From 205ddaaf002b242d6626151e6896d47008683792 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 06:18:40 +0000 Subject: [PATCH 1/3] Initial plan From 136ce5b790429583e828048cbb30c84eef4d2af1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 06:34:03 +0000 Subject: [PATCH 2/3] Add markdown-to-Javadoc formatting conversion - Added support for converting **bold** to bold - Added support for converting *italic* to italic - Added support for converting ***bold italic*** to bold italic - Added support for converting bullet lists (- item) to \n"); + inUnorderedList = false; + } + if (inOrderedList) { + result.append("\n"); + inOrderedList = false; + } + + if (!trimmedLine.isEmpty()) { + result.append(convertInlineFormatting(line)); + } + + // Add newline if not the last line + if (i < lines.length - 1) { + result.append("\n"); + } + } + } + + // Close any remaining open lists + if (inUnorderedList) { + result.append(""); + } + if (inOrderedList) { + result.append(""); + } + + return result.toString(); + } + + /** + * Converts inline Markdown formatting (bold, italic) to JavaDoc HTML tags. + * + * @param text the text with inline Markdown formatting + * @return the text with JavaDoc HTML formatting + */ + private static String convertInlineFormatting(String text) { + if (text == null || text.isEmpty()) { + return text; + } + + // Convert ***bold italic*** first (must come before ** and *) + text = BOLD_ITALIC_PATTERN.matcher(text).replaceAll("$1"); + + // Convert **bold** + text = BOLD_PATTERN.matcher(text).replaceAll("$1"); + + // Convert *italic* + text = ITALIC_PATTERN.matcher(text).replaceAll("$1"); + + return text; + } + private static String processText(String value) { - String text = CodeNamer.escapeXmlComment(ensurePeriod(trim(value))); - if (text != null) { + String text = trim(value); + if (text != null && !text.isEmpty()) { + // Convert Markdown formatting to JavaDoc HTML tags + text = convertMarkdownToJavadoc(text); + // Ensure period at the end + text = ensurePeriod(text); + // Escape XML special characters + text = CodeNamer.escapeXmlComment(text); // escape "@" that isn't prefixed with "{" text = ESCAPE_AT.matcher(text).replaceAll("@"); // escape tab diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/README.md b/packages/http-client-java/generator/http-client-generator-test/specs/README.md new file mode 100644 index 00000000000..fb1e5e7d92a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/README.md @@ -0,0 +1,3 @@ +# HTTP Test scenarios + +**_Pending_** diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/main.tsp new file mode 100644 index 00000000000..e7ee63add64 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/main.tsp @@ -0,0 +1,40 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@scenarioService("/authentication/api-key") +@doc("Illustrates clients generated with ApiKey authentication.") +@useAuth(ApiKeyAuth) +namespace Authentication.ApiKey; + +@scenario +@scenarioDoc("Expects header 'x-ms-api-key': 'valid-key'") +@doc("Check whether client is authenticated") +@get +@route("/valid") +op valid(): NoContentResponse; + +@scenario +@scenarioDoc(""" + Expect error code 403 and error body: + ```json + { + "error": { + "code": "InvalidApiKey", + "message": "API key is invalid" + } + } + ``` + """) +@doc("Check whether client is authenticated.") +@get +@route("/invalid") +op invalid(): NoContentResponse | InvalidAuth; + +@error +model InvalidAuth { + @statusCode _: 403; + error: string; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/mockapi.ts new file mode 100644 index 00000000000..db82b7319cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/mockapi.ts @@ -0,0 +1,35 @@ +import { json, passOnCode, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Authentication_ApiKey_invalid = passOnCode(403, { + uri: `/authentication/api-key/invalid`, + method: `get`, + request: { + headers: { + "x-ms-api-key": "invalid-key", + }, + status: 403, + }, + response: { + status: 403, + body: json({ + error: "invalid-api-key", + }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Authentication_ApiKey_valid = passOnSuccess({ + uri: `/authentication/api-key/valid`, + method: `get`, + request: { + headers: { + "x-ms-api-key": "valid-key", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/main.tsp new file mode 100644 index 00000000000..6165727803f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/main.tsp @@ -0,0 +1,40 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using TypeSpec.Http; +using Spector; + +@scenarioService("/authentication/http/custom") +@doc("Illustrates clients generated with generic HTTP auth.") +@useAuth({ + type: AuthType.http, + scheme: "SharedAccessKey", +}) +namespace Authentication.Http.Custom; + +@scenario +@scenarioDoc("Expects header 'Authorization': 'SharedAccessKey valid-key'") +@doc("Check whether client is authenticated") +@get +@route("/valid") +op valid(): NoContentResponse; + +@scenario +@scenarioDoc(""" + Expect error code 403 and error body: + ```json + { + "error": "invalid-api-key" + } + ``` + """) +@doc("Check whether client is authenticated.") +@get +@route("/invalid") +op invalid(): NoContentResponse | InvalidAuth; + +@error +model InvalidAuth { + @statusCode _: 403; + error: string; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/mockapi.ts new file mode 100644 index 00000000000..1d9e4e5ac0b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/mockapi.ts @@ -0,0 +1,35 @@ +import { json, passOnCode, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Authentication_Http_Custom_valid = passOnSuccess({ + uri: `/authentication/http/custom/valid`, + method: "get", + request: { + headers: { + authorization: "SharedAccessKey valid-key", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Authentication_Http_Custom_invalid = passOnCode(403, { + uri: `/authentication/http/custom/invalid`, + method: "get", + request: { + headers: { + authorization: "SharedAccessKey invalid-key", + }, + status: 403, + }, + response: { + status: 403, + body: json({ + error: "invalid-api-key", + }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/main.tsp new file mode 100644 index 00000000000..ced1738a657 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/main.tsp @@ -0,0 +1,45 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@scenarioService("/authentication/oauth2") +@doc("Illustrates clients generated with OAuth2 authentication.") +@useAuth(OAuth2Auth<[MyFlow]>) +namespace Authentication.OAuth2; + +model MyFlow { + type: OAuth2FlowType.implicit; + authorizationUrl: "https://login.microsoftonline.com/common/oauth2/authorize"; + scopes: ["https://security.microsoft.com/.default"]; +} + +@scenario +@scenarioDoc("Expects header 'authorization': 'Bearer https://security.microsoft.com/.default'") +@doc("Check whether client is authenticated") +@get +@route("/valid") +op valid(): NoContentResponse; + +@scenario +@scenarioDoc(""" + Expect error code 400 and error body: + ```json + { + "message": "Expected Bearer x but got Bearer y", + "expected": "Bearer x", + "actual": "Bearer y", + } + ``` + """) +@doc("Check whether client is authenticated. Will return an invalid bearer error.") +@get +@route("/invalid") +op invalid(): NoContentResponse | InvalidAuth; + +@error +model InvalidAuth { + @statusCode _: 403; + error: string; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/mockapi.ts new file mode 100644 index 00000000000..3911a1e37de --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/mockapi.ts @@ -0,0 +1,32 @@ +import { json, passOnCode, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Authentication_OAuth2_valid = passOnSuccess({ + uri: `/authentication/oauth2/valid`, + method: "get", + request: { + headers: { + authorization: "Bearer https://security.microsoft.com/.default", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Authentication_OAuth2_invalid = passOnCode(403, { + uri: `/authentication/oauth2/invalid`, + method: "get", + request: { + status: 403, + }, + response: { + status: 403, + body: json({ + error: "invalid-grant", + }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/main.tsp new file mode 100644 index 00000000000..9d6afef5c87 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/main.tsp @@ -0,0 +1,30 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@scenarioService("/authentication/union") +@doc("Illustrates clients generated with ApiKey and OAuth2 authentication.") +@useAuth(ApiKeyAuth | OAuth2Auth<[MyFlow]>) +namespace Authentication.Union; + +model MyFlow { + type: OAuth2FlowType.implicit; + authorizationUrl: "https://login.microsoftonline.com/common/oauth2/authorize"; + scopes: ["https://security.microsoft.com/.default"]; +} + +@scenario +@scenarioDoc("Expects header 'x-ms-api-key': 'valid-key'") +@doc("Check whether client is authenticated") +@get +@route("/validkey") +op validKey(): NoContentResponse; + +@scenario +@scenarioDoc("Expects header 'authorization': 'Bearer https://security.microsoft.com/.default'") +@doc("Check whether client is authenticated") +@get +@route("/validtoken") +op validToken(): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/mockapi.ts new file mode 100644 index 00000000000..e52e327ec34 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/mockapi.ts @@ -0,0 +1,31 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Authentication_Union_validKey = passOnSuccess({ + uri: `/authentication/union/validkey`, + method: "get", + request: { + headers: { + "x-ms-api-key": "valid-key", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Authentication_Union_validToken = passOnSuccess({ + uri: `/authentication/union/validtoken`, + method: "get", + request: { + headers: { + authorization: "Bearer https://security.microsoft.com/.default", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/main.tsp new file mode 100644 index 00000000000..e3c17c5b5d8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/main.tsp @@ -0,0 +1,192 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Azure.ClientGenerator.Core; +using Spector; + +@doc("Test for internal decorator.") +@scenarioService("/azure/client-generator-core/access") +@global.Azure.ClientGenerator.Core.clientNamespace("azure.clientgenerator.core.access", "java") +namespace _Specs_.Azure.ClientGenerator.Core.Access; + +@route("/publicOperation") +@global.Azure.ClientGenerator.Core.operationGroup +@scenario +@scenarioDoc(""" + This scenario contains public operations. It should be generated and exported. + Expected query parameter: name="sample" + Expected response body: + ```json + { + "name": "sample" + } + ``` + """) +namespace PublicOperation { + @doc("Used in a public operation, should be generated and exported.") + model NoDecoratorModelInPublic { + name: string; + } + + @doc("Used in a public operation, should be generated and exported.") + @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.public) + model PublicDecoratorModelInPublic { + name: string; + } + + @route("/noDecoratorInPublic") + @get + @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.public) + op noDecoratorInPublic(@query name: string): NoDecoratorModelInPublic; + + @route("/publicDecoratorInPublic") + @get + @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.public) + op publicDecoratorInPublic(@query name: string): PublicDecoratorModelInPublic; +} + +@route("/internalOperation") +@global.Azure.ClientGenerator.Core.operationGroup +@scenario +@scenarioDoc(""" + This scenario contains internal operations. All should be generated but not exposed. + Expected query parameter: name="sample" + Expected response body: + ```json + { + "name": "sample" + } + ``` + """) +namespace InternalOperation { + @doc("Used in an internal operation, should be generated but not exported.") + model NoDecoratorModelInInternal { + name: string; + } + + @doc("Used in an internal operation, should be generated but not exported.") + @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) + model InternalDecoratorModelInInternal { + name: string; + } + + @doc("Used in an internal operation but with public decorator, should be generated and exported.") + @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.public) + model PublicDecoratorModelInInternal { + name: string; + } + + @route("/noDecoratorInInternal") + @get + @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) + op noDecoratorInInternal(@query name: string): NoDecoratorModelInInternal; + + @route("/internalDecoratorInInternal") + @get + @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) + op internalDecoratorInInternal(@query name: string): InternalDecoratorModelInInternal; + + @route("/publicDecoratorInInternal") + @get + @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) + op publicDecoratorInInternal(@query name: string): PublicDecoratorModelInInternal; +} + +@route("/sharedModelInOperation") +@global.Azure.ClientGenerator.Core.operationGroup +@scenario +@scenarioDoc(""" + This scenario contains two operations, one public, another internal. The public one should be generated and exported while the internal one should be generated but not exposed. + Expected query parameter: name="sample" + Expected response body: + ```json + { + "name": "sample" + } + ``` + """) +namespace SharedModelInOperation { + @doc("Used by both public and internal operation. It should be generated and exported.") + model SharedModel { + name: string; + } + + @route("/public") + @get + @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.public) + op `public`(@query name: string): SharedModel; + + @route("/internal") + @get + @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) + op `internal`(@query name: string): SharedModel; +} + +@route("/relativeModelInOperation") +@global.Azure.ClientGenerator.Core.operationGroup +@scenario +@scenarioDoc(""" + This scenario contains internal operations. All should be generated but not exposed. + """) +namespace RelativeModelInOperation { + @doc("Used in internal operations, should be generated but not exported.") + model OuterModel extends BaseModel { + inner: InnerModel; + } + + @doc("Used in internal operations, should be generated but not exported.") + model InnerModel { + name: string; + } + + @doc("Used in internal operations, should be generated but not exported.") + model BaseModel { + name: string; + } + + @doc("Used in internal operations, should be generated but not exported.") + @discriminator("kind") + model AbstractModel { + name: string; + } + + @doc("Used in internal operations, should be generated but not exported.") + model RealModel extends AbstractModel { + kind: "real"; + } + + @doc(""" + Expected query parameter: name="Madge" + Expected response body: + ```json + { + "name": "Madge", + "inner": + { + "name": "Madge" + } + } + ``` + """) + @route("/operation") + @get + @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) + op operation(@query name: string): OuterModel; + + @doc(""" + Expected query parameter: kind="real" + Expected response body: + ```json + { + "name": "Madge", + "kind": "real" + } + ``` + """) + @route("/discriminator") + @get + @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) + op discriminator(@query kind: string): AbstractModel; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/mockapi.ts new file mode 100644 index 00000000000..eff4874cc81 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/mockapi.ts @@ -0,0 +1,67 @@ +import { json, MockApiDefinition, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createMockApiDefinitions(route: string): MockApiDefinition { + return { + uri: `/azure/client-generator-core/access/${route}`, + method: "get", + request: { + query: { + name: "sample", + }, + }, + response: { + status: 200, + body: json({ name: "sample" }), + }, + kind: "MockApiDefinition", + }; +} + +Scenarios.Azure_ClientGenerator_Core_Access_PublicOperation = passOnSuccess([ + createMockApiDefinitions("publicOperation/noDecoratorInPublic"), + createMockApiDefinitions("publicOperation/publicDecoratorInPublic"), +]); + +Scenarios.Azure_ClientGenerator_Core_Access_InternalOperation = passOnSuccess([ + createMockApiDefinitions("internalOperation/noDecoratorInInternal"), + createMockApiDefinitions("internalOperation/internalDecoratorInInternal"), + createMockApiDefinitions("internalOperation/publicDecoratorInInternal"), +]); + +Scenarios.Azure_ClientGenerator_Core_Access_SharedModelInOperation = passOnSuccess([ + createMockApiDefinitions("sharedModelInOperation/public"), + createMockApiDefinitions("sharedModelInOperation/internal"), +]); + +Scenarios.Azure_ClientGenerator_Core_Access_RelativeModelInOperation = passOnSuccess([ + { + uri: "/azure/client-generator-core/access/relativeModelInOperation/operation", + method: "get", + request: { + query: { + name: "Madge", + }, + }, + response: { + status: 200, + body: json({ name: "Madge", inner: { name: "Madge" } }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/access/relativeModelInOperation/discriminator", + method: "get", + request: { + query: { + kind: "real", + }, + }, + response: { + status: 200, + body: json({ name: "Madge", kind: "real" }), + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/client.tsp new file mode 100644 index 00000000000..737b57f8f0e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/client.tsp @@ -0,0 +1,45 @@ +import "@azure-tools/typespec-client-generator-core"; +import "./main.tsp"; + +using Azure.ClientGenerator.Core; + +@@global.Azure.ClientGenerator.Core.clientNamespace(_Specs_.Azure.ClientGenerator.Core.AlternateType, + "azure.clientgenerator.core.alternatetype", + "java" +); + +@@alternateType(_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.Feature, + { + identity: "geojson.Feature", + package: "geojson", + minVersion: "3.2.0", + }, + "python" +); + +@@alternateType(_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.Feature, + { + identity: "com.azure.core.models.GeoObject", // cSpell:ignore GeoObject + package: "com.azure.core", + minVersion: "1.14.0", + }, + "java" +); + +@@alternateType(_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.Feature, + { + identity: "NetTopologySuite.IO.GeoJSON.Feature", + package: "NetTopologySuite.IO.GeoJSON", + minVersion: "4.0.0", + }, + "csharp" +); + +@@alternateType(_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.Feature, + { + identity: "NetTopologySuite.IO.GeoJSON.Feature", + package: "@types/geojson", + minVersion: "7946.0.0", + }, + "typescript" +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/main.tsp new file mode 100644 index 00000000000..ba27cca219d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/main.tsp @@ -0,0 +1,139 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Azure.ClientGenerator.Core; +using Spector; + +@doc("Test for alternate type decorator") +@scenarioService("/azure/client-generator-core/alternate-type") +@service +namespace _Specs_.Azure.ClientGenerator.Core.AlternateType; + +@global.Azure.ClientGenerator.Core.operationGroup +@route("/external") +@doc("Test using language-idiomatic external types for defined TypeSpec types") +namespace ExternalType { + model Geometry { + type: string; + coordinates: numeric[]; + } + + model Feature { + type: "Feature"; + geometry: Geometry | null; + properties: Record; + id?: string | numeric; + } + + model ModelWithFeatureProperty { + feature: Feature; + additionalProperty: string; + } + @scenario + @scenarioDoc(""" + Input: None + Output: Feature object with geometry, properties, and optional id fields. + Example response: + ```json + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.25, 37.87] + }, + "properties": { + "name": "A single point of interest", + "category": "landmark", + "elevation": 100 + }, + "id": "feature-1" + } + ``` + """) + @route("/model") + @get + op getModel(): Feature; + + @scenario + @scenarioDoc(""" + Input: Feature object in request body. + Example input: + ```json + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.25, 37.87] + }, + "properties": { + "name": "A single point of interest", + "category": "landmark", + "elevation": 100 + }, + "id": "feature-1" + } + ``` + Output: None (204/empty response) + """) + @route("/model") + @put + op putModel(@body body: Feature): void; + + @scenario + @scenarioDoc(""" + Input: None + Output: ModelWithFeatureProperty object with feature and additionalProperty fields. + Example response: + ```json + { + "feature": { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.25, 37.87] + }, + "properties": { + "name": "A single point of interest", + "category": "landmark", + "elevation": 100 + }, + "id": "feature-1" + }, + "additionalProperty": "extra" + } + ``` + """) + @route("/property") + @get + op getProperty(): ModelWithFeatureProperty; + + @scenario + @scenarioDoc(""" + Input: ModelWithFeatureProperty object in request body. + Example input: + ```json + { + "feature": { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.25, 37.87] + }, + "properties": { + "name": "A single point of interest", + "category": "landmark", + "elevation": 100 + }, + "id": "feature-1" + }, + "additionalProperty": "extra" + } + ``` + Output: None (204/empty response) + """) + @route("/property") + @put + op putProperty(@body body: ModelWithFeatureProperty): void; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/mockapi.ts new file mode 100644 index 00000000000..ed83dd8632f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/mockapi.ts @@ -0,0 +1,75 @@ +import { + json, + MockApiDefinition, + MockBody, + passOnSuccess, + ScenarioMockApi, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createMockApiDefinitions( + route: string, + body: MockBody, +): [MockApiDefinition, MockApiDefinition] { + return [ + { + uri: `/azure/client-generator-core/alternate-type/external/${route}`, + method: "get", + response: { + status: 200, + body: body, + }, + kind: "MockApiDefinition", + }, + { + uri: `/azure/client-generator-core/alternate-type/external/${route}`, + method: "put", + request: { + body, + }, + response: { status: 204 }, + kind: "MockApiDefinition", + }, + ]; +} + +const feature = { + type: "Feature", + geometry: { + type: "Point", + coordinates: [-122.25, 37.87], + }, + properties: { + name: "A single point of interest", + category: "landmark", + elevation: 100, + }, + id: "feature-1", +}; + +const modelScenarioTypes = createMockApiDefinitions("model", json(feature)); + +Scenarios.Azure_ClientGenerator_Core_AlternateType_ExternalType_getModel = passOnSuccess( + modelScenarioTypes[0], +); +Scenarios.Azure_ClientGenerator_Core_AlternateType_ExternalType_putModel = passOnSuccess( + modelScenarioTypes[1], +); + +const modelWithFeatureProperty = { + feature, + additionalProperty: "extra", +}; + +const modelPropertyScenarioTypes = createMockApiDefinitions( + "property", + json(modelWithFeatureProperty), +); + +Scenarios.Azure_ClientGenerator_Core_AlternateType_ExternalType_getProperty = passOnSuccess( + modelPropertyScenarioTypes[0], +); +Scenarios.Azure_ClientGenerator_Core_AlternateType_ExternalType_putProperty = passOnSuccess( + modelPropertyScenarioTypes[1], +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/client.tsp new file mode 100644 index 00000000000..5465aeb240f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/client.tsp @@ -0,0 +1,18 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; +import "./main.tsp"; + +using Http; +using Azure.ClientGenerator.Core; +using Client.AlternateApiVersion.Service.Header; +using Spector; + +namespace Customizations; + +@@apiVersion(HeaderApiVersionParam.version); + +@@clientNamespace(Client.AlternateApiVersion.Service.Header, + "azure.clientgenerator.core.apiversion.header", + "java" +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/main.tsp new file mode 100644 index 00000000000..71be3af005d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/main.tsp @@ -0,0 +1,39 @@ +/** + * DO NOT GENERATE FROM THIS FILE USE client.tsp + * This is just to simulate a service entrypoint + */ +import "@typespec/http"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Versioning; +using Azure.ClientGenerator.Core; +using Spector; + +@scenarioService( + "/azure/client-generator-core/api-version/header", + { + versioned: ApiVersions, + } +) +namespace Client.AlternateApiVersion.Service.Header; + +@doc("Supported api versions.") +enum ApiVersions { + @doc("Api version 2025-01-01.") + v2025_01_01: "2025-01-01", +} + +model HeaderApiVersionParam { + @header("x-ms-version") + version: string; +} + +@scenario +@scenarioDoc("Set a header as the service api version") +@doc("Header api version parameter.") +@post +op headerApiVersion(...HeaderApiVersionParam): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/mockapi.ts new file mode 100644 index 00000000000..554c04fc7c1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/mockapi.ts @@ -0,0 +1,19 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Client_AlternateApiVersion_Service_Header_headerApiVersion = passOnSuccess([ + { + uri: "/azure/client-generator-core/api-version/header", + method: "post", + request: { + headers: { + "x-ms-version": "2025-01-01", + }, + }, + response: { + status: 200, + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/client.tsp new file mode 100644 index 00000000000..bfa8b654f84 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/client.tsp @@ -0,0 +1,18 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; +import "./main.tsp"; + +using Http; +using Azure.ClientGenerator.Core; +using Client.AlternateApiVersion.Service.Path; +using Spector; + +namespace Customizations; + +@@apiVersion(PathApiVersionParam.version); + +@@clientNamespace(Client.AlternateApiVersion.Service.Path, + "azure.clientgenerator.core.apiversion.path", + "java" +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/main.tsp new file mode 100644 index 00000000000..fe395284d26 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/main.tsp @@ -0,0 +1,40 @@ +/** + * DO NOT GENERATE FROM THIS FILE USE client.tsp + * This is just to simulate a service entrypoint + */ +import "@typespec/http"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Versioning; +using Azure.ClientGenerator.Core; +using Spector; + +@scenarioService( + "/azure/client-generator-core/api-version/path", + { + versioned: ApiVersions, + } +) +namespace Client.AlternateApiVersion.Service.Path; + +@doc("Supported api versions.") +enum ApiVersions { + @doc("Api version 2025-01-01.") + v2025_01_01: "2025-01-01", +} + +model PathApiVersionParam { + @path + version: string; +} + +@scenario +@scenarioDoc("Set a path service api version") +@doc("Path api version parameter.") +@route("{version}") +@post +op pathApiVersion(...PathApiVersionParam): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/mockapi.ts new file mode 100644 index 00000000000..18905d1f368 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/mockapi.ts @@ -0,0 +1,15 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Client_AlternateApiVersion_Service_Path_pathApiVersion = passOnSuccess([ + { + uri: "/azure/client-generator-core/api-version/path/2025-01-01", + method: "post", + request: {}, + response: { + status: 200, + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/client.tsp new file mode 100644 index 00000000000..97c588069d7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/client.tsp @@ -0,0 +1,18 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; +import "./main.tsp"; + +using Http; +using Azure.ClientGenerator.Core; +using Client.AlternateApiVersion.Service.Query; +using Spector; + +namespace Customizations; + +@@apiVersion(QueryApiVersionParam.version); + +@@clientNamespace(Client.AlternateApiVersion.Service.Query, + "azure.clientgenerator.core.apiversion.query", + "java" +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/main.tsp new file mode 100644 index 00000000000..68319c24913 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/main.tsp @@ -0,0 +1,39 @@ +/** + * DO NOT GENERATE FROM THIS FILE USE client.tsp + * This is just to simulate a service entrypoint + */ +import "@typespec/http"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Versioning; +using Azure.ClientGenerator.Core; +using Spector; + +@scenarioService( + "/azure/client-generator-core/api-version/query", + { + versioned: ApiVersions, + } +) +namespace Client.AlternateApiVersion.Service.Query; + +@doc("Supported api versions.") +enum ApiVersions { + @doc("Api version 2025-01-01.") + v2025_01_01: "2025-01-01", +} + +model QueryApiVersionParam { + @query + version: string; +} + +@scenario +@scenarioDoc("Set a query parameter as the service api version") +@doc("Query api version parameter.") +@post +op queryApiVersion(...QueryApiVersionParam): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/mockapi.ts new file mode 100644 index 00000000000..782ffb6687d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/mockapi.ts @@ -0,0 +1,19 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Client_AlternateApiVersion_Service_Query_queryApiVersion = passOnSuccess([ + { + uri: "/azure/client-generator-core/api-version/query", + method: "post", + request: { + query: { + version: "2025-01-01", + }, + }, + response: { + status: 200, + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/client.tsp new file mode 100644 index 00000000000..6859e310883 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/client.tsp @@ -0,0 +1,246 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/spector"; +import "@typespec/http"; + +using Spector; +using Http; + +@route("/azure/client-generator-core/client-initialization") +namespace _Specs_.Azure.ClientGenerator.Core.ClientInitialization; + +@@global.Azure.ClientGenerator.Core.clientNamespace(_Specs_.Azure.ClientGenerator.Core.ClientInitialization, + "azure.clientgenerator.core.clientinitialization", + "java" +); +@@global.Azure.ClientGenerator.Core.clientNamespace(Service, + "azure.clientgenerator.core.clientinitialization", + "java" +); + +model HeaderParamClientOptions { + @doc("The name of the client. This parameter is used as a header in all operations.") + name: string; +} + +model MultipleParamsClientOptions { + @doc("The name of the client. This parameter is used as a header in all operations.") + name: string; + + @doc("The region to use for all operations. This parameter is used as a query parameter.") + region: string; +} + +model MixedParamsClientOptions { + @doc("The name of the client. This parameter is used as a header in all operations.") + name: string; +} + +model PathParamClientOptions { + @doc("The name of the blob. This parameter is used as a path parameter in all operations.") + blobName: string; +} + +model ParamAliasClientOptions { + @doc("Blob name for the client.") + @global.Azure.ClientGenerator.Core.paramAlias("blob") + blobName: string; +} + +// Scenario 1: Header parameter moved to client level +@scenarioDoc(""" + Client for testing header parameter moved to client level. + + Parameters elevated to client level: + - name: "test-name-value" (header parameter) + + Expected client usage: + ```ts + const client = new HeaderParamClient({ + name: "test-name-value" + }); + + client.withQuery(id: "test-id"); // No need to pass name here + client.withBody({ name: "test-name" }); // No need to pass name here + ``` + """) +@scenario +@doc("Client for testing header parameter moved to client level.") +@global.Azure.ClientGenerator.Core.client({ + name: "HeaderParamClient", + service: Service, +}) +@global.Azure.ClientGenerator.Core.clientInitialization(HeaderParamClientOptions) +@route("/header-param") +interface HeaderParam { + withQuery is Service.HeaderParam.withQuery; + withBody is Service.HeaderParam.withBody; +} + +// Scenario 2: Multiple parameters (header and query) moved to client level +@scenarioDoc(""" + Client for testing multiple parameters (header and query) moved to client level. + + Parameters elevated to client level: + - name: "test-name-value" (header parameter) + - region: "us-west" (query parameter) + + Expected client usage: + ```ts + const client = new MultipleParamsClient({ + name: "test-name-value", + region: "us-west" + }); + + client.withQuery(id: "test-id"); // No need to pass name or region here + client.withBody({ name: "test-name" }); // No need to pass name or region here + ``` + """) +@scenario +@global.Azure.ClientGenerator.Core.client({ + name: "MultipleParamsClient", + service: Service, +}) +@global.Azure.ClientGenerator.Core.clientInitialization(MultipleParamsClientOptions) +@route("/multiple-params") +interface MultipleParams { + withQuery is Service.MultipleParams.withQuery; + withBody is Service.MultipleParams.withBody; +} + +// Scenario 3: Mix of client-level and method-level parameters +@scenarioDoc(""" + Client for testing a mix of client-level and method-level parameters. + + Parameters elevated to client level: + - name: "test-name-value" (header parameter) + + Parameters remaining at method level: + - region: "us-west" (query parameter) + + Expected client usage: + ```ts + const client = new MixedParamsClient({ + name: "test-name-value" + }); + + client.withQuery(region: "us-west", id: "test-id"); // region stays as method param + client.withBody( region: "us-west", body: { name: "test-name" }); // region stays as method param + ``` + """) +@scenario +@global.Azure.ClientGenerator.Core.client({ + name: "MixedParamsClient", + service: Service, +}) +@global.Azure.ClientGenerator.Core.clientInitialization(MixedParamsClientOptions) +@route("/mixed-params") +interface MixedParams { + withQuery is Service.MixedParams.withQuery; + withBody is Service.MixedParams.withBody; +} + +// Scenario 4: Path parameter moved to client level +@scenarioDoc(""" + Client for testing a path parameter (blobName) moved to client level. + + Parameters elevated to client level: + - blobName: "sample-blob" (path parameter) + + Expected client usage: + ```ts + const client = new PathParamClient({ + blobName: "sample-blob" + }); + + // No need to pass blobName to any operations + client.withQuery(format: "text"); + client.getStandalone(); + client.deleteStandalone(); + ``` + """) +@scenario +@global.Azure.ClientGenerator.Core.client({ + name: "PathParamClient", + service: Service, +}) +@global.Azure.ClientGenerator.Core.clientInitialization(PathParamClientOptions) +@route("/path") +interface PathParam { + withQuery is Service.PathParam.withQuery; + getStandalone is Service.PathParam.getStandalone; + deleteStandalone is Service.PathParam.deleteStandalone; +} + +// Scenario 5: Parameter aliases for better client API names +@scenarioDoc(""" + Client for testing the @paramAlias decorator for renaming parameters in client code. + + Parameters elevated to client level: + - blobName: "sample-blob" (path parameter) + + Expected client usage: + ```ts + // Elevated to client level via alias + client.withAliasedName(); + + // Elevated to client level via original name + client.withOriginalName(); + ``` + """) +@scenario +@global.Azure.ClientGenerator.Core.clientInitialization(ParamAliasClientOptions) +@global.Azure.ClientGenerator.Core.client({ + name: "ParamAliasClient", + service: Service, +}) +@route("/param-alias") +interface ParamAlias { + withAliasedName is Service.ParamAlias.withAliasedName; + withOriginalName is Service.ParamAlias.withOriginalName; +} + +@global.Azure.ClientGenerator.Core.client({ + name: "ParentClient", + service: Service, +}) +namespace ParentClient { + @scenarioDoc(""" + Client for testing a path parameter (blobName) moved to client level, in child client. + + The child client can be initialized individually, or via its parent client. + + Parameters elevated to client level: + - blobName: "sample-blob" (path parameter) + + Expected client usage: + ```ts + // via ParentClient + const client = new ParentClient.getChildClient({ + blobName: "sample-blob" + }); + + // directly + const client = new ChildClient({ + blobName: "sample-blob" + }); + + // No need to pass blobName to any operations + client.withQuery(format: "text"); + client.getStandalone(); + client.deleteStandalone(); + ``` + """) + @scenario + @global.Azure.ClientGenerator.Core.operationGroup + @global.Azure.ClientGenerator.Core.clientInitialization({ + parameters: PathParamClientOptions, + initializedBy: global.Azure.ClientGenerator.Core.InitializedBy.individually | global.Azure.ClientGenerator.Core.InitializedBy.parent, + }) + @route("/child-client") + interface ChildClient { + withQuery is Service.ChildClient.withQuery; + getStandalone is Service.ChildClient.getStandalone; + deleteStandalone is Service.ChildClient.deleteStandalone; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/main.tsp new file mode 100644 index 00000000000..883e1218aa8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/main.tsp @@ -0,0 +1,133 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Spector; +using Azure.ClientGenerator.Core; + +@doc("Test for client initialization decorator - moving parameters from method to client level") +@scenarioService("/azure/client-generator-core/client-initialization") +namespace Service; + +// Common parameter types and models + +model NameHeaderParam { + @header("name") + name: string; +} + +model RegionQueryParam { + @query + region: string; +} + +model Input { + name: string; +} + +// Scenario 1: Header parameter moved to client level + +@route("/header-param") +interface HeaderParam { + @route("/with-query") + @get + withQuery(...NameHeaderParam, @query id: string): void; + + @route("/with-body") + @post + withBody(...NameHeaderParam, @body body: Input): void; +} + +// Scenario 2: Multiple parameters (header and query) moved to client level + +@route("/multiple-params") +interface MultipleParams { + @route("/with-query") + @get + withQuery(...NameHeaderParam, ...RegionQueryParam, @query id: string): void; + + @route("/with-body") + @post + withBody(...NameHeaderParam, ...RegionQueryParam, @body body: Input): void; +} + +// Scenario 3: Mix of client-level and method-level parameters + +@route("/mixed-params") +interface MixedParams { + @route("/with-query") + @get + withQuery(...NameHeaderParam, ...RegionQueryParam, @query id: string): void; + + @route("/with-body") + @post + withBody( + ...NameHeaderParam, + ...RegionQueryParam, + @body body: { + name: string; + }, + ): void; +} + +// Scenario 4: Path parameter moved to client level +@doc("Blob operations with path parameter that should be moved to client level") +@route("/path") +interface PathParam { + @route("/{blobName}/with-query") + @get + withQuery(@path blobName: string, @query format?: string): void; + + @route("/{blobName}/get-standalone") + @get + getStandalone(@path blobName: string): BlobProperties; + + @route("/{blobName}") + @delete + deleteStandalone(@path blobName: string): void; +} + +// Scenario 5: Parameter aliases for better client API names +@doc("Operations demonstrating the @paramAlias decorator for renaming parameters in client code") +@route("/param-alias") +interface ParamAlias { + @route("/{blob}/with-aliased-name") + @get + withAliasedName( + @path + blob: string, + ): void; + + @route("/{blobName}/with-original-name") + @get + withOriginalName( + @path + blobName: string, + ): void; +} + +@doc("Properties of a blob") +model BlobProperties { + name: string; + size: int64; + contentType: string; + createdOn: utcDateTime; +} + +// Scenario 6: Client initialization on child client +@doc("Blob operations with path parameter that should be moved to client level, in child client") +@route("/child-client") +interface ChildClient { + @route("/{blobName}/with-query") + @get + withQuery(@path blobName: string, @query format?: string): void; + + @route("/{blobName}/get-standalone") + @get + getStandalone(@path blobName: string): BlobProperties; + + @route("/{blobName}") + @delete + deleteStandalone(@path blobName: string): void; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/mockapi.ts new file mode 100644 index 00000000000..0b6df10133c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/mockapi.ts @@ -0,0 +1,223 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +// Mock responses for HeaderParam scenario +Scenarios.Azure_ClientGenerator_Core_ClientInitialization_HeaderParam = passOnSuccess([ + { + uri: "/azure/client-generator-core/client-initialization/header-param/with-query", + method: "get", + request: { + query: { + id: "test-id", + }, + headers: { + name: "test-name-value", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/client-initialization/header-param/with-body", + method: "post", + request: { + headers: { + name: "test-name-value", + }, + body: json({ + name: "test-name", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +// Mock responses for MultipleParams scenario +Scenarios.Azure_ClientGenerator_Core_ClientInitialization_MultipleParams = passOnSuccess([ + { + uri: "/azure/client-generator-core/client-initialization/multiple-params/with-query", + method: "get", + request: { + query: { + id: "test-id", + region: "us-west", + }, + headers: { + name: "test-name-value", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/client-initialization/multiple-params/with-body", + method: "post", + request: { + query: { + region: "us-west", + }, + headers: { + name: "test-name-value", + }, + body: json({ + name: "test-name", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +// Mock responses for MixedParams scenario +Scenarios.Azure_ClientGenerator_Core_ClientInitialization_MixedParams = passOnSuccess([ + { + uri: "/azure/client-generator-core/client-initialization/mixed-params/with-query", + method: "get", + request: { + query: { + id: "test-id", + region: "us-west", + }, + headers: { + name: "test-name-value", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/client-initialization/mixed-params/with-body", + method: "post", + request: { + query: { + region: "us-west", + }, + headers: { + name: "test-name-value", + }, + body: json({ + name: "test-name", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +// Mock responses for PathParam scenario +Scenarios.Azure_ClientGenerator_Core_ClientInitialization_PathParam = passOnSuccess([ + { + uri: "/azure/client-generator-core/client-initialization/path/sample-blob/with-query", + method: "get", + request: { + query: { + format: "text", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/client-initialization/path/sample-blob/get-standalone", + method: "get", + request: {}, + response: { + status: 200, + body: json({ + name: "sample-blob", + size: 42, + contentType: "text/plain", + createdOn: "2025-04-01T12:00:00Z", + }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/client-initialization/path/sample-blob", + method: "delete", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +// Mock responses for ParamAlias scenario +Scenarios.Azure_ClientGenerator_Core_ClientInitialization_ParamAlias = passOnSuccess([ + { + uri: "/azure/client-generator-core/client-initialization/param-alias/sample-blob/with-aliased-name", + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/client-initialization/param-alias/sample-blob/with-original-name", + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +// Mock responses for ParentClient/ChildClient scenario +Scenarios.Azure_ClientGenerator_Core_ClientInitialization_ParentClient_ChildClient = passOnSuccess([ + { + uri: "/azure/client-generator-core/client-initialization/child-client/sample-blob/with-query", + method: "get", + request: { + query: { + format: "text", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/client-initialization/child-client/sample-blob/get-standalone", + method: "get", + request: {}, + response: { + status: 200, + body: json({ + name: "sample-blob", + size: 42, + contentType: "text/plain", + createdOn: "2025-04-01T12:00:00Z", + }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/client-initialization/child-client/sample-blob", + method: "delete", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/main.tsp new file mode 100644 index 00000000000..622437a5925 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/main.tsp @@ -0,0 +1,131 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Spector; +using Azure.ClientGenerator.Core; + +@doc("Test for @clientLocation decorator - moving operations between clients") +@scenarioService("/azure/client-generator-core/client-location") +@global.Azure.ClientGenerator.Core.clientNamespace( + "azure.clientgenerator.core.clientlocation", + "java" +) +namespace _Specs_.Azure.ClientGenerator.Core.ClientLocation; + +// Scenario 1: Move an operation to another sub client (existing interface) +@scenarioDoc(""" + Test moving an operation from one sub client to another existing sub client. + + Operation `deleteUser` from interface `UserOperations` should be moved to interface `AdminOperations` using @clientLocation(AdminOperations). + + Expected client structure: + - Interface UserOperations should contain only operation `getUser` + - Interface AdminOperations should contain operations `getAdminInfo` and `deleteUser` (moved from UserOperations) + """) +@scenario +namespace MoveToExistingSubClient { + interface UserOperations { + @route("/user") + @get + getUser(): void; + + @route("/user") + @delete + @global.Azure.ClientGenerator.Core.clientLocation(AdminOperations) + deleteUser(): void; + } + + interface AdminOperations { + @route("/admin") + @get + getAdminInfo(): void; + } +} + +// Scenario 2: Move an operation to a new sub client (string name) +@scenarioDoc(""" + Test moving an operation to a new sub client specified by string name. + + Operation `archiveProduct` from interface `ProductOperations` should be moved to a new sub client named "ArchiveOperations" using @clientLocation("ArchiveOperations"). + + Expected client structure: + - Interface ProductOperations should contain only operation `listProducts` + - A new sub client "ArchiveOperations" should be created containing operation `archiveProduct` + """) +@scenario +namespace MoveToNewSubClient { + interface ProductOperations { + @route("/products") + @get + listProducts(): void; + + @route("/products/archive") + @post + @global.Azure.ClientGenerator.Core.clientLocation("ArchiveOperations") + archiveProduct(): void; + } +} + +// Scenario 3: Move an operation to root client +@scenarioDoc(""" + Test moving an operation to the root client. + + Operation `getHealthStatus` from interface `ResourceOperations` should be moved to the root client using @clientLocation(service namespace). + + Expected client structure: + - Interface ResourceOperations should contain only operation `getResource` + - Root client should contain operation `getHealthStatus` (moved from ResourceOperations) + """) +@scenario +namespace MoveToRootClient { + interface ResourceOperations { + @route("/resource") + @get + getResource(): void; + + @route("/health") + @get + @global.Azure.ClientGenerator.Core.clientLocation( + _Specs_.Azure.ClientGenerator.Core.ClientLocation + ) + getHealthStatus(): void; + } +} + +// Scenario 4: Move method parameter to client +@scenarioDoc(""" + Test moving a method parameter to client. + + The parameter `storageAccount` from operation `getBlob` should be moved to the `MoveMethodParameterToClient` in the generated code. + + Expected request: + - GET /blob?storageAccount=testaccount&container=testcontainer&blob=testblob.txt + + Expected response: + - Status: 200 + - Body: {"id": "blob-001", "name": "testblob.txt", "size": 1024, "path": "/testcontainer/testblob.txt"} + """) +@scenario +namespace MoveMethodParameterToClient { + model Blob { + id: string; + name: string; + size: int32; + path: string; + } + + interface BlobOperations { + @route("/blob") + @get + getBlob( + @query + @global.Azure.ClientGenerator.Core.clientLocation(MoveMethodParameterToClient) + storageAccount: string, + + @query container: string, + @query blob: string, + ): Blob; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/mockapi.ts new file mode 100644 index 00000000000..d0bb342d9f6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/mockapi.ts @@ -0,0 +1,103 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +// Scenario 1: Move to existing sub client - Mock responses +Scenarios.Azure_ClientGenerator_Core_ClientLocation_MoveToExistingSubClient = passOnSuccess([ + { + uri: "/azure/client-generator-core/client-location/user", + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/client-location/user", + method: "delete", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/client-location/admin", + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +// Scenario 2: Move to new sub client - Mock responses +Scenarios.Azure_ClientGenerator_Core_ClientLocation_MoveToNewSubClient = passOnSuccess([ + { + uri: "/azure/client-generator-core/client-location/products", + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/client-location/products/archive", + method: "post", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +// Scenario 3: Move to root client - Mock responses +Scenarios.Azure_ClientGenerator_Core_ClientLocation_MoveToRootClient = passOnSuccess([ + { + uri: "/azure/client-generator-core/client-location/resource", + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/client-location/health", + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +// Scenario 4: Move method parameter to client - Mock responses +Scenarios.Azure_ClientGenerator_Core_ClientLocation_MoveMethodParameterToClient = passOnSuccess([ + { + uri: "/azure/client-generator-core/client-location/blob", + method: "get", + request: { + query: { + storageAccount: "testaccount", + container: "testcontainer", + blob: "testblob.txt", + }, + }, + response: { + status: 200, + body: json({ + id: "blob-001", + name: "testblob.txt", + size: 1024, + path: "/testcontainer/testblob.txt", + }), + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/main.tsp new file mode 100644 index 00000000000..e41c72f5931 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/main.tsp @@ -0,0 +1,35 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using global.Azure.ClientGenerator.Core; +using Spector; + +@doc("Test decorator @deserializeEmptyStringAsNull.") +@scenarioService("/azure/client-generator-core/deserialize-empty-string-as-null") +@global.Azure.ClientGenerator.Core.clientNamespace( + "azure.clientgenerator.core.deserialize.emptystringnull", + "java" +) +namespace _Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull; + +@doc("This is a Model contains a string-like property of type url.") +model ResponseModel { + @deserializeEmptyStringAsNull + sampleUrl: url; +} + +@scenario +@scenarioDoc(""" + This scenario will be used to test if client code can correctly deserializes an empty url as null. + Expected response body: + ```json + { + "serviceUrl": "" + } + ``` + """) +@route("/responseModel") +@get +op get(): ResponseModel; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/mockapi.ts new file mode 100644 index 00000000000..8a2efdc5521 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/mockapi.ts @@ -0,0 +1,16 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Azure_ClientGenerator_Core_DeserializeEmptyStringAsNull_get = passOnSuccess({ + uri: "/azure/client-generator-core/deserialize-empty-string-as-null/responseModel", + method: "get", + request: {}, + response: { + status: 200, + body: json({ + sampleUrl: "", + }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/main.tsp new file mode 100644 index 00000000000..242d49ece4e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/main.tsp @@ -0,0 +1,112 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using global.Azure.ClientGenerator.Core; +using Spector; + +@doc("Illustrates the model flatten cases.") +@scenarioService("/azure/client-generator-core/flatten-property") +@global.Azure.ClientGenerator.Core.clientNamespace( + "azure.clientgenerator.core.flattenproperty", + "java" +) +namespace _Specs_.Azure.ClientGenerator.Core.FlattenProperty; + +@doc("This is the model with one level of flattening.") +model FlattenModel { + name: string; + + #suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Testing backcompat" + @global.Azure.ClientGenerator.Core.Legacy.flattenProperty + properties: ChildModel; +} + +@doc("This is the model with two levels of flattening.") +model NestedFlattenModel { + name: string; + + #suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Testing backcompat" + @global.Azure.ClientGenerator.Core.Legacy.flattenProperty + properties: ChildFlattenModel; +} + +@doc("This is the child model to be flattened.") +model ChildModel { + description: string; + age: int32; +} + +@doc("This is the child model to be flattened. And it has flattened property as well.") +model ChildFlattenModel { + summary: string; + + #suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Testing backcompat" + @global.Azure.ClientGenerator.Core.Legacy.flattenProperty + properties: ChildModel; +} + +@scenario +@route("/flattenModel") +@scenarioDoc(""" + Update and receive model with 1 level of flattening. + Expected input body: + ```json + { + "name": "foo", + "properties": { + "description": "bar", + "age": 10 + } + } + ``` + + Expected response body: + ```json + { + "name": "test", + "properties": { + "description": "test", + "age": 1 + } + } + ``` + """) +@put +op putFlattenModel(@body input: FlattenModel): FlattenModel; + +@scenario +@route("/nestedFlattenModel") +@scenarioDoc(""" + Update and receive model with 2 levels of flattening. + Expected input body: + ```json + { + "name": "foo", + "properties": { + "summary": "bar", + "properties": { + "description": "test", + "age": 10 + } + } + } + ``` + + Expected response body: + ```json + { + "name": "test", + "properties": { + "summary": "test", + "properties": { + "description": "foo", + "age": 1 + } + } + } + ``` + """) +@put +op putNestedFlattenModel(@body input: NestedFlattenModel): NestedFlattenModel; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/mockapi.ts new file mode 100644 index 00000000000..8b5205d8f99 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/mockapi.ts @@ -0,0 +1,63 @@ +import { json, MockApiDefinition, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; +function createMockApiDefinitions(route: string, request: any, response: any): MockApiDefinition { + return { + uri: `/azure/client-generator-core/flatten-property/${route}`, + method: "put", + request: { + body: json(request), + }, + response: { + status: 200, + body: json(response), + }, + kind: "MockApiDefinition", + }; +} + +Scenarios.Azure_ClientGenerator_Core_FlattenProperty_putFlattenModel = passOnSuccess( + createMockApiDefinitions( + "flattenModel", + { + name: "foo", + properties: { + description: "bar", + age: 10, + }, + }, + { + name: "test", + properties: { + description: "test", + age: 1, + }, + }, + ), +); + +Scenarios.Azure_ClientGenerator_Core_FlattenProperty_putNestedFlattenModel = passOnSuccess( + createMockApiDefinitions( + "nestedFlattenModel", + { + name: "foo", + properties: { + summary: "bar", + properties: { + description: "test", + age: 10, + }, + }, + }, + { + name: "test", + properties: { + summary: "test", + properties: { + description: "foo", + age: 1, + }, + }, + }, + ), +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/main.tsp new file mode 100644 index 00000000000..4f95e3598f3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/main.tsp @@ -0,0 +1,194 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Spector; +using Azure.ClientGenerator.Core; + +@doc("Test for @hierarchyBuilding decorator.") +@scenarioService("/azure/client-generator-core/hierarchy-building") +@global.Azure.ClientGenerator.Core.clientNamespace( + "specs.azure.clientgenerator.core.hierarchybuilding", + "python" +) +@global.Azure.ClientGenerator.Core.clientNamespace( + "azure.clientgenerator.core.hierarchybuilding", + "java" +) +namespace _Specs_.Azure.ClientGenerator.Core.HierarchyBuilding; + +@discriminator("kind") +model Animal { + @doc("The kind of animal") + kind: string; + + @doc("Name of the animal") + name: string; +} + +alias PetContent = { + @doc("Whether the pet is trained") + trained: boolean; +}; + +model Pet extends Animal { + kind: "pet"; + ...PetContent; +} + +alias DogContent = { + @doc("The breed of the dog") + breed: string; +}; + +@global.Azure.ClientGenerator.Core.Legacy.hierarchyBuilding(Pet) +model Dog extends Animal { + kind: "dog"; + ...PetContent; + ...DogContent; +} + +interface AnimalOperations { + @scenario + @route("/pet/as-animal") + @scenarioDoc(""" + Test operation that accepts Animal input and returns Animal output. + Service expects Pet data and returns Pet data. + Expected request body: + ```json + { + "kind": "pet", + "name": "Buddy", + "trained": true + } + ``` + Expected response body: + ```json + { + "kind": "pet", + "name": "Buddy", + "trained": true + } + ``` + """) + @doc("Update a pet as an animal") + @put + updatePetAsAnimal(@body animal: Animal): Animal; + + @scenario + @route("/dog/as-animal") + @scenarioDoc(""" + Test operation that accepts Animal input and returns Animal output. + Service expects Dog data and returns Dog data. + Due to @hierarchyBuilding(Pet), Dog should inherit from Pet rather than Animal directly. + Expected request body: + ```json + { + "kind": "dog", + "name": "Rex", + "trained": true, + "breed": "German Shepherd" + } + ``` + Expected response body: + ```json + { + "kind": "dog", + "name": "Rex", + "trained": true, + "breed": "German Shepherd" + } + ``` + """) + @doc("Update a dog as an animal") + @put + updateDogAsAnimal(@body animal: Animal): Animal; +} + +interface PetOperations { + @scenario + @route("/pet/as-pet") + @scenarioDoc(""" + Test operation that accepts Pet input and returns Pet output. + This operation validates Pet type directly. + Expected request body: + ```json + { + "kind": "pet", + "name": "Buddy", + "trained": true + } + ``` + Expected response body: + ```json + { + "kind": "pet", + "name": "Buddy", + "trained": true + } + ``` + """) + @doc("Update a pet as a pet") + @put + updatePetAsPet(@body pet: Pet): Pet; + + @scenario + @route("/dog/as-pet") + @scenarioDoc(""" + Test operation that accepts Pet input and returns Pet output. + Service expects Dog data and returns Dog data. + This validates that Dog can be used as Pet due to @hierarchyBuilding decorator. + Expected request body: + ```json + { + "kind": "dog", + "name": "Rex", + "trained": true, + "breed": "German Shepherd" + } + ``` + Expected response body: + ```json + { + "kind": "dog", + "name": "Rex", + "trained": true, + "breed": "German Shepherd" + } + ``` + """) + @doc("Update a dog as a pet") + @put + updateDogAsPet(@body pet: Pet): Pet; +} + +interface DogOperations { + @scenario + @route("/dog/as-dog") + @scenarioDoc(""" + Test operation that accepts Dog input and returns Dog output. + This operation validates Dog type directly. + Expected request body: + ```json + { + "kind": "dog", + "name": "Rex", + "trained": true, + "breed": "German Shepherd" + } + ``` + Expected response body: + ```json + { + "kind": "dog", + "name": "Rex", + "trained": true, + "breed": "German Shepherd" + } + ``` + """) + @doc("Update a dog as a dog") + @put + updateDogAsDog(@body dog: Dog): Dog; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/mockapi.ts new file mode 100644 index 00000000000..fee2df64327 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/mockapi.ts @@ -0,0 +1,94 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +// Sample data for testing +const samplePet = { + kind: "pet", + name: "Buddy", + trained: true, +}; + +const sampleDog = { + kind: "dog", + name: "Rex", + trained: true, + breed: "German Shepherd", +}; + +// Animal operations + +Scenarios.Azure_ClientGenerator_Core_HierarchyBuilding_AnimalOperations_updatePetAsAnimal = + passOnSuccess({ + uri: "/azure/client-generator-core/hierarchy-building/pet/as-animal", + method: "put", + request: { + body: json(samplePet), + }, + response: { + status: 200, + body: json(samplePet), + }, + kind: "MockApiDefinition", + }); + +Scenarios.Azure_ClientGenerator_Core_HierarchyBuilding_AnimalOperations_updateDogAsAnimal = + passOnSuccess({ + uri: "/azure/client-generator-core/hierarchy-building/dog/as-animal", + method: "put", + request: { + body: json(sampleDog), + }, + response: { + status: 200, + body: json(sampleDog), + }, + kind: "MockApiDefinition", + }); + +// Pet operations +Scenarios.Azure_ClientGenerator_Core_HierarchyBuilding_PetOperations_updatePetAsPet = passOnSuccess( + { + uri: "/azure/client-generator-core/hierarchy-building/pet/as-pet", + method: "put", + request: { + body: json(samplePet), + }, + response: { + status: 200, + body: json(samplePet), + }, + kind: "MockApiDefinition", + }, +); + +Scenarios.Azure_ClientGenerator_Core_HierarchyBuilding_PetOperations_updateDogAsPet = passOnSuccess( + { + uri: "/azure/client-generator-core/hierarchy-building/dog/as-pet", + method: "put", + request: { + body: json(sampleDog), + }, + response: { + status: 200, + body: json(sampleDog), + }, + kind: "MockApiDefinition", + }, +); + +// Dog operations +Scenarios.Azure_ClientGenerator_Core_HierarchyBuilding_DogOperations_updateDogAsDog = passOnSuccess( + { + uri: "/azure/client-generator-core/hierarchy-building/dog/as-dog", + method: "put", + request: { + body: json(sampleDog), + }, + response: { + status: 200, + body: json(sampleDog), + }, + kind: "MockApiDefinition", + }, +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/main.tsp new file mode 100644 index 00000000000..d2690c4045b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/main.tsp @@ -0,0 +1,72 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Spector; +using Azure.ClientGenerator.Core; + +@doc("Test for @nextLinkVerb decorator.") +@scenarioService("/azure/client-generator-core/next-link-verb") +@global.Azure.ClientGenerator.Core.clientNamespace( + "azure.clientgenerator.core.nextlinkverb", + "java" +) +@global.Azure.ClientGenerator.Core.clientNamespace( + "specs.azure.clientgenerator.core.nextlinkverb", + "python" +) +namespace _Specs_.Azure.ClientGenerator.Core.NextLinkVerb; + +@doc("Test model.") +model Test { + @doc("The id of the test.") + id: string; +} + +@doc("Paged response model.") +model ListTestResult { + @pageItems + @doc("List of items.") + items: Test[]; + + @nextLink + @doc("Link to fetch more items.") + nextLink?: string; +} + +@scenario +@scenarioDoc(""" + Test for @nextLinkVerb decorator with POST verb. + This operation should use POST for both the initial request and the next link request. + + Expected initial request: POST /azure/client-generator-core/next-link-verb/items + Expected response body: + ```json + { + "items": [ + { + "id": "test1" + } + ], + "nextLink": "http://localhost:3000/azure/client-generator-core/next-link-verb/items/page/2" + } + ``` + + Expected next link request: POST /azure/client-generator-core/next-link-verb/items/page/2 + Expected response body: + ```json + { + "items": [ + { + "id": "test2" + } + ] + } + ``` + """) +@global.Azure.ClientGenerator.Core.Legacy.nextLinkVerb("POST") +@list +@route("/items") +@post +op listItems(): ListTestResult; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/mockapi.ts new file mode 100644 index 00000000000..f6cd63d392a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/mockapi.ts @@ -0,0 +1,41 @@ +import { dyn, dynItem, json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Azure_ClientGenerator_Core_NextLinkVerb_listItems = passOnSuccess([ + { + // First page request + uri: "/azure/client-generator-core/next-link-verb/items", + method: "post", + request: {}, + response: { + status: 200, + body: json({ + items: [ + { + id: "test1", + }, + ], + nextLink: dyn`${dynItem("baseUrl")}/azure/client-generator-core/next-link-verb/items/page/2`, + }), + }, + kind: "MockApiDefinition", + }, + { + // Second page request + uri: "/azure/client-generator-core/next-link-verb/items/page/2", + method: "post", + request: {}, + response: { + status: 200, + body: json({ + items: [ + { + id: "test2", + }, + ], + }), + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/client.tsp new file mode 100644 index 00000000000..ef51ac5e22d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/client.tsp @@ -0,0 +1,44 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/http"; + +using Http; +using global.Azure.ClientGenerator.Core; + +@clientNamespace("azure.clientgenerator.core.methodoverride", "java") +namespace Customization; + +@@clientNamespace(_Specs_.Azure.ClientGenerator.Core.Override, + "azure.clientgenerator.core.methodoverride", + "java" +); + +op reorderCustomized(@path param1: string, @path param2: string): void; + +@@override(_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder, + reorderCustomized +); + +model GroupParametersOptions { + @query param1: string; + @query param2: string; +} + +op groupCustomized(options: GroupParametersOptions): void; + +@@override(_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group, + groupCustomized, + "!javascript" +); + +op requireOptionalCustomized(@path param1: string, @path param2: string): void; + +@@override(_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional, + requireOptionalCustomized +); + +op removeOptionalCustomized(@path param1: string, @query param2?: string): void; + +@@override(_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional, + removeOptionalCustomized +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/main.tsp new file mode 100644 index 00000000000..982ccc65f96 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/main.tsp @@ -0,0 +1,81 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Spector; + +@doc("Test scenarios for client override behavior.") +@scenarioService("/azure/client-generator-core/override") +namespace _Specs_.Azure.ClientGenerator.Core.Override; + +interface ReorderParameters { + @scenario + @scenarioDoc(""" + Verify that after `@override` the parameters are reordered correctly in the client method signature. + + Expected path parameter: + param1: param1 + param2: param2 + + Expected response: 204 No Content + """) + @route("/reorder/{param2}/{param1}") + @get + reorder(@path param2: string, @path param1: string): void; +} + +interface GroupParameters { + @scenario + @scenarioDoc(""" + Verify that after `@override` the parameters are grouped correctly to `GroupParametersOptions` in the client method signature. + + Expected query parameter: + param1: param1 + param2: param2 + + Expected response: 204 No Content + """) + @route("/group") + @get + group(@query param1: string, @query param2: string): void; +} + +interface RequireOptionalParameter { + @scenario + @scenarioDoc(""" + Verify that after `@override` an optional parameter can be made required in the client method signature. + + Expected path parameter: + param1: param1 + param2: param2 + + Expected response: 204 No Content + """) + @route("/require-optional/{param1}/{param2}") + @get + requireOptional(@path param1: string, @path param2?: string): void; +} + +interface RemoveOptionalParameter { + @scenario + @scenarioDoc(""" + Verify that after `@override`, optional parameters can be removed from the client method signature. + + Expected path parameter: + param1: param1 + + Expected query parameter: + param2: param2 + + Expected response: 204 No Content + """) + @route("/remove-optional/{param1}") + @get + removeOptional( + @path param1: string, + @query param2?: string, + @query param3?: string, + @header param4?: string, + ): void; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/mockapi.ts new file mode 100644 index 00000000000..1a1f7203f49 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/mockapi.ts @@ -0,0 +1,73 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +// Test parameter reordering with @override decorator +// Verifies that parameters are reordered correctly in client method signature +// Expected path: /azure/client-generator-core/override/reorder/{param2}/{param1} +// Where param1="param1" and param2="param2" +Scenarios.Azure_ClientGenerator_Core_Override_ReorderParameters_reorder = passOnSuccess([ + { + uri: "/azure/client-generator-core/override/reorder/param2/param1", + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +// Test parameter grouping with @override decorator +// Verifies that parameters are grouped correctly into GroupParametersOptions +// Expected query parameters: param1="param1", param2="param2" +Scenarios.Azure_ClientGenerator_Core_Override_GroupParameters_group = passOnSuccess([ + { + uri: "/azure/client-generator-core/override/group", + method: "get", + request: { + query: { + param1: "param1", + param2: "param2", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +// Test parameter requirement with @override decorator +// Verifies that optional parameters can be made required via @override +Scenarios.Azure_ClientGenerator_Core_Override_RequireOptionalParameter_requireOptional = + passOnSuccess([ + { + uri: "/azure/client-generator-core/override/require-optional/param1/param2", + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + ]); + +// Test parameter requirement with @override decorator +// Verifies that optional parameters can be removed via @override +Scenarios.Azure_ClientGenerator_Core_Override_RemoveOptionalParameter_removeOptional = + passOnSuccess([ + { + uri: "/azure/client-generator-core/override/remove-optional/param1", + method: "get", + request: { + query: { + param2: "param2", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + ]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/main.tsp new file mode 100644 index 00000000000..326b229c2e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/main.tsp @@ -0,0 +1,122 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Spector; + +@doc("Test for internal decorator.") +@scenarioService("/azure/client-generator-core/usage") +@global.Azure.ClientGenerator.Core.clientNamespace("azure.clientgenerator.core.usage", "java") +namespace _Specs_.Azure.ClientGenerator.Core.Usage; + +@scenario +@scenarioDoc(""" + This scenario contains 4 public operations. All should be generated and exported. + 'OrphanModel' is not used but specified as 'public' and 'input', so it should be generated in SDK. The 'orphanModelSerializable' operation verifies that the model can be serialized to JSON. + The other models' usage is additive to roundtrip, so they should be generated and exported as well. + """) +@global.Azure.ClientGenerator.Core.clientNamespace("azure.clientgenerator.core.usage", "java") +namespace ModelInOperation { + @doc("Usage additive to roundtrip.") + @global.Azure.ClientGenerator.Core.usage( + global.Azure.ClientGenerator.Core.Usage.input | global.Azure.ClientGenerator.Core.Usage.output + ) + model InputModel { + name: string; + } + + @doc(""" + Expected body parameter: + ```json + { + "name": "Madge" + } + ``` + """) + @route("/inputToInputOutput") + @post + op inputToInputOutput(@body body: InputModel): void; + + @doc("Usage additive to roundtrip.") + @global.Azure.ClientGenerator.Core.usage( + global.Azure.ClientGenerator.Core.Usage.input | global.Azure.ClientGenerator.Core.Usage.output + ) + model OutputModel { + name: string; + } + + @doc(""" + Expected response body: + ```json + { + "name": "Madge" + } + ``` + """) + @route("/outputToInputOutput") + @get + op outputToInputOutput(): OutputModel; + + model ResultModel { + name: string; + } + + model RoundTripModel { + @visibility(Lifecycle.Read) + result: ResultModel; + } + + @doc(""" + "ResultModel" should be usage=output, as it is read-only and does not exist in request body. + + Expected body parameter: + ```json + { + } + ``` + + Expected response body: + ```json + { + "result": { + "name": "Madge" + } + } + ``` + """) + @route("/modelInReadOnlyProperty") + @put + op modelInReadOnlyProperty(@body body: RoundTripModel): { + @body body: RoundTripModel; + }; + + @doc(""" + Serialize the 'OrphanModel' as request body. + + Expected body parameter: + ```json + { + "name": "name", + "desc": "desc" + } + ``` + """) + @global.Azure.ClientGenerator.Core.convenientAPI(false) + @route("/orphanModelSerializable") + @put + op orphanModelSerializable(@body body: unknown): NoContentResponse; +} + +@doc("Not used anywhere, but access is override to public so still need to be generated and exported with serialization.") +@global.Azure.ClientGenerator.Core.usage( + global.Azure.ClientGenerator.Core.Usage.input | global.Azure.ClientGenerator.Core.Usage.json +) +@global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.public) +model OrphanModel { + @global.Azure.ClientGenerator.Core.clientName("modelName") + name: string; + + @encodedName("application/json", "desc") + description: string; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/mockapi.ts new file mode 100644 index 00000000000..3added595a8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/mockapi.ts @@ -0,0 +1,53 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Azure_ClientGenerator_Core_Usage_ModelInOperation = passOnSuccess([ + { + uri: "/azure/client-generator-core/usage/inputToInputOutput", + method: "post", + request: { + body: json({ + name: "Madge", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/usage/outputToInputOutput", + method: "get", + request: {}, + response: { + status: 200, + body: json({ name: "Madge" }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/usage/modelInReadOnlyProperty", + method: "put", + request: {}, + response: { + status: 200, + body: json({ result: { name: "Madge" } }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/client-generator-core/usage/orphanModelSerializable", + method: "put", + request: { + body: json({ + name: "name", + desc: "desc", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/client.tsp new file mode 100644 index 00000000000..474b89b83f1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/client.tsp @@ -0,0 +1,8 @@ +import "@azure-tools/typespec-client-generator-core"; +import "./main.tsp"; + +using Azure.ClientGenerator.Core; + +@@convenientAPI(_Specs_.Azure.Core.Basic.createOrUpdate, false, "csharp"); + +@@clientNamespace(_Specs_.Azure.Core.Basic, "azure.core.basic", "java"); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/main.tsp new file mode 100644 index 00000000000..f1bbb4a6c2a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/main.tsp @@ -0,0 +1,260 @@ +import "@typespec/spector"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; + +using Azure.Core; +using global.Azure.Core.Traits; +using global.Azure.Core.Foundations; +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Spector; + +#suppress "@azure-tools/typespec-azure-core/casing-style" "For spec" +@doc("Illustrates bodies templated with Azure Core") +@scenarioService( + "/azure/core/basic", + { + versioned: Versions, + } +) +namespace _Specs_.Azure.Core.Basic; + +@doc("The version of the API.") +enum Versions { + @doc("The version 2022-12-01-preview.") + v2022_12_01_preview: "2022-12-01-preview", +} + +alias ResourceOperations = global.Azure.Core.ResourceOperations; + +@resource("users") +@doc("Details about a user.") +model User { + @key + @doc("The user's id.") + @visibility(Lifecycle.Read) + id: int32; + + @doc("The user's name.") + name: string; + + @doc("The user's order list") + orders?: UserOrder[]; + + ...global.Azure.Core.EtagProperty; +} + +@doc("UserOrder for testing list with expand.") +@resource("user") +model UserOrder { + @key + @doc("The user's id.") + @visibility(Lifecycle.Read) + id: int32; + + @doc("The user's id.") + userId: int32; + + @doc("The user's order detail") + detail: string; +} + +@doc("The parameters for exporting a user.") +model UserExportParams { + @query + @doc("The format of the data.") + format: string; +} + +@scenario +@doc("Creates or updates a User") +@summary("Adds a user or updates a user's fields.") +@scenarioDoc(""" + Should only generate models named User and UserOrder. + + Expected path parameter: id=1 + Expected query parameter: api-version=2022-12-01-preview + + Expected input body: + ```json + { + "name": "Madge" + } + ``` + + Expected response body: + ```json + { + "id": 1, + "name": "Madge" + } + ``` + """) +op createOrUpdate is ResourceOperations.ResourceCreateOrUpdate; + +@scenario +@doc("Creates or replaces a User") +@summary("Adds a user or replaces a user's fields.") +@scenarioDoc(""" + Should only generate models named User and UserOrder. + + Expected path parameter: id=1 + Expected query parameter: api-version=2022-12-01-preview + + Expected input body: + ```json + { + "name": "Madge" + } + ``` + + Expected response body: + ```json + { + "id": 1, + "name": "Madge", + "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" + } + ``` + """) +op createOrReplace is ResourceOperations.ResourceCreateOrReplace; + +@scenario +@doc("Gets a User") +@summary("Gets a user.") +@scenarioDoc(""" + Should only generate models named User and UserOrder. + + Expected path parameter: id=1 + Expected query parameter: api-version=2022-12-01-preview + + Expected response body: + ```json + { + "id": 1, + "name": "Madge", + "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" + } + ``` + """) +op get is ResourceOperations.ResourceRead; + +@scenario +@doc("Lists all Users") +@summary("Lists all users.") +@scenarioDoc(""" + Should only generate models named User and UserOrder. + + Should not generate visible model like CustomPage. + + Expected query parameter: api-version=2022-12-01-preview&top=5&skip=10&orderby=id&filter=id%20lt%2010&select=id&select=orders&select=etag&expand=orders + + Expected response body: + ```json + { + "value":[ + { + "id":1, + "name":"Madge", + "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59", + "orders": [{ "id": 1, "userId": 1, detail: "a recorder" }] + }, + { + "id":2, + "name":"John", + "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b5a", + "orders": [{ "id": 2, "userId": 2, "detail": "a TV" }] + } + ] + } + ``` + """) +op list is ResourceOperations.ResourceList< + User, + ListQueryParametersTrait +>; + +@scenario +@doc("Deletes a User") +@summary("Deletes a user.") +@scenarioDoc(""" + Expected path parameter: id=1 + + Expected query parameter: api-version=2022-12-01-preview + + Expected response of status code 204 with empty body. + """) +op delete is ResourceOperations.ResourceDelete; + +@scenario +@doc("Exports a User") +@summary("Exports a user.") +@scenarioDoc(""" + Should only generate models named User and UserOrder. + + Expected path parameter: id=1 + Expected query parameter: format=json + Expected query parameter: api-version=2022-12-01-preview + + Expected response body: + ```json + { + "id": 1, + "name": "Madge", + "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" + } + ``` + """) +op export is ResourceOperations.ResourceAction; + +model UserList { + users: User[]; +} + +@scenario +@doc("Exports all users") +@summary("Exports all users.") +@scenarioDoc(""" + Should generate a model named User. + + Expected query parameter: format=json + Expected query parameter: api-version=2022-12-01-preview + + Expected response body: + ```json + { + "users":[ + { + "id": 1, + "name": "Madge", + "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" + }, + { + "id": 2, + "name": "John", + "etag": "22bdc430-65e8-45ad-81d9-8ffa60d55b59" + } + ] + } + ``` + """) +@collectionAction(User, "exportallusers") +@post +op exportAllUsers is ResourceOperations.ResourceCollectionAction< + User, + UserExportParams, + UserList, + { + apiVersion: "2022-12-01-preview"; + } +>; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/mockapi.ts new file mode 100644 index 00000000000..f0fcae86bf8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/mockapi.ts @@ -0,0 +1,137 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; +const validUser = { id: 1, name: "Madge", etag: "11bdc430-65e8-45ad-81d9-8ffa60d55b59" }; +const validUser2 = { id: 2, name: "John", etag: "22bdc430-65e8-45ad-81d9-8ffa60d55b59" }; +Scenarios.Azure_Core_Basic_createOrUpdate = passOnSuccess({ + uri: "/azure/core/basic/users/:id", + method: "patch", + request: { + pathParams: { + id: "1", + }, + query: { + "api-version": "2022-12-01-preview", + }, + headers: { + "Content-Type": "application/merge-patch+json", + }, + body: json({ name: "Madge" }), + }, + response: { status: 200, body: json(validUser) }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_Core_Basic_createOrReplace = passOnSuccess({ + uri: "/azure/core/basic/users/:id", + method: "put", + request: { + pathParams: { + id: "1", + }, + query: { + "api-version": "2022-12-01-preview", + }, + body: json({ name: "Madge" }), + }, + response: { status: 200, body: json(validUser) }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_Core_Basic_get = passOnSuccess({ + uri: "/azure/core/basic/users/:id", + method: "get", + request: { + pathParams: { + id: "1", + }, + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { status: 200, body: json(validUser) }, + kind: "MockApiDefinition", +}); +const responseBody = { + value: [ + { + id: 1, + name: "Madge", + etag: "11bdc430-65e8-45ad-81d9-8ffa60d55b59", + orders: [{ id: 1, userId: 1, detail: "a recorder" }], + }, + { + id: 2, + name: "John", + etag: "11bdc430-65e8-45ad-81d9-8ffa60d55b5a", + orders: [{ id: 2, userId: 2, detail: "a TV" }], + }, + ], +}; +Scenarios.Azure_Core_Basic_list = passOnSuccess({ + uri: "/azure/core/basic/users", + method: "get", + request: { + query: { + "api-version": "2022-12-01-preview", + top: 5, + skip: 10, + orderby: "id", + filter: "id lt 10", + select: ["id", "orders", "etag"], + expand: "orders", + }, + }, + response: { status: 200, body: json(responseBody) }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_Core_Basic_delete = passOnSuccess({ + uri: "/azure/core/basic/users/:id", + method: "delete", + request: { + pathParams: { + id: "1", + }, + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_Core_Basic_export = passOnSuccess({ + uri: "/azure/core/basic/users/:id\\:export", + method: "post", + request: { + pathParams: { + id: "1", + }, + query: { + format: "json", + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validUser), + }, + kind: "MockApiDefinition", +}); + +const expectBody = { users: [validUser, validUser2] }; +Scenarios.Azure_Core_Basic_exportAllUsers = passOnSuccess({ + uri: "/azure/core/basic/users:exportallusers", + method: "post", + request: { + query: { + format: "json", + "api-version": "2022-12-01-preview", + }, + }, + response: { status: 200, body: json(expectBody) }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/main.tsp new file mode 100644 index 00000000000..552ecfae7d4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/main.tsp @@ -0,0 +1,115 @@ +import "@azure-tools/typespec-azure-core"; +import "@typespec/spector"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-client-generator-core"; + +using Azure.Core; +using global.Azure.Core.Traits; +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Spector; + +#suppress "@azure-tools/typespec-azure-core/casing-style" "For spec" +@doc("Illustrates bodies templated with Azure Core with long-running RPC operation") +@scenarioService( + "/azure/core/lro/rpc", + { + versioned: Versions, + } +) +@global.Azure.ClientGenerator.Core.clientNamespace("azure.core.lro.rpc", "java") +namespace _Specs_.Azure.Core.Lro.Rpc; + +@doc("The API version.") +enum Versions { + @doc("The 2022-12-01-preview version.") + v2022_12_01_preview: "2022-12-01-preview", +} + +@doc("Options for the generation.") +model GenerationOptions { + @doc("Prompt.") + prompt: string; +} + +model GenerationResponse is global.Azure.Core.Foundations.OperationStatus; +// fix warning in Azure.Core.Foundations.OperationStatus +@@visibility(global.Azure.Core.Foundations.OperationStatus.id, Lifecycle.Read); + +@doc("Result of the generation.") +model GenerationResult { + @doc("The data.") + data: string; +} + +@scenario +@doc("Generate data.") +@summary("Generate data.") +@scenarioDoc(""" + Should generate model GenerationOptions and GenerationResult. + GenerationResponse could be generated, depending on implementation. + + Expected verb: POST + Expected request body: + ```json + { + "prompt": "text" + } + ``` + + Expected status code: 202 + Expected response header: operation-location={endpoint}/generations/operations/operation1 + Expected response body: + ```json + { + "id": "operation1", + "status": "InProgress" + } + ``` + + Expected verb: GET + Expected URL: {endpoint}/generations/operations/operation1 + + Expected status code: 200 + Expected response body: + ```json + { + "id": "operation1", + "status": "InProgress" + } + ``` + + Expected verb: GET + Expected URL: {endpoint}/generations/operations/operation1 + + Expected status code: 200 + Expected response body: + ```json + { + "id": "operation1", + "status": "Succeeded", + "result": { + "data": "text data" + } + } + ``` + """) +@route("/generations:submit") +op longRunningRpc is global.Azure.Core.LongRunningRpcOperation< + BodyParameter, + GenerationResponse, + GenerationResult +>; + +alias BodyParameter< + T, + TName extends valueof string = "body", + TDoc extends valueof string = "The body parameter." +> = { + @doc(TDoc) + @friendlyName(TName) + @bodyRoot + body: T; +}; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/mockapi.ts new file mode 100644 index 00000000000..0043ce0d159 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/mockapi.ts @@ -0,0 +1,85 @@ +import { + dyn, + dynItem, + json, + MockRequest, + passOnSuccess, + ScenarioMockApi, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +let generationPollCount = 0; + +Scenarios.Azure_Core_Lro_Rpc_longRunningRpc = passOnSuccess([ + { + uri: "/azure/core/lro/rpc/generations:submit", + method: "post", + request: { + body: json({ prompt: "text" }), + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 202, + headers: { + "operation-location": dyn`${dynItem("baseUrl")}/azure/core/lro/rpc/generations/operations/operation1`, + }, + body: json({ id: "operation1", status: "InProgress" }), + }, + handler: (req: MockRequest) => { + req.expect.containsQueryParam("api-version", "2022-12-01-preview"); + req.expect.bodyEquals({ prompt: "text" }); + generationPollCount = 0; + return { + status: 202, + headers: { + "operation-location": `${req.baseUrl}/azure/core/lro/rpc/generations/operations/operation1`, + }, + body: json({ id: "operation1", status: "InProgress" }), + }; + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/core/lro/rpc/generations/operations/operation1", + method: "get", + request: { + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ id: "operation1", status: "InProgress" }), + }, + handler: lroHandler, + kind: "MockApiDefinition", + }, + { + uri: "/azure/core/lro/rpc/generations/operations/operation1", + method: "get", + request: { + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ id: "operation1", status: "Succeeded", result: { data: "text data" } }), + }, + handler: lroHandler, + kind: "MockApiDefinition", + }, +]); + +function lroHandler(req: MockRequest) { + req.expect.containsQueryParam("api-version", "2022-12-01-preview"); + const response = + generationPollCount > 0 + ? { id: "operation1", status: "Succeeded", result: { data: "text data" } } + : { id: "operation1", status: "InProgress" }; + generationPollCount += 1; + return { status: 200, body: json(response) }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/main.tsp new file mode 100644 index 00000000000..5cfce610798 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/main.tsp @@ -0,0 +1,219 @@ +import "@azure-tools/typespec-azure-core"; +import "@typespec/spector"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-client-generator-core"; + +using Azure.Core; +using global.Azure.Core.Traits; +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Spector; + +#suppress "@azure-tools/typespec-azure-core/casing-style" "For spec" +@doc("Illustrates bodies templated with Azure Core with long-running operation") +@scenarioService( + "/azure/core/lro/standard", + { + versioned: Versions, + } +) +@global.Azure.ClientGenerator.Core.clientNamespace("azure.core.lro.standard", "java") +namespace _Specs_.Azure.Core.Lro.Standard; + +@doc("The API version.") +enum Versions { + @doc("The 2022-12-01-preview version.") + v2022_12_01_preview: "2022-12-01-preview", +} + +alias ResourceOperations = global.Azure.Core.ResourceOperations; + +@resource("users") +@doc("Details about a user.") +model User { + @key + @visibility(Lifecycle.Read) + @doc("The name of user.") + name: string; + + @doc("The role of user") + role: string; +} + +@doc("The parameters for exporting a user.") +model UserExportParams { + @query + @doc("The format of the data.") + format: string; +} + +@doc("The exported user data.") +model ExportedUser { + @doc("The name of user.") + name: string; + + @doc("The exported URI.") + resourceUri: string; +} + +@scenario +@doc("Creates or replaces a User") +@summary("Adds a user or replaces a user's fields.") +@scenarioDoc(""" + Should only generate one model named User. + + Expected verb: PUT + Expected path parameter: name=madge + + Expected request body: + ```json + { + "role": "contributor" + } + ``` + + Expected status code: 201 + Expected response header: operation-location={endpoint}/users/madge/operations/operation1 + Expected response body: + ```json + { + "name": "madge", + "role": "contributor" + } + ``` + + Expected verb: GET + Expected URL: {endpoint}/users/madge/operations/operation1 + + Expected status code: 200 + Expected response body: + ```json + { + "id": "operation1", + "status": "InProgress" + } + ``` + + Expected verb: GET + Expected URL: {endpoint}/users/madge/operations/operation1 + + Expected status code: 200 + Expected response body: + ```json + { + "id": "operation1", + "status": "Succeeded" + } + ``` + + (The last GET call on resource URL is optional) + Expected verb: GET + Expected URL: {endpoint}/users/madge + + Expected status code: 200 + Expected response body: + ```json + { + "name": "madge", + "role": "contributor" + } + ``` + """) +op createOrReplace is ResourceOperations.LongRunningResourceCreateOrReplace; + +@scenario +@doc("Deletes a User") +@summary("Deletes a user.") +@scenarioDoc(""" + Expected verb: DELETE + Expected path parameter: name=madge + + Expected status code: 202 + Expected response header: operation-location={endpoint}/users/madge/operations/operation2 + Expected response body: + ```json + { + "id": "operation2", + "status": "InProgress" + } + ``` + + Expected verb: GET + Expected URL: {endpoint}/users/madge/operations/operation2 + + Expected status code: 200 + Expected response body: + ```json + { + "id": "operation2", + "status": "InProgress" + } + ``` + + Expected verb: GET + Expected URL: {endpoint}/users/madge/operations/operation2 + + Expected status code: 200 + Expected response body: + ```json + { + "id": "operation2", + "status": "Succeeded" + } + ``` + """) +op delete is ResourceOperations.LongRunningResourceDelete; + +@scenario +@doc("Exports a User") +@summary("Exports a user.") +@scenarioDoc(""" + Should only generate one model named ExportedUser. + + Expected verb: POST + Expected path parameter: name=madge + Expected query parameter: format=json + + Expected status code: 202 + Expected response header: operation-location={endpoint}/users/madge/operations/operation3 + Expected response body: + ```json + { + "id": "operation3", + "status": "InProgress" + } + ``` + + Expected verb: GET + Expected URL: {endpoint}/users/madge/operations/operation3 + + Expected status code: 200 + Expected response body: + ```json + { + "id": "operation3", + "status": "InProgress" + } + ``` + + Expected verb: GET + Expected URL: {endpoint}/users/madge/operations/operation3 + + Expected status code: 200 + Expected response body: + ```json + { + "id": "operation3", + "status": "Succeeded", + "result": { + "name": "madge", + "resourceUri": "/users/madge" + } + } + ``` + """) +op export is ResourceOperations.LongRunningResourceAction; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/mockapi.ts new file mode 100644 index 00000000000..d298890ca92 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/mockapi.ts @@ -0,0 +1,250 @@ +import { + dyn, + dynItem, + json, + MockRequest, + passOnSuccess, + ScenarioMockApi, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const validUser = { name: "madge", role: "contributor" }; +let createOrReplacePollCount = 0; +let deletePollCount = 0; +let exportPollCount = 0; + +function createOrReplaceLroHandler(req: MockRequest) { + req.expect.containsQueryParam("api-version", "2022-12-01-preview"); + const response = + createOrReplacePollCount > 0 + ? { id: "operation1", status: "Succeeded" } + : { id: "operation1", status: "InProgress" }; + createOrReplacePollCount += 1; + return { status: 200, body: json(response) }; +} + +function deleteLroHandler(req: MockRequest) { + req.expect.containsQueryParam("api-version", "2022-12-01-preview"); + const response = + deletePollCount > 0 + ? { id: "operation2", status: "Succeeded" } + : { id: "operation2", status: "InProgress" }; + deletePollCount += 1; + return { status: 200, body: json(response) }; +} + +function exportLroHandler(req: MockRequest) { + req.expect.containsQueryParam("api-version", "2022-12-01-preview"); + const response = + exportPollCount > 0 + ? { + id: "operation3", + status: "Succeeded", + result: { name: "madge", resourceUri: "/users/madge" }, + } + : { id: "operation3", status: "InProgress" }; + exportPollCount += 1; + return { status: 200, body: json(response) }; +} + +Scenarios.Azure_Core_Lro_Standard_createOrReplace = passOnSuccess([ + { + uri: "/azure/core/lro/standard/users/madge", + method: "put", + request: { + body: json({ role: "contributor" }), + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 201, + headers: { + "operation-location": dyn`${dynItem("baseUrl")}/azure/core/lro/standard/users/madge/operations/operation1`, + }, + body: json(validUser), + }, + handler: (req: MockRequest) => { + req.expect.containsQueryParam("api-version", "2022-12-01-preview"); + req.expect.bodyEquals({ role: "contributor" }); + createOrReplacePollCount = 0; + return { + status: 201, + headers: { + "operation-location": `${req.baseUrl}/azure/core/lro/standard/users/madge/operations/operation1`, + }, + body: json(validUser), + }; + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/core/lro/standard/users/madge/operations/operation1", + method: "get", + request: { + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ id: "operation1", status: "InProgress" }), + }, + handler: createOrReplaceLroHandler, + kind: "MockApiDefinition", + }, + { + uri: "/azure/core/lro/standard/users/madge/operations/operation1", + method: "get", + request: { + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ id: "operation1", status: "Succeeded" }), + }, + handler: createOrReplaceLroHandler, + kind: "MockApiDefinition", + }, + { + uri: "/azure/core/lro/standard/users/madge", + method: "get", + request: {}, + response: { + status: 200, + body: json(validUser), + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_Core_Lro_Standard_delete = passOnSuccess([ + { + uri: "/azure/core/lro/standard/users/madge", + method: "delete", + request: { + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 202, + headers: { + "operation-location": dyn`${dynItem("baseUrl")}/azure/core/lro/standard/users/madge/operations/operation2`, + }, + body: json({ id: "operation2", status: "InProgress" }), + }, + handler: (req: MockRequest) => { + req.expect.containsQueryParam("api-version", "2022-12-01-preview"); + deletePollCount = 0; + return { + status: 202, + headers: { + "operation-location": `${req.baseUrl}/azure/core/lro/standard/users/madge/operations/operation2`, + }, + body: json({ id: "operation2", status: "InProgress" }), + }; + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/core/lro/standard/users/madge/operations/operation2", + method: "get", + request: { + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ id: "operation2", status: "InProgress" }), + }, + handler: deleteLroHandler, + kind: "MockApiDefinition", + }, + { + uri: "/azure/core/lro/standard/users/madge/operations/operation2", + method: "get", + request: { + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ id: "operation2", status: "Succeeded" }), + }, + handler: deleteLroHandler, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_Core_Lro_Standard_export = passOnSuccess([ + { + uri: "/azure/core/lro/standard/users/madge:export", + method: "post", + request: { + query: { + "api-version": "2022-12-01-preview", + format: "json", + }, + }, + response: { + status: 202, + headers: { + "operation-location": dyn`${dynItem("baseUrl")}/azure/core/lro/standard/users/madge/operations/operation3`, + }, + body: json({ id: "operation3", status: "InProgress" }), + }, + handler: (req: MockRequest) => { + req.expect.containsQueryParam("api-version", "2022-12-01-preview"); + req.expect.containsQueryParam("format", "json"); + exportPollCount = 0; + return { + status: 202, + headers: { + "operation-location": `${req.baseUrl}/azure/core/lro/standard/users/madge/operations/operation3`, + }, + body: json({ id: "operation3", status: "InProgress" }), + }; + }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/core/lro/standard/users/madge/operations/operation3", + method: "get", + request: { + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ id: "operation3", status: "InProgress" }), + }, + handler: exportLroHandler, + kind: "MockApiDefinition", + }, + { + uri: "/azure/core/lro/standard/users/madge/operations/operation3", + method: "get", + request: { + query: { + "api-version": "2022-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + id: "operation3", + status: "Succeeded", + result: { name: "madge", resourceUri: "/users/madge" }, + }), + }, + handler: exportLroHandler, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/main.tsp new file mode 100644 index 00000000000..e21ce5d3132 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/main.tsp @@ -0,0 +1,65 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; +import "@azure-tools/typespec-azure-core"; +import "@typespec/versioning"; + +using TypeSpec.Http; +using global.Azure.ClientGenerator.Core; +using global.Azure.Core; +using TypeSpec.Versioning; +using Spector; + +@scenarioService( + "/azure/core/model", + { + versioned: Versions, + } +) +@global.Azure.ClientGenerator.Core.clientNamespace("azure.core.model", "java") +namespace _Specs_.Azure.Core.Model; +@doc("The version of the API.") +enum Versions { + @doc("The version 2022-12-01-preview.") + v2022_12_01_preview: "2022-12-01-preview", +} +model AzureEmbeddingModel { + embedding: EmbeddingVector; +} + +@operationGroup +@route("/embeddingVector") +interface AzureCoreEmbeddingVector { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to handle an embedding vector. Mock api will return [0, 1, 2, 3, 4]") + @get + @doc("get an embedding vector") + get(): EmbeddingVector; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to send an embedding vector. Mock api expect to receive [0, 1, 2, 3, 4]") + @put + @doc("put an embedding vector") + put(@body @doc("_") body: EmbeddingVector): void; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc(""" + Expect to send a model which has an embedding vector property. + + Expected request body: + ```json + {"embedding": [0, 1, 2, 3, 4]} + ``` + + Expected response body: + ```json + {"embedding": [5, 6, 7, 8, 9]} + ``` + """) + @post + @doc("post a model which has an embeddingVector property") + post(@body @doc("_") body: AzureEmbeddingModel): AzureEmbeddingModel; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/mockapi.ts new file mode 100644 index 00000000000..7be54031567 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/mockapi.ts @@ -0,0 +1,30 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Azure_Core_Model_AzureCoreEmbeddingVector_get = passOnSuccess({ + uri: "/azure/core/model/embeddingVector", + method: "get", + request: {}, + response: { status: 200, body: json([0, 1, 2, 3, 4]) }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_Core_Model_AzureCoreEmbeddingVector_put = passOnSuccess({ + uri: "/azure/core/model/embeddingVector", + method: "put", + request: { + body: json([0, 1, 2, 3, 4]), + }, + response: { status: 204 }, + kind: "MockApiDefinition", +}); + +const responseBody = { embedding: [5, 6, 7, 8, 9] }; +Scenarios.Azure_Core_Model_AzureCoreEmbeddingVector_post = passOnSuccess({ + uri: "/azure/core/model/embeddingVector", + method: "post", + request: { body: json({ embedding: [0, 1, 2, 3, 4] }) }, + response: { status: 200, body: json(responseBody) }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/client.tsp new file mode 100644 index 00000000000..d26030665dd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/client.tsp @@ -0,0 +1,6 @@ +import "@azure-tools/typespec-client-generator-core"; +import "./main.tsp"; + +using Azure.ClientGenerator.Core; + +@@scope(_Specs_.Azure.Core.Page.withParameterizedNextLink, "!go"); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/main.tsp new file mode 100644 index 00000000000..458652361e7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/main.tsp @@ -0,0 +1,263 @@ +import "@azure-tools/typespec-azure-core"; +import "@typespec/spector"; +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-client-generator-core"; + +using Azure.Core; +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Spector; + +#suppress "@azure-tools/typespec-azure-core/casing-style" "For spec" +@doc("Illustrates bodies templated with Azure Core with paging support") +@scenarioService( + "/azure/core/page", + { + versioned: Versions, + } +) +@global.Azure.ClientGenerator.Core.clientNamespace("azure.core.page", "java") +namespace _Specs_.Azure.Core.Page; + +@doc("The version of the API.") +enum Versions { + @doc("The version 2022-12-01-preview.") + v2022_12_01_preview: "2022-12-01-preview", +} + +@resource("users") +@doc("Details about a user.") +model User { + @key + @doc("The user's id.") + @visibility(Lifecycle.Read) + id: int32; + + @doc("The user's name.") + name: string; + + @doc("The user's order list") + orders?: UserOrder[]; + + ...global.Azure.Core.EtagProperty; +} + +@doc("UserOrder for testing list with expand.") +@resource("user") +model UserOrder { + @key + @doc("The user's id.") + @visibility(Lifecycle.Read) + id: int32; + + @doc("The user's id.") + userId: int32; + + @doc("The user's order detail") + detail: string; +} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing global.Azure.Core.Page" +@scenario +@doc("List with Azure.Core.Page<>.") +@route("/page") +@scenarioDoc(""" + Should only generate models named User and UserOrder. + + Should not generate visible model like Page. + + Expected query parameter: api-version=2022-12-01-preview + + Expected response body: + ```json + { + "value":[ + { + "id":1, + "name":"Madge", + "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" + } + ] + } + ``` + """) +@list +op listWithPage is global.Azure.Core.Foundations.Operation<{}, global.Azure.Core.Page>; + +@doc("The parameters for listing users.") +model ListItemInput { + @doc("The body of the input.") + @body + bodyInput: ListItemInputBody; + + @doc("Another query parameter.") + @query + another?: ListItemInputExtensibleEnum; +} + +@doc("An extensible enum input parameter.") +enum ListItemInputExtensibleEnum { + @doc("The first enum value.") + First, + + @doc("The second enum value.") + Second, +} + +@doc("The body of the input.") +model ListItemInputBody { + @doc("The name of the input.") + inputName: string; +} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing global.Azure.Core.Page" +@scenario +@doc("List with extensible enum parameter Azure.Core.Page<>.") +@route("/parameters") +@scenarioDoc(""" + Expected query parameter: api-version=2022-12-01-preview&another=Second + + Expected body parameter: {"inputName": "Madge"} + + Expected response body: + ```json + { + "value":[ + { + "id": 1, + "name": "Madge", + "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" + } + ] + } + ``` + """) +@post +@list +op listWithParameters is global.Azure.Core.Foundations.Operation< + ListItemInput, + global.Azure.Core.Page +>; + +@friendlyName("{name}ListResults", T) +model CustomPageModel { + @pageItems + @doc("List of items.") + items: T[]; + + @nextLink + @doc("Link to fetch more items.") + nextLink?: string; +} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing global.Azure.Core.Page" +@scenario +@doc("List with custom page model.") +@route("/custom-page") +@scenarioDoc(""" + Should ideally only generate models named User and UserOrder. If your language has to, you can also generate CustomPageModel + + Expected query parameter: api-version=2022-12-01-preview + + Expected response body: + ```json + { + "items":[ + { + "id":1, + "name":"Madge", + "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" + } + ] + } + ``` + """) +@list +op listWithCustomPageModel is global.Azure.Core.Foundations.Operation<{}, CustomPageModel>; + +@doc("First item.") +model FirstItem { + @doc("The id of the item.") + @visibility(Lifecycle.Read) + id: int32; +} + +@doc("Second item.") +model SecondItem { + @doc("The name of the item.") + @visibility(Lifecycle.Read) + name: string; +} + +@scenario +@scenarioDoc(""" + This scenario is to test two operations with two different page item types. + """) +interface TwoModelsAsPageItem { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing global.Azure.Core.Page" + @doc("Two operations with two different page item types should be successfully generated. Should generate model for FirstItem.") + @route("/first-item") + @list + listFirstItem is global.Azure.Core.Foundations.Operation<{}, global.Azure.Core.Page>; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing global.Azure.Core.Page" + @doc("Two operations with two different page item types should be successfully generated. Should generate model for SecondItem.") + @route("/second-item") + @list + listSecondItem is global.Azure.Core.Foundations.Operation<{}, global.Azure.Core.Page>; +} + +model IncludePendingOptions { + @query + includePending?: boolean; +} + +model ParameterizedNextLinkPagingResult { + @pageItems + values: User[]; + + @nextLink + nextLink: global.Azure.Core.Legacy.parameterizedNextLink<[IncludePendingOptions.includePending]>; +} + +@scenario +@doc("List with parameterized next link that re-injects parameters.") +@route("/with-parameterized-next-link") +@scenarioDoc(""" + This scenario tests the Azure.Core.Legacy.parameterizedNextLink decorator which ensures original request + parameters are maintained in next link URLs. + + Expected query parameters on initial request: + - includePending=true + - select=name + + Expected query parameters on next link request. Note: the SDK will need to re-inject this parameter: + - includePending=true (note: the client will need to manually re-inject this parameter into the next link) + - select=name (note: this is returned in the next link, the client does NOT need to manually re-inject this parameter) + + Expected concatenation of the paged items: + ```json + { + "value":[ + { + "id": 1, + "name": "User1", + }, + { + "id": 2, + "name": "User2", + } + ] + } + ``` + + Note that the nextLink preserves the original filter and select parameters. + """) +@list +op withParameterizedNextLink( + ...IncludePendingOptions, + @query select: string, +): ParameterizedNextLinkPagingResult; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/mockapi.ts new file mode 100644 index 00000000000..4515c445f93 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/mockapi.ts @@ -0,0 +1,90 @@ +import { dyn, dynItem, json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; +const validUser = { id: 1, name: "Madge", etag: "11bdc430-65e8-45ad-81d9-8ffa60d55b59" }; + +Scenarios.Azure_Core_Page_listWithPage = passOnSuccess({ + uri: "/azure/core/page/page", + method: "get", + request: {}, + response: { status: 200, body: json({ value: [validUser] }) }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_Core_Page_listWithParameters = passOnSuccess({ + uri: "/azure/core/page/parameters", + method: "post", + request: { + query: { + another: "Second", + }, + body: json({ inputName: "Madge" }), + }, + response: { status: 200, body: json({ value: [validUser] }) }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_Core_Page_TwoModelsAsPageItem = passOnSuccess([ + { + uri: "/azure/core/page/first-item", + method: "get", + request: {}, + response: { status: 200, body: json({ value: [{ id: 1 }] }) }, + kind: "MockApiDefinition", + }, + { + uri: "/azure/core/page/second-item", + method: "get", + request: {}, + response: { status: 200, body: json({ value: [{ name: "Madge" }] }) }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_Core_Page_listWithCustomPageModel = passOnSuccess({ + uri: "/azure/core/page/custom-page", + method: "get", + request: {}, + response: { status: 200, body: json({ items: [validUser] }) }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_Core_Page_withParameterizedNextLink = passOnSuccess([ + { + // First page request + uri: "/azure/core/page/with-parameterized-next-link", + method: "get", + request: { + query: { + includePending: true, + select: "name", + }, + }, + response: { + status: 200, + body: json({ + values: [{ id: 1, name: "User1" }], + nextLink: dyn`${dynItem("baseUrl")}/azure/core/page/with-parameterized-next-link/second-page?select=name`, + }), + }, + kind: "MockApiDefinition", + }, + { + // Follow-up page request + uri: "/azure/core/page/with-parameterized-next-link/second-page", + method: "get", + request: { + query: { + includePending: true, + select: "name", + }, + }, + response: { + status: 200, + body: json({ + values: [{ id: 2, name: "User2" }], + }), + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/main.tsp new file mode 100644 index 00000000000..cc6ef505971 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/main.tsp @@ -0,0 +1,94 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; +import "@azure-tools/typespec-azure-core"; +import "@typespec/versioning"; + +using TypeSpec.Http; +using global.Azure.ClientGenerator.Core; +using global.Azure.Core; +using TypeSpec.Versioning; +using Spector; + +@scenarioService( + "/azure/core/scalar", + { + versioned: Versions, + } +) +@global.Azure.ClientGenerator.Core.clientNamespace("azure.core.scalar", "java") +namespace _Specs_.Azure.Core.Scalar; +@doc("The version of the API.") +enum Versions { + @doc("The version 2022-12-01-preview.") + v2022_12_01_preview: "2022-12-01-preview", +} +model AzureLocationModel { + location: azureLocation; +} + +@operationGroup +@route("/azureLocation") +interface AzureLocationScalar { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to handle a azureLocation value. Mock api will return 'eastus'") + @get + @doc("get azureLocation value") + get(): { + @header contentType: "application/json"; + @body body: azureLocation; + }; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to send a azureLocation value. Mock api expect to receive 'eastus'") + @put + @doc("put azureLocation value") + put(@header contentType: "application/json", @body @doc("_") body: azureLocation): void; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc(""" + Expect to send a model which has an azureLocation property. + + Expected request body: + ```json + {"location": "eastus"} + ``` + + Expected response body: + ```json + {"location": "eastus"} + ``` + """) + @scenarioDoc("Expect to send a model who has an azureLocation property. Mock api expect to receive '{location: eastus}'") + @post + @doc("post a model which has azureLocation property") + post( + @header contentType: "application/json", + @body @doc("_") body: AzureLocationModel, + ): AzureLocationModel; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc(""" + Expect to send a azureLocation value as header. + Expected header parameter: `region="eastus"` + """) + @post + @route("/header") + @doc("azureLocation value header") + header(@header @doc("_") region: azureLocation): void; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc(""" + Expect to send a azureLocation value as query. + Expected query parameter: `region="eastus"` + """) + @post + @doc("azureLocation value query") + @route("/query") + query(@query @doc("_") region: azureLocation): void; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/mockapi.ts new file mode 100644 index 00000000000..19a3f8c6183 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/mockapi.ts @@ -0,0 +1,55 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +// string value +Scenarios.Azure_Core_Scalar_AzureLocationScalar_get = passOnSuccess({ + uri: "/azure/core/scalar/azureLocation", + method: "get", + request: {}, + response: { status: 200, body: json("eastus") }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_Core_Scalar_AzureLocationScalar_put = passOnSuccess({ + uri: "/azure/core/scalar/azureLocation", + method: "put", + request: { + body: json("eastus"), + }, + response: { status: 204 }, + kind: "MockApiDefinition", +}); + +const azureLocation = { location: "eastus" }; +Scenarios.Azure_Core_Scalar_AzureLocationScalar_post = passOnSuccess({ + uri: "/azure/core/scalar/azureLocation", + method: "post", + request: { body: json(azureLocation) }, + response: { status: 200, body: json(azureLocation) }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_Core_Scalar_AzureLocationScalar_header = passOnSuccess({ + uri: "/azure/core/scalar/azureLocation/header", + method: "post", + request: { + headers: { + region: "eastus", + }, + }, + response: { status: 204 }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_Core_Scalar_AzureLocationScalar_query = passOnSuccess({ + uri: "/azure/core/scalar/azureLocation/query", + method: "post", + request: { + query: { + region: "eastus", + }, + }, + response: { status: 204 }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/main.tsp new file mode 100644 index 00000000000..a99a83023b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/main.tsp @@ -0,0 +1,142 @@ +import "@azure-tools/typespec-azure-core"; +import "@typespec/spector"; +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-client-generator-core"; + +using global.Azure.Core; +using global.Azure.Core.Traits; +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Spector; + +#suppress "@azure-tools/typespec-azure-core/casing-style" "For spec" +@doc("Illustrates Azure Core operation customizations by traits") +@scenarioService( + "/azure/core/traits", + { + versioned: Versions, + } +) +@versioned(Versions) +@global.Azure.ClientGenerator.Core.clientNamespace("azure.core.traits", "java") +namespace _Specs_.Azure.Core.Traits; + +@doc("Service versions") +enum Versions { + @doc("2022-12-01-preview") + v2022_12_01_preview: "2022-12-01-preview", +} + +alias SmokeOperationsWithTraits = global.Azure.Core.ResourceOperations; + +alias RepeatableOperationsWithTraits = global.Azure.Core.ResourceOperations; + +@doc("Sample Model") +@resource("user") +model User { + @key + @doc("The user's id.") + @visibility(Lifecycle.Read) + id: int32; + + @doc("The user's name.") + name?: string; +} + +@scenario +@doc("Get a resource, sending and receiving headers.") +@scenarioDoc(""" + SDK should not genreate `clientRequestId` paramerter but use policy to auto-set the header. + Expected path parameter: id=1 + Expected query parameter: api-version=2022-12-01-preview + Expected header parameters: + - foo=123 + - if-match=valid + - if-none-match=invalid + - if-unmodified-since=Fri, 26 Aug 2022 14:38:00 GMT + - if-modified-since=Thu, 26 Aug 2021 14:38:00 GMT + - x-ms-client-request-id= + + Expected response header: + - bar="456" + - x-ms-client-request-id= + - etag="11bdc430-65e8-45ad-81d9-8ffa60d55b59" + + Expected response body: + ```json + { + "id": 1, + "name": "Madge" + } + ``` + """) +op smokeTest is SmokeOperationsWithTraits.ResourceRead< + User, + RequestHeadersTrait<{ + @doc("header in request") + @header + foo: string; + }> & + ResponseHeadersTrait<{ + @header bar: string; + }> +>; + +@doc("User action param") +model UserActionParam { + @doc("User action value.") + userActionValue: string; +} + +@doc("User action response") +model UserActionResponse { + @doc("User action result.") + userActionResult: string; +} + +@scenario +@doc("Test for repeatable requests") +@scenarioDoc(""" + Expected path parameter: id=1 + Expected header parameters: + - repeatability-request-id= + - repeatability-first-sent= + Expected request body: + ```json + { + "userActionValue": "test" + } + ``` + + Expected response header: + - repeatability-result=accepted + Expected response body: + ```json + { + "userActionResult": "test" + } + ``` + """) +op repeatableAction is RepeatableOperationsWithTraits.ResourceAction< + User, + BodyParameter, + UserActionResponse +>; + +alias BodyParameter< + T, + TName extends valueof string = "body", + TDoc extends valueof string = "The body parameter." +> = { + @doc(TDoc) + @friendlyName(TName) + @bodyRoot + body: T; +}; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/mockapi.ts new file mode 100644 index 00000000000..e76ed359798 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/mockapi.ts @@ -0,0 +1,131 @@ +import { + json, + MockRequest, + passOnSuccess, + ScenarioMockApi, + validateValueFormat, + ValidationError, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const validUser = { + id: 1, + name: "Madge", +}; + +Scenarios.Azure_Core_Traits_smokeTest = passOnSuccess({ + uri: "/azure/core/traits/user/:id", + method: "get", + request: { + pathParams: { + id: "1", + }, + headers: { + foo: "123", + "If-Match": '"valid"', + "If-None-Match": '"invalid"', + "If-Modified-Since": "Thu, 26 Aug 2021 14:38:00 GMT", + "If-Unmodified-Since": "Fri, 26 Aug 2022 14:38:00 GMT", + "x-ms-client-request-id": "86aede1f-96fa-4e7f-b1e1-bf8a947cb804", + }, + }, + response: { + status: 200, + body: json(validUser), + headers: { + bar: "456", + etag: "11bdc430-65e8-45ad-81d9-8ffa60d55b59", + "x-ms-client-request-id": "86aede1f-96fa-4e7f-b1e1-bf8a947cb804", + }, + }, + handler: (req: MockRequest) => { + if (!("x-ms-client-request-id" in req.headers)) { + throw new ValidationError( + "Should submit header x-ms-client-request-id", + "any uuid", + undefined, + ); + } + if (req.params.id !== "1") { + throw new ValidationError("Expected path param id=1", "1", req.params.id); + } + req.expect.containsHeader("foo", "123"); + const if_none_match = req.headers["if-none-match"]; + const if_match = req.headers["if-match"]; + if (if_none_match !== '"invalid"' && if_match !== '"valid"') { + throw new ValidationError( + `Expected header "if-none-match" equals "invalid" but got ${if_none_match} or "if-match" equals "valid" but got ${if_match}`, + `"if-match": "valid" or "if-none-match": "invalid"`, + `"if-match": ${if_match} or "if-none-match": ${if_none_match}`, + ); + } + req.expect.containsHeader("if-unmodified-since", "Fri, 26 Aug 2022 14:38:00 GMT"); + req.expect.containsHeader("if-modified-since", "Thu, 26 Aug 2021 14:38:00 GMT"); + return { + status: 200, + body: json(validUser), + headers: { + bar: "456", + etag: "11bdc430-65e8-45ad-81d9-8ffa60d55b59", + "x-ms-client-request-id": req.headers["x-ms-client-request-id"], + }, + }; + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_Core_Traits_repeatableAction = passOnSuccess({ + uri: "/azure/core/traits/user/:id\\:repeatableAction", + method: "post", + request: { + body: json({ + userActionValue: "test", + }), + headers: { + "Repeatability-Request-ID": "86aede1f-96fa-4e7f-b1e1-bf8a947cb804", + "Repeatability-First-Sent": "Mon, 27 Nov 2023 11:58:00 GMT", + }, + pathParams: { + id: "1", + }, + }, + response: { + status: 200, + body: json({ userActionResult: "test" }), + headers: { + "repeatability-result": "accepted", + }, + }, + handler: (req: MockRequest) => { + if (req.params.id !== "1") { + throw new ValidationError("Expected path param id=1", "1", req.params.id); + } + + if (!("repeatability-request-id" in req.headers)) { + throw new ValidationError("Repeatability-Request-ID is missing", "A UUID string", undefined); + } + if (!("repeatability-first-sent" in req.headers)) { + throw new ValidationError( + "Repeatability-First-Sent is missing", + "A date-time in headers format", + undefined, + ); + } + + validateValueFormat(req.headers["repeatability-request-id"], "uuid"); + validateValueFormat(req.headers["repeatability-first-sent"], "rfc7231"); + + const validBody = { userActionValue: "test" }; + req.expect.bodyEquals(validBody); + + return { + status: 200, + body: json({ userActionResult: "test" }), + headers: { + "repeatability-result": "accepted", + }, + }; + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/main.tsp new file mode 100644 index 00000000000..35381e467fd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/main.tsp @@ -0,0 +1,33 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using global.Azure.ClientGenerator.Core; +using Spector; + +@doc("Test for azure related encode decorator.") +@scenarioService("/azure/encode/duration") +namespace _Specs_.Azure.Encode.Duration; + +@@clientNamespace(_Specs_.Azure.Encode.Duration, "azure.encode.duration", "java"); + +model DurationModel { + @encode("duration-constant") + input: duration; +} + +@scenario +@scenarioDoc(""" + Test case for azure specific encoding. SDK should generate correct serialization format according to the set encoding. + Expected request body: + ```json + { + "input": "1.02:59:59.5000000" + } + ``` + """) +@doc("Test duration with azure specific encoding.") +@put +@route("/duration-constant") +op durationConstant(@body body: DurationModel): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/mockapi.ts new file mode 100644 index 00000000000..d053fe63a5e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/mockapi.ts @@ -0,0 +1,19 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Azure_Encode_Duration_durationConstant = passOnSuccess([ + { + uri: "/azure/encode/duration/duration-constant", + method: "put", + request: { + body: json({ + input: "1.02:59:59.5000000", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/client.tsp new file mode 100644 index 00000000000..4b84ea8a42f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/client.tsp @@ -0,0 +1,22 @@ +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/spector"; +import "./main.tsp"; + +using Http; +using Azure.ClientGenerator.Core; +using Spector; + +@TypeSpec.Versioning.useDependency(_Specs_.Azure.Example.Basic.Versions.v2022_12_01_preview) +@route("/azure/example/basic") +namespace AzureExampleBasicClient; + +@@clientNamespace(AzureExampleBasicClient, "azure.example.basic", "java"); +@@clientNamespace(_Specs_.Azure.Example.Basic, "azure.example.basic", "java"); + +@client({ + name: "AzureExampleClient", + service: _Specs_.Azure.Example.Basic, +}) +interface AzureExampleClient { + basicAction is _Specs_.Azure.Example.Basic.ServiceOperationGroup.basic; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/examples/2022-12-01-preview/basic.json b/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/examples/2022-12-01-preview/basic.json new file mode 100644 index 00000000000..0583374b7cd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/examples/2022-12-01-preview/basic.json @@ -0,0 +1,26 @@ +{ + "operationId": "ServiceOperationGroup_Basic", + "title": "Basic action", + "parameters": { + "api-version": "2022-12-01-preview", + "query-param": "query", + "header-param": "header", + "body": { + "stringProperty": "text", + "modelProperty": { + "int32Property": 1, + "float32Property": 1.5, + "enumProperty": "EnumValue1" + }, + "arrayProperty": ["item"], + "recordProperty": { + "record": "value" + } + } + }, + "responses": { + "200": { + "stringProperty": "text" + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/main.tsp new file mode 100644 index 00000000000..e127430d5cc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/main.tsp @@ -0,0 +1,95 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/spector"; +import "@typespec/versioning"; + +using Http; +using Rest; +using Versioning; +using Spector; + +/** Test for loading JSON example and generating sample code. */ +@scenarioService( + "/azure/example/basic", + { + versioned: Versions, + } +) +@scenario +@scenarioDoc(""" + Expected request and response is same as the JSON example at examples/2022-12-01-preview/basic.json + + When generate the code, one need to set the "examples-dir" option. + + Expected query parameter: query-param=query&api-version=2022-12-01-preview + Expected header parameter: header-param=header + + Expected input body: + ```json + { + "stringProperty": "text", + "modelProperty": { + "int32Property": 1, + "float32Property": 1.5, + "enumProperty": "EnumValue1" + }, + "arrayProperty": [ + "item" + ], + "recordProperty": { + "record": "value" + } + } + ``` + + Expected response body: + ```json + { + "stringProperty": "text" + } + ``` + """) +namespace _Specs_.Azure.Example.Basic; + +enum Versions { + v2022_12_01_preview: "2022-12-01-preview", +} + +model ApiVersionParameter { + @query("api-version") + @minLength(1) + @doc("The API version to use for this operation.") + apiVersion: string; +} + +model ActionRequest { + stringProperty: string; + modelProperty?: Model; + arrayProperty?: Array; + recordProperty?: Record; +} + +model Model { + int32Property?: int32; + float32Property?: float32; + enumProperty?: Enum; +} + +union Enum { + string, + "EnumValue1", +} + +model ActionResponse is ActionRequest; + +interface ServiceOperationGroup { + #suppress "@typespec/spector/missing-scenario" "scenario defined in client.tsp" + @route("/basic") + @post + basic( + ...ApiVersionParameter, + @query("query-param") queryParam: string, + @header("header-param") headerParam: string, + @body body: ActionRequest, + ): ActionResponse; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/mockapi.ts new file mode 100644 index 00000000000..32b8ea97f83 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/mockapi.ts @@ -0,0 +1,36 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Azure_Example_Basic = passOnSuccess({ + uri: "/azure/example/basic/basic", + method: "post", + request: { + query: { + "api-version": "2022-12-01-preview", + "query-param": "query", + }, + headers: { + "header-param": "header", + }, + body: json({ + stringProperty: "text", + modelProperty: { + int32Property: 1, + float32Property: 1.5, + enumProperty: "EnumValue1", + }, + arrayProperty: ["item"], + recordProperty: { + record: "value", + }, + }), + }, + response: { + status: 200, + body: json({ + stringProperty: "text", + }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/main.tsp new file mode 100644 index 00000000000..4845317ef26 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/main.tsp @@ -0,0 +1,67 @@ +import "@typespec/spector"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using Spector; +using Versioning; +using global.Azure.Core; +using global.Azure.ClientGenerator.Core; + +@doc("Test describing pageable.") +@scenarioService("/azure/payload/pageable") +namespace _Specs_.Azure.Payload.Pageable; + +@@clientNamespace(_Specs_.Azure.Payload.Pageable, "azure.payload.pageable", "java"); + +@doc("User model") +model User { + @doc("User name") + name: string; +} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing pageable" +@scenario +@scenarioDoc(""" + List users. + + SDK may hide the "maxpagesize" from API signature. The functionality of "maxpagesize" could be in related language Page model. + + Expected query parameter: + maxpagesize=3 + + Expected response body: + ```json + { + "value":[ + { + "name":"user5" + }, + { + "name":"user6" + }, + { + "name":"user7" + } + ], + "nextLink": "{endpoint}/azure/payload/pageable?skipToken=name-user7&maxpagesize=3" + } + ``` + + Expected query parameter: + skipToken=name-user7 + maxpagesize=3 + + ```json + { + "value":[ + { + "name":"user8" + } + ] + } + ``` + """) +@doc("List users") +@list +op list(...MaxPageSizeQueryParameter): Page; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/mockapi.ts new file mode 100644 index 00000000000..a7cdf96462f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/mockapi.ts @@ -0,0 +1,74 @@ +import { + json, + MockRequest, + ScenarioMockApi, + ValidationError, + withServiceKeys, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function pageableHandler(req: MockRequest) { + req.expect.containsQueryParam("maxpagesize", "3"); + const skipToken = req.query["skipToken"]; + if (skipToken === undefined) { + return { + pass: "firstPage", + status: 200, + body: json({ + value: [{ name: "user5" }, { name: "user6" }, { name: "user7" }], + nextLink: `${req.baseUrl}/azure/payload/pageable?skipToken=name-user7&maxpagesize=3`, + }), + } as const; + } else if (skipToken === "name-user7") { + return { + pass: "secondPage", + status: 200, + body: json({ value: [{ name: "user8" }] }), + } as const; + } else { + throw new ValidationError( + "Unsupported skipToken query parameter", + `Not provided for first page, "name-user7" for second page`, + req.query["skipToken"], + ); + } +} + +Scenarios.Azure_Payload_Pageable_list = withServiceKeys(["firstPage", "secondPage"]).pass([ + { + uri: "/azure/payload/pageable", + method: "get", + request: { + query: { + maxpagesize: "3", + }, + }, + response: { + status: 200, + // TODO: next link not working as it should include the base url + // body: json({ + // value: [{ name: "user5" }, { name: "user6" }, { name: "user7" }], + // nextLink: `/azure/payload/pageable?skipToken=name-user7&maxpagesize=3`, + // }), + }, + handler: pageableHandler, + kind: "MockApiDefinition", + }, + { + uri: "/azure/payload/pageable", + method: "get", + request: { + query: { + maxpagesize: "3", + skipToken: "name-user7", + }, + }, + response: { + status: 200, + body: json({ value: [{ name: "user8" }] }), + }, + handler: pageableHandler, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/error.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/error.tsp new file mode 100644 index 00000000000..e7a40bb0696 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/error.tsp @@ -0,0 +1,161 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using Http; +using Rest; +using Versioning; +using Azure.Core; +using Azure.ResourceManager; +using Spector; + +namespace Azure.ResourceManager.CommonProperties; + +@resource("confidentialResources") +model ConfidentialResource is TrackedResource { + ...ResourceNameParameter; +} + +@doc("Confidential Resource Properties.") +model ConfidentialResourceProperties { + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState: string; + + username: string; +} + +/** + * Api error. + */ +model ApiError { + /** + * The Api error details + */ + details?: ApiErrorBase[]; + + /** + * The Api inner error + */ + innererror?: InnerError; + + /** + * The error code. + */ + code?: string; + + /** + * The target of the particular error. + */ + target?: string; + + /** + * The error message. + */ + message?: string; +} + +/** + * Api error base. + */ +model ApiErrorBase { + /** + * The error code. + */ + code?: string; + + /** + * The target of the particular error. + */ + target?: string; + + /** + * The error message. + */ + message?: string; +} + +/** + * Inner error details. + */ +model InnerError { + /** + * The exception type. + */ + exceptiontype?: string; + + /** + * The internal error message or exception dump. + */ + errordetail?: string; +} + +/** + * An error response. + */ +@error +model CloudError { + /** + * Api error. + */ + error?: ApiError; +} + +@armResourceOperations +interface Error { + @scenario + @scenarioDoc(""" + Resource GET operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/confidentialResources/confidential", + Expected query parameter: api-version=2023-12-01-preview + + Expected response status code: 404 + Expected response body: + ```json + { + "error": { + "code": "ResourceNotFound", + "message": "The Resource 'Azure.ResourceManager.CommonProperties/confidentialResources/confidential' under resource group 'test-rg' was not found." + } + } + ``` + """) + getForPredefinedError is ArmResourceRead; + + @scenario + @scenarioDoc(""" + Resource PUT operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/confidentialResources/confidential", + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "location": , + "properties": { + "username": "00" + } + } + ``` + + Expected response status code: 400 + Expected response body: + ```json + { + "error": { + "code": "BadRequest", + "message": "Username should not contain only numbers.", + "innererror": { + "exceptiontype": "general" + } + } + } + ``` + """) + createForUserDefinedError is ArmResourceCreateOrReplaceSync< + ConfidentialResource, + Error = CloudError + >; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/main.tsp new file mode 100644 index 00000000000..c534559bd05 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/main.tsp @@ -0,0 +1,25 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "./managed-identity.tsp"; +import "./error.tsp"; + +using Http; +using Rest; +using Versioning; +using Azure.Core; +using Azure.ResourceManager; + +@armProviderNamespace +@service +@versioned(Versions) +@doc("Arm Managed Identity Provider management API.") +namespace Azure.ResourceManager.CommonProperties; + +@doc("Azure API versions.") +enum Versions { + @doc("Preview API version 2023-12-01-preview.") + v2023_12_01_preview: "2023-12-01-preview", +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/managed-identity.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/managed-identity.tsp new file mode 100644 index 00000000000..1499dfc17a1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/managed-identity.tsp @@ -0,0 +1,150 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using Http; +using Rest; +using Versioning; +using Azure.Core; +using Azure.ResourceManager; +using Spector; + +namespace Azure.ResourceManager.CommonProperties; + +@resource("managedIdentityTrackedResources") +model ManagedIdentityTrackedResource + is Azure.ResourceManager.TrackedResource { + @key("managedIdentityTrackedResourceName") + @path + @segment("managedIdentityTrackedResources") + @doc("arm resource name for path") + @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") + name: string; + + ...ManagedServiceIdentityProperty; +} + +@doc("Managed Identity Arm Resource Properties.") +model ManagedIdentityTrackedResourceProperties { + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState: string; +} + +@armResourceOperations +interface ManagedIdentity { + @scenario + @scenarioDoc(""" + Resource GET operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity", + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity", + "location": "eastus", + "tags": { + "tagKey1": "tagValue1" + }, + "identity": { + "type": "SystemAssigned", + "principalId": + "tenantId": + }, + "properties": { + "provisioningState": "Succeeded" + } + } + ``` + """) + get is ArmResourceRead; + + @scenario + @scenarioDoc(""" + Resource PUT operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity", + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "location": "eastus", + "tags": { + "tagKey1": "tagValue1" + }, + "properties": {}, + "identity": { + "type": "SystemAssigned" + } + } + ``` + Expected response body: + ```json + { + "id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity", + "location": "eastus", + "tags": { + "tagKey1": "tagValue1" + }, + "identity": { + "type": "SystemAssigned", + "principalId": , + "tenantId": + }, + "properties": { + "provisioningState": "Succeeded" + } + } + ``` + """) + createWithSystemAssigned is ArmResourceCreateOrReplaceSync; + + @scenario + @scenarioDoc(""" + Resource PATCH operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity", + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "identity": { + "type": "SystemAssigned,UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {} + } + } + } + ``` + Expected response body: + ```json + { + "id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity", + "location": "eastus", + "tags": { + "tagKey1": "tagValue1" + }, + "identity": { + "type": "SystemAssigned,UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": { + "principalId": , + "clientId": + }, + }, + "principalId": , + "tenantId": + }, + "properties": { + "provisioningState": "Succeeded" + } + } + ``` + """) + updateWithUserAssignedAndSystemAssigned is ArmCustomPatchSync< + ManagedIdentityTrackedResource, + ManagedIdentityTrackedResource + >; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/mockapi.ts new file mode 100644 index 00000000000..d07f6b9898f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/mockapi.ts @@ -0,0 +1,233 @@ +import { deepEquals } from "@typespec/compiler/utils"; +import { + json, + passOnCode, + passOnSuccess, + ScenarioMockApi, + ValidationError, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const SUBSCRIPTION_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; +const PRINCIPAL_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; +const TENANT_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; +const CLIENT_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; +const LOCATION_REGION_EXPECTED = "eastus"; +const RESOURCE_GROUP_EXPECTED = "test-rg"; +const IDENTITY_TYPE_SYSTEM_ASSIGNED_EXPECTED = "SystemAssigned"; +const IDENTITY_TYPE_SYSTEM_USER_ASSIGNED_EXPECTED = "SystemAssigned,UserAssigned"; +const validSystemAssignedManagedIdentityResource = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity`, + location: `${LOCATION_REGION_EXPECTED}`, + tags: { + tagKey1: "tagValue1", + }, + identity: { + type: `${IDENTITY_TYPE_SYSTEM_ASSIGNED_EXPECTED}`, + principalId: `${PRINCIPAL_ID_EXPECTED}`, + tenantId: `${TENANT_ID_EXPECTED}`, + }, + properties: { + provisioningState: "Succeeded", + }, +}; + +const validUserAssignedAndSystemAssignedManagedIdentityResource = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity`, + location: `${LOCATION_REGION_EXPECTED}`, + tags: { + tagKey1: "tagValue1", + }, + identity: { + type: `${IDENTITY_TYPE_SYSTEM_USER_ASSIGNED_EXPECTED}`, + userAssignedIdentities: { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": + { + principalId: `${PRINCIPAL_ID_EXPECTED}`, + clientId: `${CLIENT_ID_EXPECTED}`, + }, + }, + principalId: `${PRINCIPAL_ID_EXPECTED}`, + tenantId: `${TENANT_ID_EXPECTED}`, + }, + properties: { + provisioningState: "Succeeded", + }, +}; + +const createExpectedIdentity = { + type: `${IDENTITY_TYPE_SYSTEM_ASSIGNED_EXPECTED}`, +}; + +const updateExpectedIdentity = { + type: `${IDENTITY_TYPE_SYSTEM_USER_ASSIGNED_EXPECTED}`, + userAssignedIdentities: { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": + {}, + }, +}; + +// managed identity tracked resource +Scenarios.Azure_ResourceManager_CommonProperties_ManagedIdentity_get = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/:managedIdentityResourceName", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + managedIdentityResourceName: "identity", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validSystemAssignedManagedIdentityResource), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_CommonProperties_ManagedIdentity_createWithSystemAssigned = + passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/:managedIdentityResourceName", + method: "put", + request: { + body: json({ + location: "eastus", + tags: { + tagKey1: "tagValue1", + }, + properties: {}, + identity: createExpectedIdentity, + }), + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + managedIdentityResourceName: "identity", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validSystemAssignedManagedIdentityResource), + }, + kind: "MockApiDefinition", + handler: (req) => { + // .NET SDK would not send "properties" property, if it is empty. + // Hence here we only verify "identity" property. + if (!deepEquals(req.body["identity"], createExpectedIdentity)) { + throw new ValidationError( + "Body should contain 'identity' property", + createExpectedIdentity, + req.body, + ); + } + return { + status: 200, + body: json(validSystemAssignedManagedIdentityResource), + }; + }, + }); + +Scenarios.Azure_ResourceManager_CommonProperties_ManagedIdentity_updateWithUserAssignedAndSystemAssigned = + passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/:managedIdentityResourceName", + method: "patch", + request: { + body: json({ + identity: updateExpectedIdentity, + }), + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + managedIdentityResourceName: "identity", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validUserAssignedAndSystemAssignedManagedIdentityResource), + }, + kind: "MockApiDefinition", + handler: (req) => { + if (!deepEquals(req.body["identity"], updateExpectedIdentity)) { + throw new ValidationError( + "Body should contain 'identity' property", + updateExpectedIdentity, + req.body, + ); + } + return { + status: 200, + body: json(validUserAssignedAndSystemAssignedManagedIdentityResource), + }; + }, + }); + +Scenarios.Azure_ResourceManager_CommonProperties_Error_getForPredefinedError = passOnCode(404, { + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.CommonProperties/confidentialResources/:resourceName", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + resourceName: "confidential", + }, + query: { + "api-version": "2023-12-01-preview", + }, + status: 404, + }, + response: { + status: 404, + body: json({ + error: { + code: "ResourceNotFound", + message: + "The Resource 'Azure.ResourceManager.CommonProperties/confidentialResources/confidential' under resource group 'test-rg' was not found.", + }, + }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_CommonProperties_Error_createForUserDefinedError = passOnCode(400, { + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.CommonProperties/confidentialResources/:resourceName", + method: "put", + request: { + body: json({ + location: "eastus", + properties: { + username: "00", + }, + }), + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + resourceName: "confidential", + }, + query: { + "api-version": "2023-12-01-preview", + }, + status: 400, + }, + response: { + status: 400, + body: json({ + error: { + code: "BadRequest", + message: "Username should not contain only numbers.", + innererror: { + exceptiontype: "general", + }, + }, + }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/main.tsp new file mode 100644 index 00000000000..085fe16d295 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/main.tsp @@ -0,0 +1,121 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/spector"; + +using Http; +using Rest; +using Versioning; +using Azure.Core; +using Azure.ResourceManager; +using Spector; + +@armProviderNamespace +@service +@versioned(Versions) +@doc("Arm Resource Provider management API.") +namespace Azure.ResourceManager.LargeHeader; + +@doc("Azure API versions.") +enum Versions { + @armCommonTypesVersion(CommonTypes.Versions.v5) + @doc("Preview API version 2023-12-01-preview.") + v2023_12_01_preview: "2023-12-01-preview", +} + +@resource("largeHeaders") +model LargeHeader is TrackedResource { + ...ResourceNameParameter; +} + +model LargeHeaderProperties { + @doc("The provisioning state of the resource.") + @visibility(Lifecycle.Read) + provisioningState?: string; +} + +model CancelResult { + succeeded: boolean; +} + +@armResourceOperations +interface LargeHeaders { + @scenario + @scenarioDoc(""" + Resource POST operation with long LRO headers(> 6KB + 6KB = 12KB). + To pass the test, client should accept both: + 1. Single header size that's more than 6KB. 7KB is sure to pass the test. + 2. Total headers size that's more than 12KB. 13KB is sure to pass the test. + + Service returns both Location and Azure-AsyncOperation header on initial request. + final-state-via: location + + Expected verb: POST + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.LargeHeader/largeHeaders/header1/two6k + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 202 + Expected response headers: + - Azure-AsyncOperation={endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post?userContext=<6KB-string> + - Location={endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/operations/post?userContext=<6KB-string> + Expected no response body + + Whether you do polling through AAO, Location or combined, first one will respond with provisioning state "InProgress", second one with "Succeeded". + + AAO first poll. + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post_aao?userContext=<6KB-string> + Expected status code: 200 + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post_aao?userContext=<6KB-string>", + "name": "post_aao", + "status" : "InProgress", + "startTime": "2024-11-08T01:41:53.5508583+00:00" + } + ``` + + AAO second poll. + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post_aao?userContext=<6KB-string> + Expected status code: 200 + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post_aao?userContext=<6KB-string>", + "name": "post_aao", + "status" : "Succeeded", + "startTime": "2024-11-08T01:41:53.5508583+00:00", + "endTime": "2024-11-08T01:42:41.5354192+00:00" + } + ``` + + Location first poll. + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post_location?userContext=<6KB-string> + Expected status code: 202 + Expected no response body + + Location second poll. + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post_location?userContext=<6KB-string> + Expected status code: 200 + Expected response body: + ```json + { + "succeeded": true + } + ``` + """) + two6k is ArmResourceActionAsync< + LargeHeader, + void, + CancelResult, + LroHeaders = ArmCombinedLroHeaders & + Azure.Core.Foundations.RetryAfterHeader, + OptionalRequestBody = true + >; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/mockapi.ts new file mode 100644 index 00000000000..948ccabf9d2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/mockapi.ts @@ -0,0 +1,116 @@ +import { + dyn, + dynItem, + json, + MockRequest, + passOnSuccess, + ScenarioMockApi, + ValidationError, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const SUBSCRIPTION_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; +const RESOURCE_GROUP_EXPECTED = "test-rg"; +const SIX_KB_STRING = "a".repeat(1024 * 6); +let pollCount = 0; + +Scenarios.Azure_ResourceManager_LargeHeader_LargeHeaders_two6k = passOnSuccess([ + { + // LRO POST initial request + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.LargeHeader/largeHeaders/header1/two6k", + method: "post", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 202, + headers: { + location: dyn`${dynItem("baseUrl")}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.LargeHeaders/locations/eastus/operations/post_location?userContext=${SIX_KB_STRING}`, + "azure-asyncoperation": dyn`${dynItem("baseUrl")}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.LargeHeaders/locations/eastus/operations/post_aao?userContext=${SIX_KB_STRING}`, + }, + }, + handler: (req: MockRequest) => { + pollCount = 0; + return { + status: 202, + headers: { + location: `${req.baseUrl}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.LargeHeaders/locations/eastus/operations/post_location?userContext=${SIX_KB_STRING}`, + "azure-asyncoperation": `${req.baseUrl}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.LargeHeaders/locations/eastus/operations/post_aao?userContext=${SIX_KB_STRING}`, + }, + }; + }, + kind: "MockApiDefinition", + }, + { + // LRO POST poll intermediate/get final result + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.LargeHeaders/locations/eastus/operations/:operation_name", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + operation_name: "post_aao", // operation_name can be "post_location" or "post_aao", depending on the header you choose to poll. "post_aao" here is just for passing e2e test + }, + query: { + "api-version": "2023-12-01-preview", + userContext: SIX_KB_STRING, + }, + }, + response: { + status: 200, // This is for passing e2e test. For actual status code, see "handler" definition below + }, + handler: (req: MockRequest) => { + let response; + const operation_name = req.params["operation_name"]; + if (operation_name === "post_location") { + response = + // first status will be 200, second and forward be 204 + pollCount > 0 + ? { + status: 200, + body: json({ + succeeded: true, + }), + } + : { status: 202 }; + } else if (operation_name === "post_aao") { + const aaoResponse = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.LargeHeaders/locations/eastus/operations/post_aao?userContext=${SIX_KB_STRING}`, + name: "lro_post_aao", + startTime: "2024-11-08T01:41:53.5508583+00:00", + }; + // first provisioningState will be "InProgress", second and forward be "Succeeded" + const responseBody = + pollCount > 0 + ? { + ...aaoResponse, + status: "Succeeded", + endTime: "2024-11-08T01:42:41.5354192+00:00", + } + : { ...aaoResponse, status: "InProgress" }; + + response = { + status: 200, // aao always returns 200 with response body + body: json(responseBody), + }; + } else { + throw new ValidationError( + `Unexpected lro poll operation: ${operation_name}`, + undefined, + undefined, + ); + } + + pollCount += 1; + + return response; + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/client.tsp new file mode 100644 index 00000000000..d53bc046852 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/client.tsp @@ -0,0 +1,43 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; + +using Azure.ClientGenerator.Core; +using Azure.ResourceManager.MethodSubscriptionId; + +// Scenario 1: Two subscription resources - move all subscriptionId parameters to method level +@@clientLocation(TwoSubscriptionResourcesMethodLevel.GetSubscriptionResource1BaseParameter.subscriptionId, + TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.get +); + +@@clientLocation(TwoSubscriptionResourcesMethodLevel.PutSubscriptionResource1BaseParameter.subscriptionId, + TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.put +); + +@@clientLocation(TwoSubscriptionResourcesMethodLevel.DeleteSubscriptionResource1BaseParameter.subscriptionId, + TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.delete +); + +@@clientLocation(TwoSubscriptionResourcesMethodLevel.GetSubscriptionResource2BaseParameter.subscriptionId, + TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.get +); + +@@clientLocation(TwoSubscriptionResourcesMethodLevel.PutSubscriptionResource2BaseParameter.subscriptionId, + TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.put +); + +@@clientLocation(TwoSubscriptionResourcesMethodLevel.DeleteSubscriptionResource2BaseParameter.subscriptionId, + TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.delete +); + +// Scenario 2: Mixed placement - only move subscriptionId for subscription resource operations to method level +@@clientLocation(MixedSubscriptionPlacement.GetSubscriptionResourceBaseParameter.subscriptionId, + MixedSubscriptionPlacement.SubscriptionResourceOperations.get +); + +@@clientLocation(MixedSubscriptionPlacement.PutSubscriptionResourceBaseParameter.subscriptionId, + MixedSubscriptionPlacement.SubscriptionResourceOperations.put +); + +@@clientLocation(MixedSubscriptionPlacement.DeleteSubscriptionResourceBaseParameter.subscriptionId, + MixedSubscriptionPlacement.SubscriptionResourceOperations.delete +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/main.tsp new file mode 100644 index 00000000000..cbdec4b1a3c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/main.tsp @@ -0,0 +1,502 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/spector"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@azure-tools/typespec-client-generator-core"; + +using Rest; +using Spector; +using Versioning; +using Azure.ResourceManager.Foundations; + +@armProviderNamespace +@service +@versioned(Versions) +@doc("Test for ARM method level subscription ID parameter placement") +namespace Azure.ResourceManager.MethodSubscriptionId; + +@doc("Azure API versions.") +enum Versions { + @armCommonTypesVersion(CommonTypes.Versions.v5) + @doc("Preview API version 2023-12-01-preview.") + v2023_12_01_preview: "2023-12-01-preview", +} + +@scenario +@scenarioDoc(""" + Operations list GET operation for Azure.ResourceManager.MethodSubscriptionId. + Expected path: /providers/Azure.ResourceManager.MethodSubscriptionId/operations + Expected query parameter: api-version=2023-12-01-preview + Expected response body: + ```json + { + "value": [ + { + "name": "Azure.ResourceManager.MethodSubscriptionId/services/read", + "isDataAction": false, + "display": { + "provider": "Azure.ResourceManager.MethodSubscriptionId", + "resource": "services", + "operation": "Lists services", + "description": "Lists registered services" + } + } + ] + } + ``` + """) +interface Operations extends Azure.ResourceManager.Operations {} + +/** + * Scenario 1: Two subscription level resources with subscriptionId at method level for all operations + * + * Test that subscriptionId parameter stays at method level for all operations on subscription-scoped resources. + * + * This scenario has two subscription-level resources (SubscriptionResource1 and SubscriptionResource2) where + * the subscriptionId parameter is explicitly moved from client level to method level for all operations + * using @clientLocation decorator. + * + * Expected behavior: + * - Client should not have subscriptionId parameter in initialization + * - All operations (get, put, delete) should have subscriptionId as method-level parameter + */ +namespace TwoSubscriptionResourcesMethodLevel { + @subscriptionResource + @resource("subscriptionResource1s") + model SubscriptionResource1 is ProxyResource { + ...ResourceNameParameter; + } + + @doc("Properties of subscription resource 1.") + model SubscriptionResource1Properties { + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState?: ResourceProvisioningState; + + @doc("The description of the resource.") + description?: string; + } + + @subscriptionResource + @resource("subscriptionResource2s") + model SubscriptionResource2 is ProxyResource { + ...ResourceNameParameter; + } + + @doc("Properties of subscription resource 2.") + model SubscriptionResource2Properties { + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState?: ResourceProvisioningState; + + @doc("The configuration value.") + configValue?: string; + } + + // Define base parameter models to enable subscriptionId parameter access + model GetSubscriptionResource1BaseParameter + is Azure.ResourceManager.Foundations.DefaultBaseParameters; + model PutSubscriptionResource1BaseParameter + is Azure.ResourceManager.Foundations.DefaultBaseParameters; + model DeleteSubscriptionResource1BaseParameter + is Azure.ResourceManager.Foundations.DefaultBaseParameters; + + model GetSubscriptionResource2BaseParameter + is Azure.ResourceManager.Foundations.DefaultBaseParameters; + model PutSubscriptionResource2BaseParameter + is Azure.ResourceManager.Foundations.DefaultBaseParameters; + model DeleteSubscriptionResource2BaseParameter + is Azure.ResourceManager.Foundations.DefaultBaseParameters; + + @armResourceOperations + interface SubscriptionResource1Operations { + @scenario + @scenarioDoc(""" + Resource GET operation for SubscriptionResource1 with method-level subscriptionId. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/sub-resource-1 + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/sub-resource-1", + "name": "sub-resource-1", + "type": "Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s", + "properties":{ + "description": "Valid subscription resource 1", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": "2023-01-01T00:00:00.000Z", + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": "2023-01-01T00:00:00.000Z", + "lastModifiedByType": "User" + } + } + ``` + """) + get is ArmResourceRead< + SubscriptionResource1, + BaseParameters = GetSubscriptionResource1BaseParameter + >; + + @scenario + @scenarioDoc(""" + Resource PUT operation for SubscriptionResource1 with method-level subscriptionId. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/sub-resource-1 + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "properties":{ + "description": "Valid subscription resource 1" + } + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/sub-resource-1", + "name": "sub-resource-1", + "type": "Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s", + "properties":{ + "description": "Valid subscription resource 1", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": "2023-01-01T00:00:00.000Z", + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": "2023-01-01T00:00:00.000Z", + "lastModifiedByType": "User" + } + } + ``` + """) + put is ArmResourceCreateOrReplaceSync< + SubscriptionResource1, + BaseParameters = PutSubscriptionResource1BaseParameter + >; + + @scenario + @scenarioDoc(""" + Resource DELETE operation for SubscriptionResource1 with method-level subscriptionId. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/sub-resource-1 + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + """) + delete is ArmResourceDeleteSync< + SubscriptionResource1, + BaseParameters = DeleteSubscriptionResource1BaseParameter + >; + } + + @armResourceOperations + interface SubscriptionResource2Operations { + @scenario + @scenarioDoc(""" + Resource GET operation for SubscriptionResource2 with method-level subscriptionId. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/sub-resource-2 + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/sub-resource-2", + "name": "sub-resource-2", + "type": "Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s", + "properties":{ + "configValue": "test-config", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": "2023-01-01T00:00:00.000Z", + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": "2023-01-01T00:00:00.000Z", + "lastModifiedByType": "User" + } + } + ``` + """) + get is ArmResourceRead< + SubscriptionResource2, + BaseParameters = GetSubscriptionResource2BaseParameter + >; + + @scenario + @scenarioDoc(""" + Resource PUT operation for SubscriptionResource2 with method-level subscriptionId. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/sub-resource-2 + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "properties":{ + "configValue": "test-config" + } + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/sub-resource-2", + "name": "sub-resource-2", + "type": "Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s", + "properties":{ + "configValue": "test-config", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": "2023-01-01T00:00:00.000Z", + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": "2023-01-01T00:00:00.000Z", + "lastModifiedByType": "User" + } + } + ``` + """) + put is ArmResourceCreateOrReplaceSync< + SubscriptionResource2, + BaseParameters = PutSubscriptionResource2BaseParameter + >; + + @scenario + @scenarioDoc(""" + Resource DELETE operation for SubscriptionResource2 with method-level subscriptionId. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/sub-resource-2 + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + """) + delete is ArmResourceDeleteSync< + SubscriptionResource2, + BaseParameters = DeleteSubscriptionResource2BaseParameter + >; + } +} + +/** + * Scenario 2: One subscription level resource (method-level subscriptionId) and one resource group level resource (client-level subscriptionId) + * + * Test mixed parameter placement: subscription resource with method-level subscriptionId and resource group resource with client-level subscriptionId. + * + * This scenario has: + * 1. One subscription-level resource (SubscriptionResource) with subscriptionId moved to method level + * 2. One resource group-level resource (ResourceGroupResource) with subscriptionId staying at client level + * + * Expected behavior: + * - Client should have subscriptionId parameter in initialization (for ResourceGroupResource operations) + * - SubscriptionResource operations should have subscriptionId as method-level parameter + * - ResourceGroupResource operations should not have subscriptionId as method-level parameter (uses client-level) + */ +namespace MixedSubscriptionPlacement { + @subscriptionResource + @resource("subscriptionResources") + model SubscriptionResource is ProxyResource { + ...ResourceNameParameter; + } + + @doc("Properties of subscription resource.") + model SubscriptionResourceProperties { + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState?: ResourceProvisioningState; + + @doc("The subscription-scoped setting.") + subscriptionSetting?: string; + } + + @resource("resourceGroupResources") + model ResourceGroupResource is TrackedResource { + ...ResourceNameParameter; + } + + @doc("Properties of resource group resource.") + model ResourceGroupResourceProperties { + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState?: ResourceProvisioningState; + + @doc("The resource group-scoped setting.") + resourceGroupSetting?: string; + } + + // Define base parameter models only for subscription resource to enable subscriptionId parameter access + model GetSubscriptionResourceBaseParameter is DefaultBaseParameters; + model PutSubscriptionResourceBaseParameter is DefaultBaseParameters; + model DeleteSubscriptionResourceBaseParameter is DefaultBaseParameters; + + @armResourceOperations + interface SubscriptionResourceOperations { + @scenario + @scenarioDoc(""" + Resource GET operation for subscription-scoped resource with method-level subscriptionId in mixed scenario. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/sub-resource + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/sub-resource", + "name": "sub-resource", + "type": "Azure.ResourceManager.MethodSubscriptionId/subscriptionResources", + "properties":{ + "subscriptionSetting": "test-sub-setting", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": "2023-01-01T00:00:00.000Z", + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": "2023-01-01T00:00:00.000Z", + "lastModifiedByType": "User" + } + } + ``` + """) + get is ArmResourceRead< + SubscriptionResource, + BaseParameters = GetSubscriptionResourceBaseParameter + >; + + @scenario + @scenarioDoc(""" + Resource PUT operation for subscription-scoped resource with method-level subscriptionId in mixed scenario. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/sub-resource + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "properties":{ + "subscriptionSetting": "test-sub-setting" + } + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/sub-resource", + "name": "sub-resource", + "type": "Azure.ResourceManager.MethodSubscriptionId/subscriptionResources", + "properties":{ + "subscriptionSetting": "test-sub-setting", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": "2023-01-01T00:00:00.000Z", + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": "2023-01-01T00:00:00.000Z", + "lastModifiedByType": "User" + } + } + ``` + """) + put is ArmResourceCreateOrReplaceSync< + SubscriptionResource, + BaseParameters = PutSubscriptionResourceBaseParameter + >; + + @scenario + @scenarioDoc(""" + Resource DELETE operation for subscription-scoped resource with method-level subscriptionId in mixed scenario. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/sub-resource + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + """) + delete is ArmResourceDeleteSync< + SubscriptionResource, + BaseParameters = DeleteSubscriptionResourceBaseParameter + >; + } + + @armResourceOperations + interface ResourceGroupResourceOperations { + @scenario + @scenarioDoc(""" + Resource GET operation for resource group-scoped resource with client-level subscriptionId in mixed scenario. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/rg-resource + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/rg-resource", + "name": "rg-resource", + "type": "Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources", + "location": "eastus", + "properties":{ + "resourceGroupSetting": "test-setting", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": "2023-01-01T00:00:00.000Z", + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": "2023-01-01T00:00:00.000Z", + "lastModifiedByType": "User" + } + } + ``` + """) + get is ArmResourceRead; + + @scenario + @scenarioDoc(""" + Resource PUT operation for resource group-scoped resource with client-level subscriptionId in mixed scenario. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/rg-resource + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "location": "eastus", + "properties":{ + "resourceGroupSetting": "test-setting" + } + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/rg-resource", + "name": "rg-resource", + "type": "Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources", + "location": "eastus", + "properties":{ + "resourceGroupSetting": "test-setting", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": "2023-01-01T00:00:00.000Z", + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": "2023-01-01T00:00:00.000Z", + "lastModifiedByType": "User" + } + } + ``` + """) + put is ArmResourceCreateOrReplaceSync; + + @scenario + @scenarioDoc(""" + Resource DELETE operation for resource group-scoped resource with client-level subscriptionId in mixed scenario. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/rg-resource + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + """) + delete is ArmResourceDeleteSync; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/mockapi.ts new file mode 100644 index 00000000000..22d4c8aca01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/mockapi.ts @@ -0,0 +1,238 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const SUBSCRIPTION_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; +const RESOURCE_GROUP_EXPECTED = "test-rg"; +const LOCATION_EXPECTED = "eastus"; +const API_VERSION = "2023-12-01-preview"; + +// Resource objects +const validSubscriptionResource1 = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/sub-resource-1`, + name: "sub-resource-1", + type: "Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s", + properties: { + provisioningState: "Succeeded", + description: "Valid subscription resource 1", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2023-01-01T00:00:00.000Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2023-01-01T00:00:00.000Z", + lastModifiedByType: "User", + }, +}; + +const validSubscriptionResource2 = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/sub-resource-2`, + name: "sub-resource-2", + type: "Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s", + properties: { + provisioningState: "Succeeded", + configValue: "test-config", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2023-01-01T00:00:00.000Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2023-01-01T00:00:00.000Z", + lastModifiedByType: "User", + }, +}; + +const validMixedSubscriptionResource = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/sub-resource`, + name: "sub-resource", + type: "Azure.ResourceManager.MethodSubscriptionId/subscriptionResources", + properties: { + provisioningState: "Succeeded", + subscriptionSetting: "test-sub-setting", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2023-01-01T00:00:00.000Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2023-01-01T00:00:00.000Z", + lastModifiedByType: "User", + }, +}; + +const validResourceGroupResource = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/rg-resource`, + name: "rg-resource", + type: "Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources", + location: LOCATION_EXPECTED, + properties: { + provisioningState: "Succeeded", + resourceGroupSetting: "test-setting", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2023-01-01T00:00:00.000Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2023-01-01T00:00:00.000Z", + lastModifiedByType: "User", + }, +}; + +// Helper function to create resource operations +function createResourceOperations( + resourceTypePattern: string, + resourceName: string, + resourceObject: any, + requestBody: any, + isResourceGroupScoped = false, +) { + const baseUri = isResourceGroupScoped + ? `/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Azure.ResourceManager.MethodSubscriptionId/${resourceTypePattern}` + : `/subscriptions/:subscriptionId/providers/Azure.ResourceManager.MethodSubscriptionId/${resourceTypePattern}`; + + const basePathParams = isResourceGroupScoped + ? { subscriptionId: SUBSCRIPTION_ID_EXPECTED, resourceGroupName: RESOURCE_GROUP_EXPECTED } + : { subscriptionId: SUBSCRIPTION_ID_EXPECTED }; + + return { + get: { + uri: `${baseUri}/:name`, + method: "get" as const, + request: { + pathParams: { ...basePathParams, name: resourceName }, + query: { "api-version": API_VERSION }, + }, + response: { + status: 200, + body: json(resourceObject), + }, + kind: "MockApiDefinition" as const, + }, + put: { + uri: `${baseUri}/:name`, + method: "put" as const, + request: { + body: json(requestBody), + pathParams: { ...basePathParams, name: resourceName }, + query: { "api-version": API_VERSION }, + }, + response: { + status: 200, + body: json(resourceObject), + }, + kind: "MockApiDefinition" as const, + }, + delete: { + uri: `${baseUri}/:name`, + method: "delete" as const, + request: { + pathParams: { ...basePathParams, name: resourceName }, + query: { "api-version": API_VERSION }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition" as const, + }, + }; +} + +// Resource operations using helper function +const subscriptionResource1Ops = createResourceOperations( + "subscriptionResource1s", + "sub-resource-1", + validSubscriptionResource1, + { properties: { description: "Valid subscription resource 1" } }, +); + +const subscriptionResource2Ops = createResourceOperations( + "subscriptionResource2s", + "sub-resource-2", + validSubscriptionResource2, + { properties: { configValue: "test-config" } }, +); + +const mixedSubscriptionResourceOps = createResourceOperations( + "subscriptionResources", + "sub-resource", + validMixedSubscriptionResource, + { properties: { subscriptionSetting: "test-sub-setting" } }, +); + +const resourceGroupResourceOps = createResourceOperations( + "resourceGroupResources", + "rg-resource", + validResourceGroupResource, + { + location: LOCATION_EXPECTED, + properties: { resourceGroupSetting: "test-setting" }, + }, + true, +); + +// Operations scenario +Scenarios.Azure_ResourceManager_MethodSubscriptionId_Operations = passOnSuccess({ + uri: "/providers/Azure.ResourceManager.MethodSubscriptionId/operations", + method: "get" as const, + request: { + query: { "api-version": API_VERSION }, + }, + response: { + status: 200, + body: json({ + value: [ + { + name: "Azure.ResourceManager.MethodSubscriptionId/services/read", + isDataAction: false, + display: { + provider: "Azure.ResourceManager.MethodSubscriptionId", + resource: "services", + operation: "Lists services", + description: "Lists registered services", + }, + }, + ], + }), + }, + kind: "MockApiDefinition" as const, +}); + +// Scenario assignments +Scenarios.Azure_ResourceManager_MethodSubscriptionId_TwoSubscriptionResourcesMethodLevel_SubscriptionResource1Operations_get = + passOnSuccess(subscriptionResource1Ops.get); + +Scenarios.Azure_ResourceManager_MethodSubscriptionId_TwoSubscriptionResourcesMethodLevel_SubscriptionResource1Operations_put = + passOnSuccess(subscriptionResource1Ops.put); + +Scenarios.Azure_ResourceManager_MethodSubscriptionId_TwoSubscriptionResourcesMethodLevel_SubscriptionResource1Operations_delete = + passOnSuccess(subscriptionResource1Ops.delete); + +Scenarios.Azure_ResourceManager_MethodSubscriptionId_TwoSubscriptionResourcesMethodLevel_SubscriptionResource2Operations_get = + passOnSuccess(subscriptionResource2Ops.get); + +Scenarios.Azure_ResourceManager_MethodSubscriptionId_TwoSubscriptionResourcesMethodLevel_SubscriptionResource2Operations_put = + passOnSuccess(subscriptionResource2Ops.put); + +Scenarios.Azure_ResourceManager_MethodSubscriptionId_TwoSubscriptionResourcesMethodLevel_SubscriptionResource2Operations_delete = + passOnSuccess(subscriptionResource2Ops.delete); + +Scenarios.Azure_ResourceManager_MethodSubscriptionId_MixedSubscriptionPlacement_SubscriptionResourceOperations_get = + passOnSuccess(mixedSubscriptionResourceOps.get); + +Scenarios.Azure_ResourceManager_MethodSubscriptionId_MixedSubscriptionPlacement_SubscriptionResourceOperations_put = + passOnSuccess(mixedSubscriptionResourceOps.put); + +Scenarios.Azure_ResourceManager_MethodSubscriptionId_MixedSubscriptionPlacement_SubscriptionResourceOperations_delete = + passOnSuccess(mixedSubscriptionResourceOps.delete); + +Scenarios.Azure_ResourceManager_MethodSubscriptionId_MixedSubscriptionPlacement_ResourceGroupResourceOperations_get = + passOnSuccess(resourceGroupResourceOps.get); + +Scenarios.Azure_ResourceManager_MethodSubscriptionId_MixedSubscriptionPlacement_ResourceGroupResourceOperations_put = + passOnSuccess(resourceGroupResourceOps.put); + +Scenarios.Azure_ResourceManager_MethodSubscriptionId_MixedSubscriptionPlacement_ResourceGroupResourceOperations_delete = + passOnSuccess(resourceGroupResourceOps.delete); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/client.tsp new file mode 100644 index 00000000000..7dbee9a6815 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/client.tsp @@ -0,0 +1,16 @@ +import "./service1.tsp"; +import "./service2.tsp"; +import "@azure-tools/typespec-client-generator-core"; + +using Versioning; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ClientGenerator.Core; + +@client({ + service: [ + Azure.ResourceManager.MultiService.Compute, + Azure.ResourceManager.MultiService.ComputeDisk + ], +}) +namespace Azure.ResourceManager.MultiService.Combined; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/mockapi.ts new file mode 100644 index 00000000000..a7098899ddf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/mockapi.ts @@ -0,0 +1,111 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +// Mock data for Compute (VirtualMachine) +const SUBSCRIPTION_ID = "00000000-0000-0000-0000-000000000000"; +const RESOURCE_GROUP = "test-rg"; +const LOCATION = "eastus"; + +const virtualMachine = { + id: `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Compute/virtualMachines/vm1`, + name: "vm1", + type: "Microsoft.Compute/virtualMachines", + location: LOCATION, + properties: { + provisioningState: "Succeeded", + }, +}; + +// Mock data for ComputeDisk (Disk) +const disk = { + id: `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Compute/disks/disk1`, + name: "disk1", + type: "Microsoft.Compute/disks", + location: LOCATION, + properties: { + provisioningState: "Succeeded", + }, +}; + +// Scenario: Get Virtual Machine +Scenarios.Azure_ResourceManager_MultiService_Compute_VirtualMachines_get = passOnSuccess([ + { + uri: `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Compute/virtualMachines/vm1`, + method: "get", + request: { + query: { + "api-version": "2025-04-01", + }, + }, + response: { + status: 200, + body: json(virtualMachine), + }, + kind: "MockApiDefinition", + }, +]); + +// Scenario: Create or Update Virtual Machine +Scenarios.Azure_ResourceManager_MultiService_Compute_VirtualMachines_createOrUpdate = passOnSuccess( + [ + { + uri: `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Compute/virtualMachines/vm1`, + method: "put", + request: { + query: { + "api-version": "2025-04-01", + }, + body: json({ + location: LOCATION, + properties: {}, + }), + }, + response: { + status: 200, + body: json(virtualMachine), + }, + kind: "MockApiDefinition", + }, + ], +); + +// Scenario: Get Disk +Scenarios.Azure_ResourceManager_MultiService_ComputeDisk_Disks_get = passOnSuccess([ + { + uri: `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Compute/disks/disk1`, + method: "get", + request: { + query: { + "api-version": "2025-01-02", + }, + }, + response: { + status: 200, + body: json(disk), + }, + kind: "MockApiDefinition", + }, +]); + +// Scenario: Create or Update Disk +Scenarios.Azure_ResourceManager_MultiService_ComputeDisk_Disks_createOrUpdate = passOnSuccess([ + { + uri: `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Compute/disks/disk1`, + method: "put", + request: { + query: { + "api-version": "2025-01-02", + }, + body: json({ + location: LOCATION, + properties: {}, + }), + }, + response: { + status: 200, + body: json(disk), + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service1.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service1.tsp new file mode 100644 index 00000000000..131c840b388 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service1.tsp @@ -0,0 +1,109 @@ +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using TypeSpec.Versioning; +using Spector; + +/** + * Compute Client + */ +@armProviderNamespace("Microsoft.Compute") +@service(#{ title: "Azure Compute resource management API." }) +@versioned(Versions) +namespace Azure.ResourceManager.MultiService.Compute; + +/** + * The available API versions. + */ +enum Versions { + /** + * The 2024-11-01 API version. + */ + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) + v2024_11_01: "2024-11-01", + + /** + * The 2025-04-01 API version. + */ + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) + v2025_04_01: "2025-04-01", +} + +/** + * Describes a Virtual Machine. + */ +model VirtualMachine is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = VirtualMachine, + KeyName = "vmName", + SegmentName = "virtualMachines", + NamePattern = "" + >; +} + +model VirtualMachineProperties { + @visibility(Lifecycle.Read) + provisioningState?: ResourceProvisioningState; +} + +@armResourceOperations +interface VirtualMachines { + /** + * Retrieves information about the model view or the instance view of a virtual machine. + */ + @scenario + @scenarioDoc(""" + Test that a client can expose operations from multiple services. This operaton should be called like this: `client.virtualMachines.get(...)`. + + GET a Virtual Machine. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/vm1 + Expected query parameter: api-version=2025-04-01 + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/vm1", + "name": "vm1", + "type": "Microsoft.Compute/virtualMachines", + "location": "eastus", + "properties": { + "provisioningState": "Succeeded" + } + } + ``` + """) + get is ArmResourceRead; + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. + */ + @scenario + @scenarioDoc(""" + Test that a client can expose operations from multiple services. This operaton should be called like this: `client.virtualMachines.createOrUpdate(...)`. + + PUT (create or update) a Virtual Machine. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/vm1 + Expected query parameter: api-version=2025-04-01 + Expected request body: + ```json + { + "location": "eastus", + "properties": {} + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/vm1", + "name": "vm1", + "type": "Microsoft.Compute/virtualMachines", + "location": "eastus", + "properties": { + "provisioningState": "Succeeded" + } + } + ``` + """) + createOrUpdate is ArmResourceCreateOrUpdateAsync; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service2.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service2.tsp new file mode 100644 index 00000000000..528b78779d5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service2.tsp @@ -0,0 +1,112 @@ +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using TypeSpec.Versioning; +using Spector; + +/** + * Compute Client + */ +@armProviderNamespace("Microsoft.Compute") +@service(#{ title: "Azure Compute resource management API." }) +@versioned(Versions) +namespace Azure.ResourceManager.MultiService.ComputeDisk; + +/** + * The available API versions. + */ +enum Versions { + /** + * The 2024-03-02 API version. + */ + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) + v2024_03_02: "2024-03-02", + + /** + * The 2025-01-02 API version. + */ + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) + v2025_01_02: "2025-01-02", +} + +/** + * Disk resource. + */ +model Disk is Azure.ResourceManager.TrackedResource { + ...ResourceNameParameter< + Resource = Disk, + KeyName = "diskName", + SegmentName = "disks", + NamePattern = "" + >; +} + +/** + * Disk resource properties. + */ +model DiskProperties { + @visibility(Lifecycle.Read) + provisioningState?: ResourceProvisioningState; +} + +@armResourceOperations +interface Disks { + /** + * Gets information about a disk. + */ + @scenario + @scenarioDoc(""" + Test that a client can expose operations from multiple services. This operaton should be called like this: `client.disks.get(...)`. + + GET a Disk resource. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/disks/disk1 + Expected query parameter: api-version=2025-01-02 + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/disks/disk1", + "name": "disk1", + "type": "Microsoft.Compute/disks", + "location": "eastus", + "properties": { + "provisioningState": "Succeeded" + } + } + ``` + """) + get is ArmResourceRead; + + /** + * Creates or updates a disk. + */ + @scenario + @scenarioDoc(""" + Test that a client can expose operations from multiple services. This operaton should be called like this: `client.disks.createOrUpdate(...)`. + + PUT (create or update) a Disk resource. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/disks/disk1 + Expected query parameter: api-version=2025-01-02 + Expected request body: + ```json + { + "location": "eastus", + "properties": {} + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/disks/disk1", + "name": "disk1", + "type": "Microsoft.Compute/disks", + "location": "eastus", + "properties": { + "provisioningState": "Succeeded" + } + } + ``` + """) + createOrUpdate is ArmResourceCreateOrUpdateAsync; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/main.tsp new file mode 100644 index 00000000000..27fb4aa4562 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/main.tsp @@ -0,0 +1,26 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@azure-tools/typespec-client-generator-core"; +import "./non-resource.tsp"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.ResourceManager; + +@armProviderNamespace +@service +@versioned(Versions) +@doc("Arm Resource Provider management API.") +namespace Azure.ResourceManager.NonResource; + +@doc("Azure API versions.") +enum Versions { + @armCommonTypesVersion(CommonTypes.Versions.v5) + @doc("Preview API version 2023-12-01-preview.") + v2023_12_01_preview: "2023-12-01-preview", +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/mockapi.ts new file mode 100644 index 00000000000..751f22f92c6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/mockapi.ts @@ -0,0 +1,49 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const SUBSCRIPTION_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; +const LOCATION_EXPECTED = "eastus"; + +const nonResource = { + id: "id", + name: "hello", + type: "nonResource", +}; + +Scenarios.Azure_ResourceManager_NonResource_NonResourceOperations_get = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/providers/Microsoft.NonResource/locations/:location/otherParameters/:parameter", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + location: LOCATION_EXPECTED, + parameter: "hello", + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(nonResource), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_NonResource_NonResourceOperations_create = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/providers/Microsoft.NonResource/locations/:location/otherParameters/:parameter", + method: "put", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + location: LOCATION_EXPECTED, + parameter: "hello", + "api-version": "2023-12-01-preview", + }, + body: json(nonResource), + }, + response: { + status: 200, + body: json(nonResource), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/non-resource.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/non-resource.tsp new file mode 100644 index 00000000000..1dedd80d230 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/non-resource.tsp @@ -0,0 +1,118 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using Http; +using Spector; + +namespace Azure.ResourceManager.NonResource; + +/** + * Though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends `Resource`. + */ +model NonResource { + /** + * An id. + */ + id?: string; + + /** + * A name. + */ + name?: string; + + /** + * A type. + */ + type?: string; +} + +/** + * Operations on non resource model should not be marked as `@armResourceOperations`. + */ +interface NonResourceOperations { + @scenario + @scenarioDoc(""" + It's non-resource get operation operating on non-resource model, though the model has `id`, `name`, `type` properties. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NonResource/locations/eastus/otherParameters/hello + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "id", + "name": "hello", + "type": "nonResource" + } + ``` + """) + @route("/subscriptions/{subscriptionId}/providers/Microsoft.NonResource/locations/{location}/otherParameters/{parameter}") + @get + get( + ...ApiVersionParameter, + ...SubscriptionIdParameter, + + /** + * The location parameter. + */ + @path + location: string, + + /** + * Another parameter. + */ + @path + parameter: string, + ): ArmResponse | ErrorResponse; + + @scenario + @scenarioDoc(""" + It's non-resource put operation operating on non-resource model, though the model has `id`, `name`, `type` properties. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NonResource/locations/eastus/otherParameters/hello + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "id": "id", + "name": "hello", + "type": "nonResource" + } + ``` + + Expected response body: + ```json + { + "id": "id", + "name": "hello", + "type": "nonResource" + } + ``` + """) + @route("/subscriptions/{subscriptionId}/providers/Microsoft.NonResource/locations/{location}/otherParameters/{parameter}") + @put + create( + ...ApiVersionParameter, + ...SubscriptionIdParameter, + + /** + * The location parameter. + */ + @path + location: string, + + /** + * Another parameter. + */ + @path + parameter: string, + + /** + * The request body. + */ + @body + body: NonResource, + ): ArmResponse | ErrorResponse; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/available-operations.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/available-operations.tsp new file mode 100644 index 00000000000..b1daac655b2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/available-operations.tsp @@ -0,0 +1,34 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using Spector; + +namespace Azure.ResourceManager.OperationTemplates; + +@scenario("ListAvailableOperations") +@scenarioDoc(""" + Resource GET operation. + Expected path: /providers/Azure.ResourceManager.OperationTemplates/operations + Expected query parameter: api-version=2023-12-01-preview + Expected response body: + ```json + { + "value": [{ + "name": "Microsoft.Compute/virtualMachines/write", + "isDataAction": false, + "display": { + "provider": "Microsoft Compute", + "resource": "Virtual Machines", + "operation": "Create or Update Virtual Machine.", + "description": "Add or modify virtual machines.", + }, + "origin": "user,system", + "actionType": "Internal", + }] + } + ``` + """) +interface Operations extends Azure.ResourceManager.Operations {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/checkname-availability.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/checkname-availability.tsp new file mode 100644 index 00000000000..624d7ae18b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/checkname-availability.tsp @@ -0,0 +1,57 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using Spector; + +namespace Azure.ResourceManager.OperationTemplates; + +interface CheckNameAvailability { + @scenario + @scenarioDoc(""" + Resource POST operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/checkNameAvailability + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "name": "checkName", + "type": "Microsoft.Web/site" + } + ``` + Expected response body: + ```json + { + "nameAvailable": false, + "reason": "AlreadyExists", + "message": "Hostname 'checkName' already exists. Please select a different name." + } + ``` + """) + checkGlobal is checkGlobalNameAvailability; + + @scenario + @scenarioDoc(""" + Resource POST operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/westus/checkNameAvailability + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "name": "checkName", + "type": "Microsoft.Web/site", + } + ``` + Expected response body: + ```json + { + "nameAvailable": false, + "reason": "AlreadyExists", + "message": "Hostname 'checkName' already exists. Please select a different name." + } + ``` + """) + checkLocal is checkLocalNameAvailability; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/lro.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/lro.tsp new file mode 100644 index 00000000000..6d5d6f21875 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/lro.tsp @@ -0,0 +1,246 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using Rest; +using Spector; + +namespace Azure.ResourceManager.OperationTemplates; + +@resource("orders") +model Order is TrackedResource { + ...ResourceNameParameter; +} + +model OrderProperties { + @doc("The product ID of the order.") + productId: string; + + @doc("Amount of the product.") + amount: int32; + + @doc("The provisioning state of the product.") + @visibility(Lifecycle.Read) + provisioningState?: string; +} + +model ExportRequest { + @doc("Format of the exported order.") + format: string; +} + +model ExportResult { + @doc("Content of the exported order.") + content: string; +} + +@armResourceOperations +interface Lro { + @scenario + @scenarioDoc(""" + Resource PUT operation. + Service returns "Azure-AsyncOperation" on initial request. + final-state-via: Azure-AsyncOperation + + Expected verb: PUT + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1 + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "location": "eastus", + "properties": { + "productId": "product1", + "amount": 1 + } + } + ``` + Expected status code: 201 + Expected response header: Azure-AsyncOperation={endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1", + "name": "order1", + "type": "Azure.ResourceManager.Resources/orders", + "location": "eastus", + "properties": { + "productId": "product1", + "amount": 1, + "provisioningState": "InProgress" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao + + Expected status code: 200 + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao", + "name": "lro_create_aao", + "startTime": "2024-11-08T01:41:53.5508583+00:00", + "status" : "InProgress" + } + ``` + + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao + + Expected status code: 200 + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao", + "name": "lro_create_aao", + "status" : "Succeeded", + "startTime": "2024-11-08T01:41:53.5508583+00:00", + "endTime": "2024-11-08T01:42:41.5354192+00:00" + } + ``` + + Last get call on resource URL + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1 + + Expected status code: 200 + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1", + "name": "order1", + "type": "Azure.ResourceManager.Resources/orders", + "location": "eastus", + "properties": { + "productId": "product1", + "amount": 1, + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + createOrReplace is ArmResourceCreateOrReplaceAsync; + + @scenario + @scenarioDoc(""" + Resource POST operation. + Service returns both Location and Azure-AsyncOperation header on initial request. + final-state-via: location + + Expected verb: POST + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1/export + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "format": "csv" + } + ``` + Expected response status code: 202 + Expected response headers: + - Azure-AsyncOperation={endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao + - Location={endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/operations/lro_post_location + Expected no response body + + Whether you do polling through AAO, Location or combined, first one will respond with provisioning state "InProgress", second one with "Succeeded". + + AAO first poll. + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao + Expected status code: 200 + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao", + "name": "lro_post_aao", + "status" : "InProgress", + "startTime": "2024-11-08T01:41:53.5508583+00:00" + } + ``` + + AAO second poll. + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao + Expected status code: 200 + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao", + "name": "lro_post_aao", + "status" : "Succeeded", + "startTime": "2024-11-08T01:41:53.5508583+00:00", + "endTime": "2024-11-08T01:42:41.5354192+00:00" + } + ``` + + Location first poll. + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_location + Expected status code: 202 + Expected no response body + + Location second poll. + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_location + Expected status code: 200 + Expected response body: + ```json + { + "content": "order1,product1,1" + } + ``` + """) + export is ArmResourceActionAsync< + Order, + ExportRequest, + ExportResult, + LroHeaders = ArmCombinedLroHeaders & + Azure.Core.Foundations.RetryAfterHeader + >; + + @scenario + @scenarioDoc(""" + Resource DELETE operation. + Service returns both Location header on initial request. + + Expected verb: DELETE + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1 + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 202 + Expected response header: Location={endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operationResults/lro_delete_location + Expected no response body + + Location first poll. + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operationResults/lro_delete_location + Expected status code: 202 + Expected no response body + + Location second poll. + Expected verb: GET + Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operationResults/lro_delete_location + Expected status code: 204 + Expected no response body + """) + delete is ArmResourceDeleteWithoutOkAsync; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/main.tsp new file mode 100644 index 00000000000..58b70b79e5f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/main.tsp @@ -0,0 +1,29 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@azure-tools/typespec-client-generator-core"; +import "./available-operations.tsp"; +import "./checkname-availability.tsp"; +import "./lro.tsp"; +import "./optional-body.tsp"; + +using Http; +using Rest; +using Versioning; +using Azure.Core; +using Azure.ResourceManager; + +@armProviderNamespace +@service +@versioned(Versions) +@doc("Arm Resource Provider management API.") +namespace Azure.ResourceManager.OperationTemplates; + +@doc("Azure API versions.") +enum Versions { + @armCommonTypesVersion(CommonTypes.Versions.v5) + @doc("Preview API version 2023-12-01-preview.") + v2023_12_01_preview: "2023-12-01-preview", +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/mockapi.ts new file mode 100644 index 00000000000..5f38dbd1c77 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/mockapi.ts @@ -0,0 +1,633 @@ +import { + dyn, + dynItem, + json, + MockRequest, + passOnSuccess, + ScenarioMockApi, + ValidationError, + withServiceKeys, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const SUBSCRIPTION_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; +const RESOURCE_GROUP_EXPECTED = "test-rg"; +const validOrder = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/orders/order1`, + name: "order1", + type: "Azure.ResourceManager.Resources/orders", + location: "eastus", + properties: { + provisioningState: "Succeeded", + productId: "product1", + amount: 1, + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; +const validOperation = { + name: "Microsoft.Compute/virtualMachines/write", + isDataAction: false, + display: { + provider: "Microsoft Compute", + resource: "Virtual Machines", + operation: "Create or Update Virtual Machine.", + description: "Add or modify virtual machines.", + }, + origin: "user,system", + actionType: "Internal", +}; +const checkNameAvailabilityResponse = { + nameAvailable: false, + reason: "AlreadyExists", + message: "Hostname 'checkName' already exists. Please select a different name.", +}; +let createOrReplacePollCount = 0; +let postPollCount = 0; +let deletePollCount = 0; + +// operation list +Scenarios.Azure_ResourceManager_OperationTemplates_ListAvailableOperations = passOnSuccess({ + uri: "/providers/Azure.ResourceManager.OperationTemplates/operations", + method: "get", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + value: [validOperation], + }), + }, + kind: "MockApiDefinition", +}); + +// Check Global Name Availability +Scenarios.Azure_ResourceManager_OperationTemplates_CheckNameAvailability_checkGlobal = + passOnSuccess({ + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.OperationTemplates/checkNameAvailability", + method: "post", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + }, + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + name: "checkName", + type: "Microsoft.Web/site", + }), + }, + response: { + status: 200, + body: json(checkNameAvailabilityResponse), + }, + kind: "MockApiDefinition", + }); + +// Check Local Name Availability +Scenarios.Azure_ResourceManager_OperationTemplates_CheckNameAvailability_checkLocal = passOnSuccess( + { + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.OperationTemplates/locations/:location/checkNameAvailability", + method: "post", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + location: "westus", + }, + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + name: "checkName", + type: "Microsoft.Web/site", + }), + }, + response: { + status: 200, + body: json(checkNameAvailabilityResponse), + }, + kind: "MockApiDefinition", + }, +); + +// lro resource +Scenarios.Azure_ResourceManager_OperationTemplates_Lro_createOrReplace = passOnSuccess([ + { + // LRO PUT initial request + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/orders/:orderName", + method: "put", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + orderName: "order1", + }, + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + location: "eastus", + properties: { + productId: "product1", + amount: 1, + }, + }), + }, + response: { + status: 201, + headers: { + "azure-asyncoperation": dyn`${dynItem("baseUrl")}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao`, + }, + body: json({ + ...validOrder, + properties: { + provisioningState: "InProgress", + }, + }), + }, + handler: (req: MockRequest) => { + createOrReplacePollCount = 0; + return { + status: 201, + headers: { + "azure-asyncoperation": `${req.baseUrl}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao`, + }, + body: json({ + ...validOrder, + properties: { + provisioningState: "InProgress", + }, + }), + }; + }, + kind: "MockApiDefinition", + }, + { + // LRO PUT poll intermediate/get final result + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao`, + name: "lro_create_aao", + startTime: "2024-11-08T01:41:53.5508583+00:00", + status: "InProgress", + }), + }, + handler: (req: MockRequest) => { + const aaoResponse = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao`, + name: "lro_create_aao", + startTime: "2024-11-08T01:41:53.5508583+00:00", + }; + const response = + createOrReplacePollCount > 0 + ? { + ...aaoResponse, + status: "Succeeded", + endTime: "2024-11-08T01:42:41.5354192+00:00", + ...validOrder, + } + : { ...aaoResponse, status: "InProgress" }; + const statusCode = 200; + createOrReplacePollCount += 1; + return { + status: statusCode, + body: json(response), + }; + }, + kind: "MockApiDefinition", + }, + { + // LRO PUT get final result through initial request uri + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/orders/:orderName", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + orderName: "order1", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validOrder), + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_ResourceManager_OperationTemplates_Lro_export = passOnSuccess([ + { + // LRO POST initial request + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/orders/:orderName/export", + method: "post", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + orderName: "order1", + }, + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + format: "csv", + }), + }, + response: { + status: 202, + headers: { + location: dyn`${dynItem("baseUrl")}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_location`, + "azure-asyncoperation": dyn`${dynItem("baseUrl")}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao`, + }, + }, + handler: (req: MockRequest) => { + postPollCount = 0; + return { + status: 202, + headers: { + location: `${req.baseUrl}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_location`, + "azure-asyncoperation": `${req.baseUrl}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao`, + }, + }; + }, + kind: "MockApiDefinition", + }, + { + // LRO POST poll intermediate/get final result + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/:operation_name", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + operation_name: "lro_post_aao", // operation_name can be "lro_post_location" or "lro_post_aao", depending on the header you choose to poll. "lro_post_aao" here is just for passing e2e test + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, // This is for passing e2e test. For actual status code, see "handler" definition below + }, + handler: (req: MockRequest) => { + let response; + const operation_name = req.params["operation_name"]; + if (operation_name === "lro_post_location") { + response = + // first status will be 200, second and forward be 204 + postPollCount > 0 + ? { + status: 200, + body: json({ + content: "order1,product1,1", + }), + } + : { status: 202 }; + } else if (operation_name === "lro_post_aao") { + const aaoResponse = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao`, + name: "lro_post_aao", + startTime: "2024-11-08T01:41:53.5508583+00:00", + }; + // first provisioningState will be "InProgress", second and forward be "Succeeded" + const responseBody = + postPollCount > 0 + ? { + ...aaoResponse, + status: "Succeeded", + endTime: "2024-11-08T01:42:41.5354192+00:00", + } + : { ...aaoResponse, status: "InProgress" }; + + response = { + status: 200, // aao always returns 200 with response body + body: json(responseBody), + }; + } else { + throw new ValidationError( + `Unexpected lro poll operation: ${operation_name}`, + undefined, + undefined, + ); + } + + postPollCount += 1; + + return response; + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_ResourceManager_OperationTemplates_Lro_delete = passOnSuccess([ + { + // LRO DELETE initial request + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/orders/:orderName", + method: "delete", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + orderName: "order1", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 202, + headers: { + location: dyn`${dynItem("baseUrl")}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operationResults/lro_delete_location`, + }, + }, + handler: (req: MockRequest) => { + deletePollCount = 0; + return { + status: 202, + headers: { + location: `${req.baseUrl}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operationResults/lro_delete_location`, + }, + }; + }, + kind: "MockApiDefinition", + }, + { + // LRO DELETE poll intermediate/get final result + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operationResults/lro_delete_location", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 202, // This is for passing e2e test. For actual status code, see "handler" definition below + }, + handler: (req: MockRequest) => { + const response = + // first status will be 202, second and forward be 204 + deletePollCount > 0 ? { status: 204 } : { status: 202 }; + + deletePollCount += 1; + + return response; + }, + kind: "MockApiDefinition", + }, +]); + +// Optional Body scenarios +const validWidget = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1`, + name: "widget1", + type: "Azure.ResourceManager.OperationTemplates/widgets", + location: "eastus", + properties: { + name: "widget1", + description: "A test widget", + provisioningState: "Succeeded", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +// GET operation +Scenarios.Azure_ResourceManager_OperationTemplates_OptionalBody_get = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/widgets/:widgetName", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + widgetName: "widget1", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validWidget), + }, + kind: "MockApiDefinition", +}); + +// PATCH operation with optional body - test both with and without body +Scenarios.Azure_ResourceManager_OperationTemplates_OptionalBody_patch = withServiceKeys([ + "EmptyBody", + "WithBody", +]).pass({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/widgets/:widgetName", + method: "patch", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + widgetName: "widget1", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + }, + handler: (req: MockRequest) => { + // Check if request has a body with content + if (req.body && Object.keys(req.body).length > 0) { + // WithBody scenario - validate and merge request body with existing widget + const requestBody = req.body as { properties?: { name?: string; description?: string } }; + + // Validate expected values + if ( + requestBody.properties?.name === "updated-widget" && + requestBody.properties?.description === "Updated description" + ) { + const updatedWidget = { + ...validWidget, + properties: { + ...validWidget.properties, + name: requestBody.properties.name, + description: requestBody.properties.description, + }, + }; + return { + pass: "WithBody", + status: 200, + body: json(updatedWidget), + }; + } else { + // Invalid request body values + return { + pass: "WithBody", + status: 400, + body: json({ + error: + "Invalid request body values. Expected properties: {name: 'updated-widget', description: 'Updated description'}", + }), + }; + } + } else { + // EmptyBody scenario - return original widget + return { + pass: "EmptyBody", + status: 200, + body: json(validWidget), + }; + } + }, + kind: "MockApiDefinition", +}); + +// POST action operation with optional body - test both with and without body +Scenarios.Azure_ResourceManager_OperationTemplates_OptionalBody_post = withServiceKeys([ + "EmptyBody", + "WithBody", +]).pass({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/widgets/:widgetName/post", + method: "post", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + widgetName: "widget1", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + }, + handler: (req: MockRequest) => { + // Check if request has a body with content + if (req.body && Object.keys(req.body).length > 0) { + // WithBody scenario - validate request body values + const requestBody = req.body as { actionType?: string; parameters?: string }; + + // Validate expected values + if (requestBody.actionType === "perform" && requestBody.parameters === "test-parameters") { + return { + pass: "WithBody", + status: 200, + body: json({ + result: "Action completed successfully with parameters", + }), + }; + } else { + // Invalid request body values + return { + pass: "WithBody", + status: 400, + body: json({ + error: + "Invalid request body values. Expected actionType: 'perform', parameters: 'test-parameters'", + }), + }; + } + } else { + // EmptyBody scenario - action completed without parameters + return { + pass: "EmptyBody", + status: 200, + body: json({ + result: "Action completed successfully", + }), + }; + } + }, + kind: "MockApiDefinition", +}); + +// Provider POST action operation with optional body - test both with and without body +Scenarios.Azure_ResourceManager_OperationTemplates_OptionalBody_providerPost = withServiceKeys([ + "EmptyBody", + "WithBody", +]).pass({ + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.OperationTemplates/providerPost", + method: "post", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + }, + handler: (req: MockRequest) => { + // Check if request has a body with content + if (req.body && Object.keys(req.body).length > 0) { + // WithBody scenario - validate request body values + const requestBody = req.body as { totalAllowed?: number; reason?: string }; + + // Validate expected values + if (requestBody.totalAllowed === 100 && requestBody.reason === "Increased demand") { + return { + pass: "WithBody", + status: 200, + body: json({ + totalAllowed: requestBody.totalAllowed, + status: "Changed to requested allowance", + }), + }; + } else { + // Invalid request body values + return { + pass: "WithBody", + status: 400, + body: json({ + error: + "Invalid request body values. Expected totalAllowed: 100, reason: 'Increased demand'", + }), + }; + } + } else { + // EmptyBody scenario - use default allowance + return { + pass: "EmptyBody", + status: 200, + body: json({ + totalAllowed: 50, + status: "Changed to default allowance", + }), + }; + } + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/optional-body.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/optional-body.tsp new file mode 100644 index 00000000000..569f4481e27 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/optional-body.tsp @@ -0,0 +1,228 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using Rest; +using Spector; + +namespace Azure.ResourceManager.OperationTemplates; + +@resource("widgets") +model Widget is TrackedResource { + ...ResourceNameParameter; +} + +model WidgetProperties { + @doc("The name of the widget.") + name?: string; + + @doc("The description of the widget.") + description?: string; + + @doc("The provisioning state of the widget.") + @visibility(Lifecycle.Read) + provisioningState?: string; +} + +// Request models for optional body scenarios + +model ActionRequest { + @doc("The action type to perform.") + actionType?: string; + + @doc("Additional action parameters.") + parameters?: string; +} + +model ActionResult { + @doc("The result of the action.") + result: string; +} + +model ChangeAllowanceRequest { + @doc("The new total allowed widgets.") + totalAllowed?: int32; + + @doc("The reason for the change.") + reason?: string; +} + +model ChangeAllowanceResult { + @doc("The new total allowed widgets.") + totalAllowed: int32; + + @doc("The status of the change.") + status: string; +} + +@armResourceOperations +interface OptionalBody { + @scenario + @scenarioDoc(""" + Resource GET operation to retrieve a widget. + + Expected verb: GET + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1 + Expected query parameter: api-version=2023-12-01-preview + Expected status code: 200 + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1", + "name": "widget1", + "type": "Azure.ResourceManager.OperationTemplates/widgets", + "location": "eastus", + "properties": { + "name": "widget1", + "description": "A test widget", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User" + } + } + ``` + """) + get is ArmResourceRead; + + @scenario + @scenarioDoc(""" + Resource PATCH operation using Legacy.CustomPatchSync with optional request body. + This tests the optional body functionality in two scenarios: + 1. Empty body scenario: Request body is not sent + 2. With body scenario: Request body contains update data + + Expected verb: PATCH + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1 + Expected query parameter: api-version=2023-12-01-preview + + Scenario 1 - Expected request body: None (empty body) + Scenario 2 - Expected request body: {"properties": {"name": "updated-widget", "description": "Updated description"}} + + Expected status code: 200 + Expected response body (empty body scenario): + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1", + "name": "widget1", + "type": "Azure.ResourceManager.OperationTemplates/widgets", + "location": "eastus", + "properties": { + "name": "widget1", + "description": "A test widget", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User" + } + } + ``` + + Expected response body (with body scenario): + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1", + "name": "widget1", + "type": "Azure.ResourceManager.OperationTemplates/widgets", + "location": "eastus", + "properties": { + "name": "updated-widget", + "description": "Updated description", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User" + } + } + ``` + """) + patch is Azure.ResourceManager.Legacy.CustomPatchSync; + + @scenario + @scenarioDoc(""" + Resource POST action operation using ArmResourceActionSync with optional request body. + This tests the optional body functionality in two scenarios: + 1. Empty body scenario: Request body is not sent + 2. With body scenario: Request body contains action data + + Expected verb: POST + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1/post + Expected query parameter: api-version=2023-12-01-preview + + Scenario 1 - Expected request body: None (empty body) + Scenario 2 - Expected request body: {"actionType": "perform", "parameters": "test-parameters"} + + Expected status code: 200 + Expected response body (empty body scenario): + ```json + { + "result": "Action completed successfully" + } + ``` + + Expected response body (with body scenario): + ```json + { + "result": "Action completed successfully with parameters" + } + ``` + """) + post is ArmResourceActionSync; + + @scenario + @scenarioDoc(""" + Provider POST action operation using ArmProviderActionSync with optional request body. + This tests the optional body functionality for subscription-scoped provider actions in two scenarios: + 1. Empty body scenario: Request body is not sent (uses default allowance) + 2. With body scenario: Request body contains allowance change data + + Expected verb: POST + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/providerPost + Expected query parameter: api-version=2023-12-01-preview + + Scenario 1 - Expected request body: None (empty body) + Scenario 2 - Expected request body: {"totalAllowed": 100, "reason": "Increased demand"} + + Expected status code: 200 + Expected response body (empty body scenario): + ```json + { + "totalAllowed": 50, + "status": "Changed to default allowance" + } + ``` + + Expected response body (with body scenario): + ```json + { + "totalAllowed": 100, + "status": "Changed to requested allowance" + } + ``` + """) + providerPost is ArmProviderActionSync< + ChangeAllowanceRequest, + ChangeAllowanceResult, + SubscriptionActionScope, + {}, + ErrorResponse, + OptionalRequestBody = true + >; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/extension.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/extension.tsp new file mode 100644 index 00000000000..41bb1006ad2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/extension.tsp @@ -0,0 +1,554 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using Spector; + +namespace Azure.ResourceManager.Resources; + +model ExtensionsResource is ExtensionResource { + ...ResourceNameParameter; +} + +/** ExtensionsResource properties */ +model ExtensionsResourceProperties { + @doc("The description of the resource.") + description?: string; + + /** The status of the last operation. */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; +} + +/** The interface of extensions resources, + * it contains 4 kinds of scopes (resource, resource group, subscription and tenant) + */ +@armResourceOperations +interface ExtensionsResources { + @scenario + @scenarioDoc(""" + This test is passed by calling the API 4 times, by providing different parameters. + Resource GET extension resource by tenant. + Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource GET extension resource by subscription. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource GET extension resource by resource group. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource GET extension resource by resource. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + get is ArmResourceRead; + + @scenario + @scenarioDoc(""" + This test is passed by calling the API 4 times, by providing different parameters. + Resource PUT extension resource by tenant. + Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid", + } + } + ``` + + Expected response body: + ```json + { + "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource PUT extension resource by subscription. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid", + } + } + ``` + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource PUT extension resource by resource group. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid", + } + } + ``` + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource PUT extension resource by resource. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid", + } + } + ``` + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + createOrUpdate is ArmResourceCreateOrReplaceAsync; + + @scenario + @scenarioDoc(""" + This test is passed by calling the API 4 times, by providing different parameters. + Resource Patch extension resource by tenant. + Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid2", + } + } + ``` + + Expected response body: + ```json + { + "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource Patch extension resource by subscription. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid2", + } + } + ``` + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource Patch extension resource by resource group. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid2", + } + } + ``` + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + + Resource Patch extension resource by resource. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + + Expected request body: + ```json + { + "properties":{ + "description": "valid2", + } + } + ``` + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + update is ArmCustomPatchSync; + + @scenario + @scenarioDoc(""" + This test is passed by calling the API 4 times, by providing different parameters. + Resource DELETE extension resource by tenant. + Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + + Resource DELETE extension resource by subscription. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + + Resource DELETE extension resource by resource group. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + + Resource DELETE extension resource by resource. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + """) + delete is ArmResourceDeleteSync; + + @scenario + @scenarioDoc(""" + This test is passed by calling the API 4 times, by providing different parameters. + Resource LIST extension resources by tenant. + Expected path: /providers/Azure.ResourceManager.Resources/extensionResources + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + + Resource LIST extension resources by subscription. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionResources + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + + Resource LIST extension resources by resource group. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionResources + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + + Resource LIST extension resources by resource. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionResources + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", + "name": "extension", + "type": "Azure.ResourceManager.Resources/extensionsResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + """) + listByScope is ArmResourceListByParent; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/location.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/location.tsp new file mode 100644 index 00000000000..894c8f08013 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/location.tsp @@ -0,0 +1,170 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using Rest; +using Spector; + +namespace Azure.ResourceManager.Resources; + +@resource("locationResources") +@parentResource(SubscriptionLocationResource) +model LocationResource is ProxyResource { + ...ResourceNameParameter; +} + +/** Location resource properties */ +model LocationResourceProperties { + @doc("The description of the resource.") + description?: string; + + /** The status of the last operation. */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; +} + +@armResourceOperations +interface LocationResources { + @scenario + @scenarioDoc(""" + Resource GET operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", + "name": "resource", + "type": "Azure.ResourceManager.Resources/locationResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + get is ArmResourceRead; + + @scenario + @scenarioDoc(""" + Resource PUT operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource + Expected query parameter: api-version=2022-12-01-preview + Expected request body: + ```json + { + "properties": { + "description": "valid", + } + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", + "name": "resource", + "type": "Azure.ResourceManager.Resources/locationResources", + "properties": { + "description": "valid", + "provisioningState": "Succeeded", + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + createOrUpdate is ArmResourceCreateOrReplaceSync; + + @scenario + @scenarioDoc(""" + Resource PATCH operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "properties": { + "description": "valid2", + } + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", + "name": "resource", + "type": "Azure.ResourceManager.Resources/locationResources", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + update is ArmCustomPatchSync; + + @scenario + @scenarioDoc(""" + Resource DELETE operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + """) + delete is ArmResourceDeleteSync; + + @scenario + @scenarioDoc(""" + Resource List operation by location. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", + "name": "resource", + "type": "Azure.ResourceManager.Resources/locationResources", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + """) + listByLocation is ArmResourceListByParent; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/main.tsp new file mode 100644 index 00000000000..f2088bd38ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/main.tsp @@ -0,0 +1,38 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@azure-tools/typespec-client-generator-core"; +import "./toplevel.tsp"; +import "./nested.tsp"; +import "./singleton.tsp"; +import "./extension.tsp"; +import "./location.tsp"; + +using Http; +using Rest; +using Versioning; +using Azure.Core; +using Azure.ResourceManager; + +@armProviderNamespace +@service +@versioned(Versions) +@doc("Arm Resource Provider management API.") +namespace Azure.ResourceManager.Resources; + +@doc("Azure API versions.") +enum Versions { + @armCommonTypesVersion(CommonTypes.Versions.v5) + @doc("Preview API version 2023-12-01-preview.") + v2023_12_01_preview: "2023-12-01-preview", +} + +union ProvisioningState { + ResourceProvisioningState, + Provisioning: "Provisioning", + Updating: "Updating", + Deleting: "Deleting", + Accepted: "Accepted", +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/mockapi.ts new file mode 100644 index 00000000000..79067f0ff23 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/mockapi.ts @@ -0,0 +1,1042 @@ +import { json, passOnSuccess, ScenarioMockApi, ValidationError } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const SUBSCRIPTION_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; +const RESOURCE_GROUP_EXPECTED = "test-rg"; +const LOCATION_EXPECTED = "eastus"; +const SUBSCRIPTION_SCOPE_URI = `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}`; +const RESOURCE_GROUP_SCOPE_URI = `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}`; +const RESOURCE_SCOPE_URI = `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top`; +const EXTENSION_RESOURCE_NAME = "extension"; +const validTopLevelResource = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top`, + name: "top", + type: "Azure.ResourceManager.Resources/topLevelTrackedResources", + location: "eastus", + properties: { + provisioningState: "Succeeded", + description: "valid", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +const validNestedResource = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested`, + name: "nested", + type: "Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources", + properties: { + provisioningState: "Succeeded", + description: "valid", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +const validSingletonResource = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default`, + name: "default", + type: "Azure.ResourceManager.Resources/singletonTrackedResources", + location: "eastus", + properties: { + provisioningState: "Succeeded", + description: "valid", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +const validLocationResource = { + id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/locations/${LOCATION_EXPECTED}/locationResources/resource`, + name: "resource", + type: "Azure.ResourceManager.Resources/locationResources", + properties: { + description: "valid", + provisioningState: "Succeeded", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +const validResourceGroupExtensionsResource = { + id: `${RESOURCE_GROUP_SCOPE_URI}/providers/Azure.ResourceManager.Resources/extensionsResources/extension`, + name: EXTENSION_RESOURCE_NAME, + type: "Azure.ResourceManager.Resources/extensionsResources", + properties: { + description: "valid", + provisioningState: "Succeeded", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +const validSubscriptionExtensionsResource = { + id: `${SUBSCRIPTION_SCOPE_URI}/providers/Azure.ResourceManager.Resources/extensionsResources/extension`, + name: EXTENSION_RESOURCE_NAME, + type: "Azure.ResourceManager.Resources/extensionsResources", + properties: { + description: "valid", + provisioningState: "Succeeded", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +const validTenantExtensionsResource = { + id: `/providers/Azure.ResourceManager.Resources/extensionsResources/extension`, + name: EXTENSION_RESOURCE_NAME, + type: "Azure.ResourceManager.Resources/extensionsResources", + properties: { + description: "valid", + provisioningState: "Succeeded", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +const validResourceExtensionsResource = { + id: `${RESOURCE_SCOPE_URI}/providers/Azure.ResourceManager.Resources/extensionsResources/extension`, + name: EXTENSION_RESOURCE_NAME, + type: "Azure.ResourceManager.Resources/extensionsResources", + properties: { + description: "valid", + provisioningState: "Succeeded", + }, + systemData: { + createdBy: "AzureSDK", + createdByType: "User", + createdAt: "2024-10-04T00:56:07.442Z", + lastModifiedBy: "AzureSDK", + lastModifiedAt: "2024-10-04T00:56:07.442Z", + lastModifiedByType: "User", + }, +}; + +// extension tracked resource +Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_get = passOnSuccess([ + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "get", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validResourceGroupExtensionsResource), + }, + kind: "MockApiDefinition", + }, + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "get", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validSubscriptionExtensionsResource), + }, + kind: "MockApiDefinition", + }, + { + uri: `/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "get", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validTenantExtensionsResource), + }, + kind: "MockApiDefinition", + }, + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "get", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validResourceExtensionsResource), + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_createOrUpdate = passOnSuccess([ + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "put", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + properties: { + description: "valid", + }, + }), + }, + response: { + status: 200, + body: json(validResourceGroupExtensionsResource), + }, + kind: "MockApiDefinition", + }, + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "put", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + properties: { + description: "valid", + }, + }), + }, + response: { + status: 200, + body: json(validSubscriptionExtensionsResource), + }, + kind: "MockApiDefinition", + }, + { + uri: `/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "put", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + properties: { + description: "valid", + }, + }), + }, + response: { + status: 200, + body: json(validTenantExtensionsResource), + }, + kind: "MockApiDefinition", + }, + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "put", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + properties: { + description: "valid", + }, + }), + }, + response: { + status: 200, + body: json(validResourceExtensionsResource), + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_update = passOnSuccess([ + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "patch", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + properties: { + description: "valid2", + }, + }), + }, + response: { + status: 200, + body: json({ + ...validResourceGroupExtensionsResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }, + kind: "MockApiDefinition", + }, + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "patch", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + properties: { + description: "valid2", + }, + }), + }, + response: { + status: 200, + body: json({ + ...validSubscriptionExtensionsResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }, + kind: "MockApiDefinition", + }, + { + uri: `/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "patch", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + properties: { + description: "valid2", + }, + }), + }, + response: { + status: 200, + body: json({ + ...validTenantExtensionsResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }, + kind: "MockApiDefinition", + }, + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "patch", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + properties: { + description: "valid2", + }, + }), + }, + response: { + status: 200, + body: json({ + ...validResourceExtensionsResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_delete = passOnSuccess([ + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "delete", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "delete", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: `/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "delete", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, + method: "delete", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_listByScope = passOnSuccess([ + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources`, + method: "get", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + value: [validResourceGroupExtensionsResource], + }), + }, + kind: "MockApiDefinition", + }, + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources`, + method: "get", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + value: [validSubscriptionExtensionsResource], + }), + }, + kind: "MockApiDefinition", + }, + { + uri: `/providers/Azure.ResourceManager.Resources/extensionsResources`, + method: "get", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + value: [validTenantExtensionsResource], + }), + }, + kind: "MockApiDefinition", + }, + { + uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources`, + method: "get", + request: { + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + value: [validResourceExtensionsResource], + }), + }, + kind: "MockApiDefinition", + }, +]); + +// location resource +Scenarios.Azure_ResourceManager_Resources_LocationResources_get = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/locations/:location/locationResources/:locationResourceName", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validLocationResource), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_LocationResources_createOrUpdate = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/locations/:location/locationResources/:locationResourceName", + method: "put", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + }, + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + properties: { + description: "valid", + }, + }), + }, + response: { + status: 200, + body: json(validLocationResource), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_LocationResources_update = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/locations/:location/locationResources/:locationResourceName", + method: "patch", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + }, + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + properties: { + description: "valid2", + }, + }), + }, + response: { + status: 200, + body: json({ + ...validLocationResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_LocationResources_delete = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/locations/:location/locationResources/:locationResourceName", + method: "delete", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_LocationResources_listByLocation = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/locations/:location/locationResources", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + location: LOCATION_EXPECTED, + }, + query: { "api-version": "2023-12-01-preview" }, + }, + response: { + status: 200, + body: json({ + value: [validLocationResource], + }), + }, + kind: "MockApiDefinition", +}); + +// singleton tracked resource +Scenarios.Azure_ResourceManager_Resources_Singleton_getByResourceGroup = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validSingletonResource), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_Singleton_createOrUpdate = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", + method: "put", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + }, + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + location: "eastus", + properties: { + description: "valid", + }, + }), + }, + response: { + status: 200, + body: json(validSingletonResource), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_Singleton_update = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", + method: "patch", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + }, + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + properties: { + description: "valid2", + }, + }), + }, + response: { + status: 200, + body: json({ + ...validSingletonResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }, + kind: "MockApiDefinition", + handler: (req) => { + if (req.body["properties"]["description"] !== "valid2") { + throw new ValidationError( + "Body should contain 'properties.description' property", + "valid2", + req.body, + ); + } + return { + status: 200, + body: json({ + ...validSingletonResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }; + }, +}); + +Scenarios.Azure_ResourceManager_Resources_Singleton_listByResourceGroup = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/singletonTrackedResources", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + value: [validSingletonResource], + }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_TopLevel_actionSync = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/actionSync", + method: "post", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + }, + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + message: "Resource action at top level.", + urgent: true, + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +// top level tracked resource +Scenarios.Azure_ResourceManager_Resources_TopLevel_get = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json(validTopLevelResource), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_TopLevel_createOrReplace = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName", + method: "put", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + }, + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + location: "eastus", + properties: { + description: "valid", + }, + }), + }, + response: { + status: 200, + body: json(validTopLevelResource), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_TopLevel_update = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName", + method: "patch", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + }, + query: { + "api-version": "2023-12-01-preview", + }, + body: json({ + properties: { + description: "valid2", + }, + }), + }, + response: { + status: 200, + body: json({ + ...validTopLevelResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }, + kind: "MockApiDefinition", + handler: (req) => { + if (req.body["properties"]["description"] !== "valid2") { + throw new ValidationError( + "Body should contain 'properties.description' property", + "valid2", + req.body, + ); + } + return { + status: 200, + body: json({ + ...validTopLevelResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }; + }, +}); + +Scenarios.Azure_ResourceManager_Resources_TopLevel_delete = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName", + method: "delete", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_TopLevel_listByResourceGroup = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + value: [validTopLevelResource], + }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_TopLevel_listBySubscription = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/topLevelTrackedResources", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + }, + query: { "api-version": "2023-12-01-preview" }, + }, + response: { + status: 200, + body: json({ + value: [validTopLevelResource], + }), + }, + kind: "MockApiDefinition", +}); + +// nested proxy resource +Scenarios.Azure_ResourceManager_Resources_Nested_get = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/nestedProxyResources/:nestedResourceName", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + nestedResourceName: "nested", + }, + query: { "api-version": "2023-12-01-preview" }, + }, + response: { + status: 200, + body: json(validNestedResource), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_Nested_createOrReplace = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/nestedProxyResources/:nestedResourceName", + method: "put", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + nestedResourceName: "nested", + }, + query: { "api-version": "2023-12-01-preview" }, + body: json({ + properties: { + description: "valid", + }, + }), + }, + response: { + status: 200, + body: json(validNestedResource), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_Nested_update = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/nestedProxyResources/:nestedResourceName", + method: "patch", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + nestedResourceName: "nested", + }, + query: { "api-version": "2023-12-01-preview" }, + body: json({ + properties: { + description: "valid2", + }, + }), + }, + response: { + status: 200, + body: json({ + ...validNestedResource, + properties: { + provisioningState: "Succeeded", + description: "valid2", + }, + }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_Nested_delete = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/nestedProxyResources/:nestedResourceName", + method: "delete", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + nestedResourceName: "nested", + }, + query: { "api-version": "2023-12-01-preview" }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Azure_ResourceManager_Resources_Nested_listByTopLevelTrackedResource = passOnSuccess({ + uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/nestedProxyResources", + method: "get", + request: { + pathParams: { + subscriptionId: SUBSCRIPTION_ID_EXPECTED, + resourceGroup: RESOURCE_GROUP_EXPECTED, + topLevelResourceName: "top", + }, + query: { + "api-version": "2023-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + value: [validNestedResource], + }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/nested.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/nested.tsp new file mode 100644 index 00000000000..15f203b18ed --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/nested.tsp @@ -0,0 +1,177 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using Http; +using Rest; +using Spector; + +namespace Azure.ResourceManager.Resources; + +@doc("Nested child of Top Level Tracked Resource.") +@parentResource(TopLevelTrackedResource) +model NestedProxyResource is ProxyResource { + @key("nextedProxyResourceName") + @doc("Name of the nested resource.") + @visibility(Lifecycle.Read) + @path + @segment("nestedProxyResources") + @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") + name: string; +} + +@doc("Nested Proxy Resource Properties.") +model NestedProxyResourceProperties { + @visibility(Lifecycle.Read) + @doc("Provisioning State of the nested child Resource") + provisioningState?: ProvisioningState; + + @doc("Nested resource description.") + description?: string; +} + +@armResourceOperations +interface Nested { + @scenario + @scenarioDoc(""" + Resource GET operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested", + "name": "nested", + "type": "nested", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + get is ArmResourceRead; + + @scenario + @scenarioDoc(""" + Resource PUT operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "properties":{ + "description": "valid" + } + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested", + "name": "nested", + "type": "nested", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + createOrReplace is ArmResourceCreateOrReplaceAsync; + + @scenario + @scenarioDoc(""" + Resource PATCH operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "properties":{ + "description": "valid2" + } + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested", + "name": "nested", + "type": "nested", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + update is ArmCustomPatchAsync; + + @scenario + @scenarioDoc(""" + Resource DELETE operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested + Expected query parameter: api-version=2023-12-01-preview + Expected response status code: 204 + """) + delete is ArmResourceDeleteWithoutOkAsync; + + @scenario + @scenarioDoc(""" + Resource LIST by parent resource operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested", + "name": "nested", + "type": "nested", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + """) + listByTopLevelTrackedResource is ArmResourceListByParent; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/singleton.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/singleton.tsp new file mode 100644 index 00000000000..1ae36732406 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/singleton.tsp @@ -0,0 +1,164 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using Spector; + +namespace Azure.ResourceManager.Resources; + +@singleton("default") +model SingletonTrackedResource is TrackedResource { + ...ResourceNameParameter; +} + +@doc("Singleton Arm Resource Properties.") +model SingletonTrackedResourceProperties { + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState?: ProvisioningState; + + @doc("The description of the resource.") + description?: string; +} + +@armResourceOperations +interface Singleton { + @scenario + @scenarioDoc(""" + Resource GET operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", + "name": "default", + "type": "Azure.ResourceManager.Resources/singletonTrackedResources", + "location": "eastus", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + getByResourceGroup is ArmResourceRead; + + @scenario + @scenarioDoc(""" + Resource PUT operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "location": "eastus", + "properties": { + "description": "valid" + } + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", + "name": "default", + "type": "Azure.ResourceManager.Resources/singletonTrackedResources", + "location": "eastus", + "properties": { + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + createOrUpdate is ArmResourceCreateOrReplaceAsync; + + @scenario + @scenarioDoc(""" + Resource PATCH operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "properties": { + "description": "valid2" + } + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", + "name": "default", + "type": "Azure.ResourceManager.Resources/singletonTrackedResources", + "location": "eastus", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + update is ArmCustomPatchSync; + + @scenario + @scenarioDoc(""" + Resource LIST by resource group operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", + "name": "default", + "type": "Azure.ResourceManager.Resources/singletonTrackedResources", + "location": "eastus", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + """) + listByResourceGroup is ArmResourceListByParent; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/toplevel.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/toplevel.tsp new file mode 100644 index 00000000000..bc300db74e2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/toplevel.tsp @@ -0,0 +1,237 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@typespec/spector"; + +using Http; +using Rest; +using Spector; + +namespace Azure.ResourceManager.Resources; + +@resource("topLevelTrackedResources") +model TopLevelTrackedResource is TrackedResource { + @key("topLevelTrackedResourceName") + @path + @segment("topLevelTrackedResources") + @doc("arm resource name for path") + @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") + name: string; +} + +@doc("Top Level Arm Resource Properties.") +model TopLevelTrackedResourceProperties { + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState?: ProvisioningState; + + @doc("The description of the resource.") + description?: string; +} + +@doc("The details of a user notification.") +model NotificationDetails { + @doc("The notification message.") + message: string; + + @doc("If true, the notification is urgent.") + urgent: boolean; +} + +@armResourceOperations +interface TopLevel { + @scenario + @scenarioDoc(""" + Resource GET operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top", + "name": "top", + "type": "topLevel", + "location": "eastus", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + get is ArmResourceRead; + + @scenario + @scenarioDoc(""" + Resource PUT operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "location": "eastus", + "properties": { + "description": "valid" + } + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top", + "name": "top", + "type": "topLevel", + "location": "eastus", + "properties": { + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + createOrReplace is ArmResourceCreateOrReplaceAsync; + + @scenario + @scenarioDoc(""" + Resource PATCH operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "properties": { + "description": "valid2" + } + } + ``` + Expected response body: + ```json + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top", + "name": "top", + "type": "topLevel", + "location": "eastus", + "properties":{ + "description": "valid2", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + } + ``` + """) + update is ArmCustomPatchAsync; + + @scenario + @scenarioDoc(""" + Resource DELETE operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top + Expected query parameter: api-version=2023-12-01-preview + ``` + Expected response status code: 204 + """) + delete is ArmResourceDeleteWithoutOkAsync; + + @scenario + @scenarioDoc(""" + Resource LIST by resource group operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top", + "name": "top", + "type": "topLevel", + "location": "eastus", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + """) + listByResourceGroup is ArmResourceListByParent; + + @scenario + @scenarioDoc(""" + Resource LIST by subscription operation. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources + Expected query parameter: api-version=2023-12-01-preview + + Expected response body: + ```json + { + "value": [{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top", + "name": "top", + "type": "topLevel", + "location": "eastus", + "properties":{ + "description": "valid", + "provisioningState": "Succeeded" + }, + "systemData": { + "createdBy": "AzureSDK", + "createdByType": "User", + "createdAt": , + "lastModifiedBy": "AzureSDK", + "lastModifiedAt": , + "lastModifiedByType": "User", + } + }] + } + ``` + """) + listBySubscription is ArmListBySubscription; + + @scenario + @scenarioDoc(""" + Resource sync action. + Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/actionSync + Expected query parameter: api-version=2023-12-01-preview + Expected request body: + ```json + { + "message": "Resource action at top level.", + "urgent": true + } + ``` + """) + actionSync is ArmResourceActionNoContentSync; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/main.tsp new file mode 100644 index 00000000000..a381c72064c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/main.tsp @@ -0,0 +1,28 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Spector; + +@doc("Azure client request id header configurations.") +@scenarioService("/azure/special-headers/x-ms-client-request-id") +@scenario +@scenarioDoc(""" + Test case for azure client request id header. SDK should not generate `clientRequestId` paramerter but use policy to auto-set the header. + Expected header parameters: + - x-ms-client-request-id= + Expected response header: + - x-ms-client-request-id= + """) +namespace Azure.SpecialHeaders.XmsClientRequestId; + +@doc(""" + Get operation with azure `x-ms-client-request-id` header. + """) +@get +@route("/") +op get( + @header("x-ms-client-request-id") + clientRequestId?: string, +): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/mockapi.ts new file mode 100644 index 00000000000..bc3f62b0f97 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/mockapi.ts @@ -0,0 +1,34 @@ +import { + MockRequest, + passOnSuccess, + ScenarioMockApi, + validateValueFormat, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Azure_SpecialHeaders_XmsClientRequestId = passOnSuccess({ + uri: "/azure/special-headers/x-ms-client-request-id", + method: "get", + request: { + headers: { + "x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000", + }, + }, + response: { + status: 204, + headers: { + "x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000", + }, + }, + handler: (req: MockRequest) => { + validateValueFormat(req.headers["x-ms-client-request-id"], "uuid"); + return { + status: 204, + headers: { + ["x-ms-client-request-id"]: req.headers["x-ms-client-request-id"], + }, + }; + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/main.tsp new file mode 100644 index 00000000000..c8e7bb8bb0e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/main.tsp @@ -0,0 +1,146 @@ +/** + * Test for @previewVersion decorator functionality + * This verifies that emitters correctly handle preview versions + */ +import "@typespec/http"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using TypeSpec.Versioning; +using Spector; +using global.Azure.Core; + +@scenarioService( + "/azure/versioning/previewVersion", + { + versioned: ApiVersions, + } +) +@global.Azure.ClientGenerator.Core.clientNamespace("azure.versioning.previewversion", "java") +namespace _Specs_.Azure.Versioning.PreviewVersion; + +@doc("Supported api versions including preview.") +enum ApiVersions { + @doc("Api version 2024-01-01.") + v2024_01_01: "2024-01-01", + + @doc("Api version 2024-06-01.") + v2024_06_01: "2024-06-01", + + @doc("Preview api version 2024-12-01-preview.") + @previewVersion + v2024_12_01_preview: "2024-12-01-preview", +} + +@doc("A simple model for testing.") +model Widget { + @doc("Widget identifier.") + id: string; + + @doc("Widget name.") + name: string; + + @doc("Widget color, only available in preview version.") + @added(ApiVersions.v2024_12_01_preview) + color?: string; +} + +@scenario +@scenarioDoc(""" + Test @previewVersion decorator with stable operations. + Should send a preview api-version and response should contain color field. + + Expected path parameter: id=widget-123 + Expected query parameter: api-version=2024-12-01-preview + + Expected response body: + ```json + { + "id": "widget-123", + "name": "Sample Widget", + "color": "blue" + } + ``` + """) +@doc("Get widget by id (available in all versions)") +@get +@route("/widgets/{id}") +op getWidget( + @path id: string, + ...global.Azure.Core.Foundations.ApiVersionParameter, +): Widget | NotFoundResponse; + +@doc("Update widget color request.") +model UpdateWidgetColorRequest { + @doc("New color for the widget.") + color: string; +} + +@scenario +@scenarioDoc(""" + Test @previewVersion decorator with preview-only operations. + Only available in preview API versions. + + Expected path parameter: id=widget-123 + Expected query parameter: api-version=2024-12-01-preview + + Expected input body: + ```json + { + "color": "red" + } + ``` + + Expected response body: + ```json + { + "id": "widget-123", + "name": "Sample Widget", + "color": "red" + } + ``` + """) +@doc("Update widget color (preview only)") +@patch(#{ implicitOptionality: true }) +@route("/widgets/{id}/color") +@added(ApiVersions.v2024_12_01_preview) +op updateWidgetColor( + @path id: string, + @header("Content-Type") contentType: "application/merge-patch+json", + @body colorUpdate: UpdateWidgetColorRequest, + ...global.Azure.Core.Foundations.ApiVersionParameter, +): Widget | NotFoundResponse; + +@scenario +@scenarioDoc(""" + Test @previewVersion decorator with version-specific query parameters. + Request should send stable api-version and response should not contain color field. + + Expected query parameter: api-version=2024-06-01 + Expected query parameter: name=test (color not available in stable version) + + Expected response body: + ```json + { + "widgets": [ + { + "id": "widget-1", + "name": "test" + } + ] + } + ``` + """) +@doc("List widgets with optional color filtering") +@get +@route("/widgets") +op listWidgets( + @query name?: string, + @query @added(ApiVersions.v2024_12_01_preview) color?: string, + ...global.Azure.Core.Foundations.ApiVersionParameter, +): { + widgets: Widget[]; +}; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/mockapi.ts new file mode 100644 index 00000000000..6aae334d190 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/mockapi.ts @@ -0,0 +1,82 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +// Test @previewVersion with stable operations - should work across all versions +// Color is expected in the response because we are passing api-version "2024-12-01-preview" +Scenarios.Azure_Versioning_PreviewVersion_getWidget = passOnSuccess({ + uri: "/azure/versioning/previewVersion/widgets/:id", + method: "get", + request: { + pathParams: { + id: "widget-123", + }, + query: { + "api-version": "2024-12-01-preview", + }, + }, + response: { + status: 200, + body: json({ + id: "widget-123", + name: "Sample Widget", + color: "blue", + }), + }, + kind: "MockApiDefinition", +}); + +// Test @previewVersion with preview-only operations - only available in preview version +// This operation can be called because the request uses api-version "2024-12-01-preview" +Scenarios.Azure_Versioning_PreviewVersion_updateWidgetColor = passOnSuccess({ + uri: "/azure/versioning/previewVersion/widgets/:id/color", + method: "patch", + request: { + pathParams: { + id: "widget-123", + }, + query: { + "api-version": "2024-12-01-preview", + }, + headers: { + "Content-Type": "application/merge-patch+json", + }, + body: json({ + color: "red", + }), + }, + response: { + status: 200, + body: json({ + id: "widget-123", + name: "Sample Widget", + color: "red", + }), + }, + kind: "MockApiDefinition", +}); + +// Test @previewVersion with version-specific query parameters +// api-version "2024-06-01" is stable, so color is not expected in the response +Scenarios.Azure_Versioning_PreviewVersion_listWidgets = passOnSuccess({ + uri: "/azure/versioning/previewVersion/widgets", + method: "get", + request: { + query: { + "api-version": "2024-06-01", + name: "test", + }, + }, + response: { + status: 200, + body: json({ + widgets: [ + { + id: "widget-1", + name: "test", + }, + ], + }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/client.tsp new file mode 100644 index 00000000000..f5eb8ecd1c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/client.tsp @@ -0,0 +1,31 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Spector; +using Azure.ClientGenerator.Core; +using Client.ClientNamespace; + +@route("/client/client-namespace") +namespace ClientNameSpaceClient; + +@client({ + name: "ClientNamespaceFirstClient", + service: Client.ClientNamespace, +}) +@clientNamespace("client.clientnamespace") +interface ClientNamespaceFirstClient { + getFirst is First.getFirst; +} +@@clientNamespace(FirstModel, "client.clientnamespace.first"); + +@client({ + name: "ClientNamespaceSecondClient", + service: Client.ClientNamespace, +}) +@clientNamespace("client.clientnamespace.second") +namespace ClientNamespaceSecondClient { + op getSecond is Second.getSecond; +} +@@clientNamespace(Second.Model, "client.clientnamespace.second"); +@@clientNamespace(Second.Model.SecondClientEnumType, "client.clientnamespace.second.sub"); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/main.tsp new file mode 100644 index 00000000000..7bd95064f12 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/main.tsp @@ -0,0 +1,51 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +/** Illustrates the clientNamespace cases. */ +@scenarioService("/client/client-namespace") +@scenario +@scenarioDoc(""" + Expected client namespace for clients: + - ClientNamespaceFirstClient: Client.ClientNamespace + - ClientNamespaceSecondClient: Client.ClientNamespace.Second + + Expected client namespace for models: + - FirstClientResult: Client.ClientNamespace.First + - SecondClientResult: Client.ClientNamespace.Second + - SecondClientEnumType: Client.ClientNamespace.Second.Sub + """) +namespace Client.ClientNamespace; + +interface First { + #suppress "@azure-tools/cadl-ranch-expect/missing-scenario" "scenario defined in client.tsp" + @route("/first") + @get + getFirst(): FirstModel.FirstClientResult; +} + +namespace FirstModel { + model FirstClientResult { + name: string; + } +} + +namespace Second { + #suppress "@azure-tools/cadl-ranch-expect/missing-scenario" "scenario defined in client.tsp" + @route("/second") + @get + op getSecond(): Model.SecondClientResult; + + namespace Model { + model SecondClientResult { + type: SecondClientEnumType; + } + + union SecondClientEnumType { + string, + Second: "second", + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/mockapi.ts new file mode 100644 index 00000000000..60f06ee2e09 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/mockapi.ts @@ -0,0 +1,24 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Client_ClientNamespace = passOnSuccess([ + { + uri: "/client/client-namespace/first", + method: "get", + response: { + status: 200, + body: json({ name: "first" }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/client/client-namespace/second", + method: "get", + response: { + status: 200, + body: json({ type: "second" }), + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/client.tsp new file mode 100644 index 00000000000..9d74dc29069 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/client.tsp @@ -0,0 +1,9 @@ +import "@azure-tools/typespec-client-generator-core"; +import "./main.tsp"; + +using Azure.ClientGenerator.Core; +using Client.Naming.EnumConflict; + +// Resolve enum naming conflict: Rename SecondNamespace.Status to SecondStatus +// Client should generate FirstNamespace.Status as `Status` and SecondNamespace.Status as `SecondStatus`. +@@clientName(SecondNamespace.Status, "SecondStatus"); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/main.tsp new file mode 100644 index 00000000000..c42564e807c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/main.tsp @@ -0,0 +1,86 @@ +/** + * Test for enum with same name in different namespace + * This is valid in TypeSpec, but will cause SDK generation problem. + * For such cases, we should use client.tsp to rename one of them. + */ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Azure.ClientGenerator.Core; +using Spector; + +@doc("Test for enum with same name in different namespace.") +@scenarioService("/client/naming/enum-conflict") +namespace Client.Naming.EnumConflict; + +namespace FirstNamespace { + @doc("Status enum in first namespace") + enum Status { + @doc("Active status") + Active: "active", + + @doc("Inactive status") + Inactive: "inactive", + } + + model FirstModel { + @doc("Status from first namespace") + status: Status; + + @doc("Name of the item") + name: string; + } +} + +namespace SecondNamespace { + @doc("Status enum in second namespace") + enum Status { + @doc("Running status") + Running: "running", + + @doc("Stopped status") + Stopped: "stopped", + } + + model SecondModel { + @doc("Status from second namespace") + status: Status; + + @doc("Description of the item") + description: string; + } +} + +@operationGroup +@route("/first") +interface FirstOperations { + @scenario + @scenarioDoc(""" + Test enum with same name in different namespace - first namespace. + Expected request body: + ```json + {"status": "active", "name": "test"} + ``` + """) + @post + @doc("Operation using first namespace Status enum") + first(@body body: FirstNamespace.FirstModel): FirstNamespace.FirstModel; +} + +@operationGroup +@route("/second") +interface SecondOperations { + @scenario + @scenarioDoc(""" + Test enum with same name in different namespace - second namespace. + Expected request body: + ```json + {"status": "running", "description": "test description"} + ``` + """) + @post + @doc("Operation using second namespace Status enum") + second(@body body: SecondNamespace.SecondModel): SecondNamespace.SecondModel; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/mockapi.ts new file mode 100644 index 00000000000..85919fa72b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/mockapi.ts @@ -0,0 +1,29 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Client_Naming_EnumConflict_FirstOperations_first = passOnSuccess({ + uri: "/client/naming/enum-conflict/first", + method: "post", + request: { + body: json({ status: "active", name: "test" }), + }, + response: { + status: 200, + body: json({ status: "active", name: "test" }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Client_Naming_EnumConflict_SecondOperations_second = passOnSuccess({ + uri: "/client/naming/enum-conflict/second", + method: "post", + request: { + body: json({ status: "running", description: "test description" }), + }, + response: { + status: 200, + body: json({ status: "running", description: "test description" }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/main.tsp new file mode 100644 index 00000000000..b71dbafa529 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/main.tsp @@ -0,0 +1,249 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Azure.ClientGenerator.Core; +using Spector; + +/** + * Describe changing names of types in a client with `@clientName` + */ +@scenarioService("/client/naming") +namespace Client.Naming; + +@route("/property") +namespace Property { + model LanguageClientNameModel { + @doc("Pass in true") + @clientName("CSName", "csharp") + @clientName("GoName", "go") + @clientName("JavaName", "java") + @clientName("TSName", "javascript") + @clientName("python_name", "python") + @clientName("rustName", "rust") + defaultName: boolean; + } + + model ClientNameModel { + @doc("Pass in true") + @clientName("clientName") + defaultName: boolean; + } + + model ClientNameAndJsonEncodedNameModel { + @doc("Pass in true") + @clientName("clientName") + @encodedName("application/json", "wireName") + defaultName: boolean; + } + + @scenario + @scenarioDoc(""" + Testing that we can project the client name in our generated SDKs. + Your generated SDK should generate ClientNameModel with one property `clientName` with wire name `defaultName`. + + Expected request body: + ```json + {"defaultName": true} + ``` + """) + @route("/client") + @post + op client(@body body: ClientNameModel): NoContentResponse; + + @scenario + @scenarioDoc(""" + Testing that we can project the language specific name in our generated SDKs. + Your generated SDK should generate LanguageClientNameModel with one property with your language specific property name and wire name `defaultName`. + + Expected request body: + ```json + {"defaultName": true} + ``` + """) + @route("/language") + @post + op language(@body body: LanguageClientNameModel): NoContentResponse; + + @scenario + @scenarioDoc(""" + Testing that we can project the client name and the wire name. + Your generated SDK should generate ClientNameAndJsonEncodedNameModel with one property with client name `clientName` and wire name `wireName`. + + Expected request body: + ```json + {"wireName": true} + ``` + """) + @route("/compatible-with-encoded-name") + @post + op compatibleWithEncodedName(@body body: ClientNameAndJsonEncodedNameModel): NoContentResponse; +} + +@scenario +@scenarioDoc(""" + Testing that we can project the operation name. + Your generated SDK should generate an operation called `clientName`. + + Expected status code: 204 + """) +@route("/operation") +@clientName("clientName") +@post +op operation(): NoContentResponse; + +@scenario +@scenarioDoc(""" + Testing that we can project a parameter name. + Your generated SDK should generate an operation `parameter` with a single parameter called `clientName`. + + Expected query parameter: `defaultName="true"` + + """) +@route("/parameter") +@post +op parameter( + @clientName("clientName") + @query + defaultName: string, +): NoContentResponse; + +@route("/header") +namespace Header { + @scenario + @scenarioDoc(""" + Testing that we can project a header name. + Your generated SDK should generate an operation header `parameter` with a single parameter called `clientName`. + + Expected header parameter: `default-name="true"` + """) + @post + op request( + @clientName("clientName") + @header + `default-name`: string, + ): void; + + @scenario + @scenarioDoc(""" + Testing that we can project a header name. + Your generated SDK should generate an operation header `parameter` with a single parameter called `clientName`. + + Expected response header: `default-name="true"` + """) + @get + op response(): { + @statusCode _: 204; + + @clientName("clientName") + @header + `default-name`: string; + }; +} + +@route("/model") +@operationGroup +@clientName("ModelClient") +namespace Model { + @clientName("CSModel", "csharp") + @clientName("GoModel", "go") + @clientName("JavaModel", "java") + @clientName("TSModel", "javascript") + @clientName("PythonModel", "python") + @clientName("rustName", "rust") + model ModelWithLanguageClientName { + @doc("Pass in true") + defaultName: boolean; + } + + @clientName("ClientModel") + model ModelWithClientClientName { + @doc("Pass in true") + defaultName: boolean; + } + + @scenario + @scenarioDoc(""" + Testing that we can project the client name in our generated SDKs. + Your generated SDK should generate the model with name `ClientModel`. + + Expected request body: + ```json + {"defaultName": true} + ``` + """) + @route("/client") + @post + op client(@bodyRoot body: ModelWithClientClientName): NoContentResponse; + + @scenario + @scenarioDoc(""" + Testing that we can project the language specific name in our generated SDKs. + Your generated SDK should generate the model with your language specific model name. + + Expected request body: + ```json + {"defaultName": true} + ``` + """) + @route("/language") + @post + op language(@bodyRoot body: ModelWithLanguageClientName): NoContentResponse; +} + +@operationGroup +@route("/union-enum") +namespace UnionEnum { + @clientName("ClientExtensibleEnum") + union ServerExtensibleEnum { + string, + EnumValue1: "value1", + } + + union ExtensibleEnum { + string, + + @clientName("ClientEnumValue1") + EnumValue1: "value1", + + @clientName("ClientEnumValue2") + "value2", + } + + @scenario + @scenarioDoc(""" + Testing that we can project a enum name and enum value name. + Your generated SDK should generate an Enum "ClientExtensibleEnum". + (The exact name may depend on language convention) + + Expected request body: + ```json + "value1" + ``` + """) + @route("/union-enum-name") + @post + op unionEnumName( + @header contentType: "application/json", + @body body: ServerExtensibleEnum, + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + Testing that we can project a enum name and enum value name. + Your generated SDK should generate an Enum with members "ClientEnumValue1", "ClientEnumValue2". + (The exact name may depend on language convention) + + Expected request body: + ```json + "value1" + ``` + """) + @route("/union-enum-member-name") + @post + op unionEnumMemberName( + @header contentType: "application/json", + @body body: ExtensibleEnum, + ): NoContentResponse; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/mockapi.ts new file mode 100644 index 00000000000..5c88f98c8ce --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/mockapi.ts @@ -0,0 +1,140 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Client_Naming_Property_client = passOnSuccess({ + uri: "/client/naming/property/client", + method: "post", + request: { + body: json({ defaultName: true }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Client_Naming_Property_language = passOnSuccess({ + uri: "/client/naming/property/language", + method: "post", + request: { + body: json({ defaultName: true }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Client_Naming_Property_compatibleWithEncodedName = passOnSuccess({ + uri: `/client/naming/property/compatible-with-encoded-name`, + method: "post", + request: { + body: json({ wireName: true }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Client_Naming_operation = passOnSuccess({ + uri: `/client/naming/operation`, + method: "post", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Client_Naming_parameter = passOnSuccess({ + uri: `/client/naming/parameter`, + method: "post", + request: { + query: { defaultName: "true" }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Client_Naming_Header_request = passOnSuccess({ + uri: `/client/naming/header`, + method: "post", + request: { + headers: { "default-name": "true" }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Client_Naming_Header_response = passOnSuccess({ + uri: `/client/naming/header`, + method: "get", + request: {}, + response: { + status: 204, + headers: { + "default-name": "true", + }, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Client_Naming_Model_client = passOnSuccess({ + uri: `/client/naming/model/client`, + method: "post", + request: { + body: json({ defaultName: true }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Client_Naming_Model_language = passOnSuccess({ + uri: `/client/naming/model/language`, + method: "post", + request: { + body: json({ defaultName: true }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Client_Naming_UnionEnum_unionEnumName = passOnSuccess({ + uri: `/client/naming/union-enum/union-enum-name`, + method: "post", + request: { + body: json("value1"), + headers: { + "Content-Type": "text/plain", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Client_Naming_UnionEnum_unionEnumMemberName = passOnSuccess({ + uri: `/client/naming/union-enum/union-enum-member-name`, + method: "post", + request: { + body: json("value1"), + headers: { + "Content-Type": "text/plain", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/client.tsp new file mode 100644 index 00000000000..49df6edd273 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/client.tsp @@ -0,0 +1,9 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; + +using Azure.ClientGenerator.Core; +using Client.Overload; + +// This creates an overload in C# where both `list()` and `list(scope)` methods exist +#suppress "@azure-tools/typespec-client-generator-core/duplicate-client-name-warning" "Intentional overload for testing method overloading in C#" +@@clientName(listByScope, "list", "csharp"); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/main.tsp new file mode 100644 index 00000000000..a38e08c52d6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/main.tsp @@ -0,0 +1,50 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Spector; + +/** + * Test for overload operation in .NET. + */ +@scenarioService("/client/overload") +namespace Client.Overload; + +model Resource { + id: string; + name: string; + scope: string; +} + +#suppress "@azure-tools/typespec-client-generator-core/duplicate-client-name-warning" "Intentional overload for testing method overloading in C#" +@scenario +@scenarioDoc(""" + List all resources operation. + + Expected request: GET /client/overload/resources + Expected response body: + ```json + [ + {"id": "1", "name": "foo", "scope": "car"}, + {"id": "2", "name": "bar", "scope": "bike"} + ] + ``` + """) +@route("/resources") +op list(): Resource[]; + +@scenario +@scenarioDoc(""" + List resources by scope operation. This operation uses `@clientName("list", "csharp")` to generate it as an overload method named "list" in C# client code, demonstrating method overloading capabilities. + + Expected request: GET /client/overload/resources/car + Expected response body: + ```json + [ + {"id": "1", "name": "foo", "scope": "car"} + ] + ``` + """) +@route("/resources/{scope}") +op listByScope(@path scope: string): Resource[]; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/mockapi.ts new file mode 100644 index 00000000000..f5f21edee35 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/mockapi.ts @@ -0,0 +1,26 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Client_Overload_list = passOnSuccess({ + uri: "/client/overload/resources", + method: "get", + response: { + status: 200, + body: json([ + { id: "1", name: "foo", scope: "car" }, + { id: "2", name: "bar", scope: "bike" }, + ]), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Client_Overload_listByScope = passOnSuccess({ + uri: "/client/overload/resources/car", + method: "get", + response: { + status: 200, + body: json([{ id: "1", name: "foo", scope: "car" }]), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/client.tsp new file mode 100644 index 00000000000..a95b7aab8eb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/client.tsp @@ -0,0 +1,76 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/spector"; + +using Azure.ClientGenerator.Core; +using Spector; + +@scenarioDoc(""" + This is to show we can have multiple clients, with multiple operation groups in each client. + + ```ts + const client1 = new FirstClient("client-operation-group"); + + client1.one(); + + client1.group3.two(); + client1.group3.three(); + + client1.group4.four(); + ``` + """) +@scenario +@client({ + name: "FirstClient", + service: Client.Structure.Service, +}) +namespace Client.Structure.ClientOperationGroup { + op one is Client.Structure.Service.one; + + @operationGroup + interface Group3 { + two is Client.Structure.Service.two; + three is Client.Structure.Service.Foo.three; + } + + @operationGroup + interface Group4 { + four is Client.Structure.Service.Foo.four; + } +} + +@scenarioDoc(""" + This is to show we can have multiple clients, with multiple operation groups in each client. + The client and its operation groups can be moved to a sub namespace/package. + + ```ts + const client2 = new SubNamespace.SecondClient("client-operation-group"); + + client2.five(); + client2.group5.six(); + ``` + """) +@scenario +@client( + { + name: "SubNamespace.SecondClient", + service: Client.Structure.Service, + }, + "csharp,java" +) +@client( + { + name: "SecondClient", + service: Client.Structure.Service, + }, + "javascript,go,python,rust" +) +namespace Client.Structure.AnotherClientOperationGroup { + op five is Client.Structure.Service.Bar.five; + + #suppress "@azure-tools/typespec-client-generator-core/client-service" "issue https://github.com/Azure/typespec-azure/issues/1326" + @operationGroup + interface Group5 { + six is Client.Structure.Service.Bar.six; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/main.tsp new file mode 100644 index 00000000000..c57c79ee2e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/main.tsp @@ -0,0 +1,5 @@ +/** + * DO NOT GENERATE FROM THIS FILE USE client.tsp + * This is just to simulate a service entrypoint + */ +import "../common/service.tsp"; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/mockapi.ts new file mode 100644 index 00000000000..899e029b85f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/mockapi.ts @@ -0,0 +1,16 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; +import { createServerTests } from "../common/service.js"; + +export const Scenarios: Record = {}; + +Scenarios.Client_Structure_ClientOperationGroup = passOnSuccess([ + createServerTests("/client/structure/client-operation-group/one"), + createServerTests("/client/structure/client-operation-group/two"), + createServerTests("/client/structure/client-operation-group/three"), + createServerTests("/client/structure/client-operation-group/four"), +]); + +Scenarios.Client_Structure_AnotherClientOperationGroup = passOnSuccess([ + createServerTests("/client/structure/client-operation-group/five"), + createServerTests("/client/structure/client-operation-group/six"), +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.ts new file mode 100644 index 00000000000..854ae2a0928 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.ts @@ -0,0 +1,11 @@ +import { MockApiDefinition } from "@typespec/spec-api"; + +export function createServerTests(uri: string): MockApiDefinition { + return { + uri: uri, + method: "post", + request: {}, + response: { status: 204 }, + kind: "MockApiDefinition", + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.tsp new file mode 100644 index 00000000000..7eab0ee73f4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.tsp @@ -0,0 +1,95 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/spector"; + +using Http; +using Rest; +using Azure.ClientGenerator; +using Azure.ClientGenerator.Core; + +@doc(""" + Test that we can use @client and @operationGroup decorators to customize client side code structure, such as: + 1. have everything as default. + 2. to rename client or operation group + 3. one client can have more than one operations groups + 4. split one interface into two clients + 5. have two clients with operations come from different interfaces + 6. have two clients with a hierarchy relation. + """) +@server( + "{endpoint}/client/structure/{client}", + "", + { + @doc("Need to be set as 'http://localhost:3000' in client.") + endpoint: url, + + @doc("Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client.") + client: ClientType, + } +) +@service(#{ title: "MultiClient" }) +namespace Client.Structure.Service; + +enum ClientType { + Default: "default", + MultiClient: "multi-client", + RenamedOperation: "renamed-operation", + TwoOperationGroup: "two-operation-group", + ClientOperationGroup: "client-operation-group", +} + +#suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" +@route("/one") +@post +op one(): void; + +#suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" +@route("/two") +@post +op two(): void; + +interface Foo { + #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" + @route("/three") + @post + three(): void; + + #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" + @route("/four") + @post + four(): void; +} + +interface Bar { + #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" + @route("/five") + @post + five(): void; + #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" + @route("/six") + @post + six(): void; +} + +namespace Baz { + interface Foo { + #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" + @route("/seven") + @post + seven(): void; + } +} + +namespace Qux { + #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" + @route("/eight") + @post + op eight(): void; + + interface Bar { + #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" + @route("/nine") + @post + nine(): void; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/client.tsp new file mode 100644 index 00000000000..871f9b725f9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/client.tsp @@ -0,0 +1,24 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/spector"; + +using Spector; + +@@scenario(Client.Structure.Service); +@@scenarioDoc(Client.Structure.Service, + """ + This is to show that if we don't do any customization. The client side should be able to call the api like + ```ts + const client = new ServiceClient("default"); + client.one(); + client.two(); + client.foo.three(); + client.foo.four(); + client.bar.five(); + client.bar.six(); + client.baz.foo.seven(); + client.qux.eight(); + client.qux.bar.nine(); + ``` + """ +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/main.tsp new file mode 100644 index 00000000000..c57c79ee2e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/main.tsp @@ -0,0 +1,5 @@ +/** + * DO NOT GENERATE FROM THIS FILE USE client.tsp + * This is just to simulate a service entrypoint + */ +import "../common/service.tsp"; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/mockapi.ts new file mode 100644 index 00000000000..8dd29c23226 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/mockapi.ts @@ -0,0 +1,16 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; +import { createServerTests } from "../common/service.js"; + +export const Scenarios: Record = {}; + +Scenarios.Client_Structure_Service = passOnSuccess([ + createServerTests("/client/structure/default/one"), + createServerTests("/client/structure/default/two"), + createServerTests("/client/structure/default/three"), + createServerTests("/client/structure/default/four"), + createServerTests("/client/structure/default/five"), + createServerTests("/client/structure/default/six"), + createServerTests("/client/structure/default/seven"), + createServerTests("/client/structure/default/eight"), + createServerTests("/client/structure/default/nine"), +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/client.tsp new file mode 100644 index 00000000000..7d5908de331 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/client.tsp @@ -0,0 +1,44 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/spector"; + +using Azure.ClientGenerator.Core; +using Spector; + +@scenarioDoc(""" + Include multiple clients in the same spec. + ```ts + const clientA = new ClientAClient("multi-client"); + const clientB = new ClientBClient("multi-client"); + + clientA.renamedOne(); + clientA.renamedThree(); + clientA.renamedFive(); + + clientB.renamedTwo(); + clientB.renamedFour(); + clientB.renamedSix(); + ``` + """) +@scenario +namespace Client.Structure.MultiClient; + +@client({ + name: "ClientAClient", + service: Client.Structure.Service, +}) +interface ClientA { + renamedOne is Client.Structure.Service.one; + renamedThree is Client.Structure.Service.Foo.three; + renamedFive is Client.Structure.Service.Bar.five; +} + +@client({ + name: "ClientBClient", + service: Client.Structure.Service, +}) +interface ClientB { + renamedTwo is Client.Structure.Service.two; + renamedFour is Client.Structure.Service.Foo.four; + renamedSix is Client.Structure.Service.Bar.six; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/main.tsp new file mode 100644 index 00000000000..c57c79ee2e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/main.tsp @@ -0,0 +1,5 @@ +/** + * DO NOT GENERATE FROM THIS FILE USE client.tsp + * This is just to simulate a service entrypoint + */ +import "../common/service.tsp"; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/mockapi.ts new file mode 100644 index 00000000000..4a7dcf1a01d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/mockapi.ts @@ -0,0 +1,13 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; +import { createServerTests } from "../common/service.js"; + +export const Scenarios: Record = {}; + +Scenarios.Client_Structure_MultiClient = passOnSuccess([ + createServerTests("/client/structure/multi-client/one"), + createServerTests("/client/structure/multi-client/two"), + createServerTests("/client/structure/multi-client/three"), + createServerTests("/client/structure/multi-client/four"), + createServerTests("/client/structure/multi-client/five"), + createServerTests("/client/structure/multi-client/six"), +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/client.tsp new file mode 100644 index 00000000000..316153e9f0f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/client.tsp @@ -0,0 +1,40 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/spector"; + +using Azure.ClientGenerator.Core; +using Spector; + +@scenarioDoc(""" + This is to show we can have more than one operation group in a client. The client side should be able to call the api like + ```ts + const client = new RenamedOperationClient("renamed-operation"); + + client.renamedOne(); + client.renamedThree(); + client.renamedFive(); + + client.group.renamedTwo(); + client.group.renamedFour(); + client.group.renamedSix(); + ``` + """) +@client({ + name: "RenamedOperationClient", + service: Client.Structure.Service, +}) +@scenario +namespace Client.Structure.RenamedOperation; + +// Those operations are renamed at the root +op renamedOne is Client.Structure.Service.one; +op renamedThree is Client.Structure.Service.Foo.three; +op renamedFive is Client.Structure.Service.Bar.five; + +// Those operations are renamed inside an operation group +@operationGroup +interface Group { + renamedTwo is Client.Structure.Service.two; + renamedFour is Client.Structure.Service.Foo.four; + renamedSix is Client.Structure.Service.Bar.six; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/main.tsp new file mode 100644 index 00000000000..c57c79ee2e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/main.tsp @@ -0,0 +1,5 @@ +/** + * DO NOT GENERATE FROM THIS FILE USE client.tsp + * This is just to simulate a service entrypoint + */ +import "../common/service.tsp"; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/mockapi.ts new file mode 100644 index 00000000000..6bc25321481 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/mockapi.ts @@ -0,0 +1,13 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; +import { createServerTests } from "../common/service.js"; + +export const Scenarios: Record = {}; + +Scenarios.Client_Structure_RenamedOperation = passOnSuccess([ + createServerTests("/client/structure/renamed-operation/one"), + createServerTests("/client/structure/renamed-operation/two"), + createServerTests("/client/structure/renamed-operation/three"), + createServerTests("/client/structure/renamed-operation/four"), + createServerTests("/client/structure/renamed-operation/five"), + createServerTests("/client/structure/renamed-operation/six"), +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/client.tsp new file mode 100644 index 00000000000..07e112eba94 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/client.tsp @@ -0,0 +1,42 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/spector"; + +using Azure.ClientGenerator.Core; +using Spector; + +@scenarioDoc(""" + This is to show we can have more than one operation group in a client. The client side should be able to call the api like + + ```ts + const client = new TwoOperationGroupClient("two-operation-group"); + + client.group1.one(); + client.group1.three(); + client.group1.four(); + + client.group2.two(); + client.group2.five(); + client.group2.six(); + ``` + """) +@client({ + name: "TwoOperationGroupClient", + service: Client.Structure.Service, +}) +@scenario +namespace Client.Structure.TwoOperationGroup; + +@operationGroup +interface Group1 { + one is Client.Structure.Service.one; + three is Client.Structure.Service.Foo.three; + four is Client.Structure.Service.Foo.four; +} + +@operationGroup +interface Group2 { + two is Client.Structure.Service.two; + five is Client.Structure.Service.Bar.five; + six is Client.Structure.Service.Bar.six; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/main.tsp new file mode 100644 index 00000000000..c57c79ee2e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/main.tsp @@ -0,0 +1,5 @@ +/** + * DO NOT GENERATE FROM THIS FILE USE client.tsp + * This is just to simulate a service entrypoint + */ +import "../common/service.tsp"; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/mockapi.ts new file mode 100644 index 00000000000..1fb9a03da75 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/mockapi.ts @@ -0,0 +1,13 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; +import { createServerTests } from "../common/service.js"; + +export const Scenarios: Record = {}; + +Scenarios.Client_Structure_TwoOperationGroup = passOnSuccess([ + createServerTests("/client/structure/two-operation-group/one"), + createServerTests("/client/structure/two-operation-group/two"), + createServerTests("/client/structure/two-operation-group/three"), + createServerTests("/client/structure/two-operation-group/four"), + createServerTests("/client/structure/two-operation-group/five"), + createServerTests("/client/structure/two-operation-group/six"), +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/documentation/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/documentation/main.tsp new file mode 100644 index 00000000000..93808f9d1ba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/documentation/main.tsp @@ -0,0 +1,158 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@scenarioService("/documentation") +@doc("Illustrates documentation generation and formatting features") +namespace Documentation; + +@route("/lists") +namespace Lists { + /** + * This tests: + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet points within documentation comments. It should properly indent the wrapped lines. + * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is preserved when the text wraps onto multiple lines in the generated documentation. + * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how the bold formatting is maintained across wrapped lines. + * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that italic formatting is correctly applied even when the text spans multiple lines. + */ + @scenario + @scenarioDoc(""" + Test simple bullet points in documentation. + Expected behavior: Should render properly formatted bullet lists. + """) + @get + @route("/bullet-points/op") + op bulletPointsOp(): NoContentResponse; + + /** + * This tests: + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet points within documentation comments. It should properly indent the wrapped lines. + * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is preserved when the text wraps onto multiple lines in the generated documentation. + * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how the bold formatting is maintained across wrapped lines. + * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that italic formatting is correctly applied even when the text spans multiple lines. + */ + model BulletPointsModel { + /** + * This property uses an enum with bullet point documentation. The enum documentation includes various formatting styles to test rendering. The styles are: + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet points within documentation comments. It should properly indent the wrapped lines. + * - Bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is preserved when the text wraps onto multiple + * - Bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point** + * - *Italic bullet point* + */ + prop: BulletPointsEnum; + } + + /** + * This tests really long bullet points in enum documentation to see how wrapping and formatting are handled. This should wrap around correctly and maintain proper indentation for each line. + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet points within documentation comments. It should properly indent the wrapped lines. + * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is preserved when the text wraps onto multiple lines in the generated documentation. + * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how the bold formatting is maintained across wrapped lines. + * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that italic formatting is correctly applied even when the text spans multiple lines. + */ + enum BulletPointsEnum { + /** + * Simple bullet point. This line is intentionally long to test text wrapping in bullet points within enum documentation comments. It should properly indent the wrapped lines. + * - One: one. This line is intentionally long to test text wrapping in bullet points within enum documentation comments. It should properly indent the wrapped lines. + * - Two: two. This line is intentionally long to test text wrapping in bullet points within enum documentation comments. It should properly indent the wrapped lines. + */ + Simple: "Simple", + + /** + * Bullet point with **bold text**. This line is intentionally long to test text wrapping in bullet points within enum documentation comments. It should properly indent the wrapped lines. + * - **One**: one. This line is intentionally long to test text wrapping in bullet points within enum documentation comments. It should properly indent the wrapped lines. + * - **Two**: two. This line is intentionally long to test text wrapping in bullet points within enum documentation comments. It should properly indent the wrapped lines. + */ + Bold: "Bold", + + /** + * Bullet point with *italic text*. This line is intentionally long to test text wrapping in bullet points within enum documentation comments. It should properly indent the wrapped lines. + * - *One*: one. This line is intentionally long to test text wrapping in bullet points within enum documentation comments. It should properly indent the wrapped lines. + * - *Two*: two. This line is intentionally long to test text wrapping in bullet points within enum documentation comments. It should properly indent the wrapped lines. + */ + Italic: "Italic", + } + + @scenarioDoc(""" + Test bullet points in model and enum documentation. + Expected input: + ```json + { + "prop": "Simple" + } + ``` + """) + @post + @route("/bullet-points/model") + op bulletPointsModel(input: BulletPointsModel): NoContentResponse; + + /** + * Steps to follow: + * 1. First step with **important** note + * 2. Second step with *emphasis* + * 3. Third step combining **bold** and *italic* + * 4. **Final step**: Review all steps for *accuracy*. + */ + @scenario + @scenarioDoc(""" + Test numbered lists. + Expected behavior: Should render numbered list properly. + """) + @route("/numbered") + @get + op numbered(): NoContentResponse; +} + +@route("/text-formatting") +namespace TextFormatting { + /** + * This is **bold text** in the middle of a sentence. + * This is a sentence with **multiple bold** sections and **another bold** section. + * **This entire sentence is bold.** + */ + @scenario + @scenarioDoc(""" + Expected behavior: Text between ** should render as bold. + """) + @route("/bold") + @get + op boldText(): NoContentResponse; + + /** + * This is *italic text* in the middle of a sentence. + * This is a sentence with *multiple italic* sections and *another italic* section. + * *This entire sentence is italic.* + * */ + @scenario + @scenarioDoc(""" + Test italic text formatting using *single asterisks*. + Expected behavior: Text between * should render as italic. + """) + @route("/italic") + @get + op italicText(): NoContentResponse; + + /** + * This sentence has **bold**, *italic*, and ***bold italic*** text. + * You can also combine them like **bold with *italic inside* bold**. + * Or *italic with **bold inside** italic*. + * This is a sentence with **bold**, *italic*, and ***bold italic*** text. + */ + @scenario + @scenarioDoc(""" + Test combined bold and italic formatting. + Expected behavior: Should handle nested and combined formatting. + """) + @route("/combined") + @get + op combinedFormatting(): NoContentResponse; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/documentation/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/documentation/mockapi.ts new file mode 100644 index 00000000000..446aac99f36 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/documentation/mockapi.ts @@ -0,0 +1,57 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createGetServerTests(uri: string) { + return passOnSuccess({ + uri, + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }); +} + +function createPostServerTests(uri: string, requestBody: unknown, responseBody?: unknown) { + return passOnSuccess({ + uri, + method: "post", + request: { + body: json(requestBody), + }, + response: { + status: 200, + body: responseBody ? json(responseBody) : undefined, + }, + kind: "MockApiDefinition", + }); +} + +// Lists namespace tests +Scenarios.Documentation_Lists_bulletPointsOp = createGetServerTests( + "/documentation/lists/bullet-points/op", +); + +Scenarios.Documentation_Lists_bulletPointsModel = createPostServerTests( + "/documentation/lists/bullet-points/model", + { + prop: "Simple", + }, +); + +Scenarios.Documentation_Lists_numbered = createGetServerTests("/documentation/lists/numbered"); + +// TextFormatting namespace tests +Scenarios.Documentation_TextFormatting_boldText = createGetServerTests( + "/documentation/text-formatting/bold", +); + +Scenarios.Documentation_TextFormatting_italicText = createGetServerTests( + "/documentation/text-formatting/italic", +); + +Scenarios.Documentation_TextFormatting_combinedFormatting = createGetServerTests( + "/documentation/text-formatting/combined", +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/array/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/encode/array/main.tsp new file mode 100644 index 00000000000..4e707eeb41d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/encode/array/main.tsp @@ -0,0 +1,112 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test for encode decorator on array.") +@scenarioService("/encode/array") +namespace Encode.Array; + +model CommaDelimitedArrayProperty { + @encode(ArrayEncoding.commaDelimited) + value: string[]; +} + +model SpaceDelimitedArrayProperty { + @encode(ArrayEncoding.spaceDelimited) + value: string[]; +} + +model PipeDelimitedArrayProperty { + @encode(ArrayEncoding.pipeDelimited) + value: string[]; +} + +model NewlineDelimitedArrayProperty { + @encode(ArrayEncoding.newlineDelimited) + value: string[]; +} + +@route("/property") +namespace Property { + @route("/comma-delimited") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a string array property with commaDelimited encode. + Expected request body: + ```json + { + "value": "blue,red,green" + } + ``` + Expected response body: + ```json + { + "value": "blue,red,green" + } + ``` + """) + @post + op commaDelimited(@body body: CommaDelimitedArrayProperty): CommaDelimitedArrayProperty; + + @route("/space-delimited") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a string array property with spaceDelimited encode. + Expected request body: + ```json + { + "value": "blue red green" + } + ``` + Expected response body: + ```json + { + "value": "blue red green" + } + ``` + """) + @post + op spaceDelimited(@body body: SpaceDelimitedArrayProperty): SpaceDelimitedArrayProperty; + + @route("/pipe-delimited") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a string array property with pipeDelimited encode. + Expected request body: + ```json + { + "value": "blue|red|green" + } + ``` + Expected response body: + ```json + { + "value": "blue|red|green" + } + ``` + """) + @post + op pipeDelimited(@body body: PipeDelimitedArrayProperty): PipeDelimitedArrayProperty; + + @route("/newline-delimited") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a string array property with newlineDelimited encode. + Expected request body: + ```json + { + "value": "blue\\nred\\ngreen" + } + ``` + Expected response body: + ```json + { + "value": "blue\\nred\\ngreen" + } + ``` + """) + @post + op newlineDelimited(@body body: NewlineDelimitedArrayProperty): NewlineDelimitedArrayProperty; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/array/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/encode/array/mockapi.ts new file mode 100644 index 00000000000..8b22eeb67ea --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/encode/array/mockapi.ts @@ -0,0 +1,43 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const colors = ["blue", "red", "green"]; + +function createPropertyServerTests(uri: string, delimiter: string) { + const encodedValue = colors.join(delimiter); + return passOnSuccess({ + uri, + method: "post", + request: { + body: json({ + value: encodedValue, + }), + }, + response: { + status: 200, + body: json({ value: encodedValue }), + }, + kind: "MockApiDefinition", + }); +} + +Scenarios.Encode_Array_Property_commaDelimited = createPropertyServerTests( + "/encode/array/property/comma-delimited", + ",", +); + +Scenarios.Encode_Array_Property_spaceDelimited = createPropertyServerTests( + "/encode/array/property/space-delimited", + " ", +); + +Scenarios.Encode_Array_Property_pipeDelimited = createPropertyServerTests( + "/encode/array/property/pipe-delimited", + "|", +); + +Scenarios.Encode_Array_Property_newlineDelimited = createPropertyServerTests( + "/encode/array/property/newline-delimited", + "\n", +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/main.tsp new file mode 100644 index 00000000000..9a462c78a29 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/main.tsp @@ -0,0 +1,372 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test for encode decorator on bytes.") +@scenarioService("/encode/bytes") +namespace Encode.Bytes; + +@encode(BytesKnownEncoding.base64url) +scalar base64urlBytes extends bytes; + +@route("/query") +namespace Query { + @route("/default") + @scenario + @scenarioDoc(""" + Test default encode (base64) for bytes query parameter. + Expected query parameter: + value=dGVzdA== (base64 encode of test) + """) + op default( + @query + value: bytes, + ): NoContentResponse; + + @route("/base64") + @scenario + @scenarioDoc(""" + Test base64 encode for bytes query parameter. + Expected query parameter: + value=dGVzdA== (base64 encode of test) + """) + op base64( + @query + @encode(BytesKnownEncoding.base64) + value: bytes, + ): NoContentResponse; + + @route("/base64url") + @scenario + @scenarioDoc(""" + Test base64url encode for bytes query parameter. + Expected query parameter: + value=dGVzdA (base64url encode of test) + """) + op base64url( + @query + @encode(BytesKnownEncoding.base64url) + value: bytes, + ): NoContentResponse; + + @route("/base64url-array") + @scenario + @scenarioDoc(""" + Test base64url encode for bytes array query parameter. + Expected query parameter: + value=dGVzdA, dGVzdA + """) + op base64urlArray( + @query + value: base64urlBytes[], + ): NoContentResponse; +} + +model DefaultBytesProperty { + value: bytes; +} + +model Base64BytesProperty { + @encode(BytesKnownEncoding.base64) + value: bytes; +} + +model Base64urlBytesProperty { + @encode(BytesKnownEncoding.base64url) + value: bytes; +} + +model Base64urlArrayBytesProperty { + value: base64urlBytes[]; +} + +@route("/property") +namespace Property { + @route("/default") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains bytes properties with default encode (base64). + Expected request body: + ```json + { + "value": "dGVzdA==" // base64 encode of test + } + ``` + Expected response body: + ```json + { + "value": "dGVzdA==" + } + ``` + """) + @post + op default(@body body: DefaultBytesProperty): DefaultBytesProperty; + + @route("/base64") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains bytes properties with base64 encode. + Expected request body: + ```json + { + "value": "dGVzdA==" // base64 encode of test + } + ``` + Expected response body: + ```json + { + "value": "dGVzdA==" + } + ``` + """) + @post + op base64(@body body: Base64BytesProperty): Base64BytesProperty; + + @route("/base64url") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains bytes properties with base64url encode. + Expected request body: + ```json + { + "value": "dGVzdA" // base64url encode of test + } + ``` + Expected response body: + ```json + { + "value": "dGVzdA" + } + ``` + """) + @post + op base64url(@body body: Base64urlBytesProperty): Base64urlBytesProperty; + + @route("/base64url-array") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains bytes array properties with base64url encode. + Expected request body: + ```json + { + "value": ["dGVzdA", "dGVzdA"] + } + ``` + Expected response body: + ```json + { + "value": ["dGVzdA", "dGVzdA"] + } + ``` + """) + @post + op base64urlArray(@body body: Base64urlArrayBytesProperty): Base64urlArrayBytesProperty; +} + +@route("/header") +namespace Header { + @route("/default") + @scenario + @scenarioDoc(""" + Test default encode (base64) for bytes header. + Expected header: + value=dGVzdA== (base64 encode of test) + """) + op default( + @header + value: bytes, + ): NoContentResponse; + + @route("/base64") + @scenario + @scenarioDoc(""" + Test base64 encode for bytes header. + Expected header: + value=dGVzdA== (base64 encode of test) + """) + op base64( + @header + @encode(BytesKnownEncoding.base64) + value: bytes, + ): NoContentResponse; + + @route("/base64url") + @scenario + @scenarioDoc(""" + Test base64url encode for bytes header. + Expected header: + value=dGVzdA (base64url encode of test) + """) + op base64url( + @header + @encode(BytesKnownEncoding.base64url) + value: bytes, + ): NoContentResponse; + + @route("/base64url-array") + @scenario + @scenarioDoc(""" + Test base64url encode for bytes array header. + Expected header: + value=dGVzdA,dGVzdA + """) + op base64urlArray( + @header + value: base64urlBytes[], + ): NoContentResponse; +} + +@route("/body/request") +namespace RequestBody { + @route("/default") + @scenario + @scenarioDoc(""" + When content type is not defined and body is `bytes` the payload is a binary stream. + Stream should match packages/http-specs/assets/image.png file. + """) + @post + op default( + @body + value: bytes, + ): NoContentResponse; + + @route("/octet-stream") + @scenario + @scenarioDoc(""" + When content type is application/octet-stream and body is `bytes` the payload is a binary stream. + Stream should match packages/http-specs/assets/image.png file. + """) + @post + op octetStream( + @header + contentType: "application/octet-stream", + + @body + value: bytes, + ): NoContentResponse; + + @route("/custom-content-type") + @scenario + @scenarioDoc(""" + When content type is a custom type(image/png here) and body is `bytes` the payload is a binary file. + File should match packages/http-specs/assets/image.png. + """) + @post + op customContentType( + @header + contentType: "image/png", + + @body + value: bytes, + ): NoContentResponse; + + @route("/base64") + @scenario + @scenarioDoc(""" + Test base64 encode for bytes body. + Expected body: + "dGVzdA==" (base64 encode of test, in JSON string) + """) + @post + op base64( + @header + contentType: "application/json", + + @body + @encode(BytesKnownEncoding.base64) + value: bytes, + ): NoContentResponse; + + @route("/base64url") + @scenario + @scenarioDoc(""" + Test base64url encode for bytes body. + Expected body: + "dGVzdA" (base64url encode of test, in JSON string) + """) + @post + op base64url( + @header + contentType: "application/json", + + @body + @encode(BytesKnownEncoding.base64url) + value: bytes, + ): NoContentResponse; +} + +@route("/body/response") +namespace ResponseBody { + @route("/default") + @scenario + @scenarioDoc(""" + When content type is not defined and body is `bytes` the payload is a binary stream. + Stream should match packages/http-specs/assets/image.png file. + """) + op default(): { + @body + value: bytes; + }; + + @route("/octet-stream") + @scenario + @scenarioDoc(""" + When content type is application/octet-stream and body is `bytes` the payload is a binary stream. + Stream should match packages/http-specs/assets/image.png file. + """) + op octetStream(): { + @header + contentType: "application/octet-stream"; + + @body + value: bytes; + }; + + @route("/custom-content-type") + @scenario + @scenarioDoc(""" + When content type is a custom type(image/png here) and body is `bytes` the payload is a binary file. + File should match packages/http-specs/assets/image.png + """) + op customContentType(): { + @header + contentType: "image/png"; + + @body + value: bytes; + }; + + @route("/base64") + @scenario + @scenarioDoc(""" + Test base64 encode for bytes body. + Expected body: + "dGVzdA==" (base64 encode of test, in JSON string) + """) + op base64(): { + @header + contentType: "application/json"; + + @body + @encode(BytesKnownEncoding.base64) + value: bytes; + }; + + @route("/base64url") + @scenario + @scenarioDoc(""" + Test base64url encode for bytes body. + Expected body: + "dGVzdA" (base64url encode of test, in JSON string) + """) + op base64url(): { + @header + contentType: "application/json"; + + @body + @encode(BytesKnownEncoding.base64url) + body: base64urlBytes; + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/mockapi.ts new file mode 100644 index 00000000000..a65099d3b2a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/mockapi.ts @@ -0,0 +1,279 @@ +import { resolvePath } from "@typespec/compiler"; +import { + CollectionFormat, + json, + MockRequest, + passOnSuccess, + ScenarioMockApi, +} from "@typespec/spec-api"; +import { readFileSync } from "fs"; +import { fileURLToPath } from "url"; + +const root = resolvePath(fileURLToPath(import.meta.url), "../../../../../"); + +const pngFile = readFileSync(resolvePath(root, "assets/image.png")); + +export const Scenarios: Record = {}; + +function createQueryServerTests( + uri: string, + data: any, + value: any, + collectionFormat?: CollectionFormat, +) { + return passOnSuccess({ + uri, + method: "get", + request: { + query: data, + }, + response: { + status: 204, + }, + handler: (req: MockRequest) => { + req.expect.containsQueryParam("value", value, collectionFormat); + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }); +} +Scenarios.Encode_Bytes_Query_default = createQueryServerTests( + "/encode/bytes/query/default", + { + value: "dGVzdA==", + }, + "dGVzdA==", +); +Scenarios.Encode_Bytes_Query_base64 = createQueryServerTests( + "/encode/bytes/query/base64", + { + value: "dGVzdA==", + }, + "dGVzdA==", +); +Scenarios.Encode_Bytes_Query_base64url = createQueryServerTests( + "/encode/bytes/query/base64url", + { + value: "dGVzdA", + }, + "dGVzdA", +); +Scenarios.Encode_Bytes_Query_base64urlArray = createQueryServerTests( + "/encode/bytes/query/base64url-array", + { + value: ["dGVzdA", "dGVzdA"].join(","), + }, + ["dGVzdA", "dGVzdA"], + "csv", +); +function createPropertyServerTests(uri: string, data: any, value: any) { + return passOnSuccess({ + uri, + method: "post", + request: { + body: json(data), + }, + response: { + status: 200, + body: json({ value: value }), + }, + kind: "MockApiDefinition", + }); +} +Scenarios.Encode_Bytes_Property_default = createPropertyServerTests( + "/encode/bytes/property/default", + { + value: "dGVzdA==", + }, + "dGVzdA==", +); +Scenarios.Encode_Bytes_Property_base64 = createPropertyServerTests( + "/encode/bytes/property/base64", + { + value: "dGVzdA==", + }, + "dGVzdA==", +); +Scenarios.Encode_Bytes_Property_base64url = createPropertyServerTests( + "/encode/bytes/property/base64url", + { + value: "dGVzdA", + }, + "dGVzdA", +); +Scenarios.Encode_Bytes_Property_base64urlArray = createPropertyServerTests( + "/encode/bytes/property/base64url-array", + { + value: ["dGVzdA", "dGVzdA"], + }, + ["dGVzdA", "dGVzdA"], +); +function createHeaderServerTests(uri: string, data: any, value: any) { + return passOnSuccess({ + uri, + method: "get", + request: { + headers: data, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }); +} +Scenarios.Encode_Bytes_Header_default = createHeaderServerTests( + "/encode/bytes/header/default", + { + value: "dGVzdA==", + }, + "dGVzdA==", +); +Scenarios.Encode_Bytes_Header_base64 = createHeaderServerTests( + "/encode/bytes/header/base64", + { + value: "dGVzdA==", + }, + "dGVzdA==", +); +Scenarios.Encode_Bytes_Header_base64url = createHeaderServerTests( + "/encode/bytes/header/base64url", + { + value: "dGVzdA", + }, + "dGVzdA", +); +Scenarios.Encode_Bytes_Header_base64urlArray = createHeaderServerTests( + "/encode/bytes/header/base64url-array", + { + value: ["dGVzdA", "dGVzdA"].join(","), + }, + ["dGVzdA", "dGVzdA"].join(","), +); +function createRequestBodyServerTests( + uri: string, + data: any, + contentType: string = "application/json", +) { + return passOnSuccess({ + uri, + method: "post", + request: { + body: { + contentType: contentType, + rawContent: data, + }, + }, + response: { + status: 204, + }, + handler(req: MockRequest) { + req.expect.containsHeader("content-type", contentType); + req.expect.rawBodyEquals(data); + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }); +} +Scenarios.Encode_Bytes_RequestBody_default = createRequestBodyServerTests( + "/encode/bytes/body/request/default", + pngFile, + "application/octet-stream", +); +Scenarios.Encode_Bytes_RequestBody_base64 = createRequestBodyServerTests( + "/encode/bytes/body/request/base64", + '"dGVzdA=="', +); +Scenarios.Encode_Bytes_RequestBody_base64url = createRequestBodyServerTests( + "/encode/bytes/body/request/base64url", + '"dGVzdA"', +); + +Scenarios.Encode_Bytes_RequestBody_customContentType = createRequestBodyServerTests( + "/encode/bytes/body/request/custom-content-type", + pngFile, + "image/png", +); +Scenarios.Encode_Bytes_RequestBody_octetStream = createRequestBodyServerTests( + "/encode/bytes/body/request/octet-stream", + pngFile, + "application/octet-stream", +); +function createResponseBodyServerTests( + uri: string, + data: any, + headerData: any, + value: any, + contentType: string = "application/json", +) { + return passOnSuccess({ + uri, + method: "get", + request: { + headers: headerData, + }, + response: { + status: 200, + body: { + contentType: contentType, + rawContent: data, + }, + }, + handler(req: MockRequest) { + return { + status: 200, + body: { + contentType: contentType, + rawContent: value, + }, + }; + }, + kind: "MockApiDefinition", + }); +} +Scenarios.Encode_Bytes_ResponseBody_default = createResponseBodyServerTests( + "/encode/bytes/body/response/default", + pngFile, + { + "Content-Type": "application/octet-stream", + }, + pngFile, + "application/octet-stream", +); +Scenarios.Encode_Bytes_ResponseBody_base64 = createResponseBodyServerTests( + "/encode/bytes/body/response/base64", + JSON.stringify("dGVzdA=="), + { + "Content-Type": "application/json", + }, + JSON.stringify("dGVzdA=="), +); +Scenarios.Encode_Bytes_ResponseBody_base64url = createResponseBodyServerTests( + "/encode/bytes/body/response/base64url", + JSON.stringify("dGVzdA"), + { + "Content-Type": "application/json", + }, + JSON.stringify("dGVzdA"), +); +Scenarios.Encode_Bytes_ResponseBody_customContentType = createResponseBodyServerTests( + "/encode/bytes/body/response/custom-content-type", + pngFile, + { + "Content-Type": "image/png", + }, + pngFile, + "image/png", +); +Scenarios.Encode_Bytes_ResponseBody_octetStream = createResponseBodyServerTests( + "/encode/bytes/body/response/octet-stream", + pngFile, + { + "Content-Type": "application/octet-stream", + }, + pngFile, + "application/octet-stream", +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/main.tsp new file mode 100644 index 00000000000..c78fd9afbf1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/main.tsp @@ -0,0 +1,334 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test for encode decorator on datetime.") +@scenarioService("/encode/datetime") +namespace Encode.Datetime; + +@encode(DateTimeKnownEncoding.unixTimestamp, int64) +scalar unixTimestampDatetime extends utcDateTime; + +@route("/query") +namespace Query { + @route("/default") + @scenario + @scenarioDoc(""" + Test default encode (rfc3339) for datetime query parameter. + Expected query parameter: + value=2022-08-26T18:38:00.000Z + """) + op default( + @query + value: utcDateTime, + ): NoContentResponse; + + @route("/rfc3339") + @scenario + @scenarioDoc(""" + Test rfc3339 encode for datetime query parameter. + Expected query parameter: + value=2022-08-26T18:38:00.000Z + """) + op rfc3339( + @query + @encode(DateTimeKnownEncoding.rfc3339) + value: utcDateTime, + ): NoContentResponse; + + @route("/rfc7231") + @scenario + @scenarioDoc(""" + Test rfc7231 encode for datetime query parameter. + Expected query parameter: + value=Fri, 26 Aug 2022 14:38:00 GMT + """) + op rfc7231( + @query + @encode(DateTimeKnownEncoding.rfc7231) + value: utcDateTime, + ): NoContentResponse; + + @route("/unix-timestamp") + @scenario + @scenarioDoc(""" + Test unixTimestamp encode for datetime query parameter. + Expected query parameter: + value=1686566864 + """) + op unixTimestamp( + @query + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + value: utcDateTime, + ): NoContentResponse; + + @route("/unix-timestamp-array") + @scenario + @scenarioDoc(""" + Test unixTimestamp encode for datetime array query parameter. + Expected query parameter: + value=1686566864, 1686734256 + """) + op unixTimestampArray( + @query + value: unixTimestampDatetime[], + ): NoContentResponse; +} + +model DefaultDatetimeProperty { + value: utcDateTime; +} + +model Rfc3339DatetimeProperty { + @encode(DateTimeKnownEncoding.rfc3339) + value: utcDateTime; +} + +model Rfc7231DatetimeProperty { + @encode(DateTimeKnownEncoding.rfc7231) + value: utcDateTime; +} + +model UnixTimestampDatetimeProperty { + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + value: utcDateTime; +} + +model UnixTimestampArrayDatetimeProperty { + value: unixTimestampDatetime[]; +} + +@route("/property") +namespace Property { + @route("/default") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains datetime property with default encode (rfc3339). + Expected request body: + ```json + { + "value": "2022-08-26T18:38:00.000Z" + } + ``` + Expected response body: + ```json + { + "value": "2022-08-26T18:38:00.000Z" + } + ``` + """) + @post + op default(@body body: DefaultDatetimeProperty): DefaultDatetimeProperty; + + @route("/rfc3339") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains datetime property with rfc3339 encode. + Expected request body: + ```json + { + "value": "2022-08-26T18:38:00.000Z" + } + ``` + Expected response body: + ```json + { + "value": "2022-08-26T18:38:00.000Z" + } + ``` + """) + @post + op rfc3339(@body body: Rfc3339DatetimeProperty): Rfc3339DatetimeProperty; + + @route("/rfc7231") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains datetime property with rfc7231 encode. + Expected request body: + ```json + { + "value": "Fri, 26 Aug 2022 14:38:00 GMT" + } + ``` + Expected response body: + ```json + { + "value": "Fri, 26 Aug 2022 14:38:00 GMT" + } + ``` + """) + @post + op rfc7231(@body body: Rfc7231DatetimeProperty): Rfc7231DatetimeProperty; + + @route("/unix-timestamp") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains datetime property with unixTimestamp encode. + Expected request body: + ```json + { + "value": 1686566864 + } + ``` + Expected response body: + ```json + { + "value": 1686566864 + } + ``` + """) + @post + op unixTimestamp(@body body: UnixTimestampDatetimeProperty): UnixTimestampDatetimeProperty; + + @route("/unix-timestamp-array") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains datetime array property with unixTimestamp encode. + Expected request body:f + ```json + { + "value": [1686566864, 1686734256] + } + ``` + Expected response body: + ```json + { + "value": [1686566864, 1686734256] + } + ``` + """) + @post + op unixTimestampArray( + @body body: UnixTimestampArrayDatetimeProperty, + ): UnixTimestampArrayDatetimeProperty; +} + +@route("/header") +namespace Header { + @route("/default") + @scenario + @scenarioDoc(""" + Test default encode (rfc7231) for datetime header. + Expected header: + value=Fri, 26 Aug 2022 14:38:00 GMT + """) + op default( + @header + value: utcDateTime, + ): NoContentResponse; + + @route("/rfc3339") + @scenario + @scenarioDoc(""" + Test rfc3339 encode for datetime header. + Expected header: + value=2022-08-26T18:38:00.000Z + """) + op rfc3339( + @header + @encode(DateTimeKnownEncoding.rfc3339) + value: utcDateTime, + ): NoContentResponse; + + @route("/rfc7231") + @scenario + @scenarioDoc(""" + Test rfc7231 encode for datetime header. + Expected header: + value=Fri, 26 Aug 2022 14:38:00 GMT + """) + op rfc7231( + @header + @encode(DateTimeKnownEncoding.rfc7231) + value: utcDateTime, + ): NoContentResponse; + + @route("/unix-timestamp") + @scenario + @scenarioDoc(""" + Test unixTimestamp encode for datetime header. + Expected header: + value=1686566864 + """) + op unixTimestamp( + @header + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + value: utcDateTime, + ): NoContentResponse; + + @route("/unix-timestamp-array") + @scenario + @scenarioDoc(""" + Test unixTimestamp encode for datetime array header. + Expected header: + value=1686566864,1686734256 + """) + op unixTimestampArray( + @header + value: unixTimestampDatetime[], + ): NoContentResponse; +} + +model DefaultDatetimeHeader { + @header + value: utcDateTime; +} + +model Rfc3339DatetimeHeader { + @encode(DateTimeKnownEncoding.rfc3339) + @header + value: utcDateTime; +} + +model Rfc7231DatetimeHeader { + @encode(DateTimeKnownEncoding.rfc7231) + @header + value: utcDateTime; +} + +model UnixTimestampDatetimeHeader { + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + @header + value: utcDateTime; +} + +@route("/responseheader") +namespace ResponseHeader { + @route("/default") + @scenario + @scenarioDoc(""" + Test default encode (rfc7231) for datetime header. + Expected response header: + value=Fri, 26 Aug 2022 14:38:00 GMT + """) + op default(): NoContentResponse & DefaultDatetimeHeader; + + @route("/rfc3339") + @scenario + @scenarioDoc(""" + Test rfc3339 encode for datetime header. + Expected response header: + value=2022-08-26T18:38:00.000Z + """) + op rfc3339(): NoContentResponse & Rfc3339DatetimeHeader; + + @route("/rfc7231") + @scenario + @scenarioDoc(""" + Test rfc7231 encode for datetime header. + Expected response header: + value=Fri, 26 Aug 2022 14:38:00 GMT + """) + op rfc7231(): NoContentResponse & Rfc7231DatetimeHeader; + + @route("/unix-timestamp") + @scenario + @scenarioDoc(""" + Test unixTimestamp encode for datetime header. + Expected response header: + value=1686566864 + """) + op unixTimestamp(): NoContentResponse & UnixTimestampDatetimeHeader; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/mockapi.ts new file mode 100644 index 00000000000..00d21397026 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/mockapi.ts @@ -0,0 +1,274 @@ +import { + CollectionFormat, + json, + MockRequest, + passOnSuccess, + ScenarioMockApi, + validateValueFormat, + ValidationError, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createQueryServerTests( + uri: string, + paramData: any, + format: "rfc7231" | "rfc3339" | undefined, + value: any, + collectionFormat?: CollectionFormat, +) { + return passOnSuccess({ + uri, + method: "get", + request: { + query: paramData, + }, + response: { + status: 204, + }, + handler(req: MockRequest) { + if (format) { + validateValueFormat(req.query["value"] as string, format); + if (Date.parse(req.query["value"] as string) !== Date.parse(value)) { + throw new ValidationError(`Wrong value`, value, req.query["value"]); + } + } else { + req.expect.containsQueryParam("value", value, collectionFormat); + } + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }); +} +Scenarios.Encode_Datetime_Query_default = createQueryServerTests( + "/encode/datetime/query/default", + { + value: "2022-08-26T18:38:00.000Z", + }, + "rfc3339", + "2022-08-26T18:38:00.000Z", +); +Scenarios.Encode_Datetime_Query_rfc3339 = createQueryServerTests( + "/encode/datetime/query/rfc3339", + { + value: "2022-08-26T18:38:00.000Z", + }, + "rfc3339", + "2022-08-26T18:38:00.000Z", +); +Scenarios.Encode_Datetime_Query_rfc7231 = createQueryServerTests( + "/encode/datetime/query/rfc7231", + { + value: "Fri, 26 Aug 2022 14:38:00 GMT", + }, + "rfc7231", + "Fri, 26 Aug 2022 14:38:00 GMT", +); +Scenarios.Encode_Datetime_Query_unixTimestamp = createQueryServerTests( + "/encode/datetime/query/unix-timestamp", + { + value: 1686566864, + }, + undefined, + "1686566864", +); +Scenarios.Encode_Datetime_Query_unixTimestampArray = createQueryServerTests( + "/encode/datetime/query/unix-timestamp-array", + { + value: [1686566864, 1686734256].join(","), + }, + undefined, + ["1686566864", "1686734256"], + "csv", +); +function createPropertyServerTests( + uri: string, + data: any, + format: "rfc7231" | "rfc3339" | undefined, + value: any, +) { + return passOnSuccess({ + uri, + method: "post", + request: { + body: json(data), + }, + response: { + status: 200, + }, + handler: (req: MockRequest) => { + if (format) { + validateValueFormat(req.body["value"], format); + if (Date.parse(req.body["value"]) !== Date.parse(value)) { + throw new ValidationError(`Wrong value`, value, req.body["value"]); + } + } else { + req.expect.coercedBodyEquals({ value: value }); + } + return { + status: 200, + body: json({ value: value }), + }; + }, + kind: "MockApiDefinition", + }); +} +Scenarios.Encode_Datetime_Property_default = createPropertyServerTests( + "/encode/datetime/property/default", + { + value: "2022-08-26T18:38:00.000Z", + }, + "rfc3339", + "2022-08-26T18:38:00.000Z", +); +Scenarios.Encode_Datetime_Property_rfc3339 = createPropertyServerTests( + "/encode/datetime/property/rfc3339", + { + value: "2022-08-26T18:38:00.000Z", + }, + "rfc3339", + "2022-08-26T18:38:00.000Z", +); +Scenarios.Encode_Datetime_Property_rfc7231 = createPropertyServerTests( + "/encode/datetime/property/rfc7231", + { + value: "Fri, 26 Aug 2022 14:38:00 GMT", + }, + "rfc7231", + "Fri, 26 Aug 2022 14:38:00 GMT", +); +Scenarios.Encode_Datetime_Property_unixTimestamp = createPropertyServerTests( + "/encode/datetime/property/unix-timestamp", + { + value: 1686566864, + }, + undefined, + 1686566864, +); +Scenarios.Encode_Datetime_Property_unixTimestampArray = createPropertyServerTests( + "/encode/datetime/property/unix-timestamp-array", + { + value: [1686566864, 1686734256], + }, + undefined, + [1686566864, 1686734256], +); +function createHeaderServerTests( + uri: string, + data: any, + format: "rfc7231" | "rfc3339" | undefined, + value: any, +) { + return passOnSuccess({ + uri, + method: "get", + request: { + headers: data, + }, + response: { + status: 204, + }, + handler(req: MockRequest) { + if (format) { + validateValueFormat(req.headers["value"], format); + if (Date.parse(req.headers["value"]) !== Date.parse(value)) { + throw new ValidationError(`Wrong value`, value, req.headers["value"]); + } + } else { + req.expect.containsHeader("value", value); + } + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }); +} +Scenarios.Encode_Datetime_Header_default = createHeaderServerTests( + "/encode/datetime/header/default", + { + value: "Fri, 26 Aug 2022 14:38:00 GMT", + }, + "rfc7231", + "Fri, 26 Aug 2022 14:38:00 GMT", +); +Scenarios.Encode_Datetime_Header_rfc3339 = createHeaderServerTests( + "/encode/datetime/header/rfc3339", + { + value: "2022-08-26T18:38:00.000Z", + }, + "rfc3339", + "2022-08-26T18:38:00.000Z", +); +Scenarios.Encode_Datetime_Header_rfc7231 = createHeaderServerTests( + "/encode/datetime/header/rfc7231", + { + value: "Fri, 26 Aug 2022 14:38:00 GMT", + }, + "rfc7231", + "Fri, 26 Aug 2022 14:38:00 GMT", +); +Scenarios.Encode_Datetime_Header_unixTimestamp = createHeaderServerTests( + "/encode/datetime/header/unix-timestamp", + { + value: 1686566864, + }, + undefined, + "1686566864", +); +Scenarios.Encode_Datetime_Header_unixTimestampArray = createHeaderServerTests( + "/encode/datetime/header/unix-timestamp-array", + { + value: [1686566864, 1686734256].join(","), + }, + undefined, + "1686566864,1686734256", +); +function createResponseHeaderServerTests(uri: string, data: any, value: any) { + return passOnSuccess({ + uri, + method: "get", + request: {}, + response: { + status: 204, + headers: data, + }, + handler: (req: MockRequest) => { + return { + status: 204, + headers: { value: value }, + }; + }, + kind: "MockApiDefinition", + }); +} +Scenarios.Encode_Datetime_ResponseHeader_default = createResponseHeaderServerTests( + "/encode/datetime/responseheader/default", + { + value: "Fri, 26 Aug 2022 14:38:00 GMT", + }, + "Fri, 26 Aug 2022 14:38:00 GMT", +); +Scenarios.Encode_Datetime_ResponseHeader_rfc3339 = createResponseHeaderServerTests( + "/encode/datetime/responseheader/rfc3339", + { + value: "2022-08-26T18:38:00.000Z", + }, + "2022-08-26T18:38:00.000Z", +); +Scenarios.Encode_Datetime_ResponseHeader_rfc7231 = createResponseHeaderServerTests( + "/encode/datetime/responseheader/rfc7231", + { + value: "Fri, 26 Aug 2022 14:38:00 GMT", + }, + "Fri, 26 Aug 2022 14:38:00 GMT", +); +Scenarios.Encode_Datetime_ResponseHeader_unixTimestamp = createResponseHeaderServerTests( + "/encode/datetime/responseheader/unix-timestamp", + { + value: "1686566864", + }, + 1686566864, +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/main.tsp new file mode 100644 index 00000000000..cb0cf16aee0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/main.tsp @@ -0,0 +1,731 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test for encode decorator on duration.") +@scenarioService("/encode/duration") +namespace Encode.Duration; + +@route("/query") +namespace Query { + @route("/default") + @scenario + @scenarioDoc(""" + Test default encode for a duration parameter. + Expected query parameter `input=P40D` + """) + op default( + @query + input: duration, + ): NoContentResponse; + + @route("/iso8601") + @scenario + @scenarioDoc(""" + Test iso8601 encode for a duration parameter. + Expected query parameter `input=P40D` + """) + op iso8601( + @query + @encode(DurationKnownEncoding.ISO8601) + input: duration, + ): NoContentResponse; + + @route("/int32-seconds") + @scenario + @scenarioDoc(""" + Test int32 seconds encode for a duration parameter. + Expected query parameter `input=36` + """) + op int32Seconds( + @query + @encode(DurationKnownEncoding.seconds, int32) + input: duration, + ): NoContentResponse; + + @route("/int32-seconds-larger-unit") + @scenario + @scenarioDoc(""" + Test int32 seconds encode for a duration parameter where the duration is several minutes. + Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2) in C#. + Expected query parameter `input=120` + """) + op int32SecondsLargerUnit( + @query + @encode(DurationKnownEncoding.seconds, int32) + input: duration, + ): NoContentResponse; + + @route("/float-seconds") + @scenario + @scenarioDoc(""" + Test float seconds encode for a duration parameter. + Expected query parameter `input=35.625` + """) + op floatSeconds( + @query + @encode(DurationKnownEncoding.seconds, float) + input: duration, + ): NoContentResponse; + + @route("/float-seconds-larger-unit") + @scenario + @scenarioDoc(""" + Test float seconds encode for a duration parameter where the duration is several minutes. + Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2.5) in C#. + Expected query parameter `input=150.0` + """) + op floatSecondsLargerUnit( + @query + @encode(DurationKnownEncoding.seconds, float) + input: duration, + ): NoContentResponse; + + @route("/float64-seconds") + @scenario + @scenarioDoc(""" + Test float64 seconds encode for a duration parameter. + Expected query parameter `input=35.625` + """) + op float64Seconds( + @query + @encode(DurationKnownEncoding.seconds, float64) + input: duration, + ): NoContentResponse; + + @route("/int32-milliseconds") + @scenario + @scenarioDoc(""" + Test int32 milliseconds encode for a duration parameter. + Expected query parameter `input=36000` + """) + op int32Milliseconds( + @query + @encode(DurationKnownEncoding.milliseconds, int32) + input: duration, + ): NoContentResponse; + + @route("/int32-milliseconds-larger-unit") + @scenario + @scenarioDoc(""" + Test int32 milliseconds encode for a duration parameter where the duration is several minutes. + Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3) in C#. + Expected query parameter `input=180000` + """) + op int32MillisecondsLargerUnit( + @query + @encode(DurationKnownEncoding.milliseconds, int32) + input: duration, + ): NoContentResponse; + + @route("/float-milliseconds") + @scenario + @scenarioDoc(""" + Test float milliseconds encode for a duration parameter. + Expected query parameter `input=35625` + """) + op floatMilliseconds( + @query + @encode(DurationKnownEncoding.milliseconds, float) + input: duration, + ): NoContentResponse; + + @route("/float-milliseconds-larger-unit") + @scenario + @scenarioDoc(""" + Test float milliseconds encode for a duration parameter where the duration is several minutes. + Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3.5) in C#. + Expected query parameter `input=210000.0` + """) + op floatMillisecondsLargerUnit( + @query + @encode(DurationKnownEncoding.milliseconds, float) + input: duration, + ): NoContentResponse; + + @route("/float64-milliseconds") + @scenario + @scenarioDoc(""" + Test float64 milliseconds encode for a duration parameter. + Expected query parameter `input=35625` + """) + op float64Milliseconds( + @query + @encode(DurationKnownEncoding.milliseconds, float64) + input: duration, + ): NoContentResponse; + + @encode(DurationKnownEncoding.seconds, int32) + scalar Int32Duration extends duration; + + @route("/int32-seconds-array") + @scenario + @scenarioDoc(""" + Test int32 seconds encode for a duration array parameter. + Expected query parameter `input=36,47` + """) + op int32SecondsArray( + @query + input: Int32Duration[], + ): NoContentResponse; + + @encode(DurationKnownEncoding.milliseconds, int32) + scalar Int32MillisecondsDuration extends duration; + + @route("/int32-milliseconds-array") + @scenario + @scenarioDoc(""" + Test int32 milliseconds encode for a duration array parameter. + Expected query parameter `input=36000,47000` + """) + op int32MillisecondsArray( + @query + input: Int32MillisecondsDuration[], + ): NoContentResponse; +} + +@route("/property") +namespace Property { + model DefaultDurationProperty { + value: duration; + } + + model ISO8601DurationProperty { + @encode(DurationKnownEncoding.ISO8601) + value: duration; + } + + model Int32SecondsDurationProperty { + @encode(DurationKnownEncoding.seconds, int32) + value: duration; + } + + model FloatSecondsDurationProperty { + @encode(DurationKnownEncoding.seconds, float) + value: duration; + } + + model Float64SecondsDurationProperty { + @encode(DurationKnownEncoding.seconds, float64) + value: duration; + } + + model Int32MillisecondsDurationProperty { + @encode(DurationKnownEncoding.milliseconds, int32) + value: duration; + } + + model FloatMillisecondsDurationProperty { + @encode(DurationKnownEncoding.milliseconds, float) + value: duration; + } + + model Float64MillisecondsDurationProperty { + @encode(DurationKnownEncoding.milliseconds, float64) + value: duration; + } + + model Int32SecondsLargerUnitDurationProperty { + @encode(DurationKnownEncoding.seconds, int32) + value: duration; + } + + model FloatSecondsLargerUnitDurationProperty { + @encode(DurationKnownEncoding.seconds, float) + value: duration; + } + + model Int32MillisecondsLargerUnitDurationProperty { + @encode(DurationKnownEncoding.milliseconds, int32) + value: duration; + } + + model FloatMillisecondsLargerUnitDurationProperty { + @encode(DurationKnownEncoding.milliseconds, float) + value: duration; + } + + @encode(DurationKnownEncoding.seconds, float32) + scalar Float32Duration extends duration; + + model FloatSecondsDurationArrayProperty { + value: Float32Duration[]; + } + + @encode(DurationKnownEncoding.milliseconds, float32) + scalar Float32MillisecondsDuration extends duration; + + model FloatMillisecondsDurationArrayProperty { + value: Float32MillisecondsDuration[]; + } + + @route("/default") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a duration property with default encode. + Expected request body: + ```json + { + "value": "P40D" + } + ``` + Expected response body: + ```json + { + "value": "P40D" + } + ``` + """) + @post + op default(@body body: DefaultDurationProperty): DefaultDurationProperty; + + @route("/iso8601") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a duration property with iso8601 encode. + Expected request body: + ```json + { + "value": "P40D" + } + ``` + Expected response body: + ```json + { + "value": "P40D" + } + ``` + """) + @post + op iso8601(@body body: ISO8601DurationProperty): ISO8601DurationProperty; + + @route("/int32-seconds") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a duration property with int32 seconds encode. + Expected request body: + ```json + { + "value": 36 + } + ``` + Expected response body: + ```json + { + "value": 36 + } + ``` + """) + op int32Seconds(@body body: Int32SecondsDurationProperty): Int32SecondsDurationProperty; + + @route("/float-seconds") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a duration property with float seconds encode. + Expected request body: + ```json + { + "value": 35.625 + } + ``` + Expected response body: + ```json + { + "value": 35.625 + } + ``` + """) + op floatSeconds(@body body: FloatSecondsDurationProperty): FloatSecondsDurationProperty; + + @route("/float64-seconds") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a duration property with float64 seconds encode. + Expected request body: + ```json + { + "value": 35.625 + } + ``` + Expected response body: + ```json + { + "value": 35.625 + } + ``` + """) + op float64Seconds(@body body: Float64SecondsDurationProperty): Float64SecondsDurationProperty; + + @route("/int32-milliseconds") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a duration property with int32 milliseconds encode. + Expected request body: + ```json + { + "value": 36000 + } + ``` + Expected response body: + ```json + { + "value": 36000 + } + ``` + """) + op int32Milliseconds( + @body body: Int32MillisecondsDurationProperty, + ): Int32MillisecondsDurationProperty; + + @route("/float-milliseconds") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a duration property with float milliseconds encode. + Expected request body: + ```json + { + "value": 35625 + } + ``` + Expected response body: + ```json + { + "value": 35625 + } + ``` + """) + op floatMilliseconds( + @body body: FloatMillisecondsDurationProperty, + ): FloatMillisecondsDurationProperty; + + @route("/float64-milliseconds") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a duration property with float64 milliseconds encode. + Expected request body: + ```json + { + "value": 35625 + } + ``` + Expected response body: + ```json + { + "value": 35625 + } + ``` + """) + op float64Milliseconds( + @body body: Float64MillisecondsDurationProperty, + ): Float64MillisecondsDurationProperty; + + @route("/float-seconds-array") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains an array property which elements are duration with float seconds encode. + Expected request body: + ```json + { + "value": [35.625, 46.75] + } + ``` + Expected response body: + ```json + { + "value": [35.625, 46.75] + } + ``` + """) + op floatSecondsArray( + @body body: FloatSecondsDurationArrayProperty, + ): FloatSecondsDurationArrayProperty; + + @route("/float-milliseconds-array") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains an array property which elements are duration with float milliseconds encode. + Expected request body: + ```json + { + "value": [35625, 46750] + } + ``` + Expected response body: + ```json + { + "value": [35625, 46750] + } + ``` + """) + op floatMillisecondsArray( + @body body: FloatMillisecondsDurationArrayProperty, + ): FloatMillisecondsDurationArrayProperty; + + @route("/int32-seconds-larger-unit") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a duration property with int32 seconds encode where the duration is several minutes. + Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2) in C#. + Expected request body: + ```json + { + "value": 120 + } + ``` + Expected response body: + ```json + { + "value": 120 + } + ``` + """) + op int32SecondsLargerUnit( + @body body: Int32SecondsLargerUnitDurationProperty, + ): Int32SecondsLargerUnitDurationProperty; + + @route("/float-seconds-larger-unit") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a duration property with float seconds encode where the duration is several minutes. + Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2.5) in C#. + Expected request body: + ```json + { + "value": 150.0 + } + ``` + Expected response body: + ```json + { + "value": 150.0 + } + ``` + """) + op floatSecondsLargerUnit( + @body body: FloatSecondsLargerUnitDurationProperty, + ): FloatSecondsLargerUnitDurationProperty; + + @route("/int32-milliseconds-larger-unit") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a duration property with int32 milliseconds encode where the duration is several minutes. + Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3) in C#. + Expected request body: + ```json + { + "value": 180000 + } + ``` + Expected response body: + ```json + { + "value": 180000 + } + ``` + """) + op int32MillisecondsLargerUnit( + @body body: Int32MillisecondsLargerUnitDurationProperty, + ): Int32MillisecondsLargerUnitDurationProperty; + + @route("/float-milliseconds-larger-unit") + @scenario + @scenarioDoc(""" + Test operation with request and response model contains a duration property with float milliseconds encode where the duration is several minutes. + Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3.5) in C#. + Expected request body: + ```json + { + "value": 210000.0 + } + ``` + Expected response body: + ```json + { + "value": 210000.0 + } + ``` + """) + op floatMillisecondsLargerUnit( + @body body: FloatMillisecondsLargerUnitDurationProperty, + ): FloatMillisecondsLargerUnitDurationProperty; +} + +@route("/header") +namespace Header { + @route("/default") + @scenario + @scenarioDoc(""" + Test default encode for a duration header. + Expected header `input=P40D` + """) + op default( + @header + duration: duration, + ): NoContentResponse; + + @route("/iso8601") + @scenario + @scenarioDoc(""" + Test iso8601 encode for a duration header. + Expected header `duration: P40D` + """) + op iso8601( + @header + @encode(DurationKnownEncoding.ISO8601) + duration: duration, + ): NoContentResponse; + + @encode(DurationKnownEncoding.ISO8601) + scalar Iso8601Duration extends duration; + + @route("/iso8601-array") + @scenario + @scenarioDoc(""" + Test iso8601 encode for a duration array header. + Expected header `duration: [P40D,P50D]` + """) + op iso8601Array( + @header + duration: Iso8601Duration[], + ): NoContentResponse; + + @route("/int32-seconds") + @scenario + @scenarioDoc(""" + Test int32 seconds encode for a duration header. + Expected header `duration: 36` + """) + op int32Seconds( + @header + @encode(DurationKnownEncoding.seconds, int32) + duration: duration, + ): NoContentResponse; + + @route("/int32-seconds-larger-unit") + @scenario + @scenarioDoc(""" + Test int32 seconds encode for a duration header where the duration is several minutes. + Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2) in C#. + Expected header `duration: 120` + """) + op int32SecondsLargerUnit( + @header + @encode(DurationKnownEncoding.seconds, int32) + duration: duration, + ): NoContentResponse; + + @route("/float-seconds") + @scenario + @scenarioDoc(""" + Test float seconds encode for a duration header. + Expected header `duration: 35.625` + """) + op floatSeconds( + @header + @encode(DurationKnownEncoding.seconds, float) + duration: duration, + ): NoContentResponse; + + @route("/float-seconds-larger-unit") + @scenario + @scenarioDoc(""" + Test float seconds encode for a duration header where the duration is several minutes. + Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2.5) in C#. + Expected header `duration: 150.0` + """) + op floatSecondsLargerUnit( + @header + @encode(DurationKnownEncoding.seconds, float) + duration: duration, + ): NoContentResponse; + + @route("/float64-seconds") + @scenario + @scenarioDoc(""" + Test float64 seconds encode for a duration header. + Expected header `duration: 35.625` + """) + op float64Seconds( + @header + @encode(DurationKnownEncoding.seconds, float64) + duration: duration, + ): NoContentResponse; + + @route("/int32-milliseconds") + @scenario + @scenarioDoc(""" + Test int32 milliseconds encode for a duration header. + Expected header `duration: 36000` + """) + op int32Milliseconds( + @header + @encode(DurationKnownEncoding.milliseconds, int32) + duration: duration, + ): NoContentResponse; + + @route("/int32-milliseconds-larger-unit") + @scenario + @scenarioDoc(""" + Test int32 milliseconds encode for a duration header where the duration is several minutes. + Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3) in C#. + Expected header `duration: 180000` + """) + op int32MillisecondsLargerUnit( + @header + @encode(DurationKnownEncoding.milliseconds, int32) + duration: duration, + ): NoContentResponse; + + @route("/float-milliseconds") + @scenario + @scenarioDoc(""" + Test float milliseconds encode for a duration header. + Expected header `duration: 35625` + """) + op floatMilliseconds( + @header + @encode(DurationKnownEncoding.milliseconds, float) + duration: duration, + ): NoContentResponse; + + @route("/float-milliseconds-larger-unit") + @scenario + @scenarioDoc(""" + Test float milliseconds encode for a duration header where the duration is several minutes. + Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3.5) in C#. + Expected header `duration: 210000.0` + """) + op floatMillisecondsLargerUnit( + @header + @encode(DurationKnownEncoding.milliseconds, float) + duration: duration, + ): NoContentResponse; + + @route("/float64-milliseconds") + @scenario + @scenarioDoc(""" + Test float64 milliseconds encode for a duration header. + Expected header `duration: 35625` + """) + op float64Milliseconds( + @header + @encode(DurationKnownEncoding.milliseconds, float64) + duration: duration, + ): NoContentResponse; + + @encode(DurationKnownEncoding.milliseconds, int32) + scalar Int32MillisecondsDuration extends duration; + + @route("/int32-milliseconds-array") + @scenario + @scenarioDoc(""" + Test int32 milliseconds encode for a duration array header. + Expected header `duration: [36000,47000]` + """) + op int32MillisecondsArray( + @header + duration: Int32MillisecondsDuration[], + ): NoContentResponse; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/mockapi.ts new file mode 100644 index 00000000000..e77b3f4ab90 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/mockapi.ts @@ -0,0 +1,363 @@ +import { + CollectionFormat, + json, + MockRequest, + passOnSuccess, + ScenarioMockApi, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createBodyServerTests(uri: string, data: any, value: any) { + return passOnSuccess({ + uri, + method: "post", + request: { + body: json(data), + }, + response: { + status: 200, + body: json(data), + }, + kind: "MockApiDefinition", + }); +} +Scenarios.Encode_Duration_Property_default = createBodyServerTests( + "/encode/duration/property/default", + { + value: "P40D", + }, + "P40D", +); +Scenarios.Encode_Duration_Property_floatSeconds = createBodyServerTests( + "/encode/duration/property/float-seconds", + { + value: 35.625, + }, + 35.625, +); +Scenarios.Encode_Duration_Property_float64Seconds = createBodyServerTests( + "/encode/duration/property/float64-seconds", + { + value: 35.625, + }, + 35.625, +); +Scenarios.Encode_Duration_Property_int32Seconds = createBodyServerTests( + "/encode/duration/property/int32-seconds", + { + value: 36, + }, + 36, +); +Scenarios.Encode_Duration_Property_iso8601 = createBodyServerTests( + "/encode/duration/property/iso8601", + { + value: "P40D", + }, + "P40D", +); +Scenarios.Encode_Duration_Property_floatSecondsArray = createBodyServerTests( + "/encode/duration/property/float-seconds-array", + { + value: [35.625, 46.75], + }, + [35.625, 46.75], +); + +Scenarios.Encode_Duration_Property_int32Milliseconds = createBodyServerTests( + "/encode/duration/property/int32-milliseconds", + { + value: 36000, + }, + 36000, +); +Scenarios.Encode_Duration_Property_floatMilliseconds = createBodyServerTests( + "/encode/duration/property/float-milliseconds", + { + value: 35625, + }, + 35625, +); +Scenarios.Encode_Duration_Property_float64Milliseconds = createBodyServerTests( + "/encode/duration/property/float64-milliseconds", + { + value: 35625, + }, + 35625, +); +Scenarios.Encode_Duration_Property_floatMillisecondsArray = createBodyServerTests( + "/encode/duration/property/float-milliseconds-array", + { + value: [35625, 46750], + }, + [35625, 46750], +); +Scenarios.Encode_Duration_Property_int32SecondsLargerUnit = createBodyServerTests( + "/encode/duration/property/int32-seconds-larger-unit", + { + value: 120, + }, + 120, +); +Scenarios.Encode_Duration_Property_floatSecondsLargerUnit = createBodyServerTests( + "/encode/duration/property/float-seconds-larger-unit", + { + value: 150.0, + }, + 150.0, +); +Scenarios.Encode_Duration_Property_int32MillisecondsLargerUnit = createBodyServerTests( + "/encode/duration/property/int32-milliseconds-larger-unit", + { + value: 180000, + }, + 180000, +); +Scenarios.Encode_Duration_Property_floatMillisecondsLargerUnit = createBodyServerTests( + "/encode/duration/property/float-milliseconds-larger-unit", + { + value: 210000.0, + }, + 210000.0, +); + +function createQueryServerTests( + uri: string, + paramData: any, + value: any, + collectionFormat?: CollectionFormat, +) { + return passOnSuccess({ + uri, + method: "get", + request: { + query: paramData, + }, + response: { + status: 204, + }, + handler: (req: MockRequest) => { + req.expect.containsQueryParam("input", value, collectionFormat); + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }); +} +Scenarios.Encode_Duration_Query_default = createQueryServerTests( + "/encode/duration/query/default", + { + input: "P40D", + }, + "P40D", +); +Scenarios.Encode_Duration_Query_iso8601 = createQueryServerTests( + "/encode/duration/query/iso8601", + { + input: "P40D", + }, + "P40D", +); +Scenarios.Encode_Duration_Query_int32Seconds = createQueryServerTests( + "/encode/duration/query/int32-seconds", + { + input: 36, + }, + "36", +); +Scenarios.Encode_Duration_Query_int32SecondsArray = createQueryServerTests( + "/encode/duration/query/int32-seconds-array", + { + input: [36, 47].join(","), + }, + ["36", "47"], + "csv", +); +Scenarios.Encode_Duration_Query_floatSeconds = createQueryServerTests( + "/encode/duration/query/float-seconds", + { + input: 35.625, + }, + "35.625", +); +Scenarios.Encode_Duration_Query_float64Seconds = createQueryServerTests( + "/encode/duration/query/float64-seconds", + { + input: 35.625, + }, + "35.625", +); + +Scenarios.Encode_Duration_Query_int32Milliseconds = createQueryServerTests( + "/encode/duration/query/int32-milliseconds", + { + input: 36000, + }, + "36000", +); +Scenarios.Encode_Duration_Query_floatMilliseconds = createQueryServerTests( + "/encode/duration/query/float-milliseconds", + { + input: 35625, + }, + "35625", +); +Scenarios.Encode_Duration_Query_float64Milliseconds = createQueryServerTests( + "/encode/duration/query/float64-milliseconds", + { + input: 35625, + }, + "35625", +); +Scenarios.Encode_Duration_Query_int32MillisecondsArray = createQueryServerTests( + "/encode/duration/query/int32-milliseconds-array", + { + input: [36000, 47000].join(","), + }, + ["36000", "47000"], + "csv", +); +Scenarios.Encode_Duration_Query_int32SecondsLargerUnit = createQueryServerTests( + "/encode/duration/query/int32-seconds-larger-unit", + { + input: 120, + }, + "120", +); +Scenarios.Encode_Duration_Query_floatSecondsLargerUnit = createQueryServerTests( + "/encode/duration/query/float-seconds-larger-unit", + { + input: 150, + }, + 150, +); +Scenarios.Encode_Duration_Query_int32MillisecondsLargerUnit = createQueryServerTests( + "/encode/duration/query/int32-milliseconds-larger-unit", + { + input: 180000, + }, + "180000", +); +Scenarios.Encode_Duration_Query_floatMillisecondsLargerUnit = createQueryServerTests( + "/encode/duration/query/float-milliseconds-larger-unit", + { + input: 210000, + }, + 210000, +); + +function createHeaderServerTests(uri: string, headersData: any, value: any) { + return passOnSuccess({ + uri, + method: "get", + request: { + headers: headersData, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }); +} + +Scenarios.Encode_Duration_Header_default = createHeaderServerTests( + "/encode/duration/header/default", + { + duration: "P40D", + }, + "P40D", +); +Scenarios.Encode_Duration_Header_iso8601 = createHeaderServerTests( + "/encode/duration/header/iso8601", + { + duration: "P40D", + }, + "P40D", +); +Scenarios.Encode_Duration_Header_int32Seconds = createHeaderServerTests( + "/encode/duration/header/int32-seconds", + { + duration: "36", + }, + "36", +); +Scenarios.Encode_Duration_Header_floatSeconds = createHeaderServerTests( + "/encode/duration/header/float-seconds", + { + duration: "35.625", + }, + "35.625", +); +Scenarios.Encode_Duration_Header_float64Seconds = createHeaderServerTests( + "/encode/duration/header/float64-seconds", + { + duration: "35.625", + }, + "35.625", +); +Scenarios.Encode_Duration_Header_iso8601Array = createHeaderServerTests( + "/encode/duration/header/iso8601-array", + { + duration: ["P40D", "P50D"].join(","), + }, + "P40D,P50D", +); + +Scenarios.Encode_Duration_Header_int32Milliseconds = createHeaderServerTests( + "/encode/duration/header/int32-milliseconds", + { + duration: "36000", + }, + "36000", +); +Scenarios.Encode_Duration_Header_floatMilliseconds = createHeaderServerTests( + "/encode/duration/header/float-milliseconds", + { + duration: "35625", + }, + "35625", +); +Scenarios.Encode_Duration_Header_float64Milliseconds = createHeaderServerTests( + "/encode/duration/header/float64-milliseconds", + { + duration: "35625", + }, + "35625", +); +Scenarios.Encode_Duration_Header_int32MillisecondsArray = createHeaderServerTests( + "/encode/duration/header/int32-milliseconds-array", + { + duration: ["36000", "47000"].join(","), + }, + "36000,47000", +); +Scenarios.Encode_Duration_Header_int32SecondsLargerUnit = createHeaderServerTests( + "/encode/duration/header/int32-seconds-larger-unit", + { + duration: "120", + }, + "120", +); +Scenarios.Encode_Duration_Header_floatSecondsLargerUnit = createHeaderServerTests( + "/encode/duration/header/float-seconds-larger-unit", + { + duration: "150", + }, + "150", +); +Scenarios.Encode_Duration_Header_int32MillisecondsLargerUnit = createHeaderServerTests( + "/encode/duration/header/int32-milliseconds-larger-unit", + { + duration: "180000", + }, + "180000", +); +Scenarios.Encode_Duration_Header_floatMillisecondsLargerUnit = createHeaderServerTests( + "/encode/duration/header/float-milliseconds-larger-unit", + { + duration: "210000", + }, + "210000", +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/main.tsp new file mode 100644 index 00000000000..5677d2c673c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/main.tsp @@ -0,0 +1,69 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test for encode decorator on integer.") +@scenarioService("/encode/numeric") +namespace Encode.Numeric; + +@route("/property") +namespace Property { + alias SendSafeIntAsString = SendIntAsString; + + @route("/safeint") + op safeintAsString is SendSafeIntAsString.sendIntAsString; + + model SafeintAsStringProperty { + @encode(string) + value: safeint; + } + + alias SendUint32AsString = SendIntAsString; + + @route("/uint32") + op uint32AsStringOptional is SendUint32AsString.sendIntAsString; + + model Uint32AsStringProperty { + @encode(string) + value?: uint32; + } + + alias SendUint8AsString = SendIntAsString; + + @route("/uint8") + op uint8AsString is SendUint8AsString.sendIntAsString; + + model Uint8AsStringProperty { + @encode(string) + value: uint8; + } + + interface SendIntAsString { + @scenario + @scenarioDoc( + """ + Test operation with request and response model contains property of {type} type with string encode. + Expected request body: + ```json + { + "value": "{value}" + } + ``` + Expected response body: + ```json + { + "value": "{value}" + } + ``` + """, + { + type: IntType, + value: StringValue, + } + ) + @post + sendIntAsString(@body value: Payload): Payload; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/mockapi.ts new file mode 100644 index 00000000000..fe5feaaed25 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/mockapi.ts @@ -0,0 +1,32 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createTests(uri: string, value: any) { + return passOnSuccess({ + uri, + method: "post", + request: { + body: json({ + value, + }), + }, + response: { + status: 200, + body: json({ value }), + }, + kind: "MockApiDefinition", + }); +} +Scenarios.Encode_Numeric_Property_safeintAsString = createTests( + "/encode/numeric/property/safeint", + "10000000000", +); +Scenarios.Encode_Numeric_Property_uint32AsStringOptional = createTests( + "/encode/numeric/property/uint32", + "1", +); +Scenarios.Encode_Numeric_Property_uint8AsString = createTests( + "/encode/numeric/property/uint8", + "255", +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/helper.ts b/packages/http-client-java/generator/http-client-generator-test/specs/helper.ts new file mode 100644 index 00000000000..2fa9acec5ff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/helper.ts @@ -0,0 +1,8 @@ +import { resolvePath } from "@typespec/compiler"; +import { readFileSync } from "fs"; +import { fileURLToPath } from "url"; + +const root = resolvePath(fileURLToPath(import.meta.url), "../../../"); + +export const pngFile = readFileSync(resolvePath(root, "assets/image.png")); +export const jpgFile = readFileSync(resolvePath(root, "assets/image.jpg")); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/main.tsp new file mode 100644 index 00000000000..d797a05cec8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/main.tsp @@ -0,0 +1,58 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test for basic parameters cases.") +@scenarioService("/parameters/basic") +namespace Parameters.Basic; + +@route("/explicit-body") +namespace ExplicitBody { + @doc("This is a simple model.") + model User { + name: string; + } + + @scenario + @scenarioDoc(""" + Test case for simple explicit body. + + Should generate request body model named `User`. + Should generate an operation like below: + ``` + spreadAsRequestBody(bodyParameter: BodyParameter) + ``` + Note the parameter name is guessed from the model name and it may vary by language. + + Expected request body: + ```json + { "name": "foo" } + ``` + """) + @route("/simple") + @put + op simple(@body body: User): NoContentResponse; +} + +@route("/implicit-body") +namespace ImplicitBody { + @scenario + @scenarioDoc(""" + Test case for simple implicit body. + + Should generate an operation like below: + ``` + simple(name: string) + ``` + + Expected request body: + ```json + { "name": "foo" } + ``` + """) + @route("/simple") + @put + op simple(name: string): NoContentResponse; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/mockapi.ts new file mode 100644 index 00000000000..dbe4976ec33 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/mockapi.ts @@ -0,0 +1,25 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; +function createServerTests(uri: string) { + return passOnSuccess({ + uri, + method: "put", + request: { + body: json({ + name: "foo", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }); +} + +Scenarios.Parameters_Basic_ExplicitBody_simple = createServerTests( + "/parameters/basic/explicit-body/simple", +); +Scenarios.Parameters_Basic_ImplicitBody_simple = createServerTests( + "/parameters/basic/implicit-body/simple", +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/main.tsp new file mode 100644 index 00000000000..567f757df5e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/main.tsp @@ -0,0 +1,63 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test describing optionality of the request body.") +@scenarioService("/parameters/body-optionality") +namespace Parameters.BodyOptionality; + +model BodyModel { + name: string; +} + +@scenario +@scenarioDoc(""" + Scenario defining how an explicit required body parameter is specified. + + Expected request body: + ```json + { "name": "foo" } + ``` + """) +@route("/required-explicit") +@post +op requiredExplicit(@body body: BodyModel): NoContentResponse; + +@scenario +@scenarioDoc(""" + Scenario defining how an explicit optional body parameter is specified. + + Expected request body for `set` + ```json + { "name": "foo" } + ``` + Expected Content-Type header: application/json + + Expected no request body for `omit` + Expected Content-Type header: must NOT be present + """) +@route("/optional-explicit") +namespace OptionalExplicit { + @route("/set") + @post + op set(@body body?: BodyModel): NoContentResponse; + + @route("/omit") + @post + op omit(@body body?: BodyModel): NoContentResponse; +} + +@scenario +@scenarioDoc(""" + Scenario defining how an implicit required body parameter is specified. + + Expected request body: + ```json + { "name": "foo" } + ``` + """) +@route("/required-implicit") +@post +op requiredImplicit(...BodyModel): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/mockapi.ts new file mode 100644 index 00000000000..f0350f1c176 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/mockapi.ts @@ -0,0 +1,79 @@ +import { + json, + MockRequest, + passOnSuccess, + ScenarioMockApi, + ValidationError, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; +function createServerTests(uri: string, data: any) { + return passOnSuccess({ + uri, + method: "post", + request: { + body: json(data), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }); +} + +Scenarios.Parameters_BodyOptionality_requiredExplicit = createServerTests( + "/parameters/body-optionality/required-explicit", + { + name: "foo", + }, +); + +Scenarios.Parameters_BodyOptionality_OptionalExplicit = passOnSuccess([ + { + uri: "/parameters/body-optionality/optional-explicit/set", + method: "post", + request: { + body: json({ + name: "foo", + }), + }, + response: { + status: 204, + }, + handler: (req: MockRequest) => { + // Validate that Content-Type header is present when body is provided + req.expect.containsHeader("content-type", "application/json"); + return { status: 204 }; + }, + kind: "MockApiDefinition", + }, + { + uri: "/parameters/body-optionality/optional-explicit/omit", + method: "post", + request: {}, + response: { + status: 204, + }, + handler: (req: MockRequest) => { + req.expect.rawBodyEquals(undefined); + // Validate that Content-Type header is NOT present when body is omitted + const contentTypeHeader = req.headers["content-type"]; + if (contentTypeHeader !== undefined) { + throw new ValidationError( + "Content-Type header must NOT be present when body is omitted", + undefined, + contentTypeHeader, + ); + } + return { status: 204 }; + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Parameters_BodyOptionality_requiredImplicit = createServerTests( + "/parameters/body-optionality/required-implicit", + { + name: "foo", + }, +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/main.tsp new file mode 100644 index 00000000000..620cf14c3f8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/main.tsp @@ -0,0 +1,72 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test for collectionFormat.") +@scenarioService("/parameters/collection-format") +namespace Parameters.CollectionFormat; + +@route("/query") +namespace Query { + @scenario + @scenarioDoc(""" + This test is testing sending a multi collection format array query parameters + """) + @route("/multi") + op multi( + @doc("Possible values for colors are [blue,red,green]") + @query(#{ explode: true }) + colors: string[], + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + This test is testing sending a ssv collection format array query parameters + """) + @route("/ssv") + op ssv( + @doc("Possible values for colors are [blue,red,green]") + @query + @encode(ArrayEncoding.spaceDelimited) + colors: string[], + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + This test is testing sending a pipes collection format array query parameters + """) + @route("/pipes") + op pipes( + @doc("Possible values for colors are [blue,red,green]") + @query + @encode(ArrayEncoding.pipeDelimited) + colors: string[], + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + This test is testing sending a csv collection format array query parameters + """) + @route("/csv") + op csv( + @doc("Possible values for colors are [blue,red,green]") + @query + colors: string[], + ): NoContentResponse; +} + +@route("/header") +namespace Header { + @scenario + @scenarioDoc(""" + This test is testing sending a csv collection format array header parameters + """) + @route("/csv") + op csv( + @doc("Possible values for colors are [blue,red,green]") + @header + colors: string[], + ): NoContentResponse; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/mockapi.ts new file mode 100644 index 00000000000..724b794c59c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/mockapi.ts @@ -0,0 +1,71 @@ +import { MockRequest, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const colors = ["blue", "red", "green"]; + +Scenarios.Parameters_CollectionFormat_Query_multi = passOnSuccess({ + uri: `/parameters/collection-format/query/multi`, + method: "get", + request: { + query: { colors: ["blue", "red", "green"] }, + }, + response: { + status: 204, + }, + handler: (req: MockRequest) => { + req.expect.containsQueryParam("colors", ["blue", "red", "green"], "multi"); + return { + status: 204, + }; + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_CollectionFormat_Query_csv = passOnSuccess({ + uri: `/parameters/collection-format/query/csv`, + method: "get", + request: { + query: { colors: colors.join(",") }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_CollectionFormat_Query_ssv = passOnSuccess({ + uri: `/parameters/collection-format/query/ssv`, + method: "get", + request: { + query: { colors: colors.join(" ") }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_CollectionFormat_Query_pipes = passOnSuccess({ + uri: `/parameters/collection-format/query/pipes`, + method: "get", + request: { + query: { colors: colors.join("|") }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_CollectionFormat_Header_csv = passOnSuccess({ + uri: `/parameters/collection-format/header/csv`, + method: "get", + request: { + headers: { colors: colors.join(",") }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/main.tsp new file mode 100644 index 00000000000..f985369972c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/main.tsp @@ -0,0 +1,48 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test for path parameters cases.") +@scenarioService("/parameters/path") +namespace Parameters.Path; + +@scenario +@scenarioDoc(""" + Test case for normal path parameter. + + Should generate an operation like below: + ``` + normal(name: string) + ``` + + Expected request path: + ``` + /normal/foo + ``` + """) +@route("/normal/{name}") +op normal(@path name: string): NoContentResponse; + +@scenario +@scenarioDoc(""" + Test case for optional path parameter. + + Should generate an operation like below: + ``` + optional(name?: string) + ``` + + Expected two request: + First request path: + ``` + /optional + ``` + Second request path: + ``` + /optional/foo + ``` + """) +@route("/optional{/name}") +op optional(@path name?: string): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/mockapi.ts new file mode 100644 index 00000000000..22eb68e9a1f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/mockapi.ts @@ -0,0 +1,34 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Parameters_Path_normal = passOnSuccess({ + uri: "/parameters/path/normal/foo", + method: "get", + + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_Path_optional = passOnSuccess([ + { + uri: "/parameters/path/optional", + method: "get", + + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: "/parameters/path/optional/foo", + method: "get", + + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/main.tsp new file mode 100644 index 00000000000..5d8d3488445 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/main.tsp @@ -0,0 +1,337 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test for the spread operator.") +@scenarioService("/parameters/spread") +namespace Parameters.Spread; + +@route("/model") +namespace Model { + @doc("This is a simple model.") + model BodyParameter { + name: string; + } + + @scenario + @scenarioDoc(""" + Test case for spread named model. + + Should not generate request body model named `BodyParameter`. + Should generate an operation like below: + ``` + spreadAsRequestBody(name: string) + ``` + Note the parameter name is guessed from the model name and it may vary by language. + + Expected request body: + ```json + { "name": "foo" } + ``` + """) + @route("/request-body") + @put + op spreadAsRequestBody(...BodyParameter): NoContentResponse; + + @doc("This is a model only with `@body` property.") + model CompositeRequestOnlyWithBody { + @body body: BodyParameter; + } + + @scenario + @scenarioDoc(""" + Test case for spread model only with `@body` property. + + Should generate request body model named `BodyParameter`. + Should not generate model named `CompositeRequestOnlyWithBody`. + Should generate an operation like below: + ``` + spreadCompositeRequestOnlyWithBody(bodyParameter: BodyParameter) + ``` + Note the parameter name is guessed from the model name and it may vary by language. + + Expected request body: + ```json + { "name": "foo" } + ``` + """) + @route("/composite-request-only-with-body") + @put + op spreadCompositeRequestOnlyWithBody(...CompositeRequestOnlyWithBody): NoContentResponse; + + @doc("This is a model without `@body` property.") + model CompositeRequestWithoutBody { + @path + name: string; + + @header + testHeader: string; + } + + @scenario + @scenarioDoc(""" + Test case for spread model without `@body` property. + + Should not generate model named `CompositeRequestOnlyWithBody`. + Should generate an operation like below: + ``` + spreadCompositeRequestWithoutBody(name: string, testHeader: string) + ``` + + Expected path parameter: name="foo" + Expected header parameter: testHeader="bar" + """) + @route("/composite-request-without-body/{name}") + @put + op spreadCompositeRequestWithoutBody(...CompositeRequestWithoutBody): NoContentResponse; + + @doc("This is a model with all http request decorator.") + model CompositeRequest { + @path + name: string; + + @header + testHeader: string; + + @body + body: BodyParameter; + } + + @scenario + @scenarioDoc(""" + Test case for spread model with all http request decorator. + + Should generate request body model named `BodyParameter`. + Should not generate model named `CompositeRequest`. + Should generate an operation like below: + ``` + spreadCompositeRequest(name: string, testHeader: string, bodyParameter: BodyParameter) + ``` + Note the parameter name is guessed from the model name and it may vary by language. + + Expected path parameter: name="foo" + Expected header parameter: testHeader="bar" + Expected request body: + ```json + { "name": "foo" } + ``` + """) + @route("/composite-request/{name}") + @put + op spreadCompositeRequest(...CompositeRequest): NoContentResponse; + + @doc("This is a model with non-body http request decorator.") + model CompositeRequestMix { + @path + name: string; + + @header + testHeader: string; + + prop: string; + } + + @scenario + @scenarioDoc(""" + Test case for spread model with non-body http request decorator. + + Should not generate model named `CompositeRequestMix`. + Should generate an operation like below: + ``` + spreadCompositeRequestMix(name: string, testHeader: string, prop: string) + ``` + Note the parameter name is guessed from the model name and it may vary by language. + + Expected path parameter: name="foo" + Expected header parameter: testHeader="bar" + Expected request body: + ```json + { "prop": "foo" } + ``` + """) + @route("/composite-request-mix/{name}") + @put + op spreadCompositeRequestMix(...CompositeRequestMix): NoContentResponse; +} + +@route("/alias") +namespace Alias { + alias BodyParameter = { + name: string; + }; + + @scenario + @scenarioDoc(""" + Test case for spread alias. + + Should not generate any model named `BodyParameter`. + Should generate an operation like: + ``` + spreadAsRequestBody(name: string) + ``` + + Expected request body: + ```json + { "name": "foo" } + ``` + """) + @route("/request-body") + @put + op spreadAsRequestBody(...BodyParameter): NoContentResponse; + + model InnerModel { + name: string; + } + + alias InnerModelParameter = { + @path + id: string; + + ...InnerModel; + + @header + `x-ms-test-header`: string; + }; + + @scenario + @scenarioDoc(""" + Test case for spread alias. + + Should not generate any model named `InnerModel`. + Should not generate any model named `InnerModelParameter`. + Should generate an operation like: + ``` + spreadParameterWithInnerModel(id: string, x_ms_test_header: string, name: string) + ``` + Note the parameter name is guessed from the model name and it may vary by language. + + Expected path parameter: id="1" + Expected header parameter: x-ms-test-header="bar" + Expected request body: + ```json + { "name": "foo" } + ``` + """) + @route("/inner-model-parameter/{id}") + @post + op spreadParameterWithInnerModel(...InnerModelParameter): NoContentResponse; + + alias RequestParameter = { + @path + id: string; + + @header + `x-ms-test-header`: string; + + name: string; + }; + + @scenario + @scenarioDoc(""" + Test case for spread alias with path and header parameter. + + Should not generate any model named `RequestParameter`. + Should generate an operation like below: + ``` + spreadAsRequestParameter(id: string, x_ms_test_header: string, name: string) + ``` + Note the parameter name may be normalized and vary by language. + + Expected path parameter: id="1" + Expected header parameter: x-ms-test-header="bar" + Expected request body: + ```json + { "name": "foo" } + ``` + """) + @route("/request-parameter/{id}") + @put + op spreadAsRequestParameter(...RequestParameter): NoContentResponse; + + alias MultipleRequestParameters = { + @path + id: string; + + @header + `x-ms-test-header`: string; + + /** required string */ + requiredString: string; + + /** optional int */ + optionalInt?: int32; + + /** required int */ + requiredIntList: int32[]; + + /** optional string */ + optionalStringList?: string[]; + }; + + @scenario + @scenarioDoc(""" + Test case for spread alias including 6 parameters. May handle as property bag for these parameters. + + Should not generate any model named `MultipleRequestParameters`. + Since it contains both optional properties and required properties, the method signature might vary across different languages. + Note it's also acceptable if some languages handle it as property bag. + + Expected path parameter: id="1" + Expected header parameter: x-ms-test-header="bar" + Expected request body: + ```json + { + "requiredString": "foo", + "optionalInt": 1, + "requiredIntList": [1, 2], + "optionalStringList": ["foo", "bar"] + } + ``` + """) + @route("/multiple-parameters/{id}") + @put + op spreadWithMultipleParameters(...MultipleRequestParameters): NoContentResponse; + + alias InnerAlias = { + @doc("name of the Thing") + name: string; + + @doc("age of the Thing") + age: int32; + }; + + alias InnerAliasParameter = { + @path id: string; + ...InnerAlias; + + @header + `x-ms-test-header`: string; + }; + + @scenario + @scenarioDoc(""" + Test case for spread alias with contains another alias property as body. + + Should not generate any model named `InnerAlias` and `InnerAliasParameter`. + Should generate an operation like below: + ``` + spreadParameterWithInnerAlias(id: string, name: string, age: int32, x_ms_test_header: string) + ``` + Note the parameter name is guessed from the model name and it may vary by language. + Expected path parameter: id="1" + Expected header parameter: x-ms-test-header="bar" + Expected request body: + ```json + { + "name": "foo", + "age": 1 + } + ``` + """) + @route("/inner-alias-parameter") + @doc("spread an alias with contains another alias property as body.") + @post + op spreadParameterWithInnerAlias(...InnerAliasParameter): NoContentResponse; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/mockapi.ts new file mode 100644 index 00000000000..6e223f720bb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/mockapi.ts @@ -0,0 +1,165 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Parameters_Spread_Model_spreadAsRequestBody = passOnSuccess({ + uri: `/parameters/spread/model/request-body`, + method: "put", + request: { + body: json({ + name: "foo", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_Spread_Model_spreadCompositeRequestOnlyWithBody = passOnSuccess({ + uri: `/parameters/spread/model/composite-request-only-with-body`, + method: "put", + request: { + body: json({ + name: "foo", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_Spread_Model_spreadCompositeRequestWithoutBody = passOnSuccess({ + uri: `/parameters/spread/model/composite-request-without-body/foo`, + method: "put", + request: { + headers: { + "test-header": "bar", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_Spread_Model_spreadCompositeRequest = passOnSuccess({ + uri: `/parameters/spread/model/composite-request/foo`, + method: "put", + request: { + body: json({ + name: "foo", + }), + headers: { + "test-header": "bar", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_Spread_Model_spreadCompositeRequestMix = passOnSuccess({ + uri: `/parameters/spread/model/composite-request-mix/foo`, + method: "put", + request: { + body: json({ + prop: "foo", + }), + headers: { + "test-header": "bar", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_Spread_Alias_spreadAsRequestBody = passOnSuccess({ + uri: `/parameters/spread/alias/request-body`, + method: "put", + request: { + body: json({ + name: "foo", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_Spread_Alias_spreadAsRequestParameter = passOnSuccess({ + uri: `/parameters/spread/alias/request-parameter/1`, + method: "put", + request: { + body: json({ + name: "foo", + }), + headers: { + "x-ms-test-header": "bar", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_Spread_Alias_spreadWithMultipleParameters = passOnSuccess({ + uri: `/parameters/spread/alias/multiple-parameters/1`, + method: "put", + request: { + body: json({ + requiredString: "foo", + optionalInt: 1, + requiredIntList: [1, 2], + optionalStringList: ["foo", "bar"], + }), + headers: { + "x-ms-test-header": "bar", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_Spread_Alias_spreadParameterWithInnerModel = passOnSuccess({ + uri: `/parameters/spread/alias/inner-model-parameter/1`, + method: "post", + request: { + body: json({ + name: "foo", + }), + headers: { + "x-ms-test-header": "bar", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Parameters_Spread_Alias_spreadParameterWithInnerAlias = passOnSuccess({ + uri: `/parameters/spread/alias/inner-alias-parameter/1`, + method: "post", + request: { + body: json({ + name: "foo", + age: 1, + }), + headers: { + "x-ms-test-header": "bar", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/main.tsp new file mode 100644 index 00000000000..7dc2ad3c3c8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/main.tsp @@ -0,0 +1,61 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test describing optionality of the request body.") +@scenarioService("/content-negotiation") +namespace Payload.ContentNegotiation; + +@scenario +@scenarioDoc(""" + Scenario that returns a different file encoding depending on the accept header. + + - image/png return a png image + - image/jpeg return a jpeg image + """) +@route("same-body") +namespace SameBody { + model PngImage { + @header contentType: "image/png"; + @body image: bytes; + } + + model JpegImage { + @header contentType: "image/jpeg"; + @body image: bytes; + } + + @sharedRoute + op getAvatarAsPng(@header accept: "image/png"): PngImage; + + @sharedRoute + op getAvatarAsJpeg(@header accept: "image/jpeg"): JpegImage; +} + +@scenario +@scenarioDoc(""" + Scenario that a different payload depending on the accept header. + + - application/json return a png image in a Json object + - image/png return the png image + """) +@route("different-body") +namespace DifferentBody { + model PngImage { + @header contentType: "image/png"; + @body image: bytes; + } + + model PngImageAsJson { + @header contentType: "application/json"; + content: bytes; + } + + @sharedRoute + op getAvatarAsPng(@header accept: "image/png"): PngImage; + + @sharedRoute + op getAvatarAsJson(@header accept: "application/json"): PngImageAsJson; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/mockapi.ts new file mode 100644 index 00000000000..355a82eaaad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/mockapi.ts @@ -0,0 +1,188 @@ +import { + json, + MockRequest, + ScenarioMockApi, + ValidationError, + withServiceKeys, +} from "@typespec/spec-api"; +import { jpgFile, pngFile } from "../../helper.js"; + +export const Scenarios: Record = {}; + +function sameBodyHandler(req: MockRequest) { + switch (req.headers["accept"]) { + case "image/png": + return { + pass: "image/png", + status: 200, + body: { + contentType: "image/png", + rawContent: pngFile, + }, + } as const; + case "image/jpeg": + return { + pass: "image/jpeg", + + status: 200, + body: { + contentType: "image/jpeg", + rawContent: jpgFile, + }, + } as const; + default: + throw new ValidationError( + "Unsupported Accept header", + `"image/png" | "image/jpeg"`, + req.headers["accept"], + ); + } +} + +function differentBodyHandler(req: MockRequest) { + switch (req.headers["accept"]) { + case "image/png": + return { + pass: "image/png", + status: 200, + body: { + contentType: "image/png", + rawContent: pngFile, + }, + } as const; + case "application/json": + return { + pass: "application/json", + status: 200, + body: json({ + content: pngFile.toString("base64"), + }), + } as const; + default: + throw new ValidationError( + "Unsupported Accept header", + `"image/png" | "application/json"`, + req.headers["accept"], + ); + } +} + +Scenarios.Payload_ContentNegotiation_SameBody = withServiceKeys(["image/png", "image/jpeg"]).pass([ + { + uri: "/content-negotiation/same-body", + method: "get", + request: { + headers: { + accept: "image/png", + }, + }, + response: { + body: { + contentType: "image/png", + rawContent: pngFile, + }, + status: 200, + }, + handler: (req) => sameBodyHandler(req), + kind: "MockApiDefinition", + }, + { + uri: "/content-negotiation/same-body", + method: "get", + request: { + headers: { + accept: "image/jpeg", + }, + }, + response: { + body: { + contentType: "image/jpeg", + rawContent: jpgFile, + }, + status: 200, + }, + handler: (req) => sameBodyHandler(req), + kind: "MockApiDefinition", + }, + { + uri: "/content-negotiation/same-body", + method: "get", + request: { + status: 400, + headers: { + accept: "wrongAccept", + }, + }, + response: { + status: 400, + body: json({ + message: "Unsupported Accept header", + expected: `"image/png" | "image/jpeg"`, + actual: "wrongAccept", + }), + }, + handler: sameBodyHandler, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Payload_ContentNegotiation_DifferentBody = withServiceKeys([ + "image/png", + "application/json", +]).pass([ + { + uri: "/content-negotiation/different-body", + method: "get", + request: { + headers: { + accept: "image/png", + }, + }, + response: { + status: 200, + body: { + contentType: "image/png", + rawContent: pngFile, + }, + }, + handler: differentBodyHandler, + kind: "MockApiDefinition", + }, + { + uri: "/content-negotiation/different-body", + method: "get", + request: { + headers: { + accept: "application/json", + }, + }, + response: { + status: 200, + body: json({ + content: pngFile.toString("base64"), + }), + }, + handler: differentBodyHandler, + kind: "MockApiDefinition", + }, + { + uri: "/content-negotiation/different-body", + method: "get", + request: { + status: 400, + headers: { + accept: "wrongAccept", + }, + }, + response: { + status: 400, + body: json({ + message: "Unsupported Accept header", + expected: `"image/png" | "application/json"`, + actual: "wrongAccept", + }), + }, + handler: differentBodyHandler, + kind: "MockApiDefinition", + }, +]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/main.tsp new file mode 100644 index 00000000000..cb2ae6bc02a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/main.tsp @@ -0,0 +1,184 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test for merge-patch+json content-type") +@scenarioService("/json-merge-patch") +namespace Payload.JsonMergePatch; + +@doc("Details about a resource.") +model Resource { + name: string; + description?: string; + map?: Record; + array?: InnerModel[]; + intValue?: int32; + floatValue?: float32; + innerModel?: InnerModel; + intArray?: int32[]; +} + +@doc("Details about a resource for patch operation.") +model ResourcePatch { + description?: string; + map?: Record; + array?: InnerModel[]; + intValue?: int32; + floatValue?: float32; + innerModel?: InnerModel; + intArray?: int32[]; +} + +@doc("It is the model used by Resource model") +model InnerModel { + name?: string; + description?: string; +} + +@scenario +@scenarioDoc(""" + + Expected input body: + ```json + { + "name": "Madge", + "description": "desc", + "map": { + "key": { + "name": "InnerMadge", + "description": "innerDesc" + } + }, + "array": [ + { + "name": "InnerMadge", + "description": "innerDesc" + } + ], + "intValue": 1, + "floatValue": 1.25, + "innerModel": { + "name": "InnerMadge", + "description": "innerDesc" + }, + "intArray": [1, 2, 3] + } + ``` + + Expected response body: + ```json + { + "name": "Madge", + "description": "desc", + "map": { + "key": { + "name": "InnerMadge", + "description": "innerDesc" + } + }, + "array": [ + { + "name": "InnerMadge", + "description": "innerDesc" + } + ], + "intValue": 1, + "floatValue": 1.25, + "innerModel": { + "name": "InnerMadge", + "description": "innerDesc" + }, + "intArray": [1, 2, 3] + } + ``` + """) +@doc("Test content-type: application/merge-patch+json with required body") +@route("/create/resource") +@put +op createResource(@body body: Resource): Resource; + +@scenario +@scenarioDoc(""" + Should serialize null values with merge-patch+json enabled. + + Expected input body: + ```json + { + "description": null, + "map": { + "key": { + "description": null + }, + "key2": null + }, + "array": null, + "intValue": null, + "floatValue": null, + "innerModel": null, + "intArray": null + } + ``` + + Expected response body: + ```json + { + name: "Madge", + map: { + key: { + name: "InnerMadge" + } + } + } + ``` + """) +@doc("Test content-type: application/merge-patch+json with required body") +@route("/update/resource") +@patch +op updateResource( + @header("content-type") contentType: "application/merge-patch+json", + @body body: ResourcePatch, +): Resource; + +@scenario +@scenarioDoc(""" + Should serialize null values with merge-patch+json enabled. + + Expected input body: + ```json + { + "description": null, + "map": { + "key": { + "description": null + }, + "key2": null + }, + "array": null, + "intValue": null, + "floatValue": null, + "innerModel": null, + "intArray": null + } + ``` + + Expected response body: + ```json + { + name: "Madge", + map: { + key: { + name: "InnerMadge" + } + } + } + ``` + """) +@doc("Test content-type: application/merge-patch+json with optional body") +@route("/update/resource/optional") +@patch +op updateOptionalResource( + @header("content-type") contentType: "application/merge-patch+json", + @body body?: ResourcePatch, +): Resource; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/mockapi.ts new file mode 100644 index 00000000000..0f1412a1b75 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/mockapi.ts @@ -0,0 +1,95 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +export const expectedCreateBody = { + name: "Madge", + description: "desc", + map: { + key: { + name: "InnerMadge", + description: "innerDesc", + }, + }, + array: [ + { + name: "InnerMadge", + description: "innerDesc", + }, + ], + intValue: 1, + floatValue: 1.25, + innerModel: { + name: "InnerMadge", + description: "innerDesc", + }, + intArray: [1, 2, 3], +}; + +export const expectedUpdateBody = { + description: null, + map: { + key: { + description: null, + }, + key2: null, + }, + array: null, + intValue: null, + floatValue: null, + innerModel: null, + intArray: null, +}; + +Scenarios.Payload_JsonMergePatch_createResource = passOnSuccess({ + uri: "/json-merge-patch/create/resource", + method: "put", + request: { + body: json(expectedCreateBody), + }, + response: { + status: 200, + body: json(expectedCreateBody), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Payload_JsonMergePatch_updateResource = passOnSuccess({ + uri: "/json-merge-patch/update/resource", + method: "patch", + request: { + body: json(expectedUpdateBody), + }, + response: { + status: 200, + body: json({ + name: "Madge", + map: { + key: { + name: "InnerMadge", + }, + }, + }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Payload_JsonMergePatch_updateOptionalResource = passOnSuccess({ + uri: "/json-merge-patch/update/resource/optional", + method: "patch", + request: { + body: json(expectedUpdateBody), + }, + response: { + status: 200, + body: json({ + name: "Madge", + map: { + key: { + name: "InnerMadge", + }, + }, + }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/main.tsp new file mode 100644 index 00000000000..3ced443cbbc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/main.tsp @@ -0,0 +1,52 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +/** + * Test the payload with different media types and different types of the payload itself. + */ +@scenarioService("/payload/media-type") +namespace Payload.MediaType; + +@route("/string-body") +namespace StringBody { + @scenario + @scenarioDoc(""" + Expected request body is a string '{cat}'. + """) + @post + @route("/sendAsText") + op sendAsText(@header contentType: "text/plain", @body text: string): OkResponse; + + @scenario + @scenarioDoc(""" + Expected response body is a string '{cat}'. + """) + @get + @route("/getAsText") + op getAsText(): { + @header contentType: "text/plain"; + @body text: string; + }; + + @scenario + @scenarioDoc(""" + Expected request body is "foo". + """) + @post + @route("/sendAsJson") + op sendAsJson(@header contentType: "application/json", @body text: string): OkResponse; + + @scenario + @scenarioDoc(""" + Expected response body is "foo". + """) + @get + @route("/getAsJson") + op getAsJson(): { + @header contentType: "application/json"; + @body text: string; + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/mockapi.ts new file mode 100644 index 00000000000..159931f4dd9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/mockapi.ts @@ -0,0 +1,63 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Payload_MediaType_StringBody_sendAsText = passOnSuccess({ + uri: "/payload/media-type/string-body/sendAsText", + method: "post", + request: { + body: json("{cat}"), + headers: { + "Content-Type": "text/plain", + }, + }, + response: { + status: 200, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Payload_MediaType_StringBody_getAsText = passOnSuccess({ + uri: "/payload/media-type/string-body/getAsText", + method: "get", + request: { + headers: { + accept: "text/plain", + }, + }, + response: { + status: 200, + body: { rawContent: "{cat}", contentType: "text/plain" }, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Payload_MediaType_StringBody_sendAsJson = passOnSuccess({ + uri: "/payload/media-type/string-body/sendAsJson", + method: "post", + request: { + body: json("foo"), + headers: { + "Content-Type": "application/json", + }, + }, + response: { + status: 200, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Payload_MediaType_StringBody_getAsJson = passOnSuccess({ + uri: "/payload/media-type/string-body/getAsJson", + method: "get", + request: { + headers: { + accept: "application/json", + }, + }, + response: { + status: 200, + body: json("foo"), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/main.tsp new file mode 100644 index 00000000000..618f0ba18b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/main.tsp @@ -0,0 +1,502 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Test for multipart") +@scenarioService("/multipart") +namespace Payload.MultiPart; + +model MultiPartRequest { + id: HttpPart; + profileImage: HttpPart; +} + +model Address { + city: string; +} + +model FileSpecificContentType extends File { + filename: string; + contentType: "image/jpg"; +} + +model FileWithHttpPartSpecificContentTypeRequest { + profileImage: HttpPart; +} + +model FileRequiredMetaData extends File { + filename: string; + contentType: string; +} + +model FileWithHttpPartRequiredContentTypeRequest { + profileImage: HttpPart; +} + +model FileOptionalContentType extends File { + filename: string; +} + +model FileWithHttpPartOptionalContentTypeRequest { + profileImage: HttpPart; +} + +model ComplexHttpPartsModelRequest { + id: HttpPart; + address: HttpPart
; + profileImage: HttpPart; + previousAddresses: HttpPart; + pictures: HttpPart[]; +} + +model ComplexPartsRequest { + id: HttpPart; + address: HttpPart
; + profileImage: HttpPart; + pictures: HttpPart[]; +} + +model JsonPartRequest { + address: HttpPart
; + profileImage: HttpPart; +} + +model BinaryArrayPartsRequest { + id: HttpPart; + pictures: HttpPart[]; +} + +model MultiBinaryPartsRequest { + profileImage: HttpPart; + picture?: HttpPart; +} + +@route("/form-data") +namespace FormData { + @scenario + @scenarioDoc(""" + Expect request ( + - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.4, content-type of file part shall be labeled with + appropriate media type, server will check it; content-type of other parts is optional, server will ignore it. + - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.2, filename of file part SHOULD be supplied. + If there are duplicated filename in same fieldName, server can't parse them all. + ): + ``` + POST /upload HTTP/1.1 + Content-Length: 428 + Content-Type: multipart/form-data; boundary=abcde12345 + + --abcde12345 + Content-Disposition: form-data; name="id" + Content-Type: text/plain + + 123 + --abcde12345 + Content-Disposition: form-data; name="profileImage"; filename="" + Content-Type: application/octet-stream; + + {…file content of .jpg file…} + --abcde12345-- + ``` + """) + @doc("Test content-type: multipart/form-data") + @post + @route("/mixed-parts") + op basic( + @header contentType: "multipart/form-data", + @multipartBody body: MultiPartRequest, + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + Expect request ( + - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.4, content-type of file part shall be labeled with + appropriate media type, server will check it; content-type of other parts is optional, server will ignore it. + - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.2, filename of file part SHOULD be supplied. + If there are duplicated filename in same fieldName, server can't parse them all. + ): + ``` + POST /upload HTTP/1.1 + Content-Length: 428 + Content-Type: multipart/form-data; boundary=abcde12345 + + --abcde12345 + Content-Disposition: form-data; name="id" + Content-Type: text/plain + + 123 + --abcde12345 + Content-Disposition: form-data; name="address" + Content-Type: application/json + + { + "city": "X" + } + --abcde12345 + Content-Disposition: form-data; name="profileImage"; filename="" + Content-Type: application/octet-stream + + {…file content of .jpg file…} + --abcde12345-- + Content-Disposition: form-data; name="previousAddresses" + Content-Type: application/json + + [{ + "city": "Y" + },{ + "city": "Z" + }] + --abcde12345 + Content-Disposition: form-data; name="pictures"; filename="" + Content-Type: application/octet-stream + + {…file content of .png file…} + --abcde12345 + Content-Disposition: form-data; name="pictures"; filename="" + Content-Type: application/octet-stream + + {…file content of .png file…} + --abcde12345-- + ``` + """) + @doc("Test content-type: multipart/form-data for mixed scenarios") + @post + @route("/complex-parts") + op fileArrayAndBasic( + @header contentType: "multipart/form-data", + @multipartBody body: ComplexPartsRequest, + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + Expect request ( + - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.4, content-type of file part shall be labeled with + appropriate media type, server will check it; content-type of other parts is optional, server will ignore it. + - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.2, filename of file part SHOULD be supplied. + If there are duplicated filename in same fieldName, server can't parse them all. + ): + ``` + POST /upload HTTP/1.1 + Content-Length: 428 + Content-Type: multipart/form-data; boundary=abcde12345 + + --abcde12345 + Content-Disposition: form-data; name="address" + Content-Type: application/json + + { + "city": "X" + } + --abcde12345 + Content-Disposition: form-data; name="profileImage"; filename="" + Content-Type: application/octet-stream + + {…file content of .jpg file…} + --abcde12345-- + ``` + """) + @doc("Test content-type: multipart/form-data for scenario contains json part and binary part ") + @post + @route("/json-part") + op jsonPart( + @header contentType: "multipart/form-data", + @multipartBody body: JsonPartRequest, + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + Expect request ( + - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.4, content-type of file part shall be labeled with + appropriate media type, server will check it; content-type of other parts is optional, server will ignore it. + - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.2, filename of file part SHOULD be supplied. + If there are duplicated filename in same fieldName, server can't parse them all. + ): + ``` + POST /upload HTTP/1.1 + Content-Length: 428 + Content-Type: multipart/form-data; boundary=abcde12345 + + --abcde12345 + Content-Disposition: form-data; name="id" + Content-Type: text/plain + + 123 + --abcde12345 + Content-Disposition: form-data; name="pictures"; filename="" + Content-Type: application/octet-stream + + {…file content of .png file…} + --abcde12345 + Content-Disposition: form-data; name="pictures"; filename="" + Content-Type: application/octet-stream + + {…file content of .png file…} + --abcde12345-- + ``` + """) + @doc("Test content-type: multipart/form-data for scenario contains multi binary parts") + @post + @route("/binary-array-parts") + op binaryArrayParts( + @header contentType: "multipart/form-data", + @multipartBody body: BinaryArrayPartsRequest, + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + Please send request twice, first time with only profileImage, second time with both profileImage and picture( + - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.4, content-type of file part shall be labeled with + appropriate media type, server will check it; content-type of other parts is optional, server will ignore it. + - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.2, filename of file part SHOULD be supplied. + If there are duplicated filename in same fieldName, server can't parse them all. + ): + ``` + POST /upload HTTP/1.1 + Content-Length: 428 + Content-Type: multipart/form-data; boundary=abcde12345 + + --abcde12345 + Content-Disposition: form-data; name="profileImage"; filename="" + Content-Type: application/octet-stream + + {…file content of .jpg file…} + --abcde12345 + Content-Disposition: form-data; name="picture"; filename="" + Content-Type: application/octet-stream + + {…file content of .png file…} + --abcde12345-- + ``` + """) + @doc("Test content-type: multipart/form-data for scenario contains multi binary parts") + @post + @route("/multi-binary-parts") + op multiBinaryParts( + @header contentType: "multipart/form-data", + @multipartBody body: MultiBinaryPartsRequest, + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + this case will check filename and content-type of file part, so expect request: + ``` + POST /upload HTTP/1.1 + Content-Length: 428 + Content-Type: multipart/form-data; boundary=abcde12345 + + --abcde12345 + Content-Disposition: form-data; name="id" + Content-Type: text/plain + + 123 + --abcde12345 + Content-Disposition: form-data; name="profileImage"; filename="hello.jpg" + Content-Type: image/jpg + + {…file content of .jpg file…} + --abcde12345-- + ``` + """) + @doc("Test content-type: multipart/form-data") + @post + @route("/check-filename-and-content-type") + op checkFileNameAndContentType( + @header contentType: "multipart/form-data", + @multipartBody body: MultiPartRequest, + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + Expect request ( + - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.4, content-type of file part shall be labeled with + appropriate media type, server will check it; content-type of other parts is optional, server will ignore it. + - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.2, filename of file part SHOULD be supplied. + If there are duplicated filename in same filedName, server can't parse them all. + ): + ``` + POST /multipart/form-data/anonymous-model HTTP/1.1 + Content-Length: 428 + Content-Type: multipart/form-data; boundary=abcde12345 + + --abcde12345 + Content-Disposition: form-data; name="profileImage"; filename="" + Content-Type: application/octet-stream; + + {…file content of .jpg file…} + --abcde12345-- + ``` + """) + @doc("Test content-type: multipart/form-data") + @post + @route("/anonymous-model") + op anonymousModel( + @header contentType: "multipart/form-data", + @multipartBody body: { + profileImage: HttpPart; + }, + ): NoContentResponse; + + namespace HttpParts { + namespace ContentType { + @scenario + @scenarioDoc(""" + This case will check filename and specific content-type of file part, so expect request: + ``` + POST /upload HTTP/1.1 + Content-Length: 428 + Content-Type: multipart/form-data; boundary=abcde12345 + + --abcde12345 + Content-Disposition: form-data; name="profileImage"; filename="hello.jpg" + Content-Type: image/jpg + + {…file content of .jpg file…} + --abcde12345-- + ``` + """) + @doc("Test content-type: multipart/form-data") + @post + @route("/check-filename-and-specific-content-type-with-httppart") + op imageJpegContentType( + @header contentType: "multipart/form-data", + @multipartBody body: FileWithHttpPartSpecificContentTypeRequest, + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + This case will check required content-type of file part, so expect request: + ``` + POST /upload HTTP/1.1 + Content-Length: 428 + Content-Type: multipart/form-data; boundary=abcde12345 + + --abcde12345 + Content-Disposition: form-data; name="profileImage"; filename="" + Content-Type: application/octet-stream + + {…file content of .jpg file…} + --abcde12345-- + ``` + """) + @doc("Test content-type: multipart/form-data") + @post + @route("/check-filename-and-required-content-type-with-httppart") + op requiredContentType( + @header contentType: "multipart/form-data", + @multipartBody body: FileWithHttpPartRequiredContentTypeRequest, + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + Please send request twice, first time with no content-type and second time with content-type "application/octet-stream". Expect request: + ``` + POST /upload HTTP/1.1 + Content-Length: 428 + Content-Type: multipart/form-data; boundary=abcde12345 + + --abcde12345 + Content-Disposition: form-data; name="profileImage"; filename="" + Content-Type: application/octet-stream + + {…file content of .jpg file…} + --abcde12345 + ``` + """) + @doc("Test content-type: multipart/form-data for optional content type") + @post + @route("/file-with-http-part-optional-content-type") + op optionalContentType( + @header contentType: "multipart/form-data", + @multipartBody body: FileWithHttpPartOptionalContentTypeRequest, + ): NoContentResponse; + } + @scenario + @scenarioDoc(""" + For File part, filename will not be checked but it is necessary otherwise server can't parse it; + content-type will be checked with value "application/octet-stream". Expect request: + ``` + POST /upload HTTP/1.1 + Content-Length: 428 + Content-Type: multipart/form-data; boundary=abcde12345 + + --abcde12345 + Content-Disposition: form-data; name="id" + Content-Type: text/plain + + 123 + --abcde12345 + Content-Disposition: form-data; name="address" + Content-Type: application/json + + { + "city": "X" + } + --abcde12345 + Content-Disposition: form-data; name="profileImage"; filename="" + Content-Type: application/octet-stream + + {…file content of .jpg file…} + --abcde12345-- + Content-Disposition: form-data; name="previousAddresses" + Content-Type: application/json + + [{ + "city": "Y" + },{ + "city": "Z" + }] + --abcde12345 + Content-Disposition: form-data; name="pictures"; filename="" + Content-Type: application/octet-stream + + {…file content of .png file…} + --abcde12345 + Content-Disposition: form-data; name="pictures"; filename="" + Content-Type: application/octet-stream + + {…file content of .png file…} + --abcde12345-- + ``` + """) + @doc("Test content-type: multipart/form-data for mixed scenarios") + @post + @route("/complex-parts-with-httppart") + op jsonArrayAndFileArray( + @header contentType: "multipart/form-data", + @multipartBody body: ComplexHttpPartsModelRequest, + ): NoContentResponse; + + namespace NonString { + @scenario + @scenarioDoc(""" + Expect request: + ``` + POST /upload HTTP/1.1 + Content-Length: 428 + Content-Type: multipart/form-data; boundary=abcde12345 + + --abcde12345 + Content-Disposition: form-data; name="temperature" + Content-Type: text/plain + + 0.5 + --abcde12345 + ``` + """) + @doc("Test content-type: multipart/form-data for non string") + @post + @route("/non-string-float") + op float( + @header contentType: "multipart/form-data", + @multipartBody body: { + temperature: HttpPart<{ + @body body: float64; + @header contentType: "text/plain"; + }>; + }, + ): NoContentResponse; + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/mockapi.ts new file mode 100644 index 00000000000..0c78709535a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/mockapi.ts @@ -0,0 +1,347 @@ +import { + MockRequest, + multipart, + passOnSuccess, + ScenarioMockApi, + ValidationError, + withServiceKeys, +} from "@typespec/spec-api"; +import { jpgFile, pngFile } from "../../helper.js"; + +export const Scenarios: Record = {}; + +function checkId(req: MockRequest) { + req.expect.deepEqual(req.body.id, "123"); +} + +function checkAddress(req: MockRequest) { + req.expect.deepEqual(JSON.parse(req.body.address), { city: "X" }); +} + +function checkPreviousAddresses(req: MockRequest) { + req.expect.deepEqual(JSON.parse(req.body.previousAddresses), [{ city: "Y" }, { city: "Z" }]); +} + +function checkFile( + req: MockRequest, + file: Record, + expected: Buffer, + contentType: string = "application/octet-stream", + fileName: string | undefined = undefined, + mustCheckContentType: boolean = true, +) { + // server depends on multer, which sets the mimetype to "text/plain" if this part has no content-type header + if (mustCheckContentType || file.mimetype !== "text/plain") { + req.expect.deepEqual(file.mimetype, contentType); + } + req.expect.deepEqual(file.buffer, expected); + if (fileName) { + req.expect.deepEqual(file.originalname, fileName); + } +} + +function checkJpgFile( + req: MockRequest, + file: Record, + contentType: string = "application/octet-stream", + fileName: string | undefined = undefined, + mustCheckContentType: boolean = true, +) { + req.expect.deepEqual(file.fieldname, "profileImage"); + checkFile(req, file, jpgFile, contentType, fileName, mustCheckContentType); +} + +function checkOptionalContentType(req: MockRequest) { + if (req.files instanceof Array && req.files?.length > 0) { + checkJpgFile(req, req.files[0], "application/octet-stream", undefined, false); + } else { + throw new ValidationError("No profileImage found", "jpg file is expected", req.body); + } +} + +function checkPngFile(req: MockRequest, file: Record, fieldName: string = "pictures") { + req.expect.deepEqual(file.fieldname, fieldName); + checkFile(req, file, pngFile); +} + +function checkProfileImage(req: MockRequest) { + if (req.files instanceof Array && req.files?.length > 0) { + checkJpgFile(req, req.files[0]); + } else { + throw new ValidationError("No profileImage found", "jpg file is expected", req.body); + } +} + +function checkFileNameAndContentType(req: MockRequest) { + if (req.files instanceof Array && req.files?.length > 0) { + checkJpgFile(req, req.files[0], "image/jpg", "hello.jpg"); + } else { + throw new ValidationError("No profileImage found", "jpg file is expected", req.body); + } +} + +function checkAllFiles(req: MockRequest) { + if (req.files instanceof Array && req.files?.length === 3) { + for (const file of req.files) { + if (file.fieldname === "profileImage") { + checkJpgFile(req, file); + } else if (file.fieldname === "pictures") { + checkPngFile(req, file); + } else { + throw new ValidationError( + "unexpected fieldname", + "profileImage or pictures", + file.fieldname, + ); + } + } + } else { + throw new ValidationError( + "Can't parse files from request", + "jpg/png files are expected", + req.body, + ); + } +} +function checkPictures(req: MockRequest) { + if (req.files instanceof Array && req.files?.length === 2) { + for (const file of req.files) { + checkPngFile(req, file); + } + } else { + throw new ValidationError("No pictures found", "png files are expected", req.body); + } +} +function checkFloat(req: MockRequest) { + req.expect.deepEqual(parseFloat(req.body.temperature), 0.5); +} +const files = [ + { + fieldname: "profileImage", + originalname: "image.jpg", + buffer: jpgFile, + mimetype: "application/octet-stream", + }, + { + fieldname: "pictures", + originalname: "image.png", + buffer: pngFile, + mimetype: "application/octet-stream", + }, +]; +function createHandler(req: MockRequest, checkList: ((req: MockRequest) => void)[]) { + for (const callback of checkList) { + callback(req); + } + return { status: 204 }; +} + +function createMultiBinaryPartsHandler(req: MockRequest) { + if (req.files instanceof Array) { + switch (req.files.length) { + case 1: + checkJpgFile(req, req.files[0]); + return { pass: "profileImage", status: 204 } as const; + case 2: + let profileImage = false; + let picture = false; + for (const file of req.files) { + if (file.fieldname === "profileImage") { + checkJpgFile(req, file); + profileImage = true; + } else if (file.fieldname === "picture") { + checkPngFile(req, file, "picture"); + picture = true; + } else { + throw new ValidationError( + "unexpected fieldname", + "profileImage or picture", + file.fieldname, + ); + } + } + if (!profileImage) { + throw new ValidationError("No profileImage found", "jpg file is expected", req.body); + } else if (!picture) { + throw new ValidationError("No picture found", "png file are expected", req.body); + } + return { pass: "profileImage,picture", status: 204 } as const; + default: + throw new ValidationError( + "number of files is incorrect", + "1 or 2 files are expected", + req.body, + ); + } + } else { + throw new ValidationError( + "Can't parse files from request", + "jpg/png files are expected", + req.body, + ); + } +} + +Scenarios.Payload_MultiPart_FormData_basic = passOnSuccess({ + uri: "/multipart/form-data/mixed-parts", + method: "post", + request: { + body: multipart({ parts: { id: 123 }, files: [files[0]] }), + }, + response: { status: 204 }, + handler: (req: MockRequest) => createHandler(req, [checkId, checkProfileImage]), + kind: "MockApiDefinition", +}); +Scenarios.Payload_MultiPart_FormData_fileArrayAndBasic = passOnSuccess({ + uri: "/multipart/form-data/complex-parts", + method: "post", + request: { + body: multipart({ + parts: { id: 123, address: { city: "X" } }, + files: [files[0], files[1], files[1]], + }), + }, + response: { status: 204 }, + handler: (req: MockRequest) => createHandler(req, [checkId, checkAddress, checkAllFiles]), + kind: "MockApiDefinition", +}); +Scenarios.Payload_MultiPart_FormData_jsonPart = passOnSuccess({ + uri: "/multipart/form-data/json-part", + method: "post", + request: { + body: multipart({ parts: { address: { city: "X" } }, files: [files[0]] }), + }, + response: { status: 204 }, + handler: (req: MockRequest) => createHandler(req, [checkAddress, checkProfileImage]), + kind: "MockApiDefinition", +}); +Scenarios.Payload_MultiPart_FormData_binaryArrayParts = passOnSuccess({ + uri: "/multipart/form-data/binary-array-parts", + method: "post", + request: { + body: multipart({ parts: { id: 123 }, files: [files[1], files[1]] }), + }, + response: { status: 204 }, + handler: (req: MockRequest) => createHandler(req, [checkId, checkPictures]), + kind: "MockApiDefinition", +}); +Scenarios.Payload_MultiPart_FormData_multiBinaryParts = withServiceKeys([ + "profileImage", + "profileImage,picture", +]).pass([ + { + uri: "/multipart/form-data/multi-binary-parts", + method: "post", + request: { + body: multipart({ + files: [files[0]], + }), + }, + response: { status: 204 }, + handler: createMultiBinaryPartsHandler, + kind: "MockApiDefinition", + }, + { + uri: "/multipart/form-data/multi-binary-parts", + method: "post", + request: { + body: multipart({ + files: [files[0], { ...files[1], fieldname: "picture" }], + }), + }, + response: { status: 204 }, + handler: createMultiBinaryPartsHandler, + kind: "MockApiDefinition", + }, +]); +Scenarios.Payload_MultiPart_FormData_checkFileNameAndContentType = passOnSuccess({ + uri: "/multipart/form-data/check-filename-and-content-type", + method: "post", + request: { + body: multipart({ + parts: { id: 123 }, + files: [{ ...files[0], mimetype: "image/jpg", originalname: "hello.jpg" }], + }), + }, + response: { status: 204 }, + handler: (req: MockRequest) => createHandler(req, [checkId, checkFileNameAndContentType]), + kind: "MockApiDefinition", +}); +Scenarios.Payload_MultiPart_FormData_anonymousModel = passOnSuccess({ + uri: "/multipart/form-data/anonymous-model", + method: "post", + request: { + body: multipart({ + files: [files[0]], + }), + }, + response: { status: 204 }, + handler: (req: MockRequest) => createHandler(req, [checkProfileImage]), + kind: "MockApiDefinition", +}); +Scenarios.Payload_MultiPart_FormData_HttpParts_ContentType_imageJpegContentType = passOnSuccess({ + uri: "/multipart/form-data/check-filename-and-specific-content-type-with-httppart", + method: "post", + request: { + body: multipart({ + files: [{ ...files[0], mimetype: "image/jpg", originalname: "hello.jpg" }], + }), + }, + response: { status: 204 }, + handler: (req: MockRequest) => createHandler(req, [checkFileNameAndContentType]), + kind: "MockApiDefinition", +}); +Scenarios.Payload_MultiPart_FormData_HttpParts_ContentType_requiredContentType = passOnSuccess({ + uri: "/multipart/form-data/check-filename-and-required-content-type-with-httppart", + method: "post", + request: { + body: multipart({ + files: [files[0]], + }), + }, + response: { status: 204 }, + handler: (req: MockRequest) => createHandler(req, [checkProfileImage]), + kind: "MockApiDefinition", +}); +Scenarios.Payload_MultiPart_FormData_HttpParts_ContentType_optionalContentType = passOnSuccess({ + uri: "/multipart/form-data/file-with-http-part-optional-content-type", + method: "post", + request: { + body: multipart({ + files: [files[0]], + }), + }, + response: { status: 204 }, + handler: (req: MockRequest) => createHandler(req, [checkOptionalContentType]), + kind: "MockApiDefinition", +}); +Scenarios.Payload_MultiPart_FormData_HttpParts_jsonArrayAndFileArray = passOnSuccess({ + uri: "/multipart/form-data/complex-parts-with-httppart", + method: "post", + request: { + body: multipart({ + parts: { + id: 123, + address: { city: "X" }, + previousAddresses: [{ city: "Y" }, { city: "Z" }], + }, + files: [files[0], files[1], files[1]], + }), + }, + response: { status: 204 }, + handler: (req: MockRequest) => + createHandler(req, [checkId, checkAddress, checkPreviousAddresses, checkAllFiles]), + kind: "MockApiDefinition", +}); +Scenarios.Payload_MultiPart_FormData_HttpParts_NonString_float = passOnSuccess({ + uri: "/multipart/form-data/non-string-float", + method: "post", + request: { + body: multipart({ + parts: { temperature: 0.5 }, + }), + }, + response: { status: 204 }, + handler: (req: MockRequest) => createHandler(req, [checkFloat]), + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/main.tsp new file mode 100644 index 00000000000..63f7d30e4ee --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/main.tsp @@ -0,0 +1,516 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +/** + * Test for pageable payload. + */ +@scenarioService("/payload/pageable") +namespace Payload.Pageable; + +model Pet { + id: string; + name: string; +} + +alias HeaderAndQuery = { + @header foo?: string; + @query bar?: string; +}; + +@route("/server-driven-pagination") +namespace ServerDrivenPagination { + @scenario + @scenarioDoc(""" + Test case for using link as pagination. + + Two requests need to be tested. + 1. Initial request: + Expected route: /payload/pageable/server-driven-pagination/link + Expected response body: + ```json + { "pets": [ + { "id": "1", "name": "dog" }, + { "id": "2", "name": "cat" } + ], + "next": "http://[host]:[port]/payload/pageable/server-driven-pagination/link/nextPage" + } + ``` + 2. Next page request: + Expected route: /payload/pageable/server-driven-pagination/link/nextPage + Expected response body: + ```json + { "pets": [ + { "id": "3", "name": "bird" }, + { "id": "4", "name": "fish" } + ] + } + ``` + """) + @route("/link") + @list + op link(): { + @pageItems + pets: Pet[]; + + @nextLink next?: url; + }; + + @scenario + @scenarioDoc(""" + Test case for using link as pagination with string nextLink. + + Two requests need to be tested. + 1. Initial request: + Expected route: /payload/pageable/server-driven-pagination/link-string + Expected response body: + ```json + { "pets": [ + { "id": "1", "name": "dog" }, + { "id": "2", "name": "cat" } + ], + "next": "http://[host]:[port]/payload/pageable/server-driven-pagination/link-string/nextPage" + } + ``` + 2. Next page request: + Expected route: /payload/pageable/server-driven-pagination/link-string/nextPage + Expected response body: + ```json + { "pets": [ + { "id": "3", "name": "bird" }, + { "id": "4", "name": "fish" } + ] + } + ``` + """) + @route("/link-string") + @list + op linkString(): { + @pageItems + pets: Pet[]; + + @nextLink next?: string; + }; + + @scenario + @scenarioDoc(""" + Test case for using link as pagination with nested structure. + + Two requests need to be tested. + 1. Initial request: + Expected route: /payload/pageable/server-driven-pagination/nested-link + Expected response body: + ```json + { "nestedItems": { + "pets": [ + { "id": "1", "name": "dog" }, + { "id": "2", "name": "cat" } + ] + }, + "nestedNext": { + "next": "http://[host]:[port]/payload/pageable/server-driven-pagination/nested-link/nextPage" + } + } + ``` + 2. Next page request: + Expected route: /payload/pageable/server-driven-pagination/nested-link/nextPage + Expected response body: + ```json + { "nestedItems": { + "pets": [ + { "id": "3", "name": "bird" }, + { "id": "4", "name": "fish" } + ] + } + } + ``` + """) + @route("/nested-link") + @list + op nestedLink(): { + nestedItems: { + @pageItems + pets: Pet[]; + }; + nestedNext: { + @nextLink next?: url; + }; + }; + + @route("/continuationtoken") + namespace ContinuationToken { + @scenario + @scenarioDoc(""" + Test case for using continuation token as pagination. Continuation token is passed in the request query and response body. + + Two requests need to be tested. + + 1. Initial request: + Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-body?bar=bar + + Expected request header: + foo=foo + + Expected response body: + ```json + { "pets": [ + { "id": "1", "name": "dog" }, + { "id": "2", "name": "cat" } + ], + "nextToken": "page2" + } + ``` + + 2. Next page request: + Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-body?bar=bar&token=page2 + + Expected request header: + foo=foo + + Expected response body: + ```json + { "pets": [ + { "id": "3", "name": "bird" }, + { "id": "4", "name": "fish" } + ] + } + ``` + """) + @route("/request-query-response-body") + @list + op requestQueryResponseBody(@continuationToken @query token?: string, ...HeaderAndQuery): { + @pageItems + pets: Pet[]; + + @continuationToken nextToken?: string; + }; + + @scenario + @scenarioDoc(""" + Test case for using continuation token as pagination. Continuation token is passed in the request header and response body. + + Two requests need to be tested. + + 1. Initial request: + Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-body?bar=bar + + Expected request header: + foo=foo + + Expected response body: + ```json + { "pets": [ + { "id": "1", "name": "dog" }, + { "id": "2", "name": "cat" } + ], + "nextToken": "page2" + } + ``` + + 2. Next page request: + Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-body?bar=bar + + Expected request header: + token=page2 + foo=foo + + Expected response body: + ```json + { "pets": [ + { "id": "3", "name": "bird" }, + { "id": "4", "name": "fish" } + ] + } + ``` + """) + @route("/request-header-response-body") + @list + op requestHeaderResponseBody(@continuationToken @header token?: string, ...HeaderAndQuery): { + @pageItems + pets: Pet[]; + + @continuationToken nextToken?: string; + }; + + @scenario + @scenarioDoc(""" + Test case for using continuation token as pagination. Continuation token is passed in the request query and response header. + + Two requests need to be tested. + + 1. Initial request: + Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-header?bar=bar + + Expected request header: + foo=foo + + Expected response body: + ```json + { "pets": [ + { "id": "1", "name": "dog" }, + { "id": "2", "name": "cat" } + ] + } + ``` + + Expected response header: + next-token=page2 + + 2. Next page request: + Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-header?bar=bar&token=page2 + + Expected request header: + foo=foo + + Expected response body: + ```json + { "pets": [ + { "id": "3", "name": "bird" }, + { "id": "4", "name": "fish" } + ] + } + ``` + """) + @route("/request-query-response-header") + @list + op requestQueryResponseHeader(@continuationToken @query token?: string, ...HeaderAndQuery): { + @pageItems + pets: Pet[]; + + @continuationToken @header nextToken?: string; + }; + + @scenario + @scenarioDoc(""" + Test case for using continuation token as pagination. Continuation token is passed in the request header and response header. + + Two requests need to be tested. + 1. Initial request: + Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-header?bar=bar + + Expected request header: + foo=foo + + Expected response body: + ```json + { "pets": [ + { "id": "1", "name": "dog" }, + { "id": "2", "name": "cat" } + ] + } + ``` + + Expected response header: + next-token=page2 + + 2. Next page request: + Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-header?bar=bar + + Expected request header: + token=page2 + foo=foo + + Expected response body: + ```json + { "pets": [ + { "id": "3", "name": "bird" }, + { "id": "4", "name": "fish" } + ] + } + ``` + """) + @route("/request-header-response-header") + @list + op requestHeaderResponseHeader(@continuationToken @header token?: string, ...HeaderAndQuery): { + @pageItems + pets: Pet[]; + + @continuationToken @header nextToken?: string; + }; + + @scenario + @scenarioDoc(""" + Test case for using continuation token as pagination with nested response structure. Continuation token is passed in the request query and nested within response body. + + Two requests need to be tested. + + 1. Initial request: + Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-nested-response-body?bar=bar + + Expected request header: + foo=foo + + Expected response body: + ```json + { "nestedItems": { + "pets": [ + { "id": "1", "name": "dog" }, + { "id": "2", "name": "cat" } + ] + }, + "nestedNext": { + "nextToken": "page2" + } + } + ``` + + 2. Next page request: + Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-nested-response-body?bar=bar&token=page2 + + Expected request header: + foo=foo + + Expected response body: + ```json + { "nestedItems": { + "pets": [ + { "id": "3", "name": "bird" }, + { "id": "4", "name": "fish" } + ] + } + } + ``` + """) + @route("/request-query-nested-response-body") + @list + op requestQueryNestedResponseBody( + @continuationToken @query token?: string, + ...HeaderAndQuery, + ): { + nestedItems: { + @pageItems + pets: Pet[]; + }; + nestedNext?: { + @continuationToken nextToken?: string; + }; + }; + + @scenario + @scenarioDoc(""" + Test case for using continuation token as pagination with nested response structure. Continuation token is passed in the request header and nested within response body. + + Two requests need to be tested. + + 1. Initial request: + Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-nested-response-body?bar=bar + + Expected request header: + foo=foo + + Expected response body: + ```json + { "nestedItems": { + "pets": [ + { "id": "1", "name": "dog" }, + { "id": "2", "name": "cat" } + ] + }, + "next": { + "nextToken": "page2" + } + } + ``` + + 2. Next page request: + Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-nested-response-body?bar=bar + + Expected request header: + token=page2 + foo=foo + + Expected response body: + ```json + { "nestedItems": { + "pets": [ + { "id": "3", "name": "bird" }, + { "id": "4", "name": "fish" } + ] + } + } + ``` + """) + @route("/request-header-nested-response-body") + @list + op requestHeaderNestedResponseBody( + @continuationToken @header token?: string, + ...HeaderAndQuery, + ): { + nestedItems: { + @pageItems + pets: Pet[]; + }; + nestedNext?: { + @continuationToken nextToken?: string; + }; + }; + } +} + +@route("/pagesize") +namespace PageSize { + @scenario + @scenarioDoc(""" + Test case for simple pagination without nextlink or continuationToken. + + Single request: + Expected route: /payload/pageable/pagesize/without-continuation + + Expected response body: + ```json + { "pets": [ + { "id": "1", "name": "dog" }, + { "id": "2", "name": "cat" }, + { "id": "3", "name": "bird" }, + { "id": "4", "name": "fish" } + ] + } + ``` + """) + @route("/without-continuation") + @list + op listWithoutContinuation(): { + @pageItems + pets: Pet[]; + }; + + @scenario + @scenarioDoc(""" + Test case for pagination with a regular @pageSize parameter. + + Two requests need to be tested: + 1. Request with pageSize=2: + Expected route: /payload/pageable/pagesize/list?pageSize=2 + + Expected response body: + ```json + { "pets": [ + { "id": "1", "name": "dog" }, + { "id": "2", "name": "cat" } + ] + } + ``` + + 2. Request with pageSize=4: + Expected route: /payload/pageable/pagesize/list?pageSize=4 + + Expected response body: + ```json + { "pets": [ + { "id": "1", "name": "dog" }, + { "id": "2", "name": "cat" }, + { "id": "3", "name": "bird" }, + { "id": "4", "name": "fish" } + ] + } + ``` + """) + @route("/list") + @list + op listWithPageSize(@pageSize @query pageSize?: int32): { + @pageItems + pets: Pet[]; + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/mockapi.ts new file mode 100644 index 00000000000..565bfde9ace --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/mockapi.ts @@ -0,0 +1,513 @@ +import { + dyn, + dynItem, + json, + MockRequest, + passOnSuccess, + ScenarioMockApi, + ValidationError, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const FirstPage = [ + { id: "1", name: "dog" }, + { id: "2", name: "cat" }, +]; + +const SecondPage = [ + { id: "3", name: "bird" }, + { id: "4", name: "fish" }, +]; + +const FirstResponseTokenInBody = { + status: 200, + body: json({ + pets: FirstPage, + nextToken: "page2", + }), +}; + +const SecondResponse = { + status: 200, + body: json({ + pets: SecondPage, + }), +}; + +const FirstResponseTokenInHeader = { + status: 200, + body: json({ + pets: FirstPage, + }), + headers: { + "next-token": "page2", + foo: "foo", + }, +}; + +const RequestTokenInQuery = { + query: { token: "page2", bar: "bar" }, + headers: { foo: "foo" }, +}; + +const RequestTokenInHeader = { headers: { token: "page2", foo: "foo" }, query: { bar: "bar" } }; + +function createTests(reqInfo: "query" | "header", resInfo: "body" | "header") { + const uri = `/payload/pageable/server-driven-pagination/continuationtoken/request-${reqInfo}-response-${resInfo}`; + function createHandler() { + return (req: MockRequest) => { + req.expect.containsHeader("foo", "foo"); + req.expect.containsQueryParam("bar", "bar"); + const token = reqInfo === "header" ? req.headers?.token : req.query?.token; + switch (token) { + case undefined: + return resInfo === "header" ? FirstResponseTokenInHeader : FirstResponseTokenInBody; + case "page2": + return SecondResponse; + default: + throw new ValidationError( + "Unsupported continuation token", + `"undefined" | "page2"`, + token, + ); + } + }; + } + + return passOnSuccess([ + { + uri: uri, + method: "get", + request: { headers: { foo: "foo" }, query: { bar: "bar" } }, + response: resInfo === "header" ? FirstResponseTokenInHeader : FirstResponseTokenInBody, + handler: createHandler(), + kind: "MockApiDefinition", + }, + { + uri: uri, + method: "get", + request: reqInfo === "header" ? RequestTokenInHeader : RequestTokenInQuery, + response: SecondResponse, + handler: createHandler(), + kind: "MockApiDefinition", + }, + ]); +} + +Scenarios.Payload_Pageable_ServerDrivenPagination_link = passOnSuccess([ + { + uri: "/payload/pageable/server-driven-pagination/link", + method: "get", + request: {}, + response: { + status: 200, + body: json({ + pets: FirstPage, + next: dyn`${dynItem("baseUrl")}/payload/pageable/server-driven-pagination/link/nextPage`, + }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/payload/pageable/server-driven-pagination/link/nextPage", + method: "get", + request: {}, + response: SecondResponse, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Payload_Pageable_ServerDrivenPagination_linkString = passOnSuccess([ + { + uri: "/payload/pageable/server-driven-pagination/link-string", + method: "get", + request: {}, + response: { + status: 200, + body: json({ + pets: FirstPage, + next: dyn`${dynItem("baseUrl")}/payload/pageable/server-driven-pagination/link-string/nextPage`, + }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/payload/pageable/server-driven-pagination/link-string/nextPage", + method: "get", + request: {}, + response: SecondResponse, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Payload_Pageable_ServerDrivenPagination_nestedLink = passOnSuccess([ + { + uri: "/payload/pageable/server-driven-pagination/nested-link", + method: "get", + request: {}, + response: { + status: 200, + body: json({ + nestedItems: { + pets: FirstPage, + }, + nestedNext: { + next: dyn`${dynItem("baseUrl")}/payload/pageable/server-driven-pagination/nested-link/nextPage`, + }, + }), + }, + kind: "MockApiDefinition", + }, + { + uri: "/payload/pageable/server-driven-pagination/nested-link/nextPage", + method: "get", + request: {}, + response: { + status: 200, + body: json({ + nestedItems: { + pets: SecondPage, + }, + }), + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestQueryResponseBody = + createTests("query", "body"); + +Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestHeaderResponseBody = + createTests("header", "body"); + +Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestQueryResponseHeader = + createTests("query", "header"); + +Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestHeaderResponseHeader = + createTests("header", "header"); + +Scenarios.Payload_Pageable_PageSize_listWithoutContinuation = passOnSuccess([ + { + uri: "/payload/pageable/pagesize/without-continuation", + method: "get", + request: {}, + response: { + status: 200, + body: json({ + pets: [ + { id: "1", name: "dog" }, + { id: "2", name: "cat" }, + { id: "3", name: "bird" }, + { id: "4", name: "fish" }, + ], + }), + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Payload_Pageable_PageSize_listWithPageSize = passOnSuccess([ + { + uri: "/payload/pageable/pagesize/list", + method: "get", + request: { query: { pageSize: "2" } }, + response: { + status: 200, + body: json({ + pets: [ + { id: "1", name: "dog" }, + { id: "2", name: "cat" }, + ], + }), + }, + handler: (req: MockRequest) => { + const pageSize = req.query?.pageSize; + + switch (pageSize) { + case "2": + return { + status: 200, + body: json({ + pets: [ + { id: "1", name: "dog" }, + { id: "2", name: "cat" }, + ], + }), + }; + case "4": + return { + status: 200, + body: json({ + pets: [ + { id: "1", name: "dog" }, + { id: "2", name: "cat" }, + { id: "3", name: "bird" }, + { id: "4", name: "fish" }, + ], + }), + }; + default: + throw new ValidationError("Unsupported page size", `"2" | "4"`, pageSize); + } + }, + kind: "MockApiDefinition", + }, + { + uri: "/payload/pageable/pagesize/list", + method: "get", + request: { query: { pageSize: "4" } }, + response: { + status: 200, + body: json({ + pets: [ + { id: "1", name: "dog" }, + { id: "2", name: "cat" }, + { id: "3", name: "bird" }, + { id: "4", name: "fish" }, + ], + }), + }, + handler: (req: MockRequest) => { + const pageSize = req.query?.pageSize; + + switch (pageSize) { + case "2": + return { + status: 200, + body: json({ + pets: [ + { id: "1", name: "dog" }, + { id: "2", name: "cat" }, + ], + }), + }; + case "4": + return { + status: 200, + body: json({ + pets: [ + { id: "1", name: "dog" }, + { id: "2", name: "cat" }, + { id: "3", name: "bird" }, + { id: "4", name: "fish" }, + ], + }), + }; + default: + throw new ValidationError("Unsupported page size", `"2" | "4"`, pageSize); + } + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestQueryNestedResponseBody = + passOnSuccess([ + { + uri: "/payload/pageable/server-driven-pagination/continuationtoken/request-query-nested-response-body", + method: "get", + request: { headers: { foo: "foo" }, query: { bar: "bar" } }, + response: { + status: 200, + body: json({ + nestedItems: { + pets: FirstPage, + }, + nestedNext: { + nextToken: "page2", + }, + }), + }, + handler: (req: MockRequest) => { + req.expect.containsHeader("foo", "foo"); + req.expect.containsQueryParam("bar", "bar"); + const token = req.query?.token; + + switch (token) { + case undefined: + return { + status: 200, + body: json({ + nestedItems: { + pets: FirstPage, + }, + nestedNext: { + nextToken: "page2", + }, + }), + }; + case "page2": + return { + status: 200, + body: json({ + nestedItems: { + pets: SecondPage, + }, + }), + }; + default: + throw new ValidationError( + "Unsupported continuation token", + `"undefined" | "page2"`, + token, + ); + } + }, + kind: "MockApiDefinition", + }, + { + uri: "/payload/pageable/server-driven-pagination/continuationtoken/request-query-nested-response-body", + method: "get", + request: RequestTokenInQuery, + response: { + status: 200, + body: json({ + nestedItems: { + pets: SecondPage, + }, + }), + }, + handler: (req: MockRequest) => { + req.expect.containsHeader("foo", "foo"); + req.expect.containsQueryParam("bar", "bar"); + const token = req.query?.token; + + switch (token) { + case undefined: + return { + status: 200, + body: json({ + nestedItems: { + pets: FirstPage, + }, + nestedNext: { + nextToken: "page2", + }, + }), + }; + case "page2": + return { + status: 200, + body: json({ + nestedItems: { + pets: SecondPage, + }, + }), + }; + default: + throw new ValidationError( + "Unsupported continuation token", + `"undefined" | "page2"`, + token, + ); + } + }, + kind: "MockApiDefinition", + }, + ]); + +Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestHeaderNestedResponseBody = + passOnSuccess([ + { + uri: "/payload/pageable/server-driven-pagination/continuationtoken/request-header-nested-response-body", + method: "get", + request: { headers: { foo: "foo" }, query: { bar: "bar" } }, + response: { + status: 200, + body: json({ + nestedItems: { + pets: FirstPage, + }, + nestedNext: { + nextToken: "page2", + }, + }), + }, + handler: (req: MockRequest) => { + req.expect.containsHeader("foo", "foo"); + req.expect.containsQueryParam("bar", "bar"); + const token = req.headers?.token; + + switch (token) { + case undefined: + return { + status: 200, + body: json({ + nestedItems: { + pets: FirstPage, + }, + nestedNext: { + nextToken: "page2", + }, + }), + }; + case "page2": + return { + status: 200, + body: json({ + nestedItems: { + pets: SecondPage, + }, + }), + }; + default: + throw new ValidationError( + "Unsupported continuation token", + `"undefined" | "page2"`, + token, + ); + } + }, + kind: "MockApiDefinition", + }, + { + uri: "/payload/pageable/server-driven-pagination/continuationtoken/request-header-nested-response-body", + method: "get", + request: RequestTokenInHeader, + response: { + status: 200, + body: json({ + nestedItems: { + pets: SecondPage, + }, + }), + }, + handler: (req: MockRequest) => { + req.expect.containsHeader("foo", "foo"); + req.expect.containsQueryParam("bar", "bar"); + const token = req.headers?.token; + + switch (token) { + case undefined: + return { + status: 200, + body: json({ + nestedItems: { + pets: FirstPage, + }, + nestedNext: { + nextToken: "page2", + }, + }), + }; + case "page2": + return { + status: 200, + body: json({ + nestedItems: { + pets: SecondPage, + }, + }), + }; + default: + throw new ValidationError( + "Unsupported continuation token", + `"undefined" | "page2"`, + token, + ); + } + }, + kind: "MockApiDefinition", + }, + ]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/main.tsp new file mode 100644 index 00000000000..68bf621eb81 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/main.tsp @@ -0,0 +1,302 @@ +import "@typespec/http"; +import "@typespec/xml"; +import "@typespec/spector"; + +using Http; +using Spector; +using TypeSpec.Xml; + +@doc("Sends and receives bodies in XML format.") +@scenarioService("/payload/xml") +namespace Payload.Xml; + +@doc("Contains fields of primitive types.") +model SimpleModel { + name: string; + age: int32; +} + +@doc("Contains fields of arrays of primitive types.") +model ModelWithSimpleArrays { + colors: string[]; + counts: int32[]; +} + +@doc("Contains an array of models.") +model ModelWithArrayOfModel { + items: SimpleModel[]; +} + +@doc("Contains an optional field.") +model ModelWithOptionalField { + item: string; + value?: int32; +} + +@doc("Contains fields that are XML attributes.") +model ModelWithAttributes { + @attribute id1: int32; + @attribute id2: string; + enabled: boolean; +} + +@doc("Contains fields of wrapped and unwrapped arrays of primitive types.") +model ModelWithUnwrappedArray { + @unwrapped colors: string[]; + counts: int32[]; +} + +@doc("Contains fields of wrapped and unwrapped arrays of primitive types that have different XML representations.") +model ModelWithRenamedArrays { + @name("Colors") @unwrapped colors: string[]; + @name("Counts") counts: int32[]; +} + +@doc("Contains fields of the same type that have different XML representation.") +@name("ModelWithRenamedFieldsSrc") +model ModelWithRenamedFields { + @name("InputData") inputData: SimpleModel; + @name("OutputData") outputData: SimpleModel; +} + +@doc("Contains an array of models that's supposed to be sent/received as an empty XML element.") +model ModelWithEmptyArray { + items: SimpleModel[]; +} + +@doc("Contains an attribute and text.") +model ModelWithText { + @attribute language: string; + @unwrapped content: string; +} + +@doc("Contains a dictionary of key value pairs.") +model ModelWithDictionary { + metadata: Record; +} + +@doc("Uses encodedName instead of Xml.Name which is functionally equivalent.") +@encodedName("application/xml", "ModelWithEncodedNamesSrc") +model ModelWithEncodedNames { + @encodedName("application/xml", "SimpleModelData") modelData: SimpleModel; + @encodedName("application/xml", "PossibleColors") colors: string[]; +} + +@doc("Template for XML operations") +interface XmlOperations { + @scenario + @scenarioDoc(""" + Expected response body: + ```xml + ${TDoc} + ``` + """) + @get + get(): { + @header("content-type") contentType: "application/xml"; + @body body: TModel; + }; + + @scenario + @scenarioDoc(""" + Expected request body: + ```xml + ${TDoc} + ``` + """) + @put + put(@header("content-type") contentType: "application/xml", @body input: TModel): void; +} + +@doc("Operations for the SimpleModel type.") +@route("/simpleModel") +interface SimpleModelValue + extends XmlOperations< + SimpleModel, + """ + + foo + 123 + + """ + > {} + +@doc("Operations for the ModelWithSimpleArrays type.") +@route("/modelWithSimpleArrays") +interface ModelWithSimpleArraysValue + extends XmlOperations< + ModelWithSimpleArrays, + """ + + + red + green + blue + + + 1 + 2 + + + """ + > {} + +@doc("Operations for the ModelWithArrayOfModel type.") +@route("/modelWithArrayOfModel") +interface ModelWithArrayOfModelValue + extends XmlOperations< + ModelWithArrayOfModel, + """ + + + + foo + 123 + + + bar + 456 + + + + """ + > {} + +@doc("Operations for the ModelWithOptionalField type.") +@route("/modelWithOptionalField") +interface ModelWithOptionalFieldValue + extends XmlOperations< + ModelWithOptionalField, + """ + + widget + + """ + > {} + +@doc("Operations for the ModelWithAttributes type.") +@route("/modelWithAttributes") +interface ModelWithAttributesValue + extends XmlOperations< + ModelWithAttributes, + """ + + true + + """ + > {} + +@doc("Operations for the ModelWithUnwrappedArray type.") +@route("/modelWithUnwrappedArray") +interface ModelWithUnwrappedArrayValue + extends XmlOperations< + ModelWithUnwrappedArray, + """ + + red + green + blue + + 1 + 2 + + + """ + > {} + +@doc("Operations for the ModelWithRenamedArrays type.") +@route("/modelWithRenamedArrays") +interface ModelWithRenamedArraysValue + extends XmlOperations< + ModelWithRenamedArrays, + """ + + red + green + blue + + 1 + 2 + + + """ + > {} + +@doc("Operations for the ModelWithRenamedFields type.") +@route("/modelWithRenamedFields") +interface ModelWithRenamedFieldsValue + extends XmlOperations< + ModelWithRenamedFields, + """ + + + foo + 123 + + + bar + 456 + + + """ + > {} + +@doc("Operations for the ModelWithEmptyArray type.") +@route("/modelWithEmptyArray") +interface ModelWithEmptyArrayValue + extends XmlOperations< + ModelWithEmptyArray, + """ + + + + """ + > {} + +@doc("Operations for the ModelWithText type.") +@route("/modelWithText") +interface ModelWithTextValue + extends XmlOperations< + ModelWithText, + """ + + This is some text. + + """ + > {} + +@doc("Operations for the ModelWithDictionary type.") +@route("/modelWithDictionary") +interface ModelWithDictionaryValue + extends XmlOperations< + ModelWithDictionary, + """ + + + blue + 123 + false + + + """ + > {} + +@doc("Operations for the ModelWithEncodedNames type.") +@route("/modelWithEncodedNames") +interface ModelWithEncodedNamesValue + extends XmlOperations< + ModelWithEncodedNames, + """ + + + foo + 123 + + + red + green + blue + + + """ + > {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/mockapi.ts new file mode 100644 index 00000000000..af06ef9c039 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/mockapi.ts @@ -0,0 +1,235 @@ +import { MockRequest, passOnSuccess, ScenarioMockApi, xml } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +export const simpleModel = ` + + foo + 123 + +`; + +export const modelWithSimpleArrays = ` + + + red + green + blue + + + 1 + 2 + + +`; + +export const modelWithArrayOfModel = ` + + + + foo + 123 + + + bar + 456 + + + +`; + +export const modelWithOptionalField = ` + + widget + +`; + +export const modelWithAttributes = ` + + true + +`; + +export const modelWithUnwrappedArray = ` + + red + green + blue + + 1 + 2 + + +`; + +export const modelWithRenamedArrays = ` + + red + green + blue + + 1 + 2 + + +`; + +export const modelWithRenamedFields = ` + + + foo + 123 + + + bar + 456 + + +`; + +export const modelWithEmptyArray = ` + + + +`; + +export const modelWithText = ` + + This is some text. + +`; + +export const modelWithDictionary = ` + + + blue + 123 + false + + +`; + +export const modelWithEncodedNames = ` + + + foo + 123 + + + red + green + blue + + +`; + +function createServerTests(uri: string, data?: any) { + return { + get: passOnSuccess({ + uri, + method: "get", + request: {}, + response: { + status: 200, + body: xml(data), + }, + kind: "MockApiDefinition", + }), + put: passOnSuccess({ + uri, + method: "put", + request: { + body: xml(data), + }, + handler: (req: MockRequest) => { + req.expect.containsHeader("content-type", "application/xml"); + req.expect.xmlBodyEquals(data); + return { + status: 204, + }; + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }), + }; +} + +const Payload_Xml_SimpleModel = createServerTests("/payload/xml/simpleModel", simpleModel); +Scenarios.Payload_Xml_SimpleModelValue_get = Payload_Xml_SimpleModel.get; +Scenarios.Payload_Xml_SimpleModelValue_put = Payload_Xml_SimpleModel.put; + +const Payload_Xml_ModelWithSimpleArrays = createServerTests( + "/payload/xml/modelWithSimpleArrays", + modelWithSimpleArrays, +); +Scenarios.Payload_Xml_ModelWithSimpleArraysValue_get = Payload_Xml_ModelWithSimpleArrays.get; +Scenarios.Payload_Xml_ModelWithSimpleArraysValue_put = Payload_Xml_ModelWithSimpleArrays.put; + +const Payload_Xml_ModelWithArrayOfModel = createServerTests( + "/payload/xml/modelWithArrayOfModel", + modelWithArrayOfModel, +); +Scenarios.Payload_Xml_ModelWithArrayOfModelValue_get = Payload_Xml_ModelWithArrayOfModel.get; +Scenarios.Payload_Xml_ModelWithArrayOfModelValue_put = Payload_Xml_ModelWithArrayOfModel.put; + +const Payload_Xml_ModelWithOptionalField = createServerTests( + "/payload/xml/modelWithOptionalField", + modelWithOptionalField, +); +Scenarios.Payload_Xml_ModelWithOptionalFieldValue_get = Payload_Xml_ModelWithOptionalField.get; +Scenarios.Payload_Xml_ModelWithOptionalFieldValue_put = Payload_Xml_ModelWithOptionalField.put; + +const Payload_Xml_ModelWithAttributes = createServerTests( + "/payload/xml/modelWithAttributes", + modelWithAttributes, +); +Scenarios.Payload_Xml_ModelWithAttributesValue_get = Payload_Xml_ModelWithAttributes.get; +Scenarios.Payload_Xml_ModelWithAttributesValue_put = Payload_Xml_ModelWithAttributes.put; + +const Payload_Xml_ModelWithUnwrappedArray = createServerTests( + "/payload/xml/modelWithUnwrappedArray", + modelWithUnwrappedArray, +); +Scenarios.Payload_Xml_ModelWithUnwrappedArrayValue_get = Payload_Xml_ModelWithUnwrappedArray.get; +Scenarios.Payload_Xml_ModelWithUnwrappedArrayValue_put = Payload_Xml_ModelWithUnwrappedArray.put; + +const Payload_Xml_ModelWithRenamedArrays = createServerTests( + "/payload/xml/modelWithRenamedArrays", + modelWithRenamedArrays, +); +Scenarios.Payload_Xml_ModelWithRenamedArraysValue_get = Payload_Xml_ModelWithRenamedArrays.get; +Scenarios.Payload_Xml_ModelWithRenamedArraysValue_put = Payload_Xml_ModelWithRenamedArrays.put; + +const Payload_Xml_ModelWithRenamedFields = createServerTests( + "/payload/xml/modelWithRenamedFields", + modelWithRenamedFields, +); +Scenarios.Payload_Xml_ModelWithRenamedFieldsValue_get = Payload_Xml_ModelWithRenamedFields.get; +Scenarios.Payload_Xml_ModelWithRenamedFieldsValue_put = Payload_Xml_ModelWithRenamedFields.put; + +const Payload_Xml_ModelWithEmptyArray = createServerTests( + "/payload/xml/modelWithEmptyArray", + modelWithEmptyArray, +); +Scenarios.Payload_Xml_ModelWithEmptyArrayValue_get = Payload_Xml_ModelWithEmptyArray.get; +Scenarios.Payload_Xml_ModelWithEmptyArrayValue_put = Payload_Xml_ModelWithEmptyArray.put; + +const Payload_Xml_ModelWithText = createServerTests("/payload/xml/modelWithText", modelWithText); +Scenarios.Payload_Xml_ModelWithTextValue_get = Payload_Xml_ModelWithText.get; +Scenarios.Payload_Xml_ModelWithTextValue_put = Payload_Xml_ModelWithText.put; + +const Payload_Xml_ModelWithDictionary = createServerTests( + "/payload/xml/modelWithDictionary", + modelWithDictionary, +); +Scenarios.Payload_Xml_ModelWithDictionaryValue_get = Payload_Xml_ModelWithDictionary.get; +Scenarios.Payload_Xml_ModelWithDictionaryValue_put = Payload_Xml_ModelWithDictionary.put; + +const Payload_Xml_ModelWithEncodedNames = createServerTests( + "/payload/xml/modelWithEncodedNames", + modelWithEncodedNames, +); +Scenarios.Payload_Xml_ModelWithEncodedNamesValue_get = Payload_Xml_ModelWithEncodedNames.get; +Scenarios.Payload_Xml_ModelWithEncodedNamesValue_put = Payload_Xml_ModelWithEncodedNames.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/main.tsp new file mode 100644 index 00000000000..a397060ac2d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/main.tsp @@ -0,0 +1,170 @@ +import "@typespec/http"; +import "@typespec/versioning"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Versioning; +using Azure.ClientGenerator.Core; +using Http; +using Spector; + +@versioned(Versions) +@doc(""" + Test that we can grow up a service spec and service deployment into a multi-versioned service with full client support. + + There are three concepts that should be clarified: + 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. + 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions + 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. + + We test the following configurations from this service spec: + - A client generated from the second service spec can call the second deployment of a service with api version v1 + - A client generated from the second service spec can call the second deployment of a service with api version v2 + """) +@client({ + name: "ResiliencyServiceDrivenClient", +}) +@service +@server( + "{endpoint}/resiliency/service-driven/client:v2/service:{serviceDeploymentVersion}/api-version:{apiVersion}", + "Testserver endpoint", + { + @doc("Need to be set as 'http://localhost:3000' in client.") + endpoint: url, + + @doc("Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when the service had api-versions 'v1' and 'v2'.") + serviceDeploymentVersion: string, + + @doc("Pass in either 'v1' or 'v2'. This represents the API version of a service.") + apiVersion: string, + } +) +namespace Resiliency.ServiceDriven; + +@doc("Service versions") +enum Versions { + @doc("Version 1") + v1, + + @doc("Version 2") + v2, +} + +model PostInput { + url: string; +} + +@route("/add-optional-param") +interface AddOptionalParam { + @scenario + @scenarioDoc(""" + Need the following two calls: + - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v1"` with no parameters. + - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v2"` with query parameter `new-parameter="new"`. + + There are three concepts that should be clarified: + 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. + 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions + 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. + + With the above two calls, we test the following configurations from this service spec: + - A client generated from the second service spec can call the second deployment of a service with api version v1 + - A client generated from the second service spec can call the second deployment of a service with api version v2 with the updated changes + + Tests that we can grow up an operation from accepting no parameters to accepting an optional input parameter. + """) + @route("/from-none") + @doc("Test that grew up from accepting no parameters to an optional input parameter") + @head + fromNone( + @added(Versions.v2) + @doc("I'm a new input optional parameter") + @query + `new-parameter`?: string, + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + Need the following two calls: + - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v1"` with query parameter `parameter="required"`. + - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v2"` with query parameter `parameter="required"` and query parameter `new-parameter="new"`. + + There are three concepts that should be clarified: + 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. + 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions + 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. + + With the above two calls, we test the following configurations from this service spec: + - A client generated from the second service spec can call the second deployment of a service with api version v1 + - A client generated from the second service spec can call the second deployment of a service with api version v2 with the updated changes + + Tests that we can grow up an operation from accepting one required parameter to accepting a required parameter and an optional parameter. + """) + @route("/from-one-required") + @doc("Operation that grew up from accepting one required parameter to accepting a required parameter and an optional parameter.") + @get + fromOneRequired( + @doc("I am a required parameter") + @query + parameter: string, + + @added(Versions.v2) + @doc("I'm a new input optional parameter") + @query + `new-parameter`?: string, + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + Need the following two calls: + - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v1"` with query parameter `parameter="optional"`. + - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v2"` with query parameter `parameter="optional"` and query parameter `new-parameter="new"`. + + There are three concepts that should be clarified: + 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. + 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions + 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. + + With the above two calls, we test the following configurations from this service spec: + - A client generated from the second service spec can call the second deployment of a service with api version v1 + - A client generated from the second service spec can call the second deployment of a service with api version v2 with the updated changes + + Tests that we can grow up an operation from accepting one optional parameter to accepting two optional parameters. + """) + @route("/from-one-optional") + @doc("Tests that we can grow up an operation from accepting one optional parameter to accepting two optional parameters.") + @get + fromOneOptional( + @doc("I am an optional parameter") + @query + parameter?: string, + + @added(Versions.v2) + @doc("I'm a new input optional parameter") + @query + `new-parameter`?: string, + ): NoContentResponse; +} + +@scenario +@scenarioDoc(""" + Need the following two calls: + - Call with client spec version "v1" with `serviceDeploymentVersion="v2"` and `apiVersion="v2"` + - Call with client spec version "v2" with `serviceDeploymentVersion="v2"` and `apiVersion="v2"` + + There are three concepts that should be clarified: + 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. + 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions + 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. + + With the above two calls, we test the following configurations from this service spec: + - A client generated from the first service spec can break the glass and call the second deployment of a service with api version v2 + - A client generated from the second service spec can call the second deployment of a service with api version v2 with the updated changes + + Tests that we can grow up by adding an operation. + """) +@added(Versions.v2) +@route("/add-operation") +@doc("Added operation") +@delete +op addOperation(): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/mockapi.ts new file mode 100644 index 00000000000..f025bb65da2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/mockapi.ts @@ -0,0 +1,218 @@ +import { MockRequest, ScenarioMockApi, ValidationError, passOnSuccess } from "@typespec/spec-api"; + +export const commonBase = "/resiliency/service-driven"; + +export const Scenarios: Record = {}; + +Scenarios.Resiliency_ServiceDriven_AddOptionalParam_fromNone = passOnSuccess([ + { + uri: `${commonBase}/client\\:v1/service\\:v1/api-version\\:v1/add-optional-param/from-none`, + method: "head", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: `${commonBase}/client\\:v1/service\\:v2/api-version\\:v1/add-optional-param/from-none`, + method: "head", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v1/add-optional-param/from-none`, + method: "head", + request: {}, + response: { + status: 204, + }, + handler: (req: MockRequest) => { + if (req.params["new-parameter"] !== undefined) { + throw new ValidationError( + "Did not expect 'new-parameter'", + undefined, + req.params["new-parameter"], + ); + } + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }, + { + uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v2/add-optional-param/from-none`, + method: "head", + request: { + query: { + "new-parameter": "new", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Resiliency_ServiceDriven_AddOptionalParam_fromOneRequired = passOnSuccess([ + { + uri: `${commonBase}/client\\:v1/service\\:v1/api-version\\:v1/add-optional-param/from-one-required`, + method: "get", + request: { + query: { + parameter: "required", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: `${commonBase}/client\\:v1/service\\:v2/api-version\\:v1/add-optional-param/from-one-required`, + method: "get", + request: { + query: { + parameter: "required", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v1/add-optional-param/from-one-required`, + method: "get", + request: { + query: { + parameter: "required", + }, + }, + response: { + status: 204, + }, + handler: (req: MockRequest) => { + req.expect.containsQueryParam("parameter", "required"); + if (req.params["new-parameter"] !== undefined) { + throw new ValidationError( + "Did not expect 'new-parameter'", + undefined, + req.params["new-parameter"], + ); + } + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }, + { + uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v2/add-optional-param/from-one-required`, + method: "get", + request: { + query: { + parameter: "required", + "new-parameter": "new", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Resiliency_ServiceDriven_AddOptionalParam_fromOneOptional = passOnSuccess([ + { + uri: `${commonBase}/client\\:v1/service\\:v1/api-version\\:v1/add-optional-param/from-one-optional`, + method: "get", + request: { + query: { + parameter: "optional", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: `${commonBase}/client\\:v1/service\\:v2/api-version\\:v1/add-optional-param/from-one-optional`, + method: "get", + request: { + query: { + parameter: "optional", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, + { + uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v1/add-optional-param/from-one-optional`, + method: "get", + request: { + query: { + parameter: "optional", + }, + }, + response: { + status: 204, + }, + handler: (req: MockRequest) => { + req.expect.containsQueryParam("parameter", "optional"); + if (req.params["new-parameter"] !== undefined) { + throw new ValidationError( + "Did not expect 'new-parameter'", + undefined, + req.params["new-parameter"], + ); + } + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }, + { + uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v2/add-optional-param/from-one-optional`, + method: "get", + request: { + query: { + parameter: "optional", + "new-parameter": "new", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }, +]); + +Scenarios.Resiliency_ServiceDriven_breakTheGlass = passOnSuccess({ + uri: `${commonBase}/client\\:v1/service\\:v2/api-version\\:v2/add-operation`, + method: "delete", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Resiliency_ServiceDriven_addOperation = passOnSuccess({ + uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v2/add-operation`, + method: "delete", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/old.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/old.tsp new file mode 100644 index 00000000000..38e8ddf1c18 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/old.tsp @@ -0,0 +1,120 @@ +import "@typespec/http"; +import "@typespec/versioning"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using Http; +using Azure.ClientGenerator.Core; +using Versioning; +using Spector; + +@versioned(Versions) +@doc(""" + Test that we can grow up a service spec and service deployment into a multi-versioned service with full client support. + """) +@client({ + name: "ResiliencyServiceDrivenClient", +}) +@service +@server( + "{endpoint}/resiliency/service-driven/client:v1/service:{serviceDeploymentVersion}/api-version:{apiVersion}", + "Testserver endpoint", + { + @doc("Need to be set as 'http://localhost:3000' in client.") + endpoint: url, + + @doc("Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when the service had api-versions 'v1' and 'v2'.") + serviceDeploymentVersion: string, + + @doc("Pass in 'v1'. This represents the API version of the service. Will grow up in the next deployment to be both 'v1' and 'v2'") + apiVersion: string, + } +) +namespace Resiliency.ServiceDriven; + +@doc("Service versions.") +enum Versions { + @doc("Version 1") + v1, +} + +model PostInput { + url: string; +} + +@route("/add-optional-param") +interface AddOptionalParam { + @scenario + @scenarioDoc(""" + Need the following two calls: + - Pass in `serviceDeploymentVersion="v1"` and `apiVersion="v1"` with no parameters. + - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v1"` with no parameters. + + There are three concepts that should be clarified: + 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. + 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions + 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. + + With the above two calls, we test the following configurations from this service spec: + - A client generated from the first service spec can call the first deployment of a service with api version v1 + - A client generated from the first service spec can call the second deployment of a service with api version v1 + + In the next service spec, we will test that we can grow this operation from accepting no parameters to accepting an optional parameter. + """) + @route("/from-none") + @doc("Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as well") + @head + fromNone(): NoContentResponse; + + @scenario + @scenarioDoc(""" + Need the following two calls: + - Pass in `serviceDeploymentVersion="v1"` and `apiVersion="v1"` with query parameter `parameter="required"`. + - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v1"` with query parameter `parameter="required"`. + + There are three concepts that should be clarified: + 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. + 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions + 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. + + With the above two calls, we test the following configurations from this service spec: + - A client generated from the first service spec can call the first deployment of a service with api version v1 + - A client generated from the first service spec can call the second deployment of a service with api version v1 + + In the next service spec, we will test that we can grow this operation from accepting one required parameter to accepting both a required and an optional parameter. + """) + @route("/from-one-required") + @doc("Test that currently accepts one required parameter, will be updated in next spec to accept a new optional parameter as well") + @get + fromOneRequired( + @doc("I am a required parameter") + @query + parameter: string, + ): NoContentResponse; + + @scenario + @scenarioDoc(""" + Need the following two calls: + - Pass in `serviceDeploymentVersion="v1"` and `apiVersion="v1"` with query parameter `parameter="optional"`. + - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v1"` with query parameter `parameter="optional"`. + + There are three concepts that should be clarified: + 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. + 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions + 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. + + With the above two calls, we test the following configurations from this service spec: + - A client generated from the first service spec can call the first deployment of a service with api version v1 + - A client generated from the first service spec can call the second deployment of a service with api version v1 + + In the next service spec, we will test that we can grow this operation from accepting one optional parameter to accepting two optional parameters. + """) + @route("/from-one-optional") + @doc("Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional parameter as well") + @get + fromOneOptional( + @doc("I am an optional parameter") + @query + parameter?: string, + ): NoContentResponse; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/main.tsp new file mode 100644 index 00000000000..d103490e840 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/main.tsp @@ -0,0 +1,82 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +/** + * Test for range of status code. + */ +@scenarioService("/response/status-code-range") +namespace Response.StatusCodeRange; + +@scenario +@scenarioDoc(""" + Test case for range of status code in error response. + + Verify that the result of the API is an error/exception in client, and the error response can be de-serialized to ErrorInRange model (instead of DefaultError model). + + Expected status code 494 and response body: + ```json + { + "code": "request-header-too-large", + "message": "Request header too large" + } + ``` + """) +@route("/error-response-status-code-in-range") +@get +op errorResponseStatusCodeInRange(): NoContentResponse | ErrorInRange | DefaultError; + +@scenario +@scenarioDoc(""" + Test case for range of status code in error response. + + Verify that the result of the API is an error/exception in client, and the error response can be de-serialized to NotFoundError model (instead of Standard4XXError model). + + Expected status code 404 and response body: + ```json + { + "code": "not-found", + "resourceId": "resource1" + } + ``` + """) +@route("/error-response-status-code-404") +@get +op errorResponseStatusCode404(): NoContentResponse | NotFoundError | Standard4XXError; + +@error +model NotFoundError { + @statusCode + _: 404; + + code: string; + resourceId: string; +} + +@error +model ErrorInRange { + @minValue(494) + @maxValue(499) + @statusCode + _: int32; + + code: string; + message: string; +} + +@error +model Standard4XXError { + @minValue(400) + @maxValue(499) + @statusCode + _: int32; + + code: string; +} + +@error +model DefaultError { + code: string; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/mockapi.ts new file mode 100644 index 00000000000..6621059e050 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/mockapi.ts @@ -0,0 +1,31 @@ +import { json, passOnCode, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Response_StatusCodeRange_errorResponseStatusCodeInRange = passOnCode(494, { + uri: "/response/status-code-range/error-response-status-code-in-range", + method: "get", + request: {}, + response: { + status: 494, + body: json({ + code: "request-header-too-large", + message: "Request header too large", + }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Response_StatusCodeRange_errorResponseStatusCode404 = passOnCode(404, { + uri: "/response/status-code-range/error-response-status-code-404", + method: "get", + request: {}, + response: { + status: 404, + body: json({ + code: "not-found", + resourceId: "resource1", + }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/routes/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/routes/main.tsp new file mode 100644 index 00000000000..d87580ec6c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/routes/main.tsp @@ -0,0 +1,477 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +/** + * Define scenario in building the http route/uri + */ +@scenarioService("/routes") +namespace Routes; + +@scenario +@scenarioDoc(""" + Simple operation at a fixed in an interface + Expected path: /routes/fixed + """) +@route("fixed") +op fixed(): void; + +@scenario +@scenarioDoc(""" + Simple operation at a fixed in an interface + Expected path: /routes/in-interface/fixed + """) +@route("in-interface") +interface InInterface { + @route("fixed") + fixed(): void; +} + +@route("path") +namespace PathParameters { + @scenario + @scenarioDoc(""" + Path parameter defined implicitly + Value: "a" + Expected path: /routes/path/template-only/a + """) + @route("template-only/{param}") + op templateOnly(param: string): void; + + @scenario + @scenarioDoc(""" + Path parameter defined explicitly + Value: "a" + Expected path: /routes/path/explicit/a + """) + @route("explicit/{param}") + op explicit(@path param: string): void; + + @scenario + @scenarioDoc(""" + Path parameter annotated with @path but not defined explicitly in the route + Value: "a" + Expected path: /routes/path/annotation-only/a + """) + @route("annotation-only") + op annotationOnly(@path param: string): void; + + @route("reserved-expansion") + namespace ReservedExpansion { + @scenario + @scenarioDoc(""" + Defines a path parameter that shouldn't encode reserved characters. It should however still encode the other url characters. + Param value: "foo/bar baz" + Expected path: "/routes/path/reserved-expansion/template/foo/bar%20baz" + """) + @route("template/{+param}") + op template(param: string): void; + + @scenario + @scenarioDoc(""" + Defines a path parameter that shouldn't encode reserved characters. It should however still encode the other url characters. + Param value: "foo/bar baz" + Expected path: "/routes/path/reserved-expansion/annotation/foo/bar%20baz" + """) + @route("annotation") + op annotation(@path(#{ allowReserved: true }) param: string): void; + } + + @route("simple") + namespace SimpleExpansion { + @route("standard") + namespace Standard { + @scenario + @scenarioDoc(""" + Test simple expansion with explode: false when passed a primitive value. + Param value: "a" + Expected path: /routes/path/simple/standard/primitivea + """) + @route("primitive{param}") + op primitive(param: string): void; + + @scenario + @scenarioDoc(""" + Test simple expansion with explode: false when passed an array value. + Param value: ["a","b"] + Expected path: /routes/path/simple/standard/arraya,b + """) + @route("array{param}") + op `array`(param: string[]): void; + + @scenario + @scenarioDoc(""" + Test simple expansion with explode: false when passed a record value. + Param value: {a: 1, b: 2} + Expected path: /routes/path/simple/standard/recorda,1,b,2 + """) + @route("record{param}") + op `record`(param: Record): void; + } + + @route("explode") + namespace Explode { + @scenario + @scenarioDoc(""" + Test simple expansion with explode: true when passed a primitive value. + Param value: "a" + Expected path: /routes/path/simple/explode/primitivea + """) + @route("primitive{param*}") + op primitive(param: string): void; + + @scenario + @scenarioDoc(""" + Test simple expansion with explode: true when passed an array value. + Param value: ["a","b"] + Expected path: /routes/path/simple/explode/arraya.b + """) + @route("array{param*}") + op `array`(param: string[]): void; + + @scenario + @scenarioDoc(""" + Test simple expansion with explode: true when passed a record value. + Param value: {a: 1, b: 2} + Expected path: /routes/path/simple/explode/recorda=1,b=2 + """) + @route("record{param*}") + op `record`(param: Record): void; + } + } + + @route("path") + namespace PathExpansion { + @route("standard") + namespace Standard { + @scenario + @scenarioDoc(""" + Test path expansion with explode: false when passed a primitive value. + Param value: "a" + Expected path: /routes/path/path/standard/primitive/a + """) + @route("primitive{/param}") + op primitive(param: string): void; + + @scenario + @scenarioDoc(""" + Test path expansion with explode: false when passed an array value. + Param value: ["a","b"] + Expected path: /routes/path/path/standard/array/a,b + """) + @route("array{/param}") + op `array`(param: string[]): void; + + @scenario + @scenarioDoc(""" + Test path expansion with explode: false when passed a record value. + Param value: {a: 1, b: 2} + Expected path: /routes/path/path/standard/record/a,1,b,2 + """) + @route("record{/param}") + op `record`(param: Record): void; + } + + @route("explode") + namespace Explode { + @scenario + @scenarioDoc(""" + Test path expansion with explode: true when passed a primitive value. + Param value: "a" + Expected path: /routes/path/path/explode/primitive/a + """) + @route("primitive{/param*}") + op primitive(param: string): void; + + @scenario + @scenarioDoc(""" + Test path expansion with explode: true when passed an array value. + Param value: ["a","b"] + Expected path: /routes/path/path/explode/array/a/b + """) + @route("array{/param*}") + op `array`(param: string[]): void; + + @scenario + @scenarioDoc(""" + Test path expansion with explode: true when passed a record value. + Param value: {a: 1, b: 2} + Expected path: /routes/path/path/explode/record/a=1/b=2 + """) + @route("record{/param*}") + op `record`(param: Record): void; + } + } + + @route("label") + namespace LabelExpansion { + @route("standard") + namespace Standard { + @scenario + @scenarioDoc(""" + Test label expansion with explode: false when passed a primitive value. + Param value: "a" + Expected path: /routes/path/label/standard/primitive.a + """) + @route("primitive{.param}") + op primitive(param: string): void; + + @scenario + @scenarioDoc(""" + Test label expansion with explode: false when passed an array value. + Param value: ["a","b"] + Expected path: /routes/path/label/standard/array.a,b + """) + @route("array{.param}") + op `array`(param: string[]): void; + + @scenario + @scenarioDoc(""" + Test label expansion with explode: false when passed a record value. + Param value: {a: 1, b: 2} + Expected path: /routes/path/label/standard/record.a,1,b,2 + """) + @route("record{.param}") + op `record`(param: Record): void; + } + + @route("explode") + namespace Explode { + @scenario + @scenarioDoc(""" + Test label expansion with explode: true when passed a primitive value. + Param value: "a" + Expected path: /routes/path/label/explode/primitive.a + """) + @route("primitive{.param*}") + op primitive(param: string): void; + + @scenario + @scenarioDoc(""" + Test label expansion with explode: true when passed an array value. + Param value: ["a","b"] + Expected path: /routes/path/label/explode/array.a.b + """) + @route("array{.param*}") + op `array`(param: string[]): void; + + @scenario + @scenarioDoc(""" + Test label expansion with explode: true when passed a record value. + Param value: {a: 1, b: 2} + Expected path: /routes/path/label/explode/record.a=1.b=2 + """) + @route("record{.param*}") + op `record`(param: Record): void; + } + } + + @route("matrix") + namespace MatrixExpansion { + @route("standard") + namespace Standard { + @scenario + @scenarioDoc(""" + Test matrix expansion with explode: false when passed a primitive value. + Param value: "a" + Expected path: /routes/path/matrix/standard/primitive;param=a + """) + @route("primitive{;param}") + op primitive(param: string): void; + + @scenario + @scenarioDoc(""" + Test matrix expansion with explode: false when passed an array value. + Param value: ["a","b"] + Expected path: /routes/path/matrix/standard/array;param=a;param=b + """) + @route("array{;param}") + op `array`(param: string[]): void; + + @scenario + @scenarioDoc(""" + Test matrix expansion with explode: false when passed a record value. + Param value: {a: 1, b: 2} + Expected path: /routes/path/matrix/standard/record;a=1;b=2 + """) + @route("record{;param}") + op `record`(param: Record): void; + } + + @route("explode") + namespace Explode { + @scenario + @scenarioDoc(""" + Test matrix expansion with explode: true when passed a primitive value. + Param value: "a" + Expected path: /routes/path/matrix/explode/primitive;param=a + """) + @route("primitive{;param*}") + op primitive(param: string): void; + + @scenario + @scenarioDoc(""" + Test matrix expansion with explode: true when passed an array value. + Param value: ["a","b"] + Expected path: /routes/path/matrix/explode/array;param=a;param=b + """) + @route("array{;param*}") + op `array`(param: string[]): void; + + @scenario + @scenarioDoc(""" + Test matrix expansion with explode: true when passed a record value. + Param value: {a: 1, b: 2} + Expected path: /routes/path/matrix/explode/record;a=1;b=2 + """) + @route("record{;param*}") + op `record`(param: Record): void; + } + } +} + +@route("query") +namespace QueryParameters { + @scenario + @scenarioDoc("Query parameter defined implicitly") + @route("template-only{?param}") + op templateOnly(param: string): void; + + @scenario + @scenarioDoc("Query parameter marked with explicit @query") + @route("explicit{?param}") + op explicit(@query param: string): void; + + @scenario + @scenarioDoc("Query parameter annotated with @query but not defined explicitly in the route") + @route("annotation-only") + op annotationOnly(@query param: string): void; + + @route("query-expansion") + namespace QueryExpansion { + @route("standard") + namespace Standard { + @scenario + @scenarioDoc(""" + Test query expansion with explode: false when passed a primitive value. + Param value: "a" + Expected path: /routes/query/query-expansion/standard/primitive?param=a + """) + @route("primitive{?param}") + op primitive(param: string): void; + + @scenario + @scenarioDoc(""" + Test query expansion with explode: false when passed an array value. + Param value: ["a","b"] + Expected path: /routes/query/query-expansion/standard/array?param=a,b + """) + @route("array{?param}") + op `array`(param: string[]): void; + + @scenario + @scenarioDoc(""" + Test query expansion with explode: false when passed a record value. + Param value: {a: 1, b: 2} + Expected path: /routes/query/query-expansion/standard/record?param=a,1,b,2 + """) + @route("record{?param}") + op `record`(param: Record): void; + } + + @route("explode") + namespace Explode { + @scenario + @scenarioDoc(""" + Test query expansion with explode: true when passed a primitive value. + Param value: "a" + Expected path: /routes/query/query-expansion/explode/primitive?param=a + """) + @route("primitive{?param*}") + op primitive(param: string): void; + + @scenario + @scenarioDoc(""" + Test query expansion with explode: true when passed an array value. + Param value: ["a","b"] + Expected path: /routes/query/query-expansion/explode/array?param=a¶m=b + """) + @route("array{?param*}") + op `array`(param: string[]): void; + + @scenario + @scenarioDoc(""" + Test query expansion with explode: true when passed a record value. + Param value: {a: 1, b: 2} + Expected path: /routes/query/query-expansion/explode/record?a=1&b=2 + """) + @route("record{?param*}") + op `record`(param: Record): void; + } + } + + @route("query-continuation") + namespace QueryContinuation { + @route("standard") + namespace Standard { + @scenario + @scenarioDoc(""" + Test query continuation expansion with explode: false when passed a primitive value. + Param value: "a" + Expected path: /routes/query/query-continuation/standard/primitive?fixed=true¶m=a + """) + @route("primitive?fixed=true{¶m}") + op primitive(param: string): void; + + @scenario + @scenarioDoc(""" + Test query continuation expansion with explode: false when passed an array value. + Param value: ["a","b"] + Expected path: /routes/query/query-continuation/standard/array?fixed=true¶m=a,b + """) + @route("array?fixed=true{¶m}") + op `array`(param: string[]): void; + + @scenario + @scenarioDoc(""" + Test query continuation expansion with explode: false when passed a record value. + Param value: {a: 1, b: 2} + Expected path: /routes/query/query-continuation/standard/record?fixed=true¶m=a,1,b,2 + """) + @route("record?fixed=true{¶m}") + op `record`(param: Record): void; + } + + @route("explode") + namespace Explode { + @scenario + @scenarioDoc(""" + Test query continuation expansion with explode: true when passed a primitive value. + Param value: "a" + Expected path: /routes/query/query-continuation/explode/primitive?fixed=true¶m=a + """) + @route("primitive?fixed=true{¶m*}") + op primitive(param: string): void; + + @scenario + @scenarioDoc(""" + Test query continuation expansion with explode: true when passed an array value. + Param value: ["a","b"] + Expected path: /routes/query/query-continuation/explode/array?fixed=true¶m=a¶m=b + """) + @route("array?fixed=true{¶m*}") + op `array`(param: string[]): void; + + @scenario + @scenarioDoc(""" + Test query continuation expansion with explode: true when passed a record value. + Param value: {a: 1, b: 2} + Expected path: /routes/query/query-continuation/explode/record?fixed=true&a=1&b=2 + """) + @route("record?fixed=true{¶m*}") + op `record`(param: Record): void; + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/routes/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/routes/mockapi.ts new file mode 100644 index 00000000000..8b1a0728a97 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/routes/mockapi.ts @@ -0,0 +1,175 @@ +import { MockRequest, passOnSuccess, ScenarioMockApi, ValidationError } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createTests(uri: string) { + const url = new URL("http://example.com" + uri); + const queryMap = new Map(); + for (const [key, value] of url.searchParams.entries()) { + if (queryMap.has(key)) { + const existing = queryMap.get(key)!; + if (Array.isArray(existing)) { + existing.push(value); + } else { + queryMap.set(key, [existing, value]); + } + } else { + queryMap.set(key, value); + } + } + return passOnSuccess({ + uri: url.pathname, + method: "get", + request: { + query: Object.fromEntries(queryMap), + }, + response: { + status: 204, + }, + handler: (req: MockRequest) => { + for (const [key, value] of queryMap.entries()) { + if (Array.isArray(value)) { + req.expect.containsQueryParam(key, value, "multi"); + } else { + req.expect.containsQueryParam(key, value); + } + } + for (const param of Object.keys(req.query)) { + if (!url.searchParams.has(param)) { + throw new ValidationError( + `Unexpected query parameter ${param}`, + undefined, + req.query[param], + ); + } + } + return { status: 204 }; + }, + kind: "MockApiDefinition", + }); +} + +Scenarios.Routes_InInterface = createTests("/routes/fixed"); +Scenarios.Routes_fixed = createTests("/routes/in-interface/fixed"); +Scenarios.Routes_PathParameters_templateOnly = createTests("/routes/path/template-only/a"); +Scenarios.Routes_PathParameters_explicit = createTests("/routes/path/explicit/a"); +Scenarios.Routes_PathParameters_annotationOnly = createTests("/routes/path/annotation-only/a"); +Scenarios.Routes_PathParameters_ReservedExpansion_template = createTests( + "/routes/path/reserved-expansion/template/foo/bar%20baz", +); +Scenarios.Routes_PathParameters_ReservedExpansion_annotation = createTests( + "/routes/path/reserved-expansion/annotation/foo/bar%20baz", +); +Scenarios.Routes_PathParameters_SimpleExpansion_Standard_primitive = createTests( + "/routes/path/simple/standard/primitivea", +); +Scenarios.Routes_PathParameters_SimpleExpansion_Standard_array = createTests( + "/routes/path/simple/standard/arraya,b", +); +Scenarios.Routes_PathParameters_SimpleExpansion_Standard_record = createTests( + "/routes/path/simple/standard/recorda,1,b,2", +); +Scenarios.Routes_PathParameters_SimpleExpansion_Explode_primitive = createTests( + "/routes/path/simple/explode/primitivea", +); +Scenarios.Routes_PathParameters_SimpleExpansion_Explode_array = createTests( + "/routes/path/simple/explode/arraya,b", +); +Scenarios.Routes_PathParameters_SimpleExpansion_Explode_record = createTests( + "/routes/path/simple/explode/recorda=1,b=2", +); +Scenarios.Routes_PathParameters_PathExpansion_Standard_primitive = createTests( + "/routes/path/path/standard/primitive/a", +); +Scenarios.Routes_PathParameters_PathExpansion_Standard_array = createTests( + "/routes/path/path/standard/array/a,b", +); +Scenarios.Routes_PathParameters_PathExpansion_Standard_record = createTests( + "/routes/path/path/standard/record/a,1,b,2", +); +Scenarios.Routes_PathParameters_PathExpansion_Explode_primitive = createTests( + "/routes/path/path/explode/primitive/a", +); +Scenarios.Routes_PathParameters_PathExpansion_Explode_array = createTests( + "/routes/path/path/explode/array/a/b", +); +Scenarios.Routes_PathParameters_PathExpansion_Explode_record = createTests( + "/routes/path/path/explode/record/a=1/b=2", +); +Scenarios.Routes_PathParameters_LabelExpansion_Standard_primitive = createTests( + "/routes/path/label/standard/primitive.a", +); +Scenarios.Routes_PathParameters_LabelExpansion_Standard_array = createTests( + "/routes/path/label/standard/array.a,b", +); +Scenarios.Routes_PathParameters_LabelExpansion_Standard_record = createTests( + "/routes/path/label/standard/record.a,1,b,2", +); +Scenarios.Routes_PathParameters_LabelExpansion_Explode_primitive = createTests( + "/routes/path/label/explode/primitive.a", +); +Scenarios.Routes_PathParameters_LabelExpansion_Explode_array = createTests( + "/routes/path/label/explode/array.a.b", +); +Scenarios.Routes_PathParameters_LabelExpansion_Explode_record = createTests( + "/routes/path/label/explode/record.a=1.b=2", +); +Scenarios.Routes_PathParameters_MatrixExpansion_Standard_primitive = createTests( + "/routes/path/matrix/standard/primitive;param=a", +); +Scenarios.Routes_PathParameters_MatrixExpansion_Standard_array = createTests( + "/routes/path/matrix/standard/array;param=a,b", +); +Scenarios.Routes_PathParameters_MatrixExpansion_Standard_record = createTests( + "/routes/path/matrix/standard/record;param=a,1,b,2", +); +Scenarios.Routes_PathParameters_MatrixExpansion_Explode_primitive = createTests( + "/routes/path/matrix/explode/primitive;param=a", +); +Scenarios.Routes_PathParameters_MatrixExpansion_Explode_array = createTests( + "/routes/path/matrix/explode/array;param=a;param=b", +); +Scenarios.Routes_PathParameters_MatrixExpansion_Explode_record = createTests( + "/routes/path/matrix/explode/record;a=1;b=2", +); +Scenarios.Routes_QueryParameters_templateOnly = createTests("/routes/query/template-only?param=a"); +Scenarios.Routes_QueryParameters_explicit = createTests("/routes/query/explicit?param=a"); +Scenarios.Routes_QueryParameters_annotationOnly = createTests( + "/routes/query/annotation-only?param=a", +); +Scenarios.Routes_QueryParameters_QueryExpansion_Standard_primitive = createTests( + "/routes/query/query-expansion/standard/primitive?param=a", +); +Scenarios.Routes_QueryParameters_QueryExpansion_Standard_array = createTests( + "/routes/query/query-expansion/standard/array?param=a,b", +); +Scenarios.Routes_QueryParameters_QueryExpansion_Standard_record = createTests( + "/routes/query/query-expansion/standard/record?param=a,1,b,2", +); +Scenarios.Routes_QueryParameters_QueryExpansion_Explode_primitive = createTests( + "/routes/query/query-expansion/explode/primitive?param=a", +); +Scenarios.Routes_QueryParameters_QueryExpansion_Explode_array = createTests( + "/routes/query/query-expansion/explode/array?param=a¶m=b", +); +Scenarios.Routes_QueryParameters_QueryExpansion_Explode_record = createTests( + "/routes/query/query-expansion/explode/record?a=1&b=2", +); +Scenarios.Routes_QueryParameters_QueryContinuation_Standard_primitive = createTests( + "/routes/query/query-continuation/standard/primitive?fixed=true¶m=a", +); +Scenarios.Routes_QueryParameters_QueryContinuation_Standard_array = createTests( + "/routes/query/query-continuation/standard/array?fixed=true¶m=a,b", +); +Scenarios.Routes_QueryParameters_QueryContinuation_Standard_record = createTests( + "/routes/query/query-continuation/standard/record?fixed=true¶m=a,1,b,2", +); +Scenarios.Routes_QueryParameters_QueryContinuation_Explode_primitive = createTests( + "/routes/query/query-continuation/explode/primitive?fixed=true¶m=a", +); +Scenarios.Routes_QueryParameters_QueryContinuation_Explode_array = createTests( + "/routes/query/query-continuation/explode/array?fixed=true¶m=a¶m=b", +); +Scenarios.Routes_QueryParameters_QueryContinuation_Explode_record = createTests( + "/routes/query/query-continuation/explode/record?fixed=true&a=1&b=2", +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/scratch/.npmignore b/packages/http-client-java/generator/http-client-generator-test/specs/scratch/.npmignore new file mode 100644 index 00000000000..ae140cafe73 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/scratch/.npmignore @@ -0,0 +1,3 @@ +# This directory reserved for creating scratch *.tsp for testing/experimentation +**/* +!.gitignore diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/main.tsp new file mode 100644 index 00000000000..8d1d0e006f9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/main.tsp @@ -0,0 +1,45 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Encoded names") +@scenarioService("/serialization/encoded-name/json") +namespace Serialization.EncodedName.Json; + +@route("/property") +namespace Property { + model JsonEncodedNameModel { + /** Pass in true */ + @encodedName("application/json", "wireName") + defaultName: boolean; + } + + @scenario + @scenarioDoc(""" + Testing that you send the right JSON name on the wire. + Your generated SDK should generate JsonEncodedNameModel with one property `defaultName` with wire name `wireName`. + + Expected request body: + ```json + {"wireName": true} + ``` + """) + @post + op send(@bodyRoot body: JsonEncodedNameModel): NoContentResponse; + + @scenario + @scenarioDoc(""" + Testing that you deserialize the right json name over the wire. + + Your generated SDK should generate JsonEncodedNameModel with one property `defaultName` with wire name `wireName`. + + Expected response body: + ```json + {"wireName": true} + ``` + """) + @get + op get(): JsonEncodedNameModel; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/mockapi.ts new file mode 100644 index 00000000000..5087a954e8a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/mockapi.ts @@ -0,0 +1,22 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Serialization_EncodedName_Json_Property_send = passOnSuccess({ + uri: "/serialization/encoded-name/json/property", + method: "post", + request: { body: json({ wireName: true }) }, + response: { status: 204 }, + kind: "MockApiDefinition", +}); + +Scenarios.Serialization_EncodedName_Json_Property_get = passOnSuccess({ + uri: "/serialization/encoded-name/json/property", + method: "get", + request: {}, + response: { + status: 200, + body: json({ wireName: true }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/main.tsp new file mode 100644 index 00000000000..d477ddb8130 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/main.tsp @@ -0,0 +1,18 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +/** + * Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let user pass in. + */ +@route("/server/endpoint/not-defined") +@service(#{ title: "Testserver without any endpoint" }) +namespace Server.Endpoint.NotDefined; + +@scenario +@scenarioDoc("A simple operation in a server without defining a endpoint. Expected uri: '/valid'") +@route("/valid") +@head +op valid(): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/mockapi.ts new file mode 100644 index 00000000000..c3a58c08826 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/mockapi.ts @@ -0,0 +1,13 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Server_Endpoint_NotDefined_valid = passOnSuccess({ + uri: "/server/endpoint/not-defined/valid", + method: "head", + request: {}, + response: { + status: 200, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/main.tsp new file mode 100644 index 00000000000..8910fd834b8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/main.tsp @@ -0,0 +1,45 @@ +import "@typespec/rest"; +import "@typespec/spector"; +import "@typespec/versioning"; + +using Http; +using Spector; +using Versioning; +using Rest; + +@versioned(Versions) +@service(#{ title: "ServerPathMultiple" }) +@server( + "{endpoint}/server/path/multiple/{apiVersion}", + "Test server with path parameters.", + { + @doc("Pass in http://localhost:3000 for endpoint.") + endpoint: url, + + @doc("Pass in v1.0 for API version.") + apiVersion: Versions, + } +) +namespace Server.Path.Multiple; + +@doc("Service versions") +enum Versions { + @doc("Version 1.0") + v1_0: "v1.0", +} + +@scenario +@scenarioDoc(""" + Operation with client path parameters. + + Expected path parameter: apiVersion=v1.0 + """) +op noOperationParams(): NoContentResponse; + +@scenario +@scenarioDoc(""" + Operation with client and method path parameters. + + Expected path parameter: apiVersion=v1.0, keyword=test + """) +op withOperationPathParam(@path keyword: string): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/mockapi.ts new file mode 100644 index 00000000000..8c5fef06e1c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/mockapi.ts @@ -0,0 +1,23 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Server_Path_Multiple_noOperationParams = passOnSuccess({ + uri: "/server/path/multiple/v1.0", + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Server_Path_Multiple_withOperationPathParam = passOnSuccess({ + uri: "/server/path/multiple/v1.0/test", + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/main.tsp new file mode 100644 index 00000000000..fd8713c47a6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/main.tsp @@ -0,0 +1,24 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates server with a single path parameter @server") +@service +@server( + "{endpoint}", + "Testserver endpoint", + { + @doc("Need to be set as 'http://localhost:3000' in client.") + endpoint: url, + } +) +@route("/server/path/single") +namespace Server.Path.Single; + +@scenario +@scenarioDoc("An simple operation in a parameterized server.") +@route("/myOp") +@head +op myOp(): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/mockapi.ts new file mode 100644 index 00000000000..93619e73574 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/mockapi.ts @@ -0,0 +1,13 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Server_Path_Single_myOp = passOnSuccess({ + uri: "/server/path/single/myOp", + method: "head", + request: {}, + response: { + status: 200, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/main.tsp new file mode 100644 index 00000000000..0f8bafb36cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/main.tsp @@ -0,0 +1,40 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +/** + * Illustrates not-versioned server. + */ +@service +@server( + "{endpoint}", + "Testserver endpoint", + { + /** + * Need to be set as 'http://localhost:3000' in client. + */ + endpoint: url, + } +) +@route("/server/versions/not-versioned") +namespace Server.Versions.NotVersioned; + +@scenario +@scenarioDoc("A simple operation without api-version. Expected url: '/without-api-version', it should not contain any api-version.") +@route("/without-api-version") +@head +op withoutApiVersion(): OkResponse; + +@scenario +@scenarioDoc("A simple operation with query api-version, which doesn't have any default value. Expected url: '/with-query-api-version?api-version=v1.0'.") +@route("/with-query-api-version") +@head +op withQueryApiVersion(@query("api-version") apiVersion: string): OkResponse; + +@scenario +@scenarioDoc("A simple operation with path api-version, which doesn't have any default value. Expected url: '/with-path-api-version/v1.0'.") +@route("/with-path-api-version") +@head +op withPathApiVersion(@path apiVersion: string): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/mockapi.ts new file mode 100644 index 00000000000..c08ac66b0cb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/mockapi.ts @@ -0,0 +1,51 @@ +import { MockRequest, passOnSuccess, ScenarioMockApi, ValidationError } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createServerTests(uri: string, requestData?: any) { + let requestObject: any; + if (requestData) { + requestObject = requestData; + } else { + requestObject = {}; + } + return passOnSuccess({ + uri, + method: "head", + request: requestObject, + response: { + status: 200, + }, + handler: (req: MockRequest) => { + if (Object.keys(req.query).length > 0) { + throw new ValidationError( + "Expected no query parameters including api-version", + "No query parameters", + req.query, + ); + } + return { status: 200 }; + }, + kind: "MockApiDefinition", + }); +} + +Scenarios.Server_Versions_NotVersioned_withoutApiVersion = createServerTests( + "/server/versions/not-versioned/without-api-version", +); +Scenarios.Server_Versions_NotVersioned_withPathApiVersion = createServerTests( + "/server/versions/not-versioned/with-path-api-version/v1.0", +); +Scenarios.Server_Versions_NotVersioned_withQueryApiVersion = passOnSuccess({ + uri: "/server/versions/not-versioned/with-query-api-version", + method: "head", + request: { + query: { + "api-version": "v1.0", + }, + }, + response: { + status: 200, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/main.tsp new file mode 100644 index 00000000000..d8fc46e3c05 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/main.tsp @@ -0,0 +1,64 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@typespec/versioning"; + +using Http; +using Spector; +using Versioning; + +/** + * Illustrates versioned server. + */ +@service +@versioned(Versions) +@server( + "{endpoint}", + "Testserver endpoint", + { + /** + * Need to be set as 'http://localhost:3000' in client. + */ + endpoint: url, + } +) +@route("/server/versions/versioned") +namespace Server.Versions.Versioned; + +/** + * The version of the API. + */ +enum Versions { + /** + * The version 2022-12-01-preview. + */ + v2021_01_01_preview: "2021-01-01-preview", + + /** + * The version 2022-12-01-preview. + */ + v2022_12_01_preview: "2022-12-01-preview", +} + +@scenario +@scenarioDoc("A simple operation without api-version. Expected url: '/without-api-version', it should not contain any api-version.") +@route("/without-api-version") +@head +op withoutApiVersion(): OkResponse; + +@scenario +@scenarioDoc("A simple operation with query api-version, whose default value is defined as '2022-12-01-preview'. Expected url: '/with-query-api-version?api-version=2022-12-01-preview'.") +@route("/with-query-api-version") +@head +op withQueryApiVersion(@query("api-version") apiVersion: string): OkResponse; + +@scenario +@scenarioDoc("A simple operation with path api-version, whose default value is defined as '2022-12-01-preview'. Expected url: '/with-path-api-version/2022-12-01-preview'.") +@route("/with-path-api-version") +@head +op withPathApiVersion(@path apiVersion: string): OkResponse; + +@scenario +@scenarioDoc("A simple operation with query api-version, that do NOT use the default but '2021-01-01-preview'. It's expected to be set at the client level. Expected url: '/with-old-query-api-version?api-version=2021-01-01-preview'.") +@route("/with-query-old-api-version") +@head +op withQueryOldApiVersion(@query("api-version") apiVersion: string): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/mockapi.ts new file mode 100644 index 00000000000..2e3e41d9236 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/mockapi.ts @@ -0,0 +1,58 @@ +import { MockRequest, passOnSuccess, ScenarioMockApi, ValidationError } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createServerTests(uri: string) { + return passOnSuccess({ + uri, + method: "head", + request: {}, + response: { + status: 200, + }, + handler: (req: MockRequest) => { + if (Object.keys(req.query).length > 0) { + throw new ValidationError( + "Expected no query parameters including api-version", + "No query parameters", + req.query, + ); + } + return { status: 200 }; + }, + kind: "MockApiDefinition", + }); +} + +Scenarios.Server_Versions_Versioned_withoutApiVersion = createServerTests( + "/server/versions/versioned/without-api-version", +); +Scenarios.Server_Versions_Versioned_withPathApiVersion = createServerTests( + "/server/versions/versioned/with-path-api-version/2022-12-01-preview", +); + +function createAPIVersionTests(uri: string, version: string) { + return passOnSuccess({ + uri, + method: "head", + request: { + query: { + "api-version": version, + }, + }, + response: { + status: 200, + }, + kind: "MockApiDefinition", + }); +} + +Scenarios.Server_Versions_Versioned_withQueryOldApiVersion = createAPIVersionTests( + "/server/versions/versioned/with-query-old-api-version", + "2021-01-01-preview", +); + +Scenarios.Server_Versions_Versioned_withQueryApiVersion = createAPIVersionTests( + "/server/versions/versioned/with-query-api-version", + "2022-12-01-preview", +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/client.tsp new file mode 100644 index 00000000000..53215701eb8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/client.tsp @@ -0,0 +1,14 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/spector"; +import "@typespec/http"; +import "@typespec/versioning"; + +using Azure.ClientGenerator.Core; +using Spector; +using Versioning; + +@client({ + service: [Service.MultiService.ServiceA, Service.MultiService.ServiceB], +}) +namespace Service.MultiService.Combined; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/main.tsp new file mode 100644 index 00000000000..6f71022f937 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/main.tsp @@ -0,0 +1,61 @@ +import "@typespec/versioning"; +import "@typespec/http"; +import "@typespec/spector"; + +using Versioning; +using Http; +using Spector; + +namespace Service.MultiService; + +/* + * First service definition in a multi-service package with versioning + */ +@scenarioService("/service/multi-service/service-a") +@versioned(VersionsA) +namespace ServiceA { + enum VersionsA { + av1, + av2, + } + + @route("foo") + interface Foo { + @scenario + @scenarioDoc(""" + Test that a client can expose operations from multiple services. This operaton should be called like this: `client.foo.test(...)`. + + Expected path: /service/multi-service/service-a/foo/test + Expected query parameter: api-version=av2 + Expected 204 response. + """) + @route("/test") + test(@query("api-version") apiVersion: VersionsA): void; + } +} + +/** + * Second service definition in a multi-service package with versioning + */ +@scenarioService("/service/multi-service/service-b") +@versioned(VersionsB) +namespace ServiceB { + enum VersionsB { + bv1, + bv2, + } + + @route("bar") + interface Bar { + @scenario + @scenarioDoc(""" + Test that a client can expose operations from multiple services. This operaton should be called like this: `client.bar.test(...)`. + + Expected path: /service/multi-service/service-b/bar/test + Expected query parameter: api-version=bv2 + Expected 204 response. + """) + @route("/test") + test(@query("api-version") apiVersion: VersionsB): void; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/mockapi.ts new file mode 100644 index 00000000000..0f819722353 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/mockapi.ts @@ -0,0 +1,27 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Service_MultiService_ServiceA_Foo_test = passOnSuccess({ + uri: "/service/multi-service/service-a/foo/test", + method: "get", + request: { + query: { + "api-version": "av2", + }, + }, + response: { status: 204 }, + kind: "MockApiDefinition", +}); + +Scenarios.Service_MultiService_ServiceB_Bar_test = passOnSuccess({ + uri: "/service/multi-service/service-b/bar/test", + method: "get", + request: { + query: { + "api-version": "bv2", + }, + }, + response: { status: 204 }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/main.tsp new file mode 100644 index 00000000000..eb621c54438 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/main.tsp @@ -0,0 +1,89 @@ +import "@typespec/http"; +import "@typespec/versioning"; +import "@typespec/spector"; + +using Http; +using Spector; +using Versioning; + +@doc("Illustrates conditional request headers") +@scenarioService("/special-headers/conditional-request") +namespace SpecialHeaders.ConditionalRequest; + +@scenario +@doc(""" + Check when only If-Match in header is defined. + """) +@scenarioDoc(""" + Check when only If-Match in header is defined. + Expected header parameters: + - if-match="valid" + """) +@post +@route("/if-match") +op postIfMatch( + @header("If-Match") + @doc("The request should only proceed if an entity matches this string.") + ifMatch?: string, +): NoContentResponse; + +@scenario +@doc(""" + Check when only If-None-Match in header is defined. + """) +@scenarioDoc(""" + Check when only If-None-Match in header is defined. + Expected header parameters: + - if-nonematch="invalid" + """) +@post +@route("/if-none-match") +op postIfNoneMatch( + @header("If-None-Match") + @doc("The request should only proceed if no entity matches this string.") + ifNoneMatch?: string, +): NoContentResponse; + +@scenario +@doc(""" + Check when only If-Modified-Since in header is defined. + """) +@scenarioDoc(""" + Check when only If-Modified-Since in header is defined. + Expected header parameters: + - if-modified-since=Fri, 26 Aug 2022 14:38:00 GMT + """) +@head +@route("/if-modified-since") +op headIfModifiedSince( + @doc(""" + A timestamp indicating the last modified time of the resource known to the + client. The operation will be performed only if the resource on the service has + been modified since the specified time. + """) + @header("If-Modified-Since") + @encode(DateTimeKnownEncoding.rfc7231) + ifModifiedSince?: utcDateTime, +): NoContentResponse; + +@scenario +@doc(""" + Check when only If-Unmodified-Since in header is defined. + """) +@scenarioDoc(""" + Check when only If-Unmodified-Since in header is defined. + Expected header parameters: + - if-unmodified-since=Fri, 26 Aug 2022 14:38:00 GMT + """) +@post +@route("/if-unmodified-since") +op postIfUnmodifiedSince( + @doc(""" + A timestamp indicating the last modified time of the resource known to the + client. The operation will be performed only if the resource on the service has + not been modified since the specified time. + """) + @header("If-Unmodified-Since") + @encode(DateTimeKnownEncoding.rfc7231) + ifUnmodifiedSince?: utcDateTime, +): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/mockapi.ts new file mode 100644 index 00000000000..ddad3105af4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/mockapi.ts @@ -0,0 +1,59 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.SpecialHeaders_ConditionalRequest_postIfUnmodifiedSince = passOnSuccess({ + uri: "/special-headers/conditional-request/if-unmodified-since", + method: "post", + request: { + headers: { + "if-unmodified-since": "Fri, 26 Aug 2022 14:38:00 GMT", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.SpecialHeaders_ConditionalRequest_headIfModifiedSince = passOnSuccess({ + uri: "/special-headers/conditional-request/if-modified-since", + method: "head", + request: { + headers: { + "if-modified-since": "Fri, 26 Aug 2022 14:38:00 GMT", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.SpecialHeaders_ConditionalRequest_postIfMatch = passOnSuccess({ + uri: "/special-headers/conditional-request/if-match", + method: "post", + request: { + headers: { + "if-match": '"valid"', + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.SpecialHeaders_ConditionalRequest_postIfNoneMatch = passOnSuccess({ + uri: "/special-headers/conditional-request/if-none-match", + method: "post", + request: { + headers: { + "if-none-match": '"invalid"', + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/main.tsp new file mode 100644 index 00000000000..b40e5e93478 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/main.tsp @@ -0,0 +1,39 @@ +import "@typespec/http"; +import "@typespec/versioning"; +import "@typespec/spector"; + +using Http; +using Spector; +using Versioning; + +@doc("Illustrates OASIS repeatability headers") +@scenarioService("/special-headers/repeatability") +namespace SpecialHeaders.Repeatability; + +model RepeatableResponse { + @doc("The status code.") + @statusCode + statusCode: 204; + + @visibility(Lifecycle.Read) + @header("Repeatability-Result") + @doc("Indicates whether the repeatable request was accepted or rejected.") + repeatabilityResult?: "accepted" | "rejected"; +} + +@scenario +@scenarioDoc(""" + Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. + """) +@doc(""" + Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. + """) +@post +@route("/immediateSuccess") +op immediateSuccess( + @header("Repeatability-Request-ID") + repeatabilityRequestID: string, + + @header("Repeatability-First-Sent") + repeatabilityFirstSent: utcDateTime, +): RepeatableResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/mockapi.ts new file mode 100644 index 00000000000..5e24cc55666 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/mockapi.ts @@ -0,0 +1,47 @@ +import { + MockRequest, + passOnSuccess, + ScenarioMockApi, + validateValueFormat, + ValidationError, +} from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.SpecialHeaders_Repeatability_immediateSuccess = passOnSuccess({ + uri: "/special-headers/repeatability/immediateSuccess", + method: "post", + request: { + headers: { + "Repeatability-First-Sent": "Tue, 15 Nov 2022 12:45:26 GMT", + "Repeatability-Request-ID": "2378d9bc-1726-11ee-be56-0242ac120002", // fake uuid + }, + }, + response: { + status: 204, + headers: { + "repeatability-result": "accepted", + }, + }, + handler: (req: MockRequest) => { + if (!("repeatability-request-id" in req.headers)) { + throw new ValidationError("Repeatability-Request-ID is missing", "A UUID string", undefined); + } + if (!("repeatability-first-sent" in req.headers)) { + throw new ValidationError( + "Repeatability-First-Sent is missing", + "A date-time in headers format", + undefined, + ); + } + validateValueFormat(req.headers["repeatability-request-id"], "uuid"); + validateValueFormat(req.headers["repeatability-first-sent"], "rfc7231"); + return { + status: 204, + headers: { + "repeatability-result": "accepted", + }, + }; + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-words/dec.js b/packages/http-client-java/generator/http-client-generator-test/specs/special-words/dec.js new file mode 100644 index 00000000000..b3188c2b223 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/special-words/dec.js @@ -0,0 +1,52 @@ +// @ts-check + +import { $route } from "@typespec/http"; +import { $scenario, $scenarioDoc } from "@typespec/spector"; + +/** + * + * @param {*} context + * @param {*} target + * @param {*} name + */ +export function $opNameScenario(context, target, name) { + context.call($scenario, target, name.value); + context.call( + $scenarioDoc, + target, + `Verify that the name "${name.value}" works as an operation name. Call this operation to pass.`, + ); + context.call($route, target, `/${name.value}`); +} + +/** + * + * @param {*} context + * @param {*} target + * @param {*} name + */ +export function $paramNameScenario(context, target, name) { + context.call($scenario, target, name.value); + context.call( + $scenarioDoc, + target, + `Verify that the name "${name.value}" works. Send this parameter to pass with value \`ok\`.`, + ); + context.call($route, target, `/${name.value}`); +} + +/** + * + * @param {*} context + * @param {*} target + * @param {*} name + */ +export function $modelNameScenario(context, target, name) { + context.call($scenario, target, name.value); + context.call( + $scenarioDoc, + target, + `Verify that the name "${name.value}" works. Send\n\`\`\`json\n{"name": "ok"}\n\`\`\` `, + ); + context.call($route, target, `/${name.value}`); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-words/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/special-words/main.tsp new file mode 100644 index 00000000000..2705d858905 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/special-words/main.tsp @@ -0,0 +1,272 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "./dec.js"; + +using Http; +using Spector; + +/** + * Scenarios to verify that reserved words can be used in service and generators will handle it appropriately. + * + * Current list of special words + * ```txt + * and + * as + * assert + * async + * await + * break + * class + * constructor + * continue + * def + * del + * elif + * else + * except + * exec + * finally + * for + * from + * global + * if + * import + * in + * is + * lambda + * not + * or + * pass + * raise + * return + * try + * while + * with + * yield + * ``` + */ +@scenarioService("/special-words") +namespace SpecialWords; + +/** + * Test reserved words as operation name. + */ +@route("/operations") +interface Operations { + @opNameScenario("and") and(): void; + @opNameScenario("as") as(): void; + @opNameScenario("assert") assert(): void; + @opNameScenario("async") `async`(): void; + @opNameScenario("await") await(): void; + @opNameScenario("break") break(): void; + @opNameScenario("class") class(): void; + @opNameScenario("constructor") constructor(): void; + @opNameScenario("continue") continue(): void; + @opNameScenario("def") def(): void; + @opNameScenario("del") del(): void; + @opNameScenario("elif") elif(): void; + @opNameScenario("else") `else`(): void; + @opNameScenario("except") except(): void; + @opNameScenario("exec") exec(): void; + @opNameScenario("finally") finally(): void; + @opNameScenario("for") for(): void; + @opNameScenario("from") from(): void; + @opNameScenario("global") global(): void; + @opNameScenario("if") `if`(): void; + @opNameScenario("import") `import`(): void; + @opNameScenario("in") in(): void; + @opNameScenario("is") `is`(): void; + @opNameScenario("lambda") lambda(): void; + @opNameScenario("not") not(): void; + @opNameScenario("or") or(): void; + @opNameScenario("pass") pass(): void; + @opNameScenario("raise") raise(): void; + @opNameScenario("return") `return`(): void; + @opNameScenario("try") try(): void; + @opNameScenario("while") while(): void; + @opNameScenario("with") `with`(): void; + @opNameScenario("yield") yield(): void; +} + +/** + * Verify reserved words as parameter name. + */ +@route("/parameters") +interface Parameters { + @paramNameScenario("and") withAnd(@query and: string): void; + @paramNameScenario("as") withAs(@query as: string): void; + @paramNameScenario("assert") withAssert(@query assert: string): void; + @paramNameScenario("async") withAsync(@query async: string): void; + @paramNameScenario("await") withAwait(@query await: string): void; + @paramNameScenario("break") withBreak(@query break: string): void; + @paramNameScenario("class") withClass(@query class: string): void; + @paramNameScenario("constructor") withConstructor(@query constructor: string): void; + @paramNameScenario("continue") withContinue(@query continue: string): void; + @paramNameScenario("def") withDef(@query def: string): void; + @paramNameScenario("del") withDel(@query del: string): void; + @paramNameScenario("elif") withElif(@query elif: string): void; + @paramNameScenario("else") withElse(@query `else`: string): void; + @paramNameScenario("except") withExcept(@query except: string): void; + @paramNameScenario("exec") withExec(@query exec: string): void; + @paramNameScenario("finally") withFinally(@query finally: string): void; + @paramNameScenario("for") withFor(@query for: string): void; + @paramNameScenario("from") withFrom(@query from: string): void; + @paramNameScenario("global") withGlobal(@query global: string): void; + @paramNameScenario("if") withIf(@query `if`: string): void; + @paramNameScenario("import") withImport(@query `import`: string): void; + @paramNameScenario("in") withIn(@query in: string): void; + @paramNameScenario("is") withIs(@query `is`: string): void; + @paramNameScenario("lambda") withLambda(@query lambda: string): void; + @paramNameScenario("not") withNot(@query not: string): void; + @paramNameScenario("or") withOr(@query or: string): void; + @paramNameScenario("pass") withPass(@query pass: string): void; + @paramNameScenario("raise") withRaise(@query raise: string): void; + @paramNameScenario("return") withReturn(@query `return`: string): void; + @paramNameScenario("try") withTry(@query try: string): void; + @paramNameScenario("while") withWhile(@query while: string): void; + @paramNameScenario("with") withWith(@query with: string): void; + @paramNameScenario("yield") withYield(@query yield: string): void; + + // Non keywords but parameters name that could cause conflict with some language standards + @paramNameScenario("cancellationToken") withCancellationToken( + @query cancellationToken: string, + ): void; +} + +/** + * Verify model names + */ +@route("/models") +namespace Models { + model Base { + name: string; + } + model and is Base; + model as is Base; + model assert is Base; + model `async` is Base; + model await is Base; + model break is Base; + model class is Base; + model continue is Base; + model constructor is Base; + model def is Base; + model del is Base; + model elif is Base; + model `else` is Base; + model except is Base; + model exec is Base; + model finally is Base; + model for is Base; + model from is Base; + model global is Base; + model `if` is Base; + model `import` is Base; + model in is Base; + model `is` is Base; + model lambda is Base; + model not is Base; + model or is Base; + model pass is Base; + model raise is Base; + model `return` is Base; + model try is Base; + model while is Base; + model `with` is Base; + model yield is Base; + + @modelNameScenario("and") op withAnd(@body body: and): void; + @modelNameScenario("as") op withAs(@body body: as): void; + @modelNameScenario("assert") op withAssert(@body body: assert): void; + @modelNameScenario("async") op withAsync(@body body: `async`): void; + @modelNameScenario("await") op withAwait(@body body: await): void; + @modelNameScenario("break") op withBreak(@body body: break): void; + @modelNameScenario("class") op withClass(@body body: class): void; + @modelNameScenario("constructor") op withConstructor(@body body: constructor): void; + @modelNameScenario("continue") op withContinue(@body body: continue): void; + @modelNameScenario("def") op withDef(@body body: def): void; + @modelNameScenario("del") op withDel(@body body: del): void; + @modelNameScenario("elif") op withElif(@body body: elif): void; + @modelNameScenario("else") op withElse(@body body: `else`): void; + @modelNameScenario("except") op withExcept(@body body: except): void; + @modelNameScenario("exec") op withExec(@body body: exec): void; + @modelNameScenario("finally") op withFinally(@body body: finally): void; + @modelNameScenario("for") op withFor(@body body: for): void; + @modelNameScenario("from") op withFrom(@body body: from): void; + @modelNameScenario("global") op withGlobal(@body body: global): void; + @modelNameScenario("if") op withIf(@body body: `if`): void; + @modelNameScenario("import") op withImport(@body body: `import`): void; + @modelNameScenario("in") op withIn(@body body: in): void; + @modelNameScenario("is") op withIs(@body body: `is`): void; + @modelNameScenario("lambda") op withLambda(@body body: lambda): void; + @modelNameScenario("not") op withNot(@body body: not): void; + @modelNameScenario("or") op withOr(@body body: or): void; + @modelNameScenario("pass") op withPass(@body body: pass): void; + @modelNameScenario("raise") op withRaise(@body body: raise): void; + @modelNameScenario("return") op withReturn(@body body: `return`): void; + @modelNameScenario("try") op withTry(@body body: try): void; + @modelNameScenario("while") op withWhile(@body body: while): void; + @modelNameScenario("with") op withWith(@body body: `with`): void; + @modelNameScenario("yield") op withYield(@body body: yield): void; +} + +/** + * Verify model names + */ +@route("/model-properties") +namespace ModelProperties { + model SameAsModel { + SameAsModel: string; + } + + @scenario + @scenarioDoc(""" + Verify that a property can be called the same as the model name. This can be an issue in some languages where the class name is the constructor. + + Send + + ```json + {"SameAsModel": "ok"} + ``` + """) + @route("same-as-model") + op sameAsModel(@body body: SameAsModel): void; + + // Python dict method names that could conflict + model DictMethods { + keys: string; + items: string; + values: string; + popitem: string; + clear: string; + update: string; + setdefault: string; + pop: string; + get: string; + copy: string; + } + + @scenario + @scenarioDoc(""" + Verify that model properties can use names that are Python dict methods. These names (keys, items, values, etc.) may conflict with Python's dict class methods. + + Send + + ```json + { + "keys": "ok", + "items": "ok", + "values": "ok", + "popitem": "ok", + "clear": "ok", + "update": "ok", + "setdefault": "ok", + "pop": "ok", + "get": "ok", + "copy": "ok" + } + ``` + """) + @route("dict-methods") + op dictMethods(@body body: DictMethods): void; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-words/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/special-words/mockapi.ts new file mode 100644 index 00000000000..4d2883b10f1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/special-words/mockapi.ts @@ -0,0 +1,407 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.SpecialWords_ModelProperties_sameAsModel = passOnSuccess({ + uri: "/special-words/model-properties/same-as-model", + method: "post", + request: { + body: json({ + SameAsModel: "ok", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.SpecialWords_ModelProperties_dictMethods = passOnSuccess({ + uri: "/special-words/model-properties/dict-methods", + method: "post", + request: { + body: json({ + keys: "ok", + items: "ok", + values: "ok", + popitem: "ok", + clear: "ok", + update: "ok", + setdefault: "ok", + pop: "ok", + get: "ok", + copy: "ok", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +function createModelsTests(uri: string) { + return passOnSuccess({ + uri, + method: "post", + request: { + body: json({ + name: "ok", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }); +} +Scenarios.SpecialWords_Models_and = createModelsTests(`/special-words/models/and`); +Scenarios.SpecialWords_Models_as = createModelsTests(`/special-words/models/as`); +Scenarios.SpecialWords_Models_assert = createModelsTests(`/special-words/models/assert`); +Scenarios.SpecialWords_Models_async = createModelsTests(`/special-words/models/async`); +Scenarios.SpecialWords_Models_await = createModelsTests(`/special-words/models/await`); +Scenarios.SpecialWords_Models_break = createModelsTests(`/special-words/models/break`); +Scenarios.SpecialWords_Models_class = createModelsTests(`/special-words/models/class`); +Scenarios.SpecialWords_Models_constructor = createModelsTests(`/special-words/models/constructor`); +Scenarios.SpecialWords_Models_continue = createModelsTests(`/special-words/models/continue`); +Scenarios.SpecialWords_Models_def = createModelsTests(`/special-words/models/def`); +Scenarios.SpecialWords_Models_del = createModelsTests(`/special-words/models/del`); +Scenarios.SpecialWords_Models_elif = createModelsTests(`/special-words/models/elif`); +Scenarios.SpecialWords_Models_else = createModelsTests(`/special-words/models/else`); +Scenarios.SpecialWords_Models_except = createModelsTests(`/special-words/models/except`); +Scenarios.SpecialWords_Models_exec = createModelsTests(`/special-words/models/exec`); +Scenarios.SpecialWords_Models_finally = createModelsTests(`/special-words/models/finally`); +Scenarios.SpecialWords_Models_for = createModelsTests(`/special-words/models/for`); +Scenarios.SpecialWords_Models_from = createModelsTests(`/special-words/models/from`); +Scenarios.SpecialWords_Models_global = createModelsTests(`/special-words/models/global`); +Scenarios.SpecialWords_Models_if = createModelsTests(`/special-words/models/if`); +Scenarios.SpecialWords_Models_import = createModelsTests(`/special-words/models/import`); +Scenarios.SpecialWords_Models_in = createModelsTests(`/special-words/models/in`); +Scenarios.SpecialWords_Models_is = createModelsTests(`/special-words/models/is`); +Scenarios.SpecialWords_Models_lambda = createModelsTests(`/special-words/models/lambda`); +Scenarios.SpecialWords_Models_not = createModelsTests(`/special-words/models/not`); +Scenarios.SpecialWords_Models_or = createModelsTests(`/special-words/models/or`); +Scenarios.SpecialWords_Models_pass = createModelsTests(`/special-words/models/pass`); +Scenarios.SpecialWords_Models_raise = createModelsTests(`/special-words/models/raise`); +Scenarios.SpecialWords_Models_return = createModelsTests(`/special-words/models/return`); +Scenarios.SpecialWords_Models_try = createModelsTests(`/special-words/models/try`); +Scenarios.SpecialWords_Models_while = createModelsTests(`/special-words/models/while`); +Scenarios.SpecialWords_Models_with = createModelsTests(`/special-words/models/with`); +Scenarios.SpecialWords_Models_yield = createModelsTests(`/special-words/models/yield`); + +function createOperationsTests(uri: string) { + return passOnSuccess({ + uri, + method: "get", + request: {}, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }); +} + +Scenarios.SpecialWords_Operations_and = createOperationsTests(`/special-words/operations/and`); +Scenarios.SpecialWords_Operations_as = createOperationsTests(`/special-words/operations/as`); +Scenarios.SpecialWords_Operations_assert = createOperationsTests( + `/special-words/operations/assert`, +); +Scenarios.SpecialWords_Operations_async = createOperationsTests(`/special-words/operations/async`); +Scenarios.SpecialWords_Operations_await = createOperationsTests(`/special-words/operations/await`); +Scenarios.SpecialWords_Operations_break = createOperationsTests(`/special-words/operations/break`); +Scenarios.SpecialWords_Operations_class = createOperationsTests(`/special-words/operations/class`); +Scenarios.SpecialWords_Operations_constructor = createOperationsTests( + `/special-words/operations/constructor`, +); +Scenarios.SpecialWords_Operations_continue = createOperationsTests( + `/special-words/operations/continue`, +); +Scenarios.SpecialWords_Operations_def = createOperationsTests(`/special-words/operations/def`); +Scenarios.SpecialWords_Operations_del = createOperationsTests(`/special-words/operations/del`); +Scenarios.SpecialWords_Operations_elif = createOperationsTests(`/special-words/operations/elif`); +Scenarios.SpecialWords_Operations_else = createOperationsTests(`/special-words/operations/else`); +Scenarios.SpecialWords_Operations_except = createOperationsTests( + `/special-words/operations/except`, +); +Scenarios.SpecialWords_Operations_exec = createOperationsTests(`/special-words/operations/exec`); +Scenarios.SpecialWords_Operations_finally = createOperationsTests( + `/special-words/operations/finally`, +); +Scenarios.SpecialWords_Operations_for = createOperationsTests(`/special-words/operations/for`); +Scenarios.SpecialWords_Operations_from = createOperationsTests(`/special-words/operations/from`); +Scenarios.SpecialWords_Operations_global = createOperationsTests( + `/special-words/operations/global`, +); +Scenarios.SpecialWords_Operations_if = createOperationsTests(`/special-words/operations/if`); +Scenarios.SpecialWords_Operations_import = createOperationsTests( + `/special-words/operations/import`, +); +Scenarios.SpecialWords_Operations_in = createOperationsTests(`/special-words/operations/in`); +Scenarios.SpecialWords_Operations_is = createOperationsTests(`/special-words/operations/is`); +Scenarios.SpecialWords_Operations_lambda = createOperationsTests( + `/special-words/operations/lambda`, +); +Scenarios.SpecialWords_Operations_not = createOperationsTests(`/special-words/operations/not`); +Scenarios.SpecialWords_Operations_or = createOperationsTests(`/special-words/operations/or`); +Scenarios.SpecialWords_Operations_pass = createOperationsTests(`/special-words/operations/pass`); +Scenarios.SpecialWords_Operations_raise = createOperationsTests(`/special-words/operations/raise`); +Scenarios.SpecialWords_Operations_return = createOperationsTests( + `/special-words/operations/return`, +); +Scenarios.SpecialWords_Operations_try = createOperationsTests(`/special-words/operations/try`); +Scenarios.SpecialWords_Operations_while = createOperationsTests(`/special-words/operations/while`); +Scenarios.SpecialWords_Operations_with = createOperationsTests(`/special-words/operations/with`); +Scenarios.SpecialWords_Operations_yield = createOperationsTests(`/special-words/operations/yield`); + +function createParametersTests(uri: string, data: any, paramName: string) { + return passOnSuccess({ + uri, + method: "get", + request: { + query: data, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }); +} + +Scenarios.SpecialWords_Parameters_and = createParametersTests( + `/special-words/parameters/and`, + { + and: "ok", + }, + "and", +); +Scenarios.SpecialWords_Parameters_as = createParametersTests( + `/special-words/parameters/as`, + { + as: "ok", + }, + "as", +); +Scenarios.SpecialWords_Parameters_assert = createParametersTests( + `/special-words/parameters/assert`, + { + assert: "ok", + }, + "assert", +); +Scenarios.SpecialWords_Parameters_async = createParametersTests( + `/special-words/parameters/async`, + { + async: "ok", + }, + "async", +); +Scenarios.SpecialWords_Parameters_await = createParametersTests( + `/special-words/parameters/await`, + { + await: "ok", + }, + "await", +); +Scenarios.SpecialWords_Parameters_break = createParametersTests( + `/special-words/parameters/break`, + { + break: "ok", + }, + "break", +); +Scenarios.SpecialWords_Parameters_class = createParametersTests( + `/special-words/parameters/class`, + { + class: "ok", + }, + "class", +); +Scenarios.SpecialWords_Parameters_constructor = createParametersTests( + `/special-words/parameters/constructor`, + { + constructor: "ok", + }, + "constructor", +); +Scenarios.SpecialWords_Parameters_continue = createParametersTests( + `/special-words/parameters/continue`, + { + continue: "ok", + }, + "continue", +); +Scenarios.SpecialWords_Parameters_def = createParametersTests( + `/special-words/parameters/def`, + { + def: "ok", + }, + "def", +); +Scenarios.SpecialWords_Parameters_del = createParametersTests( + `/special-words/parameters/del`, + { + del: "ok", + }, + "del", +); +Scenarios.SpecialWords_Parameters_elif = createParametersTests( + `/special-words/parameters/elif`, + { + elif: "ok", + }, + "elif", +); +Scenarios.SpecialWords_Parameters_else = createParametersTests( + `/special-words/parameters/else`, + { + else: "ok", + }, + "else", +); +Scenarios.SpecialWords_Parameters_except = createParametersTests( + `/special-words/parameters/except`, + { + except: "ok", + }, + "except", +); +Scenarios.SpecialWords_Parameters_exec = createParametersTests( + `/special-words/parameters/exec`, + { + exec: "ok", + }, + "exec", +); +Scenarios.SpecialWords_Parameters_finally = createParametersTests( + `/special-words/parameters/finally`, + { + finally: "ok", + }, + "finally", +); + +Scenarios.SpecialWords_Parameters_for = createParametersTests( + `/special-words/parameters/for`, + { + for: "ok", + }, + "for", +); +Scenarios.SpecialWords_Parameters_from = createParametersTests( + `/special-words/parameters/from`, + { + from: "ok", + }, + "from", +); +Scenarios.SpecialWords_Parameters_global = createParametersTests( + `/special-words/parameters/global`, + { + global: "ok", + }, + "global", +); +Scenarios.SpecialWords_Parameters_if = createParametersTests( + `/special-words/parameters/if`, + { + if: "ok", + }, + "if", +); +Scenarios.SpecialWords_Parameters_import = createParametersTests( + `/special-words/parameters/import`, + { + import: "ok", + }, + "import", +); +Scenarios.SpecialWords_Parameters_in = createParametersTests( + `/special-words/parameters/in`, + { + in: "ok", + }, + "in", +); +Scenarios.SpecialWords_Parameters_is = createParametersTests( + `/special-words/parameters/is`, + { + is: "ok", + }, + "is", +); +Scenarios.SpecialWords_Parameters_lambda = createParametersTests( + `/special-words/parameters/lambda`, + { + lambda: "ok", + }, + "lambda", +); +Scenarios.SpecialWords_Parameters_not = createParametersTests( + `/special-words/parameters/not`, + { + not: "ok", + }, + "not", +); +Scenarios.SpecialWords_Parameters_or = createParametersTests( + `/special-words/parameters/or`, + { + or: "ok", + }, + "or", +); +Scenarios.SpecialWords_Parameters_pass = createParametersTests( + `/special-words/parameters/pass`, + { + pass: "ok", + }, + "pass", +); +Scenarios.SpecialWords_Parameters_raise = createParametersTests( + `/special-words/parameters/raise`, + { + raise: "ok", + }, + "raise", +); +Scenarios.SpecialWords_Parameters_return = createParametersTests( + `/special-words/parameters/return`, + { + return: "ok", + }, + "return", +); +Scenarios.SpecialWords_Parameters_try = createParametersTests( + `/special-words/parameters/try`, + { + try: "ok", + }, + "try", +); +Scenarios.SpecialWords_Parameters_while = createParametersTests( + `/special-words/parameters/while`, + { + while: "ok", + }, + "while", +); +Scenarios.SpecialWords_Parameters_with = createParametersTests( + `/special-words/parameters/with`, + { + with: "ok", + }, + "with", +); +Scenarios.SpecialWords_Parameters_yield = createParametersTests( + `/special-words/parameters/yield`, + { + yield: "ok", + }, + "yield", +); +Scenarios.SpecialWords_Parameters_cancellationToken = createParametersTests( + `/special-words/parameters/cancellationToken`, + { + cancellationToken: "ok", + }, + "cancellationToken", +); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/main.tsp new file mode 100644 index 00000000000..8ea66967ce3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/main.tsp @@ -0,0 +1,33 @@ +import "@typespec/http"; +import "@typespec/http/streams"; +import "@typespec/spector"; + +using Http; +using Http.Streams; +using Spector; + +@doc("Test of jsonl streaming.") +@scenarioService("/streaming/jsonl") +namespace Streaming.Jsonl; + +@route("basic") +namespace Basic { + @scenario + @scenarioDoc(""" + Basic jsonl streaming for request. + """) + @route("send") + @post + op send(stream: JsonlStream): NoContentResponse; + + @scenario + @scenarioDoc(""" + Basic jsonl streaming for response. + """) + @route("receive") + op receive(): JsonlStream; + + model Info { + desc: string; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/mockapi.ts new file mode 100644 index 00000000000..5b11022fc7e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/mockapi.ts @@ -0,0 +1,32 @@ +import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Streaming_Jsonl_Basic_send = passOnSuccess({ + uri: "/streaming/jsonl/basic/send", + method: "post", + request: { + body: { + rawContent: Buffer.from('{"desc": "one"}\n{"desc": "two"}\n{"desc": "three"}'), + contentType: "application/jsonl", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Streaming_Jsonl_Basic_receive = passOnSuccess({ + uri: "/streaming/jsonl/basic/receive", + method: "get", + request: {}, + response: { + status: 200, + body: { + rawContent: Buffer.from('{"desc": "one"}\n{"desc": "two"}\n{"desc": "three"}'), + contentType: "application/jsonl", + }, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/array/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/array/main.tsp new file mode 100644 index 00000000000..b91b2fe6847 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/array/main.tsp @@ -0,0 +1,108 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates various types of arrays.") +@scenarioService("/type/array") +namespace Type.Array; + +@doc("Template to have Array operations") +interface ArrayOperations { + @scenario + @scenarioDoc(""" + Expected Array response body: + ```json + ${TDoc} + ``` + """) + @get + get(): TArr; + + @scenario + @scenarioDoc(""" + Expected Array input body: + ```json + ${TDoc} + ``` + """) + @put + put(@body body: TArr): void; +} + +@doc("Array of int32 values") +@route("/int32") +interface Int32Value extends ArrayOperations {} + +@doc("Array of int64 values") +@route("/int64") +interface Int64Value + extends ArrayOperations {} + +@doc("Array of boolean values") +@route("/boolean") +interface BooleanValue extends ArrayOperations {} + +@doc("Array of string values") +@route("/string") +interface StringValue extends ArrayOperations {} + +@doc("Array of float values") +@route("/float32") +interface Float32Value extends ArrayOperations {} + +@doc("Array of datetime values") +@route("/datetime") +interface DatetimeValue extends ArrayOperations {} + +@doc("Array of duration values") +@route("/duration") +interface DurationValue extends ArrayOperations {} + +@doc("Array of unknown values") +@route("/unknown") +interface UnknownValue extends ArrayOperations {} + +@doc("Array inner model") +model InnerModel { + @doc("Required string property") + property: string; + + children?: InnerModel[]; +} + +@doc("Array of model values") +@route("/model") +interface ModelValue + extends ArrayOperations {} + +alias NullableFloat = float32 | null; +@doc("Array of nullable float values") +@route("/nullable-float") +interface NullableFloatValue extends ArrayOperations {} + +alias NullableInt32 = int32 | null; +@doc("Array of nullable int32 values") +@route("/nullable-int32") +interface NullableInt32Value extends ArrayOperations {} + +alias NullableBoolean = boolean | null; +@doc("Array of nullable boolean values") +@route("/nullable-boolean") +interface NullableBooleanValue extends ArrayOperations {} + +alias NullableString = string | null; +@doc("Array of nullable string values") +@route("/nullable-string") +interface NullableStringValue + extends ArrayOperations {} + +alias NullableModel = InnerModel | null; +@doc("Array of nullable model values") +@route("/nullable-model") +interface NullableModelValue + extends ArrayOperations< + NullableModel[], + "[{'property': 'hello'}, null, {'property': 'world'}]" + > {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/array/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/array/mockapi.ts new file mode 100644 index 00000000000..7bab93b261b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/array/mockapi.ts @@ -0,0 +1,107 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createServerTests(uri: string, data: any) { + return { + get: passOnSuccess({ + uri, + method: "get", + request: {}, + response: { + status: 200, + body: json(data), + }, + kind: "MockApiDefinition", + }), + put: passOnSuccess({ + uri, + method: "put", + request: { + body: json(data), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }), + }; +} + +const Type_Array_Int32 = createServerTests(`/type/array/int32`, [1, 2]); +Scenarios.Type_Array_Int32Value_get = Type_Array_Int32.get; +Scenarios.Type_Array_Int32Value_put = Type_Array_Int32.put; + +const Type_Array_Int64 = createServerTests(`/type/array/int64`, [ + Number.MAX_SAFE_INTEGER, + Number.MIN_SAFE_INTEGER, +]); +Scenarios.Type_Array_Int64Value_get = Type_Array_Int64.get; +Scenarios.Type_Array_Int64Value_put = Type_Array_Int64.put; + +const Type_Array_Boolean = createServerTests(`/type/array/boolean`, [true, false]); +Scenarios.Type_Array_BooleanValue_get = Type_Array_Boolean.get; +Scenarios.Type_Array_BooleanValue_put = Type_Array_Boolean.put; + +const Type_Array_String = createServerTests(`/type/array/string`, ["hello", ""]); +Scenarios.Type_Array_StringValue_get = Type_Array_String.get; +Scenarios.Type_Array_StringValue_put = Type_Array_String.put; + +const Type_Array_Float32 = createServerTests(`/type/array/float32`, [43.125]); +Scenarios.Type_Array_Float32Value_get = Type_Array_Float32.get; +Scenarios.Type_Array_Float32Value_put = Type_Array_Float32.put; + +const Type_Array_Datetime = createServerTests(`/type/array/datetime`, ["2022-08-26T18:38:00Z"]); +Scenarios.Type_Array_DatetimeValue_get = Type_Array_Datetime.get; +Scenarios.Type_Array_DatetimeValue_put = Type_Array_Datetime.put; + +const Type_Array_Duration = createServerTests(`/type/array/duration`, ["P123DT22H14M12.011S"]); +Scenarios.Type_Array_DurationValue_get = Type_Array_Duration.get; +Scenarios.Type_Array_DurationValue_put = Type_Array_Duration.put; + +const Type_Array_Unknown = createServerTests(`/type/array/unknown`, [1, "hello", null]); +Scenarios.Type_Array_UnknownValue_get = Type_Array_Unknown.get; +Scenarios.Type_Array_UnknownValue_put = Type_Array_Unknown.put; + +const Type_Array_Model = createServerTests(`/type/array/model`, [ + { property: "hello" }, + { property: "world" }, +]); +Scenarios.Type_Array_ModelValue_get = Type_Array_Model.get; +Scenarios.Type_Array_ModelValue_put = Type_Array_Model.put; + +const Type_Array_Nullable_Float = createServerTests(`/type/array/nullable-float`, [ + 1.25, + null, + 3.0, +]); +Scenarios.Type_Array_NullableFloatValue_get = Type_Array_Nullable_Float.get; +Scenarios.Type_Array_NullableFloatValue_put = Type_Array_Nullable_Float.put; + +const Type_Array_Nullable_Boolean = createServerTests(`/type/array/nullable-boolean`, [ + true, + null, + false, +]); +Scenarios.Type_Array_NullableBooleanValue_get = Type_Array_Nullable_Boolean.get; +Scenarios.Type_Array_NullableBooleanValue_put = Type_Array_Nullable_Boolean.put; + +const Type_Array_Nullable_Int32 = createServerTests(`/type/array/nullable-int32`, [1, null, 3]); +Scenarios.Type_Array_NullableInt32Value_get = Type_Array_Nullable_Int32.get; +Scenarios.Type_Array_NullableInt32Value_put = Type_Array_Nullable_Int32.put; + +const Type_Array_Nullable_String = createServerTests(`/type/array/nullable-string`, [ + "hello", + null, + "world", +]); +Scenarios.Type_Array_NullableStringValue_get = Type_Array_Nullable_String.get; +Scenarios.Type_Array_NullableStringValue_put = Type_Array_Nullable_String.put; + +const Type_Array_Nullable_Model = createServerTests(`/type/array/nullable-model`, [ + { property: "hello" }, + null, + { property: "world" }, +]); +Scenarios.Type_Array_NullableModelValue_get = Type_Array_Nullable_Model.get; +Scenarios.Type_Array_NullableModelValue_put = Type_Array_Nullable_Model.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/main.tsp new file mode 100644 index 00000000000..bf8f5586524 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/main.tsp @@ -0,0 +1,101 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates various of dictionaries.") +@scenarioService("/type/dictionary") +namespace Type.Dictionary; + +@doc("Template to have dictionary operations") +interface DictionaryOperations { + @scenario + @scenarioDoc(""" + Expected dictionary response body: + ```json + ${TDoc} + ``` + """) + @get + get(): TDict; + + @scenario + @scenarioDoc(""" + Expected dictionary input body: + ```json + ${TDoc} + ``` + """) + @put + put(@body body: TDict): void; +} + +@doc("Dictionary of int32 values") +@route("/int32") +interface Int32Value extends DictionaryOperations, "{'k1': 1, 'k2': 2}"> {} + +@doc("Dictionary of int64 values") +@route("/int64") +interface Int64Value + extends DictionaryOperations< + Record, + "{'k1': 0x7FFFFFFFFFFFFFFF, 'k2': -0x7FFFFFFFFFFFFFFF}" + > {} + +@doc("Dictionary of boolean values") +@route("/boolean") +interface BooleanValue extends DictionaryOperations, "{'k1': true, 'k2': false}"> {} + +@doc("Dictionary of string values") +@route("/string") +interface StringValue extends DictionaryOperations, "{'k1': 'hello', 'k2': ''}"> {} + +@doc("Dictionary of float values") +@route("/float32") +interface Float32Value extends DictionaryOperations, "{'k1': 43.125}"> {} + +@doc("Dictionary of datetime values") +@route("/datetime") +interface DatetimeValue + extends DictionaryOperations, "{'k1': '2022-08-26T18:38:00Z'}"> {} + +@doc("Dictionary of duration values") +@route("/duration") +interface DurationValue + extends DictionaryOperations, "{'k1': 'P123DT22H14M12.011S'}"> {} + +@doc("Dictionary of unknown values") +@route("/unknown") +interface UnknownValue + extends DictionaryOperations, "{'k1': 1, 'k2': 'hello', 'k3': null}"> {} + +@doc("Dictionary inner model") +model InnerModel { + @doc("Required string property") + property: string; + + children?: Record; +} + +@doc("Dictionary of model values") +@route("/model") +interface ModelValue + extends DictionaryOperations< + Record, + "{'k1': {'property': 'hello'}, 'k2': {'property': 'world'}}" + > {} + +@doc("Dictionary of model values") +@route("/model/recursive") +interface RecursiveModelValue + extends DictionaryOperations< + Record, + "{'k1': {'property': 'hello', children: {}}, 'k2': {'property': 'world', children: {'k2.1': {'property': 'inner world'}}}}" + > {} + +alias NullableFloat = float32 | null; +@doc("Dictionary of nullable float values") +@route("/nullable-float") +interface NullableFloatValue + extends DictionaryOperations, "{'k1': 1.25, 'k2': 0.5, 'k3': null}"> {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/mockapi.ts new file mode 100644 index 00000000000..d8a634350a9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/mockapi.ts @@ -0,0 +1,109 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createServerTests(uri: string, data: any) { + return { + get: passOnSuccess({ + uri, + method: "get", + request: {}, + response: { + status: 200, + body: json(data), + }, + kind: "MockApiDefinition", + }), + put: passOnSuccess({ + uri, + method: "put", + request: { + body: json(data), + }, + response: { + status: 204, + }, + handler: (req) => { + req.expect.coercedBodyEquals(data); + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }), + }; +} + +const Type_Dictionary_Int32 = createServerTests(`/type/dictionary/int32`, { k1: 1, k2: 2 }); +Scenarios.Type_Dictionary_Int32Value_get = Type_Dictionary_Int32.get; +Scenarios.Type_Dictionary_Int32Value_put = Type_Dictionary_Int32.put; + +const Type_Dictionary_Int64 = createServerTests(`/type/dictionary/int64`, { + k1: Number.MAX_SAFE_INTEGER, + k2: Number.MIN_SAFE_INTEGER, +}); +Scenarios.Type_Dictionary_Int64Value_get = Type_Dictionary_Int64.get; +Scenarios.Type_Dictionary_Int64Value_put = Type_Dictionary_Int64.put; + +const Type_Dictionary_Boolean = createServerTests(`/type/dictionary/boolean`, { + k1: true, + k2: false, +}); +Scenarios.Type_Dictionary_BooleanValue_get = Type_Dictionary_Boolean.get; +Scenarios.Type_Dictionary_BooleanValue_put = Type_Dictionary_Boolean.put; + +const Type_Dictionary_String = createServerTests(`/type/dictionary/string`, { + k1: "hello", + k2: "", +}); +Scenarios.Type_Dictionary_StringValue_get = Type_Dictionary_String.get; +Scenarios.Type_Dictionary_StringValue_put = Type_Dictionary_String.put; + +const Type_Dictionary_Float32 = createServerTests(`/type/dictionary/float32`, { k1: 43.125 }); +Scenarios.Type_Dictionary_Float32Value_get = Type_Dictionary_Float32.get; +Scenarios.Type_Dictionary_Float32Value_put = Type_Dictionary_Float32.put; + +const Type_Dictionary_Datetime = createServerTests(`/type/dictionary/datetime`, { + k1: "2022-08-26T18:38:00Z", +}); +Scenarios.Type_Dictionary_DatetimeValue_get = Type_Dictionary_Datetime.get; +Scenarios.Type_Dictionary_DatetimeValue_put = Type_Dictionary_Datetime.put; + +const Type_Dictionary_Duration = createServerTests(`/type/dictionary/duration`, { + k1: "P123DT22H14M12.011S", +}); +Scenarios.Type_Dictionary_DurationValue_get = Type_Dictionary_Duration.get; +Scenarios.Type_Dictionary_DurationValue_put = Type_Dictionary_Duration.put; + +const Type_Dictionary_Unknown = createServerTests(`/type/dictionary/unknown`, { + k1: 1, + k2: "hello", + k3: null, +}); +Scenarios.Type_Dictionary_UnknownValue_get = Type_Dictionary_Unknown.get; +Scenarios.Type_Dictionary_UnknownValue_put = Type_Dictionary_Unknown.put; + +const Type_Dictionary_Model = createServerTests(`/type/dictionary/model`, { + k1: { property: "hello" }, + k2: { property: "world" }, +}); +Scenarios.Type_Dictionary_ModelValue_get = Type_Dictionary_Model.get; +Scenarios.Type_Dictionary_ModelValue_put = Type_Dictionary_Model.put; + +const Type_Dictionary_Model_Recursive = createServerTests(`/type/dictionary/model/recursive`, { + k1: { property: "hello", children: {} }, + k2: { + property: "world", + children: { "k2.1": { property: "inner world" } }, + }, +}); +Scenarios.Type_Dictionary_RecursiveModelValue_get = Type_Dictionary_Model_Recursive.get; +Scenarios.Type_Dictionary_RecursiveModelValue_put = Type_Dictionary_Model_Recursive.put; + +const Type_Dictionary_Nullable_Float = createServerTests(`/type/dictionary/nullable-float`, { + k1: 1.25, + k2: 0.5, + k3: null, +}); +Scenarios.Type_Dictionary_NullableFloatValue_get = Type_Dictionary_Nullable_Float.get; +Scenarios.Type_Dictionary_NullableFloatValue_put = Type_Dictionary_Nullable_Float.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/main.tsp new file mode 100644 index 00000000000..51c3d6fb971 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/main.tsp @@ -0,0 +1,81 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@scenarioService("/type/enum/extensible") +namespace Type.Enum.Extensible; + +@doc("Days of the week") +union DaysOfWeekExtensibleEnum { + string, + + @doc("Monday.") + Monday: "Monday", + + @doc("Tuesday.") + Tuesday: "Tuesday", + + @doc("Wednesday.") + Wednesday: "Wednesday", + + @doc("Thursday.") + Thursday: "Thursday", + + @doc("Friday.") + Friday: "Friday", + + @doc("Saturday.") + Saturday: "Saturday", + + @doc("Sunday.") + Sunday: "Sunday", +} + +@route("/string") +interface String { + @scenario + @scenarioDoc("Expect to handle a known value. Mock api will return 'Monday'") + @get + @route("/known-value") + getKnownValue(): { + @header + contentType: "application/json"; + + @body body: DaysOfWeekExtensibleEnum; + }; + + @scenario + @scenarioDoc("Expect to handle an unknown value. Mock api will return 'Weekend'") + @get + @route("/unknown-value") + getUnknownValue(): { + @header + contentType: "application/json"; + + @body body: DaysOfWeekExtensibleEnum; + }; + + @scenario + @scenarioDoc("Expect to send a known value. Mock api expect to receive 'Monday'") + @put + @route("/known-value") + putKnownValue( + @header + contentType: "application/json", + + @body body: DaysOfWeekExtensibleEnum, + ): void; + + @scenario + @scenarioDoc("Expect to handle an unknown value. Mock api expect to receive 'Weekend'") + @put + @route("/unknown-value") + putUnknownValue( + @header + contentType: "application/json", + + @body body: DaysOfWeekExtensibleEnum, + ): void; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/mockapi.ts new file mode 100644 index 00000000000..1d7acd47722 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/mockapi.ts @@ -0,0 +1,48 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createMockServerTests(uri: string, data: any) { + return { + get: passOnSuccess({ + uri, + method: "get", + request: {}, + response: { + status: 200, + body: json(data), + }, + kind: "MockApiDefinition", + }), + put: passOnSuccess({ + uri, + method: "put", + request: { + body: json(data), + headers: { + "Content-Type": "text/plain", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }), + }; +} + +const Type_Enum_Extensible_String_Known_Value = createMockServerTests( + `/type/enum/extensible/string/known-value`, + "Monday", +); +Scenarios.Type_Enum_Extensible_String_getKnownValue = Type_Enum_Extensible_String_Known_Value.get; +Scenarios.Type_Enum_Extensible_String_putKnownValue = Type_Enum_Extensible_String_Known_Value.put; + +const Type_Enum_Extensible_String_UnKnown_Value = createMockServerTests( + `/type/enum/extensible/string/unknown-value`, + "Weekend", +); +Scenarios.Type_Enum_Extensible_String_getUnknownValue = + Type_Enum_Extensible_String_UnKnown_Value.get; +Scenarios.Type_Enum_Extensible_String_putUnknownValue = + Type_Enum_Extensible_String_UnKnown_Value.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/main.tsp new file mode 100644 index 00000000000..f5d89f1cab4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/main.tsp @@ -0,0 +1,72 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@scenarioService("/type/enum/fixed") +namespace Type.Enum.Fixed; + +#suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing" +@doc("Days of the week") +enum DaysOfWeekEnum { + @doc("Monday.") + Monday, + + @doc("Tuesday.") + Tuesday, + + @doc("Wednesday.") + Wednesday, + + @doc("Thursday.") + Thursday, + + @doc("Friday.") + Friday, + + @doc("Saturday.") + Saturday, + + @doc("Sunday.") + Sunday, +} + +@route("/string") +interface String { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to handle a known value. Mock api will return 'Monday'") + @get + @route("/known-value") + @doc("getKnownValue") + getKnownValue(): { + @header + contentType: "application/json"; + + @body + body: DaysOfWeekEnum; + }; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to send a known value. Mock api expect to receive 'Monday'") + @put + @route("/known-value") + @doc("putKnownValue") + putKnownValue( + @header contentType: "application/json", + @body @doc("_") body: DaysOfWeekEnum, + ): void; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to handle an unknown value. Mock api expect to receive 'Weekend'") + @put + @route("/unknown-value") + @doc("putUnknownValue") + putUnknownValue( + @header contentType: "application/json", + @body @doc("_") body: DaysOfWeekEnum, + ): void; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/mockapi.ts new file mode 100644 index 00000000000..adff9b8f59e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/mockapi.ts @@ -0,0 +1,44 @@ +import { json, passOnCode, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Type_Enum_Fixed_String_getKnownValue = passOnSuccess({ + uri: "/type/enum/fixed/string/known-value", + method: "get", + request: {}, + response: { + status: 200, + body: json("Monday"), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Enum_Fixed_String_putKnownValue = passOnSuccess({ + uri: "/type/enum/fixed/string/known-value", + method: "put", + request: { + body: json("Monday"), + headers: { + "Content-Type": "application/json", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Enum_Fixed_String_putUnknownValue = passOnCode(500, { + uri: "/type/enum/fixed/string/unknown-value", + method: "put", + request: { + body: json("Weekend"), + headers: { + "Content-Type": "application/json", + }, + status: 500, + }, + response: { + status: 500, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/main.tsp new file mode 100644 index 00000000000..bbfb6194c64 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/main.tsp @@ -0,0 +1,40 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates usage of empty model used in operation's parameters and responses.") +@scenarioService("/type/model/empty") +namespace Type.Model.Empty; + +@doc("Empty model used in operation parameters") +model EmptyInput {} + +@doc("Empty model used in operation return type") +model EmptyOutput {} + +@doc("Empty model used in both parameter and return type") +model EmptyInputOutput {} + +@scenario +@scenarioDoc("Send a PUT request with the following body {}") +@route("/alone") +@put +op putEmpty(@body input: EmptyInput): void; + +@scenario +@scenarioDoc("Send a GET request which returns the following body {}") +@route("/alone") +@get +op getEmpty(): { + @body body: EmptyOutput; +}; + +@scenario +@scenarioDoc("Send a POST request with the following body {} which returns the same.") +@route("/round-trip") +@post +op postRoundTripEmpty(@body body: EmptyInputOutput): { + @body body: EmptyInputOutput; +}; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/mockapi.ts new file mode 100644 index 00000000000..c4c11c502ca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/mockapi.ts @@ -0,0 +1,40 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const body = {}; + +Scenarios.Type_Model_Empty_putEmpty = passOnSuccess({ + uri: "/type/model/empty/alone", + method: "put", + request: { + body: json(body), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Empty_getEmpty = passOnSuccess({ + uri: "/type/model/empty/alone", + method: "get", + request: {}, + response: { + status: 200, + body: json(body), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Model_Empty_postRoundTripEmpty = passOnSuccess({ + uri: "/type/model/empty/round-trip", + method: "post", + request: { + body: json(body), + }, + response: { + status: 200, + body: json(body), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/main.tsp new file mode 100644 index 00000000000..e7893d73105 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/main.tsp @@ -0,0 +1,169 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates inheritance with enum discriminator.") +@scenarioService("/type/model/inheritance/enum-discriminator") +namespace Type.Model.Inheritance.EnumDiscriminator; + +@doc("extensible enum type for discriminator") +union DogKind { + string, + + @doc("Species golden") + Golden: "golden", +} + +@doc("Test extensible enum type for discriminator") +@discriminator("kind") +model Dog { + @doc("discriminator property") + kind: DogKind; + + @doc("Weight of the dog") + weight: int32; +} + +@doc("Golden dog model") +model Golden extends Dog { + @doc("discriminator property") + kind: DogKind.Golden; +} + +#suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing fixed enum as discriminator property" +@doc("fixed enum type for discriminator") +enum SnakeKind { + @doc("Species cobra") + Cobra: "cobra", +} + +#suppress "@azure-tools/typespec-azure-core/no-fixed-enum-discriminator" "For testing fixed enum as discriminator property" +@doc("Test fixed enum type for discriminator") +@discriminator("kind") +model Snake { + @doc("discriminator property") + kind: SnakeKind; + + @doc("Length of the snake") + length: int32; +} + +@doc("Cobra model") +model Cobra extends Snake { + @doc("discriminator property") + kind: SnakeKind.Cobra; +} + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" +@doc("Receive model with extensible enum discriminator type.") +@scenario +@scenarioDoc(""" + Receive model with extensible enum discriminator type. + Expected response body: + ```json + {"kind": "golden", "weight": 10} + ``` + """) +@route("/extensible-enum") +@get +op getExtensibleModel(): Dog; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" +@doc("Send model with extensible enum discriminator type.") +@scenario +@scenarioDoc(""" + Send model with extensible enum discriminator type. + Expected request body: + ```json + {"kind": "golden", "weight": 10} + ``` + """) +@route("/extensible-enum") +@put +op putExtensibleModel(@body @doc("Dog to create") input: Dog): NoContentResponse; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" +@doc("Get a model omitting the discriminator.") +@scenario +@route("/extensible-enum/missingdiscriminator") +@scenarioDoc(""" + Get a model omitting the discriminator. + Expected response body: + ```json + {"weight": 10} + ``` + """) +@get +op getExtensibleModelMissingDiscriminator(): Dog; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" +@doc("Get a model containing discriminator value never defined.") +@scenario +@route("/extensible-enum/wrongdiscriminator") +@scenarioDoc(""" + Get a model containing discriminator value never defined. + Expected response body: + ```json + {"weight": 8, "kind": "wrongKind" } + ``` + """) +@get +op getExtensibleModelWrongDiscriminator(): Dog; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" +@doc("Receive model with fixed enum discriminator type.") +@scenario +@scenarioDoc(""" + Receive model with fixed enum discriminator type. + Expected response body: + ```json + {"kind": "cobra", "length": 10} + ``` + """) +@route("/fixed-enum") +@get +op getFixedModel(): Snake; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" +@doc("Send model with fixed enum discriminator type.") +@scenario +@scenarioDoc(""" + Send model with fixed enum discriminator type. + Expected request body: + ```json + {"kind": "cobra", "length": 10} + ``` + """) +@route("/fixed-enum") +@put +op putFixedModel(@body @doc("Snake to create") input: Snake): NoContentResponse; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" +@doc("Get a model omitting the discriminator.") +@scenario +@route("/fixed-enum/missingdiscriminator") +@scenarioDoc(""" + Get a model omitting the discriminator. + Expected response body: + ```json + {"length": 10} + ``` + """) +@get +op getFixedModelMissingDiscriminator(): Snake; + +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" +@doc("Get a model containing discriminator value never defined.") +@scenario +@route("/fixed-enum/wrongdiscriminator") +@scenarioDoc(""" + Get a model containing discriminator value never defined. + Expected response body: + ```json + {"length": 8, "kind": "wrongKind" } + ``` + """) +@get +op getFixedModelWrongDiscriminator(): Snake; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/mockapi.ts new file mode 100644 index 00000000000..1d3a405b6cd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/mockapi.ts @@ -0,0 +1,89 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const validExtensibleEnumBody = { + weight: 10, + kind: "golden", +}; +const validFixedEnumBody = { + length: 10, + kind: "cobra", +}; +function createGetServerTests(uri: string, data: any) { + return passOnSuccess({ + uri: uri, + method: "get", + request: {}, + response: { + status: 200, + body: json(data), + }, + kind: "MockApiDefinition", + }); +} + +function createGetPutServerTests(uri: string, data: any) { + return { + get: passOnSuccess({ + uri: uri, + method: "get", + request: {}, + response: { + status: 200, + body: json(data), + }, + kind: "MockApiDefinition", + }), + put: passOnSuccess({ + uri: uri, + method: "put", + request: { + body: json(data), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }), + }; +} + +const Type_Model_Inheritance_Enum_Discriminator_Extensible_Enum = createGetPutServerTests( + "/type/model/inheritance/enum-discriminator/extensible-enum", + validExtensibleEnumBody, +); +Scenarios.Type_Model_Inheritance_EnumDiscriminator_getExtensibleModel = + Type_Model_Inheritance_Enum_Discriminator_Extensible_Enum.get; +Scenarios.Type_Model_Inheritance_EnumDiscriminator_putExtensibleModel = + Type_Model_Inheritance_Enum_Discriminator_Extensible_Enum.put; + +const Type_Model_Inheritance_Enum_Discriminator_Fixed_Enum = createGetPutServerTests( + "/type/model/inheritance/enum-discriminator/fixed-enum", + validFixedEnumBody, +); +Scenarios.Type_Model_Inheritance_EnumDiscriminator_getFixedModel = + Type_Model_Inheritance_Enum_Discriminator_Fixed_Enum.get; +Scenarios.Type_Model_Inheritance_EnumDiscriminator_putFixedModel = + Type_Model_Inheritance_Enum_Discriminator_Fixed_Enum.put; + +Scenarios.Type_Model_Inheritance_EnumDiscriminator_getExtensibleModelMissingDiscriminator = + createGetServerTests( + "/type/model/inheritance/enum-discriminator/extensible-enum/missingdiscriminator", + { weight: 10 }, + ); +Scenarios.Type_Model_Inheritance_EnumDiscriminator_getExtensibleModelWrongDiscriminator = + createGetServerTests( + "/type/model/inheritance/enum-discriminator/extensible-enum/wrongdiscriminator", + { weight: 8, kind: "wrongKind" }, + ); +Scenarios.Type_Model_Inheritance_EnumDiscriminator_getFixedModelMissingDiscriminator = + createGetServerTests( + "/type/model/inheritance/enum-discriminator/fixed-enum/missingdiscriminator", + { length: 10 }, + ); +Scenarios.Type_Model_Inheritance_EnumDiscriminator_getFixedModelWrongDiscriminator = + createGetServerTests("/type/model/inheritance/enum-discriminator/fixed-enum/wrongdiscriminator", { + length: 8, + kind: "wrongKind", + }); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/main.tsp new file mode 100644 index 00000000000..fdf750bf536 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/main.tsp @@ -0,0 +1,224 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates multiple level inheritance with multiple discriminators.") +@scenarioService("/type/model/inheritance/nested-discriminator") +namespace Type.Model.Inheritance.NestedDiscriminator; + +@doc("This is base model for polymorphic multiple levels inheritance with a discriminator.") +@discriminator("kind") +model Fish { + age: int32; +} + +@doc("The second level model in polymorphic multiple levels inheritance and it defines a new discriminator.") +@discriminator("sharktype") +model Shark extends Fish { + kind: "shark"; + sharktype: string; +} + +@doc("The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic instances.") +model Salmon extends Fish { + kind: "salmon"; + friends?: Fish[]; + hate?: Record; + partner?: Fish; +} + +@doc("The third level model SawShark in polymorphic multiple levels inheritance.") +model SawShark extends Shark { + sharktype: "saw"; +} + +@doc("The third level model GoblinShark in polymorphic multiple levels inheritance.") +model GoblinShark extends Shark { + sharktype: "goblin"; +} + +@scenario +@route("/model") +@scenarioDoc(""" + Generate and receive polymorphic model in multiple levels inheritance with 2 discriminators. + Expected response body: + ```json + {"age": 1, "kind": "shark", "sharktype": "goblin"} + ``` + """) +@get +op getModel(): Fish; + +@scenario +@route("/model") +@scenarioDoc(""" + Generate and send polymorphic model in multiple levels inheritance with 2 discriminators. + Expected input body: + ```json + {"age": 1, "kind": "shark", "sharktype": "goblin"} + ``` + """) +@put +op putModel(@body input: Fish): NoContentResponse; + +@scenario +@route("/recursivemodel") +@scenarioDoc(""" + Generate and receive polymorphic models has collection and dictionary properties referring to other polymorphic models. + Expected response body: + ```json + { + "age": 1, + "kind": "salmon", + "partner": { + "age": 2, + "kind": "shark", + "sharktype": "saw" + }, + "friends": [ + { + "age": 2, + "kind": "salmon", + "partner": { + "age": 3, + "kind": "salmon" + }, + "hate": { + "key1": { + "age": 4, + "kind": "salmon" + }, + "key2": { + "age": 2, + "kind": "shark", + "sharktype": "goblin" + } + } + }, + { + "age": 3, + "kind": "shark", + "sharktype": "goblin" + } + ], + "hate": { + "key3": { + "age": 3, + "kind": "shark", + "sharktype": "saw" + }, + "key4": { + "age": 2, + "kind": "salmon", + "friends": [ + { + "age": 1, + "kind": "salmon" + }, + { + "age": 4, + "kind": "shark", + "sharktype": "goblin" + } + ] + } + } + } + ``` + """) +@get +op getRecursiveModel(): Fish; + +@scenario +@route("/recursivemodel") +@scenarioDoc(""" + Generate and send polymorphic models has collection and dictionary properties referring to other polymorphic models. + Expected input body: + ```json + { + "age": 1, + "kind": "salmon", + "partner": { + "age": 2, + "kind": "shark", + "sharktype": "saw" + }, + "friends": [ + { + "age": 2, + "kind": "salmon", + "partner": { + "age": 3, + "kind": "salmon" + }, + "hate": { + "key1": { + "age": 4, + "kind": "salmon" + }, + "key2": { + "age": 2, + "kind": "shark", + "sharktype": "goblin" + } + } + }, + { + "age": 3, + "kind": "shark", + "sharktype": "goblin" + } + ], + "hate": { + "key3": { + "age": 3, + "kind": "shark", + "sharktype": "saw" + }, + "key4": { + "age": 2, + "kind": "salmon", + "friends": [ + { + "age": 1, + "kind": "salmon" + }, + { + "age": 4, + "kind": "shark", + "sharktype": "goblin" + } + ] + } + } + } + ``` + """) +@put +op putRecursiveModel(@body input: Fish): NoContentResponse; + +@scenario +@route("/missingdiscriminator") +@scenarioDoc(""" + Get a model omitting the discriminator. + Expected response body: + ```json + {"age": 1} + ``` + """) +@get +op getMissingDiscriminator(): Fish; + +@scenario +@route("/wrongdiscriminator") +@scenarioDoc(""" + Get a model containing discriminator value never defined. + Expected response body: + ```json + {"age": 1, "kind": "wrongKind" } + ``` + """) +@get +op getWrongDiscriminator(): Fish; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/mockapi.ts new file mode 100644 index 00000000000..b653c2f1d28 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/mockapi.ts @@ -0,0 +1,130 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const validPolymorphicBody = { + age: 1, + kind: "shark", + sharktype: "goblin", +}; +const validRecursiveBody = { + age: 1, + kind: "salmon", + partner: { + age: 2, + kind: "shark", + sharktype: "saw", + }, + friends: [ + { + age: 2, + kind: "salmon", + partner: { + age: 3, + kind: "salmon", + }, + hate: { + key1: { + age: 4, + kind: "salmon", + }, + key2: { + age: 2, + kind: "shark", + sharktype: "goblin", + }, + }, + }, + { + age: 3, + kind: "shark", + sharktype: "goblin", + }, + ], + hate: { + key3: { + age: 3, + kind: "shark", + sharktype: "saw", + }, + key4: { + age: 2, + kind: "salmon", + friends: [ + { + age: 1, + kind: "salmon", + }, + { + age: 4, + kind: "shark", + sharktype: "goblin", + }, + ], + }, + }, +}; +Scenarios.Type_Model_Inheritance_NestedDiscriminator_getModel = passOnSuccess({ + uri: "/type/model/inheritance/nested-discriminator/model", + method: "get", + request: {}, + response: { + status: 200, + body: json(validPolymorphicBody), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Inheritance_NestedDiscriminator_putModel = passOnSuccess({ + uri: "/type/model/inheritance/nested-discriminator/model", + method: "put", + request: { + body: json(validPolymorphicBody), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Model_Inheritance_NestedDiscriminator_getRecursiveModel = passOnSuccess({ + uri: "/type/model/inheritance/nested-discriminator/recursivemodel", + method: "get", + request: {}, + response: { + status: 200, + body: json(validRecursiveBody), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Inheritance_NestedDiscriminator_putRecursiveModel = passOnSuccess({ + uri: "/type/model/inheritance/nested-discriminator/recursivemodel", + method: "put", + request: { + body: json(validRecursiveBody), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Model_Inheritance_NestedDiscriminator_getMissingDiscriminator = passOnSuccess({ + uri: "/type/model/inheritance/nested-discriminator/missingdiscriminator", + method: "get", + request: {}, + response: { + status: 200, + body: json({ age: 1 }), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Inheritance_NestedDiscriminator_getWrongDiscriminator = passOnSuccess({ + uri: "/type/model/inheritance/nested-discriminator/wrongdiscriminator", + method: "get", + request: {}, + response: { + status: 200, + body: json({ age: 1, kind: "wrongKind" }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/main.tsp new file mode 100644 index 00000000000..69c186445be --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/main.tsp @@ -0,0 +1,54 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates not-discriminated inheritance model.") +@scenarioService("/type/model/inheritance/not-discriminated") +namespace Type.Model.Inheritance.NotDiscriminated; + +@doc("This is base model for not-discriminated normal multiple levels inheritance.") +model Pet { + name: string; +} + +@doc("The second level model in the normal multiple levels inheritance.") +model Cat extends Pet { + age: int32; +} + +@doc("The third level model in the normal multiple levels inheritance.") +model Siamese extends Cat { + smart: boolean; +} + +@scenario +@scenarioDoc(""" + Generate and send model. + Expected input body: + ```json + {"name": "abc", "age": 32, "smart": true} + ``` + """) +@route("/valid") +@post +op postValid(@body input: Siamese): NoContentResponse; + +@scenario +@scenarioDoc(""" + Generate and receive model. + Expected response body: + ```json + {"name": "abc", "age": 32, "smart": true} + ``` + """) +@route("/valid") +@get +op getValid(): Siamese; + +@scenario +@scenarioDoc("Generate, send, and receive round-trip bottom model.") +@route("/valid") +@put +op putValid(@body input: Siamese): Siamese; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/mockapi.ts new file mode 100644 index 00000000000..c919de7b67e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/mockapi.ts @@ -0,0 +1,39 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const inheritanceValidBody = { name: "abc", age: 32, smart: true }; + +Scenarios.Type_Model_Inheritance_NotDiscriminated_postValid = passOnSuccess({ + uri: "/type/model/inheritance/not-discriminated/valid", + method: "post", + request: { + body: json(inheritanceValidBody), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Inheritance_NotDiscriminated_getValid = passOnSuccess({ + uri: "/type/model/inheritance/not-discriminated/valid", + method: "get", + request: {}, + response: { + status: 200, + body: json(inheritanceValidBody), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Inheritance_NotDiscriminated_putValid = passOnSuccess({ + uri: "/type/model/inheritance/not-discriminated/valid", + method: "put", + request: { + body: json(inheritanceValidBody), + }, + response: { + status: 200, + body: json(inheritanceValidBody), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/main.tsp new file mode 100644 index 00000000000..a5656b94913 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/main.tsp @@ -0,0 +1,71 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates inheritance recursion") +@scenarioService("/type/model/inheritance/recursive") +namespace Type.Model.Inheritance.Recursive; + +@doc("extension") +model Extension extends Element { + level: int8; +} + +@doc("element") +model Element { + extension?: Extension[]; +} + +@scenario +@scenarioDoc(""" + Send a PUT request with the following body: + Expected input body: + ```json + { + "level": 0, + "extension": [ + { + "level": 1, + "extension": [ + { + "level": 2 + } + ] + }, + { + "level": 1 + } + ] + } + ``` + """) +@put +op put(@body input: Extension): void; + +@scenario +@scenarioDoc(""" + Send a GET request which returns the following body: + Expected response body: + ```json + { + "level": 0, + "extension": [ + { + "level": 1, + "extension": [ + { + "level": 2 + } + ] + }, + { + "level": 1 + } + ] + } + ``` + """) +@get +op get(): Extension; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/mockapi.ts new file mode 100644 index 00000000000..e8687d4bb4d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/mockapi.ts @@ -0,0 +1,41 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const body = { + level: 0, + extension: [ + { + level: 1, + extension: [ + { + level: 2, + }, + ], + }, + { + level: 1, + }, + ], +}; +Scenarios.Type_Model_Inheritance_Recursive_put = passOnSuccess({ + uri: "/type/model/inheritance/recursive", + method: "put", + request: { + body: json(body), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Inheritance_Recursive_get = passOnSuccess({ + uri: "/type/model/inheritance/recursive", + method: "get", + request: {}, + response: { + status: 200, + body: json(body), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/main.tsp new file mode 100644 index 00000000000..0a396d731ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/main.tsp @@ -0,0 +1,172 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates inheritance with single discriminator.") +@scenarioService("/type/model/inheritance/single-discriminator") +namespace Type.Model.Inheritance.SingleDiscriminator; + +@doc("This is base model for polymorphic single level inheritance with a discriminator.") +@discriminator("kind") +model Bird { + kind: string; + wingspan: int32; +} + +@doc("The second level model in polymorphic single level inheritance.") +model SeaGull extends Bird { + kind: "seagull"; +} + +@doc("The second level model in polymorphic single level inheritance.") +model Sparrow extends Bird { + kind: "sparrow"; +} + +@doc("The second level model in polymorphic single level inheritance.") +model Goose extends Bird { + kind: "goose"; +} + +@doc("The second level model in polymorphic single levels inheritance which contains references to other polymorphic instances.") +model Eagle extends Bird { + kind: "eagle"; + friends?: Bird[]; + hate?: Record; + partner?: Bird; +} + +@doc("Define a base class in the legacy way. Discriminator property is not explicitly defined in the model.") +@discriminator("kind") +model Dinosaur { + size: int32; +} + +@doc("The second level legacy model in polymorphic single level inheritance.") +model TRex extends Dinosaur { + kind: "t-rex"; +} + +@scenario +@route("/model") +@scenarioDoc(""" + Generate and receive polymorphic model in single level inheritance with 1 discriminator. + Expected response body: + ```json + {"wingspan": 1, "kind": "sparrow"} + ``` + """) +@get +op getModel(): Bird; + +@scenario +@route("/model") +@scenarioDoc(""" + Generate and send polymorphic model in single level inheritance with 1 discriminator. + Expected input body: + ```json + {"wingspan": 1, "kind": "sparrow"} + ``` + """) +@put +op putModel(@body input: Bird): NoContentResponse; + +@scenario +@route("/recursivemodel") +@scenarioDoc(""" + Generate and receive polymorphic models has collection and dictionary properties referring to other polymorphic models. + Expected response body: + ```json + { + "wingspan": 5, + "kind": "eagle", + "partner": { + "wingspan": 2, + "kind": "goose" + }, + "friends": [ + { + "wingspan": 2, + "kind": "seagull" + } + ], + "hate": { + "key3": { + "wingspan": 1, + "kind": "sparrow" + } + } + } + ``` + """) +@get +op getRecursiveModel(): Bird; + +@scenario +@route("/recursivemodel") +@scenarioDoc(""" + Generate and send polymorphic models has collection and dictionary properties referring to other polymorphic models. + Expected input body: + ```json + { + "wingspan": 5, + "kind": "eagle", + "partner": { + "wingspan": 2, + "kind": "goose" + }, + "friends": [ + { + "wingspan": 2, + "kind": "seagull" + } + ], + "hate": { + "key3": { + "wingspan": 1, + "kind": "sparrow" + } + } + } + ``` + """) +@put +op putRecursiveModel(@body input: Bird): NoContentResponse; + +@scenario +@route("/missingdiscriminator") +@scenarioDoc(""" + Get a model omitting the discriminator. + Expected response body: + ```json + {"wingspan": 1} + ``` + """) +@get +op getMissingDiscriminator(): Bird; + +@scenario +@route("/wrongdiscriminator") +@scenarioDoc(""" + Get a model containing discriminator value never defined. + Expected response body: + ```json + {"wingspan": 1, "kind": "wrongKind" } + ``` + """) +@get +op getWrongDiscriminator(): Bird; + +@scenario +@route("/legacy-model") +@scenarioDoc(""" + Generate and receive polymorphic model defined in legacy way. + Expected response body: + ```json + {"size": 20, "kind": "t-rex"} + ``` + """) +@get +op getLegacyModel(): Dinosaur; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/mockapi.ts new file mode 100644 index 00000000000..f8adcf9c0f5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/mockapi.ts @@ -0,0 +1,103 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const validPolymorphicBody = { + wingspan: 1, + kind: "sparrow", +}; +const validRecursiveBody = { + wingspan: 5, + kind: "eagle", + partner: { + wingspan: 2, + kind: "goose", + }, + friends: [ + { + wingspan: 2, + kind: "seagull", + }, + ], + hate: { + key3: { + wingspan: 1, + kind: "sparrow", + }, + }, +}; +Scenarios.Type_Model_Inheritance_SingleDiscriminator_getModel = passOnSuccess({ + uri: "/type/model/inheritance/single-discriminator/model", + method: "get", + request: {}, + response: { + status: 200, + body: json(validPolymorphicBody), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Inheritance_SingleDiscriminator_putModel = passOnSuccess({ + uri: "/type/model/inheritance/single-discriminator/model", + method: "put", + request: { + body: json(validPolymorphicBody), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Model_Inheritance_SingleDiscriminator_getRecursiveModel = passOnSuccess({ + uri: "/type/model/inheritance/single-discriminator/recursivemodel", + method: "get", + request: {}, + response: { + status: 200, + body: json(validRecursiveBody), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Inheritance_SingleDiscriminator_putRecursiveModel = passOnSuccess({ + uri: "/type/model/inheritance/single-discriminator/recursivemodel", + method: "put", + request: { + body: json(validRecursiveBody), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Model_Inheritance_SingleDiscriminator_getMissingDiscriminator = passOnSuccess({ + uri: "/type/model/inheritance/single-discriminator/missingdiscriminator", + method: "get", + request: {}, + response: { + status: 200, + body: json({ wingspan: 1 }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Model_Inheritance_SingleDiscriminator_getWrongDiscriminator = passOnSuccess({ + uri: "/type/model/inheritance/single-discriminator/wrongdiscriminator", + method: "get", + request: {}, + response: { + status: 200, + body: json({ wingspan: 1, kind: "wrongKind" }), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Inheritance_SingleDiscriminator_getLegacyModel = passOnSuccess({ + uri: "/type/model/inheritance/single-discriminator/legacy-model", + method: "get", + request: {}, + response: { + status: 200, + body: json({ size: 20, kind: "t-rex" }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/main.tsp new file mode 100644 index 00000000000..5197007a0f7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/main.tsp @@ -0,0 +1,49 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +/** + * Those tests are meant to test different behavior of records if they are used as input, output or both. + * This is something that might not matter in your emitter. + * + * This is valuable if you for example only decide to create a public constructor if a model is used as input. + */ +@doc("Illustrates usage of Record in different places(Operation parameters, return type or both).") +@scenarioService("/type/model/usage") +namespace Type.Model.Usage; + +alias RecordBase = { + requiredProp: string; +}; + +@doc("Record used in operation parameters") +model InputRecord { + ...RecordBase; +} + +@doc("Record used in operation return type") +model OutputRecord { + ...RecordBase; +} + +@doc("Record used both as operation parameter and return type") +model InputOutputRecord { + ...RecordBase; +} + +@scenario +@scenarioDoc("Send a POST request with the following body {requiredProp: \"example-value\"}") +@route("/input") +op input(@body input: InputRecord): void; + +@scenario +@scenarioDoc("Send a GET request which return the following body {requiredProp: \"example-value\"}") +@route("/output") +op output(): OutputRecord; + +@scenario +@scenarioDoc("Send a POST request which return the following body {requiredProp: \"example-value\"} and return the same.") +@route("/input-output") +op inputAndOutput(@body body: InputOutputRecord): InputOutputRecord; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/mockapi.ts new file mode 100644 index 00000000000..ccce6fbf44a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/mockapi.ts @@ -0,0 +1,45 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const body = { requiredProp: "example-value" }; + +Scenarios.Type_Model_Usage_input = passOnSuccess({ + uri: "/type/model/usage/input", + method: "post", + request: { + body: json({ + requiredProp: "example-value", + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Model_Usage_output = passOnSuccess({ + uri: "/type/model/usage/output", + method: "get", + request: {}, + response: { + status: 200, + body: json(body), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Model_Usage_inputAndOutput = passOnSuccess({ + uri: "/type/model/usage/input-output", + method: "post", + request: { + body: json({ + requiredProp: "example-value", + }), + }, + response: { + status: 200, + body: json(body), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/main.tsp new file mode 100644 index 00000000000..80be39ab019 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/main.tsp @@ -0,0 +1,149 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates models with visibility properties.") +@scenarioService("/type/model/visibility") +namespace Type.Model.Visibility; + +@doc("Output model with visibility properties.") +model VisibilityModel { + @doc("Required string, illustrating a readonly property.") + @visibility(Lifecycle.Read) + readProp: string; + + #suppress "@typespec/http/metadata-ignored" "For test" + @doc("Required int32, illustrating a query property.") + @visibility(Lifecycle.Query) + @query + queryProp: int32; + + @doc("Required string[], illustrating a create property.") + @visibility(Lifecycle.Create) + createProp: string[]; + + @doc("Required int32[], illustrating a update property.") + @visibility(Lifecycle.Update) + updateProp: int32[]; + + @doc("Required bool, illustrating a delete property.") + @visibility(Lifecycle.Delete) + deleteProp: boolean; + + @doc("Property that does not exist in any payload.") + @invisible(Lifecycle) + noneProp: "none"; +} + +/** RoundTrip model with readonly optional properties. */ +model ReadOnlyModel { + /** Optional readonly nullable int list. */ + @visibility(Lifecycle.Read) + optionalNullableIntList?: int32[] | null; + + /** Optional readonly string dictionary. */ + @visibility(Lifecycle.Read) + optionalStringRecord?: Record; +} + +@scenario +@scenarioDoc(""" + Generate and receive output model with readonly properties. + Expected no body with `?queryProp=123`. + + Expected response body: + ```json + { + readProp: "abc", + } + ``` + """) +@get +op getModel(@bodyRoot input: VisibilityModel): { + @body + output: VisibilityModel; +}; + +@scenario +@scenarioDoc(""" + Generate abd send put model with write/create properties. + Expected no body with `?queryProp=123`. + """) +@head +op headModel(@bodyRoot input: VisibilityModel): OkResponse; + +@scenario +@scenarioDoc(""" + Generate abd send put model with write/create/update properties. + Expected input body: + ```json + { + createProp: ["foo", "bar"], + updateProp: [1, 2], + } + ``` + """) +@put +op putModel(@body input: VisibilityModel): void; + +@scenario +@scenarioDoc(""" + Generate abd send put model with write/update properties. + Expected input body: + ```json + { + updateProp: [1, 2], + } + ``` + """) +@patch(#{ implicitOptionality: true }) +op patchModel(@body input: VisibilityModel): void; + +@scenario +@scenarioDoc(""" + Generate abd send put model with write/create properties. + Expected input body: + ```json + { + createProp: ["foo", "bar"], + } + ``` + """) +@post +op postModel(@body input: VisibilityModel): void; + +@scenario +@scenarioDoc(""" + Generate abd send put model with write/create properties. + Expected input body: + ```json + { + deleteProp: true, + } + ``` + """) +@delete +op deleteModel(@body input: VisibilityModel): void; + +@route("/readonlyroundtrip") +@scenario +@scenarioDoc(""" + Generate and receive output model with readonly properties. + + Expected input body: + ```json + {} + ``` + + Expected response body: + ```json + { + optionalNullableIntList: [1, 2, 3], + optionalStringRecord: { k1: "value1", k2: "value2" }, + } + ``` + """) +@put +op putReadOnlyModel(@body input: ReadOnlyModel): ReadOnlyModel; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/mockapi.ts new file mode 100644 index 00000000000..de3c492d3e8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/mockapi.ts @@ -0,0 +1,107 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function genData(keys: string[]): Record { + const ret: Record = {}; + const fullData: Record = { + readProp: "abc", + createProp: ["foo", "bar"], + updateProp: [1, 2], + deleteProp: true, + }; + for (const k of keys) { + if (k in fullData) { + ret[k] = fullData[k]; + } + } + return ret; +} +const expectBody = { + optionalNullableIntList: [1, 2, 3], + optionalStringRecord: { k1: "value1", k2: "value2" }, +}; +Scenarios.Type_Model_Visibility_putReadOnlyModel = passOnSuccess({ + uri: "/type/model/visibility/readonlyroundtrip", + method: "put", + request: {}, + response: { + status: 200, + body: json(expectBody), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Visibility_headModel = passOnSuccess({ + uri: "/type/model/visibility", + method: "head", + request: { + query: { queryProp: 123 }, + }, + response: { + status: 200, + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Visibility_getModel = passOnSuccess({ + uri: "/type/model/visibility", + method: "get", + request: { + query: { queryProp: 123 }, + }, + response: { + status: 200, + body: json(genData(["readProp"])), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Visibility_putModel = passOnSuccess({ + uri: "/type/model/visibility", + method: "put", + request: { + body: json({ + createProp: ["foo", "bar"], + updateProp: [1, 2], + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Visibility_patchModel = passOnSuccess({ + uri: "/type/model/visibility", + method: "patch", + request: { + body: json({ + updateProp: [1, 2], + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Visibility_postModel = passOnSuccess({ + uri: "/type/model/visibility", + method: "post", + request: { + body: json({ + createProp: ["foo", "bar"], + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Model_Visibility_deleteModel = passOnSuccess({ + uri: "/type/model/visibility", + method: "delete", + request: { + body: json({ deleteProp: true }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/main.tsp new file mode 100644 index 00000000000..b304f1db348 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/main.tsp @@ -0,0 +1,549 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Tests for additional properties of models") +@scenarioService("/type/property/additionalProperties") +namespace Type.Property.AdditionalProperties; + +@doc("Template to have models operations") +interface ModelOperations { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc(""" + Expected response body: + ```json + ${TDoc} + ``` + """) + @get + @doc("Get call") + get(): TModel; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" + @scenario + @scenarioDoc(""" + Expected input body: + ```json + ${TDoc} + ``` + """) + @put + @doc("Put operation") + put(@body @doc("body") body: TModel): void; +} + +// ********************************************** Record ********************************************** +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" +@doc("The model extends from Record type.") +model ExtendsUnknownAdditionalProperties extends Record { + @doc("The name property") + name: string; +} + +@route("/extendsRecordUnknown") +interface ExtendsUnknown + extends ModelOperations< + ExtendsUnknownAdditionalProperties, + "{'name': 'ExtendsUnknownAdditionalProperties', 'prop1': 32, 'prop2': true, 'prop3': 'abc'}" + > {} + +@doc("The model extends from a type that extends from Record.") +model ExtendsUnknownAdditionalPropertiesDerived extends ExtendsUnknownAdditionalProperties { + @doc("The index property") + index: int32; + + @doc("The age property") + age?: float32; +} + +@route("/extendsRecordUnknownDerived") +interface ExtendsUnknownDerived + extends ModelOperations< + ExtendsUnknownAdditionalPropertiesDerived, + "{'name': 'ExtendsUnknownAdditionalProperties', 'index': 314, 'age': 2.71875, 'prop1': 32, 'prop2': true, 'prop3': 'abc'}" + > {} + +@doc("The model extends from Record with a discriminator.") +@discriminator("kind") +model ExtendsUnknownAdditionalPropertiesDiscriminated extends Record { + @doc("The name property") + name: string; + + @doc("The discriminator") + kind: string; +} + +@doc("The derived discriminated type") +model ExtendsUnknownAdditionalPropertiesDiscriminatedDerived + extends ExtendsUnknownAdditionalPropertiesDiscriminated { + kind: "derived"; + + @doc("The index property") + index: int32; + + @doc("The age property") + age?: float32; +} + +@route("/extendsUnknownDiscriminated") +interface ExtendsUnknownDiscriminated + extends ModelOperations< + ExtendsUnknownAdditionalPropertiesDiscriminated, + "{'kind': 'derived', 'name': 'Derived', 'index': 314, 'age': 2.71875, 'prop1': 32, 'prop2': true, 'prop3': 'abc'}" + > {} + +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" +@doc("The model is from Record type.") +model IsUnknownAdditionalProperties is Record { + @doc("The name property") + name: string; +} + +@route("/isRecordUnknown") +interface IsUnknown + extends ModelOperations< + IsUnknownAdditionalProperties, + "{'name': 'IsUnknownAdditionalProperties', 'prop1': 32, 'prop2': true, 'prop3': 'abc'}" + > {} + +@doc("The model extends from a type that is Record type") +model IsUnknownAdditionalPropertiesDerived extends IsUnknownAdditionalProperties { + @doc("The index property") + index: int32; + + @doc("The age property") + age?: float32; +} + +@route("/isRecordUnknownDerived") +interface IsUnknownDerived + extends ModelOperations< + IsUnknownAdditionalPropertiesDerived, + "{'name': 'IsUnknownAdditionalProperties', 'index': 314, 'age': 2.71875, 'prop1': 32, 'prop2': true, 'prop3': 'abc'}" + > {} + +@doc("The model is Record with a discriminator.") +@discriminator("kind") +model IsUnknownAdditionalPropertiesDiscriminated is Record { + @doc("The name property") + name: string; + + @doc("The discriminator") + kind: string; +} + +@doc("The derived discriminated type") +model IsUnknownAdditionalPropertiesDiscriminatedDerived + extends IsUnknownAdditionalPropertiesDiscriminated { + kind: "derived"; + + @doc("The index property") + index: int32; + + @doc("The age property") + age?: float32; +} + +@route("/isUnknownDiscriminated") +interface IsUnknownDiscriminated + extends ModelOperations< + IsUnknownAdditionalPropertiesDiscriminated, + "{'kind': 'derived', 'name': 'Derived', 'index': 314, 'age': 2.71875, 'prop1': 32, 'prop2': true, 'prop3': 'abc'}" + > {} + +// ***************** Known properties type is the same with additional properties type ************************** +// ********************************************** Record ********************************************** +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" +@doc("The model extends from Record type.") +model ExtendsStringAdditionalProperties extends Record { + @doc("The name property") + name: string; +} + +@route("/extendsRecordString") +interface ExtendsString + extends ModelOperations< + ExtendsStringAdditionalProperties, + "{'name': 'ExtendsStringAdditionalProperties', 'prop': 'abc'}" + > {} + +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" +@doc("The model is from Record type.") +model IsStringAdditionalProperties is Record { + @doc("The name property") + name: string; +} + +@route("/isRecordstring") +interface IsString + extends ModelOperations< + IsStringAdditionalProperties, + "{'name': 'IsStringAdditionalProperties', 'prop': 'abc'}" + > {} + +@doc("The model spread Record with the same known property type") +model SpreadStringRecord { + @doc("The name property") + name: string; + + ...Record; +} + +@route("/spreadRecordString") +interface SpreadString + extends ModelOperations {} + +// ********************************************** Record ********************************************** +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" +@doc("The model extends from Record type.") +model ExtendsFloatAdditionalProperties extends Record { + @doc("The id property") + id: float32; +} + +@route("/extendsRecordFloat") +interface ExtendsFloat + extends ModelOperations {} + +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" +@doc("The model is from Record type.") +model IsFloatAdditionalProperties is Record { + @doc("The id property") + id: float32; +} + +@route("/isRecordFloat") +interface IsFloat + extends ModelOperations {} + +@doc("The model spread Record with the same known property type") +model SpreadFloatRecord { + @doc("The id property") + id: float32; + + ...Record; +} + +@route("/spreadRecordFloat") +interface SpreadFloat + extends ModelOperations {} + +// ********************************************** Record ********************************************** +@doc("model for record") +model ModelForRecord { + @doc("The state property") + state: string; +} + +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" +@doc("The model extends from Record type.") +model ExtendsModelAdditionalProperties extends Record { + knownProp: ModelForRecord; +} + +@route("/extendsRecordModel") +interface ExtendsModel + extends ModelOperations< + ExtendsModelAdditionalProperties, + "{'knownProp': {'state': 'ok'}, 'prop': {'state': 'ok'}}" + > {} + +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" +@doc("The model is from Record type.") +model IsModelAdditionalProperties is Record { + knownProp: ModelForRecord; +} + +@route("/isRecordModel") +interface IsModel + extends ModelOperations< + IsModelAdditionalProperties, + "{'knownProp': {'state': 'ok'}, 'prop': {'state': 'ok'}}" + > {} + +@doc("The model spread Record with the same known property type") +model SpreadModelRecord { + knownProp: ModelForRecord; + ...Record; +} + +@route("/spreadRecordModel") +interface SpreadModel + extends ModelOperations< + SpreadModelRecord, + "{'knownProp': {'state': 'ok'}, 'prop': {'state': 'ok'}}" + > {} + +// ********************************************** Record ********************************************** +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" +@doc("The model extends from Record type.") +model ExtendsModelArrayAdditionalProperties extends Record { + knownProp: ModelForRecord[]; +} + +@route("/extendsRecordModelArray") +interface ExtendsModelArray + extends ModelOperations< + ExtendsModelArrayAdditionalProperties, + "{'knownProp': [{'state': 'ok'}, {'state': 'ok'}], 'prop': [{'state': 'ok'}, {'state': 'ok'}]}" + > {} + +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" +@doc("The model is from Record type.") +model IsModelArrayAdditionalProperties is Record { + knownProp: ModelForRecord[]; +} + +@route("/isRecordModelArray") +interface IsModelArray + extends ModelOperations< + IsModelArrayAdditionalProperties, + "{'knownProp': [{'state': 'ok'}, {'state': 'ok'}], 'prop': [{'state': 'ok'}, {'state': 'ok'}]}" + > {} + +model SpreadModelArrayRecord { + knownProp: ModelForRecord[]; + ...Record; +} + +@route("/spreadRecordModelArray") +interface SpreadModelArray + extends ModelOperations< + SpreadModelArrayRecord, + "{'knownProp': [{'state': 'ok'}, {'state': 'ok'}], 'prop': [{'state': 'ok'}, {'state': 'ok'}]}" + > {} + +// ****************** Known properties type is different from additional properties type ************************** +// ********************************************** Record ********************************************** +@doc("The model spread Record with the different known property type") +model DifferentSpreadStringRecord { + @doc("The name property") + id: float32; + + ...Record; +} + +@route("/spreadDifferentRecordString") +interface SpreadDifferentString + extends ModelOperations {} + +// ********************************************** Record ********************************************** +@doc("The model spread Record with the different known property type") +model DifferentSpreadFloatRecord { + @doc("The id property") + name: string; + + ...Record; +} + +@route("/spreadDifferentRecordFloat") +interface SpreadDifferentFloat + extends ModelOperations {} + +// ********************************************** Record ********************************************** +@doc("The model spread Record with the different known property type") +model DifferentSpreadModelRecord { + knownProp: string; + ...Record; +} + +@route("/spreadDifferentRecordModel") +interface SpreadDifferentModel + extends ModelOperations< + DifferentSpreadModelRecord, + "{'knownProp': 'abc', 'prop': {'state': 'ok'}}" + > {} + +// ********************************************** Record ********************************************** +@doc("The model spread Record with the different known property type") +model DifferentSpreadModelArrayRecord { + knownProp: string; + ...Record; +} + +@route("/spreadDifferentRecordModelArray") +interface SpreadDifferentModelArray + extends ModelOperations< + DifferentSpreadModelArrayRecord, + "{'knownProp': 'abc', 'prop': [{'state': 'ok'}, {'state': 'ok'}]}" + > {} + +// ****************** extends model has spread Record ************************** +@doc("The model extends from a model that spread Record with the different known property type") +model DifferentSpreadStringDerived extends DifferentSpreadStringRecord { + @doc("The index property") + derivedProp: string; +} + +@route("/extendsDifferentSpreadString") +interface ExtendsDifferentSpreadString + extends ModelOperations< + DifferentSpreadStringDerived, + "{'id': 43.125, 'prop': 'abc', 'derivedProp': 'abc'}" + > {} + +// ****************** extends model has spread Record ************************** +@doc("The model extends from a model that spread Record with the different known property type") +model DifferentSpreadFloatDerived extends DifferentSpreadFloatRecord { + @doc("The index property") + derivedProp: float32; +} + +@route("/extendsDifferentSpreadFloat") +interface ExtendsDifferentSpreadFloat + extends ModelOperations< + DifferentSpreadFloatDerived, + "{'name': 'abc', 'prop': 43.125, 'derivedProp': 43.125}" + > {} + +// ****************** extends model has spread Record ************************** + +@doc("The model extends from a model that spread Record with the different known property type") +model DifferentSpreadModelDerived extends DifferentSpreadModelRecord { + @doc("The index property") + derivedProp: ModelForRecord; +} + +@route("/extendsDifferentSpreadModel") +interface ExtendsDifferentSpreadModel + extends ModelOperations< + DifferentSpreadModelDerived, + "{'knownProp': 'abc', 'prop': {'state': 'ok'}, 'derivedProp': {'state': 'ok'}}" + > {} + +// ****************** extends model has spread Record ************************** +@doc("The model extends from a model that spread Record with the different known property type") +model DifferentSpreadModelArrayDerived extends DifferentSpreadModelArrayRecord { + @doc("The index property") + derivedProp: ModelForRecord[]; +} + +@route("/extendsDifferentSpreadModelArray") +interface ExtendsDifferentSpreadModelArray + extends ModelOperations< + DifferentSpreadModelArrayDerived, + "{'knownProp': 'abc', 'prop': [{'state': 'ok'}, {'state': 'ok'}], 'derivedProp': [{'state': 'ok'}, {'state': 'ok'}]}" + > {} + +// ****************** multiple spread of records ************************** +@doc("The model spread Record and Record") +model MultipleSpreadRecord { + @doc("The name property") + flag: boolean; + + ...Record; + ...Record; +} + +@route("/multipleSpreadRecord") +interface MultipleSpread + extends ModelOperations< + MultipleSpreadRecord, + "{'flag': true, 'prop1': 'abc', 'prop2': 43.125}" + > {} + +// ****************** spread record of unions ************************** +@doc("The model spread Record") +model SpreadRecordForUnion { + @doc("The name property") + flag: boolean; + + ...Record; +} + +@route("/spreadRecordUnion") +interface SpreadRecordUnion + extends ModelOperations< + SpreadRecordForUnion, + "{'flag': true, 'prop1': 'abc', 'prop2': 43.125}" + > {} + +// ****************** spread record of discriminated unions ************************** +// @discriminated(#{ envelope: "none" }) +// union WidgetData { +// kind0: WidgetData0, +// kind1: WidgetData1, +// } + +model WidgetData0 { + kind: "kind0"; + fooProp: string; +} + +model WidgetData1 { + kind: "kind1"; + start: utcDateTime; + end?: utcDateTime; +} + +model WidgetData2 { + kind: "kind1"; + start: string; +} + +// @doc("The model spread Record") +// model SpreadRecordForDiscriminatedUnion { +// @doc("The name property") +// name: string; + +// ...Record; +// } + +// @route("/spreadRecordDiscriminatedUnion") +// interface SpreadRecordDiscriminatedUnion +// extends ModelOperations< +// SpreadRecordForDiscriminatedUnion, +// "{'name': 'abc', 'prop1': {'kind': 'kind0', 'fooProp': 'abc'}, 'prop2': {'kind': 'kind1', 'start': '2021-01-01T00:00:00Z', 'end': '2021-01-02T00:00:00Z'}}" +// > {} + +// ****************** spread record of non-discriminated unions but could guess a discriminator ************************** +@doc("The model spread Record") +model SpreadRecordForNonDiscriminatedUnion { + @doc("The name property") + name: string; + + ...Record; +} + +@route("/spreadRecordNonDiscriminatedUnion") +interface SpreadRecordNonDiscriminatedUnion + extends ModelOperations< + SpreadRecordForNonDiscriminatedUnion, + "{'name': 'abc', 'prop1': {'kind': 'kind0', 'fooProp': 'abc'}, 'prop2': {'kind': 'kind1', 'start': '2021-01-01T00:00:00Z', 'end': '2021-01-02T00:00:00Z'}}" + > {} + +// ****************** spread record of non-discriminated unions ************************** +@doc("The model spread Record") +model SpreadRecordForNonDiscriminatedUnion2 { + @doc("The name property") + name: string; + + ...Record; +} + +@route("/spreadRecordNonDiscriminatedUnion2") +interface SpreadRecordNonDiscriminatedUnion2 + extends ModelOperations< + SpreadRecordForNonDiscriminatedUnion2, + "{'name': 'abc', 'prop1': {'kind': 'kind1', 'start': '2021-01-01T00:00:00Z'}, 'prop2': {'kind': 'kind1', 'start': '2021-01-01T00:00:00Z', 'end': '2021-01-02T00:00:00Z'}}" + > {} + +// ****************** spread record of non-discriminated unions ************************** +@doc("The model spread Record") +model SpreadRecordForNonDiscriminatedUnion3 { + @doc("The name property") + name: string; + + ...Record; +} + +@route("/spreadRecordNonDiscriminatedUnion3") +interface SpreadRecordNonDiscriminatedUnion3 + extends ModelOperations< + SpreadRecordForNonDiscriminatedUnion3, + "{'name': 'abc', 'prop1': [{'kind': 'kind1', 'start': '2021-01-01T00:00:00Z'}, {'kind': 'kind1', 'start': '2021-01-01T00:00:00Z'], 'prop2': {'kind': 'kind1', 'start': '2021-01-01T00:00:00Z', 'end': '2021-01-02T00:00:00Z'}}" + > {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/mockapi.ts new file mode 100644 index 00000000000..62d35378115 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/mockapi.ts @@ -0,0 +1,471 @@ +import { json, MockRequest, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +const recordFloatBody = { + id: 43.125, + prop: 43.125, +}; +const recordModelBody = { + knownProp: { state: "ok" }, + prop: { state: "ok" }, +}; +const recordModelArrayBody = { + knownProp: [{ state: "ok" }, { state: "ok" }], + prop: [{ state: "ok" }, { state: "ok" }], +}; +const differentRecordStringBody = { + id: 43.125, + prop: "abc", +}; +const differentRecordFloatBody = { + name: "abc", + prop: 43.125, +}; +const differentRecordModelBody = { + knownProp: "abc", + prop: { state: "ok" }, +}; +const differentRecordModelArrayBody = { + knownProp: "abc", + prop: [{ state: "ok" }, { state: "ok" }], +}; +const extendsModelSpreadStringBody = { + id: 43.125, + prop: "abc", + derivedProp: "abc", +}; +const extendsModelSpreadFloatBody = { + name: "abc", + prop: 43.125, + derivedProp: 43.125, +}; +const extendsModelSpreadModelBody = { + knownProp: "abc", + prop: { state: "ok" }, + derivedProp: { state: "ok" }, +}; +const extendsModelSpreadModelArrayBody = { + knownProp: "abc", + prop: [{ state: "ok" }, { state: "ok" }], + derivedProp: [{ state: "ok" }, { state: "ok" }], +}; +const multipleSpreadBody = { + flag: true, + prop1: "abc", + prop2: 43.125, +}; +const recordUnionBody = multipleSpreadBody; +const recordDiscriminatedUnionBody = { + name: "abc", + prop1: { + kind: "kind0", + fooProp: "abc", + }, + prop2: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + end: "2021-01-02T00:00:00Z", + }, +}; +const recordNonDiscriminatedUnion2Body = { + name: "abc", + prop1: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + }, + prop2: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + end: "2021-01-02T00:00:00Z", + }, +}; +const recordNonDiscriminatedUnion3Body = { + name: "abc", + prop1: [ + { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + }, + { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + }, + ], + prop2: { + kind: "kind1", + start: "2021-01-01T00:00:00Z", + end: "2021-01-02T00:00:00Z", + }, +}; +function createServerTests(url: string, value: unknown) { + return { + get: passOnSuccess({ + uri: url, + method: `get`, + request: {}, + response: { + status: 200, + body: json(value), + }, + kind: "MockApiDefinition", + }), + put: passOnSuccess({ + uri: url, + method: `put`, + request: { + body: json(value), + }, + response: { + status: 204, + }, + handler: (req: MockRequest) => { + const expectedBody = JSON.parse(JSON.stringify(value)); + req.expect.coercedBodyEquals(expectedBody); + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }), + }; +} + +const Type_Property_Additional_Properties_Extends_Record_Unknown = createServerTests( + `/type/property/additionalProperties/extendsRecordUnknown`, + { + name: "ExtendsUnknownAdditionalProperties", + prop1: 32, + prop2: true, + prop3: "abc", + }, +); +Scenarios.Type_Property_AdditionalProperties_ExtendsUnknown_get = + Type_Property_Additional_Properties_Extends_Record_Unknown.get; +Scenarios.Type_Property_AdditionalProperties_ExtendsUnknown_put = + Type_Property_Additional_Properties_Extends_Record_Unknown.put; + +const Type_Property_Additional_Properties_Extends_Record_Unknown_Derived = createServerTests( + `/type/property/additionalProperties/extendsRecordUnknownDerived`, + { + name: "ExtendsUnknownAdditionalProperties", + index: 314, + age: 2.71875, + prop1: 32, + prop2: true, + prop3: "abc", + }, +); +Scenarios.Type_Property_AdditionalProperties_ExtendsUnknownDerived_get = + Type_Property_Additional_Properties_Extends_Record_Unknown_Derived.get; +Scenarios.Type_Property_AdditionalProperties_ExtendsUnknownDerived_put = + Type_Property_Additional_Properties_Extends_Record_Unknown_Derived.put; + +const Type_Property_Additional_Properties_Extends_Unknown_Discriminated = createServerTests( + `/type/property/additionalProperties/extendsUnknownDiscriminated`, + { + kind: "derived", + name: "Derived", + index: 314, + age: 2.71875, + prop1: 32, + prop2: true, + prop3: "abc", + }, +); +Scenarios.Type_Property_AdditionalProperties_ExtendsUnknownDiscriminated_get = + Type_Property_Additional_Properties_Extends_Unknown_Discriminated.get; +Scenarios.Type_Property_AdditionalProperties_ExtendsUnknownDiscriminated_put = + Type_Property_Additional_Properties_Extends_Unknown_Discriminated.put; + +const Type_Property_Additional_Properties_Is_Record_Unknown = createServerTests( + `/type/property/additionalProperties/isRecordUnknown`, + { + name: "IsUnknownAdditionalProperties", + prop1: 32, + prop2: true, + prop3: "abc", + }, +); +Scenarios.Type_Property_AdditionalProperties_IsUnknown_get = + Type_Property_Additional_Properties_Is_Record_Unknown.get; +Scenarios.Type_Property_AdditionalProperties_IsUnknown_put = + Type_Property_Additional_Properties_Is_Record_Unknown.put; + +const Type_Property_Additional_Properties_Is_Record_Unknown_Derived = createServerTests( + `/type/property/additionalProperties/isRecordUnknownDerived`, + { + name: "IsUnknownAdditionalProperties", + index: 314, + age: 2.71875, + prop1: 32, + prop2: true, + prop3: "abc", + }, +); +Scenarios.Type_Property_AdditionalProperties_IsUnknownDerived_get = + Type_Property_Additional_Properties_Is_Record_Unknown_Derived.get; +Scenarios.Type_Property_AdditionalProperties_IsUnknownDerived_put = + Type_Property_Additional_Properties_Is_Record_Unknown_Derived.put; + +const Type_Property_Additional_Properties_Is_Unknown_Discriminated = createServerTests( + `/type/property/additionalProperties/isUnknownDiscriminated`, + { + kind: "derived", + name: "Derived", + index: 314, + age: 2.71875, + prop1: 32, + prop2: true, + prop3: "abc", + }, +); +Scenarios.Type_Property_AdditionalProperties_IsUnknownDiscriminated_get = + Type_Property_Additional_Properties_Is_Unknown_Discriminated.get; +Scenarios.Type_Property_AdditionalProperties_IsUnknownDiscriminated_put = + Type_Property_Additional_Properties_Is_Unknown_Discriminated.put; + +const Type_Property_Additional_Properties_Extends_Record_String = createServerTests( + `/type/property/additionalProperties/extendsRecordString`, + { + name: "ExtendsStringAdditionalProperties", + prop: "abc", + }, +); +Scenarios.Type_Property_AdditionalProperties_ExtendsString_get = + Type_Property_Additional_Properties_Extends_Record_String.get; +Scenarios.Type_Property_AdditionalProperties_ExtendsString_put = + Type_Property_Additional_Properties_Extends_Record_String.put; + +const Type_Property_Additional_Properties_Is_Record_String = createServerTests( + `/type/property/additionalProperties/isRecordstring`, + { + name: "IsStringAdditionalProperties", + prop: "abc", + }, +); +Scenarios.Type_Property_AdditionalProperties_IsString_get = + Type_Property_Additional_Properties_Is_Record_String.get; +Scenarios.Type_Property_AdditionalProperties_IsString_put = + Type_Property_Additional_Properties_Is_Record_String.put; + +const Type_Property_Additional_Properties_Extends_Record_Float = createServerTests( + `/type/property/additionalProperties/extendsRecordFloat`, + recordFloatBody, +); +Scenarios.Type_Property_AdditionalProperties_ExtendsFloat_get = + Type_Property_Additional_Properties_Extends_Record_Float.get; +Scenarios.Type_Property_AdditionalProperties_ExtendsFloat_put = + Type_Property_Additional_Properties_Extends_Record_Float.put; + +const Type_Property_Additional_Properties_Is_Record_Float = createServerTests( + `/type/property/additionalProperties/isRecordFloat`, + recordFloatBody, +); +Scenarios.Type_Property_AdditionalProperties_IsFloat_get = + Type_Property_Additional_Properties_Is_Record_Float.get; +Scenarios.Type_Property_AdditionalProperties_IsFloat_put = + Type_Property_Additional_Properties_Is_Record_Float.put; + +const Type_Property_Additional_Properties_Extends_Record_Model = createServerTests( + `/type/property/additionalProperties/extendsRecordModel`, + recordModelBody, +); +Scenarios.Type_Property_AdditionalProperties_ExtendsModel_get = + Type_Property_Additional_Properties_Extends_Record_Model.get; +Scenarios.Type_Property_AdditionalProperties_ExtendsModel_put = + Type_Property_Additional_Properties_Extends_Record_Model.put; + +const Type_Property_Additional_Properties_Is_Record_Model = createServerTests( + `/type/property/additionalProperties/isRecordModel`, + recordModelBody, +); +Scenarios.Type_Property_AdditionalProperties_IsModel_get = + Type_Property_Additional_Properties_Is_Record_Model.get; +Scenarios.Type_Property_AdditionalProperties_IsModel_put = + Type_Property_Additional_Properties_Is_Record_Model.put; + +const Type_Property_Additional_Properties_Extends_Record_Model_Array = createServerTests( + `/type/property/additionalProperties/extendsRecordModelArray`, + recordModelArrayBody, +); +Scenarios.Type_Property_AdditionalProperties_ExtendsModelArray_get = + Type_Property_Additional_Properties_Extends_Record_Model_Array.get; +Scenarios.Type_Property_AdditionalProperties_ExtendsModelArray_put = + Type_Property_Additional_Properties_Extends_Record_Model_Array.put; + +const Type_Property_Additional_Properties_Is_Record_Model_Array = createServerTests( + `/type/property/additionalProperties/isRecordModelArray`, + recordModelArrayBody, +); +Scenarios.Type_Property_AdditionalProperties_IsModelArray_get = + Type_Property_Additional_Properties_Is_Record_Model_Array.get; +Scenarios.Type_Property_AdditionalProperties_IsModelArray_put = + Type_Property_Additional_Properties_Is_Record_Model_Array.put; + +const Type_Property_Additional_Properties_Spread_Record_String = createServerTests( + `/type/property/additionalProperties/spreadRecordString`, + { + name: "SpreadSpringRecord", + prop: "abc", + }, +); +Scenarios.Type_Property_AdditionalProperties_SpreadString_get = + Type_Property_Additional_Properties_Spread_Record_String.get; +Scenarios.Type_Property_AdditionalProperties_SpreadString_put = + Type_Property_Additional_Properties_Spread_Record_String.put; + +const Type_Property_Additional_Properties_Spread_Record_Float = createServerTests( + `/type/property/additionalProperties/spreadRecordFloat`, + recordFloatBody, +); +Scenarios.Type_Property_AdditionalProperties_SpreadFloat_get = + Type_Property_Additional_Properties_Spread_Record_Float.get; +Scenarios.Type_Property_AdditionalProperties_SpreadFloat_put = + Type_Property_Additional_Properties_Spread_Record_Float.put; + +const Type_Property_Additional_Properties_Spread_Record_Model = createServerTests( + `/type/property/additionalProperties/spreadRecordModel`, + recordModelBody, +); +Scenarios.Type_Property_AdditionalProperties_SpreadModel_get = + Type_Property_Additional_Properties_Spread_Record_Model.get; +Scenarios.Type_Property_AdditionalProperties_SpreadModel_put = + Type_Property_Additional_Properties_Spread_Record_Model.put; + +const Type_Property_Additional_Properties_Spread_Record_Model_Array = createServerTests( + `/type/property/additionalProperties/spreadRecordModelArray`, + recordModelArrayBody, +); +Scenarios.Type_Property_AdditionalProperties_SpreadModelArray_get = + Type_Property_Additional_Properties_Spread_Record_Model_Array.get; +Scenarios.Type_Property_AdditionalProperties_SpreadModelArray_put = + Type_Property_Additional_Properties_Spread_Record_Model_Array.put; + +const Type_Property_Additional_Properties_Spread_Different_Record_String = createServerTests( + `/type/property/additionalProperties/spreadDifferentRecordString`, + differentRecordStringBody, +); +Scenarios.Type_Property_AdditionalProperties_SpreadDifferentString_get = + Type_Property_Additional_Properties_Spread_Different_Record_String.get; +Scenarios.Type_Property_AdditionalProperties_SpreadDifferentString_put = + Type_Property_Additional_Properties_Spread_Different_Record_String.put; + +const Type_Property_Additional_Properties_Spread_Different_Record_Float = createServerTests( + `/type/property/additionalProperties/spreadDifferentRecordFloat`, + differentRecordFloatBody, +); +Scenarios.Type_Property_AdditionalProperties_SpreadDifferentFloat_get = + Type_Property_Additional_Properties_Spread_Different_Record_Float.get; +Scenarios.Type_Property_AdditionalProperties_SpreadDifferentFloat_put = + Type_Property_Additional_Properties_Spread_Different_Record_Float.put; + +const Type_Property_Additional_Properties_Spread_Different_Record_Model = createServerTests( + `/type/property/additionalProperties/spreadDifferentRecordModel`, + differentRecordModelBody, +); +Scenarios.Type_Property_AdditionalProperties_SpreadDifferentModel_get = + Type_Property_Additional_Properties_Spread_Different_Record_Model.get; +Scenarios.Type_Property_AdditionalProperties_SpreadDifferentModel_put = + Type_Property_Additional_Properties_Spread_Different_Record_Model.put; + +const Type_Property_Additional_Properties_Spread_Different_Record_Model_Array = createServerTests( + `/type/property/additionalProperties/spreadDifferentRecordModelArray`, + differentRecordModelArrayBody, +); +Scenarios.Type_Property_AdditionalProperties_SpreadDifferentModelArray_get = + Type_Property_Additional_Properties_Spread_Different_Record_Model_Array.get; +Scenarios.Type_Property_AdditionalProperties_SpreadDifferentModelArray_put = + Type_Property_Additional_Properties_Spread_Different_Record_Model_Array.put; + +const Type_Property_Additional_Properties_Extends_Different_Spread_String = createServerTests( + `/type/property/additionalProperties/extendsDifferentSpreadString`, + extendsModelSpreadStringBody, +); +Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadString_get = + Type_Property_Additional_Properties_Extends_Different_Spread_String.get; +Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadString_put = + Type_Property_Additional_Properties_Extends_Different_Spread_String.put; + +const Type_Property_Additional_Properties_Extends_Different_Spread_Float = createServerTests( + `/type/property/additionalProperties/extendsDifferentSpreadFloat`, + extendsModelSpreadFloatBody, +); +Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadFloat_get = + Type_Property_Additional_Properties_Extends_Different_Spread_Float.get; +Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadFloat_put = + Type_Property_Additional_Properties_Extends_Different_Spread_Float.put; + +const Type_Property_Additional_Properties_Extends_Different_Spread_Model = createServerTests( + `/type/property/additionalProperties/extendsDifferentSpreadModel`, + extendsModelSpreadModelBody, +); +Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadModel_get = + Type_Property_Additional_Properties_Extends_Different_Spread_Model.get; +Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadModel_put = + Type_Property_Additional_Properties_Extends_Different_Spread_Model.put; + +const Type_Property_Additional_Properties_Extends_Different_Spread_Model_Array = createServerTests( + `/type/property/additionalProperties/extendsDifferentSpreadModelArray`, + extendsModelSpreadModelArrayBody, +); +Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadModelArray_get = + Type_Property_Additional_Properties_Extends_Different_Spread_Model_Array.get; +Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadModelArray_put = + Type_Property_Additional_Properties_Extends_Different_Spread_Model_Array.put; + +const Type_Property_Additional_Properties_Multiple_Spread_Record = createServerTests( + `/type/property/additionalProperties/multipleSpreadRecord`, + multipleSpreadBody, +); +Scenarios.Type_Property_AdditionalProperties_MultipleSpread_get = + Type_Property_Additional_Properties_Multiple_Spread_Record.get; +Scenarios.Type_Property_AdditionalProperties_MultipleSpread_put = + Type_Property_Additional_Properties_Multiple_Spread_Record.put; + +const Type_Property_Additional_Properties_Spread_Record_Union = createServerTests( + `/type/property/additionalProperties/spreadRecordUnion`, + recordUnionBody, +); +Scenarios.Type_Property_AdditionalProperties_SpreadRecordUnion_get = + Type_Property_Additional_Properties_Spread_Record_Union.get; +Scenarios.Type_Property_AdditionalProperties_SpreadRecordUnion_put = + Type_Property_Additional_Properties_Spread_Record_Union.put; + +// const Type_Property_Additional_Properties_Spread_Record_Discriminated_Union = createServerTests( +// `/type/property/additionalProperties/spreadRecordDiscriminatedUnion`, +// recordDiscriminatedUnionBody, +// ); +// Scenarios.Type_Property_AdditionalProperties_SpreadRecordDiscriminatedUnion_get = +// Type_Property_Additional_Properties_Spread_Record_Discriminated_Union.get; +// Scenarios.Type_Property_AdditionalProperties_SpreadRecordDiscriminatedUnion_put = +// Type_Property_Additional_Properties_Spread_Record_Discriminated_Union.put; + +const Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union = createServerTests( + `/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion`, + recordDiscriminatedUnionBody, +); +Scenarios.Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion_get = + Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union.get; +Scenarios.Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion_put = + Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union.put; + +const Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union2 = + createServerTests( + `/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2`, + recordNonDiscriminatedUnion2Body, + ); +Scenarios.Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion2_get = + Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union2.get; +Scenarios.Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion2_put = + Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union2.put; + +const Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union3 = + createServerTests( + `/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3`, + recordNonDiscriminatedUnion3Body, + ); +Scenarios.Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion3_get = + Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union3.get; +Scenarios.Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion3_put = + Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union3.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/main.tsp new file mode 100644 index 00000000000..aa9c5b0f294 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/main.tsp @@ -0,0 +1,139 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates models with nullable properties.") +@scenarioService("/type/property/nullable") +namespace Type.Property.Nullable; + +@doc("Template type for testing models with nullable property. Pass in the type of the property you are looking for") +model ModelTemplate { + @doc("Required property") + requiredProperty: string; + + @doc("Property") + nullableProperty: TProperty | null; +} + +@doc("Operations associated with getting and putting models with nullable properties.") +interface OperationsTemplate< + TModel, + TDoc extends valueof string, + TDefaultDoc extends valueof string = "null" +> { + @doc("Get models that will return all properties in the model") + @scenario + @scenarioDoc(""" + Expected response body: + ```json + { "requiredProperty": "foo", "nullableProperty": ${TDoc}} + ``` + """) + @route("/non-null") + @get + getNonNull(): TModel; + + @doc("Get models that will return the default object") + @scenario + @scenarioDoc(""" + Expected response body: + ```json + { "requiredProperty": "foo", "nullableProperty": ${TDefaultDoc}} + ``` + """) + @route("/null") + @get + getNull(): TModel; + + @doc("Put a body with all properties present.") + @scenario + @scenarioDoc(""" + Expected request body: + ```json + { "requiredProperty": "foo", "nullableProperty": ${TDoc}} + ``` + """) + @route("/non-null") + @patch + patchNonNull( + @doc("content-type is application/merge-patch+json") + @header("Content-Type") + contentType: "application/merge-patch+json", + + @body body: TModel, + ): void; + + @doc("Put a body with default properties.") + @scenario + @scenarioDoc(""" + Expected request body: + ```json + { "requiredProperty": "foo", "nullableProperty": ${TDefaultDoc}} + ``` + """) + @route("/null") + @patch + patchNull( + @doc("content-type is application/merge-patch+json") + @header("Content-Type") + contentType: "application/merge-patch+json", + + @body body: TModel, + ): void; +} + +// Model with nullable string property +model StringProperty is ModelTemplate; +@route("/string") +interface String extends OperationsTemplate {} + +// Model with nullable bytes property +model BytesProperty is ModelTemplate; +@route("/bytes") +interface Bytes extends OperationsTemplate {} + +// Model with nullable datetime property +@doc("Model with a datetime property") +model DatetimeProperty is ModelTemplate; +@route("/datetime") +interface Datetime extends OperationsTemplate {} + +// Model with nullable duration property +@doc("Model with a duration property") +model DurationProperty is ModelTemplate; +@route("/duration") +interface Duration extends OperationsTemplate {} + +// Model with nullable collection bytes property +@doc("Model with collection bytes properties") +model CollectionsByteProperty is ModelTemplate; +@route("/collections/bytes") +interface CollectionsByte + extends OperationsTemplate< + CollectionsByteProperty, + "[aGVsbG8sIHdvcmxkIQ==, aGVsbG8sIHdvcmxkIQ==]" + > {} + +// Model with nullable collection models property +@doc("Inner model used in collections model property") +model InnerModel { + @doc("Inner model property") + property: string; +} +@doc("Model with collection models properties") +model CollectionsModelProperty is ModelTemplate; +@route("/collections/model") +interface CollectionsModel + extends OperationsTemplate< + CollectionsModelProperty, + "[{'property': 'hello'}, {'property': 'world'}]" + > {} + +// Model with nullable collection string property +@doc("Model with collection string properties") +model CollectionsStringProperty is ModelTemplate; +@route("/collections/string") +interface CollectionsString + extends OperationsTemplate {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/mockapi.ts new file mode 100644 index 00000000000..10a35c7b609 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/mockapi.ts @@ -0,0 +1,195 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createServerTests(url: string, value: unknown, patchNullableProperty?: any) { + return { + get: passOnSuccess({ + uri: url, + method: `get`, + response: { + status: 200, + body: json(value), + }, + kind: "MockApiDefinition", + }), + patch: passOnSuccess({ + uri: url, + method: `patch`, + request: { + body: json( + { + requiredProperty: "foo", + nullableProperty: patchNullableProperty || null, + }, + "application/merge-patch+json", + ), + }, + response: { + status: 204, + }, + handler: (req) => { + req.expect.coercedBodyEquals({ + requiredProperty: "foo", + nullableProperty: patchNullableProperty || null, + }); + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }), + }; +} + +const Type_Property_Nullable_String_Null = createServerTests( + `/type/property/nullable/string/null`, + { + requiredProperty: "foo", + nullableProperty: null, + }, +); +const Type_Property_Nullable_String_Non_Null = createServerTests( + `/type/property/nullable/string/non-null`, + { + requiredProperty: "foo", + nullableProperty: "hello", + }, + "hello", +); + +Scenarios.Type_Property_Nullable_String_getNonNull = Type_Property_Nullable_String_Non_Null.get; +Scenarios.Type_Property_Nullable_String_getNull = Type_Property_Nullable_String_Null.get; +Scenarios.Type_Property_Nullable_String_patchNonNull = Type_Property_Nullable_String_Non_Null.patch; +Scenarios.Type_Property_Nullable_String_patchNull = Type_Property_Nullable_String_Null.patch; + +const Type_Property_Nullable_Bytes_Null = createServerTests(`/type/property/nullable/bytes/null`, { + requiredProperty: "foo", + nullableProperty: null, +}); +const Type_Property_Nullable_Bytes_Non_Null = createServerTests( + `/type/property/nullable/bytes/non-null`, + { + requiredProperty: "foo", + nullableProperty: "aGVsbG8sIHdvcmxkIQ==", + }, + "aGVsbG8sIHdvcmxkIQ==", +); +Scenarios.Type_Property_Nullable_Bytes_getNonNull = Type_Property_Nullable_Bytes_Non_Null.get; +Scenarios.Type_Property_Nullable_Bytes_getNull = Type_Property_Nullable_Bytes_Null.get; +Scenarios.Type_Property_Nullable_Bytes_patchNonNull = Type_Property_Nullable_Bytes_Non_Null.patch; +Scenarios.Type_Property_Nullable_Bytes_patchNull = Type_Property_Nullable_Bytes_Null.patch; + +const Type_Property_Nullable_DateTime_Null = createServerTests( + `/type/property/nullable/datetime/null`, + { + requiredProperty: "foo", + nullableProperty: null, + }, +); +const Type_Property_Nullable_DateTime_Non_Null = createServerTests( + `/type/property/nullable/datetime/non-null`, + { + requiredProperty: "foo", + nullableProperty: "2022-08-26T18:38:00Z", + }, + "2022-08-26T18:38:00Z", +); +Scenarios.Type_Property_Nullable_Datetime_getNonNull = Type_Property_Nullable_DateTime_Non_Null.get; +Scenarios.Type_Property_Nullable_Datetime_getNull = Type_Property_Nullable_DateTime_Null.get; +Scenarios.Type_Property_Nullable_Datetime_patchNonNull = + Type_Property_Nullable_DateTime_Non_Null.patch; +Scenarios.Type_Property_Nullable_Datetime_patchNull = Type_Property_Nullable_DateTime_Null.patch; + +const Type_Property_Nullable_Duration_Null = createServerTests( + `/type/property/nullable/duration/null`, + { + requiredProperty: "foo", + nullableProperty: null, + }, +); +const Type_Property_Nullable_Duration_Non_Null = createServerTests( + `/type/property/nullable/duration/non-null`, + { + requiredProperty: "foo", + nullableProperty: "P123DT22H14M12.011S", + }, + "P123DT22H14M12.011S", +); +Scenarios.Type_Property_Nullable_Duration_getNonNull = Type_Property_Nullable_Duration_Non_Null.get; +Scenarios.Type_Property_Nullable_Duration_getNull = Type_Property_Nullable_Duration_Null.get; +Scenarios.Type_Property_Nullable_Duration_patchNonNull = + Type_Property_Nullable_Duration_Non_Null.patch; +Scenarios.Type_Property_Nullable_Duration_patchNull = Type_Property_Nullable_Duration_Null.patch; + +const Type_Property_Nullable_Collections_Bytes_Null = createServerTests( + `/type/property/nullable/collections/bytes/null`, + { + requiredProperty: "foo", + nullableProperty: null, + }, +); +const Type_Property_Nullable_Collections_Bytes_Non_Null = createServerTests( + `/type/property/nullable/collections/bytes/non-null`, + { + requiredProperty: "foo", + nullableProperty: ["aGVsbG8sIHdvcmxkIQ==", "aGVsbG8sIHdvcmxkIQ=="], + }, + ["aGVsbG8sIHdvcmxkIQ==", "aGVsbG8sIHdvcmxkIQ=="], +); +Scenarios.Type_Property_Nullable_CollectionsByte_getNonNull = + Type_Property_Nullable_Collections_Bytes_Non_Null.get; +Scenarios.Type_Property_Nullable_CollectionsByte_getNull = + Type_Property_Nullable_Collections_Bytes_Null.get; +Scenarios.Type_Property_Nullable_CollectionsByte_patchNonNull = + Type_Property_Nullable_Collections_Bytes_Non_Null.patch; +Scenarios.Type_Property_Nullable_CollectionsByte_patchNull = + Type_Property_Nullable_Collections_Bytes_Null.patch; + +const Type_Property_Nullable_Collections_Model_Null = createServerTests( + `/type/property/nullable/collections/model/null`, + { + requiredProperty: "foo", + nullableProperty: null, + }, +); +const Type_Property_Nullable_Collections_Model_Non_Null = createServerTests( + `/type/property/nullable/collections/model/non-null`, + { + requiredProperty: "foo", + nullableProperty: [{ property: "hello" }, { property: "world" }], + }, + [{ property: "hello" }, { property: "world" }], +); +Scenarios.Type_Property_Nullable_CollectionsModel_getNonNull = + Type_Property_Nullable_Collections_Model_Non_Null.get; +Scenarios.Type_Property_Nullable_CollectionsModel_getNull = + Type_Property_Nullable_Collections_Model_Null.get; +Scenarios.Type_Property_Nullable_CollectionsModel_patchNonNull = + Type_Property_Nullable_Collections_Model_Non_Null.patch; +Scenarios.Type_Property_Nullable_CollectionsModel_patchNull = + Type_Property_Nullable_Collections_Model_Null.patch; + +const Type_Property_Nullable_Collections_String_Null = createServerTests( + `/type/property/nullable/collections/string/null`, + { + requiredProperty: "foo", + nullableProperty: null, + }, +); +const Type_Property_Nullable_Collections_String_Non_Null = createServerTests( + `/type/property/nullable/collections/string/non-null`, + { + requiredProperty: "foo", + nullableProperty: ["hello", "world"], + }, + ["hello", "world"], +); +Scenarios.Type_Property_Nullable_CollectionsString_getNonNull = + Type_Property_Nullable_Collections_String_Non_Null.get; +Scenarios.Type_Property_Nullable_CollectionsString_getNull = + Type_Property_Nullable_Collections_String_Null.get; +Scenarios.Type_Property_Nullable_CollectionsString_patchNonNull = + Type_Property_Nullable_Collections_String_Non_Null.patch; +Scenarios.Type_Property_Nullable_CollectionsString_patchNull = + Type_Property_Nullable_Collections_String_Null.patch; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/main.tsp new file mode 100644 index 00000000000..7c7cd060005 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/main.tsp @@ -0,0 +1,226 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates models with optional properties.") +@scenarioService("/type/property/optional") +namespace Type.Property.Optional; + +@doc("Template type for testing models with optional property. Pass in the type of the property you are looking for") +model ModelTemplate { + @doc("Property") + property?: TProperty; +} + +@doc("Operations associated with getting and putting models with optional properties.") +interface OperationsTemplate< + TModel, + TDoc extends valueof string, + TDefaultDoc extends valueof string = "{}" +> { + @doc("Get models that will return all properties in the model") + @scenario + @scenarioDoc(""" + Expected response body: + ```json + {"property": ${TDoc}} + ``` + """) + @route("/all") + @get + getAll(): TModel; + + @doc("Get models that will return the default object") + @scenario + @scenarioDoc(""" + Expected response body: + ```json + ${TDefaultDoc} + ``` + """) + @route("/default") + @get + getDefault(): TModel; + + @doc("Put a body with all properties present.") + @scenario + @scenarioDoc(""" + Expected request body: + ```json + {"property": ${TDoc}} + ``` + """) + @route("/all") + @put + putAll(@body body: TModel): void; + + @doc("Put a body with default properties.") + @scenario + @scenarioDoc(""" + Expected request body: + ```json + ${TDefaultDoc} + ``` + """) + @route("/default") + @put + putDefault(@body body: TModel): void; +} + +// Model with optional string property +model StringProperty is ModelTemplate; +@route("/string") +interface String extends OperationsTemplate {} + +// Model with optional bytes property +model BytesProperty is ModelTemplate; +@route("/bytes") +interface Bytes extends OperationsTemplate {} + +// Model with optional datetime property +@doc("Model with a datetime property") +model DatetimeProperty is ModelTemplate; +@route("/datetime") +interface Datetime extends OperationsTemplate {} + +// Model with optional duration property +@doc("Model with a duration property") +model DurationProperty is ModelTemplate; +@route("/duration") +interface Duration extends OperationsTemplate {} + +// Model with optional plainDate property +@doc("Model with a plainDate property") +model PlainDateProperty is ModelTemplate; +@route("/plainDate") +interface PlainDate extends OperationsTemplate {} + +// Model with optional property +@doc("Model with a plainTime property") +model PlainTimeProperty is ModelTemplate; +@route("/plainTime") +interface PlainTime extends OperationsTemplate {} + +// Model with optional collection bytes property +@doc("Model with collection bytes properties") +model CollectionsByteProperty is ModelTemplate; +@route("/collections/bytes") +interface CollectionsByte + extends OperationsTemplate< + CollectionsByteProperty, + "[\"aGVsbG8sIHdvcmxkIQ==\", \"aGVsbG8sIHdvcmxkIQ==\"]" + > {} + +// Model with optional collection models property +@doc("Model with collection models properties") +model CollectionsModelProperty is ModelTemplate; +@route("/collections/model") +interface CollectionsModel + extends OperationsTemplate< + CollectionsModelProperty, + "[{'property': 'hello'}, {'property': 'world'}]" + > {} + +// Model with optional string literal property +@doc("Model with string literal property") +model StringLiteralProperty is ModelTemplate<"hello">; +@route("/string/literal") +interface StringLiteral extends OperationsTemplate {} + +// Model with optional int literal property +@doc("Model with int literal property") +model IntLiteralProperty is ModelTemplate<1>; +@route("/int/literal") +interface IntLiteral extends OperationsTemplate {} + +// Model with optional float literal property +@doc("Model with float literal property") +model FloatLiteralProperty is ModelTemplate<1.25>; +@route("/float/literal") +interface FloatLiteral extends OperationsTemplate {} + +// Model with optional boolean literal property +@doc("Model with boolean literal property") +model BooleanLiteralProperty is ModelTemplate; +@route("/boolean/literal") +interface BooleanLiteral extends OperationsTemplate {} + +// Model with union of string literal property +@doc("Model with union of string literal property") +model UnionStringLiteralProperty is ModelTemplate<"hello" | "world">; +@route("/union/string/literal") +interface UnionStringLiteral extends OperationsTemplate {} + +// Model with union of int literal property +@doc("Model with union of int literal property") +model UnionIntLiteralProperty is ModelTemplate<1 | 2>; +@route("/union/int/literal") +interface UnionIntLiteral extends OperationsTemplate {} + +// Model with union of float literal property +@doc("Model with union of float literal property") +model UnionFloatLiteralProperty is ModelTemplate<1.25 | 2.375>; +@route("/union/float/literal") +interface UnionFloatLiteral extends OperationsTemplate {} + +@doc("Model with required and optional properties") +model RequiredAndOptionalProperty { + @doc("optional string property") + optionalProperty?: string; + + @doc("required int property") + requiredProperty: int32; +} +@doc("Test optional and required properties") +@route("/requiredAndOptional") +interface RequiredAndOptional { + @doc("Get models that will return all properties in the model") + @scenario + @scenarioDoc(""" + Expected response body: + ```json + {"optionalProperty": "hello", "requiredProperty": 42} + ``` + """) + @route("/all") + @get + getAll(): RequiredAndOptionalProperty; + + @doc("Get models that will return only the required properties") + @scenario + @scenarioDoc(""" + Expected response body: + ```json + {"requiredProperty": 42} + ``` + """) + @route("/requiredOnly") + @get + getRequiredOnly(): RequiredAndOptionalProperty; + + @doc("Put a body with all properties present.") + @scenario + @scenarioDoc(""" + Expected request body: + ```json + {"optionalProperty": "hello", "requiredProperty": 42} + ``` + """) + @route("/all") + @put + putAll(@body body: RequiredAndOptionalProperty): void; + + @doc("Put a body with only required properties.") + @scenario + @scenarioDoc(""" + Expected request body: + ```json + {"requiredProperty": 42} + ``` + """) + @route("/requiredOnly") + @put + putRequiredOnly(@body body: RequiredAndOptionalProperty): void; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/mockapi.ts new file mode 100644 index 00000000000..c69baf3f1a9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/mockapi.ts @@ -0,0 +1,302 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createServerTests(url: string, value: unknown) { + return { + get: passOnSuccess({ + uri: url, + method: `get`, + request: {}, + response: { + status: 200, + body: json(value), + }, + kind: "MockApiDefinition", + }), + put: passOnSuccess({ + uri: url, + method: `put`, + request: { + body: json(value), + }, + response: { + status: 204, + }, + handler: (req) => { + req.expect.coercedBodyEquals(value); + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }), + }; +} + +const Type_Property_Optional_String_Default = createServerTests( + `/type/property/optional/string/default`, + {}, +); +const Type_Property_Optional_String_All = createServerTests(`/type/property/optional/string/all`, { + property: "hello", +}); +Scenarios.Type_Property_Optional_String_getDefault = Type_Property_Optional_String_Default.get; +Scenarios.Type_Property_Optional_String_putDefault = Type_Property_Optional_String_Default.put; +Scenarios.Type_Property_Optional_String_getAll = Type_Property_Optional_String_All.get; +Scenarios.Type_Property_Optional_String_putAll = Type_Property_Optional_String_All.put; + +const Type_Property_Optional_Bytes_Default = createServerTests( + `/type/property/optional/bytes/default`, + {}, +); +const Type_Property_Optional_Bytes_All = createServerTests(`/type/property/optional/bytes/all`, { + property: "aGVsbG8sIHdvcmxkIQ==", +}); +Scenarios.Type_Property_Optional_Bytes_getDefault = Type_Property_Optional_Bytes_Default.get; +Scenarios.Type_Property_Optional_Bytes_putDefault = Type_Property_Optional_Bytes_Default.put; +Scenarios.Type_Property_Optional_Bytes_getAll = Type_Property_Optional_Bytes_All.get; +Scenarios.Type_Property_Optional_Bytes_putAll = Type_Property_Optional_Bytes_All.put; + +const Type_Property_Optional_DateTime_Default = createServerTests( + `/type/property/optional/datetime/default`, + {}, +); +const Type_Property_Optional_DateTime_All = createServerTests( + `/type/property/optional/datetime/all`, + { + property: "2022-08-26T18:38:00Z", + }, +); +Scenarios.Type_Property_Optional_Datetime_getDefault = Type_Property_Optional_DateTime_Default.get; +Scenarios.Type_Property_Optional_Datetime_putDefault = Type_Property_Optional_DateTime_Default.put; +Scenarios.Type_Property_Optional_Datetime_getAll = Type_Property_Optional_DateTime_All.get; +Scenarios.Type_Property_Optional_Datetime_putAll = Type_Property_Optional_DateTime_All.put; + +const Type_Property_Optional_Duration_Default = createServerTests( + `/type/property/optional/duration/default`, + {}, +); +const Type_Property_Optional_Duration_All = createServerTests( + `/type/property/optional/duration/all`, + { + property: "P123DT22H14M12.011S", + }, +); + +Scenarios.Type_Property_Optional_Duration_getDefault = Type_Property_Optional_Duration_Default.get; +Scenarios.Type_Property_Optional_Duration_putDefault = Type_Property_Optional_Duration_Default.put; +Scenarios.Type_Property_Optional_Duration_getAll = Type_Property_Optional_Duration_All.get; +Scenarios.Type_Property_Optional_Duration_putAll = Type_Property_Optional_Duration_All.put; + +const Type_Property_Optional_PlainDate_Default = createServerTests( + `/type/property/optional/plainDate/default`, + {}, +); +const Type_Property_Optional_PlainDate_All = createServerTests( + `/type/property/optional/plainDate/all`, + { + property: "2022-12-12", + }, +); + +Scenarios.Type_Property_Optional_PlainDate_getDefault = + Type_Property_Optional_PlainDate_Default.get; +Scenarios.Type_Property_Optional_PlainDate_putDefault = + Type_Property_Optional_PlainDate_Default.put; +Scenarios.Type_Property_Optional_PlainDate_getAll = Type_Property_Optional_PlainDate_All.get; +Scenarios.Type_Property_Optional_PlainDate_putAll = Type_Property_Optional_PlainDate_All.put; + +const Type_Property_Optional_PlainTime_Default = createServerTests( + `/type/property/optional/plainTime/default`, + {}, +); +const Type_Property_Optional_PlainTime_All = createServerTests( + `/type/property/optional/plainTime/all`, + { + property: "13:06:12", + }, +); +Scenarios.Type_Property_Optional_PlainTime_getDefault = + Type_Property_Optional_PlainTime_Default.get; +Scenarios.Type_Property_Optional_PlainTime_putDefault = + Type_Property_Optional_PlainTime_Default.put; +Scenarios.Type_Property_Optional_PlainTime_getAll = Type_Property_Optional_PlainTime_All.get; +Scenarios.Type_Property_Optional_PlainTime_putAll = Type_Property_Optional_PlainTime_All.put; + +const Type_Property_Optional_Collections_Bytes_Default = createServerTests( + `/type/property/optional/collections/bytes/default`, + {}, +); +const Type_Property_Optional_Collections_Bytes_All = createServerTests( + `/type/property/optional/collections/bytes/all`, + { property: ["aGVsbG8sIHdvcmxkIQ==", "aGVsbG8sIHdvcmxkIQ=="] }, +); + +Scenarios.Type_Property_Optional_CollectionsByte_getDefault = + Type_Property_Optional_Collections_Bytes_Default.get; +Scenarios.Type_Property_Optional_CollectionsByte_putDefault = + Type_Property_Optional_Collections_Bytes_Default.put; +Scenarios.Type_Property_Optional_CollectionsByte_getAll = + Type_Property_Optional_Collections_Bytes_All.get; +Scenarios.Type_Property_Optional_CollectionsByte_putAll = + Type_Property_Optional_Collections_Bytes_All.put; + +const Type_Property_Optional_Collections_Model_Default = createServerTests( + `/type/property/optional/collections/model/default`, + {}, +); +const Type_Property_Optional_Collections_Model_All = createServerTests( + `/type/property/optional/collections/model/all`, + { property: [{ property: "hello" }, { property: "world" }] }, +); +Scenarios.Type_Property_Optional_CollectionsModel_getDefault = + Type_Property_Optional_Collections_Model_Default.get; +Scenarios.Type_Property_Optional_CollectionsModel_putDefault = + Type_Property_Optional_Collections_Model_Default.put; +Scenarios.Type_Property_Optional_CollectionsModel_getAll = + Type_Property_Optional_Collections_Model_All.get; +Scenarios.Type_Property_Optional_CollectionsModel_putAll = + Type_Property_Optional_Collections_Model_All.put; + +const Type_Property_Optional_String_Literal_Default = createServerTests( + `/type/property/optional/string/literal/default`, + {}, +); +const Type_Property_Optional_String_Literal_All = createServerTests( + `/type/property/optional/string/literal/all`, + { + property: "hello", + }, +); +Scenarios.Type_Property_Optional_StringLiteral_getDefault = + Type_Property_Optional_String_Literal_Default.get; +Scenarios.Type_Property_Optional_StringLiteral_putDefault = + Type_Property_Optional_String_Literal_Default.put; +Scenarios.Type_Property_Optional_StringLiteral_getAll = + Type_Property_Optional_String_Literal_All.get; +Scenarios.Type_Property_Optional_StringLiteral_putAll = + Type_Property_Optional_String_Literal_All.put; + +const Type_Property_Optional_Int_Literal_Default = createServerTests( + `/type/property/optional/int/literal/default`, + {}, +); +const Type_Property_Optional_Int_Literal_All = createServerTests( + `/type/property/optional/int/literal/all`, + { + property: 1, + }, +); +Scenarios.Type_Property_Optional_IntLiteral_getDefault = + Type_Property_Optional_Int_Literal_Default.get; +Scenarios.Type_Property_Optional_IntLiteral_putDefault = + Type_Property_Optional_Int_Literal_Default.put; +Scenarios.Type_Property_Optional_IntLiteral_getAll = Type_Property_Optional_Int_Literal_All.get; +Scenarios.Type_Property_Optional_IntLiteral_putAll = Type_Property_Optional_Int_Literal_All.put; + +const Type_Property_Optional_Float_Literal_Default = createServerTests( + `/type/property/optional/float/literal/default`, + {}, +); +const Type_Property_Optional_Float_Literal_All = createServerTests( + `/type/property/optional/float/literal/all`, + { + property: 1.25, + }, +); +Scenarios.Type_Property_Optional_FloatLiteral_getDefault = + Type_Property_Optional_Float_Literal_Default.get; +Scenarios.Type_Property_Optional_FloatLiteral_putDefault = + Type_Property_Optional_Float_Literal_Default.put; +Scenarios.Type_Property_Optional_FloatLiteral_getAll = Type_Property_Optional_Float_Literal_All.get; +Scenarios.Type_Property_Optional_FloatLiteral_putAll = Type_Property_Optional_Float_Literal_All.put; + +const Type_Property_Optional_Boolean_Literal_Default = createServerTests( + `/type/property/optional/boolean/literal/default`, + {}, +); +const Type_Property_Optional_Boolean_Literal_All = createServerTests( + `/type/property/optional/boolean/literal/all`, + { property: true }, +); +Scenarios.Type_Property_Optional_BooleanLiteral_getDefault = + Type_Property_Optional_Boolean_Literal_Default.get; +Scenarios.Type_Property_Optional_BooleanLiteral_putDefault = + Type_Property_Optional_Boolean_Literal_Default.put; +Scenarios.Type_Property_Optional_BooleanLiteral_getAll = + Type_Property_Optional_Boolean_Literal_All.get; +Scenarios.Type_Property_Optional_BooleanLiteral_putAll = + Type_Property_Optional_Boolean_Literal_All.put; + +const Type_Property_Optional_Union_String_Literal_Default = createServerTests( + `/type/property/optional/union/string/literal/default`, + {}, +); +const Type_Property_Optional_Union_String_Literal_All = createServerTests( + `/type/property/optional/union/string/literal/all`, + { property: "world" }, +); +Scenarios.Type_Property_Optional_UnionStringLiteral_getDefault = + Type_Property_Optional_Union_String_Literal_Default.get; +Scenarios.Type_Property_Optional_UnionStringLiteral_putDefault = + Type_Property_Optional_Union_String_Literal_Default.put; +Scenarios.Type_Property_Optional_UnionStringLiteral_getAll = + Type_Property_Optional_Union_String_Literal_All.get; +Scenarios.Type_Property_Optional_UnionStringLiteral_putAll = + Type_Property_Optional_Union_String_Literal_All.put; + +const Type_Property_Optional_Union_Int_Literal_Default = createServerTests( + `/type/property/optional/union/int/literal/default`, + {}, +); +const Type_Property_Optional_Union_Int_Literal_All = createServerTests( + `/type/property/optional/union/int/literal/all`, + { property: 2 }, +); +Scenarios.Type_Property_Optional_UnionIntLiteral_getDefault = + Type_Property_Optional_Union_Int_Literal_Default.get; +Scenarios.Type_Property_Optional_UnionIntLiteral_putDefault = + Type_Property_Optional_Union_Int_Literal_Default.put; +Scenarios.Type_Property_Optional_UnionIntLiteral_getAll = + Type_Property_Optional_Union_Int_Literal_All.get; +Scenarios.Type_Property_Optional_UnionIntLiteral_putAll = + Type_Property_Optional_Union_Int_Literal_All.put; + +const Type_Property_Optional_Union_Float_Literal_Default = createServerTests( + `/type/property/optional/union/float/literal/default`, + {}, +); +const Type_Property_Optional_Union_Float_Literal_All = createServerTests( + `/type/property/optional/union/float/literal/all`, + { property: 2.375 }, +); +Scenarios.Type_Property_Optional_UnionFloatLiteral_getDefault = + Type_Property_Optional_Union_Float_Literal_Default.get; +Scenarios.Type_Property_Optional_UnionFloatLiteral_putDefault = + Type_Property_Optional_Union_Float_Literal_Default.put; +Scenarios.Type_Property_Optional_UnionFloatLiteral_getAll = + Type_Property_Optional_Union_Float_Literal_All.get; +Scenarios.Type_Property_Optional_UnionFloatLiteral_putAll = + Type_Property_Optional_Union_Float_Literal_All.put; + +const Type_Property_Optional_Required_And_Optional_RequiredOnly = createServerTests( + `/type/property/optional/requiredAndOptional/requiredOnly`, + { requiredProperty: 42 }, +); +Scenarios.Type_Property_Optional_RequiredAndOptional_getRequiredOnly = + Type_Property_Optional_Required_And_Optional_RequiredOnly.get; +Scenarios.Type_Property_Optional_RequiredAndOptional_putRequiredOnly = + Type_Property_Optional_Required_And_Optional_RequiredOnly.put; + +const Type_Property_Optional_Required_And_Optional_All = createServerTests( + `/type/property/optional/requiredAndOptional/all`, + { + optionalProperty: "hello", + requiredProperty: 42, + }, +); +Scenarios.Type_Property_Optional_RequiredAndOptional_getAll = + Type_Property_Optional_Required_And_Optional_All.get; +Scenarios.Type_Property_Optional_RequiredAndOptional_putAll = + Type_Property_Optional_Required_And_Optional_All.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/main.tsp new file mode 100644 index 00000000000..3f661a4baac --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/main.tsp @@ -0,0 +1,244 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@doc("Illustrates various property types for models") +@scenarioService("/type/property/value-types") +namespace Type.Property.ValueTypes; + +// TEMPLATES +@doc("Template type for testing models with specific properties. Pass in the type of the property you are looking for") +model ModelTemplate { + @doc("Property") + property: TProperty; +} + +@doc("Template to have models operations") +interface ModelOperations { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc(""" + Expected response body: + ```json + {"property": ${TDoc}} + ``` + """) + @get + @doc("Get call") + get(): TModel; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc(""" + Expected input body: + ```json + {"property": ${TDoc}} + ``` + """) + @put + @doc("Put operation") + put(@body @doc("body") body: TModel): void; +} + +// Test a model with a boolean property +@doc("Model with a boolean property") +model BooleanProperty is ModelTemplate; +@route("/boolean") +interface Boolean extends ModelOperations {} + +// Test a model with a string property +@doc("Model with a string property") +model StringProperty is ModelTemplate; +@route("/string") +interface String extends ModelOperations {} + +// Test a model with a bytes property +@doc("Model with a bytes property") +model BytesProperty is ModelTemplate; +@route("/bytes") +interface Bytes extends ModelOperations {} + +// Test a model with an int property +@doc("Model with a int property") +model IntProperty is ModelTemplate; +@route("/int") +interface Int extends ModelOperations {} + +// Test a model with a float property +@doc("Model with a float property") +model FloatProperty is ModelTemplate; +@route("/float") +interface Float extends ModelOperations {} + +// Test a model with a decimal property +@doc("Model with a decimal property") +model DecimalProperty is ModelTemplate; +@route("/decimal") +interface Decimal extends ModelOperations {} + +// Test a model with a decimal128 property +@doc("Model with a decimal128 property") +model Decimal128Property is ModelTemplate; +@route("/decimal128") +interface Decimal128 extends ModelOperations {} + +// Test a model with a datetime property +@doc("Model with a datetime property") +model DatetimeProperty is ModelTemplate; +@route("/datetime") +interface Datetime extends ModelOperations {} + +// Test a model with a duration property +@doc("Model with a duration property") +model DurationProperty is ModelTemplate; +@route("/duration") +interface Duration extends ModelOperations {} + +// Test a model with an enum property +@doc("Enum that will be used as a property for model EnumProperty. Extensible.") +union InnerEnum { + string, + + @doc("First value.") + ValueOne: "ValueOne", + + @doc("Second value.") + ValueTwo: "ValueTwo", +} + +@doc("Enum that will be used as a property for model EnumProperty. Non-extensible.") +enum FixedInnerEnum { + @doc("First value.") + ValueOne, + + @doc("Second value.") + ValueTwo, +} + +@doc("Model with enum properties") +model EnumProperty is ModelTemplate; +@route("/enum") +interface Enum extends ModelOperations {} + +@doc("Model with extensible enum properties") +model ExtensibleEnumProperty is ModelTemplate; +@route("/extensible-enum") +interface ExtensibleEnum extends ModelOperations {} + +// Test a model with a model property +@doc("Inner model. Will be a property type for ModelWithModelProperties") +model InnerModel { + @doc("Required string property") + property: string; +} +@doc("Model with model properties") +model ModelProperty is ModelTemplate; +@route("/model") +interface Model extends ModelOperations {} + +// Test a model with a string collection property +@doc("Model with collection string properties") +model CollectionsStringProperty is ModelTemplate; +@route("/collections/string") +interface CollectionsString + extends ModelOperations {} + +// Test a model with an int collection property +@doc("Model with collection int properties") +model CollectionsIntProperty is ModelTemplate; +@route("/collections/int") +interface CollectionsInt extends ModelOperations {} + +// Test a model with a model collection property +@doc("Model with collection model properties") +model CollectionsModelProperty is ModelTemplate; +@route("/collections/model") +interface CollectionsModel + extends ModelOperations< + CollectionsModelProperty, + "[{'property': 'hello'}, {'property': 'world'}]" + > {} + +// Test a model with a string dictionary property +@doc("Model with dictionary string properties") +model DictionaryStringProperty is ModelTemplate>; +@route("/dictionary/string") +interface DictionaryString + extends ModelOperations {} + +// Test a model with a never property +@doc("Model with a property never. (This property should not be included).") +model NeverProperty is ModelTemplate; +@route("/never") +interface Never extends ModelOperations"> {} + +// Test a model with unknown and string +@doc("Model with a property unknown, and the data is a string.") +model UnknownStringProperty is ModelTemplate; +@route("/unknown/string") +interface UnknownString extends ModelOperations {} + +// Test a model with unknown and int +@doc("Model with a property unknown, and the data is a int32.") +model UnknownIntProperty is ModelTemplate; +@route("/unknown/int") +interface UnknownInt extends ModelOperations {} + +// Test a model with unknown and a dictionnary +@doc("Model with a property unknown, and the data is a dictionnary.") +model UnknownDictProperty is ModelTemplate; +@route("/unknown/dict") +interface UnknownDict extends ModelOperations {} + +// Test a model with unknown and an array +@doc("Model with a property unknown, and the data is an array.") +model UnknownArrayProperty is ModelTemplate; +@route("/unknown/array") +interface UnknownArray extends ModelOperations {} + +@doc("Model with a string literal property.") +model StringLiteralProperty is ModelTemplate<"hello">; +@route("/string/literal") +interface StringLiteral extends ModelOperations {} + +@doc("Model with a int literal property.") +model IntLiteralProperty is ModelTemplate<42>; +@route("/int/literal") +interface IntLiteral extends ModelOperations {} + +@doc("Model with a float literal property.") +model FloatLiteralProperty is ModelTemplate<43.125>; +@route("/float/literal") +interface FloatLiteral extends ModelOperations {} + +@doc("Model with a boolean literal property.") +model BooleanLiteralProperty is ModelTemplate; +@route("/boolean/literal") +interface BooleanLiteral extends ModelOperations {} + +@doc("Model with a union of string literal as property.") +model UnionStringLiteralProperty is ModelTemplate<"hello" | "world">; +@route("/union/string/literal") +interface UnionStringLiteral extends ModelOperations {} + +@doc("Model with a union of int literal as property.") +model UnionIntLiteralProperty is ModelTemplate<42 | 43>; +@route("/union/int/literal") +interface UnionIntLiteral extends ModelOperations {} + +@doc("Model with a union of float literal as property.") +model UnionFloatLiteralProperty is ModelTemplate<43.125 | 46.875>; +@route("/union/float/literal") +interface UnionFloatLiteral extends ModelOperations {} + +union ExtendedEnum { + string, + EnumValue2: "value2", +} + +model UnionEnumValueProperty is ModelTemplate; + +@route("/union-enum-value") +interface UnionEnumValue extends ModelOperations {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/mockapi.ts new file mode 100644 index 00000000000..4a635330592 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/mockapi.ts @@ -0,0 +1,306 @@ +import { json, MockRequest, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createServerTests(url: string, data: unknown) { + return { + get: passOnSuccess({ + uri: url, + method: `get`, + request: {}, + response: { + status: 200, + body: json(data), + }, + kind: "MockApiDefinition", + }), + put: passOnSuccess({ + uri: url, + method: `put`, + request: { + body: json(data), + }, + response: { + status: 204, + }, + handler: (req) => { + req.expect.coercedBodyEquals(data); + return { + status: 204, + }; + }, + kind: "MockApiDefinition", + }), + }; +} + +const Type_Property_ValueTypes_Boolean = createServerTests(`/type/property/value-types/boolean`, { + property: true, +}); +Scenarios.Type_Property_ValueTypes_Boolean_get = Type_Property_ValueTypes_Boolean.get; +Scenarios.Type_Property_ValueTypes_Boolean_put = Type_Property_ValueTypes_Boolean.put; + +const Type_Property_ValueTypes_String = createServerTests(`/type/property/value-types/string`, { + property: "hello", +}); +Scenarios.Type_Property_ValueTypes_String_get = Type_Property_ValueTypes_String.get; +Scenarios.Type_Property_ValueTypes_String_put = Type_Property_ValueTypes_String.put; + +const Type_Property_ValueTypes_Bytes = createServerTests(`/type/property/value-types/bytes`, { + property: "aGVsbG8sIHdvcmxkIQ==", +}); +Scenarios.Type_Property_ValueTypes_Bytes_get = Type_Property_ValueTypes_Bytes.get; +Scenarios.Type_Property_ValueTypes_Bytes_put = Type_Property_ValueTypes_Bytes.put; + +const Type_Property_ValueTypes_Int = createServerTests(`/type/property/value-types/int`, { + property: 42, +}); +Scenarios.Type_Property_ValueTypes_Int_get = Type_Property_ValueTypes_Int.get; +Scenarios.Type_Property_ValueTypes_Int_put = Type_Property_ValueTypes_Int.put; + +const Type_Property_ValueTypes_Float = createServerTests(`/type/property/value-types/float`, { + property: 43.125, +}); +Scenarios.Type_Property_ValueTypes_Float_get = Type_Property_ValueTypes_Float.get; +Scenarios.Type_Property_ValueTypes_Float_put = Type_Property_ValueTypes_Float.put; + +const Type_Property_ValueTypes_Decimal = createServerTests(`/type/property/value-types/decimal`, { + property: 0.33333, +}); +Scenarios.Type_Property_ValueTypes_Decimal_get = Type_Property_ValueTypes_Decimal.get; +Scenarios.Type_Property_ValueTypes_Decimal_put = Type_Property_ValueTypes_Decimal.put; + +const Type_Property_ValueTypes_Decimal128 = createServerTests( + `/type/property/value-types/decimal128`, + { + property: 0.33333, + }, +); +Scenarios.Type_Property_ValueTypes_Decimal128_get = Type_Property_ValueTypes_Decimal128.get; +Scenarios.Type_Property_ValueTypes_Decimal128_put = Type_Property_ValueTypes_Decimal128.put; + +const Type_Property_ValueTypes_DateTime = createServerTests(`/type/property/value-types/datetime`, { + property: "2022-08-26T18:38:00Z", +}); +Scenarios.Type_Property_ValueTypes_Datetime_get = Type_Property_ValueTypes_DateTime.get; +Scenarios.Type_Property_ValueTypes_Datetime_put = Type_Property_ValueTypes_DateTime.put; + +const Type_Property_ValueTypes_Duration = createServerTests(`/type/property/value-types/duration`, { + property: "P123DT22H14M12.011S", +}); +Scenarios.Type_Property_ValueTypes_Duration_get = Type_Property_ValueTypes_Duration.get; +Scenarios.Type_Property_ValueTypes_Duration_put = Type_Property_ValueTypes_Duration.put; + +const Type_Property_ValueTypes_Enum = createServerTests(`/type/property/value-types/enum`, { + property: "ValueOne", +}); +Scenarios.Type_Property_ValueTypes_Enum_get = Type_Property_ValueTypes_Enum.get; +Scenarios.Type_Property_ValueTypes_Enum_put = Type_Property_ValueTypes_Enum.put; + +const Type_Property_ValueTypes_Extensible_Enum = createServerTests( + `/type/property/value-types/extensible-enum`, + { + property: "UnknownValue", + }, +); +Scenarios.Type_Property_ValueTypes_ExtensibleEnum_get = + Type_Property_ValueTypes_Extensible_Enum.get; +Scenarios.Type_Property_ValueTypes_ExtensibleEnum_put = + Type_Property_ValueTypes_Extensible_Enum.put; + +const Type_Property_ValueTypes_Model = createServerTests(`/type/property/value-types/model`, { + property: { property: "hello" }, +}); +Scenarios.Type_Property_ValueTypes_Model_get = Type_Property_ValueTypes_Model.get; +Scenarios.Type_Property_ValueTypes_Model_put = Type_Property_ValueTypes_Model.put; + +const Type_Property_ValueTypes_Collections_String = createServerTests( + `/type/property/value-types/collections/string`, + { + property: ["hello", "world"], + }, +); +Scenarios.Type_Property_ValueTypes_CollectionsString_get = + Type_Property_ValueTypes_Collections_String.get; +Scenarios.Type_Property_ValueTypes_CollectionsString_put = + Type_Property_ValueTypes_Collections_String.put; + +const Type_Property_ValueTypes_Collections_Int = createServerTests( + `/type/property/value-types/collections/int`, + { + property: [1, 2], + }, +); +Scenarios.Type_Property_ValueTypes_CollectionsInt_get = + Type_Property_ValueTypes_Collections_Int.get; +Scenarios.Type_Property_ValueTypes_CollectionsInt_put = + Type_Property_ValueTypes_Collections_Int.put; + +const Type_Property_ValueTypes_Collections_Model = createServerTests( + `/type/property/value-types/collections/model`, + { + property: [{ property: "hello" }, { property: "world" }], + }, +); +Scenarios.Type_Property_ValueTypes_CollectionsModel_get = + Type_Property_ValueTypes_Collections_Model.get; +Scenarios.Type_Property_ValueTypes_CollectionsModel_put = + Type_Property_ValueTypes_Collections_Model.put; + +const Type_Property_ValueTypes_Dictionary_String = createServerTests( + `/type/property/value-types/dictionary/string`, + { + property: { k1: "hello", k2: "world" }, + }, +); +Scenarios.Type_Property_ValueTypes_DictionaryString_get = + Type_Property_ValueTypes_Dictionary_String.get; +Scenarios.Type_Property_ValueTypes_DictionaryString_put = + Type_Property_ValueTypes_Dictionary_String.put; + +const Type_Property_ValueTypes_Never = createServerTests(`/type/property/value-types/never`, { + property: undefined, +}); +Scenarios.Type_Property_ValueTypes_Never_get = Type_Property_ValueTypes_Never.get; +Scenarios.Type_Property_ValueTypes_Never_put = passOnSuccess({ + uri: `/type/property/value-types/never`, + method: `put`, + request: { + body: json({ + property: undefined, + }), + }, + response: { + status: 204, + }, + handler: (req: MockRequest) => { + const expectedBody = JSON.parse( + JSON.stringify({ + property: undefined, + }), + ); + req.expect.coercedBodyEquals(expectedBody); + return { + status: 204, + }; + }, + kind: "MockApiDefinition", +}); + +const Type_Property_ValueTypes_Unknown_String = createServerTests( + `/type/property/value-types/unknown/string`, + { + property: "hello", + }, +); +Scenarios.Type_Property_ValueTypes_UnknownString_get = Type_Property_ValueTypes_Unknown_String.get; +Scenarios.Type_Property_ValueTypes_UnknownString_put = Type_Property_ValueTypes_Unknown_String.put; + +const Type_Property_ValueTypes_Unknown_Int = createServerTests( + `/type/property/value-types/unknown/int`, + { + property: 42, + }, +); +Scenarios.Type_Property_ValueTypes_UnknownInt_get = Type_Property_ValueTypes_Unknown_Int.get; +Scenarios.Type_Property_ValueTypes_UnknownInt_put = Type_Property_ValueTypes_Unknown_Int.put; + +const Type_Property_ValueTypes_Unknown_Dict = createServerTests( + `/type/property/value-types/unknown/dict`, + { + property: { k1: "hello", k2: 42 }, + }, +); +Scenarios.Type_Property_ValueTypes_UnknownDict_get = Type_Property_ValueTypes_Unknown_Dict.get; +Scenarios.Type_Property_ValueTypes_UnknownDict_put = Type_Property_ValueTypes_Unknown_Dict.put; + +const Type_Property_ValueTypes_Unknown_Array = createServerTests( + `/type/property/value-types/unknown/array`, + { + property: ["hello", "world"], + }, +); +Scenarios.Type_Property_ValueTypes_UnknownArray_get = Type_Property_ValueTypes_Unknown_Array.get; +Scenarios.Type_Property_ValueTypes_UnknownArray_put = Type_Property_ValueTypes_Unknown_Array.put; + +const Type_Property_ValueTypes_String_Literal = createServerTests( + `/type/property/value-types/string/literal`, + { + property: "hello", + }, +); +Scenarios.Type_Property_ValueTypes_StringLiteral_get = Type_Property_ValueTypes_String_Literal.get; +Scenarios.Type_Property_ValueTypes_StringLiteral_put = Type_Property_ValueTypes_String_Literal.put; + +const Type_Property_ValueTypes_Int_Literal = createServerTests( + `/type/property/value-types/int/literal`, + { + property: 42, + }, +); +Scenarios.Type_Property_ValueTypes_IntLiteral_get = Type_Property_ValueTypes_Int_Literal.get; +Scenarios.Type_Property_ValueTypes_IntLiteral_put = Type_Property_ValueTypes_Int_Literal.put; + +const Type_Property_ValueTypes_Float_Literal = createServerTests( + `/type/property/value-types/float/literal`, + { + property: 43.125, + }, +); +Scenarios.Type_Property_ValueTypes_FloatLiteral_get = Type_Property_ValueTypes_Float_Literal.get; +Scenarios.Type_Property_ValueTypes_FloatLiteral_put = Type_Property_ValueTypes_Float_Literal.put; + +const Type_Property_ValueTypes_Boolean_Literal = createServerTests( + `/type/property/value-types/boolean/literal`, + { + property: true, + }, +); +Scenarios.Type_Property_ValueTypes_BooleanLiteral_get = + Type_Property_ValueTypes_Boolean_Literal.get; +Scenarios.Type_Property_ValueTypes_BooleanLiteral_put = + Type_Property_ValueTypes_Boolean_Literal.put; + +const Type_Property_ValueTypes_Union_String_Literal = createServerTests( + `/type/property/value-types/union/string/literal`, + { + property: "world", + }, +); +Scenarios.Type_Property_ValueTypes_UnionStringLiteral_get = + Type_Property_ValueTypes_Union_String_Literal.get; +Scenarios.Type_Property_ValueTypes_UnionStringLiteral_put = + Type_Property_ValueTypes_Union_String_Literal.put; + +const Type_Property_ValueTypes_Union_Int_Literal = createServerTests( + `/type/property/value-types/union/int/literal`, + { + property: 42, + }, +); +Scenarios.Type_Property_ValueTypes_UnionIntLiteral_get = + Type_Property_ValueTypes_Union_Int_Literal.get; +Scenarios.Type_Property_ValueTypes_UnionIntLiteral_put = + Type_Property_ValueTypes_Union_Int_Literal.put; + +const Type_Property_ValueTypes_Union_Float_Literal = createServerTests( + `/type/property/value-types/union/float/literal`, + { + property: 46.875, + }, +); +Scenarios.Type_Property_ValueTypes_UnionFloatLiteral_get = + Type_Property_ValueTypes_Union_Float_Literal.get; +Scenarios.Type_Property_ValueTypes_UnionFloatLiteral_put = + Type_Property_ValueTypes_Union_Float_Literal.put; + +const Type_Property_ValueTypes_Union_Enum_Value = createServerTests( + `/type/property/value-types/union-enum-value`, + { + property: "value2", + }, +); +Scenarios.Type_Property_ValueTypes_UnionEnumValue_get = + Type_Property_ValueTypes_Union_Enum_Value.get; +Scenarios.Type_Property_ValueTypes_UnionEnumValue_put = + Type_Property_ValueTypes_Union_Enum_Value.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/main.tsp new file mode 100644 index 00000000000..3eeddd4705e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/main.tsp @@ -0,0 +1,185 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +@scenarioService("/type/scalar") +namespace Type.Scalar; + +@route("/string") +interface String { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to handle a string value. Mock api will return 'test'") + @get + @doc("get string value") + get(): { + @header + contentType: "application/json"; + + @body + body: string; + }; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to send a string value. Mock api expect to receive 'test'") + @put + @doc("put string value") + put( + @header + contentType: "application/json", + + @body @doc("_") body: string, + ): void; +} + +@route("/boolean") +interface Boolean { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to handle a boolean value. Mock api will return true ") + @get + @doc("get boolean value") + get(): { + @header + contentType: "application/json"; + + @body + body: boolean; + }; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to send a boolean value. Mock api expect to receive 'true'") + @put + @doc("put boolean value") + put( + @header + contentType: "application/json", + + @body @doc("_") body: boolean, + ): void; +} + +@route("/unknown") +interface Unknown { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to handle a unknown type value. Mock api will return 'test'") + @get + @doc("get unknown value") + get(): { + @header + contentType: "application/json"; + + @body + body: unknown; + }; + + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" + @scenario + @scenarioDoc("Expect to send a string value. Mock api expect to receive 'test'") + @put + @doc("put unknown value") + put( + @header + contentType: "application/json", + + @body @doc("_") body: unknown, + ): void; +} + +@doc("Template to have scalar types operations") +interface ScalarTypesOperations { + @scenario + @scenarioDoc(""" + Expected response body: + ```json + ${TDoc} + ``` + """) + @get + @route("/response_body") + responseBody(): { + @header + contentType: "application/json"; + + @body + body: T; + }; + + @scenario + @scenarioDoc(""" + Expected input body: + ```json + ${TDoc} + ``` + """) + @put + @route("/resquest_body") + requestBody( + @header + contentType: "application/json", + + @body body: T, + ): void; + + @scenario + @scenarioDoc(""" + Expected request parameter: + value=${TDoc} + """) + @get + @route("/request_parameter") + requestParameter(@query value: T): void; +} + +@doc("Decimal type") +@route("/decimal") +interface DecimalType extends ScalarTypesOperations {} + +@doc("Decimal128 type") +@route("/decimal128") +interface Decimal128Type extends ScalarTypesOperations {} + +@doc("Template to verify number types") +interface NumberTypesVerifyOperations< + T, + VerifyValues extends valueof string, + ResultValue extends valueof string +> { + @scenario + @scenarioDoc(""" + Get verify values: + ${VerifyValues} + """) + @get + @route("/prepare_verify") + prepareVerify(): T[]; + + @scenario + @scenarioDoc(""" + Expected input body: + ```json + ${ResultValue} + ``` + """) + @post + @route("/verify") + verify( + @header + contentType: "application/json", + + @body body: T, + ): void; +} + +@doc("Decimal type verification") +@route("/decimal") +interface DecimalVerify extends NumberTypesVerifyOperations {} + +@doc("Decimal128 type verification") +@route("/decimal128") +interface Decimal128Verify extends NumberTypesVerifyOperations {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/mockapi.ts new file mode 100644 index 00000000000..ec69226ac07 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/mockapi.ts @@ -0,0 +1,199 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Type_Scalar_String_get = passOnSuccess({ + uri: "/type/scalar/string", + method: `get`, + request: {}, + response: { + status: 200, + body: json("test"), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Scalar_String_put = passOnSuccess({ + uri: "/type/scalar/string", + method: `put`, + request: { + body: json("test"), + headers: { + "Content-Type": "text/plain", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Scalar_Boolean_get = passOnSuccess({ + uri: "/type/scalar/boolean", + method: `get`, + request: {}, + response: { + status: 200, + body: json(true), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Scalar_Boolean_put = passOnSuccess({ + uri: "/type/scalar/boolean", + method: `put`, + request: { + body: json(true), + headers: { + "Content-Type": "application/json; charset=utf-8", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Scalar_Unknown_get = passOnSuccess({ + uri: "/type/scalar/unknown", + method: `get`, + request: {}, + response: { + status: 200, + body: json("test"), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Scalar_Unknown_put = passOnSuccess({ + uri: "/type/scalar/unknown", + method: `put`, + request: { + body: json("test"), + headers: { + "Content-Type": "text/plain", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Scalar_DecimalType_responseBody = passOnSuccess({ + uri: "/type/scalar/decimal/response_body", + method: `get`, + request: {}, + response: { + status: 200, + body: json(0.33333), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Scalar_Decimal128Type_responseBody = passOnSuccess({ + uri: "/type/scalar/decimal128/response_body", + method: `get`, + request: {}, + response: { + status: 200, + body: json(0.33333), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Scalar_DecimalType_requestBody = passOnSuccess({ + uri: "/type/scalar/decimal/resquest_body", + method: `put`, + request: { + body: json(0.33333), + headers: { + "Content-Type": "application/json; charset=utf-8", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Scalar_Decimal128Type_requestBody = passOnSuccess({ + uri: "/type/scalar/decimal128/resquest_body", + method: `put`, + request: { + body: json(0.33333), + headers: { + "Content-Type": "application/json; charset=utf-8", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Scalar_DecimalType_requestParameter = passOnSuccess({ + uri: "/type/scalar/decimal/request_parameter", + method: `get`, + request: { + query: { value: "0.33333" }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Scalar_Decimal128Type_requestParameter = passOnSuccess({ + uri: "/type/scalar/decimal128/request_parameter", + method: `get`, + request: { + query: { value: "0.33333" }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Scalar_DecimalVerify_prepareVerify = passOnSuccess({ + uri: "/type/scalar/decimal/prepare_verify", + method: `get`, + request: {}, + response: { + status: 200, + body: json([0.1, 0.1, 0.1]), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Scalar_Decimal128Verify_prepareVerify = passOnSuccess({ + uri: "/type/scalar/decimal128/prepare_verify", + method: `get`, + request: {}, + response: { + status: 200, + body: json([0.1, 0.1, 0.1]), + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Scalar_DecimalVerify_verify = passOnSuccess({ + uri: "/type/scalar/decimal/verify", + method: `post`, + request: { + body: json(0.3), + headers: { + "Content-Type": "application/json; charset=utf-8", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); +Scenarios.Type_Scalar_Decimal128Verify_verify = passOnSuccess({ + uri: "/type/scalar/decimal128/verify", + method: `post`, + request: { + body: json(0.3), + headers: { + "Content-Type": "application/json; charset=utf-8", + }, + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/main.tsp new file mode 100644 index 00000000000..c6f2dc04931 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/main.tsp @@ -0,0 +1,251 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +/** + * Describe scenarios for discriminated unions. + */ +@scenarioService("/type/union/discriminated") +namespace Type.Union.Discriminated; + +// Models for discriminated unions +model Cat { + name: string; + meow: boolean; +} + +model Dog { + name: string; + bark: boolean; +} + +/** + * Test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property. + */ +@discriminated +union PetWithEnvelope { + cat: Cat, + dog: Dog, +} + +@route("/envelope") +namespace Envelope { + @route("/object") + namespace Object { + @route("/default") + interface Default { + @scenario + @scenarioDoc(""" + Test discriminated union with envelope serialization. + When value of query parameter "kind" is "cat" or no query parameter input, the expected response is: + ```json + { + "kind": "cat", + "value": { + "name": "Whiskers", + "meow": true + } + } + ``` + When it is "dog", expected response is: + ```json + { + "kind": "dog", + "value": { + "name": "Rex", + "bark": false + } + } + ``` + """) + @get + get(@query kind?: string): PetWithEnvelope; + + @scenario + @scenarioDoc(""" + Test discriminated union with envelope serialization. + Send the union as: + ```json + { + "kind": "cat", + "value": { + "name": "Whiskers", + "meow": true + } + } + ``` + """) + @put + put(@body input: PetWithEnvelope): PetWithEnvelope; + } + + @route("/custom-properties") + interface CustomProperties { + @scenario + @scenarioDoc(""" + Test discriminated union with custom property names. + When value of query parameter "petType" is "cat" or no query parameter input, the expected response is: + ```json + { + "petType": "cat", + "petData": { + "name": "Whiskers", + "meow": true + } + } + ``` + When it is "dog", expected response is: + ```json + { + "petType": "dog", + "petData": { + "name": "Rex", + "bark": false + } + } + ``` + """) + @get + get(@query petType?: string): PetWithCustomNames; + + @scenario + @scenarioDoc(""" + Test discriminated union with custom property names. + Send the union as: + ```json + { + "petType": "cat", + "petData": { + "name": "Whiskers", + "meow": true + } + } + ``` + """) + @put + put(@body input: PetWithCustomNames): PetWithCustomNames; + } + } +} + +/** + * Test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names. + */ +@discriminated(#{ discriminatorPropertyName: "petType", envelopePropertyName: "petData" }) +union PetWithCustomNames { + cat: Cat, + dog: Dog, +} + +/** + * Test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object. + */ +@discriminated(#{ envelope: "none" }) +union PetInline { + cat: Cat, + dog: Dog, +} + +/** + * Test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object. + */ +@discriminated(#{ envelope: "none", discriminatorPropertyName: "type" }) +union PetInlineWithCustomDiscriminator { + cat: Cat, + dog: Dog, +} + +@route("/no-envelope") +namespace NoEnvelope { + @route("/default") + interface Default { + @scenario + @scenarioDoc(""" + Test discriminated union with inline discriminator. + When value of query parameter "kind" is "cat" or no query parameter input, the expected response is: + ```json + { + "kind": "cat", + "name": "Whiskers", + "meow": true + } + ``` + When it is "dog", expected response is: + ```json + { + "kind": "dog", + "name": "Rex", + "bark": false + } + ``` + """) + @get + get(@query kind?: string): PetInline; + + @scenario + @scenarioDoc(""" + Test discriminated union with inline discriminator. + Send the union as: + ```json + { + "kind": "cat", + "name": "Whiskers", + "meow": true + } + ``` + """) + @put + put(@body input: PetInline): PetInline; + } + + @route("/custom-discriminator") + interface CustomDiscriminator { + @scenario + @scenarioDoc(""" + Test discriminated union with inline discriminator and custom discriminator property name. + When value of query parameter "type" is "cat" or no query parameter input, the expected response is: + ```json + { + "type": "cat", + "name": "Whiskers", + "meow": true + } + ``` + When it is "dog", expected response is: + ```json + { + "type": "dog", + "name": "Rex", + "bark": false + } + ``` + """) + @get + get(@query type?: string): PetInlineWithCustomDiscriminator; + + @scenario + @scenarioDoc(""" + Test discriminated union with inline discriminator and custom discriminator property name. + Send the union as: + ```json + { + "type": "cat", + "name": "Whiskers", + "meow": true + } + ``` + """) + @put + put(@body input: PetInlineWithCustomDiscriminator): PetInlineWithCustomDiscriminator; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/mockapi.ts new file mode 100644 index 00000000000..5502cf3f279 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/mockapi.ts @@ -0,0 +1,230 @@ +import { json, MockRequest, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +// Test data for discriminated union scenarios +const catData = { + name: "Whiskers", + meow: true, +}; + +const dogData = { + name: "Rex", + bark: false, +}; + +// Envelope discriminated union (default serialization) +const envelopeCatBody = { + kind: "cat", + value: catData, +}; + +const envelopeDogBody = { + kind: "dog", + value: dogData, +}; + +Scenarios.Type_Union_Discriminated_Envelope_Object_Default_get = passOnSuccess({ + uri: "/type/union/discriminated/envelope/object/default", + method: "get", + request: {}, + response: { + status: 200, + body: json(envelopeCatBody), + }, + handler: (req: MockRequest) => { + const kind = req.query.kind as string | undefined; + + // When kind is null or "cat", return response for "cat" + // When kind is "dog", return response for "dog" + if (kind === "dog") { + return { + status: 200, + body: json(envelopeDogBody), + }; + } else { + // Default case: when kind is null, undefined, or "cat" + return { + status: 200, + body: json(envelopeCatBody), + }; + } + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Union_Discriminated_Envelope_Object_Default_put = passOnSuccess({ + uri: "/type/union/discriminated/envelope/object/default", + method: "put", + request: { + body: json(envelopeCatBody), + }, + response: { + status: 200, + body: json(envelopeCatBody), + }, + kind: "MockApiDefinition", +}); + +// Custom names discriminated union +const customNamesCatBody = { + petType: "cat", + petData: catData, +}; + +const customNamesDogBody = { + petType: "dog", + petData: dogData, +}; + +Scenarios.Type_Union_Discriminated_Envelope_Object_CustomProperties_get = passOnSuccess({ + uri: "/type/union/discriminated/envelope/object/custom-properties", + method: "get", + request: {}, + response: { + status: 200, + body: json(customNamesCatBody), + }, + handler: (req: MockRequest) => { + const petType = req.query.petType as string | undefined; + + // When petType is null or "cat", return response for "cat" + // When petType is "dog", return response for "dog" + if (petType === "dog") { + return { + status: 200, + body: json(customNamesDogBody), + }; + } else { + // Default case: when petType is null, undefined, or "cat" + return { + status: 200, + body: json(customNamesCatBody), + }; + } + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Union_Discriminated_Envelope_Object_CustomProperties_put = passOnSuccess({ + uri: "/type/union/discriminated/envelope/object/custom-properties", + method: "put", + request: { + body: json(customNamesCatBody), + }, + response: { + status: 200, + body: json(customNamesCatBody), + }, + kind: "MockApiDefinition", +}); + +// Inline discriminated union (no envelope) +const inlineCatBody = { + kind: "cat", + name: "Whiskers", + meow: true, +}; + +const inlineDogBody = { + kind: "dog", + name: "Rex", + bark: false, +}; + +Scenarios.Type_Union_Discriminated_NoEnvelope_Default_get = passOnSuccess({ + uri: "/type/union/discriminated/no-envelope/default", + method: "get", + request: {}, + response: { + status: 200, + body: json(inlineCatBody), + }, + handler: (req: MockRequest) => { + const kind = req.query.kind as string | undefined; + + // When kind is null or "cat", return response for "cat" + // When kind is "dog", return response for "dog" + if (kind === "dog") { + return { + status: 200, + body: json(inlineDogBody), + }; + } else { + // Default case: when kind is null, undefined, or "cat" + return { + status: 200, + body: json(inlineCatBody), + }; + } + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Union_Discriminated_NoEnvelope_Default_put = passOnSuccess({ + uri: "/type/union/discriminated/no-envelope/default", + method: "put", + request: { + body: json(inlineCatBody), + }, + response: { + status: 200, + body: json(inlineCatBody), + }, + kind: "MockApiDefinition", +}); + +// Inline discriminated union with custom discriminator property name +const inlineCustomCatBody = { + type: "cat", + name: "Whiskers", + meow: true, +}; + +const inlineCustomDogBody = { + type: "dog", + name: "Rex", + bark: false, +}; + +Scenarios.Type_Union_Discriminated_NoEnvelope_CustomDiscriminator_get = passOnSuccess({ + uri: "/type/union/discriminated/no-envelope/custom-discriminator", + method: "get", + request: {}, + response: { + status: 200, + body: json(inlineCustomCatBody), + }, + handler: (req: MockRequest) => { + const type = req.query.type as string | undefined; + + // When type is null or "cat", return response for "cat" + // When type is "dog", return response for "dog" + if (type === "dog") { + return { + status: 200, + body: json(inlineCustomDogBody), + }; + } else { + // Default case: when type is null, undefined, or "cat" + return { + status: 200, + body: json(inlineCustomCatBody), + }; + } + }, + kind: "MockApiDefinition", +}); + +Scenarios.Type_Union_Discriminated_NoEnvelope_CustomDiscriminator_put = passOnSuccess({ + uri: "/type/union/discriminated/no-envelope/custom-discriminator", + method: "put", + request: { + body: json(inlineCustomCatBody), + }, + response: { + status: 200, + body: json(inlineCustomCatBody), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/union/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/union/main.tsp new file mode 100644 index 00000000000..7df2d3387a0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/union/main.tsp @@ -0,0 +1,249 @@ +import "@typespec/http"; +import "@typespec/spector"; + +using Http; +using Spector; + +/** + * Describe scenarios for various combinations of unions. + */ +@scenarioService("/type/union") +namespace Type.Union; + +model Cat { + name: string; +} + +model Dog { + bark: string; +} + +enum LR { + left, + right, +} +enum UD { + up, + down, +} + +/** + * Describe union of string "a" | "b" | "c" + */ +@route("/strings-only") +interface StringsOnly extends GetAndSend<"a" | "b" | "c", "\"b\""> {} + +/** + * Describe union of string string | "b" | "c" + */ +@route("/string-extensible") +interface StringExtensible extends GetAndSend {} + +union StringExtensibleNamedUnion { + string, + OptionB: "b", + "c", +} +/** + * Describe union of string string | "b" | "c" but where the union is named and some of the variants are named + */ +@route("/string-extensible-named") +interface StringExtensibleNamed extends GetAndSend {} + +/** + * Describe union of integer 1 | 2 | 3 + */ +@route("/ints-only") +interface IntsOnly extends GetAndSend<1 | 2 | 3, "2"> {} + +/** + * Describe union of floats 1.1 | 2.2 | 3.3 + */ +@route("/floats-only") +interface FloatsOnly extends GetAndSend<1.1 | 2.2 | 3.3, "2.2"> {} + +/** + * Describe union of models + */ +@route("/models-only") +interface ModelsOnly + extends GetAndSend< + Cat | Dog, + """ + { + "name": "test" + } + """ + > {} + +model EnumsOnlyCases { + /** This should be receive/send the left variant */ + lr: LR | UD; + + /** This should be receive/send the up variant */ + ud: UD | UD; +} + +/** + * Describe union of 2 different enums + */ +@route("/enums-only") +interface EnumsOnly + extends GetAndSend< + LR | UD, + """ + { + "lr": "right", + "ud": "up" + } + """, + EnumsOnlyCases + > {} + +model StringAndArrayCases { + /** This should be receive/send the string variant */ + string: string | string[]; + + /** This should be receive/send the array variant */ + array: string | string[]; +} + +/** + * Describe union of a string and an array of strings + */ +@route("/string-and-array") +interface StringAndArray + extends GetAndSend< + string | string[], + """ + { + "string": "test", + "array": ["test1", "test2"] + } + """, + StringAndArrayCases + > {} + +alias MixedLiteralsUnion = "a" | 2 | 3.3 | true; +model MixedLiteralsCases { + /** This should be receive/send the "a" variant */ + stringLiteral: MixedLiteralsUnion; + + /** This should be receive/send the 2 variant */ + intLiteral: MixedLiteralsUnion; + + /** This should be receive/send the 3.3 variant */ + floatLiteral: MixedLiteralsUnion; + + /** This should be receive/send the true variant */ + booleanLiteral: MixedLiteralsUnion; +} + +/** + * Describe union of floats "a" | 2 | 3.3 + */ +@route("/mixed-literals") +interface MixedLiterals + extends GetAndSend< + MixedLiteralsUnion, + """ + { + "stringLiteral": "a", + "intLiteral": 2, + "floatLiteral": 3.3, + "booleanLiteral": true + } + """, + MixedLiteralsCases + > {} + +alias MixedTypesUnion = Cat | "a" | int32 | boolean; +model MixedTypesCases { + /** This should be receive/send the Cat variant */ + `model`: MixedTypesUnion; + + /** This should be receive/send the "a" variant */ + literal: MixedTypesUnion; + + /** This should be receive/send the int variant */ + int: MixedTypesUnion; + + /** This should be receive/send the boolean variant */ + boolean: MixedTypesUnion; + + /** This should be receive/send 4 element with Cat, "a", int, and boolean */ + array: MixedTypesUnion[]; +} + +/** + * Describe union of floats "a" | 2 | 3.3 + */ +@route("/mixed-types") +interface MixedTypes + extends GetAndSend< + MixedTypesUnion, + """ + { + "model": { + "name": "test" + }, + "literal": "a", + "int": 2, + "boolean": true, + "array": [ + { + "name": "test" + }, + "a", + 2, + true + ] + } + """, + MixedTypesCases + > {} + +/** + * Helper interface to describe a test involving getting and sending a specific data + */ +interface GetAndSend { + @scenario + @scenarioDoc( + """ + Verify a union can be processed in a response: + ```tsp + {type} + ``` + + Expected response body: + ```json + { "prop": ${Payload}} + ``` + """, + { + type: Union, + } + ) + get(): { + prop: Cases; + }; + + @scenario + @scenarioDoc( + """ + Verify a union can be processed in a response: + ```tsp + {type} + ``` + + Expected request to send body: + ```json + { "prop": ${Payload}} + ``` + """, + { + type: Union, + } + ) + send(prop: Cases): void; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/union/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/union/mockapi.ts new file mode 100644 index 00000000000..26c42638c58 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/type/union/mockapi.ts @@ -0,0 +1,130 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +function createGetServerTests(url: string, value: unknown) { + return passOnSuccess({ + uri: url, + method: `get`, + request: {}, + response: { + status: 200, + body: json({ prop: value }), + }, + kind: "MockApiDefinition", + }); +} + +function createPostServerTests(url: string, value: unknown) { + return passOnSuccess({ + uri: url, + method: `post`, + request: { + body: json({ + prop: value, + }), + }, + response: { + status: 204, + }, + kind: "MockApiDefinition", + }); +} + +Scenarios.Type_Union_StringsOnly_get = createGetServerTests(`/type/union/strings-only`, "b"); +Scenarios.Type_Union_StringsOnly_send = createPostServerTests(`/type/union/strings-only`, "b"); + +Scenarios.Type_Union_StringExtensible_get = createGetServerTests( + `/type/union/string-extensible`, + "custom", +); +Scenarios.Type_Union_StringExtensible_send = createPostServerTests( + `/type/union/string-extensible`, + "custom", +); + +Scenarios.Type_Union_StringExtensibleNamed_get = createGetServerTests( + `/type/union/string-extensible-named`, + "custom", +); +Scenarios.Type_Union_StringExtensibleNamed_send = createPostServerTests( + `/type/union/string-extensible-named`, + "custom", +); + +Scenarios.Type_Union_IntsOnly_get = createGetServerTests(`/type/union/ints-only`, 2); +Scenarios.Type_Union_IntsOnly_send = createPostServerTests(`/type/union/ints-only`, 2); + +Scenarios.Type_Union_FloatsOnly_get = createGetServerTests(`/type/union/floats-only`, 2.2); +Scenarios.Type_Union_FloatsOnly_send = createPostServerTests(`/type/union/floats-only`, 2.2); + +Scenarios.Type_Union_ModelsOnly_get = createGetServerTests(`/type/union/models-only`, { + name: "test", +}); +Scenarios.Type_Union_ModelsOnly_send = createPostServerTests(`/type/union/models-only`, { + name: "test", +}); + +Scenarios.Type_Union_EnumsOnly_get = createGetServerTests(`/type/union/enums-only`, { + lr: "right", + ud: "up", +}); +Scenarios.Type_Union_EnumsOnly_send = createPostServerTests(`/type/union/enums-only`, { + lr: "right", + ud: "up", +}); + +Scenarios.Type_Union_StringAndArray_get = createGetServerTests(`/type/union/string-and-array`, { + string: "test", + array: ["test1", "test2"], +}); +Scenarios.Type_Union_StringAndArray_send = createPostServerTests(`/type/union/string-and-array`, { + string: "test", + array: ["test1", "test2"], +}); + +Scenarios.Type_Union_MixedLiterals_get = createGetServerTests(`/type/union/mixed-literals`, { + stringLiteral: "a", + intLiteral: 2, + floatLiteral: 3.3, + booleanLiteral: true, +}); +Scenarios.Type_Union_MixedLiterals_send = createPostServerTests(`/type/union/mixed-literals`, { + stringLiteral: "a", + intLiteral: 2, + floatLiteral: 3.3, + booleanLiteral: true, +}); + +Scenarios.Type_Union_MixedTypes_get = createGetServerTests(`/type/union/mixed-types`, { + model: { + name: "test", + }, + literal: "a", + int: 2, + boolean: true, + array: [ + { + name: "test", + }, + "a", + 2, + true, + ], +}); +Scenarios.Type_Union_MixedTypes_send = createPostServerTests(`/type/union/mixed-types`, { + model: { + name: "test", + }, + literal: "a", + int: 2, + boolean: true, + array: [ + { + name: "test", + }, + "a", + 2, + true, + ], +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/main.tsp new file mode 100644 index 00000000000..a81594a47a0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/main.tsp @@ -0,0 +1,136 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@typespec/versioning"; + +using Http; +using Spector; +using TypeSpec.Versioning; + +/** + * Test for the `@added` decorator. + */ +@service +@versioned(Versions) +@server( + "{endpoint}/versioning/added/api-version:{version}", + "Testserver endpoint", + { + /** + * Need to be set as 'http://localhost:3000' in client. + */ + endpoint: url, + + /** + * Need to be set as 'v1' or 'v2' in client. + */ + version: Versions, + } +) +namespace Versioning.Added; + +/** + * The version of the API. + */ +enum Versions { + /** + * The version v1. + */ + v1: "v1", + + /** + * The version v2. + */ + v2: "v2", +} + +model ModelV1 { + prop: string; + enumProp: EnumV1; + + @added(Versions.v2) + unionProp: UnionV1; +} + +enum EnumV1 { + enumMemberV1, + + @added(Versions.v2) + enumMemberV2, +} + +@added(Versions.v2) +model ModelV2 { + prop: string; + enumProp: EnumV2; + unionProp: UnionV2; +} + +@added(Versions.v2) +enum EnumV2 { + enumMember, +} + +union UnionV1 { + string, + + @added(Versions.v2) + V2Scalar, +} + +@added(Versions.v2) +union UnionV2 { + string, + int32, +} + +@added(Versions.v2) +scalar V2Scalar extends int32; + +@scenario +@scenarioDoc(""" + This operation should be generated with latest version's signature. + + Expected request body: + ```json + { "prop": "foo", "enumProp": "enumMemberV2", "unionProp": 10 } + ``` + + Expected header: + header-v2=bar + + """) +@route("/v1") +@post +op v1(@body body: ModelV1, @added(Versions.v2) @header headerV2: string): ModelV1; + +@scenario +@scenarioDoc(""" + This operation should only be generated with latest version. + + Expected request body: + ```json + { "prop": "foo", "enumProp": "enumMember", "unionProp": "bar" } + ``` + """) +@route("/v2") +@added(Versions.v2) +@post +op v2(@body body: ModelV2): ModelV2; + +@added(Versions.v2) +@scenario +@scenarioDoc(""" + This operation group should only be generated with latest version. + + Expected request body for v2InInterface: + ```json + { "prop": "foo", "enumProp": "enumMember", "unionProp": "bar" } + ``` + + """) +@route("/interface-v2") +interface InterfaceV2 { + @post + @route("/v2") + v2InInterface(@body body: ModelV2): ModelV2; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/mockapi.ts new file mode 100644 index 00000000000..3b6ef53b584 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/mockapi.ts @@ -0,0 +1,57 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Versioning_Added_v1 = passOnSuccess({ + uri: `/versioning/added/api-version:v2/v1`, + method: `post`, + request: { + body: json({ + prop: "foo", + enumProp: "enumMemberV2", + unionProp: 10, + }), + headers: { + "header-v2": "bar", + }, + }, + response: { + status: 200, + body: json({ prop: "foo", enumProp: "enumMemberV2", unionProp: 10 }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Versioning_Added_v2 = passOnSuccess({ + uri: `/versioning/added/api-version:v2/v2`, + method: `post`, + request: { + body: json({ + prop: "foo", + enumProp: "enumMember", + unionProp: "bar", + }), + }, + response: { + status: 200, + body: json({ prop: "foo", enumProp: "enumMember", unionProp: "bar" }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Versioning_Added_InterfaceV2 = passOnSuccess({ + uri: `/versioning/added/api-version:v2/interface-v2/v2`, + method: `post`, + request: { + body: json({ + prop: "foo", + enumProp: "enumMember", + unionProp: "bar", + }), + }, + response: { + status: 200, + body: json({ prop: "foo", enumProp: "enumMember", unionProp: "bar" }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/main.tsp new file mode 100644 index 00000000000..df1d25c018a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/main.tsp @@ -0,0 +1,65 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@typespec/versioning"; + +using Http; +using Spector; +using TypeSpec.Versioning; + +/** + * Test for the `@madeOptional` decorator. + */ +@service +@versioned(Versions) +@server( + "{endpoint}/versioning/made-optional/api-version:{version}", + "Testserver endpoint", + { + /** + * Need to be set as 'http://localhost:3000' in client. + */ + endpoint: url, + + /** + * Need to be set as 'v1' or 'v2' in client. + */ + version: Versions, + } +) +namespace Versioning.MadeOptional; + +/** + * The version of the API. + */ +enum Versions { + /** + * The version v1. + */ + v1: "v1", + + /** + * The version v2. + */ + v2: "v2", +} + +model TestModel { + prop: string; + + @madeOptional(Versions.v2) + changedProp?: string; +} + +@scenario +@scenarioDoc(""" + This operation should be generated with latest version's signature. + + Expected request body: + ```json + { "prop": "foo" } + ``` + + """) +@route("/test") +@post +op test(@body body: TestModel, @madeOptional(Versions.v2) @query param?: string): TestModel; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/mockapi.ts new file mode 100644 index 00000000000..b28d3b80704 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/mockapi.ts @@ -0,0 +1,18 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Versioning_MadeOptional_test = passOnSuccess({ + uri: `/versioning/made-optional/api-version:v2/test`, + method: `post`, + request: { + body: json({ + prop: "foo", + }), + }, + response: { + status: 200, + body: json({ prop: "foo" }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/main.tsp new file mode 100644 index 00000000000..769230a6c53 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/main.tsp @@ -0,0 +1,188 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@typespec/versioning"; + +using Http; +using Spector; +using TypeSpec.Versioning; + +/** + * Test for the `@removed` decorator. + */ +@service +@versioned(Versions) +@server( + "{endpoint}/versioning/removed/api-version:{version}", + "Testserver endpoint", + { + /** + * Need to be set as 'http://localhost:3000' in client. + */ + endpoint: url, + + /** + * Need to be set as 'v1', 'v2preview' or 'v2' in client. + */ + version: Versions, + } +) +namespace Versioning.Removed; + +/** + * The version of the API. + */ +enum Versions { + /** + * The version v1. + */ + v1: "v1", + + /** + * The V2 Preview version. + */ + v2preview: "v2preview", + + /** + * The version v2. + */ + v2: "v2", +} + +@removed(Versions.v2) +model ModelV1 { + prop: string; + enumProp: EnumV1; + unionProp: UnionV1; +} + +@removed(Versions.v2) +enum EnumV1 { + enumMember, +} + +model ModelV2 { + prop: string; + + @removed(Versions.v2) + removedProp: string; + + enumProp: EnumV2; + + @added(Versions.v1) + unionProp: UnionV2; +} + +model ModelV3 { + id: string; + + @removed(Versions.v2preview) + @added(Versions.v2) + enumProp: EnumV3; +} + +enum EnumV2 { + @removed(Versions.v2) + enumMemberV1, + + enumMemberV2, +} + +enum EnumV3 { + @removed(Versions.v2preview) + @added(Versions.v2) + enumMemberV1, + + enumMemberV2Preview, +} + +@removed(Versions.v2) +union UnionV1 { + string, + int32, +} + +union UnionV2 { + string, + float32, + + @removed(Versions.v2) + V1Scalar, +} + +@removed(Versions.v2) +scalar V1Scalar extends int32; + +/** + * This operation should not be generated with latest version's signature. + */ +#suppress "@typespec/spector/missing-scenario" "by design" +@route("/v1") +@post +@removed(Versions.v2) +op v1(@body body: ModelV1): ModelV1; + +@scenario +@scenarioDoc(""" + This operation should be generated with latest version's signature. + + Expected request body: + ```json + { "prop": "foo", "enumProp": "enumMemberV2", "unionProp": "bar" } + ``` + """) +@route("/v2") +@post +op v2(@body body: ModelV2, @removed(Versions.v2) @query param: string): ModelV2; + +/** + * This operation group should not be generated with latest version. + */ +@route("/interface-v1") +@removed(Versions.v2) +interface InterfaceV1 { + #suppress "@typespec/spector/missing-scenario" "by design" + @post + @route("/v1") + v1InInterface(@body body: ModelV1): ModelV1; +} + +/** This operation will pass different paths and different request bodies based on different versions. */ +@scenario +@scenarioDoc(""" + path: "/versioning/removed/api-version:v1/v3" + Expected request body: + ```json + { "id": "123", "enumProp": "enumMemberV1" } + ``` + + Expected response body: + ```json + { "id": "123", "enumProp": "enumMemberV1" } + ``` + + path: "/versioning/removed/api-version:v2preview/v3" + Expected request body: + ```json + { "id": "123"} + ``` + + Expected response body: + ```json + { "id": "123"} + ``` + + path: "/versioning/removed/api-version:v2/v3" + Expected request body: + ```json + { "id": "123", "enumProp": "enumMemberV1" } + ``` + + Expected response body: + ```json + { "id": "123", "enumProp": "enumMemberV1" } + ``` + + """) +@post +@route("/v3") +op modelV3(@body body: ModelV3): ModelV3; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/mockapi.ts new file mode 100644 index 00000000000..3ad0c9f2677 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/mockapi.ts @@ -0,0 +1,67 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Versioning_Removed_v2 = passOnSuccess({ + uri: `/versioning/removed/api-version:v2/v2`, + method: `post`, + request: { + body: json({ + prop: "foo", + enumProp: "enumMemberV2", + unionProp: "bar", + }), + }, + response: { + status: 200, + body: json({ prop: "foo", enumProp: "enumMemberV2", unionProp: "bar" }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Versioning_Removed_modelV3 = passOnSuccess({ + uri: `/versioning/removed/api-version\\:v1/v3`, + method: "post", + request: { + body: json({ + id: "123", + enumProp: "enumMemberV1", + }), + }, + response: { + status: 200, + body: json({ id: "123", enumProp: "enumMemberV1" }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Versioning_Removed_modelV3_V2 = passOnSuccess({ + uri: `/versioning/removed/api-version\\:v2/v3`, + method: "post", + request: { + body: json({ + id: "123", + enumProp: "enumMemberV1", + }), + }, + response: { + status: 200, + body: json({ id: "123", enumProp: "enumMemberV1" }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Versioning_Removed_modelV3_V2preview = passOnSuccess({ + uri: `/versioning/removed/api-version\\:v2preview/v3`, + method: "post", + request: { + body: json({ + id: "123", + }), + }, + response: { + status: 200, + body: json({ id: "123" }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/main.tsp new file mode 100644 index 00000000000..c6e6e81fe21 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/main.tsp @@ -0,0 +1,112 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@typespec/versioning"; + +using Http; +using Spector; +using TypeSpec.Versioning; + +/** + * Test for the `@renamedFrom` decorator. + */ +@service +@versioned(Versions) +@server( + "{endpoint}/versioning/renamed-from/api-version:{version}", + "Testserver endpoint", + { + /** + * Need to be set as 'http://localhost:3000' in client. + */ + endpoint: url, + + /** + * Need to be set as 'v1' or 'v2' in client. + */ + version: Versions, + } +) +namespace Versioning.RenamedFrom; + +/** + * The version of the API. + */ +enum Versions { + /** + * The version v1. + */ + v1: "v1", + + /** + * The version v2. + */ + v2: "v2", +} + +@renamedFrom(Versions.v2, "OldModel") +model NewModel { + @renamedFrom(Versions.v2, "oldProp") + newProp: string; + + enumProp: NewEnum; + unionProp: NewUnion; +} + +@renamedFrom(Versions.v2, "OldEnum") +enum NewEnum { + @renamedFrom(Versions.v2, "oldEnumMember") + newEnumMember, +} + +@renamedFrom(Versions.v2, "OldUnion") +union NewUnion { + string, + + @renamedFrom(Versions.v2, "oldUnionVariant") + newUnionVariant: NewScalar, +} + +@renamedFrom(Versions.v2, "OldScalar") +scalar NewScalar extends int32; + +@scenario +@scenarioDoc(""" + This operation should be generated with latest version's signature. + + Expected request body: + ```json + { "newProp": "foo", "enumProp": "newEnumMember", "unionProp": 10 } + ``` + + Expected query: + newQuery=bar + + """) +@route("/test") +@post +@renamedFrom(Versions.v2, "oldOp") +op newOp( + @body body: NewModel, + + @renamedFrom(Versions.v2, "oldQuery") + @query + newQuery: string, +): NewModel; + +@renamedFrom(Versions.v2, "OldInterface") +@scenario +@scenarioDoc(""" + This operation group should only be generated with latest version's signature. + + Expected request body for test: + ```json + { "prop": "foo", "enumProp": "newEnumMember", "unionProp": 10 } + ``` + + """) +@route("/interface") +interface NewInterface { + @post + @route("/test") + newOpInNewInterface(@body body: NewModel): NewModel; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/mockapi.ts new file mode 100644 index 00000000000..c666f859b27 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/mockapi.ts @@ -0,0 +1,40 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Versioning_RenamedFrom_newOp = passOnSuccess({ + uri: `/versioning/renamed-from/api-version:v2/test`, + method: `post`, + request: { + body: json({ + newProp: "foo", + enumProp: "newEnumMember", + unionProp: 10, + }), + query: { + newQuery: "bar", + }, + }, + response: { + status: 200, + body: json({ newProp: "foo", enumProp: "newEnumMember", unionProp: 10 }), + }, + kind: "MockApiDefinition", +}); + +Scenarios.Versioning_RenamedFrom_NewInterface = passOnSuccess({ + uri: `/versioning/renamed-from/api-version:v2/interface/test`, + method: `post`, + request: { + body: json({ + newProp: "foo", + enumProp: "newEnumMember", + unionProp: 10, + }), + }, + response: { + status: 200, + body: json({ newProp: "foo", enumProp: "newEnumMember", unionProp: 10 }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/main.tsp new file mode 100644 index 00000000000..a6fa063011b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/main.tsp @@ -0,0 +1,72 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@typespec/versioning"; + +using Http; +using Spector; +using TypeSpec.Versioning; + +/** + * Test for the `@returnTypeChangedFrom` decorator. + */ +@service +@versioned(Versions) +@server( + "{endpoint}/versioning/return-type-changed-from/api-version:{version}", + "Testserver endpoint", + { + /** + * Need to be set as 'http://localhost:3000' in client. + */ + endpoint: url, + + /** + * Need to be set as 'v1' or 'v2' in client. + */ + version: Versions, + } +) +namespace Versioning.ReturnTypeChangedFrom; + +/** + * The version of the API. + */ +enum Versions { + /** + * The version v1. + */ + v1: "v1", + + /** + * The version v2. + */ + v2: "v2", +} + +@scenario +@scenarioDoc(""" + This operation should be generated with latest version's signature. + + Expected request body: "test" + Expected response body: "test" + + """) +@route("/test") +@post +@returnTypeChangedFrom( + Versions.v2, + { + @header + contentType: "application/json", + + @body + body: int32, + } +) +op test(@header contentType: "application/json", @body body: string): { + @header + contentType: "application/json"; + + @body + body: string; +}; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/mockapi.ts new file mode 100644 index 00000000000..b15729a3c05 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/mockapi.ts @@ -0,0 +1,19 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Versioning_ReturnTypeChangedFrom_test = passOnSuccess({ + uri: `/versioning/return-type-changed-from/api-version:v2/test`, + method: `post`, + request: { + body: json("test"), + headers: { + "Content-Type": "text/plain", + }, + }, + response: { + status: 200, + body: json("test"), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/main.tsp new file mode 100644 index 00000000000..acc8bd99e50 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/main.tsp @@ -0,0 +1,71 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@typespec/versioning"; + +using Http; +using Spector; +using TypeSpec.Versioning; + +/** + * Test for the `@typeChangedFrom` decorator. + */ +@service +@versioned(Versions) +@server( + "{endpoint}/versioning/type-changed-from/api-version:{version}", + "Testserver endpoint", + { + /** + * Need to be set as 'http://localhost:3000' in client. + */ + endpoint: url, + + /** + * Need to be set as 'v1' or 'v2' in client. + */ + version: Versions, + } +) +namespace Versioning.TypeChangedFrom; + +/** + * The version of the API. + */ +enum Versions { + /** + * The version v1. + */ + v1: "v1", + + /** + * The version v2. + */ + v2: "v2", +} + +model TestModel { + prop: string; + + @typeChangedFrom(Versions.v2, int32) + changedProp: string; +} + +@scenario +@scenarioDoc(""" + This operation should be generated with latest version's signature. + + Expected request body: + ```json + { "prop": "foo", "changedProp": "bar" } + ``` + + Expected query param: + param="baz" + + """) +@route("/test") +@post +op test( + @body body: TestModel, + @typeChangedFrom(Versions.v2, int32) @query param: string, +): TestModel; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/mockapi.ts new file mode 100644 index 00000000000..4e7b0142a5e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/mockapi.ts @@ -0,0 +1,22 @@ +import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; + +export const Scenarios: Record = {}; + +Scenarios.Versioning_TypeChangedFrom_test = passOnSuccess({ + uri: `/versioning/type-changed-from/api-version:v2/test`, + method: `post`, + request: { + query: { + param: "baz", + }, + body: json({ + prop: "foo", + changedProp: "bar", + }), + }, + response: { + status: 200, + body: json({ prop: "foo", changedProp: "bar" }), + }, + kind: "MockApiDefinition", +}); diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyAsyncClient.java deleted file mode 100644 index 60d52673c2b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyAsyncClient.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.apikey; - -import authentication.apikey.implementation.ApiKeyClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ApiKeyClient type. - */ -@ServiceClient(builder = ApiKeyClientBuilder.class, isAsync = true) -public final class ApiKeyAsyncClient { - @Generated - private final ApiKeyClientImpl serviceClient; - - /** - * Initializes an instance of ApiKeyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ApiKeyAsyncClient(ApiKeyClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> validWithResponse(RequestOptions requestOptions) { - return this.serviceClient.validWithResponseAsync(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> invalidWithResponse(RequestOptions requestOptions) { - return this.serviceClient.invalidWithResponseAsync(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono valid() { - // Generated convenience method for validWithResponse - RequestOptions requestOptions = new RequestOptions(); - return validWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono invalid() { - // Generated convenience method for invalidWithResponse - RequestOptions requestOptions = new RequestOptions(); - return invalidWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClient.java deleted file mode 100644 index cfb5c1e5e03..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClient.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.apikey; - -import authentication.apikey.implementation.ApiKeyClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ApiKeyClient type. - */ -@ServiceClient(builder = ApiKeyClientBuilder.class) -public final class ApiKeyClient { - @Generated - private final ApiKeyClientImpl serviceClient; - - /** - * Initializes an instance of ApiKeyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ApiKeyClient(ApiKeyClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response validWithResponse(RequestOptions requestOptions) { - return this.serviceClient.validWithResponse(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response invalidWithResponse(RequestOptions requestOptions) { - return this.serviceClient.invalidWithResponse(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void valid() { - // Generated convenience method for validWithResponse - RequestOptions requestOptions = new RequestOptions(); - validWithResponse(requestOptions).getValue(); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void invalid() { - // Generated convenience method for invalidWithResponse - RequestOptions requestOptions = new RequestOptions(); - invalidWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClientBuilder.java deleted file mode 100644 index 4e53c7e847f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClientBuilder.java +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.apikey; - -import authentication.apikey.implementation.ApiKeyClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.client.traits.KeyCredentialTrait; -import com.azure.core.credential.KeyCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.KeyCredentialPolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ApiKeyClient type. - */ -@ServiceClientBuilder(serviceClients = { ApiKeyClient.class, ApiKeyAsyncClient.class }) -public final class ApiKeyClientBuilder - implements HttpTrait, ConfigurationTrait, - KeyCredentialTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("authentication-apikey.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ApiKeyClientBuilder. - */ - @Generated - public ApiKeyClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ApiKeyClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ApiKeyClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ApiKeyClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ApiKeyClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ApiKeyClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ApiKeyClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ApiKeyClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The KeyCredential used for authentication. - */ - @Generated - private KeyCredential keyCredential; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ApiKeyClientBuilder credential(KeyCredential keyCredential) { - this.keyCredential = keyCredential; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ApiKeyClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ApiKeyClientBuilder. - */ - @Generated - public ApiKeyClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ApiKeyClientImpl with the provided parameters. - * - * @return an instance of ApiKeyClientImpl. - */ - @Generated - private ApiKeyClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ApiKeyClientImpl client - = new ApiKeyClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - if (keyCredential != null) { - policies.add(new KeyCredentialPolicy("x-ms-api-key", keyCredential)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ApiKeyAsyncClient class. - * - * @return an instance of ApiKeyAsyncClient. - */ - @Generated - public ApiKeyAsyncClient buildAsyncClient() { - return new ApiKeyAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ApiKeyClient class. - * - * @return an instance of ApiKeyClient. - */ - @Generated - public ApiKeyClient buildClient() { - return new ApiKeyClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ApiKeyClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java deleted file mode 100644 index 404e09eca33..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.apikey.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the ApiKeyClient type. - */ -public final class ApiKeyClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ApiKeyClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of ApiKeyClient client. - * - * @param endpoint Service host. - */ - public ApiKeyClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ApiKeyClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ApiKeyClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ApiKeyClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ApiKeyClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(ApiKeyClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ApiKeyClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ApiKeyClient") - public interface ApiKeyClientService { - @Get("/authentication/api-key/valid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> valid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/authentication/api-key/valid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response validSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/authentication/api-key/invalid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> invalid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/authentication/api-key/invalid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response invalidSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> validWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.valid(this.getEndpoint(), requestOptions, context)); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response validWithResponse(RequestOptions requestOptions) { - return service.validSync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> invalidWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.invalid(this.getEndpoint(), requestOptions, context)); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response invalidWithResponse(RequestOptions requestOptions) { - return service.invalidSync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/package-info.java deleted file mode 100644 index e645e8e6d3d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ApiKey. - * Illustrates clients generated with ApiKey authentication. - * - */ -package authentication.apikey.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/package-info.java deleted file mode 100644 index b83288c26de..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ApiKey. - * Illustrates clients generated with ApiKey authentication. - * - */ -package authentication.apikey; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomAsyncClient.java deleted file mode 100644 index dacdf449df5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomAsyncClient.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.http.custom; - -import authentication.http.custom.implementation.CustomClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous CustomClient type. - */ -@ServiceClient(builder = CustomClientBuilder.class, isAsync = true) -public final class CustomAsyncClient { - @Generated - private final CustomClientImpl serviceClient; - - /** - * Initializes an instance of CustomAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CustomAsyncClient(CustomClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> validWithResponse(RequestOptions requestOptions) { - return this.serviceClient.validWithResponseAsync(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> invalidWithResponse(RequestOptions requestOptions) { - return this.serviceClient.invalidWithResponseAsync(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono valid() { - // Generated convenience method for validWithResponse - RequestOptions requestOptions = new RequestOptions(); - return validWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono invalid() { - // Generated convenience method for invalidWithResponse - RequestOptions requestOptions = new RequestOptions(); - return invalidWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClient.java deleted file mode 100644 index 608e2ada8b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClient.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.http.custom; - -import authentication.http.custom.implementation.CustomClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous CustomClient type. - */ -@ServiceClient(builder = CustomClientBuilder.class) -public final class CustomClient { - @Generated - private final CustomClientImpl serviceClient; - - /** - * Initializes an instance of CustomClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CustomClient(CustomClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response validWithResponse(RequestOptions requestOptions) { - return this.serviceClient.validWithResponse(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response invalidWithResponse(RequestOptions requestOptions) { - return this.serviceClient.invalidWithResponse(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void valid() { - // Generated convenience method for validWithResponse - RequestOptions requestOptions = new RequestOptions(); - validWithResponse(requestOptions).getValue(); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void invalid() { - // Generated convenience method for invalidWithResponse - RequestOptions requestOptions = new RequestOptions(); - invalidWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClientBuilder.java deleted file mode 100644 index 3dce343176f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClientBuilder.java +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.http.custom; - -import authentication.http.custom.implementation.CustomClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.client.traits.KeyCredentialTrait; -import com.azure.core.credential.KeyCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.KeyCredentialPolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the CustomClient type. - */ -@ServiceClientBuilder(serviceClients = { CustomClient.class, CustomAsyncClient.class }) -public final class CustomClientBuilder - implements HttpTrait, ConfigurationTrait, - KeyCredentialTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("authentication-http-custom.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the CustomClientBuilder. - */ - @Generated - public CustomClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CustomClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CustomClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CustomClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CustomClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CustomClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CustomClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CustomClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The KeyCredential used for authentication. - */ - @Generated - private KeyCredential keyCredential; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CustomClientBuilder credential(KeyCredential keyCredential) { - this.keyCredential = keyCredential; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CustomClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the CustomClientBuilder. - */ - @Generated - public CustomClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of CustomClientImpl with the provided parameters. - * - * @return an instance of CustomClientImpl. - */ - @Generated - private CustomClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - CustomClientImpl client - = new CustomClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - if (keyCredential != null) { - policies.add(new KeyCredentialPolicy("authorization", keyCredential, "SharedAccessKey")); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of CustomAsyncClient class. - * - * @return an instance of CustomAsyncClient. - */ - @Generated - public CustomAsyncClient buildAsyncClient() { - return new CustomAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of CustomClient class. - * - * @return an instance of CustomClient. - */ - @Generated - public CustomClient buildClient() { - return new CustomClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(CustomClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/CustomClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/CustomClientImpl.java deleted file mode 100644 index 040adf1b5f3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/CustomClientImpl.java +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.http.custom.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the CustomClient type. - */ -public final class CustomClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final CustomClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of CustomClient client. - * - * @param endpoint Service host. - */ - public CustomClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of CustomClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public CustomClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of CustomClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public CustomClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(CustomClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for CustomClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "CustomClient") - public interface CustomClientService { - @Get("/authentication/http/custom/valid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> valid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/authentication/http/custom/valid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response validSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/authentication/http/custom/invalid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> invalid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/authentication/http/custom/invalid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response invalidSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> validWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.valid(this.getEndpoint(), requestOptions, context)); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response validWithResponse(RequestOptions requestOptions) { - return service.validSync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> invalidWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.invalid(this.getEndpoint(), requestOptions, context)); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response invalidWithResponse(RequestOptions requestOptions) { - return service.invalidSync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/package-info.java deleted file mode 100644 index 2d75758fa57..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Custom. - * Illustrates clients generated with generic HTTP auth. - * - */ -package authentication.http.custom.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/package-info.java deleted file mode 100644 index 449090f6e8d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Custom. - * Illustrates clients generated with generic HTTP auth. - * - */ -package authentication.http.custom; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2AsyncClient.java deleted file mode 100644 index c7fa3bf6632..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2AsyncClient.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.oauth2; - -import authentication.oauth2.implementation.OAuth2ClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous OAuth2Client type. - */ -@ServiceClient(builder = OAuth2ClientBuilder.class, isAsync = true) -public final class OAuth2AsyncClient { - @Generated - private final OAuth2ClientImpl serviceClient; - - /** - * Initializes an instance of OAuth2AsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - OAuth2AsyncClient(OAuth2ClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> validWithResponse(RequestOptions requestOptions) { - return this.serviceClient.validWithResponseAsync(requestOptions); - } - - /** - * Check whether client is authenticated. Will return an invalid bearer error. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> invalidWithResponse(RequestOptions requestOptions) { - return this.serviceClient.invalidWithResponseAsync(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono valid() { - // Generated convenience method for validWithResponse - RequestOptions requestOptions = new RequestOptions(); - return validWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Check whether client is authenticated. Will return an invalid bearer error. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono invalid() { - // Generated convenience method for invalidWithResponse - RequestOptions requestOptions = new RequestOptions(); - return invalidWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2Client.java deleted file mode 100644 index f9eb53cddc9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2Client.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.oauth2; - -import authentication.oauth2.implementation.OAuth2ClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous OAuth2Client type. - */ -@ServiceClient(builder = OAuth2ClientBuilder.class) -public final class OAuth2Client { - @Generated - private final OAuth2ClientImpl serviceClient; - - /** - * Initializes an instance of OAuth2Client class. - * - * @param serviceClient the service client implementation. - */ - @Generated - OAuth2Client(OAuth2ClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response validWithResponse(RequestOptions requestOptions) { - return this.serviceClient.validWithResponse(requestOptions); - } - - /** - * Check whether client is authenticated. Will return an invalid bearer error. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response invalidWithResponse(RequestOptions requestOptions) { - return this.serviceClient.invalidWithResponse(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void valid() { - // Generated convenience method for validWithResponse - RequestOptions requestOptions = new RequestOptions(); - validWithResponse(requestOptions).getValue(); - } - - /** - * Check whether client is authenticated. Will return an invalid bearer error. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void invalid() { - // Generated convenience method for invalidWithResponse - RequestOptions requestOptions = new RequestOptions(); - invalidWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2ClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2ClientBuilder.java deleted file mode 100644 index 24fb716a6a4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2ClientBuilder.java +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.oauth2; - -import authentication.oauth2.implementation.OAuth2ClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.client.traits.TokenCredentialTrait; -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the OAuth2Client type. - */ -@ServiceClientBuilder(serviceClients = { OAuth2Client.class, OAuth2AsyncClient.class }) -public final class OAuth2ClientBuilder - implements HttpTrait, ConfigurationTrait, - TokenCredentialTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final String[] DEFAULT_SCOPES = new String[] { "https://security.microsoft.com/.default" }; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("authentication-oauth2.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the OAuth2ClientBuilder. - */ - @Generated - public OAuth2ClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OAuth2ClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OAuth2ClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OAuth2ClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OAuth2ClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OAuth2ClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OAuth2ClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OAuth2ClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The TokenCredential used for authentication. - */ - @Generated - private TokenCredential tokenCredential; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OAuth2ClientBuilder credential(TokenCredential tokenCredential) { - this.tokenCredential = tokenCredential; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OAuth2ClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the OAuth2ClientBuilder. - */ - @Generated - public OAuth2ClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of OAuth2ClientImpl with the provided parameters. - * - * @return an instance of OAuth2ClientImpl. - */ - @Generated - private OAuth2ClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - OAuth2ClientImpl client - = new OAuth2ClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - if (tokenCredential != null) { - policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of OAuth2AsyncClient class. - * - * @return an instance of OAuth2AsyncClient. - */ - @Generated - public OAuth2AsyncClient buildAsyncClient() { - return new OAuth2AsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of OAuth2Client class. - * - * @return an instance of OAuth2Client. - */ - @Generated - public OAuth2Client buildClient() { - return new OAuth2Client(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(OAuth2ClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/OAuth2ClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/OAuth2ClientImpl.java deleted file mode 100644 index 3c182019e1d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/OAuth2ClientImpl.java +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.oauth2.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the OAuth2Client type. - */ -public final class OAuth2ClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final OAuth2ClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of OAuth2Client client. - * - * @param endpoint Service host. - */ - public OAuth2ClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of OAuth2Client client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public OAuth2ClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of OAuth2Client client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public OAuth2ClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(OAuth2ClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for OAuth2Client to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OAuth2Client") - public interface OAuth2ClientService { - @Get("/authentication/oauth2/valid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> valid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/authentication/oauth2/valid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response validSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/authentication/oauth2/invalid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> invalid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/authentication/oauth2/invalid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response invalidSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> validWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.valid(this.getEndpoint(), requestOptions, context)); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response validWithResponse(RequestOptions requestOptions) { - return service.validSync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * Check whether client is authenticated. Will return an invalid bearer error. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> invalidWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.invalid(this.getEndpoint(), requestOptions, context)); - } - - /** - * Check whether client is authenticated. Will return an invalid bearer error. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response invalidWithResponse(RequestOptions requestOptions) { - return service.invalidSync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/package-info.java deleted file mode 100644 index 0e2e4513a2f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for OAuth2. - * Illustrates clients generated with OAuth2 authentication. - * - */ -package authentication.oauth2.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/package-info.java deleted file mode 100644 index d401e7ffaba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for OAuth2. - * Illustrates clients generated with OAuth2 authentication. - * - */ -package authentication.oauth2; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionAsyncClient.java deleted file mode 100644 index cbbf2f81c74..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionAsyncClient.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.union; - -import authentication.union.implementation.UnionClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) -public final class UnionAsyncClient { - @Generated - private final UnionClientImpl serviceClient; - - /** - * Initializes an instance of UnionAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionAsyncClient(UnionClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> validKeyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.validKeyWithResponseAsync(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> validTokenWithResponse(RequestOptions requestOptions) { - return this.serviceClient.validTokenWithResponseAsync(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono validKey() { - // Generated convenience method for validKeyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return validKeyWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono validToken() { - // Generated convenience method for validTokenWithResponse - RequestOptions requestOptions = new RequestOptions(); - return validTokenWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClient.java deleted file mode 100644 index 8bd5ba11689..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClient.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.union; - -import authentication.union.implementation.UnionClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class) -public final class UnionClient { - @Generated - private final UnionClientImpl serviceClient; - - /** - * Initializes an instance of UnionClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionClient(UnionClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response validKeyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.validKeyWithResponse(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response validTokenWithResponse(RequestOptions requestOptions) { - return this.serviceClient.validTokenWithResponse(requestOptions); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void validKey() { - // Generated convenience method for validKeyWithResponse - RequestOptions requestOptions = new RequestOptions(); - validKeyWithResponse(requestOptions).getValue(); - } - - /** - * Check whether client is authenticated. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void validToken() { - // Generated convenience method for validTokenWithResponse - RequestOptions requestOptions = new RequestOptions(); - validTokenWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClientBuilder.java deleted file mode 100644 index f7726517bca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClientBuilder.java +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.union; - -import authentication.union.implementation.UnionClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.client.traits.KeyCredentialTrait; -import com.azure.core.client.traits.TokenCredentialTrait; -import com.azure.core.credential.KeyCredential; -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.KeyCredentialPolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the UnionClient type. - */ -@ServiceClientBuilder(serviceClients = { UnionClient.class, UnionAsyncClient.class }) -public final class UnionClientBuilder implements HttpTrait, ConfigurationTrait, - TokenCredentialTrait, KeyCredentialTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final String[] DEFAULT_SCOPES = new String[] { "https://security.microsoft.com/.default" }; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("authentication-union.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the UnionClientBuilder. - */ - @Generated - public UnionClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The TokenCredential used for authentication. - */ - @Generated - private TokenCredential tokenCredential; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder credential(TokenCredential tokenCredential) { - this.tokenCredential = tokenCredential; - return this; - } - - /* - * The KeyCredential used for authentication. - */ - @Generated - private KeyCredential keyCredential; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder credential(KeyCredential keyCredential) { - this.keyCredential = keyCredential; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the UnionClientBuilder. - */ - @Generated - public UnionClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of UnionClientImpl with the provided parameters. - * - * @return an instance of UnionClientImpl. - */ - @Generated - private UnionClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - UnionClientImpl client - = new UnionClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - if (keyCredential != null) { - policies.add(new KeyCredentialPolicy("x-ms-api-key", keyCredential)); - } - if (tokenCredential != null) { - policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of UnionAsyncClient class. - * - * @return an instance of UnionAsyncClient. - */ - @Generated - public UnionAsyncClient buildAsyncClient() { - return new UnionAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of UnionClient class. - * - * @return an instance of UnionClient. - */ - @Generated - public UnionClient buildClient() { - return new UnionClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(UnionClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/UnionClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/UnionClientImpl.java deleted file mode 100644 index 846b942b491..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/UnionClientImpl.java +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.union.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the UnionClient type. - */ -public final class UnionClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnionClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of UnionClient client. - * - * @param endpoint Service host. - */ - public UnionClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of UnionClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public UnionClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of UnionClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public UnionClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(UnionClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for UnionClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UnionClient") - public interface UnionClientService { - @Get("/authentication/union/validkey") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> validKey(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/authentication/union/validkey") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response validKeySync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/authentication/union/validtoken") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> validToken(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/authentication/union/validtoken") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response validTokenSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> validKeyWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.validKey(this.getEndpoint(), requestOptions, context)); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response validKeyWithResponse(RequestOptions requestOptions) { - return service.validKeySync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> validTokenWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.validToken(this.getEndpoint(), requestOptions, context)); - } - - /** - * Check whether client is authenticated. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response validTokenWithResponse(RequestOptions requestOptions) { - return service.validTokenSync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/package-info.java deleted file mode 100644 index 02dbb0277f9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Union. - * Illustrates clients generated with ApiKey and OAuth2 authentication. - * - */ -package authentication.union.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/package-info.java deleted file mode 100644 index 090b0c5f393..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Union. - * Illustrates clients generated with ApiKey and OAuth2 authentication. - * - */ -package authentication.union; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/AccessClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/AccessClientBuilder.java deleted file mode 100644 index 760c951a8d3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/AccessClientBuilder.java +++ /dev/null @@ -1,357 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access; - -import azure.clientgenerator.core.access.implementation.AccessClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the AccessClient type. - */ -@ServiceClientBuilder( - serviceClients = { - PublicOperationClient.class, - InternalOperationClient.class, - SharedModelInOperationClient.class, - RelativeModelInOperationClient.class, - PublicOperationAsyncClient.class, - InternalOperationAsyncClient.class, - SharedModelInOperationAsyncClient.class, - RelativeModelInOperationAsyncClient.class }) -public final class AccessClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-access.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the AccessClientBuilder. - */ - @Generated - public AccessClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AccessClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AccessClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AccessClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AccessClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AccessClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AccessClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AccessClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AccessClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the AccessClientBuilder. - */ - @Generated - public AccessClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of AccessClientImpl with the provided parameters. - * - * @return an instance of AccessClientImpl. - */ - @Generated - private AccessClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - AccessClientImpl client - = new AccessClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of PublicOperationAsyncClient class. - * - * @return an instance of PublicOperationAsyncClient. - */ - @Generated - public PublicOperationAsyncClient buildPublicOperationAsyncClient() { - return new PublicOperationAsyncClient(buildInnerClient().getPublicOperations()); - } - - /** - * Builds an instance of InternalOperationAsyncClient class. - * - * @return an instance of InternalOperationAsyncClient. - */ - @Generated - public InternalOperationAsyncClient buildInternalOperationAsyncClient() { - return new InternalOperationAsyncClient(buildInnerClient().getInternalOperations()); - } - - /** - * Builds an instance of SharedModelInOperationAsyncClient class. - * - * @return an instance of SharedModelInOperationAsyncClient. - */ - @Generated - public SharedModelInOperationAsyncClient buildSharedModelInOperationAsyncClient() { - return new SharedModelInOperationAsyncClient(buildInnerClient().getSharedModelInOperations()); - } - - /** - * Builds an instance of RelativeModelInOperationAsyncClient class. - * - * @return an instance of RelativeModelInOperationAsyncClient. - */ - @Generated - public RelativeModelInOperationAsyncClient buildRelativeModelInOperationAsyncClient() { - return new RelativeModelInOperationAsyncClient(buildInnerClient().getRelativeModelInOperations()); - } - - /** - * Builds an instance of PublicOperationClient class. - * - * @return an instance of PublicOperationClient. - */ - @Generated - public PublicOperationClient buildPublicOperationClient() { - return new PublicOperationClient(buildInnerClient().getPublicOperations()); - } - - /** - * Builds an instance of InternalOperationClient class. - * - * @return an instance of InternalOperationClient. - */ - @Generated - public InternalOperationClient buildInternalOperationClient() { - return new InternalOperationClient(buildInnerClient().getInternalOperations()); - } - - /** - * Builds an instance of SharedModelInOperationClient class. - * - * @return an instance of SharedModelInOperationClient. - */ - @Generated - public SharedModelInOperationClient buildSharedModelInOperationClient() { - return new SharedModelInOperationClient(buildInnerClient().getSharedModelInOperations()); - } - - /** - * Builds an instance of RelativeModelInOperationClient class. - * - * @return an instance of RelativeModelInOperationClient. - */ - @Generated - public RelativeModelInOperationClient buildRelativeModelInOperationClient() { - return new RelativeModelInOperationClient(buildInnerClient().getRelativeModelInOperations()); - } - - private static final ClientLogger LOGGER = new ClientLogger(AccessClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationAsyncClient.java deleted file mode 100644 index aa84b8c985b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationAsyncClient.java +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access; - -import azure.clientgenerator.core.access.implementation.InternalOperationsImpl; -import azure.clientgenerator.core.access.internaloperation.implementation.models.InternalDecoratorModelInInternal; -import azure.clientgenerator.core.access.internaloperation.implementation.models.NoDecoratorModelInInternal; -import azure.clientgenerator.core.access.internaloperation.models.PublicDecoratorModelInInternal; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous AccessClient type. - */ -@ServiceClient(builder = AccessClientBuilder.class, isAsync = true) -public final class InternalOperationAsyncClient { - @Generated - private final InternalOperationsImpl serviceClient; - - /** - * Initializes an instance of InternalOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - InternalOperationAsyncClient(InternalOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The noDecoratorInInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in an internal operation, should be generated but not exported along with {@link Response} on - * successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> noDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.noDecoratorInInternalWithResponseAsync(name, requestOptions); - } - - /** - * The internalDecoratorInInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in an internal operation, should be generated but not exported along with {@link Response} on - * successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> internalDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.internalDecoratorInInternalWithResponseAsync(name, requestOptions); - } - - /** - * The publicDecoratorInInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in an internal operation but with public decorator, should be generated and exported along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> publicDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.publicDecoratorInInternalWithResponseAsync(name, requestOptions); - } - - /** - * The noDecoratorInInternal operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in an internal operation, should be generated but not exported on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono noDecoratorInInternal(String name) { - // Generated convenience method for noDecoratorInInternalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return noDecoratorInInternalWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(NoDecoratorModelInInternal.class)); - } - - /** - * The internalDecoratorInInternal operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in an internal operation, should be generated but not exported on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono internalDecoratorInInternal(String name) { - // Generated convenience method for internalDecoratorInInternalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return internalDecoratorInInternalWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(InternalDecoratorModelInInternal.class)); - } - - /** - * The publicDecoratorInInternal operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in an internal operation but with public decorator, should be generated and exported on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono publicDecoratorInInternal(String name) { - // Generated convenience method for publicDecoratorInInternalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return publicDecoratorInInternalWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(PublicDecoratorModelInInternal.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationClient.java deleted file mode 100644 index 034879644d8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationClient.java +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access; - -import azure.clientgenerator.core.access.implementation.InternalOperationsImpl; -import azure.clientgenerator.core.access.internaloperation.implementation.models.InternalDecoratorModelInInternal; -import azure.clientgenerator.core.access.internaloperation.implementation.models.NoDecoratorModelInInternal; -import azure.clientgenerator.core.access.internaloperation.models.PublicDecoratorModelInInternal; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous AccessClient type. - */ -@ServiceClient(builder = AccessClientBuilder.class) -public final class InternalOperationClient { - @Generated - private final InternalOperationsImpl serviceClient; - - /** - * Initializes an instance of InternalOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - InternalOperationClient(InternalOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The noDecoratorInInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in an internal operation, should be generated but not exported along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response noDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.noDecoratorInInternalWithResponse(name, requestOptions); - } - - /** - * The internalDecoratorInInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in an internal operation, should be generated but not exported along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response internalDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.internalDecoratorInInternalWithResponse(name, requestOptions); - } - - /** - * The publicDecoratorInInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in an internal operation but with public decorator, should be generated and exported along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response publicDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.publicDecoratorInInternalWithResponse(name, requestOptions); - } - - /** - * The noDecoratorInInternal operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in an internal operation, should be generated but not exported. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - NoDecoratorModelInInternal noDecoratorInInternal(String name) { - // Generated convenience method for noDecoratorInInternalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return noDecoratorInInternalWithResponse(name, requestOptions).getValue() - .toObject(NoDecoratorModelInInternal.class); - } - - /** - * The internalDecoratorInInternal operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in an internal operation, should be generated but not exported. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - InternalDecoratorModelInInternal internalDecoratorInInternal(String name) { - // Generated convenience method for internalDecoratorInInternalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return internalDecoratorInInternalWithResponse(name, requestOptions).getValue() - .toObject(InternalDecoratorModelInInternal.class); - } - - /** - * The publicDecoratorInInternal operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in an internal operation but with public decorator, should be generated and exported. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - PublicDecoratorModelInInternal publicDecoratorInInternal(String name) { - // Generated convenience method for publicDecoratorInInternalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return publicDecoratorInInternalWithResponse(name, requestOptions).getValue() - .toObject(PublicDecoratorModelInInternal.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationAsyncClient.java deleted file mode 100644 index 3d3eacf5312..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationAsyncClient.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access; - -import azure.clientgenerator.core.access.implementation.PublicOperationsImpl; -import azure.clientgenerator.core.access.publicoperation.models.NoDecoratorModelInPublic; -import azure.clientgenerator.core.access.publicoperation.models.PublicDecoratorModelInPublic; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous AccessClient type. - */ -@ServiceClient(builder = AccessClientBuilder.class, isAsync = true) -public final class PublicOperationAsyncClient { - @Generated - private final PublicOperationsImpl serviceClient; - - /** - * Initializes an instance of PublicOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PublicOperationAsyncClient(PublicOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The noDecoratorInPublic operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in a public operation, should be generated and exported along with {@link Response} on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> noDecoratorInPublicWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.noDecoratorInPublicWithResponseAsync(name, requestOptions); - } - - /** - * The publicDecoratorInPublic operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in a public operation, should be generated and exported along with {@link Response} on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> publicDecoratorInPublicWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.publicDecoratorInPublicWithResponseAsync(name, requestOptions); - } - - /** - * The noDecoratorInPublic operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in a public operation, should be generated and exported on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono noDecoratorInPublic(String name) { - // Generated convenience method for noDecoratorInPublicWithResponse - RequestOptions requestOptions = new RequestOptions(); - return noDecoratorInPublicWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(NoDecoratorModelInPublic.class)); - } - - /** - * The publicDecoratorInPublic operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in a public operation, should be generated and exported on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono publicDecoratorInPublic(String name) { - // Generated convenience method for publicDecoratorInPublicWithResponse - RequestOptions requestOptions = new RequestOptions(); - return publicDecoratorInPublicWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(PublicDecoratorModelInPublic.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationClient.java deleted file mode 100644 index 66d89e302e8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationClient.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access; - -import azure.clientgenerator.core.access.implementation.PublicOperationsImpl; -import azure.clientgenerator.core.access.publicoperation.models.NoDecoratorModelInPublic; -import azure.clientgenerator.core.access.publicoperation.models.PublicDecoratorModelInPublic; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous AccessClient type. - */ -@ServiceClient(builder = AccessClientBuilder.class) -public final class PublicOperationClient { - @Generated - private final PublicOperationsImpl serviceClient; - - /** - * Initializes an instance of PublicOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PublicOperationClient(PublicOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The noDecoratorInPublic operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in a public operation, should be generated and exported along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response noDecoratorInPublicWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.noDecoratorInPublicWithResponse(name, requestOptions); - } - - /** - * The publicDecoratorInPublic operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in a public operation, should be generated and exported along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response publicDecoratorInPublicWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.publicDecoratorInPublicWithResponse(name, requestOptions); - } - - /** - * The noDecoratorInPublic operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in a public operation, should be generated and exported. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public NoDecoratorModelInPublic noDecoratorInPublic(String name) { - // Generated convenience method for noDecoratorInPublicWithResponse - RequestOptions requestOptions = new RequestOptions(); - return noDecoratorInPublicWithResponse(name, requestOptions).getValue() - .toObject(NoDecoratorModelInPublic.class); - } - - /** - * The publicDecoratorInPublic operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in a public operation, should be generated and exported. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public PublicDecoratorModelInPublic publicDecoratorInPublic(String name) { - // Generated convenience method for publicDecoratorInPublicWithResponse - RequestOptions requestOptions = new RequestOptions(); - return publicDecoratorInPublicWithResponse(name, requestOptions).getValue() - .toObject(PublicDecoratorModelInPublic.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationAsyncClient.java deleted file mode 100644 index a31185d7e0a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationAsyncClient.java +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access; - -import azure.clientgenerator.core.access.implementation.RelativeModelInOperationsImpl; -import azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.AbstractModel; -import azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.OuterModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous AccessClient type. - */ -@ServiceClient(builder = AccessClientBuilder.class, isAsync = true) -public final class RelativeModelInOperationAsyncClient { - @Generated - private final RelativeModelInOperationsImpl serviceClient; - - /** - * Initializes an instance of RelativeModelInOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RelativeModelInOperationAsyncClient(RelativeModelInOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Expected query parameter: name="Madge" - * Expected response body: - * ```json - * { - * "name": "Madge", - * "inner": - * { - * "name": "Madge" - * } - * } - * ```. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     inner (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in internal operations, should be generated but not exported along with {@link Response} on - * successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> operationWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.operationWithResponseAsync(name, requestOptions); - } - - /** - * Expected query parameter: kind="real" - * Expected response body: - * ```json - * { - * "name": "Madge", - * "kind": "real" - * } - * ```. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param kind The kind parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in internal operations, should be generated but not exported along with {@link Response} on - * successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> discriminatorWithResponse(String kind, RequestOptions requestOptions) { - return this.serviceClient.discriminatorWithResponseAsync(kind, requestOptions); - } - - /** - * Expected query parameter: name="Madge" - * Expected response body: - * ```json - * { - * "name": "Madge", - * "inner": - * { - * "name": "Madge" - * } - * } - * ```. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in internal operations, should be generated but not exported on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono operation(String name) { - // Generated convenience method for operationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return operationWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(OuterModel.class)); - } - - /** - * Expected query parameter: kind="real" - * Expected response body: - * ```json - * { - * "name": "Madge", - * "kind": "real" - * } - * ```. - * - * @param kind The kind parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in internal operations, should be generated but not exported on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono discriminator(String kind) { - // Generated convenience method for discriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return discriminatorWithResponse(kind, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(AbstractModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationClient.java deleted file mode 100644 index b584e546456..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationClient.java +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access; - -import azure.clientgenerator.core.access.implementation.RelativeModelInOperationsImpl; -import azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.AbstractModel; -import azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.OuterModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous AccessClient type. - */ -@ServiceClient(builder = AccessClientBuilder.class) -public final class RelativeModelInOperationClient { - @Generated - private final RelativeModelInOperationsImpl serviceClient; - - /** - * Initializes an instance of RelativeModelInOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RelativeModelInOperationClient(RelativeModelInOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Expected query parameter: name="Madge" - * Expected response body: - * ```json - * { - * "name": "Madge", - * "inner": - * { - * "name": "Madge" - * } - * } - * ```. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     inner (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in internal operations, should be generated but not exported along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response operationWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.operationWithResponse(name, requestOptions); - } - - /** - * Expected query parameter: kind="real" - * Expected response body: - * ```json - * { - * "name": "Madge", - * "kind": "real" - * } - * ```. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param kind The kind parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in internal operations, should be generated but not exported along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response discriminatorWithResponse(String kind, RequestOptions requestOptions) { - return this.serviceClient.discriminatorWithResponse(kind, requestOptions); - } - - /** - * Expected query parameter: name="Madge" - * Expected response body: - * ```json - * { - * "name": "Madge", - * "inner": - * { - * "name": "Madge" - * } - * } - * ```. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in internal operations, should be generated but not exported. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - OuterModel operation(String name) { - // Generated convenience method for operationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return operationWithResponse(name, requestOptions).getValue().toObject(OuterModel.class); - } - - /** - * Expected query parameter: kind="real" - * Expected response body: - * ```json - * { - * "name": "Madge", - * "kind": "real" - * } - * ```. - * - * @param kind The kind parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used in internal operations, should be generated but not exported. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - AbstractModel discriminator(String kind) { - // Generated convenience method for discriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return discriminatorWithResponse(kind, requestOptions).getValue().toObject(AbstractModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationAsyncClient.java deleted file mode 100644 index f6e574f8e2c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access; - -import azure.clientgenerator.core.access.implementation.SharedModelInOperationsImpl; -import azure.clientgenerator.core.access.sharedmodelinoperation.models.SharedModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous AccessClient type. - */ -@ServiceClient(builder = AccessClientBuilder.class, isAsync = true) -public final class SharedModelInOperationAsyncClient { - @Generated - private final SharedModelInOperationsImpl serviceClient; - - /** - * Initializes an instance of SharedModelInOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SharedModelInOperationAsyncClient(SharedModelInOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The publicMethod operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used by both public and internal operation along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> publicMethodWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.publicMethodWithResponseAsync(name, requestOptions); - } - - /** - * The internal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used by both public and internal operation along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> internalWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.internalWithResponseAsync(name, requestOptions); - } - - /** - * The publicMethod operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used by both public and internal operation on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono publicMethod(String name) { - // Generated convenience method for publicMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return publicMethodWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SharedModel.class)); - } - - /** - * The internal operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used by both public and internal operation on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono internal(String name) { - // Generated convenience method for internalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return internalWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SharedModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationClient.java deleted file mode 100644 index b46aea36681..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access; - -import azure.clientgenerator.core.access.implementation.SharedModelInOperationsImpl; -import azure.clientgenerator.core.access.sharedmodelinoperation.models.SharedModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous AccessClient type. - */ -@ServiceClient(builder = AccessClientBuilder.class) -public final class SharedModelInOperationClient { - @Generated - private final SharedModelInOperationsImpl serviceClient; - - /** - * Initializes an instance of SharedModelInOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SharedModelInOperationClient(SharedModelInOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The publicMethod operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used by both public and internal operation along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response publicMethodWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.publicMethodWithResponse(name, requestOptions); - } - - /** - * The internal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used by both public and internal operation along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response internalWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.internalWithResponse(name, requestOptions); - } - - /** - * The publicMethod operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used by both public and internal operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SharedModel publicMethod(String name) { - // Generated convenience method for publicMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return publicMethodWithResponse(name, requestOptions).getValue().toObject(SharedModel.class); - } - - /** - * The internal operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return used by both public and internal operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - SharedModel internal(String name) { - // Generated convenience method for internalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return internalWithResponse(name, requestOptions).getValue().toObject(SharedModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/AccessClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/AccessClientImpl.java deleted file mode 100644 index c0bf3320c78..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/AccessClientImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 AccessClient type. - */ -public final class AccessClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 PublicOperationsImpl object to access its operations. - */ - private final PublicOperationsImpl publicOperations; - - /** - * Gets the PublicOperationsImpl object to access its operations. - * - * @return the PublicOperationsImpl object. - */ - public PublicOperationsImpl getPublicOperations() { - return this.publicOperations; - } - - /** - * The InternalOperationsImpl object to access its operations. - */ - private final InternalOperationsImpl internalOperations; - - /** - * Gets the InternalOperationsImpl object to access its operations. - * - * @return the InternalOperationsImpl object. - */ - public InternalOperationsImpl getInternalOperations() { - return this.internalOperations; - } - - /** - * The SharedModelInOperationsImpl object to access its operations. - */ - private final SharedModelInOperationsImpl sharedModelInOperations; - - /** - * Gets the SharedModelInOperationsImpl object to access its operations. - * - * @return the SharedModelInOperationsImpl object. - */ - public SharedModelInOperationsImpl getSharedModelInOperations() { - return this.sharedModelInOperations; - } - - /** - * The RelativeModelInOperationsImpl object to access its operations. - */ - private final RelativeModelInOperationsImpl relativeModelInOperations; - - /** - * Gets the RelativeModelInOperationsImpl object to access its operations. - * - * @return the RelativeModelInOperationsImpl object. - */ - public RelativeModelInOperationsImpl getRelativeModelInOperations() { - return this.relativeModelInOperations; - } - - /** - * Initializes an instance of AccessClient client. - * - * @param endpoint Service host. - */ - public AccessClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of AccessClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public AccessClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of AccessClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public AccessClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.publicOperations = new PublicOperationsImpl(this); - this.internalOperations = new InternalOperationsImpl(this); - this.sharedModelInOperations = new SharedModelInOperationsImpl(this); - this.relativeModelInOperations = new RelativeModelInOperationsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/InternalOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/InternalOperationsImpl.java deleted file mode 100644 index 0c196872d31..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/InternalOperationsImpl.java +++ /dev/null @@ -1,289 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in InternalOperations. - */ -public final class InternalOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final InternalOperationsService service; - - /** - * The service client containing this operation class. - */ - private final AccessClientImpl client; - - /** - * Initializes an instance of InternalOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - InternalOperationsImpl(AccessClientImpl client) { - this.service = RestProxy.create(InternalOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AccessClientInternalOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AccessClientInternalOperations") - public interface InternalOperationsService { - @Get("/azure/client-generator-core/access/internalOperation/noDecoratorInInternal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> noDecoratorInInternal(@HostParam("endpoint") String endpoint, - @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/access/internalOperation/noDecoratorInInternal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response noDecoratorInInternalSync(@HostParam("endpoint") String endpoint, - @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/access/internalOperation/internalDecoratorInInternal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> internalDecoratorInInternal(@HostParam("endpoint") String endpoint, - @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/access/internalOperation/internalDecoratorInInternal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response internalDecoratorInInternalSync(@HostParam("endpoint") String endpoint, - @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/access/internalOperation/publicDecoratorInInternal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> publicDecoratorInInternal(@HostParam("endpoint") String endpoint, - @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/access/internalOperation/publicDecoratorInInternal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response publicDecoratorInInternalSync(@HostParam("endpoint") String endpoint, - @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * The noDecoratorInInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in an internal operation, should be generated but not exported along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> noDecoratorInInternalWithResponseAsync(String name, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.noDecoratorInInternal(this.client.getEndpoint(), name, accept, requestOptions, context)); - } - - /** - * The noDecoratorInInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in an internal operation, should be generated but not exported along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response noDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.noDecoratorInInternalSync(this.client.getEndpoint(), name, accept, requestOptions, Context.NONE); - } - - /** - * The internalDecoratorInInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in an internal operation, should be generated but not exported along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> internalDecoratorInInternalWithResponseAsync(String name, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.internalDecoratorInInternal(this.client.getEndpoint(), name, - accept, requestOptions, context)); - } - - /** - * The internalDecoratorInInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in an internal operation, should be generated but not exported along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response internalDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.internalDecoratorInInternalSync(this.client.getEndpoint(), name, accept, requestOptions, - Context.NONE); - } - - /** - * The publicDecoratorInInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in an internal operation but with public decorator, should be generated and exported along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> publicDecoratorInInternalWithResponseAsync(String name, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.publicDecoratorInInternal(this.client.getEndpoint(), name, - accept, requestOptions, context)); - } - - /** - * The publicDecoratorInInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in an internal operation but with public decorator, should be generated and exported along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response publicDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.publicDecoratorInInternalSync(this.client.getEndpoint(), name, accept, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/PublicOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/PublicOperationsImpl.java deleted file mode 100644 index 68af0c4ca68..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/PublicOperationsImpl.java +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PublicOperations. - */ -public final class PublicOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PublicOperationsService service; - - /** - * The service client containing this operation class. - */ - private final AccessClientImpl client; - - /** - * Initializes an instance of PublicOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PublicOperationsImpl(AccessClientImpl client) { - this.service - = RestProxy.create(PublicOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AccessClientPublicOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AccessClientPublicOperations") - public interface PublicOperationsService { - @Get("/azure/client-generator-core/access/publicOperation/noDecoratorInPublic") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> noDecoratorInPublic(@HostParam("endpoint") String endpoint, - @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/access/publicOperation/noDecoratorInPublic") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response noDecoratorInPublicSync(@HostParam("endpoint") String endpoint, - @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/access/publicOperation/publicDecoratorInPublic") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> publicDecoratorInPublic(@HostParam("endpoint") String endpoint, - @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/access/publicOperation/publicDecoratorInPublic") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response publicDecoratorInPublicSync(@HostParam("endpoint") String endpoint, - @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * The noDecoratorInPublic operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in a public operation, should be generated and exported along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> noDecoratorInPublicWithResponseAsync(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.noDecoratorInPublic(this.client.getEndpoint(), name, accept, requestOptions, context)); - } - - /** - * The noDecoratorInPublic operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in a public operation, should be generated and exported along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response noDecoratorInPublicWithResponse(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.noDecoratorInPublicSync(this.client.getEndpoint(), name, accept, requestOptions, Context.NONE); - } - - /** - * The publicDecoratorInPublic operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in a public operation, should be generated and exported along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> publicDecoratorInPublicWithResponseAsync(String name, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.publicDecoratorInPublic(this.client.getEndpoint(), name, accept, - requestOptions, context)); - } - - /** - * The publicDecoratorInPublic operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in a public operation, should be generated and exported along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response publicDecoratorInPublicWithResponse(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.publicDecoratorInPublicSync(this.client.getEndpoint(), name, accept, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/RelativeModelInOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/RelativeModelInOperationsImpl.java deleted file mode 100644 index eaaa2943a6b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/RelativeModelInOperationsImpl.java +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in RelativeModelInOperations. - */ -public final class RelativeModelInOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RelativeModelInOperationsService service; - - /** - * The service client containing this operation class. - */ - private final AccessClientImpl client; - - /** - * Initializes an instance of RelativeModelInOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - RelativeModelInOperationsImpl(AccessClientImpl client) { - this.service = RestProxy.create(RelativeModelInOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AccessClientRelativeModelInOperations to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AccessClientRelativeModelInOperations") - public interface RelativeModelInOperationsService { - @Get("/azure/client-generator-core/access/relativeModelInOperation/operation") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> operation(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/access/relativeModelInOperation/operation") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response operationSync(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/access/relativeModelInOperation/discriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> discriminator(@HostParam("endpoint") String endpoint, - @QueryParam("kind") String kind, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/access/relativeModelInOperation/discriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response discriminatorSync(@HostParam("endpoint") String endpoint, @QueryParam("kind") String kind, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * Expected query parameter: name="Madge" - * Expected response body: - * ```json - * { - * "name": "Madge", - * "inner": - * { - * "name": "Madge" - * } - * } - * ```. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     inner (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in internal operations, should be generated but not exported along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> operationWithResponseAsync(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.operation(this.client.getEndpoint(), name, accept, requestOptions, context)); - } - - /** - * Expected query parameter: name="Madge" - * Expected response body: - * ```json - * { - * "name": "Madge", - * "inner": - * { - * "name": "Madge" - * } - * } - * ```. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     inner (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in internal operations, should be generated but not exported along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response operationWithResponse(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.operationSync(this.client.getEndpoint(), name, accept, requestOptions, Context.NONE); - } - - /** - * Expected query parameter: kind="real" - * Expected response body: - * ```json - * { - * "name": "Madge", - * "kind": "real" - * } - * ```. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param kind The kind parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in internal operations, should be generated but not exported along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> discriminatorWithResponseAsync(String kind, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.discriminator(this.client.getEndpoint(), kind, accept, requestOptions, context)); - } - - /** - * Expected query parameter: kind="real" - * Expected response body: - * ```json - * { - * "name": "Madge", - * "kind": "real" - * } - * ```. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param kind The kind parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used in internal operations, should be generated but not exported along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response discriminatorWithResponse(String kind, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.discriminatorSync(this.client.getEndpoint(), kind, accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/SharedModelInOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/SharedModelInOperationsImpl.java deleted file mode 100644 index c8f4ab258a8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/SharedModelInOperationsImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SharedModelInOperations. - */ -public final class SharedModelInOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SharedModelInOperationsService service; - - /** - * The service client containing this operation class. - */ - private final AccessClientImpl client; - - /** - * Initializes an instance of SharedModelInOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SharedModelInOperationsImpl(AccessClientImpl client) { - this.service = RestProxy.create(SharedModelInOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AccessClientSharedModelInOperations to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AccessClientSharedModelInOperations") - public interface SharedModelInOperationsService { - @Get("/azure/client-generator-core/access/sharedModelInOperation/public") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> publicMethod(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/access/sharedModelInOperation/public") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response publicMethodSync(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/access/sharedModelInOperation/internal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> internal(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/access/sharedModelInOperation/internal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response internalSync(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * The publicMethod operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used by both public and internal operation along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> publicMethodWithResponseAsync(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.publicMethod(this.client.getEndpoint(), name, accept, requestOptions, context)); - } - - /** - * The publicMethod operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used by both public and internal operation along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response publicMethodWithResponse(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.publicMethodSync(this.client.getEndpoint(), name, accept, requestOptions, Context.NONE); - } - - /** - * The internal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used by both public and internal operation along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> internalWithResponseAsync(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.internal(this.client.getEndpoint(), name, accept, requestOptions, context)); - } - - /** - * The internal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return used by both public and internal operation along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response internalWithResponse(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.internalSync(this.client.getEndpoint(), name, accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/package-info.java deleted file mode 100644 index 8435d3a9fc1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Access. - * Test for internal decorator. - * - */ -package azure.clientgenerator.core.access.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/InternalDecoratorModelInInternal.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/InternalDecoratorModelInInternal.java deleted file mode 100644 index 342889d164d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/InternalDecoratorModelInInternal.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.internaloperation.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Used in an internal operation, should be generated but not exported. - */ -@Immutable -public final class InternalDecoratorModelInInternal implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of InternalDecoratorModelInInternal class. - * - * @param name the name value to set. - */ - @Generated - private InternalDecoratorModelInInternal(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InternalDecoratorModelInInternal from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InternalDecoratorModelInInternal if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the InternalDecoratorModelInInternal. - */ - @Generated - public static InternalDecoratorModelInInternal fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new InternalDecoratorModelInInternal(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/NoDecoratorModelInInternal.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/NoDecoratorModelInInternal.java deleted file mode 100644 index 0e6708a93df..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/NoDecoratorModelInInternal.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.internaloperation.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Used in an internal operation, should be generated but not exported. - */ -@Immutable -public final class NoDecoratorModelInInternal implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of NoDecoratorModelInInternal class. - * - * @param name the name value to set. - */ - @Generated - private NoDecoratorModelInInternal(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NoDecoratorModelInInternal from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NoDecoratorModelInInternal if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NoDecoratorModelInInternal. - */ - @Generated - public static NoDecoratorModelInInternal fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new NoDecoratorModelInInternal(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/package-info.java deleted file mode 100644 index fa7be66bf74..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Access. - * Test for internal decorator. - * - */ -package azure.clientgenerator.core.access.internaloperation.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/PublicDecoratorModelInInternal.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/PublicDecoratorModelInInternal.java deleted file mode 100644 index 1884f67500d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/PublicDecoratorModelInInternal.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.internaloperation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Used in an internal operation but with public decorator, should be generated and exported. - */ -@Immutable -public final class PublicDecoratorModelInInternal implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of PublicDecoratorModelInInternal class. - * - * @param name the name value to set. - */ - @Generated - private PublicDecoratorModelInInternal(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PublicDecoratorModelInInternal from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PublicDecoratorModelInInternal if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the PublicDecoratorModelInInternal. - */ - @Generated - public static PublicDecoratorModelInInternal fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new PublicDecoratorModelInInternal(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/package-info.java deleted file mode 100644 index 830b72bfb4c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Access. - * Test for internal decorator. - * - */ -package azure.clientgenerator.core.access.internaloperation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/package-info.java deleted file mode 100644 index 4a7d900431a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Access. - * Test for internal decorator. - * - */ -package azure.clientgenerator.core.access; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/NoDecoratorModelInPublic.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/NoDecoratorModelInPublic.java deleted file mode 100644 index 7a6de979768..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/NoDecoratorModelInPublic.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.publicoperation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Used in a public operation, should be generated and exported. - */ -@Immutable -public final class NoDecoratorModelInPublic implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of NoDecoratorModelInPublic class. - * - * @param name the name value to set. - */ - @Generated - private NoDecoratorModelInPublic(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NoDecoratorModelInPublic from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NoDecoratorModelInPublic if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NoDecoratorModelInPublic. - */ - @Generated - public static NoDecoratorModelInPublic fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new NoDecoratorModelInPublic(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/PublicDecoratorModelInPublic.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/PublicDecoratorModelInPublic.java deleted file mode 100644 index 738d5691fb7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/PublicDecoratorModelInPublic.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.publicoperation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Used in a public operation, should be generated and exported. - */ -@Immutable -public final class PublicDecoratorModelInPublic implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of PublicDecoratorModelInPublic class. - * - * @param name the name value to set. - */ - @Generated - private PublicDecoratorModelInPublic(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PublicDecoratorModelInPublic from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PublicDecoratorModelInPublic if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the PublicDecoratorModelInPublic. - */ - @Generated - public static PublicDecoratorModelInPublic fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new PublicDecoratorModelInPublic(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/package-info.java deleted file mode 100644 index e4f02519486..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Access. - * Test for internal decorator. - * - */ -package azure.clientgenerator.core.access.publicoperation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/AbstractModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/AbstractModel.java deleted file mode 100644 index 430239f6ef9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/AbstractModel.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.relativemodelinoperation.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Used in internal operations, should be generated but not exported. - */ -@Immutable -public class AbstractModel implements JsonSerializable { - /* - * Discriminator property for AbstractModel. - */ - @Generated - private String kind = "AbstractModel"; - - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of AbstractModel class. - * - * @param name the name value to set. - */ - @Generated - protected AbstractModel(String name) { - this.name = name; - } - - /** - * Get the kind property: Discriminator property for AbstractModel. - * - * @return the kind value. - */ - @Generated - public String getKind() { - return this.kind; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AbstractModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AbstractModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the AbstractModel. - */ - @Generated - public static AbstractModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("real".equals(discriminatorValue)) { - return RealModel.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static AbstractModel fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - String kind = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - AbstractModel deserializedAbstractModel = new AbstractModel(name); - deserializedAbstractModel.kind = kind; - - return deserializedAbstractModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/BaseModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/BaseModel.java deleted file mode 100644 index b881abcfe67..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/BaseModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.relativemodelinoperation.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Used in internal operations, should be generated but not exported. - */ -@Immutable -public class BaseModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of BaseModel class. - * - * @param name the name value to set. - */ - @Generated - protected BaseModel(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BaseModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BaseModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BaseModel. - */ - @Generated - public static BaseModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new BaseModel(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/InnerModel.java deleted file mode 100644 index 23562827c9d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/InnerModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.relativemodelinoperation.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Used in internal operations, should be generated but not exported. - */ -@Immutable -public final class InnerModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of InnerModel class. - * - * @param name the name value to set. - */ - @Generated - private InnerModel(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InnerModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the InnerModel. - */ - @Generated - public static InnerModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new InnerModel(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/OuterModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/OuterModel.java deleted file mode 100644 index c3033a7968c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/OuterModel.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.relativemodelinoperation.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Used in internal operations, should be generated but not exported. - */ -@Immutable -public final class OuterModel extends BaseModel { - /* - * The inner property. - */ - @Generated - private final InnerModel inner; - - /** - * Creates an instance of OuterModel class. - * - * @param name the name value to set. - * @param inner the inner value to set. - */ - @Generated - private OuterModel(String name, InnerModel inner) { - super(name); - this.inner = inner; - } - - /** - * Get the inner property: The inner property. - * - * @return the inner value. - */ - @Generated - public InnerModel getInner() { - return this.inner; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", getName()); - jsonWriter.writeJsonField("inner", this.inner); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OuterModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OuterModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OuterModel. - */ - @Generated - public static OuterModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - InnerModel inner = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("inner".equals(fieldName)) { - inner = InnerModel.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new OuterModel(name, inner); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/RealModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/RealModel.java deleted file mode 100644 index db88e30c940..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/RealModel.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.relativemodelinoperation.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Used in internal operations, should be generated but not exported. - */ -@Immutable -public final class RealModel extends AbstractModel { - /* - * Discriminator property for AbstractModel. - */ - @Generated - private String kind = "real"; - - /** - * Creates an instance of RealModel class. - * - * @param name the name value to set. - */ - @Generated - private RealModel(String name) { - super(name); - } - - /** - * Get the kind property: Discriminator property for AbstractModel. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", getName()); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of RealModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of RealModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the RealModel. - */ - @Generated - public static RealModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - String kind = "real"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - RealModel deserializedRealModel = new RealModel(name); - deserializedRealModel.kind = kind; - - return deserializedRealModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/package-info.java deleted file mode 100644 index 69624107369..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Access. - * Test for internal decorator. - * - */ -package azure.clientgenerator.core.access.relativemodelinoperation.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/SharedModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/SharedModel.java deleted file mode 100644 index f8f1f32ebb3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/SharedModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.sharedmodelinoperation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Used by both public and internal operation. It should be generated and exported. - */ -@Immutable -public final class SharedModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of SharedModel class. - * - * @param name the name value to set. - */ - @Generated - private SharedModel(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SharedModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SharedModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SharedModel. - */ - @Generated - public static SharedModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new SharedModel(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/package-info.java deleted file mode 100644 index cea72b15ba9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Access. - * Test for internal decorator. - * - */ -package azure.clientgenerator.core.access.sharedmodelinoperation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeAsyncClient.java deleted file mode 100644 index 8d846069a28..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeAsyncClient.java +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.alternatetype; - -import azure.clientgenerator.core.alternatetype.externaltype.models.ModelWithFeatureProperty; -import azure.clientgenerator.core.alternatetype.implementation.ExternalTypesImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.models.GeoObject; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous AlternateTypeClient type. - */ -@ServiceClient(builder = AlternateTypeClientBuilder.class, isAsync = true) -public final class AlternateTypeAsyncClient { - @Generated - private final ExternalTypesImpl serviceClient; - - /** - * Initializes an instance of AlternateTypeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - AlternateTypeAsyncClient(ExternalTypesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     type: String (Required)
-     *     geometry (Required): {
-     *         type: String (Required)
-     *         coordinates (Required): [
-     *             int (Required)
-     *         ]
-     *     }
-     *     properties (Required): {
-     *         String: BinaryData (Required)
-     *     }
-     *     id: BinaryData (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getModelWithResponseAsync(requestOptions); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     type: String (Required)
-     *     geometry (Required): {
-     *         type: String (Required)
-     *         coordinates (Required): [
-     *             int (Required)
-     *         ]
-     *     }
-     *     properties (Required): {
-     *         String: BinaryData (Required)
-     *     }
-     *     id: BinaryData (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putModelWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putModelWithResponseAsync(body, requestOptions); - } - - /** - * The getProperty operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     feature (Required): {
-     *         type: String (Required)
-     *         geometry (Required): {
-     *             type: String (Required)
-     *             coordinates (Required): [
-     *                 int (Required)
-     *             ]
-     *         }
-     *         properties (Required): {
-     *             String: BinaryData (Required)
-     *         }
-     *         id: BinaryData (Optional)
-     *     }
-     *     additionalProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getPropertyWithResponseAsync(requestOptions); - } - - /** - * The putProperty operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     feature (Required): {
-     *         type: String (Required)
-     *         geometry (Required): {
-     *             type: String (Required)
-     *             coordinates (Required): [
-     *                 int (Required)
-     *             ]
-     *         }
-     *         properties (Required): {
-     *             String: BinaryData (Required)
-     *         }
-     *         id: BinaryData (Optional)
-     *     }
-     *     additionalProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putPropertyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putPropertyWithResponseAsync(body, requestOptions); - } - - /** - * The getModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getModel() { - // Generated convenience method for getModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GeoObject.class)); - } - - /** - * The putModel operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putModel(GeoObject body) { - // Generated convenience method for putModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putModelWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getProperty operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getProperty() { - // Generated convenience method for getPropertyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getPropertyWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithFeatureProperty.class)); - } - - /** - * The putProperty operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putProperty(ModelWithFeatureProperty body) { - // Generated convenience method for putPropertyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putPropertyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClient.java deleted file mode 100644 index b5799840f37..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClient.java +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.alternatetype; - -import azure.clientgenerator.core.alternatetype.externaltype.models.ModelWithFeatureProperty; -import azure.clientgenerator.core.alternatetype.implementation.ExternalTypesImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.models.GeoObject; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous AlternateTypeClient type. - */ -@ServiceClient(builder = AlternateTypeClientBuilder.class) -public final class AlternateTypeClient { - @Generated - private final ExternalTypesImpl serviceClient; - - /** - * Initializes an instance of AlternateTypeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - AlternateTypeClient(ExternalTypesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     type: String (Required)
-     *     geometry (Required): {
-     *         type: String (Required)
-     *         coordinates (Required): [
-     *             int (Required)
-     *         ]
-     *     }
-     *     properties (Required): {
-     *         String: BinaryData (Required)
-     *     }
-     *     id: BinaryData (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getModelWithResponse(requestOptions); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     type: String (Required)
-     *     geometry (Required): {
-     *         type: String (Required)
-     *         coordinates (Required): [
-     *             int (Required)
-     *         ]
-     *     }
-     *     properties (Required): {
-     *         String: BinaryData (Required)
-     *     }
-     *     id: BinaryData (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putModelWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putModelWithResponse(body, requestOptions); - } - - /** - * The getProperty operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     feature (Required): {
-     *         type: String (Required)
-     *         geometry (Required): {
-     *             type: String (Required)
-     *             coordinates (Required): [
-     *                 int (Required)
-     *             ]
-     *         }
-     *         properties (Required): {
-     *             String: BinaryData (Required)
-     *         }
-     *         id: BinaryData (Optional)
-     *     }
-     *     additionalProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getPropertyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getPropertyWithResponse(requestOptions); - } - - /** - * The putProperty operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     feature (Required): {
-     *         type: String (Required)
-     *         geometry (Required): {
-     *             type: String (Required)
-     *             coordinates (Required): [
-     *                 int (Required)
-     *             ]
-     *         }
-     *         properties (Required): {
-     *             String: BinaryData (Required)
-     *         }
-     *         id: BinaryData (Optional)
-     *     }
-     *     additionalProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putPropertyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putPropertyWithResponse(body, requestOptions); - } - - /** - * The getModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GeoObject getModel() { - // Generated convenience method for getModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getModelWithResponse(requestOptions).getValue().toObject(GeoObject.class); - } - - /** - * The putModel operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putModel(GeoObject body) { - // Generated convenience method for putModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - putModelWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The getProperty operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ModelWithFeatureProperty getProperty() { - // Generated convenience method for getPropertyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getPropertyWithResponse(requestOptions).getValue().toObject(ModelWithFeatureProperty.class); - } - - /** - * The putProperty operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putProperty(ModelWithFeatureProperty body) { - // Generated convenience method for putPropertyWithResponse - RequestOptions requestOptions = new RequestOptions(); - putPropertyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClientBuilder.java deleted file mode 100644 index 9b234acdf20..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.alternatetype; - -import azure.clientgenerator.core.alternatetype.implementation.AlternateTypeClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the AlternateTypeClient type. - */ -@ServiceClientBuilder(serviceClients = { AlternateTypeClient.class, AlternateTypeAsyncClient.class }) -public final class AlternateTypeClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-alternatetype.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the AlternateTypeClientBuilder. - */ - @Generated - public AlternateTypeClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AlternateTypeClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AlternateTypeClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AlternateTypeClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AlternateTypeClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AlternateTypeClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AlternateTypeClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AlternateTypeClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AlternateTypeClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the AlternateTypeClientBuilder. - */ - @Generated - public AlternateTypeClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of AlternateTypeClientImpl with the provided parameters. - * - * @return an instance of AlternateTypeClientImpl. - */ - @Generated - private AlternateTypeClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - AlternateTypeClientImpl client = new AlternateTypeClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of AlternateTypeAsyncClient class. - * - * @return an instance of AlternateTypeAsyncClient. - */ - @Generated - public AlternateTypeAsyncClient buildAsyncClient() { - return new AlternateTypeAsyncClient(buildInnerClient().getExternalTypes()); - } - - /** - * Builds an instance of AlternateTypeClient class. - * - * @return an instance of AlternateTypeClient. - */ - @Generated - public AlternateTypeClient buildClient() { - return new AlternateTypeClient(buildInnerClient().getExternalTypes()); - } - - private static final ClientLogger LOGGER = new ClientLogger(AlternateTypeClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/ModelWithFeatureProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/ModelWithFeatureProperty.java deleted file mode 100644 index b851de6f226..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/ModelWithFeatureProperty.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.alternatetype.externaltype.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.models.GeoObject; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ModelWithFeatureProperty model. - */ -@Immutable -public final class ModelWithFeatureProperty implements JsonSerializable { - /* - * The feature property. - */ - @Generated - private final GeoObject feature; - - /* - * The additionalProperty property. - */ - @Generated - private final String additionalProperty; - - /** - * Creates an instance of ModelWithFeatureProperty class. - * - * @param feature the feature value to set. - * @param additionalProperty the additionalProperty value to set. - */ - @Generated - public ModelWithFeatureProperty(GeoObject feature, String additionalProperty) { - this.feature = feature; - this.additionalProperty = additionalProperty; - } - - /** - * Get the feature property: The feature property. - * - * @return the feature value. - */ - @Generated - public GeoObject getFeature() { - return this.feature; - } - - /** - * Get the additionalProperty property: The additionalProperty property. - * - * @return the additionalProperty value. - */ - @Generated - public String getAdditionalProperty() { - return this.additionalProperty; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("feature", this.feature); - jsonWriter.writeStringField("additionalProperty", this.additionalProperty); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ModelWithFeatureProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ModelWithFeatureProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ModelWithFeatureProperty. - */ - @Generated - public static ModelWithFeatureProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GeoObject feature = null; - String additionalProperty = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("feature".equals(fieldName)) { - feature = GeoObject.fromJson(reader); - } else if ("additionalProperty".equals(fieldName)) { - additionalProperty = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ModelWithFeatureProperty(feature, additionalProperty); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/package-info.java deleted file mode 100644 index 5c89505dddd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for AlternateType. - * Test for alternate type decorator. - * - */ -package azure.clientgenerator.core.alternatetype.externaltype.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/AlternateTypeClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/AlternateTypeClientImpl.java deleted file mode 100644 index d993353e535..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/AlternateTypeClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.alternatetype.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 AlternateTypeClient type. - */ -public final class AlternateTypeClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 ExternalTypesImpl object to access its operations. - */ - private final ExternalTypesImpl externalTypes; - - /** - * Gets the ExternalTypesImpl object to access its operations. - * - * @return the ExternalTypesImpl object. - */ - public ExternalTypesImpl getExternalTypes() { - return this.externalTypes; - } - - /** - * Initializes an instance of AlternateTypeClient client. - * - * @param endpoint Service host. - */ - public AlternateTypeClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of AlternateTypeClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public AlternateTypeClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of AlternateTypeClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public AlternateTypeClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.externalTypes = new ExternalTypesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/ExternalTypesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/ExternalTypesImpl.java deleted file mode 100644 index 6eb894ad40d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/ExternalTypesImpl.java +++ /dev/null @@ -1,438 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.alternatetype.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExternalTypes. - */ -public final class ExternalTypesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExternalTypesService service; - - /** - * The service client containing this operation class. - */ - private final AlternateTypeClientImpl client; - - /** - * Initializes an instance of ExternalTypesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExternalTypesImpl(AlternateTypeClientImpl client) { - this.service - = RestProxy.create(ExternalTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AlternateTypeClientExternalTypes to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AlternateTypeClientExternalTypes") - public interface ExternalTypesService { - @Get("/azure/client-generator-core/alternate-type/external/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/alternate-type/external/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getModelSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/alternate-type/external/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/alternate-type/external/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/alternate-type/external/property") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getProperty(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/alternate-type/external/property") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getPropertySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/alternate-type/external/property") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putProperty(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/alternate-type/external/property") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putPropertySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     type: String (Required)
-     *     geometry (Required): {
-     *         type: String (Required)
-     *         coordinates (Required): [
-     *             int (Required)
-     *         ]
-     *     }
-     *     properties (Required): {
-     *         String: BinaryData (Required)
-     *     }
-     *     id: BinaryData (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getModelWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getModel(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     type: String (Required)
-     *     geometry (Required): {
-     *         type: String (Required)
-     *         coordinates (Required): [
-     *             int (Required)
-     *         ]
-     *     }
-     *     properties (Required): {
-     *         String: BinaryData (Required)
-     *     }
-     *     id: BinaryData (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getModelWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getModelSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     type: String (Required)
-     *     geometry (Required): {
-     *         type: String (Required)
-     *         coordinates (Required): [
-     *             int (Required)
-     *         ]
-     *     }
-     *     properties (Required): {
-     *         String: BinaryData (Required)
-     *     }
-     *     id: BinaryData (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putModelWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putModel(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     type: String (Required)
-     *     geometry (Required): {
-     *         type: String (Required)
-     *         coordinates (Required): [
-     *             int (Required)
-     *         ]
-     *     }
-     *     properties (Required): {
-     *         String: BinaryData (Required)
-     *     }
-     *     id: BinaryData (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putModelWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putModelSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The getProperty operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     feature (Required): {
-     *         type: String (Required)
-     *         geometry (Required): {
-     *             type: String (Required)
-     *             coordinates (Required): [
-     *                 int (Required)
-     *             ]
-     *         }
-     *         properties (Required): {
-     *             String: BinaryData (Required)
-     *         }
-     *         id: BinaryData (Optional)
-     *     }
-     *     additionalProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPropertyWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getProperty(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getProperty operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     feature (Required): {
-     *         type: String (Required)
-     *         geometry (Required): {
-     *             type: String (Required)
-     *             coordinates (Required): [
-     *                 int (Required)
-     *             ]
-     *         }
-     *         properties (Required): {
-     *             String: BinaryData (Required)
-     *         }
-     *         id: BinaryData (Optional)
-     *     }
-     *     additionalProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getPropertyWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getPropertySync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The putProperty operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     feature (Required): {
-     *         type: String (Required)
-     *         geometry (Required): {
-     *             type: String (Required)
-     *             coordinates (Required): [
-     *                 int (Required)
-     *             ]
-     *         }
-     *         properties (Required): {
-     *             String: BinaryData (Required)
-     *         }
-     *         id: BinaryData (Optional)
-     *     }
-     *     additionalProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putPropertyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putProperty(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The putProperty operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     feature (Required): {
-     *         type: String (Required)
-     *         geometry (Required): {
-     *             type: String (Required)
-     *             coordinates (Required): [
-     *                 int (Required)
-     *             ]
-     *         }
-     *         properties (Required): {
-     *             String: BinaryData (Required)
-     *         }
-     *         id: BinaryData (Optional)
-     *     }
-     *     additionalProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putPropertyWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putPropertySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/package-info.java deleted file mode 100644 index da62eb33b3c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for AlternateType. - * Test for alternate type decorator. - * - */ -package azure.clientgenerator.core.alternatetype.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/package-info.java deleted file mode 100644 index 3eb16e12fde..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for AlternateType. - * Test for alternate type decorator. - * - */ -package azure.clientgenerator.core.alternatetype; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderAsyncClient.java deleted file mode 100644 index 27374c8c535..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.header; - -import azure.clientgenerator.core.apiversion.header.implementation.HeaderClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous HeaderClient type. - */ -@ServiceClient(builder = HeaderClientBuilder.class, isAsync = true) -public final class HeaderAsyncClient { - @Generated - private final HeaderClientImpl serviceClient; - - /** - * Initializes an instance of HeaderAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - HeaderAsyncClient(HeaderClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Header api version parameter. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> headerApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.headerApiVersionWithResponseAsync(requestOptions); - } - - /** - * Header api version parameter. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono headerApiVersion() { - // Generated convenience method for headerApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return headerApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClient.java deleted file mode 100644 index 075eb89c90a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.header; - -import azure.clientgenerator.core.apiversion.header.implementation.HeaderClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous HeaderClient type. - */ -@ServiceClient(builder = HeaderClientBuilder.class) -public final class HeaderClient { - @Generated - private final HeaderClientImpl serviceClient; - - /** - * Initializes an instance of HeaderClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - HeaderClient(HeaderClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Header api version parameter. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response headerApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.headerApiVersionWithResponse(requestOptions); - } - - /** - * Header api version parameter. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void headerApiVersion() { - // Generated convenience method for headerApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - headerApiVersionWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClientBuilder.java deleted file mode 100644 index 0a2426f5383..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClientBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.header; - -import azure.clientgenerator.core.apiversion.header.implementation.HeaderClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the HeaderClient type. - */ -@ServiceClientBuilder(serviceClients = { HeaderClient.class, HeaderAsyncClient.class }) -public final class HeaderClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-apiversion-header.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the HeaderClientBuilder. - */ - @Generated - public HeaderClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private HeaderServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the HeaderClientBuilder. - */ - @Generated - public HeaderClientBuilder serviceVersion(HeaderServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the HeaderClientBuilder. - */ - @Generated - public HeaderClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of HeaderClientImpl with the provided parameters. - * - * @return an instance of HeaderClientImpl. - */ - @Generated - private HeaderClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - HeaderServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : HeaderServiceVersion.getLatest(); - HeaderClientImpl client = new HeaderClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - localEndpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of HeaderAsyncClient class. - * - * @return an instance of HeaderAsyncClient. - */ - @Generated - public HeaderAsyncClient buildAsyncClient() { - return new HeaderAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of HeaderClient class. - * - * @return an instance of HeaderClient. - */ - @Generated - public HeaderClient buildClient() { - return new HeaderClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(HeaderClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderServiceVersion.java deleted file mode 100644 index f1ca4c3f11a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.header; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of HeaderClient. - */ -public enum HeaderServiceVersion implements ServiceVersion { - /** - * Enum value 2025-01-01. - */ - V2025_01_01("2025-01-01"); - - private final String version; - - HeaderServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link HeaderServiceVersion}. - */ - public static HeaderServiceVersion getLatest() { - return V2025_01_01; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/HeaderClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/HeaderClientImpl.java deleted file mode 100644 index 7c1aee01d25..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/HeaderClientImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.header.implementation; - -import azure.clientgenerator.core.apiversion.header.HeaderServiceVersion; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the HeaderClient type. - */ -public final class HeaderClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final HeaderClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final HeaderServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public HeaderServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of HeaderClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public HeaderClientImpl(String endpoint, HeaderServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of HeaderClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public HeaderClientImpl(HttpPipeline httpPipeline, String endpoint, HeaderServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of HeaderClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public HeaderClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - HeaderServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(HeaderClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for HeaderClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "HeaderClient") - public interface HeaderClientService { - @Post("/azure/client-generator-core/api-version/header") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> headerApiVersion(@HostParam("endpoint") String endpoint, - @HeaderParam("x-ms-version") String xMsVersion, RequestOptions requestOptions, Context context); - - @Post("/azure/client-generator-core/api-version/header") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response headerApiVersionSync(@HostParam("endpoint") String endpoint, - @HeaderParam("x-ms-version") String xMsVersion, RequestOptions requestOptions, Context context); - } - - /** - * Header api version parameter. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> headerApiVersionWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.headerApiVersion(this.getEndpoint(), - this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * Header api version parameter. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response headerApiVersionWithResponse(RequestOptions requestOptions) { - return service.headerApiVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/package-info.java deleted file mode 100644 index 6be380c7b87..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Header. - * - */ -package azure.clientgenerator.core.apiversion.header.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/package-info.java deleted file mode 100644 index 0f66241f957..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Header. - * - */ -package azure.clientgenerator.core.apiversion.header; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathAsyncClient.java deleted file mode 100644 index 62e493d3326..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.path; - -import azure.clientgenerator.core.apiversion.path.implementation.PathClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous PathClient type. - */ -@ServiceClient(builder = PathClientBuilder.class, isAsync = true) -public final class PathAsyncClient { - @Generated - private final PathClientImpl serviceClient; - - /** - * Initializes an instance of PathAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathAsyncClient(PathClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Path api version parameter. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> pathApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.pathApiVersionWithResponseAsync(requestOptions); - } - - /** - * Path api version parameter. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono pathApiVersion() { - // Generated convenience method for pathApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return pathApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClient.java deleted file mode 100644 index df2959f55ba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.path; - -import azure.clientgenerator.core.apiversion.path.implementation.PathClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous PathClient type. - */ -@ServiceClient(builder = PathClientBuilder.class) -public final class PathClient { - @Generated - private final PathClientImpl serviceClient; - - /** - * Initializes an instance of PathClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathClient(PathClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Path api version parameter. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response pathApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.pathApiVersionWithResponse(requestOptions); - } - - /** - * Path api version parameter. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void pathApiVersion() { - // Generated convenience method for pathApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - pathApiVersionWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClientBuilder.java deleted file mode 100644 index cb433113811..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClientBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.path; - -import azure.clientgenerator.core.apiversion.path.implementation.PathClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the PathClient type. - */ -@ServiceClientBuilder(serviceClients = { PathClient.class, PathAsyncClient.class }) -public final class PathClientBuilder - implements HttpTrait, ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-apiversion-path.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the PathClientBuilder. - */ - @Generated - public PathClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private PathServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the PathClientBuilder. - */ - @Generated - public PathClientBuilder serviceVersion(PathServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the PathClientBuilder. - */ - @Generated - public PathClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of PathClientImpl with the provided parameters. - * - * @return an instance of PathClientImpl. - */ - @Generated - private PathClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - PathServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : PathServiceVersion.getLatest(); - PathClientImpl client = new PathClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - localEndpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of PathAsyncClient class. - * - * @return an instance of PathAsyncClient. - */ - @Generated - public PathAsyncClient buildAsyncClient() { - return new PathAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of PathClient class. - * - * @return an instance of PathClient. - */ - @Generated - public PathClient buildClient() { - return new PathClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(PathClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathServiceVersion.java deleted file mode 100644 index aecfc2cd07a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.path; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of PathClient. - */ -public enum PathServiceVersion implements ServiceVersion { - /** - * Enum value 2025-01-01. - */ - V2025_01_01("2025-01-01"); - - private final String version; - - PathServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link PathServiceVersion}. - */ - public static PathServiceVersion getLatest() { - return V2025_01_01; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/PathClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/PathClientImpl.java deleted file mode 100644 index af071c6bb43..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/PathClientImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.path.implementation; - -import azure.clientgenerator.core.apiversion.path.PathServiceVersion; -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the PathClient type. - */ -public final class PathClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final PathServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public PathServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of PathClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public PathClientImpl(String endpoint, PathServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of PathClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public PathClientImpl(HttpPipeline httpPipeline, String endpoint, PathServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of PathClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public PathClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - PathServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(PathClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for PathClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "PathClient") - public interface PathClientService { - @Post("/azure/client-generator-core/api-version/path/{version}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> pathApiVersion(@HostParam("endpoint") String endpoint, - @PathParam("version") String version, RequestOptions requestOptions, Context context); - - @Post("/azure/client-generator-core/api-version/path/{version}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response pathApiVersionSync(@HostParam("endpoint") String endpoint, @PathParam("version") String version, - RequestOptions requestOptions, Context context); - } - - /** - * Path api version parameter. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> pathApiVersionWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.pathApiVersion(this.getEndpoint(), - this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * Path api version parameter. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response pathApiVersionWithResponse(RequestOptions requestOptions) { - return service.pathApiVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/package-info.java deleted file mode 100644 index 208c8607ea9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Path. - * - */ -package azure.clientgenerator.core.apiversion.path.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/package-info.java deleted file mode 100644 index 85af30d1325..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Path. - * - */ -package azure.clientgenerator.core.apiversion.path; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryAsyncClient.java deleted file mode 100644 index 4d9415c6410..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.query; - -import azure.clientgenerator.core.apiversion.query.implementation.QueryClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous QueryClient type. - */ -@ServiceClient(builder = QueryClientBuilder.class, isAsync = true) -public final class QueryAsyncClient { - @Generated - private final QueryClientImpl serviceClient; - - /** - * Initializes an instance of QueryAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryAsyncClient(QueryClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Query api version parameter. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> queryApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.queryApiVersionWithResponseAsync(requestOptions); - } - - /** - * Query api version parameter. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono queryApiVersion() { - // Generated convenience method for queryApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return queryApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClient.java deleted file mode 100644 index 38ecc492f87..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.query; - -import azure.clientgenerator.core.apiversion.query.implementation.QueryClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous QueryClient type. - */ -@ServiceClient(builder = QueryClientBuilder.class) -public final class QueryClient { - @Generated - private final QueryClientImpl serviceClient; - - /** - * Initializes an instance of QueryClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryClient(QueryClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Query api version parameter. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response queryApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.queryApiVersionWithResponse(requestOptions); - } - - /** - * Query api version parameter. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void queryApiVersion() { - // Generated convenience method for queryApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - queryApiVersionWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClientBuilder.java deleted file mode 100644 index e5de8523aaf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClientBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.query; - -import azure.clientgenerator.core.apiversion.query.implementation.QueryClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the QueryClient type. - */ -@ServiceClientBuilder(serviceClients = { QueryClient.class, QueryAsyncClient.class }) -public final class QueryClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-apiversion-query.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the QueryClientBuilder. - */ - @Generated - public QueryClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public QueryClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public QueryClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public QueryClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public QueryClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public QueryClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public QueryClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public QueryClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public QueryClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private QueryServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the QueryClientBuilder. - */ - @Generated - public QueryClientBuilder serviceVersion(QueryServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the QueryClientBuilder. - */ - @Generated - public QueryClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of QueryClientImpl with the provided parameters. - * - * @return an instance of QueryClientImpl. - */ - @Generated - private QueryClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - QueryServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : QueryServiceVersion.getLatest(); - QueryClientImpl client = new QueryClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - localEndpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of QueryAsyncClient class. - * - * @return an instance of QueryAsyncClient. - */ - @Generated - public QueryAsyncClient buildAsyncClient() { - return new QueryAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of QueryClient class. - * - * @return an instance of QueryClient. - */ - @Generated - public QueryClient buildClient() { - return new QueryClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(QueryClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryServiceVersion.java deleted file mode 100644 index a8d1379b75c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.query; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of QueryClient. - */ -public enum QueryServiceVersion implements ServiceVersion { - /** - * Enum value 2025-01-01. - */ - V2025_01_01("2025-01-01"); - - private final String version; - - QueryServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link QueryServiceVersion}. - */ - public static QueryServiceVersion getLatest() { - return V2025_01_01; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/QueryClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/QueryClientImpl.java deleted file mode 100644 index f36a3da09c4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/QueryClientImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.query.implementation; - -import azure.clientgenerator.core.apiversion.query.QueryServiceVersion; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the QueryClient type. - */ -public final class QueryClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final QueryClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final QueryServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public QueryServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of QueryClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public QueryClientImpl(String endpoint, QueryServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of QueryClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public QueryClientImpl(HttpPipeline httpPipeline, String endpoint, QueryServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of QueryClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public QueryClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - QueryServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(QueryClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for QueryClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "QueryClient") - public interface QueryClientService { - @Post("/azure/client-generator-core/api-version/query") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> queryApiVersion(@HostParam("endpoint") String endpoint, - @QueryParam("version") String version, RequestOptions requestOptions, Context context); - - @Post("/azure/client-generator-core/api-version/query") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response queryApiVersionSync(@HostParam("endpoint") String endpoint, - @QueryParam("version") String version, RequestOptions requestOptions, Context context); - } - - /** - * Query api version parameter. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> queryApiVersionWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.queryApiVersion(this.getEndpoint(), - this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * Query api version parameter. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response queryApiVersionWithResponse(RequestOptions requestOptions) { - return service.queryApiVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/package-info.java deleted file mode 100644 index 4a074856c8c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Query. - * - */ -package azure.clientgenerator.core.apiversion.query.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/package-info.java deleted file mode 100644 index 61fe05283f8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Query. - * - */ -package azure.clientgenerator.core.apiversion.query; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamAsyncClient.java deleted file mode 100644 index 539b2d5456d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamAsyncClient.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.HeaderParamClientImpl; -import azure.clientgenerator.core.clientinitialization.models.Input; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous HeaderParamClient type. - */ -@ServiceClient(builder = HeaderParamClientBuilder.class, isAsync = true) -public final class HeaderParamAsyncClient { - @Generated - private final HeaderParamClientImpl serviceClient; - - /** - * Initializes an instance of HeaderParamAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - HeaderParamAsyncClient(HeaderParamClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withQuery operation. - * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryWithResponse(String id, RequestOptions requestOptions) { - return this.serviceClient.withQueryWithResponseAsync(id, requestOptions); - } - - /** - * The withBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withBodyWithResponseAsync(body, requestOptions); - } - - /** - * The withQuery operation. - * - * @param id The id parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withQuery(String id) { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withQueryWithResponse(id, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withBody operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withBody(Input body) { - // Generated convenience method for withBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClient.java deleted file mode 100644 index 4bbcd7e8365..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClient.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.HeaderParamClientImpl; -import azure.clientgenerator.core.clientinitialization.models.Input; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous HeaderParamClient type. - */ -@ServiceClient(builder = HeaderParamClientBuilder.class) -public final class HeaderParamClient { - @Generated - private final HeaderParamClientImpl serviceClient; - - /** - * Initializes an instance of HeaderParamClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - HeaderParamClient(HeaderParamClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withQuery operation. - * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryWithResponse(String id, RequestOptions requestOptions) { - return this.serviceClient.withQueryWithResponse(id, requestOptions); - } - - /** - * The withBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withBodyWithResponse(body, requestOptions); - } - - /** - * The withQuery operation. - * - * @param id The id parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withQuery(String id) { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - withQueryWithResponse(id, requestOptions).getValue(); - } - - /** - * The withBody operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withBody(Input body) { - // Generated convenience method for withBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - withBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClientBuilder.java deleted file mode 100644 index 31137851e48..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.HeaderParamClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the HeaderParamClient type. - */ -@ServiceClientBuilder(serviceClients = { HeaderParamClient.class, HeaderParamAsyncClient.class }) -public final class HeaderParamClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the HeaderParamClientBuilder. - */ - @Generated - public HeaderParamClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderParamClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderParamClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderParamClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderParamClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderParamClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderParamClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderParamClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HeaderParamClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * - */ - @Generated - private String name; - - /** - * Sets. - * - * @param name the name value. - * @return the HeaderParamClientBuilder. - */ - @Generated - public HeaderParamClientBuilder name(String name) { - this.name = name; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the HeaderParamClientBuilder. - */ - @Generated - public HeaderParamClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of HeaderParamClientImpl with the provided parameters. - * - * @return an instance of HeaderParamClientImpl. - */ - @Generated - private HeaderParamClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - HeaderParamClientImpl client = new HeaderParamClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, this.name); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(name, "'name' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of HeaderParamAsyncClient class. - * - * @return an instance of HeaderParamAsyncClient. - */ - @Generated - public HeaderParamAsyncClient buildAsyncClient() { - return new HeaderParamAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of HeaderParamClient class. - * - * @return an instance of HeaderParamClient. - */ - @Generated - public HeaderParamClient buildClient() { - return new HeaderParamClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(HeaderParamClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsAsyncClient.java deleted file mode 100644 index 04a316639b8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsAsyncClient.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.MixedParamsClientImpl; -import azure.clientgenerator.core.clientinitialization.models.WithBodyRequest; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous MixedParamsClient type. - */ -@ServiceClient(builder = MixedParamsClientBuilder.class, isAsync = true) -public final class MixedParamsAsyncClient { - @Generated - private final MixedParamsClientImpl serviceClient; - - /** - * Initializes an instance of MixedParamsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MixedParamsAsyncClient(MixedParamsClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withQuery operation. - * - * @param region The region parameter. - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryWithResponse(String region, String id, RequestOptions requestOptions) { - return this.serviceClient.withQueryWithResponseAsync(region, id, requestOptions); - } - - /** - * The withBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param region The region parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withBodyWithResponse(String region, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withBodyWithResponseAsync(region, body, requestOptions); - } - - /** - * The withQuery operation. - * - * @param region The region parameter. - * @param id The id parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withQuery(String region, String id) { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withQueryWithResponse(region, id, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withBody operation. - * - * @param region The region parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withBody(String region, WithBodyRequest body) { - // Generated convenience method for withBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withBodyWithResponse(region, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClient.java deleted file mode 100644 index 7ab664776b7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClient.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.MixedParamsClientImpl; -import azure.clientgenerator.core.clientinitialization.models.WithBodyRequest; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous MixedParamsClient type. - */ -@ServiceClient(builder = MixedParamsClientBuilder.class) -public final class MixedParamsClient { - @Generated - private final MixedParamsClientImpl serviceClient; - - /** - * Initializes an instance of MixedParamsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MixedParamsClient(MixedParamsClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withQuery operation. - * - * @param region The region parameter. - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryWithResponse(String region, String id, RequestOptions requestOptions) { - return this.serviceClient.withQueryWithResponse(region, id, requestOptions); - } - - /** - * The withBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param region The region parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withBodyWithResponse(String region, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withBodyWithResponse(region, body, requestOptions); - } - - /** - * The withQuery operation. - * - * @param region The region parameter. - * @param id The id parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withQuery(String region, String id) { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - withQueryWithResponse(region, id, requestOptions).getValue(); - } - - /** - * The withBody operation. - * - * @param region The region parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withBody(String region, WithBodyRequest body) { - // Generated convenience method for withBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - withBodyWithResponse(region, BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClientBuilder.java deleted file mode 100644 index 7ce96535235..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.MixedParamsClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the MixedParamsClient type. - */ -@ServiceClientBuilder(serviceClients = { MixedParamsClient.class, MixedParamsAsyncClient.class }) -public final class MixedParamsClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the MixedParamsClientBuilder. - */ - @Generated - public MixedParamsClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MixedParamsClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MixedParamsClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MixedParamsClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MixedParamsClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MixedParamsClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MixedParamsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MixedParamsClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MixedParamsClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * - */ - @Generated - private String name; - - /** - * Sets. - * - * @param name the name value. - * @return the MixedParamsClientBuilder. - */ - @Generated - public MixedParamsClientBuilder name(String name) { - this.name = name; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the MixedParamsClientBuilder. - */ - @Generated - public MixedParamsClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of MixedParamsClientImpl with the provided parameters. - * - * @return an instance of MixedParamsClientImpl. - */ - @Generated - private MixedParamsClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - MixedParamsClientImpl client = new MixedParamsClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, this.name); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(name, "'name' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of MixedParamsAsyncClient class. - * - * @return an instance of MixedParamsAsyncClient. - */ - @Generated - public MixedParamsAsyncClient buildAsyncClient() { - return new MixedParamsAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of MixedParamsClient class. - * - * @return an instance of MixedParamsClient. - */ - @Generated - public MixedParamsClient buildClient() { - return new MixedParamsClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(MixedParamsClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsAsyncClient.java deleted file mode 100644 index fffad715e02..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsAsyncClient.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.MultipleParamsClientImpl; -import azure.clientgenerator.core.clientinitialization.models.Input; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous MultipleParamsClient type. - */ -@ServiceClient(builder = MultipleParamsClientBuilder.class, isAsync = true) -public final class MultipleParamsAsyncClient { - @Generated - private final MultipleParamsClientImpl serviceClient; - - /** - * Initializes an instance of MultipleParamsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MultipleParamsAsyncClient(MultipleParamsClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withQuery operation. - * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryWithResponse(String id, RequestOptions requestOptions) { - return this.serviceClient.withQueryWithResponseAsync(id, requestOptions); - } - - /** - * The withBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withBodyWithResponseAsync(body, requestOptions); - } - - /** - * The withQuery operation. - * - * @param id The id parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withQuery(String id) { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withQueryWithResponse(id, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withBody operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withBody(Input body) { - // Generated convenience method for withBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClient.java deleted file mode 100644 index 99729267707..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClient.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.MultipleParamsClientImpl; -import azure.clientgenerator.core.clientinitialization.models.Input; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous MultipleParamsClient type. - */ -@ServiceClient(builder = MultipleParamsClientBuilder.class) -public final class MultipleParamsClient { - @Generated - private final MultipleParamsClientImpl serviceClient; - - /** - * Initializes an instance of MultipleParamsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MultipleParamsClient(MultipleParamsClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withQuery operation. - * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryWithResponse(String id, RequestOptions requestOptions) { - return this.serviceClient.withQueryWithResponse(id, requestOptions); - } - - /** - * The withBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withBodyWithResponse(body, requestOptions); - } - - /** - * The withQuery operation. - * - * @param id The id parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withQuery(String id) { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - withQueryWithResponse(id, requestOptions).getValue(); - } - - /** - * The withBody operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withBody(Input body) { - // Generated convenience method for withBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - withBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClientBuilder.java deleted file mode 100644 index c448d71678b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClientBuilder.java +++ /dev/null @@ -1,326 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.MultipleParamsClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the MultipleParamsClient type. - */ -@ServiceClientBuilder(serviceClients = { MultipleParamsClient.class, MultipleParamsAsyncClient.class }) -public final class MultipleParamsClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the MultipleParamsClientBuilder. - */ - @Generated - public MultipleParamsClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleParamsClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleParamsClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleParamsClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleParamsClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleParamsClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleParamsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleParamsClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleParamsClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * - */ - @Generated - private String name; - - /** - * Sets. - * - * @param name the name value. - * @return the MultipleParamsClientBuilder. - */ - @Generated - public MultipleParamsClientBuilder name(String name) { - this.name = name; - return this; - } - - /* - * - */ - @Generated - private String region; - - /** - * Sets. - * - * @param region the region value. - * @return the MultipleParamsClientBuilder. - */ - @Generated - public MultipleParamsClientBuilder region(String region) { - this.region = region; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the MultipleParamsClientBuilder. - */ - @Generated - public MultipleParamsClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of MultipleParamsClientImpl with the provided parameters. - * - * @return an instance of MultipleParamsClientImpl. - */ - @Generated - private MultipleParamsClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - MultipleParamsClientImpl client = new MultipleParamsClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, this.name, this.region); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(name, "'name' cannot be null."); - Objects.requireNonNull(region, "'region' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of MultipleParamsAsyncClient class. - * - * @return an instance of MultipleParamsAsyncClient. - */ - @Generated - public MultipleParamsAsyncClient buildAsyncClient() { - return new MultipleParamsAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of MultipleParamsClient class. - * - * @return an instance of MultipleParamsClient. - */ - @Generated - public MultipleParamsClient buildClient() { - return new MultipleParamsClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(MultipleParamsClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasAsyncClient.java deleted file mode 100644 index d15937a219a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasAsyncClient.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.ParamAliasClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ParamAliasClient type. - */ -@ServiceClient(builder = ParamAliasClientBuilder.class, isAsync = true) -public final class ParamAliasAsyncClient { - @Generated - private final ParamAliasClientImpl serviceClient; - - /** - * Initializes an instance of ParamAliasAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ParamAliasAsyncClient(ParamAliasClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withAliasedName operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAliasedNameWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withAliasedNameWithResponseAsync(requestOptions); - } - - /** - * The withOriginalName operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withOriginalNameWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withOriginalNameWithResponseAsync(requestOptions); - } - - /** - * The withAliasedName operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withAliasedName() { - // Generated convenience method for withAliasedNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withAliasedNameWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withOriginalName operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withOriginalName() { - // Generated convenience method for withOriginalNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withOriginalNameWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClient.java deleted file mode 100644 index c373ba582a2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClient.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.ParamAliasClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ParamAliasClient type. - */ -@ServiceClient(builder = ParamAliasClientBuilder.class) -public final class ParamAliasClient { - @Generated - private final ParamAliasClientImpl serviceClient; - - /** - * Initializes an instance of ParamAliasClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ParamAliasClient(ParamAliasClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withAliasedName operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAliasedNameWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withAliasedNameWithResponse(requestOptions); - } - - /** - * The withOriginalName operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withOriginalNameWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withOriginalNameWithResponse(requestOptions); - } - - /** - * The withAliasedName operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withAliasedName() { - // Generated convenience method for withAliasedNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - withAliasedNameWithResponse(requestOptions).getValue(); - } - - /** - * The withOriginalName operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withOriginalName() { - // Generated convenience method for withOriginalNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - withOriginalNameWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClientBuilder.java deleted file mode 100644 index fb31bfe1980..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.ParamAliasClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ParamAliasClient type. - */ -@ServiceClientBuilder(serviceClients = { ParamAliasClient.class, ParamAliasAsyncClient.class }) -public final class ParamAliasClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ParamAliasClientBuilder. - */ - @Generated - public ParamAliasClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParamAliasClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParamAliasClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParamAliasClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParamAliasClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParamAliasClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParamAliasClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParamAliasClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParamAliasClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * - */ - @Generated - private String blobName; - - /** - * Sets. - * - * @param blobName the blobName value. - * @return the ParamAliasClientBuilder. - */ - @Generated - public ParamAliasClientBuilder blobName(String blobName) { - this.blobName = blobName; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ParamAliasClientBuilder. - */ - @Generated - public ParamAliasClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ParamAliasClientImpl with the provided parameters. - * - * @return an instance of ParamAliasClientImpl. - */ - @Generated - private ParamAliasClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ParamAliasClientImpl client = new ParamAliasClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, this.blobName); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(blobName, "'blobName' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ParamAliasAsyncClient class. - * - * @return an instance of ParamAliasAsyncClient. - */ - @Generated - public ParamAliasAsyncClient buildAsyncClient() { - return new ParamAliasAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ParamAliasClient class. - * - * @return an instance of ParamAliasClient. - */ - @Generated - public ParamAliasClient buildClient() { - return new ParamAliasClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ParamAliasClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamAsyncClient.java deleted file mode 100644 index c62b4f90bf3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamAsyncClient.java +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.PathParamClientImpl; -import azure.clientgenerator.core.clientinitialization.models.BlobProperties; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous PathParamClient type. - */ -@ServiceClient(builder = PathParamClientBuilder.class, isAsync = true) -public final class PathParamAsyncClient { - @Generated - private final PathParamClientImpl serviceClient; - - /** - * Initializes an instance of PathParamAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParamAsyncClient(PathParamClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withQuery operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withQueryWithResponseAsync(requestOptions); - } - - /** - * The getStandalone operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     size: long (Required)
-     *     contentType: String (Required)
-     *     createdOn: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return properties of a blob along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getStandaloneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getStandaloneWithResponseAsync(requestOptions); - } - - /** - * The deleteStandalone operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteStandaloneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.deleteStandaloneWithResponseAsync(requestOptions); - } - - /** - * The withQuery operation. - * - * @param format The format parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withQuery(String format) { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (format != null) { - requestOptions.addQueryParam("format", format, false); - } - return withQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withQuery operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withQuery() { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getStandalone operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return properties of a blob on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getStandalone() { - // Generated convenience method for getStandaloneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getStandaloneWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BlobProperties.class)); - } - - /** - * The deleteStandalone operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteStandalone() { - // Generated convenience method for deleteStandaloneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return deleteStandaloneWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClient.java deleted file mode 100644 index c724e68662b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClient.java +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.PathParamClientImpl; -import azure.clientgenerator.core.clientinitialization.models.BlobProperties; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous PathParamClient type. - */ -@ServiceClient(builder = PathParamClientBuilder.class) -public final class PathParamClient { - @Generated - private final PathParamClientImpl serviceClient; - - /** - * Initializes an instance of PathParamClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParamClient(PathParamClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withQuery operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withQueryWithResponse(requestOptions); - } - - /** - * The getStandalone operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     size: long (Required)
-     *     contentType: String (Required)
-     *     createdOn: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return properties of a blob along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getStandaloneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getStandaloneWithResponse(requestOptions); - } - - /** - * The deleteStandalone operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteStandaloneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.deleteStandaloneWithResponse(requestOptions); - } - - /** - * The withQuery operation. - * - * @param format The format parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withQuery(String format) { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (format != null) { - requestOptions.addQueryParam("format", format, false); - } - withQueryWithResponse(requestOptions).getValue(); - } - - /** - * The withQuery operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withQuery() { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - withQueryWithResponse(requestOptions).getValue(); - } - - /** - * The getStandalone operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return properties of a blob. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BlobProperties getStandalone() { - // Generated convenience method for getStandaloneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getStandaloneWithResponse(requestOptions).getValue().toObject(BlobProperties.class); - } - - /** - * The deleteStandalone operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteStandalone() { - // Generated convenience method for deleteStandaloneWithResponse - RequestOptions requestOptions = new RequestOptions(); - deleteStandaloneWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClientBuilder.java deleted file mode 100644 index 59ec31c7f38..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization; - -import azure.clientgenerator.core.clientinitialization.implementation.PathParamClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the PathParamClient type. - */ -@ServiceClientBuilder(serviceClients = { PathParamClient.class, PathParamAsyncClient.class }) -public final class PathParamClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the PathParamClientBuilder. - */ - @Generated - public PathParamClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathParamClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathParamClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathParamClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathParamClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathParamClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathParamClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathParamClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathParamClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * - */ - @Generated - private String blobName; - - /** - * Sets. - * - * @param blobName the blobName value. - * @return the PathParamClientBuilder. - */ - @Generated - public PathParamClientBuilder blobName(String blobName) { - this.blobName = blobName; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the PathParamClientBuilder. - */ - @Generated - public PathParamClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of PathParamClientImpl with the provided parameters. - * - * @return an instance of PathParamClientImpl. - */ - @Generated - private PathParamClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - PathParamClientImpl client = new PathParamClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, this.blobName); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(blobName, "'blobName' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of PathParamAsyncClient class. - * - * @return an instance of PathParamAsyncClient. - */ - @Generated - public PathParamAsyncClient buildAsyncClient() { - return new PathParamAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of PathParamClient class. - * - * @return an instance of PathParamClient. - */ - @Generated - public PathParamClient buildClient() { - return new PathParamClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(PathParamClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ChildClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ChildClientImpl.java deleted file mode 100644 index d7d09acf4c2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ChildClientImpl.java +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.implementation; - -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the ChildClient type. - */ -public final class ChildClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ChildClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - */ - private final String blobName; - - /** - * Gets. - * - * @return the blobName value. - */ - public String getBlobName() { - return this.blobName; - } - - /** - * 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; - } - - /** - * Initializes an instance of ChildClient client. - * - * @param endpoint Service host. - * @param blobName - */ - public ChildClientImpl(String endpoint, String blobName) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, blobName); - } - - /** - * Initializes an instance of ChildClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param blobName - */ - public ChildClientImpl(HttpPipeline httpPipeline, String endpoint, String blobName) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, blobName); - } - - /** - * Initializes an instance of ChildClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param blobName - */ - public ChildClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - String blobName) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.blobName = blobName; - this.service = RestProxy.create(ChildClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ChildClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ChildClient") - public interface ChildClientService { - @Get("/azure/client-generator-core/client-initialization/child-client/{blobName}/with-query") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withQuery(@HostParam("endpoint") String endpoint, @PathParam("blobName") String blobName, - RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/client-initialization/child-client/{blobName}/with-query") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withQuerySync(@HostParam("endpoint") String endpoint, @PathParam("blobName") String blobName, - RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/client-initialization/child-client/{blobName}/get-standalone") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getStandalone(@HostParam("endpoint") String endpoint, - @PathParam("blobName") String blobName, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/client-initialization/child-client/{blobName}/get-standalone") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getStandaloneSync(@HostParam("endpoint") String endpoint, - @PathParam("blobName") String blobName, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Delete("/azure/client-generator-core/client-initialization/child-client/{blobName}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> deleteStandalone(@HostParam("endpoint") String endpoint, - @PathParam("blobName") String blobName, RequestOptions requestOptions, Context context); - - @Delete("/azure/client-generator-core/client-initialization/child-client/{blobName}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteStandaloneSync(@HostParam("endpoint") String endpoint, - @PathParam("blobName") String blobName, RequestOptions requestOptions, Context context); - } - - /** - * The withQuery operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withQuery(this.getEndpoint(), this.getBlobName(), requestOptions, context)); - } - - /** - * The withQuery operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryWithResponse(RequestOptions requestOptions) { - return service.withQuerySync(this.getEndpoint(), this.getBlobName(), requestOptions, Context.NONE); - } - - /** - * The getStandalone operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     size: long (Required)
-     *     contentType: String (Required)
-     *     createdOn: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return properties of a blob along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getStandaloneWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getStandalone(this.getEndpoint(), this.getBlobName(), accept, requestOptions, context)); - } - - /** - * The getStandalone operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     size: long (Required)
-     *     contentType: String (Required)
-     *     createdOn: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return properties of a blob along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getStandaloneWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getStandaloneSync(this.getEndpoint(), this.getBlobName(), accept, requestOptions, Context.NONE); - } - - /** - * The deleteStandalone operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteStandaloneWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.deleteStandalone(this.getEndpoint(), this.getBlobName(), requestOptions, context)); - } - - /** - * The deleteStandalone operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteStandaloneWithResponse(RequestOptions requestOptions) { - return service.deleteStandaloneSync(this.getEndpoint(), this.getBlobName(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/HeaderParamClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/HeaderParamClientImpl.java deleted file mode 100644 index 6f6d472bfb7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/HeaderParamClientImpl.java +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the HeaderParamClient type. - */ -public final class HeaderParamClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final HeaderParamClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - */ - private final String name; - - /** - * Gets. - * - * @return the name value. - */ - public String getName() { - return this.name; - } - - /** - * 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; - } - - /** - * Initializes an instance of HeaderParamClient client. - * - * @param endpoint Service host. - * @param name - */ - public HeaderParamClientImpl(String endpoint, String name) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name); - } - - /** - * Initializes an instance of HeaderParamClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param name - */ - public HeaderParamClientImpl(HttpPipeline httpPipeline, String endpoint, String name) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name); - } - - /** - * Initializes an instance of HeaderParamClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param name - */ - public HeaderParamClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - String name) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.name = name; - this.service = RestProxy.create(HeaderParamClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for HeaderParamClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "HeaderParamClient") - public interface HeaderParamClientService { - @Get("/azure/client-generator-core/client-initialization/header-param/with-query") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withQuery(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, - @QueryParam("id") String id, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/client-initialization/header-param/with-query") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withQuerySync(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, - @QueryParam("id") String id, RequestOptions requestOptions, Context context); - - @Post("/azure/client-generator-core/client-initialization/header-param/with-body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withBody(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/azure/client-generator-core/client-initialization/header-param/with-body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withBodySync(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The withQuery operation. - * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryWithResponseAsync(String id, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withQuery(this.getEndpoint(), this.getName(), id, requestOptions, context)); - } - - /** - * The withQuery operation. - * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryWithResponse(String id, RequestOptions requestOptions) { - return service.withQuerySync(this.getEndpoint(), this.getName(), id, requestOptions, Context.NONE); - } - - /** - * The withBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withBodyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.withBody(this.getEndpoint(), this.getName(), contentType, body, - requestOptions, context)); - } - - /** - * The withBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withBodySync(this.getEndpoint(), this.getName(), contentType, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MixedParamsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MixedParamsClientImpl.java deleted file mode 100644 index 0c38becf5c3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MixedParamsClientImpl.java +++ /dev/null @@ -1,279 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the MixedParamsClient type. - */ -public final class MixedParamsClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MixedParamsClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - */ - private final String name; - - /** - * Gets. - * - * @return the name value. - */ - public String getName() { - return this.name; - } - - /** - * 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; - } - - /** - * Initializes an instance of MixedParamsClient client. - * - * @param endpoint Service host. - * @param name - */ - public MixedParamsClientImpl(String endpoint, String name) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name); - } - - /** - * Initializes an instance of MixedParamsClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param name - */ - public MixedParamsClientImpl(HttpPipeline httpPipeline, String endpoint, String name) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name); - } - - /** - * Initializes an instance of MixedParamsClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param name - */ - public MixedParamsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - String name) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.name = name; - this.service = RestProxy.create(MixedParamsClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for MixedParamsClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MixedParamsClient") - public interface MixedParamsClientService { - @Get("/azure/client-generator-core/client-initialization/mixed-params/with-query") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withQuery(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, - @QueryParam("region") String region, @QueryParam("id") String id, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/client-initialization/mixed-params/with-query") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withQuerySync(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, - @QueryParam("region") String region, @QueryParam("id") String id, RequestOptions requestOptions, - Context context); - - @Post("/azure/client-generator-core/client-initialization/mixed-params/with-body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withBody(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, - @QueryParam("region") String region, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/azure/client-generator-core/client-initialization/mixed-params/with-body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withBodySync(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, - @QueryParam("region") String region, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The withQuery operation. - * - * @param region The region parameter. - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryWithResponseAsync(String region, String id, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withQuery(this.getEndpoint(), this.getName(), region, id, requestOptions, context)); - } - - /** - * The withQuery operation. - * - * @param region The region parameter. - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryWithResponse(String region, String id, RequestOptions requestOptions) { - return service.withQuerySync(this.getEndpoint(), this.getName(), region, id, requestOptions, Context.NONE); - } - - /** - * The withBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param region The region parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withBodyWithResponseAsync(String region, BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.withBody(this.getEndpoint(), this.getName(), region, contentType, - body, requestOptions, context)); - } - - /** - * The withBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param region The region parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withBodyWithResponse(String region, BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withBodySync(this.getEndpoint(), this.getName(), region, contentType, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MultipleParamsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MultipleParamsClientImpl.java deleted file mode 100644 index f3f2e5d8a24..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MultipleParamsClientImpl.java +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the MultipleParamsClient type. - */ -public final class MultipleParamsClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MultipleParamsClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - */ - private final String name; - - /** - * Gets. - * - * @return the name value. - */ - public String getName() { - return this.name; - } - - /** - */ - private final String region; - - /** - * Gets. - * - * @return the region value. - */ - public String getRegion() { - return this.region; - } - - /** - * 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; - } - - /** - * Initializes an instance of MultipleParamsClient client. - * - * @param endpoint Service host. - * @param name - * @param region - */ - public MultipleParamsClientImpl(String endpoint, String name, String region) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name, region); - } - - /** - * Initializes an instance of MultipleParamsClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param name - * @param region - */ - public MultipleParamsClientImpl(HttpPipeline httpPipeline, String endpoint, String name, String region) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name, region); - } - - /** - * Initializes an instance of MultipleParamsClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param name - * @param region - */ - public MultipleParamsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - String name, String region) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.name = name; - this.region = region; - this.service - = RestProxy.create(MultipleParamsClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for MultipleParamsClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MultipleParamsClient") - public interface MultipleParamsClientService { - @Get("/azure/client-generator-core/client-initialization/multiple-params/with-query") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withQuery(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, - @QueryParam("region") String region, @QueryParam("id") String id, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/client-initialization/multiple-params/with-query") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withQuerySync(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, - @QueryParam("region") String region, @QueryParam("id") String id, RequestOptions requestOptions, - Context context); - - @Post("/azure/client-generator-core/client-initialization/multiple-params/with-body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withBody(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, - @QueryParam("region") String region, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/azure/client-generator-core/client-initialization/multiple-params/with-body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withBodySync(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, - @QueryParam("region") String region, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The withQuery operation. - * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryWithResponseAsync(String id, RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.withQuery(this.getEndpoint(), this.getName(), this.getRegion(), - id, requestOptions, context)); - } - - /** - * The withQuery operation. - * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryWithResponse(String id, RequestOptions requestOptions) { - return service.withQuerySync(this.getEndpoint(), this.getName(), this.getRegion(), id, requestOptions, - Context.NONE); - } - - /** - * The withBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withBodyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.withBody(this.getEndpoint(), this.getName(), this.getRegion(), - contentType, body, requestOptions, context)); - } - - /** - * The withBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withBodySync(this.getEndpoint(), this.getName(), this.getRegion(), contentType, body, - requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParamAliasClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParamAliasClientImpl.java deleted file mode 100644 index 0c1d58cfbce..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParamAliasClientImpl.java +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the ParamAliasClient type. - */ -public final class ParamAliasClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ParamAliasClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - */ - private final String blobName; - - /** - * Gets. - * - * @return the blobName value. - */ - public String getBlobName() { - return this.blobName; - } - - /** - * 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; - } - - /** - * Initializes an instance of ParamAliasClient client. - * - * @param endpoint Service host. - * @param blobName - */ - public ParamAliasClientImpl(String endpoint, String blobName) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, blobName); - } - - /** - * Initializes an instance of ParamAliasClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param blobName - */ - public ParamAliasClientImpl(HttpPipeline httpPipeline, String endpoint, String blobName) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, blobName); - } - - /** - * Initializes an instance of ParamAliasClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param blobName - */ - public ParamAliasClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - String blobName) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.blobName = blobName; - this.service = RestProxy.create(ParamAliasClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ParamAliasClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ParamAliasClient") - public interface ParamAliasClientService { - @Get("/azure/client-generator-core/client-initialization/param-alias/{blob}/with-aliased-name") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withAliasedName(@HostParam("endpoint") String endpoint, @PathParam("blob") String blobName, - RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/client-initialization/param-alias/{blob}/with-aliased-name") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withAliasedNameSync(@HostParam("endpoint") String endpoint, @PathParam("blob") String blobName, - RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/client-initialization/param-alias/{blobName}/with-original-name") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withOriginalName(@HostParam("endpoint") String endpoint, - @PathParam("blobName") String blobName, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/client-initialization/param-alias/{blobName}/with-original-name") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withOriginalNameSync(@HostParam("endpoint") String endpoint, - @PathParam("blobName") String blobName, RequestOptions requestOptions, Context context); - } - - /** - * The withAliasedName operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAliasedNameWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withAliasedName(this.getEndpoint(), this.getBlobName(), requestOptions, context)); - } - - /** - * The withAliasedName operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAliasedNameWithResponse(RequestOptions requestOptions) { - return service.withAliasedNameSync(this.getEndpoint(), this.getBlobName(), requestOptions, Context.NONE); - } - - /** - * The withOriginalName operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withOriginalNameWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withOriginalName(this.getEndpoint(), this.getBlobName(), requestOptions, context)); - } - - /** - * The withOriginalName operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withOriginalNameWithResponse(RequestOptions requestOptions) { - return service.withOriginalNameSync(this.getEndpoint(), this.getBlobName(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParentClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParentClientImpl.java deleted file mode 100644 index fc97d0a752e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParentClientImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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; -import java.util.Objects; - -/** - * Initializes a new instance of the ParentClient type. - */ -public final class ParentClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of ParentClient client. - * - * @param endpoint Service host. - */ - public ParentClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ParentClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ParentClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ParentClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ParentClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - } - - /** - * Gets an instance of ChildClientImpl class. - * - * @param blobName The blobName parameter. - * @return an instance of ChildClientImpl class. - */ - public ChildClientImpl getChildClient(String blobName) { - Objects.requireNonNull(blobName, "'blobName' cannot be null."); - return new ChildClientImpl(httpPipeline, serializerAdapter, endpoint, blobName); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/PathParamClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/PathParamClientImpl.java deleted file mode 100644 index 7fd730e5700..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/PathParamClientImpl.java +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.implementation; - -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the PathParamClient type. - */ -public final class PathParamClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathParamClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - */ - private final String blobName; - - /** - * Gets. - * - * @return the blobName value. - */ - public String getBlobName() { - return this.blobName; - } - - /** - * 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; - } - - /** - * Initializes an instance of PathParamClient client. - * - * @param endpoint Service host. - * @param blobName - */ - public PathParamClientImpl(String endpoint, String blobName) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, blobName); - } - - /** - * Initializes an instance of PathParamClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param blobName - */ - public PathParamClientImpl(HttpPipeline httpPipeline, String endpoint, String blobName) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, blobName); - } - - /** - * Initializes an instance of PathParamClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param blobName - */ - public PathParamClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - String blobName) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.blobName = blobName; - this.service = RestProxy.create(PathParamClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for PathParamClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "PathParamClient") - public interface PathParamClientService { - @Get("/azure/client-generator-core/client-initialization/path/{blobName}/with-query") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withQuery(@HostParam("endpoint") String endpoint, @PathParam("blobName") String blobName, - RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/client-initialization/path/{blobName}/with-query") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withQuerySync(@HostParam("endpoint") String endpoint, @PathParam("blobName") String blobName, - RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/client-initialization/path/{blobName}/get-standalone") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getStandalone(@HostParam("endpoint") String endpoint, - @PathParam("blobName") String blobName, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/client-initialization/path/{blobName}/get-standalone") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getStandaloneSync(@HostParam("endpoint") String endpoint, - @PathParam("blobName") String blobName, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Delete("/azure/client-generator-core/client-initialization/path/{blobName}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> deleteStandalone(@HostParam("endpoint") String endpoint, - @PathParam("blobName") String blobName, RequestOptions requestOptions, Context context); - - @Delete("/azure/client-generator-core/client-initialization/path/{blobName}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteStandaloneSync(@HostParam("endpoint") String endpoint, - @PathParam("blobName") String blobName, RequestOptions requestOptions, Context context); - } - - /** - * The withQuery operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withQuery(this.getEndpoint(), this.getBlobName(), requestOptions, context)); - } - - /** - * The withQuery operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryWithResponse(RequestOptions requestOptions) { - return service.withQuerySync(this.getEndpoint(), this.getBlobName(), requestOptions, Context.NONE); - } - - /** - * The getStandalone operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     size: long (Required)
-     *     contentType: String (Required)
-     *     createdOn: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return properties of a blob along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getStandaloneWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getStandalone(this.getEndpoint(), this.getBlobName(), accept, requestOptions, context)); - } - - /** - * The getStandalone operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     size: long (Required)
-     *     contentType: String (Required)
-     *     createdOn: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return properties of a blob along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getStandaloneWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getStandaloneSync(this.getEndpoint(), this.getBlobName(), accept, requestOptions, Context.NONE); - } - - /** - * The deleteStandalone operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteStandaloneWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.deleteStandalone(this.getEndpoint(), this.getBlobName(), requestOptions, context)); - } - - /** - * The deleteStandalone operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteStandaloneWithResponse(RequestOptions requestOptions) { - return service.deleteStandaloneSync(this.getEndpoint(), this.getBlobName(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/package-info.java deleted file mode 100644 index b43dea52e01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Service. - * Test for client initialization decorator - moving parameters from method to client level. - * - */ -package azure.clientgenerator.core.clientinitialization.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/BlobProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/BlobProperties.java deleted file mode 100644 index 06b73553c8d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/BlobProperties.java +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; - -/** - * Properties of a blob. - */ -@Immutable -public final class BlobProperties implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The size property. - */ - @Generated - private final long size; - - /* - * The contentType property. - */ - @Generated - private final String contentType; - - /* - * The createdOn property. - */ - @Generated - private final OffsetDateTime createdOn; - - /** - * Creates an instance of BlobProperties class. - * - * @param name the name value to set. - * @param size the size value to set. - * @param contentType the contentType value to set. - * @param createdOn the createdOn value to set. - */ - @Generated - private BlobProperties(String name, long size, String contentType, OffsetDateTime createdOn) { - this.name = name; - this.size = size; - this.contentType = contentType; - this.createdOn = createdOn; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the size property: The size property. - * - * @return the size value. - */ - @Generated - public long getSize() { - return this.size; - } - - /** - * Get the contentType property: The contentType property. - * - * @return the contentType value. - */ - @Generated - public String getContentType() { - return this.contentType; - } - - /** - * Get the createdOn property: The createdOn property. - * - * @return the createdOn value. - */ - @Generated - public OffsetDateTime getCreatedOn() { - return this.createdOn; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeLongField("size", this.size); - jsonWriter.writeStringField("contentType", this.contentType); - jsonWriter.writeStringField("createdOn", - this.createdOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdOn)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BlobProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BlobProperties if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BlobProperties. - */ - @Generated - public static BlobProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - long size = 0L; - String contentType = null; - OffsetDateTime createdOn = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("size".equals(fieldName)) { - size = reader.getLong(); - } else if ("contentType".equals(fieldName)) { - contentType = reader.getString(); - } else if ("createdOn".equals(fieldName)) { - createdOn = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new BlobProperties(name, size, contentType, createdOn); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/Input.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/Input.java deleted file mode 100644 index 3b0429b115c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/Input.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Input model. - */ -@Immutable -public final class Input implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Input class. - * - * @param name the name value to set. - */ - @Generated - public Input(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Input from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Input if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Input. - */ - @Generated - public static Input fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Input(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/WithBodyRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/WithBodyRequest.java deleted file mode 100644 index f8ff0870726..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/WithBodyRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The WithBodyRequest model. - */ -@Immutable -public final class WithBodyRequest implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of WithBodyRequest class. - * - * @param name the name value to set. - */ - @Generated - public WithBodyRequest(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of WithBodyRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of WithBodyRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the WithBodyRequest. - */ - @Generated - public static WithBodyRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new WithBodyRequest(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/package-info.java deleted file mode 100644 index c2c747b3cf2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Service. - * Test for client initialization decorator - moving parameters from method to client level. - * - */ -package azure.clientgenerator.core.clientinitialization.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/package-info.java deleted file mode 100644 index daa49ebd2d7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Service. - * Test for client initialization decorator - moving parameters from method to client level. - * - */ -package azure.clientgenerator.core.clientinitialization; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildAsyncClient.java deleted file mode 100644 index 9c7040e5860..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildAsyncClient.java +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.parentclient; - -import azure.clientgenerator.core.clientinitialization.implementation.ChildClientImpl; -import azure.clientgenerator.core.clientinitialization.models.BlobProperties; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ChildClient type. - */ -@ServiceClient(builder = ChildClientBuilder.class, isAsync = true) -public final class ChildAsyncClient { - @Generated - private final ChildClientImpl serviceClient; - - /** - * Initializes an instance of ChildAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ChildAsyncClient(ChildClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withQuery operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withQueryWithResponseAsync(requestOptions); - } - - /** - * The getStandalone operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     size: long (Required)
-     *     contentType: String (Required)
-     *     createdOn: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return properties of a blob along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getStandaloneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getStandaloneWithResponseAsync(requestOptions); - } - - /** - * The deleteStandalone operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteStandaloneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.deleteStandaloneWithResponseAsync(requestOptions); - } - - /** - * The withQuery operation. - * - * @param format The format parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withQuery(String format) { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (format != null) { - requestOptions.addQueryParam("format", format, false); - } - return withQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withQuery operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withQuery() { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getStandalone operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return properties of a blob on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getStandalone() { - // Generated convenience method for getStandaloneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getStandaloneWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BlobProperties.class)); - } - - /** - * The deleteStandalone operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteStandalone() { - // Generated convenience method for deleteStandaloneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return deleteStandaloneWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClient.java deleted file mode 100644 index 305cf7f8fc1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClient.java +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.parentclient; - -import azure.clientgenerator.core.clientinitialization.implementation.ChildClientImpl; -import azure.clientgenerator.core.clientinitialization.models.BlobProperties; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous ChildClient type. - */ -@ServiceClient(builder = ChildClientBuilder.class) -public final class ChildClient { - @Generated - private final ChildClientImpl serviceClient; - - /** - * Initializes an instance of ChildClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ChildClient(ChildClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withQuery operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withQueryWithResponse(requestOptions); - } - - /** - * The getStandalone operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     size: long (Required)
-     *     contentType: String (Required)
-     *     createdOn: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return properties of a blob along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getStandaloneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getStandaloneWithResponse(requestOptions); - } - - /** - * The deleteStandalone operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteStandaloneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.deleteStandaloneWithResponse(requestOptions); - } - - /** - * The withQuery operation. - * - * @param format The format parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withQuery(String format) { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (format != null) { - requestOptions.addQueryParam("format", format, false); - } - withQueryWithResponse(requestOptions).getValue(); - } - - /** - * The withQuery operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withQuery() { - // Generated convenience method for withQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - withQueryWithResponse(requestOptions).getValue(); - } - - /** - * The getStandalone operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return properties of a blob. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BlobProperties getStandalone() { - // Generated convenience method for getStandaloneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getStandaloneWithResponse(requestOptions).getValue().toObject(BlobProperties.class); - } - - /** - * The deleteStandalone operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteStandalone() { - // Generated convenience method for deleteStandaloneWithResponse - RequestOptions requestOptions = new RequestOptions(); - deleteStandaloneWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClientBuilder.java deleted file mode 100644 index 17c2d148691..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.parentclient; - -import azure.clientgenerator.core.clientinitialization.implementation.ChildClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ChildClient type. - */ -@ServiceClientBuilder(serviceClients = { ChildClient.class, ChildAsyncClient.class }) -public final class ChildClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ChildClientBuilder. - */ - @Generated - public ChildClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ChildClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ChildClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ChildClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ChildClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ChildClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ChildClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ChildClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ChildClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * - */ - @Generated - private String blobName; - - /** - * Sets. - * - * @param blobName the blobName value. - * @return the ChildClientBuilder. - */ - @Generated - public ChildClientBuilder blobName(String blobName) { - this.blobName = blobName; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ChildClientBuilder. - */ - @Generated - public ChildClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ChildClientImpl with the provided parameters. - * - * @return an instance of ChildClientImpl. - */ - @Generated - private ChildClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ChildClientImpl client = new ChildClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - localEndpoint, this.blobName); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(blobName, "'blobName' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ChildAsyncClient class. - * - * @return an instance of ChildAsyncClient. - */ - @Generated - public ChildAsyncClient buildAsyncClient() { - return new ChildAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ChildClient class. - * - * @return an instance of ChildClient. - */ - @Generated - public ChildClient buildClient() { - return new ChildClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ChildClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentAsyncClient.java deleted file mode 100644 index 773affee93b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentAsyncClient.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.parentclient; - -import azure.clientgenerator.core.clientinitialization.implementation.ParentClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClient; - -/** - * Initializes a new instance of the asynchronous ParentClient type. - */ -@ServiceClient(builder = ParentClientBuilder.class, isAsync = true) -public final class ParentAsyncClient { - @Generated - private final ParentClientImpl serviceClient; - - /** - * Initializes an instance of ParentAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ParentAsyncClient(ParentClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Gets an instance of ChildAsyncClient class. - * - * @param blobName The blobName parameter. - * @return an instance of ChildAsyncClient class. - */ - public ChildAsyncClient getChildAsyncClient(String blobName) { - return new ChildAsyncClient(serviceClient.getChildClient(blobName)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClient.java deleted file mode 100644 index a0f775904cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClient.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.parentclient; - -import azure.clientgenerator.core.clientinitialization.implementation.ParentClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClient; - -/** - * Initializes a new instance of the synchronous ParentClient type. - */ -@ServiceClient(builder = ParentClientBuilder.class) -public final class ParentClient { - @Generated - private final ParentClientImpl serviceClient; - - /** - * Initializes an instance of ParentClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ParentClient(ParentClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Gets an instance of ChildClient class. - * - * @param blobName The blobName parameter. - * @return an instance of ChildClient class. - */ - public ChildClient getChildClient(String blobName) { - return new ChildClient(serviceClient.getChildClient(blobName)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClientBuilder.java deleted file mode 100644 index cba227f9fba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.parentclient; - -import azure.clientgenerator.core.clientinitialization.implementation.ParentClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ParentClient type. - */ -@ServiceClientBuilder(serviceClients = { ParentClient.class, ParentAsyncClient.class }) -public final class ParentClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ParentClientBuilder. - */ - @Generated - public ParentClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParentClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParentClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParentClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParentClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParentClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParentClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParentClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ParentClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ParentClientBuilder. - */ - @Generated - public ParentClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ParentClientImpl with the provided parameters. - * - * @return an instance of ParentClientImpl. - */ - @Generated - private ParentClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ParentClientImpl client - = new ParentClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ParentAsyncClient class. - * - * @return an instance of ParentAsyncClient. - */ - @Generated - public ParentAsyncClient buildAsyncClient() { - return new ParentAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ParentClient class. - * - * @return an instance of ParentClient. - */ - @Generated - public ParentClient buildClient() { - return new ParentClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ParentClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/package-info.java deleted file mode 100644 index 2eb62c2e3d9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ChildClient. - * Test for client initialization decorator - moving parameters from method to client level. - * - */ -package azure.clientgenerator.core.clientinitialization.parentclient; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsAsyncClient.java deleted file mode 100644 index 704dcc2088a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.ArchiveOperationsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) -public final class ArchiveOperationsAsyncClient { - @Generated - private final ArchiveOperationsImpl serviceClient; - - /** - * Initializes an instance of ArchiveOperationsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ArchiveOperationsAsyncClient(ArchiveOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The archiveProduct operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> archiveProductWithResponse(RequestOptions requestOptions) { - return this.serviceClient.archiveProductWithResponseAsync(requestOptions); - } - - /** - * The archiveProduct operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono archiveProduct() { - // Generated convenience method for archiveProductWithResponse - RequestOptions requestOptions = new RequestOptions(); - return archiveProductWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsClient.java deleted file mode 100644 index 8523ce49892..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.ArchiveOperationsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class) -public final class ArchiveOperationsClient { - @Generated - private final ArchiveOperationsImpl serviceClient; - - /** - * Initializes an instance of ArchiveOperationsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ArchiveOperationsClient(ArchiveOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The archiveProduct operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response archiveProductWithResponse(RequestOptions requestOptions) { - return this.serviceClient.archiveProductWithResponse(requestOptions); - } - - /** - * The archiveProduct operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void archiveProduct() { - // Generated convenience method for archiveProductWithResponse - RequestOptions requestOptions = new RequestOptions(); - archiveProductWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationAsyncClient.java deleted file mode 100644 index 668979b60f9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.ClientLocationClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) -public final class ClientLocationAsyncClient { - @Generated - private final ClientLocationClientImpl serviceClient; - - /** - * Initializes an instance of ClientLocationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ClientLocationAsyncClient(ClientLocationClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getHealthStatus operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getHealthStatusWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getHealthStatusWithResponseAsync(requestOptions); - } - - /** - * The getHealthStatus operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getHealthStatus() { - // Generated convenience method for getHealthStatusWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getHealthStatusWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClient.java deleted file mode 100644 index d8fb1cd5337..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.ClientLocationClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class) -public final class ClientLocationClient { - @Generated - private final ClientLocationClientImpl serviceClient; - - /** - * Initializes an instance of ClientLocationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ClientLocationClient(ClientLocationClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getHealthStatus operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getHealthStatusWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getHealthStatusWithResponse(requestOptions); - } - - /** - * The getHealthStatus operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void getHealthStatus() { - // Generated convenience method for getHealthStatusWithResponse - RequestOptions requestOptions = new RequestOptions(); - getHealthStatusWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClientBuilder.java deleted file mode 100644 index 0a7ac21a2a3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClientBuilder.java +++ /dev/null @@ -1,445 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.ClientLocationClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ClientLocationClient type. - */ -@ServiceClientBuilder( - serviceClients = { - ClientLocationClient.class, - MoveToExistingSubAdminOperationsClient.class, - MoveToExistingSubUserOperationsClient.class, - MoveToNewSubProductOperationsClient.class, - MoveToRootResourceOperationsClient.class, - MoveMethodParameterToBlobOperationsClient.class, - ArchiveOperationsClient.class, - ClientLocationAsyncClient.class, - MoveToExistingSubAdminOperationsAsyncClient.class, - MoveToExistingSubUserOperationsAsyncClient.class, - MoveToNewSubProductOperationsAsyncClient.class, - MoveToRootResourceOperationsAsyncClient.class, - MoveMethodParameterToBlobOperationsAsyncClient.class, - ArchiveOperationsAsyncClient.class }) -public final class ClientLocationClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-clientlocation.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ClientLocationClientBuilder. - */ - @Generated - public ClientLocationClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientLocationClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientLocationClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientLocationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientLocationClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientLocationClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientLocationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientLocationClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientLocationClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * - */ - @Generated - private String storageAccount; - - /** - * Sets. - * - * @param storageAccount the storageAccount value. - * @return the ClientLocationClientBuilder. - */ - @Generated - public ClientLocationClientBuilder storageAccount(String storageAccount) { - this.storageAccount = storageAccount; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ClientLocationClientBuilder. - */ - @Generated - public ClientLocationClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ClientLocationClientImpl with the provided parameters. - * - * @return an instance of ClientLocationClientImpl. - */ - @Generated - private ClientLocationClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ClientLocationClientImpl client = new ClientLocationClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, this.storageAccount); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(storageAccount, "'storageAccount' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ClientLocationAsyncClient class. - * - * @return an instance of ClientLocationAsyncClient. - */ - @Generated - public ClientLocationAsyncClient buildAsyncClient() { - return new ClientLocationAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of MoveToExistingSubAdminOperationsAsyncClient class. - * - * @return an instance of MoveToExistingSubAdminOperationsAsyncClient. - */ - @Generated - public MoveToExistingSubAdminOperationsAsyncClient buildMoveToExistingSubAdminOperationsAsyncClient() { - return new MoveToExistingSubAdminOperationsAsyncClient( - buildInnerClient().getMoveToExistingSubAdminOperations()); - } - - /** - * Builds an instance of MoveToExistingSubUserOperationsAsyncClient class. - * - * @return an instance of MoveToExistingSubUserOperationsAsyncClient. - */ - @Generated - public MoveToExistingSubUserOperationsAsyncClient buildMoveToExistingSubUserOperationsAsyncClient() { - return new MoveToExistingSubUserOperationsAsyncClient(buildInnerClient().getMoveToExistingSubUserOperations()); - } - - /** - * Builds an instance of MoveToNewSubProductOperationsAsyncClient class. - * - * @return an instance of MoveToNewSubProductOperationsAsyncClient. - */ - @Generated - public MoveToNewSubProductOperationsAsyncClient buildMoveToNewSubProductOperationsAsyncClient() { - return new MoveToNewSubProductOperationsAsyncClient(buildInnerClient().getMoveToNewSubProductOperations()); - } - - /** - * Builds an instance of MoveToRootResourceOperationsAsyncClient class. - * - * @return an instance of MoveToRootResourceOperationsAsyncClient. - */ - @Generated - public MoveToRootResourceOperationsAsyncClient buildMoveToRootResourceOperationsAsyncClient() { - return new MoveToRootResourceOperationsAsyncClient(buildInnerClient().getMoveToRootResourceOperations()); - } - - /** - * Builds an instance of MoveMethodParameterToBlobOperationsAsyncClient class. - * - * @return an instance of MoveMethodParameterToBlobOperationsAsyncClient. - */ - @Generated - public MoveMethodParameterToBlobOperationsAsyncClient buildMoveMethodParameterToBlobOperationsAsyncClient() { - return new MoveMethodParameterToBlobOperationsAsyncClient( - buildInnerClient().getMoveMethodParameterToBlobOperations()); - } - - /** - * Builds an instance of ArchiveOperationsAsyncClient class. - * - * @return an instance of ArchiveOperationsAsyncClient. - */ - @Generated - public ArchiveOperationsAsyncClient buildArchiveOperationsAsyncClient() { - return new ArchiveOperationsAsyncClient(buildInnerClient().getArchiveOperations()); - } - - /** - * Builds an instance of ClientLocationClient class. - * - * @return an instance of ClientLocationClient. - */ - @Generated - public ClientLocationClient buildClient() { - return new ClientLocationClient(buildInnerClient()); - } - - /** - * Builds an instance of MoveToExistingSubAdminOperationsClient class. - * - * @return an instance of MoveToExistingSubAdminOperationsClient. - */ - @Generated - public MoveToExistingSubAdminOperationsClient buildMoveToExistingSubAdminOperationsClient() { - return new MoveToExistingSubAdminOperationsClient(buildInnerClient().getMoveToExistingSubAdminOperations()); - } - - /** - * Builds an instance of MoveToExistingSubUserOperationsClient class. - * - * @return an instance of MoveToExistingSubUserOperationsClient. - */ - @Generated - public MoveToExistingSubUserOperationsClient buildMoveToExistingSubUserOperationsClient() { - return new MoveToExistingSubUserOperationsClient(buildInnerClient().getMoveToExistingSubUserOperations()); - } - - /** - * Builds an instance of MoveToNewSubProductOperationsClient class. - * - * @return an instance of MoveToNewSubProductOperationsClient. - */ - @Generated - public MoveToNewSubProductOperationsClient buildMoveToNewSubProductOperationsClient() { - return new MoveToNewSubProductOperationsClient(buildInnerClient().getMoveToNewSubProductOperations()); - } - - /** - * Builds an instance of MoveToRootResourceOperationsClient class. - * - * @return an instance of MoveToRootResourceOperationsClient. - */ - @Generated - public MoveToRootResourceOperationsClient buildMoveToRootResourceOperationsClient() { - return new MoveToRootResourceOperationsClient(buildInnerClient().getMoveToRootResourceOperations()); - } - - /** - * Builds an instance of MoveMethodParameterToBlobOperationsClient class. - * - * @return an instance of MoveMethodParameterToBlobOperationsClient. - */ - @Generated - public MoveMethodParameterToBlobOperationsClient buildMoveMethodParameterToBlobOperationsClient() { - return new MoveMethodParameterToBlobOperationsClient( - buildInnerClient().getMoveMethodParameterToBlobOperations()); - } - - /** - * Builds an instance of ArchiveOperationsClient class. - * - * @return an instance of ArchiveOperationsClient. - */ - @Generated - public ArchiveOperationsClient buildArchiveOperationsClient() { - return new ArchiveOperationsClient(buildInnerClient().getArchiveOperations()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ClientLocationClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsAsyncClient.java deleted file mode 100644 index 5e91ff5f4c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsAsyncClient.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.MoveMethodParameterToBlobOperationsImpl; -import azure.clientgenerator.core.clientlocation.movemethodparametertoclient.models.Blob; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) -public final class MoveMethodParameterToBlobOperationsAsyncClient { - @Generated - private final MoveMethodParameterToBlobOperationsImpl serviceClient; - - /** - * Initializes an instance of MoveMethodParameterToBlobOperationsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MoveMethodParameterToBlobOperationsAsyncClient(MoveMethodParameterToBlobOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getBlob operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     size: int (Required)
-     *     path: String (Required)
-     * }
-     * }
-     * 
- * - * @param container The container parameter. - * @param blob The blob parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getBlobWithResponse(String container, String blob, - RequestOptions requestOptions) { - return this.serviceClient.getBlobWithResponseAsync(container, blob, requestOptions); - } - - /** - * The getBlob operation. - * - * @param container The container parameter. - * @param blob The blob parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getBlob(String container, String blob) { - // Generated convenience method for getBlobWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getBlobWithResponse(container, blob, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Blob.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsClient.java deleted file mode 100644 index 4e22ce39cde..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsClient.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.MoveMethodParameterToBlobOperationsImpl; -import azure.clientgenerator.core.clientlocation.movemethodparametertoclient.models.Blob; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class) -public final class MoveMethodParameterToBlobOperationsClient { - @Generated - private final MoveMethodParameterToBlobOperationsImpl serviceClient; - - /** - * Initializes an instance of MoveMethodParameterToBlobOperationsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MoveMethodParameterToBlobOperationsClient(MoveMethodParameterToBlobOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getBlob operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     size: int (Required)
-     *     path: String (Required)
-     * }
-     * }
-     * 
- * - * @param container The container parameter. - * @param blob The blob parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getBlobWithResponse(String container, String blob, RequestOptions requestOptions) { - return this.serviceClient.getBlobWithResponse(container, blob, requestOptions); - } - - /** - * The getBlob operation. - * - * @param container The container parameter. - * @param blob The blob parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Blob getBlob(String container, String blob) { - // Generated convenience method for getBlobWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getBlobWithResponse(container, blob, requestOptions).getValue().toObject(Blob.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsAsyncClient.java deleted file mode 100644 index 0b8f5b68f08..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsAsyncClient.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.MoveToExistingSubAdminOperationsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) -public final class MoveToExistingSubAdminOperationsAsyncClient { - @Generated - private final MoveToExistingSubAdminOperationsImpl serviceClient; - - /** - * Initializes an instance of MoveToExistingSubAdminOperationsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MoveToExistingSubAdminOperationsAsyncClient(MoveToExistingSubAdminOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getAdminInfo operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAdminInfoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAdminInfoWithResponseAsync(requestOptions); - } - - /** - * The deleteUser operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteUserWithResponse(RequestOptions requestOptions) { - return this.serviceClient.deleteUserWithResponseAsync(requestOptions); - } - - /** - * The getAdminInfo operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAdminInfo() { - // Generated convenience method for getAdminInfoWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAdminInfoWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The deleteUser operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteUser() { - // Generated convenience method for deleteUserWithResponse - RequestOptions requestOptions = new RequestOptions(); - return deleteUserWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsClient.java deleted file mode 100644 index 7341dd9d9c4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsClient.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.MoveToExistingSubAdminOperationsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class) -public final class MoveToExistingSubAdminOperationsClient { - @Generated - private final MoveToExistingSubAdminOperationsImpl serviceClient; - - /** - * Initializes an instance of MoveToExistingSubAdminOperationsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MoveToExistingSubAdminOperationsClient(MoveToExistingSubAdminOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getAdminInfo operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAdminInfoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAdminInfoWithResponse(requestOptions); - } - - /** - * The deleteUser operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteUserWithResponse(RequestOptions requestOptions) { - return this.serviceClient.deleteUserWithResponse(requestOptions); - } - - /** - * The getAdminInfo operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void getAdminInfo() { - // Generated convenience method for getAdminInfoWithResponse - RequestOptions requestOptions = new RequestOptions(); - getAdminInfoWithResponse(requestOptions).getValue(); - } - - /** - * The deleteUser operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteUser() { - // Generated convenience method for deleteUserWithResponse - RequestOptions requestOptions = new RequestOptions(); - deleteUserWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsAsyncClient.java deleted file mode 100644 index 05ac9a7aa29..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.MoveToExistingSubUserOperationsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) -public final class MoveToExistingSubUserOperationsAsyncClient { - @Generated - private final MoveToExistingSubUserOperationsImpl serviceClient; - - /** - * Initializes an instance of MoveToExistingSubUserOperationsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MoveToExistingSubUserOperationsAsyncClient(MoveToExistingSubUserOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getUser operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getUserWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getUserWithResponseAsync(requestOptions); - } - - /** - * The getUser operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getUser() { - // Generated convenience method for getUserWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getUserWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsClient.java deleted file mode 100644 index 9110b923029..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.MoveToExistingSubUserOperationsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class) -public final class MoveToExistingSubUserOperationsClient { - @Generated - private final MoveToExistingSubUserOperationsImpl serviceClient; - - /** - * Initializes an instance of MoveToExistingSubUserOperationsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MoveToExistingSubUserOperationsClient(MoveToExistingSubUserOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getUser operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getUserWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getUserWithResponse(requestOptions); - } - - /** - * The getUser operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void getUser() { - // Generated convenience method for getUserWithResponse - RequestOptions requestOptions = new RequestOptions(); - getUserWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsAsyncClient.java deleted file mode 100644 index 3b107568da7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.MoveToNewSubProductOperationsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) -public final class MoveToNewSubProductOperationsAsyncClient { - @Generated - private final MoveToNewSubProductOperationsImpl serviceClient; - - /** - * Initializes an instance of MoveToNewSubProductOperationsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MoveToNewSubProductOperationsAsyncClient(MoveToNewSubProductOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The listProducts operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listProductsWithResponse(RequestOptions requestOptions) { - return this.serviceClient.listProductsWithResponseAsync(requestOptions); - } - - /** - * The listProducts operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono listProducts() { - // Generated convenience method for listProductsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return listProductsWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsClient.java deleted file mode 100644 index dc42847624b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.MoveToNewSubProductOperationsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class) -public final class MoveToNewSubProductOperationsClient { - @Generated - private final MoveToNewSubProductOperationsImpl serviceClient; - - /** - * Initializes an instance of MoveToNewSubProductOperationsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MoveToNewSubProductOperationsClient(MoveToNewSubProductOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The listProducts operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listProductsWithResponse(RequestOptions requestOptions) { - return this.serviceClient.listProductsWithResponse(requestOptions); - } - - /** - * The listProducts operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void listProducts() { - // Generated convenience method for listProductsWithResponse - RequestOptions requestOptions = new RequestOptions(); - listProductsWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsAsyncClient.java deleted file mode 100644 index f650251c67b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.MoveToRootResourceOperationsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) -public final class MoveToRootResourceOperationsAsyncClient { - @Generated - private final MoveToRootResourceOperationsImpl serviceClient; - - /** - * Initializes an instance of MoveToRootResourceOperationsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MoveToRootResourceOperationsAsyncClient(MoveToRootResourceOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getResource operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getResourceWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getResourceWithResponseAsync(requestOptions); - } - - /** - * The getResource operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getResource() { - // Generated convenience method for getResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getResourceWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsClient.java deleted file mode 100644 index 8f0a554943b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation; - -import azure.clientgenerator.core.clientlocation.implementation.MoveToRootResourceOperationsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ClientLocationClient type. - */ -@ServiceClient(builder = ClientLocationClientBuilder.class) -public final class MoveToRootResourceOperationsClient { - @Generated - private final MoveToRootResourceOperationsImpl serviceClient; - - /** - * Initializes an instance of MoveToRootResourceOperationsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MoveToRootResourceOperationsClient(MoveToRootResourceOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getResource operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getResourceWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getResourceWithResponse(requestOptions); - } - - /** - * The getResource operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void getResource() { - // Generated convenience method for getResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - getResourceWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ArchiveOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ArchiveOperationsImpl.java deleted file mode 100644 index 1e30253f634..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ArchiveOperationsImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ArchiveOperations. - */ -public final class ArchiveOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ArchiveOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ClientLocationClientImpl client; - - /** - * Initializes an instance of ArchiveOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ArchiveOperationsImpl(ClientLocationClientImpl client) { - this.service - = RestProxy.create(ArchiveOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ClientLocationClientArchiveOperations to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ClientLocationClientArchiveOperations") - public interface ArchiveOperationsService { - @Post("/azure/client-generator-core/client-location/products/archive") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> archiveProduct(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Post("/azure/client-generator-core/client-location/products/archive") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response archiveProductSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The archiveProduct operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> archiveProductWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.archiveProduct(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The archiveProduct operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response archiveProductWithResponse(RequestOptions requestOptions) { - return service.archiveProductSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ClientLocationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ClientLocationClientImpl.java deleted file mode 100644 index 30cbbf6a0a9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ClientLocationClientImpl.java +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the ClientLocationClient type. - */ -public final class ClientLocationClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ClientLocationClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - */ - private final String storageAccount; - - /** - * Gets. - * - * @return the storageAccount value. - */ - public String getStorageAccount() { - return this.storageAccount; - } - - /** - * 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 MoveToExistingSubAdminOperationsImpl object to access its operations. - */ - private final MoveToExistingSubAdminOperationsImpl moveToExistingSubAdminOperations; - - /** - * Gets the MoveToExistingSubAdminOperationsImpl object to access its operations. - * - * @return the MoveToExistingSubAdminOperationsImpl object. - */ - public MoveToExistingSubAdminOperationsImpl getMoveToExistingSubAdminOperations() { - return this.moveToExistingSubAdminOperations; - } - - /** - * The MoveToExistingSubUserOperationsImpl object to access its operations. - */ - private final MoveToExistingSubUserOperationsImpl moveToExistingSubUserOperations; - - /** - * Gets the MoveToExistingSubUserOperationsImpl object to access its operations. - * - * @return the MoveToExistingSubUserOperationsImpl object. - */ - public MoveToExistingSubUserOperationsImpl getMoveToExistingSubUserOperations() { - return this.moveToExistingSubUserOperations; - } - - /** - * The MoveToNewSubProductOperationsImpl object to access its operations. - */ - private final MoveToNewSubProductOperationsImpl moveToNewSubProductOperations; - - /** - * Gets the MoveToNewSubProductOperationsImpl object to access its operations. - * - * @return the MoveToNewSubProductOperationsImpl object. - */ - public MoveToNewSubProductOperationsImpl getMoveToNewSubProductOperations() { - return this.moveToNewSubProductOperations; - } - - /** - * The MoveToRootResourceOperationsImpl object to access its operations. - */ - private final MoveToRootResourceOperationsImpl moveToRootResourceOperations; - - /** - * Gets the MoveToRootResourceOperationsImpl object to access its operations. - * - * @return the MoveToRootResourceOperationsImpl object. - */ - public MoveToRootResourceOperationsImpl getMoveToRootResourceOperations() { - return this.moveToRootResourceOperations; - } - - /** - * The MoveMethodParameterToBlobOperationsImpl object to access its operations. - */ - private final MoveMethodParameterToBlobOperationsImpl moveMethodParameterToBlobOperations; - - /** - * Gets the MoveMethodParameterToBlobOperationsImpl object to access its operations. - * - * @return the MoveMethodParameterToBlobOperationsImpl object. - */ - public MoveMethodParameterToBlobOperationsImpl getMoveMethodParameterToBlobOperations() { - return this.moveMethodParameterToBlobOperations; - } - - /** - * The ArchiveOperationsImpl object to access its operations. - */ - private final ArchiveOperationsImpl archiveOperations; - - /** - * Gets the ArchiveOperationsImpl object to access its operations. - * - * @return the ArchiveOperationsImpl object. - */ - public ArchiveOperationsImpl getArchiveOperations() { - return this.archiveOperations; - } - - /** - * Initializes an instance of ClientLocationClient client. - * - * @param endpoint Service host. - * @param storageAccount - */ - public ClientLocationClientImpl(String endpoint, String storageAccount) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, storageAccount); - } - - /** - * Initializes an instance of ClientLocationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param storageAccount - */ - public ClientLocationClientImpl(HttpPipeline httpPipeline, String endpoint, String storageAccount) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, storageAccount); - } - - /** - * Initializes an instance of ClientLocationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param storageAccount - */ - public ClientLocationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - String storageAccount) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.storageAccount = storageAccount; - this.moveToExistingSubAdminOperations = new MoveToExistingSubAdminOperationsImpl(this); - this.moveToExistingSubUserOperations = new MoveToExistingSubUserOperationsImpl(this); - this.moveToNewSubProductOperations = new MoveToNewSubProductOperationsImpl(this); - this.moveToRootResourceOperations = new MoveToRootResourceOperationsImpl(this); - this.moveMethodParameterToBlobOperations = new MoveMethodParameterToBlobOperationsImpl(this); - this.archiveOperations = new ArchiveOperationsImpl(this); - this.service - = RestProxy.create(ClientLocationClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ClientLocationClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ClientLocationClient") - public interface ClientLocationClientService { - @Get("/azure/client-generator-core/client-location/health") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getHealthStatus(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/client-location/health") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getHealthStatusSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The getHealthStatus operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getHealthStatusWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.getHealthStatus(this.getEndpoint(), requestOptions, context)); - } - - /** - * The getHealthStatus operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getHealthStatusWithResponse(RequestOptions requestOptions) { - return service.getHealthStatusSync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveMethodParameterToBlobOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveMethodParameterToBlobOperationsImpl.java deleted file mode 100644 index 99a148e1cce..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveMethodParameterToBlobOperationsImpl.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in MoveMethodParameterToBlobOperations. - */ -public final class MoveMethodParameterToBlobOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MoveMethodParameterToBlobOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ClientLocationClientImpl client; - - /** - * Initializes an instance of MoveMethodParameterToBlobOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - MoveMethodParameterToBlobOperationsImpl(ClientLocationClientImpl client) { - this.service = RestProxy.create(MoveMethodParameterToBlobOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ClientLocationClientMoveMethodParameterToBlobOperations to be used by - * the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ClientLocationClientMoveMethodParameterToBlobOperations") - public interface MoveMethodParameterToBlobOperationsService { - @Get("/azure/client-generator-core/client-location/blob") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getBlob(@HostParam("endpoint") String endpoint, - @QueryParam("storageAccount") String storageAccount, @QueryParam("container") String container, - @QueryParam("blob") String blob, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/client-location/blob") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getBlobSync(@HostParam("endpoint") String endpoint, - @QueryParam("storageAccount") String storageAccount, @QueryParam("container") String container, - @QueryParam("blob") String blob, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * The getBlob operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     size: int (Required)
-     *     path: String (Required)
-     * }
-     * }
-     * 
- * - * @param container The container parameter. - * @param blob The blob parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getBlobWithResponseAsync(String container, String blob, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getBlob(this.client.getEndpoint(), - this.client.getStorageAccount(), container, blob, accept, requestOptions, context)); - } - - /** - * The getBlob operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     size: int (Required)
-     *     path: String (Required)
-     * }
-     * }
-     * 
- * - * @param container The container parameter. - * @param blob The blob parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getBlobWithResponse(String container, String blob, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getBlobSync(this.client.getEndpoint(), this.client.getStorageAccount(), container, blob, accept, - requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubAdminOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubAdminOperationsImpl.java deleted file mode 100644 index c03618651f0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubAdminOperationsImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation.implementation; - -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in MoveToExistingSubAdminOperations. - */ -public final class MoveToExistingSubAdminOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MoveToExistingSubAdminOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ClientLocationClientImpl client; - - /** - * Initializes an instance of MoveToExistingSubAdminOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - MoveToExistingSubAdminOperationsImpl(ClientLocationClientImpl client) { - this.service = RestProxy.create(MoveToExistingSubAdminOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ClientLocationClientMoveToExistingSubAdminOperations to be used by - * the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ClientLocationClientMoveToExistingSubAdminOperations") - public interface MoveToExistingSubAdminOperationsService { - @Get("/azure/client-generator-core/client-location/admin") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAdminInfo(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/client-location/admin") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAdminInfoSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Delete("/azure/client-generator-core/client-location/user") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> deleteUser(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Delete("/azure/client-generator-core/client-location/user") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteUserSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The getAdminInfo operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAdminInfoWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.getAdminInfo(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The getAdminInfo operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAdminInfoWithResponse(RequestOptions requestOptions) { - return service.getAdminInfoSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The deleteUser operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteUserWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.deleteUser(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The deleteUser operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteUserWithResponse(RequestOptions requestOptions) { - return service.deleteUserSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubUserOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubUserOperationsImpl.java deleted file mode 100644 index 16f04a75d53..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubUserOperationsImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in MoveToExistingSubUserOperations. - */ -public final class MoveToExistingSubUserOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MoveToExistingSubUserOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ClientLocationClientImpl client; - - /** - * Initializes an instance of MoveToExistingSubUserOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - MoveToExistingSubUserOperationsImpl(ClientLocationClientImpl client) { - this.service = RestProxy.create(MoveToExistingSubUserOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ClientLocationClientMoveToExistingSubUserOperations to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ClientLocationClientMoveToExistingSubUserOperations") - public interface MoveToExistingSubUserOperationsService { - @Get("/azure/client-generator-core/client-location/user") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getUser(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/client-location/user") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getUserSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The getUser operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getUserWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.getUser(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The getUser operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getUserWithResponse(RequestOptions requestOptions) { - return service.getUserSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToNewSubProductOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToNewSubProductOperationsImpl.java deleted file mode 100644 index a8c443b0f9f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToNewSubProductOperationsImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in MoveToNewSubProductOperations. - */ -public final class MoveToNewSubProductOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MoveToNewSubProductOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ClientLocationClientImpl client; - - /** - * Initializes an instance of MoveToNewSubProductOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - MoveToNewSubProductOperationsImpl(ClientLocationClientImpl client) { - this.service = RestProxy.create(MoveToNewSubProductOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ClientLocationClientMoveToNewSubProductOperations to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ClientLocationClientMoveToNewSubProductOperations") - public interface MoveToNewSubProductOperationsService { - @Get("/azure/client-generator-core/client-location/products") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listProducts(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/client-location/products") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listProductsSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The listProducts operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listProductsWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.listProducts(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The listProducts operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listProductsWithResponse(RequestOptions requestOptions) { - return service.listProductsSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToRootResourceOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToRootResourceOperationsImpl.java deleted file mode 100644 index ff5f211a921..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToRootResourceOperationsImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in MoveToRootResourceOperations. - */ -public final class MoveToRootResourceOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MoveToRootResourceOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ClientLocationClientImpl client; - - /** - * Initializes an instance of MoveToRootResourceOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - MoveToRootResourceOperationsImpl(ClientLocationClientImpl client) { - this.service = RestProxy.create(MoveToRootResourceOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ClientLocationClientMoveToRootResourceOperations to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ClientLocationClientMoveToRootResourceOperations") - public interface MoveToRootResourceOperationsService { - @Get("/azure/client-generator-core/client-location/resource") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getResource(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/azure/client-generator-core/client-location/resource") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getResourceSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The getResource operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getResourceWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.getResource(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The getResource operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getResourceWithResponse(RequestOptions requestOptions) { - return service.getResourceSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/package-info.java deleted file mode 100644 index 5015b7891bc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ClientLocation. - * Test for @clientLocation decorator - moving operations between clients. - * - */ -package azure.clientgenerator.core.clientlocation.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/Blob.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/Blob.java deleted file mode 100644 index 73c2a582eae..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/Blob.java +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation.movemethodparametertoclient.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Blob model. - */ -@Immutable -public final class Blob implements JsonSerializable { - /* - * The id property. - */ - @Generated - private final String id; - - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The size property. - */ - @Generated - private final int size; - - /* - * The path property. - */ - @Generated - private final String path; - - /** - * Creates an instance of Blob class. - * - * @param id the id value to set. - * @param name the name value to set. - * @param size the size value to set. - * @param path the path value to set. - */ - @Generated - private Blob(String id, String name, int size, String path) { - this.id = id; - this.name = name; - this.size = size; - this.path = path; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the size property: The size property. - * - * @return the size value. - */ - @Generated - public int getSize() { - return this.size; - } - - /** - * Get the path property: The path property. - * - * @return the path value. - */ - @Generated - public String getPath() { - return this.path; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeIntField("size", this.size); - jsonWriter.writeStringField("path", this.path); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Blob from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Blob if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Blob. - */ - @Generated - public static Blob fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String name = null; - int size = 0; - String path = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("size".equals(fieldName)) { - size = reader.getInt(); - } else if ("path".equals(fieldName)) { - path = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Blob(id, name, size, path); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/package-info.java deleted file mode 100644 index 1dda884bd3e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for ClientLocation. - * Test for @clientLocation decorator - moving operations between clients. - * - */ -package azure.clientgenerator.core.clientlocation.movemethodparametertoclient.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/package-info.java deleted file mode 100644 index 71104e04270..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ClientLocation. - * Test for @clientLocation decorator - moving operations between clients. - * - */ -package azure.clientgenerator.core.clientlocation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullAsyncClient.java deleted file mode 100644 index 924ed44e4be..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullAsyncClient.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.deserialize.emptystringnull; - -import azure.clientgenerator.core.deserialize.emptystringnull.implementation.DeserializeEmptyStringAsNullClientImpl; -import azure.clientgenerator.core.deserialize.emptystringnull.models.ResponseModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous DeserializeEmptyStringAsNullClient type. - */ -@ServiceClient(builder = DeserializeEmptyStringAsNullClientBuilder.class, isAsync = true) -public final class DeserializeEmptyStringAsNullAsyncClient { - @Generated - private final DeserializeEmptyStringAsNullClientImpl serviceClient; - - /** - * Initializes an instance of DeserializeEmptyStringAsNullAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DeserializeEmptyStringAsNullAsyncClient(DeserializeEmptyStringAsNullClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     sampleUrl: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is a Model contains a string-like property of type url along with {@link Response} on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is a Model contains a string-like property of type url on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ResponseModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClient.java deleted file mode 100644 index c0756b069a3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClient.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.deserialize.emptystringnull; - -import azure.clientgenerator.core.deserialize.emptystringnull.implementation.DeserializeEmptyStringAsNullClientImpl; -import azure.clientgenerator.core.deserialize.emptystringnull.models.ResponseModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous DeserializeEmptyStringAsNullClient type. - */ -@ServiceClient(builder = DeserializeEmptyStringAsNullClientBuilder.class) -public final class DeserializeEmptyStringAsNullClient { - @Generated - private final DeserializeEmptyStringAsNullClientImpl serviceClient; - - /** - * Initializes an instance of DeserializeEmptyStringAsNullClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DeserializeEmptyStringAsNullClient(DeserializeEmptyStringAsNullClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     sampleUrl: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is a Model contains a string-like property of type url along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is a Model contains a string-like property of type url. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseModel get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ResponseModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClientBuilder.java deleted file mode 100644 index 3f32e73f0c5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClientBuilder.java +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.deserialize.emptystringnull; - -import azure.clientgenerator.core.deserialize.emptystringnull.implementation.DeserializeEmptyStringAsNullClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the DeserializeEmptyStringAsNullClient type. - */ -@ServiceClientBuilder( - serviceClients = { DeserializeEmptyStringAsNullClient.class, DeserializeEmptyStringAsNullAsyncClient.class }) -public final class DeserializeEmptyStringAsNullClientBuilder implements - HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-deserialize-emptystringnull.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the DeserializeEmptyStringAsNullClientBuilder. - */ - @Generated - public DeserializeEmptyStringAsNullClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DeserializeEmptyStringAsNullClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DeserializeEmptyStringAsNullClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DeserializeEmptyStringAsNullClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DeserializeEmptyStringAsNullClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DeserializeEmptyStringAsNullClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DeserializeEmptyStringAsNullClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DeserializeEmptyStringAsNullClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DeserializeEmptyStringAsNullClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the DeserializeEmptyStringAsNullClientBuilder. - */ - @Generated - public DeserializeEmptyStringAsNullClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of DeserializeEmptyStringAsNullClientImpl with the provided parameters. - * - * @return an instance of DeserializeEmptyStringAsNullClientImpl. - */ - @Generated - private DeserializeEmptyStringAsNullClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - DeserializeEmptyStringAsNullClientImpl client = new DeserializeEmptyStringAsNullClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of DeserializeEmptyStringAsNullAsyncClient class. - * - * @return an instance of DeserializeEmptyStringAsNullAsyncClient. - */ - @Generated - public DeserializeEmptyStringAsNullAsyncClient buildAsyncClient() { - return new DeserializeEmptyStringAsNullAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of DeserializeEmptyStringAsNullClient class. - * - * @return an instance of DeserializeEmptyStringAsNullClient. - */ - @Generated - public DeserializeEmptyStringAsNullClient buildClient() { - return new DeserializeEmptyStringAsNullClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(DeserializeEmptyStringAsNullClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/DeserializeEmptyStringAsNullClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/DeserializeEmptyStringAsNullClientImpl.java deleted file mode 100644 index e7d485fc2df..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/DeserializeEmptyStringAsNullClientImpl.java +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.deserialize.emptystringnull.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the DeserializeEmptyStringAsNullClient type. - */ -public final class DeserializeEmptyStringAsNullClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DeserializeEmptyStringAsNullClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of DeserializeEmptyStringAsNullClient client. - * - * @param endpoint Service host. - */ - public DeserializeEmptyStringAsNullClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DeserializeEmptyStringAsNullClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public DeserializeEmptyStringAsNullClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DeserializeEmptyStringAsNullClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public DeserializeEmptyStringAsNullClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(DeserializeEmptyStringAsNullClientService.class, this.httpPipeline, - this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for DeserializeEmptyStringAsNullClient to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DeserializeEmptyStringAsNullClient") - public interface DeserializeEmptyStringAsNullClientService { - @Get("/azure/client-generator-core/deserialize-empty-string-as-null/responseModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/deserialize-empty-string-as-null/responseModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     sampleUrl: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is a Model contains a string-like property of type url along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     sampleUrl: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is a Model contains a string-like property of type url along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/package-info.java deleted file mode 100644 index 8fcdc6340ea..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for DeserializeEmptyStringAsNull. - * Test decorator @deserializeEmptyStringAsNull. - * - */ -package azure.clientgenerator.core.deserialize.emptystringnull.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/ResponseModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/ResponseModel.java deleted file mode 100644 index 19416a61421..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/ResponseModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.deserialize.emptystringnull.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * This is a Model contains a string-like property of type url. - */ -@Immutable -public final class ResponseModel implements JsonSerializable { - /* - * The sampleUrl property. - */ - @Generated - private final String sampleUrl; - - /** - * Creates an instance of ResponseModel class. - * - * @param sampleUrl the sampleUrl value to set. - */ - @Generated - private ResponseModel(String sampleUrl) { - this.sampleUrl = sampleUrl; - } - - /** - * Get the sampleUrl property: The sampleUrl property. - * - * @return the sampleUrl value. - */ - @Generated - public String getSampleUrl() { - return this.sampleUrl; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("sampleUrl", this.sampleUrl); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResponseModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResponseModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResponseModel. - */ - @Generated - public static ResponseModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String sampleUrl = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("sampleUrl".equals(fieldName)) { - sampleUrl = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ResponseModel(sampleUrl); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/package-info.java deleted file mode 100644 index 381ca26c64a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for DeserializeEmptyStringAsNull. - * Test decorator @deserializeEmptyStringAsNull. - * - */ -package azure.clientgenerator.core.deserialize.emptystringnull.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/package-info.java deleted file mode 100644 index fc1a2aae117..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for DeserializeEmptyStringAsNull. - * Test decorator @deserializeEmptyStringAsNull. - * - */ -package azure.clientgenerator.core.deserialize.emptystringnull; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyAsyncClient.java deleted file mode 100644 index e4dd5e633de..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyAsyncClient.java +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.flattenproperty; - -import azure.clientgenerator.core.flattenproperty.implementation.FlattenPropertyClientImpl; -import azure.clientgenerator.core.flattenproperty.models.FlattenModel; -import azure.clientgenerator.core.flattenproperty.models.NestedFlattenModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous FlattenPropertyClient type. - */ -@ServiceClient(builder = FlattenPropertyClientBuilder.class, isAsync = true) -public final class FlattenPropertyAsyncClient { - @Generated - private final FlattenPropertyClientImpl serviceClient; - - /** - * Initializes an instance of FlattenPropertyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FlattenPropertyAsyncClient(FlattenPropertyClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The putFlattenModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         description: String (Required)
-     *         age: int (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         description: String (Required)
-     *         age: int (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is the model with one level of flattening along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putFlattenModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putFlattenModelWithResponseAsync(input, requestOptions); - } - - /** - * The putNestedFlattenModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         summary: String (Required)
-     *         properties (Required): {
-     *             description: String (Required)
-     *             age: int (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         summary: String (Required)
-     *         properties (Required): {
-     *             description: String (Required)
-     *             age: int (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is the model with two levels of flattening along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putNestedFlattenModelWithResponse(BinaryData input, - RequestOptions requestOptions) { - return this.serviceClient.putNestedFlattenModelWithResponseAsync(input, requestOptions); - } - - /** - * The putFlattenModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is the model with one level of flattening on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putFlattenModel(FlattenModel input) { - // Generated convenience method for putFlattenModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putFlattenModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FlattenModel.class)); - } - - /** - * The putNestedFlattenModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is the model with two levels of flattening on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putNestedFlattenModel(NestedFlattenModel input) { - // Generated convenience method for putNestedFlattenModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putNestedFlattenModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(NestedFlattenModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClient.java deleted file mode 100644 index 6df185bf86f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClient.java +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.flattenproperty; - -import azure.clientgenerator.core.flattenproperty.implementation.FlattenPropertyClientImpl; -import azure.clientgenerator.core.flattenproperty.models.FlattenModel; -import azure.clientgenerator.core.flattenproperty.models.NestedFlattenModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous FlattenPropertyClient type. - */ -@ServiceClient(builder = FlattenPropertyClientBuilder.class) -public final class FlattenPropertyClient { - @Generated - private final FlattenPropertyClientImpl serviceClient; - - /** - * Initializes an instance of FlattenPropertyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FlattenPropertyClient(FlattenPropertyClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The putFlattenModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         description: String (Required)
-     *         age: int (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         description: String (Required)
-     *         age: int (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is the model with one level of flattening along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putFlattenModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putFlattenModelWithResponse(input, requestOptions); - } - - /** - * The putNestedFlattenModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         summary: String (Required)
-     *         properties (Required): {
-     *             description: String (Required)
-     *             age: int (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         summary: String (Required)
-     *         properties (Required): {
-     *             description: String (Required)
-     *             age: int (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is the model with two levels of flattening along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putNestedFlattenModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putNestedFlattenModelWithResponse(input, requestOptions); - } - - /** - * The putFlattenModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is the model with one level of flattening. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FlattenModel putFlattenModel(FlattenModel input) { - // Generated convenience method for putFlattenModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putFlattenModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue() - .toObject(FlattenModel.class); - } - - /** - * The putNestedFlattenModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is the model with two levels of flattening. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public NestedFlattenModel putNestedFlattenModel(NestedFlattenModel input) { - // Generated convenience method for putNestedFlattenModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putNestedFlattenModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue() - .toObject(NestedFlattenModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClientBuilder.java deleted file mode 100644 index c5e49b6f3d8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.flattenproperty; - -import azure.clientgenerator.core.flattenproperty.implementation.FlattenPropertyClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the FlattenPropertyClient type. - */ -@ServiceClientBuilder(serviceClients = { FlattenPropertyClient.class, FlattenPropertyAsyncClient.class }) -public final class FlattenPropertyClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-flattenproperty.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the FlattenPropertyClientBuilder. - */ - @Generated - public FlattenPropertyClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenPropertyClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenPropertyClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenPropertyClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenPropertyClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenPropertyClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenPropertyClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenPropertyClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenPropertyClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the FlattenPropertyClientBuilder. - */ - @Generated - public FlattenPropertyClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of FlattenPropertyClientImpl with the provided parameters. - * - * @return an instance of FlattenPropertyClientImpl. - */ - @Generated - private FlattenPropertyClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - FlattenPropertyClientImpl client = new FlattenPropertyClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of FlattenPropertyAsyncClient class. - * - * @return an instance of FlattenPropertyAsyncClient. - */ - @Generated - public FlattenPropertyAsyncClient buildAsyncClient() { - return new FlattenPropertyAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of FlattenPropertyClient class. - * - * @return an instance of FlattenPropertyClient. - */ - @Generated - public FlattenPropertyClient buildClient() { - return new FlattenPropertyClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(FlattenPropertyClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/FlattenPropertyClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/FlattenPropertyClientImpl.java deleted file mode 100644 index b15d7fb3eb2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/FlattenPropertyClientImpl.java +++ /dev/null @@ -1,368 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.flattenproperty.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the FlattenPropertyClient type. - */ -public final class FlattenPropertyClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FlattenPropertyClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of FlattenPropertyClient client. - * - * @param endpoint Service host. - */ - public FlattenPropertyClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of FlattenPropertyClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public FlattenPropertyClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of FlattenPropertyClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public FlattenPropertyClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(FlattenPropertyClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for FlattenPropertyClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "FlattenPropertyClient") - public interface FlattenPropertyClientService { - @Put("/azure/client-generator-core/flatten-property/flattenModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putFlattenModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/flatten-property/flattenModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putFlattenModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/flatten-property/nestedFlattenModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putNestedFlattenModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/flatten-property/nestedFlattenModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putNestedFlattenModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - } - - /** - * The putFlattenModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         description: String (Required)
-     *         age: int (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         description: String (Required)
-     *         age: int (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is the model with one level of flattening along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putFlattenModelWithResponseAsync(BinaryData input, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.putFlattenModel(this.getEndpoint(), contentType, accept, input, - requestOptions, context)); - } - - /** - * The putFlattenModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         description: String (Required)
-     *         age: int (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         description: String (Required)
-     *         age: int (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is the model with one level of flattening along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putFlattenModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putFlattenModelSync(this.getEndpoint(), contentType, accept, input, requestOptions, - Context.NONE); - } - - /** - * The putNestedFlattenModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         summary: String (Required)
-     *         properties (Required): {
-     *             description: String (Required)
-     *             age: int (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         summary: String (Required)
-     *         properties (Required): {
-     *             description: String (Required)
-     *             age: int (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is the model with two levels of flattening along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putNestedFlattenModelWithResponseAsync(BinaryData input, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.putNestedFlattenModel(this.getEndpoint(), contentType, accept, - input, requestOptions, context)); - } - - /** - * The putNestedFlattenModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         summary: String (Required)
-     *         properties (Required): {
-     *             description: String (Required)
-     *             age: int (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     properties (Required): {
-     *         summary: String (Required)
-     *         properties (Required): {
-     *             description: String (Required)
-     *             age: int (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is the model with two levels of flattening along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putNestedFlattenModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putNestedFlattenModelSync(this.getEndpoint(), contentType, accept, input, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/package-info.java deleted file mode 100644 index 55c70816957..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for FlattenProperty. - * Illustrates the model flatten cases. - * - */ -package azure.clientgenerator.core.flattenproperty.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildFlattenModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildFlattenModel.java deleted file mode 100644 index f09ff20f276..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildFlattenModel.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.flattenproperty.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * This is the child model to be flattened. And it has flattened property as well. - */ -@Immutable -public final class ChildFlattenModel implements JsonSerializable { - /* - * The summary property. - */ - @Generated - private final String summary; - - /* - * The properties property. - */ - @Generated - private final ChildModel properties; - - /** - * Creates an instance of ChildFlattenModel class. - * - * @param summary the summary value to set. - * @param properties the properties value to set. - */ - @Generated - public ChildFlattenModel(String summary, ChildModel properties) { - this.summary = summary; - this.properties = properties; - } - - /** - * Get the summary property: The summary property. - * - * @return the summary value. - */ - @Generated - public String getSummary() { - return this.summary; - } - - /** - * Get the properties property: The properties property. - * - * @return the properties value. - */ - @Generated - public ChildModel getProperties() { - return this.properties; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("summary", this.summary); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChildFlattenModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChildFlattenModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ChildFlattenModel. - */ - @Generated - public static ChildFlattenModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String summary = null; - ChildModel properties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("summary".equals(fieldName)) { - summary = reader.getString(); - } else if ("properties".equals(fieldName)) { - properties = ChildModel.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new ChildFlattenModel(summary, properties); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildModel.java deleted file mode 100644 index 2fd844a0cee..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildModel.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.flattenproperty.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * This is the child model to be flattened. - */ -@Immutable -public final class ChildModel implements JsonSerializable { - /* - * The description property. - */ - @Generated - private final String description; - - /* - * The age property. - */ - @Generated - private final int age; - - /** - * Creates an instance of ChildModel class. - * - * @param description the description value to set. - * @param age the age value to set. - */ - @Generated - public ChildModel(String description, int age) { - this.description = description; - this.age = age; - } - - /** - * Get the description property: The description property. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * Get the age property: The age property. - * - * @return the age value. - */ - @Generated - public int getAge() { - return this.age; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("description", this.description); - jsonWriter.writeIntField("age", this.age); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChildModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChildModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ChildModel. - */ - @Generated - public static ChildModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String description = null; - int age = 0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("description".equals(fieldName)) { - description = reader.getString(); - } else if ("age".equals(fieldName)) { - age = reader.getInt(); - } else { - reader.skipChildren(); - } - } - return new ChildModel(description, age); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/FlattenModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/FlattenModel.java deleted file mode 100644 index 973aacf162a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/FlattenModel.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.flattenproperty.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * This is the model with one level of flattening. - */ -@Immutable -public final class FlattenModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The properties property. - */ - @Generated - private final ChildModel properties; - - /** - * Creates an instance of FlattenModel class. - * - * @param name the name value to set. - * @param properties the properties value to set. - */ - @Generated - public FlattenModel(String name, ChildModel properties) { - this.name = name; - this.properties = properties; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the properties property: The properties property. - * - * @return the properties value. - */ - @Generated - public ChildModel getProperties() { - return this.properties; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FlattenModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FlattenModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FlattenModel. - */ - @Generated - public static FlattenModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - ChildModel properties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("properties".equals(fieldName)) { - properties = ChildModel.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new FlattenModel(name, properties); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/NestedFlattenModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/NestedFlattenModel.java deleted file mode 100644 index 976248cc9a7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/NestedFlattenModel.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.flattenproperty.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * This is the model with two levels of flattening. - */ -@Immutable -public final class NestedFlattenModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The properties property. - */ - @Generated - private final ChildFlattenModel properties; - - /** - * Creates an instance of NestedFlattenModel class. - * - * @param name the name value to set. - * @param properties the properties value to set. - */ - @Generated - public NestedFlattenModel(String name, ChildFlattenModel properties) { - this.name = name; - this.properties = properties; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the properties property: The properties property. - * - * @return the properties value. - */ - @Generated - public ChildFlattenModel getProperties() { - return this.properties; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NestedFlattenModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NestedFlattenModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NestedFlattenModel. - */ - @Generated - public static NestedFlattenModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - ChildFlattenModel properties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("properties".equals(fieldName)) { - properties = ChildFlattenModel.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new NestedFlattenModel(name, properties); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/package-info.java deleted file mode 100644 index ae162abe0de..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for FlattenProperty. - * Illustrates the model flatten cases. - * - */ -package azure.clientgenerator.core.flattenproperty.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/package-info.java deleted file mode 100644 index afccbab87b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for FlattenProperty. - * Illustrates the model flatten cases. - * - */ -package azure.clientgenerator.core.flattenproperty; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsAsyncClient.java deleted file mode 100644 index 3f529464029..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsAsyncClient.java +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding; - -import azure.clientgenerator.core.hierarchybuilding.implementation.AnimalOperationsImpl; -import azure.clientgenerator.core.hierarchybuilding.models.Animal; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous HierarchyBuildingClient type. - */ -@ServiceClient(builder = HierarchyBuildingClientBuilder.class, isAsync = true) -public final class AnimalOperationsAsyncClient { - @Generated - private final AnimalOperationsImpl serviceClient; - - /** - * Initializes an instance of AnimalOperationsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - AnimalOperationsAsyncClient(AnimalOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Update a pet as an animal. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param animal The animal parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updatePetAsAnimalWithResponse(BinaryData animal, RequestOptions requestOptions) { - return this.serviceClient.updatePetAsAnimalWithResponseAsync(animal, requestOptions); - } - - /** - * Update a dog as an animal. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param animal The animal parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateDogAsAnimalWithResponse(BinaryData animal, RequestOptions requestOptions) { - return this.serviceClient.updateDogAsAnimalWithResponseAsync(animal, requestOptions); - } - - /** - * Update a pet as an animal. - * - * @param animal The animal parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updatePetAsAnimal(Animal animal) { - // Generated convenience method for updatePetAsAnimalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return updatePetAsAnimalWithResponse(BinaryData.fromObject(animal), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Animal.class)); - } - - /** - * Update a dog as an animal. - * - * @param animal The animal parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateDogAsAnimal(Animal animal) { - // Generated convenience method for updateDogAsAnimalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return updateDogAsAnimalWithResponse(BinaryData.fromObject(animal), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Animal.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsClient.java deleted file mode 100644 index 3d9bf2dadf4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsClient.java +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding; - -import azure.clientgenerator.core.hierarchybuilding.implementation.AnimalOperationsImpl; -import azure.clientgenerator.core.hierarchybuilding.models.Animal; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous HierarchyBuildingClient type. - */ -@ServiceClient(builder = HierarchyBuildingClientBuilder.class) -public final class AnimalOperationsClient { - @Generated - private final AnimalOperationsImpl serviceClient; - - /** - * Initializes an instance of AnimalOperationsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - AnimalOperationsClient(AnimalOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Update a pet as an animal. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param animal The animal parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updatePetAsAnimalWithResponse(BinaryData animal, RequestOptions requestOptions) { - return this.serviceClient.updatePetAsAnimalWithResponse(animal, requestOptions); - } - - /** - * Update a dog as an animal. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param animal The animal parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateDogAsAnimalWithResponse(BinaryData animal, RequestOptions requestOptions) { - return this.serviceClient.updateDogAsAnimalWithResponse(animal, requestOptions); - } - - /** - * Update a pet as an animal. - * - * @param animal The animal parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Animal updatePetAsAnimal(Animal animal) { - // Generated convenience method for updatePetAsAnimalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return updatePetAsAnimalWithResponse(BinaryData.fromObject(animal), requestOptions).getValue() - .toObject(Animal.class); - } - - /** - * Update a dog as an animal. - * - * @param animal The animal parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Animal updateDogAsAnimal(Animal animal) { - // Generated convenience method for updateDogAsAnimalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return updateDogAsAnimalWithResponse(BinaryData.fromObject(animal), requestOptions).getValue() - .toObject(Animal.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsAsyncClient.java deleted file mode 100644 index 86a4eb9b9f1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsAsyncClient.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding; - -import azure.clientgenerator.core.hierarchybuilding.implementation.DogOperationsImpl; -import azure.clientgenerator.core.hierarchybuilding.models.Dog; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous HierarchyBuildingClient type. - */ -@ServiceClient(builder = HierarchyBuildingClientBuilder.class, isAsync = true) -public final class DogOperationsAsyncClient { - @Generated - private final DogOperationsImpl serviceClient; - - /** - * Initializes an instance of DogOperationsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DogOperationsAsyncClient(DogOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Update a dog as a dog. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     *     breed: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     *     breed: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateDogAsDogWithResponse(BinaryData dog, RequestOptions requestOptions) { - return this.serviceClient.updateDogAsDogWithResponseAsync(dog, requestOptions); - } - - /** - * Update a dog as a dog. - * - * @param dog The dog parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateDogAsDog(Dog dog) { - // Generated convenience method for updateDogAsDogWithResponse - RequestOptions requestOptions = new RequestOptions(); - return updateDogAsDogWithResponse(BinaryData.fromObject(dog), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsClient.java deleted file mode 100644 index 813fe651d7f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsClient.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding; - -import azure.clientgenerator.core.hierarchybuilding.implementation.DogOperationsImpl; -import azure.clientgenerator.core.hierarchybuilding.models.Dog; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous HierarchyBuildingClient type. - */ -@ServiceClient(builder = HierarchyBuildingClientBuilder.class) -public final class DogOperationsClient { - @Generated - private final DogOperationsImpl serviceClient; - - /** - * Initializes an instance of DogOperationsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DogOperationsClient(DogOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Update a dog as a dog. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     *     breed: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     *     breed: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateDogAsDogWithResponse(BinaryData dog, RequestOptions requestOptions) { - return this.serviceClient.updateDogAsDogWithResponse(dog, requestOptions); - } - - /** - * Update a dog as a dog. - * - * @param dog The dog parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Dog updateDogAsDog(Dog dog) { - // Generated convenience method for updateDogAsDogWithResponse - RequestOptions requestOptions = new RequestOptions(); - return updateDogAsDogWithResponse(BinaryData.fromObject(dog), requestOptions).getValue().toObject(Dog.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/HierarchyBuildingClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/HierarchyBuildingClientBuilder.java deleted file mode 100644 index f1fecd5e481..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/HierarchyBuildingClientBuilder.java +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding; - -import azure.clientgenerator.core.hierarchybuilding.implementation.HierarchyBuildingClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the HierarchyBuildingClient type. - */ -@ServiceClientBuilder( - serviceClients = { - AnimalOperationsClient.class, - PetOperationsClient.class, - DogOperationsClient.class, - AnimalOperationsAsyncClient.class, - PetOperationsAsyncClient.class, - DogOperationsAsyncClient.class }) -public final class HierarchyBuildingClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-hierarchybuilding.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the HierarchyBuildingClientBuilder. - */ - @Generated - public HierarchyBuildingClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HierarchyBuildingClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HierarchyBuildingClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HierarchyBuildingClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HierarchyBuildingClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HierarchyBuildingClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HierarchyBuildingClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HierarchyBuildingClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public HierarchyBuildingClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the HierarchyBuildingClientBuilder. - */ - @Generated - public HierarchyBuildingClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of HierarchyBuildingClientImpl with the provided parameters. - * - * @return an instance of HierarchyBuildingClientImpl. - */ - @Generated - private HierarchyBuildingClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - HierarchyBuildingClientImpl client = new HierarchyBuildingClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of AnimalOperationsAsyncClient class. - * - * @return an instance of AnimalOperationsAsyncClient. - */ - @Generated - public AnimalOperationsAsyncClient buildAnimalOperationsAsyncClient() { - return new AnimalOperationsAsyncClient(buildInnerClient().getAnimalOperations()); - } - - /** - * Builds an instance of PetOperationsAsyncClient class. - * - * @return an instance of PetOperationsAsyncClient. - */ - @Generated - public PetOperationsAsyncClient buildPetOperationsAsyncClient() { - return new PetOperationsAsyncClient(buildInnerClient().getPetOperations()); - } - - /** - * Builds an instance of DogOperationsAsyncClient class. - * - * @return an instance of DogOperationsAsyncClient. - */ - @Generated - public DogOperationsAsyncClient buildDogOperationsAsyncClient() { - return new DogOperationsAsyncClient(buildInnerClient().getDogOperations()); - } - - /** - * Builds an instance of AnimalOperationsClient class. - * - * @return an instance of AnimalOperationsClient. - */ - @Generated - public AnimalOperationsClient buildAnimalOperationsClient() { - return new AnimalOperationsClient(buildInnerClient().getAnimalOperations()); - } - - /** - * Builds an instance of PetOperationsClient class. - * - * @return an instance of PetOperationsClient. - */ - @Generated - public PetOperationsClient buildPetOperationsClient() { - return new PetOperationsClient(buildInnerClient().getPetOperations()); - } - - /** - * Builds an instance of DogOperationsClient class. - * - * @return an instance of DogOperationsClient. - */ - @Generated - public DogOperationsClient buildDogOperationsClient() { - return new DogOperationsClient(buildInnerClient().getDogOperations()); - } - - private static final ClientLogger LOGGER = new ClientLogger(HierarchyBuildingClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsAsyncClient.java deleted file mode 100644 index 1600097887a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsAsyncClient.java +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding; - -import azure.clientgenerator.core.hierarchybuilding.implementation.PetOperationsImpl; -import azure.clientgenerator.core.hierarchybuilding.models.Pet; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous HierarchyBuildingClient type. - */ -@ServiceClient(builder = HierarchyBuildingClientBuilder.class, isAsync = true) -public final class PetOperationsAsyncClient { - @Generated - private final PetOperationsImpl serviceClient; - - /** - * Initializes an instance of PetOperationsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PetOperationsAsyncClient(PetOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Update a pet as a pet. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param pet The pet parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updatePetAsPetWithResponse(BinaryData pet, RequestOptions requestOptions) { - return this.serviceClient.updatePetAsPetWithResponseAsync(pet, requestOptions); - } - - /** - * Update a dog as a pet. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param pet The pet parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateDogAsPetWithResponse(BinaryData pet, RequestOptions requestOptions) { - return this.serviceClient.updateDogAsPetWithResponseAsync(pet, requestOptions); - } - - /** - * Update a pet as a pet. - * - * @param pet The pet parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updatePetAsPet(Pet pet) { - // Generated convenience method for updatePetAsPetWithResponse - RequestOptions requestOptions = new RequestOptions(); - return updatePetAsPetWithResponse(BinaryData.fromObject(pet), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Pet.class)); - } - - /** - * Update a dog as a pet. - * - * @param pet The pet parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateDogAsPet(Pet pet) { - // Generated convenience method for updateDogAsPetWithResponse - RequestOptions requestOptions = new RequestOptions(); - return updateDogAsPetWithResponse(BinaryData.fromObject(pet), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Pet.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsClient.java deleted file mode 100644 index dfa76fa5482..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsClient.java +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding; - -import azure.clientgenerator.core.hierarchybuilding.implementation.PetOperationsImpl; -import azure.clientgenerator.core.hierarchybuilding.models.Pet; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous HierarchyBuildingClient type. - */ -@ServiceClient(builder = HierarchyBuildingClientBuilder.class) -public final class PetOperationsClient { - @Generated - private final PetOperationsImpl serviceClient; - - /** - * Initializes an instance of PetOperationsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PetOperationsClient(PetOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Update a pet as a pet. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param pet The pet parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updatePetAsPetWithResponse(BinaryData pet, RequestOptions requestOptions) { - return this.serviceClient.updatePetAsPetWithResponse(pet, requestOptions); - } - - /** - * Update a dog as a pet. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param pet The pet parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateDogAsPetWithResponse(BinaryData pet, RequestOptions requestOptions) { - return this.serviceClient.updateDogAsPetWithResponse(pet, requestOptions); - } - - /** - * Update a pet as a pet. - * - * @param pet The pet parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Pet updatePetAsPet(Pet pet) { - // Generated convenience method for updatePetAsPetWithResponse - RequestOptions requestOptions = new RequestOptions(); - return updatePetAsPetWithResponse(BinaryData.fromObject(pet), requestOptions).getValue().toObject(Pet.class); - } - - /** - * Update a dog as a pet. - * - * @param pet The pet parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Pet updateDogAsPet(Pet pet) { - // Generated convenience method for updateDogAsPetWithResponse - RequestOptions requestOptions = new RequestOptions(); - return updateDogAsPetWithResponse(BinaryData.fromObject(pet), requestOptions).getValue().toObject(Pet.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/AnimalOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/AnimalOperationsImpl.java deleted file mode 100644 index 71d67baf7b8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/AnimalOperationsImpl.java +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in AnimalOperations. - */ -public final class AnimalOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final AnimalOperationsService service; - - /** - * The service client containing this operation class. - */ - private final HierarchyBuildingClientImpl client; - - /** - * Initializes an instance of AnimalOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - AnimalOperationsImpl(HierarchyBuildingClientImpl client) { - this.service - = RestProxy.create(AnimalOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for HierarchyBuildingClientAnimalOperations to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "HierarchyBuildingClientAnimalOperations") - public interface AnimalOperationsService { - @Put("/azure/client-generator-core/hierarchy-building/pet/as-animal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> updatePetAsAnimal(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData animal, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/hierarchy-building/pet/as-animal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response updatePetAsAnimalSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData animal, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/hierarchy-building/dog/as-animal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> updateDogAsAnimal(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData animal, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/hierarchy-building/dog/as-animal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response updateDogAsAnimalSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData animal, RequestOptions requestOptions, Context context); - } - - /** - * Update a pet as an animal. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param animal The animal parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updatePetAsAnimalWithResponseAsync(BinaryData animal, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.updatePetAsAnimal(this.client.getEndpoint(), contentType, accept, - animal, requestOptions, context)); - } - - /** - * Update a pet as an animal. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param animal The animal parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updatePetAsAnimalWithResponse(BinaryData animal, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updatePetAsAnimalSync(this.client.getEndpoint(), contentType, accept, animal, requestOptions, - Context.NONE); - } - - /** - * Update a dog as an animal. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param animal The animal parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateDogAsAnimalWithResponseAsync(BinaryData animal, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.updateDogAsAnimal(this.client.getEndpoint(), contentType, accept, - animal, requestOptions, context)); - } - - /** - * Update a dog as an animal. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param animal The animal parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateDogAsAnimalWithResponse(BinaryData animal, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateDogAsAnimalSync(this.client.getEndpoint(), contentType, accept, animal, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/DogOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/DogOperationsImpl.java deleted file mode 100644 index 54e4d0acc12..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/DogOperationsImpl.java +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DogOperations. - */ -public final class DogOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DogOperationsService service; - - /** - * The service client containing this operation class. - */ - private final HierarchyBuildingClientImpl client; - - /** - * Initializes an instance of DogOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DogOperationsImpl(HierarchyBuildingClientImpl client) { - this.service - = RestProxy.create(DogOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for HierarchyBuildingClientDogOperations to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "HierarchyBuildingClientDogOperations") - public interface DogOperationsService { - @Put("/azure/client-generator-core/hierarchy-building/dog/as-dog") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> updateDogAsDog(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/hierarchy-building/dog/as-dog") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response updateDogAsDogSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); - } - - /** - * Update a dog as a dog. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     *     breed: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     *     breed: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateDogAsDogWithResponseAsync(BinaryData dog, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.updateDogAsDog(this.client.getEndpoint(), contentType, accept, - dog, requestOptions, context)); - } - - /** - * Update a dog as a dog. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     *     breed: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     *     breed: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateDogAsDogWithResponse(BinaryData dog, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateDogAsDogSync(this.client.getEndpoint(), contentType, accept, dog, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/HierarchyBuildingClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/HierarchyBuildingClientImpl.java deleted file mode 100644 index 0fdca8bab26..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/HierarchyBuildingClientImpl.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 HierarchyBuildingClient type. - */ -public final class HierarchyBuildingClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 AnimalOperationsImpl object to access its operations. - */ - private final AnimalOperationsImpl animalOperations; - - /** - * Gets the AnimalOperationsImpl object to access its operations. - * - * @return the AnimalOperationsImpl object. - */ - public AnimalOperationsImpl getAnimalOperations() { - return this.animalOperations; - } - - /** - * The PetOperationsImpl object to access its operations. - */ - private final PetOperationsImpl petOperations; - - /** - * Gets the PetOperationsImpl object to access its operations. - * - * @return the PetOperationsImpl object. - */ - public PetOperationsImpl getPetOperations() { - return this.petOperations; - } - - /** - * The DogOperationsImpl object to access its operations. - */ - private final DogOperationsImpl dogOperations; - - /** - * Gets the DogOperationsImpl object to access its operations. - * - * @return the DogOperationsImpl object. - */ - public DogOperationsImpl getDogOperations() { - return this.dogOperations; - } - - /** - * Initializes an instance of HierarchyBuildingClient client. - * - * @param endpoint Service host. - */ - public HierarchyBuildingClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of HierarchyBuildingClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public HierarchyBuildingClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of HierarchyBuildingClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public HierarchyBuildingClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.animalOperations = new AnimalOperationsImpl(this); - this.petOperations = new PetOperationsImpl(this); - this.dogOperations = new DogOperationsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/PetOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/PetOperationsImpl.java deleted file mode 100644 index 4d8d85821cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/PetOperationsImpl.java +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PetOperations. - */ -public final class PetOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PetOperationsService service; - - /** - * The service client containing this operation class. - */ - private final HierarchyBuildingClientImpl client; - - /** - * Initializes an instance of PetOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PetOperationsImpl(HierarchyBuildingClientImpl client) { - this.service - = RestProxy.create(PetOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for HierarchyBuildingClientPetOperations to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "HierarchyBuildingClientPetOperations") - public interface PetOperationsService { - @Put("/azure/client-generator-core/hierarchy-building/pet/as-pet") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> updatePetAsPet(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData pet, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/hierarchy-building/pet/as-pet") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response updatePetAsPetSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData pet, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/hierarchy-building/dog/as-pet") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> updateDogAsPet(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData pet, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/hierarchy-building/dog/as-pet") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response updateDogAsPetSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData pet, RequestOptions requestOptions, Context context); - } - - /** - * Update a pet as a pet. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param pet The pet parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updatePetAsPetWithResponseAsync(BinaryData pet, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.updatePetAsPet(this.client.getEndpoint(), contentType, accept, - pet, requestOptions, context)); - } - - /** - * Update a pet as a pet. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param pet The pet parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updatePetAsPetWithResponse(BinaryData pet, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updatePetAsPetSync(this.client.getEndpoint(), contentType, accept, pet, requestOptions, - Context.NONE); - } - - /** - * Update a dog as a pet. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param pet The pet parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateDogAsPetWithResponseAsync(BinaryData pet, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.updateDogAsPet(this.client.getEndpoint(), contentType, accept, - pet, requestOptions, context)); - } - - /** - * Update a dog as a pet. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *     trained: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param pet The pet parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateDogAsPetWithResponse(BinaryData pet, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateDogAsPetSync(this.client.getEndpoint(), contentType, accept, pet, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/package-info.java deleted file mode 100644 index c2f03d0a8c9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for HierarchyBuilding. - * Test for @hierarchyBuilding decorator. - * - */ -package azure.clientgenerator.core.hierarchybuilding.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Animal.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Animal.java deleted file mode 100644 index ffee228ac27..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Animal.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Animal model. - */ -@Immutable -public class Animal implements JsonSerializable { - /* - * The kind of animal - */ - @Generated - private String kind = "Animal"; - - /* - * Name of the animal - */ - @Generated - private final String name; - - /** - * Creates an instance of Animal class. - * - * @param name the name value to set. - */ - @Generated - public Animal(String name) { - this.name = name; - } - - /** - * Get the kind property: The kind of animal. - * - * @return the kind value. - */ - @Generated - public String getKind() { - return this.kind; - } - - /** - * Get the name property: Name of the animal. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Animal from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Animal if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Animal. - */ - @Generated - public static Animal fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("pet".equals(discriminatorValue)) { - return Pet.fromJsonKnownDiscriminator(readerToUse.reset()); - } else if ("dog".equals(discriminatorValue)) { - return Dog.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Animal fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - String kind = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - Animal deserializedAnimal = new Animal(name); - deserializedAnimal.kind = kind; - - return deserializedAnimal; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Dog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Dog.java deleted file mode 100644 index e4022f5e308..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Dog.java +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Dog model. - */ -@Immutable -public final class Dog extends Pet { - /* - * The kind property. - */ - @Generated - private String kind = "dog"; - - /* - * The breed of the dog - */ - @Generated - private final String breed; - - /** - * Creates an instance of Dog class. - * - * @param name the name value to set. - * @param trained the trained value to set. - * @param breed the breed value to set. - */ - @Generated - public Dog(String name, boolean trained, String breed) { - super(name, trained); - this.breed = breed; - } - - /** - * Get the kind property: The kind property. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * Get the breed property: The breed of the dog. - * - * @return the breed value. - */ - @Generated - public String getBreed() { - return this.breed; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", getName()); - jsonWriter.writeBooleanField("trained", isTrained()); - jsonWriter.writeStringField("breed", this.breed); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Dog from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Dog if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Dog. - */ - @Generated - public static Dog fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - boolean trained = false; - String breed = null; - String kind = "dog"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("trained".equals(fieldName)) { - trained = reader.getBoolean(); - } else if ("breed".equals(fieldName)) { - breed = reader.getString(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - Dog deserializedDog = new Dog(name, trained, breed); - deserializedDog.kind = kind; - - return deserializedDog; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Pet.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Pet.java deleted file mode 100644 index 5b834dd247d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Pet.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Pet model. - */ -@Immutable -public class Pet extends Animal { - /* - * The kind property. - */ - @Generated - private String kind = "pet"; - - /* - * Whether the pet is trained - */ - @Generated - private final boolean trained; - - /** - * Creates an instance of Pet class. - * - * @param name the name value to set. - * @param trained the trained value to set. - */ - @Generated - public Pet(String name, boolean trained) { - super(name); - this.trained = trained; - } - - /** - * Get the kind property: The kind property. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * Get the trained property: Whether the pet is trained. - * - * @return the trained value. - */ - @Generated - public boolean isTrained() { - return this.trained; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", getName()); - jsonWriter.writeBooleanField("trained", this.trained); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Pet from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Pet if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Pet. - */ - @Generated - public static Pet fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("dog".equals(discriminatorValue)) { - return Dog.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Pet fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - boolean trained = false; - String kind = "pet"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("trained".equals(fieldName)) { - trained = reader.getBoolean(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - Pet deserializedPet = new Pet(name, trained); - deserializedPet.kind = kind; - - return deserializedPet; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/package-info.java deleted file mode 100644 index 631f1b5d26a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for HierarchyBuilding. - * Test for @hierarchyBuilding decorator. - * - */ -package azure.clientgenerator.core.hierarchybuilding.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/package-info.java deleted file mode 100644 index db4fb851dd6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for HierarchyBuilding. - * Test for @hierarchyBuilding decorator. - * - */ -package azure.clientgenerator.core.hierarchybuilding; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java deleted file mode 100644 index c70d5799f04..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride; - -import azure.clientgenerator.core.methodoverride.implementation.GroupParametersImpl; -import azure.clientgenerator.core.methodoverride.models.GroupParametersOptions; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous OverrideClient type. - */ -@ServiceClient(builder = OverrideClientBuilder.class, isAsync = true) -public final class GroupParametersAsyncClient { - @Generated - private final GroupParametersImpl serviceClient; - - /** - * Initializes an instance of GroupParametersAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - GroupParametersAsyncClient(GroupParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The group operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupWithResponse(String param1, String param2, RequestOptions requestOptions) { - return this.serviceClient.groupWithResponseAsync(param1, param2, requestOptions); - } - - /** - * The group operation. - * - * @param options The options parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono group(GroupParametersOptions options) { - // Generated convenience method for groupWithResponse - RequestOptions requestOptions = new RequestOptions(); - String param1 = options.getParam1(); - String param2 = options.getParam2(); - return groupWithResponse(param1, param2, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java deleted file mode 100644 index 66d1ae1fe96..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride; - -import azure.clientgenerator.core.methodoverride.implementation.GroupParametersImpl; -import azure.clientgenerator.core.methodoverride.models.GroupParametersOptions; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous OverrideClient type. - */ -@ServiceClient(builder = OverrideClientBuilder.class) -public final class GroupParametersClient { - @Generated - private final GroupParametersImpl serviceClient; - - /** - * Initializes an instance of GroupParametersClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - GroupParametersClient(GroupParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The group operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupWithResponse(String param1, String param2, RequestOptions requestOptions) { - return this.serviceClient.groupWithResponse(param1, param2, requestOptions); - } - - /** - * The group operation. - * - * @param options The options parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void group(GroupParametersOptions options) { - // Generated convenience method for groupWithResponse - RequestOptions requestOptions = new RequestOptions(); - String param1 = options.getParam1(); - String param2 = options.getParam2(); - groupWithResponse(param1, param2, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/OverrideClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/OverrideClientBuilder.java deleted file mode 100644 index 4bd811b5ae6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/OverrideClientBuilder.java +++ /dev/null @@ -1,357 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride; - -import azure.clientgenerator.core.methodoverride.implementation.OverrideClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the OverrideClient type. - */ -@ServiceClientBuilder( - serviceClients = { - ReorderParametersClient.class, - GroupParametersClient.class, - RequireOptionalParameterClient.class, - RemoveOptionalParameterClient.class, - ReorderParametersAsyncClient.class, - GroupParametersAsyncClient.class, - RequireOptionalParameterAsyncClient.class, - RemoveOptionalParameterAsyncClient.class }) -public final class OverrideClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-methodoverride.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the OverrideClientBuilder. - */ - @Generated - public OverrideClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverrideClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverrideClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverrideClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverrideClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverrideClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverrideClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverrideClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverrideClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the OverrideClientBuilder. - */ - @Generated - public OverrideClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of OverrideClientImpl with the provided parameters. - * - * @return an instance of OverrideClientImpl. - */ - @Generated - private OverrideClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - OverrideClientImpl client - = new OverrideClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ReorderParametersAsyncClient class. - * - * @return an instance of ReorderParametersAsyncClient. - */ - @Generated - public ReorderParametersAsyncClient buildReorderParametersAsyncClient() { - return new ReorderParametersAsyncClient(buildInnerClient().getReorderParameters()); - } - - /** - * Builds an instance of GroupParametersAsyncClient class. - * - * @return an instance of GroupParametersAsyncClient. - */ - @Generated - public GroupParametersAsyncClient buildGroupParametersAsyncClient() { - return new GroupParametersAsyncClient(buildInnerClient().getGroupParameters()); - } - - /** - * Builds an instance of RequireOptionalParameterAsyncClient class. - * - * @return an instance of RequireOptionalParameterAsyncClient. - */ - @Generated - public RequireOptionalParameterAsyncClient buildRequireOptionalParameterAsyncClient() { - return new RequireOptionalParameterAsyncClient(buildInnerClient().getRequireOptionalParameters()); - } - - /** - * Builds an instance of RemoveOptionalParameterAsyncClient class. - * - * @return an instance of RemoveOptionalParameterAsyncClient. - */ - @Generated - public RemoveOptionalParameterAsyncClient buildRemoveOptionalParameterAsyncClient() { - return new RemoveOptionalParameterAsyncClient(buildInnerClient().getRemoveOptionalParameters()); - } - - /** - * Builds an instance of ReorderParametersClient class. - * - * @return an instance of ReorderParametersClient. - */ - @Generated - public ReorderParametersClient buildReorderParametersClient() { - return new ReorderParametersClient(buildInnerClient().getReorderParameters()); - } - - /** - * Builds an instance of GroupParametersClient class. - * - * @return an instance of GroupParametersClient. - */ - @Generated - public GroupParametersClient buildGroupParametersClient() { - return new GroupParametersClient(buildInnerClient().getGroupParameters()); - } - - /** - * Builds an instance of RequireOptionalParameterClient class. - * - * @return an instance of RequireOptionalParameterClient. - */ - @Generated - public RequireOptionalParameterClient buildRequireOptionalParameterClient() { - return new RequireOptionalParameterClient(buildInnerClient().getRequireOptionalParameters()); - } - - /** - * Builds an instance of RemoveOptionalParameterClient class. - * - * @return an instance of RemoveOptionalParameterClient. - */ - @Generated - public RemoveOptionalParameterClient buildRemoveOptionalParameterClient() { - return new RemoveOptionalParameterClient(buildInnerClient().getRemoveOptionalParameters()); - } - - private static final ClientLogger LOGGER = new ClientLogger(OverrideClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterAsyncClient.java deleted file mode 100644 index d7aaffbd93e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterAsyncClient.java +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride; - -import azure.clientgenerator.core.methodoverride.implementation.RemoveOptionalParametersImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous OverrideClient type. - */ -@ServiceClient(builder = OverrideClientBuilder.class, isAsync = true) -public final class RemoveOptionalParameterAsyncClient { - @Generated - private final RemoveOptionalParametersImpl serviceClient; - - /** - * Initializes an instance of RemoveOptionalParameterAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RemoveOptionalParameterAsyncClient(RemoveOptionalParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The removeOptional operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
param2StringNoThe param2 parameter
param3StringNoThe param3 parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
param4StringNoThe param4 parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param param1 The param1 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> removeOptionalWithResponse(String param1, RequestOptions requestOptions) { - return this.serviceClient.removeOptionalWithResponseAsync(param1, requestOptions); - } - - /** - * The removeOptional operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono removeOptional(String param1, String param2) { - // Generated convenience method for removeOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (param2 != null) { - requestOptions.addQueryParam("param2", param2, false); - } - return removeOptionalWithResponse(param1, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The removeOptional operation. - * - * @param param1 The param1 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono removeOptional(String param1) { - // Generated convenience method for removeOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return removeOptionalWithResponse(param1, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterClient.java deleted file mode 100644 index 55dcc010b67..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterClient.java +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride; - -import azure.clientgenerator.core.methodoverride.implementation.RemoveOptionalParametersImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous OverrideClient type. - */ -@ServiceClient(builder = OverrideClientBuilder.class) -public final class RemoveOptionalParameterClient { - @Generated - private final RemoveOptionalParametersImpl serviceClient; - - /** - * Initializes an instance of RemoveOptionalParameterClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RemoveOptionalParameterClient(RemoveOptionalParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The removeOptional operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
param2StringNoThe param2 parameter
param3StringNoThe param3 parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
param4StringNoThe param4 parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param param1 The param1 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response removeOptionalWithResponse(String param1, RequestOptions requestOptions) { - return this.serviceClient.removeOptionalWithResponse(param1, requestOptions); - } - - /** - * The removeOptional operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void removeOptional(String param1, String param2) { - // Generated convenience method for removeOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (param2 != null) { - requestOptions.addQueryParam("param2", param2, false); - } - removeOptionalWithResponse(param1, requestOptions).getValue(); - } - - /** - * The removeOptional operation. - * - * @param param1 The param1 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void removeOptional(String param1) { - // Generated convenience method for removeOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - removeOptionalWithResponse(param1, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersAsyncClient.java deleted file mode 100644 index 8480fd46ce6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersAsyncClient.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride; - -import azure.clientgenerator.core.methodoverride.implementation.ReorderParametersImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous OverrideClient type. - */ -@ServiceClient(builder = OverrideClientBuilder.class, isAsync = true) -public final class ReorderParametersAsyncClient { - @Generated - private final ReorderParametersImpl serviceClient; - - /** - * Initializes an instance of ReorderParametersAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ReorderParametersAsyncClient(ReorderParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The reorder operation. - * - * @param param2 The param2 parameter. - * @param param1 The param1 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> reorderWithResponse(String param2, String param1, RequestOptions requestOptions) { - return this.serviceClient.reorderWithResponseAsync(param2, param1, requestOptions); - } - - /** - * The reorder operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono reorder(String param1, String param2) { - // Generated convenience method for reorderWithResponse - RequestOptions requestOptions = new RequestOptions(); - return reorderWithResponse(param2, param1, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersClient.java deleted file mode 100644 index 6ca922852e5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersClient.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride; - -import azure.clientgenerator.core.methodoverride.implementation.ReorderParametersImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous OverrideClient type. - */ -@ServiceClient(builder = OverrideClientBuilder.class) -public final class ReorderParametersClient { - @Generated - private final ReorderParametersImpl serviceClient; - - /** - * Initializes an instance of ReorderParametersClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ReorderParametersClient(ReorderParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The reorder operation. - * - * @param param2 The param2 parameter. - * @param param1 The param1 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response reorderWithResponse(String param2, String param1, RequestOptions requestOptions) { - return this.serviceClient.reorderWithResponse(param2, param1, requestOptions); - } - - /** - * The reorder operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void reorder(String param1, String param2) { - // Generated convenience method for reorderWithResponse - RequestOptions requestOptions = new RequestOptions(); - reorderWithResponse(param2, param1, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterAsyncClient.java deleted file mode 100644 index ed6366f3563..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterAsyncClient.java +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride; - -import azure.clientgenerator.core.methodoverride.implementation.RequireOptionalParametersImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous OverrideClient type. - */ -@ServiceClient(builder = OverrideClientBuilder.class, isAsync = true) -public final class RequireOptionalParameterAsyncClient { - @Generated - private final RequireOptionalParametersImpl serviceClient; - - /** - * Initializes an instance of RequireOptionalParameterAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RequireOptionalParameterAsyncClient(RequireOptionalParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The requireOptional operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requireOptionalWithResponse(String param1, String param2, - RequestOptions requestOptions) { - return this.serviceClient.requireOptionalWithResponseAsync(param1, param2, requestOptions); - } - - /** - * The requireOptional operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono requireOptional(String param1, String param2) { - // Generated convenience method for requireOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return requireOptionalWithResponse(param1, param2, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterClient.java deleted file mode 100644 index 2731177caa0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterClient.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride; - -import azure.clientgenerator.core.methodoverride.implementation.RequireOptionalParametersImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous OverrideClient type. - */ -@ServiceClient(builder = OverrideClientBuilder.class) -public final class RequireOptionalParameterClient { - @Generated - private final RequireOptionalParametersImpl serviceClient; - - /** - * Initializes an instance of RequireOptionalParameterClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RequireOptionalParameterClient(RequireOptionalParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The requireOptional operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requireOptionalWithResponse(String param1, String param2, RequestOptions requestOptions) { - return this.serviceClient.requireOptionalWithResponse(param1, param2, requestOptions); - } - - /** - * The requireOptional operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void requireOptional(String param1, String param2) { - // Generated convenience method for requireOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - requireOptionalWithResponse(param1, param2, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java deleted file mode 100644 index f3a671c175e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in GroupParameters. - */ -public final class GroupParametersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final GroupParametersService service; - - /** - * The service client containing this operation class. - */ - private final OverrideClientImpl client; - - /** - * Initializes an instance of GroupParametersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - GroupParametersImpl(OverrideClientImpl client) { - this.service - = RestProxy.create(GroupParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OverrideClientGroupParameters to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OverrideClientGroupParameters") - public interface GroupParametersService { - @Get("/azure/client-generator-core/override/group") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> group(@HostParam("endpoint") String endpoint, @QueryParam("param1") String param1, - @QueryParam("param2") String param2, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/override/group") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response groupSync(@HostParam("endpoint") String endpoint, @QueryParam("param1") String param1, - @QueryParam("param2") String param2, RequestOptions requestOptions, Context context); - } - - /** - * The group operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupWithResponseAsync(String param1, String param2, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.group(this.client.getEndpoint(), param1, param2, requestOptions, context)); - } - - /** - * The group operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupWithResponse(String param1, String param2, RequestOptions requestOptions) { - return service.groupSync(this.client.getEndpoint(), param1, param2, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/OverrideClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/OverrideClientImpl.java deleted file mode 100644 index 68bac3d9fc5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/OverrideClientImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 OverrideClient type. - */ -public final class OverrideClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 ReorderParametersImpl object to access its operations. - */ - private final ReorderParametersImpl reorderParameters; - - /** - * Gets the ReorderParametersImpl object to access its operations. - * - * @return the ReorderParametersImpl object. - */ - public ReorderParametersImpl getReorderParameters() { - return this.reorderParameters; - } - - /** - * The GroupParametersImpl object to access its operations. - */ - private final GroupParametersImpl groupParameters; - - /** - * Gets the GroupParametersImpl object to access its operations. - * - * @return the GroupParametersImpl object. - */ - public GroupParametersImpl getGroupParameters() { - return this.groupParameters; - } - - /** - * The RequireOptionalParametersImpl object to access its operations. - */ - private final RequireOptionalParametersImpl requireOptionalParameters; - - /** - * Gets the RequireOptionalParametersImpl object to access its operations. - * - * @return the RequireOptionalParametersImpl object. - */ - public RequireOptionalParametersImpl getRequireOptionalParameters() { - return this.requireOptionalParameters; - } - - /** - * The RemoveOptionalParametersImpl object to access its operations. - */ - private final RemoveOptionalParametersImpl removeOptionalParameters; - - /** - * Gets the RemoveOptionalParametersImpl object to access its operations. - * - * @return the RemoveOptionalParametersImpl object. - */ - public RemoveOptionalParametersImpl getRemoveOptionalParameters() { - return this.removeOptionalParameters; - } - - /** - * Initializes an instance of OverrideClient client. - * - * @param endpoint Service host. - */ - public OverrideClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of OverrideClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public OverrideClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of OverrideClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public OverrideClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.reorderParameters = new ReorderParametersImpl(this); - this.groupParameters = new GroupParametersImpl(this); - this.requireOptionalParameters = new RequireOptionalParametersImpl(this); - this.removeOptionalParameters = new RemoveOptionalParametersImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RemoveOptionalParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RemoveOptionalParametersImpl.java deleted file mode 100644 index 8a70698b293..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RemoveOptionalParametersImpl.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in RemoveOptionalParameters. - */ -public final class RemoveOptionalParametersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RemoveOptionalParametersService service; - - /** - * The service client containing this operation class. - */ - private final OverrideClientImpl client; - - /** - * Initializes an instance of RemoveOptionalParametersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - RemoveOptionalParametersImpl(OverrideClientImpl client) { - this.service = RestProxy.create(RemoveOptionalParametersService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OverrideClientRemoveOptionalParameters to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OverrideClientRemoveOptionalParameters") - public interface RemoveOptionalParametersService { - @Get("/azure/client-generator-core/override/remove-optional/{param1}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> removeOptional(@HostParam("endpoint") String endpoint, @PathParam("param1") String param1, - RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/override/remove-optional/{param1}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response removeOptionalSync(@HostParam("endpoint") String endpoint, @PathParam("param1") String param1, - RequestOptions requestOptions, Context context); - } - - /** - * The removeOptional operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
param2StringNoThe param2 parameter
param3StringNoThe param3 parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
param4StringNoThe param4 parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param param1 The param1 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> removeOptionalWithResponseAsync(String param1, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.removeOptional(this.client.getEndpoint(), param1, requestOptions, context)); - } - - /** - * The removeOptional operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
param2StringNoThe param2 parameter
param3StringNoThe param3 parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
param4StringNoThe param4 parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param param1 The param1 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response removeOptionalWithResponse(String param1, RequestOptions requestOptions) { - return service.removeOptionalSync(this.client.getEndpoint(), param1, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/ReorderParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/ReorderParametersImpl.java deleted file mode 100644 index b75f33756c2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/ReorderParametersImpl.java +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ReorderParameters. - */ -public final class ReorderParametersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ReorderParametersService service; - - /** - * The service client containing this operation class. - */ - private final OverrideClientImpl client; - - /** - * Initializes an instance of ReorderParametersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ReorderParametersImpl(OverrideClientImpl client) { - this.service - = RestProxy.create(ReorderParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OverrideClientReorderParameters to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OverrideClientReorderParameters") - public interface ReorderParametersService { - @Get("/azure/client-generator-core/override/reorder/{param2}/{param1}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> reorder(@HostParam("endpoint") String endpoint, @PathParam("param2") String param2, - @PathParam("param1") String param1, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/override/reorder/{param2}/{param1}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response reorderSync(@HostParam("endpoint") String endpoint, @PathParam("param2") String param2, - @PathParam("param1") String param1, RequestOptions requestOptions, Context context); - } - - /** - * The reorder operation. - * - * @param param2 The param2 parameter. - * @param param1 The param1 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> reorderWithResponseAsync(String param2, String param1, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.reorder(this.client.getEndpoint(), param2, param1, requestOptions, context)); - } - - /** - * The reorder operation. - * - * @param param2 The param2 parameter. - * @param param1 The param1 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response reorderWithResponse(String param2, String param1, RequestOptions requestOptions) { - return service.reorderSync(this.client.getEndpoint(), param2, param1, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RequireOptionalParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RequireOptionalParametersImpl.java deleted file mode 100644 index 52f1ce8fc5f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RequireOptionalParametersImpl.java +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in RequireOptionalParameters. - */ -public final class RequireOptionalParametersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RequireOptionalParametersService service; - - /** - * The service client containing this operation class. - */ - private final OverrideClientImpl client; - - /** - * Initializes an instance of RequireOptionalParametersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - RequireOptionalParametersImpl(OverrideClientImpl client) { - this.service = RestProxy.create(RequireOptionalParametersService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OverrideClientRequireOptionalParameters to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OverrideClientRequireOptionalParameters") - public interface RequireOptionalParametersService { - @Get("/azure/client-generator-core/override/require-optional/{param1}/{param2}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> requireOptional(@HostParam("endpoint") String endpoint, @PathParam("param1") String param1, - @PathParam("param2") String param2, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/override/require-optional/{param1}/{param2}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response requireOptionalSync(@HostParam("endpoint") String endpoint, @PathParam("param1") String param1, - @PathParam("param2") String param2, RequestOptions requestOptions, Context context); - } - - /** - * The requireOptional operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requireOptionalWithResponseAsync(String param1, String param2, - RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.requireOptional(this.client.getEndpoint(), param1, param2, requestOptions, context)); - } - - /** - * The requireOptional operation. - * - * @param param1 The param1 parameter. - * @param param2 The param2 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requireOptionalWithResponse(String param1, String param2, RequestOptions requestOptions) { - return service.requireOptionalSync(this.client.getEndpoint(), param1, param2, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/package-info.java deleted file mode 100644 index 1d7dfa6e5d3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for OverrideModel. - * Test scenarios for client override behavior. - * - */ -package azure.clientgenerator.core.methodoverride.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/GroupParametersOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/GroupParametersOptions.java deleted file mode 100644 index 0c6ffb8a071..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/GroupParametersOptions.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; - -/** - * The GroupParametersOptions model. - */ -@Immutable -public final class GroupParametersOptions { - /* - * The param1 property. - */ - @Generated - private final String param1; - - /* - * The param2 property. - */ - @Generated - private final String param2; - - /** - * Creates an instance of GroupParametersOptions class. - * - * @param param1 the param1 value to set. - * @param param2 the param2 value to set. - */ - @Generated - public GroupParametersOptions(String param1, String param2) { - this.param1 = param1; - this.param2 = param2; - } - - /** - * Get the param1 property: The param1 property. - * - * @return the param1 value. - */ - @Generated - public String getParam1() { - return this.param1; - } - - /** - * Get the param2 property: The param2 property. - * - * @return the param2 value. - */ - @Generated - public String getParam2() { - return this.param2; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/package-info.java deleted file mode 100644 index 3f84a575362..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for OverrideModel. - * Test scenarios for client override behavior. - * - */ -package azure.clientgenerator.core.methodoverride.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/package-info.java deleted file mode 100644 index cf07b420472..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for OverrideModel. - * Test scenarios for client override behavior. - * - */ -package azure.clientgenerator.core.methodoverride; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbAsyncClient.java deleted file mode 100644 index ceaadd6b727..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbAsyncClient.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.nextlinkverb; - -import azure.clientgenerator.core.nextlinkverb.implementation.NextLinkVerbClientImpl; -import azure.clientgenerator.core.nextlinkverb.models.Test; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import java.util.stream.Collectors; -import reactor.core.publisher.Flux; - -/** - * Initializes a new instance of the asynchronous NextLinkVerbClient type. - */ -@ServiceClient(builder = NextLinkVerbClientBuilder.class, isAsync = true) -public final class NextLinkVerbAsyncClient { - @Generated - private final NextLinkVerbClientImpl serviceClient; - - /** - * Initializes an instance of NextLinkVerbAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NextLinkVerbAsyncClient(NextLinkVerbClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The listItems operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged response model as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listItems(RequestOptions requestOptions) { - return this.serviceClient.listItemsAsync(requestOptions); - } - - /** - * The listItems operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged response model as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listItems() { - // Generated convenience method for listItems - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listItems(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(Test.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClient.java deleted file mode 100644 index e88b934d7a9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClient.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.nextlinkverb; - -import azure.clientgenerator.core.nextlinkverb.implementation.NextLinkVerbClientImpl; -import azure.clientgenerator.core.nextlinkverb.models.Test; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous NextLinkVerbClient type. - */ -@ServiceClient(builder = NextLinkVerbClientBuilder.class) -public final class NextLinkVerbClient { - @Generated - private final NextLinkVerbClientImpl serviceClient; - - /** - * Initializes an instance of NextLinkVerbClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NextLinkVerbClient(NextLinkVerbClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The listItems operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged response model as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listItems(RequestOptions requestOptions) { - return this.serviceClient.listItems(requestOptions); - } - - /** - * The listItems operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged response model as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listItems() { - // Generated convenience method for listItems - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listItems(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Test.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClientBuilder.java deleted file mode 100644 index 9e1f3614e98..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.nextlinkverb; - -import azure.clientgenerator.core.nextlinkverb.implementation.NextLinkVerbClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the NextLinkVerbClient type. - */ -@ServiceClientBuilder(serviceClients = { NextLinkVerbClient.class, NextLinkVerbAsyncClient.class }) -public final class NextLinkVerbClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-nextlinkverb.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the NextLinkVerbClientBuilder. - */ - @Generated - public NextLinkVerbClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NextLinkVerbClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NextLinkVerbClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NextLinkVerbClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NextLinkVerbClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NextLinkVerbClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NextLinkVerbClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NextLinkVerbClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NextLinkVerbClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the NextLinkVerbClientBuilder. - */ - @Generated - public NextLinkVerbClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of NextLinkVerbClientImpl with the provided parameters. - * - * @return an instance of NextLinkVerbClientImpl. - */ - @Generated - private NextLinkVerbClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - NextLinkVerbClientImpl client - = new NextLinkVerbClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of NextLinkVerbAsyncClient class. - * - * @return an instance of NextLinkVerbAsyncClient. - */ - @Generated - public NextLinkVerbAsyncClient buildAsyncClient() { - return new NextLinkVerbAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of NextLinkVerbClient class. - * - * @return an instance of NextLinkVerbClient. - */ - @Generated - public NextLinkVerbClient buildClient() { - return new NextLinkVerbClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(NextLinkVerbClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/NextLinkVerbClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/NextLinkVerbClientImpl.java deleted file mode 100644 index 86da457c2c6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/NextLinkVerbClientImpl.java +++ /dev/null @@ -1,362 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.nextlinkverb.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -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.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the NextLinkVerbClient type. - */ -public final class NextLinkVerbClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NextLinkVerbClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of NextLinkVerbClient client. - * - * @param endpoint Service host. - */ - public NextLinkVerbClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NextLinkVerbClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public NextLinkVerbClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NextLinkVerbClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public NextLinkVerbClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(NextLinkVerbClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for NextLinkVerbClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NextLinkVerbClient") - public interface NextLinkVerbClientService { - @Post("/azure/client-generator-core/next-link-verb/items") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listItems(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/azure/client-generator-core/next-link-verb/items") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listItemsSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listItemsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Post("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listItemsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * The listItems operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged response model along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listItemsSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listItems(this.getEndpoint(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * The listItems operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged response model as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listItemsAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listItemsSinglePageAsync(requestOptions), - nextLink -> listItemsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); - } - - /** - * The listItems operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged response model along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listItemsSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listItemsSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * The listItems operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged response model as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listItems(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listItemsSinglePage(requestOptions), - nextLink -> listItemsNextSinglePage(nextLink, requestOptionsForNextPage)); - } - - /** - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged response model along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listItemsNextSinglePageAsync(String nextLink, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listItemsNext(nextLink, this.getEndpoint(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged response model along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listItemsNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listItemsNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null); - } - - private List getValues(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - List values = (List) obj.get(path); - return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); - } catch (RuntimeException e) { - return null; - } - } - - private String getNextLink(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - return (String) obj.get(path); - } catch (RuntimeException e) { - return null; - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/package-info.java deleted file mode 100644 index 93f6358e5f6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for NextLinkVerb. - * Test for @nextLinkVerb decorator. - * - */ -package azure.clientgenerator.core.nextlinkverb.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/Test.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/Test.java deleted file mode 100644 index 357ccddf984..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/Test.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.nextlinkverb.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Test model. - */ -@Immutable -public final class Test implements JsonSerializable { - /* - * The id of the test. - */ - @Generated - private final String id; - - /** - * Creates an instance of Test class. - * - * @param id the id value to set. - */ - @Generated - private Test(String id) { - this.id = id; - } - - /** - * Get the id property: The id of the test. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Test from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Test if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Test. - */ - @Generated - public static Test fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Test(id); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/package-info.java deleted file mode 100644 index c889bfde4a1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for NextLinkVerb. - * Test for @nextLinkVerb decorator. - * - */ -package azure.clientgenerator.core.nextlinkverb.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/package-info.java deleted file mode 100644 index ea516924dcf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for NextLinkVerb. - * Test for @nextLinkVerb decorator. - * - */ -package azure.clientgenerator.core.nextlinkverb; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageAsyncClient.java deleted file mode 100644 index 38ae7bba90a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageAsyncClient.java +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.usage; - -import azure.clientgenerator.core.usage.implementation.ModelInOperationsImpl; -import azure.clientgenerator.core.usage.models.InputModel; -import azure.clientgenerator.core.usage.models.OutputModel; -import azure.clientgenerator.core.usage.models.RoundTripModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous UsageClient type. - */ -@ServiceClient(builder = UsageClientBuilder.class, isAsync = true) -public final class UsageAsyncClient { - @Generated - private final ModelInOperationsImpl serviceClient; - - /** - * Initializes an instance of UsageAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UsageAsyncClient(ModelInOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Expected body parameter: - * ```json - * { - * "name": "Madge" - * } - * ```. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> inputToInputOutputWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.inputToInputOutputWithResponseAsync(body, requestOptions); - } - - /** - * Expected response body: - * ```json - * { - * "name": "Madge" - * } - * ```. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return usage additive to roundtrip along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> outputToInputOutputWithResponse(RequestOptions requestOptions) { - return this.serviceClient.outputToInputOutputWithResponseAsync(requestOptions); - } - - /** - * "ResultModel" should be usage=output, as it is read-only and does not exist in request body. - * - * Expected body parameter: - * ```json - * { - * } - * ``` - * - * Expected response body: - * ```json - * { - * "result": { - * "name": "Madge" - * } - * } - * ```. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     result (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     result (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> modelInReadOnlyPropertyWithResponse(BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.modelInReadOnlyPropertyWithResponseAsync(body, requestOptions); - } - - /** - * Serialize the 'OrphanModel' as request body. - * - * Expected body parameter: - * ```json - * { - * "name": "name", - * "desc": "desc" - * } - * ```. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> orphanModelSerializableWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.orphanModelSerializableWithResponseAsync(body, requestOptions); - } - - /** - * Expected body parameter: - * ```json - * { - * "name": "Madge" - * } - * ```. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono inputToInputOutput(InputModel body) { - // Generated convenience method for inputToInputOutputWithResponse - RequestOptions requestOptions = new RequestOptions(); - return inputToInputOutputWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Expected response body: - * ```json - * { - * "name": "Madge" - * } - * ```. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return usage additive to roundtrip on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono outputToInputOutput() { - // Generated convenience method for outputToInputOutputWithResponse - RequestOptions requestOptions = new RequestOptions(); - return outputToInputOutputWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(OutputModel.class)); - } - - /** - * "ResultModel" should be usage=output, as it is read-only and does not exist in request body. - * - * Expected body parameter: - * ```json - * { - * } - * ``` - * - * Expected response body: - * ```json - * { - * "result": { - * "name": "Madge" - * } - * } - * ```. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono modelInReadOnlyProperty(RoundTripModel body) { - // Generated convenience method for modelInReadOnlyPropertyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return modelInReadOnlyPropertyWithResponse(BinaryData.fromObject(body), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(RoundTripModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClient.java deleted file mode 100644 index e42a3e9318a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClient.java +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.usage; - -import azure.clientgenerator.core.usage.implementation.ModelInOperationsImpl; -import azure.clientgenerator.core.usage.models.InputModel; -import azure.clientgenerator.core.usage.models.OutputModel; -import azure.clientgenerator.core.usage.models.RoundTripModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous UsageClient type. - */ -@ServiceClient(builder = UsageClientBuilder.class) -public final class UsageClient { - @Generated - private final ModelInOperationsImpl serviceClient; - - /** - * Initializes an instance of UsageClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UsageClient(ModelInOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Expected body parameter: - * ```json - * { - * "name": "Madge" - * } - * ```. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response inputToInputOutputWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.inputToInputOutputWithResponse(body, requestOptions); - } - - /** - * Expected response body: - * ```json - * { - * "name": "Madge" - * } - * ```. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return usage additive to roundtrip along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response outputToInputOutputWithResponse(RequestOptions requestOptions) { - return this.serviceClient.outputToInputOutputWithResponse(requestOptions); - } - - /** - * "ResultModel" should be usage=output, as it is read-only and does not exist in request body. - * - * Expected body parameter: - * ```json - * { - * } - * ``` - * - * Expected response body: - * ```json - * { - * "result": { - * "name": "Madge" - * } - * } - * ```. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     result (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     result (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response modelInReadOnlyPropertyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.modelInReadOnlyPropertyWithResponse(body, requestOptions); - } - - /** - * Serialize the 'OrphanModel' as request body. - * - * Expected body parameter: - * ```json - * { - * "name": "name", - * "desc": "desc" - * } - * ```. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response orphanModelSerializableWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.orphanModelSerializableWithResponse(body, requestOptions); - } - - /** - * Expected body parameter: - * ```json - * { - * "name": "Madge" - * } - * ```. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void inputToInputOutput(InputModel body) { - // Generated convenience method for inputToInputOutputWithResponse - RequestOptions requestOptions = new RequestOptions(); - inputToInputOutputWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Expected response body: - * ```json - * { - * "name": "Madge" - * } - * ```. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return usage additive to roundtrip. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public OutputModel outputToInputOutput() { - // Generated convenience method for outputToInputOutputWithResponse - RequestOptions requestOptions = new RequestOptions(); - return outputToInputOutputWithResponse(requestOptions).getValue().toObject(OutputModel.class); - } - - /** - * "ResultModel" should be usage=output, as it is read-only and does not exist in request body. - * - * Expected body parameter: - * ```json - * { - * } - * ``` - * - * Expected response body: - * ```json - * { - * "result": { - * "name": "Madge" - * } - * } - * ```. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public RoundTripModel modelInReadOnlyProperty(RoundTripModel body) { - // Generated convenience method for modelInReadOnlyPropertyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return modelInReadOnlyPropertyWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(RoundTripModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClientBuilder.java deleted file mode 100644 index bf4b3328114..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.usage; - -import azure.clientgenerator.core.usage.implementation.UsageClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the UsageClient type. - */ -@ServiceClientBuilder(serviceClients = { UsageClient.class, UsageAsyncClient.class }) -public final class UsageClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-clientgenerator-core-usage.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the UsageClientBuilder. - */ - @Generated - public UsageClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the UsageClientBuilder. - */ - @Generated - public UsageClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of UsageClientImpl with the provided parameters. - * - * @return an instance of UsageClientImpl. - */ - @Generated - private UsageClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - UsageClientImpl client - = new UsageClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of UsageAsyncClient class. - * - * @return an instance of UsageAsyncClient. - */ - @Generated - public UsageAsyncClient buildAsyncClient() { - return new UsageAsyncClient(buildInnerClient().getModelInOperations()); - } - - /** - * Builds an instance of UsageClient class. - * - * @return an instance of UsageClient. - */ - @Generated - public UsageClient buildClient() { - return new UsageClient(buildInnerClient().getModelInOperations()); - } - - private static final ClientLogger LOGGER = new ClientLogger(UsageClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/ModelInOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/ModelInOperationsImpl.java deleted file mode 100644 index ce7d4d1671a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/ModelInOperationsImpl.java +++ /dev/null @@ -1,448 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.usage.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ModelInOperations. - */ -public final class ModelInOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ModelInOperationsService service; - - /** - * The service client containing this operation class. - */ - private final UsageClientImpl client; - - /** - * Initializes an instance of ModelInOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ModelInOperationsImpl(UsageClientImpl client) { - this.service - = RestProxy.create(ModelInOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UsageClientModelInOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UsageClientModelInOperations") - public interface ModelInOperationsService { - @Post("/azure/client-generator-core/usage/inputToInputOutput") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> inputToInputOutput(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/azure/client-generator-core/usage/inputToInputOutput") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response inputToInputOutputSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/usage/outputToInputOutput") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> outputToInputOutput(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/azure/client-generator-core/usage/outputToInputOutput") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response outputToInputOutputSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/usage/modelInReadOnlyProperty") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> modelInReadOnlyProperty(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/usage/modelInReadOnlyProperty") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response modelInReadOnlyPropertySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/usage/orphanModelSerializable") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> orphanModelSerializable(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/azure/client-generator-core/usage/orphanModelSerializable") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response orphanModelSerializableSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Expected body parameter: - * ```json - * { - * "name": "Madge" - * } - * ```. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> inputToInputOutputWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.inputToInputOutput(this.client.getEndpoint(), contentType, body, - requestOptions, context)); - } - - /** - * Expected body parameter: - * ```json - * { - * "name": "Madge" - * } - * ```. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response inputToInputOutputWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.inputToInputOutputSync(this.client.getEndpoint(), contentType, body, requestOptions, - Context.NONE); - } - - /** - * Expected response body: - * ```json - * { - * "name": "Madge" - * } - * ```. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return usage additive to roundtrip along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> outputToInputOutputWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.outputToInputOutput(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Expected response body: - * ```json - * { - * "name": "Madge" - * } - * ```. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return usage additive to roundtrip along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response outputToInputOutputWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.outputToInputOutputSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * "ResultModel" should be usage=output, as it is read-only and does not exist in request body. - * - * Expected body parameter: - * ```json - * { - * } - * ``` - * - * Expected response body: - * ```json - * { - * "result": { - * "name": "Madge" - * } - * } - * ```. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     result (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     result (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> modelInReadOnlyPropertyWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.modelInReadOnlyProperty(this.client.getEndpoint(), contentType, - accept, body, requestOptions, context)); - } - - /** - * "ResultModel" should be usage=output, as it is read-only and does not exist in request body. - * - * Expected body parameter: - * ```json - * { - * } - * ``` - * - * Expected response body: - * ```json - * { - * "result": { - * "name": "Madge" - * } - * } - * ```. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     result (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     result (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response modelInReadOnlyPropertyWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.modelInReadOnlyPropertySync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * Serialize the 'OrphanModel' as request body. - * - * Expected body parameter: - * ```json - * { - * "name": "name", - * "desc": "desc" - * } - * ```. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> orphanModelSerializableWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.orphanModelSerializable(this.client.getEndpoint(), contentType, - body, requestOptions, context)); - } - - /** - * Serialize the 'OrphanModel' as request body. - * - * Expected body parameter: - * ```json - * { - * "name": "name", - * "desc": "desc" - * } - * ```. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response orphanModelSerializableWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.orphanModelSerializableSync(this.client.getEndpoint(), contentType, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/UsageClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/UsageClientImpl.java deleted file mode 100644 index 8122cbb5849..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/UsageClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.usage.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 UsageClient type. - */ -public final class UsageClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 ModelInOperationsImpl object to access its operations. - */ - private final ModelInOperationsImpl modelInOperations; - - /** - * Gets the ModelInOperationsImpl object to access its operations. - * - * @return the ModelInOperationsImpl object. - */ - public ModelInOperationsImpl getModelInOperations() { - return this.modelInOperations; - } - - /** - * Initializes an instance of UsageClient client. - * - * @param endpoint Service host. - */ - public UsageClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of UsageClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public UsageClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of UsageClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public UsageClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.modelInOperations = new ModelInOperationsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/package-info.java deleted file mode 100644 index c1319d5bd58..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Usage. - * Test for internal decorator. - * - */ -package azure.clientgenerator.core.usage.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/InputModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/InputModel.java deleted file mode 100644 index de15ec1a55e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/InputModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.usage.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Usage additive to roundtrip. - */ -@Immutable -public final class InputModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of InputModel class. - * - * @param name the name value to set. - */ - @Generated - public InputModel(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InputModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InputModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the InputModel. - */ - @Generated - public static InputModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new InputModel(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OrphanModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OrphanModel.java deleted file mode 100644 index 09d7e0471a3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OrphanModel.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.usage.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Not used anywhere, but access is override to public so still need to be generated and exported with serialization. - */ -@Immutable -public final class OrphanModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String modelName; - - /* - * The desc property. - */ - @Generated - private final String description; - - /** - * Creates an instance of OrphanModel class. - * - * @param modelName the modelName value to set. - * @param description the description value to set. - */ - @Generated - public OrphanModel(String modelName, String description) { - this.modelName = modelName; - this.description = description; - } - - /** - * Get the modelName property: The name property. - * - * @return the modelName value. - */ - @Generated - public String getModelName() { - return this.modelName; - } - - /** - * Get the description property: The desc property. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.modelName); - jsonWriter.writeStringField("desc", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OrphanModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OrphanModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OrphanModel. - */ - @Generated - public static OrphanModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String modelName = null; - String description = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - modelName = reader.getString(); - } else if ("desc".equals(fieldName)) { - description = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new OrphanModel(modelName, description); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OutputModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OutputModel.java deleted file mode 100644 index e92ddd0c447..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OutputModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.usage.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Usage additive to roundtrip. - */ -@Immutable -public final class OutputModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of OutputModel class. - * - * @param name the name value to set. - */ - @Generated - public OutputModel(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OutputModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OutputModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OutputModel. - */ - @Generated - public static OutputModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new OutputModel(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/ResultModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/ResultModel.java deleted file mode 100644 index 99975529fb1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/ResultModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.usage.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ResultModel model. - */ -@Immutable -public final class ResultModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of ResultModel class. - * - * @param name the name value to set. - */ - @Generated - private ResultModel(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResultModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResultModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResultModel. - */ - @Generated - public static ResultModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ResultModel(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/RoundTripModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/RoundTripModel.java deleted file mode 100644 index 4eb57c74a58..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/RoundTripModel.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.usage.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The RoundTripModel model. - */ -@Immutable -public final class RoundTripModel implements JsonSerializable { - /* - * The result property. - */ - @Generated - private ResultModel result; - - /** - * Creates an instance of RoundTripModel class. - */ - @Generated - public RoundTripModel() { - } - - /** - * Get the result property: The result property. - * - * @return the result value. - */ - @Generated - public ResultModel getResult() { - return this.result; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of RoundTripModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of RoundTripModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the RoundTripModel. - */ - @Generated - public static RoundTripModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - RoundTripModel deserializedRoundTripModel = new RoundTripModel(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("result".equals(fieldName)) { - deserializedRoundTripModel.result = ResultModel.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedRoundTripModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/package-info.java deleted file mode 100644 index 2b53c1a3a7a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Usage. - * Test for internal decorator. - * - */ -package azure.clientgenerator.core.usage.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/package-info.java deleted file mode 100644 index cb61e04d930..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Usage. - * Test for internal decorator. - * - */ -package azure.clientgenerator.core.usage; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicAsyncClient.java deleted file mode 100644 index 7ef6716f929..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicAsyncClient.java +++ /dev/null @@ -1,603 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.basic; - -import azure.core.basic.implementation.BasicClientImpl; -import azure.core.basic.implementation.JsonMergePatchHelper; -import azure.core.basic.models.User; -import azure.core.basic.models.UserList; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.stream.Collectors; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous BasicClient type. - */ -@ServiceClient(builder = BasicClientBuilder.class, isAsync = true) -public final class BasicAsyncClient { - @Generated - private final BasicClientImpl serviceClient; - - /** - * Initializes an instance of BasicAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BasicAsyncClient(BasicClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Adds a user or updates a user's fields. - * - * Creates or updates a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateWithResponse(int id, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateWithResponseAsync(id, resource, requestOptions); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrReplaceWithResponse(int id, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.createOrReplaceWithResponseAsync(id, resource, requestOptions); - } - - /** - * Gets a user. - * - * Gets a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a user. - * - * Gets a User along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(int id, RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(id, requestOptions); - } - - /** - * Lists all users. - * - * Lists all Users. - *

Query Parameters

- * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
orderbyList<String>NoExpressions that specify the order of returned - * results. Call {@link RequestOptions#addQueryParam} to add string to array.
filterStringNoFilter the result list using the given expression.
selectList<String>NoSelect the specified fields to be included in the - * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandList<String>NoExpand the indicated resources into the response. - * Call {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux list(RequestOptions requestOptions) { - return this.serviceClient.listAsync(requestOptions); - } - - /** - * Deletes a user. - * - * Deletes a User. - * - * @param id The user's id. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithResponse(int id, RequestOptions requestOptions) { - return this.serviceClient.deleteWithResponseAsync(id, requestOptions); - } - - /** - * Exports a user. - * - * Exports a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> exportWithResponse(int id, String format, RequestOptions requestOptions) { - return this.serviceClient.exportWithResponseAsync(id, format, requestOptions); - } - - /** - * Exports all users. - * - * Exports all users. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     users (Required): [
-     *          (Required){
-     *             id: int (Required)
-     *             name: String (Optional, Required on create)
-     *             orders (Optional): [
-     *                  (Optional){
-     *                     id: int (Required)
-     *                     userId: int (Optional, Required on create)
-     *                     detail: String (Optional, Required on create)
-     *                 }
-     *             ]
-     *             etag: String (Required)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> exportAllUsersWithResponse(String format, RequestOptions requestOptions) { - return this.serviceClient.exportAllUsersWithResponseAsync(format, requestOptions); - } - - /** - * Adds a user or updates a user's fields. - * - * Creates or updates a User. - * - * @param id The user's id. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a user on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdate(int id, User resource) { - // Generated convenience method for createOrUpdateWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getUserAccessor().prepareModelForJsonMergePatch(resource, true); - BinaryData resourceInBinaryData = BinaryData.fromObject(resource); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - resourceInBinaryData.getLength(); - JsonMergePatchHelper.getUserAccessor().prepareModelForJsonMergePatch(resource, false); - return createOrUpdateWithResponse(id, resourceInBinaryData, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(User.class)); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - * - * @param id The user's id. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a user on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrReplace(int id, User resource) { - // Generated convenience method for createOrReplaceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createOrReplaceWithResponse(id, BinaryData.fromObject(resource), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(User.class)); - } - - /** - * Gets a user. - * - * Gets a User. - * - * @param id The user's id. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a user. - * - * Gets a User on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get(int id) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(id, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(User.class)); - } - - /** - * Lists all users. - * - * Lists all Users. - * - * @param top The number of result items to return. - * @param skip The number of result items to skip. - * @param orderBy Expressions that specify the order of returned results. - * @param filter Filter the result list using the given expression. - * @param select Select the specified fields to be included in the response. - * @param expand Expand the indicated resources into the response. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux list(Integer top, Integer skip, List orderBy, String filter, List select, - List expand) { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - if (top != null) { - requestOptions.addQueryParam("top", String.valueOf(top), false); - } - if (skip != null) { - requestOptions.addQueryParam("skip", String.valueOf(skip), false); - } - if (orderBy != null) { - for (String paramItemValue : orderBy) { - if (paramItemValue != null) { - requestOptions.addQueryParam("orderby", paramItemValue, false); - } - } - } - if (filter != null) { - requestOptions.addQueryParam("filter", filter, false); - } - if (select != null) { - for (String paramItemValue : select) { - if (paramItemValue != null) { - requestOptions.addQueryParam("select", paramItemValue, false); - } - } - } - if (expand != null) { - for (String paramItemValue : expand) { - if (paramItemValue != null) { - requestOptions.addQueryParam("expand", paramItemValue, false); - } - } - } - PagedFlux pagedFluxResponse = list(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(User.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } - - /** - * Lists all users. - * - * Lists all Users. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux list() { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = list(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(User.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } - - /** - * Deletes a user. - * - * Deletes a User. - * - * @param id The user's id. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono delete(int id) { - // Generated convenience method for deleteWithResponse - RequestOptions requestOptions = new RequestOptions(); - return deleteWithResponse(id, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Exports a user. - * - * Exports a User. - * - * @param id The user's id. - * @param format The format of the data. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a user on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono export(int id, String format) { - // Generated convenience method for exportWithResponse - RequestOptions requestOptions = new RequestOptions(); - return exportWithResponse(id, format, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(User.class)); - } - - /** - * Exports all users. - * - * Exports all users. - * - * @param format The format of the data. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono exportAllUsers(String format) { - // Generated convenience method for exportAllUsersWithResponse - RequestOptions requestOptions = new RequestOptions(); - return exportAllUsersWithResponse(format, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UserList.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClient.java deleted file mode 100644 index 32419b9f1e5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClient.java +++ /dev/null @@ -1,566 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.basic; - -import azure.core.basic.implementation.BasicClientImpl; -import azure.core.basic.implementation.JsonMergePatchHelper; -import azure.core.basic.models.User; -import azure.core.basic.models.UserList; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import java.util.List; - -/** - * Initializes a new instance of the synchronous BasicClient type. - */ -@ServiceClient(builder = BasicClientBuilder.class) -public final class BasicClient { - @Generated - private final BasicClientImpl serviceClient; - - /** - * Initializes an instance of BasicClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BasicClient(BasicClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Adds a user or updates a user's fields. - * - * Creates or updates a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse(int id, BinaryData resource, RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateWithResponse(id, resource, requestOptions); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrReplaceWithResponse(int id, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.createOrReplaceWithResponse(id, resource, requestOptions); - } - - /** - * Gets a user. - * - * Gets a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a user. - * - * Gets a User along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(int id, RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(id, requestOptions); - } - - /** - * Lists all users. - * - * Lists all Users. - *

Query Parameters

- * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
orderbyList<String>NoExpressions that specify the order of returned - * results. Call {@link RequestOptions#addQueryParam} to add string to array.
filterStringNoFilter the result list using the given expression.
selectList<String>NoSelect the specified fields to be included in the - * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandList<String>NoExpand the indicated resources into the response. - * Call {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(RequestOptions requestOptions) { - return this.serviceClient.list(requestOptions); - } - - /** - * Deletes a user. - * - * Deletes a User. - * - * @param id The user's id. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(int id, RequestOptions requestOptions) { - return this.serviceClient.deleteWithResponse(id, requestOptions); - } - - /** - * Exports a user. - * - * Exports a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response exportWithResponse(int id, String format, RequestOptions requestOptions) { - return this.serviceClient.exportWithResponse(id, format, requestOptions); - } - - /** - * Exports all users. - * - * Exports all users. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     users (Required): [
-     *          (Required){
-     *             id: int (Required)
-     *             name: String (Optional, Required on create)
-     *             orders (Optional): [
-     *                  (Optional){
-     *                     id: int (Required)
-     *                     userId: int (Optional, Required on create)
-     *                     detail: String (Optional, Required on create)
-     *                 }
-     *             ]
-     *             etag: String (Required)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response exportAllUsersWithResponse(String format, RequestOptions requestOptions) { - return this.serviceClient.exportAllUsersWithResponse(format, requestOptions); - } - - /** - * Adds a user or updates a user's fields. - * - * Creates or updates a User. - * - * @param id The user's id. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a user. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public User createOrUpdate(int id, User resource) { - // Generated convenience method for createOrUpdateWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getUserAccessor().prepareModelForJsonMergePatch(resource, true); - BinaryData resourceInBinaryData = BinaryData.fromObject(resource); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - resourceInBinaryData.getLength(); - JsonMergePatchHelper.getUserAccessor().prepareModelForJsonMergePatch(resource, false); - return createOrUpdateWithResponse(id, resourceInBinaryData, requestOptions).getValue().toObject(User.class); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - * - * @param id The user's id. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a user. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public User createOrReplace(int id, User resource) { - // Generated convenience method for createOrReplaceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createOrReplaceWithResponse(id, BinaryData.fromObject(resource), requestOptions).getValue() - .toObject(User.class); - } - - /** - * Gets a user. - * - * Gets a User. - * - * @param id The user's id. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a user. - * - * Gets a User. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public User get(int id) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(id, requestOptions).getValue().toObject(User.class); - } - - /** - * Lists all users. - * - * Lists all Users. - * - * @param top The number of result items to return. - * @param skip The number of result items to skip. - * @param orderBy Expressions that specify the order of returned results. - * @param filter Filter the result list using the given expression. - * @param select Select the specified fields to be included in the response. - * @param expand Expand the indicated resources into the response. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Integer top, Integer skip, List orderBy, String filter, List select, - List expand) { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - if (top != null) { - requestOptions.addQueryParam("top", String.valueOf(top), false); - } - if (skip != null) { - requestOptions.addQueryParam("skip", String.valueOf(skip), false); - } - if (orderBy != null) { - for (String paramItemValue : orderBy) { - if (paramItemValue != null) { - requestOptions.addQueryParam("orderby", paramItemValue, false); - } - } - } - if (filter != null) { - requestOptions.addQueryParam("filter", filter, false); - } - if (select != null) { - for (String paramItemValue : select) { - if (paramItemValue != null) { - requestOptions.addQueryParam("select", paramItemValue, false); - } - } - } - if (expand != null) { - for (String paramItemValue : expand) { - if (paramItemValue != null) { - requestOptions.addQueryParam("expand", paramItemValue, false); - } - } - } - return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); - } - - /** - * Lists all users. - * - * Lists all Users. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); - } - - /** - * Deletes a user. - * - * Deletes a User. - * - * @param id The user's id. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(int id) { - // Generated convenience method for deleteWithResponse - RequestOptions requestOptions = new RequestOptions(); - deleteWithResponse(id, requestOptions).getValue(); - } - - /** - * Exports a user. - * - * Exports a User. - * - * @param id The user's id. - * @param format The format of the data. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a user. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public User export(int id, String format) { - // Generated convenience method for exportWithResponse - RequestOptions requestOptions = new RequestOptions(); - return exportWithResponse(id, format, requestOptions).getValue().toObject(User.class); - } - - /** - * Exports all users. - * - * Exports all users. - * - * @param format The format of the data. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UserList exportAllUsers(String format) { - // Generated convenience method for exportAllUsersWithResponse - RequestOptions requestOptions = new RequestOptions(); - return exportAllUsersWithResponse(format, requestOptions).getValue().toObject(UserList.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClientBuilder.java deleted file mode 100644 index d9a34f8480e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.basic; - -import azure.core.basic.implementation.BasicClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the BasicClient type. - */ -@ServiceClientBuilder(serviceClients = { BasicClient.class, BasicAsyncClient.class }) -public final class BasicClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-basic.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the BasicClientBuilder. - */ - @Generated - public BasicClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private BasicServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the BasicClientBuilder. - */ - @Generated - public BasicClientBuilder serviceVersion(BasicServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the BasicClientBuilder. - */ - @Generated - public BasicClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of BasicClientImpl with the provided parameters. - * - * @return an instance of BasicClientImpl. - */ - @Generated - private BasicClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - BasicServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : BasicServiceVersion.getLatest(); - BasicClientImpl client = new BasicClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - localEndpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of BasicAsyncClient class. - * - * @return an instance of BasicAsyncClient. - */ - @Generated - public BasicAsyncClient buildAsyncClient() { - return new BasicAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of BasicClient class. - * - * @return an instance of BasicClient. - */ - @Generated - public BasicClient buildClient() { - return new BasicClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(BasicClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicServiceVersion.java deleted file mode 100644 index 6df5e089edc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.basic; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of BasicClient. - */ -public enum BasicServiceVersion implements ServiceVersion { - /** - * Enum value 2022-12-01-preview. - */ - V2022_12_01_PREVIEW("2022-12-01-preview"); - - private final String version; - - BasicServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link BasicServiceVersion}. - */ - public static BasicServiceVersion getLatest() { - return V2022_12_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/BasicClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/BasicClientImpl.java deleted file mode 100644 index 0d851f4d0ce..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/BasicClientImpl.java +++ /dev/null @@ -1,1204 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.basic.implementation; - -import azure.core.basic.BasicServiceVersion; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -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.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -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.RequestOptions; -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 com.azure.core.util.UrlBuilder; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the BasicClient type. - */ -public final class BasicClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BasicClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final BasicServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public BasicServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of BasicClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public BasicClientImpl(String endpoint, BasicServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of BasicClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public BasicClientImpl(HttpPipeline httpPipeline, String endpoint, BasicServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of BasicClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public BasicClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - BasicServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(BasicClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for BasicClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "BasicClient") - public interface BasicClientService { - @Patch("/azure/core/basic/users/{id}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, - Context context); - - @Patch("/azure/core/basic/users/{id}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, - Context context); - - @Put("/azure/core/basic/users/{id}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createOrReplace(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); - - @Put("/azure/core/basic/users/{id}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrReplaceSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); - - @Get("/azure/core/basic/users/{id}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/core/basic/users/{id}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/core/basic/users") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> list(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/core/basic/users") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Delete("/azure/core/basic/users/{id}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, RequestOptions requestOptions, - Context context); - - @Delete("/azure/core/basic/users/{id}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("id") int id, RequestOptions requestOptions, Context context); - - @Post("/azure/core/basic/users/{id}:export") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> export(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, @QueryParam("format") String format, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/azure/core/basic/users/{id}:export") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response exportSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, @QueryParam("format") String format, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/azure/core/basic/users:exportallusers") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> exportAllUsers(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @QueryParam("format") String format, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/azure/core/basic/users:exportallusers") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response exportAllUsersSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @QueryParam("format") String format, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * Adds a user or updates a user's fields. - * - * Creates or updates a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateWithResponseAsync(int id, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrUpdate(this.getEndpoint(), - this.getServiceVersion().getVersion(), id, contentType, accept, resource, requestOptions, context)); - } - - /** - * Adds a user or updates a user's fields. - * - * Creates or updates a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse(int id, BinaryData resource, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, contentType, - accept, resource, requestOptions, Context.NONE); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrReplaceWithResponseAsync(int id, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrReplace(this.getEndpoint(), - this.getServiceVersion().getVersion(), id, contentType, accept, resource, requestOptions, context)); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrReplaceWithResponse(int id, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrReplaceSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, contentType, - accept, resource, requestOptions, Context.NONE); - } - - /** - * Gets a user. - * - * Gets a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a user. - * - * Gets a User along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(int id, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.getEndpoint(), this.getServiceVersion().getVersion(), - id, accept, requestOptions, context)); - } - - /** - * Gets a user. - * - * Gets a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a user. - * - * Gets a User along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(int id, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, accept, requestOptions, - Context.NONE); - } - - /** - * Lists all users. - * - * Lists all Users. - *

Query Parameters

- * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
orderbyList<String>NoExpressions that specify the order of returned - * results. Call {@link RequestOptions#addQueryParam} to add string to array.
filterStringNoFilter the result list using the given expression.
selectList<String>NoSelect the specified fields to be included in the - * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandList<String>NoExpand the indicated resources into the response. - * Call {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, - requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * Lists all users. - * - * Lists all Users. - *

Query Parameters

- * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
orderbyList<String>NoExpressions that specify the order of returned - * results. Call {@link RequestOptions#addQueryParam} to add string to array.
filterStringNoFilter the result list using the given expression.
selectList<String>NoSelect the specified fields to be included in the - * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandList<String>NoExpand the indicated resources into the response. - * Call {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>((pageSize) -> { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listSinglePageAsync(requestOptionsLocal); - }, (nextLink, pageSize) -> { - RequestOptions requestOptionsLocal = new RequestOptions(); - requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listNextSinglePageAsync(nextLink, requestOptionsLocal); - }); - } - - /** - * Lists all users. - * - * Lists all Users. - *

Query Parameters

- * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
orderbyList<String>NoExpressions that specify the order of returned - * results. Call {@link RequestOptions#addQueryParam} to add string to array.
filterStringNoFilter the result list using the given expression.
selectList<String>NoSelect the specified fields to be included in the - * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandList<String>NoExpand the indicated resources into the response. - * Call {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, - requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * Lists all users. - * - * Lists all Users. - *

Query Parameters

- * - * - * - * - * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
orderbyList<String>NoExpressions that specify the order of returned - * results. Call {@link RequestOptions#addQueryParam} to add string to array.
filterStringNoFilter the result list using the given expression.
selectList<String>NoSelect the specified fields to be included in the - * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandList<String>NoExpand the indicated resources into the response. - * Call {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>((pageSize) -> { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listSinglePage(requestOptionsLocal); - }, (nextLink, pageSize) -> { - RequestOptions requestOptionsLocal = new RequestOptions(); - requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listNextSinglePage(nextLink, requestOptionsLocal); - }); - } - - /** - * Deletes a user. - * - * Deletes a User. - * - * @param id The user's id. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithResponseAsync(int id, RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.delete(this.getEndpoint(), this.getServiceVersion().getVersion(), - id, requestOptions, context)); - } - - /** - * Deletes a user. - * - * Deletes a User. - * - * @param id The user's id. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(int id, RequestOptions requestOptions) { - return service.deleteSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, requestOptions, - Context.NONE); - } - - /** - * Exports a user. - * - * Exports a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> exportWithResponseAsync(int id, String format, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.export(this.getEndpoint(), this.getServiceVersion().getVersion(), - id, format, accept, requestOptions, context)); - } - - /** - * Exports a user. - * - * Exports a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response exportWithResponse(int id, String format, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.exportSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, format, accept, - requestOptions, Context.NONE); - } - - /** - * Exports all users. - * - * Exports all users. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     users (Required): [
-     *          (Required){
-     *             id: int (Required)
-     *             name: String (Optional, Required on create)
-     *             orders (Optional): [
-     *                  (Optional){
-     *                     id: int (Required)
-     *                     userId: int (Optional, Required on create)
-     *                     detail: String (Optional, Required on create)
-     *                 }
-     *             ]
-     *             etag: String (Required)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> exportAllUsersWithResponseAsync(String format, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.exportAllUsers(this.getEndpoint(), - this.getServiceVersion().getVersion(), format, accept, requestOptions, context)); - } - - /** - * Exports all users. - * - * Exports all users. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     users (Required): [
-     *          (Required){
-     *             id: int (Required)
-     *             name: String (Optional, Required on create)
-     *             orders (Optional): [
-     *                  (Optional){
-     *                     id: int (Required)
-     *                     userId: int (Optional, Required on create)
-     *                     detail: String (Optional, Required on create)
-     *                 }
-     *             ]
-     *             etag: String (Required)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response exportAllUsersWithResponse(String format, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.exportAllUsersSync(this.getEndpoint(), this.getServiceVersion().getVersion(), format, accept, - requestOptions, Context.NONE); - } - - /** - * Lists all users. - * - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listNext(nextLink, this.getEndpoint(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * Lists all users. - * - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional, Required on create)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Optional, Required on create)
-     *             detail: String (Optional, Required on create)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - private List getValues(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - List values = (List) obj.get(path); - return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); - } catch (RuntimeException e) { - return null; - } - } - - private String getNextLink(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - return (String) obj.get(path); - } catch (RuntimeException e) { - return null; - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/JsonMergePatchHelper.java deleted file mode 100644 index 74bed5be156..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/JsonMergePatchHelper.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.basic.implementation; - -import azure.core.basic.models.User; -import azure.core.basic.models.UserOrder; - -/** - * This is the Helper class to enable json merge patch serialization for a model. - */ -public class JsonMergePatchHelper { - private static UserAccessor userAccessor; - - public interface UserAccessor { - User prepareModelForJsonMergePatch(User user, boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(User user); - } - - public static void setUserAccessor(UserAccessor accessor) { - userAccessor = accessor; - } - - public static UserAccessor getUserAccessor() { - return userAccessor; - } - - private static UserOrderAccessor userOrderAccessor; - - public interface UserOrderAccessor { - UserOrder prepareModelForJsonMergePatch(UserOrder userOrder, boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(UserOrder userOrder); - } - - public static void setUserOrderAccessor(UserOrderAccessor accessor) { - userOrderAccessor = accessor; - } - - public static UserOrderAccessor getUserOrderAccessor() { - return userOrderAccessor; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/package-info.java deleted file mode 100644 index 6a09cf4b857..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Basic. - * Illustrates bodies templated with Azure Core. - * - */ -package azure.core.basic.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/User.java deleted file mode 100644 index c49b5ff83eb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/User.java +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.basic.models; - -import azure.core.basic.implementation.JsonMergePatchHelper; -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * Details about a user. - */ -@Fluent -public final class User implements JsonSerializable { - /* - * The user's id. - */ - @Generated - private int id; - - /* - * The user's name. - */ - @Generated - private String name; - - /* - * The user's order list - */ - @Generated - private List orders; - - /* - * The entity tag for this resource. - */ - @Generated - private String etag; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setUserAccessor(new JsonMergePatchHelper.UserAccessor() { - @Override - public User prepareModelForJsonMergePatch(User model, boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(User model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of User class. - */ - @Generated - public User() { - } - - /** - * Get the id property: The user's id. - * - * @return the id value. - */ - @Generated - public int getId() { - return this.id; - } - - /** - * Get the name property: The user's name. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Set the name property: The user's name. - *

Required when create the resource.

- * - * @param name the name value to set. - * @return the User object itself. - */ - @Generated - public User setName(String name) { - this.name = name; - this.updatedProperties.add("name"); - return this; - } - - /** - * Get the orders property: The user's order list. - * - * @return the orders value. - */ - @Generated - public List getOrders() { - return this.orders; - } - - /** - * Set the orders property: The user's order list. - * - * @param orders the orders value to set. - * @return the User object itself. - */ - @Generated - public User setOrders(List orders) { - this.orders = orders; - this.updatedProperties.add("orders"); - return this; - } - - /** - * Get the etag property: The entity tag for this resource. - * - * @return the etag value. - */ - @Generated - public String getEtag() { - return this.etag; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeArrayField("orders", this.orders, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("name")) { - if (this.name == null) { - jsonWriter.writeNullField("name"); - } else { - jsonWriter.writeStringField("name", this.name); - } - } - if (updatedProperties.contains("orders")) { - if (this.orders == null) { - jsonWriter.writeNullField("orders"); - } else { - jsonWriter.writeArrayField("orders", this.orders, (writer, element) -> writer.writeJson(element)); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of User from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the User. - */ - @Generated - public static User fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - User deserializedUser = new User(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedUser.id = reader.getInt(); - } else if ("etag".equals(fieldName)) { - deserializedUser.etag = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedUser.name = reader.getString(); - } else if ("orders".equals(fieldName)) { - List orders = reader.readArray(reader1 -> UserOrder.fromJson(reader1)); - deserializedUser.orders = orders; - } else { - reader.skipChildren(); - } - } - - return deserializedUser; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserList.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserList.java deleted file mode 100644 index 1fdad200694..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserList.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.basic.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The UserList model. - */ -@Immutable -public final class UserList implements JsonSerializable { - /* - * The users property. - */ - @Generated - private final List users; - - /** - * Creates an instance of UserList class. - * - * @param users the users value to set. - */ - @Generated - private UserList(List users) { - this.users = users; - } - - /** - * Get the users property: The users property. - * - * @return the users value. - */ - @Generated - public List getUsers() { - return this.users; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("users", this.users, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UserList from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UserList if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UserList. - */ - @Generated - public static UserList fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List users = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("users".equals(fieldName)) { - users = reader.readArray(reader1 -> User.fromJson(reader1)); - } else { - reader.skipChildren(); - } - } - return new UserList(users); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserOrder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserOrder.java deleted file mode 100644 index aeb217694c6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserOrder.java +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.basic.models; - -import azure.core.basic.implementation.JsonMergePatchHelper; -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; - -/** - * UserOrder for testing list with expand. - */ -@Fluent -public final class UserOrder implements JsonSerializable { - /* - * The user's id. - */ - @Generated - private int id; - - /* - * The user's id. - */ - @Generated - private int userId; - - /* - * The user's order detail - */ - @Generated - private String detail; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setUserOrderAccessor(new JsonMergePatchHelper.UserOrderAccessor() { - @Override - public UserOrder prepareModelForJsonMergePatch(UserOrder model, boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(UserOrder model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of UserOrder class. - */ - @Generated - public UserOrder() { - } - - /** - * Get the id property: The user's id. - * - * @return the id value. - */ - @Generated - public int getId() { - return this.id; - } - - /** - * Get the userId property: The user's id. - * - * @return the userId value. - */ - @Generated - public int getUserId() { - return this.userId; - } - - /** - * Set the userId property: The user's id. - *

Required when create the resource.

- * - * @param userId the userId value to set. - * @return the UserOrder object itself. - */ - @Generated - public UserOrder setUserId(int userId) { - this.userId = userId; - this.updatedProperties.add("userId"); - return this; - } - - /** - * Get the detail property: The user's order detail. - * - * @return the detail value. - */ - @Generated - public String getDetail() { - return this.detail; - } - - /** - * Set the detail property: The user's order detail. - *

Required when create the resource.

- * - * @param detail the detail value to set. - * @return the UserOrder object itself. - */ - @Generated - public UserOrder setDetail(String detail) { - this.detail = detail; - this.updatedProperties.add("detail"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("userId", this.userId); - jsonWriter.writeStringField("detail", this.detail); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("userId")) { - jsonWriter.writeIntField("userId", this.userId); - } - if (updatedProperties.contains("detail")) { - if (this.detail == null) { - jsonWriter.writeNullField("detail"); - } else { - jsonWriter.writeStringField("detail", this.detail); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UserOrder from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UserOrder if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UserOrder. - */ - @Generated - public static UserOrder fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - UserOrder deserializedUserOrder = new UserOrder(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedUserOrder.id = reader.getInt(); - } else if ("userId".equals(fieldName)) { - deserializedUserOrder.userId = reader.getInt(); - } else if ("detail".equals(fieldName)) { - deserializedUserOrder.detail = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedUserOrder; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/package-info.java deleted file mode 100644 index 9aed4461e97..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Basic. - * Illustrates bodies templated with Azure Core. - * - */ -package azure.core.basic.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/package-info.java deleted file mode 100644 index b7984bdc4df..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Basic. - * Illustrates bodies templated with Azure Core. - * - */ -package azure.core.basic; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcAsyncClient.java deleted file mode 100644 index c44f6cee8e0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcAsyncClient.java +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.rpc; - -import azure.core.lro.rpc.implementation.RpcClientImpl; -import azure.core.lro.rpc.models.GenerationOptions; -import azure.core.lro.rpc.models.GenerationResult; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.PollerFlux; - -/** - * Initializes a new instance of the asynchronous RpcClient type. - */ -@ServiceClient(builder = RpcClientBuilder.class, isAsync = true) -public final class RpcAsyncClient { - @Generated - private final RpcClientImpl serviceClient; - - /** - * Initializes an instance of RpcAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RpcAsyncClient(RpcClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Generate data. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prompt: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLongRunningRpc(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.beginLongRunningRpcAsync(body, requestOptions); - } - - /** - * Generate data. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLongRunningRpc(GenerationOptions body) { - // Generated convenience method for beginLongRunningRpcWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginLongRunningRpcWithModelAsync(BinaryData.fromObject(body), requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClient.java deleted file mode 100644 index e96a776a854..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClient.java +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.rpc; - -import azure.core.lro.rpc.implementation.RpcClientImpl; -import azure.core.lro.rpc.models.GenerationOptions; -import azure.core.lro.rpc.models.GenerationResult; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.SyncPoller; - -/** - * Initializes a new instance of the synchronous RpcClient type. - */ -@ServiceClient(builder = RpcClientBuilder.class) -public final class RpcClient { - @Generated - private final RpcClientImpl serviceClient; - - /** - * Initializes an instance of RpcClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RpcClient(RpcClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Generate data. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prompt: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLongRunningRpc(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.beginLongRunningRpc(body, requestOptions); - } - - /** - * Generate data. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLongRunningRpc(GenerationOptions body) { - // Generated convenience method for beginLongRunningRpcWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginLongRunningRpcWithModel(BinaryData.fromObject(body), requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClientBuilder.java deleted file mode 100644 index cb153e10cdf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.rpc; - -import azure.core.lro.rpc.implementation.RpcClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the RpcClient type. - */ -@ServiceClientBuilder(serviceClients = { RpcClient.class, RpcAsyncClient.class }) -public final class RpcClientBuilder - implements HttpTrait, ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-lro-rpc.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the RpcClientBuilder. - */ - @Generated - public RpcClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RpcClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RpcClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RpcClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RpcClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RpcClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RpcClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RpcClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RpcClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private RpcServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the RpcClientBuilder. - */ - @Generated - public RpcClientBuilder serviceVersion(RpcServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the RpcClientBuilder. - */ - @Generated - public RpcClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of RpcClientImpl with the provided parameters. - * - * @return an instance of RpcClientImpl. - */ - @Generated - private RpcClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - RpcServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : RpcServiceVersion.getLatest(); - RpcClientImpl client = new RpcClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - localEndpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of RpcAsyncClient class. - * - * @return an instance of RpcAsyncClient. - */ - @Generated - public RpcAsyncClient buildAsyncClient() { - return new RpcAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of RpcClient class. - * - * @return an instance of RpcClient. - */ - @Generated - public RpcClient buildClient() { - return new RpcClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(RpcClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcServiceVersion.java deleted file mode 100644 index 5f1df22153e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.rpc; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of RpcClient. - */ -public enum RpcServiceVersion implements ServiceVersion { - /** - * Enum value 2022-12-01-preview. - */ - V2022_12_01_PREVIEW("2022-12-01-preview"); - - private final String version; - - RpcServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link RpcServiceVersion}. - */ - public static RpcServiceVersion getLatest() { - return V2022_12_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/OperationLocationPollingStrategy.java deleted file mode 100644 index 5e741b934cd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/OperationLocationPollingStrategy.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.rpc.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.OperationResourcePollingStrategy; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -/** - * Implements an operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public Mono> onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - final Mono> pollResponseMono - = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) - .onErrorResume(exception -> { - LOGGER.info("Failed to parse initial response."); - return Mono.empty(); - }) - .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); - return pollResponseMono.switchIfEmpty( - Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); - } else { - return Mono - .error( - new AzureException(String.format( - "Operation failed or cancelled with status code %d," - + ", '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - } - - /** - * {@inheritDoc} - */ - @Override - public Mono getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - return Mono.error(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - return Mono.error(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - return PollingUtils - .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) - .flatMap(value -> { - if (value.get(propertyName) != null) { - return BinaryData.fromObjectAsync(value.get(propertyName)) - .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); - } else { - return Mono.error(new AzureException("Cannot get final result")); - } - }) - .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/PollingUtils.java deleted file mode 100644 index 0b0557ef059..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/PollingUtils.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.rpc.implementation; - -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.BinaryData; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.net.URI; -import java.net.URISyntaxException; -import java.time.DateTimeException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.time.temporal.ChronoUnit; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -final class PollingUtils { - - public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE - = new TypeReference>() { - }; - - public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); - - public static final String HTTP_METHOD = "httpMethod"; - public static final String REQUEST_URL = "requestURL"; - public static final String POLL_RESPONSE_BODY = "pollResponseBody"; - - private static final String FORWARD_SLASH = "/"; - - public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { - try { - URI uri = new URI(path); - if (!uri.isAbsolute()) { - if (CoreUtils.isNullOrEmpty(endpoint)) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); - } - - if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { - return endpoint + path.substring(1); - } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { - return endpoint + FORWARD_SLASH + path; - } else { - return endpoint + path; - } - } - } catch (URISyntaxException ex) { - throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); - } - return path; - } - - public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - T value; - if (binaryData == null) { - value = null; - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); - } else { - value = binaryData.toObject(typeReference, serializer); - } - return value; - } - - @SuppressWarnings("unchecked") - public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - Mono value; - if (binaryData == null) { - value = Mono.empty(); - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = (Mono) binaryData.toReplayableBinaryDataAsync(); - } else { - value = binaryData.toObjectAsync(typeReference, serializer); - } - return value; - } - - private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); - private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); - - public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { - // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. - Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. - retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then - // attempt to resolve it as an HTTP date (RFC1123). - retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, - headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); - - // Either the retry delay will have been found or it'll be null, null indicates no retry after. - return retryDelay; - } - - private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, - Function delayParser) { - String headerValue = headers.getValue(headerName); - - return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); - } - - private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { - long delaySeconds; - try { - OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); - - delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); - } catch (DateTimeException ex) { - delaySeconds = tryParseLong(value); - } - - return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; - } - - private static long tryParseLong(String value) { - try { - return Long.parseLong(value); - } catch (NumberFormatException ex) { - return -1; - } - } - - private static Duration tryGetDelayMillis(String value) { - long delayMillis = tryParseLong(value); - return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/RpcClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/RpcClientImpl.java deleted file mode 100644 index fc45b22219b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/RpcClientImpl.java +++ /dev/null @@ -1,533 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.rpc.implementation; - -import azure.core.lro.rpc.RpcServiceVersion; -import azure.core.lro.rpc.models.GenerationResult; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the RpcClient type. - */ -public final class RpcClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RpcClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final RpcServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public RpcServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of RpcClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public RpcClientImpl(String endpoint, RpcServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of RpcClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public RpcClientImpl(HttpPipeline httpPipeline, String endpoint, RpcServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of RpcClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public RpcClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - RpcServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(RpcClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for RpcClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RpcClient") - public interface RpcClientService { - @Post("/azure/core/lro/rpc/generations:submit") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> longRunningRpc(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/azure/core/lro/rpc/generations:submit") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response longRunningRpcSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Generate data. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prompt: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return provides status details for long running operations along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> longRunningRpcWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.longRunningRpc(this.getEndpoint(), - this.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context)); - } - - /** - * Generate data. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prompt: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return provides status details for long running operations along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response longRunningRpcWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.longRunningRpcSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, - accept, body, requestOptions, Context.NONE); - } - - /** - * Generate data. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prompt: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLongRunningRpcWithModelAsync(BinaryData body, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.longRunningRpcWithResponseAsync(body, requestOptions), - new azure.core.lro.rpc.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(PollOperationDetails.class), - TypeReference.createInstance(GenerationResult.class)); - } - - /** - * Generate data. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prompt: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLongRunningRpcWithModel(BinaryData body, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.longRunningRpcWithResponse(body, requestOptions), - new azure.core.lro.rpc.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(PollOperationDetails.class), - TypeReference.createInstance(GenerationResult.class)); - } - - /** - * Generate data. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prompt: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLongRunningRpcAsync(BinaryData body, RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.longRunningRpcWithResponseAsync(body, requestOptions), - new azure.core.lro.rpc.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * Generate data. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prompt: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLongRunningRpc(BinaryData body, RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.longRunningRpcWithResponse(body, requestOptions), - new azure.core.lro.rpc.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/SyncOperationLocationPollingStrategy.java deleted file mode 100644 index 8d97671b944..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/SyncOperationLocationPollingStrategy.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.rpc.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.io.UncheckedIOException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Map; - -// DO NOT modify this helper class - -/** - * Implements a synchronous operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public PollResponse onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - T initialResponseType = null; - try { - initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, - pollResponseType); - } catch (UncheckedIOException e) { - LOGGER.info("Failed to parse initial response."); - } - return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); - } - - throw LOGGER.logExceptionAsError(new AzureException( - String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - - /** - * {@inheritDoc} - */ - public U getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, - PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); - if (pollResult != null && pollResult.get(propertyName) != null) { - return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), - serializer, resultType); - } else { - throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); - } - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/package-info.java deleted file mode 100644 index e20752fc5b1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Rpc. - * Illustrates bodies templated with Azure Core with long-running RPC operation. - * - */ -package azure.core.lro.rpc.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationOptions.java deleted file mode 100644 index 13d8725cf37..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationOptions.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.rpc.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Options for the generation. - */ -@Immutable -public final class GenerationOptions implements JsonSerializable { - /* - * Prompt. - */ - @Generated - private final String prompt; - - /** - * Creates an instance of GenerationOptions class. - * - * @param prompt the prompt value to set. - */ - @Generated - public GenerationOptions(String prompt) { - this.prompt = prompt; - } - - /** - * Get the prompt property: Prompt. - * - * @return the prompt value. - */ - @Generated - public String getPrompt() { - return this.prompt; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prompt", this.prompt); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GenerationOptions from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GenerationOptions if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GenerationOptions. - */ - @Generated - public static GenerationOptions fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String prompt = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prompt".equals(fieldName)) { - prompt = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new GenerationOptions(prompt); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationResult.java deleted file mode 100644 index afd8a382b89..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationResult.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.rpc.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Result of the generation. - */ -@Immutable -public final class GenerationResult implements JsonSerializable { - /* - * The data. - */ - @Generated - private final String data; - - /** - * Creates an instance of GenerationResult class. - * - * @param data the data value to set. - */ - @Generated - private GenerationResult(String data) { - this.data = data; - } - - /** - * Get the data property: The data. - * - * @return the data value. - */ - @Generated - public String getData() { - return this.data; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("data", this.data); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GenerationResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GenerationResult if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GenerationResult. - */ - @Generated - public static GenerationResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String data = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("data".equals(fieldName)) { - data = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new GenerationResult(data); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/package-info.java deleted file mode 100644 index 2ec09e78bc7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Rpc. - * Illustrates bodies templated with Azure Core with long-running RPC operation. - * - */ -package azure.core.lro.rpc.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/package-info.java deleted file mode 100644 index b5a485d8963..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Rpc. - * Illustrates bodies templated with Azure Core with long-running RPC operation. - * - */ -package azure.core.lro.rpc; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardAsyncClient.java deleted file mode 100644 index f9b3771566c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardAsyncClient.java +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.standard; - -import azure.core.lro.standard.implementation.StandardClientImpl; -import azure.core.lro.standard.models.ExportedUser; -import azure.core.lro.standard.models.User; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.PollerFlux; - -/** - * Initializes a new instance of the asynchronous StandardClient type. - */ -@ServiceClient(builder = StandardClientBuilder.class, isAsync = true) -public final class StandardAsyncClient { - @Generated - private final StandardClientImpl serviceClient; - - /** - * Initializes an instance of StandardAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StandardAsyncClient(StandardClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of details about a user. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateOrReplace(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.beginCreateOrReplaceAsync(name, resource, requestOptions); - } - - /** - * Deletes a user. - * - * Deletes a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginDelete(String name, RequestOptions requestOptions) { - return this.serviceClient.beginDeleteAsync(name, requestOptions); - } - - /** - * Exports a user. - * - * Exports a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginExport(String name, String format, RequestOptions requestOptions) { - return this.serviceClient.beginExportAsync(name, format, requestOptions); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - * - * @param name The name of user. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of details about a user. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateOrReplace(String name, User resource) { - // Generated convenience method for beginCreateOrReplaceWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginCreateOrReplaceWithModelAsync(name, BinaryData.fromObject(resource), requestOptions); - } - - /** - * Deletes a user. - * - * Deletes a User. - * - * @param name The name of user. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginDelete(String name) { - // Generated convenience method for beginDeleteWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginDeleteWithModelAsync(name, requestOptions); - } - - /** - * Exports a user. - * - * Exports a User. - * - * @param name The name of user. - * @param format The format of the data. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginExport(String name, String format) { - // Generated convenience method for beginExportWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginExportWithModelAsync(name, format, requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClient.java deleted file mode 100644 index 418e6abc9f7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClient.java +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.standard; - -import azure.core.lro.standard.implementation.StandardClientImpl; -import azure.core.lro.standard.models.ExportedUser; -import azure.core.lro.standard.models.User; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.SyncPoller; - -/** - * Initializes a new instance of the synchronous StandardClient type. - */ -@ServiceClient(builder = StandardClientBuilder.class) -public final class StandardClient { - @Generated - private final StandardClientImpl serviceClient; - - /** - * Initializes an instance of StandardClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StandardClient(StandardClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of details about a user. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateOrReplace(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.beginCreateOrReplace(name, resource, requestOptions); - } - - /** - * Deletes a user. - * - * Deletes a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginDelete(String name, RequestOptions requestOptions) { - return this.serviceClient.beginDelete(name, requestOptions); - } - - /** - * Exports a user. - * - * Exports a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginExport(String name, String format, RequestOptions requestOptions) { - return this.serviceClient.beginExport(name, format, requestOptions); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - * - * @param name The name of user. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of details about a user. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateOrReplace(String name, User resource) { - // Generated convenience method for beginCreateOrReplaceWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginCreateOrReplaceWithModel(name, BinaryData.fromObject(resource), requestOptions); - } - - /** - * Deletes a user. - * - * Deletes a User. - * - * @param name The name of user. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginDelete(String name) { - // Generated convenience method for beginDeleteWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginDeleteWithModel(name, requestOptions); - } - - /** - * Exports a user. - * - * Exports a User. - * - * @param name The name of user. - * @param format The format of the data. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginExport(String name, String format) { - // Generated convenience method for beginExportWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginExportWithModel(name, format, requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClientBuilder.java deleted file mode 100644 index 713db27e940..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.standard; - -import azure.core.lro.standard.implementation.StandardClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the StandardClient type. - */ -@ServiceClientBuilder(serviceClients = { StandardClient.class, StandardAsyncClient.class }) -public final class StandardClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-lro-standard.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the StandardClientBuilder. - */ - @Generated - public StandardClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StandardClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StandardClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StandardClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StandardClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StandardClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StandardClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StandardClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StandardClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private StandardServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the StandardClientBuilder. - */ - @Generated - public StandardClientBuilder serviceVersion(StandardServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the StandardClientBuilder. - */ - @Generated - public StandardClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of StandardClientImpl with the provided parameters. - * - * @return an instance of StandardClientImpl. - */ - @Generated - private StandardClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - StandardServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : StandardServiceVersion.getLatest(); - StandardClientImpl client = new StandardClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of StandardAsyncClient class. - * - * @return an instance of StandardAsyncClient. - */ - @Generated - public StandardAsyncClient buildAsyncClient() { - return new StandardAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of StandardClient class. - * - * @return an instance of StandardClient. - */ - @Generated - public StandardClient buildClient() { - return new StandardClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(StandardClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardServiceVersion.java deleted file mode 100644 index e4f9ed20c5d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.standard; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of StandardClient. - */ -public enum StandardServiceVersion implements ServiceVersion { - /** - * Enum value 2022-12-01-preview. - */ - V2022_12_01_PREVIEW("2022-12-01-preview"); - - private final String version; - - StandardServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link StandardServiceVersion}. - */ - public static StandardServiceVersion getLatest() { - return V2022_12_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/OperationLocationPollingStrategy.java deleted file mode 100644 index f0087961747..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/OperationLocationPollingStrategy.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.standard.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.OperationResourcePollingStrategy; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -/** - * Implements an operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public Mono> onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - final Mono> pollResponseMono - = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) - .onErrorResume(exception -> { - LOGGER.info("Failed to parse initial response."); - return Mono.empty(); - }) - .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); - return pollResponseMono.switchIfEmpty( - Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); - } else { - return Mono - .error( - new AzureException(String.format( - "Operation failed or cancelled with status code %d," - + ", '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - } - - /** - * {@inheritDoc} - */ - @Override - public Mono getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - return Mono.error(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - return Mono.error(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - return PollingUtils - .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) - .flatMap(value -> { - if (value.get(propertyName) != null) { - return BinaryData.fromObjectAsync(value.get(propertyName)) - .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); - } else { - return Mono.error(new AzureException("Cannot get final result")); - } - }) - .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/PollingUtils.java deleted file mode 100644 index 83ec49b76d5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/PollingUtils.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.standard.implementation; - -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.BinaryData; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.net.URI; -import java.net.URISyntaxException; -import java.time.DateTimeException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.time.temporal.ChronoUnit; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -final class PollingUtils { - - public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE - = new TypeReference>() { - }; - - public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); - - public static final String HTTP_METHOD = "httpMethod"; - public static final String REQUEST_URL = "requestURL"; - public static final String POLL_RESPONSE_BODY = "pollResponseBody"; - - private static final String FORWARD_SLASH = "/"; - - public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { - try { - URI uri = new URI(path); - if (!uri.isAbsolute()) { - if (CoreUtils.isNullOrEmpty(endpoint)) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); - } - - if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { - return endpoint + path.substring(1); - } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { - return endpoint + FORWARD_SLASH + path; - } else { - return endpoint + path; - } - } - } catch (URISyntaxException ex) { - throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); - } - return path; - } - - public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - T value; - if (binaryData == null) { - value = null; - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); - } else { - value = binaryData.toObject(typeReference, serializer); - } - return value; - } - - @SuppressWarnings("unchecked") - public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - Mono value; - if (binaryData == null) { - value = Mono.empty(); - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = (Mono) binaryData.toReplayableBinaryDataAsync(); - } else { - value = binaryData.toObjectAsync(typeReference, serializer); - } - return value; - } - - private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); - private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); - - public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { - // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. - Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. - retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then - // attempt to resolve it as an HTTP date (RFC1123). - retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, - headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); - - // Either the retry delay will have been found or it'll be null, null indicates no retry after. - return retryDelay; - } - - private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, - Function delayParser) { - String headerValue = headers.getValue(headerName); - - return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); - } - - private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { - long delaySeconds; - try { - OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); - - delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); - } catch (DateTimeException ex) { - delaySeconds = tryParseLong(value); - } - - return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; - } - - private static long tryParseLong(String value) { - try { - return Long.parseLong(value); - } catch (NumberFormatException ex) { - return -1; - } - } - - private static Duration tryGetDelayMillis(String value) { - long delayMillis = tryParseLong(value); - return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/StandardClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/StandardClientImpl.java deleted file mode 100644 index 6b74c0996ec..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/StandardClientImpl.java +++ /dev/null @@ -1,1107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.standard.implementation; - -import azure.core.lro.standard.StandardServiceVersion; -import azure.core.lro.standard.models.ExportedUser; -import azure.core.lro.standard.models.User; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the StandardClient type. - */ -public final class StandardClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StandardClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final StandardServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public StandardServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of StandardClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public StandardClientImpl(String endpoint, StandardServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of StandardClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public StandardClientImpl(HttpPipeline httpPipeline, String endpoint, StandardServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of StandardClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public StandardClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - StandardServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(StandardClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for StandardClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "StandardClient") - public interface StandardClientService { - @Put("/azure/core/lro/standard/users/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createOrReplace(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); - - @Put("/azure/core/lro/standard/users/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrReplaceSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); - - @Delete("/azure/core/lro/standard/users/{name}") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Delete("/azure/core/lro/standard/users/{name}") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/azure/core/lro/standard/users/{name}:export") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> export(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @QueryParam("format") String format, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Post("/azure/core/lro/standard/users/{name}:export") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response exportSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @QueryParam("format") String format, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrReplaceWithResponseAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrReplace(this.getEndpoint(), - this.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, context)); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a user along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrReplaceWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrReplaceSync(this.getEndpoint(), this.getServiceVersion().getVersion(), name, contentType, - accept, resource, requestOptions, Context.NONE); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of details about a user. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateOrReplaceWithModelAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.createOrReplaceWithResponseAsync(name, resource, requestOptions), - new azure.core.lro.standard.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion())), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(User.class)); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of details about a user. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateOrReplaceWithModel(String name, BinaryData resource, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.createOrReplaceWithResponse(name, resource, requestOptions), - new azure.core.lro.standard.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion())), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(User.class)); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of details about a user. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateOrReplaceAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.createOrReplaceWithResponseAsync(name, resource, requestOptions), - new azure.core.lro.standard.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion())), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * Adds a user or replaces a user's fields. - * - * Creates or replaces a User. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     role: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of details about a user. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateOrReplace(String name, BinaryData resource, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.createOrReplaceWithResponse(name, resource, requestOptions), - new azure.core.lro.standard.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion())), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * Deletes a user. - * - * Deletes a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return provides status details for long running operations along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.delete(this.getEndpoint(), this.getServiceVersion().getVersion(), - name, accept, requestOptions, context)); - } - - /** - * Deletes a user. - * - * Deletes a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return provides status details for long running operations along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.deleteSync(this.getEndpoint(), this.getServiceVersion().getVersion(), name, accept, - requestOptions, Context.NONE); - } - - /** - * Deletes a user. - * - * Deletes a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginDeleteWithModelAsync(String name, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), () -> this.deleteWithResponseAsync(name, requestOptions), - new azure.core.lro.standard.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion())), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Void.class)); - } - - /** - * Deletes a user. - * - * Deletes a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginDeleteWithModel(String name, RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.deleteWithResponse(name, requestOptions), - new azure.core.lro.standard.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion())), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Void.class)); - } - - /** - * Deletes a user. - * - * Deletes a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginDeleteAsync(String name, RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), () -> this.deleteWithResponseAsync(name, requestOptions), - new azure.core.lro.standard.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion())), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(Void.class)); - } - - /** - * Deletes a user. - * - * Deletes a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginDelete(String name, RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.deleteWithResponse(name, requestOptions), - new azure.core.lro.standard.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion())), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(Void.class)); - } - - /** - * Exports a user. - * - * Exports a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return provides status details for long running operations along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> exportWithResponseAsync(String name, String format, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.export(this.getEndpoint(), this.getServiceVersion().getVersion(), - name, format, accept, requestOptions, context)); - } - - /** - * Exports a user. - * - * Exports a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return provides status details for long running operations along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response exportWithResponse(String name, String format, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.exportSync(this.getEndpoint(), this.getServiceVersion().getVersion(), name, format, accept, - requestOptions, Context.NONE); - } - - /** - * Exports a user. - * - * Exports a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginExportWithModelAsync(String name, String format, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.exportWithResponseAsync(name, format, requestOptions), - new azure.core.lro.standard.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(ExportedUser.class)); - } - - /** - * Exports a user. - * - * Exports a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginExportWithModel(String name, String format, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.exportWithResponse(name, format, requestOptions), - new azure.core.lro.standard.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(ExportedUser.class)); - } - - /** - * Exports a user. - * - * Exports a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginExportAsync(String name, String format, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.exportWithResponseAsync(name, format, requestOptions), - new azure.core.lro.standard.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * Exports a user. - * - * Exports a User. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name of user. - * @param format The format of the data. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginExport(String name, String format, RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.exportWithResponse(name, format, requestOptions), - new azure.core.lro.standard.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/SyncOperationLocationPollingStrategy.java deleted file mode 100644 index 21e94ae8c51..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/SyncOperationLocationPollingStrategy.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.standard.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.io.UncheckedIOException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Map; - -// DO NOT modify this helper class - -/** - * Implements a synchronous operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public PollResponse onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - T initialResponseType = null; - try { - initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, - pollResponseType); - } catch (UncheckedIOException e) { - LOGGER.info("Failed to parse initial response."); - } - return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); - } - - throw LOGGER.logExceptionAsError(new AzureException( - String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - - /** - * {@inheritDoc} - */ - public U getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, - PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); - if (pollResult != null && pollResult.get(propertyName) != null) { - return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), - serializer, resultType); - } else { - throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); - } - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/package-info.java deleted file mode 100644 index afa5ba5ff6a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Standard. - * Illustrates bodies templated with Azure Core with long-running operation. - * - */ -package azure.core.lro.standard.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/ExportedUser.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/ExportedUser.java deleted file mode 100644 index 9c541f6950b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/ExportedUser.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.standard.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The exported user data. - */ -@Immutable -public final class ExportedUser implements JsonSerializable { - /* - * The name of user. - */ - @Generated - private final String name; - - /* - * The exported URI. - */ - @Generated - private final String resourceUri; - - /** - * Creates an instance of ExportedUser class. - * - * @param name the name value to set. - * @param resourceUri the resourceUri value to set. - */ - @Generated - private ExportedUser(String name, String resourceUri) { - this.name = name; - this.resourceUri = resourceUri; - } - - /** - * Get the name property: The name of user. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the resourceUri property: The exported URI. - * - * @return the resourceUri value. - */ - @Generated - public String getResourceUri() { - return this.resourceUri; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("resourceUri", this.resourceUri); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExportedUser from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExportedUser if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExportedUser. - */ - @Generated - public static ExportedUser fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - String resourceUri = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("resourceUri".equals(fieldName)) { - resourceUri = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ExportedUser(name, resourceUri); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/User.java deleted file mode 100644 index 29a6b83c503..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/User.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.standard.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Details about a user. - */ -@Immutable -public final class User implements JsonSerializable { - /* - * The name of user. - */ - @Generated - private String name; - - /* - * The role of user - */ - @Generated - private final String role; - - /** - * Creates an instance of User class. - * - * @param role the role value to set. - */ - @Generated - public User(String role) { - this.role = role; - } - - /** - * Get the name property: The name of user. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the role property: The role of user. - * - * @return the role value. - */ - @Generated - public String getRole() { - return this.role; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("role", this.role); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of User from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the User. - */ - @Generated - public static User fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - String role = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("role".equals(fieldName)) { - role = reader.getString(); - } else { - reader.skipChildren(); - } - } - User deserializedUser = new User(role); - deserializedUser.name = name; - - return deserializedUser; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/package-info.java deleted file mode 100644 index a8c39b76582..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Standard. - * Illustrates bodies templated with Azure Core with long-running operation. - * - */ -package azure.core.lro.standard.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/package-info.java deleted file mode 100644 index 791326fd1fe..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Standard. - * Illustrates bodies templated with Azure Core with long-running operation. - * - */ -package azure.core.lro.standard; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelAsyncClient.java deleted file mode 100644 index 75d79a066d2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelAsyncClient.java +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.model; - -import azure.core.model.implementation.AzureCoreEmbeddingVectorsImpl; -import azure.core.model.models.AzureEmbeddingModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ModelClient type. - */ -@ServiceClient(builder = ModelClientBuilder.class, isAsync = true) -public final class ModelAsyncClient { - @Generated - private final AzureCoreEmbeddingVectorsImpl serviceClient; - - /** - * Initializes an instance of ModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelAsyncClient(AzureCoreEmbeddingVectorsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * get an embedding vector. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return an embedding vector along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * put an embedding vector. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * post a model which has an embeddingVector property. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     embedding (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     embedding (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postWithResponseAsync(body, requestOptions); - } - - /** - * get an embedding vector. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an embedding vector on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_INTEGER)); - } - - /** - * put an embedding vector. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * post a model which has an embeddingVector property. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono post(AzureEmbeddingModel body) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(AzureEmbeddingModel.class)); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_INTEGER = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClient.java deleted file mode 100644 index aabdbc0f4fc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClient.java +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.model; - -import azure.core.model.implementation.AzureCoreEmbeddingVectorsImpl; -import azure.core.model.models.AzureEmbeddingModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; - -/** - * Initializes a new instance of the synchronous ModelClient type. - */ -@ServiceClient(builder = ModelClientBuilder.class) -public final class ModelClient { - @Generated - private final AzureCoreEmbeddingVectorsImpl serviceClient; - - /** - * Initializes an instance of ModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelClient(AzureCoreEmbeddingVectorsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * get an embedding vector. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return an embedding vector along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * put an embedding vector. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * post a model which has an embeddingVector property. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     embedding (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     embedding (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postWithResponse(body, requestOptions); - } - - /** - * get an embedding vector. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an embedding vector. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_INTEGER); - } - - /** - * put an embedding vector. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * post a model which has an embeddingVector property. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public AzureEmbeddingModel post(AzureEmbeddingModel body) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(AzureEmbeddingModel.class); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_INTEGER = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClientBuilder.java deleted file mode 100644 index b5fec48b2f5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.model; - -import azure.core.model.implementation.ModelClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ModelClient type. - */ -@ServiceClientBuilder(serviceClients = { ModelClient.class, ModelAsyncClient.class }) -public final class ModelClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-model.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ModelClientBuilder. - */ - @Generated - public ModelClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private ModelServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the ModelClientBuilder. - */ - @Generated - public ModelClientBuilder serviceVersion(ModelServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ModelClientBuilder. - */ - @Generated - public ModelClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ModelClientImpl with the provided parameters. - * - * @return an instance of ModelClientImpl. - */ - @Generated - private ModelClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ModelServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : ModelServiceVersion.getLatest(); - ModelClientImpl client = new ModelClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - localEndpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ModelAsyncClient class. - * - * @return an instance of ModelAsyncClient. - */ - @Generated - public ModelAsyncClient buildAsyncClient() { - return new ModelAsyncClient(buildInnerClient().getAzureCoreEmbeddingVectors()); - } - - /** - * Builds an instance of ModelClient class. - * - * @return an instance of ModelClient. - */ - @Generated - public ModelClient buildClient() { - return new ModelClient(buildInnerClient().getAzureCoreEmbeddingVectors()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ModelClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelServiceVersion.java deleted file mode 100644 index 108b1cfa12c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.model; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of ModelClient. - */ -public enum ModelServiceVersion implements ServiceVersion { - /** - * Enum value 2022-12-01-preview. - */ - V2022_12_01_PREVIEW("2022-12-01-preview"); - - private final String version; - - ModelServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link ModelServiceVersion}. - */ - public static ModelServiceVersion getLatest() { - return V2022_12_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/AzureCoreEmbeddingVectorsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/AzureCoreEmbeddingVectorsImpl.java deleted file mode 100644 index a7710adc313..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/AzureCoreEmbeddingVectorsImpl.java +++ /dev/null @@ -1,316 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.model.implementation; - -import azure.core.model.ModelServiceVersion; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in AzureCoreEmbeddingVectors. - */ -public final class AzureCoreEmbeddingVectorsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final AzureCoreEmbeddingVectorsService service; - - /** - * The service client containing this operation class. - */ - private final ModelClientImpl client; - - /** - * Initializes an instance of AzureCoreEmbeddingVectorsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - AzureCoreEmbeddingVectorsImpl(ModelClientImpl client) { - this.service = RestProxy.create(AzureCoreEmbeddingVectorsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public ModelServiceVersion getServiceVersion() { - return client.getServiceVersion(); - } - - /** - * The interface defining all the services for ModelClientAzureCoreEmbeddingVectors to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ModelClientAzureCoreEmbeddingVectors") - public interface AzureCoreEmbeddingVectorsService { - @Get("/azure/core/model/embeddingVector") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/core/model/embeddingVector") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/azure/core/model/embeddingVector") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/azure/core/model/embeddingVector") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/azure/core/model/embeddingVector") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> post(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/azure/core/model/embeddingVector") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * get an embedding vector. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return an embedding vector along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * get an embedding vector. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return an embedding vector along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * put an embedding vector. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * put an embedding vector. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * post a model which has an embeddingVector property. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     embedding (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     embedding (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.post(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * post a model which has an embeddingVector property. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     embedding (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     embedding (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.postSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/ModelClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/ModelClientImpl.java deleted file mode 100644 index eafcea0250b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/ModelClientImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.model.implementation; - -import azure.core.model.ModelServiceVersion; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 ModelClient type. - */ -public final class ModelClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final ModelServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public ModelServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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 AzureCoreEmbeddingVectorsImpl object to access its operations. - */ - private final AzureCoreEmbeddingVectorsImpl azureCoreEmbeddingVectors; - - /** - * Gets the AzureCoreEmbeddingVectorsImpl object to access its operations. - * - * @return the AzureCoreEmbeddingVectorsImpl object. - */ - public AzureCoreEmbeddingVectorsImpl getAzureCoreEmbeddingVectors() { - return this.azureCoreEmbeddingVectors; - } - - /** - * Initializes an instance of ModelClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public ModelClientImpl(String endpoint, ModelServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of ModelClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public ModelClientImpl(HttpPipeline httpPipeline, String endpoint, ModelServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of ModelClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public ModelClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - ModelServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.azureCoreEmbeddingVectors = new AzureCoreEmbeddingVectorsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/package-info.java deleted file mode 100644 index be97a0cca1c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Model. - * - */ -package azure.core.model.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/AzureEmbeddingModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/AzureEmbeddingModel.java deleted file mode 100644 index 353e9884168..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/AzureEmbeddingModel.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The AzureEmbeddingModel model. - */ -@Immutable -public final class AzureEmbeddingModel implements JsonSerializable { - /* - * The embedding property. - */ - @Generated - private final List embedding; - - /** - * Creates an instance of AzureEmbeddingModel class. - * - * @param embedding the embedding value to set. - */ - @Generated - public AzureEmbeddingModel(List embedding) { - this.embedding = embedding; - } - - /** - * Get the embedding property: The embedding property. - * - * @return the embedding value. - */ - @Generated - public List getEmbedding() { - return this.embedding; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("embedding", this.embedding, (writer, element) -> writer.writeInt(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AzureEmbeddingModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AzureEmbeddingModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the AzureEmbeddingModel. - */ - @Generated - public static AzureEmbeddingModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List embedding = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("embedding".equals(fieldName)) { - embedding = reader.readArray(reader1 -> reader1.getInt()); - } else { - reader.skipChildren(); - } - } - return new AzureEmbeddingModel(embedding); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/package-info.java deleted file mode 100644 index aa165b66da7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Model. - * - */ -package azure.core.model.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/package-info.java deleted file mode 100644 index 87b2a0fb7e5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Model. - * - */ -package azure.core.model; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageAsyncClient.java deleted file mode 100644 index ccd87439af6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageAsyncClient.java +++ /dev/null @@ -1,403 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page; - -import azure.core.page.implementation.PageClientImpl; -import azure.core.page.models.ListItemInputBody; -import azure.core.page.models.ListItemInputExtensibleEnum; -import azure.core.page.models.User; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import java.util.stream.Collectors; -import reactor.core.publisher.Flux; - -/** - * Initializes a new instance of the asynchronous PageClient type. - */ -@ServiceClient(builder = PageClientBuilder.class, isAsync = true) -public final class PageAsyncClient { - @Generated - private final PageClientImpl serviceClient; - - /** - * Initializes an instance of PageAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PageAsyncClient(PageClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * List with Azure.Core.Page<>. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithPage(RequestOptions requestOptions) { - return this.serviceClient.listWithPageAsync(requestOptions); - } - - /** - * List with extensible enum parameter Azure.Core.Page<>. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
anotherStringNoAnother query parameter. Allowed values: "First", - * "Second".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     inputName: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyInput The body of the input. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithParameters(BinaryData bodyInput, RequestOptions requestOptions) { - return this.serviceClient.listWithParametersAsync(bodyInput, requestOptions); - } - - /** - * List with custom page model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithCustomPageModel(RequestOptions requestOptions) { - return this.serviceClient.listWithCustomPageModelAsync(requestOptions); - } - - /** - * List with parameterized next link that re-injects parameters. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
includePendingBooleanNoThe includePending parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param select The select parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux withParameterizedNextLink(String select, RequestOptions requestOptions) { - return this.serviceClient.withParameterizedNextLinkAsync(select, requestOptions); - } - - /** - * List with Azure.Core.Page<>. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithPage() { - // Generated convenience method for listWithPage - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listWithPage(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(User.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } - - /** - * List with extensible enum parameter Azure.Core.Page<>. - * - * @param bodyInput The body of the input. - * @param another Another query parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithParameters(ListItemInputBody bodyInput, ListItemInputExtensibleEnum another) { - // Generated convenience method for listWithParameters - RequestOptions requestOptions = new RequestOptions(); - if (another != null) { - requestOptions.addQueryParam("another", another.toString(), false); - } - PagedFlux pagedFluxResponse = listWithParameters(BinaryData.fromObject(bodyInput), requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(User.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } - - /** - * List with extensible enum parameter Azure.Core.Page<>. - * - * @param bodyInput The body of the input. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithParameters(ListItemInputBody bodyInput) { - // Generated convenience method for listWithParameters - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listWithParameters(BinaryData.fromObject(bodyInput), requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(User.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } - - /** - * List with custom page model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithCustomPageModel() { - // Generated convenience method for listWithCustomPageModel - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listWithCustomPageModel(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(User.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } - - /** - * List with parameterized next link that re-injects parameters. - * - * @param select The select parameter. - * @param includePending The includePending parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux withParameterizedNextLink(String select, Boolean includePending) { - // Generated convenience method for withParameterizedNextLink - RequestOptions requestOptions = new RequestOptions(); - if (includePending != null) { - requestOptions.addQueryParam("includePending", String.valueOf(includePending), false); - } - PagedFlux pagedFluxResponse = withParameterizedNextLink(select, requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(User.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } - - /** - * List with parameterized next link that re-injects parameters. - * - * @param select The select parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux withParameterizedNextLink(String select) { - // Generated convenience method for withParameterizedNextLink - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = withParameterizedNextLink(select, requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(User.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClient.java deleted file mode 100644 index d92d2dc4554..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClient.java +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page; - -import azure.core.page.implementation.PageClientImpl; -import azure.core.page.models.ListItemInputBody; -import azure.core.page.models.ListItemInputExtensibleEnum; -import azure.core.page.models.User; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous PageClient type. - */ -@ServiceClient(builder = PageClientBuilder.class) -public final class PageClient { - @Generated - private final PageClientImpl serviceClient; - - /** - * Initializes an instance of PageClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PageClient(PageClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * List with Azure.Core.Page<>. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithPage(RequestOptions requestOptions) { - return this.serviceClient.listWithPage(requestOptions); - } - - /** - * List with extensible enum parameter Azure.Core.Page<>. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
anotherStringNoAnother query parameter. Allowed values: "First", - * "Second".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     inputName: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyInput The body of the input. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithParameters(BinaryData bodyInput, RequestOptions requestOptions) { - return this.serviceClient.listWithParameters(bodyInput, requestOptions); - } - - /** - * List with custom page model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithCustomPageModel(RequestOptions requestOptions) { - return this.serviceClient.listWithCustomPageModel(requestOptions); - } - - /** - * List with parameterized next link that re-injects parameters. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
includePendingBooleanNoThe includePending parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param select The select parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable withParameterizedNextLink(String select, RequestOptions requestOptions) { - return this.serviceClient.withParameterizedNextLink(select, requestOptions); - } - - /** - * List with Azure.Core.Page<>. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithPage() { - // Generated convenience method for listWithPage - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listWithPage(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); - } - - /** - * List with extensible enum parameter Azure.Core.Page<>. - * - * @param bodyInput The body of the input. - * @param another Another query parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithParameters(ListItemInputBody bodyInput, ListItemInputExtensibleEnum another) { - // Generated convenience method for listWithParameters - RequestOptions requestOptions = new RequestOptions(); - if (another != null) { - requestOptions.addQueryParam("another", another.toString(), false); - } - return serviceClient.listWithParameters(BinaryData.fromObject(bodyInput), requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); - } - - /** - * List with extensible enum parameter Azure.Core.Page<>. - * - * @param bodyInput The body of the input. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithParameters(ListItemInputBody bodyInput) { - // Generated convenience method for listWithParameters - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listWithParameters(BinaryData.fromObject(bodyInput), requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); - } - - /** - * List with custom page model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithCustomPageModel() { - // Generated convenience method for listWithCustomPageModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listWithCustomPageModel(requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); - } - - /** - * List with parameterized next link that re-injects parameters. - * - * @param select The select parameter. - * @param includePending The includePending parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable withParameterizedNextLink(String select, Boolean includePending) { - // Generated convenience method for withParameterizedNextLink - RequestOptions requestOptions = new RequestOptions(); - if (includePending != null) { - requestOptions.addQueryParam("includePending", String.valueOf(includePending), false); - } - return serviceClient.withParameterizedNextLink(select, requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); - } - - /** - * List with parameterized next link that re-injects parameters. - * - * @param select The select parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable withParameterizedNextLink(String select) { - // Generated convenience method for withParameterizedNextLink - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.withParameterizedNextLink(select, requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClientBuilder.java deleted file mode 100644 index 78db020bef3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClientBuilder.java +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page; - -import azure.core.page.implementation.PageClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the PageClient type. - */ -@ServiceClientBuilder( - serviceClients = { - PageClient.class, - TwoModelsAsPageItemClient.class, - PageAsyncClient.class, - TwoModelsAsPageItemAsyncClient.class }) -public final class PageClientBuilder - implements HttpTrait, ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-page.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the PageClientBuilder. - */ - @Generated - public PageClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private PageServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the PageClientBuilder. - */ - @Generated - public PageClientBuilder serviceVersion(PageServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the PageClientBuilder. - */ - @Generated - public PageClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of PageClientImpl with the provided parameters. - * - * @return an instance of PageClientImpl. - */ - @Generated - private PageClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - PageServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : PageServiceVersion.getLatest(); - PageClientImpl client = new PageClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - localEndpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of PageAsyncClient class. - * - * @return an instance of PageAsyncClient. - */ - @Generated - public PageAsyncClient buildAsyncClient() { - return new PageAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of TwoModelsAsPageItemAsyncClient class. - * - * @return an instance of TwoModelsAsPageItemAsyncClient. - */ - @Generated - public TwoModelsAsPageItemAsyncClient buildTwoModelsAsPageItemAsyncClient() { - return new TwoModelsAsPageItemAsyncClient(buildInnerClient().getTwoModelsAsPageItems()); - } - - /** - * Builds an instance of PageClient class. - * - * @return an instance of PageClient. - */ - @Generated - public PageClient buildClient() { - return new PageClient(buildInnerClient()); - } - - /** - * Builds an instance of TwoModelsAsPageItemClient class. - * - * @return an instance of TwoModelsAsPageItemClient. - */ - @Generated - public TwoModelsAsPageItemClient buildTwoModelsAsPageItemClient() { - return new TwoModelsAsPageItemClient(buildInnerClient().getTwoModelsAsPageItems()); - } - - private static final ClientLogger LOGGER = new ClientLogger(PageClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageServiceVersion.java deleted file mode 100644 index 8f9d6dc1bc6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of PageClient. - */ -public enum PageServiceVersion implements ServiceVersion { - /** - * Enum value 2022-12-01-preview. - */ - V2022_12_01_PREVIEW("2022-12-01-preview"); - - private final String version; - - PageServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link PageServiceVersion}. - */ - public static PageServiceVersion getLatest() { - return V2022_12_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemAsyncClient.java deleted file mode 100644 index 944ecd05bbf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemAsyncClient.java +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page; - -import azure.core.page.implementation.TwoModelsAsPageItemsImpl; -import azure.core.page.models.FirstItem; -import azure.core.page.models.SecondItem; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import java.util.stream.Collectors; -import reactor.core.publisher.Flux; - -/** - * Initializes a new instance of the asynchronous PageClient type. - */ -@ServiceClient(builder = PageClientBuilder.class, isAsync = true) -public final class TwoModelsAsPageItemAsyncClient { - @Generated - private final TwoModelsAsPageItemsImpl serviceClient; - - /** - * Initializes an instance of TwoModelsAsPageItemAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - TwoModelsAsPageItemAsyncClient(TwoModelsAsPageItemsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * FirstItem. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of FirstItem items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listFirstItem(RequestOptions requestOptions) { - return this.serviceClient.listFirstItemAsync(requestOptions); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * SecondItem. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of SecondItem items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listSecondItem(RequestOptions requestOptions) { - return this.serviceClient.listSecondItemAsync(requestOptions); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * FirstItem. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of FirstItem items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listFirstItem() { - // Generated convenience method for listFirstItem - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listFirstItem(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(FirstItem.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * SecondItem. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of SecondItem items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listSecondItem() { - // Generated convenience method for listSecondItem - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listSecondItem(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(SecondItem.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemClient.java deleted file mode 100644 index 7a73a3f4b40..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page; - -import azure.core.page.implementation.TwoModelsAsPageItemsImpl; -import azure.core.page.models.FirstItem; -import azure.core.page.models.SecondItem; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous PageClient type. - */ -@ServiceClient(builder = PageClientBuilder.class) -public final class TwoModelsAsPageItemClient { - @Generated - private final TwoModelsAsPageItemsImpl serviceClient; - - /** - * Initializes an instance of TwoModelsAsPageItemClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - TwoModelsAsPageItemClient(TwoModelsAsPageItemsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * FirstItem. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of FirstItem items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listFirstItem(RequestOptions requestOptions) { - return this.serviceClient.listFirstItem(requestOptions); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * SecondItem. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of SecondItem items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listSecondItem(RequestOptions requestOptions) { - return this.serviceClient.listSecondItem(requestOptions); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * FirstItem. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of FirstItem items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listFirstItem() { - // Generated convenience method for listFirstItem - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listFirstItem(requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(FirstItem.class)); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * SecondItem. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of SecondItem items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listSecondItem() { - // Generated convenience method for listSecondItem - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listSecondItem(requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(SecondItem.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/PageClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/PageClientImpl.java deleted file mode 100644 index c870206103b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/PageClientImpl.java +++ /dev/null @@ -1,1389 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page.implementation; - -import azure.core.page.PageServiceVersion; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -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.RequestOptions; -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 com.azure.core.util.UrlBuilder; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the PageClient type. - */ -public final class PageClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PageClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final PageServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public PageServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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 TwoModelsAsPageItemsImpl object to access its operations. - */ - private final TwoModelsAsPageItemsImpl twoModelsAsPageItems; - - /** - * Gets the TwoModelsAsPageItemsImpl object to access its operations. - * - * @return the TwoModelsAsPageItemsImpl object. - */ - public TwoModelsAsPageItemsImpl getTwoModelsAsPageItems() { - return this.twoModelsAsPageItems; - } - - /** - * Initializes an instance of PageClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public PageClientImpl(String endpoint, PageServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of PageClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public PageClientImpl(HttpPipeline httpPipeline, String endpoint, PageServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of PageClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public PageClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - PageServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.twoModelsAsPageItems = new TwoModelsAsPageItemsImpl(this); - this.service = RestProxy.create(PageClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for PageClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "PageClient") - public interface PageClientService { - @Get("/azure/core/page/page") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listWithPage(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/core/page/page") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listWithPageSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/azure/core/page/parameters") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listWithParameters(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData bodyInput, RequestOptions requestOptions, Context context); - - @Post("/azure/core/page/parameters") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listWithParametersSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData bodyInput, RequestOptions requestOptions, Context context); - - @Get("/azure/core/page/custom-page") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listWithCustomPageModel(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/core/page/custom-page") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listWithCustomPageModelSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/core/page/with-parameterized-next-link") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withParameterizedNextLink(@HostParam("endpoint") String endpoint, - @QueryParam("select") String select, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/azure/core/page/with-parameterized-next-link") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withParameterizedNextLinkSync(@HostParam("endpoint") String endpoint, - @QueryParam("select") String select, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listWithPageNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listWithPageNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listWithParametersNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listWithParametersNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listWithCustomPageModelNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listWithCustomPageModelNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withParameterizedNextLinkNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withParameterizedNextLinkNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * List with Azure.Core.Page<>. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithPageSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listWithPage(this.getEndpoint(), this.getServiceVersion().getVersion(), - accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * List with Azure.Core.Page<>. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithPageAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listWithPageSinglePageAsync(requestOptions), - nextLink -> listWithPageNextSinglePageAsync(nextLink, requestOptionsForNextPage)); - } - - /** - * List with Azure.Core.Page<>. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listWithPageSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listWithPageSync(this.getEndpoint(), this.getServiceVersion().getVersion(), - accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * List with Azure.Core.Page<>. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithPage(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listWithPageSinglePage(requestOptions), - nextLink -> listWithPageNextSinglePage(nextLink, requestOptionsForNextPage)); - } - - /** - * List with extensible enum parameter Azure.Core.Page<>. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
anotherStringNoAnother query parameter. Allowed values: "First", - * "Second".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     inputName: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyInput The body of the input. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithParametersSinglePageAsync(BinaryData bodyInput, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listWithParameters(this.getEndpoint(), - this.getServiceVersion().getVersion(), accept, bodyInput, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * List with extensible enum parameter Azure.Core.Page<>. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
anotherStringNoAnother query parameter. Allowed values: "First", - * "Second".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     inputName: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyInput The body of the input. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithParametersAsync(BinaryData bodyInput, RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listWithParametersSinglePageAsync(bodyInput, requestOptions), - nextLink -> listWithParametersNextSinglePageAsync(nextLink, requestOptionsForNextPage)); - } - - /** - * List with extensible enum parameter Azure.Core.Page<>. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
anotherStringNoAnother query parameter. Allowed values: "First", - * "Second".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     inputName: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyInput The body of the input. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listWithParametersSinglePage(BinaryData bodyInput, - RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listWithParametersSync(this.getEndpoint(), - this.getServiceVersion().getVersion(), accept, bodyInput, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * List with extensible enum parameter Azure.Core.Page<>. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
anotherStringNoAnother query parameter. Allowed values: "First", - * "Second".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     inputName: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyInput The body of the input. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithParameters(BinaryData bodyInput, RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listWithParametersSinglePage(bodyInput, requestOptions), - nextLink -> listWithParametersNextSinglePage(nextLink, requestOptionsForNextPage)); - } - - /** - * List with custom page model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithCustomPageModelSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listWithCustomPageModel(this.getEndpoint(), - this.getServiceVersion().getVersion(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * List with custom page model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithCustomPageModelAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listWithCustomPageModelSinglePageAsync(requestOptions), - nextLink -> listWithCustomPageModelNextSinglePageAsync(nextLink, requestOptionsForNextPage)); - } - - /** - * List with custom page model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listWithCustomPageModelSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listWithCustomPageModelSync(this.getEndpoint(), - this.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * List with custom page model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithCustomPageModel(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listWithCustomPageModelSinglePage(requestOptions), - nextLink -> listWithCustomPageModelNextSinglePage(nextLink, requestOptionsForNextPage)); - } - - /** - * List with parameterized next link that re-injects parameters. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
includePendingBooleanNoThe includePending parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param select The select parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> withParameterizedNextLinkSinglePageAsync(String select, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.withParameterizedNextLink(this.getEndpoint(), select, accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "values"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * List with parameterized next link that re-injects parameters. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
includePendingBooleanNoThe includePending parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param select The select parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux withParameterizedNextLinkAsync(String select, RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - if (requestOptions != null) { - requestOptions.addRequestCallback(httpRequest -> { - UrlBuilder urlBuilder = UrlBuilder.parse(httpRequest.getUrl().toString()); - Map queryParams = urlBuilder.getQuery(); - if (queryParams.containsKey("includePending")) { - requestOptionsForNextPage.addQueryParam("includePending", queryParams.get("includePending")); - } - }); - } - return new PagedFlux<>(() -> withParameterizedNextLinkSinglePageAsync(select, requestOptions), - nextLink -> withParameterizedNextLinkNextSinglePageAsync(nextLink, requestOptionsForNextPage)); - } - - /** - * List with parameterized next link that re-injects parameters. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
includePendingBooleanNoThe includePending parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param select The select parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse withParameterizedNextLinkSinglePage(String select, - RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.withParameterizedNextLinkSync(this.getEndpoint(), select, accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "values"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * List with parameterized next link that re-injects parameters. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
includePendingBooleanNoThe includePending parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param select The select parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable withParameterizedNextLink(String select, RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - if (requestOptions != null) { - requestOptions.addRequestCallback(httpRequest -> { - UrlBuilder urlBuilder = UrlBuilder.parse(httpRequest.getUrl().toString()); - Map queryParams = urlBuilder.getQuery(); - if (queryParams.containsKey("includePending")) { - requestOptionsForNextPage.addQueryParam("includePending", queryParams.get("includePending")); - } - }); - } - return new PagedIterable<>(() -> withParameterizedNextLinkSinglePage(select, requestOptions), - nextLink -> withParameterizedNextLinkNextSinglePage(nextLink, requestOptionsForNextPage)); - } - - /** - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithPageNextSinglePageAsync(String nextLink, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listWithPageNext(nextLink, this.getEndpoint(), 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
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listWithPageNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listWithPageNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); - return 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
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithParametersNextSinglePageAsync(String nextLink, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listWithParametersNext(nextLink, this.getEndpoint(), 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
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listWithParametersNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listWithParametersNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); - return 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
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithCustomPageModelNextSinglePageAsync(String nextLink, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listWithCustomPageModelNext(nextLink, this.getEndpoint(), accept, - requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listWithCustomPageModelNextSinglePage(String nextLink, - RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listWithCustomPageModelNextSync(nextLink, this.getEndpoint(), accept, - requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> withParameterizedNextLinkNextSinglePageAsync(String nextLink, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.withParameterizedNextLinkNext(nextLink, this.getEndpoint(), 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
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     *     orders (Optional): [
-     *          (Optional){
-     *             id: int (Required)
-     *             userId: int (Required)
-     *             detail: String (Required)
-     *         }
-     *     ]
-     *     etag: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse withParameterizedNextLinkNextSinglePage(String nextLink, - RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.withParameterizedNextLinkNextSync(nextLink, this.getEndpoint(), accept, - requestOptions, Context.NONE); - return 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 { - Map obj = binaryData.toObject(Map.class); - List values = (List) obj.get(path); - return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); - } catch (RuntimeException e) { - return null; - } - } - - private String getNextLink(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - return (String) obj.get(path); - } catch (RuntimeException e) { - return null; - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java deleted file mode 100644 index 177aee41257..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java +++ /dev/null @@ -1,534 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page.implementation; - -import azure.core.page.PageServiceVersion; -import com.azure.core.annotation.ExpectedResponses; -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.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -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.RequestOptions; -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 TwoModelsAsPageItems. - */ -public final class TwoModelsAsPageItemsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final TwoModelsAsPageItemsService service; - - /** - * The service client containing this operation class. - */ - private final PageClientImpl client; - - /** - * Initializes an instance of TwoModelsAsPageItemsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - TwoModelsAsPageItemsImpl(PageClientImpl client) { - this.service = RestProxy.create(TwoModelsAsPageItemsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public PageServiceVersion getServiceVersion() { - return client.getServiceVersion(); - } - - /** - * The interface defining all the services for PageClientTwoModelsAsPageItems to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "PageClientTwoModelsAsPageItems") - public interface TwoModelsAsPageItemsService { - @Get("/azure/core/page/first-item") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listFirstItem(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/core/page/first-item") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listFirstItemSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/core/page/second-item") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listSecondItem(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/core/page/second-item") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listSecondItemSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listFirstItemNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listFirstItemNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listSecondItemNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listSecondItemNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * FirstItem. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of FirstItem items along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listFirstItemSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listFirstItem(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * FirstItem. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of FirstItem items as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listFirstItemAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listFirstItemSinglePageAsync(requestOptions), - nextLink -> listFirstItemNextSinglePageAsync(nextLink, requestOptionsForNextPage)); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * FirstItem. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of FirstItem items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listFirstItemSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listFirstItemSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * FirstItem. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of FirstItem items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listFirstItem(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listFirstItemSinglePage(requestOptions), - nextLink -> listFirstItemNextSinglePage(nextLink, requestOptionsForNextPage)); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * SecondItem. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of SecondItem items along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSecondItemSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listSecondItem(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * SecondItem. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of SecondItem items as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listSecondItemAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listSecondItemSinglePageAsync(requestOptions), - nextLink -> listSecondItemNextSinglePageAsync(nextLink, requestOptionsForNextPage)); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * SecondItem. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of SecondItem items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSecondItemSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listSecondItemSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * Two operations with two different page item types should be successfully generated. Should generate model for - * SecondItem. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of SecondItem items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listSecondItem(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listSecondItemSinglePage(requestOptions), - nextLink -> listSecondItemNextSinglePage(nextLink, requestOptionsForNextPage)); - } - - /** - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of FirstItem items along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listFirstItemNextSinglePageAsync(String nextLink, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listFirstItemNext(nextLink, this.client.getEndpoint(), 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
-     * {
-     *     id: int (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of FirstItem items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listFirstItemNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listFirstItemNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); - return 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
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of SecondItem items along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSecondItemNextSinglePageAsync(String nextLink, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listSecondItemNext(nextLink, this.client.getEndpoint(), 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
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of SecondItem items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSecondItemNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listSecondItemNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - private List getValues(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - List values = (List) obj.get(path); - return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); - } catch (RuntimeException e) { - return null; - } - } - - private String getNextLink(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - return (String) obj.get(path); - } catch (RuntimeException e) { - return null; - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/package-info.java deleted file mode 100644 index e8b34fec789..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Page. - * Illustrates bodies templated with Azure Core with paging support. - * - */ -package azure.core.page.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/FirstItem.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/FirstItem.java deleted file mode 100644 index 3a253d4c0ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/FirstItem.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * First item. - */ -@Immutable -public final class FirstItem implements JsonSerializable { - /* - * The id of the item. - */ - @Generated - private int id; - - /** - * Creates an instance of FirstItem class. - */ - @Generated - private FirstItem() { - } - - /** - * Get the id property: The id of the item. - * - * @return the id value. - */ - @Generated - public int getId() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FirstItem from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FirstItem if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FirstItem. - */ - @Generated - public static FirstItem fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - FirstItem deserializedFirstItem = new FirstItem(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedFirstItem.id = reader.getInt(); - } else { - reader.skipChildren(); - } - } - - return deserializedFirstItem; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputBody.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputBody.java deleted file mode 100644 index 216dca2398e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputBody.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The body of the input. - */ -@Immutable -public final class ListItemInputBody implements JsonSerializable { - /* - * The name of the input. - */ - @Generated - private final String inputName; - - /** - * Creates an instance of ListItemInputBody class. - * - * @param inputName the inputName value to set. - */ - @Generated - public ListItemInputBody(String inputName) { - this.inputName = inputName; - } - - /** - * Get the inputName property: The name of the input. - * - * @return the inputName value. - */ - @Generated - public String getInputName() { - return this.inputName; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("inputName", this.inputName); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ListItemInputBody from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ListItemInputBody if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ListItemInputBody. - */ - @Generated - public static ListItemInputBody fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String inputName = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("inputName".equals(fieldName)) { - inputName = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ListItemInputBody(inputName); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputExtensibleEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputExtensibleEnum.java deleted file mode 100644 index e8ef6821558..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputExtensibleEnum.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page.models; - -/** - * An extensible enum input parameter. - */ -public enum ListItemInputExtensibleEnum { - /** - * The first enum value. - */ - FIRST("First"), - - /** - * The second enum value. - */ - SECOND("Second"); - - /** - * The actual serialized value for a ListItemInputExtensibleEnum instance. - */ - private final String value; - - ListItemInputExtensibleEnum(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a ListItemInputExtensibleEnum instance. - * - * @param value the serialized value to parse. - * @return the parsed ListItemInputExtensibleEnum object, or null if unable to parse. - */ - public static ListItemInputExtensibleEnum fromString(String value) { - if (value == null) { - return null; - } - ListItemInputExtensibleEnum[] items = ListItemInputExtensibleEnum.values(); - for (ListItemInputExtensibleEnum item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/SecondItem.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/SecondItem.java deleted file mode 100644 index 78284815a72..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/SecondItem.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Second item. - */ -@Immutable -public final class SecondItem implements JsonSerializable { - /* - * The name of the item. - */ - @Generated - private String name; - - /** - * Creates an instance of SecondItem class. - */ - @Generated - private SecondItem() { - } - - /** - * Get the name property: The name of the item. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SecondItem from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SecondItem if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SecondItem. - */ - @Generated - public static SecondItem fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SecondItem deserializedSecondItem = new SecondItem(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedSecondItem.name = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedSecondItem; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/User.java deleted file mode 100644 index 79073d63522..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/User.java +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * Details about a user. - */ -@Immutable -public final class User implements JsonSerializable { - /* - * The user's id. - */ - @Generated - private int id; - - /* - * The user's name. - */ - @Generated - private final String name; - - /* - * The user's order list - */ - @Generated - private List orders; - - /* - * The entity tag for this resource. - */ - @Generated - private String etag; - - /** - * Creates an instance of User class. - * - * @param name the name value to set. - */ - @Generated - private User(String name) { - this.name = name; - } - - /** - * Get the id property: The user's id. - * - * @return the id value. - */ - @Generated - public int getId() { - return this.id; - } - - /** - * Get the name property: The user's name. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the orders property: The user's order list. - * - * @return the orders value. - */ - @Generated - public List getOrders() { - return this.orders; - } - - /** - * Get the etag property: The entity tag for this resource. - * - * @return the etag value. - */ - @Generated - public String getEtag() { - return this.etag; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeArrayField("orders", this.orders, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of User from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the User. - */ - @Generated - public static User fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int id = 0; - String name = null; - String etag = null; - List orders = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getInt(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("etag".equals(fieldName)) { - etag = reader.getString(); - } else if ("orders".equals(fieldName)) { - orders = reader.readArray(reader1 -> UserOrder.fromJson(reader1)); - } else { - reader.skipChildren(); - } - } - User deserializedUser = new User(name); - deserializedUser.id = id; - deserializedUser.etag = etag; - deserializedUser.orders = orders; - - return deserializedUser; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/UserOrder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/UserOrder.java deleted file mode 100644 index 57223330106..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/UserOrder.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * UserOrder for testing list with expand. - */ -@Immutable -public final class UserOrder implements JsonSerializable { - /* - * The user's id. - */ - @Generated - private int id; - - /* - * The user's id. - */ - @Generated - private final int userId; - - /* - * The user's order detail - */ - @Generated - private final String detail; - - /** - * Creates an instance of UserOrder class. - * - * @param userId the userId value to set. - * @param detail the detail value to set. - */ - @Generated - private UserOrder(int userId, String detail) { - this.userId = userId; - this.detail = detail; - } - - /** - * Get the id property: The user's id. - * - * @return the id value. - */ - @Generated - public int getId() { - return this.id; - } - - /** - * Get the userId property: The user's id. - * - * @return the userId value. - */ - @Generated - public int getUserId() { - return this.userId; - } - - /** - * Get the detail property: The user's order detail. - * - * @return the detail value. - */ - @Generated - public String getDetail() { - return this.detail; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("userId", this.userId); - jsonWriter.writeStringField("detail", this.detail); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UserOrder from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UserOrder if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UserOrder. - */ - @Generated - public static UserOrder fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int id = 0; - int userId = 0; - String detail = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getInt(); - } else if ("userId".equals(fieldName)) { - userId = reader.getInt(); - } else if ("detail".equals(fieldName)) { - detail = reader.getString(); - } else { - reader.skipChildren(); - } - } - UserOrder deserializedUserOrder = new UserOrder(userId, detail); - deserializedUserOrder.id = id; - - return deserializedUserOrder; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/package-info.java deleted file mode 100644 index 586acb3d66a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Page. - * Illustrates bodies templated with Azure Core with paging support. - * - */ -package azure.core.page.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/package-info.java deleted file mode 100644 index a6c2f64f4c4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Page. - * Illustrates bodies templated with Azure Core with paging support. - * - */ -package azure.core.page; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarAsyncClient.java deleted file mode 100644 index 7e9252a3a54..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarAsyncClient.java +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.scalar; - -import azure.core.scalar.implementation.AzureLocationScalarsImpl; -import azure.core.scalar.models.AzureLocationModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) -public final class ScalarAsyncClient { - @Generated - private final AzureLocationScalarsImpl serviceClient; - - /** - * Initializes an instance of ScalarAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ScalarAsyncClient(AzureLocationScalarsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * get azureLocation value. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return azureLocation value along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * put azureLocation value. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * post a model which has azureLocation property. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     location: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     location: String (Required)
-     * }
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postWithResponseAsync(body, requestOptions); - } - - /** - * azureLocation value header. - * - * @param region _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> headerMethodWithResponse(String region, RequestOptions requestOptions) { - return this.serviceClient.headerMethodWithResponseAsync(region, requestOptions); - } - - /** - * azureLocation value query. - * - * @param region _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> queryWithResponse(String region, RequestOptions requestOptions) { - return this.serviceClient.queryWithResponseAsync(region, requestOptions); - } - - /** - * get azureLocation value. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return azureLocation value on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(String.class)); - } - - /** - * put azureLocation value. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(String body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * post a model which has azureLocation property. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono post(AzureLocationModel body) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(AzureLocationModel.class)); - } - - /** - * azureLocation value header. - * - * @param region _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono headerMethod(String region) { - // Generated convenience method for headerMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return headerMethodWithResponse(region, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * azureLocation value query. - * - * @param region _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono query(String region) { - // Generated convenience method for queryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return queryWithResponse(region, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClient.java deleted file mode 100644 index a30e9ff33e2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClient.java +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.scalar; - -import azure.core.scalar.implementation.AzureLocationScalarsImpl; -import azure.core.scalar.models.AzureLocationModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class) -public final class ScalarClient { - @Generated - private final AzureLocationScalarsImpl serviceClient; - - /** - * Initializes an instance of ScalarClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ScalarClient(AzureLocationScalarsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * get azureLocation value. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return azureLocation value along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * put azureLocation value. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * post a model which has azureLocation property. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     location: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     location: String (Required)
-     * }
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postWithResponse(body, requestOptions); - } - - /** - * azureLocation value header. - * - * @param region _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response headerMethodWithResponse(String region, RequestOptions requestOptions) { - return this.serviceClient.headerMethodWithResponse(region, requestOptions); - } - - /** - * azureLocation value query. - * - * @param region _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response queryWithResponse(String region, RequestOptions requestOptions) { - return this.serviceClient.queryWithResponse(region, requestOptions); - } - - /** - * get azureLocation value. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return azureLocation value. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public String get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(String.class); - } - - /** - * put azureLocation value. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(String body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * post a model which has azureLocation property. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public AzureLocationModel post(AzureLocationModel body) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(AzureLocationModel.class); - } - - /** - * azureLocation value header. - * - * @param region _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void headerMethod(String region) { - // Generated convenience method for headerMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - headerMethodWithResponse(region, requestOptions).getValue(); - } - - /** - * azureLocation value query. - * - * @param region _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void query(String region) { - // Generated convenience method for queryWithResponse - RequestOptions requestOptions = new RequestOptions(); - queryWithResponse(region, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClientBuilder.java deleted file mode 100644 index 6402651ad25..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.scalar; - -import azure.core.scalar.implementation.ScalarClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ScalarClient type. - */ -@ServiceClientBuilder(serviceClients = { ScalarClient.class, ScalarAsyncClient.class }) -public final class ScalarClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-scalar.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ScalarClientBuilder. - */ - @Generated - public ScalarClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private ScalarServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the ScalarClientBuilder. - */ - @Generated - public ScalarClientBuilder serviceVersion(ScalarServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ScalarClientBuilder. - */ - @Generated - public ScalarClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ScalarClientImpl with the provided parameters. - * - * @return an instance of ScalarClientImpl. - */ - @Generated - private ScalarClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ScalarServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : ScalarServiceVersion.getLatest(); - ScalarClientImpl client = new ScalarClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - localEndpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ScalarAsyncClient class. - * - * @return an instance of ScalarAsyncClient. - */ - @Generated - public ScalarAsyncClient buildAsyncClient() { - return new ScalarAsyncClient(buildInnerClient().getAzureLocationScalars()); - } - - /** - * Builds an instance of ScalarClient class. - * - * @return an instance of ScalarClient. - */ - @Generated - public ScalarClient buildClient() { - return new ScalarClient(buildInnerClient().getAzureLocationScalars()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ScalarClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarServiceVersion.java deleted file mode 100644 index 040e5d7c8fb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.scalar; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of ScalarClient. - */ -public enum ScalarServiceVersion implements ServiceVersion { - /** - * Enum value 2022-12-01-preview. - */ - V2022_12_01_PREVIEW("2022-12-01-preview"); - - private final String version; - - ScalarServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link ScalarServiceVersion}. - */ - public static ScalarServiceVersion getLatest() { - return V2022_12_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/AzureLocationScalarsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/AzureLocationScalarsImpl.java deleted file mode 100644 index e459eaf4eba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/AzureLocationScalarsImpl.java +++ /dev/null @@ -1,403 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.scalar.implementation; - -import azure.core.scalar.ScalarServiceVersion; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in AzureLocationScalars. - */ -public final class AzureLocationScalarsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final AzureLocationScalarsService service; - - /** - * The service client containing this operation class. - */ - private final ScalarClientImpl client; - - /** - * Initializes an instance of AzureLocationScalarsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - AzureLocationScalarsImpl(ScalarClientImpl client) { - this.service = RestProxy.create(AzureLocationScalarsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public ScalarServiceVersion getServiceVersion() { - return client.getServiceVersion(); - } - - /** - * The interface defining all the services for ScalarClientAzureLocationScalars to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ScalarClientAzureLocationScalars") - public interface AzureLocationScalarsService { - @Get("/azure/core/scalar/azureLocation") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/core/scalar/azureLocation") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/azure/core/scalar/azureLocation") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/azure/core/scalar/azureLocation") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/azure/core/scalar/azureLocation") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> post(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/azure/core/scalar/azureLocation") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/azure/core/scalar/azureLocation/header") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> headerMethod(@HostParam("endpoint") String endpoint, @HeaderParam("region") String region, - RequestOptions requestOptions, Context context); - - @Post("/azure/core/scalar/azureLocation/header") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response headerMethodSync(@HostParam("endpoint") String endpoint, @HeaderParam("region") String region, - RequestOptions requestOptions, Context context); - - @Post("/azure/core/scalar/azureLocation/query") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> query(@HostParam("endpoint") String endpoint, @QueryParam("region") String region, - RequestOptions requestOptions, Context context); - - @Post("/azure/core/scalar/azureLocation/query") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response querySync(@HostParam("endpoint") String endpoint, @QueryParam("region") String region, - RequestOptions requestOptions, Context context); - } - - /** - * get azureLocation value. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return azureLocation value along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * get azureLocation value. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return azureLocation value along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * put azureLocation value. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * put azureLocation value. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * post a model which has azureLocation property. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     location: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     location: String (Required)
-     * }
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.post(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * post a model which has azureLocation property. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     location: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     location: String (Required)
-     * }
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.postSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } - - /** - * azureLocation value header. - * - * @param region _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> headerMethodWithResponseAsync(String region, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.headerMethod(this.client.getEndpoint(), region, requestOptions, context)); - } - - /** - * azureLocation value header. - * - * @param region _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response headerMethodWithResponse(String region, RequestOptions requestOptions) { - return service.headerMethodSync(this.client.getEndpoint(), region, requestOptions, Context.NONE); - } - - /** - * azureLocation value query. - * - * @param region _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> queryWithResponseAsync(String region, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.query(this.client.getEndpoint(), region, requestOptions, context)); - } - - /** - * azureLocation value query. - * - * @param region _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response queryWithResponse(String region, RequestOptions requestOptions) { - return service.querySync(this.client.getEndpoint(), region, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/ScalarClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/ScalarClientImpl.java deleted file mode 100644 index f02ea66e3c2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/ScalarClientImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.scalar.implementation; - -import azure.core.scalar.ScalarServiceVersion; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 ScalarClient type. - */ -public final class ScalarClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final ScalarServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public ScalarServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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 AzureLocationScalarsImpl object to access its operations. - */ - private final AzureLocationScalarsImpl azureLocationScalars; - - /** - * Gets the AzureLocationScalarsImpl object to access its operations. - * - * @return the AzureLocationScalarsImpl object. - */ - public AzureLocationScalarsImpl getAzureLocationScalars() { - return this.azureLocationScalars; - } - - /** - * Initializes an instance of ScalarClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public ScalarClientImpl(String endpoint, ScalarServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of ScalarClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public ScalarClientImpl(HttpPipeline httpPipeline, String endpoint, ScalarServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of ScalarClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public ScalarClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - ScalarServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.azureLocationScalars = new AzureLocationScalarsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/package-info.java deleted file mode 100644 index 53c0447681d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Scalar. - * - */ -package azure.core.scalar.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/AzureLocationModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/AzureLocationModel.java deleted file mode 100644 index 796aa35bccc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/AzureLocationModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.scalar.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The AzureLocationModel model. - */ -@Immutable -public final class AzureLocationModel implements JsonSerializable { - /* - * The location property. - */ - @Generated - private final String location; - - /** - * Creates an instance of AzureLocationModel class. - * - * @param location the location value to set. - */ - @Generated - public AzureLocationModel(String location) { - this.location = location; - } - - /** - * Get the location property: The location property. - * - * @return the location value. - */ - @Generated - public String getLocation() { - return this.location; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", this.location); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AzureLocationModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AzureLocationModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the AzureLocationModel. - */ - @Generated - public static AzureLocationModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String location = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("location".equals(fieldName)) { - location = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new AzureLocationModel(location); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/package-info.java deleted file mode 100644 index efdd10b7115..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Scalar. - * - */ -package azure.core.scalar.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/package-info.java deleted file mode 100644 index f48930a0b2e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Scalar. - * - */ -package azure.core.scalar; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsAsyncClient.java deleted file mode 100644 index 6e664b20672..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsAsyncClient.java +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.traits; - -import azure.core.traits.implementation.TraitsClientImpl; -import azure.core.traits.models.User; -import azure.core.traits.models.UserActionParam; -import azure.core.traits.models.UserActionResponse; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.RequestConditions; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.FluxUtil; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous TraitsClient type. - */ -@ServiceClient(builder = TraitsClientBuilder.class, isAsync = true) -public final class TraitsAsyncClient { - @Generated - private final TraitsClientImpl serviceClient; - - /** - * Initializes an instance of TraitsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - TraitsAsyncClient(TraitsClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get a resource, sending and receiving headers. - *

Header Parameters

- * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the - * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity - * was modified after this time.
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param foo header in request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a resource, sending and receiving headers along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> smokeTestWithResponse(int id, String foo, RequestOptions requestOptions) { - return this.serviceClient.smokeTestWithResponseAsync(id, foo, requestOptions); - } - - /** - * Test for repeatable requests. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     userActionValue: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     userActionResult: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return user action response along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> repeatableActionWithResponse(int id, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.repeatableActionWithResponseAsync(id, body, requestOptions); - } - - /** - * Get a resource, sending and receiving headers. - * - * @param id The user's id. - * @param foo header in request. - * @param requestConditions Specifies HTTP options for conditional requests based on modification time. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a resource, sending and receiving headers on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono smokeTest(int id, String foo, RequestConditions requestConditions) { - // Generated convenience method for smokeTestWithResponse - RequestOptions requestOptions = new RequestOptions(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return smokeTestWithResponse(id, foo, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(User.class)); - } - - /** - * Get a resource, sending and receiving headers. - * - * @param id The user's id. - * @param foo header in request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a resource, sending and receiving headers on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono smokeTest(int id, String foo) { - // Generated convenience method for smokeTestWithResponse - RequestOptions requestOptions = new RequestOptions(); - return smokeTestWithResponse(id, foo, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(User.class)); - } - - /** - * Test for repeatable requests. - * - * @param id The user's id. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return user action response on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono repeatableAction(int id, UserActionParam body) { - // Generated convenience method for repeatableActionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return repeatableActionWithResponse(id, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UserActionResponse.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClient.java deleted file mode 100644 index 13ca40d7ea1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClient.java +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.traits; - -import azure.core.traits.implementation.TraitsClientImpl; -import azure.core.traits.models.User; -import azure.core.traits.models.UserActionParam; -import azure.core.traits.models.UserActionResponse; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.RequestConditions; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; - -/** - * Initializes a new instance of the synchronous TraitsClient type. - */ -@ServiceClient(builder = TraitsClientBuilder.class) -public final class TraitsClient { - @Generated - private final TraitsClientImpl serviceClient; - - /** - * Initializes an instance of TraitsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - TraitsClient(TraitsClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get a resource, sending and receiving headers. - *

Header Parameters

- * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the - * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity - * was modified after this time.
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param foo header in request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a resource, sending and receiving headers along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response smokeTestWithResponse(int id, String foo, RequestOptions requestOptions) { - return this.serviceClient.smokeTestWithResponse(id, foo, requestOptions); - } - - /** - * Test for repeatable requests. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     userActionValue: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     userActionResult: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return user action response along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response repeatableActionWithResponse(int id, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.repeatableActionWithResponse(id, body, requestOptions); - } - - /** - * Get a resource, sending and receiving headers. - * - * @param id The user's id. - * @param foo header in request. - * @param requestConditions Specifies HTTP options for conditional requests based on modification time. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a resource, sending and receiving headers. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public User smokeTest(int id, String foo, RequestConditions requestConditions) { - // Generated convenience method for smokeTestWithResponse - RequestOptions requestOptions = new RequestOptions(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return smokeTestWithResponse(id, foo, requestOptions).getValue().toObject(User.class); - } - - /** - * Get a resource, sending and receiving headers. - * - * @param id The user's id. - * @param foo header in request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a resource, sending and receiving headers. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public User smokeTest(int id, String foo) { - // Generated convenience method for smokeTestWithResponse - RequestOptions requestOptions = new RequestOptions(); - return smokeTestWithResponse(id, foo, requestOptions).getValue().toObject(User.class); - } - - /** - * Test for repeatable requests. - * - * @param id The user's id. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return user action response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UserActionResponse repeatableAction(int id, UserActionParam body) { - // Generated convenience method for repeatableActionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return repeatableActionWithResponse(id, BinaryData.fromObject(body), requestOptions).getValue() - .toObject(UserActionResponse.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClientBuilder.java deleted file mode 100644 index 42d02b04e7e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.traits; - -import azure.core.traits.implementation.TraitsClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the TraitsClient type. - */ -@ServiceClientBuilder(serviceClients = { TraitsClient.class, TraitsAsyncClient.class }) -public final class TraitsClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-traits.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the TraitsClientBuilder. - */ - @Generated - public TraitsClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TraitsClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TraitsClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TraitsClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TraitsClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TraitsClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TraitsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TraitsClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TraitsClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private TraitsServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the TraitsClientBuilder. - */ - @Generated - public TraitsClientBuilder serviceVersion(TraitsServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the TraitsClientBuilder. - */ - @Generated - public TraitsClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of TraitsClientImpl with the provided parameters. - * - * @return an instance of TraitsClientImpl. - */ - @Generated - private TraitsClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - TraitsServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : TraitsServiceVersion.getLatest(); - TraitsClientImpl client = new TraitsClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - localEndpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of TraitsAsyncClient class. - * - * @return an instance of TraitsAsyncClient. - */ - @Generated - public TraitsAsyncClient buildAsyncClient() { - return new TraitsAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of TraitsClient class. - * - * @return an instance of TraitsClient. - */ - @Generated - public TraitsClient buildClient() { - return new TraitsClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(TraitsClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsServiceVersion.java deleted file mode 100644 index 84e5f05f2b8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.traits; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of TraitsClient. - */ -public enum TraitsServiceVersion implements ServiceVersion { - /** - * Enum value 2022-12-01-preview. - */ - V2022_12_01_PREVIEW("2022-12-01-preview"); - - private final String version; - - TraitsServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link TraitsServiceVersion}. - */ - public static TraitsServiceVersion getLatest() { - return V2022_12_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/TraitsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/TraitsClientImpl.java deleted file mode 100644 index 9c63246859b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/TraitsClientImpl.java +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.traits.implementation; - -import azure.core.traits.TraitsServiceVersion; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the TraitsClient type. - */ -public final class TraitsClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final TraitsClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final TraitsServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public TraitsServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of TraitsClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public TraitsClientImpl(String endpoint, TraitsServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of TraitsClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public TraitsClientImpl(HttpPipeline httpPipeline, String endpoint, TraitsServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of TraitsClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public TraitsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - TraitsServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(TraitsClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for TraitsClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "TraitsClient") - public interface TraitsClientService { - @Get("/azure/core/traits/user/{id}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> smokeTest(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, @HeaderParam("foo") String foo, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/azure/core/traits/user/{id}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response smokeTestSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, @HeaderParam("foo") String foo, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/azure/core/traits/user/{id}:repeatableAction") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> repeatableAction(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/azure/core/traits/user/{id}:repeatableAction") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response repeatableActionSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") int id, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get a resource, sending and receiving headers. - *

Header Parameters

- * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the - * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity - * was modified after this time.
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param foo header in request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a resource, sending and receiving headers along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> smokeTestWithResponseAsync(int id, String foo, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.smokeTest(this.getEndpoint(), - this.getServiceVersion().getVersion(), id, foo, accept, requestOptions, context)); - } - - /** - * Get a resource, sending and receiving headers. - *

Header Parameters

- * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the - * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity - * was modified after this time.
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param foo header in request. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a resource, sending and receiving headers along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response smokeTestWithResponse(int id, String foo, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.smokeTestSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, foo, accept, - requestOptions, Context.NONE); - } - - /** - * Test for repeatable requests. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     userActionValue: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     userActionResult: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return user action response along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> repeatableActionWithResponseAsync(int id, BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); - } - }); - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-first-sent"), - DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); - } - }); - return FluxUtil.withContext(context -> service.repeatableAction(this.getEndpoint(), - this.getServiceVersion().getVersion(), id, contentType, accept, body, requestOptionsLocal, context)); - } - - /** - * Test for repeatable requests. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     userActionValue: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     userActionResult: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The user's id. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return user action response along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response repeatableActionWithResponse(int id, BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); - } - }); - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-first-sent"), - DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); - } - }); - return service.repeatableActionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, contentType, - accept, body, requestOptionsLocal, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/package-info.java deleted file mode 100644 index 532fee74378..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Traits. - * Illustrates Azure Core operation customizations by traits. - * - */ -package azure.core.traits.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/User.java deleted file mode 100644 index 15ef9101b89..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/User.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.traits.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Sample Model. - */ -@Immutable -public final class User implements JsonSerializable { - /* - * The user's id. - */ - @Generated - private int id; - - /* - * The user's name. - */ - @Generated - private String name; - - /** - * Creates an instance of User class. - */ - @Generated - private User() { - } - - /** - * Get the id property: The user's id. - * - * @return the id value. - */ - @Generated - public int getId() { - return this.id; - } - - /** - * Get the name property: The user's name. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of User from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the User. - */ - @Generated - public static User fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - User deserializedUser = new User(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedUser.id = reader.getInt(); - } else if ("name".equals(fieldName)) { - deserializedUser.name = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedUser; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionParam.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionParam.java deleted file mode 100644 index ff13bc84f1f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionParam.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.traits.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * User action param. - */ -@Immutable -public final class UserActionParam implements JsonSerializable { - /* - * User action value. - */ - @Generated - private final String userActionValue; - - /** - * Creates an instance of UserActionParam class. - * - * @param userActionValue the userActionValue value to set. - */ - @Generated - public UserActionParam(String userActionValue) { - this.userActionValue = userActionValue; - } - - /** - * Get the userActionValue property: User action value. - * - * @return the userActionValue value. - */ - @Generated - public String getUserActionValue() { - return this.userActionValue; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("userActionValue", this.userActionValue); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UserActionParam from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UserActionParam if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UserActionParam. - */ - @Generated - public static UserActionParam fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String userActionValue = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("userActionValue".equals(fieldName)) { - userActionValue = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new UserActionParam(userActionValue); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionResponse.java deleted file mode 100644 index 27d8b754962..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionResponse.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.traits.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * User action response. - */ -@Immutable -public final class UserActionResponse implements JsonSerializable { - /* - * User action result. - */ - @Generated - private final String userActionResult; - - /** - * Creates an instance of UserActionResponse class. - * - * @param userActionResult the userActionResult value to set. - */ - @Generated - private UserActionResponse(String userActionResult) { - this.userActionResult = userActionResult; - } - - /** - * Get the userActionResult property: User action result. - * - * @return the userActionResult value. - */ - @Generated - public String getUserActionResult() { - return this.userActionResult; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("userActionResult", this.userActionResult); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UserActionResponse from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UserActionResponse if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UserActionResponse. - */ - @Generated - public static UserActionResponse fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String userActionResult = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("userActionResult".equals(fieldName)) { - userActionResult = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new UserActionResponse(userActionResult); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/package-info.java deleted file mode 100644 index 0367d6c3e2f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Traits. - * Illustrates Azure Core operation customizations by traits. - * - */ -package azure.core.traits.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/package-info.java deleted file mode 100644 index 9ce44d2806b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Traits. - * Illustrates Azure Core operation customizations by traits. - * - */ -package azure.core.traits; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationAsyncClient.java deleted file mode 100644 index f6e7e61ed12..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationAsyncClient.java +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.encode.duration; - -import azure.encode.duration.implementation.DurationClientImpl; -import azure.encode.duration.models.DurationModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous DurationClient type. - */ -@ServiceClient(builder = DurationClientBuilder.class, isAsync = true) -public final class DurationAsyncClient { - @Generated - private final DurationClientImpl serviceClient; - - /** - * Initializes an instance of DurationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DurationAsyncClient(DurationClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test duration with azure specific encoding. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     input: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> durationConstantWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.durationConstantWithResponseAsync(body, requestOptions); - } - - /** - * Test duration with azure specific encoding. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono durationConstant(DurationModel body) { - // Generated convenience method for durationConstantWithResponse - RequestOptions requestOptions = new RequestOptions(); - return durationConstantWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClient.java deleted file mode 100644 index 5fc7765423d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClient.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.encode.duration; - -import azure.encode.duration.implementation.DurationClientImpl; -import azure.encode.duration.models.DurationModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous DurationClient type. - */ -@ServiceClient(builder = DurationClientBuilder.class) -public final class DurationClient { - @Generated - private final DurationClientImpl serviceClient; - - /** - * Initializes an instance of DurationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DurationClient(DurationClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test duration with azure specific encoding. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     input: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response durationConstantWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.durationConstantWithResponse(body, requestOptions); - } - - /** - * Test duration with azure specific encoding. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void durationConstant(DurationModel body) { - // Generated convenience method for durationConstantWithResponse - RequestOptions requestOptions = new RequestOptions(); - durationConstantWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClientBuilder.java deleted file mode 100644 index ca88f7b842d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.encode.duration; - -import azure.encode.duration.implementation.DurationClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the DurationClient type. - */ -@ServiceClientBuilder(serviceClients = { DurationClient.class, DurationAsyncClient.class }) -public final class DurationClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("azure-encode-duration.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the DurationClientBuilder. - */ - @Generated - public DurationClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the DurationClientBuilder. - */ - @Generated - public DurationClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of DurationClientImpl with the provided parameters. - * - * @return an instance of DurationClientImpl. - */ - @Generated - private DurationClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - DurationClientImpl client - = new DurationClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of DurationAsyncClient class. - * - * @return an instance of DurationAsyncClient. - */ - @Generated - public DurationAsyncClient buildAsyncClient() { - return new DurationAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of DurationClient class. - * - * @return an instance of DurationClient. - */ - @Generated - public DurationClient buildClient() { - return new DurationClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(DurationClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/DurationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/DurationClientImpl.java deleted file mode 100644 index 2f8546dcdd5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/DurationClientImpl.java +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.encode.duration.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the DurationClient type. - */ -public final class DurationClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DurationClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of DurationClient client. - * - * @param endpoint Service host. - */ - public DurationClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DurationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public DurationClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DurationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public DurationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(DurationClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for DurationClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DurationClient") - public interface DurationClientService { - @Put("/azure/encode/duration/duration-constant") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> durationConstant(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/azure/encode/duration/duration-constant") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response durationConstantSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Test duration with azure specific encoding. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     input: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> durationConstantWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.durationConstant(this.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Test duration with azure specific encoding. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     input: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response durationConstantWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.durationConstantSync(this.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/package-info.java deleted file mode 100644 index 9ecc22677f7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for DurationModel. - * Test for azure related encode decorator. - * - */ -package azure.encode.duration.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/DurationModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/DurationModel.java deleted file mode 100644 index 66e4b6ca5fd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/DurationModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.encode.duration.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The DurationModel model. - */ -@Immutable -public final class DurationModel implements JsonSerializable { - /* - * The input property. - */ - @Generated - private final String input; - - /** - * Creates an instance of DurationModel class. - * - * @param input the input value to set. - */ - @Generated - public DurationModel(String input) { - this.input = input; - } - - /** - * Get the input property: The input property. - * - * @return the input value. - */ - @Generated - public String getInput() { - return this.input; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("input", this.input); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DurationModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DurationModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DurationModel. - */ - @Generated - public static DurationModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String input = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("input".equals(fieldName)) { - input = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new DurationModel(input); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/package-info.java deleted file mode 100644 index 009e218d99b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for DurationModel. - * Test for azure related encode decorator. - * - */ -package azure.encode.duration.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/package-info.java deleted file mode 100644 index a963ea59122..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for DurationModel. - * Test for azure related encode decorator. - * - */ -package azure.encode.duration; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleAsyncClient.java deleted file mode 100644 index 419b8f9be21..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleAsyncClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.example.basic; - -import azure.example.basic.implementation.AzureExampleClientImpl; -import azure.example.basic.models.ActionRequest; -import azure.example.basic.models.ActionResponse; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous AzureExampleClient type. - */ -@ServiceClient(builder = AzureExampleClientBuilder.class, isAsync = true) -public final class AzureExampleAsyncClient { - @Generated - private final AzureExampleClientImpl serviceClient; - - /** - * Initializes an instance of AzureExampleAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - AzureExampleAsyncClient(AzureExampleClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The basicAction operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     stringProperty: String (Required)
-     *     modelProperty (Optional): {
-     *         int32Property: Integer (Optional)
-     *         float32Property: Double (Optional)
-     *         enumProperty: String(EnumValue1) (Optional)
-     *     }
-     *     arrayProperty (Optional): [
-     *         String (Optional)
-     *     ]
-     *     recordProperty (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     stringProperty: String (Required)
-     *     modelProperty (Optional): {
-     *         int32Property: Integer (Optional)
-     *         float32Property: Double (Optional)
-     *         enumProperty: String(EnumValue1) (Optional)
-     *     }
-     *     arrayProperty (Optional): [
-     *         String (Optional)
-     *     ]
-     *     recordProperty (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param queryParam The queryParam parameter. - * @param headerParam The headerParam parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> basicActionWithResponse(String queryParam, String headerParam, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.basicActionWithResponseAsync(queryParam, headerParam, body, requestOptions); - } - - /** - * The basicAction operation. - * - * @param queryParam The queryParam parameter. - * @param headerParam The headerParam parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono basicAction(String queryParam, String headerParam, ActionRequest body) { - // Generated convenience method for basicActionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return basicActionWithResponse(queryParam, headerParam, BinaryData.fromObject(body), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ActionResponse.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClient.java deleted file mode 100644 index 639253f07d7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClient.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.example.basic; - -import azure.example.basic.implementation.AzureExampleClientImpl; -import azure.example.basic.models.ActionRequest; -import azure.example.basic.models.ActionResponse; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous AzureExampleClient type. - */ -@ServiceClient(builder = AzureExampleClientBuilder.class) -public final class AzureExampleClient { - @Generated - private final AzureExampleClientImpl serviceClient; - - /** - * Initializes an instance of AzureExampleClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - AzureExampleClient(AzureExampleClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The basicAction operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     stringProperty: String (Required)
-     *     modelProperty (Optional): {
-     *         int32Property: Integer (Optional)
-     *         float32Property: Double (Optional)
-     *         enumProperty: String(EnumValue1) (Optional)
-     *     }
-     *     arrayProperty (Optional): [
-     *         String (Optional)
-     *     ]
-     *     recordProperty (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     stringProperty: String (Required)
-     *     modelProperty (Optional): {
-     *         int32Property: Integer (Optional)
-     *         float32Property: Double (Optional)
-     *         enumProperty: String(EnumValue1) (Optional)
-     *     }
-     *     arrayProperty (Optional): [
-     *         String (Optional)
-     *     ]
-     *     recordProperty (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param queryParam The queryParam parameter. - * @param headerParam The headerParam parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response basicActionWithResponse(String queryParam, String headerParam, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.basicActionWithResponse(queryParam, headerParam, body, requestOptions); - } - - /** - * The basicAction operation. - * - * @param queryParam The queryParam parameter. - * @param headerParam The headerParam parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ActionResponse basicAction(String queryParam, String headerParam, ActionRequest body) { - // Generated convenience method for basicActionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return basicActionWithResponse(queryParam, headerParam, BinaryData.fromObject(body), requestOptions).getValue() - .toObject(ActionResponse.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClientBuilder.java deleted file mode 100644 index c1550d34d32..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.example.basic; - -import azure.example.basic.implementation.AzureExampleClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the AzureExampleClient type. - */ -@ServiceClientBuilder(serviceClients = { AzureExampleClient.class, AzureExampleAsyncClient.class }) -public final class AzureExampleClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("azure-example-basic.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the AzureExampleClientBuilder. - */ - @Generated - public AzureExampleClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AzureExampleClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AzureExampleClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AzureExampleClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AzureExampleClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AzureExampleClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AzureExampleClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AzureExampleClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AzureExampleClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private BasicServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the AzureExampleClientBuilder. - */ - @Generated - public AzureExampleClientBuilder serviceVersion(BasicServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the AzureExampleClientBuilder. - */ - @Generated - public AzureExampleClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of AzureExampleClientImpl with the provided parameters. - * - * @return an instance of AzureExampleClientImpl. - */ - @Generated - private AzureExampleClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - BasicServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : BasicServiceVersion.getLatest(); - AzureExampleClientImpl client = new AzureExampleClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of AzureExampleAsyncClient class. - * - * @return an instance of AzureExampleAsyncClient. - */ - @Generated - public AzureExampleAsyncClient buildAsyncClient() { - return new AzureExampleAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of AzureExampleClient class. - * - * @return an instance of AzureExampleClient. - */ - @Generated - public AzureExampleClient buildClient() { - return new AzureExampleClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(AzureExampleClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/BasicServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/BasicServiceVersion.java deleted file mode 100644 index 8bc4e6ce297..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/BasicServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.example.basic; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of BasicClient. - */ -public enum BasicServiceVersion implements ServiceVersion { - /** - * Enum value 2022-12-01-preview. - */ - V2022_12_01_PREVIEW("2022-12-01-preview"); - - private final String version; - - BasicServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link BasicServiceVersion}. - */ - public static BasicServiceVersion getLatest() { - return V2022_12_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/AzureExampleClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/AzureExampleClientImpl.java deleted file mode 100644 index 3bdad0cdf26..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/AzureExampleClientImpl.java +++ /dev/null @@ -1,300 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.example.basic.implementation; - -import azure.example.basic.BasicServiceVersion; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the AzureExampleClient type. - */ -public final class AzureExampleClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final AzureExampleClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final BasicServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public BasicServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of AzureExampleClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public AzureExampleClientImpl(String endpoint, BasicServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of AzureExampleClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public AzureExampleClientImpl(HttpPipeline httpPipeline, String endpoint, BasicServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of AzureExampleClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public AzureExampleClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - BasicServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service - = RestProxy.create(AzureExampleClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for AzureExampleClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AzureExampleClient") - public interface AzureExampleClientService { - @Post("/azure/example/basic/basic") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> basicAction(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @QueryParam("query-param") String queryParam, - @HeaderParam("header-param") String headerParam, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/azure/example/basic/basic") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response basicActionSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @QueryParam("query-param") String queryParam, - @HeaderParam("header-param") String headerParam, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The basicAction operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     stringProperty: String (Required)
-     *     modelProperty (Optional): {
-     *         int32Property: Integer (Optional)
-     *         float32Property: Double (Optional)
-     *         enumProperty: String(EnumValue1) (Optional)
-     *     }
-     *     arrayProperty (Optional): [
-     *         String (Optional)
-     *     ]
-     *     recordProperty (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     stringProperty: String (Required)
-     *     modelProperty (Optional): {
-     *         int32Property: Integer (Optional)
-     *         float32Property: Double (Optional)
-     *         enumProperty: String(EnumValue1) (Optional)
-     *     }
-     *     arrayProperty (Optional): [
-     *         String (Optional)
-     *     ]
-     *     recordProperty (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param queryParam The queryParam parameter. - * @param headerParam The headerParam parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> basicActionWithResponseAsync(String queryParam, String headerParam, - BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.basicAction(this.getEndpoint(), this.getServiceVersion().getVersion(), - queryParam, headerParam, contentType, accept, body, requestOptions, context)); - } - - /** - * The basicAction operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     stringProperty: String (Required)
-     *     modelProperty (Optional): {
-     *         int32Property: Integer (Optional)
-     *         float32Property: Double (Optional)
-     *         enumProperty: String(EnumValue1) (Optional)
-     *     }
-     *     arrayProperty (Optional): [
-     *         String (Optional)
-     *     ]
-     *     recordProperty (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     stringProperty: String (Required)
-     *     modelProperty (Optional): {
-     *         int32Property: Integer (Optional)
-     *         float32Property: Double (Optional)
-     *         enumProperty: String(EnumValue1) (Optional)
-     *     }
-     *     arrayProperty (Optional): [
-     *         String (Optional)
-     *     ]
-     *     recordProperty (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param queryParam The queryParam parameter. - * @param headerParam The headerParam parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response basicActionWithResponse(String queryParam, String headerParam, BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.basicActionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), queryParam, - headerParam, contentType, accept, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/package-info.java deleted file mode 100644 index 57ac429e1ff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Basic. - * Test for loading JSON example and generating sample code. - * - */ -package azure.example.basic.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionRequest.java deleted file mode 100644 index c39a54ecc96..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionRequest.java +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.example.basic.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * The ActionRequest model. - */ -@Fluent -public final class ActionRequest implements JsonSerializable { - /* - * The stringProperty property. - */ - @Generated - private final String stringProperty; - - /* - * The modelProperty property. - */ - @Generated - private Model modelProperty; - - /* - * The arrayProperty property. - */ - @Generated - private List arrayProperty; - - /* - * The recordProperty property. - */ - @Generated - private Map recordProperty; - - /** - * Creates an instance of ActionRequest class. - * - * @param stringProperty the stringProperty value to set. - */ - @Generated - public ActionRequest(String stringProperty) { - this.stringProperty = stringProperty; - } - - /** - * Get the stringProperty property: The stringProperty property. - * - * @return the stringProperty value. - */ - @Generated - public String getStringProperty() { - return this.stringProperty; - } - - /** - * Get the modelProperty property: The modelProperty property. - * - * @return the modelProperty value. - */ - @Generated - public Model getModelProperty() { - return this.modelProperty; - } - - /** - * Set the modelProperty property: The modelProperty property. - * - * @param modelProperty the modelProperty value to set. - * @return the ActionRequest object itself. - */ - @Generated - public ActionRequest setModelProperty(Model modelProperty) { - this.modelProperty = modelProperty; - return this; - } - - /** - * Get the arrayProperty property: The arrayProperty property. - * - * @return the arrayProperty value. - */ - @Generated - public List getArrayProperty() { - return this.arrayProperty; - } - - /** - * Set the arrayProperty property: The arrayProperty property. - * - * @param arrayProperty the arrayProperty value to set. - * @return the ActionRequest object itself. - */ - @Generated - public ActionRequest setArrayProperty(List arrayProperty) { - this.arrayProperty = arrayProperty; - return this; - } - - /** - * Get the recordProperty property: The recordProperty property. - * - * @return the recordProperty value. - */ - @Generated - public Map getRecordProperty() { - return this.recordProperty; - } - - /** - * Set the recordProperty property: The recordProperty property. - * - * @param recordProperty the recordProperty value to set. - * @return the ActionRequest object itself. - */ - @Generated - public ActionRequest setRecordProperty(Map recordProperty) { - this.recordProperty = recordProperty; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("stringProperty", this.stringProperty); - jsonWriter.writeJsonField("modelProperty", this.modelProperty); - jsonWriter.writeArrayField("arrayProperty", this.arrayProperty, - (writer, element) -> writer.writeString(element)); - jsonWriter.writeMapField("recordProperty", this.recordProperty, - (writer, element) -> writer.writeString(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ActionRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ActionRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ActionRequest. - */ - @Generated - public static ActionRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String stringProperty = null; - Model modelProperty = null; - List arrayProperty = null; - Map recordProperty = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("stringProperty".equals(fieldName)) { - stringProperty = reader.getString(); - } else if ("modelProperty".equals(fieldName)) { - modelProperty = Model.fromJson(reader); - } else if ("arrayProperty".equals(fieldName)) { - arrayProperty = reader.readArray(reader1 -> reader1.getString()); - } else if ("recordProperty".equals(fieldName)) { - recordProperty = reader.readMap(reader1 -> reader1.getString()); - } else { - reader.skipChildren(); - } - } - ActionRequest deserializedActionRequest = new ActionRequest(stringProperty); - deserializedActionRequest.modelProperty = modelProperty; - deserializedActionRequest.arrayProperty = arrayProperty; - deserializedActionRequest.recordProperty = recordProperty; - - return deserializedActionRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionResponse.java deleted file mode 100644 index 7975deabf2a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionResponse.java +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.example.basic.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * The ActionResponse model. - */ -@Immutable -public final class ActionResponse implements JsonSerializable { - /* - * The stringProperty property. - */ - @Generated - private final String stringProperty; - - /* - * The modelProperty property. - */ - @Generated - private Model modelProperty; - - /* - * The arrayProperty property. - */ - @Generated - private List arrayProperty; - - /* - * The recordProperty property. - */ - @Generated - private Map recordProperty; - - /** - * Creates an instance of ActionResponse class. - * - * @param stringProperty the stringProperty value to set. - */ - @Generated - private ActionResponse(String stringProperty) { - this.stringProperty = stringProperty; - } - - /** - * Get the stringProperty property: The stringProperty property. - * - * @return the stringProperty value. - */ - @Generated - public String getStringProperty() { - return this.stringProperty; - } - - /** - * Get the modelProperty property: The modelProperty property. - * - * @return the modelProperty value. - */ - @Generated - public Model getModelProperty() { - return this.modelProperty; - } - - /** - * Get the arrayProperty property: The arrayProperty property. - * - * @return the arrayProperty value. - */ - @Generated - public List getArrayProperty() { - return this.arrayProperty; - } - - /** - * Get the recordProperty property: The recordProperty property. - * - * @return the recordProperty value. - */ - @Generated - public Map getRecordProperty() { - return this.recordProperty; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("stringProperty", this.stringProperty); - jsonWriter.writeJsonField("modelProperty", this.modelProperty); - jsonWriter.writeArrayField("arrayProperty", this.arrayProperty, - (writer, element) -> writer.writeString(element)); - jsonWriter.writeMapField("recordProperty", this.recordProperty, - (writer, element) -> writer.writeString(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ActionResponse from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ActionResponse if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ActionResponse. - */ - @Generated - public static ActionResponse fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String stringProperty = null; - Model modelProperty = null; - List arrayProperty = null; - Map recordProperty = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("stringProperty".equals(fieldName)) { - stringProperty = reader.getString(); - } else if ("modelProperty".equals(fieldName)) { - modelProperty = Model.fromJson(reader); - } else if ("arrayProperty".equals(fieldName)) { - arrayProperty = reader.readArray(reader1 -> reader1.getString()); - } else if ("recordProperty".equals(fieldName)) { - recordProperty = reader.readMap(reader1 -> reader1.getString()); - } else { - reader.skipChildren(); - } - } - ActionResponse deserializedActionResponse = new ActionResponse(stringProperty); - deserializedActionResponse.modelProperty = modelProperty; - deserializedActionResponse.arrayProperty = arrayProperty; - deserializedActionResponse.recordProperty = recordProperty; - - return deserializedActionResponse; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Enum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Enum.java deleted file mode 100644 index 23213094907..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Enum.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.example.basic.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for Enum. - */ -public final class Enum extends ExpandableStringEnum { - /** - * Static value EnumValue1 for Enum. - */ - @Generated - public static final Enum ENUM_VALUE1 = fromString("EnumValue1"); - - /** - * Creates a new instance of Enum value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public Enum() { - } - - /** - * Creates or finds a Enum from its string representation. - * - * @param name a name to look for. - * @return the corresponding Enum. - */ - @Generated - public static Enum fromString(String name) { - return fromString(name, Enum.class); - } - - /** - * Gets known Enum values. - * - * @return known Enum values. - */ - @Generated - public static Collection values() { - return values(Enum.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Model.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Model.java deleted file mode 100644 index b311b16a5fb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Model.java +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.example.basic.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Model model. - */ -@Fluent -public final class Model implements JsonSerializable { - /* - * The int32Property property. - */ - @Generated - private Integer int32Property; - - /* - * The float32Property property. - */ - @Generated - private Double float32Property; - - /* - * The enumProperty property. - */ - @Generated - private Enum enumProperty; - - /** - * Creates an instance of Model class. - */ - @Generated - public Model() { - } - - /** - * Get the int32Property property: The int32Property property. - * - * @return the int32Property value. - */ - @Generated - public Integer getInt32Property() { - return this.int32Property; - } - - /** - * Set the int32Property property: The int32Property property. - * - * @param int32Property the int32Property value to set. - * @return the Model object itself. - */ - @Generated - public Model setInt32Property(Integer int32Property) { - this.int32Property = int32Property; - return this; - } - - /** - * Get the float32Property property: The float32Property property. - * - * @return the float32Property value. - */ - @Generated - public Double getFloat32Property() { - return this.float32Property; - } - - /** - * Set the float32Property property: The float32Property property. - * - * @param float32Property the float32Property value to set. - * @return the Model object itself. - */ - @Generated - public Model setFloat32Property(Double float32Property) { - this.float32Property = float32Property; - return this; - } - - /** - * Get the enumProperty property: The enumProperty property. - * - * @return the enumProperty value. - */ - @Generated - public Enum getEnumProperty() { - return this.enumProperty; - } - - /** - * Set the enumProperty property: The enumProperty property. - * - * @param enumProperty the enumProperty value to set. - * @return the Model object itself. - */ - @Generated - public Model setEnumProperty(Enum enumProperty) { - this.enumProperty = enumProperty; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("int32Property", this.int32Property); - jsonWriter.writeNumberField("float32Property", this.float32Property); - jsonWriter.writeStringField("enumProperty", this.enumProperty == null ? null : this.enumProperty.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Model from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Model if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IOException If an error occurs while reading the Model. - */ - @Generated - public static Model fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Model deserializedModel = new Model(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("int32Property".equals(fieldName)) { - deserializedModel.int32Property = reader.getNullable(JsonReader::getInt); - } else if ("float32Property".equals(fieldName)) { - deserializedModel.float32Property = reader.getNullable(JsonReader::getDouble); - } else if ("enumProperty".equals(fieldName)) { - deserializedModel.enumProperty = Enum.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/package-info.java deleted file mode 100644 index 004e67e35b6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Basic. - * Test for loading JSON example and generating sample code. - * - */ -package azure.example.basic.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/package-info.java deleted file mode 100644 index 215f743313d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Basic. - * Test for loading JSON example and generating sample code. - * - */ -package azure.example.basic; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableAsyncClient.java deleted file mode 100644 index 83a35a33193..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableAsyncClient.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.payload.pageable; - -import azure.payload.pageable.implementation.PageableClientImpl; -import azure.payload.pageable.models.User; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import java.util.stream.Collectors; -import reactor.core.publisher.Flux; - -/** - * Initializes a new instance of the asynchronous PageableClient type. - */ -@ServiceClient(builder = PageableClientBuilder.class, isAsync = true) -public final class PageableAsyncClient { - @Generated - private final PageableClientImpl serviceClient; - - /** - * Initializes an instance of PageableAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PageableAsyncClient(PageableClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * List users. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maximum number of result items per page.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux list(RequestOptions requestOptions) { - return this.serviceClient.listAsync(requestOptions); - } - - /** - * List users. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux list() { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = list(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(User.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClient.java deleted file mode 100644 index 68c3882885e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClient.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.payload.pageable; - -import azure.payload.pageable.implementation.PageableClientImpl; -import azure.payload.pageable.models.User; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous PageableClient type. - */ -@ServiceClient(builder = PageableClientBuilder.class) -public final class PageableClient { - @Generated - private final PageableClientImpl serviceClient; - - /** - * Initializes an instance of PageableClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PageableClient(PageableClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * List users. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maximum number of result items per page.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(RequestOptions requestOptions) { - return this.serviceClient.list(requestOptions); - } - - /** - * List users. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClientBuilder.java deleted file mode 100644 index 0b11ef09c92..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.payload.pageable; - -import azure.payload.pageable.implementation.PageableClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the PageableClient type. - */ -@ServiceClientBuilder(serviceClients = { PageableClient.class, PageableAsyncClient.class }) -public final class PageableClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("azure-payload-pageable.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the PageableClientBuilder. - */ - @Generated - public PageableClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageableClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageableClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageableClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageableClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageableClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageableClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageableClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PageableClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the PageableClientBuilder. - */ - @Generated - public PageableClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of PageableClientImpl with the provided parameters. - * - * @return an instance of PageableClientImpl. - */ - @Generated - private PageableClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - PageableClientImpl client - = new PageableClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of PageableAsyncClient class. - * - * @return an instance of PageableAsyncClient. - */ - @Generated - public PageableAsyncClient buildAsyncClient() { - return new PageableAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of PageableClient class. - * - * @return an instance of PageableClient. - */ - @Generated - public PageableClient buildClient() { - return new PageableClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(PageableClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/PageableClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/PageableClientImpl.java deleted file mode 100644 index 70002c4a3ee..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/PageableClientImpl.java +++ /dev/null @@ -1,427 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.payload.pageable.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -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.RequestOptions; -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 com.azure.core.util.UrlBuilder; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the PageableClient type. - */ -public final class PageableClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PageableClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of PageableClient client. - * - * @param endpoint Service host. - */ - public PageableClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of PageableClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public PageableClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of PageableClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public PageableClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(PageableClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for PageableClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "PageableClient") - public interface PageableClientService { - @Get("/azure/payload/pageable") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> list(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/payload/pageable") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * List users. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maximum number of result items per page.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.list(this.getEndpoint(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * List users. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maximum number of result items per page.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>((pageSize) -> { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listSinglePageAsync(requestOptionsLocal); - }, (nextLink, pageSize) -> { - RequestOptions requestOptionsLocal = new RequestOptions(); - requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listNextSinglePageAsync(nextLink, requestOptionsLocal); - }); - } - - /** - * List users. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maximum number of result items per page.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * List users. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maximum number of result items per page.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>((pageSize) -> { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listSinglePage(requestOptionsLocal); - }, (nextLink, pageSize) -> { - RequestOptions requestOptionsLocal = new RequestOptions(); - requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listNextSinglePage(nextLink, requestOptionsLocal); - }); - } - - /** - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listNext(nextLink, this.getEndpoint(), 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
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of User items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - private List getValues(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - List values = (List) obj.get(path); - return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); - } catch (RuntimeException e) { - return null; - } - } - - private String getNextLink(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - return (String) obj.get(path); - } catch (RuntimeException e) { - return null; - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/package-info.java deleted file mode 100644 index e03f730af76..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Pageable. - * Test describing pageable. - * - */ -package azure.payload.pageable.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/User.java deleted file mode 100644 index b21b986ab8a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/User.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.payload.pageable.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * User model. - */ -@Immutable -public final class User implements JsonSerializable { - /* - * User name - */ - @Generated - private final String name; - - /** - * Creates an instance of User class. - * - * @param name the name value to set. - */ - @Generated - private User(String name) { - this.name = name; - } - - /** - * Get the name property: User name. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of User from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the User. - */ - @Generated - public static User fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new User(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/package-info.java deleted file mode 100644 index ea5290238a3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Pageable. - * Test describing pageable. - * - */ -package azure.payload.pageable.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/package-info.java deleted file mode 100644 index da31e5e394e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Pageable. - * Test describing pageable. - * - */ -package azure.payload.pageable; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/CommonPropertiesManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/CommonPropertiesManager.java deleted file mode 100644 index cc0e7a13895..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/CommonPropertiesManager.java +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties; - -import azure.resourcemanager.commonproperties.fluent.CommonPropertiesClient; -import azure.resourcemanager.commonproperties.implementation.CommonPropertiesClientBuilder; -import azure.resourcemanager.commonproperties.implementation.ErrorsImpl; -import azure.resourcemanager.commonproperties.implementation.ManagedIdentitiesImpl; -import azure.resourcemanager.commonproperties.models.Errors; -import azure.resourcemanager.commonproperties.models.ManagedIdentities; -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * Entry point to CommonPropertiesManager. - * Arm Managed Identity Provider management API. - */ -public final class CommonPropertiesManager { - private ManagedIdentities managedIdentities; - - private Errors errors; - - private final CommonPropertiesClient clientObject; - - private CommonPropertiesManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new CommonPropertiesClientBuilder().pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of CommonProperties service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the CommonProperties service API instance. - */ - public static CommonPropertiesManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return configure().authenticate(credential, profile); - } - - /** - * Creates an instance of CommonProperties service API entry point. - * - * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. - * @param profile the Azure profile for client. - * @return the CommonProperties service API instance. - */ - public static CommonPropertiesManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return new CommonPropertiesManager(httpPipeline, profile, null); - } - - /** - * Gets a Configurable instance that can be used to create CommonPropertiesManager with optional configuration. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new CommonPropertiesManager.Configurable(); - } - - /** - * The Configurable allowing configurations to be set. - */ - public static final class Configurable { - private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); - private static final String SDK_VERSION = "version"; - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-resourcemanager-commonproperties-generated.properties"); - - private HttpClient httpClient; - private HttpLogOptions httpLogOptions; - private final List policies = new ArrayList<>(); - private final List scopes = new ArrayList<>(); - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - private Duration defaultPollInterval; - - private Configurable() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - return this; - } - - /** - * Adds the scope to permission sets. - * - * @param scope the scope. - * @return the configurable object itself. - */ - public Configurable withScope(String scope) { - this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); - return this; - } - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - /** - * Sets the default poll interval, used when service does not provide "Retry-After" header. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval - = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of CommonProperties service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the CommonProperties service API instance. - */ - public CommonPropertiesManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder.append("azsdk-java") - .append("-") - .append("azure.resourcemanager.commonproperties") - .append("/") - .append(clientVersion); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder.append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(userAgentBuilder.toString())); - policies.add(new AddHeadersFromContextPolicy()); - policies.add(new RequestIdPolicy()); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy); - policies.add(new AddDatePolicy()); - policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new CommonPropertiesManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * Gets the resource collection API of ManagedIdentities. It manages ManagedIdentityTrackedResource. - * - * @return Resource collection API of ManagedIdentities. - */ - public ManagedIdentities managedIdentities() { - if (this.managedIdentities == null) { - this.managedIdentities = new ManagedIdentitiesImpl(clientObject.getManagedIdentities(), this); - } - return managedIdentities; - } - - /** - * Gets the resource collection API of Errors. It manages ConfidentialResource. - * - * @return Resource collection API of Errors. - */ - public Errors errors() { - if (this.errors == null) { - this.errors = new ErrorsImpl(clientObject.getErrors(), this); - } - return errors; - } - - /** - * Gets wrapped service client CommonPropertiesClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. - * - * @return Wrapped service client CommonPropertiesClient. - */ - public CommonPropertiesClient serviceClient() { - return this.clientObject; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/CommonPropertiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/CommonPropertiesClient.java deleted file mode 100644 index 89b218eb72d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/CommonPropertiesClient.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for CommonPropertiesClient class. - */ -public interface CommonPropertiesClient { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the ManagedIdentitiesClient object to access its operations. - * - * @return the ManagedIdentitiesClient object. - */ - ManagedIdentitiesClient getManagedIdentities(); - - /** - * Gets the ErrorsClient object to access its operations. - * - * @return the ErrorsClient object. - */ - ErrorsClient getErrors(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ErrorsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ErrorsClient.java deleted file mode 100644 index ac0836451ab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ErrorsClient.java +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.fluent; - -import azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * An instance of this class provides access to all the operations defined in ErrorsClient. - */ -public interface ErrorsClient { - /** - * Get a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ConfidentialResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, - String confidentialResourceName, Context context); - - /** - * Get a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ConfidentialResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ConfidentialResourceInner getByResourceGroup(String resourceGroupName, String confidentialResourceName); - - /** - * Create a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws azure.resourcemanager.commonproperties.models.ApiErrorException thrown if the request is rejected by - * server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response createForUserDefinedErrorWithResponse(String resourceGroupName, - String confidentialResourceName, ConfidentialResourceInner resource, Context context); - - /** - * Create a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws azure.resourcemanager.commonproperties.models.ApiErrorException thrown if the request is rejected by - * server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ConfidentialResourceInner createForUserDefinedError(String resourceGroupName, String confidentialResourceName, - ConfidentialResourceInner resource); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ManagedIdentitiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ManagedIdentitiesClient.java deleted file mode 100644 index f8e4af583d1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ManagedIdentitiesClient.java +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.fluent; - -import azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * An instance of this class provides access to all the operations defined in ManagedIdentitiesClient. - */ -public interface ManagedIdentitiesClient { - /** - * Get a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedIdentityTrackedResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, - String managedIdentityTrackedResourceName, Context context); - - /** - * Get a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedIdentityTrackedResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ManagedIdentityTrackedResourceInner getByResourceGroup(String resourceGroupName, - String managedIdentityTrackedResourceName); - - /** - * Create a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response createWithSystemAssignedWithResponse(String resourceGroupName, - String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner resource, Context context); - - /** - * Create a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ManagedIdentityTrackedResourceInner createWithSystemAssigned(String resourceGroupName, - String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner resource); - - /** - * Update a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithUserAssignedAndSystemAssignedWithResponse( - String resourceGroupName, String managedIdentityTrackedResourceName, - ManagedIdentityTrackedResourceInner properties, Context context); - - /** - * Update a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ManagedIdentityTrackedResourceInner updateWithUserAssignedAndSystemAssigned(String resourceGroupName, - String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner properties); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ConfidentialResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ConfidentialResourceInner.java deleted file mode 100644 index 20e0d970733..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ConfidentialResourceInner.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.fluent.models; - -import azure.resourcemanager.commonproperties.models.ConfidentialResourceProperties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class ConfidentialResourceInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private ConfidentialResourceProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of ConfidentialResourceInner class. - */ - public ConfidentialResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public ConfidentialResourceProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the ConfidentialResourceInner object itself. - */ - public ConfidentialResourceInner withProperties(ConfidentialResourceProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public ConfidentialResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ConfidentialResourceInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ConfidentialResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ConfidentialResourceInner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ConfidentialResourceInner. - */ - public static ConfidentialResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ConfidentialResourceInner deserializedConfidentialResourceInner = new ConfidentialResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedConfidentialResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedConfidentialResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedConfidentialResourceInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedConfidentialResourceInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedConfidentialResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedConfidentialResourceInner.properties = ConfidentialResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedConfidentialResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedConfidentialResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ManagedIdentityTrackedResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ManagedIdentityTrackedResourceInner.java deleted file mode 100644 index f81a34bf4e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ManagedIdentityTrackedResourceInner.java +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.fluent.models; - -import azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResourceProperties; -import azure.resourcemanager.commonproperties.models.ManagedServiceIdentity; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class ManagedIdentityTrackedResourceInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private ManagedIdentityTrackedResourceProperties properties; - - /* - * The managed service identities assigned to this resource. - */ - private ManagedServiceIdentity identity; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of ManagedIdentityTrackedResourceInner class. - */ - public ManagedIdentityTrackedResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public ManagedIdentityTrackedResourceProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the ManagedIdentityTrackedResourceInner object itself. - */ - public ManagedIdentityTrackedResourceInner withProperties(ManagedIdentityTrackedResourceProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the identity property: The managed service identities assigned to this resource. - * - * @return the identity value. - */ - public ManagedServiceIdentity identity() { - return this.identity; - } - - /** - * Set the identity property: The managed service identities assigned to this resource. - * - * @param identity the identity value to set. - * @return the ManagedIdentityTrackedResourceInner object itself. - */ - public ManagedIdentityTrackedResourceInner withIdentity(ManagedServiceIdentity identity) { - this.identity = identity; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public ManagedIdentityTrackedResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ManagedIdentityTrackedResourceInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.properties); - jsonWriter.writeJsonField("identity", this.identity); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ManagedIdentityTrackedResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ManagedIdentityTrackedResourceInner if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ManagedIdentityTrackedResourceInner. - */ - public static ManagedIdentityTrackedResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ManagedIdentityTrackedResourceInner deserializedManagedIdentityTrackedResourceInner - = new ManagedIdentityTrackedResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedManagedIdentityTrackedResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedManagedIdentityTrackedResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedManagedIdentityTrackedResourceInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedManagedIdentityTrackedResourceInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedManagedIdentityTrackedResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedManagedIdentityTrackedResourceInner.properties - = ManagedIdentityTrackedResourceProperties.fromJson(reader); - } else if ("identity".equals(fieldName)) { - deserializedManagedIdentityTrackedResourceInner.identity = ManagedServiceIdentity.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedManagedIdentityTrackedResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedManagedIdentityTrackedResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/package-info.java deleted file mode 100644 index bebd0a0f96d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the inner data models for CommonProperties. - * Arm Managed Identity Provider management API. - */ -package azure.resourcemanager.commonproperties.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/package-info.java deleted file mode 100644 index 00ee0fffe7b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the service clients for CommonProperties. - * Arm Managed Identity Provider management API. - */ -package azure.resourcemanager.commonproperties.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientBuilder.java deleted file mode 100644 index b926a4b5b2e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** - * A builder for creating a new instance of the CommonPropertiesClientImpl type. - */ -@ServiceClientBuilder(serviceClients = { CommonPropertiesClientImpl.class }) -public final class CommonPropertiesClientBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the CommonPropertiesClientBuilder. - */ - public CommonPropertiesClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The ID of the target subscription. The value must be an UUID. - */ - private String subscriptionId; - - /** - * Sets The ID of the target subscription. The value must be an UUID. - * - * @param subscriptionId the subscriptionId value. - * @return the CommonPropertiesClientBuilder. - */ - public CommonPropertiesClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the CommonPropertiesClientBuilder. - */ - public CommonPropertiesClientBuilder environment(AzureEnvironment environment) { - this.environment = environment; - 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 CommonPropertiesClientBuilder. - */ - public CommonPropertiesClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the CommonPropertiesClientBuilder. - */ - public CommonPropertiesClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - 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 CommonPropertiesClientBuilder. - */ - public CommonPropertiesClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of CommonPropertiesClientImpl with the provided parameters. - * - * @return an instance of CommonPropertiesClientImpl. - */ - public CommonPropertiesClientImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval - = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - CommonPropertiesClientImpl client = new CommonPropertiesClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientImpl.java deleted file mode 100644 index 0c015e90c3f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientImpl.java +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.implementation; - -import azure.resourcemanager.commonproperties.fluent.CommonPropertiesClient; -import azure.resourcemanager.commonproperties.fluent.ErrorsClient; -import azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.management.polling.SyncPollerFactory; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the CommonPropertiesClientImpl type. - */ -@ServiceClient(builder = CommonPropertiesClientBuilder.class) -public final class CommonPropertiesClientImpl implements CommonPropertiesClient { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Version parameter. - */ - private final String apiVersion; - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * The ID of the target subscription. The value must be an UUID. - */ - private final String subscriptionId; - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * 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. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The ManagedIdentitiesClient object to access its operations. - */ - private final ManagedIdentitiesClient managedIdentities; - - /** - * Gets the ManagedIdentitiesClient object to access its operations. - * - * @return the ManagedIdentitiesClient object. - */ - public ManagedIdentitiesClient getManagedIdentities() { - return this.managedIdentities; - } - - /** - * The ErrorsClient object to access its operations. - */ - private final ErrorsClient errors; - - /** - * Gets the ErrorsClient object to access its operations. - * - * @return the ErrorsClient object. - */ - public ErrorsClient getErrors() { - return this.errors; - } - - /** - * Initializes an instance of CommonPropertiesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - CommonPropertiesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.apiVersion = "2023-12-01-preview"; - this.managedIdentities = new ManagedIdentitiesClientImpl(this); - this.errors = new ErrorsClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return SyncPoller for poll result and final result. - */ - public SyncPoller, U> getLroResult(Response activationResponse, - Type pollResultType, Type finalResultType, Context context) { - return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, () -> activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(CommonPropertiesClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ConfidentialResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ConfidentialResourceImpl.java deleted file mode 100644 index 65abf4a950d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ConfidentialResourceImpl.java +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.implementation; - -import azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner; -import azure.resourcemanager.commonproperties.models.ConfidentialResource; -import azure.resourcemanager.commonproperties.models.ConfidentialResourceProperties; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Collections; -import java.util.Map; - -public final class ConfidentialResourceImpl implements ConfidentialResource, ConfidentialResource.Definition { - private ConfidentialResourceInner innerObject; - - private final azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager; - - ConfidentialResourceImpl(ConfidentialResourceInner innerObject, - azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public ConfidentialResourceProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public ConfidentialResourceInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.commonproperties.CommonPropertiesManager manager() { - return this.serviceManager; - } - - private String resourceGroupName; - - private String confidentialResourceName; - - public ConfidentialResourceImpl withExistingResourceGroup(String resourceGroupName) { - this.resourceGroupName = resourceGroupName; - return this; - } - - public ConfidentialResource create() { - this.innerObject = serviceManager.serviceClient() - .getErrors() - .createForUserDefinedErrorWithResponse(resourceGroupName, confidentialResourceName, this.innerModel(), - Context.NONE) - .getValue(); - return this; - } - - public ConfidentialResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getErrors() - .createForUserDefinedErrorWithResponse(resourceGroupName, confidentialResourceName, this.innerModel(), - context) - .getValue(); - return this; - } - - ConfidentialResourceImpl(String name, - azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager) { - this.innerObject = new ConfidentialResourceInner(); - this.serviceManager = serviceManager; - this.confidentialResourceName = name; - } - - public ConfidentialResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getErrors() - .getByResourceGroupWithResponse(resourceGroupName, confidentialResourceName, Context.NONE) - .getValue(); - return this; - } - - public ConfidentialResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getErrors() - .getByResourceGroupWithResponse(resourceGroupName, confidentialResourceName, context) - .getValue(); - return this; - } - - public ConfidentialResourceImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); - return this; - } - - public ConfidentialResourceImpl withRegion(String location) { - this.innerModel().withLocation(location); - return this; - } - - public ConfidentialResourceImpl withTags(Map tags) { - this.innerModel().withTags(tags); - return this; - } - - public ConfidentialResourceImpl withProperties(ConfidentialResourceProperties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsClientImpl.java deleted file mode 100644 index d22e1de82c9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsClientImpl.java +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.implementation; - -import azure.resourcemanager.commonproperties.fluent.ErrorsClient; -import azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner; -import azure.resourcemanager.commonproperties.models.ApiErrorException; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ErrorsClient. - */ -public final class ErrorsClientImpl implements ErrorsClient { - /** - * The proxy service used to perform REST calls. - */ - private final ErrorsService service; - - /** - * The service client containing this operation class. - */ - private final CommonPropertiesClientImpl client; - - /** - * Initializes an instance of ErrorsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ErrorsClientImpl(CommonPropertiesClientImpl client) { - this.service = RestProxy.create(ErrorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for CommonPropertiesClientErrors to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "CommonPropertiesClientErrors") - public interface ErrorsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/confidentialResources/{confidentialResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("confidentialResourceName") String confidentialResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/confidentialResources/{confidentialResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("confidentialResourceName") String confidentialResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/confidentialResources/{confidentialResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ApiErrorException.class) - Mono> createForUserDefinedError(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("confidentialResourceName") String confidentialResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ConfidentialResourceInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/confidentialResources/{confidentialResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ApiErrorException.class) - Response createForUserDefinedErrorSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("confidentialResourceName") String confidentialResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ConfidentialResourceInner resource, Context context); - } - - /** - * Get a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ConfidentialResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String confidentialResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, confidentialResourceName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ConfidentialResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, - String confidentialResourceName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, confidentialResourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ConfidentialResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - String confidentialResourceName, Context context) { - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, confidentialResourceName, accept, context); - } - - /** - * Get a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ConfidentialResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ConfidentialResourceInner getByResourceGroup(String resourceGroupName, String confidentialResourceName) { - return getByResourceGroupWithResponse(resourceGroupName, confidentialResourceName, Context.NONE).getValue(); - } - - /** - * Create a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createForUserDefinedErrorWithResponseAsync( - String resourceGroupName, String confidentialResourceName, ConfidentialResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createForUserDefinedError(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, - confidentialResourceName, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createForUserDefinedErrorAsync(String resourceGroupName, - String confidentialResourceName, ConfidentialResourceInner resource) { - return createForUserDefinedErrorWithResponseAsync(resourceGroupName, confidentialResourceName, resource) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Create a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createForUserDefinedErrorWithResponse(String resourceGroupName, - String confidentialResourceName, ConfidentialResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createForUserDefinedErrorSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, confidentialResourceName, contentType, accept, resource, - context); - } - - /** - * Create a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ConfidentialResourceInner createForUserDefinedError(String resourceGroupName, - String confidentialResourceName, ConfidentialResourceInner resource) { - return createForUserDefinedErrorWithResponse(resourceGroupName, confidentialResourceName, resource, - Context.NONE).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsImpl.java deleted file mode 100644 index 13fa33d72d8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.implementation; - -import azure.resourcemanager.commonproperties.fluent.ErrorsClient; -import azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner; -import azure.resourcemanager.commonproperties.models.ConfidentialResource; -import azure.resourcemanager.commonproperties.models.Errors; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class ErrorsImpl implements Errors { - private static final ClientLogger LOGGER = new ClientLogger(ErrorsImpl.class); - - private final ErrorsClient innerClient; - - private final azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager; - - public ErrorsImpl(ErrorsClient innerClient, - azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, - String confidentialResourceName, Context context) { - Response inner - = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, confidentialResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ConfidentialResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public ConfidentialResource getByResourceGroup(String resourceGroupName, String confidentialResourceName) { - ConfidentialResourceInner inner - = this.serviceClient().getByResourceGroup(resourceGroupName, confidentialResourceName); - if (inner != null) { - return new ConfidentialResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public ConfidentialResource getById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String confidentialResourceName = ResourceManagerUtils.getValueFromIdByName(id, "confidentialResources"); - if (confidentialResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'confidentialResources'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, confidentialResourceName, Context.NONE) - .getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String confidentialResourceName = ResourceManagerUtils.getValueFromIdByName(id, "confidentialResources"); - if (confidentialResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'confidentialResources'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, confidentialResourceName, context); - } - - private ErrorsClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.commonproperties.CommonPropertiesManager manager() { - return this.serviceManager; - } - - public ConfidentialResourceImpl define(String name) { - return new ConfidentialResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesClientImpl.java deleted file mode 100644 index c4b234e3a20..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesClientImpl.java +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.implementation; - -import azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient; -import azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ManagedIdentitiesClient. - */ -public final class ManagedIdentitiesClientImpl implements ManagedIdentitiesClient { - /** - * The proxy service used to perform REST calls. - */ - private final ManagedIdentitiesService service; - - /** - * The service client containing this operation class. - */ - private final CommonPropertiesClientImpl client; - - /** - * Initializes an instance of ManagedIdentitiesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ManagedIdentitiesClientImpl(CommonPropertiesClientImpl client) { - this.service - = RestProxy.create(ManagedIdentitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for CommonPropertiesClientManagedIdentities to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "CommonPropertiesClientManagedIdentities") - public interface ManagedIdentitiesService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/{managedIdentityTrackedResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("managedIdentityTrackedResourceName") String managedIdentityTrackedResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/{managedIdentityTrackedResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("managedIdentityTrackedResourceName") String managedIdentityTrackedResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/{managedIdentityTrackedResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createWithSystemAssigned( - @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("managedIdentityTrackedResourceName") String managedIdentityTrackedResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ManagedIdentityTrackedResourceInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/{managedIdentityTrackedResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createWithSystemAssignedSync( - @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("managedIdentityTrackedResourceName") String managedIdentityTrackedResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ManagedIdentityTrackedResourceInner resource, Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/{managedIdentityTrackedResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> updateWithUserAssignedAndSystemAssigned( - @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("managedIdentityTrackedResourceName") String managedIdentityTrackedResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ManagedIdentityTrackedResourceInner properties, Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/{managedIdentityTrackedResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response updateWithUserAssignedAndSystemAssignedSync( - @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("managedIdentityTrackedResourceName") String managedIdentityTrackedResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ManagedIdentityTrackedResourceInner properties, Context context); - } - - /** - * Get a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedIdentityTrackedResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - getByResourceGroupWithResponseAsync(String resourceGroupName, String managedIdentityTrackedResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, managedIdentityTrackedResourceName, accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedIdentityTrackedResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, - String managedIdentityTrackedResourceName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, managedIdentityTrackedResourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedIdentityTrackedResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - String managedIdentityTrackedResourceName, Context context) { - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, managedIdentityTrackedResourceName, accept, context); - } - - /** - * Get a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedIdentityTrackedResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ManagedIdentityTrackedResourceInner getByResourceGroup(String resourceGroupName, - String managedIdentityTrackedResourceName) { - return getByResourceGroupWithResponse(resourceGroupName, managedIdentityTrackedResourceName, Context.NONE) - .getValue(); - } - - /** - * Create a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createWithSystemAssignedWithResponseAsync( - String resourceGroupName, String managedIdentityTrackedResourceName, - ManagedIdentityTrackedResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createWithSystemAssigned(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, - managedIdentityTrackedResourceName, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createWithSystemAssignedAsync(String resourceGroupName, - String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner resource) { - return createWithSystemAssignedWithResponseAsync(resourceGroupName, managedIdentityTrackedResourceName, - resource).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Create a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createWithSystemAssignedWithResponse(String resourceGroupName, - String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createWithSystemAssignedSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, managedIdentityTrackedResourceName, contentType, accept, - resource, context); - } - - /** - * Create a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ManagedIdentityTrackedResourceInner createWithSystemAssigned(String resourceGroupName, - String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner resource) { - return createWithSystemAssignedWithResponse(resourceGroupName, managedIdentityTrackedResourceName, resource, - Context.NONE).getValue(); - } - - /** - * Update a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - updateWithUserAssignedAndSystemAssignedWithResponseAsync(String resourceGroupName, - String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.updateWithUserAssignedAndSystemAssigned(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, - managedIdentityTrackedResourceName, contentType, accept, properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateWithUserAssignedAndSystemAssignedAsync( - String resourceGroupName, String managedIdentityTrackedResourceName, - ManagedIdentityTrackedResourceInner properties) { - return updateWithUserAssignedAndSystemAssignedWithResponseAsync(resourceGroupName, - managedIdentityTrackedResourceName, properties).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Update a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithUserAssignedAndSystemAssignedWithResponse( - String resourceGroupName, String managedIdentityTrackedResourceName, - ManagedIdentityTrackedResourceInner properties, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateWithUserAssignedAndSystemAssignedSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, - managedIdentityTrackedResourceName, contentType, accept, properties, context); - } - - /** - * Update a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ManagedIdentityTrackedResourceInner updateWithUserAssignedAndSystemAssigned(String resourceGroupName, - String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner properties) { - return updateWithUserAssignedAndSystemAssignedWithResponse(resourceGroupName, - managedIdentityTrackedResourceName, properties, Context.NONE).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesImpl.java deleted file mode 100644 index 9627240bd36..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesImpl.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.implementation; - -import azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient; -import azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner; -import azure.resourcemanager.commonproperties.models.ManagedIdentities; -import azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResource; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class ManagedIdentitiesImpl implements ManagedIdentities { - private static final ClientLogger LOGGER = new ClientLogger(ManagedIdentitiesImpl.class); - - private final ManagedIdentitiesClient innerClient; - - private final azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager; - - public ManagedIdentitiesImpl(ManagedIdentitiesClient innerClient, - azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, - String managedIdentityTrackedResourceName, Context context) { - Response inner = this.serviceClient() - .getByResourceGroupWithResponse(resourceGroupName, managedIdentityTrackedResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ManagedIdentityTrackedResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public ManagedIdentityTrackedResource getByResourceGroup(String resourceGroupName, - String managedIdentityTrackedResourceName) { - ManagedIdentityTrackedResourceInner inner - = this.serviceClient().getByResourceGroup(resourceGroupName, managedIdentityTrackedResourceName); - if (inner != null) { - return new ManagedIdentityTrackedResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public ManagedIdentityTrackedResource getById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String managedIdentityTrackedResourceName - = ResourceManagerUtils.getValueFromIdByName(id, "managedIdentityTrackedResources"); - if (managedIdentityTrackedResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( - "The resource ID '%s' is not valid. Missing path segment 'managedIdentityTrackedResources'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, managedIdentityTrackedResourceName, Context.NONE) - .getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String managedIdentityTrackedResourceName - = ResourceManagerUtils.getValueFromIdByName(id, "managedIdentityTrackedResources"); - if (managedIdentityTrackedResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( - "The resource ID '%s' is not valid. Missing path segment 'managedIdentityTrackedResources'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, managedIdentityTrackedResourceName, context); - } - - private ManagedIdentitiesClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.commonproperties.CommonPropertiesManager manager() { - return this.serviceManager; - } - - public ManagedIdentityTrackedResourceImpl define(String name) { - return new ManagedIdentityTrackedResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentityTrackedResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentityTrackedResourceImpl.java deleted file mode 100644 index 69c5be4415a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentityTrackedResourceImpl.java +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.implementation; - -import azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner; -import azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResource; -import azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResourceProperties; -import azure.resourcemanager.commonproperties.models.ManagedServiceIdentity; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Collections; -import java.util.Map; - -public final class ManagedIdentityTrackedResourceImpl implements ManagedIdentityTrackedResource, - ManagedIdentityTrackedResource.Definition, ManagedIdentityTrackedResource.Update { - private ManagedIdentityTrackedResourceInner innerObject; - - private final azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public ManagedIdentityTrackedResourceProperties properties() { - return this.innerModel().properties(); - } - - public ManagedServiceIdentity identity() { - return this.innerModel().identity(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public String resourceGroupName() { - return resourceGroupName; - } - - public ManagedIdentityTrackedResourceInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.commonproperties.CommonPropertiesManager manager() { - return this.serviceManager; - } - - private String resourceGroupName; - - private String managedIdentityTrackedResourceName; - - public ManagedIdentityTrackedResourceImpl withExistingResourceGroup(String resourceGroupName) { - this.resourceGroupName = resourceGroupName; - return this; - } - - public ManagedIdentityTrackedResource create() { - this.innerObject = serviceManager.serviceClient() - .getManagedIdentities() - .createWithSystemAssignedWithResponse(resourceGroupName, managedIdentityTrackedResourceName, - this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public ManagedIdentityTrackedResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getManagedIdentities() - .createWithSystemAssignedWithResponse(resourceGroupName, managedIdentityTrackedResourceName, - this.innerModel(), context) - .getValue(); - return this; - } - - ManagedIdentityTrackedResourceImpl(String name, - azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager) { - this.innerObject = new ManagedIdentityTrackedResourceInner(); - this.serviceManager = serviceManager; - this.managedIdentityTrackedResourceName = name; - } - - public ManagedIdentityTrackedResourceImpl update() { - return this; - } - - public ManagedIdentityTrackedResource apply() { - this.innerObject = serviceManager.serviceClient() - .getManagedIdentities() - .updateWithUserAssignedAndSystemAssignedWithResponse(resourceGroupName, managedIdentityTrackedResourceName, - this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public ManagedIdentityTrackedResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getManagedIdentities() - .updateWithUserAssignedAndSystemAssignedWithResponse(resourceGroupName, managedIdentityTrackedResourceName, - this.innerModel(), context) - .getValue(); - return this; - } - - ManagedIdentityTrackedResourceImpl(ManagedIdentityTrackedResourceInner innerObject, - azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.managedIdentityTrackedResourceName - = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "managedIdentityTrackedResources"); - } - - public ManagedIdentityTrackedResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getManagedIdentities() - .getByResourceGroupWithResponse(resourceGroupName, managedIdentityTrackedResourceName, Context.NONE) - .getValue(); - return this; - } - - public ManagedIdentityTrackedResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getManagedIdentities() - .getByResourceGroupWithResponse(resourceGroupName, managedIdentityTrackedResourceName, context) - .getValue(); - return this; - } - - public ManagedIdentityTrackedResourceImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); - return this; - } - - public ManagedIdentityTrackedResourceImpl withRegion(String location) { - this.innerModel().withLocation(location); - return this; - } - - public ManagedIdentityTrackedResourceImpl withTags(Map tags) { - this.innerModel().withTags(tags); - return this; - } - - public ManagedIdentityTrackedResourceImpl withProperties(ManagedIdentityTrackedResourceProperties properties) { - this.innerModel().withProperties(properties); - return this; - } - - public ManagedIdentityTrackedResourceImpl withIdentity(ManagedServiceIdentity identity) { - this.innerModel().withIdentity(identity); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ResourceManagerUtils.java deleted file mode 100644 index 216b5b29cb4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ResourceManagerUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.implementation; - -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.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class ResourceManagerUtils { - private ResourceManagerUtils() { - } - - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (!segments.isEmpty() && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl<>(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux - .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(iterable.iterator(), mapper); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/package-info.java deleted file mode 100644 index 6d71aa70f2c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the implementations for CommonProperties. - * Arm Managed Identity Provider management API. - */ -package azure.resourcemanager.commonproperties.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiError.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiError.java deleted file mode 100644 index 89e1cdb7251..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiError.java +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.management.exception.AdditionalInfo; -import com.azure.core.management.exception.ManagementError; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * An error response. - */ -@Immutable -public final class ApiError extends ManagementError { - /* - * The Api inner error - */ - private InnerError innererror; - - /* - * Additional info for the error. - */ - private List additionalInfo; - - /* - * Details for the error. - */ - private List details; - - /* - * The target of the error. - */ - private String target; - - /* - * The error message parsed from the body of the http error response. - */ - private String message; - - /* - * The error code parsed from the body of the http error response. - */ - private String code; - - /** - * Creates an instance of ApiError class. - */ - private ApiError() { - } - - /** - * Get the innererror property: The Api inner error. - * - * @return the innererror value. - */ - public InnerError getInnererror() { - return this.innererror; - } - - /** - * Get the additionalInfo property: Additional info for the error. - * - * @return the additionalInfo value. - */ - @Override - public List getAdditionalInfo() { - return this.additionalInfo; - } - - /** - * Get the details property: Details for the error. - * - * @return the details value. - */ - @Override - public List getDetails() { - return this.details; - } - - /** - * Get the target property: The target of the error. - * - * @return the target value. - */ - @Override - public String getTarget() { - return this.target; - } - - /** - * Get the message property: The error message parsed from the body of the http error response. - * - * @return the message value. - */ - @Override - public String getMessage() { - return this.message; - } - - /** - * Get the code property: The error code parsed from the body of the http error response. - * - * @return the code value. - */ - @Override - public String getCode() { - return this.code; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ApiError from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ApiError if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IOException If an error occurs while reading the ApiError. - */ - public static ApiError fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - JsonReader bufferedReader = reader.bufferObject(); - bufferedReader.nextToken(); - while (bufferedReader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = bufferedReader.getFieldName(); - bufferedReader.nextToken(); - - if ("error".equals(fieldName)) { - return readManagementError(bufferedReader); - } else { - bufferedReader.skipChildren(); - } - } - return readManagementError(bufferedReader.reset()); - }); - } - - private static ApiError readManagementError(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ApiError deserializedApiError = new ApiError(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("code".equals(fieldName)) { - deserializedApiError.code = reader.getString(); - } else if ("message".equals(fieldName)) { - deserializedApiError.message = reader.getString(); - } else if ("target".equals(fieldName)) { - deserializedApiError.target = reader.getString(); - } else if ("details".equals(fieldName)) { - List details = reader.readArray(reader1 -> ManagementError.fromJson(reader1)); - deserializedApiError.details = details; - } else if ("additionalInfo".equals(fieldName)) { - List additionalInfo = reader.readArray(reader1 -> AdditionalInfo.fromJson(reader1)); - deserializedApiError.additionalInfo = additionalInfo; - } else if ("innererror".equals(fieldName)) { - deserializedApiError.innererror = InnerError.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedApiError; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiErrorException.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiErrorException.java deleted file mode 100644 index 4d5627ba10c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiErrorException.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.models; - -import com.azure.core.http.HttpResponse; -import com.azure.core.management.exception.ManagementException; - -/** - * Exception thrown for an invalid response with ApiError information. - */ -public final class ApiErrorException extends ManagementException { - /** - * Initializes a new instance of the ApiErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - */ - public ApiErrorException(String message, HttpResponse response) { - super(message, response); - } - - /** - * Initializes a new instance of the ApiErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - * @param value the deserialized response value. - */ - public ApiErrorException(String message, HttpResponse response, ApiError value) { - super(message, response, value); - } - - /** - * {@inheritDoc} - */ - @Override - public ApiError getValue() { - return (ApiError) super.getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResource.java deleted file mode 100644 index 683e7d8a043..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResource.java +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.models; - -import azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Map; - -/** - * An immutable client-side representation of ConfidentialResource. - */ -public interface ConfidentialResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - ConfidentialResourceProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the inner azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner object. - * - * @return the inner object. - */ - ConfidentialResourceInner innerModel(); - - /** - * The entirety of the ConfidentialResource definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { - } - - /** - * The ConfidentialResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the ConfidentialResource definition. - */ - interface Blank extends WithLocation { - } - - /** - * The stage of the ConfidentialResource definition allowing to specify location. - */ - interface WithLocation { - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(Region location); - - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(String location); - } - - /** - * The stage of the ConfidentialResource definition allowing to specify parent resource. - */ - interface WithResourceGroup { - /** - * Specifies resourceGroupName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @return the next definition stage. - */ - WithCreate withExistingResourceGroup(String resourceGroupName); - } - - /** - * The stage of the ConfidentialResource definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - ConfidentialResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - ConfidentialResource create(Context context); - } - - /** - * The stage of the ConfidentialResource definition allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - WithCreate withTags(Map tags); - } - - /** - * The stage of the ConfidentialResource definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(ConfidentialResourceProperties properties); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - ConfidentialResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - ConfidentialResource refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResourceProperties.java deleted file mode 100644 index 01a7a09581f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResourceProperties.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Confidential Resource Properties. - */ -@Fluent -public final class ConfidentialResourceProperties implements JsonSerializable { - /* - * The status of the last operation. - */ - private String provisioningState; - - /* - * The username property. - */ - private String username; - - /** - * Creates an instance of ConfidentialResourceProperties class. - */ - public ConfidentialResourceProperties() { - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public String provisioningState() { - return this.provisioningState; - } - - /** - * Get the username property: The username property. - * - * @return the username value. - */ - public String username() { - return this.username; - } - - /** - * Set the username property: The username property. - * - * @param username the username value to set. - * @return the ConfidentialResourceProperties object itself. - */ - public ConfidentialResourceProperties withUsername(String username) { - this.username = username; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("username", this.username); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ConfidentialResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ConfidentialResourceProperties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ConfidentialResourceProperties. - */ - public static ConfidentialResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ConfidentialResourceProperties deserializedConfidentialResourceProperties - = new ConfidentialResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedConfidentialResourceProperties.provisioningState = reader.getString(); - } else if ("username".equals(fieldName)) { - deserializedConfidentialResourceProperties.username = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedConfidentialResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/Errors.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/Errors.java deleted file mode 100644 index bc48e294d80..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/Errors.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of Errors. - */ -public interface Errors { - /** - * Get a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ConfidentialResource along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, - String confidentialResourceName, Context context); - - /** - * Get a ConfidentialResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param confidentialResourceName The name of the ConfidentialResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ConfidentialResource. - */ - ConfidentialResource getByResourceGroup(String resourceGroupName, String confidentialResourceName); - - /** - * Get a ConfidentialResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ConfidentialResource along with {@link Response}. - */ - ConfidentialResource getById(String id); - - /** - * Get a ConfidentialResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ConfidentialResource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new ConfidentialResource resource. - * - * @param name resource name. - * @return the first stage of the new ConfidentialResource definition. - */ - ConfidentialResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/InnerError.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/InnerError.java deleted file mode 100644 index 1479be875b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/InnerError.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Inner error details. - */ -@Immutable -public final class InnerError implements JsonSerializable { - /* - * The exception type. - */ - private String exceptiontype; - - /* - * The internal error message or exception dump. - */ - private String errordetail; - - /** - * Creates an instance of InnerError class. - */ - private InnerError() { - } - - /** - * Get the exceptiontype property: The exception type. - * - * @return the exceptiontype value. - */ - public String exceptiontype() { - return this.exceptiontype; - } - - /** - * Get the errordetail property: The internal error message or exception dump. - * - * @return the errordetail value. - */ - public String errordetail() { - return this.errordetail; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("exceptiontype", this.exceptiontype); - jsonWriter.writeStringField("errordetail", this.errordetail); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InnerError from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InnerError if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IOException If an error occurs while reading the InnerError. - */ - public static InnerError fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - InnerError deserializedInnerError = new InnerError(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("exceptiontype".equals(fieldName)) { - deserializedInnerError.exceptiontype = reader.getString(); - } else if ("errordetail".equals(fieldName)) { - deserializedInnerError.errordetail = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedInnerError; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentities.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentities.java deleted file mode 100644 index e90e3222dc8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentities.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of ManagedIdentities. - */ -public interface ManagedIdentities { - /** - * Get a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedIdentityTrackedResource along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, - String managedIdentityTrackedResourceName, Context context); - - /** - * Get a ManagedIdentityTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedIdentityTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedIdentityTrackedResource. - */ - ManagedIdentityTrackedResource getByResourceGroup(String resourceGroupName, - String managedIdentityTrackedResourceName); - - /** - * Get a ManagedIdentityTrackedResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedIdentityTrackedResource along with {@link Response}. - */ - ManagedIdentityTrackedResource getById(String id); - - /** - * Get a ManagedIdentityTrackedResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedIdentityTrackedResource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new ManagedIdentityTrackedResource resource. - * - * @param name resource name. - * @return the first stage of the new ManagedIdentityTrackedResource definition. - */ - ManagedIdentityTrackedResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResource.java deleted file mode 100644 index e221b3cadfd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResource.java +++ /dev/null @@ -1,299 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.models; - -import azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Map; - -/** - * An immutable client-side representation of ManagedIdentityTrackedResource. - */ -public interface ManagedIdentityTrackedResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - ManagedIdentityTrackedResourceProperties properties(); - - /** - * Gets the identity property: The managed service identities assigned to this resource. - * - * @return the identity value. - */ - ManagedServiceIdentity identity(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the name of the resource group. - * - * @return the name of the resource group. - */ - String resourceGroupName(); - - /** - * Gets the inner azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner object. - * - * @return the inner object. - */ - ManagedIdentityTrackedResourceInner innerModel(); - - /** - * The entirety of the ManagedIdentityTrackedResource definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { - } - - /** - * The ManagedIdentityTrackedResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the ManagedIdentityTrackedResource definition. - */ - interface Blank extends WithLocation { - } - - /** - * The stage of the ManagedIdentityTrackedResource definition allowing to specify location. - */ - interface WithLocation { - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(Region location); - - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(String location); - } - - /** - * The stage of the ManagedIdentityTrackedResource definition allowing to specify parent resource. - */ - interface WithResourceGroup { - /** - * Specifies resourceGroupName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @return the next definition stage. - */ - WithCreate withExistingResourceGroup(String resourceGroupName); - } - - /** - * The stage of the ManagedIdentityTrackedResource definition which contains all the minimum required properties - * for the resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate - extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithIdentity { - /** - * Executes the create request. - * - * @return the created resource. - */ - ManagedIdentityTrackedResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - ManagedIdentityTrackedResource create(Context context); - } - - /** - * The stage of the ManagedIdentityTrackedResource definition allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - WithCreate withTags(Map tags); - } - - /** - * The stage of the ManagedIdentityTrackedResource definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(ManagedIdentityTrackedResourceProperties properties); - } - - /** - * The stage of the ManagedIdentityTrackedResource definition allowing to specify identity. - */ - interface WithIdentity { - /** - * Specifies the identity property: The managed service identities assigned to this resource.. - * - * @param identity The managed service identities assigned to this resource. - * @return the next definition stage. - */ - WithCreate withIdentity(ManagedServiceIdentity identity); - } - } - - /** - * Begins update for the ManagedIdentityTrackedResource resource. - * - * @return the stage of resource update. - */ - ManagedIdentityTrackedResource.Update update(); - - /** - * The template for ManagedIdentityTrackedResource update. - */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties, UpdateStages.WithIdentity { - /** - * Executes the update request. - * - * @return the updated resource. - */ - ManagedIdentityTrackedResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - ManagedIdentityTrackedResource apply(Context context); - } - - /** - * The ManagedIdentityTrackedResource update stages. - */ - interface UpdateStages { - /** - * The stage of the ManagedIdentityTrackedResource update allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - Update withTags(Map tags); - } - - /** - * The stage of the ManagedIdentityTrackedResource update allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - Update withProperties(ManagedIdentityTrackedResourceProperties properties); - } - - /** - * The stage of the ManagedIdentityTrackedResource update allowing to specify identity. - */ - interface WithIdentity { - /** - * Specifies the identity property: The managed service identities assigned to this resource.. - * - * @param identity The managed service identities assigned to this resource. - * @return the next definition stage. - */ - Update withIdentity(ManagedServiceIdentity identity); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - ManagedIdentityTrackedResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - ManagedIdentityTrackedResource refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResourceProperties.java deleted file mode 100644 index 097a31707a4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResourceProperties.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Managed Identity Arm Resource Properties. - */ -@Immutable -public final class ManagedIdentityTrackedResourceProperties - implements JsonSerializable { - /* - * The status of the last operation. - */ - private String provisioningState; - - /** - * Creates an instance of ManagedIdentityTrackedResourceProperties class. - */ - public ManagedIdentityTrackedResourceProperties() { - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public String provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ManagedIdentityTrackedResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ManagedIdentityTrackedResourceProperties if the JsonReader was pointing to an instance of - * it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ManagedIdentityTrackedResourceProperties. - */ - public static ManagedIdentityTrackedResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ManagedIdentityTrackedResourceProperties deserializedManagedIdentityTrackedResourceProperties - = new ManagedIdentityTrackedResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedManagedIdentityTrackedResourceProperties.provisioningState = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedManagedIdentityTrackedResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentity.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentity.java deleted file mode 100644 index c08d689f65b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentity.java +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Managed service identity (system assigned and/or user assigned identities). - */ -@Fluent -public final class ManagedServiceIdentity implements JsonSerializable { - /* - * The service principal ID of the system assigned identity. This property will only be provided for a system - * assigned identity. - */ - private String principalId; - - /* - * The tenant ID of the system assigned identity. This property will only be provided for a system assigned - * identity. - */ - private String tenantId; - - /* - * The type of managed identity assigned to this resource. - */ - private ManagedServiceIdentityType type; - - /* - * The identities assigned to this resource by the user. - */ - private Map userAssignedIdentities; - - /** - * Creates an instance of ManagedServiceIdentity class. - */ - public ManagedServiceIdentity() { - } - - /** - * Get the principalId property: The service principal ID of the system assigned identity. This property will only - * be provided for a system assigned identity. - * - * @return the principalId value. - */ - public String principalId() { - return this.principalId; - } - - /** - * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for - * a system assigned identity. - * - * @return the tenantId value. - */ - public String tenantId() { - return this.tenantId; - } - - /** - * Get the type property: The type of managed identity assigned to this resource. - * - * @return the type value. - */ - public ManagedServiceIdentityType type() { - return this.type; - } - - /** - * Set the type property: The type of managed identity assigned to this resource. - * - * @param type the type value to set. - * @return the ManagedServiceIdentity object itself. - */ - public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { - this.type = type; - return this; - } - - /** - * Get the userAssignedIdentities property: The identities assigned to this resource by the user. - * - * @return the userAssignedIdentities value. - */ - public Map userAssignedIdentities() { - return this.userAssignedIdentities; - } - - /** - * Set the userAssignedIdentities property: The identities assigned to this resource by the user. - * - * @param userAssignedIdentities the userAssignedIdentities value to set. - * @return the ManagedServiceIdentity object itself. - */ - public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { - this.userAssignedIdentities = userAssignedIdentities; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); - jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, - (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ManagedServiceIdentity from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ManagedServiceIdentity. - */ - public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("type".equals(fieldName)) { - deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); - } else if ("principalId".equals(fieldName)) { - deserializedManagedServiceIdentity.principalId = reader.getString(); - } else if ("tenantId".equals(fieldName)) { - deserializedManagedServiceIdentity.tenantId = reader.getString(); - } else if ("userAssignedIdentities".equals(fieldName)) { - Map userAssignedIdentities - = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); - deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; - } else { - reader.skipChildren(); - } - } - - return deserializedManagedServiceIdentity; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentityType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentityType.java deleted file mode 100644 index ea458f7db5c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentityType.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). - */ -public final class ManagedServiceIdentityType extends ExpandableStringEnum { - /** - * No managed identity. - */ - public static final ManagedServiceIdentityType NONE = fromString("None"); - - /** - * System assigned managed identity. - */ - public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); - - /** - * User assigned managed identity. - */ - public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); - - /** - * System and user assigned managed identity. - */ - public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED - = fromString("SystemAssigned,UserAssigned"); - - /** - * Creates a new instance of ManagedServiceIdentityType value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ManagedServiceIdentityType() { - } - - /** - * Creates or finds a ManagedServiceIdentityType from its string representation. - * - * @param name a name to look for. - * @return the corresponding ManagedServiceIdentityType. - */ - public static ManagedServiceIdentityType fromString(String name) { - return fromString(name, ManagedServiceIdentityType.class); - } - - /** - * Gets known ManagedServiceIdentityType values. - * - * @return known ManagedServiceIdentityType values. - */ - public static Collection values() { - return values(ManagedServiceIdentityType.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/UserAssignedIdentity.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/UserAssignedIdentity.java deleted file mode 100644 index 543d8842d08..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/UserAssignedIdentity.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.commonproperties.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * User assigned identity properties. - */ -@Immutable -public final class UserAssignedIdentity implements JsonSerializable { - /* - * The principal ID of the assigned identity. - */ - private String principalId; - - /* - * The client ID of the assigned identity. - */ - private String clientId; - - /** - * Creates an instance of UserAssignedIdentity class. - */ - public UserAssignedIdentity() { - } - - /** - * Get the principalId property: The principal ID of the assigned identity. - * - * @return the principalId value. - */ - public String principalId() { - return this.principalId; - } - - /** - * Get the clientId property: The client ID of the assigned identity. - * - * @return the clientId value. - */ - public String clientId() { - return this.clientId; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UserAssignedIdentity from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the UserAssignedIdentity. - */ - public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("principalId".equals(fieldName)) { - deserializedUserAssignedIdentity.principalId = reader.getString(); - } else if ("clientId".equals(fieldName)) { - deserializedUserAssignedIdentity.clientId = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedUserAssignedIdentity; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/package-info.java deleted file mode 100644 index fbe69cf6855..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the data models for CommonProperties. - * Arm Managed Identity Provider management API. - */ -package azure.resourcemanager.commonproperties.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/package-info.java deleted file mode 100644 index d76a42f2fb4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the classes for CommonProperties. - * Arm Managed Identity Provider management API. - */ -package azure.resourcemanager.commonproperties; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/LargeHeaderManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/LargeHeaderManager.java deleted file mode 100644 index c002ee5710e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/LargeHeaderManager.java +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.largeheader; - -import azure.resourcemanager.largeheader.fluent.LargeHeaderClient; -import azure.resourcemanager.largeheader.implementation.LargeHeaderClientBuilder; -import azure.resourcemanager.largeheader.implementation.LargeHeadersImpl; -import azure.resourcemanager.largeheader.models.LargeHeaders; -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * Entry point to LargeHeaderManager. - * Arm Resource Provider management API. - */ -public final class LargeHeaderManager { - private LargeHeaders largeHeaders; - - private final LargeHeaderClient clientObject; - - private LargeHeaderManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new LargeHeaderClientBuilder().pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of LargeHeader service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the LargeHeader service API instance. - */ - public static LargeHeaderManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return configure().authenticate(credential, profile); - } - - /** - * Creates an instance of LargeHeader service API entry point. - * - * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. - * @param profile the Azure profile for client. - * @return the LargeHeader service API instance. - */ - public static LargeHeaderManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return new LargeHeaderManager(httpPipeline, profile, null); - } - - /** - * Gets a Configurable instance that can be used to create LargeHeaderManager with optional configuration. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new LargeHeaderManager.Configurable(); - } - - /** - * The Configurable allowing configurations to be set. - */ - public static final class Configurable { - private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); - private static final String SDK_VERSION = "version"; - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-resourcemanager-largeheader-generated.properties"); - - private HttpClient httpClient; - private HttpLogOptions httpLogOptions; - private final List policies = new ArrayList<>(); - private final List scopes = new ArrayList<>(); - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - private Duration defaultPollInterval; - - private Configurable() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - return this; - } - - /** - * Adds the scope to permission sets. - * - * @param scope the scope. - * @return the configurable object itself. - */ - public Configurable withScope(String scope) { - this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); - return this; - } - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - /** - * Sets the default poll interval, used when service does not provide "Retry-After" header. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval - = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of LargeHeader service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the LargeHeader service API instance. - */ - public LargeHeaderManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder.append("azsdk-java") - .append("-") - .append("azure.resourcemanager.largeheader") - .append("/") - .append(clientVersion); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder.append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(userAgentBuilder.toString())); - policies.add(new AddHeadersFromContextPolicy()); - policies.add(new RequestIdPolicy()); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy); - policies.add(new AddDatePolicy()); - policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new LargeHeaderManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * Gets the resource collection API of LargeHeaders. - * - * @return Resource collection API of LargeHeaders. - */ - public LargeHeaders largeHeaders() { - if (this.largeHeaders == null) { - this.largeHeaders = new LargeHeadersImpl(clientObject.getLargeHeaders(), this); - } - return largeHeaders; - } - - /** - * Gets wrapped service client LargeHeaderClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. - * - * @return Wrapped service client LargeHeaderClient. - */ - public LargeHeaderClient serviceClient() { - return this.clientObject; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeaderClient.java deleted file mode 100644 index 116654e3b13..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeaderClient.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.largeheader.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for LargeHeaderClient class. - */ -public interface LargeHeaderClient { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the LargeHeadersClient object to access its operations. - * - * @return the LargeHeadersClient object. - */ - LargeHeadersClient getLargeHeaders(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeadersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeadersClient.java deleted file mode 100644 index 6ef5879917e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeadersClient.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.largeheader.fluent; - -import azure.resourcemanager.largeheader.fluent.models.CancelResultInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; - -/** - * An instance of this class provides access to all the operations defined in LargeHeadersClient. - */ -public interface LargeHeadersClient { - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, CancelResultInner> beginTwo6k(String resourceGroupName, - String largeHeaderName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, CancelResultInner> beginTwo6k(String resourceGroupName, - String largeHeaderName, Context context); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - CancelResultInner two6k(String resourceGroupName, String largeHeaderName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - CancelResultInner two6k(String resourceGroupName, String largeHeaderName, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/CancelResultInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/CancelResultInner.java deleted file mode 100644 index 5147a25f71b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/CancelResultInner.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.largeheader.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The CancelResult model. - */ -@Immutable -public final class CancelResultInner implements JsonSerializable { - /* - * The succeeded property. - */ - private boolean succeeded; - - /** - * Creates an instance of CancelResultInner class. - */ - private CancelResultInner() { - } - - /** - * Get the succeeded property: The succeeded property. - * - * @return the succeeded value. - */ - public boolean succeeded() { - return this.succeeded; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("succeeded", this.succeeded); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CancelResultInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CancelResultInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the CancelResultInner. - */ - public static CancelResultInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CancelResultInner deserializedCancelResultInner = new CancelResultInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("succeeded".equals(fieldName)) { - deserializedCancelResultInner.succeeded = reader.getBoolean(); - } else { - reader.skipChildren(); - } - } - - return deserializedCancelResultInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/package-info.java deleted file mode 100644 index 549698d9152..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the inner data models for LargeHeader. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.largeheader.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/package-info.java deleted file mode 100644 index c62c520a473..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the service clients for LargeHeader. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.largeheader.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/CancelResultImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/CancelResultImpl.java deleted file mode 100644 index e7c8f18d428..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/CancelResultImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.largeheader.implementation; - -import azure.resourcemanager.largeheader.fluent.models.CancelResultInner; -import azure.resourcemanager.largeheader.models.CancelResult; - -public final class CancelResultImpl implements CancelResult { - private CancelResultInner innerObject; - - private final azure.resourcemanager.largeheader.LargeHeaderManager serviceManager; - - CancelResultImpl(CancelResultInner innerObject, - azure.resourcemanager.largeheader.LargeHeaderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public boolean succeeded() { - return this.innerModel().succeeded(); - } - - public CancelResultInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.largeheader.LargeHeaderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientBuilder.java deleted file mode 100644 index e380c03c513..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.largeheader.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** - * A builder for creating a new instance of the LargeHeaderClientImpl type. - */ -@ServiceClientBuilder(serviceClients = { LargeHeaderClientImpl.class }) -public final class LargeHeaderClientBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the LargeHeaderClientBuilder. - */ - public LargeHeaderClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The ID of the target subscription. The value must be an UUID. - */ - private String subscriptionId; - - /** - * Sets The ID of the target subscription. The value must be an UUID. - * - * @param subscriptionId the subscriptionId value. - * @return the LargeHeaderClientBuilder. - */ - public LargeHeaderClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the LargeHeaderClientBuilder. - */ - public LargeHeaderClientBuilder environment(AzureEnvironment environment) { - this.environment = environment; - 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 LargeHeaderClientBuilder. - */ - public LargeHeaderClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the LargeHeaderClientBuilder. - */ - public LargeHeaderClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - 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 LargeHeaderClientBuilder. - */ - public LargeHeaderClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of LargeHeaderClientImpl with the provided parameters. - * - * @return an instance of LargeHeaderClientImpl. - */ - public LargeHeaderClientImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval - = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - LargeHeaderClientImpl client = new LargeHeaderClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientImpl.java deleted file mode 100644 index 420a3767afb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientImpl.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.largeheader.implementation; - -import azure.resourcemanager.largeheader.fluent.LargeHeaderClient; -import azure.resourcemanager.largeheader.fluent.LargeHeadersClient; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.management.polling.SyncPollerFactory; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the LargeHeaderClientImpl type. - */ -@ServiceClient(builder = LargeHeaderClientBuilder.class) -public final class LargeHeaderClientImpl implements LargeHeaderClient { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Version parameter. - */ - private final String apiVersion; - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * The ID of the target subscription. The value must be an UUID. - */ - private final String subscriptionId; - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * 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. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The LargeHeadersClient object to access its operations. - */ - private final LargeHeadersClient largeHeaders; - - /** - * Gets the LargeHeadersClient object to access its operations. - * - * @return the LargeHeadersClient object. - */ - public LargeHeadersClient getLargeHeaders() { - return this.largeHeaders; - } - - /** - * Initializes an instance of LargeHeaderClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - LargeHeaderClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, - AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.apiVersion = "2023-12-01-preview"; - this.largeHeaders = new LargeHeadersClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return SyncPoller for poll result and final result. - */ - public SyncPoller, U> getLroResult(Response activationResponse, - Type pollResultType, Type finalResultType, Context context) { - return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, () -> activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(LargeHeaderClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersClientImpl.java deleted file mode 100644 index c5df0d843e6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersClientImpl.java +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.largeheader.implementation; - -import azure.resourcemanager.largeheader.fluent.LargeHeadersClient; -import azure.resourcemanager.largeheader.fluent.models.CancelResultInner; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in LargeHeadersClient. - */ -public final class LargeHeadersClientImpl implements LargeHeadersClient { - /** - * The proxy service used to perform REST calls. - */ - private final LargeHeadersService service; - - /** - * The service client containing this operation class. - */ - private final LargeHeaderClientImpl client; - - /** - * Initializes an instance of LargeHeadersClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - LargeHeadersClientImpl(LargeHeaderClientImpl client) { - this.service - = RestProxy.create(LargeHeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for LargeHeaderClientLargeHeaders to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "LargeHeaderClientLargeHeaders") - public interface LargeHeadersService { - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.LargeHeader/largeHeaders/{largeHeaderName}/two6k") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> two6k(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("largeHeaderName") String largeHeaderName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.LargeHeader/largeHeaders/{largeHeaderName}/two6k") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response two6kSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("largeHeaderName") String largeHeaderName, @HeaderParam("Accept") String accept, - Context context); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> two6kWithResponseAsync(String resourceGroupName, String largeHeaderName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.two6k(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, largeHeaderName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response two6kWithResponse(String resourceGroupName, String largeHeaderName) { - final String accept = "application/json"; - return service.two6kSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, largeHeaderName, accept, Context.NONE); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response two6kWithResponse(String resourceGroupName, String largeHeaderName, Context context) { - final String accept = "application/json"; - return service.two6kSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, largeHeaderName, accept, context); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, CancelResultInner> beginTwo6kAsync(String resourceGroupName, - String largeHeaderName) { - Mono>> mono = two6kWithResponseAsync(resourceGroupName, largeHeaderName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - CancelResultInner.class, CancelResultInner.class, this.client.getContext()); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, CancelResultInner> beginTwo6k(String resourceGroupName, - String largeHeaderName) { - Response response = two6kWithResponse(resourceGroupName, largeHeaderName); - return this.client.getLroResult(response, CancelResultInner.class, - CancelResultInner.class, Context.NONE); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, CancelResultInner> beginTwo6k(String resourceGroupName, - String largeHeaderName, Context context) { - Response response = two6kWithResponse(resourceGroupName, largeHeaderName, context); - return this.client.getLroResult(response, CancelResultInner.class, - CancelResultInner.class, context); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono two6kAsync(String resourceGroupName, String largeHeaderName) { - return beginTwo6kAsync(resourceGroupName, largeHeaderName).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 CancelResultInner two6k(String resourceGroupName, String largeHeaderName) { - return beginTwo6k(resourceGroupName, largeHeaderName).getFinalResult(); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 CancelResultInner two6k(String resourceGroupName, String largeHeaderName, Context context) { - return beginTwo6k(resourceGroupName, largeHeaderName, context).getFinalResult(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersImpl.java deleted file mode 100644 index 1799419dee3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.largeheader.implementation; - -import azure.resourcemanager.largeheader.fluent.LargeHeadersClient; -import azure.resourcemanager.largeheader.fluent.models.CancelResultInner; -import azure.resourcemanager.largeheader.models.CancelResult; -import azure.resourcemanager.largeheader.models.LargeHeaders; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class LargeHeadersImpl implements LargeHeaders { - private static final ClientLogger LOGGER = new ClientLogger(LargeHeadersImpl.class); - - private final LargeHeadersClient innerClient; - - private final azure.resourcemanager.largeheader.LargeHeaderManager serviceManager; - - public LargeHeadersImpl(LargeHeadersClient innerClient, - azure.resourcemanager.largeheader.LargeHeaderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public CancelResult two6k(String resourceGroupName, String largeHeaderName) { - CancelResultInner inner = this.serviceClient().two6k(resourceGroupName, largeHeaderName); - if (inner != null) { - return new CancelResultImpl(inner, this.manager()); - } else { - return null; - } - } - - public CancelResult two6k(String resourceGroupName, String largeHeaderName, Context context) { - CancelResultInner inner = this.serviceClient().two6k(resourceGroupName, largeHeaderName, context); - if (inner != null) { - return new CancelResultImpl(inner, this.manager()); - } else { - return null; - } - } - - private LargeHeadersClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.largeheader.LargeHeaderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/ResourceManagerUtils.java deleted file mode 100644 index 7c02e2426ae..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/ResourceManagerUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.largeheader.implementation; - -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.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class ResourceManagerUtils { - private ResourceManagerUtils() { - } - - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (!segments.isEmpty() && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl<>(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux - .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(iterable.iterator(), mapper); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/package-info.java deleted file mode 100644 index ccab556daba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the implementations for LargeHeader. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.largeheader.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/CancelResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/CancelResult.java deleted file mode 100644 index 21ed342529e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/CancelResult.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.largeheader.models; - -import azure.resourcemanager.largeheader.fluent.models.CancelResultInner; - -/** - * An immutable client-side representation of CancelResult. - */ -public interface CancelResult { - /** - * Gets the succeeded property: The succeeded property. - * - * @return the succeeded value. - */ - boolean succeeded(); - - /** - * Gets the inner azure.resourcemanager.largeheader.fluent.models.CancelResultInner object. - * - * @return the inner object. - */ - CancelResultInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/LargeHeaders.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/LargeHeaders.java deleted file mode 100644 index 99ac162675d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/LargeHeaders.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.largeheader.models; - -import com.azure.core.util.Context; - -/** - * Resource collection API of LargeHeaders. - */ -public interface LargeHeaders { - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - CancelResult two6k(String resourceGroupName, String largeHeaderName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param largeHeaderName The name of the LargeHeader. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - CancelResult two6k(String resourceGroupName, String largeHeaderName, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/package-info.java deleted file mode 100644 index 781de7fb684..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the data models for LargeHeader. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.largeheader.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/package-info.java deleted file mode 100644 index 9b57448d5d9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the classes for LargeHeader. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.largeheader; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/MethodSubscriptionIdManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/MethodSubscriptionIdManager.java deleted file mode 100644 index 51203494232..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/MethodSubscriptionIdManager.java +++ /dev/null @@ -1,362 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid; - -import azure.resourcemanager.methodsubscriptionid.fluent.MethodSubscriptionIdClient; -import azure.resourcemanager.methodsubscriptionid.implementation.MethodSubscriptionIdClientBuilder; -import azure.resourcemanager.methodsubscriptionid.implementation.MixedSubscriptionPlacementResourceGroupResourceOperationsImpl; -import azure.resourcemanager.methodsubscriptionid.implementation.MixedSubscriptionPlacementSubscriptionResourceOperationsImpl; -import azure.resourcemanager.methodsubscriptionid.implementation.OperationsImpl; -import azure.resourcemanager.methodsubscriptionid.implementation.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl; -import azure.resourcemanager.methodsubscriptionid.implementation.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl; -import azure.resourcemanager.methodsubscriptionid.models.MixedSubscriptionPlacementResourceGroupResourceOperations; -import azure.resourcemanager.methodsubscriptionid.models.MixedSubscriptionPlacementSubscriptionResourceOperations; -import azure.resourcemanager.methodsubscriptionid.models.Operations; -import azure.resourcemanager.methodsubscriptionid.models.TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations; -import azure.resourcemanager.methodsubscriptionid.models.TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations; -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * Entry point to MethodSubscriptionIdManager. - * Test for ARM method level subscription ID parameter placement. - */ -public final class MethodSubscriptionIdManager { - private TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations; - - private TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations; - - private MixedSubscriptionPlacementSubscriptionResourceOperations mixedSubscriptionPlacementSubscriptionResourceOperations; - - private MixedSubscriptionPlacementResourceGroupResourceOperations mixedSubscriptionPlacementResourceGroupResourceOperations; - - private Operations operations; - - private final MethodSubscriptionIdClient clientObject; - - private MethodSubscriptionIdManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new MethodSubscriptionIdClientBuilder().pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of MethodSubscriptionId service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the MethodSubscriptionId service API instance. - */ - public static MethodSubscriptionIdManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return configure().authenticate(credential, profile); - } - - /** - * Creates an instance of MethodSubscriptionId service API entry point. - * - * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. - * @param profile the Azure profile for client. - * @return the MethodSubscriptionId service API instance. - */ - public static MethodSubscriptionIdManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return new MethodSubscriptionIdManager(httpPipeline, profile, null); - } - - /** - * Gets a Configurable instance that can be used to create MethodSubscriptionIdManager with optional configuration. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new MethodSubscriptionIdManager.Configurable(); - } - - /** - * The Configurable allowing configurations to be set. - */ - public static final class Configurable { - private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); - private static final String SDK_VERSION = "version"; - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-resourcemanager-methodsubscriptionid-generated.properties"); - - private HttpClient httpClient; - private HttpLogOptions httpLogOptions; - private final List policies = new ArrayList<>(); - private final List scopes = new ArrayList<>(); - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - private Duration defaultPollInterval; - - private Configurable() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - return this; - } - - /** - * Adds the scope to permission sets. - * - * @param scope the scope. - * @return the configurable object itself. - */ - public Configurable withScope(String scope) { - this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); - return this; - } - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - /** - * Sets the default poll interval, used when service does not provide "Retry-After" header. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval - = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of MethodSubscriptionId service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the MethodSubscriptionId service API instance. - */ - public MethodSubscriptionIdManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder.append("azsdk-java") - .append("-") - .append("azure.resourcemanager.methodsubscriptionid") - .append("/") - .append(clientVersion); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder.append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(userAgentBuilder.toString())); - policies.add(new AddHeadersFromContextPolicy()); - policies.add(new RequestIdPolicy()); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy); - policies.add(new AddDatePolicy()); - policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new MethodSubscriptionIdManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * Gets the resource collection API of TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations. It - * manages SubscriptionResource1. - * - * @return Resource collection API of TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations. - */ - public TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations - twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() { - if (this.twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations == null) { - this.twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations - = new TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl( - clientObject.getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations(), this); - } - return twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations; - } - - /** - * Gets the resource collection API of TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations. It - * manages SubscriptionResource2. - * - * @return Resource collection API of TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations. - */ - public TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations - twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() { - if (this.twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations == null) { - this.twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations - = new TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl( - clientObject.getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations(), this); - } - return twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations; - } - - /** - * Gets the resource collection API of MixedSubscriptionPlacementSubscriptionResourceOperations. It manages - * SubscriptionResource. - * - * @return Resource collection API of MixedSubscriptionPlacementSubscriptionResourceOperations. - */ - public MixedSubscriptionPlacementSubscriptionResourceOperations - mixedSubscriptionPlacementSubscriptionResourceOperations() { - if (this.mixedSubscriptionPlacementSubscriptionResourceOperations == null) { - this.mixedSubscriptionPlacementSubscriptionResourceOperations - = new MixedSubscriptionPlacementSubscriptionResourceOperationsImpl( - clientObject.getMixedSubscriptionPlacementSubscriptionResourceOperations(), this); - } - return mixedSubscriptionPlacementSubscriptionResourceOperations; - } - - /** - * Gets the resource collection API of MixedSubscriptionPlacementResourceGroupResourceOperations. It manages - * ResourceGroupResource. - * - * @return Resource collection API of MixedSubscriptionPlacementResourceGroupResourceOperations. - */ - public MixedSubscriptionPlacementResourceGroupResourceOperations - mixedSubscriptionPlacementResourceGroupResourceOperations() { - if (this.mixedSubscriptionPlacementResourceGroupResourceOperations == null) { - this.mixedSubscriptionPlacementResourceGroupResourceOperations - = new MixedSubscriptionPlacementResourceGroupResourceOperationsImpl( - clientObject.getMixedSubscriptionPlacementResourceGroupResourceOperations(), this); - } - return mixedSubscriptionPlacementResourceGroupResourceOperations; - } - - /** - * Gets the resource collection API of Operations. - * - * @return Resource collection API of Operations. - */ - public Operations operations() { - if (this.operations == null) { - this.operations = new OperationsImpl(clientObject.getOperations(), this); - } - return operations; - } - - /** - * Gets wrapped service client MethodSubscriptionIdClient providing direct access to the underlying auto-generated - * API implementation, based on Azure REST API. - * - * @return Wrapped service client MethodSubscriptionIdClient. - */ - public MethodSubscriptionIdClient serviceClient() { - return this.clientObject; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MethodSubscriptionIdClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MethodSubscriptionIdClient.java deleted file mode 100644 index ecec95c25a3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MethodSubscriptionIdClient.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for MethodSubscriptionIdClient class. - */ -public interface MethodSubscriptionIdClient { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient object to access its - * operations. - * - * @return the TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient object. - */ - TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient - getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations(); - - /** - * Gets the TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient object to access its - * operations. - * - * @return the TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient object. - */ - TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient - getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations(); - - /** - * Gets the MixedSubscriptionPlacementSubscriptionResourceOperationsClient object to access its operations. - * - * @return the MixedSubscriptionPlacementSubscriptionResourceOperationsClient object. - */ - MixedSubscriptionPlacementSubscriptionResourceOperationsClient - getMixedSubscriptionPlacementSubscriptionResourceOperations(); - - /** - * Gets the MixedSubscriptionPlacementResourceGroupResourceOperationsClient object to access its operations. - * - * @return the MixedSubscriptionPlacementResourceGroupResourceOperationsClient object. - */ - MixedSubscriptionPlacementResourceGroupResourceOperationsClient - getMixedSubscriptionPlacementResourceGroupResourceOperations(); - - /** - * Gets the OperationsClient object to access its operations. - * - * @return the OperationsClient object. - */ - OperationsClient getOperations(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementResourceGroupResourceOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementResourceGroupResourceOperationsClient.java deleted file mode 100644 index 1699d64abd9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementResourceGroupResourceOperationsClient.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.fluent; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * An instance of this class provides access to all the operations defined in - * MixedSubscriptionPlacementResourceGroupResourceOperationsClient. - */ -public interface MixedSubscriptionPlacementResourceGroupResourceOperationsClient { - /** - * Get a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ResourceGroupResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, - String resourceGroupResourceName, Context context); - - /** - * Get a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ResourceGroupResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ResourceGroupResourceInner getByResourceGroup(String resourceGroupName, String resourceGroupResourceName); - - /** - * Create a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response putWithResponse(String resourceGroupName, String resourceGroupResourceName, - ResourceGroupResourceInner resource, Context context); - - /** - * Create a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ResourceGroupResourceInner put(String resourceGroupName, String resourceGroupResourceName, - ResourceGroupResourceInner resource); - - /** - * Delete a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String resourceGroupName, String resourceGroupResourceName, Context context); - - /** - * Delete a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String resourceGroupResourceName); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementSubscriptionResourceOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementSubscriptionResourceOperationsClient.java deleted file mode 100644 index da9a757977d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementSubscriptionResourceOperationsClient.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.fluent; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * An instance of this class provides access to all the operations defined in - * MixedSubscriptionPlacementSubscriptionResourceOperationsClient. - */ -public interface MixedSubscriptionPlacementSubscriptionResourceOperationsClient { - /** - * Get a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String subscriptionId, String subscriptionResourceName, - Context context); - - /** - * Get a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SubscriptionResourceInner get(String subscriptionId, String subscriptionResourceName); - - /** - * Create a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response putWithResponse(String subscriptionId, String subscriptionResourceName, - SubscriptionResourceInner resource, Context context); - - /** - * Create a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SubscriptionResourceInner put(String subscriptionId, String subscriptionResourceName, - SubscriptionResourceInner resource); - - /** - * Delete a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String subscriptionId, String subscriptionResourceName, Context context); - - /** - * Delete a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String subscriptionId, String subscriptionResourceName); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/OperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/OperationsClient.java deleted file mode 100644 index ddb61e4cdad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/OperationsClient.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.fluent; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; - -/** - * An instance of this class provides access to all the operations defined in OperationsClient. - */ -public interface OperationsClient { - /** - * List the operations for the provider. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * List the operations for the provider. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.java deleted file mode 100644 index cb9210bba54..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.fluent; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * An instance of this class provides access to all the operations defined in - * TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient. - */ -public interface TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient { - /** - * Get a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource1 along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String subscriptionId, String subscriptionResource1Name, - Context context); - - /** - * Get a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource1. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SubscriptionResource1Inner get(String subscriptionId, String subscriptionResource1Name); - - /** - * Create a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response putWithResponse(String subscriptionId, String subscriptionResource1Name, - SubscriptionResource1Inner resource, Context context); - - /** - * Create a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SubscriptionResource1Inner put(String subscriptionId, String subscriptionResource1Name, - SubscriptionResource1Inner resource); - - /** - * Delete a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String subscriptionId, String subscriptionResource1Name, Context context); - - /** - * Delete a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String subscriptionId, String subscriptionResource1Name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.java deleted file mode 100644 index 3213076a3f6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.fluent; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * An instance of this class provides access to all the operations defined in - * TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient. - */ -public interface TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient { - /** - * Get a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource2 along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String subscriptionId, String subscriptionResource2Name, - Context context); - - /** - * Get a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource2. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SubscriptionResource2Inner get(String subscriptionId, String subscriptionResource2Name); - - /** - * Create a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response putWithResponse(String subscriptionId, String subscriptionResource2Name, - SubscriptionResource2Inner resource, Context context); - - /** - * Create a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SubscriptionResource2Inner put(String subscriptionId, String subscriptionResource2Name, - SubscriptionResource2Inner resource); - - /** - * Delete a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String subscriptionId, String subscriptionResource2Name, Context context); - - /** - * Delete a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String subscriptionId, String subscriptionResource2Name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/OperationInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/OperationInner.java deleted file mode 100644 index 484d3592976..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/OperationInner.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.fluent.models; - -import azure.resourcemanager.methodsubscriptionid.models.ActionType; -import azure.resourcemanager.methodsubscriptionid.models.OperationDisplay; -import azure.resourcemanager.methodsubscriptionid.models.Origin; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * REST API Operation - * - * Details of a REST API operation, returned from the Resource Provider Operations API. - */ -@Immutable -public final class OperationInner implements JsonSerializable { - /* - * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" - */ - private String name; - - /* - * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure - * Resource Manager/control-plane operations. - */ - private Boolean isDataAction; - - /* - * Localized display information for this particular operation. - */ - private OperationDisplay display; - - /* - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default - * value is "user,system" - */ - private Origin origin; - - /* - * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - */ - private ActionType actionType; - - /** - * Creates an instance of OperationInner class. - */ - private OperationInner() { - } - - /** - * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane - * operations and "false" for Azure Resource Manager/control-plane operations. - * - * @return the isDataAction value. - */ - public Boolean isDataAction() { - return this.isDataAction; - } - - /** - * Get the display property: Localized display information for this particular operation. - * - * @return the display value. - */ - public OperationDisplay display() { - return this.display; - } - - /** - * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and - * audit logs UX. Default value is "user,system". - * - * @return the origin value. - */ - public Origin origin() { - return this.origin; - } - - /** - * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are - * for internal only APIs. - * - * @return the actionType value. - */ - public ActionType actionType() { - return this.actionType; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("display", this.display); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the OperationInner. - */ - public static OperationInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationInner deserializedOperationInner = new OperationInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedOperationInner.name = reader.getString(); - } else if ("isDataAction".equals(fieldName)) { - deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); - } else if ("display".equals(fieldName)) { - deserializedOperationInner.display = OperationDisplay.fromJson(reader); - } else if ("origin".equals(fieldName)) { - deserializedOperationInner.origin = Origin.fromString(reader.getString()); - } else if ("actionType".equals(fieldName)) { - deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedOperationInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/ResourceGroupResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/ResourceGroupResourceInner.java deleted file mode 100644 index d30dcf45f33..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/ResourceGroupResourceInner.java +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.fluent.models; - -import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class ResourceGroupResourceInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private ResourceGroupResourceProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of ResourceGroupResourceInner class. - */ - public ResourceGroupResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public ResourceGroupResourceProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the ResourceGroupResourceInner object itself. - */ - public ResourceGroupResourceInner withProperties(ResourceGroupResourceProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public ResourceGroupResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ResourceGroupResourceInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourceGroupResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourceGroupResourceInner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResourceGroupResourceInner. - */ - public static ResourceGroupResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ResourceGroupResourceInner deserializedResourceGroupResourceInner = new ResourceGroupResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedResourceGroupResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedResourceGroupResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedResourceGroupResourceInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedResourceGroupResourceInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedResourceGroupResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedResourceGroupResourceInner.properties - = ResourceGroupResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedResourceGroupResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedResourceGroupResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource1Inner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource1Inner.java deleted file mode 100644 index d4ff171c1b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource1Inner.java +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.fluent.models; - -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Concrete proxy resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class SubscriptionResource1Inner extends ProxyResource { - /* - * The resource-specific properties for this resource. - */ - private SubscriptionResource1Properties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of SubscriptionResource1Inner class. - */ - public SubscriptionResource1Inner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public SubscriptionResource1Properties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the SubscriptionResource1Inner object itself. - */ - public SubscriptionResource1Inner withProperties(SubscriptionResource1Properties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubscriptionResource1Inner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubscriptionResource1Inner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SubscriptionResource1Inner. - */ - public static SubscriptionResource1Inner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SubscriptionResource1Inner deserializedSubscriptionResource1Inner = new SubscriptionResource1Inner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedSubscriptionResource1Inner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedSubscriptionResource1Inner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedSubscriptionResource1Inner.type = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedSubscriptionResource1Inner.properties - = SubscriptionResource1Properties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedSubscriptionResource1Inner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedSubscriptionResource1Inner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource2Inner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource2Inner.java deleted file mode 100644 index 8c78b74e127..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource2Inner.java +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.fluent.models; - -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Concrete proxy resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class SubscriptionResource2Inner extends ProxyResource { - /* - * The resource-specific properties for this resource. - */ - private SubscriptionResource2Properties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of SubscriptionResource2Inner class. - */ - public SubscriptionResource2Inner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public SubscriptionResource2Properties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the SubscriptionResource2Inner object itself. - */ - public SubscriptionResource2Inner withProperties(SubscriptionResource2Properties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubscriptionResource2Inner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubscriptionResource2Inner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SubscriptionResource2Inner. - */ - public static SubscriptionResource2Inner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SubscriptionResource2Inner deserializedSubscriptionResource2Inner = new SubscriptionResource2Inner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedSubscriptionResource2Inner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedSubscriptionResource2Inner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedSubscriptionResource2Inner.type = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedSubscriptionResource2Inner.properties - = SubscriptionResource2Properties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedSubscriptionResource2Inner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedSubscriptionResource2Inner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResourceInner.java deleted file mode 100644 index 5ce20b4ad59..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResourceInner.java +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.fluent.models; - -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Concrete proxy resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class SubscriptionResourceInner extends ProxyResource { - /* - * The resource-specific properties for this resource. - */ - private SubscriptionResourceProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of SubscriptionResourceInner class. - */ - public SubscriptionResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public SubscriptionResourceProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the SubscriptionResourceInner object itself. - */ - public SubscriptionResourceInner withProperties(SubscriptionResourceProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubscriptionResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubscriptionResourceInner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SubscriptionResourceInner. - */ - public static SubscriptionResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SubscriptionResourceInner deserializedSubscriptionResourceInner = new SubscriptionResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedSubscriptionResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedSubscriptionResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedSubscriptionResourceInner.type = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedSubscriptionResourceInner.properties = SubscriptionResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedSubscriptionResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedSubscriptionResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/package-info.java deleted file mode 100644 index da2168ece74..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the inner data models for MethodSubscriptionId. - * Test for ARM method level subscription ID parameter placement. - */ -package azure.resourcemanager.methodsubscriptionid.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/package-info.java deleted file mode 100644 index 0bbf2be71c7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the service clients for MethodSubscriptionId. - * Test for ARM method level subscription ID parameter placement. - */ -package azure.resourcemanager.methodsubscriptionid.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientBuilder.java deleted file mode 100644 index 6e61c5be387..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** - * A builder for creating a new instance of the MethodSubscriptionIdClientImpl type. - */ -@ServiceClientBuilder(serviceClients = { MethodSubscriptionIdClientImpl.class }) -public final class MethodSubscriptionIdClientBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the MethodSubscriptionIdClientBuilder. - */ - public MethodSubscriptionIdClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The ID of the target subscription. The value must be an UUID. - */ - private String subscriptionId; - - /** - * Sets The ID of the target subscription. The value must be an UUID. - * - * @param subscriptionId the subscriptionId value. - * @return the MethodSubscriptionIdClientBuilder. - */ - public MethodSubscriptionIdClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the MethodSubscriptionIdClientBuilder. - */ - public MethodSubscriptionIdClientBuilder environment(AzureEnvironment environment) { - this.environment = environment; - 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 MethodSubscriptionIdClientBuilder. - */ - public MethodSubscriptionIdClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the MethodSubscriptionIdClientBuilder. - */ - public MethodSubscriptionIdClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - 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 MethodSubscriptionIdClientBuilder. - */ - public MethodSubscriptionIdClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of MethodSubscriptionIdClientImpl with the provided parameters. - * - * @return an instance of MethodSubscriptionIdClientImpl. - */ - public MethodSubscriptionIdClientImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval - = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - MethodSubscriptionIdClientImpl client = new MethodSubscriptionIdClientImpl(localPipeline, - localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientImpl.java deleted file mode 100644 index f3206ee4a9a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientImpl.java +++ /dev/null @@ -1,382 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.MethodSubscriptionIdClient; -import azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.management.polling.SyncPollerFactory; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the MethodSubscriptionIdClientImpl type. - */ -@ServiceClient(builder = MethodSubscriptionIdClientBuilder.class) -public final class MethodSubscriptionIdClientImpl implements MethodSubscriptionIdClient { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Version parameter. - */ - private final String apiVersion; - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * The ID of the target subscription. The value must be an UUID. - */ - private final String subscriptionId; - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * 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. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient object to access its operations. - */ - private final TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations; - - /** - * Gets the TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient object to access its - * operations. - * - * @return the TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient object. - */ - public TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient - getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() { - return this.twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations; - } - - /** - * The TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient object to access its operations. - */ - private final TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations; - - /** - * Gets the TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient object to access its - * operations. - * - * @return the TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient object. - */ - public TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient - getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() { - return this.twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations; - } - - /** - * The MixedSubscriptionPlacementSubscriptionResourceOperationsClient object to access its operations. - */ - private final MixedSubscriptionPlacementSubscriptionResourceOperationsClient mixedSubscriptionPlacementSubscriptionResourceOperations; - - /** - * Gets the MixedSubscriptionPlacementSubscriptionResourceOperationsClient object to access its operations. - * - * @return the MixedSubscriptionPlacementSubscriptionResourceOperationsClient object. - */ - public MixedSubscriptionPlacementSubscriptionResourceOperationsClient - getMixedSubscriptionPlacementSubscriptionResourceOperations() { - return this.mixedSubscriptionPlacementSubscriptionResourceOperations; - } - - /** - * The MixedSubscriptionPlacementResourceGroupResourceOperationsClient object to access its operations. - */ - private final MixedSubscriptionPlacementResourceGroupResourceOperationsClient mixedSubscriptionPlacementResourceGroupResourceOperations; - - /** - * Gets the MixedSubscriptionPlacementResourceGroupResourceOperationsClient object to access its operations. - * - * @return the MixedSubscriptionPlacementResourceGroupResourceOperationsClient object. - */ - public MixedSubscriptionPlacementResourceGroupResourceOperationsClient - getMixedSubscriptionPlacementResourceGroupResourceOperations() { - return this.mixedSubscriptionPlacementResourceGroupResourceOperations; - } - - /** - * The OperationsClient object to access its operations. - */ - private final OperationsClient operations; - - /** - * Gets the OperationsClient object to access its operations. - * - * @return the OperationsClient object. - */ - public OperationsClient getOperations() { - return this.operations; - } - - /** - * Initializes an instance of MethodSubscriptionIdClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - MethodSubscriptionIdClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.apiVersion = "2023-12-01-preview"; - this.twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations - = new TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl(this); - this.twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations - = new TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl(this); - this.mixedSubscriptionPlacementSubscriptionResourceOperations - = new MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl(this); - this.mixedSubscriptionPlacementResourceGroupResourceOperations - = new MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl(this); - this.operations = new OperationsClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return SyncPoller for poll result and final result. - */ - public SyncPoller, U> getLroResult(Response activationResponse, - Type pollResultType, Type finalResultType, Context context) { - return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, () -> activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(MethodSubscriptionIdClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl.java deleted file mode 100644 index 095b76d32c5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl.java +++ /dev/null @@ -1,342 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in - * MixedSubscriptionPlacementResourceGroupResourceOperationsClient. - */ -public final class MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl - implements MixedSubscriptionPlacementResourceGroupResourceOperationsClient { - /** - * The proxy service used to perform REST calls. - */ - private final MixedSubscriptionPlacementResourceGroupResourceOperationsService service; - - /** - * The service client containing this operation class. - */ - private final MethodSubscriptionIdClientImpl client; - - /** - * Initializes an instance of MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl(MethodSubscriptionIdClientImpl client) { - this.service = RestProxy.create(MixedSubscriptionPlacementResourceGroupResourceOperationsService.class, - client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for - * MethodSubscriptionIdClientMixedSubscriptionPlacementResourceGroupResourceOperations to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MethodSubscriptionIdClientMixedSubscriptionPlacementResourceGroupResourceOperations") - public interface MixedSubscriptionPlacementResourceGroupResourceOperationsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/{resourceGroupResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceGroupResourceName") String resourceGroupResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/{resourceGroupResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceGroupResourceName") String resourceGroupResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/{resourceGroupResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceGroupResourceName") String resourceGroupResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ResourceGroupResourceInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/{resourceGroupResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response putSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceGroupResourceName") String resourceGroupResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ResourceGroupResourceInner resource, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/{resourceGroupResourceName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceGroupResourceName") String resourceGroupResourceName, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/{resourceGroupResourceName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceGroupResourceName") String resourceGroupResourceName, Context context); - } - - /** - * Get a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ResourceGroupResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String resourceGroupResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, resourceGroupResourceName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ResourceGroupResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, - String resourceGroupResourceName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, resourceGroupResourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ResourceGroupResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - String resourceGroupResourceName, Context context) { - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, resourceGroupResourceName, accept, context); - } - - /** - * Get a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ResourceGroupResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResourceGroupResourceInner getByResourceGroup(String resourceGroupName, String resourceGroupResourceName) { - return getByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, Context.NONE).getValue(); - } - - /** - * Create a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> putWithResponseAsync(String resourceGroupName, - String resourceGroupResourceName, ResourceGroupResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, resourceGroupResourceName, contentType, accept, - resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putAsync(String resourceGroupName, String resourceGroupResourceName, - ResourceGroupResourceInner resource) { - return putWithResponseAsync(resourceGroupName, resourceGroupResourceName, resource) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Create a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(String resourceGroupName, - String resourceGroupResourceName, ResourceGroupResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, resourceGroupResourceName, contentType, accept, resource, context); - } - - /** - * Create a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ResourceGroupResourceInner put(String resourceGroupName, String resourceGroupResourceName, - ResourceGroupResourceInner resource) { - return putWithResponse(resourceGroupName, resourceGroupResourceName, resource, Context.NONE).getValue(); - } - - /** - * Delete a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String resourceGroupResourceName) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, resourceGroupResourceName, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String resourceGroupResourceName) { - return deleteWithResponseAsync(resourceGroupName, resourceGroupResourceName).flatMap(ignored -> Mono.empty()); - } - - /** - * Delete a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceGroupName, String resourceGroupResourceName, - Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, resourceGroupResourceName, context); - } - - /** - * Delete a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String resourceGroupResourceName) { - deleteWithResponse(resourceGroupName, resourceGroupResourceName, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsImpl.java deleted file mode 100644 index e4c7ef18e1c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsImpl.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner; -import azure.resourcemanager.methodsubscriptionid.models.MixedSubscriptionPlacementResourceGroupResourceOperations; -import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResource; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class MixedSubscriptionPlacementResourceGroupResourceOperationsImpl - implements MixedSubscriptionPlacementResourceGroupResourceOperations { - private static final ClientLogger LOGGER - = new ClientLogger(MixedSubscriptionPlacementResourceGroupResourceOperationsImpl.class); - - private final MixedSubscriptionPlacementResourceGroupResourceOperationsClient innerClient; - - private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; - - public MixedSubscriptionPlacementResourceGroupResourceOperationsImpl( - MixedSubscriptionPlacementResourceGroupResourceOperationsClient innerClient, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, - String resourceGroupResourceName, Context context) { - Response inner = this.serviceClient() - .getByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ResourceGroupResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public ResourceGroupResource getByResourceGroup(String resourceGroupName, String resourceGroupResourceName) { - ResourceGroupResourceInner inner - = this.serviceClient().getByResourceGroup(resourceGroupName, resourceGroupResourceName); - if (inner != null) { - return new ResourceGroupResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteByResourceGroupWithResponse(String resourceGroupName, String resourceGroupResourceName, - Context context) { - return this.serviceClient().deleteWithResponse(resourceGroupName, resourceGroupResourceName, context); - } - - public void deleteByResourceGroup(String resourceGroupName, String resourceGroupResourceName) { - this.serviceClient().delete(resourceGroupName, resourceGroupResourceName); - } - - public ResourceGroupResource getById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String resourceGroupResourceName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroupResources"); - if (resourceGroupResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroupResources'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, Context.NONE) - .getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String resourceGroupResourceName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroupResources"); - if (resourceGroupResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroupResources'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, context); - } - - public void deleteById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String resourceGroupResourceName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroupResources"); - if (resourceGroupResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroupResources'.", id))); - } - this.deleteByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, Context.NONE); - } - - public Response deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String resourceGroupResourceName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroupResources"); - if (resourceGroupResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroupResources'.", id))); - } - return this.deleteByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, context); - } - - private MixedSubscriptionPlacementResourceGroupResourceOperationsClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { - return this.serviceManager; - } - - public ResourceGroupResourceImpl define(String name) { - return new ResourceGroupResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl.java deleted file mode 100644 index ffae5de029a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl.java +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in - * MixedSubscriptionPlacementSubscriptionResourceOperationsClient. - */ -public final class MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl - implements MixedSubscriptionPlacementSubscriptionResourceOperationsClient { - /** - * The proxy service used to perform REST calls. - */ - private final MixedSubscriptionPlacementSubscriptionResourceOperationsService service; - - /** - * The service client containing this operation class. - */ - private final MethodSubscriptionIdClientImpl client; - - /** - * Initializes an instance of MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl(MethodSubscriptionIdClientImpl client) { - this.service = RestProxy.create(MixedSubscriptionPlacementSubscriptionResourceOperationsService.class, - client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for - * MethodSubscriptionIdClientMixedSubscriptionPlacementSubscriptionResourceOperations to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MethodSubscriptionIdClientMixedSubscriptionPlacementSubscriptionResourceOperations") - public interface MixedSubscriptionPlacementSubscriptionResourceOperationsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/{subscriptionResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResourceName") String subscriptionResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/{subscriptionResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResourceName") String subscriptionResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/{subscriptionResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResourceName") String subscriptionResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") SubscriptionResourceInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/{subscriptionResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response putSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResourceName") String subscriptionResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") SubscriptionResourceInner resource, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/{subscriptionResourceName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResourceName") String subscriptionResourceName, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/{subscriptionResourceName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResourceName") String subscriptionResourceName, Context context); - } - - /** - * Get a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String subscriptionId, - String subscriptionResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResourceName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String subscriptionId, String subscriptionResourceName) { - return getWithResponseAsync(subscriptionId, subscriptionResourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String subscriptionId, String subscriptionResourceName, - Context context) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResourceName, accept, context); - } - - /** - * Get a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SubscriptionResourceInner get(String subscriptionId, String subscriptionResourceName) { - return getWithResponse(subscriptionId, subscriptionResourceName, Context.NONE).getValue(); - } - - /** - * Create a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> putWithResponseAsync(String subscriptionId, - String subscriptionResourceName, SubscriptionResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResourceName, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putAsync(String subscriptionId, String subscriptionResourceName, - SubscriptionResourceInner resource) { - return putWithResponseAsync(subscriptionId, subscriptionResourceName, resource) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Create a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(String subscriptionId, String subscriptionResourceName, - SubscriptionResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResourceName, contentType, accept, resource, context); - } - - /** - * Create a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SubscriptionResourceInner put(String subscriptionId, String subscriptionResourceName, - SubscriptionResourceInner resource) { - return putWithResponse(subscriptionId, subscriptionResourceName, resource, Context.NONE).getValue(); - } - - /** - * Delete a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String subscriptionId, String subscriptionResourceName) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - subscriptionId, subscriptionResourceName, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String subscriptionId, String subscriptionResourceName) { - return deleteWithResponseAsync(subscriptionId, subscriptionResourceName).flatMap(ignored -> Mono.empty()); - } - - /** - * Delete a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String subscriptionId, String subscriptionResourceName, Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResourceName, context); - } - - /** - * Delete a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String subscriptionId, String subscriptionResourceName) { - deleteWithResponse(subscriptionId, subscriptionResourceName, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsImpl.java deleted file mode 100644 index d16d4186aff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; -import azure.resourcemanager.methodsubscriptionid.models.MixedSubscriptionPlacementSubscriptionResourceOperations; -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class MixedSubscriptionPlacementSubscriptionResourceOperationsImpl - implements MixedSubscriptionPlacementSubscriptionResourceOperations { - private static final ClientLogger LOGGER - = new ClientLogger(MixedSubscriptionPlacementSubscriptionResourceOperationsImpl.class); - - private final MixedSubscriptionPlacementSubscriptionResourceOperationsClient innerClient; - - private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; - - public MixedSubscriptionPlacementSubscriptionResourceOperationsImpl( - MixedSubscriptionPlacementSubscriptionResourceOperationsClient innerClient, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getWithResponse(String subscriptionId, String subscriptionResourceName, - Context context) { - Response inner - = this.serviceClient().getWithResponse(subscriptionId, subscriptionResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SubscriptionResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public SubscriptionResource get(String subscriptionId, String subscriptionResourceName) { - SubscriptionResourceInner inner = this.serviceClient().get(subscriptionId, subscriptionResourceName); - if (inner != null) { - return new SubscriptionResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteByResourceGroupWithResponse(String subscriptionId, String subscriptionResourceName, - Context context) { - return this.serviceClient().deleteWithResponse(subscriptionId, subscriptionResourceName, context); - } - - public void deleteByResourceGroup(String subscriptionId, String subscriptionResourceName) { - this.serviceClient().delete(subscriptionId, subscriptionResourceName); - } - - public SubscriptionResource getById(String id) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String subscriptionResourceName = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResources"); - if (subscriptionResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResources'.", id))); - } - return this.getWithResponse(subscriptionId, subscriptionResourceName, Context.NONE).getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String subscriptionResourceName = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResources"); - if (subscriptionResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResources'.", id))); - } - return this.getWithResponse(subscriptionId, subscriptionResourceName, context); - } - - public void deleteById(String id) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String subscriptionResourceName = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResources"); - if (subscriptionResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResources'.", id))); - } - this.deleteByResourceGroupWithResponse(subscriptionId, subscriptionResourceName, Context.NONE); - } - - public Response deleteByIdWithResponse(String id, Context context) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String subscriptionResourceName = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResources"); - if (subscriptionResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResources'.", id))); - } - return this.deleteByResourceGroupWithResponse(subscriptionId, subscriptionResourceName, context); - } - - private MixedSubscriptionPlacementSubscriptionResourceOperationsClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { - return this.serviceManager; - } - - public SubscriptionResourceImpl define(String name) { - return new SubscriptionResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationImpl.java deleted file mode 100644 index 70044ef003e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; -import azure.resourcemanager.methodsubscriptionid.models.ActionType; -import azure.resourcemanager.methodsubscriptionid.models.Operation; -import azure.resourcemanager.methodsubscriptionid.models.OperationDisplay; -import azure.resourcemanager.methodsubscriptionid.models.Origin; - -public final class OperationImpl implements Operation { - private OperationInner innerObject; - - private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; - - OperationImpl(OperationInner innerObject, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String name() { - return this.innerModel().name(); - } - - public Boolean isDataAction() { - return this.innerModel().isDataAction(); - } - - public OperationDisplay display() { - return this.innerModel().display(); - } - - public Origin origin() { - return this.innerModel().origin(); - } - - public ActionType actionType() { - return this.innerModel().actionType(); - } - - public OperationInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsClientImpl.java deleted file mode 100644 index bf16ce45edc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsClientImpl.java +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; -import azure.resourcemanager.methodsubscriptionid.implementation.models.OperationListResult; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -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.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in OperationsClient. - */ -public final class OperationsClientImpl implements OperationsClient { - /** - * The proxy service used to perform REST calls. - */ - private final OperationsService service; - - /** - * The service client containing this operation class. - */ - private final MethodSubscriptionIdClientImpl client; - - /** - * Initializes an instance of OperationsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - OperationsClientImpl(MethodSubscriptionIdClientImpl client) { - this.service - = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for MethodSubscriptionIdClientOperations to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MethodSubscriptionIdClientOperations") - public interface OperationsService { - @Headers({ "Content-Type: application/json" }) - @Get("/providers/Azure.ResourceManager.MethodSubscriptionId/operations") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/providers/Azure.ResourceManager.MethodSubscriptionId/operations") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); - } - - /** - * List the operations for the provider. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List the operations for the provider. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * List the operations for the provider. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage() { - final String accept = "application/json"; - Response res - = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List the operations for the provider. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(Context context) { - final String accept = "application/json"; - Response res - = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List the operations for the provider. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); - } - - /** - * List the operations for the provider. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listNextSinglePage(String nextLink, Context context) { - final String accept = "application/json"; - Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsImpl.java deleted file mode 100644 index c6c55ba2cd1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; -import azure.resourcemanager.methodsubscriptionid.models.Operation; -import azure.resourcemanager.methodsubscriptionid.models.Operations; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class OperationsImpl implements Operations { - private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); - - private final OperationsClient innerClient; - - private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; - - public OperationsImpl(OperationsClient innerClient, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); - } - - private OperationsClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceGroupResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceGroupResourceImpl.java deleted file mode 100644 index 6f6407891d1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceGroupResourceImpl.java +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner; -import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResource; -import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Collections; -import java.util.Map; - -public final class ResourceGroupResourceImpl - implements ResourceGroupResource, ResourceGroupResource.Definition, ResourceGroupResource.Update { - private ResourceGroupResourceInner innerObject; - - private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public ResourceGroupResourceProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public String resourceGroupName() { - return resourceGroupName; - } - - public ResourceGroupResourceInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { - return this.serviceManager; - } - - private String resourceGroupName; - - private String resourceGroupResourceName; - - public ResourceGroupResourceImpl withExistingResourceGroup(String resourceGroupName) { - this.resourceGroupName = resourceGroupName; - return this; - } - - public ResourceGroupResource create() { - this.innerObject = serviceManager.serviceClient() - .getMixedSubscriptionPlacementResourceGroupResourceOperations() - .putWithResponse(resourceGroupName, resourceGroupResourceName, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public ResourceGroupResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getMixedSubscriptionPlacementResourceGroupResourceOperations() - .putWithResponse(resourceGroupName, resourceGroupResourceName, this.innerModel(), context) - .getValue(); - return this; - } - - ResourceGroupResourceImpl(String name, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerObject = new ResourceGroupResourceInner(); - this.serviceManager = serviceManager; - this.resourceGroupResourceName = name; - } - - public ResourceGroupResourceImpl update() { - return this; - } - - public ResourceGroupResource apply() { - this.innerObject = serviceManager.serviceClient() - .getMixedSubscriptionPlacementResourceGroupResourceOperations() - .putWithResponse(resourceGroupName, resourceGroupResourceName, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public ResourceGroupResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getMixedSubscriptionPlacementResourceGroupResourceOperations() - .putWithResponse(resourceGroupName, resourceGroupResourceName, this.innerModel(), context) - .getValue(); - return this; - } - - ResourceGroupResourceImpl(ResourceGroupResourceInner innerObject, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.resourceGroupResourceName - = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroupResources"); - } - - public ResourceGroupResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getMixedSubscriptionPlacementResourceGroupResourceOperations() - .getByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, Context.NONE) - .getValue(); - return this; - } - - public ResourceGroupResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getMixedSubscriptionPlacementResourceGroupResourceOperations() - .getByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, context) - .getValue(); - return this; - } - - public ResourceGroupResourceImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); - return this; - } - - public ResourceGroupResourceImpl withRegion(String location) { - this.innerModel().withLocation(location); - return this; - } - - public ResourceGroupResourceImpl withTags(Map tags) { - this.innerModel().withTags(tags); - return this; - } - - public ResourceGroupResourceImpl withProperties(ResourceGroupResourceProperties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceManagerUtils.java deleted file mode 100644 index 159e5bc85f4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceManagerUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -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.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class ResourceManagerUtils { - private ResourceManagerUtils() { - } - - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (!segments.isEmpty() && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl<>(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux - .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(iterable.iterator(), mapper); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource1Impl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource1Impl.java deleted file mode 100644 index 79a3f61408f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource1Impl.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1; -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; - -public final class SubscriptionResource1Impl - implements SubscriptionResource1, SubscriptionResource1.Definition, SubscriptionResource1.Update { - private SubscriptionResource1Inner innerObject; - - private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public SubscriptionResource1Properties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public SubscriptionResource1Inner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { - return this.serviceManager; - } - - private String subscriptionId; - - private String subscriptionResource1Name; - - public SubscriptionResource1 create() { - this.innerObject = serviceManager.serviceClient() - .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() - .putWithResponse(subscriptionId, subscriptionResource1Name, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public SubscriptionResource1 create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() - .putWithResponse(subscriptionId, subscriptionResource1Name, this.innerModel(), context) - .getValue(); - return this; - } - - SubscriptionResource1Impl(String name, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerObject = new SubscriptionResource1Inner(); - this.serviceManager = serviceManager; - this.subscriptionResource1Name = name; - } - - public SubscriptionResource1Impl update() { - return this; - } - - public SubscriptionResource1 apply() { - this.innerObject = serviceManager.serviceClient() - .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() - .putWithResponse(subscriptionId, subscriptionResource1Name, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public SubscriptionResource1 apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() - .putWithResponse(subscriptionId, subscriptionResource1Name, this.innerModel(), context) - .getValue(); - return this; - } - - SubscriptionResource1Impl(SubscriptionResource1Inner innerObject, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.subscriptionId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptions"); - this.subscriptionResource1Name - = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptionResource1s"); - } - - public SubscriptionResource1 refresh() { - this.innerObject = serviceManager.serviceClient() - .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() - .getWithResponse(subscriptionId, subscriptionResource1Name, Context.NONE) - .getValue(); - return this; - } - - public SubscriptionResource1 refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() - .getWithResponse(subscriptionId, subscriptionResource1Name, context) - .getValue(); - return this; - } - - public SubscriptionResource1Impl withProperties(SubscriptionResource1Properties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource2Impl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource2Impl.java deleted file mode 100644 index b1c2899d766..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource2Impl.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2; -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; - -public final class SubscriptionResource2Impl - implements SubscriptionResource2, SubscriptionResource2.Definition, SubscriptionResource2.Update { - private SubscriptionResource2Inner innerObject; - - private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public SubscriptionResource2Properties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public SubscriptionResource2Inner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { - return this.serviceManager; - } - - private String subscriptionId; - - private String subscriptionResource2Name; - - public SubscriptionResource2 create() { - this.innerObject = serviceManager.serviceClient() - .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() - .putWithResponse(subscriptionId, subscriptionResource2Name, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public SubscriptionResource2 create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() - .putWithResponse(subscriptionId, subscriptionResource2Name, this.innerModel(), context) - .getValue(); - return this; - } - - SubscriptionResource2Impl(String name, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerObject = new SubscriptionResource2Inner(); - this.serviceManager = serviceManager; - this.subscriptionResource2Name = name; - } - - public SubscriptionResource2Impl update() { - return this; - } - - public SubscriptionResource2 apply() { - this.innerObject = serviceManager.serviceClient() - .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() - .putWithResponse(subscriptionId, subscriptionResource2Name, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public SubscriptionResource2 apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() - .putWithResponse(subscriptionId, subscriptionResource2Name, this.innerModel(), context) - .getValue(); - return this; - } - - SubscriptionResource2Impl(SubscriptionResource2Inner innerObject, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.subscriptionId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptions"); - this.subscriptionResource2Name - = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptionResource2s"); - } - - public SubscriptionResource2 refresh() { - this.innerObject = serviceManager.serviceClient() - .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() - .getWithResponse(subscriptionId, subscriptionResource2Name, Context.NONE) - .getValue(); - return this; - } - - public SubscriptionResource2 refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() - .getWithResponse(subscriptionId, subscriptionResource2Name, context) - .getValue(); - return this; - } - - public SubscriptionResource2Impl withProperties(SubscriptionResource2Properties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResourceImpl.java deleted file mode 100644 index f5a7fd1b81a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResourceImpl.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource; -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; - -public final class SubscriptionResourceImpl - implements SubscriptionResource, SubscriptionResource.Definition, SubscriptionResource.Update { - private SubscriptionResourceInner innerObject; - - private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public SubscriptionResourceProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public SubscriptionResourceInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { - return this.serviceManager; - } - - private String subscriptionId; - - private String subscriptionResourceName; - - public SubscriptionResource create() { - this.innerObject = serviceManager.serviceClient() - .getMixedSubscriptionPlacementSubscriptionResourceOperations() - .putWithResponse(subscriptionId, subscriptionResourceName, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public SubscriptionResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getMixedSubscriptionPlacementSubscriptionResourceOperations() - .putWithResponse(subscriptionId, subscriptionResourceName, this.innerModel(), context) - .getValue(); - return this; - } - - SubscriptionResourceImpl(String name, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerObject = new SubscriptionResourceInner(); - this.serviceManager = serviceManager; - this.subscriptionResourceName = name; - } - - public SubscriptionResourceImpl update() { - return this; - } - - public SubscriptionResource apply() { - this.innerObject = serviceManager.serviceClient() - .getMixedSubscriptionPlacementSubscriptionResourceOperations() - .putWithResponse(subscriptionId, subscriptionResourceName, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public SubscriptionResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getMixedSubscriptionPlacementSubscriptionResourceOperations() - .putWithResponse(subscriptionId, subscriptionResourceName, this.innerModel(), context) - .getValue(); - return this; - } - - SubscriptionResourceImpl(SubscriptionResourceInner innerObject, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.subscriptionId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptions"); - this.subscriptionResourceName - = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptionResources"); - } - - public SubscriptionResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getMixedSubscriptionPlacementSubscriptionResourceOperations() - .getWithResponse(subscriptionId, subscriptionResourceName, Context.NONE) - .getValue(); - return this; - } - - public SubscriptionResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getMixedSubscriptionPlacementSubscriptionResourceOperations() - .getWithResponse(subscriptionId, subscriptionResourceName, context) - .getValue(); - return this; - } - - public SubscriptionResourceImpl withProperties(SubscriptionResourceProperties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl.java deleted file mode 100644 index 87dcdc74982..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl.java +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in - * TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient. - */ -public final class TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl - implements TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient { - /** - * The proxy service used to perform REST calls. - */ - private final TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsService service; - - /** - * The service client containing this operation class. - */ - private final MethodSubscriptionIdClientImpl client; - - /** - * Initializes an instance of TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl( - MethodSubscriptionIdClientImpl client) { - this.service = RestProxy.create(TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsService.class, - client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for - * MethodSubscriptionIdClientTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface( - name = "MethodSubscriptionIdClientTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations") - public interface TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/{subscriptionResource1Name}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResource1Name") String subscriptionResource1Name, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/{subscriptionResource1Name}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResource1Name") String subscriptionResource1Name, - @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/{subscriptionResource1Name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResource1Name") String subscriptionResource1Name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") SubscriptionResource1Inner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/{subscriptionResource1Name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response putSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResource1Name") String subscriptionResource1Name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") SubscriptionResource1Inner resource, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/{subscriptionResource1Name}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResource1Name") String subscriptionResource1Name, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/{subscriptionResource1Name}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResource1Name") String subscriptionResource1Name, Context context); - } - - /** - * Get a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource1 along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String subscriptionId, - String subscriptionResource1Name) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResource1Name, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource1 on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String subscriptionId, String subscriptionResource1Name) { - return getWithResponseAsync(subscriptionId, subscriptionResource1Name) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource1 along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String subscriptionId, String subscriptionResource1Name, - Context context) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResource1Name, accept, context); - } - - /** - * Get a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource1. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SubscriptionResource1Inner get(String subscriptionId, String subscriptionResource1Name) { - return getWithResponse(subscriptionId, subscriptionResource1Name, Context.NONE).getValue(); - } - - /** - * Create a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> putWithResponseAsync(String subscriptionId, - String subscriptionResource1Name, SubscriptionResource1Inner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResource1Name, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putAsync(String subscriptionId, String subscriptionResource1Name, - SubscriptionResource1Inner resource) { - return putWithResponseAsync(subscriptionId, subscriptionResource1Name, resource) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Create a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(String subscriptionId, String subscriptionResource1Name, - SubscriptionResource1Inner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResource1Name, contentType, accept, resource, context); - } - - /** - * Create a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SubscriptionResource1Inner put(String subscriptionId, String subscriptionResource1Name, - SubscriptionResource1Inner resource) { - return putWithResponse(subscriptionId, subscriptionResource1Name, resource, Context.NONE).getValue(); - } - - /** - * Delete a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String subscriptionId, String subscriptionResource1Name) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - subscriptionId, subscriptionResource1Name, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String subscriptionId, String subscriptionResource1Name) { - return deleteWithResponseAsync(subscriptionId, subscriptionResource1Name).flatMap(ignored -> Mono.empty()); - } - - /** - * Delete a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String subscriptionId, String subscriptionResource1Name, Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResource1Name, context); - } - - /** - * Delete a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String subscriptionId, String subscriptionResource1Name) { - deleteWithResponse(subscriptionId, subscriptionResource1Name, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl.java deleted file mode 100644 index 86e2607d924..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1; -import azure.resourcemanager.methodsubscriptionid.models.TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl - implements TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations { - private static final ClientLogger LOGGER - = new ClientLogger(TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl.class); - - private final TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient innerClient; - - private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; - - public TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl( - TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient innerClient, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getWithResponse(String subscriptionId, String subscriptionResource1Name, - Context context) { - Response inner - = this.serviceClient().getWithResponse(subscriptionId, subscriptionResource1Name, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SubscriptionResource1Impl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public SubscriptionResource1 get(String subscriptionId, String subscriptionResource1Name) { - SubscriptionResource1Inner inner = this.serviceClient().get(subscriptionId, subscriptionResource1Name); - if (inner != null) { - return new SubscriptionResource1Impl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteByResourceGroupWithResponse(String subscriptionId, String subscriptionResource1Name, - Context context) { - return this.serviceClient().deleteWithResponse(subscriptionId, subscriptionResource1Name, context); - } - - public void deleteByResourceGroup(String subscriptionId, String subscriptionResource1Name) { - this.serviceClient().delete(subscriptionId, subscriptionResource1Name); - } - - public SubscriptionResource1 getById(String id) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String subscriptionResource1Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource1s"); - if (subscriptionResource1Name == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource1s'.", id))); - } - return this.getWithResponse(subscriptionId, subscriptionResource1Name, Context.NONE).getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String subscriptionResource1Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource1s"); - if (subscriptionResource1Name == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource1s'.", id))); - } - return this.getWithResponse(subscriptionId, subscriptionResource1Name, context); - } - - public void deleteById(String id) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String subscriptionResource1Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource1s"); - if (subscriptionResource1Name == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource1s'.", id))); - } - this.deleteByResourceGroupWithResponse(subscriptionId, subscriptionResource1Name, Context.NONE); - } - - public Response deleteByIdWithResponse(String id, Context context) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String subscriptionResource1Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource1s"); - if (subscriptionResource1Name == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource1s'.", id))); - } - return this.deleteByResourceGroupWithResponse(subscriptionId, subscriptionResource1Name, context); - } - - private TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { - return this.serviceManager; - } - - public SubscriptionResource1Impl define(String name) { - return new SubscriptionResource1Impl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl.java deleted file mode 100644 index f492a9a9a90..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl.java +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in - * TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient. - */ -public final class TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl - implements TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient { - /** - * The proxy service used to perform REST calls. - */ - private final TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsService service; - - /** - * The service client containing this operation class. - */ - private final MethodSubscriptionIdClientImpl client; - - /** - * Initializes an instance of TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl( - MethodSubscriptionIdClientImpl client) { - this.service = RestProxy.create(TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsService.class, - client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for - * MethodSubscriptionIdClientTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface( - name = "MethodSubscriptionIdClientTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations") - public interface TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/{subscriptionResource2Name}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResource2Name") String subscriptionResource2Name, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/{subscriptionResource2Name}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResource2Name") String subscriptionResource2Name, - @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/{subscriptionResource2Name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResource2Name") String subscriptionResource2Name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") SubscriptionResource2Inner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/{subscriptionResource2Name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response putSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResource2Name") String subscriptionResource2Name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") SubscriptionResource2Inner resource, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/{subscriptionResource2Name}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResource2Name") String subscriptionResource2Name, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/{subscriptionResource2Name}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("subscriptionResource2Name") String subscriptionResource2Name, Context context); - } - - /** - * Get a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource2 along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String subscriptionId, - String subscriptionResource2Name) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResource2Name, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource2 on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String subscriptionId, String subscriptionResource2Name) { - return getWithResponseAsync(subscriptionId, subscriptionResource2Name) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource2 along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String subscriptionId, String subscriptionResource2Name, - Context context) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResource2Name, accept, context); - } - - /** - * Get a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource2. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SubscriptionResource2Inner get(String subscriptionId, String subscriptionResource2Name) { - return getWithResponse(subscriptionId, subscriptionResource2Name, Context.NONE).getValue(); - } - - /** - * Create a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> putWithResponseAsync(String subscriptionId, - String subscriptionResource2Name, SubscriptionResource2Inner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResource2Name, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putAsync(String subscriptionId, String subscriptionResource2Name, - SubscriptionResource2Inner resource) { - return putWithResponseAsync(subscriptionId, subscriptionResource2Name, resource) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Create a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(String subscriptionId, String subscriptionResource2Name, - SubscriptionResource2Inner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResource2Name, contentType, accept, resource, context); - } - - /** - * Create a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SubscriptionResource2Inner put(String subscriptionId, String subscriptionResource2Name, - SubscriptionResource2Inner resource) { - return putWithResponse(subscriptionId, subscriptionResource2Name, resource, Context.NONE).getValue(); - } - - /** - * Delete a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String subscriptionId, String subscriptionResource2Name) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - subscriptionId, subscriptionResource2Name, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String subscriptionId, String subscriptionResource2Name) { - return deleteWithResponseAsync(subscriptionId, subscriptionResource2Name).flatMap(ignored -> Mono.empty()); - } - - /** - * Delete a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String subscriptionId, String subscriptionResource2Name, Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, - subscriptionResource2Name, context); - } - - /** - * Delete a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String subscriptionId, String subscriptionResource2Name) { - deleteWithResponse(subscriptionId, subscriptionResource2Name, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl.java deleted file mode 100644 index 53407392904..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation; - -import azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient; -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2; -import azure.resourcemanager.methodsubscriptionid.models.TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl - implements TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations { - private static final ClientLogger LOGGER - = new ClientLogger(TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl.class); - - private final TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient innerClient; - - private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; - - public TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl( - TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient innerClient, - azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getWithResponse(String subscriptionId, String subscriptionResource2Name, - Context context) { - Response inner - = this.serviceClient().getWithResponse(subscriptionId, subscriptionResource2Name, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SubscriptionResource2Impl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public SubscriptionResource2 get(String subscriptionId, String subscriptionResource2Name) { - SubscriptionResource2Inner inner = this.serviceClient().get(subscriptionId, subscriptionResource2Name); - if (inner != null) { - return new SubscriptionResource2Impl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteByResourceGroupWithResponse(String subscriptionId, String subscriptionResource2Name, - Context context) { - return this.serviceClient().deleteWithResponse(subscriptionId, subscriptionResource2Name, context); - } - - public void deleteByResourceGroup(String subscriptionId, String subscriptionResource2Name) { - this.serviceClient().delete(subscriptionId, subscriptionResource2Name); - } - - public SubscriptionResource2 getById(String id) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String subscriptionResource2Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource2s"); - if (subscriptionResource2Name == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource2s'.", id))); - } - return this.getWithResponse(subscriptionId, subscriptionResource2Name, Context.NONE).getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String subscriptionResource2Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource2s"); - if (subscriptionResource2Name == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource2s'.", id))); - } - return this.getWithResponse(subscriptionId, subscriptionResource2Name, context); - } - - public void deleteById(String id) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String subscriptionResource2Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource2s"); - if (subscriptionResource2Name == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource2s'.", id))); - } - this.deleteByResourceGroupWithResponse(subscriptionId, subscriptionResource2Name, Context.NONE); - } - - public Response deleteByIdWithResponse(String id, Context context) { - String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); - if (subscriptionId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); - } - String subscriptionResource2Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource2s"); - if (subscriptionResource2Name == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource2s'.", id))); - } - return this.deleteByResourceGroupWithResponse(subscriptionId, subscriptionResource2Name, context); - } - - private TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { - return this.serviceManager; - } - - public SubscriptionResource2Impl define(String name) { - return new SubscriptionResource2Impl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/models/OperationListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/models/OperationListResult.java deleted file mode 100644 index 93b37969e00..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/models/OperationListResult.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.implementation.models; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of - * results. - */ -@Immutable -public final class OperationListResult implements JsonSerializable { - /* - * The Operation items on this page - */ - private List value; - - /* - * The link to the next page of items - */ - private String nextLink; - - /** - * Creates an instance of OperationListResult class. - */ - private OperationListResult() { - } - - /** - * Get the value property: The Operation items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OperationListResult. - */ - public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationListResult deserializedOperationListResult = new OperationListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); - deserializedOperationListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedOperationListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOperationListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/package-info.java deleted file mode 100644 index ea20becfb7a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the implementations for MethodSubscriptionId. - * Test for ARM method level subscription ID parameter placement. - */ -package azure.resourcemanager.methodsubscriptionid.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ActionType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ActionType.java deleted file mode 100644 index dc30ca05366..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ActionType.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - */ -public final class ActionType extends ExpandableStringEnum { - /** - * Actions are for internal-only APIs. - */ - public static final ActionType INTERNAL = fromString("Internal"); - - /** - * Creates a new instance of ActionType value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ActionType() { - } - - /** - * Creates or finds a ActionType from its string representation. - * - * @param name a name to look for. - * @return the corresponding ActionType. - */ - public static ActionType fromString(String name) { - return fromString(name, ActionType.class); - } - - /** - * Gets known ActionType values. - * - * @return known ActionType values. - */ - public static Collection values() { - return values(ActionType.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementResourceGroupResourceOperations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementResourceGroupResourceOperations.java deleted file mode 100644 index fe0cec369c1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementResourceGroupResourceOperations.java +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of MixedSubscriptionPlacementResourceGroupResourceOperations. - */ -public interface MixedSubscriptionPlacementResourceGroupResourceOperations { - /** - * Get a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ResourceGroupResource along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, - String resourceGroupResourceName, Context context); - - /** - * Get a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ResourceGroupResource. - */ - ResourceGroupResource getByResourceGroup(String resourceGroupName, String resourceGroupResourceName); - - /** - * Delete a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByResourceGroupWithResponse(String resourceGroupName, String resourceGroupResourceName, - Context context); - - /** - * Delete a ResourceGroupResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceGroupResourceName The name of the ResourceGroupResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String resourceGroupName, String resourceGroupResourceName); - - /** - * Get a ResourceGroupResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ResourceGroupResource along with {@link Response}. - */ - ResourceGroupResource getById(String id); - - /** - * Get a ResourceGroupResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ResourceGroupResource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Delete a ResourceGroupResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a ResourceGroupResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new ResourceGroupResource resource. - * - * @param name resource name. - * @return the first stage of the new ResourceGroupResource definition. - */ - ResourceGroupResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementSubscriptionResourceOperations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementSubscriptionResourceOperations.java deleted file mode 100644 index a694d5353f1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementSubscriptionResourceOperations.java +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of MixedSubscriptionPlacementSubscriptionResourceOperations. - */ -public interface MixedSubscriptionPlacementSubscriptionResourceOperations { - /** - * Get a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource along with {@link Response}. - */ - Response getWithResponse(String subscriptionId, String subscriptionResourceName, - Context context); - - /** - * Get a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource. - */ - SubscriptionResource get(String subscriptionId, String subscriptionResourceName); - - /** - * Delete a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByResourceGroupWithResponse(String subscriptionId, String subscriptionResourceName, - Context context); - - /** - * Delete a SubscriptionResource. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResourceName The name of the SubscriptionResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String subscriptionId, String subscriptionResourceName); - - /** - * Get a SubscriptionResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource along with {@link Response}. - */ - SubscriptionResource getById(String id); - - /** - * Get a SubscriptionResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Delete a SubscriptionResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a SubscriptionResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new SubscriptionResource resource. - * - * @param name resource name. - * @return the first stage of the new SubscriptionResource definition. - */ - SubscriptionResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operation.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operation.java deleted file mode 100644 index bc652f2e968..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operation.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; - -/** - * An immutable client-side representation of Operation. - */ -public interface Operation { - /** - * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - * - * @return the name value. - */ - String name(); - - /** - * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane - * operations and "false" for Azure Resource Manager/control-plane operations. - * - * @return the isDataAction value. - */ - Boolean isDataAction(); - - /** - * Gets the display property: Localized display information for this particular operation. - * - * @return the display value. - */ - OperationDisplay display(); - - /** - * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and - * audit logs UX. Default value is "user,system". - * - * @return the origin value. - */ - Origin origin(); - - /** - * Gets the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are - * for internal only APIs. - * - * @return the actionType value. - */ - ActionType actionType(); - - /** - * Gets the inner azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner object. - * - * @return the inner object. - */ - OperationInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/OperationDisplay.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/OperationDisplay.java deleted file mode 100644 index c03918c5fda..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/OperationDisplay.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Localized display information for and operation. - */ -@Immutable -public final class OperationDisplay implements JsonSerializable { - /* - * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or - * "Microsoft Compute". - */ - private String provider; - - /* - * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or - * "Job Schedule Collections". - */ - private String resource; - - /* - * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. - * "Create or Update Virtual Machine", "Restart Virtual Machine". - */ - private String operation; - - /* - * The short, localized friendly description of the operation; suitable for tool tips and detailed views. - */ - private String description; - - /** - * Creates an instance of OperationDisplay class. - */ - private OperationDisplay() { - } - - /** - * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring - * Insights" or "Microsoft Compute". - * - * @return the provider value. - */ - public String provider() { - return this.provider; - } - - /** - * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. - * "Virtual Machines" or "Job Schedule Collections". - * - * @return the resource value. - */ - public String resource() { - return this.resource; - } - - /** - * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. - * "Create or Update Virtual Machine", "Restart Virtual Machine". - * - * @return the operation value. - */ - public String operation() { - return this.operation; - } - - /** - * Get the description property: The short, localized friendly description of the operation; suitable for tool tips - * and detailed views. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationDisplay from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the OperationDisplay. - */ - public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationDisplay deserializedOperationDisplay = new OperationDisplay(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provider".equals(fieldName)) { - deserializedOperationDisplay.provider = reader.getString(); - } else if ("resource".equals(fieldName)) { - deserializedOperationDisplay.resource = reader.getString(); - } else if ("operation".equals(fieldName)) { - deserializedOperationDisplay.operation = reader.getString(); - } else if ("description".equals(fieldName)) { - deserializedOperationDisplay.description = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOperationDisplay; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operations.java deleted file mode 100644 index 7f6fe38ee0f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operations.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; - -/** - * Resource collection API of Operations. - */ -public interface Operations { - /** - * List the operations for the provider. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - PagedIterable list(); - - /** - * List the operations for the provider. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - PagedIterable list(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Origin.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Origin.java deleted file mode 100644 index ed0b1a9a8c4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Origin.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value - * is "user,system". - */ -public final class Origin extends ExpandableStringEnum { - /** - * Indicates the operation is initiated by a user. - */ - public static final Origin USER = fromString("user"); - - /** - * Indicates the operation is initiated by a system. - */ - public static final Origin SYSTEM = fromString("system"); - - /** - * Indicates the operation is initiated by a user or system. - */ - public static final Origin USER_SYSTEM = fromString("user,system"); - - /** - * Creates a new instance of Origin value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public Origin() { - } - - /** - * Creates or finds a Origin from its string representation. - * - * @param name a name to look for. - * @return the corresponding Origin. - */ - public static Origin fromString(String name) { - return fromString(name, Origin.class); - } - - /** - * Gets known Origin values. - * - * @return known Origin values. - */ - public static Collection values() { - return values(Origin.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResource.java deleted file mode 100644 index 21ba8253d7d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResource.java +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Map; - -/** - * An immutable client-side representation of ResourceGroupResource. - */ -public interface ResourceGroupResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - ResourceGroupResourceProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the name of the resource group. - * - * @return the name of the resource group. - */ - String resourceGroupName(); - - /** - * Gets the inner azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner object. - * - * @return the inner object. - */ - ResourceGroupResourceInner innerModel(); - - /** - * The entirety of the ResourceGroupResource definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { - } - - /** - * The ResourceGroupResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the ResourceGroupResource definition. - */ - interface Blank extends WithLocation { - } - - /** - * The stage of the ResourceGroupResource definition allowing to specify location. - */ - interface WithLocation { - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(Region location); - - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(String location); - } - - /** - * The stage of the ResourceGroupResource definition allowing to specify parent resource. - */ - interface WithResourceGroup { - /** - * Specifies resourceGroupName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @return the next definition stage. - */ - WithCreate withExistingResourceGroup(String resourceGroupName); - } - - /** - * The stage of the ResourceGroupResource definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - ResourceGroupResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - ResourceGroupResource create(Context context); - } - - /** - * The stage of the ResourceGroupResource definition allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - WithCreate withTags(Map tags); - } - - /** - * The stage of the ResourceGroupResource definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(ResourceGroupResourceProperties properties); - } - } - - /** - * Begins update for the ResourceGroupResource resource. - * - * @return the stage of resource update. - */ - ResourceGroupResource.Update update(); - - /** - * The template for ResourceGroupResource update. - */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { - /** - * Executes the update request. - * - * @return the updated resource. - */ - ResourceGroupResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - ResourceGroupResource apply(Context context); - } - - /** - * The ResourceGroupResource update stages. - */ - interface UpdateStages { - /** - * The stage of the ResourceGroupResource update allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - Update withTags(Map tags); - } - - /** - * The stage of the ResourceGroupResource update allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - Update withProperties(ResourceGroupResourceProperties properties); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - ResourceGroupResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - ResourceGroupResource refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResourceProperties.java deleted file mode 100644 index 02f23db62c5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResourceProperties.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Properties of resource group resource. - */ -@Fluent -public final class ResourceGroupResourceProperties implements JsonSerializable { - /* - * The status of the last operation. - */ - private ResourceProvisioningState provisioningState; - - /* - * The resource group-scoped setting. - */ - private String resourceGroupSetting; - - /** - * Creates an instance of ResourceGroupResourceProperties class. - */ - public ResourceGroupResourceProperties() { - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ResourceProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Get the resourceGroupSetting property: The resource group-scoped setting. - * - * @return the resourceGroupSetting value. - */ - public String resourceGroupSetting() { - return this.resourceGroupSetting; - } - - /** - * Set the resourceGroupSetting property: The resource group-scoped setting. - * - * @param resourceGroupSetting the resourceGroupSetting value to set. - * @return the ResourceGroupResourceProperties object itself. - */ - public ResourceGroupResourceProperties withResourceGroupSetting(String resourceGroupSetting) { - this.resourceGroupSetting = resourceGroupSetting; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("resourceGroupSetting", this.resourceGroupSetting); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourceGroupResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourceGroupResourceProperties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the ResourceGroupResourceProperties. - */ - public static ResourceGroupResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ResourceGroupResourceProperties deserializedResourceGroupResourceProperties - = new ResourceGroupResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedResourceGroupResourceProperties.provisioningState - = ResourceProvisioningState.fromString(reader.getString()); - } else if ("resourceGroupSetting".equals(fieldName)) { - deserializedResourceGroupResourceProperties.resourceGroupSetting = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedResourceGroupResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceProvisioningState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceProvisioningState.java deleted file mode 100644 index 1885b2f593f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceProvisioningState.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * The provisioning state of a resource type. - */ -public final class ResourceProvisioningState extends ExpandableStringEnum { - /** - * Resource has been created. - */ - public static final ResourceProvisioningState SUCCEEDED = fromString("Succeeded"); - - /** - * Resource creation failed. - */ - public static final ResourceProvisioningState FAILED = fromString("Failed"); - - /** - * Resource creation was canceled. - */ - public static final ResourceProvisioningState CANCELED = fromString("Canceled"); - - /** - * Creates a new instance of ResourceProvisioningState value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ResourceProvisioningState() { - } - - /** - * Creates or finds a ResourceProvisioningState from its string representation. - * - * @param name a name to look for. - * @return the corresponding ResourceProvisioningState. - */ - public static ResourceProvisioningState fromString(String name) { - return fromString(name, ResourceProvisioningState.class); - } - - /** - * Gets known ResourceProvisioningState values. - * - * @return known ResourceProvisioningState values. - */ - public static Collection values() { - return values(ResourceProvisioningState.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource.java deleted file mode 100644 index 7850a9e1e31..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource.java +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; - -/** - * An immutable client-side representation of SubscriptionResource. - */ -public interface SubscriptionResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - SubscriptionResourceProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the inner azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner object. - * - * @return the inner object. - */ - SubscriptionResourceInner innerModel(); - - /** - * The entirety of the SubscriptionResource definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { - } - - /** - * The SubscriptionResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the SubscriptionResource definition. - */ - interface Blank extends WithCreate { - } - - /** - * The stage of the SubscriptionResource definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - SubscriptionResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - SubscriptionResource create(Context context); - } - - /** - * The stage of the SubscriptionResource definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(SubscriptionResourceProperties properties); - } - } - - /** - * Begins update for the SubscriptionResource resource. - * - * @return the stage of resource update. - */ - SubscriptionResource.Update update(); - - /** - * The template for SubscriptionResource update. - */ - interface Update extends UpdateStages.WithProperties { - /** - * Executes the update request. - * - * @return the updated resource. - */ - SubscriptionResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - SubscriptionResource apply(Context context); - } - - /** - * The SubscriptionResource update stages. - */ - interface UpdateStages { - /** - * The stage of the SubscriptionResource update allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - Update withProperties(SubscriptionResourceProperties properties); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - SubscriptionResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - SubscriptionResource refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1.java deleted file mode 100644 index d3deed1893f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1.java +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; - -/** - * An immutable client-side representation of SubscriptionResource1. - */ -public interface SubscriptionResource1 { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - SubscriptionResource1Properties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the inner azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner object. - * - * @return the inner object. - */ - SubscriptionResource1Inner innerModel(); - - /** - * The entirety of the SubscriptionResource1 definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { - } - - /** - * The SubscriptionResource1 definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the SubscriptionResource1 definition. - */ - interface Blank extends WithCreate { - } - - /** - * The stage of the SubscriptionResource1 definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - SubscriptionResource1 create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - SubscriptionResource1 create(Context context); - } - - /** - * The stage of the SubscriptionResource1 definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(SubscriptionResource1Properties properties); - } - } - - /** - * Begins update for the SubscriptionResource1 resource. - * - * @return the stage of resource update. - */ - SubscriptionResource1.Update update(); - - /** - * The template for SubscriptionResource1 update. - */ - interface Update extends UpdateStages.WithProperties { - /** - * Executes the update request. - * - * @return the updated resource. - */ - SubscriptionResource1 apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - SubscriptionResource1 apply(Context context); - } - - /** - * The SubscriptionResource1 update stages. - */ - interface UpdateStages { - /** - * The stage of the SubscriptionResource1 update allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - Update withProperties(SubscriptionResource1Properties properties); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - SubscriptionResource1 refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - SubscriptionResource1 refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1Properties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1Properties.java deleted file mode 100644 index 30fb94fa155..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1Properties.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Properties of subscription resource 1. - */ -@Fluent -public final class SubscriptionResource1Properties implements JsonSerializable { - /* - * The status of the last operation. - */ - private ResourceProvisioningState provisioningState; - - /* - * The description of the resource. - */ - private String description; - - /** - * Creates an instance of SubscriptionResource1Properties class. - */ - public SubscriptionResource1Properties() { - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ResourceProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Get the description property: The description of the resource. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Set the description property: The description of the resource. - * - * @param description the description value to set. - * @return the SubscriptionResource1Properties object itself. - */ - public SubscriptionResource1Properties withDescription(String description) { - this.description = description; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubscriptionResource1Properties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubscriptionResource1Properties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the SubscriptionResource1Properties. - */ - public static SubscriptionResource1Properties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SubscriptionResource1Properties deserializedSubscriptionResource1Properties - = new SubscriptionResource1Properties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedSubscriptionResource1Properties.provisioningState - = ResourceProvisioningState.fromString(reader.getString()); - } else if ("description".equals(fieldName)) { - deserializedSubscriptionResource1Properties.description = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedSubscriptionResource1Properties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2.java deleted file mode 100644 index 1eceb96e79b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2.java +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; - -/** - * An immutable client-side representation of SubscriptionResource2. - */ -public interface SubscriptionResource2 { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - SubscriptionResource2Properties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the inner azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner object. - * - * @return the inner object. - */ - SubscriptionResource2Inner innerModel(); - - /** - * The entirety of the SubscriptionResource2 definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { - } - - /** - * The SubscriptionResource2 definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the SubscriptionResource2 definition. - */ - interface Blank extends WithCreate { - } - - /** - * The stage of the SubscriptionResource2 definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - SubscriptionResource2 create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - SubscriptionResource2 create(Context context); - } - - /** - * The stage of the SubscriptionResource2 definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(SubscriptionResource2Properties properties); - } - } - - /** - * Begins update for the SubscriptionResource2 resource. - * - * @return the stage of resource update. - */ - SubscriptionResource2.Update update(); - - /** - * The template for SubscriptionResource2 update. - */ - interface Update extends UpdateStages.WithProperties { - /** - * Executes the update request. - * - * @return the updated resource. - */ - SubscriptionResource2 apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - SubscriptionResource2 apply(Context context); - } - - /** - * The SubscriptionResource2 update stages. - */ - interface UpdateStages { - /** - * The stage of the SubscriptionResource2 update allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - Update withProperties(SubscriptionResource2Properties properties); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - SubscriptionResource2 refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - SubscriptionResource2 refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2Properties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2Properties.java deleted file mode 100644 index b5b02bd53df..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2Properties.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Properties of subscription resource 2. - */ -@Fluent -public final class SubscriptionResource2Properties implements JsonSerializable { - /* - * The status of the last operation. - */ - private ResourceProvisioningState provisioningState; - - /* - * The configuration value. - */ - private String configValue; - - /** - * Creates an instance of SubscriptionResource2Properties class. - */ - public SubscriptionResource2Properties() { - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ResourceProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Get the configValue property: The configuration value. - * - * @return the configValue value. - */ - public String configValue() { - return this.configValue; - } - - /** - * Set the configValue property: The configuration value. - * - * @param configValue the configValue value to set. - * @return the SubscriptionResource2Properties object itself. - */ - public SubscriptionResource2Properties withConfigValue(String configValue) { - this.configValue = configValue; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("configValue", this.configValue); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubscriptionResource2Properties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubscriptionResource2Properties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the SubscriptionResource2Properties. - */ - public static SubscriptionResource2Properties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SubscriptionResource2Properties deserializedSubscriptionResource2Properties - = new SubscriptionResource2Properties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedSubscriptionResource2Properties.provisioningState - = ResourceProvisioningState.fromString(reader.getString()); - } else if ("configValue".equals(fieldName)) { - deserializedSubscriptionResource2Properties.configValue = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedSubscriptionResource2Properties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResourceProperties.java deleted file mode 100644 index 74042f35bde..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResourceProperties.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Properties of subscription resource. - */ -@Fluent -public final class SubscriptionResourceProperties implements JsonSerializable { - /* - * The status of the last operation. - */ - private ResourceProvisioningState provisioningState; - - /* - * The subscription-scoped setting. - */ - private String subscriptionSetting; - - /** - * Creates an instance of SubscriptionResourceProperties class. - */ - public SubscriptionResourceProperties() { - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ResourceProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Get the subscriptionSetting property: The subscription-scoped setting. - * - * @return the subscriptionSetting value. - */ - public String subscriptionSetting() { - return this.subscriptionSetting; - } - - /** - * Set the subscriptionSetting property: The subscription-scoped setting. - * - * @param subscriptionSetting the subscriptionSetting value to set. - * @return the SubscriptionResourceProperties object itself. - */ - public SubscriptionResourceProperties withSubscriptionSetting(String subscriptionSetting) { - this.subscriptionSetting = subscriptionSetting; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("subscriptionSetting", this.subscriptionSetting); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubscriptionResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubscriptionResourceProperties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the SubscriptionResourceProperties. - */ - public static SubscriptionResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SubscriptionResourceProperties deserializedSubscriptionResourceProperties - = new SubscriptionResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedSubscriptionResourceProperties.provisioningState - = ResourceProvisioningState.fromString(reader.getString()); - } else if ("subscriptionSetting".equals(fieldName)) { - deserializedSubscriptionResourceProperties.subscriptionSetting = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedSubscriptionResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations.java deleted file mode 100644 index d0076c164b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations.java +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations. - */ -public interface TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations { - /** - * Get a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource1 along with {@link Response}. - */ - Response getWithResponse(String subscriptionId, String subscriptionResource1Name, - Context context); - - /** - * Get a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource1. - */ - SubscriptionResource1 get(String subscriptionId, String subscriptionResource1Name); - - /** - * Delete a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByResourceGroupWithResponse(String subscriptionId, String subscriptionResource1Name, - Context context); - - /** - * Delete a SubscriptionResource1. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource1Name The name of the SubscriptionResource1. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String subscriptionId, String subscriptionResource1Name); - - /** - * Get a SubscriptionResource1. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource1 along with {@link Response}. - */ - SubscriptionResource1 getById(String id); - - /** - * Get a SubscriptionResource1. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource1 along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Delete a SubscriptionResource1. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a SubscriptionResource1. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new SubscriptionResource1 resource. - * - * @param name resource name. - * @return the first stage of the new SubscriptionResource1 definition. - */ - SubscriptionResource1.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations.java deleted file mode 100644 index f9ea1bf9785..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations.java +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations. - */ -public interface TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations { - /** - * Get a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource2 along with {@link Response}. - */ - Response getWithResponse(String subscriptionId, String subscriptionResource2Name, - Context context); - - /** - * Get a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource2. - */ - SubscriptionResource2 get(String subscriptionId, String subscriptionResource2Name); - - /** - * Delete a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByResourceGroupWithResponse(String subscriptionId, String subscriptionResource2Name, - Context context); - - /** - * Delete a SubscriptionResource2. - * - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - * @param subscriptionResource2Name The name of the SubscriptionResource2. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String subscriptionId, String subscriptionResource2Name); - - /** - * Get a SubscriptionResource2. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource2 along with {@link Response}. - */ - SubscriptionResource2 getById(String id); - - /** - * Get a SubscriptionResource2. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SubscriptionResource2 along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Delete a SubscriptionResource2. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a SubscriptionResource2. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new SubscriptionResource2 resource. - * - * @param name resource name. - * @return the first stage of the new SubscriptionResource2 definition. - */ - SubscriptionResource2.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/package-info.java deleted file mode 100644 index c00a72b8e8e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the data models for MethodSubscriptionId. - * Test for ARM method level subscription ID parameter placement. - */ -package azure.resourcemanager.methodsubscriptionid.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/package-info.java deleted file mode 100644 index a8244d1c741..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the classes for MethodSubscriptionId. - * Test for ARM method level subscription ID parameter placement. - */ -package azure.resourcemanager.methodsubscriptionid; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/CombinedManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/CombinedManager.java deleted file mode 100644 index ba46e7c64d5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/CombinedManager.java +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined; - -import azure.resourcemanager.multiservice.combined.fluent.Combined; -import azure.resourcemanager.multiservice.combined.implementation.CombinedBuilder; -import azure.resourcemanager.multiservice.combined.implementation.DisksImpl; -import azure.resourcemanager.multiservice.combined.implementation.VirtualMachinesImpl; -import azure.resourcemanager.multiservice.combined.models.Disks; -import azure.resourcemanager.multiservice.combined.models.VirtualMachines; -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * Entry point to CombinedManager. - * Compute Client. - */ -public final class CombinedManager { - private VirtualMachines virtualMachines; - - private Disks disks; - - private final Combined clientObject; - - private CombinedManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new CombinedBuilder().pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of combined service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the combined service API instance. - */ - public static CombinedManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return configure().authenticate(credential, profile); - } - - /** - * Creates an instance of combined service API entry point. - * - * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. - * @param profile the Azure profile for client. - * @return the combined service API instance. - */ - public static CombinedManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return new CombinedManager(httpPipeline, profile, null); - } - - /** - * Gets a Configurable instance that can be used to create CombinedManager with optional configuration. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new CombinedManager.Configurable(); - } - - /** - * The Configurable allowing configurations to be set. - */ - public static final class Configurable { - private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); - private static final String SDK_VERSION = "version"; - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-resourcemanager-combined-generated.properties"); - - private HttpClient httpClient; - private HttpLogOptions httpLogOptions; - private final List policies = new ArrayList<>(); - private final List scopes = new ArrayList<>(); - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - private Duration defaultPollInterval; - - private Configurable() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - return this; - } - - /** - * Adds the scope to permission sets. - * - * @param scope the scope. - * @return the configurable object itself. - */ - public Configurable withScope(String scope) { - this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); - return this; - } - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - /** - * Sets the default poll interval, used when service does not provide "Retry-After" header. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval - = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of combined service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the combined service API instance. - */ - public CombinedManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder.append("azsdk-java") - .append("-") - .append("azure.resourcemanager.multiservice.combined") - .append("/") - .append(clientVersion); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder.append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(userAgentBuilder.toString())); - policies.add(new AddHeadersFromContextPolicy()); - policies.add(new RequestIdPolicy()); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy); - policies.add(new AddDatePolicy()); - policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new CombinedManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * Gets the resource collection API of VirtualMachines. It manages VirtualMachine. - * - * @return Resource collection API of VirtualMachines. - */ - public VirtualMachines virtualMachines() { - if (this.virtualMachines == null) { - this.virtualMachines = new VirtualMachinesImpl(clientObject.getVirtualMachines(), this); - } - return virtualMachines; - } - - /** - * Gets the resource collection API of Disks. It manages Disk. - * - * @return Resource collection API of Disks. - */ - public Disks disks() { - if (this.disks == null) { - this.disks = new DisksImpl(clientObject.getDisks(), this); - } - return disks; - } - - /** - * Gets wrapped service client Combined providing direct access to the underlying auto-generated API implementation, - * based on Azure REST API. - * - * @return Wrapped service client Combined. - */ - public Combined serviceClient() { - return this.clientObject; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/Combined.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/Combined.java deleted file mode 100644 index 2cca6a21a4a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/Combined.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for Combined class. - */ -public interface Combined { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the VirtualMachinesClient object to access its operations. - * - * @return the VirtualMachinesClient object. - */ - VirtualMachinesClient getVirtualMachines(); - - /** - * Gets the DisksClient object to access its operations. - * - * @return the DisksClient object. - */ - DisksClient getDisks(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/DisksClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/DisksClient.java deleted file mode 100644 index 0abf504509d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/DisksClient.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.fluent; - -import azure.resourcemanager.multiservice.combined.fluent.models.DiskInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; - -/** - * An instance of this class provides access to all the operations defined in DisksClient. - */ -public interface DisksClient { - /** - * Gets information about a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a disk along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, String diskName, Context context); - - /** - * Gets information about a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a disk. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - DiskInner getByResourceGroup(String resourceGroupName, String diskName); - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of disk resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, DiskInner> beginCreateOrUpdate(String resourceGroupName, String diskName, - DiskInner resource); - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of disk resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, DiskInner> beginCreateOrUpdate(String resourceGroupName, String diskName, - DiskInner resource, Context context); - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return disk resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner resource); - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return disk resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner resource, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/VirtualMachinesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/VirtualMachinesClient.java deleted file mode 100644 index 7f05b08e0bb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/VirtualMachinesClient.java +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.fluent; - -import azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; - -/** - * An instance of this class provides access to all the operations defined in VirtualMachinesClient. - */ -public interface VirtualMachinesClient { - /** - * Retrieves information about the model view or the instance view of a virtual machine. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, String vmName, - Context context); - - /** - * Retrieves information about the model view or the instance view of a virtual machine. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - VirtualMachineInner getByResourceGroup(String resourceGroupName, String vmName); - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of describes a Virtual Machine. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, VirtualMachineInner> beginCreateOrUpdate(String resourceGroupName, - String vmName, VirtualMachineInner resource); - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of describes a Virtual Machine. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, VirtualMachineInner> beginCreateOrUpdate(String resourceGroupName, - String vmName, VirtualMachineInner resource, Context context); - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - VirtualMachineInner createOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner resource); - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - VirtualMachineInner createOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner resource, - Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/DiskInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/DiskInner.java deleted file mode 100644 index 7a464f689ed..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/DiskInner.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.fluent.models; - -import azure.resourcemanager.multiservice.combined.models.DiskProperties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Disk resource. - */ -@Fluent -public final class DiskInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private DiskProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of DiskInner class. - */ - public DiskInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public DiskProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the DiskInner object itself. - */ - public DiskInner withProperties(DiskProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public DiskInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public DiskInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DiskInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DiskInner if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DiskInner. - */ - public static DiskInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - DiskInner deserializedDiskInner = new DiskInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedDiskInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedDiskInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedDiskInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedDiskInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedDiskInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedDiskInner.properties = DiskProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedDiskInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedDiskInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/VirtualMachineInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/VirtualMachineInner.java deleted file mode 100644 index ecb75d37263..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/VirtualMachineInner.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.fluent.models; - -import azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Describes a Virtual Machine. - */ -@Fluent -public final class VirtualMachineInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private VirtualMachineProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of VirtualMachineInner class. - */ - public VirtualMachineInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public VirtualMachineProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the VirtualMachineInner object itself. - */ - public VirtualMachineInner withProperties(VirtualMachineProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public VirtualMachineInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public VirtualMachineInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of VirtualMachineInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of VirtualMachineInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the VirtualMachineInner. - */ - public static VirtualMachineInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - VirtualMachineInner deserializedVirtualMachineInner = new VirtualMachineInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedVirtualMachineInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedVirtualMachineInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedVirtualMachineInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedVirtualMachineInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedVirtualMachineInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedVirtualMachineInner.properties = VirtualMachineProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedVirtualMachineInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedVirtualMachineInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/package-info.java deleted file mode 100644 index a418da6f4ef..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the inner data models for Compute. - * Compute Client. - */ -package azure.resourcemanager.multiservice.combined.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/package-info.java deleted file mode 100644 index b51da8a120d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the service clients for Compute. - * Compute Client. - */ -package azure.resourcemanager.multiservice.combined.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedBuilder.java deleted file mode 100644 index 77d2d288003..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** - * A builder for creating a new instance of the CombinedImpl type. - */ -@ServiceClientBuilder(serviceClients = { CombinedImpl.class }) -public final class CombinedBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the CombinedBuilder. - */ - public CombinedBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The ID of the target subscription. The value must be an UUID. - */ - private String subscriptionId; - - /** - * Sets The ID of the target subscription. The value must be an UUID. - * - * @param subscriptionId the subscriptionId value. - * @return the CombinedBuilder. - */ - public CombinedBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the CombinedBuilder. - */ - public CombinedBuilder environment(AzureEnvironment environment) { - this.environment = environment; - 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 CombinedBuilder. - */ - public CombinedBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the CombinedBuilder. - */ - public CombinedBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - 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 CombinedBuilder. - */ - public CombinedBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of CombinedImpl with the provided parameters. - * - * @return an instance of CombinedImpl. - */ - public CombinedImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval - = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - CombinedImpl client = new CombinedImpl(localPipeline, localSerializerAdapter, localDefaultPollInterval, - localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedImpl.java deleted file mode 100644 index 3082d51ed39..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedImpl.java +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.implementation; - -import azure.resourcemanager.multiservice.combined.fluent.Combined; -import azure.resourcemanager.multiservice.combined.fluent.DisksClient; -import azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.management.polling.SyncPollerFactory; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the CombinedImpl type. - */ -@ServiceClient(builder = CombinedBuilder.class) -public final class CombinedImpl implements Combined { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * The ID of the target subscription. The value must be an UUID. - */ - private final String subscriptionId; - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * 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. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The VirtualMachinesClient object to access its operations. - */ - private final VirtualMachinesClient virtualMachines; - - /** - * Gets the VirtualMachinesClient object to access its operations. - * - * @return the VirtualMachinesClient object. - */ - public VirtualMachinesClient getVirtualMachines() { - return this.virtualMachines; - } - - /** - * The DisksClient object to access its operations. - */ - private final DisksClient disks; - - /** - * Gets the DisksClient object to access its operations. - * - * @return the DisksClient object. - */ - public DisksClient getDisks() { - return this.disks; - } - - /** - * Initializes an instance of Combined client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - CombinedImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, - AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.virtualMachines = new VirtualMachinesClientImpl(this); - this.disks = new DisksClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return SyncPoller for poll result and final result. - */ - public SyncPoller, U> getLroResult(Response activationResponse, - Type pollResultType, Type finalResultType, Context context) { - return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, () -> activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(CombinedImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DiskImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DiskImpl.java deleted file mode 100644 index a2602710bbb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DiskImpl.java +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.implementation; - -import azure.resourcemanager.multiservice.combined.fluent.models.DiskInner; -import azure.resourcemanager.multiservice.combined.models.Disk; -import azure.resourcemanager.multiservice.combined.models.DiskProperties; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Collections; -import java.util.Map; - -public final class DiskImpl implements Disk, Disk.Definition, Disk.Update { - private DiskInner innerObject; - - private final azure.resourcemanager.multiservice.combined.CombinedManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public DiskProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public String resourceGroupName() { - return resourceGroupName; - } - - public DiskInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.multiservice.combined.CombinedManager manager() { - return this.serviceManager; - } - - private String resourceGroupName; - - private String diskName; - - public DiskImpl withExistingResourceGroup(String resourceGroupName) { - this.resourceGroupName = resourceGroupName; - return this; - } - - public Disk create() { - this.innerObject = serviceManager.serviceClient() - .getDisks() - .createOrUpdate(resourceGroupName, diskName, this.innerModel(), Context.NONE); - return this; - } - - public Disk create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getDisks() - .createOrUpdate(resourceGroupName, diskName, this.innerModel(), context); - return this; - } - - DiskImpl(String name, azure.resourcemanager.multiservice.combined.CombinedManager serviceManager) { - this.innerObject = new DiskInner(); - this.serviceManager = serviceManager; - this.diskName = name; - } - - public DiskImpl update() { - return this; - } - - public Disk apply() { - this.innerObject = serviceManager.serviceClient() - .getDisks() - .createOrUpdate(resourceGroupName, diskName, this.innerModel(), Context.NONE); - return this; - } - - public Disk apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getDisks() - .createOrUpdate(resourceGroupName, diskName, this.innerModel(), context); - return this; - } - - DiskImpl(DiskInner innerObject, azure.resourcemanager.multiservice.combined.CombinedManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.diskName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "disks"); - } - - public Disk refresh() { - this.innerObject = serviceManager.serviceClient() - .getDisks() - .getByResourceGroupWithResponse(resourceGroupName, diskName, Context.NONE) - .getValue(); - return this; - } - - public Disk refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getDisks() - .getByResourceGroupWithResponse(resourceGroupName, diskName, context) - .getValue(); - return this; - } - - public DiskImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); - return this; - } - - public DiskImpl withRegion(String location) { - this.innerModel().withLocation(location); - return this; - } - - public DiskImpl withTags(Map tags) { - this.innerModel().withTags(tags); - return this; - } - - public DiskImpl withProperties(DiskProperties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksClientImpl.java deleted file mode 100644 index 163e986aa13..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksClientImpl.java +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.implementation; - -import azure.resourcemanager.multiservice.combined.fluent.DisksClient; -import azure.resourcemanager.multiservice.combined.fluent.models.DiskInner; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DisksClient. - */ -public final class DisksClientImpl implements DisksClient { - /** - * The proxy service used to perform REST calls. - */ - private final DisksService service; - - /** - * The service client containing this operation class. - */ - private final CombinedImpl client; - - /** - * Initializes an instance of DisksClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DisksClientImpl(CombinedImpl client) { - this.service = RestProxy.create(DisksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for CombinedDisks to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "CombinedDisks") - public interface DisksService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName, - @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") DiskInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") DiskInner resource, Context context); - } - - /** - * Gets information about a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a disk along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String diskName) { - final String apiVersion = "2025-01-02"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, diskName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Gets information about a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a disk on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, String diskName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, diskName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Gets information about a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a disk along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, String diskName, - Context context) { - final String apiVersion = "2025-01-02"; - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, diskName, accept, context); - } - - /** - * Gets information about a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a disk. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public DiskInner getByResourceGroup(String resourceGroupName, String diskName) { - return getByResourceGroupWithResponse(resourceGroupName, diskName, Context.NONE).getValue(); - } - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return disk resource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String diskName, - DiskInner resource) { - final String apiVersion = "2025-01-02"; - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, diskName, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return disk resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String diskName, - DiskInner resource) { - final String apiVersion = "2025-01-02"; - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, diskName, contentType, accept, resource, Context.NONE); - } - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return disk resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String diskName, - DiskInner resource, Context context) { - final String apiVersion = "2025-01-02"; - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, diskName, contentType, accept, resource, context); - } - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of disk resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DiskInner> beginCreateOrUpdateAsync(String resourceGroupName, - String diskName, DiskInner resource) { - Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, diskName, resource); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), DiskInner.class, - DiskInner.class, this.client.getContext()); - } - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of disk resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, DiskInner> beginCreateOrUpdate(String resourceGroupName, String diskName, - DiskInner resource) { - Response response = createOrUpdateWithResponse(resourceGroupName, diskName, resource); - return this.client.getLroResult(response, DiskInner.class, DiskInner.class, Context.NONE); - } - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of disk resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, DiskInner> beginCreateOrUpdate(String resourceGroupName, String diskName, - DiskInner resource, Context context) { - Response response = createOrUpdateWithResponse(resourceGroupName, diskName, resource, context); - return this.client.getLroResult(response, DiskInner.class, DiskInner.class, context); - } - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return disk resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String diskName, DiskInner resource) { - return beginCreateOrUpdateAsync(resourceGroupName, diskName, resource).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return disk resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner resource) { - return beginCreateOrUpdate(resourceGroupName, diskName, resource).getFinalResult(); - } - - /** - * Creates or updates a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return disk resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner resource, Context context) { - return beginCreateOrUpdate(resourceGroupName, diskName, resource, context).getFinalResult(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksImpl.java deleted file mode 100644 index dc239f5146c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.implementation; - -import azure.resourcemanager.multiservice.combined.fluent.DisksClient; -import azure.resourcemanager.multiservice.combined.fluent.models.DiskInner; -import azure.resourcemanager.multiservice.combined.models.Disk; -import azure.resourcemanager.multiservice.combined.models.Disks; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class DisksImpl implements Disks { - private static final ClientLogger LOGGER = new ClientLogger(DisksImpl.class); - - private final DisksClient innerClient; - - private final azure.resourcemanager.multiservice.combined.CombinedManager serviceManager; - - public DisksImpl(DisksClient innerClient, - azure.resourcemanager.multiservice.combined.CombinedManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, String diskName, Context context) { - Response inner - = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, diskName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new DiskImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public Disk getByResourceGroup(String resourceGroupName, String diskName) { - DiskInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, diskName); - if (inner != null) { - return new DiskImpl(inner, this.manager()); - } else { - return null; - } - } - - public Disk getById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String diskName = ResourceManagerUtils.getValueFromIdByName(id, "disks"); - if (diskName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'disks'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, diskName, Context.NONE).getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String diskName = ResourceManagerUtils.getValueFromIdByName(id, "disks"); - if (diskName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'disks'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, diskName, context); - } - - private DisksClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.multiservice.combined.CombinedManager manager() { - return this.serviceManager; - } - - public DiskImpl define(String name) { - return new DiskImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/ResourceManagerUtils.java deleted file mode 100644 index 0c6500fe0ec..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/ResourceManagerUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.implementation; - -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.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class ResourceManagerUtils { - private ResourceManagerUtils() { - } - - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (!segments.isEmpty() && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl<>(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux - .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(iterable.iterator(), mapper); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachineImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachineImpl.java deleted file mode 100644 index c168f6217d2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachineImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.implementation; - -import azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner; -import azure.resourcemanager.multiservice.combined.models.VirtualMachine; -import azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Collections; -import java.util.Map; - -public final class VirtualMachineImpl implements VirtualMachine, VirtualMachine.Definition, VirtualMachine.Update { - private VirtualMachineInner innerObject; - - private final azure.resourcemanager.multiservice.combined.CombinedManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public VirtualMachineProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public String resourceGroupName() { - return resourceGroupName; - } - - public VirtualMachineInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.multiservice.combined.CombinedManager manager() { - return this.serviceManager; - } - - private String resourceGroupName; - - private String vmName; - - public VirtualMachineImpl withExistingResourceGroup(String resourceGroupName) { - this.resourceGroupName = resourceGroupName; - return this; - } - - public VirtualMachine create() { - this.innerObject = serviceManager.serviceClient() - .getVirtualMachines() - .createOrUpdate(resourceGroupName, vmName, this.innerModel(), Context.NONE); - return this; - } - - public VirtualMachine create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getVirtualMachines() - .createOrUpdate(resourceGroupName, vmName, this.innerModel(), context); - return this; - } - - VirtualMachineImpl(String name, azure.resourcemanager.multiservice.combined.CombinedManager serviceManager) { - this.innerObject = new VirtualMachineInner(); - this.serviceManager = serviceManager; - this.vmName = name; - } - - public VirtualMachineImpl update() { - return this; - } - - public VirtualMachine apply() { - this.innerObject = serviceManager.serviceClient() - .getVirtualMachines() - .createOrUpdate(resourceGroupName, vmName, this.innerModel(), Context.NONE); - return this; - } - - public VirtualMachine apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getVirtualMachines() - .createOrUpdate(resourceGroupName, vmName, this.innerModel(), context); - return this; - } - - VirtualMachineImpl(VirtualMachineInner innerObject, - azure.resourcemanager.multiservice.combined.CombinedManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.vmName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "virtualMachines"); - } - - public VirtualMachine refresh() { - this.innerObject = serviceManager.serviceClient() - .getVirtualMachines() - .getByResourceGroupWithResponse(resourceGroupName, vmName, Context.NONE) - .getValue(); - return this; - } - - public VirtualMachine refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getVirtualMachines() - .getByResourceGroupWithResponse(resourceGroupName, vmName, context) - .getValue(); - return this; - } - - public VirtualMachineImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); - return this; - } - - public VirtualMachineImpl withRegion(String location) { - this.innerModel().withLocation(location); - return this; - } - - public VirtualMachineImpl withTags(Map tags) { - this.innerModel().withTags(tags); - return this; - } - - public VirtualMachineImpl withProperties(VirtualMachineProperties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesClientImpl.java deleted file mode 100644 index 46c32f950ab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesClientImpl.java +++ /dev/null @@ -1,361 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.implementation; - -import azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient; -import azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in VirtualMachinesClient. - */ -public final class VirtualMachinesClientImpl implements VirtualMachinesClient { - /** - * The proxy service used to perform REST calls. - */ - private final VirtualMachinesService service; - - /** - * The service client containing this operation class. - */ - private final CombinedImpl client; - - /** - * Initializes an instance of VirtualMachinesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - VirtualMachinesClientImpl(CombinedImpl client) { - this.service - = RestProxy.create(VirtualMachinesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for CombinedVirtualMachines to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "CombinedVirtualMachines") - public interface VirtualMachinesService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vmName") String vmName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vmName") String vmName, - @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vmName") String vmName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") VirtualMachineInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vmName") String vmName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") VirtualMachineInner resource, Context context); - } - - /** - * Retrieves information about the model view or the instance view of a virtual machine. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String vmName) { - final String apiVersion = "2025-04-01"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, vmName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Retrieves information about the model view or the instance view of a virtual machine. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, String vmName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, vmName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Retrieves information about the model view or the instance view of a virtual machine. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, String vmName, - Context context) { - final String apiVersion = "2025-04-01"; - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, vmName, accept, context); - } - - /** - * Retrieves information about the model view or the instance view of a virtual machine. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public VirtualMachineInner getByResourceGroup(String resourceGroupName, String vmName) { - return getByResourceGroupWithResponse(resourceGroupName, vmName, Context.NONE).getValue(); - } - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String vmName, - VirtualMachineInner resource) { - final String apiVersion = "2025-04-01"; - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, - this.client.getSubscriptionId(), resourceGroupName, vmName, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String vmName, - VirtualMachineInner resource) { - final String apiVersion = "2025-04-01"; - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, vmName, contentType, accept, resource, Context.NONE); - } - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String vmName, - VirtualMachineInner resource, Context context) { - final String apiVersion = "2025-04-01"; - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), - resourceGroupName, vmName, contentType, accept, resource, context); - } - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of describes a Virtual Machine. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, VirtualMachineInner> - beginCreateOrUpdateAsync(String resourceGroupName, String vmName, VirtualMachineInner resource) { - Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, vmName, resource); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - VirtualMachineInner.class, VirtualMachineInner.class, this.client.getContext()); - } - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of describes a Virtual Machine. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, VirtualMachineInner> - beginCreateOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner resource) { - Response response = createOrUpdateWithResponse(resourceGroupName, vmName, resource); - return this.client.getLroResult(response, VirtualMachineInner.class, - VirtualMachineInner.class, Context.NONE); - } - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of describes a Virtual Machine. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, VirtualMachineInner> - beginCreateOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner resource, Context context) { - Response response = createOrUpdateWithResponse(resourceGroupName, vmName, resource, context); - return this.client.getLroResult(response, VirtualMachineInner.class, - VirtualMachineInner.class, context); - } - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String vmName, - VirtualMachineInner resource) { - return beginCreateOrUpdateAsync(resourceGroupName, vmName, resource).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public VirtualMachineInner createOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner resource) { - return beginCreateOrUpdate(resourceGroupName, vmName, resource).getFinalResult(); - } - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual - * machine creation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public VirtualMachineInner createOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner resource, - Context context) { - return beginCreateOrUpdate(resourceGroupName, vmName, resource, context).getFinalResult(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesImpl.java deleted file mode 100644 index 05f4cd048c2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesImpl.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.implementation; - -import azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient; -import azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner; -import azure.resourcemanager.multiservice.combined.models.VirtualMachine; -import azure.resourcemanager.multiservice.combined.models.VirtualMachines; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class VirtualMachinesImpl implements VirtualMachines { - private static final ClientLogger LOGGER = new ClientLogger(VirtualMachinesImpl.class); - - private final VirtualMachinesClient innerClient; - - private final azure.resourcemanager.multiservice.combined.CombinedManager serviceManager; - - public VirtualMachinesImpl(VirtualMachinesClient innerClient, - azure.resourcemanager.multiservice.combined.CombinedManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, String vmName, - Context context) { - Response inner - = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, vmName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new VirtualMachineImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public VirtualMachine getByResourceGroup(String resourceGroupName, String vmName) { - VirtualMachineInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, vmName); - if (inner != null) { - return new VirtualMachineImpl(inner, this.manager()); - } else { - return null; - } - } - - public VirtualMachine getById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String vmName = ResourceManagerUtils.getValueFromIdByName(id, "virtualMachines"); - if (vmName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, vmName, Context.NONE).getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String vmName = ResourceManagerUtils.getValueFromIdByName(id, "virtualMachines"); - if (vmName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, vmName, context); - } - - private VirtualMachinesClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.multiservice.combined.CombinedManager manager() { - return this.serviceManager; - } - - public VirtualMachineImpl define(String name) { - return new VirtualMachineImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/package-info.java deleted file mode 100644 index 09f6feb1b9f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the implementations for Compute. - * Compute Client. - */ -package azure.resourcemanager.multiservice.combined.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disk.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disk.java deleted file mode 100644 index b2ce33a9b71..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disk.java +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.models; - -import azure.resourcemanager.multiservice.combined.fluent.models.DiskInner; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Map; - -/** - * An immutable client-side representation of Disk. - */ -public interface Disk { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - DiskProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the name of the resource group. - * - * @return the name of the resource group. - */ - String resourceGroupName(); - - /** - * Gets the inner azure.resourcemanager.multiservice.combined.fluent.models.DiskInner object. - * - * @return the inner object. - */ - DiskInner innerModel(); - - /** - * The entirety of the Disk definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { - } - - /** - * The Disk definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the Disk definition. - */ - interface Blank extends WithLocation { - } - - /** - * The stage of the Disk definition allowing to specify location. - */ - interface WithLocation { - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(Region location); - - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(String location); - } - - /** - * The stage of the Disk definition allowing to specify parent resource. - */ - interface WithResourceGroup { - /** - * Specifies resourceGroupName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @return the next definition stage. - */ - WithCreate withExistingResourceGroup(String resourceGroupName); - } - - /** - * The stage of the Disk definition which contains all the minimum required properties for the resource to be - * created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - Disk create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - Disk create(Context context); - } - - /** - * The stage of the Disk definition allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - WithCreate withTags(Map tags); - } - - /** - * The stage of the Disk definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(DiskProperties properties); - } - } - - /** - * Begins update for the Disk resource. - * - * @return the stage of resource update. - */ - Disk.Update update(); - - /** - * The template for Disk update. - */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { - /** - * Executes the update request. - * - * @return the updated resource. - */ - Disk apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - Disk apply(Context context); - } - - /** - * The Disk update stages. - */ - interface UpdateStages { - /** - * The stage of the Disk update allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - Update withTags(Map tags); - } - - /** - * The stage of the Disk update allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - Update withProperties(DiskProperties properties); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - Disk refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - Disk refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/DiskProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/DiskProperties.java deleted file mode 100644 index 14fbcecb499..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/DiskProperties.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Disk resource properties. - */ -@Immutable -public final class DiskProperties implements JsonSerializable { - /* - * The provisioningState property. - */ - private ResourceProvisioningState provisioningState; - - /** - * Creates an instance of DiskProperties class. - */ - public DiskProperties() { - } - - /** - * Get the provisioningState property: The provisioningState property. - * - * @return the provisioningState value. - */ - public ResourceProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DiskProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DiskProperties if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the DiskProperties. - */ - public static DiskProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - DiskProperties deserializedDiskProperties = new DiskProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedDiskProperties.provisioningState - = ResourceProvisioningState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedDiskProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disks.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disks.java deleted file mode 100644 index 57b4ce0d912..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disks.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of Disks. - */ -public interface Disks { - /** - * Gets information about a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a disk along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, String diskName, Context context); - - /** - * Gets information about a disk. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param diskName The name of the Disk. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a disk. - */ - Disk getByResourceGroup(String resourceGroupName, String diskName); - - /** - * Gets information about a disk. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a disk along with {@link Response}. - */ - Disk getById(String id); - - /** - * Gets information about a disk. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a disk along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new Disk resource. - * - * @param name resource name. - * @return the first stage of the new Disk definition. - */ - Disk.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/ResourceProvisioningState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/ResourceProvisioningState.java deleted file mode 100644 index 22f4daccb3f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/ResourceProvisioningState.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * The provisioning state of a resource type. - */ -public final class ResourceProvisioningState extends ExpandableStringEnum { - /** - * Resource has been created. - */ - public static final ResourceProvisioningState SUCCEEDED = fromString("Succeeded"); - - /** - * Resource creation failed. - */ - public static final ResourceProvisioningState FAILED = fromString("Failed"); - - /** - * Resource creation was canceled. - */ - public static final ResourceProvisioningState CANCELED = fromString("Canceled"); - - /** - * Creates a new instance of ResourceProvisioningState value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ResourceProvisioningState() { - } - - /** - * Creates or finds a ResourceProvisioningState from its string representation. - * - * @param name a name to look for. - * @return the corresponding ResourceProvisioningState. - */ - public static ResourceProvisioningState fromString(String name) { - return fromString(name, ResourceProvisioningState.class); - } - - /** - * Gets known ResourceProvisioningState values. - * - * @return known ResourceProvisioningState values. - */ - public static Collection values() { - return values(ResourceProvisioningState.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachine.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachine.java deleted file mode 100644 index 36530565907..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachine.java +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.models; - -import azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Map; - -/** - * An immutable client-side representation of VirtualMachine. - */ -public interface VirtualMachine { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - VirtualMachineProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the name of the resource group. - * - * @return the name of the resource group. - */ - String resourceGroupName(); - - /** - * Gets the inner azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner object. - * - * @return the inner object. - */ - VirtualMachineInner innerModel(); - - /** - * The entirety of the VirtualMachine definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { - } - - /** - * The VirtualMachine definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the VirtualMachine definition. - */ - interface Blank extends WithLocation { - } - - /** - * The stage of the VirtualMachine definition allowing to specify location. - */ - interface WithLocation { - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(Region location); - - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(String location); - } - - /** - * The stage of the VirtualMachine definition allowing to specify parent resource. - */ - interface WithResourceGroup { - /** - * Specifies resourceGroupName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @return the next definition stage. - */ - WithCreate withExistingResourceGroup(String resourceGroupName); - } - - /** - * The stage of the VirtualMachine definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - VirtualMachine create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - VirtualMachine create(Context context); - } - - /** - * The stage of the VirtualMachine definition allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - WithCreate withTags(Map tags); - } - - /** - * The stage of the VirtualMachine definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(VirtualMachineProperties properties); - } - } - - /** - * Begins update for the VirtualMachine resource. - * - * @return the stage of resource update. - */ - VirtualMachine.Update update(); - - /** - * The template for VirtualMachine update. - */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { - /** - * Executes the update request. - * - * @return the updated resource. - */ - VirtualMachine apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - VirtualMachine apply(Context context); - } - - /** - * The VirtualMachine update stages. - */ - interface UpdateStages { - /** - * The stage of the VirtualMachine update allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - Update withTags(Map tags); - } - - /** - * The stage of the VirtualMachine update allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - Update withProperties(VirtualMachineProperties properties); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - VirtualMachine refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - VirtualMachine refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachineProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachineProperties.java deleted file mode 100644 index d911aed030c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachineProperties.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The VirtualMachineProperties model. - */ -@Immutable -public final class VirtualMachineProperties implements JsonSerializable { - /* - * The provisioningState property. - */ - private ResourceProvisioningState provisioningState; - - /** - * Creates an instance of VirtualMachineProperties class. - */ - public VirtualMachineProperties() { - } - - /** - * Get the provisioningState property: The provisioningState property. - * - * @return the provisioningState value. - */ - public ResourceProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of VirtualMachineProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of VirtualMachineProperties if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the VirtualMachineProperties. - */ - public static VirtualMachineProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - VirtualMachineProperties deserializedVirtualMachineProperties = new VirtualMachineProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedVirtualMachineProperties.provisioningState - = ResourceProvisioningState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedVirtualMachineProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachines.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachines.java deleted file mode 100644 index cee367106b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachines.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of VirtualMachines. - */ -public interface VirtualMachines { - /** - * Retrieves information about the model view or the instance view of a virtual machine. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, String vmName, Context context); - - /** - * Retrieves information about the model view or the instance view of a virtual machine. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vmName The name of the VirtualMachine. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine. - */ - VirtualMachine getByResourceGroup(String resourceGroupName, String vmName); - - /** - * Retrieves information about the model view or the instance view of a virtual machine. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine along with {@link Response}. - */ - VirtualMachine getById(String id); - - /** - * Retrieves information about the model view or the instance view of a virtual machine. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return describes a Virtual Machine along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new VirtualMachine resource. - * - * @param name resource name. - * @return the first stage of the new VirtualMachine definition. - */ - VirtualMachine.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/package-info.java deleted file mode 100644 index 39b4e2b7bcf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the data models for Compute. - * Compute Client. - */ -package azure.resourcemanager.multiservice.combined.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/package-info.java deleted file mode 100644 index 21bfd176845..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the classes for Compute. - * Compute Client. - */ -package azure.resourcemanager.multiservice.combined; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/NonResourceManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/NonResourceManager.java deleted file mode 100644 index 8c3b9456bac..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/NonResourceManager.java +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.nonresource; - -import azure.resourcemanager.nonresource.fluent.NonResourceClient; -import azure.resourcemanager.nonresource.implementation.NonResourceClientBuilder; -import azure.resourcemanager.nonresource.implementation.NonResourceOperationsImpl; -import azure.resourcemanager.nonresource.models.NonResourceOperations; -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * Entry point to NonResourceManager. - * Arm Resource Provider management API. - */ -public final class NonResourceManager { - private NonResourceOperations nonResourceOperations; - - private final NonResourceClient clientObject; - - private NonResourceManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new NonResourceClientBuilder().pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of NonResource service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the NonResource service API instance. - */ - public static NonResourceManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return configure().authenticate(credential, profile); - } - - /** - * Creates an instance of NonResource service API entry point. - * - * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. - * @param profile the Azure profile for client. - * @return the NonResource service API instance. - */ - public static NonResourceManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return new NonResourceManager(httpPipeline, profile, null); - } - - /** - * Gets a Configurable instance that can be used to create NonResourceManager with optional configuration. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new NonResourceManager.Configurable(); - } - - /** - * The Configurable allowing configurations to be set. - */ - public static final class Configurable { - private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); - private static final String SDK_VERSION = "version"; - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-resourcemanager-nonresource-generated.properties"); - - private HttpClient httpClient; - private HttpLogOptions httpLogOptions; - private final List policies = new ArrayList<>(); - private final List scopes = new ArrayList<>(); - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - private Duration defaultPollInterval; - - private Configurable() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - return this; - } - - /** - * Adds the scope to permission sets. - * - * @param scope the scope. - * @return the configurable object itself. - */ - public Configurable withScope(String scope) { - this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); - return this; - } - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - /** - * Sets the default poll interval, used when service does not provide "Retry-After" header. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval - = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of NonResource service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the NonResource service API instance. - */ - public NonResourceManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder.append("azsdk-java") - .append("-") - .append("azure.resourcemanager.nonresource") - .append("/") - .append(clientVersion); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder.append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(userAgentBuilder.toString())); - policies.add(new AddHeadersFromContextPolicy()); - policies.add(new RequestIdPolicy()); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy); - policies.add(new AddDatePolicy()); - policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new NonResourceManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * Gets the resource collection API of NonResourceOperations. It manages NonResource. - * - * @return Resource collection API of NonResourceOperations. - */ - public NonResourceOperations nonResourceOperations() { - if (this.nonResourceOperations == null) { - this.nonResourceOperations = new NonResourceOperationsImpl(clientObject.getNonResourceOperations(), this); - } - return nonResourceOperations; - } - - /** - * Gets wrapped service client NonResourceClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. - * - * @return Wrapped service client NonResourceClient. - */ - public NonResourceClient serviceClient() { - return this.clientObject; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceClient.java deleted file mode 100644 index 33db00d223d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceClient.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.nonresource.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for NonResourceClient class. - */ -public interface NonResourceClient { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the NonResourceOperationsClient object to access its operations. - * - * @return the NonResourceOperationsClient object. - */ - NonResourceOperationsClient getNonResourceOperations(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceOperationsClient.java deleted file mode 100644 index 3a71a624631..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceOperationsClient.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.nonresource.fluent; - -import azure.resourcemanager.nonresource.fluent.models.NonResourceInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * An instance of this class provides access to all the operations defined in NonResourceOperationsClient. - */ -public interface NonResourceOperationsClient { - /** - * The get operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource` along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String location, String parameter, Context context); - - /** - * The get operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource`. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - NonResourceInner get(String location, String parameter); - - /** - * The create operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @param body The request body. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource` along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response createWithResponse(String location, String parameter, NonResourceInner body, - Context context); - - /** - * The create operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @param body The request body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource`. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - NonResourceInner create(String location, String parameter, NonResourceInner body); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/NonResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/NonResourceInner.java deleted file mode 100644 index 8c5de1fb522..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/NonResourceInner.java +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.nonresource.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends `Resource`. - */ -@Fluent -public final class NonResourceInner implements JsonSerializable { - /* - * An id. - */ - private String id; - - /* - * A name. - */ - private String name; - - /* - * A type. - */ - private String type; - - /** - * Creates an instance of NonResourceInner class. - */ - public NonResourceInner() { - } - - /** - * Get the id property: An id. - * - * @return the id value. - */ - public String id() { - return this.id; - } - - /** - * Set the id property: An id. - * - * @param id the id value to set. - * @return the NonResourceInner object itself. - */ - public NonResourceInner withId(String id) { - this.id = id; - return this; - } - - /** - * Get the name property: A name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: A name. - * - * @param name the name value to set. - * @return the NonResourceInner object itself. - */ - public NonResourceInner withName(String name) { - this.name = name; - return this; - } - - /** - * Get the type property: A type. - * - * @return the type value. - */ - public String type() { - return this.type; - } - - /** - * Set the type property: A type. - * - * @param type the type value to set. - * @return the NonResourceInner object itself. - */ - public NonResourceInner withType(String type) { - this.type = type; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("type", this.type); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NonResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NonResourceInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the NonResourceInner. - */ - public static NonResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NonResourceInner deserializedNonResourceInner = new NonResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedNonResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedNonResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedNonResourceInner.type = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedNonResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/package-info.java deleted file mode 100644 index 1b0f8b6dfc9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the inner data models for NonResourceManagementClient. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.nonresource.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/package-info.java deleted file mode 100644 index f2fde364870..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the service clients for NonResourceManagementClient. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.nonresource.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientBuilder.java deleted file mode 100644 index 69351f4aa18..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.nonresource.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** - * A builder for creating a new instance of the NonResourceClientImpl type. - */ -@ServiceClientBuilder(serviceClients = { NonResourceClientImpl.class }) -public final class NonResourceClientBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the NonResourceClientBuilder. - */ - public NonResourceClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The ID of the target subscription. The value must be an UUID. - */ - private String subscriptionId; - - /** - * Sets The ID of the target subscription. The value must be an UUID. - * - * @param subscriptionId the subscriptionId value. - * @return the NonResourceClientBuilder. - */ - public NonResourceClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the NonResourceClientBuilder. - */ - public NonResourceClientBuilder environment(AzureEnvironment environment) { - this.environment = environment; - 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 NonResourceClientBuilder. - */ - public NonResourceClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the NonResourceClientBuilder. - */ - public NonResourceClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - 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 NonResourceClientBuilder. - */ - public NonResourceClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of NonResourceClientImpl with the provided parameters. - * - * @return an instance of NonResourceClientImpl. - */ - public NonResourceClientImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval - = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - NonResourceClientImpl client = new NonResourceClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientImpl.java deleted file mode 100644 index 01a8142ee74..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientImpl.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.nonresource.implementation; - -import azure.resourcemanager.nonresource.fluent.NonResourceClient; -import azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.management.polling.SyncPollerFactory; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the NonResourceClientImpl type. - */ -@ServiceClient(builder = NonResourceClientBuilder.class) -public final class NonResourceClientImpl implements NonResourceClient { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Version parameter. - */ - private final String apiVersion; - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * The ID of the target subscription. The value must be an UUID. - */ - private final String subscriptionId; - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * 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. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The NonResourceOperationsClient object to access its operations. - */ - private final NonResourceOperationsClient nonResourceOperations; - - /** - * Gets the NonResourceOperationsClient object to access its operations. - * - * @return the NonResourceOperationsClient object. - */ - public NonResourceOperationsClient getNonResourceOperations() { - return this.nonResourceOperations; - } - - /** - * Initializes an instance of NonResourceClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - NonResourceClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, - AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.apiVersion = "2023-12-01-preview"; - this.nonResourceOperations = new NonResourceOperationsClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return SyncPoller for poll result and final result. - */ - public SyncPoller, U> getLroResult(Response activationResponse, - Type pollResultType, Type finalResultType, Context context) { - return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, () -> activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(NonResourceClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceImpl.java deleted file mode 100644 index 61e3cb878e0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.nonresource.implementation; - -import azure.resourcemanager.nonresource.fluent.models.NonResourceInner; -import azure.resourcemanager.nonresource.models.NonResource; -import com.azure.core.util.Context; - -public final class NonResourceImpl implements NonResource, NonResource.Definition { - private NonResourceInner innerObject; - - private final azure.resourcemanager.nonresource.NonResourceManager serviceManager; - - NonResourceImpl(NonResourceInner innerObject, azure.resourcemanager.nonresource.NonResourceManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public NonResourceInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.nonresource.NonResourceManager manager() { - return this.serviceManager; - } - - private String location; - - private String parameter; - - public NonResourceImpl withExistingLocation(String location) { - this.location = location; - return this; - } - - public NonResource create() { - this.innerObject = serviceManager.serviceClient() - .getNonResourceOperations() - .createWithResponse(location, parameter, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public NonResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getNonResourceOperations() - .createWithResponse(location, parameter, this.innerModel(), context) - .getValue(); - return this; - } - - NonResourceImpl(String name, azure.resourcemanager.nonresource.NonResourceManager serviceManager) { - this.innerObject = new NonResourceInner(); - this.serviceManager = serviceManager; - this.parameter = name; - } - - public NonResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getNonResourceOperations() - .getWithResponse(location, parameter, Context.NONE) - .getValue(); - return this; - } - - public NonResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getNonResourceOperations() - .getWithResponse(location, parameter, context) - .getValue(); - return this; - } - - public NonResourceImpl withName(String name) { - this.innerModel().withName(name); - return this; - } - - public NonResourceImpl withType(String type) { - this.innerModel().withType(type); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsClientImpl.java deleted file mode 100644 index 3b7cf615f3c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsClientImpl.java +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.nonresource.implementation; - -import azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient; -import azure.resourcemanager.nonresource.fluent.models.NonResourceInner; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in NonResourceOperationsClient. - */ -public final class NonResourceOperationsClientImpl implements NonResourceOperationsClient { - /** - * The proxy service used to perform REST calls. - */ - private final NonResourceOperationsService service; - - /** - * The service client containing this operation class. - */ - private final NonResourceClientImpl client; - - /** - * Initializes an instance of NonResourceOperationsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NonResourceOperationsClientImpl(NonResourceClientImpl client) { - this.service = RestProxy.create(NonResourceOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NonResourceClientNonResourceOperations to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NonResourceClientNonResourceOperations") - public interface NonResourceOperationsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.NonResource/locations/{location}/otherParameters/{parameter}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @PathParam("parameter") String parameter, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.NonResource/locations/{location}/otherParameters/{parameter}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @PathParam("parameter") String parameter, - @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Microsoft.NonResource/locations/{location}/otherParameters/{parameter}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> create(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @PathParam("parameter") String parameter, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") NonResourceInner body, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Microsoft.NonResource/locations/{location}/otherParameters/{parameter}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @PathParam("parameter") String parameter, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") NonResourceInner body, Context context); - } - - /** - * The get operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource` along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String location, String parameter) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, parameter, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * The get operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource` on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String location, String parameter) { - return getWithResponseAsync(location, parameter).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The get operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource` along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String location, String parameter, Context context) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - location, parameter, accept, context); - } - - /** - * The get operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource`. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NonResourceInner get(String location, String parameter) { - return getWithResponse(location, parameter, Context.NONE).getValue(); - } - - /** - * The create operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @param body The request body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource` along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createWithResponseAsync(String location, String parameter, - NonResourceInner body) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, parameter, contentType, accept, body, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * The create operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @param body The request body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource` on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String location, String parameter, NonResourceInner body) { - return createWithResponseAsync(location, parameter, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The create operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @param body The request body. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource` along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createWithResponse(String location, String parameter, NonResourceInner body, - Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, parameter, contentType, accept, body, context); - } - - /** - * The create operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @param body The request body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource`. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NonResourceInner create(String location, String parameter, NonResourceInner body) { - return createWithResponse(location, parameter, body, Context.NONE).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsImpl.java deleted file mode 100644 index 53db37891f7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.nonresource.implementation; - -import azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient; -import azure.resourcemanager.nonresource.fluent.models.NonResourceInner; -import azure.resourcemanager.nonresource.models.NonResource; -import azure.resourcemanager.nonresource.models.NonResourceOperations; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class NonResourceOperationsImpl implements NonResourceOperations { - private static final ClientLogger LOGGER = new ClientLogger(NonResourceOperationsImpl.class); - - private final NonResourceOperationsClient innerClient; - - private final azure.resourcemanager.nonresource.NonResourceManager serviceManager; - - public NonResourceOperationsImpl(NonResourceOperationsClient innerClient, - azure.resourcemanager.nonresource.NonResourceManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getWithResponse(String location, String parameter, Context context) { - Response inner = this.serviceClient().getWithResponse(location, parameter, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new NonResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public NonResource get(String location, String parameter) { - NonResourceInner inner = this.serviceClient().get(location, parameter); - if (inner != null) { - return new NonResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public NonResource getById(String id) { - String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); - if (location == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); - } - String parameter = ResourceManagerUtils.getValueFromIdByName(id, "otherParameters"); - if (parameter == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'otherParameters'.", id))); - } - return this.getWithResponse(location, parameter, Context.NONE).getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); - if (location == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); - } - String parameter = ResourceManagerUtils.getValueFromIdByName(id, "otherParameters"); - if (parameter == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'otherParameters'.", id))); - } - return this.getWithResponse(location, parameter, context); - } - - private NonResourceOperationsClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.nonresource.NonResourceManager manager() { - return this.serviceManager; - } - - public NonResourceImpl define(String name) { - return new NonResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/ResourceManagerUtils.java deleted file mode 100644 index c971258f5ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/ResourceManagerUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.nonresource.implementation; - -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.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class ResourceManagerUtils { - private ResourceManagerUtils() { - } - - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (!segments.isEmpty() && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl<>(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux - .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(iterable.iterator(), mapper); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/package-info.java deleted file mode 100644 index b2a8c37b109..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the implementations for NonResourceManagementClient. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.nonresource.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResource.java deleted file mode 100644 index 80c59f8c1ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResource.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.nonresource.models; - -import azure.resourcemanager.nonresource.fluent.models.NonResourceInner; -import com.azure.core.util.Context; - -/** - * An immutable client-side representation of NonResource. - */ -public interface NonResource { - /** - * Gets the id property: An id. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: A name. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: A type. - * - * @return the type value. - */ - String type(); - - /** - * Gets the inner azure.resourcemanager.nonresource.fluent.models.NonResourceInner object. - * - * @return the inner object. - */ - NonResourceInner innerModel(); - - /** - * The entirety of the NonResource definition. - */ - interface Definition - extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { - } - - /** - * The NonResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the NonResource definition. - */ - interface Blank extends WithParentResource { - } - - /** - * The stage of the NonResource definition allowing to specify parent resource. - */ - interface WithParentResource { - /** - * Specifies location. - * - * @param location The location parameter. - * @return the next definition stage. - */ - WithCreate withExistingLocation(String location); - } - - /** - * The stage of the NonResource definition which contains all the minimum required properties for the resource - * to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithName, DefinitionStages.WithType { - /** - * Executes the create request. - * - * @return the created resource. - */ - NonResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - NonResource create(Context context); - } - - /** - * The stage of the NonResource definition allowing to specify name. - */ - interface WithName { - /** - * Specifies the name property: A name.. - * - * @param name A name. - * @return the next definition stage. - */ - WithCreate withName(String name); - } - - /** - * The stage of the NonResource definition allowing to specify type. - */ - interface WithType { - /** - * Specifies the type property: A type.. - * - * @param type A type. - * @return the next definition stage. - */ - WithCreate withType(String type); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - NonResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - NonResource refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResourceOperations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResourceOperations.java deleted file mode 100644 index 6c9381670a2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResourceOperations.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.nonresource.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of NonResourceOperations. - */ -public interface NonResourceOperations { - /** - * The get operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource` along with {@link Response}. - */ - Response getWithResponse(String location, String parameter, Context context); - - /** - * The get operation. - * - * @param location The location parameter. - * @param parameter Another parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource`. - */ - NonResource get(String location, String parameter); - - /** - * The get operation. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource` along with {@link Response}. - */ - NonResource getById(String id); - - /** - * The get operation. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends - * `Resource` along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new NonResource resource. - * - * @param name resource name. - * @return the first stage of the new NonResource definition. - */ - NonResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/package-info.java deleted file mode 100644 index f99d250fa0a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the data models for NonResourceManagementClient. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.nonresource.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/package-info.java deleted file mode 100644 index e18de96ec78..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the classes for NonResourceManagementClient. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.nonresource; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/OperationTemplatesManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/OperationTemplatesManager.java deleted file mode 100644 index 731f22dc7e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/OperationTemplatesManager.java +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates; - -import azure.resourcemanager.operationtemplates.fluent.OperationTemplatesClient; -import azure.resourcemanager.operationtemplates.implementation.CheckNameAvailabilitiesImpl; -import azure.resourcemanager.operationtemplates.implementation.LroesImpl; -import azure.resourcemanager.operationtemplates.implementation.OperationTemplatesClientBuilder; -import azure.resourcemanager.operationtemplates.implementation.OperationsImpl; -import azure.resourcemanager.operationtemplates.implementation.OptionalBodiesImpl; -import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilities; -import azure.resourcemanager.operationtemplates.models.Lroes; -import azure.resourcemanager.operationtemplates.models.Operations; -import azure.resourcemanager.operationtemplates.models.OptionalBodies; -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * Entry point to OperationTemplatesManager. - * Arm Resource Provider management API. - */ -public final class OperationTemplatesManager { - private Operations operations; - - private CheckNameAvailabilities checkNameAvailabilities; - - private Lroes lroes; - - private OptionalBodies optionalBodies; - - private final OperationTemplatesClient clientObject; - - private OperationTemplatesManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new OperationTemplatesClientBuilder().pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of OperationTemplates service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the OperationTemplates service API instance. - */ - public static OperationTemplatesManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return configure().authenticate(credential, profile); - } - - /** - * Creates an instance of OperationTemplates service API entry point. - * - * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. - * @param profile the Azure profile for client. - * @return the OperationTemplates service API instance. - */ - public static OperationTemplatesManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return new OperationTemplatesManager(httpPipeline, profile, null); - } - - /** - * Gets a Configurable instance that can be used to create OperationTemplatesManager with optional configuration. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new OperationTemplatesManager.Configurable(); - } - - /** - * The Configurable allowing configurations to be set. - */ - public static final class Configurable { - private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); - private static final String SDK_VERSION = "version"; - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-resourcemanager-operationtemplates-generated.properties"); - - private HttpClient httpClient; - private HttpLogOptions httpLogOptions; - private final List policies = new ArrayList<>(); - private final List scopes = new ArrayList<>(); - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - private Duration defaultPollInterval; - - private Configurable() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - return this; - } - - /** - * Adds the scope to permission sets. - * - * @param scope the scope. - * @return the configurable object itself. - */ - public Configurable withScope(String scope) { - this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); - return this; - } - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - /** - * Sets the default poll interval, used when service does not provide "Retry-After" header. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval - = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of OperationTemplates service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the OperationTemplates service API instance. - */ - public OperationTemplatesManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder.append("azsdk-java") - .append("-") - .append("azure.resourcemanager.operationtemplates") - .append("/") - .append(clientVersion); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder.append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(userAgentBuilder.toString())); - policies.add(new AddHeadersFromContextPolicy()); - policies.add(new RequestIdPolicy()); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy); - policies.add(new AddDatePolicy()); - policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new OperationTemplatesManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * Gets the resource collection API of Operations. - * - * @return Resource collection API of Operations. - */ - public Operations operations() { - if (this.operations == null) { - this.operations = new OperationsImpl(clientObject.getOperations(), this); - } - return operations; - } - - /** - * Gets the resource collection API of CheckNameAvailabilities. - * - * @return Resource collection API of CheckNameAvailabilities. - */ - public CheckNameAvailabilities checkNameAvailabilities() { - if (this.checkNameAvailabilities == null) { - this.checkNameAvailabilities - = new CheckNameAvailabilitiesImpl(clientObject.getCheckNameAvailabilities(), this); - } - return checkNameAvailabilities; - } - - /** - * Gets the resource collection API of Lroes. It manages Order. - * - * @return Resource collection API of Lroes. - */ - public Lroes lroes() { - if (this.lroes == null) { - this.lroes = new LroesImpl(clientObject.getLroes(), this); - } - return lroes; - } - - /** - * Gets the resource collection API of OptionalBodies. - * - * @return Resource collection API of OptionalBodies. - */ - public OptionalBodies optionalBodies() { - if (this.optionalBodies == null) { - this.optionalBodies = new OptionalBodiesImpl(clientObject.getOptionalBodies(), this); - } - return optionalBodies; - } - - /** - * Gets wrapped service client OperationTemplatesClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. - * - * @return Wrapped service client OperationTemplatesClient. - */ - public OperationTemplatesClient serviceClient() { - return this.clientObject; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/CheckNameAvailabilitiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/CheckNameAvailabilitiesClient.java deleted file mode 100644 index 5707564b00e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/CheckNameAvailabilitiesClient.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.fluent; - -import azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner; -import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityRequest; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient. - */ -public interface CheckNameAvailabilitiesClient { - /** - * Implements global CheckNameAvailability operations. - * - * @param body The CheckAvailability request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response checkGlobalWithResponse(CheckNameAvailabilityRequest body, - Context context); - - /** - * Implements global CheckNameAvailability operations. - * - * @param body The CheckAvailability request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - CheckNameAvailabilityResponseInner checkGlobal(CheckNameAvailabilityRequest body); - - /** - * Implements local CheckNameAvailability operations. - * - * @param location The name of the Azure region. - * @param body The CheckAvailability request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response checkLocalWithResponse(String location, - CheckNameAvailabilityRequest body, Context context); - - /** - * Implements local CheckNameAvailability operations. - * - * @param location The name of the Azure region. - * @param body The CheckAvailability request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - CheckNameAvailabilityResponseInner checkLocal(String location, CheckNameAvailabilityRequest body); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/LroesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/LroesClient.java deleted file mode 100644 index a3b6d814291..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/LroesClient.java +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.fluent; - -import azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner; -import azure.resourcemanager.operationtemplates.fluent.models.OrderInner; -import azure.resourcemanager.operationtemplates.models.ExportRequest; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; - -/** - * An instance of this class provides access to all the operations defined in LroesClient. - */ -public interface LroesClient { - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, OrderInner> beginCreateOrReplace(String resourceGroupName, String orderName, - OrderInner resource); - - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, OrderInner> beginCreateOrReplace(String resourceGroupName, String orderName, - OrderInner resource, Context context); - - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - OrderInner createOrReplace(String resourceGroupName, String orderName, OrderInner resource); - - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - OrderInner createOrReplace(String resourceGroupName, String orderName, OrderInner resource, Context context); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ExportResultInner> beginExport(String resourceGroupName, String orderName, - ExportRequest body); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ExportResultInner> beginExport(String resourceGroupName, String orderName, - ExportRequest body, Context context); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - ExportResultInner export(String resourceGroupName, String orderName, ExportRequest body); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - ExportResultInner export(String resourceGroupName, String orderName, ExportRequest body, Context context); - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String orderName); - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String orderName, Context context); - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String orderName); - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String orderName, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationTemplatesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationTemplatesClient.java deleted file mode 100644 index bf0655d3b59..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationTemplatesClient.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for OperationTemplatesClient class. - */ -public interface OperationTemplatesClient { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the OperationsClient object to access its operations. - * - * @return the OperationsClient object. - */ - OperationsClient getOperations(); - - /** - * Gets the CheckNameAvailabilitiesClient object to access its operations. - * - * @return the CheckNameAvailabilitiesClient object. - */ - CheckNameAvailabilitiesClient getCheckNameAvailabilities(); - - /** - * Gets the LroesClient object to access its operations. - * - * @return the LroesClient object. - */ - LroesClient getLroes(); - - /** - * Gets the OptionalBodiesClient object to access its operations. - * - * @return the OptionalBodiesClient object. - */ - OptionalBodiesClient getOptionalBodies(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationsClient.java deleted file mode 100644 index 86e9ca7219a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationsClient.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.fluent; - -import azure.resourcemanager.operationtemplates.fluent.models.OperationInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; - -/** - * An instance of this class provides access to all the operations defined in OperationsClient. - */ -public interface OperationsClient { - /** - * List the operations for the provider. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * List the operations for the provider. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OptionalBodiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OptionalBodiesClient.java deleted file mode 100644 index 872f9fa4597..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OptionalBodiesClient.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.fluent; - -import azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner; -import azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner; -import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; -import azure.resourcemanager.operationtemplates.models.ActionRequest; -import azure.resourcemanager.operationtemplates.models.ChangeAllowanceRequest; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * An instance of this class provides access to all the operations defined in OptionalBodiesClient. - */ -public interface OptionalBodiesClient { - /** - * Get a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Widget along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, String widgetName, Context context); - - /** - * Get a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Widget. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - WidgetInner getByResourceGroup(String resourceGroupName, String widgetName); - - /** - * Update a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response patchWithResponse(String resourceGroupName, String widgetName, WidgetInner properties, - Context context); - - /** - * Update a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - WidgetInner patch(String resourceGroupName, String widgetName); - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response postWithResponse(String resourceGroupName, String widgetName, ActionRequest body, - Context context); - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - ActionResultInner post(String resourceGroupName, String widgetName); - - /** - * The providerPost operation. - * - * @param body The request body. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response providerPostWithResponse(ChangeAllowanceRequest body, Context context); - - /** - * The providerPost operation. - * - * @throws com.azure.core.management.exception.ManagementException 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) - ChangeAllowanceResultInner providerPost(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ActionResultInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ActionResultInner.java deleted file mode 100644 index b998a2cd2d3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ActionResultInner.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ActionResult model. - */ -@Immutable -public final class ActionResultInner implements JsonSerializable { - /* - * The result of the action. - */ - private String result; - - /** - * Creates an instance of ActionResultInner class. - */ - private ActionResultInner() { - } - - /** - * Get the result property: The result of the action. - * - * @return the result value. - */ - public String result() { - return this.result; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("result", this.result); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ActionResultInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ActionResultInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ActionResultInner. - */ - public static ActionResultInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ActionResultInner deserializedActionResultInner = new ActionResultInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("result".equals(fieldName)) { - deserializedActionResultInner.result = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedActionResultInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ChangeAllowanceResultInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ChangeAllowanceResultInner.java deleted file mode 100644 index e04458ba4c8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ChangeAllowanceResultInner.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ChangeAllowanceResult model. - */ -@Immutable -public final class ChangeAllowanceResultInner implements JsonSerializable { - /* - * The new total allowed widgets. - */ - private int totalAllowed; - - /* - * The status of the change. - */ - private String status; - - /** - * Creates an instance of ChangeAllowanceResultInner class. - */ - private ChangeAllowanceResultInner() { - } - - /** - * Get the totalAllowed property: The new total allowed widgets. - * - * @return the totalAllowed value. - */ - public int totalAllowed() { - return this.totalAllowed; - } - - /** - * Get the status property: The status of the change. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("totalAllowed", this.totalAllowed); - jsonWriter.writeStringField("status", this.status); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChangeAllowanceResultInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChangeAllowanceResultInner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ChangeAllowanceResultInner. - */ - public static ChangeAllowanceResultInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ChangeAllowanceResultInner deserializedChangeAllowanceResultInner = new ChangeAllowanceResultInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("totalAllowed".equals(fieldName)) { - deserializedChangeAllowanceResultInner.totalAllowed = reader.getInt(); - } else if ("status".equals(fieldName)) { - deserializedChangeAllowanceResultInner.status = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedChangeAllowanceResultInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/CheckNameAvailabilityResponseInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/CheckNameAvailabilityResponseInner.java deleted file mode 100644 index 6cfbc39c51f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/CheckNameAvailabilityResponseInner.java +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.fluent.models; - -import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityReason; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The check availability result. - */ -@Immutable -public final class CheckNameAvailabilityResponseInner implements JsonSerializable { - /* - * Indicates if the resource name is available. - */ - private Boolean nameAvailable; - - /* - * The reason why the given name is not available. - */ - private CheckNameAvailabilityReason reason; - - /* - * Detailed reason why the given name is not available. - */ - private String message; - - /** - * Creates an instance of CheckNameAvailabilityResponseInner class. - */ - private CheckNameAvailabilityResponseInner() { - } - - /** - * Get the nameAvailable property: Indicates if the resource name is available. - * - * @return the nameAvailable value. - */ - public Boolean nameAvailable() { - return this.nameAvailable; - } - - /** - * Get the reason property: The reason why the given name is not available. - * - * @return the reason value. - */ - public CheckNameAvailabilityReason reason() { - return this.reason; - } - - /** - * Get the message property: Detailed reason why the given name is not available. - * - * @return the message value. - */ - public String message() { - return this.message; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("nameAvailable", this.nameAvailable); - jsonWriter.writeStringField("reason", this.reason == null ? null : this.reason.toString()); - jsonWriter.writeStringField("message", this.message); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CheckNameAvailabilityResponseInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CheckNameAvailabilityResponseInner if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the CheckNameAvailabilityResponseInner. - */ - public static CheckNameAvailabilityResponseInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CheckNameAvailabilityResponseInner deserializedCheckNameAvailabilityResponseInner - = new CheckNameAvailabilityResponseInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("nameAvailable".equals(fieldName)) { - deserializedCheckNameAvailabilityResponseInner.nameAvailable - = reader.getNullable(JsonReader::getBoolean); - } else if ("reason".equals(fieldName)) { - deserializedCheckNameAvailabilityResponseInner.reason - = CheckNameAvailabilityReason.fromString(reader.getString()); - } else if ("message".equals(fieldName)) { - deserializedCheckNameAvailabilityResponseInner.message = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedCheckNameAvailabilityResponseInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ExportResultInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ExportResultInner.java deleted file mode 100644 index e8c747a6b1f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ExportResultInner.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ExportResult model. - */ -@Immutable -public final class ExportResultInner implements JsonSerializable { - /* - * Content of the exported order. - */ - private String content; - - /** - * Creates an instance of ExportResultInner class. - */ - private ExportResultInner() { - } - - /** - * Get the content property: Content of the exported order. - * - * @return the content value. - */ - public String content() { - return this.content; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("content", this.content); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExportResultInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExportResultInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExportResultInner. - */ - public static ExportResultInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ExportResultInner deserializedExportResultInner = new ExportResultInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("content".equals(fieldName)) { - deserializedExportResultInner.content = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedExportResultInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OperationInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OperationInner.java deleted file mode 100644 index 257e5c40fb2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OperationInner.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.fluent.models; - -import azure.resourcemanager.operationtemplates.models.ActionType; -import azure.resourcemanager.operationtemplates.models.OperationDisplay; -import azure.resourcemanager.operationtemplates.models.Origin; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * REST API Operation - * - * Details of a REST API operation, returned from the Resource Provider Operations API. - */ -@Immutable -public final class OperationInner implements JsonSerializable { - /* - * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" - */ - private String name; - - /* - * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure - * Resource Manager/control-plane operations. - */ - private Boolean isDataAction; - - /* - * Localized display information for this particular operation. - */ - private OperationDisplay display; - - /* - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default - * value is "user,system" - */ - private Origin origin; - - /* - * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - */ - private ActionType actionType; - - /** - * Creates an instance of OperationInner class. - */ - private OperationInner() { - } - - /** - * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane - * operations and "false" for Azure Resource Manager/control-plane operations. - * - * @return the isDataAction value. - */ - public Boolean isDataAction() { - return this.isDataAction; - } - - /** - * Get the display property: Localized display information for this particular operation. - * - * @return the display value. - */ - public OperationDisplay display() { - return this.display; - } - - /** - * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and - * audit logs UX. Default value is "user,system". - * - * @return the origin value. - */ - public Origin origin() { - return this.origin; - } - - /** - * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are - * for internal only APIs. - * - * @return the actionType value. - */ - public ActionType actionType() { - return this.actionType; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("display", this.display); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the OperationInner. - */ - public static OperationInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationInner deserializedOperationInner = new OperationInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedOperationInner.name = reader.getString(); - } else if ("isDataAction".equals(fieldName)) { - deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); - } else if ("display".equals(fieldName)) { - deserializedOperationInner.display = OperationDisplay.fromJson(reader); - } else if ("origin".equals(fieldName)) { - deserializedOperationInner.origin = Origin.fromString(reader.getString()); - } else if ("actionType".equals(fieldName)) { - deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedOperationInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OrderInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OrderInner.java deleted file mode 100644 index cc36b6bab96..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OrderInner.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.fluent.models; - -import azure.resourcemanager.operationtemplates.models.OrderProperties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class OrderInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private OrderProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of OrderInner class. - */ - public OrderInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public OrderProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the OrderInner object itself. - */ - public OrderInner withProperties(OrderProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public OrderInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public OrderInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OrderInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OrderInner if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OrderInner. - */ - public static OrderInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OrderInner deserializedOrderInner = new OrderInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedOrderInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedOrderInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedOrderInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedOrderInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedOrderInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedOrderInner.properties = OrderProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedOrderInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedOrderInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/WidgetInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/WidgetInner.java deleted file mode 100644 index 476d178236f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/WidgetInner.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.fluent.models; - -import azure.resourcemanager.operationtemplates.models.WidgetProperties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class WidgetInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private WidgetProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of WidgetInner class. - */ - public WidgetInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public WidgetProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the WidgetInner object itself. - */ - public WidgetInner withProperties(WidgetProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public WidgetInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public WidgetInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of WidgetInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of WidgetInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the WidgetInner. - */ - public static WidgetInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - WidgetInner deserializedWidgetInner = new WidgetInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedWidgetInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedWidgetInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedWidgetInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedWidgetInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedWidgetInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedWidgetInner.properties = WidgetProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedWidgetInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedWidgetInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/package-info.java deleted file mode 100644 index 15ba9bbc455..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the inner data models for OperationTemplates. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.operationtemplates.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/package-info.java deleted file mode 100644 index c750d615107..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the service clients for OperationTemplates. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.operationtemplates.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ActionResultImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ActionResultImpl.java deleted file mode 100644 index 10831820005..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ActionResultImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner; -import azure.resourcemanager.operationtemplates.models.ActionResult; - -public final class ActionResultImpl implements ActionResult { - private ActionResultInner innerObject; - - private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; - - ActionResultImpl(ActionResultInner innerObject, - azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String result() { - return this.innerModel().result(); - } - - public ActionResultInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ChangeAllowanceResultImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ChangeAllowanceResultImpl.java deleted file mode 100644 index 5c5ccd0d9b8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ChangeAllowanceResultImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner; -import azure.resourcemanager.operationtemplates.models.ChangeAllowanceResult; - -public final class ChangeAllowanceResultImpl implements ChangeAllowanceResult { - private ChangeAllowanceResultInner innerObject; - - private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; - - ChangeAllowanceResultImpl(ChangeAllowanceResultInner innerObject, - azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public int totalAllowed() { - return this.innerModel().totalAllowed(); - } - - public String status() { - return this.innerModel().status(); - } - - public ChangeAllowanceResultInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesClientImpl.java deleted file mode 100644 index 663a7f0ec9a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesClientImpl.java +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient; -import azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner; -import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityRequest; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient. - */ -public final class CheckNameAvailabilitiesClientImpl implements CheckNameAvailabilitiesClient { - /** - * The proxy service used to perform REST calls. - */ - private final CheckNameAvailabilitiesService service; - - /** - * The service client containing this operation class. - */ - private final OperationTemplatesClientImpl client; - - /** - * Initializes an instance of CheckNameAvailabilitiesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - CheckNameAvailabilitiesClientImpl(OperationTemplatesClientImpl client) { - this.service = RestProxy.create(CheckNameAvailabilitiesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OperationTemplatesClientCheckNameAvailabilities to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OperationTemplatesClientCheckNameAvailabilities") - public interface CheckNameAvailabilitiesService { - @Post("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.OperationTemplates/checkNameAvailability") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> checkGlobal(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") CheckNameAvailabilityRequest body, Context context); - - @Post("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.OperationTemplates/checkNameAvailability") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response checkGlobalSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") CheckNameAvailabilityRequest body, Context context); - - @Post("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.OperationTemplates/locations/{location}/checkNameAvailability") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> checkLocal(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") CheckNameAvailabilityRequest body, - Context context); - - @Post("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.OperationTemplates/locations/{location}/checkNameAvailability") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response checkLocalSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") CheckNameAvailabilityRequest body, - Context context); - } - - /** - * Implements global CheckNameAvailability operations. - * - * @param body The CheckAvailability request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - checkGlobalWithResponseAsync(CheckNameAvailabilityRequest body) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.checkGlobal(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), contentType, accept, body, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Implements global CheckNameAvailability operations. - * - * @param body The CheckAvailability request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono checkGlobalAsync(CheckNameAvailabilityRequest body) { - return checkGlobalWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Implements global CheckNameAvailability operations. - * - * @param body The CheckAvailability request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response checkGlobalWithResponse(CheckNameAvailabilityRequest body, - Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.checkGlobalSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), contentType, accept, body, context); - } - - /** - * Implements global CheckNameAvailability operations. - * - * @param body The CheckAvailability request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CheckNameAvailabilityResponseInner checkGlobal(CheckNameAvailabilityRequest body) { - return checkGlobalWithResponse(body, Context.NONE).getValue(); - } - - /** - * Implements local CheckNameAvailability operations. - * - * @param location The name of the Azure region. - * @param body The CheckAvailability request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> checkLocalWithResponseAsync(String location, - CheckNameAvailabilityRequest body) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.checkLocal(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, contentType, accept, body, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Implements local CheckNameAvailability operations. - * - * @param location The name of the Azure region. - * @param body The CheckAvailability request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono checkLocalAsync(String location, - CheckNameAvailabilityRequest body) { - return checkLocalWithResponseAsync(location, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Implements local CheckNameAvailability operations. - * - * @param location The name of the Azure region. - * @param body The CheckAvailability request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response checkLocalWithResponse(String location, - CheckNameAvailabilityRequest body, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.checkLocalSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, contentType, accept, body, context); - } - - /** - * Implements local CheckNameAvailability operations. - * - * @param location The name of the Azure region. - * @param body The CheckAvailability request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CheckNameAvailabilityResponseInner checkLocal(String location, CheckNameAvailabilityRequest body) { - return checkLocalWithResponse(location, body, Context.NONE).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesImpl.java deleted file mode 100644 index bba72824e04..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient; -import azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner; -import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilities; -import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityRequest; -import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class CheckNameAvailabilitiesImpl implements CheckNameAvailabilities { - private static final ClientLogger LOGGER = new ClientLogger(CheckNameAvailabilitiesImpl.class); - - private final CheckNameAvailabilitiesClient innerClient; - - private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; - - public CheckNameAvailabilitiesImpl(CheckNameAvailabilitiesClient innerClient, - azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response checkGlobalWithResponse(CheckNameAvailabilityRequest body, - Context context) { - Response inner - = this.serviceClient().checkGlobalWithResponse(body, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public CheckNameAvailabilityResponse checkGlobal(CheckNameAvailabilityRequest body) { - CheckNameAvailabilityResponseInner inner = this.serviceClient().checkGlobal(body); - if (inner != null) { - return new CheckNameAvailabilityResponseImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response checkLocalWithResponse(String location, - CheckNameAvailabilityRequest body, Context context) { - Response inner - = this.serviceClient().checkLocalWithResponse(location, body, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public CheckNameAvailabilityResponse checkLocal(String location, CheckNameAvailabilityRequest body) { - CheckNameAvailabilityResponseInner inner = this.serviceClient().checkLocal(location, body); - if (inner != null) { - return new CheckNameAvailabilityResponseImpl(inner, this.manager()); - } else { - return null; - } - } - - private CheckNameAvailabilitiesClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilityResponseImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilityResponseImpl.java deleted file mode 100644 index af6750562f7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilityResponseImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner; -import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityReason; -import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityResponse; - -public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { - private CheckNameAvailabilityResponseInner innerObject; - - private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; - - CheckNameAvailabilityResponseImpl(CheckNameAvailabilityResponseInner innerObject, - azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public Boolean nameAvailable() { - return this.innerModel().nameAvailable(); - } - - public CheckNameAvailabilityReason reason() { - return this.innerModel().reason(); - } - - public String message() { - return this.innerModel().message(); - } - - public CheckNameAvailabilityResponseInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ExportResultImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ExportResultImpl.java deleted file mode 100644 index 3170b71ca11..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ExportResultImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner; -import azure.resourcemanager.operationtemplates.models.ExportResult; - -public final class ExportResultImpl implements ExportResult { - private ExportResultInner innerObject; - - private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; - - ExportResultImpl(ExportResultInner innerObject, - azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String content() { - return this.innerModel().content(); - } - - public ExportResultInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesClientImpl.java deleted file mode 100644 index e713f224536..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesClientImpl.java +++ /dev/null @@ -1,618 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.LroesClient; -import azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner; -import azure.resourcemanager.operationtemplates.fluent.models.OrderInner; -import azure.resourcemanager.operationtemplates.models.ExportRequest; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -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.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in LroesClient. - */ -public final class LroesClientImpl implements LroesClient { - /** - * The proxy service used to perform REST calls. - */ - private final LroesService service; - - /** - * The service client containing this operation class. - */ - private final OperationTemplatesClientImpl client; - - /** - * Initializes an instance of LroesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - LroesClientImpl(OperationTemplatesClientImpl client) { - this.service = RestProxy.create(LroesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OperationTemplatesClientLroes to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OperationTemplatesClientLroes") - public interface LroesService { - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/orders/{orderName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrReplace(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("orderName") String orderName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") OrderInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/orders/{orderName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrReplaceSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("orderName") String orderName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") OrderInner resource, Context context); - - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/orders/{orderName}/export") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> export(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("orderName") String orderName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ExportRequest body, Context context); - - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/orders/{orderName}/export") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response exportSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("orderName") String orderName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ExportRequest body, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/orders/{orderName}") - @ExpectedResponses({ 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("orderName") String orderName, - Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/orders/{orderName}") - @ExpectedResponses({ 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("orderName") String orderName, - Context context); - } - - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, - String orderName, OrderInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, orderName, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrReplaceWithResponse(String resourceGroupName, String orderName, - OrderInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, orderName, contentType, accept, resource, Context.NONE); - } - - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrReplaceWithResponse(String resourceGroupName, String orderName, - OrderInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, orderName, contentType, accept, resource, context); - } - - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, OrderInner> beginCreateOrReplaceAsync(String resourceGroupName, - String orderName, OrderInner resource) { - Mono>> mono - = createOrReplaceWithResponseAsync(resourceGroupName, orderName, resource); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), OrderInner.class, - OrderInner.class, this.client.getContext()); - } - - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, OrderInner> beginCreateOrReplace(String resourceGroupName, - String orderName, OrderInner resource) { - Response response = createOrReplaceWithResponse(resourceGroupName, orderName, resource); - return this.client.getLroResult(response, OrderInner.class, OrderInner.class, - Context.NONE); - } - - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, OrderInner> beginCreateOrReplace(String resourceGroupName, - String orderName, OrderInner resource, Context context) { - Response response = createOrReplaceWithResponse(resourceGroupName, orderName, resource, context); - return this.client.getLroResult(response, OrderInner.class, OrderInner.class, context); - } - - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrReplaceAsync(String resourceGroupName, String orderName, OrderInner resource) { - return beginCreateOrReplaceAsync(resourceGroupName, orderName, resource).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public OrderInner createOrReplace(String resourceGroupName, String orderName, OrderInner resource) { - return beginCreateOrReplace(resourceGroupName, orderName, resource).getFinalResult(); - } - - /** - * Create a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public OrderInner createOrReplace(String resourceGroupName, String orderName, OrderInner resource, - Context context) { - return beginCreateOrReplace(resourceGroupName, orderName, resource, context).getFinalResult(); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> exportWithResponseAsync(String resourceGroupName, String orderName, - ExportRequest body) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.export(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, orderName, contentType, accept, body, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response exportWithResponse(String resourceGroupName, String orderName, ExportRequest body) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.exportSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, orderName, contentType, accept, body, Context.NONE); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response exportWithResponse(String resourceGroupName, String orderName, ExportRequest body, - Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.exportSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, orderName, contentType, accept, body, context); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ExportResultInner> beginExportAsync(String resourceGroupName, - String orderName, ExportRequest body) { - Mono>> mono = exportWithResponseAsync(resourceGroupName, orderName, body); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - ExportResultInner.class, ExportResultInner.class, this.client.getContext()); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ExportResultInner> beginExport(String resourceGroupName, - String orderName, ExportRequest body) { - Response response = exportWithResponse(resourceGroupName, orderName, body); - return this.client.getLroResult(response, ExportResultInner.class, - ExportResultInner.class, Context.NONE); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ExportResultInner> beginExport(String resourceGroupName, - String orderName, ExportRequest body, Context context) { - Response response = exportWithResponse(resourceGroupName, orderName, body, context); - return this.client.getLroResult(response, ExportResultInner.class, - ExportResultInner.class, context); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono exportAsync(String resourceGroupName, String orderName, ExportRequest body) { - return beginExportAsync(resourceGroupName, orderName, body).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 ExportResultInner export(String resourceGroupName, String orderName, ExportRequest body) { - return beginExport(resourceGroupName, orderName, body).getFinalResult(); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 ExportResultInner export(String resourceGroupName, String orderName, ExportRequest body, Context context) { - return beginExport(resourceGroupName, orderName, body, context).getFinalResult(); - } - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String orderName) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, orderName, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceGroupName, String orderName) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, orderName, Context.NONE); - } - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceGroupName, String orderName, Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, orderName, context); - } - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String orderName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, orderName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); - } - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String orderName) { - Response response = deleteWithResponse(resourceGroupName, orderName); - return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); - } - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String orderName, Context context) { - Response response = deleteWithResponse(resourceGroupName, orderName, context); - return this.client.getLroResult(response, Void.class, Void.class, context); - } - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String orderName) { - return beginDeleteAsync(resourceGroupName, orderName).last().flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String orderName) { - beginDelete(resourceGroupName, orderName).getFinalResult(); - } - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String orderName, Context context) { - beginDelete(resourceGroupName, orderName, context).getFinalResult(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesImpl.java deleted file mode 100644 index b528a783464..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.LroesClient; -import azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner; -import azure.resourcemanager.operationtemplates.models.ExportRequest; -import azure.resourcemanager.operationtemplates.models.ExportResult; -import azure.resourcemanager.operationtemplates.models.Lroes; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class LroesImpl implements Lroes { - private static final ClientLogger LOGGER = new ClientLogger(LroesImpl.class); - - private final LroesClient innerClient; - - private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; - - public LroesImpl(LroesClient innerClient, - azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public ExportResult export(String resourceGroupName, String orderName, ExportRequest body) { - ExportResultInner inner = this.serviceClient().export(resourceGroupName, orderName, body); - if (inner != null) { - return new ExportResultImpl(inner, this.manager()); - } else { - return null; - } - } - - public ExportResult export(String resourceGroupName, String orderName, ExportRequest body, Context context) { - ExportResultInner inner = this.serviceClient().export(resourceGroupName, orderName, body, context); - if (inner != null) { - return new ExportResultImpl(inner, this.manager()); - } else { - return null; - } - } - - public void deleteByResourceGroup(String resourceGroupName, String orderName) { - this.serviceClient().delete(resourceGroupName, orderName); - } - - public void delete(String resourceGroupName, String orderName, Context context) { - this.serviceClient().delete(resourceGroupName, orderName, context); - } - - public void deleteById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String orderName = ResourceManagerUtils.getValueFromIdByName(id, "orders"); - if (orderName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'orders'.", id))); - } - this.delete(resourceGroupName, orderName, Context.NONE); - } - - public void deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String orderName = ResourceManagerUtils.getValueFromIdByName(id, "orders"); - if (orderName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'orders'.", id))); - } - this.delete(resourceGroupName, orderName, context); - } - - private LroesClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { - return this.serviceManager; - } - - public OrderImpl define(String name) { - return new OrderImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationImpl.java deleted file mode 100644 index 9c65f9a5f59..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.models.OperationInner; -import azure.resourcemanager.operationtemplates.models.ActionType; -import azure.resourcemanager.operationtemplates.models.Operation; -import azure.resourcemanager.operationtemplates.models.OperationDisplay; -import azure.resourcemanager.operationtemplates.models.Origin; - -public final class OperationImpl implements Operation { - private OperationInner innerObject; - - private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; - - OperationImpl(OperationInner innerObject, - azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String name() { - return this.innerModel().name(); - } - - public Boolean isDataAction() { - return this.innerModel().isDataAction(); - } - - public OperationDisplay display() { - return this.innerModel().display(); - } - - public Origin origin() { - return this.innerModel().origin(); - } - - public ActionType actionType() { - return this.innerModel().actionType(); - } - - public OperationInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientBuilder.java deleted file mode 100644 index bc9c3f5d43d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** - * A builder for creating a new instance of the OperationTemplatesClientImpl type. - */ -@ServiceClientBuilder(serviceClients = { OperationTemplatesClientImpl.class }) -public final class OperationTemplatesClientBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the OperationTemplatesClientBuilder. - */ - public OperationTemplatesClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The ID of the target subscription. The value must be an UUID. - */ - private String subscriptionId; - - /** - * Sets The ID of the target subscription. The value must be an UUID. - * - * @param subscriptionId the subscriptionId value. - * @return the OperationTemplatesClientBuilder. - */ - public OperationTemplatesClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the OperationTemplatesClientBuilder. - */ - public OperationTemplatesClientBuilder environment(AzureEnvironment environment) { - this.environment = environment; - 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 OperationTemplatesClientBuilder. - */ - public OperationTemplatesClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the OperationTemplatesClientBuilder. - */ - public OperationTemplatesClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - 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 OperationTemplatesClientBuilder. - */ - public OperationTemplatesClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of OperationTemplatesClientImpl with the provided parameters. - * - * @return an instance of OperationTemplatesClientImpl. - */ - public OperationTemplatesClientImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval - = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - OperationTemplatesClientImpl client = new OperationTemplatesClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientImpl.java deleted file mode 100644 index f6db0b30d4c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientImpl.java +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient; -import azure.resourcemanager.operationtemplates.fluent.LroesClient; -import azure.resourcemanager.operationtemplates.fluent.OperationTemplatesClient; -import azure.resourcemanager.operationtemplates.fluent.OperationsClient; -import azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.management.polling.SyncPollerFactory; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the OperationTemplatesClientImpl type. - */ -@ServiceClient(builder = OperationTemplatesClientBuilder.class) -public final class OperationTemplatesClientImpl implements OperationTemplatesClient { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Version parameter. - */ - private final String apiVersion; - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * The ID of the target subscription. The value must be an UUID. - */ - private final String subscriptionId; - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * 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. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The OperationsClient object to access its operations. - */ - private final OperationsClient operations; - - /** - * Gets the OperationsClient object to access its operations. - * - * @return the OperationsClient object. - */ - public OperationsClient getOperations() { - return this.operations; - } - - /** - * The CheckNameAvailabilitiesClient object to access its operations. - */ - private final CheckNameAvailabilitiesClient checkNameAvailabilities; - - /** - * Gets the CheckNameAvailabilitiesClient object to access its operations. - * - * @return the CheckNameAvailabilitiesClient object. - */ - public CheckNameAvailabilitiesClient getCheckNameAvailabilities() { - return this.checkNameAvailabilities; - } - - /** - * The LroesClient object to access its operations. - */ - private final LroesClient lroes; - - /** - * Gets the LroesClient object to access its operations. - * - * @return the LroesClient object. - */ - public LroesClient getLroes() { - return this.lroes; - } - - /** - * The OptionalBodiesClient object to access its operations. - */ - private final OptionalBodiesClient optionalBodies; - - /** - * Gets the OptionalBodiesClient object to access its operations. - * - * @return the OptionalBodiesClient object. - */ - public OptionalBodiesClient getOptionalBodies() { - return this.optionalBodies; - } - - /** - * Initializes an instance of OperationTemplatesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - OperationTemplatesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.apiVersion = "2023-12-01-preview"; - this.operations = new OperationsClientImpl(this); - this.checkNameAvailabilities = new CheckNameAvailabilitiesClientImpl(this); - this.lroes = new LroesClientImpl(this); - this.optionalBodies = new OptionalBodiesClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return SyncPoller for poll result and final result. - */ - public SyncPoller, U> getLroResult(Response activationResponse, - Type pollResultType, Type finalResultType, Context context) { - return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, () -> activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(OperationTemplatesClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsClientImpl.java deleted file mode 100644 index 6a7eceedfab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsClientImpl.java +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.OperationsClient; -import azure.resourcemanager.operationtemplates.fluent.models.OperationInner; -import azure.resourcemanager.operationtemplates.implementation.models.OperationListResult; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -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.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in OperationsClient. - */ -public final class OperationsClientImpl implements OperationsClient { - /** - * The proxy service used to perform REST calls. - */ - private final OperationsService service; - - /** - * The service client containing this operation class. - */ - private final OperationTemplatesClientImpl client; - - /** - * Initializes an instance of OperationsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - OperationsClientImpl(OperationTemplatesClientImpl client) { - this.service - = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OperationTemplatesClientOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OperationTemplatesClientOperations") - public interface OperationsService { - @Headers({ "Content-Type: application/json" }) - @Get("/providers/Azure.ResourceManager.OperationTemplates/operations") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/providers/Azure.ResourceManager.OperationTemplates/operations") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); - } - - /** - * List the operations for the provider. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List the operations for the provider. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * List the operations for the provider. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage() { - final String accept = "application/json"; - Response res - = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List the operations for the provider. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(Context context) { - final String accept = "application/json"; - Response res - = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List the operations for the provider. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); - } - - /** - * List the operations for the provider. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listNextSinglePage(String nextLink, Context context) { - final String accept = "application/json"; - Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsImpl.java deleted file mode 100644 index 387ffe7c33e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.OperationsClient; -import azure.resourcemanager.operationtemplates.fluent.models.OperationInner; -import azure.resourcemanager.operationtemplates.models.Operation; -import azure.resourcemanager.operationtemplates.models.Operations; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class OperationsImpl implements Operations { - private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); - - private final OperationsClient innerClient; - - private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; - - public OperationsImpl(OperationsClient innerClient, - azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); - } - - private OperationsClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesClientImpl.java deleted file mode 100644 index 69ac5b5b9cd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesClientImpl.java +++ /dev/null @@ -1,423 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient; -import azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner; -import azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner; -import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; -import azure.resourcemanager.operationtemplates.models.ActionRequest; -import azure.resourcemanager.operationtemplates.models.ChangeAllowanceRequest; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in OptionalBodiesClient. - */ -public final class OptionalBodiesClientImpl implements OptionalBodiesClient { - /** - * The proxy service used to perform REST calls. - */ - private final OptionalBodiesService service; - - /** - * The service client containing this operation class. - */ - private final OperationTemplatesClientImpl client; - - /** - * Initializes an instance of OptionalBodiesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - OptionalBodiesClientImpl(OperationTemplatesClientImpl client) { - this.service - = RestProxy.create(OptionalBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OperationTemplatesClientOptionalBodies to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OperationTemplatesClientOptionalBodies") - public interface OptionalBodiesService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/widgets/{widgetName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("widgetName") String widgetName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/widgets/{widgetName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("widgetName") String widgetName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/widgets/{widgetName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> patch(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("widgetName") String widgetName, - @HeaderParam("Accept") String accept, @BodyParam("application/json") WidgetInner properties, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/widgets/{widgetName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response patchSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("widgetName") String widgetName, - @HeaderParam("Accept") String accept, @BodyParam("application/json") WidgetInner properties, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/widgets/{widgetName}/post") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> post(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("widgetName") String widgetName, - @HeaderParam("Accept") String accept, @BodyParam("application/json") ActionRequest body, Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/widgets/{widgetName}/post") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response postSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("widgetName") String widgetName, - @HeaderParam("Accept") String accept, @BodyParam("application/json") ActionRequest body, Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.OperationTemplates/providerPost") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> providerPost(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, @BodyParam("application/json") ChangeAllowanceRequest body, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.OperationTemplates/providerPost") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response providerPostSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, @BodyParam("application/json") ChangeAllowanceRequest body, - Context context); - } - - /** - * Get a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Widget along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String widgetName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, widgetName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Widget on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, String widgetName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, widgetName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Widget along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, String widgetName, - Context context) { - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, widgetName, accept, context); - } - - /** - * Get a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Widget. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public WidgetInner getByResourceGroup(String resourceGroupName, String widgetName) { - return getByResourceGroupWithResponse(resourceGroupName, widgetName, Context.NONE).getValue(); - } - - /** - * Update a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> patchWithResponseAsync(String resourceGroupName, String widgetName, - WidgetInner properties) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.patch(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, widgetName, accept, properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono patchAsync(String resourceGroupName, String widgetName) { - final WidgetInner properties = null; - return patchWithResponseAsync(resourceGroupName, widgetName, properties) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Update a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchWithResponse(String resourceGroupName, String widgetName, WidgetInner properties, - Context context) { - final String accept = "application/json"; - return service.patchSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, widgetName, accept, properties, context); - } - - /** - * Update a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public WidgetInner patch(String resourceGroupName, String widgetName) { - final WidgetInner properties = null; - return patchWithResponse(resourceGroupName, widgetName, properties, Context.NONE).getValue(); - } - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> postWithResponseAsync(String resourceGroupName, String widgetName, - ActionRequest body) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.post(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, widgetName, accept, body, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono postAsync(String resourceGroupName, String widgetName) { - final ActionRequest body = null; - return postWithResponseAsync(resourceGroupName, widgetName, body) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postWithResponse(String resourceGroupName, String widgetName, ActionRequest body, - Context context) { - final String accept = "application/json"; - return service.postSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, widgetName, accept, body, context); - } - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 ActionResultInner post(String resourceGroupName, String widgetName) { - final ActionRequest body = null; - return postWithResponse(resourceGroupName, widgetName, body, Context.NONE).getValue(); - } - - /** - * The providerPost operation. - * - * @param body The request body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> providerPostWithResponseAsync(ChangeAllowanceRequest body) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.providerPost(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, body, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * The providerPost operation. - * - * @throws ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono providerPostAsync() { - final ChangeAllowanceRequest body = null; - return providerPostWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The providerPost operation. - * - * @param body The request body. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response providerPostWithResponse(ChangeAllowanceRequest body, Context context) { - final String accept = "application/json"; - return service.providerPostSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, body, context); - } - - /** - * The providerPost operation. - * - * @throws ManagementException 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 ChangeAllowanceResultInner providerPost() { - final ChangeAllowanceRequest body = null; - return providerPostWithResponse(body, Context.NONE).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesImpl.java deleted file mode 100644 index 1395adf37aa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesImpl.java +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient; -import azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner; -import azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner; -import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; -import azure.resourcemanager.operationtemplates.models.ActionRequest; -import azure.resourcemanager.operationtemplates.models.ActionResult; -import azure.resourcemanager.operationtemplates.models.ChangeAllowanceRequest; -import azure.resourcemanager.operationtemplates.models.ChangeAllowanceResult; -import azure.resourcemanager.operationtemplates.models.OptionalBodies; -import azure.resourcemanager.operationtemplates.models.Widget; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class OptionalBodiesImpl implements OptionalBodies { - private static final ClientLogger LOGGER = new ClientLogger(OptionalBodiesImpl.class); - - private final OptionalBodiesClient innerClient; - - private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; - - public OptionalBodiesImpl(OptionalBodiesClient innerClient, - azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, String widgetName, - Context context) { - Response inner - = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, widgetName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new WidgetImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public Widget getByResourceGroup(String resourceGroupName, String widgetName) { - WidgetInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, widgetName); - if (inner != null) { - return new WidgetImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response patchWithResponse(String resourceGroupName, String widgetName, WidgetInner properties, - Context context) { - Response inner - = this.serviceClient().patchWithResponse(resourceGroupName, widgetName, properties, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new WidgetImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public Widget patch(String resourceGroupName, String widgetName) { - WidgetInner inner = this.serviceClient().patch(resourceGroupName, widgetName); - if (inner != null) { - return new WidgetImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response postWithResponse(String resourceGroupName, String widgetName, ActionRequest body, - Context context) { - Response inner - = this.serviceClient().postWithResponse(resourceGroupName, widgetName, body, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ActionResultImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public ActionResult post(String resourceGroupName, String widgetName) { - ActionResultInner inner = this.serviceClient().post(resourceGroupName, widgetName); - if (inner != null) { - return new ActionResultImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response providerPostWithResponse(ChangeAllowanceRequest body, Context context) { - Response inner = this.serviceClient().providerPostWithResponse(body, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ChangeAllowanceResultImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public ChangeAllowanceResult providerPost() { - ChangeAllowanceResultInner inner = this.serviceClient().providerPost(); - if (inner != null) { - return new ChangeAllowanceResultImpl(inner, this.manager()); - } else { - return null; - } - } - - private OptionalBodiesClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OrderImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OrderImpl.java deleted file mode 100644 index ff8fba0c5a5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OrderImpl.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.models.OrderInner; -import azure.resourcemanager.operationtemplates.models.ExportRequest; -import azure.resourcemanager.operationtemplates.models.ExportResult; -import azure.resourcemanager.operationtemplates.models.Order; -import azure.resourcemanager.operationtemplates.models.OrderProperties; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Collections; -import java.util.Map; - -public final class OrderImpl implements Order, Order.Definition { - private OrderInner innerObject; - - private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; - - OrderImpl(OrderInner innerObject, - azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public OrderProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public OrderInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { - return this.serviceManager; - } - - private String resourceGroupName; - - private String orderName; - - public OrderImpl withExistingResourceGroup(String resourceGroupName) { - this.resourceGroupName = resourceGroupName; - return this; - } - - public Order create() { - this.innerObject = serviceManager.serviceClient() - .getLroes() - .createOrReplace(resourceGroupName, orderName, this.innerModel(), Context.NONE); - return this; - } - - public Order create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getLroes() - .createOrReplace(resourceGroupName, orderName, this.innerModel(), context); - return this; - } - - OrderImpl(String name, azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { - this.innerObject = new OrderInner(); - this.serviceManager = serviceManager; - this.orderName = name; - } - - public ExportResult export(ExportRequest body) { - return serviceManager.lroes().export(resourceGroupName, orderName, body); - } - - public ExportResult export(ExportRequest body, Context context) { - return serviceManager.lroes().export(resourceGroupName, orderName, body, context); - } - - public OrderImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); - return this; - } - - public OrderImpl withRegion(String location) { - this.innerModel().withLocation(location); - return this; - } - - public OrderImpl withTags(Map tags) { - this.innerModel().withTags(tags); - return this; - } - - public OrderImpl withProperties(OrderProperties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ResourceManagerUtils.java deleted file mode 100644 index 3cc05aedfd5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ResourceManagerUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -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.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class ResourceManagerUtils { - private ResourceManagerUtils() { - } - - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (!segments.isEmpty() && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl<>(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux - .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(iterable.iterator(), mapper); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/WidgetImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/WidgetImpl.java deleted file mode 100644 index 96cf7ce8cef..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/WidgetImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation; - -import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; -import azure.resourcemanager.operationtemplates.models.Widget; -import azure.resourcemanager.operationtemplates.models.WidgetProperties; -import com.azure.core.management.SystemData; -import java.util.Collections; -import java.util.Map; - -public final class WidgetImpl implements Widget { - private WidgetInner innerObject; - - private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; - - WidgetImpl(WidgetInner innerObject, - azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public WidgetProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public WidgetInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/models/OperationListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/models/OperationListResult.java deleted file mode 100644 index 89acab6b398..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/models/OperationListResult.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.implementation.models; - -import azure.resourcemanager.operationtemplates.fluent.models.OperationInner; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of - * results. - */ -@Immutable -public final class OperationListResult implements JsonSerializable { - /* - * The Operation items on this page - */ - private List value; - - /* - * The link to the next page of items - */ - private String nextLink; - - /** - * Creates an instance of OperationListResult class. - */ - private OperationListResult() { - } - - /** - * Get the value property: The Operation items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OperationListResult. - */ - public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationListResult deserializedOperationListResult = new OperationListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); - deserializedOperationListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedOperationListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOperationListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/package-info.java deleted file mode 100644 index fd1cf178054..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the implementations for OperationTemplates. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.operationtemplates.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionRequest.java deleted file mode 100644 index 8376965746a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionRequest.java +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ActionRequest model. - */ -@Fluent -public final class ActionRequest implements JsonSerializable { - /* - * The action type to perform. - */ - private String actionType; - - /* - * Additional action parameters. - */ - private String parameters; - - /** - * Creates an instance of ActionRequest class. - */ - public ActionRequest() { - } - - /** - * Get the actionType property: The action type to perform. - * - * @return the actionType value. - */ - public String actionType() { - return this.actionType; - } - - /** - * Set the actionType property: The action type to perform. - * - * @param actionType the actionType value to set. - * @return the ActionRequest object itself. - */ - public ActionRequest withActionType(String actionType) { - this.actionType = actionType; - return this; - } - - /** - * Get the parameters property: Additional action parameters. - * - * @return the parameters value. - */ - public String parameters() { - return this.parameters; - } - - /** - * Set the parameters property: Additional action parameters. - * - * @param parameters the parameters value to set. - * @return the ActionRequest object itself. - */ - public ActionRequest withParameters(String parameters) { - this.parameters = parameters; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("actionType", this.actionType); - jsonWriter.writeStringField("parameters", this.parameters); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ActionRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ActionRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the ActionRequest. - */ - public static ActionRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ActionRequest deserializedActionRequest = new ActionRequest(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("actionType".equals(fieldName)) { - deserializedActionRequest.actionType = reader.getString(); - } else if ("parameters".equals(fieldName)) { - deserializedActionRequest.parameters = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedActionRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionResult.java deleted file mode 100644 index 8fa33c36ecd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionResult.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner; - -/** - * An immutable client-side representation of ActionResult. - */ -public interface ActionResult { - /** - * Gets the result property: The result of the action. - * - * @return the result value. - */ - String result(); - - /** - * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner object. - * - * @return the inner object. - */ - ActionResultInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionType.java deleted file mode 100644 index 4f43f52a489..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionType.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - */ -public final class ActionType extends ExpandableStringEnum { - /** - * Actions are for internal-only APIs. - */ - public static final ActionType INTERNAL = fromString("Internal"); - - /** - * Creates a new instance of ActionType value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ActionType() { - } - - /** - * Creates or finds a ActionType from its string representation. - * - * @param name a name to look for. - * @return the corresponding ActionType. - */ - public static ActionType fromString(String name) { - return fromString(name, ActionType.class); - } - - /** - * Gets known ActionType values. - * - * @return known ActionType values. - */ - public static Collection values() { - return values(ActionType.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceRequest.java deleted file mode 100644 index 0b01dfb9d39..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceRequest.java +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ChangeAllowanceRequest model. - */ -@Fluent -public final class ChangeAllowanceRequest implements JsonSerializable { - /* - * The new total allowed widgets. - */ - private Integer totalAllowed; - - /* - * The reason for the change. - */ - private String reason; - - /** - * Creates an instance of ChangeAllowanceRequest class. - */ - public ChangeAllowanceRequest() { - } - - /** - * Get the totalAllowed property: The new total allowed widgets. - * - * @return the totalAllowed value. - */ - public Integer totalAllowed() { - return this.totalAllowed; - } - - /** - * Set the totalAllowed property: The new total allowed widgets. - * - * @param totalAllowed the totalAllowed value to set. - * @return the ChangeAllowanceRequest object itself. - */ - public ChangeAllowanceRequest withTotalAllowed(Integer totalAllowed) { - this.totalAllowed = totalAllowed; - return this; - } - - /** - * Get the reason property: The reason for the change. - * - * @return the reason value. - */ - public String reason() { - return this.reason; - } - - /** - * Set the reason property: The reason for the change. - * - * @param reason the reason value to set. - * @return the ChangeAllowanceRequest object itself. - */ - public ChangeAllowanceRequest withReason(String reason) { - this.reason = reason; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("totalAllowed", this.totalAllowed); - jsonWriter.writeStringField("reason", this.reason); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChangeAllowanceRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChangeAllowanceRequest if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the ChangeAllowanceRequest. - */ - public static ChangeAllowanceRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ChangeAllowanceRequest deserializedChangeAllowanceRequest = new ChangeAllowanceRequest(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("totalAllowed".equals(fieldName)) { - deserializedChangeAllowanceRequest.totalAllowed = reader.getNullable(JsonReader::getInt); - } else if ("reason".equals(fieldName)) { - deserializedChangeAllowanceRequest.reason = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedChangeAllowanceRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceResult.java deleted file mode 100644 index 626f08877e5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceResult.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner; - -/** - * An immutable client-side representation of ChangeAllowanceResult. - */ -public interface ChangeAllowanceResult { - /** - * Gets the totalAllowed property: The new total allowed widgets. - * - * @return the totalAllowed value. - */ - int totalAllowed(); - - /** - * Gets the status property: The status of the change. - * - * @return the status value. - */ - String status(); - - /** - * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner object. - * - * @return the inner object. - */ - ChangeAllowanceResultInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilities.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilities.java deleted file mode 100644 index a4daf298951..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilities.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of CheckNameAvailabilities. - */ -public interface CheckNameAvailabilities { - /** - * Implements global CheckNameAvailability operations. - * - * @param body The CheckAvailability request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result along with {@link Response}. - */ - Response checkGlobalWithResponse(CheckNameAvailabilityRequest body, Context context); - - /** - * Implements global CheckNameAvailability operations. - * - * @param body The CheckAvailability request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result. - */ - CheckNameAvailabilityResponse checkGlobal(CheckNameAvailabilityRequest body); - - /** - * Implements local CheckNameAvailability operations. - * - * @param location The name of the Azure region. - * @param body The CheckAvailability request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result along with {@link Response}. - */ - Response checkLocalWithResponse(String location, CheckNameAvailabilityRequest body, - Context context); - - /** - * Implements local CheckNameAvailability operations. - * - * @param location The name of the Azure region. - * @param body The CheckAvailability request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the check availability result. - */ - CheckNameAvailabilityResponse checkLocal(String location, CheckNameAvailabilityRequest body); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityReason.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityReason.java deleted file mode 100644 index 1e2fc96ba7b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityReason.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Possible reasons for a name not being available. - */ -public final class CheckNameAvailabilityReason extends ExpandableStringEnum { - /** - * Name is invalid. - */ - public static final CheckNameAvailabilityReason INVALID = fromString("Invalid"); - - /** - * Name already exists. - */ - public static final CheckNameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); - - /** - * Creates a new instance of CheckNameAvailabilityReason value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public CheckNameAvailabilityReason() { - } - - /** - * Creates or finds a CheckNameAvailabilityReason from its string representation. - * - * @param name a name to look for. - * @return the corresponding CheckNameAvailabilityReason. - */ - public static CheckNameAvailabilityReason fromString(String name) { - return fromString(name, CheckNameAvailabilityReason.class); - } - - /** - * Gets known CheckNameAvailabilityReason values. - * - * @return known CheckNameAvailabilityReason values. - */ - public static Collection values() { - return values(CheckNameAvailabilityReason.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityRequest.java deleted file mode 100644 index 262b02efd9f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityRequest.java +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The check availability request body. - */ -@Fluent -public final class CheckNameAvailabilityRequest implements JsonSerializable { - /* - * The name of the resource for which availability needs to be checked. - */ - private String name; - - /* - * The resource type. - */ - private String type; - - /** - * Creates an instance of CheckNameAvailabilityRequest class. - */ - public CheckNameAvailabilityRequest() { - } - - /** - * Get the name property: The name of the resource for which availability needs to be checked. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name of the resource for which availability needs to be checked. - * - * @param name the name value to set. - * @return the CheckNameAvailabilityRequest object itself. - */ - public CheckNameAvailabilityRequest withName(String name) { - this.name = name; - return this; - } - - /** - * Get the type property: The resource type. - * - * @return the type value. - */ - public String type() { - return this.type; - } - - /** - * Set the type property: The resource type. - * - * @param type the type value to set. - * @return the CheckNameAvailabilityRequest object itself. - */ - public CheckNameAvailabilityRequest withType(String type) { - this.type = type; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("type", this.type); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CheckNameAvailabilityRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CheckNameAvailabilityRequest if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the CheckNameAvailabilityRequest. - */ - public static CheckNameAvailabilityRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CheckNameAvailabilityRequest deserializedCheckNameAvailabilityRequest = new CheckNameAvailabilityRequest(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedCheckNameAvailabilityRequest.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedCheckNameAvailabilityRequest.type = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedCheckNameAvailabilityRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityResponse.java deleted file mode 100644 index 46c6eb9876f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner; - -/** - * An immutable client-side representation of CheckNameAvailabilityResponse. - */ -public interface CheckNameAvailabilityResponse { - /** - * Gets the nameAvailable property: Indicates if the resource name is available. - * - * @return the nameAvailable value. - */ - Boolean nameAvailable(); - - /** - * Gets the reason property: The reason why the given name is not available. - * - * @return the reason value. - */ - CheckNameAvailabilityReason reason(); - - /** - * Gets the message property: Detailed reason why the given name is not available. - * - * @return the message value. - */ - String message(); - - /** - * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner object. - * - * @return the inner object. - */ - CheckNameAvailabilityResponseInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportRequest.java deleted file mode 100644 index f4a1e3c8bdb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportRequest.java +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ExportRequest model. - */ -@Fluent -public final class ExportRequest implements JsonSerializable { - /* - * Format of the exported order. - */ - private String format; - - /** - * Creates an instance of ExportRequest class. - */ - public ExportRequest() { - } - - /** - * Get the format property: Format of the exported order. - * - * @return the format value. - */ - public String format() { - return this.format; - } - - /** - * Set the format property: Format of the exported order. - * - * @param format the format value to set. - * @return the ExportRequest object itself. - */ - public ExportRequest withFormat(String format) { - this.format = format; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("format", this.format); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExportRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExportRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExportRequest. - */ - public static ExportRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ExportRequest deserializedExportRequest = new ExportRequest(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("format".equals(fieldName)) { - deserializedExportRequest.format = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedExportRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportResult.java deleted file mode 100644 index 7b1b795b874..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportResult.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner; - -/** - * An immutable client-side representation of ExportResult. - */ -public interface ExportResult { - /** - * Gets the content property: Content of the exported order. - * - * @return the content value. - */ - String content(); - - /** - * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner object. - * - * @return the inner object. - */ - ExportResultInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Lroes.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Lroes.java deleted file mode 100644 index 92398ca748a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Lroes.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.util.Context; - -/** - * Resource collection API of Lroes. - */ -public interface Lroes { - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - ExportResult export(String resourceGroupName, String orderName, ExportRequest body); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - ExportResult export(String resourceGroupName, String orderName, ExportRequest body, Context context); - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String resourceGroupName, String orderName); - - /** - * Delete a Order. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param orderName The name of the Order. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceGroupName, String orderName, Context context); - - /** - * Delete a Order. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a Order. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new Order resource. - * - * @param name resource name. - * @return the first stage of the new Order definition. - */ - Order.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operation.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operation.java deleted file mode 100644 index b38f9e5b438..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operation.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import azure.resourcemanager.operationtemplates.fluent.models.OperationInner; - -/** - * An immutable client-side representation of Operation. - */ -public interface Operation { - /** - * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - * - * @return the name value. - */ - String name(); - - /** - * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane - * operations and "false" for Azure Resource Manager/control-plane operations. - * - * @return the isDataAction value. - */ - Boolean isDataAction(); - - /** - * Gets the display property: Localized display information for this particular operation. - * - * @return the display value. - */ - OperationDisplay display(); - - /** - * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and - * audit logs UX. Default value is "user,system". - * - * @return the origin value. - */ - Origin origin(); - - /** - * Gets the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are - * for internal only APIs. - * - * @return the actionType value. - */ - ActionType actionType(); - - /** - * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.OperationInner object. - * - * @return the inner object. - */ - OperationInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OperationDisplay.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OperationDisplay.java deleted file mode 100644 index 608639b71dc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OperationDisplay.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Localized display information for and operation. - */ -@Immutable -public final class OperationDisplay implements JsonSerializable { - /* - * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or - * "Microsoft Compute". - */ - private String provider; - - /* - * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or - * "Job Schedule Collections". - */ - private String resource; - - /* - * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. - * "Create or Update Virtual Machine", "Restart Virtual Machine". - */ - private String operation; - - /* - * The short, localized friendly description of the operation; suitable for tool tips and detailed views. - */ - private String description; - - /** - * Creates an instance of OperationDisplay class. - */ - private OperationDisplay() { - } - - /** - * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring - * Insights" or "Microsoft Compute". - * - * @return the provider value. - */ - public String provider() { - return this.provider; - } - - /** - * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. - * "Virtual Machines" or "Job Schedule Collections". - * - * @return the resource value. - */ - public String resource() { - return this.resource; - } - - /** - * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. - * "Create or Update Virtual Machine", "Restart Virtual Machine". - * - * @return the operation value. - */ - public String operation() { - return this.operation; - } - - /** - * Get the description property: The short, localized friendly description of the operation; suitable for tool tips - * and detailed views. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationDisplay from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the OperationDisplay. - */ - public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationDisplay deserializedOperationDisplay = new OperationDisplay(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provider".equals(fieldName)) { - deserializedOperationDisplay.provider = reader.getString(); - } else if ("resource".equals(fieldName)) { - deserializedOperationDisplay.resource = reader.getString(); - } else if ("operation".equals(fieldName)) { - deserializedOperationDisplay.operation = reader.getString(); - } else if ("description".equals(fieldName)) { - deserializedOperationDisplay.description = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOperationDisplay; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operations.java deleted file mode 100644 index 64f9736ec02..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operations.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; - -/** - * Resource collection API of Operations. - */ -public interface Operations { - /** - * List the operations for the provider. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - PagedIterable list(); - - /** - * List the operations for the provider. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - PagedIterable list(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OptionalBodies.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OptionalBodies.java deleted file mode 100644 index b6065cad974..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OptionalBodies.java +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of OptionalBodies. - */ -public interface OptionalBodies { - /** - * Get a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Widget along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, String widgetName, Context context); - - /** - * Get a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Widget. - */ - Widget getByResourceGroup(String resourceGroupName, String widgetName); - - /** - * Update a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - Response patchWithResponse(String resourceGroupName, String widgetName, WidgetInner properties, - Context context); - - /** - * Update a Widget. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - Widget patch(String resourceGroupName, String widgetName); - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response}. - */ - Response postWithResponse(String resourceGroupName, String widgetName, ActionRequest body, - Context context); - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param widgetName The name of the Widget. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - ActionResult post(String resourceGroupName, String widgetName); - - /** - * The providerPost operation. - * - * @param body The request body. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response}. - */ - Response providerPostWithResponse(ChangeAllowanceRequest body, Context context); - - /** - * The providerPost operation. - * - * @throws com.azure.core.management.exception.ManagementException 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. - */ - ChangeAllowanceResult providerPost(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Order.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Order.java deleted file mode 100644 index 9155502b9e3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Order.java +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import azure.resourcemanager.operationtemplates.fluent.models.OrderInner; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Map; - -/** - * An immutable client-side representation of Order. - */ -public interface Order { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - OrderProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.OrderInner object. - * - * @return the inner object. - */ - OrderInner innerModel(); - - /** - * The entirety of the Order definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { - } - - /** - * The Order definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the Order definition. - */ - interface Blank extends WithLocation { - } - - /** - * The stage of the Order definition allowing to specify location. - */ - interface WithLocation { - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(Region location); - - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(String location); - } - - /** - * The stage of the Order definition allowing to specify parent resource. - */ - interface WithResourceGroup { - /** - * Specifies resourceGroupName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @return the next definition stage. - */ - WithCreate withExistingResourceGroup(String resourceGroupName); - } - - /** - * The stage of the Order definition which contains all the minimum required properties for the resource to be - * created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - Order create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - Order create(Context context); - } - - /** - * The stage of the Order definition allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - WithCreate withTags(Map tags); - } - - /** - * The stage of the Order definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(OrderProperties properties); - } - } - - /** - * A long-running resource action. - * - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - ExportResult export(ExportRequest body); - - /** - * A long-running resource action. - * - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - ExportResult export(ExportRequest body, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OrderProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OrderProperties.java deleted file mode 100644 index 87e50bd76e0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OrderProperties.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The OrderProperties model. - */ -@Fluent -public final class OrderProperties implements JsonSerializable { - /* - * The product ID of the order. - */ - private String productId; - - /* - * Amount of the product. - */ - private int amount; - - /* - * The provisioning state of the product. - */ - private String provisioningState; - - /** - * Creates an instance of OrderProperties class. - */ - public OrderProperties() { - } - - /** - * Get the productId property: The product ID of the order. - * - * @return the productId value. - */ - public String productId() { - return this.productId; - } - - /** - * Set the productId property: The product ID of the order. - * - * @param productId the productId value to set. - * @return the OrderProperties object itself. - */ - public OrderProperties withProductId(String productId) { - this.productId = productId; - return this; - } - - /** - * Get the amount property: Amount of the product. - * - * @return the amount value. - */ - public int amount() { - return this.amount; - } - - /** - * Set the amount property: Amount of the product. - * - * @param amount the amount value to set. - * @return the OrderProperties object itself. - */ - public OrderProperties withAmount(int amount) { - this.amount = amount; - return this; - } - - /** - * Get the provisioningState property: The provisioning state of the product. - * - * @return the provisioningState value. - */ - public String provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("productId", this.productId); - jsonWriter.writeIntField("amount", this.amount); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OrderProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OrderProperties if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OrderProperties. - */ - public static OrderProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OrderProperties deserializedOrderProperties = new OrderProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("productId".equals(fieldName)) { - deserializedOrderProperties.productId = reader.getString(); - } else if ("amount".equals(fieldName)) { - deserializedOrderProperties.amount = reader.getInt(); - } else if ("provisioningState".equals(fieldName)) { - deserializedOrderProperties.provisioningState = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOrderProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Origin.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Origin.java deleted file mode 100644 index 71894245ffc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Origin.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value - * is "user,system". - */ -public final class Origin extends ExpandableStringEnum { - /** - * Indicates the operation is initiated by a user. - */ - public static final Origin USER = fromString("user"); - - /** - * Indicates the operation is initiated by a system. - */ - public static final Origin SYSTEM = fromString("system"); - - /** - * Indicates the operation is initiated by a user or system. - */ - public static final Origin USER_SYSTEM = fromString("user,system"); - - /** - * Creates a new instance of Origin value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public Origin() { - } - - /** - * Creates or finds a Origin from its string representation. - * - * @param name a name to look for. - * @return the corresponding Origin. - */ - public static Origin fromString(String name) { - return fromString(name, Origin.class); - } - - /** - * Gets known Origin values. - * - * @return known Origin values. - */ - public static Collection values() { - return values(Origin.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Widget.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Widget.java deleted file mode 100644 index 4cfeb469f02..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Widget.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; -import com.azure.core.management.SystemData; -import java.util.Map; - -/** - * An immutable client-side representation of Widget. - */ -public interface Widget { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - WidgetProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.WidgetInner object. - * - * @return the inner object. - */ - WidgetInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/WidgetProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/WidgetProperties.java deleted file mode 100644 index c2e500cd71c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/WidgetProperties.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.operationtemplates.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The WidgetProperties model. - */ -@Fluent -public final class WidgetProperties implements JsonSerializable { - /* - * The name of the widget. - */ - private String name; - - /* - * The description of the widget. - */ - private String description; - - /* - * The provisioning state of the widget. - */ - private String provisioningState; - - /** - * Creates an instance of WidgetProperties class. - */ - public WidgetProperties() { - } - - /** - * Get the name property: The name of the widget. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name of the widget. - * - * @param name the name value to set. - * @return the WidgetProperties object itself. - */ - public WidgetProperties withName(String name) { - this.name = name; - return this; - } - - /** - * Get the description property: The description of the widget. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Set the description property: The description of the widget. - * - * @param description the description value to set. - * @return the WidgetProperties object itself. - */ - public WidgetProperties withDescription(String description) { - this.description = description; - return this; - } - - /** - * Get the provisioningState property: The provisioning state of the widget. - * - * @return the provisioningState value. - */ - public String provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of WidgetProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of WidgetProperties if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the WidgetProperties. - */ - public static WidgetProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - WidgetProperties deserializedWidgetProperties = new WidgetProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedWidgetProperties.name = reader.getString(); - } else if ("description".equals(fieldName)) { - deserializedWidgetProperties.description = reader.getString(); - } else if ("provisioningState".equals(fieldName)) { - deserializedWidgetProperties.provisioningState = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedWidgetProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/package-info.java deleted file mode 100644 index 32a6c3f3337..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the data models for OperationTemplates. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.operationtemplates.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/package-info.java deleted file mode 100644 index 77cea3ac709..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the classes for OperationTemplates. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.operationtemplates; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/ResourcesManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/ResourcesManager.java deleted file mode 100644 index f7583a35939..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/ResourcesManager.java +++ /dev/null @@ -1,346 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources; - -import azure.resourcemanager.resources.fluent.ResourcesClient; -import azure.resourcemanager.resources.implementation.ExtensionsResourcesImpl; -import azure.resourcemanager.resources.implementation.LocationResourcesImpl; -import azure.resourcemanager.resources.implementation.NestedsImpl; -import azure.resourcemanager.resources.implementation.ResourcesClientBuilder; -import azure.resourcemanager.resources.implementation.SingletonsImpl; -import azure.resourcemanager.resources.implementation.TopLevelsImpl; -import azure.resourcemanager.resources.models.ExtensionsResources; -import azure.resourcemanager.resources.models.LocationResources; -import azure.resourcemanager.resources.models.Nesteds; -import azure.resourcemanager.resources.models.Singletons; -import azure.resourcemanager.resources.models.TopLevels; -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * Entry point to ResourcesManager. - * Arm Resource Provider management API. - */ -public final class ResourcesManager { - private TopLevels topLevels; - - private Nesteds nesteds; - - private Singletons singletons; - - private ExtensionsResources extensionsResources; - - private LocationResources locationResources; - - private final ResourcesClient clientObject; - - private ResourcesManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new ResourcesClientBuilder().pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of Resources service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the Resources service API instance. - */ - public static ResourcesManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return configure().authenticate(credential, profile); - } - - /** - * Creates an instance of Resources service API entry point. - * - * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. - * @param profile the Azure profile for client. - * @return the Resources service API instance. - */ - public static ResourcesManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return new ResourcesManager(httpPipeline, profile, null); - } - - /** - * Gets a Configurable instance that can be used to create ResourcesManager with optional configuration. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new ResourcesManager.Configurable(); - } - - /** - * The Configurable allowing configurations to be set. - */ - public static final class Configurable { - private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); - private static final String SDK_VERSION = "version"; - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-resourcemanager-resources-generated.properties"); - - private HttpClient httpClient; - private HttpLogOptions httpLogOptions; - private final List policies = new ArrayList<>(); - private final List scopes = new ArrayList<>(); - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - private Duration defaultPollInterval; - - private Configurable() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - return this; - } - - /** - * Adds the scope to permission sets. - * - * @param scope the scope. - * @return the configurable object itself. - */ - public Configurable withScope(String scope) { - this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); - return this; - } - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - /** - * Sets the default poll interval, used when service does not provide "Retry-After" header. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval - = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of Resources service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the Resources service API instance. - */ - public ResourcesManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder.append("azsdk-java") - .append("-") - .append("azure.resourcemanager.resources") - .append("/") - .append(clientVersion); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder.append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(userAgentBuilder.toString())); - policies.add(new AddHeadersFromContextPolicy()); - policies.add(new RequestIdPolicy()); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy); - policies.add(new AddDatePolicy()); - policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new ResourcesManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * Gets the resource collection API of TopLevels. It manages TopLevelTrackedResource. - * - * @return Resource collection API of TopLevels. - */ - public TopLevels topLevels() { - if (this.topLevels == null) { - this.topLevels = new TopLevelsImpl(clientObject.getTopLevels(), this); - } - return topLevels; - } - - /** - * Gets the resource collection API of Nesteds. It manages NestedProxyResource. - * - * @return Resource collection API of Nesteds. - */ - public Nesteds nesteds() { - if (this.nesteds == null) { - this.nesteds = new NestedsImpl(clientObject.getNesteds(), this); - } - return nesteds; - } - - /** - * Gets the resource collection API of Singletons. - * - * @return Resource collection API of Singletons. - */ - public Singletons singletons() { - if (this.singletons == null) { - this.singletons = new SingletonsImpl(clientObject.getSingletons(), this); - } - return singletons; - } - - /** - * Gets the resource collection API of ExtensionsResources. It manages ExtensionsResource. - * - * @return Resource collection API of ExtensionsResources. - */ - public ExtensionsResources extensionsResources() { - if (this.extensionsResources == null) { - this.extensionsResources = new ExtensionsResourcesImpl(clientObject.getExtensionsResources(), this); - } - return extensionsResources; - } - - /** - * Gets the resource collection API of LocationResources. It manages LocationResource. - * - * @return Resource collection API of LocationResources. - */ - public LocationResources locationResources() { - if (this.locationResources == null) { - this.locationResources = new LocationResourcesImpl(clientObject.getLocationResources(), this); - } - return locationResources; - } - - /** - * Gets wrapped service client ResourcesClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. - * - * @return Wrapped service client ResourcesClient. - */ - public ResourcesClient serviceClient() { - return this.clientObject; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ExtensionsResourcesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ExtensionsResourcesClient.java deleted file mode 100644 index eaf7ba259f0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ExtensionsResourcesClient.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.fluent; - -import azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; - -/** - * An instance of this class provides access to all the operations defined in ExtensionsResourcesClient. - */ -public interface ExtensionsResourcesClient { - /** - * Get a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ExtensionsResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceUri, String extensionsResourceName, - Context context); - - /** - * Get a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ExtensionsResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ExtensionsResourceInner get(String resourceUri, String extensionsResourceName); - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete extension resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ExtensionsResourceInner> beginCreateOrUpdate(String resourceUri, - String extensionsResourceName, ExtensionsResourceInner resource); - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete extension resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ExtensionsResourceInner> beginCreateOrUpdate(String resourceUri, - String extensionsResourceName, ExtensionsResourceInner resource, Context context); - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ExtensionsResourceInner createOrUpdate(String resourceUri, String extensionsResourceName, - ExtensionsResourceInner resource); - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ExtensionsResourceInner createOrUpdate(String resourceUri, String extensionsResourceName, - ExtensionsResourceInner resource, Context context); - - /** - * Update a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type - * along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse(String resourceUri, String extensionsResourceName, - ExtensionsResourceInner properties, Context context); - - /** - * Update a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ExtensionsResourceInner update(String resourceUri, String extensionsResourceName, - ExtensionsResourceInner properties); - - /** - * Delete a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String resourceUri, String extensionsResourceName, Context context); - - /** - * Delete a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceUri, String extensionsResourceName); - - /** - * List ExtensionsResource resources by parent. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByScope(String resourceUri); - - /** - * List ExtensionsResource resources by parent. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByScope(String resourceUri, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/LocationResourcesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/LocationResourcesClient.java deleted file mode 100644 index ecc05282b4c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/LocationResourcesClient.java +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.fluent; - -import azure.resourcemanager.resources.fluent.models.LocationResourceInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * An instance of this class provides access to all the operations defined in LocationResourcesClient. - */ -public interface LocationResourcesClient { - /** - * Get a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a LocationResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String location, String locationResourceName, Context context); - - /** - * Get a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a LocationResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - LocationResourceInner get(String location, String locationResourceName); - - /** - * Create a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse(String location, String locationResourceName, - LocationResourceInner resource, Context context); - - /** - * Create a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - LocationResourceInner createOrUpdate(String location, String locationResourceName, LocationResourceInner resource); - - /** - * Update a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse(String location, String locationResourceName, - LocationResourceInner properties, Context context); - - /** - * Update a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - LocationResourceInner update(String location, String locationResourceName, LocationResourceInner properties); - - /** - * Delete a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String location, String locationResourceName, Context context); - - /** - * Delete a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String location, String locationResourceName); - - /** - * List LocationResource resources by SubscriptionLocationResource. - * - * @param location The name of the Azure region. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByLocation(String location); - - /** - * List LocationResource resources by SubscriptionLocationResource. - * - * @param location The name of the Azure region. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByLocation(String location, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/NestedsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/NestedsClient.java deleted file mode 100644 index b032fefdbfa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/NestedsClient.java +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.fluent; - -import azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; - -/** - * An instance of this class provides access to all the operations defined in NestedsClient. - */ -public interface NestedsClient { - /** - * Get a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a NestedProxyResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, Context context); - - /** - * Get a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a NestedProxyResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - NestedProxyResourceInner get(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName); - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, NestedProxyResourceInner> beginCreateOrReplace( - String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, - NestedProxyResourceInner resource); - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, NestedProxyResourceInner> beginCreateOrReplace( - String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, - NestedProxyResourceInner resource, Context context); - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - NestedProxyResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, NestedProxyResourceInner resource); - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - NestedProxyResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, NestedProxyResourceInner resource, Context context); - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, NestedProxyResourceInner> beginUpdate(String resourceGroupName, - String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner properties); - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, NestedProxyResourceInner> beginUpdate(String resourceGroupName, - String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner properties, - Context context); - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - NestedProxyResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, NestedProxyResourceInner properties); - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - NestedProxyResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, NestedProxyResourceInner properties, Context context); - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName); - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, Context context); - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName); - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, - Context context); - - /** - * List NestedProxyResource resources by TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByTopLevelTrackedResource(String resourceGroupName, - String topLevelTrackedResourceName); - - /** - * List NestedProxyResource resources by TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByTopLevelTrackedResource(String resourceGroupName, - String topLevelTrackedResourceName, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ResourcesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ResourcesClient.java deleted file mode 100644 index 4cdff9c6d1f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ResourcesClient.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for ResourcesClient class. - */ -public interface ResourcesClient { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the TopLevelsClient object to access its operations. - * - * @return the TopLevelsClient object. - */ - TopLevelsClient getTopLevels(); - - /** - * Gets the NestedsClient object to access its operations. - * - * @return the NestedsClient object. - */ - NestedsClient getNesteds(); - - /** - * Gets the SingletonsClient object to access its operations. - * - * @return the SingletonsClient object. - */ - SingletonsClient getSingletons(); - - /** - * Gets the ExtensionsResourcesClient object to access its operations. - * - * @return the ExtensionsResourcesClient object. - */ - ExtensionsResourcesClient getExtensionsResources(); - - /** - * Gets the LocationResourcesClient object to access its operations. - * - * @return the LocationResourcesClient object. - */ - LocationResourcesClient getLocationResources(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/SingletonsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/SingletonsClient.java deleted file mode 100644 index fdbabdcc31a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/SingletonsClient.java +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.fluent; - -import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; - -/** - * An instance of this class provides access to all the operations defined in SingletonsClient. - */ -public interface SingletonsClient { - /** - * Get a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SingletonTrackedResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, Context context); - - /** - * Get a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SingletonTrackedResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SingletonTrackedResourceInner getByResourceGroup(String resourceGroupName); - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, SingletonTrackedResourceInner> - beginCreateOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource); - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, SingletonTrackedResourceInner> - beginCreateOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource, Context context); - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SingletonTrackedResourceInner createOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource); - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SingletonTrackedResourceInner createOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource, - Context context); - - /** - * Update a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse(String resourceGroupName, - SingletonTrackedResourceInner properties, Context context); - - /** - * Update a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SingletonTrackedResourceInner update(String resourceGroupName, SingletonTrackedResourceInner properties); - - /** - * List SingletonTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a SingletonTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * List SingletonTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a SingletonTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/TopLevelsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/TopLevelsClient.java deleted file mode 100644 index 1b571f34e6a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/TopLevelsClient.java +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.fluent; - -import azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner; -import azure.resourcemanager.resources.models.NotificationDetails; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; - -/** - * An instance of this class provides access to all the operations defined in TopLevelsClient. - */ -public interface TopLevelsClient { - /** - * Get a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelTrackedResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelTrackedResourceName, Context context); - - /** - * Get a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelTrackedResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelTrackedResourceInner getByResourceGroup(String resourceGroupName, String topLevelTrackedResourceName); - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, TopLevelTrackedResourceInner> beginCreateOrReplace( - String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource); - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, TopLevelTrackedResourceInner> beginCreateOrReplace( - String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource, - Context context); - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelTrackedResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, - TopLevelTrackedResourceInner resource); - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelTrackedResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, - TopLevelTrackedResourceInner resource, Context context); - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, TopLevelTrackedResourceInner> beginUpdate( - String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner properties); - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, TopLevelTrackedResourceInner> beginUpdate( - String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner properties, - Context context); - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelTrackedResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, - TopLevelTrackedResourceInner properties); - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelTrackedResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, - TopLevelTrackedResourceInner properties, Context context); - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName); - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName, - Context context); - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String topLevelTrackedResourceName); - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String topLevelTrackedResourceName, Context context); - - /** - * List TopLevelTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * List TopLevelTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, Context context); - - /** - * List TopLevelTrackedResource resources by subscription ID. - * - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * List TopLevelTrackedResource resources by subscription ID. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); - - /** - * A synchronous resource action that returns no content. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response actionSyncWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - NotificationDetails body, Context context); - - /** - * A synchronous resource action that returns no content. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void actionSync(String resourceGroupName, String topLevelTrackedResourceName, NotificationDetails body); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/ExtensionsResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/ExtensionsResourceInner.java deleted file mode 100644 index a1b78b3d32a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/ExtensionsResourceInner.java +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.fluent.models; - -import azure.resourcemanager.resources.models.ExtensionsResourceProperties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Concrete extension resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class ExtensionsResourceInner extends ProxyResource { - /* - * The resource-specific properties for this resource. - */ - private ExtensionsResourceProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of ExtensionsResourceInner class. - */ - public ExtensionsResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public ExtensionsResourceProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the ExtensionsResourceInner object itself. - */ - public ExtensionsResourceInner withProperties(ExtensionsResourceProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExtensionsResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExtensionsResourceInner if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExtensionsResourceInner. - */ - public static ExtensionsResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ExtensionsResourceInner deserializedExtensionsResourceInner = new ExtensionsResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedExtensionsResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedExtensionsResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedExtensionsResourceInner.type = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedExtensionsResourceInner.properties = ExtensionsResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedExtensionsResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedExtensionsResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/LocationResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/LocationResourceInner.java deleted file mode 100644 index 2070b1e0110..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/LocationResourceInner.java +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.fluent.models; - -import azure.resourcemanager.resources.models.LocationResourceProperties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Concrete proxy resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class LocationResourceInner extends ProxyResource { - /* - * The resource-specific properties for this resource. - */ - private LocationResourceProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of LocationResourceInner class. - */ - public LocationResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public LocationResourceProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the LocationResourceInner object itself. - */ - public LocationResourceInner withProperties(LocationResourceProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of LocationResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of LocationResourceInner if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the LocationResourceInner. - */ - public static LocationResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - LocationResourceInner deserializedLocationResourceInner = new LocationResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedLocationResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedLocationResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedLocationResourceInner.type = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedLocationResourceInner.properties = LocationResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedLocationResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedLocationResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/NestedProxyResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/NestedProxyResourceInner.java deleted file mode 100644 index 934224d377f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/NestedProxyResourceInner.java +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.fluent.models; - -import azure.resourcemanager.resources.models.NestedProxyResourceProperties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Nested child of Top Level Tracked Resource. - */ -@Fluent -public final class NestedProxyResourceInner extends ProxyResource { - /* - * The resource-specific properties for this resource. - */ - private NestedProxyResourceProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of NestedProxyResourceInner class. - */ - public NestedProxyResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public NestedProxyResourceProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the NestedProxyResourceInner object itself. - */ - public NestedProxyResourceInner withProperties(NestedProxyResourceProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NestedProxyResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NestedProxyResourceInner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NestedProxyResourceInner. - */ - public static NestedProxyResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NestedProxyResourceInner deserializedNestedProxyResourceInner = new NestedProxyResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedNestedProxyResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedNestedProxyResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedNestedProxyResourceInner.type = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedNestedProxyResourceInner.properties = NestedProxyResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedNestedProxyResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedNestedProxyResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/SingletonTrackedResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/SingletonTrackedResourceInner.java deleted file mode 100644 index 61d4243fe3f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/SingletonTrackedResourceInner.java +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.fluent.models; - -import azure.resourcemanager.resources.models.SingletonTrackedResourceProperties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class SingletonTrackedResourceInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private SingletonTrackedResourceProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of SingletonTrackedResourceInner class. - */ - public SingletonTrackedResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public SingletonTrackedResourceProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the SingletonTrackedResourceInner object itself. - */ - public SingletonTrackedResourceInner withProperties(SingletonTrackedResourceProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public SingletonTrackedResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public SingletonTrackedResourceInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SingletonTrackedResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SingletonTrackedResourceInner if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SingletonTrackedResourceInner. - */ - public static SingletonTrackedResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SingletonTrackedResourceInner deserializedSingletonTrackedResourceInner - = new SingletonTrackedResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedSingletonTrackedResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedSingletonTrackedResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedSingletonTrackedResourceInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedSingletonTrackedResourceInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedSingletonTrackedResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedSingletonTrackedResourceInner.properties - = SingletonTrackedResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedSingletonTrackedResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedSingletonTrackedResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/TopLevelTrackedResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/TopLevelTrackedResourceInner.java deleted file mode 100644 index e97a548b079..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/TopLevelTrackedResourceInner.java +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.fluent.models; - -import azure.resourcemanager.resources.models.TopLevelTrackedResourceProperties; -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class TopLevelTrackedResourceInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private TopLevelTrackedResourceProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of TopLevelTrackedResourceInner class. - */ - public TopLevelTrackedResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public TopLevelTrackedResourceProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the TopLevelTrackedResourceInner object itself. - */ - public TopLevelTrackedResourceInner withProperties(TopLevelTrackedResourceProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public TopLevelTrackedResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public TopLevelTrackedResourceInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelTrackedResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelTrackedResourceInner if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TopLevelTrackedResourceInner. - */ - public static TopLevelTrackedResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelTrackedResourceInner deserializedTopLevelTrackedResourceInner = new TopLevelTrackedResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedTopLevelTrackedResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedTopLevelTrackedResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedTopLevelTrackedResourceInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedTopLevelTrackedResourceInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedTopLevelTrackedResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedTopLevelTrackedResourceInner.properties - = TopLevelTrackedResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedTopLevelTrackedResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelTrackedResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/package-info.java deleted file mode 100644 index 05af82bacf9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the inner data models for Resources. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.resources.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/package-info.java deleted file mode 100644 index e51e2bd885c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the service clients for Resources. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.resources.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourceImpl.java deleted file mode 100644 index feda0303920..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourceImpl.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner; -import azure.resourcemanager.resources.models.ExtensionsResource; -import azure.resourcemanager.resources.models.ExtensionsResourceProperties; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; - -public final class ExtensionsResourceImpl - implements ExtensionsResource, ExtensionsResource.Definition, ExtensionsResource.Update { - private ExtensionsResourceInner innerObject; - - private final azure.resourcemanager.resources.ResourcesManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public ExtensionsResourceProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public ExtensionsResourceInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.resources.ResourcesManager manager() { - return this.serviceManager; - } - - private String resourceUri; - - private String extensionsResourceName; - - public ExtensionsResourceImpl withExistingResourceUri(String resourceUri) { - this.resourceUri = resourceUri; - return this; - } - - public ExtensionsResource create() { - this.innerObject = serviceManager.serviceClient() - .getExtensionsResources() - .createOrUpdate(resourceUri, extensionsResourceName, this.innerModel(), Context.NONE); - return this; - } - - public ExtensionsResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getExtensionsResources() - .createOrUpdate(resourceUri, extensionsResourceName, this.innerModel(), context); - return this; - } - - ExtensionsResourceImpl(String name, azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerObject = new ExtensionsResourceInner(); - this.serviceManager = serviceManager; - this.extensionsResourceName = name; - } - - public ExtensionsResourceImpl update() { - return this; - } - - public ExtensionsResource apply() { - this.innerObject = serviceManager.serviceClient() - .getExtensionsResources() - .updateWithResponse(resourceUri, extensionsResourceName, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public ExtensionsResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getExtensionsResources() - .updateWithResponse(resourceUri, extensionsResourceName, this.innerModel(), context) - .getValue(); - return this; - } - - ExtensionsResourceImpl(ExtensionsResourceInner innerObject, - azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), - "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", - "resourceUri"); - this.extensionsResourceName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), - "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", - "extensionsResourceName"); - } - - public ExtensionsResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getExtensionsResources() - .getWithResponse(resourceUri, extensionsResourceName, Context.NONE) - .getValue(); - return this; - } - - public ExtensionsResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getExtensionsResources() - .getWithResponse(resourceUri, extensionsResourceName, context) - .getValue(); - return this; - } - - public ExtensionsResourceImpl withProperties(ExtensionsResourceProperties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesClientImpl.java deleted file mode 100644 index 618b4514b0a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesClientImpl.java +++ /dev/null @@ -1,746 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.ExtensionsResourcesClient; -import azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner; -import azure.resourcemanager.resources.implementation.models.ExtensionsResourceListResult; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtensionsResourcesClient. - */ -public final class ExtensionsResourcesClientImpl implements ExtensionsResourcesClient { - /** - * The proxy service used to perform REST calls. - */ - private final ExtensionsResourcesService service; - - /** - * The service client containing this operation class. - */ - private final ResourcesClientImpl client; - - /** - * Initializes an instance of ExtensionsResourcesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtensionsResourcesClientImpl(ResourcesClientImpl client) { - this.service = RestProxy.create(ExtensionsResourcesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ResourcesClientExtensionsResources to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ResourcesClientExtensionsResources") - public interface ExtensionsResourcesService { - @Headers({ "Content-Type: application/json" }) - @Get("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("extensionsResourceName") String extensionsResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("extensionsResourceName") String extensionsResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Put("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("extensionsResourceName") String extensionsResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ExtensionsResourceInner resource, Context context); - - @Put("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("extensionsResourceName") String extensionsResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ExtensionsResourceInner resource, Context context); - - @Patch("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("extensionsResourceName") String extensionsResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ExtensionsResourceInner properties, Context context); - - @Patch("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response updateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("extensionsResourceName") String extensionsResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ExtensionsResourceInner properties, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("extensionsResourceName") String extensionsResourceName, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("extensionsResourceName") String extensionsResourceName, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByScope(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByScopeSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByScopeNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByScopeNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Get a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ExtensionsResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceUri, - String extensionsResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - extensionsResourceName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ExtensionsResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceUri, String extensionsResourceName) { - return getWithResponseAsync(resourceUri, extensionsResourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ExtensionsResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceUri, String extensionsResourceName, - Context context) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - extensionsResourceName, accept, context); - } - - /** - * Get a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ExtensionsResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ExtensionsResourceInner get(String resourceUri, String extensionsResourceName) { - return getWithResponse(resourceUri, extensionsResourceName, Context.NONE).getValue(); - } - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type - * along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceUri, - String extensionsResourceName, ExtensionsResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - resourceUri, extensionsResourceName, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type - * along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceUri, String extensionsResourceName, - ExtensionsResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - extensionsResourceName, contentType, accept, resource, Context.NONE); - } - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type - * along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceUri, String extensionsResourceName, - ExtensionsResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - extensionsResourceName, contentType, accept, resource, context); - } - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete extension resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ExtensionsResourceInner> - beginCreateOrUpdateAsync(String resourceUri, String extensionsResourceName, ExtensionsResourceInner resource) { - Mono>> mono - = createOrUpdateWithResponseAsync(resourceUri, extensionsResourceName, resource); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), ExtensionsResourceInner.class, ExtensionsResourceInner.class, - this.client.getContext()); - } - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete extension resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ExtensionsResourceInner> - beginCreateOrUpdate(String resourceUri, String extensionsResourceName, ExtensionsResourceInner resource) { - Response response = createOrUpdateWithResponse(resourceUri, extensionsResourceName, resource); - return this.client.getLroResult(response, - ExtensionsResourceInner.class, ExtensionsResourceInner.class, Context.NONE); - } - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete extension resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ExtensionsResourceInner> beginCreateOrUpdate( - String resourceUri, String extensionsResourceName, ExtensionsResourceInner resource, Context context) { - Response response - = createOrUpdateWithResponse(resourceUri, extensionsResourceName, resource, context); - return this.client.getLroResult(response, - ExtensionsResourceInner.class, ExtensionsResourceInner.class, context); - } - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceUri, String extensionsResourceName, - ExtensionsResourceInner resource) { - return beginCreateOrUpdateAsync(resourceUri, extensionsResourceName, resource).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ExtensionsResourceInner createOrUpdate(String resourceUri, String extensionsResourceName, - ExtensionsResourceInner resource) { - return beginCreateOrUpdate(resourceUri, extensionsResourceName, resource).getFinalResult(); - } - - /** - * Create a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ExtensionsResourceInner createOrUpdate(String resourceUri, String extensionsResourceName, - ExtensionsResourceInner resource, Context context) { - return beginCreateOrUpdate(resourceUri, extensionsResourceName, resource, context).getFinalResult(); - } - - /** - * Update a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type - * along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String resourceUri, - String extensionsResourceName, ExtensionsResourceInner properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - extensionsResourceName, contentType, accept, properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceUri, String extensionsResourceName, - ExtensionsResourceInner properties) { - return updateWithResponseAsync(resourceUri, extensionsResourceName, properties) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Update a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type - * along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(String resourceUri, String extensionsResourceName, - ExtensionsResourceInner properties, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - extensionsResourceName, contentType, accept, properties, context); - } - - /** - * Update a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete extension resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ExtensionsResourceInner update(String resourceUri, String extensionsResourceName, - ExtensionsResourceInner properties) { - return updateWithResponse(resourceUri, extensionsResourceName, properties, Context.NONE).getValue(); - } - - /** - * Delete a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceUri, String extensionsResourceName) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - extensionsResourceName, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceUri, String extensionsResourceName) { - return deleteWithResponseAsync(resourceUri, extensionsResourceName).flatMap(ignored -> Mono.empty()); - } - - /** - * Delete a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceUri, String extensionsResourceName, Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - extensionsResourceName, context); - } - - /** - * Delete a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceUri, String extensionsResourceName) { - deleteWithResponse(resourceUri, extensionsResourceName, Context.NONE); - } - - /** - * List ExtensionsResource resources by parent. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ExtensionsResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByScopeSinglePageAsync(String resourceUri) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByScope(this.client.getEndpoint(), this.client.getApiVersion(), - resourceUri, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List ExtensionsResource resources by parent. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByScopeAsync(String resourceUri) { - return new PagedFlux<>(() -> listByScopeSinglePageAsync(resourceUri), - nextLink -> listByScopeNextSinglePageAsync(nextLink)); - } - - /** - * List ExtensionsResource resources by parent. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ExtensionsResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByScopeSinglePage(String resourceUri) { - final String accept = "application/json"; - Response res = service.listByScopeSync(this.client.getEndpoint(), - this.client.getApiVersion(), resourceUri, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List ExtensionsResource resources by parent. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ExtensionsResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByScopeSinglePage(String resourceUri, Context context) { - final String accept = "application/json"; - Response res = service.listByScopeSync(this.client.getEndpoint(), - this.client.getApiVersion(), resourceUri, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List ExtensionsResource resources by parent. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByScope(String resourceUri) { - return new PagedIterable<>(() -> listByScopeSinglePage(resourceUri), - nextLink -> listByScopeNextSinglePage(nextLink)); - } - - /** - * List ExtensionsResource resources by parent. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByScope(String resourceUri, Context context) { - return new PagedIterable<>(() -> listByScopeSinglePage(resourceUri, context), - nextLink -> listByScopeNextSinglePage(nextLink, context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ExtensionsResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByScopeNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByScopeNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ExtensionsResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByScopeNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listByScopeNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ExtensionsResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByScopeNextSinglePage(String nextLink, Context context) { - final String accept = "application/json"; - Response res - = service.listByScopeNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesImpl.java deleted file mode 100644 index aa268931b34..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesImpl.java +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.ExtensionsResourcesClient; -import azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner; -import azure.resourcemanager.resources.models.ExtensionsResource; -import azure.resourcemanager.resources.models.ExtensionsResources; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class ExtensionsResourcesImpl implements ExtensionsResources { - private static final ClientLogger LOGGER = new ClientLogger(ExtensionsResourcesImpl.class); - - private final ExtensionsResourcesClient innerClient; - - private final azure.resourcemanager.resources.ResourcesManager serviceManager; - - public ExtensionsResourcesImpl(ExtensionsResourcesClient innerClient, - azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getWithResponse(String resourceUri, String extensionsResourceName, - Context context) { - Response inner - = this.serviceClient().getWithResponse(resourceUri, extensionsResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ExtensionsResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public ExtensionsResource get(String resourceUri, String extensionsResourceName) { - ExtensionsResourceInner inner = this.serviceClient().get(resourceUri, extensionsResourceName); - if (inner != null) { - return new ExtensionsResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteByResourceGroupWithResponse(String resourceUri, String extensionsResourceName, - Context context) { - return this.serviceClient().deleteWithResponse(resourceUri, extensionsResourceName, context); - } - - public void deleteByResourceGroup(String resourceUri, String extensionsResourceName) { - this.serviceClient().delete(resourceUri, extensionsResourceName); - } - - public PagedIterable listByScope(String resourceUri) { - PagedIterable inner = this.serviceClient().listByScope(resourceUri); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ExtensionsResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByScope(String resourceUri, Context context) { - PagedIterable inner = this.serviceClient().listByScope(resourceUri, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ExtensionsResourceImpl(inner1, this.manager())); - } - - public ExtensionsResource getById(String id) { - String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", - "resourceUri"); - if (resourceUri == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); - } - String extensionsResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", - "extensionsResourceName"); - if (extensionsResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'extensionsResources'.", id))); - } - return this.getWithResponse(resourceUri, extensionsResourceName, Context.NONE).getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", - "resourceUri"); - if (resourceUri == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); - } - String extensionsResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", - "extensionsResourceName"); - if (extensionsResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'extensionsResources'.", id))); - } - return this.getWithResponse(resourceUri, extensionsResourceName, context); - } - - public void deleteById(String id) { - String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", - "resourceUri"); - if (resourceUri == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); - } - String extensionsResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", - "extensionsResourceName"); - if (extensionsResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'extensionsResources'.", id))); - } - this.deleteByResourceGroupWithResponse(resourceUri, extensionsResourceName, Context.NONE); - } - - public Response deleteByIdWithResponse(String id, Context context) { - String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", - "resourceUri"); - if (resourceUri == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); - } - String extensionsResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", - "extensionsResourceName"); - if (extensionsResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'extensionsResources'.", id))); - } - return this.deleteByResourceGroupWithResponse(resourceUri, extensionsResourceName, context); - } - - private ExtensionsResourcesClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.resources.ResourcesManager manager() { - return this.serviceManager; - } - - public ExtensionsResourceImpl define(String name) { - return new ExtensionsResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourceImpl.java deleted file mode 100644 index 1961ee412f3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourceImpl.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.models.LocationResourceInner; -import azure.resourcemanager.resources.models.LocationResource; -import azure.resourcemanager.resources.models.LocationResourceProperties; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; - -public final class LocationResourceImpl - implements LocationResource, LocationResource.Definition, LocationResource.Update { - private LocationResourceInner innerObject; - - private final azure.resourcemanager.resources.ResourcesManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public LocationResourceProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public LocationResourceInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.resources.ResourcesManager manager() { - return this.serviceManager; - } - - private String location; - - private String locationResourceName; - - public LocationResourceImpl withExistingLocation(String location) { - this.location = location; - return this; - } - - public LocationResource create() { - this.innerObject = serviceManager.serviceClient() - .getLocationResources() - .createOrUpdateWithResponse(location, locationResourceName, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public LocationResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getLocationResources() - .createOrUpdateWithResponse(location, locationResourceName, this.innerModel(), context) - .getValue(); - return this; - } - - LocationResourceImpl(String name, azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerObject = new LocationResourceInner(); - this.serviceManager = serviceManager; - this.locationResourceName = name; - } - - public LocationResourceImpl update() { - return this; - } - - public LocationResource apply() { - this.innerObject = serviceManager.serviceClient() - .getLocationResources() - .updateWithResponse(location, locationResourceName, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public LocationResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getLocationResources() - .updateWithResponse(location, locationResourceName, this.innerModel(), context) - .getValue(); - return this; - } - - LocationResourceImpl(LocationResourceInner innerObject, - azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.location = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "locations"); - this.locationResourceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "locationResources"); - } - - public LocationResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getLocationResources() - .getWithResponse(location, locationResourceName, Context.NONE) - .getValue(); - return this; - } - - public LocationResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getLocationResources() - .getWithResponse(location, locationResourceName, context) - .getValue(); - return this; - } - - public LocationResourceImpl withProperties(LocationResourceProperties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesClientImpl.java deleted file mode 100644 index ea0644391dd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesClientImpl.java +++ /dev/null @@ -1,627 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.LocationResourcesClient; -import azure.resourcemanager.resources.fluent.models.LocationResourceInner; -import azure.resourcemanager.resources.implementation.models.LocationResourceListResult; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in LocationResourcesClient. - */ -public final class LocationResourcesClientImpl implements LocationResourcesClient { - /** - * The proxy service used to perform REST calls. - */ - private final LocationResourcesService service; - - /** - * The service client containing this operation class. - */ - private final ResourcesClientImpl client; - - /** - * Initializes an instance of LocationResourcesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - LocationResourcesClientImpl(ResourcesClientImpl client) { - this.service - = RestProxy.create(LocationResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ResourcesClientLocationResources to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ResourcesClientLocationResources") - public interface LocationResourcesService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") LocationResourceInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") LocationResourceInner resource, Context context); - - @Patch("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") LocationResourceInner properties, Context context); - - @Patch("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response updateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") LocationResourceInner properties, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, - Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, @PathParam("location") String location, - @PathParam("locationResourceName") String locationResourceName, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByLocation(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByLocationSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("location") String location, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByLocationNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByLocationNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Get a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a LocationResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String location, String locationResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, locationResourceName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a LocationResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String location, String locationResourceName) { - return getWithResponseAsync(location, locationResourceName).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a LocationResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String location, String locationResourceName, - Context context) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - location, locationResourceName, accept, context); - } - - /** - * Get a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a LocationResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public LocationResourceInner get(String location, String locationResourceName) { - return getWithResponse(location, locationResourceName, Context.NONE).getValue(); - } - - /** - * Create a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync(String location, - String locationResourceName, LocationResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, locationResourceName, contentType, accept, resource, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String location, String locationResourceName, - LocationResourceInner resource) { - return createOrUpdateWithResponseAsync(location, locationResourceName, resource) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Create a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse(String location, String locationResourceName, - LocationResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, locationResourceName, contentType, accept, resource, context); - } - - /** - * Create a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public LocationResourceInner createOrUpdate(String location, String locationResourceName, - LocationResourceInner resource) { - return createOrUpdateWithResponse(location, locationResourceName, resource, Context.NONE).getValue(); - } - - /** - * Update a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String location, String locationResourceName, - LocationResourceInner properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, locationResourceName, contentType, accept, properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String location, String locationResourceName, - LocationResourceInner properties) { - return updateWithResponseAsync(location, locationResourceName, properties) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Update a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(String location, String locationResourceName, - LocationResourceInner properties, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, locationResourceName, contentType, accept, properties, context); - } - - /** - * Update a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public LocationResourceInner update(String location, String locationResourceName, - LocationResourceInner properties) { - return updateWithResponse(location, locationResourceName, properties, Context.NONE).getValue(); - } - - /** - * Delete a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String location, String locationResourceName) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, locationResourceName, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String location, String locationResourceName) { - return deleteWithResponseAsync(location, locationResourceName).flatMap(ignored -> Mono.empty()); - } - - /** - * Delete a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String location, String locationResourceName, Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, locationResourceName, context); - } - - /** - * Delete a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String location, String locationResourceName) { - deleteWithResponse(location, locationResourceName, Context.NONE); - } - - /** - * List LocationResource resources by SubscriptionLocationResource. - * - * @param location The name of the Azure region. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a LocationResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByLocationSinglePageAsync(String location) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByLocation(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), location, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List LocationResource resources by SubscriptionLocationResource. - * - * @param location The name of the Azure region. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByLocationAsync(String location) { - return new PagedFlux<>(() -> listByLocationSinglePageAsync(location), - nextLink -> listByLocationNextSinglePageAsync(nextLink)); - } - - /** - * List LocationResource resources by SubscriptionLocationResource. - * - * @param location The name of the Azure region. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a LocationResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByLocationSinglePage(String location) { - final String accept = "application/json"; - Response res = service.listByLocationSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), location, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List LocationResource resources by SubscriptionLocationResource. - * - * @param location The name of the Azure region. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a LocationResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByLocationSinglePage(String location, Context context) { - final String accept = "application/json"; - Response res = service.listByLocationSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), location, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List LocationResource resources by SubscriptionLocationResource. - * - * @param location The name of the Azure region. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByLocation(String location) { - return new PagedIterable<>(() -> listByLocationSinglePage(location), - nextLink -> listByLocationNextSinglePage(nextLink)); - } - - /** - * List LocationResource resources by SubscriptionLocationResource. - * - * @param location The name of the Azure region. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByLocation(String location, Context context) { - return new PagedIterable<>(() -> listByLocationSinglePage(location, context), - nextLink -> listByLocationNextSinglePage(nextLink, context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a LocationResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByLocationNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByLocationNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a LocationResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByLocationNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listByLocationNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a LocationResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByLocationNextSinglePage(String nextLink, Context context) { - final String accept = "application/json"; - Response res - = service.listByLocationNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesImpl.java deleted file mode 100644 index 59faad49ddb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesImpl.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.LocationResourcesClient; -import azure.resourcemanager.resources.fluent.models.LocationResourceInner; -import azure.resourcemanager.resources.models.LocationResource; -import azure.resourcemanager.resources.models.LocationResources; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class LocationResourcesImpl implements LocationResources { - private static final ClientLogger LOGGER = new ClientLogger(LocationResourcesImpl.class); - - private final LocationResourcesClient innerClient; - - private final azure.resourcemanager.resources.ResourcesManager serviceManager; - - public LocationResourcesImpl(LocationResourcesClient innerClient, - azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getWithResponse(String location, String locationResourceName, Context context) { - Response inner - = this.serviceClient().getWithResponse(location, locationResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new LocationResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public LocationResource get(String location, String locationResourceName) { - LocationResourceInner inner = this.serviceClient().get(location, locationResourceName); - if (inner != null) { - return new LocationResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteByResourceGroupWithResponse(String location, String locationResourceName, - Context context) { - return this.serviceClient().deleteWithResponse(location, locationResourceName, context); - } - - public void deleteByResourceGroup(String location, String locationResourceName) { - this.serviceClient().delete(location, locationResourceName); - } - - public PagedIterable listByLocation(String location) { - PagedIterable inner = this.serviceClient().listByLocation(location); - return ResourceManagerUtils.mapPage(inner, inner1 -> new LocationResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByLocation(String location, Context context) { - PagedIterable inner = this.serviceClient().listByLocation(location, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new LocationResourceImpl(inner1, this.manager())); - } - - public LocationResource getById(String id) { - String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); - if (location == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); - } - String locationResourceName = ResourceManagerUtils.getValueFromIdByName(id, "locationResources"); - if (locationResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locationResources'.", id))); - } - return this.getWithResponse(location, locationResourceName, Context.NONE).getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); - if (location == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); - } - String locationResourceName = ResourceManagerUtils.getValueFromIdByName(id, "locationResources"); - if (locationResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locationResources'.", id))); - } - return this.getWithResponse(location, locationResourceName, context); - } - - public void deleteById(String id) { - String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); - if (location == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); - } - String locationResourceName = ResourceManagerUtils.getValueFromIdByName(id, "locationResources"); - if (locationResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locationResources'.", id))); - } - this.deleteByResourceGroupWithResponse(location, locationResourceName, Context.NONE); - } - - public Response deleteByIdWithResponse(String id, Context context) { - String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); - if (location == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); - } - String locationResourceName = ResourceManagerUtils.getValueFromIdByName(id, "locationResources"); - if (locationResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'locationResources'.", id))); - } - return this.deleteByResourceGroupWithResponse(location, locationResourceName, context); - } - - private LocationResourcesClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.resources.ResourcesManager manager() { - return this.serviceManager; - } - - public LocationResourceImpl define(String name) { - return new LocationResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedProxyResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedProxyResourceImpl.java deleted file mode 100644 index 278049c63f2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedProxyResourceImpl.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner; -import azure.resourcemanager.resources.models.NestedProxyResource; -import azure.resourcemanager.resources.models.NestedProxyResourceProperties; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; - -public final class NestedProxyResourceImpl - implements NestedProxyResource, NestedProxyResource.Definition, NestedProxyResource.Update { - private NestedProxyResourceInner innerObject; - - private final azure.resourcemanager.resources.ResourcesManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public NestedProxyResourceProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public String resourceGroupName() { - return resourceGroupName; - } - - public NestedProxyResourceInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.resources.ResourcesManager manager() { - return this.serviceManager; - } - - private String resourceGroupName; - - private String topLevelTrackedResourceName; - - private String nextedProxyResourceName; - - public NestedProxyResourceImpl withExistingTopLevelTrackedResource(String resourceGroupName, - String topLevelTrackedResourceName) { - this.resourceGroupName = resourceGroupName; - this.topLevelTrackedResourceName = topLevelTrackedResourceName; - return this; - } - - public NestedProxyResource create() { - this.innerObject = serviceManager.serviceClient() - .getNesteds() - .createOrReplace(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, this.innerModel(), - Context.NONE); - return this; - } - - public NestedProxyResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getNesteds() - .createOrReplace(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, this.innerModel(), - context); - return this; - } - - NestedProxyResourceImpl(String name, azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerObject = new NestedProxyResourceInner(); - this.serviceManager = serviceManager; - this.nextedProxyResourceName = name; - } - - public NestedProxyResourceImpl update() { - return this; - } - - public NestedProxyResource apply() { - this.innerObject = serviceManager.serviceClient() - .getNesteds() - .update(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, this.innerModel(), - Context.NONE); - return this; - } - - public NestedProxyResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getNesteds() - .update(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, this.innerModel(), - context); - return this; - } - - NestedProxyResourceImpl(NestedProxyResourceInner innerObject, - azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.topLevelTrackedResourceName - = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "topLevelTrackedResources"); - this.nextedProxyResourceName - = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "nestedProxyResources"); - } - - public NestedProxyResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getNesteds() - .getWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, Context.NONE) - .getValue(); - return this; - } - - public NestedProxyResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getNesteds() - .getWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context) - .getValue(); - return this; - } - - public NestedProxyResourceImpl withProperties(NestedProxyResourceProperties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsClientImpl.java deleted file mode 100644 index 46ffda5e677..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsClientImpl.java +++ /dev/null @@ -1,1020 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.NestedsClient; -import azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner; -import azure.resourcemanager.resources.implementation.models.NestedProxyResourceListResult; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in NestedsClient. - */ -public final class NestedsClientImpl implements NestedsClient { - /** - * The proxy service used to perform REST calls. - */ - private final NestedsService service; - - /** - * The service client containing this operation class. - */ - private final ResourcesClientImpl client; - - /** - * Initializes an instance of NestedsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NestedsClientImpl(ResourcesClientImpl client) { - this.service = RestProxy.create(NestedsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ResourcesClientNesteds to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ResourcesClientNesteds") - public interface NestedsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @PathParam("nextedProxyResourceName") String nextedProxyResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @PathParam("nextedProxyResourceName") String nextedProxyResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrReplace(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @PathParam("nextedProxyResourceName") String nextedProxyResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") NestedProxyResourceInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrReplaceSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @PathParam("nextedProxyResourceName") String nextedProxyResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") NestedProxyResourceInner resource, Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> update(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @PathParam("nextedProxyResourceName") String nextedProxyResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") NestedProxyResourceInner properties, Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response updateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @PathParam("nextedProxyResourceName") String nextedProxyResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") NestedProxyResourceInner properties, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") - @ExpectedResponses({ 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @PathParam("nextedProxyResourceName") String nextedProxyResourceName, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") - @ExpectedResponses({ 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @PathParam("nextedProxyResourceName") String nextedProxyResourceName, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByTopLevelTrackedResource( - @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByTopLevelTrackedResourceSync( - @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByTopLevelTrackedResourceNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByTopLevelTrackedResourceNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Get a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a NestedProxyResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, - String topLevelTrackedResourceName, String nextedProxyResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, - nextedProxyResourceName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a NestedProxyResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName) { - return getWithResponseAsync(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a NestedProxyResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, - String topLevelTrackedResourceName, String nextedProxyResourceName, Context context) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, accept, context); - } - - /** - * Get a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a NestedProxyResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NestedProxyResourceInner get(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName) { - return getWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, Context.NONE) - .getValue(); - } - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, - String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, - nextedProxyResourceName, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrReplaceWithResponse(String resourceGroupName, - String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, - contentType, accept, resource, Context.NONE); - } - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrReplaceWithResponse(String resourceGroupName, - String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner resource, - Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, - contentType, accept, resource, context); - } - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, NestedProxyResourceInner> beginCreateOrReplaceAsync( - String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, - NestedProxyResourceInner resource) { - Mono>> mono = createOrReplaceWithResponseAsync(resourceGroupName, - topLevelTrackedResourceName, nextedProxyResourceName, resource); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), NestedProxyResourceInner.class, NestedProxyResourceInner.class, - this.client.getContext()); - } - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, NestedProxyResourceInner> beginCreateOrReplace( - String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, - NestedProxyResourceInner resource) { - Response response = createOrReplaceWithResponse(resourceGroupName, topLevelTrackedResourceName, - nextedProxyResourceName, resource); - return this.client.getLroResult(response, - NestedProxyResourceInner.class, NestedProxyResourceInner.class, Context.NONE); - } - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, NestedProxyResourceInner> beginCreateOrReplace( - String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, - NestedProxyResourceInner resource, Context context) { - Response response = createOrReplaceWithResponse(resourceGroupName, topLevelTrackedResourceName, - nextedProxyResourceName, resource, context); - return this.client.getLroResult(response, - NestedProxyResourceInner.class, NestedProxyResourceInner.class, context); - } - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrReplaceAsync(String resourceGroupName, - String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner resource) { - return beginCreateOrReplaceAsync(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, - resource).last().flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NestedProxyResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, NestedProxyResourceInner resource) { - return beginCreateOrReplace(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, resource) - .getFinalResult(); - } - - /** - * Create a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NestedProxyResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, NestedProxyResourceInner resource, Context context) { - return beginCreateOrReplace(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, resource, - context).getFinalResult(); - } - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync(String resourceGroupName, - String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, - nextedProxyResourceName, contentType, accept, properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response updateWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, NestedProxyResourceInner properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, - contentType, accept, properties, Context.NONE); - } - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response updateWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, NestedProxyResourceInner properties, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, - contentType, accept, properties, context); - } - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, NestedProxyResourceInner> beginUpdateAsync( - String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, - NestedProxyResourceInner properties) { - Mono>> mono = updateWithResponseAsync(resourceGroupName, topLevelTrackedResourceName, - nextedProxyResourceName, properties); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), NestedProxyResourceInner.class, NestedProxyResourceInner.class, - this.client.getContext()); - } - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, NestedProxyResourceInner> beginUpdate( - String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, - NestedProxyResourceInner properties) { - Response response - = updateWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, properties); - return this.client.getLroResult(response, - NestedProxyResourceInner.class, NestedProxyResourceInner.class, Context.NONE); - } - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, NestedProxyResourceInner> beginUpdate( - String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, - NestedProxyResourceInner properties, Context context) { - Response response = updateWithResponse(resourceGroupName, topLevelTrackedResourceName, - nextedProxyResourceName, properties, context); - return this.client.getLroResult(response, - NestedProxyResourceInner.class, NestedProxyResourceInner.class, context); - } - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, NestedProxyResourceInner properties) { - return beginUpdateAsync(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, properties) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NestedProxyResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, NestedProxyResourceInner properties) { - return beginUpdate(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, properties) - .getFinalResult(); - } - - /** - * Update a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return nested child of Top Level Tracked Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NestedProxyResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, NestedProxyResourceInner properties, Context context) { - return beginUpdate(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, properties, context) - .getFinalResult(); - } - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, - String topLevelTrackedResourceName, String nextedProxyResourceName) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, - nextedProxyResourceName, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, - Context.NONE); - } - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, - context); - } - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, - String topLevelTrackedResourceName, String nextedProxyResourceName) { - Mono>> mono - = deleteWithResponseAsync(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); - } - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName) { - Response response - = deleteWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName); - return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); - } - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, Context context) { - Response response - = deleteWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context); - return this.client.getLroResult(response, Void.class, Void.class, context); - } - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName) { - return beginDeleteAsync(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName) { - beginDelete(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName).getFinalResult(); - } - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, - Context context) { - beginDelete(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context).getFinalResult(); - } - - /** - * List NestedProxyResource resources by TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a NestedProxyResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByTopLevelTrackedResourceSinglePageAsync(String resourceGroupName, String topLevelTrackedResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByTopLevelTrackedResource(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List NestedProxyResource resources by TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByTopLevelTrackedResourceAsync(String resourceGroupName, - String topLevelTrackedResourceName) { - return new PagedFlux<>( - () -> listByTopLevelTrackedResourceSinglePageAsync(resourceGroupName, topLevelTrackedResourceName), - nextLink -> listByTopLevelTrackedResourceNextSinglePageAsync(nextLink)); - } - - /** - * List NestedProxyResource resources by TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a NestedProxyResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByTopLevelTrackedResourceSinglePage(String resourceGroupName, - String topLevelTrackedResourceName) { - final String accept = "application/json"; - Response res - = service.listByTopLevelTrackedResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List NestedProxyResource resources by TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a NestedProxyResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByTopLevelTrackedResourceSinglePage(String resourceGroupName, - String topLevelTrackedResourceName, Context context) { - final String accept = "application/json"; - Response res - = service.listByTopLevelTrackedResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List NestedProxyResource resources by TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByTopLevelTrackedResource(String resourceGroupName, - String topLevelTrackedResourceName) { - return new PagedIterable<>( - () -> listByTopLevelTrackedResourceSinglePage(resourceGroupName, topLevelTrackedResourceName), - nextLink -> listByTopLevelTrackedResourceNextSinglePage(nextLink)); - } - - /** - * List NestedProxyResource resources by TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByTopLevelTrackedResource(String resourceGroupName, - String topLevelTrackedResourceName, Context context) { - return new PagedIterable<>( - () -> listByTopLevelTrackedResourceSinglePage(resourceGroupName, topLevelTrackedResourceName, context), - nextLink -> listByTopLevelTrackedResourceNextSinglePage(nextLink, context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a NestedProxyResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByTopLevelTrackedResourceNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listByTopLevelTrackedResourceNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a NestedProxyResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByTopLevelTrackedResourceNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listByTopLevelTrackedResourceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a NestedProxyResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByTopLevelTrackedResourceNextSinglePage(String nextLink, - Context context) { - final String accept = "application/json"; - Response res - = service.listByTopLevelTrackedResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsImpl.java deleted file mode 100644 index dd4d8747aaa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.NestedsClient; -import azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner; -import azure.resourcemanager.resources.models.NestedProxyResource; -import azure.resourcemanager.resources.models.Nesteds; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class NestedsImpl implements Nesteds { - private static final ClientLogger LOGGER = new ClientLogger(NestedsImpl.class); - - private final NestedsClient innerClient; - - private final azure.resourcemanager.resources.ResourcesManager serviceManager; - - public NestedsImpl(NestedsClient innerClient, azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, Context context) { - Response inner = this.serviceClient() - .getWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new NestedProxyResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public NestedProxyResource get(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName) { - NestedProxyResourceInner inner - = this.serviceClient().get(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName); - if (inner != null) { - return new NestedProxyResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName) { - this.serviceClient().delete(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName); - } - - public void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, - Context context) { - this.serviceClient().delete(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context); - } - - public PagedIterable listByTopLevelTrackedResource(String resourceGroupName, - String topLevelTrackedResourceName) { - PagedIterable inner - = this.serviceClient().listByTopLevelTrackedResource(resourceGroupName, topLevelTrackedResourceName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new NestedProxyResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByTopLevelTrackedResource(String resourceGroupName, - String topLevelTrackedResourceName, Context context) { - PagedIterable inner = this.serviceClient() - .listByTopLevelTrackedResource(resourceGroupName, topLevelTrackedResourceName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new NestedProxyResourceImpl(inner1, this.manager())); - } - - public NestedProxyResource getById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); - if (topLevelTrackedResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); - } - String nextedProxyResourceName = ResourceManagerUtils.getValueFromIdByName(id, "nestedProxyResources"); - if (nextedProxyResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'nestedProxyResources'.", id))); - } - return this - .getWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, Context.NONE) - .getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); - if (topLevelTrackedResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); - } - String nextedProxyResourceName = ResourceManagerUtils.getValueFromIdByName(id, "nestedProxyResources"); - if (nextedProxyResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'nestedProxyResources'.", id))); - } - return this.getWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context); - } - - public void deleteById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); - if (topLevelTrackedResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); - } - String nextedProxyResourceName = ResourceManagerUtils.getValueFromIdByName(id, "nestedProxyResources"); - if (nextedProxyResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'nestedProxyResources'.", id))); - } - this.delete(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, Context.NONE); - } - - public void deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); - if (topLevelTrackedResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); - } - String nextedProxyResourceName = ResourceManagerUtils.getValueFromIdByName(id, "nestedProxyResources"); - if (nextedProxyResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'nestedProxyResources'.", id))); - } - this.delete(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context); - } - - private NestedsClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.resources.ResourcesManager manager() { - return this.serviceManager; - } - - public NestedProxyResourceImpl define(String name) { - return new NestedProxyResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourceManagerUtils.java deleted file mode 100644 index bdbf8295e4c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourceManagerUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -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.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class ResourceManagerUtils { - private ResourceManagerUtils() { - } - - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (!segments.isEmpty() && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl<>(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux - .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(iterable.iterator(), mapper); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientBuilder.java deleted file mode 100644 index c3248686524..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** - * A builder for creating a new instance of the ResourcesClientImpl type. - */ -@ServiceClientBuilder(serviceClients = { ResourcesClientImpl.class }) -public final class ResourcesClientBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the ResourcesClientBuilder. - */ - public ResourcesClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The ID of the target subscription. The value must be an UUID. - */ - private String subscriptionId; - - /** - * Sets The ID of the target subscription. The value must be an UUID. - * - * @param subscriptionId the subscriptionId value. - * @return the ResourcesClientBuilder. - */ - public ResourcesClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the ResourcesClientBuilder. - */ - public ResourcesClientBuilder environment(AzureEnvironment environment) { - this.environment = environment; - 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 ResourcesClientBuilder. - */ - public ResourcesClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the ResourcesClientBuilder. - */ - public ResourcesClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - 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 ResourcesClientBuilder. - */ - public ResourcesClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of ResourcesClientImpl with the provided parameters. - * - * @return an instance of ResourcesClientImpl. - */ - public ResourcesClientImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval - = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - ResourcesClientImpl client = new ResourcesClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientImpl.java deleted file mode 100644 index 30ccafe16a1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientImpl.java +++ /dev/null @@ -1,372 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.ExtensionsResourcesClient; -import azure.resourcemanager.resources.fluent.LocationResourcesClient; -import azure.resourcemanager.resources.fluent.NestedsClient; -import azure.resourcemanager.resources.fluent.ResourcesClient; -import azure.resourcemanager.resources.fluent.SingletonsClient; -import azure.resourcemanager.resources.fluent.TopLevelsClient; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.management.polling.SyncPollerFactory; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the ResourcesClientImpl type. - */ -@ServiceClient(builder = ResourcesClientBuilder.class) -public final class ResourcesClientImpl implements ResourcesClient { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Version parameter. - */ - private final String apiVersion; - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * The ID of the target subscription. The value must be an UUID. - */ - private final String subscriptionId; - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * 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. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The TopLevelsClient object to access its operations. - */ - private final TopLevelsClient topLevels; - - /** - * Gets the TopLevelsClient object to access its operations. - * - * @return the TopLevelsClient object. - */ - public TopLevelsClient getTopLevels() { - return this.topLevels; - } - - /** - * The NestedsClient object to access its operations. - */ - private final NestedsClient nesteds; - - /** - * Gets the NestedsClient object to access its operations. - * - * @return the NestedsClient object. - */ - public NestedsClient getNesteds() { - return this.nesteds; - } - - /** - * The SingletonsClient object to access its operations. - */ - private final SingletonsClient singletons; - - /** - * Gets the SingletonsClient object to access its operations. - * - * @return the SingletonsClient object. - */ - public SingletonsClient getSingletons() { - return this.singletons; - } - - /** - * The ExtensionsResourcesClient object to access its operations. - */ - private final ExtensionsResourcesClient extensionsResources; - - /** - * Gets the ExtensionsResourcesClient object to access its operations. - * - * @return the ExtensionsResourcesClient object. - */ - public ExtensionsResourcesClient getExtensionsResources() { - return this.extensionsResources; - } - - /** - * The LocationResourcesClient object to access its operations. - */ - private final LocationResourcesClient locationResources; - - /** - * Gets the LocationResourcesClient object to access its operations. - * - * @return the LocationResourcesClient object. - */ - public LocationResourcesClient getLocationResources() { - return this.locationResources; - } - - /** - * Initializes an instance of ResourcesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - ResourcesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, - AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.apiVersion = "2023-12-01-preview"; - this.topLevels = new TopLevelsClientImpl(this); - this.nesteds = new NestedsClientImpl(this); - this.singletons = new SingletonsClientImpl(this); - this.extensionsResources = new ExtensionsResourcesClientImpl(this); - this.locationResources = new LocationResourcesClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return SyncPoller for poll result and final result. - */ - public SyncPoller, U> getLroResult(Response activationResponse, - Type pollResultType, Type finalResultType, Context context) { - return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, () -> activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ResourcesClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonTrackedResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonTrackedResourceImpl.java deleted file mode 100644 index 82b129bcd81..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonTrackedResourceImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; -import azure.resourcemanager.resources.models.SingletonTrackedResource; -import azure.resourcemanager.resources.models.SingletonTrackedResourceProperties; -import com.azure.core.management.SystemData; -import java.util.Collections; -import java.util.Map; - -public final class SingletonTrackedResourceImpl implements SingletonTrackedResource { - private SingletonTrackedResourceInner innerObject; - - private final azure.resourcemanager.resources.ResourcesManager serviceManager; - - SingletonTrackedResourceImpl(SingletonTrackedResourceInner innerObject, - azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public SingletonTrackedResourceProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public SingletonTrackedResourceInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.resources.ResourcesManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsClientImpl.java deleted file mode 100644 index 78468ceadf0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsClientImpl.java +++ /dev/null @@ -1,642 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.SingletonsClient; -import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; -import azure.resourcemanager.resources.implementation.models.SingletonTrackedResourceListResult; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SingletonsClient. - */ -public final class SingletonsClientImpl implements SingletonsClient { - /** - * The proxy service used to perform REST calls. - */ - private final SingletonsService service; - - /** - * The service client containing this operation class. - */ - private final ResourcesClientImpl client; - - /** - * Initializes an instance of SingletonsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SingletonsClientImpl(ResourcesClientImpl client) { - this.service - = RestProxy.create(SingletonsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ResourcesClientSingletons to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ResourcesClientSingletons") - public interface SingletonsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, - Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") SingletonTrackedResourceInner resource, - Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") SingletonTrackedResourceInner resource, - Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, - @BodyParam("application/json") SingletonTrackedResourceInner properties, Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response updateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, - @BodyParam("application/json") SingletonTrackedResourceInner properties, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByResourceGroupNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Get a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SingletonTrackedResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - getByResourceGroupWithResponseAsync(String resourceGroupName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SingletonTrackedResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName) { - return getByResourceGroupWithResponseAsync(resourceGroupName).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SingletonTrackedResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - Context context) { - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, accept, context); - } - - /** - * Get a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SingletonTrackedResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SingletonTrackedResourceInner getByResourceGroup(String resourceGroupName) { - return getByResourceGroupWithResponse(resourceGroupName, Context.NONE).getValue(); - } - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - SingletonTrackedResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, - SingletonTrackedResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, contentType, accept, resource, Context.NONE); - } - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, - SingletonTrackedResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, contentType, accept, resource, context); - } - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, SingletonTrackedResourceInner> - beginCreateOrUpdateAsync(String resourceGroupName, SingletonTrackedResourceInner resource) { - Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, resource); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), SingletonTrackedResourceInner.class, SingletonTrackedResourceInner.class, - this.client.getContext()); - } - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, SingletonTrackedResourceInner> - beginCreateOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource) { - Response response = createOrUpdateWithResponse(resourceGroupName, resource); - return this.client.getLroResult(response, - SingletonTrackedResourceInner.class, SingletonTrackedResourceInner.class, Context.NONE); - } - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, SingletonTrackedResourceInner> - beginCreateOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource, Context context) { - Response response = createOrUpdateWithResponse(resourceGroupName, resource, context); - return this.client.getLroResult(response, - SingletonTrackedResourceInner.class, SingletonTrackedResourceInner.class, context); - } - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, - SingletonTrackedResourceInner resource) { - return beginCreateOrUpdateAsync(resourceGroupName, resource).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SingletonTrackedResourceInner createOrUpdate(String resourceGroupName, - SingletonTrackedResourceInner resource) { - return beginCreateOrUpdate(resourceGroupName, resource).getFinalResult(); - } - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SingletonTrackedResourceInner createOrUpdate(String resourceGroupName, - SingletonTrackedResourceInner resource, Context context) { - return beginCreateOrUpdate(resourceGroupName, resource, context).getFinalResult(); - } - - /** - * Update a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String resourceGroupName, - SingletonTrackedResourceInner properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, contentType, accept, properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, - SingletonTrackedResourceInner properties) { - return updateWithResponseAsync(resourceGroupName, properties).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Update a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(String resourceGroupName, - SingletonTrackedResourceInner properties, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, contentType, accept, properties, context); - } - - /** - * Update a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SingletonTrackedResourceInner update(String resourceGroupName, SingletonTrackedResourceInner properties) { - return updateWithResponse(resourceGroupName, properties, Context.NONE).getValue(); - } - - /** - * List SingletonTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a SingletonTrackedResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupSinglePageAsync(String resourceGroupName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List SingletonTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a SingletonTrackedResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); - } - - /** - * List SingletonTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a SingletonTrackedResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { - final String accept = "application/json"; - Response res = service.listByResourceGroupSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List SingletonTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a SingletonTrackedResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, - Context context) { - final String accept = "application/json"; - Response res = service.listByResourceGroupSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List SingletonTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a SingletonTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePage(nextLink)); - } - - /** - * List SingletonTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a SingletonTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a SingletonTrackedResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a SingletonTrackedResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a SingletonTrackedResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupNextSinglePage(String nextLink, - Context context) { - final String accept = "application/json"; - Response res - = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsImpl.java deleted file mode 100644 index 17d498c93de..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.SingletonsClient; -import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; -import azure.resourcemanager.resources.models.SingletonTrackedResource; -import azure.resourcemanager.resources.models.Singletons; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class SingletonsImpl implements Singletons { - private static final ClientLogger LOGGER = new ClientLogger(SingletonsImpl.class); - - private final SingletonsClient innerClient; - - private final azure.resourcemanager.resources.ResourcesManager serviceManager; - - public SingletonsImpl(SingletonsClient innerClient, - azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, - Context context) { - Response inner - = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SingletonTrackedResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public SingletonTrackedResource getByResourceGroup(String resourceGroupName) { - SingletonTrackedResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName); - if (inner != null) { - return new SingletonTrackedResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public SingletonTrackedResource createOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource) { - SingletonTrackedResourceInner inner = this.serviceClient().createOrUpdate(resourceGroupName, resource); - if (inner != null) { - return new SingletonTrackedResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public SingletonTrackedResource createOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource, - Context context) { - SingletonTrackedResourceInner inner = this.serviceClient().createOrUpdate(resourceGroupName, resource, context); - if (inner != null) { - return new SingletonTrackedResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response updateWithResponse(String resourceGroupName, - SingletonTrackedResourceInner properties, Context context) { - Response inner - = this.serviceClient().updateWithResponse(resourceGroupName, properties, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SingletonTrackedResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public SingletonTrackedResource update(String resourceGroupName, SingletonTrackedResourceInner properties) { - SingletonTrackedResourceInner inner = this.serviceClient().update(resourceGroupName, properties); - if (inner != null) { - return new SingletonTrackedResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public PagedIterable listByResourceGroup(String resourceGroupName) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(resourceGroupName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SingletonTrackedResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new SingletonTrackedResourceImpl(inner1, this.manager())); - } - - private SingletonsClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.resources.ResourcesManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelTrackedResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelTrackedResourceImpl.java deleted file mode 100644 index 63da63b4d06..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelTrackedResourceImpl.java +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner; -import azure.resourcemanager.resources.models.NotificationDetails; -import azure.resourcemanager.resources.models.TopLevelTrackedResource; -import azure.resourcemanager.resources.models.TopLevelTrackedResourceProperties; -import com.azure.core.http.rest.Response; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Collections; -import java.util.Map; - -public final class TopLevelTrackedResourceImpl - implements TopLevelTrackedResource, TopLevelTrackedResource.Definition, TopLevelTrackedResource.Update { - private TopLevelTrackedResourceInner innerObject; - - private final azure.resourcemanager.resources.ResourcesManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public TopLevelTrackedResourceProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public String resourceGroupName() { - return resourceGroupName; - } - - public TopLevelTrackedResourceInner innerModel() { - return this.innerObject; - } - - private azure.resourcemanager.resources.ResourcesManager manager() { - return this.serviceManager; - } - - private String resourceGroupName; - - private String topLevelTrackedResourceName; - - public TopLevelTrackedResourceImpl withExistingResourceGroup(String resourceGroupName) { - this.resourceGroupName = resourceGroupName; - return this; - } - - public TopLevelTrackedResource create() { - this.innerObject = serviceManager.serviceClient() - .getTopLevels() - .createOrReplace(resourceGroupName, topLevelTrackedResourceName, this.innerModel(), Context.NONE); - return this; - } - - public TopLevelTrackedResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTopLevels() - .createOrReplace(resourceGroupName, topLevelTrackedResourceName, this.innerModel(), context); - return this; - } - - TopLevelTrackedResourceImpl(String name, azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerObject = new TopLevelTrackedResourceInner(); - this.serviceManager = serviceManager; - this.topLevelTrackedResourceName = name; - } - - public TopLevelTrackedResourceImpl update() { - return this; - } - - public TopLevelTrackedResource apply() { - this.innerObject = serviceManager.serviceClient() - .getTopLevels() - .update(resourceGroupName, topLevelTrackedResourceName, this.innerModel(), Context.NONE); - return this; - } - - public TopLevelTrackedResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTopLevels() - .update(resourceGroupName, topLevelTrackedResourceName, this.innerModel(), context); - return this; - } - - TopLevelTrackedResourceImpl(TopLevelTrackedResourceInner innerObject, - azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.topLevelTrackedResourceName - = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "topLevelTrackedResources"); - } - - public TopLevelTrackedResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getTopLevels() - .getByResourceGroupWithResponse(resourceGroupName, topLevelTrackedResourceName, Context.NONE) - .getValue(); - return this; - } - - public TopLevelTrackedResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTopLevels() - .getByResourceGroupWithResponse(resourceGroupName, topLevelTrackedResourceName, context) - .getValue(); - return this; - } - - public Response actionSyncWithResponse(NotificationDetails body, Context context) { - return serviceManager.topLevels() - .actionSyncWithResponse(resourceGroupName, topLevelTrackedResourceName, body, context); - } - - public void actionSync(NotificationDetails body) { - serviceManager.topLevels().actionSync(resourceGroupName, topLevelTrackedResourceName, body); - } - - public TopLevelTrackedResourceImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); - return this; - } - - public TopLevelTrackedResourceImpl withRegion(String location) { - this.innerModel().withLocation(location); - return this; - } - - public TopLevelTrackedResourceImpl withTags(Map tags) { - this.innerModel().withTags(tags); - return this; - } - - public TopLevelTrackedResourceImpl withProperties(TopLevelTrackedResourceProperties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsClientImpl.java deleted file mode 100644 index 80bfc177415..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsClientImpl.java +++ /dev/null @@ -1,1241 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.TopLevelsClient; -import azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner; -import azure.resourcemanager.resources.implementation.models.TopLevelTrackedResourceListResult; -import azure.resourcemanager.resources.models.NotificationDetails; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in TopLevelsClient. - */ -public final class TopLevelsClientImpl implements TopLevelsClient { - /** - * The proxy service used to perform REST calls. - */ - private final TopLevelsService service; - - /** - * The service client containing this operation class. - */ - private final ResourcesClientImpl client; - - /** - * Initializes an instance of TopLevelsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - TopLevelsClientImpl(ResourcesClientImpl client) { - this.service - = RestProxy.create(TopLevelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ResourcesClientTopLevels to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ResourcesClientTopLevels") - public interface TopLevelsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrReplace(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") TopLevelTrackedResourceInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrReplaceSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") TopLevelTrackedResourceInner resource, Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> update(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") TopLevelTrackedResourceInner properties, Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response updateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") TopLevelTrackedResourceInner properties, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") - @ExpectedResponses({ 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") - @ExpectedResponses({ 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Accept: application/json;q=0.9" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/actionSync") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> actionSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") NotificationDetails body, - Context context); - - @Headers({ "Accept: application/json;q=0.9" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/actionSync") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response actionSyncSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") NotificationDetails body, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByResourceGroupNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listBySubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listBySubscriptionNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Get a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelTrackedResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String topLevelTrackedResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelTrackedResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, - String topLevelTrackedResourceName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, topLevelTrackedResourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelTrackedResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelTrackedResourceName, Context context) { - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, accept, context); - } - - /** - * Get a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelTrackedResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelTrackedResourceInner getByResourceGroup(String resourceGroupName, - String topLevelTrackedResourceName) { - return getByResourceGroupWithResponse(resourceGroupName, topLevelTrackedResourceName, Context.NONE).getValue(); - } - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, - String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, accept, - resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrReplaceWithResponse(String resourceGroupName, - String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, accept, - resource, Context.NONE); - } - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrReplaceWithResponse(String resourceGroupName, - String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, accept, - resource, context); - } - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, TopLevelTrackedResourceInner> - beginCreateOrReplaceAsync(String resourceGroupName, String topLevelTrackedResourceName, - TopLevelTrackedResourceInner resource) { - Mono>> mono - = createOrReplaceWithResponseAsync(resourceGroupName, topLevelTrackedResourceName, resource); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), TopLevelTrackedResourceInner.class, TopLevelTrackedResourceInner.class, - this.client.getContext()); - } - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, TopLevelTrackedResourceInner> beginCreateOrReplace( - String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource) { - Response response - = createOrReplaceWithResponse(resourceGroupName, topLevelTrackedResourceName, resource); - return this.client.getLroResult(response, - TopLevelTrackedResourceInner.class, TopLevelTrackedResourceInner.class, Context.NONE); - } - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, TopLevelTrackedResourceInner> beginCreateOrReplace( - String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource, - Context context) { - Response response - = createOrReplaceWithResponse(resourceGroupName, topLevelTrackedResourceName, resource, context); - return this.client.getLroResult(response, - TopLevelTrackedResourceInner.class, TopLevelTrackedResourceInner.class, context); - } - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrReplaceAsync(String resourceGroupName, - String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource) { - return beginCreateOrReplaceAsync(resourceGroupName, topLevelTrackedResourceName, resource).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelTrackedResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, - TopLevelTrackedResourceInner resource) { - return beginCreateOrReplace(resourceGroupName, topLevelTrackedResourceName, resource).getFinalResult(); - } - - /** - * Create a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelTrackedResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, - TopLevelTrackedResourceInner resource, Context context) { - return beginCreateOrReplace(resourceGroupName, topLevelTrackedResourceName, resource, context).getFinalResult(); - } - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync(String resourceGroupName, - String topLevelTrackedResourceName, TopLevelTrackedResourceInner properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, accept, - properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response updateWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - TopLevelTrackedResourceInner properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, accept, - properties, Context.NONE); - } - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response updateWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - TopLevelTrackedResourceInner properties, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, accept, - properties, context); - } - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, TopLevelTrackedResourceInner> beginUpdateAsync( - String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner properties) { - Mono>> mono - = updateWithResponseAsync(resourceGroupName, topLevelTrackedResourceName, properties); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), TopLevelTrackedResourceInner.class, TopLevelTrackedResourceInner.class, - this.client.getContext()); - } - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, TopLevelTrackedResourceInner> beginUpdate( - String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner properties) { - Response response = updateWithResponse(resourceGroupName, topLevelTrackedResourceName, properties); - return this.client.getLroResult(response, - TopLevelTrackedResourceInner.class, TopLevelTrackedResourceInner.class, Context.NONE); - } - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, TopLevelTrackedResourceInner> beginUpdate( - String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner properties, - Context context) { - Response response - = updateWithResponse(resourceGroupName, topLevelTrackedResourceName, properties, context); - return this.client.getLroResult(response, - TopLevelTrackedResourceInner.class, TopLevelTrackedResourceInner.class, context); - } - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String topLevelTrackedResourceName, - TopLevelTrackedResourceInner properties) { - return beginUpdateAsync(resourceGroupName, topLevelTrackedResourceName, properties).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelTrackedResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, - TopLevelTrackedResourceInner properties) { - return beginUpdate(resourceGroupName, topLevelTrackedResourceName, properties).getFinalResult(); - } - - /** - * Update a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelTrackedResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, - TopLevelTrackedResourceInner properties, Context context) { - return beginUpdate(resourceGroupName, topLevelTrackedResourceName, properties, context).getFinalResult(); - } - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, - String topLevelTrackedResourceName) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceGroupName, String topLevelTrackedResourceName) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, Context.NONE); - } - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, context); - } - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, - String topLevelTrackedResourceName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, topLevelTrackedResourceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); - } - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, - String topLevelTrackedResourceName) { - Response response = deleteWithResponse(resourceGroupName, topLevelTrackedResourceName); - return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); - } - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName, - Context context) { - Response response = deleteWithResponse(resourceGroupName, topLevelTrackedResourceName, context); - return this.client.getLroResult(response, Void.class, Void.class, context); - } - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String topLevelTrackedResourceName) { - return beginDeleteAsync(resourceGroupName, topLevelTrackedResourceName).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String topLevelTrackedResourceName) { - beginDelete(resourceGroupName, topLevelTrackedResourceName).getFinalResult(); - } - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String topLevelTrackedResourceName, Context context) { - beginDelete(resourceGroupName, topLevelTrackedResourceName, context).getFinalResult(); - } - - /** - * List TopLevelTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByResourceGroupSinglePageAsync(String resourceGroupName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List TopLevelTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); - } - - /** - * List TopLevelTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { - final String accept = "application/json"; - Response res = service.listByResourceGroupSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, - Context context) { - final String accept = "application/json"; - Response res = service.listByResourceGroupSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePage(nextLink)); - } - - /** - * List TopLevelTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); - } - - /** - * List TopLevelTrackedResource resources by subscription ID. - * - * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List TopLevelTrackedResource resources by subscription ID. - * - * @throws ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); - } - - /** - * List TopLevelTrackedResource resources by subscription ID. - * - * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage() { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelTrackedResource resources by subscription ID. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(Context context) { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelTrackedResource resources by subscription ID. - * - * @throws ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); - } - - /** - * List TopLevelTrackedResource resources by subscription ID. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(() -> listSinglePage(context), - nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); - } - - /** - * A synchronous resource action that returns no content. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> actionSyncWithResponseAsync(String resourceGroupName, - String topLevelTrackedResourceName, NotificationDetails body) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, body, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * A synchronous resource action that returns no content. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono actionSyncAsync(String resourceGroupName, String topLevelTrackedResourceName, - NotificationDetails body) { - return actionSyncWithResponseAsync(resourceGroupName, topLevelTrackedResourceName, body) - .flatMap(ignored -> Mono.empty()); - } - - /** - * A synchronous resource action that returns no content. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response actionSyncWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - NotificationDetails body, Context context) { - final String contentType = "application/json"; - return service.actionSyncSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, body, - context); - } - - /** - * A synchronous resource action that returns no content. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void actionSync(String resourceGroupName, String topLevelTrackedResourceName, NotificationDetails body) { - actionSyncWithResponse(resourceGroupName, topLevelTrackedResourceName, body, Context.NONE); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupNextSinglePage(String nextLink, - Context context) { - final String accept = "application/json"; - Response res - = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listBySubscriptionNextSinglePage(String nextLink, - Context context) { - final String accept = "application/json"; - Response res - = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsImpl.java deleted file mode 100644 index ef143a2f101..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsImpl.java +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation; - -import azure.resourcemanager.resources.fluent.TopLevelsClient; -import azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner; -import azure.resourcemanager.resources.models.NotificationDetails; -import azure.resourcemanager.resources.models.TopLevelTrackedResource; -import azure.resourcemanager.resources.models.TopLevels; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; - -public final class TopLevelsImpl implements TopLevels { - private static final ClientLogger LOGGER = new ClientLogger(TopLevelsImpl.class); - - private final TopLevelsClient innerClient; - - private final azure.resourcemanager.resources.ResourcesManager serviceManager; - - public TopLevelsImpl(TopLevelsClient innerClient, azure.resourcemanager.resources.ResourcesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelTrackedResourceName, Context context) { - Response inner = this.serviceClient() - .getByResourceGroupWithResponse(resourceGroupName, topLevelTrackedResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new TopLevelTrackedResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public TopLevelTrackedResource getByResourceGroup(String resourceGroupName, String topLevelTrackedResourceName) { - TopLevelTrackedResourceInner inner - = this.serviceClient().getByResourceGroup(resourceGroupName, topLevelTrackedResourceName); - if (inner != null) { - return new TopLevelTrackedResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public void deleteByResourceGroup(String resourceGroupName, String topLevelTrackedResourceName) { - this.serviceClient().delete(resourceGroupName, topLevelTrackedResourceName); - } - - public void delete(String resourceGroupName, String topLevelTrackedResourceName, Context context) { - this.serviceClient().delete(resourceGroupName, topLevelTrackedResourceName, context); - } - - public PagedIterable listByResourceGroup(String resourceGroupName) { - PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelTrackedResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelTrackedResourceImpl(inner1, this.manager())); - } - - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelTrackedResourceImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelTrackedResourceImpl(inner1, this.manager())); - } - - public Response actionSyncWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - NotificationDetails body, Context context) { - return this.serviceClient() - .actionSyncWithResponse(resourceGroupName, topLevelTrackedResourceName, body, context); - } - - public void actionSync(String resourceGroupName, String topLevelTrackedResourceName, NotificationDetails body) { - this.serviceClient().actionSync(resourceGroupName, topLevelTrackedResourceName, body); - } - - public TopLevelTrackedResource getById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); - if (topLevelTrackedResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, topLevelTrackedResourceName, Context.NONE) - .getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); - if (topLevelTrackedResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, topLevelTrackedResourceName, context); - } - - public void deleteById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); - if (topLevelTrackedResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); - } - this.delete(resourceGroupName, topLevelTrackedResourceName, Context.NONE); - } - - public void deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); - if (topLevelTrackedResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); - } - this.delete(resourceGroupName, topLevelTrackedResourceName, context); - } - - private TopLevelsClient serviceClient() { - return this.innerClient; - } - - private azure.resourcemanager.resources.ResourcesManager manager() { - return this.serviceManager; - } - - public TopLevelTrackedResourceImpl define(String name) { - return new TopLevelTrackedResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/ExtensionsResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/ExtensionsResourceListResult.java deleted file mode 100644 index 99bcea9924e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/ExtensionsResourceListResult.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation.models; - -import azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The response of a ExtensionsResource list operation. - */ -@Immutable -public final class ExtensionsResourceListResult implements JsonSerializable { - /* - * The ExtensionsResource items on this page - */ - private List value; - - /* - * The link to the next page of items - */ - private String nextLink; - - /** - * Creates an instance of ExtensionsResourceListResult class. - */ - private ExtensionsResourceListResult() { - } - - /** - * Get the value property: The ExtensionsResource items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExtensionsResourceListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExtensionsResourceListResult if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExtensionsResourceListResult. - */ - public static ExtensionsResourceListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ExtensionsResourceListResult deserializedExtensionsResourceListResult = new ExtensionsResourceListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> ExtensionsResourceInner.fromJson(reader1)); - deserializedExtensionsResourceListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedExtensionsResourceListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedExtensionsResourceListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/LocationResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/LocationResourceListResult.java deleted file mode 100644 index 66a9c0d7c46..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/LocationResourceListResult.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation.models; - -import azure.resourcemanager.resources.fluent.models.LocationResourceInner; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The response of a LocationResource list operation. - */ -@Immutable -public final class LocationResourceListResult implements JsonSerializable { - /* - * The LocationResource items on this page - */ - private List value; - - /* - * The link to the next page of items - */ - private String nextLink; - - /** - * Creates an instance of LocationResourceListResult class. - */ - private LocationResourceListResult() { - } - - /** - * Get the value property: The LocationResource items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of LocationResourceListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of LocationResourceListResult if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the LocationResourceListResult. - */ - public static LocationResourceListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - LocationResourceListResult deserializedLocationResourceListResult = new LocationResourceListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> LocationResourceInner.fromJson(reader1)); - deserializedLocationResourceListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedLocationResourceListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedLocationResourceListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/NestedProxyResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/NestedProxyResourceListResult.java deleted file mode 100644 index 5b5ad6116fb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/NestedProxyResourceListResult.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation.models; - -import azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The response of a NestedProxyResource list operation. - */ -@Immutable -public final class NestedProxyResourceListResult implements JsonSerializable { - /* - * The NestedProxyResource items on this page - */ - private List value; - - /* - * The link to the next page of items - */ - private String nextLink; - - /** - * Creates an instance of NestedProxyResourceListResult class. - */ - private NestedProxyResourceListResult() { - } - - /** - * Get the value property: The NestedProxyResource items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NestedProxyResourceListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NestedProxyResourceListResult if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NestedProxyResourceListResult. - */ - public static NestedProxyResourceListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NestedProxyResourceListResult deserializedNestedProxyResourceListResult - = new NestedProxyResourceListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> NestedProxyResourceInner.fromJson(reader1)); - deserializedNestedProxyResourceListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedNestedProxyResourceListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedNestedProxyResourceListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/SingletonTrackedResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/SingletonTrackedResourceListResult.java deleted file mode 100644 index cef78e46164..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/SingletonTrackedResourceListResult.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation.models; - -import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The response of a SingletonTrackedResource list operation. - */ -@Immutable -public final class SingletonTrackedResourceListResult implements JsonSerializable { - /* - * The SingletonTrackedResource items on this page - */ - private List value; - - /* - * The link to the next page of items - */ - private String nextLink; - - /** - * Creates an instance of SingletonTrackedResourceListResult class. - */ - private SingletonTrackedResourceListResult() { - } - - /** - * Get the value property: The SingletonTrackedResource items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SingletonTrackedResourceListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SingletonTrackedResourceListResult if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SingletonTrackedResourceListResult. - */ - public static SingletonTrackedResourceListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SingletonTrackedResourceListResult deserializedSingletonTrackedResourceListResult - = new SingletonTrackedResourceListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> SingletonTrackedResourceInner.fromJson(reader1)); - deserializedSingletonTrackedResourceListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedSingletonTrackedResourceListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedSingletonTrackedResourceListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/TopLevelTrackedResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/TopLevelTrackedResourceListResult.java deleted file mode 100644 index a2c2fd93ed2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/TopLevelTrackedResourceListResult.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.implementation.models; - -import azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The response of a TopLevelTrackedResource list operation. - */ -@Immutable -public final class TopLevelTrackedResourceListResult implements JsonSerializable { - /* - * The TopLevelTrackedResource items on this page - */ - private List value; - - /* - * The link to the next page of items - */ - private String nextLink; - - /** - * Creates an instance of TopLevelTrackedResourceListResult class. - */ - private TopLevelTrackedResourceListResult() { - } - - /** - * Get the value property: The TopLevelTrackedResource items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelTrackedResourceListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelTrackedResourceListResult if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TopLevelTrackedResourceListResult. - */ - public static TopLevelTrackedResourceListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelTrackedResourceListResult deserializedTopLevelTrackedResourceListResult - = new TopLevelTrackedResourceListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> TopLevelTrackedResourceInner.fromJson(reader1)); - deserializedTopLevelTrackedResourceListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedTopLevelTrackedResourceListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelTrackedResourceListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/package-info.java deleted file mode 100644 index 3af261c2c86..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the implementations for Resources. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.resources.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResource.java deleted file mode 100644 index a0889b14778..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResource.java +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; - -/** - * An immutable client-side representation of ExtensionsResource. - */ -public interface ExtensionsResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - ExtensionsResourceProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the inner azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner object. - * - * @return the inner object. - */ - ExtensionsResourceInner innerModel(); - - /** - * The entirety of the ExtensionsResource definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { - } - - /** - * The ExtensionsResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the ExtensionsResource definition. - */ - interface Blank extends WithScope { - } - - /** - * The stage of the ExtensionsResource definition allowing to specify parent resource. - */ - interface WithScope { - /** - * Specifies resourceUri. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @return the next definition stage. - */ - WithCreate withExistingResourceUri(String resourceUri); - } - - /** - * The stage of the ExtensionsResource definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - ExtensionsResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - ExtensionsResource create(Context context); - } - - /** - * The stage of the ExtensionsResource definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(ExtensionsResourceProperties properties); - } - } - - /** - * Begins update for the ExtensionsResource resource. - * - * @return the stage of resource update. - */ - ExtensionsResource.Update update(); - - /** - * The template for ExtensionsResource update. - */ - interface Update extends UpdateStages.WithProperties { - /** - * Executes the update request. - * - * @return the updated resource. - */ - ExtensionsResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - ExtensionsResource apply(Context context); - } - - /** - * The ExtensionsResource update stages. - */ - interface UpdateStages { - /** - * The stage of the ExtensionsResource update allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - Update withProperties(ExtensionsResourceProperties properties); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - ExtensionsResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - ExtensionsResource refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResourceProperties.java deleted file mode 100644 index aa249496965..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResourceProperties.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * ExtensionsResource properties. - */ -@Fluent -public final class ExtensionsResourceProperties implements JsonSerializable { - /* - * The description of the resource. - */ - private String description; - - /* - * The status of the last operation. - */ - private ProvisioningState provisioningState; - - /** - * Creates an instance of ExtensionsResourceProperties class. - */ - public ExtensionsResourceProperties() { - } - - /** - * Get the description property: The description of the resource. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Set the description property: The description of the resource. - * - * @param description the description value to set. - * @return the ExtensionsResourceProperties object itself. - */ - public ExtensionsResourceProperties withDescription(String description) { - this.description = description; - return this; - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExtensionsResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExtensionsResourceProperties if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the ExtensionsResourceProperties. - */ - public static ExtensionsResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ExtensionsResourceProperties deserializedExtensionsResourceProperties = new ExtensionsResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("description".equals(fieldName)) { - deserializedExtensionsResourceProperties.description = reader.getString(); - } else if ("provisioningState".equals(fieldName)) { - deserializedExtensionsResourceProperties.provisioningState - = ProvisioningState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedExtensionsResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResources.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResources.java deleted file mode 100644 index 89169d96802..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResources.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of ExtensionsResources. - */ -public interface ExtensionsResources { - /** - * Get a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ExtensionsResource along with {@link Response}. - */ - Response getWithResponse(String resourceUri, String extensionsResourceName, Context context); - - /** - * Get a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ExtensionsResource. - */ - ExtensionsResource get(String resourceUri, String extensionsResourceName); - - /** - * Delete a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByResourceGroupWithResponse(String resourceUri, String extensionsResourceName, - Context context); - - /** - * Delete a ExtensionsResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param extensionsResourceName The name of the ExtensionsResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String resourceUri, String extensionsResourceName); - - /** - * List ExtensionsResource resources by parent. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByScope(String resourceUri); - - /** - * List ExtensionsResource resources by parent. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByScope(String resourceUri, Context context); - - /** - * Get a ExtensionsResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ExtensionsResource along with {@link Response}. - */ - ExtensionsResource getById(String id); - - /** - * Get a ExtensionsResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ExtensionsResource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Delete a ExtensionsResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a ExtensionsResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new ExtensionsResource resource. - * - * @param name resource name. - * @return the first stage of the new ExtensionsResource definition. - */ - ExtensionsResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResource.java deleted file mode 100644 index 437d9311d12..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResource.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import azure.resourcemanager.resources.fluent.models.LocationResourceInner; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; - -/** - * An immutable client-side representation of LocationResource. - */ -public interface LocationResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - LocationResourceProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the inner azure.resourcemanager.resources.fluent.models.LocationResourceInner object. - * - * @return the inner object. - */ - LocationResourceInner innerModel(); - - /** - * The entirety of the LocationResource definition. - */ - interface Definition - extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { - } - - /** - * The LocationResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the LocationResource definition. - */ - interface Blank extends WithParentResource { - } - - /** - * The stage of the LocationResource definition allowing to specify parent resource. - */ - interface WithParentResource { - /** - * Specifies location. - * - * @param location The name of the Azure region. - * @return the next definition stage. - */ - WithCreate withExistingLocation(String location); - } - - /** - * The stage of the LocationResource definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - LocationResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - LocationResource create(Context context); - } - - /** - * The stage of the LocationResource definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(LocationResourceProperties properties); - } - } - - /** - * Begins update for the LocationResource resource. - * - * @return the stage of resource update. - */ - LocationResource.Update update(); - - /** - * The template for LocationResource update. - */ - interface Update extends UpdateStages.WithProperties { - /** - * Executes the update request. - * - * @return the updated resource. - */ - LocationResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - LocationResource apply(Context context); - } - - /** - * The LocationResource update stages. - */ - interface UpdateStages { - /** - * The stage of the LocationResource update allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - Update withProperties(LocationResourceProperties properties); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - LocationResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - LocationResource refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResourceProperties.java deleted file mode 100644 index 3fdaae10b50..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResourceProperties.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Location resource properties. - */ -@Fluent -public final class LocationResourceProperties implements JsonSerializable { - /* - * The description of the resource. - */ - private String description; - - /* - * The status of the last operation. - */ - private ProvisioningState provisioningState; - - /** - * Creates an instance of LocationResourceProperties class. - */ - public LocationResourceProperties() { - } - - /** - * Get the description property: The description of the resource. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Set the description property: The description of the resource. - * - * @param description the description value to set. - * @return the LocationResourceProperties object itself. - */ - public LocationResourceProperties withDescription(String description) { - this.description = description; - return this; - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of LocationResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of LocationResourceProperties if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the LocationResourceProperties. - */ - public static LocationResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - LocationResourceProperties deserializedLocationResourceProperties = new LocationResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("description".equals(fieldName)) { - deserializedLocationResourceProperties.description = reader.getString(); - } else if ("provisioningState".equals(fieldName)) { - deserializedLocationResourceProperties.provisioningState - = ProvisioningState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedLocationResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResources.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResources.java deleted file mode 100644 index d80a2171f3d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResources.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of LocationResources. - */ -public interface LocationResources { - /** - * Get a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a LocationResource along with {@link Response}. - */ - Response getWithResponse(String location, String locationResourceName, Context context); - - /** - * Get a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a LocationResource. - */ - LocationResource get(String location, String locationResourceName); - - /** - * Delete a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByResourceGroupWithResponse(String location, String locationResourceName, Context context); - - /** - * Delete a LocationResource. - * - * @param location The name of the Azure region. - * @param locationResourceName The name of the LocationResource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String location, String locationResourceName); - - /** - * List LocationResource resources by SubscriptionLocationResource. - * - * @param location The name of the Azure region. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByLocation(String location); - - /** - * List LocationResource resources by SubscriptionLocationResource. - * - * @param location The name of the Azure region. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByLocation(String location, Context context); - - /** - * Get a LocationResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a LocationResource along with {@link Response}. - */ - LocationResource getById(String id); - - /** - * Get a LocationResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a LocationResource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Delete a LocationResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a LocationResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new LocationResource resource. - * - * @param name resource name. - * @return the first stage of the new LocationResource definition. - */ - LocationResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResource.java deleted file mode 100644 index 7fd3d7e47ea..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResource.java +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; - -/** - * An immutable client-side representation of NestedProxyResource. - */ -public interface NestedProxyResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - NestedProxyResourceProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the name of the resource group. - * - * @return the name of the resource group. - */ - String resourceGroupName(); - - /** - * Gets the inner azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner object. - * - * @return the inner object. - */ - NestedProxyResourceInner innerModel(); - - /** - * The entirety of the NestedProxyResource definition. - */ - interface Definition - extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { - } - - /** - * The NestedProxyResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the NestedProxyResource definition. - */ - interface Blank extends WithParentResource { - } - - /** - * The stage of the NestedProxyResource definition allowing to specify parent resource. - */ - interface WithParentResource { - /** - * Specifies resourceGroupName, topLevelTrackedResourceName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @return the next definition stage. - */ - WithCreate withExistingTopLevelTrackedResource(String resourceGroupName, - String topLevelTrackedResourceName); - } - - /** - * The stage of the NestedProxyResource definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - NestedProxyResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - NestedProxyResource create(Context context); - } - - /** - * The stage of the NestedProxyResource definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(NestedProxyResourceProperties properties); - } - } - - /** - * Begins update for the NestedProxyResource resource. - * - * @return the stage of resource update. - */ - NestedProxyResource.Update update(); - - /** - * The template for NestedProxyResource update. - */ - interface Update extends UpdateStages.WithProperties { - /** - * Executes the update request. - * - * @return the updated resource. - */ - NestedProxyResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - NestedProxyResource apply(Context context); - } - - /** - * The NestedProxyResource update stages. - */ - interface UpdateStages { - /** - * The stage of the NestedProxyResource update allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - Update withProperties(NestedProxyResourceProperties properties); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - NestedProxyResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - NestedProxyResource refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResourceProperties.java deleted file mode 100644 index 573424d24c9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResourceProperties.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Nested Proxy Resource Properties. - */ -@Fluent -public final class NestedProxyResourceProperties implements JsonSerializable { - /* - * Provisioning State of the nested child Resource - */ - private ProvisioningState provisioningState; - - /* - * Nested resource description. - */ - private String description; - - /** - * Creates an instance of NestedProxyResourceProperties class. - */ - public NestedProxyResourceProperties() { - } - - /** - * Get the provisioningState property: Provisioning State of the nested child Resource. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Get the description property: Nested resource description. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Set the description property: Nested resource description. - * - * @param description the description value to set. - * @return the NestedProxyResourceProperties object itself. - */ - public NestedProxyResourceProperties withDescription(String description) { - this.description = description; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NestedProxyResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NestedProxyResourceProperties if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the NestedProxyResourceProperties. - */ - public static NestedProxyResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NestedProxyResourceProperties deserializedNestedProxyResourceProperties - = new NestedProxyResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedNestedProxyResourceProperties.provisioningState - = ProvisioningState.fromString(reader.getString()); - } else if ("description".equals(fieldName)) { - deserializedNestedProxyResourceProperties.description = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedNestedProxyResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Nesteds.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Nesteds.java deleted file mode 100644 index 35e29ad0477..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Nesteds.java +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of Nesteds. - */ -public interface Nesteds { - /** - * Get a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a NestedProxyResource along with {@link Response}. - */ - Response getWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName, Context context); - - /** - * Get a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a NestedProxyResource. - */ - NestedProxyResource get(String resourceGroupName, String topLevelTrackedResourceName, - String nextedProxyResourceName); - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName); - - /** - * Delete a NestedProxyResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param nextedProxyResourceName Name of the nested resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, - Context context); - - /** - * List NestedProxyResource resources by TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByTopLevelTrackedResource(String resourceGroupName, - String topLevelTrackedResourceName); - - /** - * List NestedProxyResource resources by TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByTopLevelTrackedResource(String resourceGroupName, - String topLevelTrackedResourceName, Context context); - - /** - * Get a NestedProxyResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a NestedProxyResource along with {@link Response}. - */ - NestedProxyResource getById(String id); - - /** - * Get a NestedProxyResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a NestedProxyResource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Delete a NestedProxyResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a NestedProxyResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new NestedProxyResource resource. - * - * @param name resource name. - * @return the first stage of the new NestedProxyResource definition. - */ - NestedProxyResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NotificationDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NotificationDetails.java deleted file mode 100644 index 8da79ea2cd1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NotificationDetails.java +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The details of a user notification. - */ -@Fluent -public final class NotificationDetails implements JsonSerializable { - /* - * The notification message. - */ - private String message; - - /* - * If true, the notification is urgent. - */ - private boolean urgent; - - /** - * Creates an instance of NotificationDetails class. - */ - public NotificationDetails() { - } - - /** - * Get the message property: The notification message. - * - * @return the message value. - */ - public String message() { - return this.message; - } - - /** - * Set the message property: The notification message. - * - * @param message the message value to set. - * @return the NotificationDetails object itself. - */ - public NotificationDetails withMessage(String message) { - this.message = message; - return this; - } - - /** - * Get the urgent property: If true, the notification is urgent. - * - * @return the urgent value. - */ - public boolean urgent() { - return this.urgent; - } - - /** - * Set the urgent property: If true, the notification is urgent. - * - * @param urgent the urgent value to set. - * @return the NotificationDetails object itself. - */ - public NotificationDetails withUrgent(boolean urgent) { - this.urgent = urgent; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("message", this.message); - jsonWriter.writeBooleanField("urgent", this.urgent); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NotificationDetails from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NotificationDetails if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NotificationDetails. - */ - public static NotificationDetails fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NotificationDetails deserializedNotificationDetails = new NotificationDetails(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("message".equals(fieldName)) { - deserializedNotificationDetails.message = reader.getString(); - } else if ("urgent".equals(fieldName)) { - deserializedNotificationDetails.urgent = reader.getBoolean(); - } else { - reader.skipChildren(); - } - } - - return deserializedNotificationDetails; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ProvisioningState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ProvisioningState.java deleted file mode 100644 index b78fe07d209..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ProvisioningState.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for ProvisioningState. - */ -public final class ProvisioningState extends ExpandableStringEnum { - /** - * Resource has been created. - */ - public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); - - /** - * Resource creation failed. - */ - public static final ProvisioningState FAILED = fromString("Failed"); - - /** - * Resource creation was canceled. - */ - public static final ProvisioningState CANCELED = fromString("Canceled"); - - /** - * Static value Provisioning for ProvisioningState. - */ - public static final ProvisioningState PROVISIONING = fromString("Provisioning"); - - /** - * Static value Updating for ProvisioningState. - */ - public static final ProvisioningState UPDATING = fromString("Updating"); - - /** - * Static value Deleting for ProvisioningState. - */ - public static final ProvisioningState DELETING = fromString("Deleting"); - - /** - * Static value Accepted for ProvisioningState. - */ - public static final ProvisioningState ACCEPTED = fromString("Accepted"); - - /** - * Creates a new instance of ProvisioningState value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ProvisioningState() { - } - - /** - * Creates or finds a ProvisioningState from its string representation. - * - * @param name a name to look for. - * @return the corresponding ProvisioningState. - */ - public static ProvisioningState fromString(String name) { - return fromString(name, ProvisioningState.class); - } - - /** - * Gets known ProvisioningState values. - * - * @return known ProvisioningState values. - */ - public static Collection values() { - return values(ProvisioningState.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResource.java deleted file mode 100644 index 33ce6468dd2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResource.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; -import com.azure.core.management.SystemData; -import java.util.Map; - -/** - * An immutable client-side representation of SingletonTrackedResource. - */ -public interface SingletonTrackedResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - SingletonTrackedResourceProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the inner azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner object. - * - * @return the inner object. - */ - SingletonTrackedResourceInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResourceProperties.java deleted file mode 100644 index ba0a6117dd9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResourceProperties.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Singleton Arm Resource Properties. - */ -@Fluent -public final class SingletonTrackedResourceProperties implements JsonSerializable { - /* - * The status of the last operation. - */ - private ProvisioningState provisioningState; - - /* - * The description of the resource. - */ - private String description; - - /** - * Creates an instance of SingletonTrackedResourceProperties class. - */ - public SingletonTrackedResourceProperties() { - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Get the description property: The description of the resource. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Set the description property: The description of the resource. - * - * @param description the description value to set. - * @return the SingletonTrackedResourceProperties object itself. - */ - public SingletonTrackedResourceProperties withDescription(String description) { - this.description = description; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SingletonTrackedResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SingletonTrackedResourceProperties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the SingletonTrackedResourceProperties. - */ - public static SingletonTrackedResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SingletonTrackedResourceProperties deserializedSingletonTrackedResourceProperties - = new SingletonTrackedResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedSingletonTrackedResourceProperties.provisioningState - = ProvisioningState.fromString(reader.getString()); - } else if ("description".equals(fieldName)) { - deserializedSingletonTrackedResourceProperties.description = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedSingletonTrackedResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Singletons.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Singletons.java deleted file mode 100644 index c7a207ade57..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Singletons.java +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of Singletons. - */ -public interface Singletons { - /** - * Get a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SingletonTrackedResource along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, Context context); - - /** - * Get a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SingletonTrackedResource. - */ - SingletonTrackedResource getByResourceGroup(String resourceGroupName); - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - SingletonTrackedResource createOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource); - - /** - * Create a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - SingletonTrackedResource createOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource, - Context context); - - /** - * Update a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - Response updateWithResponse(String resourceGroupName, - SingletonTrackedResourceInner properties, Context context); - - /** - * Update a SingletonTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - SingletonTrackedResource update(String resourceGroupName, SingletonTrackedResourceInner properties); - - /** - * List SingletonTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a SingletonTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * List SingletonTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a SingletonTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String resourceGroupName, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResource.java deleted file mode 100644 index 7343eb4d422..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResource.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner; -import com.azure.core.http.rest.Response; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Map; - -/** - * An immutable client-side representation of TopLevelTrackedResource. - */ -public interface TopLevelTrackedResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - TopLevelTrackedResourceProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the name of the resource group. - * - * @return the name of the resource group. - */ - String resourceGroupName(); - - /** - * Gets the inner azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner object. - * - * @return the inner object. - */ - TopLevelTrackedResourceInner innerModel(); - - /** - * The entirety of the TopLevelTrackedResource definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { - } - - /** - * The TopLevelTrackedResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the TopLevelTrackedResource definition. - */ - interface Blank extends WithLocation { - } - - /** - * The stage of the TopLevelTrackedResource definition allowing to specify location. - */ - interface WithLocation { - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(Region location); - - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(String location); - } - - /** - * The stage of the TopLevelTrackedResource definition allowing to specify parent resource. - */ - interface WithResourceGroup { - /** - * Specifies resourceGroupName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @return the next definition stage. - */ - WithCreate withExistingResourceGroup(String resourceGroupName); - } - - /** - * The stage of the TopLevelTrackedResource definition which contains all the minimum required properties for - * the resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - TopLevelTrackedResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - TopLevelTrackedResource create(Context context); - } - - /** - * The stage of the TopLevelTrackedResource definition allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - WithCreate withTags(Map tags); - } - - /** - * The stage of the TopLevelTrackedResource definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(TopLevelTrackedResourceProperties properties); - } - } - - /** - * Begins update for the TopLevelTrackedResource resource. - * - * @return the stage of resource update. - */ - TopLevelTrackedResource.Update update(); - - /** - * The template for TopLevelTrackedResource update. - */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { - /** - * Executes the update request. - * - * @return the updated resource. - */ - TopLevelTrackedResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - TopLevelTrackedResource apply(Context context); - } - - /** - * The TopLevelTrackedResource update stages. - */ - interface UpdateStages { - /** - * The stage of the TopLevelTrackedResource update allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - Update withTags(Map tags); - } - - /** - * The stage of the TopLevelTrackedResource update allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - Update withProperties(TopLevelTrackedResourceProperties properties); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - TopLevelTrackedResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - TopLevelTrackedResource refresh(Context context); - - /** - * A synchronous resource action that returns no content. - * - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response actionSyncWithResponse(NotificationDetails body, Context context); - - /** - * A synchronous resource action that returns no content. - * - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void actionSync(NotificationDetails body); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResourceProperties.java deleted file mode 100644 index 621b5ab70cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResourceProperties.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Top Level Arm Resource Properties. - */ -@Fluent -public final class TopLevelTrackedResourceProperties implements JsonSerializable { - /* - * The status of the last operation. - */ - private ProvisioningState provisioningState; - - /* - * The description of the resource. - */ - private String description; - - /** - * Creates an instance of TopLevelTrackedResourceProperties class. - */ - public TopLevelTrackedResourceProperties() { - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Get the description property: The description of the resource. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Set the description property: The description of the resource. - * - * @param description the description value to set. - * @return the TopLevelTrackedResourceProperties object itself. - */ - public TopLevelTrackedResourceProperties withDescription(String description) { - this.description = description; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelTrackedResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelTrackedResourceProperties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the TopLevelTrackedResourceProperties. - */ - public static TopLevelTrackedResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelTrackedResourceProperties deserializedTopLevelTrackedResourceProperties - = new TopLevelTrackedResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedTopLevelTrackedResourceProperties.provisioningState - = ProvisioningState.fromString(reader.getString()); - } else if ("description".equals(fieldName)) { - deserializedTopLevelTrackedResourceProperties.description = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelTrackedResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevels.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevels.java deleted file mode 100644 index 4eb259aa47b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevels.java +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.resources.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of TopLevels. - */ -public interface TopLevels { - /** - * Get a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelTrackedResource along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelTrackedResourceName, Context context); - - /** - * Get a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelTrackedResource. - */ - TopLevelTrackedResource getByResourceGroup(String resourceGroupName, String topLevelTrackedResourceName); - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String resourceGroupName, String topLevelTrackedResourceName); - - /** - * Delete a TopLevelTrackedResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceGroupName, String topLevelTrackedResourceName, Context context); - - /** - * List TopLevelTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * List TopLevelTrackedResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String resourceGroupName, Context context); - - /** - * List TopLevelTrackedResource resources by subscription ID. - * - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - PagedIterable list(); - - /** - * List TopLevelTrackedResource resources by subscription ID. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with - * {@link PagedIterable}. - */ - PagedIterable list(Context context); - - /** - * A synchronous resource action that returns no content. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param body The content of the action request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response actionSyncWithResponse(String resourceGroupName, String topLevelTrackedResourceName, - NotificationDetails body, Context context); - - /** - * A synchronous resource action that returns no content. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelTrackedResourceName arm resource name for path. - * @param body The content of the action request. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void actionSync(String resourceGroupName, String topLevelTrackedResourceName, NotificationDetails body); - - /** - * Get a TopLevelTrackedResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelTrackedResource along with {@link Response}. - */ - TopLevelTrackedResource getById(String id); - - /** - * Get a TopLevelTrackedResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelTrackedResource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Delete a TopLevelTrackedResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a TopLevelTrackedResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new TopLevelTrackedResource resource. - * - * @param name resource name. - * @return the first stage of the new TopLevelTrackedResource definition. - */ - TopLevelTrackedResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/package-info.java deleted file mode 100644 index d0dff3ee76b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the data models for Resources. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.resources.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/package-info.java deleted file mode 100644 index fdf2263b127..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the classes for Resources. - * Arm Resource Provider management API. - */ -package azure.resourcemanager.resources; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdAsyncClient.java deleted file mode 100644 index b93f19586bc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdAsyncClient.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.specialheaders.xmsclientrequestid; - -import azure.specialheaders.xmsclientrequestid.implementation.XmsClientRequestIdClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous XmsClientRequestIdClient type. - */ -@ServiceClient(builder = XmsClientRequestIdClientBuilder.class, isAsync = true) -public final class XmsClientRequestIdAsyncClient { - @Generated - private final XmsClientRequestIdClientImpl serviceClient; - - /** - * Initializes an instance of XmsClientRequestIdAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - XmsClientRequestIdAsyncClient(XmsClientRequestIdClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get operation with azure `x-ms-client-request-id` header. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return operation with azure `x-ms-client-request-id` header along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Get operation with azure `x-ms-client-request-id` header. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return operation with azure `x-ms-client-request-id` header on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClient.java deleted file mode 100644 index 402124a15bd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.specialheaders.xmsclientrequestid; - -import azure.specialheaders.xmsclientrequestid.implementation.XmsClientRequestIdClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous XmsClientRequestIdClient type. - */ -@ServiceClient(builder = XmsClientRequestIdClientBuilder.class) -public final class XmsClientRequestIdClient { - @Generated - private final XmsClientRequestIdClientImpl serviceClient; - - /** - * Initializes an instance of XmsClientRequestIdClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - XmsClientRequestIdClient(XmsClientRequestIdClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get operation with azure `x-ms-client-request-id` header. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return operation with azure `x-ms-client-request-id` header along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Get operation with azure `x-ms-client-request-id` header. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - getWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClientBuilder.java deleted file mode 100644 index 7119e5ee7af..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.specialheaders.xmsclientrequestid; - -import azure.specialheaders.xmsclientrequestid.implementation.XmsClientRequestIdClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the XmsClientRequestIdClient type. - */ -@ServiceClientBuilder(serviceClients = { XmsClientRequestIdClient.class, XmsClientRequestIdAsyncClient.class }) -public final class XmsClientRequestIdClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-specialheaders-xmsclientrequestid.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the XmsClientRequestIdClientBuilder. - */ - @Generated - public XmsClientRequestIdClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public XmsClientRequestIdClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public XmsClientRequestIdClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public XmsClientRequestIdClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public XmsClientRequestIdClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public XmsClientRequestIdClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public XmsClientRequestIdClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public XmsClientRequestIdClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public XmsClientRequestIdClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the XmsClientRequestIdClientBuilder. - */ - @Generated - public XmsClientRequestIdClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of XmsClientRequestIdClientImpl with the provided parameters. - * - * @return an instance of XmsClientRequestIdClientImpl. - */ - @Generated - private XmsClientRequestIdClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - XmsClientRequestIdClientImpl client = new XmsClientRequestIdClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of XmsClientRequestIdAsyncClient class. - * - * @return an instance of XmsClientRequestIdAsyncClient. - */ - @Generated - public XmsClientRequestIdAsyncClient buildAsyncClient() { - return new XmsClientRequestIdAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of XmsClientRequestIdClient class. - * - * @return an instance of XmsClientRequestIdClient. - */ - @Generated - public XmsClientRequestIdClient buildClient() { - return new XmsClientRequestIdClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(XmsClientRequestIdClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/XmsClientRequestIdClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/XmsClientRequestIdClientImpl.java deleted file mode 100644 index 8956b968849..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/XmsClientRequestIdClientImpl.java +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.specialheaders.xmsclientrequestid.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the XmsClientRequestIdClient type. - */ -public final class XmsClientRequestIdClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final XmsClientRequestIdClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of XmsClientRequestIdClient client. - * - * @param endpoint Service host. - */ - public XmsClientRequestIdClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of XmsClientRequestIdClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public XmsClientRequestIdClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of XmsClientRequestIdClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public XmsClientRequestIdClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(XmsClientRequestIdClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for XmsClientRequestIdClient to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "XmsClientRequestIdClient") - public interface XmsClientRequestIdClientService { - @Get("/azure/special-headers/x-ms-client-request-id/") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/azure/special-headers/x-ms-client-request-id/") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - } - - /** - * Get operation with azure `x-ms-client-request-id` header. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return operation with azure `x-ms-client-request-id` header along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.get(this.getEndpoint(), requestOptions, context)); - } - - /** - * Get operation with azure `x-ms-client-request-id` header. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return operation with azure `x-ms-client-request-id` header along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return service.getSync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/package-info.java deleted file mode 100644 index 68c801983b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for XmsClientRequestId. - * Azure client request id header configurations. - * - */ -package azure.specialheaders.xmsclientrequestid.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/package-info.java deleted file mode 100644 index c0532e6b9bb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for XmsClientRequestId. - * Azure client request id header configurations. - * - */ -package azure.specialheaders.xmsclientrequestid; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionAsyncClient.java deleted file mode 100644 index b2e2513b894..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionAsyncClient.java +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.versioning.previewversion; - -import azure.versioning.previewversion.implementation.JsonMergePatchHelper; -import azure.versioning.previewversion.implementation.PreviewVersionClientImpl; -import azure.versioning.previewversion.models.ListWidgetsResponse; -import azure.versioning.previewversion.models.UpdateWidgetColorRequest; -import azure.versioning.previewversion.models.Widget; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous PreviewVersionClient type. - */ -@ServiceClient(builder = PreviewVersionClientBuilder.class, isAsync = true) -public final class PreviewVersionAsyncClient { - @Generated - private final PreviewVersionClientImpl serviceClient; - - /** - * Initializes an instance of PreviewVersionAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PreviewVersionAsyncClient(PreviewVersionClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get widget by id (available in all versions). - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return widget by id (available in all versions) along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWidgetWithResponse(String id, RequestOptions requestOptions) { - return this.serviceClient.getWidgetWithResponseAsync(id, requestOptions); - } - - /** - * Update widget color (preview only). - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     color: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param colorUpdate The colorUpdate parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a simple model for testing along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateWidgetColorWithResponse(String id, BinaryData colorUpdate, - RequestOptions requestOptions) { - return this.serviceClient.updateWidgetColorWithResponseAsync(id, colorUpdate, requestOptions); - } - - /** - * List widgets with optional color filtering. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
nameStringNoThe name parameter
colorStringNoThe color parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     widgets (Required): [
-     *          (Required){
-     *             id: String (Required)
-     *             name: String (Required)
-     *             color: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listWidgetsWithResponse(RequestOptions requestOptions) { - return this.serviceClient.listWidgetsWithResponseAsync(requestOptions); - } - - /** - * Get widget by id (available in all versions). - * - * @param id The id parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return widget by id (available in all versions) on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getWidget(String id) { - // Generated convenience method for getWidgetWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWidgetWithResponse(id, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Widget.class)); - } - - /** - * Update widget color (preview only). - * - * @param id The id parameter. - * @param colorUpdate The colorUpdate parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a simple model for testing on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateWidgetColor(String id, UpdateWidgetColorRequest colorUpdate) { - // Generated convenience method for updateWidgetColorWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getUpdateWidgetColorRequestAccessor().prepareModelForJsonMergePatch(colorUpdate, true); - BinaryData colorUpdateInBinaryData = BinaryData.fromObject(colorUpdate); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - colorUpdateInBinaryData.getLength(); - JsonMergePatchHelper.getUpdateWidgetColorRequestAccessor().prepareModelForJsonMergePatch(colorUpdate, false); - return updateWidgetColorWithResponse(id, colorUpdateInBinaryData, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Widget.class)); - } - - /** - * List widgets with optional color filtering. - * - * @param name The name parameter. - * @param color The color parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono listWidgets(String name, String color) { - // Generated convenience method for listWidgetsWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (name != null) { - requestOptions.addQueryParam("name", name, false); - } - if (color != null) { - requestOptions.addQueryParam("color", color, false); - } - return listWidgetsWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ListWidgetsResponse.class)); - } - - /** - * List widgets with optional color filtering. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono listWidgets() { - // Generated convenience method for listWidgetsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return listWidgetsWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ListWidgetsResponse.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClient.java deleted file mode 100644 index 1a9ab6a96f0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClient.java +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.versioning.previewversion; - -import azure.versioning.previewversion.implementation.JsonMergePatchHelper; -import azure.versioning.previewversion.implementation.PreviewVersionClientImpl; -import azure.versioning.previewversion.models.ListWidgetsResponse; -import azure.versioning.previewversion.models.UpdateWidgetColorRequest; -import azure.versioning.previewversion.models.Widget; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous PreviewVersionClient type. - */ -@ServiceClient(builder = PreviewVersionClientBuilder.class) -public final class PreviewVersionClient { - @Generated - private final PreviewVersionClientImpl serviceClient; - - /** - * Initializes an instance of PreviewVersionClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PreviewVersionClient(PreviewVersionClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get widget by id (available in all versions). - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return widget by id (available in all versions) along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWidgetWithResponse(String id, RequestOptions requestOptions) { - return this.serviceClient.getWidgetWithResponse(id, requestOptions); - } - - /** - * Update widget color (preview only). - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     color: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param colorUpdate The colorUpdate parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a simple model for testing along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWidgetColorWithResponse(String id, BinaryData colorUpdate, - RequestOptions requestOptions) { - return this.serviceClient.updateWidgetColorWithResponse(id, colorUpdate, requestOptions); - } - - /** - * List widgets with optional color filtering. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
nameStringNoThe name parameter
colorStringNoThe color parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     widgets (Required): [
-     *          (Required){
-     *             id: String (Required)
-     *             name: String (Required)
-     *             color: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWidgetsWithResponse(RequestOptions requestOptions) { - return this.serviceClient.listWidgetsWithResponse(requestOptions); - } - - /** - * Get widget by id (available in all versions). - * - * @param id The id parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return widget by id (available in all versions). - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Widget getWidget(String id) { - // Generated convenience method for getWidgetWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWidgetWithResponse(id, requestOptions).getValue().toObject(Widget.class); - } - - /** - * Update widget color (preview only). - * - * @param id The id parameter. - * @param colorUpdate The colorUpdate parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a simple model for testing. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Widget updateWidgetColor(String id, UpdateWidgetColorRequest colorUpdate) { - // Generated convenience method for updateWidgetColorWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getUpdateWidgetColorRequestAccessor().prepareModelForJsonMergePatch(colorUpdate, true); - BinaryData colorUpdateInBinaryData = BinaryData.fromObject(colorUpdate); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - colorUpdateInBinaryData.getLength(); - JsonMergePatchHelper.getUpdateWidgetColorRequestAccessor().prepareModelForJsonMergePatch(colorUpdate, false); - return updateWidgetColorWithResponse(id, colorUpdateInBinaryData, requestOptions).getValue() - .toObject(Widget.class); - } - - /** - * List widgets with optional color filtering. - * - * @param name The name parameter. - * @param color The color parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ListWidgetsResponse listWidgets(String name, String color) { - // Generated convenience method for listWidgetsWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (name != null) { - requestOptions.addQueryParam("name", name, false); - } - if (color != null) { - requestOptions.addQueryParam("color", color, false); - } - return listWidgetsWithResponse(requestOptions).getValue().toObject(ListWidgetsResponse.class); - } - - /** - * List widgets with optional color filtering. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ListWidgetsResponse listWidgets() { - // Generated convenience method for listWidgetsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return listWidgetsWithResponse(requestOptions).getValue().toObject(ListWidgetsResponse.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClientBuilder.java deleted file mode 100644 index 9d0b8fe4a83..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClientBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.versioning.previewversion; - -import azure.versioning.previewversion.implementation.PreviewVersionClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the PreviewVersionClient type. - */ -@ServiceClientBuilder(serviceClients = { PreviewVersionClient.class, PreviewVersionAsyncClient.class }) -public final class PreviewVersionClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-versioning-previewversion.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the PreviewVersionClientBuilder. - */ - @Generated - public PreviewVersionClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PreviewVersionClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PreviewVersionClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PreviewVersionClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PreviewVersionClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PreviewVersionClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PreviewVersionClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PreviewVersionClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PreviewVersionClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private PreviewVersionServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the PreviewVersionClientBuilder. - */ - @Generated - public PreviewVersionClientBuilder serviceVersion(PreviewVersionServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the PreviewVersionClientBuilder. - */ - @Generated - public PreviewVersionClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of PreviewVersionClientImpl with the provided parameters. - * - * @return an instance of PreviewVersionClientImpl. - */ - @Generated - private PreviewVersionClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - PreviewVersionServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : PreviewVersionServiceVersion.getLatest(); - PreviewVersionClientImpl client = new PreviewVersionClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of PreviewVersionAsyncClient class. - * - * @return an instance of PreviewVersionAsyncClient. - */ - @Generated - public PreviewVersionAsyncClient buildAsyncClient() { - return new PreviewVersionAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of PreviewVersionClient class. - * - * @return an instance of PreviewVersionClient. - */ - @Generated - public PreviewVersionClient buildClient() { - return new PreviewVersionClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(PreviewVersionClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionServiceVersion.java deleted file mode 100644 index c10088e0ec8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionServiceVersion.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.versioning.previewversion; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of PreviewVersionClient. - */ -public enum PreviewVersionServiceVersion implements ServiceVersion { - /** - * Enum value 2024-01-01. - */ - V2024_01_01("2024-01-01"), - - /** - * Enum value 2024-06-01. - */ - V2024_06_01("2024-06-01"), - - /** - * Enum value 2024-12-01-preview. - */ - V2024_12_01_PREVIEW("2024-12-01-preview"); - - private final String version; - - PreviewVersionServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link PreviewVersionServiceVersion}. - */ - public static PreviewVersionServiceVersion getLatest() { - return V2024_12_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/JsonMergePatchHelper.java deleted file mode 100644 index d3cb05ef899..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/JsonMergePatchHelper.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.versioning.previewversion.implementation; - -import azure.versioning.previewversion.models.UpdateWidgetColorRequest; - -/** - * This is the Helper class to enable json merge patch serialization for a model. - */ -public class JsonMergePatchHelper { - private static UpdateWidgetColorRequestAccessor updateWidgetColorRequestAccessor; - - public interface UpdateWidgetColorRequestAccessor { - UpdateWidgetColorRequest prepareModelForJsonMergePatch(UpdateWidgetColorRequest updateWidgetColorRequest, - boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(UpdateWidgetColorRequest updateWidgetColorRequest); - } - - public static void setUpdateWidgetColorRequestAccessor(UpdateWidgetColorRequestAccessor accessor) { - updateWidgetColorRequestAccessor = accessor; - } - - public static UpdateWidgetColorRequestAccessor getUpdateWidgetColorRequestAccessor() { - return updateWidgetColorRequestAccessor; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/PreviewVersionClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/PreviewVersionClientImpl.java deleted file mode 100644 index 0091fe4ea1c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/PreviewVersionClientImpl.java +++ /dev/null @@ -1,429 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.versioning.previewversion.implementation; - -import azure.versioning.previewversion.PreviewVersionServiceVersion; -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Patch; -import com.azure.core.annotation.PathParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the PreviewVersionClient type. - */ -public final class PreviewVersionClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PreviewVersionClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final PreviewVersionServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public PreviewVersionServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of PreviewVersionClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public PreviewVersionClientImpl(String endpoint, PreviewVersionServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of PreviewVersionClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public PreviewVersionClientImpl(HttpPipeline httpPipeline, String endpoint, - PreviewVersionServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of PreviewVersionClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public PreviewVersionClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - PreviewVersionServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service - = RestProxy.create(PreviewVersionClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for PreviewVersionClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "PreviewVersionClient") - public interface PreviewVersionClientService { - @Get("/azure/versioning/previewVersion/widgets/{id}") - @ExpectedResponses({ 200, 404 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getWidget(@HostParam("endpoint") String endpoint, @PathParam("id") String id, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/versioning/previewVersion/widgets/{id}") - @ExpectedResponses({ 200, 404 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getWidgetSync(@HostParam("endpoint") String endpoint, @PathParam("id") String id, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Patch("/azure/versioning/previewVersion/widgets/{id}/color") - @ExpectedResponses({ 200, 404 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> updateWidgetColor(@HostParam("endpoint") String endpoint, @PathParam("id") String id, - @HeaderParam("Content-Type") String contentType, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData colorUpdate, - RequestOptions requestOptions, Context context); - - @Patch("/azure/versioning/previewVersion/widgets/{id}/color") - @ExpectedResponses({ 200, 404 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response updateWidgetColorSync(@HostParam("endpoint") String endpoint, @PathParam("id") String id, - @HeaderParam("Content-Type") String contentType, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData colorUpdate, - RequestOptions requestOptions, Context context); - - @Get("/azure/versioning/previewVersion/widgets") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listWidgets(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/azure/versioning/previewVersion/widgets") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listWidgetsSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * Get widget by id (available in all versions). - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return widget by id (available in all versions) along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWidgetWithResponseAsync(String id, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getWidget(this.getEndpoint(), id, - this.getServiceVersion().getVersion(), accept, requestOptions, context)); - } - - /** - * Get widget by id (available in all versions). - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return widget by id (available in all versions) along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWidgetWithResponse(String id, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getWidgetSync(this.getEndpoint(), id, this.getServiceVersion().getVersion(), accept, - requestOptions, Context.NONE); - } - - /** - * Update widget color (preview only). - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     color: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param colorUpdate The colorUpdate parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a simple model for testing along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateWidgetColorWithResponseAsync(String id, BinaryData colorUpdate, - RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.updateWidgetColor(this.getEndpoint(), id, contentType, - this.getServiceVersion().getVersion(), accept, colorUpdate, requestOptions, context)); - } - - /** - * Update widget color (preview only). - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     color: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param colorUpdate The colorUpdate parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a simple model for testing along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWidgetColorWithResponse(String id, BinaryData colorUpdate, - RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return service.updateWidgetColorSync(this.getEndpoint(), id, contentType, this.getServiceVersion().getVersion(), - accept, colorUpdate, requestOptions, Context.NONE); - } - - /** - * List widgets with optional color filtering. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
nameStringNoThe name parameter
colorStringNoThe color parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     widgets (Required): [
-     *          (Required){
-     *             id: String (Required)
-     *             name: String (Required)
-     *             color: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listWidgetsWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listWidgets(this.getEndpoint(), - this.getServiceVersion().getVersion(), accept, requestOptions, context)); - } - - /** - * List widgets with optional color filtering. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
nameStringNoThe name parameter
colorStringNoThe color parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     widgets (Required): [
-     *          (Required){
-     *             id: String (Required)
-     *             name: String (Required)
-     *             color: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWidgetsWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.listWidgetsSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, - requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/package-info.java deleted file mode 100644 index 3686447413c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for PreviewVersion. - * - */ -package azure.versioning.previewversion.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/ListWidgetsResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/ListWidgetsResponse.java deleted file mode 100644 index e135064bc76..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/ListWidgetsResponse.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.versioning.previewversion.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The ListWidgetsResponse model. - */ -@Immutable -public final class ListWidgetsResponse implements JsonSerializable { - /* - * The widgets property. - */ - @Generated - private final List widgets; - - /** - * Creates an instance of ListWidgetsResponse class. - * - * @param widgets the widgets value to set. - */ - @Generated - private ListWidgetsResponse(List widgets) { - this.widgets = widgets; - } - - /** - * Get the widgets property: The widgets property. - * - * @return the widgets value. - */ - @Generated - public List getWidgets() { - return this.widgets; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("widgets", this.widgets, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ListWidgetsResponse from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ListWidgetsResponse if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ListWidgetsResponse. - */ - @Generated - public static ListWidgetsResponse fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List widgets = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("widgets".equals(fieldName)) { - widgets = reader.readArray(reader1 -> Widget.fromJson(reader1)); - } else { - reader.skipChildren(); - } - } - return new ListWidgetsResponse(widgets); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/UpdateWidgetColorRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/UpdateWidgetColorRequest.java deleted file mode 100644 index f323e3ca9dc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/UpdateWidgetColorRequest.java +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.versioning.previewversion.models; - -import azure.versioning.previewversion.implementation.JsonMergePatchHelper; -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; - -/** - * Update widget color request. - */ -@Fluent -public final class UpdateWidgetColorRequest implements JsonSerializable { - /* - * New color for the widget. - */ - @Generated - private String color; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper - .setUpdateWidgetColorRequestAccessor(new JsonMergePatchHelper.UpdateWidgetColorRequestAccessor() { - @Override - public UpdateWidgetColorRequest prepareModelForJsonMergePatch(UpdateWidgetColorRequest model, - boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(UpdateWidgetColorRequest model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of UpdateWidgetColorRequest class. - */ - @Generated - public UpdateWidgetColorRequest() { - } - - /** - * Get the color property: New color for the widget. - * - * @return the color value. - */ - @Generated - public String getColor() { - return this.color; - } - - /** - * Set the color property: New color for the widget. - *

Required when create the resource.

- * - * @param color the color value to set. - * @return the UpdateWidgetColorRequest object itself. - */ - @Generated - public UpdateWidgetColorRequest setColor(String color) { - this.color = color; - this.updatedProperties.add("color"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("color", this.color); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("color")) { - if (this.color == null) { - jsonWriter.writeNullField("color"); - } else { - jsonWriter.writeStringField("color", this.color); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UpdateWidgetColorRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UpdateWidgetColorRequest if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the UpdateWidgetColorRequest. - */ - @Generated - public static UpdateWidgetColorRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - UpdateWidgetColorRequest deserializedUpdateWidgetColorRequest = new UpdateWidgetColorRequest(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("color".equals(fieldName)) { - deserializedUpdateWidgetColorRequest.color = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedUpdateWidgetColorRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/Widget.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/Widget.java deleted file mode 100644 index b1e6ab0a8ed..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/Widget.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.versioning.previewversion.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * A simple model for testing. - */ -@Immutable -public final class Widget implements JsonSerializable { - /* - * Widget identifier. - */ - @Generated - private final String id; - - /* - * Widget name. - */ - @Generated - private final String name; - - /* - * Widget color, only available in preview version. - */ - @Generated - private String color; - - /** - * Creates an instance of Widget class. - * - * @param id the id value to set. - * @param name the name value to set. - */ - @Generated - private Widget(String id, String name) { - this.id = id; - this.name = name; - } - - /** - * Get the id property: Widget identifier. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: Widget name. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the color property: Widget color, only available in preview version. - * - * @return the color value. - */ - @Generated - public String getColor() { - return this.color; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("color", this.color); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Widget from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Widget if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Widget. - */ - @Generated - public static Widget fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String name = null; - String color = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("color".equals(fieldName)) { - color = reader.getString(); - } else { - reader.skipChildren(); - } - } - Widget deserializedWidget = new Widget(id, name); - deserializedWidget.color = color; - - return deserializedWidget; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/package-info.java deleted file mode 100644 index fa0e4b7c103..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for PreviewVersion. - * - */ -package azure.versioning.previewversion.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/package-info.java deleted file mode 100644 index 39514290b33..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for PreviewVersion. - * - */ -package azure.versioning.previewversion; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstAsyncClient.java deleted file mode 100644 index 6e716aaaf6f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstAsyncClient.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.clientnamespace; - -import client.clientnamespace.first.models.FirstClientResult; -import client.clientnamespace.implementation.ClientNamespaceFirstClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ClientNamespaceFirstClient type. - */ -@ServiceClient(builder = ClientNamespaceFirstClientBuilder.class, isAsync = true) -public final class ClientNamespaceFirstAsyncClient { - @Generated - private final ClientNamespaceFirstClientImpl serviceClient; - - /** - * Initializes an instance of ClientNamespaceFirstAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ClientNamespaceFirstAsyncClient(ClientNamespaceFirstClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getFirst operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getFirstWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getFirstWithResponseAsync(requestOptions); - } - - /** - * The getFirst operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getFirst() { - // Generated convenience method for getFirstWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getFirstWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FirstClientResult.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClient.java deleted file mode 100644 index bc3370372d0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClient.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.clientnamespace; - -import client.clientnamespace.first.models.FirstClientResult; -import client.clientnamespace.implementation.ClientNamespaceFirstClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous ClientNamespaceFirstClient type. - */ -@ServiceClient(builder = ClientNamespaceFirstClientBuilder.class) -public final class ClientNamespaceFirstClient { - @Generated - private final ClientNamespaceFirstClientImpl serviceClient; - - /** - * Initializes an instance of ClientNamespaceFirstClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ClientNamespaceFirstClient(ClientNamespaceFirstClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getFirst operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getFirstWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getFirstWithResponse(requestOptions); - } - - /** - * The getFirst operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FirstClientResult getFirst() { - // Generated convenience method for getFirstWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getFirstWithResponse(requestOptions).getValue().toObject(FirstClientResult.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClientBuilder.java deleted file mode 100644 index d5fdca507e5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.clientnamespace; - -import client.clientnamespace.implementation.ClientNamespaceFirstClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ClientNamespaceFirstClient type. - */ -@ServiceClientBuilder(serviceClients = { ClientNamespaceFirstClient.class, ClientNamespaceFirstAsyncClient.class }) -public final class ClientNamespaceFirstClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("client-clientnamespace.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ClientNamespaceFirstClientBuilder. - */ - @Generated - public ClientNamespaceFirstClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceFirstClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceFirstClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceFirstClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceFirstClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceFirstClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceFirstClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceFirstClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceFirstClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ClientNamespaceFirstClientBuilder. - */ - @Generated - public ClientNamespaceFirstClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ClientNamespaceFirstClientImpl with the provided parameters. - * - * @return an instance of ClientNamespaceFirstClientImpl. - */ - @Generated - private ClientNamespaceFirstClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ClientNamespaceFirstClientImpl client = new ClientNamespaceFirstClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ClientNamespaceFirstAsyncClient class. - * - * @return an instance of ClientNamespaceFirstAsyncClient. - */ - @Generated - public ClientNamespaceFirstAsyncClient buildAsyncClient() { - return new ClientNamespaceFirstAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ClientNamespaceFirstClient class. - * - * @return an instance of ClientNamespaceFirstClient. - */ - @Generated - public ClientNamespaceFirstClient buildClient() { - return new ClientNamespaceFirstClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ClientNamespaceFirstClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/FirstClientResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/FirstClientResult.java deleted file mode 100644 index 13834159ebf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/FirstClientResult.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.clientnamespace.first.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The FirstClientResult model. - */ -@Immutable -public final class FirstClientResult implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of FirstClientResult class. - * - * @param name the name value to set. - */ - @Generated - private FirstClientResult(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FirstClientResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FirstClientResult if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FirstClientResult. - */ - @Generated - public static FirstClientResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new FirstClientResult(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/package-info.java deleted file mode 100644 index 390a58aee36..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for ClientNamespace. - * Illustrates the clientNamespace cases. - * - */ -package client.clientnamespace.first.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceFirstClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceFirstClientImpl.java deleted file mode 100644 index 176ea456391..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceFirstClientImpl.java +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.clientnamespace.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the ClientNamespaceFirstClient type. - */ -public final class ClientNamespaceFirstClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ClientNamespaceFirstClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of ClientNamespaceFirstClient client. - * - * @param endpoint Service host. - */ - public ClientNamespaceFirstClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ClientNamespaceFirstClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ClientNamespaceFirstClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ClientNamespaceFirstClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ClientNamespaceFirstClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(ClientNamespaceFirstClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ClientNamespaceFirstClient to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ClientNamespaceFirstClient") - public interface ClientNamespaceFirstClientService { - @Get("/client/client-namespace/first") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getFirst(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/client/client-namespace/first") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getFirstSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The getFirst operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getFirstWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getFirst(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getFirst operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getFirstWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getFirstSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceSecondClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceSecondClientImpl.java deleted file mode 100644 index 043c1567d37..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceSecondClientImpl.java +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.clientnamespace.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the ClientNamespaceSecondClient type. - */ -public final class ClientNamespaceSecondClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ClientNamespaceSecondClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of ClientNamespaceSecondClient client. - * - * @param endpoint Service host. - */ - public ClientNamespaceSecondClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ClientNamespaceSecondClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ClientNamespaceSecondClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ClientNamespaceSecondClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ClientNamespaceSecondClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(ClientNamespaceSecondClientService.class, this.httpPipeline, - this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ClientNamespaceSecondClient to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ClientNamespaceSecondClient") - public interface ClientNamespaceSecondClientService { - @Get("/client/client-namespace/second") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getSecond(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/client/client-namespace/second") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSecondSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The getSecond operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     type: String(second) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getSecondWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getSecond(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getSecond operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     type: String(second) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getSecondWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSecondSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/package-info.java deleted file mode 100644 index cd067e55cee..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ClientNamespace. - * Illustrates the clientNamespace cases. - * - */ -package client.clientnamespace.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/package-info.java deleted file mode 100644 index 32ea24a8ff2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ClientNamespace. - * Illustrates the clientNamespace cases. - * - */ -package client.clientnamespace; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondAsyncClient.java deleted file mode 100644 index 8416dc8451e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondAsyncClient.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.clientnamespace.second; - -import client.clientnamespace.implementation.ClientNamespaceSecondClientImpl; -import client.clientnamespace.second.models.SecondClientResult; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ClientNamespaceSecondClient type. - */ -@ServiceClient(builder = ClientNamespaceSecondClientBuilder.class, isAsync = true) -public final class ClientNamespaceSecondAsyncClient { - @Generated - private final ClientNamespaceSecondClientImpl serviceClient; - - /** - * Initializes an instance of ClientNamespaceSecondAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ClientNamespaceSecondAsyncClient(ClientNamespaceSecondClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getSecond operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     type: String(second) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getSecondWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getSecondWithResponseAsync(requestOptions); - } - - /** - * The getSecond operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getSecond() { - // Generated convenience method for getSecondWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getSecondWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SecondClientResult.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClient.java deleted file mode 100644 index afa387956fc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClient.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.clientnamespace.second; - -import client.clientnamespace.implementation.ClientNamespaceSecondClientImpl; -import client.clientnamespace.second.models.SecondClientResult; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous ClientNamespaceSecondClient type. - */ -@ServiceClient(builder = ClientNamespaceSecondClientBuilder.class) -public final class ClientNamespaceSecondClient { - @Generated - private final ClientNamespaceSecondClientImpl serviceClient; - - /** - * Initializes an instance of ClientNamespaceSecondClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ClientNamespaceSecondClient(ClientNamespaceSecondClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getSecond operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     type: String(second) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getSecondWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getSecondWithResponse(requestOptions); - } - - /** - * The getSecond operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SecondClientResult getSecond() { - // Generated convenience method for getSecondWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getSecondWithResponse(requestOptions).getValue().toObject(SecondClientResult.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClientBuilder.java deleted file mode 100644 index f0898adc960..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.clientnamespace.second; - -import client.clientnamespace.implementation.ClientNamespaceSecondClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ClientNamespaceSecondClient type. - */ -@ServiceClientBuilder(serviceClients = { ClientNamespaceSecondClient.class, ClientNamespaceSecondAsyncClient.class }) -public final class ClientNamespaceSecondClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("client-clientnamespace.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ClientNamespaceSecondClientBuilder. - */ - @Generated - public ClientNamespaceSecondClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceSecondClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceSecondClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceSecondClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceSecondClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceSecondClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceSecondClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceSecondClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientNamespaceSecondClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ClientNamespaceSecondClientBuilder. - */ - @Generated - public ClientNamespaceSecondClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ClientNamespaceSecondClientImpl with the provided parameters. - * - * @return an instance of ClientNamespaceSecondClientImpl. - */ - @Generated - private ClientNamespaceSecondClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ClientNamespaceSecondClientImpl client = new ClientNamespaceSecondClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ClientNamespaceSecondAsyncClient class. - * - * @return an instance of ClientNamespaceSecondAsyncClient. - */ - @Generated - public ClientNamespaceSecondAsyncClient buildAsyncClient() { - return new ClientNamespaceSecondAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ClientNamespaceSecondClient class. - * - * @return an instance of ClientNamespaceSecondClient. - */ - @Generated - public ClientNamespaceSecondClient buildClient() { - return new ClientNamespaceSecondClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ClientNamespaceSecondClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/SecondClientResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/SecondClientResult.java deleted file mode 100644 index 5e0324070d5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/SecondClientResult.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.clientnamespace.second.models; - -import client.clientnamespace.second.sub.models.SecondClientEnumType; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The SecondClientResult model. - */ -@Immutable -public final class SecondClientResult implements JsonSerializable { - /* - * The type property. - */ - @Generated - private final SecondClientEnumType type; - - /** - * Creates an instance of SecondClientResult class. - * - * @param type the type value to set. - */ - @Generated - private SecondClientResult(SecondClientEnumType type) { - this.type = type; - } - - /** - * Get the type property: The type property. - * - * @return the type value. - */ - @Generated - public SecondClientEnumType getType() { - return this.type; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SecondClientResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SecondClientResult if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SecondClientResult. - */ - @Generated - public static SecondClientResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SecondClientEnumType type = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("type".equals(fieldName)) { - type = SecondClientEnumType.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new SecondClientResult(type); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/package-info.java deleted file mode 100644 index 4c5d7b940ab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for ClientNamespace. - * Illustrates the clientNamespace cases. - * - */ -package client.clientnamespace.second.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/package-info.java deleted file mode 100644 index cd4f158ff59..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ClientNamespaceSecondClient. - * Illustrates the clientNamespace cases. - * - */ -package client.clientnamespace.second; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/SecondClientEnumType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/SecondClientEnumType.java deleted file mode 100644 index ba7b1afaf57..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/SecondClientEnumType.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.clientnamespace.second.sub.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for SecondClientEnumType. - */ -public final class SecondClientEnumType extends ExpandableStringEnum { - /** - * Static value second for SecondClientEnumType. - */ - @Generated - public static final SecondClientEnumType SECOND = fromString("second"); - - /** - * Creates a new instance of SecondClientEnumType value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public SecondClientEnumType() { - } - - /** - * Creates or finds a SecondClientEnumType from its string representation. - * - * @param name a name to look for. - * @return the corresponding SecondClientEnumType. - */ - @Generated - public static SecondClientEnumType fromString(String name) { - return fromString(name, SecondClientEnumType.class); - } - - /** - * Gets known SecondClientEnumType values. - * - * @return known SecondClientEnumType values. - */ - @Generated - public static Collection values() { - return values(SecondClientEnumType.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/package-info.java deleted file mode 100644 index 9082e6ae77b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for ClientNamespace. - * Illustrates the clientNamespace cases. - * - */ -package client.clientnamespace.second.sub.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelAsyncClient.java deleted file mode 100644 index 60a41d100a2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelAsyncClient.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming; - -import client.naming.implementation.ModelClientsImpl; -import client.naming.model.models.ClientModel; -import client.naming.model.models.JavaModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous NamingClient type. - */ -@ServiceClient(builder = NamingClientBuilder.class, isAsync = true) -public final class ModelAsyncClient { - @Generated - private final ModelClientsImpl serviceClient; - - /** - * Initializes an instance of ModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelAsyncClient(ModelClientsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The client operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> clientWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.clientWithResponseAsync(body, requestOptions); - } - - /** - * The language operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> languageWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.languageWithResponseAsync(body, requestOptions); - } - - /** - * The client operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono client(ClientModel body) { - // Generated convenience method for clientWithResponse - RequestOptions requestOptions = new RequestOptions(); - return clientWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The language operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono language(JavaModel body) { - // Generated convenience method for languageWithResponse - RequestOptions requestOptions = new RequestOptions(); - return languageWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelClient.java deleted file mode 100644 index 3f4b9cf9b76..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelClient.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming; - -import client.naming.implementation.ModelClientsImpl; -import client.naming.model.models.ClientModel; -import client.naming.model.models.JavaModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous NamingClient type. - */ -@ServiceClient(builder = NamingClientBuilder.class) -public final class ModelClient { - @Generated - private final ModelClientsImpl serviceClient; - - /** - * Initializes an instance of ModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelClient(ModelClientsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The client operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response clientWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.clientWithResponse(body, requestOptions); - } - - /** - * The language operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response languageWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.languageWithResponse(body, requestOptions); - } - - /** - * The client operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void client(ClientModel body) { - // Generated convenience method for clientWithResponse - RequestOptions requestOptions = new RequestOptions(); - clientWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The language operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void language(JavaModel body) { - // Generated convenience method for languageWithResponse - RequestOptions requestOptions = new RequestOptions(); - languageWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingAsyncClient.java deleted file mode 100644 index 29bdc3d4247..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingAsyncClient.java +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming; - -import client.naming.implementation.NamingClientImpl; -import client.naming.property.models.ClientNameAndJsonEncodedNameModel; -import client.naming.property.models.ClientNameModel; -import client.naming.property.models.LanguageClientNameModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous NamingClient type. - */ -@ServiceClient(builder = NamingClientBuilder.class, isAsync = true) -public final class NamingAsyncClient { - @Generated - private final NamingClientImpl serviceClient; - - /** - * Initializes an instance of NamingAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NamingAsyncClient(NamingClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The clientName operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> clientNameWithResponse(RequestOptions requestOptions) { - return this.serviceClient.clientNameWithResponseAsync(requestOptions); - } - - /** - * The parameter operation. - * - * @param clientName The clientName parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> parameterWithResponse(String clientName, RequestOptions requestOptions) { - return this.serviceClient.parameterWithResponseAsync(clientName, requestOptions); - } - - /** - * The client operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> clientWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.clientWithResponseAsync(body, requestOptions); - } - - /** - * The language operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> languageWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.languageWithResponseAsync(body, requestOptions); - } - - /** - * The compatibleWithEncodedName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     wireName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> compatibleWithEncodedNameWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.compatibleWithEncodedNameWithResponseAsync(body, requestOptions); - } - - /** - * The request operation. - * - * @param clientName The clientName parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requestWithResponse(String clientName, RequestOptions requestOptions) { - return this.serviceClient.requestWithResponseAsync(clientName, requestOptions); - } - - /** - * The response operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> responseWithResponse(RequestOptions requestOptions) { - return this.serviceClient.responseWithResponseAsync(requestOptions); - } - - /** - * The clientName operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono clientName() { - // Generated convenience method for clientNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - return clientNameWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The parameter operation. - * - * @param clientName The clientName parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono parameter(String clientName) { - // Generated convenience method for parameterWithResponse - RequestOptions requestOptions = new RequestOptions(); - return parameterWithResponse(clientName, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The client operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono client(ClientNameModel body) { - // Generated convenience method for clientWithResponse - RequestOptions requestOptions = new RequestOptions(); - return clientWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The language operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono language(LanguageClientNameModel body) { - // Generated convenience method for languageWithResponse - RequestOptions requestOptions = new RequestOptions(); - return languageWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The compatibleWithEncodedName operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono compatibleWithEncodedName(ClientNameAndJsonEncodedNameModel body) { - // Generated convenience method for compatibleWithEncodedNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - return compatibleWithEncodedNameWithResponse(BinaryData.fromObject(body), requestOptions) - .flatMap(FluxUtil::toMono); - } - - /** - * The request operation. - * - * @param clientName The clientName parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono request(String clientName) { - // Generated convenience method for requestWithResponse - RequestOptions requestOptions = new RequestOptions(); - return requestWithResponse(clientName, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The response operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono response() { - // Generated convenience method for responseWithResponse - RequestOptions requestOptions = new RequestOptions(); - return responseWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClient.java deleted file mode 100644 index cbf0519ab3e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClient.java +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming; - -import client.naming.implementation.NamingClientImpl; -import client.naming.property.models.ClientNameAndJsonEncodedNameModel; -import client.naming.property.models.ClientNameModel; -import client.naming.property.models.LanguageClientNameModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous NamingClient type. - */ -@ServiceClient(builder = NamingClientBuilder.class) -public final class NamingClient { - @Generated - private final NamingClientImpl serviceClient; - - /** - * Initializes an instance of NamingClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NamingClient(NamingClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The clientName operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response clientNameWithResponse(RequestOptions requestOptions) { - return this.serviceClient.clientNameWithResponse(requestOptions); - } - - /** - * The parameter operation. - * - * @param clientName The clientName parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response parameterWithResponse(String clientName, RequestOptions requestOptions) { - return this.serviceClient.parameterWithResponse(clientName, requestOptions); - } - - /** - * The client operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response clientWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.clientWithResponse(body, requestOptions); - } - - /** - * The language operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response languageWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.languageWithResponse(body, requestOptions); - } - - /** - * The compatibleWithEncodedName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     wireName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response compatibleWithEncodedNameWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.compatibleWithEncodedNameWithResponse(body, requestOptions); - } - - /** - * The request operation. - * - * @param clientName The clientName parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requestWithResponse(String clientName, RequestOptions requestOptions) { - return this.serviceClient.requestWithResponse(clientName, requestOptions); - } - - /** - * The response operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response responseWithResponse(RequestOptions requestOptions) { - return this.serviceClient.responseWithResponse(requestOptions); - } - - /** - * The clientName operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void clientName() { - // Generated convenience method for clientNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - clientNameWithResponse(requestOptions).getValue(); - } - - /** - * The parameter operation. - * - * @param clientName The clientName parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void parameter(String clientName) { - // Generated convenience method for parameterWithResponse - RequestOptions requestOptions = new RequestOptions(); - parameterWithResponse(clientName, requestOptions).getValue(); - } - - /** - * The client operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void client(ClientNameModel body) { - // Generated convenience method for clientWithResponse - RequestOptions requestOptions = new RequestOptions(); - clientWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The language operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void language(LanguageClientNameModel body) { - // Generated convenience method for languageWithResponse - RequestOptions requestOptions = new RequestOptions(); - languageWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The compatibleWithEncodedName operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void compatibleWithEncodedName(ClientNameAndJsonEncodedNameModel body) { - // Generated convenience method for compatibleWithEncodedNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - compatibleWithEncodedNameWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The request operation. - * - * @param clientName The clientName parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void request(String clientName) { - // Generated convenience method for requestWithResponse - RequestOptions requestOptions = new RequestOptions(); - requestWithResponse(clientName, requestOptions).getValue(); - } - - /** - * The response operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void response() { - // Generated convenience method for responseWithResponse - RequestOptions requestOptions = new RequestOptions(); - responseWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClientBuilder.java deleted file mode 100644 index e03f6a58db2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClientBuilder.java +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming; - -import client.naming.implementation.NamingClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the NamingClient type. - */ -@ServiceClientBuilder( - serviceClients = { - NamingClient.class, - ModelClient.class, - UnionEnumClient.class, - NamingAsyncClient.class, - ModelAsyncClient.class, - UnionEnumAsyncClient.class }) -public final class NamingClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("client-naming.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the NamingClientBuilder. - */ - @Generated - public NamingClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the NamingClientBuilder. - */ - @Generated - public NamingClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of NamingClientImpl with the provided parameters. - * - * @return an instance of NamingClientImpl. - */ - @Generated - private NamingClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - NamingClientImpl client - = new NamingClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of NamingAsyncClient class. - * - * @return an instance of NamingAsyncClient. - */ - @Generated - public NamingAsyncClient buildAsyncClient() { - return new NamingAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ModelAsyncClient class. - * - * @return an instance of ModelAsyncClient. - */ - @Generated - public ModelAsyncClient buildModelAsyncClient() { - return new ModelAsyncClient(buildInnerClient().getModelClients()); - } - - /** - * Builds an instance of UnionEnumAsyncClient class. - * - * @return an instance of UnionEnumAsyncClient. - */ - @Generated - public UnionEnumAsyncClient buildUnionEnumAsyncClient() { - return new UnionEnumAsyncClient(buildInnerClient().getUnionEnums()); - } - - /** - * Builds an instance of NamingClient class. - * - * @return an instance of NamingClient. - */ - @Generated - public NamingClient buildClient() { - return new NamingClient(buildInnerClient()); - } - - /** - * Builds an instance of ModelClient class. - * - * @return an instance of ModelClient. - */ - @Generated - public ModelClient buildModelClient() { - return new ModelClient(buildInnerClient().getModelClients()); - } - - /** - * Builds an instance of UnionEnumClient class. - * - * @return an instance of UnionEnumClient. - */ - @Generated - public UnionEnumClient buildUnionEnumClient() { - return new UnionEnumClient(buildInnerClient().getUnionEnums()); - } - - private static final ClientLogger LOGGER = new ClientLogger(NamingClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumAsyncClient.java deleted file mode 100644 index 2358fd7b6cc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumAsyncClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming; - -import client.naming.implementation.UnionEnumsImpl; -import client.naming.unionenum.models.ClientExtensibleEnum; -import client.naming.unionenum.models.ExtensibleEnum; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous NamingClient type. - */ -@ServiceClient(builder = NamingClientBuilder.class, isAsync = true) -public final class UnionEnumAsyncClient { - @Generated - private final UnionEnumsImpl serviceClient; - - /** - * Initializes an instance of UnionEnumAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionEnumAsyncClient(UnionEnumsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The unionEnumName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(value1)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unionEnumNameWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.unionEnumNameWithResponseAsync(body, requestOptions); - } - - /** - * The unionEnumMemberName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(value1/value2)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unionEnumMemberNameWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.unionEnumMemberNameWithResponseAsync(body, requestOptions); - } - - /** - * The unionEnumName operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono unionEnumName(ClientExtensibleEnum body) { - // Generated convenience method for unionEnumNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - return unionEnumNameWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) - .flatMap(FluxUtil::toMono); - } - - /** - * The unionEnumMemberName operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono unionEnumMemberName(ExtensibleEnum body) { - // Generated convenience method for unionEnumMemberNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - return unionEnumMemberNameWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), - requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumClient.java deleted file mode 100644 index 03e85a8cf15..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumClient.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming; - -import client.naming.implementation.UnionEnumsImpl; -import client.naming.unionenum.models.ClientExtensibleEnum; -import client.naming.unionenum.models.ExtensibleEnum; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous NamingClient type. - */ -@ServiceClient(builder = NamingClientBuilder.class) -public final class UnionEnumClient { - @Generated - private final UnionEnumsImpl serviceClient; - - /** - * Initializes an instance of UnionEnumClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionEnumClient(UnionEnumsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The unionEnumName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(value1)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unionEnumNameWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.unionEnumNameWithResponse(body, requestOptions); - } - - /** - * The unionEnumMemberName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(value1/value2)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unionEnumMemberNameWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.unionEnumMemberNameWithResponse(body, requestOptions); - } - - /** - * The unionEnumName operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void unionEnumName(ClientExtensibleEnum body) { - // Generated convenience method for unionEnumNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - unionEnumNameWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) - .getValue(); - } - - /** - * The unionEnumMemberName operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void unionEnumMemberName(ExtensibleEnum body) { - // Generated convenience method for unionEnumMemberNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - unionEnumMemberNameWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) - .getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/EnumConflictClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/EnumConflictClientBuilder.java deleted file mode 100644 index c38546f3d39..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/EnumConflictClientBuilder.java +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict; - -import client.naming.enumconflict.implementation.EnumConflictClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the EnumConflictClient type. - */ -@ServiceClientBuilder( - serviceClients = { - FirstOperationsClient.class, - SecondOperationsClient.class, - FirstOperationsAsyncClient.class, - SecondOperationsAsyncClient.class }) -public final class EnumConflictClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("client-naming-enumconflict.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the EnumConflictClientBuilder. - */ - @Generated - public EnumConflictClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumConflictClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumConflictClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumConflictClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumConflictClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumConflictClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumConflictClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumConflictClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumConflictClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the EnumConflictClientBuilder. - */ - @Generated - public EnumConflictClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of EnumConflictClientImpl with the provided parameters. - * - * @return an instance of EnumConflictClientImpl. - */ - @Generated - private EnumConflictClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - EnumConflictClientImpl client - = new EnumConflictClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of FirstOperationsAsyncClient class. - * - * @return an instance of FirstOperationsAsyncClient. - */ - @Generated - public FirstOperationsAsyncClient buildFirstOperationsAsyncClient() { - return new FirstOperationsAsyncClient(buildInnerClient().getFirstOperations()); - } - - /** - * Builds an instance of SecondOperationsAsyncClient class. - * - * @return an instance of SecondOperationsAsyncClient. - */ - @Generated - public SecondOperationsAsyncClient buildSecondOperationsAsyncClient() { - return new SecondOperationsAsyncClient(buildInnerClient().getSecondOperations()); - } - - /** - * Builds an instance of FirstOperationsClient class. - * - * @return an instance of FirstOperationsClient. - */ - @Generated - public FirstOperationsClient buildFirstOperationsClient() { - return new FirstOperationsClient(buildInnerClient().getFirstOperations()); - } - - /** - * Builds an instance of SecondOperationsClient class. - * - * @return an instance of SecondOperationsClient. - */ - @Generated - public SecondOperationsClient buildSecondOperationsClient() { - return new SecondOperationsClient(buildInnerClient().getSecondOperations()); - } - - private static final ClientLogger LOGGER = new ClientLogger(EnumConflictClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsAsyncClient.java deleted file mode 100644 index ccb9355039f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsAsyncClient.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict; - -import client.naming.enumconflict.firstnamespace.models.FirstModel; -import client.naming.enumconflict.implementation.FirstOperationsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous EnumConflictClient type. - */ -@ServiceClient(builder = EnumConflictClientBuilder.class, isAsync = true) -public final class FirstOperationsAsyncClient { - @Generated - private final FirstOperationsImpl serviceClient; - - /** - * Initializes an instance of FirstOperationsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FirstOperationsAsyncClient(FirstOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Operation using first namespace Status enum. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(active/inactive) (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(active/inactive) (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> firstWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.firstWithResponseAsync(body, requestOptions); - } - - /** - * Operation using first namespace Status enum. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono first(FirstModel body) { - // Generated convenience method for firstWithResponse - RequestOptions requestOptions = new RequestOptions(); - return firstWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FirstModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsClient.java deleted file mode 100644 index a698dc1ed77..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsClient.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict; - -import client.naming.enumconflict.firstnamespace.models.FirstModel; -import client.naming.enumconflict.implementation.FirstOperationsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous EnumConflictClient type. - */ -@ServiceClient(builder = EnumConflictClientBuilder.class) -public final class FirstOperationsClient { - @Generated - private final FirstOperationsImpl serviceClient; - - /** - * Initializes an instance of FirstOperationsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FirstOperationsClient(FirstOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Operation using first namespace Status enum. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(active/inactive) (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(active/inactive) (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response firstWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.firstWithResponse(body, requestOptions); - } - - /** - * Operation using first namespace Status enum. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FirstModel first(FirstModel body) { - // Generated convenience method for firstWithResponse - RequestOptions requestOptions = new RequestOptions(); - return firstWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(FirstModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsAsyncClient.java deleted file mode 100644 index 6fc39a90bf3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsAsyncClient.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict; - -import client.naming.enumconflict.implementation.SecondOperationsImpl; -import client.naming.enumconflict.secondnamespace.models.SecondModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous EnumConflictClient type. - */ -@ServiceClient(builder = EnumConflictClientBuilder.class, isAsync = true) -public final class SecondOperationsAsyncClient { - @Generated - private final SecondOperationsImpl serviceClient; - - /** - * Initializes an instance of SecondOperationsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SecondOperationsAsyncClient(SecondOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Operation using second namespace Status enum. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(running/stopped) (Required)
-     *     description: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(running/stopped) (Required)
-     *     description: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> secondWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.secondWithResponseAsync(body, requestOptions); - } - - /** - * Operation using second namespace Status enum. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono second(SecondModel body) { - // Generated convenience method for secondWithResponse - RequestOptions requestOptions = new RequestOptions(); - return secondWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SecondModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsClient.java deleted file mode 100644 index 0b716104ab0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsClient.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict; - -import client.naming.enumconflict.implementation.SecondOperationsImpl; -import client.naming.enumconflict.secondnamespace.models.SecondModel; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; - -/** - * Initializes a new instance of the synchronous EnumConflictClient type. - */ -@ServiceClient(builder = EnumConflictClientBuilder.class) -public final class SecondOperationsClient { - @Generated - private final SecondOperationsImpl serviceClient; - - /** - * Initializes an instance of SecondOperationsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SecondOperationsClient(SecondOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Operation using second namespace Status enum. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(running/stopped) (Required)
-     *     description: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(running/stopped) (Required)
-     *     description: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response secondWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.secondWithResponse(body, requestOptions); - } - - /** - * Operation using second namespace Status enum. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SecondModel second(SecondModel body) { - // Generated convenience method for secondWithResponse - RequestOptions requestOptions = new RequestOptions(); - return secondWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(SecondModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/FirstModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/FirstModel.java deleted file mode 100644 index 82c2179189c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/FirstModel.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict.firstnamespace.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The FirstModel model. - */ -@Immutable -public final class FirstModel implements JsonSerializable { - /* - * Status from first namespace - */ - @Generated - private final Status status; - - /* - * Name of the item - */ - @Generated - private final String name; - - /** - * Creates an instance of FirstModel class. - * - * @param status the status value to set. - * @param name the name value to set. - */ - @Generated - public FirstModel(Status status, String name) { - this.status = status; - this.name = name; - } - - /** - * Get the status property: Status from first namespace. - * - * @return the status value. - */ - @Generated - public Status getStatus() { - return this.status; - } - - /** - * Get the name property: Name of the item. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FirstModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FirstModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FirstModel. - */ - @Generated - public static FirstModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Status status = null; - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("status".equals(fieldName)) { - status = Status.fromString(reader.getString()); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new FirstModel(status, name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/Status.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/Status.java deleted file mode 100644 index ea02703277c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/Status.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict.firstnamespace.models; - -/** - * Status enum in first namespace. - */ -public enum Status { - /** - * Active status. - */ - ACTIVE("active"), - - /** - * Inactive status. - */ - INACTIVE("inactive"); - - /** - * The actual serialized value for a Status instance. - */ - private final String value; - - Status(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a Status instance. - * - * @param value the serialized value to parse. - * @return the parsed Status object, or null if unable to parse. - */ - public static Status fromString(String value) { - if (value == null) { - return null; - } - Status[] items = Status.values(); - for (Status item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/package-info.java deleted file mode 100644 index 0e29e362189..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for EnumConflict. - * Test for enum with same name in different namespace. - * - */ -package client.naming.enumconflict.firstnamespace.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/EnumConflictClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/EnumConflictClientImpl.java deleted file mode 100644 index 6158a0d0222..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/EnumConflictClientImpl.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 EnumConflictClient type. - */ -public final class EnumConflictClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 FirstOperationsImpl object to access its operations. - */ - private final FirstOperationsImpl firstOperations; - - /** - * Gets the FirstOperationsImpl object to access its operations. - * - * @return the FirstOperationsImpl object. - */ - public FirstOperationsImpl getFirstOperations() { - return this.firstOperations; - } - - /** - * The SecondOperationsImpl object to access its operations. - */ - private final SecondOperationsImpl secondOperations; - - /** - * Gets the SecondOperationsImpl object to access its operations. - * - * @return the SecondOperationsImpl object. - */ - public SecondOperationsImpl getSecondOperations() { - return this.secondOperations; - } - - /** - * Initializes an instance of EnumConflictClient client. - * - * @param endpoint Service host. - */ - public EnumConflictClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of EnumConflictClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public EnumConflictClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of EnumConflictClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public EnumConflictClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.firstOperations = new FirstOperationsImpl(this); - this.secondOperations = new SecondOperationsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/FirstOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/FirstOperationsImpl.java deleted file mode 100644 index cfe052925ce..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/FirstOperationsImpl.java +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in FirstOperations. - */ -public final class FirstOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FirstOperationsService service; - - /** - * The service client containing this operation class. - */ - private final EnumConflictClientImpl client; - - /** - * Initializes an instance of FirstOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FirstOperationsImpl(EnumConflictClientImpl client) { - this.service - = RestProxy.create(FirstOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for EnumConflictClientFirstOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "EnumConflictClientFirstOperations") - public interface FirstOperationsService { - @Post("/client/naming/enum-conflict/first") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> first(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/client/naming/enum-conflict/first") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response firstSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Operation using first namespace Status enum. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(active/inactive) (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(active/inactive) (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> firstWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.first(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * Operation using first namespace Status enum. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(active/inactive) (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(active/inactive) (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response firstWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.firstSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/SecondOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/SecondOperationsImpl.java deleted file mode 100644 index a476c4346db..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/SecondOperationsImpl.java +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SecondOperations. - */ -public final class SecondOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SecondOperationsService service; - - /** - * The service client containing this operation class. - */ - private final EnumConflictClientImpl client; - - /** - * Initializes an instance of SecondOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SecondOperationsImpl(EnumConflictClientImpl client) { - this.service - = RestProxy.create(SecondOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for EnumConflictClientSecondOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "EnumConflictClientSecondOperations") - public interface SecondOperationsService { - @Post("/client/naming/enum-conflict/second") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> second(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/client/naming/enum-conflict/second") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response secondSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Operation using second namespace Status enum. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(running/stopped) (Required)
-     *     description: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(running/stopped) (Required)
-     *     description: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> secondWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.second(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * Operation using second namespace Status enum. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(running/stopped) (Required)
-     *     description: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     status: String(running/stopped) (Required)
-     *     description: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response secondWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.secondSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/package-info.java deleted file mode 100644 index 2d20601fc1e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for EnumConflict. - * Test for enum with same name in different namespace. - * - */ -package client.naming.enumconflict.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/package-info.java deleted file mode 100644 index db349530152..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for EnumConflict. - * Test for enum with same name in different namespace. - * - */ -package client.naming.enumconflict; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondModel.java deleted file mode 100644 index b4c3f670f85..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondModel.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict.secondnamespace.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The SecondModel model. - */ -@Immutable -public final class SecondModel implements JsonSerializable { - /* - * Status from second namespace - */ - @Generated - private final SecondStatus status; - - /* - * Description of the item - */ - @Generated - private final String description; - - /** - * Creates an instance of SecondModel class. - * - * @param status the status value to set. - * @param description the description value to set. - */ - @Generated - public SecondModel(SecondStatus status, String description) { - this.status = status; - this.description = description; - } - - /** - * Get the status property: Status from second namespace. - * - * @return the status value. - */ - @Generated - public SecondStatus getStatus() { - return this.status; - } - - /** - * Get the description property: Description of the item. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SecondModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SecondModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SecondModel. - */ - @Generated - public static SecondModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SecondStatus status = null; - String description = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("status".equals(fieldName)) { - status = SecondStatus.fromString(reader.getString()); - } else if ("description".equals(fieldName)) { - description = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new SecondModel(status, description); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondStatus.java deleted file mode 100644 index 5482b3ae7f1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondStatus.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict.secondnamespace.models; - -/** - * Status enum in second namespace. - */ -public enum SecondStatus { - /** - * Running status. - */ - RUNNING("running"), - - /** - * Stopped status. - */ - STOPPED("stopped"); - - /** - * The actual serialized value for a SecondStatus instance. - */ - private final String value; - - SecondStatus(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a SecondStatus instance. - * - * @param value the serialized value to parse. - * @return the parsed SecondStatus object, or null if unable to parse. - */ - public static SecondStatus fromString(String value) { - if (value == null) { - return null; - } - SecondStatus[] items = SecondStatus.values(); - for (SecondStatus item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/package-info.java deleted file mode 100644 index 5d69741fbf6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for EnumConflict. - * Test for enum with same name in different namespace. - * - */ -package client.naming.enumconflict.secondnamespace.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/ModelClientsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/ModelClientsImpl.java deleted file mode 100644 index 1cb2f4e947f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/ModelClientsImpl.java +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ModelClients. - */ -public final class ModelClientsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ModelClientsService service; - - /** - * The service client containing this operation class. - */ - private final NamingClientImpl client; - - /** - * Initializes an instance of ModelClientsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ModelClientsImpl(NamingClientImpl client) { - this.service - = RestProxy.create(ModelClientsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NamingClientModelClients to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NamingClientModelClients") - public interface ModelClientsService { - @Post("/client/naming/model/client") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> client(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/client/naming/model/client") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response clientSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/client/naming/model/language") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> language(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/client/naming/model/language") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response languageSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The client operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> clientWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.client(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The client operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response clientWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.clientSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The language operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> languageWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.language(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The language operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response languageWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.languageSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/NamingClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/NamingClientImpl.java deleted file mode 100644 index e1555932b3d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/NamingClientImpl.java +++ /dev/null @@ -1,577 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the NamingClient type. - */ -public final class NamingClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NamingClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 ModelClientsImpl object to access its operations. - */ - private final ModelClientsImpl modelClients; - - /** - * Gets the ModelClientsImpl object to access its operations. - * - * @return the ModelClientsImpl object. - */ - public ModelClientsImpl getModelClients() { - return this.modelClients; - } - - /** - * The UnionEnumsImpl object to access its operations. - */ - private final UnionEnumsImpl unionEnums; - - /** - * Gets the UnionEnumsImpl object to access its operations. - * - * @return the UnionEnumsImpl object. - */ - public UnionEnumsImpl getUnionEnums() { - return this.unionEnums; - } - - /** - * Initializes an instance of NamingClient client. - * - * @param endpoint Service host. - */ - public NamingClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NamingClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public NamingClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NamingClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public NamingClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.modelClients = new ModelClientsImpl(this); - this.unionEnums = new UnionEnumsImpl(this); - this.service = RestProxy.create(NamingClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for NamingClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NamingClient") - public interface NamingClientService { - @Post("/client/naming/operation") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> clientName(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Post("/client/naming/operation") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response clientNameSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Post("/client/naming/parameter") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> parameter(@HostParam("endpoint") String endpoint, - @QueryParam("defaultName") String clientName, RequestOptions requestOptions, Context context); - - @Post("/client/naming/parameter") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response parameterSync(@HostParam("endpoint") String endpoint, - @QueryParam("defaultName") String clientName, RequestOptions requestOptions, Context context); - - @Post("/client/naming/property/client") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> client(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/client/naming/property/client") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response clientSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/client/naming/property/language") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> language(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/client/naming/property/language") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response languageSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/client/naming/property/compatible-with-encoded-name") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> compatibleWithEncodedName(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/client/naming/property/compatible-with-encoded-name") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response compatibleWithEncodedNameSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/client/naming/header") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> request(@HostParam("endpoint") String endpoint, - @HeaderParam("default-name") String clientName, RequestOptions requestOptions, Context context); - - @Post("/client/naming/header") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response requestSync(@HostParam("endpoint") String endpoint, - @HeaderParam("default-name") String clientName, RequestOptions requestOptions, Context context); - - @Get("/client/naming/header") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> response(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/client/naming/header") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response responseSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The clientName operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> clientNameWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.clientName(this.getEndpoint(), requestOptions, context)); - } - - /** - * The clientName operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response clientNameWithResponse(RequestOptions requestOptions) { - return service.clientNameSync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The parameter operation. - * - * @param clientName The clientName parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> parameterWithResponseAsync(String clientName, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.parameter(this.getEndpoint(), clientName, requestOptions, context)); - } - - /** - * The parameter operation. - * - * @param clientName The clientName parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response parameterWithResponse(String clientName, RequestOptions requestOptions) { - return service.parameterSync(this.getEndpoint(), clientName, requestOptions, Context.NONE); - } - - /** - * The client operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> clientWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.client(this.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The client operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response clientWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.clientSync(this.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The language operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> languageWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.language(this.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The language operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     defaultName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response languageWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.languageSync(this.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The compatibleWithEncodedName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     wireName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> compatibleWithEncodedNameWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.compatibleWithEncodedName(this.getEndpoint(), contentType, body, - requestOptions, context)); - } - - /** - * The compatibleWithEncodedName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     wireName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response compatibleWithEncodedNameWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.compatibleWithEncodedNameSync(this.getEndpoint(), contentType, body, requestOptions, - Context.NONE); - } - - /** - * The request operation. - * - * @param clientName The clientName parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requestWithResponseAsync(String clientName, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.request(this.getEndpoint(), clientName, requestOptions, context)); - } - - /** - * The request operation. - * - * @param clientName The clientName parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requestWithResponse(String clientName, RequestOptions requestOptions) { - return service.requestSync(this.getEndpoint(), clientName, requestOptions, Context.NONE); - } - - /** - * The response operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> responseWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.response(this.getEndpoint(), requestOptions, context)); - } - - /** - * The response operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response responseWithResponse(RequestOptions requestOptions) { - return service.responseSync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/UnionEnumsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/UnionEnumsImpl.java deleted file mode 100644 index ff1a14540e2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/UnionEnumsImpl.java +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnionEnums. - */ -public final class UnionEnumsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnionEnumsService service; - - /** - * The service client containing this operation class. - */ - private final NamingClientImpl client; - - /** - * Initializes an instance of UnionEnumsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnionEnumsImpl(NamingClientImpl client) { - this.service - = RestProxy.create(UnionEnumsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NamingClientUnionEnums to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NamingClientUnionEnums") - public interface UnionEnumsService { - @Post("/client/naming/union-enum/union-enum-name") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> unionEnumName(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/client/naming/union-enum/union-enum-name") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response unionEnumNameSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/client/naming/union-enum/union-enum-member-name") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> unionEnumMemberName(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/client/naming/union-enum/union-enum-member-name") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response unionEnumMemberNameSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The unionEnumName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(value1)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unionEnumNameWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.unionEnumName(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The unionEnumName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(value1)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unionEnumNameWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.unionEnumNameSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The unionEnumMemberName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(value1/value2)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unionEnumMemberNameWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.unionEnumMemberName(this.client.getEndpoint(), contentType, body, - requestOptions, context)); - } - - /** - * The unionEnumMemberName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(value1/value2)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unionEnumMemberNameWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.unionEnumMemberNameSync(this.client.getEndpoint(), contentType, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/package-info.java deleted file mode 100644 index 1649f4ca942..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Naming. - * Describe changing names of types in a client with `@clientName`. - * - */ -package client.naming.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/ClientModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/ClientModel.java deleted file mode 100644 index 7431caa7fa4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/ClientModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ClientModel model. - */ -@Immutable -public final class ClientModel implements JsonSerializable { - /* - * Pass in true - */ - @Generated - private final boolean defaultName; - - /** - * Creates an instance of ClientModel class. - * - * @param defaultName the defaultName value to set. - */ - @Generated - public ClientModel(boolean defaultName) { - this.defaultName = defaultName; - } - - /** - * Get the defaultName property: Pass in true. - * - * @return the defaultName value. - */ - @Generated - public boolean isDefaultName() { - return this.defaultName; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("defaultName", this.defaultName); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ClientModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ClientModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ClientModel. - */ - @Generated - public static ClientModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - boolean defaultName = false; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("defaultName".equals(fieldName)) { - defaultName = reader.getBoolean(); - } else { - reader.skipChildren(); - } - } - return new ClientModel(defaultName); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/JavaModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/JavaModel.java deleted file mode 100644 index 971d3ee18dd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/JavaModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The JavaModel model. - */ -@Immutable -public final class JavaModel implements JsonSerializable { - /* - * Pass in true - */ - @Generated - private final boolean defaultName; - - /** - * Creates an instance of JavaModel class. - * - * @param defaultName the defaultName value to set. - */ - @Generated - public JavaModel(boolean defaultName) { - this.defaultName = defaultName; - } - - /** - * Get the defaultName property: Pass in true. - * - * @return the defaultName value. - */ - @Generated - public boolean isDefaultName() { - return this.defaultName; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("defaultName", this.defaultName); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of JavaModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of JavaModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the JavaModel. - */ - @Generated - public static JavaModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - boolean defaultName = false; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("defaultName".equals(fieldName)) { - defaultName = reader.getBoolean(); - } else { - reader.skipChildren(); - } - } - return new JavaModel(defaultName); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/package-info.java deleted file mode 100644 index 03534784dfe..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Naming. - * Describe changing names of types in a client with `@clientName`. - * - */ -package client.naming.model.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/package-info.java deleted file mode 100644 index 10dadebbad5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Naming. - * Describe changing names of types in a client with `@clientName`. - * - */ -package client.naming; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameAndJsonEncodedNameModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameAndJsonEncodedNameModel.java deleted file mode 100644 index 97269505cef..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameAndJsonEncodedNameModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ClientNameAndJsonEncodedNameModel model. - */ -@Immutable -public final class ClientNameAndJsonEncodedNameModel implements JsonSerializable { - /* - * Pass in true - */ - @Generated - private final boolean clientName; - - /** - * Creates an instance of ClientNameAndJsonEncodedNameModel class. - * - * @param clientName the clientName value to set. - */ - @Generated - public ClientNameAndJsonEncodedNameModel(boolean clientName) { - this.clientName = clientName; - } - - /** - * Get the clientName property: Pass in true. - * - * @return the clientName value. - */ - @Generated - public boolean isClientName() { - return this.clientName; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("wireName", this.clientName); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ClientNameAndJsonEncodedNameModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ClientNameAndJsonEncodedNameModel if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ClientNameAndJsonEncodedNameModel. - */ - @Generated - public static ClientNameAndJsonEncodedNameModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - boolean clientName = false; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("wireName".equals(fieldName)) { - clientName = reader.getBoolean(); - } else { - reader.skipChildren(); - } - } - return new ClientNameAndJsonEncodedNameModel(clientName); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameModel.java deleted file mode 100644 index 141d72e9d3e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ClientNameModel model. - */ -@Immutable -public final class ClientNameModel implements JsonSerializable { - /* - * Pass in true - */ - @Generated - private final boolean clientName; - - /** - * Creates an instance of ClientNameModel class. - * - * @param clientName the clientName value to set. - */ - @Generated - public ClientNameModel(boolean clientName) { - this.clientName = clientName; - } - - /** - * Get the clientName property: Pass in true. - * - * @return the clientName value. - */ - @Generated - public boolean isClientName() { - return this.clientName; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("defaultName", this.clientName); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ClientNameModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ClientNameModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ClientNameModel. - */ - @Generated - public static ClientNameModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - boolean clientName = false; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("defaultName".equals(fieldName)) { - clientName = reader.getBoolean(); - } else { - reader.skipChildren(); - } - } - return new ClientNameModel(clientName); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/LanguageClientNameModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/LanguageClientNameModel.java deleted file mode 100644 index 741edaafea8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/LanguageClientNameModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The LanguageClientNameModel model. - */ -@Immutable -public final class LanguageClientNameModel implements JsonSerializable { - /* - * Pass in true - */ - @Generated - private final boolean javaName; - - /** - * Creates an instance of LanguageClientNameModel class. - * - * @param javaName the javaName value to set. - */ - @Generated - public LanguageClientNameModel(boolean javaName) { - this.javaName = javaName; - } - - /** - * Get the javaName property: Pass in true. - * - * @return the javaName value. - */ - @Generated - public boolean isJavaName() { - return this.javaName; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("defaultName", this.javaName); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of LanguageClientNameModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of LanguageClientNameModel if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the LanguageClientNameModel. - */ - @Generated - public static LanguageClientNameModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - boolean javaName = false; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("defaultName".equals(fieldName)) { - javaName = reader.getBoolean(); - } else { - reader.skipChildren(); - } - } - return new LanguageClientNameModel(javaName); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/package-info.java deleted file mode 100644 index 46e5eab569f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Naming. - * Describe changing names of types in a client with `@clientName`. - * - */ -package client.naming.property.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ClientExtensibleEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ClientExtensibleEnum.java deleted file mode 100644 index b1d54c85a8c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ClientExtensibleEnum.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.unionenum.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for ClientExtensibleEnum. - */ -public final class ClientExtensibleEnum extends ExpandableStringEnum { - /** - * Static value value1 for ClientExtensibleEnum. - */ - @Generated - public static final ClientExtensibleEnum ENUM_VALUE1 = fromString("value1"); - - /** - * Creates a new instance of ClientExtensibleEnum value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public ClientExtensibleEnum() { - } - - /** - * Creates or finds a ClientExtensibleEnum from its string representation. - * - * @param name a name to look for. - * @return the corresponding ClientExtensibleEnum. - */ - @Generated - public static ClientExtensibleEnum fromString(String name) { - return fromString(name, ClientExtensibleEnum.class); - } - - /** - * Gets known ClientExtensibleEnum values. - * - * @return known ClientExtensibleEnum values. - */ - @Generated - public static Collection values() { - return values(ClientExtensibleEnum.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ExtensibleEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ExtensibleEnum.java deleted file mode 100644 index e73fab6c92d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ExtensibleEnum.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.unionenum.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for ExtensibleEnum. - */ -public final class ExtensibleEnum extends ExpandableStringEnum { - /** - * Static value value1 for ExtensibleEnum. - */ - @Generated - public static final ExtensibleEnum CLIENT_ENUM_VALUE1 = fromString("value1"); - - /** - * Static value value2 for ExtensibleEnum. - */ - @Generated - public static final ExtensibleEnum CLIENT_ENUM_VALUE2 = fromString("value2"); - - /** - * Creates a new instance of ExtensibleEnum value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public ExtensibleEnum() { - } - - /** - * Creates or finds a ExtensibleEnum from its string representation. - * - * @param name a name to look for. - * @return the corresponding ExtensibleEnum. - */ - @Generated - public static ExtensibleEnum fromString(String name) { - return fromString(name, ExtensibleEnum.class); - } - - /** - * Gets known ExtensibleEnum values. - * - * @return known ExtensibleEnum values. - */ - @Generated - public static Collection values() { - return values(ExtensibleEnum.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/package-info.java deleted file mode 100644 index 9b23ebed4b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Naming. - * Describe changing names of types in a client with `@clientName`. - * - */ -package client.naming.unionenum.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadAsyncClient.java deleted file mode 100644 index 6a924ff84c7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadAsyncClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.overload; - -import client.overload.implementation.OverloadClientImpl; -import client.overload.models.Resource; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous OverloadClient type. - */ -@ServiceClient(builder = OverloadClientBuilder.class, isAsync = true) -public final class OverloadAsyncClient { - @Generated - private final OverloadClientImpl serviceClient; - - /** - * Initializes an instance of OverloadAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - OverloadAsyncClient(OverloadClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The list operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         scope: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listWithResponse(RequestOptions requestOptions) { - return this.serviceClient.listWithResponseAsync(requestOptions); - } - - /** - * The listByScope operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         scope: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param scope The scope parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listByScopeWithResponse(String scope, RequestOptions requestOptions) { - return this.serviceClient.listByScopeWithResponseAsync(scope, requestOptions); - } - - /** - * The list operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> list() { - // Generated convenience method for listWithResponse - RequestOptions requestOptions = new RequestOptions(); - return listWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_RESOURCE)); - } - - /** - * The listByScope operation. - * - * @param scope The scope parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listByScope(String scope) { - // Generated convenience method for listByScopeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return listByScopeWithResponse(scope, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_RESOURCE)); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_RESOURCE - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClient.java deleted file mode 100644 index 58592ca3f24..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClient.java +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.overload; - -import client.overload.implementation.OverloadClientImpl; -import client.overload.models.Resource; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; - -/** - * Initializes a new instance of the synchronous OverloadClient type. - */ -@ServiceClient(builder = OverloadClientBuilder.class) -public final class OverloadClient { - @Generated - private final OverloadClientImpl serviceClient; - - /** - * Initializes an instance of OverloadClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - OverloadClient(OverloadClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The list operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         scope: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWithResponse(RequestOptions requestOptions) { - return this.serviceClient.listWithResponse(requestOptions); - } - - /** - * The listByScope operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         scope: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param scope The scope parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listByScopeWithResponse(String scope, RequestOptions requestOptions) { - return this.serviceClient.listByScopeWithResponse(scope, requestOptions); - } - - /** - * The list operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List list() { - // Generated convenience method for listWithResponse - RequestOptions requestOptions = new RequestOptions(); - return listWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_RESOURCE); - } - - /** - * The listByScope operation. - * - * @param scope The scope parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List listByScope(String scope) { - // Generated convenience method for listByScopeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return listByScopeWithResponse(scope, requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_RESOURCE); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_RESOURCE - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClientBuilder.java deleted file mode 100644 index 5c5efeb816e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.overload; - -import client.overload.implementation.OverloadClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the OverloadClient type. - */ -@ServiceClientBuilder(serviceClients = { OverloadClient.class, OverloadAsyncClient.class }) -public final class OverloadClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("client-overload.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the OverloadClientBuilder. - */ - @Generated - public OverloadClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverloadClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverloadClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverloadClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverloadClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverloadClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverloadClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverloadClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OverloadClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the OverloadClientBuilder. - */ - @Generated - public OverloadClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of OverloadClientImpl with the provided parameters. - * - * @return an instance of OverloadClientImpl. - */ - @Generated - private OverloadClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - OverloadClientImpl client - = new OverloadClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of OverloadAsyncClient class. - * - * @return an instance of OverloadAsyncClient. - */ - @Generated - public OverloadAsyncClient buildAsyncClient() { - return new OverloadAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of OverloadClient class. - * - * @return an instance of OverloadClient. - */ - @Generated - public OverloadClient buildClient() { - return new OverloadClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(OverloadClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/OverloadClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/OverloadClientImpl.java deleted file mode 100644 index b3a3f7b1058..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/OverloadClientImpl.java +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.overload.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the OverloadClient type. - */ -public final class OverloadClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final OverloadClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of OverloadClient client. - * - * @param endpoint Service host. - */ - public OverloadClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of OverloadClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public OverloadClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of OverloadClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public OverloadClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(OverloadClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for OverloadClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OverloadClient") - public interface OverloadClientService { - @Get("/client/overload/resources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> list(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/client/overload/resources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/client/overload/resources/{scope}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listByScope(@HostParam("endpoint") String endpoint, @PathParam("scope") String scope, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/client/overload/resources/{scope}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listByScopeSync(@HostParam("endpoint") String endpoint, @PathParam("scope") String scope, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * The list operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         scope: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.list(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The list operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         scope: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.listSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The listByScope operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         scope: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param scope The scope parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listByScopeWithResponseAsync(String scope, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByScope(this.getEndpoint(), scope, accept, requestOptions, context)); - } - - /** - * The listByScope operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         scope: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param scope The scope parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listByScopeWithResponse(String scope, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.listByScopeSync(this.getEndpoint(), scope, accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/package-info.java deleted file mode 100644 index c8cae93e0f6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Overload. - * Test for overload operation in .NET. - * - */ -package client.overload.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/Resource.java deleted file mode 100644 index 74bc59aa4f8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/Resource.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.overload.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Resource model. - */ -@Immutable -public final class Resource implements JsonSerializable { - /* - * The id property. - */ - @Generated - private final String id; - - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The scope property. - */ - @Generated - private final String scope; - - /** - * Creates an instance of Resource class. - * - * @param id the id value to set. - * @param name the name value to set. - * @param scope the scope value to set. - */ - @Generated - private Resource(String id, String name, String scope) { - this.id = id; - this.name = name; - this.scope = scope; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the scope property: The scope property. - * - * @return the scope value. - */ - @Generated - public String getScope() { - return this.scope; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("scope", this.scope); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Resource from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Resource. - */ - @Generated - public static Resource fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String name = null; - String scope = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("scope".equals(fieldName)) { - scope = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Resource(id, name, scope); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/package-info.java deleted file mode 100644 index 87d5f3c65fd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Overload. - * Test for overload operation in .NET. - * - */ -package client.overload.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/package-info.java deleted file mode 100644 index e35b221ead0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Overload. - * Test for overload operation in .NET. - * - */ -package client.overload; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5AsyncClient.java deleted file mode 100644 index 4de78d62108..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5AsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.anotherclientoperationgroup.subnamespace; - -import client.structure.clientoperationgroup.implementation.Group5sImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous SecondClient type. - */ -@ServiceClient(builder = SecondClientBuilder.class, isAsync = true) -public final class Group5AsyncClient { - @Generated - private final Group5sImpl serviceClient; - - /** - * Initializes an instance of Group5AsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Group5AsyncClient(Group5sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The six operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sixWithResponse(RequestOptions requestOptions) { - return this.serviceClient.sixWithResponseAsync(requestOptions); - } - - /** - * The six operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono six() { - // Generated convenience method for sixWithResponse - RequestOptions requestOptions = new RequestOptions(); - return sixWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5Client.java deleted file mode 100644 index 73eb49cae6f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5Client.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.anotherclientoperationgroup.subnamespace; - -import client.structure.clientoperationgroup.implementation.Group5sImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous SecondClient type. - */ -@ServiceClient(builder = SecondClientBuilder.class) -public final class Group5Client { - @Generated - private final Group5sImpl serviceClient; - - /** - * Initializes an instance of Group5Client class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Group5Client(Group5sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The six operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sixWithResponse(RequestOptions requestOptions) { - return this.serviceClient.sixWithResponse(requestOptions); - } - - /** - * The six operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void six() { - // Generated convenience method for sixWithResponse - RequestOptions requestOptions = new RequestOptions(); - sixWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondAsyncClient.java deleted file mode 100644 index 1ce2e3b9112..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.anotherclientoperationgroup.subnamespace; - -import client.structure.clientoperationgroup.implementation.SecondClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous SecondClient type. - */ -@ServiceClient(builder = SecondClientBuilder.class, isAsync = true) -public final class SecondAsyncClient { - @Generated - private final SecondClientImpl serviceClient; - - /** - * Initializes an instance of SecondAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SecondAsyncClient(SecondClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The five operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fiveWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fiveWithResponseAsync(requestOptions); - } - - /** - * The five operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono five() { - // Generated convenience method for fiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fiveWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClient.java deleted file mode 100644 index 1eb84f8693c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.anotherclientoperationgroup.subnamespace; - -import client.structure.clientoperationgroup.implementation.SecondClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous SecondClient type. - */ -@ServiceClient(builder = SecondClientBuilder.class) -public final class SecondClient { - @Generated - private final SecondClientImpl serviceClient; - - /** - * Initializes an instance of SecondClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SecondClient(SecondClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The five operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fiveWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fiveWithResponse(requestOptions); - } - - /** - * The five operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void five() { - // Generated convenience method for fiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - fiveWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClientBuilder.java deleted file mode 100644 index 6cf381f5ba9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClientBuilder.java +++ /dev/null @@ -1,329 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.anotherclientoperationgroup.subnamespace; - -import client.structure.clientoperationgroup.implementation.SecondClientImpl; -import client.structure.service.models.ClientType; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the SecondClient type. - */ -@ServiceClientBuilder( - serviceClients = { SecondClient.class, Group5Client.class, SecondAsyncClient.class, Group5AsyncClient.class }) -public final class SecondClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("client-structure-clientoperationgroup.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the SecondClientBuilder. - */ - @Generated - public SecondClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SecondClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SecondClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SecondClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SecondClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SecondClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SecondClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SecondClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SecondClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - @Generated - private ClientType client; - - /** - * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @param client the client value. - * @return the SecondClientBuilder. - */ - @Generated - public SecondClientBuilder client(ClientType client) { - this.client = client; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the SecondClientBuilder. - */ - @Generated - public SecondClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of SecondClientImpl with the provided parameters. - * - * @return an instance of SecondClientImpl. - */ - @Generated - private SecondClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - SecondClientImpl client = new SecondClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - this.endpoint, this.client); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - Objects.requireNonNull(client, "'client' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of SecondAsyncClient class. - * - * @return an instance of SecondAsyncClient. - */ - @Generated - public SecondAsyncClient buildAsyncClient() { - return new SecondAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of Group5AsyncClient class. - * - * @return an instance of Group5AsyncClient. - */ - @Generated - public Group5AsyncClient buildGroup5AsyncClient() { - return new Group5AsyncClient(buildInnerClient().getGroup5s()); - } - - /** - * Builds an instance of SecondClient class. - * - * @return an instance of SecondClient. - */ - @Generated - public SecondClient buildClient() { - return new SecondClient(buildInnerClient()); - } - - /** - * Builds an instance of Group5Client class. - * - * @return an instance of Group5Client. - */ - @Generated - public Group5Client buildGroup5Client() { - return new Group5Client(buildInnerClient().getGroup5s()); - } - - private static final ClientLogger LOGGER = new ClientLogger(SecondClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/package-info.java deleted file mode 100644 index 4a649af0460..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for SecondClient. - * Test that we can use @client and @operationGroup decorators to customize client side code structure, such - * as: - * 1. have everything as default. - * 2. to rename client or operation group - * 3. one client can have more than one operations groups - * 4. split one interface into two clients - * 5. have two clients with operations come from different interfaces - * 6. have two clients with a hierarchy relation. - * - */ -package client.structure.anotherclientoperationgroup.subnamespace; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstAsyncClient.java deleted file mode 100644 index d979682d0f3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup; - -import client.structure.clientoperationgroup.implementation.FirstClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous FirstClient type. - */ -@ServiceClient(builder = FirstClientBuilder.class, isAsync = true) -public final class FirstAsyncClient { - @Generated - private final FirstClientImpl serviceClient; - - /** - * Initializes an instance of FirstAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FirstAsyncClient(FirstClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The one operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> oneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.oneWithResponseAsync(requestOptions); - } - - /** - * The one operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono one() { - // Generated convenience method for oneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return oneWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClient.java deleted file mode 100644 index f65ade66215..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup; - -import client.structure.clientoperationgroup.implementation.FirstClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous FirstClient type. - */ -@ServiceClient(builder = FirstClientBuilder.class) -public final class FirstClient { - @Generated - private final FirstClientImpl serviceClient; - - /** - * Initializes an instance of FirstClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FirstClient(FirstClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The one operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response oneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.oneWithResponse(requestOptions); - } - - /** - * The one operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void one() { - // Generated convenience method for oneWithResponse - RequestOptions requestOptions = new RequestOptions(); - oneWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClientBuilder.java deleted file mode 100644 index 5e5d5dfd0c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClientBuilder.java +++ /dev/null @@ -1,355 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup; - -import client.structure.clientoperationgroup.implementation.FirstClientImpl; -import client.structure.service.models.ClientType; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the FirstClient type. - */ -@ServiceClientBuilder( - serviceClients = { - FirstClient.class, - Group3Client.class, - Group4Client.class, - FirstAsyncClient.class, - Group3AsyncClient.class, - Group4AsyncClient.class }) -public final class FirstClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("client-structure-clientoperationgroup.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the FirstClientBuilder. - */ - @Generated - public FirstClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FirstClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FirstClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FirstClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FirstClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FirstClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FirstClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FirstClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FirstClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - @Generated - private ClientType client; - - /** - * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @param client the client value. - * @return the FirstClientBuilder. - */ - @Generated - public FirstClientBuilder client(ClientType client) { - this.client = client; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the FirstClientBuilder. - */ - @Generated - public FirstClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of FirstClientImpl with the provided parameters. - * - * @return an instance of FirstClientImpl. - */ - @Generated - private FirstClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - FirstClientImpl client = new FirstClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - this.endpoint, this.client); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - Objects.requireNonNull(client, "'client' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of FirstAsyncClient class. - * - * @return an instance of FirstAsyncClient. - */ - @Generated - public FirstAsyncClient buildAsyncClient() { - return new FirstAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of Group3AsyncClient class. - * - * @return an instance of Group3AsyncClient. - */ - @Generated - public Group3AsyncClient buildGroup3AsyncClient() { - return new Group3AsyncClient(buildInnerClient().getGroup3s()); - } - - /** - * Builds an instance of Group4AsyncClient class. - * - * @return an instance of Group4AsyncClient. - */ - @Generated - public Group4AsyncClient buildGroup4AsyncClient() { - return new Group4AsyncClient(buildInnerClient().getGroup4s()); - } - - /** - * Builds an instance of FirstClient class. - * - * @return an instance of FirstClient. - */ - @Generated - public FirstClient buildClient() { - return new FirstClient(buildInnerClient()); - } - - /** - * Builds an instance of Group3Client class. - * - * @return an instance of Group3Client. - */ - @Generated - public Group3Client buildGroup3Client() { - return new Group3Client(buildInnerClient().getGroup3s()); - } - - /** - * Builds an instance of Group4Client class. - * - * @return an instance of Group4Client. - */ - @Generated - public Group4Client buildGroup4Client() { - return new Group4Client(buildInnerClient().getGroup4s()); - } - - private static final ClientLogger LOGGER = new ClientLogger(FirstClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3AsyncClient.java deleted file mode 100644 index d9aa9c27af9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3AsyncClient.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup; - -import client.structure.clientoperationgroup.implementation.Group3sImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous FirstClient type. - */ -@ServiceClient(builder = FirstClientBuilder.class, isAsync = true) -public final class Group3AsyncClient { - @Generated - private final Group3sImpl serviceClient; - - /** - * Initializes an instance of Group3AsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Group3AsyncClient(Group3sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The two operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> twoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.twoWithResponseAsync(requestOptions); - } - - /** - * The three operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> threeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.threeWithResponseAsync(requestOptions); - } - - /** - * The two operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono two() { - // Generated convenience method for twoWithResponse - RequestOptions requestOptions = new RequestOptions(); - return twoWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The three operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono three() { - // Generated convenience method for threeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return threeWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3Client.java deleted file mode 100644 index 289cada0739..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3Client.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup; - -import client.structure.clientoperationgroup.implementation.Group3sImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous FirstClient type. - */ -@ServiceClient(builder = FirstClientBuilder.class) -public final class Group3Client { - @Generated - private final Group3sImpl serviceClient; - - /** - * Initializes an instance of Group3Client class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Group3Client(Group3sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The two operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response twoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.twoWithResponse(requestOptions); - } - - /** - * The three operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response threeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.threeWithResponse(requestOptions); - } - - /** - * The two operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void two() { - // Generated convenience method for twoWithResponse - RequestOptions requestOptions = new RequestOptions(); - twoWithResponse(requestOptions).getValue(); - } - - /** - * The three operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void three() { - // Generated convenience method for threeWithResponse - RequestOptions requestOptions = new RequestOptions(); - threeWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4AsyncClient.java deleted file mode 100644 index 520428cfec0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4AsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup; - -import client.structure.clientoperationgroup.implementation.Group4sImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous FirstClient type. - */ -@ServiceClient(builder = FirstClientBuilder.class, isAsync = true) -public final class Group4AsyncClient { - @Generated - private final Group4sImpl serviceClient; - - /** - * Initializes an instance of Group4AsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Group4AsyncClient(Group4sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The four operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fourWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fourWithResponseAsync(requestOptions); - } - - /** - * The four operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono four() { - // Generated convenience method for fourWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fourWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4Client.java deleted file mode 100644 index a328066729d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4Client.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup; - -import client.structure.clientoperationgroup.implementation.Group4sImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous FirstClient type. - */ -@ServiceClient(builder = FirstClientBuilder.class) -public final class Group4Client { - @Generated - private final Group4sImpl serviceClient; - - /** - * Initializes an instance of Group4Client class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Group4Client(Group4sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The four operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fourWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fourWithResponse(requestOptions); - } - - /** - * The four operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void four() { - // Generated convenience method for fourWithResponse - RequestOptions requestOptions = new RequestOptions(); - fourWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/FirstClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/FirstClientImpl.java deleted file mode 100644 index 0663fc01880..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/FirstClientImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the FirstClient type. - */ -public final class FirstClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FirstClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - private final ClientType client; - - /** - * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @return the client value. - */ - public ClientType getClient() { - return this.client; - } - - /** - * 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 Group3sImpl object to access its operations. - */ - private final Group3sImpl group3s; - - /** - * Gets the Group3sImpl object to access its operations. - * - * @return the Group3sImpl object. - */ - public Group3sImpl getGroup3s() { - return this.group3s; - } - - /** - * The Group4sImpl object to access its operations. - */ - private final Group4sImpl group4s; - - /** - * Gets the Group4sImpl object to access its operations. - * - * @return the Group4sImpl object. - */ - public Group4sImpl getGroup4s() { - return this.group4s; - } - - /** - * Initializes an instance of FirstClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public FirstClientImpl(String endpoint, ClientType client) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of FirstClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public FirstClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of FirstClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public FirstClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - ClientType client) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.client = client; - this.group3s = new Group3sImpl(this); - this.group4s = new Group4sImpl(this); - this.service = RestProxy.create(FirstClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for FirstClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "FirstClient") - public interface FirstClientService { - @Post("/one") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> one(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/one") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response oneSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The one operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> oneWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.one(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The one operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response oneWithResponse(RequestOptions requestOptions) { - return service.oneSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group3sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group3sImpl.java deleted file mode 100644 index cc861000362..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group3sImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Group3s. - */ -public final class Group3sImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Group3sService service; - - /** - * The service client containing this operation class. - */ - private final FirstClientImpl client; - - /** - * Initializes an instance of Group3sImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Group3sImpl(FirstClientImpl client) { - this.service = RestProxy.create(Group3sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for FirstClientGroup3s to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "FirstClientGroup3s") - public interface Group3sService { - @Post("/two") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> two(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/two") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response twoSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/three") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> three(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/three") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response threeSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The two operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> twoWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.two(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The two operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response twoWithResponse(RequestOptions requestOptions) { - return service.twoSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } - - /** - * The three operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> threeWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.three(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The three operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response threeWithResponse(RequestOptions requestOptions) { - return service.threeSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group4sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group4sImpl.java deleted file mode 100644 index 445b41ae3e6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group4sImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Group4s. - */ -public final class Group4sImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Group4sService service; - - /** - * The service client containing this operation class. - */ - private final FirstClientImpl client; - - /** - * Initializes an instance of Group4sImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Group4sImpl(FirstClientImpl client) { - this.service = RestProxy.create(Group4sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for FirstClientGroup4s to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "FirstClientGroup4s") - public interface Group4sService { - @Post("/four") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> four(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/four") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fourSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The four operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fourWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.four(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The four operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fourWithResponse(RequestOptions requestOptions) { - return service.fourSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group5sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group5sImpl.java deleted file mode 100644 index 9fd28a5de33..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group5sImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Group5s. - */ -public final class Group5sImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Group5sService service; - - /** - * The service client containing this operation class. - */ - private final SecondClientImpl client; - - /** - * Initializes an instance of Group5sImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Group5sImpl(SecondClientImpl client) { - this.service = RestProxy.create(Group5sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for SecondClientGroup5s to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "SecondClientGroup5s") - public interface Group5sService { - @Post("/six") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> six(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/six") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sixSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The six operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sixWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.six(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The six operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sixWithResponse(RequestOptions requestOptions) { - return service.sixSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/SecondClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/SecondClientImpl.java deleted file mode 100644 index a7a49fb4084..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/SecondClientImpl.java +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the SecondClient type. - */ -public final class SecondClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SecondClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - private final ClientType client; - - /** - * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @return the client value. - */ - public ClientType getClient() { - return this.client; - } - - /** - * 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 Group5sImpl object to access its operations. - */ - private final Group5sImpl group5s; - - /** - * Gets the Group5sImpl object to access its operations. - * - * @return the Group5sImpl object. - */ - public Group5sImpl getGroup5s() { - return this.group5s; - } - - /** - * Initializes an instance of SecondClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public SecondClientImpl(String endpoint, ClientType client) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of SecondClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public SecondClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of SecondClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public SecondClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - ClientType client) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.client = client; - this.group5s = new Group5sImpl(this); - this.service = RestProxy.create(SecondClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for SecondClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "SecondClient") - public interface SecondClientService { - @Post("/five") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> five(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/five") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fiveSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The five operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fiveWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.five(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The five operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fiveWithResponse(RequestOptions requestOptions) { - return service.fiveSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/package-info.java deleted file mode 100644 index a806f1928b8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Service. - * Test that we can use @client and @operationGroup decorators to customize client side code structure, such - * as: - * 1. have everything as default. - * 2. to rename client or operation group - * 3. one client can have more than one operations groups - * 4. split one interface into two clients - * 5. have two clients with operations come from different interfaces - * 6. have two clients with a hierarchy relation. - * - */ -package client.structure.clientoperationgroup.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/package-info.java deleted file mode 100644 index 2b619ea0cb2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Service. - * Test that we can use @client and @operationGroup decorators to customize client side code structure, such - * as: - * 1. have everything as default. - * 2. to rename client or operation group - * 3. one client can have more than one operations groups - * 4. split one interface into two clients - * 5. have two clients with operations come from different interfaces - * 6. have two clients with a hierarchy relation. - * - */ -package client.structure.clientoperationgroup; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAAsyncClient.java deleted file mode 100644 index 8bfb2f86bc6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAAsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.multiclient; - -import client.structure.multiclient.implementation.ClientAClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ClientAClient type. - */ -@ServiceClient(builder = ClientAClientBuilder.class, isAsync = true) -public final class ClientAAsyncClient { - @Generated - private final ClientAClientImpl serviceClient; - - /** - * Initializes an instance of ClientAAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ClientAAsyncClient(ClientAClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The renamedOne operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedOneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedOneWithResponseAsync(requestOptions); - } - - /** - * The renamedThree operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedThreeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedThreeWithResponseAsync(requestOptions); - } - - /** - * The renamedFive operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedFiveWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedFiveWithResponseAsync(requestOptions); - } - - /** - * The renamedOne operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renamedOne() { - // Generated convenience method for renamedOneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return renamedOneWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The renamedThree operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renamedThree() { - // Generated convenience method for renamedThreeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return renamedThreeWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The renamedFive operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renamedFive() { - // Generated convenience method for renamedFiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return renamedFiveWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClient.java deleted file mode 100644 index eea8925a0c3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.multiclient; - -import client.structure.multiclient.implementation.ClientAClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ClientAClient type. - */ -@ServiceClient(builder = ClientAClientBuilder.class) -public final class ClientAClient { - @Generated - private final ClientAClientImpl serviceClient; - - /** - * Initializes an instance of ClientAClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ClientAClient(ClientAClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The renamedOne operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedOneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedOneWithResponse(requestOptions); - } - - /** - * The renamedThree operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedThreeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedThreeWithResponse(requestOptions); - } - - /** - * The renamedFive operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedFiveWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedFiveWithResponse(requestOptions); - } - - /** - * The renamedOne operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void renamedOne() { - // Generated convenience method for renamedOneWithResponse - RequestOptions requestOptions = new RequestOptions(); - renamedOneWithResponse(requestOptions).getValue(); - } - - /** - * The renamedThree operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void renamedThree() { - // Generated convenience method for renamedThreeWithResponse - RequestOptions requestOptions = new RequestOptions(); - renamedThreeWithResponse(requestOptions).getValue(); - } - - /** - * The renamedFive operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void renamedFive() { - // Generated convenience method for renamedFiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - renamedFiveWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClientBuilder.java deleted file mode 100644 index 26b39606e76..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClientBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.multiclient; - -import client.structure.multiclient.implementation.ClientAClientImpl; -import client.structure.service.models.ClientType; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ClientAClient type. - */ -@ServiceClientBuilder(serviceClients = { ClientAClient.class, ClientAAsyncClient.class }) -public final class ClientAClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("client-structure-multiclient.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ClientAClientBuilder. - */ - @Generated - public ClientAClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientAClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientAClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientAClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientAClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientAClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientAClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientAClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientAClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - @Generated - private ClientType client; - - /** - * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @param client the client value. - * @return the ClientAClientBuilder. - */ - @Generated - public ClientAClientBuilder client(ClientType client) { - this.client = client; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ClientAClientBuilder. - */ - @Generated - public ClientAClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ClientAClientImpl with the provided parameters. - * - * @return an instance of ClientAClientImpl. - */ - @Generated - private ClientAClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - ClientAClientImpl client = new ClientAClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - this.endpoint, this.client); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - Objects.requireNonNull(client, "'client' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ClientAAsyncClient class. - * - * @return an instance of ClientAAsyncClient. - */ - @Generated - public ClientAAsyncClient buildAsyncClient() { - return new ClientAAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ClientAClient class. - * - * @return an instance of ClientAClient. - */ - @Generated - public ClientAClient buildClient() { - return new ClientAClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ClientAClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBAsyncClient.java deleted file mode 100644 index 9457d59396c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBAsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.multiclient; - -import client.structure.multiclient.implementation.ClientBClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ClientBClient type. - */ -@ServiceClient(builder = ClientBClientBuilder.class, isAsync = true) -public final class ClientBAsyncClient { - @Generated - private final ClientBClientImpl serviceClient; - - /** - * Initializes an instance of ClientBAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ClientBAsyncClient(ClientBClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The renamedTwo operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedTwoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedTwoWithResponseAsync(requestOptions); - } - - /** - * The renamedFour operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedFourWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedFourWithResponseAsync(requestOptions); - } - - /** - * The renamedSix operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedSixWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedSixWithResponseAsync(requestOptions); - } - - /** - * The renamedTwo operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renamedTwo() { - // Generated convenience method for renamedTwoWithResponse - RequestOptions requestOptions = new RequestOptions(); - return renamedTwoWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The renamedFour operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renamedFour() { - // Generated convenience method for renamedFourWithResponse - RequestOptions requestOptions = new RequestOptions(); - return renamedFourWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The renamedSix operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renamedSix() { - // Generated convenience method for renamedSixWithResponse - RequestOptions requestOptions = new RequestOptions(); - return renamedSixWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClient.java deleted file mode 100644 index 28bf6a65572..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.multiclient; - -import client.structure.multiclient.implementation.ClientBClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ClientBClient type. - */ -@ServiceClient(builder = ClientBClientBuilder.class) -public final class ClientBClient { - @Generated - private final ClientBClientImpl serviceClient; - - /** - * Initializes an instance of ClientBClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ClientBClient(ClientBClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The renamedTwo operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedTwoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedTwoWithResponse(requestOptions); - } - - /** - * The renamedFour operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedFourWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedFourWithResponse(requestOptions); - } - - /** - * The renamedSix operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedSixWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedSixWithResponse(requestOptions); - } - - /** - * The renamedTwo operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void renamedTwo() { - // Generated convenience method for renamedTwoWithResponse - RequestOptions requestOptions = new RequestOptions(); - renamedTwoWithResponse(requestOptions).getValue(); - } - - /** - * The renamedFour operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void renamedFour() { - // Generated convenience method for renamedFourWithResponse - RequestOptions requestOptions = new RequestOptions(); - renamedFourWithResponse(requestOptions).getValue(); - } - - /** - * The renamedSix operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void renamedSix() { - // Generated convenience method for renamedSixWithResponse - RequestOptions requestOptions = new RequestOptions(); - renamedSixWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClientBuilder.java deleted file mode 100644 index 1ad3b9b4efa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClientBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.multiclient; - -import client.structure.multiclient.implementation.ClientBClientImpl; -import client.structure.service.models.ClientType; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ClientBClient type. - */ -@ServiceClientBuilder(serviceClients = { ClientBClient.class, ClientBAsyncClient.class }) -public final class ClientBClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("client-structure-multiclient.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ClientBClientBuilder. - */ - @Generated - public ClientBClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientBClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientBClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientBClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientBClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientBClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientBClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientBClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientBClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - @Generated - private ClientType client; - - /** - * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @param client the client value. - * @return the ClientBClientBuilder. - */ - @Generated - public ClientBClientBuilder client(ClientType client) { - this.client = client; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ClientBClientBuilder. - */ - @Generated - public ClientBClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ClientBClientImpl with the provided parameters. - * - * @return an instance of ClientBClientImpl. - */ - @Generated - private ClientBClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - ClientBClientImpl client = new ClientBClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - this.endpoint, this.client); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - Objects.requireNonNull(client, "'client' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ClientBAsyncClient class. - * - * @return an instance of ClientBAsyncClient. - */ - @Generated - public ClientBAsyncClient buildAsyncClient() { - return new ClientBAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ClientBClient class. - * - * @return an instance of ClientBClient. - */ - @Generated - public ClientBClient buildClient() { - return new ClientBClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ClientBClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientAClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientAClientImpl.java deleted file mode 100644 index 6e9f2779ba1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientAClientImpl.java +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.multiclient.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the ClientAClient type. - */ -public final class ClientAClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ClientAClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - private final ClientType client; - - /** - * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @return the client value. - */ - public ClientType getClient() { - return this.client; - } - - /** - * 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; - } - - /** - * Initializes an instance of ClientAClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public ClientAClientImpl(String endpoint, ClientType client) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of ClientAClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public ClientAClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of ClientAClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public ClientAClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - ClientType client) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.client = client; - this.service = RestProxy.create(ClientAClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ClientAClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "ClientAClient") - public interface ClientAClientService { - @Post("/one") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> renamedOne(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/one") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response renamedOneSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/three") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> renamedThree(@HostParam("endpoint") String endpoint, - @HostParam("client") ClientType client, RequestOptions requestOptions, Context context); - - @Post("/three") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response renamedThreeSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/five") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> renamedFive(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/five") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response renamedFiveSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The renamedOne operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedOneWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.renamedOne(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The renamedOne operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedOneWithResponse(RequestOptions requestOptions) { - return service.renamedOneSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } - - /** - * The renamedThree operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedThreeWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.renamedThree(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The renamedThree operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedThreeWithResponse(RequestOptions requestOptions) { - return service.renamedThreeSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } - - /** - * The renamedFive operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedFiveWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.renamedFive(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The renamedFive operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedFiveWithResponse(RequestOptions requestOptions) { - return service.renamedFiveSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientBClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientBClientImpl.java deleted file mode 100644 index 079b8aa421f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientBClientImpl.java +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.multiclient.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the ClientBClient type. - */ -public final class ClientBClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ClientBClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - private final ClientType client; - - /** - * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @return the client value. - */ - public ClientType getClient() { - return this.client; - } - - /** - * 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; - } - - /** - * Initializes an instance of ClientBClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public ClientBClientImpl(String endpoint, ClientType client) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of ClientBClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public ClientBClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of ClientBClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public ClientBClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - ClientType client) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.client = client; - this.service = RestProxy.create(ClientBClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ClientBClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "ClientBClient") - public interface ClientBClientService { - @Post("/two") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> renamedTwo(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/two") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response renamedTwoSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/four") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> renamedFour(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/four") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response renamedFourSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/six") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> renamedSix(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/six") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response renamedSixSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The renamedTwo operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedTwoWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.renamedTwo(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The renamedTwo operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedTwoWithResponse(RequestOptions requestOptions) { - return service.renamedTwoSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } - - /** - * The renamedFour operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedFourWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.renamedFour(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The renamedFour operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedFourWithResponse(RequestOptions requestOptions) { - return service.renamedFourSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } - - /** - * The renamedSix operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedSixWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.renamedSix(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The renamedSix operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedSixWithResponse(RequestOptions requestOptions) { - return service.renamedSixSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/package-info.java deleted file mode 100644 index 4bd35e24192..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Service. - * Test that we can use @client and @operationGroup decorators to customize client side code structure, such - * as: - * 1. have everything as default. - * 2. to rename client or operation group - * 3. one client can have more than one operations groups - * 4. split one interface into two clients - * 5. have two clients with operations come from different interfaces - * 6. have two clients with a hierarchy relation. - * - */ -package client.structure.multiclient.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/package-info.java deleted file mode 100644 index 9e0bc9b2ccd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Service. - * Test that we can use @client and @operationGroup decorators to customize client side code structure, such - * as: - * 1. have everything as default. - * 2. to rename client or operation group - * 3. one client can have more than one operations groups - * 4. split one interface into two clients - * 5. have two clients with operations come from different interfaces - * 6. have two clients with a hierarchy relation. - * - */ -package client.structure.multiclient; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupAsyncClient.java deleted file mode 100644 index 9e654d6d4be..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupAsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.renamedoperation; - -import client.structure.renamedoperation.implementation.GroupsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous RenamedOperationClient type. - */ -@ServiceClient(builder = RenamedOperationClientBuilder.class, isAsync = true) -public final class GroupAsyncClient { - @Generated - private final GroupsImpl serviceClient; - - /** - * Initializes an instance of GroupAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - GroupAsyncClient(GroupsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The renamedTwo operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedTwoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedTwoWithResponseAsync(requestOptions); - } - - /** - * The renamedFour operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedFourWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedFourWithResponseAsync(requestOptions); - } - - /** - * The renamedSix operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedSixWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedSixWithResponseAsync(requestOptions); - } - - /** - * The renamedTwo operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renamedTwo() { - // Generated convenience method for renamedTwoWithResponse - RequestOptions requestOptions = new RequestOptions(); - return renamedTwoWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The renamedFour operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renamedFour() { - // Generated convenience method for renamedFourWithResponse - RequestOptions requestOptions = new RequestOptions(); - return renamedFourWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The renamedSix operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renamedSix() { - // Generated convenience method for renamedSixWithResponse - RequestOptions requestOptions = new RequestOptions(); - return renamedSixWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupClient.java deleted file mode 100644 index 377c0322cbd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.renamedoperation; - -import client.structure.renamedoperation.implementation.GroupsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous RenamedOperationClient type. - */ -@ServiceClient(builder = RenamedOperationClientBuilder.class) -public final class GroupClient { - @Generated - private final GroupsImpl serviceClient; - - /** - * Initializes an instance of GroupClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - GroupClient(GroupsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The renamedTwo operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedTwoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedTwoWithResponse(requestOptions); - } - - /** - * The renamedFour operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedFourWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedFourWithResponse(requestOptions); - } - - /** - * The renamedSix operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedSixWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedSixWithResponse(requestOptions); - } - - /** - * The renamedTwo operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void renamedTwo() { - // Generated convenience method for renamedTwoWithResponse - RequestOptions requestOptions = new RequestOptions(); - renamedTwoWithResponse(requestOptions).getValue(); - } - - /** - * The renamedFour operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void renamedFour() { - // Generated convenience method for renamedFourWithResponse - RequestOptions requestOptions = new RequestOptions(); - renamedFourWithResponse(requestOptions).getValue(); - } - - /** - * The renamedSix operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void renamedSix() { - // Generated convenience method for renamedSixWithResponse - RequestOptions requestOptions = new RequestOptions(); - renamedSixWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationAsyncClient.java deleted file mode 100644 index 5140c8ca6d9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationAsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.renamedoperation; - -import client.structure.renamedoperation.implementation.RenamedOperationClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous RenamedOperationClient type. - */ -@ServiceClient(builder = RenamedOperationClientBuilder.class, isAsync = true) -public final class RenamedOperationAsyncClient { - @Generated - private final RenamedOperationClientImpl serviceClient; - - /** - * Initializes an instance of RenamedOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RenamedOperationAsyncClient(RenamedOperationClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The renamedOne operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedOneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedOneWithResponseAsync(requestOptions); - } - - /** - * The renamedThree operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedThreeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedThreeWithResponseAsync(requestOptions); - } - - /** - * The renamedFive operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedFiveWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedFiveWithResponseAsync(requestOptions); - } - - /** - * The renamedOne operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renamedOne() { - // Generated convenience method for renamedOneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return renamedOneWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The renamedThree operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renamedThree() { - // Generated convenience method for renamedThreeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return renamedThreeWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The renamedFive operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono renamedFive() { - // Generated convenience method for renamedFiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return renamedFiveWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClient.java deleted file mode 100644 index 362e8f650c1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.renamedoperation; - -import client.structure.renamedoperation.implementation.RenamedOperationClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous RenamedOperationClient type. - */ -@ServiceClient(builder = RenamedOperationClientBuilder.class) -public final class RenamedOperationClient { - @Generated - private final RenamedOperationClientImpl serviceClient; - - /** - * Initializes an instance of RenamedOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RenamedOperationClient(RenamedOperationClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The renamedOne operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedOneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedOneWithResponse(requestOptions); - } - - /** - * The renamedThree operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedThreeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedThreeWithResponse(requestOptions); - } - - /** - * The renamedFive operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedFiveWithResponse(RequestOptions requestOptions) { - return this.serviceClient.renamedFiveWithResponse(requestOptions); - } - - /** - * The renamedOne operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void renamedOne() { - // Generated convenience method for renamedOneWithResponse - RequestOptions requestOptions = new RequestOptions(); - renamedOneWithResponse(requestOptions).getValue(); - } - - /** - * The renamedThree operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void renamedThree() { - // Generated convenience method for renamedThreeWithResponse - RequestOptions requestOptions = new RequestOptions(); - renamedThreeWithResponse(requestOptions).getValue(); - } - - /** - * The renamedFive operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void renamedFive() { - // Generated convenience method for renamedFiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - renamedFiveWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClientBuilder.java deleted file mode 100644 index 4784fa30b10..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClientBuilder.java +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.renamedoperation; - -import client.structure.renamedoperation.implementation.RenamedOperationClientImpl; -import client.structure.service.models.ClientType; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the RenamedOperationClient type. - */ -@ServiceClientBuilder( - serviceClients = { - RenamedOperationClient.class, - GroupClient.class, - RenamedOperationAsyncClient.class, - GroupAsyncClient.class }) -public final class RenamedOperationClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("client-structure-renamedoperation.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the RenamedOperationClientBuilder. - */ - @Generated - public RenamedOperationClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedOperationClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedOperationClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedOperationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedOperationClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedOperationClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedOperationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedOperationClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedOperationClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - @Generated - private ClientType client; - - /** - * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @param client the client value. - * @return the RenamedOperationClientBuilder. - */ - @Generated - public RenamedOperationClientBuilder client(ClientType client) { - this.client = client; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the RenamedOperationClientBuilder. - */ - @Generated - public RenamedOperationClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of RenamedOperationClientImpl with the provided parameters. - * - * @return an instance of RenamedOperationClientImpl. - */ - @Generated - private RenamedOperationClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - RenamedOperationClientImpl client = new RenamedOperationClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, this.client); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - Objects.requireNonNull(client, "'client' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of RenamedOperationAsyncClient class. - * - * @return an instance of RenamedOperationAsyncClient. - */ - @Generated - public RenamedOperationAsyncClient buildAsyncClient() { - return new RenamedOperationAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of GroupAsyncClient class. - * - * @return an instance of GroupAsyncClient. - */ - @Generated - public GroupAsyncClient buildGroupAsyncClient() { - return new GroupAsyncClient(buildInnerClient().getGroups()); - } - - /** - * Builds an instance of RenamedOperationClient class. - * - * @return an instance of RenamedOperationClient. - */ - @Generated - public RenamedOperationClient buildClient() { - return new RenamedOperationClient(buildInnerClient()); - } - - /** - * Builds an instance of GroupClient class. - * - * @return an instance of GroupClient. - */ - @Generated - public GroupClient buildGroupClient() { - return new GroupClient(buildInnerClient().getGroups()); - } - - private static final ClientLogger LOGGER = new ClientLogger(RenamedOperationClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/GroupsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/GroupsImpl.java deleted file mode 100644 index 1c87ec04577..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/GroupsImpl.java +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.renamedoperation.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Groups. - */ -public final class GroupsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final GroupsService service; - - /** - * The service client containing this operation class. - */ - private final RenamedOperationClientImpl client; - - /** - * Initializes an instance of GroupsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - GroupsImpl(RenamedOperationClientImpl client) { - this.service = RestProxy.create(GroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RenamedOperationClientGroups to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "RenamedOperationClientGroups") - public interface GroupsService { - @Post("/two") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> renamedTwo(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/two") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response renamedTwoSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/four") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> renamedFour(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/four") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response renamedFourSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/six") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> renamedSix(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/six") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response renamedSixSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The renamedTwo operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedTwoWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.renamedTwo(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The renamedTwo operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedTwoWithResponse(RequestOptions requestOptions) { - return service.renamedTwoSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } - - /** - * The renamedFour operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedFourWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.renamedFour(this.client.getEndpoint(), this.client.getClient(), - requestOptions, context)); - } - - /** - * The renamedFour operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedFourWithResponse(RequestOptions requestOptions) { - return service.renamedFourSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, - Context.NONE); - } - - /** - * The renamedSix operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedSixWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.renamedSix(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The renamedSix operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedSixWithResponse(RequestOptions requestOptions) { - return service.renamedSixSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/RenamedOperationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/RenamedOperationClientImpl.java deleted file mode 100644 index a704bf8a461..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/RenamedOperationClientImpl.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.renamedoperation.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the RenamedOperationClient type. - */ -public final class RenamedOperationClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RenamedOperationClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - private final ClientType client; - - /** - * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @return the client value. - */ - public ClientType getClient() { - return this.client; - } - - /** - * 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 GroupsImpl object to access its operations. - */ - private final GroupsImpl groups; - - /** - * Gets the GroupsImpl object to access its operations. - * - * @return the GroupsImpl object. - */ - public GroupsImpl getGroups() { - return this.groups; - } - - /** - * Initializes an instance of RenamedOperationClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public RenamedOperationClientImpl(String endpoint, ClientType client) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of RenamedOperationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public RenamedOperationClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of RenamedOperationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public RenamedOperationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - ClientType client) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.client = client; - this.groups = new GroupsImpl(this); - this.service - = RestProxy.create(RenamedOperationClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for RenamedOperationClient to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "RenamedOperationClient") - public interface RenamedOperationClientService { - @Post("/one") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> renamedOne(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/one") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response renamedOneSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/three") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> renamedThree(@HostParam("endpoint") String endpoint, - @HostParam("client") ClientType client, RequestOptions requestOptions, Context context); - - @Post("/three") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response renamedThreeSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/five") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> renamedFive(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/five") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response renamedFiveSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The renamedOne operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedOneWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.renamedOne(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The renamedOne operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedOneWithResponse(RequestOptions requestOptions) { - return service.renamedOneSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } - - /** - * The renamedThree operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedThreeWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.renamedThree(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The renamedThree operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedThreeWithResponse(RequestOptions requestOptions) { - return service.renamedThreeSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } - - /** - * The renamedFive operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> renamedFiveWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.renamedFive(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The renamedFive operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response renamedFiveWithResponse(RequestOptions requestOptions) { - return service.renamedFiveSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/package-info.java deleted file mode 100644 index ef4c542a7da..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Service. - * Test that we can use @client and @operationGroup decorators to customize client side code structure, such - * as: - * 1. have everything as default. - * 2. to rename client or operation group - * 3. one client can have more than one operations groups - * 4. split one interface into two clients - * 5. have two clients with operations come from different interfaces - * 6. have two clients with a hierarchy relation. - * - */ -package client.structure.renamedoperation.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/package-info.java deleted file mode 100644 index d08052aad20..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Service. - * Test that we can use @client and @operationGroup decorators to customize client side code structure, such - * as: - * 1. have everything as default. - * 2. to rename client or operation group - * 3. one client can have more than one operations groups - * 4. split one interface into two clients - * 5. have two clients with operations come from different interfaces - * 6. have two clients with a hierarchy relation. - * - */ -package client.structure.renamedoperation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarAsyncClient.java deleted file mode 100644 index b941fc9ef48..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarAsyncClient.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.BarsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ServiceClientClient type. - */ -@ServiceClient(builder = ServiceClientClientBuilder.class, isAsync = true) -public final class BarAsyncClient { - @Generated - private final BarsImpl serviceClient; - - /** - * Initializes an instance of BarAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BarAsyncClient(BarsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The five operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fiveWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fiveWithResponseAsync(requestOptions); - } - - /** - * The six operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sixWithResponse(RequestOptions requestOptions) { - return this.serviceClient.sixWithResponseAsync(requestOptions); - } - - /** - * The five operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono five() { - // Generated convenience method for fiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fiveWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The six operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono six() { - // Generated convenience method for sixWithResponse - RequestOptions requestOptions = new RequestOptions(); - return sixWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarClient.java deleted file mode 100644 index a58d0d88474..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarClient.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.BarsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ServiceClientClient type. - */ -@ServiceClient(builder = ServiceClientClientBuilder.class) -public final class BarClient { - @Generated - private final BarsImpl serviceClient; - - /** - * Initializes an instance of BarClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BarClient(BarsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The five operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fiveWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fiveWithResponse(requestOptions); - } - - /** - * The six operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sixWithResponse(RequestOptions requestOptions) { - return this.serviceClient.sixWithResponse(requestOptions); - } - - /** - * The five operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void five() { - // Generated convenience method for fiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - fiveWithResponse(requestOptions).getValue(); - } - - /** - * The six operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void six() { - // Generated convenience method for sixWithResponse - RequestOptions requestOptions = new RequestOptions(); - sixWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooAsyncClient.java deleted file mode 100644 index 58f69d03334..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.BazFoosImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ServiceClientClient type. - */ -@ServiceClient(builder = ServiceClientClientBuilder.class, isAsync = true) -public final class BazFooAsyncClient { - @Generated - private final BazFoosImpl serviceClient; - - /** - * Initializes an instance of BazFooAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BazFooAsyncClient(BazFoosImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The seven operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sevenWithResponse(RequestOptions requestOptions) { - return this.serviceClient.sevenWithResponseAsync(requestOptions); - } - - /** - * The seven operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono seven() { - // Generated convenience method for sevenWithResponse - RequestOptions requestOptions = new RequestOptions(); - return sevenWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooClient.java deleted file mode 100644 index 954ee21329d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.BazFoosImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ServiceClientClient type. - */ -@ServiceClient(builder = ServiceClientClientBuilder.class) -public final class BazFooClient { - @Generated - private final BazFoosImpl serviceClient; - - /** - * Initializes an instance of BazFooClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BazFooClient(BazFoosImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The seven operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sevenWithResponse(RequestOptions requestOptions) { - return this.serviceClient.sevenWithResponse(requestOptions); - } - - /** - * The seven operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void seven() { - // Generated convenience method for sevenWithResponse - RequestOptions requestOptions = new RequestOptions(); - sevenWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooAsyncClient.java deleted file mode 100644 index ccfe125ff70..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooAsyncClient.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.FoosImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ServiceClientClient type. - */ -@ServiceClient(builder = ServiceClientClientBuilder.class, isAsync = true) -public final class FooAsyncClient { - @Generated - private final FoosImpl serviceClient; - - /** - * Initializes an instance of FooAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FooAsyncClient(FoosImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The three operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> threeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.threeWithResponseAsync(requestOptions); - } - - /** - * The four operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fourWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fourWithResponseAsync(requestOptions); - } - - /** - * The three operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono three() { - // Generated convenience method for threeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return threeWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The four operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono four() { - // Generated convenience method for fourWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fourWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooClient.java deleted file mode 100644 index 266804d497e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooClient.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.FoosImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ServiceClientClient type. - */ -@ServiceClient(builder = ServiceClientClientBuilder.class) -public final class FooClient { - @Generated - private final FoosImpl serviceClient; - - /** - * Initializes an instance of FooClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FooClient(FoosImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The three operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response threeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.threeWithResponse(requestOptions); - } - - /** - * The four operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fourWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fourWithResponse(requestOptions); - } - - /** - * The three operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void three() { - // Generated convenience method for threeWithResponse - RequestOptions requestOptions = new RequestOptions(); - threeWithResponse(requestOptions).getValue(); - } - - /** - * The four operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void four() { - // Generated convenience method for fourWithResponse - RequestOptions requestOptions = new RequestOptions(); - fourWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxAsyncClient.java deleted file mode 100644 index fdf3efce9f8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.QuxesImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ServiceClientClient type. - */ -@ServiceClient(builder = ServiceClientClientBuilder.class, isAsync = true) -public final class QuxAsyncClient { - @Generated - private final QuxesImpl serviceClient; - - /** - * Initializes an instance of QuxAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QuxAsyncClient(QuxesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The eight operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> eightWithResponse(RequestOptions requestOptions) { - return this.serviceClient.eightWithResponseAsync(requestOptions); - } - - /** - * The eight operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono eight() { - // Generated convenience method for eightWithResponse - RequestOptions requestOptions = new RequestOptions(); - return eightWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarAsyncClient.java deleted file mode 100644 index b135871ca7e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.QuxBarsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ServiceClientClient type. - */ -@ServiceClient(builder = ServiceClientClientBuilder.class, isAsync = true) -public final class QuxBarAsyncClient { - @Generated - private final QuxBarsImpl serviceClient; - - /** - * Initializes an instance of QuxBarAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QuxBarAsyncClient(QuxBarsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The nine operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> nineWithResponse(RequestOptions requestOptions) { - return this.serviceClient.nineWithResponseAsync(requestOptions); - } - - /** - * The nine operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono nine() { - // Generated convenience method for nineWithResponse - RequestOptions requestOptions = new RequestOptions(); - return nineWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarClient.java deleted file mode 100644 index 7936f0be210..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.QuxBarsImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ServiceClientClient type. - */ -@ServiceClient(builder = ServiceClientClientBuilder.class) -public final class QuxBarClient { - @Generated - private final QuxBarsImpl serviceClient; - - /** - * Initializes an instance of QuxBarClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QuxBarClient(QuxBarsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The nine operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response nineWithResponse(RequestOptions requestOptions) { - return this.serviceClient.nineWithResponse(requestOptions); - } - - /** - * The nine operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void nine() { - // Generated convenience method for nineWithResponse - RequestOptions requestOptions = new RequestOptions(); - nineWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxClient.java deleted file mode 100644 index c329fabaef9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.QuxesImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ServiceClientClient type. - */ -@ServiceClient(builder = ServiceClientClientBuilder.class) -public final class QuxClient { - @Generated - private final QuxesImpl serviceClient; - - /** - * Initializes an instance of QuxClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QuxClient(QuxesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The eight operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response eightWithResponse(RequestOptions requestOptions) { - return this.serviceClient.eightWithResponse(requestOptions); - } - - /** - * The eight operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void eight() { - // Generated convenience method for eightWithResponse - RequestOptions requestOptions = new RequestOptions(); - eightWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientAsyncClient.java deleted file mode 100644 index cc2ff1f0b3c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientAsyncClient.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.ServiceClientClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ServiceClientClient type. - */ -@ServiceClient(builder = ServiceClientClientBuilder.class, isAsync = true) -public final class ServiceClientAsyncClient { - @Generated - private final ServiceClientClientImpl serviceClient; - - /** - * Initializes an instance of ServiceClientAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ServiceClientAsyncClient(ServiceClientClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The one operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> oneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.oneWithResponseAsync(requestOptions); - } - - /** - * The two operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> twoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.twoWithResponseAsync(requestOptions); - } - - /** - * The one operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono one() { - // Generated convenience method for oneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return oneWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The two operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono two() { - // Generated convenience method for twoWithResponse - RequestOptions requestOptions = new RequestOptions(); - return twoWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClient.java deleted file mode 100644 index 1e6ff84d0c1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClient.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.ServiceClientClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous ServiceClientClient type. - */ -@ServiceClient(builder = ServiceClientClientBuilder.class) -public final class ServiceClientClient { - @Generated - private final ServiceClientClientImpl serviceClient; - - /** - * Initializes an instance of ServiceClientClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ServiceClientClient(ServiceClientClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The one operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response oneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.oneWithResponse(requestOptions); - } - - /** - * The two operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response twoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.twoWithResponse(requestOptions); - } - - /** - * The one operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void one() { - // Generated convenience method for oneWithResponse - RequestOptions requestOptions = new RequestOptions(); - oneWithResponse(requestOptions).getValue(); - } - - /** - * The two operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void two() { - // Generated convenience method for twoWithResponse - RequestOptions requestOptions = new RequestOptions(); - twoWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClientBuilder.java deleted file mode 100644 index 9443d4bee18..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClientBuilder.java +++ /dev/null @@ -1,421 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service; - -import client.structure.service.implementation.ServiceClientClientImpl; -import client.structure.service.models.ClientType; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ServiceClientClient type. - */ -@ServiceClientBuilder( - serviceClients = { - ServiceClientClient.class, - BazFooClient.class, - QuxClient.class, - QuxBarClient.class, - FooClient.class, - BarClient.class, - ServiceClientAsyncClient.class, - BazFooAsyncClient.class, - QuxAsyncClient.class, - QuxBarAsyncClient.class, - FooAsyncClient.class, - BarAsyncClient.class }) -public final class ServiceClientClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("client-structure-service.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ServiceClientClientBuilder. - */ - @Generated - public ServiceClientClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ServiceClientClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ServiceClientClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ServiceClientClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ServiceClientClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ServiceClientClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ServiceClientClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ServiceClientClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ServiceClientClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - @Generated - private ClientType client; - - /** - * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @param client the client value. - * @return the ServiceClientClientBuilder. - */ - @Generated - public ServiceClientClientBuilder client(ClientType client) { - this.client = client; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ServiceClientClientBuilder. - */ - @Generated - public ServiceClientClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ServiceClientClientImpl with the provided parameters. - * - * @return an instance of ServiceClientClientImpl. - */ - @Generated - private ServiceClientClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - ServiceClientClientImpl client = new ServiceClientClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, this.client); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - Objects.requireNonNull(client, "'client' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ServiceClientAsyncClient class. - * - * @return an instance of ServiceClientAsyncClient. - */ - @Generated - public ServiceClientAsyncClient buildAsyncClient() { - return new ServiceClientAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of BazFooAsyncClient class. - * - * @return an instance of BazFooAsyncClient. - */ - @Generated - public BazFooAsyncClient buildBazFooAsyncClient() { - return new BazFooAsyncClient(buildInnerClient().getBazFoos()); - } - - /** - * Builds an instance of QuxAsyncClient class. - * - * @return an instance of QuxAsyncClient. - */ - @Generated - public QuxAsyncClient buildQuxAsyncClient() { - return new QuxAsyncClient(buildInnerClient().getQuxes()); - } - - /** - * Builds an instance of QuxBarAsyncClient class. - * - * @return an instance of QuxBarAsyncClient. - */ - @Generated - public QuxBarAsyncClient buildQuxBarAsyncClient() { - return new QuxBarAsyncClient(buildInnerClient().getQuxBars()); - } - - /** - * Builds an instance of FooAsyncClient class. - * - * @return an instance of FooAsyncClient. - */ - @Generated - public FooAsyncClient buildFooAsyncClient() { - return new FooAsyncClient(buildInnerClient().getFoos()); - } - - /** - * Builds an instance of BarAsyncClient class. - * - * @return an instance of BarAsyncClient. - */ - @Generated - public BarAsyncClient buildBarAsyncClient() { - return new BarAsyncClient(buildInnerClient().getBars()); - } - - /** - * Builds an instance of ServiceClientClient class. - * - * @return an instance of ServiceClientClient. - */ - @Generated - public ServiceClientClient buildClient() { - return new ServiceClientClient(buildInnerClient()); - } - - /** - * Builds an instance of BazFooClient class. - * - * @return an instance of BazFooClient. - */ - @Generated - public BazFooClient buildBazFooClient() { - return new BazFooClient(buildInnerClient().getBazFoos()); - } - - /** - * Builds an instance of QuxClient class. - * - * @return an instance of QuxClient. - */ - @Generated - public QuxClient buildQuxClient() { - return new QuxClient(buildInnerClient().getQuxes()); - } - - /** - * Builds an instance of QuxBarClient class. - * - * @return an instance of QuxBarClient. - */ - @Generated - public QuxBarClient buildQuxBarClient() { - return new QuxBarClient(buildInnerClient().getQuxBars()); - } - - /** - * Builds an instance of FooClient class. - * - * @return an instance of FooClient. - */ - @Generated - public FooClient buildFooClient() { - return new FooClient(buildInnerClient().getFoos()); - } - - /** - * Builds an instance of BarClient class. - * - * @return an instance of BarClient. - */ - @Generated - public BarClient buildBarClient() { - return new BarClient(buildInnerClient().getBars()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ServiceClientClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BarsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BarsImpl.java deleted file mode 100644 index 79134ef47fa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BarsImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Bars. - */ -public final class BarsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BarsService service; - - /** - * The service client containing this operation class. - */ - private final ServiceClientClientImpl client; - - /** - * Initializes an instance of BarsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BarsImpl(ServiceClientClientImpl client) { - this.service = RestProxy.create(BarsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ServiceClientClientBars to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "ServiceClientClientBars") - public interface BarsService { - @Post("/five") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> five(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/five") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fiveSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/six") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> six(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/six") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sixSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The five operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fiveWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.five(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The five operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fiveWithResponse(RequestOptions requestOptions) { - return service.fiveSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } - - /** - * The six operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sixWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.six(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The six operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sixWithResponse(RequestOptions requestOptions) { - return service.sixSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BazFoosImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BazFoosImpl.java deleted file mode 100644 index 977659af7f0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BazFoosImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in BazFoos. - */ -public final class BazFoosImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BazFoosService service; - - /** - * The service client containing this operation class. - */ - private final ServiceClientClientImpl client; - - /** - * Initializes an instance of BazFoosImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BazFoosImpl(ServiceClientClientImpl client) { - this.service = RestProxy.create(BazFoosService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ServiceClientClientBazFoos to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "ServiceClientClientBazFoos") - public interface BazFoosService { - @Post("/seven") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> seven(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/seven") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sevenSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The seven operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sevenWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.seven(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The seven operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sevenWithResponse(RequestOptions requestOptions) { - return service.sevenSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/FoosImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/FoosImpl.java deleted file mode 100644 index 504252d2074..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/FoosImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Foos. - */ -public final class FoosImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FoosService service; - - /** - * The service client containing this operation class. - */ - private final ServiceClientClientImpl client; - - /** - * Initializes an instance of FoosImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FoosImpl(ServiceClientClientImpl client) { - this.service = RestProxy.create(FoosService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ServiceClientClientFoos to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "ServiceClientClientFoos") - public interface FoosService { - @Post("/three") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> three(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/three") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response threeSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/four") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> four(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/four") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fourSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The three operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> threeWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.three(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The three operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response threeWithResponse(RequestOptions requestOptions) { - return service.threeSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } - - /** - * The four operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fourWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.four(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The four operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fourWithResponse(RequestOptions requestOptions) { - return service.fourSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxBarsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxBarsImpl.java deleted file mode 100644 index 635ded3f086..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxBarsImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in QuxBars. - */ -public final class QuxBarsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final QuxBarsService service; - - /** - * The service client containing this operation class. - */ - private final ServiceClientClientImpl client; - - /** - * Initializes an instance of QuxBarsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - QuxBarsImpl(ServiceClientClientImpl client) { - this.service = RestProxy.create(QuxBarsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ServiceClientClientQuxBars to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "ServiceClientClientQuxBars") - public interface QuxBarsService { - @Post("/nine") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> nine(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/nine") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response nineSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The nine operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> nineWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.nine(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The nine operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response nineWithResponse(RequestOptions requestOptions) { - return service.nineSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxesImpl.java deleted file mode 100644 index dbbad11c751..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxesImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Quxes. - */ -public final class QuxesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final QuxesService service; - - /** - * The service client containing this operation class. - */ - private final ServiceClientClientImpl client; - - /** - * Initializes an instance of QuxesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - QuxesImpl(ServiceClientClientImpl client) { - this.service = RestProxy.create(QuxesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ServiceClientClientQuxes to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "ServiceClientClientQuxes") - public interface QuxesService { - @Post("/eight") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> eight(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/eight") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response eightSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The eight operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> eightWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.eight(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The eight operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response eightWithResponse(RequestOptions requestOptions) { - return service.eightSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/ServiceClientClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/ServiceClientClientImpl.java deleted file mode 100644 index 9084229a968..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/ServiceClientClientImpl.java +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the ServiceClientClient type. - */ -public final class ServiceClientClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ServiceClientClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - private final ClientType client; - - /** - * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @return the client value. - */ - public ClientType getClient() { - return this.client; - } - - /** - * 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 BazFoosImpl object to access its operations. - */ - private final BazFoosImpl bazFoos; - - /** - * Gets the BazFoosImpl object to access its operations. - * - * @return the BazFoosImpl object. - */ - public BazFoosImpl getBazFoos() { - return this.bazFoos; - } - - /** - * The QuxesImpl object to access its operations. - */ - private final QuxesImpl quxes; - - /** - * Gets the QuxesImpl object to access its operations. - * - * @return the QuxesImpl object. - */ - public QuxesImpl getQuxes() { - return this.quxes; - } - - /** - * The QuxBarsImpl object to access its operations. - */ - private final QuxBarsImpl quxBars; - - /** - * Gets the QuxBarsImpl object to access its operations. - * - * @return the QuxBarsImpl object. - */ - public QuxBarsImpl getQuxBars() { - return this.quxBars; - } - - /** - * The FoosImpl object to access its operations. - */ - private final FoosImpl foos; - - /** - * Gets the FoosImpl object to access its operations. - * - * @return the FoosImpl object. - */ - public FoosImpl getFoos() { - return this.foos; - } - - /** - * The BarsImpl object to access its operations. - */ - private final BarsImpl bars; - - /** - * Gets the BarsImpl object to access its operations. - * - * @return the BarsImpl object. - */ - public BarsImpl getBars() { - return this.bars; - } - - /** - * Initializes an instance of ServiceClientClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public ServiceClientClientImpl(String endpoint, ClientType client) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of ServiceClientClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public ServiceClientClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of ServiceClientClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public ServiceClientClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - ClientType client) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.client = client; - this.bazFoos = new BazFoosImpl(this); - this.quxes = new QuxesImpl(this); - this.quxBars = new QuxBarsImpl(this); - this.foos = new FoosImpl(this); - this.bars = new BarsImpl(this); - this.service - = RestProxy.create(ServiceClientClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ServiceClientClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "ServiceClientClient") - public interface ServiceClientClientService { - @Post("/one") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> one(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/one") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response oneSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/two") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> two(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/two") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response twoSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The one operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> oneWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.one(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The one operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response oneWithResponse(RequestOptions requestOptions) { - return service.oneSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } - - /** - * The two operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> twoWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.two(this.getEndpoint(), this.getClient(), requestOptions, context)); - } - - /** - * The two operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response twoWithResponse(RequestOptions requestOptions) { - return service.twoSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/package-info.java deleted file mode 100644 index c7595374ac3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Service. - * Test that we can use @client and @operationGroup decorators to customize client side code structure, such - * as: - * 1. have everything as default. - * 2. to rename client or operation group - * 3. one client can have more than one operations groups - * 4. split one interface into two clients - * 5. have two clients with operations come from different interfaces - * 6. have two clients with a hierarchy relation. - * - */ -package client.structure.service.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/ClientType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/ClientType.java deleted file mode 100644 index 81bc9c8ad88..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/ClientType.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service.models; - -/** - * Defines values for ClientType. - */ -public enum ClientType { - /** - * Enum value default. - */ - DEFAULT("default"), - - /** - * Enum value multi-client. - */ - MULTI_CLIENT("multi-client"), - - /** - * Enum value renamed-operation. - */ - RENAMED_OPERATION("renamed-operation"), - - /** - * Enum value two-operation-group. - */ - TWO_OPERATION_GROUP("two-operation-group"), - - /** - * Enum value client-operation-group. - */ - CLIENT_OPERATION_GROUP("client-operation-group"); - - /** - * The actual serialized value for a ClientType instance. - */ - private final String value; - - ClientType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a ClientType instance. - * - * @param value the serialized value to parse. - * @return the parsed ClientType object, or null if unable to parse. - */ - public static ClientType fromString(String value) { - if (value == null) { - return null; - } - ClientType[] items = ClientType.values(); - for (ClientType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/package-info.java deleted file mode 100644 index 39f210ff84a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Service. - * Test that we can use @client and @operationGroup decorators to customize client side code structure, such - * as: - * 1. have everything as default. - * 2. to rename client or operation group - * 3. one client can have more than one operations groups - * 4. split one interface into two clients - * 5. have two clients with operations come from different interfaces - * 6. have two clients with a hierarchy relation. - * - */ -package client.structure.service.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/package-info.java deleted file mode 100644 index 8f70f1bf5d8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Service. - * Test that we can use @client and @operationGroup decorators to customize client side code structure, such - * as: - * 1. have everything as default. - * 2. to rename client or operation group - * 3. one client can have more than one operations groups - * 4. split one interface into two clients - * 5. have two clients with operations come from different interfaces - * 6. have two clients with a hierarchy relation. - * - */ -package client.structure.service; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1AsyncClient.java deleted file mode 100644 index 9f112a22b4b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1AsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.twooperationgroup; - -import client.structure.twooperationgroup.implementation.Group1sImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous TwoOperationGroupClient type. - */ -@ServiceClient(builder = TwoOperationGroupClientBuilder.class, isAsync = true) -public final class Group1AsyncClient { - @Generated - private final Group1sImpl serviceClient; - - /** - * Initializes an instance of Group1AsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Group1AsyncClient(Group1sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The one operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> oneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.oneWithResponseAsync(requestOptions); - } - - /** - * The three operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> threeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.threeWithResponseAsync(requestOptions); - } - - /** - * The four operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fourWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fourWithResponseAsync(requestOptions); - } - - /** - * The one operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono one() { - // Generated convenience method for oneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return oneWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The three operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono three() { - // Generated convenience method for threeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return threeWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The four operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono four() { - // Generated convenience method for fourWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fourWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1Client.java deleted file mode 100644 index e0fa961bf6f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1Client.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.twooperationgroup; - -import client.structure.twooperationgroup.implementation.Group1sImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous TwoOperationGroupClient type. - */ -@ServiceClient(builder = TwoOperationGroupClientBuilder.class) -public final class Group1Client { - @Generated - private final Group1sImpl serviceClient; - - /** - * Initializes an instance of Group1Client class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Group1Client(Group1sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The one operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response oneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.oneWithResponse(requestOptions); - } - - /** - * The three operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response threeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.threeWithResponse(requestOptions); - } - - /** - * The four operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fourWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fourWithResponse(requestOptions); - } - - /** - * The one operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void one() { - // Generated convenience method for oneWithResponse - RequestOptions requestOptions = new RequestOptions(); - oneWithResponse(requestOptions).getValue(); - } - - /** - * The three operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void three() { - // Generated convenience method for threeWithResponse - RequestOptions requestOptions = new RequestOptions(); - threeWithResponse(requestOptions).getValue(); - } - - /** - * The four operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void four() { - // Generated convenience method for fourWithResponse - RequestOptions requestOptions = new RequestOptions(); - fourWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2AsyncClient.java deleted file mode 100644 index 7e85b1c96c9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2AsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.twooperationgroup; - -import client.structure.twooperationgroup.implementation.Group2sImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous TwoOperationGroupClient type. - */ -@ServiceClient(builder = TwoOperationGroupClientBuilder.class, isAsync = true) -public final class Group2AsyncClient { - @Generated - private final Group2sImpl serviceClient; - - /** - * Initializes an instance of Group2AsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Group2AsyncClient(Group2sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The two operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> twoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.twoWithResponseAsync(requestOptions); - } - - /** - * The five operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fiveWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fiveWithResponseAsync(requestOptions); - } - - /** - * The six operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sixWithResponse(RequestOptions requestOptions) { - return this.serviceClient.sixWithResponseAsync(requestOptions); - } - - /** - * The two operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono two() { - // Generated convenience method for twoWithResponse - RequestOptions requestOptions = new RequestOptions(); - return twoWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The five operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono five() { - // Generated convenience method for fiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fiveWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The six operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono six() { - // Generated convenience method for sixWithResponse - RequestOptions requestOptions = new RequestOptions(); - return sixWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2Client.java deleted file mode 100644 index fada175ec71..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2Client.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.twooperationgroup; - -import client.structure.twooperationgroup.implementation.Group2sImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; - -/** - * Initializes a new instance of the synchronous TwoOperationGroupClient type. - */ -@ServiceClient(builder = TwoOperationGroupClientBuilder.class) -public final class Group2Client { - @Generated - private final Group2sImpl serviceClient; - - /** - * Initializes an instance of Group2Client class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Group2Client(Group2sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The two operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response twoWithResponse(RequestOptions requestOptions) { - return this.serviceClient.twoWithResponse(requestOptions); - } - - /** - * The five operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fiveWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fiveWithResponse(requestOptions); - } - - /** - * The six operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sixWithResponse(RequestOptions requestOptions) { - return this.serviceClient.sixWithResponse(requestOptions); - } - - /** - * The two operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void two() { - // Generated convenience method for twoWithResponse - RequestOptions requestOptions = new RequestOptions(); - twoWithResponse(requestOptions).getValue(); - } - - /** - * The five operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void five() { - // Generated convenience method for fiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - fiveWithResponse(requestOptions).getValue(); - } - - /** - * The six operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void six() { - // Generated convenience method for sixWithResponse - RequestOptions requestOptions = new RequestOptions(); - sixWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/TwoOperationGroupClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/TwoOperationGroupClientBuilder.java deleted file mode 100644 index 26468e7b9da..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/TwoOperationGroupClientBuilder.java +++ /dev/null @@ -1,329 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.twooperationgroup; - -import client.structure.service.models.ClientType; -import client.structure.twooperationgroup.implementation.TwoOperationGroupClientImpl; -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the TwoOperationGroupClient type. - */ -@ServiceClientBuilder( - serviceClients = { Group1Client.class, Group2Client.class, Group1AsyncClient.class, Group2AsyncClient.class }) -public final class TwoOperationGroupClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("client-structure-twooperationgroup.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the TwoOperationGroupClientBuilder. - */ - @Generated - public TwoOperationGroupClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TwoOperationGroupClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TwoOperationGroupClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TwoOperationGroupClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TwoOperationGroupClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TwoOperationGroupClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TwoOperationGroupClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TwoOperationGroupClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TwoOperationGroupClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - @Generated - private ClientType client; - - /** - * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @param client the client value. - * @return the TwoOperationGroupClientBuilder. - */ - @Generated - public TwoOperationGroupClientBuilder client(ClientType client) { - this.client = client; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the TwoOperationGroupClientBuilder. - */ - @Generated - public TwoOperationGroupClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of TwoOperationGroupClientImpl with the provided parameters. - * - * @return an instance of TwoOperationGroupClientImpl. - */ - @Generated - private TwoOperationGroupClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - TwoOperationGroupClientImpl client = new TwoOperationGroupClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, this.client); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - Objects.requireNonNull(client, "'client' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of Group1AsyncClient class. - * - * @return an instance of Group1AsyncClient. - */ - @Generated - public Group1AsyncClient buildGroup1AsyncClient() { - return new Group1AsyncClient(buildInnerClient().getGroup1s()); - } - - /** - * Builds an instance of Group2AsyncClient class. - * - * @return an instance of Group2AsyncClient. - */ - @Generated - public Group2AsyncClient buildGroup2AsyncClient() { - return new Group2AsyncClient(buildInnerClient().getGroup2s()); - } - - /** - * Builds an instance of Group1Client class. - * - * @return an instance of Group1Client. - */ - @Generated - public Group1Client buildGroup1Client() { - return new Group1Client(buildInnerClient().getGroup1s()); - } - - /** - * Builds an instance of Group2Client class. - * - * @return an instance of Group2Client. - */ - @Generated - public Group2Client buildGroup2Client() { - return new Group2Client(buildInnerClient().getGroup2s()); - } - - private static final ClientLogger LOGGER = new ClientLogger(TwoOperationGroupClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group1sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group1sImpl.java deleted file mode 100644 index 7c9ae5b79ae..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group1sImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.twooperationgroup.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Group1s. - */ -public final class Group1sImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Group1sService service; - - /** - * The service client containing this operation class. - */ - private final TwoOperationGroupClientImpl client; - - /** - * Initializes an instance of Group1sImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Group1sImpl(TwoOperationGroupClientImpl client) { - this.service = RestProxy.create(Group1sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for TwoOperationGroupClientGroup1s to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "TwoOperationGroupClientGroup1s") - public interface Group1sService { - @Post("/one") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> one(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/one") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response oneSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/three") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> three(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/three") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response threeSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/four") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> four(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/four") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fourSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The one operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> oneWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.one(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The one operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response oneWithResponse(RequestOptions requestOptions) { - return service.oneSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } - - /** - * The three operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> threeWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.three(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The three operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response threeWithResponse(RequestOptions requestOptions) { - return service.threeSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } - - /** - * The four operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fourWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.four(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The four operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fourWithResponse(RequestOptions requestOptions) { - return service.fourSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group2sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group2sImpl.java deleted file mode 100644 index 210b49378d4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group2sImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.twooperationgroup.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Group2s. - */ -public final class Group2sImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Group2sService service; - - /** - * The service client containing this operation class. - */ - private final TwoOperationGroupClientImpl client; - - /** - * Initializes an instance of Group2sImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Group2sImpl(TwoOperationGroupClientImpl client) { - this.service = RestProxy.create(Group2sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for TwoOperationGroupClientGroup2s to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}/client/structure/{client}") - @ServiceInterface(name = "TwoOperationGroupClientGroup2s") - public interface Group2sService { - @Post("/two") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> two(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/two") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response twoSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/five") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> five(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/five") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fiveSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/six") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> six(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - - @Post("/six") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sixSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, - RequestOptions requestOptions, Context context); - } - - /** - * The two operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> twoWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.two(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The two operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response twoWithResponse(RequestOptions requestOptions) { - return service.twoSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } - - /** - * The five operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fiveWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.five(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The five operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fiveWithResponse(RequestOptions requestOptions) { - return service.fiveSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } - - /** - * The six operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sixWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.six(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); - } - - /** - * The six operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sixWithResponse(RequestOptions requestOptions) { - return service.sixSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/TwoOperationGroupClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/TwoOperationGroupClientImpl.java deleted file mode 100644 index 3fd9b54985c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/TwoOperationGroupClientImpl.java +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.twooperationgroup.implementation; - -import client.structure.service.models.ClientType; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 TwoOperationGroupClient type. - */ -public final class TwoOperationGroupClientImpl { - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - private final ClientType client; - - /** - * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - * - * @return the client value. - */ - public ClientType getClient() { - return this.client; - } - - /** - * 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 Group1sImpl object to access its operations. - */ - private final Group1sImpl group1s; - - /** - * Gets the Group1sImpl object to access its operations. - * - * @return the Group1sImpl object. - */ - public Group1sImpl getGroup1s() { - return this.group1s; - } - - /** - * The Group2sImpl object to access its operations. - */ - private final Group2sImpl group2s; - - /** - * Gets the Group2sImpl object to access its operations. - * - * @return the Group2sImpl object. - */ - public Group2sImpl getGroup2s() { - return this.group2s; - } - - /** - * Initializes an instance of TwoOperationGroupClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public TwoOperationGroupClientImpl(String endpoint, ClientType client) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of TwoOperationGroupClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public TwoOperationGroupClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); - } - - /** - * Initializes an instance of TwoOperationGroupClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. - */ - public TwoOperationGroupClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - ClientType client) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.client = client; - this.group1s = new Group1sImpl(this); - this.group2s = new Group2sImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/package-info.java deleted file mode 100644 index 799b292b9dd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Service. - * Test that we can use @client and @operationGroup decorators to customize client side code structure, such - * as: - * 1. have everything as default. - * 2. to rename client or operation group - * 3. one client can have more than one operations groups - * 4. split one interface into two clients - * 5. have two clients with operations come from different interfaces - * 6. have two clients with a hierarchy relation. - * - */ -package client.structure.twooperationgroup.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/package-info.java deleted file mode 100644 index e3d68ebcf75..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Service. - * Test that we can use @client and @operationGroup decorators to customize client side code structure, such - * as: - * 1. have everything as default. - * 2. to rename client or operation group - * 3. one client can have more than one operations groups - * 4. split one interface into two clients - * 5. have two clients with operations come from different interfaces - * 6. have two clients with a hierarchy relation. - * - */ -package client.structure.twooperationgroup; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/DocumentationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/DocumentationClientBuilder.java deleted file mode 100644 index 66fcf8f2936..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/DocumentationClientBuilder.java +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package documentation; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import documentation.implementation.DocumentationClientImpl; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the DocumentationClient type. - */ -@ServiceClientBuilder( - serviceClients = { - ListsClient.class, - TextFormattingClient.class, - ListsAsyncClient.class, - TextFormattingAsyncClient.class }) -public final class DocumentationClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("documentation.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the DocumentationClientBuilder. - */ - @Generated - public DocumentationClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DocumentationClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DocumentationClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DocumentationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DocumentationClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DocumentationClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DocumentationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DocumentationClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DocumentationClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the DocumentationClientBuilder. - */ - @Generated - public DocumentationClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of DocumentationClientImpl with the provided parameters. - * - * @return an instance of DocumentationClientImpl. - */ - @Generated - private DocumentationClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - DocumentationClientImpl client = new DocumentationClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ListsAsyncClient class. - * - * @return an instance of ListsAsyncClient. - */ - @Generated - public ListsAsyncClient buildListsAsyncClient() { - return new ListsAsyncClient(buildInnerClient().getLists()); - } - - /** - * Builds an instance of TextFormattingAsyncClient class. - * - * @return an instance of TextFormattingAsyncClient. - */ - @Generated - public TextFormattingAsyncClient buildTextFormattingAsyncClient() { - return new TextFormattingAsyncClient(buildInnerClient().getTextFormattings()); - } - - /** - * Builds an instance of ListsClient class. - * - * @return an instance of ListsClient. - */ - @Generated - public ListsClient buildListsClient() { - return new ListsClient(buildInnerClient().getLists()); - } - - /** - * Builds an instance of TextFormattingClient class. - * - * @return an instance of TextFormattingClient. - */ - @Generated - public TextFormattingClient buildTextFormattingClient() { - return new TextFormattingClient(buildInnerClient().getTextFormattings()); - } - - private static final ClientLogger LOGGER = new ClientLogger(DocumentationClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsAsyncClient.java deleted file mode 100644 index 9be33080835..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsAsyncClient.java +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package documentation; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import documentation.implementation.ListsImpl; -import documentation.lists.implementation.models.BulletPointsModelRequest; -import documentation.lists.models.BulletPointsModel; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous DocumentationClient type. - */ -@ServiceClient(builder = DocumentationClientBuilder.class, isAsync = true) -public final class ListsAsyncClient { - @Generated - private final ListsImpl serviceClient; - - /** - * Initializes an instance of ListsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ListsAsyncClient(ListsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * This tests: - * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet - * points within documentation comments. It should properly indent the wrapped lines. - * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting - * is preserved when the text wraps onto multiple lines in the generated documentation. - * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the - * wrapping and formatting are correctly applied in the output. - * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic - * formatting and is long enough to test the wrapping behavior in such cases. - * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how - * the bold formatting is maintained across wrapped lines. - * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that - * italic formatting is correctly applied even when the text spans multiple lines. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> bulletPointsOpWithResponse(RequestOptions requestOptions) { - return this.serviceClient.bulletPointsOpWithResponseAsync(requestOptions); - } - - /** - * The bulletPointsModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     input (Required): {
-     *         prop: String(Simple/Bold/Italic) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param bulletPointsModelRequest The bulletPointsModelRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> bulletPointsModelWithResponse(BinaryData bulletPointsModelRequest, - RequestOptions requestOptions) { - return this.serviceClient.bulletPointsModelWithResponseAsync(bulletPointsModelRequest, requestOptions); - } - - /** - * Steps to follow: - * 1. First step with **important** note - * 2. Second step with *emphasis* - * 3. Third step combining **bold** and *italic* - * 4. **Final step**: Review all steps for *accuracy*. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> numberedWithResponse(RequestOptions requestOptions) { - return this.serviceClient.numberedWithResponseAsync(requestOptions); - } - - /** - * This tests: - * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet - * points within documentation comments. It should properly indent the wrapped lines. - * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting - * is preserved when the text wraps onto multiple lines in the generated documentation. - * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the - * wrapping and formatting are correctly applied in the output. - * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic - * formatting and is long enough to test the wrapping behavior in such cases. - * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how - * the bold formatting is maintained across wrapped lines. - * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that - * italic formatting is correctly applied even when the text spans multiple lines. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono bulletPointsOp() { - // Generated convenience method for bulletPointsOpWithResponse - RequestOptions requestOptions = new RequestOptions(); - return bulletPointsOpWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The bulletPointsModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono bulletPointsModel(BulletPointsModel input) { - // Generated convenience method for bulletPointsModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - BulletPointsModelRequest bulletPointsModelRequestObj = new BulletPointsModelRequest(input); - BinaryData bulletPointsModelRequest = BinaryData.fromObject(bulletPointsModelRequestObj); - return bulletPointsModelWithResponse(bulletPointsModelRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Steps to follow: - * 1. First step with **important** note - * 2. Second step with *emphasis* - * 3. Third step combining **bold** and *italic* - * 4. **Final step**: Review all steps for *accuracy*. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono numbered() { - // Generated convenience method for numberedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return numberedWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsClient.java deleted file mode 100644 index 8d609982a08..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsClient.java +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package documentation; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import documentation.implementation.ListsImpl; -import documentation.lists.implementation.models.BulletPointsModelRequest; -import documentation.lists.models.BulletPointsModel; - -/** - * Initializes a new instance of the synchronous DocumentationClient type. - */ -@ServiceClient(builder = DocumentationClientBuilder.class) -public final class ListsClient { - @Generated - private final ListsImpl serviceClient; - - /** - * Initializes an instance of ListsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ListsClient(ListsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * This tests: - * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet - * points within documentation comments. It should properly indent the wrapped lines. - * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting - * is preserved when the text wraps onto multiple lines in the generated documentation. - * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the - * wrapping and formatting are correctly applied in the output. - * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic - * formatting and is long enough to test the wrapping behavior in such cases. - * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how - * the bold formatting is maintained across wrapped lines. - * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that - * italic formatting is correctly applied even when the text spans multiple lines. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response bulletPointsOpWithResponse(RequestOptions requestOptions) { - return this.serviceClient.bulletPointsOpWithResponse(requestOptions); - } - - /** - * The bulletPointsModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     input (Required): {
-     *         prop: String(Simple/Bold/Italic) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param bulletPointsModelRequest The bulletPointsModelRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response bulletPointsModelWithResponse(BinaryData bulletPointsModelRequest, - RequestOptions requestOptions) { - return this.serviceClient.bulletPointsModelWithResponse(bulletPointsModelRequest, requestOptions); - } - - /** - * Steps to follow: - * 1. First step with **important** note - * 2. Second step with *emphasis* - * 3. Third step combining **bold** and *italic* - * 4. **Final step**: Review all steps for *accuracy*. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response numberedWithResponse(RequestOptions requestOptions) { - return this.serviceClient.numberedWithResponse(requestOptions); - } - - /** - * This tests: - * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet - * points within documentation comments. It should properly indent the wrapped lines. - * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting - * is preserved when the text wraps onto multiple lines in the generated documentation. - * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the - * wrapping and formatting are correctly applied in the output. - * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic - * formatting and is long enough to test the wrapping behavior in such cases. - * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how - * the bold formatting is maintained across wrapped lines. - * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that - * italic formatting is correctly applied even when the text spans multiple lines. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void bulletPointsOp() { - // Generated convenience method for bulletPointsOpWithResponse - RequestOptions requestOptions = new RequestOptions(); - bulletPointsOpWithResponse(requestOptions).getValue(); - } - - /** - * The bulletPointsModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void bulletPointsModel(BulletPointsModel input) { - // Generated convenience method for bulletPointsModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - BulletPointsModelRequest bulletPointsModelRequestObj = new BulletPointsModelRequest(input); - BinaryData bulletPointsModelRequest = BinaryData.fromObject(bulletPointsModelRequestObj); - bulletPointsModelWithResponse(bulletPointsModelRequest, requestOptions).getValue(); - } - - /** - * Steps to follow: - * 1. First step with **important** note - * 2. Second step with *emphasis* - * 3. Third step combining **bold** and *italic* - * 4. **Final step**: Review all steps for *accuracy*. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void numbered() { - // Generated convenience method for numberedWithResponse - RequestOptions requestOptions = new RequestOptions(); - numberedWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingAsyncClient.java deleted file mode 100644 index 333f94325bd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingAsyncClient.java +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package documentation; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import documentation.implementation.TextFormattingsImpl; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous DocumentationClient type. - */ -@ServiceClient(builder = DocumentationClientBuilder.class, isAsync = true) -public final class TextFormattingAsyncClient { - @Generated - private final TextFormattingsImpl serviceClient; - - /** - * Initializes an instance of TextFormattingAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - TextFormattingAsyncClient(TextFormattingsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * This is **bold text** in the middle of a sentence. - * This is a sentence with **multiple bold** sections and **another bold** section. - * **This entire sentence is bold.**. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> boldTextWithResponse(RequestOptions requestOptions) { - return this.serviceClient.boldTextWithResponseAsync(requestOptions); - } - - /** - * This is *italic text* in the middle of a sentence. - * This is a sentence with *multiple italic* sections and *another italic* section. - * *This entire sentence is italic.*. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> italicTextWithResponse(RequestOptions requestOptions) { - return this.serviceClient.italicTextWithResponseAsync(requestOptions); - } - - /** - * This sentence has **bold**, *italic*, and ***bold italic*** text. - * You can also combine them like **bold with *italic inside* bold**. - * Or *italic with **bold inside** italic*. - * This is a sentence with **bold**, *italic*, and ***bold italic*** text. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> combinedFormattingWithResponse(RequestOptions requestOptions) { - return this.serviceClient.combinedFormattingWithResponseAsync(requestOptions); - } - - /** - * This is **bold text** in the middle of a sentence. - * This is a sentence with **multiple bold** sections and **another bold** section. - * **This entire sentence is bold.**. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono boldText() { - // Generated convenience method for boldTextWithResponse - RequestOptions requestOptions = new RequestOptions(); - return boldTextWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * This is *italic text* in the middle of a sentence. - * This is a sentence with *multiple italic* sections and *another italic* section. - * *This entire sentence is italic.*. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono italicText() { - // Generated convenience method for italicTextWithResponse - RequestOptions requestOptions = new RequestOptions(); - return italicTextWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * This sentence has **bold**, *italic*, and ***bold italic*** text. - * You can also combine them like **bold with *italic inside* bold**. - * Or *italic with **bold inside** italic*. - * This is a sentence with **bold**, *italic*, and ***bold italic*** text. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono combinedFormatting() { - // Generated convenience method for combinedFormattingWithResponse - RequestOptions requestOptions = new RequestOptions(); - return combinedFormattingWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingClient.java deleted file mode 100644 index da0f8a3fbf6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingClient.java +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package documentation; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import documentation.implementation.TextFormattingsImpl; - -/** - * Initializes a new instance of the synchronous DocumentationClient type. - */ -@ServiceClient(builder = DocumentationClientBuilder.class) -public final class TextFormattingClient { - @Generated - private final TextFormattingsImpl serviceClient; - - /** - * Initializes an instance of TextFormattingClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - TextFormattingClient(TextFormattingsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * This is **bold text** in the middle of a sentence. - * This is a sentence with **multiple bold** sections and **another bold** section. - * **This entire sentence is bold.**. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response boldTextWithResponse(RequestOptions requestOptions) { - return this.serviceClient.boldTextWithResponse(requestOptions); - } - - /** - * This is *italic text* in the middle of a sentence. - * This is a sentence with *multiple italic* sections and *another italic* section. - * *This entire sentence is italic.*. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response italicTextWithResponse(RequestOptions requestOptions) { - return this.serviceClient.italicTextWithResponse(requestOptions); - } - - /** - * This sentence has **bold**, *italic*, and ***bold italic*** text. - * You can also combine them like **bold with *italic inside* bold**. - * Or *italic with **bold inside** italic*. - * This is a sentence with **bold**, *italic*, and ***bold italic*** text. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response combinedFormattingWithResponse(RequestOptions requestOptions) { - return this.serviceClient.combinedFormattingWithResponse(requestOptions); - } - - /** - * This is **bold text** in the middle of a sentence. - * This is a sentence with **multiple bold** sections and **another bold** section. - * **This entire sentence is bold.**. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void boldText() { - // Generated convenience method for boldTextWithResponse - RequestOptions requestOptions = new RequestOptions(); - boldTextWithResponse(requestOptions).getValue(); - } - - /** - * This is *italic text* in the middle of a sentence. - * This is a sentence with *multiple italic* sections and *another italic* section. - * *This entire sentence is italic.*. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void italicText() { - // Generated convenience method for italicTextWithResponse - RequestOptions requestOptions = new RequestOptions(); - italicTextWithResponse(requestOptions).getValue(); - } - - /** - * This sentence has **bold**, *italic*, and ***bold italic*** text. - * You can also combine them like **bold with *italic inside* bold**. - * Or *italic with **bold inside** italic*. - * This is a sentence with **bold**, *italic*, and ***bold italic*** text. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void combinedFormatting() { - // Generated convenience method for combinedFormattingWithResponse - RequestOptions requestOptions = new RequestOptions(); - combinedFormattingWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/DocumentationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/DocumentationClientImpl.java deleted file mode 100644 index e856209854a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/DocumentationClientImpl.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package documentation.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 DocumentationClient type. - */ -public final class DocumentationClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 ListsImpl object to access its operations. - */ - private final ListsImpl lists; - - /** - * Gets the ListsImpl object to access its operations. - * - * @return the ListsImpl object. - */ - public ListsImpl getLists() { - return this.lists; - } - - /** - * The TextFormattingsImpl object to access its operations. - */ - private final TextFormattingsImpl textFormattings; - - /** - * Gets the TextFormattingsImpl object to access its operations. - * - * @return the TextFormattingsImpl object. - */ - public TextFormattingsImpl getTextFormattings() { - return this.textFormattings; - } - - /** - * Initializes an instance of DocumentationClient client. - * - * @param endpoint Service host. - */ - public DocumentationClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DocumentationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public DocumentationClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DocumentationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public DocumentationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.lists = new ListsImpl(this); - this.textFormattings = new TextFormattingsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/ListsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/ListsImpl.java deleted file mode 100644 index 300720a0e38..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/ListsImpl.java +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package documentation.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Lists. - */ -public final class ListsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ListsService service; - - /** - * The service client containing this operation class. - */ - private final DocumentationClientImpl client; - - /** - * Initializes an instance of ListsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ListsImpl(DocumentationClientImpl client) { - this.service = RestProxy.create(ListsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DocumentationClientLists to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DocumentationClientLists") - public interface ListsService { - @Get("/documentation/lists/bullet-points/op") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> bulletPointsOp(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/documentation/lists/bullet-points/op") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response bulletPointsOpSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Post("/documentation/lists/bullet-points/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> bulletPointsModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData bulletPointsModelRequest, RequestOptions requestOptions, - Context context); - - @Post("/documentation/lists/bullet-points/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response bulletPointsModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData bulletPointsModelRequest, RequestOptions requestOptions, - Context context); - - @Get("/documentation/lists/numbered") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> numbered(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/documentation/lists/numbered") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response numberedSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * This tests: - * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet - * points within documentation comments. It should properly indent the wrapped lines. - * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting - * is preserved when the text wraps onto multiple lines in the generated documentation. - * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the - * wrapping and formatting are correctly applied in the output. - * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic - * formatting and is long enough to test the wrapping behavior in such cases. - * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how - * the bold formatting is maintained across wrapped lines. - * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that - * italic formatting is correctly applied even when the text spans multiple lines. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> bulletPointsOpWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.bulletPointsOp(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * This tests: - * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet - * points within documentation comments. It should properly indent the wrapped lines. - * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting - * is preserved when the text wraps onto multiple lines in the generated documentation. - * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the - * wrapping and formatting are correctly applied in the output. - * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic - * formatting and is long enough to test the wrapping behavior in such cases. - * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how - * the bold formatting is maintained across wrapped lines. - * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that - * italic formatting is correctly applied even when the text spans multiple lines. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response bulletPointsOpWithResponse(RequestOptions requestOptions) { - return service.bulletPointsOpSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The bulletPointsModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     input (Required): {
-     *         prop: String(Simple/Bold/Italic) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param bulletPointsModelRequest The bulletPointsModelRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> bulletPointsModelWithResponseAsync(BinaryData bulletPointsModelRequest, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.bulletPointsModel(this.client.getEndpoint(), contentType, - bulletPointsModelRequest, requestOptions, context)); - } - - /** - * The bulletPointsModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     input (Required): {
-     *         prop: String(Simple/Bold/Italic) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param bulletPointsModelRequest The bulletPointsModelRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response bulletPointsModelWithResponse(BinaryData bulletPointsModelRequest, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.bulletPointsModelSync(this.client.getEndpoint(), contentType, bulletPointsModelRequest, - requestOptions, Context.NONE); - } - - /** - * Steps to follow: - * 1. First step with **important** note - * 2. Second step with *emphasis* - * 3. Third step combining **bold** and *italic* - * 4. **Final step**: Review all steps for *accuracy*. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> numberedWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.numbered(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * Steps to follow: - * 1. First step with **important** note - * 2. Second step with *emphasis* - * 3. Third step combining **bold** and *italic* - * 4. **Final step**: Review all steps for *accuracy*. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response numberedWithResponse(RequestOptions requestOptions) { - return service.numberedSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/TextFormattingsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/TextFormattingsImpl.java deleted file mode 100644 index 714c5ca8436..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/TextFormattingsImpl.java +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package documentation.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in TextFormattings. - */ -public final class TextFormattingsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final TextFormattingsService service; - - /** - * The service client containing this operation class. - */ - private final DocumentationClientImpl client; - - /** - * Initializes an instance of TextFormattingsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - TextFormattingsImpl(DocumentationClientImpl client) { - this.service - = RestProxy.create(TextFormattingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DocumentationClientTextFormattings to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DocumentationClientTextFormattings") - public interface TextFormattingsService { - @Get("/documentation/text-formatting/bold") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> boldText(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/documentation/text-formatting/bold") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response boldTextSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/documentation/text-formatting/italic") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> italicText(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/documentation/text-formatting/italic") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response italicTextSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/documentation/text-formatting/combined") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> combinedFormatting(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/documentation/text-formatting/combined") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response combinedFormattingSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * This is **bold text** in the middle of a sentence. - * This is a sentence with **multiple bold** sections and **another bold** section. - * **This entire sentence is bold.**. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> boldTextWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.boldText(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * This is **bold text** in the middle of a sentence. - * This is a sentence with **multiple bold** sections and **another bold** section. - * **This entire sentence is bold.**. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response boldTextWithResponse(RequestOptions requestOptions) { - return service.boldTextSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * This is *italic text* in the middle of a sentence. - * This is a sentence with *multiple italic* sections and *another italic* section. - * *This entire sentence is italic.*. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> italicTextWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.italicText(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * This is *italic text* in the middle of a sentence. - * This is a sentence with *multiple italic* sections and *another italic* section. - * *This entire sentence is italic.*. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response italicTextWithResponse(RequestOptions requestOptions) { - return service.italicTextSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * This sentence has **bold**, *italic*, and ***bold italic*** text. - * You can also combine them like **bold with *italic inside* bold**. - * Or *italic with **bold inside** italic*. - * This is a sentence with **bold**, *italic*, and ***bold italic*** text. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> combinedFormattingWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.combinedFormatting(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * This sentence has **bold**, *italic*, and ***bold italic*** text. - * You can also combine them like **bold with *italic inside* bold**. - * Or *italic with **bold inside** italic*. - * This is a sentence with **bold**, *italic*, and ***bold italic*** text. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response combinedFormattingWithResponse(RequestOptions requestOptions) { - return service.combinedFormattingSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/package-info.java deleted file mode 100644 index cf5c015aeea..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Documentation. - * Illustrates documentation generation and formatting features. - * - */ -package documentation.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/BulletPointsModelRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/BulletPointsModelRequest.java deleted file mode 100644 index 33c31b8319a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/BulletPointsModelRequest.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package documentation.lists.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import documentation.lists.models.BulletPointsModel; -import java.io.IOException; - -/** - * The BulletPointsModelRequest model. - */ -@Immutable -public final class BulletPointsModelRequest implements JsonSerializable { - /* - * The input property. - */ - @Generated - private final BulletPointsModel input; - - /** - * Creates an instance of BulletPointsModelRequest class. - * - * @param input the input value to set. - */ - @Generated - public BulletPointsModelRequest(BulletPointsModel input) { - this.input = input; - } - - /** - * Get the input property: The input property. - * - * @return the input value. - */ - @Generated - public BulletPointsModel getInput() { - return this.input; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("input", this.input); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BulletPointsModelRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BulletPointsModelRequest if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BulletPointsModelRequest. - */ - @Generated - public static BulletPointsModelRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BulletPointsModel input = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("input".equals(fieldName)) { - input = BulletPointsModel.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new BulletPointsModelRequest(input); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/package-info.java deleted file mode 100644 index 14161731cbc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Documentation. - * Illustrates documentation generation and formatting features. - * - */ -package documentation.lists.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsEnum.java deleted file mode 100644 index cc5f71d6248..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsEnum.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package documentation.lists.models; - -/** - * This tests really long bullet points in enum documentation to see how wrapping and formatting are handled. This - * should wrap around correctly and maintain proper indentation for each line. - * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet - * points within documentation comments. It should properly indent the wrapped lines. - * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is - * preserved when the text wraps onto multiple lines in the generated documentation. - * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the - * wrapping and formatting are correctly applied in the output. - * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic - * formatting and is long enough to test the wrapping behavior in such cases. - * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how the - * bold formatting is maintained across wrapped lines. - * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that - * italic formatting is correctly applied even when the text spans multiple lines. - */ -public enum BulletPointsEnum { - /** - * Simple bullet point. This line is intentionally long to test text wrapping in bullet points within enum - * documentation comments. It should properly indent the wrapped lines. - * - One: one. This line is intentionally long to test text wrapping in bullet points within enum documentation - * comments. It should properly indent the wrapped lines. - * - Two: two. This line is intentionally long to test text wrapping in bullet points within enum documentation - * comments. It should properly indent the wrapped lines. - */ - SIMPLE("Simple"), - - /** - * Bullet point with **bold text**. This line is intentionally long to test text wrapping in bullet points within - * enum documentation comments. It should properly indent the wrapped lines. - * - **One**: one. This line is intentionally long to test text wrapping in bullet points within enum documentation - * comments. It should properly indent the wrapped lines. - * - **Two**: two. This line is intentionally long to test text wrapping in bullet points within enum documentation - * comments. It should properly indent the wrapped lines. - */ - BOLD("Bold"), - - /** - * Bullet point with *italic text*. This line is intentionally long to test text wrapping in bullet points within - * enum documentation comments. It should properly indent the wrapped lines. - * - *One*: one. This line is intentionally long to test text wrapping in bullet points within enum documentation - * comments. It should properly indent the wrapped lines. - * - *Two*: two. This line is intentionally long to test text wrapping in bullet points within enum documentation - * comments. It should properly indent the wrapped lines. - */ - ITALIC("Italic"); - - /** - * The actual serialized value for a BulletPointsEnum instance. - */ - private final String value; - - BulletPointsEnum(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a BulletPointsEnum instance. - * - * @param value the serialized value to parse. - * @return the parsed BulletPointsEnum object, or null if unable to parse. - */ - public static BulletPointsEnum fromString(String value) { - if (value == null) { - return null; - } - BulletPointsEnum[] items = BulletPointsEnum.values(); - for (BulletPointsEnum item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsModel.java deleted file mode 100644 index 7d67f328555..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsModel.java +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package documentation.lists.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * This tests: - * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet - * points within documentation comments. It should properly indent the wrapped lines. - * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is - * preserved when the text wraps onto multiple lines in the generated documentation. - * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the - * wrapping and formatting are correctly applied in the output. - * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic - * formatting and is long enough to test the wrapping behavior in such cases. - * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how the - * bold formatting is maintained across wrapped lines. - * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that - * italic formatting is correctly applied even when the text spans multiple lines. - */ -@Immutable -public final class BulletPointsModel implements JsonSerializable { - /* - * This property uses an enum with bullet point documentation. The enum documentation includes various formatting - * styles to test rendering. The styles are: - * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet - * points within documentation comments. It should properly indent the wrapped lines. - * - Bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is - * preserved when the text wraps onto multiple - * - Bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the - * wrapping and formatting are correctly applied in the output. - * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic - * formatting and is long enough to test the wrapping behavior in such cases. - * - **Bold bullet point** - * - *Italic bullet point* - */ - @Generated - private final BulletPointsEnum prop; - - /** - * Creates an instance of BulletPointsModel class. - * - * @param prop the prop value to set. - */ - @Generated - public BulletPointsModel(BulletPointsEnum prop) { - this.prop = prop; - } - - /** - * Get the prop property: This property uses an enum with bullet point documentation. The enum documentation - * includes various formatting styles to test rendering. The styles are: - * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet - * points within documentation comments. It should properly indent the wrapped lines. - * - Bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is - * preserved when the text wraps onto multiple - * - Bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the - * wrapping and formatting are correctly applied in the output. - * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic - * formatting and is long enough to test the wrapping behavior in such cases. - * - **Bold bullet point** - * - *Italic bullet point*. - * - * @return the prop value. - */ - @Generated - public BulletPointsEnum getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BulletPointsModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BulletPointsModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BulletPointsModel. - */ - @Generated - public static BulletPointsModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BulletPointsEnum prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = BulletPointsEnum.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new BulletPointsModel(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/package-info.java deleted file mode 100644 index 18b20f6214a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Documentation. - * Illustrates documentation generation and formatting features. - * - */ -package documentation.lists.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/package-info.java deleted file mode 100644 index c1de9ece111..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Documentation. - * Illustrates documentation generation and formatting features. - * - */ -package documentation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayAsyncClient.java deleted file mode 100644 index c1f61049463..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayAsyncClient.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import encode.array.implementation.PropertiesImpl; -import encode.array.models.CommaDelimitedArrayProperty; -import encode.array.models.NewlineDelimitedArrayProperty; -import encode.array.models.PipeDelimitedArrayProperty; -import encode.array.models.SpaceDelimitedArrayProperty; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class ArrayAsyncClient { - @Generated - private final PropertiesImpl serviceClient; - - /** - * Initializes an instance of ArrayAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ArrayAsyncClient(PropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The commaDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> commaDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.commaDelimitedWithResponseAsync(body, requestOptions); - } - - /** - * The spaceDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spaceDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.spaceDelimitedWithResponseAsync(body, requestOptions); - } - - /** - * The pipeDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> pipeDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.pipeDelimitedWithResponseAsync(body, requestOptions); - } - - /** - * The newlineDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> newlineDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.newlineDelimitedWithResponseAsync(body, requestOptions); - } - - /** - * The commaDelimited operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono commaDelimited(CommaDelimitedArrayProperty body) { - // Generated convenience method for commaDelimitedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return commaDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CommaDelimitedArrayProperty.class)); - } - - /** - * The spaceDelimited operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono spaceDelimited(SpaceDelimitedArrayProperty body) { - // Generated convenience method for spaceDelimitedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return spaceDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SpaceDelimitedArrayProperty.class)); - } - - /** - * The pipeDelimited operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono pipeDelimited(PipeDelimitedArrayProperty body) { - // Generated convenience method for pipeDelimitedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return pipeDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(PipeDelimitedArrayProperty.class)); - } - - /** - * The newlineDelimited operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono newlineDelimited(NewlineDelimitedArrayProperty body) { - // Generated convenience method for newlineDelimitedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return newlineDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(NewlineDelimitedArrayProperty.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClient.java deleted file mode 100644 index eba503c660f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClient.java +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import encode.array.implementation.PropertiesImpl; -import encode.array.models.CommaDelimitedArrayProperty; -import encode.array.models.NewlineDelimitedArrayProperty; -import encode.array.models.PipeDelimitedArrayProperty; -import encode.array.models.SpaceDelimitedArrayProperty; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class ArrayClient { - @Generated - private final PropertiesImpl serviceClient; - - /** - * Initializes an instance of ArrayClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ArrayClient(PropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The commaDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response commaDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.commaDelimitedWithResponse(body, requestOptions); - } - - /** - * The spaceDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spaceDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.spaceDelimitedWithResponse(body, requestOptions); - } - - /** - * The pipeDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response pipeDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.pipeDelimitedWithResponse(body, requestOptions); - } - - /** - * The newlineDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response newlineDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.newlineDelimitedWithResponse(body, requestOptions); - } - - /** - * The commaDelimited operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CommaDelimitedArrayProperty commaDelimited(CommaDelimitedArrayProperty body) { - // Generated convenience method for commaDelimitedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return commaDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(CommaDelimitedArrayProperty.class); - } - - /** - * The spaceDelimited operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SpaceDelimitedArrayProperty spaceDelimited(SpaceDelimitedArrayProperty body) { - // Generated convenience method for spaceDelimitedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return spaceDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(SpaceDelimitedArrayProperty.class); - } - - /** - * The pipeDelimited operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public PipeDelimitedArrayProperty pipeDelimited(PipeDelimitedArrayProperty body) { - // Generated convenience method for pipeDelimitedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return pipeDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(PipeDelimitedArrayProperty.class); - } - - /** - * The newlineDelimited operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public NewlineDelimitedArrayProperty newlineDelimited(NewlineDelimitedArrayProperty body) { - // Generated convenience method for newlineDelimitedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return newlineDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(NewlineDelimitedArrayProperty.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClientBuilder.java deleted file mode 100644 index e2ea5c59755..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import encode.array.implementation.ArrayClientImpl; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the ArrayClient type. - */ -@ServiceClientBuilder(serviceClients = { ArrayClient.class, ArrayAsyncClient.class }) -public final class ArrayClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("encode-array.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ArrayClientBuilder. - */ - @Generated - public ArrayClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ArrayClientBuilder. - */ - @Generated - public ArrayClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ArrayClientImpl with the provided parameters. - * - * @return an instance of ArrayClientImpl. - */ - @Generated - private ArrayClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ArrayClientImpl client - = new ArrayClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ArrayAsyncClient class. - * - * @return an instance of ArrayAsyncClient. - */ - @Generated - public ArrayAsyncClient buildAsyncClient() { - return new ArrayAsyncClient(buildInnerClient().getProperties()); - } - - /** - * Builds an instance of ArrayClient class. - * - * @return an instance of ArrayClient. - */ - @Generated - public ArrayClient buildClient() { - return new ArrayClient(buildInnerClient().getProperties()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ArrayClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/ArrayClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/ArrayClientImpl.java deleted file mode 100644 index 14b21d0341a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/ArrayClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.array.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 ArrayClient type. - */ -public final class ArrayClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 PropertiesImpl object to access its operations. - */ - private final PropertiesImpl properties; - - /** - * Gets the PropertiesImpl object to access its operations. - * - * @return the PropertiesImpl object. - */ - public PropertiesImpl getProperties() { - return this.properties; - } - - /** - * Initializes an instance of ArrayClient client. - * - * @param endpoint Service host. - */ - public ArrayClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ArrayClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ArrayClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ArrayClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ArrayClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.properties = new PropertiesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/PropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/PropertiesImpl.java deleted file mode 100644 index ee142d68512..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/PropertiesImpl.java +++ /dev/null @@ -1,478 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Properties. - */ -public final class PropertiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PropertiesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of PropertiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PropertiesImpl(ArrayClientImpl client) { - this.service - = RestProxy.create(PropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientProperties to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientProperties") - public interface PropertiesService { - @Post("/encode/array/property/comma-delimited") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> commaDelimited(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/array/property/comma-delimited") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response commaDelimitedSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/array/property/space-delimited") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> spaceDelimited(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/array/property/space-delimited") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response spaceDelimitedSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/array/property/pipe-delimited") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> pipeDelimited(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/array/property/pipe-delimited") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response pipeDelimitedSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/array/property/newline-delimited") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> newlineDelimited(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/array/property/newline-delimited") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response newlineDelimitedSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The commaDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> commaDelimitedWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.commaDelimited(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The commaDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response commaDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.commaDelimitedSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The spaceDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spaceDelimitedWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.spaceDelimited(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The spaceDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spaceDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.spaceDelimitedSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The pipeDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> pipeDelimitedWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.pipeDelimited(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The pipeDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response pipeDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.pipeDelimitedSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The newlineDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> newlineDelimitedWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.newlineDelimited(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The newlineDelimited operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response newlineDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.newlineDelimitedSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/package-info.java deleted file mode 100644 index 57c9ca5eac9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Array. - * Test for encode decorator on array. - * - */ -package encode.array.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/CommaDelimitedArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/CommaDelimitedArrayProperty.java deleted file mode 100644 index 25747bc7fe0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/CommaDelimitedArrayProperty.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.array.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * The CommaDelimitedArrayProperty model. - */ -@Immutable -public final class CommaDelimitedArrayProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final List value; - - /** - * Creates an instance of CommaDelimitedArrayProperty class. - * - * @param value the value value to set. - */ - @Generated - public CommaDelimitedArrayProperty(List value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public List getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (this.value != null) { - jsonWriter.writeStringField("value", - this.value.stream().map(element -> element == null ? "" : element).collect(Collectors.joining(","))); - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CommaDelimitedArrayProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CommaDelimitedArrayProperty if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the CommaDelimitedArrayProperty. - */ - @Generated - public static CommaDelimitedArrayProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - String valueEncodedAsString = reader.getString(); - value = valueEncodedAsString == null - ? null - : valueEncodedAsString.isEmpty() - ? new LinkedList<>() - : new LinkedList<>(Arrays.asList(valueEncodedAsString.split(",", -1))); - } else { - reader.skipChildren(); - } - } - return new CommaDelimitedArrayProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/NewlineDelimitedArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/NewlineDelimitedArrayProperty.java deleted file mode 100644 index 03acae4ccd1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/NewlineDelimitedArrayProperty.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.array.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * The NewlineDelimitedArrayProperty model. - */ -@Immutable -public final class NewlineDelimitedArrayProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final List value; - - /** - * Creates an instance of NewlineDelimitedArrayProperty class. - * - * @param value the value value to set. - */ - @Generated - public NewlineDelimitedArrayProperty(List value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public List getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (this.value != null) { - jsonWriter.writeStringField("value", - this.value.stream().map(element -> element == null ? "" : element).collect(Collectors.joining("\n"))); - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NewlineDelimitedArrayProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NewlineDelimitedArrayProperty if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NewlineDelimitedArrayProperty. - */ - @Generated - public static NewlineDelimitedArrayProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - String valueEncodedAsString = reader.getString(); - value = valueEncodedAsString == null - ? null - : valueEncodedAsString.isEmpty() - ? new LinkedList<>() - : new LinkedList<>(Arrays.asList(valueEncodedAsString.split("\n", -1))); - } else { - reader.skipChildren(); - } - } - return new NewlineDelimitedArrayProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/PipeDelimitedArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/PipeDelimitedArrayProperty.java deleted file mode 100644 index 37a143a7016..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/PipeDelimitedArrayProperty.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.array.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * The PipeDelimitedArrayProperty model. - */ -@Immutable -public final class PipeDelimitedArrayProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final List value; - - /** - * Creates an instance of PipeDelimitedArrayProperty class. - * - * @param value the value value to set. - */ - @Generated - public PipeDelimitedArrayProperty(List value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public List getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (this.value != null) { - jsonWriter.writeStringField("value", - this.value.stream().map(element -> element == null ? "" : element).collect(Collectors.joining("|"))); - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PipeDelimitedArrayProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PipeDelimitedArrayProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the PipeDelimitedArrayProperty. - */ - @Generated - public static PipeDelimitedArrayProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - String valueEncodedAsString = reader.getString(); - value = valueEncodedAsString == null - ? null - : valueEncodedAsString.isEmpty() - ? new LinkedList<>() - : new LinkedList<>(Arrays.asList(valueEncodedAsString.split("\\|", -1))); - } else { - reader.skipChildren(); - } - } - return new PipeDelimitedArrayProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/SpaceDelimitedArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/SpaceDelimitedArrayProperty.java deleted file mode 100644 index 1c270faa5b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/SpaceDelimitedArrayProperty.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.array.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * The SpaceDelimitedArrayProperty model. - */ -@Immutable -public final class SpaceDelimitedArrayProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final List value; - - /** - * Creates an instance of SpaceDelimitedArrayProperty class. - * - * @param value the value value to set. - */ - @Generated - public SpaceDelimitedArrayProperty(List value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public List getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (this.value != null) { - jsonWriter.writeStringField("value", - this.value.stream().map(element -> element == null ? "" : element).collect(Collectors.joining(" "))); - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpaceDelimitedArrayProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpaceDelimitedArrayProperty if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpaceDelimitedArrayProperty. - */ - @Generated - public static SpaceDelimitedArrayProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - String valueEncodedAsString = reader.getString(); - value = valueEncodedAsString == null - ? null - : valueEncodedAsString.isEmpty() - ? new LinkedList<>() - : new LinkedList<>(Arrays.asList(valueEncodedAsString.split(" ", -1))); - } else { - reader.skipChildren(); - } - } - return new SpaceDelimitedArrayProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/package-info.java deleted file mode 100644 index 7db692b7214..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Array. - * Test for encode decorator on array. - * - */ -package encode.array.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/package-info.java deleted file mode 100644 index 0167f7cae0c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Array. - * Test for encode decorator on array. - * - */ -package encode.array; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/BytesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/BytesClientBuilder.java deleted file mode 100644 index ffe0132bbb6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/BytesClientBuilder.java +++ /dev/null @@ -1,378 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import encode.bytes.implementation.BytesClientImpl; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the BytesClient type. - */ -@ServiceClientBuilder( - serviceClients = { - QueryClient.class, - PropertyClient.class, - HeaderClient.class, - RequestBodyClient.class, - ResponseBodyClient.class, - QueryAsyncClient.class, - PropertyAsyncClient.class, - HeaderAsyncClient.class, - RequestBodyAsyncClient.class, - ResponseBodyAsyncClient.class }) -public final class BytesClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("encode-bytes.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the BytesClientBuilder. - */ - @Generated - public BytesClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BytesClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BytesClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BytesClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BytesClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BytesClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BytesClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BytesClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BytesClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the BytesClientBuilder. - */ - @Generated - public BytesClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of BytesClientImpl with the provided parameters. - * - * @return an instance of BytesClientImpl. - */ - @Generated - private BytesClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - BytesClientImpl client - = new BytesClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of QueryAsyncClient class. - * - * @return an instance of QueryAsyncClient. - */ - @Generated - public QueryAsyncClient buildQueryAsyncClient() { - return new QueryAsyncClient(buildInnerClient().getQueries()); - } - - /** - * Builds an instance of PropertyAsyncClient class. - * - * @return an instance of PropertyAsyncClient. - */ - @Generated - public PropertyAsyncClient buildPropertyAsyncClient() { - return new PropertyAsyncClient(buildInnerClient().getProperties()); - } - - /** - * Builds an instance of HeaderAsyncClient class. - * - * @return an instance of HeaderAsyncClient. - */ - @Generated - public HeaderAsyncClient buildHeaderAsyncClient() { - return new HeaderAsyncClient(buildInnerClient().getHeaders()); - } - - /** - * Builds an instance of RequestBodyAsyncClient class. - * - * @return an instance of RequestBodyAsyncClient. - */ - @Generated - public RequestBodyAsyncClient buildRequestBodyAsyncClient() { - return new RequestBodyAsyncClient(buildInnerClient().getRequestBodies()); - } - - /** - * Builds an instance of ResponseBodyAsyncClient class. - * - * @return an instance of ResponseBodyAsyncClient. - */ - @Generated - public ResponseBodyAsyncClient buildResponseBodyAsyncClient() { - return new ResponseBodyAsyncClient(buildInnerClient().getResponseBodies()); - } - - /** - * Builds an instance of QueryClient class. - * - * @return an instance of QueryClient. - */ - @Generated - public QueryClient buildQueryClient() { - return new QueryClient(buildInnerClient().getQueries()); - } - - /** - * Builds an instance of PropertyClient class. - * - * @return an instance of PropertyClient. - */ - @Generated - public PropertyClient buildPropertyClient() { - return new PropertyClient(buildInnerClient().getProperties()); - } - - /** - * Builds an instance of HeaderClient class. - * - * @return an instance of HeaderClient. - */ - @Generated - public HeaderClient buildHeaderClient() { - return new HeaderClient(buildInnerClient().getHeaders()); - } - - /** - * Builds an instance of RequestBodyClient class. - * - * @return an instance of RequestBodyClient. - */ - @Generated - public RequestBodyClient buildRequestBodyClient() { - return new RequestBodyClient(buildInnerClient().getRequestBodies()); - } - - /** - * Builds an instance of ResponseBodyClient class. - * - * @return an instance of ResponseBodyClient. - */ - @Generated - public ResponseBodyClient buildResponseBodyClient() { - return new ResponseBodyClient(buildInnerClient().getResponseBodies()); - } - - private static final ClientLogger LOGGER = new ClientLogger(BytesClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderAsyncClient.java deleted file mode 100644 index e6db694f911..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderAsyncClient.java +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import encode.bytes.implementation.HeadersImpl; -import java.util.List; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous BytesClient type. - */ -@ServiceClient(builder = BytesClientBuilder.class, isAsync = true) -public final class HeaderAsyncClient { - @Generated - private final HeadersImpl serviceClient; - - /** - * Initializes an instance of HeaderAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - HeaderAsyncClient(HeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponse(byte[] value, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponseAsync(value, requestOptions); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64WithResponse(byte[] value, RequestOptions requestOptions) { - return this.serviceClient.base64WithResponseAsync(value, requestOptions); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlWithResponse(byte[] value, RequestOptions requestOptions) { - return this.serviceClient.base64urlWithResponseAsync(value, requestOptions); - } - - /** - * The base64urlArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlArrayWithResponse(List value, RequestOptions requestOptions) { - return this.serviceClient.base64urlArrayWithResponseAsync(value, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono defaultMethod(byte[] value) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64(byte[] value) { - // Generated convenience method for base64WithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64WithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64url(byte[] value) { - // Generated convenience method for base64urlWithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64urlWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The base64urlArray operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64urlArray(List value) { - // Generated convenience method for base64urlArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64urlArrayWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderClient.java deleted file mode 100644 index 505615bb621..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderClient.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import encode.bytes.implementation.HeadersImpl; -import java.util.List; - -/** - * Initializes a new instance of the synchronous BytesClient type. - */ -@ServiceClient(builder = BytesClientBuilder.class) -public final class HeaderClient { - @Generated - private final HeadersImpl serviceClient; - - /** - * Initializes an instance of HeaderClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - HeaderClient(HeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(byte[] value, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponse(value, requestOptions); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64WithResponse(byte[] value, RequestOptions requestOptions) { - return this.serviceClient.base64WithResponse(value, requestOptions); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlWithResponse(byte[] value, RequestOptions requestOptions) { - return this.serviceClient.base64urlWithResponse(value, requestOptions); - } - - /** - * The base64urlArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlArrayWithResponse(List value, RequestOptions requestOptions) { - return this.serviceClient.base64urlArrayWithResponse(value, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void defaultMethod(byte[] value) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - defaultMethodWithResponse(value, requestOptions).getValue(); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void base64(byte[] value) { - // Generated convenience method for base64WithResponse - RequestOptions requestOptions = new RequestOptions(); - base64WithResponse(value, requestOptions).getValue(); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void base64url(byte[] value) { - // Generated convenience method for base64urlWithResponse - RequestOptions requestOptions = new RequestOptions(); - base64urlWithResponse(value, requestOptions).getValue(); - } - - /** - * The base64urlArray operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void base64urlArray(List value) { - // Generated convenience method for base64urlArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - base64urlArrayWithResponse(value, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyAsyncClient.java deleted file mode 100644 index 272680978f0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyAsyncClient.java +++ /dev/null @@ -1,275 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import encode.bytes.implementation.PropertiesImpl; -import encode.bytes.models.Base64BytesProperty; -import encode.bytes.models.Base64urlArrayBytesProperty; -import encode.bytes.models.Base64urlBytesProperty; -import encode.bytes.models.DefaultBytesProperty; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous BytesClient type. - */ -@ServiceClient(builder = BytesClientBuilder.class, isAsync = true) -public final class PropertyAsyncClient { - @Generated - private final PropertiesImpl serviceClient; - - /** - * Initializes an instance of PropertyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PropertyAsyncClient(PropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponseAsync(body, requestOptions); - } - - /** - * The base64 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.base64WithResponseAsync(body, requestOptions); - } - - /** - * The base64url operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Base64Url (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Base64Url (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.base64urlWithResponseAsync(body, requestOptions); - } - - /** - * The base64urlArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         Base64Url (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         Base64Url (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.base64urlArrayWithResponseAsync(body, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono defaultMethod(DefaultBytesProperty body) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DefaultBytesProperty.class)); - } - - /** - * The base64 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64(Base64BytesProperty body) { - // Generated convenience method for base64WithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Base64BytesProperty.class)); - } - - /** - * The base64url operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64url(Base64urlBytesProperty body) { - // Generated convenience method for base64urlWithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64urlWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Base64urlBytesProperty.class)); - } - - /** - * The base64urlArray operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64urlArray(Base64urlArrayBytesProperty body) { - // Generated convenience method for base64urlArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64urlArrayWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Base64urlArrayBytesProperty.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyClient.java deleted file mode 100644 index 4176a3a50c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyClient.java +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import encode.bytes.implementation.PropertiesImpl; -import encode.bytes.models.Base64BytesProperty; -import encode.bytes.models.Base64urlArrayBytesProperty; -import encode.bytes.models.Base64urlBytesProperty; -import encode.bytes.models.DefaultBytesProperty; - -/** - * Initializes a new instance of the synchronous BytesClient type. - */ -@ServiceClient(builder = BytesClientBuilder.class) -public final class PropertyClient { - @Generated - private final PropertiesImpl serviceClient; - - /** - * Initializes an instance of PropertyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PropertyClient(PropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponse(body, requestOptions); - } - - /** - * The base64 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.base64WithResponse(body, requestOptions); - } - - /** - * The base64url operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Base64Url (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Base64Url (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.base64urlWithResponse(body, requestOptions); - } - - /** - * The base64urlArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         Base64Url (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         Base64Url (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.base64urlArrayWithResponse(body, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DefaultBytesProperty defaultMethod(DefaultBytesProperty body) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(DefaultBytesProperty.class); - } - - /** - * The base64 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Base64BytesProperty base64(Base64BytesProperty body) { - // Generated convenience method for base64WithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64WithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Base64BytesProperty.class); - } - - /** - * The base64url operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Base64urlBytesProperty base64url(Base64urlBytesProperty body) { - // Generated convenience method for base64urlWithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64urlWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Base64urlBytesProperty.class); - } - - /** - * The base64urlArray operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Base64urlArrayBytesProperty base64urlArray(Base64urlArrayBytesProperty body) { - // Generated convenience method for base64urlArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64urlArrayWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Base64urlArrayBytesProperty.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryAsyncClient.java deleted file mode 100644 index ecaa3e32c70..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryAsyncClient.java +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import encode.bytes.implementation.QueriesImpl; -import java.util.List; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous BytesClient type. - */ -@ServiceClient(builder = BytesClientBuilder.class, isAsync = true) -public final class QueryAsyncClient { - @Generated - private final QueriesImpl serviceClient; - - /** - * Initializes an instance of QueryAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryAsyncClient(QueriesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponse(byte[] value, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponseAsync(value, requestOptions); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64WithResponse(byte[] value, RequestOptions requestOptions) { - return this.serviceClient.base64WithResponseAsync(value, requestOptions); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlWithResponse(byte[] value, RequestOptions requestOptions) { - return this.serviceClient.base64urlWithResponseAsync(value, requestOptions); - } - - /** - * The base64urlArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlArrayWithResponse(List value, RequestOptions requestOptions) { - return this.serviceClient.base64urlArrayWithResponseAsync(value, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono defaultMethod(byte[] value) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64(byte[] value) { - // Generated convenience method for base64WithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64WithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64url(byte[] value) { - // Generated convenience method for base64urlWithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64urlWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The base64urlArray operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64urlArray(List value) { - // Generated convenience method for base64urlArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64urlArrayWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryClient.java deleted file mode 100644 index 6c1a43f04a3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryClient.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import encode.bytes.implementation.QueriesImpl; -import java.util.List; - -/** - * Initializes a new instance of the synchronous BytesClient type. - */ -@ServiceClient(builder = BytesClientBuilder.class) -public final class QueryClient { - @Generated - private final QueriesImpl serviceClient; - - /** - * Initializes an instance of QueryClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryClient(QueriesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(byte[] value, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponse(value, requestOptions); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64WithResponse(byte[] value, RequestOptions requestOptions) { - return this.serviceClient.base64WithResponse(value, requestOptions); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlWithResponse(byte[] value, RequestOptions requestOptions) { - return this.serviceClient.base64urlWithResponse(value, requestOptions); - } - - /** - * The base64urlArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlArrayWithResponse(List value, RequestOptions requestOptions) { - return this.serviceClient.base64urlArrayWithResponse(value, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void defaultMethod(byte[] value) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - defaultMethodWithResponse(value, requestOptions).getValue(); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void base64(byte[] value) { - // Generated convenience method for base64WithResponse - RequestOptions requestOptions = new RequestOptions(); - base64WithResponse(value, requestOptions).getValue(); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void base64url(byte[] value) { - // Generated convenience method for base64urlWithResponse - RequestOptions requestOptions = new RequestOptions(); - base64urlWithResponse(value, requestOptions).getValue(); - } - - /** - * The base64urlArray operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void base64urlArray(List value) { - // Generated convenience method for base64urlArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - base64urlArrayWithResponse(value, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyAsyncClient.java deleted file mode 100644 index 1647799a2ae..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyAsyncClient.java +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Base64Url; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import encode.bytes.implementation.RequestBodiesImpl; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous BytesClient type. - */ -@ServiceClient(builder = BytesClientBuilder.class, isAsync = true) -public final class RequestBodyAsyncClient { - @Generated - private final RequestBodiesImpl serviceClient; - - /** - * Initializes an instance of RequestBodyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RequestBodyAsyncClient(RequestBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponseAsync(value, requestOptions); - } - - /** - * The octetStream operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> octetStreamWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.octetStreamWithResponseAsync(value, requestOptions); - } - - /** - * The customContentType operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> customContentTypeWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.customContentTypeWithResponseAsync(value, requestOptions); - } - - /** - * The base64 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * byte[]
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64WithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.base64WithResponseAsync(value, requestOptions); - } - - /** - * The base64url operation. - *

Request Body Schema

- * - *
-     * {@code
-     * Base64Url
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.base64urlWithResponseAsync(value, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono defaultMethod(BinaryData value) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The octetStream operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono octetStream(BinaryData value) { - // Generated convenience method for octetStreamWithResponse - RequestOptions requestOptions = new RequestOptions(); - return octetStreamWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The customContentType operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono customContentType(BinaryData value) { - // Generated convenience method for customContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return customContentTypeWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64(byte[] value) { - // Generated convenience method for base64WithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64WithResponse(BinaryData.fromObject(value), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64url(byte[] value) { - // Generated convenience method for base64urlWithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64urlWithResponse(BinaryData.fromObject(Base64Url.encode(value)), requestOptions) - .flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyClient.java deleted file mode 100644 index 799260ac22c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyClient.java +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Base64Url; -import com.azure.core.util.BinaryData; -import encode.bytes.implementation.RequestBodiesImpl; - -/** - * Initializes a new instance of the synchronous BytesClient type. - */ -@ServiceClient(builder = BytesClientBuilder.class) -public final class RequestBodyClient { - @Generated - private final RequestBodiesImpl serviceClient; - - /** - * Initializes an instance of RequestBodyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RequestBodyClient(RequestBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponse(value, requestOptions); - } - - /** - * The octetStream operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response octetStreamWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.octetStreamWithResponse(value, requestOptions); - } - - /** - * The customContentType operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response customContentTypeWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.customContentTypeWithResponse(value, requestOptions); - } - - /** - * The base64 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * byte[]
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64WithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.base64WithResponse(value, requestOptions); - } - - /** - * The base64url operation. - *

Request Body Schema

- * - *
-     * {@code
-     * Base64Url
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.base64urlWithResponse(value, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void defaultMethod(BinaryData value) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - defaultMethodWithResponse(value, requestOptions).getValue(); - } - - /** - * The octetStream operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void octetStream(BinaryData value) { - // Generated convenience method for octetStreamWithResponse - RequestOptions requestOptions = new RequestOptions(); - octetStreamWithResponse(value, requestOptions).getValue(); - } - - /** - * The customContentType operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void customContentType(BinaryData value) { - // Generated convenience method for customContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - customContentTypeWithResponse(value, requestOptions).getValue(); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void base64(byte[] value) { - // Generated convenience method for base64WithResponse - RequestOptions requestOptions = new RequestOptions(); - base64WithResponse(BinaryData.fromObject(value), requestOptions).getValue(); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void base64url(byte[] value) { - // Generated convenience method for base64urlWithResponse - RequestOptions requestOptions = new RequestOptions(); - base64urlWithResponse(BinaryData.fromObject(Base64Url.encode(value)), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyAsyncClient.java deleted file mode 100644 index 74791b9b6aa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyAsyncClient.java +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Base64Url; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import encode.bytes.implementation.ResponseBodiesImpl; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous BytesClient type. - */ -@ServiceClient(builder = BytesClientBuilder.class, isAsync = true) -public final class ResponseBodyAsyncClient { - @Generated - private final ResponseBodiesImpl serviceClient; - - /** - * Initializes an instance of ResponseBodyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ResponseBodyAsyncClient(ResponseBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponseAsync(requestOptions); - } - - /** - * The octetStream operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> octetStreamWithResponse(RequestOptions requestOptions) { - return this.serviceClient.octetStreamWithResponseAsync(requestOptions); - } - - /** - * The customContentType operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> customContentTypeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.customContentTypeWithResponseAsync(requestOptions); - } - - /** - * The base64 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * byte[]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return represent a byte array along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64WithResponse(RequestOptions requestOptions) { - return this.serviceClient.base64WithResponseAsync(requestOptions); - } - - /** - * The base64url operation. - *

Response Body Schema

- * - *
-     * {@code
-     * Base64Url
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlWithResponse(RequestOptions requestOptions) { - return this.serviceClient.base64urlWithResponseAsync(requestOptions); - } - - /** - * The defaultMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono defaultMethod() { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The octetStream operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono octetStream() { - // Generated convenience method for octetStreamWithResponse - RequestOptions requestOptions = new RequestOptions(); - return octetStreamWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The customContentType operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono customContentType() { - // Generated convenience method for customContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return customContentTypeWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The base64 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represent a byte array on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64() { - // Generated convenience method for base64WithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64WithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(byte[].class)); - } - - /** - * The base64url operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono base64url() { - // Generated convenience method for base64urlWithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64urlWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Base64Url.class).decodedBytes()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyClient.java deleted file mode 100644 index b0b14afe310..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyClient.java +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Base64Url; -import com.azure.core.util.BinaryData; -import encode.bytes.implementation.ResponseBodiesImpl; - -/** - * Initializes a new instance of the synchronous BytesClient type. - */ -@ServiceClient(builder = BytesClientBuilder.class) -public final class ResponseBodyClient { - @Generated - private final ResponseBodiesImpl serviceClient; - - /** - * Initializes an instance of ResponseBodyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ResponseBodyClient(ResponseBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponse(requestOptions); - } - - /** - * The octetStream operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response octetStreamWithResponse(RequestOptions requestOptions) { - return this.serviceClient.octetStreamWithResponse(requestOptions); - } - - /** - * The customContentType operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response customContentTypeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.customContentTypeWithResponse(requestOptions); - } - - /** - * The base64 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * byte[]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return represent a byte array along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64WithResponse(RequestOptions requestOptions) { - return this.serviceClient.base64WithResponse(requestOptions); - } - - /** - * The base64url operation. - *

Response Body Schema

- * - *
-     * {@code
-     * Base64Url
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlWithResponse(RequestOptions requestOptions) { - return this.serviceClient.base64urlWithResponse(requestOptions); - } - - /** - * The defaultMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData defaultMethod() { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(requestOptions).getValue(); - } - - /** - * The octetStream operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData octetStream() { - // Generated convenience method for octetStreamWithResponse - RequestOptions requestOptions = new RequestOptions(); - return octetStreamWithResponse(requestOptions).getValue(); - } - - /** - * The customContentType operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData customContentType() { - // Generated convenience method for customContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return customContentTypeWithResponse(requestOptions).getValue(); - } - - /** - * The base64 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represent a byte array. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public byte[] base64() { - // Generated convenience method for base64WithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64WithResponse(requestOptions).getValue().toObject(byte[].class); - } - - /** - * The base64url operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public byte[] base64url() { - // Generated convenience method for base64urlWithResponse - RequestOptions requestOptions = new RequestOptions(); - return base64urlWithResponse(requestOptions).getValue().toObject(Base64Url.class).decodedBytes(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/BytesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/BytesClientImpl.java deleted file mode 100644 index 1323b86b63c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/BytesClientImpl.java +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 BytesClient type. - */ -public final class BytesClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 QueriesImpl object to access its operations. - */ - private final QueriesImpl queries; - - /** - * Gets the QueriesImpl object to access its operations. - * - * @return the QueriesImpl object. - */ - public QueriesImpl getQueries() { - return this.queries; - } - - /** - * The PropertiesImpl object to access its operations. - */ - private final PropertiesImpl properties; - - /** - * Gets the PropertiesImpl object to access its operations. - * - * @return the PropertiesImpl object. - */ - public PropertiesImpl getProperties() { - return this.properties; - } - - /** - * The HeadersImpl object to access its operations. - */ - private final HeadersImpl headers; - - /** - * Gets the HeadersImpl object to access its operations. - * - * @return the HeadersImpl object. - */ - public HeadersImpl getHeaders() { - return this.headers; - } - - /** - * The RequestBodiesImpl object to access its operations. - */ - private final RequestBodiesImpl requestBodies; - - /** - * Gets the RequestBodiesImpl object to access its operations. - * - * @return the RequestBodiesImpl object. - */ - public RequestBodiesImpl getRequestBodies() { - return this.requestBodies; - } - - /** - * The ResponseBodiesImpl object to access its operations. - */ - private final ResponseBodiesImpl responseBodies; - - /** - * Gets the ResponseBodiesImpl object to access its operations. - * - * @return the ResponseBodiesImpl object. - */ - public ResponseBodiesImpl getResponseBodies() { - return this.responseBodies; - } - - /** - * Initializes an instance of BytesClient client. - * - * @param endpoint Service host. - */ - public BytesClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of BytesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public BytesClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of BytesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public BytesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.queries = new QueriesImpl(this); - this.properties = new PropertiesImpl(this); - this.headers = new HeadersImpl(this); - this.requestBodies = new RequestBodiesImpl(this); - this.responseBodies = new ResponseBodiesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/HeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/HeadersImpl.java deleted file mode 100644 index 0edbfd7c626..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/HeadersImpl.java +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Base64Url; -import com.azure.core.util.Base64Util; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.CollectionFormat; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.List; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Headers. - */ -public final class HeadersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final HeadersService service; - - /** - * The service client containing this operation class. - */ - private final BytesClientImpl client; - - /** - * Initializes an instance of HeadersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - HeadersImpl(BytesClientImpl client) { - this.service = RestProxy.create(HeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for BytesClientHeaders to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "BytesClientHeaders") - public interface HeadersService { - @Get("/encode/bytes/header/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> defaultMethod(@HostParam("endpoint") String endpoint, @HeaderParam("value") String value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/header/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defaultMethodSync(@HostParam("endpoint") String endpoint, @HeaderParam("value") String value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/header/base64") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64(@HostParam("endpoint") String endpoint, @HeaderParam("value") String value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/header/base64") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64Sync(@HostParam("endpoint") String endpoint, @HeaderParam("value") String value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/header/base64url") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64url(@HostParam("endpoint") String endpoint, @HeaderParam("value") Base64Url value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/header/base64url") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64urlSync(@HostParam("endpoint") String endpoint, @HeaderParam("value") Base64Url value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/header/base64url-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64urlArray(@HostParam("endpoint") String endpoint, @HeaderParam("value") String value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/header/base64url-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64urlArraySync(@HostParam("endpoint") String endpoint, @HeaderParam("value") String value, - RequestOptions requestOptions, Context context); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponseAsync(byte[] value, RequestOptions requestOptions) { - String valueConverted = Base64Util.encodeToString(value); - return FluxUtil.withContext( - context -> service.defaultMethod(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(byte[] value, RequestOptions requestOptions) { - String valueConverted = Base64Util.encodeToString(value); - return service.defaultMethodSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64WithResponseAsync(byte[] value, RequestOptions requestOptions) { - String valueConverted = Base64Util.encodeToString(value); - return FluxUtil - .withContext(context -> service.base64(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64WithResponse(byte[] value, RequestOptions requestOptions) { - String valueConverted = Base64Util.encodeToString(value); - return service.base64Sync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlWithResponseAsync(byte[] value, RequestOptions requestOptions) { - Base64Url valueConverted = Base64Url.encode(value); - return FluxUtil.withContext( - context -> service.base64url(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlWithResponse(byte[] value, RequestOptions requestOptions) { - Base64Url valueConverted = Base64Url.encode(value); - return service.base64urlSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } - - /** - * The base64urlArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlArrayWithResponseAsync(List value, RequestOptions requestOptions) { - String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() - .serializeIterable( - value.stream().map(paramItemValue -> Base64Url.encode(paramItemValue)).collect(Collectors.toList()), - CollectionFormat.CSV); - return FluxUtil.withContext( - context -> service.base64urlArray(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The base64urlArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlArrayWithResponse(List value, RequestOptions requestOptions) { - String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() - .serializeIterable( - value.stream().map(paramItemValue -> Base64Url.encode(paramItemValue)).collect(Collectors.toList()), - CollectionFormat.CSV); - return service.base64urlArraySync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/PropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/PropertiesImpl.java deleted file mode 100644 index 45542ab254a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/PropertiesImpl.java +++ /dev/null @@ -1,452 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Properties. - */ -public final class PropertiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PropertiesService service; - - /** - * The service client containing this operation class. - */ - private final BytesClientImpl client; - - /** - * Initializes an instance of PropertiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PropertiesImpl(BytesClientImpl client) { - this.service - = RestProxy.create(PropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for BytesClientProperties to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "BytesClientProperties") - public interface PropertiesService { - @Post("/encode/bytes/property/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> defaultMethod(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/property/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defaultMethodSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/property/base64") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/property/base64") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64Sync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/property/base64url") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64url(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/property/base64url") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64urlSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/property/base64url-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64urlArray(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/property/base64url-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64urlArraySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.defaultMethod(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.defaultMethodSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The base64 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64WithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.base64(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * The base64 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64WithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.base64Sync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } - - /** - * The base64url operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Base64Url (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Base64Url (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.base64url(this.client.getEndpoint(), contentType, accept, body, - requestOptions, context)); - } - - /** - * The base64url operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Base64Url (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Base64Url (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.base64urlSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The base64urlArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         Base64Url (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         Base64Url (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlArrayWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.base64urlArray(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The base64urlArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         Base64Url (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         Base64Url (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.base64urlArraySync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/QueriesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/QueriesImpl.java deleted file mode 100644 index c46a1c48c74..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/QueriesImpl.java +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Base64Url; -import com.azure.core.util.Base64Util; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.CollectionFormat; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.List; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Queries. - */ -public final class QueriesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final QueriesService service; - - /** - * The service client containing this operation class. - */ - private final BytesClientImpl client; - - /** - * Initializes an instance of QueriesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - QueriesImpl(BytesClientImpl client) { - this.service = RestProxy.create(QueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for BytesClientQueries to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "BytesClientQueries") - public interface QueriesService { - @Get("/encode/bytes/query/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> defaultMethod(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/query/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defaultMethodSync(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/query/base64") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/query/base64") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64Sync(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/query/base64url") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64url(@HostParam("endpoint") String endpoint, @QueryParam("value") Base64Url value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/query/base64url") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64urlSync(@HostParam("endpoint") String endpoint, @QueryParam("value") Base64Url value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/query/base64url-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64urlArray(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/query/base64url-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64urlArraySync(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, - RequestOptions requestOptions, Context context); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponseAsync(byte[] value, RequestOptions requestOptions) { - String valueConverted = Base64Util.encodeToString(value); - return FluxUtil.withContext( - context -> service.defaultMethod(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(byte[] value, RequestOptions requestOptions) { - String valueConverted = Base64Util.encodeToString(value); - return service.defaultMethodSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64WithResponseAsync(byte[] value, RequestOptions requestOptions) { - String valueConverted = Base64Util.encodeToString(value); - return FluxUtil - .withContext(context -> service.base64(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The base64 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64WithResponse(byte[] value, RequestOptions requestOptions) { - String valueConverted = Base64Util.encodeToString(value); - return service.base64Sync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlWithResponseAsync(byte[] value, RequestOptions requestOptions) { - Base64Url valueConverted = Base64Url.encode(value); - return FluxUtil.withContext( - context -> service.base64url(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The base64url operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlWithResponse(byte[] value, RequestOptions requestOptions) { - Base64Url valueConverted = Base64Url.encode(value); - return service.base64urlSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } - - /** - * The base64urlArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlArrayWithResponseAsync(List value, RequestOptions requestOptions) { - String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() - .serializeIterable( - value.stream().map(paramItemValue -> Base64Url.encode(paramItemValue)).collect(Collectors.toList()), - CollectionFormat.CSV); - return FluxUtil.withContext( - context -> service.base64urlArray(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The base64urlArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlArrayWithResponse(List value, RequestOptions requestOptions) { - String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() - .serializeIterable( - value.stream().map(paramItemValue -> Base64Url.encode(paramItemValue)).collect(Collectors.toList()), - CollectionFormat.CSV); - return service.base64urlArraySync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/RequestBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/RequestBodiesImpl.java deleted file mode 100644 index 8451775b3fd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/RequestBodiesImpl.java +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in RequestBodies. - */ -public final class RequestBodiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RequestBodiesService service; - - /** - * The service client containing this operation class. - */ - private final BytesClientImpl client; - - /** - * Initializes an instance of RequestBodiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - RequestBodiesImpl(BytesClientImpl client) { - this.service - = RestProxy.create(RequestBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for BytesClientRequestBodies to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "BytesClientRequestBodies") - public interface RequestBodiesService { - @Post("/encode/bytes/body/request/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> defaultMethod(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/octet-stream") BinaryData value, - RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/body/request/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defaultMethodSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/octet-stream") BinaryData value, - RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/body/request/octet-stream") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> octetStream(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/octet-stream") BinaryData value, - RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/body/request/octet-stream") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response octetStreamSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/octet-stream") BinaryData value, - RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/body/request/custom-content-type") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> customContentType(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("image/png") BinaryData value, - RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/body/request/custom-content-type") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response customContentTypeSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("image/png") BinaryData value, - RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/body/request/base64") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData value, - RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/body/request/base64") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64Sync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData value, - RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/body/request/base64url") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64url(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData value, - RequestOptions requestOptions, Context context); - - @Post("/encode/bytes/body/request/base64url") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64urlSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData value, - RequestOptions requestOptions, Context context); - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponseAsync(BinaryData value, RequestOptions requestOptions) { - final String contentType = "application/octet-stream"; - return FluxUtil.withContext( - context -> service.defaultMethod(this.client.getEndpoint(), contentType, value, requestOptions, context)); - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(BinaryData value, RequestOptions requestOptions) { - final String contentType = "application/octet-stream"; - return service.defaultMethodSync(this.client.getEndpoint(), contentType, value, requestOptions, Context.NONE); - } - - /** - * The octetStream operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> octetStreamWithResponseAsync(BinaryData value, RequestOptions requestOptions) { - final String contentType = "application/octet-stream"; - return FluxUtil.withContext( - context -> service.octetStream(this.client.getEndpoint(), contentType, value, requestOptions, context)); - } - - /** - * The octetStream operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response octetStreamWithResponse(BinaryData value, RequestOptions requestOptions) { - final String contentType = "application/octet-stream"; - return service.octetStreamSync(this.client.getEndpoint(), contentType, value, requestOptions, Context.NONE); - } - - /** - * The customContentType operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> customContentTypeWithResponseAsync(BinaryData value, RequestOptions requestOptions) { - final String contentType = "image/png"; - return FluxUtil.withContext(context -> service.customContentType(this.client.getEndpoint(), contentType, value, - requestOptions, context)); - } - - /** - * The customContentType operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response customContentTypeWithResponse(BinaryData value, RequestOptions requestOptions) { - final String contentType = "image/png"; - return service.customContentTypeSync(this.client.getEndpoint(), contentType, value, requestOptions, - Context.NONE); - } - - /** - * The base64 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * byte[]
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64WithResponseAsync(BinaryData value, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.base64(this.client.getEndpoint(), contentType, value, requestOptions, context)); - } - - /** - * The base64 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * byte[]
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64WithResponse(BinaryData value, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.base64Sync(this.client.getEndpoint(), contentType, value, requestOptions, Context.NONE); - } - - /** - * The base64url operation. - *

Request Body Schema

- * - *
-     * {@code
-     * Base64Url
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlWithResponseAsync(BinaryData value, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.base64url(this.client.getEndpoint(), contentType, value, requestOptions, context)); - } - - /** - * The base64url operation. - *

Request Body Schema

- * - *
-     * {@code
-     * Base64Url
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlWithResponse(BinaryData value, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.base64urlSync(this.client.getEndpoint(), contentType, value, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/ResponseBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/ResponseBodiesImpl.java deleted file mode 100644 index 7b68e91b2b7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/ResponseBodiesImpl.java +++ /dev/null @@ -1,385 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ResponseBodies. - */ -public final class ResponseBodiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ResponseBodiesService service; - - /** - * The service client containing this operation class. - */ - private final BytesClientImpl client; - - /** - * Initializes an instance of ResponseBodiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ResponseBodiesImpl(BytesClientImpl client) { - this.service - = RestProxy.create(ResponseBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for BytesClientResponseBodies to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "BytesClientResponseBodies") - public interface ResponseBodiesService { - @Get("/encode/bytes/body/response/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> defaultMethod(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/body/response/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defaultMethodSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/body/response/octet-stream") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> octetStream(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/body/response/octet-stream") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response octetStreamSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/body/response/custom-content-type") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> customContentType(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/body/response/custom-content-type") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response customContentTypeSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/body/response/base64") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/body/response/base64") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64Sync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/body/response/base64url") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> base64url(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/encode/bytes/body/response/base64url") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response base64urlSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The defaultMethod operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/octet-stream"; - return FluxUtil - .withContext(context -> service.defaultMethod(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The defaultMethod operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(RequestOptions requestOptions) { - final String accept = "application/octet-stream"; - return service.defaultMethodSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The octetStream operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> octetStreamWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/octet-stream"; - return FluxUtil - .withContext(context -> service.octetStream(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The octetStream operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response octetStreamWithResponse(RequestOptions requestOptions) { - final String accept = "application/octet-stream"; - return service.octetStreamSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The customContentType operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> customContentTypeWithResponseAsync(RequestOptions requestOptions) { - final String accept = "image/png"; - return FluxUtil.withContext( - context -> service.customContentType(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The customContentType operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response customContentTypeWithResponse(RequestOptions requestOptions) { - final String accept = "image/png"; - return service.customContentTypeSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The base64 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * byte[]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return represent a byte array along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64WithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.base64(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The base64 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * byte[]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return represent a byte array along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64WithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.base64Sync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The base64url operation. - *

Response Body Schema

- * - *
-     * {@code
-     * Base64Url
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> base64urlWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.base64url(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The base64url operation. - *

Response Body Schema

- * - *
-     * {@code
-     * Base64Url
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response base64urlWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.base64urlSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/package-info.java deleted file mode 100644 index ab4eb2c6c40..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Bytes. - * Test for encode decorator on bytes. - * - */ -package encode.bytes.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64BytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64BytesProperty.java deleted file mode 100644 index e22e32a9446..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64BytesProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Base64BytesProperty model. - */ -@Immutable -public final class Base64BytesProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final byte[] value; - - /** - * Creates an instance of Base64BytesProperty class. - * - * @param value the value value to set. - */ - @Generated - public Base64BytesProperty(byte[] value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public byte[] getValue() { - return CoreUtils.clone(this.value); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBinaryField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Base64BytesProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Base64BytesProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Base64BytesProperty. - */ - @Generated - public static Base64BytesProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - byte[] value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.getBinary(); - } else { - reader.skipChildren(); - } - } - return new Base64BytesProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlArrayBytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlArrayBytesProperty.java deleted file mode 100644 index 142c5daaba4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlArrayBytesProperty.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.Base64Url; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import java.util.Objects; - -/** - * The Base64urlArrayBytesProperty model. - */ -@Immutable -public final class Base64urlArrayBytesProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final List value; - - /** - * Creates an instance of Base64urlArrayBytesProperty class. - * - * @param value the value value to set. - */ - @Generated - public Base64urlArrayBytesProperty(List value) { - if (value == null) { - this.value = null; - } else { - this.value = value.stream().map(el -> Base64Url.encode(el)).collect(java.util.stream.Collectors.toList()); - } - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public List getValue() { - if (this.value == null) { - return null; - } - return this.value.stream().map(el -> el.decodedBytes()).collect(java.util.stream.Collectors.toList()); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, - (writer, element) -> writer.writeString(Objects.toString(element, null))); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Base64urlArrayBytesProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Base64urlArrayBytesProperty if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Base64urlArrayBytesProperty. - */ - @Generated - public static Base64urlArrayBytesProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.readArray(reader1 -> { - Base64Url reader1ValueHolder - = reader1.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); - if (reader1ValueHolder != null) { - return reader1ValueHolder.decodedBytes(); - } else { - return null; - } - }); - } else { - reader.skipChildren(); - } - } - return new Base64urlArrayBytesProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlBytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlBytesProperty.java deleted file mode 100644 index eadc57dbe41..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlBytesProperty.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.Base64Url; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Objects; - -/** - * The Base64urlBytesProperty model. - */ -@Immutable -public final class Base64urlBytesProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final Base64Url value; - - /** - * Creates an instance of Base64urlBytesProperty class. - * - * @param value the value value to set. - */ - @Generated - public Base64urlBytesProperty(byte[] value) { - if (value == null) { - this.value = null; - } else { - this.value = Base64Url.encode(value); - } - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public byte[] getValue() { - if (this.value == null) { - return null; - } - return this.value.decodedBytes(); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("value", Objects.toString(this.value, null)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Base64urlBytesProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Base64urlBytesProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Base64urlBytesProperty. - */ - @Generated - public static Base64urlBytesProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - byte[] value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - Base64Url valueHolder - = reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); - if (valueHolder != null) { - value = valueHolder.decodedBytes(); - } - } else { - reader.skipChildren(); - } - } - return new Base64urlBytesProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/DefaultBytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/DefaultBytesProperty.java deleted file mode 100644 index 2bdbc1e8953..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/DefaultBytesProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The DefaultBytesProperty model. - */ -@Immutable -public final class DefaultBytesProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final byte[] value; - - /** - * Creates an instance of DefaultBytesProperty class. - * - * @param value the value value to set. - */ - @Generated - public DefaultBytesProperty(byte[] value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public byte[] getValue() { - return CoreUtils.clone(this.value); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBinaryField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DefaultBytesProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DefaultBytesProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DefaultBytesProperty. - */ - @Generated - public static DefaultBytesProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - byte[] value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.getBinary(); - } else { - reader.skipChildren(); - } - } - return new DefaultBytesProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/package-info.java deleted file mode 100644 index f51e8aa1f5d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Bytes. - * Test for encode decorator on bytes. - * - */ -package encode.bytes.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/package-info.java deleted file mode 100644 index 20845fc1cd3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Bytes. - * Test for encode decorator on bytes. - * - */ -package encode.bytes; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/DatetimeClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/DatetimeClientBuilder.java deleted file mode 100644 index 214b4c7edc5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/DatetimeClientBuilder.java +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import encode.datetime.implementation.DatetimeClientImpl; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the DatetimeClient type. - */ -@ServiceClientBuilder( - serviceClients = { - QueryClient.class, - PropertyClient.class, - HeaderClient.class, - ResponseHeaderClient.class, - QueryAsyncClient.class, - PropertyAsyncClient.class, - HeaderAsyncClient.class, - ResponseHeaderAsyncClient.class }) -public final class DatetimeClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("encode-datetime.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the DatetimeClientBuilder. - */ - @Generated - public DatetimeClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DatetimeClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DatetimeClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DatetimeClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DatetimeClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DatetimeClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DatetimeClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DatetimeClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DatetimeClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the DatetimeClientBuilder. - */ - @Generated - public DatetimeClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of DatetimeClientImpl with the provided parameters. - * - * @return an instance of DatetimeClientImpl. - */ - @Generated - private DatetimeClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - DatetimeClientImpl client - = new DatetimeClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of QueryAsyncClient class. - * - * @return an instance of QueryAsyncClient. - */ - @Generated - public QueryAsyncClient buildQueryAsyncClient() { - return new QueryAsyncClient(buildInnerClient().getQueries()); - } - - /** - * Builds an instance of PropertyAsyncClient class. - * - * @return an instance of PropertyAsyncClient. - */ - @Generated - public PropertyAsyncClient buildPropertyAsyncClient() { - return new PropertyAsyncClient(buildInnerClient().getProperties()); - } - - /** - * Builds an instance of HeaderAsyncClient class. - * - * @return an instance of HeaderAsyncClient. - */ - @Generated - public HeaderAsyncClient buildHeaderAsyncClient() { - return new HeaderAsyncClient(buildInnerClient().getHeaders()); - } - - /** - * Builds an instance of ResponseHeaderAsyncClient class. - * - * @return an instance of ResponseHeaderAsyncClient. - */ - @Generated - public ResponseHeaderAsyncClient buildResponseHeaderAsyncClient() { - return new ResponseHeaderAsyncClient(buildInnerClient().getResponseHeaders()); - } - - /** - * Builds an instance of QueryClient class. - * - * @return an instance of QueryClient. - */ - @Generated - public QueryClient buildQueryClient() { - return new QueryClient(buildInnerClient().getQueries()); - } - - /** - * Builds an instance of PropertyClient class. - * - * @return an instance of PropertyClient. - */ - @Generated - public PropertyClient buildPropertyClient() { - return new PropertyClient(buildInnerClient().getProperties()); - } - - /** - * Builds an instance of HeaderClient class. - * - * @return an instance of HeaderClient. - */ - @Generated - public HeaderClient buildHeaderClient() { - return new HeaderClient(buildInnerClient().getHeaders()); - } - - /** - * Builds an instance of ResponseHeaderClient class. - * - * @return an instance of ResponseHeaderClient. - */ - @Generated - public ResponseHeaderClient buildResponseHeaderClient() { - return new ResponseHeaderClient(buildInnerClient().getResponseHeaders()); - } - - private static final ClientLogger LOGGER = new ClientLogger(DatetimeClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderAsyncClient.java deleted file mode 100644 index 679b7507bd7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderAsyncClient.java +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import encode.datetime.implementation.HeadersImpl; -import java.time.OffsetDateTime; -import java.util.List; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous DatetimeClient type. - */ -@ServiceClient(builder = DatetimeClientBuilder.class, isAsync = true) -public final class HeaderAsyncClient { - @Generated - private final HeadersImpl serviceClient; - - /** - * Initializes an instance of HeaderAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - HeaderAsyncClient(HeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponseAsync(value, requestOptions); - } - - /** - * The rfc3339 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc3339WithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.rfc3339WithResponseAsync(value, requestOptions); - } - - /** - * The rfc7231 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc7231WithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.rfc7231WithResponseAsync(value, requestOptions); - } - - /** - * The unixTimestamp operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampWithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.unixTimestampWithResponseAsync(value, requestOptions); - } - - /** - * The unixTimestampArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampArrayWithResponse(List value, - RequestOptions requestOptions) { - return this.serviceClient.unixTimestampArrayWithResponseAsync(value, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono defaultMethod(OffsetDateTime value) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The rfc3339 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono rfc3339(OffsetDateTime value) { - // Generated convenience method for rfc3339WithResponse - RequestOptions requestOptions = new RequestOptions(); - return rfc3339WithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The rfc7231 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono rfc7231(OffsetDateTime value) { - // Generated convenience method for rfc7231WithResponse - RequestOptions requestOptions = new RequestOptions(); - return rfc7231WithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The unixTimestamp operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono unixTimestamp(OffsetDateTime value) { - // Generated convenience method for unixTimestampWithResponse - RequestOptions requestOptions = new RequestOptions(); - return unixTimestampWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The unixTimestampArray operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono unixTimestampArray(List value) { - // Generated convenience method for unixTimestampArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return unixTimestampArrayWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderClient.java deleted file mode 100644 index acab1729a13..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderClient.java +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import encode.datetime.implementation.HeadersImpl; -import java.time.OffsetDateTime; -import java.util.List; - -/** - * Initializes a new instance of the synchronous DatetimeClient type. - */ -@ServiceClient(builder = DatetimeClientBuilder.class) -public final class HeaderClient { - @Generated - private final HeadersImpl serviceClient; - - /** - * Initializes an instance of HeaderClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - HeaderClient(HeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponse(value, requestOptions); - } - - /** - * The rfc3339 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc3339WithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.rfc3339WithResponse(value, requestOptions); - } - - /** - * The rfc7231 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc7231WithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.rfc7231WithResponse(value, requestOptions); - } - - /** - * The unixTimestamp operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampWithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.unixTimestampWithResponse(value, requestOptions); - } - - /** - * The unixTimestampArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampArrayWithResponse(List value, RequestOptions requestOptions) { - return this.serviceClient.unixTimestampArrayWithResponse(value, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void defaultMethod(OffsetDateTime value) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - defaultMethodWithResponse(value, requestOptions).getValue(); - } - - /** - * The rfc3339 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void rfc3339(OffsetDateTime value) { - // Generated convenience method for rfc3339WithResponse - RequestOptions requestOptions = new RequestOptions(); - rfc3339WithResponse(value, requestOptions).getValue(); - } - - /** - * The rfc7231 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void rfc7231(OffsetDateTime value) { - // Generated convenience method for rfc7231WithResponse - RequestOptions requestOptions = new RequestOptions(); - rfc7231WithResponse(value, requestOptions).getValue(); - } - - /** - * The unixTimestamp operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void unixTimestamp(OffsetDateTime value) { - // Generated convenience method for unixTimestampWithResponse - RequestOptions requestOptions = new RequestOptions(); - unixTimestampWithResponse(value, requestOptions).getValue(); - } - - /** - * The unixTimestampArray operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void unixTimestampArray(List value) { - // Generated convenience method for unixTimestampArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - unixTimestampArrayWithResponse(value, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyAsyncClient.java deleted file mode 100644 index 3e79966a22e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyAsyncClient.java +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import encode.datetime.implementation.PropertiesImpl; -import encode.datetime.models.DefaultDatetimeProperty; -import encode.datetime.models.Rfc3339DatetimeProperty; -import encode.datetime.models.Rfc7231DatetimeProperty; -import encode.datetime.models.UnixTimestampArrayDatetimeProperty; -import encode.datetime.models.UnixTimestampDatetimeProperty; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous DatetimeClient type. - */ -@ServiceClient(builder = DatetimeClientBuilder.class, isAsync = true) -public final class PropertyAsyncClient { - @Generated - private final PropertiesImpl serviceClient; - - /** - * Initializes an instance of PropertyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PropertyAsyncClient(PropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponseAsync(body, requestOptions); - } - - /** - * The rfc3339 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc3339WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.rfc3339WithResponseAsync(body, requestOptions); - } - - /** - * The rfc7231 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc7231WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.rfc7231WithResponseAsync(body, requestOptions); - } - - /** - * The unixTimestamp operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.unixTimestampWithResponseAsync(body, requestOptions); - } - - /** - * The unixTimestampArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         long (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         long (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.unixTimestampArrayWithResponseAsync(body, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono defaultMethod(DefaultDatetimeProperty body) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DefaultDatetimeProperty.class)); - } - - /** - * The rfc3339 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono rfc3339(Rfc3339DatetimeProperty body) { - // Generated convenience method for rfc3339WithResponse - RequestOptions requestOptions = new RequestOptions(); - return rfc3339WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Rfc3339DatetimeProperty.class)); - } - - /** - * The rfc7231 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono rfc7231(Rfc7231DatetimeProperty body) { - // Generated convenience method for rfc7231WithResponse - RequestOptions requestOptions = new RequestOptions(); - return rfc7231WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Rfc7231DatetimeProperty.class)); - } - - /** - * The unixTimestamp operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono unixTimestamp(UnixTimestampDatetimeProperty body) { - // Generated convenience method for unixTimestampWithResponse - RequestOptions requestOptions = new RequestOptions(); - return unixTimestampWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnixTimestampDatetimeProperty.class)); - } - - /** - * The unixTimestampArray operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono unixTimestampArray(UnixTimestampArrayDatetimeProperty body) { - // Generated convenience method for unixTimestampArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return unixTimestampArrayWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnixTimestampArrayDatetimeProperty.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyClient.java deleted file mode 100644 index 5ee85172f0a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyClient.java +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import encode.datetime.implementation.PropertiesImpl; -import encode.datetime.models.DefaultDatetimeProperty; -import encode.datetime.models.Rfc3339DatetimeProperty; -import encode.datetime.models.Rfc7231DatetimeProperty; -import encode.datetime.models.UnixTimestampArrayDatetimeProperty; -import encode.datetime.models.UnixTimestampDatetimeProperty; - -/** - * Initializes a new instance of the synchronous DatetimeClient type. - */ -@ServiceClient(builder = DatetimeClientBuilder.class) -public final class PropertyClient { - @Generated - private final PropertiesImpl serviceClient; - - /** - * Initializes an instance of PropertyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PropertyClient(PropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponse(body, requestOptions); - } - - /** - * The rfc3339 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc3339WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.rfc3339WithResponse(body, requestOptions); - } - - /** - * The rfc7231 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc7231WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.rfc7231WithResponse(body, requestOptions); - } - - /** - * The unixTimestamp operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.unixTimestampWithResponse(body, requestOptions); - } - - /** - * The unixTimestampArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         long (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         long (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.unixTimestampArrayWithResponse(body, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DefaultDatetimeProperty defaultMethod(DefaultDatetimeProperty body) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(DefaultDatetimeProperty.class); - } - - /** - * The rfc3339 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Rfc3339DatetimeProperty rfc3339(Rfc3339DatetimeProperty body) { - // Generated convenience method for rfc3339WithResponse - RequestOptions requestOptions = new RequestOptions(); - return rfc3339WithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Rfc3339DatetimeProperty.class); - } - - /** - * The rfc7231 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Rfc7231DatetimeProperty rfc7231(Rfc7231DatetimeProperty body) { - // Generated convenience method for rfc7231WithResponse - RequestOptions requestOptions = new RequestOptions(); - return rfc7231WithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Rfc7231DatetimeProperty.class); - } - - /** - * The unixTimestamp operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnixTimestampDatetimeProperty unixTimestamp(UnixTimestampDatetimeProperty body) { - // Generated convenience method for unixTimestampWithResponse - RequestOptions requestOptions = new RequestOptions(); - return unixTimestampWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(UnixTimestampDatetimeProperty.class); - } - - /** - * The unixTimestampArray operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnixTimestampArrayDatetimeProperty unixTimestampArray(UnixTimestampArrayDatetimeProperty body) { - // Generated convenience method for unixTimestampArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return unixTimestampArrayWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(UnixTimestampArrayDatetimeProperty.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryAsyncClient.java deleted file mode 100644 index e695a6ca334..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryAsyncClient.java +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import encode.datetime.implementation.QueriesImpl; -import java.time.OffsetDateTime; -import java.util.List; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous DatetimeClient type. - */ -@ServiceClient(builder = DatetimeClientBuilder.class, isAsync = true) -public final class QueryAsyncClient { - @Generated - private final QueriesImpl serviceClient; - - /** - * Initializes an instance of QueryAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryAsyncClient(QueriesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponseAsync(value, requestOptions); - } - - /** - * The rfc3339 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc3339WithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.rfc3339WithResponseAsync(value, requestOptions); - } - - /** - * The rfc7231 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc7231WithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.rfc7231WithResponseAsync(value, requestOptions); - } - - /** - * The unixTimestamp operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampWithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.unixTimestampWithResponseAsync(value, requestOptions); - } - - /** - * The unixTimestampArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampArrayWithResponse(List value, - RequestOptions requestOptions) { - return this.serviceClient.unixTimestampArrayWithResponseAsync(value, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono defaultMethod(OffsetDateTime value) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The rfc3339 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono rfc3339(OffsetDateTime value) { - // Generated convenience method for rfc3339WithResponse - RequestOptions requestOptions = new RequestOptions(); - return rfc3339WithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The rfc7231 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono rfc7231(OffsetDateTime value) { - // Generated convenience method for rfc7231WithResponse - RequestOptions requestOptions = new RequestOptions(); - return rfc7231WithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The unixTimestamp operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono unixTimestamp(OffsetDateTime value) { - // Generated convenience method for unixTimestampWithResponse - RequestOptions requestOptions = new RequestOptions(); - return unixTimestampWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The unixTimestampArray operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono unixTimestampArray(List value) { - // Generated convenience method for unixTimestampArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return unixTimestampArrayWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryClient.java deleted file mode 100644 index eababe28a4a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryClient.java +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import encode.datetime.implementation.QueriesImpl; -import java.time.OffsetDateTime; -import java.util.List; - -/** - * Initializes a new instance of the synchronous DatetimeClient type. - */ -@ServiceClient(builder = DatetimeClientBuilder.class) -public final class QueryClient { - @Generated - private final QueriesImpl serviceClient; - - /** - * Initializes an instance of QueryClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryClient(QueriesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponse(value, requestOptions); - } - - /** - * The rfc3339 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc3339WithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.rfc3339WithResponse(value, requestOptions); - } - - /** - * The rfc7231 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc7231WithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.rfc7231WithResponse(value, requestOptions); - } - - /** - * The unixTimestamp operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampWithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return this.serviceClient.unixTimestampWithResponse(value, requestOptions); - } - - /** - * The unixTimestampArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampArrayWithResponse(List value, RequestOptions requestOptions) { - return this.serviceClient.unixTimestampArrayWithResponse(value, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void defaultMethod(OffsetDateTime value) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - defaultMethodWithResponse(value, requestOptions).getValue(); - } - - /** - * The rfc3339 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void rfc3339(OffsetDateTime value) { - // Generated convenience method for rfc3339WithResponse - RequestOptions requestOptions = new RequestOptions(); - rfc3339WithResponse(value, requestOptions).getValue(); - } - - /** - * The rfc7231 operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void rfc7231(OffsetDateTime value) { - // Generated convenience method for rfc7231WithResponse - RequestOptions requestOptions = new RequestOptions(); - rfc7231WithResponse(value, requestOptions).getValue(); - } - - /** - * The unixTimestamp operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void unixTimestamp(OffsetDateTime value) { - // Generated convenience method for unixTimestampWithResponse - RequestOptions requestOptions = new RequestOptions(); - unixTimestampWithResponse(value, requestOptions).getValue(); - } - - /** - * The unixTimestampArray operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void unixTimestampArray(List value) { - // Generated convenience method for unixTimestampArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - unixTimestampArrayWithResponse(value, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderAsyncClient.java deleted file mode 100644 index dd2355693bb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderAsyncClient.java +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import encode.datetime.implementation.ResponseHeadersImpl; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous DatetimeClient type. - */ -@ServiceClient(builder = DatetimeClientBuilder.class, isAsync = true) -public final class ResponseHeaderAsyncClient { - @Generated - private final ResponseHeadersImpl serviceClient; - - /** - * Initializes an instance of ResponseHeaderAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ResponseHeaderAsyncClient(ResponseHeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponseAsync(requestOptions); - } - - /** - * The rfc3339 operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc3339WithResponse(RequestOptions requestOptions) { - return this.serviceClient.rfc3339WithResponseAsync(requestOptions); - } - - /** - * The rfc7231 operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc7231WithResponse(RequestOptions requestOptions) { - return this.serviceClient.rfc7231WithResponseAsync(requestOptions); - } - - /** - * The unixTimestamp operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampWithResponse(RequestOptions requestOptions) { - return this.serviceClient.unixTimestampWithResponseAsync(requestOptions); - } - - /** - * The defaultMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono defaultMethod() { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The rfc3339 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono rfc3339() { - // Generated convenience method for rfc3339WithResponse - RequestOptions requestOptions = new RequestOptions(); - return rfc3339WithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The rfc7231 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono rfc7231() { - // Generated convenience method for rfc7231WithResponse - RequestOptions requestOptions = new RequestOptions(); - return rfc7231WithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The unixTimestamp operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono unixTimestamp() { - // Generated convenience method for unixTimestampWithResponse - RequestOptions requestOptions = new RequestOptions(); - return unixTimestampWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderClient.java deleted file mode 100644 index 94dbd27ce13..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderClient.java +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import encode.datetime.implementation.ResponseHeadersImpl; - -/** - * Initializes a new instance of the synchronous DatetimeClient type. - */ -@ServiceClient(builder = DatetimeClientBuilder.class) -public final class ResponseHeaderClient { - @Generated - private final ResponseHeadersImpl serviceClient; - - /** - * Initializes an instance of ResponseHeaderClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ResponseHeaderClient(ResponseHeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponse(requestOptions); - } - - /** - * The rfc3339 operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc3339WithResponse(RequestOptions requestOptions) { - return this.serviceClient.rfc3339WithResponse(requestOptions); - } - - /** - * The rfc7231 operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc7231WithResponse(RequestOptions requestOptions) { - return this.serviceClient.rfc7231WithResponse(requestOptions); - } - - /** - * The unixTimestamp operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampWithResponse(RequestOptions requestOptions) { - return this.serviceClient.unixTimestampWithResponse(requestOptions); - } - - /** - * The defaultMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void defaultMethod() { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - defaultMethodWithResponse(requestOptions).getValue(); - } - - /** - * The rfc3339 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void rfc3339() { - // Generated convenience method for rfc3339WithResponse - RequestOptions requestOptions = new RequestOptions(); - rfc3339WithResponse(requestOptions).getValue(); - } - - /** - * The rfc7231 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void rfc7231() { - // Generated convenience method for rfc7231WithResponse - RequestOptions requestOptions = new RequestOptions(); - rfc7231WithResponse(requestOptions).getValue(); - } - - /** - * The unixTimestamp operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void unixTimestamp() { - // Generated convenience method for unixTimestampWithResponse - RequestOptions requestOptions = new RequestOptions(); - unixTimestampWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/DatetimeClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/DatetimeClientImpl.java deleted file mode 100644 index 5d8eb89de0c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/DatetimeClientImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 DatetimeClient type. - */ -public final class DatetimeClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 QueriesImpl object to access its operations. - */ - private final QueriesImpl queries; - - /** - * Gets the QueriesImpl object to access its operations. - * - * @return the QueriesImpl object. - */ - public QueriesImpl getQueries() { - return this.queries; - } - - /** - * The PropertiesImpl object to access its operations. - */ - private final PropertiesImpl properties; - - /** - * Gets the PropertiesImpl object to access its operations. - * - * @return the PropertiesImpl object. - */ - public PropertiesImpl getProperties() { - return this.properties; - } - - /** - * The HeadersImpl object to access its operations. - */ - private final HeadersImpl headers; - - /** - * Gets the HeadersImpl object to access its operations. - * - * @return the HeadersImpl object. - */ - public HeadersImpl getHeaders() { - return this.headers; - } - - /** - * The ResponseHeadersImpl object to access its operations. - */ - private final ResponseHeadersImpl responseHeaders; - - /** - * Gets the ResponseHeadersImpl object to access its operations. - * - * @return the ResponseHeadersImpl object. - */ - public ResponseHeadersImpl getResponseHeaders() { - return this.responseHeaders; - } - - /** - * Initializes an instance of DatetimeClient client. - * - * @param endpoint Service host. - */ - public DatetimeClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DatetimeClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public DatetimeClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DatetimeClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public DatetimeClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.queries = new QueriesImpl(this); - this.properties = new PropertiesImpl(this); - this.headers = new HeadersImpl(this); - this.responseHeaders = new ResponseHeadersImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/HeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/HeadersImpl.java deleted file mode 100644 index de0e8adab6b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/HeadersImpl.java +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.CollectionFormat; -import com.azure.core.util.serializer.JacksonAdapter; -import java.time.OffsetDateTime; -import java.util.List; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Headers. - */ -public final class HeadersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final HeadersService service; - - /** - * The service client containing this operation class. - */ - private final DatetimeClientImpl client; - - /** - * Initializes an instance of HeadersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - HeadersImpl(DatetimeClientImpl client) { - this.service = RestProxy.create(HeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DatetimeClientHeaders to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DatetimeClientHeaders") - public interface HeadersService { - @Get("/encode/datetime/header/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> defaultMethod(@HostParam("endpoint") String endpoint, - @HeaderParam("value") DateTimeRfc1123 value, RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/header/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defaultMethodSync(@HostParam("endpoint") String endpoint, - @HeaderParam("value") DateTimeRfc1123 value, RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/header/rfc3339") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> rfc3339(@HostParam("endpoint") String endpoint, @HeaderParam("value") OffsetDateTime value, - RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/header/rfc3339") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response rfc3339Sync(@HostParam("endpoint") String endpoint, @HeaderParam("value") OffsetDateTime value, - RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/header/rfc7231") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> rfc7231(@HostParam("endpoint") String endpoint, - @HeaderParam("value") DateTimeRfc1123 value, RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/header/rfc7231") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response rfc7231Sync(@HostParam("endpoint") String endpoint, @HeaderParam("value") DateTimeRfc1123 value, - RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/header/unix-timestamp") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> unixTimestamp(@HostParam("endpoint") String endpoint, @HeaderParam("value") long value, - RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/header/unix-timestamp") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response unixTimestampSync(@HostParam("endpoint") String endpoint, @HeaderParam("value") long value, - RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/header/unix-timestamp-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> unixTimestampArray(@HostParam("endpoint") String endpoint, - @HeaderParam("value") String value, RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/header/unix-timestamp-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response unixTimestampArraySync(@HostParam("endpoint") String endpoint, - @HeaderParam("value") String value, RequestOptions requestOptions, Context context); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { - DateTimeRfc1123 valueConverted = new DateTimeRfc1123(value); - return FluxUtil.withContext( - context -> service.defaultMethod(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(OffsetDateTime value, RequestOptions requestOptions) { - DateTimeRfc1123 valueConverted = new DateTimeRfc1123(value); - return service.defaultMethodSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } - - /** - * The rfc3339 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc3339WithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.rfc3339(this.client.getEndpoint(), value, requestOptions, context)); - } - - /** - * The rfc3339 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc3339WithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return service.rfc3339Sync(this.client.getEndpoint(), value, requestOptions, Context.NONE); - } - - /** - * The rfc7231 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc7231WithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { - DateTimeRfc1123 valueConverted = new DateTimeRfc1123(value); - return FluxUtil.withContext( - context -> service.rfc7231(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The rfc7231 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc7231WithResponse(OffsetDateTime value, RequestOptions requestOptions) { - DateTimeRfc1123 valueConverted = new DateTimeRfc1123(value); - return service.rfc7231Sync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } - - /** - * The unixTimestamp operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampWithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { - long valueConverted = value.toEpochSecond(); - return FluxUtil.withContext( - context -> service.unixTimestamp(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The unixTimestamp operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampWithResponse(OffsetDateTime value, RequestOptions requestOptions) { - long valueConverted = value.toEpochSecond(); - return service.unixTimestampSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } - - /** - * The unixTimestampArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampArrayWithResponseAsync(List value, - RequestOptions requestOptions) { - String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() - .serializeIterable( - value.stream().map(paramItemValue -> paramItemValue.toEpochSecond()).collect(Collectors.toList()), - CollectionFormat.CSV); - return FluxUtil.withContext( - context -> service.unixTimestampArray(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The unixTimestampArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampArrayWithResponse(List value, RequestOptions requestOptions) { - String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() - .serializeIterable( - value.stream().map(paramItemValue -> paramItemValue.toEpochSecond()).collect(Collectors.toList()), - CollectionFormat.CSV); - return service.unixTimestampArraySync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/PropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/PropertiesImpl.java deleted file mode 100644 index 63537cbe29d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/PropertiesImpl.java +++ /dev/null @@ -1,548 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Properties. - */ -public final class PropertiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PropertiesService service; - - /** - * The service client containing this operation class. - */ - private final DatetimeClientImpl client; - - /** - * Initializes an instance of PropertiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PropertiesImpl(DatetimeClientImpl client) { - this.service - = RestProxy.create(PropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DatetimeClientProperties to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DatetimeClientProperties") - public interface PropertiesService { - @Post("/encode/datetime/property/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> defaultMethod(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/datetime/property/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defaultMethodSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/datetime/property/rfc3339") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> rfc3339(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/datetime/property/rfc3339") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response rfc3339Sync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/datetime/property/rfc7231") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> rfc7231(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/datetime/property/rfc7231") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response rfc7231Sync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/datetime/property/unix-timestamp") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> unixTimestamp(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/datetime/property/unix-timestamp") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response unixTimestampSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/datetime/property/unix-timestamp-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> unixTimestampArray(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/datetime/property/unix-timestamp-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response unixTimestampArraySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.defaultMethod(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.defaultMethodSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The rfc3339 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc3339WithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.rfc3339(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * The rfc3339 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc3339WithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.rfc3339Sync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } - - /** - * The rfc7231 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc7231WithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.rfc7231(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * The rfc7231 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc7231WithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.rfc7231Sync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } - - /** - * The unixTimestamp operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.unixTimestamp(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The unixTimestamp operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.unixTimestampSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The unixTimestampArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         long (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         long (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampArrayWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.unixTimestampArray(this.client.getEndpoint(), contentType, - accept, body, requestOptions, context)); - } - - /** - * The unixTimestampArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         long (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         long (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.unixTimestampArraySync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/QueriesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/QueriesImpl.java deleted file mode 100644 index e1ddd511969..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/QueriesImpl.java +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.CollectionFormat; -import com.azure.core.util.serializer.JacksonAdapter; -import java.time.OffsetDateTime; -import java.util.List; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Queries. - */ -public final class QueriesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final QueriesService service; - - /** - * The service client containing this operation class. - */ - private final DatetimeClientImpl client; - - /** - * Initializes an instance of QueriesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - QueriesImpl(DatetimeClientImpl client) { - this.service = RestProxy.create(QueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DatetimeClientQueries to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DatetimeClientQueries") - public interface QueriesService { - @Get("/encode/datetime/query/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> defaultMethod(@HostParam("endpoint") String endpoint, - @QueryParam("value") OffsetDateTime value, RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/query/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defaultMethodSync(@HostParam("endpoint") String endpoint, - @QueryParam("value") OffsetDateTime value, RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/query/rfc3339") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> rfc3339(@HostParam("endpoint") String endpoint, @QueryParam("value") OffsetDateTime value, - RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/query/rfc3339") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response rfc3339Sync(@HostParam("endpoint") String endpoint, @QueryParam("value") OffsetDateTime value, - RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/query/rfc7231") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> rfc7231(@HostParam("endpoint") String endpoint, @QueryParam("value") DateTimeRfc1123 value, - RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/query/rfc7231") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response rfc7231Sync(@HostParam("endpoint") String endpoint, @QueryParam("value") DateTimeRfc1123 value, - RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/query/unix-timestamp") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> unixTimestamp(@HostParam("endpoint") String endpoint, @QueryParam("value") long value, - RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/query/unix-timestamp") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response unixTimestampSync(@HostParam("endpoint") String endpoint, @QueryParam("value") long value, - RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/query/unix-timestamp-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> unixTimestampArray(@HostParam("endpoint") String endpoint, - @QueryParam("value") String value, RequestOptions requestOptions, Context context); - - @Get("/encode/datetime/query/unix-timestamp-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response unixTimestampArraySync(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, - RequestOptions requestOptions, Context context); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.defaultMethod(this.client.getEndpoint(), value, requestOptions, context)); - } - - /** - * The defaultMethod operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return service.defaultMethodSync(this.client.getEndpoint(), value, requestOptions, Context.NONE); - } - - /** - * The rfc3339 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc3339WithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.rfc3339(this.client.getEndpoint(), value, requestOptions, context)); - } - - /** - * The rfc3339 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc3339WithResponse(OffsetDateTime value, RequestOptions requestOptions) { - return service.rfc3339Sync(this.client.getEndpoint(), value, requestOptions, Context.NONE); - } - - /** - * The rfc7231 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc7231WithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { - DateTimeRfc1123 valueConverted = new DateTimeRfc1123(value); - return FluxUtil.withContext( - context -> service.rfc7231(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The rfc7231 operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc7231WithResponse(OffsetDateTime value, RequestOptions requestOptions) { - DateTimeRfc1123 valueConverted = new DateTimeRfc1123(value); - return service.rfc7231Sync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } - - /** - * The unixTimestamp operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampWithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { - long valueConverted = value.toEpochSecond(); - return FluxUtil.withContext( - context -> service.unixTimestamp(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The unixTimestamp operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampWithResponse(OffsetDateTime value, RequestOptions requestOptions) { - long valueConverted = value.toEpochSecond(); - return service.unixTimestampSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } - - /** - * The unixTimestampArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampArrayWithResponseAsync(List value, - RequestOptions requestOptions) { - String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() - .serializeIterable( - value.stream().map(paramItemValue -> paramItemValue.toEpochSecond()).collect(Collectors.toList()), - CollectionFormat.CSV); - return FluxUtil.withContext( - context -> service.unixTimestampArray(this.client.getEndpoint(), valueConverted, requestOptions, context)); - } - - /** - * The unixTimestampArray operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampArrayWithResponse(List value, RequestOptions requestOptions) { - String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() - .serializeIterable( - value.stream().map(paramItemValue -> paramItemValue.toEpochSecond()).collect(Collectors.toList()), - CollectionFormat.CSV); - return service.unixTimestampArraySync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/ResponseHeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/ResponseHeadersImpl.java deleted file mode 100644 index 900cbca4eb5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/ResponseHeadersImpl.java +++ /dev/null @@ -1,252 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ResponseHeaders. - */ -public final class ResponseHeadersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ResponseHeadersService service; - - /** - * The service client containing this operation class. - */ - private final DatetimeClientImpl client; - - /** - * Initializes an instance of ResponseHeadersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ResponseHeadersImpl(DatetimeClientImpl client) { - this.service - = RestProxy.create(ResponseHeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DatetimeClientResponseHeaders to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DatetimeClientResponseHeaders") - public interface ResponseHeadersService { - @Get("/encode/datetime/responseheader/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> defaultMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/encode/datetime/responseheader/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defaultMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/encode/datetime/responseheader/rfc3339") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> rfc3339(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/encode/datetime/responseheader/rfc3339") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response rfc3339Sync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/encode/datetime/responseheader/rfc7231") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> rfc7231(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/encode/datetime/responseheader/rfc7231") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response rfc7231Sync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/encode/datetime/responseheader/unix-timestamp") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> unixTimestamp(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/encode/datetime/responseheader/unix-timestamp") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response unixTimestampSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The defaultMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.defaultMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The defaultMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(RequestOptions requestOptions) { - return service.defaultMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The rfc3339 operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc3339WithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.rfc3339(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The rfc3339 operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc3339WithResponse(RequestOptions requestOptions) { - return service.rfc3339Sync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The rfc7231 operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> rfc7231WithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.rfc7231(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The rfc7231 operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response rfc7231WithResponse(RequestOptions requestOptions) { - return service.rfc7231Sync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The unixTimestamp operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> unixTimestampWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.unixTimestamp(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The unixTimestamp operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response unixTimestampWithResponse(RequestOptions requestOptions) { - return service.unixTimestampSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/package-info.java deleted file mode 100644 index 721350d895f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for DatetimeModel. - * Test for encode decorator on datetime. - * - */ -package encode.datetime.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/DefaultDatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/DefaultDatetimeProperty.java deleted file mode 100644 index 2985f443acc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/DefaultDatetimeProperty.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; - -/** - * The DefaultDatetimeProperty model. - */ -@Immutable -public final class DefaultDatetimeProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final OffsetDateTime value; - - /** - * Creates an instance of DefaultDatetimeProperty class. - * - * @param value the value value to set. - */ - @Generated - public DefaultDatetimeProperty(OffsetDateTime value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public OffsetDateTime getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("value", - this.value == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.value)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DefaultDatetimeProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DefaultDatetimeProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DefaultDatetimeProperty. - */ - @Generated - public static DefaultDatetimeProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OffsetDateTime value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new DefaultDatetimeProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc3339DatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc3339DatetimeProperty.java deleted file mode 100644 index abad518e36c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc3339DatetimeProperty.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; - -/** - * The Rfc3339DatetimeProperty model. - */ -@Immutable -public final class Rfc3339DatetimeProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final OffsetDateTime value; - - /** - * Creates an instance of Rfc3339DatetimeProperty class. - * - * @param value the value value to set. - */ - @Generated - public Rfc3339DatetimeProperty(OffsetDateTime value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public OffsetDateTime getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("value", - this.value == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.value)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Rfc3339DatetimeProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Rfc3339DatetimeProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Rfc3339DatetimeProperty. - */ - @Generated - public static Rfc3339DatetimeProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OffsetDateTime value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new Rfc3339DatetimeProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc7231DatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc7231DatetimeProperty.java deleted file mode 100644 index 2068cb42930..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc7231DatetimeProperty.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Objects; - -/** - * The Rfc7231DatetimeProperty model. - */ -@Immutable -public final class Rfc7231DatetimeProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final DateTimeRfc1123 value; - - /** - * Creates an instance of Rfc7231DatetimeProperty class. - * - * @param value the value value to set. - */ - @Generated - public Rfc7231DatetimeProperty(OffsetDateTime value) { - if (value == null) { - this.value = null; - } else { - this.value = new DateTimeRfc1123(value); - } - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public OffsetDateTime getValue() { - if (this.value == null) { - return null; - } - return this.value.getDateTime(); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("value", Objects.toString(this.value, null)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Rfc7231DatetimeProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Rfc7231DatetimeProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Rfc7231DatetimeProperty. - */ - @Generated - public static Rfc7231DatetimeProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OffsetDateTime value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - DateTimeRfc1123 valueHolder - = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); - if (valueHolder != null) { - value = valueHolder.getDateTime(); - } - } else { - reader.skipChildren(); - } - } - return new Rfc7231DatetimeProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampArrayDatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampArrayDatetimeProperty.java deleted file mode 100644 index 1e5b108155e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampArrayDatetimeProperty.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Instant; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.util.List; - -/** - * The UnixTimestampArrayDatetimeProperty model. - */ -@Immutable -public final class UnixTimestampArrayDatetimeProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final List value; - - /** - * Creates an instance of UnixTimestampArrayDatetimeProperty class. - * - * @param value the value value to set. - */ - @Generated - public UnixTimestampArrayDatetimeProperty(List value) { - if (value == null) { - this.value = null; - } else { - this.value = value.stream().map(el -> el.toEpochSecond()).collect(java.util.stream.Collectors.toList()); - } - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public List getValue() { - if (this.value == null) { - return null; - } - return this.value.stream() - .map(el -> OffsetDateTime.ofInstant(Instant.ofEpochSecond(el), ZoneOffset.UTC)) - .collect(java.util.stream.Collectors.toList()); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeLong(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnixTimestampArrayDatetimeProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnixTimestampArrayDatetimeProperty if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UnixTimestampArrayDatetimeProperty. - */ - @Generated - public static UnixTimestampArrayDatetimeProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.readArray( - reader1 -> OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader1.getLong()), ZoneOffset.UTC)); - } else { - reader.skipChildren(); - } - } - return new UnixTimestampArrayDatetimeProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampDatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampDatetimeProperty.java deleted file mode 100644 index 40c63f11ff7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampDatetimeProperty.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Instant; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; - -/** - * The UnixTimestampDatetimeProperty model. - */ -@Immutable -public final class UnixTimestampDatetimeProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final long value; - - /** - * Creates an instance of UnixTimestampDatetimeProperty class. - * - * @param value the value value to set. - */ - @Generated - public UnixTimestampDatetimeProperty(OffsetDateTime value) { - if (value == null) { - this.value = 0L; - } else { - this.value = value.toEpochSecond(); - } - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public OffsetDateTime getValue() { - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.value), ZoneOffset.UTC); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeLongField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnixTimestampDatetimeProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnixTimestampDatetimeProperty if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UnixTimestampDatetimeProperty. - */ - @Generated - public static UnixTimestampDatetimeProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OffsetDateTime value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader.getLong()), ZoneOffset.UTC); - } else { - reader.skipChildren(); - } - } - return new UnixTimestampDatetimeProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/package-info.java deleted file mode 100644 index 0174989392e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for DatetimeModel. - * Test for encode decorator on datetime. - * - */ -package encode.datetime.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/package-info.java deleted file mode 100644 index e580dd8644e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for DatetimeModel. - * Test for encode decorator on datetime. - * - */ -package encode.datetime; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/DurationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/DurationClientBuilder.java deleted file mode 100644 index 13a7e3b79bc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/DurationClientBuilder.java +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import encode.duration.implementation.DurationClientImpl; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the DurationClient type. - */ -@ServiceClientBuilder( - serviceClients = { - QueryClient.class, - PropertyClient.class, - HeaderClient.class, - QueryAsyncClient.class, - PropertyAsyncClient.class, - HeaderAsyncClient.class }) -public final class DurationClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("encode-duration.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the DurationClientBuilder. - */ - @Generated - public DurationClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DurationClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the DurationClientBuilder. - */ - @Generated - public DurationClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of DurationClientImpl with the provided parameters. - * - * @return an instance of DurationClientImpl. - */ - @Generated - private DurationClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - DurationClientImpl client - = new DurationClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of QueryAsyncClient class. - * - * @return an instance of QueryAsyncClient. - */ - @Generated - public QueryAsyncClient buildQueryAsyncClient() { - return new QueryAsyncClient(buildInnerClient().getQueries()); - } - - /** - * Builds an instance of PropertyAsyncClient class. - * - * @return an instance of PropertyAsyncClient. - */ - @Generated - public PropertyAsyncClient buildPropertyAsyncClient() { - return new PropertyAsyncClient(buildInnerClient().getProperties()); - } - - /** - * Builds an instance of HeaderAsyncClient class. - * - * @return an instance of HeaderAsyncClient. - */ - @Generated - public HeaderAsyncClient buildHeaderAsyncClient() { - return new HeaderAsyncClient(buildInnerClient().getHeaders()); - } - - /** - * Builds an instance of QueryClient class. - * - * @return an instance of QueryClient. - */ - @Generated - public QueryClient buildQueryClient() { - return new QueryClient(buildInnerClient().getQueries()); - } - - /** - * Builds an instance of PropertyClient class. - * - * @return an instance of PropertyClient. - */ - @Generated - public PropertyClient buildPropertyClient() { - return new PropertyClient(buildInnerClient().getProperties()); - } - - /** - * Builds an instance of HeaderClient class. - * - * @return an instance of HeaderClient. - */ - @Generated - public HeaderClient buildHeaderClient() { - return new HeaderClient(buildInnerClient().getHeaders()); - } - - private static final ClientLogger LOGGER = new ClientLogger(DurationClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderAsyncClient.java deleted file mode 100644 index 6d626edacb1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderAsyncClient.java +++ /dev/null @@ -1,560 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import encode.duration.implementation.HeadersImpl; -import java.time.Duration; -import java.util.List; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous DurationClient type. - */ -@ServiceClient(builder = DurationClientBuilder.class, isAsync = true) -public final class HeaderAsyncClient { - @Generated - private final HeadersImpl serviceClient; - - /** - * Initializes an instance of HeaderAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - HeaderAsyncClient(HeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponseAsync(duration, requestOptions); - } - - /** - * The iso8601 operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> iso8601WithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.iso8601WithResponseAsync(duration, requestOptions); - } - - /** - * The iso8601Array operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> iso8601ArrayWithResponse(List duration, RequestOptions requestOptions) { - return this.serviceClient.iso8601ArrayWithResponseAsync(duration, requestOptions); - } - - /** - * The int32Seconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsWithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsWithResponseAsync(duration, requestOptions); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsLargerUnitWithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsLargerUnitWithResponseAsync(duration, requestOptions); - } - - /** - * The floatSeconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsWithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsWithResponseAsync(duration, requestOptions); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsLargerUnitWithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsLargerUnitWithResponseAsync(duration, requestOptions); - } - - /** - * The float64Seconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> float64SecondsWithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.float64SecondsWithResponseAsync(duration, requestOptions); - } - - /** - * The int32Milliseconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsWithResponse(int duration, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsWithResponseAsync(duration, requestOptions); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsLargerUnitWithResponse(int duration, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsLargerUnitWithResponseAsync(duration, requestOptions); - } - - /** - * The floatMilliseconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsWithResponse(double duration, RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsWithResponseAsync(duration, requestOptions); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsLargerUnitWithResponse(double duration, - RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsLargerUnitWithResponseAsync(duration, requestOptions); - } - - /** - * The float64Milliseconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> float64MillisecondsWithResponse(double duration, RequestOptions requestOptions) { - return this.serviceClient.float64MillisecondsWithResponseAsync(duration, requestOptions); - } - - /** - * The int32MillisecondsArray operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsArrayWithResponse(List duration, - RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsArrayWithResponseAsync(duration, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono defaultMethod(Duration duration) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The iso8601 operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono iso8601(Duration duration) { - // Generated convenience method for iso8601WithResponse - RequestOptions requestOptions = new RequestOptions(); - return iso8601WithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The iso8601Array operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono iso8601Array(List duration) { - // Generated convenience method for iso8601ArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return iso8601ArrayWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The int32Seconds operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32Seconds(Duration duration) { - // Generated convenience method for int32SecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32SecondsWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32SecondsLargerUnit(Duration duration) { - // Generated convenience method for int32SecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32SecondsLargerUnitWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The floatSeconds operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono floatSeconds(Duration duration) { - // Generated convenience method for floatSecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatSecondsWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono floatSecondsLargerUnit(Duration duration) { - // Generated convenience method for floatSecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatSecondsLargerUnitWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The float64Seconds operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono float64Seconds(Duration duration) { - // Generated convenience method for float64SecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return float64SecondsWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The int32Milliseconds operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32Milliseconds(int duration) { - // Generated convenience method for int32MillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32MillisecondsWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32MillisecondsLargerUnit(int duration) { - // Generated convenience method for int32MillisecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32MillisecondsLargerUnitWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The floatMilliseconds operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono floatMilliseconds(double duration) { - // Generated convenience method for floatMillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatMillisecondsWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono floatMillisecondsLargerUnit(double duration) { - // Generated convenience method for floatMillisecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatMillisecondsLargerUnitWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The float64Milliseconds operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono float64Milliseconds(double duration) { - // Generated convenience method for float64MillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return float64MillisecondsWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The int32MillisecondsArray operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32MillisecondsArray(List duration) { - // Generated convenience method for int32MillisecondsArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32MillisecondsArrayWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderClient.java deleted file mode 100644 index 710d085edcb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderClient.java +++ /dev/null @@ -1,542 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import encode.duration.implementation.HeadersImpl; -import java.time.Duration; -import java.util.List; - -/** - * Initializes a new instance of the synchronous DurationClient type. - */ -@ServiceClient(builder = DurationClientBuilder.class) -public final class HeaderClient { - @Generated - private final HeadersImpl serviceClient; - - /** - * Initializes an instance of HeaderClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - HeaderClient(HeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponse(duration, requestOptions); - } - - /** - * The iso8601 operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response iso8601WithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.iso8601WithResponse(duration, requestOptions); - } - - /** - * The iso8601Array operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response iso8601ArrayWithResponse(List duration, RequestOptions requestOptions) { - return this.serviceClient.iso8601ArrayWithResponse(duration, requestOptions); - } - - /** - * The int32Seconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsWithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsWithResponse(duration, requestOptions); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsLargerUnitWithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsLargerUnitWithResponse(duration, requestOptions); - } - - /** - * The floatSeconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsWithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsWithResponse(duration, requestOptions); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsLargerUnitWithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsLargerUnitWithResponse(duration, requestOptions); - } - - /** - * The float64Seconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response float64SecondsWithResponse(Duration duration, RequestOptions requestOptions) { - return this.serviceClient.float64SecondsWithResponse(duration, requestOptions); - } - - /** - * The int32Milliseconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsWithResponse(int duration, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsWithResponse(duration, requestOptions); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsLargerUnitWithResponse(int duration, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsLargerUnitWithResponse(duration, requestOptions); - } - - /** - * The floatMilliseconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsWithResponse(double duration, RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsWithResponse(duration, requestOptions); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsLargerUnitWithResponse(double duration, RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsLargerUnitWithResponse(duration, requestOptions); - } - - /** - * The float64Milliseconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response float64MillisecondsWithResponse(double duration, RequestOptions requestOptions) { - return this.serviceClient.float64MillisecondsWithResponse(duration, requestOptions); - } - - /** - * The int32MillisecondsArray operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsArrayWithResponse(List duration, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsArrayWithResponse(duration, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void defaultMethod(Duration duration) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - defaultMethodWithResponse(duration, requestOptions).getValue(); - } - - /** - * The iso8601 operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void iso8601(Duration duration) { - // Generated convenience method for iso8601WithResponse - RequestOptions requestOptions = new RequestOptions(); - iso8601WithResponse(duration, requestOptions).getValue(); - } - - /** - * The iso8601Array operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void iso8601Array(List duration) { - // Generated convenience method for iso8601ArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - iso8601ArrayWithResponse(duration, requestOptions).getValue(); - } - - /** - * The int32Seconds operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void int32Seconds(Duration duration) { - // Generated convenience method for int32SecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - int32SecondsWithResponse(duration, requestOptions).getValue(); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void int32SecondsLargerUnit(Duration duration) { - // Generated convenience method for int32SecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - int32SecondsLargerUnitWithResponse(duration, requestOptions).getValue(); - } - - /** - * The floatSeconds operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void floatSeconds(Duration duration) { - // Generated convenience method for floatSecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - floatSecondsWithResponse(duration, requestOptions).getValue(); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void floatSecondsLargerUnit(Duration duration) { - // Generated convenience method for floatSecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - floatSecondsLargerUnitWithResponse(duration, requestOptions).getValue(); - } - - /** - * The float64Seconds operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void float64Seconds(Duration duration) { - // Generated convenience method for float64SecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - float64SecondsWithResponse(duration, requestOptions).getValue(); - } - - /** - * The int32Milliseconds operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void int32Milliseconds(int duration) { - // Generated convenience method for int32MillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - int32MillisecondsWithResponse(duration, requestOptions).getValue(); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void int32MillisecondsLargerUnit(int duration) { - // Generated convenience method for int32MillisecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - int32MillisecondsLargerUnitWithResponse(duration, requestOptions).getValue(); - } - - /** - * The floatMilliseconds operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void floatMilliseconds(double duration) { - // Generated convenience method for floatMillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - floatMillisecondsWithResponse(duration, requestOptions).getValue(); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void floatMillisecondsLargerUnit(double duration) { - // Generated convenience method for floatMillisecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - floatMillisecondsLargerUnitWithResponse(duration, requestOptions).getValue(); - } - - /** - * The float64Milliseconds operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void float64Milliseconds(double duration) { - // Generated convenience method for float64MillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - float64MillisecondsWithResponse(duration, requestOptions).getValue(); - } - - /** - * The int32MillisecondsArray operation. - * - * @param duration The duration parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void int32MillisecondsArray(List duration) { - // Generated convenience method for int32MillisecondsArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - int32MillisecondsArrayWithResponse(duration, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyAsyncClient.java deleted file mode 100644 index ddebcb7d99d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyAsyncClient.java +++ /dev/null @@ -1,871 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import encode.duration.implementation.PropertiesImpl; -import encode.duration.property.models.DefaultDurationProperty; -import encode.duration.property.models.Float64MillisecondsDurationProperty; -import encode.duration.property.models.Float64SecondsDurationProperty; -import encode.duration.property.models.FloatMillisecondsDurationArrayProperty; -import encode.duration.property.models.FloatMillisecondsDurationProperty; -import encode.duration.property.models.FloatMillisecondsLargerUnitDurationProperty; -import encode.duration.property.models.FloatSecondsDurationArrayProperty; -import encode.duration.property.models.FloatSecondsDurationProperty; -import encode.duration.property.models.FloatSecondsLargerUnitDurationProperty; -import encode.duration.property.models.ISO8601DurationProperty; -import encode.duration.property.models.Int32MillisecondsDurationProperty; -import encode.duration.property.models.Int32MillisecondsLargerUnitDurationProperty; -import encode.duration.property.models.Int32SecondsDurationProperty; -import encode.duration.property.models.Int32SecondsLargerUnitDurationProperty; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous DurationClient type. - */ -@ServiceClient(builder = DurationClientBuilder.class, isAsync = true) -public final class PropertyAsyncClient { - @Generated - private final PropertiesImpl serviceClient; - - /** - * Initializes an instance of PropertyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PropertyAsyncClient(PropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponseAsync(body, requestOptions); - } - - /** - * The iso8601 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> iso8601WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.iso8601WithResponseAsync(body, requestOptions); - } - - /** - * The int32Seconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsWithResponseAsync(body, requestOptions); - } - - /** - * The floatSeconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsWithResponseAsync(body, requestOptions); - } - - /** - * The float64Seconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> float64SecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.float64SecondsWithResponseAsync(body, requestOptions); - } - - /** - * The int32Milliseconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsWithResponseAsync(body, requestOptions); - } - - /** - * The floatMilliseconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsWithResponseAsync(body, requestOptions); - } - - /** - * The float64Milliseconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> float64MillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.float64MillisecondsWithResponseAsync(body, requestOptions); - } - - /** - * The floatSecondsArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsArrayWithResponseAsync(body, requestOptions); - } - - /** - * The floatMillisecondsArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsArrayWithResponse(BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsArrayWithResponseAsync(body, requestOptions); - } - - /** - * The int32SecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsLargerUnitWithResponse(BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.int32SecondsLargerUnitWithResponseAsync(body, requestOptions); - } - - /** - * The floatSecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsLargerUnitWithResponse(BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.floatSecondsLargerUnitWithResponseAsync(body, requestOptions); - } - - /** - * The int32MillisecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsLargerUnitWithResponse(BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsLargerUnitWithResponseAsync(body, requestOptions); - } - - /** - * The floatMillisecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsLargerUnitWithResponse(BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsLargerUnitWithResponseAsync(body, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono defaultMethod(DefaultDurationProperty body) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DefaultDurationProperty.class)); - } - - /** - * The iso8601 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono iso8601(ISO8601DurationProperty body) { - // Generated convenience method for iso8601WithResponse - RequestOptions requestOptions = new RequestOptions(); - return iso8601WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ISO8601DurationProperty.class)); - } - - /** - * The int32Seconds operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32Seconds(Int32SecondsDurationProperty body) { - // Generated convenience method for int32SecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32SecondsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Int32SecondsDurationProperty.class)); - } - - /** - * The floatSeconds operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono floatSeconds(FloatSecondsDurationProperty body) { - // Generated convenience method for floatSecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatSecondsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FloatSecondsDurationProperty.class)); - } - - /** - * The float64Seconds operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono float64Seconds(Float64SecondsDurationProperty body) { - // Generated convenience method for float64SecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return float64SecondsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Float64SecondsDurationProperty.class)); - } - - /** - * The int32Milliseconds operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32Milliseconds(Int32MillisecondsDurationProperty body) { - // Generated convenience method for int32MillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32MillisecondsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Int32MillisecondsDurationProperty.class)); - } - - /** - * The floatMilliseconds operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono floatMilliseconds(FloatMillisecondsDurationProperty body) { - // Generated convenience method for floatMillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatMillisecondsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FloatMillisecondsDurationProperty.class)); - } - - /** - * The float64Milliseconds operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono float64Milliseconds(Float64MillisecondsDurationProperty body) { - // Generated convenience method for float64MillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return float64MillisecondsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Float64MillisecondsDurationProperty.class)); - } - - /** - * The floatSecondsArray operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono floatSecondsArray(FloatSecondsDurationArrayProperty body) { - // Generated convenience method for floatSecondsArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatSecondsArrayWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FloatSecondsDurationArrayProperty.class)); - } - - /** - * The floatMillisecondsArray operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono - floatMillisecondsArray(FloatMillisecondsDurationArrayProperty body) { - // Generated convenience method for floatMillisecondsArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatMillisecondsArrayWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FloatMillisecondsDurationArrayProperty.class)); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono - int32SecondsLargerUnit(Int32SecondsLargerUnitDurationProperty body) { - // Generated convenience method for int32SecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32SecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Int32SecondsLargerUnitDurationProperty.class)); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono - floatSecondsLargerUnit(FloatSecondsLargerUnitDurationProperty body) { - // Generated convenience method for floatSecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatSecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FloatSecondsLargerUnitDurationProperty.class)); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono - int32MillisecondsLargerUnit(Int32MillisecondsLargerUnitDurationProperty body) { - // Generated convenience method for int32MillisecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32MillisecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Int32MillisecondsLargerUnitDurationProperty.class)); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono - floatMillisecondsLargerUnit(FloatMillisecondsLargerUnitDurationProperty body) { - // Generated convenience method for floatMillisecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatMillisecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FloatMillisecondsLargerUnitDurationProperty.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyClient.java deleted file mode 100644 index c175283374f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyClient.java +++ /dev/null @@ -1,861 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import encode.duration.implementation.PropertiesImpl; -import encode.duration.property.models.DefaultDurationProperty; -import encode.duration.property.models.Float64MillisecondsDurationProperty; -import encode.duration.property.models.Float64SecondsDurationProperty; -import encode.duration.property.models.FloatMillisecondsDurationArrayProperty; -import encode.duration.property.models.FloatMillisecondsDurationProperty; -import encode.duration.property.models.FloatMillisecondsLargerUnitDurationProperty; -import encode.duration.property.models.FloatSecondsDurationArrayProperty; -import encode.duration.property.models.FloatSecondsDurationProperty; -import encode.duration.property.models.FloatSecondsLargerUnitDurationProperty; -import encode.duration.property.models.ISO8601DurationProperty; -import encode.duration.property.models.Int32MillisecondsDurationProperty; -import encode.duration.property.models.Int32MillisecondsLargerUnitDurationProperty; -import encode.duration.property.models.Int32SecondsDurationProperty; -import encode.duration.property.models.Int32SecondsLargerUnitDurationProperty; - -/** - * Initializes a new instance of the synchronous DurationClient type. - */ -@ServiceClient(builder = DurationClientBuilder.class) -public final class PropertyClient { - @Generated - private final PropertiesImpl serviceClient; - - /** - * Initializes an instance of PropertyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PropertyClient(PropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponse(body, requestOptions); - } - - /** - * The iso8601 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response iso8601WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.iso8601WithResponse(body, requestOptions); - } - - /** - * The int32Seconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsWithResponse(body, requestOptions); - } - - /** - * The floatSeconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsWithResponse(body, requestOptions); - } - - /** - * The float64Seconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response float64SecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.float64SecondsWithResponse(body, requestOptions); - } - - /** - * The int32Milliseconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsWithResponse(body, requestOptions); - } - - /** - * The floatMilliseconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsWithResponse(body, requestOptions); - } - - /** - * The float64Milliseconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response float64MillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.float64MillisecondsWithResponse(body, requestOptions); - } - - /** - * The floatSecondsArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsArrayWithResponse(body, requestOptions); - } - - /** - * The floatMillisecondsArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsArrayWithResponse(body, requestOptions); - } - - /** - * The int32SecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsLargerUnitWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsLargerUnitWithResponse(body, requestOptions); - } - - /** - * The floatSecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsLargerUnitWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsLargerUnitWithResponse(body, requestOptions); - } - - /** - * The int32MillisecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsLargerUnitWithResponse(BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsLargerUnitWithResponse(body, requestOptions); - } - - /** - * The floatMillisecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsLargerUnitWithResponse(BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsLargerUnitWithResponse(body, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DefaultDurationProperty defaultMethod(DefaultDurationProperty body) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(DefaultDurationProperty.class); - } - - /** - * The iso8601 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ISO8601DurationProperty iso8601(ISO8601DurationProperty body) { - // Generated convenience method for iso8601WithResponse - RequestOptions requestOptions = new RequestOptions(); - return iso8601WithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(ISO8601DurationProperty.class); - } - - /** - * The int32Seconds operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Int32SecondsDurationProperty int32Seconds(Int32SecondsDurationProperty body) { - // Generated convenience method for int32SecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32SecondsWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Int32SecondsDurationProperty.class); - } - - /** - * The floatSeconds operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FloatSecondsDurationProperty floatSeconds(FloatSecondsDurationProperty body) { - // Generated convenience method for floatSecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatSecondsWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(FloatSecondsDurationProperty.class); - } - - /** - * The float64Seconds operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Float64SecondsDurationProperty float64Seconds(Float64SecondsDurationProperty body) { - // Generated convenience method for float64SecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return float64SecondsWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Float64SecondsDurationProperty.class); - } - - /** - * The int32Milliseconds operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Int32MillisecondsDurationProperty int32Milliseconds(Int32MillisecondsDurationProperty body) { - // Generated convenience method for int32MillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32MillisecondsWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Int32MillisecondsDurationProperty.class); - } - - /** - * The floatMilliseconds operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FloatMillisecondsDurationProperty floatMilliseconds(FloatMillisecondsDurationProperty body) { - // Generated convenience method for floatMillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatMillisecondsWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(FloatMillisecondsDurationProperty.class); - } - - /** - * The float64Milliseconds operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Float64MillisecondsDurationProperty float64Milliseconds(Float64MillisecondsDurationProperty body) { - // Generated convenience method for float64MillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return float64MillisecondsWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Float64MillisecondsDurationProperty.class); - } - - /** - * The floatSecondsArray operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FloatSecondsDurationArrayProperty floatSecondsArray(FloatSecondsDurationArrayProperty body) { - // Generated convenience method for floatSecondsArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatSecondsArrayWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(FloatSecondsDurationArrayProperty.class); - } - - /** - * The floatMillisecondsArray operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FloatMillisecondsDurationArrayProperty floatMillisecondsArray(FloatMillisecondsDurationArrayProperty body) { - // Generated convenience method for floatMillisecondsArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatMillisecondsArrayWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(FloatMillisecondsDurationArrayProperty.class); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Int32SecondsLargerUnitDurationProperty int32SecondsLargerUnit(Int32SecondsLargerUnitDurationProperty body) { - // Generated convenience method for int32SecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32SecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Int32SecondsLargerUnitDurationProperty.class); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FloatSecondsLargerUnitDurationProperty floatSecondsLargerUnit(FloatSecondsLargerUnitDurationProperty body) { - // Generated convenience method for floatSecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatSecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(FloatSecondsLargerUnitDurationProperty.class); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Int32MillisecondsLargerUnitDurationProperty - int32MillisecondsLargerUnit(Int32MillisecondsLargerUnitDurationProperty body) { - // Generated convenience method for int32MillisecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32MillisecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Int32MillisecondsLargerUnitDurationProperty.class); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FloatMillisecondsLargerUnitDurationProperty - floatMillisecondsLargerUnit(FloatMillisecondsLargerUnitDurationProperty body) { - // Generated convenience method for floatMillisecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatMillisecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(FloatMillisecondsLargerUnitDurationProperty.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryAsyncClient.java deleted file mode 100644 index c376be68fe2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryAsyncClient.java +++ /dev/null @@ -1,558 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import encode.duration.implementation.QueriesImpl; -import java.time.Duration; -import java.util.List; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous DurationClient type. - */ -@ServiceClient(builder = DurationClientBuilder.class, isAsync = true) -public final class QueryAsyncClient { - @Generated - private final QueriesImpl serviceClient; - - /** - * Initializes an instance of QueryAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryAsyncClient(QueriesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponseAsync(input, requestOptions); - } - - /** - * The iso8601 operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> iso8601WithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.iso8601WithResponseAsync(input, requestOptions); - } - - /** - * The int32Seconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsWithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsWithResponseAsync(input, requestOptions); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsLargerUnitWithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsLargerUnitWithResponseAsync(input, requestOptions); - } - - /** - * The floatSeconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsWithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsWithResponseAsync(input, requestOptions); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsLargerUnitWithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsLargerUnitWithResponseAsync(input, requestOptions); - } - - /** - * The float64Seconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> float64SecondsWithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.float64SecondsWithResponseAsync(input, requestOptions); - } - - /** - * The int32Milliseconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsWithResponse(int input, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsWithResponseAsync(input, requestOptions); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsLargerUnitWithResponse(int input, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsLargerUnitWithResponseAsync(input, requestOptions); - } - - /** - * The floatMilliseconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsWithResponse(double input, RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsWithResponseAsync(input, requestOptions); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsLargerUnitWithResponse(double input, RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsLargerUnitWithResponseAsync(input, requestOptions); - } - - /** - * The float64Milliseconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> float64MillisecondsWithResponse(double input, RequestOptions requestOptions) { - return this.serviceClient.float64MillisecondsWithResponseAsync(input, requestOptions); - } - - /** - * The int32SecondsArray operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsArrayWithResponse(List input, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsArrayWithResponseAsync(input, requestOptions); - } - - /** - * The int32MillisecondsArray operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsArrayWithResponse(List input, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsArrayWithResponseAsync(input, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono defaultMethod(Duration input) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defaultMethodWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The iso8601 operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono iso8601(Duration input) { - // Generated convenience method for iso8601WithResponse - RequestOptions requestOptions = new RequestOptions(); - return iso8601WithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The int32Seconds operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32Seconds(Duration input) { - // Generated convenience method for int32SecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32SecondsWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32SecondsLargerUnit(Duration input) { - // Generated convenience method for int32SecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32SecondsLargerUnitWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The floatSeconds operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono floatSeconds(Duration input) { - // Generated convenience method for floatSecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatSecondsWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono floatSecondsLargerUnit(Duration input) { - // Generated convenience method for floatSecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatSecondsLargerUnitWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The float64Seconds operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono float64Seconds(Duration input) { - // Generated convenience method for float64SecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return float64SecondsWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The int32Milliseconds operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32Milliseconds(int input) { - // Generated convenience method for int32MillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32MillisecondsWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32MillisecondsLargerUnit(int input) { - // Generated convenience method for int32MillisecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32MillisecondsLargerUnitWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The floatMilliseconds operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono floatMilliseconds(double input) { - // Generated convenience method for floatMillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatMillisecondsWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono floatMillisecondsLargerUnit(double input) { - // Generated convenience method for floatMillisecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatMillisecondsLargerUnitWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The float64Milliseconds operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono float64Milliseconds(double input) { - // Generated convenience method for float64MillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return float64MillisecondsWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The int32SecondsArray operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32SecondsArray(List input) { - // Generated convenience method for int32SecondsArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32SecondsArrayWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The int32MillisecondsArray operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono int32MillisecondsArray(List input) { - // Generated convenience method for int32MillisecondsArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return int32MillisecondsArrayWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryClient.java deleted file mode 100644 index 1c68bee8ba5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryClient.java +++ /dev/null @@ -1,542 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import encode.duration.implementation.QueriesImpl; -import java.time.Duration; -import java.util.List; - -/** - * Initializes a new instance of the synchronous DurationClient type. - */ -@ServiceClient(builder = DurationClientBuilder.class) -public final class QueryClient { - @Generated - private final QueriesImpl serviceClient; - - /** - * Initializes an instance of QueryClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryClient(QueriesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The defaultMethod operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.defaultMethodWithResponse(input, requestOptions); - } - - /** - * The iso8601 operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response iso8601WithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.iso8601WithResponse(input, requestOptions); - } - - /** - * The int32Seconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsWithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsWithResponse(input, requestOptions); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsLargerUnitWithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsLargerUnitWithResponse(input, requestOptions); - } - - /** - * The floatSeconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsWithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsWithResponse(input, requestOptions); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsLargerUnitWithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.floatSecondsLargerUnitWithResponse(input, requestOptions); - } - - /** - * The float64Seconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response float64SecondsWithResponse(Duration input, RequestOptions requestOptions) { - return this.serviceClient.float64SecondsWithResponse(input, requestOptions); - } - - /** - * The int32Milliseconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsWithResponse(int input, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsWithResponse(input, requestOptions); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsLargerUnitWithResponse(int input, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsLargerUnitWithResponse(input, requestOptions); - } - - /** - * The floatMilliseconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsWithResponse(double input, RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsWithResponse(input, requestOptions); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsLargerUnitWithResponse(double input, RequestOptions requestOptions) { - return this.serviceClient.floatMillisecondsLargerUnitWithResponse(input, requestOptions); - } - - /** - * The float64Milliseconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response float64MillisecondsWithResponse(double input, RequestOptions requestOptions) { - return this.serviceClient.float64MillisecondsWithResponse(input, requestOptions); - } - - /** - * The int32SecondsArray operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsArrayWithResponse(List input, RequestOptions requestOptions) { - return this.serviceClient.int32SecondsArrayWithResponse(input, requestOptions); - } - - /** - * The int32MillisecondsArray operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsArrayWithResponse(List input, RequestOptions requestOptions) { - return this.serviceClient.int32MillisecondsArrayWithResponse(input, requestOptions); - } - - /** - * The defaultMethod operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void defaultMethod(Duration input) { - // Generated convenience method for defaultMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - defaultMethodWithResponse(input, requestOptions).getValue(); - } - - /** - * The iso8601 operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void iso8601(Duration input) { - // Generated convenience method for iso8601WithResponse - RequestOptions requestOptions = new RequestOptions(); - iso8601WithResponse(input, requestOptions).getValue(); - } - - /** - * The int32Seconds operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void int32Seconds(Duration input) { - // Generated convenience method for int32SecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - int32SecondsWithResponse(input, requestOptions).getValue(); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void int32SecondsLargerUnit(Duration input) { - // Generated convenience method for int32SecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - int32SecondsLargerUnitWithResponse(input, requestOptions).getValue(); - } - - /** - * The floatSeconds operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void floatSeconds(Duration input) { - // Generated convenience method for floatSecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - floatSecondsWithResponse(input, requestOptions).getValue(); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void floatSecondsLargerUnit(Duration input) { - // Generated convenience method for floatSecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - floatSecondsLargerUnitWithResponse(input, requestOptions).getValue(); - } - - /** - * The float64Seconds operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void float64Seconds(Duration input) { - // Generated convenience method for float64SecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - float64SecondsWithResponse(input, requestOptions).getValue(); - } - - /** - * The int32Milliseconds operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void int32Milliseconds(int input) { - // Generated convenience method for int32MillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - int32MillisecondsWithResponse(input, requestOptions).getValue(); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void int32MillisecondsLargerUnit(int input) { - // Generated convenience method for int32MillisecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - int32MillisecondsLargerUnitWithResponse(input, requestOptions).getValue(); - } - - /** - * The floatMilliseconds operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void floatMilliseconds(double input) { - // Generated convenience method for floatMillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - floatMillisecondsWithResponse(input, requestOptions).getValue(); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void floatMillisecondsLargerUnit(double input) { - // Generated convenience method for floatMillisecondsLargerUnitWithResponse - RequestOptions requestOptions = new RequestOptions(); - floatMillisecondsLargerUnitWithResponse(input, requestOptions).getValue(); - } - - /** - * The float64Milliseconds operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void float64Milliseconds(double input) { - // Generated convenience method for float64MillisecondsWithResponse - RequestOptions requestOptions = new RequestOptions(); - float64MillisecondsWithResponse(input, requestOptions).getValue(); - } - - /** - * The int32SecondsArray operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void int32SecondsArray(List input) { - // Generated convenience method for int32SecondsArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - int32SecondsArrayWithResponse(input, requestOptions).getValue(); - } - - /** - * The int32MillisecondsArray operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void int32MillisecondsArray(List input) { - // Generated convenience method for int32MillisecondsArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - int32MillisecondsArrayWithResponse(input, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/DurationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/DurationClientImpl.java deleted file mode 100644 index 64829d228e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/DurationClientImpl.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 DurationClient type. - */ -public final class DurationClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 QueriesImpl object to access its operations. - */ - private final QueriesImpl queries; - - /** - * Gets the QueriesImpl object to access its operations. - * - * @return the QueriesImpl object. - */ - public QueriesImpl getQueries() { - return this.queries; - } - - /** - * The PropertiesImpl object to access its operations. - */ - private final PropertiesImpl properties; - - /** - * Gets the PropertiesImpl object to access its operations. - * - * @return the PropertiesImpl object. - */ - public PropertiesImpl getProperties() { - return this.properties; - } - - /** - * The HeadersImpl object to access its operations. - */ - private final HeadersImpl headers; - - /** - * Gets the HeadersImpl object to access its operations. - * - * @return the HeadersImpl object. - */ - public HeadersImpl getHeaders() { - return this.headers; - } - - /** - * Initializes an instance of DurationClient client. - * - * @param endpoint Service host. - */ - public DurationClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DurationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public DurationClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DurationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public DurationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.queries = new QueriesImpl(this); - this.properties = new PropertiesImpl(this); - this.headers = new HeadersImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/HeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/HeadersImpl.java deleted file mode 100644 index 78fc0f39e98..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/HeadersImpl.java +++ /dev/null @@ -1,804 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.CollectionFormat; -import com.azure.core.util.serializer.JacksonAdapter; -import java.time.Duration; -import java.util.List; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Headers. - */ -public final class HeadersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final HeadersService service; - - /** - * The service client containing this operation class. - */ - private final DurationClientImpl client; - - /** - * Initializes an instance of HeadersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - HeadersImpl(DurationClientImpl client) { - this.service = RestProxy.create(HeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DurationClientHeaders to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DurationClientHeaders") - public interface HeadersService { - @Get("/encode/duration/header/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> defaultMethod(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") Duration duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defaultMethodSync(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") Duration duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/iso8601") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> iso8601(@HostParam("endpoint") String endpoint, @HeaderParam("duration") Duration duration, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/iso8601") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response iso8601Sync(@HostParam("endpoint") String endpoint, @HeaderParam("duration") Duration duration, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/iso8601-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> iso8601Array(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") String duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/iso8601-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response iso8601ArraySync(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") String duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/int32-seconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32Seconds(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") long duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/int32-seconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32SecondsSync(@HostParam("endpoint") String endpoint, @HeaderParam("duration") long duration, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/int32-seconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32SecondsLargerUnit(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") long duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/int32-seconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32SecondsLargerUnitSync(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") long duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/float-seconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatSeconds(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/float-seconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatSecondsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/float-seconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatSecondsLargerUnit(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/float-seconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatSecondsLargerUnitSync(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/float64-seconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> float64Seconds(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/float64-seconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response float64SecondsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/int32-milliseconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32Milliseconds(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") int duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/int32-milliseconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32MillisecondsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") int duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/int32-milliseconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32MillisecondsLargerUnit(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") int duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/int32-milliseconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32MillisecondsLargerUnitSync(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") int duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/float-milliseconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatMilliseconds(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/float-milliseconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatMillisecondsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/float-milliseconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatMillisecondsLargerUnit(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/float-milliseconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatMillisecondsLargerUnitSync(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/float64-milliseconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> float64Milliseconds(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/float64-milliseconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response float64MillisecondsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/int32-milliseconds-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32MillisecondsArray(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") String duration, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/header/int32-milliseconds-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32MillisecondsArraySync(@HostParam("endpoint") String endpoint, - @HeaderParam("duration") String duration, RequestOptions requestOptions, Context context); - } - - /** - * The defaultMethod operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponseAsync(Duration duration, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.defaultMethod(this.client.getEndpoint(), duration, requestOptions, context)); - } - - /** - * The defaultMethod operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(Duration duration, RequestOptions requestOptions) { - return service.defaultMethodSync(this.client.getEndpoint(), duration, requestOptions, Context.NONE); - } - - /** - * The iso8601 operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> iso8601WithResponseAsync(Duration duration, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.iso8601(this.client.getEndpoint(), duration, requestOptions, context)); - } - - /** - * The iso8601 operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response iso8601WithResponse(Duration duration, RequestOptions requestOptions) { - return service.iso8601Sync(this.client.getEndpoint(), duration, requestOptions, Context.NONE); - } - - /** - * The iso8601Array operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> iso8601ArrayWithResponseAsync(List duration, RequestOptions requestOptions) { - String durationConverted - = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(duration, CollectionFormat.CSV); - return FluxUtil.withContext( - context -> service.iso8601Array(this.client.getEndpoint(), durationConverted, requestOptions, context)); - } - - /** - * The iso8601Array operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response iso8601ArrayWithResponse(List duration, RequestOptions requestOptions) { - String durationConverted - = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(duration, CollectionFormat.CSV); - return service.iso8601ArraySync(this.client.getEndpoint(), durationConverted, requestOptions, Context.NONE); - } - - /** - * The int32Seconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsWithResponseAsync(Duration duration, RequestOptions requestOptions) { - long durationConverted = duration.getSeconds(); - return FluxUtil.withContext( - context -> service.int32Seconds(this.client.getEndpoint(), durationConverted, requestOptions, context)); - } - - /** - * The int32Seconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsWithResponse(Duration duration, RequestOptions requestOptions) { - long durationConverted = duration.getSeconds(); - return service.int32SecondsSync(this.client.getEndpoint(), durationConverted, requestOptions, Context.NONE); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsLargerUnitWithResponseAsync(Duration duration, - RequestOptions requestOptions) { - long durationConverted = duration.getSeconds(); - return FluxUtil.withContext(context -> service.int32SecondsLargerUnit(this.client.getEndpoint(), - durationConverted, requestOptions, context)); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsLargerUnitWithResponse(Duration duration, RequestOptions requestOptions) { - long durationConverted = duration.getSeconds(); - return service.int32SecondsLargerUnitSync(this.client.getEndpoint(), durationConverted, requestOptions, - Context.NONE); - } - - /** - * The floatSeconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsWithResponseAsync(Duration duration, RequestOptions requestOptions) { - double durationConverted = (double) duration.toNanos() / 1000_000_000L; - return FluxUtil.withContext( - context -> service.floatSeconds(this.client.getEndpoint(), durationConverted, requestOptions, context)); - } - - /** - * The floatSeconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsWithResponse(Duration duration, RequestOptions requestOptions) { - double durationConverted = (double) duration.toNanos() / 1000_000_000L; - return service.floatSecondsSync(this.client.getEndpoint(), durationConverted, requestOptions, Context.NONE); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsLargerUnitWithResponseAsync(Duration duration, - RequestOptions requestOptions) { - double durationConverted = (double) duration.toNanos() / 1000_000_000L; - return FluxUtil.withContext(context -> service.floatSecondsLargerUnit(this.client.getEndpoint(), - durationConverted, requestOptions, context)); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsLargerUnitWithResponse(Duration duration, RequestOptions requestOptions) { - double durationConverted = (double) duration.toNanos() / 1000_000_000L; - return service.floatSecondsLargerUnitSync(this.client.getEndpoint(), durationConverted, requestOptions, - Context.NONE); - } - - /** - * The float64Seconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> float64SecondsWithResponseAsync(Duration duration, RequestOptions requestOptions) { - double durationConverted = (double) duration.toNanos() / 1000_000_000L; - return FluxUtil.withContext( - context -> service.float64Seconds(this.client.getEndpoint(), durationConverted, requestOptions, context)); - } - - /** - * The float64Seconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response float64SecondsWithResponse(Duration duration, RequestOptions requestOptions) { - double durationConverted = (double) duration.toNanos() / 1000_000_000L; - return service.float64SecondsSync(this.client.getEndpoint(), durationConverted, requestOptions, Context.NONE); - } - - /** - * The int32Milliseconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsWithResponseAsync(int duration, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.int32Milliseconds(this.client.getEndpoint(), duration, requestOptions, context)); - } - - /** - * The int32Milliseconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsWithResponse(int duration, RequestOptions requestOptions) { - return service.int32MillisecondsSync(this.client.getEndpoint(), duration, requestOptions, Context.NONE); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsLargerUnitWithResponseAsync(int duration, - RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.int32MillisecondsLargerUnit(this.client.getEndpoint(), duration, - requestOptions, context)); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsLargerUnitWithResponse(int duration, RequestOptions requestOptions) { - return service.int32MillisecondsLargerUnitSync(this.client.getEndpoint(), duration, requestOptions, - Context.NONE); - } - - /** - * The floatMilliseconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsWithResponseAsync(double duration, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.floatMilliseconds(this.client.getEndpoint(), duration, requestOptions, context)); - } - - /** - * The floatMilliseconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsWithResponse(double duration, RequestOptions requestOptions) { - return service.floatMillisecondsSync(this.client.getEndpoint(), duration, requestOptions, Context.NONE); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsLargerUnitWithResponseAsync(double duration, - RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.floatMillisecondsLargerUnit(this.client.getEndpoint(), duration, - requestOptions, context)); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsLargerUnitWithResponse(double duration, RequestOptions requestOptions) { - return service.floatMillisecondsLargerUnitSync(this.client.getEndpoint(), duration, requestOptions, - Context.NONE); - } - - /** - * The float64Milliseconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> float64MillisecondsWithResponseAsync(double duration, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.float64Milliseconds(this.client.getEndpoint(), duration, requestOptions, context)); - } - - /** - * The float64Milliseconds operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response float64MillisecondsWithResponse(double duration, RequestOptions requestOptions) { - return service.float64MillisecondsSync(this.client.getEndpoint(), duration, requestOptions, Context.NONE); - } - - /** - * The int32MillisecondsArray operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsArrayWithResponseAsync(List duration, - RequestOptions requestOptions) { - String durationConverted - = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(duration, CollectionFormat.CSV); - return FluxUtil.withContext(context -> service.int32MillisecondsArray(this.client.getEndpoint(), - durationConverted, requestOptions, context)); - } - - /** - * The int32MillisecondsArray operation. - * - * @param duration The duration parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsArrayWithResponse(List duration, RequestOptions requestOptions) { - String durationConverted - = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(duration, CollectionFormat.CSV); - return service.int32MillisecondsArraySync(this.client.getEndpoint(), durationConverted, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/PropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/PropertiesImpl.java deleted file mode 100644 index b727b536a71..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/PropertiesImpl.java +++ /dev/null @@ -1,1431 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Properties. - */ -public final class PropertiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PropertiesService service; - - /** - * The service client containing this operation class. - */ - private final DurationClientImpl client; - - /** - * Initializes an instance of PropertiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PropertiesImpl(DurationClientImpl client) { - this.service - = RestProxy.create(PropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DurationClientProperties to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DurationClientProperties") - public interface PropertiesService { - @Post("/encode/duration/property/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> defaultMethod(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defaultMethodSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/iso8601") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> iso8601(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/iso8601") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response iso8601Sync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/int32-seconds") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32Seconds(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/int32-seconds") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32SecondsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float-seconds") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatSeconds(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float-seconds") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatSecondsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float64-seconds") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> float64Seconds(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float64-seconds") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response float64SecondsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/int32-milliseconds") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32Milliseconds(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/int32-milliseconds") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32MillisecondsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float-milliseconds") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatMilliseconds(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float-milliseconds") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatMillisecondsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float64-milliseconds") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> float64Milliseconds(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float64-milliseconds") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response float64MillisecondsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float-seconds-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatSecondsArray(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float-seconds-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatSecondsArraySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float-milliseconds-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatMillisecondsArray(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float-milliseconds-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatMillisecondsArraySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/int32-seconds-larger-unit") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32SecondsLargerUnit(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/int32-seconds-larger-unit") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32SecondsLargerUnitSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float-seconds-larger-unit") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatSecondsLargerUnit(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float-seconds-larger-unit") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatSecondsLargerUnitSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/int32-milliseconds-larger-unit") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32MillisecondsLargerUnit(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/int32-milliseconds-larger-unit") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32MillisecondsLargerUnitSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float-milliseconds-larger-unit") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatMillisecondsLargerUnit(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/encode/duration/property/float-milliseconds-larger-unit") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatMillisecondsLargerUnitSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.defaultMethod(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The defaultMethod operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.defaultMethodSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The iso8601 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> iso8601WithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.iso8601(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * The iso8601 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response iso8601WithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.iso8601Sync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } - - /** - * The int32Seconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.int32Seconds(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The int32Seconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.int32SecondsSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The floatSeconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.floatSeconds(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The floatSeconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.floatSecondsSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The float64Seconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> float64SecondsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.float64Seconds(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The float64Seconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response float64SecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.float64SecondsSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The int32Milliseconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.int32Milliseconds(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The int32Milliseconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.int32MillisecondsSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The floatMilliseconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.floatMilliseconds(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The floatMilliseconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.floatMillisecondsSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The float64Milliseconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> float64MillisecondsWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.float64Milliseconds(this.client.getEndpoint(), contentType, - accept, body, requestOptions, context)); - } - - /** - * The float64Milliseconds operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response float64MillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.float64MillisecondsSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The floatSecondsArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsArrayWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.floatSecondsArray(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The floatSecondsArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.floatSecondsArraySync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The floatMillisecondsArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsArrayWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.floatMillisecondsArray(this.client.getEndpoint(), contentType, - accept, body, requestOptions, context)); - } - - /** - * The floatMillisecondsArray operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value (Required): [
-     *         double (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.floatMillisecondsArraySync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The int32SecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsLargerUnitWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.int32SecondsLargerUnit(this.client.getEndpoint(), contentType, - accept, body, requestOptions, context)); - } - - /** - * The int32SecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsLargerUnitWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.int32SecondsLargerUnitSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The floatSecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsLargerUnitWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.floatSecondsLargerUnit(this.client.getEndpoint(), contentType, - accept, body, requestOptions, context)); - } - - /** - * The floatSecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsLargerUnitWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.floatSecondsLargerUnitSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The int32MillisecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsLargerUnitWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.int32MillisecondsLargerUnit(this.client.getEndpoint(), - contentType, accept, body, requestOptions, context)); - } - - /** - * The int32MillisecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsLargerUnitWithResponse(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.int32MillisecondsLargerUnitSync(this.client.getEndpoint(), contentType, accept, body, - requestOptions, Context.NONE); - } - - /** - * The floatMillisecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsLargerUnitWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.floatMillisecondsLargerUnit(this.client.getEndpoint(), - contentType, accept, body, requestOptions, context)); - } - - /** - * The floatMillisecondsLargerUnit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsLargerUnitWithResponse(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.floatMillisecondsLargerUnitSync(this.client.getEndpoint(), contentType, accept, body, - requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/QueriesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/QueriesImpl.java deleted file mode 100644 index 3a46e23b7ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/QueriesImpl.java +++ /dev/null @@ -1,805 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.CollectionFormat; -import com.azure.core.util.serializer.JacksonAdapter; -import java.time.Duration; -import java.util.List; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Queries. - */ -public final class QueriesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final QueriesService service; - - /** - * The service client containing this operation class. - */ - private final DurationClientImpl client; - - /** - * Initializes an instance of QueriesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - QueriesImpl(DurationClientImpl client) { - this.service = RestProxy.create(QueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DurationClientQueries to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DurationClientQueries") - public interface QueriesService { - @Get("/encode/duration/query/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> defaultMethod(@HostParam("endpoint") String endpoint, @QueryParam("input") Duration input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defaultMethodSync(@HostParam("endpoint") String endpoint, @QueryParam("input") Duration input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/iso8601") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> iso8601(@HostParam("endpoint") String endpoint, @QueryParam("input") Duration input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/iso8601") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response iso8601Sync(@HostParam("endpoint") String endpoint, @QueryParam("input") Duration input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/int32-seconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32Seconds(@HostParam("endpoint") String endpoint, @QueryParam("input") long input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/int32-seconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32SecondsSync(@HostParam("endpoint") String endpoint, @QueryParam("input") long input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/int32-seconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32SecondsLargerUnit(@HostParam("endpoint") String endpoint, - @QueryParam("input") long input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/int32-seconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32SecondsLargerUnitSync(@HostParam("endpoint") String endpoint, - @QueryParam("input") long input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/float-seconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatSeconds(@HostParam("endpoint") String endpoint, @QueryParam("input") double input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/float-seconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatSecondsSync(@HostParam("endpoint") String endpoint, @QueryParam("input") double input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/float-seconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatSecondsLargerUnit(@HostParam("endpoint") String endpoint, - @QueryParam("input") double input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/float-seconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatSecondsLargerUnitSync(@HostParam("endpoint") String endpoint, - @QueryParam("input") double input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/float64-seconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> float64Seconds(@HostParam("endpoint") String endpoint, @QueryParam("input") double input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/float64-seconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response float64SecondsSync(@HostParam("endpoint") String endpoint, @QueryParam("input") double input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/int32-milliseconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32Milliseconds(@HostParam("endpoint") String endpoint, @QueryParam("input") int input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/int32-milliseconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32MillisecondsSync(@HostParam("endpoint") String endpoint, @QueryParam("input") int input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/int32-milliseconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32MillisecondsLargerUnit(@HostParam("endpoint") String endpoint, - @QueryParam("input") int input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/int32-milliseconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32MillisecondsLargerUnitSync(@HostParam("endpoint") String endpoint, - @QueryParam("input") int input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/float-milliseconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatMilliseconds(@HostParam("endpoint") String endpoint, - @QueryParam("input") double input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/float-milliseconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatMillisecondsSync(@HostParam("endpoint") String endpoint, @QueryParam("input") double input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/float-milliseconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatMillisecondsLargerUnit(@HostParam("endpoint") String endpoint, - @QueryParam("input") double input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/float-milliseconds-larger-unit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatMillisecondsLargerUnitSync(@HostParam("endpoint") String endpoint, - @QueryParam("input") double input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/float64-milliseconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> float64Milliseconds(@HostParam("endpoint") String endpoint, - @QueryParam("input") double input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/float64-milliseconds") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response float64MillisecondsSync(@HostParam("endpoint") String endpoint, - @QueryParam("input") double input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/int32-seconds-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32SecondsArray(@HostParam("endpoint") String endpoint, - @QueryParam("input") String input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/int32-seconds-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32SecondsArraySync(@HostParam("endpoint") String endpoint, @QueryParam("input") String input, - RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/int32-milliseconds-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> int32MillisecondsArray(@HostParam("endpoint") String endpoint, - @QueryParam("input") String input, RequestOptions requestOptions, Context context); - - @Get("/encode/duration/query/int32-milliseconds-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response int32MillisecondsArraySync(@HostParam("endpoint") String endpoint, - @QueryParam("input") String input, RequestOptions requestOptions, Context context); - } - - /** - * The defaultMethod operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defaultMethodWithResponseAsync(Duration input, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.defaultMethod(this.client.getEndpoint(), input, requestOptions, context)); - } - - /** - * The defaultMethod operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defaultMethodWithResponse(Duration input, RequestOptions requestOptions) { - return service.defaultMethodSync(this.client.getEndpoint(), input, requestOptions, Context.NONE); - } - - /** - * The iso8601 operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> iso8601WithResponseAsync(Duration input, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.iso8601(this.client.getEndpoint(), input, requestOptions, context)); - } - - /** - * The iso8601 operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response iso8601WithResponse(Duration input, RequestOptions requestOptions) { - return service.iso8601Sync(this.client.getEndpoint(), input, requestOptions, Context.NONE); - } - - /** - * The int32Seconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsWithResponseAsync(Duration input, RequestOptions requestOptions) { - long inputConverted = input.getSeconds(); - return FluxUtil.withContext( - context -> service.int32Seconds(this.client.getEndpoint(), inputConverted, requestOptions, context)); - } - - /** - * The int32Seconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsWithResponse(Duration input, RequestOptions requestOptions) { - long inputConverted = input.getSeconds(); - return service.int32SecondsSync(this.client.getEndpoint(), inputConverted, requestOptions, Context.NONE); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsLargerUnitWithResponseAsync(Duration input, RequestOptions requestOptions) { - long inputConverted = input.getSeconds(); - return FluxUtil.withContext(context -> service.int32SecondsLargerUnit(this.client.getEndpoint(), inputConverted, - requestOptions, context)); - } - - /** - * The int32SecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsLargerUnitWithResponse(Duration input, RequestOptions requestOptions) { - long inputConverted = input.getSeconds(); - return service.int32SecondsLargerUnitSync(this.client.getEndpoint(), inputConverted, requestOptions, - Context.NONE); - } - - /** - * The floatSeconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsWithResponseAsync(Duration input, RequestOptions requestOptions) { - double inputConverted = (double) input.toNanos() / 1000_000_000L; - return FluxUtil.withContext( - context -> service.floatSeconds(this.client.getEndpoint(), inputConverted, requestOptions, context)); - } - - /** - * The floatSeconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsWithResponse(Duration input, RequestOptions requestOptions) { - double inputConverted = (double) input.toNanos() / 1000_000_000L; - return service.floatSecondsSync(this.client.getEndpoint(), inputConverted, requestOptions, Context.NONE); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatSecondsLargerUnitWithResponseAsync(Duration input, RequestOptions requestOptions) { - double inputConverted = (double) input.toNanos() / 1000_000_000L; - return FluxUtil.withContext(context -> service.floatSecondsLargerUnit(this.client.getEndpoint(), inputConverted, - requestOptions, context)); - } - - /** - * The floatSecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatSecondsLargerUnitWithResponse(Duration input, RequestOptions requestOptions) { - double inputConverted = (double) input.toNanos() / 1000_000_000L; - return service.floatSecondsLargerUnitSync(this.client.getEndpoint(), inputConverted, requestOptions, - Context.NONE); - } - - /** - * The float64Seconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> float64SecondsWithResponseAsync(Duration input, RequestOptions requestOptions) { - double inputConverted = (double) input.toNanos() / 1000_000_000L; - return FluxUtil.withContext( - context -> service.float64Seconds(this.client.getEndpoint(), inputConverted, requestOptions, context)); - } - - /** - * The float64Seconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response float64SecondsWithResponse(Duration input, RequestOptions requestOptions) { - double inputConverted = (double) input.toNanos() / 1000_000_000L; - return service.float64SecondsSync(this.client.getEndpoint(), inputConverted, requestOptions, Context.NONE); - } - - /** - * The int32Milliseconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsWithResponseAsync(int input, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.int32Milliseconds(this.client.getEndpoint(), input, requestOptions, context)); - } - - /** - * The int32Milliseconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsWithResponse(int input, RequestOptions requestOptions) { - return service.int32MillisecondsSync(this.client.getEndpoint(), input, requestOptions, Context.NONE); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsLargerUnitWithResponseAsync(int input, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.int32MillisecondsLargerUnit(this.client.getEndpoint(), input, requestOptions, context)); - } - - /** - * The int32MillisecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsLargerUnitWithResponse(int input, RequestOptions requestOptions) { - return service.int32MillisecondsLargerUnitSync(this.client.getEndpoint(), input, requestOptions, Context.NONE); - } - - /** - * The floatMilliseconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsWithResponseAsync(double input, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.floatMilliseconds(this.client.getEndpoint(), input, requestOptions, context)); - } - - /** - * The floatMilliseconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsWithResponse(double input, RequestOptions requestOptions) { - return service.floatMillisecondsSync(this.client.getEndpoint(), input, requestOptions, Context.NONE); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMillisecondsLargerUnitWithResponseAsync(double input, - RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.floatMillisecondsLargerUnit(this.client.getEndpoint(), input, requestOptions, context)); - } - - /** - * The floatMillisecondsLargerUnit operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMillisecondsLargerUnitWithResponse(double input, RequestOptions requestOptions) { - return service.floatMillisecondsLargerUnitSync(this.client.getEndpoint(), input, requestOptions, Context.NONE); - } - - /** - * The float64Milliseconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> float64MillisecondsWithResponseAsync(double input, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.float64Milliseconds(this.client.getEndpoint(), input, requestOptions, context)); - } - - /** - * The float64Milliseconds operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response float64MillisecondsWithResponse(double input, RequestOptions requestOptions) { - return service.float64MillisecondsSync(this.client.getEndpoint(), input, requestOptions, Context.NONE); - } - - /** - * The int32SecondsArray operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32SecondsArrayWithResponseAsync(List input, - RequestOptions requestOptions) { - String inputConverted = JacksonAdapter.createDefaultSerializerAdapter() - .serializeIterable( - input.stream().map(paramItemValue -> paramItemValue.getSeconds()).collect(Collectors.toList()), - CollectionFormat.CSV); - return FluxUtil.withContext( - context -> service.int32SecondsArray(this.client.getEndpoint(), inputConverted, requestOptions, context)); - } - - /** - * The int32SecondsArray operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32SecondsArrayWithResponse(List input, RequestOptions requestOptions) { - String inputConverted = JacksonAdapter.createDefaultSerializerAdapter() - .serializeIterable( - input.stream().map(paramItemValue -> paramItemValue.getSeconds()).collect(Collectors.toList()), - CollectionFormat.CSV); - return service.int32SecondsArraySync(this.client.getEndpoint(), inputConverted, requestOptions, Context.NONE); - } - - /** - * The int32MillisecondsArray operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> int32MillisecondsArrayWithResponseAsync(List input, - RequestOptions requestOptions) { - String inputConverted - = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(input, CollectionFormat.CSV); - return FluxUtil.withContext(context -> service.int32MillisecondsArray(this.client.getEndpoint(), inputConverted, - requestOptions, context)); - } - - /** - * The int32MillisecondsArray operation. - * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response int32MillisecondsArrayWithResponse(List input, RequestOptions requestOptions) { - String inputConverted - = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(input, CollectionFormat.CSV); - return service.int32MillisecondsArraySync(this.client.getEndpoint(), inputConverted, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/package-info.java deleted file mode 100644 index e3346ba84e6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for DurationModel. - * Test for encode decorator on duration. - * - */ -package encode.duration.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/package-info.java deleted file mode 100644 index 6049cecc4ab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for DurationModel. - * Test for encode decorator on duration. - * - */ -package encode.duration; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/DefaultDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/DefaultDurationProperty.java deleted file mode 100644 index 14556802f5c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/DefaultDurationProperty.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; - -/** - * The DefaultDurationProperty model. - */ -@Immutable -public final class DefaultDurationProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final Duration value; - - /** - * Creates an instance of DefaultDurationProperty class. - * - * @param value the value value to set. - */ - @Generated - public DefaultDurationProperty(Duration value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public Duration getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("value", CoreUtils.durationToStringWithDays(this.value)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DefaultDurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DefaultDurationProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DefaultDurationProperty. - */ - @Generated - public static DefaultDurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Duration value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new DefaultDurationProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64MillisecondsDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64MillisecondsDurationProperty.java deleted file mode 100644 index 5a6aa75879e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64MillisecondsDurationProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Float64MillisecondsDurationProperty model. - */ -@Immutable -public final class Float64MillisecondsDurationProperty - implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final double value; - - /** - * Creates an instance of Float64MillisecondsDurationProperty class. - * - * @param value the value value to set. - */ - @Generated - public Float64MillisecondsDurationProperty(double value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public double getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Float64MillisecondsDurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Float64MillisecondsDurationProperty if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Float64MillisecondsDurationProperty. - */ - @Generated - public static Float64MillisecondsDurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - double value = 0.0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.getDouble(); - } else { - reader.skipChildren(); - } - } - return new Float64MillisecondsDurationProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64SecondsDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64SecondsDurationProperty.java deleted file mode 100644 index 2d54a349a25..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64SecondsDurationProperty.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; - -/** - * The Float64SecondsDurationProperty model. - */ -@Immutable -public final class Float64SecondsDurationProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final double value; - - /** - * Creates an instance of Float64SecondsDurationProperty class. - * - * @param value the value value to set. - */ - @Generated - public Float64SecondsDurationProperty(Duration value) { - if (value == null) { - this.value = 0.0; - } else { - this.value = (double) value.toNanos() / 1000_000_000L; - } - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public Duration getValue() { - return Duration.ofNanos((long) (this.value * 1000_000_000L)); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Float64SecondsDurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Float64SecondsDurationProperty if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Float64SecondsDurationProperty. - */ - @Generated - public static Float64SecondsDurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Duration value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = Duration.ofNanos((long) (reader.getDouble() * 1000_000_000L)); - } else { - reader.skipChildren(); - } - } - return new Float64SecondsDurationProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationArrayProperty.java deleted file mode 100644 index aa77fd209a0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationArrayProperty.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The FloatMillisecondsDurationArrayProperty model. - */ -@Immutable -public final class FloatMillisecondsDurationArrayProperty - implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final List value; - - /** - * Creates an instance of FloatMillisecondsDurationArrayProperty class. - * - * @param value the value value to set. - */ - @Generated - public FloatMillisecondsDurationArrayProperty(List value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public List getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeDouble(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FloatMillisecondsDurationArrayProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FloatMillisecondsDurationArrayProperty if the JsonReader was pointing to an instance of - * it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FloatMillisecondsDurationArrayProperty. - */ - @Generated - public static FloatMillisecondsDurationArrayProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.readArray(reader1 -> reader1.getDouble()); - } else { - reader.skipChildren(); - } - } - return new FloatMillisecondsDurationArrayProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationProperty.java deleted file mode 100644 index d40fbf62e9d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationProperty.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The FloatMillisecondsDurationProperty model. - */ -@Immutable -public final class FloatMillisecondsDurationProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final double value; - - /** - * Creates an instance of FloatMillisecondsDurationProperty class. - * - * @param value the value value to set. - */ - @Generated - public FloatMillisecondsDurationProperty(double value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public double getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FloatMillisecondsDurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FloatMillisecondsDurationProperty if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FloatMillisecondsDurationProperty. - */ - @Generated - public static FloatMillisecondsDurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - double value = 0.0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.getDouble(); - } else { - reader.skipChildren(); - } - } - return new FloatMillisecondsDurationProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsLargerUnitDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsLargerUnitDurationProperty.java deleted file mode 100644 index e98cf4026c6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsLargerUnitDurationProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The FloatMillisecondsLargerUnitDurationProperty model. - */ -@Immutable -public final class FloatMillisecondsLargerUnitDurationProperty - implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final double value; - - /** - * Creates an instance of FloatMillisecondsLargerUnitDurationProperty class. - * - * @param value the value value to set. - */ - @Generated - public FloatMillisecondsLargerUnitDurationProperty(double value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public double getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FloatMillisecondsLargerUnitDurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FloatMillisecondsLargerUnitDurationProperty if the JsonReader was pointing to an instance - * of it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FloatMillisecondsLargerUnitDurationProperty. - */ - @Generated - public static FloatMillisecondsLargerUnitDurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - double value = 0.0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.getDouble(); - } else { - reader.skipChildren(); - } - } - return new FloatMillisecondsLargerUnitDurationProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationArrayProperty.java deleted file mode 100644 index 1f70094dfa3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationArrayProperty.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; -import java.util.List; - -/** - * The FloatSecondsDurationArrayProperty model. - */ -@Immutable -public final class FloatSecondsDurationArrayProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final List value; - - /** - * Creates an instance of FloatSecondsDurationArrayProperty class. - * - * @param value the value value to set. - */ - @Generated - public FloatSecondsDurationArrayProperty(List value) { - if (value == null) { - this.value = null; - } else { - this.value = value.stream() - .map(el -> (double) el.toNanos() / 1000_000_000L) - .collect(java.util.stream.Collectors.toList()); - } - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public List getValue() { - if (this.value == null) { - return null; - } - return this.value.stream() - .map(el -> Duration.ofNanos((long) (el * 1000_000_000L))) - .collect(java.util.stream.Collectors.toList()); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeDouble(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FloatSecondsDurationArrayProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FloatSecondsDurationArrayProperty if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FloatSecondsDurationArrayProperty. - */ - @Generated - public static FloatSecondsDurationArrayProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.readArray(reader1 -> Duration.ofNanos((long) (reader1.getDouble() * 1000_000_000L))); - } else { - reader.skipChildren(); - } - } - return new FloatSecondsDurationArrayProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationProperty.java deleted file mode 100644 index 126a0b10fba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationProperty.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; - -/** - * The FloatSecondsDurationProperty model. - */ -@Immutable -public final class FloatSecondsDurationProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final double value; - - /** - * Creates an instance of FloatSecondsDurationProperty class. - * - * @param value the value value to set. - */ - @Generated - public FloatSecondsDurationProperty(Duration value) { - if (value == null) { - this.value = 0.0; - } else { - this.value = (double) value.toNanos() / 1000_000_000L; - } - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public Duration getValue() { - return Duration.ofNanos((long) (this.value * 1000_000_000L)); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FloatSecondsDurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FloatSecondsDurationProperty if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FloatSecondsDurationProperty. - */ - @Generated - public static FloatSecondsDurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Duration value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = Duration.ofNanos((long) (reader.getDouble() * 1000_000_000L)); - } else { - reader.skipChildren(); - } - } - return new FloatSecondsDurationProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsLargerUnitDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsLargerUnitDurationProperty.java deleted file mode 100644 index b8fa54d2e28..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsLargerUnitDurationProperty.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; - -/** - * The FloatSecondsLargerUnitDurationProperty model. - */ -@Immutable -public final class FloatSecondsLargerUnitDurationProperty - implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final double value; - - /** - * Creates an instance of FloatSecondsLargerUnitDurationProperty class. - * - * @param value the value value to set. - */ - @Generated - public FloatSecondsLargerUnitDurationProperty(Duration value) { - if (value == null) { - this.value = 0.0; - } else { - this.value = (double) value.toNanos() / 1000_000_000L; - } - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public Duration getValue() { - return Duration.ofNanos((long) (this.value * 1000_000_000L)); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FloatSecondsLargerUnitDurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FloatSecondsLargerUnitDurationProperty if the JsonReader was pointing to an instance of - * it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FloatSecondsLargerUnitDurationProperty. - */ - @Generated - public static FloatSecondsLargerUnitDurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Duration value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = Duration.ofNanos((long) (reader.getDouble() * 1000_000_000L)); - } else { - reader.skipChildren(); - } - } - return new FloatSecondsLargerUnitDurationProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/ISO8601DurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/ISO8601DurationProperty.java deleted file mode 100644 index bcb67d4fc24..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/ISO8601DurationProperty.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; - -/** - * The ISO8601DurationProperty model. - */ -@Immutable -public final class ISO8601DurationProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final Duration value; - - /** - * Creates an instance of ISO8601DurationProperty class. - * - * @param value the value value to set. - */ - @Generated - public ISO8601DurationProperty(Duration value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public Duration getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("value", CoreUtils.durationToStringWithDays(this.value)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ISO8601DurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ISO8601DurationProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ISO8601DurationProperty. - */ - @Generated - public static ISO8601DurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Duration value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new ISO8601DurationProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsDurationProperty.java deleted file mode 100644 index d8130c569a7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsDurationProperty.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Int32MillisecondsDurationProperty model. - */ -@Immutable -public final class Int32MillisecondsDurationProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final int value; - - /** - * Creates an instance of Int32MillisecondsDurationProperty class. - * - * @param value the value value to set. - */ - @Generated - public Int32MillisecondsDurationProperty(int value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public int getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Int32MillisecondsDurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Int32MillisecondsDurationProperty if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Int32MillisecondsDurationProperty. - */ - @Generated - public static Int32MillisecondsDurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int value = 0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.getInt(); - } else { - reader.skipChildren(); - } - } - return new Int32MillisecondsDurationProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsLargerUnitDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsLargerUnitDurationProperty.java deleted file mode 100644 index 9be4f62447d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsLargerUnitDurationProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Int32MillisecondsLargerUnitDurationProperty model. - */ -@Immutable -public final class Int32MillisecondsLargerUnitDurationProperty - implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final int value; - - /** - * Creates an instance of Int32MillisecondsLargerUnitDurationProperty class. - * - * @param value the value value to set. - */ - @Generated - public Int32MillisecondsLargerUnitDurationProperty(int value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public int getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Int32MillisecondsLargerUnitDurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Int32MillisecondsLargerUnitDurationProperty if the JsonReader was pointing to an instance - * of it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Int32MillisecondsLargerUnitDurationProperty. - */ - @Generated - public static Int32MillisecondsLargerUnitDurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int value = 0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.getInt(); - } else { - reader.skipChildren(); - } - } - return new Int32MillisecondsLargerUnitDurationProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsDurationProperty.java deleted file mode 100644 index bf634dd3220..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsDurationProperty.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; - -/** - * The Int32SecondsDurationProperty model. - */ -@Immutable -public final class Int32SecondsDurationProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final long value; - - /** - * Creates an instance of Int32SecondsDurationProperty class. - * - * @param value the value value to set. - */ - @Generated - public Int32SecondsDurationProperty(Duration value) { - if (value == null) { - this.value = 0L; - } else { - this.value = value.getSeconds(); - } - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public Duration getValue() { - return Duration.ofSeconds(this.value); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeLongField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Int32SecondsDurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Int32SecondsDurationProperty if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Int32SecondsDurationProperty. - */ - @Generated - public static Int32SecondsDurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Duration value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = Duration.ofSeconds(reader.getLong()); - } else { - reader.skipChildren(); - } - } - return new Int32SecondsDurationProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsLargerUnitDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsLargerUnitDurationProperty.java deleted file mode 100644 index 7a1d845ed26..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsLargerUnitDurationProperty.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; - -/** - * The Int32SecondsLargerUnitDurationProperty model. - */ -@Immutable -public final class Int32SecondsLargerUnitDurationProperty - implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final long value; - - /** - * Creates an instance of Int32SecondsLargerUnitDurationProperty class. - * - * @param value the value value to set. - */ - @Generated - public Int32SecondsLargerUnitDurationProperty(Duration value) { - if (value == null) { - this.value = 0L; - } else { - this.value = value.getSeconds(); - } - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public Duration getValue() { - return Duration.ofSeconds(this.value); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeLongField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Int32SecondsLargerUnitDurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Int32SecondsLargerUnitDurationProperty if the JsonReader was pointing to an instance of - * it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Int32SecondsLargerUnitDurationProperty. - */ - @Generated - public static Int32SecondsLargerUnitDurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Duration value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = Duration.ofSeconds(reader.getLong()); - } else { - reader.skipChildren(); - } - } - return new Int32SecondsLargerUnitDurationProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/package-info.java deleted file mode 100644 index 217fa3faafc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for DurationModel. - * Test for encode decorator on duration. - * - */ -package encode.duration.property.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericAsyncClient.java deleted file mode 100644 index 58806522fc6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericAsyncClient.java +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.numeric; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import encode.numeric.implementation.PropertiesImpl; -import encode.numeric.property.models.SafeintAsStringProperty; -import encode.numeric.property.models.Uint32AsStringProperty; -import encode.numeric.property.models.Uint8AsStringProperty; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous NumericClient type. - */ -@ServiceClient(builder = NumericClientBuilder.class, isAsync = true) -public final class NumericAsyncClient { - @Generated - private final PropertiesImpl serviceClient; - - /** - * Initializes an instance of NumericAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NumericAsyncClient(PropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The safeintAsString operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> safeintAsStringWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.safeintAsStringWithResponseAsync(value, requestOptions); - } - - /** - * The uint32AsStringOptional operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Integer (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Integer (Optional)
-     * }
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uint32AsStringOptionalWithResponse(BinaryData value, - RequestOptions requestOptions) { - return this.serviceClient.uint32AsStringOptionalWithResponseAsync(value, requestOptions); - } - - /** - * The uint8AsString operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uint8AsStringWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.uint8AsStringWithResponseAsync(value, requestOptions); - } - - /** - * The safeintAsString operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono safeintAsString(SafeintAsStringProperty value) { - // Generated convenience method for safeintAsStringWithResponse - RequestOptions requestOptions = new RequestOptions(); - return safeintAsStringWithResponse(BinaryData.fromObject(value), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SafeintAsStringProperty.class)); - } - - /** - * The uint32AsStringOptional operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uint32AsStringOptional(Uint32AsStringProperty value) { - // Generated convenience method for uint32AsStringOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return uint32AsStringOptionalWithResponse(BinaryData.fromObject(value), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Uint32AsStringProperty.class)); - } - - /** - * The uint8AsString operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uint8AsString(Uint8AsStringProperty value) { - // Generated convenience method for uint8AsStringWithResponse - RequestOptions requestOptions = new RequestOptions(); - return uint8AsStringWithResponse(BinaryData.fromObject(value), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Uint8AsStringProperty.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClient.java deleted file mode 100644 index d638911302b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClient.java +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.numeric; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import encode.numeric.implementation.PropertiesImpl; -import encode.numeric.property.models.SafeintAsStringProperty; -import encode.numeric.property.models.Uint32AsStringProperty; -import encode.numeric.property.models.Uint8AsStringProperty; - -/** - * Initializes a new instance of the synchronous NumericClient type. - */ -@ServiceClient(builder = NumericClientBuilder.class) -public final class NumericClient { - @Generated - private final PropertiesImpl serviceClient; - - /** - * Initializes an instance of NumericClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NumericClient(PropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The safeintAsString operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response safeintAsStringWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.safeintAsStringWithResponse(value, requestOptions); - } - - /** - * The uint32AsStringOptional operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Integer (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Integer (Optional)
-     * }
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uint32AsStringOptionalWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.uint32AsStringOptionalWithResponse(value, requestOptions); - } - - /** - * The uint8AsString operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uint8AsStringWithResponse(BinaryData value, RequestOptions requestOptions) { - return this.serviceClient.uint8AsStringWithResponse(value, requestOptions); - } - - /** - * The safeintAsString operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SafeintAsStringProperty safeintAsString(SafeintAsStringProperty value) { - // Generated convenience method for safeintAsStringWithResponse - RequestOptions requestOptions = new RequestOptions(); - return safeintAsStringWithResponse(BinaryData.fromObject(value), requestOptions).getValue() - .toObject(SafeintAsStringProperty.class); - } - - /** - * The uint32AsStringOptional operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Uint32AsStringProperty uint32AsStringOptional(Uint32AsStringProperty value) { - // Generated convenience method for uint32AsStringOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return uint32AsStringOptionalWithResponse(BinaryData.fromObject(value), requestOptions).getValue() - .toObject(Uint32AsStringProperty.class); - } - - /** - * The uint8AsString operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Uint8AsStringProperty uint8AsString(Uint8AsStringProperty value) { - // Generated convenience method for uint8AsStringWithResponse - RequestOptions requestOptions = new RequestOptions(); - return uint8AsStringWithResponse(BinaryData.fromObject(value), requestOptions).getValue() - .toObject(Uint8AsStringProperty.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClientBuilder.java deleted file mode 100644 index 61fb71387b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.numeric; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import encode.numeric.implementation.NumericClientImpl; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * A builder for creating a new instance of the NumericClient type. - */ -@ServiceClientBuilder(serviceClients = { NumericClient.class, NumericAsyncClient.class }) -public final class NumericClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("encode-numeric.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the NumericClientBuilder. - */ - @Generated - public NumericClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NumericClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NumericClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NumericClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NumericClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NumericClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NumericClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NumericClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NumericClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the NumericClientBuilder. - */ - @Generated - public NumericClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of NumericClientImpl with the provided parameters. - * - * @return an instance of NumericClientImpl. - */ - @Generated - private NumericClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - NumericClientImpl client - = new NumericClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of NumericAsyncClient class. - * - * @return an instance of NumericAsyncClient. - */ - @Generated - public NumericAsyncClient buildAsyncClient() { - return new NumericAsyncClient(buildInnerClient().getProperties()); - } - - /** - * Builds an instance of NumericClient class. - * - * @return an instance of NumericClient. - */ - @Generated - public NumericClient buildClient() { - return new NumericClient(buildInnerClient().getProperties()); - } - - private static final ClientLogger LOGGER = new ClientLogger(NumericClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/NumericClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/NumericClientImpl.java deleted file mode 100644 index 9b015846858..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/NumericClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.numeric.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 NumericClient type. - */ -public final class NumericClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 PropertiesImpl object to access its operations. - */ - private final PropertiesImpl properties; - - /** - * Gets the PropertiesImpl object to access its operations. - * - * @return the PropertiesImpl object. - */ - public PropertiesImpl getProperties() { - return this.properties; - } - - /** - * Initializes an instance of NumericClient client. - * - * @param endpoint Service host. - */ - public NumericClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NumericClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public NumericClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NumericClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public NumericClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.properties = new PropertiesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/PropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/PropertiesImpl.java deleted file mode 100644 index 1a9deca67f3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/PropertiesImpl.java +++ /dev/null @@ -1,351 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.numeric.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Properties. - */ -public final class PropertiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PropertiesService service; - - /** - * The service client containing this operation class. - */ - private final NumericClientImpl client; - - /** - * Initializes an instance of PropertiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PropertiesImpl(NumericClientImpl client) { - this.service - = RestProxy.create(PropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NumericClientProperties to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NumericClientProperties") - public interface PropertiesService { - @Post("/encode/numeric/property/safeint") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> safeintAsString(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData value, RequestOptions requestOptions, Context context); - - @Post("/encode/numeric/property/safeint") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response safeintAsStringSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData value, RequestOptions requestOptions, Context context); - - @Post("/encode/numeric/property/uint32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> uint32AsStringOptional(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData value, RequestOptions requestOptions, Context context); - - @Post("/encode/numeric/property/uint32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response uint32AsStringOptionalSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData value, RequestOptions requestOptions, Context context); - - @Post("/encode/numeric/property/uint8") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> uint8AsString(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData value, RequestOptions requestOptions, Context context); - - @Post("/encode/numeric/property/uint8") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response uint8AsStringSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData value, RequestOptions requestOptions, Context context); - } - - /** - * The safeintAsString operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> safeintAsStringWithResponseAsync(BinaryData value, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.safeintAsString(this.client.getEndpoint(), contentType, accept, - value, requestOptions, context)); - } - - /** - * The safeintAsString operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: long (Required)
-     * }
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response safeintAsStringWithResponse(BinaryData value, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.safeintAsStringSync(this.client.getEndpoint(), contentType, accept, value, requestOptions, - Context.NONE); - } - - /** - * The uint32AsStringOptional operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Integer (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Integer (Optional)
-     * }
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uint32AsStringOptionalWithResponseAsync(BinaryData value, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.uint32AsStringOptional(this.client.getEndpoint(), contentType, - accept, value, requestOptions, context)); - } - - /** - * The uint32AsStringOptional operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Integer (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: Integer (Optional)
-     * }
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uint32AsStringOptionalWithResponse(BinaryData value, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.uint32AsStringOptionalSync(this.client.getEndpoint(), contentType, accept, value, requestOptions, - Context.NONE); - } - - /** - * The uint8AsString operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uint8AsStringWithResponseAsync(BinaryData value, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.uint8AsString(this.client.getEndpoint(), contentType, accept, - value, requestOptions, context)); - } - - /** - * The uint8AsString operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     value: int (Required)
-     * }
-     * }
-     * 
- * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uint8AsStringWithResponse(BinaryData value, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.uint8AsStringSync(this.client.getEndpoint(), contentType, accept, value, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/package-info.java deleted file mode 100644 index f0b10d1e8dd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Numeric. - * Test for encode decorator on integer. - * - */ -package encode.numeric.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/package-info.java deleted file mode 100644 index 664e3918b31..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Numeric. - * Test for encode decorator on integer. - * - */ -package encode.numeric; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/SafeintAsStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/SafeintAsStringProperty.java deleted file mode 100644 index 6d4fb40a3cd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/SafeintAsStringProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.numeric.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Objects; - -/** - * The SafeintAsStringProperty model. - */ -@Immutable -public final class SafeintAsStringProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final long value; - - /** - * Creates an instance of SafeintAsStringProperty class. - * - * @param value the value value to set. - */ - @Generated - public SafeintAsStringProperty(long value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public long getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("value", Objects.toString(this.value, null)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SafeintAsStringProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SafeintAsStringProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SafeintAsStringProperty. - */ - @Generated - public static SafeintAsStringProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - long value = Long.parseLong("0"); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.getNullable(nonNullReader -> Long.parseLong(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new SafeintAsStringProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint32AsStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint32AsStringProperty.java deleted file mode 100644 index 43358522f7f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint32AsStringProperty.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.numeric.property.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Objects; - -/** - * The Uint32AsStringProperty model. - */ -@Fluent -public final class Uint32AsStringProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private Integer value; - - /** - * Creates an instance of Uint32AsStringProperty class. - */ - @Generated - public Uint32AsStringProperty() { - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public Integer getValue() { - return this.value; - } - - /** - * Set the value property: The value property. - * - * @param value the value value to set. - * @return the Uint32AsStringProperty object itself. - */ - @Generated - public Uint32AsStringProperty setValue(Integer value) { - this.value = value; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("value", Objects.toString(this.value, null)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Uint32AsStringProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Uint32AsStringProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the Uint32AsStringProperty. - */ - @Generated - public static Uint32AsStringProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Uint32AsStringProperty deserializedUint32AsStringProperty = new Uint32AsStringProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - deserializedUint32AsStringProperty.value - = reader.getNullable(nonNullReader -> Integer.parseInt(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - - return deserializedUint32AsStringProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint8AsStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint8AsStringProperty.java deleted file mode 100644 index b5c75a3c428..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint8AsStringProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.numeric.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Objects; - -/** - * The Uint8AsStringProperty model. - */ -@Immutable -public final class Uint8AsStringProperty implements JsonSerializable { - /* - * The value property. - */ - @Generated - private final int value; - - /** - * Creates an instance of Uint8AsStringProperty class. - * - * @param value the value value to set. - */ - @Generated - public Uint8AsStringProperty(int value) { - this.value = value; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public int getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("value", Objects.toString(this.value, null)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Uint8AsStringProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Uint8AsStringProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Uint8AsStringProperty. - */ - @Generated - public static Uint8AsStringProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int value = Integer.parseInt("0"); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - value = reader.getNullable(nonNullReader -> Integer.parseInt(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new Uint8AsStringProperty(value); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/package-info.java deleted file mode 100644 index 0a95848ffdd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Numeric. - * Test for encode decorator on integer. - * - */ -package encode.numeric.property.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/BasicClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/BasicClientBuilder.java deleted file mode 100644 index b0b6265e7d7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/BasicClientBuilder.java +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.basic; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import parameters.basic.implementation.BasicClientImpl; - -/** - * A builder for creating a new instance of the BasicClient type. - */ -@ServiceClientBuilder( - serviceClients = { - ExplicitBodyClient.class, - ImplicitBodyClient.class, - ExplicitBodyAsyncClient.class, - ImplicitBodyAsyncClient.class }) -public final class BasicClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("parameters-basic.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the BasicClientBuilder. - */ - @Generated - public BasicClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BasicClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the BasicClientBuilder. - */ - @Generated - public BasicClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of BasicClientImpl with the provided parameters. - * - * @return an instance of BasicClientImpl. - */ - @Generated - private BasicClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - BasicClientImpl client - = new BasicClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ExplicitBodyAsyncClient class. - * - * @return an instance of ExplicitBodyAsyncClient. - */ - @Generated - public ExplicitBodyAsyncClient buildExplicitBodyAsyncClient() { - return new ExplicitBodyAsyncClient(buildInnerClient().getExplicitBodies()); - } - - /** - * Builds an instance of ImplicitBodyAsyncClient class. - * - * @return an instance of ImplicitBodyAsyncClient. - */ - @Generated - public ImplicitBodyAsyncClient buildImplicitBodyAsyncClient() { - return new ImplicitBodyAsyncClient(buildInnerClient().getImplicitBodies()); - } - - /** - * Builds an instance of ExplicitBodyClient class. - * - * @return an instance of ExplicitBodyClient. - */ - @Generated - public ExplicitBodyClient buildExplicitBodyClient() { - return new ExplicitBodyClient(buildInnerClient().getExplicitBodies()); - } - - /** - * Builds an instance of ImplicitBodyClient class. - * - * @return an instance of ImplicitBodyClient. - */ - @Generated - public ImplicitBodyClient buildImplicitBodyClient() { - return new ImplicitBodyClient(buildInnerClient().getImplicitBodies()); - } - - private static final ClientLogger LOGGER = new ClientLogger(BasicClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyAsyncClient.java deleted file mode 100644 index f8239999a49..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyAsyncClient.java +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.basic; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import parameters.basic.explicitbody.models.User; -import parameters.basic.implementation.ExplicitBodiesImpl; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous BasicClient type. - */ -@ServiceClient(builder = BasicClientBuilder.class, isAsync = true) -public final class ExplicitBodyAsyncClient { - @Generated - private final ExplicitBodiesImpl serviceClient; - - /** - * Initializes an instance of ExplicitBodyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExplicitBodyAsyncClient(ExplicitBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The simple operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> simpleWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.simpleWithResponseAsync(body, requestOptions); - } - - /** - * The simple operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono simple(User body) { - // Generated convenience method for simpleWithResponse - RequestOptions requestOptions = new RequestOptions(); - return simpleWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyClient.java deleted file mode 100644 index df6d4c01acd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyClient.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.basic; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import parameters.basic.explicitbody.models.User; -import parameters.basic.implementation.ExplicitBodiesImpl; - -/** - * Initializes a new instance of the synchronous BasicClient type. - */ -@ServiceClient(builder = BasicClientBuilder.class) -public final class ExplicitBodyClient { - @Generated - private final ExplicitBodiesImpl serviceClient; - - /** - * Initializes an instance of ExplicitBodyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExplicitBodyClient(ExplicitBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The simple operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response simpleWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.simpleWithResponse(body, requestOptions); - } - - /** - * The simple operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void simple(User body) { - // Generated convenience method for simpleWithResponse - RequestOptions requestOptions = new RequestOptions(); - simpleWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyAsyncClient.java deleted file mode 100644 index 7f4027747cd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyAsyncClient.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.basic; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import parameters.basic.implementation.ImplicitBodiesImpl; -import parameters.basic.implicitbody.implementation.models.SimpleRequest; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous BasicClient type. - */ -@ServiceClient(builder = BasicClientBuilder.class, isAsync = true) -public final class ImplicitBodyAsyncClient { - @Generated - private final ImplicitBodiesImpl serviceClient; - - /** - * Initializes an instance of ImplicitBodyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ImplicitBodyAsyncClient(ImplicitBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The simple operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param simpleRequest The simpleRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> simpleWithResponse(BinaryData simpleRequest, RequestOptions requestOptions) { - return this.serviceClient.simpleWithResponseAsync(simpleRequest, requestOptions); - } - - /** - * The simple operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono simple(String name) { - // Generated convenience method for simpleWithResponse - RequestOptions requestOptions = new RequestOptions(); - SimpleRequest simpleRequestObj = new SimpleRequest(name); - BinaryData simpleRequest = BinaryData.fromObject(simpleRequestObj); - return simpleWithResponse(simpleRequest, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyClient.java deleted file mode 100644 index 708f82e2677..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyClient.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.basic; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import parameters.basic.implementation.ImplicitBodiesImpl; -import parameters.basic.implicitbody.implementation.models.SimpleRequest; - -/** - * Initializes a new instance of the synchronous BasicClient type. - */ -@ServiceClient(builder = BasicClientBuilder.class) -public final class ImplicitBodyClient { - @Generated - private final ImplicitBodiesImpl serviceClient; - - /** - * Initializes an instance of ImplicitBodyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ImplicitBodyClient(ImplicitBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The simple operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param simpleRequest The simpleRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response simpleWithResponse(BinaryData simpleRequest, RequestOptions requestOptions) { - return this.serviceClient.simpleWithResponse(simpleRequest, requestOptions); - } - - /** - * The simple operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void simple(String name) { - // Generated convenience method for simpleWithResponse - RequestOptions requestOptions = new RequestOptions(); - SimpleRequest simpleRequestObj = new SimpleRequest(name); - BinaryData simpleRequest = BinaryData.fromObject(simpleRequestObj); - simpleWithResponse(simpleRequest, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/User.java deleted file mode 100644 index 0f755168c08..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/User.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.basic.explicitbody.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * This is a simple model. - */ -@Immutable -public final class User implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of User class. - * - * @param name the name value to set. - */ - @Generated - public User(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of User from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the User. - */ - @Generated - public static User fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new User(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/package-info.java deleted file mode 100644 index c8e323e193d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Basic. - * Test for basic parameters cases. - * - */ -package parameters.basic.explicitbody.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/BasicClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/BasicClientImpl.java deleted file mode 100644 index 3132582eceb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/BasicClientImpl.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.basic.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 BasicClient type. - */ -public final class BasicClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 ExplicitBodiesImpl object to access its operations. - */ - private final ExplicitBodiesImpl explicitBodies; - - /** - * Gets the ExplicitBodiesImpl object to access its operations. - * - * @return the ExplicitBodiesImpl object. - */ - public ExplicitBodiesImpl getExplicitBodies() { - return this.explicitBodies; - } - - /** - * The ImplicitBodiesImpl object to access its operations. - */ - private final ImplicitBodiesImpl implicitBodies; - - /** - * Gets the ImplicitBodiesImpl object to access its operations. - * - * @return the ImplicitBodiesImpl object. - */ - public ImplicitBodiesImpl getImplicitBodies() { - return this.implicitBodies; - } - - /** - * Initializes an instance of BasicClient client. - * - * @param endpoint Service host. - */ - public BasicClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of BasicClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public BasicClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of BasicClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public BasicClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.explicitBodies = new ExplicitBodiesImpl(this); - this.implicitBodies = new ImplicitBodiesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ExplicitBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ExplicitBodiesImpl.java deleted file mode 100644 index 666397dfd25..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ExplicitBodiesImpl.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.basic.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExplicitBodies. - */ -public final class ExplicitBodiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExplicitBodiesService service; - - /** - * The service client containing this operation class. - */ - private final BasicClientImpl client; - - /** - * Initializes an instance of ExplicitBodiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExplicitBodiesImpl(BasicClientImpl client) { - this.service - = RestProxy.create(ExplicitBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for BasicClientExplicitBodies to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "BasicClientExplicitBodies") - public interface ExplicitBodiesService { - @Put("/parameters/basic/explicit-body/simple") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> simple(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/parameters/basic/explicit-body/simple") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response simpleSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The simple operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> simpleWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.simple(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The simple operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response simpleWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.simpleSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ImplicitBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ImplicitBodiesImpl.java deleted file mode 100644 index d430931c609..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ImplicitBodiesImpl.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.basic.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ImplicitBodies. - */ -public final class ImplicitBodiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ImplicitBodiesService service; - - /** - * The service client containing this operation class. - */ - private final BasicClientImpl client; - - /** - * Initializes an instance of ImplicitBodiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ImplicitBodiesImpl(BasicClientImpl client) { - this.service - = RestProxy.create(ImplicitBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for BasicClientImplicitBodies to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "BasicClientImplicitBodies") - public interface ImplicitBodiesService { - @Put("/parameters/basic/implicit-body/simple") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> simple(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData simpleRequest, - RequestOptions requestOptions, Context context); - - @Put("/parameters/basic/implicit-body/simple") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response simpleSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData simpleRequest, - RequestOptions requestOptions, Context context); - } - - /** - * The simple operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param simpleRequest The simpleRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> simpleWithResponseAsync(BinaryData simpleRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.simple(this.client.getEndpoint(), contentType, simpleRequest, requestOptions, context)); - } - - /** - * The simple operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param simpleRequest The simpleRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response simpleWithResponse(BinaryData simpleRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.simpleSync(this.client.getEndpoint(), contentType, simpleRequest, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/package-info.java deleted file mode 100644 index 5c8e5833b57..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Basic. - * Test for basic parameters cases. - * - */ -package parameters.basic.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/SimpleRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/SimpleRequest.java deleted file mode 100644 index 26eee898576..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/SimpleRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.basic.implicitbody.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The SimpleRequest model. - */ -@Immutable -public final class SimpleRequest implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of SimpleRequest class. - * - * @param name the name value to set. - */ - @Generated - public SimpleRequest(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SimpleRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SimpleRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SimpleRequest. - */ - @Generated - public static SimpleRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new SimpleRequest(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/package-info.java deleted file mode 100644 index 401952b9be3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Basic. - * Test for basic parameters cases. - * - */ -package parameters.basic.implicitbody.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/package-info.java deleted file mode 100644 index 085d9c7406a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Basic. - * Test for basic parameters cases. - * - */ -package parameters.basic; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityAsyncClient.java deleted file mode 100644 index be91fc8ce6d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityAsyncClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.bodyoptionality; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import parameters.bodyoptionality.implementation.BodyOptionalityClientImpl; -import parameters.bodyoptionality.models.BodyModel; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous BodyOptionalityClient type. - */ -@ServiceClient(builder = BodyOptionalityClientBuilder.class, isAsync = true) -public final class BodyOptionalityAsyncClient { - @Generated - private final BodyOptionalityClientImpl serviceClient; - - /** - * Initializes an instance of BodyOptionalityAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BodyOptionalityAsyncClient(BodyOptionalityClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The requiredExplicit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requiredExplicitWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.requiredExplicitWithResponseAsync(body, requestOptions); - } - - /** - * The requiredImplicit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyModel The bodyModel parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requiredImplicitWithResponse(BinaryData bodyModel, RequestOptions requestOptions) { - return this.serviceClient.requiredImplicitWithResponseAsync(bodyModel, requestOptions); - } - - /** - * The requiredExplicit operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono requiredExplicit(BodyModel body) { - // Generated convenience method for requiredExplicitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return requiredExplicitWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The requiredImplicit operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono requiredImplicit(String name) { - // Generated convenience method for requiredImplicitWithResponse - RequestOptions requestOptions = new RequestOptions(); - BodyModel bodyModelObj = new BodyModel(name); - BinaryData bodyModel = BinaryData.fromObject(bodyModelObj); - return requiredImplicitWithResponse(bodyModel, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClient.java deleted file mode 100644 index 139e335bff1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.bodyoptionality; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import parameters.bodyoptionality.implementation.BodyOptionalityClientImpl; -import parameters.bodyoptionality.models.BodyModel; - -/** - * Initializes a new instance of the synchronous BodyOptionalityClient type. - */ -@ServiceClient(builder = BodyOptionalityClientBuilder.class) -public final class BodyOptionalityClient { - @Generated - private final BodyOptionalityClientImpl serviceClient; - - /** - * Initializes an instance of BodyOptionalityClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BodyOptionalityClient(BodyOptionalityClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The requiredExplicit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requiredExplicitWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.requiredExplicitWithResponse(body, requestOptions); - } - - /** - * The requiredImplicit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyModel The bodyModel parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requiredImplicitWithResponse(BinaryData bodyModel, RequestOptions requestOptions) { - return this.serviceClient.requiredImplicitWithResponse(bodyModel, requestOptions); - } - - /** - * The requiredExplicit operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void requiredExplicit(BodyModel body) { - // Generated convenience method for requiredExplicitWithResponse - RequestOptions requestOptions = new RequestOptions(); - requiredExplicitWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The requiredImplicit operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void requiredImplicit(String name) { - // Generated convenience method for requiredImplicitWithResponse - RequestOptions requestOptions = new RequestOptions(); - BodyModel bodyModelObj = new BodyModel(name); - BinaryData bodyModel = BinaryData.fromObject(bodyModelObj); - requiredImplicitWithResponse(bodyModel, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClientBuilder.java deleted file mode 100644 index 0dec95c2bc3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClientBuilder.java +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.bodyoptionality; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import parameters.bodyoptionality.implementation.BodyOptionalityClientImpl; - -/** - * A builder for creating a new instance of the BodyOptionalityClient type. - */ -@ServiceClientBuilder( - serviceClients = { - BodyOptionalityClient.class, - OptionalExplicitClient.class, - BodyOptionalityAsyncClient.class, - OptionalExplicitAsyncClient.class }) -public final class BodyOptionalityClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("parameters-bodyoptionality.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the BodyOptionalityClientBuilder. - */ - @Generated - public BodyOptionalityClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BodyOptionalityClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BodyOptionalityClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BodyOptionalityClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BodyOptionalityClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BodyOptionalityClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BodyOptionalityClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BodyOptionalityClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BodyOptionalityClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the BodyOptionalityClientBuilder. - */ - @Generated - public BodyOptionalityClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of BodyOptionalityClientImpl with the provided parameters. - * - * @return an instance of BodyOptionalityClientImpl. - */ - @Generated - private BodyOptionalityClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - BodyOptionalityClientImpl client = new BodyOptionalityClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of BodyOptionalityAsyncClient class. - * - * @return an instance of BodyOptionalityAsyncClient. - */ - @Generated - public BodyOptionalityAsyncClient buildAsyncClient() { - return new BodyOptionalityAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of OptionalExplicitAsyncClient class. - * - * @return an instance of OptionalExplicitAsyncClient. - */ - @Generated - public OptionalExplicitAsyncClient buildOptionalExplicitAsyncClient() { - return new OptionalExplicitAsyncClient(buildInnerClient().getOptionalExplicits()); - } - - /** - * Builds an instance of BodyOptionalityClient class. - * - * @return an instance of BodyOptionalityClient. - */ - @Generated - public BodyOptionalityClient buildClient() { - return new BodyOptionalityClient(buildInnerClient()); - } - - /** - * Builds an instance of OptionalExplicitClient class. - * - * @return an instance of OptionalExplicitClient. - */ - @Generated - public OptionalExplicitClient buildOptionalExplicitClient() { - return new OptionalExplicitClient(buildInnerClient().getOptionalExplicits()); - } - - private static final ClientLogger LOGGER = new ClientLogger(BodyOptionalityClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitAsyncClient.java deleted file mode 100644 index 8bf61894c95..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitAsyncClient.java +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.bodyoptionality; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import parameters.bodyoptionality.implementation.OptionalExplicitsImpl; -import parameters.bodyoptionality.models.BodyModel; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous BodyOptionalityClient type. - */ -@ServiceClient(builder = BodyOptionalityClientBuilder.class, isAsync = true) -public final class OptionalExplicitAsyncClient { - @Generated - private final OptionalExplicitsImpl serviceClient; - - /** - * Initializes an instance of OptionalExplicitAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - OptionalExplicitAsyncClient(OptionalExplicitsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The set operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setWithResponse(RequestOptions requestOptions) { - return this.serviceClient.setWithResponseAsync(requestOptions); - } - - /** - * The omit operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> omitWithResponse(RequestOptions requestOptions) { - return this.serviceClient.omitWithResponseAsync(requestOptions); - } - - /** - * The set operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono set(BodyModel body) { - // Generated convenience method for setWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (body != null) { - requestOptions.setBody(BinaryData.fromObject(body)); - } - return setWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The set operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono set() { - // Generated convenience method for setWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The omit operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono omit(BodyModel body) { - // Generated convenience method for omitWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (body != null) { - requestOptions.setBody(BinaryData.fromObject(body)); - } - return omitWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The omit operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono omit() { - // Generated convenience method for omitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return omitWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitClient.java deleted file mode 100644 index b6d71686573..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitClient.java +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.bodyoptionality; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import parameters.bodyoptionality.implementation.OptionalExplicitsImpl; -import parameters.bodyoptionality.models.BodyModel; - -/** - * Initializes a new instance of the synchronous BodyOptionalityClient type. - */ -@ServiceClient(builder = BodyOptionalityClientBuilder.class) -public final class OptionalExplicitClient { - @Generated - private final OptionalExplicitsImpl serviceClient; - - /** - * Initializes an instance of OptionalExplicitClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - OptionalExplicitClient(OptionalExplicitsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The set operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setWithResponse(RequestOptions requestOptions) { - return this.serviceClient.setWithResponse(requestOptions); - } - - /** - * The omit operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response omitWithResponse(RequestOptions requestOptions) { - return this.serviceClient.omitWithResponse(requestOptions); - } - - /** - * The set operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void set(BodyModel body) { - // Generated convenience method for setWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (body != null) { - requestOptions.setBody(BinaryData.fromObject(body)); - } - setWithResponse(requestOptions).getValue(); - } - - /** - * The set operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void set() { - // Generated convenience method for setWithResponse - RequestOptions requestOptions = new RequestOptions(); - setWithResponse(requestOptions).getValue(); - } - - /** - * The omit operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void omit(BodyModel body) { - // Generated convenience method for omitWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (body != null) { - requestOptions.setBody(BinaryData.fromObject(body)); - } - omitWithResponse(requestOptions).getValue(); - } - - /** - * The omit operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void omit() { - // Generated convenience method for omitWithResponse - RequestOptions requestOptions = new RequestOptions(); - omitWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java deleted file mode 100644 index 0056f1e1593..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java +++ /dev/null @@ -1,289 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.bodyoptionality.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the BodyOptionalityClient type. - */ -public final class BodyOptionalityClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BodyOptionalityClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 OptionalExplicitsImpl object to access its operations. - */ - private final OptionalExplicitsImpl optionalExplicits; - - /** - * Gets the OptionalExplicitsImpl object to access its operations. - * - * @return the OptionalExplicitsImpl object. - */ - public OptionalExplicitsImpl getOptionalExplicits() { - return this.optionalExplicits; - } - - /** - * Initializes an instance of BodyOptionalityClient client. - * - * @param endpoint Service host. - */ - public BodyOptionalityClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of BodyOptionalityClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public BodyOptionalityClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of BodyOptionalityClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public BodyOptionalityClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.optionalExplicits = new OptionalExplicitsImpl(this); - this.service - = RestProxy.create(BodyOptionalityClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for BodyOptionalityClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "BodyOptionalityClient") - public interface BodyOptionalityClientService { - @Post("/parameters/body-optionality/required-explicit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> requiredExplicit(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/parameters/body-optionality/required-explicit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response requiredExplicitSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/parameters/body-optionality/required-implicit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> requiredImplicit(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData bodyModel, - RequestOptions requestOptions, Context context); - - @Post("/parameters/body-optionality/required-implicit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response requiredImplicitSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData bodyModel, - RequestOptions requestOptions, Context context); - } - - /** - * The requiredExplicit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requiredExplicitWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.requiredExplicit(this.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The requiredExplicit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requiredExplicitWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.requiredExplicitSync(this.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The requiredImplicit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyModel The bodyModel parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requiredImplicitWithResponseAsync(BinaryData bodyModel, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.requiredImplicit(this.getEndpoint(), contentType, bodyModel, requestOptions, context)); - } - - /** - * The requiredImplicit operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyModel The bodyModel parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requiredImplicitWithResponse(BinaryData bodyModel, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.requiredImplicitSync(this.getEndpoint(), contentType, bodyModel, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/OptionalExplicitsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/OptionalExplicitsImpl.java deleted file mode 100644 index 4dc7b914048..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/OptionalExplicitsImpl.java +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.bodyoptionality.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in OptionalExplicits. - */ -public final class OptionalExplicitsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final OptionalExplicitsService service; - - /** - * The service client containing this operation class. - */ - private final BodyOptionalityClientImpl client; - - /** - * Initializes an instance of OptionalExplicitsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - OptionalExplicitsImpl(BodyOptionalityClientImpl client) { - this.service - = RestProxy.create(OptionalExplicitsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for BodyOptionalityClientOptionalExplicits to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "BodyOptionalityClientOptionalExplicits") - public interface OptionalExplicitsService { - @Post("/parameters/body-optionality/optional-explicit/set") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> set(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Post("/parameters/body-optionality/optional-explicit/set") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response setSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Post("/parameters/body-optionality/optional-explicit/omit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> omit(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Post("/parameters/body-optionality/optional-explicit/omit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response omitSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - } - - /** - * The set operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setWithResponseAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - return FluxUtil.withContext(context -> service.set(this.client.getEndpoint(), requestOptionsLocal, context)); - } - - /** - * The set operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setWithResponse(RequestOptions requestOptions) { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - return service.setSync(this.client.getEndpoint(), requestOptionsLocal, Context.NONE); - } - - /** - * The omit operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> omitWithResponseAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - return FluxUtil.withContext(context -> service.omit(this.client.getEndpoint(), requestOptionsLocal, context)); - } - - /** - * The omit operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response omitWithResponse(RequestOptions requestOptions) { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - return service.omitSync(this.client.getEndpoint(), requestOptionsLocal, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/package-info.java deleted file mode 100644 index a5254dbefb8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for BodyOptionality. - * Test describing optionality of the request body. - * - */ -package parameters.bodyoptionality.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/BodyModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/BodyModel.java deleted file mode 100644 index cfc53f4ecaa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/BodyModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.bodyoptionality.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The BodyModel model. - */ -@Immutable -public final class BodyModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of BodyModel class. - * - * @param name the name value to set. - */ - @Generated - public BodyModel(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BodyModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BodyModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BodyModel. - */ - @Generated - public static BodyModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new BodyModel(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/package-info.java deleted file mode 100644 index fa8e9c44b08..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for BodyOptionality. - * Test describing optionality of the request body. - * - */ -package parameters.bodyoptionality.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/package-info.java deleted file mode 100644 index 3bc50e2d87b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for BodyOptionality. - * Test describing optionality of the request body. - * - */ -package parameters.bodyoptionality; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/CollectionFormatClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/CollectionFormatClientBuilder.java deleted file mode 100644 index 80b3fe0da27..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/CollectionFormatClientBuilder.java +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.collectionformat; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import parameters.collectionformat.implementation.CollectionFormatClientImpl; - -/** - * A builder for creating a new instance of the CollectionFormatClient type. - */ -@ServiceClientBuilder( - serviceClients = { QueryClient.class, HeaderClient.class, QueryAsyncClient.class, HeaderAsyncClient.class }) -public final class CollectionFormatClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("parameters-collectionformat.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the CollectionFormatClientBuilder. - */ - @Generated - public CollectionFormatClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CollectionFormatClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CollectionFormatClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CollectionFormatClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CollectionFormatClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CollectionFormatClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CollectionFormatClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CollectionFormatClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CollectionFormatClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the CollectionFormatClientBuilder. - */ - @Generated - public CollectionFormatClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of CollectionFormatClientImpl with the provided parameters. - * - * @return an instance of CollectionFormatClientImpl. - */ - @Generated - private CollectionFormatClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - CollectionFormatClientImpl client = new CollectionFormatClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of QueryAsyncClient class. - * - * @return an instance of QueryAsyncClient. - */ - @Generated - public QueryAsyncClient buildQueryAsyncClient() { - return new QueryAsyncClient(buildInnerClient().getQueries()); - } - - /** - * Builds an instance of HeaderAsyncClient class. - * - * @return an instance of HeaderAsyncClient. - */ - @Generated - public HeaderAsyncClient buildHeaderAsyncClient() { - return new HeaderAsyncClient(buildInnerClient().getHeaders()); - } - - /** - * Builds an instance of QueryClient class. - * - * @return an instance of QueryClient. - */ - @Generated - public QueryClient buildQueryClient() { - return new QueryClient(buildInnerClient().getQueries()); - } - - /** - * Builds an instance of HeaderClient class. - * - * @return an instance of HeaderClient. - */ - @Generated - public HeaderClient buildHeaderClient() { - return new HeaderClient(buildInnerClient().getHeaders()); - } - - private static final ClientLogger LOGGER = new ClientLogger(CollectionFormatClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderAsyncClient.java deleted file mode 100644 index 2447f2dc199..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderAsyncClient.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.collectionformat; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import parameters.collectionformat.implementation.HeadersImpl; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous CollectionFormatClient type. - */ -@ServiceClient(builder = CollectionFormatClientBuilder.class, isAsync = true) -public final class HeaderAsyncClient { - @Generated - private final HeadersImpl serviceClient; - - /** - * Initializes an instance of HeaderAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - HeaderAsyncClient(HeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The csv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> csvWithResponse(List colors, RequestOptions requestOptions) { - return this.serviceClient.csvWithResponseAsync(colors, requestOptions); - } - - /** - * The csv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono csv(List colors) { - // Generated convenience method for csvWithResponse - RequestOptions requestOptions = new RequestOptions(); - return csvWithResponse(colors, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderClient.java deleted file mode 100644 index 2507a34950c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderClient.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.collectionformat; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import parameters.collectionformat.implementation.HeadersImpl; - -/** - * Initializes a new instance of the synchronous CollectionFormatClient type. - */ -@ServiceClient(builder = CollectionFormatClientBuilder.class) -public final class HeaderClient { - @Generated - private final HeadersImpl serviceClient; - - /** - * Initializes an instance of HeaderClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - HeaderClient(HeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The csv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response csvWithResponse(List colors, RequestOptions requestOptions) { - return this.serviceClient.csvWithResponse(colors, requestOptions); - } - - /** - * The csv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void csv(List colors) { - // Generated convenience method for csvWithResponse - RequestOptions requestOptions = new RequestOptions(); - csvWithResponse(colors, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryAsyncClient.java deleted file mode 100644 index 4eb4259fac8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryAsyncClient.java +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.collectionformat; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import parameters.collectionformat.implementation.QueriesImpl; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous CollectionFormatClient type. - */ -@ServiceClient(builder = CollectionFormatClientBuilder.class, isAsync = true) -public final class QueryAsyncClient { - @Generated - private final QueriesImpl serviceClient; - - /** - * Initializes an instance of QueryAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryAsyncClient(QueriesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The multi operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> multiWithResponse(List colors, RequestOptions requestOptions) { - return this.serviceClient.multiWithResponseAsync(colors, requestOptions); - } - - /** - * The ssv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> ssvWithResponse(List colors, RequestOptions requestOptions) { - return this.serviceClient.ssvWithResponseAsync(colors, requestOptions); - } - - /** - * The pipes operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> pipesWithResponse(List colors, RequestOptions requestOptions) { - return this.serviceClient.pipesWithResponseAsync(colors, requestOptions); - } - - /** - * The csv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> csvWithResponse(List colors, RequestOptions requestOptions) { - return this.serviceClient.csvWithResponseAsync(colors, requestOptions); - } - - /** - * The multi operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono multi(List colors) { - // Generated convenience method for multiWithResponse - RequestOptions requestOptions = new RequestOptions(); - return multiWithResponse(colors, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The ssv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono ssv(List colors) { - // Generated convenience method for ssvWithResponse - RequestOptions requestOptions = new RequestOptions(); - return ssvWithResponse(colors, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The pipes operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono pipes(List colors) { - // Generated convenience method for pipesWithResponse - RequestOptions requestOptions = new RequestOptions(); - return pipesWithResponse(colors, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The csv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono csv(List colors) { - // Generated convenience method for csvWithResponse - RequestOptions requestOptions = new RequestOptions(); - return csvWithResponse(colors, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryClient.java deleted file mode 100644 index 925a32165c5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryClient.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.collectionformat; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import parameters.collectionformat.implementation.QueriesImpl; - -/** - * Initializes a new instance of the synchronous CollectionFormatClient type. - */ -@ServiceClient(builder = CollectionFormatClientBuilder.class) -public final class QueryClient { - @Generated - private final QueriesImpl serviceClient; - - /** - * Initializes an instance of QueryClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryClient(QueriesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The multi operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response multiWithResponse(List colors, RequestOptions requestOptions) { - return this.serviceClient.multiWithResponse(colors, requestOptions); - } - - /** - * The ssv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response ssvWithResponse(List colors, RequestOptions requestOptions) { - return this.serviceClient.ssvWithResponse(colors, requestOptions); - } - - /** - * The pipes operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response pipesWithResponse(List colors, RequestOptions requestOptions) { - return this.serviceClient.pipesWithResponse(colors, requestOptions); - } - - /** - * The csv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response csvWithResponse(List colors, RequestOptions requestOptions) { - return this.serviceClient.csvWithResponse(colors, requestOptions); - } - - /** - * The multi operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void multi(List colors) { - // Generated convenience method for multiWithResponse - RequestOptions requestOptions = new RequestOptions(); - multiWithResponse(colors, requestOptions).getValue(); - } - - /** - * The ssv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void ssv(List colors) { - // Generated convenience method for ssvWithResponse - RequestOptions requestOptions = new RequestOptions(); - ssvWithResponse(colors, requestOptions).getValue(); - } - - /** - * The pipes operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void pipes(List colors) { - // Generated convenience method for pipesWithResponse - RequestOptions requestOptions = new RequestOptions(); - pipesWithResponse(colors, requestOptions).getValue(); - } - - /** - * The csv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void csv(List colors) { - // Generated convenience method for csvWithResponse - RequestOptions requestOptions = new RequestOptions(); - csvWithResponse(colors, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java deleted file mode 100644 index 42dc0bc723f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.collectionformat.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 CollectionFormatClient type. - */ -public final class CollectionFormatClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 QueriesImpl object to access its operations. - */ - private final QueriesImpl queries; - - /** - * Gets the QueriesImpl object to access its operations. - * - * @return the QueriesImpl object. - */ - public QueriesImpl getQueries() { - return this.queries; - } - - /** - * The HeadersImpl object to access its operations. - */ - private final HeadersImpl headers; - - /** - * Gets the HeadersImpl object to access its operations. - * - * @return the HeadersImpl object. - */ - public HeadersImpl getHeaders() { - return this.headers; - } - - /** - * Initializes an instance of CollectionFormatClient client. - * - * @param endpoint Service host. - */ - public CollectionFormatClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of CollectionFormatClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public CollectionFormatClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of CollectionFormatClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public CollectionFormatClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.queries = new QueriesImpl(this); - this.headers = new HeadersImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/HeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/HeadersImpl.java deleted file mode 100644 index 551bfe38fa7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/HeadersImpl.java +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.collectionformat.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Headers. - */ -public final class HeadersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final HeadersService service; - - /** - * The service client containing this operation class. - */ - private final CollectionFormatClientImpl client; - - /** - * Initializes an instance of HeadersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - HeadersImpl(CollectionFormatClientImpl client) { - this.service = RestProxy.create(HeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for CollectionFormatClientHeaders to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "CollectionFormatClientHeaders") - public interface HeadersService { - @Get("/parameters/collection-format/header/csv") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> csv(@HostParam("endpoint") String endpoint, @HeaderParam("colors") String colors, - RequestOptions requestOptions, Context context); - - @Get("/parameters/collection-format/header/csv") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response csvSync(@HostParam("endpoint") String endpoint, @HeaderParam("colors") String colors, - RequestOptions requestOptions, Context context); - } - - /** - * The csv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> csvWithResponseAsync(List colors, RequestOptions requestOptions) { - String colorsConverted = colors.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.csv(this.client.getEndpoint(), colorsConverted, requestOptions, context)); - } - - /** - * The csv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response csvWithResponse(List colors, RequestOptions requestOptions) { - String colorsConverted = colors.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.csvSync(this.client.getEndpoint(), colorsConverted, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/QueriesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/QueriesImpl.java deleted file mode 100644 index 3d0b78de9b3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/QueriesImpl.java +++ /dev/null @@ -1,289 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.collectionformat.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Queries. - */ -public final class QueriesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final QueriesService service; - - /** - * The service client containing this operation class. - */ - private final CollectionFormatClientImpl client; - - /** - * Initializes an instance of QueriesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - QueriesImpl(CollectionFormatClientImpl client) { - this.service = RestProxy.create(QueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for CollectionFormatClientQueries to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "CollectionFormatClientQueries") - public interface QueriesService { - @Get("/parameters/collection-format/query/multi") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> multi(@HostParam("endpoint") String endpoint, - @QueryParam(value = "colors", multipleQueryParams = true) List colors, - RequestOptions requestOptions, Context context); - - @Get("/parameters/collection-format/query/multi") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response multiSync(@HostParam("endpoint") String endpoint, - @QueryParam(value = "colors", multipleQueryParams = true) List colors, - RequestOptions requestOptions, Context context); - - @Get("/parameters/collection-format/query/ssv") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> ssv(@HostParam("endpoint") String endpoint, @QueryParam("colors") String colors, - RequestOptions requestOptions, Context context); - - @Get("/parameters/collection-format/query/ssv") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response ssvSync(@HostParam("endpoint") String endpoint, @QueryParam("colors") String colors, - RequestOptions requestOptions, Context context); - - @Get("/parameters/collection-format/query/pipes") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> pipes(@HostParam("endpoint") String endpoint, @QueryParam("colors") String colors, - RequestOptions requestOptions, Context context); - - @Get("/parameters/collection-format/query/pipes") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response pipesSync(@HostParam("endpoint") String endpoint, @QueryParam("colors") String colors, - RequestOptions requestOptions, Context context); - - @Get("/parameters/collection-format/query/csv") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> csv(@HostParam("endpoint") String endpoint, @QueryParam("colors") String colors, - RequestOptions requestOptions, Context context); - - @Get("/parameters/collection-format/query/csv") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response csvSync(@HostParam("endpoint") String endpoint, @QueryParam("colors") String colors, - RequestOptions requestOptions, Context context); - } - - /** - * The multi operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> multiWithResponseAsync(List colors, RequestOptions requestOptions) { - List colorsConverted - = colors.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return FluxUtil - .withContext(context -> service.multi(this.client.getEndpoint(), colorsConverted, requestOptions, context)); - } - - /** - * The multi operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response multiWithResponse(List colors, RequestOptions requestOptions) { - List colorsConverted - = colors.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return service.multiSync(this.client.getEndpoint(), colorsConverted, requestOptions, Context.NONE); - } - - /** - * The ssv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> ssvWithResponseAsync(List colors, RequestOptions requestOptions) { - String colorsConverted = colors.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(" ")); - return FluxUtil - .withContext(context -> service.ssv(this.client.getEndpoint(), colorsConverted, requestOptions, context)); - } - - /** - * The ssv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response ssvWithResponse(List colors, RequestOptions requestOptions) { - String colorsConverted = colors.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(" ")); - return service.ssvSync(this.client.getEndpoint(), colorsConverted, requestOptions, Context.NONE); - } - - /** - * The pipes operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> pipesWithResponseAsync(List colors, RequestOptions requestOptions) { - String colorsConverted = colors.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining("|")); - return FluxUtil - .withContext(context -> service.pipes(this.client.getEndpoint(), colorsConverted, requestOptions, context)); - } - - /** - * The pipes operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response pipesWithResponse(List colors, RequestOptions requestOptions) { - String colorsConverted = colors.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining("|")); - return service.pipesSync(this.client.getEndpoint(), colorsConverted, requestOptions, Context.NONE); - } - - /** - * The csv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> csvWithResponseAsync(List colors, RequestOptions requestOptions) { - String colorsConverted = colors.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.csv(this.client.getEndpoint(), colorsConverted, requestOptions, context)); - } - - /** - * The csv operation. - * - * @param colors Possible values for colors are [blue,red,green]. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response csvWithResponse(List colors, RequestOptions requestOptions) { - String colorsConverted = colors.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.csvSync(this.client.getEndpoint(), colorsConverted, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/package-info.java deleted file mode 100644 index b3a377ad6cb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for CollectionFormat. - * Test for collectionFormat. - * - */ -package parameters.collectionformat.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/package-info.java deleted file mode 100644 index eab6990f5d3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for CollectionFormat. - * Test for collectionFormat. - * - */ -package parameters.collectionformat; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathAsyncClient.java deleted file mode 100644 index d29c64e0b8d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathAsyncClient.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.path; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import parameters.path.implementation.PathClientImpl; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous PathClient type. - */ -@ServiceClient(builder = PathClientBuilder.class, isAsync = true) -public final class PathAsyncClient { - @Generated - private final PathClientImpl serviceClient; - - /** - * Initializes an instance of PathAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathAsyncClient(PathClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The normal operation. - * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> normalWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.normalWithResponseAsync(name, requestOptions); - } - - /** - * The optional operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> optionalWithResponse(RequestOptions requestOptions) { - return this.serviceClient.optionalWithResponseAsync(requestOptions); - } - - /** - * The normal operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono normal(String name) { - // Generated convenience method for normalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return normalWithResponse(name, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The optional operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono optional(String name) { - // Generated convenience method for optionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return optionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The optional operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono optional() { - // Generated convenience method for optionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return optionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClient.java deleted file mode 100644 index 8784b742833..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClient.java +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.path; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import parameters.path.implementation.PathClientImpl; - -/** - * Initializes a new instance of the synchronous PathClient type. - */ -@ServiceClient(builder = PathClientBuilder.class) -public final class PathClient { - @Generated - private final PathClientImpl serviceClient; - - /** - * Initializes an instance of PathClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathClient(PathClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The normal operation. - * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response normalWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.normalWithResponse(name, requestOptions); - } - - /** - * The optional operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response optionalWithResponse(RequestOptions requestOptions) { - return this.serviceClient.optionalWithResponse(requestOptions); - } - - /** - * The normal operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void normal(String name) { - // Generated convenience method for normalWithResponse - RequestOptions requestOptions = new RequestOptions(); - normalWithResponse(name, requestOptions).getValue(); - } - - /** - * The optional operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void optional(String name) { - // Generated convenience method for optionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - optionalWithResponse(requestOptions).getValue(); - } - - /** - * The optional operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void optional() { - // Generated convenience method for optionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - optionalWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClientBuilder.java deleted file mode 100644 index 1cebf5077d7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.path; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import parameters.path.implementation.PathClientImpl; - -/** - * A builder for creating a new instance of the PathClient type. - */ -@ServiceClientBuilder(serviceClients = { PathClient.class, PathAsyncClient.class }) -public final class PathClientBuilder - implements HttpTrait, ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("parameters-path.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the PathClientBuilder. - */ - @Generated - public PathClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PathClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the PathClientBuilder. - */ - @Generated - public PathClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of PathClientImpl with the provided parameters. - * - * @return an instance of PathClientImpl. - */ - @Generated - private PathClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - PathClientImpl client - = new PathClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of PathAsyncClient class. - * - * @return an instance of PathAsyncClient. - */ - @Generated - public PathAsyncClient buildAsyncClient() { - return new PathAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of PathClient class. - * - * @return an instance of PathClient. - */ - @Generated - public PathClient buildClient() { - return new PathClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(PathClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/PathClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/PathClientImpl.java deleted file mode 100644 index afc7377b430..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/PathClientImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.path.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the PathClient type. - */ -public final class PathClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of PathClient client. - * - * @param endpoint Service host. - */ - public PathClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of PathClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public PathClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of PathClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public PathClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(PathClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for PathClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "PathClient") - public interface PathClientService { - @Get("/parameters/path/normal/{name}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> normal(@HostParam("endpoint") String endpoint, @PathParam("name") String name, - RequestOptions requestOptions, Context context); - - @Get("/parameters/path/normal/{name}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response normalSync(@HostParam("endpoint") String endpoint, @PathParam("name") String name, - RequestOptions requestOptions, Context context); - - @Get("/parameters/path/optional{name}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> optional(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/parameters/path/optional{name}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response optionalSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The normal operation. - * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> normalWithResponseAsync(String name, RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.normal(this.getEndpoint(), name, requestOptions, context)); - } - - /** - * The normal operation. - * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response normalWithResponse(String name, RequestOptions requestOptions) { - return service.normalSync(this.getEndpoint(), name, requestOptions, Context.NONE); - } - - /** - * The optional operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> optionalWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.optional(this.getEndpoint(), requestOptions, context)); - } - - /** - * The optional operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response optionalWithResponse(RequestOptions requestOptions) { - return service.optionalSync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/package-info.java deleted file mode 100644 index 1888a5d5cae..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Path. - * Test for path parameters cases. - * - */ -package parameters.path.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/package-info.java deleted file mode 100644 index a52de46e2d4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Path. - * Test for path parameters cases. - * - */ -package parameters.path; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasAsyncClient.java deleted file mode 100644 index 974e5d7b741..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasAsyncClient.java +++ /dev/null @@ -1,361 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import java.util.List; -import parameters.spread.alias.implementation.models.SpreadAsRequestBodyRequest; -import parameters.spread.implementation.AliasImpl; -import parameters.spread.implementation.models.SpreadAsRequestParameterRequest; -import parameters.spread.implementation.models.SpreadParameterWithInnerAliasRequest; -import parameters.spread.implementation.models.SpreadParameterWithInnerModelRequest; -import parameters.spread.implementation.models.SpreadWithMultipleParametersRequest; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous SpreadClient type. - */ -@ServiceClient(builder = SpreadClientBuilder.class, isAsync = true) -public final class AliasAsyncClient { - @Generated - private final AliasImpl serviceClient; - - /** - * Initializes an instance of AliasAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - AliasAsyncClient(AliasImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The spreadAsRequestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param spreadAsRequestBodyRequest The spreadAsRequestBodyRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadAsRequestBodyWithResponse(BinaryData spreadAsRequestBodyRequest, - RequestOptions requestOptions) { - return this.serviceClient.spreadAsRequestBodyWithResponseAsync(spreadAsRequestBodyRequest, requestOptions); - } - - /** - * The spreadParameterWithInnerModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadParameterWithInnerModelRequest The spreadParameterWithInnerModelRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadParameterWithInnerModelWithResponse(String id, String xMsTestHeader, - BinaryData spreadParameterWithInnerModelRequest, RequestOptions requestOptions) { - return this.serviceClient.spreadParameterWithInnerModelWithResponseAsync(id, xMsTestHeader, - spreadParameterWithInnerModelRequest, requestOptions); - } - - /** - * The spreadAsRequestParameter operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadAsRequestParameterRequest The spreadAsRequestParameterRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadAsRequestParameterWithResponse(String id, String xMsTestHeader, - BinaryData spreadAsRequestParameterRequest, RequestOptions requestOptions) { - return this.serviceClient.spreadAsRequestParameterWithResponseAsync(id, xMsTestHeader, - spreadAsRequestParameterRequest, requestOptions); - } - - /** - * The spreadWithMultipleParameters operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredString: String (Required)
-     *     optionalInt: Integer (Optional)
-     *     requiredIntList (Required): [
-     *         int (Required)
-     *     ]
-     *     optionalStringList (Optional): [
-     *         String (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadWithMultipleParametersRequest The spreadWithMultipleParametersRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadWithMultipleParametersWithResponse(String id, String xMsTestHeader, - BinaryData spreadWithMultipleParametersRequest, RequestOptions requestOptions) { - return this.serviceClient.spreadWithMultipleParametersWithResponseAsync(id, xMsTestHeader, - spreadWithMultipleParametersRequest, requestOptions); - } - - /** - * spread an alias with contains another alias property as body. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadParameterWithInnerAliasRequest The spreadParameterWithInnerAliasRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadParameterWithInnerAliasWithResponse(String id, String xMsTestHeader, - BinaryData spreadParameterWithInnerAliasRequest, RequestOptions requestOptions) { - return this.serviceClient.spreadParameterWithInnerAliasWithResponseAsync(id, xMsTestHeader, - spreadParameterWithInnerAliasRequest, requestOptions); - } - - /** - * The spreadAsRequestBody operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono spreadAsRequestBody(String name) { - // Generated convenience method for spreadAsRequestBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadAsRequestBodyRequest spreadAsRequestBodyRequestObj = new SpreadAsRequestBodyRequest(name); - BinaryData spreadAsRequestBodyRequest = BinaryData.fromObject(spreadAsRequestBodyRequestObj); - return spreadAsRequestBodyWithResponse(spreadAsRequestBodyRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The spreadParameterWithInnerModel operation. - * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono spreadParameterWithInnerModel(String id, String xMsTestHeader, String name) { - // Generated convenience method for spreadParameterWithInnerModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadParameterWithInnerModelRequest spreadParameterWithInnerModelRequestObj - = new SpreadParameterWithInnerModelRequest(name); - BinaryData spreadParameterWithInnerModelRequest - = BinaryData.fromObject(spreadParameterWithInnerModelRequestObj); - return spreadParameterWithInnerModelWithResponse(id, xMsTestHeader, spreadParameterWithInnerModelRequest, - requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The spreadAsRequestParameter operation. - * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono spreadAsRequestParameter(String id, String xMsTestHeader, String name) { - // Generated convenience method for spreadAsRequestParameterWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadAsRequestParameterRequest spreadAsRequestParameterRequestObj = new SpreadAsRequestParameterRequest(name); - BinaryData spreadAsRequestParameterRequest = BinaryData.fromObject(spreadAsRequestParameterRequestObj); - return spreadAsRequestParameterWithResponse(id, xMsTestHeader, spreadAsRequestParameterRequest, requestOptions) - .flatMap(FluxUtil::toMono); - } - - /** - * The spreadWithMultipleParameters operation. - * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param requiredString required string. - * @param requiredIntList required int. - * @param optionalInt optional int. - * @param optionalStringList optional string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono spreadWithMultipleParameters(String id, String xMsTestHeader, String requiredString, - List requiredIntList, Integer optionalInt, List optionalStringList) { - // Generated convenience method for spreadWithMultipleParametersWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadWithMultipleParametersRequest spreadWithMultipleParametersRequestObj - = new SpreadWithMultipleParametersRequest(requiredString, requiredIntList).setOptionalInt(optionalInt) - .setOptionalStringList(optionalStringList); - BinaryData spreadWithMultipleParametersRequest = BinaryData.fromObject(spreadWithMultipleParametersRequestObj); - return spreadWithMultipleParametersWithResponse(id, xMsTestHeader, spreadWithMultipleParametersRequest, - requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The spreadWithMultipleParameters operation. - * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param requiredString required string. - * @param requiredIntList required int. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono spreadWithMultipleParameters(String id, String xMsTestHeader, String requiredString, - List requiredIntList) { - // Generated convenience method for spreadWithMultipleParametersWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadWithMultipleParametersRequest spreadWithMultipleParametersRequestObj - = new SpreadWithMultipleParametersRequest(requiredString, requiredIntList); - BinaryData spreadWithMultipleParametersRequest = BinaryData.fromObject(spreadWithMultipleParametersRequestObj); - return spreadWithMultipleParametersWithResponse(id, xMsTestHeader, spreadWithMultipleParametersRequest, - requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * spread an alias with contains another alias property as body. - * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param name name of the Thing. - * @param age age of the Thing. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono spreadParameterWithInnerAlias(String id, String xMsTestHeader, String name, int age) { - // Generated convenience method for spreadParameterWithInnerAliasWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadParameterWithInnerAliasRequest spreadParameterWithInnerAliasRequestObj - = new SpreadParameterWithInnerAliasRequest(name, age); - BinaryData spreadParameterWithInnerAliasRequest - = BinaryData.fromObject(spreadParameterWithInnerAliasRequestObj); - return spreadParameterWithInnerAliasWithResponse(id, xMsTestHeader, spreadParameterWithInnerAliasRequest, - requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasClient.java deleted file mode 100644 index a8faa210759..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasClient.java +++ /dev/null @@ -1,353 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import java.util.List; -import parameters.spread.alias.implementation.models.SpreadAsRequestBodyRequest; -import parameters.spread.implementation.AliasImpl; -import parameters.spread.implementation.models.SpreadAsRequestParameterRequest; -import parameters.spread.implementation.models.SpreadParameterWithInnerAliasRequest; -import parameters.spread.implementation.models.SpreadParameterWithInnerModelRequest; -import parameters.spread.implementation.models.SpreadWithMultipleParametersRequest; - -/** - * Initializes a new instance of the synchronous SpreadClient type. - */ -@ServiceClient(builder = SpreadClientBuilder.class) -public final class AliasClient { - @Generated - private final AliasImpl serviceClient; - - /** - * Initializes an instance of AliasClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - AliasClient(AliasImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The spreadAsRequestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param spreadAsRequestBodyRequest The spreadAsRequestBodyRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadAsRequestBodyWithResponse(BinaryData spreadAsRequestBodyRequest, - RequestOptions requestOptions) { - return this.serviceClient.spreadAsRequestBodyWithResponse(spreadAsRequestBodyRequest, requestOptions); - } - - /** - * The spreadParameterWithInnerModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadParameterWithInnerModelRequest The spreadParameterWithInnerModelRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadParameterWithInnerModelWithResponse(String id, String xMsTestHeader, - BinaryData spreadParameterWithInnerModelRequest, RequestOptions requestOptions) { - return this.serviceClient.spreadParameterWithInnerModelWithResponse(id, xMsTestHeader, - spreadParameterWithInnerModelRequest, requestOptions); - } - - /** - * The spreadAsRequestParameter operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadAsRequestParameterRequest The spreadAsRequestParameterRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadAsRequestParameterWithResponse(String id, String xMsTestHeader, - BinaryData spreadAsRequestParameterRequest, RequestOptions requestOptions) { - return this.serviceClient.spreadAsRequestParameterWithResponse(id, xMsTestHeader, - spreadAsRequestParameterRequest, requestOptions); - } - - /** - * The spreadWithMultipleParameters operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredString: String (Required)
-     *     optionalInt: Integer (Optional)
-     *     requiredIntList (Required): [
-     *         int (Required)
-     *     ]
-     *     optionalStringList (Optional): [
-     *         String (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadWithMultipleParametersRequest The spreadWithMultipleParametersRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadWithMultipleParametersWithResponse(String id, String xMsTestHeader, - BinaryData spreadWithMultipleParametersRequest, RequestOptions requestOptions) { - return this.serviceClient.spreadWithMultipleParametersWithResponse(id, xMsTestHeader, - spreadWithMultipleParametersRequest, requestOptions); - } - - /** - * spread an alias with contains another alias property as body. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadParameterWithInnerAliasRequest The spreadParameterWithInnerAliasRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadParameterWithInnerAliasWithResponse(String id, String xMsTestHeader, - BinaryData spreadParameterWithInnerAliasRequest, RequestOptions requestOptions) { - return this.serviceClient.spreadParameterWithInnerAliasWithResponse(id, xMsTestHeader, - spreadParameterWithInnerAliasRequest, requestOptions); - } - - /** - * The spreadAsRequestBody operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void spreadAsRequestBody(String name) { - // Generated convenience method for spreadAsRequestBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadAsRequestBodyRequest spreadAsRequestBodyRequestObj = new SpreadAsRequestBodyRequest(name); - BinaryData spreadAsRequestBodyRequest = BinaryData.fromObject(spreadAsRequestBodyRequestObj); - spreadAsRequestBodyWithResponse(spreadAsRequestBodyRequest, requestOptions).getValue(); - } - - /** - * The spreadParameterWithInnerModel operation. - * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void spreadParameterWithInnerModel(String id, String xMsTestHeader, String name) { - // Generated convenience method for spreadParameterWithInnerModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadParameterWithInnerModelRequest spreadParameterWithInnerModelRequestObj - = new SpreadParameterWithInnerModelRequest(name); - BinaryData spreadParameterWithInnerModelRequest - = BinaryData.fromObject(spreadParameterWithInnerModelRequestObj); - spreadParameterWithInnerModelWithResponse(id, xMsTestHeader, spreadParameterWithInnerModelRequest, - requestOptions).getValue(); - } - - /** - * The spreadAsRequestParameter operation. - * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void spreadAsRequestParameter(String id, String xMsTestHeader, String name) { - // Generated convenience method for spreadAsRequestParameterWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadAsRequestParameterRequest spreadAsRequestParameterRequestObj = new SpreadAsRequestParameterRequest(name); - BinaryData spreadAsRequestParameterRequest = BinaryData.fromObject(spreadAsRequestParameterRequestObj); - spreadAsRequestParameterWithResponse(id, xMsTestHeader, spreadAsRequestParameterRequest, requestOptions) - .getValue(); - } - - /** - * The spreadWithMultipleParameters operation. - * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param requiredString required string. - * @param requiredIntList required int. - * @param optionalInt optional int. - * @param optionalStringList optional string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void spreadWithMultipleParameters(String id, String xMsTestHeader, String requiredString, - List requiredIntList, Integer optionalInt, List optionalStringList) { - // Generated convenience method for spreadWithMultipleParametersWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadWithMultipleParametersRequest spreadWithMultipleParametersRequestObj - = new SpreadWithMultipleParametersRequest(requiredString, requiredIntList).setOptionalInt(optionalInt) - .setOptionalStringList(optionalStringList); - BinaryData spreadWithMultipleParametersRequest = BinaryData.fromObject(spreadWithMultipleParametersRequestObj); - spreadWithMultipleParametersWithResponse(id, xMsTestHeader, spreadWithMultipleParametersRequest, requestOptions) - .getValue(); - } - - /** - * The spreadWithMultipleParameters operation. - * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param requiredString required string. - * @param requiredIntList required int. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void spreadWithMultipleParameters(String id, String xMsTestHeader, String requiredString, - List requiredIntList) { - // Generated convenience method for spreadWithMultipleParametersWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadWithMultipleParametersRequest spreadWithMultipleParametersRequestObj - = new SpreadWithMultipleParametersRequest(requiredString, requiredIntList); - BinaryData spreadWithMultipleParametersRequest = BinaryData.fromObject(spreadWithMultipleParametersRequestObj); - spreadWithMultipleParametersWithResponse(id, xMsTestHeader, spreadWithMultipleParametersRequest, requestOptions) - .getValue(); - } - - /** - * spread an alias with contains another alias property as body. - * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param name name of the Thing. - * @param age age of the Thing. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void spreadParameterWithInnerAlias(String id, String xMsTestHeader, String name, int age) { - // Generated convenience method for spreadParameterWithInnerAliasWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadParameterWithInnerAliasRequest spreadParameterWithInnerAliasRequestObj - = new SpreadParameterWithInnerAliasRequest(name, age); - BinaryData spreadParameterWithInnerAliasRequest - = BinaryData.fromObject(spreadParameterWithInnerAliasRequestObj); - spreadParameterWithInnerAliasWithResponse(id, xMsTestHeader, spreadParameterWithInnerAliasRequest, - requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelAsyncClient.java deleted file mode 100644 index 0bb9d5521a8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelAsyncClient.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import parameters.spread.implementation.ModelsImpl; -import parameters.spread.implementation.models.SpreadCompositeRequestMixRequest; -import parameters.spread.model.models.BodyParameter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous SpreadClient type. - */ -@ServiceClient(builder = SpreadClientBuilder.class, isAsync = true) -public final class ModelAsyncClient { - @Generated - private final ModelsImpl serviceClient; - - /** - * Initializes an instance of ModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelAsyncClient(ModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The spreadAsRequestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyParameter The bodyParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadAsRequestBodyWithResponse(BinaryData bodyParameter, - RequestOptions requestOptions) { - return this.serviceClient.spreadAsRequestBodyWithResponseAsync(bodyParameter, requestOptions); - } - - /** - * The spreadCompositeRequestOnlyWithBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadCompositeRequestOnlyWithBodyWithResponse(BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.spreadCompositeRequestOnlyWithBodyWithResponseAsync(body, requestOptions); - } - - /** - * The spreadCompositeRequestWithoutBody operation. - * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadCompositeRequestWithoutBodyWithResponse(String name, String testHeader, - RequestOptions requestOptions) { - return this.serviceClient.spreadCompositeRequestWithoutBodyWithResponseAsync(name, testHeader, requestOptions); - } - - /** - * The spreadCompositeRequest operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadCompositeRequestWithResponse(String name, String testHeader, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.spreadCompositeRequestWithResponseAsync(name, testHeader, body, requestOptions); - } - - /** - * The spreadCompositeRequestMix operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param spreadCompositeRequestMixRequest The spreadCompositeRequestMixRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadCompositeRequestMixWithResponse(String name, String testHeader, - BinaryData spreadCompositeRequestMixRequest, RequestOptions requestOptions) { - return this.serviceClient.spreadCompositeRequestMixWithResponseAsync(name, testHeader, - spreadCompositeRequestMixRequest, requestOptions); - } - - /** - * The spreadAsRequestBody operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono spreadAsRequestBody(String name) { - // Generated convenience method for spreadAsRequestBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - BodyParameter bodyParameterObj = new BodyParameter(name); - BinaryData bodyParameter = BinaryData.fromObject(bodyParameterObj); - return spreadAsRequestBodyWithResponse(bodyParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The spreadCompositeRequestOnlyWithBody operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono spreadCompositeRequestOnlyWithBody(BodyParameter body) { - // Generated convenience method for spreadCompositeRequestOnlyWithBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return spreadCompositeRequestOnlyWithBodyWithResponse(BinaryData.fromObject(body), requestOptions) - .flatMap(FluxUtil::toMono); - } - - /** - * The spreadCompositeRequestWithoutBody operation. - * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono spreadCompositeRequestWithoutBody(String name, String testHeader) { - // Generated convenience method for spreadCompositeRequestWithoutBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return spreadCompositeRequestWithoutBodyWithResponse(name, testHeader, requestOptions) - .flatMap(FluxUtil::toMono); - } - - /** - * The spreadCompositeRequest operation. - * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono spreadCompositeRequest(String name, String testHeader, BodyParameter body) { - // Generated convenience method for spreadCompositeRequestWithResponse - RequestOptions requestOptions = new RequestOptions(); - return spreadCompositeRequestWithResponse(name, testHeader, BinaryData.fromObject(body), requestOptions) - .flatMap(FluxUtil::toMono); - } - - /** - * The spreadCompositeRequestMix operation. - * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono spreadCompositeRequestMix(String name, String testHeader, String prop) { - // Generated convenience method for spreadCompositeRequestMixWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadCompositeRequestMixRequest spreadCompositeRequestMixRequestObj - = new SpreadCompositeRequestMixRequest(prop); - BinaryData spreadCompositeRequestMixRequest = BinaryData.fromObject(spreadCompositeRequestMixRequestObj); - return spreadCompositeRequestMixWithResponse(name, testHeader, spreadCompositeRequestMixRequest, requestOptions) - .flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelClient.java deleted file mode 100644 index 3870ce5b144..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelClient.java +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import parameters.spread.implementation.ModelsImpl; -import parameters.spread.implementation.models.SpreadCompositeRequestMixRequest; -import parameters.spread.model.models.BodyParameter; - -/** - * Initializes a new instance of the synchronous SpreadClient type. - */ -@ServiceClient(builder = SpreadClientBuilder.class) -public final class ModelClient { - @Generated - private final ModelsImpl serviceClient; - - /** - * Initializes an instance of ModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelClient(ModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The spreadAsRequestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyParameter The bodyParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadAsRequestBodyWithResponse(BinaryData bodyParameter, RequestOptions requestOptions) { - return this.serviceClient.spreadAsRequestBodyWithResponse(bodyParameter, requestOptions); - } - - /** - * The spreadCompositeRequestOnlyWithBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadCompositeRequestOnlyWithBodyWithResponse(BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.spreadCompositeRequestOnlyWithBodyWithResponse(body, requestOptions); - } - - /** - * The spreadCompositeRequestWithoutBody operation. - * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadCompositeRequestWithoutBodyWithResponse(String name, String testHeader, - RequestOptions requestOptions) { - return this.serviceClient.spreadCompositeRequestWithoutBodyWithResponse(name, testHeader, requestOptions); - } - - /** - * The spreadCompositeRequest operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadCompositeRequestWithResponse(String name, String testHeader, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.spreadCompositeRequestWithResponse(name, testHeader, body, requestOptions); - } - - /** - * The spreadCompositeRequestMix operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param spreadCompositeRequestMixRequest The spreadCompositeRequestMixRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadCompositeRequestMixWithResponse(String name, String testHeader, - BinaryData spreadCompositeRequestMixRequest, RequestOptions requestOptions) { - return this.serviceClient.spreadCompositeRequestMixWithResponse(name, testHeader, - spreadCompositeRequestMixRequest, requestOptions); - } - - /** - * The spreadAsRequestBody operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void spreadAsRequestBody(String name) { - // Generated convenience method for spreadAsRequestBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - BodyParameter bodyParameterObj = new BodyParameter(name); - BinaryData bodyParameter = BinaryData.fromObject(bodyParameterObj); - spreadAsRequestBodyWithResponse(bodyParameter, requestOptions).getValue(); - } - - /** - * The spreadCompositeRequestOnlyWithBody operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void spreadCompositeRequestOnlyWithBody(BodyParameter body) { - // Generated convenience method for spreadCompositeRequestOnlyWithBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - spreadCompositeRequestOnlyWithBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The spreadCompositeRequestWithoutBody operation. - * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void spreadCompositeRequestWithoutBody(String name, String testHeader) { - // Generated convenience method for spreadCompositeRequestWithoutBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - spreadCompositeRequestWithoutBodyWithResponse(name, testHeader, requestOptions).getValue(); - } - - /** - * The spreadCompositeRequest operation. - * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void spreadCompositeRequest(String name, String testHeader, BodyParameter body) { - // Generated convenience method for spreadCompositeRequestWithResponse - RequestOptions requestOptions = new RequestOptions(); - spreadCompositeRequestWithResponse(name, testHeader, BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The spreadCompositeRequestMix operation. - * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void spreadCompositeRequestMix(String name, String testHeader, String prop) { - // Generated convenience method for spreadCompositeRequestMixWithResponse - RequestOptions requestOptions = new RequestOptions(); - SpreadCompositeRequestMixRequest spreadCompositeRequestMixRequestObj - = new SpreadCompositeRequestMixRequest(prop); - BinaryData spreadCompositeRequestMixRequest = BinaryData.fromObject(spreadCompositeRequestMixRequestObj); - spreadCompositeRequestMixWithResponse(name, testHeader, spreadCompositeRequestMixRequest, requestOptions) - .getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/SpreadClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/SpreadClientBuilder.java deleted file mode 100644 index de3ecd9c5d5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/SpreadClientBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import parameters.spread.implementation.SpreadClientImpl; - -/** - * A builder for creating a new instance of the SpreadClient type. - */ -@ServiceClientBuilder( - serviceClients = { ModelClient.class, AliasClient.class, ModelAsyncClient.class, AliasAsyncClient.class }) -public final class SpreadClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("parameters-spread.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the SpreadClientBuilder. - */ - @Generated - public SpreadClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpreadClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpreadClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpreadClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpreadClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpreadClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpreadClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpreadClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpreadClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the SpreadClientBuilder. - */ - @Generated - public SpreadClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of SpreadClientImpl with the provided parameters. - * - * @return an instance of SpreadClientImpl. - */ - @Generated - private SpreadClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - SpreadClientImpl client - = new SpreadClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ModelAsyncClient class. - * - * @return an instance of ModelAsyncClient. - */ - @Generated - public ModelAsyncClient buildModelAsyncClient() { - return new ModelAsyncClient(buildInnerClient().getModels()); - } - - /** - * Builds an instance of AliasAsyncClient class. - * - * @return an instance of AliasAsyncClient. - */ - @Generated - public AliasAsyncClient buildAliasAsyncClient() { - return new AliasAsyncClient(buildInnerClient().getAlias()); - } - - /** - * Builds an instance of ModelClient class. - * - * @return an instance of ModelClient. - */ - @Generated - public ModelClient buildModelClient() { - return new ModelClient(buildInnerClient().getModels()); - } - - /** - * Builds an instance of AliasClient class. - * - * @return an instance of AliasClient. - */ - @Generated - public AliasClient buildAliasClient() { - return new AliasClient(buildInnerClient().getAlias()); - } - - private static final ClientLogger LOGGER = new ClientLogger(SpreadClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/SpreadAsRequestBodyRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/SpreadAsRequestBodyRequest.java deleted file mode 100644 index ae982101e3e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/SpreadAsRequestBodyRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread.alias.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The SpreadAsRequestBodyRequest model. - */ -@Immutable -public final class SpreadAsRequestBodyRequest implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of SpreadAsRequestBodyRequest class. - * - * @param name the name value to set. - */ - @Generated - public SpreadAsRequestBodyRequest(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadAsRequestBodyRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadAsRequestBodyRequest if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadAsRequestBodyRequest. - */ - @Generated - public static SpreadAsRequestBodyRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new SpreadAsRequestBodyRequest(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/package-info.java deleted file mode 100644 index 970bd234545..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Spread. - * Test for the spread operator. - * - */ -package parameters.spread.alias.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/AliasImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/AliasImpl.java deleted file mode 100644 index 3e3a5c432a5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/AliasImpl.java +++ /dev/null @@ -1,491 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Alias. - */ -public final class AliasImpl { - /** - * The proxy service used to perform REST calls. - */ - private final AliasService service; - - /** - * The service client containing this operation class. - */ - private final SpreadClientImpl client; - - /** - * Initializes an instance of AliasImpl. - * - * @param client the instance of the service client containing this operation class. - */ - AliasImpl(SpreadClientImpl client) { - this.service = RestProxy.create(AliasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for SpreadClientAlias to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SpreadClientAlias") - public interface AliasService { - @Put("/parameters/spread/alias/request-body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> spreadAsRequestBody(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData spreadAsRequestBodyRequest, RequestOptions requestOptions, - Context context); - - @Put("/parameters/spread/alias/request-body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response spreadAsRequestBodySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData spreadAsRequestBodyRequest, RequestOptions requestOptions, - Context context); - - @Post("/parameters/spread/alias/inner-model-parameter/{id}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> spreadParameterWithInnerModel(@HostParam("endpoint") String endpoint, - @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData spreadParameterWithInnerModelRequest, - RequestOptions requestOptions, Context context); - - @Post("/parameters/spread/alias/inner-model-parameter/{id}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response spreadParameterWithInnerModelSync(@HostParam("endpoint") String endpoint, - @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData spreadParameterWithInnerModelRequest, - RequestOptions requestOptions, Context context); - - @Put("/parameters/spread/alias/request-parameter/{id}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> spreadAsRequestParameter(@HostParam("endpoint") String endpoint, - @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData spreadAsRequestParameterRequest, RequestOptions requestOptions, - Context context); - - @Put("/parameters/spread/alias/request-parameter/{id}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response spreadAsRequestParameterSync(@HostParam("endpoint") String endpoint, @PathParam("id") String id, - @HeaderParam("x-ms-test-header") String xMsTestHeader, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData spreadAsRequestParameterRequest, RequestOptions requestOptions, - Context context); - - @Put("/parameters/spread/alias/multiple-parameters/{id}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> spreadWithMultipleParameters(@HostParam("endpoint") String endpoint, - @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData spreadWithMultipleParametersRequest, - RequestOptions requestOptions, Context context); - - @Put("/parameters/spread/alias/multiple-parameters/{id}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response spreadWithMultipleParametersSync(@HostParam("endpoint") String endpoint, - @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData spreadWithMultipleParametersRequest, - RequestOptions requestOptions, Context context); - - @Post("/parameters/spread/alias/inner-alias-parameter/{id}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> spreadParameterWithInnerAlias(@HostParam("endpoint") String endpoint, - @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData spreadParameterWithInnerAliasRequest, - RequestOptions requestOptions, Context context); - - @Post("/parameters/spread/alias/inner-alias-parameter/{id}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response spreadParameterWithInnerAliasSync(@HostParam("endpoint") String endpoint, - @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData spreadParameterWithInnerAliasRequest, - RequestOptions requestOptions, Context context); - } - - /** - * The spreadAsRequestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param spreadAsRequestBodyRequest The spreadAsRequestBodyRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadAsRequestBodyWithResponseAsync(BinaryData spreadAsRequestBodyRequest, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.spreadAsRequestBody(this.client.getEndpoint(), contentType, - spreadAsRequestBodyRequest, requestOptions, context)); - } - - /** - * The spreadAsRequestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param spreadAsRequestBodyRequest The spreadAsRequestBodyRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadAsRequestBodyWithResponse(BinaryData spreadAsRequestBodyRequest, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.spreadAsRequestBodySync(this.client.getEndpoint(), contentType, spreadAsRequestBodyRequest, - requestOptions, Context.NONE); - } - - /** - * The spreadParameterWithInnerModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadParameterWithInnerModelRequest The spreadParameterWithInnerModelRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadParameterWithInnerModelWithResponseAsync(String id, String xMsTestHeader, - BinaryData spreadParameterWithInnerModelRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.spreadParameterWithInnerModel(this.client.getEndpoint(), id, - xMsTestHeader, contentType, spreadParameterWithInnerModelRequest, requestOptions, context)); - } - - /** - * The spreadParameterWithInnerModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadParameterWithInnerModelRequest The spreadParameterWithInnerModelRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadParameterWithInnerModelWithResponse(String id, String xMsTestHeader, - BinaryData spreadParameterWithInnerModelRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.spreadParameterWithInnerModelSync(this.client.getEndpoint(), id, xMsTestHeader, contentType, - spreadParameterWithInnerModelRequest, requestOptions, Context.NONE); - } - - /** - * The spreadAsRequestParameter operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadAsRequestParameterRequest The spreadAsRequestParameterRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadAsRequestParameterWithResponseAsync(String id, String xMsTestHeader, - BinaryData spreadAsRequestParameterRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.spreadAsRequestParameter(this.client.getEndpoint(), id, - xMsTestHeader, contentType, spreadAsRequestParameterRequest, requestOptions, context)); - } - - /** - * The spreadAsRequestParameter operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadAsRequestParameterRequest The spreadAsRequestParameterRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadAsRequestParameterWithResponse(String id, String xMsTestHeader, - BinaryData spreadAsRequestParameterRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.spreadAsRequestParameterSync(this.client.getEndpoint(), id, xMsTestHeader, contentType, - spreadAsRequestParameterRequest, requestOptions, Context.NONE); - } - - /** - * The spreadWithMultipleParameters operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredString: String (Required)
-     *     optionalInt: Integer (Optional)
-     *     requiredIntList (Required): [
-     *         int (Required)
-     *     ]
-     *     optionalStringList (Optional): [
-     *         String (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadWithMultipleParametersRequest The spreadWithMultipleParametersRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadWithMultipleParametersWithResponseAsync(String id, String xMsTestHeader, - BinaryData spreadWithMultipleParametersRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.spreadWithMultipleParameters(this.client.getEndpoint(), id, - xMsTestHeader, contentType, spreadWithMultipleParametersRequest, requestOptions, context)); - } - - /** - * The spreadWithMultipleParameters operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredString: String (Required)
-     *     optionalInt: Integer (Optional)
-     *     requiredIntList (Required): [
-     *         int (Required)
-     *     ]
-     *     optionalStringList (Optional): [
-     *         String (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadWithMultipleParametersRequest The spreadWithMultipleParametersRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadWithMultipleParametersWithResponse(String id, String xMsTestHeader, - BinaryData spreadWithMultipleParametersRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.spreadWithMultipleParametersSync(this.client.getEndpoint(), id, xMsTestHeader, contentType, - spreadWithMultipleParametersRequest, requestOptions, Context.NONE); - } - - /** - * spread an alias with contains another alias property as body. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadParameterWithInnerAliasRequest The spreadParameterWithInnerAliasRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadParameterWithInnerAliasWithResponseAsync(String id, String xMsTestHeader, - BinaryData spreadParameterWithInnerAliasRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.spreadParameterWithInnerAlias(this.client.getEndpoint(), id, - xMsTestHeader, contentType, spreadParameterWithInnerAliasRequest, requestOptions, context)); - } - - /** - * spread an alias with contains another alias property as body. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param xMsTestHeader The xMsTestHeader parameter. - * @param spreadParameterWithInnerAliasRequest The spreadParameterWithInnerAliasRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadParameterWithInnerAliasWithResponse(String id, String xMsTestHeader, - BinaryData spreadParameterWithInnerAliasRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.spreadParameterWithInnerAliasSync(this.client.getEndpoint(), id, xMsTestHeader, contentType, - spreadParameterWithInnerAliasRequest, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/ModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/ModelsImpl.java deleted file mode 100644 index 1f35a3fb6a2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/ModelsImpl.java +++ /dev/null @@ -1,436 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Models. - */ -public final class ModelsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ModelsService service; - - /** - * The service client containing this operation class. - */ - private final SpreadClientImpl client; - - /** - * Initializes an instance of ModelsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ModelsImpl(SpreadClientImpl client) { - this.service = RestProxy.create(ModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for SpreadClientModels to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SpreadClientModels") - public interface ModelsService { - @Put("/parameters/spread/model/request-body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> spreadAsRequestBody(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData bodyParameter, - RequestOptions requestOptions, Context context); - - @Put("/parameters/spread/model/request-body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response spreadAsRequestBodySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData bodyParameter, - RequestOptions requestOptions, Context context); - - @Put("/parameters/spread/model/composite-request-only-with-body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> spreadCompositeRequestOnlyWithBody(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/parameters/spread/model/composite-request-only-with-body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response spreadCompositeRequestOnlyWithBodySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/parameters/spread/model/composite-request-without-body/{name}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> spreadCompositeRequestWithoutBody(@HostParam("endpoint") String endpoint, - @PathParam("name") String name, @HeaderParam("test-header") String testHeader, - RequestOptions requestOptions, Context context); - - @Put("/parameters/spread/model/composite-request-without-body/{name}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response spreadCompositeRequestWithoutBodySync(@HostParam("endpoint") String endpoint, - @PathParam("name") String name, @HeaderParam("test-header") String testHeader, - RequestOptions requestOptions, Context context); - - @Put("/parameters/spread/model/composite-request/{name}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> spreadCompositeRequest(@HostParam("endpoint") String endpoint, - @PathParam("name") String name, @HeaderParam("test-header") String testHeader, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/parameters/spread/model/composite-request/{name}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response spreadCompositeRequestSync(@HostParam("endpoint") String endpoint, - @PathParam("name") String name, @HeaderParam("test-header") String testHeader, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/parameters/spread/model/composite-request-mix/{name}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> spreadCompositeRequestMix(@HostParam("endpoint") String endpoint, - @PathParam("name") String name, @HeaderParam("test-header") String testHeader, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData spreadCompositeRequestMixRequest, RequestOptions requestOptions, - Context context); - - @Put("/parameters/spread/model/composite-request-mix/{name}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response spreadCompositeRequestMixSync(@HostParam("endpoint") String endpoint, - @PathParam("name") String name, @HeaderParam("test-header") String testHeader, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData spreadCompositeRequestMixRequest, RequestOptions requestOptions, - Context context); - } - - /** - * The spreadAsRequestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyParameter The bodyParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadAsRequestBodyWithResponseAsync(BinaryData bodyParameter, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.spreadAsRequestBody(this.client.getEndpoint(), contentType, - bodyParameter, requestOptions, context)); - } - - /** - * The spreadAsRequestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param bodyParameter The bodyParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadAsRequestBodyWithResponse(BinaryData bodyParameter, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.spreadAsRequestBodySync(this.client.getEndpoint(), contentType, bodyParameter, requestOptions, - Context.NONE); - } - - /** - * The spreadCompositeRequestOnlyWithBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadCompositeRequestOnlyWithBodyWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.spreadCompositeRequestOnlyWithBody(this.client.getEndpoint(), - contentType, body, requestOptions, context)); - } - - /** - * The spreadCompositeRequestOnlyWithBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadCompositeRequestOnlyWithBodyWithResponse(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.spreadCompositeRequestOnlyWithBodySync(this.client.getEndpoint(), contentType, body, - requestOptions, Context.NONE); - } - - /** - * The spreadCompositeRequestWithoutBody operation. - * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadCompositeRequestWithoutBodyWithResponseAsync(String name, String testHeader, - RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.spreadCompositeRequestWithoutBody(this.client.getEndpoint(), - name, testHeader, requestOptions, context)); - } - - /** - * The spreadCompositeRequestWithoutBody operation. - * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadCompositeRequestWithoutBodyWithResponse(String name, String testHeader, - RequestOptions requestOptions) { - return service.spreadCompositeRequestWithoutBodySync(this.client.getEndpoint(), name, testHeader, - requestOptions, Context.NONE); - } - - /** - * The spreadCompositeRequest operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadCompositeRequestWithResponseAsync(String name, String testHeader, BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.spreadCompositeRequest(this.client.getEndpoint(), name, - testHeader, contentType, body, requestOptions, context)); - } - - /** - * The spreadCompositeRequest operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadCompositeRequestWithResponse(String name, String testHeader, BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.spreadCompositeRequestSync(this.client.getEndpoint(), name, testHeader, contentType, body, - requestOptions, Context.NONE); - } - - /** - * The spreadCompositeRequestMix operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param spreadCompositeRequestMixRequest The spreadCompositeRequestMixRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> spreadCompositeRequestMixWithResponseAsync(String name, String testHeader, - BinaryData spreadCompositeRequestMixRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.spreadCompositeRequestMix(this.client.getEndpoint(), name, - testHeader, contentType, spreadCompositeRequestMixRequest, requestOptions, context)); - } - - /** - * The spreadCompositeRequestMix operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param testHeader The testHeader parameter. - * @param spreadCompositeRequestMixRequest The spreadCompositeRequestMixRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response spreadCompositeRequestMixWithResponse(String name, String testHeader, - BinaryData spreadCompositeRequestMixRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.spreadCompositeRequestMixSync(this.client.getEndpoint(), name, testHeader, contentType, - spreadCompositeRequestMixRequest, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/SpreadClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/SpreadClientImpl.java deleted file mode 100644 index 9488e151f85..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/SpreadClientImpl.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 SpreadClient type. - */ -public final class SpreadClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 ModelsImpl object to access its operations. - */ - private final ModelsImpl models; - - /** - * Gets the ModelsImpl object to access its operations. - * - * @return the ModelsImpl object. - */ - public ModelsImpl getModels() { - return this.models; - } - - /** - * The AliasImpl object to access its operations. - */ - private final AliasImpl alias; - - /** - * Gets the AliasImpl object to access its operations. - * - * @return the AliasImpl object. - */ - public AliasImpl getAlias() { - return this.alias; - } - - /** - * Initializes an instance of SpreadClient client. - * - * @param endpoint Service host. - */ - public SpreadClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of SpreadClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public SpreadClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of SpreadClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public SpreadClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.models = new ModelsImpl(this); - this.alias = new AliasImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadAsRequestParameterRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadAsRequestParameterRequest.java deleted file mode 100644 index 5b4f356e1ed..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadAsRequestParameterRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The SpreadAsRequestParameterRequest model. - */ -@Immutable -public final class SpreadAsRequestParameterRequest implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of SpreadAsRequestParameterRequest class. - * - * @param name the name value to set. - */ - @Generated - public SpreadAsRequestParameterRequest(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadAsRequestParameterRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadAsRequestParameterRequest if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadAsRequestParameterRequest. - */ - @Generated - public static SpreadAsRequestParameterRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new SpreadAsRequestParameterRequest(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadCompositeRequestMixRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadCompositeRequestMixRequest.java deleted file mode 100644 index a9338d497fb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadCompositeRequestMixRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The SpreadCompositeRequestMixRequest model. - */ -@Immutable -public final class SpreadCompositeRequestMixRequest implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final String prop; - - /** - * Creates an instance of SpreadCompositeRequestMixRequest class. - * - * @param prop the prop value to set. - */ - @Generated - public SpreadCompositeRequestMixRequest(String prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public String getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadCompositeRequestMixRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadCompositeRequestMixRequest if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadCompositeRequestMixRequest. - */ - @Generated - public static SpreadCompositeRequestMixRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new SpreadCompositeRequestMixRequest(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerAliasRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerAliasRequest.java deleted file mode 100644 index d3c60fd0733..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerAliasRequest.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The SpreadParameterWithInnerAliasRequest model. - */ -@Immutable -public final class SpreadParameterWithInnerAliasRequest - implements JsonSerializable { - /* - * name of the Thing - */ - @Generated - private final String name; - - /* - * age of the Thing - */ - @Generated - private final int age; - - /** - * Creates an instance of SpreadParameterWithInnerAliasRequest class. - * - * @param name the name value to set. - * @param age the age value to set. - */ - @Generated - public SpreadParameterWithInnerAliasRequest(String name, int age) { - this.name = name; - this.age = age; - } - - /** - * Get the name property: name of the Thing. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the age property: age of the Thing. - * - * @return the age value. - */ - @Generated - public int getAge() { - return this.age; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeIntField("age", this.age); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadParameterWithInnerAliasRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadParameterWithInnerAliasRequest if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadParameterWithInnerAliasRequest. - */ - @Generated - public static SpreadParameterWithInnerAliasRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - int age = 0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("age".equals(fieldName)) { - age = reader.getInt(); - } else { - reader.skipChildren(); - } - } - return new SpreadParameterWithInnerAliasRequest(name, age); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerModelRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerModelRequest.java deleted file mode 100644 index 2642974a83d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerModelRequest.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The SpreadParameterWithInnerModelRequest model. - */ -@Immutable -public final class SpreadParameterWithInnerModelRequest - implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of SpreadParameterWithInnerModelRequest class. - * - * @param name the name value to set. - */ - @Generated - public SpreadParameterWithInnerModelRequest(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadParameterWithInnerModelRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadParameterWithInnerModelRequest if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadParameterWithInnerModelRequest. - */ - @Generated - public static SpreadParameterWithInnerModelRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new SpreadParameterWithInnerModelRequest(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadWithMultipleParametersRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadWithMultipleParametersRequest.java deleted file mode 100644 index 41e5bc82a43..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadWithMultipleParametersRequest.java +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The SpreadWithMultipleParametersRequest model. - */ -@Fluent -public final class SpreadWithMultipleParametersRequest - implements JsonSerializable { - /* - * required string - */ - @Generated - private final String requiredString; - - /* - * optional int - */ - @Generated - private Integer optionalInt; - - /* - * required int - */ - @Generated - private final List requiredIntList; - - /* - * optional string - */ - @Generated - private List optionalStringList; - - /** - * Creates an instance of SpreadWithMultipleParametersRequest class. - * - * @param requiredString the requiredString value to set. - * @param requiredIntList the requiredIntList value to set. - */ - @Generated - public SpreadWithMultipleParametersRequest(String requiredString, List requiredIntList) { - this.requiredString = requiredString; - this.requiredIntList = requiredIntList; - } - - /** - * Get the requiredString property: required string. - * - * @return the requiredString value. - */ - @Generated - public String getRequiredString() { - return this.requiredString; - } - - /** - * Get the optionalInt property: optional int. - * - * @return the optionalInt value. - */ - @Generated - public Integer getOptionalInt() { - return this.optionalInt; - } - - /** - * Set the optionalInt property: optional int. - * - * @param optionalInt the optionalInt value to set. - * @return the SpreadWithMultipleParametersRequest object itself. - */ - @Generated - public SpreadWithMultipleParametersRequest setOptionalInt(Integer optionalInt) { - this.optionalInt = optionalInt; - return this; - } - - /** - * Get the requiredIntList property: required int. - * - * @return the requiredIntList value. - */ - @Generated - public List getRequiredIntList() { - return this.requiredIntList; - } - - /** - * Get the optionalStringList property: optional string. - * - * @return the optionalStringList value. - */ - @Generated - public List getOptionalStringList() { - return this.optionalStringList; - } - - /** - * Set the optionalStringList property: optional string. - * - * @param optionalStringList the optionalStringList value to set. - * @return the SpreadWithMultipleParametersRequest object itself. - */ - @Generated - public SpreadWithMultipleParametersRequest setOptionalStringList(List optionalStringList) { - this.optionalStringList = optionalStringList; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("requiredString", this.requiredString); - jsonWriter.writeArrayField("requiredIntList", this.requiredIntList, - (writer, element) -> writer.writeInt(element)); - jsonWriter.writeNumberField("optionalInt", this.optionalInt); - jsonWriter.writeArrayField("optionalStringList", this.optionalStringList, - (writer, element) -> writer.writeString(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadWithMultipleParametersRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadWithMultipleParametersRequest if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadWithMultipleParametersRequest. - */ - @Generated - public static SpreadWithMultipleParametersRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String requiredString = null; - List requiredIntList = null; - Integer optionalInt = null; - List optionalStringList = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("requiredString".equals(fieldName)) { - requiredString = reader.getString(); - } else if ("requiredIntList".equals(fieldName)) { - requiredIntList = reader.readArray(reader1 -> reader1.getInt()); - } else if ("optionalInt".equals(fieldName)) { - optionalInt = reader.getNullable(JsonReader::getInt); - } else if ("optionalStringList".equals(fieldName)) { - optionalStringList = reader.readArray(reader1 -> reader1.getString()); - } else { - reader.skipChildren(); - } - } - SpreadWithMultipleParametersRequest deserializedSpreadWithMultipleParametersRequest - = new SpreadWithMultipleParametersRequest(requiredString, requiredIntList); - deserializedSpreadWithMultipleParametersRequest.optionalInt = optionalInt; - deserializedSpreadWithMultipleParametersRequest.optionalStringList = optionalStringList; - - return deserializedSpreadWithMultipleParametersRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/package-info.java deleted file mode 100644 index 8a6836639f7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Spread. - * Test for the spread operator. - * - */ -package parameters.spread.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/package-info.java deleted file mode 100644 index 8806ae9835e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Spread. - * Test for the spread operator. - * - */ -package parameters.spread.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/BodyParameter.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/BodyParameter.java deleted file mode 100644 index fc712390229..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/BodyParameter.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * This is a simple model. - */ -@Immutable -public final class BodyParameter implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of BodyParameter class. - * - * @param name the name value to set. - */ - @Generated - public BodyParameter(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BodyParameter from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BodyParameter if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BodyParameter. - */ - @Generated - public static BodyParameter fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new BodyParameter(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/package-info.java deleted file mode 100644 index 9abd14e2243..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Spread. - * Test for the spread operator. - * - */ -package parameters.spread.model.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/package-info.java deleted file mode 100644 index 929f47272f2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Spread. - * Test for the spread operator. - * - */ -package parameters.spread; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/ContentNegotiationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/ContentNegotiationClientBuilder.java deleted file mode 100644 index aa4b8e9ed47..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/ContentNegotiationClientBuilder.java +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.contentnegotiation; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import payload.contentnegotiation.implementation.ContentNegotiationClientImpl; - -/** - * A builder for creating a new instance of the ContentNegotiationClient type. - */ -@ServiceClientBuilder( - serviceClients = { - SameBodyClient.class, - DifferentBodyClient.class, - SameBodyAsyncClient.class, - DifferentBodyAsyncClient.class }) -public final class ContentNegotiationClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("payload-contentnegotiation.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ContentNegotiationClientBuilder. - */ - @Generated - public ContentNegotiationClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ContentNegotiationClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ContentNegotiationClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ContentNegotiationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ContentNegotiationClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ContentNegotiationClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ContentNegotiationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ContentNegotiationClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ContentNegotiationClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ContentNegotiationClientBuilder. - */ - @Generated - public ContentNegotiationClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ContentNegotiationClientImpl with the provided parameters. - * - * @return an instance of ContentNegotiationClientImpl. - */ - @Generated - private ContentNegotiationClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ContentNegotiationClientImpl client = new ContentNegotiationClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of SameBodyAsyncClient class. - * - * @return an instance of SameBodyAsyncClient. - */ - @Generated - public SameBodyAsyncClient buildSameBodyAsyncClient() { - return new SameBodyAsyncClient(buildInnerClient().getSameBodies()); - } - - /** - * Builds an instance of DifferentBodyAsyncClient class. - * - * @return an instance of DifferentBodyAsyncClient. - */ - @Generated - public DifferentBodyAsyncClient buildDifferentBodyAsyncClient() { - return new DifferentBodyAsyncClient(buildInnerClient().getDifferentBodies()); - } - - /** - * Builds an instance of SameBodyClient class. - * - * @return an instance of SameBodyClient. - */ - @Generated - public SameBodyClient buildSameBodyClient() { - return new SameBodyClient(buildInnerClient().getSameBodies()); - } - - /** - * Builds an instance of DifferentBodyClient class. - * - * @return an instance of DifferentBodyClient. - */ - @Generated - public DifferentBodyClient buildDifferentBodyClient() { - return new DifferentBodyClient(buildInnerClient().getDifferentBodies()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ContentNegotiationClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyAsyncClient.java deleted file mode 100644 index 8353e6ec89e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyAsyncClient.java +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.contentnegotiation; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import payload.contentnegotiation.differentbody.models.PngImageAsJson; -import payload.contentnegotiation.implementation.DifferentBodiesImpl; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ContentNegotiationClient type. - */ -@ServiceClient(builder = ContentNegotiationClientBuilder.class, isAsync = true) -public final class DifferentBodyAsyncClient { - @Generated - private final DifferentBodiesImpl serviceClient; - - /** - * Initializes an instance of DifferentBodyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DifferentBodyAsyncClient(DifferentBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getAvatarAsPng operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAvatarAsPngWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAvatarAsPngWithResponseAsync(requestOptions); - } - - /** - * The getAvatarAsJson operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     content: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAvatarAsJsonWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAvatarAsJsonWithResponseAsync(requestOptions); - } - - /** - * The getAvatarAsPng operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAvatarAsPng() { - // Generated convenience method for getAvatarAsPngWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAvatarAsPngWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getAvatarAsJson operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAvatarAsJson() { - // Generated convenience method for getAvatarAsJsonWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAvatarAsJsonWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(PngImageAsJson.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyClient.java deleted file mode 100644 index 4e72b809bfb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyClient.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.contentnegotiation; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import payload.contentnegotiation.differentbody.models.PngImageAsJson; -import payload.contentnegotiation.implementation.DifferentBodiesImpl; - -/** - * Initializes a new instance of the synchronous ContentNegotiationClient type. - */ -@ServiceClient(builder = ContentNegotiationClientBuilder.class) -public final class DifferentBodyClient { - @Generated - private final DifferentBodiesImpl serviceClient; - - /** - * Initializes an instance of DifferentBodyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DifferentBodyClient(DifferentBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getAvatarAsPng operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAvatarAsPngWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAvatarAsPngWithResponse(requestOptions); - } - - /** - * The getAvatarAsJson operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     content: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAvatarAsJsonWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAvatarAsJsonWithResponse(requestOptions); - } - - /** - * The getAvatarAsPng operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData getAvatarAsPng() { - // Generated convenience method for getAvatarAsPngWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAvatarAsPngWithResponse(requestOptions).getValue(); - } - - /** - * The getAvatarAsJson operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public PngImageAsJson getAvatarAsJson() { - // Generated convenience method for getAvatarAsJsonWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAvatarAsJsonWithResponse(requestOptions).getValue().toObject(PngImageAsJson.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyAsyncClient.java deleted file mode 100644 index 5bea329b843..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyAsyncClient.java +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.contentnegotiation; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import payload.contentnegotiation.implementation.SameBodiesImpl; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous ContentNegotiationClient type. - */ -@ServiceClient(builder = ContentNegotiationClientBuilder.class, isAsync = true) -public final class SameBodyAsyncClient { - @Generated - private final SameBodiesImpl serviceClient; - - /** - * Initializes an instance of SameBodyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SameBodyAsyncClient(SameBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getAvatarAsPng operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAvatarAsPngWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAvatarAsPngWithResponseAsync(requestOptions); - } - - /** - * The getAvatarAsJpeg operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAvatarAsJpegWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAvatarAsJpegWithResponseAsync(requestOptions); - } - - /** - * The getAvatarAsPng operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAvatarAsPng() { - // Generated convenience method for getAvatarAsPngWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAvatarAsPngWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getAvatarAsJpeg operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAvatarAsJpeg() { - // Generated convenience method for getAvatarAsJpegWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAvatarAsJpegWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyClient.java deleted file mode 100644 index bbb4817ab0d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyClient.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.contentnegotiation; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import payload.contentnegotiation.implementation.SameBodiesImpl; - -/** - * Initializes a new instance of the synchronous ContentNegotiationClient type. - */ -@ServiceClient(builder = ContentNegotiationClientBuilder.class) -public final class SameBodyClient { - @Generated - private final SameBodiesImpl serviceClient; - - /** - * Initializes an instance of SameBodyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SameBodyClient(SameBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getAvatarAsPng operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAvatarAsPngWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAvatarAsPngWithResponse(requestOptions); - } - - /** - * The getAvatarAsJpeg operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAvatarAsJpegWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAvatarAsJpegWithResponse(requestOptions); - } - - /** - * The getAvatarAsPng operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData getAvatarAsPng() { - // Generated convenience method for getAvatarAsPngWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAvatarAsPngWithResponse(requestOptions).getValue(); - } - - /** - * The getAvatarAsJpeg operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData getAvatarAsJpeg() { - // Generated convenience method for getAvatarAsJpegWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAvatarAsJpegWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/PngImageAsJson.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/PngImageAsJson.java deleted file mode 100644 index f1bad165634..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/PngImageAsJson.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.contentnegotiation.differentbody.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The PngImageAsJson model. - */ -@Immutable -public final class PngImageAsJson implements JsonSerializable { - /* - * The content property. - */ - @Generated - private final byte[] content; - - /** - * Creates an instance of PngImageAsJson class. - * - * @param content the content value to set. - */ - @Generated - private PngImageAsJson(byte[] content) { - this.content = content; - } - - /** - * Get the content property: The content property. - * - * @return the content value. - */ - @Generated - public byte[] getContent() { - return CoreUtils.clone(this.content); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBinaryField("content", this.content); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PngImageAsJson from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PngImageAsJson if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the PngImageAsJson. - */ - @Generated - public static PngImageAsJson fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - byte[] content = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("content".equals(fieldName)) { - content = reader.getBinary(); - } else { - reader.skipChildren(); - } - } - return new PngImageAsJson(content); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/package-info.java deleted file mode 100644 index a571412c8f4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for ContentNegotiation. - * Test describing optionality of the request body. - * - */ -package payload.contentnegotiation.differentbody.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java deleted file mode 100644 index 71f59aaaa4a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.contentnegotiation.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 ContentNegotiationClient type. - */ -public final class ContentNegotiationClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 SameBodiesImpl object to access its operations. - */ - private final SameBodiesImpl sameBodies; - - /** - * Gets the SameBodiesImpl object to access its operations. - * - * @return the SameBodiesImpl object. - */ - public SameBodiesImpl getSameBodies() { - return this.sameBodies; - } - - /** - * The DifferentBodiesImpl object to access its operations. - */ - private final DifferentBodiesImpl differentBodies; - - /** - * Gets the DifferentBodiesImpl object to access its operations. - * - * @return the DifferentBodiesImpl object. - */ - public DifferentBodiesImpl getDifferentBodies() { - return this.differentBodies; - } - - /** - * Initializes an instance of ContentNegotiationClient client. - * - * @param endpoint Service host. - */ - public ContentNegotiationClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ContentNegotiationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ContentNegotiationClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ContentNegotiationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ContentNegotiationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.sameBodies = new SameBodiesImpl(this); - this.differentBodies = new DifferentBodiesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/DifferentBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/DifferentBodiesImpl.java deleted file mode 100644 index 4928bf2b6d8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/DifferentBodiesImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.contentnegotiation.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DifferentBodies. - */ -public final class DifferentBodiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DifferentBodiesService service; - - /** - * The service client containing this operation class. - */ - private final ContentNegotiationClientImpl client; - - /** - * Initializes an instance of DifferentBodiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DifferentBodiesImpl(ContentNegotiationClientImpl client) { - this.service - = RestProxy.create(DifferentBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ContentNegotiationClientDifferentBodies to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ContentNegotiationClientDifferentBodies") - public interface DifferentBodiesService { - @Get("/content-negotiation/different-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAvatarAsPng(@HostParam("endpoint") String endpoint, - @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/content-negotiation/different-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAvatarAsPngSync(@HostParam("endpoint") String endpoint, - @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/content-negotiation/different-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAvatarAsJson(@HostParam("endpoint") String endpoint, - @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/content-negotiation/different-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAvatarAsJsonSync(@HostParam("endpoint") String endpoint, - @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * The getAvatarAsPng operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAvatarAsPngWithResponseAsync(RequestOptions requestOptions) { - final String accept = "image/png"; - return FluxUtil - .withContext(context -> service.getAvatarAsPng(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getAvatarAsPng operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAvatarAsPngWithResponse(RequestOptions requestOptions) { - final String accept = "image/png"; - return service.getAvatarAsPngSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getAvatarAsJson operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     content: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAvatarAsJsonWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getAvatarAsJson(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getAvatarAsJson operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     content: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAvatarAsJsonWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAvatarAsJsonSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/SameBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/SameBodiesImpl.java deleted file mode 100644 index 44bdf30e76c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/SameBodiesImpl.java +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.contentnegotiation.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SameBodies. - */ -public final class SameBodiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SameBodiesService service; - - /** - * The service client containing this operation class. - */ - private final ContentNegotiationClientImpl client; - - /** - * Initializes an instance of SameBodiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SameBodiesImpl(ContentNegotiationClientImpl client) { - this.service - = RestProxy.create(SameBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ContentNegotiationClientSameBodies to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ContentNegotiationClientSameBodies") - public interface SameBodiesService { - @Get("/content-negotiation/same-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAvatarAsPng(@HostParam("endpoint") String endpoint, - @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/content-negotiation/same-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAvatarAsPngSync(@HostParam("endpoint") String endpoint, - @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/content-negotiation/same-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAvatarAsJpeg(@HostParam("endpoint") String endpoint, - @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/content-negotiation/same-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAvatarAsJpegSync(@HostParam("endpoint") String endpoint, - @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * The getAvatarAsPng operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAvatarAsPngWithResponseAsync(RequestOptions requestOptions) { - final String accept = "image/png"; - return FluxUtil - .withContext(context -> service.getAvatarAsPng(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getAvatarAsPng operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAvatarAsPngWithResponse(RequestOptions requestOptions) { - final String accept = "image/png"; - return service.getAvatarAsPngSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getAvatarAsJpeg operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAvatarAsJpegWithResponseAsync(RequestOptions requestOptions) { - final String accept = "image/jpeg"; - return FluxUtil.withContext( - context -> service.getAvatarAsJpeg(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getAvatarAsJpeg operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAvatarAsJpegWithResponse(RequestOptions requestOptions) { - final String accept = "image/jpeg"; - return service.getAvatarAsJpegSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/package-info.java deleted file mode 100644 index ce96af483de..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ContentNegotiation. - * Test describing optionality of the request body. - * - */ -package payload.contentnegotiation.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/package-info.java deleted file mode 100644 index 363404f10e2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ContentNegotiation. - * Test describing optionality of the request body. - * - */ -package payload.contentnegotiation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchAsyncClient.java deleted file mode 100644 index d7542a08fb8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchAsyncClient.java +++ /dev/null @@ -1,346 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.jsonmergepatch; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import payload.jsonmergepatch.implementation.JsonMergePatchClientImpl; -import payload.jsonmergepatch.implementation.JsonMergePatchHelper; -import payload.jsonmergepatch.models.Resource; -import payload.jsonmergepatch.models.ResourcePatch; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous JsonMergePatchClient type. - */ -@ServiceClient(builder = JsonMergePatchClientBuilder.class, isAsync = true) -public final class JsonMergePatchAsyncClient { - @Generated - private final JsonMergePatchClientImpl serviceClient; - - /** - * Initializes an instance of JsonMergePatchAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - JsonMergePatchAsyncClient(JsonMergePatchClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test content-type: application/merge-patch+json with required body. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a resource along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createResourceWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.createResourceWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: application/merge-patch+json with required body. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a resource along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateResourceWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.updateResourceWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: application/merge-patch+json with optional body. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/merge-patch+json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a resource along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateOptionalResourceWithResponse(RequestOptions requestOptions) { - return this.serviceClient.updateOptionalResourceWithResponseAsync(requestOptions); - } - - /** - * Test content-type: application/merge-patch+json with required body. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a resource on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createResource(Resource body) { - // Generated convenience method for createResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createResourceWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * Test content-type: application/merge-patch+json with required body. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a resource on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateResource(ResourcePatch body) { - // Generated convenience method for updateResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, false); - return updateResourceWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * Test content-type: application/merge-patch+json with optional body. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a resource on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateOptionalResource(ResourcePatch body) { - // Generated convenience method for updateOptionalResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (body != null) { - JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, false); - requestOptions.setBody(bodyInBinaryData); - } - return updateOptionalResourceWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * Test content-type: application/merge-patch+json with optional body. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a resource on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateOptionalResource() { - // Generated convenience method for updateOptionalResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return updateOptionalResourceWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClient.java deleted file mode 100644 index 7db0b977781..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClient.java +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.jsonmergepatch; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import payload.jsonmergepatch.implementation.JsonMergePatchClientImpl; -import payload.jsonmergepatch.implementation.JsonMergePatchHelper; -import payload.jsonmergepatch.models.Resource; -import payload.jsonmergepatch.models.ResourcePatch; - -/** - * Initializes a new instance of the synchronous JsonMergePatchClient type. - */ -@ServiceClient(builder = JsonMergePatchClientBuilder.class) -public final class JsonMergePatchClient { - @Generated - private final JsonMergePatchClientImpl serviceClient; - - /** - * Initializes an instance of JsonMergePatchClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - JsonMergePatchClient(JsonMergePatchClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test content-type: application/merge-patch+json with required body. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a resource along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createResourceWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.createResourceWithResponse(body, requestOptions); - } - - /** - * Test content-type: application/merge-patch+json with required body. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a resource along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateResourceWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.updateResourceWithResponse(body, requestOptions); - } - - /** - * Test content-type: application/merge-patch+json with optional body. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/merge-patch+json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a resource along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateOptionalResourceWithResponse(RequestOptions requestOptions) { - return this.serviceClient.updateOptionalResourceWithResponse(requestOptions); - } - - /** - * Test content-type: application/merge-patch+json with required body. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a resource. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource createResource(Resource body) { - // Generated convenience method for createResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createResourceWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Resource.class); - } - - /** - * Test content-type: application/merge-patch+json with required body. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a resource. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource updateResource(ResourcePatch body) { - // Generated convenience method for updateResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, false); - return updateResourceWithResponse(bodyInBinaryData, requestOptions).getValue().toObject(Resource.class); - } - - /** - * Test content-type: application/merge-patch+json with optional body. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a resource. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource updateOptionalResource(ResourcePatch body) { - // Generated convenience method for updateOptionalResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (body != null) { - JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, false); - requestOptions.setBody(bodyInBinaryData); - } - return updateOptionalResourceWithResponse(requestOptions).getValue().toObject(Resource.class); - } - - /** - * Test content-type: application/merge-patch+json with optional body. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return details about a resource. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource updateOptionalResource() { - // Generated convenience method for updateOptionalResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return updateOptionalResourceWithResponse(requestOptions).getValue().toObject(Resource.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClientBuilder.java deleted file mode 100644 index 149bcac626e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.jsonmergepatch; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import payload.jsonmergepatch.implementation.JsonMergePatchClientImpl; - -/** - * A builder for creating a new instance of the JsonMergePatchClient type. - */ -@ServiceClientBuilder(serviceClients = { JsonMergePatchClient.class, JsonMergePatchAsyncClient.class }) -public final class JsonMergePatchClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("payload-jsonmergepatch.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the JsonMergePatchClientBuilder. - */ - @Generated - public JsonMergePatchClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonMergePatchClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonMergePatchClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonMergePatchClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonMergePatchClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonMergePatchClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonMergePatchClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonMergePatchClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonMergePatchClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the JsonMergePatchClientBuilder. - */ - @Generated - public JsonMergePatchClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of JsonMergePatchClientImpl with the provided parameters. - * - * @return an instance of JsonMergePatchClientImpl. - */ - @Generated - private JsonMergePatchClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - JsonMergePatchClientImpl client = new JsonMergePatchClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of JsonMergePatchAsyncClient class. - * - * @return an instance of JsonMergePatchAsyncClient. - */ - @Generated - public JsonMergePatchAsyncClient buildAsyncClient() { - return new JsonMergePatchAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of JsonMergePatchClient class. - * - * @return an instance of JsonMergePatchClient. - */ - @Generated - public JsonMergePatchClient buildClient() { - return new JsonMergePatchClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(JsonMergePatchClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java deleted file mode 100644 index 78afebd7113..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java +++ /dev/null @@ -1,625 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.jsonmergepatch.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the JsonMergePatchClient type. - */ -public final class JsonMergePatchClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final JsonMergePatchClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of JsonMergePatchClient client. - * - * @param endpoint Service host. - */ - public JsonMergePatchClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of JsonMergePatchClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public JsonMergePatchClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of JsonMergePatchClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public JsonMergePatchClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(JsonMergePatchClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for JsonMergePatchClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "JsonMergePatchClient") - public interface JsonMergePatchClientService { - @Put("/json-merge-patch/create/resource") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createResource(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/json-merge-patch/create/resource") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createResourceSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Patch("/json-merge-patch/update/resource") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> updateResource(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); - - @Patch("/json-merge-patch/update/resource") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response updateResourceSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); - - @Patch("/json-merge-patch/update/resource/optional") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> updateOptionalResource(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Patch("/json-merge-patch/update/resource/optional") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response updateOptionalResourceSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * Test content-type: application/merge-patch+json with required body. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a resource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createResourceWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.createResource(this.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * Test content-type: application/merge-patch+json with required body. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createResourceWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createResourceSync(this.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } - - /** - * Test content-type: application/merge-patch+json with required body. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a resource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateResourceWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.updateResource(this.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * Test content-type: application/merge-patch+json with required body. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateResourceWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return service.updateResourceSync(this.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } - - /** - * Test content-type: application/merge-patch+json with optional body. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/merge-patch+json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a resource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateOptionalResourceWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/merge-patch+json"); - } - }); - return FluxUtil.withContext( - context -> service.updateOptionalResource(this.getEndpoint(), accept, requestOptionsLocal, context)); - } - - /** - * Test content-type: application/merge-patch+json with optional body. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/merge-patch+json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional): {
-     *         String (Required): {
-     *             name: String (Optional)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     intValue: Integer (Optional)
-     *     floatValue: Double (Optional)
-     *     innerModel (Optional): (recursive schema, see innerModel above)
-     *     intArray (Optional): [
-     *         int (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return details about a resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateOptionalResourceWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/merge-patch+json"); - } - }); - return service.updateOptionalResourceSync(this.getEndpoint(), accept, requestOptionsLocal, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchHelper.java deleted file mode 100644 index e9ca845bf98..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchHelper.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.jsonmergepatch.implementation; - -import payload.jsonmergepatch.models.InnerModel; -import payload.jsonmergepatch.models.ResourcePatch; - -/** - * This is the Helper class to enable json merge patch serialization for a model. - */ -public class JsonMergePatchHelper { - private static InnerModelAccessor innerModelAccessor; - - public interface InnerModelAccessor { - InnerModel prepareModelForJsonMergePatch(InnerModel innerModel, boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(InnerModel innerModel); - } - - public static void setInnerModelAccessor(InnerModelAccessor accessor) { - innerModelAccessor = accessor; - } - - public static InnerModelAccessor getInnerModelAccessor() { - return innerModelAccessor; - } - - private static ResourcePatchAccessor resourcePatchAccessor; - - public interface ResourcePatchAccessor { - ResourcePatch prepareModelForJsonMergePatch(ResourcePatch resourcePatch, boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(ResourcePatch resourcePatch); - } - - public static void setResourcePatchAccessor(ResourcePatchAccessor accessor) { - resourcePatchAccessor = accessor; - } - - public static ResourcePatchAccessor getResourcePatchAccessor() { - return resourcePatchAccessor; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/package-info.java deleted file mode 100644 index 1e763224f5d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for JsonMergePatch. - * Test for merge-patch+json content-type. - * - */ -package payload.jsonmergepatch.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/InnerModel.java deleted file mode 100644 index b09eee2b354..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/InnerModel.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.jsonmergepatch.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import payload.jsonmergepatch.implementation.JsonMergePatchHelper; - -/** - * It is the model used by Resource model. - */ -@Fluent -public final class InnerModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private String name; - - /* - * The description property. - */ - @Generated - private String description; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setInnerModelAccessor(new JsonMergePatchHelper.InnerModelAccessor() { - @Override - public InnerModel prepareModelForJsonMergePatch(InnerModel model, boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(InnerModel model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of InnerModel class. - */ - @Generated - public InnerModel() { - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Set the name property: The name property. - * - * @param name the name value to set. - * @return the InnerModel object itself. - */ - @Generated - public InnerModel setName(String name) { - this.name = name; - this.updatedProperties.add("name"); - return this; - } - - /** - * Get the description property: The description property. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * Set the description property: The description property. - * - * @param description the description value to set. - * @return the InnerModel object itself. - */ - @Generated - public InnerModel setDescription(String description) { - this.description = description; - this.updatedProperties.add("description"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("name")) { - if (this.name == null) { - jsonWriter.writeNullField("name"); - } else { - jsonWriter.writeStringField("name", this.name); - } - } - if (updatedProperties.contains("description")) { - if (this.description == null) { - jsonWriter.writeNullField("description"); - } else { - jsonWriter.writeStringField("description", this.description); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InnerModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IOException If an error occurs while reading the InnerModel. - */ - @Generated - public static InnerModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - InnerModel deserializedInnerModel = new InnerModel(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedInnerModel.name = reader.getString(); - } else if ("description".equals(fieldName)) { - deserializedInnerModel.description = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedInnerModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/Resource.java deleted file mode 100644 index 1f7f1b7c967..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/Resource.java +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.jsonmergepatch.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * Details about a resource. - */ -@Fluent -public final class Resource implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The description property. - */ - @Generated - private String description; - - /* - * The map property. - */ - @Generated - private Map map; - - /* - * The array property. - */ - @Generated - private List array; - - /* - * The intValue property. - */ - @Generated - private Integer intValue; - - /* - * The floatValue property. - */ - @Generated - private Double floatValue; - - /* - * The innerModel property. - */ - @Generated - private InnerModel innerModel; - - /* - * The intArray property. - */ - @Generated - private List intArray; - - /** - * Creates an instance of Resource class. - * - * @param name the name value to set. - */ - @Generated - public Resource(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the description property: The description property. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * Set the description property: The description property. - * - * @param description the description value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setDescription(String description) { - this.description = description; - return this; - } - - /** - * Get the map property: The map property. - * - * @return the map value. - */ - @Generated - public Map getMap() { - return this.map; - } - - /** - * Set the map property: The map property. - * - * @param map the map value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setMap(Map map) { - this.map = map; - return this; - } - - /** - * Get the array property: The array property. - * - * @return the array value. - */ - @Generated - public List getArray() { - return this.array; - } - - /** - * Set the array property: The array property. - * - * @param array the array value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setArray(List array) { - this.array = array; - return this; - } - - /** - * Get the intValue property: The intValue property. - * - * @return the intValue value. - */ - @Generated - public Integer getIntValue() { - return this.intValue; - } - - /** - * Set the intValue property: The intValue property. - * - * @param intValue the intValue value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setIntValue(Integer intValue) { - this.intValue = intValue; - return this; - } - - /** - * Get the floatValue property: The floatValue property. - * - * @return the floatValue value. - */ - @Generated - public Double getFloatValue() { - return this.floatValue; - } - - /** - * Set the floatValue property: The floatValue property. - * - * @param floatValue the floatValue value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setFloatValue(Double floatValue) { - this.floatValue = floatValue; - return this; - } - - /** - * Get the innerModel property: The innerModel property. - * - * @return the innerModel value. - */ - @Generated - public InnerModel getInnerModel() { - return this.innerModel; - } - - /** - * Set the innerModel property: The innerModel property. - * - * @param innerModel the innerModel value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setInnerModel(InnerModel innerModel) { - this.innerModel = innerModel; - return this; - } - - /** - * Get the intArray property: The intArray property. - * - * @return the intArray value. - */ - @Generated - public List getIntArray() { - return this.intArray; - } - - /** - * Set the intArray property: The intArray property. - * - * @param intArray the intArray value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setIntArray(List intArray) { - this.intArray = intArray; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("description", this.description); - jsonWriter.writeMapField("map", this.map, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeNumberField("intValue", this.intValue); - jsonWriter.writeNumberField("floatValue", this.floatValue); - jsonWriter.writeJsonField("innerModel", this.innerModel); - jsonWriter.writeArrayField("intArray", this.intArray, (writer, element) -> writer.writeInt(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Resource from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Resource. - */ - @Generated - public static Resource fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - String description = null; - Map map = null; - List array = null; - Integer intValue = null; - Double floatValue = null; - InnerModel innerModel = null; - List intArray = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("description".equals(fieldName)) { - description = reader.getString(); - } else if ("map".equals(fieldName)) { - map = reader.readMap(reader1 -> InnerModel.fromJson(reader1)); - } else if ("array".equals(fieldName)) { - array = reader.readArray(reader1 -> InnerModel.fromJson(reader1)); - } else if ("intValue".equals(fieldName)) { - intValue = reader.getNullable(JsonReader::getInt); - } else if ("floatValue".equals(fieldName)) { - floatValue = reader.getNullable(JsonReader::getDouble); - } else if ("innerModel".equals(fieldName)) { - innerModel = InnerModel.fromJson(reader); - } else if ("intArray".equals(fieldName)) { - intArray = reader.readArray(reader1 -> reader1.getInt()); - } else { - reader.skipChildren(); - } - } - Resource deserializedResource = new Resource(name); - deserializedResource.description = description; - deserializedResource.map = map; - deserializedResource.array = array; - deserializedResource.intValue = intValue; - deserializedResource.floatValue = floatValue; - deserializedResource.innerModel = innerModel; - deserializedResource.intArray = intArray; - - return deserializedResource; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/ResourcePatch.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/ResourcePatch.java deleted file mode 100644 index 6a39adbcb9b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/ResourcePatch.java +++ /dev/null @@ -1,391 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.jsonmergepatch.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import payload.jsonmergepatch.implementation.JsonMergePatchHelper; - -/** - * Details about a resource for patch operation. - */ -@Fluent -public final class ResourcePatch implements JsonSerializable { - /* - * The description property. - */ - @Generated - private String description; - - /* - * The map property. - */ - @Generated - private Map map; - - /* - * The array property. - */ - @Generated - private List array; - - /* - * The intValue property. - */ - @Generated - private Integer intValue; - - /* - * The floatValue property. - */ - @Generated - private Double floatValue; - - /* - * The innerModel property. - */ - @Generated - private InnerModel innerModel; - - /* - * The intArray property. - */ - @Generated - private List intArray; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setResourcePatchAccessor(new JsonMergePatchHelper.ResourcePatchAccessor() { - @Override - public ResourcePatch prepareModelForJsonMergePatch(ResourcePatch model, boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(ResourcePatch model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of ResourcePatch class. - */ - @Generated - public ResourcePatch() { - } - - /** - * Get the description property: The description property. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * Set the description property: The description property. - * - * @param description the description value to set. - * @return the ResourcePatch object itself. - */ - @Generated - public ResourcePatch setDescription(String description) { - this.description = description; - this.updatedProperties.add("description"); - return this; - } - - /** - * Get the map property: The map property. - * - * @return the map value. - */ - @Generated - public Map getMap() { - return this.map; - } - - /** - * Set the map property: The map property. - * - * @param map the map value to set. - * @return the ResourcePatch object itself. - */ - @Generated - public ResourcePatch setMap(Map map) { - this.map = map; - this.updatedProperties.add("map"); - return this; - } - - /** - * Get the array property: The array property. - * - * @return the array value. - */ - @Generated - public List getArray() { - return this.array; - } - - /** - * Set the array property: The array property. - * - * @param array the array value to set. - * @return the ResourcePatch object itself. - */ - @Generated - public ResourcePatch setArray(List array) { - this.array = array; - this.updatedProperties.add("array"); - return this; - } - - /** - * Get the intValue property: The intValue property. - * - * @return the intValue value. - */ - @Generated - public Integer getIntValue() { - return this.intValue; - } - - /** - * Set the intValue property: The intValue property. - * - * @param intValue the intValue value to set. - * @return the ResourcePatch object itself. - */ - @Generated - public ResourcePatch setIntValue(Integer intValue) { - this.intValue = intValue; - this.updatedProperties.add("intValue"); - return this; - } - - /** - * Get the floatValue property: The floatValue property. - * - * @return the floatValue value. - */ - @Generated - public Double getFloatValue() { - return this.floatValue; - } - - /** - * Set the floatValue property: The floatValue property. - * - * @param floatValue the floatValue value to set. - * @return the ResourcePatch object itself. - */ - @Generated - public ResourcePatch setFloatValue(Double floatValue) { - this.floatValue = floatValue; - this.updatedProperties.add("floatValue"); - return this; - } - - /** - * Get the innerModel property: The innerModel property. - * - * @return the innerModel value. - */ - @Generated - public InnerModel getInnerModel() { - return this.innerModel; - } - - /** - * Set the innerModel property: The innerModel property. - * - * @param innerModel the innerModel value to set. - * @return the ResourcePatch object itself. - */ - @Generated - public ResourcePatch setInnerModel(InnerModel innerModel) { - this.innerModel = innerModel; - this.updatedProperties.add("innerModel"); - return this; - } - - /** - * Get the intArray property: The intArray property. - * - * @return the intArray value. - */ - @Generated - public List getIntArray() { - return this.intArray; - } - - /** - * Set the intArray property: The intArray property. - * - * @param intArray the intArray value to set. - * @return the ResourcePatch object itself. - */ - @Generated - public ResourcePatch setIntArray(List intArray) { - this.intArray = intArray; - this.updatedProperties.add("intArray"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("description", this.description); - jsonWriter.writeMapField("map", this.map, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeNumberField("intValue", this.intValue); - jsonWriter.writeNumberField("floatValue", this.floatValue); - jsonWriter.writeJsonField("innerModel", this.innerModel); - jsonWriter.writeArrayField("intArray", this.intArray, (writer, element) -> writer.writeInt(element)); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("description")) { - if (this.description == null) { - jsonWriter.writeNullField("description"); - } else { - jsonWriter.writeStringField("description", this.description); - } - } - if (updatedProperties.contains("map")) { - if (this.map == null) { - jsonWriter.writeNullField("map"); - } else { - jsonWriter.writeMapField("map", this.map, (writer, element) -> { - if (element != null) { - JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(element, true); - writer.writeJson(element); - JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(element, false); - } else { - writer.writeNull(); - } - }); - } - } - if (updatedProperties.contains("array")) { - if (this.array == null) { - jsonWriter.writeNullField("array"); - } else { - jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element)); - } - } - if (updatedProperties.contains("intValue")) { - if (this.intValue == null) { - jsonWriter.writeNullField("intValue"); - } else { - jsonWriter.writeNumberField("intValue", this.intValue); - } - } - if (updatedProperties.contains("floatValue")) { - if (this.floatValue == null) { - jsonWriter.writeNullField("floatValue"); - } else { - jsonWriter.writeNumberField("floatValue", this.floatValue); - } - } - if (updatedProperties.contains("innerModel")) { - if (this.innerModel == null) { - jsonWriter.writeNullField("innerModel"); - } else { - JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(this.innerModel, true); - jsonWriter.writeJsonField("innerModel", this.innerModel); - JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(this.innerModel, false); - } - } - if (updatedProperties.contains("intArray")) { - if (this.intArray == null) { - jsonWriter.writeNullField("intArray"); - } else { - jsonWriter.writeArrayField("intArray", this.intArray, (writer, element) -> writer.writeInt(element)); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourcePatch from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourcePatch if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the ResourcePatch. - */ - @Generated - public static ResourcePatch fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ResourcePatch deserializedResourcePatch = new ResourcePatch(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("description".equals(fieldName)) { - deserializedResourcePatch.description = reader.getString(); - } else if ("map".equals(fieldName)) { - Map map = reader.readMap(reader1 -> InnerModel.fromJson(reader1)); - deserializedResourcePatch.map = map; - } else if ("array".equals(fieldName)) { - List array = reader.readArray(reader1 -> InnerModel.fromJson(reader1)); - deserializedResourcePatch.array = array; - } else if ("intValue".equals(fieldName)) { - deserializedResourcePatch.intValue = reader.getNullable(JsonReader::getInt); - } else if ("floatValue".equals(fieldName)) { - deserializedResourcePatch.floatValue = reader.getNullable(JsonReader::getDouble); - } else if ("innerModel".equals(fieldName)) { - deserializedResourcePatch.innerModel = InnerModel.fromJson(reader); - } else if ("intArray".equals(fieldName)) { - List intArray = reader.readArray(reader1 -> reader1.getInt()); - deserializedResourcePatch.intArray = intArray; - } else { - reader.skipChildren(); - } - } - - return deserializedResourcePatch; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/package-info.java deleted file mode 100644 index ca0638171f9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for JsonMergePatch. - * Test for merge-patch+json content-type. - * - */ -package payload.jsonmergepatch.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/package-info.java deleted file mode 100644 index 6e3df942262..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for JsonMergePatch. - * Test for merge-patch+json content-type. - * - */ -package payload.jsonmergepatch; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeAsyncClient.java deleted file mode 100644 index 0f46513bbb1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeAsyncClient.java +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.mediatype; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import payload.mediatype.implementation.StringBodiesImpl; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous MediaTypeClient type. - */ -@ServiceClient(builder = MediaTypeClientBuilder.class, isAsync = true) -public final class MediaTypeAsyncClient { - @Generated - private final StringBodiesImpl serviceClient; - - /** - * Initializes an instance of MediaTypeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MediaTypeAsyncClient(StringBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The sendAsText operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param text The text parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendAsTextWithResponse(BinaryData text, RequestOptions requestOptions) { - return this.serviceClient.sendAsTextWithResponseAsync(text, requestOptions); - } - - /** - * The getAsText operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAsTextWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAsTextWithResponseAsync(requestOptions); - } - - /** - * The sendAsJson operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param text The text parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendAsJsonWithResponse(BinaryData text, RequestOptions requestOptions) { - return this.serviceClient.sendAsJsonWithResponseAsync(text, requestOptions); - } - - /** - * The getAsJson operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAsJsonWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAsJsonWithResponseAsync(requestOptions); - } - - /** - * The sendAsText operation. - * - * @param text The text parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono sendAsText(String text) { - // Generated convenience method for sendAsTextWithResponse - RequestOptions requestOptions = new RequestOptions(); - return sendAsTextWithResponse(BinaryData.fromString(text), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getAsText operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a sequence of textual characters on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAsText() { - // Generated convenience method for getAsTextWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAsTextWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toString()); - } - - /** - * The sendAsJson operation. - * - * @param text The text parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono sendAsJson(String text) { - // Generated convenience method for sendAsJsonWithResponse - RequestOptions requestOptions = new RequestOptions(); - return sendAsJsonWithResponse(BinaryData.fromObject(text), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getAsJson operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a sequence of textual characters on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAsJson() { - // Generated convenience method for getAsJsonWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAsJsonWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(String.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClient.java deleted file mode 100644 index c436537812f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClient.java +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.mediatype; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import payload.mediatype.implementation.StringBodiesImpl; - -/** - * Initializes a new instance of the synchronous MediaTypeClient type. - */ -@ServiceClient(builder = MediaTypeClientBuilder.class) -public final class MediaTypeClient { - @Generated - private final StringBodiesImpl serviceClient; - - /** - * Initializes an instance of MediaTypeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MediaTypeClient(StringBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The sendAsText operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param text The text parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendAsTextWithResponse(BinaryData text, RequestOptions requestOptions) { - return this.serviceClient.sendAsTextWithResponse(text, requestOptions); - } - - /** - * The getAsText operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAsTextWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAsTextWithResponse(requestOptions); - } - - /** - * The sendAsJson operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param text The text parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendAsJsonWithResponse(BinaryData text, RequestOptions requestOptions) { - return this.serviceClient.sendAsJsonWithResponse(text, requestOptions); - } - - /** - * The getAsJson operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAsJsonWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAsJsonWithResponse(requestOptions); - } - - /** - * The sendAsText operation. - * - * @param text The text parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void sendAsText(String text) { - // Generated convenience method for sendAsTextWithResponse - RequestOptions requestOptions = new RequestOptions(); - sendAsTextWithResponse(BinaryData.fromString(text), requestOptions).getValue(); - } - - /** - * The getAsText operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a sequence of textual characters. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public String getAsText() { - // Generated convenience method for getAsTextWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAsTextWithResponse(requestOptions).getValue().toString(); - } - - /** - * The sendAsJson operation. - * - * @param text The text parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void sendAsJson(String text) { - // Generated convenience method for sendAsJsonWithResponse - RequestOptions requestOptions = new RequestOptions(); - sendAsJsonWithResponse(BinaryData.fromObject(text), requestOptions).getValue(); - } - - /** - * The getAsJson operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a sequence of textual characters. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public String getAsJson() { - // Generated convenience method for getAsJsonWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAsJsonWithResponse(requestOptions).getValue().toObject(String.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClientBuilder.java deleted file mode 100644 index 51931beb8c7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.mediatype; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import payload.mediatype.implementation.MediaTypeClientImpl; - -/** - * A builder for creating a new instance of the MediaTypeClient type. - */ -@ServiceClientBuilder(serviceClients = { MediaTypeClient.class, MediaTypeAsyncClient.class }) -public final class MediaTypeClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("payload-mediatype.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the MediaTypeClientBuilder. - */ - @Generated - public MediaTypeClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MediaTypeClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MediaTypeClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MediaTypeClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MediaTypeClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MediaTypeClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MediaTypeClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MediaTypeClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MediaTypeClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the MediaTypeClientBuilder. - */ - @Generated - public MediaTypeClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of MediaTypeClientImpl with the provided parameters. - * - * @return an instance of MediaTypeClientImpl. - */ - @Generated - private MediaTypeClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - MediaTypeClientImpl client - = new MediaTypeClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of MediaTypeAsyncClient class. - * - * @return an instance of MediaTypeAsyncClient. - */ - @Generated - public MediaTypeAsyncClient buildAsyncClient() { - return new MediaTypeAsyncClient(buildInnerClient().getStringBodies()); - } - - /** - * Builds an instance of MediaTypeClient class. - * - * @return an instance of MediaTypeClient. - */ - @Generated - public MediaTypeClient buildClient() { - return new MediaTypeClient(buildInnerClient().getStringBodies()); - } - - private static final ClientLogger LOGGER = new ClientLogger(MediaTypeClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java deleted file mode 100644 index 7747e38a777..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.mediatype.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 MediaTypeClient type. - */ -public final class MediaTypeClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 StringBodiesImpl object to access its operations. - */ - private final StringBodiesImpl stringBodies; - - /** - * Gets the StringBodiesImpl object to access its operations. - * - * @return the StringBodiesImpl object. - */ - public StringBodiesImpl getStringBodies() { - return this.stringBodies; - } - - /** - * Initializes an instance of MediaTypeClient client. - * - * @param endpoint Service host. - */ - public MediaTypeClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of MediaTypeClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public MediaTypeClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of MediaTypeClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public MediaTypeClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.stringBodies = new StringBodiesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/StringBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/StringBodiesImpl.java deleted file mode 100644 index e7a784ff33c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/StringBodiesImpl.java +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.mediatype.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringBodies. - */ -public final class StringBodiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringBodiesService service; - - /** - * The service client containing this operation class. - */ - private final MediaTypeClientImpl client; - - /** - * Initializes an instance of StringBodiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringBodiesImpl(MediaTypeClientImpl client) { - this.service - = RestProxy.create(StringBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for MediaTypeClientStringBodies to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MediaTypeClientStringBodies") - public interface StringBodiesService { - @Post("/payload/media-type/string-body/sendAsText") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> sendAsText(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("text/plain") BinaryData text, - RequestOptions requestOptions, Context context); - - @Post("/payload/media-type/string-body/sendAsText") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendAsTextSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("text/plain") BinaryData text, - RequestOptions requestOptions, Context context); - - @Get("/payload/media-type/string-body/getAsText") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAsText(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/payload/media-type/string-body/getAsText") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAsTextSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/payload/media-type/string-body/sendAsJson") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> sendAsJson(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData text, - RequestOptions requestOptions, Context context); - - @Post("/payload/media-type/string-body/sendAsJson") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendAsJsonSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData text, - RequestOptions requestOptions, Context context); - - @Get("/payload/media-type/string-body/getAsJson") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAsJson(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/payload/media-type/string-body/getAsJson") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAsJsonSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The sendAsText operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param text The text parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendAsTextWithResponseAsync(BinaryData text, RequestOptions requestOptions) { - final String contentType = "text/plain"; - return FluxUtil.withContext( - context -> service.sendAsText(this.client.getEndpoint(), contentType, text, requestOptions, context)); - } - - /** - * The sendAsText operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param text The text parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendAsTextWithResponse(BinaryData text, RequestOptions requestOptions) { - final String contentType = "text/plain"; - return service.sendAsTextSync(this.client.getEndpoint(), contentType, text, requestOptions, Context.NONE); - } - - /** - * The getAsText operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAsTextWithResponseAsync(RequestOptions requestOptions) { - final String accept = "text/plain"; - return FluxUtil - .withContext(context -> service.getAsText(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getAsText operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAsTextWithResponse(RequestOptions requestOptions) { - final String accept = "text/plain"; - return service.getAsTextSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The sendAsJson operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param text The text parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendAsJsonWithResponseAsync(BinaryData text, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.sendAsJson(this.client.getEndpoint(), contentType, text, requestOptions, context)); - } - - /** - * The sendAsJson operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param text The text parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendAsJsonWithResponse(BinaryData text, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendAsJsonSync(this.client.getEndpoint(), contentType, text, requestOptions, Context.NONE); - } - - /** - * The getAsJson operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAsJsonWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAsJson(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getAsJson operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAsJsonWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAsJsonSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/package-info.java deleted file mode 100644 index ad53c1a390c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for MediaType. - * Test the payload with different media types and different types of the payload itself. - * - */ -package payload.mediatype.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/package-info.java deleted file mode 100644 index ffe9542e3d9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for MediaType. - * Test the payload with different media types and different types of the payload itself. - * - */ -package payload.mediatype; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataAsyncClient.java deleted file mode 100644 index 56cbe49d0f5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataAsyncClient.java +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import java.util.stream.Collectors; -import payload.multipart.formdata.models.AnonymousModelRequest; -import payload.multipart.implementation.FormDatasImpl; -import payload.multipart.implementation.MultipartFormDataHelper; -import payload.multipart.models.BinaryArrayPartsRequest; -import payload.multipart.models.ComplexPartsRequest; -import payload.multipart.models.JsonPartRequest; -import payload.multipart.models.MultiBinaryPartsRequest; -import payload.multipart.models.MultiPartRequest; -import payload.multipart.models.PicturesFileDetails; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous MultiPartClient type. - */ -@ServiceClient(builder = MultiPartClientBuilder.class, isAsync = true) -public final class FormDataAsyncClient { - @Generated - private final FormDatasImpl serviceClient; - - /** - * Initializes an instance of FormDataAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FormDataAsyncClient(FormDatasImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> basicWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'basic' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not - // generated. - return this.serviceClient.basicWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for mixed scenarios. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> fileArrayAndBasicWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'fileArrayAndBasic' is of content-type 'multipart/form-data'. Protocol API is not usable and hence - // not generated. - return this.serviceClient.fileArrayAndBasicWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for scenario contains json part and binary part. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> jsonPartWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'jsonPart' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not - // generated. - return this.serviceClient.jsonPartWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for scenario contains multi binary parts. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> binaryArrayPartsWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'binaryArrayParts' is of content-type 'multipart/form-data'. Protocol API is not usable and hence - // not generated. - return this.serviceClient.binaryArrayPartsWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for scenario contains multi binary parts. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> multiBinaryPartsWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'multiBinaryParts' is of content-type 'multipart/form-data'. Protocol API is not usable and hence - // not generated. - return this.serviceClient.multiBinaryPartsWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> checkFileNameAndContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'checkFileNameAndContentType' is of content-type 'multipart/form-data'. Protocol API is not usable - // and hence not generated. - return this.serviceClient.checkFileNameAndContentTypeWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> anonymousModelWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'anonymousModel' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not - // generated. - return this.serviceClient.anonymousModelWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono basic(MultiPartRequest body) { - // Generated convenience method for basicWithResponse - RequestOptions requestOptions = new RequestOptions(); - return basicWithResponse(new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test content-type: multipart/form-data for mixed scenarios. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fileArrayAndBasic(ComplexPartsRequest body) { - // Generated convenience method for fileArrayAndBasicWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fileArrayAndBasicWithResponse( - new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) - .serializeJsonField("address", body.getAddress()) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .serializeFileFields("pictures", - body.getPictures().stream().map(PicturesFileDetails::getContent).collect(Collectors.toList()), - body.getPictures().stream().map(PicturesFileDetails::getContentType).collect(Collectors.toList()), - body.getPictures().stream().map(PicturesFileDetails::getFilename).collect(Collectors.toList())) - .end() - .getRequestBody(), - requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test content-type: multipart/form-data for scenario contains json part and binary part. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono jsonPart(JsonPartRequest body) { - // Generated convenience method for jsonPartWithResponse - RequestOptions requestOptions = new RequestOptions(); - return jsonPartWithResponse( - new MultipartFormDataHelper(requestOptions).serializeJsonField("address", body.getAddress()) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), - requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test content-type: multipart/form-data for scenario contains multi binary parts. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono binaryArrayParts(BinaryArrayPartsRequest body) { - // Generated convenience method for binaryArrayPartsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return binaryArrayPartsWithResponse( - new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) - .serializeFileFields("pictures", - body.getPictures().stream().map(PicturesFileDetails::getContent).collect(Collectors.toList()), - body.getPictures().stream().map(PicturesFileDetails::getContentType).collect(Collectors.toList()), - body.getPictures().stream().map(PicturesFileDetails::getFilename).collect(Collectors.toList())) - .end() - .getRequestBody(), - requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test content-type: multipart/form-data for scenario contains multi binary parts. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono multiBinaryParts(MultiBinaryPartsRequest body) { - // Generated convenience method for multiBinaryPartsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return multiBinaryPartsWithResponse(new MultipartFormDataHelper(requestOptions) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .serializeFileField("picture", body.getPicture() == null ? null : body.getPicture().getContent(), - body.getPicture() == null ? null : body.getPicture().getContentType(), - body.getPicture() == null ? null : body.getPicture().getFilename()) - .end() - .getRequestBody(), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono checkFileNameAndContentType(MultiPartRequest body) { - // Generated convenience method for checkFileNameAndContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return checkFileNameAndContentTypeWithResponse( - new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), - requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono anonymousModel(AnonymousModelRequest body) { - // Generated convenience method for anonymousModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return anonymousModelWithResponse( - new MultipartFormDataHelper(requestOptions) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), - requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataClient.java deleted file mode 100644 index 6b077edb170..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataClient.java +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import java.util.stream.Collectors; -import payload.multipart.formdata.models.AnonymousModelRequest; -import payload.multipart.implementation.FormDatasImpl; -import payload.multipart.implementation.MultipartFormDataHelper; -import payload.multipart.models.BinaryArrayPartsRequest; -import payload.multipart.models.ComplexPartsRequest; -import payload.multipart.models.JsonPartRequest; -import payload.multipart.models.MultiBinaryPartsRequest; -import payload.multipart.models.MultiPartRequest; -import payload.multipart.models.PicturesFileDetails; - -/** - * Initializes a new instance of the synchronous MultiPartClient type. - */ -@ServiceClient(builder = MultiPartClientBuilder.class) -public final class FormDataClient { - @Generated - private final FormDatasImpl serviceClient; - - /** - * Initializes an instance of FormDataClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FormDataClient(FormDatasImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response basicWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'basic' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not - // generated. - return this.serviceClient.basicWithResponse(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for mixed scenarios. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response fileArrayAndBasicWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'fileArrayAndBasic' is of content-type 'multipart/form-data'. Protocol API is not usable and hence - // not generated. - return this.serviceClient.fileArrayAndBasicWithResponse(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for scenario contains json part and binary part. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response jsonPartWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'jsonPart' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not - // generated. - return this.serviceClient.jsonPartWithResponse(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for scenario contains multi binary parts. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response binaryArrayPartsWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'binaryArrayParts' is of content-type 'multipart/form-data'. Protocol API is not usable and hence - // not generated. - return this.serviceClient.binaryArrayPartsWithResponse(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for scenario contains multi binary parts. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response multiBinaryPartsWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'multiBinaryParts' is of content-type 'multipart/form-data'. Protocol API is not usable and hence - // not generated. - return this.serviceClient.multiBinaryPartsWithResponse(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response checkFileNameAndContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'checkFileNameAndContentType' is of content-type 'multipart/form-data'. Protocol API is not usable - // and hence not generated. - return this.serviceClient.checkFileNameAndContentTypeWithResponse(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response anonymousModelWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'anonymousModel' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not - // generated. - return this.serviceClient.anonymousModelWithResponse(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void basic(MultiPartRequest body) { - // Generated convenience method for basicWithResponse - RequestOptions requestOptions = new RequestOptions(); - basicWithResponse(new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), requestOptions).getValue(); - } - - /** - * Test content-type: multipart/form-data for mixed scenarios. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fileArrayAndBasic(ComplexPartsRequest body) { - // Generated convenience method for fileArrayAndBasicWithResponse - RequestOptions requestOptions = new RequestOptions(); - fileArrayAndBasicWithResponse(new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) - .serializeJsonField("address", body.getAddress()) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .serializeFileFields("pictures", - body.getPictures().stream().map(PicturesFileDetails::getContent).collect(Collectors.toList()), - body.getPictures().stream().map(PicturesFileDetails::getContentType).collect(Collectors.toList()), - body.getPictures().stream().map(PicturesFileDetails::getFilename).collect(Collectors.toList())) - .end() - .getRequestBody(), requestOptions).getValue(); - } - - /** - * Test content-type: multipart/form-data for scenario contains json part and binary part. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void jsonPart(JsonPartRequest body) { - // Generated convenience method for jsonPartWithResponse - RequestOptions requestOptions = new RequestOptions(); - jsonPartWithResponse( - new MultipartFormDataHelper(requestOptions).serializeJsonField("address", body.getAddress()) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), - requestOptions).getValue(); - } - - /** - * Test content-type: multipart/form-data for scenario contains multi binary parts. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void binaryArrayParts(BinaryArrayPartsRequest body) { - // Generated convenience method for binaryArrayPartsWithResponse - RequestOptions requestOptions = new RequestOptions(); - binaryArrayPartsWithResponse(new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) - .serializeFileFields("pictures", - body.getPictures().stream().map(PicturesFileDetails::getContent).collect(Collectors.toList()), - body.getPictures().stream().map(PicturesFileDetails::getContentType).collect(Collectors.toList()), - body.getPictures().stream().map(PicturesFileDetails::getFilename).collect(Collectors.toList())) - .end() - .getRequestBody(), requestOptions).getValue(); - } - - /** - * Test content-type: multipart/form-data for scenario contains multi binary parts. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void multiBinaryParts(MultiBinaryPartsRequest body) { - // Generated convenience method for multiBinaryPartsWithResponse - RequestOptions requestOptions = new RequestOptions(); - multiBinaryPartsWithResponse(new MultipartFormDataHelper(requestOptions) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .serializeFileField("picture", body.getPicture() == null ? null : body.getPicture().getContent(), - body.getPicture() == null ? null : body.getPicture().getContentType(), - body.getPicture() == null ? null : body.getPicture().getFilename()) - .end() - .getRequestBody(), requestOptions).getValue(); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void checkFileNameAndContentType(MultiPartRequest body) { - // Generated convenience method for checkFileNameAndContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - checkFileNameAndContentTypeWithResponse( - new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), - requestOptions).getValue(); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void anonymousModel(AnonymousModelRequest body) { - // Generated convenience method for anonymousModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - anonymousModelWithResponse( - new MultipartFormDataHelper(requestOptions) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), - requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsAsyncClient.java deleted file mode 100644 index ac78bac81ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsAsyncClient.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import java.util.stream.Collectors; -import payload.multipart.implementation.FormDataHttpPartsImpl; -import payload.multipart.implementation.MultipartFormDataHelper; -import payload.multipart.models.ComplexHttpPartsModelRequest; -import payload.multipart.models.FileRequiredMetaData; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous MultiPartClient type. - */ -@ServiceClient(builder = MultiPartClientBuilder.class, isAsync = true) -public final class FormDataHttpPartsAsyncClient { - @Generated - private final FormDataHttpPartsImpl serviceClient; - - /** - * Initializes an instance of FormDataHttpPartsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FormDataHttpPartsAsyncClient(FormDataHttpPartsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test content-type: multipart/form-data for mixed scenarios. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> jsonArrayAndFileArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'jsonArrayAndFileArray' is of content-type 'multipart/form-data'. Protocol API is not usable and - // hence not generated. - return this.serviceClient.jsonArrayAndFileArrayWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for mixed scenarios. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono jsonArrayAndFileArray(ComplexHttpPartsModelRequest body) { - // Generated convenience method for jsonArrayAndFileArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return jsonArrayAndFileArrayWithResponse( - new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) - .serializeJsonField("address", body.getAddress()) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .serializeJsonField("previousAddresses", body.getPreviousAddresses()) - .serializeFileFields("pictures", - body.getPictures().stream().map(FileRequiredMetaData::getContent).collect(Collectors.toList()), - body.getPictures().stream().map(FileRequiredMetaData::getContentType).collect(Collectors.toList()), - body.getPictures().stream().map(FileRequiredMetaData::getFilename).collect(Collectors.toList())) - .end() - .getRequestBody(), - requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsClient.java deleted file mode 100644 index 2a1059fe70e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsClient.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import java.util.stream.Collectors; -import payload.multipart.implementation.FormDataHttpPartsImpl; -import payload.multipart.implementation.MultipartFormDataHelper; -import payload.multipart.models.ComplexHttpPartsModelRequest; -import payload.multipart.models.FileRequiredMetaData; - -/** - * Initializes a new instance of the synchronous MultiPartClient type. - */ -@ServiceClient(builder = MultiPartClientBuilder.class) -public final class FormDataHttpPartsClient { - @Generated - private final FormDataHttpPartsImpl serviceClient; - - /** - * Initializes an instance of FormDataHttpPartsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FormDataHttpPartsClient(FormDataHttpPartsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test content-type: multipart/form-data for mixed scenarios. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response jsonArrayAndFileArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'jsonArrayAndFileArray' is of content-type 'multipart/form-data'. Protocol API is not usable and - // hence not generated. - return this.serviceClient.jsonArrayAndFileArrayWithResponse(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for mixed scenarios. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void jsonArrayAndFileArray(ComplexHttpPartsModelRequest body) { - // Generated convenience method for jsonArrayAndFileArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - jsonArrayAndFileArrayWithResponse( - new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) - .serializeJsonField("address", body.getAddress()) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .serializeJsonField("previousAddresses", body.getPreviousAddresses()) - .serializeFileFields("pictures", - body.getPictures().stream().map(FileRequiredMetaData::getContent).collect(Collectors.toList()), - body.getPictures().stream().map(FileRequiredMetaData::getContentType).collect(Collectors.toList()), - body.getPictures().stream().map(FileRequiredMetaData::getFilename).collect(Collectors.toList())) - .end() - .getRequestBody(), - requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeAsyncClient.java deleted file mode 100644 index 6a7ae8ceec0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeAsyncClient.java +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import payload.multipart.implementation.FormDataHttpPartsContentTypesImpl; -import payload.multipart.implementation.MultipartFormDataHelper; -import payload.multipart.models.FileWithHttpPartOptionalContentTypeRequest; -import payload.multipart.models.FileWithHttpPartRequiredContentTypeRequest; -import payload.multipart.models.FileWithHttpPartSpecificContentTypeRequest; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous MultiPartClient type. - */ -@ServiceClient(builder = MultiPartClientBuilder.class, isAsync = true) -public final class FormDataHttpPartsContentTypeAsyncClient { - @Generated - private final FormDataHttpPartsContentTypesImpl serviceClient; - - /** - * Initializes an instance of FormDataHttpPartsContentTypeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FormDataHttpPartsContentTypeAsyncClient(FormDataHttpPartsContentTypesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> imageJpegContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'imageJpegContentType' is of content-type 'multipart/form-data'. Protocol API is not usable and - // hence not generated. - return this.serviceClient.imageJpegContentTypeWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> requiredContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'requiredContentType' is of content-type 'multipart/form-data'. Protocol API is not usable and - // hence not generated. - return this.serviceClient.requiredContentTypeWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for optional content type. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> optionalContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'optionalContentType' is of content-type 'multipart/form-data'. Protocol API is not usable and - // hence not generated. - return this.serviceClient.optionalContentTypeWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono imageJpegContentType(FileWithHttpPartSpecificContentTypeRequest body) { - // Generated convenience method for imageJpegContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return imageJpegContentTypeWithResponse( - new MultipartFormDataHelper(requestOptions) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), - requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono requiredContentType(FileWithHttpPartRequiredContentTypeRequest body) { - // Generated convenience method for requiredContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return requiredContentTypeWithResponse( - new MultipartFormDataHelper(requestOptions) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), - requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test content-type: multipart/form-data for optional content type. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono optionalContentType(FileWithHttpPartOptionalContentTypeRequest body) { - // Generated convenience method for optionalContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return optionalContentTypeWithResponse( - new MultipartFormDataHelper(requestOptions) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), - requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeClient.java deleted file mode 100644 index ba6a6786b93..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeClient.java +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import payload.multipart.implementation.FormDataHttpPartsContentTypesImpl; -import payload.multipart.implementation.MultipartFormDataHelper; -import payload.multipart.models.FileWithHttpPartOptionalContentTypeRequest; -import payload.multipart.models.FileWithHttpPartRequiredContentTypeRequest; -import payload.multipart.models.FileWithHttpPartSpecificContentTypeRequest; - -/** - * Initializes a new instance of the synchronous MultiPartClient type. - */ -@ServiceClient(builder = MultiPartClientBuilder.class) -public final class FormDataHttpPartsContentTypeClient { - @Generated - private final FormDataHttpPartsContentTypesImpl serviceClient; - - /** - * Initializes an instance of FormDataHttpPartsContentTypeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FormDataHttpPartsContentTypeClient(FormDataHttpPartsContentTypesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response imageJpegContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'imageJpegContentType' is of content-type 'multipart/form-data'. Protocol API is not usable and - // hence not generated. - return this.serviceClient.imageJpegContentTypeWithResponse(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response requiredContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'requiredContentType' is of content-type 'multipart/form-data'. Protocol API is not usable and - // hence not generated. - return this.serviceClient.requiredContentTypeWithResponse(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for optional content type. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response optionalContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'optionalContentType' is of content-type 'multipart/form-data'. Protocol API is not usable and - // hence not generated. - return this.serviceClient.optionalContentTypeWithResponse(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void imageJpegContentType(FileWithHttpPartSpecificContentTypeRequest body) { - // Generated convenience method for imageJpegContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - imageJpegContentTypeWithResponse( - new MultipartFormDataHelper(requestOptions) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), - requestOptions).getValue(); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void requiredContentType(FileWithHttpPartRequiredContentTypeRequest body) { - // Generated convenience method for requiredContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - requiredContentTypeWithResponse( - new MultipartFormDataHelper(requestOptions) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), - requestOptions).getValue(); - } - - /** - * Test content-type: multipart/form-data for optional content type. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void optionalContentType(FileWithHttpPartOptionalContentTypeRequest body) { - // Generated convenience method for optionalContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - optionalContentTypeWithResponse( - new MultipartFormDataHelper(requestOptions) - .serializeFileField("profileImage", body.getProfileImage().getContent(), - body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) - .end() - .getRequestBody(), - requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringAsyncClient.java deleted file mode 100644 index 3bde6e4119f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringAsyncClient.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import payload.multipart.formdata.httpparts.nonstring.models.FloatRequest; -import payload.multipart.implementation.FormDataHttpPartsNonStringsImpl; -import payload.multipart.implementation.MultipartFormDataHelper; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the asynchronous MultiPartClient type. - */ -@ServiceClient(builder = MultiPartClientBuilder.class, isAsync = true) -public final class FormDataHttpPartsNonStringAsyncClient { - @Generated - private final FormDataHttpPartsNonStringsImpl serviceClient; - - /** - * Initializes an instance of FormDataHttpPartsNonStringAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FormDataHttpPartsNonStringAsyncClient(FormDataHttpPartsNonStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test content-type: multipart/form-data for non string. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> floatMethodWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'float' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not - // generated. - return this.serviceClient.floatMethodWithResponseAsync(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for non string. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono floatMethod(FloatRequest body) { - // Generated convenience method for floatMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return floatMethodWithResponse(new MultipartFormDataHelper(requestOptions) - .serializeTextField("temperature", String.valueOf(body.getTemperature())) - .end() - .getRequestBody(), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringClient.java deleted file mode 100644 index a31ef62543a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringClient.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import payload.multipart.formdata.httpparts.nonstring.models.FloatRequest; -import payload.multipart.implementation.FormDataHttpPartsNonStringsImpl; -import payload.multipart.implementation.MultipartFormDataHelper; - -/** - * Initializes a new instance of the synchronous MultiPartClient type. - */ -@ServiceClient(builder = MultiPartClientBuilder.class) -public final class FormDataHttpPartsNonStringClient { - @Generated - private final FormDataHttpPartsNonStringsImpl serviceClient; - - /** - * Initializes an instance of FormDataHttpPartsNonStringClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FormDataHttpPartsNonStringClient(FormDataHttpPartsNonStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test content-type: multipart/form-data for non string. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response floatMethodWithResponse(BinaryData body, RequestOptions requestOptions) { - // Operation 'float' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not - // generated. - return this.serviceClient.floatMethodWithResponse(body, requestOptions); - } - - /** - * Test content-type: multipart/form-data for non string. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void floatMethod(FloatRequest body) { - // Generated convenience method for floatMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - floatMethodWithResponse(new MultipartFormDataHelper(requestOptions) - .serializeTextField("temperature", String.valueOf(body.getTemperature())) - .end() - .getRequestBody(), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/MultiPartClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/MultiPartClientBuilder.java deleted file mode 100644 index 73a94809558..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/MultiPartClientBuilder.java +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import payload.multipart.implementation.MultiPartClientImpl; - -/** - * A builder for creating a new instance of the MultiPartClient type. - */ -@ServiceClientBuilder( - serviceClients = { - FormDataClient.class, - FormDataHttpPartsClient.class, - FormDataHttpPartsContentTypeClient.class, - FormDataHttpPartsNonStringClient.class, - FormDataAsyncClient.class, - FormDataHttpPartsAsyncClient.class, - FormDataHttpPartsContentTypeAsyncClient.class, - FormDataHttpPartsNonStringAsyncClient.class }) -public final class MultiPartClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("payload-multipart.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the MultiPartClientBuilder. - */ - @Generated - public MultiPartClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiPartClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiPartClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiPartClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiPartClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiPartClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiPartClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiPartClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiPartClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the MultiPartClientBuilder. - */ - @Generated - public MultiPartClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of MultiPartClientImpl with the provided parameters. - * - * @return an instance of MultiPartClientImpl. - */ - @Generated - private MultiPartClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - MultiPartClientImpl client - = new MultiPartClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of FormDataAsyncClient class. - * - * @return an instance of FormDataAsyncClient. - */ - @Generated - public FormDataAsyncClient buildFormDataAsyncClient() { - return new FormDataAsyncClient(buildInnerClient().getFormDatas()); - } - - /** - * Builds an instance of FormDataHttpPartsAsyncClient class. - * - * @return an instance of FormDataHttpPartsAsyncClient. - */ - @Generated - public FormDataHttpPartsAsyncClient buildFormDataHttpPartsAsyncClient() { - return new FormDataHttpPartsAsyncClient(buildInnerClient().getFormDataHttpParts()); - } - - /** - * Builds an instance of FormDataHttpPartsContentTypeAsyncClient class. - * - * @return an instance of FormDataHttpPartsContentTypeAsyncClient. - */ - @Generated - public FormDataHttpPartsContentTypeAsyncClient buildFormDataHttpPartsContentTypeAsyncClient() { - return new FormDataHttpPartsContentTypeAsyncClient(buildInnerClient().getFormDataHttpPartsContentTypes()); - } - - /** - * Builds an instance of FormDataHttpPartsNonStringAsyncClient class. - * - * @return an instance of FormDataHttpPartsNonStringAsyncClient. - */ - @Generated - public FormDataHttpPartsNonStringAsyncClient buildFormDataHttpPartsNonStringAsyncClient() { - return new FormDataHttpPartsNonStringAsyncClient(buildInnerClient().getFormDataHttpPartsNonStrings()); - } - - /** - * Builds an instance of FormDataClient class. - * - * @return an instance of FormDataClient. - */ - @Generated - public FormDataClient buildFormDataClient() { - return new FormDataClient(buildInnerClient().getFormDatas()); - } - - /** - * Builds an instance of FormDataHttpPartsClient class. - * - * @return an instance of FormDataHttpPartsClient. - */ - @Generated - public FormDataHttpPartsClient buildFormDataHttpPartsClient() { - return new FormDataHttpPartsClient(buildInnerClient().getFormDataHttpParts()); - } - - /** - * Builds an instance of FormDataHttpPartsContentTypeClient class. - * - * @return an instance of FormDataHttpPartsContentTypeClient. - */ - @Generated - public FormDataHttpPartsContentTypeClient buildFormDataHttpPartsContentTypeClient() { - return new FormDataHttpPartsContentTypeClient(buildInnerClient().getFormDataHttpPartsContentTypes()); - } - - /** - * Builds an instance of FormDataHttpPartsNonStringClient class. - * - * @return an instance of FormDataHttpPartsNonStringClient. - */ - @Generated - public FormDataHttpPartsNonStringClient buildFormDataHttpPartsNonStringClient() { - return new FormDataHttpPartsNonStringClient(buildInnerClient().getFormDataHttpPartsNonStrings()); - } - - private static final ClientLogger LOGGER = new ClientLogger(MultiPartClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/FloatRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/FloatRequest.java deleted file mode 100644 index 16eb7e29c3e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/FloatRequest.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.formdata.httpparts.nonstring.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; - -/** - * The FloatRequest model. - */ -@Immutable -public final class FloatRequest { - /* - * The temperature property. - */ - @Generated - private final double temperature; - - /** - * Creates an instance of FloatRequest class. - * - * @param temperature the temperature value to set. - */ - @Generated - public FloatRequest(double temperature) { - this.temperature = temperature; - } - - /** - * Get the temperature property: The temperature property. - * - * @return the temperature value. - */ - @Generated - public double getTemperature() { - return this.temperature; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/package-info.java deleted file mode 100644 index 3e30b7cc133..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for MultiPart. - * Test for multipart. - * - */ -package payload.multipart.formdata.httpparts.nonstring.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/AnonymousModelRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/AnonymousModelRequest.java deleted file mode 100644 index ca7d485b92f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/AnonymousModelRequest.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.formdata.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import payload.multipart.models.ProfileImageFileDetails; - -/** - * The AnonymousModelRequest model. - */ -@Immutable -public final class AnonymousModelRequest { - /* - * The profileImage property. - */ - @Generated - private final ProfileImageFileDetails profileImage; - - /** - * Creates an instance of AnonymousModelRequest class. - * - * @param profileImage the profileImage value to set. - */ - @Generated - public AnonymousModelRequest(ProfileImageFileDetails profileImage) { - this.profileImage = profileImage; - } - - /** - * Get the profileImage property: The profileImage property. - * - * @return the profileImage value. - */ - @Generated - public ProfileImageFileDetails getProfileImage() { - return this.profileImage; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/package-info.java deleted file mode 100644 index eb621067a32..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for MultiPart. - * Test for multipart. - * - */ -package payload.multipart.formdata.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsContentTypesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsContentTypesImpl.java deleted file mode 100644 index 8d65e0d251d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsContentTypesImpl.java +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in FormDataHttpPartsContentTypes. - */ -public final class FormDataHttpPartsContentTypesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FormDataHttpPartsContentTypesService service; - - /** - * The service client containing this operation class. - */ - private final MultiPartClientImpl client; - - /** - * Initializes an instance of FormDataHttpPartsContentTypesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FormDataHttpPartsContentTypesImpl(MultiPartClientImpl client) { - this.service = RestProxy.create(FormDataHttpPartsContentTypesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for MultiPartClientFormDataHttpPartsContentTypes to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MultiPartClientFormDataHttpPartsContentTypes") - public interface FormDataHttpPartsContentTypesService { - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/check-filename-and-specific-content-type-with-httppart") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> imageJpegContentType(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/check-filename-and-specific-content-type-with-httppart") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response imageJpegContentTypeSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/check-filename-and-required-content-type-with-httppart") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> requiredContentType(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/check-filename-and-required-content-type-with-httppart") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response requiredContentTypeSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/file-with-http-part-optional-content-type") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> optionalContentType(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/file-with-http-part-optional-content-type") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response optionalContentTypeSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> imageJpegContentTypeWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext(context -> service.imageJpegContentType(this.client.getEndpoint(), contentType, - body, requestOptions, context)); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response imageJpegContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.imageJpegContentTypeSync(this.client.getEndpoint(), contentType, body, requestOptions, - Context.NONE); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requiredContentTypeWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext(context -> service.requiredContentType(this.client.getEndpoint(), contentType, body, - requestOptions, context)); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requiredContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.requiredContentTypeSync(this.client.getEndpoint(), contentType, body, requestOptions, - Context.NONE); - } - - /** - * Test content-type: multipart/form-data for optional content type. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> optionalContentTypeWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext(context -> service.optionalContentType(this.client.getEndpoint(), contentType, body, - requestOptions, context)); - } - - /** - * Test content-type: multipart/form-data for optional content type. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response optionalContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.optionalContentTypeSync(this.client.getEndpoint(), contentType, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsImpl.java deleted file mode 100644 index c5195f9becf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsImpl.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in FormDataHttpParts. - */ -public final class FormDataHttpPartsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FormDataHttpPartsService service; - - /** - * The service client containing this operation class. - */ - private final MultiPartClientImpl client; - - /** - * Initializes an instance of FormDataHttpPartsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FormDataHttpPartsImpl(MultiPartClientImpl client) { - this.service - = RestProxy.create(FormDataHttpPartsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for MultiPartClientFormDataHttpParts to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MultiPartClientFormDataHttpParts") - public interface FormDataHttpPartsService { - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/complex-parts-with-httppart") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> jsonArrayAndFileArray(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/complex-parts-with-httppart") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response jsonArrayAndFileArraySync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Test content-type: multipart/form-data for mixed scenarios. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> jsonArrayAndFileArrayWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext(context -> service.jsonArrayAndFileArray(this.client.getEndpoint(), contentType, - body, requestOptions, context)); - } - - /** - * Test content-type: multipart/form-data for mixed scenarios. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response jsonArrayAndFileArrayWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.jsonArrayAndFileArraySync(this.client.getEndpoint(), contentType, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsNonStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsNonStringsImpl.java deleted file mode 100644 index 15e7c5460a2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsNonStringsImpl.java +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in FormDataHttpPartsNonStrings. - */ -public final class FormDataHttpPartsNonStringsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FormDataHttpPartsNonStringsService service; - - /** - * The service client containing this operation class. - */ - private final MultiPartClientImpl client; - - /** - * Initializes an instance of FormDataHttpPartsNonStringsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FormDataHttpPartsNonStringsImpl(MultiPartClientImpl client) { - this.service = RestProxy.create(FormDataHttpPartsNonStringsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for MultiPartClientFormDataHttpPartsNonStrings to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MultiPartClientFormDataHttpPartsNonStrings") - public interface FormDataHttpPartsNonStringsService { - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/non-string-float") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> floatMethod(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/non-string-float") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response floatMethodSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Test content-type: multipart/form-data for non string. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> floatMethodWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext( - context -> service.floatMethod(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Test content-type: multipart/form-data for non string. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response floatMethodWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.floatMethodSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDatasImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDatasImpl.java deleted file mode 100644 index fdef78501b3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDatasImpl.java +++ /dev/null @@ -1,463 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in FormDatas. - */ -public final class FormDatasImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FormDatasService service; - - /** - * The service client containing this operation class. - */ - private final MultiPartClientImpl client; - - /** - * Initializes an instance of FormDatasImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FormDatasImpl(MultiPartClientImpl client) { - this.service - = RestProxy.create(FormDatasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for MultiPartClientFormDatas to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MultiPartClientFormDatas") - public interface FormDatasService { - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/mixed-parts") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> basic(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/mixed-parts") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response basicSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/complex-parts") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> fileArrayAndBasic(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/complex-parts") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fileArrayAndBasicSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/json-part") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> jsonPart(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/json-part") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response jsonPartSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/binary-array-parts") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> binaryArrayParts(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/binary-array-parts") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response binaryArrayPartsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/multi-binary-parts") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> multiBinaryParts(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/multi-binary-parts") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response multiBinaryPartsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/check-filename-and-content-type") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> checkFileNameAndContentType(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/check-filename-and-content-type") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response checkFileNameAndContentTypeSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/anonymous-model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> anonymousModel(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/multipart/form-data/anonymous-model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response anonymousModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> basicWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext( - context -> service.basic(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response basicWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.basicSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Test content-type: multipart/form-data for mixed scenarios. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fileArrayAndBasicWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext(context -> service.fileArrayAndBasic(this.client.getEndpoint(), contentType, body, - requestOptions, context)); - } - - /** - * Test content-type: multipart/form-data for mixed scenarios. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fileArrayAndBasicWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.fileArrayAndBasicSync(this.client.getEndpoint(), contentType, body, requestOptions, - Context.NONE); - } - - /** - * Test content-type: multipart/form-data for scenario contains json part and binary part. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> jsonPartWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext( - context -> service.jsonPart(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Test content-type: multipart/form-data for scenario contains json part and binary part. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response jsonPartWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.jsonPartSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Test content-type: multipart/form-data for scenario contains multi binary parts. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> binaryArrayPartsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext( - context -> service.binaryArrayParts(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Test content-type: multipart/form-data for scenario contains multi binary parts. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response binaryArrayPartsWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.binaryArrayPartsSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Test content-type: multipart/form-data for scenario contains multi binary parts. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> multiBinaryPartsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext( - context -> service.multiBinaryParts(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Test content-type: multipart/form-data for scenario contains multi binary parts. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response multiBinaryPartsWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.multiBinaryPartsSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> checkFileNameAndContentTypeWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext(context -> service.checkFileNameAndContentType(this.client.getEndpoint(), - contentType, body, requestOptions, context)); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response checkFileNameAndContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.checkFileNameAndContentTypeSync(this.client.getEndpoint(), contentType, body, requestOptions, - Context.NONE); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> anonymousModelWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext( - context -> service.anonymousModel(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Test content-type: multipart/form-data. - * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response anonymousModelWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.anonymousModelSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultiPartClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultiPartClientImpl.java deleted file mode 100644 index 084691d24cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultiPartClientImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 MultiPartClient type. - */ -public final class MultiPartClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 FormDatasImpl object to access its operations. - */ - private final FormDatasImpl formDatas; - - /** - * Gets the FormDatasImpl object to access its operations. - * - * @return the FormDatasImpl object. - */ - public FormDatasImpl getFormDatas() { - return this.formDatas; - } - - /** - * The FormDataHttpPartsImpl object to access its operations. - */ - private final FormDataHttpPartsImpl formDataHttpParts; - - /** - * Gets the FormDataHttpPartsImpl object to access its operations. - * - * @return the FormDataHttpPartsImpl object. - */ - public FormDataHttpPartsImpl getFormDataHttpParts() { - return this.formDataHttpParts; - } - - /** - * The FormDataHttpPartsContentTypesImpl object to access its operations. - */ - private final FormDataHttpPartsContentTypesImpl formDataHttpPartsContentTypes; - - /** - * Gets the FormDataHttpPartsContentTypesImpl object to access its operations. - * - * @return the FormDataHttpPartsContentTypesImpl object. - */ - public FormDataHttpPartsContentTypesImpl getFormDataHttpPartsContentTypes() { - return this.formDataHttpPartsContentTypes; - } - - /** - * The FormDataHttpPartsNonStringsImpl object to access its operations. - */ - private final FormDataHttpPartsNonStringsImpl formDataHttpPartsNonStrings; - - /** - * Gets the FormDataHttpPartsNonStringsImpl object to access its operations. - * - * @return the FormDataHttpPartsNonStringsImpl object. - */ - public FormDataHttpPartsNonStringsImpl getFormDataHttpPartsNonStrings() { - return this.formDataHttpPartsNonStrings; - } - - /** - * Initializes an instance of MultiPartClient client. - * - * @param endpoint Service host. - */ - public MultiPartClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of MultiPartClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public MultiPartClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of MultiPartClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public MultiPartClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.formDatas = new FormDatasImpl(this); - this.formDataHttpParts = new FormDataHttpPartsImpl(this); - this.formDataHttpPartsContentTypes = new FormDataHttpPartsContentTypesImpl(this); - this.formDataHttpPartsNonStrings = new FormDataHttpPartsNonStringsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultipartFormDataHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultipartFormDataHelper.java deleted file mode 100644 index 2abfdfa9b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultipartFormDataHelper.java +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.implementation; - -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.core.util.CoreUtils; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.SequenceInputStream; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.UUID; - -// DO NOT modify this helper class - -public final class MultipartFormDataHelper { - /** - * Line separator for the multipart HTTP request. - */ - private static final String CRLF = "\r\n"; - - private static final String APPLICATION_OCTET_STREAM = "application/octet-stream"; - - /** - * Value to be used as part of the divider for the multipart requests. - */ - private final String boundary; - - /** - * The actual part separator in the request. This is obtained by prepending "--" to the "boundary". - */ - private final String partSeparator; - - /** - * The marker for the ending of a multipart request. This is obtained by post-pending "--" to the "partSeparator". - */ - private final String endMarker; - - /** - * Charset used for encoding the multipart HTTP request. - */ - private final Charset encoderCharset = StandardCharsets.UTF_8; - - private InputStream requestDataStream = new ByteArrayInputStream(new byte[0]); - private long requestLength = 0; - - private RequestOptions requestOptions; - private BinaryData requestBody; - - /** - * Default constructor used in the code. The boundary is a random value. - * - * @param requestOptions the RequestOptions to update - */ - public MultipartFormDataHelper(RequestOptions requestOptions) { - this(requestOptions, UUID.randomUUID().toString().substring(0, 16)); - } - - private MultipartFormDataHelper(RequestOptions requestOptions, String boundary) { - this.requestOptions = requestOptions; - this.boundary = boundary; - this.partSeparator = "--" + boundary; - this.endMarker = this.partSeparator + "--"; - } - - /** - * Gets the multipart HTTP request body. - * - * @return the BinaryData of the multipart HTTP request body - */ - public BinaryData getRequestBody() { - return requestBody; - } - - // text/plain - /** - * Formats a text/plain field for a multipart HTTP request. - * - * @param fieldName the field name - * @param value the value of the text/plain field - * @return the MultipartFormDataHelper instance - */ - public MultipartFormDataHelper serializeTextField(String fieldName, String value) { - if (value != null) { - String serialized = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) - + "\"" + CRLF + CRLF + value + CRLF; - byte[] data = serialized.getBytes(encoderCharset); - appendBytes(data); - } - return this; - } - - // application/json - /** - * Formats a application/json field for a multipart HTTP request. - * - * @param fieldName the field name - * @param jsonObject the object of the application/json field - * @return the MultipartFormDataHelper instance - */ - public MultipartFormDataHelper serializeJsonField(String fieldName, Object jsonObject) { - if (jsonObject != null) { - String serialized - = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + "\"" + CRLF - + "Content-Type: application/json" + CRLF + CRLF + BinaryData.fromObject(jsonObject) + CRLF; - byte[] data = serialized.getBytes(encoderCharset); - appendBytes(data); - } - return this; - } - - /** - * Formats a file field for a multipart HTTP request. - * - * @param fieldName the field name - * @param file the BinaryData of the file - * @param contentType the content-type of the file - * @param filename the filename - * @return the MultipartFormDataHelper instance - */ - public MultipartFormDataHelper serializeFileField(String fieldName, BinaryData file, String contentType, - String filename) { - if (file != null) { - if (CoreUtils.isNullOrEmpty(contentType)) { - contentType = APPLICATION_OCTET_STREAM; - } - writeFileField(fieldName, file, contentType, filename); - } - return this; - } - - /** - * Formats a file field (potentially multiple files) for a multipart HTTP request. - * - * @param fieldName the field name - * @param files the List of BinaryData of the files - * @param contentTypes the List of content-type of the files - * @param filenames the List of filenames - * @return the MultipartFormDataHelper instance - */ - public MultipartFormDataHelper serializeFileFields(String fieldName, List files, - List contentTypes, List filenames) { - if (files != null) { - for (int i = 0; i < files.size(); ++i) { - BinaryData file = files.get(i); - String contentType = contentTypes.get(i); - if (CoreUtils.isNullOrEmpty(contentType)) { - contentType = APPLICATION_OCTET_STREAM; - } - String filename = filenames.get(i); - writeFileField(fieldName, file, contentType, filename); - } - } - return this; - } - - /** - * Ends the serialization of the multipart HTTP request. - * - * @return the MultipartFormDataHelper instance - */ - public MultipartFormDataHelper end() { - byte[] data = endMarker.getBytes(encoderCharset); - appendBytes(data); - - requestBody = BinaryData.fromStream(requestDataStream, requestLength); - - requestOptions.setHeader(HttpHeaderName.CONTENT_TYPE, "multipart/form-data; boundary=" + this.boundary) - .setHeader(HttpHeaderName.CONTENT_LENGTH, String.valueOf(requestLength)); - - return this; - } - - private void writeFileField(String fieldName, BinaryData file, String contentType, String filename) { - String contentDispositionFilename = ""; - if (!CoreUtils.isNullOrEmpty(filename)) { - contentDispositionFilename = "; filename=\"" + escapeName(filename) + "\""; - } - - // Multipart preamble - String fileFieldPreamble - = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + "\"" - + contentDispositionFilename + CRLF + "Content-Type: " + contentType + CRLF + CRLF; - byte[] data = fileFieldPreamble.getBytes(encoderCharset); - appendBytes(data); - - // Writing the file into the request as a byte stream - requestLength += file.getLength(); - requestDataStream = new SequenceInputStream(requestDataStream, file.toStream()); - - // CRLF - data = CRLF.getBytes(encoderCharset); - appendBytes(data); - } - - private void appendBytes(byte[] bytes) { - requestLength += bytes.length; - requestDataStream = new SequenceInputStream(requestDataStream, new ByteArrayInputStream(bytes)); - } - - private static String escapeName(String name) { - return name.replace("\n", "%0A").replace("\r", "%0D").replace("\"", "%22"); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/package-info.java deleted file mode 100644 index 517ca8ab146..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for MultiPart. - * Test for multipart. - * - */ -package payload.multipart.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/Address.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/Address.java deleted file mode 100644 index 94d3789f103..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/Address.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Address model. - */ -@Immutable -public final class Address implements JsonSerializable
{ - /* - * The city property. - */ - @Generated - private final String city; - - /** - * Creates an instance of Address class. - * - * @param city the city value to set. - */ - @Generated - public Address(String city) { - this.city = city; - } - - /** - * Get the city property: The city property. - * - * @return the city value. - */ - @Generated - public String getCity() { - return this.city; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("city", this.city); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Address from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Address if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Address. - */ - @Generated - public static Address fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String city = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("city".equals(fieldName)) { - city = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Address(city); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/BinaryArrayPartsRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/BinaryArrayPartsRequest.java deleted file mode 100644 index 6e2236bf2b8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/BinaryArrayPartsRequest.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import java.util.List; - -/** - * The BinaryArrayPartsRequest model. - */ -@Immutable -public final class BinaryArrayPartsRequest { - /* - * The id property. - */ - @Generated - private final String id; - - /* - * The pictures property. - */ - @Generated - private final List pictures; - - /** - * Creates an instance of BinaryArrayPartsRequest class. - * - * @param id the id value to set. - * @param pictures the pictures value to set. - */ - @Generated - public BinaryArrayPartsRequest(String id, List pictures) { - this.id = id; - this.pictures = pictures; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the pictures property: The pictures property. - * - * @return the pictures value. - */ - @Generated - public List getPictures() { - return this.pictures; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexHttpPartsModelRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexHttpPartsModelRequest.java deleted file mode 100644 index 526fe1ed946..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexHttpPartsModelRequest.java +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import java.util.List; - -/** - * The ComplexHttpPartsModelRequest model. - */ -@Immutable -public final class ComplexHttpPartsModelRequest { - /* - * The id property. - */ - @Generated - private final String id; - - /* - * The address property. - */ - @Generated - private final Address address; - - /* - * The profileImage property. - */ - @Generated - private final FileRequiredMetaData profileImage; - - /* - * The previousAddresses property. - */ - @Generated - private final List
previousAddresses; - - /* - * The pictures property. - */ - @Generated - private final List pictures; - - /** - * Creates an instance of ComplexHttpPartsModelRequest class. - * - * @param id the id value to set. - * @param address the address value to set. - * @param profileImage the profileImage value to set. - * @param previousAddresses the previousAddresses value to set. - * @param pictures the pictures value to set. - */ - @Generated - public ComplexHttpPartsModelRequest(String id, Address address, FileRequiredMetaData profileImage, - List
previousAddresses, List pictures) { - this.id = id; - this.address = address; - this.profileImage = profileImage; - this.previousAddresses = previousAddresses; - this.pictures = pictures; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the address property: The address property. - * - * @return the address value. - */ - @Generated - public Address getAddress() { - return this.address; - } - - /** - * Get the profileImage property: The profileImage property. - * - * @return the profileImage value. - */ - @Generated - public FileRequiredMetaData getProfileImage() { - return this.profileImage; - } - - /** - * Get the previousAddresses property: The previousAddresses property. - * - * @return the previousAddresses value. - */ - @Generated - public List
getPreviousAddresses() { - return this.previousAddresses; - } - - /** - * Get the pictures property: The pictures property. - * - * @return the pictures value. - */ - @Generated - public List getPictures() { - return this.pictures; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexPartsRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexPartsRequest.java deleted file mode 100644 index ec5ad76b21d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexPartsRequest.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import java.util.List; - -/** - * The ComplexPartsRequest model. - */ -@Immutable -public final class ComplexPartsRequest { - /* - * The id property. - */ - @Generated - private final String id; - - /* - * The address property. - */ - @Generated - private final Address address; - - /* - * The profileImage property. - */ - @Generated - private final ProfileImageFileDetails profileImage; - - /* - * The pictures property. - */ - @Generated - private final List pictures; - - /** - * Creates an instance of ComplexPartsRequest class. - * - * @param id the id value to set. - * @param address the address value to set. - * @param profileImage the profileImage value to set. - * @param pictures the pictures value to set. - */ - @Generated - public ComplexPartsRequest(String id, Address address, ProfileImageFileDetails profileImage, - List pictures) { - this.id = id; - this.address = address; - this.profileImage = profileImage; - this.pictures = pictures; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the address property: The address property. - * - * @return the address value. - */ - @Generated - public Address getAddress() { - return this.address; - } - - /** - * Get the profileImage property: The profileImage property. - * - * @return the profileImage value. - */ - @Generated - public ProfileImageFileDetails getProfileImage() { - return this.profileImage; - } - - /** - * Get the pictures property: The pictures property. - * - * @return the pictures value. - */ - @Generated - public List getPictures() { - return this.pictures; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileOptionalContentType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileOptionalContentType.java deleted file mode 100644 index 5a234481a17..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileOptionalContentType.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; - -/** - * The file details for the "profileImage" field. - */ -@Fluent -public final class FileOptionalContentType { - /* - * The content of the file. - */ - @Generated - private final BinaryData content; - - /* - * The filename of the file. - */ - @Generated - private final String filename; - - /* - * The content-type of the file. - */ - @Generated - private String contentType = "application/octet-stream"; - - /** - * Creates an instance of FileOptionalContentType class. - * - * @param content the content value to set. - * @param filename the filename value to set. - */ - @Generated - public FileOptionalContentType(BinaryData content, String filename) { - this.content = content; - this.filename = filename; - } - - /** - * Get the content property: The content of the file. - * - * @return the content value. - */ - @Generated - public BinaryData getContent() { - return this.content; - } - - /** - * Get the filename property: The filename of the file. - * - * @return the filename value. - */ - @Generated - public String getFilename() { - return this.filename; - } - - /** - * Get the contentType property: The content-type of the file. - * - * @return the contentType value. - */ - @Generated - public String getContentType() { - return this.contentType; - } - - /** - * Set the contentType property: The content-type of the file. - * - * @param contentType the contentType value to set. - * @return the FileOptionalContentType object itself. - */ - @Generated - public FileOptionalContentType setContentType(String contentType) { - this.contentType = contentType; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileRequiredMetaData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileRequiredMetaData.java deleted file mode 100644 index 32d06b9a0f6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileRequiredMetaData.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; - -/** - * The file details for the "profileImage" field. - */ -@Immutable -public final class FileRequiredMetaData { - /* - * The content of the file. - */ - @Generated - private final BinaryData content; - - /* - * The filename of the file. - */ - @Generated - private final String filename; - - /* - * The content-type of the file. - */ - @Generated - private final String contentType; - - /** - * Creates an instance of FileRequiredMetaData class. - * - * @param content the content value to set. - * @param filename the filename value to set. - * @param contentType the contentType value to set. - */ - @Generated - public FileRequiredMetaData(BinaryData content, String filename, String contentType) { - this.content = content; - this.filename = filename; - this.contentType = contentType; - } - - /** - * Get the content property: The content of the file. - * - * @return the content value. - */ - @Generated - public BinaryData getContent() { - return this.content; - } - - /** - * Get the filename property: The filename of the file. - * - * @return the filename value. - */ - @Generated - public String getFilename() { - return this.filename; - } - - /** - * Get the contentType property: The content-type of the file. - * - * @return the contentType value. - */ - @Generated - public String getContentType() { - return this.contentType; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileSpecificContentType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileSpecificContentType.java deleted file mode 100644 index 27a57da187b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileSpecificContentType.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; - -/** - * The file details for the "profileImage" field. - */ -@Immutable -public final class FileSpecificContentType { - /* - * The content of the file. - */ - @Generated - private final BinaryData content; - - /* - * The filename of the file. - */ - @Generated - private final String filename; - - /* - * The content-type of the file. - */ - @Generated - private final String contentType = "image/jpg"; - - /** - * Creates an instance of FileSpecificContentType class. - * - * @param content the content value to set. - * @param filename the filename value to set. - */ - @Generated - public FileSpecificContentType(BinaryData content, String filename) { - this.content = content; - this.filename = filename; - } - - /** - * Get the content property: The content of the file. - * - * @return the content value. - */ - @Generated - public BinaryData getContent() { - return this.content; - } - - /** - * Get the filename property: The filename of the file. - * - * @return the filename value. - */ - @Generated - public String getFilename() { - return this.filename; - } - - /** - * Get the contentType property: The content-type of the file. - * - * @return the contentType value. - */ - @Generated - public String getContentType() { - return this.contentType; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartOptionalContentTypeRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartOptionalContentTypeRequest.java deleted file mode 100644 index 98bd9bedb2f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartOptionalContentTypeRequest.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; - -/** - * The FileWithHttpPartOptionalContentTypeRequest model. - */ -@Immutable -public final class FileWithHttpPartOptionalContentTypeRequest { - /* - * The profileImage property. - */ - @Generated - private final FileOptionalContentType profileImage; - - /** - * Creates an instance of FileWithHttpPartOptionalContentTypeRequest class. - * - * @param profileImage the profileImage value to set. - */ - @Generated - public FileWithHttpPartOptionalContentTypeRequest(FileOptionalContentType profileImage) { - this.profileImage = profileImage; - } - - /** - * Get the profileImage property: The profileImage property. - * - * @return the profileImage value. - */ - @Generated - public FileOptionalContentType getProfileImage() { - return this.profileImage; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartRequiredContentTypeRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartRequiredContentTypeRequest.java deleted file mode 100644 index 0606530e757..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartRequiredContentTypeRequest.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; - -/** - * The FileWithHttpPartRequiredContentTypeRequest model. - */ -@Immutable -public final class FileWithHttpPartRequiredContentTypeRequest { - /* - * The profileImage property. - */ - @Generated - private final FileRequiredMetaData profileImage; - - /** - * Creates an instance of FileWithHttpPartRequiredContentTypeRequest class. - * - * @param profileImage the profileImage value to set. - */ - @Generated - public FileWithHttpPartRequiredContentTypeRequest(FileRequiredMetaData profileImage) { - this.profileImage = profileImage; - } - - /** - * Get the profileImage property: The profileImage property. - * - * @return the profileImage value. - */ - @Generated - public FileRequiredMetaData getProfileImage() { - return this.profileImage; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartSpecificContentTypeRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartSpecificContentTypeRequest.java deleted file mode 100644 index 12f1fe506f2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartSpecificContentTypeRequest.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; - -/** - * The FileWithHttpPartSpecificContentTypeRequest model. - */ -@Immutable -public final class FileWithHttpPartSpecificContentTypeRequest { - /* - * The profileImage property. - */ - @Generated - private final FileSpecificContentType profileImage; - - /** - * Creates an instance of FileWithHttpPartSpecificContentTypeRequest class. - * - * @param profileImage the profileImage value to set. - */ - @Generated - public FileWithHttpPartSpecificContentTypeRequest(FileSpecificContentType profileImage) { - this.profileImage = profileImage; - } - - /** - * Get the profileImage property: The profileImage property. - * - * @return the profileImage value. - */ - @Generated - public FileSpecificContentType getProfileImage() { - return this.profileImage; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/JsonPartRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/JsonPartRequest.java deleted file mode 100644 index 636bcfa3c2a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/JsonPartRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; - -/** - * The JsonPartRequest model. - */ -@Immutable -public final class JsonPartRequest { - /* - * The address property. - */ - @Generated - private final Address address; - - /* - * The profileImage property. - */ - @Generated - private final ProfileImageFileDetails profileImage; - - /** - * Creates an instance of JsonPartRequest class. - * - * @param address the address value to set. - * @param profileImage the profileImage value to set. - */ - @Generated - public JsonPartRequest(Address address, ProfileImageFileDetails profileImage) { - this.address = address; - this.profileImage = profileImage; - } - - /** - * Get the address property: The address property. - * - * @return the address value. - */ - @Generated - public Address getAddress() { - return this.address; - } - - /** - * Get the profileImage property: The profileImage property. - * - * @return the profileImage value. - */ - @Generated - public ProfileImageFileDetails getProfileImage() { - return this.profileImage; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiBinaryPartsRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiBinaryPartsRequest.java deleted file mode 100644 index ad93462bb89..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiBinaryPartsRequest.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; - -/** - * The MultiBinaryPartsRequest model. - */ -@Fluent -public final class MultiBinaryPartsRequest { - /* - * The profileImage property. - */ - @Generated - private final ProfileImageFileDetails profileImage; - - /* - * The picture property. - */ - @Generated - private PictureFileDetails picture; - - /** - * Creates an instance of MultiBinaryPartsRequest class. - * - * @param profileImage the profileImage value to set. - */ - @Generated - public MultiBinaryPartsRequest(ProfileImageFileDetails profileImage) { - this.profileImage = profileImage; - } - - /** - * Get the profileImage property: The profileImage property. - * - * @return the profileImage value. - */ - @Generated - public ProfileImageFileDetails getProfileImage() { - return this.profileImage; - } - - /** - * Get the picture property: The picture property. - * - * @return the picture value. - */ - @Generated - public PictureFileDetails getPicture() { - return this.picture; - } - - /** - * Set the picture property: The picture property. - * - * @param picture the picture value to set. - * @return the MultiBinaryPartsRequest object itself. - */ - @Generated - public MultiBinaryPartsRequest setPicture(PictureFileDetails picture) { - this.picture = picture; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiPartRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiPartRequest.java deleted file mode 100644 index 13513f1c540..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiPartRequest.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; - -/** - * The MultiPartRequest model. - */ -@Immutable -public final class MultiPartRequest { - /* - * The id property. - */ - @Generated - private final String id; - - /* - * The profileImage property. - */ - @Generated - private final ProfileImageFileDetails profileImage; - - /** - * Creates an instance of MultiPartRequest class. - * - * @param id the id value to set. - * @param profileImage the profileImage value to set. - */ - @Generated - public MultiPartRequest(String id, ProfileImageFileDetails profileImage) { - this.id = id; - this.profileImage = profileImage; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the profileImage property: The profileImage property. - * - * @return the profileImage value. - */ - @Generated - public ProfileImageFileDetails getProfileImage() { - return this.profileImage; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PictureFileDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PictureFileDetails.java deleted file mode 100644 index 3ad2b8d4855..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PictureFileDetails.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; - -/** - * The file details for the "picture" field. - */ -@Fluent -public final class PictureFileDetails { - /* - * The content of the file. - */ - @Generated - private final BinaryData content; - - /* - * The filename of the file. - */ - @Generated - private String filename; - - /* - * The content-type of the file. - */ - @Generated - private String contentType = "application/octet-stream"; - - /** - * Creates an instance of PictureFileDetails class. - * - * @param content the content value to set. - */ - @Generated - public PictureFileDetails(BinaryData content) { - this.content = content; - } - - /** - * Get the content property: The content of the file. - * - * @return the content value. - */ - @Generated - public BinaryData getContent() { - return this.content; - } - - /** - * Get the filename property: The filename of the file. - * - * @return the filename value. - */ - @Generated - public String getFilename() { - return this.filename; - } - - /** - * Set the filename property: The filename of the file. - * - * @param filename the filename value to set. - * @return the PictureFileDetails object itself. - */ - @Generated - public PictureFileDetails setFilename(String filename) { - this.filename = filename; - return this; - } - - /** - * Get the contentType property: The content-type of the file. - * - * @return the contentType value. - */ - @Generated - public String getContentType() { - return this.contentType; - } - - /** - * Set the contentType property: The content-type of the file. - * - * @param contentType the contentType value to set. - * @return the PictureFileDetails object itself. - */ - @Generated - public PictureFileDetails setContentType(String contentType) { - this.contentType = contentType; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PicturesFileDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PicturesFileDetails.java deleted file mode 100644 index 039f01f7bf4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PicturesFileDetails.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; - -/** - * The file details for the "pictures" field. - */ -@Fluent -public final class PicturesFileDetails { - /* - * The content of the file. - */ - @Generated - private final BinaryData content; - - /* - * The filename of the file. - */ - @Generated - private String filename; - - /* - * The content-type of the file. - */ - @Generated - private String contentType = "application/octet-stream"; - - /** - * Creates an instance of PicturesFileDetails class. - * - * @param content the content value to set. - */ - @Generated - public PicturesFileDetails(BinaryData content) { - this.content = content; - } - - /** - * Get the content property: The content of the file. - * - * @return the content value. - */ - @Generated - public BinaryData getContent() { - return this.content; - } - - /** - * Get the filename property: The filename of the file. - * - * @return the filename value. - */ - @Generated - public String getFilename() { - return this.filename; - } - - /** - * Set the filename property: The filename of the file. - * - * @param filename the filename value to set. - * @return the PicturesFileDetails object itself. - */ - @Generated - public PicturesFileDetails setFilename(String filename) { - this.filename = filename; - return this; - } - - /** - * Get the contentType property: The content-type of the file. - * - * @return the contentType value. - */ - @Generated - public String getContentType() { - return this.contentType; - } - - /** - * Set the contentType property: The content-type of the file. - * - * @param contentType the contentType value to set. - * @return the PicturesFileDetails object itself. - */ - @Generated - public PicturesFileDetails setContentType(String contentType) { - this.contentType = contentType; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ProfileImageFileDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ProfileImageFileDetails.java deleted file mode 100644 index d36215a1566..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ProfileImageFileDetails.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; - -/** - * The file details for the "profileImage" field. - */ -@Fluent -public final class ProfileImageFileDetails { - /* - * The content of the file. - */ - @Generated - private final BinaryData content; - - /* - * The filename of the file. - */ - @Generated - private String filename; - - /* - * The content-type of the file. - */ - @Generated - private String contentType = "application/octet-stream"; - - /** - * Creates an instance of ProfileImageFileDetails class. - * - * @param content the content value to set. - */ - @Generated - public ProfileImageFileDetails(BinaryData content) { - this.content = content; - } - - /** - * Get the content property: The content of the file. - * - * @return the content value. - */ - @Generated - public BinaryData getContent() { - return this.content; - } - - /** - * Get the filename property: The filename of the file. - * - * @return the filename value. - */ - @Generated - public String getFilename() { - return this.filename; - } - - /** - * Set the filename property: The filename of the file. - * - * @param filename the filename value to set. - * @return the ProfileImageFileDetails object itself. - */ - @Generated - public ProfileImageFileDetails setFilename(String filename) { - this.filename = filename; - return this; - } - - /** - * Get the contentType property: The content-type of the file. - * - * @return the contentType value. - */ - @Generated - public String getContentType() { - return this.contentType; - } - - /** - * Set the contentType property: The content-type of the file. - * - * @param contentType the contentType value to set. - * @return the ProfileImageFileDetails object itself. - */ - @Generated - public ProfileImageFileDetails setContentType(String contentType) { - this.contentType = contentType; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/package-info.java deleted file mode 100644 index 2d4efd70032..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for MultiPart. - * Test for multipart. - * - */ -package payload.multipart.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/package-info.java deleted file mode 100644 index 96a48cfc53c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for MultiPart. - * Test for multipart. - * - */ -package payload.multipart; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenAsyncClient.java deleted file mode 100644 index c2890ccd4ca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenAsyncClient.java +++ /dev/null @@ -1,316 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package resiliency.servicedriven; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.Arrays; -import reactor.core.publisher.Mono; -import resiliency.servicedriven.implementation.ResiliencyServiceDrivenClientImpl; - -/** - * Initializes a new instance of the asynchronous ResiliencyServiceDrivenClient type. - */ -@ServiceClient(builder = ResiliencyServiceDrivenClientBuilder.class, isAsync = true) -public final class ResiliencyServiceDrivenAsyncClient { - @Generated - private final ResiliencyServiceDrivenClientImpl serviceClient; - - /** - * Initializes an instance of ResiliencyServiceDrivenAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ResiliencyServiceDrivenAsyncClient(ResiliencyServiceDrivenClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Added operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> addOperationWithResponse(RequestOptions requestOptions) { - return this.serviceClient.addOperationWithResponseAsync(requestOptions); - } - - /** - * Test that grew up from accepting no parameters to an optional input parameter. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromNoneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fromNoneWithResponseAsync(requestOptions); - } - - /** - * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional - * parameter. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param parameter I am a required parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromOneRequiredWithResponse(String parameter, RequestOptions requestOptions) { - return this.serviceClient.fromOneRequiredWithResponseAsync(parameter, requestOptions); - } - - /** - * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional - * parameters. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
new-parameterStringNoI'm a new input optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromOneOptionalWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fromOneOptionalWithResponseAsync(requestOptions); - } - - /** - * Added operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono addOperation() { - // Generated convenience method for addOperationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return addOperationWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test that grew up from accepting no parameters to an optional input parameter. - * - * @param newParameter I'm a new input optional parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fromNone(String newParameter) { - // Generated convenience method for fromNoneWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (!Arrays.asList("v2").contains(serviceClient.getServiceVersion().getVersion())) { - return Mono - .error(new IllegalArgumentException("Parameter newParameter is only available in api-version v2.")); - } - if (newParameter != null) { - requestOptions.addQueryParam("new-parameter", newParameter, false); - } - return fromNoneWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test that grew up from accepting no parameters to an optional input parameter. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fromNone() { - // Generated convenience method for fromNoneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fromNoneWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional - * parameter. - * - * @param parameter I am a required parameter. - * @param newParameter I'm a new input optional parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fromOneRequired(String parameter, String newParameter) { - // Generated convenience method for fromOneRequiredWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (!Arrays.asList("v2").contains(serviceClient.getServiceVersion().getVersion())) { - return Mono - .error(new IllegalArgumentException("Parameter newParameter is only available in api-version v2.")); - } - if (newParameter != null) { - requestOptions.addQueryParam("new-parameter", newParameter, false); - } - return fromOneRequiredWithResponse(parameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional - * parameter. - * - * @param parameter I am a required parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fromOneRequired(String parameter) { - // Generated convenience method for fromOneRequiredWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fromOneRequiredWithResponse(parameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional - * parameters. - * - * @param parameter I am an optional parameter. - * @param newParameter I'm a new input optional parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fromOneOptional(String parameter, String newParameter) { - // Generated convenience method for fromOneOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (!Arrays.asList("v2").contains(serviceClient.getServiceVersion().getVersion())) { - return Mono - .error(new IllegalArgumentException("Parameter newParameter is only available in api-version v2.")); - } - if (parameter != null) { - requestOptions.addQueryParam("parameter", parameter, false); - } - if (newParameter != null) { - requestOptions.addQueryParam("new-parameter", newParameter, false); - } - return fromOneOptionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional - * parameters. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fromOneOptional() { - // Generated convenience method for fromOneOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fromOneOptionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional - * parameters. - * - * @param parameter I am an optional parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fromOneOptional(String parameter) { - // Generated convenience method for fromOneOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (parameter != null) { - requestOptions.addQueryParam("parameter", parameter, false); - } - return fromOneOptionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClient.java deleted file mode 100644 index 44c7799e4be..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClient.java +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package resiliency.servicedriven; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.logging.ClientLogger; -import java.util.Arrays; -import resiliency.servicedriven.implementation.ResiliencyServiceDrivenClientImpl; - -/** - * Initializes a new instance of the synchronous ResiliencyServiceDrivenClient type. - */ -@ServiceClient(builder = ResiliencyServiceDrivenClientBuilder.class) -public final class ResiliencyServiceDrivenClient { - @Generated - private final ResiliencyServiceDrivenClientImpl serviceClient; - - /** - * Initializes an instance of ResiliencyServiceDrivenClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Added operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response addOperationWithResponse(RequestOptions requestOptions) { - return this.serviceClient.addOperationWithResponse(requestOptions); - } - - /** - * Test that grew up from accepting no parameters to an optional input parameter. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromNoneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fromNoneWithResponse(requestOptions); - } - - /** - * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional - * parameter. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param parameter I am a required parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromOneRequiredWithResponse(String parameter, RequestOptions requestOptions) { - return this.serviceClient.fromOneRequiredWithResponse(parameter, requestOptions); - } - - /** - * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional - * parameters. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
new-parameterStringNoI'm a new input optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromOneOptionalWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fromOneOptionalWithResponse(requestOptions); - } - - /** - * Added operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void addOperation() { - // Generated convenience method for addOperationWithResponse - RequestOptions requestOptions = new RequestOptions(); - addOperationWithResponse(requestOptions).getValue(); - } - - /** - * Test that grew up from accepting no parameters to an optional input parameter. - * - * @param newParameter I'm a new input optional parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fromNone(String newParameter) { - // Generated convenience method for fromNoneWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (!Arrays.asList("v2").contains(serviceClient.getServiceVersion().getVersion())) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter newParameter is only available in api-version v2.")); - } - if (newParameter != null) { - requestOptions.addQueryParam("new-parameter", newParameter, false); - } - fromNoneWithResponse(requestOptions).getValue(); - } - - /** - * Test that grew up from accepting no parameters to an optional input parameter. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fromNone() { - // Generated convenience method for fromNoneWithResponse - RequestOptions requestOptions = new RequestOptions(); - fromNoneWithResponse(requestOptions).getValue(); - } - - /** - * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional - * parameter. - * - * @param parameter I am a required parameter. - * @param newParameter I'm a new input optional parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fromOneRequired(String parameter, String newParameter) { - // Generated convenience method for fromOneRequiredWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (!Arrays.asList("v2").contains(serviceClient.getServiceVersion().getVersion())) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter newParameter is only available in api-version v2.")); - } - if (newParameter != null) { - requestOptions.addQueryParam("new-parameter", newParameter, false); - } - fromOneRequiredWithResponse(parameter, requestOptions).getValue(); - } - - /** - * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional - * parameter. - * - * @param parameter I am a required parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fromOneRequired(String parameter) { - // Generated convenience method for fromOneRequiredWithResponse - RequestOptions requestOptions = new RequestOptions(); - fromOneRequiredWithResponse(parameter, requestOptions).getValue(); - } - - /** - * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional - * parameters. - * - * @param parameter I am an optional parameter. - * @param newParameter I'm a new input optional parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fromOneOptional(String parameter, String newParameter) { - // Generated convenience method for fromOneOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (!Arrays.asList("v2").contains(serviceClient.getServiceVersion().getVersion())) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter newParameter is only available in api-version v2.")); - } - if (parameter != null) { - requestOptions.addQueryParam("parameter", parameter, false); - } - if (newParameter != null) { - requestOptions.addQueryParam("new-parameter", newParameter, false); - } - fromOneOptionalWithResponse(requestOptions).getValue(); - } - - /** - * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional - * parameters. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fromOneOptional() { - // Generated convenience method for fromOneOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - fromOneOptionalWithResponse(requestOptions).getValue(); - } - - /** - * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional - * parameters. - * - * @param parameter I am an optional parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fromOneOptional(String parameter) { - // Generated convenience method for fromOneOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (parameter != null) { - requestOptions.addQueryParam("parameter", parameter, false); - } - fromOneOptionalWithResponse(requestOptions).getValue(); - } - - private static final ClientLogger LOGGER = new ClientLogger(ResiliencyServiceDrivenClient.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClientBuilder.java deleted file mode 100644 index eeabb5665d0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClientBuilder.java +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package resiliency.servicedriven; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import resiliency.servicedriven.implementation.ResiliencyServiceDrivenClientImpl; - -/** - * A builder for creating a new instance of the ResiliencyServiceDrivenClient type. - */ -@ServiceClientBuilder( - serviceClients = { ResiliencyServiceDrivenClient.class, ResiliencyServiceDrivenAsyncClient.class }) -public final class ResiliencyServiceDrivenClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("resiliency-servicedriven.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ResiliencyServiceDrivenClientBuilder. - */ - @Generated - public ResiliencyServiceDrivenClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the - * deployment when the service had only one api version. 'v2' is for the deployment when the service had - * api-versions 'v1' and 'v2'. - */ - @Generated - private String serviceDeploymentVersion; - - /** - * Sets Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the - * deployment when the service had only one api version. 'v2' is for the deployment when the service had - * api-versions 'v1' and 'v2'. - * - * @param serviceDeploymentVersion the serviceDeploymentVersion value. - * @return the ResiliencyServiceDrivenClientBuilder. - */ - @Generated - public ResiliencyServiceDrivenClientBuilder serviceDeploymentVersion(String serviceDeploymentVersion) { - this.serviceDeploymentVersion = serviceDeploymentVersion; - return this; - } - - /* - * Service version - */ - @Generated - private ServiceDrivenServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the ResiliencyServiceDrivenClientBuilder. - */ - @Generated - public ResiliencyServiceDrivenClientBuilder serviceVersion(ServiceDrivenServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ResiliencyServiceDrivenClientBuilder. - */ - @Generated - public ResiliencyServiceDrivenClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ResiliencyServiceDrivenClientImpl with the provided parameters. - * - * @return an instance of ResiliencyServiceDrivenClientImpl. - */ - @Generated - private ResiliencyServiceDrivenClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - ServiceDrivenServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : ServiceDrivenServiceVersion.getLatest(); - ResiliencyServiceDrivenClientImpl client - = new ResiliencyServiceDrivenClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - this.endpoint, this.serviceDeploymentVersion, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - Objects.requireNonNull(serviceDeploymentVersion, "'serviceDeploymentVersion' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ResiliencyServiceDrivenAsyncClient class. - * - * @return an instance of ResiliencyServiceDrivenAsyncClient. - */ - @Generated - public ResiliencyServiceDrivenAsyncClient buildAsyncClient() { - return new ResiliencyServiceDrivenAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ResiliencyServiceDrivenClient class. - * - * @return an instance of ResiliencyServiceDrivenClient. - */ - @Generated - public ResiliencyServiceDrivenClient buildClient() { - return new ResiliencyServiceDrivenClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ResiliencyServiceDrivenClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ServiceDrivenServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ServiceDrivenServiceVersion.java deleted file mode 100644 index 737c82ce06a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ServiceDrivenServiceVersion.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package resiliency.servicedriven; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of ServiceDrivenClient. - */ -public enum ServiceDrivenServiceVersion implements ServiceVersion { - /** - * Enum value v1. - */ - V1("v1"), - - /** - * Enum value v2. - */ - V2("v2"); - - private final String version; - - ServiceDrivenServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link ServiceDrivenServiceVersion}. - */ - public static ServiceDrivenServiceVersion getLatest() { - return V2; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/ResiliencyServiceDrivenClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/ResiliencyServiceDrivenClientImpl.java deleted file mode 100644 index 54a4a34dda8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/ResiliencyServiceDrivenClientImpl.java +++ /dev/null @@ -1,440 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package resiliency.servicedriven.implementation; - -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Head; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; -import resiliency.servicedriven.ServiceDrivenServiceVersion; - -/** - * Initializes a new instance of the ResiliencyServiceDrivenClient type. - */ -public final class ResiliencyServiceDrivenClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ResiliencyServiceDrivenClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the - * deployment when the service had only one api version. 'v2' is for the deployment when the service had - * api-versions 'v1' and 'v2'. - */ - private final String serviceDeploymentVersion; - - /** - * Gets Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the - * deployment when the service had only one api version. 'v2' is for the deployment when the service had - * api-versions 'v1' and 'v2'. - * - * @return the serviceDeploymentVersion value. - */ - public String getServiceDeploymentVersion() { - return this.serviceDeploymentVersion; - } - - /** - * Service version. - */ - private final ServiceDrivenServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public ServiceDrivenServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of ResiliencyServiceDrivenClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceDeploymentVersion Pass in either 'v1' or 'v2'. This represents a version of the service deployment - * in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when - * the service had api-versions 'v1' and 'v2'. - * @param serviceVersion Service version. - */ - public ResiliencyServiceDrivenClientImpl(String endpoint, String serviceDeploymentVersion, - ServiceDrivenServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceDeploymentVersion, serviceVersion); - } - - /** - * Initializes an instance of ResiliencyServiceDrivenClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceDeploymentVersion Pass in either 'v1' or 'v2'. This represents a version of the service deployment - * in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when - * the service had api-versions 'v1' and 'v2'. - * @param serviceVersion Service version. - */ - public ResiliencyServiceDrivenClientImpl(HttpPipeline httpPipeline, String endpoint, - String serviceDeploymentVersion, ServiceDrivenServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceDeploymentVersion, - serviceVersion); - } - - /** - * Initializes an instance of ResiliencyServiceDrivenClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceDeploymentVersion Pass in either 'v1' or 'v2'. This represents a version of the service deployment - * in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when - * the service had api-versions 'v1' and 'v2'. - * @param serviceVersion Service version. - */ - public ResiliencyServiceDrivenClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint, String serviceDeploymentVersion, ServiceDrivenServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceDeploymentVersion = serviceDeploymentVersion; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(ResiliencyServiceDrivenClientService.class, this.httpPipeline, - this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ResiliencyServiceDrivenClient to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}/resiliency/service-driven/client:v2/service:{serviceDeploymentVersion}/api-version:{apiVersion}") - @ServiceInterface(name = "ResiliencyServiceDrivenClient") - public interface ResiliencyServiceDrivenClientService { - @Delete("/add-operation") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> addOperation(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Delete("/add-operation") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response addOperationSync(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Head("/add-optional-param/from-none") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> fromNone(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Head("/add-optional-param/from-none") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fromNoneSync(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Get("/add-optional-param/from-one-required") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> fromOneRequired(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, @QueryParam("parameter") String parameter, - RequestOptions requestOptions, Context context); - - @Get("/add-optional-param/from-one-required") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fromOneRequiredSync(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, @QueryParam("parameter") String parameter, - RequestOptions requestOptions, Context context); - - @Get("/add-optional-param/from-one-optional") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> fromOneOptional(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Get("/add-optional-param/from-one-optional") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fromOneOptionalSync(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - } - - /** - * Added operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> addOperationWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.addOperation(this.getEndpoint(), - this.getServiceDeploymentVersion(), this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * Added operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response addOperationWithResponse(RequestOptions requestOptions) { - return service.addOperationSync(this.getEndpoint(), this.getServiceDeploymentVersion(), - this.getServiceVersion().getVersion(), requestOptions, Context.NONE); - } - - /** - * Test that grew up from accepting no parameters to an optional input parameter. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromNoneWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.fromNone(this.getEndpoint(), this.getServiceDeploymentVersion(), - this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * Test that grew up from accepting no parameters to an optional input parameter. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromNoneWithResponse(RequestOptions requestOptions) { - return service.fromNoneSync(this.getEndpoint(), this.getServiceDeploymentVersion(), - this.getServiceVersion().getVersion(), requestOptions, Context.NONE); - } - - /** - * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional - * parameter. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param parameter I am a required parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromOneRequiredWithResponseAsync(String parameter, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.fromOneRequired(this.getEndpoint(), this.getServiceDeploymentVersion(), - this.getServiceVersion().getVersion(), parameter, requestOptions, context)); - } - - /** - * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional - * parameter. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param parameter I am a required parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromOneRequiredWithResponse(String parameter, RequestOptions requestOptions) { - return service.fromOneRequiredSync(this.getEndpoint(), this.getServiceDeploymentVersion(), - this.getServiceVersion().getVersion(), parameter, requestOptions, Context.NONE); - } - - /** - * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional - * parameters. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
new-parameterStringNoI'm a new input optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromOneOptionalWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.fromOneOptional(this.getEndpoint(), - this.getServiceDeploymentVersion(), this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional - * parameters. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
new-parameterStringNoI'm a new input optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromOneOptionalWithResponse(RequestOptions requestOptions) { - return service.fromOneOptionalSync(this.getEndpoint(), this.getServiceDeploymentVersion(), - this.getServiceVersion().getVersion(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/package-info.java deleted file mode 100644 index 5f83b7325a6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ServiceDriven. - * Test that we can grow up a service spec and service deployment into a multi-versioned service with full client - * support. - * - * There are three concepts that should be clarified: - * 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp - * and 'v2' is a client generated from main.tsp. - * 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment - * of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions - * 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the - * service supports api versions 'v1' and 'v2'. - * - * We test the following configurations from this service spec: - * - A client generated from the second service spec can call the second deployment of a service with api version v1 - * - A client generated from the second service spec can call the second deployment of a service with api version v2. - * - */ -package resiliency.servicedriven.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/package-info.java deleted file mode 100644 index 7eb9f03cbc1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ServiceDriven. - * Test that we can grow up a service spec and service deployment into a multi-versioned service with full client - * support. - * - * There are three concepts that should be clarified: - * 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp - * and 'v2' is a client generated from main.tsp. - * 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment - * of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions - * 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the - * service supports api versions 'v1' and 'v2'. - * - * We test the following configurations from this service spec: - * - A client generated from the second service spec can call the second deployment of a service with api version v1 - * - A client generated from the second service spec can call the second deployment of a service with api version v2. - * - */ -package resiliency.servicedriven; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenAsyncClient.java deleted file mode 100644 index a6dc12520e1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenAsyncClient.java +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package resiliency.servicedriven.v1; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import resiliency.servicedriven.v1.implementation.ResiliencyServiceDrivenClientImpl; - -/** - * Initializes a new instance of the asynchronous ResiliencyServiceDrivenClient type. - */ -@ServiceClient(builder = ResiliencyServiceDrivenClientBuilder.class, isAsync = true) -public final class ResiliencyServiceDrivenAsyncClient { - @Generated - private final ResiliencyServiceDrivenClientImpl serviceClient; - - /** - * Initializes an instance of ResiliencyServiceDrivenAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ResiliencyServiceDrivenAsyncClient(ResiliencyServiceDrivenClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as - * well. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromNoneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fromNoneWithResponseAsync(requestOptions); - } - - /** - * Test that currently accepts one required parameter, will be updated in next spec to accept a new optional - * parameter as well. - * - * @param parameter I am a required parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromOneRequiredWithResponse(String parameter, RequestOptions requestOptions) { - return this.serviceClient.fromOneRequiredWithResponseAsync(parameter, requestOptions); - } - - /** - * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional - * parameter as well. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromOneOptionalWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fromOneOptionalWithResponseAsync(requestOptions); - } - - /** - * Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as - * well. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fromNone() { - // Generated convenience method for fromNoneWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fromNoneWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test that currently accepts one required parameter, will be updated in next spec to accept a new optional - * parameter as well. - * - * @param parameter I am a required parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fromOneRequired(String parameter) { - // Generated convenience method for fromOneRequiredWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fromOneRequiredWithResponse(parameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional - * parameter as well. - * - * @param parameter I am an optional parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fromOneOptional(String parameter) { - // Generated convenience method for fromOneOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (parameter != null) { - requestOptions.addQueryParam("parameter", parameter, false); - } - return fromOneOptionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional - * parameter as well. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fromOneOptional() { - // Generated convenience method for fromOneOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fromOneOptionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClient.java deleted file mode 100644 index c810728417e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClient.java +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package resiliency.servicedriven.v1; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import resiliency.servicedriven.v1.implementation.ResiliencyServiceDrivenClientImpl; - -/** - * Initializes a new instance of the synchronous ResiliencyServiceDrivenClient type. - */ -@ServiceClient(builder = ResiliencyServiceDrivenClientBuilder.class) -public final class ResiliencyServiceDrivenClient { - @Generated - private final ResiliencyServiceDrivenClientImpl serviceClient; - - /** - * Initializes an instance of ResiliencyServiceDrivenClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as - * well. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromNoneWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fromNoneWithResponse(requestOptions); - } - - /** - * Test that currently accepts one required parameter, will be updated in next spec to accept a new optional - * parameter as well. - * - * @param parameter I am a required parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromOneRequiredWithResponse(String parameter, RequestOptions requestOptions) { - return this.serviceClient.fromOneRequiredWithResponse(parameter, requestOptions); - } - - /** - * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional - * parameter as well. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromOneOptionalWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fromOneOptionalWithResponse(requestOptions); - } - - /** - * Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as - * well. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fromNone() { - // Generated convenience method for fromNoneWithResponse - RequestOptions requestOptions = new RequestOptions(); - fromNoneWithResponse(requestOptions).getValue(); - } - - /** - * Test that currently accepts one required parameter, will be updated in next spec to accept a new optional - * parameter as well. - * - * @param parameter I am a required parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fromOneRequired(String parameter) { - // Generated convenience method for fromOneRequiredWithResponse - RequestOptions requestOptions = new RequestOptions(); - fromOneRequiredWithResponse(parameter, requestOptions).getValue(); - } - - /** - * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional - * parameter as well. - * - * @param parameter I am an optional parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fromOneOptional(String parameter) { - // Generated convenience method for fromOneOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (parameter != null) { - requestOptions.addQueryParam("parameter", parameter, false); - } - fromOneOptionalWithResponse(requestOptions).getValue(); - } - - /** - * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional - * parameter as well. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fromOneOptional() { - // Generated convenience method for fromOneOptionalWithResponse - RequestOptions requestOptions = new RequestOptions(); - fromOneOptionalWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClientBuilder.java deleted file mode 100644 index 90c7b5cf246..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClientBuilder.java +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package resiliency.servicedriven.v1; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import resiliency.servicedriven.v1.implementation.ResiliencyServiceDrivenClientImpl; - -/** - * A builder for creating a new instance of the ResiliencyServiceDrivenClient type. - */ -@ServiceClientBuilder( - serviceClients = { ResiliencyServiceDrivenClient.class, ResiliencyServiceDrivenAsyncClient.class }) -public final class ResiliencyServiceDrivenClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("resiliency-servicedriven-v1.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ResiliencyServiceDrivenClientBuilder. - */ - @Generated - public ResiliencyServiceDrivenClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResiliencyServiceDrivenClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the - * deployment when the service had only one api version. 'v2' is for the deployment when the service had - * api-versions 'v1' and 'v2'. - */ - @Generated - private String serviceDeploymentVersion; - - /** - * Sets Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the - * deployment when the service had only one api version. 'v2' is for the deployment when the service had - * api-versions 'v1' and 'v2'. - * - * @param serviceDeploymentVersion the serviceDeploymentVersion value. - * @return the ResiliencyServiceDrivenClientBuilder. - */ - @Generated - public ResiliencyServiceDrivenClientBuilder serviceDeploymentVersion(String serviceDeploymentVersion) { - this.serviceDeploymentVersion = serviceDeploymentVersion; - return this; - } - - /* - * Service version - */ - @Generated - private ServiceDrivenServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the ResiliencyServiceDrivenClientBuilder. - */ - @Generated - public ResiliencyServiceDrivenClientBuilder serviceVersion(ServiceDrivenServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ResiliencyServiceDrivenClientBuilder. - */ - @Generated - public ResiliencyServiceDrivenClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ResiliencyServiceDrivenClientImpl with the provided parameters. - * - * @return an instance of ResiliencyServiceDrivenClientImpl. - */ - @Generated - private ResiliencyServiceDrivenClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - ServiceDrivenServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : ServiceDrivenServiceVersion.getLatest(); - ResiliencyServiceDrivenClientImpl client - = new ResiliencyServiceDrivenClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - this.endpoint, this.serviceDeploymentVersion, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - Objects.requireNonNull(serviceDeploymentVersion, "'serviceDeploymentVersion' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ResiliencyServiceDrivenAsyncClient class. - * - * @return an instance of ResiliencyServiceDrivenAsyncClient. - */ - @Generated - public ResiliencyServiceDrivenAsyncClient buildAsyncClient() { - return new ResiliencyServiceDrivenAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ResiliencyServiceDrivenClient class. - * - * @return an instance of ResiliencyServiceDrivenClient. - */ - @Generated - public ResiliencyServiceDrivenClient buildClient() { - return new ResiliencyServiceDrivenClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ResiliencyServiceDrivenClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ServiceDrivenServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ServiceDrivenServiceVersion.java deleted file mode 100644 index b154f887b77..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ServiceDrivenServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package resiliency.servicedriven.v1; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of ServiceDrivenClient. - */ -public enum ServiceDrivenServiceVersion implements ServiceVersion { - /** - * Enum value v1. - */ - V1("v1"); - - private final String version; - - ServiceDrivenServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link ServiceDrivenServiceVersion}. - */ - public static ServiceDrivenServiceVersion getLatest() { - return V1; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/ResiliencyServiceDrivenClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/ResiliencyServiceDrivenClientImpl.java deleted file mode 100644 index 738bcdc4c8d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/ResiliencyServiceDrivenClientImpl.java +++ /dev/null @@ -1,359 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package resiliency.servicedriven.v1.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Head; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; -import resiliency.servicedriven.v1.ServiceDrivenServiceVersion; - -/** - * Initializes a new instance of the ResiliencyServiceDrivenClient type. - */ -public final class ResiliencyServiceDrivenClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ResiliencyServiceDrivenClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the - * deployment when the service had only one api version. 'v2' is for the deployment when the service had - * api-versions 'v1' and 'v2'. - */ - private final String serviceDeploymentVersion; - - /** - * Gets Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the - * deployment when the service had only one api version. 'v2' is for the deployment when the service had - * api-versions 'v1' and 'v2'. - * - * @return the serviceDeploymentVersion value. - */ - public String getServiceDeploymentVersion() { - return this.serviceDeploymentVersion; - } - - /** - * Service version. - */ - private final ServiceDrivenServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public ServiceDrivenServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of ResiliencyServiceDrivenClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceDeploymentVersion Pass in either 'v1' or 'v2'. This represents a version of the service deployment - * in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when - * the service had api-versions 'v1' and 'v2'. - * @param serviceVersion Service version. - */ - public ResiliencyServiceDrivenClientImpl(String endpoint, String serviceDeploymentVersion, - ServiceDrivenServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceDeploymentVersion, serviceVersion); - } - - /** - * Initializes an instance of ResiliencyServiceDrivenClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceDeploymentVersion Pass in either 'v1' or 'v2'. This represents a version of the service deployment - * in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when - * the service had api-versions 'v1' and 'v2'. - * @param serviceVersion Service version. - */ - public ResiliencyServiceDrivenClientImpl(HttpPipeline httpPipeline, String endpoint, - String serviceDeploymentVersion, ServiceDrivenServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceDeploymentVersion, - serviceVersion); - } - - /** - * Initializes an instance of ResiliencyServiceDrivenClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceDeploymentVersion Pass in either 'v1' or 'v2'. This represents a version of the service deployment - * in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when - * the service had api-versions 'v1' and 'v2'. - * @param serviceVersion Service version. - */ - public ResiliencyServiceDrivenClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint, String serviceDeploymentVersion, ServiceDrivenServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceDeploymentVersion = serviceDeploymentVersion; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(ResiliencyServiceDrivenClientService.class, this.httpPipeline, - this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ResiliencyServiceDrivenClient to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}/resiliency/service-driven/client:v1/service:{serviceDeploymentVersion}/api-version:{apiVersion}") - @ServiceInterface(name = "ResiliencyServiceDrivenClient") - public interface ResiliencyServiceDrivenClientService { - @Head("/add-optional-param/from-none") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> fromNone(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Head("/add-optional-param/from-none") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fromNoneSync(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Get("/add-optional-param/from-one-required") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> fromOneRequired(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, @QueryParam("parameter") String parameter, - RequestOptions requestOptions, Context context); - - @Get("/add-optional-param/from-one-required") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fromOneRequiredSync(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, @QueryParam("parameter") String parameter, - RequestOptions requestOptions, Context context); - - @Get("/add-optional-param/from-one-optional") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> fromOneOptional(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Get("/add-optional-param/from-one-optional") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fromOneOptionalSync(@HostParam("endpoint") String endpoint, - @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, - @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - } - - /** - * Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as - * well. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromNoneWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.fromNone(this.getEndpoint(), this.getServiceDeploymentVersion(), - this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as - * well. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromNoneWithResponse(RequestOptions requestOptions) { - return service.fromNoneSync(this.getEndpoint(), this.getServiceDeploymentVersion(), - this.getServiceVersion().getVersion(), requestOptions, Context.NONE); - } - - /** - * Test that currently accepts one required parameter, will be updated in next spec to accept a new optional - * parameter as well. - * - * @param parameter I am a required parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromOneRequiredWithResponseAsync(String parameter, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.fromOneRequired(this.getEndpoint(), this.getServiceDeploymentVersion(), - this.getServiceVersion().getVersion(), parameter, requestOptions, context)); - } - - /** - * Test that currently accepts one required parameter, will be updated in next spec to accept a new optional - * parameter as well. - * - * @param parameter I am a required parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromOneRequiredWithResponse(String parameter, RequestOptions requestOptions) { - return service.fromOneRequiredSync(this.getEndpoint(), this.getServiceDeploymentVersion(), - this.getServiceVersion().getVersion(), parameter, requestOptions, Context.NONE); - } - - /** - * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional - * parameter as well. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromOneOptionalWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.fromOneOptional(this.getEndpoint(), - this.getServiceDeploymentVersion(), this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional - * parameter as well. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromOneOptionalWithResponse(RequestOptions requestOptions) { - return service.fromOneOptionalSync(this.getEndpoint(), this.getServiceDeploymentVersion(), - this.getServiceVersion().getVersion(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/package-info.java deleted file mode 100644 index 7311849a931..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/package-info.java +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ServiceDriven. - * Test that we can grow up a service spec and service deployment into a multi-versioned service with full client - * support. - * - */ -package resiliency.servicedriven.v1.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/package-info.java deleted file mode 100644 index 54930ad990f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/package-info.java +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ServiceDriven. - * Test that we can grow up a service spec and service deployment into a multi-versioned service with full client - * support. - * - */ -package resiliency.servicedriven.v1; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeAsyncClient.java deleted file mode 100644 index 7d23753604f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeAsyncClient.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package response.statuscoderange; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import response.statuscoderange.implementation.StatusCodeRangeClientImpl; - -/** - * Initializes a new instance of the asynchronous StatusCodeRangeClient type. - */ -@ServiceClient(builder = StatusCodeRangeClientBuilder.class, isAsync = true) -public final class StatusCodeRangeAsyncClient { - @Generated - private final StatusCodeRangeClientImpl serviceClient; - - /** - * Initializes an instance of StatusCodeRangeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StatusCodeRangeAsyncClient(StatusCodeRangeClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The errorResponseStatusCodeInRange operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> errorResponseStatusCodeInRangeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.errorResponseStatusCodeInRangeWithResponseAsync(requestOptions); - } - - /** - * The errorResponseStatusCode404 operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> errorResponseStatusCode404WithResponse(RequestOptions requestOptions) { - return this.serviceClient.errorResponseStatusCode404WithResponseAsync(requestOptions); - } - - /** - * The errorResponseStatusCodeInRange operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono errorResponseStatusCodeInRange() { - // Generated convenience method for errorResponseStatusCodeInRangeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return errorResponseStatusCodeInRangeWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The errorResponseStatusCode404 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono errorResponseStatusCode404() { - // Generated convenience method for errorResponseStatusCode404WithResponse - RequestOptions requestOptions = new RequestOptions(); - return errorResponseStatusCode404WithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClient.java deleted file mode 100644 index 138d7b1e1dc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClient.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package response.statuscoderange; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import response.statuscoderange.implementation.StatusCodeRangeClientImpl; - -/** - * Initializes a new instance of the synchronous StatusCodeRangeClient type. - */ -@ServiceClient(builder = StatusCodeRangeClientBuilder.class) -public final class StatusCodeRangeClient { - @Generated - private final StatusCodeRangeClientImpl serviceClient; - - /** - * Initializes an instance of StatusCodeRangeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StatusCodeRangeClient(StatusCodeRangeClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The errorResponseStatusCodeInRange operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response errorResponseStatusCodeInRangeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.errorResponseStatusCodeInRangeWithResponse(requestOptions); - } - - /** - * The errorResponseStatusCode404 operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response errorResponseStatusCode404WithResponse(RequestOptions requestOptions) { - return this.serviceClient.errorResponseStatusCode404WithResponse(requestOptions); - } - - /** - * The errorResponseStatusCodeInRange operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void errorResponseStatusCodeInRange() { - // Generated convenience method for errorResponseStatusCodeInRangeWithResponse - RequestOptions requestOptions = new RequestOptions(); - errorResponseStatusCodeInRangeWithResponse(requestOptions).getValue(); - } - - /** - * The errorResponseStatusCode404 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void errorResponseStatusCode404() { - // Generated convenience method for errorResponseStatusCode404WithResponse - RequestOptions requestOptions = new RequestOptions(); - errorResponseStatusCode404WithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClientBuilder.java deleted file mode 100644 index ff02f0e698b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package response.statuscoderange; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import response.statuscoderange.implementation.StatusCodeRangeClientImpl; - -/** - * A builder for creating a new instance of the StatusCodeRangeClient type. - */ -@ServiceClientBuilder(serviceClients = { StatusCodeRangeClient.class, StatusCodeRangeAsyncClient.class }) -public final class StatusCodeRangeClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("response-statuscoderange.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the StatusCodeRangeClientBuilder. - */ - @Generated - public StatusCodeRangeClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StatusCodeRangeClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StatusCodeRangeClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StatusCodeRangeClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StatusCodeRangeClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StatusCodeRangeClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StatusCodeRangeClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StatusCodeRangeClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public StatusCodeRangeClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the StatusCodeRangeClientBuilder. - */ - @Generated - public StatusCodeRangeClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of StatusCodeRangeClientImpl with the provided parameters. - * - * @return an instance of StatusCodeRangeClientImpl. - */ - @Generated - private StatusCodeRangeClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - StatusCodeRangeClientImpl client = new StatusCodeRangeClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of StatusCodeRangeAsyncClient class. - * - * @return an instance of StatusCodeRangeAsyncClient. - */ - @Generated - public StatusCodeRangeAsyncClient buildAsyncClient() { - return new StatusCodeRangeAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of StatusCodeRangeClient class. - * - * @return an instance of StatusCodeRangeClient. - */ - @Generated - public StatusCodeRangeClient buildClient() { - return new StatusCodeRangeClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(StatusCodeRangeClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/StatusCodeRangeClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/StatusCodeRangeClientImpl.java deleted file mode 100644 index ce8cf3030fa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/StatusCodeRangeClientImpl.java +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package response.statuscoderange.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the StatusCodeRangeClient type. - */ -public final class StatusCodeRangeClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StatusCodeRangeClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of StatusCodeRangeClient client. - * - * @param endpoint Service host. - */ - public StatusCodeRangeClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of StatusCodeRangeClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public StatusCodeRangeClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of StatusCodeRangeClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public StatusCodeRangeClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(StatusCodeRangeClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for StatusCodeRangeClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "StatusCodeRangeClient") - public interface StatusCodeRangeClientService { - @Get("/response/status-code-range/error-response-status-code-in-range") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> errorResponseStatusCodeInRange(@HostParam("endpoint") String endpoint, - RequestOptions requestOptions, Context context); - - @Get("/response/status-code-range/error-response-status-code-in-range") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response errorResponseStatusCodeInRangeSync(@HostParam("endpoint") String endpoint, - RequestOptions requestOptions, Context context); - - @Get("/response/status-code-range/error-response-status-code-404") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> errorResponseStatusCode404(@HostParam("endpoint") String endpoint, - RequestOptions requestOptions, Context context); - - @Get("/response/status-code-range/error-response-status-code-404") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response errorResponseStatusCode404Sync(@HostParam("endpoint") String endpoint, - RequestOptions requestOptions, Context context); - } - - /** - * The errorResponseStatusCodeInRange operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> errorResponseStatusCodeInRangeWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.errorResponseStatusCodeInRange(this.getEndpoint(), requestOptions, context)); - } - - /** - * The errorResponseStatusCodeInRange operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response errorResponseStatusCodeInRangeWithResponse(RequestOptions requestOptions) { - return service.errorResponseStatusCodeInRangeSync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The errorResponseStatusCode404 operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> errorResponseStatusCode404WithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.errorResponseStatusCode404(this.getEndpoint(), requestOptions, context)); - } - - /** - * The errorResponseStatusCode404 operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response errorResponseStatusCode404WithResponse(RequestOptions requestOptions) { - return service.errorResponseStatusCode404Sync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/package-info.java deleted file mode 100644 index 55549a1fa0b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for StatusCodeRange. - * Test for range of status code. - * - */ -package response.statuscoderange.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/package-info.java deleted file mode 100644 index 671243840d0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for StatusCodeRange. - * Test for range of status code. - * - */ -package response.statuscoderange; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceAsyncClient.java deleted file mode 100644 index 2d87c4f597b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import routes.implementation.InInterfacesImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class InInterfaceAsyncClient { - @Generated - private final InInterfacesImpl serviceClient; - - /** - * Initializes an instance of InInterfaceAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - InInterfaceAsyncClient(InInterfacesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The fixed operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fixedWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fixedWithResponseAsync(requestOptions); - } - - /** - * The fixed operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fixed() { - // Generated convenience method for fixedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fixedWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceClient.java deleted file mode 100644 index bde2701511b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import routes.implementation.InInterfacesImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class InInterfaceClient { - @Generated - private final InInterfacesImpl serviceClient; - - /** - * Initializes an instance of InInterfaceClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - InInterfaceClient(InInterfacesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The fixed operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fixedWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fixedWithResponse(requestOptions); - } - - /** - * The fixed operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fixed() { - // Generated convenience method for fixedWithResponse - RequestOptions requestOptions = new RequestOptions(); - fixedWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersAsyncClient.java deleted file mode 100644 index 08f362adf26..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersAsyncClient.java +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import routes.implementation.PathParametersImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class PathParametersAsyncClient { - @Generated - private final PathParametersImpl serviceClient; - - /** - * Initializes an instance of PathParametersAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersAsyncClient(PathParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The templateOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> templateOnlyWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.templateOnlyWithResponseAsync(param, requestOptions); - } - - /** - * The explicit operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> explicitWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.explicitWithResponseAsync(param, requestOptions); - } - - /** - * The annotationOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> annotationOnlyWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.annotationOnlyWithResponseAsync(param, requestOptions); - } - - /** - * The templateOnly operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono templateOnly(String param) { - // Generated convenience method for templateOnlyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return templateOnlyWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The explicit operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono explicit(String param) { - // Generated convenience method for explicitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return explicitWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The annotationOnly operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono annotationOnly(String param) { - // Generated convenience method for annotationOnlyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return annotationOnlyWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersClient.java deleted file mode 100644 index 2c0a9d307d9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersClient.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import routes.implementation.PathParametersImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class PathParametersClient { - @Generated - private final PathParametersImpl serviceClient; - - /** - * Initializes an instance of PathParametersClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersClient(PathParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The templateOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response templateOnlyWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.templateOnlyWithResponse(param, requestOptions); - } - - /** - * The explicit operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response explicitWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.explicitWithResponse(param, requestOptions); - } - - /** - * The annotationOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response annotationOnlyWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.annotationOnlyWithResponse(param, requestOptions); - } - - /** - * The templateOnly operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void templateOnly(String param) { - // Generated convenience method for templateOnlyWithResponse - RequestOptions requestOptions = new RequestOptions(); - templateOnlyWithResponse(param, requestOptions).getValue(); - } - - /** - * The explicit operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void explicit(String param) { - // Generated convenience method for explicitWithResponse - RequestOptions requestOptions = new RequestOptions(); - explicitWithResponse(param, requestOptions).getValue(); - } - - /** - * The annotationOnly operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void annotationOnly(String param) { - // Generated convenience method for annotationOnlyWithResponse - RequestOptions requestOptions = new RequestOptions(); - annotationOnlyWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeAsyncClient.java deleted file mode 100644 index 677c05b697f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeAsyncClient.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Mono; -import routes.implementation.PathParametersLabelExpansionExplodesImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class PathParametersLabelExpansionExplodeAsyncClient { - @Generated - private final PathParametersLabelExpansionExplodesImpl serviceClient; - - /** - * Initializes an instance of PathParametersLabelExpansionExplodeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersLabelExpansionExplodeAsyncClient(PathParametersLabelExpansionExplodesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponseAsync(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponseAsync(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeClient.java deleted file mode 100644 index 2086edeb4ee..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import java.util.Map; -import routes.implementation.PathParametersLabelExpansionExplodesImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class PathParametersLabelExpansionExplodeClient { - @Generated - private final PathParametersLabelExpansionExplodesImpl serviceClient; - - /** - * Initializes an instance of PathParametersLabelExpansionExplodeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersLabelExpansionExplodeClient(PathParametersLabelExpansionExplodesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponse(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponse(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponse(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - primitiveWithResponse(param, requestOptions).getValue(); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - arrayWithResponse(param, requestOptions).getValue(); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - recordWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardAsyncClient.java deleted file mode 100644 index 9f32721b34b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardAsyncClient.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Mono; -import routes.implementation.PathParametersLabelExpansionStandardsImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class PathParametersLabelExpansionStandardAsyncClient { - @Generated - private final PathParametersLabelExpansionStandardsImpl serviceClient; - - /** - * Initializes an instance of PathParametersLabelExpansionStandardAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersLabelExpansionStandardAsyncClient(PathParametersLabelExpansionStandardsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponseAsync(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponseAsync(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardClient.java deleted file mode 100644 index 30731fb1bb1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import java.util.Map; -import routes.implementation.PathParametersLabelExpansionStandardsImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class PathParametersLabelExpansionStandardClient { - @Generated - private final PathParametersLabelExpansionStandardsImpl serviceClient; - - /** - * Initializes an instance of PathParametersLabelExpansionStandardClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersLabelExpansionStandardClient(PathParametersLabelExpansionStandardsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponse(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponse(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponse(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - primitiveWithResponse(param, requestOptions).getValue(); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - arrayWithResponse(param, requestOptions).getValue(); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - recordWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeAsyncClient.java deleted file mode 100644 index 4ffa11efc10..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeAsyncClient.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Mono; -import routes.implementation.PathParametersMatrixExpansionExplodesImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class PathParametersMatrixExpansionExplodeAsyncClient { - @Generated - private final PathParametersMatrixExpansionExplodesImpl serviceClient; - - /** - * Initializes an instance of PathParametersMatrixExpansionExplodeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersMatrixExpansionExplodeAsyncClient(PathParametersMatrixExpansionExplodesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponseAsync(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponseAsync(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeClient.java deleted file mode 100644 index 8c6f498f62e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import java.util.Map; -import routes.implementation.PathParametersMatrixExpansionExplodesImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class PathParametersMatrixExpansionExplodeClient { - @Generated - private final PathParametersMatrixExpansionExplodesImpl serviceClient; - - /** - * Initializes an instance of PathParametersMatrixExpansionExplodeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersMatrixExpansionExplodeClient(PathParametersMatrixExpansionExplodesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponse(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponse(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponse(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - primitiveWithResponse(param, requestOptions).getValue(); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - arrayWithResponse(param, requestOptions).getValue(); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - recordWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardAsyncClient.java deleted file mode 100644 index 22ac90ff860..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardAsyncClient.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Mono; -import routes.implementation.PathParametersMatrixExpansionStandardsImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class PathParametersMatrixExpansionStandardAsyncClient { - @Generated - private final PathParametersMatrixExpansionStandardsImpl serviceClient; - - /** - * Initializes an instance of PathParametersMatrixExpansionStandardAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersMatrixExpansionStandardAsyncClient(PathParametersMatrixExpansionStandardsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponseAsync(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponseAsync(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardClient.java deleted file mode 100644 index 8d4480b32ec..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import java.util.Map; -import routes.implementation.PathParametersMatrixExpansionStandardsImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class PathParametersMatrixExpansionStandardClient { - @Generated - private final PathParametersMatrixExpansionStandardsImpl serviceClient; - - /** - * Initializes an instance of PathParametersMatrixExpansionStandardClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersMatrixExpansionStandardClient(PathParametersMatrixExpansionStandardsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponse(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponse(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponse(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - primitiveWithResponse(param, requestOptions).getValue(); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - arrayWithResponse(param, requestOptions).getValue(); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - recordWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeAsyncClient.java deleted file mode 100644 index 3ce17131340..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeAsyncClient.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Mono; -import routes.implementation.PathParametersPathExpansionExplodesImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class PathParametersPathExpansionExplodeAsyncClient { - @Generated - private final PathParametersPathExpansionExplodesImpl serviceClient; - - /** - * Initializes an instance of PathParametersPathExpansionExplodeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersPathExpansionExplodeAsyncClient(PathParametersPathExpansionExplodesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponseAsync(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponseAsync(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeClient.java deleted file mode 100644 index d1c98ee0caf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import java.util.Map; -import routes.implementation.PathParametersPathExpansionExplodesImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class PathParametersPathExpansionExplodeClient { - @Generated - private final PathParametersPathExpansionExplodesImpl serviceClient; - - /** - * Initializes an instance of PathParametersPathExpansionExplodeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersPathExpansionExplodeClient(PathParametersPathExpansionExplodesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponse(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponse(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponse(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - primitiveWithResponse(param, requestOptions).getValue(); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - arrayWithResponse(param, requestOptions).getValue(); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - recordWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardAsyncClient.java deleted file mode 100644 index df4adba481b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardAsyncClient.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Mono; -import routes.implementation.PathParametersPathExpansionStandardsImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class PathParametersPathExpansionStandardAsyncClient { - @Generated - private final PathParametersPathExpansionStandardsImpl serviceClient; - - /** - * Initializes an instance of PathParametersPathExpansionStandardAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersPathExpansionStandardAsyncClient(PathParametersPathExpansionStandardsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponseAsync(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponseAsync(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardClient.java deleted file mode 100644 index 01cf42726ab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import java.util.Map; -import routes.implementation.PathParametersPathExpansionStandardsImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class PathParametersPathExpansionStandardClient { - @Generated - private final PathParametersPathExpansionStandardsImpl serviceClient; - - /** - * Initializes an instance of PathParametersPathExpansionStandardClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersPathExpansionStandardClient(PathParametersPathExpansionStandardsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponse(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponse(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponse(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - primitiveWithResponse(param, requestOptions).getValue(); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - arrayWithResponse(param, requestOptions).getValue(); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - recordWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionAsyncClient.java deleted file mode 100644 index 1648d254406..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionAsyncClient.java +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import routes.implementation.PathParametersReservedExpansionsImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class PathParametersReservedExpansionAsyncClient { - @Generated - private final PathParametersReservedExpansionsImpl serviceClient; - - /** - * Initializes an instance of PathParametersReservedExpansionAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersReservedExpansionAsyncClient(PathParametersReservedExpansionsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The template operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> templateWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.templateWithResponseAsync(param, requestOptions); - } - - /** - * The annotation operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> annotationWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.annotationWithResponseAsync(param, requestOptions); - } - - /** - * The template operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono template(String param) { - // Generated convenience method for templateWithResponse - RequestOptions requestOptions = new RequestOptions(); - return templateWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The annotation operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono annotation(String param) { - // Generated convenience method for annotationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return annotationWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionClient.java deleted file mode 100644 index db3f7e09ac9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionClient.java +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import routes.implementation.PathParametersReservedExpansionsImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class PathParametersReservedExpansionClient { - @Generated - private final PathParametersReservedExpansionsImpl serviceClient; - - /** - * Initializes an instance of PathParametersReservedExpansionClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersReservedExpansionClient(PathParametersReservedExpansionsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The template operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response templateWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.templateWithResponse(param, requestOptions); - } - - /** - * The annotation operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response annotationWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.annotationWithResponse(param, requestOptions); - } - - /** - * The template operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void template(String param) { - // Generated convenience method for templateWithResponse - RequestOptions requestOptions = new RequestOptions(); - templateWithResponse(param, requestOptions).getValue(); - } - - /** - * The annotation operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void annotation(String param) { - // Generated convenience method for annotationWithResponse - RequestOptions requestOptions = new RequestOptions(); - annotationWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeAsyncClient.java deleted file mode 100644 index 397536e5152..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeAsyncClient.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Mono; -import routes.implementation.PathParametersSimpleExpansionExplodesImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class PathParametersSimpleExpansionExplodeAsyncClient { - @Generated - private final PathParametersSimpleExpansionExplodesImpl serviceClient; - - /** - * Initializes an instance of PathParametersSimpleExpansionExplodeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersSimpleExpansionExplodeAsyncClient(PathParametersSimpleExpansionExplodesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponseAsync(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponseAsync(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeClient.java deleted file mode 100644 index 78f36c391c3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import java.util.Map; -import routes.implementation.PathParametersSimpleExpansionExplodesImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class PathParametersSimpleExpansionExplodeClient { - @Generated - private final PathParametersSimpleExpansionExplodesImpl serviceClient; - - /** - * Initializes an instance of PathParametersSimpleExpansionExplodeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersSimpleExpansionExplodeClient(PathParametersSimpleExpansionExplodesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponse(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponse(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponse(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - primitiveWithResponse(param, requestOptions).getValue(); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - arrayWithResponse(param, requestOptions).getValue(); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - recordWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardAsyncClient.java deleted file mode 100644 index 24efff8daba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardAsyncClient.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Mono; -import routes.implementation.PathParametersSimpleExpansionStandardsImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class PathParametersSimpleExpansionStandardAsyncClient { - @Generated - private final PathParametersSimpleExpansionStandardsImpl serviceClient; - - /** - * Initializes an instance of PathParametersSimpleExpansionStandardAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersSimpleExpansionStandardAsyncClient(PathParametersSimpleExpansionStandardsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponseAsync(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponseAsync(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardClient.java deleted file mode 100644 index 2e36ba00608..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import java.util.Map; -import routes.implementation.PathParametersSimpleExpansionStandardsImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class PathParametersSimpleExpansionStandardClient { - @Generated - private final PathParametersSimpleExpansionStandardsImpl serviceClient; - - /** - * Initializes an instance of PathParametersSimpleExpansionStandardClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PathParametersSimpleExpansionStandardClient(PathParametersSimpleExpansionStandardsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponse(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponse(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponse(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - primitiveWithResponse(param, requestOptions).getValue(); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - arrayWithResponse(param, requestOptions).getValue(); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - recordWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersAsyncClient.java deleted file mode 100644 index 6f7cafcabb4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersAsyncClient.java +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import routes.implementation.QueryParametersImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class QueryParametersAsyncClient { - @Generated - private final QueryParametersImpl serviceClient; - - /** - * Initializes an instance of QueryParametersAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryParametersAsyncClient(QueryParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The templateOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> templateOnlyWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.templateOnlyWithResponseAsync(param, requestOptions); - } - - /** - * The explicit operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> explicitWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.explicitWithResponseAsync(param, requestOptions); - } - - /** - * The annotationOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> annotationOnlyWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.annotationOnlyWithResponseAsync(param, requestOptions); - } - - /** - * The templateOnly operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono templateOnly(String param) { - // Generated convenience method for templateOnlyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return templateOnlyWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The explicit operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono explicit(String param) { - // Generated convenience method for explicitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return explicitWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The annotationOnly operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono annotationOnly(String param) { - // Generated convenience method for annotationOnlyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return annotationOnlyWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersClient.java deleted file mode 100644 index b192d97cc68..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersClient.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import routes.implementation.QueryParametersImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class QueryParametersClient { - @Generated - private final QueryParametersImpl serviceClient; - - /** - * Initializes an instance of QueryParametersClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryParametersClient(QueryParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The templateOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response templateOnlyWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.templateOnlyWithResponse(param, requestOptions); - } - - /** - * The explicit operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response explicitWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.explicitWithResponse(param, requestOptions); - } - - /** - * The annotationOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response annotationOnlyWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.annotationOnlyWithResponse(param, requestOptions); - } - - /** - * The templateOnly operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void templateOnly(String param) { - // Generated convenience method for templateOnlyWithResponse - RequestOptions requestOptions = new RequestOptions(); - templateOnlyWithResponse(param, requestOptions).getValue(); - } - - /** - * The explicit operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void explicit(String param) { - // Generated convenience method for explicitWithResponse - RequestOptions requestOptions = new RequestOptions(); - explicitWithResponse(param, requestOptions).getValue(); - } - - /** - * The annotationOnly operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void annotationOnly(String param) { - // Generated convenience method for annotationOnlyWithResponse - RequestOptions requestOptions = new RequestOptions(); - annotationOnlyWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeAsyncClient.java deleted file mode 100644 index 4593254b21e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeAsyncClient.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Mono; -import routes.implementation.QueryParametersQueryContinuationExplodesImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class QueryParametersQueryContinuationExplodeAsyncClient { - @Generated - private final QueryParametersQueryContinuationExplodesImpl serviceClient; - - /** - * Initializes an instance of QueryParametersQueryContinuationExplodeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryParametersQueryContinuationExplodeAsyncClient(QueryParametersQueryContinuationExplodesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponseAsync(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponseAsync(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeClient.java deleted file mode 100644 index 0a562af346f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import java.util.Map; -import routes.implementation.QueryParametersQueryContinuationExplodesImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class QueryParametersQueryContinuationExplodeClient { - @Generated - private final QueryParametersQueryContinuationExplodesImpl serviceClient; - - /** - * Initializes an instance of QueryParametersQueryContinuationExplodeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryParametersQueryContinuationExplodeClient(QueryParametersQueryContinuationExplodesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponse(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponse(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponse(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - primitiveWithResponse(param, requestOptions).getValue(); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - arrayWithResponse(param, requestOptions).getValue(); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - recordWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardAsyncClient.java deleted file mode 100644 index 618f09e8895..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardAsyncClient.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Mono; -import routes.implementation.QueryParametersQueryContinuationStandardsImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class QueryParametersQueryContinuationStandardAsyncClient { - @Generated - private final QueryParametersQueryContinuationStandardsImpl serviceClient; - - /** - * Initializes an instance of QueryParametersQueryContinuationStandardAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryParametersQueryContinuationStandardAsyncClient(QueryParametersQueryContinuationStandardsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponseAsync(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponseAsync(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardClient.java deleted file mode 100644 index dc5351b0ad4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import java.util.Map; -import routes.implementation.QueryParametersQueryContinuationStandardsImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class QueryParametersQueryContinuationStandardClient { - @Generated - private final QueryParametersQueryContinuationStandardsImpl serviceClient; - - /** - * Initializes an instance of QueryParametersQueryContinuationStandardClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryParametersQueryContinuationStandardClient(QueryParametersQueryContinuationStandardsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponse(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponse(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponse(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - primitiveWithResponse(param, requestOptions).getValue(); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - arrayWithResponse(param, requestOptions).getValue(); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - recordWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeAsyncClient.java deleted file mode 100644 index ce1c3db069d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeAsyncClient.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Mono; -import routes.implementation.QueryParametersQueryExpansionExplodesImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class QueryParametersQueryExpansionExplodeAsyncClient { - @Generated - private final QueryParametersQueryExpansionExplodesImpl serviceClient; - - /** - * Initializes an instance of QueryParametersQueryExpansionExplodeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryParametersQueryExpansionExplodeAsyncClient(QueryParametersQueryExpansionExplodesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponseAsync(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponseAsync(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeClient.java deleted file mode 100644 index 267bcb6b548..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import java.util.Map; -import routes.implementation.QueryParametersQueryExpansionExplodesImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class QueryParametersQueryExpansionExplodeClient { - @Generated - private final QueryParametersQueryExpansionExplodesImpl serviceClient; - - /** - * Initializes an instance of QueryParametersQueryExpansionExplodeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryParametersQueryExpansionExplodeClient(QueryParametersQueryExpansionExplodesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponse(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponse(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponse(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - primitiveWithResponse(param, requestOptions).getValue(); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - arrayWithResponse(param, requestOptions).getValue(); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - recordWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardAsyncClient.java deleted file mode 100644 index 443f762d223..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardAsyncClient.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Mono; -import routes.implementation.QueryParametersQueryExpansionStandardsImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class QueryParametersQueryExpansionStandardAsyncClient { - @Generated - private final QueryParametersQueryExpansionStandardsImpl serviceClient; - - /** - * Initializes an instance of QueryParametersQueryExpansionStandardAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryParametersQueryExpansionStandardAsyncClient(QueryParametersQueryExpansionStandardsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponseAsync(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponseAsync(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardClient.java deleted file mode 100644 index 91bfd0cc27b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import java.util.List; -import java.util.Map; -import routes.implementation.QueryParametersQueryExpansionStandardsImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class QueryParametersQueryExpansionStandardClient { - @Generated - private final QueryParametersQueryExpansionStandardsImpl serviceClient; - - /** - * Initializes an instance of QueryParametersQueryExpansionStandardClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - QueryParametersQueryExpansionStandardClient(QueryParametersQueryExpansionStandardsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return this.serviceClient.primitiveWithResponse(param, requestOptions); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - return this.serviceClient.arrayWithResponse(param, requestOptions); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return this.serviceClient.recordWithResponse(param, requestOptions); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void primitive(String param) { - // Generated convenience method for primitiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - primitiveWithResponse(param, requestOptions).getValue(); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void array(List param) { - // Generated convenience method for arrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - arrayWithResponse(param, requestOptions).getValue(); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void record(Map param) { - // Generated convenience method for recordWithResponse - RequestOptions requestOptions = new RequestOptions(); - recordWithResponse(param, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesAsyncClient.java deleted file mode 100644 index 7e9e7d1572a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import routes.implementation.RoutesClientImpl; - -/** - * Initializes a new instance of the asynchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) -public final class RoutesAsyncClient { - @Generated - private final RoutesClientImpl serviceClient; - - /** - * Initializes an instance of RoutesAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RoutesAsyncClient(RoutesClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The fixed operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fixedWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fixedWithResponseAsync(requestOptions); - } - - /** - * The fixed operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono fixed() { - // Generated convenience method for fixedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fixedWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClient.java deleted file mode 100644 index c5854322942..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import routes.implementation.RoutesClientImpl; - -/** - * Initializes a new instance of the synchronous RoutesClient type. - */ -@ServiceClient(builder = RoutesClientBuilder.class) -public final class RoutesClient { - @Generated - private final RoutesClientImpl serviceClient; - - /** - * Initializes an instance of RoutesClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RoutesClient(RoutesClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The fixed operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fixedWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fixedWithResponse(requestOptions); - } - - /** - * The fixed operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void fixed() { - // Generated convenience method for fixedWithResponse - RequestOptions requestOptions = new RequestOptions(); - fixedWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClientBuilder.java deleted file mode 100644 index be76263fef0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClientBuilder.java +++ /dev/null @@ -1,668 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import routes.implementation.RoutesClientImpl; - -/** - * A builder for creating a new instance of the RoutesClient type. - */ -@ServiceClientBuilder( - serviceClients = { - RoutesClient.class, - PathParametersClient.class, - PathParametersReservedExpansionClient.class, - PathParametersSimpleExpansionStandardClient.class, - PathParametersSimpleExpansionExplodeClient.class, - PathParametersPathExpansionStandardClient.class, - PathParametersPathExpansionExplodeClient.class, - PathParametersLabelExpansionStandardClient.class, - PathParametersLabelExpansionExplodeClient.class, - PathParametersMatrixExpansionStandardClient.class, - PathParametersMatrixExpansionExplodeClient.class, - QueryParametersClient.class, - QueryParametersQueryExpansionStandardClient.class, - QueryParametersQueryExpansionExplodeClient.class, - QueryParametersQueryContinuationStandardClient.class, - QueryParametersQueryContinuationExplodeClient.class, - InInterfaceClient.class, - RoutesAsyncClient.class, - PathParametersAsyncClient.class, - PathParametersReservedExpansionAsyncClient.class, - PathParametersSimpleExpansionStandardAsyncClient.class, - PathParametersSimpleExpansionExplodeAsyncClient.class, - PathParametersPathExpansionStandardAsyncClient.class, - PathParametersPathExpansionExplodeAsyncClient.class, - PathParametersLabelExpansionStandardAsyncClient.class, - PathParametersLabelExpansionExplodeAsyncClient.class, - PathParametersMatrixExpansionStandardAsyncClient.class, - PathParametersMatrixExpansionExplodeAsyncClient.class, - QueryParametersAsyncClient.class, - QueryParametersQueryExpansionStandardAsyncClient.class, - QueryParametersQueryExpansionExplodeAsyncClient.class, - QueryParametersQueryContinuationStandardAsyncClient.class, - QueryParametersQueryContinuationExplodeAsyncClient.class, - InInterfaceAsyncClient.class }) -public final class RoutesClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("routes.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the RoutesClientBuilder. - */ - @Generated - public RoutesClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RoutesClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RoutesClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RoutesClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RoutesClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RoutesClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RoutesClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RoutesClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RoutesClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the RoutesClientBuilder. - */ - @Generated - public RoutesClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of RoutesClientImpl with the provided parameters. - * - * @return an instance of RoutesClientImpl. - */ - @Generated - private RoutesClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - RoutesClientImpl client - = new RoutesClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of RoutesAsyncClient class. - * - * @return an instance of RoutesAsyncClient. - */ - @Generated - public RoutesAsyncClient buildAsyncClient() { - return new RoutesAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of PathParametersAsyncClient class. - * - * @return an instance of PathParametersAsyncClient. - */ - @Generated - public PathParametersAsyncClient buildPathParametersAsyncClient() { - return new PathParametersAsyncClient(buildInnerClient().getPathParameters()); - } - - /** - * Builds an instance of PathParametersReservedExpansionAsyncClient class. - * - * @return an instance of PathParametersReservedExpansionAsyncClient. - */ - @Generated - public PathParametersReservedExpansionAsyncClient buildPathParametersReservedExpansionAsyncClient() { - return new PathParametersReservedExpansionAsyncClient(buildInnerClient().getPathParametersReservedExpansions()); - } - - /** - * Builds an instance of PathParametersSimpleExpansionStandardAsyncClient class. - * - * @return an instance of PathParametersSimpleExpansionStandardAsyncClient. - */ - @Generated - public PathParametersSimpleExpansionStandardAsyncClient buildPathParametersSimpleExpansionStandardAsyncClient() { - return new PathParametersSimpleExpansionStandardAsyncClient( - buildInnerClient().getPathParametersSimpleExpansionStandards()); - } - - /** - * Builds an instance of PathParametersSimpleExpansionExplodeAsyncClient class. - * - * @return an instance of PathParametersSimpleExpansionExplodeAsyncClient. - */ - @Generated - public PathParametersSimpleExpansionExplodeAsyncClient buildPathParametersSimpleExpansionExplodeAsyncClient() { - return new PathParametersSimpleExpansionExplodeAsyncClient( - buildInnerClient().getPathParametersSimpleExpansionExplodes()); - } - - /** - * Builds an instance of PathParametersPathExpansionStandardAsyncClient class. - * - * @return an instance of PathParametersPathExpansionStandardAsyncClient. - */ - @Generated - public PathParametersPathExpansionStandardAsyncClient buildPathParametersPathExpansionStandardAsyncClient() { - return new PathParametersPathExpansionStandardAsyncClient( - buildInnerClient().getPathParametersPathExpansionStandards()); - } - - /** - * Builds an instance of PathParametersPathExpansionExplodeAsyncClient class. - * - * @return an instance of PathParametersPathExpansionExplodeAsyncClient. - */ - @Generated - public PathParametersPathExpansionExplodeAsyncClient buildPathParametersPathExpansionExplodeAsyncClient() { - return new PathParametersPathExpansionExplodeAsyncClient( - buildInnerClient().getPathParametersPathExpansionExplodes()); - } - - /** - * Builds an instance of PathParametersLabelExpansionStandardAsyncClient class. - * - * @return an instance of PathParametersLabelExpansionStandardAsyncClient. - */ - @Generated - public PathParametersLabelExpansionStandardAsyncClient buildPathParametersLabelExpansionStandardAsyncClient() { - return new PathParametersLabelExpansionStandardAsyncClient( - buildInnerClient().getPathParametersLabelExpansionStandards()); - } - - /** - * Builds an instance of PathParametersLabelExpansionExplodeAsyncClient class. - * - * @return an instance of PathParametersLabelExpansionExplodeAsyncClient. - */ - @Generated - public PathParametersLabelExpansionExplodeAsyncClient buildPathParametersLabelExpansionExplodeAsyncClient() { - return new PathParametersLabelExpansionExplodeAsyncClient( - buildInnerClient().getPathParametersLabelExpansionExplodes()); - } - - /** - * Builds an instance of PathParametersMatrixExpansionStandardAsyncClient class. - * - * @return an instance of PathParametersMatrixExpansionStandardAsyncClient. - */ - @Generated - public PathParametersMatrixExpansionStandardAsyncClient buildPathParametersMatrixExpansionStandardAsyncClient() { - return new PathParametersMatrixExpansionStandardAsyncClient( - buildInnerClient().getPathParametersMatrixExpansionStandards()); - } - - /** - * Builds an instance of PathParametersMatrixExpansionExplodeAsyncClient class. - * - * @return an instance of PathParametersMatrixExpansionExplodeAsyncClient. - */ - @Generated - public PathParametersMatrixExpansionExplodeAsyncClient buildPathParametersMatrixExpansionExplodeAsyncClient() { - return new PathParametersMatrixExpansionExplodeAsyncClient( - buildInnerClient().getPathParametersMatrixExpansionExplodes()); - } - - /** - * Builds an instance of QueryParametersAsyncClient class. - * - * @return an instance of QueryParametersAsyncClient. - */ - @Generated - public QueryParametersAsyncClient buildQueryParametersAsyncClient() { - return new QueryParametersAsyncClient(buildInnerClient().getQueryParameters()); - } - - /** - * Builds an instance of QueryParametersQueryExpansionStandardAsyncClient class. - * - * @return an instance of QueryParametersQueryExpansionStandardAsyncClient. - */ - @Generated - public QueryParametersQueryExpansionStandardAsyncClient buildQueryParametersQueryExpansionStandardAsyncClient() { - return new QueryParametersQueryExpansionStandardAsyncClient( - buildInnerClient().getQueryParametersQueryExpansionStandards()); - } - - /** - * Builds an instance of QueryParametersQueryExpansionExplodeAsyncClient class. - * - * @return an instance of QueryParametersQueryExpansionExplodeAsyncClient. - */ - @Generated - public QueryParametersQueryExpansionExplodeAsyncClient buildQueryParametersQueryExpansionExplodeAsyncClient() { - return new QueryParametersQueryExpansionExplodeAsyncClient( - buildInnerClient().getQueryParametersQueryExpansionExplodes()); - } - - /** - * Builds an instance of QueryParametersQueryContinuationStandardAsyncClient class. - * - * @return an instance of QueryParametersQueryContinuationStandardAsyncClient. - */ - @Generated - public QueryParametersQueryContinuationStandardAsyncClient - buildQueryParametersQueryContinuationStandardAsyncClient() { - return new QueryParametersQueryContinuationStandardAsyncClient( - buildInnerClient().getQueryParametersQueryContinuationStandards()); - } - - /** - * Builds an instance of QueryParametersQueryContinuationExplodeAsyncClient class. - * - * @return an instance of QueryParametersQueryContinuationExplodeAsyncClient. - */ - @Generated - public QueryParametersQueryContinuationExplodeAsyncClient - buildQueryParametersQueryContinuationExplodeAsyncClient() { - return new QueryParametersQueryContinuationExplodeAsyncClient( - buildInnerClient().getQueryParametersQueryContinuationExplodes()); - } - - /** - * Builds an instance of InInterfaceAsyncClient class. - * - * @return an instance of InInterfaceAsyncClient. - */ - @Generated - public InInterfaceAsyncClient buildInInterfaceAsyncClient() { - return new InInterfaceAsyncClient(buildInnerClient().getInInterfaces()); - } - - /** - * Builds an instance of RoutesClient class. - * - * @return an instance of RoutesClient. - */ - @Generated - public RoutesClient buildClient() { - return new RoutesClient(buildInnerClient()); - } - - /** - * Builds an instance of PathParametersClient class. - * - * @return an instance of PathParametersClient. - */ - @Generated - public PathParametersClient buildPathParametersClient() { - return new PathParametersClient(buildInnerClient().getPathParameters()); - } - - /** - * Builds an instance of PathParametersReservedExpansionClient class. - * - * @return an instance of PathParametersReservedExpansionClient. - */ - @Generated - public PathParametersReservedExpansionClient buildPathParametersReservedExpansionClient() { - return new PathParametersReservedExpansionClient(buildInnerClient().getPathParametersReservedExpansions()); - } - - /** - * Builds an instance of PathParametersSimpleExpansionStandardClient class. - * - * @return an instance of PathParametersSimpleExpansionStandardClient. - */ - @Generated - public PathParametersSimpleExpansionStandardClient buildPathParametersSimpleExpansionStandardClient() { - return new PathParametersSimpleExpansionStandardClient( - buildInnerClient().getPathParametersSimpleExpansionStandards()); - } - - /** - * Builds an instance of PathParametersSimpleExpansionExplodeClient class. - * - * @return an instance of PathParametersSimpleExpansionExplodeClient. - */ - @Generated - public PathParametersSimpleExpansionExplodeClient buildPathParametersSimpleExpansionExplodeClient() { - return new PathParametersSimpleExpansionExplodeClient( - buildInnerClient().getPathParametersSimpleExpansionExplodes()); - } - - /** - * Builds an instance of PathParametersPathExpansionStandardClient class. - * - * @return an instance of PathParametersPathExpansionStandardClient. - */ - @Generated - public PathParametersPathExpansionStandardClient buildPathParametersPathExpansionStandardClient() { - return new PathParametersPathExpansionStandardClient( - buildInnerClient().getPathParametersPathExpansionStandards()); - } - - /** - * Builds an instance of PathParametersPathExpansionExplodeClient class. - * - * @return an instance of PathParametersPathExpansionExplodeClient. - */ - @Generated - public PathParametersPathExpansionExplodeClient buildPathParametersPathExpansionExplodeClient() { - return new PathParametersPathExpansionExplodeClient( - buildInnerClient().getPathParametersPathExpansionExplodes()); - } - - /** - * Builds an instance of PathParametersLabelExpansionStandardClient class. - * - * @return an instance of PathParametersLabelExpansionStandardClient. - */ - @Generated - public PathParametersLabelExpansionStandardClient buildPathParametersLabelExpansionStandardClient() { - return new PathParametersLabelExpansionStandardClient( - buildInnerClient().getPathParametersLabelExpansionStandards()); - } - - /** - * Builds an instance of PathParametersLabelExpansionExplodeClient class. - * - * @return an instance of PathParametersLabelExpansionExplodeClient. - */ - @Generated - public PathParametersLabelExpansionExplodeClient buildPathParametersLabelExpansionExplodeClient() { - return new PathParametersLabelExpansionExplodeClient( - buildInnerClient().getPathParametersLabelExpansionExplodes()); - } - - /** - * Builds an instance of PathParametersMatrixExpansionStandardClient class. - * - * @return an instance of PathParametersMatrixExpansionStandardClient. - */ - @Generated - public PathParametersMatrixExpansionStandardClient buildPathParametersMatrixExpansionStandardClient() { - return new PathParametersMatrixExpansionStandardClient( - buildInnerClient().getPathParametersMatrixExpansionStandards()); - } - - /** - * Builds an instance of PathParametersMatrixExpansionExplodeClient class. - * - * @return an instance of PathParametersMatrixExpansionExplodeClient. - */ - @Generated - public PathParametersMatrixExpansionExplodeClient buildPathParametersMatrixExpansionExplodeClient() { - return new PathParametersMatrixExpansionExplodeClient( - buildInnerClient().getPathParametersMatrixExpansionExplodes()); - } - - /** - * Builds an instance of QueryParametersClient class. - * - * @return an instance of QueryParametersClient. - */ - @Generated - public QueryParametersClient buildQueryParametersClient() { - return new QueryParametersClient(buildInnerClient().getQueryParameters()); - } - - /** - * Builds an instance of QueryParametersQueryExpansionStandardClient class. - * - * @return an instance of QueryParametersQueryExpansionStandardClient. - */ - @Generated - public QueryParametersQueryExpansionStandardClient buildQueryParametersQueryExpansionStandardClient() { - return new QueryParametersQueryExpansionStandardClient( - buildInnerClient().getQueryParametersQueryExpansionStandards()); - } - - /** - * Builds an instance of QueryParametersQueryExpansionExplodeClient class. - * - * @return an instance of QueryParametersQueryExpansionExplodeClient. - */ - @Generated - public QueryParametersQueryExpansionExplodeClient buildQueryParametersQueryExpansionExplodeClient() { - return new QueryParametersQueryExpansionExplodeClient( - buildInnerClient().getQueryParametersQueryExpansionExplodes()); - } - - /** - * Builds an instance of QueryParametersQueryContinuationStandardClient class. - * - * @return an instance of QueryParametersQueryContinuationStandardClient. - */ - @Generated - public QueryParametersQueryContinuationStandardClient buildQueryParametersQueryContinuationStandardClient() { - return new QueryParametersQueryContinuationStandardClient( - buildInnerClient().getQueryParametersQueryContinuationStandards()); - } - - /** - * Builds an instance of QueryParametersQueryContinuationExplodeClient class. - * - * @return an instance of QueryParametersQueryContinuationExplodeClient. - */ - @Generated - public QueryParametersQueryContinuationExplodeClient buildQueryParametersQueryContinuationExplodeClient() { - return new QueryParametersQueryContinuationExplodeClient( - buildInnerClient().getQueryParametersQueryContinuationExplodes()); - } - - /** - * Builds an instance of InInterfaceClient class. - * - * @return an instance of InInterfaceClient. - */ - @Generated - public InInterfaceClient buildInInterfaceClient() { - return new InInterfaceClient(buildInnerClient().getInInterfaces()); - } - - private static final ClientLogger LOGGER = new ClientLogger(RoutesClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/InInterfacesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/InInterfacesImpl.java deleted file mode 100644 index e8f098ff6e3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/InInterfacesImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in InInterfaces. - */ -public final class InInterfacesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final InInterfacesService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of InInterfacesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - InInterfacesImpl(RoutesClientImpl client) { - this.service - = RestProxy.create(InInterfacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientInInterfaces to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientInInterfaces") - public interface InInterfacesService { - @Get("/routes/in-interface/fixed") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> fixed(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/routes/in-interface/fixed") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fixedSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The fixed operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fixedWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.fixed(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The fixed operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fixedWithResponse(RequestOptions requestOptions) { - return service.fixedSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersImpl.java deleted file mode 100644 index 72b05a7a165..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersImpl.java +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PathParameters. - */ -public final class PathParametersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathParametersService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of PathParametersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PathParametersImpl(RoutesClientImpl client) { - this.service - = RestProxy.create(PathParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientPathParameters to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientPathParameters") - public interface PathParametersService { - @Get("/routes/path/template-only/{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> templateOnly(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/template-only/{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response templateOnlySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/explicit/{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> explicit(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/explicit/{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response explicitSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/annotation-only/{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> annotationOnly(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/annotation-only/{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response annotationOnlySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - } - - /** - * The templateOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> templateOnlyWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.templateOnly(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The templateOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response templateOnlyWithResponse(String param, RequestOptions requestOptions) { - return service.templateOnlySync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The explicit operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> explicitWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.explicit(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The explicit operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response explicitWithResponse(String param, RequestOptions requestOptions) { - return service.explicitSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The annotationOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> annotationOnlyWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.annotationOnly(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The annotationOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response annotationOnlyWithResponse(String param, RequestOptions requestOptions) { - return service.annotationOnlySync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionExplodesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionExplodesImpl.java deleted file mode 100644 index 1036b592bcb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionExplodesImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PathParametersLabelExpansionExplodes. - */ -public final class PathParametersLabelExpansionExplodesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathParametersLabelExpansionExplodesService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of PathParametersLabelExpansionExplodesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PathParametersLabelExpansionExplodesImpl(RoutesClientImpl client) { - this.service = RestProxy.create(PathParametersLabelExpansionExplodesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientPathParametersLabelExpansionExplodes to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientPathParametersLabelExpansionExplodes") - public interface PathParametersLabelExpansionExplodesService { - @Get("/routes/path/label/explode/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/label/explode/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/label/explode/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/label/explode/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/label/explode/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> record(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - - @Get("/routes/path/label/explode/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response recordSync(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionStandardsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionStandardsImpl.java deleted file mode 100644 index 67c8867ac3e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionStandardsImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PathParametersLabelExpansionStandards. - */ -public final class PathParametersLabelExpansionStandardsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathParametersLabelExpansionStandardsService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of PathParametersLabelExpansionStandardsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PathParametersLabelExpansionStandardsImpl(RoutesClientImpl client) { - this.service = RestProxy.create(PathParametersLabelExpansionStandardsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientPathParametersLabelExpansionStandards to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientPathParametersLabelExpansionStandards") - public interface PathParametersLabelExpansionStandardsService { - @Get("/routes/path/label/standard/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/label/standard/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/label/standard/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/label/standard/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/label/standard/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> record(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - - @Get("/routes/path/label/standard/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response recordSync(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionExplodesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionExplodesImpl.java deleted file mode 100644 index 015db58141d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionExplodesImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PathParametersMatrixExpansionExplodes. - */ -public final class PathParametersMatrixExpansionExplodesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathParametersMatrixExpansionExplodesService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of PathParametersMatrixExpansionExplodesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PathParametersMatrixExpansionExplodesImpl(RoutesClientImpl client) { - this.service = RestProxy.create(PathParametersMatrixExpansionExplodesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientPathParametersMatrixExpansionExplodes to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientPathParametersMatrixExpansionExplodes") - public interface PathParametersMatrixExpansionExplodesService { - @Get("/routes/path/matrix/explode/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/matrix/explode/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/matrix/explode/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/matrix/explode/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/matrix/explode/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> record(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - - @Get("/routes/path/matrix/explode/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response recordSync(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionStandardsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionStandardsImpl.java deleted file mode 100644 index 18eca57d6dc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionStandardsImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PathParametersMatrixExpansionStandards. - */ -public final class PathParametersMatrixExpansionStandardsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathParametersMatrixExpansionStandardsService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of PathParametersMatrixExpansionStandardsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PathParametersMatrixExpansionStandardsImpl(RoutesClientImpl client) { - this.service = RestProxy.create(PathParametersMatrixExpansionStandardsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientPathParametersMatrixExpansionStandards to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientPathParametersMatrixExpansionStandards") - public interface PathParametersMatrixExpansionStandardsService { - @Get("/routes/path/matrix/standard/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/matrix/standard/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/matrix/standard/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/matrix/standard/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/matrix/standard/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> record(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - - @Get("/routes/path/matrix/standard/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response recordSync(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionExplodesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionExplodesImpl.java deleted file mode 100644 index c5ed020e107..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionExplodesImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PathParametersPathExpansionExplodes. - */ -public final class PathParametersPathExpansionExplodesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathParametersPathExpansionExplodesService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of PathParametersPathExpansionExplodesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PathParametersPathExpansionExplodesImpl(RoutesClientImpl client) { - this.service = RestProxy.create(PathParametersPathExpansionExplodesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientPathParametersPathExpansionExplodes to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientPathParametersPathExpansionExplodes") - public interface PathParametersPathExpansionExplodesService { - @Get("/routes/path/path/explode/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/path/explode/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/path/explode/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/path/explode/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/path/explode/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> record(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - - @Get("/routes/path/path/explode/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response recordSync(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionStandardsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionStandardsImpl.java deleted file mode 100644 index c37c22b31c6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionStandardsImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PathParametersPathExpansionStandards. - */ -public final class PathParametersPathExpansionStandardsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathParametersPathExpansionStandardsService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of PathParametersPathExpansionStandardsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PathParametersPathExpansionStandardsImpl(RoutesClientImpl client) { - this.service = RestProxy.create(PathParametersPathExpansionStandardsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientPathParametersPathExpansionStandards to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientPathParametersPathExpansionStandards") - public interface PathParametersPathExpansionStandardsService { - @Get("/routes/path/path/standard/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/path/standard/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/path/standard/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/path/standard/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/path/standard/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> record(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - - @Get("/routes/path/path/standard/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response recordSync(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersReservedExpansionsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersReservedExpansionsImpl.java deleted file mode 100644 index a91cc6470e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersReservedExpansionsImpl.java +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PathParametersReservedExpansions. - */ -public final class PathParametersReservedExpansionsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathParametersReservedExpansionsService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of PathParametersReservedExpansionsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PathParametersReservedExpansionsImpl(RoutesClientImpl client) { - this.service = RestProxy.create(PathParametersReservedExpansionsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientPathParametersReservedExpansions to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientPathParametersReservedExpansions") - public interface PathParametersReservedExpansionsService { - @Get("/routes/path/reserved-expansion/template/{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> template(@HostParam("endpoint") String endpoint, - @PathParam(value = "param", encoded = true) String param, RequestOptions requestOptions, Context context); - - @Get("/routes/path/reserved-expansion/template/{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response templateSync(@HostParam("endpoint") String endpoint, - @PathParam(value = "param", encoded = true) String param, RequestOptions requestOptions, Context context); - - @Get("/routes/path/reserved-expansion/annotation/{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> annotation(@HostParam("endpoint") String endpoint, - @PathParam(value = "param", encoded = true) String param, RequestOptions requestOptions, Context context); - - @Get("/routes/path/reserved-expansion/annotation/{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response annotationSync(@HostParam("endpoint") String endpoint, - @PathParam(value = "param", encoded = true) String param, RequestOptions requestOptions, Context context); - } - - /** - * The template operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> templateWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.template(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The template operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response templateWithResponse(String param, RequestOptions requestOptions) { - return service.templateSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The annotation operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> annotationWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.annotation(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The annotation operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response annotationWithResponse(String param, RequestOptions requestOptions) { - return service.annotationSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionExplodesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionExplodesImpl.java deleted file mode 100644 index c9546c0c362..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionExplodesImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PathParametersSimpleExpansionExplodes. - */ -public final class PathParametersSimpleExpansionExplodesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathParametersSimpleExpansionExplodesService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of PathParametersSimpleExpansionExplodesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PathParametersSimpleExpansionExplodesImpl(RoutesClientImpl client) { - this.service = RestProxy.create(PathParametersSimpleExpansionExplodesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientPathParametersSimpleExpansionExplodes to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientPathParametersSimpleExpansionExplodes") - public interface PathParametersSimpleExpansionExplodesService { - @Get("/routes/path/simple/explode/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/simple/explode/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/simple/explode/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/simple/explode/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/simple/explode/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> record(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - - @Get("/routes/path/simple/explode/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response recordSync(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionStandardsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionStandardsImpl.java deleted file mode 100644 index b4e5df97a42..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionStandardsImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PathParametersSimpleExpansionStandards. - */ -public final class PathParametersSimpleExpansionStandardsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PathParametersSimpleExpansionStandardsService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of PathParametersSimpleExpansionStandardsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PathParametersSimpleExpansionStandardsImpl(RoutesClientImpl client) { - this.service = RestProxy.create(PathParametersSimpleExpansionStandardsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientPathParametersSimpleExpansionStandards to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientPathParametersSimpleExpansionStandards") - public interface PathParametersSimpleExpansionStandardsService { - @Get("/routes/path/simple/standard/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/simple/standard/primitive{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/simple/standard/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/simple/standard/array{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/path/simple/standard/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> record(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - - @Get("/routes/path/simple/standard/record{param}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response recordSync(@HostParam("endpoint") String endpoint, - @PathParam("param") Map param, RequestOptions requestOptions, Context context); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersImpl.java deleted file mode 100644 index d48dd0e3453..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersImpl.java +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in QueryParameters. - */ -public final class QueryParametersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final QueryParametersService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of QueryParametersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - QueryParametersImpl(RoutesClientImpl client) { - this.service - = RestProxy.create(QueryParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientQueryParameters to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientQueryParameters") - public interface QueryParametersService { - @Get("/routes/query/template-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> templateOnly(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/template-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response templateOnlySync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/explicit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> explicit(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/explicit") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response explicitSync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/annotation-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> annotationOnly(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/annotation-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response annotationOnlySync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - } - - /** - * The templateOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> templateOnlyWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.templateOnly(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The templateOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response templateOnlyWithResponse(String param, RequestOptions requestOptions) { - return service.templateOnlySync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The explicit operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> explicitWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.explicit(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The explicit operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response explicitWithResponse(String param, RequestOptions requestOptions) { - return service.explicitSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The annotationOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> annotationOnlyWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.annotationOnly(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The annotationOnly operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response annotationOnlyWithResponse(String param, RequestOptions requestOptions) { - return service.annotationOnlySync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationExplodesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationExplodesImpl.java deleted file mode 100644 index 98f0caf7d29..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationExplodesImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in QueryParametersQueryContinuationExplodes. - */ -public final class QueryParametersQueryContinuationExplodesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final QueryParametersQueryContinuationExplodesService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of QueryParametersQueryContinuationExplodesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - QueryParametersQueryContinuationExplodesImpl(RoutesClientImpl client) { - this.service = RestProxy.create(QueryParametersQueryContinuationExplodesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientQueryParametersQueryContinuationExplodes to be used by - * the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientQueryParametersQueryContinuationExplodes") - public interface QueryParametersQueryContinuationExplodesService { - @Get("/routes/query/query-continuation/explode/primitive?fixed=true") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> primitive(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-continuation/explode/primitive?fixed=true") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response primitiveSync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-continuation/explode/array?fixed=true") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> array(@HostParam("endpoint") String endpoint, - @QueryParam(value = "param", multipleQueryParams = true) List param, RequestOptions requestOptions, - Context context); - - @Get("/routes/query/query-continuation/explode/array?fixed=true") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response arraySync(@HostParam("endpoint") String endpoint, - @QueryParam(value = "param", multipleQueryParams = true) List param, RequestOptions requestOptions, - Context context); - - @Get("/routes/query/query-continuation/explode/record?fixed=true") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> record(@HostParam("endpoint") String endpoint, - @QueryParam("param") Map param, RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-continuation/explode/record?fixed=true") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response recordSync(@HostParam("endpoint") String endpoint, - @QueryParam("param") Map param, RequestOptions requestOptions, Context context); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { - List paramConverted - = param.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return FluxUtil - .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - List paramConverted - = param.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationStandardsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationStandardsImpl.java deleted file mode 100644 index ef0fe9d529b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationStandardsImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in QueryParametersQueryContinuationStandards. - */ -public final class QueryParametersQueryContinuationStandardsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final QueryParametersQueryContinuationStandardsService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of QueryParametersQueryContinuationStandardsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - QueryParametersQueryContinuationStandardsImpl(RoutesClientImpl client) { - this.service = RestProxy.create(QueryParametersQueryContinuationStandardsService.class, - client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientQueryParametersQueryContinuationStandards to be used by - * the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientQueryParametersQueryContinuationStandards") - public interface QueryParametersQueryContinuationStandardsService { - @Get("/routes/query/query-continuation/standard/primitive?fixed=true") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> primitive(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-continuation/standard/primitive?fixed=true") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response primitiveSync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-continuation/standard/array?fixed=true") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> array(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-continuation/standard/array?fixed=true") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response arraySync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-continuation/standard/record?fixed=true") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> record(@HostParam("endpoint") String endpoint, - @QueryParam("param") Map param, RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-continuation/standard/record?fixed=true") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response recordSync(@HostParam("endpoint") String endpoint, - @QueryParam("param") Map param, RequestOptions requestOptions, Context context); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionExplodesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionExplodesImpl.java deleted file mode 100644 index 3bc6b8391ed..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionExplodesImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in QueryParametersQueryExpansionExplodes. - */ -public final class QueryParametersQueryExpansionExplodesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final QueryParametersQueryExpansionExplodesService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of QueryParametersQueryExpansionExplodesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - QueryParametersQueryExpansionExplodesImpl(RoutesClientImpl client) { - this.service = RestProxy.create(QueryParametersQueryExpansionExplodesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientQueryParametersQueryExpansionExplodes to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientQueryParametersQueryExpansionExplodes") - public interface QueryParametersQueryExpansionExplodesService { - @Get("/routes/query/query-expansion/explode/primitive") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> primitive(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-expansion/explode/primitive") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response primitiveSync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-expansion/explode/array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> array(@HostParam("endpoint") String endpoint, - @QueryParam(value = "param", multipleQueryParams = true) List param, RequestOptions requestOptions, - Context context); - - @Get("/routes/query/query-expansion/explode/array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response arraySync(@HostParam("endpoint") String endpoint, - @QueryParam(value = "param", multipleQueryParams = true) List param, RequestOptions requestOptions, - Context context); - - @Get("/routes/query/query-expansion/explode/record") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> record(@HostParam("endpoint") String endpoint, - @QueryParam("param") Map param, RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-expansion/explode/record") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response recordSync(@HostParam("endpoint") String endpoint, - @QueryParam("param") Map param, RequestOptions requestOptions, Context context); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { - List paramConverted - = param.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return FluxUtil - .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - List paramConverted - = param.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionStandardsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionStandardsImpl.java deleted file mode 100644 index bdc3a7a8a54..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionStandardsImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in QueryParametersQueryExpansionStandards. - */ -public final class QueryParametersQueryExpansionStandardsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final QueryParametersQueryExpansionStandardsService service; - - /** - * The service client containing this operation class. - */ - private final RoutesClientImpl client; - - /** - * Initializes an instance of QueryParametersQueryExpansionStandardsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - QueryParametersQueryExpansionStandardsImpl(RoutesClientImpl client) { - this.service = RestProxy.create(QueryParametersQueryExpansionStandardsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for RoutesClientQueryParametersQueryExpansionStandards to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClientQueryParametersQueryExpansionStandards") - public interface QueryParametersQueryExpansionStandardsService { - @Get("/routes/query/query-expansion/standard/primitive") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> primitive(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-expansion/standard/primitive") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response primitiveSync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-expansion/standard/array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> array(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-expansion/standard/array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response arraySync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, - RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-expansion/standard/record") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> record(@HostParam("endpoint") String endpoint, - @QueryParam("param") Map param, RequestOptions requestOptions, Context context); - - @Get("/routes/query/query-expansion/standard/record") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response recordSync(@HostParam("endpoint") String endpoint, - @QueryParam("param") Map param, RequestOptions requestOptions, Context context); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The primitive operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response primitiveWithResponse(String param, RequestOptions requestOptions) { - return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil - .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); - } - - /** - * The array operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response arrayWithResponse(List param, RequestOptions requestOptions) { - String paramConverted = param.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); - } - - /** - * The record operation. - * - * @param param The param parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response recordWithResponse(Map param, RequestOptions requestOptions) { - return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/RoutesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/RoutesClientImpl.java deleted file mode 100644 index 52fba65798a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/RoutesClientImpl.java +++ /dev/null @@ -1,411 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the RoutesClient type. - */ -public final class RoutesClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RoutesClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 PathParametersImpl object to access its operations. - */ - private final PathParametersImpl pathParameters; - - /** - * Gets the PathParametersImpl object to access its operations. - * - * @return the PathParametersImpl object. - */ - public PathParametersImpl getPathParameters() { - return this.pathParameters; - } - - /** - * The PathParametersReservedExpansionsImpl object to access its operations. - */ - private final PathParametersReservedExpansionsImpl pathParametersReservedExpansions; - - /** - * Gets the PathParametersReservedExpansionsImpl object to access its operations. - * - * @return the PathParametersReservedExpansionsImpl object. - */ - public PathParametersReservedExpansionsImpl getPathParametersReservedExpansions() { - return this.pathParametersReservedExpansions; - } - - /** - * The PathParametersSimpleExpansionStandardsImpl object to access its operations. - */ - private final PathParametersSimpleExpansionStandardsImpl pathParametersSimpleExpansionStandards; - - /** - * Gets the PathParametersSimpleExpansionStandardsImpl object to access its operations. - * - * @return the PathParametersSimpleExpansionStandardsImpl object. - */ - public PathParametersSimpleExpansionStandardsImpl getPathParametersSimpleExpansionStandards() { - return this.pathParametersSimpleExpansionStandards; - } - - /** - * The PathParametersSimpleExpansionExplodesImpl object to access its operations. - */ - private final PathParametersSimpleExpansionExplodesImpl pathParametersSimpleExpansionExplodes; - - /** - * Gets the PathParametersSimpleExpansionExplodesImpl object to access its operations. - * - * @return the PathParametersSimpleExpansionExplodesImpl object. - */ - public PathParametersSimpleExpansionExplodesImpl getPathParametersSimpleExpansionExplodes() { - return this.pathParametersSimpleExpansionExplodes; - } - - /** - * The PathParametersPathExpansionStandardsImpl object to access its operations. - */ - private final PathParametersPathExpansionStandardsImpl pathParametersPathExpansionStandards; - - /** - * Gets the PathParametersPathExpansionStandardsImpl object to access its operations. - * - * @return the PathParametersPathExpansionStandardsImpl object. - */ - public PathParametersPathExpansionStandardsImpl getPathParametersPathExpansionStandards() { - return this.pathParametersPathExpansionStandards; - } - - /** - * The PathParametersPathExpansionExplodesImpl object to access its operations. - */ - private final PathParametersPathExpansionExplodesImpl pathParametersPathExpansionExplodes; - - /** - * Gets the PathParametersPathExpansionExplodesImpl object to access its operations. - * - * @return the PathParametersPathExpansionExplodesImpl object. - */ - public PathParametersPathExpansionExplodesImpl getPathParametersPathExpansionExplodes() { - return this.pathParametersPathExpansionExplodes; - } - - /** - * The PathParametersLabelExpansionStandardsImpl object to access its operations. - */ - private final PathParametersLabelExpansionStandardsImpl pathParametersLabelExpansionStandards; - - /** - * Gets the PathParametersLabelExpansionStandardsImpl object to access its operations. - * - * @return the PathParametersLabelExpansionStandardsImpl object. - */ - public PathParametersLabelExpansionStandardsImpl getPathParametersLabelExpansionStandards() { - return this.pathParametersLabelExpansionStandards; - } - - /** - * The PathParametersLabelExpansionExplodesImpl object to access its operations. - */ - private final PathParametersLabelExpansionExplodesImpl pathParametersLabelExpansionExplodes; - - /** - * Gets the PathParametersLabelExpansionExplodesImpl object to access its operations. - * - * @return the PathParametersLabelExpansionExplodesImpl object. - */ - public PathParametersLabelExpansionExplodesImpl getPathParametersLabelExpansionExplodes() { - return this.pathParametersLabelExpansionExplodes; - } - - /** - * The PathParametersMatrixExpansionStandardsImpl object to access its operations. - */ - private final PathParametersMatrixExpansionStandardsImpl pathParametersMatrixExpansionStandards; - - /** - * Gets the PathParametersMatrixExpansionStandardsImpl object to access its operations. - * - * @return the PathParametersMatrixExpansionStandardsImpl object. - */ - public PathParametersMatrixExpansionStandardsImpl getPathParametersMatrixExpansionStandards() { - return this.pathParametersMatrixExpansionStandards; - } - - /** - * The PathParametersMatrixExpansionExplodesImpl object to access its operations. - */ - private final PathParametersMatrixExpansionExplodesImpl pathParametersMatrixExpansionExplodes; - - /** - * Gets the PathParametersMatrixExpansionExplodesImpl object to access its operations. - * - * @return the PathParametersMatrixExpansionExplodesImpl object. - */ - public PathParametersMatrixExpansionExplodesImpl getPathParametersMatrixExpansionExplodes() { - return this.pathParametersMatrixExpansionExplodes; - } - - /** - * The QueryParametersImpl object to access its operations. - */ - private final QueryParametersImpl queryParameters; - - /** - * Gets the QueryParametersImpl object to access its operations. - * - * @return the QueryParametersImpl object. - */ - public QueryParametersImpl getQueryParameters() { - return this.queryParameters; - } - - /** - * The QueryParametersQueryExpansionStandardsImpl object to access its operations. - */ - private final QueryParametersQueryExpansionStandardsImpl queryParametersQueryExpansionStandards; - - /** - * Gets the QueryParametersQueryExpansionStandardsImpl object to access its operations. - * - * @return the QueryParametersQueryExpansionStandardsImpl object. - */ - public QueryParametersQueryExpansionStandardsImpl getQueryParametersQueryExpansionStandards() { - return this.queryParametersQueryExpansionStandards; - } - - /** - * The QueryParametersQueryExpansionExplodesImpl object to access its operations. - */ - private final QueryParametersQueryExpansionExplodesImpl queryParametersQueryExpansionExplodes; - - /** - * Gets the QueryParametersQueryExpansionExplodesImpl object to access its operations. - * - * @return the QueryParametersQueryExpansionExplodesImpl object. - */ - public QueryParametersQueryExpansionExplodesImpl getQueryParametersQueryExpansionExplodes() { - return this.queryParametersQueryExpansionExplodes; - } - - /** - * The QueryParametersQueryContinuationStandardsImpl object to access its operations. - */ - private final QueryParametersQueryContinuationStandardsImpl queryParametersQueryContinuationStandards; - - /** - * Gets the QueryParametersQueryContinuationStandardsImpl object to access its operations. - * - * @return the QueryParametersQueryContinuationStandardsImpl object. - */ - public QueryParametersQueryContinuationStandardsImpl getQueryParametersQueryContinuationStandards() { - return this.queryParametersQueryContinuationStandards; - } - - /** - * The QueryParametersQueryContinuationExplodesImpl object to access its operations. - */ - private final QueryParametersQueryContinuationExplodesImpl queryParametersQueryContinuationExplodes; - - /** - * Gets the QueryParametersQueryContinuationExplodesImpl object to access its operations. - * - * @return the QueryParametersQueryContinuationExplodesImpl object. - */ - public QueryParametersQueryContinuationExplodesImpl getQueryParametersQueryContinuationExplodes() { - return this.queryParametersQueryContinuationExplodes; - } - - /** - * The InInterfacesImpl object to access its operations. - */ - private final InInterfacesImpl inInterfaces; - - /** - * Gets the InInterfacesImpl object to access its operations. - * - * @return the InInterfacesImpl object. - */ - public InInterfacesImpl getInInterfaces() { - return this.inInterfaces; - } - - /** - * Initializes an instance of RoutesClient client. - * - * @param endpoint Service host. - */ - public RoutesClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of RoutesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public RoutesClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of RoutesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public RoutesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.pathParameters = new PathParametersImpl(this); - this.pathParametersReservedExpansions = new PathParametersReservedExpansionsImpl(this); - this.pathParametersSimpleExpansionStandards = new PathParametersSimpleExpansionStandardsImpl(this); - this.pathParametersSimpleExpansionExplodes = new PathParametersSimpleExpansionExplodesImpl(this); - this.pathParametersPathExpansionStandards = new PathParametersPathExpansionStandardsImpl(this); - this.pathParametersPathExpansionExplodes = new PathParametersPathExpansionExplodesImpl(this); - this.pathParametersLabelExpansionStandards = new PathParametersLabelExpansionStandardsImpl(this); - this.pathParametersLabelExpansionExplodes = new PathParametersLabelExpansionExplodesImpl(this); - this.pathParametersMatrixExpansionStandards = new PathParametersMatrixExpansionStandardsImpl(this); - this.pathParametersMatrixExpansionExplodes = new PathParametersMatrixExpansionExplodesImpl(this); - this.queryParameters = new QueryParametersImpl(this); - this.queryParametersQueryExpansionStandards = new QueryParametersQueryExpansionStandardsImpl(this); - this.queryParametersQueryExpansionExplodes = new QueryParametersQueryExpansionExplodesImpl(this); - this.queryParametersQueryContinuationStandards = new QueryParametersQueryContinuationStandardsImpl(this); - this.queryParametersQueryContinuationExplodes = new QueryParametersQueryContinuationExplodesImpl(this); - this.inInterfaces = new InInterfacesImpl(this); - this.service = RestProxy.create(RoutesClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for RoutesClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RoutesClient") - public interface RoutesClientService { - @Get("/routes/fixed") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> fixed(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/routes/fixed") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fixedSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The fixed operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fixedWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.fixed(this.getEndpoint(), requestOptions, context)); - } - - /** - * The fixed operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fixedWithResponse(RequestOptions requestOptions) { - return service.fixedSync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/package-info.java deleted file mode 100644 index ddda07afd44..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Routes. - * Define scenario in building the http route/uri. - * - */ -package routes.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/package-info.java deleted file mode 100644 index 1db2c80b7d9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Routes. - * Define scenario in building the http route/uri. - * - */ -package routes; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonAsyncClient.java deleted file mode 100644 index f1e39fce7d4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package serialization.encodedname.json; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import serialization.encodedname.json.implementation.PropertiesImpl; -import serialization.encodedname.json.property.models.JsonEncodedNameModel; - -/** - * Initializes a new instance of the asynchronous JsonClient type. - */ -@ServiceClient(builder = JsonClientBuilder.class, isAsync = true) -public final class JsonAsyncClient { - @Generated - private final PropertiesImpl serviceClient; - - /** - * Initializes an instance of JsonAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - JsonAsyncClient(PropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     wireName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     wireName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The send operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(JsonEncodedNameModel body) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - return sendWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(JsonEncodedNameModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClient.java deleted file mode 100644 index f3fe2bc3621..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package serialization.encodedname.json; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import serialization.encodedname.json.implementation.PropertiesImpl; -import serialization.encodedname.json.property.models.JsonEncodedNameModel; - -/** - * Initializes a new instance of the synchronous JsonClient type. - */ -@ServiceClient(builder = JsonClientBuilder.class) -public final class JsonClient { - @Generated - private final PropertiesImpl serviceClient; - - /** - * Initializes an instance of JsonClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - JsonClient(PropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     wireName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(body, requestOptions); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     wireName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The send operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(JsonEncodedNameModel body) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - sendWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public JsonEncodedNameModel get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(JsonEncodedNameModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClientBuilder.java deleted file mode 100644 index 2c03280dba7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package serialization.encodedname.json; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import serialization.encodedname.json.implementation.JsonClientImpl; - -/** - * A builder for creating a new instance of the JsonClient type. - */ -@ServiceClientBuilder(serviceClients = { JsonClient.class, JsonAsyncClient.class }) -public final class JsonClientBuilder - implements HttpTrait, ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("serialization-encodedname-json.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the JsonClientBuilder. - */ - @Generated - public JsonClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the JsonClientBuilder. - */ - @Generated - public JsonClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of JsonClientImpl with the provided parameters. - * - * @return an instance of JsonClientImpl. - */ - @Generated - private JsonClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - JsonClientImpl client - = new JsonClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of JsonAsyncClient class. - * - * @return an instance of JsonAsyncClient. - */ - @Generated - public JsonAsyncClient buildAsyncClient() { - return new JsonAsyncClient(buildInnerClient().getProperties()); - } - - /** - * Builds an instance of JsonClient class. - * - * @return an instance of JsonClient. - */ - @Generated - public JsonClient buildClient() { - return new JsonClient(buildInnerClient().getProperties()); - } - - private static final ClientLogger LOGGER = new ClientLogger(JsonClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java deleted file mode 100644 index b3e0fc8d6c9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package serialization.encodedname.json.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 JsonClient type. - */ -public final class JsonClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 PropertiesImpl object to access its operations. - */ - private final PropertiesImpl properties; - - /** - * Gets the PropertiesImpl object to access its operations. - * - * @return the PropertiesImpl object. - */ - public PropertiesImpl getProperties() { - return this.properties; - } - - /** - * Initializes an instance of JsonClient client. - * - * @param endpoint Service host. - */ - public JsonClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of JsonClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public JsonClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of JsonClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public JsonClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.properties = new PropertiesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/PropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/PropertiesImpl.java deleted file mode 100644 index 07565d3e69f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/PropertiesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package serialization.encodedname.json.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Properties. - */ -public final class PropertiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PropertiesService service; - - /** - * The service client containing this operation class. - */ - private final JsonClientImpl client; - - /** - * Initializes an instance of PropertiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PropertiesImpl(JsonClientImpl client) { - this.service - = RestProxy.create(PropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for JsonClientProperties to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "JsonClientProperties") - public interface PropertiesService { - @Post("/serialization/encoded-name/json/property") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/serialization/encoded-name/json/property") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Get("/serialization/encoded-name/json/property") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/serialization/encoded-name/json/property") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     wireName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.send(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     wireName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     wireName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     wireName: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/package-info.java deleted file mode 100644 index c7c4a88a11f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Json. - * Encoded names. - * - */ -package serialization.encodedname.json.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/package-info.java deleted file mode 100644 index 9b838780dcb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Json. - * Encoded names. - * - */ -package serialization.encodedname.json; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/JsonEncodedNameModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/JsonEncodedNameModel.java deleted file mode 100644 index f5a1fa46583..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/JsonEncodedNameModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package serialization.encodedname.json.property.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The JsonEncodedNameModel model. - */ -@Immutable -public final class JsonEncodedNameModel implements JsonSerializable { - /* - * Pass in true - */ - @Generated - private final boolean defaultName; - - /** - * Creates an instance of JsonEncodedNameModel class. - * - * @param defaultName the defaultName value to set. - */ - @Generated - public JsonEncodedNameModel(boolean defaultName) { - this.defaultName = defaultName; - } - - /** - * Get the defaultName property: Pass in true. - * - * @return the defaultName value. - */ - @Generated - public boolean isDefaultName() { - return this.defaultName; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("wireName", this.defaultName); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of JsonEncodedNameModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of JsonEncodedNameModel if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the JsonEncodedNameModel. - */ - @Generated - public static JsonEncodedNameModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - boolean defaultName = false; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("wireName".equals(fieldName)) { - defaultName = reader.getBoolean(); - } else { - reader.skipChildren(); - } - } - return new JsonEncodedNameModel(defaultName); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/package-info.java deleted file mode 100644 index 634192c3dc4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Json. - * Encoded names. - * - */ -package serialization.encodedname.json.property.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedAsyncClient.java deleted file mode 100644 index 9eac38a24b0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.endpoint.notdefined; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import server.endpoint.notdefined.implementation.NotDefinedClientImpl; - -/** - * Initializes a new instance of the asynchronous NotDefinedClient type. - */ -@ServiceClient(builder = NotDefinedClientBuilder.class, isAsync = true) -public final class NotDefinedAsyncClient { - @Generated - private final NotDefinedClientImpl serviceClient; - - /** - * Initializes an instance of NotDefinedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NotDefinedAsyncClient(NotDefinedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The valid operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> validWithResponse(RequestOptions requestOptions) { - return this.serviceClient.validWithResponseAsync(requestOptions); - } - - /** - * The valid operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono valid() { - // Generated convenience method for validWithResponse - RequestOptions requestOptions = new RequestOptions(); - return validWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClient.java deleted file mode 100644 index ee3d262e7c6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.endpoint.notdefined; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import server.endpoint.notdefined.implementation.NotDefinedClientImpl; - -/** - * Initializes a new instance of the synchronous NotDefinedClient type. - */ -@ServiceClient(builder = NotDefinedClientBuilder.class) -public final class NotDefinedClient { - @Generated - private final NotDefinedClientImpl serviceClient; - - /** - * Initializes an instance of NotDefinedClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NotDefinedClient(NotDefinedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The valid operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response validWithResponse(RequestOptions requestOptions) { - return this.serviceClient.validWithResponse(requestOptions); - } - - /** - * The valid operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void valid() { - // Generated convenience method for validWithResponse - RequestOptions requestOptions = new RequestOptions(); - validWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClientBuilder.java deleted file mode 100644 index 56a7a3b0e8d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.endpoint.notdefined; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import server.endpoint.notdefined.implementation.NotDefinedClientImpl; - -/** - * A builder for creating a new instance of the NotDefinedClient type. - */ -@ServiceClientBuilder(serviceClients = { NotDefinedClient.class, NotDefinedAsyncClient.class }) -public final class NotDefinedClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("server-endpoint-notdefined.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the NotDefinedClientBuilder. - */ - @Generated - public NotDefinedClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDefinedClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDefinedClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDefinedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDefinedClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDefinedClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDefinedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDefinedClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDefinedClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the NotDefinedClientBuilder. - */ - @Generated - public NotDefinedClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of NotDefinedClientImpl with the provided parameters. - * - * @return an instance of NotDefinedClientImpl. - */ - @Generated - private NotDefinedClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - NotDefinedClientImpl client - = new NotDefinedClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of NotDefinedAsyncClient class. - * - * @return an instance of NotDefinedAsyncClient. - */ - @Generated - public NotDefinedAsyncClient buildAsyncClient() { - return new NotDefinedAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of NotDefinedClient class. - * - * @return an instance of NotDefinedClient. - */ - @Generated - public NotDefinedClient buildClient() { - return new NotDefinedClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(NotDefinedClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java deleted file mode 100644 index 4ea639a0ff9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.endpoint.notdefined.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Head; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the NotDefinedClient type. - */ -public final class NotDefinedClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NotDefinedClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of NotDefinedClient client. - * - * @param endpoint Service host. - */ - public NotDefinedClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NotDefinedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public NotDefinedClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NotDefinedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public NotDefinedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(NotDefinedClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for NotDefinedClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NotDefinedClient") - public interface NotDefinedClientService { - @Head("/server/endpoint/not-defined/valid") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> valid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Head("/server/endpoint/not-defined/valid") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response validSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The valid operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> validWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.valid(this.getEndpoint(), requestOptions, context)); - } - - /** - * The valid operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response validWithResponse(RequestOptions requestOptions) { - return service.validSync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/package-info.java deleted file mode 100644 index e6716d53105..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for NotDefined. - * Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let user pass in. - * - */ -package server.endpoint.notdefined.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/package-info.java deleted file mode 100644 index ee8c05fee2b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for NotDefined. - * Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let user pass in. - * - */ -package server.endpoint.notdefined; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleAsyncClient.java deleted file mode 100644 index e8d82b12b25..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleAsyncClient.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.path.multiple; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import server.path.multiple.implementation.MultipleClientImpl; - -/** - * Initializes a new instance of the asynchronous MultipleClient type. - */ -@ServiceClient(builder = MultipleClientBuilder.class, isAsync = true) -public final class MultipleAsyncClient { - @Generated - private final MultipleClientImpl serviceClient; - - /** - * Initializes an instance of MultipleAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MultipleAsyncClient(MultipleClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The noOperationParams operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> noOperationParamsWithResponse(RequestOptions requestOptions) { - return this.serviceClient.noOperationParamsWithResponseAsync(requestOptions); - } - - /** - * The withOperationPathParam operation. - * - * @param keyword The keyword parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withOperationPathParamWithResponse(String keyword, RequestOptions requestOptions) { - return this.serviceClient.withOperationPathParamWithResponseAsync(keyword, requestOptions); - } - - /** - * The noOperationParams operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono noOperationParams() { - // Generated convenience method for noOperationParamsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return noOperationParamsWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withOperationPathParam operation. - * - * @param keyword The keyword parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withOperationPathParam(String keyword) { - // Generated convenience method for withOperationPathParamWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withOperationPathParamWithResponse(keyword, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClient.java deleted file mode 100644 index 07089f5be19..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClient.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.path.multiple; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import server.path.multiple.implementation.MultipleClientImpl; - -/** - * Initializes a new instance of the synchronous MultipleClient type. - */ -@ServiceClient(builder = MultipleClientBuilder.class) -public final class MultipleClient { - @Generated - private final MultipleClientImpl serviceClient; - - /** - * Initializes an instance of MultipleClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MultipleClient(MultipleClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The noOperationParams operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response noOperationParamsWithResponse(RequestOptions requestOptions) { - return this.serviceClient.noOperationParamsWithResponse(requestOptions); - } - - /** - * The withOperationPathParam operation. - * - * @param keyword The keyword parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withOperationPathParamWithResponse(String keyword, RequestOptions requestOptions) { - return this.serviceClient.withOperationPathParamWithResponse(keyword, requestOptions); - } - - /** - * The noOperationParams operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void noOperationParams() { - // Generated convenience method for noOperationParamsWithResponse - RequestOptions requestOptions = new RequestOptions(); - noOperationParamsWithResponse(requestOptions).getValue(); - } - - /** - * The withOperationPathParam operation. - * - * @param keyword The keyword parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withOperationPathParam(String keyword) { - // Generated convenience method for withOperationPathParamWithResponse - RequestOptions requestOptions = new RequestOptions(); - withOperationPathParamWithResponse(keyword, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClientBuilder.java deleted file mode 100644 index e53f5a1b173..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.path.multiple; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import server.path.multiple.implementation.MultipleClientImpl; - -/** - * A builder for creating a new instance of the MultipleClient type. - */ -@ServiceClientBuilder(serviceClients = { MultipleClient.class, MultipleAsyncClient.class }) -public final class MultipleClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("server-path-multiple.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the MultipleClientBuilder. - */ - @Generated - public MultipleClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipleClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private MultipleServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the MultipleClientBuilder. - */ - @Generated - public MultipleClientBuilder serviceVersion(MultipleServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the MultipleClientBuilder. - */ - @Generated - public MultipleClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of MultipleClientImpl with the provided parameters. - * - * @return an instance of MultipleClientImpl. - */ - @Generated - private MultipleClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - MultipleServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : MultipleServiceVersion.getLatest(); - MultipleClientImpl client = new MultipleClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of MultipleAsyncClient class. - * - * @return an instance of MultipleAsyncClient. - */ - @Generated - public MultipleAsyncClient buildAsyncClient() { - return new MultipleAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of MultipleClient class. - * - * @return an instance of MultipleClient. - */ - @Generated - public MultipleClient buildClient() { - return new MultipleClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(MultipleClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleServiceVersion.java deleted file mode 100644 index f4fb1653e56..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.path.multiple; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of MultipleClient. - */ -public enum MultipleServiceVersion implements ServiceVersion { - /** - * Enum value v1.0. - */ - V1_0("v1.0"); - - private final String version; - - MultipleServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link MultipleServiceVersion}. - */ - public static MultipleServiceVersion getLatest() { - return V1_0; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/MultipleClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/MultipleClientImpl.java deleted file mode 100644 index bc8357ca33a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/MultipleClientImpl.java +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.path.multiple.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; -import server.path.multiple.MultipleServiceVersion; - -/** - * Initializes a new instance of the MultipleClient type. - */ -public final class MultipleClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MultipleClientService service; - - /** - * Pass in http://localhost:3000 for endpoint. - */ - private final String endpoint; - - /** - * Gets Pass in http://localhost:3000 for endpoint. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final MultipleServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public MultipleServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of MultipleClient client. - * - * @param endpoint Pass in http://localhost:3000 for endpoint. - * @param serviceVersion Service version. - */ - public MultipleClientImpl(String endpoint, MultipleServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of MultipleClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Pass in http://localhost:3000 for endpoint. - * @param serviceVersion Service version. - */ - public MultipleClientImpl(HttpPipeline httpPipeline, String endpoint, MultipleServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of MultipleClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Pass in http://localhost:3000 for endpoint. - * @param serviceVersion Service version. - */ - public MultipleClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - MultipleServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(MultipleClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for MultipleClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}/server/path/multiple/{apiVersion}") - @ServiceInterface(name = "MultipleClient") - public interface MultipleClientService { - @Get("/") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> noOperationParams(@HostParam("endpoint") String endpoint, - @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Get("/") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response noOperationParamsSync(@HostParam("endpoint") String endpoint, - @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Get("/{keyword}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withOperationPathParam(@HostParam("endpoint") String endpoint, - @HostParam("apiVersion") String apiVersion, @PathParam("keyword") String keyword, - RequestOptions requestOptions, Context context); - - @Get("/{keyword}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withOperationPathParamSync(@HostParam("endpoint") String endpoint, - @HostParam("apiVersion") String apiVersion, @PathParam("keyword") String keyword, - RequestOptions requestOptions, Context context); - } - - /** - * The noOperationParams operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> noOperationParamsWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.noOperationParams(this.getEndpoint(), - this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * The noOperationParams operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response noOperationParamsWithResponse(RequestOptions requestOptions) { - return service.noOperationParamsSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, - Context.NONE); - } - - /** - * The withOperationPathParam operation. - * - * @param keyword The keyword parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withOperationPathParamWithResponseAsync(String keyword, RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.withOperationPathParam(this.getEndpoint(), - this.getServiceVersion().getVersion(), keyword, requestOptions, context)); - } - - /** - * The withOperationPathParam operation. - * - * @param keyword The keyword parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withOperationPathParamWithResponse(String keyword, RequestOptions requestOptions) { - return service.withOperationPathParamSync(this.getEndpoint(), this.getServiceVersion().getVersion(), keyword, - requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/package-info.java deleted file mode 100644 index 51c1318d974..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Multiple. - * - */ -package server.path.multiple.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/package-info.java deleted file mode 100644 index 4a95ed39ce5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Multiple. - * - */ -package server.path.multiple; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleAsyncClient.java deleted file mode 100644 index 899719ae884..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.path.single; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import server.path.single.implementation.SingleClientImpl; - -/** - * Initializes a new instance of the asynchronous SingleClient type. - */ -@ServiceClient(builder = SingleClientBuilder.class, isAsync = true) -public final class SingleAsyncClient { - @Generated - private final SingleClientImpl serviceClient; - - /** - * Initializes an instance of SingleAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SingleAsyncClient(SingleClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The myOp operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> myOpWithResponse(RequestOptions requestOptions) { - return this.serviceClient.myOpWithResponseAsync(requestOptions); - } - - /** - * The myOp operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono myOp() { - // Generated convenience method for myOpWithResponse - RequestOptions requestOptions = new RequestOptions(); - return myOpWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClient.java deleted file mode 100644 index 1e6bce8e601..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.path.single; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import server.path.single.implementation.SingleClientImpl; - -/** - * Initializes a new instance of the synchronous SingleClient type. - */ -@ServiceClient(builder = SingleClientBuilder.class) -public final class SingleClient { - @Generated - private final SingleClientImpl serviceClient; - - /** - * Initializes an instance of SingleClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SingleClient(SingleClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The myOp operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response myOpWithResponse(RequestOptions requestOptions) { - return this.serviceClient.myOpWithResponse(requestOptions); - } - - /** - * The myOp operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void myOp() { - // Generated convenience method for myOpWithResponse - RequestOptions requestOptions = new RequestOptions(); - myOpWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClientBuilder.java deleted file mode 100644 index 61b3dd90ddc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.path.single; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import server.path.single.implementation.SingleClientImpl; - -/** - * A builder for creating a new instance of the SingleClient type. - */ -@ServiceClientBuilder(serviceClients = { SingleClient.class, SingleAsyncClient.class }) -public final class SingleClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("server-path-single.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the SingleClientBuilder. - */ - @Generated - public SingleClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the SingleClientBuilder. - */ - @Generated - public SingleClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of SingleClientImpl with the provided parameters. - * - * @return an instance of SingleClientImpl. - */ - @Generated - private SingleClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - SingleClientImpl client - = new SingleClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of SingleAsyncClient class. - * - * @return an instance of SingleAsyncClient. - */ - @Generated - public SingleAsyncClient buildAsyncClient() { - return new SingleAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of SingleClient class. - * - * @return an instance of SingleClient. - */ - @Generated - public SingleClient buildClient() { - return new SingleClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(SingleClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/SingleClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/SingleClientImpl.java deleted file mode 100644 index 26346f9e7d6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/SingleClientImpl.java +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.path.single.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Head; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the SingleClient type. - */ -public final class SingleClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SingleClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of SingleClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - */ - public SingleClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of SingleClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - */ - public SingleClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of SingleClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - */ - public SingleClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(SingleClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for SingleClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SingleClient") - public interface SingleClientService { - @Head("/server/path/single/myOp") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> myOp(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Head("/server/path/single/myOp") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response myOpSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - } - - /** - * The myOp operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> myOpWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.myOp(this.getEndpoint(), requestOptions, context)); - } - - /** - * The myOp operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response myOpWithResponse(RequestOptions requestOptions) { - return service.myOpSync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/package-info.java deleted file mode 100644 index 554b05fc178..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Single. - * Illustrates server with a single path parameter @server. - * - */ -package server.path.single.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/package-info.java deleted file mode 100644 index b29badf29c4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Single. - * Illustrates server with a single path parameter @server. - * - */ -package server.path.single; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedAsyncClient.java deleted file mode 100644 index 3f6c214b8fc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedAsyncClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.versions.notversioned; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import server.versions.notversioned.implementation.NotVersionedClientImpl; - -/** - * Initializes a new instance of the asynchronous NotVersionedClient type. - */ -@ServiceClient(builder = NotVersionedClientBuilder.class, isAsync = true) -public final class NotVersionedAsyncClient { - @Generated - private final NotVersionedClientImpl serviceClient; - - /** - * Initializes an instance of NotVersionedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NotVersionedAsyncClient(NotVersionedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withoutApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withoutApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withoutApiVersionWithResponseAsync(requestOptions); - } - - /** - * The withQueryApiVersion operation. - * - * @param apiVersion The apiVersion parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryApiVersionWithResponse(String apiVersion, RequestOptions requestOptions) { - return this.serviceClient.withQueryApiVersionWithResponseAsync(apiVersion, requestOptions); - } - - /** - * The withPathApiVersion operation. - * - * @param apiVersion The apiVersion parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withPathApiVersionWithResponse(String apiVersion, RequestOptions requestOptions) { - return this.serviceClient.withPathApiVersionWithResponseAsync(apiVersion, requestOptions); - } - - /** - * The withoutApiVersion operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withoutApiVersion() { - // Generated convenience method for withoutApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withoutApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withQueryApiVersion operation. - * - * @param apiVersion The apiVersion parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withQueryApiVersion(String apiVersion) { - // Generated convenience method for withQueryApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withQueryApiVersionWithResponse(apiVersion, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withPathApiVersion operation. - * - * @param apiVersion The apiVersion parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withPathApiVersion(String apiVersion) { - // Generated convenience method for withPathApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withPathApiVersionWithResponse(apiVersion, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClient.java deleted file mode 100644 index 271337ca77c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClient.java +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.versions.notversioned; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import server.versions.notversioned.implementation.NotVersionedClientImpl; - -/** - * Initializes a new instance of the synchronous NotVersionedClient type. - */ -@ServiceClient(builder = NotVersionedClientBuilder.class) -public final class NotVersionedClient { - @Generated - private final NotVersionedClientImpl serviceClient; - - /** - * Initializes an instance of NotVersionedClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NotVersionedClient(NotVersionedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withoutApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withoutApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withoutApiVersionWithResponse(requestOptions); - } - - /** - * The withQueryApiVersion operation. - * - * @param apiVersion The apiVersion parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryApiVersionWithResponse(String apiVersion, RequestOptions requestOptions) { - return this.serviceClient.withQueryApiVersionWithResponse(apiVersion, requestOptions); - } - - /** - * The withPathApiVersion operation. - * - * @param apiVersion The apiVersion parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withPathApiVersionWithResponse(String apiVersion, RequestOptions requestOptions) { - return this.serviceClient.withPathApiVersionWithResponse(apiVersion, requestOptions); - } - - /** - * The withoutApiVersion operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withoutApiVersion() { - // Generated convenience method for withoutApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - withoutApiVersionWithResponse(requestOptions).getValue(); - } - - /** - * The withQueryApiVersion operation. - * - * @param apiVersion The apiVersion parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withQueryApiVersion(String apiVersion) { - // Generated convenience method for withQueryApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - withQueryApiVersionWithResponse(apiVersion, requestOptions).getValue(); - } - - /** - * The withPathApiVersion operation. - * - * @param apiVersion The apiVersion parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withPathApiVersion(String apiVersion) { - // Generated convenience method for withPathApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - withPathApiVersionWithResponse(apiVersion, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClientBuilder.java deleted file mode 100644 index 814ee07bd59..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.versions.notversioned; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import server.versions.notversioned.implementation.NotVersionedClientImpl; - -/** - * A builder for creating a new instance of the NotVersionedClient type. - */ -@ServiceClientBuilder(serviceClients = { NotVersionedClient.class, NotVersionedAsyncClient.class }) -public final class NotVersionedClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("server-versions-notversioned.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the NotVersionedClientBuilder. - */ - @Generated - public NotVersionedClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotVersionedClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotVersionedClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotVersionedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotVersionedClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotVersionedClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotVersionedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotVersionedClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotVersionedClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the NotVersionedClientBuilder. - */ - @Generated - public NotVersionedClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of NotVersionedClientImpl with the provided parameters. - * - * @return an instance of NotVersionedClientImpl. - */ - @Generated - private NotVersionedClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - NotVersionedClientImpl client - = new NotVersionedClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of NotVersionedAsyncClient class. - * - * @return an instance of NotVersionedAsyncClient. - */ - @Generated - public NotVersionedAsyncClient buildAsyncClient() { - return new NotVersionedAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of NotVersionedClient class. - * - * @return an instance of NotVersionedClient. - */ - @Generated - public NotVersionedClient buildClient() { - return new NotVersionedClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(NotVersionedClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java deleted file mode 100644 index 46282333378..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.versions.notversioned.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Head; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the NotVersionedClient type. - */ -public final class NotVersionedClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NotVersionedClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of NotVersionedClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - */ - public NotVersionedClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NotVersionedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - */ - public NotVersionedClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NotVersionedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - */ - public NotVersionedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(NotVersionedClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for NotVersionedClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NotVersionedClient") - public interface NotVersionedClientService { - @Head("/server/versions/not-versioned/without-api-version") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withoutApiVersion(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Head("/server/versions/not-versioned/without-api-version") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withoutApiVersionSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Head("/server/versions/not-versioned/with-query-api-version") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withQueryApiVersion(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); - - @Head("/server/versions/not-versioned/with-query-api-version") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withQueryApiVersionSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); - - @Head("/server/versions/not-versioned/with-path-api-version/{apiVersion}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withPathApiVersion(@HostParam("endpoint") String endpoint, - @PathParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Head("/server/versions/not-versioned/with-path-api-version/{apiVersion}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withPathApiVersionSync(@HostParam("endpoint") String endpoint, - @PathParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - } - - /** - * The withoutApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withoutApiVersionWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.withoutApiVersion(this.getEndpoint(), requestOptions, context)); - } - - /** - * The withoutApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withoutApiVersionWithResponse(RequestOptions requestOptions) { - return service.withoutApiVersionSync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The withQueryApiVersion operation. - * - * @param apiVersion The apiVersion parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryApiVersionWithResponseAsync(String apiVersion, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withQueryApiVersion(this.getEndpoint(), apiVersion, requestOptions, context)); - } - - /** - * The withQueryApiVersion operation. - * - * @param apiVersion The apiVersion parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryApiVersionWithResponse(String apiVersion, RequestOptions requestOptions) { - return service.withQueryApiVersionSync(this.getEndpoint(), apiVersion, requestOptions, Context.NONE); - } - - /** - * The withPathApiVersion operation. - * - * @param apiVersion The apiVersion parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withPathApiVersionWithResponseAsync(String apiVersion, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withPathApiVersion(this.getEndpoint(), apiVersion, requestOptions, context)); - } - - /** - * The withPathApiVersion operation. - * - * @param apiVersion The apiVersion parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withPathApiVersionWithResponse(String apiVersion, RequestOptions requestOptions) { - return service.withPathApiVersionSync(this.getEndpoint(), apiVersion, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/package-info.java deleted file mode 100644 index c7fbcc652d8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for NotVersioned. - * Illustrates not-versioned server. - * - */ -package server.versions.notversioned.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/package-info.java deleted file mode 100644 index b744d37b22a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for NotVersioned. - * Illustrates not-versioned server. - * - */ -package server.versions.notversioned; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedAsyncClient.java deleted file mode 100644 index 2cba337eb43..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedAsyncClient.java +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.versions.versioned; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import server.versions.versioned.implementation.VersionedClientImpl; - -/** - * Initializes a new instance of the asynchronous VersionedClient type. - */ -@ServiceClient(builder = VersionedClientBuilder.class, isAsync = true) -public final class VersionedAsyncClient { - @Generated - private final VersionedClientImpl serviceClient; - - /** - * Initializes an instance of VersionedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - VersionedAsyncClient(VersionedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withoutApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withoutApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withoutApiVersionWithResponseAsync(requestOptions); - } - - /** - * The withQueryApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withQueryApiVersionWithResponseAsync(requestOptions); - } - - /** - * The withPathApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withPathApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withPathApiVersionWithResponseAsync(requestOptions); - } - - /** - * The withQueryOldApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryOldApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withQueryOldApiVersionWithResponseAsync(requestOptions); - } - - /** - * The withoutApiVersion operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withoutApiVersion() { - // Generated convenience method for withoutApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withoutApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withQueryApiVersion operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withQueryApiVersion() { - // Generated convenience method for withQueryApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withQueryApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withPathApiVersion operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withPathApiVersion() { - // Generated convenience method for withPathApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withPathApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withQueryOldApiVersion operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withQueryOldApiVersion() { - // Generated convenience method for withQueryOldApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withQueryOldApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClient.java deleted file mode 100644 index 819053006ce..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClient.java +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.versions.versioned; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import server.versions.versioned.implementation.VersionedClientImpl; - -/** - * Initializes a new instance of the synchronous VersionedClient type. - */ -@ServiceClient(builder = VersionedClientBuilder.class) -public final class VersionedClient { - @Generated - private final VersionedClientImpl serviceClient; - - /** - * Initializes an instance of VersionedClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - VersionedClient(VersionedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withoutApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withoutApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withoutApiVersionWithResponse(requestOptions); - } - - /** - * The withQueryApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withQueryApiVersionWithResponse(requestOptions); - } - - /** - * The withPathApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withPathApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withPathApiVersionWithResponse(requestOptions); - } - - /** - * The withQueryOldApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryOldApiVersionWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withQueryOldApiVersionWithResponse(requestOptions); - } - - /** - * The withoutApiVersion operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withoutApiVersion() { - // Generated convenience method for withoutApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - withoutApiVersionWithResponse(requestOptions).getValue(); - } - - /** - * The withQueryApiVersion operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withQueryApiVersion() { - // Generated convenience method for withQueryApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - withQueryApiVersionWithResponse(requestOptions).getValue(); - } - - /** - * The withPathApiVersion operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withPathApiVersion() { - // Generated convenience method for withPathApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - withPathApiVersionWithResponse(requestOptions).getValue(); - } - - /** - * The withQueryOldApiVersion operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withQueryOldApiVersion() { - // Generated convenience method for withQueryOldApiVersionWithResponse - RequestOptions requestOptions = new RequestOptions(); - withQueryOldApiVersionWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClientBuilder.java deleted file mode 100644 index baea8044ff1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClientBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.versions.versioned; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import server.versions.versioned.implementation.VersionedClientImpl; - -/** - * A builder for creating a new instance of the VersionedClient type. - */ -@ServiceClientBuilder(serviceClients = { VersionedClient.class, VersionedAsyncClient.class }) -public final class VersionedClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("server-versions-versioned.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the VersionedClientBuilder. - */ - @Generated - public VersionedClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersionedClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersionedClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersionedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersionedClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersionedClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersionedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersionedClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersionedClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private VersionedServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the VersionedClientBuilder. - */ - @Generated - public VersionedClientBuilder serviceVersion(VersionedServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the VersionedClientBuilder. - */ - @Generated - public VersionedClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of VersionedClientImpl with the provided parameters. - * - * @return an instance of VersionedClientImpl. - */ - @Generated - private VersionedClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - VersionedServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : VersionedServiceVersion.getLatest(); - VersionedClientImpl client = new VersionedClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of VersionedAsyncClient class. - * - * @return an instance of VersionedAsyncClient. - */ - @Generated - public VersionedAsyncClient buildAsyncClient() { - return new VersionedAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of VersionedClient class. - * - * @return an instance of VersionedClient. - */ - @Generated - public VersionedClient buildClient() { - return new VersionedClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(VersionedClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedServiceVersion.java deleted file mode 100644 index 2399f722bea..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedServiceVersion.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.versions.versioned; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of VersionedClient. - */ -public enum VersionedServiceVersion implements ServiceVersion { - /** - * Enum value 2021-01-01-preview. - */ - V2021_01_01_PREVIEW("2021-01-01-preview"), - - /** - * Enum value 2022-12-01-preview. - */ - V2022_12_01_PREVIEW("2022-12-01-preview"); - - private final String version; - - VersionedServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link VersionedServiceVersion}. - */ - public static VersionedServiceVersion getLatest() { - return V2022_12_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java deleted file mode 100644 index b9d95687bb5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java +++ /dev/null @@ -1,344 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.versions.versioned.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Head; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; -import server.versions.versioned.VersionedServiceVersion; - -/** - * Initializes a new instance of the VersionedClient type. - */ -public final class VersionedClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final VersionedClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final VersionedServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public VersionedServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of VersionedClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public VersionedClientImpl(String endpoint, VersionedServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of VersionedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public VersionedClientImpl(HttpPipeline httpPipeline, String endpoint, VersionedServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of VersionedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public VersionedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - VersionedServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(VersionedClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for VersionedClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "VersionedClient") - public interface VersionedClientService { - @Head("/server/versions/versioned/without-api-version") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withoutApiVersion(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Head("/server/versions/versioned/without-api-version") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withoutApiVersionSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Head("/server/versions/versioned/with-query-api-version") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withQueryApiVersion(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); - - @Head("/server/versions/versioned/with-query-api-version") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withQueryApiVersionSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); - - @Head("/server/versions/versioned/with-path-api-version/{apiVersion}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withPathApiVersion(@HostParam("endpoint") String endpoint, - @PathParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Head("/server/versions/versioned/with-path-api-version/{apiVersion}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withPathApiVersionSync(@HostParam("endpoint") String endpoint, - @PathParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); - - @Head("/server/versions/versioned/with-query-old-api-version") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withQueryOldApiVersion(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); - - @Head("/server/versions/versioned/with-query-old-api-version") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withQueryOldApiVersionSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); - } - - /** - * The withoutApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withoutApiVersionWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.withoutApiVersion(this.getEndpoint(), requestOptions, context)); - } - - /** - * The withoutApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withoutApiVersionWithResponse(RequestOptions requestOptions) { - return service.withoutApiVersionSync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The withQueryApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryApiVersionWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.withQueryApiVersion(this.getEndpoint(), - this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * The withQueryApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryApiVersionWithResponse(RequestOptions requestOptions) { - return service.withQueryApiVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), - requestOptions, Context.NONE); - } - - /** - * The withPathApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withPathApiVersionWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.withPathApiVersion(this.getEndpoint(), - this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * The withPathApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withPathApiVersionWithResponse(RequestOptions requestOptions) { - return service.withPathApiVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, - Context.NONE); - } - - /** - * The withQueryOldApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withQueryOldApiVersionWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.withQueryOldApiVersion(this.getEndpoint(), - this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * The withQueryOldApiVersion operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withQueryOldApiVersionWithResponse(RequestOptions requestOptions) { - return service.withQueryOldApiVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), - requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/package-info.java deleted file mode 100644 index 2e7ef69662c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Versioned. - * Illustrates versioned server. - * - */ -package server.versions.versioned.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/package-info.java deleted file mode 100644 index ce684d1fa6f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Versioned. - * Illustrates versioned server. - * - */ -package server.versions.versioned; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarAsyncClient.java deleted file mode 100644 index 9211574695c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package service.multiservice.combined; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import service.multiservice.combined.implementation.BarsImpl; - -/** - * Initializes a new instance of the asynchronous Combined type. - */ -@ServiceClient(builder = CombinedBuilder.class, isAsync = true) -public final class BarAsyncClient { - @Generated - private final BarsImpl serviceClient; - - /** - * Initializes an instance of BarAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BarAsyncClient(BarsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The test operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> testWithResponse(RequestOptions requestOptions) { - return this.serviceClient.testWithResponseAsync(requestOptions); - } - - /** - * The test operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono test() { - // Generated convenience method for testWithResponse - RequestOptions requestOptions = new RequestOptions(); - return testWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarClient.java deleted file mode 100644 index 03b812e715a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package service.multiservice.combined; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import service.multiservice.combined.implementation.BarsImpl; - -/** - * Initializes a new instance of the synchronous Combined type. - */ -@ServiceClient(builder = CombinedBuilder.class) -public final class BarClient { - @Generated - private final BarsImpl serviceClient; - - /** - * Initializes an instance of BarClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BarClient(BarsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The test operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response testWithResponse(RequestOptions requestOptions) { - return this.serviceClient.testWithResponse(requestOptions); - } - - /** - * The test operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void test() { - // Generated convenience method for testWithResponse - RequestOptions requestOptions = new RequestOptions(); - testWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/CombinedBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/CombinedBuilder.java deleted file mode 100644 index b89f4e03a22..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/CombinedBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package service.multiservice.combined; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import service.multiservice.combined.implementation.CombinedImpl; - -/** - * A builder for creating a new instance of the Combined type. - */ -@ServiceClientBuilder(serviceClients = { FooClient.class, BarClient.class, FooAsyncClient.class, BarAsyncClient.class }) -public final class CombinedBuilder - implements HttpTrait, ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("service-multiservice-combined.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the CombinedBuilder. - */ - @Generated - public CombinedBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CombinedBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CombinedBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CombinedBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CombinedBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CombinedBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CombinedBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CombinedBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public CombinedBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the CombinedBuilder. - */ - @Generated - public CombinedBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of CombinedImpl with the provided parameters. - * - * @return an instance of CombinedImpl. - */ - @Generated - private CombinedImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - CombinedImpl client - = new CombinedImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of FooAsyncClient class. - * - * @return an instance of FooAsyncClient. - */ - @Generated - public FooAsyncClient buildFooAsyncClient() { - return new FooAsyncClient(buildInnerClient().getFoos()); - } - - /** - * Builds an instance of BarAsyncClient class. - * - * @return an instance of BarAsyncClient. - */ - @Generated - public BarAsyncClient buildBarAsyncClient() { - return new BarAsyncClient(buildInnerClient().getBars()); - } - - /** - * Builds an instance of FooClient class. - * - * @return an instance of FooClient. - */ - @Generated - public FooClient buildFooClient() { - return new FooClient(buildInnerClient().getFoos()); - } - - /** - * Builds an instance of BarClient class. - * - * @return an instance of BarClient. - */ - @Generated - public BarClient buildBarClient() { - return new BarClient(buildInnerClient().getBars()); - } - - private static final ClientLogger LOGGER = new ClientLogger(CombinedBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooAsyncClient.java deleted file mode 100644 index 34f3161e6a2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooAsyncClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package service.multiservice.combined; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import service.multiservice.combined.implementation.FoosImpl; - -/** - * Initializes a new instance of the asynchronous Combined type. - */ -@ServiceClient(builder = CombinedBuilder.class, isAsync = true) -public final class FooAsyncClient { - @Generated - private final FoosImpl serviceClient; - - /** - * Initializes an instance of FooAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FooAsyncClient(FoosImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The test operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> testWithResponse(RequestOptions requestOptions) { - return this.serviceClient.testWithResponseAsync(requestOptions); - } - - /** - * The test operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono test() { - // Generated convenience method for testWithResponse - RequestOptions requestOptions = new RequestOptions(); - return testWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooClient.java deleted file mode 100644 index 98a2d8c872e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package service.multiservice.combined; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import service.multiservice.combined.implementation.FoosImpl; - -/** - * Initializes a new instance of the synchronous Combined type. - */ -@ServiceClient(builder = CombinedBuilder.class) -public final class FooClient { - @Generated - private final FoosImpl serviceClient; - - /** - * Initializes an instance of FooClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FooClient(FoosImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The test operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response testWithResponse(RequestOptions requestOptions) { - return this.serviceClient.testWithResponse(requestOptions); - } - - /** - * The test operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void test() { - // Generated convenience method for testWithResponse - RequestOptions requestOptions = new RequestOptions(); - testWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/BarsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/BarsImpl.java deleted file mode 100644 index c481c896037..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/BarsImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package service.multiservice.combined.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Bars. - */ -public final class BarsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BarsService service; - - /** - * The service client containing this operation class. - */ - private final CombinedImpl client; - - /** - * Initializes an instance of BarsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BarsImpl(CombinedImpl client) { - this.service = RestProxy.create(BarsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for CombinedBars to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "CombinedBars") - public interface BarsService { - @Get("/service/multi-service/service-b/bar/test") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> test(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - RequestOptions requestOptions, Context context); - - @Get("/service/multi-service/service-b/bar/test") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response testSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - RequestOptions requestOptions, Context context); - } - - /** - * The test operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> testWithResponseAsync(RequestOptions requestOptions) { - final String apiVersion = "bv2"; - return FluxUtil - .withContext(context -> service.test(this.client.getEndpoint(), apiVersion, requestOptions, context)); - } - - /** - * The test operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response testWithResponse(RequestOptions requestOptions) { - final String apiVersion = "bv2"; - return service.testSync(this.client.getEndpoint(), apiVersion, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/CombinedImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/CombinedImpl.java deleted file mode 100644 index d524e6a1b39..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/CombinedImpl.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package service.multiservice.combined.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 Combined type. - */ -public final class CombinedImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 FoosImpl object to access its operations. - */ - private final FoosImpl foos; - - /** - * Gets the FoosImpl object to access its operations. - * - * @return the FoosImpl object. - */ - public FoosImpl getFoos() { - return this.foos; - } - - /** - * The BarsImpl object to access its operations. - */ - private final BarsImpl bars; - - /** - * Gets the BarsImpl object to access its operations. - * - * @return the BarsImpl object. - */ - public BarsImpl getBars() { - return this.bars; - } - - /** - * Initializes an instance of Combined client. - * - * @param endpoint Service host. - */ - public CombinedImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of Combined client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public CombinedImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of Combined client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public CombinedImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.foos = new FoosImpl(this); - this.bars = new BarsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/FoosImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/FoosImpl.java deleted file mode 100644 index fe467381554..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/FoosImpl.java +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package service.multiservice.combined.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Foos. - */ -public final class FoosImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FoosService service; - - /** - * The service client containing this operation class. - */ - private final CombinedImpl client; - - /** - * Initializes an instance of FoosImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FoosImpl(CombinedImpl client) { - this.service = RestProxy.create(FoosService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for CombinedFoos to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "CombinedFoos") - public interface FoosService { - @Get("/service/multi-service/service-a/foo/test") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> test(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - RequestOptions requestOptions, Context context); - - @Get("/service/multi-service/service-a/foo/test") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response testSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - RequestOptions requestOptions, Context context); - } - - /** - * The test operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> testWithResponseAsync(RequestOptions requestOptions) { - final String apiVersion = "av2"; - return FluxUtil - .withContext(context -> service.test(this.client.getEndpoint(), apiVersion, requestOptions, context)); - } - - /** - * The test operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response testWithResponse(RequestOptions requestOptions) { - final String apiVersion = "av2"; - return service.testSync(this.client.getEndpoint(), apiVersion, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/package-info.java deleted file mode 100644 index abf0c574d64..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ServiceA. - * - */ -package service.multiservice.combined.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/package-info.java deleted file mode 100644 index 79ea8b07e7f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ServiceA. - * - */ -package service.multiservice.combined; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestAsyncClient.java deleted file mode 100644 index fbd8ba89398..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestAsyncClient.java +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialheaders.conditionalrequest; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.FluxUtil; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; -import specialheaders.conditionalrequest.implementation.ConditionalRequestClientImpl; - -/** - * Initializes a new instance of the asynchronous ConditionalRequestClient type. - */ -@ServiceClient(builder = ConditionalRequestClientBuilder.class, isAsync = true) -public final class ConditionalRequestAsyncClient { - @Generated - private final ConditionalRequestClientImpl serviceClient; - - /** - * Initializes an instance of ConditionalRequestAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ConditionalRequestAsyncClient(ConditionalRequestClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Check when only If-Match in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postIfMatchWithResponse(RequestOptions requestOptions) { - return this.serviceClient.postIfMatchWithResponseAsync(requestOptions); - } - - /** - * Check when only If-None-Match in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postIfNoneMatchWithResponse(RequestOptions requestOptions) { - return this.serviceClient.postIfNoneMatchWithResponseAsync(requestOptions); - } - - /** - * Check when only If-Modified-Since in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoA timestamp indicating the last modified time - * of the resource known to the - * client. The operation will be performed only if the resource on the service has - * been modified since the specified time.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> headIfModifiedSinceWithResponse(RequestOptions requestOptions) { - return this.serviceClient.headIfModifiedSinceWithResponseAsync(requestOptions); - } - - /** - * Check when only If-Unmodified-Since in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-Unmodified-SinceOffsetDateTimeNoA timestamp indicating the last modified - * time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * not been modified since the specified time.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postIfUnmodifiedSinceWithResponse(RequestOptions requestOptions) { - return this.serviceClient.postIfUnmodifiedSinceWithResponseAsync(requestOptions); - } - - /** - * Check when only If-Match in header is defined. - * - * @param ifMatch The request should only proceed if an entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono postIfMatch(String ifMatch) { - // Generated convenience method for postIfMatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - return postIfMatchWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Check when only If-Match in header is defined. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono postIfMatch() { - // Generated convenience method for postIfMatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postIfMatchWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Check when only If-None-Match in header is defined. - * - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono postIfNoneMatch(String ifNoneMatch) { - // Generated convenience method for postIfNoneMatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - return postIfNoneMatchWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Check when only If-None-Match in header is defined. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono postIfNoneMatch() { - // Generated convenience method for postIfNoneMatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postIfNoneMatchWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Check when only If-Modified-Since in header is defined. - * - * @param ifModifiedSince A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * been modified since the specified time. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono headIfModifiedSince(OffsetDateTime ifModifiedSince) { - // Generated convenience method for headIfModifiedSinceWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return headIfModifiedSinceWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Check when only If-Modified-Since in header is defined. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono headIfModifiedSince() { - // Generated convenience method for headIfModifiedSinceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return headIfModifiedSinceWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Check when only If-Unmodified-Since in header is defined. - * - * @param ifUnmodifiedSince A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * not been modified since the specified time. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono postIfUnmodifiedSince(OffsetDateTime ifUnmodifiedSince) { - // Generated convenience method for postIfUnmodifiedSinceWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - return postIfUnmodifiedSinceWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Check when only If-Unmodified-Since in header is defined. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono postIfUnmodifiedSince() { - // Generated convenience method for postIfUnmodifiedSinceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postIfUnmodifiedSinceWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClient.java deleted file mode 100644 index 19f63e6bf91..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClient.java +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialheaders.conditionalrequest; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; -import specialheaders.conditionalrequest.implementation.ConditionalRequestClientImpl; - -/** - * Initializes a new instance of the synchronous ConditionalRequestClient type. - */ -@ServiceClient(builder = ConditionalRequestClientBuilder.class) -public final class ConditionalRequestClient { - @Generated - private final ConditionalRequestClientImpl serviceClient; - - /** - * Initializes an instance of ConditionalRequestClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ConditionalRequestClient(ConditionalRequestClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Check when only If-Match in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postIfMatchWithResponse(RequestOptions requestOptions) { - return this.serviceClient.postIfMatchWithResponse(requestOptions); - } - - /** - * Check when only If-None-Match in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postIfNoneMatchWithResponse(RequestOptions requestOptions) { - return this.serviceClient.postIfNoneMatchWithResponse(requestOptions); - } - - /** - * Check when only If-Modified-Since in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoA timestamp indicating the last modified time - * of the resource known to the - * client. The operation will be performed only if the resource on the service has - * been modified since the specified time.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response headIfModifiedSinceWithResponse(RequestOptions requestOptions) { - return this.serviceClient.headIfModifiedSinceWithResponse(requestOptions); - } - - /** - * Check when only If-Unmodified-Since in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-Unmodified-SinceOffsetDateTimeNoA timestamp indicating the last modified - * time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * not been modified since the specified time.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postIfUnmodifiedSinceWithResponse(RequestOptions requestOptions) { - return this.serviceClient.postIfUnmodifiedSinceWithResponse(requestOptions); - } - - /** - * Check when only If-Match in header is defined. - * - * @param ifMatch The request should only proceed if an entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void postIfMatch(String ifMatch) { - // Generated convenience method for postIfMatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - postIfMatchWithResponse(requestOptions).getValue(); - } - - /** - * Check when only If-Match in header is defined. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void postIfMatch() { - // Generated convenience method for postIfMatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - postIfMatchWithResponse(requestOptions).getValue(); - } - - /** - * Check when only If-None-Match in header is defined. - * - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void postIfNoneMatch(String ifNoneMatch) { - // Generated convenience method for postIfNoneMatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - postIfNoneMatchWithResponse(requestOptions).getValue(); - } - - /** - * Check when only If-None-Match in header is defined. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void postIfNoneMatch() { - // Generated convenience method for postIfNoneMatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - postIfNoneMatchWithResponse(requestOptions).getValue(); - } - - /** - * Check when only If-Modified-Since in header is defined. - * - * @param ifModifiedSince A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * been modified since the specified time. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void headIfModifiedSince(OffsetDateTime ifModifiedSince) { - // Generated convenience method for headIfModifiedSinceWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - headIfModifiedSinceWithResponse(requestOptions).getValue(); - } - - /** - * Check when only If-Modified-Since in header is defined. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void headIfModifiedSince() { - // Generated convenience method for headIfModifiedSinceWithResponse - RequestOptions requestOptions = new RequestOptions(); - headIfModifiedSinceWithResponse(requestOptions).getValue(); - } - - /** - * Check when only If-Unmodified-Since in header is defined. - * - * @param ifUnmodifiedSince A timestamp indicating the last modified time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * not been modified since the specified time. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void postIfUnmodifiedSince(OffsetDateTime ifUnmodifiedSince) { - // Generated convenience method for postIfUnmodifiedSinceWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - postIfUnmodifiedSinceWithResponse(requestOptions).getValue(); - } - - /** - * Check when only If-Unmodified-Since in header is defined. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void postIfUnmodifiedSince() { - // Generated convenience method for postIfUnmodifiedSinceWithResponse - RequestOptions requestOptions = new RequestOptions(); - postIfUnmodifiedSinceWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClientBuilder.java deleted file mode 100644 index 83002268e51..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialheaders.conditionalrequest; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import specialheaders.conditionalrequest.implementation.ConditionalRequestClientImpl; - -/** - * A builder for creating a new instance of the ConditionalRequestClient type. - */ -@ServiceClientBuilder(serviceClients = { ConditionalRequestClient.class, ConditionalRequestAsyncClient.class }) -public final class ConditionalRequestClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("specialheaders-conditionalrequest.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ConditionalRequestClientBuilder. - */ - @Generated - public ConditionalRequestClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ConditionalRequestClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ConditionalRequestClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ConditionalRequestClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ConditionalRequestClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ConditionalRequestClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ConditionalRequestClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ConditionalRequestClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ConditionalRequestClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ConditionalRequestClientBuilder. - */ - @Generated - public ConditionalRequestClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ConditionalRequestClientImpl with the provided parameters. - * - * @return an instance of ConditionalRequestClientImpl. - */ - @Generated - private ConditionalRequestClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ConditionalRequestClientImpl client = new ConditionalRequestClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ConditionalRequestAsyncClient class. - * - * @return an instance of ConditionalRequestAsyncClient. - */ - @Generated - public ConditionalRequestAsyncClient buildAsyncClient() { - return new ConditionalRequestAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ConditionalRequestClient class. - * - * @return an instance of ConditionalRequestClient. - */ - @Generated - public ConditionalRequestClient buildClient() { - return new ConditionalRequestClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ConditionalRequestClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/ConditionalRequestClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/ConditionalRequestClientImpl.java deleted file mode 100644 index 45ac00fbab5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/ConditionalRequestClientImpl.java +++ /dev/null @@ -1,393 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialheaders.conditionalrequest.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Head; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the ConditionalRequestClient type. - */ -public final class ConditionalRequestClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ConditionalRequestClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of ConditionalRequestClient client. - * - * @param endpoint Service host. - */ - public ConditionalRequestClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ConditionalRequestClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ConditionalRequestClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ConditionalRequestClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ConditionalRequestClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(ConditionalRequestClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ConditionalRequestClient to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ConditionalRequestClient") - public interface ConditionalRequestClientService { - @Post("/special-headers/conditional-request/if-match") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> postIfMatch(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Post("/special-headers/conditional-request/if-match") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postIfMatchSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Post("/special-headers/conditional-request/if-none-match") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> postIfNoneMatch(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Post("/special-headers/conditional-request/if-none-match") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postIfNoneMatchSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Head("/special-headers/conditional-request/if-modified-since") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> headIfModifiedSince(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Head("/special-headers/conditional-request/if-modified-since") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response headIfModifiedSinceSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Post("/special-headers/conditional-request/if-unmodified-since") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> postIfUnmodifiedSince(@HostParam("endpoint") String endpoint, - RequestOptions requestOptions, Context context); - - @Post("/special-headers/conditional-request/if-unmodified-since") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postIfUnmodifiedSinceSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * Check when only If-Match in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postIfMatchWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.postIfMatch(this.getEndpoint(), requestOptions, context)); - } - - /** - * Check when only If-Match in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postIfMatchWithResponse(RequestOptions requestOptions) { - return service.postIfMatchSync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * Check when only If-None-Match in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postIfNoneMatchWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.postIfNoneMatch(this.getEndpoint(), requestOptions, context)); - } - - /** - * Check when only If-None-Match in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postIfNoneMatchWithResponse(RequestOptions requestOptions) { - return service.postIfNoneMatchSync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * Check when only If-Modified-Since in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoA timestamp indicating the last modified time - * of the resource known to the - * client. The operation will be performed only if the resource on the service has - * been modified since the specified time.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> headIfModifiedSinceWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.headIfModifiedSince(this.getEndpoint(), requestOptions, context)); - } - - /** - * Check when only If-Modified-Since in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoA timestamp indicating the last modified time - * of the resource known to the - * client. The operation will be performed only if the resource on the service has - * been modified since the specified time.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response headIfModifiedSinceWithResponse(RequestOptions requestOptions) { - return service.headIfModifiedSinceSync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * Check when only If-Unmodified-Since in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-Unmodified-SinceOffsetDateTimeNoA timestamp indicating the last modified - * time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * not been modified since the specified time.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postIfUnmodifiedSinceWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.postIfUnmodifiedSince(this.getEndpoint(), requestOptions, context)); - } - - /** - * Check when only If-Unmodified-Since in header is defined. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-Unmodified-SinceOffsetDateTimeNoA timestamp indicating the last modified - * time of the resource known to the - * client. The operation will be performed only if the resource on the service has - * not been modified since the specified time.
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postIfUnmodifiedSinceWithResponse(RequestOptions requestOptions) { - return service.postIfUnmodifiedSinceSync(this.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/package-info.java deleted file mode 100644 index 7110fedce66..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ConditionalRequest. - * Illustrates conditional request headers. - * - */ -package specialheaders.conditionalrequest.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/package-info.java deleted file mode 100644 index a265790cb9a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ConditionalRequest. - * Illustrates conditional request headers. - * - */ -package specialheaders.conditionalrequest; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityAsyncClient.java deleted file mode 100644 index dfb531b787b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityAsyncClient.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialheaders.repeatability; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import specialheaders.repeatability.implementation.RepeatabilityClientImpl; - -/** - * Initializes a new instance of the asynchronous RepeatabilityClient type. - */ -@ServiceClient(builder = RepeatabilityClientBuilder.class, isAsync = true) -public final class RepeatabilityAsyncClient { - @Generated - private final RepeatabilityClientImpl serviceClient; - - /** - * Initializes an instance of RepeatabilityAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RepeatabilityAsyncClient(RepeatabilityClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> immediateSuccessWithResponse(RequestOptions requestOptions) { - return this.serviceClient.immediateSuccessWithResponseAsync(requestOptions); - } - - /** - * Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono immediateSuccess() { - // Generated convenience method for immediateSuccessWithResponse - RequestOptions requestOptions = new RequestOptions(); - return immediateSuccessWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClient.java deleted file mode 100644 index 4840de1b303..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClient.java +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialheaders.repeatability; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import specialheaders.repeatability.implementation.RepeatabilityClientImpl; - -/** - * Initializes a new instance of the synchronous RepeatabilityClient type. - */ -@ServiceClient(builder = RepeatabilityClientBuilder.class) -public final class RepeatabilityClient { - @Generated - private final RepeatabilityClientImpl serviceClient; - - /** - * Initializes an instance of RepeatabilityClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RepeatabilityClient(RepeatabilityClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response immediateSuccessWithResponse(RequestOptions requestOptions) { - return this.serviceClient.immediateSuccessWithResponse(requestOptions); - } - - /** - * Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void immediateSuccess() { - // Generated convenience method for immediateSuccessWithResponse - RequestOptions requestOptions = new RequestOptions(); - immediateSuccessWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClientBuilder.java deleted file mode 100644 index 90ddb1a5ff9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialheaders.repeatability; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import specialheaders.repeatability.implementation.RepeatabilityClientImpl; - -/** - * A builder for creating a new instance of the RepeatabilityClient type. - */ -@ServiceClientBuilder(serviceClients = { RepeatabilityClient.class, RepeatabilityAsyncClient.class }) -public final class RepeatabilityClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("specialheaders-repeatability.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the RepeatabilityClientBuilder. - */ - @Generated - public RepeatabilityClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RepeatabilityClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RepeatabilityClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RepeatabilityClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RepeatabilityClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RepeatabilityClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RepeatabilityClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RepeatabilityClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RepeatabilityClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the RepeatabilityClientBuilder. - */ - @Generated - public RepeatabilityClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of RepeatabilityClientImpl with the provided parameters. - * - * @return an instance of RepeatabilityClientImpl. - */ - @Generated - private RepeatabilityClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - RepeatabilityClientImpl client = new RepeatabilityClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of RepeatabilityAsyncClient class. - * - * @return an instance of RepeatabilityAsyncClient. - */ - @Generated - public RepeatabilityAsyncClient buildAsyncClient() { - return new RepeatabilityAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of RepeatabilityClient class. - * - * @return an instance of RepeatabilityClient. - */ - @Generated - public RepeatabilityClient buildClient() { - return new RepeatabilityClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(RepeatabilityClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/RepeatabilityClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/RepeatabilityClientImpl.java deleted file mode 100644 index 085186d6e79..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/RepeatabilityClientImpl.java +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialheaders.repeatability.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the RepeatabilityClient type. - */ -public final class RepeatabilityClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RepeatabilityClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of RepeatabilityClient client. - * - * @param endpoint Service host. - */ - public RepeatabilityClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of RepeatabilityClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public RepeatabilityClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of RepeatabilityClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public RepeatabilityClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(RepeatabilityClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for RepeatabilityClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RepeatabilityClient") - public interface RepeatabilityClientService { - @Post("/special-headers/repeatability/immediateSuccess") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> immediateSuccess(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Post("/special-headers/repeatability/immediateSuccess") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response immediateSuccessSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> immediateSuccessWithResponseAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); - } - }); - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-first-sent"), - DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); - } - }); - return FluxUtil - .withContext(context -> service.immediateSuccess(this.getEndpoint(), requestOptionsLocal, context)); - } - - /** - * Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response immediateSuccessWithResponse(RequestOptions requestOptions) { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); - } - }); - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-first-sent"), - DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); - } - }); - return service.immediateSuccessSync(this.getEndpoint(), requestOptionsLocal, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/package-info.java deleted file mode 100644 index 950e6a3770d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Repeatability. - * Illustrates OASIS repeatability headers. - * - */ -package specialheaders.repeatability.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/package-info.java deleted file mode 100644 index b42a6426c9a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Repeatability. - * Illustrates OASIS repeatability headers. - * - */ -package specialheaders.repeatability; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesAsyncClient.java deleted file mode 100644 index e8922e855b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesAsyncClient.java +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import specialwords.implementation.ModelPropertiesImpl; -import specialwords.modelproperties.models.DictMethods; -import specialwords.modelproperties.models.SameAsModel; - -/** - * Initializes a new instance of the asynchronous SpecialWordsClient type. - */ -@ServiceClient(builder = SpecialWordsClientBuilder.class, isAsync = true) -public final class ModelPropertiesAsyncClient { - @Generated - private final ModelPropertiesImpl serviceClient; - - /** - * Initializes an instance of ModelPropertiesAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelPropertiesAsyncClient(ModelPropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The sameAsModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     SameAsModel: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sameAsModelWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.sameAsModelWithResponseAsync(body, requestOptions); - } - - /** - * The dictMethods operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     keys: String (Required)
-     *     items: String (Required)
-     *     values: String (Required)
-     *     popitem: String (Required)
-     *     clear: String (Required)
-     *     update: String (Required)
-     *     setdefault: String (Required)
-     *     pop: String (Required)
-     *     get: String (Required)
-     *     copy: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> dictMethodsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.dictMethodsWithResponseAsync(body, requestOptions); - } - - /** - * The sameAsModel operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono sameAsModel(SameAsModel body) { - // Generated convenience method for sameAsModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return sameAsModelWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The dictMethods operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono dictMethods(DictMethods body) { - // Generated convenience method for dictMethodsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return dictMethodsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesClient.java deleted file mode 100644 index 1374bc9f693..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesClient.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import specialwords.implementation.ModelPropertiesImpl; -import specialwords.modelproperties.models.DictMethods; -import specialwords.modelproperties.models.SameAsModel; - -/** - * Initializes a new instance of the synchronous SpecialWordsClient type. - */ -@ServiceClient(builder = SpecialWordsClientBuilder.class) -public final class ModelPropertiesClient { - @Generated - private final ModelPropertiesImpl serviceClient; - - /** - * Initializes an instance of ModelPropertiesClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelPropertiesClient(ModelPropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The sameAsModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     SameAsModel: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sameAsModelWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.sameAsModelWithResponse(body, requestOptions); - } - - /** - * The dictMethods operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     keys: String (Required)
-     *     items: String (Required)
-     *     values: String (Required)
-     *     popitem: String (Required)
-     *     clear: String (Required)
-     *     update: String (Required)
-     *     setdefault: String (Required)
-     *     pop: String (Required)
-     *     get: String (Required)
-     *     copy: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response dictMethodsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.dictMethodsWithResponse(body, requestOptions); - } - - /** - * The sameAsModel operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void sameAsModel(SameAsModel body) { - // Generated convenience method for sameAsModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - sameAsModelWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The dictMethods operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void dictMethods(DictMethods body) { - // Generated convenience method for dictMethodsWithResponse - RequestOptions requestOptions = new RequestOptions(); - dictMethodsWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsAsyncClient.java deleted file mode 100644 index e36add4ca6f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsAsyncClient.java +++ /dev/null @@ -1,1590 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import specialwords.implementation.ModelsImpl; -import specialwords.models.models.And; -import specialwords.models.models.As; -import specialwords.models.models.Assert; -import specialwords.models.models.Async; -import specialwords.models.models.Await; -import specialwords.models.models.Break; -import specialwords.models.models.ClassModel; -import specialwords.models.models.Constructor; -import specialwords.models.models.Continue; -import specialwords.models.models.Def; -import specialwords.models.models.Del; -import specialwords.models.models.Elif; -import specialwords.models.models.Else; -import specialwords.models.models.Except; -import specialwords.models.models.Exec; -import specialwords.models.models.Finally; -import specialwords.models.models.For; -import specialwords.models.models.From; -import specialwords.models.models.Global; -import specialwords.models.models.If; -import specialwords.models.models.Import; -import specialwords.models.models.In; -import specialwords.models.models.Is; -import specialwords.models.models.Lambda; -import specialwords.models.models.Not; -import specialwords.models.models.Or; -import specialwords.models.models.Pass; -import specialwords.models.models.Raise; -import specialwords.models.models.Return; -import specialwords.models.models.Try; -import specialwords.models.models.While; -import specialwords.models.models.With; -import specialwords.models.models.Yield; - -/** - * Initializes a new instance of the asynchronous SpecialWordsClient type. - */ -@ServiceClient(builder = SpecialWordsClientBuilder.class, isAsync = true) -public final class ModelsAsyncClient { - @Generated - private final ModelsImpl serviceClient; - - /** - * Initializes an instance of ModelsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelsAsyncClient(ModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withAnd operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAndWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withAndWithResponseAsync(body, requestOptions); - } - - /** - * The withAs operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withAsWithResponseAsync(body, requestOptions); - } - - /** - * The withAssert operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAssertWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withAssertWithResponseAsync(body, requestOptions); - } - - /** - * The withAsync operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAsyncWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withAsyncWithResponseAsync(body, requestOptions); - } - - /** - * The withAwait operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAwaitWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withAwaitWithResponseAsync(body, requestOptions); - } - - /** - * The withBreak operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withBreakWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withBreakWithResponseAsync(body, requestOptions); - } - - /** - * The withClass operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withClassWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withClassWithResponseAsync(body, requestOptions); - } - - /** - * The withConstructor operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withConstructorWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withConstructorWithResponseAsync(body, requestOptions); - } - - /** - * The withContinue operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withContinueWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withContinueWithResponseAsync(body, requestOptions); - } - - /** - * The withDef operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withDefWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withDefWithResponseAsync(body, requestOptions); - } - - /** - * The withDel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withDelWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withDelWithResponseAsync(body, requestOptions); - } - - /** - * The withElif operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withElifWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withElifWithResponseAsync(body, requestOptions); - } - - /** - * The withElse operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withElseWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withElseWithResponseAsync(body, requestOptions); - } - - /** - * The withExcept operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withExceptWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withExceptWithResponseAsync(body, requestOptions); - } - - /** - * The withExec operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withExecWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withExecWithResponseAsync(body, requestOptions); - } - - /** - * The withFinally operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withFinallyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withFinallyWithResponseAsync(body, requestOptions); - } - - /** - * The withFor operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withForWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withForWithResponseAsync(body, requestOptions); - } - - /** - * The withFrom operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withFromWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withFromWithResponseAsync(body, requestOptions); - } - - /** - * The withGlobal operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withGlobalWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withGlobalWithResponseAsync(body, requestOptions); - } - - /** - * The withIf operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withIfWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withIfWithResponseAsync(body, requestOptions); - } - - /** - * The withImport operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withImportWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withImportWithResponseAsync(body, requestOptions); - } - - /** - * The withIn operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withInWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withInWithResponseAsync(body, requestOptions); - } - - /** - * The withIs operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withIsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withIsWithResponseAsync(body, requestOptions); - } - - /** - * The withLambda operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withLambdaWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withLambdaWithResponseAsync(body, requestOptions); - } - - /** - * The withNot operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withNotWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withNotWithResponseAsync(body, requestOptions); - } - - /** - * The withOr operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withOrWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withOrWithResponseAsync(body, requestOptions); - } - - /** - * The withPass operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withPassWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withPassWithResponseAsync(body, requestOptions); - } - - /** - * The withRaise operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withRaiseWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withRaiseWithResponseAsync(body, requestOptions); - } - - /** - * The withReturn operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withReturnWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withReturnWithResponseAsync(body, requestOptions); - } - - /** - * The withTry operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withTryWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withTryWithResponseAsync(body, requestOptions); - } - - /** - * The withWhile operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withWhileWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withWhileWithResponseAsync(body, requestOptions); - } - - /** - * The withWith operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withWithWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withWithWithResponseAsync(body, requestOptions); - } - - /** - * The withYield operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withYieldWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withYieldWithResponseAsync(body, requestOptions); - } - - /** - * The withAnd operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withAnd(And body) { - // Generated convenience method for withAndWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withAndWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withAs operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withAs(As body) { - // Generated convenience method for withAsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withAsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withAssert operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withAssert(Assert body) { - // Generated convenience method for withAssertWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withAssertWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withAsync operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withAsync(Async body) { - // Generated convenience method for withAsyncWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withAsyncWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withAwait operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withAwait(Await body) { - // Generated convenience method for withAwaitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withAwaitWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withBreak operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withBreak(Break body) { - // Generated convenience method for withBreakWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withBreakWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withClass operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withClass(ClassModel body) { - // Generated convenience method for withClassWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withClassWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withConstructor operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withConstructor(Constructor body) { - // Generated convenience method for withConstructorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withConstructorWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withContinue operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withContinue(Continue body) { - // Generated convenience method for withContinueWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withContinueWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withDef operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withDef(Def body) { - // Generated convenience method for withDefWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withDefWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withDel operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withDel(Del body) { - // Generated convenience method for withDelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withDelWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withElif operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withElif(Elif body) { - // Generated convenience method for withElifWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withElifWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withElse operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withElse(Else body) { - // Generated convenience method for withElseWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withElseWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withExcept operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withExcept(Except body) { - // Generated convenience method for withExceptWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withExceptWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withExec operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withExec(Exec body) { - // Generated convenience method for withExecWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withExecWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withFinally operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withFinally(Finally body) { - // Generated convenience method for withFinallyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withFinallyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withFor operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withFor(For body) { - // Generated convenience method for withForWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withForWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withFrom operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withFrom(From body) { - // Generated convenience method for withFromWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withFromWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withGlobal operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withGlobal(Global body) { - // Generated convenience method for withGlobalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withGlobalWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withIf operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withIf(If body) { - // Generated convenience method for withIfWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withIfWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withImport operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withImport(Import body) { - // Generated convenience method for withImportWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withImportWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withIn operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withIn(In body) { - // Generated convenience method for withInWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withInWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withIs operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withIs(Is body) { - // Generated convenience method for withIsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withIsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withLambda operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withLambda(Lambda body) { - // Generated convenience method for withLambdaWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withLambdaWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withNot operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withNot(Not body) { - // Generated convenience method for withNotWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withNotWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withOr operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withOr(Or body) { - // Generated convenience method for withOrWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withOrWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withPass operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withPass(Pass body) { - // Generated convenience method for withPassWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withPassWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withRaise operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withRaise(Raise body) { - // Generated convenience method for withRaiseWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withRaiseWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withReturn operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withReturn(Return body) { - // Generated convenience method for withReturnWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withReturnWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withTry operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withTry(Try body) { - // Generated convenience method for withTryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withTryWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withWhile operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withWhile(While body) { - // Generated convenience method for withWhileWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withWhileWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withWith operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withWith(With body) { - // Generated convenience method for withWithWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withWithWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withYield operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withYield(Yield body) { - // Generated convenience method for withYieldWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withYieldWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsClient.java deleted file mode 100644 index d38e17b174e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsClient.java +++ /dev/null @@ -1,1555 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import specialwords.implementation.ModelsImpl; -import specialwords.models.models.And; -import specialwords.models.models.As; -import specialwords.models.models.Assert; -import specialwords.models.models.Async; -import specialwords.models.models.Await; -import specialwords.models.models.Break; -import specialwords.models.models.ClassModel; -import specialwords.models.models.Constructor; -import specialwords.models.models.Continue; -import specialwords.models.models.Def; -import specialwords.models.models.Del; -import specialwords.models.models.Elif; -import specialwords.models.models.Else; -import specialwords.models.models.Except; -import specialwords.models.models.Exec; -import specialwords.models.models.Finally; -import specialwords.models.models.For; -import specialwords.models.models.From; -import specialwords.models.models.Global; -import specialwords.models.models.If; -import specialwords.models.models.Import; -import specialwords.models.models.In; -import specialwords.models.models.Is; -import specialwords.models.models.Lambda; -import specialwords.models.models.Not; -import specialwords.models.models.Or; -import specialwords.models.models.Pass; -import specialwords.models.models.Raise; -import specialwords.models.models.Return; -import specialwords.models.models.Try; -import specialwords.models.models.While; -import specialwords.models.models.With; -import specialwords.models.models.Yield; - -/** - * Initializes a new instance of the synchronous SpecialWordsClient type. - */ -@ServiceClient(builder = SpecialWordsClientBuilder.class) -public final class ModelsClient { - @Generated - private final ModelsImpl serviceClient; - - /** - * Initializes an instance of ModelsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelsClient(ModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withAnd operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAndWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withAndWithResponse(body, requestOptions); - } - - /** - * The withAs operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withAsWithResponse(body, requestOptions); - } - - /** - * The withAssert operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAssertWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withAssertWithResponse(body, requestOptions); - } - - /** - * The withAsync operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAsyncWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withAsyncWithResponse(body, requestOptions); - } - - /** - * The withAwait operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAwaitWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withAwaitWithResponse(body, requestOptions); - } - - /** - * The withBreak operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withBreakWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withBreakWithResponse(body, requestOptions); - } - - /** - * The withClass operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withClassWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withClassWithResponse(body, requestOptions); - } - - /** - * The withConstructor operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withConstructorWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withConstructorWithResponse(body, requestOptions); - } - - /** - * The withContinue operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withContinueWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withContinueWithResponse(body, requestOptions); - } - - /** - * The withDef operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withDefWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withDefWithResponse(body, requestOptions); - } - - /** - * The withDel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withDelWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withDelWithResponse(body, requestOptions); - } - - /** - * The withElif operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withElifWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withElifWithResponse(body, requestOptions); - } - - /** - * The withElse operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withElseWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withElseWithResponse(body, requestOptions); - } - - /** - * The withExcept operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withExceptWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withExceptWithResponse(body, requestOptions); - } - - /** - * The withExec operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withExecWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withExecWithResponse(body, requestOptions); - } - - /** - * The withFinally operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withFinallyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withFinallyWithResponse(body, requestOptions); - } - - /** - * The withFor operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withForWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withForWithResponse(body, requestOptions); - } - - /** - * The withFrom operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withFromWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withFromWithResponse(body, requestOptions); - } - - /** - * The withGlobal operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withGlobalWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withGlobalWithResponse(body, requestOptions); - } - - /** - * The withIf operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withIfWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withIfWithResponse(body, requestOptions); - } - - /** - * The withImport operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withImportWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withImportWithResponse(body, requestOptions); - } - - /** - * The withIn operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withInWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withInWithResponse(body, requestOptions); - } - - /** - * The withIs operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withIsWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withIsWithResponse(body, requestOptions); - } - - /** - * The withLambda operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withLambdaWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withLambdaWithResponse(body, requestOptions); - } - - /** - * The withNot operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withNotWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withNotWithResponse(body, requestOptions); - } - - /** - * The withOr operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withOrWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withOrWithResponse(body, requestOptions); - } - - /** - * The withPass operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withPassWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withPassWithResponse(body, requestOptions); - } - - /** - * The withRaise operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withRaiseWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withRaiseWithResponse(body, requestOptions); - } - - /** - * The withReturn operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withReturnWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withReturnWithResponse(body, requestOptions); - } - - /** - * The withTry operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withTryWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withTryWithResponse(body, requestOptions); - } - - /** - * The withWhile operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withWhileWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withWhileWithResponse(body, requestOptions); - } - - /** - * The withWith operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withWithWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withWithWithResponse(body, requestOptions); - } - - /** - * The withYield operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withYieldWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.withYieldWithResponse(body, requestOptions); - } - - /** - * The withAnd operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withAnd(And body) { - // Generated convenience method for withAndWithResponse - RequestOptions requestOptions = new RequestOptions(); - withAndWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withAs operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withAs(As body) { - // Generated convenience method for withAsWithResponse - RequestOptions requestOptions = new RequestOptions(); - withAsWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withAssert operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withAssert(Assert body) { - // Generated convenience method for withAssertWithResponse - RequestOptions requestOptions = new RequestOptions(); - withAssertWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withAsync operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withAsync(Async body) { - // Generated convenience method for withAsyncWithResponse - RequestOptions requestOptions = new RequestOptions(); - withAsyncWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withAwait operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withAwait(Await body) { - // Generated convenience method for withAwaitWithResponse - RequestOptions requestOptions = new RequestOptions(); - withAwaitWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withBreak operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withBreak(Break body) { - // Generated convenience method for withBreakWithResponse - RequestOptions requestOptions = new RequestOptions(); - withBreakWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withClass operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withClass(ClassModel body) { - // Generated convenience method for withClassWithResponse - RequestOptions requestOptions = new RequestOptions(); - withClassWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withConstructor operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withConstructor(Constructor body) { - // Generated convenience method for withConstructorWithResponse - RequestOptions requestOptions = new RequestOptions(); - withConstructorWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withContinue operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withContinue(Continue body) { - // Generated convenience method for withContinueWithResponse - RequestOptions requestOptions = new RequestOptions(); - withContinueWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withDef operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withDef(Def body) { - // Generated convenience method for withDefWithResponse - RequestOptions requestOptions = new RequestOptions(); - withDefWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withDel operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withDel(Del body) { - // Generated convenience method for withDelWithResponse - RequestOptions requestOptions = new RequestOptions(); - withDelWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withElif operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withElif(Elif body) { - // Generated convenience method for withElifWithResponse - RequestOptions requestOptions = new RequestOptions(); - withElifWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withElse operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withElse(Else body) { - // Generated convenience method for withElseWithResponse - RequestOptions requestOptions = new RequestOptions(); - withElseWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withExcept operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withExcept(Except body) { - // Generated convenience method for withExceptWithResponse - RequestOptions requestOptions = new RequestOptions(); - withExceptWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withExec operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withExec(Exec body) { - // Generated convenience method for withExecWithResponse - RequestOptions requestOptions = new RequestOptions(); - withExecWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withFinally operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withFinally(Finally body) { - // Generated convenience method for withFinallyWithResponse - RequestOptions requestOptions = new RequestOptions(); - withFinallyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withFor operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withFor(For body) { - // Generated convenience method for withForWithResponse - RequestOptions requestOptions = new RequestOptions(); - withForWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withFrom operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withFrom(From body) { - // Generated convenience method for withFromWithResponse - RequestOptions requestOptions = new RequestOptions(); - withFromWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withGlobal operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withGlobal(Global body) { - // Generated convenience method for withGlobalWithResponse - RequestOptions requestOptions = new RequestOptions(); - withGlobalWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withIf operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withIf(If body) { - // Generated convenience method for withIfWithResponse - RequestOptions requestOptions = new RequestOptions(); - withIfWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withImport operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withImport(Import body) { - // Generated convenience method for withImportWithResponse - RequestOptions requestOptions = new RequestOptions(); - withImportWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withIn operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withIn(In body) { - // Generated convenience method for withInWithResponse - RequestOptions requestOptions = new RequestOptions(); - withInWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withIs operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withIs(Is body) { - // Generated convenience method for withIsWithResponse - RequestOptions requestOptions = new RequestOptions(); - withIsWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withLambda operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withLambda(Lambda body) { - // Generated convenience method for withLambdaWithResponse - RequestOptions requestOptions = new RequestOptions(); - withLambdaWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withNot operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withNot(Not body) { - // Generated convenience method for withNotWithResponse - RequestOptions requestOptions = new RequestOptions(); - withNotWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withOr operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withOr(Or body) { - // Generated convenience method for withOrWithResponse - RequestOptions requestOptions = new RequestOptions(); - withOrWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withPass operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withPass(Pass body) { - // Generated convenience method for withPassWithResponse - RequestOptions requestOptions = new RequestOptions(); - withPassWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withRaise operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withRaise(Raise body) { - // Generated convenience method for withRaiseWithResponse - RequestOptions requestOptions = new RequestOptions(); - withRaiseWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withReturn operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withReturn(Return body) { - // Generated convenience method for withReturnWithResponse - RequestOptions requestOptions = new RequestOptions(); - withReturnWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withTry operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withTry(Try body) { - // Generated convenience method for withTryWithResponse - RequestOptions requestOptions = new RequestOptions(); - withTryWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withWhile operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withWhile(While body) { - // Generated convenience method for withWhileWithResponse - RequestOptions requestOptions = new RequestOptions(); - withWhileWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withWith operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withWith(With body) { - // Generated convenience method for withWithWithResponse - RequestOptions requestOptions = new RequestOptions(); - withWithWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The withYield operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withYield(Yield body) { - // Generated convenience method for withYieldWithResponse - RequestOptions requestOptions = new RequestOptions(); - withYieldWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsAsyncClient.java deleted file mode 100644 index 9d05a1c885a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsAsyncClient.java +++ /dev/null @@ -1,1160 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import specialwords.implementation.OperationsImpl; - -/** - * Initializes a new instance of the asynchronous SpecialWordsClient type. - */ -@ServiceClient(builder = SpecialWordsClientBuilder.class, isAsync = true) -public final class OperationsAsyncClient { - @Generated - private final OperationsImpl serviceClient; - - /** - * Initializes an instance of OperationsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - OperationsAsyncClient(OperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The and operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> andWithResponse(RequestOptions requestOptions) { - return this.serviceClient.andWithResponseAsync(requestOptions); - } - - /** - * The as operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> asWithResponse(RequestOptions requestOptions) { - return this.serviceClient.asWithResponseAsync(requestOptions); - } - - /** - * The assertMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> assertMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.assertMethodWithResponseAsync(requestOptions); - } - - /** - * The async operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> asyncWithResponse(RequestOptions requestOptions) { - return this.serviceClient.asyncWithResponseAsync(requestOptions); - } - - /** - * The await operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> awaitWithResponse(RequestOptions requestOptions) { - return this.serviceClient.awaitWithResponseAsync(requestOptions); - } - - /** - * The breakMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> breakMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.breakMethodWithResponseAsync(requestOptions); - } - - /** - * The classMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> classMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.classMethodWithResponseAsync(requestOptions); - } - - /** - * The constructor operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> constructorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.constructorWithResponseAsync(requestOptions); - } - - /** - * The continueMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> continueMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.continueMethodWithResponseAsync(requestOptions); - } - - /** - * The def operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defWithResponse(RequestOptions requestOptions) { - return this.serviceClient.defWithResponseAsync(requestOptions); - } - - /** - * The del operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> delWithResponse(RequestOptions requestOptions) { - return this.serviceClient.delWithResponseAsync(requestOptions); - } - - /** - * The elif operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> elifWithResponse(RequestOptions requestOptions) { - return this.serviceClient.elifWithResponseAsync(requestOptions); - } - - /** - * The elseMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> elseMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.elseMethodWithResponseAsync(requestOptions); - } - - /** - * The except operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> exceptWithResponse(RequestOptions requestOptions) { - return this.serviceClient.exceptWithResponseAsync(requestOptions); - } - - /** - * The exec operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> execWithResponse(RequestOptions requestOptions) { - return this.serviceClient.execWithResponseAsync(requestOptions); - } - - /** - * The finallyMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> finallyMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.finallyMethodWithResponseAsync(requestOptions); - } - - /** - * The forMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> forMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.forMethodWithResponseAsync(requestOptions); - } - - /** - * The from operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fromWithResponseAsync(requestOptions); - } - - /** - * The global operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> globalWithResponse(RequestOptions requestOptions) { - return this.serviceClient.globalWithResponseAsync(requestOptions); - } - - /** - * The ifMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> ifMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.ifMethodWithResponseAsync(requestOptions); - } - - /** - * The importMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> importMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.importMethodWithResponseAsync(requestOptions); - } - - /** - * The in operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> inWithResponse(RequestOptions requestOptions) { - return this.serviceClient.inWithResponseAsync(requestOptions); - } - - /** - * The is operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> isWithResponse(RequestOptions requestOptions) { - return this.serviceClient.isWithResponseAsync(requestOptions); - } - - /** - * The lambda operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> lambdaWithResponse(RequestOptions requestOptions) { - return this.serviceClient.lambdaWithResponseAsync(requestOptions); - } - - /** - * The not operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> notWithResponse(RequestOptions requestOptions) { - return this.serviceClient.notWithResponseAsync(requestOptions); - } - - /** - * The or operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> orWithResponse(RequestOptions requestOptions) { - return this.serviceClient.orWithResponseAsync(requestOptions); - } - - /** - * The pass operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> passWithResponse(RequestOptions requestOptions) { - return this.serviceClient.passWithResponseAsync(requestOptions); - } - - /** - * The raise operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> raiseWithResponse(RequestOptions requestOptions) { - return this.serviceClient.raiseWithResponseAsync(requestOptions); - } - - /** - * The returnMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> returnMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.returnMethodWithResponseAsync(requestOptions); - } - - /** - * The tryMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> tryMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.tryMethodWithResponseAsync(requestOptions); - } - - /** - * The whileMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> whileMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.whileMethodWithResponseAsync(requestOptions); - } - - /** - * The with operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withWithResponseAsync(requestOptions); - } - - /** - * The yield operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> yieldWithResponse(RequestOptions requestOptions) { - return this.serviceClient.yieldWithResponseAsync(requestOptions); - } - - /** - * The and operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono and() { - // Generated convenience method for andWithResponse - RequestOptions requestOptions = new RequestOptions(); - return andWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The as operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono as() { - // Generated convenience method for asWithResponse - RequestOptions requestOptions = new RequestOptions(); - return asWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The assertMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono assertMethod() { - // Generated convenience method for assertMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return assertMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The async operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono async() { - // Generated convenience method for asyncWithResponse - RequestOptions requestOptions = new RequestOptions(); - return asyncWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The await operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono await() { - // Generated convenience method for awaitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return awaitWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The breakMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono breakMethod() { - // Generated convenience method for breakMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return breakMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The classMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono classMethod() { - // Generated convenience method for classMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return classMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The constructor operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono constructor() { - // Generated convenience method for constructorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return constructorWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The continueMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono continueMethod() { - // Generated convenience method for continueMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return continueMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The def operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono def() { - // Generated convenience method for defWithResponse - RequestOptions requestOptions = new RequestOptions(); - return defWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The del operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono del() { - // Generated convenience method for delWithResponse - RequestOptions requestOptions = new RequestOptions(); - return delWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The elif operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono elif() { - // Generated convenience method for elifWithResponse - RequestOptions requestOptions = new RequestOptions(); - return elifWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The elseMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono elseMethod() { - // Generated convenience method for elseMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return elseMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The except operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono except() { - // Generated convenience method for exceptWithResponse - RequestOptions requestOptions = new RequestOptions(); - return exceptWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The exec operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono exec() { - // Generated convenience method for execWithResponse - RequestOptions requestOptions = new RequestOptions(); - return execWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The finallyMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono finallyMethod() { - // Generated convenience method for finallyMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return finallyMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The forMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono forMethod() { - // Generated convenience method for forMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return forMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The from operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono from() { - // Generated convenience method for fromWithResponse - RequestOptions requestOptions = new RequestOptions(); - return fromWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The global operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono global() { - // Generated convenience method for globalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return globalWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The ifMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono ifMethod() { - // Generated convenience method for ifMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return ifMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The importMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono importMethod() { - // Generated convenience method for importMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return importMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The in operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono in() { - // Generated convenience method for inWithResponse - RequestOptions requestOptions = new RequestOptions(); - return inWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The is operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono is() { - // Generated convenience method for isWithResponse - RequestOptions requestOptions = new RequestOptions(); - return isWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The lambda operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono lambda() { - // Generated convenience method for lambdaWithResponse - RequestOptions requestOptions = new RequestOptions(); - return lambdaWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The not operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono not() { - // Generated convenience method for notWithResponse - RequestOptions requestOptions = new RequestOptions(); - return notWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The or operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono or() { - // Generated convenience method for orWithResponse - RequestOptions requestOptions = new RequestOptions(); - return orWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The pass operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono pass() { - // Generated convenience method for passWithResponse - RequestOptions requestOptions = new RequestOptions(); - return passWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The raise operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono raise() { - // Generated convenience method for raiseWithResponse - RequestOptions requestOptions = new RequestOptions(); - return raiseWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The returnMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono returnMethod() { - // Generated convenience method for returnMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return returnMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The tryMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono tryMethod() { - // Generated convenience method for tryMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return tryMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The whileMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono whileMethod() { - // Generated convenience method for whileMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - return whileMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The with operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono with() { - // Generated convenience method for withWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The yield operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono yield() { - // Generated convenience method for yieldWithResponse - RequestOptions requestOptions = new RequestOptions(); - return yieldWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsClient.java deleted file mode 100644 index d34a5fd6991..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsClient.java +++ /dev/null @@ -1,1125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import specialwords.implementation.OperationsImpl; - -/** - * Initializes a new instance of the synchronous SpecialWordsClient type. - */ -@ServiceClient(builder = SpecialWordsClientBuilder.class) -public final class OperationsClient { - @Generated - private final OperationsImpl serviceClient; - - /** - * Initializes an instance of OperationsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - OperationsClient(OperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The and operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response andWithResponse(RequestOptions requestOptions) { - return this.serviceClient.andWithResponse(requestOptions); - } - - /** - * The as operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response asWithResponse(RequestOptions requestOptions) { - return this.serviceClient.asWithResponse(requestOptions); - } - - /** - * The assertMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response assertMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.assertMethodWithResponse(requestOptions); - } - - /** - * The async operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response asyncWithResponse(RequestOptions requestOptions) { - return this.serviceClient.asyncWithResponse(requestOptions); - } - - /** - * The await operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response awaitWithResponse(RequestOptions requestOptions) { - return this.serviceClient.awaitWithResponse(requestOptions); - } - - /** - * The breakMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response breakMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.breakMethodWithResponse(requestOptions); - } - - /** - * The classMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response classMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.classMethodWithResponse(requestOptions); - } - - /** - * The constructor operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response constructorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.constructorWithResponse(requestOptions); - } - - /** - * The continueMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response continueMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.continueMethodWithResponse(requestOptions); - } - - /** - * The def operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defWithResponse(RequestOptions requestOptions) { - return this.serviceClient.defWithResponse(requestOptions); - } - - /** - * The del operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response delWithResponse(RequestOptions requestOptions) { - return this.serviceClient.delWithResponse(requestOptions); - } - - /** - * The elif operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response elifWithResponse(RequestOptions requestOptions) { - return this.serviceClient.elifWithResponse(requestOptions); - } - - /** - * The elseMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response elseMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.elseMethodWithResponse(requestOptions); - } - - /** - * The except operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response exceptWithResponse(RequestOptions requestOptions) { - return this.serviceClient.exceptWithResponse(requestOptions); - } - - /** - * The exec operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response execWithResponse(RequestOptions requestOptions) { - return this.serviceClient.execWithResponse(requestOptions); - } - - /** - * The finallyMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response finallyMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.finallyMethodWithResponse(requestOptions); - } - - /** - * The forMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response forMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.forMethodWithResponse(requestOptions); - } - - /** - * The from operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromWithResponse(RequestOptions requestOptions) { - return this.serviceClient.fromWithResponse(requestOptions); - } - - /** - * The global operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response globalWithResponse(RequestOptions requestOptions) { - return this.serviceClient.globalWithResponse(requestOptions); - } - - /** - * The ifMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response ifMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.ifMethodWithResponse(requestOptions); - } - - /** - * The importMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response importMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.importMethodWithResponse(requestOptions); - } - - /** - * The in operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response inWithResponse(RequestOptions requestOptions) { - return this.serviceClient.inWithResponse(requestOptions); - } - - /** - * The is operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response isWithResponse(RequestOptions requestOptions) { - return this.serviceClient.isWithResponse(requestOptions); - } - - /** - * The lambda operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response lambdaWithResponse(RequestOptions requestOptions) { - return this.serviceClient.lambdaWithResponse(requestOptions); - } - - /** - * The not operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response notWithResponse(RequestOptions requestOptions) { - return this.serviceClient.notWithResponse(requestOptions); - } - - /** - * The or operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response orWithResponse(RequestOptions requestOptions) { - return this.serviceClient.orWithResponse(requestOptions); - } - - /** - * The pass operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response passWithResponse(RequestOptions requestOptions) { - return this.serviceClient.passWithResponse(requestOptions); - } - - /** - * The raise operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response raiseWithResponse(RequestOptions requestOptions) { - return this.serviceClient.raiseWithResponse(requestOptions); - } - - /** - * The returnMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response returnMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.returnMethodWithResponse(requestOptions); - } - - /** - * The tryMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response tryMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.tryMethodWithResponse(requestOptions); - } - - /** - * The whileMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response whileMethodWithResponse(RequestOptions requestOptions) { - return this.serviceClient.whileMethodWithResponse(requestOptions); - } - - /** - * The with operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withWithResponse(RequestOptions requestOptions) { - return this.serviceClient.withWithResponse(requestOptions); - } - - /** - * The yield operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response yieldWithResponse(RequestOptions requestOptions) { - return this.serviceClient.yieldWithResponse(requestOptions); - } - - /** - * The and operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void and() { - // Generated convenience method for andWithResponse - RequestOptions requestOptions = new RequestOptions(); - andWithResponse(requestOptions).getValue(); - } - - /** - * The as operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void as() { - // Generated convenience method for asWithResponse - RequestOptions requestOptions = new RequestOptions(); - asWithResponse(requestOptions).getValue(); - } - - /** - * The assertMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void assertMethod() { - // Generated convenience method for assertMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - assertMethodWithResponse(requestOptions).getValue(); - } - - /** - * The async operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void async() { - // Generated convenience method for asyncWithResponse - RequestOptions requestOptions = new RequestOptions(); - asyncWithResponse(requestOptions).getValue(); - } - - /** - * The await operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void await() { - // Generated convenience method for awaitWithResponse - RequestOptions requestOptions = new RequestOptions(); - awaitWithResponse(requestOptions).getValue(); - } - - /** - * The breakMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void breakMethod() { - // Generated convenience method for breakMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - breakMethodWithResponse(requestOptions).getValue(); - } - - /** - * The classMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void classMethod() { - // Generated convenience method for classMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - classMethodWithResponse(requestOptions).getValue(); - } - - /** - * The constructor operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void constructor() { - // Generated convenience method for constructorWithResponse - RequestOptions requestOptions = new RequestOptions(); - constructorWithResponse(requestOptions).getValue(); - } - - /** - * The continueMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void continueMethod() { - // Generated convenience method for continueMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - continueMethodWithResponse(requestOptions).getValue(); - } - - /** - * The def operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void def() { - // Generated convenience method for defWithResponse - RequestOptions requestOptions = new RequestOptions(); - defWithResponse(requestOptions).getValue(); - } - - /** - * The del operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void del() { - // Generated convenience method for delWithResponse - RequestOptions requestOptions = new RequestOptions(); - delWithResponse(requestOptions).getValue(); - } - - /** - * The elif operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void elif() { - // Generated convenience method for elifWithResponse - RequestOptions requestOptions = new RequestOptions(); - elifWithResponse(requestOptions).getValue(); - } - - /** - * The elseMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void elseMethod() { - // Generated convenience method for elseMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - elseMethodWithResponse(requestOptions).getValue(); - } - - /** - * The except operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void except() { - // Generated convenience method for exceptWithResponse - RequestOptions requestOptions = new RequestOptions(); - exceptWithResponse(requestOptions).getValue(); - } - - /** - * The exec operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void exec() { - // Generated convenience method for execWithResponse - RequestOptions requestOptions = new RequestOptions(); - execWithResponse(requestOptions).getValue(); - } - - /** - * The finallyMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void finallyMethod() { - // Generated convenience method for finallyMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - finallyMethodWithResponse(requestOptions).getValue(); - } - - /** - * The forMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void forMethod() { - // Generated convenience method for forMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - forMethodWithResponse(requestOptions).getValue(); - } - - /** - * The from operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void from() { - // Generated convenience method for fromWithResponse - RequestOptions requestOptions = new RequestOptions(); - fromWithResponse(requestOptions).getValue(); - } - - /** - * The global operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void global() { - // Generated convenience method for globalWithResponse - RequestOptions requestOptions = new RequestOptions(); - globalWithResponse(requestOptions).getValue(); - } - - /** - * The ifMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void ifMethod() { - // Generated convenience method for ifMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - ifMethodWithResponse(requestOptions).getValue(); - } - - /** - * The importMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void importMethod() { - // Generated convenience method for importMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - importMethodWithResponse(requestOptions).getValue(); - } - - /** - * The in operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void in() { - // Generated convenience method for inWithResponse - RequestOptions requestOptions = new RequestOptions(); - inWithResponse(requestOptions).getValue(); - } - - /** - * The is operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void is() { - // Generated convenience method for isWithResponse - RequestOptions requestOptions = new RequestOptions(); - isWithResponse(requestOptions).getValue(); - } - - /** - * The lambda operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void lambda() { - // Generated convenience method for lambdaWithResponse - RequestOptions requestOptions = new RequestOptions(); - lambdaWithResponse(requestOptions).getValue(); - } - - /** - * The not operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void not() { - // Generated convenience method for notWithResponse - RequestOptions requestOptions = new RequestOptions(); - notWithResponse(requestOptions).getValue(); - } - - /** - * The or operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void or() { - // Generated convenience method for orWithResponse - RequestOptions requestOptions = new RequestOptions(); - orWithResponse(requestOptions).getValue(); - } - - /** - * The pass operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void pass() { - // Generated convenience method for passWithResponse - RequestOptions requestOptions = new RequestOptions(); - passWithResponse(requestOptions).getValue(); - } - - /** - * The raise operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void raise() { - // Generated convenience method for raiseWithResponse - RequestOptions requestOptions = new RequestOptions(); - raiseWithResponse(requestOptions).getValue(); - } - - /** - * The returnMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void returnMethod() { - // Generated convenience method for returnMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - returnMethodWithResponse(requestOptions).getValue(); - } - - /** - * The tryMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void tryMethod() { - // Generated convenience method for tryMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - tryMethodWithResponse(requestOptions).getValue(); - } - - /** - * The whileMethod operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void whileMethod() { - // Generated convenience method for whileMethodWithResponse - RequestOptions requestOptions = new RequestOptions(); - whileMethodWithResponse(requestOptions).getValue(); - } - - /** - * The with operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void with() { - // Generated convenience method for withWithResponse - RequestOptions requestOptions = new RequestOptions(); - withWithResponse(requestOptions).getValue(); - } - - /** - * The yield operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void yield() { - // Generated convenience method for yieldWithResponse - RequestOptions requestOptions = new RequestOptions(); - yieldWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersAsyncClient.java deleted file mode 100644 index 9d263bdea57..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersAsyncClient.java +++ /dev/null @@ -1,1297 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import specialwords.implementation.ParametersImpl; - -/** - * Initializes a new instance of the asynchronous SpecialWordsClient type. - */ -@ServiceClient(builder = SpecialWordsClientBuilder.class, isAsync = true) -public final class ParametersAsyncClient { - @Generated - private final ParametersImpl serviceClient; - - /** - * Initializes an instance of ParametersAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ParametersAsyncClient(ParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withAnd operation. - * - * @param and The and parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAndWithResponse(String and, RequestOptions requestOptions) { - return this.serviceClient.withAndWithResponseAsync(and, requestOptions); - } - - /** - * The withAs operation. - * - * @param as The as parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAsWithResponse(String as, RequestOptions requestOptions) { - return this.serviceClient.withAsWithResponseAsync(as, requestOptions); - } - - /** - * The withAssert operation. - * - * @param assertParameter The assertParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAssertWithResponse(String assertParameter, RequestOptions requestOptions) { - return this.serviceClient.withAssertWithResponseAsync(assertParameter, requestOptions); - } - - /** - * The withAsync operation. - * - * @param async The async parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAsyncWithResponse(String async, RequestOptions requestOptions) { - return this.serviceClient.withAsyncWithResponseAsync(async, requestOptions); - } - - /** - * The withAwait operation. - * - * @param await The await parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAwaitWithResponse(String await, RequestOptions requestOptions) { - return this.serviceClient.withAwaitWithResponseAsync(await, requestOptions); - } - - /** - * The withBreak operation. - * - * @param breakParameter The breakParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withBreakWithResponse(String breakParameter, RequestOptions requestOptions) { - return this.serviceClient.withBreakWithResponseAsync(breakParameter, requestOptions); - } - - /** - * The withClass operation. - * - * @param classParameter The classParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withClassWithResponse(String classParameter, RequestOptions requestOptions) { - return this.serviceClient.withClassWithResponseAsync(classParameter, requestOptions); - } - - /** - * The withConstructor operation. - * - * @param constructor The constructor parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withConstructorWithResponse(String constructor, RequestOptions requestOptions) { - return this.serviceClient.withConstructorWithResponseAsync(constructor, requestOptions); - } - - /** - * The withContinue operation. - * - * @param continueParameter The continueParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withContinueWithResponse(String continueParameter, RequestOptions requestOptions) { - return this.serviceClient.withContinueWithResponseAsync(continueParameter, requestOptions); - } - - /** - * The withDef operation. - * - * @param def The def parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withDefWithResponse(String def, RequestOptions requestOptions) { - return this.serviceClient.withDefWithResponseAsync(def, requestOptions); - } - - /** - * The withDel operation. - * - * @param del The del parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withDelWithResponse(String del, RequestOptions requestOptions) { - return this.serviceClient.withDelWithResponseAsync(del, requestOptions); - } - - /** - * The withElif operation. - * - * @param elif The elif parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withElifWithResponse(String elif, RequestOptions requestOptions) { - return this.serviceClient.withElifWithResponseAsync(elif, requestOptions); - } - - /** - * The withElse operation. - * - * @param elseParameter The elseParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withElseWithResponse(String elseParameter, RequestOptions requestOptions) { - return this.serviceClient.withElseWithResponseAsync(elseParameter, requestOptions); - } - - /** - * The withExcept operation. - * - * @param except The except parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withExceptWithResponse(String except, RequestOptions requestOptions) { - return this.serviceClient.withExceptWithResponseAsync(except, requestOptions); - } - - /** - * The withExec operation. - * - * @param exec The exec parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withExecWithResponse(String exec, RequestOptions requestOptions) { - return this.serviceClient.withExecWithResponseAsync(exec, requestOptions); - } - - /** - * The withFinally operation. - * - * @param finallyParameter The finallyParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withFinallyWithResponse(String finallyParameter, RequestOptions requestOptions) { - return this.serviceClient.withFinallyWithResponseAsync(finallyParameter, requestOptions); - } - - /** - * The withFor operation. - * - * @param forParameter The forParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withForWithResponse(String forParameter, RequestOptions requestOptions) { - return this.serviceClient.withForWithResponseAsync(forParameter, requestOptions); - } - - /** - * The withFrom operation. - * - * @param from The from parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withFromWithResponse(String from, RequestOptions requestOptions) { - return this.serviceClient.withFromWithResponseAsync(from, requestOptions); - } - - /** - * The withGlobal operation. - * - * @param global The global parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withGlobalWithResponse(String global, RequestOptions requestOptions) { - return this.serviceClient.withGlobalWithResponseAsync(global, requestOptions); - } - - /** - * The withIf operation. - * - * @param ifParameter The ifParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withIfWithResponse(String ifParameter, RequestOptions requestOptions) { - return this.serviceClient.withIfWithResponseAsync(ifParameter, requestOptions); - } - - /** - * The withImport operation. - * - * @param importParameter The importParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withImportWithResponse(String importParameter, RequestOptions requestOptions) { - return this.serviceClient.withImportWithResponseAsync(importParameter, requestOptions); - } - - /** - * The withIn operation. - * - * @param in The in parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withInWithResponse(String in, RequestOptions requestOptions) { - return this.serviceClient.withInWithResponseAsync(in, requestOptions); - } - - /** - * The withIs operation. - * - * @param is The is parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withIsWithResponse(String is, RequestOptions requestOptions) { - return this.serviceClient.withIsWithResponseAsync(is, requestOptions); - } - - /** - * The withLambda operation. - * - * @param lambda The lambda parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withLambdaWithResponse(String lambda, RequestOptions requestOptions) { - return this.serviceClient.withLambdaWithResponseAsync(lambda, requestOptions); - } - - /** - * The withNot operation. - * - * @param not The not parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withNotWithResponse(String not, RequestOptions requestOptions) { - return this.serviceClient.withNotWithResponseAsync(not, requestOptions); - } - - /** - * The withOr operation. - * - * @param or The or parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withOrWithResponse(String or, RequestOptions requestOptions) { - return this.serviceClient.withOrWithResponseAsync(or, requestOptions); - } - - /** - * The withPass operation. - * - * @param pass The pass parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withPassWithResponse(String pass, RequestOptions requestOptions) { - return this.serviceClient.withPassWithResponseAsync(pass, requestOptions); - } - - /** - * The withRaise operation. - * - * @param raise The raise parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withRaiseWithResponse(String raise, RequestOptions requestOptions) { - return this.serviceClient.withRaiseWithResponseAsync(raise, requestOptions); - } - - /** - * The withReturn operation. - * - * @param returnParameter The returnParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withReturnWithResponse(String returnParameter, RequestOptions requestOptions) { - return this.serviceClient.withReturnWithResponseAsync(returnParameter, requestOptions); - } - - /** - * The withTry operation. - * - * @param tryParameter The tryParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withTryWithResponse(String tryParameter, RequestOptions requestOptions) { - return this.serviceClient.withTryWithResponseAsync(tryParameter, requestOptions); - } - - /** - * The withWhile operation. - * - * @param whileParameter The whileParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withWhileWithResponse(String whileParameter, RequestOptions requestOptions) { - return this.serviceClient.withWhileWithResponseAsync(whileParameter, requestOptions); - } - - /** - * The withWith operation. - * - * @param with The with parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withWithWithResponse(String with, RequestOptions requestOptions) { - return this.serviceClient.withWithWithResponseAsync(with, requestOptions); - } - - /** - * The withYield operation. - * - * @param yield The yield parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withYieldWithResponse(String yield, RequestOptions requestOptions) { - return this.serviceClient.withYieldWithResponseAsync(yield, requestOptions); - } - - /** - * The withCancellationToken operation. - * - * @param cancellationToken The cancellationToken parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withCancellationTokenWithResponse(String cancellationToken, - RequestOptions requestOptions) { - return this.serviceClient.withCancellationTokenWithResponseAsync(cancellationToken, requestOptions); - } - - /** - * The withAnd operation. - * - * @param and The and parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withAnd(String and) { - // Generated convenience method for withAndWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withAndWithResponse(and, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withAs operation. - * - * @param as The as parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withAs(String as) { - // Generated convenience method for withAsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withAsWithResponse(as, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withAssert operation. - * - * @param assertParameter The assertParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withAssert(String assertParameter) { - // Generated convenience method for withAssertWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withAssertWithResponse(assertParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withAsync operation. - * - * @param async The async parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withAsync(String async) { - // Generated convenience method for withAsyncWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withAsyncWithResponse(async, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withAwait operation. - * - * @param await The await parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withAwait(String await) { - // Generated convenience method for withAwaitWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withAwaitWithResponse(await, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withBreak operation. - * - * @param breakParameter The breakParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withBreak(String breakParameter) { - // Generated convenience method for withBreakWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withBreakWithResponse(breakParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withClass operation. - * - * @param classParameter The classParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withClass(String classParameter) { - // Generated convenience method for withClassWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withClassWithResponse(classParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withConstructor operation. - * - * @param constructor The constructor parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withConstructor(String constructor) { - // Generated convenience method for withConstructorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withConstructorWithResponse(constructor, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withContinue operation. - * - * @param continueParameter The continueParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withContinue(String continueParameter) { - // Generated convenience method for withContinueWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withContinueWithResponse(continueParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withDef operation. - * - * @param def The def parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withDef(String def) { - // Generated convenience method for withDefWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withDefWithResponse(def, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withDel operation. - * - * @param del The del parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withDel(String del) { - // Generated convenience method for withDelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withDelWithResponse(del, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withElif operation. - * - * @param elif The elif parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withElif(String elif) { - // Generated convenience method for withElifWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withElifWithResponse(elif, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withElse operation. - * - * @param elseParameter The elseParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withElse(String elseParameter) { - // Generated convenience method for withElseWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withElseWithResponse(elseParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withExcept operation. - * - * @param except The except parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withExcept(String except) { - // Generated convenience method for withExceptWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withExceptWithResponse(except, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withExec operation. - * - * @param exec The exec parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withExec(String exec) { - // Generated convenience method for withExecWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withExecWithResponse(exec, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withFinally operation. - * - * @param finallyParameter The finallyParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withFinally(String finallyParameter) { - // Generated convenience method for withFinallyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withFinallyWithResponse(finallyParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withFor operation. - * - * @param forParameter The forParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withFor(String forParameter) { - // Generated convenience method for withForWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withForWithResponse(forParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withFrom operation. - * - * @param from The from parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withFrom(String from) { - // Generated convenience method for withFromWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withFromWithResponse(from, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withGlobal operation. - * - * @param global The global parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withGlobal(String global) { - // Generated convenience method for withGlobalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withGlobalWithResponse(global, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withIf operation. - * - * @param ifParameter The ifParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withIf(String ifParameter) { - // Generated convenience method for withIfWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withIfWithResponse(ifParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withImport operation. - * - * @param importParameter The importParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withImport(String importParameter) { - // Generated convenience method for withImportWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withImportWithResponse(importParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withIn operation. - * - * @param in The in parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withIn(String in) { - // Generated convenience method for withInWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withInWithResponse(in, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withIs operation. - * - * @param is The is parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withIs(String is) { - // Generated convenience method for withIsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withIsWithResponse(is, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withLambda operation. - * - * @param lambda The lambda parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withLambda(String lambda) { - // Generated convenience method for withLambdaWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withLambdaWithResponse(lambda, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withNot operation. - * - * @param not The not parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withNot(String not) { - // Generated convenience method for withNotWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withNotWithResponse(not, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withOr operation. - * - * @param or The or parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withOr(String or) { - // Generated convenience method for withOrWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withOrWithResponse(or, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withPass operation. - * - * @param pass The pass parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withPass(String pass) { - // Generated convenience method for withPassWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withPassWithResponse(pass, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withRaise operation. - * - * @param raise The raise parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withRaise(String raise) { - // Generated convenience method for withRaiseWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withRaiseWithResponse(raise, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withReturn operation. - * - * @param returnParameter The returnParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withReturn(String returnParameter) { - // Generated convenience method for withReturnWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withReturnWithResponse(returnParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withTry operation. - * - * @param tryParameter The tryParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withTry(String tryParameter) { - // Generated convenience method for withTryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withTryWithResponse(tryParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withWhile operation. - * - * @param whileParameter The whileParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withWhile(String whileParameter) { - // Generated convenience method for withWhileWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withWhileWithResponse(whileParameter, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withWith operation. - * - * @param with The with parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withWith(String with) { - // Generated convenience method for withWithWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withWithWithResponse(with, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withYield operation. - * - * @param yield The yield parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withYield(String yield) { - // Generated convenience method for withYieldWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withYieldWithResponse(yield, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The withCancellationToken operation. - * - * @param cancellationToken The cancellationToken parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono withCancellationToken(String cancellationToken) { - // Generated convenience method for withCancellationTokenWithResponse - RequestOptions requestOptions = new RequestOptions(); - return withCancellationTokenWithResponse(cancellationToken, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersClient.java deleted file mode 100644 index 12066239656..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersClient.java +++ /dev/null @@ -1,1260 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import specialwords.implementation.ParametersImpl; - -/** - * Initializes a new instance of the synchronous SpecialWordsClient type. - */ -@ServiceClient(builder = SpecialWordsClientBuilder.class) -public final class ParametersClient { - @Generated - private final ParametersImpl serviceClient; - - /** - * Initializes an instance of ParametersClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ParametersClient(ParametersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The withAnd operation. - * - * @param and The and parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAndWithResponse(String and, RequestOptions requestOptions) { - return this.serviceClient.withAndWithResponse(and, requestOptions); - } - - /** - * The withAs operation. - * - * @param as The as parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAsWithResponse(String as, RequestOptions requestOptions) { - return this.serviceClient.withAsWithResponse(as, requestOptions); - } - - /** - * The withAssert operation. - * - * @param assertParameter The assertParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAssertWithResponse(String assertParameter, RequestOptions requestOptions) { - return this.serviceClient.withAssertWithResponse(assertParameter, requestOptions); - } - - /** - * The withAsync operation. - * - * @param async The async parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAsyncWithResponse(String async, RequestOptions requestOptions) { - return this.serviceClient.withAsyncWithResponse(async, requestOptions); - } - - /** - * The withAwait operation. - * - * @param await The await parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAwaitWithResponse(String await, RequestOptions requestOptions) { - return this.serviceClient.withAwaitWithResponse(await, requestOptions); - } - - /** - * The withBreak operation. - * - * @param breakParameter The breakParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withBreakWithResponse(String breakParameter, RequestOptions requestOptions) { - return this.serviceClient.withBreakWithResponse(breakParameter, requestOptions); - } - - /** - * The withClass operation. - * - * @param classParameter The classParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withClassWithResponse(String classParameter, RequestOptions requestOptions) { - return this.serviceClient.withClassWithResponse(classParameter, requestOptions); - } - - /** - * The withConstructor operation. - * - * @param constructor The constructor parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withConstructorWithResponse(String constructor, RequestOptions requestOptions) { - return this.serviceClient.withConstructorWithResponse(constructor, requestOptions); - } - - /** - * The withContinue operation. - * - * @param continueParameter The continueParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withContinueWithResponse(String continueParameter, RequestOptions requestOptions) { - return this.serviceClient.withContinueWithResponse(continueParameter, requestOptions); - } - - /** - * The withDef operation. - * - * @param def The def parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withDefWithResponse(String def, RequestOptions requestOptions) { - return this.serviceClient.withDefWithResponse(def, requestOptions); - } - - /** - * The withDel operation. - * - * @param del The del parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withDelWithResponse(String del, RequestOptions requestOptions) { - return this.serviceClient.withDelWithResponse(del, requestOptions); - } - - /** - * The withElif operation. - * - * @param elif The elif parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withElifWithResponse(String elif, RequestOptions requestOptions) { - return this.serviceClient.withElifWithResponse(elif, requestOptions); - } - - /** - * The withElse operation. - * - * @param elseParameter The elseParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withElseWithResponse(String elseParameter, RequestOptions requestOptions) { - return this.serviceClient.withElseWithResponse(elseParameter, requestOptions); - } - - /** - * The withExcept operation. - * - * @param except The except parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withExceptWithResponse(String except, RequestOptions requestOptions) { - return this.serviceClient.withExceptWithResponse(except, requestOptions); - } - - /** - * The withExec operation. - * - * @param exec The exec parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withExecWithResponse(String exec, RequestOptions requestOptions) { - return this.serviceClient.withExecWithResponse(exec, requestOptions); - } - - /** - * The withFinally operation. - * - * @param finallyParameter The finallyParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withFinallyWithResponse(String finallyParameter, RequestOptions requestOptions) { - return this.serviceClient.withFinallyWithResponse(finallyParameter, requestOptions); - } - - /** - * The withFor operation. - * - * @param forParameter The forParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withForWithResponse(String forParameter, RequestOptions requestOptions) { - return this.serviceClient.withForWithResponse(forParameter, requestOptions); - } - - /** - * The withFrom operation. - * - * @param from The from parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withFromWithResponse(String from, RequestOptions requestOptions) { - return this.serviceClient.withFromWithResponse(from, requestOptions); - } - - /** - * The withGlobal operation. - * - * @param global The global parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withGlobalWithResponse(String global, RequestOptions requestOptions) { - return this.serviceClient.withGlobalWithResponse(global, requestOptions); - } - - /** - * The withIf operation. - * - * @param ifParameter The ifParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withIfWithResponse(String ifParameter, RequestOptions requestOptions) { - return this.serviceClient.withIfWithResponse(ifParameter, requestOptions); - } - - /** - * The withImport operation. - * - * @param importParameter The importParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withImportWithResponse(String importParameter, RequestOptions requestOptions) { - return this.serviceClient.withImportWithResponse(importParameter, requestOptions); - } - - /** - * The withIn operation. - * - * @param in The in parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withInWithResponse(String in, RequestOptions requestOptions) { - return this.serviceClient.withInWithResponse(in, requestOptions); - } - - /** - * The withIs operation. - * - * @param is The is parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withIsWithResponse(String is, RequestOptions requestOptions) { - return this.serviceClient.withIsWithResponse(is, requestOptions); - } - - /** - * The withLambda operation. - * - * @param lambda The lambda parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withLambdaWithResponse(String lambda, RequestOptions requestOptions) { - return this.serviceClient.withLambdaWithResponse(lambda, requestOptions); - } - - /** - * The withNot operation. - * - * @param not The not parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withNotWithResponse(String not, RequestOptions requestOptions) { - return this.serviceClient.withNotWithResponse(not, requestOptions); - } - - /** - * The withOr operation. - * - * @param or The or parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withOrWithResponse(String or, RequestOptions requestOptions) { - return this.serviceClient.withOrWithResponse(or, requestOptions); - } - - /** - * The withPass operation. - * - * @param pass The pass parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withPassWithResponse(String pass, RequestOptions requestOptions) { - return this.serviceClient.withPassWithResponse(pass, requestOptions); - } - - /** - * The withRaise operation. - * - * @param raise The raise parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withRaiseWithResponse(String raise, RequestOptions requestOptions) { - return this.serviceClient.withRaiseWithResponse(raise, requestOptions); - } - - /** - * The withReturn operation. - * - * @param returnParameter The returnParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withReturnWithResponse(String returnParameter, RequestOptions requestOptions) { - return this.serviceClient.withReturnWithResponse(returnParameter, requestOptions); - } - - /** - * The withTry operation. - * - * @param tryParameter The tryParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withTryWithResponse(String tryParameter, RequestOptions requestOptions) { - return this.serviceClient.withTryWithResponse(tryParameter, requestOptions); - } - - /** - * The withWhile operation. - * - * @param whileParameter The whileParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withWhileWithResponse(String whileParameter, RequestOptions requestOptions) { - return this.serviceClient.withWhileWithResponse(whileParameter, requestOptions); - } - - /** - * The withWith operation. - * - * @param with The with parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withWithWithResponse(String with, RequestOptions requestOptions) { - return this.serviceClient.withWithWithResponse(with, requestOptions); - } - - /** - * The withYield operation. - * - * @param yield The yield parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withYieldWithResponse(String yield, RequestOptions requestOptions) { - return this.serviceClient.withYieldWithResponse(yield, requestOptions); - } - - /** - * The withCancellationToken operation. - * - * @param cancellationToken The cancellationToken parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withCancellationTokenWithResponse(String cancellationToken, RequestOptions requestOptions) { - return this.serviceClient.withCancellationTokenWithResponse(cancellationToken, requestOptions); - } - - /** - * The withAnd operation. - * - * @param and The and parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withAnd(String and) { - // Generated convenience method for withAndWithResponse - RequestOptions requestOptions = new RequestOptions(); - withAndWithResponse(and, requestOptions).getValue(); - } - - /** - * The withAs operation. - * - * @param as The as parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withAs(String as) { - // Generated convenience method for withAsWithResponse - RequestOptions requestOptions = new RequestOptions(); - withAsWithResponse(as, requestOptions).getValue(); - } - - /** - * The withAssert operation. - * - * @param assertParameter The assertParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withAssert(String assertParameter) { - // Generated convenience method for withAssertWithResponse - RequestOptions requestOptions = new RequestOptions(); - withAssertWithResponse(assertParameter, requestOptions).getValue(); - } - - /** - * The withAsync operation. - * - * @param async The async parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withAsync(String async) { - // Generated convenience method for withAsyncWithResponse - RequestOptions requestOptions = new RequestOptions(); - withAsyncWithResponse(async, requestOptions).getValue(); - } - - /** - * The withAwait operation. - * - * @param await The await parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withAwait(String await) { - // Generated convenience method for withAwaitWithResponse - RequestOptions requestOptions = new RequestOptions(); - withAwaitWithResponse(await, requestOptions).getValue(); - } - - /** - * The withBreak operation. - * - * @param breakParameter The breakParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withBreak(String breakParameter) { - // Generated convenience method for withBreakWithResponse - RequestOptions requestOptions = new RequestOptions(); - withBreakWithResponse(breakParameter, requestOptions).getValue(); - } - - /** - * The withClass operation. - * - * @param classParameter The classParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withClass(String classParameter) { - // Generated convenience method for withClassWithResponse - RequestOptions requestOptions = new RequestOptions(); - withClassWithResponse(classParameter, requestOptions).getValue(); - } - - /** - * The withConstructor operation. - * - * @param constructor The constructor parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withConstructor(String constructor) { - // Generated convenience method for withConstructorWithResponse - RequestOptions requestOptions = new RequestOptions(); - withConstructorWithResponse(constructor, requestOptions).getValue(); - } - - /** - * The withContinue operation. - * - * @param continueParameter The continueParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withContinue(String continueParameter) { - // Generated convenience method for withContinueWithResponse - RequestOptions requestOptions = new RequestOptions(); - withContinueWithResponse(continueParameter, requestOptions).getValue(); - } - - /** - * The withDef operation. - * - * @param def The def parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withDef(String def) { - // Generated convenience method for withDefWithResponse - RequestOptions requestOptions = new RequestOptions(); - withDefWithResponse(def, requestOptions).getValue(); - } - - /** - * The withDel operation. - * - * @param del The del parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withDel(String del) { - // Generated convenience method for withDelWithResponse - RequestOptions requestOptions = new RequestOptions(); - withDelWithResponse(del, requestOptions).getValue(); - } - - /** - * The withElif operation. - * - * @param elif The elif parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withElif(String elif) { - // Generated convenience method for withElifWithResponse - RequestOptions requestOptions = new RequestOptions(); - withElifWithResponse(elif, requestOptions).getValue(); - } - - /** - * The withElse operation. - * - * @param elseParameter The elseParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withElse(String elseParameter) { - // Generated convenience method for withElseWithResponse - RequestOptions requestOptions = new RequestOptions(); - withElseWithResponse(elseParameter, requestOptions).getValue(); - } - - /** - * The withExcept operation. - * - * @param except The except parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withExcept(String except) { - // Generated convenience method for withExceptWithResponse - RequestOptions requestOptions = new RequestOptions(); - withExceptWithResponse(except, requestOptions).getValue(); - } - - /** - * The withExec operation. - * - * @param exec The exec parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withExec(String exec) { - // Generated convenience method for withExecWithResponse - RequestOptions requestOptions = new RequestOptions(); - withExecWithResponse(exec, requestOptions).getValue(); - } - - /** - * The withFinally operation. - * - * @param finallyParameter The finallyParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withFinally(String finallyParameter) { - // Generated convenience method for withFinallyWithResponse - RequestOptions requestOptions = new RequestOptions(); - withFinallyWithResponse(finallyParameter, requestOptions).getValue(); - } - - /** - * The withFor operation. - * - * @param forParameter The forParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withFor(String forParameter) { - // Generated convenience method for withForWithResponse - RequestOptions requestOptions = new RequestOptions(); - withForWithResponse(forParameter, requestOptions).getValue(); - } - - /** - * The withFrom operation. - * - * @param from The from parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withFrom(String from) { - // Generated convenience method for withFromWithResponse - RequestOptions requestOptions = new RequestOptions(); - withFromWithResponse(from, requestOptions).getValue(); - } - - /** - * The withGlobal operation. - * - * @param global The global parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withGlobal(String global) { - // Generated convenience method for withGlobalWithResponse - RequestOptions requestOptions = new RequestOptions(); - withGlobalWithResponse(global, requestOptions).getValue(); - } - - /** - * The withIf operation. - * - * @param ifParameter The ifParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withIf(String ifParameter) { - // Generated convenience method for withIfWithResponse - RequestOptions requestOptions = new RequestOptions(); - withIfWithResponse(ifParameter, requestOptions).getValue(); - } - - /** - * The withImport operation. - * - * @param importParameter The importParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withImport(String importParameter) { - // Generated convenience method for withImportWithResponse - RequestOptions requestOptions = new RequestOptions(); - withImportWithResponse(importParameter, requestOptions).getValue(); - } - - /** - * The withIn operation. - * - * @param in The in parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withIn(String in) { - // Generated convenience method for withInWithResponse - RequestOptions requestOptions = new RequestOptions(); - withInWithResponse(in, requestOptions).getValue(); - } - - /** - * The withIs operation. - * - * @param is The is parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withIs(String is) { - // Generated convenience method for withIsWithResponse - RequestOptions requestOptions = new RequestOptions(); - withIsWithResponse(is, requestOptions).getValue(); - } - - /** - * The withLambda operation. - * - * @param lambda The lambda parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withLambda(String lambda) { - // Generated convenience method for withLambdaWithResponse - RequestOptions requestOptions = new RequestOptions(); - withLambdaWithResponse(lambda, requestOptions).getValue(); - } - - /** - * The withNot operation. - * - * @param not The not parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withNot(String not) { - // Generated convenience method for withNotWithResponse - RequestOptions requestOptions = new RequestOptions(); - withNotWithResponse(not, requestOptions).getValue(); - } - - /** - * The withOr operation. - * - * @param or The or parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withOr(String or) { - // Generated convenience method for withOrWithResponse - RequestOptions requestOptions = new RequestOptions(); - withOrWithResponse(or, requestOptions).getValue(); - } - - /** - * The withPass operation. - * - * @param pass The pass parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withPass(String pass) { - // Generated convenience method for withPassWithResponse - RequestOptions requestOptions = new RequestOptions(); - withPassWithResponse(pass, requestOptions).getValue(); - } - - /** - * The withRaise operation. - * - * @param raise The raise parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withRaise(String raise) { - // Generated convenience method for withRaiseWithResponse - RequestOptions requestOptions = new RequestOptions(); - withRaiseWithResponse(raise, requestOptions).getValue(); - } - - /** - * The withReturn operation. - * - * @param returnParameter The returnParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withReturn(String returnParameter) { - // Generated convenience method for withReturnWithResponse - RequestOptions requestOptions = new RequestOptions(); - withReturnWithResponse(returnParameter, requestOptions).getValue(); - } - - /** - * The withTry operation. - * - * @param tryParameter The tryParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withTry(String tryParameter) { - // Generated convenience method for withTryWithResponse - RequestOptions requestOptions = new RequestOptions(); - withTryWithResponse(tryParameter, requestOptions).getValue(); - } - - /** - * The withWhile operation. - * - * @param whileParameter The whileParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withWhile(String whileParameter) { - // Generated convenience method for withWhileWithResponse - RequestOptions requestOptions = new RequestOptions(); - withWhileWithResponse(whileParameter, requestOptions).getValue(); - } - - /** - * The withWith operation. - * - * @param with The with parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withWith(String with) { - // Generated convenience method for withWithWithResponse - RequestOptions requestOptions = new RequestOptions(); - withWithWithResponse(with, requestOptions).getValue(); - } - - /** - * The withYield operation. - * - * @param yield The yield parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withYield(String yield) { - // Generated convenience method for withYieldWithResponse - RequestOptions requestOptions = new RequestOptions(); - withYieldWithResponse(yield, requestOptions).getValue(); - } - - /** - * The withCancellationToken operation. - * - * @param cancellationToken The cancellationToken parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void withCancellationToken(String cancellationToken) { - // Generated convenience method for withCancellationTokenWithResponse - RequestOptions requestOptions = new RequestOptions(); - withCancellationTokenWithResponse(cancellationToken, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/SpecialWordsClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/SpecialWordsClientBuilder.java deleted file mode 100644 index ea87d109d89..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/SpecialWordsClientBuilder.java +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import specialwords.implementation.SpecialWordsClientImpl; - -/** - * A builder for creating a new instance of the SpecialWordsClient type. - */ -@ServiceClientBuilder( - serviceClients = { - ModelsClient.class, - ModelPropertiesClient.class, - OperationsClient.class, - ParametersClient.class, - ModelsAsyncClient.class, - ModelPropertiesAsyncClient.class, - OperationsAsyncClient.class, - ParametersAsyncClient.class }) -public final class SpecialWordsClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("specialwords.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the SpecialWordsClientBuilder. - */ - @Generated - public SpecialWordsClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialWordsClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialWordsClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialWordsClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialWordsClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialWordsClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialWordsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialWordsClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialWordsClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the SpecialWordsClientBuilder. - */ - @Generated - public SpecialWordsClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of SpecialWordsClientImpl with the provided parameters. - * - * @return an instance of SpecialWordsClientImpl. - */ - @Generated - private SpecialWordsClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - SpecialWordsClientImpl client - = new SpecialWordsClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ModelsAsyncClient class. - * - * @return an instance of ModelsAsyncClient. - */ - @Generated - public ModelsAsyncClient buildModelsAsyncClient() { - return new ModelsAsyncClient(buildInnerClient().getModels()); - } - - /** - * Builds an instance of ModelPropertiesAsyncClient class. - * - * @return an instance of ModelPropertiesAsyncClient. - */ - @Generated - public ModelPropertiesAsyncClient buildModelPropertiesAsyncClient() { - return new ModelPropertiesAsyncClient(buildInnerClient().getModelProperties()); - } - - /** - * Builds an instance of OperationsAsyncClient class. - * - * @return an instance of OperationsAsyncClient. - */ - @Generated - public OperationsAsyncClient buildOperationsAsyncClient() { - return new OperationsAsyncClient(buildInnerClient().getOperations()); - } - - /** - * Builds an instance of ParametersAsyncClient class. - * - * @return an instance of ParametersAsyncClient. - */ - @Generated - public ParametersAsyncClient buildParametersAsyncClient() { - return new ParametersAsyncClient(buildInnerClient().getParameters()); - } - - /** - * Builds an instance of ModelsClient class. - * - * @return an instance of ModelsClient. - */ - @Generated - public ModelsClient buildModelsClient() { - return new ModelsClient(buildInnerClient().getModels()); - } - - /** - * Builds an instance of ModelPropertiesClient class. - * - * @return an instance of ModelPropertiesClient. - */ - @Generated - public ModelPropertiesClient buildModelPropertiesClient() { - return new ModelPropertiesClient(buildInnerClient().getModelProperties()); - } - - /** - * Builds an instance of OperationsClient class. - * - * @return an instance of OperationsClient. - */ - @Generated - public OperationsClient buildOperationsClient() { - return new OperationsClient(buildInnerClient().getOperations()); - } - - /** - * Builds an instance of ParametersClient class. - * - * @return an instance of ParametersClient. - */ - @Generated - public ParametersClient buildParametersClient() { - return new ParametersClient(buildInnerClient().getParameters()); - } - - private static final ClientLogger LOGGER = new ClientLogger(SpecialWordsClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelPropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelPropertiesImpl.java deleted file mode 100644 index f8d2e28261c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelPropertiesImpl.java +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ModelProperties. - */ -public final class ModelPropertiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ModelPropertiesService service; - - /** - * The service client containing this operation class. - */ - private final SpecialWordsClientImpl client; - - /** - * Initializes an instance of ModelPropertiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ModelPropertiesImpl(SpecialWordsClientImpl client) { - this.service - = RestProxy.create(ModelPropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for SpecialWordsClientModelProperties to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SpecialWordsClientModelProperties") - public interface ModelPropertiesService { - @Post("/special-words/model-properties/same-as-model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> sameAsModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/model-properties/same-as-model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sameAsModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/model-properties/dict-methods") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> dictMethods(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/model-properties/dict-methods") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response dictMethodsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The sameAsModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     SameAsModel: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sameAsModelWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.sameAsModel(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The sameAsModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     SameAsModel: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sameAsModelWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sameAsModelSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The dictMethods operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     keys: String (Required)
-     *     items: String (Required)
-     *     values: String (Required)
-     *     popitem: String (Required)
-     *     clear: String (Required)
-     *     update: String (Required)
-     *     setdefault: String (Required)
-     *     pop: String (Required)
-     *     get: String (Required)
-     *     copy: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> dictMethodsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.dictMethods(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The dictMethods operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     keys: String (Required)
-     *     items: String (Required)
-     *     values: String (Required)
-     *     popitem: String (Required)
-     *     clear: String (Required)
-     *     update: String (Required)
-     *     setdefault: String (Required)
-     *     pop: String (Required)
-     *     get: String (Required)
-     *     copy: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response dictMethodsWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.dictMethodsSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelsImpl.java deleted file mode 100644 index 2061d477dbf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelsImpl.java +++ /dev/null @@ -1,2469 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Models. - */ -public final class ModelsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ModelsService service; - - /** - * The service client containing this operation class. - */ - private final SpecialWordsClientImpl client; - - /** - * Initializes an instance of ModelsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ModelsImpl(SpecialWordsClientImpl client) { - this.service = RestProxy.create(ModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for SpecialWordsClientModels to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SpecialWordsClientModels") - public interface ModelsService { - @Post("/special-words/models/and") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withAnd(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/and") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withAndSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/as") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withAs(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/as") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withAsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/assert") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withAssert(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/assert") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withAssertSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/async") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withAsync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/async") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withAsyncSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/await") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withAwait(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/await") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withAwaitSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/break") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withBreak(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/break") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withBreakSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/class") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withClass(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/class") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withClassSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/constructor") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withConstructor(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/constructor") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withConstructorSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/continue") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withContinue(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/continue") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withContinueSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/def") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withDef(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/def") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withDefSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/del") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withDel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/del") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withDelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/elif") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withElif(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/elif") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withElifSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/else") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withElse(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/else") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withElseSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/except") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withExcept(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/except") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withExceptSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/exec") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withExec(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/exec") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withExecSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/finally") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withFinally(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/finally") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withFinallySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/for") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withFor(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/for") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withForSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/from") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withFrom(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/from") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withFromSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/global") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withGlobal(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/global") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withGlobalSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/if") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withIf(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/if") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withIfSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/import") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withImport(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/import") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withImportSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/in") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withIn(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/in") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withInSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/is") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withIs(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/is") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withIsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/lambda") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withLambda(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/lambda") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withLambdaSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/not") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withNot(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/not") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withNotSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/or") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withOr(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/or") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withOrSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/pass") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withPass(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/pass") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withPassSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/raise") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withRaise(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/raise") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withRaiseSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/return") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withReturn(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/return") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withReturnSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/try") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withTry(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/try") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withTrySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/while") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withWhile(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/while") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withWhileSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/with") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withWith(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/with") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withWithSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/yield") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withYield(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/special-words/models/yield") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withYieldSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The withAnd operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAndWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withAnd(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withAnd operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAndWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withAndSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withAs operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withAs(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withAs operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAsWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withAsSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withAssert operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAssertWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withAssert(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withAssert operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAssertWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withAssertSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withAsync operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAsyncWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withAsync(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withAsync operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAsyncWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withAsyncSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withAwait operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAwaitWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withAwait(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withAwait operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAwaitWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withAwaitSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withBreak operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withBreakWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withBreak(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withBreak operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withBreakWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withBreakSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withClass operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withClassWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withClass(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withClass operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withClassWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withClassSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withConstructor operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withConstructorWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withConstructor(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withConstructor operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withConstructorWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withConstructorSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withContinue operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withContinueWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withContinue(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withContinue operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withContinueWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withContinueSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withDef operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withDefWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withDef(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withDef operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withDefWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withDefSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withDel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withDelWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withDel(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withDel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withDelWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withDelSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withElif operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withElifWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withElif(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withElif operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withElifWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withElifSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withElse operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withElseWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withElse(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withElse operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withElseWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withElseSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withExcept operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withExceptWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withExcept(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withExcept operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withExceptWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withExceptSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withExec operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withExecWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withExec(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withExec operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withExecWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withExecSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withFinally operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withFinallyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withFinally(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withFinally operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withFinallyWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withFinallySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withFor operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withForWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withFor(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withFor operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withForWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withForSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withFrom operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withFromWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withFrom(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withFrom operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withFromWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withFromSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withGlobal operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withGlobalWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withGlobal(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withGlobal operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withGlobalWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withGlobalSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withIf operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withIfWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withIf(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withIf operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withIfWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withIfSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withImport operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withImportWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withImport(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withImport operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withImportWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withImportSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withIn operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withInWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withIn(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withIn operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withInWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withInSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withIs operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withIsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withIs(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withIs operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withIsWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withIsSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withLambda operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withLambdaWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withLambda(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withLambda operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withLambdaWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withLambdaSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withNot operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withNotWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withNot(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withNot operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withNotWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withNotSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withOr operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withOrWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withOr(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withOr operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withOrWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withOrSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withPass operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withPassWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withPass(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withPass operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withPassWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withPassSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withRaise operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withRaiseWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withRaise(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withRaise operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withRaiseWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withRaiseSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withReturn operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withReturnWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withReturn(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withReturn operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withReturnWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withReturnSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withTry operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withTryWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withTry(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withTry operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withTryWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withTrySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withWhile operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withWhileWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withWhile(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withWhile operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withWhileWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withWhileSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withWith operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withWithWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withWith(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withWith operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withWithWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withWithSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The withYield operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withYieldWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.withYield(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The withYield operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withYieldWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.withYieldSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/OperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/OperationsImpl.java deleted file mode 100644 index 4464f1967ef..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/OperationsImpl.java +++ /dev/null @@ -1,1630 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Operations. - */ -public final class OperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final OperationsService service; - - /** - * The service client containing this operation class. - */ - private final SpecialWordsClientImpl client; - - /** - * Initializes an instance of OperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - OperationsImpl(SpecialWordsClientImpl client) { - this.service - = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for SpecialWordsClientOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SpecialWordsClientOperations") - public interface OperationsService { - @Get("/special-words/operations/and") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> and(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/and") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response andSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/as") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> as(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/as") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response asSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/assert") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> assertMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/assert") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response assertMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/async") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> async(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/async") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response asyncSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/await") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> await(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/await") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response awaitSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/break") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> breakMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/break") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response breakMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/class") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> classMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/class") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response classMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/constructor") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> constructor(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/constructor") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response constructorSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/continue") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> continueMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/continue") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response continueMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/def") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> def(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/def") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response defSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/del") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> del(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/del") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response delSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/elif") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> elif(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/elif") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response elifSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/else") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> elseMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/else") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response elseMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/except") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> except(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/except") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response exceptSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/exec") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> exec(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/exec") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response execSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/finally") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> finallyMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/finally") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response finallyMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/for") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> forMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/for") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response forMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/from") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> from(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/from") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response fromSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/global") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> global(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/global") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response globalSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/if") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> ifMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/if") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response ifMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/import") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> importMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/import") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response importMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/in") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> in(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/in") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response inSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/is") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> is(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/is") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response isSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/lambda") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> lambda(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/lambda") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response lambdaSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/not") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> not(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/not") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response notSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/or") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> or(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/or") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response orSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/pass") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> pass(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/pass") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response passSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/raise") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> raise(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/raise") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response raiseSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/return") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> returnMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/return") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response returnMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/try") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> tryMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/try") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response tryMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/while") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> whileMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/while") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response whileMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/with") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> with(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/with") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Get("/special-words/operations/yield") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> yield(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/special-words/operations/yield") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response yieldSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - } - - /** - * The and operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> andWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.and(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The and operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response andWithResponse(RequestOptions requestOptions) { - return service.andSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The as operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> asWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.as(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The as operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response asWithResponse(RequestOptions requestOptions) { - return service.asSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The assertMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> assertMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.assertMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The assertMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response assertMethodWithResponse(RequestOptions requestOptions) { - return service.assertMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The async operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> asyncWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.async(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The async operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response asyncWithResponse(RequestOptions requestOptions) { - return service.asyncSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The await operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> awaitWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.await(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The await operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response awaitWithResponse(RequestOptions requestOptions) { - return service.awaitSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The breakMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> breakMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.breakMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The breakMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response breakMethodWithResponse(RequestOptions requestOptions) { - return service.breakMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The classMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> classMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.classMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The classMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response classMethodWithResponse(RequestOptions requestOptions) { - return service.classMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The constructor operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> constructorWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.constructor(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The constructor operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response constructorWithResponse(RequestOptions requestOptions) { - return service.constructorSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The continueMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> continueMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.continueMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The continueMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response continueMethodWithResponse(RequestOptions requestOptions) { - return service.continueMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The def operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> defWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.def(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The def operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response defWithResponse(RequestOptions requestOptions) { - return service.defSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The del operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> delWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.del(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The del operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response delWithResponse(RequestOptions requestOptions) { - return service.delSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The elif operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> elifWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.elif(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The elif operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response elifWithResponse(RequestOptions requestOptions) { - return service.elifSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The elseMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> elseMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.elseMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The elseMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response elseMethodWithResponse(RequestOptions requestOptions) { - return service.elseMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The except operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> exceptWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.except(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The except operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response exceptWithResponse(RequestOptions requestOptions) { - return service.exceptSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The exec operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> execWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.exec(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The exec operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response execWithResponse(RequestOptions requestOptions) { - return service.execSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The finallyMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> finallyMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.finallyMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The finallyMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response finallyMethodWithResponse(RequestOptions requestOptions) { - return service.finallyMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The forMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> forMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.forMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The forMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response forMethodWithResponse(RequestOptions requestOptions) { - return service.forMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The from operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> fromWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.from(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The from operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response fromWithResponse(RequestOptions requestOptions) { - return service.fromSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The global operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> globalWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.global(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The global operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response globalWithResponse(RequestOptions requestOptions) { - return service.globalSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The ifMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> ifMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.ifMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The ifMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response ifMethodWithResponse(RequestOptions requestOptions) { - return service.ifMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The importMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> importMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.importMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The importMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response importMethodWithResponse(RequestOptions requestOptions) { - return service.importMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The in operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> inWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.in(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The in operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response inWithResponse(RequestOptions requestOptions) { - return service.inSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The is operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> isWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.is(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The is operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response isWithResponse(RequestOptions requestOptions) { - return service.isSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The lambda operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> lambdaWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.lambda(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The lambda operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response lambdaWithResponse(RequestOptions requestOptions) { - return service.lambdaSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The not operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> notWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.not(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The not operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response notWithResponse(RequestOptions requestOptions) { - return service.notSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The or operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> orWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.or(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The or operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response orWithResponse(RequestOptions requestOptions) { - return service.orSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The pass operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> passWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.pass(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The pass operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response passWithResponse(RequestOptions requestOptions) { - return service.passSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The raise operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> raiseWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.raise(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The raise operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response raiseWithResponse(RequestOptions requestOptions) { - return service.raiseSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The returnMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> returnMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.returnMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The returnMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response returnMethodWithResponse(RequestOptions requestOptions) { - return service.returnMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The tryMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> tryMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.tryMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The tryMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response tryMethodWithResponse(RequestOptions requestOptions) { - return service.tryMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The whileMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> whileMethodWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.whileMethod(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The whileMethod operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response whileMethodWithResponse(RequestOptions requestOptions) { - return service.whileMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The with operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.with(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The with operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withWithResponse(RequestOptions requestOptions) { - return service.withSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The yield operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> yieldWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.yield(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The yield operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response yieldWithResponse(RequestOptions requestOptions) { - return service.yieldSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ParametersImpl.java deleted file mode 100644 index c4ed6e67ddc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ParametersImpl.java +++ /dev/null @@ -1,1791 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Parameters. - */ -public final class ParametersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ParametersService service; - - /** - * The service client containing this operation class. - */ - private final SpecialWordsClientImpl client; - - /** - * Initializes an instance of ParametersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ParametersImpl(SpecialWordsClientImpl client) { - this.service - = RestProxy.create(ParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for SpecialWordsClientParameters to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SpecialWordsClientParameters") - public interface ParametersService { - @Get("/special-words/parameters/and") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withAnd(@HostParam("endpoint") String endpoint, @QueryParam("and") String and, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/and") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withAndSync(@HostParam("endpoint") String endpoint, @QueryParam("and") String and, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/as") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withAs(@HostParam("endpoint") String endpoint, @QueryParam("as") String as, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/as") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withAsSync(@HostParam("endpoint") String endpoint, @QueryParam("as") String as, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/assert") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withAssert(@HostParam("endpoint") String endpoint, - @QueryParam("assert") String assertParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/assert") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withAssertSync(@HostParam("endpoint") String endpoint, - @QueryParam("assert") String assertParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/async") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withAsync(@HostParam("endpoint") String endpoint, @QueryParam("async") String async, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/async") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withAsyncSync(@HostParam("endpoint") String endpoint, @QueryParam("async") String async, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/await") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withAwait(@HostParam("endpoint") String endpoint, @QueryParam("await") String await, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/await") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withAwaitSync(@HostParam("endpoint") String endpoint, @QueryParam("await") String await, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/break") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withBreak(@HostParam("endpoint") String endpoint, - @QueryParam("break") String breakParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/break") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withBreakSync(@HostParam("endpoint") String endpoint, @QueryParam("break") String breakParameter, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/class") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withClass(@HostParam("endpoint") String endpoint, - @QueryParam("class") String classParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/class") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withClassSync(@HostParam("endpoint") String endpoint, @QueryParam("class") String classParameter, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/constructor") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withConstructor(@HostParam("endpoint") String endpoint, - @QueryParam("constructor") String constructor, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/constructor") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withConstructorSync(@HostParam("endpoint") String endpoint, - @QueryParam("constructor") String constructor, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/continue") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withContinue(@HostParam("endpoint") String endpoint, - @QueryParam("continue") String continueParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/continue") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withContinueSync(@HostParam("endpoint") String endpoint, - @QueryParam("continue") String continueParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/def") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withDef(@HostParam("endpoint") String endpoint, @QueryParam("def") String def, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/def") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withDefSync(@HostParam("endpoint") String endpoint, @QueryParam("def") String def, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/del") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withDel(@HostParam("endpoint") String endpoint, @QueryParam("del") String del, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/del") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withDelSync(@HostParam("endpoint") String endpoint, @QueryParam("del") String del, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/elif") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withElif(@HostParam("endpoint") String endpoint, @QueryParam("elif") String elif, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/elif") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withElifSync(@HostParam("endpoint") String endpoint, @QueryParam("elif") String elif, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/else") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withElse(@HostParam("endpoint") String endpoint, @QueryParam("else") String elseParameter, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/else") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withElseSync(@HostParam("endpoint") String endpoint, @QueryParam("else") String elseParameter, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/except") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withExcept(@HostParam("endpoint") String endpoint, @QueryParam("except") String except, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/except") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withExceptSync(@HostParam("endpoint") String endpoint, @QueryParam("except") String except, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/exec") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withExec(@HostParam("endpoint") String endpoint, @QueryParam("exec") String exec, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/exec") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withExecSync(@HostParam("endpoint") String endpoint, @QueryParam("exec") String exec, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/finally") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withFinally(@HostParam("endpoint") String endpoint, - @QueryParam("finally") String finallyParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/finally") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withFinallySync(@HostParam("endpoint") String endpoint, - @QueryParam("finally") String finallyParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/for") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withFor(@HostParam("endpoint") String endpoint, @QueryParam("for") String forParameter, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/for") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withForSync(@HostParam("endpoint") String endpoint, @QueryParam("for") String forParameter, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/from") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withFrom(@HostParam("endpoint") String endpoint, @QueryParam("from") String from, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/from") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withFromSync(@HostParam("endpoint") String endpoint, @QueryParam("from") String from, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/global") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withGlobal(@HostParam("endpoint") String endpoint, @QueryParam("global") String global, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/global") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withGlobalSync(@HostParam("endpoint") String endpoint, @QueryParam("global") String global, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/if") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withIf(@HostParam("endpoint") String endpoint, @QueryParam("if") String ifParameter, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/if") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withIfSync(@HostParam("endpoint") String endpoint, @QueryParam("if") String ifParameter, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/import") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withImport(@HostParam("endpoint") String endpoint, - @QueryParam("import") String importParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/import") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withImportSync(@HostParam("endpoint") String endpoint, - @QueryParam("import") String importParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/in") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withIn(@HostParam("endpoint") String endpoint, @QueryParam("in") String in, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/in") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withInSync(@HostParam("endpoint") String endpoint, @QueryParam("in") String in, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/is") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withIs(@HostParam("endpoint") String endpoint, @QueryParam("is") String is, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/is") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withIsSync(@HostParam("endpoint") String endpoint, @QueryParam("is") String is, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/lambda") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withLambda(@HostParam("endpoint") String endpoint, @QueryParam("lambda") String lambda, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/lambda") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withLambdaSync(@HostParam("endpoint") String endpoint, @QueryParam("lambda") String lambda, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/not") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withNot(@HostParam("endpoint") String endpoint, @QueryParam("not") String not, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/not") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withNotSync(@HostParam("endpoint") String endpoint, @QueryParam("not") String not, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/or") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withOr(@HostParam("endpoint") String endpoint, @QueryParam("or") String or, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/or") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withOrSync(@HostParam("endpoint") String endpoint, @QueryParam("or") String or, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/pass") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withPass(@HostParam("endpoint") String endpoint, @QueryParam("pass") String pass, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/pass") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withPassSync(@HostParam("endpoint") String endpoint, @QueryParam("pass") String pass, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/raise") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withRaise(@HostParam("endpoint") String endpoint, @QueryParam("raise") String raise, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/raise") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withRaiseSync(@HostParam("endpoint") String endpoint, @QueryParam("raise") String raise, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/return") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withReturn(@HostParam("endpoint") String endpoint, - @QueryParam("return") String returnParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/return") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withReturnSync(@HostParam("endpoint") String endpoint, - @QueryParam("return") String returnParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/try") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withTry(@HostParam("endpoint") String endpoint, @QueryParam("try") String tryParameter, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/try") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withTrySync(@HostParam("endpoint") String endpoint, @QueryParam("try") String tryParameter, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/while") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withWhile(@HostParam("endpoint") String endpoint, - @QueryParam("while") String whileParameter, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/while") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withWhileSync(@HostParam("endpoint") String endpoint, @QueryParam("while") String whileParameter, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/with") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withWith(@HostParam("endpoint") String endpoint, @QueryParam("with") String with, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/with") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withWithSync(@HostParam("endpoint") String endpoint, @QueryParam("with") String with, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/yield") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withYield(@HostParam("endpoint") String endpoint, @QueryParam("yield") String yield, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/yield") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withYieldSync(@HostParam("endpoint") String endpoint, @QueryParam("yield") String yield, - RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/cancellationToken") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> withCancellationToken(@HostParam("endpoint") String endpoint, - @QueryParam("cancellationToken") String cancellationToken, RequestOptions requestOptions, Context context); - - @Get("/special-words/parameters/cancellationToken") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response withCancellationTokenSync(@HostParam("endpoint") String endpoint, - @QueryParam("cancellationToken") String cancellationToken, RequestOptions requestOptions, Context context); - } - - /** - * The withAnd operation. - * - * @param and The and parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAndWithResponseAsync(String and, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withAnd(this.client.getEndpoint(), and, requestOptions, context)); - } - - /** - * The withAnd operation. - * - * @param and The and parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAndWithResponse(String and, RequestOptions requestOptions) { - return service.withAndSync(this.client.getEndpoint(), and, requestOptions, Context.NONE); - } - - /** - * The withAs operation. - * - * @param as The as parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAsWithResponseAsync(String as, RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.withAs(this.client.getEndpoint(), as, requestOptions, context)); - } - - /** - * The withAs operation. - * - * @param as The as parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAsWithResponse(String as, RequestOptions requestOptions) { - return service.withAsSync(this.client.getEndpoint(), as, requestOptions, Context.NONE); - } - - /** - * The withAssert operation. - * - * @param assertParameter The assertParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAssertWithResponseAsync(String assertParameter, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withAssert(this.client.getEndpoint(), assertParameter, requestOptions, context)); - } - - /** - * The withAssert operation. - * - * @param assertParameter The assertParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAssertWithResponse(String assertParameter, RequestOptions requestOptions) { - return service.withAssertSync(this.client.getEndpoint(), assertParameter, requestOptions, Context.NONE); - } - - /** - * The withAsync operation. - * - * @param async The async parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAsyncWithResponseAsync(String async, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withAsync(this.client.getEndpoint(), async, requestOptions, context)); - } - - /** - * The withAsync operation. - * - * @param async The async parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAsyncWithResponse(String async, RequestOptions requestOptions) { - return service.withAsyncSync(this.client.getEndpoint(), async, requestOptions, Context.NONE); - } - - /** - * The withAwait operation. - * - * @param await The await parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withAwaitWithResponseAsync(String await, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withAwait(this.client.getEndpoint(), await, requestOptions, context)); - } - - /** - * The withAwait operation. - * - * @param await The await parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withAwaitWithResponse(String await, RequestOptions requestOptions) { - return service.withAwaitSync(this.client.getEndpoint(), await, requestOptions, Context.NONE); - } - - /** - * The withBreak operation. - * - * @param breakParameter The breakParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withBreakWithResponseAsync(String breakParameter, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withBreak(this.client.getEndpoint(), breakParameter, requestOptions, context)); - } - - /** - * The withBreak operation. - * - * @param breakParameter The breakParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withBreakWithResponse(String breakParameter, RequestOptions requestOptions) { - return service.withBreakSync(this.client.getEndpoint(), breakParameter, requestOptions, Context.NONE); - } - - /** - * The withClass operation. - * - * @param classParameter The classParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withClassWithResponseAsync(String classParameter, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withClass(this.client.getEndpoint(), classParameter, requestOptions, context)); - } - - /** - * The withClass operation. - * - * @param classParameter The classParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withClassWithResponse(String classParameter, RequestOptions requestOptions) { - return service.withClassSync(this.client.getEndpoint(), classParameter, requestOptions, Context.NONE); - } - - /** - * The withConstructor operation. - * - * @param constructor The constructor parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withConstructorWithResponseAsync(String constructor, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withConstructor(this.client.getEndpoint(), constructor, requestOptions, context)); - } - - /** - * The withConstructor operation. - * - * @param constructor The constructor parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withConstructorWithResponse(String constructor, RequestOptions requestOptions) { - return service.withConstructorSync(this.client.getEndpoint(), constructor, requestOptions, Context.NONE); - } - - /** - * The withContinue operation. - * - * @param continueParameter The continueParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withContinueWithResponseAsync(String continueParameter, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withContinue(this.client.getEndpoint(), continueParameter, requestOptions, context)); - } - - /** - * The withContinue operation. - * - * @param continueParameter The continueParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withContinueWithResponse(String continueParameter, RequestOptions requestOptions) { - return service.withContinueSync(this.client.getEndpoint(), continueParameter, requestOptions, Context.NONE); - } - - /** - * The withDef operation. - * - * @param def The def parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withDefWithResponseAsync(String def, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withDef(this.client.getEndpoint(), def, requestOptions, context)); - } - - /** - * The withDef operation. - * - * @param def The def parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withDefWithResponse(String def, RequestOptions requestOptions) { - return service.withDefSync(this.client.getEndpoint(), def, requestOptions, Context.NONE); - } - - /** - * The withDel operation. - * - * @param del The del parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withDelWithResponseAsync(String del, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withDel(this.client.getEndpoint(), del, requestOptions, context)); - } - - /** - * The withDel operation. - * - * @param del The del parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withDelWithResponse(String del, RequestOptions requestOptions) { - return service.withDelSync(this.client.getEndpoint(), del, requestOptions, Context.NONE); - } - - /** - * The withElif operation. - * - * @param elif The elif parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withElifWithResponseAsync(String elif, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withElif(this.client.getEndpoint(), elif, requestOptions, context)); - } - - /** - * The withElif operation. - * - * @param elif The elif parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withElifWithResponse(String elif, RequestOptions requestOptions) { - return service.withElifSync(this.client.getEndpoint(), elif, requestOptions, Context.NONE); - } - - /** - * The withElse operation. - * - * @param elseParameter The elseParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withElseWithResponseAsync(String elseParameter, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withElse(this.client.getEndpoint(), elseParameter, requestOptions, context)); - } - - /** - * The withElse operation. - * - * @param elseParameter The elseParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withElseWithResponse(String elseParameter, RequestOptions requestOptions) { - return service.withElseSync(this.client.getEndpoint(), elseParameter, requestOptions, Context.NONE); - } - - /** - * The withExcept operation. - * - * @param except The except parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withExceptWithResponseAsync(String except, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withExcept(this.client.getEndpoint(), except, requestOptions, context)); - } - - /** - * The withExcept operation. - * - * @param except The except parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withExceptWithResponse(String except, RequestOptions requestOptions) { - return service.withExceptSync(this.client.getEndpoint(), except, requestOptions, Context.NONE); - } - - /** - * The withExec operation. - * - * @param exec The exec parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withExecWithResponseAsync(String exec, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withExec(this.client.getEndpoint(), exec, requestOptions, context)); - } - - /** - * The withExec operation. - * - * @param exec The exec parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withExecWithResponse(String exec, RequestOptions requestOptions) { - return service.withExecSync(this.client.getEndpoint(), exec, requestOptions, Context.NONE); - } - - /** - * The withFinally operation. - * - * @param finallyParameter The finallyParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withFinallyWithResponseAsync(String finallyParameter, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withFinally(this.client.getEndpoint(), finallyParameter, requestOptions, context)); - } - - /** - * The withFinally operation. - * - * @param finallyParameter The finallyParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withFinallyWithResponse(String finallyParameter, RequestOptions requestOptions) { - return service.withFinallySync(this.client.getEndpoint(), finallyParameter, requestOptions, Context.NONE); - } - - /** - * The withFor operation. - * - * @param forParameter The forParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withForWithResponseAsync(String forParameter, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withFor(this.client.getEndpoint(), forParameter, requestOptions, context)); - } - - /** - * The withFor operation. - * - * @param forParameter The forParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withForWithResponse(String forParameter, RequestOptions requestOptions) { - return service.withForSync(this.client.getEndpoint(), forParameter, requestOptions, Context.NONE); - } - - /** - * The withFrom operation. - * - * @param from The from parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withFromWithResponseAsync(String from, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withFrom(this.client.getEndpoint(), from, requestOptions, context)); - } - - /** - * The withFrom operation. - * - * @param from The from parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withFromWithResponse(String from, RequestOptions requestOptions) { - return service.withFromSync(this.client.getEndpoint(), from, requestOptions, Context.NONE); - } - - /** - * The withGlobal operation. - * - * @param global The global parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withGlobalWithResponseAsync(String global, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withGlobal(this.client.getEndpoint(), global, requestOptions, context)); - } - - /** - * The withGlobal operation. - * - * @param global The global parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withGlobalWithResponse(String global, RequestOptions requestOptions) { - return service.withGlobalSync(this.client.getEndpoint(), global, requestOptions, Context.NONE); - } - - /** - * The withIf operation. - * - * @param ifParameter The ifParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withIfWithResponseAsync(String ifParameter, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withIf(this.client.getEndpoint(), ifParameter, requestOptions, context)); - } - - /** - * The withIf operation. - * - * @param ifParameter The ifParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withIfWithResponse(String ifParameter, RequestOptions requestOptions) { - return service.withIfSync(this.client.getEndpoint(), ifParameter, requestOptions, Context.NONE); - } - - /** - * The withImport operation. - * - * @param importParameter The importParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withImportWithResponseAsync(String importParameter, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withImport(this.client.getEndpoint(), importParameter, requestOptions, context)); - } - - /** - * The withImport operation. - * - * @param importParameter The importParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withImportWithResponse(String importParameter, RequestOptions requestOptions) { - return service.withImportSync(this.client.getEndpoint(), importParameter, requestOptions, Context.NONE); - } - - /** - * The withIn operation. - * - * @param in The in parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withInWithResponseAsync(String in, RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.withIn(this.client.getEndpoint(), in, requestOptions, context)); - } - - /** - * The withIn operation. - * - * @param in The in parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withInWithResponse(String in, RequestOptions requestOptions) { - return service.withInSync(this.client.getEndpoint(), in, requestOptions, Context.NONE); - } - - /** - * The withIs operation. - * - * @param is The is parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withIsWithResponseAsync(String is, RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.withIs(this.client.getEndpoint(), is, requestOptions, context)); - } - - /** - * The withIs operation. - * - * @param is The is parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withIsWithResponse(String is, RequestOptions requestOptions) { - return service.withIsSync(this.client.getEndpoint(), is, requestOptions, Context.NONE); - } - - /** - * The withLambda operation. - * - * @param lambda The lambda parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withLambdaWithResponseAsync(String lambda, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withLambda(this.client.getEndpoint(), lambda, requestOptions, context)); - } - - /** - * The withLambda operation. - * - * @param lambda The lambda parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withLambdaWithResponse(String lambda, RequestOptions requestOptions) { - return service.withLambdaSync(this.client.getEndpoint(), lambda, requestOptions, Context.NONE); - } - - /** - * The withNot operation. - * - * @param not The not parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withNotWithResponseAsync(String not, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withNot(this.client.getEndpoint(), not, requestOptions, context)); - } - - /** - * The withNot operation. - * - * @param not The not parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withNotWithResponse(String not, RequestOptions requestOptions) { - return service.withNotSync(this.client.getEndpoint(), not, requestOptions, Context.NONE); - } - - /** - * The withOr operation. - * - * @param or The or parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withOrWithResponseAsync(String or, RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.withOr(this.client.getEndpoint(), or, requestOptions, context)); - } - - /** - * The withOr operation. - * - * @param or The or parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withOrWithResponse(String or, RequestOptions requestOptions) { - return service.withOrSync(this.client.getEndpoint(), or, requestOptions, Context.NONE); - } - - /** - * The withPass operation. - * - * @param pass The pass parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withPassWithResponseAsync(String pass, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withPass(this.client.getEndpoint(), pass, requestOptions, context)); - } - - /** - * The withPass operation. - * - * @param pass The pass parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withPassWithResponse(String pass, RequestOptions requestOptions) { - return service.withPassSync(this.client.getEndpoint(), pass, requestOptions, Context.NONE); - } - - /** - * The withRaise operation. - * - * @param raise The raise parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withRaiseWithResponseAsync(String raise, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withRaise(this.client.getEndpoint(), raise, requestOptions, context)); - } - - /** - * The withRaise operation. - * - * @param raise The raise parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withRaiseWithResponse(String raise, RequestOptions requestOptions) { - return service.withRaiseSync(this.client.getEndpoint(), raise, requestOptions, Context.NONE); - } - - /** - * The withReturn operation. - * - * @param returnParameter The returnParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withReturnWithResponseAsync(String returnParameter, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withReturn(this.client.getEndpoint(), returnParameter, requestOptions, context)); - } - - /** - * The withReturn operation. - * - * @param returnParameter The returnParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withReturnWithResponse(String returnParameter, RequestOptions requestOptions) { - return service.withReturnSync(this.client.getEndpoint(), returnParameter, requestOptions, Context.NONE); - } - - /** - * The withTry operation. - * - * @param tryParameter The tryParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withTryWithResponseAsync(String tryParameter, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withTry(this.client.getEndpoint(), tryParameter, requestOptions, context)); - } - - /** - * The withTry operation. - * - * @param tryParameter The tryParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withTryWithResponse(String tryParameter, RequestOptions requestOptions) { - return service.withTrySync(this.client.getEndpoint(), tryParameter, requestOptions, Context.NONE); - } - - /** - * The withWhile operation. - * - * @param whileParameter The whileParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withWhileWithResponseAsync(String whileParameter, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.withWhile(this.client.getEndpoint(), whileParameter, requestOptions, context)); - } - - /** - * The withWhile operation. - * - * @param whileParameter The whileParameter parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withWhileWithResponse(String whileParameter, RequestOptions requestOptions) { - return service.withWhileSync(this.client.getEndpoint(), whileParameter, requestOptions, Context.NONE); - } - - /** - * The withWith operation. - * - * @param with The with parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withWithWithResponseAsync(String with, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withWith(this.client.getEndpoint(), with, requestOptions, context)); - } - - /** - * The withWith operation. - * - * @param with The with parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withWithWithResponse(String with, RequestOptions requestOptions) { - return service.withWithSync(this.client.getEndpoint(), with, requestOptions, Context.NONE); - } - - /** - * The withYield operation. - * - * @param yield The yield parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withYieldWithResponseAsync(String yield, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.withYield(this.client.getEndpoint(), yield, requestOptions, context)); - } - - /** - * The withYield operation. - * - * @param yield The yield parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withYieldWithResponse(String yield, RequestOptions requestOptions) { - return service.withYieldSync(this.client.getEndpoint(), yield, requestOptions, Context.NONE); - } - - /** - * The withCancellationToken operation. - * - * @param cancellationToken The cancellationToken parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> withCancellationTokenWithResponseAsync(String cancellationToken, - RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.withCancellationToken(this.client.getEndpoint(), - cancellationToken, requestOptions, context)); - } - - /** - * The withCancellationToken operation. - * - * @param cancellationToken The cancellationToken parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response withCancellationTokenWithResponse(String cancellationToken, RequestOptions requestOptions) { - return service.withCancellationTokenSync(this.client.getEndpoint(), cancellationToken, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/SpecialWordsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/SpecialWordsClientImpl.java deleted file mode 100644 index 0228a3a8eff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/SpecialWordsClientImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 SpecialWordsClient type. - */ -public final class SpecialWordsClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 ModelsImpl object to access its operations. - */ - private final ModelsImpl models; - - /** - * Gets the ModelsImpl object to access its operations. - * - * @return the ModelsImpl object. - */ - public ModelsImpl getModels() { - return this.models; - } - - /** - * The ModelPropertiesImpl object to access its operations. - */ - private final ModelPropertiesImpl modelProperties; - - /** - * Gets the ModelPropertiesImpl object to access its operations. - * - * @return the ModelPropertiesImpl object. - */ - public ModelPropertiesImpl getModelProperties() { - return this.modelProperties; - } - - /** - * The OperationsImpl object to access its operations. - */ - private final OperationsImpl operations; - - /** - * Gets the OperationsImpl object to access its operations. - * - * @return the OperationsImpl object. - */ - public OperationsImpl getOperations() { - return this.operations; - } - - /** - * The ParametersImpl object to access its operations. - */ - private final ParametersImpl parameters; - - /** - * Gets the ParametersImpl object to access its operations. - * - * @return the ParametersImpl object. - */ - public ParametersImpl getParameters() { - return this.parameters; - } - - /** - * Initializes an instance of SpecialWordsClient client. - * - * @param endpoint Service host. - */ - public SpecialWordsClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of SpecialWordsClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public SpecialWordsClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of SpecialWordsClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public SpecialWordsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.models = new ModelsImpl(this); - this.modelProperties = new ModelPropertiesImpl(this); - this.operations = new OperationsImpl(this); - this.parameters = new ParametersImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/package-info.java deleted file mode 100644 index 408c8a8e2e9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/package-info.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for SpecialWords. - * Scenarios to verify that reserved words can be used in service and generators will handle it appropriately. - * - * Current list of special words - * ```txt - * and - * as - * assert - * async - * await - * break - * class - * constructor - * continue - * def - * del - * elif - * else - * except - * exec - * finally - * for - * from - * global - * if - * import - * in - * is - * lambda - * not - * or - * pass - * raise - * return - * try - * while - * with - * yield - * ```. - * - */ -package specialwords.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/DictMethods.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/DictMethods.java deleted file mode 100644 index fd5b55c5f65..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/DictMethods.java +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.modelproperties.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The DictMethods model. - */ -@Immutable -public final class DictMethods implements JsonSerializable { - /* - * The keys property. - */ - @Generated - private final String keys; - - /* - * The items property. - */ - @Generated - private final String items; - - /* - * The values property. - */ - @Generated - private final String values; - - /* - * The popitem property. - */ - @Generated - private final String popitem; - - /* - * The clear property. - */ - @Generated - private final String clear; - - /* - * The update property. - */ - @Generated - private final String update; - - /* - * The setdefault property. - */ - @Generated - private final String setdefault; - - /* - * The pop property. - */ - @Generated - private final String pop; - - /* - * The get property. - */ - @Generated - private final String get; - - /* - * The copy property. - */ - @Generated - private final String copy; - - /** - * Creates an instance of DictMethods class. - * - * @param keys the keys value to set. - * @param items the items value to set. - * @param values the values value to set. - * @param popitem the popitem value to set. - * @param clear the clear value to set. - * @param update the update value to set. - * @param setdefault the setdefault value to set. - * @param pop the pop value to set. - * @param get the get value to set. - * @param copy the copy value to set. - */ - @Generated - public DictMethods(String keys, String items, String values, String popitem, String clear, String update, - String setdefault, String pop, String get, String copy) { - this.keys = keys; - this.items = items; - this.values = values; - this.popitem = popitem; - this.clear = clear; - this.update = update; - this.setdefault = setdefault; - this.pop = pop; - this.get = get; - this.copy = copy; - } - - /** - * Get the keys property: The keys property. - * - * @return the keys value. - */ - @Generated - public String getKeys() { - return this.keys; - } - - /** - * Get the items property: The items property. - * - * @return the items value. - */ - @Generated - public String getItems() { - return this.items; - } - - /** - * Get the values property: The values property. - * - * @return the values value. - */ - @Generated - public String getValues() { - return this.values; - } - - /** - * Get the popitem property: The popitem property. - * - * @return the popitem value. - */ - @Generated - public String getPopitem() { - return this.popitem; - } - - /** - * Get the clear property: The clear property. - * - * @return the clear value. - */ - @Generated - public String getClear() { - return this.clear; - } - - /** - * Get the update property: The update property. - * - * @return the update value. - */ - @Generated - public String getUpdate() { - return this.update; - } - - /** - * Get the setdefault property: The setdefault property. - * - * @return the setdefault value. - */ - @Generated - public String getSetdefault() { - return this.setdefault; - } - - /** - * Get the pop property: The pop property. - * - * @return the pop value. - */ - @Generated - public String getPop() { - return this.pop; - } - - /** - * Get the get property: The get property. - * - * @return the get value. - */ - @Generated - public String getGet() { - return this.get; - } - - /** - * Get the copy property: The copy property. - * - * @return the copy value. - */ - @Generated - public String getCopy() { - return this.copy; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("keys", this.keys); - jsonWriter.writeStringField("items", this.items); - jsonWriter.writeStringField("values", this.values); - jsonWriter.writeStringField("popitem", this.popitem); - jsonWriter.writeStringField("clear", this.clear); - jsonWriter.writeStringField("update", this.update); - jsonWriter.writeStringField("setdefault", this.setdefault); - jsonWriter.writeStringField("pop", this.pop); - jsonWriter.writeStringField("get", this.get); - jsonWriter.writeStringField("copy", this.copy); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DictMethods from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DictMethods if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DictMethods. - */ - @Generated - public static DictMethods fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String keys = null; - String items = null; - String values = null; - String popitem = null; - String clear = null; - String update = null; - String setdefault = null; - String pop = null; - String get = null; - String copy = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("keys".equals(fieldName)) { - keys = reader.getString(); - } else if ("items".equals(fieldName)) { - items = reader.getString(); - } else if ("values".equals(fieldName)) { - values = reader.getString(); - } else if ("popitem".equals(fieldName)) { - popitem = reader.getString(); - } else if ("clear".equals(fieldName)) { - clear = reader.getString(); - } else if ("update".equals(fieldName)) { - update = reader.getString(); - } else if ("setdefault".equals(fieldName)) { - setdefault = reader.getString(); - } else if ("pop".equals(fieldName)) { - pop = reader.getString(); - } else if ("get".equals(fieldName)) { - get = reader.getString(); - } else if ("copy".equals(fieldName)) { - copy = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new DictMethods(keys, items, values, popitem, clear, update, setdefault, pop, get, copy); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/SameAsModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/SameAsModel.java deleted file mode 100644 index 9710a57a0b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/SameAsModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.modelproperties.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The SameAsModel model. - */ -@Immutable -public final class SameAsModel implements JsonSerializable { - /* - * The SameAsModel property. - */ - @Generated - private final String sameAsModel; - - /** - * Creates an instance of SameAsModel class. - * - * @param sameAsModel the sameAsModel value to set. - */ - @Generated - public SameAsModel(String sameAsModel) { - this.sameAsModel = sameAsModel; - } - - /** - * Get the sameAsModel property: The SameAsModel property. - * - * @return the sameAsModel value. - */ - @Generated - public String getSameAsModel() { - return this.sameAsModel; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("SameAsModel", this.sameAsModel); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SameAsModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SameAsModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SameAsModel. - */ - @Generated - public static SameAsModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String sameAsModel = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("SameAsModel".equals(fieldName)) { - sameAsModel = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new SameAsModel(sameAsModel); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/package-info.java deleted file mode 100644 index 1a4933291ab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/package-info.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for SpecialWords. - * Scenarios to verify that reserved words can be used in service and generators will handle it appropriately. - * - * Current list of special words - * ```txt - * and - * as - * assert - * async - * await - * break - * class - * constructor - * continue - * def - * del - * elif - * else - * except - * exec - * finally - * for - * from - * global - * if - * import - * in - * is - * lambda - * not - * or - * pass - * raise - * return - * try - * while - * with - * yield - * ```. - * - */ -package specialwords.modelproperties.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/And.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/And.java deleted file mode 100644 index e6a16870bb6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/And.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The And model. - */ -@Immutable -public final class And implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of And class. - * - * @param name the name value to set. - */ - @Generated - public And(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of And from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of And if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the And. - */ - @Generated - public static And fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new And(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/As.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/As.java deleted file mode 100644 index 14b4cd32d3e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/As.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The As model. - */ -@Immutable -public final class As implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of As class. - * - * @param name the name value to set. - */ - @Generated - public As(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of As from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of As if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON - * null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the As. - */ - @Generated - public static As fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new As(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Assert.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Assert.java deleted file mode 100644 index 1e06ffca1cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Assert.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Assert model. - */ -@Immutable -public final class Assert implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Assert class. - * - * @param name the name value to set. - */ - @Generated - public Assert(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Assert from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Assert if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Assert. - */ - @Generated - public static Assert fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Assert(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Async.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Async.java deleted file mode 100644 index f580b301b49..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Async.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Async model. - */ -@Immutable -public final class Async implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Async class. - * - * @param name the name value to set. - */ - @Generated - public Async(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Async from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Async if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Async. - */ - @Generated - public static Async fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Async(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Await.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Await.java deleted file mode 100644 index e7522d710bc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Await.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Await model. - */ -@Immutable -public final class Await implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Await class. - * - * @param name the name value to set. - */ - @Generated - public Await(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Await from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Await if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Await. - */ - @Generated - public static Await fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Await(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Break.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Break.java deleted file mode 100644 index e5e17e354b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Break.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Break model. - */ -@Immutable -public final class Break implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Break class. - * - * @param name the name value to set. - */ - @Generated - public Break(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Break from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Break if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Break. - */ - @Generated - public static Break fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Break(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/ClassModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/ClassModel.java deleted file mode 100644 index f93dafb3aca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/ClassModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ClassModel model. - */ -@Immutable -public final class ClassModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of ClassModel class. - * - * @param name the name value to set. - */ - @Generated - public ClassModel(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ClassModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ClassModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ClassModel. - */ - @Generated - public static ClassModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ClassModel(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Constructor.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Constructor.java deleted file mode 100644 index cd0ba701821..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Constructor.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Constructor model. - */ -@Immutable -public final class Constructor implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Constructor class. - * - * @param name the name value to set. - */ - @Generated - public Constructor(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Constructor from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Constructor if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Constructor. - */ - @Generated - public static Constructor fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Constructor(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Continue.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Continue.java deleted file mode 100644 index 56a8e1f2c59..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Continue.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Continue model. - */ -@Immutable -public final class Continue implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Continue class. - * - * @param name the name value to set. - */ - @Generated - public Continue(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Continue from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Continue if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Continue. - */ - @Generated - public static Continue fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Continue(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Def.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Def.java deleted file mode 100644 index 1509ac08642..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Def.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Def model. - */ -@Immutable -public final class Def implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Def class. - * - * @param name the name value to set. - */ - @Generated - public Def(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Def from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Def if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Def. - */ - @Generated - public static Def fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Def(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Del.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Del.java deleted file mode 100644 index 538764c687d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Del.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Del model. - */ -@Immutable -public final class Del implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Del class. - * - * @param name the name value to set. - */ - @Generated - public Del(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Del from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Del if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Del. - */ - @Generated - public static Del fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Del(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Elif.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Elif.java deleted file mode 100644 index 1e99697c42f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Elif.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Elif model. - */ -@Immutable -public final class Elif implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Elif class. - * - * @param name the name value to set. - */ - @Generated - public Elif(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Elif from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Elif if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Elif. - */ - @Generated - public static Elif fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Elif(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Else.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Else.java deleted file mode 100644 index 58dad508c86..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Else.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Else model. - */ -@Immutable -public final class Else implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Else class. - * - * @param name the name value to set. - */ - @Generated - public Else(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Else from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Else if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Else. - */ - @Generated - public static Else fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Else(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Except.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Except.java deleted file mode 100644 index 49e2f32c6d4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Except.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Except model. - */ -@Immutable -public final class Except implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Except class. - * - * @param name the name value to set. - */ - @Generated - public Except(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Except from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Except if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Except. - */ - @Generated - public static Except fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Except(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Exec.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Exec.java deleted file mode 100644 index 44a3c3f64f5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Exec.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Exec model. - */ -@Immutable -public final class Exec implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Exec class. - * - * @param name the name value to set. - */ - @Generated - public Exec(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Exec from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Exec if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Exec. - */ - @Generated - public static Exec fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Exec(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Finally.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Finally.java deleted file mode 100644 index 0e339f6cfcd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Finally.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Finally model. - */ -@Immutable -public final class Finally implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Finally class. - * - * @param name the name value to set. - */ - @Generated - public Finally(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Finally from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Finally if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Finally. - */ - @Generated - public static Finally fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Finally(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/For.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/For.java deleted file mode 100644 index 896953f3a67..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/For.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The For model. - */ -@Immutable -public final class For implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of For class. - * - * @param name the name value to set. - */ - @Generated - public For(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of For from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of For if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the For. - */ - @Generated - public static For fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new For(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/From.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/From.java deleted file mode 100644 index 7bc6a331aac..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/From.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The From model. - */ -@Immutable -public final class From implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of From class. - * - * @param name the name value to set. - */ - @Generated - public From(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of From from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of From if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the From. - */ - @Generated - public static From fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new From(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Global.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Global.java deleted file mode 100644 index d6bbcc0d202..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Global.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Global model. - */ -@Immutable -public final class Global implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Global class. - * - * @param name the name value to set. - */ - @Generated - public Global(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Global from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Global if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Global. - */ - @Generated - public static Global fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Global(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/If.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/If.java deleted file mode 100644 index 10f4ba85358..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/If.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The If model. - */ -@Immutable -public final class If implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of If class. - * - * @param name the name value to set. - */ - @Generated - public If(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of If from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of If if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON - * null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the If. - */ - @Generated - public static If fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new If(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Import.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Import.java deleted file mode 100644 index cfd4b3403b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Import.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Import model. - */ -@Immutable -public final class Import implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Import class. - * - * @param name the name value to set. - */ - @Generated - public Import(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Import from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Import if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Import. - */ - @Generated - public static Import fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Import(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/In.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/In.java deleted file mode 100644 index f066ee95c57..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/In.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The In model. - */ -@Immutable -public final class In implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of In class. - * - * @param name the name value to set. - */ - @Generated - public In(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of In from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of In if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON - * null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the In. - */ - @Generated - public static In fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new In(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Is.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Is.java deleted file mode 100644 index 1d8f13e25a1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Is.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Is model. - */ -@Immutable -public final class Is implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Is class. - * - * @param name the name value to set. - */ - @Generated - public Is(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Is from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Is if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON - * null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Is. - */ - @Generated - public static Is fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Is(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Lambda.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Lambda.java deleted file mode 100644 index add869f415b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Lambda.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Lambda model. - */ -@Immutable -public final class Lambda implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Lambda class. - * - * @param name the name value to set. - */ - @Generated - public Lambda(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Lambda from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Lambda if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Lambda. - */ - @Generated - public static Lambda fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Lambda(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Not.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Not.java deleted file mode 100644 index 2dc767ce224..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Not.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Not model. - */ -@Immutable -public final class Not implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Not class. - * - * @param name the name value to set. - */ - @Generated - public Not(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Not from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Not if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Not. - */ - @Generated - public static Not fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Not(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Or.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Or.java deleted file mode 100644 index efbdd54f250..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Or.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Or model. - */ -@Immutable -public final class Or implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Or class. - * - * @param name the name value to set. - */ - @Generated - public Or(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Or from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Or if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON - * null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Or. - */ - @Generated - public static Or fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Or(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Pass.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Pass.java deleted file mode 100644 index 080818c13b1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Pass.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Pass model. - */ -@Immutable -public final class Pass implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Pass class. - * - * @param name the name value to set. - */ - @Generated - public Pass(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Pass from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Pass if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Pass. - */ - @Generated - public static Pass fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Pass(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Raise.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Raise.java deleted file mode 100644 index 7193057a518..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Raise.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Raise model. - */ -@Immutable -public final class Raise implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Raise class. - * - * @param name the name value to set. - */ - @Generated - public Raise(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Raise from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Raise if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Raise. - */ - @Generated - public static Raise fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Raise(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Return.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Return.java deleted file mode 100644 index a3407d7fdff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Return.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Return model. - */ -@Immutable -public final class Return implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Return class. - * - * @param name the name value to set. - */ - @Generated - public Return(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Return from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Return if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Return. - */ - @Generated - public static Return fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Return(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Try.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Try.java deleted file mode 100644 index eccc81c329d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Try.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Try model. - */ -@Immutable -public final class Try implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Try class. - * - * @param name the name value to set. - */ - @Generated - public Try(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Try from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Try if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Try. - */ - @Generated - public static Try fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Try(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/While.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/While.java deleted file mode 100644 index 9123f900817..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/While.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The While model. - */ -@Immutable -public final class While implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of While class. - * - * @param name the name value to set. - */ - @Generated - public While(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of While from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of While if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the While. - */ - @Generated - public static While fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new While(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/With.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/With.java deleted file mode 100644 index c529df30405..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/With.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The With model. - */ -@Immutable -public final class With implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of With class. - * - * @param name the name value to set. - */ - @Generated - public With(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of With from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of With if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the With. - */ - @Generated - public static With fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new With(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Yield.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Yield.java deleted file mode 100644 index dd31e16b12f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Yield.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.models.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Yield model. - */ -@Immutable -public final class Yield implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Yield class. - * - * @param name the name value to set. - */ - @Generated - public Yield(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Yield from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Yield if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Yield. - */ - @Generated - public static Yield fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Yield(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/package-info.java deleted file mode 100644 index 57300012b01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/package-info.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for SpecialWords. - * Scenarios to verify that reserved words can be used in service and generators will handle it appropriately. - * - * Current list of special words - * ```txt - * and - * as - * assert - * async - * await - * break - * class - * constructor - * continue - * def - * del - * elif - * else - * except - * exec - * finally - * for - * from - * global - * if - * import - * in - * is - * lambda - * not - * or - * pass - * raise - * return - * try - * while - * with - * yield - * ```. - * - */ -package specialwords.models.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/package-info.java deleted file mode 100644 index f0c32070d09..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/package-info.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for SpecialWords. - * Scenarios to verify that reserved words can be used in service and generators will handle it appropriately. - * - * Current list of special words - * ```txt - * and - * as - * assert - * async - * await - * break - * class - * constructor - * continue - * def - * del - * elif - * else - * except - * exec - * finally - * for - * from - * global - * if - * import - * in - * is - * lambda - * not - * or - * pass - * raise - * return - * try - * while - * with - * yield - * ```. - * - */ -package specialwords; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlAsyncClient.java deleted file mode 100644 index 53049ae37d3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlAsyncClient.java +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package streaming.jsonl; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import streaming.jsonl.implementation.BasicsImpl; - -/** - * Initializes a new instance of the asynchronous JsonlClient type. - */ -@ServiceClient(builder = JsonlClientBuilder.class, isAsync = true) -public final class JsonlAsyncClient { - @Generated - private final BasicsImpl serviceClient; - - /** - * Initializes an instance of JsonlAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - JsonlAsyncClient(BasicsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(body, requestOptions); - } - - /** - * The receive operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> receiveWithResponse(RequestOptions requestOptions) { - return this.serviceClient.receiveWithResponseAsync(requestOptions); - } - - /** - * The send operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(BinaryData body) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - return sendWithResponse(body, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The receive operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono receive() { - // Generated convenience method for receiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return receiveWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClient.java deleted file mode 100644 index 4b5a4666fcb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClient.java +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package streaming.jsonl; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import streaming.jsonl.implementation.BasicsImpl; - -/** - * Initializes a new instance of the synchronous JsonlClient type. - */ -@ServiceClient(builder = JsonlClientBuilder.class) -public final class JsonlClient { - @Generated - private final BasicsImpl serviceClient; - - /** - * Initializes an instance of JsonlClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - JsonlClient(BasicsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(body, requestOptions); - } - - /** - * The receive operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response receiveWithResponse(RequestOptions requestOptions) { - return this.serviceClient.receiveWithResponse(requestOptions); - } - - /** - * The send operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(BinaryData body) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - sendWithResponse(body, requestOptions).getValue(); - } - - /** - * The receive operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData receive() { - // Generated convenience method for receiveWithResponse - RequestOptions requestOptions = new RequestOptions(); - return receiveWithResponse(requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClientBuilder.java deleted file mode 100644 index 6e088df63ff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package streaming.jsonl; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import streaming.jsonl.implementation.JsonlClientImpl; - -/** - * A builder for creating a new instance of the JsonlClient type. - */ -@ServiceClientBuilder(serviceClients = { JsonlClient.class, JsonlAsyncClient.class }) -public final class JsonlClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("streaming-jsonl.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the JsonlClientBuilder. - */ - @Generated - public JsonlClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonlClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonlClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonlClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonlClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonlClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonlClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonlClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public JsonlClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the JsonlClientBuilder. - */ - @Generated - public JsonlClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of JsonlClientImpl with the provided parameters. - * - * @return an instance of JsonlClientImpl. - */ - @Generated - private JsonlClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - JsonlClientImpl client - = new JsonlClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of JsonlAsyncClient class. - * - * @return an instance of JsonlAsyncClient. - */ - @Generated - public JsonlAsyncClient buildAsyncClient() { - return new JsonlAsyncClient(buildInnerClient().getBasics()); - } - - /** - * Builds an instance of JsonlClient class. - * - * @return an instance of JsonlClient. - */ - @Generated - public JsonlClient buildClient() { - return new JsonlClient(buildInnerClient().getBasics()); - } - - private static final ClientLogger LOGGER = new ClientLogger(JsonlClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/BasicsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/BasicsImpl.java deleted file mode 100644 index 633eb69a5e1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/BasicsImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package streaming.jsonl.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Basics. - */ -public final class BasicsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BasicsService service; - - /** - * The service client containing this operation class. - */ - private final JsonlClientImpl client; - - /** - * Initializes an instance of BasicsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BasicsImpl(JsonlClientImpl client) { - this.service = RestProxy.create(BasicsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for JsonlClientBasics to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "JsonlClientBasics") - public interface BasicsService { - @Post("/streaming/jsonl/basic/send") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/jsonl") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/streaming/jsonl/basic/send") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, - @BodyParam("application/jsonl") BinaryData body, RequestOptions requestOptions, Context context); - - @Get("/streaming/jsonl/basic/receive") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> receive(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/streaming/jsonl/basic/receive") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response receiveSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/jsonl"; - return FluxUtil.withContext( - context -> service.send(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/jsonl"; - return service.sendSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The receive operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> receiveWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/jsonl"; - return FluxUtil - .withContext(context -> service.receive(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The receive operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response receiveWithResponse(RequestOptions requestOptions) { - final String accept = "application/jsonl"; - return service.receiveSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/JsonlClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/JsonlClientImpl.java deleted file mode 100644 index 3830f1b5707..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/JsonlClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package streaming.jsonl.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 JsonlClient type. - */ -public final class JsonlClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 BasicsImpl object to access its operations. - */ - private final BasicsImpl basics; - - /** - * Gets the BasicsImpl object to access its operations. - * - * @return the BasicsImpl object. - */ - public BasicsImpl getBasics() { - return this.basics; - } - - /** - * Initializes an instance of JsonlClient client. - * - * @param endpoint Service host. - */ - public JsonlClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of JsonlClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public JsonlClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of JsonlClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public JsonlClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.basics = new BasicsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/package-info.java deleted file mode 100644 index fdc79595592..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Jsonl. - * Test of jsonl streaming. - * - */ -package streaming.jsonl.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/package-info.java deleted file mode 100644 index 3ed6455bbf5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Jsonl. - * Test of jsonl streaming. - * - */ -package streaming.jsonl; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/ArmCustomizationManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/ArmCustomizationManager.java deleted file mode 100644 index 52bf9fa4c6a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/ArmCustomizationManager.java +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armcustomization; - -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import tsptest.armcustomization.fluent.ArmCustomizationClient; -import tsptest.armcustomization.implementation.ArmCustomizationClientBuilder; -import tsptest.armcustomization.implementation.VaultsImpl; -import tsptest.armcustomization.models.Vaults; - -/** - * Entry point to ArmCustomizationManager. - * Arm Resource Provider management API. - */ -public final class ArmCustomizationManager { - private Vaults vaults; - - private final ArmCustomizationClient clientObject; - - private ArmCustomizationManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new ArmCustomizationClientBuilder().pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of ArmCustomization service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the ArmCustomization service API instance. - */ - public static ArmCustomizationManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return configure().authenticate(credential, profile); - } - - /** - * Creates an instance of ArmCustomization service API entry point. - * - * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. - * @param profile the Azure profile for client. - * @return the ArmCustomization service API instance. - */ - public static ArmCustomizationManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return new ArmCustomizationManager(httpPipeline, profile, null); - } - - /** - * Gets a Configurable instance that can be used to create ArmCustomizationManager with optional configuration. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new ArmCustomizationManager.Configurable(); - } - - /** - * The Configurable allowing configurations to be set. - */ - public static final class Configurable { - private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); - private static final String SDK_VERSION = "version"; - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-resourcemanager-armcustomization-generated.properties"); - - private HttpClient httpClient; - private HttpLogOptions httpLogOptions; - private final List policies = new ArrayList<>(); - private final List scopes = new ArrayList<>(); - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - private Duration defaultPollInterval; - - private Configurable() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - return this; - } - - /** - * Adds the scope to permission sets. - * - * @param scope the scope. - * @return the configurable object itself. - */ - public Configurable withScope(String scope) { - this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); - return this; - } - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - /** - * Sets the default poll interval, used when service does not provide "Retry-After" header. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval - = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of ArmCustomization service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the ArmCustomization service API instance. - */ - public ArmCustomizationManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder.append("azsdk-java") - .append("-") - .append("tsptest.armcustomization") - .append("/") - .append(clientVersion); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder.append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(userAgentBuilder.toString())); - policies.add(new AddHeadersFromContextPolicy()); - policies.add(new RequestIdPolicy()); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy); - policies.add(new AddDatePolicy()); - policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new ArmCustomizationManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * Gets the resource collection API of Vaults. - * - * @return Resource collection API of Vaults. - */ - public Vaults vaults() { - if (this.vaults == null) { - this.vaults = new VaultsImpl(clientObject.getVaults(), this); - } - return vaults; - } - - /** - * Gets wrapped service client ArmCustomizationClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. - * - * @return Wrapped service client ArmCustomizationClient. - */ - public ArmCustomizationClient serviceClient() { - return this.clientObject; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/ArmCustomizationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/ArmCustomizationClient.java deleted file mode 100644 index 61586d01636..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/ArmCustomizationClient.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armcustomization.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for ArmCustomizationClient class. - */ -public interface ArmCustomizationClient { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the VaultsClient object to access its operations. - * - * @return the VaultsClient object. - */ - VaultsClient getVaults(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/VaultsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/VaultsClient.java deleted file mode 100644 index 5de29857fab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/VaultsClient.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armcustomization.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import tsptest.armcustomization.fluent.models.VaultInner; - -/** - * An instance of this class provides access to all the operations defined in VaultsClient. - */ -public interface VaultsClient { - /** - * Gets the specified Azure key vault. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vaultName The name of the Vault. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the specified Azure key vault along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, Context context); - - /** - * Gets the specified Azure key vault. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vaultName The name of the Vault. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the specified Azure key vault. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - VaultInner getByResourceGroup(String resourceGroupName, String vaultName); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/VaultInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/VaultInner.java deleted file mode 100644 index 80c96f0b38d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/VaultInner.java +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. -package tsptest.armcustomization.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; -import tsptest.armcustomization.models.VaultProperties; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Immutable -public final class VaultInner extends Resource { - - /* - * The RP-specific properties for this resource. - */ - private VaultProperties properties; - - /* - * Resource tags. - */ - private Map tags; - - /* - * The geo-location where the resource lives - */ - private String location; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of VaultInner class. - */ - private VaultInner() { - } - - /** - * Get the properties property: The RP-specific properties for this resource. - * - * @return the properties value. - */ - public VaultProperties properties() { - return this.properties; - } - - /** - * Get the tags property: Resource tags. - * - * @return the tags value. - */ - public Map tags() { - return this.tags; - } - - /** - * Get the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - public String location() { - return this.location; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.properties); - jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); - jsonWriter.writeStringField("location", this.location); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of VaultInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of VaultInner if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the VaultInner. - */ - public static VaultInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - VaultInner deserializedVaultInner = new VaultInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - if ("id".equals(fieldName)) { - deserializedVaultInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedVaultInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedVaultInner.type = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedVaultInner.properties = VaultProperties.fromJson(reader); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedVaultInner.tags = tags; - } else if ("location".equals(fieldName)) { - deserializedVaultInner.location = reader.getString(); - } else if ("systemData".equals(fieldName)) { - deserializedVaultInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return deserializedVaultInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/package-info.java deleted file mode 100644 index e1a0ba70b6f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the inner data models for ArmCustomization. - * Arm Resource Provider management API. - */ -package tsptest.armcustomization.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/package-info.java deleted file mode 100644 index 8f005f15551..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the service clients for ArmCustomization. - * Arm Resource Provider management API. - */ -package tsptest.armcustomization.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientBuilder.java deleted file mode 100644 index ba4a09a5d53..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armcustomization.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** - * A builder for creating a new instance of the ArmCustomizationClientImpl type. - */ -@ServiceClientBuilder(serviceClients = { ArmCustomizationClientImpl.class }) -public final class ArmCustomizationClientBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the ArmCustomizationClientBuilder. - */ - public ArmCustomizationClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The ID of the target subscription. The value must be an UUID. - */ - private String subscriptionId; - - /** - * Sets The ID of the target subscription. The value must be an UUID. - * - * @param subscriptionId the subscriptionId value. - * @return the ArmCustomizationClientBuilder. - */ - public ArmCustomizationClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the ArmCustomizationClientBuilder. - */ - public ArmCustomizationClientBuilder environment(AzureEnvironment environment) { - this.environment = environment; - 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 ArmCustomizationClientBuilder. - */ - public ArmCustomizationClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the ArmCustomizationClientBuilder. - */ - public ArmCustomizationClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - 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 ArmCustomizationClientBuilder. - */ - public ArmCustomizationClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of ArmCustomizationClientImpl with the provided parameters. - * - * @return an instance of ArmCustomizationClientImpl. - */ - public ArmCustomizationClientImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval - = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - ArmCustomizationClientImpl client = new ArmCustomizationClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientImpl.java deleted file mode 100644 index bb97758a5fd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientImpl.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armcustomization.implementation; - -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.management.polling.SyncPollerFactory; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armcustomization.fluent.ArmCustomizationClient; -import tsptest.armcustomization.fluent.VaultsClient; - -/** - * Initializes a new instance of the ArmCustomizationClientImpl type. - */ -@ServiceClient(builder = ArmCustomizationClientBuilder.class) -public final class ArmCustomizationClientImpl implements ArmCustomizationClient { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Version parameter. - */ - private final String apiVersion; - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * The ID of the target subscription. The value must be an UUID. - */ - private final String subscriptionId; - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * 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. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The VaultsClient object to access its operations. - */ - private final VaultsClient vaults; - - /** - * Gets the VaultsClient object to access its operations. - * - * @return the VaultsClient object. - */ - public VaultsClient getVaults() { - return this.vaults; - } - - /** - * Initializes an instance of ArmCustomizationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - ArmCustomizationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.apiVersion = "2023-12-01-preview"; - this.vaults = new VaultsClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return SyncPoller for poll result and final result. - */ - public SyncPoller, U> getLroResult(Response activationResponse, - Type pollResultType, Type finalResultType, Context context) { - return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, () -> activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ArmCustomizationClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ResourceManagerUtils.java deleted file mode 100644 index 27e3a303f34..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ResourceManagerUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armcustomization.implementation; - -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.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class ResourceManagerUtils { - private ResourceManagerUtils() { - } - - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (!segments.isEmpty() && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl<>(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux - .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(iterable.iterator(), mapper); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultImpl.java deleted file mode 100644 index 18ed66f5db9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armcustomization.implementation; - -import com.azure.core.management.SystemData; -import java.util.Collections; -import java.util.Map; -import tsptest.armcustomization.fluent.models.VaultInner; -import tsptest.armcustomization.models.Vault; -import tsptest.armcustomization.models.VaultProperties; - -public final class VaultImpl implements Vault { - private VaultInner innerObject; - - private final tsptest.armcustomization.ArmCustomizationManager serviceManager; - - VaultImpl(VaultInner innerObject, tsptest.armcustomization.ArmCustomizationManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public VaultProperties properties() { - return this.innerModel().properties(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public String location() { - return this.innerModel().location(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public VaultInner innerModel() { - return this.innerObject; - } - - private tsptest.armcustomization.ArmCustomizationManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsClientImpl.java deleted file mode 100644 index 37f500ade56..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsClientImpl.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armcustomization.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.armcustomization.fluent.VaultsClient; -import tsptest.armcustomization.fluent.models.VaultInner; - -/** - * An instance of this class provides access to all the operations defined in VaultsClient. - */ -public final class VaultsClientImpl implements VaultsClient { - /** - * The proxy service used to perform REST calls. - */ - private final VaultsService service; - - /** - * The service client containing this operation class. - */ - private final ArmCustomizationClientImpl client; - - /** - * Initializes an instance of VaultsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - VaultsClientImpl(ArmCustomizationClientImpl client) { - this.service = RestProxy.create(VaultsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmCustomizationClientVaults to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmCustomizationClientVaults") - public interface VaultsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmCustomization/vaults/{vaultName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmCustomization/vaults/{vaultName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Gets the specified Azure key vault. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vaultName The name of the Vault. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the specified Azure key vault along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String vaultName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, vaultName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Gets the specified Azure key vault. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vaultName The name of the Vault. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the specified Azure key vault on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, String vaultName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, vaultName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Gets the specified Azure key vault. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vaultName The name of the Vault. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the specified Azure key vault along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, - Context context) { - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, vaultName, accept, context); - } - - /** - * Gets the specified Azure key vault. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vaultName The name of the Vault. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the specified Azure key vault. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public VaultInner getByResourceGroup(String resourceGroupName, String vaultName) { - return getByResourceGroupWithResponse(resourceGroupName, vaultName, Context.NONE).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsImpl.java deleted file mode 100644 index 7f656c6cabc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armcustomization.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armcustomization.fluent.VaultsClient; -import tsptest.armcustomization.fluent.models.VaultInner; -import tsptest.armcustomization.models.Vault; -import tsptest.armcustomization.models.Vaults; - -public final class VaultsImpl implements Vaults { - private static final ClientLogger LOGGER = new ClientLogger(VaultsImpl.class); - - private final VaultsClient innerClient; - - private final tsptest.armcustomization.ArmCustomizationManager serviceManager; - - public VaultsImpl(VaultsClient innerClient, tsptest.armcustomization.ArmCustomizationManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, Context context) { - Response inner - = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, vaultName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new VaultImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public Vault getByResourceGroup(String resourceGroupName, String vaultName) { - VaultInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, vaultName); - if (inner != null) { - return new VaultImpl(inner, this.manager()); - } else { - return null; - } - } - - private VaultsClient serviceClient() { - return this.innerClient; - } - - private tsptest.armcustomization.ArmCustomizationManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/package-info.java deleted file mode 100644 index 5b21792c461..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the implementations for ArmCustomization. - * Arm Resource Provider management API. - */ -package tsptest.armcustomization.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vault.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vault.java deleted file mode 100644 index 239eaeeae1f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vault.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armcustomization.models; - -import com.azure.core.management.SystemData; -import java.util.Map; -import tsptest.armcustomization.fluent.models.VaultInner; - -/** - * An immutable client-side representation of Vault. - */ -public interface Vault { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the properties property: The RP-specific properties for this resource. - * - * @return the properties value. - */ - VaultProperties properties(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the inner tsptest.armcustomization.fluent.models.VaultInner object. - * - * @return the inner object. - */ - VaultInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/VaultProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/VaultProperties.java deleted file mode 100644 index d6989dc5adb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/VaultProperties.java +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armcustomization.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Properties of the vault. - */ -@Immutable -public final class VaultProperties implements JsonSerializable { - /* - * Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic - * except private endpoint traffic and that that originates from trusted services will be blocked. This will - * override the set firewall rules, meaning that even if the firewall rules are present we will not honor the rules. - */ - private String publicNetworkAccess; - - /** - * Creates an instance of VaultProperties class. - */ - private VaultProperties() { - } - - /** - * Get the publicNetworkAccess property: Property to specify whether the vault will accept traffic from public - * internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted - * services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are - * present we will not honor the rules. - * - * @return the publicNetworkAccess value. - */ - public String publicNetworkAccess() { - return this.publicNetworkAccess; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("publicNetworkAccess", this.publicNetworkAccess); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of VaultProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of VaultProperties if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the VaultProperties. - */ - public static VaultProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - VaultProperties deserializedVaultProperties = new VaultProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("publicNetworkAccess".equals(fieldName)) { - deserializedVaultProperties.publicNetworkAccess = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedVaultProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vaults.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vaults.java deleted file mode 100644 index f4bd41695d1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vaults.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armcustomization.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of Vaults. - */ -public interface Vaults { - /** - * Gets the specified Azure key vault. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vaultName The name of the Vault. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the specified Azure key vault along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, Context context); - - /** - * Gets the specified Azure key vault. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param vaultName The name of the Vault. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the specified Azure key vault. - */ - Vault getByResourceGroup(String resourceGroupName, String vaultName); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/package-info.java deleted file mode 100644 index 3cc45547178..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the data models for ArmCustomization. - * Arm Resource Provider management API. - */ -package tsptest.armcustomization.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/package-info.java deleted file mode 100644 index cd3311db413..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the classes for ArmCustomization. - * Arm Resource Provider management API. - */ -package tsptest.armcustomization; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/ArmLegacyManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/ArmLegacyManager.java deleted file mode 100644 index 234c70b7d11..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/ArmLegacyManager.java +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy; - -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import tsptest.armlegacy.fluent.ArmLegacyClient; -import tsptest.armlegacy.implementation.ArmLegacyClientBuilder; -import tsptest.armlegacy.implementation.SkusImpl; -import tsptest.armlegacy.models.Skus; - -/** - * Entry point to ArmLegacyManager. - * Arm Resource Provider management API. - */ -public final class ArmLegacyManager { - private Skus skus; - - private final ArmLegacyClient clientObject; - - private ArmLegacyManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new ArmLegacyClientBuilder().pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of ArmLegacy service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the ArmLegacy service API instance. - */ - public static ArmLegacyManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return configure().authenticate(credential, profile); - } - - /** - * Creates an instance of ArmLegacy service API entry point. - * - * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. - * @param profile the Azure profile for client. - * @return the ArmLegacy service API instance. - */ - public static ArmLegacyManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return new ArmLegacyManager(httpPipeline, profile, null); - } - - /** - * Gets a Configurable instance that can be used to create ArmLegacyManager with optional configuration. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new ArmLegacyManager.Configurable(); - } - - /** - * The Configurable allowing configurations to be set. - */ - public static final class Configurable { - private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); - private static final String SDK_VERSION = "version"; - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-resourcemanager-armlegacy-generated.properties"); - - private HttpClient httpClient; - private HttpLogOptions httpLogOptions; - private final List policies = new ArrayList<>(); - private final List scopes = new ArrayList<>(); - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - private Duration defaultPollInterval; - - private Configurable() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - return this; - } - - /** - * Adds the scope to permission sets. - * - * @param scope the scope. - * @return the configurable object itself. - */ - public Configurable withScope(String scope) { - this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); - return this; - } - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - /** - * Sets the default poll interval, used when service does not provide "Retry-After" header. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval - = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of ArmLegacy service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the ArmLegacy service API instance. - */ - public ArmLegacyManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder.append("azsdk-java") - .append("-") - .append("tsptest.armlegacy") - .append("/") - .append(clientVersion); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder.append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(userAgentBuilder.toString())); - policies.add(new AddHeadersFromContextPolicy()); - policies.add(new RequestIdPolicy()); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy); - policies.add(new AddDatePolicy()); - policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new ArmLegacyManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * Gets the resource collection API of Skus. It manages SkuResource. - * - * @return Resource collection API of Skus. - */ - public Skus skus() { - if (this.skus == null) { - this.skus = new SkusImpl(clientObject.getSkus(), this); - } - return skus; - } - - /** - * Gets wrapped service client ArmLegacyClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. - * - * @return Wrapped service client ArmLegacyClient. - */ - public ArmLegacyClient serviceClient() { - return this.clientObject; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/ArmLegacyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/ArmLegacyClient.java deleted file mode 100644 index f33b4a5b345..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/ArmLegacyClient.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for ArmLegacyClient class. - */ -public interface ArmLegacyClient { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the SkusClient object to access its operations. - * - * @return the SkusClient object. - */ - SkusClient getSkus(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/SkusClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/SkusClient.java deleted file mode 100644 index 26a5b4a17ed..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/SkusClient.java +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import tsptest.armlegacy.fluent.models.SkuResourceInner; - -/** - * An instance of this class provides access to all the operations defined in SkusClient. - */ -public interface SkusClient { - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getNestedWithResponse(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, Context context); - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SkuResourceInner getNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, - String sku); - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response createNestedWithResponse(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, SkuResourceInner resource, Context context); - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SkuResourceInner createNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, - String sku, SkuResourceInner resource); - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteNestedWithResponse(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, Context context); - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void deleteNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, String sku); - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getRootWithResponse(String providerNamespace, String resourceType, String sku, - Context context); - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SkuResourceInner getRoot(String providerNamespace, String resourceType, String sku); - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response createRootWithResponse(String providerNamespace, String resourceType, String sku, - SkuResourceInner resource, Context context); - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SkuResourceInner createRoot(String providerNamespace, String resourceType, String sku, SkuResourceInner resource); - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteRootWithResponse(String providerNamespace, String resourceType, String sku, Context context); - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void deleteRoot(String providerNamespace, String resourceType, String sku); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/SkuResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/SkuResourceInner.java deleted file mode 100644 index 21e966d91e5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/SkuResourceInner.java +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armlegacy.models.ResourceTypeSku; - -/** - * Concrete proxy resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class SkuResourceInner extends ProxyResource { - /* - * The resource-specific properties for this resource. - */ - private ResourceTypeSku properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of SkuResourceInner class. - */ - public SkuResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public ResourceTypeSku properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the SkuResourceInner object itself. - */ - public SkuResourceInner withProperties(ResourceTypeSku properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SkuResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SkuResourceInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SkuResourceInner. - */ - public static SkuResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SkuResourceInner deserializedSkuResourceInner = new SkuResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedSkuResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedSkuResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedSkuResourceInner.type = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedSkuResourceInner.properties = ResourceTypeSku.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedSkuResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedSkuResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/package-info.java deleted file mode 100644 index 943d736868c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the inner data models for ArmLegacy. - * Arm Resource Provider management API. - */ -package tsptest.armlegacy.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/package-info.java deleted file mode 100644 index f1f346a9dd2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the service clients for ArmLegacy. - * Arm Resource Provider management API. - */ -package tsptest.armlegacy.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientBuilder.java deleted file mode 100644 index cdf55e70138..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** - * A builder for creating a new instance of the ArmLegacyClientImpl type. - */ -@ServiceClientBuilder(serviceClients = { ArmLegacyClientImpl.class }) -public final class ArmLegacyClientBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the ArmLegacyClientBuilder. - */ - public ArmLegacyClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The ID of the target subscription. The value must be an UUID. - */ - private String subscriptionId; - - /** - * Sets The ID of the target subscription. The value must be an UUID. - * - * @param subscriptionId the subscriptionId value. - * @return the ArmLegacyClientBuilder. - */ - public ArmLegacyClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the ArmLegacyClientBuilder. - */ - public ArmLegacyClientBuilder environment(AzureEnvironment environment) { - this.environment = environment; - 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 ArmLegacyClientBuilder. - */ - public ArmLegacyClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the ArmLegacyClientBuilder. - */ - public ArmLegacyClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - 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 ArmLegacyClientBuilder. - */ - public ArmLegacyClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of ArmLegacyClientImpl with the provided parameters. - * - * @return an instance of ArmLegacyClientImpl. - */ - public ArmLegacyClientImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval - = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - ArmLegacyClientImpl client = new ArmLegacyClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientImpl.java deleted file mode 100644 index 032d64f27d7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientImpl.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.implementation; - -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.management.polling.SyncPollerFactory; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armlegacy.fluent.ArmLegacyClient; -import tsptest.armlegacy.fluent.SkusClient; - -/** - * Initializes a new instance of the ArmLegacyClientImpl type. - */ -@ServiceClient(builder = ArmLegacyClientBuilder.class) -public final class ArmLegacyClientImpl implements ArmLegacyClient { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Version parameter. - */ - private final String apiVersion; - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * The ID of the target subscription. The value must be an UUID. - */ - private final String subscriptionId; - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * 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. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The SkusClient object to access its operations. - */ - private final SkusClient skus; - - /** - * Gets the SkusClient object to access its operations. - * - * @return the SkusClient object. - */ - public SkusClient getSkus() { - return this.skus; - } - - /** - * Initializes an instance of ArmLegacyClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - ArmLegacyClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, - AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.apiVersion = "2024-12-01"; - this.skus = new SkusClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return SyncPoller for poll result and final result. - */ - public SyncPoller, U> getLroResult(Response activationResponse, - Type pollResultType, Type finalResultType, Context context) { - return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, () -> activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ArmLegacyClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ResourceManagerUtils.java deleted file mode 100644 index 96b4a0a5a0b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ResourceManagerUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.implementation; - -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.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class ResourceManagerUtils { - private ResourceManagerUtils() { - } - - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (!segments.isEmpty() && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl<>(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux - .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(iterable.iterator(), mapper); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkuResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkuResourceImpl.java deleted file mode 100644 index c0d6172ee36..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkuResourceImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.implementation; - -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import tsptest.armlegacy.fluent.models.SkuResourceInner; -import tsptest.armlegacy.models.ResourceTypeSku; -import tsptest.armlegacy.models.SkuResource; - -public final class SkuResourceImpl implements SkuResource, SkuResource.Definition { - private SkuResourceInner innerObject; - - private final tsptest.armlegacy.ArmLegacyManager serviceManager; - - SkuResourceImpl(SkuResourceInner innerObject, tsptest.armlegacy.ArmLegacyManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public ResourceTypeSku properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public SkuResourceInner innerModel() { - return this.innerObject; - } - - private tsptest.armlegacy.ArmLegacyManager manager() { - return this.serviceManager; - } - - private String providerNamespace; - - private String resourceType; - - private String sku; - - public SkuResourceImpl withExistingResourcetypeRegistration(String providerNamespace, String resourceType) { - this.providerNamespace = providerNamespace; - this.resourceType = resourceType; - return this; - } - - public SkuResource create() { - this.innerObject = serviceManager.serviceClient() - .getSkus() - .createRootWithResponse(providerNamespace, resourceType, sku, this.innerModel(), Context.NONE) - .getValue(); - return this; - } - - public SkuResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getSkus() - .createRootWithResponse(providerNamespace, resourceType, sku, this.innerModel(), context) - .getValue(); - return this; - } - - SkuResourceImpl(String name, tsptest.armlegacy.ArmLegacyManager serviceManager) { - this.innerObject = new SkuResourceInner(); - this.serviceManager = serviceManager; - this.sku = name; - } - - public SkuResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getSkus() - .getRootWithResponse(providerNamespace, resourceType, sku, Context.NONE) - .getValue(); - return this; - } - - public SkuResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getSkus() - .getRootWithResponse(providerNamespace, resourceType, sku, context) - .getValue(); - return this; - } - - public SkuResourceImpl withProperties(ResourceTypeSku properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusClientImpl.java deleted file mode 100644 index 094bde38477..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusClientImpl.java +++ /dev/null @@ -1,662 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.armlegacy.fluent.SkusClient; -import tsptest.armlegacy.fluent.models.SkuResourceInner; - -/** - * An instance of this class provides access to all the operations defined in SkusClient. - */ -public final class SkusClientImpl implements SkusClient { - /** - * The proxy service used to perform REST calls. - */ - private final SkusService service; - - /** - * The service client containing this operation class. - */ - private final ArmLegacyClientImpl client; - - /** - * Initializes an instance of SkusClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SkusClientImpl(ArmLegacyClientImpl client) { - this.service = RestProxy.create(SkusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmLegacyClientSkus to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmLegacyClientSkus") - public interface SkusService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getNested(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, - @PathParam("nestedResourceTypeFirst") String nestedResourceTypeFirst, @PathParam("sku") String sku, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getNestedSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, - @PathParam("nestedResourceTypeFirst") String nestedResourceTypeFirst, @PathParam("sku") String sku, - @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createNested(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, - @PathParam("nestedResourceTypeFirst") String nestedResourceTypeFirst, @PathParam("sku") String sku, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") SkuResourceInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createNestedSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, - @PathParam("nestedResourceTypeFirst") String nestedResourceTypeFirst, @PathParam("sku") String sku, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") SkuResourceInner resource, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> deleteNested(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, - @PathParam("nestedResourceTypeFirst") String nestedResourceTypeFirst, @PathParam("sku") String sku, - Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteNestedSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, - @PathParam("nestedResourceTypeFirst") String nestedResourceTypeFirst, @PathParam("sku") String sku, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getRoot(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, - @PathParam("sku") String sku, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getRootSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, - @PathParam("sku") String sku, @HeaderParam("Accept") String accept, Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createRoot(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, - @PathParam("sku") String sku, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") SkuResourceInner resource, - Context context); - - @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createRootSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, - @PathParam("sku") String sku, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") SkuResourceInner resource, - Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> deleteRoot(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, - @PathParam("sku") String sku, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteRootSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, - @PathParam("sku") String sku, Context context); - } - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getNestedWithResponseAsync(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNested(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), providerNamespace, resourceType, nestedResourceTypeFirst, sku, accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getNestedAsync(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku) { - return getNestedWithResponseAsync(providerNamespace, resourceType, nestedResourceTypeFirst, sku) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNestedWithResponse(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, Context context) { - final String accept = "application/json"; - return service.getNestedSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), providerNamespace, resourceType, nestedResourceTypeFirst, sku, accept, - context); - } - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SkuResourceInner getNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, - String sku) { - return getNestedWithResponse(providerNamespace, resourceType, nestedResourceTypeFirst, sku, Context.NONE) - .getValue(); - } - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createNestedWithResponseAsync(String providerNamespace, - String resourceType, String nestedResourceTypeFirst, String sku, SkuResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createNested(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), providerNamespace, resourceType, nestedResourceTypeFirst, sku, - contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createNestedAsync(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, SkuResourceInner resource) { - return createNestedWithResponseAsync(providerNamespace, resourceType, nestedResourceTypeFirst, sku, resource) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createNestedWithResponse(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, SkuResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createNestedSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), providerNamespace, resourceType, nestedResourceTypeFirst, sku, contentType, - accept, resource, context); - } - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SkuResourceInner createNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, - String sku, SkuResourceInner resource) { - return createNestedWithResponse(providerNamespace, resourceType, nestedResourceTypeFirst, sku, resource, - Context.NONE).getValue(); - } - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteNestedWithResponseAsync(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku) { - return FluxUtil - .withContext(context -> service.deleteNested(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), providerNamespace, resourceType, nestedResourceTypeFirst, sku, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteNestedAsync(String providerNamespace, String resourceType, String nestedResourceTypeFirst, - String sku) { - return deleteNestedWithResponseAsync(providerNamespace, resourceType, nestedResourceTypeFirst, sku) - .flatMap(ignored -> Mono.empty()); - } - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteNestedWithResponse(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, Context context) { - return service.deleteNestedSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), providerNamespace, resourceType, nestedResourceTypeFirst, sku, context); - } - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, - String sku) { - deleteNestedWithResponse(providerNamespace, resourceType, nestedResourceTypeFirst, sku, Context.NONE); - } - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getRootWithResponseAsync(String providerNamespace, String resourceType, - String sku) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getRoot(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), providerNamespace, resourceType, sku, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getRootAsync(String providerNamespace, String resourceType, String sku) { - return getRootWithResponseAsync(providerNamespace, resourceType, sku) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRootWithResponse(String providerNamespace, String resourceType, String sku, - Context context) { - final String accept = "application/json"; - return service.getRootSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), providerNamespace, resourceType, sku, accept, context); - } - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SkuResourceInner getRoot(String providerNamespace, String resourceType, String sku) { - return getRootWithResponse(providerNamespace, resourceType, sku, Context.NONE).getValue(); - } - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createRootWithResponseAsync(String providerNamespace, String resourceType, - String sku, SkuResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createRoot(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), providerNamespace, resourceType, sku, contentType, accept, resource, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createRootAsync(String providerNamespace, String resourceType, String sku, - SkuResourceInner resource) { - return createRootWithResponseAsync(providerNamespace, resourceType, sku, resource) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createRootWithResponse(String providerNamespace, String resourceType, String sku, - SkuResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createRootSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), providerNamespace, resourceType, sku, contentType, accept, resource, - context); - } - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SkuResourceInner createRoot(String providerNamespace, String resourceType, String sku, - SkuResourceInner resource) { - return createRootWithResponse(providerNamespace, resourceType, sku, resource, Context.NONE).getValue(); - } - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteRootWithResponseAsync(String providerNamespace, String resourceType, - String sku) { - return FluxUtil - .withContext(context -> service.deleteRoot(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), providerNamespace, resourceType, sku, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteRootAsync(String providerNamespace, String resourceType, String sku) { - return deleteRootWithResponseAsync(providerNamespace, resourceType, sku).flatMap(ignored -> Mono.empty()); - } - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteRootWithResponse(String providerNamespace, String resourceType, String sku, - Context context) { - return service.deleteRootSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), providerNamespace, resourceType, sku, context); - } - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteRoot(String providerNamespace, String resourceType, String sku) { - deleteRootWithResponse(providerNamespace, resourceType, sku, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusImpl.java deleted file mode 100644 index 99a246c7aef..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armlegacy.fluent.SkusClient; -import tsptest.armlegacy.fluent.models.SkuResourceInner; -import tsptest.armlegacy.models.SkuResource; -import tsptest.armlegacy.models.Skus; - -public final class SkusImpl implements Skus { - private static final ClientLogger LOGGER = new ClientLogger(SkusImpl.class); - - private final SkusClient innerClient; - - private final tsptest.armlegacy.ArmLegacyManager serviceManager; - - public SkusImpl(SkusClient innerClient, tsptest.armlegacy.ArmLegacyManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getNestedWithResponse(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, Context context) { - Response inner = this.serviceClient() - .getNestedWithResponse(providerNamespace, resourceType, nestedResourceTypeFirst, sku, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SkuResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public SkuResource getNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, - String sku) { - SkuResourceInner inner - = this.serviceClient().getNested(providerNamespace, resourceType, nestedResourceTypeFirst, sku); - if (inner != null) { - return new SkuResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response createNestedWithResponse(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, SkuResourceInner resource, Context context) { - Response inner = this.serviceClient() - .createNestedWithResponse(providerNamespace, resourceType, nestedResourceTypeFirst, sku, resource, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SkuResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public SkuResource createNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, - String sku, SkuResourceInner resource) { - SkuResourceInner inner = this.serviceClient() - .createNested(providerNamespace, resourceType, nestedResourceTypeFirst, sku, resource); - if (inner != null) { - return new SkuResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteNestedWithResponse(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, Context context) { - return this.serviceClient() - .deleteNestedWithResponse(providerNamespace, resourceType, nestedResourceTypeFirst, sku, context); - } - - public void deleteNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, - String sku) { - this.serviceClient().deleteNested(providerNamespace, resourceType, nestedResourceTypeFirst, sku); - } - - public Response getRootWithResponse(String providerNamespace, String resourceType, String sku, - Context context) { - Response inner - = this.serviceClient().getRootWithResponse(providerNamespace, resourceType, sku, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SkuResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public SkuResource getRoot(String providerNamespace, String resourceType, String sku) { - SkuResourceInner inner = this.serviceClient().getRoot(providerNamespace, resourceType, sku); - if (inner != null) { - return new SkuResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteRootWithResponse(String providerNamespace, String resourceType, String sku, - Context context) { - return this.serviceClient().deleteRootWithResponse(providerNamespace, resourceType, sku, context); - } - - public void deleteRoot(String providerNamespace, String resourceType, String sku) { - this.serviceClient().deleteRoot(providerNamespace, resourceType, sku); - } - - public SkuResource getRootById(String id) { - String providerNamespace = ResourceManagerUtils.getValueFromIdByName(id, "providerRegistrations"); - if (providerNamespace == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'providerRegistrations'.", id))); - } - String resourceType = ResourceManagerUtils.getValueFromIdByName(id, "resourcetypeRegistrations"); - if (resourceType == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'resourcetypeRegistrations'.", id))); - } - String sku = ResourceManagerUtils.getValueFromIdByName(id, "skus"); - if (sku == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'skus'.", id))); - } - return this.getRootWithResponse(providerNamespace, resourceType, sku, Context.NONE).getValue(); - } - - public Response getRootByIdWithResponse(String id, Context context) { - String providerNamespace = ResourceManagerUtils.getValueFromIdByName(id, "providerRegistrations"); - if (providerNamespace == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'providerRegistrations'.", id))); - } - String resourceType = ResourceManagerUtils.getValueFromIdByName(id, "resourcetypeRegistrations"); - if (resourceType == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'resourcetypeRegistrations'.", id))); - } - String sku = ResourceManagerUtils.getValueFromIdByName(id, "skus"); - if (sku == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'skus'.", id))); - } - return this.getRootWithResponse(providerNamespace, resourceType, sku, context); - } - - public void deleteRootById(String id) { - String providerNamespace = ResourceManagerUtils.getValueFromIdByName(id, "providerRegistrations"); - if (providerNamespace == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'providerRegistrations'.", id))); - } - String resourceType = ResourceManagerUtils.getValueFromIdByName(id, "resourcetypeRegistrations"); - if (resourceType == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'resourcetypeRegistrations'.", id))); - } - String sku = ResourceManagerUtils.getValueFromIdByName(id, "skus"); - if (sku == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'skus'.", id))); - } - this.deleteRootWithResponse(providerNamespace, resourceType, sku, Context.NONE); - } - - public Response deleteRootByIdWithResponse(String id, Context context) { - String providerNamespace = ResourceManagerUtils.getValueFromIdByName(id, "providerRegistrations"); - if (providerNamespace == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'providerRegistrations'.", id))); - } - String resourceType = ResourceManagerUtils.getValueFromIdByName(id, "resourcetypeRegistrations"); - if (resourceType == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'resourcetypeRegistrations'.", id))); - } - String sku = ResourceManagerUtils.getValueFromIdByName(id, "skus"); - if (sku == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'skus'.", id))); - } - return this.deleteRootWithResponse(providerNamespace, resourceType, sku, context); - } - - private SkusClient serviceClient() { - return this.innerClient; - } - - private tsptest.armlegacy.ArmLegacyManager manager() { - return this.serviceManager; - } - - public SkuResourceImpl define(String name) { - return new SkuResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/package-info.java deleted file mode 100644 index 7c77130eb60..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the implementations for ArmLegacy. - * Arm Resource Provider management API. - */ -package tsptest.armlegacy.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ProvisioningState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ProvisioningState.java deleted file mode 100644 index 4c5281afdab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ProvisioningState.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for ProvisioningState. - */ -public final class ProvisioningState extends ExpandableStringEnum { - /** - * Resource has been created. - */ - public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); - - /** - * Resource creation failed. - */ - public static final ProvisioningState FAILED = fromString("Failed"); - - /** - * Resource creation was canceled. - */ - public static final ProvisioningState CANCELED = fromString("Canceled"); - - /** - * Static value Provisioning for ProvisioningState. - */ - public static final ProvisioningState PROVISIONING = fromString("Provisioning"); - - /** - * Static value Updating for ProvisioningState. - */ - public static final ProvisioningState UPDATING = fromString("Updating"); - - /** - * Static value Deleting for ProvisioningState. - */ - public static final ProvisioningState DELETING = fromString("Deleting"); - - /** - * Static value Accepted for ProvisioningState. - */ - public static final ProvisioningState ACCEPTED = fromString("Accepted"); - - /** - * Creates a new instance of ProvisioningState value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ProvisioningState() { - } - - /** - * Creates or finds a ProvisioningState from its string representation. - * - * @param name a name to look for. - * @return the corresponding ProvisioningState. - */ - public static ProvisioningState fromString(String name) { - return fromString(name, ProvisioningState.class); - } - - /** - * Gets known ProvisioningState values. - * - * @return known ProvisioningState values. - */ - public static Collection values() { - return values(ProvisioningState.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ResourceTypeSku.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ResourceTypeSku.java deleted file mode 100644 index 470a039632b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ResourceTypeSku.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ResourceTypeSku model. - */ -@Immutable -public final class ResourceTypeSku implements JsonSerializable { - /* - * The provisioningState property. - */ - private ProvisioningState provisioningState; - - /** - * Creates an instance of ResourceTypeSku class. - */ - public ResourceTypeSku() { - } - - /** - * Get the provisioningState property: The provisioningState property. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourceTypeSku from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourceTypeSku if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the ResourceTypeSku. - */ - public static ResourceTypeSku fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ResourceTypeSku deserializedResourceTypeSku = new ResourceTypeSku(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedResourceTypeSku.provisioningState = ProvisioningState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedResourceTypeSku; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/SkuResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/SkuResource.java deleted file mode 100644 index 7136d52dbf4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/SkuResource.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.models; - -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import tsptest.armlegacy.fluent.models.SkuResourceInner; - -/** - * An immutable client-side representation of SkuResource. - */ -public interface SkuResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - ResourceTypeSku properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the inner tsptest.armlegacy.fluent.models.SkuResourceInner object. - * - * @return the inner object. - */ - SkuResourceInner innerModel(); - - /** - * The entirety of the SkuResource definition. - */ - interface Definition - extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { - } - - /** - * The SkuResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the SkuResource definition. - */ - interface Blank extends WithParentResource { - } - - /** - * The stage of the SkuResource definition allowing to specify parent resource. - */ - interface WithParentResource { - /** - * Specifies providerNamespace, resourceType. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @return the next definition stage. - */ - WithCreate withExistingResourcetypeRegistration(String providerNamespace, String resourceType); - } - - /** - * The stage of the SkuResource definition which contains all the minimum required properties for the resource - * to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - SkuResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - SkuResource create(Context context); - } - - /** - * The stage of the SkuResource definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(ResourceTypeSku properties); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - SkuResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - SkuResource refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/Skus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/Skus.java deleted file mode 100644 index ea55ce0b7c8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/Skus.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armlegacy.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import tsptest.armlegacy.fluent.models.SkuResourceInner; - -/** - * Resource collection API of Skus. - */ -public interface Skus { - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource along with {@link Response}. - */ - Response getNestedWithResponse(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, Context context); - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource. - */ - SkuResource getNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, String sku); - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - Response createNestedWithResponse(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, SkuResourceInner resource, Context context); - - /** - * Create a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - SkuResource createNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, String sku, - SkuResourceInner resource); - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteNestedWithResponse(String providerNamespace, String resourceType, - String nestedResourceTypeFirst, String sku, Context context); - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param nestedResourceTypeFirst The first child resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, String sku); - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource along with {@link Response}. - */ - Response getRootWithResponse(String providerNamespace, String resourceType, String sku, - Context context); - - /** - * Get a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource. - */ - SkuResource getRoot(String providerNamespace, String resourceType, String sku); - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteRootWithResponse(String providerNamespace, String resourceType, String sku, Context context); - - /** - * Delete a SkuResource. - * - * @param providerNamespace The name of the resource provider hosted within ProviderHub. - * @param resourceType The resource type. - * @param sku The SKU. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteRoot(String providerNamespace, String resourceType, String sku); - - /** - * Get a SkuResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource along with {@link Response}. - */ - SkuResource getRootById(String id); - - /** - * Get a SkuResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a SkuResource along with {@link Response}. - */ - Response getRootByIdWithResponse(String id, Context context); - - /** - * Delete a SkuResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteRootById(String id); - - /** - * Delete a SkuResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteRootByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new SkuResource resource. - * - * @param name resource name. - * @return the first stage of the new SkuResource definition. - */ - SkuResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/package-info.java deleted file mode 100644 index c58defcfc99..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the data models for ArmLegacy. - * Arm Resource Provider management API. - */ -package tsptest.armlegacy.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/package-info.java deleted file mode 100644 index c5f766eb6db..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the classes for ArmLegacy. - * Arm Resource Provider management API. - */ -package tsptest.armlegacy; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java deleted file mode 100644 index 5b9c041ecef..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java +++ /dev/null @@ -1,417 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider; - -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import tsptest.armresourceprovider.fluent.ArmClient; -import tsptest.armresourceprovider.implementation.ArmClientBuilder; -import tsptest.armresourceprovider.implementation.ChildExtensionResourceInterfacesImpl; -import tsptest.armresourceprovider.implementation.ChildResourcesInterfacesImpl; -import tsptest.armresourceprovider.implementation.CustomTemplateResourceInterfacesImpl; -import tsptest.armresourceprovider.implementation.ImmutableResourceModelsImpl; -import tsptest.armresourceprovider.implementation.LroNoBodiesImpl; -import tsptest.armresourceprovider.implementation.ManagedMaintenanceWindowStatusOperationsImpl; -import tsptest.armresourceprovider.implementation.ModelInterfaceSameNamesImpl; -import tsptest.armresourceprovider.implementation.OperationsImpl; -import tsptest.armresourceprovider.implementation.TopLevelArmResourceInterfacesImpl; -import tsptest.armresourceprovider.models.ChildExtensionResourceInterfaces; -import tsptest.armresourceprovider.models.ChildResourcesInterfaces; -import tsptest.armresourceprovider.models.CustomTemplateResourceInterfaces; -import tsptest.armresourceprovider.models.ImmutableResourceModels; -import tsptest.armresourceprovider.models.LroNoBodies; -import tsptest.armresourceprovider.models.ManagedMaintenanceWindowStatusOperations; -import tsptest.armresourceprovider.models.ModelInterfaceSameNames; -import tsptest.armresourceprovider.models.Operations; -import tsptest.armresourceprovider.models.TopLevelArmResourceInterfaces; - -/** - * Entry point to ArmResourceProviderManager. - * Arm Resource Provider management API. - */ -public final class ArmResourceProviderManager { - private ChildResourcesInterfaces childResourcesInterfaces; - - private TopLevelArmResourceInterfaces topLevelArmResourceInterfaces; - - private CustomTemplateResourceInterfaces customTemplateResourceInterfaces; - - private Operations operations; - - private ChildExtensionResourceInterfaces childExtensionResourceInterfaces; - - private ManagedMaintenanceWindowStatusOperations managedMaintenanceWindowStatusOperations; - - private ModelInterfaceSameNames modelInterfaceSameNames; - - private ImmutableResourceModels immutableResourceModels; - - private LroNoBodies lroNoBodies; - - private final ArmClient clientObject; - - private ArmResourceProviderManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new ArmClientBuilder().pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of Arm Resource Provider service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the Arm Resource Provider service API instance. - */ - public static ArmResourceProviderManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return configure().authenticate(credential, profile); - } - - /** - * Creates an instance of Arm Resource Provider service API entry point. - * - * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. - * @param profile the Azure profile for client. - * @return the Arm Resource Provider service API instance. - */ - public static ArmResourceProviderManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return new ArmResourceProviderManager(httpPipeline, profile, null); - } - - /** - * Gets a Configurable instance that can be used to create ArmResourceProviderManager with optional configuration. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new ArmResourceProviderManager.Configurable(); - } - - /** - * The Configurable allowing configurations to be set. - */ - public static final class Configurable { - private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); - private static final String SDK_VERSION = "version"; - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-resourcemanager-armresourceprovider-generated.properties"); - - private HttpClient httpClient; - private HttpLogOptions httpLogOptions; - private final List policies = new ArrayList<>(); - private final List scopes = new ArrayList<>(); - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - private Duration defaultPollInterval; - - private Configurable() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - return this; - } - - /** - * Adds the scope to permission sets. - * - * @param scope the scope. - * @return the configurable object itself. - */ - public Configurable withScope(String scope) { - this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); - return this; - } - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - /** - * Sets the default poll interval, used when service does not provide "Retry-After" header. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval - = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of Arm Resource Provider service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the Arm Resource Provider service API instance. - */ - public ArmResourceProviderManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder.append("azsdk-java") - .append("-") - .append("tsptest.armresourceprovider") - .append("/") - .append(clientVersion); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder.append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(userAgentBuilder.toString())); - policies.add(new AddHeadersFromContextPolicy()); - policies.add(new RequestIdPolicy()); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy); - policies.add(new AddDatePolicy()); - policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new ArmResourceProviderManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * Gets the resource collection API of ChildResourcesInterfaces. It manages ChildResource. - * - * @return Resource collection API of ChildResourcesInterfaces. - */ - public ChildResourcesInterfaces childResourcesInterfaces() { - if (this.childResourcesInterfaces == null) { - this.childResourcesInterfaces - = new ChildResourcesInterfacesImpl(clientObject.getChildResourcesInterfaces(), this); - } - return childResourcesInterfaces; - } - - /** - * Gets the resource collection API of TopLevelArmResourceInterfaces. It manages TopLevelArmResource. - * - * @return Resource collection API of TopLevelArmResourceInterfaces. - */ - public TopLevelArmResourceInterfaces topLevelArmResourceInterfaces() { - if (this.topLevelArmResourceInterfaces == null) { - this.topLevelArmResourceInterfaces - = new TopLevelArmResourceInterfacesImpl(clientObject.getTopLevelArmResourceInterfaces(), this); - } - return topLevelArmResourceInterfaces; - } - - /** - * Gets the resource collection API of CustomTemplateResourceInterfaces. It manages CustomTemplateResource. - * - * @return Resource collection API of CustomTemplateResourceInterfaces. - */ - public CustomTemplateResourceInterfaces customTemplateResourceInterfaces() { - if (this.customTemplateResourceInterfaces == null) { - this.customTemplateResourceInterfaces - = new CustomTemplateResourceInterfacesImpl(clientObject.getCustomTemplateResourceInterfaces(), this); - } - return customTemplateResourceInterfaces; - } - - /** - * Gets the resource collection API of Operations. - * - * @return Resource collection API of Operations. - */ - public Operations operations() { - if (this.operations == null) { - this.operations = new OperationsImpl(clientObject.getOperations(), this); - } - return operations; - } - - /** - * Gets the resource collection API of ChildExtensionResourceInterfaces. It manages ChildExtensionResource. - * - * @return Resource collection API of ChildExtensionResourceInterfaces. - */ - public ChildExtensionResourceInterfaces childExtensionResourceInterfaces() { - if (this.childExtensionResourceInterfaces == null) { - this.childExtensionResourceInterfaces - = new ChildExtensionResourceInterfacesImpl(clientObject.getChildExtensionResourceInterfaces(), this); - } - return childExtensionResourceInterfaces; - } - - /** - * Gets the resource collection API of ManagedMaintenanceWindowStatusOperations. - * - * @return Resource collection API of ManagedMaintenanceWindowStatusOperations. - */ - public ManagedMaintenanceWindowStatusOperations managedMaintenanceWindowStatusOperations() { - if (this.managedMaintenanceWindowStatusOperations == null) { - this.managedMaintenanceWindowStatusOperations = new ManagedMaintenanceWindowStatusOperationsImpl( - clientObject.getManagedMaintenanceWindowStatusOperations(), this); - } - return managedMaintenanceWindowStatusOperations; - } - - /** - * Gets the resource collection API of ModelInterfaceSameNames. - * - * @return Resource collection API of ModelInterfaceSameNames. - */ - public ModelInterfaceSameNames modelInterfaceSameNames() { - if (this.modelInterfaceSameNames == null) { - this.modelInterfaceSameNames - = new ModelInterfaceSameNamesImpl(clientObject.getModelInterfaceSameNames(), this); - } - return modelInterfaceSameNames; - } - - /** - * Gets the resource collection API of ImmutableResourceModels. - * - * @return Resource collection API of ImmutableResourceModels. - */ - public ImmutableResourceModels immutableResourceModels() { - if (this.immutableResourceModels == null) { - this.immutableResourceModels - = new ImmutableResourceModelsImpl(clientObject.getImmutableResourceModels(), this); - } - return immutableResourceModels; - } - - /** - * Gets the resource collection API of LroNoBodies. - * - * @return Resource collection API of LroNoBodies. - */ - public LroNoBodies lroNoBodies() { - if (this.lroNoBodies == null) { - this.lroNoBodies = new LroNoBodiesImpl(clientObject.getLroNoBodies(), this); - } - return lroNoBodies; - } - - /** - * Gets wrapped service client ArmClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. - * - * @return Wrapped service client ArmClient. - */ - public ArmClient serviceClient() { - return this.clientObject; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java deleted file mode 100644 index 8853b2c1975..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for ArmClient class. - */ -public interface ArmClient { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the ChildResourcesInterfacesClient object to access its operations. - * - * @return the ChildResourcesInterfacesClient object. - */ - ChildResourcesInterfacesClient getChildResourcesInterfaces(); - - /** - * Gets the TopLevelArmResourceInterfacesClient object to access its operations. - * - * @return the TopLevelArmResourceInterfacesClient object. - */ - TopLevelArmResourceInterfacesClient getTopLevelArmResourceInterfaces(); - - /** - * Gets the CustomTemplateResourceInterfacesClient object to access its operations. - * - * @return the CustomTemplateResourceInterfacesClient object. - */ - CustomTemplateResourceInterfacesClient getCustomTemplateResourceInterfaces(); - - /** - * Gets the OperationsClient object to access its operations. - * - * @return the OperationsClient object. - */ - OperationsClient getOperations(); - - /** - * Gets the ChildExtensionResourceInterfacesClient object to access its operations. - * - * @return the ChildExtensionResourceInterfacesClient object. - */ - ChildExtensionResourceInterfacesClient getChildExtensionResourceInterfaces(); - - /** - * Gets the ManagedMaintenanceWindowStatusOperationsClient object to access its operations. - * - * @return the ManagedMaintenanceWindowStatusOperationsClient object. - */ - ManagedMaintenanceWindowStatusOperationsClient getManagedMaintenanceWindowStatusOperations(); - - /** - * Gets the ModelInterfaceSameNamesClient object to access its operations. - * - * @return the ModelInterfaceSameNamesClient object. - */ - ModelInterfaceSameNamesClient getModelInterfaceSameNames(); - - /** - * Gets the ImmutableResourceModelsClient object to access its operations. - * - * @return the ImmutableResourceModelsClient object. - */ - ImmutableResourceModelsClient getImmutableResourceModels(); - - /** - * Gets the LroNoBodiesClient object to access its operations. - * - * @return the LroNoBodiesClient object. - */ - LroNoBodiesClient getLroNoBodies(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildExtensionResourceInterfacesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildExtensionResourceInterfacesClient.java deleted file mode 100644 index 56b02c142b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildExtensionResourceInterfacesClient.java +++ /dev/null @@ -1,415 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner; -import tsptest.armresourceprovider.models.ChildExtensionResourceUpdate; - -/** - * An instance of this class provides access to all the operations defined in ChildExtensionResourceInterfacesClient. - */ -public interface ChildExtensionResourceInterfacesClient { - /** - * Get a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildExtensionResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> getWithResponseAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName); - - /** - * Get a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildExtensionResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono getAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName); - - /** - * Get a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildExtensionResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, Context context); - - /** - * Get a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildExtensionResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ChildExtensionResourceInner get(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName); - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> createOrUpdateWithResponseAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceInner resource); - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of extensionResource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, ChildExtensionResourceInner> beginCreateOrUpdateAsync( - String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, - ChildExtensionResourceInner resource); - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of extensionResource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ChildExtensionResourceInner> beginCreateOrUpdate( - String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, - ChildExtensionResourceInner resource); - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of extensionResource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ChildExtensionResourceInner> beginCreateOrUpdate( - String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, - ChildExtensionResourceInner resource, Context context); - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono createOrUpdateAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceInner resource); - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ChildExtensionResourceInner createOrUpdate(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceInner resource); - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ChildExtensionResourceInner createOrUpdate(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceInner resource, Context context); - - /** - * Update a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> updateWithResponseAsync(String resourceUri, - String topLevelArmResourceName, String childExtensionResourceName, ChildExtensionResourceUpdate properties); - - /** - * Update a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono updateAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceUpdate properties); - - /** - * Update a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceUpdate properties, Context context); - - /** - * Update a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ChildExtensionResourceInner update(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceUpdate properties); - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> deleteWithResponseAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName); - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, Void> beginDeleteAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName); - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName); - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, Context context); - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono deleteAsync(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName); - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName); - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, Context context); - - /** - * List ChildExtensionResource resources by TopLevelArmResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedFlux listByTopLevelArmResourceAsync(String resourceUri, - String topLevelArmResourceName); - - /** - * List ChildExtensionResource resources by TopLevelArmResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByTopLevelArmResource(String resourceUri, - String topLevelArmResourceName); - - /** - * List ChildExtensionResource resources by TopLevelArmResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByTopLevelArmResource(String resourceUri, - String topLevelArmResourceName, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildResourcesInterfacesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildResourcesInterfacesClient.java deleted file mode 100644 index f5733578b8d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildResourcesInterfacesClient.java +++ /dev/null @@ -1,515 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.models.ChildResourceInner; -import tsptest.armresourceprovider.models.ChildResourceUpdate; - -/** - * An instance of this class provides access to all the operations defined in ChildResourcesInterfacesClient. - */ -public interface ChildResourcesInterfacesClient { - /** - * Get a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> getWithResponseAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName); - - /** - * Get a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono getAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName); - - /** - * Get a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, Context context); - - /** - * Get a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ChildResourceInner get(String resourceGroupName, String topLevelArmResourceName, String childResourceName); - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName, String childResourceName, ChildResourceInner resource); - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of subresource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, ChildResourceInner> beginCreateOrUpdateAsync(String resourceGroupName, - String topLevelArmResourceName, String childResourceName, ChildResourceInner resource); - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of subresource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ChildResourceInner> beginCreateOrUpdate(String resourceGroupName, - String topLevelArmResourceName, String childResourceName, ChildResourceInner resource); - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of subresource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ChildResourceInner> beginCreateOrUpdate(String resourceGroupName, - String topLevelArmResourceName, String childResourceName, ChildResourceInner resource, Context context); - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono createOrUpdateAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceInner resource); - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ChildResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceInner resource); - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ChildResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceInner resource, Context context); - - /** - * Update a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> updateWithResponseAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceUpdate properties); - - /** - * Update a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono updateAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceUpdate properties); - - /** - * Update a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceUpdate properties, Context context); - - /** - * Update a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ChildResourceInner update(String resourceGroupName, String topLevelArmResourceName, String childResourceName, - ChildResourceUpdate properties); - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> deleteWithResponseAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName); - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName); - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName, - String childResourceName); - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, Context context); - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono deleteAsync(String resourceGroupName, String topLevelArmResourceName, String childResourceName); - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName); - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName, Context context); - - /** - * List ChildResource resources by TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedFlux listByTopLevelArmResourceAsync(String resourceGroupName, - String topLevelArmResourceName); - - /** - * List ChildResource resources by TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByTopLevelArmResource(String resourceGroupName, - String topLevelArmResourceName); - - /** - * List ChildResource resources by TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByTopLevelArmResource(String resourceGroupName, - String topLevelArmResourceName, Context context); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> actionWithoutBodyWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName, String childResourceName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, Void> beginActionWithoutBodyAsync(String resourceGroupName, - String topLevelArmResourceName, String childResourceName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginActionWithoutBody(String resourceGroupName, String topLevelArmResourceName, - String childResourceName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginActionWithoutBody(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, Context context); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono actionWithoutBodyAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName, - Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/CustomTemplateResourceInterfacesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/CustomTemplateResourceInterfacesClient.java deleted file mode 100644 index 4bfceb90f87..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/CustomTemplateResourceInterfacesClient.java +++ /dev/null @@ -1,292 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner; -import tsptest.armresourceprovider.models.CustomTemplateResourcePatch; - -/** - * An instance of this class provides access to all the operations defined in CustomTemplateResourceInterfacesClient. - */ -public interface CustomTemplateResourceInterfacesClient { - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String customTemplateResourceName, CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch); - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, CustomTemplateResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource, - String ifMatch, String ifNoneMatch); - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, CustomTemplateResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource); - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, CustomTemplateResourceInner> beginCreateOrUpdate( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource); - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, CustomTemplateResourceInner> beginCreateOrUpdate( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource, - String ifMatch, String ifNoneMatch, Context context); - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono createOrUpdateAsync(String resourceGroupName, String customTemplateResourceName, - CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch); - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono createOrUpdateAsync(String resourceGroupName, String customTemplateResourceName, - CustomTemplateResourceInner resource); - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - CustomTemplateResourceInner createOrUpdate(String resourceGroupName, String customTemplateResourceName, - CustomTemplateResourceInner resource); - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - CustomTemplateResourceInner createOrUpdate(String resourceGroupName, String customTemplateResourceName, - CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch, Context context); - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> updateLongRunningWithResponseAsync(String resourceGroupName, - String customTemplateResourceName, CustomTemplateResourcePatch properties); - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, CustomTemplateResourceInner> beginUpdateLongRunningAsync( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourcePatch properties); - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, CustomTemplateResourceInner> beginUpdateLongRunning( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourcePatch properties); - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, CustomTemplateResourceInner> beginUpdateLongRunning( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourcePatch properties, - Context context); - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono updateLongRunningAsync(String resourceGroupName, - String customTemplateResourceName, CustomTemplateResourcePatch properties); - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - CustomTemplateResourceInner updateLongRunning(String resourceGroupName, String customTemplateResourceName, - CustomTemplateResourcePatch properties); - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - CustomTemplateResourceInner updateLongRunning(String resourceGroupName, String customTemplateResourceName, - CustomTemplateResourcePatch properties, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ImmutableResourceModelsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ImmutableResourceModelsClient.java deleted file mode 100644 index 8d1df5eb8a3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ImmutableResourceModelsClient.java +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.models.NginxConfigurationRequest; -import tsptest.armresourceprovider.models.NginxConfigurationResponse; - -/** - * An instance of this class provides access to all the operations defined in ImmutableResourceModelsClient. - */ -public interface ImmutableResourceModelsClient { - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String configurationName, - NginxConfigurationRequest properties); - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete proxy resource types can be created by aliasing this type - * using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, NginxConfigurationResponse> beginCreateOrUpdateAsync( - String resourceGroupName, String configurationName, NginxConfigurationRequest properties); - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete proxy resource types can be created by aliasing this type - * using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, NginxConfigurationResponse> - beginCreateOrUpdateAsync(String resourceGroupName, String configurationName); - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type - * using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, NginxConfigurationResponse> - beginCreateOrUpdate(String resourceGroupName, String configurationName); - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type - * using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, NginxConfigurationResponse> beginCreateOrUpdate( - String resourceGroupName, String configurationName, NginxConfigurationRequest properties, Context context); - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono createOrUpdateAsync(String resourceGroupName, String configurationName, - NginxConfigurationRequest properties); - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono createOrUpdateAsync(String resourceGroupName, String configurationName); - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName); - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName, - NginxConfigurationRequest properties, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/LroNoBodiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/LroNoBodiesClient.java deleted file mode 100644 index 2bdefd6ca4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/LroNoBodiesClient.java +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.models.ActionFinalResult; -import tsptest.armresourceprovider.models.ResourceLroNoBody; - -/** - * An instance of this class provides access to all the operations defined in LroNoBodiesClient. - */ -public interface LroNoBodiesClient { - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String resourceLroNoBodyName, ResourceLroNoBody resource); - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, ResourceLroNoBody> beginCreateOrUpdateAsync(String resourceGroupName, - String resourceLroNoBodyName, ResourceLroNoBody resource); - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ResourceLroNoBody> beginCreateOrUpdate(String resourceGroupName, - String resourceLroNoBodyName, ResourceLroNoBody resource); - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ResourceLroNoBody> beginCreateOrUpdate(String resourceGroupName, - String resourceLroNoBodyName, ResourceLroNoBody resource, Context context); - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono createOrUpdateAsync(String resourceGroupName, String resourceLroNoBodyName, - ResourceLroNoBody resource); - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, - ResourceLroNoBody resource); - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, ResourceLroNoBody resource, - Context context); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> actionWithResponseAsync(String resourceGroupName, String resourceLroNoBodyName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, ActionFinalResult> beginActionAsync(String resourceGroupName, - String resourceLroNoBodyName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ActionFinalResult> beginAction(String resourceGroupName, - String resourceLroNoBodyName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ActionFinalResult> beginAction(String resourceGroupName, - String resourceLroNoBodyName, Context context); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono actionAsync(String resourceGroupName, String resourceLroNoBodyName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ManagedMaintenanceWindowStatusOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ManagedMaintenanceWindowStatusOperationsClient.java deleted file mode 100644 index 4be93e21052..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ManagedMaintenanceWindowStatusOperationsClient.java +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner; - -/** - * An instance of this class provides access to all the operations defined in - * ManagedMaintenanceWindowStatusOperationsClient. - */ -public interface ManagedMaintenanceWindowStatusOperationsClient { - /** - * Get a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedMaintenanceWindowStatusContent along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String managedMaintenanceWindowStatusContentName); - - /** - * Get a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedMaintenanceWindowStatusContent on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono getByResourceGroupAsync(String resourceGroupName, - String managedMaintenanceWindowStatusContentName); - - /** - * Get a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedMaintenanceWindowStatusContent along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, Context context); - - /** - * Get a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedMaintenanceWindowStatusContent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ManagedMaintenanceWindowStatusInner getByResourceGroup(String resourceGroupName, - String managedMaintenanceWindowStatusContentName); - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> deleteWithResponseAsync(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch); - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, Void> beginDeleteAsync(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch); - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, Void> beginDeleteAsync(String resourceGroupName, - String managedMaintenanceWindowStatusContentName); - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, - String managedMaintenanceWindowStatusContentName); - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch, Context context); - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono deleteAsync(String resourceGroupName, String managedMaintenanceWindowStatusContentName, String ifMatch, - String ifNoneMatch); - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono deleteAsync(String resourceGroupName, String managedMaintenanceWindowStatusContentName); - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String managedMaintenanceWindowStatusContentName); - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String managedMaintenanceWindowStatusContentName, String ifMatch, - String ifNoneMatch, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ModelInterfaceSameNamesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ModelInterfaceSameNamesClient.java deleted file mode 100644 index d78cf6da4c4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ModelInterfaceSameNamesClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner; - -/** - * An instance of this class provides access to all the operations defined in ModelInterfaceSameNamesClient. - */ -public interface ModelInterfaceSameNamesClient { - /** - * Get a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ModelInterfaceDifferentName along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String modelInterfaceDifferentNameName); - - /** - * Get a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ModelInterfaceDifferentName on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono getByResourceGroupAsync(String resourceGroupName, - String modelInterfaceDifferentNameName); - - /** - * Get a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ModelInterfaceDifferentName along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, - String modelInterfaceDifferentNameName, Context context); - - /** - * Get a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ModelInterfaceDifferentName. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ModelInterfaceSameNameInner getByResourceGroup(String resourceGroupName, String modelInterfaceDifferentNameName); - - /** - * Delete a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> deleteWithResponseAsync(String resourceGroupName, String modelInterfaceDifferentNameName, - String ifMatch, String ifNoneMatch); - - /** - * Delete a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono deleteAsync(String resourceGroupName, String modelInterfaceDifferentNameName); - - /** - * Delete a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String resourceGroupName, String modelInterfaceDifferentNameName, String ifMatch, - String ifNoneMatch, Context context); - - /** - * Delete a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String modelInterfaceDifferentNameName); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/OperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/OperationsClient.java deleted file mode 100644 index 64ce716c537..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/OperationsClient.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; -import tsptest.armresourceprovider.fluent.models.OperationInner; - -/** - * An instance of this class provides access to all the operations defined in OperationsClient. - */ -public interface OperationsClient { - /** - * List the operations for the provider. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedFlux listAsync(); - - /** - * List the operations for the provider. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * List the operations for the provider. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/TopLevelArmResourceInterfacesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/TopLevelArmResourceInterfacesClient.java deleted file mode 100644 index 7e3f679951a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/TopLevelArmResourceInterfacesClient.java +++ /dev/null @@ -1,514 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.models.ResultInner; -import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner; -import tsptest.armresourceprovider.models.TopLevelArmResourceUpdate; - -/** - * An instance of this class provides access to all the operations defined in TopLevelArmResourceInterfacesClient. - */ -public interface TopLevelArmResourceInterfacesClient { - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName); - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono getByResourceGroupAsync(String resourceGroupName, String topLevelArmResourceName); - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelArmResourceName, Context context); - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelArmResourceInner getByResourceGroup(String resourceGroupName, String topLevelArmResourceName); - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName, TopLevelArmResourceInner resource); - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, TopLevelArmResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceInner resource); - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( - String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceInner resource); - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( - String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceInner resource, Context context); - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono createOrUpdateAsync(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceInner resource); - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceInner resource); - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceInner resource, Context context); - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> updateWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName, TopLevelArmResourceUpdate properties); - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono updateAsync(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceUpdate properties); - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceUpdate properties, Context context); - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelArmResourceInner update(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceUpdate properties); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> deleteWithResponseAsync(String resourceGroupName, String topLevelArmResourceName); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String topLevelArmResourceName); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName, - Context context); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono deleteAsync(String resourceGroupName, String topLevelArmResourceName); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String topLevelArmResourceName); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String topLevelArmResourceName, Context context); - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedFlux listByResourceGroupAsync(String resourceGroupName); - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, Context context); - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedFlux listAsync(); - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono>> actionWithResponseAsync(String resourceGroupName, String topLevelArmResourceName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux, ResultInner> beginActionAsync(String resourceGroupName, - String topLevelArmResourceName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ResultInner> beginAction(String resourceGroupName, - String topLevelArmResourceName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, ResultInner> beginAction(String resourceGroupName, - String topLevelArmResourceName, Context context); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Mono actionAsync(String resourceGroupName, String topLevelArmResourceName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - ResultInner action(String resourceGroupName, String topLevelArmResourceName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - ResultInner action(String resourceGroupName, String topLevelArmResourceName, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildExtensionResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildExtensionResourceInner.java deleted file mode 100644 index 838020dca53..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildExtensionResourceInner.java +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armresourceprovider.models.ChildExtensionResourceProperties; - -/** - * ExtensionResource of Top Level Arm Resource. - */ -@Fluent -public final class ChildExtensionResourceInner extends ProxyResource { - /* - * The resource-specific properties for this resource. - */ - private ChildExtensionResourceProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of ChildExtensionResourceInner class. - */ - public ChildExtensionResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public ChildExtensionResourceProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the ChildExtensionResourceInner object itself. - */ - public ChildExtensionResourceInner withProperties(ChildExtensionResourceProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChildExtensionResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChildExtensionResourceInner if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ChildExtensionResourceInner. - */ - public static ChildExtensionResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ChildExtensionResourceInner deserializedChildExtensionResourceInner = new ChildExtensionResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedChildExtensionResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedChildExtensionResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedChildExtensionResourceInner.type = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedChildExtensionResourceInner.properties - = ChildExtensionResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedChildExtensionResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedChildExtensionResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceInner.java deleted file mode 100644 index c9e04bcb71f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceInner.java +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; -import tsptest.armresourceprovider.models.ProvisioningState; - -/** - * Subresource of Top Level Arm Resource. - */ -@Fluent -public final class ChildResourceInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private ChildResourceProperties innerProperties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of ChildResourceInner class. - */ - public ChildResourceInner() { - } - - /** - * Get the innerProperties property: The resource-specific properties for this resource. - * - * @return the innerProperties value. - */ - private ChildResourceProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public ChildResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ChildResourceInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * Get the provisioningState property: Provisioning State of Top Level Arm Resource. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.innerProperties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChildResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChildResourceInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ChildResourceInner. - */ - public static ChildResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ChildResourceInner deserializedChildResourceInner = new ChildResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedChildResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedChildResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedChildResourceInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedChildResourceInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedChildResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedChildResourceInner.innerProperties = ChildResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedChildResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedChildResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceProperties.java deleted file mode 100644 index 196e5f35cca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceProperties.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armresourceprovider.models.ProvisioningState; - -/** - * Child Resource Properties. - */ -@Immutable -public final class ChildResourceProperties implements JsonSerializable { - /* - * Provisioning State of Top Level Arm Resource - */ - private ProvisioningState provisioningState; - - /** - * Creates an instance of ChildResourceProperties class. - */ - public ChildResourceProperties() { - } - - /** - * Get the provisioningState property: Provisioning State of Top Level Arm Resource. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChildResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChildResourceProperties if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the ChildResourceProperties. - */ - public static ChildResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ChildResourceProperties deserializedChildResourceProperties = new ChildResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedChildResourceProperties.provisioningState - = ProvisioningState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedChildResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceInner.java deleted file mode 100644 index 8d31fb9bbf6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceInner.java +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; -import tsptest.armresourceprovider.models.AnonymousEmptyModel; -import tsptest.armresourceprovider.models.Dog; -import tsptest.armresourceprovider.models.EmptyModel; -import tsptest.armresourceprovider.models.ManagedServiceIdentity; -import tsptest.armresourceprovider.models.PriorityModel; -import tsptest.armresourceprovider.models.ProvisioningState; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class CustomTemplateResourceInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private CustomTemplateResourceProperties innerProperties; - - /* - * Managed identity. - */ - private ManagedServiceIdentity identity; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of CustomTemplateResourceInner class. - */ - public CustomTemplateResourceInner() { - } - - /** - * Get the innerProperties property: The resource-specific properties for this resource. - * - * @return the innerProperties value. - */ - private CustomTemplateResourceProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the identity property: Managed identity. - * - * @return the identity value. - */ - public ManagedServiceIdentity identity() { - return this.identity; - } - - /** - * Set the identity property: Managed identity. - * - * @param identity the identity value to set. - * @return the CustomTemplateResourceInner object itself. - */ - public CustomTemplateResourceInner withIdentity(ManagedServiceIdentity identity) { - this.identity = identity; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public CustomTemplateResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public CustomTemplateResourceInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); - } - - /** - * Get the dog property: The dog property. - * - * @return the dog value. - */ - public Dog dog() { - return this.innerProperties() == null ? null : this.innerProperties().dog(); - } - - /** - * Set the dog property: The dog property. - * - * @param dog the dog value to set. - * @return the CustomTemplateResourceInner object itself. - */ - public CustomTemplateResourceInner withDog(Dog dog) { - if (this.innerProperties() == null) { - this.innerProperties = new CustomTemplateResourceProperties(); - } - this.innerProperties().withDog(dog); - return this; - } - - /** - * Get the namedEmptyModel property: The namedEmptyModel property. - * - * @return the namedEmptyModel value. - */ - public EmptyModel namedEmptyModel() { - return this.innerProperties() == null ? null : this.innerProperties().namedEmptyModel(); - } - - /** - * Set the namedEmptyModel property: The namedEmptyModel property. - * - * @param namedEmptyModel the namedEmptyModel value to set. - * @return the CustomTemplateResourceInner object itself. - */ - public CustomTemplateResourceInner withNamedEmptyModel(EmptyModel namedEmptyModel) { - if (this.innerProperties() == null) { - this.innerProperties = new CustomTemplateResourceProperties(); - } - this.innerProperties().withNamedEmptyModel(namedEmptyModel); - return this; - } - - /** - * Get the anonymousEmptyModel property: The anonymousEmptyModel property. - * - * @return the anonymousEmptyModel value. - */ - public AnonymousEmptyModel anonymousEmptyModel() { - return this.innerProperties() == null ? null : this.innerProperties().anonymousEmptyModel(); - } - - /** - * Set the anonymousEmptyModel property: The anonymousEmptyModel property. - * - * @param anonymousEmptyModel the anonymousEmptyModel value to set. - * @return the CustomTemplateResourceInner object itself. - */ - public CustomTemplateResourceInner withAnonymousEmptyModel(AnonymousEmptyModel anonymousEmptyModel) { - if (this.innerProperties() == null) { - this.innerProperties = new CustomTemplateResourceProperties(); - } - this.innerProperties().withAnonymousEmptyModel(anonymousEmptyModel); - return this; - } - - /** - * Get the priority property: The priority property. - * - * @return the priority value. - */ - public PriorityModel priority() { - return this.innerProperties() == null ? null : this.innerProperties().priority(); - } - - /** - * Set the priority property: The priority property. - * - * @param priority the priority value to set. - * @return the CustomTemplateResourceInner object itself. - */ - public CustomTemplateResourceInner withPriority(PriorityModel priority) { - if (this.innerProperties() == null) { - this.innerProperties = new CustomTemplateResourceProperties(); - } - this.innerProperties().withPriority(priority); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.innerProperties); - jsonWriter.writeJsonField("identity", this.identity); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CustomTemplateResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CustomTemplateResourceInner if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the CustomTemplateResourceInner. - */ - public static CustomTemplateResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CustomTemplateResourceInner deserializedCustomTemplateResourceInner = new CustomTemplateResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedCustomTemplateResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedCustomTemplateResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedCustomTemplateResourceInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedCustomTemplateResourceInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedCustomTemplateResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedCustomTemplateResourceInner.innerProperties - = CustomTemplateResourceProperties.fromJson(reader); - } else if ("identity".equals(fieldName)) { - deserializedCustomTemplateResourceInner.identity = ManagedServiceIdentity.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedCustomTemplateResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedCustomTemplateResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceProperties.java deleted file mode 100644 index a774b37f088..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceProperties.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armresourceprovider.models.AnonymousEmptyModel; -import tsptest.armresourceprovider.models.Dog; -import tsptest.armresourceprovider.models.EmptyModel; -import tsptest.armresourceprovider.models.PriorityModel; -import tsptest.armresourceprovider.models.ProvisioningState; - -/** - * Top Level Arm Resource Properties. - */ -@Fluent -public final class CustomTemplateResourceProperties implements JsonSerializable { - /* - * The status of the last operation. - */ - private ProvisioningState provisioningState; - - /* - * The dog property. - */ - private Dog dog; - - /* - * The namedEmptyModel property. - */ - private EmptyModel namedEmptyModel; - - /* - * The anonymousEmptyModel property. - */ - private AnonymousEmptyModel anonymousEmptyModel; - - /* - * The priority property. - */ - private PriorityModel priority; - - /** - * Creates an instance of CustomTemplateResourceProperties class. - */ - public CustomTemplateResourceProperties() { - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Get the dog property: The dog property. - * - * @return the dog value. - */ - public Dog dog() { - return this.dog; - } - - /** - * Set the dog property: The dog property. - * - * @param dog the dog value to set. - * @return the CustomTemplateResourceProperties object itself. - */ - public CustomTemplateResourceProperties withDog(Dog dog) { - this.dog = dog; - return this; - } - - /** - * Get the namedEmptyModel property: The namedEmptyModel property. - * - * @return the namedEmptyModel value. - */ - public EmptyModel namedEmptyModel() { - return this.namedEmptyModel; - } - - /** - * Set the namedEmptyModel property: The namedEmptyModel property. - * - * @param namedEmptyModel the namedEmptyModel value to set. - * @return the CustomTemplateResourceProperties object itself. - */ - public CustomTemplateResourceProperties withNamedEmptyModel(EmptyModel namedEmptyModel) { - this.namedEmptyModel = namedEmptyModel; - return this; - } - - /** - * Get the anonymousEmptyModel property: The anonymousEmptyModel property. - * - * @return the anonymousEmptyModel value. - */ - public AnonymousEmptyModel anonymousEmptyModel() { - return this.anonymousEmptyModel; - } - - /** - * Set the anonymousEmptyModel property: The anonymousEmptyModel property. - * - * @param anonymousEmptyModel the anonymousEmptyModel value to set. - * @return the CustomTemplateResourceProperties object itself. - */ - public CustomTemplateResourceProperties withAnonymousEmptyModel(AnonymousEmptyModel anonymousEmptyModel) { - this.anonymousEmptyModel = anonymousEmptyModel; - return this; - } - - /** - * Get the priority property: The priority property. - * - * @return the priority value. - */ - public PriorityModel priority() { - return this.priority; - } - - /** - * Set the priority property: The priority property. - * - * @param priority the priority value to set. - * @return the CustomTemplateResourceProperties object itself. - */ - public CustomTemplateResourceProperties withPriority(PriorityModel priority) { - this.priority = priority; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("dog", this.dog); - jsonWriter.writeJsonField("namedEmptyModel", this.namedEmptyModel); - jsonWriter.writeJsonField("anonymousEmptyModel", this.anonymousEmptyModel); - jsonWriter.writeNumberField("priority", this.priority == null ? null : this.priority.getValue()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CustomTemplateResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CustomTemplateResourceProperties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the CustomTemplateResourceProperties. - */ - public static CustomTemplateResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CustomTemplateResourceProperties deserializedCustomTemplateResourceProperties - = new CustomTemplateResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("dog".equals(fieldName)) { - deserializedCustomTemplateResourceProperties.dog = Dog.fromJson(reader); - } else if ("namedEmptyModel".equals(fieldName)) { - deserializedCustomTemplateResourceProperties.namedEmptyModel = EmptyModel.fromJson(reader); - } else if ("anonymousEmptyModel".equals(fieldName)) { - deserializedCustomTemplateResourceProperties.anonymousEmptyModel - = AnonymousEmptyModel.fromJson(reader); - } else if ("priority".equals(fieldName)) { - deserializedCustomTemplateResourceProperties.priority = PriorityModel.fromValue(reader.getInt()); - } else if ("provisioningState".equals(fieldName)) { - deserializedCustomTemplateResourceProperties.provisioningState - = ProvisioningState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedCustomTemplateResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusContentProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusContentProperties.java deleted file mode 100644 index 74e16902df0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusContentProperties.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ManagedMaintenanceWindowStatusContentProperties model. - */ -@Immutable -public final class ManagedMaintenanceWindowStatusContentProperties - implements JsonSerializable { - /* - * The status of the last operation. - */ - private String provisioningState; - - /** - * Creates an instance of ManagedMaintenanceWindowStatusContentProperties class. - */ - private ManagedMaintenanceWindowStatusContentProperties() { - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public String provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ManagedMaintenanceWindowStatusContentProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ManagedMaintenanceWindowStatusContentProperties if the JsonReader was pointing to an - * instance of it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ManagedMaintenanceWindowStatusContentProperties. - */ - public static ManagedMaintenanceWindowStatusContentProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ManagedMaintenanceWindowStatusContentProperties deserializedManagedMaintenanceWindowStatusContentProperties - = new ManagedMaintenanceWindowStatusContentProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedManagedMaintenanceWindowStatusContentProperties.provisioningState = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedManagedMaintenanceWindowStatusContentProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusInner.java deleted file mode 100644 index 91f1832d80a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusInner.java +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Resource for testing conflict name with operation group. - */ -@Immutable -public final class ManagedMaintenanceWindowStatusInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private ManagedMaintenanceWindowStatusContentProperties innerProperties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of ManagedMaintenanceWindowStatusInner class. - */ - private ManagedMaintenanceWindowStatusInner() { - } - - /** - * Get the innerProperties property: The resource-specific properties for this resource. - * - * @return the innerProperties value. - */ - private ManagedMaintenanceWindowStatusContentProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public String provisioningState() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.innerProperties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ManagedMaintenanceWindowStatusInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ManagedMaintenanceWindowStatusInner if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ManagedMaintenanceWindowStatusInner. - */ - public static ManagedMaintenanceWindowStatusInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ManagedMaintenanceWindowStatusInner deserializedManagedMaintenanceWindowStatusInner - = new ManagedMaintenanceWindowStatusInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedManagedMaintenanceWindowStatusInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedManagedMaintenanceWindowStatusInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedManagedMaintenanceWindowStatusInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedManagedMaintenanceWindowStatusInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedManagedMaintenanceWindowStatusInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedManagedMaintenanceWindowStatusInner.innerProperties - = ManagedMaintenanceWindowStatusContentProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedManagedMaintenanceWindowStatusInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedManagedMaintenanceWindowStatusInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceDifferentNameProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceDifferentNameProperties.java deleted file mode 100644 index 159f1d171a6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceDifferentNameProperties.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ModelInterfaceDifferentNameProperties model. - */ -@Immutable -public final class ModelInterfaceDifferentNameProperties - implements JsonSerializable { - /* - * The status of the last operation. - */ - private String provisioningState; - - /** - * Creates an instance of ModelInterfaceDifferentNameProperties class. - */ - private ModelInterfaceDifferentNameProperties() { - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public String provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ModelInterfaceDifferentNameProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ModelInterfaceDifferentNameProperties if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ModelInterfaceDifferentNameProperties. - */ - public static ModelInterfaceDifferentNameProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ModelInterfaceDifferentNameProperties deserializedModelInterfaceDifferentNameProperties - = new ModelInterfaceDifferentNameProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedModelInterfaceDifferentNameProperties.provisioningState = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedModelInterfaceDifferentNameProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceSameNameInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceSameNameInner.java deleted file mode 100644 index 6b7f6f6ed2d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceSameNameInner.java +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Immutable -public final class ModelInterfaceSameNameInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private ModelInterfaceDifferentNameProperties innerProperties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of ModelInterfaceSameNameInner class. - */ - private ModelInterfaceSameNameInner() { - } - - /** - * Get the innerProperties property: The resource-specific properties for this resource. - * - * @return the innerProperties value. - */ - private ModelInterfaceDifferentNameProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public String provisioningState() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.innerProperties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ModelInterfaceSameNameInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ModelInterfaceSameNameInner if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ModelInterfaceSameNameInner. - */ - public static ModelInterfaceSameNameInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ModelInterfaceSameNameInner deserializedModelInterfaceSameNameInner = new ModelInterfaceSameNameInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedModelInterfaceSameNameInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedModelInterfaceSameNameInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedModelInterfaceSameNameInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedModelInterfaceSameNameInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedModelInterfaceSameNameInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedModelInterfaceSameNameInner.innerProperties - = ModelInterfaceDifferentNameProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedModelInterfaceSameNameInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedModelInterfaceSameNameInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/OperationInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/OperationInner.java deleted file mode 100644 index 3696e23e091..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/OperationInner.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armresourceprovider.models.ActionType; -import tsptest.armresourceprovider.models.OperationDisplay; -import tsptest.armresourceprovider.models.Origin; - -/** - * REST API Operation - * - * Details of a REST API operation, returned from the Resource Provider Operations API. - */ -@Immutable -public final class OperationInner implements JsonSerializable { - /* - * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" - */ - private String name; - - /* - * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure - * Resource Manager/control-plane operations. - */ - private Boolean isDataAction; - - /* - * Localized display information for this particular operation. - */ - private OperationDisplay display; - - /* - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default - * value is "user,system" - */ - private Origin origin; - - /* - * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - */ - private ActionType actionType; - - /** - * Creates an instance of OperationInner class. - */ - private OperationInner() { - } - - /** - * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane - * operations and "false" for Azure Resource Manager/control-plane operations. - * - * @return the isDataAction value. - */ - public Boolean isDataAction() { - return this.isDataAction; - } - - /** - * Get the display property: Localized display information for this particular operation. - * - * @return the display value. - */ - public OperationDisplay display() { - return this.display; - } - - /** - * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and - * audit logs UX. Default value is "user,system". - * - * @return the origin value. - */ - public Origin origin() { - return this.origin; - } - - /** - * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are - * for internal only APIs. - * - * @return the actionType value. - */ - public ActionType actionType() { - return this.actionType; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("display", this.display); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the OperationInner. - */ - public static OperationInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationInner deserializedOperationInner = new OperationInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedOperationInner.name = reader.getString(); - } else if ("isDataAction".equals(fieldName)) { - deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); - } else if ("display".equals(fieldName)) { - deserializedOperationInner.display = OperationDisplay.fromJson(reader); - } else if ("origin".equals(fieldName)) { - deserializedOperationInner.origin = Origin.fromString(reader.getString()); - } else if ("actionType".equals(fieldName)) { - deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedOperationInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResourceLroNoBodyProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResourceLroNoBodyProperties.java deleted file mode 100644 index 64581bbe199..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResourceLroNoBodyProperties.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armresourceprovider.models.ProvisioningState; - -/** - * The ResourceLroNoBodyProperties model. - */ -@Immutable -public final class ResourceLroNoBodyProperties implements JsonSerializable { - /* - * The status of the last operation. - */ - private ProvisioningState provisioningState; - - /** - * Creates an instance of ResourceLroNoBodyProperties class. - */ - public ResourceLroNoBodyProperties() { - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourceLroNoBodyProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourceLroNoBodyProperties if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the ResourceLroNoBodyProperties. - */ - public static ResourceLroNoBodyProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ResourceLroNoBodyProperties deserializedResourceLroNoBodyProperties = new ResourceLroNoBodyProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedResourceLroNoBodyProperties.provisioningState - = ProvisioningState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedResourceLroNoBodyProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResultInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResultInner.java deleted file mode 100644 index 40e6632c4b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResultInner.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Result model. - */ -@Immutable -public final class ResultInner implements JsonSerializable { - /* - * The reason property. - */ - private String reason; - - /** - * Creates an instance of ResultInner class. - */ - private ResultInner() { - } - - /** - * Get the reason property: The reason property. - * - * @return the reason value. - */ - public String reason() { - return this.reason; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("reason", this.reason); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResultInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResultInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the ResultInner. - */ - public static ResultInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ResultInner deserializedResultInner = new ResultInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("reason".equals(fieldName)) { - deserializedResultInner.reason = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedResultInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceInner.java deleted file mode 100644 index db80385dcab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceInner.java +++ /dev/null @@ -1,292 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.List; -import java.util.Map; -import tsptest.armresourceprovider.models.ProvisioningState; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class TopLevelArmResourceInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private TopLevelArmResourceProperties innerProperties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of TopLevelArmResourceInner class. - */ - public TopLevelArmResourceInner() { - } - - /** - * Get the innerProperties property: The resource-specific properties for this resource. - * - * @return the innerProperties value. - */ - private TopLevelArmResourceProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public TopLevelArmResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public TopLevelArmResourceInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * Get the configurationEndpoints property: Configuration Endpoints. - * - * @return the configurationEndpoints value. - */ - public List configurationEndpoints() { - return this.innerProperties() == null ? null : this.innerProperties().configurationEndpoints(); - } - - /** - * Get the userName property: The userName property. - * - * @return the userName value. - */ - public String userName() { - return this.innerProperties() == null ? null : this.innerProperties().userName(); - } - - /** - * Set the userName property: The userName property. - * - * @param userName the userName value to set. - * @return the TopLevelArmResourceInner object itself. - */ - public TopLevelArmResourceInner withUserName(String userName) { - if (this.innerProperties() == null) { - this.innerProperties = new TopLevelArmResourceProperties(); - } - this.innerProperties().withUserName(userName); - return this; - } - - /** - * Get the userNames property: The userNames property. - * - * @return the userNames value. - */ - public String userNames() { - return this.innerProperties() == null ? null : this.innerProperties().userNames(); - } - - /** - * Set the userNames property: The userNames property. - * - * @param userNames the userNames value to set. - * @return the TopLevelArmResourceInner object itself. - */ - public TopLevelArmResourceInner withUserNames(String userNames) { - if (this.innerProperties() == null) { - this.innerProperties = new TopLevelArmResourceProperties(); - } - this.innerProperties().withUserNames(userNames); - return this; - } - - /** - * Get the accuserName property: The accuserName property. - * - * @return the accuserName value. - */ - public String accuserName() { - return this.innerProperties() == null ? null : this.innerProperties().accuserName(); - } - - /** - * Set the accuserName property: The accuserName property. - * - * @param accuserName the accuserName value to set. - * @return the TopLevelArmResourceInner object itself. - */ - public TopLevelArmResourceInner withAccuserName(String accuserName) { - if (this.innerProperties() == null) { - this.innerProperties = new TopLevelArmResourceProperties(); - } - this.innerProperties().withAccuserName(accuserName); - return this; - } - - /** - * Get the startTimeStamp property: The startTimeStamp property. - * - * @return the startTimeStamp value. - */ - public OffsetDateTime startTimeStamp() { - return this.innerProperties() == null ? null : this.innerProperties().startTimeStamp(); - } - - /** - * Set the startTimeStamp property: The startTimeStamp property. - * - * @param startTimeStamp the startTimeStamp value to set. - * @return the TopLevelArmResourceInner object itself. - */ - public TopLevelArmResourceInner withStartTimeStamp(OffsetDateTime startTimeStamp) { - if (this.innerProperties() == null) { - this.innerProperties = new TopLevelArmResourceProperties(); - } - this.innerProperties().withStartTimeStamp(startTimeStamp); - return this; - } - - /** - * Get the size property: The size property. - * - * @return the size value. - */ - public Float size() { - return this.innerProperties() == null ? null : this.innerProperties().size(); - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.innerProperties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelArmResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelArmResourceInner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TopLevelArmResourceInner. - */ - public static TopLevelArmResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelArmResourceInner deserializedTopLevelArmResourceInner = new TopLevelArmResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedTopLevelArmResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedTopLevelArmResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedTopLevelArmResourceInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedTopLevelArmResourceInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedTopLevelArmResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedTopLevelArmResourceInner.innerProperties - = TopLevelArmResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedTopLevelArmResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelArmResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceProperties.java deleted file mode 100644 index c569fd3ff52..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceProperties.java +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; -import tsptest.armresourceprovider.models.ProvisioningState; - -/** - * Top Level Arm Resource Properties. - */ -@Fluent -public final class TopLevelArmResourceProperties implements JsonSerializable { - /* - * Configuration Endpoints. - */ - private List configurationEndpoints; - - /* - * The userName property. - */ - private String userName; - - /* - * The userNames property. - */ - private String userNames; - - /* - * The accuserName property. - */ - private String accuserName; - - /* - * The startTimeStamp property. - */ - private OffsetDateTime startTimeStamp; - - /* - * The size property. - */ - private Float size; - - /* - * The status of the last operation. - */ - private ProvisioningState provisioningState; - - /** - * Creates an instance of TopLevelArmResourceProperties class. - */ - public TopLevelArmResourceProperties() { - } - - /** - * Get the configurationEndpoints property: Configuration Endpoints. - * - * @return the configurationEndpoints value. - */ - public List configurationEndpoints() { - return this.configurationEndpoints; - } - - /** - * Get the userName property: The userName property. - * - * @return the userName value. - */ - public String userName() { - return this.userName; - } - - /** - * Set the userName property: The userName property. - * - * @param userName the userName value to set. - * @return the TopLevelArmResourceProperties object itself. - */ - public TopLevelArmResourceProperties withUserName(String userName) { - this.userName = userName; - return this; - } - - /** - * Get the userNames property: The userNames property. - * - * @return the userNames value. - */ - public String userNames() { - return this.userNames; - } - - /** - * Set the userNames property: The userNames property. - * - * @param userNames the userNames value to set. - * @return the TopLevelArmResourceProperties object itself. - */ - public TopLevelArmResourceProperties withUserNames(String userNames) { - this.userNames = userNames; - return this; - } - - /** - * Get the accuserName property: The accuserName property. - * - * @return the accuserName value. - */ - public String accuserName() { - return this.accuserName; - } - - /** - * Set the accuserName property: The accuserName property. - * - * @param accuserName the accuserName value to set. - * @return the TopLevelArmResourceProperties object itself. - */ - public TopLevelArmResourceProperties withAccuserName(String accuserName) { - this.accuserName = accuserName; - return this; - } - - /** - * Get the startTimeStamp property: The startTimeStamp property. - * - * @return the startTimeStamp value. - */ - public OffsetDateTime startTimeStamp() { - return this.startTimeStamp; - } - - /** - * Set the startTimeStamp property: The startTimeStamp property. - * - * @param startTimeStamp the startTimeStamp value to set. - * @return the TopLevelArmResourceProperties object itself. - */ - public TopLevelArmResourceProperties withStartTimeStamp(OffsetDateTime startTimeStamp) { - this.startTimeStamp = startTimeStamp; - return this; - } - - /** - * Get the size property: The size property. - * - * @return the size value. - */ - public Float size() { - return this.size; - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("userName", this.userName); - jsonWriter.writeStringField("userNames", this.userNames); - jsonWriter.writeStringField("accuserName", this.accuserName); - jsonWriter.writeStringField("startTimeStamp", - this.startTimeStamp == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTimeStamp)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelArmResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelArmResourceProperties if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TopLevelArmResourceProperties. - */ - public static TopLevelArmResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelArmResourceProperties deserializedTopLevelArmResourceProperties - = new TopLevelArmResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("userName".equals(fieldName)) { - deserializedTopLevelArmResourceProperties.userName = reader.getString(); - } else if ("userNames".equals(fieldName)) { - deserializedTopLevelArmResourceProperties.userNames = reader.getString(); - } else if ("accuserName".equals(fieldName)) { - deserializedTopLevelArmResourceProperties.accuserName = reader.getString(); - } else if ("startTimeStamp".equals(fieldName)) { - deserializedTopLevelArmResourceProperties.startTimeStamp = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("configurationEndpoints".equals(fieldName)) { - List configurationEndpoints = reader.readArray(reader1 -> reader1.getString()); - deserializedTopLevelArmResourceProperties.configurationEndpoints = configurationEndpoints; - } else if ("size".equals(fieldName)) { - deserializedTopLevelArmResourceProperties.size = reader.getNullable(JsonReader::getFloat); - } else if ("provisioningState".equals(fieldName)) { - deserializedTopLevelArmResourceProperties.provisioningState - = ProvisioningState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelArmResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceUpdateProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceUpdateProperties.java deleted file mode 100644 index bb5b15e6d52..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceUpdateProperties.java +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The updatable properties of the TopLevelArmResource. - */ -@Fluent -public final class TopLevelArmResourceUpdateProperties - implements JsonSerializable { - /* - * The userName property. - */ - private String userName; - - /* - * The userNames property. - */ - private String userNames; - - /* - * The accuserName property. - */ - private String accuserName; - - /** - * Creates an instance of TopLevelArmResourceUpdateProperties class. - */ - public TopLevelArmResourceUpdateProperties() { - } - - /** - * Get the userName property: The userName property. - * - * @return the userName value. - */ - public String userName() { - return this.userName; - } - - /** - * Set the userName property: The userName property. - * - * @param userName the userName value to set. - * @return the TopLevelArmResourceUpdateProperties object itself. - */ - public TopLevelArmResourceUpdateProperties withUserName(String userName) { - this.userName = userName; - return this; - } - - /** - * Get the userNames property: The userNames property. - * - * @return the userNames value. - */ - public String userNames() { - return this.userNames; - } - - /** - * Set the userNames property: The userNames property. - * - * @param userNames the userNames value to set. - * @return the TopLevelArmResourceUpdateProperties object itself. - */ - public TopLevelArmResourceUpdateProperties withUserNames(String userNames) { - this.userNames = userNames; - return this; - } - - /** - * Get the accuserName property: The accuserName property. - * - * @return the accuserName value. - */ - public String accuserName() { - return this.accuserName; - } - - /** - * Set the accuserName property: The accuserName property. - * - * @param accuserName the accuserName value to set. - * @return the TopLevelArmResourceUpdateProperties object itself. - */ - public TopLevelArmResourceUpdateProperties withAccuserName(String accuserName) { - this.accuserName = accuserName; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("userName", this.userName); - jsonWriter.writeStringField("userNames", this.userNames); - jsonWriter.writeStringField("accuserName", this.accuserName); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelArmResourceUpdateProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelArmResourceUpdateProperties if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the TopLevelArmResourceUpdateProperties. - */ - public static TopLevelArmResourceUpdateProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelArmResourceUpdateProperties deserializedTopLevelArmResourceUpdateProperties - = new TopLevelArmResourceUpdateProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("userName".equals(fieldName)) { - deserializedTopLevelArmResourceUpdateProperties.userName = reader.getString(); - } else if ("userNames".equals(fieldName)) { - deserializedTopLevelArmResourceUpdateProperties.userNames = reader.getString(); - } else if ("accuserName".equals(fieldName)) { - deserializedTopLevelArmResourceUpdateProperties.accuserName = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelArmResourceUpdateProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/package-info.java deleted file mode 100644 index 4372b5cb021..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the inner data models for ArmResourceProvider. - * Arm Resource Provider management API. - */ -package tsptest.armresourceprovider.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/package-info.java deleted file mode 100644 index d08dbd0d90f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the service clients for ArmResourceProvider. - * Arm Resource Provider management API. - */ -package tsptest.armresourceprovider.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientBuilder.java deleted file mode 100644 index f0838533b6a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** - * A builder for creating a new instance of the ArmClientImpl type. - */ -@ServiceClientBuilder(serviceClients = { ArmClientImpl.class }) -public final class ArmClientBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the ArmClientBuilder. - */ - public ArmClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The ID of the target subscription. The value must be an UUID. - */ - private String subscriptionId; - - /** - * Sets The ID of the target subscription. The value must be an UUID. - * - * @param subscriptionId the subscriptionId value. - * @return the ArmClientBuilder. - */ - public ArmClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the ArmClientBuilder. - */ - public ArmClientBuilder environment(AzureEnvironment environment) { - this.environment = environment; - 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 ArmClientBuilder. - */ - public ArmClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the ArmClientBuilder. - */ - public ArmClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - 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 ArmClientBuilder. - */ - public ArmClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of ArmClientImpl with the provided parameters. - * - * @return an instance of ArmClientImpl. - */ - public ArmClientImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval - = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - ArmClientImpl client = new ArmClientImpl(localPipeline, localSerializerAdapter, localDefaultPollInterval, - localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java deleted file mode 100644 index 9f6b0870f52..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java +++ /dev/null @@ -1,436 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.management.polling.SyncPollerFactory; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.ArmClient; -import tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient; -import tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient; -import tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient; -import tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient; -import tsptest.armresourceprovider.fluent.LroNoBodiesClient; -import tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient; -import tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient; -import tsptest.armresourceprovider.fluent.OperationsClient; -import tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient; - -/** - * Initializes a new instance of the ArmClientImpl type. - */ -@ServiceClient(builder = ArmClientBuilder.class) -public final class ArmClientImpl implements ArmClient { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Version parameter. - */ - private final String apiVersion; - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * The ID of the target subscription. The value must be an UUID. - */ - private final String subscriptionId; - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * 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. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The ChildResourcesInterfacesClient object to access its operations. - */ - private final ChildResourcesInterfacesClient childResourcesInterfaces; - - /** - * Gets the ChildResourcesInterfacesClient object to access its operations. - * - * @return the ChildResourcesInterfacesClient object. - */ - public ChildResourcesInterfacesClient getChildResourcesInterfaces() { - return this.childResourcesInterfaces; - } - - /** - * The TopLevelArmResourceInterfacesClient object to access its operations. - */ - private final TopLevelArmResourceInterfacesClient topLevelArmResourceInterfaces; - - /** - * Gets the TopLevelArmResourceInterfacesClient object to access its operations. - * - * @return the TopLevelArmResourceInterfacesClient object. - */ - public TopLevelArmResourceInterfacesClient getTopLevelArmResourceInterfaces() { - return this.topLevelArmResourceInterfaces; - } - - /** - * The CustomTemplateResourceInterfacesClient object to access its operations. - */ - private final CustomTemplateResourceInterfacesClient customTemplateResourceInterfaces; - - /** - * Gets the CustomTemplateResourceInterfacesClient object to access its operations. - * - * @return the CustomTemplateResourceInterfacesClient object. - */ - public CustomTemplateResourceInterfacesClient getCustomTemplateResourceInterfaces() { - return this.customTemplateResourceInterfaces; - } - - /** - * The OperationsClient object to access its operations. - */ - private final OperationsClient operations; - - /** - * Gets the OperationsClient object to access its operations. - * - * @return the OperationsClient object. - */ - public OperationsClient getOperations() { - return this.operations; - } - - /** - * The ChildExtensionResourceInterfacesClient object to access its operations. - */ - private final ChildExtensionResourceInterfacesClient childExtensionResourceInterfaces; - - /** - * Gets the ChildExtensionResourceInterfacesClient object to access its operations. - * - * @return the ChildExtensionResourceInterfacesClient object. - */ - public ChildExtensionResourceInterfacesClient getChildExtensionResourceInterfaces() { - return this.childExtensionResourceInterfaces; - } - - /** - * The ManagedMaintenanceWindowStatusOperationsClient object to access its operations. - */ - private final ManagedMaintenanceWindowStatusOperationsClient managedMaintenanceWindowStatusOperations; - - /** - * Gets the ManagedMaintenanceWindowStatusOperationsClient object to access its operations. - * - * @return the ManagedMaintenanceWindowStatusOperationsClient object. - */ - public ManagedMaintenanceWindowStatusOperationsClient getManagedMaintenanceWindowStatusOperations() { - return this.managedMaintenanceWindowStatusOperations; - } - - /** - * The ModelInterfaceSameNamesClient object to access its operations. - */ - private final ModelInterfaceSameNamesClient modelInterfaceSameNames; - - /** - * Gets the ModelInterfaceSameNamesClient object to access its operations. - * - * @return the ModelInterfaceSameNamesClient object. - */ - public ModelInterfaceSameNamesClient getModelInterfaceSameNames() { - return this.modelInterfaceSameNames; - } - - /** - * The ImmutableResourceModelsClient object to access its operations. - */ - private final ImmutableResourceModelsClient immutableResourceModels; - - /** - * Gets the ImmutableResourceModelsClient object to access its operations. - * - * @return the ImmutableResourceModelsClient object. - */ - public ImmutableResourceModelsClient getImmutableResourceModels() { - return this.immutableResourceModels; - } - - /** - * The LroNoBodiesClient object to access its operations. - */ - private final LroNoBodiesClient lroNoBodies; - - /** - * Gets the LroNoBodiesClient object to access its operations. - * - * @return the LroNoBodiesClient object. - */ - public LroNoBodiesClient getLroNoBodies() { - return this.lroNoBodies; - } - - /** - * Initializes an instance of ArmClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - ArmClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, - AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.apiVersion = "2023-11-01"; - this.childResourcesInterfaces = new ChildResourcesInterfacesClientImpl(this); - this.topLevelArmResourceInterfaces = new TopLevelArmResourceInterfacesClientImpl(this); - this.customTemplateResourceInterfaces = new CustomTemplateResourceInterfacesClientImpl(this); - this.operations = new OperationsClientImpl(this); - this.childExtensionResourceInterfaces = new ChildExtensionResourceInterfacesClientImpl(this); - this.managedMaintenanceWindowStatusOperations = new ManagedMaintenanceWindowStatusOperationsClientImpl(this); - this.modelInterfaceSameNames = new ModelInterfaceSameNamesClientImpl(this); - this.immutableResourceModels = new ImmutableResourceModelsClientImpl(this); - this.lroNoBodies = new LroNoBodiesClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return SyncPoller for poll result and final result. - */ - public SyncPoller, U> getLroResult(Response activationResponse, - Type pollResultType, Type finalResultType, Context context) { - return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, () -> activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ArmClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceImpl.java deleted file mode 100644 index 29c95794440..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner; -import tsptest.armresourceprovider.models.ChildExtensionResource; -import tsptest.armresourceprovider.models.ChildExtensionResourceProperties; -import tsptest.armresourceprovider.models.ChildExtensionResourceUpdate; - -public final class ChildExtensionResourceImpl - implements ChildExtensionResource, ChildExtensionResource.Definition, ChildExtensionResource.Update { - private ChildExtensionResourceInner innerObject; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public ChildExtensionResourceProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public ChildExtensionResourceInner innerModel() { - return this.innerObject; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } - - private String resourceUri; - - private String topLevelArmResourceName; - - private String childExtensionResourceName; - - private ChildExtensionResourceUpdate updateProperties; - - public ChildExtensionResourceImpl withExistingTopLevelArmResource(String resourceUri, - String topLevelArmResourceName) { - this.resourceUri = resourceUri; - this.topLevelArmResourceName = topLevelArmResourceName; - return this; - } - - public ChildExtensionResource create() { - this.innerObject = serviceManager.serviceClient() - .getChildExtensionResourceInterfaces() - .createOrUpdate(resourceUri, topLevelArmResourceName, childExtensionResourceName, this.innerModel(), - Context.NONE); - return this; - } - - public ChildExtensionResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getChildExtensionResourceInterfaces() - .createOrUpdate(resourceUri, topLevelArmResourceName, childExtensionResourceName, this.innerModel(), - context); - return this; - } - - ChildExtensionResourceImpl(String name, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerObject = new ChildExtensionResourceInner(); - this.serviceManager = serviceManager; - this.childExtensionResourceName = name; - } - - public ChildExtensionResourceImpl update() { - this.updateProperties = new ChildExtensionResourceUpdate(); - return this; - } - - public ChildExtensionResource apply() { - this.innerObject = serviceManager.serviceClient() - .getChildExtensionResourceInterfaces() - .updateWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, updateProperties, - Context.NONE) - .getValue(); - return this; - } - - public ChildExtensionResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getChildExtensionResourceInterfaces() - .updateWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, updateProperties, - context) - .getValue(); - return this; - } - - ChildExtensionResourceImpl(ChildExtensionResourceInner innerObject, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "resourceUri"); - this.topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "topLevelArmResourceName"); - this.childExtensionResourceName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "childExtensionResourceName"); - } - - public ChildExtensionResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getChildExtensionResourceInterfaces() - .getWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, Context.NONE) - .getValue(); - return this; - } - - public ChildExtensionResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getChildExtensionResourceInterfaces() - .getWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, context) - .getValue(); - return this; - } - - public ChildExtensionResourceImpl withProperties(ChildExtensionResourceProperties properties) { - this.innerModel().withProperties(properties); - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java deleted file mode 100644 index 62dc0feffe9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java +++ /dev/null @@ -1,899 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient; -import tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner; -import tsptest.armresourceprovider.implementation.models.ChildExtensionResourceListResult; -import tsptest.armresourceprovider.models.ChildExtensionResourceUpdate; - -/** - * An instance of this class provides access to all the operations defined in ChildExtensionResourceInterfacesClient. - */ -public final class ChildExtensionResourceInterfacesClientImpl implements ChildExtensionResourceInterfacesClient { - /** - * The proxy service used to perform REST calls. - */ - private final ChildExtensionResourceInterfacesService service; - - /** - * The service client containing this operation class. - */ - private final ArmClientImpl client; - - /** - * Initializes an instance of ChildExtensionResourceInterfacesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ChildExtensionResourceInterfacesClientImpl(ArmClientImpl client) { - this.service = RestProxy.create(ChildExtensionResourceInterfacesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmClientChildExtensionResourceInterfaces to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmClientChildExtensionResourceInterfaces") - public interface ChildExtensionResourceInterfacesService { - @Headers({ "Content-Type: application/json" }) - @Get("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childExtensionResourceName") String childExtensionResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childExtensionResourceName") String childExtensionResourceName, - @HeaderParam("Accept") String accept, Context context); - - @Put("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childExtensionResourceName") String childExtensionResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ChildExtensionResourceInner resource, Context context); - - @Put("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childExtensionResourceName") String childExtensionResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ChildExtensionResourceInner resource, Context context); - - @Patch("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childExtensionResourceName") String childExtensionResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ChildExtensionResourceUpdate properties, Context context); - - @Patch("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response updateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childExtensionResourceName") String childExtensionResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") ChildExtensionResourceUpdate properties, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") - @ExpectedResponses({ 200, 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childExtensionResourceName") String childExtensionResourceName, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") - @ExpectedResponses({ 200, 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childExtensionResourceName") String childExtensionResourceName, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByTopLevelArmResource( - @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByTopLevelArmResourceSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam(value = "resourceUri", encoded = true) String resourceUri, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByTopLevelArmResourceNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByTopLevelArmResourceNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Get a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildExtensionResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(String resourceUri, - String topLevelArmResourceName, String childExtensionResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - topLevelArmResourceName, childExtensionResourceName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildExtensionResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName) { - return getWithResponseAsync(resourceUri, topLevelArmResourceName, childExtensionResourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildExtensionResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, Context context) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - topLevelArmResourceName, childExtensionResourceName, accept, context); - } - - /** - * Get a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildExtensionResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ChildExtensionResourceInner get(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName) { - return getWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, Context.NONE) - .getValue(); - } - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> createOrUpdateWithResponseAsync(String resourceUri, - String topLevelArmResourceName, String childExtensionResourceName, ChildExtensionResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - topLevelArmResourceName, childExtensionResourceName, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - topLevelArmResourceName, childExtensionResourceName, contentType, accept, resource, Context.NONE); - } - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - topLevelArmResourceName, childExtensionResourceName, contentType, accept, resource, context); - } - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of extensionResource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, ChildExtensionResourceInner> beginCreateOrUpdateAsync( - String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, - ChildExtensionResourceInner resource) { - Mono>> mono = createOrUpdateWithResponseAsync(resourceUri, topLevelArmResourceName, - childExtensionResourceName, resource); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), ChildExtensionResourceInner.class, ChildExtensionResourceInner.class, - this.client.getContext()); - } - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of extensionResource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ChildExtensionResourceInner> beginCreateOrUpdate( - String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, - ChildExtensionResourceInner resource) { - Response response - = createOrUpdateWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, resource); - return this.client.getLroResult(response, - ChildExtensionResourceInner.class, ChildExtensionResourceInner.class, Context.NONE); - } - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of extensionResource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ChildExtensionResourceInner> beginCreateOrUpdate( - String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, - ChildExtensionResourceInner resource, Context context) { - Response response = createOrUpdateWithResponse(resourceUri, topLevelArmResourceName, - childExtensionResourceName, resource, context); - return this.client.getLroResult(response, - ChildExtensionResourceInner.class, ChildExtensionResourceInner.class, context); - } - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceInner resource) { - return beginCreateOrUpdateAsync(resourceUri, topLevelArmResourceName, childExtensionResourceName, resource) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ChildExtensionResourceInner createOrUpdate(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceInner resource) { - return beginCreateOrUpdate(resourceUri, topLevelArmResourceName, childExtensionResourceName, resource) - .getFinalResult(); - } - - /** - * Create a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ChildExtensionResourceInner createOrUpdate(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceInner resource, Context context) { - return beginCreateOrUpdate(resourceUri, topLevelArmResourceName, childExtensionResourceName, resource, context) - .getFinalResult(); - } - - /** - * Update a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateWithResponseAsync(String resourceUri, - String topLevelArmResourceName, String childExtensionResourceName, ChildExtensionResourceUpdate properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - topLevelArmResourceName, childExtensionResourceName, contentType, accept, properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceUpdate properties) { - return updateWithResponseAsync(resourceUri, topLevelArmResourceName, childExtensionResourceName, properties) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Update a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceUpdate properties, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - topLevelArmResourceName, childExtensionResourceName, contentType, accept, properties, context); - } - - /** - * Update a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extensionResource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ChildExtensionResourceInner update(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, ChildExtensionResourceUpdate properties) { - return updateWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, properties, - Context.NONE).getValue(); - } - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> deleteWithResponseAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - topLevelArmResourceName, childExtensionResourceName, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - topLevelArmResourceName, childExtensionResourceName, Context.NONE); - } - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - topLevelArmResourceName, childExtensionResourceName, context); - } - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, Void> beginDeleteAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName) { - Mono>> mono - = deleteWithResponseAsync(resourceUri, topLevelArmResourceName, childExtensionResourceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); - } - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName) { - Response response - = deleteWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName); - return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); - } - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, Context context) { - Response response - = deleteWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, context); - return this.client.getLroResult(response, Void.class, Void.class, context); - } - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName) { - return beginDeleteAsync(resourceUri, topLevelArmResourceName, childExtensionResourceName).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName) { - beginDelete(resourceUri, topLevelArmResourceName, childExtensionResourceName).getFinalResult(); - } - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, - Context context) { - beginDelete(resourceUri, topLevelArmResourceName, childExtensionResourceName, context).getFinalResult(); - } - - /** - * List ChildExtensionResource resources by TopLevelArmResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ChildExtensionResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByTopLevelArmResourceSinglePageAsync(String resourceUri, String topLevelArmResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByTopLevelArmResource(this.client.getEndpoint(), - this.client.getApiVersion(), resourceUri, topLevelArmResourceName, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List ChildExtensionResource resources by TopLevelArmResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listByTopLevelArmResourceAsync(String resourceUri, - String topLevelArmResourceName) { - return new PagedFlux<>(() -> listByTopLevelArmResourceSinglePageAsync(resourceUri, topLevelArmResourceName), - nextLink -> listByTopLevelArmResourceNextSinglePageAsync(nextLink)); - } - - /** - * List ChildExtensionResource resources by TopLevelArmResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ChildExtensionResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByTopLevelArmResourceSinglePage(String resourceUri, - String topLevelArmResourceName) { - final String accept = "application/json"; - Response res - = service.listByTopLevelArmResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - topLevelArmResourceName, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List ChildExtensionResource resources by TopLevelArmResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ChildExtensionResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByTopLevelArmResourceSinglePage(String resourceUri, - String topLevelArmResourceName, Context context) { - final String accept = "application/json"; - Response res - = service.listByTopLevelArmResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, - topLevelArmResourceName, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List ChildExtensionResource resources by TopLevelArmResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByTopLevelArmResource(String resourceUri, - String topLevelArmResourceName) { - return new PagedIterable<>(() -> listByTopLevelArmResourceSinglePage(resourceUri, topLevelArmResourceName), - nextLink -> listByTopLevelArmResourceNextSinglePage(nextLink)); - } - - /** - * List ChildExtensionResource resources by TopLevelArmResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByTopLevelArmResource(String resourceUri, - String topLevelArmResourceName, Context context) { - return new PagedIterable<>( - () -> listByTopLevelArmResourceSinglePage(resourceUri, topLevelArmResourceName, context), - nextLink -> listByTopLevelArmResourceNextSinglePage(nextLink, context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ChildExtensionResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByTopLevelArmResourceNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByTopLevelArmResourceNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ChildExtensionResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByTopLevelArmResourceNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listByTopLevelArmResourceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a ChildExtensionResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByTopLevelArmResourceNextSinglePage(String nextLink, - Context context) { - final String accept = "application/json"; - Response res - = service.listByTopLevelArmResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesImpl.java deleted file mode 100644 index 51e14bb9a49..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient; -import tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner; -import tsptest.armresourceprovider.models.ChildExtensionResource; -import tsptest.armresourceprovider.models.ChildExtensionResourceInterfaces; - -public final class ChildExtensionResourceInterfacesImpl implements ChildExtensionResourceInterfaces { - private static final ClientLogger LOGGER = new ClientLogger(ChildExtensionResourceInterfacesImpl.class); - - private final ChildExtensionResourceInterfacesClient innerClient; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public ChildExtensionResourceInterfacesImpl(ChildExtensionResourceInterfacesClient innerClient, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getWithResponse(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, Context context) { - Response inner = this.serviceClient() - .getWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ChildExtensionResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public ChildExtensionResource get(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName) { - ChildExtensionResourceInner inner - = this.serviceClient().get(resourceUri, topLevelArmResourceName, childExtensionResourceName); - if (inner != null) { - return new ChildExtensionResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName) { - this.serviceClient().delete(resourceUri, topLevelArmResourceName, childExtensionResourceName); - } - - public void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, - Context context) { - this.serviceClient().delete(resourceUri, topLevelArmResourceName, childExtensionResourceName, context); - } - - public PagedIterable listByTopLevelArmResource(String resourceUri, - String topLevelArmResourceName) { - PagedIterable inner - = this.serviceClient().listByTopLevelArmResource(resourceUri, topLevelArmResourceName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ChildExtensionResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByTopLevelArmResource(String resourceUri, - String topLevelArmResourceName, Context context) { - PagedIterable inner - = this.serviceClient().listByTopLevelArmResource(resourceUri, topLevelArmResourceName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ChildExtensionResourceImpl(inner1, this.manager())); - } - - public ChildExtensionResource getById(String id) { - String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "resourceUri"); - if (resourceUri == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); - } - String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "topLevelArmResourceName"); - if (topLevelArmResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - String childExtensionResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "childExtensionResourceName"); - if (childExtensionResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'childExtensionResources'.", id))); - } - return this.getWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, Context.NONE) - .getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "resourceUri"); - if (resourceUri == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); - } - String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "topLevelArmResourceName"); - if (topLevelArmResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - String childExtensionResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "childExtensionResourceName"); - if (childExtensionResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'childExtensionResources'.", id))); - } - return this.getWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, context); - } - - public void deleteById(String id) { - String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "resourceUri"); - if (resourceUri == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); - } - String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "topLevelArmResourceName"); - if (topLevelArmResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - String childExtensionResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "childExtensionResourceName"); - if (childExtensionResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'childExtensionResources'.", id))); - } - this.delete(resourceUri, topLevelArmResourceName, childExtensionResourceName, Context.NONE); - } - - public void deleteByIdWithResponse(String id, Context context) { - String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "resourceUri"); - if (resourceUri == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); - } - String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "topLevelArmResourceName"); - if (topLevelArmResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - String childExtensionResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", - "childExtensionResourceName"); - if (childExtensionResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException(String - .format("The resource ID '%s' is not valid. Missing path segment 'childExtensionResources'.", id))); - } - this.delete(resourceUri, topLevelArmResourceName, childExtensionResourceName, context); - } - - private ChildExtensionResourceInterfacesClient serviceClient() { - return this.innerClient; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } - - public ChildExtensionResourceImpl define(String name) { - return new ChildExtensionResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java deleted file mode 100644 index 495b29a7b42..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Collections; -import java.util.Map; -import tsptest.armresourceprovider.fluent.models.ChildResourceInner; -import tsptest.armresourceprovider.models.ChildResource; -import tsptest.armresourceprovider.models.ChildResourceUpdate; -import tsptest.armresourceprovider.models.ProvisioningState; - -public final class ChildResourceImpl implements ChildResource, ChildResource.Definition, ChildResource.Update { - private ChildResourceInner innerObject; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public ProvisioningState provisioningState() { - return this.innerModel().provisioningState(); - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public String resourceGroupName() { - return resourceGroupName; - } - - public ChildResourceInner innerModel() { - return this.innerObject; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } - - private String resourceGroupName; - - private String topLevelArmResourceName; - - private String childResourceName; - - private ChildResourceUpdate updateProperties; - - public ChildResourceImpl withExistingTopLevelArmResource(String resourceGroupName, String topLevelArmResourceName) { - this.resourceGroupName = resourceGroupName; - this.topLevelArmResourceName = topLevelArmResourceName; - return this; - } - - public ChildResource create() { - this.innerObject = serviceManager.serviceClient() - .getChildResourcesInterfaces() - .createOrUpdate(resourceGroupName, topLevelArmResourceName, childResourceName, this.innerModel(), - Context.NONE); - return this; - } - - public ChildResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getChildResourcesInterfaces() - .createOrUpdate(resourceGroupName, topLevelArmResourceName, childResourceName, this.innerModel(), context); - return this; - } - - ChildResourceImpl(String name, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerObject = new ChildResourceInner(); - this.serviceManager = serviceManager; - this.childResourceName = name; - } - - public ChildResourceImpl update() { - this.updateProperties = new ChildResourceUpdate(); - return this; - } - - public ChildResource apply() { - this.innerObject = serviceManager.serviceClient() - .getChildResourcesInterfaces() - .updateWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, updateProperties, - Context.NONE) - .getValue(); - return this; - } - - public ChildResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getChildResourcesInterfaces() - .updateWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, updateProperties, - context) - .getValue(); - return this; - } - - ChildResourceImpl(ChildResourceInner innerObject, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.topLevelArmResourceName - = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "topLevelArmResources"); - this.childResourceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "childResources"); - } - - public ChildResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getChildResourcesInterfaces() - .getWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, Context.NONE) - .getValue(); - return this; - } - - public ChildResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getChildResourcesInterfaces() - .getWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, context) - .getValue(); - return this; - } - - public void actionWithoutBody() { - serviceManager.childResourcesInterfaces() - .actionWithoutBody(resourceGroupName, topLevelArmResourceName, childResourceName); - } - - public void actionWithoutBody(Context context) { - serviceManager.childResourcesInterfaces() - .actionWithoutBody(resourceGroupName, topLevelArmResourceName, childResourceName, context); - } - - public ChildResourceImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); - return this; - } - - public ChildResourceImpl withRegion(String location) { - this.innerModel().withLocation(location); - return this; - } - - public ChildResourceImpl withTags(Map tags) { - if (isInCreateMode()) { - this.innerModel().withTags(tags); - return this; - } else { - this.updateProperties.withTags(tags); - return this; - } - } - - private boolean isInCreateMode() { - return this.innerModel() == null || this.innerModel().id() == null; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java deleted file mode 100644 index 89e5d362ce6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java +++ /dev/null @@ -1,1088 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient; -import tsptest.armresourceprovider.fluent.models.ChildResourceInner; -import tsptest.armresourceprovider.implementation.models.ChildResourceListResult; -import tsptest.armresourceprovider.models.ChildResourceUpdate; - -/** - * An instance of this class provides access to all the operations defined in ChildResourcesInterfacesClient. - */ -public final class ChildResourcesInterfacesClientImpl implements ChildResourcesInterfacesClient { - /** - * The proxy service used to perform REST calls. - */ - private final ChildResourcesInterfacesService service; - - /** - * The service client containing this operation class. - */ - private final ArmClientImpl client; - - /** - * Initializes an instance of ChildResourcesInterfacesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ChildResourcesInterfacesClientImpl(ArmClientImpl client) { - this.service = RestProxy.create(ChildResourcesInterfacesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmClientChildResourcesInterfaces to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmClientChildResourcesInterfaces") - public interface ChildResourcesInterfacesService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childResourceName") String childResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childResourceName") String childResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childResourceName") String childResourceName, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") ChildResourceInner resource, - Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childResourceName") String childResourceName, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") ChildResourceInner resource, - Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childResourceName") String childResourceName, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") ChildResourceUpdate properties, - Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response updateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childResourceName") String childResourceName, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") ChildResourceUpdate properties, - Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") - @ExpectedResponses({ 200, 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childResourceName") String childResourceName, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") - @ExpectedResponses({ 200, 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childResourceName") String childResourceName, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByTopLevelArmResource(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByTopLevelArmResourceSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}/actionWithoutBody") - @ExpectedResponses({ 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> actionWithoutBody(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childResourceName") String childResourceName, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}/actionWithoutBody") - @ExpectedResponses({ 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response actionWithoutBodySync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @PathParam("childResourceName") String childResourceName, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByTopLevelArmResourceNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByTopLevelArmResourceNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Get a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName, String childResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName) { - return getWithResponseAsync(resourceGroupName, topLevelArmResourceName, childResourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, Context context) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - resourceGroupName, topLevelArmResourceName, childResourceName, accept, context); - } - - /** - * Get a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ChildResourceInner get(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { - return getWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, Context.NONE).getValue(); - } - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName, String childResourceName, ChildResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, - contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, contentType, - accept, resource, Context.NONE); - } - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, contentType, - accept, resource, context); - } - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of subresource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, ChildResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String topLevelArmResourceName, String childResourceName, - ChildResourceInner resource) { - Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, topLevelArmResourceName, childResourceName, resource); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - ChildResourceInner.class, ChildResourceInner.class, this.client.getContext()); - } - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of subresource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ChildResourceInner> beginCreateOrUpdate(String resourceGroupName, - String topLevelArmResourceName, String childResourceName, ChildResourceInner resource) { - Response response - = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, resource); - return this.client.getLroResult(response, ChildResourceInner.class, - ChildResourceInner.class, Context.NONE); - } - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of subresource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ChildResourceInner> beginCreateOrUpdate(String resourceGroupName, - String topLevelArmResourceName, String childResourceName, ChildResourceInner resource, Context context) { - Response response = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourceName, - childResourceName, resource, context); - return this.client.getLroResult(response, ChildResourceInner.class, - ChildResourceInner.class, context); - } - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceInner resource) { - return beginCreateOrUpdateAsync(resourceGroupName, topLevelArmResourceName, childResourceName, resource).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ChildResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceInner resource) { - return beginCreateOrUpdate(resourceGroupName, topLevelArmResourceName, childResourceName, resource) - .getFinalResult(); - } - - /** - * Create a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ChildResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceInner resource, Context context) { - return beginCreateOrUpdate(resourceGroupName, topLevelArmResourceName, childResourceName, resource, context) - .getFinalResult(); - } - - /** - * Update a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName, String childResourceName, ChildResourceUpdate properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, - contentType, accept, properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceUpdate properties) { - return updateWithResponseAsync(resourceGroupName, topLevelArmResourceName, childResourceName, properties) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Update a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, ChildResourceUpdate properties, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, contentType, - accept, properties, context); - } - - /** - * Update a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return subresource of Top Level Arm Resource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ChildResourceInner update(String resourceGroupName, String topLevelArmResourceName, String childResourceName, - ChildResourceUpdate properties) { - return updateWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, properties, - Context.NONE).getValue(); - } - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> deleteWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName, String childResourceName) { - return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceGroupName, String topLevelArmResourceName, - String childResourceName) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, - Context.NONE); - } - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, context); - } - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName) { - Mono>> mono - = deleteWithResponseAsync(resourceGroupName, topLevelArmResourceName, childResourceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); - } - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName, - String childResourceName) { - Response response - = deleteWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName); - return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); - } - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, Context context) { - Response response - = deleteWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, context); - return this.client.getLroResult(response, Void.class, Void.class, context); - } - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { - return beginDeleteAsync(resourceGroupName, topLevelArmResourceName, childResourceName).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { - beginDelete(resourceGroupName, topLevelArmResourceName, childResourceName).getFinalResult(); - } - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName, - Context context) { - beginDelete(resourceGroupName, topLevelArmResourceName, childResourceName, context).getFinalResult(); - } - - /** - * List ChildResource resources by TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByTopLevelArmResourceSinglePageAsync(String resourceGroupName, - String topLevelArmResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByTopLevelArmResource(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List ChildResource resources by TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listByTopLevelArmResourceAsync(String resourceGroupName, - String topLevelArmResourceName) { - return new PagedFlux<>( - () -> listByTopLevelArmResourceSinglePageAsync(resourceGroupName, topLevelArmResourceName), - nextLink -> listByTopLevelArmResourceNextSinglePageAsync(nextLink)); - } - - /** - * List ChildResource resources by TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByTopLevelArmResourceSinglePage(String resourceGroupName, - String topLevelArmResourceName) { - final String accept = "application/json"; - Response res - = service.listByTopLevelArmResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List ChildResource resources by TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByTopLevelArmResourceSinglePage(String resourceGroupName, - String topLevelArmResourceName, Context context) { - final String accept = "application/json"; - Response res - = service.listByTopLevelArmResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List ChildResource resources by TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByTopLevelArmResource(String resourceGroupName, - String topLevelArmResourceName) { - return new PagedIterable<>( - () -> listByTopLevelArmResourceSinglePage(resourceGroupName, topLevelArmResourceName), - nextLink -> listByTopLevelArmResourceNextSinglePage(nextLink)); - } - - /** - * List ChildResource resources by TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByTopLevelArmResource(String resourceGroupName, - String topLevelArmResourceName, Context context) { - return new PagedIterable<>( - () -> listByTopLevelArmResourceSinglePage(resourceGroupName, topLevelArmResourceName, context), - nextLink -> listByTopLevelArmResourceNextSinglePage(nextLink, context)); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> actionWithoutBodyWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName, String childResourceName) { - return FluxUtil - .withContext(context -> service.actionWithoutBody(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response actionWithoutBodyWithResponse(String resourceGroupName, String topLevelArmResourceName, - String childResourceName) { - return service.actionWithoutBodySync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, - Context.NONE); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response actionWithoutBodyWithResponse(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, Context context) { - return service.actionWithoutBodySync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, context); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, Void> beginActionWithoutBodyAsync(String resourceGroupName, - String topLevelArmResourceName, String childResourceName) { - Mono>> mono - = actionWithoutBodyWithResponseAsync(resourceGroupName, topLevelArmResourceName, childResourceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginActionWithoutBody(String resourceGroupName, - String topLevelArmResourceName, String childResourceName) { - Response response - = actionWithoutBodyWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName); - return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginActionWithoutBody(String resourceGroupName, - String topLevelArmResourceName, String childResourceName, Context context) { - Response response - = actionWithoutBodyWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, context); - return this.client.getLroResult(response, Void.class, Void.class, context); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono actionWithoutBodyAsync(String resourceGroupName, String topLevelArmResourceName, - String childResourceName) { - return beginActionWithoutBodyAsync(resourceGroupName, topLevelArmResourceName, childResourceName).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { - beginActionWithoutBody(resourceGroupName, topLevelArmResourceName, childResourceName).getFinalResult(); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName, - Context context) { - beginActionWithoutBody(resourceGroupName, topLevelArmResourceName, childResourceName, context).getFinalResult(); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByTopLevelArmResourceNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByTopLevelArmResourceNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByTopLevelArmResourceNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listByTopLevelArmResourceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByTopLevelArmResourceNextSinglePage(String nextLink, - Context context) { - final String accept = "application/json"; - Response res - = service.listByTopLevelArmResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesImpl.java deleted file mode 100644 index 23014261973..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesImpl.java +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient; -import tsptest.armresourceprovider.fluent.models.ChildResourceInner; -import tsptest.armresourceprovider.models.ChildResource; -import tsptest.armresourceprovider.models.ChildResourcesInterfaces; - -public final class ChildResourcesInterfacesImpl implements ChildResourcesInterfaces { - private static final ClientLogger LOGGER = new ClientLogger(ChildResourcesInterfacesImpl.class); - - private final ChildResourcesInterfacesClient innerClient; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public ChildResourcesInterfacesImpl(ChildResourcesInterfacesClient innerClient, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getWithResponse(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, Context context) { - Response inner = this.serviceClient() - .getWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ChildResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public ChildResource get(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { - ChildResourceInner inner - = this.serviceClient().get(resourceGroupName, topLevelArmResourceName, childResourceName); - if (inner != null) { - return new ChildResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { - this.serviceClient().delete(resourceGroupName, topLevelArmResourceName, childResourceName); - } - - public void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName, - Context context) { - this.serviceClient().delete(resourceGroupName, topLevelArmResourceName, childResourceName, context); - } - - public PagedIterable listByTopLevelArmResource(String resourceGroupName, - String topLevelArmResourceName) { - PagedIterable inner - = this.serviceClient().listByTopLevelArmResource(resourceGroupName, topLevelArmResourceName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ChildResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByTopLevelArmResource(String resourceGroupName, - String topLevelArmResourceName, Context context) { - PagedIterable inner - = this.serviceClient().listByTopLevelArmResource(resourceGroupName, topLevelArmResourceName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ChildResourceImpl(inner1, this.manager())); - } - - public void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { - this.serviceClient().actionWithoutBody(resourceGroupName, topLevelArmResourceName, childResourceName); - } - - public void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName, - Context context) { - this.serviceClient().actionWithoutBody(resourceGroupName, topLevelArmResourceName, childResourceName, context); - } - - public ChildResource getById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - String childResourceName = ResourceManagerUtils.getValueFromIdByName(id, "childResources"); - if (childResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'childResources'.", id))); - } - return this.getWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, Context.NONE) - .getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - String childResourceName = ResourceManagerUtils.getValueFromIdByName(id, "childResources"); - if (childResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'childResources'.", id))); - } - return this.getWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, context); - } - - public void deleteById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - String childResourceName = ResourceManagerUtils.getValueFromIdByName(id, "childResources"); - if (childResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'childResources'.", id))); - } - this.delete(resourceGroupName, topLevelArmResourceName, childResourceName, Context.NONE); - } - - public void deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - String childResourceName = ResourceManagerUtils.getValueFromIdByName(id, "childResources"); - if (childResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'childResources'.", id))); - } - this.delete(resourceGroupName, topLevelArmResourceName, childResourceName, context); - } - - private ChildResourcesInterfacesClient serviceClient() { - return this.innerClient; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } - - public ChildResourceImpl define(String name) { - return new ChildResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java deleted file mode 100644 index 9c64a9ca0c5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Collections; -import java.util.Map; -import tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner; -import tsptest.armresourceprovider.models.AnonymousEmptyModel; -import tsptest.armresourceprovider.models.CustomTemplateResource; -import tsptest.armresourceprovider.models.CustomTemplateResourcePatch; -import tsptest.armresourceprovider.models.Dog; -import tsptest.armresourceprovider.models.EmptyModel; -import tsptest.armresourceprovider.models.ManagedServiceIdentity; -import tsptest.armresourceprovider.models.PriorityModel; -import tsptest.armresourceprovider.models.ProvisioningState; - -public final class CustomTemplateResourceImpl - implements CustomTemplateResource, CustomTemplateResource.Definition, CustomTemplateResource.Update { - private CustomTemplateResourceInner innerObject; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public ManagedServiceIdentity identity() { - return this.innerModel().identity(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public ProvisioningState provisioningState() { - return this.innerModel().provisioningState(); - } - - public Dog dog() { - return this.innerModel().dog(); - } - - public EmptyModel namedEmptyModel() { - return this.innerModel().namedEmptyModel(); - } - - public AnonymousEmptyModel anonymousEmptyModel() { - return this.innerModel().anonymousEmptyModel(); - } - - public PriorityModel priority() { - return this.innerModel().priority(); - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public String resourceGroupName() { - return resourceGroupName; - } - - public CustomTemplateResourceInner innerModel() { - return this.innerObject; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } - - private String resourceGroupName; - - private String customTemplateResourceName; - - private String createIfMatch; - - private String createIfNoneMatch; - - private CustomTemplateResourcePatch updateProperties; - - public CustomTemplateResourceImpl withExistingResourceGroup(String resourceGroupName) { - this.resourceGroupName = resourceGroupName; - return this; - } - - public CustomTemplateResource create() { - this.innerObject = serviceManager.serviceClient() - .getCustomTemplateResourceInterfaces() - .createOrUpdate(resourceGroupName, customTemplateResourceName, this.innerModel(), createIfMatch, - createIfNoneMatch, Context.NONE); - return this; - } - - public CustomTemplateResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getCustomTemplateResourceInterfaces() - .createOrUpdate(resourceGroupName, customTemplateResourceName, this.innerModel(), createIfMatch, - createIfNoneMatch, context); - return this; - } - - CustomTemplateResourceImpl(String name, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerObject = new CustomTemplateResourceInner(); - this.serviceManager = serviceManager; - this.customTemplateResourceName = name; - this.createIfMatch = null; - this.createIfNoneMatch = null; - } - - public CustomTemplateResourceImpl update() { - this.updateProperties = new CustomTemplateResourcePatch(); - return this; - } - - public CustomTemplateResource apply() { - this.innerObject = serviceManager.serviceClient() - .getCustomTemplateResourceInterfaces() - .updateLongRunning(resourceGroupName, customTemplateResourceName, updateProperties, Context.NONE); - return this; - } - - public CustomTemplateResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getCustomTemplateResourceInterfaces() - .updateLongRunning(resourceGroupName, customTemplateResourceName, updateProperties, context); - return this; - } - - CustomTemplateResourceImpl(CustomTemplateResourceInner innerObject, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.customTemplateResourceName - = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "customTemplateResources"); - } - - public CustomTemplateResourceImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); - return this; - } - - public CustomTemplateResourceImpl withRegion(String location) { - this.innerModel().withLocation(location); - return this; - } - - public CustomTemplateResourceImpl withTags(Map tags) { - this.innerModel().withTags(tags); - return this; - } - - public CustomTemplateResourceImpl withIdentity(ManagedServiceIdentity identity) { - if (isInCreateMode()) { - this.innerModel().withIdentity(identity); - return this; - } else { - this.updateProperties.withIdentity(identity); - return this; - } - } - - public CustomTemplateResourceImpl withDog(Dog dog) { - this.innerModel().withDog(dog); - return this; - } - - public CustomTemplateResourceImpl withNamedEmptyModel(EmptyModel namedEmptyModel) { - this.innerModel().withNamedEmptyModel(namedEmptyModel); - return this; - } - - public CustomTemplateResourceImpl withAnonymousEmptyModel(AnonymousEmptyModel anonymousEmptyModel) { - this.innerModel().withAnonymousEmptyModel(anonymousEmptyModel); - return this; - } - - public CustomTemplateResourceImpl withPriority(PriorityModel priority) { - this.innerModel().withPriority(priority); - return this; - } - - public CustomTemplateResourceImpl withIfMatch(String ifMatch) { - this.createIfMatch = ifMatch; - return this; - } - - public CustomTemplateResourceImpl withIfNoneMatch(String ifNoneMatch) { - this.createIfNoneMatch = ifNoneMatch; - return this; - } - - private boolean isInCreateMode() { - return this.innerModel() == null || this.innerModel().id() == null; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesClientImpl.java deleted file mode 100644 index 6289e93898d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesClientImpl.java +++ /dev/null @@ -1,581 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient; -import tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner; -import tsptest.armresourceprovider.models.CustomTemplateResourcePatch; - -/** - * An instance of this class provides access to all the operations defined in CustomTemplateResourceInterfacesClient. - */ -public final class CustomTemplateResourceInterfacesClientImpl implements CustomTemplateResourceInterfacesClient { - /** - * The proxy service used to perform REST calls. - */ - private final CustomTemplateResourceInterfacesService service; - - /** - * The service client containing this operation class. - */ - private final ArmClientImpl client; - - /** - * Initializes an instance of CustomTemplateResourceInterfacesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - CustomTemplateResourceInterfacesClientImpl(ArmClientImpl client) { - this.service = RestProxy.create(CustomTemplateResourceInterfacesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmClientCustomTemplateResourceInterfaces to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmClientCustomTemplateResourceInterfaces") - public interface CustomTemplateResourceInterfacesService { - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/customTemplateResources/{customTemplateResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("If-Match") String ifMatch, - @HeaderParam("If-None-Match") String ifNoneMatch, - @PathParam("customTemplateResourceName") String customTemplateResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") CustomTemplateResourceInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/customTemplateResources/{customTemplateResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("If-Match") String ifMatch, - @HeaderParam("If-None-Match") String ifNoneMatch, - @PathParam("customTemplateResourceName") String customTemplateResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") CustomTemplateResourceInner resource, Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/customTemplateResources/{customTemplateResourceName}") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> updateLongRunning(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("customTemplateResourceName") String customTemplateResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") CustomTemplateResourcePatch properties, Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/customTemplateResources/{customTemplateResourceName}") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response updateLongRunningSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("customTemplateResourceName") String customTemplateResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") CustomTemplateResourcePatch properties, Context context); - } - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String customTemplateResourceName, CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, ifMatch, ifNoneMatch, customTemplateResourceName, - contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String customTemplateResourceName, - CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, ifMatch, ifNoneMatch, customTemplateResourceName, - contentType, accept, resource, Context.NONE); - } - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String customTemplateResourceName, - CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, ifMatch, ifNoneMatch, customTemplateResourceName, - contentType, accept, resource, context); - } - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, CustomTemplateResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource, - String ifMatch, String ifNoneMatch) { - Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, - customTemplateResourceName, resource, ifMatch, ifNoneMatch); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, - this.client.getContext()); - } - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, CustomTemplateResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource) { - final String ifMatch = null; - final String ifNoneMatch = null; - Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, - customTemplateResourceName, resource, ifMatch, ifNoneMatch); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, - this.client.getContext()); - } - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, CustomTemplateResourceInner> beginCreateOrUpdate( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource, - String ifMatch, String ifNoneMatch) { - Response response - = createOrUpdateWithResponse(resourceGroupName, customTemplateResourceName, resource, ifMatch, ifNoneMatch); - return this.client.getLroResult(response, - CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, Context.NONE); - } - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, CustomTemplateResourceInner> beginCreateOrUpdate( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource) { - final String ifMatch = null; - final String ifNoneMatch = null; - Response response - = createOrUpdateWithResponse(resourceGroupName, customTemplateResourceName, resource, ifMatch, ifNoneMatch); - return this.client.getLroResult(response, - CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, Context.NONE); - } - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, CustomTemplateResourceInner> beginCreateOrUpdate( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource, - String ifMatch, String ifNoneMatch, Context context) { - Response response = createOrUpdateWithResponse(resourceGroupName, customTemplateResourceName, - resource, ifMatch, ifNoneMatch, context); - return this.client.getLroResult(response, - CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, context); - } - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateAsync(String resourceGroupName, - String customTemplateResourceName, CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch) { - return beginCreateOrUpdateAsync(resourceGroupName, customTemplateResourceName, resource, ifMatch, ifNoneMatch) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateAsync(String resourceGroupName, - String customTemplateResourceName, CustomTemplateResourceInner resource) { - final String ifMatch = null; - final String ifNoneMatch = null; - return beginCreateOrUpdateAsync(resourceGroupName, customTemplateResourceName, resource, ifMatch, ifNoneMatch) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CustomTemplateResourceInner createOrUpdate(String resourceGroupName, String customTemplateResourceName, - CustomTemplateResourceInner resource) { - final String ifMatch = null; - final String ifNoneMatch = null; - return beginCreateOrUpdate(resourceGroupName, customTemplateResourceName, resource, ifMatch, ifNoneMatch) - .getFinalResult(); - } - - /** - * Create a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CustomTemplateResourceInner createOrUpdate(String resourceGroupName, String customTemplateResourceName, - CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch, Context context) { - return beginCreateOrUpdate(resourceGroupName, customTemplateResourceName, resource, ifMatch, ifNoneMatch, - context).getFinalResult(); - } - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> updateLongRunningWithResponseAsync(String resourceGroupName, - String customTemplateResourceName, CustomTemplateResourcePatch properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.updateLongRunning(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, customTemplateResourceName, contentType, accept, - properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response updateLongRunningWithResponse(String resourceGroupName, - String customTemplateResourceName, CustomTemplateResourcePatch properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateLongRunningSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, customTemplateResourceName, contentType, accept, - properties, Context.NONE); - } - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response updateLongRunningWithResponse(String resourceGroupName, - String customTemplateResourceName, CustomTemplateResourcePatch properties, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateLongRunningSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, customTemplateResourceName, contentType, accept, - properties, context); - } - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, CustomTemplateResourceInner> beginUpdateLongRunningAsync( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourcePatch properties) { - Mono>> mono - = updateLongRunningWithResponseAsync(resourceGroupName, customTemplateResourceName, properties); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, - this.client.getContext()); - } - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, CustomTemplateResourceInner> beginUpdateLongRunning( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourcePatch properties) { - Response response - = updateLongRunningWithResponse(resourceGroupName, customTemplateResourceName, properties); - return this.client.getLroResult(response, - CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, Context.NONE); - } - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, CustomTemplateResourceInner> beginUpdateLongRunning( - String resourceGroupName, String customTemplateResourceName, CustomTemplateResourcePatch properties, - Context context) { - Response response - = updateLongRunningWithResponse(resourceGroupName, customTemplateResourceName, properties, context); - return this.client.getLroResult(response, - CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, context); - } - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateLongRunningAsync(String resourceGroupName, - String customTemplateResourceName, CustomTemplateResourcePatch properties) { - return beginUpdateLongRunningAsync(resourceGroupName, customTemplateResourceName, properties).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CustomTemplateResourceInner updateLongRunning(String resourceGroupName, String customTemplateResourceName, - CustomTemplateResourcePatch properties) { - return beginUpdateLongRunning(resourceGroupName, customTemplateResourceName, properties).getFinalResult(); - } - - /** - * Update a CustomTemplateResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param customTemplateResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CustomTemplateResourceInner updateLongRunning(String resourceGroupName, String customTemplateResourceName, - CustomTemplateResourcePatch properties, Context context) { - return beginUpdateLongRunning(resourceGroupName, customTemplateResourceName, properties, context) - .getFinalResult(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesImpl.java deleted file mode 100644 index 16f37436aa4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.util.logging.ClientLogger; -import tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient; -import tsptest.armresourceprovider.models.CustomTemplateResourceInterfaces; - -public final class CustomTemplateResourceInterfacesImpl implements CustomTemplateResourceInterfaces { - private static final ClientLogger LOGGER = new ClientLogger(CustomTemplateResourceInterfacesImpl.class); - - private final CustomTemplateResourceInterfacesClient innerClient; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public CustomTemplateResourceInterfacesImpl(CustomTemplateResourceInterfacesClient innerClient, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - private CustomTemplateResourceInterfacesClient serviceClient() { - return this.innerClient; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } - - public CustomTemplateResourceImpl define(String name) { - return new CustomTemplateResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsClientImpl.java deleted file mode 100644 index 9adadb0f70e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsClientImpl.java +++ /dev/null @@ -1,328 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient; -import tsptest.armresourceprovider.models.NginxConfigurationRequest; -import tsptest.armresourceprovider.models.NginxConfigurationResponse; - -/** - * An instance of this class provides access to all the operations defined in ImmutableResourceModelsClient. - */ -public final class ImmutableResourceModelsClientImpl implements ImmutableResourceModelsClient { - /** - * The proxy service used to perform REST calls. - */ - private final ImmutableResourceModelsService service; - - /** - * The service client containing this operation class. - */ - private final ArmClientImpl client; - - /** - * Initializes an instance of ImmutableResourceModelsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ImmutableResourceModelsClientImpl(ArmClientImpl client) { - this.service = RestProxy.create(ImmutableResourceModelsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmClientImmutableResourceModels to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmClientImmutableResourceModels") - public interface ImmutableResourceModelsService { - @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/configurations/{configurationName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("configurationName") String configurationName, @HeaderParam("Accept") String accept, - @BodyParam("application/json") NginxConfigurationRequest properties, Context context); - - @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/configurations/{configurationName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("configurationName") String configurationName, @HeaderParam("Accept") String accept, - @BodyParam("application/json") NginxConfigurationRequest properties, Context context); - } - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String configurationName, NginxConfigurationRequest properties) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, configurationName, accept, properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String configurationName, - NginxConfigurationRequest properties) { - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, configurationName, accept, properties, Context.NONE); - } - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String configurationName, - NginxConfigurationRequest properties, Context context) { - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, configurationName, accept, properties, context); - } - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete proxy resource types can be created by aliasing this type - * using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, NginxConfigurationResponse> beginCreateOrUpdateAsync( - String resourceGroupName, String configurationName, NginxConfigurationRequest properties) { - Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, configurationName, properties); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), NginxConfigurationResponse.class, NginxConfigurationResponse.class, - this.client.getContext()); - } - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete proxy resource types can be created by aliasing this type - * using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, NginxConfigurationResponse> - beginCreateOrUpdateAsync(String resourceGroupName, String configurationName) { - final NginxConfigurationRequest properties = null; - Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, configurationName, properties); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), NginxConfigurationResponse.class, NginxConfigurationResponse.class, - this.client.getContext()); - } - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type - * using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, NginxConfigurationResponse> - beginCreateOrUpdate(String resourceGroupName, String configurationName, NginxConfigurationRequest properties) { - Response response = createOrUpdateWithResponse(resourceGroupName, configurationName, properties); - return this.client.getLroResult(response, - NginxConfigurationResponse.class, NginxConfigurationResponse.class, Context.NONE); - } - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type - * using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, NginxConfigurationResponse> - beginCreateOrUpdate(String resourceGroupName, String configurationName) { - final NginxConfigurationRequest properties = null; - Response response = createOrUpdateWithResponse(resourceGroupName, configurationName, properties); - return this.client.getLroResult(response, - NginxConfigurationResponse.class, NginxConfigurationResponse.class, Context.NONE); - } - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type - * using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, NginxConfigurationResponse> beginCreateOrUpdate( - String resourceGroupName, String configurationName, NginxConfigurationRequest properties, Context context) { - Response response - = createOrUpdateWithResponse(resourceGroupName, configurationName, properties, context); - return this.client.getLroResult(response, - NginxConfigurationResponse.class, NginxConfigurationResponse.class, context); - } - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateAsync(String resourceGroupName, String configurationName, - NginxConfigurationRequest properties) { - return beginCreateOrUpdateAsync(resourceGroupName, configurationName, properties).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateAsync(String resourceGroupName, String configurationName) { - final NginxConfigurationRequest properties = null; - return beginCreateOrUpdateAsync(resourceGroupName, configurationName, properties).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName) { - final NginxConfigurationRequest properties = null; - return beginCreateOrUpdate(resourceGroupName, configurationName, properties).getFinalResult(); - } - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName, - NginxConfigurationRequest properties, Context context) { - return beginCreateOrUpdate(resourceGroupName, configurationName, properties, context).getFinalResult(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsImpl.java deleted file mode 100644 index d5bcd4b973c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient; -import tsptest.armresourceprovider.models.ImmutableResourceModels; -import tsptest.armresourceprovider.models.NginxConfigurationRequest; -import tsptest.armresourceprovider.models.NginxConfigurationResponse; - -public final class ImmutableResourceModelsImpl implements ImmutableResourceModels { - private static final ClientLogger LOGGER = new ClientLogger(ImmutableResourceModelsImpl.class); - - private final ImmutableResourceModelsClient innerClient; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public ImmutableResourceModelsImpl(ImmutableResourceModelsClient innerClient, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName) { - return this.serviceClient().createOrUpdate(resourceGroupName, configurationName); - } - - public NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName, - NginxConfigurationRequest properties, Context context) { - return this.serviceClient().createOrUpdate(resourceGroupName, configurationName, properties, context); - } - - private ImmutableResourceModelsClient serviceClient() { - return this.innerClient; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesClientImpl.java deleted file mode 100644 index 4c9b682e39d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesClientImpl.java +++ /dev/null @@ -1,444 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -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.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.LroNoBodiesClient; -import tsptest.armresourceprovider.models.ActionFinalResult; -import tsptest.armresourceprovider.models.ResourceLroNoBody; - -/** - * An instance of this class provides access to all the operations defined in LroNoBodiesClient. - */ -public final class LroNoBodiesClientImpl implements LroNoBodiesClient { - /** - * The proxy service used to perform REST calls. - */ - private final LroNoBodiesService service; - - /** - * The service client containing this operation class. - */ - private final ArmClientImpl client; - - /** - * Initializes an instance of LroNoBodiesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - LroNoBodiesClientImpl(ArmClientImpl client) { - this.service - = RestProxy.create(LroNoBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmClientLroNoBodies to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmClientLroNoBodies") - public interface LroNoBodiesService { - @Headers({ "Accept: application/json;q=0.9" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/resourceLroNoBody/{resourceLroNoBodyName}") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceLroNoBodyName") String resourceLroNoBodyName, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") ResourceLroNoBody resource, - Context context); - - @Headers({ "Accept: application/json;q=0.9" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/resourceLroNoBody/{resourceLroNoBodyName}") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceLroNoBodyName") String resourceLroNoBodyName, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") ResourceLroNoBody resource, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/resourceLroNoBody/{resourceLroNoBodyName}/action") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> action(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceLroNoBodyName") String resourceLroNoBodyName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/resourceLroNoBody/{resourceLroNoBodyName}/action") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response actionSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceLroNoBodyName") String resourceLroNoBodyName, @HeaderParam("Accept") String accept, - Context context); - } - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String resourceLroNoBodyName, ResourceLroNoBody resource) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, resourceLroNoBodyName, contentType, resource, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String resourceLroNoBodyName, - ResourceLroNoBody resource) { - final String contentType = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, resourceLroNoBodyName, contentType, resource, - Context.NONE); - } - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String resourceLroNoBodyName, - ResourceLroNoBody resource, Context context) { - final String contentType = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, resourceLroNoBodyName, contentType, resource, context); - } - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, ResourceLroNoBody> - beginCreateOrUpdateAsync(String resourceGroupName, String resourceLroNoBodyName, ResourceLroNoBody resource) { - Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, resourceLroNoBodyName, resource); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - ResourceLroNoBody.class, ResourceLroNoBody.class, this.client.getContext()); - } - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ResourceLroNoBody> beginCreateOrUpdate(String resourceGroupName, - String resourceLroNoBodyName, ResourceLroNoBody resource) { - Response response = createOrUpdateWithResponse(resourceGroupName, resourceLroNoBodyName, resource); - return this.client.getLroResult(response, ResourceLroNoBody.class, - ResourceLroNoBody.class, Context.NONE); - } - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ResourceLroNoBody> beginCreateOrUpdate(String resourceGroupName, - String resourceLroNoBodyName, ResourceLroNoBody resource, Context context) { - Response response - = createOrUpdateWithResponse(resourceGroupName, resourceLroNoBodyName, resource, context); - return this.client.getLroResult(response, ResourceLroNoBody.class, - ResourceLroNoBody.class, context); - } - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateAsync(String resourceGroupName, String resourceLroNoBodyName, - ResourceLroNoBody resource) { - return beginCreateOrUpdateAsync(resourceGroupName, resourceLroNoBodyName, resource).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, - ResourceLroNoBody resource) { - return beginCreateOrUpdate(resourceGroupName, resourceLroNoBodyName, resource).getFinalResult(); - } - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, - ResourceLroNoBody resource, Context context) { - return beginCreateOrUpdate(resourceGroupName, resourceLroNoBodyName, resource, context).getFinalResult(); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> actionWithResponseAsync(String resourceGroupName, - String resourceLroNoBodyName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.action(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, resourceLroNoBodyName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response actionWithResponse(String resourceGroupName, String resourceLroNoBodyName) { - final String accept = "application/json"; - return service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, resourceLroNoBodyName, accept, Context.NONE); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response actionWithResponse(String resourceGroupName, String resourceLroNoBodyName, - Context context) { - final String accept = "application/json"; - return service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, resourceLroNoBodyName, accept, context); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, ActionFinalResult> beginActionAsync(String resourceGroupName, - String resourceLroNoBodyName) { - Mono>> mono = actionWithResponseAsync(resourceGroupName, resourceLroNoBodyName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - ActionFinalResult.class, ActionFinalResult.class, this.client.getContext()); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ActionFinalResult> beginAction(String resourceGroupName, - String resourceLroNoBodyName) { - Response response = actionWithResponse(resourceGroupName, resourceLroNoBodyName); - return this.client.getLroResult(response, ActionFinalResult.class, - ActionFinalResult.class, Context.NONE); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ActionFinalResult> beginAction(String resourceGroupName, - String resourceLroNoBodyName, Context context) { - Response response = actionWithResponse(resourceGroupName, resourceLroNoBodyName, context); - return this.client.getLroResult(response, ActionFinalResult.class, - ActionFinalResult.class, context); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono actionAsync(String resourceGroupName, String resourceLroNoBodyName) { - return beginActionAsync(resourceGroupName, resourceLroNoBodyName).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName) { - return beginAction(resourceGroupName, resourceLroNoBodyName).getFinalResult(); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName, Context context) { - return beginAction(resourceGroupName, resourceLroNoBodyName, context).getFinalResult(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesImpl.java deleted file mode 100644 index 7a5929e9328..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armresourceprovider.fluent.LroNoBodiesClient; -import tsptest.armresourceprovider.models.ActionFinalResult; -import tsptest.armresourceprovider.models.LroNoBodies; -import tsptest.armresourceprovider.models.ResourceLroNoBody; - -public final class LroNoBodiesImpl implements LroNoBodies { - private static final ClientLogger LOGGER = new ClientLogger(LroNoBodiesImpl.class); - - private final LroNoBodiesClient innerClient; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public LroNoBodiesImpl(LroNoBodiesClient innerClient, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, - ResourceLroNoBody resource) { - return this.serviceClient().createOrUpdate(resourceGroupName, resourceLroNoBodyName, resource); - } - - public ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, - ResourceLroNoBody resource, Context context) { - return this.serviceClient().createOrUpdate(resourceGroupName, resourceLroNoBodyName, resource, context); - } - - public ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName) { - return this.serviceClient().action(resourceGroupName, resourceLroNoBodyName); - } - - public ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName, Context context) { - return this.serviceClient().action(resourceGroupName, resourceLroNoBodyName, context); - } - - private LroNoBodiesClient serviceClient() { - return this.innerClient; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusImpl.java deleted file mode 100644 index 3fd5116872d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.management.SystemData; -import java.util.Collections; -import java.util.Map; -import tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner; -import tsptest.armresourceprovider.models.ManagedMaintenanceWindowStatus; - -public final class ManagedMaintenanceWindowStatusImpl implements ManagedMaintenanceWindowStatus { - private ManagedMaintenanceWindowStatusInner innerObject; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - ManagedMaintenanceWindowStatusImpl(ManagedMaintenanceWindowStatusInner innerObject, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public String provisioningState() { - return this.innerModel().provisioningState(); - } - - public ManagedMaintenanceWindowStatusInner innerModel() { - return this.innerObject; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsClientImpl.java deleted file mode 100644 index 59ca4c8cd7d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsClientImpl.java +++ /dev/null @@ -1,426 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient; -import tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner; - -/** - * An instance of this class provides access to all the operations defined in - * ManagedMaintenanceWindowStatusOperationsClient. - */ -public final class ManagedMaintenanceWindowStatusOperationsClientImpl - implements ManagedMaintenanceWindowStatusOperationsClient { - /** - * The proxy service used to perform REST calls. - */ - private final ManagedMaintenanceWindowStatusOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ArmClientImpl client; - - /** - * Initializes an instance of ManagedMaintenanceWindowStatusOperationsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ManagedMaintenanceWindowStatusOperationsClientImpl(ArmClientImpl client) { - this.service = RestProxy.create(ManagedMaintenanceWindowStatusOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmClientManagedMaintenanceWindowStatusOperations to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmClientManagedMaintenanceWindowStatusOperations") - public interface ManagedMaintenanceWindowStatusOperationsService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/managedMaintenanceWindowStatusContents/{managedMaintenanceWindowStatusContentName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("managedMaintenanceWindowStatusContentName") String managedMaintenanceWindowStatusContentName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/managedMaintenanceWindowStatusContents/{managedMaintenanceWindowStatusContentName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("managedMaintenanceWindowStatusContentName") String managedMaintenanceWindowStatusContentName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/managedMaintenanceWindowStatusContents/{managedMaintenanceWindowStatusContentName}") - @ExpectedResponses({ 200, 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("managedMaintenanceWindowStatusContentName") String managedMaintenanceWindowStatusContentName, - @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/managedMaintenanceWindowStatusContents/{managedMaintenanceWindowStatusContentName}") - @ExpectedResponses({ 200, 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("managedMaintenanceWindowStatusContentName") String managedMaintenanceWindowStatusContentName, - @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); - } - - /** - * Get a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedMaintenanceWindowStatusContent along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getByResourceGroupWithResponseAsync( - String resourceGroupName, String managedMaintenanceWindowStatusContentName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, managedMaintenanceWindowStatusContentName, accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedMaintenanceWindowStatusContent on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getByResourceGroupAsync(String resourceGroupName, - String managedMaintenanceWindowStatusContentName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, managedMaintenanceWindowStatusContentName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedMaintenanceWindowStatusContent along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, Context context) { - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, managedMaintenanceWindowStatusContentName, accept, - context); - } - - /** - * Get a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedMaintenanceWindowStatusContent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ManagedMaintenanceWindowStatusInner getByResourceGroup(String resourceGroupName, - String managedMaintenanceWindowStatusContentName) { - return getByResourceGroupWithResponse(resourceGroupName, managedMaintenanceWindowStatusContentName, - Context.NONE).getValue(); - } - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> deleteWithResponseAsync(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, - ifNoneMatch, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, - ifNoneMatch, Context.NONE); - } - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch, Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, - ifNoneMatch, context); - } - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, - managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); - } - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, - String managedMaintenanceWindowStatusContentName) { - final String ifMatch = null; - final String ifNoneMatch = null; - Mono>> mono = deleteWithResponseAsync(resourceGroupName, - managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); - } - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch) { - Response response - = deleteWithResponse(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch); - return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); - } - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, - String managedMaintenanceWindowStatusContentName) { - final String ifMatch = null; - final String ifNoneMatch = null; - Response response - = deleteWithResponse(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch); - return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); - } - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch, Context context) { - Response response = deleteWithResponse(resourceGroupName, managedMaintenanceWindowStatusContentName, - ifMatch, ifNoneMatch, context); - return this.client.getLroResult(response, Void.class, Void.class, context); - } - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String resourceGroupName, String managedMaintenanceWindowStatusContentName, - String ifMatch, String ifNoneMatch) { - return beginDeleteAsync(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String resourceGroupName, String managedMaintenanceWindowStatusContentName) { - final String ifMatch = null; - final String ifNoneMatch = null; - return beginDeleteAsync(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String managedMaintenanceWindowStatusContentName) { - final String ifMatch = null; - final String ifNoneMatch = null; - beginDelete(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch) - .getFinalResult(); - } - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String managedMaintenanceWindowStatusContentName, String ifMatch, - String ifNoneMatch, Context context) { - beginDelete(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch, context) - .getFinalResult(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsImpl.java deleted file mode 100644 index cb64f8316cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient; -import tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner; -import tsptest.armresourceprovider.models.ManagedMaintenanceWindowStatus; -import tsptest.armresourceprovider.models.ManagedMaintenanceWindowStatusOperations; - -public final class ManagedMaintenanceWindowStatusOperationsImpl implements ManagedMaintenanceWindowStatusOperations { - private static final ClientLogger LOGGER = new ClientLogger(ManagedMaintenanceWindowStatusOperationsImpl.class); - - private final ManagedMaintenanceWindowStatusOperationsClient innerClient; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public ManagedMaintenanceWindowStatusOperationsImpl(ManagedMaintenanceWindowStatusOperationsClient innerClient, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, Context context) { - Response inner = this.serviceClient() - .getByResourceGroupWithResponse(resourceGroupName, managedMaintenanceWindowStatusContentName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ManagedMaintenanceWindowStatusImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public ManagedMaintenanceWindowStatus getByResourceGroup(String resourceGroupName, - String managedMaintenanceWindowStatusContentName) { - ManagedMaintenanceWindowStatusInner inner - = this.serviceClient().getByResourceGroup(resourceGroupName, managedMaintenanceWindowStatusContentName); - if (inner != null) { - return new ManagedMaintenanceWindowStatusImpl(inner, this.manager()); - } else { - return null; - } - } - - public void deleteByResourceGroup(String resourceGroupName, String managedMaintenanceWindowStatusContentName) { - this.serviceClient().delete(resourceGroupName, managedMaintenanceWindowStatusContentName); - } - - public void delete(String resourceGroupName, String managedMaintenanceWindowStatusContentName, String ifMatch, - String ifNoneMatch, Context context) { - this.serviceClient() - .delete(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch, context); - } - - private ManagedMaintenanceWindowStatusOperationsClient serviceClient() { - return this.innerClient; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNameImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNameImpl.java deleted file mode 100644 index 61c4f54cade..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNameImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.management.SystemData; -import java.util.Collections; -import java.util.Map; -import tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner; -import tsptest.armresourceprovider.models.ModelInterfaceSameName; - -public final class ModelInterfaceSameNameImpl implements ModelInterfaceSameName { - private ModelInterfaceSameNameInner innerObject; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - ModelInterfaceSameNameImpl(ModelInterfaceSameNameInner innerObject, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public String provisioningState() { - return this.innerModel().provisioningState(); - } - - public ModelInterfaceSameNameInner innerModel() { - return this.innerObject; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesClientImpl.java deleted file mode 100644 index 46c239aac4a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesClientImpl.java +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient; -import tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner; - -/** - * An instance of this class provides access to all the operations defined in ModelInterfaceSameNamesClient. - */ -public final class ModelInterfaceSameNamesClientImpl implements ModelInterfaceSameNamesClient { - /** - * The proxy service used to perform REST calls. - */ - private final ModelInterfaceSameNamesService service; - - /** - * The service client containing this operation class. - */ - private final ArmClientImpl client; - - /** - * Initializes an instance of ModelInterfaceSameNamesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ModelInterfaceSameNamesClientImpl(ArmClientImpl client) { - this.service = RestProxy.create(ModelInterfaceSameNamesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmClientModelInterfaceSameNames to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmClientModelInterfaceSameNames") - public interface ModelInterfaceSameNamesService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/modelInterfaceDifferentNames/{modelInterfaceDifferentNameName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("modelInterfaceDifferentNameName") String modelInterfaceDifferentNameName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/modelInterfaceDifferentNames/{modelInterfaceDifferentNameName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("modelInterfaceDifferentNameName") String modelInterfaceDifferentNameName, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/modelInterfaceDifferentNames/{modelInterfaceDifferentNameName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("modelInterfaceDifferentNameName") String modelInterfaceDifferentNameName, - @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/modelInterfaceDifferentNames/{modelInterfaceDifferentNameName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("modelInterfaceDifferentNameName") String modelInterfaceDifferentNameName, - @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); - } - - /** - * Get a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ModelInterfaceDifferentName along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String modelInterfaceDifferentNameName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, modelInterfaceDifferentNameName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ModelInterfaceDifferentName on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getByResourceGroupAsync(String resourceGroupName, - String modelInterfaceDifferentNameName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, modelInterfaceDifferentNameName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ModelInterfaceDifferentName along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - String modelInterfaceDifferentNameName, Context context) { - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, modelInterfaceDifferentNameName, accept, context); - } - - /** - * Get a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ModelInterfaceDifferentName. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ModelInterfaceSameNameInner getByResourceGroup(String resourceGroupName, - String modelInterfaceDifferentNameName) { - return getByResourceGroupWithResponse(resourceGroupName, modelInterfaceDifferentNameName, Context.NONE) - .getValue(); - } - - /** - * Delete a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithResponseAsync(String resourceGroupName, - String modelInterfaceDifferentNameName, String ifMatch, String ifNoneMatch) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, modelInterfaceDifferentNameName, ifMatch, - ifNoneMatch, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String resourceGroupName, String modelInterfaceDifferentNameName) { - final String ifMatch = null; - final String ifNoneMatch = null; - return deleteWithResponseAsync(resourceGroupName, modelInterfaceDifferentNameName, ifMatch, ifNoneMatch) - .flatMap(ignored -> Mono.empty()); - } - - /** - * Delete a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceGroupName, String modelInterfaceDifferentNameName, - String ifMatch, String ifNoneMatch, Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, modelInterfaceDifferentNameName, ifMatch, ifNoneMatch, - context); - } - - /** - * Delete a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String modelInterfaceDifferentNameName) { - final String ifMatch = null; - final String ifNoneMatch = null; - deleteWithResponse(resourceGroupName, modelInterfaceDifferentNameName, ifMatch, ifNoneMatch, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesImpl.java deleted file mode 100644 index 3cbcc629c0d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient; -import tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner; -import tsptest.armresourceprovider.models.ModelInterfaceSameName; -import tsptest.armresourceprovider.models.ModelInterfaceSameNames; - -public final class ModelInterfaceSameNamesImpl implements ModelInterfaceSameNames { - private static final ClientLogger LOGGER = new ClientLogger(ModelInterfaceSameNamesImpl.class); - - private final ModelInterfaceSameNamesClient innerClient; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public ModelInterfaceSameNamesImpl(ModelInterfaceSameNamesClient innerClient, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, - String modelInterfaceDifferentNameName, Context context) { - Response inner = this.serviceClient() - .getByResourceGroupWithResponse(resourceGroupName, modelInterfaceDifferentNameName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ModelInterfaceSameNameImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public ModelInterfaceSameName getByResourceGroup(String resourceGroupName, String modelInterfaceDifferentNameName) { - ModelInterfaceSameNameInner inner - = this.serviceClient().getByResourceGroup(resourceGroupName, modelInterfaceDifferentNameName); - if (inner != null) { - return new ModelInterfaceSameNameImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteByResourceGroupWithResponse(String resourceGroupName, - String modelInterfaceDifferentNameName, String ifMatch, String ifNoneMatch, Context context) { - return this.serviceClient() - .deleteWithResponse(resourceGroupName, modelInterfaceDifferentNameName, ifMatch, ifNoneMatch, context); - } - - public void deleteByResourceGroup(String resourceGroupName, String modelInterfaceDifferentNameName) { - this.serviceClient().delete(resourceGroupName, modelInterfaceDifferentNameName); - } - - private ModelInterfaceSameNamesClient serviceClient() { - return this.innerClient; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationImpl.java deleted file mode 100644 index 705357dbc45..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import tsptest.armresourceprovider.fluent.models.OperationInner; -import tsptest.armresourceprovider.models.ActionType; -import tsptest.armresourceprovider.models.Operation; -import tsptest.armresourceprovider.models.OperationDisplay; -import tsptest.armresourceprovider.models.Origin; - -public final class OperationImpl implements Operation { - private OperationInner innerObject; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - OperationImpl(OperationInner innerObject, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String name() { - return this.innerModel().name(); - } - - public Boolean isDataAction() { - return this.innerModel().isDataAction(); - } - - public OperationDisplay display() { - return this.innerModel().display(); - } - - public Origin origin() { - return this.innerModel().origin(); - } - - public ActionType actionType() { - return this.innerModel().actionType(); - } - - public OperationInner innerModel() { - return this.innerObject; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsClientImpl.java deleted file mode 100644 index 5c8b56bb33d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsClientImpl.java +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -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.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.OperationsClient; -import tsptest.armresourceprovider.fluent.models.OperationInner; -import tsptest.armresourceprovider.implementation.models.OperationListResult; - -/** - * An instance of this class provides access to all the operations defined in OperationsClient. - */ -public final class OperationsClientImpl implements OperationsClient { - /** - * The proxy service used to perform REST calls. - */ - private final OperationsService service; - - /** - * The service client containing this operation class. - */ - private final ArmClientImpl client; - - /** - * Initializes an instance of OperationsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - OperationsClientImpl(ArmClientImpl client) { - this.service - = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmClientOperations to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmClientOperations") - public interface OperationsService { - @Headers({ "Content-Type: application/json" }) - @Get("/providers/TspTest.ArmResourceProvider/operations") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/providers/TspTest.ArmResourceProvider/operations") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); - } - - /** - * List the operations for the provider. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List the operations for the provider. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * List the operations for the provider. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage() { - final String accept = "application/json"; - Response res - = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List the operations for the provider. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(Context context) { - final String accept = "application/json"; - Response res - = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List the operations for the provider. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); - } - - /** - * List the operations for the provider. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listNextSinglePage(String nextLink, Context context) { - final String accept = "application/json"; - Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsImpl.java deleted file mode 100644 index f75ef034913..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armresourceprovider.fluent.OperationsClient; -import tsptest.armresourceprovider.fluent.models.OperationInner; -import tsptest.armresourceprovider.models.Operation; -import tsptest.armresourceprovider.models.Operations; - -public final class OperationsImpl implements Operations { - private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); - - private final OperationsClient innerClient; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public OperationsImpl(OperationsClient innerClient, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); - } - - private OperationsClient serviceClient() { - return this.innerClient; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResourceManagerUtils.java deleted file mode 100644 index 890033c5fbe..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResourceManagerUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -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.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class ResourceManagerUtils { - private ResourceManagerUtils() { - } - - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (!segments.isEmpty() && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl<>(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux - .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(iterable.iterator(), mapper); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResultImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResultImpl.java deleted file mode 100644 index 084bf6ca944..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResultImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import tsptest.armresourceprovider.fluent.models.ResultInner; -import tsptest.armresourceprovider.models.Result; - -public final class ResultImpl implements Result { - private ResultInner innerObject; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - ResultImpl(ResultInner innerObject, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String reason() { - return this.innerModel().reason(); - } - - public ResultInner innerModel() { - return this.innerObject; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java deleted file mode 100644 index deeec677d4c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java +++ /dev/null @@ -1,252 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.time.OffsetDateTime; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner; -import tsptest.armresourceprovider.models.ProvisioningState; -import tsptest.armresourceprovider.models.Result; -import tsptest.armresourceprovider.models.TopLevelArmResource; -import tsptest.armresourceprovider.models.TopLevelArmResourceUpdate; - -public final class TopLevelArmResourceImpl - implements TopLevelArmResource, TopLevelArmResource.Definition, TopLevelArmResource.Update { - private TopLevelArmResourceInner innerObject; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public List configurationEndpoints() { - List inner = this.innerModel().configurationEndpoints(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public String userName() { - return this.innerModel().userName(); - } - - public String userNames() { - return this.innerModel().userNames(); - } - - public String accuserName() { - return this.innerModel().accuserName(); - } - - public OffsetDateTime startTimeStamp() { - return this.innerModel().startTimeStamp(); - } - - public Float size() { - return this.innerModel().size(); - } - - public ProvisioningState provisioningState() { - return this.innerModel().provisioningState(); - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public String resourceGroupName() { - return resourceGroupName; - } - - public TopLevelArmResourceInner innerModel() { - return this.innerObject; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } - - private String resourceGroupName; - - private String topLevelArmResourceName; - - private TopLevelArmResourceUpdate updateProperties; - - public TopLevelArmResourceImpl withExistingResourceGroup(String resourceGroupName) { - this.resourceGroupName = resourceGroupName; - return this; - } - - public TopLevelArmResource create() { - this.innerObject = serviceManager.serviceClient() - .getTopLevelArmResourceInterfaces() - .createOrUpdate(resourceGroupName, topLevelArmResourceName, this.innerModel(), Context.NONE); - return this; - } - - public TopLevelArmResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTopLevelArmResourceInterfaces() - .createOrUpdate(resourceGroupName, topLevelArmResourceName, this.innerModel(), context); - return this; - } - - TopLevelArmResourceImpl(String name, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerObject = new TopLevelArmResourceInner(); - this.serviceManager = serviceManager; - this.topLevelArmResourceName = name; - } - - public TopLevelArmResourceImpl update() { - this.updateProperties = new TopLevelArmResourceUpdate(); - return this; - } - - public TopLevelArmResource apply() { - this.innerObject = serviceManager.serviceClient() - .getTopLevelArmResourceInterfaces() - .updateWithResponse(resourceGroupName, topLevelArmResourceName, updateProperties, Context.NONE) - .getValue(); - return this; - } - - public TopLevelArmResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTopLevelArmResourceInterfaces() - .updateWithResponse(resourceGroupName, topLevelArmResourceName, updateProperties, context) - .getValue(); - return this; - } - - TopLevelArmResourceImpl(TopLevelArmResourceInner innerObject, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.topLevelArmResourceName - = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "topLevelArmResources"); - } - - public TopLevelArmResource refresh() { - this.innerObject = serviceManager.serviceClient() - .getTopLevelArmResourceInterfaces() - .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourceName, Context.NONE) - .getValue(); - return this; - } - - public TopLevelArmResource refresh(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTopLevelArmResourceInterfaces() - .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourceName, context) - .getValue(); - return this; - } - - public Result action() { - return serviceManager.topLevelArmResourceInterfaces().action(resourceGroupName, topLevelArmResourceName); - } - - public Result action(Context context) { - return serviceManager.topLevelArmResourceInterfaces() - .action(resourceGroupName, topLevelArmResourceName, context); - } - - public TopLevelArmResourceImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); - return this; - } - - public TopLevelArmResourceImpl withRegion(String location) { - this.innerModel().withLocation(location); - return this; - } - - public TopLevelArmResourceImpl withTags(Map tags) { - if (isInCreateMode()) { - this.innerModel().withTags(tags); - return this; - } else { - this.updateProperties.withTags(tags); - return this; - } - } - - public TopLevelArmResourceImpl withUserName(String userName) { - if (isInCreateMode()) { - this.innerModel().withUserName(userName); - return this; - } else { - this.updateProperties.withUserName(userName); - return this; - } - } - - public TopLevelArmResourceImpl withUserNames(String userNames) { - if (isInCreateMode()) { - this.innerModel().withUserNames(userNames); - return this; - } else { - this.updateProperties.withUserNames(userNames); - return this; - } - } - - public TopLevelArmResourceImpl withAccuserName(String accuserName) { - if (isInCreateMode()) { - this.innerModel().withAccuserName(accuserName); - return this; - } else { - this.updateProperties.withAccuserName(accuserName); - return this; - } - } - - public TopLevelArmResourceImpl withStartTimeStamp(OffsetDateTime startTimeStamp) { - this.innerModel().withStartTimeStamp(startTimeStamp); - return this; - } - - private boolean isInCreateMode() { - return this.innerModel() == null || this.innerModel().id() == null; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java deleted file mode 100644 index 8b0b0a75bd5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java +++ /dev/null @@ -1,1207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient; -import tsptest.armresourceprovider.fluent.models.ResultInner; -import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner; -import tsptest.armresourceprovider.implementation.models.ResourceListResult; -import tsptest.armresourceprovider.models.TopLevelArmResourceUpdate; - -/** - * An instance of this class provides access to all the operations defined in TopLevelArmResourceInterfacesClient. - */ -public final class TopLevelArmResourceInterfacesClientImpl implements TopLevelArmResourceInterfacesClient { - /** - * The proxy service used to perform REST calls. - */ - private final TopLevelArmResourceInterfacesService service; - - /** - * The service client containing this operation class. - */ - private final ArmClientImpl client; - - /** - * Initializes an instance of TopLevelArmResourceInterfacesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - TopLevelArmResourceInterfacesClientImpl(ArmClientImpl client) { - this.service = RestProxy.create(TopLevelArmResourceInterfacesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmClientTopLevelArmResourceInterfaces to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmClientTopLevelArmResourceInterfaces") - public interface TopLevelArmResourceInterfacesService { - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") TopLevelArmResourceInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") TopLevelArmResourceInner resource, Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") TopLevelArmResourceUpdate properties, Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response updateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") TopLevelArmResourceUpdate properties, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") - @ExpectedResponses({ 200, 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") - @ExpectedResponses({ 200, 202, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/TspTest.ArmResourceProvider/topLevelArmResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/TspTest.ArmResourceProvider/topLevelArmResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/action") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> action(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/action") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response actionSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByResourceGroupNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listBySubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listBySubscriptionNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getByResourceGroupAsync(String resourceGroupName, - String topLevelArmResourceName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, topLevelArmResourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelArmResourceName, Context context) { - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, context); - } - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelArmResourceInner getByResourceGroup(String resourceGroupName, String topLevelArmResourceName) { - return getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourceName, Context.NONE).getValue(); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName, TopLevelArmResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, - resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceInner resource) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, resource, - Context.NONE); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceInner resource, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, resource, - context); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, TopLevelArmResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceInner resource) { - Mono>> mono - = createOrUpdateWithResponseAsync(resourceGroupName, topLevelArmResourceName, resource); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, - this.client.getContext()); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( - String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceInner resource) { - Response response - = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourceName, resource); - return this.client.getLroResult(response, - TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, Context.NONE); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( - String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceInner resource, Context context) { - Response response - = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourceName, resource, context); - return this.client.getLroResult(response, - TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, context); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateAsync(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceInner resource) { - return beginCreateOrUpdateAsync(resourceGroupName, topLevelArmResourceName, resource).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceInner resource) { - return beginCreateOrUpdate(resourceGroupName, topLevelArmResourceName, resource).getFinalResult(); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceInner resource, Context context) { - return beginCreateOrUpdate(resourceGroupName, topLevelArmResourceName, resource, context).getFinalResult(); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName, TopLevelArmResourceUpdate properties) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, - properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateAsync(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceUpdate properties) { - return updateWithResponseAsync(resourceGroupName, topLevelArmResourceName, properties) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(String resourceGroupName, - String topLevelArmResourceName, TopLevelArmResourceUpdate properties, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, - properties, context); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelArmResourceInner update(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceUpdate properties) { - return updateWithResponse(resourceGroupName, topLevelArmResourceName, properties, Context.NONE).getValue(); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> deleteWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceGroupName, String topLevelArmResourceName) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, Context.NONE); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response deleteWithResponse(String resourceGroupName, String topLevelArmResourceName, - Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, context); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, - String topLevelArmResourceName) { - Mono>> mono = deleteWithResponseAsync(resourceGroupName, topLevelArmResourceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName) { - Response response = deleteWithResponse(resourceGroupName, topLevelArmResourceName); - return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName, - Context context) { - Response response = deleteWithResponse(resourceGroupName, topLevelArmResourceName, context); - return this.client.getLroResult(response, Void.class, Void.class, context); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteAsync(String resourceGroupName, String topLevelArmResourceName) { - return beginDeleteAsync(resourceGroupName, topLevelArmResourceName).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String topLevelArmResourceName) { - beginDelete(resourceGroupName, topLevelArmResourceName).getFinalResult(); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String topLevelArmResourceName, Context context) { - beginDelete(resourceGroupName, topLevelArmResourceName, context).getFinalResult(); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { - final String accept = "application/json"; - Response res = service.listByResourceGroupSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, - Context context) { - final String accept = "application/json"; - Response res = service.listByResourceGroupSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName) { - return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePage(nextLink)); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage() { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(Context context) { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(() -> listSinglePage(context), - nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono>> actionWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.action(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response actionWithResponse(String resourceGroupName, String topLevelArmResourceName) { - final String accept = "application/json"; - return service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, Context.NONE); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response actionWithResponse(String resourceGroupName, String topLevelArmResourceName, - Context context) { - final String accept = "application/json"; - return service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, context); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux, ResultInner> beginActionAsync(String resourceGroupName, - String topLevelArmResourceName) { - Mono>> mono = actionWithResponseAsync(resourceGroupName, topLevelArmResourceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - ResultInner.class, ResultInner.class, this.client.getContext()); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ResultInner> beginAction(String resourceGroupName, - String topLevelArmResourceName) { - Response response = actionWithResponse(resourceGroupName, topLevelArmResourceName); - return this.client.getLroResult(response, ResultInner.class, ResultInner.class, - Context.NONE); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, ResultInner> beginAction(String resourceGroupName, - String topLevelArmResourceName, Context context) { - Response response = actionWithResponse(resourceGroupName, topLevelArmResourceName, context); - return this.client.getLroResult(response, ResultInner.class, ResultInner.class, - context); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono actionAsync(String resourceGroupName, String topLevelArmResourceName) { - return beginActionAsync(resourceGroupName, topLevelArmResourceName).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 ResultInner action(String resourceGroupName, String topLevelArmResourceName) { - return beginAction(resourceGroupName, topLevelArmResourceName).getFinalResult(); - } - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 ResultInner action(String resourceGroupName, String topLevelArmResourceName, Context context) { - return beginAction(resourceGroupName, topLevelArmResourceName, context).getFinalResult(); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupNextSinglePage(String nextLink, - Context context) { - final String accept = "application/json"; - Response res - = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { - final String accept = "application/json"; - Response res - = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesImpl.java deleted file mode 100644 index c99dec91786..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesImpl.java +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient; -import tsptest.armresourceprovider.fluent.models.ResultInner; -import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner; -import tsptest.armresourceprovider.models.Result; -import tsptest.armresourceprovider.models.TopLevelArmResource; -import tsptest.armresourceprovider.models.TopLevelArmResourceInterfaces; - -public final class TopLevelArmResourceInterfacesImpl implements TopLevelArmResourceInterfaces { - private static final ClientLogger LOGGER = new ClientLogger(TopLevelArmResourceInterfacesImpl.class); - - private final TopLevelArmResourceInterfacesClient innerClient; - - private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; - - public TopLevelArmResourceInterfacesImpl(TopLevelArmResourceInterfacesClient innerClient, - tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelArmResourceName, Context context) { - Response inner - = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourceName, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new TopLevelArmResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public TopLevelArmResource getByResourceGroup(String resourceGroupName, String topLevelArmResourceName) { - TopLevelArmResourceInner inner - = this.serviceClient().getByResourceGroup(resourceGroupName, topLevelArmResourceName); - if (inner != null) { - return new TopLevelArmResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public void deleteByResourceGroup(String resourceGroupName, String topLevelArmResourceName) { - this.serviceClient().delete(resourceGroupName, topLevelArmResourceName); - } - - public void delete(String resourceGroupName, String topLevelArmResourceName, Context context) { - this.serviceClient().delete(resourceGroupName, topLevelArmResourceName, context); - } - - public PagedIterable listByResourceGroup(String resourceGroupName) { - PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); - } - - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); - } - - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); - } - - public Result action(String resourceGroupName, String topLevelArmResourceName) { - ResultInner inner = this.serviceClient().action(resourceGroupName, topLevelArmResourceName); - if (inner != null) { - return new ResultImpl(inner, this.manager()); - } else { - return null; - } - } - - public Result action(String resourceGroupName, String topLevelArmResourceName, Context context) { - ResultInner inner = this.serviceClient().action(resourceGroupName, topLevelArmResourceName, context); - if (inner != null) { - return new ResultImpl(inner, this.manager()); - } else { - return null; - } - } - - public TopLevelArmResource getById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourceName, Context.NONE).getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourceName, context); - } - - public void deleteById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - this.delete(resourceGroupName, topLevelArmResourceName, Context.NONE); - } - - public void deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourceName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - this.delete(resourceGroupName, topLevelArmResourceName, context); - } - - private TopLevelArmResourceInterfacesClient serviceClient() { - return this.innerClient; - } - - private tsptest.armresourceprovider.ArmResourceProviderManager manager() { - return this.serviceManager; - } - - public TopLevelArmResourceImpl define(String name) { - return new TopLevelArmResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildExtensionResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildExtensionResourceListResult.java deleted file mode 100644 index 0f40c434af0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildExtensionResourceListResult.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner; - -/** - * The response of a ChildExtensionResource list operation. - */ -@Immutable -public final class ChildExtensionResourceListResult implements JsonSerializable { - /* - * The ChildExtensionResource items on this page - */ - private List value; - - /* - * The link to the next page of items - */ - private String nextLink; - - /** - * Creates an instance of ChildExtensionResourceListResult class. - */ - private ChildExtensionResourceListResult() { - } - - /** - * Get the value property: The ChildExtensionResource items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChildExtensionResourceListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChildExtensionResourceListResult if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ChildExtensionResourceListResult. - */ - public static ChildExtensionResourceListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ChildExtensionResourceListResult deserializedChildExtensionResourceListResult - = new ChildExtensionResourceListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> ChildExtensionResourceInner.fromJson(reader1)); - deserializedChildExtensionResourceListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedChildExtensionResourceListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedChildExtensionResourceListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildResourceListResult.java deleted file mode 100644 index 3eb5aff1c89..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildResourceListResult.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import tsptest.armresourceprovider.fluent.models.ChildResourceInner; - -/** - * Paged collection of ChildResource items. - */ -@Immutable -public final class ChildResourceListResult implements JsonSerializable { - /* - * The ChildResource items on this page - */ - private List value; - - /* - * The link to the next page of items - */ - private String nextLink; - - /** - * Creates an instance of ChildResourceListResult class. - */ - private ChildResourceListResult() { - } - - /** - * Get the value property: The ChildResource items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChildResourceListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChildResourceListResult if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ChildResourceListResult. - */ - public static ChildResourceListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ChildResourceListResult deserializedChildResourceListResult = new ChildResourceListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value = reader.readArray(reader1 -> ChildResourceInner.fromJson(reader1)); - deserializedChildResourceListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedChildResourceListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedChildResourceListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/OperationListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/OperationListResult.java deleted file mode 100644 index 84afbfc9caa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/OperationListResult.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import tsptest.armresourceprovider.fluent.models.OperationInner; - -/** - * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of - * results. - */ -@Immutable -public final class OperationListResult implements JsonSerializable { - /* - * The Operation items on this page - */ - private List value; - - /* - * The link to the next page of items - */ - private String nextLink; - - /** - * Creates an instance of OperationListResult class. - */ - private OperationListResult() { - } - - /** - * Get the value property: The Operation items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OperationListResult. - */ - public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationListResult deserializedOperationListResult = new OperationListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); - deserializedOperationListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedOperationListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOperationListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ResourceListResult.java deleted file mode 100644 index 542c500c575..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ResourceListResult.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.implementation.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner; - -/** - * The response of a TopLevelArmResource list operation. - */ -@Immutable -public final class ResourceListResult implements JsonSerializable { - /* - * The TopLevelArmResource items on this page - */ - private List value; - - /* - * The link to the next page of items - */ - private String nextLink; - - /** - * Creates an instance of ResourceListResult class. - */ - private ResourceListResult() { - } - - /** - * Get the value property: The TopLevelArmResource items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourceListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourceListResult if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResourceListResult. - */ - public static ResourceListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ResourceListResult deserializedResourceListResult = new ResourceListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> TopLevelArmResourceInner.fromJson(reader1)); - deserializedResourceListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedResourceListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedResourceListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/package-info.java deleted file mode 100644 index 20861efd68a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the implementations for ArmResourceProvider. - * Arm Resource Provider management API. - */ -package tsptest.armresourceprovider.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionFinalResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionFinalResult.java deleted file mode 100644 index 270046ccb13..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionFinalResult.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ActionFinalResult model. - */ -@Immutable -public final class ActionFinalResult implements JsonSerializable { - /* - * The result property. - */ - private String result; - - /** - * Creates an instance of ActionFinalResult class. - */ - private ActionFinalResult() { - } - - /** - * Get the result property: The result property. - * - * @return the result value. - */ - public String result() { - return this.result; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("result", this.result); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ActionFinalResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ActionFinalResult if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ActionFinalResult. - */ - public static ActionFinalResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ActionFinalResult deserializedActionFinalResult = new ActionFinalResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("result".equals(fieldName)) { - deserializedActionFinalResult.result = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedActionFinalResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionType.java deleted file mode 100644 index 70c3869422e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionType.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - */ -public final class ActionType extends ExpandableStringEnum { - /** - * Actions are for internal-only APIs. - */ - public static final ActionType INTERNAL = fromString("Internal"); - - /** - * Creates a new instance of ActionType value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ActionType() { - } - - /** - * Creates or finds a ActionType from its string representation. - * - * @param name a name to look for. - * @return the corresponding ActionType. - */ - public static ActionType fromString(String name) { - return fromString(name, ActionType.class); - } - - /** - * Gets known ActionType values. - * - * @return known ActionType values. - */ - public static Collection values() { - return values(ActionType.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/AnonymousEmptyModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/AnonymousEmptyModel.java deleted file mode 100644 index cc38ccbb83e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/AnonymousEmptyModel.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The AnonymousEmptyModel model. - */ -@Immutable -public final class AnonymousEmptyModel implements JsonSerializable { - /** - * Creates an instance of AnonymousEmptyModel class. - */ - public AnonymousEmptyModel() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AnonymousEmptyModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AnonymousEmptyModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the AnonymousEmptyModel. - */ - public static AnonymousEmptyModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - AnonymousEmptyModel deserializedAnonymousEmptyModel = new AnonymousEmptyModel(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedAnonymousEmptyModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResource.java deleted file mode 100644 index 43f0d651a18..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResource.java +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner; - -/** - * An immutable client-side representation of ChildExtensionResource. - */ -public interface ChildExtensionResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - ChildExtensionResourceProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the inner tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner object. - * - * @return the inner object. - */ - ChildExtensionResourceInner innerModel(); - - /** - * The entirety of the ChildExtensionResource definition. - */ - interface Definition - extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { - } - - /** - * The ChildExtensionResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the ChildExtensionResource definition. - */ - interface Blank extends WithParentResource { - } - - /** - * The stage of the ChildExtensionResource definition allowing to specify parent resource. - */ - interface WithParentResource { - /** - * Specifies resourceUri, topLevelArmResourceName. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @return the next definition stage. - */ - WithCreate withExistingTopLevelArmResource(String resourceUri, String topLevelArmResourceName); - } - - /** - * The stage of the ChildExtensionResource definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithProperties { - /** - * Executes the create request. - * - * @return the created resource. - */ - ChildExtensionResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - ChildExtensionResource create(Context context); - } - - /** - * The stage of the ChildExtensionResource definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(ChildExtensionResourceProperties properties); - } - } - - /** - * Begins update for the ChildExtensionResource resource. - * - * @return the stage of resource update. - */ - ChildExtensionResource.Update update(); - - /** - * The template for ChildExtensionResource update. - */ - interface Update { - /** - * Executes the update request. - * - * @return the updated resource. - */ - ChildExtensionResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - ChildExtensionResource apply(Context context); - } - - /** - * The ChildExtensionResource update stages. - */ - interface UpdateStages { - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - ChildExtensionResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - ChildExtensionResource refresh(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceInterfaces.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceInterfaces.java deleted file mode 100644 index 92af6f00663..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceInterfaces.java +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of ChildExtensionResourceInterfaces. - */ -public interface ChildExtensionResourceInterfaces { - /** - * Get a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildExtensionResource along with {@link Response}. - */ - Response getWithResponse(String resourceUri, String topLevelArmResourceName, - String childExtensionResourceName, Context context); - - /** - * Get a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildExtensionResource. - */ - ChildExtensionResource get(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName); - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName); - - /** - * Delete a ChildExtensionResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param childExtensionResourceName ChildExtensionResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, Context context); - - /** - * List ChildExtensionResource resources by TopLevelArmResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByTopLevelArmResource(String resourceUri, String topLevelArmResourceName); - - /** - * List ChildExtensionResource resources by TopLevelArmResource. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByTopLevelArmResource(String resourceUri, String topLevelArmResourceName, - Context context); - - /** - * Get a ChildExtensionResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildExtensionResource along with {@link Response}. - */ - ChildExtensionResource getById(String id); - - /** - * Get a ChildExtensionResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildExtensionResource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Delete a ChildExtensionResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a ChildExtensionResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new ChildExtensionResource resource. - * - * @param name resource name. - * @return the first stage of the new ChildExtensionResource definition. - */ - ChildExtensionResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceProperties.java deleted file mode 100644 index 43790631d91..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceProperties.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Child ExtensionResource properties. - */ -@Immutable -public final class ChildExtensionResourceProperties implements JsonSerializable { - /* - * Provisioning State of the Resource - */ - private ProvisioningState provisioningState; - - /** - * Creates an instance of ChildExtensionResourceProperties class. - */ - public ChildExtensionResourceProperties() { - } - - /** - * Get the provisioningState property: Provisioning State of the Resource. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChildExtensionResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChildExtensionResourceProperties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the ChildExtensionResourceProperties. - */ - public static ChildExtensionResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ChildExtensionResourceProperties deserializedChildExtensionResourceProperties - = new ChildExtensionResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedChildExtensionResourceProperties.provisioningState - = ProvisioningState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedChildExtensionResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceUpdate.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceUpdate.java deleted file mode 100644 index 543118d97c5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceUpdate.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The type used for update operations of the ChildExtensionResource. - */ -@Immutable -public final class ChildExtensionResourceUpdate implements JsonSerializable { - /** - * Creates an instance of ChildExtensionResourceUpdate class. - */ - public ChildExtensionResourceUpdate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChildExtensionResourceUpdate from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChildExtensionResourceUpdate if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the ChildExtensionResourceUpdate. - */ - public static ChildExtensionResourceUpdate fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ChildExtensionResourceUpdate deserializedChildExtensionResourceUpdate = new ChildExtensionResourceUpdate(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedChildExtensionResourceUpdate; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResource.java deleted file mode 100644 index 5269e4cfd32..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResource.java +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Map; -import tsptest.armresourceprovider.fluent.models.ChildResourceInner; - -/** - * An immutable client-side representation of ChildResource. - */ -public interface ChildResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the provisioningState property: Provisioning State of Top Level Arm Resource. - * - * @return the provisioningState value. - */ - ProvisioningState provisioningState(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the name of the resource group. - * - * @return the name of the resource group. - */ - String resourceGroupName(); - - /** - * Gets the inner tsptest.armresourceprovider.fluent.models.ChildResourceInner object. - * - * @return the inner object. - */ - ChildResourceInner innerModel(); - - /** - * The entirety of the ChildResource definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithParentResource, DefinitionStages.WithCreate { - } - - /** - * The ChildResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the ChildResource definition. - */ - interface Blank extends WithLocation { - } - - /** - * The stage of the ChildResource definition allowing to specify location. - */ - interface WithLocation { - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithParentResource withRegion(Region location); - - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithParentResource withRegion(String location); - } - - /** - * The stage of the ChildResource definition allowing to specify parent resource. - */ - interface WithParentResource { - /** - * Specifies resourceGroupName, topLevelArmResourceName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @return the next definition stage. - */ - WithCreate withExistingTopLevelArmResource(String resourceGroupName, String topLevelArmResourceName); - } - - /** - * The stage of the ChildResource definition which contains all the minimum required properties for the resource - * to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithTags { - /** - * Executes the create request. - * - * @return the created resource. - */ - ChildResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - ChildResource create(Context context); - } - - /** - * The stage of the ChildResource definition allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - WithCreate withTags(Map tags); - } - } - - /** - * Begins update for the ChildResource resource. - * - * @return the stage of resource update. - */ - ChildResource.Update update(); - - /** - * The template for ChildResource update. - */ - interface Update extends UpdateStages.WithTags { - /** - * Executes the update request. - * - * @return the updated resource. - */ - ChildResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - ChildResource apply(Context context); - } - - /** - * The ChildResource update stages. - */ - interface UpdateStages { - /** - * The stage of the ChildResource update allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - Update withTags(Map tags); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - ChildResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - ChildResource refresh(Context context); - - /** - * A long-running resource action. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void actionWithoutBody(); - - /** - * A long-running resource action. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void actionWithoutBody(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourceUpdate.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourceUpdate.java deleted file mode 100644 index bf38b0ae48a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourceUpdate.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * The type used for update operations of the ChildResource. - */ -@Fluent -public final class ChildResourceUpdate implements JsonSerializable { - /* - * Resource tags. - */ - private Map tags; - - /** - * Creates an instance of ChildResourceUpdate class. - */ - public ChildResourceUpdate() { - } - - /** - * Get the tags property: Resource tags. - * - * @return the tags value. - */ - public Map tags() { - return this.tags; - } - - /** - * Set the tags property: Resource tags. - * - * @param tags the tags value to set. - * @return the ChildResourceUpdate object itself. - */ - public ChildResourceUpdate withTags(Map tags) { - this.tags = tags; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChildResourceUpdate from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChildResourceUpdate if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the ChildResourceUpdate. - */ - public static ChildResourceUpdate fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ChildResourceUpdate deserializedChildResourceUpdate = new ChildResourceUpdate(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedChildResourceUpdate.tags = tags; - } else { - reader.skipChildren(); - } - } - - return deserializedChildResourceUpdate; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourcesInterfaces.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourcesInterfaces.java deleted file mode 100644 index 94c1bca4435..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourcesInterfaces.java +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of ChildResourcesInterfaces. - */ -public interface ChildResourcesInterfaces { - /** - * Get a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildResource along with {@link Response}. - */ - Response getWithResponse(String resourceGroupName, String topLevelArmResourceName, - String childResourceName, Context context); - - /** - * Get a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildResource. - */ - ChildResource get(String resourceGroupName, String topLevelArmResourceName, String childResourceName); - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName); - - /** - * Delete a ChildResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName, Context context); - - /** - * List ChildResource resources by TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items as paginated response with {@link PagedIterable}. - */ - PagedIterable listByTopLevelArmResource(String resourceGroupName, String topLevelArmResourceName); - - /** - * List ChildResource resources by TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ChildResource items as paginated response with {@link PagedIterable}. - */ - PagedIterable listByTopLevelArmResource(String resourceGroupName, String topLevelArmResourceName, - Context context); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param childResourceName ChildResources. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName, - Context context); - - /** - * Get a ChildResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildResource along with {@link Response}. - */ - ChildResource getById(String id); - - /** - * Get a ChildResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ChildResource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Delete a ChildResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a ChildResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new ChildResource resource. - * - * @param name resource name. - * @return the first stage of the new ChildResource definition. - */ - ChildResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResource.java deleted file mode 100644 index 968d96b2bf4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResource.java +++ /dev/null @@ -1,352 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Map; -import tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner; - -/** - * An immutable client-side representation of CustomTemplateResource. - */ -public interface CustomTemplateResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the identity property: Managed identity. - * - * @return the identity value. - */ - ManagedServiceIdentity identity(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - ProvisioningState provisioningState(); - - /** - * Gets the dog property: The dog property. - * - * @return the dog value. - */ - Dog dog(); - - /** - * Gets the namedEmptyModel property: The namedEmptyModel property. - * - * @return the namedEmptyModel value. - */ - EmptyModel namedEmptyModel(); - - /** - * Gets the anonymousEmptyModel property: The anonymousEmptyModel property. - * - * @return the anonymousEmptyModel value. - */ - AnonymousEmptyModel anonymousEmptyModel(); - - /** - * Gets the priority property: The priority property. - * - * @return the priority value. - */ - PriorityModel priority(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the name of the resource group. - * - * @return the name of the resource group. - */ - String resourceGroupName(); - - /** - * Gets the inner tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner object. - * - * @return the inner object. - */ - CustomTemplateResourceInner innerModel(); - - /** - * The entirety of the CustomTemplateResource definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { - } - - /** - * The CustomTemplateResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the CustomTemplateResource definition. - */ - interface Blank extends WithLocation { - } - - /** - * The stage of the CustomTemplateResource definition allowing to specify location. - */ - interface WithLocation { - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(Region location); - - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(String location); - } - - /** - * The stage of the CustomTemplateResource definition allowing to specify parent resource. - */ - interface WithResourceGroup { - /** - * Specifies resourceGroupName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @return the next definition stage. - */ - WithCreate withExistingResourceGroup(String resourceGroupName); - } - - /** - * The stage of the CustomTemplateResource definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithDog, - DefinitionStages.WithNamedEmptyModel, DefinitionStages.WithAnonymousEmptyModel, - DefinitionStages.WithPriority, DefinitionStages.WithIfMatch, DefinitionStages.WithIfNoneMatch { - /** - * Executes the create request. - * - * @return the created resource. - */ - CustomTemplateResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - CustomTemplateResource create(Context context); - } - - /** - * The stage of the CustomTemplateResource definition allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - WithCreate withTags(Map tags); - } - - /** - * The stage of the CustomTemplateResource definition allowing to specify identity. - */ - interface WithIdentity { - /** - * Specifies the identity property: Managed identity.. - * - * @param identity Managed identity. - * @return the next definition stage. - */ - WithCreate withIdentity(ManagedServiceIdentity identity); - } - - /** - * The stage of the CustomTemplateResource definition allowing to specify dog. - */ - interface WithDog { - /** - * Specifies the dog property: The dog property.. - * - * @param dog The dog property. - * @return the next definition stage. - */ - WithCreate withDog(Dog dog); - } - - /** - * The stage of the CustomTemplateResource definition allowing to specify namedEmptyModel. - */ - interface WithNamedEmptyModel { - /** - * Specifies the namedEmptyModel property: The namedEmptyModel property.. - * - * @param namedEmptyModel The namedEmptyModel property. - * @return the next definition stage. - */ - WithCreate withNamedEmptyModel(EmptyModel namedEmptyModel); - } - - /** - * The stage of the CustomTemplateResource definition allowing to specify anonymousEmptyModel. - */ - interface WithAnonymousEmptyModel { - /** - * Specifies the anonymousEmptyModel property: The anonymousEmptyModel property.. - * - * @param anonymousEmptyModel The anonymousEmptyModel property. - * @return the next definition stage. - */ - WithCreate withAnonymousEmptyModel(AnonymousEmptyModel anonymousEmptyModel); - } - - /** - * The stage of the CustomTemplateResource definition allowing to specify priority. - */ - interface WithPriority { - /** - * Specifies the priority property: The priority property.. - * - * @param priority The priority property. - * @return the next definition stage. - */ - WithCreate withPriority(PriorityModel priority); - } - - /** - * The stage of the CustomTemplateResource definition allowing to specify ifMatch. - */ - interface WithIfMatch { - /** - * Specifies the ifMatch property: The request should only proceed if an entity matches this string.. - * - * @param ifMatch The request should only proceed if an entity matches this string. - * @return the next definition stage. - */ - WithCreate withIfMatch(String ifMatch); - } - - /** - * The stage of the CustomTemplateResource definition allowing to specify ifNoneMatch. - */ - interface WithIfNoneMatch { - /** - * Specifies the ifNoneMatch property: The request should only proceed if no entity matches this string.. - * - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @return the next definition stage. - */ - WithCreate withIfNoneMatch(String ifNoneMatch); - } - } - - /** - * Begins update for the CustomTemplateResource resource. - * - * @return the stage of resource update. - */ - CustomTemplateResource.Update update(); - - /** - * The template for CustomTemplateResource update. - */ - interface Update extends UpdateStages.WithIdentity { - /** - * Executes the update request. - * - * @return the updated resource. - */ - CustomTemplateResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - CustomTemplateResource apply(Context context); - } - - /** - * The CustomTemplateResource update stages. - */ - interface UpdateStages { - /** - * The stage of the CustomTemplateResource update allowing to specify identity. - */ - interface WithIdentity { - /** - * Specifies the identity property: Managed identity.. - * - * @param identity Managed identity. - * @return the next definition stage. - */ - Update withIdentity(ManagedServiceIdentity identity); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourceInterfaces.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourceInterfaces.java deleted file mode 100644 index 9862d6d4804..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourceInterfaces.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -/** - * Resource collection API of CustomTemplateResourceInterfaces. - */ -public interface CustomTemplateResourceInterfaces { - /** - * Begins definition for a new CustomTemplateResource resource. - * - * @param name resource name. - * @return the first stage of the new CustomTemplateResource definition. - */ - CustomTemplateResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourcePatch.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourcePatch.java deleted file mode 100644 index 16287387f2d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourcePatch.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The CustomTemplateResourcePatch model. - */ -@Fluent -public final class CustomTemplateResourcePatch implements JsonSerializable { - /* - * Managed identity. - */ - private ManagedServiceIdentity identity; - - /** - * Creates an instance of CustomTemplateResourcePatch class. - */ - public CustomTemplateResourcePatch() { - } - - /** - * Get the identity property: Managed identity. - * - * @return the identity value. - */ - public ManagedServiceIdentity identity() { - return this.identity; - } - - /** - * Set the identity property: Managed identity. - * - * @param identity the identity value to set. - * @return the CustomTemplateResourcePatch object itself. - */ - public CustomTemplateResourcePatch withIdentity(ManagedServiceIdentity identity) { - this.identity = identity; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("identity", this.identity); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CustomTemplateResourcePatch from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CustomTemplateResourcePatch if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the CustomTemplateResourcePatch. - */ - public static CustomTemplateResourcePatch fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CustomTemplateResourcePatch deserializedCustomTemplateResourcePatch = new CustomTemplateResourcePatch(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("identity".equals(fieldName)) { - deserializedCustomTemplateResourcePatch.identity = ManagedServiceIdentity.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedCustomTemplateResourcePatch; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Dog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Dog.java deleted file mode 100644 index feed3d9d7a1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Dog.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Test extensible enum type for discriminator. - */ -@Fluent -public class Dog implements JsonSerializable { - /* - * discriminator property - */ - private DogKind kind = DogKind.fromString("Dog"); - - /* - * Weight of the dog - */ - private int weight; - - /** - * Creates an instance of Dog class. - */ - public Dog() { - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - public DogKind kind() { - return this.kind; - } - - /** - * Get the weight property: Weight of the dog. - * - * @return the weight value. - */ - public int weight() { - return this.weight; - } - - /** - * Set the weight property: Weight of the dog. - * - * @param weight the weight value to set. - * @return the Dog object itself. - */ - public Dog withWeight(int weight) { - this.weight = weight; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("weight", this.weight); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Dog from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Dog if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Dog. - */ - public static Dog fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("golden_dog".equals(discriminatorValue)) { - return Golden.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - static Dog fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Dog deserializedDog = new Dog(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("weight".equals(fieldName)) { - deserializedDog.weight = reader.getInt(); - } else if ("kind".equals(fieldName)) { - deserializedDog.kind = DogKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedDog; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/DogKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/DogKind.java deleted file mode 100644 index c762c08474f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/DogKind.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * extensible enum type for discriminator. - */ -public final class DogKind extends ExpandableStringEnum { - /** - * Species golden. - */ - public static final DogKind GOLDEN = fromString("golden_dog"); - - /** - * Creates a new instance of DogKind value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public DogKind() { - } - - /** - * Creates or finds a DogKind from its string representation. - * - * @param name a name to look for. - * @return the corresponding DogKind. - */ - public static DogKind fromString(String name) { - return fromString(name, DogKind.class); - } - - /** - * Gets known DogKind values. - * - * @return known DogKind values. - */ - public static Collection values() { - return values(DogKind.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/EmptyModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/EmptyModel.java deleted file mode 100644 index afdf6e995d5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/EmptyModel.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Empty model. - */ -@Immutable -public final class EmptyModel implements JsonSerializable { - /** - * Creates an instance of EmptyModel class. - */ - public EmptyModel() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of EmptyModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of EmptyModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IOException If an error occurs while reading the EmptyModel. - */ - public static EmptyModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - EmptyModel deserializedEmptyModel = new EmptyModel(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedEmptyModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Golden.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Golden.java deleted file mode 100644 index c2bc92e4787..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Golden.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Golden dog model. - */ -@Fluent -public final class Golden extends Dog { - /* - * discriminator property - */ - private DogKind kind = DogKind.GOLDEN; - - /** - * Creates an instance of Golden class. - */ - public Golden() { - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - @Override - public DogKind kind() { - return this.kind; - } - - /** - * {@inheritDoc} - */ - @Override - public Golden withWeight(int weight) { - super.withWeight(weight); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("weight", weight()); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Golden from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Golden if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Golden. - */ - public static Golden fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Golden deserializedGolden = new Golden(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("weight".equals(fieldName)) { - deserializedGolden.withWeight(reader.getInt()); - } else if ("kind".equals(fieldName)) { - deserializedGolden.kind = DogKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedGolden; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ImmutableResourceModels.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ImmutableResourceModels.java deleted file mode 100644 index 522f79c6f9b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ImmutableResourceModels.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.util.Context; - -/** - * Resource collection API of ImmutableResourceModels. - */ -public interface ImmutableResourceModels { - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName); - - /** - * The createOrUpdate operation. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param configurationName The name of the NginxConfigurationResponse. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete proxy resource types can be created by aliasing this type using a specific property type. - */ - NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName, - NginxConfigurationRequest properties, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/LroNoBodies.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/LroNoBodies.java deleted file mode 100644 index 68f73d0a5e5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/LroNoBodies.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.util.Context; - -/** - * Resource collection API of LroNoBodies. - */ -public interface LroNoBodies { - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, - ResourceLroNoBody resource); - - /** - * Create a ResourceLroNoBody. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param resource Resource create parameters. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, ResourceLroNoBody resource, - Context context); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceLroNoBodyName The name of the ResourceLroNoBody. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatus.java deleted file mode 100644 index 0c69e0e2840..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatus.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.management.SystemData; -import java.util.Map; -import tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner; - -/** - * An immutable client-side representation of ManagedMaintenanceWindowStatus. - */ -public interface ManagedMaintenanceWindowStatus { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - String provisioningState(); - - /** - * Gets the inner tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner object. - * - * @return the inner object. - */ - ManagedMaintenanceWindowStatusInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatusOperations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatusOperations.java deleted file mode 100644 index 17a7a798126..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatusOperations.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of ManagedMaintenanceWindowStatusOperations. - */ -public interface ManagedMaintenanceWindowStatusOperations { - /** - * Get a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedMaintenanceWindowStatusContent along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, - String managedMaintenanceWindowStatusContentName, Context context); - - /** - * Get a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ManagedMaintenanceWindowStatusContent. - */ - ManagedMaintenanceWindowStatus getByResourceGroup(String resourceGroupName, - String managedMaintenanceWindowStatusContentName); - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String resourceGroupName, String managedMaintenanceWindowStatusContentName); - - /** - * Delete a ManagedMaintenanceWindowStatusContent. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceGroupName, String managedMaintenanceWindowStatusContentName, String ifMatch, - String ifNoneMatch, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentity.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentity.java deleted file mode 100644 index 2796db12170..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentity.java +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; -import java.util.UUID; - -/** - * Managed service identity (system assigned and/or user assigned identities). - */ -@Fluent -public final class ManagedServiceIdentity implements JsonSerializable { - /* - * The service principal ID of the system assigned identity. This property will only be provided for a system - * assigned identity. - */ - private UUID principalId; - - /* - * The tenant ID of the system assigned identity. This property will only be provided for a system assigned - * identity. - */ - private UUID tenantId; - - /* - * The type of managed identity assigned to this resource. - */ - private ManagedServiceIdentityType type; - - /* - * The identities assigned to this resource by the user. - */ - private Map userAssignedIdentities; - - /** - * Creates an instance of ManagedServiceIdentity class. - */ - public ManagedServiceIdentity() { - } - - /** - * Get the principalId property: The service principal ID of the system assigned identity. This property will only - * be provided for a system assigned identity. - * - * @return the principalId value. - */ - public UUID principalId() { - return this.principalId; - } - - /** - * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for - * a system assigned identity. - * - * @return the tenantId value. - */ - public UUID tenantId() { - return this.tenantId; - } - - /** - * Get the type property: The type of managed identity assigned to this resource. - * - * @return the type value. - */ - public ManagedServiceIdentityType type() { - return this.type; - } - - /** - * Set the type property: The type of managed identity assigned to this resource. - * - * @param type the type value to set. - * @return the ManagedServiceIdentity object itself. - */ - public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { - this.type = type; - return this; - } - - /** - * Get the userAssignedIdentities property: The identities assigned to this resource by the user. - * - * @return the userAssignedIdentities value. - */ - public Map userAssignedIdentities() { - return this.userAssignedIdentities; - } - - /** - * Set the userAssignedIdentities property: The identities assigned to this resource by the user. - * - * @param userAssignedIdentities the userAssignedIdentities value to set. - * @return the ManagedServiceIdentity object itself. - */ - public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { - this.userAssignedIdentities = userAssignedIdentities; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); - jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, - (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ManagedServiceIdentity from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ManagedServiceIdentity. - */ - public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("type".equals(fieldName)) { - deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); - } else if ("principalId".equals(fieldName)) { - deserializedManagedServiceIdentity.principalId - = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); - } else if ("tenantId".equals(fieldName)) { - deserializedManagedServiceIdentity.tenantId - = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); - } else if ("userAssignedIdentities".equals(fieldName)) { - Map userAssignedIdentities - = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); - deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; - } else { - reader.skipChildren(); - } - } - - return deserializedManagedServiceIdentity; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentityType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentityType.java deleted file mode 100644 index 3bccba4b269..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentityType.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). - */ -public final class ManagedServiceIdentityType extends ExpandableStringEnum { - /** - * No managed identity. - */ - public static final ManagedServiceIdentityType NONE = fromString("None"); - - /** - * System assigned managed identity. - */ - public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); - - /** - * User assigned managed identity. - */ - public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); - - /** - * System and user assigned managed identity. - */ - public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED - = fromString("SystemAssigned,UserAssigned"); - - /** - * Creates a new instance of ManagedServiceIdentityType value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ManagedServiceIdentityType() { - } - - /** - * Creates or finds a ManagedServiceIdentityType from its string representation. - * - * @param name a name to look for. - * @return the corresponding ManagedServiceIdentityType. - */ - public static ManagedServiceIdentityType fromString(String name) { - return fromString(name, ManagedServiceIdentityType.class); - } - - /** - * Gets known ManagedServiceIdentityType values. - * - * @return known ManagedServiceIdentityType values. - */ - public static Collection values() { - return values(ManagedServiceIdentityType.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameName.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameName.java deleted file mode 100644 index d6ba3bc2ad8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameName.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.management.SystemData; -import java.util.Map; -import tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner; - -/** - * An immutable client-side representation of ModelInterfaceSameName. - */ -public interface ModelInterfaceSameName { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - String provisioningState(); - - /** - * Gets the inner tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner object. - * - * @return the inner object. - */ - ModelInterfaceSameNameInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameNames.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameNames.java deleted file mode 100644 index 692a86e831b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameNames.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of ModelInterfaceSameNames. - */ -public interface ModelInterfaceSameNames { - /** - * Get a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ModelInterfaceDifferentName along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, - String modelInterfaceDifferentNameName, Context context); - - /** - * Get a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a ModelInterfaceDifferentName. - */ - ModelInterfaceSameName getByResourceGroup(String resourceGroupName, String modelInterfaceDifferentNameName); - - /** - * Delete a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @param ifMatch The request should only proceed if an entity matches this string. - * @param ifNoneMatch The request should only proceed if no entity matches this string. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByResourceGroupWithResponse(String resourceGroupName, String modelInterfaceDifferentNameName, - String ifMatch, String ifNoneMatch, Context context); - - /** - * Delete a ModelInterfaceDifferentName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String resourceGroupName, String modelInterfaceDifferentNameName); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationRequest.java deleted file mode 100644 index 2bc71f3119b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationRequest.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The NginxConfigurationRequest model. - */ -@Fluent -public final class NginxConfigurationRequest implements JsonSerializable { - /* - * The rootFile property. - */ - private String rootFile; - - /** - * Creates an instance of NginxConfigurationRequest class. - */ - public NginxConfigurationRequest() { - } - - /** - * Get the rootFile property: The rootFile property. - * - * @return the rootFile value. - */ - public String rootFile() { - return this.rootFile; - } - - /** - * Set the rootFile property: The rootFile property. - * - * @param rootFile the rootFile value to set. - * @return the NginxConfigurationRequest object itself. - */ - public NginxConfigurationRequest withRootFile(String rootFile) { - this.rootFile = rootFile; - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("rootFile", this.rootFile); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NginxConfigurationRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NginxConfigurationRequest if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the NginxConfigurationRequest. - */ - public static NginxConfigurationRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NginxConfigurationRequest deserializedNginxConfigurationRequest = new NginxConfigurationRequest(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("rootFile".equals(fieldName)) { - deserializedNginxConfigurationRequest.rootFile = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedNginxConfigurationRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponse.java deleted file mode 100644 index 21bf7b5e06e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponse.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Concrete proxy resource types can be created by aliasing this type using a specific property type. - */ -@Immutable -public final class NginxConfigurationResponse extends ProxyResource { - /* - * The resource-specific properties for this resource. - */ - private NginxConfigurationResponseProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of NginxConfigurationResponse class. - */ - private NginxConfigurationResponse() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public NginxConfigurationResponseProperties properties() { - return this.properties; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NginxConfigurationResponse from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NginxConfigurationResponse if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NginxConfigurationResponse. - */ - public static NginxConfigurationResponse fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NginxConfigurationResponse deserializedNginxConfigurationResponse = new NginxConfigurationResponse(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedNginxConfigurationResponse.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedNginxConfigurationResponse.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedNginxConfigurationResponse.type = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedNginxConfigurationResponse.properties - = NginxConfigurationResponseProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedNginxConfigurationResponse.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedNginxConfigurationResponse; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponseProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponseProperties.java deleted file mode 100644 index 101611e091c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponseProperties.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The NginxConfigurationResponseProperties model. - */ -@Immutable -public final class NginxConfigurationResponseProperties - implements JsonSerializable { - /* - * The provisioningState property. - */ - private ProvisioningState provisioningState; - - /* - * The rootFile property. - */ - private String rootFile; - - /** - * Creates an instance of NginxConfigurationResponseProperties class. - */ - private NginxConfigurationResponseProperties() { - } - - /** - * Get the provisioningState property: The provisioningState property. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * Get the rootFile property: The rootFile property. - * - * @return the rootFile value. - */ - public String rootFile() { - return this.rootFile; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("rootFile", this.rootFile); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NginxConfigurationResponseProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NginxConfigurationResponseProperties if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the NginxConfigurationResponseProperties. - */ - public static NginxConfigurationResponseProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NginxConfigurationResponseProperties deserializedNginxConfigurationResponseProperties - = new NginxConfigurationResponseProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedNginxConfigurationResponseProperties.provisioningState - = ProvisioningState.fromString(reader.getString()); - } else if ("rootFile".equals(fieldName)) { - deserializedNginxConfigurationResponseProperties.rootFile = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedNginxConfigurationResponseProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operation.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operation.java deleted file mode 100644 index 8b7465e16d2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operation.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import tsptest.armresourceprovider.fluent.models.OperationInner; - -/** - * An immutable client-side representation of Operation. - */ -public interface Operation { - /** - * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - * - * @return the name value. - */ - String name(); - - /** - * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane - * operations and "false" for Azure Resource Manager/control-plane operations. - * - * @return the isDataAction value. - */ - Boolean isDataAction(); - - /** - * Gets the display property: Localized display information for this particular operation. - * - * @return the display value. - */ - OperationDisplay display(); - - /** - * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and - * audit logs UX. Default value is "user,system". - * - * @return the origin value. - */ - Origin origin(); - - /** - * Gets the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are - * for internal only APIs. - * - * @return the actionType value. - */ - ActionType actionType(); - - /** - * Gets the inner tsptest.armresourceprovider.fluent.models.OperationInner object. - * - * @return the inner object. - */ - OperationInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/OperationDisplay.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/OperationDisplay.java deleted file mode 100644 index a03ca741bb4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/OperationDisplay.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Localized display information for and operation. - */ -@Immutable -public final class OperationDisplay implements JsonSerializable { - /* - * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or - * "Microsoft Compute". - */ - private String provider; - - /* - * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or - * "Job Schedule Collections". - */ - private String resource; - - /* - * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. - * "Create or Update Virtual Machine", "Restart Virtual Machine". - */ - private String operation; - - /* - * The short, localized friendly description of the operation; suitable for tool tips and detailed views. - */ - private String description; - - /** - * Creates an instance of OperationDisplay class. - */ - private OperationDisplay() { - } - - /** - * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring - * Insights" or "Microsoft Compute". - * - * @return the provider value. - */ - public String provider() { - return this.provider; - } - - /** - * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. - * "Virtual Machines" or "Job Schedule Collections". - * - * @return the resource value. - */ - public String resource() { - return this.resource; - } - - /** - * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. - * "Create or Update Virtual Machine", "Restart Virtual Machine". - * - * @return the operation value. - */ - public String operation() { - return this.operation; - } - - /** - * Get the description property: The short, localized friendly description of the operation; suitable for tool tips - * and detailed views. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationDisplay from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the OperationDisplay. - */ - public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationDisplay deserializedOperationDisplay = new OperationDisplay(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provider".equals(fieldName)) { - deserializedOperationDisplay.provider = reader.getString(); - } else if ("resource".equals(fieldName)) { - deserializedOperationDisplay.resource = reader.getString(); - } else if ("operation".equals(fieldName)) { - deserializedOperationDisplay.operation = reader.getString(); - } else if ("description".equals(fieldName)) { - deserializedOperationDisplay.description = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOperationDisplay; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operations.java deleted file mode 100644 index 1630283c128..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operations.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; - -/** - * Resource collection API of Operations. - */ -public interface Operations { - /** - * List the operations for the provider. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - PagedIterable list(); - - /** - * List the operations for the provider. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with - * {@link PagedIterable}. - */ - PagedIterable list(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Origin.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Origin.java deleted file mode 100644 index 34df022a55d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Origin.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value - * is "user,system". - */ -public final class Origin extends ExpandableStringEnum { - /** - * Indicates the operation is initiated by a user. - */ - public static final Origin USER = fromString("user"); - - /** - * Indicates the operation is initiated by a system. - */ - public static final Origin SYSTEM = fromString("system"); - - /** - * Indicates the operation is initiated by a user or system. - */ - public static final Origin USER_SYSTEM = fromString("user,system"); - - /** - * Creates a new instance of Origin value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public Origin() { - } - - /** - * Creates or finds a Origin from its string representation. - * - * @param name a name to look for. - * @return the corresponding Origin. - */ - public static Origin fromString(String name) { - return fromString(name, Origin.class); - } - - /** - * Gets known Origin values. - * - * @return known Origin values. - */ - public static Collection values() { - return values(Origin.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/PriorityModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/PriorityModel.java deleted file mode 100644 index dc8d7eb9b70..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/PriorityModel.java +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.util.ExpandableEnum; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.Function; - -/** - * Defines values for PriorityModel. - */ -public final class PriorityModel implements ExpandableEnum, JsonSerializable { - private static final Map VALUES = new ConcurrentHashMap<>(); - - private static final Function NEW_INSTANCE = PriorityModel::new; - - /** - * Static value 0 for PriorityModel. - */ - public static final PriorityModel HIGH = fromValue(0); - - /** - * Static value 1 for PriorityModel. - */ - public static final PriorityModel LOW = fromValue(1); - - private final Integer value; - - private PriorityModel(Integer value) { - this.value = value; - } - - /** - * Creates or finds a PriorityModel. - * - * @param value a value to look for. - * @return the corresponding PriorityModel. - * @throws IllegalArgumentException if value is null. - */ - public static PriorityModel fromValue(Integer value) { - if (value == null) { - throw new IllegalArgumentException("'value' cannot be null."); - } - return VALUES.computeIfAbsent(value, NEW_INSTANCE); - } - - /** - * Gets known PriorityModel values. - * - * @return Known PriorityModel values. - */ - public static Collection values() { - return new ArrayList<>(VALUES.values()); - } - - /** - * Gets the value of the PriorityModel instance. - * - * @return the value of the PriorityModel instance. - */ - @Override - public Integer getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeInt(getValue()); - } - - /** - * Reads an instance of PriorityModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PriorityModel if the JsonReader was pointing to an instance of it, or null if the - * JsonReader was pointing to JSON null. - * @throws IOException If an error occurs while reading the PriorityModel. - * @throws IllegalStateException If unexpected JSON token is found. - */ - public static PriorityModel fromJson(JsonReader jsonReader) throws IOException { - JsonToken nextToken = jsonReader.nextToken(); - if (nextToken == JsonToken.NULL) { - return null; - } - if (nextToken != JsonToken.NUMBER) { - throw new IllegalStateException( - String.format("Unexpected JSON token for %s deserialization: %s", JsonToken.NUMBER, nextToken)); - } - return PriorityModel.fromValue(jsonReader.getInt()); - } - - @Override - public String toString() { - return Objects.toString(this.value); - } - - @Override - public boolean equals(Object obj) { - return this == obj; - } - - @Override - public int hashCode() { - return Objects.hashCode(this.value); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ProvisioningState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ProvisioningState.java deleted file mode 100644 index 94c14396f7f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ProvisioningState.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for ProvisioningState. - */ -public final class ProvisioningState extends ExpandableStringEnum { - /** - * Resource has been created. - */ - public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); - - /** - * Resource creation failed. - */ - public static final ProvisioningState FAILED = fromString("Failed"); - - /** - * Resource creation was canceled. - */ - public static final ProvisioningState CANCELED = fromString("Canceled"); - - /** - * Static value Provisioning for ProvisioningState. - */ - public static final ProvisioningState PROVISIONING = fromString("Provisioning"); - - /** - * Static value Updating for ProvisioningState. - */ - public static final ProvisioningState UPDATING = fromString("Updating"); - - /** - * Static value Deleting for ProvisioningState. - */ - public static final ProvisioningState DELETING = fromString("Deleting"); - - /** - * Static value Accepted for ProvisioningState. - */ - public static final ProvisioningState ACCEPTED = fromString("Accepted"); - - /** - * Creates a new instance of ProvisioningState value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ProvisioningState() { - } - - /** - * Creates or finds a ProvisioningState from its string representation. - * - * @param name a name to look for. - * @return the corresponding ProvisioningState. - */ - public static ProvisioningState fromString(String name) { - return fromString(name, ProvisioningState.class); - } - - /** - * Gets known ProvisioningState values. - * - * @return known ProvisioningState values. - */ - public static Collection values() { - return values(ProvisioningState.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ResourceLroNoBody.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ResourceLroNoBody.java deleted file mode 100644 index cd252b1d5d7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ResourceLroNoBody.java +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; -import tsptest.armresourceprovider.fluent.models.ResourceLroNoBodyProperties; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class ResourceLroNoBody extends Resource { - /* - * The resource-specific properties for this resource. - */ - private ResourceLroNoBodyProperties innerProperties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of ResourceLroNoBody class. - */ - public ResourceLroNoBody() { - } - - /** - * Get the innerProperties property: The resource-specific properties for this resource. - * - * @return the innerProperties value. - */ - private ResourceLroNoBodyProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public ResourceLroNoBody withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public ResourceLroNoBody withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * Get the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - public ProvisioningState provisioningState() { - return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.innerProperties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourceLroNoBody from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourceLroNoBody if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResourceLroNoBody. - */ - public static ResourceLroNoBody fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ResourceLroNoBody deserializedResourceLroNoBody = new ResourceLroNoBody(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedResourceLroNoBody.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedResourceLroNoBody.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedResourceLroNoBody.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedResourceLroNoBody.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedResourceLroNoBody.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedResourceLroNoBody.innerProperties = ResourceLroNoBodyProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedResourceLroNoBody.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedResourceLroNoBody; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Result.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Result.java deleted file mode 100644 index 5ab817bff5a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Result.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import tsptest.armresourceprovider.fluent.models.ResultInner; - -/** - * An immutable client-side representation of Result. - */ -public interface Result { - /** - * Gets the reason property: The reason property. - * - * @return the reason value. - */ - String reason(); - - /** - * Gets the inner tsptest.armresourceprovider.fluent.models.ResultInner object. - * - * @return the inner object. - */ - ResultInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResource.java deleted file mode 100644 index 39641c683a1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResource.java +++ /dev/null @@ -1,396 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.time.OffsetDateTime; -import java.util.List; -import java.util.Map; -import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner; - -/** - * An immutable client-side representation of TopLevelArmResource. - */ -public interface TopLevelArmResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the configurationEndpoints property: Configuration Endpoints. - * - * @return the configurationEndpoints value. - */ - List configurationEndpoints(); - - /** - * Gets the userName property: The userName property. - * - * @return the userName value. - */ - String userName(); - - /** - * Gets the userNames property: The userNames property. - * - * @return the userNames value. - */ - String userNames(); - - /** - * Gets the accuserName property: The accuserName property. - * - * @return the accuserName value. - */ - String accuserName(); - - /** - * Gets the startTimeStamp property: The startTimeStamp property. - * - * @return the startTimeStamp value. - */ - OffsetDateTime startTimeStamp(); - - /** - * Gets the size property: The size property. - * - * @return the size value. - */ - Float size(); - - /** - * Gets the provisioningState property: The status of the last operation. - * - * @return the provisioningState value. - */ - ProvisioningState provisioningState(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the name of the resource group. - * - * @return the name of the resource group. - */ - String resourceGroupName(); - - /** - * Gets the inner tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner object. - * - * @return the inner object. - */ - TopLevelArmResourceInner innerModel(); - - /** - * The entirety of the TopLevelArmResource definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { - } - - /** - * The TopLevelArmResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the TopLevelArmResource definition. - */ - interface Blank extends WithLocation { - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify location. - */ - interface WithLocation { - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(Region location); - - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(String location); - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify parent resource. - */ - interface WithResourceGroup { - /** - * Specifies resourceGroupName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @return the next definition stage. - */ - WithCreate withExistingResourceGroup(String resourceGroupName); - } - - /** - * The stage of the TopLevelArmResource definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithUserName, - DefinitionStages.WithUserNames, DefinitionStages.WithAccuserName, DefinitionStages.WithStartTimeStamp { - /** - * Executes the create request. - * - * @return the created resource. - */ - TopLevelArmResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - TopLevelArmResource create(Context context); - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - WithCreate withTags(Map tags); - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify userName. - */ - interface WithUserName { - /** - * Specifies the userName property: The userName property.. - * - * @param userName The userName property. - * @return the next definition stage. - */ - WithCreate withUserName(String userName); - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify userNames. - */ - interface WithUserNames { - /** - * Specifies the userNames property: The userNames property.. - * - * @param userNames The userNames property. - * @return the next definition stage. - */ - WithCreate withUserNames(String userNames); - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify accuserName. - */ - interface WithAccuserName { - /** - * Specifies the accuserName property: The accuserName property.. - * - * @param accuserName The accuserName property. - * @return the next definition stage. - */ - WithCreate withAccuserName(String accuserName); - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify startTimeStamp. - */ - interface WithStartTimeStamp { - /** - * Specifies the startTimeStamp property: The startTimeStamp property.. - * - * @param startTimeStamp The startTimeStamp property. - * @return the next definition stage. - */ - WithCreate withStartTimeStamp(OffsetDateTime startTimeStamp); - } - } - - /** - * Begins update for the TopLevelArmResource resource. - * - * @return the stage of resource update. - */ - TopLevelArmResource.Update update(); - - /** - * The template for TopLevelArmResource update. - */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithUserName, UpdateStages.WithUserNames, - UpdateStages.WithAccuserName { - /** - * Executes the update request. - * - * @return the updated resource. - */ - TopLevelArmResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - TopLevelArmResource apply(Context context); - } - - /** - * The TopLevelArmResource update stages. - */ - interface UpdateStages { - /** - * The stage of the TopLevelArmResource update allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - Update withTags(Map tags); - } - - /** - * The stage of the TopLevelArmResource update allowing to specify userName. - */ - interface WithUserName { - /** - * Specifies the userName property: The userName property.. - * - * @param userName The userName property. - * @return the next definition stage. - */ - Update withUserName(String userName); - } - - /** - * The stage of the TopLevelArmResource update allowing to specify userNames. - */ - interface WithUserNames { - /** - * Specifies the userNames property: The userNames property.. - * - * @param userNames The userNames property. - * @return the next definition stage. - */ - Update withUserNames(String userNames); - } - - /** - * The stage of the TopLevelArmResource update allowing to specify accuserName. - */ - interface WithAccuserName { - /** - * Specifies the accuserName property: The accuserName property.. - * - * @param accuserName The accuserName property. - * @return the next definition stage. - */ - Update withAccuserName(String accuserName); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - TopLevelArmResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - TopLevelArmResource refresh(Context context); - - /** - * A long-running resource action. - * - * @throws com.azure.core.management.exception.ManagementException 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. - */ - Result action(); - - /** - * A long-running resource action. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - Result action(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceInterfaces.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceInterfaces.java deleted file mode 100644 index 33ae3638206..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceInterfaces.java +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of TopLevelArmResourceInterfaces. - */ -public interface TopLevelArmResourceInterfaces { - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelArmResourceName, Context context); - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource. - */ - TopLevelArmResource getByResourceGroup(String resourceGroupName, String topLevelArmResourceName); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String resourceGroupName, String topLevelArmResourceName); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceGroupName, String topLevelArmResourceName, Context context); - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String resourceGroupName, Context context); - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable list(); - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable list(Context context); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - Result action(String resourceGroupName, String topLevelArmResourceName); - - /** - * A long-running resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - Result action(String resourceGroupName, String topLevelArmResourceName, Context context); - - /** - * Get a TopLevelArmResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - TopLevelArmResource getById(String id); - - /** - * Get a TopLevelArmResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Delete a TopLevelArmResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a TopLevelArmResource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new TopLevelArmResource resource. - * - * @param name resource name. - * @return the first stage of the new TopLevelArmResource definition. - */ - TopLevelArmResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceUpdate.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceUpdate.java deleted file mode 100644 index cdd06db311f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceUpdate.java +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; -import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceUpdateProperties; - -/** - * The type used for update operations of the TopLevelArmResource. - */ -@Fluent -public final class TopLevelArmResourceUpdate implements JsonSerializable { - /* - * Resource tags. - */ - private Map tags; - - /* - * The resource-specific properties for this resource. - */ - private TopLevelArmResourceUpdateProperties innerProperties; - - /** - * Creates an instance of TopLevelArmResourceUpdate class. - */ - public TopLevelArmResourceUpdate() { - } - - /** - * Get the tags property: Resource tags. - * - * @return the tags value. - */ - public Map tags() { - return this.tags; - } - - /** - * Set the tags property: Resource tags. - * - * @param tags the tags value to set. - * @return the TopLevelArmResourceUpdate object itself. - */ - public TopLevelArmResourceUpdate withTags(Map tags) { - this.tags = tags; - return this; - } - - /** - * Get the innerProperties property: The resource-specific properties for this resource. - * - * @return the innerProperties value. - */ - private TopLevelArmResourceUpdateProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the userName property: The userName property. - * - * @return the userName value. - */ - public String userName() { - return this.innerProperties() == null ? null : this.innerProperties().userName(); - } - - /** - * Set the userName property: The userName property. - * - * @param userName the userName value to set. - * @return the TopLevelArmResourceUpdate object itself. - */ - public TopLevelArmResourceUpdate withUserName(String userName) { - if (this.innerProperties() == null) { - this.innerProperties = new TopLevelArmResourceUpdateProperties(); - } - this.innerProperties().withUserName(userName); - return this; - } - - /** - * Get the userNames property: The userNames property. - * - * @return the userNames value. - */ - public String userNames() { - return this.innerProperties() == null ? null : this.innerProperties().userNames(); - } - - /** - * Set the userNames property: The userNames property. - * - * @param userNames the userNames value to set. - * @return the TopLevelArmResourceUpdate object itself. - */ - public TopLevelArmResourceUpdate withUserNames(String userNames) { - if (this.innerProperties() == null) { - this.innerProperties = new TopLevelArmResourceUpdateProperties(); - } - this.innerProperties().withUserNames(userNames); - return this; - } - - /** - * Get the accuserName property: The accuserName property. - * - * @return the accuserName value. - */ - public String accuserName() { - return this.innerProperties() == null ? null : this.innerProperties().accuserName(); - } - - /** - * Set the accuserName property: The accuserName property. - * - * @param accuserName the accuserName value to set. - * @return the TopLevelArmResourceUpdate object itself. - */ - public TopLevelArmResourceUpdate withAccuserName(String accuserName) { - if (this.innerProperties() == null) { - this.innerProperties = new TopLevelArmResourceUpdateProperties(); - } - this.innerProperties().withAccuserName(accuserName); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.innerProperties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelArmResourceUpdate from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelArmResourceUpdate if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the TopLevelArmResourceUpdate. - */ - public static TopLevelArmResourceUpdate fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelArmResourceUpdate deserializedTopLevelArmResourceUpdate = new TopLevelArmResourceUpdate(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedTopLevelArmResourceUpdate.tags = tags; - } else if ("properties".equals(fieldName)) { - deserializedTopLevelArmResourceUpdate.innerProperties - = TopLevelArmResourceUpdateProperties.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelArmResourceUpdate; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/UserAssignedIdentity.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/UserAssignedIdentity.java deleted file mode 100644 index b15213ff01d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/UserAssignedIdentity.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armresourceprovider.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.UUID; - -/** - * User assigned identity properties. - */ -@Immutable -public final class UserAssignedIdentity implements JsonSerializable { - /* - * The principal ID of the assigned identity. - */ - private UUID principalId; - - /* - * The client ID of the assigned identity. - */ - private UUID clientId; - - /** - * Creates an instance of UserAssignedIdentity class. - */ - public UserAssignedIdentity() { - } - - /** - * Get the principalId property: The principal ID of the assigned identity. - * - * @return the principalId value. - */ - public UUID principalId() { - return this.principalId; - } - - /** - * Get the clientId property: The client ID of the assigned identity. - * - * @return the clientId value. - */ - public UUID clientId() { - return this.clientId; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UserAssignedIdentity from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the UserAssignedIdentity. - */ - public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("principalId".equals(fieldName)) { - deserializedUserAssignedIdentity.principalId - = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); - } else if ("clientId".equals(fieldName)) { - deserializedUserAssignedIdentity.clientId - = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - - return deserializedUserAssignedIdentity; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/package-info.java deleted file mode 100644 index e65297f8ab5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the data models for ArmResourceProvider. - * Arm Resource Provider management API. - */ -package tsptest.armresourceprovider.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/package-info.java deleted file mode 100644 index 3e003e5a626..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the classes for ArmResourceProvider. - * Arm Resource Provider management API. - */ -package tsptest.armresourceprovider; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/ArmResourceProviderManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/ArmResourceProviderManager.java deleted file mode 100644 index 713f0e11761..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/ArmResourceProviderManager.java +++ /dev/null @@ -1,346 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization; - -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import tsptest.armstreamstyleserialization.fluent.ArmResourceProviderManagementClient; -import tsptest.armstreamstyleserialization.implementation.ArmResourceProviderManagementClientBuilder; -import tsptest.armstreamstyleserialization.implementation.FishesImpl; -import tsptest.armstreamstyleserialization.implementation.FunctionsImpl; -import tsptest.armstreamstyleserialization.implementation.ItemsImpl; -import tsptest.armstreamstyleserialization.implementation.PrioritiesImpl; -import tsptest.armstreamstyleserialization.implementation.TopLevelArmResourcesImpl; -import tsptest.armstreamstyleserialization.models.Fishes; -import tsptest.armstreamstyleserialization.models.Functions; -import tsptest.armstreamstyleserialization.models.Items; -import tsptest.armstreamstyleserialization.models.Priorities; -import tsptest.armstreamstyleserialization.models.TopLevelArmResources; - -/** - * Entry point to ArmResourceProviderManager. - * Arm Resource Provider management API. - */ -public final class ArmResourceProviderManager { - private Fishes fishes; - - private TopLevelArmResources topLevelArmResources; - - private Functions functions; - - private Priorities priorities; - - private Items items; - - private final ArmResourceProviderManagementClient clientObject; - - private ArmResourceProviderManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new ArmResourceProviderManagementClientBuilder().pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of Arm Resource Provider service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the Arm Resource Provider service API instance. - */ - public static ArmResourceProviderManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return configure().authenticate(credential, profile); - } - - /** - * Creates an instance of Arm Resource Provider service API entry point. - * - * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. - * @param profile the Azure profile for client. - * @return the Arm Resource Provider service API instance. - */ - public static ArmResourceProviderManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return new ArmResourceProviderManager(httpPipeline, profile, null); - } - - /** - * Gets a Configurable instance that can be used to create ArmResourceProviderManager with optional configuration. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new ArmResourceProviderManager.Configurable(); - } - - /** - * The Configurable allowing configurations to be set. - */ - public static final class Configurable { - private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); - private static final String SDK_VERSION = "version"; - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-resourcemanager-armstreamstyleserialization-generated.properties"); - - private HttpClient httpClient; - private HttpLogOptions httpLogOptions; - private final List policies = new ArrayList<>(); - private final List scopes = new ArrayList<>(); - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - private Duration defaultPollInterval; - - private Configurable() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - return this; - } - - /** - * Adds the scope to permission sets. - * - * @param scope the scope. - * @return the configurable object itself. - */ - public Configurable withScope(String scope) { - this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); - return this; - } - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - /** - * Sets the default poll interval, used when service does not provide "Retry-After" header. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval - = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of Arm Resource Provider service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the Arm Resource Provider service API instance. - */ - public ArmResourceProviderManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder.append("azsdk-java") - .append("-") - .append("tsptest.armstreamstyleserialization") - .append("/") - .append(clientVersion); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder.append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(userAgentBuilder.toString())); - policies.add(new AddHeadersFromContextPolicy()); - policies.add(new RequestIdPolicy()); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy); - policies.add(new AddDatePolicy()); - policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new ArmResourceProviderManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * Gets the resource collection API of Fishes. - * - * @return Resource collection API of Fishes. - */ - public Fishes fishes() { - if (this.fishes == null) { - this.fishes = new FishesImpl(clientObject.getFishes(), this); - } - return fishes; - } - - /** - * Gets the resource collection API of TopLevelArmResources. - * - * @return Resource collection API of TopLevelArmResources. - */ - public TopLevelArmResources topLevelArmResources() { - if (this.topLevelArmResources == null) { - this.topLevelArmResources = new TopLevelArmResourcesImpl(clientObject.getTopLevelArmResources(), this); - } - return topLevelArmResources; - } - - /** - * Gets the resource collection API of Functions. - * - * @return Resource collection API of Functions. - */ - public Functions functions() { - if (this.functions == null) { - this.functions = new FunctionsImpl(clientObject.getFunctions(), this); - } - return functions; - } - - /** - * Gets the resource collection API of Priorities. - * - * @return Resource collection API of Priorities. - */ - public Priorities priorities() { - if (this.priorities == null) { - this.priorities = new PrioritiesImpl(clientObject.getPriorities(), this); - } - return priorities; - } - - /** - * Gets the resource collection API of Items. - * - * @return Resource collection API of Items. - */ - public Items items() { - if (this.items == null) { - this.items = new ItemsImpl(clientObject.getItems(), this); - } - return items; - } - - /** - * Gets wrapped service client ArmResourceProviderManagementClient providing direct access to the underlying - * auto-generated API implementation, based on Azure REST API. - * - * @return Wrapped service client ArmResourceProviderManagementClient. - */ - public ArmResourceProviderManagementClient serviceClient() { - return this.clientObject; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ArmResourceProviderManagementClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ArmResourceProviderManagementClient.java deleted file mode 100644 index 00f8f96bbdd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ArmResourceProviderManagementClient.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for ArmResourceProviderManagementClient class. - */ -public interface ArmResourceProviderManagementClient { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the FishesClient object to access its operations. - * - * @return the FishesClient object. - */ - FishesClient getFishes(); - - /** - * Gets the TopLevelArmResourcesClient object to access its operations. - * - * @return the TopLevelArmResourcesClient object. - */ - TopLevelArmResourcesClient getTopLevelArmResources(); - - /** - * Gets the FunctionsClient object to access its operations. - * - * @return the FunctionsClient object. - */ - FunctionsClient getFunctions(); - - /** - * Gets the PrioritiesClient object to access its operations. - * - * @return the PrioritiesClient object. - */ - PrioritiesClient getPriorities(); - - /** - * Gets the ItemsClient object to access its operations. - * - * @return the ItemsClient object. - */ - ItemsClient getItems(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FishesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FishesClient.java deleted file mode 100644 index 0124cb6d51c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FishesClient.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import tsptest.armstreamstyleserialization.fluent.models.FishInner; -import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner; - -/** - * An instance of this class provides access to all the operations defined in FishesClient. - */ -public interface FishesClient { - /** - * The getModel operation. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws tsptest.armstreamstyleserialization.models.ErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getModelWithResponse(Context context); - - /** - * The getModel operation. - * - * @throws tsptest.armstreamstyleserialization.models.ErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - FishInner getModel(); - - /** - * The putModel operation. - * - * @param fish The fish parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws tsptest.armstreamstyleserialization.models.ErrorMinException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response putModelWithResponse(FishInner fish, Context context); - - /** - * The putModel operation. - * - * @param fish The fish parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws tsptest.armstreamstyleserialization.models.ErrorMinException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - FishInner putModel(FishInner fish); - - /** - * The getOutputOnlyModel operation. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic OutputOnlyModel along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getOutputOnlyModelWithResponse(Context context); - - /** - * The getOutputOnlyModel operation. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic OutputOnlyModel. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - OutputOnlyModelInner getOutputOnlyModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FunctionsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FunctionsClient.java deleted file mode 100644 index 247b12c2150..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FunctionsClient.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.util.Context; -import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; -import tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionResponse; - -/** - * An instance of this class provides access to all the operations defined in FunctionsClient. - */ -public interface FunctionsClient { - /** - * The createFunction operation. - * - * @param function The function parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - FunctionsCreateFunctionResponse createFunctionWithResponse(FunctionInner function, Context context); - - /** - * The createFunction operation. - * - * @param function The function parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - FunctionInner createFunction(FunctionInner function); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ItemsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ItemsClient.java deleted file mode 100644 index b12428994a8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ItemsClient.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; -import tsptest.armstreamstyleserialization.models.Result; - -/** - * An instance of this class provides access to all the operations defined in ItemsClient. - */ -public interface ItemsClient { - /** - * The list operation. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * The list operation. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/PrioritiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/PrioritiesClient.java deleted file mode 100644 index e5802ead91f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/PrioritiesClient.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import tsptest.armstreamstyleserialization.models.Priority; - -/** - * An instance of this class provides access to all the operations defined in PrioritiesClient. - */ -public interface PrioritiesClient { - /** - * The setPriority operation. - * - * @param priority The priority parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response setPriorityWithResponse(Priority priority, Context context); - - /** - * The setPriority operation. - * - * @param priority The priority parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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) - Priority setPriority(Priority priority); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/TopLevelArmResourcesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/TopLevelArmResourcesClient.java deleted file mode 100644 index 9036fa0ea7d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/TopLevelArmResourcesClient.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; -import tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner; -import tsptest.armstreamstyleserialization.models.TopLevelArmResourceTagsUpdate; - -/** - * An instance of this class provides access to all the operations defined in TopLevelArmResourcesClient. - */ -public interface TopLevelArmResourcesClient { - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, TopLevelArmResourceInner> beginUpdate(String resourceGroupName, - String topLevelArmResourceName, TopLevelArmResourceTagsUpdate properties); - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, TopLevelArmResourceInner> beginUpdate(String resourceGroupName, - String topLevelArmResourceName, TopLevelArmResourceTagsUpdate properties, Context context); - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelArmResourceInner update(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceTagsUpdate properties); - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelArmResourceInner update(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceTagsUpdate properties, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/AnotherFishProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/AnotherFishProperties.java deleted file mode 100644 index 0917db30a11..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/AnotherFishProperties.java +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The AnotherFishProperties model. - */ -@Fluent -public final class AnotherFishProperties implements JsonSerializable { - /* - * The eyeProperties property. - */ - private EyeProperties innerEyeProperties = new EyeProperties(); - - /** - * Creates an instance of AnotherFishProperties class. - */ - public AnotherFishProperties() { - } - - /** - * Get the innerEyeProperties property: The eyeProperties property. - * - * @return the innerEyeProperties value. - */ - private EyeProperties innerEyeProperties() { - return this.innerEyeProperties; - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double length() { - return this.innerEyeProperties() == null ? 0.0 : this.innerEyeProperties().length(); - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the AnotherFishProperties object itself. - */ - public AnotherFishProperties withLength(double length) { - if (this.innerEyeProperties() == null) { - this.innerEyeProperties = new EyeProperties(); - } - this.innerEyeProperties().withLength(length); - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String patten() { - return this.innerEyeProperties() == null ? null : this.innerEyeProperties().patten(); - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredString() { - return this.innerEyeProperties() == null ? null : this.innerEyeProperties().requiredString(); - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the AnotherFishProperties object itself. - */ - public AnotherFishProperties withRequiredString(String requiredString) { - if (this.innerEyeProperties() == null) { - this.innerEyeProperties = new EyeProperties(); - } - this.innerEyeProperties().withRequiredString(requiredString); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerEyeProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property innerEyeProperties in model AnotherFishProperties")); - } else { - innerEyeProperties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(AnotherFishProperties.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("eyeProperties", this.innerEyeProperties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AnotherFishProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AnotherFishProperties if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the AnotherFishProperties. - */ - public static AnotherFishProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - AnotherFishProperties deserializedAnotherFishProperties = new AnotherFishProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("eyeProperties".equals(fieldName)) { - deserializedAnotherFishProperties.innerEyeProperties = EyeProperties.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedAnotherFishProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/EyeProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/EyeProperties.java deleted file mode 100644 index c52bca4111a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/EyeProperties.java +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The EyeProperties model. - */ -@Fluent -public final class EyeProperties implements JsonSerializable { - /* - * The length property. - */ - private double length; - - /* - * The patten property. - */ - private String patten; - - /* - * The requiredString property. - */ - private String requiredString; - - /** - * Creates an instance of EyeProperties class. - */ - public EyeProperties() { - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double length() { - return this.length; - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the EyeProperties object itself. - */ - public EyeProperties withLength(double length) { - this.length = length; - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String patten() { - return this.patten; - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredString() { - return this.requiredString; - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the EyeProperties object itself. - */ - public EyeProperties withRequiredString(String requiredString) { - this.requiredString = requiredString; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (requiredString() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property requiredString in model EyeProperties")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(EyeProperties.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("length", this.length); - jsonWriter.writeStringField("requiredString", this.requiredString); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of EyeProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of EyeProperties if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the EyeProperties. - */ - public static EyeProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - EyeProperties deserializedEyeProperties = new EyeProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("length".equals(fieldName)) { - deserializedEyeProperties.length = reader.getDouble(); - } else if ("patten".equals(fieldName)) { - deserializedEyeProperties.patten = reader.getString(); - } else if ("requiredString".equals(fieldName)) { - deserializedEyeProperties.requiredString = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedEyeProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishInner.java deleted file mode 100644 index a72dfffd86f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishInner.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armstreamstyleserialization.models.Shark; - -/** - * This is base model for polymorphic multiple levels inheritance with a discriminator. - */ -@Fluent -public class FishInner implements JsonSerializable { - /* - * Discriminator property for Fish. - */ - private String kind = "Fish"; - - /* - * The age property. - */ - private int age; - - /* - * The dna property. - */ - private String dna; - - /* - * The properties property. - */ - private FishProperties innerProperties = new FishProperties(); - - /* - * The anotherProperties property. - */ - private AnotherFishProperties innerAnotherProperties = new AnotherFishProperties(); - - /** - * Creates an instance of FishInner class. - */ - public FishInner() { - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - public String kind() { - return this.kind; - } - - /** - * Get the age property: The age property. - * - * @return the age value. - */ - public int age() { - return this.age; - } - - /** - * Set the age property: The age property. - * - * @param age the age value to set. - * @return the FishInner object itself. - */ - public FishInner withAge(int age) { - this.age = age; - return this; - } - - /** - * Get the dna property: The dna property. - * - * @return the dna value. - */ - public String dna() { - return this.dna; - } - - /** - * Set the dna property: The dna property. - * - * @param dna the dna value to set. - * @return the FishInner object itself. - */ - FishInner withDna(String dna) { - this.dna = dna; - return this; - } - - /** - * Get the innerProperties property: The properties property. - * - * @return the innerProperties value. - */ - private FishProperties innerProperties() { - return this.innerProperties; - } - - /** - * Set the innerProperties property: The properties property. - * - * @param innerProperties the innerProperties value to set. - * @return the FishInner object itself. - */ - FishInner withInnerProperties(FishProperties innerProperties) { - this.innerProperties = innerProperties; - return this; - } - - /** - * Get the innerAnotherProperties property: The anotherProperties property. - * - * @return the innerAnotherProperties value. - */ - private AnotherFishProperties innerAnotherProperties() { - return this.innerAnotherProperties; - } - - /** - * Set the innerAnotherProperties property: The anotherProperties property. - * - * @param innerAnotherProperties the innerAnotherProperties value to set. - * @return the FishInner object itself. - */ - FishInner withInnerAnotherProperties(AnotherFishProperties innerAnotherProperties) { - this.innerAnotherProperties = innerAnotherProperties; - return this; - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double length() { - return this.innerProperties() == null ? 0.0 : this.innerProperties().length(); - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the FishInner object itself. - */ - public FishInner withLength(double length) { - if (this.innerProperties() == null) { - this.innerProperties = new FishProperties(); - } - this.innerProperties().withLength(length); - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String patten() { - return this.innerProperties() == null ? null : this.innerProperties().patten(); - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredString() { - return this.innerProperties() == null ? null : this.innerProperties().requiredString(); - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the FishInner object itself. - */ - public FishInner withRequiredString(String requiredString) { - if (this.innerProperties() == null) { - this.innerProperties = new FishProperties(); - } - this.innerProperties().withRequiredString(requiredString); - return this; - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double lengthAnotherPropertiesLength() { - return this.innerAnotherProperties() == null ? 0.0 : this.innerAnotherProperties().length(); - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the FishInner object itself. - */ - public FishInner withLengthAnotherPropertiesLength(double length) { - if (this.innerAnotherProperties() == null) { - this.innerAnotherProperties = new AnotherFishProperties(); - } - this.innerAnotherProperties().withLength(length); - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String pattenAnotherPropertiesPatten() { - return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().patten(); - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredStringAnotherPropertiesRequiredString() { - return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().requiredString(); - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the FishInner object itself. - */ - public FishInner withRequiredStringAnotherPropertiesRequiredString(String requiredString) { - if (this.innerAnotherProperties() == null) { - this.innerAnotherProperties = new AnotherFishProperties(); - } - this.innerAnotherProperties().withRequiredString(requiredString); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property innerProperties in model FishInner")); - } else { - innerProperties().validate(); - } - if (innerAnotherProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property innerAnotherProperties in model FishInner")); - } else { - innerAnotherProperties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(FishInner.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("age", this.age); - jsonWriter.writeJsonField("properties", this.innerProperties); - jsonWriter.writeJsonField("anotherProperties", this.innerAnotherProperties); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FishInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FishInner if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FishInner. - */ - public static FishInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("shark".equals(discriminatorValue)) { - return Shark.fromJson(readerToUse.reset()); - } else if ("salmon".equals(discriminatorValue)) { - return SalmonInner.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - static FishInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - FishInner deserializedFishInner = new FishInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - deserializedFishInner.age = reader.getInt(); - } else if ("dna".equals(fieldName)) { - deserializedFishInner.dna = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedFishInner.innerProperties = FishProperties.fromJson(reader); - } else if ("anotherProperties".equals(fieldName)) { - deserializedFishInner.innerAnotherProperties = AnotherFishProperties.fromJson(reader); - } else if ("kind".equals(fieldName)) { - deserializedFishInner.kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedFishInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishProperties.java deleted file mode 100644 index 88e1e104372..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishProperties.java +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The FishProperties model. - */ -@Fluent -public final class FishProperties implements JsonSerializable { - /* - * The tailProperties property. - */ - private TailProperties innerTailProperties = new TailProperties(); - - /** - * Creates an instance of FishProperties class. - */ - public FishProperties() { - } - - /** - * Get the innerTailProperties property: The tailProperties property. - * - * @return the innerTailProperties value. - */ - private TailProperties innerTailProperties() { - return this.innerTailProperties; - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double length() { - return this.innerTailProperties() == null ? 0.0 : this.innerTailProperties().length(); - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the FishProperties object itself. - */ - public FishProperties withLength(double length) { - if (this.innerTailProperties() == null) { - this.innerTailProperties = new TailProperties(); - } - this.innerTailProperties().withLength(length); - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String patten() { - return this.innerTailProperties() == null ? null : this.innerTailProperties().patten(); - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredString() { - return this.innerTailProperties() == null ? null : this.innerTailProperties().requiredString(); - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the FishProperties object itself. - */ - public FishProperties withRequiredString(String requiredString) { - if (this.innerTailProperties() == null) { - this.innerTailProperties = new TailProperties(); - } - this.innerTailProperties().withRequiredString(requiredString); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerTailProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property innerTailProperties in model FishProperties")); - } else { - innerTailProperties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(FishProperties.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("tailProperties", this.innerTailProperties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FishProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FishProperties if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FishProperties. - */ - public static FishProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - FishProperties deserializedFishProperties = new FishProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("tailProperties".equals(fieldName)) { - deserializedFishProperties.innerTailProperties = TailProperties.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedFishProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionConfiguration.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionConfiguration.java deleted file mode 100644 index 68ab939e210..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionConfiguration.java +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The FunctionConfiguration model. - */ -@Fluent -public final class FunctionConfiguration implements JsonSerializable { - /* - * The input property. - */ - private String input; - - /* - * The output property. - */ - private String output; - - /** - * Creates an instance of FunctionConfiguration class. - */ - public FunctionConfiguration() { - } - - /** - * Get the input property: The input property. - * - * @return the input value. - */ - public String input() { - return this.input; - } - - /** - * Set the input property: The input property. - * - * @param input the input value to set. - * @return the FunctionConfiguration object itself. - */ - public FunctionConfiguration withInput(String input) { - this.input = input; - return this; - } - - /** - * Get the output property: The output property. - * - * @return the output value. - */ - public String output() { - return this.output; - } - - /** - * Set the output property: The output property. - * - * @param output the output value to set. - * @return the FunctionConfiguration object itself. - */ - public FunctionConfiguration withOutput(String output) { - this.output = output; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (input() != null) { - jsonWriter.writeStringField("input", this.input); - } else { - jsonWriter.writeNullField("input"); - } - jsonWriter.writeStringField("output", this.output); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FunctionConfiguration from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FunctionConfiguration if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the FunctionConfiguration. - */ - public static FunctionConfiguration fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - FunctionConfiguration deserializedFunctionConfiguration = new FunctionConfiguration(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("input".equals(fieldName)) { - deserializedFunctionConfiguration.input = reader.getString(); - } else if ("output".equals(fieldName)) { - deserializedFunctionConfiguration.output = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedFunctionConfiguration; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionInner.java deleted file mode 100644 index 5823f9ad8c4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionInner.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armstreamstyleserialization.models.FunctionProperties; - -/** - * The Function model. - */ -@Fluent -public final class FunctionInner implements JsonSerializable { - /* - * The properties property. - */ - private FunctionProperties properties; - - /** - * Creates an instance of FunctionInner class. - */ - public FunctionInner() { - } - - /** - * Get the properties property: The properties property. - * - * @return the properties value. - */ - public FunctionProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The properties property. - * - * @param properties the properties value to set. - * @return the FunctionInner object itself. - */ - public FunctionInner withProperties(FunctionProperties properties) { - this.properties = properties; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (properties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property properties in model FunctionInner")); - } else { - properties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(FunctionInner.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FunctionInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FunctionInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FunctionInner. - */ - public static FunctionInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - FunctionInner deserializedFunctionInner = new FunctionInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("properties".equals(fieldName)) { - deserializedFunctionInner.properties = FunctionProperties.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedFunctionInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelInner.java deleted file mode 100644 index f940cd0ea91..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelInner.java +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armstreamstyleserialization.models.Golden; -import tsptest.armstreamstyleserialization.models.OutputOnlyModelChild; - -/** - * This is base model for polymorphic OutputOnlyModel. - */ -@Immutable -public class OutputOnlyModelInner implements JsonSerializable { - /* - * Discriminator property for OutputOnlyModel. - */ - private String kind = "OutputOnlyModel"; - - /* - * The name property. - */ - private String name; - - /* - * The id property. - */ - private String id; - - /* - * The properties property. - */ - private OutputOnlyModelProperties innerProperties; - - /** - * Creates an instance of OutputOnlyModelInner class. - */ - protected OutputOnlyModelInner() { - } - - /** - * Get the kind property: Discriminator property for OutputOnlyModel. - * - * @return the kind value. - */ - public String kind() { - return this.kind; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name property. - * - * @param name the name value to set. - * @return the OutputOnlyModelInner object itself. - */ - OutputOnlyModelInner withName(String name) { - this.name = name; - return this; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - public String id() { - return this.id; - } - - /** - * Set the id property: The id property. - * - * @param id the id value to set. - * @return the OutputOnlyModelInner object itself. - */ - OutputOnlyModelInner withId(String id) { - this.id = id; - return this; - } - - /** - * Get the innerProperties property: The properties property. - * - * @return the innerProperties value. - */ - private OutputOnlyModelProperties innerProperties() { - return this.innerProperties; - } - - /** - * Set the innerProperties property: The properties property. - * - * @param innerProperties the innerProperties value to set. - * @return the OutputOnlyModelInner object itself. - */ - OutputOnlyModelInner withInnerProperties(OutputOnlyModelProperties innerProperties) { - this.innerProperties = innerProperties; - return this; - } - - /** - * Get the title property: The title property. - * - * @return the title value. - */ - public String title() { - return this.innerProperties() == null ? null : this.innerProperties().title(); - } - - /** - * Get the dog property: The dog property. - * - * @return the dog value. - */ - public Golden dog() { - return this.innerProperties() == null ? null : this.innerProperties().dog(); - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (name() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property name in model OutputOnlyModelInner")); - } - if (innerProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property innerProperties in model OutputOnlyModelInner")); - } else { - innerProperties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(OutputOnlyModelInner.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeJsonField("properties", this.innerProperties); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OutputOnlyModelInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OutputOnlyModelInner if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OutputOnlyModelInner. - */ - public static OutputOnlyModelInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("child".equals(discriminatorValue)) { - return OutputOnlyModelChild.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - static OutputOnlyModelInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OutputOnlyModelInner deserializedOutputOnlyModelInner = new OutputOnlyModelInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedOutputOnlyModelInner.name = reader.getString(); - } else if ("id".equals(fieldName)) { - deserializedOutputOnlyModelInner.id = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedOutputOnlyModelInner.innerProperties = OutputOnlyModelProperties.fromJson(reader); - } else if ("kind".equals(fieldName)) { - deserializedOutputOnlyModelInner.kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOutputOnlyModelInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelProperties.java deleted file mode 100644 index 5e5ad9f0338..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelProperties.java +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armstreamstyleserialization.models.Golden; - -/** - * The OutputOnlyModelProperties model. - */ -@Immutable -public final class OutputOnlyModelProperties implements JsonSerializable { - /* - * The title property. - */ - private String title; - - /* - * The dog property. - */ - private Golden dog; - - /** - * Creates an instance of OutputOnlyModelProperties class. - */ - private OutputOnlyModelProperties() { - } - - /** - * Get the title property: The title property. - * - * @return the title value. - */ - public String title() { - return this.title; - } - - /** - * Get the dog property: The dog property. - * - * @return the dog value. - */ - public Golden dog() { - return this.dog; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (title() == null) { - throw LOGGER.atError() - .log( - new IllegalArgumentException("Missing required property title in model OutputOnlyModelProperties")); - } - if (dog() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property dog in model OutputOnlyModelProperties")); - } else { - dog().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(OutputOnlyModelProperties.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("title", this.title); - jsonWriter.writeJsonField("dog", this.dog); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OutputOnlyModelProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OutputOnlyModelProperties if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OutputOnlyModelProperties. - */ - public static OutputOnlyModelProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OutputOnlyModelProperties deserializedOutputOnlyModelProperties = new OutputOnlyModelProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("title".equals(fieldName)) { - deserializedOutputOnlyModelProperties.title = reader.getString(); - } else if ("dog".equals(fieldName)) { - deserializedOutputOnlyModelProperties.dog = Golden.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedOutputOnlyModelProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/ResultData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/ResultData.java deleted file mode 100644 index 5af92891851..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/ResultData.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ResultData model. - */ -@Immutable -public final class ResultData implements JsonSerializable { - /* - * The prop1 property. - */ - private String prop1; - - /* - * The prop2 property. - */ - private String prop2; - - /** - * Creates an instance of ResultData class. - */ - private ResultData() { - } - - /** - * Get the prop1 property: The prop1 property. - * - * @return the prop1 value. - */ - public String prop1() { - return this.prop1; - } - - /** - * Get the prop2 property: The prop2 property. - * - * @return the prop2 value. - */ - public String prop2() { - return this.prop2; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (prop1() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property prop1 in model ResultData")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ResultData.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop1", this.prop1); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResultData from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResultData if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResultData. - */ - public static ResultData fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ResultData deserializedResultData = new ResultData(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop1".equals(fieldName)) { - deserializedResultData.prop1 = reader.getString(); - } else if ("prop2".equals(fieldName)) { - deserializedResultData.prop2 = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedResultData; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/SalmonInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/SalmonInner.java deleted file mode 100644 index 5126f1a744f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/SalmonInner.java +++ /dev/null @@ -1,375 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic - * instances. - */ -@Fluent -public final class SalmonInner extends FishInner { - /* - * Discriminator property for Fish. - */ - private String kind = "salmon"; - - /* - * The friends property. - */ - private List friends; - - /* - * The hate property. - */ - private Map hate; - - /* - * The partner property. - */ - private FishInner partner; - - /* - * The anotherProperties property. - */ - private AnotherFishProperties innerAnotherProperties = new AnotherFishProperties(); - - /* - * The properties property. - */ - private FishProperties innerProperties = new FishProperties(); - - /* - * The dna property. - */ - private String dna; - - /** - * Creates an instance of SalmonInner class. - */ - public SalmonInner() { - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Override - public String kind() { - return this.kind; - } - - /** - * Get the friends property: The friends property. - * - * @return the friends value. - */ - public List friends() { - return this.friends; - } - - /** - * Set the friends property: The friends property. - * - * @param friends the friends value to set. - * @return the SalmonInner object itself. - */ - public SalmonInner withFriends(List friends) { - this.friends = friends; - return this; - } - - /** - * Get the hate property: The hate property. - * - * @return the hate value. - */ - public Map hate() { - return this.hate; - } - - /** - * Set the hate property: The hate property. - * - * @param hate the hate value to set. - * @return the SalmonInner object itself. - */ - public SalmonInner withHate(Map hate) { - this.hate = hate; - return this; - } - - /** - * Get the partner property: The partner property. - * - * @return the partner value. - */ - public FishInner partner() { - return this.partner; - } - - /** - * Set the partner property: The partner property. - * - * @param partner the partner value to set. - * @return the SalmonInner object itself. - */ - public SalmonInner withPartner(FishInner partner) { - this.partner = partner; - return this; - } - - /** - * Get the innerAnotherProperties property: The anotherProperties property. - * - * @return the innerAnotherProperties value. - */ - private AnotherFishProperties innerAnotherProperties() { - return this.innerAnotherProperties; - } - - /** - * Get the innerProperties property: The properties property. - * - * @return the innerProperties value. - */ - private FishProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the dna property: The dna property. - * - * @return the dna value. - */ - @Override - public String dna() { - return this.dna; - } - - /** - * {@inheritDoc} - */ - @Override - public SalmonInner withAge(int age) { - super.withAge(age); - return this; - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double length() { - return this.innerProperties() == null ? 0.0 : this.innerProperties().length(); - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the SalmonInner object itself. - */ - public SalmonInner withLength(double length) { - if (this.innerProperties() == null) { - this.innerProperties = new FishProperties(); - } - this.innerProperties().withLength(length); - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String patten() { - return this.innerProperties() == null ? null : this.innerProperties().patten(); - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredString() { - return this.innerProperties() == null ? null : this.innerProperties().requiredString(); - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the SalmonInner object itself. - */ - public SalmonInner withRequiredString(String requiredString) { - if (this.innerProperties() == null) { - this.innerProperties = new FishProperties(); - } - this.innerProperties().withRequiredString(requiredString); - return this; - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double lengthAnotherPropertiesLength() { - return this.innerAnotherProperties() == null ? 0.0 : this.innerAnotherProperties().length(); - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the SalmonInner object itself. - */ - public SalmonInner withLengthAnotherPropertiesLength(double length) { - if (this.innerAnotherProperties() == null) { - this.innerAnotherProperties = new AnotherFishProperties(); - } - this.innerAnotherProperties().withLength(length); - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String pattenAnotherPropertiesPatten() { - return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().patten(); - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredStringAnotherPropertiesRequiredString() { - return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().requiredString(); - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the SalmonInner object itself. - */ - public SalmonInner withRequiredStringAnotherPropertiesRequiredString(String requiredString) { - if (this.innerAnotherProperties() == null) { - this.innerAnotherProperties = new AnotherFishProperties(); - } - this.innerAnotherProperties().withRequiredString(requiredString); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - if (friends() != null) { - friends().forEach(e -> e.validate()); - } - if (hate() != null) { - hate().values().forEach(e -> { - if (e != null) { - e.validate(); - } - }); - } - if (partner() != null) { - partner().validate(); - } - if (innerProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property innerProperties in model SalmonInner")); - } else { - innerProperties().validate(); - } - if (innerAnotherProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property innerAnotherProperties in model SalmonInner")); - } else { - innerAnotherProperties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(SalmonInner.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("age", age()); - jsonWriter.writeJsonField("properties", innerProperties()); - jsonWriter.writeJsonField("anotherProperties", innerAnotherProperties()); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeArrayField("friends", this.friends, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeMapField("hate", this.hate, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeJsonField("partner", this.partner); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SalmonInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SalmonInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SalmonInner. - */ - public static SalmonInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SalmonInner deserializedSalmonInner = new SalmonInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - deserializedSalmonInner.withAge(reader.getInt()); - } else if ("dna".equals(fieldName)) { - deserializedSalmonInner.dna = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedSalmonInner.innerProperties = FishProperties.fromJson(reader); - } else if ("anotherProperties".equals(fieldName)) { - deserializedSalmonInner.innerAnotherProperties = AnotherFishProperties.fromJson(reader); - } else if ("kind".equals(fieldName)) { - deserializedSalmonInner.kind = reader.getString(); - } else if ("friends".equals(fieldName)) { - List friends = reader.readArray(reader1 -> FishInner.fromJson(reader1)); - deserializedSalmonInner.friends = friends; - } else if ("hate".equals(fieldName)) { - Map hate = reader.readMap(reader1 -> FishInner.fromJson(reader1)); - deserializedSalmonInner.hate = hate; - } else if ("partner".equals(fieldName)) { - deserializedSalmonInner.partner = FishInner.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedSalmonInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TailProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TailProperties.java deleted file mode 100644 index c1354910d4a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TailProperties.java +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The TailProperties model. - */ -@Fluent -public final class TailProperties implements JsonSerializable { - /* - * The length property. - */ - private double length; - - /* - * The patten property. - */ - private String patten; - - /* - * The requiredString property. - */ - private String requiredString; - - /** - * Creates an instance of TailProperties class. - */ - public TailProperties() { - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double length() { - return this.length; - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the TailProperties object itself. - */ - public TailProperties withLength(double length) { - this.length = length; - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String patten() { - return this.patten; - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredString() { - return this.requiredString; - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the TailProperties object itself. - */ - public TailProperties withRequiredString(String requiredString) { - this.requiredString = requiredString; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (requiredString() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property requiredString in model TailProperties")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(TailProperties.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("length", this.length); - jsonWriter.writeStringField("requiredString", this.requiredString); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TailProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TailProperties if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TailProperties. - */ - public static TailProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TailProperties deserializedTailProperties = new TailProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("length".equals(fieldName)) { - deserializedTailProperties.length = reader.getDouble(); - } else if ("patten".equals(fieldName)) { - deserializedTailProperties.patten = reader.getString(); - } else if ("requiredString".equals(fieldName)) { - deserializedTailProperties.requiredString = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedTailProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TopLevelArmResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TopLevelArmResourceInner.java deleted file mode 100644 index 98f5922bd72..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TopLevelArmResourceInner.java +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; -import tsptest.armstreamstyleserialization.models.TopLevelArmResourceProperties; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Immutable -public final class TopLevelArmResourceInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private TopLevelArmResourceProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of TopLevelArmResourceInner class. - */ - private TopLevelArmResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public TopLevelArmResourceProperties properties() { - return this.properties; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (properties() != null) { - properties().validate(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelArmResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelArmResourceInner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TopLevelArmResourceInner. - */ - public static TopLevelArmResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelArmResourceInner deserializedTopLevelArmResourceInner = new TopLevelArmResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedTopLevelArmResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedTopLevelArmResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedTopLevelArmResourceInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedTopLevelArmResourceInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedTopLevelArmResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedTopLevelArmResourceInner.properties = TopLevelArmResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedTopLevelArmResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelArmResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/package-info.java deleted file mode 100644 index fa1a97ef95a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the inner data models for ArmResourceProvider. - * Arm Resource Provider management API. - */ -package tsptest.armstreamstyleserialization.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/package-info.java deleted file mode 100644 index 6683350fdd5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the service clients for ArmResourceProvider. - * Arm Resource Provider management API. - */ -package tsptest.armstreamstyleserialization.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientBuilder.java deleted file mode 100644 index be08069cda1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** - * A builder for creating a new instance of the ArmResourceProviderManagementClientImpl type. - */ -@ServiceClientBuilder(serviceClients = { ArmResourceProviderManagementClientImpl.class }) -public final class ArmResourceProviderManagementClientBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the ArmResourceProviderManagementClientBuilder. - */ - public ArmResourceProviderManagementClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The ID of the target subscription. The value must be an UUID. - */ - private String subscriptionId; - - /** - * Sets The ID of the target subscription. The value must be an UUID. - * - * @param subscriptionId the subscriptionId value. - * @return the ArmResourceProviderManagementClientBuilder. - */ - public ArmResourceProviderManagementClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the ArmResourceProviderManagementClientBuilder. - */ - public ArmResourceProviderManagementClientBuilder environment(AzureEnvironment environment) { - this.environment = environment; - 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 ArmResourceProviderManagementClientBuilder. - */ - public ArmResourceProviderManagementClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the ArmResourceProviderManagementClientBuilder. - */ - public ArmResourceProviderManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - 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 ArmResourceProviderManagementClientBuilder. - */ - public ArmResourceProviderManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of ArmResourceProviderManagementClientImpl with the provided parameters. - * - * @return an instance of ArmResourceProviderManagementClientImpl. - */ - public ArmResourceProviderManagementClientImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval - = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - ArmResourceProviderManagementClientImpl client = new ArmResourceProviderManagementClientImpl(localPipeline, - localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientImpl.java deleted file mode 100644 index 9dd35d711f9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientImpl.java +++ /dev/null @@ -1,372 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.management.polling.SyncPollerFactory; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armstreamstyleserialization.fluent.ArmResourceProviderManagementClient; -import tsptest.armstreamstyleserialization.fluent.FishesClient; -import tsptest.armstreamstyleserialization.fluent.FunctionsClient; -import tsptest.armstreamstyleserialization.fluent.ItemsClient; -import tsptest.armstreamstyleserialization.fluent.PrioritiesClient; -import tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient; - -/** - * Initializes a new instance of the ArmResourceProviderManagementClientImpl type. - */ -@ServiceClient(builder = ArmResourceProviderManagementClientBuilder.class) -public final class ArmResourceProviderManagementClientImpl implements ArmResourceProviderManagementClient { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Version parameter. - */ - private final String apiVersion; - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * The ID of the target subscription. The value must be an UUID. - */ - private final String subscriptionId; - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * 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. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The FishesClient object to access its operations. - */ - private final FishesClient fishes; - - /** - * Gets the FishesClient object to access its operations. - * - * @return the FishesClient object. - */ - public FishesClient getFishes() { - return this.fishes; - } - - /** - * The TopLevelArmResourcesClient object to access its operations. - */ - private final TopLevelArmResourcesClient topLevelArmResources; - - /** - * Gets the TopLevelArmResourcesClient object to access its operations. - * - * @return the TopLevelArmResourcesClient object. - */ - public TopLevelArmResourcesClient getTopLevelArmResources() { - return this.topLevelArmResources; - } - - /** - * The FunctionsClient object to access its operations. - */ - private final FunctionsClient functions; - - /** - * Gets the FunctionsClient object to access its operations. - * - * @return the FunctionsClient object. - */ - public FunctionsClient getFunctions() { - return this.functions; - } - - /** - * The PrioritiesClient object to access its operations. - */ - private final PrioritiesClient priorities; - - /** - * Gets the PrioritiesClient object to access its operations. - * - * @return the PrioritiesClient object. - */ - public PrioritiesClient getPriorities() { - return this.priorities; - } - - /** - * The ItemsClient object to access its operations. - */ - private final ItemsClient items; - - /** - * Gets the ItemsClient object to access its operations. - * - * @return the ItemsClient object. - */ - public ItemsClient getItems() { - return this.items; - } - - /** - * Initializes an instance of ArmResourceProviderManagementClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - ArmResourceProviderManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.apiVersion = "2023-12-01-preview"; - this.fishes = new FishesClientImpl(this); - this.topLevelArmResources = new TopLevelArmResourcesClientImpl(this); - this.functions = new FunctionsClientImpl(this); - this.priorities = new PrioritiesClientImpl(this); - this.items = new ItemsClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return SyncPoller for poll result and final result. - */ - public SyncPoller, U> getLroResult(Response activationResponse, - Type pollResultType, Type finalResultType, Context context) { - return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, () -> activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ArmResourceProviderManagementClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishImpl.java deleted file mode 100644 index 156681884c5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import tsptest.armstreamstyleserialization.fluent.models.FishInner; -import tsptest.armstreamstyleserialization.models.Fish; - -public final class FishImpl implements Fish { - private FishInner innerObject; - - private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; - - FishImpl(FishInner innerObject, tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String kind() { - return this.innerModel().kind(); - } - - public int age() { - return this.innerModel().age(); - } - - public String dna() { - return this.innerModel().dna(); - } - - public double length() { - return this.innerModel().length(); - } - - public String patten() { - return this.innerModel().patten(); - } - - public String requiredString() { - return this.innerModel().requiredString(); - } - - public double lengthAnotherPropertiesLength() { - return this.innerModel().lengthAnotherPropertiesLength(); - } - - public String pattenAnotherPropertiesPatten() { - return this.innerModel().pattenAnotherPropertiesPatten(); - } - - public String requiredStringAnotherPropertiesRequiredString() { - return this.innerModel().requiredStringAnotherPropertiesRequiredString(); - } - - public FishInner innerModel() { - return this.innerObject; - } - - private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesClientImpl.java deleted file mode 100644 index ab3fe579502..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesClientImpl.java +++ /dev/null @@ -1,320 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; -import reactor.core.publisher.Mono; -import tsptest.armstreamstyleserialization.fluent.FishesClient; -import tsptest.armstreamstyleserialization.fluent.models.FishInner; -import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner; -import tsptest.armstreamstyleserialization.models.ErrorException; -import tsptest.armstreamstyleserialization.models.ErrorMinException; - -/** - * An instance of this class provides access to all the operations defined in FishesClient. - */ -public final class FishesClientImpl implements FishesClient { - /** - * The proxy service used to perform REST calls. - */ - private final FishesService service; - - /** - * The service client containing this operation class. - */ - private final ArmResourceProviderManagementClientImpl client; - - /** - * Initializes an instance of FishesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FishesClientImpl(ArmResourceProviderManagementClientImpl client) { - this.service = RestProxy.create(FishesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmResourceProviderManagementClientFishes to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmResourceProviderManagementClientFishes") - public interface FishesService { - @Headers({ "Content-Type: application/json" }) - @Get("/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ErrorException.class) - Mono> getModel(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ErrorException.class) - Response getModelSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - Context context); - - @Put("/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ErrorMinException.class) - Mono> putModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") FishInner fish, Context context); - - @Put("/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ErrorMinException.class) - Response putModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") FishInner fish, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/model/output") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getOutputOnlyModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/model/output") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getOutputOnlyModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * The getModel operation. - * - * @throws ErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getModelWithResponseAsync() { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getModel(this.client.getEndpoint(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * The getModel operation. - * - * @throws ErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getModelAsync() { - return getModelWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The getModel operation. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getModelWithResponse(Context context) { - if (this.client.getEndpoint() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return service.getModelSync(this.client.getEndpoint(), accept, context); - } - - /** - * The getModel operation. - * - * @throws ErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public FishInner getModel() { - return getModelWithResponse(Context.NONE).getValue(); - } - - /** - * The putModel operation. - * - * @param fish The fish parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorMinException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> putModelWithResponseAsync(FishInner fish) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (fish == null) { - return Mono.error(new IllegalArgumentException("Parameter fish is required and cannot be null.")); - } else { - fish.validate(); - } - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.putModel(this.client.getEndpoint(), contentType, accept, fish, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * The putModel operation. - * - * @param fish The fish parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorMinException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putModelAsync(FishInner fish) { - return putModelWithResponseAsync(fish).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The putModel operation. - * - * @param fish The fish parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorMinException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putModelWithResponse(FishInner fish, Context context) { - if (this.client.getEndpoint() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (fish == null) { - throw LOGGER.atError().log(new IllegalArgumentException("Parameter fish is required and cannot be null.")); - } else { - fish.validate(); - } - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putModelSync(this.client.getEndpoint(), contentType, accept, fish, context); - } - - /** - * The putModel operation. - * - * @param fish The fish parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ErrorMinException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public FishInner putModel(FishInner fish) { - return putModelWithResponse(fish, Context.NONE).getValue(); - } - - /** - * The getOutputOnlyModel operation. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic OutputOnlyModel along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getOutputOnlyModelWithResponseAsync() { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getOutputOnlyModel(this.client.getEndpoint(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * The getOutputOnlyModel operation. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic OutputOnlyModel on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getOutputOnlyModelAsync() { - return getOutputOnlyModelWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The getOutputOnlyModel operation. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic OutputOnlyModel along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getOutputOnlyModelWithResponse(Context context) { - if (this.client.getEndpoint() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return service.getOutputOnlyModelSync(this.client.getEndpoint(), accept, context); - } - - /** - * The getOutputOnlyModel operation. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic OutputOnlyModel. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public OutputOnlyModelInner getOutputOnlyModel() { - return getOutputOnlyModelWithResponse(Context.NONE).getValue(); - } - - private static final ClientLogger LOGGER = new ClientLogger(FishesClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesImpl.java deleted file mode 100644 index 99a767143f0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armstreamstyleserialization.fluent.FishesClient; -import tsptest.armstreamstyleserialization.fluent.models.FishInner; -import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner; -import tsptest.armstreamstyleserialization.models.Fish; -import tsptest.armstreamstyleserialization.models.Fishes; -import tsptest.armstreamstyleserialization.models.OutputOnlyModel; - -public final class FishesImpl implements Fishes { - private static final ClientLogger LOGGER = new ClientLogger(FishesImpl.class); - - private final FishesClient innerClient; - - private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; - - public FishesImpl(FishesClient innerClient, - tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getModelWithResponse(Context context) { - Response inner = this.serviceClient().getModelWithResponse(context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new FishImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public Fish getModel() { - FishInner inner = this.serviceClient().getModel(); - if (inner != null) { - return new FishImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response putModelWithResponse(FishInner fish, Context context) { - Response inner = this.serviceClient().putModelWithResponse(fish, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new FishImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public Fish putModel(FishInner fish) { - FishInner inner = this.serviceClient().putModel(fish); - if (inner != null) { - return new FishImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response getOutputOnlyModelWithResponse(Context context) { - Response inner = this.serviceClient().getOutputOnlyModelWithResponse(context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new OutputOnlyModelImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public OutputOnlyModel getOutputOnlyModel() { - OutputOnlyModelInner inner = this.serviceClient().getOutputOnlyModel(); - if (inner != null) { - return new OutputOnlyModelImpl(inner, this.manager()); - } else { - return null; - } - } - - private FishesClient serviceClient() { - return this.innerClient; - } - - private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionImpl.java deleted file mode 100644 index d6aa7a40ffd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; -import tsptest.armstreamstyleserialization.models.Function; -import tsptest.armstreamstyleserialization.models.FunctionProperties; - -public final class FunctionImpl implements Function { - private FunctionInner innerObject; - - private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; - - FunctionImpl(FunctionInner innerObject, - tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public FunctionProperties properties() { - return this.innerModel().properties(); - } - - public FunctionInner innerModel() { - return this.innerObject; - } - - private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsClientImpl.java deleted file mode 100644 index 538e58461d1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsClientImpl.java +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; -import reactor.core.publisher.Mono; -import tsptest.armstreamstyleserialization.fluent.FunctionsClient; -import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; -import tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionResponse; - -/** - * An instance of this class provides access to all the operations defined in FunctionsClient. - */ -public final class FunctionsClientImpl implements FunctionsClient { - /** - * The proxy service used to perform REST calls. - */ - private final FunctionsService service; - - /** - * The service client containing this operation class. - */ - private final ArmResourceProviderManagementClientImpl client; - - /** - * Initializes an instance of FunctionsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FunctionsClientImpl(ArmResourceProviderManagementClientImpl client) { - this.service - = RestProxy.create(FunctionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmResourceProviderManagementClientFunctions to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmResourceProviderManagementClientFunctions") - public interface FunctionsService { - @Put("/function") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono createFunction(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") FunctionInner function, Context context); - - @Put("/function") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - FunctionsCreateFunctionResponse createFunctionSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") FunctionInner function, Context context); - } - - /** - * The createFunction operation. - * - * @param function The function parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createFunctionWithResponseAsync(FunctionInner function) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (function == null) { - return Mono.error(new IllegalArgumentException("Parameter function is required and cannot be null.")); - } else { - function.validate(); - } - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.createFunction(this.client.getEndpoint(), contentType, accept, function, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * The createFunction operation. - * - * @param function The function parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createFunctionAsync(FunctionInner function) { - return createFunctionWithResponseAsync(function).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The createFunction operation. - * - * @param function The function parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 FunctionsCreateFunctionResponse createFunctionWithResponse(FunctionInner function, Context context) { - if (this.client.getEndpoint() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (function == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter function is required and cannot be null.")); - } else { - function.validate(); - } - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createFunctionSync(this.client.getEndpoint(), contentType, accept, function, context); - } - - /** - * The createFunction operation. - * - * @param function The function parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 FunctionInner createFunction(FunctionInner function) { - return createFunctionWithResponse(function, Context.NONE).getValue(); - } - - private static final ClientLogger LOGGER = new ClientLogger(FunctionsClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsImpl.java deleted file mode 100644 index 603fcde2ec4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armstreamstyleserialization.fluent.FunctionsClient; -import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; -import tsptest.armstreamstyleserialization.models.Function; -import tsptest.armstreamstyleserialization.models.Functions; -import tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionResponse; - -public final class FunctionsImpl implements Functions { - private static final ClientLogger LOGGER = new ClientLogger(FunctionsImpl.class); - - private final FunctionsClient innerClient; - - private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; - - public FunctionsImpl(FunctionsClient innerClient, - tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response createFunctionWithResponse(FunctionInner function, Context context) { - FunctionsCreateFunctionResponse inner = this.serviceClient().createFunctionWithResponse(function, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new FunctionImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public Function createFunction(FunctionInner function) { - FunctionInner inner = this.serviceClient().createFunction(function); - if (inner != null) { - return new FunctionImpl(inner, this.manager()); - } else { - return null; - } - } - - private FunctionsClient serviceClient() { - return this.innerClient; - } - - private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsClientImpl.java deleted file mode 100644 index 70d6dc0ac48..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsClientImpl.java +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armstreamstyleserialization.fluent.ItemsClient; -import tsptest.armstreamstyleserialization.implementation.models.ListResult; -import tsptest.armstreamstyleserialization.models.Result; - -/** - * An instance of this class provides access to all the operations defined in ItemsClient. - */ -public final class ItemsClientImpl implements ItemsClient { - /** - * The proxy service used to perform REST calls. - */ - private final ItemsService service; - - /** - * The service client containing this operation class. - */ - private final ArmResourceProviderManagementClientImpl client; - - /** - * Initializes an instance of ItemsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ItemsClientImpl(ArmResourceProviderManagementClientImpl client) { - this.service = RestProxy.create(ItemsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmResourceProviderManagementClientItems to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmResourceProviderManagementClientItems") - public interface ItemsService { - @Headers({ "Content-Type: application/json" }) - @Get("/items") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> list(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/items") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); - } - - /** - * The list operation. - * - * @throws ManagementException 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 body along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync() { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil.withContext(context -> { - Mono>> mono = service.list(this.client.getEndpoint(), accept, context).cache(); - return Mono.zip(mono, - this.client - .getLroResult(mono, this.client.getHttpPipeline(), ListResult.class, - ListResult.class, this.client.getContext()) - .last() - .flatMap(this.client::getLroFinalResultOrError)); - }) - .>map( - res -> new PagedResponseBase<>(res.getT1().getRequest(), res.getT1().getStatusCode(), - res.getT1().getHeaders(), res.getT2().items(), res.getT2().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * The list operation. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * The list operation. - * - * @throws ManagementException 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 body along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage() { - if (this.client.getEndpoint() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), accept, Context.NONE); - ListResult lroPageableResult - = this.client.getLroResult(res, ListResult.class, ListResult.class, Context.NONE) - .getFinalResult(); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - lroPageableResult.items(), lroPageableResult.nextLink(), null); - } - - /** - * The list operation. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(Context context) { - if (this.client.getEndpoint() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), accept, context); - ListResult lroPageableResult - = this.client.getLroResult(res, ListResult.class, ListResult.class, context) - .getFinalResult(); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - lroPageableResult.items(), lroPageableResult.nextLink(), null); - } - - /** - * The list operation. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); - } - - /** - * The list operation. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().items(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listNextSinglePage(String nextLink) { - if (nextLink == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().items(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listNextSinglePage(String nextLink, Context context) { - if (nextLink == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().items(), - res.getValue().nextLink(), null); - } - - private static final ClientLogger LOGGER = new ClientLogger(ItemsClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsImpl.java deleted file mode 100644 index 37ad1648542..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armstreamstyleserialization.fluent.ItemsClient; -import tsptest.armstreamstyleserialization.models.Items; -import tsptest.armstreamstyleserialization.models.Result; - -public final class ItemsImpl implements Items { - private static final ClientLogger LOGGER = new ClientLogger(ItemsImpl.class); - - private final ItemsClient innerClient; - - private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; - - public ItemsImpl(ItemsClient innerClient, - tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public PagedIterable list() { - return this.serviceClient().list(); - } - - public PagedIterable list(Context context) { - return this.serviceClient().list(context); - } - - private ItemsClient serviceClient() { - return this.innerClient; - } - - private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/OutputOnlyModelImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/OutputOnlyModelImpl.java deleted file mode 100644 index 7c34374c38f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/OutputOnlyModelImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner; -import tsptest.armstreamstyleserialization.models.Golden; -import tsptest.armstreamstyleserialization.models.OutputOnlyModel; - -public final class OutputOnlyModelImpl implements OutputOnlyModel { - private OutputOnlyModelInner innerObject; - - private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; - - OutputOnlyModelImpl(OutputOnlyModelInner innerObject, - tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String kind() { - return this.innerModel().kind(); - } - - public String name() { - return this.innerModel().name(); - } - - public String id() { - return this.innerModel().id(); - } - - public String title() { - return this.innerModel().title(); - } - - public Golden dog() { - return this.innerModel().dog(); - } - - public OutputOnlyModelInner innerModel() { - return this.innerObject; - } - - private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesClientImpl.java deleted file mode 100644 index 45564684237..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesClientImpl.java +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; -import reactor.core.publisher.Mono; -import tsptest.armstreamstyleserialization.fluent.PrioritiesClient; -import tsptest.armstreamstyleserialization.models.Priority; - -/** - * An instance of this class provides access to all the operations defined in PrioritiesClient. - */ -public final class PrioritiesClientImpl implements PrioritiesClient { - /** - * The proxy service used to perform REST calls. - */ - private final PrioritiesService service; - - /** - * The service client containing this operation class. - */ - private final ArmResourceProviderManagementClientImpl client; - - /** - * Initializes an instance of PrioritiesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PrioritiesClientImpl(ArmResourceProviderManagementClientImpl client) { - this.service - = RestProxy.create(PrioritiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmResourceProviderManagementClientPriorities to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmResourceProviderManagementClientPriorities") - public interface PrioritiesService { - @Headers({ "Content-Type: application/json" }) - @Post("/priority") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> setPriority(@HostParam("endpoint") String endpoint, - @QueryParam("priority") Priority priority, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Post("/priority") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response setPrioritySync(@HostParam("endpoint") String endpoint, - @QueryParam("priority") Priority priority, @HeaderParam("Accept") String accept, Context context); - } - - /** - * The setPriority operation. - * - * @param priority The priority parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> setPriorityWithResponseAsync(Priority priority) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (priority == null) { - return Mono.error(new IllegalArgumentException("Parameter priority is required and cannot be null.")); - } - final String accept = "text/plain"; - return FluxUtil - .withContext(context -> service.setPriority(this.client.getEndpoint(), priority, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * The setPriority operation. - * - * @param priority The priority parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono setPriorityAsync(Priority priority) { - return setPriorityWithResponseAsync(priority).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * The setPriority operation. - * - * @param priority The priority parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setPriorityWithResponse(Priority priority, Context context) { - if (this.client.getEndpoint() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (priority == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter priority is required and cannot be null.")); - } - final String accept = "text/plain"; - return service.setPrioritySync(this.client.getEndpoint(), priority, accept, context); - } - - /** - * The setPriority operation. - * - * @param priority The priority parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 Priority setPriority(Priority priority) { - return setPriorityWithResponse(priority, Context.NONE).getValue(); - } - - private static final ClientLogger LOGGER = new ClientLogger(PrioritiesClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesImpl.java deleted file mode 100644 index b035724262b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armstreamstyleserialization.fluent.PrioritiesClient; -import tsptest.armstreamstyleserialization.models.Priorities; -import tsptest.armstreamstyleserialization.models.Priority; - -public final class PrioritiesImpl implements Priorities { - private static final ClientLogger LOGGER = new ClientLogger(PrioritiesImpl.class); - - private final PrioritiesClient innerClient; - - private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; - - public PrioritiesImpl(PrioritiesClient innerClient, - tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response setPriorityWithResponse(Priority priority, Context context) { - return this.serviceClient().setPriorityWithResponse(priority, context); - } - - public Priority setPriority(Priority priority) { - return this.serviceClient().setPriority(priority); - } - - private PrioritiesClient serviceClient() { - return this.innerClient; - } - - private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ResourceManagerUtils.java deleted file mode 100644 index 07de5519407..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ResourceManagerUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -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.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class ResourceManagerUtils { - private ResourceManagerUtils() { - } - - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (!segments.isEmpty() && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl<>(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux - .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(iterable.iterator(), mapper); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/SalmonImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/SalmonImpl.java deleted file mode 100644 index 4bb0968d5dc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/SalmonImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import tsptest.armstreamstyleserialization.fluent.models.FishInner; -import tsptest.armstreamstyleserialization.fluent.models.SalmonInner; -import tsptest.armstreamstyleserialization.models.Fish; -import tsptest.armstreamstyleserialization.models.Salmon; - -public final class SalmonImpl implements Salmon { - private SalmonInner innerObject; - - private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; - - SalmonImpl(SalmonInner innerObject, tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public int age() { - return this.innerModel().age(); - } - - public String dna() { - return this.innerModel().dna(); - } - - public double length() { - return this.innerModel().length(); - } - - public String patten() { - return this.innerModel().patten(); - } - - public String requiredString() { - return this.innerModel().requiredString(); - } - - public double lengthAnotherPropertiesLength() { - return this.innerModel().lengthAnotherPropertiesLength(); - } - - public String pattenAnotherPropertiesPatten() { - return this.innerModel().pattenAnotherPropertiesPatten(); - } - - public String requiredStringAnotherPropertiesRequiredString() { - return this.innerModel().requiredStringAnotherPropertiesRequiredString(); - } - - public String kind() { - return this.innerModel().kind(); - } - - public List friends() { - List inner = this.innerModel().friends(); - if (inner != null) { - return Collections.unmodifiableList( - inner.stream().map(inner1 -> new FishImpl(inner1, this.manager())).collect(Collectors.toList())); - } else { - return Collections.emptyList(); - } - } - - public Map hate() { - Map inner = this.innerModel().hate(); - if (inner != null) { - return Collections.unmodifiableMap(inner.entrySet() - .stream() - .collect( - Collectors.toMap(Map.Entry::getKey, inner1 -> new FishImpl(inner1.getValue(), this.manager())))); - } else { - return Collections.emptyMap(); - } - } - - public Fish partner() { - FishInner inner = this.innerModel().partner(); - if (inner != null) { - return new FishImpl(inner, this.manager()); - } else { - return null; - } - } - - public SalmonInner innerModel() { - return this.innerObject; - } - - private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourceImpl.java deleted file mode 100644 index 0ed8d7103ce..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourceImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.management.SystemData; -import java.util.Collections; -import java.util.Map; -import tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner; -import tsptest.armstreamstyleserialization.models.TopLevelArmResource; -import tsptest.armstreamstyleserialization.models.TopLevelArmResourceProperties; - -public final class TopLevelArmResourceImpl implements TopLevelArmResource { - private TopLevelArmResourceInner innerObject; - - private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; - - TopLevelArmResourceImpl(TopLevelArmResourceInner innerObject, - tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public TopLevelArmResourceProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public TopLevelArmResourceInner innerModel() { - return this.innerObject; - } - - private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesClientImpl.java deleted file mode 100644 index 9d74a3f663d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesClientImpl.java +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient; -import tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner; -import tsptest.armstreamstyleserialization.models.TopLevelArmResourceTagsUpdate; - -/** - * An instance of this class provides access to all the operations defined in TopLevelArmResourcesClient. - */ -public final class TopLevelArmResourcesClientImpl implements TopLevelArmResourcesClient { - /** - * The proxy service used to perform REST calls. - */ - private final TopLevelArmResourcesService service; - - /** - * The service client containing this operation class. - */ - private final ArmResourceProviderManagementClientImpl client; - - /** - * Initializes an instance of TopLevelArmResourcesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - TopLevelArmResourcesClientImpl(ArmResourceProviderManagementClientImpl client) { - this.service = RestProxy.create(TopLevelArmResourcesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmResourceProviderManagementClientTopLevelArmResources to be used by - * the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmResourceProviderManagementClientTopLevelArmResources") - public interface TopLevelArmResourcesService { - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmStreamStyleSerialization/topLevelArmResources/{topLevelArmResourceName}") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> update(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") TopLevelArmResourceTagsUpdate properties, Context context); - - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmStreamStyleSerialization/topLevelArmResources/{topLevelArmResourceName}") - @ExpectedResponses({ 200, 202 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response updateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourceName") String topLevelArmResourceName, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") TopLevelArmResourceTagsUpdate properties, Context context); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync(String resourceGroupName, - String topLevelArmResourceName, TopLevelArmResourceTagsUpdate properties) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (topLevelArmResourceName == null) { - return Mono.error( - new IllegalArgumentException("Parameter topLevelArmResourceName is required and cannot be null.")); - } - if (properties == null) { - return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); - } else { - properties.validate(); - } - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, - properties, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response updateWithResponse(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceTagsUpdate properties) { - if (this.client.getEndpoint() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (topLevelArmResourceName == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter topLevelArmResourceName is required and cannot be null.")); - } - if (properties == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); - } else { - properties.validate(); - } - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, - properties, Context.NONE); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response updateWithResponse(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceTagsUpdate properties, Context context) { - if (this.client.getEndpoint() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (topLevelArmResourceName == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter topLevelArmResourceName is required and cannot be null.")); - } - if (properties == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); - } else { - properties.validate(); - } - final String contentType = "application/json"; - final String accept = "application/json"; - return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, - properties, context); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, TopLevelArmResourceInner> beginUpdateAsync( - String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceTagsUpdate properties) { - Mono>> mono - = updateWithResponseAsync(resourceGroupName, topLevelArmResourceName, properties); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, - this.client.getContext()); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, TopLevelArmResourceInner> beginUpdate( - String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceTagsUpdate properties) { - Response response = updateWithResponse(resourceGroupName, topLevelArmResourceName, properties); - return this.client.getLroResult(response, - TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, Context.NONE); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, TopLevelArmResourceInner> beginUpdate( - String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceTagsUpdate properties, - Context context) { - Response response - = updateWithResponse(resourceGroupName, topLevelArmResourceName, properties, context); - return this.client.getLroResult(response, - TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, context); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceTagsUpdate properties) { - return beginUpdateAsync(resourceGroupName, topLevelArmResourceName, properties).last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelArmResourceInner update(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceTagsUpdate properties) { - return beginUpdate(resourceGroupName, topLevelArmResourceName, properties).getFinalResult(); - } - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelArmResourceInner update(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceTagsUpdate properties, Context context) { - return beginUpdate(resourceGroupName, topLevelArmResourceName, properties, context).getFinalResult(); - } - - private static final ClientLogger LOGGER = new ClientLogger(TopLevelArmResourcesClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesImpl.java deleted file mode 100644 index 941f67da273..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation; - -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient; -import tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner; -import tsptest.armstreamstyleserialization.models.TopLevelArmResource; -import tsptest.armstreamstyleserialization.models.TopLevelArmResourceTagsUpdate; -import tsptest.armstreamstyleserialization.models.TopLevelArmResources; - -public final class TopLevelArmResourcesImpl implements TopLevelArmResources { - private static final ClientLogger LOGGER = new ClientLogger(TopLevelArmResourcesImpl.class); - - private final TopLevelArmResourcesClient innerClient; - - private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; - - public TopLevelArmResourcesImpl(TopLevelArmResourcesClient innerClient, - tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public TopLevelArmResource update(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceTagsUpdate properties) { - TopLevelArmResourceInner inner - = this.serviceClient().update(resourceGroupName, topLevelArmResourceName, properties); - if (inner != null) { - return new TopLevelArmResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public TopLevelArmResource update(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceTagsUpdate properties, Context context) { - TopLevelArmResourceInner inner - = this.serviceClient().update(resourceGroupName, topLevelArmResourceName, properties, context); - if (inner != null) { - return new TopLevelArmResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - private TopLevelArmResourcesClient serviceClient() { - return this.innerClient; - } - - private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { - return this.serviceManager; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/models/ListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/models/ListResult.java deleted file mode 100644 index af772cd80e7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/models/ListResult.java +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.implementation.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import tsptest.armstreamstyleserialization.models.Result; - -/** - * The ListResult model. - */ -@Immutable -public final class ListResult implements JsonSerializable { - /* - * The items property. - */ - private List items; - - /* - * The nextLink property. - */ - private String nextLink; - - /** - * Creates an instance of ListResult class. - */ - private ListResult() { - } - - /** - * Get the items property: The items property. - * - * @return the items value. - */ - public List items() { - return this.items; - } - - /** - * Get the nextLink property: The nextLink property. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (items() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property items in model ListResult")); - } else { - items().forEach(e -> e.validate()); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ListResult.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("items", this.items, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ListResult if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ListResult. - */ - public static ListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ListResult deserializedListResult = new ListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("items".equals(fieldName)) { - List items = reader.readArray(reader1 -> Result.fromJson(reader1)); - deserializedListResult.items = items; - } else if ("nextLink".equals(fieldName)) { - deserializedListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/package-info.java deleted file mode 100644 index e0d8dfba624..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the implementations for ArmResourceProvider. - * Arm Resource Provider management API. - */ -package tsptest.armstreamstyleserialization.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/AggregateFunctionProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/AggregateFunctionProperties.java deleted file mode 100644 index e986d139ce6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/AggregateFunctionProperties.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armstreamstyleserialization.fluent.models.FunctionConfiguration; - -/** - * The AggregateFunctionProperties model. - */ -@Fluent -public final class AggregateFunctionProperties extends FunctionProperties { - /* - * Discriminator property for FunctionProperties. - */ - private String kind = "aggregate"; - - /** - * Creates an instance of AggregateFunctionProperties class. - */ - public AggregateFunctionProperties() { - } - - /** - * Get the kind property: Discriminator property for FunctionProperties. - * - * @return the kind value. - */ - @Override - public String kind() { - return this.kind; - } - - /** - * Get the input property: The input property. - * - * @return the input value. - */ - public String input() { - return this.innerProperties() == null ? null : this.innerProperties().input(); - } - - /** - * Set the input property: The input property. - * - * @param input the input value to set. - * @return the AggregateFunctionProperties object itself. - */ - public AggregateFunctionProperties withInput(String input) { - if (this.innerProperties() == null) { - this.withInnerProperties(new FunctionConfiguration()); - } - this.innerProperties().withInput(input); - return this; - } - - /** - * Get the output property: The output property. - * - * @return the output value. - */ - public String output() { - return this.innerProperties() == null ? null : this.innerProperties().output(); - } - - /** - * Set the output property: The output property. - * - * @param output the output value to set. - * @return the AggregateFunctionProperties object itself. - */ - public AggregateFunctionProperties withOutput(String output) { - if (this.innerProperties() == null) { - this.withInnerProperties(new FunctionConfiguration()); - } - this.innerProperties().withOutput(output); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - if (innerProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property innerProperties in model AggregateFunctionProperties")); - } else { - innerProperties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(AggregateFunctionProperties.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", innerProperties()); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AggregateFunctionProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AggregateFunctionProperties if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the AggregateFunctionProperties. - */ - public static AggregateFunctionProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - AggregateFunctionProperties deserializedAggregateFunctionProperties = new AggregateFunctionProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("properties".equals(fieldName)) { - deserializedAggregateFunctionProperties.withInnerProperties(FunctionConfiguration.fromJson(reader)); - } else if ("kind".equals(fieldName)) { - deserializedAggregateFunctionProperties.kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedAggregateFunctionProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Builtin.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Builtin.java deleted file mode 100644 index 6ed4912ec3f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Builtin.java +++ /dev/null @@ -1,441 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.math.BigDecimal; -import java.time.Duration; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * The Builtin model. - */ -@Immutable -public final class Builtin implements JsonSerializable { - /* - * The boolean property. - */ - private boolean booleanProperty; - - /* - * The string property. - */ - private String string; - - /* - * The bytes property. - */ - private byte[] bytes; - - /* - * The int property. - */ - private int intProperty; - - /* - * The safeint property. - */ - private long safeint; - - /* - * The decimal property. - */ - private BigDecimal decimal; - - /* - * The long property. - */ - private long longProperty; - - /* - * The float property. - */ - private double floatProperty; - - /* - * The double property. - */ - private double doubleProperty; - - /* - * The duration property. - */ - private Duration duration; - - /* - * The date property. - */ - private LocalDate date; - - /* - * The dateTime property. - */ - private OffsetDateTime dateTime; - - /* - * The stringList property. - */ - private List stringList; - - /* - * The bytesDict property. - */ - private Map bytesDict; - - /* - * The url property. - */ - private String url; - - /* - * The nullableFloatDict property. - */ - private Map nullableFloatDict; - - /* - * The encoded property. - */ - private Encoded encoded; - - /* - * The uuid property. - */ - private String uuid; - - /** - * Creates an instance of Builtin class. - */ - private Builtin() { - } - - /** - * Get the booleanProperty property: The boolean property. - * - * @return the booleanProperty value. - */ - public boolean booleanProperty() { - return this.booleanProperty; - } - - /** - * Get the string property: The string property. - * - * @return the string value. - */ - public String string() { - return this.string; - } - - /** - * Get the bytes property: The bytes property. - * - * @return the bytes value. - */ - public byte[] bytes() { - return CoreUtils.clone(this.bytes); - } - - /** - * Get the intProperty property: The int property. - * - * @return the intProperty value. - */ - public int intProperty() { - return this.intProperty; - } - - /** - * Get the safeint property: The safeint property. - * - * @return the safeint value. - */ - public long safeint() { - return this.safeint; - } - - /** - * Get the decimal property: The decimal property. - * - * @return the decimal value. - */ - public BigDecimal decimal() { - return this.decimal; - } - - /** - * Get the longProperty property: The long property. - * - * @return the longProperty value. - */ - public long longProperty() { - return this.longProperty; - } - - /** - * Get the floatProperty property: The float property. - * - * @return the floatProperty value. - */ - public double floatProperty() { - return this.floatProperty; - } - - /** - * Get the doubleProperty property: The double property. - * - * @return the doubleProperty value. - */ - public double doubleProperty() { - return this.doubleProperty; - } - - /** - * Get the duration property: The duration property. - * - * @return the duration value. - */ - public Duration duration() { - return this.duration; - } - - /** - * Get the date property: The date property. - * - * @return the date value. - */ - public LocalDate date() { - return this.date; - } - - /** - * Get the dateTime property: The dateTime property. - * - * @return the dateTime value. - */ - public OffsetDateTime dateTime() { - return this.dateTime; - } - - /** - * Get the stringList property: The stringList property. - * - * @return the stringList value. - */ - public List stringList() { - return this.stringList; - } - - /** - * Get the bytesDict property: The bytesDict property. - * - * @return the bytesDict value. - */ - public Map bytesDict() { - return this.bytesDict; - } - - /** - * Get the url property: The url property. - * - * @return the url value. - */ - public String url() { - return this.url; - } - - /** - * Get the nullableFloatDict property: The nullableFloatDict property. - * - * @return the nullableFloatDict value. - */ - public Map nullableFloatDict() { - return this.nullableFloatDict; - } - - /** - * Get the encoded property: The encoded property. - * - * @return the encoded value. - */ - public Encoded encoded() { - return this.encoded; - } - - /** - * Get the uuid property: The uuid property. - * - * @return the uuid value. - */ - public String uuid() { - return this.uuid; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (string() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property string in model Builtin")); - } - if (bytes() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property bytes in model Builtin")); - } - if (decimal() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property decimal in model Builtin")); - } - if (duration() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property duration in model Builtin")); - } - if (date() == null) { - throw LOGGER.atError().log(new IllegalArgumentException("Missing required property date in model Builtin")); - } - if (dateTime() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property dateTime in model Builtin")); - } - if (stringList() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property stringList in model Builtin")); - } - if (bytesDict() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property bytesDict in model Builtin")); - } - if (url() == null) { - throw LOGGER.atError().log(new IllegalArgumentException("Missing required property url in model Builtin")); - } - if (nullableFloatDict() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property nullableFloatDict in model Builtin")); - } - if (encoded() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property encoded in model Builtin")); - } else { - encoded().validate(); - } - if (uuid() == null) { - throw LOGGER.atError().log(new IllegalArgumentException("Missing required property uuid in model Builtin")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(Builtin.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("boolean", this.booleanProperty); - jsonWriter.writeStringField("string", this.string); - jsonWriter.writeBinaryField("bytes", this.bytes); - jsonWriter.writeIntField("int", this.intProperty); - jsonWriter.writeLongField("safeint", this.safeint); - jsonWriter.writeNumberField("decimal", this.decimal); - jsonWriter.writeLongField("long", this.longProperty); - jsonWriter.writeDoubleField("float", this.floatProperty); - jsonWriter.writeDoubleField("double", this.doubleProperty); - jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); - jsonWriter.writeStringField("date", Objects.toString(this.date, null)); - jsonWriter.writeStringField("dateTime", - this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); - jsonWriter.writeArrayField("stringList", this.stringList, (writer, element) -> writer.writeString(element)); - jsonWriter.writeMapField("bytesDict", this.bytesDict, (writer, element) -> writer.writeBinary(element)); - jsonWriter.writeStringField("url", this.url); - jsonWriter.writeMapField("nullableFloatDict", this.nullableFloatDict, - (writer, element) -> writer.writeNumber(element)); - jsonWriter.writeJsonField("encoded", this.encoded); - jsonWriter.writeStringField("uuid", this.uuid); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Builtin from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Builtin if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Builtin. - */ - public static Builtin fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Builtin deserializedBuiltin = new Builtin(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("boolean".equals(fieldName)) { - deserializedBuiltin.booleanProperty = reader.getBoolean(); - } else if ("string".equals(fieldName)) { - deserializedBuiltin.string = reader.getString(); - } else if ("bytes".equals(fieldName)) { - deserializedBuiltin.bytes = reader.getBinary(); - } else if ("int".equals(fieldName)) { - deserializedBuiltin.intProperty = reader.getInt(); - } else if ("safeint".equals(fieldName)) { - deserializedBuiltin.safeint = reader.getLong(); - } else if ("decimal".equals(fieldName)) { - deserializedBuiltin.decimal - = reader.getNullable(nonNullReader -> new BigDecimal(nonNullReader.getString())); - } else if ("long".equals(fieldName)) { - deserializedBuiltin.longProperty = reader.getLong(); - } else if ("float".equals(fieldName)) { - deserializedBuiltin.floatProperty = reader.getDouble(); - } else if ("double".equals(fieldName)) { - deserializedBuiltin.doubleProperty = reader.getDouble(); - } else if ("duration".equals(fieldName)) { - deserializedBuiltin.duration - = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); - } else if ("date".equals(fieldName)) { - deserializedBuiltin.date - = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); - } else if ("dateTime".equals(fieldName)) { - deserializedBuiltin.dateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("stringList".equals(fieldName)) { - List stringList = reader.readArray(reader1 -> reader1.getString()); - deserializedBuiltin.stringList = stringList; - } else if ("bytesDict".equals(fieldName)) { - Map bytesDict = reader.readMap(reader1 -> reader1.getBinary()); - deserializedBuiltin.bytesDict = bytesDict; - } else if ("url".equals(fieldName)) { - deserializedBuiltin.url = reader.getString(); - } else if ("nullableFloatDict".equals(fieldName)) { - Map nullableFloatDict - = reader.readMap(reader1 -> reader1.getNullable(JsonReader::getDouble)); - deserializedBuiltin.nullableFloatDict = nullableFloatDict; - } else if ("encoded".equals(fieldName)) { - deserializedBuiltin.encoded = Encoded.fromJson(reader); - } else if ("uuid".equals(fieldName)) { - deserializedBuiltin.uuid = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedBuiltin; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Dog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Dog.java deleted file mode 100644 index 819912d4a99..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Dog.java +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Test extensible enum type for discriminator. - */ -@Immutable -public class Dog implements JsonSerializable { - /* - * discriminator property - */ - private DogKind kind = DogKind.fromString("Dog"); - - /* - * Weight of the dog - */ - private int weight; - - /* - * dna of the dog - */ - private String dna; - - /** - * Creates an instance of Dog class. - */ - protected Dog() { - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - public DogKind kind() { - return this.kind; - } - - /** - * Get the weight property: Weight of the dog. - * - * @return the weight value. - */ - public int weight() { - return this.weight; - } - - /** - * Set the weight property: Weight of the dog. - * - * @param weight the weight value to set. - * @return the Dog object itself. - */ - Dog withWeight(int weight) { - this.weight = weight; - return this; - } - - /** - * Get the dna property: dna of the dog. - * - * @return the dna value. - */ - public String dna() { - return this.dna; - } - - /** - * Set the dna property: dna of the dog. - * - * @param dna the dna value to set. - * @return the Dog object itself. - */ - Dog withDna(String dna) { - this.dna = dna; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("weight", this.weight); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Dog from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Dog if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Dog. - */ - public static Dog fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("golden".equals(discriminatorValue)) { - return Golden.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - static Dog fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Dog deserializedDog = new Dog(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("weight".equals(fieldName)) { - deserializedDog.weight = reader.getInt(); - } else if ("dna".equals(fieldName)) { - deserializedDog.dna = reader.getString(); - } else if ("kind".equals(fieldName)) { - deserializedDog.kind = DogKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedDog; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/DogKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/DogKind.java deleted file mode 100644 index 92d015749b6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/DogKind.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * extensible enum type for discriminator. - */ -public final class DogKind extends ExpandableStringEnum { - /** - * Species golden. - */ - public static final DogKind GOLDEN = fromString("golden"); - - /** - * Creates a new instance of DogKind value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public DogKind() { - } - - /** - * Creates or finds a DogKind from its string representation. - * - * @param name a name to look for. - * @return the corresponding DogKind. - */ - public static DogKind fromString(String name) { - return fromString(name, DogKind.class); - } - - /** - * Gets known DogKind values. - * - * @return known DogKind values. - */ - public static Collection values() { - return values(DogKind.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Encoded.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Encoded.java deleted file mode 100644 index 9588c592228..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Encoded.java +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.Base64Url; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; -import java.time.Instant; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.util.Objects; - -/** - * The Encoded model. - */ -@Immutable -public final class Encoded implements JsonSerializable { - private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; - - /* - * The timeInSeconds property. - */ - private Long timeInSeconds; - - /* - * The timeInSecondsPrimitive property. - */ - private long timeInSecondsPrimitive; - - /* - * The timeInSecondsFraction property. - */ - private Double timeInSecondsFraction; - - /* - * The timeInSecondsFractionPrimitive property. - */ - private double timeInSecondsFractionPrimitive; - - /* - * The dateTime property. - */ - private OffsetDateTime dateTime; - - /* - * The dateTimeRfc7231 property. - */ - private DateTimeRfc1123 dateTimeRfc7231; - - /* - * The unixTimestamp property. - */ - private Long unixTimestamp; - - /* - * The unixTimestampPrimitive property. - */ - private long unixTimestampPrimitive; - - /* - * The base64 property. - */ - private byte[] base64; - - /* - * The base64url property. - */ - private Base64Url base64url; - - /* - * The unknownDurationFormat property. - */ - private String unknownDurationFormat; - - /* - * The unknownDateTimeFormat property. - */ - private String unknownDateTimeFormat; - - /* - * The unknownBytes property. - */ - private String unknownBytes; - - /** - * Creates an instance of Encoded class. - */ - private Encoded() { - } - - /** - * Get the timeInSeconds property: The timeInSeconds property. - * - * @return the timeInSeconds value. - */ - public Duration timeInSeconds() { - if (this.timeInSeconds == null) { - return null; - } - return Duration.ofSeconds(this.timeInSeconds); - } - - /** - * Get the timeInSecondsPrimitive property: The timeInSecondsPrimitive property. - * - * @return the timeInSecondsPrimitive value. - */ - public Duration timeInSecondsPrimitive() { - return Duration.ofSeconds(this.timeInSecondsPrimitive); - } - - /** - * Get the timeInSecondsFraction property: The timeInSecondsFraction property. - * - * @return the timeInSecondsFraction value. - */ - public Duration timeInSecondsFraction() { - if (this.timeInSecondsFraction == null) { - return null; - } - return Duration.ofNanos((long) (this.timeInSecondsFraction * 1000_000_000L)); - } - - /** - * Get the timeInSecondsFractionPrimitive property: The timeInSecondsFractionPrimitive property. - * - * @return the timeInSecondsFractionPrimitive value. - */ - public Duration timeInSecondsFractionPrimitive() { - return Duration.ofNanos((long) (this.timeInSecondsFractionPrimitive * 1000_000_000L)); - } - - /** - * Get the dateTime property: The dateTime property. - * - * @return the dateTime value. - */ - public OffsetDateTime dateTime() { - return this.dateTime; - } - - /** - * Get the dateTimeRfc7231 property: The dateTimeRfc7231 property. - * - * @return the dateTimeRfc7231 value. - */ - public OffsetDateTime dateTimeRfc7231() { - if (this.dateTimeRfc7231 == null) { - return null; - } - return this.dateTimeRfc7231.getDateTime(); - } - - /** - * Get the unixTimestamp property: The unixTimestamp property. - * - * @return the unixTimestamp value. - */ - public OffsetDateTime unixTimestamp() { - if (this.unixTimestamp == null) { - return null; - } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.unixTimestamp), ZoneOffset.UTC); - } - - /** - * Get the unixTimestampPrimitive property: The unixTimestampPrimitive property. - * - * @return the unixTimestampPrimitive value. - */ - public OffsetDateTime unixTimestampPrimitive() { - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.unixTimestampPrimitive), ZoneOffset.UTC); - } - - /** - * Get the base64 property: The base64 property. - * - * @return the base64 value. - */ - public byte[] base64() { - return CoreUtils.clone(this.base64); - } - - /** - * Get the base64url property: The base64url property. - * - * @return the base64url value. - */ - public byte[] base64url() { - if (this.base64url == null) { - return EMPTY_BYTE_ARRAY; - } - return this.base64url.decodedBytes(); - } - - /** - * Get the unknownDurationFormat property: The unknownDurationFormat property. - * - * @return the unknownDurationFormat value. - */ - public String unknownDurationFormat() { - return this.unknownDurationFormat; - } - - /** - * Get the unknownDateTimeFormat property: The unknownDateTimeFormat property. - * - * @return the unknownDateTimeFormat value. - */ - public String unknownDateTimeFormat() { - return this.unknownDateTimeFormat; - } - - /** - * Get the unknownBytes property: The unknownBytes property. - * - * @return the unknownBytes value. - */ - public String unknownBytes() { - return this.unknownBytes; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (timeInSecondsPrimitive() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property timeInSecondsPrimitive in model Encoded")); - } - if (timeInSecondsFractionPrimitive() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property timeInSecondsFractionPrimitive in model Encoded")); - } - if (unixTimestampPrimitive() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property unixTimestampPrimitive in model Encoded")); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(Encoded.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeLongField("timeInSecondsPrimitive", this.timeInSecondsPrimitive); - jsonWriter.writeDoubleField("timeInSecondsFractionPrimitive", this.timeInSecondsFractionPrimitive); - jsonWriter.writeLongField("unixTimestampPrimitive", this.unixTimestampPrimitive); - jsonWriter.writeNumberField("timeInSeconds", this.timeInSeconds); - jsonWriter.writeNumberField("timeInSecondsFraction", this.timeInSecondsFraction); - jsonWriter.writeStringField("dateTime", - this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); - jsonWriter.writeStringField("dateTimeRfc7231", Objects.toString(this.dateTimeRfc7231, null)); - jsonWriter.writeNumberField("unixTimestamp", this.unixTimestamp); - jsonWriter.writeBinaryField("base64", this.base64); - jsonWriter.writeStringField("base64url", Objects.toString(this.base64url, null)); - jsonWriter.writeStringField("unknownDurationFormat", this.unknownDurationFormat); - jsonWriter.writeStringField("unknownDateTimeFormat", this.unknownDateTimeFormat); - jsonWriter.writeStringField("unknownBytes", this.unknownBytes); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Encoded from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Encoded if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Encoded. - */ - public static Encoded fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Encoded deserializedEncoded = new Encoded(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("timeInSecondsPrimitive".equals(fieldName)) { - deserializedEncoded.timeInSecondsPrimitive = reader.getLong(); - } else if ("timeInSecondsFractionPrimitive".equals(fieldName)) { - deserializedEncoded.timeInSecondsFractionPrimitive = reader.getDouble(); - } else if ("unixTimestampPrimitive".equals(fieldName)) { - deserializedEncoded.unixTimestampPrimitive = reader.getLong(); - } else if ("timeInSeconds".equals(fieldName)) { - deserializedEncoded.timeInSeconds = reader.getNullable(JsonReader::getLong); - } else if ("timeInSecondsFraction".equals(fieldName)) { - deserializedEncoded.timeInSecondsFraction = reader.getNullable(JsonReader::getDouble); - } else if ("dateTime".equals(fieldName)) { - deserializedEncoded.dateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("dateTimeRfc7231".equals(fieldName)) { - deserializedEncoded.dateTimeRfc7231 - = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); - } else if ("unixTimestamp".equals(fieldName)) { - deserializedEncoded.unixTimestamp = reader.getNullable(JsonReader::getLong); - } else if ("base64".equals(fieldName)) { - deserializedEncoded.base64 = reader.getBinary(); - } else if ("base64url".equals(fieldName)) { - deserializedEncoded.base64url - = reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); - } else if ("unknownDurationFormat".equals(fieldName)) { - deserializedEncoded.unknownDurationFormat = reader.getString(); - } else if ("unknownDateTimeFormat".equals(fieldName)) { - deserializedEncoded.unknownDateTimeFormat = reader.getString(); - } else if ("unknownBytes".equals(fieldName)) { - deserializedEncoded.unknownBytes = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedEncoded; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Error.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Error.java deleted file mode 100644 index 693b29dbd74..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Error.java +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.management.exception.AdditionalInfo; -import com.azure.core.management.exception.ManagementError; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The Error model. - */ -@Immutable -public final class Error extends ManagementError { - /* - * The details property. - */ - private List details; - - /* - * The additionalProperty property. - */ - private String additionalProperty; - - /* - * Additional info for the error. - */ - private List additionalInfo; - - /* - * The target of the error. - */ - private String target; - - /* - * The error message parsed from the body of the http error response. - */ - private String message; - - /* - * The error code parsed from the body of the http error response. - */ - private String code; - - /** - * Creates an instance of Error class. - */ - private Error() { - } - - /** - * Get the details property: The details property. - * - * @return the details value. - */ - @Override - public List getDetails() { - return this.details; - } - - /** - * Get the additionalProperty property: The additionalProperty property. - * - * @return the additionalProperty value. - */ - public String getAdditionalProperty() { - return this.additionalProperty; - } - - /** - * Get the additionalInfo property: Additional info for the error. - * - * @return the additionalInfo value. - */ - @Override - public List getAdditionalInfo() { - return this.additionalInfo; - } - - /** - * Get the target property: The target of the error. - * - * @return the target value. - */ - @Override - public String getTarget() { - return this.target; - } - - /** - * Get the message property: The error message parsed from the body of the http error response. - * - * @return the message value. - */ - @Override - public String getMessage() { - return this.message; - } - - /** - * Get the code property: The error code parsed from the body of the http error response. - * - * @return the code value. - */ - @Override - public String getCode() { - return this.code; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (getDetails() != null) { - getDetails().forEach(e -> e.validate()); - } - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Error from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Error if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Error. - */ - public static Error fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - JsonReader bufferedReader = reader.bufferObject(); - bufferedReader.nextToken(); - while (bufferedReader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = bufferedReader.getFieldName(); - bufferedReader.nextToken(); - - if ("error".equals(fieldName)) { - return readManagementError(bufferedReader); - } else { - bufferedReader.skipChildren(); - } - } - return readManagementError(bufferedReader.reset()); - }); - } - - private static Error readManagementError(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Error deserializedError = new Error(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("code".equals(fieldName)) { - deserializedError.code = reader.getString(); - } else if ("message".equals(fieldName)) { - deserializedError.message = reader.getString(); - } else if ("target".equals(fieldName)) { - deserializedError.target = reader.getString(); - } else if ("additionalInfo".equals(fieldName)) { - List additionalInfo = reader.readArray(reader1 -> AdditionalInfo.fromJson(reader1)); - deserializedError.additionalInfo = additionalInfo; - } else if ("additionalProperty".equals(fieldName)) { - deserializedError.additionalProperty = reader.getString(); - } else if ("details".equals(fieldName)) { - List details = reader.readArray(reader1 -> Error.fromJson(reader1)); - deserializedError.details = details; - } else { - reader.skipChildren(); - } - } - - return deserializedError; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorException.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorException.java deleted file mode 100644 index e07c1f64bbb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorException.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.http.HttpResponse; -import com.azure.core.management.exception.ManagementException; - -/** - * Exception thrown for an invalid response with Error information. - */ -public final class ErrorException extends ManagementException { - /** - * Initializes a new instance of the ErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - */ - public ErrorException(String message, HttpResponse response) { - super(message, response); - } - - /** - * Initializes a new instance of the ErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - * @param value the deserialized response value. - */ - public ErrorException(String message, HttpResponse response, Error value) { - super(message, response, value); - } - - /** - * {@inheritDoc} - */ - @Override - public Error getValue() { - return (Error) super.getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMin.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMin.java deleted file mode 100644 index 13dec084a22..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMin.java +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.management.exception.AdditionalInfo; -import com.azure.core.management.exception.ManagementError; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The ErrorMin model. - */ -@Immutable -public final class ErrorMin extends ManagementError { - /* - * The additionalProperty property. - */ - private String additionalProperty; - - /* - * Additional info for the error. - */ - private List additionalInfo; - - /* - * Details for the error. - */ - private List details; - - /* - * The target of the error. - */ - private String target; - - /* - * The error message parsed from the body of the http error response. - */ - private String message; - - /* - * The error code parsed from the body of the http error response. - */ - private String code; - - /** - * Creates an instance of ErrorMin class. - */ - private ErrorMin() { - } - - /** - * Get the additionalProperty property: The additionalProperty property. - * - * @return the additionalProperty value. - */ - public String getAdditionalProperty() { - return this.additionalProperty; - } - - /** - * Get the additionalInfo property: Additional info for the error. - * - * @return the additionalInfo value. - */ - @Override - public List getAdditionalInfo() { - return this.additionalInfo; - } - - /** - * Get the details property: Details for the error. - * - * @return the details value. - */ - @Override - public List getDetails() { - return this.details; - } - - /** - * Get the target property: The target of the error. - * - * @return the target value. - */ - @Override - public String getTarget() { - return this.target; - } - - /** - * Get the message property: The error message parsed from the body of the http error response. - * - * @return the message value. - */ - @Override - public String getMessage() { - return this.message; - } - - /** - * Get the code property: The error code parsed from the body of the http error response. - * - * @return the code value. - */ - @Override - public String getCode() { - return this.code; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ErrorMin from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ErrorMin if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ErrorMin. - */ - public static ErrorMin fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - JsonReader bufferedReader = reader.bufferObject(); - bufferedReader.nextToken(); - while (bufferedReader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = bufferedReader.getFieldName(); - bufferedReader.nextToken(); - - if ("error".equals(fieldName)) { - return readManagementError(bufferedReader); - } else { - bufferedReader.skipChildren(); - } - } - return readManagementError(bufferedReader.reset()); - }); - } - - private static ErrorMin readManagementError(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ErrorMin deserializedErrorMin = new ErrorMin(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("code".equals(fieldName)) { - deserializedErrorMin.code = reader.getString(); - } else if ("message".equals(fieldName)) { - deserializedErrorMin.message = reader.getString(); - } else if ("target".equals(fieldName)) { - deserializedErrorMin.target = reader.getString(); - } else if ("details".equals(fieldName)) { - List details = reader.readArray(reader1 -> ManagementError.fromJson(reader1)); - deserializedErrorMin.details = details; - } else if ("additionalInfo".equals(fieldName)) { - List additionalInfo = reader.readArray(reader1 -> AdditionalInfo.fromJson(reader1)); - deserializedErrorMin.additionalInfo = additionalInfo; - } else if ("additionalProperty".equals(fieldName)) { - deserializedErrorMin.additionalProperty = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedErrorMin; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMinException.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMinException.java deleted file mode 100644 index dc7fb38acd1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMinException.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.http.HttpResponse; -import com.azure.core.management.exception.ManagementException; - -/** - * Exception thrown for an invalid response with ErrorMin information. - */ -public final class ErrorMinException extends ManagementException { - /** - * Initializes a new instance of the ErrorMinException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - */ - public ErrorMinException(String message, HttpResponse response) { - super(message, response); - } - - /** - * Initializes a new instance of the ErrorMinException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - * @param value the deserialized response value. - */ - public ErrorMinException(String message, HttpResponse response, ErrorMin value) { - super(message, response, value); - } - - /** - * {@inheritDoc} - */ - @Override - public ErrorMin getValue() { - return (ErrorMin) super.getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fish.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fish.java deleted file mode 100644 index 70ae407fc92..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fish.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import tsptest.armstreamstyleserialization.fluent.models.FishInner; - -/** - * An immutable client-side representation of Fish. - */ -public interface Fish { - /** - * Gets the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - String kind(); - - /** - * Gets the age property: The age property. - * - * @return the age value. - */ - int age(); - - /** - * Gets the dna property: The dna property. - * - * @return the dna value. - */ - String dna(); - - /** - * Gets the length property: The length property. - * - * @return the length value. - */ - double length(); - - /** - * Gets the patten property: The patten property. - * - * @return the patten value. - */ - String patten(); - - /** - * Gets the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - String requiredString(); - - /** - * Gets the lengthAnotherPropertiesLength property: The length property. - * - * @return the lengthAnotherPropertiesLength value. - */ - double lengthAnotherPropertiesLength(); - - /** - * Gets the pattenAnotherPropertiesPatten property: The patten property. - * - * @return the pattenAnotherPropertiesPatten value. - */ - String pattenAnotherPropertiesPatten(); - - /** - * Gets the requiredStringAnotherPropertiesRequiredString property: The requiredString property. - * - * @return the requiredStringAnotherPropertiesRequiredString value. - */ - String requiredStringAnotherPropertiesRequiredString(); - - /** - * Gets the inner tsptest.armstreamstyleserialization.fluent.models.FishInner object. - * - * @return the inner object. - */ - FishInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fishes.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fishes.java deleted file mode 100644 index a08020c3b28..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fishes.java +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import tsptest.armstreamstyleserialization.fluent.models.FishInner; - -/** - * Resource collection API of Fishes. - */ -public interface Fishes { - /** - * The getModel operation. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws tsptest.armstreamstyleserialization.models.ErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - Response getModelWithResponse(Context context); - - /** - * The getModel operation. - * - * @throws tsptest.armstreamstyleserialization.models.ErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - Fish getModel(); - - /** - * The putModel operation. - * - * @param fish The fish parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws tsptest.armstreamstyleserialization.models.ErrorMinException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - Response putModelWithResponse(FishInner fish, Context context); - - /** - * The putModel operation. - * - * @param fish The fish parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws tsptest.armstreamstyleserialization.models.ErrorMinException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - Fish putModel(FishInner fish); - - /** - * The getOutputOnlyModel operation. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic OutputOnlyModel along with {@link Response}. - */ - Response getOutputOnlyModelWithResponse(Context context); - - /** - * The getOutputOnlyModel operation. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic OutputOnlyModel. - */ - OutputOnlyModel getOutputOnlyModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Function.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Function.java deleted file mode 100644 index 5c4c3e3902a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Function.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; - -/** - * An immutable client-side representation of Function. - */ -public interface Function { - /** - * Gets the properties property: The properties property. - * - * @return the properties value. - */ - FunctionProperties properties(); - - /** - * Gets the inner tsptest.armstreamstyleserialization.fluent.models.FunctionInner object. - * - * @return the inner object. - */ - FunctionInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionProperties.java deleted file mode 100644 index 13df2e20bb0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionProperties.java +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armstreamstyleserialization.fluent.models.FunctionConfiguration; - -/** - * The FunctionProperties model. - */ -@Fluent -public class FunctionProperties implements JsonSerializable { - /* - * Discriminator property for FunctionProperties. - */ - private String kind = "FunctionProperties"; - - /* - * The properties property. - */ - private FunctionConfiguration innerProperties = new FunctionConfiguration(); - - /** - * Creates an instance of FunctionProperties class. - */ - public FunctionProperties() { - } - - /** - * Get the kind property: Discriminator property for FunctionProperties. - * - * @return the kind value. - */ - public String kind() { - return this.kind; - } - - /** - * Get the innerProperties property: The properties property. - * - * @return the innerProperties value. - */ - FunctionConfiguration innerProperties() { - return this.innerProperties; - } - - /** - * Set the innerProperties property: The properties property. - * - * @param innerProperties the innerProperties value to set. - * @return the FunctionProperties object itself. - */ - FunctionProperties withInnerProperties(FunctionConfiguration innerProperties) { - this.innerProperties = innerProperties; - return this; - } - - /** - * Get the input property: The input property. - * - * @return the input value. - */ - public String input() { - return this.innerProperties() == null ? null : this.innerProperties().input(); - } - - /** - * Set the input property: The input property. - * - * @param input the input value to set. - * @return the FunctionProperties object itself. - */ - public FunctionProperties withInput(String input) { - if (this.innerProperties() == null) { - this.withInnerProperties(new FunctionConfiguration()); - } - this.innerProperties().withInput(input); - return this; - } - - /** - * Get the output property: The output property. - * - * @return the output value. - */ - public String output() { - return this.innerProperties() == null ? null : this.innerProperties().output(); - } - - /** - * Set the output property: The output property. - * - * @param output the output value to set. - * @return the FunctionProperties object itself. - */ - public FunctionProperties withOutput(String output) { - if (this.innerProperties() == null) { - this.withInnerProperties(new FunctionConfiguration()); - } - this.innerProperties().withOutput(output); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property innerProperties in model FunctionProperties")); - } else { - innerProperties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(FunctionProperties.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("properties", this.innerProperties); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FunctionProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FunctionProperties if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FunctionProperties. - */ - public static FunctionProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("aggregate".equals(discriminatorValue)) { - return AggregateFunctionProperties.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - static FunctionProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - FunctionProperties deserializedFunctionProperties = new FunctionProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("properties".equals(fieldName)) { - deserializedFunctionProperties.innerProperties = FunctionConfiguration.fromJson(reader); - } else if ("kind".equals(fieldName)) { - deserializedFunctionProperties.kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedFunctionProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Functions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Functions.java deleted file mode 100644 index d9779dc3d10..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Functions.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; - -/** - * Resource collection API of Functions. - */ -public interface Functions { - /** - * The createFunction operation. - * - * @param function The function parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - Response createFunctionWithResponse(FunctionInner function, Context context); - - /** - * The createFunction operation. - * - * @param function The function parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - Function createFunction(FunctionInner function); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionHeaders.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionHeaders.java deleted file mode 100644 index 597ee72d69b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionHeaders.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; - -/** - * The FunctionsCreateFunctionHeaders model. - */ -@Immutable -public final class FunctionsCreateFunctionHeaders { - /* - * The ETag property. - */ - private final String etag; - - // HttpHeaders containing the raw property values. - /** - * Creates an instance of FunctionsCreateFunctionHeaders class. - * - * @param rawHeaders The raw HttpHeaders that will be used to create the property values. - */ - public FunctionsCreateFunctionHeaders(HttpHeaders rawHeaders) { - this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); - } - - /** - * Get the etag property: The ETag property. - * - * @return the etag value. - */ - public String etag() { - return this.etag; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionResponse.java deleted file mode 100644 index 0d593fb3ef5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionResponse.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; -import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; - -/** - * Contains all response data for the createFunction operation. - */ -public final class FunctionsCreateFunctionResponse extends ResponseBase { - /** - * Creates an instance of FunctionsCreateFunctionResponse. - * - * @param request the request which resulted in this FunctionsCreateFunctionResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public FunctionsCreateFunctionResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, - FunctionInner value, FunctionsCreateFunctionHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * Gets the deserialized response body. - * - * @return the deserialized response body. - */ - @Override - public FunctionInner getValue() { - return super.getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/GoblinShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/GoblinShark.java deleted file mode 100644 index e1645e48e6d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/GoblinShark.java +++ /dev/null @@ -1,291 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armstreamstyleserialization.fluent.models.AnotherFishProperties; -import tsptest.armstreamstyleserialization.fluent.models.FishProperties; - -/** - * The third level model GoblinShark in polymorphic multiple levels inheritance. - */ -@Fluent -public final class GoblinShark extends Shark { - /* - * Discriminator property for Fish. - */ - private String kind = "shark"; - - /* - * The sharktype property. - */ - private String sharktype = "goblin"; - - /* - * The anotherProperties property. - */ - private AnotherFishProperties innerAnotherProperties = new AnotherFishProperties(); - - /* - * The properties property. - */ - private FishProperties innerProperties = new FishProperties(); - - /* - * The dna property. - */ - private String dna; - - /** - * Creates an instance of GoblinShark class. - */ - public GoblinShark() { - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Override - public String kind() { - return this.kind; - } - - /** - * Get the sharktype property: The sharktype property. - * - * @return the sharktype value. - */ - @Override - public String sharktype() { - return this.sharktype; - } - - /** - * Get the innerAnotherProperties property: The anotherProperties property. - * - * @return the innerAnotherProperties value. - */ - private AnotherFishProperties innerAnotherProperties() { - return this.innerAnotherProperties; - } - - /** - * Get the innerProperties property: The properties property. - * - * @return the innerProperties value. - */ - private FishProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the dna property: The dna property. - * - * @return the dna value. - */ - @Override - public String dna() { - return this.dna; - } - - /** - * {@inheritDoc} - */ - @Override - public GoblinShark withAge(int age) { - super.withAge(age); - return this; - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double length() { - return this.innerProperties() == null ? 0.0 : this.innerProperties().length(); - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the GoblinShark object itself. - */ - public GoblinShark withLength(double length) { - if (this.innerProperties() == null) { - this.innerProperties = new FishProperties(); - } - this.innerProperties().withLength(length); - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String patten() { - return this.innerProperties() == null ? null : this.innerProperties().patten(); - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredString() { - return this.innerProperties() == null ? null : this.innerProperties().requiredString(); - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the GoblinShark object itself. - */ - public GoblinShark withRequiredString(String requiredString) { - if (this.innerProperties() == null) { - this.innerProperties = new FishProperties(); - } - this.innerProperties().withRequiredString(requiredString); - return this; - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double lengthAnotherPropertiesLength() { - return this.innerAnotherProperties() == null ? 0.0 : this.innerAnotherProperties().length(); - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the GoblinShark object itself. - */ - public GoblinShark withLengthAnotherPropertiesLength(double length) { - if (this.innerAnotherProperties() == null) { - this.innerAnotherProperties = new AnotherFishProperties(); - } - this.innerAnotherProperties().withLength(length); - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String pattenAnotherPropertiesPatten() { - return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().patten(); - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredStringAnotherPropertiesRequiredString() { - return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().requiredString(); - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the GoblinShark object itself. - */ - public GoblinShark withRequiredStringAnotherPropertiesRequiredString(String requiredString) { - if (this.innerAnotherProperties() == null) { - this.innerAnotherProperties = new AnotherFishProperties(); - } - this.innerAnotherProperties().withRequiredString(requiredString); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - if (innerProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property innerProperties in model GoblinShark")); - } else { - innerProperties().validate(); - } - if (innerAnotherProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property innerAnotherProperties in model GoblinShark")); - } else { - innerAnotherProperties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(GoblinShark.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeIntField("age", age()); - jsonWriter.writeJsonField("properties", innerProperties()); - jsonWriter.writeJsonField("anotherProperties", innerAnotherProperties()); - jsonWriter.writeStringField("sharktype", this.sharktype); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GoblinShark from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GoblinShark if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GoblinShark. - */ - public static GoblinShark fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GoblinShark deserializedGoblinShark = new GoblinShark(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - deserializedGoblinShark.withAge(reader.getInt()); - } else if ("dna".equals(fieldName)) { - deserializedGoblinShark.dna = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedGoblinShark.innerProperties = FishProperties.fromJson(reader); - } else if ("anotherProperties".equals(fieldName)) { - deserializedGoblinShark.innerAnotherProperties = AnotherFishProperties.fromJson(reader); - } else if ("sharktype".equals(fieldName)) { - deserializedGoblinShark.sharktype = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedGoblinShark; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Golden.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Golden.java deleted file mode 100644 index 09e38f38c3a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Golden.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Golden dog model. - */ -@Immutable -public final class Golden extends Dog { - /* - * discriminator property - */ - private DogKind kind = DogKind.GOLDEN; - - /** - * Creates an instance of Golden class. - */ - private Golden() { - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - @Override - public DogKind kind() { - return this.kind; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("weight", weight()); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Golden from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Golden if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Golden. - */ - public static Golden fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Golden deserializedGolden = new Golden(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("weight".equals(fieldName)) { - deserializedGolden.withWeight(reader.getInt()); - } else if ("dna".equals(fieldName)) { - deserializedGolden.withDna(reader.getString()); - } else if ("kind".equals(fieldName)) { - deserializedGolden.kind = DogKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedGolden; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Items.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Items.java deleted file mode 100644 index 819aef6f3a4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Items.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Context; - -/** - * Resource collection API of Items. - */ -public interface Items { - /** - * The list operation. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - PagedIterable list(); - - /** - * The list operation. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - PagedIterable list(Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModel.java deleted file mode 100644 index 2e3ef65afde..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModel.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner; - -/** - * An immutable client-side representation of OutputOnlyModel. - */ -public interface OutputOnlyModel { - /** - * Gets the kind property: Discriminator property for OutputOnlyModel. - * - * @return the kind value. - */ - String kind(); - - /** - * Gets the name property: The name property. - * - * @return the name value. - */ - String name(); - - /** - * Gets the id property: The id property. - * - * @return the id value. - */ - String id(); - - /** - * Gets the title property: The title property. - * - * @return the title value. - */ - String title(); - - /** - * Gets the dog property: The dog property. - * - * @return the dog value. - */ - Golden dog(); - - /** - * Gets the inner tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner object. - * - * @return the inner object. - */ - OutputOnlyModelInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModelChild.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModelChild.java deleted file mode 100644 index a212bdc7628..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModelChild.java +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner; -import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelProperties; - -/** - * The OutputOnlyModelChild model. - */ -@Immutable -public final class OutputOnlyModelChild extends OutputOnlyModelInner { - /* - * Discriminator property for OutputOnlyModel. - */ - private String kind = "child"; - - /* - * The childName property. - */ - private String childName; - - /* - * The properties property. - */ - private OutputOnlyModelProperties innerProperties; - - /* - * The id property. - */ - private String id; - - /* - * The name property. - */ - private String name; - - /** - * Creates an instance of OutputOnlyModelChild class. - */ - private OutputOnlyModelChild() { - } - - /** - * Get the kind property: Discriminator property for OutputOnlyModel. - * - * @return the kind value. - */ - @Override - public String kind() { - return this.kind; - } - - /** - * Get the childName property: The childName property. - * - * @return the childName value. - */ - public String childName() { - return this.childName; - } - - /** - * Get the innerProperties property: The properties property. - * - * @return the innerProperties value. - */ - private OutputOnlyModelProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the title property: The title property. - * - * @return the title value. - */ - public String title() { - return this.innerProperties() == null ? null : this.innerProperties().title(); - } - - /** - * Get the dog property: The dog property. - * - * @return the dog value. - */ - public Golden dog() { - return this.innerProperties() == null ? null : this.innerProperties().dog(); - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - if (childName() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property childName in model OutputOnlyModelChild")); - } - if (name() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property name in model OutputOnlyModelChild")); - } - if (innerProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property innerProperties in model OutputOnlyModelChild")); - } else { - innerProperties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(OutputOnlyModelChild.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", name()); - jsonWriter.writeJsonField("properties", innerProperties()); - jsonWriter.writeStringField("childName", this.childName); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OutputOnlyModelChild from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OutputOnlyModelChild if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OutputOnlyModelChild. - */ - public static OutputOnlyModelChild fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OutputOnlyModelChild deserializedOutputOnlyModelChild = new OutputOnlyModelChild(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedOutputOnlyModelChild.name = reader.getString(); - } else if ("id".equals(fieldName)) { - deserializedOutputOnlyModelChild.id = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedOutputOnlyModelChild.innerProperties = OutputOnlyModelProperties.fromJson(reader); - } else if ("childName".equals(fieldName)) { - deserializedOutputOnlyModelChild.childName = reader.getString(); - } else if ("kind".equals(fieldName)) { - deserializedOutputOnlyModelChild.kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOutputOnlyModelChild; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priorities.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priorities.java deleted file mode 100644 index 3c871f2f8e0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priorities.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of Priorities. - */ -public interface Priorities { - /** - * The setPriority operation. - * - * @param priority The priority parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response}. - */ - Response setPriorityWithResponse(Priority priority, Context context); - - /** - * The setPriority operation. - * - * @param priority The priority parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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. - */ - Priority setPriority(Priority priority); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priority.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priority.java deleted file mode 100644 index 108963231d1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priority.java +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.util.ExpandableEnum; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.Function; - -/** - * Defines values for Priority. - */ -public final class Priority implements ExpandableEnum, JsonSerializable { - private static final Map VALUES = new ConcurrentHashMap<>(); - - private static final Function NEW_INSTANCE = Priority::new; - - /** - * high priority. - */ - public static final Priority HIGH = fromValue(0); - - /** - * low priority. - */ - public static final Priority LOW = fromValue(1); - - private final Integer value; - - private Priority(Integer value) { - this.value = value; - } - - /** - * Creates or finds a Priority. - * - * @param value a value to look for. - * @return the corresponding Priority. - * @throws IllegalArgumentException if value is null. - */ - public static Priority fromValue(Integer value) { - if (value == null) { - throw new IllegalArgumentException("'value' cannot be null."); - } - return VALUES.computeIfAbsent(value, NEW_INSTANCE); - } - - /** - * Gets known Priority values. - * - * @return Known Priority values. - */ - public static Collection values() { - return new ArrayList<>(VALUES.values()); - } - - /** - * Gets the value of the Priority instance. - * - * @return the value of the Priority instance. - */ - @Override - public Integer getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeInt(getValue()); - } - - /** - * Reads an instance of Priority from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Priority if the JsonReader was pointing to an instance of it, or null if the JsonReader - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the Priority. - * @throws IllegalStateException If unexpected JSON token is found. - */ - public static Priority fromJson(JsonReader jsonReader) throws IOException { - JsonToken nextToken = jsonReader.nextToken(); - if (nextToken == JsonToken.NULL) { - return null; - } - if (nextToken != JsonToken.NUMBER) { - throw new IllegalStateException( - String.format("Unexpected JSON token for %s deserialization: %s", JsonToken.NUMBER, nextToken)); - } - return Priority.fromValue(jsonReader.getInt()); - } - - @Override - public String toString() { - return Objects.toString(this.value); - } - - @Override - public boolean equals(Object obj) { - return this == obj; - } - - @Override - public int hashCode() { - return Objects.hashCode(this.value); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Result.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Result.java deleted file mode 100644 index 2b17d99ebc6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Result.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armstreamstyleserialization.fluent.models.ResultData; - -/** - * The Result model. - */ -@Immutable -public final class Result implements JsonSerializable { - /* - * The name property. - */ - private String name; - - /* - * The data property. - */ - private ResultData innerData; - - /** - * Creates an instance of Result class. - */ - private Result() { - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the innerData property: The data property. - * - * @return the innerData value. - */ - private ResultData innerData() { - return this.innerData; - } - - /** - * Get the prop1 property: The prop1 property. - * - * @return the prop1 value. - */ - public String prop1() { - return this.innerData() == null ? null : this.innerData().prop1(); - } - - /** - * Get the prop2 property: The prop2 property. - * - * @return the prop2 value. - */ - public String prop2() { - return this.innerData() == null ? null : this.innerData().prop2(); - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (name() == null) { - throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Result")); - } - if (innerData() != null) { - innerData().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(Result.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Result from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Result if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Result. - */ - public static Result fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Result deserializedResult = new Result(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedResult.name = reader.getString(); - } else if ("data".equals(fieldName)) { - deserializedResult.innerData = ResultData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Salmon.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Salmon.java deleted file mode 100644 index 474c400776a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Salmon.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import java.util.List; -import java.util.Map; -import tsptest.armstreamstyleserialization.fluent.models.SalmonInner; - -/** - * An immutable client-side representation of Salmon. - */ -public interface Salmon { - /** - * Gets the age property: The age property. - * - * @return the age value. - */ - int age(); - - /** - * Gets the dna property: The dna property. - * - * @return the dna value. - */ - String dna(); - - /** - * Gets the length property: The length property. - * - * @return the length value. - */ - double length(); - - /** - * Gets the patten property: The patten property. - * - * @return the patten value. - */ - String patten(); - - /** - * Gets the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - String requiredString(); - - /** - * Gets the lengthAnotherPropertiesLength property: The length property. - * - * @return the lengthAnotherPropertiesLength value. - */ - double lengthAnotherPropertiesLength(); - - /** - * Gets the pattenAnotherPropertiesPatten property: The patten property. - * - * @return the pattenAnotherPropertiesPatten value. - */ - String pattenAnotherPropertiesPatten(); - - /** - * Gets the requiredStringAnotherPropertiesRequiredString property: The requiredString property. - * - * @return the requiredStringAnotherPropertiesRequiredString value. - */ - String requiredStringAnotherPropertiesRequiredString(); - - /** - * Gets the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - String kind(); - - /** - * Gets the friends property: The friends property. - * - * @return the friends value. - */ - List friends(); - - /** - * Gets the hate property: The hate property. - * - * @return the hate value. - */ - Map hate(); - - /** - * Gets the partner property: The partner property. - * - * @return the partner value. - */ - Fish partner(); - - /** - * Gets the inner tsptest.armstreamstyleserialization.fluent.models.SalmonInner object. - * - * @return the inner object. - */ - SalmonInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java deleted file mode 100644 index 49590e9c112..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java +++ /dev/null @@ -1,321 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armstreamstyleserialization.fluent.models.AnotherFishProperties; -import tsptest.armstreamstyleserialization.fluent.models.FishProperties; - -/** - * The third level model SawShark in polymorphic multiple levels inheritance. - */ -@Fluent -public final class SawShark extends Shark { - /* - * Discriminator property for Fish. - */ - private String kind = "shark"; - - /* - * The sharktype property. - */ - private String sharktype = "saw"; - - /* - * The dna property. - */ - private String dna; - - /* - * The age property. - */ - private int age; - - /* - * The anotherProperties property. - */ - private AnotherFishProperties innerAnotherProperties = new AnotherFishProperties(); - - /* - * The properties property. - */ - private FishProperties innerProperties = new FishProperties(); - - /** - * Creates an instance of SawShark class. - */ - public SawShark() { - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Override - public String kind() { - return this.kind; - } - - /** - * Get the sharktype property: The sharktype property. - * - * @return the sharktype value. - */ - @Override - public String sharktype() { - return this.sharktype; - } - - /** - * Get the dna property: The dna property. - * - * @return the dna value. - */ - public String dna() { - return this.dna; - } - - /** - * Set the dna property: The dna property. - * - * @param dna the dna value to set. - * @return the SawShark object itself. - */ - public SawShark withDna(String dna) { - this.dna = dna; - return this; - } - - /** - * Get the age property: The age property. - * - * @return the age value. - */ - public int age() { - return this.age; - } - - /** - * Set the age property: The age property. - * - * @param age the age value to set. - * @return the SawShark object itself. - */ - public SawShark withAge(int age) { - this.age = age; - return this; - } - - /** - * Get the innerAnotherProperties property: The anotherProperties property. - * - * @return the innerAnotherProperties value. - */ - private AnotherFishProperties innerAnotherProperties() { - return this.innerAnotherProperties; - } - - /** - * Get the innerProperties property: The properties property. - * - * @return the innerProperties value. - */ - private FishProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double length() { - return this.innerProperties() == null ? 0.0 : this.innerProperties().length(); - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the SawShark object itself. - */ - public SawShark withLength(double length) { - if (this.innerProperties() == null) { - this.innerProperties = new FishProperties(); - } - this.innerProperties().withLength(length); - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String patten() { - return this.innerProperties() == null ? null : this.innerProperties().patten(); - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredString() { - return this.innerProperties() == null ? null : this.innerProperties().requiredString(); - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the SawShark object itself. - */ - public SawShark withRequiredString(String requiredString) { - if (this.innerProperties() == null) { - this.innerProperties = new FishProperties(); - } - this.innerProperties().withRequiredString(requiredString); - return this; - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double lengthAnotherPropertiesLength() { - return this.innerAnotherProperties() == null ? 0.0 : this.innerAnotherProperties().length(); - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the SawShark object itself. - */ - public SawShark withLengthAnotherPropertiesLength(double length) { - if (this.innerAnotherProperties() == null) { - this.innerAnotherProperties = new AnotherFishProperties(); - } - this.innerAnotherProperties().withLength(length); - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String pattenAnotherPropertiesPatten() { - return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().patten(); - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredStringAnotherPropertiesRequiredString() { - return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().requiredString(); - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the SawShark object itself. - */ - public SawShark withRequiredStringAnotherPropertiesRequiredString(String requiredString) { - if (this.innerAnotherProperties() == null) { - this.innerAnotherProperties = new AnotherFishProperties(); - } - this.innerAnotherProperties().withRequiredString(requiredString); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - if (dna() == null) { - throw LOGGER.atError().log(new IllegalArgumentException("Missing required property dna in model SawShark")); - } - if (innerProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property innerProperties in model SawShark")); - } else { - innerProperties().validate(); - } - if (innerAnotherProperties() == null) { - throw LOGGER.atError() - .log( - new IllegalArgumentException("Missing required property innerAnotherProperties in model SawShark")); - } else { - innerAnotherProperties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(SawShark.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeJsonField("properties", innerProperties()); - jsonWriter.writeJsonField("anotherProperties", innerAnotherProperties()); - jsonWriter.writeStringField("dna", this.dna); - jsonWriter.writeIntField("age", this.age); - jsonWriter.writeStringField("sharktype", this.sharktype); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SawShark from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SawShark if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SawShark. - */ - public static SawShark fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SawShark deserializedSawShark = new SawShark(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("properties".equals(fieldName)) { - deserializedSawShark.innerProperties = FishProperties.fromJson(reader); - } else if ("anotherProperties".equals(fieldName)) { - deserializedSawShark.innerAnotherProperties = AnotherFishProperties.fromJson(reader); - } else if ("dna".equals(fieldName)) { - deserializedSawShark.dna = reader.getString(); - } else if ("age".equals(fieldName)) { - deserializedSawShark.age = reader.getInt(); - } else if ("sharktype".equals(fieldName)) { - deserializedSawShark.sharktype = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedSawShark; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Shark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Shark.java deleted file mode 100644 index 556d445d45b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Shark.java +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.armstreamstyleserialization.fluent.models.AnotherFishProperties; -import tsptest.armstreamstyleserialization.fluent.models.FishInner; -import tsptest.armstreamstyleserialization.fluent.models.FishProperties; - -/** - * The second level model in polymorphic multiple levels inheritance and it defines a new discriminator. - */ -@Fluent -public class Shark extends FishInner { - /* - * Discriminator property for Fish. - */ - private String kind = "shark"; - - /* - * The sharktype property. - */ - private String sharktype = "shark"; - - /* - * The anotherProperties property. - */ - private AnotherFishProperties innerAnotherProperties = new AnotherFishProperties(); - - /* - * The properties property. - */ - private FishProperties innerProperties = new FishProperties(); - - /* - * The dna property. - */ - private String dna; - - /** - * Creates an instance of Shark class. - */ - public Shark() { - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Override - public String kind() { - return this.kind; - } - - /** - * Get the sharktype property: The sharktype property. - * - * @return the sharktype value. - */ - public String sharktype() { - return this.sharktype; - } - - /** - * Get the innerAnotherProperties property: The anotherProperties property. - * - * @return the innerAnotherProperties value. - */ - private AnotherFishProperties innerAnotherProperties() { - return this.innerAnotherProperties; - } - - /** - * Get the innerProperties property: The properties property. - * - * @return the innerProperties value. - */ - private FishProperties innerProperties() { - return this.innerProperties; - } - - /** - * Get the dna property: The dna property. - * - * @return the dna value. - */ - @Override - public String dna() { - return this.dna; - } - - /** - * {@inheritDoc} - */ - @Override - public Shark withAge(int age) { - super.withAge(age); - return this; - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double length() { - return this.innerProperties() == null ? 0.0 : this.innerProperties().length(); - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the Shark object itself. - */ - public Shark withLength(double length) { - if (this.innerProperties() == null) { - this.innerProperties = new FishProperties(); - } - this.innerProperties().withLength(length); - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String patten() { - return this.innerProperties() == null ? null : this.innerProperties().patten(); - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredString() { - return this.innerProperties() == null ? null : this.innerProperties().requiredString(); - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the Shark object itself. - */ - public Shark withRequiredString(String requiredString) { - if (this.innerProperties() == null) { - this.innerProperties = new FishProperties(); - } - this.innerProperties().withRequiredString(requiredString); - return this; - } - - /** - * Get the length property: The length property. - * - * @return the length value. - */ - public double lengthAnotherPropertiesLength() { - return this.innerAnotherProperties() == null ? 0.0 : this.innerAnotherProperties().length(); - } - - /** - * Set the length property: The length property. - * - * @param length the length value to set. - * @return the Shark object itself. - */ - public Shark withLengthAnotherPropertiesLength(double length) { - if (this.innerAnotherProperties() == null) { - this.innerAnotherProperties = new AnotherFishProperties(); - } - this.innerAnotherProperties().withLength(length); - return this; - } - - /** - * Get the patten property: The patten property. - * - * @return the patten value. - */ - public String pattenAnotherPropertiesPatten() { - return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().patten(); - } - - /** - * Get the requiredString property: The requiredString property. - * - * @return the requiredString value. - */ - public String requiredStringAnotherPropertiesRequiredString() { - return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().requiredString(); - } - - /** - * Set the requiredString property: The requiredString property. - * - * @param requiredString the requiredString value to set. - * @return the Shark object itself. - */ - public Shark withRequiredStringAnotherPropertiesRequiredString(String requiredString) { - if (this.innerAnotherProperties() == null) { - this.innerAnotherProperties = new AnotherFishProperties(); - } - this.innerAnotherProperties().withRequiredString(requiredString); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - @Override - public void validate() { - if (innerProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property innerProperties in model Shark")); - } else { - innerProperties().validate(); - } - if (innerAnotherProperties() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException("Missing required property innerAnotherProperties in model Shark")); - } else { - innerAnotherProperties().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(Shark.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeIntField("age", age()); - jsonWriter.writeJsonField("properties", innerProperties()); - jsonWriter.writeJsonField("anotherProperties", innerAnotherProperties()); - jsonWriter.writeStringField("sharktype", this.sharktype); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Shark from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Shark if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Shark. - */ - public static Shark fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("sharktype".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("saw".equals(discriminatorValue)) { - return SawShark.fromJson(readerToUse.reset()); - } else if ("goblin".equals(discriminatorValue)) { - return GoblinShark.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - static Shark fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Shark deserializedShark = new Shark(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - deserializedShark.withAge(reader.getInt()); - } else if ("dna".equals(fieldName)) { - deserializedShark.dna = reader.getString(); - } else if ("properties".equals(fieldName)) { - deserializedShark.innerProperties = FishProperties.fromJson(reader); - } else if ("anotherProperties".equals(fieldName)) { - deserializedShark.innerAnotherProperties = AnotherFishProperties.fromJson(reader); - } else if ("sharktype".equals(fieldName)) { - deserializedShark.sharktype = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedShark; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResource.java deleted file mode 100644 index b6434425091..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResource.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.management.SystemData; -import java.util.Map; -import tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner; - -/** - * An immutable client-side representation of TopLevelArmResource. - */ -public interface TopLevelArmResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - TopLevelArmResourceProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the inner tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner object. - * - * @return the inner object. - */ - TopLevelArmResourceInner innerModel(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceProperties.java deleted file mode 100644 index 28cb04d6533..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceProperties.java +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Top Level Arm Resource Properties. - */ -@Immutable -public final class TopLevelArmResourceProperties implements JsonSerializable { - /* - * The description property. - */ - private String description; - - /* - * The builtin property. - */ - private Builtin builtin; - - /** - * Creates an instance of TopLevelArmResourceProperties class. - */ - private TopLevelArmResourceProperties() { - } - - /** - * Get the description property: The description property. - * - * @return the description value. - */ - public String description() { - return this.description; - } - - /** - * Get the builtin property: The builtin property. - * - * @return the builtin value. - */ - public Builtin builtin() { - return this.builtin; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (builtin() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property builtin in model TopLevelArmResourceProperties")); - } else { - builtin().validate(); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(TopLevelArmResourceProperties.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("builtin", this.builtin); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelArmResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelArmResourceProperties if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TopLevelArmResourceProperties. - */ - public static TopLevelArmResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelArmResourceProperties deserializedTopLevelArmResourceProperties - = new TopLevelArmResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("builtin".equals(fieldName)) { - deserializedTopLevelArmResourceProperties.builtin = Builtin.fromJson(reader); - } else if ("description".equals(fieldName)) { - deserializedTopLevelArmResourceProperties.description = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelArmResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceTagsUpdate.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceTagsUpdate.java deleted file mode 100644 index 2ba7f735d77..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceTagsUpdate.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * The type used for updating tags in TopLevelArmResource resources. - */ -@Fluent -public final class TopLevelArmResourceTagsUpdate implements JsonSerializable { - /* - * Resource tags. - */ - private Map tags; - - /** - * Creates an instance of TopLevelArmResourceTagsUpdate class. - */ - public TopLevelArmResourceTagsUpdate() { - } - - /** - * Get the tags property: Resource tags. - * - * @return the tags value. - */ - public Map tags() { - return this.tags; - } - - /** - * Set the tags property: Resource tags. - * - * @param tags the tags value to set. - * @return the TopLevelArmResourceTagsUpdate object itself. - */ - public TopLevelArmResourceTagsUpdate withTags(Map tags) { - this.tags = tags; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelArmResourceTagsUpdate from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelArmResourceTagsUpdate if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the TopLevelArmResourceTagsUpdate. - */ - public static TopLevelArmResourceTagsUpdate fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelArmResourceTagsUpdate deserializedTopLevelArmResourceTagsUpdate - = new TopLevelArmResourceTagsUpdate(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedTopLevelArmResourceTagsUpdate.tags = tags; - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelArmResourceTagsUpdate; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResources.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResources.java deleted file mode 100644 index 3c8cbdaac8a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResources.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armstreamstyleserialization.models; - -import com.azure.core.util.Context; - -/** - * Resource collection API of TopLevelArmResources. - */ -public interface TopLevelArmResources { - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - TopLevelArmResource update(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceTagsUpdate properties); - - /** - * Update a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourceName arm resource name for path. - * @param properties The resource properties to be updated. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - TopLevelArmResource update(String resourceGroupName, String topLevelArmResourceName, - TopLevelArmResourceTagsUpdate properties, Context context); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/package-info.java deleted file mode 100644 index b5ae20d11ff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the data models for ArmResourceProvider. - * Arm Resource Provider management API. - */ -package tsptest.armstreamstyleserialization.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/package-info.java deleted file mode 100644 index 4fb92cd84de..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the classes for ArmResourceProvider. - * Arm Resource Provider management API. - */ -package tsptest.armstreamstyleserialization; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/ArmVersionedManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/ArmVersionedManager.java deleted file mode 100644 index 316d4b6e8e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/ArmVersionedManager.java +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned; - -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import tsptest.armversioned.fluent.ArmVersionedClient; -import tsptest.armversioned.implementation.ArmVersionedClientBuilder; -import tsptest.armversioned.implementation.TopLevelArmResourcesImpl; -import tsptest.armversioned.models.TopLevelArmResources; - -/** - * Entry point to ArmVersionedManager. - * Arm Resource Provider management API. - */ -public final class ArmVersionedManager { - private TopLevelArmResources topLevelArmResources; - - private final ArmVersionedClient clientObject; - - private ArmVersionedManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new ArmVersionedClientBuilder().pipeline(httpPipeline) - .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) - .subscriptionId(profile.getSubscriptionId()) - .defaultPollInterval(defaultPollInterval) - .buildClient(); - } - - /** - * Creates an instance of ArmVersioned service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the ArmVersioned service API instance. - */ - public static ArmVersionedManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return configure().authenticate(credential, profile); - } - - /** - * Creates an instance of ArmVersioned service API entry point. - * - * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. - * @param profile the Azure profile for client. - * @return the ArmVersioned service API instance. - */ - public static ArmVersionedManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { - Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - return new ArmVersionedManager(httpPipeline, profile, null); - } - - /** - * Gets a Configurable instance that can be used to create ArmVersionedManager with optional configuration. - * - * @return the Configurable instance allowing configurations. - */ - public static Configurable configure() { - return new ArmVersionedManager.Configurable(); - } - - /** - * The Configurable allowing configurations to be set. - */ - public static final class Configurable { - private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); - private static final String SDK_VERSION = "version"; - private static final Map PROPERTIES - = CoreUtils.getProperties("azure-resourcemanager-armversioned-generated.properties"); - - private HttpClient httpClient; - private HttpLogOptions httpLogOptions; - private final List policies = new ArrayList<>(); - private final List scopes = new ArrayList<>(); - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - private Duration defaultPollInterval; - - private Configurable() { - } - - /** - * Sets the http client. - * - * @param httpClient the HTTP client. - * @return the configurable object itself. - */ - public Configurable withHttpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); - return this; - } - - /** - * Sets the logging options to the HTTP pipeline. - * - * @param httpLogOptions the HTTP log options. - * @return the configurable object itself. - */ - public Configurable withLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); - return this; - } - - /** - * Adds the pipeline policy to the HTTP pipeline. - * - * @param policy the HTTP pipeline policy. - * @return the configurable object itself. - */ - public Configurable withPolicy(HttpPipelinePolicy policy) { - this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); - return this; - } - - /** - * Adds the scope to permission sets. - * - * @param scope the scope. - * @return the configurable object itself. - */ - public Configurable withScope(String scope) { - this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); - return this; - } - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - /** - * Sets the default poll interval, used when service does not provide "Retry-After" header. - * - * @param defaultPollInterval the default poll interval. - * @return the configurable object itself. - */ - public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval - = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); - if (this.defaultPollInterval.isNegative()) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); - } - return this; - } - - /** - * Creates an instance of ArmVersioned service API entry point. - * - * @param credential the credential to use. - * @param profile the Azure profile for client. - * @return the ArmVersioned service API instance. - */ - public ArmVersionedManager authenticate(TokenCredential credential, AzureProfile profile) { - Objects.requireNonNull(credential, "'credential' cannot be null."); - Objects.requireNonNull(profile, "'profile' cannot be null."); - - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - - StringBuilder userAgentBuilder = new StringBuilder(); - userAgentBuilder.append("azsdk-java") - .append("-") - .append("tsptest.armversioned") - .append("/") - .append(clientVersion); - if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { - userAgentBuilder.append(" (") - .append(Configuration.getGlobalConfiguration().get("java.version")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.name")) - .append("; ") - .append(Configuration.getGlobalConfiguration().get("os.version")) - .append("; auto-generated)"); - } else { - userAgentBuilder.append(" (auto-generated)"); - } - - if (scopes.isEmpty()) { - scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); - } - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(userAgentBuilder.toString())); - policies.add(new AddHeadersFromContextPolicy()); - policies.add(new RequestIdPolicy()); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .collect(Collectors.toList())); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy); - policies.add(new AddDatePolicy()); - policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); - policies.addAll(this.policies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .collect(Collectors.toList())); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(httpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .build(); - return new ArmVersionedManager(httpPipeline, profile, defaultPollInterval); - } - } - - /** - * Gets the resource collection API of TopLevelArmResources. It manages TopLevelArmResource. - * - * @return Resource collection API of TopLevelArmResources. - */ - public TopLevelArmResources topLevelArmResources() { - if (this.topLevelArmResources == null) { - this.topLevelArmResources = new TopLevelArmResourcesImpl(clientObject.getTopLevelArmResources(), this); - } - return topLevelArmResources; - } - - /** - * Gets wrapped service client ArmVersionedClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. - * - * @return Wrapped service client ArmVersionedClient. - */ - public ArmVersionedClient serviceClient() { - return this.clientObject; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/ArmVersionedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/ArmVersionedClient.java deleted file mode 100644 index 0c52b974851..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/ArmVersionedClient.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for ArmVersionedClient class. - */ -public interface ArmVersionedClient { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets The HTTP pipeline to send requests through. - * - * @return the httpPipeline value. - */ - HttpPipeline getHttpPipeline(); - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - Duration getDefaultPollInterval(); - - /** - * Gets the TopLevelArmResourcesClient object to access its operations. - * - * @return the TopLevelArmResourcesClient object. - */ - TopLevelArmResourcesClient getTopLevelArmResources(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/TopLevelArmResourcesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/TopLevelArmResourcesClient.java deleted file mode 100644 index 47f358f13b6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/TopLevelArmResourcesClient.java +++ /dev/null @@ -1,340 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; -import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; - -/** - * An instance of this class provides access to all the operations defined in TopLevelArmResourcesClient. - */ -public interface TopLevelArmResourcesClient { - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( - String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource); - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( - String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, - String parameter, String newParameter, Context context); - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( - String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, - String parameter, Context context); - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourcePropertiesName, - TopLevelArmResourceInner resource); - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourcePropertiesName, - TopLevelArmResourceInner resource, String parameter, String newParameter, Context context); - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourcePropertiesName, - TopLevelArmResourceInner resource, String parameter, Context context); - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String parameter, String newParameter, Context context); - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String parameter, Context context); - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, String parameter, - String newParameter, Context context); - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByResourceGroup(String resourceGroupName, String parameter, - Context context); - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelArmResourcePropertiesName, String parameter, String newParameter, Context context); - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelArmResourcePropertiesName, String parameter, Context context); - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - TopLevelArmResourceInner getByResourceGroup(String resourceGroupName, String topLevelArmResourcePropertiesName); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, String newParameter, Context context); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, Context context); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String topLevelArmResourcePropertiesName); - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, String newParameter, Context context); - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, Context context); - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void action(String resourceGroupName, String topLevelArmResourcePropertiesName); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/TopLevelArmResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/TopLevelArmResourceInner.java deleted file mode 100644 index 54adc39e6a9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/TopLevelArmResourceInner.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; -import tsptest.armversioned.models.TopLevelArmResourceProperties; - -/** - * Concrete tracked resource types can be created by aliasing this type using a specific property type. - */ -@Fluent -public final class TopLevelArmResourceInner extends Resource { - /* - * The resource-specific properties for this resource. - */ - private TopLevelArmResourceProperties properties; - - /* - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - */ - private SystemData systemData; - - /* - * The type of the resource. - */ - private String type; - - /* - * The name of the resource. - */ - private String name; - - /* - * Fully qualified resource Id for the resource. - */ - private String id; - - /** - * Creates an instance of TopLevelArmResourceInner class. - */ - public TopLevelArmResourceInner() { - } - - /** - * Get the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - public TopLevelArmResourceProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The resource-specific properties for this resource. - * - * @param properties the properties value to set. - * @return the TopLevelArmResourceInner object itself. - */ - public TopLevelArmResourceInner withProperties(TopLevelArmResourceProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - - /** - * Get the type property: The type of the resource. - * - * @return the type value. - */ - @Override - public String type() { - return this.type; - } - - /** - * Get the name property: The name of the resource. - * - * @return the name value. - */ - @Override - public String name() { - return this.name; - } - - /** - * Get the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - @Override - public String id() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Override - public TopLevelArmResourceInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public TopLevelArmResourceInner withTags(Map tags) { - super.withTags(tags); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("location", location()); - jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); - jsonWriter.writeJsonField("properties", this.properties); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelArmResourceInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelArmResourceInner if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TopLevelArmResourceInner. - */ - public static TopLevelArmResourceInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelArmResourceInner deserializedTopLevelArmResourceInner = new TopLevelArmResourceInner(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedTopLevelArmResourceInner.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedTopLevelArmResourceInner.name = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedTopLevelArmResourceInner.type = reader.getString(); - } else if ("location".equals(fieldName)) { - deserializedTopLevelArmResourceInner.withLocation(reader.getString()); - } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedTopLevelArmResourceInner.withTags(tags); - } else if ("properties".equals(fieldName)) { - deserializedTopLevelArmResourceInner.properties = TopLevelArmResourceProperties.fromJson(reader); - } else if ("systemData".equals(fieldName)) { - deserializedTopLevelArmResourceInner.systemData = SystemData.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelArmResourceInner; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/package-info.java deleted file mode 100644 index efa70b16308..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the inner data models for ArmVersioned. - * Arm Resource Provider management API. - */ -package tsptest.armversioned.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/package-info.java deleted file mode 100644 index 304185e7846..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the service clients for ArmVersioned. - * Arm Resource Provider management API. - */ -package tsptest.armversioned.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientBuilder.java deleted file mode 100644 index 6498c099e69..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.implementation; - -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.serializer.SerializerFactory; -import com.azure.core.util.serializer.SerializerAdapter; -import java.time.Duration; - -/** - * A builder for creating a new instance of the ArmVersionedClientImpl type. - */ -@ServiceClientBuilder(serviceClients = { ArmVersionedClientImpl.class }) -public final class ArmVersionedClientBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the ArmVersionedClientBuilder. - */ - public ArmVersionedClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The ID of the target subscription. The value must be an UUID. - */ - private String subscriptionId; - - /** - * Sets The ID of the target subscription. The value must be an UUID. - * - * @param subscriptionId the subscriptionId value. - * @return the ArmVersionedClientBuilder. - */ - public ArmVersionedClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the ArmVersionedClientBuilder. - */ - public ArmVersionedClientBuilder environment(AzureEnvironment environment) { - this.environment = environment; - 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 ArmVersionedClientBuilder. - */ - public ArmVersionedClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /* - * The default poll interval for long-running operation - */ - private Duration defaultPollInterval; - - /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. - * @return the ArmVersionedClientBuilder. - */ - public ArmVersionedClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; - 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 ArmVersionedClientBuilder. - */ - public ArmVersionedClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of ArmVersionedClientImpl with the provided parameters. - * - * @return an instance of ArmVersionedClientImpl. - */ - public ArmVersionedClientImpl buildClient() { - String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; - AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; - HttpPipeline localPipeline = (pipeline != null) - ? pipeline - : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); - Duration localDefaultPollInterval - = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); - SerializerAdapter localSerializerAdapter = (serializerAdapter != null) - ? serializerAdapter - : SerializerFactory.createDefaultManagementSerializerAdapter(); - ArmVersionedClientImpl client = new ArmVersionedClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientImpl.java deleted file mode 100644 index 60ee7879dcf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientImpl.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.implementation; - -import com.azure.core.annotation.ServiceClient; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.management.polling.SyncPollerFactory; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import java.io.IOException; -import java.lang.reflect.Type; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armversioned.fluent.ArmVersionedClient; -import tsptest.armversioned.fluent.TopLevelArmResourcesClient; - -/** - * Initializes a new instance of the ArmVersionedClientImpl type. - */ -@ServiceClient(builder = ArmVersionedClientBuilder.class) -public final class ArmVersionedClientImpl implements ArmVersionedClient { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Version parameter. - */ - private final String apiVersion; - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * The ID of the target subscription. The value must be an UUID. - */ - private final String subscriptionId; - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * 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. - */ - SerializerAdapter getSerializerAdapter() { - return this.serializerAdapter; - } - - /** - * The default poll interval for long-running operation. - */ - private final Duration defaultPollInterval; - - /** - * Gets The default poll interval for long-running operation. - * - * @return the defaultPollInterval value. - */ - public Duration getDefaultPollInterval() { - return this.defaultPollInterval; - } - - /** - * The TopLevelArmResourcesClient object to access its operations. - */ - private final TopLevelArmResourcesClient topLevelArmResources; - - /** - * Gets the TopLevelArmResourcesClient object to access its operations. - * - * @return the TopLevelArmResourcesClient object. - */ - public TopLevelArmResourcesClient getTopLevelArmResources() { - return this.topLevelArmResources; - } - - /** - * Initializes an instance of ArmVersionedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - ArmVersionedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, - AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.apiVersion = "2024-12-01"; - this.topLevelArmResources = new TopLevelArmResourcesClientImpl(this); - } - - /** - * Gets default client context. - * - * @return the default client context. - */ - public Context getContext() { - return Context.NONE; - } - - /** - * Merges default client context with provided context. - * - * @param context the context to be merged with default client context. - * @return the merged context. - */ - public Context mergeContext(Context context) { - return CoreUtils.mergeContexts(this.getContext(), context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param httpPipeline the http pipeline. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return poller flux for poll result and final result. - */ - public PollerFlux, U> getLroResult(Mono>> activationResponse, - HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { - return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, activationResponse, context); - } - - /** - * Gets long running operation result. - * - * @param activationResponse the response of activation operation. - * @param pollResultType type of poll result. - * @param finalResultType type of final result. - * @param context the context shared by all requests. - * @param type of poll result. - * @param type of final result. - * @return SyncPoller for poll result and final result. - */ - public SyncPoller, U> getLroResult(Response activationResponse, - Type pollResultType, Type finalResultType, Context context) { - return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, - defaultPollInterval, () -> activationResponse, context); - } - - /** - * Gets the final result, or an error, based on last async poll response. - * - * @param response the last async poll response. - * @param type of poll result. - * @param type of final result. - * @return the final result, or an error. - */ - public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { - String errorMessage; - ManagementError managementError = null; - HttpResponse errorResponse = null; - PollResult.Error lroError = response.getValue().getError(); - if (lroError != null) { - errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), - lroError.getResponseBody()); - - errorMessage = response.getValue().getError().getMessage(); - String errorBody = response.getValue().getError().getResponseBody(); - if (errorBody != null) { - // try to deserialize error body to ManagementError - try { - managementError = this.getSerializerAdapter() - .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); - if (managementError.getCode() == null || managementError.getMessage() == null) { - managementError = null; - } - } catch (IOException | RuntimeException ioe) { - LOGGER.logThrowableAsWarning(ioe); - } - } - } else { - // fallback to default error message - errorMessage = "Long running operation failed."; - } - if (managementError == null) { - // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); - } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); - } - } - - private static final class HttpResponseImpl extends HttpResponse { - private final int statusCode; - - private final byte[] responseBody; - - private final HttpHeaders httpHeaders; - - HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { - super(null); - this.statusCode = statusCode; - this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); - } - - public int getStatusCode() { - return statusCode; - } - - public String getHeaderValue(String s) { - return httpHeaders.getValue(HttpHeaderName.fromString(s)); - } - - public HttpHeaders getHeaders() { - return httpHeaders; - } - - public Flux getBody() { - return Flux.just(ByteBuffer.wrap(responseBody)); - } - - public Mono getBodyAsByteArray() { - return Mono.just(responseBody); - } - - public Mono getBodyAsString() { - return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); - } - - public Mono getBodyAsString(Charset charset) { - return Mono.just(new String(responseBody, charset)); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(ArmVersionedClientImpl.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ResourceManagerUtils.java deleted file mode 100644 index f52d86253ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ResourceManagerUtils.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.implementation; - -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.util.CoreUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import reactor.core.publisher.Flux; - -final class ResourceManagerUtils { - private ResourceManagerUtils() { - } - - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (!segments.isEmpty() && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - - static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl<>(pageIterable, mapper); - } - - private static final class PagedIterableImpl extends PagedIterable { - - private final PagedIterable pagedIterable; - private final Function mapper; - private final Function, PagedResponse> pageMapper; - - private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { - super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux - .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); - this.pagedIterable = pagedIterable; - this.mapper = mapper; - this.pageMapper = getPageMapper(mapper); - } - - private static Function, PagedResponse> getPageMapper(Function mapper) { - return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), - page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), - null); - } - - @Override - public Stream stream() { - return pagedIterable.stream().map(mapper); - } - - @Override - public Stream> streamByPage() { - return pagedIterable.streamByPage().map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken) { - return pagedIterable.streamByPage(continuationToken).map(pageMapper); - } - - @Override - public Stream> streamByPage(int preferredPageSize) { - return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); - } - - @Override - public Stream> streamByPage(String continuationToken, int preferredPageSize) { - return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(pagedIterable.iterator(), mapper); - } - - @Override - public Iterable> iterableByPage() { - return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); - } - - @Override - public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); - } - - @Override - public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); - } - } - - private static final class IteratorImpl implements Iterator { - - private final Iterator iterator; - private final Function mapper; - - private IteratorImpl(Iterator iterator, Function mapper) { - this.iterator = iterator; - this.mapper = mapper; - } - - @Override - public boolean hasNext() { - return iterator.hasNext(); - } - - @Override - public S next() { - return mapper.apply(iterator.next()); - } - - @Override - public void remove() { - iterator.remove(); - } - } - - private static final class IterableImpl implements Iterable { - - private final Iterable iterable; - private final Function mapper; - - private IterableImpl(Iterable iterable, Function mapper) { - this.iterable = iterable; - this.mapper = mapper; - } - - @Override - public Iterator iterator() { - return new IteratorImpl<>(iterable.iterator(), mapper); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourceImpl.java deleted file mode 100644 index 56789e16392..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourceImpl.java +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Collections; -import java.util.Map; -import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; -import tsptest.armversioned.models.TopLevelArmResource; -import tsptest.armversioned.models.TopLevelArmResourceProperties; - -public final class TopLevelArmResourceImpl - implements TopLevelArmResource, TopLevelArmResource.Definition, TopLevelArmResource.Update { - private TopLevelArmResourceInner innerObject; - - private final tsptest.armversioned.ArmVersionedManager serviceManager; - - public String id() { - return this.innerModel().id(); - } - - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - - public String location() { - return this.innerModel().location(); - } - - public Map tags() { - Map inner = this.innerModel().tags(); - if (inner != null) { - return Collections.unmodifiableMap(inner); - } else { - return Collections.emptyMap(); - } - } - - public TopLevelArmResourceProperties properties() { - return this.innerModel().properties(); - } - - public SystemData systemData() { - return this.innerModel().systemData(); - } - - public Region region() { - return Region.fromName(this.regionName()); - } - - public String regionName() { - return this.location(); - } - - public String resourceGroupName() { - return resourceGroupName; - } - - public TopLevelArmResourceInner innerModel() { - return this.innerObject; - } - - private tsptest.armversioned.ArmVersionedManager manager() { - return this.serviceManager; - } - - private String resourceGroupName; - - private String topLevelArmResourcePropertiesName; - - private String createParameter; - - private String createNewParameter; - - private String updateParameter; - - private String updateNewParameter; - - public TopLevelArmResourceImpl withExistingResourceGroup(String resourceGroupName) { - this.resourceGroupName = resourceGroupName; - return this; - } - - public TopLevelArmResource create() { - this.innerObject = serviceManager.serviceClient() - .getTopLevelArmResources() - .createOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, this.innerModel(), createParameter, - createNewParameter, Context.NONE); - return this; - } - - public TopLevelArmResource create(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTopLevelArmResources() - .createOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, this.innerModel(), createParameter, - createNewParameter, context); - return this; - } - - TopLevelArmResourceImpl(String name, tsptest.armversioned.ArmVersionedManager serviceManager) { - this.innerObject = new TopLevelArmResourceInner(); - this.serviceManager = serviceManager; - this.topLevelArmResourcePropertiesName = name; - this.createParameter = null; - this.createNewParameter = null; - } - - public TopLevelArmResourceImpl update() { - this.updateParameter = null; - this.updateNewParameter = null; - return this; - } - - public TopLevelArmResource apply() { - this.innerObject = serviceManager.serviceClient() - .getTopLevelArmResources() - .createOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, this.innerModel(), updateParameter, - updateNewParameter, Context.NONE); - return this; - } - - public TopLevelArmResource apply(Context context) { - this.innerObject = serviceManager.serviceClient() - .getTopLevelArmResources() - .createOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, this.innerModel(), updateParameter, - updateNewParameter, context); - return this; - } - - TopLevelArmResourceImpl(TopLevelArmResourceInner innerObject, - tsptest.armversioned.ArmVersionedManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.topLevelArmResourcePropertiesName - = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "topLevelArmResources"); - } - - public TopLevelArmResource refresh() { - String localParameter = null; - String localNewParameter = null; - this.innerObject = serviceManager.serviceClient() - .getTopLevelArmResources() - .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, localParameter, - localNewParameter, Context.NONE) - .getValue(); - return this; - } - - public TopLevelArmResource refresh(Context context) { - String localParameter = null; - String localNewParameter = null; - this.innerObject = serviceManager.serviceClient() - .getTopLevelArmResources() - .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, localParameter, - localNewParameter, context) - .getValue(); - return this; - } - - public Response actionWithResponse(String parameter, String newParameter, Context context) { - return serviceManager.topLevelArmResources() - .actionWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter, context); - } - - public Response actionWithResponse(String parameter, Context context) { - return serviceManager.topLevelArmResources() - .actionWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, context); - } - - public void action() { - serviceManager.topLevelArmResources().action(resourceGroupName, topLevelArmResourcePropertiesName); - } - - public TopLevelArmResourceImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); - return this; - } - - public TopLevelArmResourceImpl withRegion(String location) { - this.innerModel().withLocation(location); - return this; - } - - public TopLevelArmResourceImpl withTags(Map tags) { - this.innerModel().withTags(tags); - return this; - } - - public TopLevelArmResourceImpl withProperties(TopLevelArmResourceProperties properties) { - this.innerModel().withProperties(properties); - return this; - } - - public TopLevelArmResourceImpl withParameter(String parameter) { - if (isInCreateMode()) { - this.createParameter = parameter; - return this; - } else { - this.updateParameter = parameter; - return this; - } - } - - public TopLevelArmResourceImpl withNewParameter(String newParameter) { - if (isInCreateMode()) { - this.createNewParameter = newParameter; - return this; - } else { - this.updateNewParameter = newParameter; - return this; - } - } - - private boolean isInCreateMode() { - return this.innerModel() == null || this.innerModel().id() == null; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesClientImpl.java deleted file mode 100644 index 28cc7a6e6e8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesClientImpl.java +++ /dev/null @@ -1,1346 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -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.Put; -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.annotation.UnexpectedResponseExceptionType; -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.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.BinaryData; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.armversioned.fluent.TopLevelArmResourcesClient; -import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; -import tsptest.armversioned.implementation.models.TopLevelArmResourceListResult; - -/** - * An instance of this class provides access to all the operations defined in TopLevelArmResourcesClient. - */ -public final class TopLevelArmResourcesClientImpl implements TopLevelArmResourcesClient { - /** - * The proxy service used to perform REST calls. - */ - private final TopLevelArmResourcesService service; - - /** - * The service client containing this operation class. - */ - private final ArmVersionedClientImpl client; - - /** - * Initializes an instance of TopLevelArmResourcesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - TopLevelArmResourcesClientImpl(ArmVersionedClientImpl client) { - this.service = RestProxy.create(TopLevelArmResourcesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArmVersionedClientTopLevelArmResources to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArmVersionedClientTopLevelArmResources") - public interface TopLevelArmResourcesService { - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, - @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") TopLevelArmResourceInner resource, Context context); - - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response createOrUpdateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, - @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") TopLevelArmResourceInner resource, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/TspTest.ArmVersioned/topLevelArmResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/TspTest.ArmVersioned/topLevelArmResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("parameter") String parameter, - @QueryParam("newParameter") String newParameter, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("parameter") String parameter, - @QueryParam("newParameter") String newParameter, @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, - @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, - @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, - @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, - Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}") - @ExpectedResponses({ 200, 204 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, - @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, - Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}/action") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> action(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, - @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, - Context context); - - @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}/action") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response actionSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, - @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, - Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listBySubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listBySubscriptionNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Response listByResourceGroupNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, Context context); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, String parameter, - String newParameter) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, contentType, accept, resource, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, - String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, String parameter, - String newParameter) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, contentType, accept, resource, Context.NONE); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, - String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, String parameter, - String newParameter, Context context) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, contentType, accept, resource, context); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type along - * with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrUpdateWithResponse(String resourceGroupName, - String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, String parameter, - Context context) { - final String newParameter = null; - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, contentType, accept, resource, context); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, TopLevelArmResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, - String parameter, String newParameter) { - Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, - topLevelArmResourcePropertiesName, resource, parameter, newParameter); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, - this.client.getContext()); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, TopLevelArmResourceInner> beginCreateOrUpdateAsync( - String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource) { - final String parameter = null; - final String newParameter = null; - Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, - topLevelArmResourcePropertiesName, resource, parameter, newParameter); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, - this.client.getContext()); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( - String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, - String parameter, String newParameter) { - Response response = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, - resource, parameter, newParameter); - return this.client.getLroResult(response, - TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, Context.NONE); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( - String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource) { - final String parameter = null; - final String newParameter = null; - Response response = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, - resource, parameter, newParameter); - return this.client.getLroResult(response, - TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, Context.NONE); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( - String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, - String parameter, String newParameter, Context context) { - Response response = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, - resource, parameter, newParameter, context); - return this.client.getLroResult(response, - TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, context); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this - * type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( - String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, - String parameter, Context context) { - Response response = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, - resource, parameter, context); - return this.client.getLroResult(response, - TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, context); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, - String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, String parameter, - String newParameter) { - return beginCreateOrUpdateAsync(resourceGroupName, topLevelArmResourcePropertiesName, resource, parameter, - newParameter).last().flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, - String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource) { - final String parameter = null; - final String newParameter = null; - return beginCreateOrUpdateAsync(resourceGroupName, topLevelArmResourcePropertiesName, resource, parameter, - newParameter).last().flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourcePropertiesName, - TopLevelArmResourceInner resource) { - final String parameter = null; - final String newParameter = null; - return beginCreateOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, resource, parameter, - newParameter).getFinalResult(); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourcePropertiesName, - TopLevelArmResourceInner resource, String parameter, String newParameter, Context context) { - return beginCreateOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, resource, parameter, - newParameter, context).getFinalResult(); - } - - /** - * Create a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param resource Resource create parameters. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return concrete tracked resource types can be created by aliasing this type using a specific property type. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourcePropertiesName, - TopLevelArmResourceInner resource, String parameter, Context context) { - return beginCreateOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, resource, parameter, context) - .getFinalResult(); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String parameter, String newParameter) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), parameter, newParameter, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String parameter, String newParameter) { - return new PagedFlux<>(() -> listSinglePageAsync(parameter, newParameter), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - final String parameter = null; - final String newParameter = null; - return new PagedFlux<>(() -> listSinglePageAsync(parameter, newParameter), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(String parameter, String newParameter) { - final String accept = "application/json"; - Response res - = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - parameter, newParameter, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(String parameter, String newParameter, - Context context) { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), parameter, newParameter, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(String parameter, Context context) { - final String newParameter = null; - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), parameter, newParameter, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - final String parameter = null; - final String newParameter = null; - return new PagedIterable<>(() -> listSinglePage(parameter, newParameter), - nextLink -> listBySubscriptionNextSinglePage(nextLink)); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String parameter, String newParameter, Context context) { - return new PagedIterable<>(() -> listSinglePage(parameter, newParameter, context), - nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); - } - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String parameter, Context context) { - return new PagedIterable<>(() -> listSinglePage(parameter, context), - nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, - String parameter, String newParameter) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parameter, newParameter, accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName, String parameter, - String newParameter) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, parameter, newParameter), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - final String parameter = null; - final String newParameter = null; - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, parameter, newParameter), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, - String parameter, String newParameter) { - final String accept = "application/json"; - Response res - = service.listByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parameter, newParameter, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, - String parameter, String newParameter, Context context) { - final String accept = "application/json"; - Response res - = service.listByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parameter, newParameter, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, - String parameter, Context context) { - final String newParameter = null; - final String accept = "application/json"; - Response res - = service.listByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, parameter, newParameter, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName) { - final String parameter = null; - final String newParameter = null; - return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, parameter, newParameter), - nextLink -> listByResourceGroupNextSinglePage(nextLink)); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, String parameter, - String newParameter, Context context) { - return new PagedIterable<>( - () -> listByResourceGroupSinglePage(resourceGroupName, parameter, newParameter, context), - nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); - } - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByResourceGroup(String resourceGroupName, String parameter, - Context context) { - return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, parameter, context), - nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); - } - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, - String topLevelArmResourcePropertiesName, String parameter, String newParameter) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, - String topLevelArmResourcePropertiesName) { - final String parameter = null; - final String newParameter = null; - return getByResourceGroupWithResponseAsync(resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelArmResourcePropertiesName, String parameter, String newParameter, Context context) { - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, accept, context); - } - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelArmResourcePropertiesName, String parameter, Context context) { - final String newParameter = null; - final String accept = "application/json"; - return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, accept, context); - } - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public TopLevelArmResourceInner getByResourceGroup(String resourceGroupName, - String topLevelArmResourcePropertiesName) { - final String parameter = null; - final String newParameter = null; - return getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, Context.NONE).getValue(); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, - String topLevelArmResourcePropertiesName, String parameter, String newParameter) { - return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String topLevelArmResourcePropertiesName) { - final String parameter = null; - final String newParameter = null; - return deleteWithResponseAsync(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter) - .flatMap(ignored -> Mono.empty()); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, String newParameter, Context context) { - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, context); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, Context context) { - final String newParameter = null; - return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, context); - } - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String topLevelArmResourcePropertiesName) { - final String parameter = null; - final String newParameter = null; - deleteWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter, Context.NONE); - } - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> actionWithResponseAsync(String resourceGroupName, - String topLevelArmResourcePropertiesName, String parameter, String newParameter) { - return FluxUtil - .withContext(context -> service.action(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono actionAsync(String resourceGroupName, String topLevelArmResourcePropertiesName) { - final String parameter = null; - final String newParameter = null; - return actionWithResponseAsync(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter) - .flatMap(ignored -> Mono.empty()); - } - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, String newParameter, Context context) { - return service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, context); - } - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, Context context) { - final String newParameter = null; - return service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, context); - } - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void action(String resourceGroupName, String topLevelArmResourcePropertiesName) { - final String parameter = null; - final String newParameter = null; - actionWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter, Context.NONE); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { - final String accept = "application/json"; - Response res - = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map(res -> new PagedResponseBase<>(res.getRequest(), - res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listByResourceGroupNextSinglePage(String nextLink, - Context context) { - final String accept = "application/json"; - Response res - = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesImpl.java deleted file mode 100644 index a0b31f30dba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesImpl.java +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.implementation; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import tsptest.armversioned.fluent.TopLevelArmResourcesClient; -import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; -import tsptest.armversioned.models.TopLevelArmResource; -import tsptest.armversioned.models.TopLevelArmResources; - -public final class TopLevelArmResourcesImpl implements TopLevelArmResources { - private static final ClientLogger LOGGER = new ClientLogger(TopLevelArmResourcesImpl.class); - - private final TopLevelArmResourcesClient innerClient; - - private final tsptest.armversioned.ArmVersionedManager serviceManager; - - public TopLevelArmResourcesImpl(TopLevelArmResourcesClient innerClient, - tsptest.armversioned.ArmVersionedManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); - } - - public PagedIterable list(String parameter, String newParameter, Context context) { - PagedIterable inner = this.serviceClient().list(parameter, newParameter, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); - } - - public PagedIterable list(String parameter, Context context) { - PagedIterable inner = this.serviceClient().list(parameter, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName) { - PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName, String parameter, - String newParameter, Context context) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(resourceGroupName, parameter, newParameter, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); - } - - public PagedIterable listByResourceGroup(String resourceGroupName, String parameter, - Context context) { - PagedIterable inner - = this.serviceClient().listByResourceGroup(resourceGroupName, parameter, context); - return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelArmResourcePropertiesName, String parameter, String newParameter, Context context) { - Response inner = this.serviceClient() - .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new TopLevelArmResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelArmResourcePropertiesName, String parameter, Context context) { - Response inner = this.serviceClient() - .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new TopLevelArmResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public TopLevelArmResource getByResourceGroup(String resourceGroupName, String topLevelArmResourcePropertiesName) { - TopLevelArmResourceInner inner - = this.serviceClient().getByResourceGroup(resourceGroupName, topLevelArmResourcePropertiesName); - if (inner != null) { - return new TopLevelArmResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, String newParameter, Context context) { - return this.serviceClient() - .deleteWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter, context); - } - - public Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, Context context) { - return this.serviceClient() - .deleteWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, context); - } - - public void delete(String resourceGroupName, String topLevelArmResourcePropertiesName) { - this.serviceClient().delete(resourceGroupName, topLevelArmResourcePropertiesName); - } - - public Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, String newParameter, Context context) { - return this.serviceClient() - .actionWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter, context); - } - - public Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, Context context) { - return this.serviceClient() - .actionWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, context); - } - - public void action(String resourceGroupName, String topLevelArmResourcePropertiesName) { - this.serviceClient().action(resourceGroupName, topLevelArmResourcePropertiesName); - } - - public TopLevelArmResource getById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourcePropertiesName - = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourcePropertiesName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - String localParameter = null; - String localNewParameter = null; - return this - .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, localParameter, - localNewParameter, Context.NONE) - .getValue(); - } - - public Response getByIdWithResponse(String id, String parameter, String newParameter, - Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourcePropertiesName - = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourcePropertiesName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, - newParameter, context); - } - - public void deleteById(String id) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourcePropertiesName - = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourcePropertiesName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - String localParameter = null; - String localNewParameter = null; - this.deleteWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, localParameter, localNewParameter, - Context.NONE); - } - - public Response deleteByIdWithResponse(String id, String parameter, String newParameter, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourcePropertiesName - = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourcePropertiesName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - return this.deleteWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter, - context); - } - - public Response deleteByIdWithResponse(String id, String parameter, Context context) { - String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String topLevelArmResourcePropertiesName - = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); - if (topLevelArmResourcePropertiesName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); - } - return this.deleteWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, context); - } - - private TopLevelArmResourcesClient serviceClient() { - return this.innerClient; - } - - private tsptest.armversioned.ArmVersionedManager manager() { - return this.serviceManager; - } - - public TopLevelArmResourceImpl define(String name) { - return new TopLevelArmResourceImpl(name, this.manager()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/models/TopLevelArmResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/models/TopLevelArmResourceListResult.java deleted file mode 100644 index 89c6c334369..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/models/TopLevelArmResourceListResult.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.implementation.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; - -/** - * The response of a TopLevelArmResource list operation. - */ -@Immutable -public final class TopLevelArmResourceListResult implements JsonSerializable { - /* - * The TopLevelArmResource items on this page - */ - private List value; - - /* - * The link to the next page of items - */ - private String nextLink; - - /** - * Creates an instance of TopLevelArmResourceListResult class. - */ - private TopLevelArmResourceListResult() { - } - - /** - * Get the value property: The TopLevelArmResource items on this page. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Get the nextLink property: The link to the next page of items. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeStringField("nextLink", this.nextLink); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelArmResourceListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelArmResourceListResult if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TopLevelArmResourceListResult. - */ - public static TopLevelArmResourceListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelArmResourceListResult deserializedTopLevelArmResourceListResult - = new TopLevelArmResourceListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> TopLevelArmResourceInner.fromJson(reader1)); - deserializedTopLevelArmResourceListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedTopLevelArmResourceListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelArmResourceListResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/package-info.java deleted file mode 100644 index 414dcf31448..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the implementations for ArmVersioned. - * Arm Resource Provider management API. - */ -package tsptest.armversioned.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/ResourceProvisioningState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/ResourceProvisioningState.java deleted file mode 100644 index 2ebeed742f0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/ResourceProvisioningState.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * The provisioning state of a resource type. - */ -public final class ResourceProvisioningState extends ExpandableStringEnum { - /** - * Resource has been created. - */ - public static final ResourceProvisioningState SUCCEEDED = fromString("Succeeded"); - - /** - * Resource creation failed. - */ - public static final ResourceProvisioningState FAILED = fromString("Failed"); - - /** - * Resource creation was canceled. - */ - public static final ResourceProvisioningState CANCELED = fromString("Canceled"); - - /** - * Creates a new instance of ResourceProvisioningState value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public ResourceProvisioningState() { - } - - /** - * Creates or finds a ResourceProvisioningState from its string representation. - * - * @param name a name to look for. - * @return the corresponding ResourceProvisioningState. - */ - public static ResourceProvisioningState fromString(String name) { - return fromString(name, ResourceProvisioningState.class); - } - - /** - * Gets known ResourceProvisioningState values. - * - * @return known ResourceProvisioningState values. - */ - public static Collection values() { - return values(ResourceProvisioningState.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResource.java deleted file mode 100644 index 5de933bb660..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResource.java +++ /dev/null @@ -1,353 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.management.Region; -import com.azure.core.management.SystemData; -import com.azure.core.util.Context; -import java.util.Map; -import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; - -/** - * An immutable client-side representation of TopLevelArmResource. - */ -public interface TopLevelArmResource { - /** - * Gets the id property: Fully qualified resource Id for the resource. - * - * @return the id value. - */ - String id(); - - /** - * Gets the name property: The name of the resource. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: The type of the resource. - * - * @return the type value. - */ - String type(); - - /** - * Gets the location property: The geo-location where the resource lives. - * - * @return the location value. - */ - String location(); - - /** - * Gets the tags property: Resource tags. - * - * @return the tags value. - */ - Map tags(); - - /** - * Gets the properties property: The resource-specific properties for this resource. - * - * @return the properties value. - */ - TopLevelArmResourceProperties properties(); - - /** - * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. - * - * @return the systemData value. - */ - SystemData systemData(); - - /** - * Gets the region of the resource. - * - * @return the region of the resource. - */ - Region region(); - - /** - * Gets the name of the resource region. - * - * @return the name of the resource region. - */ - String regionName(); - - /** - * Gets the name of the resource group. - * - * @return the name of the resource group. - */ - String resourceGroupName(); - - /** - * Gets the inner tsptest.armversioned.fluent.models.TopLevelArmResourceInner object. - * - * @return the inner object. - */ - TopLevelArmResourceInner innerModel(); - - /** - * The entirety of the TopLevelArmResource definition. - */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, - DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { - } - - /** - * The TopLevelArmResource definition stages. - */ - interface DefinitionStages { - /** - * The first stage of the TopLevelArmResource definition. - */ - interface Blank extends WithLocation { - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify location. - */ - interface WithLocation { - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(Region location); - - /** - * Specifies the region for the resource. - * - * @param location The geo-location where the resource lives. - * @return the next definition stage. - */ - WithResourceGroup withRegion(String location); - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify parent resource. - */ - interface WithResourceGroup { - /** - * Specifies resourceGroupName. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @return the next definition stage. - */ - WithCreate withExistingResourceGroup(String resourceGroupName); - } - - /** - * The stage of the TopLevelArmResource definition which contains all the minimum required properties for the - * resource to be created, but also allows for any other optional properties to be specified. - */ - interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties, - DefinitionStages.WithParameter, DefinitionStages.WithNewParameter { - /** - * Executes the create request. - * - * @return the created resource. - */ - TopLevelArmResource create(); - - /** - * Executes the create request. - * - * @param context The context to associate with this operation. - * @return the created resource. - */ - TopLevelArmResource create(Context context); - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - WithCreate withTags(Map tags); - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - WithCreate withProperties(TopLevelArmResourceProperties properties); - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify parameter. - */ - interface WithParameter { - /** - * Specifies the parameter property: The parameter parameter. - * - * @param parameter The parameter parameter. - * @return the next definition stage. - */ - WithCreate withParameter(String parameter); - } - - /** - * The stage of the TopLevelArmResource definition allowing to specify newParameter. - */ - interface WithNewParameter { - /** - * Specifies the newParameter property: The newParameter parameter. - * - * @param newParameter The newParameter parameter. - * @return the next definition stage. - */ - WithCreate withNewParameter(String newParameter); - } - } - - /** - * Begins update for the TopLevelArmResource resource. - * - * @return the stage of resource update. - */ - TopLevelArmResource.Update update(); - - /** - * The template for TopLevelArmResource update. - */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties, UpdateStages.WithParameter, - UpdateStages.WithNewParameter { - /** - * Executes the update request. - * - * @return the updated resource. - */ - TopLevelArmResource apply(); - - /** - * Executes the update request. - * - * @param context The context to associate with this operation. - * @return the updated resource. - */ - TopLevelArmResource apply(Context context); - } - - /** - * The TopLevelArmResource update stages. - */ - interface UpdateStages { - /** - * The stage of the TopLevelArmResource update allowing to specify tags. - */ - interface WithTags { - /** - * Specifies the tags property: Resource tags.. - * - * @param tags Resource tags. - * @return the next definition stage. - */ - Update withTags(Map tags); - } - - /** - * The stage of the TopLevelArmResource update allowing to specify properties. - */ - interface WithProperties { - /** - * Specifies the properties property: The resource-specific properties for this resource.. - * - * @param properties The resource-specific properties for this resource. - * @return the next definition stage. - */ - Update withProperties(TopLevelArmResourceProperties properties); - } - - /** - * The stage of the TopLevelArmResource update allowing to specify parameter. - */ - interface WithParameter { - /** - * Specifies the parameter property: The parameter parameter. - * - * @param parameter The parameter parameter. - * @return the next definition stage. - */ - Update withParameter(String parameter); - } - - /** - * The stage of the TopLevelArmResource update allowing to specify newParameter. - */ - interface WithNewParameter { - /** - * Specifies the newParameter property: The newParameter parameter. - * - * @param newParameter The newParameter parameter. - * @return the next definition stage. - */ - Update withNewParameter(String newParameter); - } - } - - /** - * Refreshes the resource to sync with Azure. - * - * @return the refreshed resource. - */ - TopLevelArmResource refresh(); - - /** - * Refreshes the resource to sync with Azure. - * - * @param context The context to associate with this operation. - * @return the refreshed resource. - */ - TopLevelArmResource refresh(Context context); - - /** - * A synchronous resource action. - * - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response actionWithResponse(String parameter, String newParameter, Context context); - - /** - * A synchronous resource action. - * - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response actionWithResponse(String parameter, Context context); - - /** - * A synchronous resource action. - * - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void action(); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResourceProperties.java deleted file mode 100644 index 4cf68776cea..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResourceProperties.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Top Level Arm Resource Properties. - */ -@Immutable -public final class TopLevelArmResourceProperties implements JsonSerializable { - /* - * The provisioningState property. - */ - private ResourceProvisioningState provisioningState; - - /** - * Creates an instance of TopLevelArmResourceProperties class. - */ - public TopLevelArmResourceProperties() { - } - - /** - * Get the provisioningState property: The provisioningState property. - * - * @return the provisioningState value. - */ - public ResourceProvisioningState provisioningState() { - return this.provisioningState; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TopLevelArmResourceProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TopLevelArmResourceProperties if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the TopLevelArmResourceProperties. - */ - public static TopLevelArmResourceProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TopLevelArmResourceProperties deserializedTopLevelArmResourceProperties - = new TopLevelArmResourceProperties(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("provisioningState".equals(fieldName)) { - deserializedTopLevelArmResourceProperties.provisioningState - = ResourceProvisioningState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedTopLevelArmResourceProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResources.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResources.java deleted file mode 100644 index ebc8b5ca2b2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResources.java +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.models; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** - * Resource collection API of TopLevelArmResources. - */ -public interface TopLevelArmResources { - /** - * List TopLevelArmResource resources by subscription ID. - * - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable list(); - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable list(String parameter, String newParameter, Context context); - - /** - * List TopLevelArmResource resources by subscription ID. - * - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable list(String parameter, Context context); - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String resourceGroupName); - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String resourceGroupName, String parameter, - String newParameter, Context context); - - /** - * List TopLevelArmResource resources by resource group. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. - */ - PagedIterable listByResourceGroup(String resourceGroupName, String parameter, Context context); - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelArmResourcePropertiesName, String parameter, String newParameter, Context context); - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - Response getByResourceGroupWithResponse(String resourceGroupName, - String topLevelArmResourcePropertiesName, String parameter, Context context); - - /** - * Get a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource. - */ - TopLevelArmResource getByResourceGroup(String resourceGroupName, String topLevelArmResourcePropertiesName); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, String newParameter, Context context); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, Context context); - - /** - * Delete a TopLevelArmResource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void delete(String resourceGroupName, String topLevelArmResourcePropertiesName); - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, String newParameter, Context context); - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, - String parameter, Context context); - - /** - * A synchronous resource action. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void action(String resourceGroupName, String topLevelArmResourcePropertiesName); - - /** - * Get a TopLevelArmResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - TopLevelArmResource getById(String id); - - /** - * Get a TopLevelArmResource. - * - * @param id the resource ID. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a TopLevelArmResource along with {@link Response}. - */ - Response getByIdWithResponse(String id, String parameter, String newParameter, - Context context); - - /** - * Delete a TopLevelArmResource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Delete a TopLevelArmResource. - * - * @param id the resource ID. - * @param parameter The parameter parameter. - * @param newParameter The newParameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByIdWithResponse(String id, String parameter, String newParameter, Context context); - - /** - * Delete a TopLevelArmResource. - * - * @param id the resource ID. - * @param parameter The parameter parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByIdWithResponse(String id, String parameter, Context context); - - /** - * Begins definition for a new TopLevelArmResource resource. - * - * @param name resource name. - * @return the first stage of the new TopLevelArmResource definition. - */ - TopLevelArmResource.DefinitionStages.Blank define(String name); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/package-info.java deleted file mode 100644 index aca33de66ee..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the data models for ArmVersioned. - * Arm Resource Provider management API. - */ -package tsptest.armversioned.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/package-info.java deleted file mode 100644 index b306aaf7b89..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * Package containing the classes for ArmVersioned. - * Arm Resource Provider management API. - */ -package tsptest.armversioned; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinAsyncClient.java deleted file mode 100644 index d5741af7c39..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinAsyncClient.java +++ /dev/null @@ -1,268 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.builtin; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.FluxUtil; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; -import tsptest.builtin.implementation.BuiltinOpsImpl; -import tsptest.builtin.models.Builtin; - -/** - * Initializes a new instance of the asynchronous BuiltinClient type. - */ -@ServiceClient(builder = BuiltinClientBuilder.class, isAsync = true) -public final class BuiltinAsyncClient { - @Generated - private final BuiltinOpsImpl serviceClient; - - /** - * Initializes an instance of BuiltinAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BuiltinAsyncClient(BuiltinOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The read operation. - *

Query Parameters

- * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
query-optStringNoThe queryParamOptional parameter
query-opt-encodedStringNoThe queryParamOptionalEncoded parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
x-ms-dateOffsetDateTimeNoThe dateTime parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: boolean (Required)
-     *     string: String (Required)
-     *     bytes: byte[] (Required)
-     *     int: int (Required)
-     *     safeint: long (Required)
-     *     decimal: BigDecimal (Required)
-     *     long: long (Required)
-     *     float: double (Required)
-     *     double: double (Required)
-     *     duration: Duration (Required)
-     *     date: LocalDate (Required)
-     *     dateTime: OffsetDateTime (Required)
-     *     stringList (Required): [
-     *         String (Required)
-     *     ]
-     *     bytesDict (Required): {
-     *         String: byte[] (Required)
-     *     }
-     *     url: String (Required)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     *     encoded (Required): {
-     *         timeInSeconds: Long (Optional)
-     *         timeInSecondsFraction: Double (Optional)
-     *         dateTime: OffsetDateTime (Optional)
-     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
-     *         unixTimestamp: Long (Optional)
-     *         base64: byte[] (Optional)
-     *         base64url: Base64Url (Optional)
-     *         unknownDurationFormat: String (Optional)
-     *         unknownDateTimeFormat: String (Optional)
-     *         unknownBytes: String (Optional)
-     *         commaDeliminatedArray (Optional): [
-     *             String (Optional)
-     *         ]
-     *     }
-     *     uuid: String (Required)
-     * }
-     * }
-     * 
- * - * @param queryParam The queryParam parameter. - * @param queryParamEncoded The queryParamEncoded parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> readWithResponse(String queryParam, String queryParamEncoded, - RequestOptions requestOptions) { - return this.serviceClient.readWithResponseAsync(queryParam, queryParamEncoded, requestOptions); - } - - /** - * The write operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: boolean (Required)
-     *     string: String (Required)
-     *     bytes: byte[] (Required)
-     *     int: int (Required)
-     *     safeint: long (Required)
-     *     decimal: BigDecimal (Required)
-     *     long: long (Required)
-     *     float: double (Required)
-     *     double: double (Required)
-     *     duration: Duration (Required)
-     *     date: LocalDate (Required)
-     *     dateTime: OffsetDateTime (Required)
-     *     stringList (Required): [
-     *         String (Required)
-     *     ]
-     *     bytesDict (Required): {
-     *         String: byte[] (Required)
-     *     }
-     *     url: String (Required)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     *     encoded (Required): {
-     *         timeInSeconds: Long (Optional)
-     *         timeInSecondsFraction: Double (Optional)
-     *         dateTime: OffsetDateTime (Optional)
-     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
-     *         unixTimestamp: Long (Optional)
-     *         base64: byte[] (Optional)
-     *         base64url: Base64Url (Optional)
-     *         unknownDurationFormat: String (Optional)
-     *         unknownDateTimeFormat: String (Optional)
-     *         unknownBytes: String (Optional)
-     *         commaDeliminatedArray (Optional): [
-     *             String (Optional)
-     *         ]
-     *     }
-     *     uuid: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> writeWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.writeWithResponseAsync(body, requestOptions); - } - - /** - * The read operation. - * - * @param queryParam The queryParam parameter. - * @param queryParamEncoded The queryParamEncoded parameter. - * @param dateTime The dateTime parameter. - * @param filter The filter parameter. - * @param queryParamOptional The queryParamOptional parameter. - * @param queryParamOptionalEncoded The queryParamOptionalEncoded parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono read(String queryParam, String queryParamEncoded, OffsetDateTime dateTime, String filter, - String queryParamOptional, String queryParamOptionalEncoded) { - // Generated convenience method for readWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (dateTime != null) { - requestOptions.setHeader(HttpHeaderName.X_MS_DATE, String.valueOf(new DateTimeRfc1123(dateTime))); - } - if (filter != null) { - requestOptions.addQueryParam("filter", filter, false); - } - if (queryParamOptional != null) { - requestOptions.addQueryParam("query-opt", queryParamOptional, false); - } - if (queryParamOptionalEncoded != null) { - requestOptions.addQueryParam("query-opt-encoded", queryParamOptionalEncoded, true); - } - return readWithResponse(queryParam, queryParamEncoded, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Builtin.class)); - } - - /** - * The read operation. - * - * @param queryParam The queryParam parameter. - * @param queryParamEncoded The queryParamEncoded parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono read(String queryParam, String queryParamEncoded) { - // Generated convenience method for readWithResponse - RequestOptions requestOptions = new RequestOptions(); - return readWithResponse(queryParam, queryParamEncoded, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Builtin.class)); - } - - /** - * The write operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono write(Builtin body) { - // Generated convenience method for writeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return writeWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClient.java deleted file mode 100644 index bd2fb3d0c98..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClient.java +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.builtin; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; -import tsptest.builtin.implementation.BuiltinOpsImpl; -import tsptest.builtin.models.Builtin; - -/** - * Initializes a new instance of the synchronous BuiltinClient type. - */ -@ServiceClient(builder = BuiltinClientBuilder.class) -public final class BuiltinClient { - @Generated - private final BuiltinOpsImpl serviceClient; - - /** - * Initializes an instance of BuiltinClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BuiltinClient(BuiltinOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The read operation. - *

Query Parameters

- * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
query-optStringNoThe queryParamOptional parameter
query-opt-encodedStringNoThe queryParamOptionalEncoded parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
x-ms-dateOffsetDateTimeNoThe dateTime parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: boolean (Required)
-     *     string: String (Required)
-     *     bytes: byte[] (Required)
-     *     int: int (Required)
-     *     safeint: long (Required)
-     *     decimal: BigDecimal (Required)
-     *     long: long (Required)
-     *     float: double (Required)
-     *     double: double (Required)
-     *     duration: Duration (Required)
-     *     date: LocalDate (Required)
-     *     dateTime: OffsetDateTime (Required)
-     *     stringList (Required): [
-     *         String (Required)
-     *     ]
-     *     bytesDict (Required): {
-     *         String: byte[] (Required)
-     *     }
-     *     url: String (Required)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     *     encoded (Required): {
-     *         timeInSeconds: Long (Optional)
-     *         timeInSecondsFraction: Double (Optional)
-     *         dateTime: OffsetDateTime (Optional)
-     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
-     *         unixTimestamp: Long (Optional)
-     *         base64: byte[] (Optional)
-     *         base64url: Base64Url (Optional)
-     *         unknownDurationFormat: String (Optional)
-     *         unknownDateTimeFormat: String (Optional)
-     *         unknownBytes: String (Optional)
-     *         commaDeliminatedArray (Optional): [
-     *             String (Optional)
-     *         ]
-     *     }
-     *     uuid: String (Required)
-     * }
-     * }
-     * 
- * - * @param queryParam The queryParam parameter. - * @param queryParamEncoded The queryParamEncoded parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response readWithResponse(String queryParam, String queryParamEncoded, - RequestOptions requestOptions) { - return this.serviceClient.readWithResponse(queryParam, queryParamEncoded, requestOptions); - } - - /** - * The write operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: boolean (Required)
-     *     string: String (Required)
-     *     bytes: byte[] (Required)
-     *     int: int (Required)
-     *     safeint: long (Required)
-     *     decimal: BigDecimal (Required)
-     *     long: long (Required)
-     *     float: double (Required)
-     *     double: double (Required)
-     *     duration: Duration (Required)
-     *     date: LocalDate (Required)
-     *     dateTime: OffsetDateTime (Required)
-     *     stringList (Required): [
-     *         String (Required)
-     *     ]
-     *     bytesDict (Required): {
-     *         String: byte[] (Required)
-     *     }
-     *     url: String (Required)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     *     encoded (Required): {
-     *         timeInSeconds: Long (Optional)
-     *         timeInSecondsFraction: Double (Optional)
-     *         dateTime: OffsetDateTime (Optional)
-     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
-     *         unixTimestamp: Long (Optional)
-     *         base64: byte[] (Optional)
-     *         base64url: Base64Url (Optional)
-     *         unknownDurationFormat: String (Optional)
-     *         unknownDateTimeFormat: String (Optional)
-     *         unknownBytes: String (Optional)
-     *         commaDeliminatedArray (Optional): [
-     *             String (Optional)
-     *         ]
-     *     }
-     *     uuid: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response writeWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.writeWithResponse(body, requestOptions); - } - - /** - * The read operation. - * - * @param queryParam The queryParam parameter. - * @param queryParamEncoded The queryParamEncoded parameter. - * @param dateTime The dateTime parameter. - * @param filter The filter parameter. - * @param queryParamOptional The queryParamOptional parameter. - * @param queryParamOptionalEncoded The queryParamOptionalEncoded parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Builtin read(String queryParam, String queryParamEncoded, OffsetDateTime dateTime, String filter, - String queryParamOptional, String queryParamOptionalEncoded) { - // Generated convenience method for readWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (dateTime != null) { - requestOptions.setHeader(HttpHeaderName.X_MS_DATE, String.valueOf(new DateTimeRfc1123(dateTime))); - } - if (filter != null) { - requestOptions.addQueryParam("filter", filter, false); - } - if (queryParamOptional != null) { - requestOptions.addQueryParam("query-opt", queryParamOptional, false); - } - if (queryParamOptionalEncoded != null) { - requestOptions.addQueryParam("query-opt-encoded", queryParamOptionalEncoded, true); - } - return readWithResponse(queryParam, queryParamEncoded, requestOptions).getValue().toObject(Builtin.class); - } - - /** - * The read operation. - * - * @param queryParam The queryParam parameter. - * @param queryParamEncoded The queryParamEncoded parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Builtin read(String queryParam, String queryParamEncoded) { - // Generated convenience method for readWithResponse - RequestOptions requestOptions = new RequestOptions(); - return readWithResponse(queryParam, queryParamEncoded, requestOptions).getValue().toObject(Builtin.class); - } - - /** - * The write operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void write(Builtin body) { - // Generated convenience method for writeWithResponse - RequestOptions requestOptions = new RequestOptions(); - writeWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClientBuilder.java deleted file mode 100644 index 972d64dc1d2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.builtin; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.builtin.implementation.BuiltinClientImpl; - -/** - * A builder for creating a new instance of the BuiltinClient type. - */ -@ServiceClientBuilder(serviceClients = { BuiltinClient.class, BuiltinAsyncClient.class }) -public final class BuiltinClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-builtin.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the BuiltinClientBuilder. - */ - @Generated - public BuiltinClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BuiltinClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BuiltinClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BuiltinClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BuiltinClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BuiltinClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BuiltinClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BuiltinClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public BuiltinClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the BuiltinClientBuilder. - */ - @Generated - public BuiltinClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of BuiltinClientImpl with the provided parameters. - * - * @return an instance of BuiltinClientImpl. - */ - @Generated - private BuiltinClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - BuiltinClientImpl client - = new BuiltinClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of BuiltinAsyncClient class. - * - * @return an instance of BuiltinAsyncClient. - */ - @Generated - public BuiltinAsyncClient buildAsyncClient() { - return new BuiltinAsyncClient(buildInnerClient().getBuiltinOps()); - } - - /** - * Builds an instance of BuiltinClient class. - * - * @return an instance of BuiltinClient. - */ - @Generated - public BuiltinClient buildClient() { - return new BuiltinClient(buildInnerClient().getBuiltinOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(BuiltinClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinClientImpl.java deleted file mode 100644 index 6623c46236b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.builtin.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 BuiltinClient type. - */ -public final class BuiltinClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 BuiltinOpsImpl object to access its operations. - */ - private final BuiltinOpsImpl builtinOps; - - /** - * Gets the BuiltinOpsImpl object to access its operations. - * - * @return the BuiltinOpsImpl object. - */ - public BuiltinOpsImpl getBuiltinOps() { - return this.builtinOps; - } - - /** - * Initializes an instance of BuiltinClient client. - * - * @param endpoint Service host. - */ - public BuiltinClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of BuiltinClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public BuiltinClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of BuiltinClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public BuiltinClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.builtinOps = new BuiltinOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinOpsImpl.java deleted file mode 100644 index 009b00691a7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinOpsImpl.java +++ /dev/null @@ -1,394 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.builtin.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in BuiltinOps. - */ -public final class BuiltinOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BuiltinOpsService service; - - /** - * The service client containing this operation class. - */ - private final BuiltinClientImpl client; - - /** - * Initializes an instance of BuiltinOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BuiltinOpsImpl(BuiltinClientImpl client) { - this.service - = RestProxy.create(BuiltinOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for BuiltinClientBuiltinOps to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "BuiltinClientBuiltinOps") - public interface BuiltinOpsService { - @Get("/builtin") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> read(@HostParam("endpoint") String endpoint, @QueryParam("query") String queryParam, - @QueryParam(value = "query-encoded", encoded = true) String queryParamEncoded, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/builtin") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response readSync(@HostParam("endpoint") String endpoint, @QueryParam("query") String queryParam, - @QueryParam(value = "query-encoded", encoded = true) String queryParamEncoded, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/builtin") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> write(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/builtin") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response writeSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The read operation. - *

Query Parameters

- * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
query-optStringNoThe queryParamOptional parameter
query-opt-encodedStringNoThe queryParamOptionalEncoded parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
x-ms-dateOffsetDateTimeNoThe dateTime parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: boolean (Required)
-     *     string: String (Required)
-     *     bytes: byte[] (Required)
-     *     int: int (Required)
-     *     safeint: long (Required)
-     *     decimal: BigDecimal (Required)
-     *     long: long (Required)
-     *     float: double (Required)
-     *     double: double (Required)
-     *     duration: Duration (Required)
-     *     date: LocalDate (Required)
-     *     dateTime: OffsetDateTime (Required)
-     *     stringList (Required): [
-     *         String (Required)
-     *     ]
-     *     bytesDict (Required): {
-     *         String: byte[] (Required)
-     *     }
-     *     url: String (Required)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     *     encoded (Required): {
-     *         timeInSeconds: Long (Optional)
-     *         timeInSecondsFraction: Double (Optional)
-     *         dateTime: OffsetDateTime (Optional)
-     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
-     *         unixTimestamp: Long (Optional)
-     *         base64: byte[] (Optional)
-     *         base64url: Base64Url (Optional)
-     *         unknownDurationFormat: String (Optional)
-     *         unknownDateTimeFormat: String (Optional)
-     *         unknownBytes: String (Optional)
-     *         commaDeliminatedArray (Optional): [
-     *             String (Optional)
-     *         ]
-     *     }
-     *     uuid: String (Required)
-     * }
-     * }
-     * 
- * - * @param queryParam The queryParam parameter. - * @param queryParamEncoded The queryParamEncoded parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> readWithResponseAsync(String queryParam, String queryParamEncoded, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.read(this.client.getEndpoint(), queryParam, queryParamEncoded, - accept, requestOptions, context)); - } - - /** - * The read operation. - *

Query Parameters

- * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
query-optStringNoThe queryParamOptional parameter
query-opt-encodedStringNoThe queryParamOptionalEncoded parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
x-ms-dateOffsetDateTimeNoThe dateTime parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: boolean (Required)
-     *     string: String (Required)
-     *     bytes: byte[] (Required)
-     *     int: int (Required)
-     *     safeint: long (Required)
-     *     decimal: BigDecimal (Required)
-     *     long: long (Required)
-     *     float: double (Required)
-     *     double: double (Required)
-     *     duration: Duration (Required)
-     *     date: LocalDate (Required)
-     *     dateTime: OffsetDateTime (Required)
-     *     stringList (Required): [
-     *         String (Required)
-     *     ]
-     *     bytesDict (Required): {
-     *         String: byte[] (Required)
-     *     }
-     *     url: String (Required)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     *     encoded (Required): {
-     *         timeInSeconds: Long (Optional)
-     *         timeInSecondsFraction: Double (Optional)
-     *         dateTime: OffsetDateTime (Optional)
-     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
-     *         unixTimestamp: Long (Optional)
-     *         base64: byte[] (Optional)
-     *         base64url: Base64Url (Optional)
-     *         unknownDurationFormat: String (Optional)
-     *         unknownDateTimeFormat: String (Optional)
-     *         unknownBytes: String (Optional)
-     *         commaDeliminatedArray (Optional): [
-     *             String (Optional)
-     *         ]
-     *     }
-     *     uuid: String (Required)
-     * }
-     * }
-     * 
- * - * @param queryParam The queryParam parameter. - * @param queryParamEncoded The queryParamEncoded parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response readWithResponse(String queryParam, String queryParamEncoded, - RequestOptions requestOptions) { - final String accept = "application/json"; - return service.readSync(this.client.getEndpoint(), queryParam, queryParamEncoded, accept, requestOptions, - Context.NONE); - } - - /** - * The write operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: boolean (Required)
-     *     string: String (Required)
-     *     bytes: byte[] (Required)
-     *     int: int (Required)
-     *     safeint: long (Required)
-     *     decimal: BigDecimal (Required)
-     *     long: long (Required)
-     *     float: double (Required)
-     *     double: double (Required)
-     *     duration: Duration (Required)
-     *     date: LocalDate (Required)
-     *     dateTime: OffsetDateTime (Required)
-     *     stringList (Required): [
-     *         String (Required)
-     *     ]
-     *     bytesDict (Required): {
-     *         String: byte[] (Required)
-     *     }
-     *     url: String (Required)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     *     encoded (Required): {
-     *         timeInSeconds: Long (Optional)
-     *         timeInSecondsFraction: Double (Optional)
-     *         dateTime: OffsetDateTime (Optional)
-     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
-     *         unixTimestamp: Long (Optional)
-     *         base64: byte[] (Optional)
-     *         base64url: Base64Url (Optional)
-     *         unknownDurationFormat: String (Optional)
-     *         unknownDateTimeFormat: String (Optional)
-     *         unknownBytes: String (Optional)
-     *         commaDeliminatedArray (Optional): [
-     *             String (Optional)
-     *         ]
-     *     }
-     *     uuid: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> writeWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.write(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The write operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: boolean (Required)
-     *     string: String (Required)
-     *     bytes: byte[] (Required)
-     *     int: int (Required)
-     *     safeint: long (Required)
-     *     decimal: BigDecimal (Required)
-     *     long: long (Required)
-     *     float: double (Required)
-     *     double: double (Required)
-     *     duration: Duration (Required)
-     *     date: LocalDate (Required)
-     *     dateTime: OffsetDateTime (Required)
-     *     stringList (Required): [
-     *         String (Required)
-     *     ]
-     *     bytesDict (Required): {
-     *         String: byte[] (Required)
-     *     }
-     *     url: String (Required)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     *     encoded (Required): {
-     *         timeInSeconds: Long (Optional)
-     *         timeInSecondsFraction: Double (Optional)
-     *         dateTime: OffsetDateTime (Optional)
-     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
-     *         unixTimestamp: Long (Optional)
-     *         base64: byte[] (Optional)
-     *         base64url: Base64Url (Optional)
-     *         unknownDurationFormat: String (Optional)
-     *         unknownDateTimeFormat: String (Optional)
-     *         unknownBytes: String (Optional)
-     *         commaDeliminatedArray (Optional): [
-     *             String (Optional)
-     *         ]
-     *     }
-     *     uuid: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response writeWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.writeSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/package-info.java deleted file mode 100644 index 6d83286025d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Builtin. - * - */ -package tsptest.builtin.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Builtin.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Builtin.java deleted file mode 100644 index 00041d3f8be..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Builtin.java +++ /dev/null @@ -1,474 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.builtin.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.math.BigDecimal; -import java.time.Duration; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * The Builtin model. - */ -@Immutable -public final class Builtin implements JsonSerializable { - /* - * The boolean property. - */ - @Generated - private final boolean booleanProperty; - - /* - * The string property. - */ - @Generated - private final String string; - - /* - * The bytes property. - */ - @Generated - private final byte[] bytes; - - /* - * The int property. - */ - @Generated - private final int intProperty; - - /* - * The safeint property. - */ - @Generated - private final long safeint; - - /* - * The decimal property. - */ - @Generated - private final BigDecimal decimal; - - /* - * The long property. - */ - @Generated - private final long longProperty; - - /* - * The float property. - */ - @Generated - private final double floatProperty; - - /* - * The double property. - */ - @Generated - private final double doubleProperty; - - /* - * The duration property. - */ - @Generated - private final Duration duration; - - /* - * The date property. - */ - @Generated - private final LocalDate date; - - /* - * The dateTime property. - */ - @Generated - private final OffsetDateTime dateTime; - - /* - * The stringList property. - */ - @Generated - private final List stringList; - - /* - * The bytesDict property. - */ - @Generated - private final Map bytesDict; - - /* - * The url property. - */ - @Generated - private final String url; - - /* - * The nullableFloatDict property. - */ - @Generated - private final Map nullableFloatDict; - - /* - * The encoded property. - */ - @Generated - private final Encoded encoded; - - /* - * The uuid property. - */ - @Generated - private final String uuid; - - /** - * Creates an instance of Builtin class. - * - * @param booleanProperty the booleanProperty value to set. - * @param string the string value to set. - * @param bytes the bytes value to set. - * @param intProperty the intProperty value to set. - * @param safeint the safeint value to set. - * @param decimal the decimal value to set. - * @param longProperty the longProperty value to set. - * @param floatProperty the floatProperty value to set. - * @param doubleProperty the doubleProperty value to set. - * @param duration the duration value to set. - * @param date the date value to set. - * @param dateTime the dateTime value to set. - * @param stringList the stringList value to set. - * @param bytesDict the bytesDict value to set. - * @param url the url value to set. - * @param nullableFloatDict the nullableFloatDict value to set. - * @param encoded the encoded value to set. - * @param uuid the uuid value to set. - */ - @Generated - public Builtin(boolean booleanProperty, String string, byte[] bytes, int intProperty, long safeint, - BigDecimal decimal, long longProperty, double floatProperty, double doubleProperty, Duration duration, - LocalDate date, OffsetDateTime dateTime, List stringList, Map bytesDict, String url, - Map nullableFloatDict, Encoded encoded, String uuid) { - this.booleanProperty = booleanProperty; - this.string = string; - this.bytes = bytes; - this.intProperty = intProperty; - this.safeint = safeint; - this.decimal = decimal; - this.longProperty = longProperty; - this.floatProperty = floatProperty; - this.doubleProperty = doubleProperty; - this.duration = duration; - this.date = date; - this.dateTime = dateTime; - this.stringList = stringList; - this.bytesDict = bytesDict; - this.url = url; - this.nullableFloatDict = nullableFloatDict; - this.encoded = encoded; - this.uuid = uuid; - } - - /** - * Get the booleanProperty property: The boolean property. - * - * @return the booleanProperty value. - */ - @Generated - public boolean isBooleanProperty() { - return this.booleanProperty; - } - - /** - * Get the string property: The string property. - * - * @return the string value. - */ - @Generated - public String getString() { - return this.string; - } - - /** - * Get the bytes property: The bytes property. - * - * @return the bytes value. - */ - @Generated - public byte[] getBytes() { - return CoreUtils.clone(this.bytes); - } - - /** - * Get the intProperty property: The int property. - * - * @return the intProperty value. - */ - @Generated - public int getIntProperty() { - return this.intProperty; - } - - /** - * Get the safeint property: The safeint property. - * - * @return the safeint value. - */ - @Generated - public long getSafeint() { - return this.safeint; - } - - /** - * Get the decimal property: The decimal property. - * - * @return the decimal value. - */ - @Generated - public BigDecimal getDecimal() { - return this.decimal; - } - - /** - * Get the longProperty property: The long property. - * - * @return the longProperty value. - */ - @Generated - public long getLongProperty() { - return this.longProperty; - } - - /** - * Get the floatProperty property: The float property. - * - * @return the floatProperty value. - */ - @Generated - public double getFloatProperty() { - return this.floatProperty; - } - - /** - * Get the doubleProperty property: The double property. - * - * @return the doubleProperty value. - */ - @Generated - public double getDoubleProperty() { - return this.doubleProperty; - } - - /** - * Get the duration property: The duration property. - * - * @return the duration value. - */ - @Generated - public Duration getDuration() { - return this.duration; - } - - /** - * Get the date property: The date property. - * - * @return the date value. - */ - @Generated - public LocalDate getDate() { - return this.date; - } - - /** - * Get the dateTime property: The dateTime property. - * - * @return the dateTime value. - */ - @Generated - public OffsetDateTime getDateTime() { - return this.dateTime; - } - - /** - * Get the stringList property: The stringList property. - * - * @return the stringList value. - */ - @Generated - public List getStringList() { - return this.stringList; - } - - /** - * Get the bytesDict property: The bytesDict property. - * - * @return the bytesDict value. - */ - @Generated - public Map getBytesDict() { - return this.bytesDict; - } - - /** - * Get the url property: The url property. - * - * @return the url value. - */ - @Generated - public String getUrl() { - return this.url; - } - - /** - * Get the nullableFloatDict property: The nullableFloatDict property. - * - * @return the nullableFloatDict value. - */ - @Generated - public Map getNullableFloatDict() { - return this.nullableFloatDict; - } - - /** - * Get the encoded property: The encoded property. - * - * @return the encoded value. - */ - @Generated - public Encoded getEncoded() { - return this.encoded; - } - - /** - * Get the uuid property: The uuid property. - * - * @return the uuid value. - */ - @Generated - public String getUuid() { - return this.uuid; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("boolean", this.booleanProperty); - jsonWriter.writeStringField("string", this.string); - jsonWriter.writeBinaryField("bytes", this.bytes); - jsonWriter.writeIntField("int", this.intProperty); - jsonWriter.writeLongField("safeint", this.safeint); - jsonWriter.writeNumberField("decimal", this.decimal); - jsonWriter.writeLongField("long", this.longProperty); - jsonWriter.writeDoubleField("float", this.floatProperty); - jsonWriter.writeDoubleField("double", this.doubleProperty); - jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); - jsonWriter.writeStringField("date", Objects.toString(this.date, null)); - jsonWriter.writeStringField("dateTime", - this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); - jsonWriter.writeArrayField("stringList", this.stringList, (writer, element) -> writer.writeString(element)); - jsonWriter.writeMapField("bytesDict", this.bytesDict, (writer, element) -> writer.writeBinary(element)); - jsonWriter.writeStringField("url", this.url); - jsonWriter.writeMapField("nullableFloatDict", this.nullableFloatDict, - (writer, element) -> writer.writeNumber(element)); - jsonWriter.writeJsonField("encoded", this.encoded); - jsonWriter.writeStringField("uuid", this.uuid); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Builtin from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Builtin if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Builtin. - */ - @Generated - public static Builtin fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - boolean booleanProperty = false; - String string = null; - byte[] bytes = null; - int intProperty = 0; - long safeint = 0L; - BigDecimal decimal = null; - long longProperty = 0L; - double floatProperty = 0.0; - double doubleProperty = 0.0; - Duration duration = null; - LocalDate date = null; - OffsetDateTime dateTime = null; - List stringList = null; - Map bytesDict = null; - String url = null; - Map nullableFloatDict = null; - Encoded encoded = null; - String uuid = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("boolean".equals(fieldName)) { - booleanProperty = reader.getBoolean(); - } else if ("string".equals(fieldName)) { - string = reader.getString(); - } else if ("bytes".equals(fieldName)) { - bytes = reader.getBinary(); - } else if ("int".equals(fieldName)) { - intProperty = reader.getInt(); - } else if ("safeint".equals(fieldName)) { - safeint = reader.getLong(); - } else if ("decimal".equals(fieldName)) { - decimal = reader.getNullable(nonNullReader -> new BigDecimal(nonNullReader.getString())); - } else if ("long".equals(fieldName)) { - longProperty = reader.getLong(); - } else if ("float".equals(fieldName)) { - floatProperty = reader.getDouble(); - } else if ("double".equals(fieldName)) { - doubleProperty = reader.getDouble(); - } else if ("duration".equals(fieldName)) { - duration = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); - } else if ("date".equals(fieldName)) { - date = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); - } else if ("dateTime".equals(fieldName)) { - dateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("stringList".equals(fieldName)) { - stringList = reader.readArray(reader1 -> reader1.getString()); - } else if ("bytesDict".equals(fieldName)) { - bytesDict = reader.readMap(reader1 -> reader1.getBinary()); - } else if ("url".equals(fieldName)) { - url = reader.getString(); - } else if ("nullableFloatDict".equals(fieldName)) { - nullableFloatDict = reader.readMap(reader1 -> reader1.getNullable(JsonReader::getDouble)); - } else if ("encoded".equals(fieldName)) { - encoded = Encoded.fromJson(reader); - } else if ("uuid".equals(fieldName)) { - uuid = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Builtin(booleanProperty, string, bytes, intProperty, safeint, decimal, longProperty, - floatProperty, doubleProperty, duration, date, dateTime, stringList, bytesDict, url, nullableFloatDict, - encoded, uuid); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Encoded.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Encoded.java deleted file mode 100644 index 47297757eac..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Encoded.java +++ /dev/null @@ -1,465 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.builtin.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.Base64Url; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; -import java.time.Instant; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * The Encoded model. - */ -@Fluent -public final class Encoded implements JsonSerializable { - /* - * The timeInSeconds property. - */ - @Generated - private Long timeInSeconds; - - /* - * The timeInSecondsFraction property. - */ - @Generated - private Double timeInSecondsFraction; - - /* - * The dateTime property. - */ - @Generated - private OffsetDateTime dateTime; - - /* - * The dateTimeRfc7231 property. - */ - @Generated - private DateTimeRfc1123 dateTimeRfc7231; - - /* - * The unixTimestamp property. - */ - @Generated - private Long unixTimestamp; - - /* - * The base64 property. - */ - @Generated - private byte[] base64; - - /* - * The base64url property. - */ - @Generated - private Base64Url base64url; - - /* - * The unknownDurationFormat property. - */ - @Generated - private String unknownDurationFormat; - - /* - * The unknownDateTimeFormat property. - */ - @Generated - private String unknownDateTimeFormat; - - /* - * The unknownBytes property. - */ - @Generated - private String unknownBytes; - - /* - * The commaDeliminatedArray property. - */ - @Generated - private List commaDeliminatedArray; - - /** - * Creates an instance of Encoded class. - */ - @Generated - public Encoded() { - } - - /** - * Get the timeInSeconds property: The timeInSeconds property. - * - * @return the timeInSeconds value. - */ - @Generated - public Duration getTimeInSeconds() { - if (this.timeInSeconds == null) { - return null; - } - return Duration.ofSeconds(this.timeInSeconds); - } - - /** - * Set the timeInSeconds property: The timeInSeconds property. - * - * @param timeInSeconds the timeInSeconds value to set. - * @return the Encoded object itself. - */ - @Generated - public Encoded setTimeInSeconds(Duration timeInSeconds) { - if (timeInSeconds == null) { - this.timeInSeconds = null; - } else { - this.timeInSeconds = timeInSeconds.getSeconds(); - } - return this; - } - - /** - * Get the timeInSecondsFraction property: The timeInSecondsFraction property. - * - * @return the timeInSecondsFraction value. - */ - @Generated - public Duration getTimeInSecondsFraction() { - if (this.timeInSecondsFraction == null) { - return null; - } - return Duration.ofNanos((long) (this.timeInSecondsFraction * 1000_000_000L)); - } - - /** - * Set the timeInSecondsFraction property: The timeInSecondsFraction property. - * - * @param timeInSecondsFraction the timeInSecondsFraction value to set. - * @return the Encoded object itself. - */ - @Generated - public Encoded setTimeInSecondsFraction(Duration timeInSecondsFraction) { - if (timeInSecondsFraction == null) { - this.timeInSecondsFraction = null; - } else { - this.timeInSecondsFraction = (double) timeInSecondsFraction.toNanos() / 1000_000_000L; - } - return this; - } - - /** - * Get the dateTime property: The dateTime property. - * - * @return the dateTime value. - */ - @Generated - public OffsetDateTime getDateTime() { - return this.dateTime; - } - - /** - * Set the dateTime property: The dateTime property. - * - * @param dateTime the dateTime value to set. - * @return the Encoded object itself. - */ - @Generated - public Encoded setDateTime(OffsetDateTime dateTime) { - this.dateTime = dateTime; - return this; - } - - /** - * Get the dateTimeRfc7231 property: The dateTimeRfc7231 property. - * - * @return the dateTimeRfc7231 value. - */ - @Generated - public OffsetDateTime getDateTimeRfc7231() { - if (this.dateTimeRfc7231 == null) { - return null; - } - return this.dateTimeRfc7231.getDateTime(); - } - - /** - * Set the dateTimeRfc7231 property: The dateTimeRfc7231 property. - * - * @param dateTimeRfc7231 the dateTimeRfc7231 value to set. - * @return the Encoded object itself. - */ - @Generated - public Encoded setDateTimeRfc7231(OffsetDateTime dateTimeRfc7231) { - if (dateTimeRfc7231 == null) { - this.dateTimeRfc7231 = null; - } else { - this.dateTimeRfc7231 = new DateTimeRfc1123(dateTimeRfc7231); - } - return this; - } - - /** - * Get the unixTimestamp property: The unixTimestamp property. - * - * @return the unixTimestamp value. - */ - @Generated - public OffsetDateTime getUnixTimestamp() { - if (this.unixTimestamp == null) { - return null; - } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.unixTimestamp), ZoneOffset.UTC); - } - - /** - * Set the unixTimestamp property: The unixTimestamp property. - * - * @param unixTimestamp the unixTimestamp value to set. - * @return the Encoded object itself. - */ - @Generated - public Encoded setUnixTimestamp(OffsetDateTime unixTimestamp) { - if (unixTimestamp == null) { - this.unixTimestamp = null; - } else { - this.unixTimestamp = unixTimestamp.toEpochSecond(); - } - return this; - } - - /** - * Get the base64 property: The base64 property. - * - * @return the base64 value. - */ - @Generated - public byte[] getBase64() { - return CoreUtils.clone(this.base64); - } - - /** - * Set the base64 property: The base64 property. - * - * @param base64 the base64 value to set. - * @return the Encoded object itself. - */ - @Generated - public Encoded setBase64(byte[] base64) { - this.base64 = CoreUtils.clone(base64); - return this; - } - - /** - * Get the base64url property: The base64url property. - * - * @return the base64url value. - */ - @Generated - public byte[] getBase64url() { - if (this.base64url == null) { - return null; - } - return this.base64url.decodedBytes(); - } - - /** - * Set the base64url property: The base64url property. - * - * @param base64url the base64url value to set. - * @return the Encoded object itself. - */ - @Generated - public Encoded setBase64url(byte[] base64url) { - if (base64url == null) { - this.base64url = null; - } else { - this.base64url = Base64Url.encode(CoreUtils.clone(base64url)); - } - return this; - } - - /** - * Get the unknownDurationFormat property: The unknownDurationFormat property. - * - * @return the unknownDurationFormat value. - */ - @Generated - public String getUnknownDurationFormat() { - return this.unknownDurationFormat; - } - - /** - * Set the unknownDurationFormat property: The unknownDurationFormat property. - * - * @param unknownDurationFormat the unknownDurationFormat value to set. - * @return the Encoded object itself. - */ - @Generated - public Encoded setUnknownDurationFormat(String unknownDurationFormat) { - this.unknownDurationFormat = unknownDurationFormat; - return this; - } - - /** - * Get the unknownDateTimeFormat property: The unknownDateTimeFormat property. - * - * @return the unknownDateTimeFormat value. - */ - @Generated - public String getUnknownDateTimeFormat() { - return this.unknownDateTimeFormat; - } - - /** - * Set the unknownDateTimeFormat property: The unknownDateTimeFormat property. - * - * @param unknownDateTimeFormat the unknownDateTimeFormat value to set. - * @return the Encoded object itself. - */ - @Generated - public Encoded setUnknownDateTimeFormat(String unknownDateTimeFormat) { - this.unknownDateTimeFormat = unknownDateTimeFormat; - return this; - } - - /** - * Get the unknownBytes property: The unknownBytes property. - * - * @return the unknownBytes value. - */ - @Generated - public String getUnknownBytes() { - return this.unknownBytes; - } - - /** - * Set the unknownBytes property: The unknownBytes property. - * - * @param unknownBytes the unknownBytes value to set. - * @return the Encoded object itself. - */ - @Generated - public Encoded setUnknownBytes(String unknownBytes) { - this.unknownBytes = unknownBytes; - return this; - } - - /** - * Get the commaDeliminatedArray property: The commaDeliminatedArray property. - * - * @return the commaDeliminatedArray value. - */ - @Generated - public List getCommaDeliminatedArray() { - return this.commaDeliminatedArray; - } - - /** - * Set the commaDeliminatedArray property: The commaDeliminatedArray property. - * - * @param commaDeliminatedArray the commaDeliminatedArray value to set. - * @return the Encoded object itself. - */ - @Generated - public Encoded setCommaDeliminatedArray(List commaDeliminatedArray) { - this.commaDeliminatedArray = commaDeliminatedArray; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("timeInSeconds", this.timeInSeconds); - jsonWriter.writeNumberField("timeInSecondsFraction", this.timeInSecondsFraction); - jsonWriter.writeStringField("dateTime", - this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); - jsonWriter.writeStringField("dateTimeRfc7231", Objects.toString(this.dateTimeRfc7231, null)); - jsonWriter.writeNumberField("unixTimestamp", this.unixTimestamp); - jsonWriter.writeBinaryField("base64", this.base64); - jsonWriter.writeStringField("base64url", Objects.toString(this.base64url, null)); - jsonWriter.writeStringField("unknownDurationFormat", this.unknownDurationFormat); - jsonWriter.writeStringField("unknownDateTimeFormat", this.unknownDateTimeFormat); - jsonWriter.writeStringField("unknownBytes", this.unknownBytes); - if (this.commaDeliminatedArray != null) { - jsonWriter.writeStringField("commaDeliminatedArray", - this.commaDeliminatedArray.stream() - .map(element -> element == null ? "" : element) - .collect(Collectors.joining(","))); - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Encoded from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Encoded if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IOException If an error occurs while reading the Encoded. - */ - @Generated - public static Encoded fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Encoded deserializedEncoded = new Encoded(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("timeInSeconds".equals(fieldName)) { - deserializedEncoded.timeInSeconds = reader.getNullable(JsonReader::getLong); - } else if ("timeInSecondsFraction".equals(fieldName)) { - deserializedEncoded.timeInSecondsFraction = reader.getNullable(JsonReader::getDouble); - } else if ("dateTime".equals(fieldName)) { - deserializedEncoded.dateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("dateTimeRfc7231".equals(fieldName)) { - deserializedEncoded.dateTimeRfc7231 - = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); - } else if ("unixTimestamp".equals(fieldName)) { - deserializedEncoded.unixTimestamp = reader.getNullable(JsonReader::getLong); - } else if ("base64".equals(fieldName)) { - deserializedEncoded.base64 = reader.getBinary(); - } else if ("base64url".equals(fieldName)) { - deserializedEncoded.base64url - = reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); - } else if ("unknownDurationFormat".equals(fieldName)) { - deserializedEncoded.unknownDurationFormat = reader.getString(); - } else if ("unknownDateTimeFormat".equals(fieldName)) { - deserializedEncoded.unknownDateTimeFormat = reader.getString(); - } else if ("unknownBytes".equals(fieldName)) { - deserializedEncoded.unknownBytes = reader.getString(); - } else if ("commaDeliminatedArray".equals(fieldName)) { - String commaDeliminatedArrayEncodedAsString = reader.getString(); - List commaDeliminatedArray = commaDeliminatedArrayEncodedAsString == null - ? null - : commaDeliminatedArrayEncodedAsString.isEmpty() - ? new LinkedList<>() - : new LinkedList<>(Arrays.asList(commaDeliminatedArrayEncodedAsString.split(",", -1))); - deserializedEncoded.commaDeliminatedArray = commaDeliminatedArray; - } else { - reader.skipChildren(); - } - } - - return deserializedEncoded; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/package-info.java deleted file mode 100644 index a343a91ee8a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Builtin. - * - */ -package tsptest.builtin.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/package-info.java deleted file mode 100644 index c22b26e030b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Builtin. - * - */ -package tsptest.builtin; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationAsyncClient.java deleted file mode 100644 index 1a69c6c7479..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationAsyncClient.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.clientinitialization; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClient; -import tsptest.clientinitialization.implementation.ClientInitializationClientImpl; - -/** - * Initializes a new instance of the asynchronous ClientInitializationClient type. - */ -@ServiceClient(builder = ClientInitializationClientBuilder.class, isAsync = true) -public final class ClientInitializationAsyncClient { - @Generated - private final ClientInitializationClientImpl serviceClient; - - /** - * Initializes an instance of ClientInitializationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ClientInitializationAsyncClient(ClientInitializationClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Gets an instance of SubAsyncClient class. - * - * @param name The name parameter. - * @return an instance of SubAsyncClient class. - */ - public SubAsyncClient getSubAsyncClient(String name) { - return new SubAsyncClient(serviceClient.getSubClient(name)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClient.java deleted file mode 100644 index ea7cbc2f1b6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClient.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.clientinitialization; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClient; -import tsptest.clientinitialization.implementation.ClientInitializationClientImpl; - -/** - * Initializes a new instance of the synchronous ClientInitializationClient type. - */ -@ServiceClient(builder = ClientInitializationClientBuilder.class) -public final class ClientInitializationClient { - @Generated - private final ClientInitializationClientImpl serviceClient; - - /** - * Initializes an instance of ClientInitializationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ClientInitializationClient(ClientInitializationClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Gets an instance of SubClient class. - * - * @param name The name parameter. - * @return an instance of SubClient class. - */ - public SubClient getSubClient(String name) { - return new SubClient(serviceClient.getSubClient(name)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClientBuilder.java deleted file mode 100644 index 94ead6fa1d3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClientBuilder.java +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.clientinitialization; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.clientinitialization.implementation.ClientInitializationClientImpl; - -/** - * A builder for creating a new instance of the ClientInitializationClient type. - */ -@ServiceClientBuilder( - serviceClients = { - ClientInitializationClient.class, - ClientInitializationAsyncClient.class, - SubClient.class, - SubAsyncClient.class }) -public final class ClientInitializationClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("tsptest-clientinitialization.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ClientInitializationClientBuilder. - */ - @Generated - public ClientInitializationClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientInitializationClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientInitializationClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientInitializationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientInitializationClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientInitializationClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientInitializationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientInitializationClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ClientInitializationClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ClientInitializationClientBuilder. - */ - @Generated - public ClientInitializationClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ClientInitializationClientImpl with the provided parameters. - * - * @return an instance of ClientInitializationClientImpl. - */ - @Generated - private ClientInitializationClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ClientInitializationClientImpl client = new ClientInitializationClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ClientInitializationAsyncClient class. - * - * @return an instance of ClientInitializationAsyncClient. - */ - @Generated - public ClientInitializationAsyncClient buildAsyncClient() { - return new ClientInitializationAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ClientInitializationClient class. - * - * @return an instance of ClientInitializationClient. - */ - @Generated - public ClientInitializationClient buildClient() { - return new ClientInitializationClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ClientInitializationClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubAsyncClient.java deleted file mode 100644 index c45a8623d20..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubAsyncClient.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.clientinitialization; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.clientinitialization.implementation.SubClientImpl; - -/** - * Initializes a new instance of the asynchronous SubClient type. - */ -@ServiceClient(builder = ClientInitializationClientBuilder.class, isAsync = true) -public final class SubAsyncClient { - @Generated - private final SubClientImpl serviceClient; - - /** - * Initializes an instance of SubAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SubAsyncClient(SubClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The action operation. - * - * @param type The type parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> actionWithResponse(String type, RequestOptions requestOptions) { - return this.serviceClient.actionWithResponseAsync(type, requestOptions); - } - - /** - * The action operation. - * - * @param type The type parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono action(String type) { - // Generated convenience method for actionWithResponse - RequestOptions requestOptions = new RequestOptions(); - return actionWithResponse(type, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubClient.java deleted file mode 100644 index 999520fafd2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubClient.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.clientinitialization; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import tsptest.clientinitialization.implementation.SubClientImpl; - -/** - * Initializes a new instance of the synchronous SubClient type. - */ -@ServiceClient(builder = ClientInitializationClientBuilder.class) -public final class SubClient { - @Generated - private final SubClientImpl serviceClient; - - /** - * Initializes an instance of SubClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SubClient(SubClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The action operation. - * - * @param type The type parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response actionWithResponse(String type, RequestOptions requestOptions) { - return this.serviceClient.actionWithResponse(type, requestOptions); - } - - /** - * The action operation. - * - * @param type The type parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void action(String type) { - // Generated convenience method for actionWithResponse - RequestOptions requestOptions = new RequestOptions(); - actionWithResponse(type, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/ClientInitializationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/ClientInitializationClientImpl.java deleted file mode 100644 index 4fcf2e7b03e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/ClientInitializationClientImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.clientinitialization.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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; -import java.util.Objects; - -/** - * Initializes a new instance of the ClientInitializationClient type. - */ -public final class ClientInitializationClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of ClientInitializationClient client. - * - * @param endpoint Service host. - */ - public ClientInitializationClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ClientInitializationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ClientInitializationClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ClientInitializationClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ClientInitializationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - } - - /** - * Gets an instance of SubClientImpl class. - * - * @param name The name parameter. - * @return an instance of SubClientImpl class. - */ - public SubClientImpl getSubClient(String name) { - Objects.requireNonNull(name, "'name' cannot be null."); - return new SubClientImpl(httpPipeline, serializerAdapter, endpoint, name); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/SubClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/SubClientImpl.java deleted file mode 100644 index a7dc22f2f8d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/SubClientImpl.java +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.clientinitialization.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the SubClient type. - */ -public final class SubClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SubClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - */ - private final String name; - - /** - * Gets. - * - * @return the name value. - */ - public String getName() { - return this.name; - } - - /** - * 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; - } - - /** - * Initializes an instance of SubClient client. - * - * @param endpoint Service host. - * @param name - */ - public SubClientImpl(String endpoint, String name) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name); - } - - /** - * Initializes an instance of SubClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param name - */ - public SubClientImpl(HttpPipeline httpPipeline, String endpoint, String name) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name); - } - - /** - * Initializes an instance of SubClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param name - */ - public SubClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, String name) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.name = name; - this.service = RestProxy.create(SubClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for SubClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SubClient") - public interface SubClientService { - @Post("/client/initialization/basic/sub-client/{name}:action") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> action(@HostParam("endpoint") String endpoint, @PathParam("name") String name, - @QueryParam("type") String type, RequestOptions requestOptions, Context context); - - @Post("/client/initialization/basic/sub-client/{name}:action") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response actionSync(@HostParam("endpoint") String endpoint, @PathParam("name") String name, - @QueryParam("type") String type, RequestOptions requestOptions, Context context); - } - - /** - * The action operation. - * - * @param type The type parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> actionWithResponseAsync(String type, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.action(this.getEndpoint(), this.getName(), type, requestOptions, context)); - } - - /** - * The action operation. - * - * @param type The type parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response actionWithResponse(String type, RequestOptions requestOptions) { - return service.actionSync(this.getEndpoint(), this.getName(), type, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/package-info.java deleted file mode 100644 index 2703870d89a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ClientInitialization. - * Describe client with `@clientInitialization`. - * - */ -package tsptest.clientinitialization.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/package-info.java deleted file mode 100644 index 125a21a8abc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ClientInitialization. - * Describe client with `@clientInitialization`. - * - */ -package tsptest.clientinitialization; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesAsyncClient.java deleted file mode 100644 index e73463da429..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesAsyncClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.discriminatoredgecases; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.discriminatoredgecases.implementation.DiscriminatorEdgeCasesClientImpl; -import tsptest.discriminatoredgecases.models.ChildWithAnotherDiscriminator; -import tsptest.discriminatoredgecases.models.ChildWithRequiredPropertyAsDiscriminator; - -/** - * Initializes a new instance of the asynchronous DiscriminatorEdgeCasesClient type. - */ -@ServiceClient(builder = DiscriminatorEdgeCasesClientBuilder.class, isAsync = true) -public final class DiscriminatorEdgeCasesAsyncClient { - @Generated - private final DiscriminatorEdgeCasesClientImpl serviceClient; - - /** - * Initializes an instance of DiscriminatorEdgeCasesAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DiscriminatorEdgeCasesAsyncClient(DiscriminatorEdgeCasesClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getChildRequiredDiscrim operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     discriminator: String (Required)
-     *     aProperty: String (Required)
-     *     anotherProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getChildRequiredDiscrimWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getChildRequiredDiscrimWithResponseAsync(requestOptions); - } - - /** - * The getChildNewDiscrim operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     discriminator: String (Required)
-     *     aProperty: String (Required)
-     *     differentDiscriminator: String (Required)
-     *     yetAnotherProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getChildNewDiscrimWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getChildNewDiscrimWithResponseAsync(requestOptions); - } - - /** - * The getChildRequiredDiscrim operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getChildRequiredDiscrim() { - // Generated convenience method for getChildRequiredDiscrimWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getChildRequiredDiscrimWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ChildWithRequiredPropertyAsDiscriminator.class)); - } - - /** - * The getChildNewDiscrim operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getChildNewDiscrim() { - // Generated convenience method for getChildNewDiscrimWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getChildNewDiscrimWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ChildWithAnotherDiscriminator.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClient.java deleted file mode 100644 index 1ffb3e582e3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.discriminatoredgecases; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.discriminatoredgecases.implementation.DiscriminatorEdgeCasesClientImpl; -import tsptest.discriminatoredgecases.models.ChildWithAnotherDiscriminator; -import tsptest.discriminatoredgecases.models.ChildWithRequiredPropertyAsDiscriminator; - -/** - * Initializes a new instance of the synchronous DiscriminatorEdgeCasesClient type. - */ -@ServiceClient(builder = DiscriminatorEdgeCasesClientBuilder.class) -public final class DiscriminatorEdgeCasesClient { - @Generated - private final DiscriminatorEdgeCasesClientImpl serviceClient; - - /** - * Initializes an instance of DiscriminatorEdgeCasesClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DiscriminatorEdgeCasesClient(DiscriminatorEdgeCasesClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getChildRequiredDiscrim operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     discriminator: String (Required)
-     *     aProperty: String (Required)
-     *     anotherProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getChildRequiredDiscrimWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getChildRequiredDiscrimWithResponse(requestOptions); - } - - /** - * The getChildNewDiscrim operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     discriminator: String (Required)
-     *     aProperty: String (Required)
-     *     differentDiscriminator: String (Required)
-     *     yetAnotherProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getChildNewDiscrimWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getChildNewDiscrimWithResponse(requestOptions); - } - - /** - * The getChildRequiredDiscrim operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ChildWithRequiredPropertyAsDiscriminator getChildRequiredDiscrim() { - // Generated convenience method for getChildRequiredDiscrimWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getChildRequiredDiscrimWithResponse(requestOptions).getValue() - .toObject(ChildWithRequiredPropertyAsDiscriminator.class); - } - - /** - * The getChildNewDiscrim operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ChildWithAnotherDiscriminator getChildNewDiscrim() { - // Generated convenience method for getChildNewDiscrimWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getChildNewDiscrimWithResponse(requestOptions).getValue().toObject(ChildWithAnotherDiscriminator.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClientBuilder.java deleted file mode 100644 index 17fc6f82b57..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.discriminatoredgecases; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.discriminatoredgecases.implementation.DiscriminatorEdgeCasesClientImpl; - -/** - * A builder for creating a new instance of the DiscriminatorEdgeCasesClient type. - */ -@ServiceClientBuilder(serviceClients = { DiscriminatorEdgeCasesClient.class, DiscriminatorEdgeCasesAsyncClient.class }) -public final class DiscriminatorEdgeCasesClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("tsptest-discriminatoredgecases.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the DiscriminatorEdgeCasesClientBuilder. - */ - @Generated - public DiscriminatorEdgeCasesClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatorEdgeCasesClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatorEdgeCasesClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatorEdgeCasesClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatorEdgeCasesClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatorEdgeCasesClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatorEdgeCasesClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatorEdgeCasesClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatorEdgeCasesClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the DiscriminatorEdgeCasesClientBuilder. - */ - @Generated - public DiscriminatorEdgeCasesClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of DiscriminatorEdgeCasesClientImpl with the provided parameters. - * - * @return an instance of DiscriminatorEdgeCasesClientImpl. - */ - @Generated - private DiscriminatorEdgeCasesClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - DiscriminatorEdgeCasesClientImpl client = new DiscriminatorEdgeCasesClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of DiscriminatorEdgeCasesAsyncClient class. - * - * @return an instance of DiscriminatorEdgeCasesAsyncClient. - */ - @Generated - public DiscriminatorEdgeCasesAsyncClient buildAsyncClient() { - return new DiscriminatorEdgeCasesAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of DiscriminatorEdgeCasesClient class. - * - * @return an instance of DiscriminatorEdgeCasesClient. - */ - @Generated - public DiscriminatorEdgeCasesClient buildClient() { - return new DiscriminatorEdgeCasesClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(DiscriminatorEdgeCasesClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/DiscriminatorEdgeCasesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/DiscriminatorEdgeCasesClientImpl.java deleted file mode 100644 index 9ac447b8517..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/DiscriminatorEdgeCasesClientImpl.java +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.discriminatoredgecases.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the DiscriminatorEdgeCasesClient type. - */ -public final class DiscriminatorEdgeCasesClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DiscriminatorEdgeCasesClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of DiscriminatorEdgeCasesClient client. - * - * @param endpoint Service host. - */ - public DiscriminatorEdgeCasesClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DiscriminatorEdgeCasesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public DiscriminatorEdgeCasesClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DiscriminatorEdgeCasesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public DiscriminatorEdgeCasesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(DiscriminatorEdgeCasesClientService.class, this.httpPipeline, - this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for DiscriminatorEdgeCasesClient to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DiscriminatorEdgeCasesClient") - public interface DiscriminatorEdgeCasesClientService { - @Get("/model/childrequireddiscrim") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getChildRequiredDiscrim(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/model/childrequireddiscrim") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getChildRequiredDiscrimSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/model/childnewdiscrim") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getChildNewDiscrim(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/model/childnewdiscrim") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getChildNewDiscrimSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * The getChildRequiredDiscrim operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     discriminator: String (Required)
-     *     aProperty: String (Required)
-     *     anotherProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getChildRequiredDiscrimWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getChildRequiredDiscrim(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getChildRequiredDiscrim operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     discriminator: String (Required)
-     *     aProperty: String (Required)
-     *     anotherProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getChildRequiredDiscrimWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getChildRequiredDiscrimSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getChildNewDiscrim operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     discriminator: String (Required)
-     *     aProperty: String (Required)
-     *     differentDiscriminator: String (Required)
-     *     yetAnotherProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getChildNewDiscrimWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getChildNewDiscrim(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getChildNewDiscrim operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     discriminator: String (Required)
-     *     aProperty: String (Required)
-     *     differentDiscriminator: String (Required)
-     *     yetAnotherProperty: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getChildNewDiscrimWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getChildNewDiscrimSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/package-info.java deleted file mode 100644 index edd1791b5df..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for DiscriminatorEdgeCases. - * - */ -package tsptest.discriminatoredgecases.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithAnotherDiscriminator.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithAnotherDiscriminator.java deleted file mode 100644 index e766b34f42a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithAnotherDiscriminator.java +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.discriminatoredgecases.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ChildWithAnotherDiscriminator model. - */ -@Immutable -public class ChildWithAnotherDiscriminator extends ParentWithRequiredProperty { - /* - * Discriminator property for ChildWithAnotherDiscriminator. - */ - @Generated - private String differentDiscriminator = "ChildWithAnotherDiscriminator"; - - /* - * The yetAnotherProperty property. - */ - @Generated - private final String yetAnotherProperty; - - /** - * Creates an instance of ChildWithAnotherDiscriminator class. - * - * @param discriminator the discriminator value to set. - * @param aProperty the aProperty value to set. - * @param yetAnotherProperty the yetAnotherProperty value to set. - */ - @Generated - protected ChildWithAnotherDiscriminator(String discriminator, String aProperty, String yetAnotherProperty) { - super(discriminator, aProperty); - this.yetAnotherProperty = yetAnotherProperty; - } - - /** - * Get the differentDiscriminator property: Discriminator property for ChildWithAnotherDiscriminator. - * - * @return the differentDiscriminator value. - */ - @Generated - public String getDifferentDiscriminator() { - return this.differentDiscriminator; - } - - /** - * Get the yetAnotherProperty property: The yetAnotherProperty property. - * - * @return the yetAnotherProperty value. - */ - @Generated - public String getYetAnotherProperty() { - return this.yetAnotherProperty; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("discriminator", getDiscriminator()); - jsonWriter.writeStringField("aProperty", getAProperty()); - jsonWriter.writeStringField("yetAnotherProperty", this.yetAnotherProperty); - jsonWriter.writeStringField("differentDiscriminator", this.differentDiscriminator); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChildWithAnotherDiscriminator from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChildWithAnotherDiscriminator if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ChildWithAnotherDiscriminator. - */ - @Generated - public static ChildWithAnotherDiscriminator fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("differentDiscriminator".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("anotherValue".equals(discriminatorValue)) { - return GrandChildWithAnotherDiscriminator.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static ChildWithAnotherDiscriminator fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminator = null; - String aProperty = null; - String yetAnotherProperty = null; - String differentDiscriminator = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("discriminator".equals(fieldName)) { - discriminator = reader.getString(); - } else if ("aProperty".equals(fieldName)) { - aProperty = reader.getString(); - } else if ("yetAnotherProperty".equals(fieldName)) { - yetAnotherProperty = reader.getString(); - } else if ("differentDiscriminator".equals(fieldName)) { - differentDiscriminator = reader.getString(); - } else { - reader.skipChildren(); - } - } - ChildWithAnotherDiscriminator deserializedChildWithAnotherDiscriminator - = new ChildWithAnotherDiscriminator(discriminator, aProperty, yetAnotherProperty); - deserializedChildWithAnotherDiscriminator.differentDiscriminator = differentDiscriminator; - - return deserializedChildWithAnotherDiscriminator; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithRequiredPropertyAsDiscriminator.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithRequiredPropertyAsDiscriminator.java deleted file mode 100644 index e0b4fb1f882..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithRequiredPropertyAsDiscriminator.java +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.discriminatoredgecases.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ChildWithRequiredPropertyAsDiscriminator model. - */ -@Immutable -public class ChildWithRequiredPropertyAsDiscriminator extends ParentWithRequiredProperty { - /* - * Discriminator property for ChildWithRequiredPropertyAsDiscriminator. - */ - @Generated - private String discriminator = "ChildWithRequiredPropertyAsDiscriminator"; - - /* - * The anotherProperty property. - */ - @Generated - private final String anotherProperty; - - /** - * Creates an instance of ChildWithRequiredPropertyAsDiscriminator class. - * - * @param discriminator the discriminator value to set. - * @param aProperty the aProperty value to set. - * @param anotherProperty the anotherProperty value to set. - */ - @Generated - protected ChildWithRequiredPropertyAsDiscriminator(String discriminator, String aProperty, String anotherProperty) { - super(discriminator, aProperty); - this.anotherProperty = anotherProperty; - } - - /** - * Get the discriminator property: Discriminator property for ChildWithRequiredPropertyAsDiscriminator. - * - * @return the discriminator value. - */ - @Generated - @Override - public String getDiscriminator() { - return this.discriminator; - } - - /** - * Get the anotherProperty property: The anotherProperty property. - * - * @return the anotherProperty value. - */ - @Generated - public String getAnotherProperty() { - return this.anotherProperty; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("aProperty", getAProperty()); - jsonWriter.writeStringField("anotherProperty", this.anotherProperty); - jsonWriter.writeStringField("discriminator", this.discriminator); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ChildWithRequiredPropertyAsDiscriminator from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ChildWithRequiredPropertyAsDiscriminator if the JsonReader was pointing to an instance of - * it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ChildWithRequiredPropertyAsDiscriminator. - */ - @Generated - public static ChildWithRequiredPropertyAsDiscriminator fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("discriminator".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("aValue".equals(discriminatorValue)) { - return GrandChildWithRequiredProperty.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static ChildWithRequiredPropertyAsDiscriminator fromJsonKnownDiscriminator(JsonReader jsonReader) - throws IOException { - return jsonReader.readObject(reader -> { - String aProperty = null; - String anotherProperty = null; - String discriminator = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("aProperty".equals(fieldName)) { - aProperty = reader.getString(); - } else if ("anotherProperty".equals(fieldName)) { - anotherProperty = reader.getString(); - } else if ("discriminator".equals(fieldName)) { - discriminator = reader.getString(); - } else { - reader.skipChildren(); - } - } - ChildWithRequiredPropertyAsDiscriminator deserializedChildWithRequiredPropertyAsDiscriminator - = new ChildWithRequiredPropertyAsDiscriminator(discriminator, aProperty, anotherProperty); - deserializedChildWithRequiredPropertyAsDiscriminator.discriminator = discriminator; - - return deserializedChildWithRequiredPropertyAsDiscriminator; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithAnotherDiscriminator.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithAnotherDiscriminator.java deleted file mode 100644 index 6c9858dae0f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithAnotherDiscriminator.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.discriminatoredgecases.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GrandChildWithAnotherDiscriminator model. - */ -@Immutable -public final class GrandChildWithAnotherDiscriminator extends ChildWithAnotherDiscriminator { - /* - * Discriminator property for ChildWithAnotherDiscriminator. - */ - @Generated - private String differentDiscriminator = "anotherValue"; - - /** - * Creates an instance of GrandChildWithAnotherDiscriminator class. - * - * @param discriminator the discriminator value to set. - * @param aProperty the aProperty value to set. - * @param yetAnotherProperty the yetAnotherProperty value to set. - */ - @Generated - private GrandChildWithAnotherDiscriminator(String discriminator, String aProperty, String yetAnotherProperty) { - super(discriminator, aProperty, yetAnotherProperty); - } - - /** - * Get the differentDiscriminator property: Discriminator property for ChildWithAnotherDiscriminator. - * - * @return the differentDiscriminator value. - */ - @Generated - @Override - public String getDifferentDiscriminator() { - return this.differentDiscriminator; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("discriminator", getDiscriminator()); - jsonWriter.writeStringField("aProperty", getAProperty()); - jsonWriter.writeStringField("yetAnotherProperty", getYetAnotherProperty()); - jsonWriter.writeStringField("differentDiscriminator", this.differentDiscriminator); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GrandChildWithAnotherDiscriminator from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GrandChildWithAnotherDiscriminator if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GrandChildWithAnotherDiscriminator. - */ - @Generated - public static GrandChildWithAnotherDiscriminator fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminator = null; - String aProperty = null; - String yetAnotherProperty = null; - String differentDiscriminator = "anotherValue"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("discriminator".equals(fieldName)) { - discriminator = reader.getString(); - } else if ("aProperty".equals(fieldName)) { - aProperty = reader.getString(); - } else if ("yetAnotherProperty".equals(fieldName)) { - yetAnotherProperty = reader.getString(); - } else if ("differentDiscriminator".equals(fieldName)) { - differentDiscriminator = reader.getString(); - } else { - reader.skipChildren(); - } - } - GrandChildWithAnotherDiscriminator deserializedGrandChildWithAnotherDiscriminator - = new GrandChildWithAnotherDiscriminator(discriminator, aProperty, yetAnotherProperty); - deserializedGrandChildWithAnotherDiscriminator.differentDiscriminator = differentDiscriminator; - - return deserializedGrandChildWithAnotherDiscriminator; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithRequiredProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithRequiredProperty.java deleted file mode 100644 index 9e475e8b9e7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithRequiredProperty.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.discriminatoredgecases.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GrandChildWithRequiredProperty model. - */ -@Immutable -public final class GrandChildWithRequiredProperty extends ChildWithRequiredPropertyAsDiscriminator { - /* - * Discriminator property for ChildWithRequiredPropertyAsDiscriminator. - */ - @Generated - private String discriminator = "aValue"; - - /** - * Creates an instance of GrandChildWithRequiredProperty class. - * - * @param discriminator the discriminator value to set. - * @param aProperty the aProperty value to set. - * @param anotherProperty the anotherProperty value to set. - */ - @Generated - private GrandChildWithRequiredProperty(String discriminator, String aProperty, String anotherProperty) { - super(discriminator, aProperty, anotherProperty); - } - - /** - * Get the discriminator property: Discriminator property for ChildWithRequiredPropertyAsDiscriminator. - * - * @return the discriminator value. - */ - @Generated - @Override - public String getDiscriminator() { - return this.discriminator; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("aProperty", getAProperty()); - jsonWriter.writeStringField("anotherProperty", getAnotherProperty()); - jsonWriter.writeStringField("discriminator", this.discriminator); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GrandChildWithRequiredProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GrandChildWithRequiredProperty if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GrandChildWithRequiredProperty. - */ - @Generated - public static GrandChildWithRequiredProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String aProperty = null; - String anotherProperty = null; - String discriminator = "aValue"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("aProperty".equals(fieldName)) { - aProperty = reader.getString(); - } else if ("anotherProperty".equals(fieldName)) { - anotherProperty = reader.getString(); - } else if ("discriminator".equals(fieldName)) { - discriminator = reader.getString(); - } else { - reader.skipChildren(); - } - } - GrandChildWithRequiredProperty deserializedGrandChildWithRequiredProperty - = new GrandChildWithRequiredProperty(discriminator, aProperty, anotherProperty); - deserializedGrandChildWithRequiredProperty.discriminator = discriminator; - - return deserializedGrandChildWithRequiredProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ParentWithRequiredProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ParentWithRequiredProperty.java deleted file mode 100644 index 3bd0424d492..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ParentWithRequiredProperty.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.discriminatoredgecases.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ParentWithRequiredProperty model. - */ -@Immutable -public class ParentWithRequiredProperty implements JsonSerializable { - /* - * The discriminator property. - */ - @Generated - private final String discriminator; - - /* - * The aProperty property. - */ - @Generated - private final String aProperty; - - /** - * Creates an instance of ParentWithRequiredProperty class. - * - * @param discriminator the discriminator value to set. - * @param aProperty the aProperty value to set. - */ - @Generated - protected ParentWithRequiredProperty(String discriminator, String aProperty) { - this.discriminator = discriminator; - this.aProperty = aProperty; - } - - /** - * Get the discriminator property: The discriminator property. - * - * @return the discriminator value. - */ - @Generated - public String getDiscriminator() { - return this.discriminator; - } - - /** - * Get the aProperty property: The aProperty property. - * - * @return the aProperty value. - */ - @Generated - public String getAProperty() { - return this.aProperty; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("discriminator", this.discriminator); - jsonWriter.writeStringField("aProperty", this.aProperty); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ParentWithRequiredProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ParentWithRequiredProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ParentWithRequiredProperty. - */ - @Generated - public static ParentWithRequiredProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminator = null; - String aProperty = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("discriminator".equals(fieldName)) { - discriminator = reader.getString(); - } else if ("aProperty".equals(fieldName)) { - aProperty = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ParentWithRequiredProperty(discriminator, aProperty); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/package-info.java deleted file mode 100644 index 2d367fb9ef5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for DiscriminatorEdgeCases. - * - */ -package tsptest.discriminatoredgecases.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/package-info.java deleted file mode 100644 index 79db0c56286..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for DiscriminatorEdgeCases. - * - */ -package tsptest.discriminatoredgecases; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorAsyncClient.java deleted file mode 100644 index 9cef4295ee5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorAsyncClient.java +++ /dev/null @@ -1,322 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumnesteddiscriminator; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.enumnesteddiscriminator.implementation.EnumNestedDiscriminatorClientImpl; -import tsptest.enumnesteddiscriminator.models.Fish; - -/** - * Initializes a new instance of the asynchronous EnumNestedDiscriminatorClient type. - */ -@ServiceClient(builder = EnumNestedDiscriminatorClientBuilder.class, isAsync = true) -public final class EnumNestedDiscriminatorAsyncClient { - @Generated - private final EnumNestedDiscriminatorClientImpl serviceClient; - - /** - * Initializes an instance of EnumNestedDiscriminatorAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnumNestedDiscriminatorAsyncClient(EnumNestedDiscriminatorClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getModelWithResponseAsync(requestOptions); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putModelWithResponseAsync(input, requestOptions); - } - - /** - * The getRecursiveModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getRecursiveModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getRecursiveModelWithResponseAsync(requestOptions); - } - - /** - * The putRecursiveModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putRecursiveModelWithResponseAsync(input, requestOptions); - } - - /** - * The getMissingDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getMissingDiscriminatorWithResponseAsync(requestOptions); - } - - /** - * The getWrongDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWrongDiscriminatorWithResponseAsync(requestOptions); - } - - /** - * The getModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getModel() { - // Generated convenience method for getModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); - } - - /** - * The putModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putModel(Fish input) { - // Generated convenience method for putModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getRecursiveModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getRecursiveModel() { - // Generated convenience method for getRecursiveModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getRecursiveModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); - } - - /** - * The putRecursiveModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putRecursiveModel(Fish input) { - // Generated convenience method for putRecursiveModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putRecursiveModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getMissingDiscriminator operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getMissingDiscriminator() { - // Generated convenience method for getMissingDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getMissingDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); - } - - /** - * The getWrongDiscriminator operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getWrongDiscriminator() { - // Generated convenience method for getWrongDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWrongDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClient.java deleted file mode 100644 index d301486fc39..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClient.java +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumnesteddiscriminator; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.enumnesteddiscriminator.implementation.EnumNestedDiscriminatorClientImpl; -import tsptest.enumnesteddiscriminator.models.Fish; - -/** - * Initializes a new instance of the synchronous EnumNestedDiscriminatorClient type. - */ -@ServiceClient(builder = EnumNestedDiscriminatorClientBuilder.class) -public final class EnumNestedDiscriminatorClient { - @Generated - private final EnumNestedDiscriminatorClientImpl serviceClient; - - /** - * Initializes an instance of EnumNestedDiscriminatorClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnumNestedDiscriminatorClient(EnumNestedDiscriminatorClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getModelWithResponse(requestOptions); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putModelWithResponse(input, requestOptions); - } - - /** - * The getRecursiveModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRecursiveModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getRecursiveModelWithResponse(requestOptions); - } - - /** - * The putRecursiveModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putRecursiveModelWithResponse(input, requestOptions); - } - - /** - * The getMissingDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getMissingDiscriminatorWithResponse(requestOptions); - } - - /** - * The getWrongDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWrongDiscriminatorWithResponse(requestOptions); - } - - /** - * The getModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Fish getModel() { - // Generated convenience method for getModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getModelWithResponse(requestOptions).getValue().toObject(Fish.class); - } - - /** - * The putModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putModel(Fish input) { - // Generated convenience method for putModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - putModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The getRecursiveModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Fish getRecursiveModel() { - // Generated convenience method for getRecursiveModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getRecursiveModelWithResponse(requestOptions).getValue().toObject(Fish.class); - } - - /** - * The putRecursiveModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putRecursiveModel(Fish input) { - // Generated convenience method for putRecursiveModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - putRecursiveModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The getMissingDiscriminator operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Fish getMissingDiscriminator() { - // Generated convenience method for getMissingDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getMissingDiscriminatorWithResponse(requestOptions).getValue().toObject(Fish.class); - } - - /** - * The getWrongDiscriminator operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Fish getWrongDiscriminator() { - // Generated convenience method for getWrongDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWrongDiscriminatorWithResponse(requestOptions).getValue().toObject(Fish.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClientBuilder.java deleted file mode 100644 index 853402b4618..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClientBuilder.java +++ /dev/null @@ -1,289 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumnesteddiscriminator; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.enumnesteddiscriminator.implementation.EnumNestedDiscriminatorClientImpl; - -/** - * A builder for creating a new instance of the EnumNestedDiscriminatorClient type. - */ -@ServiceClientBuilder( - serviceClients = { EnumNestedDiscriminatorClient.class, EnumNestedDiscriminatorAsyncClient.class }) -public final class EnumNestedDiscriminatorClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("tsptest-enumnesteddiscriminator.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the EnumNestedDiscriminatorClientBuilder. - */ - @Generated - public EnumNestedDiscriminatorClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumNestedDiscriminatorClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumNestedDiscriminatorClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumNestedDiscriminatorClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumNestedDiscriminatorClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumNestedDiscriminatorClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumNestedDiscriminatorClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumNestedDiscriminatorClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumNestedDiscriminatorClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the EnumNestedDiscriminatorClientBuilder. - */ - @Generated - public EnumNestedDiscriminatorClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of EnumNestedDiscriminatorClientImpl with the provided parameters. - * - * @return an instance of EnumNestedDiscriminatorClientImpl. - */ - @Generated - private EnumNestedDiscriminatorClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - EnumNestedDiscriminatorClientImpl client = new EnumNestedDiscriminatorClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of EnumNestedDiscriminatorAsyncClient class. - * - * @return an instance of EnumNestedDiscriminatorAsyncClient. - */ - @Generated - public EnumNestedDiscriminatorAsyncClient buildAsyncClient() { - return new EnumNestedDiscriminatorAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of EnumNestedDiscriminatorClient class. - * - * @return an instance of EnumNestedDiscriminatorClient. - */ - @Generated - public EnumNestedDiscriminatorClient buildClient() { - return new EnumNestedDiscriminatorClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(EnumNestedDiscriminatorClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/EnumNestedDiscriminatorClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/EnumNestedDiscriminatorClientImpl.java deleted file mode 100644 index 5fe19752988..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/EnumNestedDiscriminatorClientImpl.java +++ /dev/null @@ -1,571 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumnesteddiscriminator.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the EnumNestedDiscriminatorClient type. - */ -public final class EnumNestedDiscriminatorClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final EnumNestedDiscriminatorClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of EnumNestedDiscriminatorClient client. - * - * @param endpoint Service host. - */ - public EnumNestedDiscriminatorClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of EnumNestedDiscriminatorClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public EnumNestedDiscriminatorClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of EnumNestedDiscriminatorClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public EnumNestedDiscriminatorClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(EnumNestedDiscriminatorClientService.class, this.httpPipeline, - this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for EnumNestedDiscriminatorClient to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "EnumNestedDiscriminatorClient") - public interface EnumNestedDiscriminatorClientService { - @Get("/type/model/inheritance/enum-nested-discriminator/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-nested-discriminator/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getModelSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/enum-nested-discriminator/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/enum-nested-discriminator/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-nested-discriminator/recursivemodel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getRecursiveModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-nested-discriminator/recursivemodel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getRecursiveModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/enum-nested-discriminator/recursivemodel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putRecursiveModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/enum-nested-discriminator/recursivemodel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putRecursiveModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-nested-discriminator/missingdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getMissingDiscriminator(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-nested-discriminator/missingdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getMissingDiscriminatorSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-nested-discriminator/wrongdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getWrongDiscriminator(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-nested-discriminator/wrongdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getWrongDiscriminatorSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getModelWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getModel(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getModelWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.putModel(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The getRecursiveModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getRecursiveModelWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getRecursiveModel(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getRecursiveModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRecursiveModelWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getRecursiveModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The putRecursiveModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putRecursiveModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putRecursiveModel(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The putRecursiveModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putRecursiveModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The getMissingDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getMissingDiscriminatorWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getMissingDiscriminator(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getMissingDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getMissingDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getWrongDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWrongDiscriminatorWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getWrongDiscriminator(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getWrongDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(shark/salmon) (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getWrongDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/package-info.java deleted file mode 100644 index c074e305537..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for EnumNestedDiscriminator. - * Illustrates multiple level inheritance with multiple enum discriminators. - * - */ -package tsptest.enumnesteddiscriminator.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Fish.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Fish.java deleted file mode 100644 index d96a304171f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Fish.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumnesteddiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * This is base model for polymorphic multiple levels inheritance with a discriminator. - */ -@Immutable -public class Fish implements JsonSerializable { - /* - * discriminator property - */ - @Generated - private FishKind kind = FishKind.fromString("Fish"); - - /* - * The age property. - */ - @Generated - private final int age; - - /** - * Creates an instance of Fish class. - * - * @param age the age value to set. - */ - @Generated - public Fish(int age) { - this.age = age; - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - @Generated - public FishKind getKind() { - return this.kind; - } - - /** - * Get the age property: The age property. - * - * @return the age value. - */ - @Generated - public int getAge() { - return this.age; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("age", this.age); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Fish from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Fish if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Fish. - */ - @Generated - public static Fish fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("shark".equals(discriminatorValue)) { - return Shark.fromJson(readerToUse.reset()); - } else if ("salmon".equals(discriminatorValue)) { - return Salmon.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Fish fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int age = 0; - FishKind kind = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - age = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = FishKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - Fish deserializedFish = new Fish(age); - deserializedFish.kind = kind; - - return deserializedFish; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/FishKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/FishKind.java deleted file mode 100644 index 77ee46df394..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/FishKind.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumnesteddiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * extensible enum type for discriminator. - */ -public final class FishKind extends ExpandableStringEnum { - /** - * The kind of fish is shark. - */ - @Generated - public static final FishKind SHARK = fromString("shark"); - - /** - * The kind of fish is salmon. - */ - @Generated - public static final FishKind SALMON = fromString("salmon"); - - /** - * Creates a new instance of FishKind value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public FishKind() { - } - - /** - * Creates or finds a FishKind from its string representation. - * - * @param name a name to look for. - * @return the corresponding FishKind. - */ - @Generated - public static FishKind fromString(String name) { - return fromString(name, FishKind.class); - } - - /** - * Gets known FishKind values. - * - * @return known FishKind values. - */ - @Generated - public static Collection values() { - return values(FishKind.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/GoblinShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/GoblinShark.java deleted file mode 100644 index 323da63dc43..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/GoblinShark.java +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumnesteddiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The third level model GoblinShark in polymorphic multiple levels inheritance. - */ -@Immutable -public final class GoblinShark extends Shark { - /* - * discriminator property - */ - @Generated - private FishKind kind = FishKind.SHARK; - - /* - * The sharktype property. - */ - @Generated - private SharkKind sharktype = SharkKind.GOBLIN; - - /** - * Creates an instance of GoblinShark class. - * - * @param age the age value to set. - */ - @Generated - public GoblinShark(int age) { - super(age); - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - @Generated - @Override - public FishKind getKind() { - return this.kind; - } - - /** - * Get the sharktype property: The sharktype property. - * - * @return the sharktype value. - */ - @Generated - @Override - public SharkKind getSharktype() { - return this.sharktype; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - jsonWriter.writeIntField("age", getAge()); - jsonWriter.writeStringField("sharktype", this.sharktype == null ? null : this.sharktype.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GoblinShark from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GoblinShark if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GoblinShark. - */ - @Generated - public static GoblinShark fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int age = 0; - SharkKind sharktype = SharkKind.GOBLIN; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - age = reader.getInt(); - } else if ("sharktype".equals(fieldName)) { - sharktype = SharkKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - GoblinShark deserializedGoblinShark = new GoblinShark(age); - deserializedGoblinShark.sharktype = sharktype; - - return deserializedGoblinShark; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Salmon.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Salmon.java deleted file mode 100644 index 5cc277929bf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Salmon.java +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumnesteddiscriminator.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic - * instances. - */ -@Fluent -public final class Salmon extends Fish { - /* - * discriminator property - */ - @Generated - private FishKind kind = FishKind.SALMON; - - /* - * The friends property. - */ - @Generated - private List friends; - - /* - * The hate property. - */ - @Generated - private Map hate; - - /* - * The partner property. - */ - @Generated - private Fish partner; - - /** - * Creates an instance of Salmon class. - * - * @param age the age value to set. - */ - @Generated - public Salmon(int age) { - super(age); - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - @Generated - @Override - public FishKind getKind() { - return this.kind; - } - - /** - * Get the friends property: The friends property. - * - * @return the friends value. - */ - @Generated - public List getFriends() { - return this.friends; - } - - /** - * Set the friends property: The friends property. - * - * @param friends the friends value to set. - * @return the Salmon object itself. - */ - @Generated - public Salmon setFriends(List friends) { - this.friends = friends; - return this; - } - - /** - * Get the hate property: The hate property. - * - * @return the hate value. - */ - @Generated - public Map getHate() { - return this.hate; - } - - /** - * Set the hate property: The hate property. - * - * @param hate the hate value to set. - * @return the Salmon object itself. - */ - @Generated - public Salmon setHate(Map hate) { - this.hate = hate; - return this; - } - - /** - * Get the partner property: The partner property. - * - * @return the partner value. - */ - @Generated - public Fish getPartner() { - return this.partner; - } - - /** - * Set the partner property: The partner property. - * - * @param partner the partner value to set. - * @return the Salmon object itself. - */ - @Generated - public Salmon setPartner(Fish partner) { - this.partner = partner; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("age", getAge()); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - jsonWriter.writeArrayField("friends", this.friends, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeMapField("hate", this.hate, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeJsonField("partner", this.partner); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Salmon from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Salmon if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Salmon. - */ - @Generated - public static Salmon fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int age = 0; - FishKind kind = FishKind.SALMON; - List friends = null; - Map hate = null; - Fish partner = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - age = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = FishKind.fromString(reader.getString()); - } else if ("friends".equals(fieldName)) { - friends = reader.readArray(reader1 -> Fish.fromJson(reader1)); - } else if ("hate".equals(fieldName)) { - hate = reader.readMap(reader1 -> Fish.fromJson(reader1)); - } else if ("partner".equals(fieldName)) { - partner = Fish.fromJson(reader); - } else { - reader.skipChildren(); - } - } - Salmon deserializedSalmon = new Salmon(age); - deserializedSalmon.kind = kind; - deserializedSalmon.friends = friends; - deserializedSalmon.hate = hate; - deserializedSalmon.partner = partner; - - return deserializedSalmon; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SawShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SawShark.java deleted file mode 100644 index f8225d9fc6e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SawShark.java +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumnesteddiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The third level model SawShark in polymorphic multiple levels inheritance. - */ -@Immutable -public final class SawShark extends Shark { - /* - * discriminator property - */ - @Generated - private FishKind kind = FishKind.SHARK; - - /* - * The sharktype property. - */ - @Generated - private SharkKind sharktype = SharkKind.SAW; - - /** - * Creates an instance of SawShark class. - * - * @param age the age value to set. - */ - @Generated - public SawShark(int age) { - super(age); - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - @Generated - @Override - public FishKind getKind() { - return this.kind; - } - - /** - * Get the sharktype property: The sharktype property. - * - * @return the sharktype value. - */ - @Generated - @Override - public SharkKind getSharktype() { - return this.sharktype; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - jsonWriter.writeIntField("age", getAge()); - jsonWriter.writeStringField("sharktype", this.sharktype == null ? null : this.sharktype.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SawShark from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SawShark if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SawShark. - */ - @Generated - public static SawShark fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int age = 0; - SharkKind sharktype = SharkKind.SAW; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - age = reader.getInt(); - } else if ("sharktype".equals(fieldName)) { - sharktype = SharkKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - SawShark deserializedSawShark = new SawShark(age); - deserializedSawShark.sharktype = sharktype; - - return deserializedSawShark; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Shark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Shark.java deleted file mode 100644 index f149c82c31b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Shark.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumnesteddiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The second level model in polymorphic multiple levels inheritance and it defines a new discriminator. - */ -@Immutable -public class Shark extends Fish { - /* - * discriminator property - */ - @Generated - private FishKind kind = FishKind.SHARK; - - /* - * The sharktype property. - */ - @Generated - private SharkKind sharktype = SharkKind.fromString("shark"); - - /** - * Creates an instance of Shark class. - * - * @param age the age value to set. - */ - @Generated - public Shark(int age) { - super(age); - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - @Generated - @Override - public FishKind getKind() { - return this.kind; - } - - /** - * Get the sharktype property: The sharktype property. - * - * @return the sharktype value. - */ - @Generated - public SharkKind getSharktype() { - return this.sharktype; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - jsonWriter.writeIntField("age", getAge()); - jsonWriter.writeStringField("sharktype", this.sharktype == null ? null : this.sharktype.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Shark from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Shark if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Shark. - */ - @Generated - public static Shark fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("sharktype".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("saw".equals(discriminatorValue)) { - return SawShark.fromJson(readerToUse.reset()); - } else if ("goblin".equals(discriminatorValue)) { - return GoblinShark.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Shark fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int age = 0; - SharkKind sharktype = SharkKind.fromString("shark"); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - age = reader.getInt(); - } else if ("sharktype".equals(fieldName)) { - sharktype = SharkKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - Shark deserializedShark = new Shark(age); - deserializedShark.sharktype = sharktype; - - return deserializedShark; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SharkKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SharkKind.java deleted file mode 100644 index 0e7e49f3874..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SharkKind.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumnesteddiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * extensible enum type for discriminator. - */ -public final class SharkKind extends ExpandableStringEnum { - /** - * The kind of shark is saw. - */ - @Generated - public static final SharkKind SAW = fromString("saw"); - - /** - * The kind of shark is goblin. - */ - @Generated - public static final SharkKind GOBLIN = fromString("goblin"); - - /** - * Creates a new instance of SharkKind value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public SharkKind() { - } - - /** - * Creates or finds a SharkKind from its string representation. - * - * @param name a name to look for. - * @return the corresponding SharkKind. - */ - @Generated - public static SharkKind fromString(String name) { - return fromString(name, SharkKind.class); - } - - /** - * Gets known SharkKind values. - * - * @return known SharkKind values. - */ - @Generated - public static Collection values() { - return values(SharkKind.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/package-info.java deleted file mode 100644 index ab205d6c3e8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for EnumNestedDiscriminator. - * Illustrates multiple level inheritance with multiple enum discriminators. - * - */ -package tsptest.enumnesteddiscriminator.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/package-info.java deleted file mode 100644 index 1390ac00a39..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for EnumNestedDiscriminator. - * Illustrates multiple level inheritance with multiple enum discriminators. - * - */ -package tsptest.enumnesteddiscriminator; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceAsyncClient.java deleted file mode 100644 index 5eb297d5fdc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceAsyncClient.java +++ /dev/null @@ -1,1045 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.CollectionFormat; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; -import tsptest.enumservice.implementation.EnumServiceClientImpl; -import tsptest.enumservice.models.Color; -import tsptest.enumservice.models.ColorModel; -import tsptest.enumservice.models.Operation; -import tsptest.enumservice.models.OperationStateValues; -import tsptest.enumservice.models.Priority; - -/** - * Initializes a new instance of the asynchronous EnumServiceClient type. - */ -@ServiceClient(builder = EnumServiceClientBuilder.class, isAsync = true) -public final class EnumServiceAsyncClient { - @Generated - private final EnumServiceClientImpl serviceClient; - - /** - * Initializes an instance of EnumServiceAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnumServiceAsyncClient(EnumServiceClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getColor operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Red/Blue/Green)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getColorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getColorWithResponseAsync(requestOptions); - } - - /** - * The getColorModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Red/Blue/Green)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getColorModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getColorModelWithResponseAsync(requestOptions); - } - - /** - * The setColorModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param color The color parameter. Allowed values: "Red", "Blue", "Green". - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setColorModelWithResponse(String color, RequestOptions requestOptions) { - return this.serviceClient.setColorModelWithResponseAsync(color, requestOptions); - } - - /** - * The setPriority operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param priority The priority parameter. Allowed values: 100, 0. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setPriorityWithResponse(String priority, RequestOptions requestOptions) { - return this.serviceClient.setPriorityWithResponseAsync(priority, requestOptions); - } - - /** - * The getRunningOperation operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getRunningOperationWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getRunningOperationWithResponseAsync(requestOptions); - } - - /** - * The getOperation operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param state The state parameter. Allowed values: "Running", "Completed", "Failed". - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getOperationWithResponse(String state, RequestOptions requestOptions) { - return this.serviceClient.getOperationWithResponseAsync(state, requestOptions); - } - - /** - * The setStringEnumArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. In the form of - * "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param colorArray The colorArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setStringEnumArrayWithResponse(List colorArray, - RequestOptions requestOptions) { - return this.serviceClient.setStringEnumArrayWithResponseAsync(colorArray, requestOptions); - } - - /** - * The setIntEnumArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. In the - * form of "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param priorityArray The priorityArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setIntEnumArrayWithResponse(List priorityArray, RequestOptions requestOptions) { - return this.serviceClient.setIntEnumArrayWithResponseAsync(priorityArray, requestOptions); - } - - /** - * The setStringArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. In the form of - * "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param stringArray The stringArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setStringArrayWithResponse(List stringArray, RequestOptions requestOptions) { - return this.serviceClient.setStringArrayWithResponseAsync(stringArray, requestOptions); - } - - /** - * The setIntArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. In the form of "," - * separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param intArray The intArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setIntArrayWithResponse(List intArray, RequestOptions requestOptions) { - return this.serviceClient.setIntArrayWithResponseAsync(intArray, requestOptions); - } - - /** - * The setStringEnumMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param colorArray The colorArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setStringEnumMultiWithResponse(List colorArray, RequestOptions requestOptions) { - return this.serviceClient.setStringEnumMultiWithResponseAsync(colorArray, requestOptions); - } - - /** - * The setIntEnumMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param priorityArray The priorityArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setIntEnumMultiWithResponse(List priorityArray, RequestOptions requestOptions) { - return this.serviceClient.setIntEnumMultiWithResponseAsync(priorityArray, requestOptions); - } - - /** - * The setStringMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param stringArray The stringArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setStringMultiWithResponse(List stringArray, RequestOptions requestOptions) { - return this.serviceClient.setStringMultiWithResponseAsync(stringArray, requestOptions); - } - - /** - * The setIntMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param intArray The intArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setIntMultiWithResponse(List intArray, RequestOptions requestOptions) { - return this.serviceClient.setIntMultiWithResponseAsync(intArray, requestOptions); - } - - /** - * The setStringEnumArrayHeader operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
color-array-optList<String>NoThe colorArrayOpt parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param colorArray The colorArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setStringEnumArrayHeaderWithResponse(List colorArray, - RequestOptions requestOptions) { - return this.serviceClient.setStringEnumArrayHeaderWithResponseAsync(colorArray, requestOptions); - } - - /** - * The getColor operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getColor() { - // Generated convenience method for getColorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getColorWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> Color.fromString(protocolMethodData.toObject(String.class))); - } - - /** - * The getColorModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getColorModel() { - // Generated convenience method for getColorModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getColorModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> ColorModel.fromString(protocolMethodData.toObject(String.class))); - } - - /** - * The setColorModel operation. - * - * @param color The color parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setColorModel(ColorModel color) { - // Generated convenience method for setColorModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setColorModelWithResponse(color.toString(), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Operation.class)); - } - - /** - * The setPriority operation. - * - * @param priority The priority parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setPriority(Priority priority) { - // Generated convenience method for setPriorityWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setPriorityWithResponse(String.valueOf(priority.toInt()), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Operation.class)); - } - - /** - * The getRunningOperation operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getRunningOperation() { - // Generated convenience method for getRunningOperationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getRunningOperationWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Operation.class)); - } - - /** - * The getOperation operation. - * - * @param state The state parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getOperation(OperationStateValues state) { - // Generated convenience method for getOperationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getOperationWithResponse(state.toString(), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Operation.class)); - } - - /** - * The setStringEnumArray operation. - * - * @param colorArray The colorArray parameter. - * @param colorArrayOpt The colorArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a sequence of textual characters on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setStringEnumArray(List colorArray, List colorArrayOpt) { - // Generated convenience method for setStringEnumArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (colorArrayOpt != null) { - requestOptions.addQueryParam("colorArrayOpt", - colorArrayOpt.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")), - false); - } - return setStringEnumArrayWithResponse(colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toString()); - } - - /** - * The setStringEnumArray operation. - * - * @param colorArray The colorArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a sequence of textual characters on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setStringEnumArray(List colorArray) { - // Generated convenience method for setStringEnumArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setStringEnumArrayWithResponse(colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toString()); - } - - /** - * The setIntEnumArray operation. - * - * @param priorityArray The priorityArray parameter. - * @param priorityArrayOpt The priorityArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setIntEnumArray(List priorityArray, List priorityArrayOpt) { - // Generated convenience method for setIntEnumArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (priorityArrayOpt != null) { - requestOptions.addQueryParam("priorityArrayOpt", - priorityArrayOpt.stream() - .map(paramItemValue -> Objects.toString(paramItemValue == null ? null : paramItemValue.toInt(), "")) - .collect(Collectors.joining(",")), - false); - } - return setIntEnumArrayWithResponse(priorityArray.stream() - .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) - .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setIntEnumArray operation. - * - * @param priorityArray The priorityArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setIntEnumArray(List priorityArray) { - // Generated convenience method for setIntEnumArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setIntEnumArrayWithResponse(priorityArray.stream() - .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) - .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setStringArray operation. - * - * @param stringArray The stringArray parameter. - * @param stringArrayOpt The stringArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setStringArray(List stringArray, List stringArrayOpt) { - // Generated convenience method for setStringArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (stringArrayOpt != null) { - requestOptions.addQueryParam("stringArrayOpt", - stringArrayOpt.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")), - false); - } - return setStringArrayWithResponse(stringArray, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setStringArray operation. - * - * @param stringArray The stringArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setStringArray(List stringArray) { - // Generated convenience method for setStringArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setStringArrayWithResponse(stringArray, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setIntArray operation. - * - * @param intArray The intArray parameter. - * @param intArrayOpt The intArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setIntArray(List intArray, List intArrayOpt) { - // Generated convenience method for setIntArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (intArrayOpt != null) { - requestOptions.addQueryParam("intArrayOpt", - JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(intArrayOpt, CollectionFormat.CSV), - false); - } - return setIntArrayWithResponse(intArray, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setIntArray operation. - * - * @param intArray The intArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setIntArray(List intArray) { - // Generated convenience method for setIntArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setIntArrayWithResponse(intArray, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setStringEnumMulti operation. - * - * @param colorArray The colorArray parameter. - * @param colorArrayOpt The colorArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setStringEnumMulti(List colorArray, List colorArrayOpt) { - // Generated convenience method for setStringEnumMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (colorArrayOpt != null) { - for (ColorModel paramItemValue : colorArrayOpt) { - if (paramItemValue != null) { - requestOptions.addQueryParam("colorArrayOpt", paramItemValue.toString(), false); - } - } - } - return setStringEnumMultiWithResponse(colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setStringEnumMulti operation. - * - * @param colorArray The colorArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setStringEnumMulti(List colorArray) { - // Generated convenience method for setStringEnumMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setStringEnumMultiWithResponse(colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setIntEnumMulti operation. - * - * @param priorityArray The priorityArray parameter. - * @param priorityArrayOpt The priorityArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setIntEnumMulti(List priorityArray, List priorityArrayOpt) { - // Generated convenience method for setIntEnumMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (priorityArrayOpt != null) { - for (Priority paramItemValue : priorityArrayOpt) { - if (paramItemValue != null) { - requestOptions.addQueryParam("priorityArrayOpt", String.valueOf(paramItemValue.toInt()), false); - } - } - } - return setIntEnumMultiWithResponse(priorityArray.stream() - .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) - .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setIntEnumMulti operation. - * - * @param priorityArray The priorityArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setIntEnumMulti(List priorityArray) { - // Generated convenience method for setIntEnumMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setIntEnumMultiWithResponse(priorityArray.stream() - .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) - .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setStringMulti operation. - * - * @param stringArray The stringArray parameter. - * @param stringArrayOpt The stringArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setStringMulti(List stringArray, List stringArrayOpt) { - // Generated convenience method for setStringMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (stringArrayOpt != null) { - for (String paramItemValue : stringArrayOpt) { - if (paramItemValue != null) { - requestOptions.addQueryParam("stringArrayOpt", paramItemValue, false); - } - } - } - return setStringMultiWithResponse(stringArray, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setStringMulti operation. - * - * @param stringArray The stringArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setStringMulti(List stringArray) { - // Generated convenience method for setStringMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setStringMultiWithResponse(stringArray, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setIntMulti operation. - * - * @param intArray The intArray parameter. - * @param intArrayOpt The intArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setIntMulti(List intArray, List intArrayOpt) { - // Generated convenience method for setIntMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (intArrayOpt != null) { - for (int paramItemValue : intArrayOpt) { - requestOptions.addQueryParam("intArrayOpt", String.valueOf(paramItemValue), false); - } - } - return setIntMultiWithResponse(intArray, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setIntMulti operation. - * - * @param intArray The intArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setIntMulti(List intArray) { - // Generated convenience method for setIntMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setIntMultiWithResponse(intArray, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setStringEnumArrayHeader operation. - * - * @param colorArray The colorArray parameter. - * @param colorArrayOpt The colorArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setStringEnumArrayHeader(List colorArray, List colorArrayOpt) { - // Generated convenience method for setStringEnumArrayHeaderWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (colorArrayOpt != null) { - requestOptions.setHeader(HttpHeaderName.fromString("color-array-opt"), - colorArrayOpt.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(","))); - } - return setStringEnumArrayHeaderWithResponse(colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The setStringEnumArrayHeader operation. - * - * @param colorArray The colorArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setStringEnumArrayHeader(List colorArray) { - // Generated convenience method for setStringEnumArrayHeaderWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setStringEnumArrayHeaderWithResponse(colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClient.java deleted file mode 100644 index 802a27c8802..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClient.java +++ /dev/null @@ -1,1018 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.CollectionFormat; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import tsptest.enumservice.implementation.EnumServiceClientImpl; -import tsptest.enumservice.models.Color; -import tsptest.enumservice.models.ColorModel; -import tsptest.enumservice.models.Operation; -import tsptest.enumservice.models.OperationStateValues; -import tsptest.enumservice.models.Priority; - -/** - * Initializes a new instance of the synchronous EnumServiceClient type. - */ -@ServiceClient(builder = EnumServiceClientBuilder.class) -public final class EnumServiceClient { - @Generated - private final EnumServiceClientImpl serviceClient; - - /** - * Initializes an instance of EnumServiceClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnumServiceClient(EnumServiceClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getColor operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Red/Blue/Green)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getColorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getColorWithResponse(requestOptions); - } - - /** - * The getColorModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Red/Blue/Green)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getColorModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getColorModelWithResponse(requestOptions); - } - - /** - * The setColorModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param color The color parameter. Allowed values: "Red", "Blue", "Green". - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setColorModelWithResponse(String color, RequestOptions requestOptions) { - return this.serviceClient.setColorModelWithResponse(color, requestOptions); - } - - /** - * The setPriority operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param priority The priority parameter. Allowed values: 100, 0. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setPriorityWithResponse(String priority, RequestOptions requestOptions) { - return this.serviceClient.setPriorityWithResponse(priority, requestOptions); - } - - /** - * The getRunningOperation operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRunningOperationWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getRunningOperationWithResponse(requestOptions); - } - - /** - * The getOperation operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param state The state parameter. Allowed values: "Running", "Completed", "Failed". - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getOperationWithResponse(String state, RequestOptions requestOptions) { - return this.serviceClient.getOperationWithResponse(state, requestOptions); - } - - /** - * The setStringEnumArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. In the form of - * "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param colorArray The colorArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setStringEnumArrayWithResponse(List colorArray, RequestOptions requestOptions) { - return this.serviceClient.setStringEnumArrayWithResponse(colorArray, requestOptions); - } - - /** - * The setIntEnumArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. In the - * form of "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param priorityArray The priorityArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setIntEnumArrayWithResponse(List priorityArray, RequestOptions requestOptions) { - return this.serviceClient.setIntEnumArrayWithResponse(priorityArray, requestOptions); - } - - /** - * The setStringArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. In the form of - * "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param stringArray The stringArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setStringArrayWithResponse(List stringArray, RequestOptions requestOptions) { - return this.serviceClient.setStringArrayWithResponse(stringArray, requestOptions); - } - - /** - * The setIntArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. In the form of "," - * separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param intArray The intArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setIntArrayWithResponse(List intArray, RequestOptions requestOptions) { - return this.serviceClient.setIntArrayWithResponse(intArray, requestOptions); - } - - /** - * The setStringEnumMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param colorArray The colorArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setStringEnumMultiWithResponse(List colorArray, RequestOptions requestOptions) { - return this.serviceClient.setStringEnumMultiWithResponse(colorArray, requestOptions); - } - - /** - * The setIntEnumMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param priorityArray The priorityArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setIntEnumMultiWithResponse(List priorityArray, RequestOptions requestOptions) { - return this.serviceClient.setIntEnumMultiWithResponse(priorityArray, requestOptions); - } - - /** - * The setStringMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param stringArray The stringArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setStringMultiWithResponse(List stringArray, RequestOptions requestOptions) { - return this.serviceClient.setStringMultiWithResponse(stringArray, requestOptions); - } - - /** - * The setIntMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param intArray The intArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setIntMultiWithResponse(List intArray, RequestOptions requestOptions) { - return this.serviceClient.setIntMultiWithResponse(intArray, requestOptions); - } - - /** - * The setStringEnumArrayHeader operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
color-array-optList<String>NoThe colorArrayOpt parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param colorArray The colorArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setStringEnumArrayHeaderWithResponse(List colorArray, RequestOptions requestOptions) { - return this.serviceClient.setStringEnumArrayHeaderWithResponse(colorArray, requestOptions); - } - - /** - * The getColor operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Color getColor() { - // Generated convenience method for getColorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return Color.fromString(getColorWithResponse(requestOptions).getValue().toObject(String.class)); - } - - /** - * The getColorModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ColorModel getColorModel() { - // Generated convenience method for getColorModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return ColorModel.fromString(getColorModelWithResponse(requestOptions).getValue().toObject(String.class)); - } - - /** - * The setColorModel operation. - * - * @param color The color parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Operation setColorModel(ColorModel color) { - // Generated convenience method for setColorModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setColorModelWithResponse(color.toString(), requestOptions).getValue().toObject(Operation.class); - } - - /** - * The setPriority operation. - * - * @param priority The priority parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Operation setPriority(Priority priority) { - // Generated convenience method for setPriorityWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setPriorityWithResponse(String.valueOf(priority.toInt()), requestOptions).getValue() - .toObject(Operation.class); - } - - /** - * The getRunningOperation operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Operation getRunningOperation() { - // Generated convenience method for getRunningOperationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getRunningOperationWithResponse(requestOptions).getValue().toObject(Operation.class); - } - - /** - * The getOperation operation. - * - * @param state The state parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Operation getOperation(OperationStateValues state) { - // Generated convenience method for getOperationWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getOperationWithResponse(state.toString(), requestOptions).getValue().toObject(Operation.class); - } - - /** - * The setStringEnumArray operation. - * - * @param colorArray The colorArray parameter. - * @param colorArrayOpt The colorArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a sequence of textual characters. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public String setStringEnumArray(List colorArray, List colorArrayOpt) { - // Generated convenience method for setStringEnumArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (colorArrayOpt != null) { - requestOptions.addQueryParam("colorArrayOpt", - colorArrayOpt.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")), - false); - } - return setStringEnumArrayWithResponse(colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.toList()), requestOptions).getValue().toString(); - } - - /** - * The setStringEnumArray operation. - * - * @param colorArray The colorArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a sequence of textual characters. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public String setStringEnumArray(List colorArray) { - // Generated convenience method for setStringEnumArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return setStringEnumArrayWithResponse(colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.toList()), requestOptions).getValue().toString(); - } - - /** - * The setIntEnumArray operation. - * - * @param priorityArray The priorityArray parameter. - * @param priorityArrayOpt The priorityArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setIntEnumArray(List priorityArray, List priorityArrayOpt) { - // Generated convenience method for setIntEnumArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (priorityArrayOpt != null) { - requestOptions.addQueryParam("priorityArrayOpt", - priorityArrayOpt.stream() - .map(paramItemValue -> Objects.toString(paramItemValue == null ? null : paramItemValue.toInt(), "")) - .collect(Collectors.joining(",")), - false); - } - setIntEnumArrayWithResponse(priorityArray.stream() - .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) - .collect(Collectors.toList()), requestOptions).getValue(); - } - - /** - * The setIntEnumArray operation. - * - * @param priorityArray The priorityArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setIntEnumArray(List priorityArray) { - // Generated convenience method for setIntEnumArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - setIntEnumArrayWithResponse(priorityArray.stream() - .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) - .collect(Collectors.toList()), requestOptions).getValue(); - } - - /** - * The setStringArray operation. - * - * @param stringArray The stringArray parameter. - * @param stringArrayOpt The stringArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setStringArray(List stringArray, List stringArrayOpt) { - // Generated convenience method for setStringArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (stringArrayOpt != null) { - requestOptions.addQueryParam("stringArrayOpt", - stringArrayOpt.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")), - false); - } - setStringArrayWithResponse(stringArray, requestOptions).getValue(); - } - - /** - * The setStringArray operation. - * - * @param stringArray The stringArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setStringArray(List stringArray) { - // Generated convenience method for setStringArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - setStringArrayWithResponse(stringArray, requestOptions).getValue(); - } - - /** - * The setIntArray operation. - * - * @param intArray The intArray parameter. - * @param intArrayOpt The intArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setIntArray(List intArray, List intArrayOpt) { - // Generated convenience method for setIntArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (intArrayOpt != null) { - requestOptions.addQueryParam("intArrayOpt", - JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(intArrayOpt, CollectionFormat.CSV), - false); - } - setIntArrayWithResponse(intArray, requestOptions).getValue(); - } - - /** - * The setIntArray operation. - * - * @param intArray The intArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setIntArray(List intArray) { - // Generated convenience method for setIntArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - setIntArrayWithResponse(intArray, requestOptions).getValue(); - } - - /** - * The setStringEnumMulti operation. - * - * @param colorArray The colorArray parameter. - * @param colorArrayOpt The colorArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setStringEnumMulti(List colorArray, List colorArrayOpt) { - // Generated convenience method for setStringEnumMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (colorArrayOpt != null) { - for (ColorModel paramItemValue : colorArrayOpt) { - if (paramItemValue != null) { - requestOptions.addQueryParam("colorArrayOpt", paramItemValue.toString(), false); - } - } - } - setStringEnumMultiWithResponse(colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.toList()), requestOptions).getValue(); - } - - /** - * The setStringEnumMulti operation. - * - * @param colorArray The colorArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setStringEnumMulti(List colorArray) { - // Generated convenience method for setStringEnumMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - setStringEnumMultiWithResponse(colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.toList()), requestOptions).getValue(); - } - - /** - * The setIntEnumMulti operation. - * - * @param priorityArray The priorityArray parameter. - * @param priorityArrayOpt The priorityArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setIntEnumMulti(List priorityArray, List priorityArrayOpt) { - // Generated convenience method for setIntEnumMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (priorityArrayOpt != null) { - for (Priority paramItemValue : priorityArrayOpt) { - if (paramItemValue != null) { - requestOptions.addQueryParam("priorityArrayOpt", String.valueOf(paramItemValue.toInt()), false); - } - } - } - setIntEnumMultiWithResponse(priorityArray.stream() - .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) - .collect(Collectors.toList()), requestOptions).getValue(); - } - - /** - * The setIntEnumMulti operation. - * - * @param priorityArray The priorityArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setIntEnumMulti(List priorityArray) { - // Generated convenience method for setIntEnumMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - setIntEnumMultiWithResponse(priorityArray.stream() - .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) - .collect(Collectors.toList()), requestOptions).getValue(); - } - - /** - * The setStringMulti operation. - * - * @param stringArray The stringArray parameter. - * @param stringArrayOpt The stringArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setStringMulti(List stringArray, List stringArrayOpt) { - // Generated convenience method for setStringMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (stringArrayOpt != null) { - for (String paramItemValue : stringArrayOpt) { - if (paramItemValue != null) { - requestOptions.addQueryParam("stringArrayOpt", paramItemValue, false); - } - } - } - setStringMultiWithResponse(stringArray, requestOptions).getValue(); - } - - /** - * The setStringMulti operation. - * - * @param stringArray The stringArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setStringMulti(List stringArray) { - // Generated convenience method for setStringMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - setStringMultiWithResponse(stringArray, requestOptions).getValue(); - } - - /** - * The setIntMulti operation. - * - * @param intArray The intArray parameter. - * @param intArrayOpt The intArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setIntMulti(List intArray, List intArrayOpt) { - // Generated convenience method for setIntMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (intArrayOpt != null) { - for (int paramItemValue : intArrayOpt) { - requestOptions.addQueryParam("intArrayOpt", String.valueOf(paramItemValue), false); - } - } - setIntMultiWithResponse(intArray, requestOptions).getValue(); - } - - /** - * The setIntMulti operation. - * - * @param intArray The intArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setIntMulti(List intArray) { - // Generated convenience method for setIntMultiWithResponse - RequestOptions requestOptions = new RequestOptions(); - setIntMultiWithResponse(intArray, requestOptions).getValue(); - } - - /** - * The setStringEnumArrayHeader operation. - * - * @param colorArray The colorArray parameter. - * @param colorArrayOpt The colorArrayOpt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setStringEnumArrayHeader(List colorArray, List colorArrayOpt) { - // Generated convenience method for setStringEnumArrayHeaderWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (colorArrayOpt != null) { - requestOptions.setHeader(HttpHeaderName.fromString("color-array-opt"), - colorArrayOpt.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(","))); - } - setStringEnumArrayHeaderWithResponse(colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.toList()), requestOptions).getValue(); - } - - /** - * The setStringEnumArrayHeader operation. - * - * @param colorArray The colorArray parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void setStringEnumArrayHeader(List colorArray) { - // Generated convenience method for setStringEnumArrayHeaderWithResponse - RequestOptions requestOptions = new RequestOptions(); - setStringEnumArrayHeaderWithResponse(colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.toList()), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClientBuilder.java deleted file mode 100644 index 8fbd1e16dc5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.enumservice.implementation.EnumServiceClientImpl; - -/** - * A builder for creating a new instance of the EnumServiceClient type. - */ -@ServiceClientBuilder(serviceClients = { EnumServiceClient.class, EnumServiceAsyncClient.class }) -public final class EnumServiceClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-enumservice.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the EnumServiceClientBuilder. - */ - @Generated - public EnumServiceClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumServiceClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumServiceClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumServiceClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumServiceClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumServiceClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumServiceClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumServiceClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumServiceClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the EnumServiceClientBuilder. - */ - @Generated - public EnumServiceClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of EnumServiceClientImpl with the provided parameters. - * - * @return an instance of EnumServiceClientImpl. - */ - @Generated - private EnumServiceClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - EnumServiceClientImpl client - = new EnumServiceClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of EnumServiceAsyncClient class. - * - * @return an instance of EnumServiceAsyncClient. - */ - @Generated - public EnumServiceAsyncClient buildAsyncClient() { - return new EnumServiceAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of EnumServiceClient class. - * - * @return an instance of EnumServiceClient. - */ - @Generated - public EnumServiceClient buildClient() { - return new EnumServiceClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(EnumServiceClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/EnumServiceClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/EnumServiceClientImpl.java deleted file mode 100644 index fce35a37c7a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/EnumServiceClientImpl.java +++ /dev/null @@ -1,1320 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.CollectionFormat; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the EnumServiceClient type. - */ -public final class EnumServiceClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final EnumServiceClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of EnumServiceClient client. - * - * @param endpoint Service host. - */ - public EnumServiceClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of EnumServiceClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public EnumServiceClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of EnumServiceClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public EnumServiceClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(EnumServiceClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for EnumServiceClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "EnumServiceClient") - public interface EnumServiceClientService { - @Get("/enum/color") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getColor(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/enum/color") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getColorSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/enum/colormodel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getColorModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/enum/colormodel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getColorModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/enum/operation/colormodel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> setColorModel(@HostParam("endpoint") String endpoint, - @QueryParam("color") String color, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Post("/enum/operation/colormodel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response setColorModelSync(@HostParam("endpoint") String endpoint, - @QueryParam("color") String color, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Post("/enum/operation/priority") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> setPriority(@HostParam("endpoint") String endpoint, - @QueryParam("priority") String priority, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/enum/operation/priority") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response setPrioritySync(@HostParam("endpoint") String endpoint, - @QueryParam("priority") String priority, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/enum/operation/state/running") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getRunningOperation(@HostParam("endpoint") String endpoint, - @QueryParam("state") String state, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/enum/operation/state/running") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getRunningOperationSync(@HostParam("endpoint") String endpoint, - @QueryParam("state") String state, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/enum/operation/state") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getOperation(@HostParam("endpoint") String endpoint, - @QueryParam("state") String state, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("/enum/operation/state") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getOperationSync(@HostParam("endpoint") String endpoint, @QueryParam("state") String state, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/enum/operation/stringenumarray") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> setStringEnumArray(@HostParam("endpoint") String endpoint, - @QueryParam("colorArray") String colorArray, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/enum/operation/stringenumarray") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response setStringEnumArraySync(@HostParam("endpoint") String endpoint, - @QueryParam("colorArray") String colorArray, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/enum/operation/intenumarray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> setIntEnumArray(@HostParam("endpoint") String endpoint, - @QueryParam("priorityArray") String priorityArray, RequestOptions requestOptions, Context context); - - @Post("/enum/operation/intenumarray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response setIntEnumArraySync(@HostParam("endpoint") String endpoint, - @QueryParam("priorityArray") String priorityArray, RequestOptions requestOptions, Context context); - - @Post("/enum/operation/stringarray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> setStringArray(@HostParam("endpoint") String endpoint, - @QueryParam("stringArray") String stringArray, RequestOptions requestOptions, Context context); - - @Post("/enum/operation/stringarray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response setStringArraySync(@HostParam("endpoint") String endpoint, - @QueryParam("stringArray") String stringArray, RequestOptions requestOptions, Context context); - - @Post("/enum/operation/intarray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> setIntArray(@HostParam("endpoint") String endpoint, - @QueryParam("intArray") String intArray, RequestOptions requestOptions, Context context); - - @Post("/enum/operation/intarray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response setIntArraySync(@HostParam("endpoint") String endpoint, @QueryParam("intArray") String intArray, - RequestOptions requestOptions, Context context); - - @Post("/enum/operation/stringenummulti") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> setStringEnumMulti(@HostParam("endpoint") String endpoint, - @QueryParam(value = "colorArray", multipleQueryParams = true) List colorArray, - RequestOptions requestOptions, Context context); - - @Post("/enum/operation/stringenummulti") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response setStringEnumMultiSync(@HostParam("endpoint") String endpoint, - @QueryParam(value = "colorArray", multipleQueryParams = true) List colorArray, - RequestOptions requestOptions, Context context); - - @Post("/enum/operation/intenummulti") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> setIntEnumMulti(@HostParam("endpoint") String endpoint, - @QueryParam(value = "priorityArray", multipleQueryParams = true) List priorityArray, - RequestOptions requestOptions, Context context); - - @Post("/enum/operation/intenummulti") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response setIntEnumMultiSync(@HostParam("endpoint") String endpoint, - @QueryParam(value = "priorityArray", multipleQueryParams = true) List priorityArray, - RequestOptions requestOptions, Context context); - - @Post("/enum/operation/stringmulti") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> setStringMulti(@HostParam("endpoint") String endpoint, - @QueryParam(value = "stringArray", multipleQueryParams = true) List stringArray, - RequestOptions requestOptions, Context context); - - @Post("/enum/operation/stringmulti") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response setStringMultiSync(@HostParam("endpoint") String endpoint, - @QueryParam(value = "stringArray", multipleQueryParams = true) List stringArray, - RequestOptions requestOptions, Context context); - - @Post("/enum/operation/intmulti") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> setIntMulti(@HostParam("endpoint") String endpoint, - @QueryParam(value = "intArray", multipleQueryParams = true) List intArray, - RequestOptions requestOptions, Context context); - - @Post("/enum/operation/intmulti") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response setIntMultiSync(@HostParam("endpoint") String endpoint, - @QueryParam(value = "intArray", multipleQueryParams = true) List intArray, - RequestOptions requestOptions, Context context); - - @Post("/enum/operation/stringenumarrayheader") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> setStringEnumArrayHeader(@HostParam("endpoint") String endpoint, - @HeaderParam("color-array") String colorArray, RequestOptions requestOptions, Context context); - - @Post("/enum/operation/stringenumarrayheader") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response setStringEnumArrayHeaderSync(@HostParam("endpoint") String endpoint, - @HeaderParam("color-array") String colorArray, RequestOptions requestOptions, Context context); - } - - /** - * The getColor operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Red/Blue/Green)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getColorWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getColor(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getColor operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Red/Blue/Green)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getColorWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getColorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getColorModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Red/Blue/Green)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getColorModelWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getColorModel(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getColorModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Red/Blue/Green)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getColorModelWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getColorModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The setColorModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param color The color parameter. Allowed values: "Red", "Blue", "Green". - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setColorModelWithResponseAsync(String color, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.setColorModel(this.getEndpoint(), color, accept, requestOptions, context)); - } - - /** - * The setColorModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param color The color parameter. Allowed values: "Red", "Blue", "Green". - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setColorModelWithResponse(String color, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.setColorModelSync(this.getEndpoint(), color, accept, requestOptions, Context.NONE); - } - - /** - * The setPriority operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param priority The priority parameter. Allowed values: 100, 0. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setPriorityWithResponseAsync(String priority, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.setPriority(this.getEndpoint(), priority, accept, requestOptions, context)); - } - - /** - * The setPriority operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param priority The priority parameter. Allowed values: 100, 0. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setPriorityWithResponse(String priority, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.setPrioritySync(this.getEndpoint(), priority, accept, requestOptions, Context.NONE); - } - - /** - * The getRunningOperation operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getRunningOperationWithResponseAsync(RequestOptions requestOptions) { - final String state = "Running"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getRunningOperation(this.getEndpoint(), state, accept, requestOptions, context)); - } - - /** - * The getRunningOperation operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRunningOperationWithResponse(RequestOptions requestOptions) { - final String state = "Running"; - final String accept = "application/json"; - return service.getRunningOperationSync(this.getEndpoint(), state, accept, requestOptions, Context.NONE); - } - - /** - * The getOperation operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param state The state parameter. Allowed values: "Running", "Completed", "Failed". - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getOperationWithResponseAsync(String state, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getOperation(this.getEndpoint(), state, accept, requestOptions, context)); - } - - /** - * The getOperation operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String(Read/Write) (Required)
-     *     best: boolean (Required)
-     *     age: int (Required)
-     *     priority: String(100/0) (Required)
-     *     color: String(Red/Blue/Green) (Required)
-     *     unit: String(1/0.001/1000) (Required)
-     *     priorityValue: String(100/0) (Required)
-     *     colorValue: String(Red/Blue/Green) (Required)
-     *     colorModelValue: String(Red/Blue/Green) (Required)
-     *     unitValue: String(1/0.001/1000) (Optional)
-     *     olympicRecord: String(9.58/19.3) (Optional)
-     *     olympicRecordValue: String(9.58/19.3) (Optional)
-     * }
-     * }
-     * 
- * - * @param state The state parameter. Allowed values: "Running", "Completed", "Failed". - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getOperationWithResponse(String state, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getOperationSync(this.getEndpoint(), state, accept, requestOptions, Context.NONE); - } - - /** - * The setStringEnumArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. In the form of - * "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param colorArray The colorArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setStringEnumArrayWithResponseAsync(List colorArray, - RequestOptions requestOptions) { - final String accept = "text/plain"; - String colorArrayConverted = colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil.withContext(context -> service.setStringEnumArray(this.getEndpoint(), colorArrayConverted, - accept, requestOptions, context)); - } - - /** - * The setStringEnumArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. In the form of - * "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param colorArray The colorArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setStringEnumArrayWithResponse(List colorArray, RequestOptions requestOptions) { - final String accept = "text/plain"; - String colorArrayConverted = colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.setStringEnumArraySync(this.getEndpoint(), colorArrayConverted, accept, requestOptions, - Context.NONE); - } - - /** - * The setIntEnumArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. In the - * form of "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param priorityArray The priorityArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setIntEnumArrayWithResponseAsync(List priorityArray, - RequestOptions requestOptions) { - String priorityArrayConverted = priorityArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil.withContext( - context -> service.setIntEnumArray(this.getEndpoint(), priorityArrayConverted, requestOptions, context)); - } - - /** - * The setIntEnumArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. In the - * form of "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param priorityArray The priorityArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setIntEnumArrayWithResponse(List priorityArray, RequestOptions requestOptions) { - String priorityArrayConverted = priorityArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.setIntEnumArraySync(this.getEndpoint(), priorityArrayConverted, requestOptions, Context.NONE); - } - - /** - * The setStringArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. In the form of - * "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param stringArray The stringArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setStringArrayWithResponseAsync(List stringArray, - RequestOptions requestOptions) { - String stringArrayConverted = stringArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil.withContext( - context -> service.setStringArray(this.getEndpoint(), stringArrayConverted, requestOptions, context)); - } - - /** - * The setStringArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. In the form of - * "," separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param stringArray The stringArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setStringArrayWithResponse(List stringArray, RequestOptions requestOptions) { - String stringArrayConverted = stringArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.setStringArraySync(this.getEndpoint(), stringArrayConverted, requestOptions, Context.NONE); - } - - /** - * The setIntArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. In the form of "," - * separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param intArray The intArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setIntArrayWithResponseAsync(List intArray, RequestOptions requestOptions) { - String intArrayConverted - = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(intArray, CollectionFormat.CSV); - return FluxUtil.withContext( - context -> service.setIntArray(this.getEndpoint(), intArrayConverted, requestOptions, context)); - } - - /** - * The setIntArray operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. In the form of "," - * separated string.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param intArray The intArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setIntArrayWithResponse(List intArray, RequestOptions requestOptions) { - String intArrayConverted - = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(intArray, CollectionFormat.CSV); - return service.setIntArraySync(this.getEndpoint(), intArrayConverted, requestOptions, Context.NONE); - } - - /** - * The setStringEnumMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param colorArray The colorArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setStringEnumMultiWithResponseAsync(List colorArray, - RequestOptions requestOptions) { - List colorArrayConverted - = colorArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return FluxUtil.withContext( - context -> service.setStringEnumMulti(this.getEndpoint(), colorArrayConverted, requestOptions, context)); - } - - /** - * The setStringEnumMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param colorArray The colorArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setStringEnumMultiWithResponse(List colorArray, RequestOptions requestOptions) { - List colorArrayConverted - = colorArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return service.setStringEnumMultiSync(this.getEndpoint(), colorArrayConverted, requestOptions, Context.NONE); - } - - /** - * The setIntEnumMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param priorityArray The priorityArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setIntEnumMultiWithResponseAsync(List priorityArray, - RequestOptions requestOptions) { - List priorityArrayConverted - = priorityArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return FluxUtil.withContext( - context -> service.setIntEnumMulti(this.getEndpoint(), priorityArrayConverted, requestOptions, context)); - } - - /** - * The setIntEnumMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param priorityArray The priorityArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setIntEnumMultiWithResponse(List priorityArray, RequestOptions requestOptions) { - List priorityArrayConverted - = priorityArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return service.setIntEnumMultiSync(this.getEndpoint(), priorityArrayConverted, requestOptions, Context.NONE); - } - - /** - * The setStringMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param stringArray The stringArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setStringMultiWithResponseAsync(List stringArray, - RequestOptions requestOptions) { - List stringArrayConverted - = stringArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return FluxUtil.withContext( - context -> service.setStringMulti(this.getEndpoint(), stringArrayConverted, requestOptions, context)); - } - - /** - * The setStringMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param stringArray The stringArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setStringMultiWithResponse(List stringArray, RequestOptions requestOptions) { - List stringArrayConverted - = stringArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return service.setStringMultiSync(this.getEndpoint(), stringArrayConverted, requestOptions, Context.NONE); - } - - /** - * The setIntMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param intArray The intArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setIntMultiWithResponseAsync(List intArray, RequestOptions requestOptions) { - List intArrayConverted - = intArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return FluxUtil.withContext( - context -> service.setIntMulti(this.getEndpoint(), intArrayConverted, requestOptions, context)); - } - - /** - * The setIntMulti operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. Call - * {@link RequestOptions#addQueryParam} to add string to array.
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param intArray The intArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setIntMultiWithResponse(List intArray, RequestOptions requestOptions) { - List intArrayConverted - = intArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); - return service.setIntMultiSync(this.getEndpoint(), intArrayConverted, requestOptions, Context.NONE); - } - - /** - * The setStringEnumArrayHeader operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
color-array-optList<String>NoThe colorArrayOpt parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param colorArray The colorArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setStringEnumArrayHeaderWithResponseAsync(List colorArray, - RequestOptions requestOptions) { - String colorArrayConverted = colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return FluxUtil.withContext(context -> service.setStringEnumArrayHeader(this.getEndpoint(), colorArrayConverted, - requestOptions, context)); - } - - /** - * The setStringEnumArrayHeader operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
color-array-optList<String>NoThe colorArrayOpt parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - * - * @param colorArray The colorArray parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setStringEnumArrayHeaderWithResponse(List colorArray, RequestOptions requestOptions) { - String colorArrayConverted = colorArray.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")) - .collect(Collectors.joining(",")); - return service.setStringEnumArrayHeaderSync(this.getEndpoint(), colorArrayConverted, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/package-info.java deleted file mode 100644 index 8d9a6e28ed1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for EnumService. - * - */ -package tsptest.enumservice.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Color.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Color.java deleted file mode 100644 index 469177340e7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Color.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice.models; - -/** - * Defines values for Color. - */ -public enum Color { - /** - * Enum value Red. - */ - RED("Red"), - - /** - * Enum value Blue. - */ - BLUE("Blue"), - - /** - * Enum value Green. - */ - GREEN("Green"); - - /** - * The actual serialized value for a Color instance. - */ - private final String value; - - Color(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a Color instance. - * - * @param value the serialized value to parse. - * @return the parsed Color object, or null if unable to parse. - */ - public static Color fromString(String value) { - if (value == null) { - return null; - } - Color[] items = Color.values(); - for (Color item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/ColorModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/ColorModel.java deleted file mode 100644 index d7059837782..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/ColorModel.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for ColorModel. - */ -public final class ColorModel extends ExpandableStringEnum { - /** - * Static value Red for ColorModel. - */ - @Generated - public static final ColorModel RED = fromString("Red"); - - /** - * Static value Blue for ColorModel. - */ - @Generated - public static final ColorModel BLUE = fromString("Blue"); - - /** - * Static value Green for ColorModel. - */ - @Generated - public static final ColorModel GREEN = fromString("Green"); - - /** - * Creates a new instance of ColorModel value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public ColorModel() { - } - - /** - * Creates or finds a ColorModel from its string representation. - * - * @param name a name to look for. - * @return the corresponding ColorModel. - */ - @Generated - public static ColorModel fromString(String name) { - return fromString(name, ColorModel.class); - } - - /** - * Gets known ColorModel values. - * - * @return known ColorModel values. - */ - @Generated - public static Collection values() { - return values(ColorModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OlympicRecordModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OlympicRecordModel.java deleted file mode 100644 index a2e5bcc4c82..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OlympicRecordModel.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableEnum; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.Function; - -/** - * Defines values for OlympicRecordModel. - */ -public final class OlympicRecordModel implements ExpandableEnum, JsonSerializable { - private static final Map VALUES = new ConcurrentHashMap<>(); - - private static final Function NEW_INSTANCE = OlympicRecordModel::new; - - /** - * Static value 9.58 for OlympicRecordModel. - */ - @Generated - public static final OlympicRecordModel OLYMPIC_100_METERS = fromValue(9.58); - - /** - * Static value 19.3 for OlympicRecordModel. - */ - @Generated - public static final OlympicRecordModel OLYMPIC_200_METERS = fromValue(19.3); - - private final Double value; - - private OlympicRecordModel(Double value) { - this.value = value; - } - - /** - * Creates or finds a OlympicRecordModel. - * - * @param value a value to look for. - * @return the corresponding OlympicRecordModel. - * @throws IllegalArgumentException if value is null. - */ - @Generated - public static OlympicRecordModel fromValue(Double value) { - if (value == null) { - throw new IllegalArgumentException("'value' cannot be null."); - } - return VALUES.computeIfAbsent(value, NEW_INSTANCE); - } - - /** - * Gets known OlympicRecordModel values. - * - * @return Known OlympicRecordModel values. - */ - @Generated - public static Collection values() { - return new ArrayList<>(VALUES.values()); - } - - /** - * Gets the value of the OlympicRecordModel instance. - * - * @return the value of the OlympicRecordModel instance. - */ - @Generated - @Override - public Double getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeDouble(getValue()); - } - - /** - * Reads an instance of OlympicRecordModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OlympicRecordModel if the JsonReader was pointing to an instance of it, or null if the - * JsonReader was pointing to JSON null. - * @throws IOException If an error occurs while reading the OlympicRecordModel. - * @throws IllegalStateException If unexpected JSON token is found. - */ - @Generated - public static OlympicRecordModel fromJson(JsonReader jsonReader) throws IOException { - JsonToken nextToken = jsonReader.nextToken(); - if (nextToken == JsonToken.NULL) { - return null; - } - if (nextToken != JsonToken.NUMBER) { - throw new IllegalStateException( - String.format("Unexpected JSON token for %s deserialization: %s", JsonToken.NUMBER, nextToken)); - } - return OlympicRecordModel.fromValue(jsonReader.getDouble()); - } - - @Generated - @Override - public String toString() { - return Objects.toString(this.value); - } - - @Generated - @Override - public boolean equals(Object obj) { - return this == obj; - } - - @Generated - @Override - public int hashCode() { - return Objects.hashCode(this.value); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Operation.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Operation.java deleted file mode 100644 index 81d93ce9967..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Operation.java +++ /dev/null @@ -1,337 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Operation model. - */ -@Fluent -public final class Operation implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final OperationName name; - - /* - * The best property. - */ - @Generated - private final boolean best = true; - - /* - * The age property. - */ - @Generated - private final int age = 50; - - /* - * The priority property. - */ - @Generated - private final Priority priority; - - /* - * The color property. - */ - @Generated - private final ColorModel color; - - /* - * The unit property. - */ - @Generated - private final Unit unit; - - /* - * The priorityValue property. - */ - @Generated - private final Priority priorityValue = Priority.LOW; - - /* - * The colorValue property. - */ - @Generated - private final Color colorValue = Color.GREEN; - - /* - * The colorModelValue property. - */ - @Generated - private final ColorModel colorModelValue = ColorModel.BLUE; - - /* - * The unitValue property. - */ - @Generated - private Unit unitValue; - - /* - * The olympicRecord property. - */ - @Generated - private OlympicRecordModel olympicRecord; - - /* - * The olympicRecordValue property. - */ - @Generated - private OlympicRecordModel olympicRecordValue; - - /** - * Creates an instance of Operation class. - * - * @param name the name value to set. - * @param priority the priority value to set. - * @param color the color value to set. - * @param unit the unit value to set. - */ - @Generated - public Operation(OperationName name, Priority priority, ColorModel color, Unit unit) { - this.name = name; - this.priority = priority; - this.color = color; - this.unit = unit; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public OperationName getName() { - return this.name; - } - - /** - * Get the best property: The best property. - * - * @return the best value. - */ - @Generated - public boolean isBest() { - return this.best; - } - - /** - * Get the age property: The age property. - * - * @return the age value. - */ - @Generated - public int getAge() { - return this.age; - } - - /** - * Get the priority property: The priority property. - * - * @return the priority value. - */ - @Generated - public Priority getPriority() { - return this.priority; - } - - /** - * Get the color property: The color property. - * - * @return the color value. - */ - @Generated - public ColorModel getColor() { - return this.color; - } - - /** - * Get the unit property: The unit property. - * - * @return the unit value. - */ - @Generated - public Unit getUnit() { - return this.unit; - } - - /** - * Get the priorityValue property: The priorityValue property. - * - * @return the priorityValue value. - */ - @Generated - public Priority getPriorityValue() { - return this.priorityValue; - } - - /** - * Get the colorValue property: The colorValue property. - * - * @return the colorValue value. - */ - @Generated - public Color getColorValue() { - return this.colorValue; - } - - /** - * Get the colorModelValue property: The colorModelValue property. - * - * @return the colorModelValue value. - */ - @Generated - public ColorModel getColorModelValue() { - return this.colorModelValue; - } - - /** - * Get the unitValue property: The unitValue property. - * - * @return the unitValue value. - */ - @Generated - public Unit getUnitValue() { - return this.unitValue; - } - - /** - * Set the unitValue property: The unitValue property. - * - * @param unitValue the unitValue value to set. - * @return the Operation object itself. - */ - @Generated - public Operation setUnitValue(Unit unitValue) { - this.unitValue = unitValue; - return this; - } - - /** - * Get the olympicRecord property: The olympicRecord property. - * - * @return the olympicRecord value. - */ - @Generated - public OlympicRecordModel getOlympicRecord() { - return this.olympicRecord; - } - - /** - * Set the olympicRecord property: The olympicRecord property. - * - * @param olympicRecord the olympicRecord value to set. - * @return the Operation object itself. - */ - @Generated - public Operation setOlympicRecord(OlympicRecordModel olympicRecord) { - this.olympicRecord = olympicRecord; - return this; - } - - /** - * Get the olympicRecordValue property: The olympicRecordValue property. - * - * @return the olympicRecordValue value. - */ - @Generated - public OlympicRecordModel getOlympicRecordValue() { - return this.olympicRecordValue; - } - - /** - * Set the olympicRecordValue property: The olympicRecordValue property. - * - * @param olympicRecordValue the olympicRecordValue value to set. - * @return the Operation object itself. - */ - @Generated - public Operation setOlympicRecordValue(OlympicRecordModel olympicRecordValue) { - this.olympicRecordValue = olympicRecordValue; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name == null ? null : this.name.toString()); - jsonWriter.writeBooleanField("best", this.best); - jsonWriter.writeIntField("age", this.age); - jsonWriter.writeNumberField("priority", this.priority == null ? null : this.priority.toInt()); - jsonWriter.writeStringField("color", this.color == null ? null : this.color.toString()); - jsonWriter.writeNumberField("unit", this.unit == null ? null : this.unit.toDouble()); - jsonWriter.writeNumberField("priorityValue", this.priorityValue == null ? null : this.priorityValue.toInt()); - jsonWriter.writeStringField("colorValue", this.colorValue == null ? null : this.colorValue.toString()); - jsonWriter.writeStringField("colorModelValue", - this.colorModelValue == null ? null : this.colorModelValue.toString()); - jsonWriter.writeNumberField("unitValue", this.unitValue == null ? null : this.unitValue.toDouble()); - jsonWriter.writeNumberField("olympicRecord", this.olympicRecord == null ? null : this.olympicRecord.getValue()); - jsonWriter.writeNumberField("olympicRecordValue", - this.olympicRecordValue == null ? null : this.olympicRecordValue.getValue()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Operation from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Operation if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Operation. - */ - @Generated - public static Operation fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OperationName name = null; - Priority priority = null; - ColorModel color = null; - Unit unit = null; - Unit unitValue = null; - OlympicRecordModel olympicRecord = null; - OlympicRecordModel olympicRecordValue = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = OperationName.fromString(reader.getString()); - } else if ("priority".equals(fieldName)) { - priority = Priority.fromInt(reader.getInt()); - } else if ("color".equals(fieldName)) { - color = ColorModel.fromString(reader.getString()); - } else if ("unit".equals(fieldName)) { - unit = Unit.fromDouble(reader.getDouble()); - } else if ("unitValue".equals(fieldName)) { - unitValue = Unit.fromDouble(reader.getDouble()); - } else if ("olympicRecord".equals(fieldName)) { - olympicRecord = OlympicRecordModel.fromValue(reader.getDouble()); - } else if ("olympicRecordValue".equals(fieldName)) { - olympicRecordValue = OlympicRecordModel.fromValue(reader.getDouble()); - } else { - reader.skipChildren(); - } - } - Operation deserializedOperation = new Operation(name, priority, color, unit); - deserializedOperation.unitValue = unitValue; - deserializedOperation.olympicRecord = olympicRecord; - deserializedOperation.olympicRecordValue = olympicRecordValue; - - return deserializedOperation; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationName.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationName.java deleted file mode 100644 index 94d11e8361a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationName.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice.models; - -/** - * Defines values for OperationName. - */ -public enum OperationName { - /** - * Enum value Read. - */ - READ("Read"), - - /** - * Enum value Write. - */ - WRITE("Write"); - - /** - * The actual serialized value for a OperationName instance. - */ - private final String value; - - OperationName(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a OperationName instance. - * - * @param value the serialized value to parse. - * @return the parsed OperationName object, or null if unable to parse. - */ - public static OperationName fromString(String value) { - if (value == null) { - return null; - } - OperationName[] items = OperationName.values(); - for (OperationName item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationStateValues.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationStateValues.java deleted file mode 100644 index 25acfe415af..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationStateValues.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice.models; - -/** - * Defines values for OperationStateValues. - */ -public enum OperationStateValues { - /** - * Enum value Running. - */ - RUNNING("Running"), - - /** - * Enum value Completed. - */ - COMPLETED("Completed"), - - /** - * Enum value Failed. - */ - FAILED("Failed"); - - /** - * The actual serialized value for a OperationStateValues instance. - */ - private final String value; - - OperationStateValues(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a OperationStateValues instance. - * - * @param value the serialized value to parse. - * @return the parsed OperationStateValues object, or null if unable to parse. - */ - public static OperationStateValues fromString(String value) { - if (value == null) { - return null; - } - OperationStateValues[] items = OperationStateValues.values(); - for (OperationStateValues item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Priority.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Priority.java deleted file mode 100644 index d34ed66596d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Priority.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice.models; - -/** - * Defines values for Priority. - */ -public enum Priority { - /** - * Enum value 100. - */ - HIGH(100), - - /** - * Enum value 0. - */ - LOW(0); - - /** - * The actual serialized value for a Priority instance. - */ - private final int value; - - Priority(int value) { - this.value = value; - } - - /** - * Parses a serialized value to a Priority instance. - * - * @param value the serialized value to parse. - * @return the parsed Priority object, or null if unable to parse. - */ - public static Priority fromInt(int value) { - Priority[] items = Priority.values(); - for (Priority item : items) { - if (item.toInt() == value) { - return item; - } - } - return null; - } - - /** - * De-serializes the instance to int value. - * - * @return the int value. - */ - public int toInt() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/PriorityModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/PriorityModel.java deleted file mode 100644 index fba63f9146f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/PriorityModel.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableEnum; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.Function; - -/** - * Defines values for PriorityModel. - */ -public final class PriorityModel implements ExpandableEnum, JsonSerializable { - private static final Map VALUES = new ConcurrentHashMap<>(); - - private static final Function NEW_INSTANCE = PriorityModel::new; - - /** - * Static value 100 for PriorityModel. - */ - @Generated - public static final PriorityModel HIGH = fromValue(100); - - /** - * Static value 0 for PriorityModel. - */ - @Generated - public static final PriorityModel LOW = fromValue(0); - - private final Integer value; - - private PriorityModel(Integer value) { - this.value = value; - } - - /** - * Creates or finds a PriorityModel. - * - * @param value a value to look for. - * @return the corresponding PriorityModel. - * @throws IllegalArgumentException if value is null. - */ - @Generated - public static PriorityModel fromValue(Integer value) { - if (value == null) { - throw new IllegalArgumentException("'value' cannot be null."); - } - return VALUES.computeIfAbsent(value, NEW_INSTANCE); - } - - /** - * Gets known PriorityModel values. - * - * @return Known PriorityModel values. - */ - @Generated - public static Collection values() { - return new ArrayList<>(VALUES.values()); - } - - /** - * Gets the value of the PriorityModel instance. - * - * @return the value of the PriorityModel instance. - */ - @Generated - @Override - public Integer getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeInt(getValue()); - } - - /** - * Reads an instance of PriorityModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PriorityModel if the JsonReader was pointing to an instance of it, or null if the - * JsonReader was pointing to JSON null. - * @throws IOException If an error occurs while reading the PriorityModel. - * @throws IllegalStateException If unexpected JSON token is found. - */ - @Generated - public static PriorityModel fromJson(JsonReader jsonReader) throws IOException { - JsonToken nextToken = jsonReader.nextToken(); - if (nextToken == JsonToken.NULL) { - return null; - } - if (nextToken != JsonToken.NUMBER) { - throw new IllegalStateException( - String.format("Unexpected JSON token for %s deserialization: %s", JsonToken.NUMBER, nextToken)); - } - return PriorityModel.fromValue(jsonReader.getInt()); - } - - @Generated - @Override - public String toString() { - return Objects.toString(this.value); - } - - @Generated - @Override - public boolean equals(Object obj) { - return this == obj; - } - - @Generated - @Override - public int hashCode() { - return Objects.hashCode(this.value); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Unit.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Unit.java deleted file mode 100644 index 6a02fefd92e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Unit.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice.models; - -/** - * Defines values for Unit. - */ -public enum Unit { - /** - * Enum value 1. - */ - GRAMS(1.0), - - /** - * Enum value 0.001. - */ - KILO_GRAMS(0.001), - - /** - * Enum value 1000. - */ - MILLIGRAM(1000.0); - - /** - * The actual serialized value for a Unit instance. - */ - private final double value; - - Unit(double value) { - this.value = value; - } - - /** - * Parses a serialized value to a Unit instance. - * - * @param value the serialized value to parse. - * @return the parsed Unit object, or null if unable to parse. - */ - public static Unit fromDouble(double value) { - Unit[] items = Unit.values(); - for (Unit item : items) { - if (Double.doubleToLongBits(item.toDouble()) == Double.doubleToLongBits(value)) { - return item; - } - } - return null; - } - - /** - * De-serializes the instance to double value. - * - * @return the double value. - */ - public double toDouble() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/package-info.java deleted file mode 100644 index abee2e49aa0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for EnumService. - * - */ -package tsptest.enumservice.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/package-info.java deleted file mode 100644 index 12532e2c065..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for EnumService. - * - */ -package tsptest.enumservice; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelAsyncClient.java deleted file mode 100644 index 5626e971b47..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelAsyncClient.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel; - -import com.azure.core.annotation.Generated; -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.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.errormodel.implementation.ErrorOpsImpl; -import tsptest.errormodel.models.BadResponseErrorException; -import tsptest.errormodel.models.BatchErrorException; -import tsptest.errormodel.models.Diagnostic; - -/** - * Initializes a new instance of the asynchronous ErrorModelClient type. - */ -@ServiceClient(builder = ErrorModelClientBuilder.class, isAsync = true) -public final class ErrorModelAsyncClient { - @Generated - private final ErrorOpsImpl serviceClient; - - /** - * Initializes an instance of ErrorModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ErrorModelAsyncClient(ErrorOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The read operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     error (Required): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     subError (Required): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): (recursive schema, see innererror above)
-     *         subCode: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws BatchErrorException thrown if the request is rejected by server. - * @throws BadResponseErrorException thrown if the request is rejected by server on status code 400. - * @throws HttpResponseException thrown if the request is rejected by server on status code 404. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> readWithResponse(RequestOptions requestOptions) { - return this.serviceClient.readWithResponseAsync(requestOptions); - } - - /** - * The read operation. - * - * @throws BatchErrorException thrown if the request is rejected by server. - * @throws BadResponseErrorException thrown if the request is rejected by server on status code 400. - * @throws HttpResponseException thrown if the request is rejected by server on status code 404. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono read() { - // Generated convenience method for readWithResponse - RequestOptions requestOptions = new RequestOptions(); - return readWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Diagnostic.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClient.java deleted file mode 100644 index 7e18ba75330..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClient.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel; - -import com.azure.core.annotation.Generated; -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.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.errormodel.implementation.ErrorOpsImpl; -import tsptest.errormodel.models.BadResponseErrorException; -import tsptest.errormodel.models.BatchErrorException; -import tsptest.errormodel.models.Diagnostic; - -/** - * Initializes a new instance of the synchronous ErrorModelClient type. - */ -@ServiceClient(builder = ErrorModelClientBuilder.class) -public final class ErrorModelClient { - @Generated - private final ErrorOpsImpl serviceClient; - - /** - * Initializes an instance of ErrorModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ErrorModelClient(ErrorOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The read operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     error (Required): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     subError (Required): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): (recursive schema, see innererror above)
-     *         subCode: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws BatchErrorException thrown if the request is rejected by server. - * @throws BadResponseErrorException thrown if the request is rejected by server on status code 400. - * @throws HttpResponseException thrown if the request is rejected by server on status code 404. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response readWithResponse(RequestOptions requestOptions) { - return this.serviceClient.readWithResponse(requestOptions); - } - - /** - * The read operation. - * - * @throws BatchErrorException thrown if the request is rejected by server. - * @throws BadResponseErrorException thrown if the request is rejected by server on status code 400. - * @throws HttpResponseException thrown if the request is rejected by server on status code 404. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Diagnostic read() { - // Generated convenience method for readWithResponse - RequestOptions requestOptions = new RequestOptions(); - return readWithResponse(requestOptions).getValue().toObject(Diagnostic.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClientBuilder.java deleted file mode 100644 index 2949dfde432..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.errormodel.implementation.ErrorModelClientImpl; - -/** - * A builder for creating a new instance of the ErrorModelClient type. - */ -@ServiceClientBuilder(serviceClients = { ErrorModelClient.class, ErrorModelAsyncClient.class }) -public final class ErrorModelClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-errormodel.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ErrorModelClientBuilder. - */ - @Generated - public ErrorModelClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ErrorModelClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ErrorModelClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ErrorModelClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ErrorModelClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ErrorModelClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ErrorModelClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ErrorModelClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ErrorModelClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ErrorModelClientBuilder. - */ - @Generated - public ErrorModelClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ErrorModelClientImpl with the provided parameters. - * - * @return an instance of ErrorModelClientImpl. - */ - @Generated - private ErrorModelClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - ErrorModelClientImpl client - = new ErrorModelClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ErrorModelAsyncClient class. - * - * @return an instance of ErrorModelAsyncClient. - */ - @Generated - public ErrorModelAsyncClient buildAsyncClient() { - return new ErrorModelAsyncClient(buildInnerClient().getErrorOps()); - } - - /** - * Builds an instance of ErrorModelClient class. - * - * @return an instance of ErrorModelClient. - */ - @Generated - public ErrorModelClient buildClient() { - return new ErrorModelClient(buildInnerClient().getErrorOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ErrorModelClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorModelClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorModelClientImpl.java deleted file mode 100644 index 453381c24f3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorModelClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 ErrorModelClient type. - */ -public final class ErrorModelClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 ErrorOpsImpl object to access its operations. - */ - private final ErrorOpsImpl errorOps; - - /** - * Gets the ErrorOpsImpl object to access its operations. - * - * @return the ErrorOpsImpl object. - */ - public ErrorOpsImpl getErrorOps() { - return this.errorOps; - } - - /** - * Initializes an instance of ErrorModelClient client. - * - * @param endpoint Service host. - */ - public ErrorModelClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ErrorModelClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ErrorModelClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ErrorModelClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ErrorModelClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.errorOps = new ErrorOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorOpsImpl.java deleted file mode 100644 index 3f1ae69cf89..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorOpsImpl.java +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; -import tsptest.errormodel.models.BadResponseErrorException; -import tsptest.errormodel.models.BatchErrorException; - -/** - * An instance of this class provides access to all the operations defined in ErrorOps. - */ -public final class ErrorOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ErrorOpsService service; - - /** - * The service client containing this operation class. - */ - private final ErrorModelClientImpl client; - - /** - * Initializes an instance of ErrorOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ErrorOpsImpl(ErrorModelClientImpl client) { - this.service = RestProxy.create(ErrorOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ErrorModelClientErrorOps to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ErrorModelClientErrorOps") - public interface ErrorOpsService { - @Get("/error") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = BadResponseErrorException.class, code = { 400 }) - @UnexpectedResponseExceptionType(value = HttpResponseException.class, code = { 404 }) - @UnexpectedResponseExceptionType(BatchErrorException.class) - Mono> read(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/error") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = BadResponseErrorException.class, code = { 400 }) - @UnexpectedResponseExceptionType(value = HttpResponseException.class, code = { 404 }) - @UnexpectedResponseExceptionType(BatchErrorException.class) - Response readSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The read operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     error (Required): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     subError (Required): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): (recursive schema, see innererror above)
-     *         subCode: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws BatchErrorException thrown if the request is rejected by server. - * @throws BadResponseErrorException thrown if the request is rejected by server on status code 400. - * @throws HttpResponseException thrown if the request is rejected by server on status code 404. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> readWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.read(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The read operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     error (Required): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     subError (Required): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): (recursive schema, see innererror above)
-     *         subCode: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws BatchErrorException thrown if the request is rejected by server. - * @throws BadResponseErrorException thrown if the request is rejected by server on status code 400. - * @throws HttpResponseException thrown if the request is rejected by server on status code 404. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response readWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.readSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/package-info.java deleted file mode 100644 index ef31b90e413..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ErrorModel. - * - */ -package tsptest.errormodel.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseError.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseError.java deleted file mode 100644 index 35592987895..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseError.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The BadResponseError model. - */ -@Immutable -public final class BadResponseError implements JsonSerializable { - /* - * The code property. - */ - @Generated - private final String code; - - /* - * The data property. - */ - @Generated - private final Details data; - - /** - * Creates an instance of BadResponseError class. - * - * @param code the code value to set. - * @param data the data value to set. - */ - @Generated - private BadResponseError(String code, Details data) { - this.code = code; - this.data = data; - } - - /** - * Get the code property: The code property. - * - * @return the code value. - */ - @Generated - public String getCode() { - return this.code; - } - - /** - * Get the data property: The data property. - * - * @return the data value. - */ - @Generated - public Details getData() { - return this.data; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("code", this.code); - jsonWriter.writeJsonField("data", this.data); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BadResponseError from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BadResponseError if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BadResponseError. - */ - @Generated - public static BadResponseError fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String code = null; - Details data = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("code".equals(fieldName)) { - code = reader.getString(); - } else if ("data".equals(fieldName)) { - data = Details.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new BadResponseError(code, data); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseErrorException.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseErrorException.java deleted file mode 100644 index 0c0eac278b7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseErrorException.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel.models; - -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.HttpResponse; - -/** - * Exception thrown for an invalid response with BadResponseError information. - */ -public final class BadResponseErrorException extends HttpResponseException { - /** - * Initializes a new instance of the BadResponseErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - */ - public BadResponseErrorException(String message, HttpResponse response) { - super(message, response); - } - - /** - * Initializes a new instance of the BadResponseErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - * @param value the deserialized response value. - */ - public BadResponseErrorException(String message, HttpResponse response, BadResponseError value) { - super(message, response, value); - } - - /** - * {@inheritDoc} - */ - @Override - public BadResponseError getValue() { - return (BadResponseError) super.getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchError.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchError.java deleted file mode 100644 index 97a4bfe636a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchError.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The BatchError model. - */ -@Immutable -public final class BatchError implements JsonSerializable { - /* - * The code property. - */ - @Generated - private String code; - - /* - * The message property. - */ - @Generated - private BatchErrorMessage message; - - /** - * Creates an instance of BatchError class. - */ - @Generated - private BatchError() { - } - - /** - * Get the code property: The code property. - * - * @return the code value. - */ - @Generated - public String getCode() { - return this.code; - } - - /** - * Get the message property: The message property. - * - * @return the message value. - */ - @Generated - public BatchErrorMessage getMessage() { - return this.message; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("code", this.code); - jsonWriter.writeJsonField("message", this.message); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BatchError from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BatchError if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IOException If an error occurs while reading the BatchError. - */ - @Generated - public static BatchError fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BatchError deserializedBatchError = new BatchError(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("code".equals(fieldName)) { - deserializedBatchError.code = reader.getString(); - } else if ("message".equals(fieldName)) { - deserializedBatchError.message = BatchErrorMessage.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedBatchError; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorException.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorException.java deleted file mode 100644 index e741056a209..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorException.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel.models; - -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.HttpResponse; - -/** - * Exception thrown for an invalid response with BatchError information. - */ -public final class BatchErrorException extends HttpResponseException { - /** - * Initializes a new instance of the BatchErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - */ - public BatchErrorException(String message, HttpResponse response) { - super(message, response); - } - - /** - * Initializes a new instance of the BatchErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - * @param value the deserialized response value. - */ - public BatchErrorException(String message, HttpResponse response, BatchError value) { - super(message, response, value); - } - - /** - * {@inheritDoc} - */ - @Override - public BatchError getValue() { - return (BatchError) super.getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorMessage.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorMessage.java deleted file mode 100644 index 4b1ad0a2b63..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorMessage.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The BatchErrorMessage model. - */ -@Immutable -public final class BatchErrorMessage implements JsonSerializable { - /* - * The lang property. - */ - @Generated - private String lang; - - /* - * The value property. - */ - @Generated - private String value; - - /** - * Creates an instance of BatchErrorMessage class. - */ - @Generated - private BatchErrorMessage() { - } - - /** - * Get the lang property: The lang property. - * - * @return the lang value. - */ - @Generated - public String getLang() { - return this.lang; - } - - /** - * Get the value property: The value property. - * - * @return the value value. - */ - @Generated - public String getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("lang", this.lang); - jsonWriter.writeStringField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BatchErrorMessage from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BatchErrorMessage if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the BatchErrorMessage. - */ - @Generated - public static BatchErrorMessage fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BatchErrorMessage deserializedBatchErrorMessage = new BatchErrorMessage(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("lang".equals(fieldName)) { - deserializedBatchErrorMessage.lang = reader.getString(); - } else if ("value".equals(fieldName)) { - deserializedBatchErrorMessage.value = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedBatchErrorMessage; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Details.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Details.java deleted file mode 100644 index bcfadb54d60..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Details.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Details model. - */ -@Immutable -public final class Details implements JsonSerializable
{ - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Details class. - * - * @param name the name value to set. - */ - @Generated - private Details(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Details from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Details if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Details. - */ - @Generated - public static Details fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Details(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Diagnostic.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Diagnostic.java deleted file mode 100644 index 730a9a88e65..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Diagnostic.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.models.ResponseError; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Diagnostic model. - */ -@Immutable -public final class Diagnostic implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The error property. - */ - @Generated - private final ResponseError error; - - /* - * The subError property. - */ - @Generated - private final SubError subError; - - /** - * Creates an instance of Diagnostic class. - * - * @param name the name value to set. - * @param error the error value to set. - * @param subError the subError value to set. - */ - @Generated - private Diagnostic(String name, ResponseError error, SubError subError) { - this.name = name; - this.error = error; - this.subError = subError; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the error property: The error property. - * - * @return the error value. - */ - @Generated - public ResponseError getError() { - return this.error; - } - - /** - * Get the subError property: The subError property. - * - * @return the subError value. - */ - @Generated - public SubError getSubError() { - return this.subError; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeJsonField("error", this.error); - jsonWriter.writeJsonField("subError", this.subError); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Diagnostic from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Diagnostic if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Diagnostic. - */ - @Generated - public static Diagnostic fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - ResponseError error = null; - SubError subError = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("error".equals(fieldName)) { - error = ResponseError.fromJson(reader); - } else if ("subError".equals(fieldName)) { - subError = SubError.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new Diagnostic(name, error, subError); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/InnerError.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/InnerError.java deleted file mode 100644 index 6d1985042b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/InnerError.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * An object containing more specific information about the error. As per Azure REST API guidelines - - * https://aka.ms/AzureRestApiGuidelines#handling-errors. - */ -@Immutable -public final class InnerError implements JsonSerializable { - /* - * One of a server-defined set of error codes. - */ - @Generated - private String code; - - /* - * Inner error. - */ - @Generated - private InnerError innerError; - - /** - * Creates an instance of InnerError class. - */ - @Generated - private InnerError() { - } - - /** - * Get the code property: One of a server-defined set of error codes. - * - * @return the code value. - */ - @Generated - public String getCode() { - return this.code; - } - - /** - * Get the innerError property: Inner error. - * - * @return the innerError value. - */ - @Generated - public InnerError getInnerError() { - return this.innerError; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("code", this.code); - jsonWriter.writeJsonField("innererror", this.innerError); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InnerError from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InnerError if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IOException If an error occurs while reading the InnerError. - */ - @Generated - public static InnerError fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - InnerError deserializedInnerError = new InnerError(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("code".equals(fieldName)) { - deserializedInnerError.code = reader.getString(); - } else if ("innererror".equals(fieldName)) { - deserializedInnerError.innerError = InnerError.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedInnerError; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/SubError.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/SubError.java deleted file mode 100644 index 675414dbb39..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/SubError.java +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.models.ResponseError; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The SubError model. - */ -@Immutable -public final class SubError implements JsonSerializable { - /* - * One of a server-defined set of error codes. - */ - @Generated - private final String code; - - /* - * A human-readable representation of the error. - */ - @Generated - private final String message; - - /* - * The target of the error. - */ - @Generated - private String target; - - /* - * An array of details about specific errors that led to this reported error. - */ - @Generated - private List details; - - /* - * An object containing more specific information than the current object about the error. - */ - @Generated - private InnerError innerError; - - /* - * The subCode property. - */ - @Generated - private final String subCode; - - /** - * Creates an instance of SubError class. - * - * @param code the code value to set. - * @param message the message value to set. - * @param subCode the subCode value to set. - */ - @Generated - private SubError(String code, String message, String subCode) { - this.code = code; - this.message = message; - this.subCode = subCode; - } - - /** - * Get the code property: One of a server-defined set of error codes. - * - * @return the code value. - */ - @Generated - public String getCode() { - return this.code; - } - - /** - * Get the message property: A human-readable representation of the error. - * - * @return the message value. - */ - @Generated - public String getMessage() { - return this.message; - } - - /** - * Get the target property: The target of the error. - * - * @return the target value. - */ - @Generated - public String getTarget() { - return this.target; - } - - /** - * Get the details property: An array of details about specific errors that led to this reported error. - * - * @return the details value. - */ - @Generated - public List getDetails() { - return this.details; - } - - /** - * Get the innerError property: An object containing more specific information than the current object about the - * error. - * - * @return the innerError value. - */ - @Generated - public InnerError getInnerError() { - return this.innerError; - } - - /** - * Get the subCode property: The subCode property. - * - * @return the subCode value. - */ - @Generated - public String getSubCode() { - return this.subCode; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("code", this.code); - jsonWriter.writeStringField("message", this.message); - jsonWriter.writeStringField("subCode", this.subCode); - jsonWriter.writeStringField("target", this.target); - jsonWriter.writeArrayField("details", this.details, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeJsonField("innererror", this.innerError); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubError from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubError if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SubError. - */ - @Generated - public static SubError fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String code = null; - String message = null; - String subCode = null; - String target = null; - List details = null; - InnerError innerError = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("code".equals(fieldName)) { - code = reader.getString(); - } else if ("message".equals(fieldName)) { - message = reader.getString(); - } else if ("subCode".equals(fieldName)) { - subCode = reader.getString(); - } else if ("target".equals(fieldName)) { - target = reader.getString(); - } else if ("details".equals(fieldName)) { - details = reader.readArray(reader1 -> ResponseError.fromJson(reader1)); - } else if ("innererror".equals(fieldName)) { - innerError = InnerError.fromJson(reader); - } else { - reader.skipChildren(); - } - } - SubError deserializedSubError = new SubError(code, message, subCode); - deserializedSubError.target = target; - deserializedSubError.details = details; - deserializedSubError.innerError = innerError; - - return deserializedSubError; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/package-info.java deleted file mode 100644 index 69295087d21..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for ErrorModel. - * - */ -package tsptest.errormodel.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/package-info.java deleted file mode 100644 index 135e92a62ca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ErrorModel. - * - */ -package tsptest.errormodel; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenAsyncClient.java deleted file mode 100644 index 783df036517..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenAsyncClient.java +++ /dev/null @@ -1,422 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.flatten.implementation.FlattenClientImpl; -import tsptest.flatten.implementation.JsonMergePatchHelper; -import tsptest.flatten.implementation.models.SendLongRequest; -import tsptest.flatten.implementation.models.SendOptionalBodyRequest; -import tsptest.flatten.implementation.models.SendProjectedNameRequest; -import tsptest.flatten.implementation.models.SendRequest; -import tsptest.flatten.models.SendLongOptions; -import tsptest.flatten.models.TodoItem; -import tsptest.flatten.models.UpdatePatchRequest; -import tsptest.flatten.models.User; - -/** - * Initializes a new instance of the asynchronous FlattenClient type. - */ -@ServiceClient(builder = FlattenClientBuilder.class, isAsync = true) -public final class FlattenAsyncClient { - @Generated - private final FlattenClientImpl serviceClient; - - /** - * Initializes an instance of FlattenAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FlattenAsyncClient(FlattenClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The send operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maxPageSize parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     endpoint: String (Required)
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: String (Required)
-     *     constant: String (Required)
-     *     requiredInt: int (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendRequest The sendRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(String id, BinaryData sendRequest, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(id, sendRequest, requestOptions); - } - - /** - * The sendProjectedName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     file_id: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendProjectedNameRequest The sendProjectedNameRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendProjectedNameWithResponse(String id, BinaryData sendProjectedNameRequest, - RequestOptions requestOptions) { - return this.serviceClient.sendProjectedNameWithResponseAsync(id, sendProjectedNameRequest, requestOptions); - } - - /** - * The sendLong operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: String (Required)
-     *     dataInt: int (Required)
-     *     dataIntOptional: Integer (Optional)
-     *     dataLong: Long (Optional)
-     *     requiredUser (Required): (recursive schema, see requiredUser above)
-     *     data_float: Double (Optional)
-     *     long: Long (Optional)
-     *     title: String (Required)
-     *     description: String (Optional)
-     *     status: String(NotStarted/InProgress/Completed) (Required)
-     *     _dummy: String (Optional)
-     *     constant: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param sendLongRequest The sendLongRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendLongWithResponse(String name, BinaryData sendLongRequest, - RequestOptions requestOptions) { - return this.serviceClient.sendLongWithResponseAsync(name, sendLongRequest, requestOptions); - } - - /** - * The update operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     patch (Optional, Required on create): {
-     *         title: String (Optional)
-     *         description: String (Optional)
-     *         status: String(NotStarted/InProgress/Completed) (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: long (Required)
-     *     title: String (Required)
-     *     description: String (Optional)
-     *     status: String(NotStarted/InProgress/Completed) (Required)
-     *     createdAt: OffsetDateTime (Required)
-     *     updatedAt: OffsetDateTime (Required)
-     *     completedAt: OffsetDateTime (Optional)
-     *     _dummy: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param updateRequest The updateRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateWithResponse(long id, BinaryData updateRequest, - RequestOptions requestOptions) { - return this.serviceClient.updateWithResponseAsync(id, updateRequest, requestOptions); - } - - /** - * The sendOptionalBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Optional)
-     * }
-     * }
-     * 
- * - * @param sendOptionalBodyRequest The sendOptionalBodyRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendOptionalBodyWithResponse(BinaryData sendOptionalBodyRequest, - RequestOptions requestOptions) { - return this.serviceClient.sendOptionalBodyWithResponseAsync(sendOptionalBodyRequest, requestOptions); - } - - /** - * The send operation. - * - * @param id The id parameter. - * @param endpoint The endpoint parameter. - * @param input The input parameter. - * @param requiredInt The requiredInt parameter. - * @param maxPageSize The maxPageSize parameter. - * @param user The user parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(String id, String endpoint, String input, int requiredInt, Integer maxPageSize, User user) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest sendRequestObj = new SendRequest(endpoint, input, requiredInt).setUser(user); - BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); - if (maxPageSize != null) { - requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false); - } - return sendWithResponse(id, sendRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The send operation. - * - * @param id The id parameter. - * @param endpoint The endpoint parameter. - * @param input The input parameter. - * @param requiredInt The requiredInt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(String id, String endpoint, String input, int requiredInt) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest sendRequestObj = new SendRequest(endpoint, input, requiredInt); - BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); - return sendWithResponse(id, sendRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The sendProjectedName operation. - * - * @param id The id parameter. - * @param fileIdentifier The fileIdentifier parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono sendProjectedName(String id, String fileIdentifier) { - // Generated convenience method for sendProjectedNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendProjectedNameRequest sendProjectedNameRequestObj = new SendProjectedNameRequest(fileIdentifier); - BinaryData sendProjectedNameRequest = BinaryData.fromObject(sendProjectedNameRequestObj); - return sendProjectedNameWithResponse(id, sendProjectedNameRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The sendLong operation. - * - * @param options Options for sendLong API. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono sendLong(SendLongOptions options) { - // Generated convenience method for sendLongWithResponse - RequestOptions requestOptions = new RequestOptions(); - String name = options.getName(); - String filter = options.getFilter(); - SendLongRequest sendLongRequestObj = new SendLongRequest(options.getInput(), options.getDataInt(), - options.getRequiredUser(), options.getTitle(), options.getStatus()).setUser(options.getUser()) - .setDataIntOptional(options.getDataIntOptional()) - .setDataLong(options.getDataLong()) - .setDataFloat(options.getDataFloat()) - .setLongProperty(options.getLongParameter()) - .setDescription(options.getDescription()) - .setDummy(options.getDummy()); - BinaryData sendLongRequest = BinaryData.fromObject(sendLongRequestObj); - if (filter != null) { - requestOptions.addQueryParam("filter", filter, false); - } - return sendLongWithResponse(name, sendLongRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The update operation. - * - * @param id The id parameter. - * @param updateRequest The updateRequest parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono update(long id, UpdatePatchRequest updateRequest) { - // Generated convenience method for updateWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getUpdatePatchRequestAccessor().prepareModelForJsonMergePatch(updateRequest, true); - BinaryData updateRequestInBinaryData = BinaryData.fromObject(updateRequest); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - updateRequestInBinaryData.getLength(); - JsonMergePatchHelper.getUpdatePatchRequestAccessor().prepareModelForJsonMergePatch(updateRequest, false); - return updateWithResponse(id, updateRequestInBinaryData, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TodoItem.class)); - } - - /** - * The sendOptionalBody operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono sendOptionalBody(String name) { - // Generated convenience method for sendOptionalBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendOptionalBodyRequest sendOptionalBodyRequestObj = new SendOptionalBodyRequest().setName(name); - BinaryData sendOptionalBodyRequest = BinaryData.fromObject(sendOptionalBodyRequestObj); - return sendOptionalBodyWithResponse(sendOptionalBodyRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The sendOptionalBody operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono sendOptionalBody() { - // Generated convenience method for sendOptionalBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendOptionalBodyRequest sendOptionalBodyRequestObj = new SendOptionalBodyRequest(); - BinaryData sendOptionalBodyRequest = BinaryData.fromObject(sendOptionalBodyRequestObj); - return sendOptionalBodyWithResponse(sendOptionalBodyRequest, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClient.java deleted file mode 100644 index 43889d1c8df..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClient.java +++ /dev/null @@ -1,411 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.flatten.implementation.FlattenClientImpl; -import tsptest.flatten.implementation.JsonMergePatchHelper; -import tsptest.flatten.implementation.models.SendLongRequest; -import tsptest.flatten.implementation.models.SendOptionalBodyRequest; -import tsptest.flatten.implementation.models.SendProjectedNameRequest; -import tsptest.flatten.implementation.models.SendRequest; -import tsptest.flatten.models.SendLongOptions; -import tsptest.flatten.models.TodoItem; -import tsptest.flatten.models.UpdatePatchRequest; -import tsptest.flatten.models.User; - -/** - * Initializes a new instance of the synchronous FlattenClient type. - */ -@ServiceClient(builder = FlattenClientBuilder.class) -public final class FlattenClient { - @Generated - private final FlattenClientImpl serviceClient; - - /** - * Initializes an instance of FlattenClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FlattenClient(FlattenClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The send operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maxPageSize parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     endpoint: String (Required)
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: String (Required)
-     *     constant: String (Required)
-     *     requiredInt: int (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendRequest The sendRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(String id, BinaryData sendRequest, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(id, sendRequest, requestOptions); - } - - /** - * The sendProjectedName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     file_id: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendProjectedNameRequest The sendProjectedNameRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendProjectedNameWithResponse(String id, BinaryData sendProjectedNameRequest, - RequestOptions requestOptions) { - return this.serviceClient.sendProjectedNameWithResponse(id, sendProjectedNameRequest, requestOptions); - } - - /** - * The sendLong operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: String (Required)
-     *     dataInt: int (Required)
-     *     dataIntOptional: Integer (Optional)
-     *     dataLong: Long (Optional)
-     *     requiredUser (Required): (recursive schema, see requiredUser above)
-     *     data_float: Double (Optional)
-     *     long: Long (Optional)
-     *     title: String (Required)
-     *     description: String (Optional)
-     *     status: String(NotStarted/InProgress/Completed) (Required)
-     *     _dummy: String (Optional)
-     *     constant: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param sendLongRequest The sendLongRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendLongWithResponse(String name, BinaryData sendLongRequest, RequestOptions requestOptions) { - return this.serviceClient.sendLongWithResponse(name, sendLongRequest, requestOptions); - } - - /** - * The update operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     patch (Optional, Required on create): {
-     *         title: String (Optional)
-     *         description: String (Optional)
-     *         status: String(NotStarted/InProgress/Completed) (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: long (Required)
-     *     title: String (Required)
-     *     description: String (Optional)
-     *     status: String(NotStarted/InProgress/Completed) (Required)
-     *     createdAt: OffsetDateTime (Required)
-     *     updatedAt: OffsetDateTime (Required)
-     *     completedAt: OffsetDateTime (Optional)
-     *     _dummy: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param updateRequest The updateRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(long id, BinaryData updateRequest, RequestOptions requestOptions) { - return this.serviceClient.updateWithResponse(id, updateRequest, requestOptions); - } - - /** - * The sendOptionalBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Optional)
-     * }
-     * }
-     * 
- * - * @param sendOptionalBodyRequest The sendOptionalBodyRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendOptionalBodyWithResponse(BinaryData sendOptionalBodyRequest, - RequestOptions requestOptions) { - return this.serviceClient.sendOptionalBodyWithResponse(sendOptionalBodyRequest, requestOptions); - } - - /** - * The send operation. - * - * @param id The id parameter. - * @param endpoint The endpoint parameter. - * @param input The input parameter. - * @param requiredInt The requiredInt parameter. - * @param maxPageSize The maxPageSize parameter. - * @param user The user parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(String id, String endpoint, String input, int requiredInt, Integer maxPageSize, User user) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest sendRequestObj = new SendRequest(endpoint, input, requiredInt).setUser(user); - BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); - if (maxPageSize != null) { - requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false); - } - sendWithResponse(id, sendRequest, requestOptions).getValue(); - } - - /** - * The send operation. - * - * @param id The id parameter. - * @param endpoint The endpoint parameter. - * @param input The input parameter. - * @param requiredInt The requiredInt parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(String id, String endpoint, String input, int requiredInt) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest sendRequestObj = new SendRequest(endpoint, input, requiredInt); - BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); - sendWithResponse(id, sendRequest, requestOptions).getValue(); - } - - /** - * The sendProjectedName operation. - * - * @param id The id parameter. - * @param fileIdentifier The fileIdentifier parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void sendProjectedName(String id, String fileIdentifier) { - // Generated convenience method for sendProjectedNameWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendProjectedNameRequest sendProjectedNameRequestObj = new SendProjectedNameRequest(fileIdentifier); - BinaryData sendProjectedNameRequest = BinaryData.fromObject(sendProjectedNameRequestObj); - sendProjectedNameWithResponse(id, sendProjectedNameRequest, requestOptions).getValue(); - } - - /** - * The sendLong operation. - * - * @param options Options for sendLong API. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void sendLong(SendLongOptions options) { - // Generated convenience method for sendLongWithResponse - RequestOptions requestOptions = new RequestOptions(); - String name = options.getName(); - String filter = options.getFilter(); - SendLongRequest sendLongRequestObj = new SendLongRequest(options.getInput(), options.getDataInt(), - options.getRequiredUser(), options.getTitle(), options.getStatus()).setUser(options.getUser()) - .setDataIntOptional(options.getDataIntOptional()) - .setDataLong(options.getDataLong()) - .setDataFloat(options.getDataFloat()) - .setLongProperty(options.getLongParameter()) - .setDescription(options.getDescription()) - .setDummy(options.getDummy()); - BinaryData sendLongRequest = BinaryData.fromObject(sendLongRequestObj); - if (filter != null) { - requestOptions.addQueryParam("filter", filter, false); - } - sendLongWithResponse(name, sendLongRequest, requestOptions).getValue(); - } - - /** - * The update operation. - * - * @param id The id parameter. - * @param updateRequest The updateRequest parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public TodoItem update(long id, UpdatePatchRequest updateRequest) { - // Generated convenience method for updateWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getUpdatePatchRequestAccessor().prepareModelForJsonMergePatch(updateRequest, true); - BinaryData updateRequestInBinaryData = BinaryData.fromObject(updateRequest); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - updateRequestInBinaryData.getLength(); - JsonMergePatchHelper.getUpdatePatchRequestAccessor().prepareModelForJsonMergePatch(updateRequest, false); - return updateWithResponse(id, updateRequestInBinaryData, requestOptions).getValue().toObject(TodoItem.class); - } - - /** - * The sendOptionalBody operation. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void sendOptionalBody(String name) { - // Generated convenience method for sendOptionalBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendOptionalBodyRequest sendOptionalBodyRequestObj = new SendOptionalBodyRequest().setName(name); - BinaryData sendOptionalBodyRequest = BinaryData.fromObject(sendOptionalBodyRequestObj); - sendOptionalBodyWithResponse(sendOptionalBodyRequest, requestOptions).getValue(); - } - - /** - * The sendOptionalBody operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void sendOptionalBody() { - // Generated convenience method for sendOptionalBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendOptionalBodyRequest sendOptionalBodyRequestObj = new SendOptionalBodyRequest(); - BinaryData sendOptionalBodyRequest = BinaryData.fromObject(sendOptionalBodyRequestObj); - sendOptionalBodyWithResponse(sendOptionalBodyRequest, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClientBuilder.java deleted file mode 100644 index 063565bcb6b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.flatten.implementation.FlattenClientImpl; - -/** - * A builder for creating a new instance of the FlattenClient type. - */ -@ServiceClientBuilder(serviceClients = { FlattenClient.class, FlattenAsyncClient.class }) -public final class FlattenClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-flatten.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the FlattenClientBuilder. - */ - @Generated - public FlattenClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FlattenClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private FlattenServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the FlattenClientBuilder. - */ - @Generated - public FlattenClientBuilder serviceVersion(FlattenServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the FlattenClientBuilder. - */ - @Generated - public FlattenClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of FlattenClientImpl with the provided parameters. - * - * @return an instance of FlattenClientImpl. - */ - @Generated - private FlattenClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - FlattenServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : FlattenServiceVersion.getLatest(); - FlattenClientImpl client = new FlattenClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of FlattenAsyncClient class. - * - * @return an instance of FlattenAsyncClient. - */ - @Generated - public FlattenAsyncClient buildAsyncClient() { - return new FlattenAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of FlattenClient class. - * - * @return an instance of FlattenClient. - */ - @Generated - public FlattenClient buildClient() { - return new FlattenClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(FlattenClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenServiceVersion.java deleted file mode 100644 index 3628282697a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of FlattenClient. - */ -public enum FlattenServiceVersion implements ServiceVersion { - /** - * Enum value 2022-06-01-preview. - */ - V2022_06_01_PREVIEW("2022-06-01-preview"); - - private final String version; - - FlattenServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link FlattenServiceVersion}. - */ - public static FlattenServiceVersion getLatest() { - return V2022_06_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/FlattenClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/FlattenClientImpl.java deleted file mode 100644 index c4fa3266149..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/FlattenClientImpl.java +++ /dev/null @@ -1,655 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; -import tsptest.flatten.FlattenServiceVersion; - -/** - * Initializes a new instance of the FlattenClient type. - */ -public final class FlattenClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FlattenClientService service; - - /** - */ - private final String endpoint; - - /** - * Gets. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final FlattenServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public FlattenServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of FlattenClient client. - * - * @param endpoint - * @param serviceVersion Service version. - */ - public FlattenClientImpl(String endpoint, FlattenServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of FlattenClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint - * @param serviceVersion Service version. - */ - public FlattenClientImpl(HttpPipeline httpPipeline, String endpoint, FlattenServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of FlattenClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint - * @param serviceVersion Service version. - */ - public FlattenClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - FlattenServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(FlattenClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for FlattenClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}/openai") - @ServiceInterface(name = "FlattenClient") - public interface FlattenClientService { - @Post("/flatten/send") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, - @QueryParam("constantQueryParam") String constantQueryParam, @QueryParam("api-version") String apiVersion, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest, - RequestOptions requestOptions, Context context); - - @Post("/flatten/send") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, - @QueryParam("constantQueryParam") String constantQueryParam, @QueryParam("api-version") String apiVersion, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest, - RequestOptions requestOptions, Context context); - - @Post("/flatten/send-projected-name") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> sendProjectedName(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendProjectedNameRequest, RequestOptions requestOptions, - Context context); - - @Post("/flatten/send-projected-name") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendProjectedNameSync(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendProjectedNameRequest, RequestOptions requestOptions, - Context context); - - @Post("/flatten/send-long") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> sendLong(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendLongRequest, RequestOptions requestOptions, Context context); - - @Post("/flatten/send-long") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendLongSync(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendLongRequest, RequestOptions requestOptions, Context context); - - @Patch("/flatten/patch/{id}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> update(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @PathParam("id") long id, - @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData updateRequest, - RequestOptions requestOptions, Context context); - - @Patch("/flatten/patch/{id}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response updateSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @PathParam("id") long id, - @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData updateRequest, - RequestOptions requestOptions, Context context); - - @Post("/flatten/optional-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> sendOptionalBody(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendOptionalBodyRequest, RequestOptions requestOptions, - Context context); - - @Post("/flatten/optional-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendOptionalBodySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendOptionalBodyRequest, RequestOptions requestOptions, - Context context); - } - - /** - * The send operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maxPageSize parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     endpoint: String (Required)
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: String (Required)
-     *     constant: String (Required)
-     *     requiredInt: int (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendRequest The sendRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(String id, BinaryData sendRequest, - RequestOptions requestOptions) { - final String constantQueryParam = "constant"; - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.send(this.getEndpoint(), id, constantQueryParam, - this.getServiceVersion().getVersion(), contentType, sendRequest, requestOptions, context)); - } - - /** - * The send operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maxPageSize parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     endpoint: String (Required)
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: String (Required)
-     *     constant: String (Required)
-     *     requiredInt: int (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendRequest The sendRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(String id, BinaryData sendRequest, RequestOptions requestOptions) { - final String constantQueryParam = "constant"; - final String contentType = "application/json"; - return service.sendSync(this.getEndpoint(), id, constantQueryParam, this.getServiceVersion().getVersion(), - contentType, sendRequest, requestOptions, Context.NONE); - } - - /** - * The sendProjectedName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     file_id: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendProjectedNameRequest The sendProjectedNameRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendProjectedNameWithResponseAsync(String id, BinaryData sendProjectedNameRequest, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.sendProjectedName(this.getEndpoint(), id, contentType, - sendProjectedNameRequest, requestOptions, context)); - } - - /** - * The sendProjectedName operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     file_id: String (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendProjectedNameRequest The sendProjectedNameRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendProjectedNameWithResponse(String id, BinaryData sendProjectedNameRequest, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendProjectedNameSync(this.getEndpoint(), id, contentType, sendProjectedNameRequest, - requestOptions, Context.NONE); - } - - /** - * The sendLong operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: String (Required)
-     *     dataInt: int (Required)
-     *     dataIntOptional: Integer (Optional)
-     *     dataLong: Long (Optional)
-     *     requiredUser (Required): (recursive schema, see requiredUser above)
-     *     data_float: Double (Optional)
-     *     long: Long (Optional)
-     *     title: String (Required)
-     *     description: String (Optional)
-     *     status: String(NotStarted/InProgress/Completed) (Required)
-     *     _dummy: String (Optional)
-     *     constant: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param sendLongRequest The sendLongRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendLongWithResponseAsync(String name, BinaryData sendLongRequest, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.sendLong(this.getEndpoint(), name, - this.getServiceVersion().getVersion(), contentType, sendLongRequest, requestOptions, context)); - } - - /** - * The sendLong operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: String (Required)
-     *     dataInt: int (Required)
-     *     dataIntOptional: Integer (Optional)
-     *     dataLong: Long (Optional)
-     *     requiredUser (Required): (recursive schema, see requiredUser above)
-     *     data_float: Double (Optional)
-     *     long: Long (Optional)
-     *     title: String (Required)
-     *     description: String (Optional)
-     *     status: String(NotStarted/InProgress/Completed) (Required)
-     *     _dummy: String (Optional)
-     *     constant: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param sendLongRequest The sendLongRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendLongWithResponse(String name, BinaryData sendLongRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendLongSync(this.getEndpoint(), name, this.getServiceVersion().getVersion(), contentType, - sendLongRequest, requestOptions, Context.NONE); - } - - /** - * The update operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     patch (Optional, Required on create): {
-     *         title: String (Optional)
-     *         description: String (Optional)
-     *         status: String(NotStarted/InProgress/Completed) (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: long (Required)
-     *     title: String (Required)
-     *     description: String (Optional)
-     *     status: String(NotStarted/InProgress/Completed) (Required)
-     *     createdAt: OffsetDateTime (Required)
-     *     updatedAt: OffsetDateTime (Required)
-     *     completedAt: OffsetDateTime (Optional)
-     *     _dummy: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param updateRequest The updateRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateWithResponseAsync(long id, BinaryData updateRequest, - RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.update(this.getEndpoint(), contentType, id, accept, - updateRequest, requestOptions, context)); - } - - /** - * The update operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     patch (Optional, Required on create): {
-     *         title: String (Optional)
-     *         description: String (Optional)
-     *         status: String(NotStarted/InProgress/Completed) (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: long (Required)
-     *     title: String (Required)
-     *     description: String (Optional)
-     *     status: String(NotStarted/InProgress/Completed) (Required)
-     *     createdAt: OffsetDateTime (Required)
-     *     updatedAt: OffsetDateTime (Required)
-     *     completedAt: OffsetDateTime (Optional)
-     *     _dummy: String (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param updateRequest The updateRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse(long id, BinaryData updateRequest, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return service.updateSync(this.getEndpoint(), contentType, id, accept, updateRequest, requestOptions, - Context.NONE); - } - - /** - * The sendOptionalBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Optional)
-     * }
-     * }
-     * 
- * - * @param sendOptionalBodyRequest The sendOptionalBodyRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendOptionalBodyWithResponseAsync(BinaryData sendOptionalBodyRequest, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.sendOptionalBody(this.getEndpoint(), contentType, - sendOptionalBodyRequest, requestOptions, context)); - } - - /** - * The sendOptionalBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Optional)
-     * }
-     * }
-     * 
- * - * @param sendOptionalBodyRequest The sendOptionalBodyRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendOptionalBodyWithResponse(BinaryData sendOptionalBodyRequest, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendOptionalBodySync(this.getEndpoint(), contentType, sendOptionalBodyRequest, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/JsonMergePatchHelper.java deleted file mode 100644 index ae339275cdd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/JsonMergePatchHelper.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.implementation; - -import tsptest.flatten.models.TodoItemPatch; -import tsptest.flatten.models.UpdatePatchRequest; - -/** - * This is the Helper class to enable json merge patch serialization for a model. - */ -public class JsonMergePatchHelper { - private static UpdatePatchRequestAccessor updatePatchRequestAccessor; - - public interface UpdatePatchRequestAccessor { - UpdatePatchRequest prepareModelForJsonMergePatch(UpdatePatchRequest updatePatchRequest, - boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(UpdatePatchRequest updatePatchRequest); - } - - public static void setUpdatePatchRequestAccessor(UpdatePatchRequestAccessor accessor) { - updatePatchRequestAccessor = accessor; - } - - public static UpdatePatchRequestAccessor getUpdatePatchRequestAccessor() { - return updatePatchRequestAccessor; - } - - private static TodoItemPatchAccessor todoItemPatchAccessor; - - public interface TodoItemPatchAccessor { - TodoItemPatch prepareModelForJsonMergePatch(TodoItemPatch todoItemPatch, boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(TodoItemPatch todoItemPatch); - } - - public static void setTodoItemPatchAccessor(TodoItemPatchAccessor accessor) { - todoItemPatchAccessor = accessor; - } - - public static TodoItemPatchAccessor getTodoItemPatchAccessor() { - return todoItemPatchAccessor; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendLongRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendLongRequest.java deleted file mode 100644 index 2a33ffd1032..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendLongRequest.java +++ /dev/null @@ -1,424 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.flatten.models.SendLongRequestStatus; -import tsptest.flatten.models.User; - -/** - * The SendLongRequest model. - */ -@Fluent -public final class SendLongRequest implements JsonSerializable { - /* - * The user property. - */ - @Generated - private User user; - - /* - * The input property. - */ - @Generated - private final String input; - - /* - * The dataInt property. - */ - @Generated - private final int dataInt; - - /* - * The dataIntOptional property. - */ - @Generated - private Integer dataIntOptional; - - /* - * The dataLong property. - */ - @Generated - private Long dataLong; - - /* - * The requiredUser property. - */ - @Generated - private final User requiredUser; - - /* - * The data_float property. - */ - @Generated - private Double dataFloat; - - /* - * The long property. - */ - @Generated - private Long longProperty; - - /* - * The item's title - */ - @Generated - private final String title; - - /* - * A longer description of the todo item in markdown format - */ - @Generated - private String description; - - /* - * The status of the todo item - */ - @Generated - private final SendLongRequestStatus status; - - /* - * The _dummy property. - */ - @Generated - private String dummy; - - /* - * The constant property. - */ - @Generated - private final String constant = "constant"; - - /** - * Creates an instance of SendLongRequest class. - * - * @param input the input value to set. - * @param dataInt the dataInt value to set. - * @param requiredUser the requiredUser value to set. - * @param title the title value to set. - * @param status the status value to set. - */ - @Generated - public SendLongRequest(String input, int dataInt, User requiredUser, String title, SendLongRequestStatus status) { - this.input = input; - this.dataInt = dataInt; - this.requiredUser = requiredUser; - this.title = title; - this.status = status; - } - - /** - * Get the user property: The user property. - * - * @return the user value. - */ - @Generated - public User getUser() { - return this.user; - } - - /** - * Set the user property: The user property. - * - * @param user the user value to set. - * @return the SendLongRequest object itself. - */ - @Generated - public SendLongRequest setUser(User user) { - this.user = user; - return this; - } - - /** - * Get the input property: The input property. - * - * @return the input value. - */ - @Generated - public String getInput() { - return this.input; - } - - /** - * Get the dataInt property: The dataInt property. - * - * @return the dataInt value. - */ - @Generated - public int getDataInt() { - return this.dataInt; - } - - /** - * Get the dataIntOptional property: The dataIntOptional property. - * - * @return the dataIntOptional value. - */ - @Generated - public Integer getDataIntOptional() { - return this.dataIntOptional; - } - - /** - * Set the dataIntOptional property: The dataIntOptional property. - * - * @param dataIntOptional the dataIntOptional value to set. - * @return the SendLongRequest object itself. - */ - @Generated - public SendLongRequest setDataIntOptional(Integer dataIntOptional) { - this.dataIntOptional = dataIntOptional; - return this; - } - - /** - * Get the dataLong property: The dataLong property. - * - * @return the dataLong value. - */ - @Generated - public Long getDataLong() { - return this.dataLong; - } - - /** - * Set the dataLong property: The dataLong property. - * - * @param dataLong the dataLong value to set. - * @return the SendLongRequest object itself. - */ - @Generated - public SendLongRequest setDataLong(Long dataLong) { - this.dataLong = dataLong; - return this; - } - - /** - * Get the requiredUser property: The requiredUser property. - * - * @return the requiredUser value. - */ - @Generated - public User getRequiredUser() { - return this.requiredUser; - } - - /** - * Get the dataFloat property: The data_float property. - * - * @return the dataFloat value. - */ - @Generated - public Double getDataFloat() { - return this.dataFloat; - } - - /** - * Set the dataFloat property: The data_float property. - * - * @param dataFloat the dataFloat value to set. - * @return the SendLongRequest object itself. - */ - @Generated - public SendLongRequest setDataFloat(Double dataFloat) { - this.dataFloat = dataFloat; - return this; - } - - /** - * Get the longProperty property: The long property. - * - * @return the longProperty value. - */ - @Generated - public Long getLongProperty() { - return this.longProperty; - } - - /** - * Set the longProperty property: The long property. - * - * @param longProperty the longProperty value to set. - * @return the SendLongRequest object itself. - */ - @Generated - public SendLongRequest setLongProperty(Long longProperty) { - this.longProperty = longProperty; - return this; - } - - /** - * Get the title property: The item's title. - * - * @return the title value. - */ - @Generated - public String getTitle() { - return this.title; - } - - /** - * Get the description property: A longer description of the todo item in markdown format. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * Set the description property: A longer description of the todo item in markdown format. - * - * @param description the description value to set. - * @return the SendLongRequest object itself. - */ - @Generated - public SendLongRequest setDescription(String description) { - this.description = description; - return this; - } - - /** - * Get the status property: The status of the todo item. - * - * @return the status value. - */ - @Generated - public SendLongRequestStatus getStatus() { - return this.status; - } - - /** - * Get the dummy property: The _dummy property. - * - * @return the dummy value. - */ - @Generated - public String getDummy() { - return this.dummy; - } - - /** - * Set the dummy property: The _dummy property. - * - * @param dummy the dummy value to set. - * @return the SendLongRequest object itself. - */ - @Generated - public SendLongRequest setDummy(String dummy) { - this.dummy = dummy; - return this; - } - - /** - * Get the constant property: The constant property. - * - * @return the constant value. - */ - @Generated - public String getConstant() { - return this.constant; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("input", this.input); - jsonWriter.writeIntField("dataInt", this.dataInt); - jsonWriter.writeJsonField("requiredUser", this.requiredUser); - jsonWriter.writeStringField("title", this.title); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); - jsonWriter.writeStringField("constant", this.constant); - jsonWriter.writeJsonField("user", this.user); - jsonWriter.writeNumberField("dataIntOptional", this.dataIntOptional); - jsonWriter.writeNumberField("dataLong", this.dataLong); - jsonWriter.writeNumberField("data_float", this.dataFloat); - jsonWriter.writeNumberField("long", this.longProperty); - jsonWriter.writeStringField("description", this.description); - jsonWriter.writeStringField("_dummy", this.dummy); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendLongRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendLongRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendLongRequest. - */ - @Generated - public static SendLongRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String input = null; - int dataInt = 0; - User requiredUser = null; - String title = null; - SendLongRequestStatus status = null; - User user = null; - Integer dataIntOptional = null; - Long dataLong = null; - Double dataFloat = null; - Long longProperty = null; - String description = null; - String dummy = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("input".equals(fieldName)) { - input = reader.getString(); - } else if ("dataInt".equals(fieldName)) { - dataInt = reader.getInt(); - } else if ("requiredUser".equals(fieldName)) { - requiredUser = User.fromJson(reader); - } else if ("title".equals(fieldName)) { - title = reader.getString(); - } else if ("status".equals(fieldName)) { - status = SendLongRequestStatus.fromString(reader.getString()); - } else if ("user".equals(fieldName)) { - user = User.fromJson(reader); - } else if ("dataIntOptional".equals(fieldName)) { - dataIntOptional = reader.getNullable(JsonReader::getInt); - } else if ("dataLong".equals(fieldName)) { - dataLong = reader.getNullable(JsonReader::getLong); - } else if ("data_float".equals(fieldName)) { - dataFloat = reader.getNullable(JsonReader::getDouble); - } else if ("long".equals(fieldName)) { - longProperty = reader.getNullable(JsonReader::getLong); - } else if ("description".equals(fieldName)) { - description = reader.getString(); - } else if ("_dummy".equals(fieldName)) { - dummy = reader.getString(); - } else { - reader.skipChildren(); - } - } - SendLongRequest deserializedSendLongRequest - = new SendLongRequest(input, dataInt, requiredUser, title, status); - deserializedSendLongRequest.user = user; - deserializedSendLongRequest.dataIntOptional = dataIntOptional; - deserializedSendLongRequest.dataLong = dataLong; - deserializedSendLongRequest.dataFloat = dataFloat; - deserializedSendLongRequest.longProperty = longProperty; - deserializedSendLongRequest.description = description; - deserializedSendLongRequest.dummy = dummy; - - return deserializedSendLongRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendOptionalBodyRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendOptionalBodyRequest.java deleted file mode 100644 index f2b7a774997..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendOptionalBodyRequest.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The SendOptionalBodyRequest model. - */ -@Fluent -public final class SendOptionalBodyRequest implements JsonSerializable { - /* - * The name property. - */ - @Generated - private String name; - - /** - * Creates an instance of SendOptionalBodyRequest class. - */ - @Generated - public SendOptionalBodyRequest() { - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Set the name property: The name property. - * - * @param name the name value to set. - * @return the SendOptionalBodyRequest object itself. - */ - @Generated - public SendOptionalBodyRequest setName(String name) { - this.name = name; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendOptionalBodyRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendOptionalBodyRequest if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the SendOptionalBodyRequest. - */ - @Generated - public static SendOptionalBodyRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SendOptionalBodyRequest deserializedSendOptionalBodyRequest = new SendOptionalBodyRequest(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedSendOptionalBodyRequest.name = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedSendOptionalBodyRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendProjectedNameRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendProjectedNameRequest.java deleted file mode 100644 index a32d0cb57bf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendProjectedNameRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The SendProjectedNameRequest model. - */ -@Immutable -public final class SendProjectedNameRequest implements JsonSerializable { - /* - * The file_id property. - */ - @Generated - private final String fileIdentifier; - - /** - * Creates an instance of SendProjectedNameRequest class. - * - * @param fileIdentifier the fileIdentifier value to set. - */ - @Generated - public SendProjectedNameRequest(String fileIdentifier) { - this.fileIdentifier = fileIdentifier; - } - - /** - * Get the fileIdentifier property: The file_id property. - * - * @return the fileIdentifier value. - */ - @Generated - public String getFileIdentifier() { - return this.fileIdentifier; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("file_id", this.fileIdentifier); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendProjectedNameRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendProjectedNameRequest if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendProjectedNameRequest. - */ - @Generated - public static SendProjectedNameRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String fileIdentifier = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("file_id".equals(fieldName)) { - fileIdentifier = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new SendProjectedNameRequest(fileIdentifier); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendRequest.java deleted file mode 100644 index 9570fca187f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendRequest.java +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.flatten.models.User; - -/** - * The SendRequest model. - */ -@Fluent -public final class SendRequest implements JsonSerializable { - /* - * The endpoint property. - */ - @Generated - private final String endpoint; - - /* - * The user property. - */ - @Generated - private User user; - - /* - * The input property. - */ - @Generated - private final String input; - - /* - * The constant property. - */ - @Generated - private final String constant = "constant"; - - /* - * The requiredInt property. - */ - @Generated - private final int requiredInt; - - /** - * Creates an instance of SendRequest class. - * - * @param endpoint the endpoint value to set. - * @param input the input value to set. - * @param requiredInt the requiredInt value to set. - */ - @Generated - public SendRequest(String endpoint, String input, int requiredInt) { - this.endpoint = endpoint; - this.input = input; - this.requiredInt = requiredInt; - } - - /** - * Get the endpoint property: The endpoint property. - * - * @return the endpoint value. - */ - @Generated - public String getEndpoint() { - return this.endpoint; - } - - /** - * Get the user property: The user property. - * - * @return the user value. - */ - @Generated - public User getUser() { - return this.user; - } - - /** - * Set the user property: The user property. - * - * @param user the user value to set. - * @return the SendRequest object itself. - */ - @Generated - public SendRequest setUser(User user) { - this.user = user; - return this; - } - - /** - * Get the input property: The input property. - * - * @return the input value. - */ - @Generated - public String getInput() { - return this.input; - } - - /** - * Get the constant property: The constant property. - * - * @return the constant value. - */ - @Generated - public String getConstant() { - return this.constant; - } - - /** - * Get the requiredInt property: The requiredInt property. - * - * @return the requiredInt value. - */ - @Generated - public int getRequiredInt() { - return this.requiredInt; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("endpoint", this.endpoint); - jsonWriter.writeStringField("input", this.input); - jsonWriter.writeStringField("constant", this.constant); - jsonWriter.writeIntField("requiredInt", this.requiredInt); - jsonWriter.writeJsonField("user", this.user); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendRequest. - */ - @Generated - public static SendRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String endpoint = null; - String input = null; - int requiredInt = 0; - User user = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("endpoint".equals(fieldName)) { - endpoint = reader.getString(); - } else if ("input".equals(fieldName)) { - input = reader.getString(); - } else if ("requiredInt".equals(fieldName)) { - requiredInt = reader.getInt(); - } else if ("user".equals(fieldName)) { - user = User.fromJson(reader); - } else { - reader.skipChildren(); - } - } - SendRequest deserializedSendRequest = new SendRequest(endpoint, input, requiredInt); - deserializedSendRequest.user = user; - - return deserializedSendRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/package-info.java deleted file mode 100644 index 62f7e611d3b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Flatten. - * - */ -package tsptest.flatten.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/package-info.java deleted file mode 100644 index 183df0b9444..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Flatten. - * - */ -package tsptest.flatten.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongOptions.java deleted file mode 100644 index dad0844b382..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongOptions.java +++ /dev/null @@ -1,355 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; - -/** - * Options for sendLong API. - */ -@Fluent -public final class SendLongOptions { - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The filter property. - */ - @Generated - private String filter; - - /* - * The user property. - */ - @Generated - private User user; - - /* - * The input property. - */ - @Generated - private final String input; - - /* - * The dataInt property. - */ - @Generated - private final int dataInt; - - /* - * The dataIntOptional property. - */ - @Generated - private Integer dataIntOptional; - - /* - * The dataLong property. - */ - @Generated - private Long dataLong; - - /* - * The requiredUser property. - */ - @Generated - private final User requiredUser; - - /* - * The data_float property. - */ - @Generated - private Double dataFloat; - - /* - * The long property. - */ - @Generated - private Long longParameter; - - /* - * The item's title - */ - @Generated - private final String title; - - /* - * A longer description of the todo item in markdown format - */ - @Generated - private String description; - - /* - * The status of the todo item - */ - @Generated - private final SendLongRequestStatus status; - - /* - * The _dummy property. - */ - @Generated - private String dummy; - - /** - * Creates an instance of SendLongOptions class. - * - * @param name the name value to set. - * @param input the input value to set. - * @param dataInt the dataInt value to set. - * @param requiredUser the requiredUser value to set. - * @param title the title value to set. - * @param status the status value to set. - */ - @Generated - public SendLongOptions(String name, String input, int dataInt, User requiredUser, String title, - SendLongRequestStatus status) { - this.name = name; - this.input = input; - this.dataInt = dataInt; - this.requiredUser = requiredUser; - this.title = title; - this.status = status; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the filter property: The filter property. - * - * @return the filter value. - */ - @Generated - public String getFilter() { - return this.filter; - } - - /** - * Set the filter property: The filter property. - * - * @param filter the filter value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setFilter(String filter) { - this.filter = filter; - return this; - } - - /** - * Get the user property: The user property. - * - * @return the user value. - */ - @Generated - public User getUser() { - return this.user; - } - - /** - * Set the user property: The user property. - * - * @param user the user value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setUser(User user) { - this.user = user; - return this; - } - - /** - * Get the input property: The input property. - * - * @return the input value. - */ - @Generated - public String getInput() { - return this.input; - } - - /** - * Get the dataInt property: The dataInt property. - * - * @return the dataInt value. - */ - @Generated - public int getDataInt() { - return this.dataInt; - } - - /** - * Get the dataIntOptional property: The dataIntOptional property. - * - * @return the dataIntOptional value. - */ - @Generated - public Integer getDataIntOptional() { - return this.dataIntOptional; - } - - /** - * Set the dataIntOptional property: The dataIntOptional property. - * - * @param dataIntOptional the dataIntOptional value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setDataIntOptional(Integer dataIntOptional) { - this.dataIntOptional = dataIntOptional; - return this; - } - - /** - * Get the dataLong property: The dataLong property. - * - * @return the dataLong value. - */ - @Generated - public Long getDataLong() { - return this.dataLong; - } - - /** - * Set the dataLong property: The dataLong property. - * - * @param dataLong the dataLong value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setDataLong(Long dataLong) { - this.dataLong = dataLong; - return this; - } - - /** - * Get the requiredUser property: The requiredUser property. - * - * @return the requiredUser value. - */ - @Generated - public User getRequiredUser() { - return this.requiredUser; - } - - /** - * Get the dataFloat property: The data_float property. - * - * @return the dataFloat value. - */ - @Generated - public Double getDataFloat() { - return this.dataFloat; - } - - /** - * Set the dataFloat property: The data_float property. - * - * @param dataFloat the dataFloat value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setDataFloat(Double dataFloat) { - this.dataFloat = dataFloat; - return this; - } - - /** - * Get the longParameter property: The long property. - * - * @return the longParameter value. - */ - @Generated - public Long getLongParameter() { - return this.longParameter; - } - - /** - * Set the longParameter property: The long property. - * - * @param longParameter the longParameter value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setLongParameter(Long longParameter) { - this.longParameter = longParameter; - return this; - } - - /** - * Get the title property: The item's title. - * - * @return the title value. - */ - @Generated - public String getTitle() { - return this.title; - } - - /** - * Get the description property: A longer description of the todo item in markdown format. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * Set the description property: A longer description of the todo item in markdown format. - * - * @param description the description value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setDescription(String description) { - this.description = description; - return this; - } - - /** - * Get the status property: The status of the todo item. - * - * @return the status value. - */ - @Generated - public SendLongRequestStatus getStatus() { - return this.status; - } - - /** - * Get the dummy property: The _dummy property. - * - * @return the dummy value. - */ - @Generated - public String getDummy() { - return this.dummy; - } - - /** - * Set the dummy property: The _dummy property. - * - * @param dummy the dummy value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setDummy(String dummy) { - this.dummy = dummy; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongRequestStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongRequestStatus.java deleted file mode 100644 index 722804ac761..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongRequestStatus.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.models; - -/** - * Defines values for SendLongRequestStatus. - */ -public enum SendLongRequestStatus { - /** - * Enum value NotStarted. - */ - NOT_STARTED("NotStarted"), - - /** - * Enum value InProgress. - */ - IN_PROGRESS("InProgress"), - - /** - * Enum value Completed. - */ - COMPLETED("Completed"); - - /** - * The actual serialized value for a SendLongRequestStatus instance. - */ - private final String value; - - SendLongRequestStatus(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a SendLongRequestStatus instance. - * - * @param value the serialized value to parse. - * @return the parsed SendLongRequestStatus object, or null if unable to parse. - */ - public static SendLongRequestStatus fromString(String value) { - if (value == null) { - return null; - } - SendLongRequestStatus[] items = SendLongRequestStatus.values(); - for (SendLongRequestStatus item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItem.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItem.java deleted file mode 100644 index 7f1764ae777..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItem.java +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; - -/** - * The TodoItem model. - */ -@Immutable -public final class TodoItem implements JsonSerializable { - /* - * The item's unique id - */ - @Generated - private long id; - - /* - * The item's title - */ - @Generated - private final String title; - - /* - * A longer description of the todo item in markdown format - */ - @Generated - private String description; - - /* - * The status of the todo item - */ - @Generated - private final SendLongRequestStatus status; - - /* - * When the todo item was created. - */ - @Generated - private OffsetDateTime createdAt; - - /* - * When the todo item was last updated - */ - @Generated - private OffsetDateTime updatedAt; - - /* - * When the todo item was makred as completed - */ - @Generated - private OffsetDateTime completedAt; - - /* - * The _dummy property. - */ - @Generated - private String dummy; - - /** - * Creates an instance of TodoItem class. - * - * @param title the title value to set. - * @param status the status value to set. - */ - @Generated - private TodoItem(String title, SendLongRequestStatus status) { - this.title = title; - this.status = status; - } - - /** - * Get the id property: The item's unique id. - * - * @return the id value. - */ - @Generated - public long getId() { - return this.id; - } - - /** - * Get the title property: The item's title. - * - * @return the title value. - */ - @Generated - public String getTitle() { - return this.title; - } - - /** - * Get the description property: A longer description of the todo item in markdown format. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * Get the status property: The status of the todo item. - * - * @return the status value. - */ - @Generated - public SendLongRequestStatus getStatus() { - return this.status; - } - - /** - * Get the createdAt property: When the todo item was created. - * - * @return the createdAt value. - */ - @Generated - public OffsetDateTime getCreatedAt() { - return this.createdAt; - } - - /** - * Get the updatedAt property: When the todo item was last updated. - * - * @return the updatedAt value. - */ - @Generated - public OffsetDateTime getUpdatedAt() { - return this.updatedAt; - } - - /** - * Get the completedAt property: When the todo item was makred as completed. - * - * @return the completedAt value. - */ - @Generated - public OffsetDateTime getCompletedAt() { - return this.completedAt; - } - - /** - * Get the dummy property: The _dummy property. - * - * @return the dummy value. - */ - @Generated - public String getDummy() { - return this.dummy; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("title", this.title); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); - jsonWriter.writeStringField("description", this.description); - jsonWriter.writeStringField("_dummy", this.dummy); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TodoItem from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TodoItem if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TodoItem. - */ - @Generated - public static TodoItem fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - long id = 0L; - String title = null; - SendLongRequestStatus status = null; - OffsetDateTime createdAt = null; - OffsetDateTime updatedAt = null; - String description = null; - OffsetDateTime completedAt = null; - String dummy = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getLong(); - } else if ("title".equals(fieldName)) { - title = reader.getString(); - } else if ("status".equals(fieldName)) { - status = SendLongRequestStatus.fromString(reader.getString()); - } else if ("createdAt".equals(fieldName)) { - createdAt = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("updatedAt".equals(fieldName)) { - updatedAt = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("description".equals(fieldName)) { - description = reader.getString(); - } else if ("completedAt".equals(fieldName)) { - completedAt = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("_dummy".equals(fieldName)) { - dummy = reader.getString(); - } else { - reader.skipChildren(); - } - } - TodoItem deserializedTodoItem = new TodoItem(title, status); - deserializedTodoItem.id = id; - deserializedTodoItem.createdAt = createdAt; - deserializedTodoItem.updatedAt = updatedAt; - deserializedTodoItem.description = description; - deserializedTodoItem.completedAt = completedAt; - deserializedTodoItem.dummy = dummy; - - return deserializedTodoItem; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatch.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatch.java deleted file mode 100644 index 7c30ab7a70a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatch.java +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import tsptest.flatten.implementation.JsonMergePatchHelper; - -/** - * The TodoItemPatch model. - */ -@Fluent -public final class TodoItemPatch implements JsonSerializable { - /* - * The item's title - */ - @Generated - private String title; - - /* - * A longer description of the todo item in markdown format - */ - @Generated - private String description; - - /* - * The status of the todo item - */ - @Generated - private TodoItemPatchStatus status; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setTodoItemPatchAccessor(new JsonMergePatchHelper.TodoItemPatchAccessor() { - @Override - public TodoItemPatch prepareModelForJsonMergePatch(TodoItemPatch model, boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(TodoItemPatch model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of TodoItemPatch class. - */ - @Generated - public TodoItemPatch() { - } - - /** - * Get the title property: The item's title. - * - * @return the title value. - */ - @Generated - public String getTitle() { - return this.title; - } - - /** - * Set the title property: The item's title. - * - * @param title the title value to set. - * @return the TodoItemPatch object itself. - */ - @Generated - public TodoItemPatch setTitle(String title) { - this.title = title; - this.updatedProperties.add("title"); - return this; - } - - /** - * Get the description property: A longer description of the todo item in markdown format. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * Set the description property: A longer description of the todo item in markdown format. - * - * @param description the description value to set. - * @return the TodoItemPatch object itself. - */ - @Generated - public TodoItemPatch setDescription(String description) { - this.description = description; - this.updatedProperties.add("description"); - return this; - } - - /** - * Get the status property: The status of the todo item. - * - * @return the status value. - */ - @Generated - public TodoItemPatchStatus getStatus() { - return this.status; - } - - /** - * Set the status property: The status of the todo item. - * - * @param status the status value to set. - * @return the TodoItemPatch object itself. - */ - @Generated - public TodoItemPatch setStatus(TodoItemPatchStatus status) { - this.status = status; - this.updatedProperties.add("status"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("title", this.title); - jsonWriter.writeStringField("description", this.description); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("title")) { - if (this.title == null) { - jsonWriter.writeNullField("title"); - } else { - jsonWriter.writeStringField("title", this.title); - } - } - if (updatedProperties.contains("description")) { - if (this.description == null) { - jsonWriter.writeNullField("description"); - } else { - jsonWriter.writeStringField("description", this.description); - } - } - if (updatedProperties.contains("status")) { - if (this.status == null) { - jsonWriter.writeNullField("status"); - } else { - jsonWriter.writeStringField("status", this.status.toString()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TodoItemPatch from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TodoItemPatch if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the TodoItemPatch. - */ - @Generated - public static TodoItemPatch fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TodoItemPatch deserializedTodoItemPatch = new TodoItemPatch(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("title".equals(fieldName)) { - deserializedTodoItemPatch.title = reader.getString(); - } else if ("description".equals(fieldName)) { - deserializedTodoItemPatch.description = reader.getString(); - } else if ("status".equals(fieldName)) { - deserializedTodoItemPatch.status = TodoItemPatchStatus.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedTodoItemPatch; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatchStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatchStatus.java deleted file mode 100644 index c260baaf730..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatchStatus.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.models; - -/** - * Defines values for TodoItemPatchStatus. - */ -public enum TodoItemPatchStatus { - /** - * Enum value NotStarted. - */ - NOT_STARTED("NotStarted"), - - /** - * Enum value InProgress. - */ - IN_PROGRESS("InProgress"), - - /** - * Enum value Completed. - */ - COMPLETED("Completed"); - - /** - * The actual serialized value for a TodoItemPatchStatus instance. - */ - private final String value; - - TodoItemPatchStatus(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a TodoItemPatchStatus instance. - * - * @param value the serialized value to parse. - * @return the parsed TodoItemPatchStatus object, or null if unable to parse. - */ - public static TodoItemPatchStatus fromString(String value) { - if (value == null) { - return null; - } - TodoItemPatchStatus[] items = TodoItemPatchStatus.values(); - for (TodoItemPatchStatus item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/UpdatePatchRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/UpdatePatchRequest.java deleted file mode 100644 index 3561305649d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/UpdatePatchRequest.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import tsptest.flatten.implementation.JsonMergePatchHelper; - -/** - * The UpdatePatchRequest model. - */ -@Fluent -public final class UpdatePatchRequest implements JsonSerializable { - /* - * The patch property. - */ - @Generated - private TodoItemPatch patch; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setUpdatePatchRequestAccessor(new JsonMergePatchHelper.UpdatePatchRequestAccessor() { - @Override - public UpdatePatchRequest prepareModelForJsonMergePatch(UpdatePatchRequest model, - boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(UpdatePatchRequest model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of UpdatePatchRequest class. - */ - @Generated - public UpdatePatchRequest() { - } - - /** - * Get the patch property: The patch property. - * - * @return the patch value. - */ - @Generated - public TodoItemPatch getPatch() { - return this.patch; - } - - /** - * Set the patch property: The patch property. - *

Required when create the resource.

- * - * @param patch the patch value to set. - * @return the UpdatePatchRequest object itself. - */ - @Generated - public UpdatePatchRequest setPatch(TodoItemPatch patch) { - this.patch = patch; - this.updatedProperties.add("patch"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("patch", this.patch); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("patch")) { - if (this.patch == null) { - jsonWriter.writeNullField("patch"); - } else { - JsonMergePatchHelper.getTodoItemPatchAccessor().prepareModelForJsonMergePatch(this.patch, true); - jsonWriter.writeJsonField("patch", this.patch); - JsonMergePatchHelper.getTodoItemPatchAccessor().prepareModelForJsonMergePatch(this.patch, false); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UpdatePatchRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UpdatePatchRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the UpdatePatchRequest. - */ - @Generated - public static UpdatePatchRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - UpdatePatchRequest deserializedUpdatePatchRequest = new UpdatePatchRequest(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("patch".equals(fieldName)) { - deserializedUpdatePatchRequest.patch = TodoItemPatch.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedUpdatePatchRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/User.java deleted file mode 100644 index 03a1a63dcc0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/User.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The User model. - */ -@Immutable -public final class User implements JsonSerializable { - /* - * The user property. - */ - @Generated - private final String user; - - /** - * Creates an instance of User class. - * - * @param user the user value to set. - */ - @Generated - public User(String user) { - this.user = user; - } - - /** - * Get the user property: The user property. - * - * @return the user value. - */ - @Generated - public String getUser() { - return this.user; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("user", this.user); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of User from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the User. - */ - @Generated - public static User fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String user = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("user".equals(fieldName)) { - user = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new User(user); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/package-info.java deleted file mode 100644 index eb74590fb4b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Flatten. - * - */ -package tsptest.flatten.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/package-info.java deleted file mode 100644 index b550b566524..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Flatten. - * - */ -package tsptest.flatten; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalAsyncClient.java deleted file mode 100644 index 741e46e36a7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalAsyncClient.java +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.internal.implementation.InternalOpsImpl; -import tsptest.internal.models.ApiRequest; -import tsptest.internal.models.ApiResponse; -import tsptest.internal.models.ResponseInternal; - -/** - * Initializes a new instance of the asynchronous InternalClient type. - */ -@ServiceClient(builder = InternalClientBuilder.class, isAsync = true) -public final class InternalAsyncClient { - @Generated - private final InternalOpsImpl serviceClient; - - /** - * Initializes an instance of InternalAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - InternalAsyncClient(InternalOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The postInternal operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postInternalWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postInternalWithResponseAsync(body, requestOptions); - } - - /** - * The getInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> getInternalWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getInternalWithResponseAsync(requestOptions); - } - - /** - * The postProtocalInternal operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> postProtocalInternalWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postProtocalInternalWithResponseAsync(body, requestOptions); - } - - /** - * The postInternal operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono postInternal(ApiRequest body) { - // Generated convenience method for postInternalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postInternalWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ResponseInternal.class)); - } - - /** - * The getInternal operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono getInternal() { - // Generated convenience method for getInternalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getInternalWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ApiResponse.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClient.java deleted file mode 100644 index 229e175da20..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClient.java +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.internal.implementation.InternalOpsImpl; -import tsptest.internal.models.ApiRequest; -import tsptest.internal.models.ApiResponse; -import tsptest.internal.models.ResponseInternal; - -/** - * Initializes a new instance of the synchronous InternalClient type. - */ -@ServiceClient(builder = InternalClientBuilder.class) -public final class InternalClient { - @Generated - private final InternalOpsImpl serviceClient; - - /** - * Initializes an instance of InternalClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - InternalClient(InternalOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The postInternal operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postInternalWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postInternalWithResponse(body, requestOptions); - } - - /** - * The getInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response getInternalWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getInternalWithResponse(requestOptions); - } - - /** - * The postProtocalInternal operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response postProtocalInternalWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postProtocalInternalWithResponse(body, requestOptions); - } - - /** - * The postInternal operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ResponseInternal postInternal(ApiRequest body) { - // Generated convenience method for postInternalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postInternalWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(ResponseInternal.class); - } - - /** - * The getInternal operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - ApiResponse getInternal() { - // Generated convenience method for getInternalWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getInternalWithResponse(requestOptions).getValue().toObject(ApiResponse.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClientBuilder.java deleted file mode 100644 index dfa5a8b1051..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.internal.implementation.InternalClientImpl; - -/** - * A builder for creating a new instance of the InternalClient type. - */ -@ServiceClientBuilder(serviceClients = { InternalClient.class, InternalAsyncClient.class }) -public final class InternalClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-internal.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the InternalClientBuilder. - */ - @Generated - public InternalClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public InternalClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public InternalClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public InternalClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public InternalClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public InternalClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public InternalClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public InternalClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public InternalClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the InternalClientBuilder. - */ - @Generated - public InternalClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of InternalClientImpl with the provided parameters. - * - * @return an instance of InternalClientImpl. - */ - @Generated - private InternalClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - InternalClientImpl client - = new InternalClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of InternalAsyncClient class. - * - * @return an instance of InternalAsyncClient. - */ - @Generated - public InternalAsyncClient buildAsyncClient() { - return new InternalAsyncClient(buildInnerClient().getInternalOps()); - } - - /** - * Builds an instance of InternalClient class. - * - * @return an instance of InternalClient. - */ - @Generated - public InternalClient buildClient() { - return new InternalClient(buildInnerClient().getInternalOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(InternalClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalClientImpl.java deleted file mode 100644 index 93e82ee04c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 InternalClient type. - */ -public final class InternalClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 InternalOpsImpl object to access its operations. - */ - private final InternalOpsImpl internalOps; - - /** - * Gets the InternalOpsImpl object to access its operations. - * - * @return the InternalOpsImpl object. - */ - public InternalOpsImpl getInternalOps() { - return this.internalOps; - } - - /** - * Initializes an instance of InternalClient client. - * - * @param endpoint Service host. - */ - public InternalClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of InternalClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public InternalClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of InternalClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public InternalClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.internalOps = new InternalOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalOpsImpl.java deleted file mode 100644 index 03198d62bf8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalOpsImpl.java +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in InternalOps. - */ -public final class InternalOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final InternalOpsService service; - - /** - * The service client containing this operation class. - */ - private final InternalClientImpl client; - - /** - * Initializes an instance of InternalOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - InternalOpsImpl(InternalClientImpl client) { - this.service - = RestProxy.create(InternalOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for InternalClientInternalOps to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "InternalClientInternalOps") - public interface InternalOpsService { - @Post("/internal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> postInternal(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/internal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postInternalSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Get("/internal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getInternal(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/internal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getInternalSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/internal/protocal-internal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> postProtocalInternal(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/internal/protocal-internal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postProtocalInternalSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The postInternal operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postInternalWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.postInternal(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The postInternal operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         name: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postInternalWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.postInternalSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The getInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getInternalWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getInternal(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getInternal operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getInternalWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getInternalSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The postProtocalInternal operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postProtocalInternalWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.postProtocalInternal(this.client.getEndpoint(), contentType, - body, requestOptions, context)); - } - - /** - * The postProtocalInternal operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postProtocalInternalWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.postProtocalInternalSync(this.client.getEndpoint(), contentType, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/Color.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/Color.java deleted file mode 100644 index 11a1bdaafcb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/Color.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.implementation.models; - -/** - * Defines values for Color. - */ -public enum Color { - /** - * Enum value Red. - */ - RED("Red"), - - /** - * Enum value Blue. - */ - BLUE("Blue"), - - /** - * Enum value Green. - */ - GREEN("Green"); - - /** - * The actual serialized value for a Color instance. - */ - private final String value; - - Color(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a Color instance. - * - * @param value the serialized value to parse. - * @return the parsed Color object, or null if unable to parse. - */ - public static Color fromString(String value) { - if (value == null) { - return null; - } - Color[] items = Color.values(); - for (Color item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/ColorModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/ColorModel.java deleted file mode 100644 index c2c4775e9bc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/ColorModel.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for ColorModel. - */ -public final class ColorModel extends ExpandableStringEnum { - /** - * Static value Red for ColorModel. - */ - @Generated - public static final ColorModel RED = fromString("Red"); - - /** - * Static value Blue for ColorModel. - */ - @Generated - public static final ColorModel BLUE = fromString("Blue"); - - /** - * Static value Green for ColorModel. - */ - @Generated - public static final ColorModel GREEN = fromString("Green"); - - /** - * Creates a new instance of ColorModel value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public ColorModel() { - } - - /** - * Creates or finds a ColorModel from its string representation. - * - * @param name a name to look for. - * @return the corresponding ColorModel. - */ - @Generated - public static ColorModel fromString(String name) { - return fromString(name, ColorModel.class); - } - - /** - * Gets known ColorModel values. - * - * @return known ColorModel values. - */ - @Generated - public static Collection values() { - return values(ColorModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/package-info.java deleted file mode 100644 index 207cacf666a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Internal. - * - */ -package tsptest.internal.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/package-info.java deleted file mode 100644 index 1425143c5c8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Internal. - * - */ -package tsptest.internal.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiRequest.java deleted file mode 100644 index b326e0d7dbd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ApiRequest model. - */ -@Immutable -public final class ApiRequest implements JsonSerializable { - /* - * The property property. - */ - @Generated - private final RequestInner property; - - /** - * Creates an instance of ApiRequest class. - * - * @param property the property value to set. - */ - @Generated - public ApiRequest(RequestInner property) { - this.property = property; - } - - /** - * Get the property property: The property property. - * - * @return the property value. - */ - @Generated - public RequestInner getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ApiRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ApiRequest if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ApiRequest. - */ - @Generated - public static ApiRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - RequestInner property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = RequestInner.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new ApiRequest(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiResponse.java deleted file mode 100644 index 79328cadf44..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiResponse.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ApiResponse model. - */ -@Immutable -public final class ApiResponse implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of ApiResponse class. - * - * @param name the name value to set. - */ - @Generated - private ApiResponse(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ApiResponse from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ApiResponse if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ApiResponse. - */ - @Generated - public static ApiResponse fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ApiResponse(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/RequestInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/RequestInner.java deleted file mode 100644 index 46ab385e2c7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/RequestInner.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The RequestInner model. - */ -@Immutable -public final class RequestInner implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of RequestInner class. - * - * @param name the name value to set. - */ - @Generated - public RequestInner(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of RequestInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of RequestInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the RequestInner. - */ - @Generated - public static RequestInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new RequestInner(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternal.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternal.java deleted file mode 100644 index 9fe25735f6f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternal.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ResponseInternal model. - */ -@Immutable -public final class ResponseInternal implements JsonSerializable { - /* - * The property property. - */ - @Generated - private final ResponseInternalInner property; - - /** - * Creates an instance of ResponseInternal class. - * - * @param property the property value to set. - */ - @Generated - private ResponseInternal(ResponseInternalInner property) { - this.property = property; - } - - /** - * Get the property property: The property property. - * - * @return the property value. - */ - @Generated - public ResponseInternalInner getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResponseInternal from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResponseInternal if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResponseInternal. - */ - @Generated - public static ResponseInternal fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ResponseInternalInner property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = ResponseInternalInner.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new ResponseInternal(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternalInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternalInner.java deleted file mode 100644 index 70b13fa6a22..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternalInner.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ResponseInternalInner model. - */ -@Immutable -public final class ResponseInternalInner implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of ResponseInternalInner class. - * - * @param name the name value to set. - */ - @Generated - private ResponseInternalInner(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResponseInternalInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResponseInternalInner if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResponseInternalInner. - */ - @Generated - public static ResponseInternalInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ResponseInternalInner(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneData.java deleted file mode 100644 index 7b8157a139c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneData.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The StandAloneData model. - */ -@Immutable -public final class StandAloneData implements JsonSerializable { - /* - * The property property. - */ - @Generated - private final StandAloneDataInner property; - - /** - * Creates an instance of StandAloneData class. - * - * @param property the property value to set. - */ - @Generated - private StandAloneData(StandAloneDataInner property) { - this.property = property; - } - - /** - * Get the property property: The property property. - * - * @return the property value. - */ - @Generated - public StandAloneDataInner getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of StandAloneData from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of StandAloneData if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the StandAloneData. - */ - @Generated - public static StandAloneData fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - StandAloneDataInner property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = StandAloneDataInner.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new StandAloneData(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneDataInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneDataInner.java deleted file mode 100644 index 963e9bc660b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneDataInner.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The StandAloneDataInner model. - */ -@Immutable -public final class StandAloneDataInner implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of StandAloneDataInner class. - * - * @param name the name value to set. - */ - @Generated - public StandAloneDataInner(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of StandAloneDataInner from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of StandAloneDataInner if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the StandAloneDataInner. - */ - @Generated - public static StandAloneDataInner fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new StandAloneDataInner(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/UnusedEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/UnusedEnum.java deleted file mode 100644 index 4c570593e38..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/UnusedEnum.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for UnusedEnum. - */ -public final class UnusedEnum extends ExpandableStringEnum { - /** - * Static value Weekday for UnusedEnum. - */ - @Generated - public static final UnusedEnum WEEKDAY = fromString("Weekday"); - - /** - * Static value Weekend for UnusedEnum. - */ - @Generated - public static final UnusedEnum WEEKEND = fromString("Weekend"); - - /** - * Creates a new instance of UnusedEnum value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public UnusedEnum() { - } - - /** - * Creates or finds a UnusedEnum from its string representation. - * - * @param name a name to look for. - * @return the corresponding UnusedEnum. - */ - @Generated - public static UnusedEnum fromString(String name) { - return fromString(name, UnusedEnum.class); - } - - /** - * Gets known UnusedEnum values. - * - * @return known UnusedEnum values. - */ - @Generated - public static Collection values() { - return values(UnusedEnum.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/package-info.java deleted file mode 100644 index 7dc72139b17..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Internal. - * - */ -package tsptest.internal.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/package-info.java deleted file mode 100644 index 96b804dfd10..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Internal. - * - */ -package tsptest.internal; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceAsyncClient.java deleted file mode 100644 index eb1a0778eaa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceAsyncClient.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.literalservice; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.literalservice.implementation.LiteralOpsImpl; -import tsptest.literalservice.models.Model; -import tsptest.literalservice.models.PutRequestOptionalLiteralParam; - -/** - * Initializes a new instance of the asynchronous LiteralServiceClient type. - */ -@ServiceClient(builder = LiteralServiceClientBuilder.class, isAsync = true) -public final class LiteralServiceAsyncClient { - @Generated - private final LiteralOpsImpl serviceClient; - - /** - * Initializes an instance of LiteralServiceAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - LiteralServiceAsyncClient(LiteralOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The put operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
optionalLiteralParamStringNoThe optionalLiteralParam parameter. Allowed - * values: "optionalLiteralParam".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     literal: String (Required)
-     *     optionalLiteral: String(optionalLiteral) (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     literal: String (Required)
-     *     optionalLiteral: String(optionalLiteral) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @param optionalLiteralParam The optionalLiteralParam parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Model body, PutRequestOptionalLiteralParam optionalLiteralParam) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (optionalLiteralParam != null) { - requestOptions.addQueryParam("optionalLiteralParam", optionalLiteralParam.toString(), false); - } - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Model.class)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Model body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Model.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClient.java deleted file mode 100644 index 75ff2aacc58..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClient.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.literalservice; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.literalservice.implementation.LiteralOpsImpl; -import tsptest.literalservice.models.Model; -import tsptest.literalservice.models.PutRequestOptionalLiteralParam; - -/** - * Initializes a new instance of the synchronous LiteralServiceClient type. - */ -@ServiceClient(builder = LiteralServiceClientBuilder.class) -public final class LiteralServiceClient { - @Generated - private final LiteralOpsImpl serviceClient; - - /** - * Initializes an instance of LiteralServiceClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - LiteralServiceClient(LiteralOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The put operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
optionalLiteralParamStringNoThe optionalLiteralParam parameter. Allowed - * values: "optionalLiteralParam".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     literal: String (Required)
-     *     optionalLiteral: String(optionalLiteral) (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     literal: String (Required)
-     *     optionalLiteral: String(optionalLiteral) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @param optionalLiteralParam The optionalLiteralParam parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Model put(Model body, PutRequestOptionalLiteralParam optionalLiteralParam) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (optionalLiteralParam != null) { - requestOptions.addQueryParam("optionalLiteralParam", optionalLiteralParam.toString(), false); - } - return putWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(Model.class); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Model put(Model body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(Model.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClientBuilder.java deleted file mode 100644 index e3ff46af1ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.literalservice; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.literalservice.implementation.LiteralServiceClientImpl; - -/** - * A builder for creating a new instance of the LiteralServiceClient type. - */ -@ServiceClientBuilder(serviceClients = { LiteralServiceClient.class, LiteralServiceAsyncClient.class }) -public final class LiteralServiceClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-literalservice.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the LiteralServiceClientBuilder. - */ - @Generated - public LiteralServiceClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LiteralServiceClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LiteralServiceClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LiteralServiceClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LiteralServiceClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LiteralServiceClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LiteralServiceClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LiteralServiceClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LiteralServiceClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the LiteralServiceClientBuilder. - */ - @Generated - public LiteralServiceClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of LiteralServiceClientImpl with the provided parameters. - * - * @return an instance of LiteralServiceClientImpl. - */ - @Generated - private LiteralServiceClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - LiteralServiceClientImpl client = new LiteralServiceClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of LiteralServiceAsyncClient class. - * - * @return an instance of LiteralServiceAsyncClient. - */ - @Generated - public LiteralServiceAsyncClient buildAsyncClient() { - return new LiteralServiceAsyncClient(buildInnerClient().getLiteralOps()); - } - - /** - * Builds an instance of LiteralServiceClient class. - * - * @return an instance of LiteralServiceClient. - */ - @Generated - public LiteralServiceClient buildClient() { - return new LiteralServiceClient(buildInnerClient().getLiteralOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(LiteralServiceClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralOpsImpl.java deleted file mode 100644 index b6bcb81fce3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralOpsImpl.java +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.literalservice.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in LiteralOps. - */ -public final class LiteralOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final LiteralOpsService service; - - /** - * The service client containing this operation class. - */ - private final LiteralServiceClientImpl client; - - /** - * Initializes an instance of LiteralOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - LiteralOpsImpl(LiteralServiceClientImpl client) { - this.service - = RestProxy.create(LiteralOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for LiteralServiceClientLiteralOps to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "LiteralServiceClientLiteralOps") - public interface LiteralOpsService { - @Put("/literal/put") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @QueryParam("literalParam") String literalParam, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/literal/put") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, - @QueryParam("literalParam") String literalParam, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The put operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
optionalLiteralParamStringNoThe optionalLiteralParam parameter. Allowed - * values: "optionalLiteralParam".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     literal: String (Required)
-     *     optionalLiteral: String(optionalLiteral) (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     literal: String (Required)
-     *     optionalLiteral: String(optionalLiteral) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String literalParam = "literalParam"; - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.put(this.client.getEndpoint(), literalParam, contentType, accept, - body, requestOptions, context)); - } - - /** - * The put operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
optionalLiteralParamStringNoThe optionalLiteralParam parameter. Allowed - * values: "optionalLiteralParam".
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     literal: String (Required)
-     *     optionalLiteral: String(optionalLiteral) (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     literal: String (Required)
-     *     optionalLiteral: String(optionalLiteral) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String literalParam = "literalParam"; - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putSync(this.client.getEndpoint(), literalParam, contentType, accept, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralServiceClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralServiceClientImpl.java deleted file mode 100644 index 6ff79e5eded..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralServiceClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.literalservice.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 LiteralServiceClient type. - */ -public final class LiteralServiceClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 LiteralOpsImpl object to access its operations. - */ - private final LiteralOpsImpl literalOps; - - /** - * Gets the LiteralOpsImpl object to access its operations. - * - * @return the LiteralOpsImpl object. - */ - public LiteralOpsImpl getLiteralOps() { - return this.literalOps; - } - - /** - * Initializes an instance of LiteralServiceClient client. - * - * @param endpoint Service host. - */ - public LiteralServiceClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of LiteralServiceClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public LiteralServiceClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of LiteralServiceClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public LiteralServiceClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.literalOps = new LiteralOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/package-info.java deleted file mode 100644 index 476313ade5e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for LiteralService. - * - */ -package tsptest.literalservice.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/Model.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/Model.java deleted file mode 100644 index d43ed2de5c3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/Model.java +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.literalservice.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Model model. - */ -@Fluent -public final class Model implements JsonSerializable { - /* - * The literal property. - */ - @Generated - private final String literal = "literal"; - - /* - * The optionalLiteral property. - */ - @Generated - private ModelOptionalLiteral optionalLiteral; - - /** - * Creates an instance of Model class. - */ - @Generated - public Model() { - } - - /** - * Get the literal property: The literal property. - * - * @return the literal value. - */ - @Generated - public String getLiteral() { - return this.literal; - } - - /** - * Get the optionalLiteral property: The optionalLiteral property. - * - * @return the optionalLiteral value. - */ - @Generated - public ModelOptionalLiteral getOptionalLiteral() { - return this.optionalLiteral; - } - - /** - * Set the optionalLiteral property: The optionalLiteral property. - * - * @param optionalLiteral the optionalLiteral value to set. - * @return the Model object itself. - */ - @Generated - public Model setOptionalLiteral(ModelOptionalLiteral optionalLiteral) { - this.optionalLiteral = optionalLiteral; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("literal", this.literal); - jsonWriter.writeStringField("optionalLiteral", - this.optionalLiteral == null ? null : this.optionalLiteral.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Model from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Model if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Model. - */ - @Generated - public static Model fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Model deserializedModel = new Model(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("optionalLiteral".equals(fieldName)) { - deserializedModel.optionalLiteral = ModelOptionalLiteral.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/ModelOptionalLiteral.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/ModelOptionalLiteral.java deleted file mode 100644 index eef2eb09faa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/ModelOptionalLiteral.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.literalservice.models; - -/** - * Defines values for ModelOptionalLiteral. - */ -public enum ModelOptionalLiteral { - /** - * Enum value optionalLiteral. - */ - OPTIONAL_LITERAL("optionalLiteral"); - - /** - * The actual serialized value for a ModelOptionalLiteral instance. - */ - private final String value; - - ModelOptionalLiteral(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a ModelOptionalLiteral instance. - * - * @param value the serialized value to parse. - * @return the parsed ModelOptionalLiteral object, or null if unable to parse. - */ - public static ModelOptionalLiteral fromString(String value) { - if (value == null) { - return null; - } - ModelOptionalLiteral[] items = ModelOptionalLiteral.values(); - for (ModelOptionalLiteral item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/PutRequestOptionalLiteralParam.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/PutRequestOptionalLiteralParam.java deleted file mode 100644 index cb7a97ebb06..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/PutRequestOptionalLiteralParam.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.literalservice.models; - -/** - * Defines values for PutRequestOptionalLiteralParam. - */ -public enum PutRequestOptionalLiteralParam { - /** - * Enum value optionalLiteralParam. - */ - OPTIONAL_LITERAL_PARAM("optionalLiteralParam"); - - /** - * The actual serialized value for a PutRequestOptionalLiteralParam instance. - */ - private final String value; - - PutRequestOptionalLiteralParam(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a PutRequestOptionalLiteralParam instance. - * - * @param value the serialized value to parse. - * @return the parsed PutRequestOptionalLiteralParam object, or null if unable to parse. - */ - public static PutRequestOptionalLiteralParam fromString(String value) { - if (value == null) { - return null; - } - PutRequestOptionalLiteralParam[] items = PutRequestOptionalLiteralParam.values(); - for (PutRequestOptionalLiteralParam item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/package-info.java deleted file mode 100644 index da89123155d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for LiteralService. - * - */ -package tsptest.literalservice.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/package-info.java deleted file mode 100644 index 585a4c7d317..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for LiteralService. - * - */ -package tsptest.literalservice; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningAsyncClient.java deleted file mode 100644 index 83b4583935e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningAsyncClient.java +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import reactor.core.publisher.Mono; -import tsptest.longrunning.implementation.LongRunningClientImpl; -import tsptest.longrunning.models.JobData; -import tsptest.longrunning.models.JobResult; -import tsptest.longrunning.models.JobResultResult; -import tsptest.longrunning.models.PollResponse; - -/** - * Initializes a new instance of the asynchronous LongRunningClient type. - */ -@ServiceClient(builder = LongRunningClientBuilder.class, isAsync = true) -public final class LongRunningAsyncClient { - @Generated - private final LongRunningClientImpl serviceClient; - - /** - * Initializes an instance of LongRunningAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - LongRunningAsyncClient(LongRunningClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The longRunning operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLongRunning(RequestOptions requestOptions) { - return this.serviceClient.beginLongRunningAsync(requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     expirationDateTime: OffsetDateTime (Optional)
-     *     lastUpdateDateTime: OffsetDateTime (Optional)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getJobWithResponse(String id, RequestOptions requestOptions) { - return this.serviceClient.getJobWithResponseAsync(id, requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     configuration: String (Optional)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     expirationDateTime: OffsetDateTime (Optional)
-     *     lastUpdateDateTime: OffsetDateTime (Optional)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateJob(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.beginCreateJobAsync(body, requestOptions); - } - - /** - * The longRunning operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLongRunning() { - // Generated convenience method for beginLongRunningWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginLongRunningWithModelAsync(requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param id The id parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getJob(String id) { - // Generated convenience method for getJobWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getJobWithResponse(id, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(JobResult.class)); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateJob(JobData body) { - // Generated convenience method for beginCreateJobWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginCreateJobWithModelAsync(BinaryData.fromObject(body), requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClient.java deleted file mode 100644 index f7c32401a8c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClient.java +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.SyncPoller; -import tsptest.longrunning.implementation.LongRunningClientImpl; -import tsptest.longrunning.models.JobData; -import tsptest.longrunning.models.JobResult; -import tsptest.longrunning.models.JobResultResult; -import tsptest.longrunning.models.PollResponse; - -/** - * Initializes a new instance of the synchronous LongRunningClient type. - */ -@ServiceClient(builder = LongRunningClientBuilder.class) -public final class LongRunningClient { - @Generated - private final LongRunningClientImpl serviceClient; - - /** - * Initializes an instance of LongRunningClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - LongRunningClient(LongRunningClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The longRunning operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLongRunning(RequestOptions requestOptions) { - return this.serviceClient.beginLongRunning(requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     expirationDateTime: OffsetDateTime (Optional)
-     *     lastUpdateDateTime: OffsetDateTime (Optional)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getJobWithResponse(String id, RequestOptions requestOptions) { - return this.serviceClient.getJobWithResponse(id, requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     configuration: String (Optional)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     expirationDateTime: OffsetDateTime (Optional)
-     *     lastUpdateDateTime: OffsetDateTime (Optional)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateJob(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.beginCreateJob(body, requestOptions); - } - - /** - * The longRunning operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLongRunning() { - // Generated convenience method for beginLongRunningWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginLongRunningWithModel(requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param id The id parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public JobResult getJob(String id) { - // Generated convenience method for getJobWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getJobWithResponse(id, requestOptions).getValue().toObject(JobResult.class); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateJob(JobData body) { - // Generated convenience method for beginCreateJobWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginCreateJobWithModel(BinaryData.fromObject(body), requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClientBuilder.java deleted file mode 100644 index 48832179766..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.longrunning.implementation.LongRunningClientImpl; - -/** - * A builder for creating a new instance of the LongRunningClient type. - */ -@ServiceClientBuilder(serviceClients = { LongRunningClient.class, LongRunningAsyncClient.class }) -public final class LongRunningClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-longrunning.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the LongRunningClientBuilder. - */ - @Generated - public LongRunningClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LongRunningClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LongRunningClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LongRunningClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LongRunningClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LongRunningClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LongRunningClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LongRunningClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public LongRunningClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private LongRunningServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the LongRunningClientBuilder. - */ - @Generated - public LongRunningClientBuilder serviceVersion(LongRunningServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the LongRunningClientBuilder. - */ - @Generated - public LongRunningClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of LongRunningClientImpl with the provided parameters. - * - * @return an instance of LongRunningClientImpl. - */ - @Generated - private LongRunningClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - LongRunningServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : LongRunningServiceVersion.getLatest(); - LongRunningClientImpl client = new LongRunningClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of LongRunningAsyncClient class. - * - * @return an instance of LongRunningAsyncClient. - */ - @Generated - public LongRunningAsyncClient buildAsyncClient() { - return new LongRunningAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of LongRunningClient class. - * - * @return an instance of LongRunningClient. - */ - @Generated - public LongRunningClient buildClient() { - return new LongRunningClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(LongRunningClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningServiceVersion.java deleted file mode 100644 index e72016bd01b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of LongRunningClient. - */ -public enum LongRunningServiceVersion implements ServiceVersion { - /** - * Enum value 2022-06-01-preview. - */ - V2022_06_01_PREVIEW("2022-06-01-preview"); - - private final String version; - - LongRunningServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link LongRunningServiceVersion}. - */ - public static LongRunningServiceVersion getLatest() { - return V2022_06_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/LongRunningClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/LongRunningClientImpl.java deleted file mode 100644 index 735f725ed6a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/LongRunningClientImpl.java +++ /dev/null @@ -1,880 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.DefaultPollingStrategy; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncDefaultPollingStrategy; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; -import tsptest.longrunning.LongRunningServiceVersion; -import tsptest.longrunning.models.JobResult; -import tsptest.longrunning.models.JobResultResult; -import tsptest.longrunning.models.PollResponse; - -/** - * Initializes a new instance of the LongRunningClient type. - */ -public final class LongRunningClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final LongRunningClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final LongRunningServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public LongRunningServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of LongRunningClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public LongRunningClientImpl(String endpoint, LongRunningServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of LongRunningClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public LongRunningClientImpl(HttpPipeline httpPipeline, String endpoint, LongRunningServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of LongRunningClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public LongRunningClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - LongRunningServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(LongRunningClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for LongRunningClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "LongRunningClient") - public interface LongRunningClientService { - @Post("/long-running/post") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> longRunning(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Post("/long-running/post") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response longRunningSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/long-running/jobs/{id}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getJob(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") String id, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/long-running/jobs/{id}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getJobSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("id") String id, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/long-running/jobs") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createJob(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/long-running/jobs") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createJobSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The longRunning operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> longRunningWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.longRunning(this.getEndpoint(), requestOptions, context)); - } - - /** - * The longRunning operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response longRunningWithResponse(RequestOptions requestOptions) { - return service.longRunningSync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The longRunning operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLongRunningWithModelAsync(RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), () -> this.longRunningWithResponseAsync(requestOptions), - new DefaultPollingStrategy<>(new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE)), - TypeReference.createInstance(PollResponse.class), TypeReference.createInstance(Void.class)); - } - - /** - * The longRunning operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLongRunningWithModel(RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.longRunningWithResponse(requestOptions), - new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE)), - TypeReference.createInstance(PollResponse.class), TypeReference.createInstance(Void.class)); - } - - /** - * The longRunning operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLongRunningAsync(RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), () -> this.longRunningWithResponseAsync(requestOptions), - new DefaultPollingStrategy<>(new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE)), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * The longRunning operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLongRunning(RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.longRunningWithResponse(requestOptions), - new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE)), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * A remote procedure call (RPC) operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     expirationDateTime: OffsetDateTime (Optional)
-     *     lastUpdateDateTime: OffsetDateTime (Optional)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getJobWithResponseAsync(String id, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getJob(this.getEndpoint(), this.getServiceVersion().getVersion(), - id, accept, requestOptions, context)); - } - - /** - * A remote procedure call (RPC) operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     expirationDateTime: OffsetDateTime (Optional)
-     *     lastUpdateDateTime: OffsetDateTime (Optional)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getJobWithResponse(String id, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getJobSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, accept, requestOptions, - Context.NONE); - } - - /** - * A remote procedure call (RPC) operation. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     configuration: String (Optional)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     expirationDateTime: OffsetDateTime (Optional)
-     *     lastUpdateDateTime: OffsetDateTime (Optional)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createJobWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); - } - }); - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-first-sent"), - DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); - } - }); - return FluxUtil.withContext(context -> service.createJob(this.getEndpoint(), - this.getServiceVersion().getVersion(), contentType, accept, body, requestOptionsLocal, context)); - } - - /** - * A remote procedure call (RPC) operation. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     configuration: String (Optional)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     expirationDateTime: OffsetDateTime (Optional)
-     *     lastUpdateDateTime: OffsetDateTime (Optional)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createJobWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); - } - }); - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-first-sent"), - DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); - } - }); - return service.createJobSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, - body, requestOptionsLocal, Context.NONE); - } - - /** - * A remote procedure call (RPC) operation. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     configuration: String (Optional)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     expirationDateTime: OffsetDateTime (Optional)
-     *     lastUpdateDateTime: OffsetDateTime (Optional)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateJobWithModelAsync(BinaryData body, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), () -> this.createJobWithResponseAsync(body, requestOptions), - new tsptest.longrunning.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(JobResult.class), TypeReference.createInstance(JobResultResult.class)); - } - - /** - * A remote procedure call (RPC) operation. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     configuration: String (Optional)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     expirationDateTime: OffsetDateTime (Optional)
-     *     lastUpdateDateTime: OffsetDateTime (Optional)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateJobWithModel(BinaryData body, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.createJobWithResponse(body, requestOptions), - new tsptest.longrunning.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(JobResult.class), TypeReference.createInstance(JobResultResult.class)); - } - - /** - * A remote procedure call (RPC) operation. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     configuration: String (Optional)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     expirationDateTime: OffsetDateTime (Optional)
-     *     lastUpdateDateTime: OffsetDateTime (Optional)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateJobAsync(BinaryData body, RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), () -> this.createJobWithResponseAsync(body, requestOptions), - new tsptest.longrunning.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * A remote procedure call (RPC) operation. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     configuration: String (Optional)
-     *     nullableFloatDict (Required): {
-     *         String: Double (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
-     *     createdDateTime: OffsetDateTime (Optional)
-     *     expirationDateTime: OffsetDateTime (Optional)
-     *     lastUpdateDateTime: OffsetDateTime (Optional)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateJob(BinaryData body, RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.createJobWithResponse(body, requestOptions), - new tsptest.longrunning.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/OperationLocationPollingStrategy.java deleted file mode 100644 index 235d597dd72..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/OperationLocationPollingStrategy.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.OperationResourcePollingStrategy; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -/** - * Implements an operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public Mono> onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - final Mono> pollResponseMono - = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) - .onErrorResume(exception -> { - LOGGER.info("Failed to parse initial response."); - return Mono.empty(); - }) - .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); - return pollResponseMono.switchIfEmpty( - Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); - } else { - return Mono - .error( - new AzureException(String.format( - "Operation failed or cancelled with status code %d," - + ", '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - } - - /** - * {@inheritDoc} - */ - @Override - public Mono getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - return Mono.error(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - return Mono.error(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - return PollingUtils - .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) - .flatMap(value -> { - if (value.get(propertyName) != null) { - return BinaryData.fromObjectAsync(value.get(propertyName)) - .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); - } else { - return Mono.error(new AzureException("Cannot get final result")); - } - }) - .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/PollingUtils.java deleted file mode 100644 index 3f3bcb9438c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/PollingUtils.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.implementation; - -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.BinaryData; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.net.URI; -import java.net.URISyntaxException; -import java.time.DateTimeException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.time.temporal.ChronoUnit; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -final class PollingUtils { - - public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE - = new TypeReference>() { - }; - - public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); - - public static final String HTTP_METHOD = "httpMethod"; - public static final String REQUEST_URL = "requestURL"; - public static final String POLL_RESPONSE_BODY = "pollResponseBody"; - - private static final String FORWARD_SLASH = "/"; - - public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { - try { - URI uri = new URI(path); - if (!uri.isAbsolute()) { - if (CoreUtils.isNullOrEmpty(endpoint)) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); - } - - if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { - return endpoint + path.substring(1); - } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { - return endpoint + FORWARD_SLASH + path; - } else { - return endpoint + path; - } - } - } catch (URISyntaxException ex) { - throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); - } - return path; - } - - public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - T value; - if (binaryData == null) { - value = null; - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); - } else { - value = binaryData.toObject(typeReference, serializer); - } - return value; - } - - @SuppressWarnings("unchecked") - public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - Mono value; - if (binaryData == null) { - value = Mono.empty(); - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = (Mono) binaryData.toReplayableBinaryDataAsync(); - } else { - value = binaryData.toObjectAsync(typeReference, serializer); - } - return value; - } - - private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); - private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); - - public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { - // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. - Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. - retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then - // attempt to resolve it as an HTTP date (RFC1123). - retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, - headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); - - // Either the retry delay will have been found or it'll be null, null indicates no retry after. - return retryDelay; - } - - private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, - Function delayParser) { - String headerValue = headers.getValue(headerName); - - return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); - } - - private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { - long delaySeconds; - try { - OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); - - delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); - } catch (DateTimeException ex) { - delaySeconds = tryParseLong(value); - } - - return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; - } - - private static long tryParseLong(String value) { - try { - return Long.parseLong(value); - } catch (NumberFormatException ex) { - return -1; - } - } - - private static Duration tryGetDelayMillis(String value) { - long delayMillis = tryParseLong(value); - return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/SyncOperationLocationPollingStrategy.java deleted file mode 100644 index d3bd8e98176..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/SyncOperationLocationPollingStrategy.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.io.UncheckedIOException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Map; - -// DO NOT modify this helper class - -/** - * Implements a synchronous operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public PollResponse onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - T initialResponseType = null; - try { - initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, - pollResponseType); - } catch (UncheckedIOException e) { - LOGGER.info("Failed to parse initial response."); - } - return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); - } - - throw LOGGER.logExceptionAsError(new AzureException( - String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - - /** - * {@inheritDoc} - */ - public U getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, - PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); - if (pollResult != null && pollResult.get(propertyName) != null) { - return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), - serializer, resultType); - } else { - throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); - } - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/package-info.java deleted file mode 100644 index ed38e6d5925..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for LongRunning. - * - */ -package tsptest.longrunning.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobData.java deleted file mode 100644 index 162c3f3ffa1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobData.java +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * The JobData model. - */ -@Fluent -public final class JobData implements JsonSerializable { - /* - * The configuration property. - */ - @Generated - private String configuration; - - /* - * The nullableFloatDict property. - */ - @Generated - private final Map nullableFloatDict; - - /** - * Creates an instance of JobData class. - * - * @param nullableFloatDict the nullableFloatDict value to set. - */ - @Generated - public JobData(Map nullableFloatDict) { - this.nullableFloatDict = nullableFloatDict; - } - - /** - * Get the configuration property: The configuration property. - * - * @return the configuration value. - */ - @Generated - public String getConfiguration() { - return this.configuration; - } - - /** - * Set the configuration property: The configuration property. - * - * @param configuration the configuration value to set. - * @return the JobData object itself. - */ - @Generated - public JobData setConfiguration(String configuration) { - this.configuration = configuration; - return this; - } - - /** - * Get the nullableFloatDict property: The nullableFloatDict property. - * - * @return the nullableFloatDict value. - */ - @Generated - public Map getNullableFloatDict() { - return this.nullableFloatDict; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeMapField("nullableFloatDict", this.nullableFloatDict, - (writer, element) -> writer.writeNumber(element)); - jsonWriter.writeStringField("configuration", this.configuration); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of JobData from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of JobData if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the JobData. - */ - @Generated - public static JobData fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Map nullableFloatDict = null; - String configuration = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("nullableFloatDict".equals(fieldName)) { - nullableFloatDict = reader.readMap(reader1 -> reader1.getNullable(JsonReader::getDouble)); - } else if ("configuration".equals(fieldName)) { - configuration = reader.getString(); - } else { - reader.skipChildren(); - } - } - JobData deserializedJobData = new JobData(nullableFloatDict); - deserializedJobData.configuration = configuration; - - return deserializedJobData; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResult.java deleted file mode 100644 index 47f55c61f89..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResult.java +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.models.ResponseError; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; - -/** - * The JobResult model. - */ -@Immutable -public final class JobResult implements JsonSerializable { - /* - * The id property. - */ - @Generated - private String id; - - /* - * The status property. - */ - @Generated - private JobStatus status; - - /* - * The createdDateTime property. - */ - @Generated - private OffsetDateTime createdDateTime; - - /* - * The expirationDateTime property. - */ - @Generated - private OffsetDateTime expirationDateTime; - - /* - * The lastUpdateDateTime property. - */ - @Generated - private OffsetDateTime lastUpdateDateTime; - - /* - * The error property. - */ - @Generated - private ResponseError error; - - /* - * The result property. - */ - @Generated - private JobResultResult result; - - /** - * Creates an instance of JobResult class. - */ - @Generated - private JobResult() { - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the status property: The status property. - * - * @return the status value. - */ - @Generated - public JobStatus getStatus() { - return this.status; - } - - /** - * Get the createdDateTime property: The createdDateTime property. - * - * @return the createdDateTime value. - */ - @Generated - public OffsetDateTime getCreatedDateTime() { - return this.createdDateTime; - } - - /** - * Get the expirationDateTime property: The expirationDateTime property. - * - * @return the expirationDateTime value. - */ - @Generated - public OffsetDateTime getExpirationDateTime() { - return this.expirationDateTime; - } - - /** - * Get the lastUpdateDateTime property: The lastUpdateDateTime property. - * - * @return the lastUpdateDateTime value. - */ - @Generated - public OffsetDateTime getLastUpdateDateTime() { - return this.lastUpdateDateTime; - } - - /** - * Get the error property: The error property. - * - * @return the error value. - */ - @Generated - public ResponseError getError() { - return this.error; - } - - /** - * Get the result property: The result property. - * - * @return the result value. - */ - @Generated - public JobResultResult getResult() { - return this.result; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("error", this.error); - jsonWriter.writeJsonField("result", this.result); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of JobResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of JobResult if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the JobResult. - */ - @Generated - public static JobResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - JobResult deserializedJobResult = new JobResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedJobResult.id = reader.getString(); - } else if ("status".equals(fieldName)) { - deserializedJobResult.status = JobStatus.fromString(reader.getString()); - } else if ("createdDateTime".equals(fieldName)) { - deserializedJobResult.createdDateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("expirationDateTime".equals(fieldName)) { - deserializedJobResult.expirationDateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("lastUpdateDateTime".equals(fieldName)) { - deserializedJobResult.lastUpdateDateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("error".equals(fieldName)) { - deserializedJobResult.error = ResponseError.fromJson(reader); - } else if ("result".equals(fieldName)) { - deserializedJobResult.result = JobResultResult.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedJobResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResultResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResultResult.java deleted file mode 100644 index 7d78e39f6f5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResultResult.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The JobResultResult model. - */ -@Immutable -public final class JobResultResult implements JsonSerializable { - /* - * The data property. - */ - @Generated - private final String data; - - /** - * Creates an instance of JobResultResult class. - * - * @param data the data value to set. - */ - @Generated - private JobResultResult(String data) { - this.data = data; - } - - /** - * Get the data property: The data property. - * - * @return the data value. - */ - @Generated - public String getData() { - return this.data; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("data", this.data); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of JobResultResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of JobResultResult if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the JobResultResult. - */ - @Generated - public static JobResultResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String data = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("data".equals(fieldName)) { - data = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new JobResultResult(data); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobStatus.java deleted file mode 100644 index 94c93571c52..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobStatus.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for JobStatus. - */ -public final class JobStatus extends ExpandableStringEnum { - /** - * Static value notStarted for JobStatus. - */ - @Generated - public static final JobStatus NOT_STARTED = fromString("notStarted"); - - /** - * Static value running for JobStatus. - */ - @Generated - public static final JobStatus RUNNING = fromString("running"); - - /** - * Static value Succeeded for JobStatus. - */ - @Generated - public static final JobStatus SUCCEEDED = fromString("Succeeded"); - - /** - * Static value Failed for JobStatus. - */ - @Generated - public static final JobStatus FAILED = fromString("Failed"); - - /** - * Static value canceled for JobStatus. - */ - @Generated - public static final JobStatus CANCELED = fromString("canceled"); - - /** - * Creates a new instance of JobStatus value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public JobStatus() { - } - - /** - * Creates or finds a JobStatus from its string representation. - * - * @param name a name to look for. - * @return the corresponding JobStatus. - */ - @Generated - public static JobStatus fromString(String name) { - return fromString(name, JobStatus.class); - } - - /** - * Gets known JobStatus values. - * - * @return known JobStatus values. - */ - @Generated - public static Collection values() { - return values(JobStatus.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/OperationState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/OperationState.java deleted file mode 100644 index 441a3282a85..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/OperationState.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Enum describing allowed operation states. - */ -public final class OperationState extends ExpandableStringEnum { - /** - * The operation has not started. - */ - @Generated - public static final OperationState NOT_STARTED = fromString("NotStarted"); - - /** - * The operation is in progress. - */ - @Generated - public static final OperationState RUNNING = fromString("Running"); - - /** - * The operation has completed successfully. - */ - @Generated - public static final OperationState SUCCEEDED = fromString("Succeeded"); - - /** - * The operation has failed. - */ - @Generated - public static final OperationState FAILED = fromString("Failed"); - - /** - * The operation has been canceled by the user. - */ - @Generated - public static final OperationState CANCELED = fromString("Canceled"); - - /** - * Creates a new instance of OperationState value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public OperationState() { - } - - /** - * Creates or finds a OperationState from its string representation. - * - * @param name a name to look for. - * @return the corresponding OperationState. - */ - @Generated - public static OperationState fromString(String name) { - return fromString(name, OperationState.class); - } - - /** - * Gets known OperationState values. - * - * @return known OperationState values. - */ - @Generated - public static Collection values() { - return values(OperationState.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/PollResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/PollResponse.java deleted file mode 100644 index c8e9bd9f5f9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/PollResponse.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The PollResponse model. - */ -@Immutable -public final class PollResponse implements JsonSerializable { - /* - * The operationId property. - */ - @Generated - private final String operationId; - - /* - * The status property. - */ - @Generated - private final OperationState status; - - /** - * Creates an instance of PollResponse class. - * - * @param operationId the operationId value to set. - * @param status the status value to set. - */ - @Generated - private PollResponse(String operationId, OperationState status) { - this.operationId = operationId; - this.status = status; - } - - /** - * Get the operationId property: The operationId property. - * - * @return the operationId value. - */ - @Generated - public String getOperationId() { - return this.operationId; - } - - /** - * Get the status property: The status property. - * - * @return the status value. - */ - @Generated - public OperationState getStatus() { - return this.status; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("operationId", this.operationId); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PollResponse from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PollResponse if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the PollResponse. - */ - @Generated - public static PollResponse fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String operationId = null; - OperationState status = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("operationId".equals(fieldName)) { - operationId = reader.getString(); - } else if ("status".equals(fieldName)) { - status = OperationState.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new PollResponse(operationId, status); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/package-info.java deleted file mode 100644 index 900f23037a0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for LongRunning. - * - */ -package tsptest.longrunning.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/package-info.java deleted file mode 100644 index 009f0efc041..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for LongRunning. - * - */ -package tsptest.longrunning; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java deleted file mode 100644 index ad44bbc0867..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java +++ /dev/null @@ -1,585 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.RequestConditions; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.FluxUtil; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; -import tsptest.methodoverride.implementation.MethodOverrideClientImpl; -import tsptest.methodoverride.implementation.models.GroupAllRequest; -import tsptest.methodoverride.implementation.models.GroupNoneRequest; -import tsptest.methodoverride.implementation.models.GroupPartETagRequest; -import tsptest.methodoverride.implementation.models.GroupPartRequest; -import tsptest.methodoverride.models.GroupAllOptions; -import tsptest.methodoverride.models.GroupExcludeBodyModel; -import tsptest.methodoverride.models.GroupPartETagOptions; -import tsptest.methodoverride.models.GroupPartOptions; -import tsptest.methodoverride.models.GroupQueryOptions; - -/** - * Initializes a new instance of the asynchronous MethodOverrideClient type. - */ -@ServiceClient(builder = MethodOverrideClientBuilder.class, isAsync = true) -public final class MethodOverrideAsyncClient { - @Generated - private final MethodOverrideClientImpl serviceClient; - - /** - * Initializes an instance of MethodOverrideAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MethodOverrideAsyncClient(MethodOverrideClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupQueryWithResponse(RequestOptions requestOptions) { - return this.serviceClient.groupQueryWithResponseAsync(requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupAllRequest The groupAllRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupAllWithResponse(BinaryData groupAllRequest, RequestOptions requestOptions) { - return this.serviceClient.groupAllWithResponseAsync(groupAllRequest, requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupPartRequest The groupPartRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupPartWithResponse(BinaryData groupPartRequest, RequestOptions requestOptions) { - return this.serviceClient.groupPartWithResponseAsync(groupPartRequest, requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoThe ifModifiedSince parameter
If-Unmodified-SinceOffsetDateTimeNoThe ifUnmodifiedSince parameter
If-MatchStringNoThe ifMatch parameter
If-None-MatchStringNoThe ifNoneMatch parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupPartETagRequest The groupPartETagRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupPartETagWithResponse(BinaryData groupPartETagRequest, - RequestOptions requestOptions) { - return this.serviceClient.groupPartETagWithResponseAsync(groupPartETagRequest, requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupExcludeBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.groupExcludeBodyWithResponseAsync(body, requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     *     prop3: String (Optional)
-     *     prop4: String (Optional)
-     *     prop5: String (Optional)
-     *     prop6: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupNoneRequest The groupNoneRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupNoneWithResponse(BinaryData groupNoneRequest, RequestOptions requestOptions) { - return this.serviceClient.groupNoneWithResponseAsync(groupNoneRequest, requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param options The options parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono groupQuery(GroupQueryOptions options) { - // Generated convenience method for groupQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - String foo = options == null ? null : options.getFoo(); - String bar = options == null ? null : options.getBar(); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - return groupQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * A remote procedure call (RPC) operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono groupQuery() { - // Generated convenience method for groupQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return groupQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param options The options parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono groupAll(GroupAllOptions options) { - // Generated convenience method for groupAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - String foo = options.getFoo(); - String bar = options.getBar(); - GroupAllRequest groupAllRequestObj = new GroupAllRequest(options.getProp1()).setProp2(options.getProp2()); - BinaryData groupAllRequest = BinaryData.fromObject(groupAllRequestObj); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - return groupAllWithResponse(groupAllRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param prop1 The prop1 parameter. - * @param foo The foo parameter. - * @param options The options parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono groupPart(String prop1, String foo, GroupPartOptions options) { - // Generated convenience method for groupPartWithResponse - RequestOptions requestOptions = new RequestOptions(); - GroupPartRequest groupPartRequestObj = new GroupPartRequest(prop1).setProp2(options.getProp2()); - BinaryData groupPartRequest = BinaryData.fromObject(groupPartRequestObj); - String bar = options == null ? null : options.getBar(); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - return groupPartWithResponse(groupPartRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param prop1 The prop1 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono groupPart(String prop1) { - // Generated convenience method for groupPartWithResponse - RequestOptions requestOptions = new RequestOptions(); - GroupPartRequest groupPartRequestObj = new GroupPartRequest(prop1); - BinaryData groupPartRequest = BinaryData.fromObject(groupPartRequestObj); - return groupPartWithResponse(groupPartRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param prop1 The prop1 parameter. - * @param foo The foo parameter. - * @param options The options parameter. - * @param requestConditions Specifies HTTP options for conditional requests based on modification time. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono groupPartETag(String prop1, String foo, GroupPartETagOptions options, - RequestConditions requestConditions) { - // Generated convenience method for groupPartETagWithResponse - RequestOptions requestOptions = new RequestOptions(); - GroupPartETagRequest groupPartETagRequestObj = new GroupPartETagRequest(prop1).setProp2(options.getProp2()); - BinaryData groupPartETagRequest = BinaryData.fromObject(groupPartETagRequestObj); - String bar = options == null ? null : options.getBar(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - return groupPartETagWithResponse(groupPartETagRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param prop1 The prop1 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono groupPartETag(String prop1) { - // Generated convenience method for groupPartETagWithResponse - RequestOptions requestOptions = new RequestOptions(); - GroupPartETagRequest groupPartETagRequestObj = new GroupPartETagRequest(prop1); - BinaryData groupPartETagRequest = BinaryData.fromObject(groupPartETagRequestObj); - return groupPartETagWithResponse(groupPartETagRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param body The body parameter. - * @param options The options parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono groupExcludeBody(GroupExcludeBodyModel body, GroupQueryOptions options) { - // Generated convenience method for groupExcludeBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - String foo = options == null ? null : options.getFoo(); - String bar = options == null ? null : options.getBar(); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - return groupExcludeBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono groupExcludeBody(GroupExcludeBodyModel body) { - // Generated convenience method for groupExcludeBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return groupExcludeBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param prop1 The prop1 parameter. - * @param foo The foo parameter. - * @param bar The bar parameter. - * @param prop2 The prop2 parameter. - * @param prop3 The prop3 parameter. - * @param prop4 The prop4 parameter. - * @param prop5 The prop5 parameter. - * @param prop6 The prop6 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono groupNone(String prop1, String foo, String bar, String prop2, String prop3, String prop4, - String prop5, String prop6) { - // Generated convenience method for groupNoneWithResponse - RequestOptions requestOptions = new RequestOptions(); - GroupNoneRequest groupNoneRequestObj = new GroupNoneRequest(prop1).setProp2(prop2) - .setProp3(prop3) - .setProp4(prop4) - .setProp5(prop5) - .setProp6(prop6); - BinaryData groupNoneRequest = BinaryData.fromObject(groupNoneRequestObj); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.setHeader(HttpHeaderName.fromString("bar"), bar); - } - return groupNoneWithResponse(groupNoneRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param prop1 The prop1 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono groupNone(String prop1) { - // Generated convenience method for groupNoneWithResponse - RequestOptions requestOptions = new RequestOptions(); - GroupNoneRequest groupNoneRequestObj = new GroupNoneRequest(prop1); - BinaryData groupNoneRequest = BinaryData.fromObject(groupNoneRequestObj); - return groupNoneWithResponse(groupNoneRequest, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClient.java deleted file mode 100644 index c7f2ca77e3b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClient.java +++ /dev/null @@ -1,571 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.RequestConditions; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; -import tsptest.methodoverride.implementation.MethodOverrideClientImpl; -import tsptest.methodoverride.implementation.models.GroupAllRequest; -import tsptest.methodoverride.implementation.models.GroupNoneRequest; -import tsptest.methodoverride.implementation.models.GroupPartETagRequest; -import tsptest.methodoverride.implementation.models.GroupPartRequest; -import tsptest.methodoverride.models.GroupAllOptions; -import tsptest.methodoverride.models.GroupExcludeBodyModel; -import tsptest.methodoverride.models.GroupPartETagOptions; -import tsptest.methodoverride.models.GroupPartOptions; -import tsptest.methodoverride.models.GroupQueryOptions; - -/** - * Initializes a new instance of the synchronous MethodOverrideClient type. - */ -@ServiceClient(builder = MethodOverrideClientBuilder.class) -public final class MethodOverrideClient { - @Generated - private final MethodOverrideClientImpl serviceClient; - - /** - * Initializes an instance of MethodOverrideClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MethodOverrideClient(MethodOverrideClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupQueryWithResponse(RequestOptions requestOptions) { - return this.serviceClient.groupQueryWithResponse(requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupAllRequest The groupAllRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupAllWithResponse(BinaryData groupAllRequest, RequestOptions requestOptions) { - return this.serviceClient.groupAllWithResponse(groupAllRequest, requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupPartRequest The groupPartRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupPartWithResponse(BinaryData groupPartRequest, RequestOptions requestOptions) { - return this.serviceClient.groupPartWithResponse(groupPartRequest, requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoThe ifModifiedSince parameter
If-Unmodified-SinceOffsetDateTimeNoThe ifUnmodifiedSince parameter
If-MatchStringNoThe ifMatch parameter
If-None-MatchStringNoThe ifNoneMatch parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupPartETagRequest The groupPartETagRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupPartETagWithResponse(BinaryData groupPartETagRequest, RequestOptions requestOptions) { - return this.serviceClient.groupPartETagWithResponse(groupPartETagRequest, requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupExcludeBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.groupExcludeBodyWithResponse(body, requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     *     prop3: String (Optional)
-     *     prop4: String (Optional)
-     *     prop5: String (Optional)
-     *     prop6: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupNoneRequest The groupNoneRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupNoneWithResponse(BinaryData groupNoneRequest, RequestOptions requestOptions) { - return this.serviceClient.groupNoneWithResponse(groupNoneRequest, requestOptions); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param options The options parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void groupQuery(GroupQueryOptions options) { - // Generated convenience method for groupQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - String foo = options == null ? null : options.getFoo(); - String bar = options == null ? null : options.getBar(); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - groupQueryWithResponse(requestOptions).getValue(); - } - - /** - * A remote procedure call (RPC) operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void groupQuery() { - // Generated convenience method for groupQueryWithResponse - RequestOptions requestOptions = new RequestOptions(); - groupQueryWithResponse(requestOptions).getValue(); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param options The options parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void groupAll(GroupAllOptions options) { - // Generated convenience method for groupAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - String foo = options.getFoo(); - String bar = options.getBar(); - GroupAllRequest groupAllRequestObj = new GroupAllRequest(options.getProp1()).setProp2(options.getProp2()); - BinaryData groupAllRequest = BinaryData.fromObject(groupAllRequestObj); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - groupAllWithResponse(groupAllRequest, requestOptions).getValue(); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param prop1 The prop1 parameter. - * @param foo The foo parameter. - * @param options The options parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void groupPart(String prop1, String foo, GroupPartOptions options) { - // Generated convenience method for groupPartWithResponse - RequestOptions requestOptions = new RequestOptions(); - GroupPartRequest groupPartRequestObj = new GroupPartRequest(prop1).setProp2(options.getProp2()); - BinaryData groupPartRequest = BinaryData.fromObject(groupPartRequestObj); - String bar = options == null ? null : options.getBar(); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - groupPartWithResponse(groupPartRequest, requestOptions).getValue(); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param prop1 The prop1 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void groupPart(String prop1) { - // Generated convenience method for groupPartWithResponse - RequestOptions requestOptions = new RequestOptions(); - GroupPartRequest groupPartRequestObj = new GroupPartRequest(prop1); - BinaryData groupPartRequest = BinaryData.fromObject(groupPartRequestObj); - groupPartWithResponse(groupPartRequest, requestOptions).getValue(); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param prop1 The prop1 parameter. - * @param foo The foo parameter. - * @param options The options parameter. - * @param requestConditions Specifies HTTP options for conditional requests based on modification time. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void groupPartETag(String prop1, String foo, GroupPartETagOptions options, - RequestConditions requestConditions) { - // Generated convenience method for groupPartETagWithResponse - RequestOptions requestOptions = new RequestOptions(); - GroupPartETagRequest groupPartETagRequestObj = new GroupPartETagRequest(prop1).setProp2(options.getProp2()); - BinaryData groupPartETagRequest = BinaryData.fromObject(groupPartETagRequestObj); - String bar = options == null ? null : options.getBar(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - groupPartETagWithResponse(groupPartETagRequest, requestOptions).getValue(); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param prop1 The prop1 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void groupPartETag(String prop1) { - // Generated convenience method for groupPartETagWithResponse - RequestOptions requestOptions = new RequestOptions(); - GroupPartETagRequest groupPartETagRequestObj = new GroupPartETagRequest(prop1); - BinaryData groupPartETagRequest = BinaryData.fromObject(groupPartETagRequestObj); - groupPartETagWithResponse(groupPartETagRequest, requestOptions).getValue(); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param body The body parameter. - * @param options The options parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void groupExcludeBody(GroupExcludeBodyModel body, GroupQueryOptions options) { - // Generated convenience method for groupExcludeBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - String foo = options == null ? null : options.getFoo(); - String bar = options == null ? null : options.getBar(); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.addQueryParam("bar", bar, false); - } - groupExcludeBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void groupExcludeBody(GroupExcludeBodyModel body) { - // Generated convenience method for groupExcludeBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - groupExcludeBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param prop1 The prop1 parameter. - * @param foo The foo parameter. - * @param bar The bar parameter. - * @param prop2 The prop2 parameter. - * @param prop3 The prop3 parameter. - * @param prop4 The prop4 parameter. - * @param prop5 The prop5 parameter. - * @param prop6 The prop6 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void groupNone(String prop1, String foo, String bar, String prop2, String prop3, String prop4, String prop5, - String prop6) { - // Generated convenience method for groupNoneWithResponse - RequestOptions requestOptions = new RequestOptions(); - GroupNoneRequest groupNoneRequestObj = new GroupNoneRequest(prop1).setProp2(prop2) - .setProp3(prop3) - .setProp4(prop4) - .setProp5(prop5) - .setProp6(prop6); - BinaryData groupNoneRequest = BinaryData.fromObject(groupNoneRequestObj); - if (foo != null) { - requestOptions.addQueryParam("foo", foo, false); - } - if (bar != null) { - requestOptions.setHeader(HttpHeaderName.fromString("bar"), bar); - } - groupNoneWithResponse(groupNoneRequest, requestOptions).getValue(); - } - - /** - * A remote procedure call (RPC) operation. - * - * @param prop1 The prop1 parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void groupNone(String prop1) { - // Generated convenience method for groupNoneWithResponse - RequestOptions requestOptions = new RequestOptions(); - GroupNoneRequest groupNoneRequestObj = new GroupNoneRequest(prop1); - BinaryData groupNoneRequest = BinaryData.fromObject(groupNoneRequestObj); - groupNoneWithResponse(groupNoneRequest, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClientBuilder.java deleted file mode 100644 index ebefa1868cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.methodoverride.implementation.MethodOverrideClientImpl; - -/** - * A builder for creating a new instance of the MethodOverrideClient type. - */ -@ServiceClientBuilder(serviceClients = { MethodOverrideClient.class, MethodOverrideAsyncClient.class }) -public final class MethodOverrideClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-methodoverride.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the MethodOverrideClientBuilder. - */ - @Generated - public MethodOverrideClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MethodOverrideClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MethodOverrideClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MethodOverrideClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MethodOverrideClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MethodOverrideClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MethodOverrideClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MethodOverrideClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MethodOverrideClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private MethodOverrideServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the MethodOverrideClientBuilder. - */ - @Generated - public MethodOverrideClientBuilder serviceVersion(MethodOverrideServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the MethodOverrideClientBuilder. - */ - @Generated - public MethodOverrideClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of MethodOverrideClientImpl with the provided parameters. - * - * @return an instance of MethodOverrideClientImpl. - */ - @Generated - private MethodOverrideClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - MethodOverrideServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : MethodOverrideServiceVersion.getLatest(); - MethodOverrideClientImpl client = new MethodOverrideClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of MethodOverrideAsyncClient class. - * - * @return an instance of MethodOverrideAsyncClient. - */ - @Generated - public MethodOverrideAsyncClient buildAsyncClient() { - return new MethodOverrideAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of MethodOverrideClient class. - * - * @return an instance of MethodOverrideClient. - */ - @Generated - public MethodOverrideClient buildClient() { - return new MethodOverrideClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(MethodOverrideClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideServiceVersion.java deleted file mode 100644 index f79ba516434..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of MethodOverrideClient. - */ -public enum MethodOverrideServiceVersion implements ServiceVersion { - /** - * Enum value 2022-12-01-preview. - */ - V2022_12_01_PREVIEW("2022-12-01-preview"); - - private final String version; - - MethodOverrideServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link MethodOverrideServiceVersion}. - */ - public static MethodOverrideServiceVersion getLatest() { - return V2022_12_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java deleted file mode 100644 index 88a822d3760..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java +++ /dev/null @@ -1,720 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; -import tsptest.methodoverride.MethodOverrideServiceVersion; - -/** - * Initializes a new instance of the MethodOverrideClient type. - */ -public final class MethodOverrideClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MethodOverrideClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final MethodOverrideServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public MethodOverrideServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of MethodOverrideClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public MethodOverrideClientImpl(String endpoint, MethodOverrideServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of MethodOverrideClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public MethodOverrideClientImpl(HttpPipeline httpPipeline, String endpoint, - MethodOverrideServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of MethodOverrideClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public MethodOverrideClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - MethodOverrideServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service - = RestProxy.create(MethodOverrideClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for MethodOverrideClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MethodOverrideClient") - public interface MethodOverrideClientService { - @Get("/group-query") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> groupQuery(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); - - @Get("/group-query") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response groupQuerySync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); - - @Post("/group-all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> groupAll(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData groupAllRequest, RequestOptions requestOptions, Context context); - - @Post("/group-all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response groupAllSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData groupAllRequest, RequestOptions requestOptions, Context context); - - @Post("/group-part") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> groupPart(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData groupPartRequest, RequestOptions requestOptions, Context context); - - @Post("/group-part") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response groupPartSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData groupPartRequest, RequestOptions requestOptions, Context context); - - @Post("/group-part-etag") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> groupPartETag(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData groupPartETagRequest, RequestOptions requestOptions, - Context context); - - @Post("/group-part-etag") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response groupPartETagSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData groupPartETagRequest, RequestOptions requestOptions, - Context context); - - @Post("/group-exclude-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> groupExcludeBody(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/group-exclude-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response groupExcludeBodySync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/group-none") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> groupNone(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData groupNoneRequest, RequestOptions requestOptions, Context context); - - @Post("/group-none") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response groupNoneSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData groupNoneRequest, RequestOptions requestOptions, Context context); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupQueryWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.groupQuery(this.getEndpoint(), - this.getServiceVersion().getVersion(), requestOptions, context)); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupQueryWithResponse(RequestOptions requestOptions) { - return service.groupQuerySync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, - Context.NONE); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupAllRequest The groupAllRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupAllWithResponseAsync(BinaryData groupAllRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.groupAll(this.getEndpoint(), - this.getServiceVersion().getVersion(), contentType, groupAllRequest, requestOptions, context)); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupAllRequest The groupAllRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupAllWithResponse(BinaryData groupAllRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.groupAllSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, - groupAllRequest, requestOptions, Context.NONE); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupPartRequest The groupPartRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupPartWithResponseAsync(BinaryData groupPartRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.groupPart(this.getEndpoint(), - this.getServiceVersion().getVersion(), contentType, groupPartRequest, requestOptions, context)); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupPartRequest The groupPartRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupPartWithResponse(BinaryData groupPartRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.groupPartSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, - groupPartRequest, requestOptions, Context.NONE); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoThe ifModifiedSince parameter
If-Unmodified-SinceOffsetDateTimeNoThe ifUnmodifiedSince parameter
If-MatchStringNoThe ifMatch parameter
If-None-MatchStringNoThe ifNoneMatch parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupPartETagRequest The groupPartETagRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupPartETagWithResponseAsync(BinaryData groupPartETagRequest, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.groupPartETag(this.getEndpoint(), - this.getServiceVersion().getVersion(), contentType, groupPartETagRequest, requestOptions, context)); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoThe ifModifiedSince parameter
If-Unmodified-SinceOffsetDateTimeNoThe ifUnmodifiedSince parameter
If-MatchStringNoThe ifMatch parameter
If-None-MatchStringNoThe ifNoneMatch parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupPartETagRequest The groupPartETagRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupPartETagWithResponse(BinaryData groupPartETagRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.groupPartETagSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, - groupPartETagRequest, requestOptions, Context.NONE); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupExcludeBodyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.groupExcludeBody(this.getEndpoint(), - this.getServiceVersion().getVersion(), contentType, body, requestOptions, context)); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupExcludeBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.groupExcludeBodySync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, - body, requestOptions, Context.NONE); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     *     prop3: String (Optional)
-     *     prop4: String (Optional)
-     *     prop5: String (Optional)
-     *     prop6: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupNoneRequest The groupNoneRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> groupNoneWithResponseAsync(BinaryData groupNoneRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.groupNone(this.getEndpoint(), - this.getServiceVersion().getVersion(), contentType, groupNoneRequest, requestOptions, context)); - } - - /** - * A remote procedure call (RPC) operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
barStringNoThe bar parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop1: String (Required)
-     *     prop2: String (Optional)
-     *     prop3: String (Optional)
-     *     prop4: String (Optional)
-     *     prop5: String (Optional)
-     *     prop6: String (Optional)
-     * }
-     * }
-     * 
- * - * @param groupNoneRequest The groupNoneRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response groupNoneWithResponse(BinaryData groupNoneRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.groupNoneSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, - groupNoneRequest, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupAllRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupAllRequest.java deleted file mode 100644 index 4bd93423407..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupAllRequest.java +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GroupAllRequest model. - */ -@Fluent -public final class GroupAllRequest implements JsonSerializable { - /* - * The prop1 property. - */ - @Generated - private final String prop1; - - /* - * The prop2 property. - */ - @Generated - private String prop2; - - /** - * Creates an instance of GroupAllRequest class. - * - * @param prop1 the prop1 value to set. - */ - @Generated - public GroupAllRequest(String prop1) { - this.prop1 = prop1; - } - - /** - * Get the prop1 property: The prop1 property. - * - * @return the prop1 value. - */ - @Generated - public String getProp1() { - return this.prop1; - } - - /** - * Get the prop2 property: The prop2 property. - * - * @return the prop2 value. - */ - @Generated - public String getProp2() { - return this.prop2; - } - - /** - * Set the prop2 property: The prop2 property. - * - * @param prop2 the prop2 value to set. - * @return the GroupAllRequest object itself. - */ - @Generated - public GroupAllRequest setProp2(String prop2) { - this.prop2 = prop2; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop1", this.prop1); - jsonWriter.writeStringField("prop2", this.prop2); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GroupAllRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GroupAllRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GroupAllRequest. - */ - @Generated - public static GroupAllRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String prop1 = null; - String prop2 = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop1".equals(fieldName)) { - prop1 = reader.getString(); - } else if ("prop2".equals(fieldName)) { - prop2 = reader.getString(); - } else { - reader.skipChildren(); - } - } - GroupAllRequest deserializedGroupAllRequest = new GroupAllRequest(prop1); - deserializedGroupAllRequest.prop2 = prop2; - - return deserializedGroupAllRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupNoneRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupNoneRequest.java deleted file mode 100644 index 51b1187240c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupNoneRequest.java +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GroupNoneRequest model. - */ -@Fluent -public final class GroupNoneRequest implements JsonSerializable { - /* - * The prop1 property. - */ - @Generated - private final String prop1; - - /* - * The prop2 property. - */ - @Generated - private String prop2; - - /* - * The prop3 property. - */ - @Generated - private String prop3; - - /* - * The prop4 property. - */ - @Generated - private String prop4; - - /* - * The prop5 property. - */ - @Generated - private String prop5; - - /* - * The prop6 property. - */ - @Generated - private String prop6; - - /** - * Creates an instance of GroupNoneRequest class. - * - * @param prop1 the prop1 value to set. - */ - @Generated - public GroupNoneRequest(String prop1) { - this.prop1 = prop1; - } - - /** - * Get the prop1 property: The prop1 property. - * - * @return the prop1 value. - */ - @Generated - public String getProp1() { - return this.prop1; - } - - /** - * Get the prop2 property: The prop2 property. - * - * @return the prop2 value. - */ - @Generated - public String getProp2() { - return this.prop2; - } - - /** - * Set the prop2 property: The prop2 property. - * - * @param prop2 the prop2 value to set. - * @return the GroupNoneRequest object itself. - */ - @Generated - public GroupNoneRequest setProp2(String prop2) { - this.prop2 = prop2; - return this; - } - - /** - * Get the prop3 property: The prop3 property. - * - * @return the prop3 value. - */ - @Generated - public String getProp3() { - return this.prop3; - } - - /** - * Set the prop3 property: The prop3 property. - * - * @param prop3 the prop3 value to set. - * @return the GroupNoneRequest object itself. - */ - @Generated - public GroupNoneRequest setProp3(String prop3) { - this.prop3 = prop3; - return this; - } - - /** - * Get the prop4 property: The prop4 property. - * - * @return the prop4 value. - */ - @Generated - public String getProp4() { - return this.prop4; - } - - /** - * Set the prop4 property: The prop4 property. - * - * @param prop4 the prop4 value to set. - * @return the GroupNoneRequest object itself. - */ - @Generated - public GroupNoneRequest setProp4(String prop4) { - this.prop4 = prop4; - return this; - } - - /** - * Get the prop5 property: The prop5 property. - * - * @return the prop5 value. - */ - @Generated - public String getProp5() { - return this.prop5; - } - - /** - * Set the prop5 property: The prop5 property. - * - * @param prop5 the prop5 value to set. - * @return the GroupNoneRequest object itself. - */ - @Generated - public GroupNoneRequest setProp5(String prop5) { - this.prop5 = prop5; - return this; - } - - /** - * Get the prop6 property: The prop6 property. - * - * @return the prop6 value. - */ - @Generated - public String getProp6() { - return this.prop6; - } - - /** - * Set the prop6 property: The prop6 property. - * - * @param prop6 the prop6 value to set. - * @return the GroupNoneRequest object itself. - */ - @Generated - public GroupNoneRequest setProp6(String prop6) { - this.prop6 = prop6; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop1", this.prop1); - jsonWriter.writeStringField("prop2", this.prop2); - jsonWriter.writeStringField("prop3", this.prop3); - jsonWriter.writeStringField("prop4", this.prop4); - jsonWriter.writeStringField("prop5", this.prop5); - jsonWriter.writeStringField("prop6", this.prop6); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GroupNoneRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GroupNoneRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GroupNoneRequest. - */ - @Generated - public static GroupNoneRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String prop1 = null; - String prop2 = null; - String prop3 = null; - String prop4 = null; - String prop5 = null; - String prop6 = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop1".equals(fieldName)) { - prop1 = reader.getString(); - } else if ("prop2".equals(fieldName)) { - prop2 = reader.getString(); - } else if ("prop3".equals(fieldName)) { - prop3 = reader.getString(); - } else if ("prop4".equals(fieldName)) { - prop4 = reader.getString(); - } else if ("prop5".equals(fieldName)) { - prop5 = reader.getString(); - } else if ("prop6".equals(fieldName)) { - prop6 = reader.getString(); - } else { - reader.skipChildren(); - } - } - GroupNoneRequest deserializedGroupNoneRequest = new GroupNoneRequest(prop1); - deserializedGroupNoneRequest.prop2 = prop2; - deserializedGroupNoneRequest.prop3 = prop3; - deserializedGroupNoneRequest.prop4 = prop4; - deserializedGroupNoneRequest.prop5 = prop5; - deserializedGroupNoneRequest.prop6 = prop6; - - return deserializedGroupNoneRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartETagRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartETagRequest.java deleted file mode 100644 index 7a30dc3833b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartETagRequest.java +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GroupPartETagRequest model. - */ -@Fluent -public final class GroupPartETagRequest implements JsonSerializable { - /* - * The prop1 property. - */ - @Generated - private final String prop1; - - /* - * The prop2 property. - */ - @Generated - private String prop2; - - /** - * Creates an instance of GroupPartETagRequest class. - * - * @param prop1 the prop1 value to set. - */ - @Generated - public GroupPartETagRequest(String prop1) { - this.prop1 = prop1; - } - - /** - * Get the prop1 property: The prop1 property. - * - * @return the prop1 value. - */ - @Generated - public String getProp1() { - return this.prop1; - } - - /** - * Get the prop2 property: The prop2 property. - * - * @return the prop2 value. - */ - @Generated - public String getProp2() { - return this.prop2; - } - - /** - * Set the prop2 property: The prop2 property. - * - * @param prop2 the prop2 value to set. - * @return the GroupPartETagRequest object itself. - */ - @Generated - public GroupPartETagRequest setProp2(String prop2) { - this.prop2 = prop2; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop1", this.prop1); - jsonWriter.writeStringField("prop2", this.prop2); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GroupPartETagRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GroupPartETagRequest if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GroupPartETagRequest. - */ - @Generated - public static GroupPartETagRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String prop1 = null; - String prop2 = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop1".equals(fieldName)) { - prop1 = reader.getString(); - } else if ("prop2".equals(fieldName)) { - prop2 = reader.getString(); - } else { - reader.skipChildren(); - } - } - GroupPartETagRequest deserializedGroupPartETagRequest = new GroupPartETagRequest(prop1); - deserializedGroupPartETagRequest.prop2 = prop2; - - return deserializedGroupPartETagRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartRequest.java deleted file mode 100644 index dabfce61f50..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartRequest.java +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GroupPartRequest model. - */ -@Fluent -public final class GroupPartRequest implements JsonSerializable { - /* - * The prop1 property. - */ - @Generated - private final String prop1; - - /* - * The prop2 property. - */ - @Generated - private String prop2; - - /** - * Creates an instance of GroupPartRequest class. - * - * @param prop1 the prop1 value to set. - */ - @Generated - public GroupPartRequest(String prop1) { - this.prop1 = prop1; - } - - /** - * Get the prop1 property: The prop1 property. - * - * @return the prop1 value. - */ - @Generated - public String getProp1() { - return this.prop1; - } - - /** - * Get the prop2 property: The prop2 property. - * - * @return the prop2 value. - */ - @Generated - public String getProp2() { - return this.prop2; - } - - /** - * Set the prop2 property: The prop2 property. - * - * @param prop2 the prop2 value to set. - * @return the GroupPartRequest object itself. - */ - @Generated - public GroupPartRequest setProp2(String prop2) { - this.prop2 = prop2; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop1", this.prop1); - jsonWriter.writeStringField("prop2", this.prop2); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GroupPartRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GroupPartRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GroupPartRequest. - */ - @Generated - public static GroupPartRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String prop1 = null; - String prop2 = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop1".equals(fieldName)) { - prop1 = reader.getString(); - } else if ("prop2".equals(fieldName)) { - prop2 = reader.getString(); - } else { - reader.skipChildren(); - } - } - GroupPartRequest deserializedGroupPartRequest = new GroupPartRequest(prop1); - deserializedGroupPartRequest.prop2 = prop2; - - return deserializedGroupPartRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/package-info.java deleted file mode 100644 index c430d4c1f4e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for MethodOverride. - * - */ -package tsptest.methodoverride.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/package-info.java deleted file mode 100644 index 7df234c1921..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for MethodOverride. - * - */ -package tsptest.methodoverride.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupAllOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupAllOptions.java deleted file mode 100644 index d48b8268125..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupAllOptions.java +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; - -/** - * The GroupAllOptions model. - */ -@Fluent -public final class GroupAllOptions { - /* - * The foo property. - */ - @Generated - private String foo; - - /* - * The bar property. - */ - @Generated - private String bar; - - /* - * The prop1 property. - */ - @Generated - private final String prop1; - - /* - * The prop2 property. - */ - @Generated - private String prop2; - - /** - * Creates an instance of GroupAllOptions class. - * - * @param prop1 the prop1 value to set. - */ - @Generated - public GroupAllOptions(String prop1) { - this.prop1 = prop1; - } - - /** - * Get the foo property: The foo property. - * - * @return the foo value. - */ - @Generated - public String getFoo() { - return this.foo; - } - - /** - * Set the foo property: The foo property. - * - * @param foo the foo value to set. - * @return the GroupAllOptions object itself. - */ - @Generated - public GroupAllOptions setFoo(String foo) { - this.foo = foo; - return this; - } - - /** - * Get the bar property: The bar property. - * - * @return the bar value. - */ - @Generated - public String getBar() { - return this.bar; - } - - /** - * Set the bar property: The bar property. - * - * @param bar the bar value to set. - * @return the GroupAllOptions object itself. - */ - @Generated - public GroupAllOptions setBar(String bar) { - this.bar = bar; - return this; - } - - /** - * Get the prop1 property: The prop1 property. - * - * @return the prop1 value. - */ - @Generated - public String getProp1() { - return this.prop1; - } - - /** - * Get the prop2 property: The prop2 property. - * - * @return the prop2 value. - */ - @Generated - public String getProp2() { - return this.prop2; - } - - /** - * Set the prop2 property: The prop2 property. - * - * @param prop2 the prop2 value to set. - * @return the GroupAllOptions object itself. - */ - @Generated - public GroupAllOptions setProp2(String prop2) { - this.prop2 = prop2; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupExcludeBodyModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupExcludeBodyModel.java deleted file mode 100644 index a8990016efd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupExcludeBodyModel.java +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GroupExcludeBodyModel model. - */ -@Fluent -public final class GroupExcludeBodyModel implements JsonSerializable { - /* - * The prop1 property. - */ - @Generated - private final String prop1; - - /* - * The prop2 property. - */ - @Generated - private String prop2; - - /** - * Creates an instance of GroupExcludeBodyModel class. - * - * @param prop1 the prop1 value to set. - */ - @Generated - public GroupExcludeBodyModel(String prop1) { - this.prop1 = prop1; - } - - /** - * Get the prop1 property: The prop1 property. - * - * @return the prop1 value. - */ - @Generated - public String getProp1() { - return this.prop1; - } - - /** - * Get the prop2 property: The prop2 property. - * - * @return the prop2 value. - */ - @Generated - public String getProp2() { - return this.prop2; - } - - /** - * Set the prop2 property: The prop2 property. - * - * @param prop2 the prop2 value to set. - * @return the GroupExcludeBodyModel object itself. - */ - @Generated - public GroupExcludeBodyModel setProp2(String prop2) { - this.prop2 = prop2; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop1", this.prop1); - jsonWriter.writeStringField("prop2", this.prop2); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GroupExcludeBodyModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GroupExcludeBodyModel if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GroupExcludeBodyModel. - */ - @Generated - public static GroupExcludeBodyModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String prop1 = null; - String prop2 = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop1".equals(fieldName)) { - prop1 = reader.getString(); - } else if ("prop2".equals(fieldName)) { - prop2 = reader.getString(); - } else { - reader.skipChildren(); - } - } - GroupExcludeBodyModel deserializedGroupExcludeBodyModel = new GroupExcludeBodyModel(prop1); - deserializedGroupExcludeBodyModel.prop2 = prop2; - - return deserializedGroupExcludeBodyModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartETagOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartETagOptions.java deleted file mode 100644 index 3a532805754..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartETagOptions.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; - -/** - * The GroupPartETagOptions model. - */ -@Fluent -public final class GroupPartETagOptions { - /* - * The bar property. - */ - @Generated - private String bar; - - /* - * The prop2 property. - */ - @Generated - private String prop2; - - /** - * Creates an instance of GroupPartETagOptions class. - */ - @Generated - public GroupPartETagOptions() { - } - - /** - * Get the bar property: The bar property. - * - * @return the bar value. - */ - @Generated - public String getBar() { - return this.bar; - } - - /** - * Set the bar property: The bar property. - * - * @param bar the bar value to set. - * @return the GroupPartETagOptions object itself. - */ - @Generated - public GroupPartETagOptions setBar(String bar) { - this.bar = bar; - return this; - } - - /** - * Get the prop2 property: The prop2 property. - * - * @return the prop2 value. - */ - @Generated - public String getProp2() { - return this.prop2; - } - - /** - * Set the prop2 property: The prop2 property. - * - * @param prop2 the prop2 value to set. - * @return the GroupPartETagOptions object itself. - */ - @Generated - public GroupPartETagOptions setProp2(String prop2) { - this.prop2 = prop2; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartOptions.java deleted file mode 100644 index 6d6c37b67b2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartOptions.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; - -/** - * The GroupPartOptions model. - */ -@Fluent -public final class GroupPartOptions { - /* - * The bar property. - */ - @Generated - private String bar; - - /* - * The prop2 property. - */ - @Generated - private String prop2; - - /** - * Creates an instance of GroupPartOptions class. - */ - @Generated - public GroupPartOptions() { - } - - /** - * Get the bar property: The bar property. - * - * @return the bar value. - */ - @Generated - public String getBar() { - return this.bar; - } - - /** - * Set the bar property: The bar property. - * - * @param bar the bar value to set. - * @return the GroupPartOptions object itself. - */ - @Generated - public GroupPartOptions setBar(String bar) { - this.bar = bar; - return this; - } - - /** - * Get the prop2 property: The prop2 property. - * - * @return the prop2 value. - */ - @Generated - public String getProp2() { - return this.prop2; - } - - /** - * Set the prop2 property: The prop2 property. - * - * @param prop2 the prop2 value to set. - * @return the GroupPartOptions object itself. - */ - @Generated - public GroupPartOptions setProp2(String prop2) { - this.prop2 = prop2; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java deleted file mode 100644 index 394f1fb5147..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; - -/** - * The GroupQueryOptions model. - */ -@Fluent -public final class GroupQueryOptions { - /* - * The foo property. - */ - @Generated - private String foo; - - /* - * The bar property. - */ - @Generated - private String bar; - - /** - * Creates an instance of GroupQueryOptions class. - */ - @Generated - public GroupQueryOptions() { - } - - /** - * Get the foo property: The foo property. - * - * @return the foo value. - */ - @Generated - public String getFoo() { - return this.foo; - } - - /** - * Set the foo property: The foo property. - * - * @param foo the foo value to set. - * @return the GroupQueryOptions object itself. - */ - @Generated - public GroupQueryOptions setFoo(String foo) { - this.foo = foo; - return this; - } - - /** - * Get the bar property: The bar property. - * - * @return the bar value. - */ - @Generated - public String getBar() { - return this.bar; - } - - /** - * Set the bar property: The bar property. - * - * @param bar the bar value to set. - * @return the GroupQueryOptions object itself. - */ - @Generated - public GroupQueryOptions setBar(String bar) { - this.bar = bar; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/package-info.java deleted file mode 100644 index 5309f062074..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for MethodOverride. - * - */ -package tsptest.methodoverride.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/package-info.java deleted file mode 100644 index a9dc80b7621..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for MethodOverride. - * - */ -package tsptest.methodoverride; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelAsyncClient.java deleted file mode 100644 index 574b1c35a0f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelAsyncClient.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.model.implementation.ModelOpsImpl; -import tsptest.model.models.NestedModel; -import tsptest.model.models.Resource1; -import tsptest.model.models.Resource2; -import tsptest.model.models.Resource3; - -/** - * Initializes a new instance of the asynchronous ModelClient type. - */ -@ServiceClient(builder = ModelClientBuilder.class, isAsync = true) -public final class ModelAsyncClient { - @Generated - private final ModelOpsImpl serviceClient; - - /** - * Initializes an instance of ModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelAsyncClient(ModelOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The put1 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     outputData (Required): {
-     *         data: String (Required)
-     *     }
-     *     outputData2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     outputData (Required): {
-     *         data: String (Required)
-     *     }
-     *     outputData2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> put1WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.put1WithResponseAsync(body, requestOptions); - } - - /** - * The put2 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> put2WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.put2WithResponseAsync(body, requestOptions); - } - - /** - * The get3 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     outputData3 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get3WithResponse(RequestOptions requestOptions) { - return this.serviceClient.get3WithResponseAsync(requestOptions); - } - - /** - * The putNested operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     nested1 (Required): {
-     *         nested2 (Required): {
-     *             data: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     nested1 (Required): {
-     *         nested2 (Required): {
-     *             data: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putNestedWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putNestedWithResponseAsync(body, requestOptions); - } - - /** - * The put1 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put1(Resource1 body) { - // Generated convenience method for put1WithResponse - RequestOptions requestOptions = new RequestOptions(); - return put1WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource1.class)); - } - - /** - * The put2 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put2(Resource2 body) { - // Generated convenience method for put2WithResponse - RequestOptions requestOptions = new RequestOptions(); - return put2WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource2.class)); - } - - /** - * The get3 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get3() { - // Generated convenience method for get3WithResponse - RequestOptions requestOptions = new RequestOptions(); - return get3WithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource3.class)); - } - - /** - * The putNested operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putNested(NestedModel body) { - // Generated convenience method for putNestedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putNestedWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(NestedModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClient.java deleted file mode 100644 index 4185f37bdb5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClient.java +++ /dev/null @@ -1,282 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.model.implementation.ModelOpsImpl; -import tsptest.model.models.NestedModel; -import tsptest.model.models.Resource1; -import tsptest.model.models.Resource2; -import tsptest.model.models.Resource3; - -/** - * Initializes a new instance of the synchronous ModelClient type. - */ -@ServiceClient(builder = ModelClientBuilder.class) -public final class ModelClient { - @Generated - private final ModelOpsImpl serviceClient; - - /** - * Initializes an instance of ModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelClient(ModelOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The put1 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     outputData (Required): {
-     *         data: String (Required)
-     *     }
-     *     outputData2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     outputData (Required): {
-     *         data: String (Required)
-     *     }
-     *     outputData2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response put1WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.put1WithResponse(body, requestOptions); - } - - /** - * The put2 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response put2WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.put2WithResponse(body, requestOptions); - } - - /** - * The get3 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     outputData3 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response get3WithResponse(RequestOptions requestOptions) { - return this.serviceClient.get3WithResponse(requestOptions); - } - - /** - * The putNested operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     nested1 (Required): {
-     *         nested2 (Required): {
-     *             data: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     nested1 (Required): {
-     *         nested2 (Required): {
-     *             data: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putNestedWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putNestedWithResponse(body, requestOptions); - } - - /** - * The put1 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource1 put1(Resource1 body) { - // Generated convenience method for put1WithResponse - RequestOptions requestOptions = new RequestOptions(); - return put1WithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(Resource1.class); - } - - /** - * The put2 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource2 put2(Resource2 body) { - // Generated convenience method for put2WithResponse - RequestOptions requestOptions = new RequestOptions(); - return put2WithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(Resource2.class); - } - - /** - * The get3 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource3 get3() { - // Generated convenience method for get3WithResponse - RequestOptions requestOptions = new RequestOptions(); - return get3WithResponse(requestOptions).getValue().toObject(Resource3.class); - } - - /** - * The putNested operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public NestedModel putNested(NestedModel body) { - // Generated convenience method for putNestedWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putNestedWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(NestedModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClientBuilder.java deleted file mode 100644 index d7d59d387be..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.model.implementation.ModelClientImpl; - -/** - * A builder for creating a new instance of the ModelClient type. - */ -@ServiceClientBuilder(serviceClients = { ModelClient.class, ModelAsyncClient.class }) -public final class ModelClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-model.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ModelClientBuilder. - */ - @Generated - public ModelClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ModelClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ModelClientBuilder. - */ - @Generated - public ModelClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ModelClientImpl with the provided parameters. - * - * @return an instance of ModelClientImpl. - */ - @Generated - private ModelClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - ModelClientImpl client - = new ModelClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ModelAsyncClient class. - * - * @return an instance of ModelAsyncClient. - */ - @Generated - public ModelAsyncClient buildAsyncClient() { - return new ModelAsyncClient(buildInnerClient().getModelOps()); - } - - /** - * Builds an instance of ModelClient class. - * - * @return an instance of ModelClient. - */ - @Generated - public ModelClient buildClient() { - return new ModelClient(buildInnerClient().getModelOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ModelClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelClientImpl.java deleted file mode 100644 index 14f806b1839..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 ModelClient type. - */ -public final class ModelClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 ModelOpsImpl object to access its operations. - */ - private final ModelOpsImpl modelOps; - - /** - * Gets the ModelOpsImpl object to access its operations. - * - * @return the ModelOpsImpl object. - */ - public ModelOpsImpl getModelOps() { - return this.modelOps; - } - - /** - * Initializes an instance of ModelClient client. - * - * @param endpoint Service host. - */ - public ModelClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ModelClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ModelClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ModelClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ModelClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.modelOps = new ModelOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelOpsImpl.java deleted file mode 100644 index 31441b34c72..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelOpsImpl.java +++ /dev/null @@ -1,474 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ModelOps. - */ -public final class ModelOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ModelOpsService service; - - /** - * The service client containing this operation class. - */ - private final ModelClientImpl client; - - /** - * Initializes an instance of ModelOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ModelOpsImpl(ModelClientImpl client) { - this.service = RestProxy.create(ModelOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ModelClientModelOps to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ModelClientModelOps") - public interface ModelOpsService { - @Put("/model/resource1") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put1(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/model/resource1") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response put1Sync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/model/resource2") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put2(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/model/resource2") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response put2Sync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Get("/model/resource3") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get3(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/model/resource3") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response get3Sync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/model/nested") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putNested(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Get("/model/nested") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putNestedSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The put1 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     outputData (Required): {
-     *         data: String (Required)
-     *     }
-     *     outputData2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     outputData (Required): {
-     *         data: String (Required)
-     *     }
-     *     outputData2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> put1WithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.put1(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * The put1 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     outputData (Required): {
-     *         data: String (Required)
-     *     }
-     *     outputData2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     outputData (Required): {
-     *         data: String (Required)
-     *     }
-     *     outputData2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response put1WithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.put1Sync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } - - /** - * The put2 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> put2WithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.put2(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * The put2 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data2 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response put2WithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.put2Sync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } - - /** - * The get3 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     outputData3 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get3WithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.get3(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get3 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     outputData3 (Required): {
-     *         data: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response get3WithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.get3Sync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The putNested operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     nested1 (Required): {
-     *         nested2 (Required): {
-     *             data: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     nested1 (Required): {
-     *         nested2 (Required): {
-     *             data: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putNestedWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.putNested(this.client.getEndpoint(), contentType, accept, body, - requestOptions, context)); - } - - /** - * The putNested operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     nested1 (Required): {
-     *         nested2 (Required): {
-     *             data: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     nested1 (Required): {
-     *         nested2 (Required): {
-     *             data: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putNestedWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putNestedSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/package-info.java deleted file mode 100644 index e250c3dcd63..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Model. - * - */ -package tsptest.model.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/InputOutputData2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/InputOutputData2.java deleted file mode 100644 index c691ca87f6a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/InputOutputData2.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The InputOutputData2 model. - */ -@Immutable -public final class InputOutputData2 implements JsonSerializable { - /* - * The data property. - */ - @Generated - private final String data; - - /** - * Creates an instance of InputOutputData2 class. - * - * @param data the data value to set. - */ - @Generated - public InputOutputData2(String data) { - this.data = data; - } - - /** - * Get the data property: The data property. - * - * @return the data value. - */ - @Generated - public String getData() { - return this.data; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("data", this.data); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InputOutputData2 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InputOutputData2 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the InputOutputData2. - */ - @Generated - public static InputOutputData2 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String data = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("data".equals(fieldName)) { - data = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new InputOutputData2(data); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel.java deleted file mode 100644 index aaa073333ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The NestedModel model. - */ -@Immutable -public final class NestedModel implements JsonSerializable { - /* - * The nested1 property. - */ - @Generated - private final NestedModel1 nested1; - - /** - * Creates an instance of NestedModel class. - * - * @param nested1 the nested1 value to set. - */ - @Generated - public NestedModel(NestedModel1 nested1) { - this.nested1 = nested1; - } - - /** - * Get the nested1 property: The nested1 property. - * - * @return the nested1 value. - */ - @Generated - public NestedModel1 getNested1() { - return this.nested1; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("nested1", this.nested1); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NestedModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NestedModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NestedModel. - */ - @Generated - public static NestedModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NestedModel1 nested1 = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("nested1".equals(fieldName)) { - nested1 = NestedModel1.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new NestedModel(nested1); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel1.java deleted file mode 100644 index ac657ba3016..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel1.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The NestedModel1 model. - */ -@Immutable -public final class NestedModel1 implements JsonSerializable { - /* - * The nested2 property. - */ - @Generated - private final NestedModel2 nested2; - - /** - * Creates an instance of NestedModel1 class. - * - * @param nested2 the nested2 value to set. - */ - @Generated - public NestedModel1(NestedModel2 nested2) { - this.nested2 = nested2; - } - - /** - * Get the nested2 property: The nested2 property. - * - * @return the nested2 value. - */ - @Generated - public NestedModel2 getNested2() { - return this.nested2; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("nested2", this.nested2); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NestedModel1 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NestedModel1 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NestedModel1. - */ - @Generated - public static NestedModel1 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NestedModel2 nested2 = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("nested2".equals(fieldName)) { - nested2 = NestedModel2.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new NestedModel1(nested2); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel2.java deleted file mode 100644 index 82dd348804c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel2.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The NestedModel2 model. - */ -@Immutable -public final class NestedModel2 implements JsonSerializable { - /* - * The data property. - */ - @Generated - private final String data; - - /** - * Creates an instance of NestedModel2 class. - * - * @param data the data value to set. - */ - @Generated - public NestedModel2(String data) { - this.data = data; - } - - /** - * Get the data property: The data property. - * - * @return the data value. - */ - @Generated - public String getData() { - return this.data; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("data", this.data); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NestedModel2 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NestedModel2 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NestedModel2. - */ - @Generated - public static NestedModel2 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String data = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("data".equals(fieldName)) { - data = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new NestedModel2(data); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData.java deleted file mode 100644 index 9d01d6184cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The OutputData model. - */ -@Immutable -public final class OutputData implements JsonSerializable { - /* - * The data property. - */ - @Generated - private final String data; - - /** - * Creates an instance of OutputData class. - * - * @param data the data value to set. - */ - @Generated - private OutputData(String data) { - this.data = data; - } - - /** - * Get the data property: The data property. - * - * @return the data value. - */ - @Generated - public String getData() { - return this.data; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("data", this.data); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OutputData from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OutputData if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OutputData. - */ - @Generated - public static OutputData fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String data = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("data".equals(fieldName)) { - data = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new OutputData(data); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData3.java deleted file mode 100644 index ad4c6ae8522..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData3.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The OutputData3 model. - */ -@Immutable -public final class OutputData3 implements JsonSerializable { - /* - * The data property. - */ - @Generated - private final String data; - - /** - * Creates an instance of OutputData3 class. - * - * @param data the data value to set. - */ - @Generated - private OutputData3(String data) { - this.data = data; - } - - /** - * Get the data property: The data property. - * - * @return the data value. - */ - @Generated - public String getData() { - return this.data; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("data", this.data); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OutputData3 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OutputData3 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OutputData3. - */ - @Generated - public static OutputData3 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String data = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("data".equals(fieldName)) { - data = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new OutputData3(data); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource1.java deleted file mode 100644 index 1bbf9694d84..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource1.java +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Resource1 model. - */ -@Immutable -public final class Resource1 implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The outputData property. - */ - @Generated - private OutputData outputData; - - /* - * The outputData2 property. - */ - @Generated - private InputOutputData2 outputData2; - - /** - * Creates an instance of Resource1 class. - * - * @param name the name value to set. - */ - @Generated - public Resource1(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the outputData property: The outputData property. - * - * @return the outputData value. - */ - @Generated - public OutputData getOutputData() { - return this.outputData; - } - - /** - * Get the outputData2 property: The outputData2 property. - * - * @return the outputData2 value. - */ - @Generated - public InputOutputData2 getOutputData2() { - return this.outputData2; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Resource1 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Resource1 if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Resource1. - */ - @Generated - public static Resource1 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - OutputData outputData = null; - InputOutputData2 outputData2 = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("outputData".equals(fieldName)) { - outputData = OutputData.fromJson(reader); - } else if ("outputData2".equals(fieldName)) { - outputData2 = InputOutputData2.fromJson(reader); - } else { - reader.skipChildren(); - } - } - Resource1 deserializedResource1 = new Resource1(name); - deserializedResource1.outputData = outputData; - deserializedResource1.outputData2 = outputData2; - - return deserializedResource1; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource2.java deleted file mode 100644 index bc2dcaaa9a0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource2.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Resource2 model. - */ -@Immutable -public final class Resource2 implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The data2 property. - */ - @Generated - private final InputOutputData2 data2; - - /** - * Creates an instance of Resource2 class. - * - * @param name the name value to set. - * @param data2 the data2 value to set. - */ - @Generated - public Resource2(String name, InputOutputData2 data2) { - this.name = name; - this.data2 = data2; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the data2 property: The data2 property. - * - * @return the data2 value. - */ - @Generated - public InputOutputData2 getData2() { - return this.data2; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeJsonField("data2", this.data2); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Resource2 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Resource2 if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Resource2. - */ - @Generated - public static Resource2 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - InputOutputData2 data2 = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("data2".equals(fieldName)) { - data2 = InputOutputData2.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new Resource2(name, data2); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource3.java deleted file mode 100644 index 23b179f9036..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource3.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Resource3 model. - */ -@Immutable -public final class Resource3 implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The outputData3 property. - */ - @Generated - private final OutputData3 outputData3; - - /** - * Creates an instance of Resource3 class. - * - * @param name the name value to set. - * @param outputData3 the outputData3 value to set. - */ - @Generated - private Resource3(String name, OutputData3 outputData3) { - this.name = name; - this.outputData3 = outputData3; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the outputData3 property: The outputData3 property. - * - * @return the outputData3 value. - */ - @Generated - public OutputData3 getOutputData3() { - return this.outputData3; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeJsonField("outputData3", this.outputData3); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Resource3 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Resource3 if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Resource3. - */ - @Generated - public static Resource3 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - OutputData3 outputData3 = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("outputData3".equals(fieldName)) { - outputData3 = OutputData3.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new Resource3(name, outputData3); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/package-info.java deleted file mode 100644 index 09e49bd0333..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Model. - * - */ -package tsptest.model.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/package-info.java deleted file mode 100644 index e394ea46e00..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Model. - * - */ -package tsptest.model; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesAsyncClient.java deleted file mode 100644 index 5cd3c7365d5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesAsyncClient.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import reactor.core.publisher.Mono; -import tsptest.multicontenttypes.implementation.MultiContentTypesClientImpl; - -/** - * Initializes a new instance of the asynchronous MultiContentTypesClient type. - */ -@ServiceClient(builder = MultiContentTypesClientBuilder.class, isAsync = true) -public final class MultiContentTypesAsyncClient { - @Generated - private final MultiContentTypesClientImpl serviceClient; - - /** - * Initializes an instance of MultiContentTypesAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MultiContentTypesAsyncClient(MultiContentTypesClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * multiple data types map to multiple content types. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "text/plain", "application/json", - * "application/octet-stream", "image/jpeg", "image/png". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadWithOverloadWithResponse(String contentType, BinaryData data, - RequestOptions requestOptions) { - // Operation 'uploadWithOverload' can be invoked with multiple content-type. It is difficult to form a correct - // method signature for convenience API, and hence the convenience API is not generated. - return this.serviceClient.uploadWithOverloadWithResponseAsync(contentType, data, requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClient.java deleted file mode 100644 index 9648124a0cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClient.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.multicontenttypes.implementation.MultiContentTypesClientImpl; - -/** - * Initializes a new instance of the synchronous MultiContentTypesClient type. - */ -@ServiceClient(builder = MultiContentTypesClientBuilder.class) -public final class MultiContentTypesClient { - @Generated - private final MultiContentTypesClientImpl serviceClient; - - /** - * Initializes an instance of MultiContentTypesClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MultiContentTypesClient(MultiContentTypesClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * multiple data types map to multiple content types. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "text/plain", "application/json", - * "application/octet-stream", "image/jpeg", "image/png". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadWithOverloadWithResponse(String contentType, BinaryData data, - RequestOptions requestOptions) { - // Operation 'uploadWithOverload' can be invoked with multiple content-type. It is difficult to form a correct - // method signature for convenience API, and hence the convenience API is not generated. - return this.serviceClient.uploadWithOverloadWithResponse(contentType, data, requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClientBuilder.java deleted file mode 100644 index 19af583afa0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClientBuilder.java +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.multicontenttypes.implementation.MultiContentTypesClientImpl; - -/** - * A builder for creating a new instance of the MultiContentTypesClient type. - */ -@ServiceClientBuilder( - serviceClients = { - MultiContentTypesClient.class, - SingleContentTypeClient.class, - MultipleContentTypesOnRequestClient.class, - MultiContentTypesAsyncClient.class, - SingleContentTypeAsyncClient.class, - MultipleContentTypesOnRequestAsyncClient.class }) -public final class MultiContentTypesClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("tsptest-multicontenttypes.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the MultiContentTypesClientBuilder. - */ - @Generated - public MultiContentTypesClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiContentTypesClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiContentTypesClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiContentTypesClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiContentTypesClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiContentTypesClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiContentTypesClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiContentTypesClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultiContentTypesClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the MultiContentTypesClientBuilder. - */ - @Generated - public MultiContentTypesClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of MultiContentTypesClientImpl with the provided parameters. - * - * @return an instance of MultiContentTypesClientImpl. - */ - @Generated - private MultiContentTypesClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - MultiContentTypesClientImpl client = new MultiContentTypesClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of MultiContentTypesAsyncClient class. - * - * @return an instance of MultiContentTypesAsyncClient. - */ - @Generated - public MultiContentTypesAsyncClient buildAsyncClient() { - return new MultiContentTypesAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of SingleContentTypeAsyncClient class. - * - * @return an instance of SingleContentTypeAsyncClient. - */ - @Generated - public SingleContentTypeAsyncClient buildSingleContentTypeAsyncClient() { - return new SingleContentTypeAsyncClient(buildInnerClient().getSingleContentTypes()); - } - - /** - * Builds an instance of MultipleContentTypesOnRequestAsyncClient class. - * - * @return an instance of MultipleContentTypesOnRequestAsyncClient. - */ - @Generated - public MultipleContentTypesOnRequestAsyncClient buildMultipleContentTypesOnRequestAsyncClient() { - return new MultipleContentTypesOnRequestAsyncClient(buildInnerClient().getMultipleContentTypesOnRequests()); - } - - /** - * Builds an instance of MultiContentTypesClient class. - * - * @return an instance of MultiContentTypesClient. - */ - @Generated - public MultiContentTypesClient buildClient() { - return new MultiContentTypesClient(buildInnerClient()); - } - - /** - * Builds an instance of SingleContentTypeClient class. - * - * @return an instance of SingleContentTypeClient. - */ - @Generated - public SingleContentTypeClient buildSingleContentTypeClient() { - return new SingleContentTypeClient(buildInnerClient().getSingleContentTypes()); - } - - /** - * Builds an instance of MultipleContentTypesOnRequestClient class. - * - * @return an instance of MultipleContentTypesOnRequestClient. - */ - @Generated - public MultipleContentTypesOnRequestClient buildMultipleContentTypesOnRequestClient() { - return new MultipleContentTypesOnRequestClient(buildInnerClient().getMultipleContentTypesOnRequests()); - } - - private static final ClientLogger LOGGER = new ClientLogger(MultiContentTypesClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestAsyncClient.java deleted file mode 100644 index 61c77a150ab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestAsyncClient.java +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.multicontenttypes.implementation.MultipleContentTypesOnRequestsImpl; -import tsptest.multicontenttypes.models.Resource; - -/** - * Initializes a new instance of the asynchronous MultiContentTypesClient type. - */ -@ServiceClient(builder = MultiContentTypesClientBuilder.class, isAsync = true) -public final class MultipleContentTypesOnRequestAsyncClient { - @Generated - private final MultipleContentTypesOnRequestsImpl serviceClient; - - /** - * Initializes an instance of MultipleContentTypesOnRequestAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MultipleContentTypesOnRequestAsyncClient(MultipleContentTypesOnRequestsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * one data type maps to multiple content types. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", - * "image/png", "application/json-patch+json". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadBytesWithSingleBodyTypeForMultiContentTypesWithResponse(String contentType, - BinaryData data, RequestOptions requestOptions) { - // Operation 'uploadBytesWithSingleBodyTypeForMultiContentTypes' can be invoked with multiple content-type. It - // is difficult to form a correct method signature for convenience API, and hence the convenience API is not - // generated. - return this.serviceClient.uploadBytesWithSingleBodyTypeForMultiContentTypesWithResponseAsync(contentType, data, - requestOptions); - } - - /** - * multiple data types map to multiple content types using shared route. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", - * "image/png". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType, - BinaryData data, RequestOptions requestOptions) { - // Operation 'uploadBytesWithMultiBodyTypesForMultiContentTypes' can be invoked with multiple content-type. It - // is difficult to form a correct method signature for convenience API, and hence the convenience API is not - // generated. - return this.serviceClient.uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponseAsync(contentType, data, - requestOptions); - } - - /** - * multiple data types map to multiple content types using shared route. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse(BinaryData data, - RequestOptions requestOptions) { - return this.serviceClient.uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponseAsync(data, - requestOptions); - } - - /** - * multiple data types map to multiple content types using shared route. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "application/json", "application/octet-stream", - * "image/jpeg", "image/png". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType, - BinaryData data, RequestOptions requestOptions) { - // Operation 'uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypes' can be invoked with multiple - // content-type. It is difficult to form a correct method signature for convenience API, and hence the - // convenience API is not generated. - return this.serviceClient.uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesWithResponseAsync(contentType, - data, requestOptions); - } - - /** - * multiple data types map to multiple content types using shared route. - * - * @param data The data parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadJsonWithMultiBodyTypesForMultiContentTypes(Resource data) { - // Generated convenience method for uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse - RequestOptions requestOptions = new RequestOptions(); - return uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse(BinaryData.fromObject(data), requestOptions) - .flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestClient.java deleted file mode 100644 index 4756ef09f19..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestClient.java +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.multicontenttypes.implementation.MultipleContentTypesOnRequestsImpl; -import tsptest.multicontenttypes.models.Resource; - -/** - * Initializes a new instance of the synchronous MultiContentTypesClient type. - */ -@ServiceClient(builder = MultiContentTypesClientBuilder.class) -public final class MultipleContentTypesOnRequestClient { - @Generated - private final MultipleContentTypesOnRequestsImpl serviceClient; - - /** - * Initializes an instance of MultipleContentTypesOnRequestClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MultipleContentTypesOnRequestClient(MultipleContentTypesOnRequestsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * one data type maps to multiple content types. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", - * "image/png", "application/json-patch+json". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadBytesWithSingleBodyTypeForMultiContentTypesWithResponse(String contentType, - BinaryData data, RequestOptions requestOptions) { - // Operation 'uploadBytesWithSingleBodyTypeForMultiContentTypes' can be invoked with multiple content-type. It - // is difficult to form a correct method signature for convenience API, and hence the convenience API is not - // generated. - return this.serviceClient.uploadBytesWithSingleBodyTypeForMultiContentTypesWithResponse(contentType, data, - requestOptions); - } - - /** - * multiple data types map to multiple content types using shared route. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", - * "image/png". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType, - BinaryData data, RequestOptions requestOptions) { - // Operation 'uploadBytesWithMultiBodyTypesForMultiContentTypes' can be invoked with multiple content-type. It - // is difficult to form a correct method signature for convenience API, and hence the convenience API is not - // generated. - return this.serviceClient.uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponse(contentType, data, - requestOptions); - } - - /** - * multiple data types map to multiple content types using shared route. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse(BinaryData data, - RequestOptions requestOptions) { - return this.serviceClient.uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse(data, requestOptions); - } - - /** - * multiple data types map to multiple content types using shared route. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "application/json", "application/octet-stream", - * "image/jpeg", "image/png". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType, - BinaryData data, RequestOptions requestOptions) { - // Operation 'uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypes' can be invoked with multiple - // content-type. It is difficult to form a correct method signature for convenience API, and hence the - // convenience API is not generated. - return this.serviceClient.uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesWithResponse(contentType, data, - requestOptions); - } - - /** - * multiple data types map to multiple content types using shared route. - * - * @param data The data parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void uploadJsonWithMultiBodyTypesForMultiContentTypes(Resource data) { - // Generated convenience method for uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse - RequestOptions requestOptions = new RequestOptions(); - uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse(BinaryData.fromObject(data), requestOptions) - .getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeAsyncClient.java deleted file mode 100644 index adbde39c36e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeAsyncClient.java +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.multicontenttypes.implementation.SingleContentTypesImpl; - -/** - * Initializes a new instance of the asynchronous MultiContentTypesClient type. - */ -@ServiceClient(builder = MultiContentTypesClientBuilder.class, isAsync = true) -public final class SingleContentTypeAsyncClient { - @Generated - private final SingleContentTypesImpl serviceClient; - - /** - * Initializes an instance of SingleContentTypeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SingleContentTypeAsyncClient(SingleContentTypesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * response is binary. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> downloadImageForSingleContentTypeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.downloadImageForSingleContentTypeWithResponseAsync(requestOptions); - } - - /** - * request is binary. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadImageForSingleContentTypeWithResponse(BinaryData data, - RequestOptions requestOptions) { - return this.serviceClient.uploadImageForSingleContentTypeWithResponseAsync(data, requestOptions); - } - - /** - * response is binary. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono downloadImageForSingleContentType() { - // Generated convenience method for downloadImageForSingleContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return downloadImageForSingleContentTypeWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * request is binary. - * - * @param data The data parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadImageForSingleContentType(BinaryData data) { - // Generated convenience method for uploadImageForSingleContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return uploadImageForSingleContentTypeWithResponse(data, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeClient.java deleted file mode 100644 index a31f6b5dbf3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeClient.java +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.multicontenttypes.implementation.SingleContentTypesImpl; - -/** - * Initializes a new instance of the synchronous MultiContentTypesClient type. - */ -@ServiceClient(builder = MultiContentTypesClientBuilder.class) -public final class SingleContentTypeClient { - @Generated - private final SingleContentTypesImpl serviceClient; - - /** - * Initializes an instance of SingleContentTypeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SingleContentTypeClient(SingleContentTypesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * response is binary. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response downloadImageForSingleContentTypeWithResponse(RequestOptions requestOptions) { - return this.serviceClient.downloadImageForSingleContentTypeWithResponse(requestOptions); - } - - /** - * request is binary. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadImageForSingleContentTypeWithResponse(BinaryData data, RequestOptions requestOptions) { - return this.serviceClient.uploadImageForSingleContentTypeWithResponse(data, requestOptions); - } - - /** - * response is binary. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData downloadImageForSingleContentType() { - // Generated convenience method for downloadImageForSingleContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - return downloadImageForSingleContentTypeWithResponse(requestOptions).getValue(); - } - - /** - * request is binary. - * - * @param data The data parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void uploadImageForSingleContentType(BinaryData data) { - // Generated convenience method for uploadImageForSingleContentTypeWithResponse - RequestOptions requestOptions = new RequestOptions(); - uploadImageForSingleContentTypeWithResponse(data, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultiContentTypesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultiContentTypesClientImpl.java deleted file mode 100644 index b673c499564..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultiContentTypesClientImpl.java +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the MultiContentTypesClient type. - */ -public final class MultiContentTypesClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MultiContentTypesClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 SingleContentTypesImpl object to access its operations. - */ - private final SingleContentTypesImpl singleContentTypes; - - /** - * Gets the SingleContentTypesImpl object to access its operations. - * - * @return the SingleContentTypesImpl object. - */ - public SingleContentTypesImpl getSingleContentTypes() { - return this.singleContentTypes; - } - - /** - * The MultipleContentTypesOnRequestsImpl object to access its operations. - */ - private final MultipleContentTypesOnRequestsImpl multipleContentTypesOnRequests; - - /** - * Gets the MultipleContentTypesOnRequestsImpl object to access its operations. - * - * @return the MultipleContentTypesOnRequestsImpl object. - */ - public MultipleContentTypesOnRequestsImpl getMultipleContentTypesOnRequests() { - return this.multipleContentTypesOnRequests; - } - - /** - * Initializes an instance of MultiContentTypesClient client. - * - * @param endpoint Service host. - */ - public MultiContentTypesClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of MultiContentTypesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public MultiContentTypesClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of MultiContentTypesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public MultiContentTypesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.singleContentTypes = new SingleContentTypesImpl(this); - this.multipleContentTypesOnRequests = new MultipleContentTypesOnRequestsImpl(this); - this.service - = RestProxy.create(MultiContentTypesClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for MultiContentTypesClient to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MultiContentTypesClient") - public interface MultiContentTypesClientService { - @Post("/upload/overload/multi-body-types") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> uploadWithOverload(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, - RequestOptions requestOptions, Context context); - - @Post("/upload/overload/multi-body-types") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response uploadWithOverloadSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, - RequestOptions requestOptions, Context context); - } - - /** - * multiple data types map to multiple content types. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "text/plain", "application/json", - * "application/octet-stream", "image/jpeg", "image/png". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadWithOverloadWithResponseAsync(String contentType, BinaryData data, - RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.uploadWithOverload(this.getEndpoint(), contentType, data, requestOptions, context)); - } - - /** - * multiple data types map to multiple content types. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "text/plain", "application/json", - * "application/octet-stream", "image/jpeg", "image/png". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadWithOverloadWithResponse(String contentType, BinaryData data, - RequestOptions requestOptions) { - return service.uploadWithOverloadSync(this.getEndpoint(), contentType, data, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java deleted file mode 100644 index eee0c3448f0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in MultipleContentTypesOnRequests. - */ -public final class MultipleContentTypesOnRequestsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MultipleContentTypesOnRequestsService service; - - /** - * The service client containing this operation class. - */ - private final MultiContentTypesClientImpl client; - - /** - * Initializes an instance of MultipleContentTypesOnRequestsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - MultipleContentTypesOnRequestsImpl(MultiContentTypesClientImpl client) { - this.service = RestProxy.create(MultipleContentTypesOnRequestsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for MultiContentTypesClientMultipleContentTypesOnRequests to be used by - * the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MultiContentTypesClientMultipleContentTypesOnRequests") - public interface MultipleContentTypesOnRequestsService { - @Post("/multiple/sharedroute/request/upload/single-body-type") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> uploadBytesWithSingleBodyTypeForMultiContentTypes(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, - RequestOptions requestOptions, Context context); - - @Post("/multiple/sharedroute/request/upload/single-body-type") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response uploadBytesWithSingleBodyTypeForMultiContentTypesSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, - RequestOptions requestOptions, Context context); - - @Post("/multiple/sharedroute/request/upload/multi-body-types") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> uploadBytesWithMultiBodyTypesForMultiContentTypes(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, - RequestOptions requestOptions, Context context); - - @Post("/multiple/sharedroute/request/upload/multi-body-types") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response uploadBytesWithMultiBodyTypesForMultiContentTypesSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, - RequestOptions requestOptions, Context context); - - @Post("/multiple/sharedroute/request/upload/multi-body-types") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> uploadJsonWithMultiBodyTypesForMultiContentTypes(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, - RequestOptions requestOptions, Context context); - - @Post("/multiple/sharedroute/request/upload/multi-body-types") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response uploadJsonWithMultiBodyTypesForMultiContentTypesSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, - RequestOptions requestOptions, Context context); - - @Post("/multiple/sharedroute/request/upload/multi-body-types") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypes( - @HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, - @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); - - @Post("/multiple/sharedroute/request/upload/multi-body-types") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesSync( - @HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, - @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); - } - - /** - * one data type maps to multiple content types. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", - * "image/png", "application/json-patch+json". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadBytesWithSingleBodyTypeForMultiContentTypesWithResponseAsync(String contentType, - BinaryData data, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.uploadBytesWithSingleBodyTypeForMultiContentTypes(this.client.getEndpoint(), - contentType, data, requestOptions, context)); - } - - /** - * one data type maps to multiple content types. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", - * "image/png", "application/json-patch+json". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadBytesWithSingleBodyTypeForMultiContentTypesWithResponse(String contentType, - BinaryData data, RequestOptions requestOptions) { - return service.uploadBytesWithSingleBodyTypeForMultiContentTypesSync(this.client.getEndpoint(), contentType, - data, requestOptions, Context.NONE); - } - - /** - * multiple data types map to multiple content types using shared route. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", - * "image/png". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponseAsync(String contentType, - BinaryData data, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.uploadBytesWithMultiBodyTypesForMultiContentTypes(this.client.getEndpoint(), - contentType, data, requestOptions, context)); - } - - /** - * multiple data types map to multiple content types using shared route. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", - * "image/png". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType, - BinaryData data, RequestOptions requestOptions) { - return service.uploadBytesWithMultiBodyTypesForMultiContentTypesSync(this.client.getEndpoint(), contentType, - data, requestOptions, Context.NONE); - } - - /** - * multiple data types map to multiple content types using shared route. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponseAsync(BinaryData data, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.uploadJsonWithMultiBodyTypesForMultiContentTypes(this.client.getEndpoint(), - contentType, data, requestOptions, context)); - } - - /** - * multiple data types map to multiple content types using shared route. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse(BinaryData data, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.uploadJsonWithMultiBodyTypesForMultiContentTypesSync(this.client.getEndpoint(), contentType, - data, requestOptions, Context.NONE); - } - - /** - * multiple data types map to multiple content types using shared route. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "application/json", "application/octet-stream", - * "image/jpeg", "image/png". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesWithResponseAsync( - String contentType, BinaryData data, RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypes( - this.client.getEndpoint(), contentType, data, requestOptions, context)); - } - - /** - * multiple data types map to multiple content types using shared route. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param contentType The contentType parameter. Allowed values: "application/json", "application/octet-stream", - * "image/jpeg", "image/png". - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType, - BinaryData data, RequestOptions requestOptions) { - return service.uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesSync(this.client.getEndpoint(), - contentType, data, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/SingleContentTypesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/SingleContentTypesImpl.java deleted file mode 100644 index a5ff02e2145..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/SingleContentTypesImpl.java +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SingleContentTypes. - */ -public final class SingleContentTypesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SingleContentTypesService service; - - /** - * The service client containing this operation class. - */ - private final MultiContentTypesClientImpl client; - - /** - * Initializes an instance of SingleContentTypesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SingleContentTypesImpl(MultiContentTypesClientImpl client) { - this.service = RestProxy.create(SingleContentTypesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for MultiContentTypesClientSingleContentTypes to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MultiContentTypesClientSingleContentTypes") - public interface SingleContentTypesService { - @Get("/single/request/download/image") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> downloadImageForSingleContentType(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/single/request/download/image") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response downloadImageForSingleContentTypeSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/single/request/upload/image") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> uploadImageForSingleContentType(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("image/png") BinaryData data, - RequestOptions requestOptions, Context context); - - @Post("/single/request/upload/image") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response uploadImageForSingleContentTypeSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("image/png") BinaryData data, - RequestOptions requestOptions, Context context); - } - - /** - * response is binary. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - downloadImageForSingleContentTypeWithResponseAsync(RequestOptions requestOptions) { - final String accept = "image/png"; - return FluxUtil.withContext(context -> service.downloadImageForSingleContentType(this.client.getEndpoint(), - accept, requestOptions, context)); - } - - /** - * response is binary. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response downloadImageForSingleContentTypeWithResponse(RequestOptions requestOptions) { - final String accept = "image/png"; - return service.downloadImageForSingleContentTypeSync(this.client.getEndpoint(), accept, requestOptions, - Context.NONE); - } - - /** - * request is binary. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadImageForSingleContentTypeWithResponseAsync(BinaryData data, - RequestOptions requestOptions) { - final String contentType = "image/png"; - return FluxUtil.withContext(context -> service.uploadImageForSingleContentType(this.client.getEndpoint(), - contentType, data, requestOptions, context)); - } - - /** - * request is binary. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadImageForSingleContentTypeWithResponse(BinaryData data, RequestOptions requestOptions) { - final String contentType = "image/png"; - return service.uploadImageForSingleContentTypeSync(this.client.getEndpoint(), contentType, data, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/package-info.java deleted file mode 100644 index 6734c6f872b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for MultiContentTypes. - * - */ -package tsptest.multicontenttypes.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/Resource.java deleted file mode 100644 index 3f041405616..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/Resource.java +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Resource model. - */ -@Immutable -public final class Resource implements JsonSerializable { - /* - * The id property. - */ - @Generated - private String id; - - /* - * The name property. - */ - @Generated - private String name; - - /** - * Creates an instance of Resource class. - */ - @Generated - public Resource() { - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Resource from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Resource. - */ - @Generated - public static Resource fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Resource deserializedResource = new Resource(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedResource.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedResource.name = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedResource; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/package-info.java deleted file mode 100644 index f5276e194b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for MultiContentTypes. - * - */ -package tsptest.multicontenttypes.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/package-info.java deleted file mode 100644 index f4ba7682f63..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for MultiContentTypes. - * - */ -package tsptest.multicontenttypes; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartAsyncClient.java deleted file mode 100644 index f8d8b2ba647..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartAsyncClient.java +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import java.util.Objects; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; -import tsptest.multipart.implementation.MultipartClientImpl; -import tsptest.multipart.implementation.MultipartFormDataHelper; -import tsptest.multipart.models.FileDataFileDetails; -import tsptest.multipart.models.FormData; -import tsptest.multipart.models.UploadHttpPartRequest; - -/** - * Initializes a new instance of the asynchronous MultipartClient type. - */ -@ServiceClient(builder = MultipartClientBuilder.class, isAsync = true) -public final class MultipartAsyncClient { - @Generated - private final MultipartClientImpl serviceClient; - - /** - * Initializes an instance of MultipartAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MultipartAsyncClient(MultipartClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The upload operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param name The name parameter. - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> uploadWithResponse(String name, BinaryData data, RequestOptions requestOptions) { - // Operation 'upload' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not - // generated. - return this.serviceClient.uploadWithResponseAsync(name, data, requestOptions); - } - - /** - * The uploadHttpPart operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param name The name parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> uploadHttpPartWithResponse(String name, BinaryData body, RequestOptions requestOptions) { - // Operation 'uploadHttpPart' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not - // generated. - return this.serviceClient.uploadHttpPartWithResponseAsync(name, body, requestOptions); - } - - /** - * The upload operation. - * - * @param name The name parameter. - * @param data The data parameter. - * @param compress The compress parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono upload(String name, FormData data, Boolean compress) { - // Generated convenience method for uploadWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (compress != null) { - requestOptions.addQueryParam("compress", String.valueOf(compress), false); - } - return uploadWithResponse(name, new MultipartFormDataHelper(requestOptions) - .serializeTextField("name", data.getName()) - .serializeTextField("resolution", String.valueOf(data.getResolution())) - .serializeTextField("type", Objects.toString(data.getType())) - .serializeJsonField("size", data.getSize()) - .serializeFileField("image", data.getImage().getContent(), data.getImage().getContentType(), - data.getImage().getFilename()) - .serializeFileFields("fileData", - data.getFileData() == null - ? null - : data.getFileData().stream().map(FileDataFileDetails::getContent).collect(Collectors.toList()), - data.getFileData() == null - ? null - : data.getFileData().stream().map(FileDataFileDetails::getContentType).collect(Collectors.toList()), - data.getFileData() == null - ? null - : data.getFileData().stream().map(FileDataFileDetails::getFilename).collect(Collectors.toList())) - .end() - .getRequestBody(), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The upload operation. - * - * @param name The name parameter. - * @param data The data parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono upload(String name, FormData data) { - // Generated convenience method for uploadWithResponse - RequestOptions requestOptions = new RequestOptions(); - return uploadWithResponse(name, new MultipartFormDataHelper(requestOptions) - .serializeTextField("name", data.getName()) - .serializeTextField("resolution", String.valueOf(data.getResolution())) - .serializeTextField("type", Objects.toString(data.getType())) - .serializeJsonField("size", data.getSize()) - .serializeFileField("image", data.getImage().getContent(), data.getImage().getContentType(), - data.getImage().getFilename()) - .serializeFileFields("fileData", - data.getFileData() == null - ? null - : data.getFileData().stream().map(FileDataFileDetails::getContent).collect(Collectors.toList()), - data.getFileData() == null - ? null - : data.getFileData().stream().map(FileDataFileDetails::getContentType).collect(Collectors.toList()), - data.getFileData() == null - ? null - : data.getFileData().stream().map(FileDataFileDetails::getFilename).collect(Collectors.toList())) - .end() - .getRequestBody(), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The uploadHttpPart operation. - * - * @param name The name parameter. - * @param body The body parameter. - * @param compress The compress parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadHttpPart(String name, UploadHttpPartRequest body, Boolean compress) { - // Generated convenience method for uploadHttpPartWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (compress != null) { - requestOptions.addQueryParam("compress", String.valueOf(compress), false); - } - return uploadHttpPartWithResponse(name, - new MultipartFormDataHelper(requestOptions) - .serializeFileField("fileData1", body.getFileData1().getContent(), body.getFileData1().getContentType(), - body.getFileData1().getFilename()) - .serializeFileField("file_data2", body.getFileData2().getContent(), - body.getFileData2().getContentType(), body.getFileData2().getFilename()) - .serializeJsonField("size", body.getSize()) - .end() - .getRequestBody(), - requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The uploadHttpPart operation. - * - * @param name The name parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadHttpPart(String name, UploadHttpPartRequest body) { - // Generated convenience method for uploadHttpPartWithResponse - RequestOptions requestOptions = new RequestOptions(); - return uploadHttpPartWithResponse(name, - new MultipartFormDataHelper(requestOptions) - .serializeFileField("fileData1", body.getFileData1().getContent(), body.getFileData1().getContentType(), - body.getFileData1().getFilename()) - .serializeFileField("file_data2", body.getFileData2().getContent(), - body.getFileData2().getContentType(), body.getFileData2().getFilename()) - .serializeJsonField("size", body.getSize()) - .end() - .getRequestBody(), - requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClient.java deleted file mode 100644 index e40db34a66c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClient.java +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import java.util.Objects; -import java.util.stream.Collectors; -import tsptest.multipart.implementation.MultipartClientImpl; -import tsptest.multipart.implementation.MultipartFormDataHelper; -import tsptest.multipart.models.FileDataFileDetails; -import tsptest.multipart.models.FormData; -import tsptest.multipart.models.UploadHttpPartRequest; - -/** - * Initializes a new instance of the synchronous MultipartClient type. - */ -@ServiceClient(builder = MultipartClientBuilder.class) -public final class MultipartClient { - @Generated - private final MultipartClientImpl serviceClient; - - /** - * Initializes an instance of MultipartClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MultipartClient(MultipartClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The upload operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param name The name parameter. - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response uploadWithResponse(String name, BinaryData data, RequestOptions requestOptions) { - // Operation 'upload' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not - // generated. - return this.serviceClient.uploadWithResponse(name, data, requestOptions); - } - - /** - * The uploadHttpPart operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param name The name parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response uploadHttpPartWithResponse(String name, BinaryData body, RequestOptions requestOptions) { - // Operation 'uploadHttpPart' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not - // generated. - return this.serviceClient.uploadHttpPartWithResponse(name, body, requestOptions); - } - - /** - * The upload operation. - * - * @param name The name parameter. - * @param data The data parameter. - * @param compress The compress parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void upload(String name, FormData data, Boolean compress) { - // Generated convenience method for uploadWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (compress != null) { - requestOptions.addQueryParam("compress", String.valueOf(compress), false); - } - uploadWithResponse(name, new MultipartFormDataHelper(requestOptions).serializeTextField("name", data.getName()) - .serializeTextField("resolution", String.valueOf(data.getResolution())) - .serializeTextField("type", Objects.toString(data.getType())) - .serializeJsonField("size", data.getSize()) - .serializeFileField("image", data.getImage().getContent(), data.getImage().getContentType(), - data.getImage().getFilename()) - .serializeFileFields("fileData", - data.getFileData() == null - ? null - : data.getFileData().stream().map(FileDataFileDetails::getContent).collect(Collectors.toList()), - data.getFileData() == null - ? null - : data.getFileData().stream().map(FileDataFileDetails::getContentType).collect(Collectors.toList()), - data.getFileData() == null - ? null - : data.getFileData().stream().map(FileDataFileDetails::getFilename).collect(Collectors.toList())) - .end() - .getRequestBody(), requestOptions).getValue(); - } - - /** - * The upload operation. - * - * @param name The name parameter. - * @param data The data parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void upload(String name, FormData data) { - // Generated convenience method for uploadWithResponse - RequestOptions requestOptions = new RequestOptions(); - uploadWithResponse(name, new MultipartFormDataHelper(requestOptions).serializeTextField("name", data.getName()) - .serializeTextField("resolution", String.valueOf(data.getResolution())) - .serializeTextField("type", Objects.toString(data.getType())) - .serializeJsonField("size", data.getSize()) - .serializeFileField("image", data.getImage().getContent(), data.getImage().getContentType(), - data.getImage().getFilename()) - .serializeFileFields("fileData", - data.getFileData() == null - ? null - : data.getFileData().stream().map(FileDataFileDetails::getContent).collect(Collectors.toList()), - data.getFileData() == null - ? null - : data.getFileData().stream().map(FileDataFileDetails::getContentType).collect(Collectors.toList()), - data.getFileData() == null - ? null - : data.getFileData().stream().map(FileDataFileDetails::getFilename).collect(Collectors.toList())) - .end() - .getRequestBody(), requestOptions).getValue(); - } - - /** - * The uploadHttpPart operation. - * - * @param name The name parameter. - * @param body The body parameter. - * @param compress The compress parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void uploadHttpPart(String name, UploadHttpPartRequest body, Boolean compress) { - // Generated convenience method for uploadHttpPartWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (compress != null) { - requestOptions.addQueryParam("compress", String.valueOf(compress), false); - } - uploadHttpPartWithResponse(name, - new MultipartFormDataHelper(requestOptions) - .serializeFileField("fileData1", body.getFileData1().getContent(), body.getFileData1().getContentType(), - body.getFileData1().getFilename()) - .serializeFileField("file_data2", body.getFileData2().getContent(), - body.getFileData2().getContentType(), body.getFileData2().getFilename()) - .serializeJsonField("size", body.getSize()) - .end() - .getRequestBody(), - requestOptions).getValue(); - } - - /** - * The uploadHttpPart operation. - * - * @param name The name parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void uploadHttpPart(String name, UploadHttpPartRequest body) { - // Generated convenience method for uploadHttpPartWithResponse - RequestOptions requestOptions = new RequestOptions(); - uploadHttpPartWithResponse(name, - new MultipartFormDataHelper(requestOptions) - .serializeFileField("fileData1", body.getFileData1().getContent(), body.getFileData1().getContentType(), - body.getFileData1().getFilename()) - .serializeFileField("file_data2", body.getFileData2().getContent(), - body.getFileData2().getContentType(), body.getFileData2().getFilename()) - .serializeJsonField("size", body.getSize()) - .end() - .getRequestBody(), - requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClientBuilder.java deleted file mode 100644 index 97c48ebc795..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.multipart.implementation.MultipartClientImpl; - -/** - * A builder for creating a new instance of the MultipartClient type. - */ -@ServiceClientBuilder(serviceClients = { MultipartClient.class, MultipartAsyncClient.class }) -public final class MultipartClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-multipart.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the MultipartClientBuilder. - */ - @Generated - public MultipartClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipartClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipartClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipartClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipartClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipartClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipartClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipartClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MultipartClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the MultipartClientBuilder. - */ - @Generated - public MultipartClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of MultipartClientImpl with the provided parameters. - * - * @return an instance of MultipartClientImpl. - */ - @Generated - private MultipartClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - MultipartClientImpl client - = new MultipartClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of MultipartAsyncClient class. - * - * @return an instance of MultipartAsyncClient. - */ - @Generated - public MultipartAsyncClient buildAsyncClient() { - return new MultipartAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of MultipartClient class. - * - * @return an instance of MultipartClient. - */ - @Generated - public MultipartClient buildClient() { - return new MultipartClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(MultipartClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartClientImpl.java deleted file mode 100644 index ab3d2218895..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartClientImpl.java +++ /dev/null @@ -1,275 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the MultipartClient type. - */ -public final class MultipartClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MultipartClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of MultipartClient client. - * - * @param endpoint Service host. - */ - public MultipartClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of MultipartClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public MultipartClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of MultipartClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public MultipartClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(MultipartClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for MultipartClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "MultipartClient") - public interface MultipartClientService { - // @Multipart not supported by RestProxy - @Post("/upload/images/{name}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> upload(@HostParam("endpoint") String endpoint, @PathParam("name") String name, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData data, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/upload/images/{name}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response uploadSync(@HostParam("endpoint") String endpoint, @PathParam("name") String name, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData data, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/uploadHttpPart/images/{name}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> uploadHttpPart(@HostParam("endpoint") String endpoint, @PathParam("name") String name, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - - // @Multipart not supported by RestProxy - @Post("/uploadHttpPart/images/{name}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response uploadHttpPartSync(@HostParam("endpoint") String endpoint, @PathParam("name") String name, - @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The upload operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param name The name parameter. - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadWithResponseAsync(String name, BinaryData data, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext( - context -> service.upload(this.getEndpoint(), name, contentType, data, requestOptions, context)); - } - - /** - * The upload operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param name The name parameter. - * @param data The data parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadWithResponse(String name, BinaryData data, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.uploadSync(this.getEndpoint(), name, contentType, data, requestOptions, Context.NONE); - } - - /** - * The uploadHttpPart operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param name The name parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadHttpPartWithResponseAsync(String name, BinaryData body, - RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return FluxUtil.withContext( - context -> service.uploadHttpPart(this.getEndpoint(), name, contentType, body, requestOptions, context)); - } - - /** - * The uploadHttpPart operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param name The name parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadHttpPartWithResponse(String name, BinaryData body, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; - return service.uploadHttpPartSync(this.getEndpoint(), name, contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartFormDataHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartFormDataHelper.java deleted file mode 100644 index c6bd09ee567..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartFormDataHelper.java +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart.implementation; - -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.core.util.CoreUtils; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.SequenceInputStream; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.UUID; - -// DO NOT modify this helper class - -public final class MultipartFormDataHelper { - /** - * Line separator for the multipart HTTP request. - */ - private static final String CRLF = "\r\n"; - - private static final String APPLICATION_OCTET_STREAM = "application/octet-stream"; - - /** - * Value to be used as part of the divider for the multipart requests. - */ - private final String boundary; - - /** - * The actual part separator in the request. This is obtained by prepending "--" to the "boundary". - */ - private final String partSeparator; - - /** - * The marker for the ending of a multipart request. This is obtained by post-pending "--" to the "partSeparator". - */ - private final String endMarker; - - /** - * Charset used for encoding the multipart HTTP request. - */ - private final Charset encoderCharset = StandardCharsets.UTF_8; - - private InputStream requestDataStream = new ByteArrayInputStream(new byte[0]); - private long requestLength = 0; - - private RequestOptions requestOptions; - private BinaryData requestBody; - - /** - * Default constructor used in the code. The boundary is a random value. - * - * @param requestOptions the RequestOptions to update - */ - public MultipartFormDataHelper(RequestOptions requestOptions) { - this(requestOptions, UUID.randomUUID().toString().substring(0, 16)); - } - - private MultipartFormDataHelper(RequestOptions requestOptions, String boundary) { - this.requestOptions = requestOptions; - this.boundary = boundary; - this.partSeparator = "--" + boundary; - this.endMarker = this.partSeparator + "--"; - } - - /** - * Gets the multipart HTTP request body. - * - * @return the BinaryData of the multipart HTTP request body - */ - public BinaryData getRequestBody() { - return requestBody; - } - - // text/plain - /** - * Formats a text/plain field for a multipart HTTP request. - * - * @param fieldName the field name - * @param value the value of the text/plain field - * @return the MultipartFormDataHelper instance - */ - public MultipartFormDataHelper serializeTextField(String fieldName, String value) { - if (value != null) { - String serialized = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) - + "\"" + CRLF + CRLF + value + CRLF; - byte[] data = serialized.getBytes(encoderCharset); - appendBytes(data); - } - return this; - } - - // application/json - /** - * Formats a application/json field for a multipart HTTP request. - * - * @param fieldName the field name - * @param jsonObject the object of the application/json field - * @return the MultipartFormDataHelper instance - */ - public MultipartFormDataHelper serializeJsonField(String fieldName, Object jsonObject) { - if (jsonObject != null) { - String serialized - = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + "\"" + CRLF - + "Content-Type: application/json" + CRLF + CRLF + BinaryData.fromObject(jsonObject) + CRLF; - byte[] data = serialized.getBytes(encoderCharset); - appendBytes(data); - } - return this; - } - - /** - * Formats a file field for a multipart HTTP request. - * - * @param fieldName the field name - * @param file the BinaryData of the file - * @param contentType the content-type of the file - * @param filename the filename - * @return the MultipartFormDataHelper instance - */ - public MultipartFormDataHelper serializeFileField(String fieldName, BinaryData file, String contentType, - String filename) { - if (file != null) { - if (CoreUtils.isNullOrEmpty(contentType)) { - contentType = APPLICATION_OCTET_STREAM; - } - writeFileField(fieldName, file, contentType, filename); - } - return this; - } - - /** - * Formats a file field (potentially multiple files) for a multipart HTTP request. - * - * @param fieldName the field name - * @param files the List of BinaryData of the files - * @param contentTypes the List of content-type of the files - * @param filenames the List of filenames - * @return the MultipartFormDataHelper instance - */ - public MultipartFormDataHelper serializeFileFields(String fieldName, List files, - List contentTypes, List filenames) { - if (files != null) { - for (int i = 0; i < files.size(); ++i) { - BinaryData file = files.get(i); - String contentType = contentTypes.get(i); - if (CoreUtils.isNullOrEmpty(contentType)) { - contentType = APPLICATION_OCTET_STREAM; - } - String filename = filenames.get(i); - writeFileField(fieldName, file, contentType, filename); - } - } - return this; - } - - /** - * Ends the serialization of the multipart HTTP request. - * - * @return the MultipartFormDataHelper instance - */ - public MultipartFormDataHelper end() { - byte[] data = endMarker.getBytes(encoderCharset); - appendBytes(data); - - requestBody = BinaryData.fromStream(requestDataStream, requestLength); - - requestOptions.setHeader(HttpHeaderName.CONTENT_TYPE, "multipart/form-data; boundary=" + this.boundary) - .setHeader(HttpHeaderName.CONTENT_LENGTH, String.valueOf(requestLength)); - - return this; - } - - private void writeFileField(String fieldName, BinaryData file, String contentType, String filename) { - String contentDispositionFilename = ""; - if (!CoreUtils.isNullOrEmpty(filename)) { - contentDispositionFilename = "; filename=\"" + escapeName(filename) + "\""; - } - - // Multipart preamble - String fileFieldPreamble - = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + "\"" - + contentDispositionFilename + CRLF + "Content-Type: " + contentType + CRLF + CRLF; - byte[] data = fileFieldPreamble.getBytes(encoderCharset); - appendBytes(data); - - // Writing the file into the request as a byte stream - requestLength += file.getLength(); - requestDataStream = new SequenceInputStream(requestDataStream, file.toStream()); - - // CRLF - data = CRLF.getBytes(encoderCharset); - appendBytes(data); - } - - private void appendBytes(byte[] bytes) { - requestLength += bytes.length; - requestDataStream = new SequenceInputStream(requestDataStream, new ByteArrayInputStream(bytes)); - } - - private static String escapeName(String name) { - return name.replace("\n", "%0A").replace("\r", "%0D").replace("\"", "%22"); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/package-info.java deleted file mode 100644 index 4ecfe2e7d5b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Multipart. - * - */ -package tsptest.multipart.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDataFileDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDataFileDetails.java deleted file mode 100644 index 462efb7cb3f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDataFileDetails.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; - -/** - * The file details for the "fileData" field. - */ -@Fluent -public final class FileDataFileDetails { - /* - * The content of the file. - */ - @Generated - private final BinaryData content; - - /* - * The filename of the file. - */ - @Generated - private String filename; - - /* - * The content-type of the file. - */ - @Generated - private String contentType = "application/octet-stream"; - - /** - * Creates an instance of FileDataFileDetails class. - * - * @param content the content value to set. - */ - @Generated - public FileDataFileDetails(BinaryData content) { - this.content = content; - } - - /** - * Get the content property: The content of the file. - * - * @return the content value. - */ - @Generated - public BinaryData getContent() { - return this.content; - } - - /** - * Get the filename property: The filename of the file. - * - * @return the filename value. - */ - @Generated - public String getFilename() { - return this.filename; - } - - /** - * Set the filename property: The filename of the file. - * - * @param filename the filename value to set. - * @return the FileDataFileDetails object itself. - */ - @Generated - public FileDataFileDetails setFilename(String filename) { - this.filename = filename; - return this; - } - - /** - * Get the contentType property: The content-type of the file. - * - * @return the contentType value. - */ - @Generated - public String getContentType() { - return this.contentType; - } - - /** - * Set the contentType property: The content-type of the file. - * - * @param contentType the contentType value to set. - * @return the FileDataFileDetails object itself. - */ - @Generated - public FileDataFileDetails setContentType(String contentType) { - this.contentType = contentType; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDetails.java deleted file mode 100644 index 63e0e2933b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDetails.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; - -/** - * A file in an HTTP request, response, or multipart payload. - * - * A file in an HTTP request, response, or multipart payload. - * - * Files have a special meaning that the HTTP library understands. When the body of an HTTP request, response, - * or multipart payload is _effectively_ an instance of `TypeSpec.Http.File` or any type that extends it, the - * operation is treated as a file upload or download. - * - * When using file bodies, the fields of the file model are defined to come from particular locations by default: - * - * - `contentType`: The `Content-Type` header of the request, response, or multipart payload (CANNOT be overridden or - * changed). - * - `contents`: The body of the request, response, or multipart payload (CANNOT be overridden or changed). - * - `filename`: The `filename` parameter value of the `Content-Disposition` header of the response or multipart payload - * (MAY be overridden or changed). - * - * A File may be used as a normal structured JSON object in a request or response, if the request specifies an explicit - * `Content-Type` header. In this case, the entire File model is serialized as if it were any other model. In a JSON - * payload, - * it will have a structure like: - * - * ``` - * { - * "contentType": <string?>, - * "filename": <string?>, - * "contents": <string, base64> - * } - * ``` - * - * The `contentType` _within_ the file defines what media types the data inside the file can be, but if the - * specification - * defines a `Content-Type` for the payload as HTTP metadata, that `Content-Type` metadata defines _how the file is - * serialized_. See the examples below for more information. - * - * NOTE: The `filename` and `contentType` fields are optional. Furthermore, the default location of `filename` - * (`Content-Disposition: <disposition>; filename=<filename>`) is only valid in HTTP responses and multipart - * payloads. If - * you wish to send the `filename` in a request, you must use HTTP metadata decorators to describe the location of the - * `filename` field. You can combine the metadata decorators with `@visibility` to control when the `filename` - * location - * is overridden, as shown in the examples below. - */ -@Fluent -public final class FileDetails { - /* - * The content of the file. - */ - @Generated - private final BinaryData content; - - /* - * The filename of the file. - */ - @Generated - private String filename; - - /* - * The content-type of the file. - */ - @Generated - private String contentType = "application/octet-stream"; - - /** - * Creates an instance of FileDetails class. - * - * @param content the content value to set. - */ - @Generated - public FileDetails(BinaryData content) { - this.content = content; - } - - /** - * Get the content property: The content of the file. - * - * @return the content value. - */ - @Generated - public BinaryData getContent() { - return this.content; - } - - /** - * Get the filename property: The filename of the file. - * - * @return the filename value. - */ - @Generated - public String getFilename() { - return this.filename; - } - - /** - * Set the filename property: The filename of the file. - * - * @param filename the filename value to set. - * @return the FileDetails object itself. - */ - @Generated - public FileDetails setFilename(String filename) { - this.filename = filename; - return this; - } - - /** - * Get the contentType property: The content-type of the file. - * - * @return the contentType value. - */ - @Generated - public String getContentType() { - return this.contentType; - } - - /** - * Set the contentType property: The content-type of the file. - * - * @param contentType the contentType value to set. - * @return the FileDetails object itself. - */ - @Generated - public FileDetails setContentType(String contentType) { - this.contentType = contentType; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FormData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FormData.java deleted file mode 100644 index fe8ecd9f858..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FormData.java +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import java.util.List; - -/** - * The FormData model. - */ -@Fluent -public final class FormData { - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The resolution property. - */ - @Generated - private final int resolution; - - /* - * The type property. - */ - @Generated - private final ImageType type; - - /* - * The size property. - */ - @Generated - private final Size size; - - /* - * The image property. - */ - @Generated - private final ImageFileDetails image; - - /* - * The fileData property. - */ - @Generated - private List fileData; - - /** - * Creates an instance of FormData class. - * - * @param name the name value to set. - * @param resolution the resolution value to set. - * @param type the type value to set. - * @param size the size value to set. - * @param image the image value to set. - */ - @Generated - public FormData(String name, int resolution, ImageType type, Size size, ImageFileDetails image) { - this.name = name; - this.resolution = resolution; - this.type = type; - this.size = size; - this.image = image; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the resolution property: The resolution property. - * - * @return the resolution value. - */ - @Generated - public int getResolution() { - return this.resolution; - } - - /** - * Get the type property: The type property. - * - * @return the type value. - */ - @Generated - public ImageType getType() { - return this.type; - } - - /** - * Get the size property: The size property. - * - * @return the size value. - */ - @Generated - public Size getSize() { - return this.size; - } - - /** - * Get the image property: The image property. - * - * @return the image value. - */ - @Generated - public ImageFileDetails getImage() { - return this.image; - } - - /** - * Get the fileData property: The fileData property. - * - * @return the fileData value. - */ - @Generated - public List getFileData() { - return this.fileData; - } - - /** - * Set the fileData property: The fileData property. - * - * @param fileData the fileData value to set. - * @return the FormData object itself. - */ - @Generated - public FormData setFileData(List fileData) { - this.fileData = fileData; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageFileDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageFileDetails.java deleted file mode 100644 index 367f4db02fb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageFileDetails.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; - -/** - * The file details for the "image" field. - */ -@Fluent -public final class ImageFileDetails { - /* - * The content of the file. - */ - @Generated - private final BinaryData content; - - /* - * The filename of the file. - */ - @Generated - private String filename; - - /* - * The content-type of the file. - */ - @Generated - private String contentType = "application/octet-stream"; - - /** - * Creates an instance of ImageFileDetails class. - * - * @param content the content value to set. - */ - @Generated - public ImageFileDetails(BinaryData content) { - this.content = content; - } - - /** - * Get the content property: The content of the file. - * - * @return the content value. - */ - @Generated - public BinaryData getContent() { - return this.content; - } - - /** - * Get the filename property: The filename of the file. - * - * @return the filename value. - */ - @Generated - public String getFilename() { - return this.filename; - } - - /** - * Set the filename property: The filename of the file. - * - * @param filename the filename value to set. - * @return the ImageFileDetails object itself. - */ - @Generated - public ImageFileDetails setFilename(String filename) { - this.filename = filename; - return this; - } - - /** - * Get the contentType property: The content-type of the file. - * - * @return the contentType value. - */ - @Generated - public String getContentType() { - return this.contentType; - } - - /** - * Set the contentType property: The content-type of the file. - * - * @param contentType the contentType value to set. - * @return the ImageFileDetails object itself. - */ - @Generated - public ImageFileDetails setContentType(String contentType) { - this.contentType = contentType; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageType.java deleted file mode 100644 index a511648eeb1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageType.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for ImageType. - */ -public final class ImageType extends ExpandableStringEnum { - /** - * Static value JPEG for ImageType. - */ - @Generated - public static final ImageType JPEG = fromString("JPEG"); - - /** - * Static value PNG for ImageType. - */ - @Generated - public static final ImageType PNG = fromString("PNG"); - - /** - * Creates a new instance of ImageType value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public ImageType() { - } - - /** - * Creates or finds a ImageType from its string representation. - * - * @param name a name to look for. - * @return the corresponding ImageType. - */ - @Generated - public static ImageType fromString(String name) { - return fromString(name, ImageType.class); - } - - /** - * Gets known ImageType values. - * - * @return known ImageType values. - */ - @Generated - public static Collection values() { - return values(ImageType.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/InheritFileData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/InheritFileData.java deleted file mode 100644 index e64e6189b2e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/InheritFileData.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; - -/** - * Image file of content-type "image/jpeg". - */ -@Immutable -public final class InheritFileData { - /* - * The content of the file. - */ - @Generated - private final BinaryData content; - - /* - * The filename of the file. - */ - @Generated - private final String filename; - - /* - * The content-type of the file. - */ - @Generated - private final String contentType = "image/jpeg"; - - /** - * Creates an instance of InheritFileData class. - * - * @param content the content value to set. - * @param filename the filename value to set. - */ - @Generated - public InheritFileData(BinaryData content, String filename) { - this.content = content; - this.filename = filename; - } - - /** - * Get the content property: The content of the file. - * - * @return the content value. - */ - @Generated - public BinaryData getContent() { - return this.content; - } - - /** - * Get the filename property: The filename of the file. - * - * @return the filename value. - */ - @Generated - public String getFilename() { - return this.filename; - } - - /** - * Get the contentType property: The content-type of the file. - * - * @return the contentType value. - */ - @Generated - public String getContentType() { - return this.contentType; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/Size.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/Size.java deleted file mode 100644 index 4cd60179371..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/Size.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Size model. - */ -@Immutable -public final class Size implements JsonSerializable { - /* - * The width property. - */ - @Generated - private final int width; - - /* - * The height property. - */ - @Generated - private final int height; - - /** - * Creates an instance of Size class. - * - * @param width the width value to set. - * @param height the height value to set. - */ - @Generated - public Size(int width, int height) { - this.width = width; - this.height = height; - } - - /** - * Get the width property: The width property. - * - * @return the width value. - */ - @Generated - public int getWidth() { - return this.width; - } - - /** - * Get the height property: The height property. - * - * @return the height value. - */ - @Generated - public int getHeight() { - return this.height; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("width", this.width); - jsonWriter.writeIntField("height", this.height); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Size from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Size if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Size. - */ - @Generated - public static Size fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int width = 0; - int height = 0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("width".equals(fieldName)) { - width = reader.getInt(); - } else if ("height".equals(fieldName)) { - height = reader.getInt(); - } else { - reader.skipChildren(); - } - } - return new Size(width, height); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/UploadHttpPartRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/UploadHttpPartRequest.java deleted file mode 100644 index 69f7bcdee36..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/UploadHttpPartRequest.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; - -/** - * The UploadHttpPartRequest model. - */ -@Immutable -public final class UploadHttpPartRequest { - /* - * The fileData1 property. - */ - @Generated - private final InheritFileData fileData1; - - /* - * The file_data2 property. - */ - @Generated - private final FileDetails fileData2; - - /* - * The size property. - */ - @Generated - private final Size size; - - /** - * Creates an instance of UploadHttpPartRequest class. - * - * @param fileData1 the fileData1 value to set. - * @param fileData2 the fileData2 value to set. - * @param size the size value to set. - */ - @Generated - public UploadHttpPartRequest(InheritFileData fileData1, FileDetails fileData2, Size size) { - this.fileData1 = fileData1; - this.fileData2 = fileData2; - this.size = size; - } - - /** - * Get the fileData1 property: The fileData1 property. - * - * @return the fileData1 value. - */ - @Generated - public InheritFileData getFileData1() { - return this.fileData1; - } - - /** - * Get the fileData2 property: The file_data2 property. - * - * @return the fileData2 value. - */ - @Generated - public FileDetails getFileData2() { - return this.fileData2; - } - - /** - * Get the size property: The size property. - * - * @return the size value. - */ - @Generated - public Size getSize() { - return this.size; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/package-info.java deleted file mode 100644 index b0ec5b4d132..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Multipart. - * - */ -package tsptest.multipart.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/package-info.java deleted file mode 100644 index 3256bb30ce9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Multipart. - * - */ -package tsptest.multipart; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceAsyncClient.java deleted file mode 100644 index 0cb9b4e6969..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceAsyncClient.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namespaceclient; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.namespaceclient.implementation.NamespaceClientImpl; -import tsptest.namespacemodel.models.Model; - -/** - * Initializes a new instance of the asynchronous NamespaceClient type. - */ -@ServiceClient(builder = NamespaceClientBuilder.class, isAsync = true) -public final class NamespaceAsyncClient { - @Generated - private final NamespaceClientImpl serviceClient; - - /** - * Initializes an instance of NamespaceAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NamespaceAsyncClient(NamespaceClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Model.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClient.java deleted file mode 100644 index 1bd2a5e86b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClient.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namespaceclient; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.namespaceclient.implementation.NamespaceClientImpl; -import tsptest.namespacemodel.models.Model; - -/** - * Initializes a new instance of the synchronous NamespaceClient type. - */ -@ServiceClient(builder = NamespaceClientBuilder.class) -public final class NamespaceClient { - @Generated - private final NamespaceClientImpl serviceClient; - - /** - * Initializes an instance of NamespaceClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NamespaceClient(NamespaceClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Model get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(Model.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClientBuilder.java deleted file mode 100644 index 344e7a51192..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namespaceclient; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.namespaceclient.implementation.NamespaceClientImpl; - -/** - * A builder for creating a new instance of the NamespaceClient type. - */ -@ServiceClientBuilder(serviceClients = { NamespaceClient.class, NamespaceAsyncClient.class }) -public final class NamespaceClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-namespaceclient.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the NamespaceClientBuilder. - */ - @Generated - public NamespaceClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamespaceClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamespaceClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamespaceClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamespaceClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamespaceClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamespaceClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamespaceClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamespaceClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the NamespaceClientBuilder. - */ - @Generated - public NamespaceClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of NamespaceClientImpl with the provided parameters. - * - * @return an instance of NamespaceClientImpl. - */ - @Generated - private NamespaceClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - NamespaceClientImpl client - = new NamespaceClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of NamespaceAsyncClient class. - * - * @return an instance of NamespaceAsyncClient. - */ - @Generated - public NamespaceAsyncClient buildAsyncClient() { - return new NamespaceAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of NamespaceClient class. - * - * @return an instance of NamespaceClient. - */ - @Generated - public NamespaceClient buildClient() { - return new NamespaceClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(NamespaceClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/NamespaceClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/NamespaceClientImpl.java deleted file mode 100644 index c58ec9223bb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/NamespaceClientImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namespaceclient.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the NamespaceClient type. - */ -public final class NamespaceClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NamespaceClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of NamespaceClient client. - * - * @param endpoint Service host. - */ - public NamespaceClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NamespaceClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public NamespaceClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NamespaceClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public NamespaceClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(NamespaceClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for NamespaceClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NamespaceClient") - public interface NamespaceClientService { - @Get("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/package-info.java deleted file mode 100644 index 0e540fa17cd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for NamespaceClient. - * - */ -package tsptest.namespaceclient.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/package-info.java deleted file mode 100644 index dcddec09867..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for NamespaceClient. - * - */ -package tsptest.namespaceclient; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/Model.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/Model.java deleted file mode 100644 index 617827e76fe..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/Model.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namespacemodel.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Model model. - */ -@Immutable -public final class Model implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Model class. - * - * @param name the name value to set. - */ - @Generated - private Model(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Model from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Model if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Model. - */ - @Generated - public static Model fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Model(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/package-info.java deleted file mode 100644 index 4b2e5d07af6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for NamespaceClient. - * - */ -package tsptest.namespacemodel.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingAsyncClient.java deleted file mode 100644 index 6344b136f0f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingAsyncClient.java +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.naming.implementation.NamingOpsImpl; -import tsptest.naming.models.DataRequest; -import tsptest.naming.models.DataResponse; -import tsptest.naming.models.GetAnonymousResponse; - -/** - * Initializes a new instance of the asynchronous NamingClient type. - */ -@ServiceClient(builder = NamingClientBuilder.class, isAsync = true) -public final class NamingAsyncClient { - @Generated - private final NamingOpsImpl serviceClient; - - /** - * Initializes an instance of NamingAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NamingAsyncClient(NamingOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * summary of POST op - * - * description of POST op. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter - * - * description of etag header parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     parameters (Optional): {
-     *         type: String(Type1/Type2) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data (Required): {
-     *         data (Required): {
-     *             @data.kind: String (Required)
-     *         }
-     *     }
-     *     type: String(Blob/File) (Required)
-     *     status: String(Running/Completed/Failed) (Required)
-     *     domainUsername: String (Required)
-     *     anonymous (Required): {
-     *         last_error (Required): {
-     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return summary of Response along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postWithResponse(String name, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postWithResponseAsync(name, body, requestOptions); - } - - /** - * The getAnonymous operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAnonymousWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAnonymousWithResponseAsync(requestOptions); - } - - /** - * summary of POST op - * - * description of POST op. - * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @param etag summary of etag header parameter - * - * description of etag header parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return summary of Response on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono post(String name, DataRequest body, String etag) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (etag != null) { - requestOptions.setHeader(HttpHeaderName.ETAG, etag); - } - return postWithResponse(name, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DataResponse.class)); - } - - /** - * summary of POST op - * - * description of POST op. - * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return summary of Response on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono post(String name, DataRequest body) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postWithResponse(name, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DataResponse.class)); - } - - /** - * The getAnonymous operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAnonymous() { - // Generated convenience method for getAnonymousWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAnonymousWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GetAnonymousResponse.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClient.java deleted file mode 100644 index cb8985e33f8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClient.java +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. -package tsptest.naming; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.naming.implementation.NamingOpsImpl; -import tsptest.naming.models.DataRequest; -import tsptest.naming.models.DataResponse; -import tsptest.naming.models.GetAnonymousResponse; - -/** - * Initializes a new instance of the synchronous NamingClient type. - */ -@ServiceClient(builder = NamingClientBuilder.class) -public final class NamingClient { - - @Generated - private final NamingOpsImpl serviceClient; - - /** - * Initializes an instance of NamingClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NamingClient(NamingOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Protocol method for POST operation. - * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return summary of Response along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postWithResponse(String name, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postWithResponse(name, body, requestOptions); - } - - /** - * The getAnonymous operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAnonymousWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAnonymousWithResponse(requestOptions); - } - - /** - * summary of POST op - * - * description of POST op. - * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @param etag summary of etag header parameter - * - * description of etag header parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return summary of Response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DataResponse post(String name, DataRequest body, String etag) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (etag != null) { - requestOptions.setHeader(HttpHeaderName.ETAG, etag); - } - return postWithResponse(name, BinaryData.fromObject(body), requestOptions).getValue() - .toObject(DataResponse.class); - } - - /** - * summary of POST op - * - * description of POST op. - * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return summary of Response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DataResponse post(String name, DataRequest body) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postWithResponse(name, BinaryData.fromObject(body), requestOptions).getValue() - .toObject(DataResponse.class); - } - - /** - * The getAnonymous operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GetAnonymousResponse getAnonymous() { - // Generated convenience method for getAnonymousWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAnonymousWithResponse(requestOptions).getValue().toObject(GetAnonymousResponse.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClientBuilder.java deleted file mode 100644 index 75f61f79a6f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.naming.implementation.NamingClientImpl; - -/** - * A builder for creating a new instance of the NamingClient type. - */ -@ServiceClientBuilder(serviceClients = { NamingClient.class, NamingAsyncClient.class }) -public final class NamingClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-naming.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the NamingClientBuilder. - */ - @Generated - public NamingClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the NamingClientBuilder. - */ - @Generated - public NamingClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of NamingClientImpl with the provided parameters. - * - * @return an instance of NamingClientImpl. - */ - @Generated - private NamingClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - NamingClientImpl client - = new NamingClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of NamingAsyncClient class. - * - * @return an instance of NamingAsyncClient. - */ - @Generated - public NamingAsyncClient buildAsyncClient() { - return new NamingAsyncClient(buildInnerClient().getNamingOps()); - } - - /** - * Builds an instance of NamingClient class. - * - * @return an instance of NamingClient. - */ - @Generated - public NamingClient buildClient() { - return new NamingClient(buildInnerClient().getNamingOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(NamingClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingClientImpl.java deleted file mode 100644 index 3a8586c017f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 NamingClient type. - */ -public final class NamingClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 NamingOpsImpl object to access its operations. - */ - private final NamingOpsImpl namingOps; - - /** - * Gets the NamingOpsImpl object to access its operations. - * - * @return the NamingOpsImpl object. - */ - public NamingOpsImpl getNamingOps() { - return this.namingOps; - } - - /** - * Initializes an instance of NamingClient client. - * - * @param endpoint Service host. - */ - public NamingClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NamingClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public NamingClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NamingClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public NamingClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.namingOps = new NamingOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingOpsImpl.java deleted file mode 100644 index ac85523dc45..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingOpsImpl.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in NamingOps. - */ -public final class NamingOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NamingOpsService service; - - /** - * The service client containing this operation class. - */ - private final NamingClientImpl client; - - /** - * Initializes an instance of NamingOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NamingOpsImpl(NamingClientImpl client) { - this.service - = RestProxy.create(NamingOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NamingClientNamingOps to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NamingClientNamingOps") - public interface NamingOpsService { - @Post("/naming") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> post(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/naming") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postSync(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Get("/naming") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAnonymous(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/naming") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAnonymousSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * summary of POST op - * - * description of POST op. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter - * - * description of etag header parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     parameters (Optional): {
-     *         type: String(Type1/Type2) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data (Required): {
-     *         data (Required): {
-     *             @data.kind: String (Required)
-     *         }
-     *     }
-     *     type: String(Blob/File) (Required)
-     *     status: String(Running/Completed/Failed) (Required)
-     *     domainUsername: String (Required)
-     *     anonymous (Required): {
-     *         last_error (Required): {
-     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return summary of Response along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postWithResponseAsync(String name, BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.post(this.client.getEndpoint(), name, contentType, accept, body, - requestOptions, context)); - } - - /** - * summary of POST op - * - * description of POST op. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter - * - * description of etag header parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     parameters (Optional): {
-     *         type: String(Type1/Type2) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data (Required): {
-     *         data (Required): {
-     *             @data.kind: String (Required)
-     *         }
-     *     }
-     *     type: String(Blob/File) (Required)
-     *     status: String(Running/Completed/Failed) (Required)
-     *     domainUsername: String (Required)
-     *     anonymous (Required): {
-     *         last_error (Required): {
-     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return summary of Response along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postWithResponse(String name, BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.postSync(this.client.getEndpoint(), name, contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The getAnonymous operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAnonymousWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAnonymous(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getAnonymous operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAnonymousWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAnonymousSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/package-info.java deleted file mode 100644 index a47fa92ef10..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Naming. - * description of Naming. - * - */ -package tsptest.naming.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BinaryData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BinaryData.java deleted file mode 100644 index a51ef586908..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BinaryData.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * summary of Data - * - * description of Data. - */ -@Immutable -public final class BinaryData implements JsonSerializable { - /* - * summary of data property - * - * description of data property - */ - @Generated - private final Data data; - - /** - * Creates an instance of BinaryData class. - * - * @param data the data value to set. - */ - @Generated - private BinaryData(Data data) { - this.data = data; - } - - /** - * Get the data property: summary of data property - * - * description of data property. - * - * @return the data value. - */ - @Generated - public Data getData() { - return this.data; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("data", this.data); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BinaryData from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BinaryData if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BinaryData. - */ - @Generated - public static BinaryData fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Data data = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("data".equals(fieldName)) { - data = Data.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new BinaryData(data); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BytesData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BytesData.java deleted file mode 100644 index d66718c150e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BytesData.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The BytesData model. - */ -@Immutable -public final class BytesData extends Data { - /* - * The @data.kind property. - */ - @Generated - private String type = "bytes"; - - /* - * Data as {@code byte[]} - */ - @Generated - private final byte[] dataAsBytes; - - /** - * Creates an instance of BytesData class. - * - * @param dataAsBytes the dataAsBytes value to set. - */ - @Generated - private BytesData(byte[] dataAsBytes) { - this.dataAsBytes = dataAsBytes; - } - - /** - * Get the type property: The @data.kind property. - * - * @return the type value. - */ - @Generated - @Override - public String getType() { - return this.type; - } - - /** - * Get the dataAsBytes property: Data as {@code byte[]}. - * - * @return the dataAsBytes value. - */ - @Generated - public byte[] getDataAsBytes() { - return CoreUtils.clone(this.dataAsBytes); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBinaryField("data_bytes", this.dataAsBytes); - jsonWriter.writeStringField("@data.kind", this.type); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BytesData from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BytesData if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BytesData. - */ - @Generated - public static BytesData fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - byte[] dataAsBytes = null; - String type = "bytes"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("data_bytes".equals(fieldName)) { - dataAsBytes = reader.getBinary(); - } else if ("@data.kind".equals(fieldName)) { - type = reader.getString(); - } else { - reader.skipChildren(); - } - } - BytesData deserializedBytesData = new BytesData(dataAsBytes); - deserializedBytesData.type = type; - - return deserializedBytesData; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/Data.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/Data.java deleted file mode 100644 index f142281b1a0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/Data.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Dummy doc to make the javadoc break at the 'at' symbol. The type of the Data depends on - * @data.kind.letusmakeitlongsoitwouldbreakbeforethis field. - */ -@Immutable -public class Data implements JsonSerializable { - /* - * The @data.kind property. - */ - @Generated - private String type = "Data"; - - /** - * Creates an instance of Data class. - */ - @Generated - protected Data() { - } - - /** - * Get the type property: The @data.kind property. - * - * @return the type value. - */ - @Generated - public String getType() { - return this.type; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("@data.kind", this.type); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Data from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Data if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IOException If an error occurs while reading the Data. - */ - @Generated - public static Data fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("@data.kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("bytes".equals(discriminatorValue)) { - return BytesData.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Data fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Data deserializedData = new Data(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("@data.kind".equals(fieldName)) { - deserializedData.type = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedData; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataRequest.java deleted file mode 100644 index 40ba19e0287..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataRequest.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * summary of Request - * - * description of Request. - */ -@Fluent -public final class DataRequest implements JsonSerializable { - /* - * The parameters property. - */ - @Generated - private RequestParameters parameters; - - /** - * Creates an instance of DataRequest class. - */ - @Generated - public DataRequest() { - } - - /** - * Get the parameters property: The parameters property. - * - * @return the parameters value. - */ - @Generated - public RequestParameters getParameters() { - return this.parameters; - } - - /** - * Set the parameters property: The parameters property. - * - * @param parameters the parameters value to set. - * @return the DataRequest object itself. - */ - @Generated - public DataRequest setParameters(RequestParameters parameters) { - this.parameters = parameters; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("parameters", this.parameters); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DataRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DataRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the DataRequest. - */ - @Generated - public static DataRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - DataRequest deserializedDataRequest = new DataRequest(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("parameters".equals(fieldName)) { - deserializedDataRequest.parameters = RequestParameters.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedDataRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataResponse.java deleted file mode 100644 index 7c4dc52c42c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataResponse.java +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * summary of Response - * - * description of Response. Include tab ' ' in doc. - */ -@Immutable -public final class DataResponse implements JsonSerializable { - /* - * summary of name property - * - * description of name property - */ - @Generated - private final String name; - - /* - * summary of data property - * - * description of data property - */ - @Generated - private final BinaryData data; - - /* - * summary of type property - * - * description of type property - */ - @Generated - private final TypesModel dataType; - - /* - * summary of status property - * - * description of status property - */ - @Generated - private final DataStatus status; - - /* - * The domain{@code \}username data - */ - @Generated - private final String domainUsername; - - /* - * The anonymous property. - */ - @Generated - private final RunObject anonymous; - - /** - * Creates an instance of DataResponse class. - * - * @param name the name value to set. - * @param data the data value to set. - * @param dataType the dataType value to set. - * @param status the status value to set. - * @param domainUsername the domainUsername value to set. - * @param anonymous the anonymous value to set. - */ - @Generated - private DataResponse(String name, BinaryData data, TypesModel dataType, DataStatus status, String domainUsername, - RunObject anonymous) { - this.name = name; - this.data = data; - this.dataType = dataType; - this.status = status; - this.domainUsername = domainUsername; - this.anonymous = anonymous; - } - - /** - * Get the name property: summary of name property - * - * description of name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the data property: summary of data property - * - * description of data property. - * - * @return the data value. - */ - @Generated - public BinaryData getData() { - return this.data; - } - - /** - * Get the dataType property: summary of type property - * - * description of type property. - * - * @return the dataType value. - */ - @Generated - public TypesModel getDataType() { - return this.dataType; - } - - /** - * Get the status property: summary of status property - * - * description of status property. - * - * @return the status value. - */ - @Generated - public DataStatus getStatus() { - return this.status; - } - - /** - * Get the domainUsername property: The domain{@code \}username data. - * - * @return the domainUsername value. - */ - @Generated - public String getDomainUsername() { - return this.domainUsername; - } - - /** - * Get the anonymous property: The anonymous property. - * - * @return the anonymous value. - */ - @Generated - public RunObject getAnonymous() { - return this.anonymous; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeJsonField("data", this.data); - jsonWriter.writeStringField("type", this.dataType == null ? null : this.dataType.toString()); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); - jsonWriter.writeStringField("domainUsername", this.domainUsername); - jsonWriter.writeJsonField("anonymous", this.anonymous); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DataResponse from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DataResponse if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DataResponse. - */ - @Generated - public static DataResponse fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - BinaryData data = null; - TypesModel dataType = null; - DataStatus status = null; - String domainUsername = null; - RunObject anonymous = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("data".equals(fieldName)) { - data = BinaryData.fromJson(reader); - } else if ("type".equals(fieldName)) { - dataType = TypesModel.fromString(reader.getString()); - } else if ("status".equals(fieldName)) { - status = DataStatus.fromString(reader.getString()); - } else if ("domainUsername".equals(fieldName)) { - domainUsername = reader.getString(); - } else if ("anonymous".equals(fieldName)) { - anonymous = RunObject.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new DataResponse(name, data, dataType, status, domainUsername, anonymous); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataStatus.java deleted file mode 100644 index 26e3339fee8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataStatus.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * summary of Statuses - * - * description of Statuses. - */ -public final class DataStatus extends ExpandableStringEnum { - /** - * Static value Running for DataStatus. - */ - @Generated - public static final DataStatus LRO_RUNNING = fromString("Running"); - - /** - * Static value Completed for DataStatus. - */ - @Generated - public static final DataStatus COMPLETED = fromString("Completed"); - - /** - * Static value Failed for DataStatus. - */ - @Generated - public static final DataStatus FAILED = fromString("Failed"); - - /** - * Creates a new instance of DataStatus value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public DataStatus() { - } - - /** - * Creates or finds a DataStatus from its string representation. - * - * @param name a name to look for. - * @return the corresponding DataStatus. - */ - @Generated - public static DataStatus fromString(String name) { - return fromString(name, DataStatus.class); - } - - /** - * Gets known DataStatus values. - * - * @return known DataStatus values. - */ - @Generated - public static Collection values() { - return values(DataStatus.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/GetAnonymousResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/GetAnonymousResponse.java deleted file mode 100644 index 9b492a30ea8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/GetAnonymousResponse.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GetAnonymousResponse model. - */ -@Immutable -public final class GetAnonymousResponse implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of GetAnonymousResponse class. - * - * @param name the name value to set. - */ - @Generated - private GetAnonymousResponse(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GetAnonymousResponse from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GetAnonymousResponse if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GetAnonymousResponse. - */ - @Generated - public static GetAnonymousResponse fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new GetAnonymousResponse(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParameters.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParameters.java deleted file mode 100644 index 8f9a29b384b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParameters.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The RequestParameters model. - */ -@Immutable -public final class RequestParameters implements JsonSerializable { - /* - * The type property. - */ - @Generated - private final RequestParametersType type; - - /** - * Creates an instance of RequestParameters class. - * - * @param type the type value to set. - */ - @Generated - public RequestParameters(RequestParametersType type) { - this.type = type; - } - - /** - * Get the type property: The type property. - * - * @return the type value. - */ - @Generated - public RequestParametersType getType() { - return this.type; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of RequestParameters from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of RequestParameters if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the RequestParameters. - */ - @Generated - public static RequestParameters fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - RequestParametersType type = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("type".equals(fieldName)) { - type = RequestParametersType.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new RequestParameters(type); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParametersType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParametersType.java deleted file mode 100644 index 69c776a2237..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParametersType.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -/** - * Defines values for RequestParametersType. - */ -public enum RequestParametersType { - /** - * Enum value Type1. - */ - TYPE1("Type1"), - - /** - * Enum value Type2. - */ - TYPE2("Type2"); - - /** - * The actual serialized value for a RequestParametersType instance. - */ - private final String value; - - RequestParametersType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a RequestParametersType instance. - * - * @param value the serialized value to parse. - * @return the parsed RequestParametersType object, or null if unable to parse. - */ - public static RequestParametersType fromString(String value) { - if (value == null) { - return null; - } - RequestParametersType[] items = RequestParametersType.values(); - for (RequestParametersType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObject.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObject.java deleted file mode 100644 index ce5b54a9c58..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObject.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The RunObject model. - */ -@Immutable -public final class RunObject implements JsonSerializable { - /* - * The last_error property. - */ - @Generated - private final RunObjectLastErrorRenamed lastError; - - /** - * Creates an instance of RunObject class. - * - * @param lastError the lastError value to set. - */ - @Generated - private RunObject(RunObjectLastErrorRenamed lastError) { - this.lastError = lastError; - } - - /** - * Get the lastError property: The last_error property. - * - * @return the lastError value. - */ - @Generated - public RunObjectLastErrorRenamed getLastError() { - return this.lastError; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("last_error", this.lastError); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of RunObject from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of RunObject if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the RunObject. - */ - @Generated - public static RunObject fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - RunObjectLastErrorRenamed lastError = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("last_error".equals(fieldName)) { - lastError = RunObjectLastErrorRenamed.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new RunObject(lastError); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorCodeRenamed.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorCodeRenamed.java deleted file mode 100644 index 6c7ce986472..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorCodeRenamed.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -/** - * Defines values for RunObjectLastErrorCodeRenamed. - */ -public enum RunObjectLastErrorCodeRenamed { - /** - * Enum value server_error. - */ - SERVER_ERROR("server_error"), - - /** - * Enum value rate_limit_exceeded. - */ - RATE_LIMIT_EXCEEDED("rate_limit_exceeded"), - - /** - * Enum value invalid_prompt. - */ - INVALID_PROMPT("invalid_prompt"); - - /** - * The actual serialized value for a RunObjectLastErrorCodeRenamed instance. - */ - private final String value; - - RunObjectLastErrorCodeRenamed(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a RunObjectLastErrorCodeRenamed instance. - * - * @param value the serialized value to parse. - * @return the parsed RunObjectLastErrorCodeRenamed object, or null if unable to parse. - */ - public static RunObjectLastErrorCodeRenamed fromString(String value) { - if (value == null) { - return null; - } - RunObjectLastErrorCodeRenamed[] items = RunObjectLastErrorCodeRenamed.values(); - for (RunObjectLastErrorCodeRenamed item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorRenamed.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorRenamed.java deleted file mode 100644 index de9c7901de0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorRenamed.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The RunObjectLastErrorRenamed model. - */ -@Immutable -public final class RunObjectLastErrorRenamed implements JsonSerializable { - /* - * The code property. - */ - @Generated - private final RunObjectLastErrorCodeRenamed code; - - /** - * Creates an instance of RunObjectLastErrorRenamed class. - * - * @param code the code value to set. - */ - @Generated - private RunObjectLastErrorRenamed(RunObjectLastErrorCodeRenamed code) { - this.code = code; - } - - /** - * Get the code property: The code property. - * - * @return the code value. - */ - @Generated - public RunObjectLastErrorCodeRenamed getCode() { - return this.code; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("code", this.code == null ? null : this.code.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of RunObjectLastErrorRenamed from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of RunObjectLastErrorRenamed if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the RunObjectLastErrorRenamed. - */ - @Generated - public static RunObjectLastErrorRenamed fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - RunObjectLastErrorCodeRenamed code = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("code".equals(fieldName)) { - code = RunObjectLastErrorCodeRenamed.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new RunObjectLastErrorRenamed(code); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/TypesModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/TypesModel.java deleted file mode 100644 index 54c4193c83c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/TypesModel.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.models; - -/** - * summary of Types - * - * description of Types. - */ -public enum TypesModel { - /** - * Enum value Blob. - */ - BLOB("Blob"), - - /** - * Enum value File. - */ - FILE("File"); - - /** - * The actual serialized value for a TypesModel instance. - */ - private final String value; - - TypesModel(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a TypesModel instance. - * - * @param value the serialized value to parse. - * @return the parsed TypesModel object, or null if unable to parse. - */ - public static TypesModel fromString(String value) { - if (value == null) { - return null; - } - TypesModel[] items = TypesModel.values(); - for (TypesModel item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/package-info.java deleted file mode 100644 index c09b80a7c46..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Naming. - * description of Naming. - * - */ -package tsptest.naming.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/package-info.java deleted file mode 100644 index 8a729b4e962..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Naming. - * description of Naming. - * - */ -package tsptest.naming; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserAsyncClient.java deleted file mode 100644 index dd21304c508..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserAsyncClient.java +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.namingjavaparser.implementation.NamingOpsImpl; -import tsptest.namingjavaparser.models.DataRequest; -import tsptest.namingjavaparser.models.DataResponse; -import tsptest.namingjavaparser.models.GetAnonymousResponse; - -/** - * Initializes a new instance of the asynchronous NamingJavaParserClient type. - */ -@ServiceClient(builder = NamingJavaParserClientBuilder.class, isAsync = true) -public final class NamingJavaParserAsyncClient { - @Generated - private final NamingOpsImpl serviceClient; - - /** - * Initializes an instance of NamingJavaParserAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NamingJavaParserAsyncClient(NamingOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * summary of POST op - * - * description of POST op. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter - * - * description of etag header parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     parameters (Optional): {
-     *         type: String(Type1/Type2) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data (Required): {
-     *         data (Required): {
-     *             @data.kind: String (Required)
-     *         }
-     *     }
-     *     type: String(Blob/File) (Required)
-     *     status: String(Running/Completed/Failed) (Required)
-     *     anonymous (Required): {
-     *         last_error (Required): {
-     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return summary of Response along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postWithResponse(String name, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postWithResponseAsync(name, body, requestOptions); - } - - /** - * The getAnonymous operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAnonymousWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAnonymousWithResponseAsync(requestOptions); - } - - /** - * summary of POST op - * - * description of POST op. - * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @param etag summary of etag header parameter - * - * description of etag header parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return summary of Response on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono post(String name, DataRequest body, String etag) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (etag != null) { - requestOptions.setHeader(HttpHeaderName.ETAG, etag); - } - return postWithResponse(name, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DataResponse.class)); - } - - /** - * summary of POST op - * - * description of POST op. - * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return summary of Response on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono post(String name, DataRequest body) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postWithResponse(name, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DataResponse.class)); - } - - /** - * The getAnonymous operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAnonymous() { - // Generated convenience method for getAnonymousWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAnonymousWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GetAnonymousResponse.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClient.java deleted file mode 100644 index a132fc27fb5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClient.java +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. -package tsptest.namingjavaparser; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.namingjavaparser.implementation.NamingOpsImpl; -import tsptest.namingjavaparser.models.DataRequest; -import tsptest.namingjavaparser.models.DataResponse; -import tsptest.namingjavaparser.models.GetAnonymousResponse; - -/** - * Initializes a new instance of the synchronous NamingJavaParserClient type. - */ -@ServiceClient(builder = NamingJavaParserClientBuilder.class) -public final class NamingJavaParserClient { - - @Generated - private final NamingOpsImpl serviceClient; - - /** - * Initializes an instance of NamingJavaParserClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NamingJavaParserClient(NamingOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * summary of POST op - * - * description of POST op. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter - * - * description of etag header parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     parameters (Optional): {
-     *         type: String(Type1/Type2) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data (Required): {
-     *         data (Required): {
-     *             @data.kind: String (Required)
-     *         }
-     *     }
-     *     type: String(Blob/File) (Required)
-     *     status: String(Running/Completed/Failed) (Required)
-     *     anonymous (Required): {
-     *         last_error (Required): {
-     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return summary of Response along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postWithResponse(String name, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postWithResponse(name, body, requestOptions); - } - - /** - * The getAnonymous operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAnonymousWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAnonymousWithResponse(requestOptions); - } - - /** - * summary of POST op - * - * description of POST op. - * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @param etag summary of etag header parameter - * - * description of etag header parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return summary of Response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DataResponse post(String name, DataRequest body, String etag) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (etag != null) { - requestOptions.setHeader(HttpHeaderName.ETAG, etag); - } - return postWithResponse(name, BinaryData.fromObject(body), requestOptions).getValue() - .toObject(DataResponse.class); - } - - /** - * summary of POST op - * - * description of POST op. - * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return summary of Response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DataResponse post(String name, DataRequest body) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postWithResponse(name, BinaryData.fromObject(body), requestOptions).getValue() - .toObject(DataResponse.class); - } - - /** - * The getAnonymous operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GetAnonymousResponse getAnonymous() { - // Generated convenience method for getAnonymousWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAnonymousWithResponse(requestOptions).getValue().toObject(GetAnonymousResponse.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClientBuilder.java deleted file mode 100644 index 9a555ac2b0e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.namingjavaparser.implementation.NamingJavaParserClientImpl; - -/** - * A builder for creating a new instance of the NamingJavaParserClient type. - */ -@ServiceClientBuilder(serviceClients = { NamingJavaParserClient.class, NamingJavaParserAsyncClient.class }) -public final class NamingJavaParserClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("tsptest-namingjavaparser.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the NamingJavaParserClientBuilder. - */ - @Generated - public NamingJavaParserClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingJavaParserClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingJavaParserClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingJavaParserClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingJavaParserClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingJavaParserClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingJavaParserClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingJavaParserClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NamingJavaParserClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the NamingJavaParserClientBuilder. - */ - @Generated - public NamingJavaParserClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of NamingJavaParserClientImpl with the provided parameters. - * - * @return an instance of NamingJavaParserClientImpl. - */ - @Generated - private NamingJavaParserClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - NamingJavaParserClientImpl client = new NamingJavaParserClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of NamingJavaParserAsyncClient class. - * - * @return an instance of NamingJavaParserAsyncClient. - */ - @Generated - public NamingJavaParserAsyncClient buildAsyncClient() { - return new NamingJavaParserAsyncClient(buildInnerClient().getNamingOps()); - } - - /** - * Builds an instance of NamingJavaParserClient class. - * - * @return an instance of NamingJavaParserClient. - */ - @Generated - public NamingJavaParserClient buildClient() { - return new NamingJavaParserClient(buildInnerClient().getNamingOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(NamingJavaParserClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingJavaParserClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingJavaParserClientImpl.java deleted file mode 100644 index c159ed60d4b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingJavaParserClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 NamingJavaParserClient type. - */ -public final class NamingJavaParserClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 NamingOpsImpl object to access its operations. - */ - private final NamingOpsImpl namingOps; - - /** - * Gets the NamingOpsImpl object to access its operations. - * - * @return the NamingOpsImpl object. - */ - public NamingOpsImpl getNamingOps() { - return this.namingOps; - } - - /** - * Initializes an instance of NamingJavaParserClient client. - * - * @param endpoint Service host. - */ - public NamingJavaParserClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NamingJavaParserClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public NamingJavaParserClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NamingJavaParserClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public NamingJavaParserClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.namingOps = new NamingOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingOpsImpl.java deleted file mode 100644 index 0f333bd6bfa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingOpsImpl.java +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in NamingOps. - */ -public final class NamingOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NamingOpsService service; - - /** - * The service client containing this operation class. - */ - private final NamingJavaParserClientImpl client; - - /** - * Initializes an instance of NamingOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NamingOpsImpl(NamingJavaParserClientImpl client) { - this.service - = RestProxy.create(NamingOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NamingJavaParserClientNamingOps to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NamingJavaParserClientNamingOps") - public interface NamingOpsService { - @Post("/naming") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> post(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/naming") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postSync(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Get("/naming") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAnonymous(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/naming") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAnonymousSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * summary of POST op - * - * description of POST op. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter - * - * description of etag header parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     parameters (Optional): {
-     *         type: String(Type1/Type2) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data (Required): {
-     *         data (Required): {
-     *             @data.kind: String (Required)
-     *         }
-     *     }
-     *     type: String(Blob/File) (Required)
-     *     status: String(Running/Completed/Failed) (Required)
-     *     anonymous (Required): {
-     *         last_error (Required): {
-     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return summary of Response along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postWithResponseAsync(String name, BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.post(this.client.getEndpoint(), name, contentType, accept, body, - requestOptions, context)); - } - - /** - * summary of POST op - * - * description of POST op. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter - * - * description of etag header parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     parameters (Optional): {
-     *         type: String(Type1/Type2) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     data (Required): {
-     *         data (Required): {
-     *             @data.kind: String (Required)
-     *         }
-     *     }
-     *     type: String(Blob/File) (Required)
-     *     status: String(Running/Completed/Failed) (Required)
-     *     anonymous (Required): {
-     *         last_error (Required): {
-     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param name summary of name query parameter - * - * description of name query parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return summary of Response along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postWithResponse(String name, BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.postSync(this.client.getEndpoint(), name, contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The getAnonymous operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAnonymousWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAnonymous(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getAnonymous operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAnonymousWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAnonymousSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/package-info.java deleted file mode 100644 index e91928ac172..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for NamingJavaParser. - * description of Naming JavaParser. - * - */ -package tsptest.namingjavaparser.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BinaryData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BinaryData.java deleted file mode 100644 index 25ae34fe843..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BinaryData.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * summary of Data - * - * description of Data. - */ -@Immutable -public final class BinaryData implements JsonSerializable { - /* - * summary of data property - * - * description of data property - */ - @Generated - private final Data data; - - /** - * Creates an instance of BinaryData class. - * - * @param data the data value to set. - */ - @Generated - private BinaryData(Data data) { - this.data = data; - } - - /** - * Get the data property: summary of data property - * - * description of data property. - * - * @return the data value. - */ - @Generated - public Data getData() { - return this.data; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("data", this.data); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BinaryData from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BinaryData if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BinaryData. - */ - @Generated - public static BinaryData fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Data data = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("data".equals(fieldName)) { - data = Data.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new BinaryData(data); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BytesData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BytesData.java deleted file mode 100644 index b9bae240922..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BytesData.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The BytesData model. - */ -@Immutable -public final class BytesData extends Data { - /* - * The @data.kind property. - */ - @Generated - private String type = "bytes"; - - /* - * Data as {@code byte[]} - */ - @Generated - private final byte[] dataAsBytes; - - /** - * Creates an instance of BytesData class. - * - * @param dataAsBytes the dataAsBytes value to set. - */ - @Generated - private BytesData(byte[] dataAsBytes) { - this.dataAsBytes = dataAsBytes; - } - - /** - * Get the type property: The @data.kind property. - * - * @return the type value. - */ - @Generated - @Override - public String getType() { - return this.type; - } - - /** - * Get the dataAsBytes property: Data as {@code byte[]}. - * - * @return the dataAsBytes value. - */ - @Generated - public byte[] getDataAsBytes() { - return CoreUtils.clone(this.dataAsBytes); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBinaryField("data_bytes", this.dataAsBytes); - jsonWriter.writeStringField("@data.kind", this.type); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BytesData from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BytesData if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BytesData. - */ - @Generated - public static BytesData fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - byte[] dataAsBytes = null; - String type = "bytes"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("data_bytes".equals(fieldName)) { - dataAsBytes = reader.getBinary(); - } else if ("@data.kind".equals(fieldName)) { - type = reader.getString(); - } else { - reader.skipChildren(); - } - } - BytesData deserializedBytesData = new BytesData(dataAsBytes); - deserializedBytesData.type = type; - - return deserializedBytesData; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/Data.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/Data.java deleted file mode 100644 index 48caff332d5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/Data.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Dummy doc to make the javadoc break at the 'at' symbol. The type of the Data depends on - * @data.kind.letusmakeitlongsoitwouldbreakbeforethis field. - */ -@Immutable -public class Data implements JsonSerializable { - /* - * The @data.kind property. - */ - @Generated - private String type = "Data"; - - /** - * Creates an instance of Data class. - */ - @Generated - protected Data() { - } - - /** - * Get the type property: The @data.kind property. - * - * @return the type value. - */ - @Generated - public String getType() { - return this.type; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("@data.kind", this.type); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Data from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Data if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IOException If an error occurs while reading the Data. - */ - @Generated - public static Data fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("@data.kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("bytes".equals(discriminatorValue)) { - return BytesData.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Data fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Data deserializedData = new Data(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("@data.kind".equals(fieldName)) { - deserializedData.type = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedData; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataRequest.java deleted file mode 100644 index 09b384ab05d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataRequest.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * summary of Request - * - * description of Request. - */ -@Fluent -public final class DataRequest implements JsonSerializable { - /* - * The parameters property. - */ - @Generated - private RequestParameters parameters; - - /** - * Creates an instance of DataRequest class. - */ - @Generated - public DataRequest() { - } - - /** - * Get the parameters property: The parameters property. - * - * @return the parameters value. - */ - @Generated - public RequestParameters getParameters() { - return this.parameters; - } - - /** - * Set the parameters property: The parameters property. - * - * @param parameters the parameters value to set. - * @return the DataRequest object itself. - */ - @Generated - public DataRequest setParameters(RequestParameters parameters) { - this.parameters = parameters; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("parameters", this.parameters); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DataRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DataRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the DataRequest. - */ - @Generated - public static DataRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - DataRequest deserializedDataRequest = new DataRequest(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("parameters".equals(fieldName)) { - deserializedDataRequest.parameters = RequestParameters.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedDataRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataResponse.java deleted file mode 100644 index 62bb2ac0c28..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataResponse.java +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * summary of Response - * - * description of Response. Include tab ' ' in doc. - */ -@Immutable -public final class DataResponse implements JsonSerializable { - /* - * summary of name property - * - * description of name property - */ - @Generated - private final String name; - - /* - * summary of data property - * - * description of data property - */ - @Generated - private final BinaryData data; - - /* - * summary of type property - * - * description of type property - */ - @Generated - private final TypesModel dataType; - - /* - * summary of status property - * - * description of status property - */ - @Generated - private final DataStatus status; - - /* - * The anonymous property. - */ - @Generated - private final RunObject anonymous; - - /** - * Creates an instance of DataResponse class. - * - * @param name the name value to set. - * @param data the data value to set. - * @param dataType the dataType value to set. - * @param status the status value to set. - * @param anonymous the anonymous value to set. - */ - @Generated - private DataResponse(String name, BinaryData data, TypesModel dataType, DataStatus status, RunObject anonymous) { - this.name = name; - this.data = data; - this.dataType = dataType; - this.status = status; - this.anonymous = anonymous; - } - - /** - * Get the name property: summary of name property - * - * description of name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the data property: summary of data property - * - * description of data property. - * - * @return the data value. - */ - @Generated - public BinaryData getData() { - return this.data; - } - - /** - * Get the dataType property: summary of type property - * - * description of type property. - * - * @return the dataType value. - */ - @Generated - public TypesModel getDataType() { - return this.dataType; - } - - /** - * Get the status property: summary of status property - * - * description of status property. - * - * @return the status value. - */ - @Generated - public DataStatus getStatus() { - return this.status; - } - - /** - * Get the anonymous property: The anonymous property. - * - * @return the anonymous value. - */ - @Generated - public RunObject getAnonymous() { - return this.anonymous; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeJsonField("data", this.data); - jsonWriter.writeStringField("type", this.dataType == null ? null : this.dataType.toString()); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); - jsonWriter.writeJsonField("anonymous", this.anonymous); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DataResponse from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DataResponse if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DataResponse. - */ - @Generated - public static DataResponse fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - BinaryData data = null; - TypesModel dataType = null; - DataStatus status = null; - RunObject anonymous = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("data".equals(fieldName)) { - data = BinaryData.fromJson(reader); - } else if ("type".equals(fieldName)) { - dataType = TypesModel.fromString(reader.getString()); - } else if ("status".equals(fieldName)) { - status = DataStatus.fromString(reader.getString()); - } else if ("anonymous".equals(fieldName)) { - anonymous = RunObject.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new DataResponse(name, data, dataType, status, anonymous); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataStatus.java deleted file mode 100644 index 298965620ec..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataStatus.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * summary of Statuses - * - * description of Statuses. - */ -public final class DataStatus extends ExpandableStringEnum { - /** - * Static value Running for DataStatus. - */ - @Generated - public static final DataStatus LRO_RUNNING = fromString("Running"); - - /** - * Static value Completed for DataStatus. - */ - @Generated - public static final DataStatus COMPLETED = fromString("Completed"); - - /** - * Static value Failed for DataStatus. - */ - @Generated - public static final DataStatus FAILED = fromString("Failed"); - - /** - * Creates a new instance of DataStatus value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public DataStatus() { - } - - /** - * Creates or finds a DataStatus from its string representation. - * - * @param name a name to look for. - * @return the corresponding DataStatus. - */ - @Generated - public static DataStatus fromString(String name) { - return fromString(name, DataStatus.class); - } - - /** - * Gets known DataStatus values. - * - * @return known DataStatus values. - */ - @Generated - public static Collection values() { - return values(DataStatus.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/GetAnonymousResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/GetAnonymousResponse.java deleted file mode 100644 index b30416d7a36..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/GetAnonymousResponse.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GetAnonymousResponse model. - */ -@Immutable -public final class GetAnonymousResponse implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of GetAnonymousResponse class. - * - * @param name the name value to set. - */ - @Generated - private GetAnonymousResponse(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GetAnonymousResponse from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GetAnonymousResponse if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GetAnonymousResponse. - */ - @Generated - public static GetAnonymousResponse fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new GetAnonymousResponse(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParameters.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParameters.java deleted file mode 100644 index efbeadac620..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParameters.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The RequestParameters model. - */ -@Immutable -public final class RequestParameters implements JsonSerializable { - /* - * The type property. - */ - @Generated - private final RequestParametersType type; - - /** - * Creates an instance of RequestParameters class. - * - * @param type the type value to set. - */ - @Generated - public RequestParameters(RequestParametersType type) { - this.type = type; - } - - /** - * Get the type property: The type property. - * - * @return the type value. - */ - @Generated - public RequestParametersType getType() { - return this.type; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of RequestParameters from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of RequestParameters if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the RequestParameters. - */ - @Generated - public static RequestParameters fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - RequestParametersType type = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("type".equals(fieldName)) { - type = RequestParametersType.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new RequestParameters(type); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParametersType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParametersType.java deleted file mode 100644 index 9874d82d88d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParametersType.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -/** - * Defines values for RequestParametersType. - */ -public enum RequestParametersType { - /** - * Enum value Type1. - */ - TYPE1("Type1"), - - /** - * Enum value Type2. - */ - TYPE2("Type2"); - - /** - * The actual serialized value for a RequestParametersType instance. - */ - private final String value; - - RequestParametersType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a RequestParametersType instance. - * - * @param value the serialized value to parse. - * @return the parsed RequestParametersType object, or null if unable to parse. - */ - public static RequestParametersType fromString(String value) { - if (value == null) { - return null; - } - RequestParametersType[] items = RequestParametersType.values(); - for (RequestParametersType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObject.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObject.java deleted file mode 100644 index 684c706c96c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObject.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The RunObject model. - */ -@Immutable -public final class RunObject implements JsonSerializable { - /* - * The last_error property. - */ - @Generated - private final RunObjectLastError1 lastError; - - /** - * Creates an instance of RunObject class. - * - * @param lastError the lastError value to set. - */ - @Generated - private RunObject(RunObjectLastError1 lastError) { - this.lastError = lastError; - } - - /** - * Get the lastError property: The last_error property. - * - * @return the lastError value. - */ - @Generated - public RunObjectLastError1 getLastError() { - return this.lastError; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("last_error", this.lastError); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of RunObject from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of RunObject if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the RunObject. - */ - @Generated - public static RunObject fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - RunObjectLastError1 lastError = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("last_error".equals(fieldName)) { - lastError = RunObjectLastError1.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new RunObject(lastError); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastError1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastError1.java deleted file mode 100644 index 06de8bd7eb2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastError1.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The RunObjectLastError1 model. - */ -@Immutable -public final class RunObjectLastError1 implements JsonSerializable { - /* - * The code property. - */ - @Generated - private final RunObjectLastErrorCode code; - - /** - * Creates an instance of RunObjectLastError1 class. - * - * @param code the code value to set. - */ - @Generated - private RunObjectLastError1(RunObjectLastErrorCode code) { - this.code = code; - } - - /** - * Get the code property: The code property. - * - * @return the code value. - */ - @Generated - public RunObjectLastErrorCode getCode() { - return this.code; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("code", this.code == null ? null : this.code.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of RunObjectLastError1 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of RunObjectLastError1 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the RunObjectLastError1. - */ - @Generated - public static RunObjectLastError1 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - RunObjectLastErrorCode code = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("code".equals(fieldName)) { - code = RunObjectLastErrorCode.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new RunObjectLastError1(code); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastErrorCode.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastErrorCode.java deleted file mode 100644 index 6aa0ead6ebf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastErrorCode.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -/** - * Defines values for RunObjectLastErrorCode. - */ -public enum RunObjectLastErrorCode { - /** - * Enum value server_error. - */ - SERVER_ERROR("server_error"), - - /** - * Enum value rate_limit_exceeded. - */ - RATE_LIMIT_EXCEEDED("rate_limit_exceeded"), - - /** - * Enum value invalid_prompt. - */ - INVALID_PROMPT("invalid_prompt"); - - /** - * The actual serialized value for a RunObjectLastErrorCode instance. - */ - private final String value; - - RunObjectLastErrorCode(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a RunObjectLastErrorCode instance. - * - * @param value the serialized value to parse. - * @return the parsed RunObjectLastErrorCode object, or null if unable to parse. - */ - public static RunObjectLastErrorCode fromString(String value) { - if (value == null) { - return null; - } - RunObjectLastErrorCode[] items = RunObjectLastErrorCode.values(); - for (RunObjectLastErrorCode item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/TypesModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/TypesModel.java deleted file mode 100644 index 5177a618296..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/TypesModel.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.models; - -/** - * summary of Types - * - * description of Types. - */ -public enum TypesModel { - /** - * Enum value Blob. - */ - BLOB("Blob"), - - /** - * Enum value File. - */ - FILE("File"); - - /** - * The actual serialized value for a TypesModel instance. - */ - private final String value; - - TypesModel(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a TypesModel instance. - * - * @param value the serialized value to parse. - * @return the parsed TypesModel object, or null if unable to parse. - */ - public static TypesModel fromString(String value) { - if (value == null) { - return null; - } - TypesModel[] items = TypesModel.values(); - for (TypesModel item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/package-info.java deleted file mode 100644 index 54d07be7724..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for NamingJavaParser. - * description of Naming JavaParser. - * - */ -package tsptest.namingjavaparser.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/package-info.java deleted file mode 100644 index a9b955b3184..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for NamingJavaParser. - * description of Naming JavaParser. - * - */ -package tsptest.namingjavaparser; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalAsyncClient.java deleted file mode 100644 index c5b9d71904a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalAsyncClient.java +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.optional.implementation.OptionalOpsImpl; -import tsptest.optional.models.AllPropertiesOptional; -import tsptest.optional.models.Optional; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class OptionalAsyncClient { - @Generated - private final OptionalOpsImpl serviceClient; - - /** - * Initializes an instance of OptionalAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - OptionalAsyncClient(OptionalOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The put operation. - *

Query Parameters

- * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
booleanNullableBooleanNoThe booleanNullable parameter
stringStringNoThe string parameter
stringNullableStringNoThe stringNullable parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
request-header-optionalStringNoThe requestHeaderOptional parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: Boolean (Optional)
-     *     booleanNullable: Boolean (Optional)
-     *     booleanRequired: boolean (Required)
-     *     booleanRequiredNullable: Boolean (Required)
-     *     string: String (Optional)
-     *     stringNullable: String (Optional)
-     *     stringRequired: String (Required)
-     *     stringRequiredNullable: String (Required)
-     *     bytes: byte[] (Optional)
-     *     int: Integer (Optional)
-     *     long: Long (Optional)
-     *     float: Double (Optional)
-     *     double: Double (Optional)
-     *     duration: Duration (Optional)
-     *     dateTime: OffsetDateTime (Optional)
-     *     stringList (Optional): [
-     *         String (Optional)
-     *     ]
-     *     bytesDict (Optional): {
-     *         String: byte[] (Required)
-     *     }
-     *     epochDateTimeRequiredNullable: Long (Required)
-     *     epochDateTimeNullable: Long (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: Boolean (Optional)
-     *     booleanNullable: Boolean (Optional)
-     *     booleanRequired: Boolean (Optional)
-     *     booleanRequiredNullable: Boolean (Optional)
-     *     string: String (Optional)
-     *     stringNullable: String (Optional)
-     *     stringRequired: String (Optional)
-     *     stringRequiredNullable: String (Optional)
-     *     bytes: byte[] (Optional)
-     *     int: Integer (Optional)
-     *     long: Long (Optional)
-     *     float: Double (Optional)
-     *     double: Double (Optional)
-     *     duration: Duration (Optional)
-     *     dateTime: OffsetDateTime (Optional)
-     *     stringList (Optional): [
-     *         String (Optional)
-     *     ]
-     *     bytesDict (Optional): {
-     *         String: byte[] (Required)
-     *     }
-     *     epochDateTimeRequiredNullable: Long (Optional)
-     *     epochDateTimeNullable: Long (Optional)
-     *     immutable (Optional): {
-     *         stringReadWriteRequired: String (Required)
-     *         stringReadOnlyOptional: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestHeaderRequired The requestHeaderRequired parameter. - * @param booleanRequired The booleanRequired parameter. - * @param booleanRequiredNullable The booleanRequiredNullable parameter. - * @param stringRequired The stringRequired parameter. - * @param stringRequiredNullable The stringRequiredNullable parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(String requestHeaderRequired, boolean booleanRequired, - Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable, - RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(requestHeaderRequired, booleanRequired, booleanRequiredNullable, - stringRequired, stringRequiredNullable, requestOptions); - } - - /** - * The put operation. - * - * @param requestHeaderRequired The requestHeaderRequired parameter. - * @param booleanRequired The booleanRequired parameter. - * @param booleanRequiredNullable The booleanRequiredNullable parameter. - * @param stringRequired The stringRequired parameter. - * @param stringRequiredNullable The stringRequiredNullable parameter. - * @param requestHeaderOptional The requestHeaderOptional parameter. - * @param booleanNullable The booleanNullable parameter. - * @param string The string parameter. - * @param stringNullable The stringNullable parameter. - * @param optional The optional parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(String requestHeaderRequired, boolean booleanRequired, - Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable, - String requestHeaderOptional, Boolean booleanNullable, String string, String stringNullable, - Optional optional) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (requestHeaderOptional != null) { - requestOptions.setHeader(HttpHeaderName.fromString("request-header-optional"), requestHeaderOptional); - } - if (booleanNullable != null) { - requestOptions.addQueryParam("booleanNullable", String.valueOf(booleanNullable), false); - } - if (string != null) { - requestOptions.addQueryParam("string", string, false); - } - if (stringNullable != null) { - requestOptions.addQueryParam("stringNullable", stringNullable, false); - } - if (optional != null) { - requestOptions.setBody(BinaryData.fromObject(optional)); - } - return putWithResponse(requestHeaderRequired, booleanRequired, booleanRequiredNullable, stringRequired, - stringRequiredNullable, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(AllPropertiesOptional.class)); - } - - /** - * The put operation. - * - * @param requestHeaderRequired The requestHeaderRequired parameter. - * @param booleanRequired The booleanRequired parameter. - * @param booleanRequiredNullable The booleanRequiredNullable parameter. - * @param stringRequired The stringRequired parameter. - * @param stringRequiredNullable The stringRequiredNullable parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(String requestHeaderRequired, boolean booleanRequired, - Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(requestHeaderRequired, booleanRequired, booleanRequiredNullable, stringRequired, - stringRequiredNullable, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(AllPropertiesOptional.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClient.java deleted file mode 100644 index 9b0669c9684..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClient.java +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.optional.implementation.OptionalOpsImpl; -import tsptest.optional.models.AllPropertiesOptional; -import tsptest.optional.models.Optional; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class OptionalClient { - @Generated - private final OptionalOpsImpl serviceClient; - - /** - * Initializes an instance of OptionalClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - OptionalClient(OptionalOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The put operation. - *

Query Parameters

- * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
booleanNullableBooleanNoThe booleanNullable parameter
stringStringNoThe string parameter
stringNullableStringNoThe stringNullable parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
request-header-optionalStringNoThe requestHeaderOptional parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: Boolean (Optional)
-     *     booleanNullable: Boolean (Optional)
-     *     booleanRequired: boolean (Required)
-     *     booleanRequiredNullable: Boolean (Required)
-     *     string: String (Optional)
-     *     stringNullable: String (Optional)
-     *     stringRequired: String (Required)
-     *     stringRequiredNullable: String (Required)
-     *     bytes: byte[] (Optional)
-     *     int: Integer (Optional)
-     *     long: Long (Optional)
-     *     float: Double (Optional)
-     *     double: Double (Optional)
-     *     duration: Duration (Optional)
-     *     dateTime: OffsetDateTime (Optional)
-     *     stringList (Optional): [
-     *         String (Optional)
-     *     ]
-     *     bytesDict (Optional): {
-     *         String: byte[] (Required)
-     *     }
-     *     epochDateTimeRequiredNullable: Long (Required)
-     *     epochDateTimeNullable: Long (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: Boolean (Optional)
-     *     booleanNullable: Boolean (Optional)
-     *     booleanRequired: Boolean (Optional)
-     *     booleanRequiredNullable: Boolean (Optional)
-     *     string: String (Optional)
-     *     stringNullable: String (Optional)
-     *     stringRequired: String (Optional)
-     *     stringRequiredNullable: String (Optional)
-     *     bytes: byte[] (Optional)
-     *     int: Integer (Optional)
-     *     long: Long (Optional)
-     *     float: Double (Optional)
-     *     double: Double (Optional)
-     *     duration: Duration (Optional)
-     *     dateTime: OffsetDateTime (Optional)
-     *     stringList (Optional): [
-     *         String (Optional)
-     *     ]
-     *     bytesDict (Optional): {
-     *         String: byte[] (Required)
-     *     }
-     *     epochDateTimeRequiredNullable: Long (Optional)
-     *     epochDateTimeNullable: Long (Optional)
-     *     immutable (Optional): {
-     *         stringReadWriteRequired: String (Required)
-     *         stringReadOnlyOptional: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestHeaderRequired The requestHeaderRequired parameter. - * @param booleanRequired The booleanRequired parameter. - * @param booleanRequiredNullable The booleanRequiredNullable parameter. - * @param stringRequired The stringRequired parameter. - * @param stringRequiredNullable The stringRequiredNullable parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(String requestHeaderRequired, boolean booleanRequired, - Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable, - RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(requestHeaderRequired, booleanRequired, booleanRequiredNullable, - stringRequired, stringRequiredNullable, requestOptions); - } - - /** - * The put operation. - * - * @param requestHeaderRequired The requestHeaderRequired parameter. - * @param booleanRequired The booleanRequired parameter. - * @param booleanRequiredNullable The booleanRequiredNullable parameter. - * @param stringRequired The stringRequired parameter. - * @param stringRequiredNullable The stringRequiredNullable parameter. - * @param requestHeaderOptional The requestHeaderOptional parameter. - * @param booleanNullable The booleanNullable parameter. - * @param string The string parameter. - * @param stringNullable The stringNullable parameter. - * @param optional The optional parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public AllPropertiesOptional put(String requestHeaderRequired, boolean booleanRequired, - Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable, - String requestHeaderOptional, Boolean booleanNullable, String string, String stringNullable, - Optional optional) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (requestHeaderOptional != null) { - requestOptions.setHeader(HttpHeaderName.fromString("request-header-optional"), requestHeaderOptional); - } - if (booleanNullable != null) { - requestOptions.addQueryParam("booleanNullable", String.valueOf(booleanNullable), false); - } - if (string != null) { - requestOptions.addQueryParam("string", string, false); - } - if (stringNullable != null) { - requestOptions.addQueryParam("stringNullable", stringNullable, false); - } - if (optional != null) { - requestOptions.setBody(BinaryData.fromObject(optional)); - } - return putWithResponse(requestHeaderRequired, booleanRequired, booleanRequiredNullable, stringRequired, - stringRequiredNullable, requestOptions).getValue().toObject(AllPropertiesOptional.class); - } - - /** - * The put operation. - * - * @param requestHeaderRequired The requestHeaderRequired parameter. - * @param booleanRequired The booleanRequired parameter. - * @param booleanRequiredNullable The booleanRequiredNullable parameter. - * @param stringRequired The stringRequired parameter. - * @param stringRequiredNullable The stringRequiredNullable parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public AllPropertiesOptional put(String requestHeaderRequired, boolean booleanRequired, - Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(requestHeaderRequired, booleanRequired, booleanRequiredNullable, stringRequired, - stringRequiredNullable, requestOptions).getValue().toObject(AllPropertiesOptional.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClientBuilder.java deleted file mode 100644 index 30b2d520b3c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.optional.implementation.OptionalClientImpl; - -/** - * A builder for creating a new instance of the OptionalClient type. - */ -@ServiceClientBuilder(serviceClients = { OptionalClient.class, OptionalAsyncClient.class }) -public final class OptionalClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-optional.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the OptionalClientBuilder. - */ - @Generated - public OptionalClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the OptionalClientBuilder. - */ - @Generated - public OptionalClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of OptionalClientImpl with the provided parameters. - * - * @return an instance of OptionalClientImpl. - */ - @Generated - private OptionalClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - OptionalClientImpl client - = new OptionalClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of OptionalAsyncClient class. - * - * @return an instance of OptionalAsyncClient. - */ - @Generated - public OptionalAsyncClient buildAsyncClient() { - return new OptionalAsyncClient(buildInnerClient().getOptionalOps()); - } - - /** - * Builds an instance of OptionalClient class. - * - * @return an instance of OptionalClient. - */ - @Generated - public OptionalClient buildClient() { - return new OptionalClient(buildInnerClient().getOptionalOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(OptionalClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalClientImpl.java deleted file mode 100644 index ef211e5df6d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.optional.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 OptionalClient type. - */ -public final class OptionalClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 OptionalOpsImpl object to access its operations. - */ - private final OptionalOpsImpl optionalOps; - - /** - * Gets the OptionalOpsImpl object to access its operations. - * - * @return the OptionalOpsImpl object. - */ - public OptionalOpsImpl getOptionalOps() { - return this.optionalOps; - } - - /** - * Initializes an instance of OptionalClient client. - * - * @param endpoint Service host. - */ - public OptionalClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of OptionalClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public OptionalClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of OptionalClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public OptionalClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.optionalOps = new OptionalOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalOpsImpl.java deleted file mode 100644 index 58db75c0831..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalOpsImpl.java +++ /dev/null @@ -1,321 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.optional.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in OptionalOps. - */ -public final class OptionalOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final OptionalOpsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of OptionalOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - OptionalOpsImpl(OptionalClientImpl client) { - this.service - = RestProxy.create(OptionalOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientOptionalOps to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientOptionalOps") - public interface OptionalOpsService { - @Put("/optional/put") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("request-header-required") String requestHeaderRequired, - @QueryParam("booleanRequired") boolean booleanRequired, - @QueryParam("booleanRequiredNullable") Boolean booleanRequiredNullable, - @QueryParam("stringRequired") String stringRequired, - @QueryParam("stringRequiredNullable") String stringRequiredNullable, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/optional/put") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, - @HeaderParam("request-header-required") String requestHeaderRequired, - @QueryParam("booleanRequired") boolean booleanRequired, - @QueryParam("booleanRequiredNullable") Boolean booleanRequiredNullable, - @QueryParam("stringRequired") String stringRequired, - @QueryParam("stringRequiredNullable") String stringRequiredNullable, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The put operation. - *

Query Parameters

- * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
booleanNullableBooleanNoThe booleanNullable parameter
stringStringNoThe string parameter
stringNullableStringNoThe stringNullable parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
request-header-optionalStringNoThe requestHeaderOptional parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: Boolean (Optional)
-     *     booleanNullable: Boolean (Optional)
-     *     booleanRequired: boolean (Required)
-     *     booleanRequiredNullable: Boolean (Required)
-     *     string: String (Optional)
-     *     stringNullable: String (Optional)
-     *     stringRequired: String (Required)
-     *     stringRequiredNullable: String (Required)
-     *     bytes: byte[] (Optional)
-     *     int: Integer (Optional)
-     *     long: Long (Optional)
-     *     float: Double (Optional)
-     *     double: Double (Optional)
-     *     duration: Duration (Optional)
-     *     dateTime: OffsetDateTime (Optional)
-     *     stringList (Optional): [
-     *         String (Optional)
-     *     ]
-     *     bytesDict (Optional): {
-     *         String: byte[] (Required)
-     *     }
-     *     epochDateTimeRequiredNullable: Long (Required)
-     *     epochDateTimeNullable: Long (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: Boolean (Optional)
-     *     booleanNullable: Boolean (Optional)
-     *     booleanRequired: Boolean (Optional)
-     *     booleanRequiredNullable: Boolean (Optional)
-     *     string: String (Optional)
-     *     stringNullable: String (Optional)
-     *     stringRequired: String (Optional)
-     *     stringRequiredNullable: String (Optional)
-     *     bytes: byte[] (Optional)
-     *     int: Integer (Optional)
-     *     long: Long (Optional)
-     *     float: Double (Optional)
-     *     double: Double (Optional)
-     *     duration: Duration (Optional)
-     *     dateTime: OffsetDateTime (Optional)
-     *     stringList (Optional): [
-     *         String (Optional)
-     *     ]
-     *     bytesDict (Optional): {
-     *         String: byte[] (Required)
-     *     }
-     *     epochDateTimeRequiredNullable: Long (Optional)
-     *     epochDateTimeNullable: Long (Optional)
-     *     immutable (Optional): {
-     *         stringReadWriteRequired: String (Required)
-     *         stringReadOnlyOptional: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestHeaderRequired The requestHeaderRequired parameter. - * @param booleanRequired The booleanRequired parameter. - * @param booleanRequiredNullable The booleanRequiredNullable parameter. - * @param stringRequired The stringRequired parameter. - * @param stringRequiredNullable The stringRequiredNullable parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(String requestHeaderRequired, boolean booleanRequired, - Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable, - RequestOptions requestOptions) { - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), requestHeaderRequired, booleanRequired, - booleanRequiredNullable, stringRequired, stringRequiredNullable, accept, requestOptionsLocal, context)); - } - - /** - * The put operation. - *

Query Parameters

- * - * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
booleanNullableBooleanNoThe booleanNullable parameter
stringStringNoThe string parameter
stringNullableStringNoThe stringNullable parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
request-header-optionalStringNoThe requestHeaderOptional parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: Boolean (Optional)
-     *     booleanNullable: Boolean (Optional)
-     *     booleanRequired: boolean (Required)
-     *     booleanRequiredNullable: Boolean (Required)
-     *     string: String (Optional)
-     *     stringNullable: String (Optional)
-     *     stringRequired: String (Required)
-     *     stringRequiredNullable: String (Required)
-     *     bytes: byte[] (Optional)
-     *     int: Integer (Optional)
-     *     long: Long (Optional)
-     *     float: Double (Optional)
-     *     double: Double (Optional)
-     *     duration: Duration (Optional)
-     *     dateTime: OffsetDateTime (Optional)
-     *     stringList (Optional): [
-     *         String (Optional)
-     *     ]
-     *     bytesDict (Optional): {
-     *         String: byte[] (Required)
-     *     }
-     *     epochDateTimeRequiredNullable: Long (Required)
-     *     epochDateTimeNullable: Long (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     boolean: Boolean (Optional)
-     *     booleanNullable: Boolean (Optional)
-     *     booleanRequired: Boolean (Optional)
-     *     booleanRequiredNullable: Boolean (Optional)
-     *     string: String (Optional)
-     *     stringNullable: String (Optional)
-     *     stringRequired: String (Optional)
-     *     stringRequiredNullable: String (Optional)
-     *     bytes: byte[] (Optional)
-     *     int: Integer (Optional)
-     *     long: Long (Optional)
-     *     float: Double (Optional)
-     *     double: Double (Optional)
-     *     duration: Duration (Optional)
-     *     dateTime: OffsetDateTime (Optional)
-     *     stringList (Optional): [
-     *         String (Optional)
-     *     ]
-     *     bytesDict (Optional): {
-     *         String: byte[] (Required)
-     *     }
-     *     epochDateTimeRequiredNullable: Long (Optional)
-     *     epochDateTimeNullable: Long (Optional)
-     *     immutable (Optional): {
-     *         stringReadWriteRequired: String (Required)
-     *         stringReadOnlyOptional: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestHeaderRequired The requestHeaderRequired parameter. - * @param booleanRequired The booleanRequired parameter. - * @param booleanRequiredNullable The booleanRequiredNullable parameter. - * @param stringRequired The stringRequired parameter. - * @param stringRequiredNullable The stringRequiredNullable parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(String requestHeaderRequired, boolean booleanRequired, - Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable, - RequestOptions requestOptions) { - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - return service.putSync(this.client.getEndpoint(), requestHeaderRequired, booleanRequired, - booleanRequiredNullable, stringRequired, stringRequiredNullable, accept, requestOptionsLocal, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/package-info.java deleted file mode 100644 index 8e1b7228f07..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Optional. - * - */ -package tsptest.optional.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/AllPropertiesOptional.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/AllPropertiesOptional.java deleted file mode 100644 index edec72876a6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/AllPropertiesOptional.java +++ /dev/null @@ -1,462 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.optional.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; -import java.time.Instant; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.Map; - -/** - * The AllPropertiesOptional model. - */ -@Immutable -public final class AllPropertiesOptional implements JsonSerializable { - /* - * The boolean property. - */ - @Generated - private Boolean booleanProperty; - - /* - * The booleanNullable property. - */ - @Generated - private Boolean booleanNullable; - - /* - * The booleanRequired property. - */ - @Generated - private Boolean booleanRequired; - - /* - * The booleanRequiredNullable property. - */ - @Generated - private Boolean booleanRequiredNullable; - - /* - * The string property. - */ - @Generated - private String string; - - /* - * The stringNullable property. - */ - @Generated - private String stringNullable; - - /* - * The stringRequired property. - */ - @Generated - private String stringRequired; - - /* - * The stringRequiredNullable property. - */ - @Generated - private String stringRequiredNullable; - - /* - * The bytes property. - */ - @Generated - private byte[] bytes; - - /* - * The int property. - */ - @Generated - private Integer intProperty; - - /* - * The long property. - */ - @Generated - private Long longProperty; - - /* - * The float property. - */ - @Generated - private Double floatProperty; - - /* - * The double property. - */ - @Generated - private Double doubleProperty; - - /* - * The duration property. - */ - @Generated - private Duration duration; - - /* - * The dateTime property. - */ - @Generated - private OffsetDateTime dateTime; - - /* - * The stringList property. - */ - @Generated - private List stringList; - - /* - * The bytesDict property. - */ - @Generated - private Map bytesDict; - - /* - * The epochDateTimeRequiredNullable property. - */ - @Generated - private Long epochDateTimeRequiredNullable; - - /* - * The epochDateTimeNullable property. - */ - @Generated - private Long epochDateTimeNullable; - - /* - * The immutable property. - */ - @Generated - private ImmutableModel immutable; - - /** - * Creates an instance of AllPropertiesOptional class. - */ - @Generated - private AllPropertiesOptional() { - } - - /** - * Get the booleanProperty property: The boolean property. - * - * @return the booleanProperty value. - */ - @Generated - public Boolean isBooleanProperty() { - return this.booleanProperty; - } - - /** - * Get the booleanNullable property: The booleanNullable property. - * - * @return the booleanNullable value. - */ - @Generated - public Boolean isBooleanNullable() { - return this.booleanNullable; - } - - /** - * Get the booleanRequired property: The booleanRequired property. - * - * @return the booleanRequired value. - */ - @Generated - public Boolean isBooleanRequired() { - return this.booleanRequired; - } - - /** - * Get the booleanRequiredNullable property: The booleanRequiredNullable property. - * - * @return the booleanRequiredNullable value. - */ - @Generated - public Boolean isBooleanRequiredNullable() { - return this.booleanRequiredNullable; - } - - /** - * Get the string property: The string property. - * - * @return the string value. - */ - @Generated - public String getString() { - return this.string; - } - - /** - * Get the stringNullable property: The stringNullable property. - * - * @return the stringNullable value. - */ - @Generated - public String getStringNullable() { - return this.stringNullable; - } - - /** - * Get the stringRequired property: The stringRequired property. - * - * @return the stringRequired value. - */ - @Generated - public String getStringRequired() { - return this.stringRequired; - } - - /** - * Get the stringRequiredNullable property: The stringRequiredNullable property. - * - * @return the stringRequiredNullable value. - */ - @Generated - public String getStringRequiredNullable() { - return this.stringRequiredNullable; - } - - /** - * Get the bytes property: The bytes property. - * - * @return the bytes value. - */ - @Generated - public byte[] getBytes() { - return CoreUtils.clone(this.bytes); - } - - /** - * Get the intProperty property: The int property. - * - * @return the intProperty value. - */ - @Generated - public Integer getIntProperty() { - return this.intProperty; - } - - /** - * Get the longProperty property: The long property. - * - * @return the longProperty value. - */ - @Generated - public Long getLongProperty() { - return this.longProperty; - } - - /** - * Get the floatProperty property: The float property. - * - * @return the floatProperty value. - */ - @Generated - public Double getFloatProperty() { - return this.floatProperty; - } - - /** - * Get the doubleProperty property: The double property. - * - * @return the doubleProperty value. - */ - @Generated - public Double getDoubleProperty() { - return this.doubleProperty; - } - - /** - * Get the duration property: The duration property. - * - * @return the duration value. - */ - @Generated - public Duration getDuration() { - return this.duration; - } - - /** - * Get the dateTime property: The dateTime property. - * - * @return the dateTime value. - */ - @Generated - public OffsetDateTime getDateTime() { - return this.dateTime; - } - - /** - * Get the stringList property: The stringList property. - * - * @return the stringList value. - */ - @Generated - public List getStringList() { - return this.stringList; - } - - /** - * Get the bytesDict property: The bytesDict property. - * - * @return the bytesDict value. - */ - @Generated - public Map getBytesDict() { - return this.bytesDict; - } - - /** - * Get the epochDateTimeRequiredNullable property: The epochDateTimeRequiredNullable property. - * - * @return the epochDateTimeRequiredNullable value. - */ - @Generated - public OffsetDateTime getEpochDateTimeRequiredNullable() { - if (this.epochDateTimeRequiredNullable == null) { - return null; - } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.epochDateTimeRequiredNullable), ZoneOffset.UTC); - } - - /** - * Get the epochDateTimeNullable property: The epochDateTimeNullable property. - * - * @return the epochDateTimeNullable value. - */ - @Generated - public OffsetDateTime getEpochDateTimeNullable() { - if (this.epochDateTimeNullable == null) { - return null; - } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.epochDateTimeNullable), ZoneOffset.UTC); - } - - /** - * Get the immutable property: The immutable property. - * - * @return the immutable value. - */ - @Generated - public ImmutableModel getImmutable() { - return this.immutable; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("boolean", this.booleanProperty); - jsonWriter.writeBooleanField("booleanNullable", this.booleanNullable); - jsonWriter.writeBooleanField("booleanRequired", this.booleanRequired); - jsonWriter.writeBooleanField("booleanRequiredNullable", this.booleanRequiredNullable); - jsonWriter.writeStringField("string", this.string); - jsonWriter.writeStringField("stringNullable", this.stringNullable); - jsonWriter.writeStringField("stringRequired", this.stringRequired); - jsonWriter.writeStringField("stringRequiredNullable", this.stringRequiredNullable); - jsonWriter.writeBinaryField("bytes", this.bytes); - jsonWriter.writeNumberField("int", this.intProperty); - jsonWriter.writeNumberField("long", this.longProperty); - jsonWriter.writeNumberField("float", this.floatProperty); - jsonWriter.writeNumberField("double", this.doubleProperty); - jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); - jsonWriter.writeStringField("dateTime", - this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); - jsonWriter.writeArrayField("stringList", this.stringList, (writer, element) -> writer.writeString(element)); - jsonWriter.writeMapField("bytesDict", this.bytesDict, (writer, element) -> writer.writeBinary(element)); - jsonWriter.writeNumberField("epochDateTimeRequiredNullable", this.epochDateTimeRequiredNullable); - jsonWriter.writeNumberField("epochDateTimeNullable", this.epochDateTimeNullable); - jsonWriter.writeJsonField("immutable", this.immutable); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of AllPropertiesOptional from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of AllPropertiesOptional if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the AllPropertiesOptional. - */ - @Generated - public static AllPropertiesOptional fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - AllPropertiesOptional deserializedAllPropertiesOptional = new AllPropertiesOptional(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("boolean".equals(fieldName)) { - deserializedAllPropertiesOptional.booleanProperty = reader.getNullable(JsonReader::getBoolean); - } else if ("booleanNullable".equals(fieldName)) { - deserializedAllPropertiesOptional.booleanNullable = reader.getNullable(JsonReader::getBoolean); - } else if ("booleanRequired".equals(fieldName)) { - deserializedAllPropertiesOptional.booleanRequired = reader.getNullable(JsonReader::getBoolean); - } else if ("booleanRequiredNullable".equals(fieldName)) { - deserializedAllPropertiesOptional.booleanRequiredNullable - = reader.getNullable(JsonReader::getBoolean); - } else if ("string".equals(fieldName)) { - deserializedAllPropertiesOptional.string = reader.getString(); - } else if ("stringNullable".equals(fieldName)) { - deserializedAllPropertiesOptional.stringNullable = reader.getString(); - } else if ("stringRequired".equals(fieldName)) { - deserializedAllPropertiesOptional.stringRequired = reader.getString(); - } else if ("stringRequiredNullable".equals(fieldName)) { - deserializedAllPropertiesOptional.stringRequiredNullable = reader.getString(); - } else if ("bytes".equals(fieldName)) { - deserializedAllPropertiesOptional.bytes = reader.getBinary(); - } else if ("int".equals(fieldName)) { - deserializedAllPropertiesOptional.intProperty = reader.getNullable(JsonReader::getInt); - } else if ("long".equals(fieldName)) { - deserializedAllPropertiesOptional.longProperty = reader.getNullable(JsonReader::getLong); - } else if ("float".equals(fieldName)) { - deserializedAllPropertiesOptional.floatProperty = reader.getNullable(JsonReader::getDouble); - } else if ("double".equals(fieldName)) { - deserializedAllPropertiesOptional.doubleProperty = reader.getNullable(JsonReader::getDouble); - } else if ("duration".equals(fieldName)) { - deserializedAllPropertiesOptional.duration - = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); - } else if ("dateTime".equals(fieldName)) { - deserializedAllPropertiesOptional.dateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("stringList".equals(fieldName)) { - List stringList = reader.readArray(reader1 -> reader1.getString()); - deserializedAllPropertiesOptional.stringList = stringList; - } else if ("bytesDict".equals(fieldName)) { - Map bytesDict = reader.readMap(reader1 -> reader1.getBinary()); - deserializedAllPropertiesOptional.bytesDict = bytesDict; - } else if ("epochDateTimeRequiredNullable".equals(fieldName)) { - deserializedAllPropertiesOptional.epochDateTimeRequiredNullable - = reader.getNullable(JsonReader::getLong); - } else if ("epochDateTimeNullable".equals(fieldName)) { - deserializedAllPropertiesOptional.epochDateTimeNullable = reader.getNullable(JsonReader::getLong); - } else if ("immutable".equals(fieldName)) { - deserializedAllPropertiesOptional.immutable = ImmutableModel.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedAllPropertiesOptional; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/ImmutableModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/ImmutableModel.java deleted file mode 100644 index d64c891e073..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/ImmutableModel.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.optional.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ImmutableModel model. - */ -@Immutable -public final class ImmutableModel implements JsonSerializable { - /* - * The stringReadWriteRequired property. - */ - @Generated - private final String stringReadWriteRequired; - - /* - * The stringReadOnlyOptional property. - */ - @Generated - private String stringReadOnlyOptional; - - /** - * Creates an instance of ImmutableModel class. - * - * @param stringReadWriteRequired the stringReadWriteRequired value to set. - */ - @Generated - private ImmutableModel(String stringReadWriteRequired) { - this.stringReadWriteRequired = stringReadWriteRequired; - } - - /** - * Get the stringReadWriteRequired property: The stringReadWriteRequired property. - * - * @return the stringReadWriteRequired value. - */ - @Generated - public String getStringReadWriteRequired() { - return this.stringReadWriteRequired; - } - - /** - * Get the stringReadOnlyOptional property: The stringReadOnlyOptional property. - * - * @return the stringReadOnlyOptional value. - */ - @Generated - public String getStringReadOnlyOptional() { - return this.stringReadOnlyOptional; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("stringReadWriteRequired", this.stringReadWriteRequired); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ImmutableModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ImmutableModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ImmutableModel. - */ - @Generated - public static ImmutableModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String stringReadWriteRequired = null; - String stringReadOnlyOptional = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("stringReadWriteRequired".equals(fieldName)) { - stringReadWriteRequired = reader.getString(); - } else if ("stringReadOnlyOptional".equals(fieldName)) { - stringReadOnlyOptional = reader.getString(); - } else { - reader.skipChildren(); - } - } - ImmutableModel deserializedImmutableModel = new ImmutableModel(stringReadWriteRequired); - deserializedImmutableModel.stringReadOnlyOptional = stringReadOnlyOptional; - - return deserializedImmutableModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/Optional.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/Optional.java deleted file mode 100644 index 095191c78cd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/Optional.java +++ /dev/null @@ -1,665 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; -import java.time.Instant; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.Map; - -/** - * The Optional model. - */ -@Fluent -public final class Optional implements JsonSerializable { - /* - * The boolean property. - */ - @Generated - private Boolean booleanProperty; - - /* - * The booleanNullable property. - */ - @Generated - private Boolean booleanNullable; - - /* - * The booleanRequired property. - */ - @Generated - private final boolean booleanRequired; - - /* - * The booleanRequiredNullable property. - */ - @Generated - private final Boolean booleanRequiredNullable; - - /* - * The string property. - */ - @Generated - private String string; - - /* - * The stringNullable property. - */ - @Generated - private String stringNullable; - - /* - * The stringRequired property. - */ - @Generated - private final String stringRequired; - - /* - * The stringRequiredNullable property. - */ - @Generated - private final String stringRequiredNullable; - - /* - * The bytes property. - */ - @Generated - private byte[] bytes; - - /* - * The int property. - */ - @Generated - private Integer intProperty; - - /* - * The long property. - */ - @Generated - private Long longProperty; - - /* - * The float property. - */ - @Generated - private Double floatProperty; - - /* - * The double property. - */ - @Generated - private Double doubleProperty; - - /* - * The duration property. - */ - @Generated - private Duration duration; - - /* - * The dateTime property. - */ - @Generated - private OffsetDateTime dateTime; - - /* - * The stringList property. - */ - @Generated - private List stringList; - - /* - * The bytesDict property. - */ - @Generated - private Map bytesDict; - - /* - * The epochDateTimeRequiredNullable property. - */ - @Generated - private final Long epochDateTimeRequiredNullable; - - /* - * The epochDateTimeNullable property. - */ - @Generated - private Long epochDateTimeNullable; - - /** - * Creates an instance of Optional class. - * - * @param booleanRequired the booleanRequired value to set. - * @param booleanRequiredNullable the booleanRequiredNullable value to set. - * @param stringRequired the stringRequired value to set. - * @param stringRequiredNullable the stringRequiredNullable value to set. - * @param epochDateTimeRequiredNullable the epochDateTimeRequiredNullable value to set. - */ - @Generated - public Optional(boolean booleanRequired, Boolean booleanRequiredNullable, String stringRequired, - String stringRequiredNullable, OffsetDateTime epochDateTimeRequiredNullable) { - this.booleanRequired = booleanRequired; - this.booleanRequiredNullable = booleanRequiredNullable; - this.stringRequired = stringRequired; - this.stringRequiredNullable = stringRequiredNullable; - if (epochDateTimeRequiredNullable == null) { - this.epochDateTimeRequiredNullable = null; - } else { - this.epochDateTimeRequiredNullable = epochDateTimeRequiredNullable.toEpochSecond(); - } - } - - /** - * Get the booleanProperty property: The boolean property. - * - * @return the booleanProperty value. - */ - @Generated - public Boolean isBooleanProperty() { - return this.booleanProperty; - } - - /** - * Set the booleanProperty property: The boolean property. - * - * @param booleanProperty the booleanProperty value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setBooleanProperty(Boolean booleanProperty) { - this.booleanProperty = booleanProperty; - return this; - } - - /** - * Get the booleanNullable property: The booleanNullable property. - * - * @return the booleanNullable value. - */ - @Generated - public Boolean isBooleanNullable() { - return this.booleanNullable; - } - - /** - * Set the booleanNullable property: The booleanNullable property. - * - * @param booleanNullable the booleanNullable value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setBooleanNullable(Boolean booleanNullable) { - this.booleanNullable = booleanNullable; - return this; - } - - /** - * Get the booleanRequired property: The booleanRequired property. - * - * @return the booleanRequired value. - */ - @Generated - public boolean isBooleanRequired() { - return this.booleanRequired; - } - - /** - * Get the booleanRequiredNullable property: The booleanRequiredNullable property. - * - * @return the booleanRequiredNullable value. - */ - @Generated - public Boolean isBooleanRequiredNullable() { - return this.booleanRequiredNullable; - } - - /** - * Get the string property: The string property. - * - * @return the string value. - */ - @Generated - public String getString() { - return this.string; - } - - /** - * Set the string property: The string property. - * - * @param string the string value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setString(String string) { - this.string = string; - return this; - } - - /** - * Get the stringNullable property: The stringNullable property. - * - * @return the stringNullable value. - */ - @Generated - public String getStringNullable() { - return this.stringNullable; - } - - /** - * Set the stringNullable property: The stringNullable property. - * - * @param stringNullable the stringNullable value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setStringNullable(String stringNullable) { - this.stringNullable = stringNullable; - return this; - } - - /** - * Get the stringRequired property: The stringRequired property. - * - * @return the stringRequired value. - */ - @Generated - public String getStringRequired() { - return this.stringRequired; - } - - /** - * Get the stringRequiredNullable property: The stringRequiredNullable property. - * - * @return the stringRequiredNullable value. - */ - @Generated - public String getStringRequiredNullable() { - return this.stringRequiredNullable; - } - - /** - * Get the bytes property: The bytes property. - * - * @return the bytes value. - */ - @Generated - public byte[] getBytes() { - return CoreUtils.clone(this.bytes); - } - - /** - * Set the bytes property: The bytes property. - * - * @param bytes the bytes value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setBytes(byte[] bytes) { - this.bytes = CoreUtils.clone(bytes); - return this; - } - - /** - * Get the intProperty property: The int property. - * - * @return the intProperty value. - */ - @Generated - public Integer getIntProperty() { - return this.intProperty; - } - - /** - * Set the intProperty property: The int property. - * - * @param intProperty the intProperty value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setIntProperty(Integer intProperty) { - this.intProperty = intProperty; - return this; - } - - /** - * Get the longProperty property: The long property. - * - * @return the longProperty value. - */ - @Generated - public Long getLongProperty() { - return this.longProperty; - } - - /** - * Set the longProperty property: The long property. - * - * @param longProperty the longProperty value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setLongProperty(Long longProperty) { - this.longProperty = longProperty; - return this; - } - - /** - * Get the floatProperty property: The float property. - * - * @return the floatProperty value. - */ - @Generated - public Double getFloatProperty() { - return this.floatProperty; - } - - /** - * Set the floatProperty property: The float property. - * - * @param floatProperty the floatProperty value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setFloatProperty(Double floatProperty) { - this.floatProperty = floatProperty; - return this; - } - - /** - * Get the doubleProperty property: The double property. - * - * @return the doubleProperty value. - */ - @Generated - public Double getDoubleProperty() { - return this.doubleProperty; - } - - /** - * Set the doubleProperty property: The double property. - * - * @param doubleProperty the doubleProperty value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setDoubleProperty(Double doubleProperty) { - this.doubleProperty = doubleProperty; - return this; - } - - /** - * Get the duration property: The duration property. - * - * @return the duration value. - */ - @Generated - public Duration getDuration() { - return this.duration; - } - - /** - * Set the duration property: The duration property. - * - * @param duration the duration value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setDuration(Duration duration) { - this.duration = duration; - return this; - } - - /** - * Get the dateTime property: The dateTime property. - * - * @return the dateTime value. - */ - @Generated - public OffsetDateTime getDateTime() { - return this.dateTime; - } - - /** - * Set the dateTime property: The dateTime property. - * - * @param dateTime the dateTime value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setDateTime(OffsetDateTime dateTime) { - this.dateTime = dateTime; - return this; - } - - /** - * Get the stringList property: The stringList property. - * - * @return the stringList value. - */ - @Generated - public List getStringList() { - return this.stringList; - } - - /** - * Set the stringList property: The stringList property. - * - * @param stringList the stringList value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setStringList(List stringList) { - this.stringList = stringList; - return this; - } - - /** - * Get the bytesDict property: The bytesDict property. - * - * @return the bytesDict value. - */ - @Generated - public Map getBytesDict() { - return this.bytesDict; - } - - /** - * Set the bytesDict property: The bytesDict property. - * - * @param bytesDict the bytesDict value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setBytesDict(Map bytesDict) { - this.bytesDict = bytesDict; - return this; - } - - /** - * Get the epochDateTimeRequiredNullable property: The epochDateTimeRequiredNullable property. - * - * @return the epochDateTimeRequiredNullable value. - */ - @Generated - public OffsetDateTime getEpochDateTimeRequiredNullable() { - if (this.epochDateTimeRequiredNullable == null) { - return null; - } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.epochDateTimeRequiredNullable), ZoneOffset.UTC); - } - - /** - * Get the epochDateTimeNullable property: The epochDateTimeNullable property. - * - * @return the epochDateTimeNullable value. - */ - @Generated - public OffsetDateTime getEpochDateTimeNullable() { - if (this.epochDateTimeNullable == null) { - return null; - } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.epochDateTimeNullable), ZoneOffset.UTC); - } - - /** - * Set the epochDateTimeNullable property: The epochDateTimeNullable property. - * - * @param epochDateTimeNullable the epochDateTimeNullable value to set. - * @return the Optional object itself. - */ - @Generated - public Optional setEpochDateTimeNullable(OffsetDateTime epochDateTimeNullable) { - if (epochDateTimeNullable == null) { - this.epochDateTimeNullable = null; - } else { - this.epochDateTimeNullable = epochDateTimeNullable.toEpochSecond(); - } - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("booleanRequired", this.booleanRequired); - jsonWriter.writeBooleanField("booleanRequiredNullable", this.booleanRequiredNullable); - jsonWriter.writeStringField("stringRequired", this.stringRequired); - jsonWriter.writeStringField("stringRequiredNullable", this.stringRequiredNullable); - jsonWriter.writeNumberField("epochDateTimeRequiredNullable", this.epochDateTimeRequiredNullable); - jsonWriter.writeBooleanField("boolean", this.booleanProperty); - jsonWriter.writeBooleanField("booleanNullable", this.booleanNullable); - jsonWriter.writeStringField("string", this.string); - jsonWriter.writeStringField("stringNullable", this.stringNullable); - jsonWriter.writeBinaryField("bytes", this.bytes); - jsonWriter.writeNumberField("int", this.intProperty); - jsonWriter.writeNumberField("long", this.longProperty); - jsonWriter.writeNumberField("float", this.floatProperty); - jsonWriter.writeNumberField("double", this.doubleProperty); - jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); - jsonWriter.writeStringField("dateTime", - this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); - jsonWriter.writeArrayField("stringList", this.stringList, (writer, element) -> writer.writeString(element)); - jsonWriter.writeMapField("bytesDict", this.bytesDict, (writer, element) -> writer.writeBinary(element)); - jsonWriter.writeNumberField("epochDateTimeNullable", this.epochDateTimeNullable); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Optional from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Optional if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Optional. - */ - @Generated - public static Optional fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - boolean booleanRequired = false; - Boolean booleanRequiredNullable = null; - String stringRequired = null; - String stringRequiredNullable = null; - OffsetDateTime epochDateTimeRequiredNullable = null; - Boolean booleanProperty = null; - Boolean booleanNullable = null; - String string = null; - String stringNullable = null; - byte[] bytes = null; - Integer intProperty = null; - Long longProperty = null; - Double floatProperty = null; - Double doubleProperty = null; - Duration duration = null; - OffsetDateTime dateTime = null; - List stringList = null; - Map bytesDict = null; - Long epochDateTimeNullable = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("booleanRequired".equals(fieldName)) { - booleanRequired = reader.getBoolean(); - } else if ("booleanRequiredNullable".equals(fieldName)) { - booleanRequiredNullable = reader.getNullable(JsonReader::getBoolean); - } else if ("stringRequired".equals(fieldName)) { - stringRequired = reader.getString(); - } else if ("stringRequiredNullable".equals(fieldName)) { - stringRequiredNullable = reader.getString(); - } else if ("epochDateTimeRequiredNullable".equals(fieldName)) { - Long epochDateTimeRequiredNullableHolder = reader.getNullable(JsonReader::getLong); - if (epochDateTimeRequiredNullableHolder != null) { - epochDateTimeRequiredNullable = OffsetDateTime - .ofInstant(Instant.ofEpochSecond(epochDateTimeRequiredNullableHolder), ZoneOffset.UTC); - } - } else if ("boolean".equals(fieldName)) { - booleanProperty = reader.getNullable(JsonReader::getBoolean); - } else if ("booleanNullable".equals(fieldName)) { - booleanNullable = reader.getNullable(JsonReader::getBoolean); - } else if ("string".equals(fieldName)) { - string = reader.getString(); - } else if ("stringNullable".equals(fieldName)) { - stringNullable = reader.getString(); - } else if ("bytes".equals(fieldName)) { - bytes = reader.getBinary(); - } else if ("int".equals(fieldName)) { - intProperty = reader.getNullable(JsonReader::getInt); - } else if ("long".equals(fieldName)) { - longProperty = reader.getNullable(JsonReader::getLong); - } else if ("float".equals(fieldName)) { - floatProperty = reader.getNullable(JsonReader::getDouble); - } else if ("double".equals(fieldName)) { - doubleProperty = reader.getNullable(JsonReader::getDouble); - } else if ("duration".equals(fieldName)) { - duration = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); - } else if ("dateTime".equals(fieldName)) { - dateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("stringList".equals(fieldName)) { - stringList = reader.readArray(reader1 -> reader1.getString()); - } else if ("bytesDict".equals(fieldName)) { - bytesDict = reader.readMap(reader1 -> reader1.getBinary()); - } else if ("epochDateTimeNullable".equals(fieldName)) { - epochDateTimeNullable = reader.getNullable(JsonReader::getLong); - } else { - reader.skipChildren(); - } - } - Optional deserializedOptional = new Optional(booleanRequired, booleanRequiredNullable, stringRequired, - stringRequiredNullable, epochDateTimeRequiredNullable); - deserializedOptional.booleanProperty = booleanProperty; - deserializedOptional.booleanNullable = booleanNullable; - deserializedOptional.string = string; - deserializedOptional.stringNullable = stringNullable; - deserializedOptional.bytes = bytes; - deserializedOptional.intProperty = intProperty; - deserializedOptional.longProperty = longProperty; - deserializedOptional.floatProperty = floatProperty; - deserializedOptional.doubleProperty = doubleProperty; - deserializedOptional.duration = duration; - deserializedOptional.dateTime = dateTime; - deserializedOptional.stringList = stringList; - deserializedOptional.bytesDict = bytesDict; - deserializedOptional.epochDateTimeNullable = epochDateTimeNullable; - - return deserializedOptional; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/package-info.java deleted file mode 100644 index 1ce4c75584c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Optional. - * - */ -package tsptest.optional.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/package-info.java deleted file mode 100644 index 08619765273..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Optional. - * - */ -package tsptest.optional; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/partialupdate/models/PartialUpdateModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/partialupdate/models/PartialUpdateModel.java index 650a7e3f027..e2161012b34 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/partialupdate/models/PartialUpdateModel.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/partialupdate/models/PartialUpdateModel.java @@ -96,7 +96,9 @@ public byte[] getBytes() { /** * Get the aggregate property: The aggregation function to be applied on the client metric. Allowed functions - * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, + * <ul> + * <li>‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’,</li> + * </ul> * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, * ‘count’ - for requests. * diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchAsyncClient.java deleted file mode 100644 index 6588150ae49..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchAsyncClient.java +++ /dev/null @@ -1,455 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.patch.implementation.JsonMergePatchHelper; -import tsptest.patch.implementation.PatchesImpl; -import tsptest.patch.models.Fish; -import tsptest.patch.models.Resource; -import tsptest.patch.models.Salmon; - -/** - * Initializes a new instance of the asynchronous PatchClient type. - */ -@ServiceClient(builder = PatchClientBuilder.class, isAsync = true) -public final class PatchAsyncClient { - @Generated - private final PatchesImpl serviceClient; - - /** - * Initializes an instance of PatchAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PatchAsyncClient(PatchesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The createOrUpdateResource operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - * @param resource The resource parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateResourceWithResponse(BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateResourceWithResponseAsync(resource, requestOptions); - } - - /** - * The createOrUpdateOptionalResource operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/merge-patch+json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateOptionalResourceWithResponse(RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateOptionalResourceWithResponseAsync(requestOptions); - } - - /** - * The createOrUpdateFish operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - * @param fish The fish parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateFishWithResponse(BinaryData fish, RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateFishWithResponseAsync(fish, requestOptions); - } - - /** - * The createOrUpdateSalmon operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     *     friends (Optional): [
-     *          (Optional){
-     *             kind: String (Required)
-     *             id: String (Required)
-     *             name: String (Required)
-     *             age: int (Optional, Required on create)
-     *             color: String (Optional)
-     *         }
-     *     ]
-     *     hate (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     *     partner (Optional): (recursive schema, see partner above)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     *     friends (Optional): [
-     *          (Optional){
-     *             kind: String (Required)
-     *             id: String (Required)
-     *             name: String (Required)
-     *             age: int (Optional, Required on create)
-     *             color: String (Optional)
-     *         }
-     *     ]
-     *     hate (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     *     partner (Optional): (recursive schema, see partner above)
-     * }
-     * }
-     * 
- * - * @param fish The fish parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the second level model in polymorphic multiple levels inheritance which contains references to other - * polymorphic instances along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateSalmonWithResponse(BinaryData fish, RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateSalmonWithResponseAsync(fish, requestOptions); - } - - /** - * The createOrUpdateResource operation. - * - * @param resource The resource parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateResource(Resource resource) { - // Generated convenience method for createOrUpdateResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); - BinaryData resourceInBinaryData = BinaryData.fromObject(resource); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - resourceInBinaryData.getLength(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - return createOrUpdateResourceWithResponse(resourceInBinaryData, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * The createOrUpdateOptionalResource operation. - * - * @param resource The resource parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateOptionalResource(Resource resource) { - // Generated convenience method for createOrUpdateOptionalResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (resource != null) { - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); - BinaryData resourceInBinaryData = BinaryData.fromObject(resource); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - resourceInBinaryData.getLength(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - requestOptions.setBody(resourceInBinaryData); - } - return createOrUpdateOptionalResourceWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * The createOrUpdateOptionalResource operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateOptionalResource() { - // Generated convenience method for createOrUpdateOptionalResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createOrUpdateOptionalResourceWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * The createOrUpdateFish operation. - * - * @param fish The fish parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateFish(Fish fish) { - // Generated convenience method for createOrUpdateFishWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, true); - BinaryData fishInBinaryData = BinaryData.fromObject(fish); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - fishInBinaryData.getLength(); - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, false); - return createOrUpdateFishWithResponse(fishInBinaryData, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); - } - - /** - * The createOrUpdateSalmon operation. - * - * @param fish The fish parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the second level model in polymorphic multiple levels inheritance which contains references to other - * polymorphic instances on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createOrUpdateSalmon(Salmon fish) { - // Generated convenience method for createOrUpdateSalmonWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, true); - BinaryData fishInBinaryData = BinaryData.fromObject(fish); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - fishInBinaryData.getLength(); - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, false); - return createOrUpdateSalmonWithResponse(fishInBinaryData, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Salmon.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClient.java deleted file mode 100644 index 4ea8bd7f036..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClient.java +++ /dev/null @@ -1,447 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.patch.implementation.JsonMergePatchHelper; -import tsptest.patch.implementation.PatchesImpl; -import tsptest.patch.models.Fish; -import tsptest.patch.models.Resource; -import tsptest.patch.models.Salmon; - -/** - * Initializes a new instance of the synchronous PatchClient type. - */ -@ServiceClient(builder = PatchClientBuilder.class) -public final class PatchClient { - @Generated - private final PatchesImpl serviceClient; - - /** - * Initializes an instance of PatchClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PatchClient(PatchesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The createOrUpdateResource operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - * @param resource The resource parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateResourceWithResponse(BinaryData resource, RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateResourceWithResponse(resource, requestOptions); - } - - /** - * The createOrUpdateOptionalResource operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/merge-patch+json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateOptionalResourceWithResponse(RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateOptionalResourceWithResponse(requestOptions); - } - - /** - * The createOrUpdateFish operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - * @param fish The fish parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateFishWithResponse(BinaryData fish, RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateFishWithResponse(fish, requestOptions); - } - - /** - * The createOrUpdateSalmon operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     *     friends (Optional): [
-     *          (Optional){
-     *             kind: String (Required)
-     *             id: String (Required)
-     *             name: String (Required)
-     *             age: int (Optional, Required on create)
-     *             color: String (Optional)
-     *         }
-     *     ]
-     *     hate (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     *     partner (Optional): (recursive schema, see partner above)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     *     friends (Optional): [
-     *          (Optional){
-     *             kind: String (Required)
-     *             id: String (Required)
-     *             name: String (Required)
-     *             age: int (Optional, Required on create)
-     *             color: String (Optional)
-     *         }
-     *     ]
-     *     hate (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     *     partner (Optional): (recursive schema, see partner above)
-     * }
-     * }
-     * 
- * - * @param fish The fish parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the second level model in polymorphic multiple levels inheritance which contains references to other - * polymorphic instances along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateSalmonWithResponse(BinaryData fish, RequestOptions requestOptions) { - return this.serviceClient.createOrUpdateSalmonWithResponse(fish, requestOptions); - } - - /** - * The createOrUpdateResource operation. - * - * @param resource The resource parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource createOrUpdateResource(Resource resource) { - // Generated convenience method for createOrUpdateResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); - BinaryData resourceInBinaryData = BinaryData.fromObject(resource); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - resourceInBinaryData.getLength(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - return createOrUpdateResourceWithResponse(resourceInBinaryData, requestOptions).getValue() - .toObject(Resource.class); - } - - /** - * The createOrUpdateOptionalResource operation. - * - * @param resource The resource parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource createOrUpdateOptionalResource(Resource resource) { - // Generated convenience method for createOrUpdateOptionalResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (resource != null) { - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); - BinaryData resourceInBinaryData = BinaryData.fromObject(resource); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - resourceInBinaryData.getLength(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - requestOptions.setBody(resourceInBinaryData); - } - return createOrUpdateOptionalResourceWithResponse(requestOptions).getValue().toObject(Resource.class); - } - - /** - * The createOrUpdateOptionalResource operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource createOrUpdateOptionalResource() { - // Generated convenience method for createOrUpdateOptionalResourceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createOrUpdateOptionalResourceWithResponse(requestOptions).getValue().toObject(Resource.class); - } - - /** - * The createOrUpdateFish operation. - * - * @param fish The fish parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Fish createOrUpdateFish(Fish fish) { - // Generated convenience method for createOrUpdateFishWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, true); - BinaryData fishInBinaryData = BinaryData.fromObject(fish); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - fishInBinaryData.getLength(); - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, false); - return createOrUpdateFishWithResponse(fishInBinaryData, requestOptions).getValue().toObject(Fish.class); - } - - /** - * The createOrUpdateSalmon operation. - * - * @param fish The fish parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the second level model in polymorphic multiple levels inheritance which contains references to other - * polymorphic instances. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Salmon createOrUpdateSalmon(Salmon fish) { - // Generated convenience method for createOrUpdateSalmonWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, true); - BinaryData fishInBinaryData = BinaryData.fromObject(fish); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - fishInBinaryData.getLength(); - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, false); - return createOrUpdateSalmonWithResponse(fishInBinaryData, requestOptions).getValue().toObject(Salmon.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClientBuilder.java deleted file mode 100644 index 54550fc9ae8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.patch.implementation.PatchClientImpl; - -/** - * A builder for creating a new instance of the PatchClient type. - */ -@ServiceClientBuilder(serviceClients = { PatchClient.class, PatchAsyncClient.class }) -public final class PatchClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-patch.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the PatchClientBuilder. - */ - @Generated - public PatchClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PatchClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PatchClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PatchClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PatchClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PatchClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PatchClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PatchClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public PatchClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the PatchClientBuilder. - */ - @Generated - public PatchClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of PatchClientImpl with the provided parameters. - * - * @return an instance of PatchClientImpl. - */ - @Generated - private PatchClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - PatchClientImpl client - = new PatchClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of PatchAsyncClient class. - * - * @return an instance of PatchAsyncClient. - */ - @Generated - public PatchAsyncClient buildAsyncClient() { - return new PatchAsyncClient(buildInnerClient().getPatches()); - } - - /** - * Builds an instance of PatchClient class. - * - * @return an instance of PatchClient. - */ - @Generated - public PatchClient buildClient() { - return new PatchClient(buildInnerClient().getPatches()); - } - - private static final ClientLogger LOGGER = new ClientLogger(PatchClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/JsonMergePatchHelper.java deleted file mode 100644 index c32f17e441b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/JsonMergePatchHelper.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch.implementation; - -import tsptest.patch.models.Fish; -import tsptest.patch.models.InnerModel; -import tsptest.patch.models.Resource; -import tsptest.patch.models.Shark; - -/** - * This is the Helper class to enable json merge patch serialization for a model. - */ -public class JsonMergePatchHelper { - private static ResourceAccessor resourceAccessor; - - public interface ResourceAccessor { - Resource prepareModelForJsonMergePatch(Resource resource, boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(Resource resource); - } - - public static void setResourceAccessor(ResourceAccessor accessor) { - resourceAccessor = accessor; - } - - public static ResourceAccessor getResourceAccessor() { - return resourceAccessor; - } - - private static InnerModelAccessor innerModelAccessor; - - public interface InnerModelAccessor { - InnerModel prepareModelForJsonMergePatch(InnerModel innerModel, boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(InnerModel innerModel); - } - - public static void setInnerModelAccessor(InnerModelAccessor accessor) { - innerModelAccessor = accessor; - } - - public static InnerModelAccessor getInnerModelAccessor() { - return innerModelAccessor; - } - - private static FishAccessor fishAccessor; - - public interface FishAccessor { - Fish prepareModelForJsonMergePatch(Fish fish, boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(Fish fish); - - void setId(Fish fish, String id); - - void setName(Fish fish, String name); - - void setAge(Fish fish, int age); - - void setColor(Fish fish, String color); - } - - public static void setFishAccessor(FishAccessor accessor) { - fishAccessor = accessor; - } - - public static FishAccessor getFishAccessor() { - return fishAccessor; - } - - private static SharkAccessor sharkAccessor; - - public interface SharkAccessor { - void setWeight(Shark shark, Integer weight); - } - - public static void setSharkAccessor(SharkAccessor accessor) { - sharkAccessor = accessor; - } - - public static SharkAccessor getSharkAccessor() { - return sharkAccessor; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchClientImpl.java deleted file mode 100644 index 0c066527638..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 PatchClient type. - */ -public final class PatchClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 PatchesImpl object to access its operations. - */ - private final PatchesImpl patches; - - /** - * Gets the PatchesImpl object to access its operations. - * - * @return the PatchesImpl object. - */ - public PatchesImpl getPatches() { - return this.patches; - } - - /** - * Initializes an instance of PatchClient client. - * - * @param endpoint Service host. - */ - public PatchClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of PatchClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public PatchClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of PatchClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public PatchClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.patches = new PatchesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchesImpl.java deleted file mode 100644 index 71c6372db7c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchesImpl.java +++ /dev/null @@ -1,736 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Patches. - */ -public final class PatchesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PatchesService service; - - /** - * The service client containing this operation class. - */ - private final PatchClientImpl client; - - /** - * Initializes an instance of PatchesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PatchesImpl(PatchClientImpl client) { - this.service = RestProxy.create(PatchesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for PatchClientPatches to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "PatchClientPatches") - public interface PatchesService { - @Patch("/patch/resource") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createOrUpdateResource(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, - Context context); - - @Patch("/patch/resource") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrUpdateResourceSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, - Context context); - - @Patch("/patch/resource/optional") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createOrUpdateOptionalResource(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Patch("/patch/resource/optional") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrUpdateOptionalResourceSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Patch("/patch/fish") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createOrUpdateFish(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData fish, RequestOptions requestOptions, Context context); - - @Patch("/patch/fish") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrUpdateFishSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData fish, RequestOptions requestOptions, Context context); - - @Patch("/patch/fish/salmon") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createOrUpdateSalmon(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData fish, RequestOptions requestOptions, Context context); - - @Patch("/patch/fish/salmon") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrUpdateSalmonSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData fish, RequestOptions requestOptions, Context context); - } - - /** - * The createOrUpdateResource operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - * @param resource The resource parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateResourceWithResponseAsync(BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrUpdateResource(this.client.getEndpoint(), contentType, - accept, resource, requestOptions, context)); - } - - /** - * The createOrUpdateResource operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - * @param resource The resource parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateResourceWithResponse(BinaryData resource, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return service.createOrUpdateResourceSync(this.client.getEndpoint(), contentType, accept, resource, - requestOptions, Context.NONE); - } - - /** - * The createOrUpdateOptionalResource operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/merge-patch+json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateOptionalResourceWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/merge-patch+json"); - } - }); - return FluxUtil.withContext(context -> service.createOrUpdateOptionalResource(this.client.getEndpoint(), accept, - requestOptionsLocal, context)); - } - - /** - * The createOrUpdateOptionalResource operation. - *

Header Parameters

- * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/merge-patch+json".
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     map (Optional, Required on create): {
-     *         String (Required): {
-     *             name: String (Optional, Required on create)
-     *             description: String (Optional)
-     *         }
-     *     }
-     *     longValue: Long (Optional)
-     *     intValue: Integer (Optional)
-     *     enumValue: String(a/b/c) (Optional)
-     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
-     *     array (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     fish (Optional): {
-     *         kind: String (Required)
-     *         id: String (Required)
-     *         name: String (Required)
-     *         age: int (Optional, Required on create)
-     *         color: String (Optional)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateOptionalResourceWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/merge-patch+json"); - } - }); - return service.createOrUpdateOptionalResourceSync(this.client.getEndpoint(), accept, requestOptionsLocal, - Context.NONE); - } - - /** - * The createOrUpdateFish operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - * @param fish The fish parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateFishWithResponseAsync(BinaryData fish, - RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrUpdateFish(this.client.getEndpoint(), contentType, - accept, fish, requestOptions, context)); - } - - /** - * The createOrUpdateFish operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     * }
-     * }
-     * 
- * - * @param fish The fish parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateFishWithResponse(BinaryData fish, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return service.createOrUpdateFishSync(this.client.getEndpoint(), contentType, accept, fish, requestOptions, - Context.NONE); - } - - /** - * The createOrUpdateSalmon operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     *     friends (Optional): [
-     *          (Optional){
-     *             kind: String (Required)
-     *             id: String (Required)
-     *             name: String (Required)
-     *             age: int (Optional, Required on create)
-     *             color: String (Optional)
-     *         }
-     *     ]
-     *     hate (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     *     partner (Optional): (recursive schema, see partner above)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     *     friends (Optional): [
-     *          (Optional){
-     *             kind: String (Required)
-     *             id: String (Required)
-     *             name: String (Required)
-     *             age: int (Optional, Required on create)
-     *             color: String (Optional)
-     *         }
-     *     ]
-     *     hate (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     *     partner (Optional): (recursive schema, see partner above)
-     * }
-     * }
-     * 
- * - * @param fish The fish parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the second level model in polymorphic multiple levels inheritance which contains references to other - * polymorphic instances along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createOrUpdateSalmonWithResponseAsync(BinaryData fish, - RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createOrUpdateSalmon(this.client.getEndpoint(), contentType, - accept, fish, requestOptions, context)); - } - - /** - * The createOrUpdateSalmon operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     *     friends (Optional): [
-     *          (Optional){
-     *             kind: String (Required)
-     *             id: String (Required)
-     *             name: String (Required)
-     *             age: int (Optional, Required on create)
-     *             color: String (Optional)
-     *         }
-     *     ]
-     *     hate (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     *     partner (Optional): (recursive schema, see partner above)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     id: String (Required)
-     *     name: String (Required)
-     *     age: int (Optional, Required on create)
-     *     color: String (Optional)
-     *     friends (Optional): [
-     *          (Optional){
-     *             kind: String (Required)
-     *             id: String (Required)
-     *             name: String (Required)
-     *             age: int (Optional, Required on create)
-     *             color: String (Optional)
-     *         }
-     *     ]
-     *     hate (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     *     partner (Optional): (recursive schema, see partner above)
-     * }
-     * }
-     * 
- * - * @param fish The fish parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the second level model in polymorphic multiple levels inheritance which contains references to other - * polymorphic instances along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateSalmonWithResponse(BinaryData fish, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return service.createOrUpdateSalmonSync(this.client.getEndpoint(), contentType, accept, fish, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/package-info.java deleted file mode 100644 index b9dda11360f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for PatchModel. - * - */ -package tsptest.patch.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Fish.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Fish.java deleted file mode 100644 index 4854928ff25..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Fish.java +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import tsptest.patch.implementation.JsonMergePatchHelper; - -/** - * This is base model for polymorphic multiple levels inheritance with a discriminator. - */ -@Fluent -public class Fish implements JsonSerializable { - /* - * Discriminator property for Fish. - */ - @Generated - private String kind = "Fish"; - - /* - * The id property. - */ - @Generated - private String id; - - /* - * The name property. - */ - @Generated - private String name; - - /* - * The age property. - */ - @Generated - private int age; - - /* - * The color property. - */ - @Generated - private String color; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setFishAccessor(new JsonMergePatchHelper.FishAccessor() { - @Override - public Fish prepareModelForJsonMergePatch(Fish model, boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(Fish model) { - return model.jsonMergePatch; - } - - @Override - public void setId(Fish model, String id) { - model.id = id; - } - - @Override - public void setName(Fish model, String name) { - model.name = name; - } - - @Override - public void setAge(Fish model, int age) { - model.age = age; - } - - @Override - public void setColor(Fish model, String color) { - model.color = color; - } - }); - } - - /** - * Creates an instance of Fish class. - */ - @Generated - public Fish() { - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Generated - public String getKind() { - return this.kind; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the age property: The age property. - * - * @return the age value. - */ - @Generated - public int getAge() { - return this.age; - } - - /** - * Set the age property: The age property. - *

Required when create the resource.

- * - * @param age the age value to set. - * @return the Fish object itself. - */ - @Generated - public Fish setAge(int age) { - this.age = age; - this.updatedProperties.add("age"); - return this; - } - - /** - * Get the color property: The color property. - * - * @return the color value. - */ - @Generated - public String getColor() { - return this.color; - } - - /** - * Set the color property: The color property. - * - * @param color the color value to set. - * @return the Fish object itself. - */ - @Generated - public Fish setColor(String color) { - this.color = color; - this.updatedProperties.add("color"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeIntField("age", this.age); - jsonWriter.writeStringField("color", this.color); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - if (updatedProperties.contains("age")) { - jsonWriter.writeIntField("age", this.age); - } - if (updatedProperties.contains("color")) { - if (this.color == null) { - jsonWriter.writeNullField("color"); - } else { - jsonWriter.writeStringField("color", this.color); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Fish from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Fish if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Fish. - */ - @Generated - public static Fish fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("shark".equals(discriminatorValue)) { - return Shark.fromJson(readerToUse.reset()); - } else if ("salmon".equals(discriminatorValue)) { - return Salmon.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Fish fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Fish deserializedFish = new Fish(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedFish.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedFish.name = reader.getString(); - } else if ("kind".equals(fieldName)) { - deserializedFish.kind = reader.getString(); - } else if ("age".equals(fieldName)) { - deserializedFish.age = reader.getInt(); - } else if ("color".equals(fieldName)) { - deserializedFish.color = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedFish; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/InnerModel.java deleted file mode 100644 index 1447000b55c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/InnerModel.java +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import tsptest.patch.implementation.JsonMergePatchHelper; - -/** - * The InnerModel model. - */ -@Fluent -public final class InnerModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private String name; - - /* - * The description property. - */ - @Generated - private String description; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setInnerModelAccessor(new JsonMergePatchHelper.InnerModelAccessor() { - @Override - public InnerModel prepareModelForJsonMergePatch(InnerModel model, boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(InnerModel model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of InnerModel class. - */ - @Generated - public InnerModel() { - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Set the name property: The name property. - *

Required when create the resource.

- * - * @param name the name value to set. - * @return the InnerModel object itself. - */ - @Generated - public InnerModel setName(String name) { - this.name = name; - this.updatedProperties.add("name"); - return this; - } - - /** - * Get the description property: The description property. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * Set the description property: The description property. - * - * @param description the description value to set. - * @return the InnerModel object itself. - */ - @Generated - public InnerModel setDescription(String description) { - this.description = description; - this.updatedProperties.add("description"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("name")) { - if (this.name == null) { - jsonWriter.writeNullField("name"); - } else { - jsonWriter.writeStringField("name", this.name); - } - } - if (updatedProperties.contains("description")) { - if (this.description == null) { - jsonWriter.writeNullField("description"); - } else { - jsonWriter.writeStringField("description", this.description); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InnerModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IOException If an error occurs while reading the InnerModel. - */ - @Generated - public static InnerModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - InnerModel deserializedInnerModel = new InnerModel(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - deserializedInnerModel.name = reader.getString(); - } else if ("description".equals(fieldName)) { - deserializedInnerModel.description = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedInnerModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Resource.java deleted file mode 100644 index 4a3cd667819..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Resource.java +++ /dev/null @@ -1,471 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import tsptest.patch.implementation.JsonMergePatchHelper; - -/** - * The Resource model. - */ -@Fluent -public final class Resource implements JsonSerializable { - /* - * The id property. - */ - @Generated - private String id; - - /* - * The name property. - */ - @Generated - private String name; - - /* - * The description property. - */ - @Generated - private String description; - - /* - * The map property. - */ - @Generated - private Map map; - - /* - * The longValue property. - */ - @Generated - private Long longValue; - - /* - * The intValue property. - */ - @Generated - private Integer intValue; - - /* - * The enumValue property. - */ - @Generated - private ResourceEnumValue enumValue; - - /* - * The wireNameForInnerModelProperty property. - */ - @Generated - private InnerModel innerModelProperty; - - /* - * The array property. - */ - @Generated - private List array; - - /* - * The fish property. - */ - @Generated - private Fish fish; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setResourceAccessor(new JsonMergePatchHelper.ResourceAccessor() { - @Override - public Resource prepareModelForJsonMergePatch(Resource model, boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(Resource model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of Resource class. - */ - @Generated - public Resource() { - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the description property: The description property. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * Set the description property: The description property. - * - * @param description the description value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setDescription(String description) { - this.description = description; - this.updatedProperties.add("description"); - return this; - } - - /** - * Get the map property: The map property. - * - * @return the map value. - */ - @Generated - public Map getMap() { - return this.map; - } - - /** - * Set the map property: The map property. - *

Required when create the resource.

- * - * @param map the map value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setMap(Map map) { - this.map = map; - this.updatedProperties.add("map"); - return this; - } - - /** - * Get the longValue property: The longValue property. - * - * @return the longValue value. - */ - @Generated - public Long getLongValue() { - return this.longValue; - } - - /** - * Set the longValue property: The longValue property. - * - * @param longValue the longValue value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setLongValue(Long longValue) { - this.longValue = longValue; - this.updatedProperties.add("longValue"); - return this; - } - - /** - * Get the intValue property: The intValue property. - * - * @return the intValue value. - */ - @Generated - public Integer getIntValue() { - return this.intValue; - } - - /** - * Set the intValue property: The intValue property. - * - * @param intValue the intValue value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setIntValue(Integer intValue) { - this.intValue = intValue; - this.updatedProperties.add("intValue"); - return this; - } - - /** - * Get the enumValue property: The enumValue property. - * - * @return the enumValue value. - */ - @Generated - public ResourceEnumValue getEnumValue() { - return this.enumValue; - } - - /** - * Set the enumValue property: The enumValue property. - * - * @param enumValue the enumValue value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setEnumValue(ResourceEnumValue enumValue) { - this.enumValue = enumValue; - this.updatedProperties.add("enumValue"); - return this; - } - - /** - * Get the innerModelProperty property: The wireNameForInnerModelProperty property. - * - * @return the innerModelProperty value. - */ - @Generated - public InnerModel getInnerModelProperty() { - return this.innerModelProperty; - } - - /** - * Set the innerModelProperty property: The wireNameForInnerModelProperty property. - * - * @param innerModelProperty the innerModelProperty value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setInnerModelProperty(InnerModel innerModelProperty) { - this.innerModelProperty = innerModelProperty; - this.updatedProperties.add("innerModelProperty"); - return this; - } - - /** - * Get the array property: The array property. - * - * @return the array value. - */ - @Generated - public List getArray() { - return this.array; - } - - /** - * Set the array property: The array property. - * - * @param array the array value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setArray(List array) { - this.array = array; - this.updatedProperties.add("array"); - return this; - } - - /** - * Get the fish property: The fish property. - * - * @return the fish value. - */ - @Generated - public Fish getFish() { - return this.fish; - } - - /** - * Set the fish property: The fish property. - * - * @param fish the fish value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setFish(Fish fish) { - this.fish = fish; - this.updatedProperties.add("fish"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("description", this.description); - jsonWriter.writeMapField("map", this.map, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeNumberField("longValue", this.longValue); - jsonWriter.writeNumberField("intValue", this.intValue); - jsonWriter.writeStringField("enumValue", this.enumValue == null ? null : this.enumValue.toString()); - jsonWriter.writeJsonField("wireNameForInnerModelProperty", this.innerModelProperty); - jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeJsonField("fish", this.fish); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("description")) { - if (this.description == null) { - jsonWriter.writeNullField("description"); - } else { - jsonWriter.writeStringField("description", this.description); - } - } - if (updatedProperties.contains("map")) { - if (this.map == null) { - jsonWriter.writeNullField("map"); - } else { - jsonWriter.writeMapField("map", this.map, (writer, element) -> { - if (element != null) { - JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(element, true); - writer.writeJson(element); - JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(element, false); - } else { - writer.writeNull(); - } - }); - } - } - if (updatedProperties.contains("longValue")) { - if (this.longValue == null) { - jsonWriter.writeNullField("longValue"); - } else { - jsonWriter.writeNumberField("longValue", this.longValue); - } - } - if (updatedProperties.contains("intValue")) { - if (this.intValue == null) { - jsonWriter.writeNullField("intValue"); - } else { - jsonWriter.writeNumberField("intValue", this.intValue); - } - } - if (updatedProperties.contains("enumValue")) { - if (this.enumValue == null) { - jsonWriter.writeNullField("enumValue"); - } else { - jsonWriter.writeStringField("enumValue", this.enumValue.toString()); - } - } - if (updatedProperties.contains("innerModelProperty")) { - if (this.innerModelProperty == null) { - jsonWriter.writeNullField("wireNameForInnerModelProperty"); - } else { - JsonMergePatchHelper.getInnerModelAccessor() - .prepareModelForJsonMergePatch(this.innerModelProperty, true); - jsonWriter.writeJsonField("wireNameForInnerModelProperty", this.innerModelProperty); - JsonMergePatchHelper.getInnerModelAccessor() - .prepareModelForJsonMergePatch(this.innerModelProperty, false); - } - } - if (updatedProperties.contains("array")) { - if (this.array == null) { - jsonWriter.writeNullField("array"); - } else { - jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element)); - } - } - if (updatedProperties.contains("fish")) { - if (this.fish == null) { - jsonWriter.writeNullField("fish"); - } else { - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(this.fish, true); - jsonWriter.writeJsonField("fish", this.fish); - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(this.fish, false); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Resource from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Resource. - */ - @Generated - public static Resource fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Resource deserializedResource = new Resource(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedResource.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedResource.name = reader.getString(); - } else if ("description".equals(fieldName)) { - deserializedResource.description = reader.getString(); - } else if ("map".equals(fieldName)) { - Map map = reader.readMap(reader1 -> InnerModel.fromJson(reader1)); - deserializedResource.map = map; - } else if ("longValue".equals(fieldName)) { - deserializedResource.longValue = reader.getNullable(JsonReader::getLong); - } else if ("intValue".equals(fieldName)) { - deserializedResource.intValue = reader.getNullable(JsonReader::getInt); - } else if ("enumValue".equals(fieldName)) { - deserializedResource.enumValue = ResourceEnumValue.fromString(reader.getString()); - } else if ("wireNameForInnerModelProperty".equals(fieldName)) { - deserializedResource.innerModelProperty = InnerModel.fromJson(reader); - } else if ("array".equals(fieldName)) { - List array = reader.readArray(reader1 -> InnerModel.fromJson(reader1)); - deserializedResource.array = array; - } else if ("fish".equals(fieldName)) { - deserializedResource.fish = Fish.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedResource; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/ResourceEnumValue.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/ResourceEnumValue.java deleted file mode 100644 index dae45c32ea2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/ResourceEnumValue.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch.models; - -/** - * Defines values for ResourceEnumValue. - */ -public enum ResourceEnumValue { - /** - * Enum value a. - */ - A("a"), - - /** - * Enum value b. - */ - B("b"), - - /** - * Enum value c. - */ - C("c"); - - /** - * The actual serialized value for a ResourceEnumValue instance. - */ - private final String value; - - ResourceEnumValue(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a ResourceEnumValue instance. - * - * @param value the serialized value to parse. - * @return the parsed ResourceEnumValue object, or null if unable to parse. - */ - public static ResourceEnumValue fromString(String value) { - if (value == null) { - return null; - } - ResourceEnumValue[] items = ResourceEnumValue.values(); - for (ResourceEnumValue item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Salmon.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Salmon.java deleted file mode 100644 index c28954c2bc7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Salmon.java +++ /dev/null @@ -1,275 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import tsptest.patch.implementation.JsonMergePatchHelper; - -/** - * The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic - * instances. - */ -@Fluent -public final class Salmon extends Fish { - /* - * Discriminator property for Fish. - */ - @Generated - private String kind = "salmon"; - - /* - * The friends property. - */ - @Generated - private List friends; - - /* - * The hate property. - */ - @Generated - private Map hate; - - /* - * The partner property. - */ - @Generated - private Fish partner; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - /** - * Creates an instance of Salmon class. - */ - @Generated - public Salmon() { - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * Get the friends property: The friends property. - * - * @return the friends value. - */ - @Generated - public List getFriends() { - return this.friends; - } - - /** - * Set the friends property: The friends property. - * - * @param friends the friends value to set. - * @return the Salmon object itself. - */ - @Generated - public Salmon setFriends(List friends) { - this.friends = friends; - this.updatedProperties.add("friends"); - return this; - } - - /** - * Get the hate property: The hate property. - * - * @return the hate value. - */ - @Generated - public Map getHate() { - return this.hate; - } - - /** - * Set the hate property: The hate property. - * - * @param hate the hate value to set. - * @return the Salmon object itself. - */ - @Generated - public Salmon setHate(Map hate) { - this.hate = hate; - this.updatedProperties.add("hate"); - return this; - } - - /** - * Get the partner property: The partner property. - * - * @return the partner value. - */ - @Generated - public Fish getPartner() { - return this.partner; - } - - /** - * Set the partner property: The partner property. - * - * @param partner the partner value to set. - * @return the Salmon object itself. - */ - @Generated - public Salmon setPartner(Fish partner) { - this.partner = partner; - this.updatedProperties.add("partner"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public Salmon setAge(int age) { - super.setAge(age); - this.updatedProperties.add("age"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public Salmon setColor(String color) { - super.setColor(color); - this.updatedProperties.add("color"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (JsonMergePatchHelper.getFishAccessor().isJsonMergePatch(this)) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("age", getAge()); - jsonWriter.writeStringField("color", getColor()); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeArrayField("friends", this.friends, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeMapField("hate", this.hate, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeJsonField("partner", this.partner); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("age")) { - jsonWriter.writeIntField("age", getAge()); - } - if (updatedProperties.contains("color")) { - if (getColor() == null) { - jsonWriter.writeNullField("color"); - } else { - jsonWriter.writeStringField("color", getColor()); - } - } - jsonWriter.writeStringField("kind", this.kind); - if (updatedProperties.contains("friends")) { - if (this.friends == null) { - jsonWriter.writeNullField("friends"); - } else { - jsonWriter.writeArrayField("friends", this.friends, (writer, element) -> writer.writeJson(element)); - } - } - if (updatedProperties.contains("hate")) { - if (this.hate == null) { - jsonWriter.writeNullField("hate"); - } else { - jsonWriter.writeMapField("hate", this.hate, (writer, element) -> { - if (element != null) { - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(element, true); - writer.writeJson(element); - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(element, false); - } else { - writer.writeNull(); - } - }); - } - } - if (updatedProperties.contains("partner")) { - if (this.partner == null) { - jsonWriter.writeNullField("partner"); - } else { - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(this.partner, true); - jsonWriter.writeJsonField("partner", this.partner); - JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(this.partner, false); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Salmon from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Salmon if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Salmon. - */ - @Generated - public static Salmon fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Salmon deserializedSalmon = new Salmon(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - JsonMergePatchHelper.getFishAccessor().setId(deserializedSalmon, reader.getString()); - } else if ("name".equals(fieldName)) { - JsonMergePatchHelper.getFishAccessor().setName(deserializedSalmon, reader.getString()); - } else if ("age".equals(fieldName)) { - JsonMergePatchHelper.getFishAccessor().setAge(deserializedSalmon, reader.getInt()); - } else if ("color".equals(fieldName)) { - JsonMergePatchHelper.getFishAccessor().setColor(deserializedSalmon, reader.getString()); - } else if ("kind".equals(fieldName)) { - deserializedSalmon.kind = reader.getString(); - } else if ("friends".equals(fieldName)) { - List friends = reader.readArray(reader1 -> Fish.fromJson(reader1)); - deserializedSalmon.friends = friends; - } else if ("hate".equals(fieldName)) { - Map hate = reader.readMap(reader1 -> Fish.fromJson(reader1)); - deserializedSalmon.hate = hate; - } else if ("partner".equals(fieldName)) { - deserializedSalmon.partner = Fish.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedSalmon; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/SawShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/SawShark.java deleted file mode 100644 index 55a2e636f98..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/SawShark.java +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import tsptest.patch.implementation.JsonMergePatchHelper; - -/** - * The third level model SawShark in polymorphic multiple levels inheritance. - */ -@Fluent -public final class SawShark extends Shark { - /* - * Discriminator property for Fish. - */ - @Generated - private String kind = "shark"; - - /* - * The sharktype property. - */ - @Generated - private String sharktype = "saw"; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - /** - * Creates an instance of SawShark class. - */ - @Generated - public SawShark() { - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * Get the sharktype property: The sharktype property. - * - * @return the sharktype value. - */ - @Generated - @Override - public String getSharktype() { - return this.sharktype; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public SawShark setWeight(Integer weight) { - super.setWeight(weight); - this.updatedProperties.add("weight"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public SawShark setAge(int age) { - super.setAge(age); - this.updatedProperties.add("age"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public SawShark setColor(String color) { - super.setColor(color); - this.updatedProperties.add("color"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (JsonMergePatchHelper.getFishAccessor().isJsonMergePatch(this)) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeIntField("age", getAge()); - jsonWriter.writeStringField("color", getColor()); - jsonWriter.writeNumberField("weight", getWeight()); - jsonWriter.writeStringField("sharktype", this.sharktype); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - if (updatedProperties.contains("age")) { - jsonWriter.writeIntField("age", getAge()); - } - if (updatedProperties.contains("color")) { - if (getColor() == null) { - jsonWriter.writeNullField("color"); - } else { - jsonWriter.writeStringField("color", getColor()); - } - } - if (updatedProperties.contains("weight")) { - if (getWeight() == null) { - jsonWriter.writeNullField("weight"); - } else { - jsonWriter.writeNumberField("weight", getWeight()); - } - } - jsonWriter.writeStringField("sharktype", this.sharktype); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SawShark from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SawShark if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SawShark. - */ - @Generated - public static SawShark fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SawShark deserializedSawShark = new SawShark(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - JsonMergePatchHelper.getFishAccessor().setId(deserializedSawShark, reader.getString()); - } else if ("name".equals(fieldName)) { - JsonMergePatchHelper.getFishAccessor().setName(deserializedSawShark, reader.getString()); - } else if ("age".equals(fieldName)) { - JsonMergePatchHelper.getFishAccessor().setAge(deserializedSawShark, reader.getInt()); - } else if ("color".equals(fieldName)) { - JsonMergePatchHelper.getFishAccessor().setColor(deserializedSawShark, reader.getString()); - } else if ("weight".equals(fieldName)) { - JsonMergePatchHelper.getSharkAccessor() - .setWeight(deserializedSawShark, reader.getNullable(JsonReader::getInt)); - } else if ("sharktype".equals(fieldName)) { - deserializedSawShark.sharktype = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedSawShark; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Shark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Shark.java deleted file mode 100644 index 65ce4de7ffc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Shark.java +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import tsptest.patch.implementation.JsonMergePatchHelper; - -/** - * The second level model in polymorphic multiple levels inheritance and it defines a new discriminator. - */ -@Fluent -public class Shark extends Fish { - /* - * Discriminator property for Fish. - */ - @Generated - private String kind = "shark"; - - /* - * The sharktype property. - */ - @Generated - private String sharktype = "shark"; - - /* - * The weight property. - */ - @Generated - private Integer weight; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - static { - JsonMergePatchHelper.setSharkAccessor(new JsonMergePatchHelper.SharkAccessor() { - @Override - public void setWeight(Shark model, Integer weight) { - model.weight = weight; - } - }); - } - - /** - * Creates an instance of Shark class. - */ - @Generated - public Shark() { - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * Get the sharktype property: The sharktype property. - * - * @return the sharktype value. - */ - @Generated - public String getSharktype() { - return this.sharktype; - } - - /** - * Get the weight property: The weight property. - * - * @return the weight value. - */ - @Generated - public Integer getWeight() { - return this.weight; - } - - /** - * Set the weight property: The weight property. - * - * @param weight the weight value to set. - * @return the Shark object itself. - */ - @Generated - public Shark setWeight(Integer weight) { - this.weight = weight; - this.updatedProperties.add("weight"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public Shark setAge(int age) { - super.setAge(age); - this.updatedProperties.add("age"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public Shark setColor(String color) { - super.setColor(color); - this.updatedProperties.add("color"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (JsonMergePatchHelper.getFishAccessor().isJsonMergePatch(this)) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeIntField("age", getAge()); - jsonWriter.writeStringField("color", getColor()); - jsonWriter.writeStringField("sharktype", this.sharktype); - jsonWriter.writeNumberField("weight", this.weight); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - if (updatedProperties.contains("age")) { - jsonWriter.writeIntField("age", getAge()); - } - if (updatedProperties.contains("color")) { - if (getColor() == null) { - jsonWriter.writeNullField("color"); - } else { - jsonWriter.writeStringField("color", getColor()); - } - } - jsonWriter.writeStringField("sharktype", this.sharktype); - if (updatedProperties.contains("weight")) { - if (this.weight == null) { - jsonWriter.writeNullField("weight"); - } else { - jsonWriter.writeNumberField("weight", this.weight); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Shark from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Shark if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Shark. - */ - @Generated - public static Shark fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("sharktype".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("saw".equals(discriminatorValue)) { - return SawShark.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Shark fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Shark deserializedShark = new Shark(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - JsonMergePatchHelper.getFishAccessor().setId(deserializedShark, reader.getString()); - } else if ("name".equals(fieldName)) { - JsonMergePatchHelper.getFishAccessor().setName(deserializedShark, reader.getString()); - } else if ("age".equals(fieldName)) { - JsonMergePatchHelper.getFishAccessor().setAge(deserializedShark, reader.getInt()); - } else if ("color".equals(fieldName)) { - JsonMergePatchHelper.getFishAccessor().setColor(deserializedShark, reader.getString()); - } else if ("sharktype".equals(fieldName)) { - deserializedShark.sharktype = reader.getString(); - } else if ("weight".equals(fieldName)) { - deserializedShark.weight = reader.getNullable(JsonReader::getInt); - } else { - reader.skipChildren(); - } - } - - return deserializedShark; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/package-info.java deleted file mode 100644 index f45a78d9d8e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for PatchModel. - * - */ -package tsptest.patch.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/package-info.java deleted file mode 100644 index f5fe0c1bacd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for PatchModel. - * - */ -package tsptest.patch; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientAsyncClient.java deleted file mode 100644 index 15b4bdceb08..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientAsyncClient.java +++ /dev/null @@ -1,376 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.PollerFlux; -import java.util.stream.Collectors; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.protocolandconvenient.implementation.ProtocolAndConvenienceOpsImpl; -import tsptest.protocolandconvenient.models.ResourceA; -import tsptest.protocolandconvenient.models.ResourceB; -import tsptest.protocolandconvenient.models.ResourceE; -import tsptest.protocolandconvenient.models.ResourceF; -import tsptest.protocolandconvenient.models.ResourceI; -import tsptest.protocolandconvenient.models.ResourceJ; - -/** - * Initializes a new instance of the asynchronous ProtocolAndConvenientClient type. - */ -@ServiceClient(builder = ProtocolAndConvenientClientBuilder.class, isAsync = true) -public final class ProtocolAndConvenientAsyncClient { - @Generated - private final ProtocolAndConvenienceOpsImpl serviceClient; - - /** - * Initializes an instance of ProtocolAndConvenientAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ProtocolAndConvenientAsyncClient(ProtocolAndConvenienceOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * When set protocol false and convenient true, then the protocol method should be package private. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> onlyConvenientWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.onlyConvenientWithResponseAsync(body, requestOptions); - } - - /** - * When set protocol true and convenient false, only the protocol method should be generated, ResourceC and - * ResourceD should not be generated. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> onlyProtocolWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.onlyProtocolWithResponseAsync(body, requestOptions); - } - - /** - * Setting protocol true and convenient true, both convenient and protocol methods will be generated. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> bothConvenientAndProtocolWithResponse(BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.bothConvenientAndProtocolWithResponseAsync(body, requestOptions); - } - - /** - * When set protocol false and convenient false. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Mono> errorSettingWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.errorSettingWithResponseAsync(body, requestOptions); - } - - /** - * Long running operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - PollerFlux beginCreateOrReplace(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.beginCreateOrReplaceAsync(name, resource, requestOptions); - } - - /** - * Paging operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxresultsLongNoThe maxPageSize parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of ResourceJ items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedFlux list(RequestOptions requestOptions) { - return this.serviceClient.listAsync(requestOptions); - } - - /** - * When set protocol false and convenient true, then the protocol method should be package private. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono onlyConvenient(ResourceA body) { - // Generated convenience method for onlyConvenientWithResponse - RequestOptions requestOptions = new RequestOptions(); - return onlyConvenientWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ResourceB.class)); - } - - /** - * Setting protocol true and convenient true, both convenient and protocol methods will be generated. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono bothConvenientAndProtocol(ResourceE body) { - // Generated convenience method for bothConvenientAndProtocolWithResponse - RequestOptions requestOptions = new RequestOptions(); - return bothConvenientAndProtocolWithResponse(BinaryData.fromObject(body), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ResourceF.class)); - } - - /** - * Long running operation. - * - * @param name The name parameter. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateOrReplace(String name, ResourceI resource) { - // Generated convenience method for beginCreateOrReplaceWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginCreateOrReplaceWithModelAsync(name, BinaryData.fromObject(resource), requestOptions); - } - - /** - * Paging operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ResourceJ items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux list() { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = list(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(ResourceJ.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClient.java deleted file mode 100644 index 08361806c82..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClient.java +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.SyncPoller; -import tsptest.protocolandconvenient.implementation.ProtocolAndConvenienceOpsImpl; -import tsptest.protocolandconvenient.models.ResourceA; -import tsptest.protocolandconvenient.models.ResourceB; -import tsptest.protocolandconvenient.models.ResourceE; -import tsptest.protocolandconvenient.models.ResourceF; -import tsptest.protocolandconvenient.models.ResourceI; -import tsptest.protocolandconvenient.models.ResourceJ; - -/** - * Initializes a new instance of the synchronous ProtocolAndConvenientClient type. - */ -@ServiceClient(builder = ProtocolAndConvenientClientBuilder.class) -public final class ProtocolAndConvenientClient { - @Generated - private final ProtocolAndConvenienceOpsImpl serviceClient; - - /** - * Initializes an instance of ProtocolAndConvenientClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ProtocolAndConvenientClient(ProtocolAndConvenienceOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * When set protocol false and convenient true, then the protocol method should be package private. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response onlyConvenientWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.onlyConvenientWithResponse(body, requestOptions); - } - - /** - * When set protocol true and convenient false, only the protocol method should be generated, ResourceC and - * ResourceD should not be generated. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response onlyProtocolWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.onlyProtocolWithResponse(body, requestOptions); - } - - /** - * Setting protocol true and convenient true, both convenient and protocol methods will be generated. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response bothConvenientAndProtocolWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.bothConvenientAndProtocolWithResponse(body, requestOptions); - } - - /** - * When set protocol false and convenient false. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - Response errorSettingWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.errorSettingWithResponse(body, requestOptions); - } - - /** - * Long running operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller beginCreateOrReplace(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.beginCreateOrReplace(name, resource, requestOptions); - } - - /** - * Paging operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxresultsLongNoThe maxPageSize parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of ResourceJ items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(RequestOptions requestOptions) { - return this.serviceClient.list(requestOptions); - } - - /** - * When set protocol false and convenient true, then the protocol method should be package private. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ResourceB onlyConvenient(ResourceA body) { - // Generated convenience method for onlyConvenientWithResponse - RequestOptions requestOptions = new RequestOptions(); - return onlyConvenientWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(ResourceB.class); - } - - /** - * Setting protocol true and convenient true, both convenient and protocol methods will be generated. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ResourceF bothConvenientAndProtocol(ResourceE body) { - // Generated convenience method for bothConvenientAndProtocolWithResponse - RequestOptions requestOptions = new RequestOptions(); - return bothConvenientAndProtocolWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(ResourceF.class); - } - - /** - * Long running operation. - * - * @param name The name parameter. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateOrReplace(String name, ResourceI resource) { - // Generated convenience method for beginCreateOrReplaceWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginCreateOrReplaceWithModel(name, BinaryData.fromObject(resource), requestOptions); - } - - /** - * Paging operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of ResourceJ items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(ResourceJ.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClientBuilder.java deleted file mode 100644 index 3356e2e8607..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClientBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.protocolandconvenient.implementation.ProtocolAndConvenientClientImpl; - -/** - * A builder for creating a new instance of the ProtocolAndConvenientClient type. - */ -@ServiceClientBuilder(serviceClients = { ProtocolAndConvenientClient.class, ProtocolAndConvenientAsyncClient.class }) -public final class ProtocolAndConvenientClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("tsptest-protocolandconvenient.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ProtocolAndConvenientClientBuilder. - */ - @Generated - public ProtocolAndConvenientClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ProtocolAndConvenientClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ProtocolAndConvenientClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ProtocolAndConvenientClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ProtocolAndConvenientClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ProtocolAndConvenientClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ProtocolAndConvenientClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ProtocolAndConvenientClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ProtocolAndConvenientClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private ProtocolAndConvenientServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the ProtocolAndConvenientClientBuilder. - */ - @Generated - public ProtocolAndConvenientClientBuilder serviceVersion(ProtocolAndConvenientServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ProtocolAndConvenientClientBuilder. - */ - @Generated - public ProtocolAndConvenientClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ProtocolAndConvenientClientImpl with the provided parameters. - * - * @return an instance of ProtocolAndConvenientClientImpl. - */ - @Generated - private ProtocolAndConvenientClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - ProtocolAndConvenientServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : ProtocolAndConvenientServiceVersion.getLatest(); - ProtocolAndConvenientClientImpl client = new ProtocolAndConvenientClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ProtocolAndConvenientAsyncClient class. - * - * @return an instance of ProtocolAndConvenientAsyncClient. - */ - @Generated - public ProtocolAndConvenientAsyncClient buildAsyncClient() { - return new ProtocolAndConvenientAsyncClient(buildInnerClient().getProtocolAndConvenienceOps()); - } - - /** - * Builds an instance of ProtocolAndConvenientClient class. - * - * @return an instance of ProtocolAndConvenientClient. - */ - @Generated - public ProtocolAndConvenientClient buildClient() { - return new ProtocolAndConvenientClient(buildInnerClient().getProtocolAndConvenienceOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ProtocolAndConvenientClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientServiceVersion.java deleted file mode 100644 index 97276c5335a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of ProtocolAndConvenientClient. - */ -public enum ProtocolAndConvenientServiceVersion implements ServiceVersion { - /** - * Enum value 2022-06-01-preview. - */ - V2022_06_01_PREVIEW("2022-06-01-preview"); - - private final String version; - - ProtocolAndConvenientServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link ProtocolAndConvenientServiceVersion}. - */ - public static ProtocolAndConvenientServiceVersion getLatest() { - return V2022_06_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/OperationLocationPollingStrategy.java deleted file mode 100644 index a2d34e7146a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/OperationLocationPollingStrategy.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.OperationResourcePollingStrategy; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -/** - * Implements an operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public Mono> onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - final Mono> pollResponseMono - = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) - .onErrorResume(exception -> { - LOGGER.info("Failed to parse initial response."); - return Mono.empty(); - }) - .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); - return pollResponseMono.switchIfEmpty( - Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); - } else { - return Mono - .error( - new AzureException(String.format( - "Operation failed or cancelled with status code %d," - + ", '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - } - - /** - * {@inheritDoc} - */ - @Override - public Mono getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - return Mono.error(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - return Mono.error(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - return PollingUtils - .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) - .flatMap(value -> { - if (value.get(propertyName) != null) { - return BinaryData.fromObjectAsync(value.get(propertyName)) - .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); - } else { - return Mono.error(new AzureException("Cannot get final result")); - } - }) - .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/PollingUtils.java deleted file mode 100644 index 83f9c883f39..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/PollingUtils.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient.implementation; - -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.BinaryData; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.net.URI; -import java.net.URISyntaxException; -import java.time.DateTimeException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.time.temporal.ChronoUnit; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -final class PollingUtils { - - public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE - = new TypeReference>() { - }; - - public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); - - public static final String HTTP_METHOD = "httpMethod"; - public static final String REQUEST_URL = "requestURL"; - public static final String POLL_RESPONSE_BODY = "pollResponseBody"; - - private static final String FORWARD_SLASH = "/"; - - public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { - try { - URI uri = new URI(path); - if (!uri.isAbsolute()) { - if (CoreUtils.isNullOrEmpty(endpoint)) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); - } - - if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { - return endpoint + path.substring(1); - } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { - return endpoint + FORWARD_SLASH + path; - } else { - return endpoint + path; - } - } - } catch (URISyntaxException ex) { - throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); - } - return path; - } - - public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - T value; - if (binaryData == null) { - value = null; - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); - } else { - value = binaryData.toObject(typeReference, serializer); - } - return value; - } - - @SuppressWarnings("unchecked") - public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - Mono value; - if (binaryData == null) { - value = Mono.empty(); - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = (Mono) binaryData.toReplayableBinaryDataAsync(); - } else { - value = binaryData.toObjectAsync(typeReference, serializer); - } - return value; - } - - private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); - private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); - - public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { - // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. - Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. - retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then - // attempt to resolve it as an HTTP date (RFC1123). - retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, - headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); - - // Either the retry delay will have been found or it'll be null, null indicates no retry after. - return retryDelay; - } - - private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, - Function delayParser) { - String headerValue = headers.getValue(headerName); - - return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); - } - - private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { - long delaySeconds; - try { - OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); - - delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); - } catch (DateTimeException ex) { - delaySeconds = tryParseLong(value); - } - - return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; - } - - private static long tryParseLong(String value) { - try { - return Long.parseLong(value); - } catch (NumberFormatException ex) { - return -1; - } - } - - private static Duration tryGetDelayMillis(String value) { - long delayMillis = tryParseLong(value); - return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java deleted file mode 100644 index 419ba51f13c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java +++ /dev/null @@ -1,1117 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -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.RequestOptions; -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 com.azure.core.util.UrlBuilder; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; -import tsptest.protocolandconvenient.ProtocolAndConvenientServiceVersion; -import tsptest.protocolandconvenient.models.ResourceI; - -/** - * An instance of this class provides access to all the operations defined in ProtocolAndConvenienceOps. - */ -public final class ProtocolAndConvenienceOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ProtocolAndConvenienceOpsService service; - - /** - * The service client containing this operation class. - */ - private final ProtocolAndConvenientClientImpl client; - - /** - * Initializes an instance of ProtocolAndConvenienceOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ProtocolAndConvenienceOpsImpl(ProtocolAndConvenientClientImpl client) { - this.service = RestProxy.create(ProtocolAndConvenienceOpsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public ProtocolAndConvenientServiceVersion getServiceVersion() { - return client.getServiceVersion(); - } - - /** - * The interface defining all the services for ProtocolAndConvenientClientProtocolAndConvenienceOps to be used by - * the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ProtocolAndConvenientClientProtocolAndConvenienceOps") - public interface ProtocolAndConvenienceOpsService { - @Post("/protocolandconvenient/onlyConvenient") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> onlyConvenient(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/protocolandconvenient/onlyConvenient") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response onlyConvenientSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/protocolandconvenient/onlyProtocol") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> onlyProtocol(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/protocolandconvenient/onlyProtocol") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response onlyProtocolSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/protocolandconvenient/bothConvenientAndProtocol") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> bothConvenientAndProtocol(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/protocolandconvenient/bothConvenientAndProtocol") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response bothConvenientAndProtocolSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/protocolandconvenient/errorSetting") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> errorSetting(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/protocolandconvenient/errorSetting") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response errorSettingSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/protocolandconvenient/resources/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createOrReplace(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); - - @Put("/protocolandconvenient/resources/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createOrReplaceSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); - - @Get("/protocolandconvenient/resources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> list(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/protocolandconvenient/resources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * When set protocol false and convenient true, then the protocol method should be package private. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> onlyConvenientWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.onlyConvenient(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * When set protocol false and convenient true, then the protocol method should be package private. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response onlyConvenientWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.onlyConvenientSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * When set protocol true and convenient false, only the protocol method should be generated, ResourceC and - * ResourceD should not be generated. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> onlyProtocolWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.onlyProtocol(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * When set protocol true and convenient false, only the protocol method should be generated, ResourceC and - * ResourceD should not be generated. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response onlyProtocolWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.onlyProtocolSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * Setting protocol true and convenient true, both convenient and protocol methods will be generated. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> bothConvenientAndProtocolWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.bothConvenientAndProtocol(this.client.getEndpoint(), contentType, - accept, body, requestOptions, context)); - } - - /** - * Setting protocol true and convenient true, both convenient and protocol methods will be generated. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response bothConvenientAndProtocolWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.bothConvenientAndProtocolSync(this.client.getEndpoint(), contentType, accept, body, - requestOptions, Context.NONE); - } - - /** - * When set protocol false and convenient false. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> errorSettingWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.errorSetting(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * When set protocol false and convenient false. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response errorSettingWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.errorSettingSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * Long running operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrReplaceWithResponseAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.createOrReplace(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), - name, contentType, accept, resource, requestOptions, context)); - } - - /** - * Long running operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createOrReplaceWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), - name, contentType, accept, resource, requestOptions, Context.NONE); - } - - /** - * Long running operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateOrReplaceWithModelAsync(String name, - BinaryData resource, RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.createOrReplaceWithResponseAsync(name, resource, requestOptions), - new tsptest.protocolandconvenient.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion())), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(ResourceI.class)); - } - - /** - * Long running operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateOrReplaceWithModel(String name, BinaryData resource, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.createOrReplaceWithResponse(name, resource, requestOptions), - new tsptest.protocolandconvenient.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion())), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(ResourceI.class)); - } - - /** - * Long running operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateOrReplaceAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.createOrReplaceWithResponseAsync(name, resource, requestOptions), - new tsptest.protocolandconvenient.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion())), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * Long running operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateOrReplace(String name, BinaryData resource, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.createOrReplaceWithResponse(name, resource, requestOptions), - new tsptest.protocolandconvenient.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion())), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * Paging operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxresultsLongNoThe maxPageSize parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of ResourceJ items along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * Paging operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxresultsLongNoThe maxPageSize parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of ResourceJ items as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>((pageSize) -> { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxresults", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listSinglePageAsync(requestOptionsLocal); - }, (nextLink, pageSize) -> { - RequestOptions requestOptionsLocal = new RequestOptions(); - requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxresults", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listNextSinglePageAsync(nextLink, requestOptionsLocal); - }); - } - - /** - * Paging operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxresultsLongNoThe maxPageSize parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of ResourceJ items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * Paging operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
maxresultsLongNoThe maxPageSize parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of ResourceJ items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>((pageSize) -> { - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxresults", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listSinglePage(requestOptionsLocal); - }, (nextLink, pageSize) -> { - RequestOptions requestOptionsLocal = new RequestOptions(); - requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); - if (pageSize != null) { - requestOptionsLocal.addRequestCallback(requestLocal -> { - UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); - urlBuilder.setQueryParameter("maxresults", String.valueOf(pageSize)); - requestLocal.setUrl(urlBuilder.toString()); - }); - } - return listNextSinglePage(nextLink, requestOptionsLocal); - }); - } - - /** - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of ResourceJ items along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listNext(nextLink, this.client.getEndpoint(), 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
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of ResourceJ items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - private List getValues(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - List values = (List) obj.get(path); - return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); - } catch (RuntimeException e) { - return null; - } - } - - private String getNextLink(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - return (String) obj.get(path); - } catch (RuntimeException e) { - return null; - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenientClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenientClientImpl.java deleted file mode 100644 index b650e49b670..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenientClientImpl.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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; -import tsptest.protocolandconvenient.ProtocolAndConvenientServiceVersion; - -/** - * Initializes a new instance of the ProtocolAndConvenientClient type. - */ -public final class ProtocolAndConvenientClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final ProtocolAndConvenientServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public ProtocolAndConvenientServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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 ProtocolAndConvenienceOpsImpl object to access its operations. - */ - private final ProtocolAndConvenienceOpsImpl protocolAndConvenienceOps; - - /** - * Gets the ProtocolAndConvenienceOpsImpl object to access its operations. - * - * @return the ProtocolAndConvenienceOpsImpl object. - */ - public ProtocolAndConvenienceOpsImpl getProtocolAndConvenienceOps() { - return this.protocolAndConvenienceOps; - } - - /** - * Initializes an instance of ProtocolAndConvenientClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public ProtocolAndConvenientClientImpl(String endpoint, ProtocolAndConvenientServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of ProtocolAndConvenientClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public ProtocolAndConvenientClientImpl(HttpPipeline httpPipeline, String endpoint, - ProtocolAndConvenientServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of ProtocolAndConvenientClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public ProtocolAndConvenientClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint, ProtocolAndConvenientServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.protocolAndConvenienceOps = new ProtocolAndConvenienceOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/SyncOperationLocationPollingStrategy.java deleted file mode 100644 index 9dbb6ad2b0d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/SyncOperationLocationPollingStrategy.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.io.UncheckedIOException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Map; - -// DO NOT modify this helper class - -/** - * Implements a synchronous operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public PollResponse onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - T initialResponseType = null; - try { - initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, - pollResponseType); - } catch (UncheckedIOException e) { - LOGGER.info("Failed to parse initial response."); - } - return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); - } - - throw LOGGER.logExceptionAsError(new AzureException( - String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - - /** - * {@inheritDoc} - */ - public U getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, - PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); - if (pollResult != null && pollResult.get(propertyName) != null) { - return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), - serializer, resultType); - } else { - throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); - } - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/package-info.java deleted file mode 100644 index 92e8412d77d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ProtocolAndConvenient. - * - */ -package tsptest.protocolandconvenient.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceA.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceA.java deleted file mode 100644 index b35a34303be..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceA.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ResourceA model. - */ -@Immutable -public final class ResourceA implements JsonSerializable { - /* - * The id property. - */ - @Generated - private String id; - - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of ResourceA class. - * - * @param name the name value to set. - */ - @Generated - public ResourceA(String name) { - this.name = name; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourceA from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourceA if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResourceA. - */ - @Generated - public static ResourceA fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - ResourceA deserializedResourceA = new ResourceA(name); - deserializedResourceA.id = id; - - return deserializedResourceA; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceB.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceB.java deleted file mode 100644 index 4de9e349683..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceB.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ResourceB model. - */ -@Immutable -public final class ResourceB implements JsonSerializable { - /* - * The id property. - */ - @Generated - private String id; - - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of ResourceB class. - * - * @param name the name value to set. - */ - @Generated - private ResourceB(String name) { - this.name = name; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourceB from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourceB if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResourceB. - */ - @Generated - public static ResourceB fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - ResourceB deserializedResourceB = new ResourceB(name); - deserializedResourceB.id = id; - - return deserializedResourceB; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceE.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceE.java deleted file mode 100644 index 32957b6ec19..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceE.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ResourceE model. - */ -@Immutable -public final class ResourceE implements JsonSerializable { - /* - * The id property. - */ - @Generated - private String id; - - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of ResourceE class. - * - * @param name the name value to set. - */ - @Generated - public ResourceE(String name) { - this.name = name; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourceE from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourceE if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResourceE. - */ - @Generated - public static ResourceE fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - ResourceE deserializedResourceE = new ResourceE(name); - deserializedResourceE.id = id; - - return deserializedResourceE; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceF.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceF.java deleted file mode 100644 index c8028dfc258..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceF.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ResourceF model. - */ -@Immutable -public final class ResourceF implements JsonSerializable { - /* - * The id property. - */ - @Generated - private String id; - - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of ResourceF class. - * - * @param name the name value to set. - */ - @Generated - private ResourceF(String name) { - this.name = name; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourceF from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourceF if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResourceF. - */ - @Generated - public static ResourceF fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - ResourceF deserializedResourceF = new ResourceF(name); - deserializedResourceF.id = id; - - return deserializedResourceF; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceI.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceI.java deleted file mode 100644 index 5d608a057d0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceI.java +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ResourceI model. - */ -@Immutable -public final class ResourceI implements JsonSerializable { - /* - * The id property. - */ - @Generated - private String id; - - /* - * The name property. - */ - @Generated - private String name; - - /* - * The type property. - */ - @Generated - private final String type; - - /** - * Creates an instance of ResourceI class. - * - * @param type the type value to set. - */ - @Generated - public ResourceI(String type) { - this.type = type; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the type property: The type property. - * - * @return the type value. - */ - @Generated - public String getType() { - return this.type; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("type", this.type); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourceI from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourceI if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResourceI. - */ - @Generated - public static ResourceI fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String name = null; - String type = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("type".equals(fieldName)) { - type = reader.getString(); - } else { - reader.skipChildren(); - } - } - ResourceI deserializedResourceI = new ResourceI(type); - deserializedResourceI.id = id; - deserializedResourceI.name = name; - - return deserializedResourceI; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceJ.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceJ.java deleted file mode 100644 index c540561bdc9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceJ.java +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ResourceJ model. - */ -@Immutable -public final class ResourceJ implements JsonSerializable { - /* - * The id property. - */ - @Generated - private String id; - - /* - * The name property. - */ - @Generated - private String name; - - /* - * The type property. - */ - @Generated - private final String type; - - /** - * Creates an instance of ResourceJ class. - * - * @param type the type value to set. - */ - @Generated - private ResourceJ(String type) { - this.type = type; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the type property: The type property. - * - * @return the type value. - */ - @Generated - public String getType() { - return this.type; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("type", this.type); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ResourceJ from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ResourceJ if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ResourceJ. - */ - @Generated - public static ResourceJ fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String name = null; - String type = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("type".equals(fieldName)) { - type = reader.getString(); - } else { - reader.skipChildren(); - } - } - ResourceJ deserializedResourceJ = new ResourceJ(type); - deserializedResourceJ.id = id; - deserializedResourceJ.name = name; - - return deserializedResourceJ; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/package-info.java deleted file mode 100644 index 28fc5c5b37d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for ProtocolAndConvenient. - * - */ -package tsptest.protocolandconvenient.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/package-info.java deleted file mode 100644 index 6ed14197b41..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ProtocolAndConvenient. - * - */ -package tsptest.protocolandconvenient; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseAsyncClient.java deleted file mode 100644 index bb5f84c9ca6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseAsyncClient.java +++ /dev/null @@ -1,952 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import java.util.stream.Collectors; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.response.implementation.ResponseClientImpl; -import tsptest.response.models.OperationDetails1; -import tsptest.response.models.OperationDetails2; -import tsptest.response.models.Resource; - -/** - * Initializes a new instance of the asynchronous ResponseClient type. - */ -@ServiceClient(builder = ResponseClientBuilder.class, isAsync = true) -public final class ResponseAsyncClient { - @Generated - private final ResponseClientImpl serviceClient; - - /** - * Initializes an instance of ResponseAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ResponseAsyncClient(ResponseClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getBinary operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getBinaryWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getBinaryWithResponseAsync(requestOptions); - } - - /** - * The getArray operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         description: String (Optional)
-     *         type: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getArrayWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getArrayWithResponseAsync(requestOptions); - } - - /** - * The getAnotherArray operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         description: String (Optional)
-     *         type: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAnotherArrayWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAnotherArrayWithResponseAsync(requestOptions); - } - - /** - * The createWithHeaders operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createWithHeadersWithResponse(RequestOptions requestOptions) { - return this.serviceClient.createWithHeadersWithResponseAsync(requestOptions); - } - - /** - * The deleteWithHeaders operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithHeadersWithResponse(RequestOptions requestOptions) { - return this.serviceClient.deleteWithHeadersWithResponseAsync(requestOptions); - } - - /** - * The most basic operation. - *

Response Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return whether resource exists along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> existsWithResponse(RequestOptions requestOptions) { - return this.serviceClient.existsWithResponseAsync(requestOptions); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLroInvalidPollResponse(BinaryData request, - RequestOptions requestOptions) { - return this.serviceClient.beginLroInvalidPollResponseAsync(request, requestOptions); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLroInvalidResult(BinaryData request, RequestOptions requestOptions) { - return this.serviceClient.beginLroInvalidResultAsync(request, requestOptions); - } - - /** - * The listStrings operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listStrings(RequestOptions requestOptions) { - return this.serviceClient.listStringsAsync(requestOptions); - } - - /** - * The listIntegers operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listIntegers(RequestOptions requestOptions) { - return this.serviceClient.listIntegersAsync(requestOptions); - } - - /** - * The getJsonUtf8Response operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getJsonUtf8ResponseWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getJsonUtf8ResponseWithResponseAsync(requestOptions); - } - - /** - * The getPlusJsonResponse operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPlusJsonResponseWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getPlusJsonResponseWithResponseAsync(requestOptions); - } - - /** - * The getUnionResponse operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param accept The accept parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getUnionResponseWithResponse(String accept, RequestOptions requestOptions) { - return this.serviceClient.getUnionResponseWithResponseAsync(accept, requestOptions); - } - - /** - * The getTextBoolean operation. - *

Response Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return boolean with `true` and `false` values along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextBooleanWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextBooleanWithResponseAsync(requestOptions); - } - - /** - * The getTextByte operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 8-bit integer along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextByteWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextByteWithResponseAsync(requestOptions); - } - - /** - * The getTextInt32 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 32-bit integer along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextInt32WithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextInt32WithResponseAsync(requestOptions); - } - - /** - * The getTextInt64 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * long
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 64-bit integer along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextInt64WithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextInt64WithResponseAsync(requestOptions); - } - - /** - * The getTextFloat32 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * double
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 32 bit floating point number along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextFloat32WithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextFloat32WithResponseAsync(requestOptions); - } - - /** - * The getTextFloat64 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * double
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 64 bit floating point number along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextFloat64WithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextFloat64WithResponseAsync(requestOptions); - } - - /** - * The getTextChar operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 16-bit integer along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextCharWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextCharWithResponseAsync(requestOptions); - } - - /** - * The getBinary operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getBinary() { - // Generated convenience method for getBinaryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getBinaryWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getArray operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getArray() { - // Generated convenience method for getArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getArrayWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_RESOURCE)); - } - - /** - * The getAnotherArray operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAnotherArray() { - // Generated convenience method for getAnotherArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAnotherArrayWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_RESOURCE)); - } - - /** - * The createWithHeaders operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createWithHeaders() { - // Generated convenience method for createWithHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createWithHeadersWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * The deleteWithHeaders operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteWithHeaders() { - // Generated convenience method for deleteWithHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - return deleteWithHeadersWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The most basic operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return whether resource exists on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono exists() { - // Generated convenience method for existsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return existsWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The most basic operation. - * - * @param request The request parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLroInvalidPollResponse(Resource request) { - // Generated convenience method for beginLroInvalidPollResponseWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginLroInvalidPollResponseWithModelAsync(BinaryData.fromObject(request), requestOptions); - } - - /** - * The most basic operation. - * - * @param request The request parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLroInvalidResult(Resource request) { - // Generated convenience method for beginLroInvalidResultWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginLroInvalidResultWithModelAsync(BinaryData.fromObject(request), requestOptions); - } - - /** - * The listStrings operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listStrings() { - // Generated convenience method for listStrings - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listStrings(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(String.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } - - /** - * The listIntegers operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listIntegers() { - // Generated convenience method for listIntegers - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listIntegers(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(Integer.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } - - /** - * The getJsonUtf8Response operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getJsonUtf8Response() { - // Generated convenience method for getJsonUtf8ResponseWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getJsonUtf8ResponseWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * The getPlusJsonResponse operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPlusJsonResponse() { - // Generated convenience method for getPlusJsonResponseWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getPlusJsonResponseWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * The getUnionResponse operation. - * - * @param accept The accept parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getUnionResponse(String accept) { - // Generated convenience method for getUnionResponseWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getUnionResponseWithResponse(accept, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getTextBoolean operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return boolean with `true` and `false` values on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getTextBoolean() { - // Generated convenience method for getTextBooleanWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getTextBooleanWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> Boolean.parseBoolean(protocolMethodData.toString())); - } - - /** - * The getTextByte operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 8-bit integer on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getTextByte() { - // Generated convenience method for getTextByteWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getTextByteWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> Integer.parseInt(protocolMethodData.toString())); - } - - /** - * The getTextInt32 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 32-bit integer on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getTextInt32() { - // Generated convenience method for getTextInt32WithResponse - RequestOptions requestOptions = new RequestOptions(); - return getTextInt32WithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> Integer.parseInt(protocolMethodData.toString())); - } - - /** - * The getTextInt64 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 64-bit integer on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getTextInt64() { - // Generated convenience method for getTextInt64WithResponse - RequestOptions requestOptions = new RequestOptions(); - return getTextInt64WithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> Long.parseLong(protocolMethodData.toString())); - } - - /** - * The getTextFloat32 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 32 bit floating point number on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getTextFloat32() { - // Generated convenience method for getTextFloat32WithResponse - RequestOptions requestOptions = new RequestOptions(); - return getTextFloat32WithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> Double.parseDouble(protocolMethodData.toString())); - } - - /** - * The getTextFloat64 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 64 bit floating point number on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getTextFloat64() { - // Generated convenience method for getTextFloat64WithResponse - RequestOptions requestOptions = new RequestOptions(); - return getTextFloat64WithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> Double.parseDouble(protocolMethodData.toString())); - } - - /** - * The getTextChar operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 16-bit integer on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getTextChar() { - // Generated convenience method for getTextCharWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getTextCharWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> Integer.parseInt(protocolMethodData.toString())); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_RESOURCE - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClient.java deleted file mode 100644 index d6cfa44063c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClient.java +++ /dev/null @@ -1,909 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import tsptest.response.implementation.ResponseClientImpl; -import tsptest.response.models.OperationDetails1; -import tsptest.response.models.OperationDetails2; -import tsptest.response.models.Resource; - -/** - * Initializes a new instance of the synchronous ResponseClient type. - */ -@ServiceClient(builder = ResponseClientBuilder.class) -public final class ResponseClient { - @Generated - private final ResponseClientImpl serviceClient; - - /** - * Initializes an instance of ResponseClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ResponseClient(ResponseClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getBinary operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getBinaryWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getBinaryWithResponse(requestOptions); - } - - /** - * The getArray operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         description: String (Optional)
-     *         type: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getArrayWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getArrayWithResponse(requestOptions); - } - - /** - * The getAnotherArray operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         description: String (Optional)
-     *         type: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAnotherArrayWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAnotherArrayWithResponse(requestOptions); - } - - /** - * The createWithHeaders operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createWithHeadersWithResponse(RequestOptions requestOptions) { - return this.serviceClient.createWithHeadersWithResponse(requestOptions); - } - - /** - * The deleteWithHeaders operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithHeadersWithResponse(RequestOptions requestOptions) { - return this.serviceClient.deleteWithHeadersWithResponse(requestOptions); - } - - /** - * The most basic operation. - *

Response Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return whether resource exists along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response existsWithResponse(RequestOptions requestOptions) { - return this.serviceClient.existsWithResponse(requestOptions); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLroInvalidPollResponse(BinaryData request, - RequestOptions requestOptions) { - return this.serviceClient.beginLroInvalidPollResponse(request, requestOptions); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLroInvalidResult(BinaryData request, RequestOptions requestOptions) { - return this.serviceClient.beginLroInvalidResult(request, requestOptions); - } - - /** - * The listStrings operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listStrings(RequestOptions requestOptions) { - return this.serviceClient.listStrings(requestOptions); - } - - /** - * The listIntegers operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listIntegers(RequestOptions requestOptions) { - return this.serviceClient.listIntegers(requestOptions); - } - - /** - * The getJsonUtf8Response operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getJsonUtf8ResponseWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getJsonUtf8ResponseWithResponse(requestOptions); - } - - /** - * The getPlusJsonResponse operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getPlusJsonResponseWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getPlusJsonResponseWithResponse(requestOptions); - } - - /** - * The getUnionResponse operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param accept The accept parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getUnionResponseWithResponse(String accept, RequestOptions requestOptions) { - return this.serviceClient.getUnionResponseWithResponse(accept, requestOptions); - } - - /** - * The getTextBoolean operation. - *

Response Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return boolean with `true` and `false` values along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextBooleanWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextBooleanWithResponse(requestOptions); - } - - /** - * The getTextByte operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 8-bit integer along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextByteWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextByteWithResponse(requestOptions); - } - - /** - * The getTextInt32 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 32-bit integer along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextInt32WithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextInt32WithResponse(requestOptions); - } - - /** - * The getTextInt64 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * long
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 64-bit integer along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextInt64WithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextInt64WithResponse(requestOptions); - } - - /** - * The getTextFloat32 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * double
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 32 bit floating point number along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextFloat32WithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextFloat32WithResponse(requestOptions); - } - - /** - * The getTextFloat64 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * double
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 64 bit floating point number along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextFloat64WithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextFloat64WithResponse(requestOptions); - } - - /** - * The getTextChar operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 16-bit integer along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextCharWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getTextCharWithResponse(requestOptions); - } - - /** - * The getBinary operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData getBinary() { - // Generated convenience method for getBinaryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getBinaryWithResponse(requestOptions).getValue(); - } - - /** - * The getArray operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List getArray() { - // Generated convenience method for getArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getArrayWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_RESOURCE); - } - - /** - * The getAnotherArray operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List getAnotherArray() { - // Generated convenience method for getAnotherArrayWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAnotherArrayWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_RESOURCE); - } - - /** - * The createWithHeaders operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource createWithHeaders() { - // Generated convenience method for createWithHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createWithHeadersWithResponse(requestOptions).getValue().toObject(Resource.class); - } - - /** - * The deleteWithHeaders operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteWithHeaders() { - // Generated convenience method for deleteWithHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - deleteWithHeadersWithResponse(requestOptions).getValue(); - } - - /** - * The most basic operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return whether resource exists. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public boolean exists() { - // Generated convenience method for existsWithResponse - RequestOptions requestOptions = new RequestOptions(); - return existsWithResponse(requestOptions).getValue(); - } - - /** - * The most basic operation. - * - * @param request The request parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLroInvalidPollResponse(Resource request) { - // Generated convenience method for beginLroInvalidPollResponseWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginLroInvalidPollResponseWithModel(BinaryData.fromObject(request), requestOptions); - } - - /** - * The most basic operation. - * - * @param request The request parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLroInvalidResult(Resource request) { - // Generated convenience method for beginLroInvalidResultWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginLroInvalidResultWithModel(BinaryData.fromObject(request), requestOptions); - } - - /** - * The listStrings operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listStrings() { - // Generated convenience method for listStrings - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listStrings(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(String.class)); - } - - /** - * The listIntegers operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listIntegers() { - // Generated convenience method for listIntegers - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listIntegers(requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(Integer.class)); - } - - /** - * The getJsonUtf8Response operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource getJsonUtf8Response() { - // Generated convenience method for getJsonUtf8ResponseWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getJsonUtf8ResponseWithResponse(requestOptions).getValue().toObject(Resource.class); - } - - /** - * The getPlusJsonResponse operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource getPlusJsonResponse() { - // Generated convenience method for getPlusJsonResponseWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getPlusJsonResponseWithResponse(requestOptions).getValue().toObject(Resource.class); - } - - /** - * The getUnionResponse operation. - * - * @param accept The accept parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData getUnionResponse(String accept) { - // Generated convenience method for getUnionResponseWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getUnionResponseWithResponse(accept, requestOptions).getValue(); - } - - /** - * The getTextBoolean operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return boolean with `true` and `false` values. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public boolean getTextBoolean() { - // Generated convenience method for getTextBooleanWithResponse - RequestOptions requestOptions = new RequestOptions(); - return Boolean.parseBoolean(getTextBooleanWithResponse(requestOptions).getValue().toString()); - } - - /** - * The getTextByte operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 8-bit integer. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public int getTextByte() { - // Generated convenience method for getTextByteWithResponse - RequestOptions requestOptions = new RequestOptions(); - return Integer.parseInt(getTextByteWithResponse(requestOptions).getValue().toString()); - } - - /** - * The getTextInt32 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 32-bit integer. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public int getTextInt32() { - // Generated convenience method for getTextInt32WithResponse - RequestOptions requestOptions = new RequestOptions(); - return Integer.parseInt(getTextInt32WithResponse(requestOptions).getValue().toString()); - } - - /** - * The getTextInt64 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 64-bit integer. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public long getTextInt64() { - // Generated convenience method for getTextInt64WithResponse - RequestOptions requestOptions = new RequestOptions(); - return Long.parseLong(getTextInt64WithResponse(requestOptions).getValue().toString()); - } - - /** - * The getTextFloat32 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 32 bit floating point number. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public double getTextFloat32() { - // Generated convenience method for getTextFloat32WithResponse - RequestOptions requestOptions = new RequestOptions(); - return Double.parseDouble(getTextFloat32WithResponse(requestOptions).getValue().toString()); - } - - /** - * The getTextFloat64 operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 64 bit floating point number. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public double getTextFloat64() { - // Generated convenience method for getTextFloat64WithResponse - RequestOptions requestOptions = new RequestOptions(); - return Double.parseDouble(getTextFloat64WithResponse(requestOptions).getValue().toString()); - } - - /** - * The getTextChar operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 16-bit integer. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public int getTextChar() { - // Generated convenience method for getTextCharWithResponse - RequestOptions requestOptions = new RequestOptions(); - return Integer.parseInt(getTextCharWithResponse(requestOptions).getValue().toString()); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_RESOURCE - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClientBuilder.java deleted file mode 100644 index 6ebaaea1928..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.response.implementation.ResponseClientImpl; - -/** - * A builder for creating a new instance of the ResponseClient type. - */ -@ServiceClientBuilder(serviceClients = { ResponseClient.class, ResponseAsyncClient.class }) -public final class ResponseClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-response.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ResponseClientBuilder. - */ - @Generated - public ResponseClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResponseClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResponseClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResponseClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResponseClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResponseClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResponseClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResponseClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ResponseClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private ResponseServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the ResponseClientBuilder. - */ - @Generated - public ResponseClientBuilder serviceVersion(ResponseServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ResponseClientBuilder. - */ - @Generated - public ResponseClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ResponseClientImpl with the provided parameters. - * - * @return an instance of ResponseClientImpl. - */ - @Generated - private ResponseClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - ResponseServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : ResponseServiceVersion.getLatest(); - ResponseClientImpl client = new ResponseClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ResponseAsyncClient class. - * - * @return an instance of ResponseAsyncClient. - */ - @Generated - public ResponseAsyncClient buildAsyncClient() { - return new ResponseAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ResponseClient class. - * - * @return an instance of ResponseClient. - */ - @Generated - public ResponseClient buildClient() { - return new ResponseClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ResponseClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseServiceVersion.java deleted file mode 100644 index 1744632d76d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of ResponseClient. - */ -public enum ResponseServiceVersion implements ServiceVersion { - /** - * Enum value 2022-06-01-preview. - */ - V2022_06_01_PREVIEW("2022-06-01-preview"); - - private final String version; - - ResponseServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link ResponseServiceVersion}. - */ - public static ResponseServiceVersion getLatest() { - return V2022_06_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/OperationLocationPollingStrategy.java deleted file mode 100644 index 2945cf50ac5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/OperationLocationPollingStrategy.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.OperationResourcePollingStrategy; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -/** - * Implements an operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public Mono> onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - final Mono> pollResponseMono - = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) - .onErrorResume(exception -> { - LOGGER.info("Failed to parse initial response."); - return Mono.empty(); - }) - .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); - return pollResponseMono.switchIfEmpty( - Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); - } else { - return Mono - .error( - new AzureException(String.format( - "Operation failed or cancelled with status code %d," - + ", '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - } - - /** - * {@inheritDoc} - */ - @Override - public Mono getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - return Mono.error(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - return Mono.error(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - return PollingUtils - .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) - .flatMap(value -> { - if (value.get(propertyName) != null) { - return BinaryData.fromObjectAsync(value.get(propertyName)) - .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); - } else { - return Mono.error(new AzureException("Cannot get final result")); - } - }) - .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/PollingUtils.java deleted file mode 100644 index 6b07104c70e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/PollingUtils.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.implementation; - -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.BinaryData; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.net.URI; -import java.net.URISyntaxException; -import java.time.DateTimeException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.time.temporal.ChronoUnit; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -final class PollingUtils { - - public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE - = new TypeReference>() { - }; - - public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); - - public static final String HTTP_METHOD = "httpMethod"; - public static final String REQUEST_URL = "requestURL"; - public static final String POLL_RESPONSE_BODY = "pollResponseBody"; - - private static final String FORWARD_SLASH = "/"; - - public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { - try { - URI uri = new URI(path); - if (!uri.isAbsolute()) { - if (CoreUtils.isNullOrEmpty(endpoint)) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); - } - - if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { - return endpoint + path.substring(1); - } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { - return endpoint + FORWARD_SLASH + path; - } else { - return endpoint + path; - } - } - } catch (URISyntaxException ex) { - throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); - } - return path; - } - - public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - T value; - if (binaryData == null) { - value = null; - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); - } else { - value = binaryData.toObject(typeReference, serializer); - } - return value; - } - - @SuppressWarnings("unchecked") - public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - Mono value; - if (binaryData == null) { - value = Mono.empty(); - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = (Mono) binaryData.toReplayableBinaryDataAsync(); - } else { - value = binaryData.toObjectAsync(typeReference, serializer); - } - return value; - } - - private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); - private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); - - public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { - // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. - Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. - retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then - // attempt to resolve it as an HTTP date (RFC1123). - retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, - headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); - - // Either the retry delay will have been found or it'll be null, null indicates no retry after. - return retryDelay; - } - - private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, - Function delayParser) { - String headerValue = headers.getValue(headerName); - - return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); - } - - private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { - long delaySeconds; - try { - OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); - - delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); - } catch (DateTimeException ex) { - delaySeconds = tryParseLong(value); - } - - return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; - } - - private static long tryParseLong(String value) { - try { - return Long.parseLong(value); - } catch (NumberFormatException ex) { - return -1; - } - } - - private static Duration tryGetDelayMillis(String value) { - long delayMillis = tryParseLong(value); - return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/ResponseClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/ResponseClientImpl.java deleted file mode 100644 index 6b93dafe6cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/ResponseClientImpl.java +++ /dev/null @@ -1,2042 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Head; -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.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -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.RequestOptions; -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 com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; -import tsptest.response.ResponseServiceVersion; -import tsptest.response.models.OperationDetails1; -import tsptest.response.models.OperationDetails2; -import tsptest.response.models.Resource; - -/** - * Initializes a new instance of the ResponseClient type. - */ -public final class ResponseClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ResponseClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final ResponseServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public ResponseServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of ResponseClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public ResponseClientImpl(String endpoint, ResponseServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of ResponseClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public ResponseClientImpl(HttpPipeline httpPipeline, String endpoint, ResponseServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of ResponseClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public ResponseClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - ResponseServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(ResponseClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ResponseClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ResponseClient") - public interface ResponseClientService { - @Get("/response/get-binary") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getBinary(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/get-binary") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getBinarySync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/response/get-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getArray(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/get-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getArraySync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/response/get-another-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAnotherArray(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/get-another-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAnotherArraySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/response/create-with-headers") - @ExpectedResponses({ 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createWithHeaders(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/response/create-with-headers") - @ExpectedResponses({ 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createWithHeadersSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Delete("/response/delete-with-headers") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> deleteWithHeaders(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Delete("/response/delete-with-headers") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteWithHeadersSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Head("/response/exists") - @ExpectedResponses({ 200, 404 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> exists(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); - - @Head("/response/exists") - @ExpectedResponses({ 200, 404 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response existsSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); - - @Post("/response/lro-invalid-poll-response") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> lroInvalidPollResponse(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context); - - @Post("/response/lro-invalid-poll-response") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response lroInvalidPollResponseSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context); - - @Post("/response/lro-invalid-result") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> lroInvalidResult(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context); - - @Post("/response/lro-invalid-result") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response lroInvalidResultSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context); - - @Get("/response/paged-string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listStrings(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/paged-string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listStringsSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/paged-int32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listIntegers(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/paged-int32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listIntegersSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/json-utf8-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getJsonUtf8Response(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/json-utf8-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getJsonUtf8ResponseSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/plus-json-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getPlusJsonResponse(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/plus-json-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getPlusJsonResponseSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/union-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getUnionResponse(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/union-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getUnionResponseSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-boolean-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getTextBoolean(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-boolean-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTextBooleanSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-byte-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getTextByte(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-byte-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTextByteSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-int32-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getTextInt32(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-int32-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTextInt32Sync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-int64-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getTextInt64(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-int64-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTextInt64Sync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-float32-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getTextFloat32(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-float32-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTextFloat32Sync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-float64-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getTextFloat64(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-float64-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTextFloat64Sync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-char-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getTextChar(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/response/text-char-response") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getTextCharSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listStringsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listStringsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * The getBinary operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getBinaryWithResponseAsync(RequestOptions requestOptions) { - final String accept = "image/png"; - return FluxUtil.withContext(context -> service.getBinary(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getBinary operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getBinaryWithResponse(RequestOptions requestOptions) { - final String accept = "image/png"; - return service.getBinarySync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getArray operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         description: String (Optional)
-     *         type: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getArrayWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getArray(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getArray operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         description: String (Optional)
-     *         type: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getArrayWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getArraySync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getAnotherArray operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         description: String (Optional)
-     *         type: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAnotherArrayWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAnotherArray(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getAnotherArray operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         id: String (Required)
-     *         name: String (Required)
-     *         description: String (Optional)
-     *         type: String (Required)
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAnotherArrayWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAnotherArraySync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The createWithHeaders operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createWithHeadersWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.createWithHeaders(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The createWithHeaders operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createWithHeadersWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.createWithHeadersSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The deleteWithHeaders operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithHeadersWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.deleteWithHeaders(this.getEndpoint(), requestOptions, context)); - } - - /** - * The deleteWithHeaders operation. - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithHeadersWithResponse(RequestOptions requestOptions) { - return service.deleteWithHeadersSync(this.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * The most basic operation. - *

Response Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return whether resource exists along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> existsWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.exists(this.getEndpoint(), this.getServiceVersion().getVersion(), - requestOptions, context)); - } - - /** - * The most basic operation. - *

Response Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return whether resource exists along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response existsWithResponse(RequestOptions requestOptions) { - return service.existsSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, - Context.NONE); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> lroInvalidPollResponseWithResponseAsync(BinaryData request, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.lroInvalidPollResponse(this.getEndpoint(), - this.getServiceVersion().getVersion(), contentType, request, requestOptions, context)); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response lroInvalidPollResponseWithResponse(BinaryData request, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.lroInvalidPollResponseSync(this.getEndpoint(), this.getServiceVersion().getVersion(), - contentType, request, requestOptions, Context.NONE); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLroInvalidPollResponseWithModelAsync(BinaryData request, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.lroInvalidPollResponseWithResponseAsync(request, requestOptions), - new tsptest.response.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(OperationDetails1.class), TypeReference.createInstance(Resource.class)); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLroInvalidPollResponseWithModel(BinaryData request, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.lroInvalidPollResponseWithResponse(request, requestOptions), - new tsptest.response.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(OperationDetails1.class), TypeReference.createInstance(Resource.class)); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLroInvalidPollResponseAsync(BinaryData request, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.lroInvalidPollResponseWithResponseAsync(request, requestOptions), - new tsptest.response.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLroInvalidPollResponse(BinaryData request, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.lroInvalidPollResponseWithResponse(request, requestOptions), - new tsptest.response.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> lroInvalidResultWithResponseAsync(BinaryData request, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.lroInvalidResult(this.getEndpoint(), - this.getServiceVersion().getVersion(), contentType, request, requestOptions, context)); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response lroInvalidResultWithResponse(BinaryData request, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.lroInvalidResultSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, - request, requestOptions, Context.NONE); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLroInvalidResultWithModelAsync(BinaryData request, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.lroInvalidResultWithResponseAsync(request, requestOptions), - new tsptest.response.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "lro_result"), - TypeReference.createInstance(OperationDetails2.class), TypeReference.createInstance(Resource.class)); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLroInvalidResultWithModel(BinaryData request, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.lroInvalidResultWithResponse(request, requestOptions), - new tsptest.response.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "lro_result"), - TypeReference.createInstance(OperationDetails2.class), TypeReference.createInstance(Resource.class)); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginLroInvalidResultAsync(BinaryData request, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.lroInvalidResultWithResponseAsync(request, requestOptions), - new tsptest.response.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "lro_result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * The most basic operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param request The request parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginLroInvalidResult(BinaryData request, RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.lroInvalidResultWithResponse(request, requestOptions), - new tsptest.response.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion()), - "lro_result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * The listStrings operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listStringsSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.listStrings(this.getEndpoint(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "items_value"), getNextLink(res.getValue(), "next_link"), null)); - } - - /** - * The listStrings operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listStringsAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listStringsSinglePageAsync(requestOptions), - nextLink -> listStringsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); - } - - /** - * The listStrings operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listStringsSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listStringsSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "items_value"), getNextLink(res.getValue(), "next_link"), null); - } - - /** - * The listStrings operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listStrings(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listStringsSinglePage(requestOptions), - nextLink -> listStringsNextSinglePage(nextLink, requestOptionsForNextPage)); - } - - /** - * The listIntegers operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listIntegersSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listIntegers(this.getEndpoint(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), null, null)); - } - - /** - * The listIntegers operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listIntegersAsync(RequestOptions requestOptions) { - return new PagedFlux<>(() -> listIntegersSinglePageAsync(requestOptions)); - } - - /** - * The listIntegers operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listIntegersSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listIntegersSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), null, null); - } - - /** - * The listIntegers operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listIntegers(RequestOptions requestOptions) { - return new PagedIterable<>(() -> listIntegersSinglePage(requestOptions)); - } - - /** - * The getJsonUtf8Response operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getJsonUtf8ResponseWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json;charset=utf-8"; - return FluxUtil - .withContext(context -> service.getJsonUtf8Response(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getJsonUtf8Response operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getJsonUtf8ResponseWithResponse(RequestOptions requestOptions) { - final String accept = "application/json;charset=utf-8"; - return service.getJsonUtf8ResponseSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getPlusJsonResponse operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getPlusJsonResponseWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/vnd.microsoft.appconfig.kv+json"; - return FluxUtil - .withContext(context -> service.getPlusJsonResponse(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getPlusJsonResponse operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getPlusJsonResponseWithResponse(RequestOptions requestOptions) { - final String accept = "application/vnd.microsoft.appconfig.kv+json"; - return service.getPlusJsonResponseSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getUnionResponse operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param accept The accept parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getUnionResponseWithResponseAsync(String accept, RequestOptions requestOptions) { - return FluxUtil - .withContext(context -> service.getUnionResponse(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getUnionResponse operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param accept The accept parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getUnionResponseWithResponse(String accept, RequestOptions requestOptions) { - return service.getUnionResponseSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getTextBoolean operation. - *

Response Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return boolean with `true` and `false` values along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextBooleanWithResponseAsync(RequestOptions requestOptions) { - final String accept = "text/plain"; - return FluxUtil - .withContext(context -> service.getTextBoolean(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getTextBoolean operation. - *

Response Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return boolean with `true` and `false` values along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextBooleanWithResponse(RequestOptions requestOptions) { - final String accept = "text/plain"; - return service.getTextBooleanSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getTextByte operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 8-bit integer along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextByteWithResponseAsync(RequestOptions requestOptions) { - final String accept = "text/plain"; - return FluxUtil - .withContext(context -> service.getTextByte(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getTextByte operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 8-bit integer along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextByteWithResponse(RequestOptions requestOptions) { - final String accept = "text/plain"; - return service.getTextByteSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getTextInt32 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 32-bit integer along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextInt32WithResponseAsync(RequestOptions requestOptions) { - final String accept = "text/plain"; - return FluxUtil - .withContext(context -> service.getTextInt32(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getTextInt32 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 32-bit integer along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextInt32WithResponse(RequestOptions requestOptions) { - final String accept = "text/plain"; - return service.getTextInt32Sync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getTextInt64 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * long
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 64-bit integer along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextInt64WithResponseAsync(RequestOptions requestOptions) { - final String accept = "text/plain"; - return FluxUtil - .withContext(context -> service.getTextInt64(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getTextInt64 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * long
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 64-bit integer along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextInt64WithResponse(RequestOptions requestOptions) { - final String accept = "text/plain"; - return service.getTextInt64Sync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getTextFloat32 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * double
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 32 bit floating point number along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextFloat32WithResponseAsync(RequestOptions requestOptions) { - final String accept = "text/plain"; - return FluxUtil - .withContext(context -> service.getTextFloat32(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getTextFloat32 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * double
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 32 bit floating point number along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextFloat32WithResponse(RequestOptions requestOptions) { - final String accept = "text/plain"; - return service.getTextFloat32Sync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getTextFloat64 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * double
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 64 bit floating point number along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextFloat64WithResponseAsync(RequestOptions requestOptions) { - final String accept = "text/plain"; - return FluxUtil - .withContext(context -> service.getTextFloat64(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getTextFloat64 operation. - *

Response Body Schema

- * - *
-     * {@code
-     * double
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 64 bit floating point number along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextFloat64WithResponse(RequestOptions requestOptions) { - final String accept = "text/plain"; - return service.getTextFloat64Sync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getTextChar operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 16-bit integer along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getTextCharWithResponseAsync(RequestOptions requestOptions) { - final String accept = "text/plain"; - return FluxUtil - .withContext(context -> service.getTextChar(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getTextChar operation. - *

Response Body Schema

- * - *
-     * {@code
-     * int
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 16-bit integer along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getTextCharWithResponse(RequestOptions requestOptions) { - final String accept = "text/plain"; - return service.getTextCharSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listStringsNextSinglePageAsync(String nextLink, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listStringsNext(nextLink, this.getEndpoint(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "items_value"), getNextLink(res.getValue(), "next_link"), null)); - } - - /** - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listStringsNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listStringsNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "items_value"), getNextLink(res.getValue(), "next_link"), null); - } - - private List getValues(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - List values = (List) obj.get(path); - return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); - } catch (RuntimeException e) { - return null; - } - } - - private String getNextLink(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - return (String) obj.get(path); - } catch (RuntimeException e) { - return null; - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/SyncOperationLocationPollingStrategy.java deleted file mode 100644 index 68ea8b4c5c3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/SyncOperationLocationPollingStrategy.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.io.UncheckedIOException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Map; - -// DO NOT modify this helper class - -/** - * Implements a synchronous operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public PollResponse onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - T initialResponseType = null; - try { - initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, - pollResponseType); - } catch (UncheckedIOException e) { - LOGGER.info("Failed to parse initial response."); - } - return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); - } - - throw LOGGER.logExceptionAsError(new AzureException( - String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - - /** - * {@inheritDoc} - */ - public U getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, - PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); - if (pollResult != null && pollResult.get(propertyName) != null) { - return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), - serializer, resultType); - } else { - throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); - } - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/package-info.java deleted file mode 100644 index db3f252ed91..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Response. - * - */ -package tsptest.response.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails1.java deleted file mode 100644 index a914094f85f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails1.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.models.ResponseError; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The OperationDetails1 model. - */ -@Immutable -public final class OperationDetails1 implements JsonSerializable { - /* - * Operation ID - */ - @Generated - private final String operationId; - - /* - * The status property. - */ - @Generated - private final OperationState status; - - /* - * The error property. - */ - @Generated - private ResponseError error; - - /* - * The result property. - */ - @Generated - private Resource result; - - /** - * Creates an instance of OperationDetails1 class. - * - * @param operationId the operationId value to set. - * @param status the status value to set. - */ - @Generated - private OperationDetails1(String operationId, OperationState status) { - this.operationId = operationId; - this.status = status; - } - - /** - * Get the operationId property: Operation ID. - * - * @return the operationId value. - */ - @Generated - public String getOperationId() { - return this.operationId; - } - - /** - * Get the status property: The status property. - * - * @return the status value. - */ - @Generated - public OperationState getStatus() { - return this.status; - } - - /** - * Get the error property: The error property. - * - * @return the error value. - */ - @Generated - public ResponseError getError() { - return this.error; - } - - /** - * Get the result property: The result property. - * - * @return the result value. - */ - @Generated - public Resource getResult() { - return this.result; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("operationId", this.operationId); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); - jsonWriter.writeJsonField("error", this.error); - jsonWriter.writeJsonField("result", this.result); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationDetails1 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationDetails1 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OperationDetails1. - */ - @Generated - public static OperationDetails1 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String operationId = null; - OperationState status = null; - ResponseError error = null; - Resource result = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("operationId".equals(fieldName)) { - operationId = reader.getString(); - } else if ("status".equals(fieldName)) { - status = OperationState.fromString(reader.getString()); - } else if ("error".equals(fieldName)) { - error = ResponseError.fromJson(reader); - } else if ("result".equals(fieldName)) { - result = Resource.fromJson(reader); - } else { - reader.skipChildren(); - } - } - OperationDetails1 deserializedOperationDetails1 = new OperationDetails1(operationId, status); - deserializedOperationDetails1.error = error; - deserializedOperationDetails1.result = result; - - return deserializedOperationDetails1; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails2.java deleted file mode 100644 index c5707130ba9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails2.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.models.ResponseError; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The OperationDetails2 model. - */ -@Immutable -public final class OperationDetails2 implements JsonSerializable { - /* - * Operation ID - */ - @Generated - private final String id; - - /* - * The status property. - */ - @Generated - private final OperationState status; - - /* - * The error property. - */ - @Generated - private ResponseError error; - - /* - * The lro_result property. - */ - @Generated - private Resource longRunningResult; - - /** - * Creates an instance of OperationDetails2 class. - * - * @param id the id value to set. - * @param status the status value to set. - */ - @Generated - private OperationDetails2(String id, OperationState status) { - this.id = id; - this.status = status; - } - - /** - * Get the id property: Operation ID. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the status property: The status property. - * - * @return the status value. - */ - @Generated - public OperationState getStatus() { - return this.status; - } - - /** - * Get the error property: The error property. - * - * @return the error value. - */ - @Generated - public ResponseError getError() { - return this.error; - } - - /** - * Get the longRunningResult property: The lro_result property. - * - * @return the longRunningResult value. - */ - @Generated - public Resource getLongRunningResult() { - return this.longRunningResult; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); - jsonWriter.writeJsonField("error", this.error); - jsonWriter.writeJsonField("lro_result", this.longRunningResult); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OperationDetails2 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OperationDetails2 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OperationDetails2. - */ - @Generated - public static OperationDetails2 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - OperationState status = null; - ResponseError error = null; - Resource longRunningResult = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("status".equals(fieldName)) { - status = OperationState.fromString(reader.getString()); - } else if ("error".equals(fieldName)) { - error = ResponseError.fromJson(reader); - } else if ("lro_result".equals(fieldName)) { - longRunningResult = Resource.fromJson(reader); - } else { - reader.skipChildren(); - } - } - OperationDetails2 deserializedOperationDetails2 = new OperationDetails2(id, status); - deserializedOperationDetails2.error = error; - deserializedOperationDetails2.longRunningResult = longRunningResult; - - return deserializedOperationDetails2; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationState.java deleted file mode 100644 index cd2df7f2cfa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationState.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Enum describing allowed operation states. - */ -public final class OperationState extends ExpandableStringEnum { - /** - * The operation has not started. - */ - @Generated - public static final OperationState NOT_STARTED = fromString("NotStarted"); - - /** - * The operation is in progress. - */ - @Generated - public static final OperationState RUNNING = fromString("Running"); - - /** - * The operation has completed successfully. - */ - @Generated - public static final OperationState SUCCEEDED = fromString("Succeeded"); - - /** - * The operation has failed. - */ - @Generated - public static final OperationState FAILED = fromString("Failed"); - - /** - * The operation has been canceled by the user. - */ - @Generated - public static final OperationState CANCELED = fromString("Canceled"); - - /** - * Creates a new instance of OperationState value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public OperationState() { - } - - /** - * Creates or finds a OperationState from its string representation. - * - * @param name a name to look for. - * @return the corresponding OperationState. - */ - @Generated - public static OperationState fromString(String name) { - return fromString(name, OperationState.class); - } - - /** - * Gets known OperationState values. - * - * @return known OperationState values. - */ - @Generated - public static Collection values() { - return values(OperationState.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/Resource.java deleted file mode 100644 index 491f6379f64..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/Resource.java +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Resource model. - */ -@Fluent -public final class Resource implements JsonSerializable { - /* - * The id property. - */ - @Generated - private String id; - - /* - * The name property. - */ - @Generated - private String name; - - /* - * The description property. - */ - @Generated - private String description; - - /* - * The type property. - */ - @Generated - private final String type; - - /** - * Creates an instance of Resource class. - * - * @param type the type value to set. - */ - @Generated - public Resource(String type) { - this.type = type; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the description property: The description property. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * Set the description property: The description property. - * - * @param description the description value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setDescription(String description) { - this.description = description; - return this; - } - - /** - * Get the type property: The type property. - * - * @return the type value. - */ - @Generated - public String getType() { - return this.type; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("type", this.type); - jsonWriter.writeStringField("description", this.description); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Resource from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Resource. - */ - @Generated - public static Resource fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String name = null; - String type = null; - String description = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("type".equals(fieldName)) { - type = reader.getString(); - } else if ("description".equals(fieldName)) { - description = reader.getString(); - } else { - reader.skipChildren(); - } - } - Resource deserializedResource = new Resource(type); - deserializedResource.id = id; - deserializedResource.name = name; - deserializedResource.description = description; - - return deserializedResource; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/package-info.java deleted file mode 100644 index 72aca7010fb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Response. - * - */ -package tsptest.response.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/package-info.java deleted file mode 100644 index b7cf31c9fc9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Response. - * - */ -package tsptest.response; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsAsyncClient.java deleted file mode 100644 index e79f25dca45..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsAsyncClient.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialchars; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.specialchars.implementation.BuiltinOpsImpl; -import tsptest.specialchars.implementation.models.ReadRequest; -import tsptest.specialchars.models.Resource; - -/** - * Initializes a new instance of the asynchronous SpecialCharsClient type. - */ -@ServiceClient(builder = SpecialCharsClientBuilder.class, isAsync = true) -public final class SpecialCharsAsyncClient { - @Generated - private final BuiltinOpsImpl serviceClient; - - /** - * Initializes an instance of SpecialCharsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpecialCharsAsyncClient(BuiltinOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The read operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     aggregate: String (Optional)
-     *     condition: String (Optional)
-     *     requestName: String (Optional)
-     *     value: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param readRequest The readRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> readWithResponse(BinaryData readRequest, RequestOptions requestOptions) { - return this.serviceClient.readWithResponseAsync(readRequest, requestOptions); - } - - /** - * The read operation. - * - * @param id The id parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono read(String id) { - // Generated convenience method for readWithResponse - RequestOptions requestOptions = new RequestOptions(); - ReadRequest readRequestObj = new ReadRequest(id); - BinaryData readRequest = BinaryData.fromObject(readRequestObj); - return readWithResponse(readRequest, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClient.java deleted file mode 100644 index d2aa4383b92..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClient.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialchars; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.specialchars.implementation.BuiltinOpsImpl; -import tsptest.specialchars.implementation.models.ReadRequest; -import tsptest.specialchars.models.Resource; - -/** - * Initializes a new instance of the synchronous SpecialCharsClient type. - */ -@ServiceClient(builder = SpecialCharsClientBuilder.class) -public final class SpecialCharsClient { - @Generated - private final BuiltinOpsImpl serviceClient; - - /** - * Initializes an instance of SpecialCharsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpecialCharsClient(BuiltinOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The read operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     aggregate: String (Optional)
-     *     condition: String (Optional)
-     *     requestName: String (Optional)
-     *     value: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param readRequest The readRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response readWithResponse(BinaryData readRequest, RequestOptions requestOptions) { - return this.serviceClient.readWithResponse(readRequest, requestOptions); - } - - /** - * The read operation. - * - * @param id The id parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource read(String id) { - // Generated convenience method for readWithResponse - RequestOptions requestOptions = new RequestOptions(); - ReadRequest readRequestObj = new ReadRequest(id); - BinaryData readRequest = BinaryData.fromObject(readRequestObj); - return readWithResponse(readRequest, requestOptions).getValue().toObject(Resource.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClientBuilder.java deleted file mode 100644 index 47f6dcf6fb6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialchars; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.specialchars.implementation.SpecialCharsClientImpl; - -/** - * A builder for creating a new instance of the SpecialCharsClient type. - */ -@ServiceClientBuilder(serviceClients = { SpecialCharsClient.class, SpecialCharsAsyncClient.class }) -public final class SpecialCharsClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-specialchars.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the SpecialCharsClientBuilder. - */ - @Generated - public SpecialCharsClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialCharsClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialCharsClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialCharsClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialCharsClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialCharsClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialCharsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialCharsClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialCharsClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the SpecialCharsClientBuilder. - */ - @Generated - public SpecialCharsClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of SpecialCharsClientImpl with the provided parameters. - * - * @return an instance of SpecialCharsClientImpl. - */ - @Generated - private SpecialCharsClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - SpecialCharsClientImpl client - = new SpecialCharsClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of SpecialCharsAsyncClient class. - * - * @return an instance of SpecialCharsAsyncClient. - */ - @Generated - public SpecialCharsAsyncClient buildAsyncClient() { - return new SpecialCharsAsyncClient(buildInnerClient().getBuiltinOps()); - } - - /** - * Builds an instance of SpecialCharsClient class. - * - * @return an instance of SpecialCharsClient. - */ - @Generated - public SpecialCharsClient buildClient() { - return new SpecialCharsClient(buildInnerClient().getBuiltinOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(SpecialCharsClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/BuiltinOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/BuiltinOpsImpl.java deleted file mode 100644 index 47b41b90c7b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/BuiltinOpsImpl.java +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialchars.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in BuiltinOps. - */ -public final class BuiltinOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BuiltinOpsService service; - - /** - * The service client containing this operation class. - */ - private final SpecialCharsClientImpl client; - - /** - * Initializes an instance of BuiltinOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BuiltinOpsImpl(SpecialCharsClientImpl client) { - this.service - = RestProxy.create(BuiltinOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for SpecialCharsClientBuiltinOps to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SpecialCharsClientBuiltinOps") - public interface BuiltinOpsService { - @Post("/specialchars") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> read(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData readRequest, RequestOptions requestOptions, Context context); - - @Post("/specialchars") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response readSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData readRequest, RequestOptions requestOptions, Context context); - } - - /** - * The read operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     aggregate: String (Optional)
-     *     condition: String (Optional)
-     *     requestName: String (Optional)
-     *     value: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param readRequest The readRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> readWithResponseAsync(BinaryData readRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.read(this.client.getEndpoint(), contentType, accept, readRequest, - requestOptions, context)); - } - - /** - * The read operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     aggregate: String (Optional)
-     *     condition: String (Optional)
-     *     requestName: String (Optional)
-     *     value: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param readRequest The readRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response readWithResponse(BinaryData readRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.readSync(this.client.getEndpoint(), contentType, accept, readRequest, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/SpecialCharsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/SpecialCharsClientImpl.java deleted file mode 100644 index 7a24855e804..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/SpecialCharsClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialchars.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 SpecialCharsClient type. - */ -public final class SpecialCharsClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 BuiltinOpsImpl object to access its operations. - */ - private final BuiltinOpsImpl builtinOps; - - /** - * Gets the BuiltinOpsImpl object to access its operations. - * - * @return the BuiltinOpsImpl object. - */ - public BuiltinOpsImpl getBuiltinOps() { - return this.builtinOps; - } - - /** - * Initializes an instance of SpecialCharsClient client. - * - * @param endpoint Service host. - */ - public SpecialCharsClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of SpecialCharsClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public SpecialCharsClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of SpecialCharsClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public SpecialCharsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.builtinOps = new BuiltinOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/ReadRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/ReadRequest.java deleted file mode 100644 index 73b3d51ab47..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/ReadRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialchars.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ReadRequest model. - */ -@Immutable -public final class ReadRequest implements JsonSerializable { - /* - * The id property. - */ - @Generated - private final String id; - - /** - * Creates an instance of ReadRequest class. - * - * @param id the id value to set. - */ - @Generated - public ReadRequest(String id) { - this.id = id; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ReadRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ReadRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ReadRequest. - */ - @Generated - public static ReadRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ReadRequest(id); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/package-info.java deleted file mode 100644 index 3e12aa15a44..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for SpecialChars. - * - */ -package tsptest.specialchars.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/package-info.java deleted file mode 100644 index f15c44ed1c1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for SpecialChars. - * - */ -package tsptest.specialchars.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/Resource.java deleted file mode 100644 index cf656e77475..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/Resource.java +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialchars.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Resource model. - */ -@Immutable -public final class Resource implements JsonSerializable { - /* - * id - */ - @Generated - private final String id; - - /* - * The aggregation function to be applied on the client metric. Allowed functions - * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, - * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, - * ‘count’ - for requests - */ - @Generated - private String aggregate; - - /* - * The comparison operator. Supported types ‘>’, ‘<’ - */ - @Generated - private String condition; - - /* - * Request name for which the Pass fail criteria has to be applied - */ - @Generated - private String requestName; - - /* - * The value to compare with the client metric. Allowed values - ‘error : [0.0 , - * 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. - */ - @Generated - private Double value; - - /** - * Creates an instance of Resource class. - * - * @param id the id value to set. - */ - @Generated - private Resource(String id) { - this.id = id; - } - - /** - * Get the id property: id. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the aggregate property: The aggregation function to be applied on the client metric. Allowed functions - * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, - * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, - * ‘count’ - for requests. - * - * @return the aggregate value. - */ - @Generated - public String getAggregate() { - return this.aggregate; - } - - /** - * Get the condition property: The comparison operator. Supported types ‘>’, ‘<’. - * - * @return the condition value. - */ - @Generated - public String getCondition() { - return this.condition; - } - - /** - * Get the requestName property: Request name for which the Pass fail criteria has to be applied. - * - * @return the requestName value. - */ - @Generated - public String getRequestName() { - return this.requestName; - } - - /** - * Get the value property: The value to compare with the client metric. Allowed values - ‘error : [0.0 , - * 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. - * - * @return the value value. - */ - @Generated - public Double getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - jsonWriter.writeStringField("aggregate", this.aggregate); - jsonWriter.writeStringField("condition", this.condition); - jsonWriter.writeStringField("requestName", this.requestName); - jsonWriter.writeNumberField("value", this.value); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Resource from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Resource. - */ - @Generated - public static Resource fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String aggregate = null; - String condition = null; - String requestName = null; - Double value = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("aggregate".equals(fieldName)) { - aggregate = reader.getString(); - } else if ("condition".equals(fieldName)) { - condition = reader.getString(); - } else if ("requestName".equals(fieldName)) { - requestName = reader.getString(); - } else if ("value".equals(fieldName)) { - value = reader.getNullable(JsonReader::getDouble); - } else { - reader.skipChildren(); - } - } - Resource deserializedResource = new Resource(id); - deserializedResource.aggregate = aggregate; - deserializedResource.condition = condition; - deserializedResource.requestName = requestName; - deserializedResource.value = value; - - return deserializedResource; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/package-info.java deleted file mode 100644 index 6c520940f53..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for SpecialChars. - * - */ -package tsptest.specialchars.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/package-info.java deleted file mode 100644 index 92732d72a4d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for SpecialChars. - * - */ -package tsptest.specialchars; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java deleted file mode 100644 index 53664e65642..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java +++ /dev/null @@ -1,349 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.MatchConditions; -import com.azure.core.http.RequestConditions; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.FluxUtil; -import java.time.OffsetDateTime; -import java.util.stream.Collectors; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import tsptest.specialheaders.implementation.EtagHeadersImpl; -import tsptest.specialheaders.implementation.JsonMergePatchHelper; -import tsptest.specialheaders.models.Resource; - -/** - * Initializes a new instance of the asynchronous SpecialHeadersClient type. - */ -@ServiceClient(builder = SpecialHeadersClientBuilder.class, isAsync = true) -public final class EtagHeadersAsyncClient { - @Generated - private final EtagHeadersImpl serviceClient; - - /** - * Initializes an instance of EtagHeadersAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EtagHeadersAsyncClient(EtagHeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Create or replace operation template. - *

Header Parameters

- * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the - * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity - * was modified after this time.
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithRequestHeadersWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.putWithRequestHeadersWithResponseAsync(name, resource, requestOptions); - } - - /** - * Create or update operation template. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchWithMatchHeadersWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.patchWithMatchHeadersWithResponseAsync(name, resource, requestOptions); - } - - /** - * Resource list operation template. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithEtag(RequestOptions requestOptions) { - return this.serviceClient.listWithEtagAsync(requestOptions); - } - - /** - * Create or replace operation template. - * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestConditions Specifies HTTP options for conditional requests based on modification time. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putWithRequestHeaders(String name, Resource resource, RequestConditions requestConditions) { - // Generated convenience method for putWithRequestHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * Create or replace operation template. - * - * @param name The name parameter. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putWithRequestHeaders(String name, Resource resource) { - // Generated convenience method for putWithRequestHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestOptions) - .flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * Create or update operation template. - * - * @param name The name parameter. - * @param resource The resource instance. - * @param matchConditions Specifies HTTP options for conditional requests. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchWithMatchHeaders(String name, Resource resource, MatchConditions matchConditions) { - // Generated convenience method for patchWithMatchHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - String ifMatch = matchConditions == null ? null : matchConditions.getIfMatch(); - String ifNoneMatch = matchConditions == null ? null : matchConditions.getIfNoneMatch(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); - BinaryData resourceInBinaryData = BinaryData.fromObject(resource); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - resourceInBinaryData.getLength(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * Create or update operation template. - * - * @param name The name parameter. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchWithMatchHeaders(String name, Resource resource) { - // Generated convenience method for patchWithMatchHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); - BinaryData resourceInBinaryData = BinaryData.fromObject(resource); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - resourceInBinaryData.getLength(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * Resource list operation template. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of Resource items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithEtag() { - // Generated convenience method for listWithEtag - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = listWithEtag(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersClient.java deleted file mode 100644 index 0516e1fd481..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersClient.java +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.MatchConditions; -import com.azure.core.http.RequestConditions; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; -import tsptest.specialheaders.implementation.EtagHeadersImpl; -import tsptest.specialheaders.implementation.JsonMergePatchHelper; -import tsptest.specialheaders.models.Resource; - -/** - * Initializes a new instance of the synchronous SpecialHeadersClient type. - */ -@ServiceClient(builder = SpecialHeadersClientBuilder.class) -public final class EtagHeadersClient { - @Generated - private final EtagHeadersImpl serviceClient; - - /** - * Initializes an instance of EtagHeadersClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EtagHeadersClient(EtagHeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Create or replace operation template. - *

Header Parameters

- * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the - * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity - * was modified after this time.
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithRequestHeadersWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.putWithRequestHeadersWithResponse(name, resource, requestOptions); - } - - /** - * Create or update operation template. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchWithMatchHeadersWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.patchWithMatchHeadersWithResponse(name, resource, requestOptions); - } - - /** - * Resource list operation template. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithEtag(RequestOptions requestOptions) { - return this.serviceClient.listWithEtag(requestOptions); - } - - /** - * Create or replace operation template. - * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestConditions Specifies HTTP options for conditional requests based on modification time. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource putWithRequestHeaders(String name, Resource resource, RequestConditions requestConditions) { - // Generated convenience method for putWithRequestHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestOptions).getValue() - .toObject(Resource.class); - } - - /** - * Create or replace operation template. - * - * @param name The name parameter. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource putWithRequestHeaders(String name, Resource resource) { - // Generated convenience method for putWithRequestHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestOptions).getValue() - .toObject(Resource.class); - } - - /** - * Create or update operation template. - * - * @param name The name parameter. - * @param resource The resource instance. - * @param matchConditions Specifies HTTP options for conditional requests. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource patchWithMatchHeaders(String name, Resource resource, MatchConditions matchConditions) { - // Generated convenience method for patchWithMatchHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - String ifMatch = matchConditions == null ? null : matchConditions.getIfMatch(); - String ifNoneMatch = matchConditions == null ? null : matchConditions.getIfNoneMatch(); - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); - BinaryData resourceInBinaryData = BinaryData.fromObject(resource); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - resourceInBinaryData.getLength(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, requestOptions).getValue() - .toObject(Resource.class); - } - - /** - * Create or update operation template. - * - * @param name The name parameter. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource patchWithMatchHeaders(String name, Resource resource) { - // Generated convenience method for patchWithMatchHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); - BinaryData resourceInBinaryData = BinaryData.fromObject(resource); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - resourceInBinaryData.getLength(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, requestOptions).getValue() - .toObject(Resource.class); - } - - /** - * Resource list operation template. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of Resource items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithEtag() { - // Generated convenience method for listWithEtag - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.listWithEtag(requestOptions) - .mapPage(bodyItemValue -> bodyItemValue.toObject(Resource.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java deleted file mode 100644 index 642aeefc0ba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.RequestConditions; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.FluxUtil; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; -import tsptest.specialheaders.implementation.EtagHeadersOptionalBodiesImpl; -import tsptest.specialheaders.models.Resource; - -/** - * Initializes a new instance of the asynchronous SpecialHeadersClient type. - */ -@ServiceClient(builder = SpecialHeadersClientBuilder.class, isAsync = true) -public final class EtagHeadersOptionalBodyAsyncClient { - @Generated - private final EtagHeadersOptionalBodiesImpl serviceClient; - - /** - * Initializes an instance of EtagHeadersOptionalBodyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EtagHeadersOptionalBodyAsyncClient(EtagHeadersOptionalBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * etag headers among other optional query/header/body parameters. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the - * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity - * was modified after this time.
timestampOffsetDateTimeNoThe timestamp parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param format The format parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithOptionalBodyWithResponse(String format, RequestOptions requestOptions) { - return this.serviceClient.putWithOptionalBodyWithResponseAsync(format, requestOptions); - } - - /** - * etag headers among other optional query/header/body parameters. - * - * @param format The format parameter. - * @param filter The filter parameter. - * @param timestamp The timestamp parameter. - * @param body The body parameter. - * @param requestConditions Specifies HTTP options for conditional requests based on modification time. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putWithOptionalBody(String format, String filter, OffsetDateTime timestamp, Resource body, - RequestConditions requestConditions) { - // Generated convenience method for putWithOptionalBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); - if (filter != null) { - requestOptions.addQueryParam("filter", filter, false); - } - if (timestamp != null) { - requestOptions.setHeader(HttpHeaderName.fromString("timestamp"), String.valueOf(timestamp.toEpochSecond())); - } - if (body != null) { - requestOptions.setBody(BinaryData.fromObject(body)); - } - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return putWithOptionalBodyWithResponse(format, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * etag headers among other optional query/header/body parameters. - * - * @param format The format parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putWithOptionalBody(String format) { - // Generated convenience method for putWithOptionalBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithOptionalBodyWithResponse(format, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java deleted file mode 100644 index 5b481b428f2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.RequestConditions; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.DateTimeRfc1123; -import java.time.OffsetDateTime; -import tsptest.specialheaders.implementation.EtagHeadersOptionalBodiesImpl; -import tsptest.specialheaders.models.Resource; - -/** - * Initializes a new instance of the synchronous SpecialHeadersClient type. - */ -@ServiceClient(builder = SpecialHeadersClientBuilder.class) -public final class EtagHeadersOptionalBodyClient { - @Generated - private final EtagHeadersOptionalBodiesImpl serviceClient; - - /** - * Initializes an instance of EtagHeadersOptionalBodyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EtagHeadersOptionalBodyClient(EtagHeadersOptionalBodiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * etag headers among other optional query/header/body parameters. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the - * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity - * was modified after this time.
timestampOffsetDateTimeNoThe timestamp parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param format The format parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithOptionalBodyWithResponse(String format, RequestOptions requestOptions) { - return this.serviceClient.putWithOptionalBodyWithResponse(format, requestOptions); - } - - /** - * etag headers among other optional query/header/body parameters. - * - * @param format The format parameter. - * @param filter The filter parameter. - * @param timestamp The timestamp parameter. - * @param body The body parameter. - * @param requestConditions Specifies HTTP options for conditional requests based on modification time. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource putWithOptionalBody(String format, String filter, OffsetDateTime timestamp, Resource body, - RequestConditions requestConditions) { - // Generated convenience method for putWithOptionalBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); - String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); - OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); - OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); - if (filter != null) { - requestOptions.addQueryParam("filter", filter, false); - } - if (timestamp != null) { - requestOptions.setHeader(HttpHeaderName.fromString("timestamp"), String.valueOf(timestamp.toEpochSecond())); - } - if (body != null) { - requestOptions.setBody(BinaryData.fromObject(body)); - } - if (ifMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); - } - if (ifNoneMatch != null) { - requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); - } - if (ifUnmodifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); - } - if (ifModifiedSince != null) { - requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, - String.valueOf(new DateTimeRfc1123(ifModifiedSince))); - } - return putWithOptionalBodyWithResponse(format, requestOptions).getValue().toObject(Resource.class); - } - - /** - * etag headers among other optional query/header/body parameters. - * - * @param format The format parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource putWithOptionalBody(String format) { - // Generated convenience method for putWithOptionalBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithOptionalBodyWithResponse(format, requestOptions).getValue().toObject(Resource.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersAsyncClient.java deleted file mode 100644 index 3d5ea05399c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersAsyncClient.java +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.PollerFlux; -import reactor.core.publisher.Mono; -import tsptest.specialheaders.implementation.JsonMergePatchHelper; -import tsptest.specialheaders.implementation.RepeatabilityHeadersImpl; -import tsptest.specialheaders.models.Resource; - -/** - * Initializes a new instance of the asynchronous SpecialHeadersClient type. - */ -@ServiceClient(builder = SpecialHeadersClientBuilder.class, isAsync = true) -public final class RepeatabilityHeadersAsyncClient { - @Generated - private final RepeatabilityHeadersImpl serviceClient; - - /** - * Initializes an instance of RepeatabilityHeadersAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RepeatabilityHeadersAsyncClient(RepeatabilityHeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Resource read operation template. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(name, requestOptions); - } - - /** - * Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(String name, BinaryData resource, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(name, resource, requestOptions); - } - - /** - * Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.postWithResponseAsync(name, requestOptions); - } - - /** - * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateLro(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.beginCreateLroAsync(name, resource, requestOptions); - } - - /** - * Resource read operation template. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get(String name) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent. - * - * @param name The name parameter. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(String name, Resource resource) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(name, BinaryData.fromObject(resource), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono post(String name) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); - } - - /** - * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. - * - * @param name The name parameter. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateLro(String name, Resource resource) { - // Generated convenience method for beginCreateLroWithModel - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); - BinaryData resourceInBinaryData = BinaryData.fromObject(resource); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - resourceInBinaryData.getLength(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - return serviceClient.beginCreateLroWithModelAsync(name, resourceInBinaryData, requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersClient.java deleted file mode 100644 index a048aae27d6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersClient.java +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.SyncPoller; -import tsptest.specialheaders.implementation.JsonMergePatchHelper; -import tsptest.specialheaders.implementation.RepeatabilityHeadersImpl; -import tsptest.specialheaders.models.Resource; - -/** - * Initializes a new instance of the synchronous SpecialHeadersClient type. - */ -@ServiceClient(builder = SpecialHeadersClientBuilder.class) -public final class RepeatabilityHeadersClient { - @Generated - private final RepeatabilityHeadersImpl serviceClient; - - /** - * Initializes an instance of RepeatabilityHeadersClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RepeatabilityHeadersClient(RepeatabilityHeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Resource read operation template. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(name, requestOptions); - } - - /** - * Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(String name, BinaryData resource, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(name, resource, requestOptions); - } - - /** - * Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postWithResponse(String name, RequestOptions requestOptions) { - return this.serviceClient.postWithResponse(name, requestOptions); - } - - /** - * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateLro(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.beginCreateLro(name, resource, requestOptions); - } - - /** - * Resource read operation template. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource get(String name) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(name, requestOptions).getValue().toObject(Resource.class); - } - - /** - * Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent. - * - * @param name The name parameter. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource put(String name, Resource resource) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(name, BinaryData.fromObject(resource), requestOptions).getValue() - .toObject(Resource.class); - } - - /** - * Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Resource post(String name) { - // Generated convenience method for postWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postWithResponse(name, requestOptions).getValue().toObject(Resource.class); - } - - /** - * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. - * - * @param name The name parameter. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateLro(String name, Resource resource) { - // Generated convenience method for beginCreateLroWithModel - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); - BinaryData resourceInBinaryData = BinaryData.fromObject(resource); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - resourceInBinaryData.getLength(); - JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); - return serviceClient.beginCreateLroWithModel(name, resourceInBinaryData, requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersAsyncClient.java deleted file mode 100644 index 651aa833745..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersAsyncClient.java +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.specialheaders.implementation.SkipSpecialHeadersImpl; - -/** - * Initializes a new instance of the asynchronous SpecialHeadersClient type. - */ -@ServiceClient(builder = SpecialHeadersClientBuilder.class, isAsync = true) -public final class SkipSpecialHeadersAsyncClient { - @Generated - private final SkipSpecialHeadersImpl serviceClient; - - /** - * Initializes an instance of SkipSpecialHeadersAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SkipSpecialHeadersAsyncClient(SkipSpecialHeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * skip special headers. - * - * @param name The name parameter. - * @param foo The foo parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithSpecialHeadersWithResponse(String name, String foo, - RequestOptions requestOptions) { - return this.serviceClient.deleteWithSpecialHeadersWithResponseAsync(name, foo, requestOptions); - } - - /** - * skip special headers. - * - * @param name The name parameter. - * @param foo The foo parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteWithSpecialHeaders(String name, String foo) { - // Generated convenience method for deleteWithSpecialHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - return deleteWithSpecialHeadersWithResponse(name, foo, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersClient.java deleted file mode 100644 index abc06cb3c5a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersClient.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import tsptest.specialheaders.implementation.SkipSpecialHeadersImpl; - -/** - * Initializes a new instance of the synchronous SpecialHeadersClient type. - */ -@ServiceClient(builder = SpecialHeadersClientBuilder.class) -public final class SkipSpecialHeadersClient { - @Generated - private final SkipSpecialHeadersImpl serviceClient; - - /** - * Initializes an instance of SkipSpecialHeadersClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SkipSpecialHeadersClient(SkipSpecialHeadersImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * skip special headers. - * - * @param name The name parameter. - * @param foo The foo parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithSpecialHeadersWithResponse(String name, String foo, RequestOptions requestOptions) { - return this.serviceClient.deleteWithSpecialHeadersWithResponse(name, foo, requestOptions); - } - - /** - * skip special headers. - * - * @param name The name parameter. - * @param foo The foo parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteWithSpecialHeaders(String name, String foo) { - // Generated convenience method for deleteWithSpecialHeadersWithResponse - RequestOptions requestOptions = new RequestOptions(); - deleteWithSpecialHeadersWithResponse(name, foo, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersClientBuilder.java deleted file mode 100644 index 2ff09e435ba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersClientBuilder.java +++ /dev/null @@ -1,376 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.specialheaders.implementation.SpecialHeadersClientImpl; - -/** - * A builder for creating a new instance of the SpecialHeadersClient type. - */ -@ServiceClientBuilder( - serviceClients = { - RepeatabilityHeadersClient.class, - EtagHeadersClient.class, - EtagHeadersOptionalBodyClient.class, - SkipSpecialHeadersClient.class, - RepeatabilityHeadersAsyncClient.class, - EtagHeadersAsyncClient.class, - EtagHeadersOptionalBodyAsyncClient.class, - SkipSpecialHeadersAsyncClient.class }) -public final class SpecialHeadersClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-specialheaders.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the SpecialHeadersClientBuilder. - */ - @Generated - public SpecialHeadersClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialHeadersClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialHeadersClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialHeadersClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialHeadersClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialHeadersClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialHeadersClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialHeadersClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SpecialHeadersClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private SpecialHeadersServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the SpecialHeadersClientBuilder. - */ - @Generated - public SpecialHeadersClientBuilder serviceVersion(SpecialHeadersServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the SpecialHeadersClientBuilder. - */ - @Generated - public SpecialHeadersClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of SpecialHeadersClientImpl with the provided parameters. - * - * @return an instance of SpecialHeadersClientImpl. - */ - @Generated - private SpecialHeadersClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - SpecialHeadersServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : SpecialHeadersServiceVersion.getLatest(); - SpecialHeadersClientImpl client = new SpecialHeadersClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy("client-request-id")); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of RepeatabilityHeadersAsyncClient class. - * - * @return an instance of RepeatabilityHeadersAsyncClient. - */ - @Generated - public RepeatabilityHeadersAsyncClient buildRepeatabilityHeadersAsyncClient() { - return new RepeatabilityHeadersAsyncClient(buildInnerClient().getRepeatabilityHeaders()); - } - - /** - * Builds an instance of EtagHeadersAsyncClient class. - * - * @return an instance of EtagHeadersAsyncClient. - */ - @Generated - public EtagHeadersAsyncClient buildEtagHeadersAsyncClient() { - return new EtagHeadersAsyncClient(buildInnerClient().getEtagHeaders()); - } - - /** - * Builds an instance of EtagHeadersOptionalBodyAsyncClient class. - * - * @return an instance of EtagHeadersOptionalBodyAsyncClient. - */ - @Generated - public EtagHeadersOptionalBodyAsyncClient buildEtagHeadersOptionalBodyAsyncClient() { - return new EtagHeadersOptionalBodyAsyncClient(buildInnerClient().getEtagHeadersOptionalBodies()); - } - - /** - * Builds an instance of SkipSpecialHeadersAsyncClient class. - * - * @return an instance of SkipSpecialHeadersAsyncClient. - */ - @Generated - public SkipSpecialHeadersAsyncClient buildSkipSpecialHeadersAsyncClient() { - return new SkipSpecialHeadersAsyncClient(buildInnerClient().getSkipSpecialHeaders()); - } - - /** - * Builds an instance of RepeatabilityHeadersClient class. - * - * @return an instance of RepeatabilityHeadersClient. - */ - @Generated - public RepeatabilityHeadersClient buildRepeatabilityHeadersClient() { - return new RepeatabilityHeadersClient(buildInnerClient().getRepeatabilityHeaders()); - } - - /** - * Builds an instance of EtagHeadersClient class. - * - * @return an instance of EtagHeadersClient. - */ - @Generated - public EtagHeadersClient buildEtagHeadersClient() { - return new EtagHeadersClient(buildInnerClient().getEtagHeaders()); - } - - /** - * Builds an instance of EtagHeadersOptionalBodyClient class. - * - * @return an instance of EtagHeadersOptionalBodyClient. - */ - @Generated - public EtagHeadersOptionalBodyClient buildEtagHeadersOptionalBodyClient() { - return new EtagHeadersOptionalBodyClient(buildInnerClient().getEtagHeadersOptionalBodies()); - } - - /** - * Builds an instance of SkipSpecialHeadersClient class. - * - * @return an instance of SkipSpecialHeadersClient. - */ - @Generated - public SkipSpecialHeadersClient buildSkipSpecialHeadersClient() { - return new SkipSpecialHeadersClient(buildInnerClient().getSkipSpecialHeaders()); - } - - private static final ClientLogger LOGGER = new ClientLogger(SpecialHeadersClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersServiceVersion.java deleted file mode 100644 index d17a9bfd3a2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of SpecialHeadersClient. - */ -public enum SpecialHeadersServiceVersion implements ServiceVersion { - /** - * Enum value 2022-06-01-preview. - */ - V2022_06_01_PREVIEW("2022-06-01-preview"); - - private final String version; - - SpecialHeadersServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link SpecialHeadersServiceVersion}. - */ - public static SpecialHeadersServiceVersion getLatest() { - return V2022_06_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java deleted file mode 100644 index 813a1223c10..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java +++ /dev/null @@ -1,615 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -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.RequestOptions; -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; -import tsptest.specialheaders.SpecialHeadersServiceVersion; - -/** - * An instance of this class provides access to all the operations defined in EtagHeaders. - */ -public final class EtagHeadersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final EtagHeadersService service; - - /** - * The service client containing this operation class. - */ - private final SpecialHeadersClientImpl client; - - /** - * Initializes an instance of EtagHeadersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - EtagHeadersImpl(SpecialHeadersClientImpl client) { - this.service - = RestProxy.create(EtagHeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public SpecialHeadersServiceVersion getServiceVersion() { - return client.getServiceVersion(); - } - - /** - * The interface defining all the services for SpecialHeadersClientEtagHeaders to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SpecialHeadersClientEtagHeaders") - public interface EtagHeadersService { - @Put("/etag-headers/resources/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putWithRequestHeaders(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); - - @Put("/etag-headers/resources/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putWithRequestHeadersSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); - - @Patch("/etag-headers/resources/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchWithMatchHeaders(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, - Context context); - - @Patch("/etag-headers/resources/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchWithMatchHeadersSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, - Context context); - - @Get("/etag-headers/resources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listWithEtag(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/etag-headers/resources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listWithEtagSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listWithEtagNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listWithEtagNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * Create or replace operation template. - *

Header Parameters

- * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the - * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity - * was modified after this time.
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithRequestHeadersWithResponseAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.putWithRequestHeaders(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, - context)); - } - - /** - * Create or replace operation template. - *

Header Parameters

- * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the - * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity - * was modified after this time.
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithRequestHeadersWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putWithRequestHeadersSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, - Context.NONE); - } - - /** - * Create or update operation template. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchWithMatchHeadersWithResponseAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.patchWithMatchHeaders(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, - context)); - } - - /** - * Create or update operation template. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchWithMatchHeadersWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - return service.patchWithMatchHeadersSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, - Context.NONE); - } - - /** - * Resource list operation template. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithEtagSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listWithEtag(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * Resource list operation template. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listWithEtagAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listWithEtagSinglePageAsync(requestOptions), - nextLink -> listWithEtagNextSinglePageAsync(nextLink, requestOptionsForNextPage)); - } - - /** - * Resource list operation template. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listWithEtagSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listWithEtagSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * Resource list operation template. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listWithEtag(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listWithEtagSinglePage(requestOptions), - nextLink -> listWithEtagNextSinglePage(nextLink, requestOptionsForNextPage)); - } - - /** - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithEtagNextSinglePageAsync(String nextLink, - RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.listWithEtagNext(nextLink, this.client.getEndpoint(), 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
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listWithEtagNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listWithEtagNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - private List getValues(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - List values = (List) obj.get(path); - return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); - } catch (RuntimeException e) { - return null; - } - } - - private String getNextLink(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - return (String) obj.get(path); - } catch (RuntimeException e) { - return null; - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java deleted file mode 100644 index 479f4d90c6b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; -import tsptest.specialheaders.SpecialHeadersServiceVersion; - -/** - * An instance of this class provides access to all the operations defined in EtagHeadersOptionalBodies. - */ -public final class EtagHeadersOptionalBodiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final EtagHeadersOptionalBodiesService service; - - /** - * The service client containing this operation class. - */ - private final SpecialHeadersClientImpl client; - - /** - * Initializes an instance of EtagHeadersOptionalBodiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - EtagHeadersOptionalBodiesImpl(SpecialHeadersClientImpl client) { - this.service = RestProxy.create(EtagHeadersOptionalBodiesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public SpecialHeadersServiceVersion getServiceVersion() { - return client.getServiceVersion(); - } - - /** - * The interface defining all the services for SpecialHeadersClientEtagHeadersOptionalBodies to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SpecialHeadersClientEtagHeadersOptionalBodies") - public interface EtagHeadersOptionalBodiesService { - @Put("/etag-headers-optional-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putWithOptionalBody(@HostParam("endpoint") String endpoint, - @QueryParam("format") String format, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Put("/etag-headers-optional-body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putWithOptionalBodySync(@HostParam("endpoint") String endpoint, - @QueryParam("format") String format, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * etag headers among other optional query/header/body parameters. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the - * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity - * was modified after this time.
timestampOffsetDateTimeNoThe timestamp parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param format The format parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithOptionalBodyWithResponseAsync(String format, - RequestOptions requestOptions) { - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - return FluxUtil.withContext(context -> service.putWithOptionalBody(this.client.getEndpoint(), format, accept, - requestOptionsLocal, context)); - } - - /** - * etag headers among other optional query/header/body parameters. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Header Parameters

- * - * - * - * - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: - * "application/json".
If-MatchStringNoThe request should only proceed if an entity matches this - * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this - * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the - * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity - * was modified after this time.
timestampOffsetDateTimeNoThe timestamp parameter
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param format The format parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithOptionalBodyWithResponse(String format, RequestOptions requestOptions) { - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { - requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); - } - }); - return service.putWithOptionalBodySync(this.client.getEndpoint(), format, accept, requestOptionsLocal, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/JsonMergePatchHelper.java deleted file mode 100644 index 554bd061af4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/JsonMergePatchHelper.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.implementation; - -import tsptest.specialheaders.models.Resource; - -/** - * This is the Helper class to enable json merge patch serialization for a model. - */ -public class JsonMergePatchHelper { - private static ResourceAccessor resourceAccessor; - - public interface ResourceAccessor { - Resource prepareModelForJsonMergePatch(Resource resource, boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(Resource resource); - } - - public static void setResourceAccessor(ResourceAccessor accessor) { - resourceAccessor = accessor; - } - - public static ResourceAccessor getResourceAccessor() { - return resourceAccessor; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/OperationLocationPollingStrategy.java deleted file mode 100644 index 83d1a833156..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/OperationLocationPollingStrategy.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.OperationResourcePollingStrategy; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -/** - * Implements an operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public Mono> onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - final Mono> pollResponseMono - = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) - .onErrorResume(exception -> { - LOGGER.info("Failed to parse initial response."); - return Mono.empty(); - }) - .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); - return pollResponseMono.switchIfEmpty( - Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); - } else { - return Mono - .error( - new AzureException(String.format( - "Operation failed or cancelled with status code %d," - + ", '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - } - - /** - * {@inheritDoc} - */ - @Override - public Mono getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - return Mono.error(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - return Mono.error(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - return PollingUtils - .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) - .flatMap(value -> { - if (value.get(propertyName) != null) { - return BinaryData.fromObjectAsync(value.get(propertyName)) - .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); - } else { - return Mono.error(new AzureException("Cannot get final result")); - } - }) - .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/PollingUtils.java deleted file mode 100644 index d9fbcb3ab95..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/PollingUtils.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.implementation; - -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.BinaryData; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.net.URI; -import java.net.URISyntaxException; -import java.time.DateTimeException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.time.temporal.ChronoUnit; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -final class PollingUtils { - - public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE - = new TypeReference>() { - }; - - public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); - - public static final String HTTP_METHOD = "httpMethod"; - public static final String REQUEST_URL = "requestURL"; - public static final String POLL_RESPONSE_BODY = "pollResponseBody"; - - private static final String FORWARD_SLASH = "/"; - - public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { - try { - URI uri = new URI(path); - if (!uri.isAbsolute()) { - if (CoreUtils.isNullOrEmpty(endpoint)) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); - } - - if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { - return endpoint + path.substring(1); - } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { - return endpoint + FORWARD_SLASH + path; - } else { - return endpoint + path; - } - } - } catch (URISyntaxException ex) { - throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); - } - return path; - } - - public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - T value; - if (binaryData == null) { - value = null; - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); - } else { - value = binaryData.toObject(typeReference, serializer); - } - return value; - } - - @SuppressWarnings("unchecked") - public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - Mono value; - if (binaryData == null) { - value = Mono.empty(); - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = (Mono) binaryData.toReplayableBinaryDataAsync(); - } else { - value = binaryData.toObjectAsync(typeReference, serializer); - } - return value; - } - - private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); - private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); - - public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { - // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. - Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. - retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then - // attempt to resolve it as an HTTP date (RFC1123). - retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, - headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); - - // Either the retry delay will have been found or it'll be null, null indicates no retry after. - return retryDelay; - } - - private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, - Function delayParser) { - String headerValue = headers.getValue(headerName); - - return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); - } - - private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { - long delaySeconds; - try { - OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); - - delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); - } catch (DateTimeException ex) { - delaySeconds = tryParseLong(value); - } - - return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; - } - - private static long tryParseLong(String value) { - try { - return Long.parseLong(value); - } catch (NumberFormatException ex) { - return -1; - } - } - - private static Duration tryGetDelayMillis(String value) { - long delayMillis = tryParseLong(value); - return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/RepeatabilityHeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/RepeatabilityHeadersImpl.java deleted file mode 100644 index 26bfa81465b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/RepeatabilityHeadersImpl.java +++ /dev/null @@ -1,864 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.RequestOptions; -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.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; -import tsptest.specialheaders.SpecialHeadersServiceVersion; -import tsptest.specialheaders.models.Resource; - -/** - * An instance of this class provides access to all the operations defined in RepeatabilityHeaders. - */ -public final class RepeatabilityHeadersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RepeatabilityHeadersService service; - - /** - * The service client containing this operation class. - */ - private final SpecialHeadersClientImpl client; - - /** - * Initializes an instance of RepeatabilityHeadersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - RepeatabilityHeadersImpl(SpecialHeadersClientImpl client) { - this.service = RestProxy.create(RepeatabilityHeadersService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public SpecialHeadersServiceVersion getServiceVersion() { - return client.getServiceVersion(); - } - - /** - * The interface defining all the services for SpecialHeadersClientRepeatabilityHeaders to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SpecialHeadersClientRepeatabilityHeaders") - public interface RepeatabilityHeadersService { - @Get("/repeatability-headers/resources/{name}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/repeatability-headers/resources/{name}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/repeatability-headers/resources/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); - - @Put("/repeatability-headers/resources/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); - - @Post("/repeatability-headers/resources/{name}:post") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> post(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/repeatability-headers/resources/{name}:post") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Patch("/repeatability-headers/resources/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createLro(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, - Context context); - - @Patch("/repeatability-headers/resources/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createLroSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, - Context context); - } - - /** - * Resource read operation template. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context)); - } - - /** - * Resource read operation template. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, - requestOptions, Context.NONE); - } - - /** - * Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); - } - }); - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-first-sent"), - DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); - } - }); - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), - name, contentType, accept, resource, requestOptionsLocal, context)); - } - - /** - * Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(String name, BinaryData resource, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); - } - }); - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-first-sent"), - DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); - } - }); - return service.putSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, - contentType, accept, resource, requestOptionsLocal, Context.NONE); - } - - /** - * Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postWithResponseAsync(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); - } - }); - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-first-sent"), - DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); - } - }); - return FluxUtil.withContext(context -> service.post(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, accept, requestOptionsLocal, context)); - } - - /** - * Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postWithResponse(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); - } - }); - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-first-sent"), - DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); - } - }); - return service.postSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, - requestOptionsLocal, Context.NONE); - } - - /** - * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createLroWithResponseAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); - } - }); - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-first-sent"), - DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); - } - }); - return FluxUtil.withContext( - context -> service.createLro(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, - contentType, accept, resource, requestOptionsLocal, context)); - } - - /** - * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createLroWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - final String accept = "application/json"; - RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); - } - }); - requestOptionsLocal.addRequestCallback(requestLocal -> { - if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { - requestLocal.getHeaders() - .set(HttpHeaderName.fromString("repeatability-first-sent"), - DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); - } - }); - return service.createLroSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, - contentType, accept, resource, requestOptionsLocal, Context.NONE); - } - - /** - * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateLroWithModelAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.createLroWithResponseAsync(name, resource, requestOptions), - new tsptest.specialheaders.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Resource.class)); - } - - /** - * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateLroWithModel(String name, BinaryData resource, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.createLroWithResponse(name, resource, requestOptions), - new tsptest.specialheaders.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Resource.class)); - } - - /** - * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateLroAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.createLroWithResponseAsync(name, resource, requestOptions), - new tsptest.specialheaders.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. - *

Header Parameters

- * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as - * HTTP-date
- * You can add these to a request with {@link RequestOptions#addHeader} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     description: String (Optional)
-     *     type: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateLro(String name, BinaryData resource, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.createLroWithResponse(name, resource, requestOptions), - new tsptest.specialheaders.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SkipSpecialHeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SkipSpecialHeadersImpl.java deleted file mode 100644 index eeb8e738323..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SkipSpecialHeadersImpl.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.implementation; - -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -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.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.specialheaders.SpecialHeadersServiceVersion; - -/** - * An instance of this class provides access to all the operations defined in SkipSpecialHeaders. - */ -public final class SkipSpecialHeadersImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SkipSpecialHeadersService service; - - /** - * The service client containing this operation class. - */ - private final SpecialHeadersClientImpl client; - - /** - * Initializes an instance of SkipSpecialHeadersImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SkipSpecialHeadersImpl(SpecialHeadersClientImpl client) { - this.service = RestProxy.create(SkipSpecialHeadersService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public SpecialHeadersServiceVersion getServiceVersion() { - return client.getServiceVersion(); - } - - /** - * The interface defining all the services for SpecialHeadersClientSkipSpecialHeaders to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SpecialHeadersClientSkipSpecialHeaders") - public interface SkipSpecialHeadersService { - @Delete("/skip-special-headers/resources/{name}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> deleteWithSpecialHeaders(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("foo") String foo, RequestOptions requestOptions, Context context); - - @Delete("/skip-special-headers/resources/{name}") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteWithSpecialHeadersSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("foo") String foo, RequestOptions requestOptions, Context context); - } - - /** - * skip special headers. - * - * @param name The name parameter. - * @param foo The foo parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteWithSpecialHeadersWithResponseAsync(String name, String foo, - RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.deleteWithSpecialHeaders(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, foo, requestOptions, context)); - } - - /** - * skip special headers. - * - * @param name The name parameter. - * @param foo The foo parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithSpecialHeadersWithResponse(String name, String foo, RequestOptions requestOptions) { - return service.deleteWithSpecialHeadersSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, foo, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SpecialHeadersClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SpecialHeadersClientImpl.java deleted file mode 100644 index 751531b9dab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SpecialHeadersClientImpl.java +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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; -import tsptest.specialheaders.SpecialHeadersServiceVersion; - -/** - * Initializes a new instance of the SpecialHeadersClient type. - */ -public final class SpecialHeadersClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final SpecialHeadersServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public SpecialHeadersServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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 RepeatabilityHeadersImpl object to access its operations. - */ - private final RepeatabilityHeadersImpl repeatabilityHeaders; - - /** - * Gets the RepeatabilityHeadersImpl object to access its operations. - * - * @return the RepeatabilityHeadersImpl object. - */ - public RepeatabilityHeadersImpl getRepeatabilityHeaders() { - return this.repeatabilityHeaders; - } - - /** - * The EtagHeadersImpl object to access its operations. - */ - private final EtagHeadersImpl etagHeaders; - - /** - * Gets the EtagHeadersImpl object to access its operations. - * - * @return the EtagHeadersImpl object. - */ - public EtagHeadersImpl getEtagHeaders() { - return this.etagHeaders; - } - - /** - * The EtagHeadersOptionalBodiesImpl object to access its operations. - */ - private final EtagHeadersOptionalBodiesImpl etagHeadersOptionalBodies; - - /** - * Gets the EtagHeadersOptionalBodiesImpl object to access its operations. - * - * @return the EtagHeadersOptionalBodiesImpl object. - */ - public EtagHeadersOptionalBodiesImpl getEtagHeadersOptionalBodies() { - return this.etagHeadersOptionalBodies; - } - - /** - * The SkipSpecialHeadersImpl object to access its operations. - */ - private final SkipSpecialHeadersImpl skipSpecialHeaders; - - /** - * Gets the SkipSpecialHeadersImpl object to access its operations. - * - * @return the SkipSpecialHeadersImpl object. - */ - public SkipSpecialHeadersImpl getSkipSpecialHeaders() { - return this.skipSpecialHeaders; - } - - /** - * Initializes an instance of SpecialHeadersClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public SpecialHeadersClientImpl(String endpoint, SpecialHeadersServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of SpecialHeadersClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public SpecialHeadersClientImpl(HttpPipeline httpPipeline, String endpoint, - SpecialHeadersServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of SpecialHeadersClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public SpecialHeadersClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - SpecialHeadersServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.repeatabilityHeaders = new RepeatabilityHeadersImpl(this); - this.etagHeaders = new EtagHeadersImpl(this); - this.etagHeadersOptionalBodies = new EtagHeadersOptionalBodiesImpl(this); - this.skipSpecialHeaders = new SkipSpecialHeadersImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SyncOperationLocationPollingStrategy.java deleted file mode 100644 index 0dafd8fee5f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SyncOperationLocationPollingStrategy.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.io.UncheckedIOException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Map; - -// DO NOT modify this helper class - -/** - * Implements a synchronous operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public PollResponse onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - T initialResponseType = null; - try { - initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, - pollResponseType); - } catch (UncheckedIOException e) { - LOGGER.info("Failed to parse initial response."); - } - return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); - } - - throw LOGGER.logExceptionAsError(new AzureException( - String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - - /** - * {@inheritDoc} - */ - public U getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, - PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); - if (pollResult != null && pollResult.get(propertyName) != null) { - return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), - serializer, resultType); - } else { - throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); - } - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/package-info.java deleted file mode 100644 index 72aeaded497..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for SpecialHeaders. - * - */ -package tsptest.specialheaders.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/Resource.java deleted file mode 100644 index 933c4aae0eb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/Resource.java +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import tsptest.specialheaders.implementation.JsonMergePatchHelper; - -/** - * The Resource model. - */ -@Fluent -public final class Resource implements JsonSerializable { - /* - * The id property. - */ - @Generated - private String id; - - /* - * The name property. - */ - @Generated - private String name; - - /* - * The description property. - */ - @Generated - private String description; - - /* - * The type property. - */ - @Generated - private String type; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setResourceAccessor(new JsonMergePatchHelper.ResourceAccessor() { - @Override - public Resource prepareModelForJsonMergePatch(Resource model, boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(Resource model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of Resource class. - */ - @Generated - public Resource() { - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the description property: The description property. - * - * @return the description value. - */ - @Generated - public String getDescription() { - return this.description; - } - - /** - * Set the description property: The description property. - * - * @param description the description value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setDescription(String description) { - this.description = description; - this.updatedProperties.add("description"); - return this; - } - - /** - * Get the type property: The type property. - * - * @return the type value. - */ - @Generated - public String getType() { - return this.type; - } - - /** - * Set the type property: The type property. - *

Required when create the resource.

- * - * @param type the type value to set. - * @return the Resource object itself. - */ - @Generated - public Resource setType(String type) { - this.type = type; - this.updatedProperties.add("type"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("description", this.description); - jsonWriter.writeStringField("type", this.type); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("description")) { - if (this.description == null) { - jsonWriter.writeNullField("description"); - } else { - jsonWriter.writeStringField("description", this.description); - } - } - if (updatedProperties.contains("type")) { - if (this.type == null) { - jsonWriter.writeNullField("type"); - } else { - jsonWriter.writeStringField("type", this.type); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Resource from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Resource. - */ - @Generated - public static Resource fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Resource deserializedResource = new Resource(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - deserializedResource.id = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedResource.name = reader.getString(); - } else if ("description".equals(fieldName)) { - deserializedResource.description = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedResource.type = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedResource; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/package-info.java deleted file mode 100644 index d0a3aa1e28f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for SpecialHeaders. - * - */ -package tsptest.specialheaders.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/package-info.java deleted file mode 100644 index f8e885b218a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for SpecialHeaders. - * - */ -package tsptest.specialheaders; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassAsyncClient.java deleted file mode 100644 index b1dde9b3e0b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassAsyncClient.java +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.subclass.implementation.SubclassImpl; -import tsptest.subclass.models.Body; - -/** - * Initializes a new instance of the asynchronous SubclassClient type. - */ -@ServiceClient(builder = SubclassClientBuilder.class, isAsync = true) -public final class SubclassAsyncClient { - @Generated - private final SubclassImpl serviceClient; - - /** - * Initializes an instance of SubclassAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SubclassAsyncClient(SubclassImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The propertyInSubclass operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     duplicateRequiredProperty (Optional): {
-     *         property: String (Required)
-     *         duplicateRequiredProperty: String (Required)
-     *     }
-     *     propertyChangedToRequired (Optional): {
-     *         propertyChangedToRequired: String (Required)
-     *     }
-     *     propertyChangedToConstant (Optional): {
-     *         propertyChangedToConstant: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     duplicateRequiredProperty (Optional): {
-     *         property: String (Required)
-     *         duplicateRequiredProperty: String (Required)
-     *     }
-     *     propertyChangedToRequired (Optional): {
-     *         propertyChangedToRequired: String (Required)
-     *     }
-     *     propertyChangedToConstant (Optional): {
-     *         propertyChangedToConstant: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> propertyInSubclassWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.propertyInSubclassWithResponseAsync(body, requestOptions); - } - - /** - * The propertyInSubclass operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono propertyInSubclass(Body body) { - // Generated convenience method for propertyInSubclassWithResponse - RequestOptions requestOptions = new RequestOptions(); - return propertyInSubclassWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Body.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClient.java deleted file mode 100644 index 775c7673366..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClient.java +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.subclass.implementation.SubclassImpl; -import tsptest.subclass.models.Body; - -/** - * Initializes a new instance of the synchronous SubclassClient type. - */ -@ServiceClient(builder = SubclassClientBuilder.class) -public final class SubclassClient { - @Generated - private final SubclassImpl serviceClient; - - /** - * Initializes an instance of SubclassClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SubclassClient(SubclassImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The propertyInSubclass operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     duplicateRequiredProperty (Optional): {
-     *         property: String (Required)
-     *         duplicateRequiredProperty: String (Required)
-     *     }
-     *     propertyChangedToRequired (Optional): {
-     *         propertyChangedToRequired: String (Required)
-     *     }
-     *     propertyChangedToConstant (Optional): {
-     *         propertyChangedToConstant: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     duplicateRequiredProperty (Optional): {
-     *         property: String (Required)
-     *         duplicateRequiredProperty: String (Required)
-     *     }
-     *     propertyChangedToRequired (Optional): {
-     *         propertyChangedToRequired: String (Required)
-     *     }
-     *     propertyChangedToConstant (Optional): {
-     *         propertyChangedToConstant: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response propertyInSubclassWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.propertyInSubclassWithResponse(body, requestOptions); - } - - /** - * The propertyInSubclass operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Body propertyInSubclass(Body body) { - // Generated convenience method for propertyInSubclassWithResponse - RequestOptions requestOptions = new RequestOptions(); - return propertyInSubclassWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(Body.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClientBuilder.java deleted file mode 100644 index 13b233af8fc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.subclass.implementation.SubclassClientImpl; - -/** - * A builder for creating a new instance of the SubclassClient type. - */ -@ServiceClientBuilder(serviceClients = { SubclassClient.class, SubclassAsyncClient.class }) -public final class SubclassClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-subclass.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the SubclassClientBuilder. - */ - @Generated - public SubclassClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SubclassClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SubclassClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SubclassClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SubclassClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SubclassClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SubclassClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SubclassClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SubclassClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the SubclassClientBuilder. - */ - @Generated - public SubclassClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of SubclassClientImpl with the provided parameters. - * - * @return an instance of SubclassClientImpl. - */ - @Generated - private SubclassClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - SubclassClientImpl client - = new SubclassClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of SubclassAsyncClient class. - * - * @return an instance of SubclassAsyncClient. - */ - @Generated - public SubclassAsyncClient buildAsyncClient() { - return new SubclassAsyncClient(buildInnerClient().getSubclass()); - } - - /** - * Builds an instance of SubclassClient class. - * - * @return an instance of SubclassClient. - */ - @Generated - public SubclassClient buildClient() { - return new SubclassClient(buildInnerClient().getSubclass()); - } - - private static final ClientLogger LOGGER = new ClientLogger(SubclassClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassClientImpl.java deleted file mode 100644 index 5566742f36e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 SubclassClient type. - */ -public final class SubclassClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 SubclassImpl object to access its operations. - */ - private final SubclassImpl subclass; - - /** - * Gets the SubclassImpl object to access its operations. - * - * @return the SubclassImpl object. - */ - public SubclassImpl getSubclass() { - return this.subclass; - } - - /** - * Initializes an instance of SubclassClient client. - * - * @param endpoint Service host. - */ - public SubclassClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of SubclassClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public SubclassClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of SubclassClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public SubclassClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.subclass = new SubclassImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassImpl.java deleted file mode 100644 index 92a552910a3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassImpl.java +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Subclass. - */ -public final class SubclassImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SubclassService service; - - /** - * The service client containing this operation class. - */ - private final SubclassClientImpl client; - - /** - * Initializes an instance of SubclassImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SubclassImpl(SubclassClientImpl client) { - this.service = RestProxy.create(SubclassService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for SubclassClientSubclass to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SubclassClientSubclass") - public interface SubclassService { - @Post("/subclass/property-in-subclass") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> propertyInSubclass(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/subclass/property-in-subclass") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response propertyInSubclassSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The propertyInSubclass operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     duplicateRequiredProperty (Optional): {
-     *         property: String (Required)
-     *         duplicateRequiredProperty: String (Required)
-     *     }
-     *     propertyChangedToRequired (Optional): {
-     *         propertyChangedToRequired: String (Required)
-     *     }
-     *     propertyChangedToConstant (Optional): {
-     *         propertyChangedToConstant: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     duplicateRequiredProperty (Optional): {
-     *         property: String (Required)
-     *         duplicateRequiredProperty: String (Required)
-     *     }
-     *     propertyChangedToRequired (Optional): {
-     *         propertyChangedToRequired: String (Required)
-     *     }
-     *     propertyChangedToConstant (Optional): {
-     *         propertyChangedToConstant: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> propertyInSubclassWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.propertyInSubclass(this.client.getEndpoint(), contentType, - accept, body, requestOptions, context)); - } - - /** - * The propertyInSubclass operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     duplicateRequiredProperty (Optional): {
-     *         property: String (Required)
-     *         duplicateRequiredProperty: String (Required)
-     *     }
-     *     propertyChangedToRequired (Optional): {
-     *         propertyChangedToRequired: String (Required)
-     *     }
-     *     propertyChangedToConstant (Optional): {
-     *         propertyChangedToConstant: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     duplicateRequiredProperty (Optional): {
-     *         property: String (Required)
-     *         duplicateRequiredProperty: String (Required)
-     *     }
-     *     propertyChangedToRequired (Optional): {
-     *         propertyChangedToRequired: String (Required)
-     *     }
-     *     propertyChangedToConstant (Optional): {
-     *         propertyChangedToConstant: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response propertyInSubclassWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.propertyInSubclassSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/package-info.java deleted file mode 100644 index 4cc0977cd8d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Subclass. - * - */ -package tsptest.subclass.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/Body.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/Body.java deleted file mode 100644 index 432ee35a8b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/Body.java +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Body model. - */ -@Fluent -public final class Body implements JsonSerializable { - /* - * The duplicateRequiredProperty property. - */ - @Generated - private DuplicateRequiredProperty duplicateRequiredProperty; - - /* - * The propertyChangedToRequired property. - */ - @Generated - private PropertyChangedToRequired propertyChangedToRequired; - - /* - * The propertyChangedToConstant property. - */ - @Generated - private PropertyChangedToConstant propertyChangedToConstant; - - /** - * Creates an instance of Body class. - */ - @Generated - public Body() { - } - - /** - * Get the duplicateRequiredProperty property: The duplicateRequiredProperty property. - * - * @return the duplicateRequiredProperty value. - */ - @Generated - public DuplicateRequiredProperty getDuplicateRequiredProperty() { - return this.duplicateRequiredProperty; - } - - /** - * Set the duplicateRequiredProperty property: The duplicateRequiredProperty property. - * - * @param duplicateRequiredProperty the duplicateRequiredProperty value to set. - * @return the Body object itself. - */ - @Generated - public Body setDuplicateRequiredProperty(DuplicateRequiredProperty duplicateRequiredProperty) { - this.duplicateRequiredProperty = duplicateRequiredProperty; - return this; - } - - /** - * Get the propertyChangedToRequired property: The propertyChangedToRequired property. - * - * @return the propertyChangedToRequired value. - */ - @Generated - public PropertyChangedToRequired getPropertyChangedToRequired() { - return this.propertyChangedToRequired; - } - - /** - * Set the propertyChangedToRequired property: The propertyChangedToRequired property. - * - * @param propertyChangedToRequired the propertyChangedToRequired value to set. - * @return the Body object itself. - */ - @Generated - public Body setPropertyChangedToRequired(PropertyChangedToRequired propertyChangedToRequired) { - this.propertyChangedToRequired = propertyChangedToRequired; - return this; - } - - /** - * Get the propertyChangedToConstant property: The propertyChangedToConstant property. - * - * @return the propertyChangedToConstant value. - */ - @Generated - public PropertyChangedToConstant getPropertyChangedToConstant() { - return this.propertyChangedToConstant; - } - - /** - * Set the propertyChangedToConstant property: The propertyChangedToConstant property. - * - * @param propertyChangedToConstant the propertyChangedToConstant value to set. - * @return the Body object itself. - */ - @Generated - public Body setPropertyChangedToConstant(PropertyChangedToConstant propertyChangedToConstant) { - this.propertyChangedToConstant = propertyChangedToConstant; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("duplicateRequiredProperty", this.duplicateRequiredProperty); - jsonWriter.writeJsonField("propertyChangedToRequired", this.propertyChangedToRequired); - jsonWriter.writeJsonField("propertyChangedToConstant", this.propertyChangedToConstant); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Body from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Body if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IOException If an error occurs while reading the Body. - */ - @Generated - public static Body fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Body deserializedBody = new Body(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("duplicateRequiredProperty".equals(fieldName)) { - deserializedBody.duplicateRequiredProperty = DuplicateRequiredProperty.fromJson(reader); - } else if ("propertyChangedToRequired".equals(fieldName)) { - deserializedBody.propertyChangedToRequired = PropertyChangedToRequired.fromJson(reader); - } else if ("propertyChangedToConstant".equals(fieldName)) { - deserializedBody.propertyChangedToConstant = PropertyChangedToConstant.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedBody; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredProperty.java deleted file mode 100644 index 04441739536..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredProperty.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The DuplicateRequiredProperty model. - */ -@Immutable -public final class DuplicateRequiredProperty extends DuplicateRequiredPropertyParent { - /* - * The duplicateRequiredProperty property. - */ - @Generated - private final String newRequiredProperty; - - /** - * Creates an instance of DuplicateRequiredProperty class. - * - * @param requiredProperty the requiredProperty value to set. - * @param newRequiredProperty the newRequiredProperty value to set. - */ - @Generated - public DuplicateRequiredProperty(String requiredProperty, String newRequiredProperty) { - super(requiredProperty, newRequiredProperty); - this.newRequiredProperty = newRequiredProperty; - } - - /** - * Get the newRequiredProperty property: The duplicateRequiredProperty property. - * - * @return the newRequiredProperty value. - */ - @Generated - public String getNewRequiredProperty() { - return this.newRequiredProperty; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", getRequiredProperty()); - jsonWriter.writeStringField("duplicateRequiredProperty", this.newRequiredProperty); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DuplicateRequiredProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DuplicateRequiredProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DuplicateRequiredProperty. - */ - @Generated - public static DuplicateRequiredProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String requiredProperty = null; - String newRequiredProperty = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - requiredProperty = reader.getString(); - } else if ("duplicateRequiredProperty".equals(fieldName)) { - newRequiredProperty = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new DuplicateRequiredProperty(requiredProperty, newRequiredProperty); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredPropertyParent.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredPropertyParent.java deleted file mode 100644 index 14989bc2da6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredPropertyParent.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The DuplicateRequiredPropertyParent model. - */ -@Immutable -public class DuplicateRequiredPropertyParent implements JsonSerializable { - /* - * The property property. - */ - @Generated - private final String requiredProperty; - - /* - * The duplicateRequiredProperty property. - */ - @Generated - private final String duplicateRequiredProperty; - - /** - * Creates an instance of DuplicateRequiredPropertyParent class. - * - * @param requiredProperty the requiredProperty value to set. - * @param duplicateRequiredProperty the duplicateRequiredProperty value to set. - */ - @Generated - public DuplicateRequiredPropertyParent(String requiredProperty, String duplicateRequiredProperty) { - this.requiredProperty = requiredProperty; - this.duplicateRequiredProperty = duplicateRequiredProperty; - } - - /** - * Get the requiredProperty property: The property property. - * - * @return the requiredProperty value. - */ - @Generated - public String getRequiredProperty() { - return this.requiredProperty; - } - - /** - * Get the duplicateRequiredProperty property: The duplicateRequiredProperty property. - * - * @return the duplicateRequiredProperty value. - */ - @Generated - public String getDuplicateRequiredProperty() { - return this.duplicateRequiredProperty; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.requiredProperty); - jsonWriter.writeStringField("duplicateRequiredProperty", this.duplicateRequiredProperty); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DuplicateRequiredPropertyParent from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DuplicateRequiredPropertyParent if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DuplicateRequiredPropertyParent. - */ - @Generated - public static DuplicateRequiredPropertyParent fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String requiredProperty = null; - String duplicateRequiredProperty = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - requiredProperty = reader.getString(); - } else if ("duplicateRequiredProperty".equals(fieldName)) { - duplicateRequiredProperty = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new DuplicateRequiredPropertyParent(requiredProperty, duplicateRequiredProperty); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstant.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstant.java deleted file mode 100644 index 4112d8e0e6b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstant.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The PropertyChangedToConstant model. - */ -@Immutable -public final class PropertyChangedToConstant extends PropertyChangedToConstantParent { - /* - * The propertyChangedToConstant property. - */ - @Generated - private final String propertyChangedToConstant = "constantValue"; - - /** - * Creates an instance of PropertyChangedToConstant class. - */ - @Generated - public PropertyChangedToConstant() { - super("constantValue"); - } - - /** - * Get the propertyChangedToConstant property: The propertyChangedToConstant property. - * - * @return the propertyChangedToConstant value. - */ - @Generated - public String getPropertyChangedToConstant() { - return this.propertyChangedToConstant; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("propertyChangedToConstant", this.propertyChangedToConstant); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PropertyChangedToConstant from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PropertyChangedToConstant if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the PropertyChangedToConstant. - */ - @Generated - public static PropertyChangedToConstant fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - PropertyChangedToConstant deserializedPropertyChangedToConstant = new PropertyChangedToConstant(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedPropertyChangedToConstant; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstantParent.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstantParent.java deleted file mode 100644 index 42ec9ff3a1c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstantParent.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The PropertyChangedToConstantParent model. - */ -@Immutable -public class PropertyChangedToConstantParent implements JsonSerializable { - /* - * The propertyChangedToConstant property. - */ - @Generated - private final String propertyChangedToConstant; - - /** - * Creates an instance of PropertyChangedToConstantParent class. - * - * @param propertyChangedToConstant the propertyChangedToConstant value to set. - */ - @Generated - public PropertyChangedToConstantParent(String propertyChangedToConstant) { - this.propertyChangedToConstant = propertyChangedToConstant; - } - - /** - * Get the propertyChangedToConstant property: The propertyChangedToConstant property. - * - * @return the propertyChangedToConstant value. - */ - @Generated - public String getPropertyChangedToConstant() { - return this.propertyChangedToConstant; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("propertyChangedToConstant", this.propertyChangedToConstant); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PropertyChangedToConstantParent from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PropertyChangedToConstantParent if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the PropertyChangedToConstantParent. - */ - @Generated - public static PropertyChangedToConstantParent fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String propertyChangedToConstant = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("propertyChangedToConstant".equals(fieldName)) { - propertyChangedToConstant = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new PropertyChangedToConstantParent(propertyChangedToConstant); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequired.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequired.java deleted file mode 100644 index b71da97a6a5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequired.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The PropertyChangedToRequired model. - */ -@Fluent -public final class PropertyChangedToRequired extends PropertyChangedToRequiredParent { - /* - * The propertyChangedToRequired property. - */ - @Generated - private final String propertyChangedToRequired; - - /** - * Creates an instance of PropertyChangedToRequired class. - * - * @param propertyChangedToRequired the propertyChangedToRequired value to set. - */ - @Generated - public PropertyChangedToRequired(String propertyChangedToRequired) { - this.propertyChangedToRequired = propertyChangedToRequired; - } - - /** - * Get the propertyChangedToRequired property: The propertyChangedToRequired property. - * - * @return the propertyChangedToRequired value. - */ - @Generated - public String getPropertyChangedToRequired() { - return this.propertyChangedToRequired; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("propertyChangedToRequired", this.propertyChangedToRequired); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PropertyChangedToRequired from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PropertyChangedToRequired if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the PropertyChangedToRequired. - */ - @Generated - public static PropertyChangedToRequired fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String propertyChangedToRequired = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("propertyChangedToRequired".equals(fieldName)) { - propertyChangedToRequired = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new PropertyChangedToRequired(propertyChangedToRequired); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequiredParent.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequiredParent.java deleted file mode 100644 index 2ab1511ea6a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequiredParent.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The PropertyChangedToRequiredParent model. - */ -@Fluent -public class PropertyChangedToRequiredParent implements JsonSerializable { - /* - * The propertyChangedToRequired property. - */ - @Generated - private String propertyChangedToRequired; - - /** - * Creates an instance of PropertyChangedToRequiredParent class. - */ - @Generated - public PropertyChangedToRequiredParent() { - } - - /** - * Get the propertyChangedToRequired property: The propertyChangedToRequired property. - * - * @return the propertyChangedToRequired value. - */ - @Generated - public String getPropertyChangedToRequired() { - return this.propertyChangedToRequired; - } - - /** - * Set the propertyChangedToRequired property: The propertyChangedToRequired property. - * - * @param propertyChangedToRequired the propertyChangedToRequired value to set. - * @return the PropertyChangedToRequiredParent object itself. - */ - @Generated - public PropertyChangedToRequiredParent setPropertyChangedToRequired(String propertyChangedToRequired) { - this.propertyChangedToRequired = propertyChangedToRequired; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("propertyChangedToRequired", this.propertyChangedToRequired); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PropertyChangedToRequiredParent from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PropertyChangedToRequiredParent if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the PropertyChangedToRequiredParent. - */ - @Generated - public static PropertyChangedToRequiredParent fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - PropertyChangedToRequiredParent deserializedPropertyChangedToRequiredParent - = new PropertyChangedToRequiredParent(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("propertyChangedToRequired".equals(fieldName)) { - deserializedPropertyChangedToRequiredParent.propertyChangedToRequired = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedPropertyChangedToRequiredParent; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/package-info.java deleted file mode 100644 index a14fc553344..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Subclass. - * - */ -package tsptest.subclass.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/package-info.java deleted file mode 100644 index 925d7ab7f03..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Subclass. - * - */ -package tsptest.subclass; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionAsyncClient.java deleted file mode 100644 index 456d8a5bed5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionAsyncClient.java +++ /dev/null @@ -1,321 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.PollerFlux; -import reactor.core.publisher.Mono; -import tsptest.union.implementation.UnionFlattenOpsImpl; -import tsptest.union.implementation.models.SendLongRequest; -import tsptest.union.implementation.models.SendRequest; -import tsptest.union.models.Result; -import tsptest.union.models.SendLongOptions; -import tsptest.union.models.User; - -/** - * Initializes a new instance of the asynchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) -public final class UnionAsyncClient { - @Generated - private final UnionFlattenOpsImpl serviceClient; - - /** - * Initializes an instance of UnionAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionAsyncClient(UnionFlattenOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendRequest The sendRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(String id, BinaryData sendRequest, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(id, sendRequest, requestOptions); - } - - /** - * The sendLong operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: String (Required)
-     *     dataInt: int (Required)
-     *     dataUnion: BinaryData (Optional)
-     *     dataLong: Long (Optional)
-     *     data_float: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendLongRequest The sendLongRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendLongWithResponse(String id, BinaryData sendLongRequest, - RequestOptions requestOptions) { - return this.serviceClient.sendLongWithResponseAsync(id, sendLongRequest, requestOptions); - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
dataBinaryDataNoThe data parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * A long-running remote procedure call (RPC) operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         result (Optional): (recursive schema, see result above)
-     *         data: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginGenerate(RequestOptions requestOptions) { - return this.serviceClient.beginGenerateAsync(requestOptions); - } - - /** - * The send operation. - * - * @param id The id parameter. - * @param input The input parameter. - * @param user The user parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(String id, BinaryData input, User user) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest sendRequestObj = new SendRequest(input).setUser(user); - BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); - return sendWithResponse(id, sendRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The send operation. - * - * @param id The id parameter. - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(String id, BinaryData input) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest sendRequestObj = new SendRequest(input); - BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); - return sendWithResponse(id, sendRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The sendLong operation. - * - * @param options Options for sendLong API. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono sendLong(SendLongOptions options) { - // Generated convenience method for sendLongWithResponse - RequestOptions requestOptions = new RequestOptions(); - String id = options.getId(); - String filter = options.getFilter(); - SendLongRequest sendLongRequestObj - = new SendLongRequest(options.getInput(), options.getDataInt()).setUser(options.getUser()) - .setDataUnion(options.getDataUnion()) - .setDataLong(options.getDataLong()) - .setDataFloat(options.getDataFloat()); - BinaryData sendLongRequest = BinaryData.fromObject(sendLongRequestObj); - if (filter != null) { - requestOptions.addQueryParam("filter", filter, false); - } - return sendLongWithResponse(id, sendLongRequest, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The get operation. - * - * @param data The data parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get(BinaryData data) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (data != null) { - requestOptions.addQueryParam("data", String.valueOf(data), false); - } - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * A long-running remote procedure call (RPC) operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginGenerate() { - // Generated convenience method for beginGenerateWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginGenerateWithModelAsync(requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClient.java deleted file mode 100644 index 9b0be2464f1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClient.java +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.SyncPoller; -import tsptest.union.implementation.UnionFlattenOpsImpl; -import tsptest.union.implementation.models.SendLongRequest; -import tsptest.union.implementation.models.SendRequest; -import tsptest.union.models.Result; -import tsptest.union.models.SendLongOptions; -import tsptest.union.models.User; - -/** - * Initializes a new instance of the synchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class) -public final class UnionClient { - @Generated - private final UnionFlattenOpsImpl serviceClient; - - /** - * Initializes an instance of UnionClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionClient(UnionFlattenOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendRequest The sendRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(String id, BinaryData sendRequest, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(id, sendRequest, requestOptions); - } - - /** - * The sendLong operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: String (Required)
-     *     dataInt: int (Required)
-     *     dataUnion: BinaryData (Optional)
-     *     dataLong: Long (Optional)
-     *     data_float: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendLongRequest The sendLongRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendLongWithResponse(String id, BinaryData sendLongRequest, RequestOptions requestOptions) { - return this.serviceClient.sendLongWithResponse(id, sendLongRequest, requestOptions); - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
dataBinaryDataNoThe data parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * A long-running remote procedure call (RPC) operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         result (Optional): (recursive schema, see result above)
-     *         data: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginGenerate(RequestOptions requestOptions) { - return this.serviceClient.beginGenerate(requestOptions); - } - - /** - * The send operation. - * - * @param id The id parameter. - * @param input The input parameter. - * @param user The user parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(String id, BinaryData input, User user) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest sendRequestObj = new SendRequest(input).setUser(user); - BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); - sendWithResponse(id, sendRequest, requestOptions).getValue(); - } - - /** - * The send operation. - * - * @param id The id parameter. - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(String id, BinaryData input) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest sendRequestObj = new SendRequest(input); - BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); - sendWithResponse(id, sendRequest, requestOptions).getValue(); - } - - /** - * The sendLong operation. - * - * @param options Options for sendLong API. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void sendLong(SendLongOptions options) { - // Generated convenience method for sendLongWithResponse - RequestOptions requestOptions = new RequestOptions(); - String id = options.getId(); - String filter = options.getFilter(); - SendLongRequest sendLongRequestObj - = new SendLongRequest(options.getInput(), options.getDataInt()).setUser(options.getUser()) - .setDataUnion(options.getDataUnion()) - .setDataLong(options.getDataLong()) - .setDataFloat(options.getDataFloat()); - BinaryData sendLongRequest = BinaryData.fromObject(sendLongRequestObj); - if (filter != null) { - requestOptions.addQueryParam("filter", filter, false); - } - sendLongWithResponse(id, sendLongRequest, requestOptions).getValue(); - } - - /** - * The get operation. - * - * @param data The data parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void get(BinaryData data) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (data != null) { - requestOptions.addQueryParam("data", String.valueOf(data), false); - } - getWithResponse(requestOptions).getValue(); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - getWithResponse(requestOptions).getValue(); - } - - /** - * A long-running remote procedure call (RPC) operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginGenerate() { - // Generated convenience method for beginGenerateWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginGenerateWithModel(requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClientBuilder.java deleted file mode 100644 index 43739b12928..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.union.implementation.UnionClientImpl; - -/** - * A builder for creating a new instance of the UnionClient type. - */ -@ServiceClientBuilder(serviceClients = { UnionClient.class, UnionAsyncClient.class }) -public final class UnionClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-union.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the UnionClientBuilder. - */ - @Generated - public UnionClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private UnionServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the UnionClientBuilder. - */ - @Generated - public UnionClientBuilder serviceVersion(UnionServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the UnionClientBuilder. - */ - @Generated - public UnionClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of UnionClientImpl with the provided parameters. - * - * @return an instance of UnionClientImpl. - */ - @Generated - private UnionClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - UnionServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : UnionServiceVersion.getLatest(); - UnionClientImpl client = new UnionClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of UnionAsyncClient class. - * - * @return an instance of UnionAsyncClient. - */ - @Generated - public UnionAsyncClient buildAsyncClient() { - return new UnionAsyncClient(buildInnerClient().getUnionFlattenOps()); - } - - /** - * Builds an instance of UnionClient class. - * - * @return an instance of UnionClient. - */ - @Generated - public UnionClient buildClient() { - return new UnionClient(buildInnerClient().getUnionFlattenOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(UnionClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionServiceVersion.java deleted file mode 100644 index 66111bf216a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionServiceVersion.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of UnionClient. - */ -public enum UnionServiceVersion implements ServiceVersion { - /** - * Enum value 2022-03-01-preview. - */ - V2022_03_01_PREVIEW("2022-03-01-preview"), - - /** - * Enum value 2022-06-01-preview. - */ - V2022_06_01_PREVIEW("2022-06-01-preview"); - - private final String version; - - UnionServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link UnionServiceVersion}. - */ - public static UnionServiceVersion getLatest() { - return V2022_06_01_PREVIEW; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/OperationLocationPollingStrategy.java deleted file mode 100644 index c67ac3e30fa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/OperationLocationPollingStrategy.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.OperationResourcePollingStrategy; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -/** - * Implements an operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public Mono> onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - final Mono> pollResponseMono - = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) - .onErrorResume(exception -> { - LOGGER.info("Failed to parse initial response."); - return Mono.empty(); - }) - .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); - return pollResponseMono.switchIfEmpty( - Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); - } else { - return Mono - .error( - new AzureException(String.format( - "Operation failed or cancelled with status code %d," - + ", '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - } - - /** - * {@inheritDoc} - */ - @Override - public Mono getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - return Mono.error(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - return Mono.error(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - return PollingUtils - .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) - .flatMap(value -> { - if (value.get(propertyName) != null) { - return BinaryData.fromObjectAsync(value.get(propertyName)) - .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); - } else { - return Mono.error(new AzureException("Cannot get final result")); - } - }) - .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/PollingUtils.java deleted file mode 100644 index 259efb2eb00..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/PollingUtils.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.implementation; - -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.BinaryData; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.net.URI; -import java.net.URISyntaxException; -import java.time.DateTimeException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.time.temporal.ChronoUnit; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -final class PollingUtils { - - public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE - = new TypeReference>() { - }; - - public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); - - public static final String HTTP_METHOD = "httpMethod"; - public static final String REQUEST_URL = "requestURL"; - public static final String POLL_RESPONSE_BODY = "pollResponseBody"; - - private static final String FORWARD_SLASH = "/"; - - public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { - try { - URI uri = new URI(path); - if (!uri.isAbsolute()) { - if (CoreUtils.isNullOrEmpty(endpoint)) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); - } - - if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { - return endpoint + path.substring(1); - } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { - return endpoint + FORWARD_SLASH + path; - } else { - return endpoint + path; - } - } - } catch (URISyntaxException ex) { - throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); - } - return path; - } - - public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - T value; - if (binaryData == null) { - value = null; - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); - } else { - value = binaryData.toObject(typeReference, serializer); - } - return value; - } - - @SuppressWarnings("unchecked") - public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - Mono value; - if (binaryData == null) { - value = Mono.empty(); - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = (Mono) binaryData.toReplayableBinaryDataAsync(); - } else { - value = binaryData.toObjectAsync(typeReference, serializer); - } - return value; - } - - private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); - private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); - - public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { - // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. - Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. - retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then - // attempt to resolve it as an HTTP date (RFC1123). - retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, - headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); - - // Either the retry delay will have been found or it'll be null, null indicates no retry after. - return retryDelay; - } - - private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, - Function delayParser) { - String headerValue = headers.getValue(headerName); - - return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); - } - - private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { - long delaySeconds; - try { - OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); - - delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); - } catch (DateTimeException ex) { - delaySeconds = tryParseLong(value); - } - - return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; - } - - private static long tryParseLong(String value) { - try { - return Long.parseLong(value); - } catch (NumberFormatException ex) { - return -1; - } - } - - private static Duration tryGetDelayMillis(String value) { - long delayMillis = tryParseLong(value); - return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/SyncOperationLocationPollingStrategy.java deleted file mode 100644 index 5471cb58e7d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/SyncOperationLocationPollingStrategy.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.io.UncheckedIOException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Map; - -// DO NOT modify this helper class - -/** - * Implements a synchronous operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public PollResponse onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - T initialResponseType = null; - try { - initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, - pollResponseType); - } catch (UncheckedIOException e) { - LOGGER.info("Failed to parse initial response."); - } - return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); - } - - throw LOGGER.logExceptionAsError(new AzureException( - String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - - /** - * {@inheritDoc} - */ - public U getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, - PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); - if (pollResult != null && pollResult.get(propertyName) != null) { - return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), - serializer, resultType); - } else { - throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); - } - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionClientImpl.java deleted file mode 100644 index df601c7f31c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionClientImpl.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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; -import tsptest.union.UnionServiceVersion; - -/** - * Initializes a new instance of the UnionClient type. - */ -public final class UnionClientImpl { - /** - */ - private final String endpoint; - - /** - * Gets. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final UnionServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public UnionServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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 UnionFlattenOpsImpl object to access its operations. - */ - private final UnionFlattenOpsImpl unionFlattenOps; - - /** - * Gets the UnionFlattenOpsImpl object to access its operations. - * - * @return the UnionFlattenOpsImpl object. - */ - public UnionFlattenOpsImpl getUnionFlattenOps() { - return this.unionFlattenOps; - } - - /** - * Initializes an instance of UnionClient client. - * - * @param endpoint - * @param serviceVersion Service version. - */ - public UnionClientImpl(String endpoint, UnionServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of UnionClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint - * @param serviceVersion Service version. - */ - public UnionClientImpl(HttpPipeline httpPipeline, String endpoint, UnionServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of UnionClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint - * @param serviceVersion Service version. - */ - public UnionClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - UnionServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.unionFlattenOps = new UnionFlattenOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionFlattenOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionFlattenOpsImpl.java deleted file mode 100644 index 852855dd53d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionFlattenOpsImpl.java +++ /dev/null @@ -1,642 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import reactor.core.publisher.Mono; -import tsptest.union.UnionServiceVersion; -import tsptest.union.models.Result; - -/** - * An instance of this class provides access to all the operations defined in UnionFlattenOps. - */ -public final class UnionFlattenOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnionFlattenOpsService service; - - /** - * The service client containing this operation class. - */ - private final UnionClientImpl client; - - /** - * Initializes an instance of UnionFlattenOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnionFlattenOpsImpl(UnionClientImpl client) { - this.service - = RestProxy.create(UnionFlattenOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public UnionServiceVersion getServiceVersion() { - return client.getServiceVersion(); - } - - /** - * The interface defining all the services for UnionClientUnionFlattenOps to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}/openai") - @ServiceInterface(name = "UnionClientUnionFlattenOps") - public interface UnionFlattenOpsService { - @Post("/union/send") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendRequest, RequestOptions requestOptions, Context context); - - @Post("/union/send") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendRequest, RequestOptions requestOptions, Context context); - - @Post("/union/send-long") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> sendLong(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendLongRequest, RequestOptions requestOptions, Context context); - - @Post("/union/send-long") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendLongSync(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, - @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendLongRequest, RequestOptions requestOptions, Context context); - - @Get("/union/param") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, - Context context); - - @Get("/union/param") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); - - @Post("/union/generate") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> generate(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/union/generate") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response generateSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendRequest The sendRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(String id, BinaryData sendRequest, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.send(this.client.getEndpoint(), id, - this.client.getServiceVersion().getVersion(), contentType, sendRequest, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendRequest The sendRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(String id, BinaryData sendRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendSync(this.client.getEndpoint(), id, this.client.getServiceVersion().getVersion(), - contentType, sendRequest, requestOptions, Context.NONE); - } - - /** - * The sendLong operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: String (Required)
-     *     dataInt: int (Required)
-     *     dataUnion: BinaryData (Optional)
-     *     dataLong: Long (Optional)
-     *     data_float: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendLongRequest The sendLongRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendLongWithResponseAsync(String id, BinaryData sendLongRequest, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext(context -> service.sendLong(this.client.getEndpoint(), id, - this.client.getServiceVersion().getVersion(), contentType, sendLongRequest, requestOptions, context)); - } - - /** - * The sendLong operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     user (Optional): {
-     *         user: String (Required)
-     *     }
-     *     input: String (Required)
-     *     dataInt: int (Required)
-     *     dataUnion: BinaryData (Optional)
-     *     dataLong: Long (Optional)
-     *     data_float: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param id The id parameter. - * @param sendLongRequest The sendLongRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendLongWithResponse(String id, BinaryData sendLongRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendLongSync(this.client.getEndpoint(), id, this.client.getServiceVersion().getVersion(), - contentType, sendLongRequest, requestOptions, Context.NONE); - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
dataBinaryDataNoThe data parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), requestOptions, context)); - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
dataBinaryDataNoThe data parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return service.getSync(this.client.getEndpoint(), requestOptions, Context.NONE); - } - - /** - * A long-running remote procedure call (RPC) operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         result (Optional): (recursive schema, see result above)
-     *         data: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return provides status details for long running operations along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> generateWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.generate(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); - } - - /** - * A long-running remote procedure call (RPC) operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         result (Optional): (recursive schema, see result above)
-     *         data: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return provides status details for long running operations along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response generateWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.generateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), accept, - requestOptions, Context.NONE); - } - - /** - * A long-running remote procedure call (RPC) operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         result (Optional): (recursive schema, see result above)
-     *         data: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginGenerateWithModelAsync(RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), () -> this.generateWithResponseAsync(requestOptions), - new tsptest.union.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}/openai".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Result.class)); - } - - /** - * A long-running remote procedure call (RPC) operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         result (Optional): (recursive schema, see result above)
-     *         data: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginGenerateWithModel(RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.generateWithResponse(requestOptions), - new tsptest.union.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}/openai".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Result.class)); - } - - /** - * A long-running remote procedure call (RPC) operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         result (Optional): (recursive schema, see result above)
-     *         data: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginGenerateAsync(RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), () -> this.generateWithResponseAsync(requestOptions), - new tsptest.union.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}/openai".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * A long-running remote procedure call (RPC) operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         name: String (Required)
-     *         result (Optional): (recursive schema, see result above)
-     *         data: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginGenerate(RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.generateWithResponse(requestOptions), - new tsptest.union.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}/openai".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendLongRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendLongRequest.java deleted file mode 100644 index 435539a9d2b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendLongRequest.java +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.union.models.User; - -/** - * The SendLongRequest model. - */ -@Fluent -public final class SendLongRequest implements JsonSerializable { - /* - * The user property. - */ - @Generated - private User user; - - /* - * The input property. - */ - @Generated - private final String input; - - /* - * The dataInt property. - */ - @Generated - private final int dataInt; - - /* - * The dataUnion property. - */ - @Generated - private BinaryData dataUnion; - - /* - * The dataLong property. - */ - @Generated - private Long dataLong; - - /* - * The data_float property. - */ - @Generated - private Double dataFloat; - - /** - * Creates an instance of SendLongRequest class. - * - * @param input the input value to set. - * @param dataInt the dataInt value to set. - */ - @Generated - public SendLongRequest(String input, int dataInt) { - this.input = input; - this.dataInt = dataInt; - } - - /** - * Get the user property: The user property. - * - * @return the user value. - */ - @Generated - public User getUser() { - return this.user; - } - - /** - * Set the user property: The user property. - * - * @param user the user value to set. - * @return the SendLongRequest object itself. - */ - @Generated - public SendLongRequest setUser(User user) { - this.user = user; - return this; - } - - /** - * Get the input property: The input property. - * - * @return the input value. - */ - @Generated - public String getInput() { - return this.input; - } - - /** - * Get the dataInt property: The dataInt property. - * - * @return the dataInt value. - */ - @Generated - public int getDataInt() { - return this.dataInt; - } - - /** - * Get the dataUnion property: The dataUnion property. - * - * @return the dataUnion value. - */ - @Generated - public BinaryData getDataUnion() { - return this.dataUnion; - } - - /** - * Set the dataUnion property: The dataUnion property. - * - * @param dataUnion the dataUnion value to set. - * @return the SendLongRequest object itself. - */ - @Generated - public SendLongRequest setDataUnion(BinaryData dataUnion) { - this.dataUnion = dataUnion; - return this; - } - - /** - * Get the dataLong property: The dataLong property. - * - * @return the dataLong value. - */ - @Generated - public Long getDataLong() { - return this.dataLong; - } - - /** - * Set the dataLong property: The dataLong property. - * - * @param dataLong the dataLong value to set. - * @return the SendLongRequest object itself. - */ - @Generated - public SendLongRequest setDataLong(Long dataLong) { - this.dataLong = dataLong; - return this; - } - - /** - * Get the dataFloat property: The data_float property. - * - * @return the dataFloat value. - */ - @Generated - public Double getDataFloat() { - return this.dataFloat; - } - - /** - * Set the dataFloat property: The data_float property. - * - * @param dataFloat the dataFloat value to set. - * @return the SendLongRequest object itself. - */ - @Generated - public SendLongRequest setDataFloat(Double dataFloat) { - this.dataFloat = dataFloat; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("input", this.input); - jsonWriter.writeIntField("dataInt", this.dataInt); - jsonWriter.writeJsonField("user", this.user); - if (this.dataUnion != null) { - jsonWriter.writeFieldName("dataUnion"); - this.dataUnion.writeTo(jsonWriter); - } - jsonWriter.writeNumberField("dataLong", this.dataLong); - jsonWriter.writeNumberField("data_float", this.dataFloat); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendLongRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendLongRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendLongRequest. - */ - @Generated - public static SendLongRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String input = null; - int dataInt = 0; - User user = null; - BinaryData dataUnion = null; - Long dataLong = null; - Double dataFloat = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("input".equals(fieldName)) { - input = reader.getString(); - } else if ("dataInt".equals(fieldName)) { - dataInt = reader.getInt(); - } else if ("user".equals(fieldName)) { - user = User.fromJson(reader); - } else if ("dataUnion".equals(fieldName)) { - dataUnion = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else if ("dataLong".equals(fieldName)) { - dataLong = reader.getNullable(JsonReader::getLong); - } else if ("data_float".equals(fieldName)) { - dataFloat = reader.getNullable(JsonReader::getDouble); - } else { - reader.skipChildren(); - } - } - SendLongRequest deserializedSendLongRequest = new SendLongRequest(input, dataInt); - deserializedSendLongRequest.user = user; - deserializedSendLongRequest.dataUnion = dataUnion; - deserializedSendLongRequest.dataLong = dataLong; - deserializedSendLongRequest.dataFloat = dataFloat; - - return deserializedSendLongRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendRequest.java deleted file mode 100644 index 741701ccbc8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendRequest.java +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.union.models.User; - -/** - * The SendRequest model. - */ -@Fluent -public final class SendRequest implements JsonSerializable { - /* - * The user property. - */ - @Generated - private User user; - - /* - * The input property. - */ - @Generated - private final BinaryData input; - - /** - * Creates an instance of SendRequest class. - * - * @param input the input value to set. - */ - @Generated - public SendRequest(BinaryData input) { - this.input = input; - } - - /** - * Get the user property: The user property. - * - * @return the user value. - */ - @Generated - public User getUser() { - return this.user; - } - - /** - * Set the user property: The user property. - * - * @param user the user value to set. - * @return the SendRequest object itself. - */ - @Generated - public SendRequest setUser(User user) { - this.user = user; - return this; - } - - /** - * Get the input property: The input property. - * - * @return the input value. - */ - @Generated - public BinaryData getInput() { - return this.input; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeFieldName("input"); - this.input.writeTo(jsonWriter); - jsonWriter.writeJsonField("user", this.user); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendRequest. - */ - @Generated - public static SendRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BinaryData input = null; - User user = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("input".equals(fieldName)) { - input = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else if ("user".equals(fieldName)) { - user = User.fromJson(reader); - } else { - reader.skipChildren(); - } - } - SendRequest deserializedSendRequest = new SendRequest(input); - deserializedSendRequest.user = user; - - return deserializedSendRequest; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SubResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SubResult.java deleted file mode 100644 index f35e482f57a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SubResult.java +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import tsptest.union.models.Result; - -/** - * The SubResult model. - */ -@Fluent -public final class SubResult extends Result { - /* - * The text property. - */ - @Generated - private String text; - - /* - * The arrayData property. - */ - @Generated - private BinaryData arrayData; - - /** - * Creates an instance of SubResult class. - * - * @param name the name value to set. - * @param data the data value to set. - */ - @Generated - public SubResult(String name, BinaryData data) { - super(name, data); - } - - /** - * Get the text property: The text property. - * - * @return the text value. - */ - @Generated - public String getText() { - return this.text; - } - - /** - * Set the text property: The text property. - * - * @param text the text value to set. - * @return the SubResult object itself. - */ - @Generated - public SubResult setText(String text) { - this.text = text; - return this; - } - - /** - * Get the arrayData property: The arrayData property. - * - * @return the arrayData value. - */ - @Generated - public BinaryData getArrayData() { - return this.arrayData; - } - - /** - * Set the arrayData property: The arrayData property. - * - * @param arrayData the arrayData value to set. - * @return the SubResult object itself. - */ - @Generated - public SubResult setArrayData(BinaryData arrayData) { - this.arrayData = arrayData; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public SubResult setResult(Result result) { - super.setResult(result); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", getName()); - jsonWriter.writeFieldName("data"); - getData().writeTo(jsonWriter); - jsonWriter.writeJsonField("result", getResult()); - jsonWriter.writeStringField("text", this.text); - if (this.arrayData != null) { - jsonWriter.writeFieldName("arrayData"); - this.arrayData.writeTo(jsonWriter); - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubResult if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SubResult. - */ - @Generated - public static SubResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - BinaryData data = null; - Result result = null; - String text = null; - BinaryData arrayData = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("data".equals(fieldName)) { - data = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else if ("result".equals(fieldName)) { - result = Result.fromJson(reader); - } else if ("text".equals(fieldName)) { - text = reader.getString(); - } else if ("arrayData".equals(fieldName)) { - arrayData = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - SubResult deserializedSubResult = new SubResult(name, data); - deserializedSubResult.setResult(result); - deserializedSubResult.text = text; - deserializedSubResult.arrayData = arrayData; - - return deserializedSubResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/package-info.java deleted file mode 100644 index f7a1b79ffae..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Union. - * - */ -package tsptest.union.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/package-info.java deleted file mode 100644 index 9499b67a3e6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Union. - * - */ -package tsptest.union.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/ArrayData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/ArrayData.java deleted file mode 100644 index 4b9e4d33ff9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/ArrayData.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The ArrayData model. - */ -@Immutable -public final class ArrayData implements JsonSerializable { - /* - * The data property. - */ - @Generated - private final List data; - - /** - * Creates an instance of ArrayData class. - * - * @param data the data value to set. - */ - @Generated - public ArrayData(List data) { - this.data = data; - } - - /** - * Get the data property: The data property. - * - * @return the data value. - */ - @Generated - public List getData() { - return this.data; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("data", this.data, (writer, element) -> writer.writeString(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ArrayData from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ArrayData if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ArrayData. - */ - @Generated - public static ArrayData fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List data = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("data".equals(fieldName)) { - data = reader.readArray(reader1 -> reader1.getString()); - } else { - reader.skipChildren(); - } - } - return new ArrayData(data); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/Result.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/Result.java deleted file mode 100644 index 61f1a0c25b0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/Result.java +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Result model. - */ -@Fluent -public class Result implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The result property. - */ - @Generated - private Result result; - - /* - * The data property. - */ - @Generated - private final BinaryData data; - - /** - * Creates an instance of Result class. - * - * @param name the name value to set. - * @param data the data value to set. - */ - @Generated - public Result(String name, BinaryData data) { - this.name = name; - this.data = data; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the result property: The result property. - * - * @return the result value. - */ - @Generated - public Result getResult() { - return this.result; - } - - /** - * Set the result property: The result property. - * - * @param result the result value to set. - * @return the Result object itself. - */ - @Generated - public Result setResult(Result result) { - this.result = result; - return this; - } - - /** - * Get the data property: The data property. - * - * @return the data value. - */ - @Generated - public BinaryData getData() { - return this.data; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeFieldName("data"); - this.data.writeTo(jsonWriter); - jsonWriter.writeJsonField("result", this.result); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Result from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Result if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Result. - */ - @Generated - public static Result fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - BinaryData data = null; - Result result = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("data".equals(fieldName)) { - data = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else if ("result".equals(fieldName)) { - result = Result.fromJson(reader); - } else { - reader.skipChildren(); - } - } - Result deserializedResult = new Result(name, data); - deserializedResult.result = result; - - return deserializedResult; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/SendLongOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/SendLongOptions.java deleted file mode 100644 index 77cb485371e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/SendLongOptions.java +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; - -/** - * Options for sendLong API. - */ -@Fluent -public final class SendLongOptions { - /* - * The id property. - */ - @Generated - private final String id; - - /* - * The filter property. - */ - @Generated - private String filter; - - /* - * The user property. - */ - @Generated - private User user; - - /* - * The input property. - */ - @Generated - private final String input; - - /* - * The dataInt property. - */ - @Generated - private final int dataInt; - - /* - * The dataUnion property. - */ - @Generated - private BinaryData dataUnion; - - /* - * The dataLong property. - */ - @Generated - private Long dataLong; - - /* - * The data_float property. - */ - @Generated - private Double dataFloat; - - /** - * Creates an instance of SendLongOptions class. - * - * @param id the id value to set. - * @param input the input value to set. - * @param dataInt the dataInt value to set. - */ - @Generated - public SendLongOptions(String id, String input, int dataInt) { - this.id = id; - this.input = input; - this.dataInt = dataInt; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the filter property: The filter property. - * - * @return the filter value. - */ - @Generated - public String getFilter() { - return this.filter; - } - - /** - * Set the filter property: The filter property. - * - * @param filter the filter value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setFilter(String filter) { - this.filter = filter; - return this; - } - - /** - * Get the user property: The user property. - * - * @return the user value. - */ - @Generated - public User getUser() { - return this.user; - } - - /** - * Set the user property: The user property. - * - * @param user the user value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setUser(User user) { - this.user = user; - return this; - } - - /** - * Get the input property: The input property. - * - * @return the input value. - */ - @Generated - public String getInput() { - return this.input; - } - - /** - * Get the dataInt property: The dataInt property. - * - * @return the dataInt value. - */ - @Generated - public int getDataInt() { - return this.dataInt; - } - - /** - * Get the dataUnion property: The dataUnion property. - * - * @return the dataUnion value. - */ - @Generated - public BinaryData getDataUnion() { - return this.dataUnion; - } - - /** - * Set the dataUnion property: The dataUnion property. - * - * @param dataUnion the dataUnion value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setDataUnion(BinaryData dataUnion) { - this.dataUnion = dataUnion; - return this; - } - - /** - * Get the dataLong property: The dataLong property. - * - * @return the dataLong value. - */ - @Generated - public Long getDataLong() { - return this.dataLong; - } - - /** - * Set the dataLong property: The dataLong property. - * - * @param dataLong the dataLong value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setDataLong(Long dataLong) { - this.dataLong = dataLong; - return this; - } - - /** - * Get the dataFloat property: The data_float property. - * - * @return the dataFloat value. - */ - @Generated - public Double getDataFloat() { - return this.dataFloat; - } - - /** - * Set the dataFloat property: The data_float property. - * - * @param dataFloat the dataFloat value to set. - * @return the SendLongOptions object itself. - */ - @Generated - public SendLongOptions setDataFloat(Double dataFloat) { - this.dataFloat = dataFloat; - return this; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/User.java deleted file mode 100644 index 8ac404ec5d2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/User.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The User model. - */ -@Immutable -public final class User implements JsonSerializable { - /* - * The user property. - */ - @Generated - private final String user; - - /** - * Creates an instance of User class. - * - * @param user the user value to set. - */ - @Generated - public User(String user) { - this.user = user; - } - - /** - * Get the user property: The user property. - * - * @return the user value. - */ - @Generated - public String getUser() { - return this.user; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("user", this.user); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of User from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the User. - */ - @Generated - public static User fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String user = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("user".equals(fieldName)) { - user = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new User(user); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/package-info.java deleted file mode 100644 index 7fcc2e6f48e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Union. - * - */ -package tsptest.union.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/package-info.java deleted file mode 100644 index 61f38293617..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Union. - * - */ -package tsptest.union; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningAsyncClient.java deleted file mode 100644 index eb81728b5fa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningAsyncClient.java +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.PollerFlux; -import java.util.List; -import java.util.stream.Collectors; -import reactor.core.publisher.Flux; -import tsptest.versioning.implementation.VersioningOpsImpl; -import tsptest.versioning.models.ExportedResource; -import tsptest.versioning.models.Resource; - -/** - * Initializes a new instance of the asynchronous VersioningClient type. - */ -@ServiceClient(builder = VersioningClientBuilder.class, isAsync = true) -public final class VersioningAsyncClient { - @Generated - private final VersioningOpsImpl serviceClient; - - /** - * Initializes an instance of VersioningAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - VersioningAsyncClient(VersioningOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Long-running resource action operation template. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         id: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginExport(String name, RequestOptions requestOptions) { - return this.serviceClient.beginExportAsync(name, requestOptions); - } - - /** - * Resource list operation template. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
selectList<String>NoSelect the specified fields to be included in the - * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandStringNoThe expand parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux list(RequestOptions requestOptions) { - return this.serviceClient.listAsync(requestOptions); - } - - /** - * Long-running resource create or replace operation template. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateLongRunning(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.beginCreateLongRunningAsync(name, resource, requestOptions); - } - - /** - * Long-running resource action operation template. - * - * @param name The name parameter. - * @param projectFileVersion The projectFileVersion parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginExport(String name, String projectFileVersion) { - // Generated convenience method for beginExportWithModel - RequestOptions requestOptions = new RequestOptions(); - if (projectFileVersion != null) { - requestOptions.addQueryParam("projectFileVersion", projectFileVersion, false); - } - return serviceClient.beginExportWithModelAsync(name, requestOptions); - } - - /** - * Long-running resource action operation template. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginExport(String name) { - // Generated convenience method for beginExportWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginExportWithModelAsync(name, requestOptions); - } - - /** - * Resource list operation template. - * - * @param select Select the specified fields to be included in the response. - * @param expand The expand parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of Resource items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux list(List select, String expand) { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - if (select != null) { - for (String paramItemValue : select) { - if (paramItemValue != null) { - requestOptions.addQueryParam("select", paramItemValue, false); - } - } - } - if (expand != null) { - requestOptions.addQueryParam("expand", expand, false); - } - PagedFlux pagedFluxResponse = list(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } - - /** - * Resource list operation template. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of Resource items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux list() { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = list(requestOptions); - return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { - Flux> flux = (continuationTokenParam == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationTokenParam).take(1); - return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), - pagedResponse.getStatusCode(), pagedResponse.getHeaders(), - pagedResponse.getValue() - .stream() - .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), null)); - }); - } - - /** - * Long-running resource create or replace operation template. - * - * @param name The name parameter. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateLongRunning(String name, Resource resource) { - // Generated convenience method for beginCreateLongRunningWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginCreateLongRunningWithModelAsync(name, BinaryData.fromObject(resource), - requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClient.java deleted file mode 100644 index 3b630bf2fd8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClient.java +++ /dev/null @@ -1,284 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.SyncPoller; -import java.util.List; -import tsptest.versioning.implementation.VersioningOpsImpl; -import tsptest.versioning.models.ExportedResource; -import tsptest.versioning.models.Resource; - -/** - * Initializes a new instance of the synchronous VersioningClient type. - */ -@ServiceClient(builder = VersioningClientBuilder.class) -public final class VersioningClient { - @Generated - private final VersioningOpsImpl serviceClient; - - /** - * Initializes an instance of VersioningClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - VersioningClient(VersioningOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Long-running resource action operation template. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         id: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginExport(String name, RequestOptions requestOptions) { - return this.serviceClient.beginExport(name, requestOptions); - } - - /** - * Resource list operation template. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
selectList<String>NoSelect the specified fields to be included in the - * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandStringNoThe expand parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(RequestOptions requestOptions) { - return this.serviceClient.list(requestOptions); - } - - /** - * Long-running resource create or replace operation template. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateLongRunning(String name, BinaryData resource, - RequestOptions requestOptions) { - return this.serviceClient.beginCreateLongRunning(name, resource, requestOptions); - } - - /** - * Long-running resource action operation template. - * - * @param name The name parameter. - * @param projectFileVersion The projectFileVersion parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginExport(String name, String projectFileVersion) { - // Generated convenience method for beginExportWithModel - RequestOptions requestOptions = new RequestOptions(); - if (projectFileVersion != null) { - requestOptions.addQueryParam("projectFileVersion", projectFileVersion, false); - } - return serviceClient.beginExportWithModel(name, requestOptions); - } - - /** - * Long-running resource action operation template. - * - * @param name The name parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginExport(String name) { - // Generated convenience method for beginExportWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginExportWithModel(name, requestOptions); - } - - /** - * Resource list operation template. - * - * @param select Select the specified fields to be included in the response. - * @param expand The expand parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of Resource items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(List select, String expand) { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - if (select != null) { - for (String paramItemValue : select) { - if (paramItemValue != null) { - requestOptions.addQueryParam("select", paramItemValue, false); - } - } - } - if (expand != null) { - requestOptions.addQueryParam("expand", expand, false); - } - return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Resource.class)); - } - - /** - * Resource list operation template. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of Resource items as paginated response with {@link PagedIterable}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Resource.class)); - } - - /** - * Long-running resource create or replace operation template. - * - * @param name The name parameter. - * @param resource The resource instance. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @Generated - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateLongRunning(String name, Resource resource) { - // Generated convenience method for beginCreateLongRunningWithModel - RequestOptions requestOptions = new RequestOptions(); - return serviceClient.beginCreateLongRunningWithModel(name, BinaryData.fromObject(resource), requestOptions); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClientBuilder.java deleted file mode 100644 index 65314f62664..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.versioning.implementation.VersioningClientImpl; - -/** - * A builder for creating a new instance of the VersioningClient type. - */ -@ServiceClientBuilder(serviceClients = { VersioningClient.class, VersioningAsyncClient.class }) -public final class VersioningClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-versioning.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the VersioningClientBuilder. - */ - @Generated - public VersioningClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersioningClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersioningClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersioningClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersioningClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersioningClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersioningClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersioningClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VersioningClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private VersioningServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the VersioningClientBuilder. - */ - @Generated - public VersioningClientBuilder serviceVersion(VersioningServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the VersioningClientBuilder. - */ - @Generated - public VersioningClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of VersioningClientImpl with the provided parameters. - * - * @return an instance of VersioningClientImpl. - */ - @Generated - private VersioningClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - VersioningServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : VersioningServiceVersion.getLatest(); - VersioningClientImpl client = new VersioningClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of VersioningAsyncClient class. - * - * @return an instance of VersioningAsyncClient. - */ - @Generated - public VersioningAsyncClient buildAsyncClient() { - return new VersioningAsyncClient(buildInnerClient().getVersioningOps()); - } - - /** - * Builds an instance of VersioningClient class. - * - * @return an instance of VersioningClient. - */ - @Generated - public VersioningClient buildClient() { - return new VersioningClient(buildInnerClient().getVersioningOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(VersioningClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningServiceVersion.java deleted file mode 100644 index 860989fd31c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningServiceVersion.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of VersioningClient. - */ -public enum VersioningServiceVersion implements ServiceVersion { - /** - * Enum value 2022-09-01. - */ - V2022_09_01("2022-09-01"); - - private final String version; - - VersioningServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link VersioningServiceVersion}. - */ - public static VersioningServiceVersion getLatest() { - return V2022_09_01; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/OperationLocationPollingStrategy.java deleted file mode 100644 index 9b987cbc1de..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/OperationLocationPollingStrategy.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.OperationResourcePollingStrategy; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.time.OffsetDateTime; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -/** - * Implements an operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public Mono> onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - final Mono> pollResponseMono - = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) - .onErrorResume(exception -> { - LOGGER.info("Failed to parse initial response."); - return Mono.empty(); - }) - .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); - return pollResponseMono.switchIfEmpty( - Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); - } else { - return Mono - .error( - new AzureException(String.format( - "Operation failed or cancelled with status code %d," - + ", '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - } - - /** - * {@inheritDoc} - */ - @Override - public Mono getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - return Mono.error(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - return Mono.error(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - return PollingUtils - .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) - .flatMap(value -> { - if (value.get(propertyName) != null) { - return BinaryData.fromObjectAsync(value.get(propertyName)) - .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); - } else { - return Mono.error(new AzureException("Cannot get final result")); - } - }) - .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/PollingUtils.java deleted file mode 100644 index da02ed5c49f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/PollingUtils.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning.implementation; - -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.HttpHeaders; -import com.azure.core.util.BinaryData; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.net.URI; -import java.net.URISyntaxException; -import java.time.DateTimeException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.time.temporal.ChronoUnit; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; -import reactor.core.publisher.Mono; - -// DO NOT modify this helper class - -final class PollingUtils { - - public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE - = new TypeReference>() { - }; - - public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); - - public static final String HTTP_METHOD = "httpMethod"; - public static final String REQUEST_URL = "requestURL"; - public static final String POLL_RESPONSE_BODY = "pollResponseBody"; - - private static final String FORWARD_SLASH = "/"; - - public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { - try { - URI uri = new URI(path); - if (!uri.isAbsolute()) { - if (CoreUtils.isNullOrEmpty(endpoint)) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); - } - - if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { - return endpoint + path.substring(1); - } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { - return endpoint + FORWARD_SLASH + path; - } else { - return endpoint + path; - } - } - } catch (URISyntaxException ex) { - throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); - } - return path; - } - - public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - T value; - if (binaryData == null) { - value = null; - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); - } else { - value = binaryData.toObject(typeReference, serializer); - } - return value; - } - - @SuppressWarnings("unchecked") - public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, - TypeReference typeReference) { - Mono value; - if (binaryData == null) { - value = Mono.empty(); - } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { - // T is BinaryData - value = (Mono) binaryData.toReplayableBinaryDataAsync(); - } else { - value = binaryData.toObjectAsync(typeReference, serializer); - } - return value; - } - - private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); - private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); - - public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { - // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. - Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. - retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); - if (retryDelay != null) { - return retryDelay; - } - - // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then - // attempt to resolve it as an HTTP date (RFC1123). - retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, - headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); - - // Either the retry delay will have been found or it'll be null, null indicates no retry after. - return retryDelay; - } - - private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, - Function delayParser) { - String headerValue = headers.getValue(headerName); - - return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); - } - - private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { - long delaySeconds; - try { - OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); - - delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); - } catch (DateTimeException ex) { - delaySeconds = tryParseLong(value); - } - - return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; - } - - private static long tryParseLong(String value) { - try { - return Long.parseLong(value); - } catch (NumberFormatException ex) { - return -1; - } - } - - private static Duration tryGetDelayMillis(String value) { - long delayMillis = tryParseLong(value); - return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/SyncOperationLocationPollingStrategy.java deleted file mode 100644 index ea54348a6fc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/SyncOperationLocationPollingStrategy.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning.implementation; - -import com.azure.core.exception.AzureException; -import com.azure.core.http.HttpHeader; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.PollingContext; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; -import com.azure.core.util.serializer.JsonSerializerProviders; -import com.azure.core.util.serializer.ObjectSerializer; -import com.azure.core.util.serializer.TypeReference; -import java.io.UncheckedIOException; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Map; - -// DO NOT modify this helper class - -/** - * Implements a synchronous operation location polling strategy, from Operation-Location. - * - * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept - * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be - * kept - */ -public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { - - private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); - - private final ObjectSerializer serializer; - private final String endpoint; - private final String propertyName; - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { - this(pollingStrategyOptions, null); - } - - /** - * Creates an instance of the operation resource polling strategy. - * - * @param pollingStrategyOptions options to configure this polling strategy. - * @param propertyName the name of the property to extract final result. - * @throws NullPointerException if {@code pollingStrategyOptions} is null. - */ - public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { - super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); - this.propertyName = propertyName; - this.endpoint = pollingStrategyOptions.getEndpoint(); - this.serializer = pollingStrategyOptions.getSerializer() != null - ? pollingStrategyOptions.getSerializer() - : JsonSerializerProviders.createInstance(true); - } - - /** - * {@inheritDoc} - */ - @Override - public PollResponse onInitialResponse(Response response, PollingContext pollingContext, - TypeReference pollResponseType) { - // Response is Response - - HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); - if (operationLocationHeader != null) { - pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), - PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); - } - final String httpMethod = response.getRequest().getHttpMethod().name(); - pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); - pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); - - if (response.getStatusCode() == 200 - || response.getStatusCode() == 201 - || response.getStatusCode() == 202 - || response.getStatusCode() == 204) { - final Duration retryAfter - = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); - T initialResponseType = null; - try { - initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, - pollResponseType); - } catch (UncheckedIOException e) { - LOGGER.info("Failed to parse initial response."); - } - return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); - } - - throw LOGGER.logExceptionAsError(new AzureException( - String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", - response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, - response.getValue()))); - } - - /** - * {@inheritDoc} - */ - public U getResult(PollingContext pollingContext, TypeReference resultType) { - if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); - } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { - throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); - } - if (propertyName != null) { - // take the last poll response body from PollingContext, - // and de-serialize the property as final result - BinaryData latestResponseBody - = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); - Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, - PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); - if (pollResult != null && pollResult.get(propertyName) != null) { - return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), - serializer, resultType); - } else { - throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); - } - } else { - return super.getResult(pollingContext, resultType); - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningClientImpl.java deleted file mode 100644 index da38ea6fc40..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningClientImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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; -import tsptest.versioning.VersioningServiceVersion; - -/** - * Initializes a new instance of the VersioningClient type. - */ -public final class VersioningClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final VersioningServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public VersioningServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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 VersioningOpsImpl object to access its operations. - */ - private final VersioningOpsImpl versioningOps; - - /** - * Gets the VersioningOpsImpl object to access its operations. - * - * @return the VersioningOpsImpl object. - */ - public VersioningOpsImpl getVersioningOps() { - return this.versioningOps; - } - - /** - * Initializes an instance of VersioningClient client. - * - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public VersioningClientImpl(String endpoint, VersioningServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of VersioningClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public VersioningClientImpl(HttpPipeline httpPipeline, String endpoint, VersioningServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of VersioningClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - * @param serviceVersion Service version. - */ - public VersioningClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - VersioningServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.versioningOps = new VersioningOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningOpsImpl.java deleted file mode 100644 index b58cb5ea82b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningOpsImpl.java +++ /dev/null @@ -1,1041 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -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.RequestOptions; -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 com.azure.core.util.polling.PollOperationDetails; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.PollingStrategyOptions; -import com.azure.core.util.polling.SyncPoller; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import reactor.core.publisher.Mono; -import tsptest.versioning.VersioningServiceVersion; -import tsptest.versioning.models.ExportedResource; -import tsptest.versioning.models.Resource; - -/** - * An instance of this class provides access to all the operations defined in VersioningOps. - */ -public final class VersioningOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final VersioningOpsService service; - - /** - * The service client containing this operation class. - */ - private final VersioningClientImpl client; - - /** - * Initializes an instance of VersioningOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - VersioningOpsImpl(VersioningClientImpl client) { - this.service - = RestProxy.create(VersioningOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public VersioningServiceVersion getServiceVersion() { - return client.getServiceVersion(); - } - - /** - * The interface defining all the services for VersioningClientVersioningOps to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "VersioningClientVersioningOps") - public interface VersioningOpsService { - @Post("/versioning/resources/{name}:export") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> export(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/versioning/resources/{name}:export") - @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response exportSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/versioning/resources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> list(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/versioning/resources") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/versioning/resources/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> createLongRunning(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); - - @Put("/versioning/resources/{name}") - @ExpectedResponses({ 200, 201 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createLongRunningSync(@HostParam("endpoint") String endpoint, - @QueryParam("api-version") String apiVersion, @PathParam("name") String name, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, - Context context); - } - - /** - * Long-running resource action operation template. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         id: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return provides status details for long running operations along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> exportWithResponseAsync(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.export(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context)); - } - - /** - * Long-running resource action operation template. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         id: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return provides status details for long running operations along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response exportWithResponse(String name, RequestOptions requestOptions) { - final String accept = "application/json"; - return service.exportSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, - requestOptions, Context.NONE); - } - - /** - * Long-running resource action operation template. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         id: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginExportWithModelAsync(String name, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), () -> this.exportWithResponseAsync(name, requestOptions), - new tsptest.versioning.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(PollOperationDetails.class), - TypeReference.createInstance(ExportedResource.class)); - } - - /** - * Long-running resource action operation template. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         id: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginExportWithModel(String name, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.exportWithResponse(name, requestOptions), - new tsptest.versioning.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(PollOperationDetails.class), - TypeReference.createInstance(ExportedResource.class)); - } - - /** - * Long-running resource action operation template. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         id: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginExportAsync(String name, RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), () -> this.exportWithResponseAsync(name, requestOptions), - new tsptest.versioning.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * Long-running resource action operation template. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
-     *     error (Optional): {
-     *         code: String (Required)
-     *         message: String (Required)
-     *         target: String (Optional)
-     *         details (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *         innererror (Optional): {
-     *             code: String (Optional)
-     *             innererror (Optional): (recursive schema, see innererror above)
-     *         }
-     *     }
-     *     result (Optional): {
-     *         id: String (Required)
-     *         resourceUri: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of provides status details for long running operations. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginExport(String name, RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.exportWithResponse(name, requestOptions), - new tsptest.versioning.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion()), - "result"), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * Resource list operation template. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
selectList<String>NoSelect the specified fields to be included in the - * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandStringNoThe expand parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); - } - - /** - * Resource list operation template. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
selectList<String>NoSelect the specified fields to be included in the - * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandStringNoThe expand parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux listAsync(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedFlux<>(() -> listSinglePageAsync(requestOptions), - nextLink -> listNextSinglePageAsync(nextLink, requestOptionsForNextPage)); - } - - /** - * Resource list operation template. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
selectList<String>NoSelect the specified fields to be included in the - * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandStringNoThe expand parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listSinglePage(RequestOptions requestOptions) { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - /** - * Resource list operation template. - *

Query Parameters

- * - * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
selectList<String>NoSelect the specified fields to be included in the - * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandStringNoThe expand parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(RequestOptions requestOptions) { - RequestOptions requestOptionsForNextPage = new RequestOptions(); - requestOptionsForNextPage.setContext( - requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); - return new PagedIterable<>(() -> listSinglePage(requestOptions), - nextLink -> listNextSinglePage(nextLink, requestOptionsForNextPage)); - } - - /** - * Long-running resource create or replace operation template. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createLongRunningWithResponseAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.createLongRunning(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, - context)); - } - - /** - * Long-running resource create or replace operation template. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Response createLongRunningWithResponse(String name, BinaryData resource, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createLongRunningSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), - name, contentType, accept, resource, requestOptions, Context.NONE); - } - - /** - * Long-running resource create or replace operation template. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateLongRunningWithModelAsync(String name, - BinaryData resource, RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.createLongRunningWithResponseAsync(name, resource, requestOptions), - new tsptest.versioning.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion())), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Resource.class)); - } - - /** - * Long-running resource create or replace operation template. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateLongRunningWithModel(String name, BinaryData resource, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.createLongRunningWithResponse(name, resource, requestOptions), - new tsptest.versioning.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion())), - TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Resource.class)); - } - - /** - * Long-running resource create or replace operation template. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link PollerFlux} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginCreateLongRunningAsync(String name, BinaryData resource, - RequestOptions requestOptions) { - return PollerFlux.create(Duration.ofSeconds(1), - () -> this.createLongRunningWithResponseAsync(name, resource, requestOptions), - new tsptest.versioning.implementation.OperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion())), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * Long-running resource create or replace operation template. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param name The name parameter. - * @param resource The resource instance. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link SyncPoller} for polling of long-running operation. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginCreateLongRunning(String name, BinaryData resource, - RequestOptions requestOptions) { - return SyncPoller.createPoller(Duration.ofSeconds(1), - () -> this.createLongRunningWithResponse(name, resource, requestOptions), - new tsptest.versioning.implementation.SyncOperationLocationPollingStrategy<>( - new PollingStrategyOptions(this.client.getHttpPipeline()) - .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) - .setContext(requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.client.getServiceVersion().getVersion())), - TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); - } - - /** - * Get the next page of items. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listNext(nextLink, this.client.getEndpoint(), 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
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
-     * 
- * - * @param nextLink The URL to get the next list of items. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); - } - - private List getValues(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - List values = (List) obj.get(path); - return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); - } catch (RuntimeException e) { - return null; - } - } - - private String getNextLink(BinaryData binaryData, String path) { - try { - Map obj = binaryData.toObject(Map.class); - return (String) obj.get(path); - } catch (RuntimeException e) { - return null; - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/package-info.java deleted file mode 100644 index f4cd4e3fc6b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Versioning. - * - */ -package tsptest.versioning.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/ExportedResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/ExportedResource.java deleted file mode 100644 index 2c784d92eb9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/ExportedResource.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ExportedResource model. - */ -@Immutable -public final class ExportedResource implements JsonSerializable { - /* - * The id property. - */ - @Generated - private final String id; - - /* - * The resourceUri property. - */ - @Generated - private final String resourceUri; - - /** - * Creates an instance of ExportedResource class. - * - * @param id the id value to set. - * @param resourceUri the resourceUri value to set. - */ - @Generated - private ExportedResource(String id, String resourceUri) { - this.id = id; - this.resourceUri = resourceUri; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the resourceUri property: The resourceUri property. - * - * @return the resourceUri value. - */ - @Generated - public String getResourceUri() { - return this.resourceUri; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - jsonWriter.writeStringField("resourceUri", this.resourceUri); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExportedResource from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExportedResource if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExportedResource. - */ - @Generated - public static ExportedResource fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String resourceUri = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("resourceUri".equals(fieldName)) { - resourceUri = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ExportedResource(id, resourceUri); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/Resource.java deleted file mode 100644 index ffc5f78f0d1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/Resource.java +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Resource model. - */ -@Immutable -public final class Resource implements JsonSerializable { - /* - * The id property. - */ - @Generated - private String id; - - /* - * The name property. - */ - @Generated - private String name; - - /* - * The type property. - */ - @Generated - private final String type; - - /** - * Creates an instance of Resource class. - * - * @param type the type value to set. - */ - @Generated - public Resource(String type) { - this.type = type; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the type property: The type property. - * - * @return the type value. - */ - @Generated - public String getType() { - return this.type; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("type", this.type); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Resource from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Resource. - */ - @Generated - public static Resource fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - String name = null; - String type = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("type".equals(fieldName)) { - type = reader.getString(); - } else { - reader.skipChildren(); - } - } - Resource deserializedResource = new Resource(type); - deserializedResource.id = id; - deserializedResource.name = name; - - return deserializedResource; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/package-info.java deleted file mode 100644 index 3bdb891c4e8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Versioning. - * - */ -package tsptest.versioning.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/package-info.java deleted file mode 100644 index a55af2e2824..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Versioning. - * - */ -package tsptest.versioning; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityAsyncClient.java deleted file mode 100644 index 807f5320a48..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityAsyncClient.java +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.visibility.implementation.VisibilityClientImpl; -import tsptest.visibility.models.Dog; -import tsptest.visibility.models.ReadDog; -import tsptest.visibility.models.RoundTripModel; -import tsptest.visibility.models.WriteDog; - -/** - * Initializes a new instance of the asynchronous VisibilityClient type. - */ -@ServiceClient(builder = VisibilityClientBuilder.class, isAsync = true) -public final class VisibilityAsyncClient { - @Generated - private final VisibilityClientImpl serviceClient; - - /** - * Initializes an instance of VisibilityAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - VisibilityAsyncClient(VisibilityClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The create operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createWithResponse(BinaryData dog, RequestOptions requestOptions) { - return this.serviceClient.createWithResponseAsync(dog, requestOptions); - } - - /** - * The query operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> queryWithResponse(BinaryData dog, RequestOptions requestOptions) { - return this.serviceClient.queryWithResponseAsync(dog, requestOptions); - } - - /** - * The roundtrip operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     secretName: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     secretName: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> roundtripWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.roundtripWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); - } - - /** - * The create operation. - * - * @param dog The dog parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono create(WriteDog dog) { - // Generated convenience method for createWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createWithResponse(BinaryData.fromObject(dog), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); - } - - /** - * The query operation. - * - * @param dog The dog parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono query(WriteDog dog) { - // Generated convenience method for queryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return queryWithResponse(BinaryData.fromObject(dog), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ReadDog.class)); - } - - /** - * The roundtrip operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono roundtrip(RoundTripModel body) { - // Generated convenience method for roundtripWithResponse - RequestOptions requestOptions = new RequestOptions(); - return roundtripWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(RoundTripModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClient.java deleted file mode 100644 index a79ed9bd963..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClient.java +++ /dev/null @@ -1,262 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.visibility.implementation.VisibilityClientImpl; -import tsptest.visibility.models.Dog; -import tsptest.visibility.models.ReadDog; -import tsptest.visibility.models.RoundTripModel; -import tsptest.visibility.models.WriteDog; - -/** - * Initializes a new instance of the synchronous VisibilityClient type. - */ -@ServiceClient(builder = VisibilityClientBuilder.class) -public final class VisibilityClient { - @Generated - private final VisibilityClientImpl serviceClient; - - /** - * Initializes an instance of VisibilityClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - VisibilityClient(VisibilityClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The create operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createWithResponse(BinaryData dog, RequestOptions requestOptions) { - return this.serviceClient.createWithResponse(dog, requestOptions); - } - - /** - * The query operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response queryWithResponse(BinaryData dog, RequestOptions requestOptions) { - return this.serviceClient.queryWithResponse(dog, requestOptions); - } - - /** - * The roundtrip operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     secretName: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     secretName: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response roundtripWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.roundtripWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Dog get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(Dog.class); - } - - /** - * The create operation. - * - * @param dog The dog parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Dog create(WriteDog dog) { - // Generated convenience method for createWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createWithResponse(BinaryData.fromObject(dog), requestOptions).getValue().toObject(Dog.class); - } - - /** - * The query operation. - * - * @param dog The dog parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ReadDog query(WriteDog dog) { - // Generated convenience method for queryWithResponse - RequestOptions requestOptions = new RequestOptions(); - return queryWithResponse(BinaryData.fromObject(dog), requestOptions).getValue().toObject(ReadDog.class); - } - - /** - * The roundtrip operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public RoundTripModel roundtrip(RoundTripModel body) { - // Generated convenience method for roundtripWithResponse - RequestOptions requestOptions = new RequestOptions(); - return roundtripWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(RoundTripModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClientBuilder.java deleted file mode 100644 index d1edc5a5fca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClientBuilder.java +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.visibility.implementation.VisibilityClientImpl; - -/** - * A builder for creating a new instance of the VisibilityClient type. - */ -@ServiceClientBuilder( - serviceClients = { - VisibilityClient.class, - VisibilityReadClient.class, - VisibilityWriteClient.class, - VisibilityAsyncClient.class, - VisibilityReadAsyncClient.class, - VisibilityWriteAsyncClient.class }) -public final class VisibilityClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-visibility.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the VisibilityClientBuilder. - */ - @Generated - public VisibilityClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the VisibilityClientBuilder. - */ - @Generated - public VisibilityClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of VisibilityClientImpl with the provided parameters. - * - * @return an instance of VisibilityClientImpl. - */ - @Generated - private VisibilityClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - VisibilityClientImpl client - = new VisibilityClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of VisibilityAsyncClient class. - * - * @return an instance of VisibilityAsyncClient. - */ - @Generated - public VisibilityAsyncClient buildAsyncClient() { - return new VisibilityAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of VisibilityReadAsyncClient class. - * - * @return an instance of VisibilityReadAsyncClient. - */ - @Generated - public VisibilityReadAsyncClient buildVisibilityReadAsyncClient() { - return new VisibilityReadAsyncClient(buildInnerClient().getVisibilityReads()); - } - - /** - * Builds an instance of VisibilityWriteAsyncClient class. - * - * @return an instance of VisibilityWriteAsyncClient. - */ - @Generated - public VisibilityWriteAsyncClient buildVisibilityWriteAsyncClient() { - return new VisibilityWriteAsyncClient(buildInnerClient().getVisibilityWrites()); - } - - /** - * Builds an instance of VisibilityClient class. - * - * @return an instance of VisibilityClient. - */ - @Generated - public VisibilityClient buildClient() { - return new VisibilityClient(buildInnerClient()); - } - - /** - * Builds an instance of VisibilityReadClient class. - * - * @return an instance of VisibilityReadClient. - */ - @Generated - public VisibilityReadClient buildVisibilityReadClient() { - return new VisibilityReadClient(buildInnerClient().getVisibilityReads()); - } - - /** - * Builds an instance of VisibilityWriteClient class. - * - * @return an instance of VisibilityWriteClient. - */ - @Generated - public VisibilityWriteClient buildVisibilityWriteClient() { - return new VisibilityWriteClient(buildInnerClient().getVisibilityWrites()); - } - - private static final ClientLogger LOGGER = new ClientLogger(VisibilityClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadAsyncClient.java deleted file mode 100644 index 90609bbb6bf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadAsyncClient.java +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.visibility.implementation.VisibilityReadsImpl; -import tsptest.visibility.models.Dog; - -/** - * Initializes a new instance of the asynchronous VisibilityClient type. - */ -@ServiceClient(builder = VisibilityClientBuilder.class, isAsync = true) -public final class VisibilityReadAsyncClient { - @Generated - private final VisibilityReadsImpl serviceClient; - - /** - * Initializes an instance of VisibilityReadAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - VisibilityReadAsyncClient(VisibilityReadsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadClient.java deleted file mode 100644 index d6726922eed..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadClient.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.visibility.implementation.VisibilityReadsImpl; -import tsptest.visibility.models.Dog; - -/** - * Initializes a new instance of the synchronous VisibilityClient type. - */ -@ServiceClient(builder = VisibilityClientBuilder.class) -public final class VisibilityReadClient { - @Generated - private final VisibilityReadsImpl serviceClient; - - /** - * Initializes an instance of VisibilityReadClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - VisibilityReadClient(VisibilityReadsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Dog get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(Dog.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteAsyncClient.java deleted file mode 100644 index 7ec5d34a39a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteAsyncClient.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.visibility.implementation.VisibilityWritesImpl; -import tsptest.visibility.models.Dog; -import tsptest.visibility.models.WriteDog; - -/** - * Initializes a new instance of the asynchronous VisibilityClient type. - */ -@ServiceClient(builder = VisibilityClientBuilder.class, isAsync = true) -public final class VisibilityWriteAsyncClient { - @Generated - private final VisibilityWritesImpl serviceClient; - - /** - * Initializes an instance of VisibilityWriteAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - VisibilityWriteAsyncClient(VisibilityWritesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The create operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createWithResponse(BinaryData dog, RequestOptions requestOptions) { - return this.serviceClient.createWithResponseAsync(dog, requestOptions); - } - - /** - * The create operation. - * - * @param dog The dog parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono create(WriteDog dog) { - // Generated convenience method for createWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createWithResponse(BinaryData.fromObject(dog), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteClient.java deleted file mode 100644 index 395be8d0786..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteClient.java +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.visibility.implementation.VisibilityWritesImpl; -import tsptest.visibility.models.Dog; -import tsptest.visibility.models.WriteDog; - -/** - * Initializes a new instance of the synchronous VisibilityClient type. - */ -@ServiceClient(builder = VisibilityClientBuilder.class) -public final class VisibilityWriteClient { - @Generated - private final VisibilityWritesImpl serviceClient; - - /** - * Initializes an instance of VisibilityWriteClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - VisibilityWriteClient(VisibilityWritesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The create operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createWithResponse(BinaryData dog, RequestOptions requestOptions) { - return this.serviceClient.createWithResponse(dog, requestOptions); - } - - /** - * The create operation. - * - * @param dog The dog parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Dog create(WriteDog dog) { - // Generated convenience method for createWithResponse - RequestOptions requestOptions = new RequestOptions(); - return createWithResponse(BinaryData.fromObject(dog), requestOptions).getValue().toObject(Dog.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityClientImpl.java deleted file mode 100644 index 02c3456cc5b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityClientImpl.java +++ /dev/null @@ -1,530 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the VisibilityClient type. - */ -public final class VisibilityClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final VisibilityClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 VisibilityReadsImpl object to access its operations. - */ - private final VisibilityReadsImpl visibilityReads; - - /** - * Gets the VisibilityReadsImpl object to access its operations. - * - * @return the VisibilityReadsImpl object. - */ - public VisibilityReadsImpl getVisibilityReads() { - return this.visibilityReads; - } - - /** - * The VisibilityWritesImpl object to access its operations. - */ - private final VisibilityWritesImpl visibilityWrites; - - /** - * Gets the VisibilityWritesImpl object to access its operations. - * - * @return the VisibilityWritesImpl object. - */ - public VisibilityWritesImpl getVisibilityWrites() { - return this.visibilityWrites; - } - - /** - * Initializes an instance of VisibilityClient client. - * - * @param endpoint Service host. - */ - public VisibilityClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of VisibilityClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public VisibilityClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of VisibilityClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public VisibilityClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.visibilityReads = new VisibilityReadsImpl(this); - this.visibilityWrites = new VisibilityWritesImpl(this); - this.service = RestProxy.create(VisibilityClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for VisibilityClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "VisibilityClient") - public interface VisibilityClientService { - @Get("/visibility/read") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/visibility/read") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/visibility/write") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> create(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); - - @Put("/visibility/write") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); - - @Post("/visibility/query") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> query(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); - - @Post("/visibility/query") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response querySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); - - @Put("/visibility/roundtrip") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> roundtrip(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/visibility/roundtrip") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response roundtripSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The create operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createWithResponseAsync(BinaryData dog, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.create(this.getEndpoint(), contentType, accept, dog, requestOptions, context)); - } - - /** - * The create operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createWithResponse(BinaryData dog, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createSync(this.getEndpoint(), contentType, accept, dog, requestOptions, Context.NONE); - } - - /** - * The query operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> queryWithResponseAsync(BinaryData dog, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.query(this.getEndpoint(), contentType, accept, dog, requestOptions, context)); - } - - /** - * The query operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response queryWithResponse(BinaryData dog, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.querySync(this.getEndpoint(), contentType, accept, dog, requestOptions, Context.NONE); - } - - /** - * The roundtrip operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     secretName: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     secretName: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> roundtripWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.roundtrip(this.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * The roundtrip operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     secretName: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     secretName: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response roundtripWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.roundtripSync(this.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityReadsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityReadsImpl.java deleted file mode 100644 index a4aaaf6cff8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityReadsImpl.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility.implementation; - -import com.azure.core.annotation.ExpectedResponses; -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.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in VisibilityReads. - */ -public final class VisibilityReadsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final VisibilityReadsService service; - - /** - * The service client containing this operation class. - */ - private final VisibilityClientImpl client; - - /** - * Initializes an instance of VisibilityReadsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - VisibilityReadsImpl(VisibilityClientImpl client) { - this.service - = RestProxy.create(VisibilityReadsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for VisibilityClientVisibilityReads to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "VisibilityClientVisibilityReads") - public interface VisibilityReadsService { - @Get("/read") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/read") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityWritesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityWritesImpl.java deleted file mode 100644 index 97a84afde80..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityWritesImpl.java +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in VisibilityWrites. - */ -public final class VisibilityWritesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final VisibilityWritesService service; - - /** - * The service client containing this operation class. - */ - private final VisibilityClientImpl client; - - /** - * Initializes an instance of VisibilityWritesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - VisibilityWritesImpl(VisibilityClientImpl client) { - this.service - = RestProxy.create(VisibilityWritesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for VisibilityClientVisibilityWrites to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "VisibilityClientVisibilityWrites") - public interface VisibilityWritesService { - @Put("/write") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> create(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); - - @Put("/write") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response createSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); - } - - /** - * The create operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createWithResponseAsync(BinaryData dog, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.create(this.client.getEndpoint(), contentType, accept, dog, requestOptions, context)); - } - - /** - * The create operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: int (Required)
-     *     secretName: String (Required)
-     *     name: String (Required)
-     * }
-     * }
-     * 
- * - * @param dog The dog parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createWithResponse(BinaryData dog, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.createSync(this.client.getEndpoint(), contentType, accept, dog, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/package-info.java deleted file mode 100644 index 898d7d80b54..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Visibility. - * - */ -package tsptest.visibility.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/Dog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/Dog.java deleted file mode 100644 index ded904c74cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/Dog.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Dog model. - */ -@Immutable -public final class Dog implements JsonSerializable { - /* - * The id property. - */ - @Generated - private int id; - - /* - * The secretName property. - */ - @Generated - private final String secretName; - - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Dog class. - * - * @param secretName the secretName value to set. - * @param name the name value to set. - */ - @Generated - private Dog(String secretName, String name) { - this.secretName = secretName; - this.name = name; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public int getId() { - return this.id; - } - - /** - * Get the secretName property: The secretName property. - * - * @return the secretName value. - */ - @Generated - public String getSecretName() { - return this.secretName; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("secretName", this.secretName); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Dog from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Dog if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Dog. - */ - @Generated - public static Dog fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int id = 0; - String secretName = null; - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getInt(); - } else if ("secretName".equals(fieldName)) { - secretName = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - Dog deserializedDog = new Dog(secretName, name); - deserializedDog.id = id; - - return deserializedDog; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/ReadDog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/ReadDog.java deleted file mode 100644 index 8247b5bb9a9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/ReadDog.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ReadDog model. - */ -@Immutable -public final class ReadDog implements JsonSerializable { - /* - * The id property. - */ - @Generated - private final int id; - - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of ReadDog class. - * - * @param id the id value to set. - * @param name the name value to set. - */ - @Generated - private ReadDog(int id, String name) { - this.id = id; - this.name = name; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public int getId() { - return this.id; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("id", this.id); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ReadDog from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ReadDog if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ReadDog. - */ - @Generated - public static ReadDog fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int id = 0; - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getInt(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ReadDog(id, name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/RoundTripModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/RoundTripModel.java deleted file mode 100644 index 9f58ba1e352..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/RoundTripModel.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The RoundTripModel model. - */ -@Immutable -public final class RoundTripModel implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /* - * The secretName property. - */ - @Generated - private final String secretName; - - /** - * Creates an instance of RoundTripModel class. - * - * @param name the name value to set. - * @param secretName the secretName value to set. - */ - @Generated - public RoundTripModel(String name, String secretName) { - this.name = name; - this.secretName = secretName; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the secretName property: The secretName property. - * - * @return the secretName value. - */ - @Generated - public String getSecretName() { - return this.secretName; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("secretName", this.secretName); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of RoundTripModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of RoundTripModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the RoundTripModel. - */ - @Generated - public static RoundTripModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - String secretName = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("secretName".equals(fieldName)) { - secretName = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new RoundTripModel(name, secretName); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/WriteDog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/WriteDog.java deleted file mode 100644 index f25f1921d7b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/WriteDog.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The WriteDog model. - */ -@Immutable -public final class WriteDog implements JsonSerializable { - /* - * The secretName property. - */ - @Generated - private final String secretName; - - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of WriteDog class. - * - * @param secretName the secretName value to set. - * @param name the name value to set. - */ - @Generated - public WriteDog(String secretName, String name) { - this.secretName = secretName; - this.name = name; - } - - /** - * Get the secretName property: The secretName property. - * - * @return the secretName value. - */ - @Generated - public String getSecretName() { - return this.secretName; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("secretName", this.secretName); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of WriteDog from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of WriteDog if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the WriteDog. - */ - @Generated - public static WriteDog fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String secretName = null; - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("secretName".equals(fieldName)) { - secretName = reader.getString(); - } else if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new WriteDog(secretName, name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/package-info.java deleted file mode 100644 index 6c2fad59180..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Visibility. - * - */ -package tsptest.visibility.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/package-info.java deleted file mode 100644 index c7c1083359f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Visibility. - * - */ -package tsptest.visibility; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeAsyncClient.java deleted file mode 100644 index 666d435fc72..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeAsyncClient.java +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.wiretype; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import tsptest.wiretype.implementation.WireTypeOpsImpl; -import tsptest.wiretype.models.SubClass; -import tsptest.wiretype.models.SubClassBothMismatch; -import tsptest.wiretype.models.SubClassMismatch; - -/** - * Initializes a new instance of the asynchronous WireTypeClient type. - */ -@ServiceClient(builder = WireTypeClientBuilder.class, isAsync = true) -public final class WireTypeAsyncClient { - @Generated - private final WireTypeOpsImpl serviceClient; - - /** - * Initializes an instance of WireTypeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - WireTypeAsyncClient(WireTypeOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The superClassMismatch operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     dateTime: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     dateTime: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> superClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.superClassMismatchWithResponseAsync(body, requestOptions); - } - - /** - * The subClassMismatch operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTime: OffsetDateTime (Required)
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTime: OffsetDateTime (Required)
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> subClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.subClassMismatchWithResponseAsync(body, requestOptions); - } - - /** - * The bothClassMismatch operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     base64url: Base64Url (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     base64url: Base64Url (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> bothClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.bothClassMismatchWithResponseAsync(body, requestOptions); - } - - /** - * The superClassMismatch operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono superClassMismatch(SubClass body) { - // Generated convenience method for superClassMismatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - return superClassMismatchWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SubClass.class)); - } - - /** - * The subClassMismatch operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono subClassMismatch(SubClassMismatch body) { - // Generated convenience method for subClassMismatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - return subClassMismatchWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SubClassMismatch.class)); - } - - /** - * The bothClassMismatch operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono bothClassMismatch(SubClassBothMismatch body) { - // Generated convenience method for bothClassMismatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - return bothClassMismatchWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SubClassBothMismatch.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClient.java deleted file mode 100644 index 35b647d8d0a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClient.java +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.wiretype; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import tsptest.wiretype.implementation.WireTypeOpsImpl; -import tsptest.wiretype.models.SubClass; -import tsptest.wiretype.models.SubClassBothMismatch; -import tsptest.wiretype.models.SubClassMismatch; - -/** - * Initializes a new instance of the synchronous WireTypeClient type. - */ -@ServiceClient(builder = WireTypeClientBuilder.class) -public final class WireTypeClient { - @Generated - private final WireTypeOpsImpl serviceClient; - - /** - * Initializes an instance of WireTypeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - WireTypeClient(WireTypeOpsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The superClassMismatch operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     dateTime: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     dateTime: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response superClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.superClassMismatchWithResponse(body, requestOptions); - } - - /** - * The subClassMismatch operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTime: OffsetDateTime (Required)
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTime: OffsetDateTime (Required)
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response subClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.subClassMismatchWithResponse(body, requestOptions); - } - - /** - * The bothClassMismatch operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     base64url: Base64Url (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     base64url: Base64Url (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response bothClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.bothClassMismatchWithResponse(body, requestOptions); - } - - /** - * The superClassMismatch operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SubClass superClassMismatch(SubClass body) { - // Generated convenience method for superClassMismatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - return superClassMismatchWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(SubClass.class); - } - - /** - * The subClassMismatch operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SubClassMismatch subClassMismatch(SubClassMismatch body) { - // Generated convenience method for subClassMismatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - return subClassMismatchWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(SubClassMismatch.class); - } - - /** - * The bothClassMismatch operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SubClassBothMismatch bothClassMismatch(SubClassBothMismatch body) { - // Generated convenience method for bothClassMismatchWithResponse - RequestOptions requestOptions = new RequestOptions(); - return bothClassMismatchWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(SubClassBothMismatch.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClientBuilder.java deleted file mode 100644 index 2d6f06bdacf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.wiretype; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import tsptest.wiretype.implementation.WireTypeClientImpl; - -/** - * A builder for creating a new instance of the WireTypeClient type. - */ -@ServiceClientBuilder(serviceClients = { WireTypeClient.class, WireTypeAsyncClient.class }) -public final class WireTypeClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-wiretype.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the WireTypeClientBuilder. - */ - @Generated - public WireTypeClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public WireTypeClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public WireTypeClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public WireTypeClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public WireTypeClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public WireTypeClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public WireTypeClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public WireTypeClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public WireTypeClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the WireTypeClientBuilder. - */ - @Generated - public WireTypeClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of WireTypeClientImpl with the provided parameters. - * - * @return an instance of WireTypeClientImpl. - */ - @Generated - private WireTypeClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - WireTypeClientImpl client - = new WireTypeClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of WireTypeAsyncClient class. - * - * @return an instance of WireTypeAsyncClient. - */ - @Generated - public WireTypeAsyncClient buildAsyncClient() { - return new WireTypeAsyncClient(buildInnerClient().getWireTypeOps()); - } - - /** - * Builds an instance of WireTypeClient class. - * - * @return an instance of WireTypeClient. - */ - @Generated - public WireTypeClient buildClient() { - return new WireTypeClient(buildInnerClient().getWireTypeOps()); - } - - private static final ClientLogger LOGGER = new ClientLogger(WireTypeClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeClientImpl.java deleted file mode 100644 index b64d26f0c14..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.wiretype.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 WireTypeClient type. - */ -public final class WireTypeClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 WireTypeOpsImpl object to access its operations. - */ - private final WireTypeOpsImpl wireTypeOps; - - /** - * Gets the WireTypeOpsImpl object to access its operations. - * - * @return the WireTypeOpsImpl object. - */ - public WireTypeOpsImpl getWireTypeOps() { - return this.wireTypeOps; - } - - /** - * Initializes an instance of WireTypeClient client. - * - * @param endpoint Service host. - */ - public WireTypeClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of WireTypeClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public WireTypeClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of WireTypeClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public WireTypeClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.wireTypeOps = new WireTypeOpsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeOpsImpl.java deleted file mode 100644 index 5ed40acce71..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeOpsImpl.java +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.wiretype.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in WireTypeOps. - */ -public final class WireTypeOpsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final WireTypeOpsService service; - - /** - * The service client containing this operation class. - */ - private final WireTypeClientImpl client; - - /** - * Initializes an instance of WireTypeOpsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - WireTypeOpsImpl(WireTypeClientImpl client) { - this.service - = RestProxy.create(WireTypeOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for WireTypeClientWireTypeOps to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "WireTypeClientWireTypeOps") - public interface WireTypeOpsService { - @Put("/wireType/superClassMismatch") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> superClassMismatch(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/wireType/superClassMismatch") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response superClassMismatchSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/wireType/subClassMismatch") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> subClassMismatch(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/wireType/subClassMismatch") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response subClassMismatchSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/wireType/bothClassMismatch") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> bothClassMismatch(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Put("/wireType/bothClassMismatch") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response bothClassMismatchSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The superClassMismatch operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     dateTime: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     dateTime: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> superClassMismatchWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.superClassMismatch(this.client.getEndpoint(), contentType, - accept, body, requestOptions, context)); - } - - /** - * The superClassMismatch operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     dateTime: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     dateTime: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response superClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.superClassMismatchSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The subClassMismatch operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTime: OffsetDateTime (Required)
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTime: OffsetDateTime (Required)
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> subClassMismatchWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.subClassMismatch(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The subClassMismatch operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTime: OffsetDateTime (Required)
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTime: OffsetDateTime (Required)
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response subClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.subClassMismatchSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } - - /** - * The bothClassMismatch operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     base64url: Base64Url (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     base64url: Base64Url (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> bothClassMismatchWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.bothClassMismatch(this.client.getEndpoint(), contentType, accept, - body, requestOptions, context)); - } - - /** - * The bothClassMismatch operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     base64url: Base64Url (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
-     *     base64url: Base64Url (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response bothClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.bothClassMismatchSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/package-info.java deleted file mode 100644 index e8522fb09bc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for WireType. - * Test for mismatch of wire type and client type on class constructors. - * - */ -package tsptest.wiretype.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClass.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClass.java deleted file mode 100644 index 1a6b9950751..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClass.java +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.wiretype.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Objects; - -/** - * The SubClass model. - */ -@Immutable -public final class SubClass extends SuperClassMismatch { - /* - * The dateTime property. - */ - @Generated - private final OffsetDateTime dateTime; - - /** - * Creates an instance of SubClass class. - * - * @param dateTimeRfc7231 the dateTimeRfc7231 value to set. - * @param dateTime the dateTime value to set. - */ - @Generated - public SubClass(OffsetDateTime dateTimeRfc7231, OffsetDateTime dateTime) { - super(dateTimeRfc7231); - this.dateTime = dateTime; - } - - /** - * Get the dateTime property: The dateTime property. - * - * @return the dateTime value. - */ - @Generated - public OffsetDateTime getDateTime() { - return this.dateTime; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (getDateTimeRfc7231() != null) { - jsonWriter.writeStringField("dateTimeRfc7231", - Objects.toString(new DateTimeRfc1123(getDateTimeRfc7231()), null)); - } - jsonWriter.writeStringField("dateTime", - this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubClass from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubClass if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SubClass. - */ - @Generated - public static SubClass fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OffsetDateTime dateTimeRfc7231 = null; - OffsetDateTime dateTime = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("dateTimeRfc7231".equals(fieldName)) { - DateTimeRfc1123 dateTimeRfc7231Holder - = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); - if (dateTimeRfc7231Holder != null) { - dateTimeRfc7231 = dateTimeRfc7231Holder.getDateTime(); - } - } else if ("dateTime".equals(fieldName)) { - dateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new SubClass(dateTimeRfc7231, dateTime); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassBothMismatch.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassBothMismatch.java deleted file mode 100644 index 24ab87dce2b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassBothMismatch.java +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.wiretype.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.Base64Url; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Objects; - -/** - * The SubClassBothMismatch model. - */ -@Immutable -public final class SubClassBothMismatch extends SuperClassMismatch { - /* - * The base64url property. - */ - @Generated - private final Base64Url base64url; - - /** - * Creates an instance of SubClassBothMismatch class. - * - * @param dateTimeRfc7231 the dateTimeRfc7231 value to set. - * @param base64url the base64url value to set. - */ - @Generated - public SubClassBothMismatch(OffsetDateTime dateTimeRfc7231, byte[] base64url) { - super(dateTimeRfc7231); - if (base64url == null) { - this.base64url = null; - } else { - this.base64url = Base64Url.encode(base64url); - } - } - - /** - * Get the base64url property: The base64url property. - * - * @return the base64url value. - */ - @Generated - public byte[] getBase64url() { - if (this.base64url == null) { - return null; - } - return this.base64url.decodedBytes(); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (getDateTimeRfc7231() != null) { - jsonWriter.writeStringField("dateTimeRfc7231", - Objects.toString(new DateTimeRfc1123(getDateTimeRfc7231()), null)); - } - jsonWriter.writeStringField("base64url", Objects.toString(this.base64url, null)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubClassBothMismatch from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubClassBothMismatch if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SubClassBothMismatch. - */ - @Generated - public static SubClassBothMismatch fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OffsetDateTime dateTimeRfc7231 = null; - byte[] base64url = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("dateTimeRfc7231".equals(fieldName)) { - DateTimeRfc1123 dateTimeRfc7231Holder - = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); - if (dateTimeRfc7231Holder != null) { - dateTimeRfc7231 = dateTimeRfc7231Holder.getDateTime(); - } - } else if ("base64url".equals(fieldName)) { - Base64Url base64urlHolder - = reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); - if (base64urlHolder != null) { - base64url = base64urlHolder.decodedBytes(); - } - } else { - reader.skipChildren(); - } - } - return new SubClassBothMismatch(dateTimeRfc7231, base64url); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassMismatch.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassMismatch.java deleted file mode 100644 index f2150e44a93..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassMismatch.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.wiretype.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Objects; - -/** - * The SubClassMismatch model. - */ -@Immutable -public final class SubClassMismatch extends SuperClass { - /* - * The dateTimeRfc7231 property. - */ - @Generated - private final DateTimeRfc1123 dateTimeRfc7231; - - /** - * Creates an instance of SubClassMismatch class. - * - * @param dateTime the dateTime value to set. - * @param dateTimeRfc7231 the dateTimeRfc7231 value to set. - */ - @Generated - public SubClassMismatch(OffsetDateTime dateTime, OffsetDateTime dateTimeRfc7231) { - super(dateTime); - if (dateTimeRfc7231 == null) { - this.dateTimeRfc7231 = null; - } else { - this.dateTimeRfc7231 = new DateTimeRfc1123(dateTimeRfc7231); - } - } - - /** - * Get the dateTimeRfc7231 property: The dateTimeRfc7231 property. - * - * @return the dateTimeRfc7231 value. - */ - @Generated - public OffsetDateTime getDateTimeRfc7231() { - if (this.dateTimeRfc7231 == null) { - return null; - } - return this.dateTimeRfc7231.getDateTime(); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("dateTime", - getDateTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getDateTime())); - jsonWriter.writeStringField("dateTimeRfc7231", Objects.toString(this.dateTimeRfc7231, null)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SubClassMismatch from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SubClassMismatch if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SubClassMismatch. - */ - @Generated - public static SubClassMismatch fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OffsetDateTime dateTime = null; - OffsetDateTime dateTimeRfc7231 = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("dateTime".equals(fieldName)) { - dateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("dateTimeRfc7231".equals(fieldName)) { - DateTimeRfc1123 dateTimeRfc7231Holder - = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); - if (dateTimeRfc7231Holder != null) { - dateTimeRfc7231 = dateTimeRfc7231Holder.getDateTime(); - } - } else { - reader.skipChildren(); - } - } - return new SubClassMismatch(dateTime, dateTimeRfc7231); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClass.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClass.java deleted file mode 100644 index ff699da09be..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClass.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.wiretype.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; - -/** - * The SuperClass model. - */ -@Immutable -public class SuperClass implements JsonSerializable { - /* - * The dateTime property. - */ - @Generated - private final OffsetDateTime dateTime; - - /** - * Creates an instance of SuperClass class. - * - * @param dateTime the dateTime value to set. - */ - @Generated - public SuperClass(OffsetDateTime dateTime) { - this.dateTime = dateTime; - } - - /** - * Get the dateTime property: The dateTime property. - * - * @return the dateTime value. - */ - @Generated - public OffsetDateTime getDateTime() { - return this.dateTime; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("dateTime", - this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SuperClass from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SuperClass if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SuperClass. - */ - @Generated - public static SuperClass fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OffsetDateTime dateTime = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("dateTime".equals(fieldName)) { - dateTime = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new SuperClass(dateTime); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClassMismatch.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClassMismatch.java deleted file mode 100644 index 7a87e91cd3a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClassMismatch.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.wiretype.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.DateTimeRfc1123; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Objects; - -/** - * The SuperClassMismatch model. - */ -@Immutable -public class SuperClassMismatch implements JsonSerializable { - /* - * The dateTimeRfc7231 property. - */ - @Generated - private final DateTimeRfc1123 dateTimeRfc7231; - - /** - * Creates an instance of SuperClassMismatch class. - * - * @param dateTimeRfc7231 the dateTimeRfc7231 value to set. - */ - @Generated - public SuperClassMismatch(OffsetDateTime dateTimeRfc7231) { - if (dateTimeRfc7231 == null) { - this.dateTimeRfc7231 = null; - } else { - this.dateTimeRfc7231 = new DateTimeRfc1123(dateTimeRfc7231); - } - } - - /** - * Get the dateTimeRfc7231 property: The dateTimeRfc7231 property. - * - * @return the dateTimeRfc7231 value. - */ - @Generated - public OffsetDateTime getDateTimeRfc7231() { - if (this.dateTimeRfc7231 == null) { - return null; - } - return this.dateTimeRfc7231.getDateTime(); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("dateTimeRfc7231", Objects.toString(this.dateTimeRfc7231, null)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SuperClassMismatch from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SuperClassMismatch if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SuperClassMismatch. - */ - @Generated - public static SuperClassMismatch fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OffsetDateTime dateTimeRfc7231 = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("dateTimeRfc7231".equals(fieldName)) { - DateTimeRfc1123 dateTimeRfc7231Holder - = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); - if (dateTimeRfc7231Holder != null) { - dateTimeRfc7231 = dateTimeRfc7231Holder.getDateTime(); - } - } else { - reader.skipChildren(); - } - } - return new SuperClassMismatch(dateTimeRfc7231); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/package-info.java deleted file mode 100644 index 5f78f933966..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for WireType. - * Test for mismatch of wire type and client type on class constructors. - * - */ -package tsptest.wiretype.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/package-info.java deleted file mode 100644 index 57796558c83..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for WireType. - * Test for mismatch of wire type and client type on class constructors. - * - */ -package tsptest.wiretype; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ArrayClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ArrayClientBuilder.java deleted file mode 100644 index 3a6fe7df9d3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ArrayClientBuilder.java +++ /dev/null @@ -1,576 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.array.implementation.ArrayClientImpl; - -/** - * A builder for creating a new instance of the ArrayClient type. - */ -@ServiceClientBuilder( - serviceClients = { - Int32ValueClient.class, - Int64ValueClient.class, - BooleanValueClient.class, - StringValueClient.class, - Float32ValueClient.class, - DatetimeValueClient.class, - DurationValueClient.class, - UnknownValueClient.class, - ModelValueClient.class, - NullableFloatValueClient.class, - NullableInt32ValueClient.class, - NullableBooleanValueClient.class, - NullableStringValueClient.class, - NullableModelValueClient.class, - Int32ValueAsyncClient.class, - Int64ValueAsyncClient.class, - BooleanValueAsyncClient.class, - StringValueAsyncClient.class, - Float32ValueAsyncClient.class, - DatetimeValueAsyncClient.class, - DurationValueAsyncClient.class, - UnknownValueAsyncClient.class, - ModelValueAsyncClient.class, - NullableFloatValueAsyncClient.class, - NullableInt32ValueAsyncClient.class, - NullableBooleanValueAsyncClient.class, - NullableStringValueAsyncClient.class, - NullableModelValueAsyncClient.class }) -public final class ArrayClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("type-array.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ArrayClientBuilder. - */ - @Generated - public ArrayClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ArrayClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ArrayClientBuilder. - */ - @Generated - public ArrayClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ArrayClientImpl with the provided parameters. - * - * @return an instance of ArrayClientImpl. - */ - @Generated - private ArrayClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ArrayClientImpl client - = new ArrayClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of Int32ValueAsyncClient class. - * - * @return an instance of Int32ValueAsyncClient. - */ - @Generated - public Int32ValueAsyncClient buildInt32ValueAsyncClient() { - return new Int32ValueAsyncClient(buildInnerClient().getInt32Values()); - } - - /** - * Builds an instance of Int64ValueAsyncClient class. - * - * @return an instance of Int64ValueAsyncClient. - */ - @Generated - public Int64ValueAsyncClient buildInt64ValueAsyncClient() { - return new Int64ValueAsyncClient(buildInnerClient().getInt64Values()); - } - - /** - * Builds an instance of BooleanValueAsyncClient class. - * - * @return an instance of BooleanValueAsyncClient. - */ - @Generated - public BooleanValueAsyncClient buildBooleanValueAsyncClient() { - return new BooleanValueAsyncClient(buildInnerClient().getBooleanValues()); - } - - /** - * Builds an instance of StringValueAsyncClient class. - * - * @return an instance of StringValueAsyncClient. - */ - @Generated - public StringValueAsyncClient buildStringValueAsyncClient() { - return new StringValueAsyncClient(buildInnerClient().getStringValues()); - } - - /** - * Builds an instance of Float32ValueAsyncClient class. - * - * @return an instance of Float32ValueAsyncClient. - */ - @Generated - public Float32ValueAsyncClient buildFloat32ValueAsyncClient() { - return new Float32ValueAsyncClient(buildInnerClient().getFloat32Values()); - } - - /** - * Builds an instance of DatetimeValueAsyncClient class. - * - * @return an instance of DatetimeValueAsyncClient. - */ - @Generated - public DatetimeValueAsyncClient buildDatetimeValueAsyncClient() { - return new DatetimeValueAsyncClient(buildInnerClient().getDatetimeValues()); - } - - /** - * Builds an instance of DurationValueAsyncClient class. - * - * @return an instance of DurationValueAsyncClient. - */ - @Generated - public DurationValueAsyncClient buildDurationValueAsyncClient() { - return new DurationValueAsyncClient(buildInnerClient().getDurationValues()); - } - - /** - * Builds an instance of UnknownValueAsyncClient class. - * - * @return an instance of UnknownValueAsyncClient. - */ - @Generated - public UnknownValueAsyncClient buildUnknownValueAsyncClient() { - return new UnknownValueAsyncClient(buildInnerClient().getUnknownValues()); - } - - /** - * Builds an instance of ModelValueAsyncClient class. - * - * @return an instance of ModelValueAsyncClient. - */ - @Generated - public ModelValueAsyncClient buildModelValueAsyncClient() { - return new ModelValueAsyncClient(buildInnerClient().getModelValues()); - } - - /** - * Builds an instance of NullableFloatValueAsyncClient class. - * - * @return an instance of NullableFloatValueAsyncClient. - */ - @Generated - public NullableFloatValueAsyncClient buildNullableFloatValueAsyncClient() { - return new NullableFloatValueAsyncClient(buildInnerClient().getNullableFloatValues()); - } - - /** - * Builds an instance of NullableInt32ValueAsyncClient class. - * - * @return an instance of NullableInt32ValueAsyncClient. - */ - @Generated - public NullableInt32ValueAsyncClient buildNullableInt32ValueAsyncClient() { - return new NullableInt32ValueAsyncClient(buildInnerClient().getNullableInt32Values()); - } - - /** - * Builds an instance of NullableBooleanValueAsyncClient class. - * - * @return an instance of NullableBooleanValueAsyncClient. - */ - @Generated - public NullableBooleanValueAsyncClient buildNullableBooleanValueAsyncClient() { - return new NullableBooleanValueAsyncClient(buildInnerClient().getNullableBooleanValues()); - } - - /** - * Builds an instance of NullableStringValueAsyncClient class. - * - * @return an instance of NullableStringValueAsyncClient. - */ - @Generated - public NullableStringValueAsyncClient buildNullableStringValueAsyncClient() { - return new NullableStringValueAsyncClient(buildInnerClient().getNullableStringValues()); - } - - /** - * Builds an instance of NullableModelValueAsyncClient class. - * - * @return an instance of NullableModelValueAsyncClient. - */ - @Generated - public NullableModelValueAsyncClient buildNullableModelValueAsyncClient() { - return new NullableModelValueAsyncClient(buildInnerClient().getNullableModelValues()); - } - - /** - * Builds an instance of Int32ValueClient class. - * - * @return an instance of Int32ValueClient. - */ - @Generated - public Int32ValueClient buildInt32ValueClient() { - return new Int32ValueClient(buildInnerClient().getInt32Values()); - } - - /** - * Builds an instance of Int64ValueClient class. - * - * @return an instance of Int64ValueClient. - */ - @Generated - public Int64ValueClient buildInt64ValueClient() { - return new Int64ValueClient(buildInnerClient().getInt64Values()); - } - - /** - * Builds an instance of BooleanValueClient class. - * - * @return an instance of BooleanValueClient. - */ - @Generated - public BooleanValueClient buildBooleanValueClient() { - return new BooleanValueClient(buildInnerClient().getBooleanValues()); - } - - /** - * Builds an instance of StringValueClient class. - * - * @return an instance of StringValueClient. - */ - @Generated - public StringValueClient buildStringValueClient() { - return new StringValueClient(buildInnerClient().getStringValues()); - } - - /** - * Builds an instance of Float32ValueClient class. - * - * @return an instance of Float32ValueClient. - */ - @Generated - public Float32ValueClient buildFloat32ValueClient() { - return new Float32ValueClient(buildInnerClient().getFloat32Values()); - } - - /** - * Builds an instance of DatetimeValueClient class. - * - * @return an instance of DatetimeValueClient. - */ - @Generated - public DatetimeValueClient buildDatetimeValueClient() { - return new DatetimeValueClient(buildInnerClient().getDatetimeValues()); - } - - /** - * Builds an instance of DurationValueClient class. - * - * @return an instance of DurationValueClient. - */ - @Generated - public DurationValueClient buildDurationValueClient() { - return new DurationValueClient(buildInnerClient().getDurationValues()); - } - - /** - * Builds an instance of UnknownValueClient class. - * - * @return an instance of UnknownValueClient. - */ - @Generated - public UnknownValueClient buildUnknownValueClient() { - return new UnknownValueClient(buildInnerClient().getUnknownValues()); - } - - /** - * Builds an instance of ModelValueClient class. - * - * @return an instance of ModelValueClient. - */ - @Generated - public ModelValueClient buildModelValueClient() { - return new ModelValueClient(buildInnerClient().getModelValues()); - } - - /** - * Builds an instance of NullableFloatValueClient class. - * - * @return an instance of NullableFloatValueClient. - */ - @Generated - public NullableFloatValueClient buildNullableFloatValueClient() { - return new NullableFloatValueClient(buildInnerClient().getNullableFloatValues()); - } - - /** - * Builds an instance of NullableInt32ValueClient class. - * - * @return an instance of NullableInt32ValueClient. - */ - @Generated - public NullableInt32ValueClient buildNullableInt32ValueClient() { - return new NullableInt32ValueClient(buildInnerClient().getNullableInt32Values()); - } - - /** - * Builds an instance of NullableBooleanValueClient class. - * - * @return an instance of NullableBooleanValueClient. - */ - @Generated - public NullableBooleanValueClient buildNullableBooleanValueClient() { - return new NullableBooleanValueClient(buildInnerClient().getNullableBooleanValues()); - } - - /** - * Builds an instance of NullableStringValueClient class. - * - * @return an instance of NullableStringValueClient. - */ - @Generated - public NullableStringValueClient buildNullableStringValueClient() { - return new NullableStringValueClient(buildInnerClient().getNullableStringValues()); - } - - /** - * Builds an instance of NullableModelValueClient class. - * - * @return an instance of NullableModelValueClient. - */ - @Generated - public NullableModelValueClient buildNullableModelValueClient() { - return new NullableModelValueClient(buildInnerClient().getNullableModelValues()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ArrayClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueAsyncClient.java deleted file mode 100644 index 9bbf1671c6b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueAsyncClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.BooleanValuesImpl; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class BooleanValueAsyncClient { - @Generated - private final BooleanValuesImpl serviceClient; - - /** - * Initializes an instance of BooleanValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BooleanValueAsyncClient(BooleanValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_BOOLEAN)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_BOOLEAN = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueClient.java deleted file mode 100644 index e3d731f5b6c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import type.array.implementation.BooleanValuesImpl; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class BooleanValueClient { - @Generated - private final BooleanValuesImpl serviceClient; - - /** - * Initializes an instance of BooleanValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BooleanValueClient(BooleanValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_BOOLEAN); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_BOOLEAN = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueAsyncClient.java deleted file mode 100644 index cb1702e76de..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueAsyncClient.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.time.OffsetDateTime; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.DatetimeValuesImpl; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class DatetimeValueAsyncClient { - @Generated - private final DatetimeValuesImpl serviceClient; - - /** - * Initializes an instance of DatetimeValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DatetimeValueAsyncClient(DatetimeValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     OffsetDateTime (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     OffsetDateTime (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_OFFSET_DATE_TIME)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_OFFSET_DATE_TIME - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueClient.java deleted file mode 100644 index 44734afc6b7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueClient.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.time.OffsetDateTime; -import java.util.List; -import type.array.implementation.DatetimeValuesImpl; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class DatetimeValueClient { - @Generated - private final DatetimeValuesImpl serviceClient; - - /** - * Initializes an instance of DatetimeValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DatetimeValueClient(DatetimeValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     OffsetDateTime (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     OffsetDateTime (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_OFFSET_DATE_TIME); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_OFFSET_DATE_TIME - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueAsyncClient.java deleted file mode 100644 index 8d6f9523d03..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueAsyncClient.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.DurationValuesImpl; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class DurationValueAsyncClient { - @Generated - private final DurationValuesImpl serviceClient; - - /** - * Initializes an instance of DurationValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DurationValueAsyncClient(DurationValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     Duration (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     Duration (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_DURATION)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_DURATION - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueClient.java deleted file mode 100644 index b3ba03b23bc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueClient.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.util.List; -import type.array.implementation.DurationValuesImpl; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class DurationValueClient { - @Generated - private final DurationValuesImpl serviceClient; - - /** - * Initializes an instance of DurationValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DurationValueClient(DurationValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     Duration (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     Duration (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_DURATION); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_DURATION - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueAsyncClient.java deleted file mode 100644 index a1386b1c24e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueAsyncClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.Float32ValuesImpl; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class Float32ValueAsyncClient { - @Generated - private final Float32ValuesImpl serviceClient; - - /** - * Initializes an instance of Float32ValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Float32ValueAsyncClient(Float32ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_DOUBLE)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_DOUBLE = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueClient.java deleted file mode 100644 index 608520729dc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import type.array.implementation.Float32ValuesImpl; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class Float32ValueClient { - @Generated - private final Float32ValuesImpl serviceClient; - - /** - * Initializes an instance of Float32ValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Float32ValueClient(Float32ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_DOUBLE); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_DOUBLE = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueAsyncClient.java deleted file mode 100644 index 0a837dad9ef..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueAsyncClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.Int32ValuesImpl; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class Int32ValueAsyncClient { - @Generated - private final Int32ValuesImpl serviceClient; - - /** - * Initializes an instance of Int32ValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Int32ValueAsyncClient(Int32ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_INTEGER)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_INTEGER = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueClient.java deleted file mode 100644 index 305700f8374..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import type.array.implementation.Int32ValuesImpl; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class Int32ValueClient { - @Generated - private final Int32ValuesImpl serviceClient; - - /** - * Initializes an instance of Int32ValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Int32ValueClient(Int32ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_INTEGER); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_INTEGER = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueAsyncClient.java deleted file mode 100644 index 34d07aa6663..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueAsyncClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.Int64ValuesImpl; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class Int64ValueAsyncClient { - @Generated - private final Int64ValuesImpl serviceClient; - - /** - * Initializes an instance of Int64ValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Int64ValueAsyncClient(Int64ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     long (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     long (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_LONG)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_LONG = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueClient.java deleted file mode 100644 index cfb8b0a58a7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import type.array.implementation.Int64ValuesImpl; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class Int64ValueClient { - @Generated - private final Int64ValuesImpl serviceClient; - - /** - * Initializes an instance of Int64ValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Int64ValueClient(Int64ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     long (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     long (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_LONG); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_LONG = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueAsyncClient.java deleted file mode 100644 index bc5ade7e421..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueAsyncClient.java +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.ModelValuesImpl; -import type.array.models.InnerModel; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class ModelValueAsyncClient { - @Generated - private final ModelValuesImpl serviceClient; - - /** - * Initializes an instance of ModelValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelValueAsyncClient(ModelValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_INNER_MODEL)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_INNER_MODEL - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueClient.java deleted file mode 100644 index be1be233064..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueClient.java +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import type.array.implementation.ModelValuesImpl; -import type.array.models.InnerModel; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class ModelValueClient { - @Generated - private final ModelValuesImpl serviceClient; - - /** - * Initializes an instance of ModelValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelValueClient(ModelValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_INNER_MODEL); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_INNER_MODEL - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueAsyncClient.java deleted file mode 100644 index 888d98930fa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueAsyncClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.NullableBooleanValuesImpl; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class NullableBooleanValueAsyncClient { - @Generated - private final NullableBooleanValuesImpl serviceClient; - - /** - * Initializes an instance of NullableBooleanValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NullableBooleanValueAsyncClient(NullableBooleanValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_BOOLEAN)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_BOOLEAN = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueClient.java deleted file mode 100644 index 5e483140a5c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import type.array.implementation.NullableBooleanValuesImpl; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class NullableBooleanValueClient { - @Generated - private final NullableBooleanValuesImpl serviceClient; - - /** - * Initializes an instance of NullableBooleanValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NullableBooleanValueClient(NullableBooleanValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_BOOLEAN); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_BOOLEAN = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueAsyncClient.java deleted file mode 100644 index 18038c63a41..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueAsyncClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.NullableFloatValuesImpl; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class NullableFloatValueAsyncClient { - @Generated - private final NullableFloatValuesImpl serviceClient; - - /** - * Initializes an instance of NullableFloatValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NullableFloatValueAsyncClient(NullableFloatValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_DOUBLE)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_DOUBLE = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueClient.java deleted file mode 100644 index 0b51260004d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import type.array.implementation.NullableFloatValuesImpl; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class NullableFloatValueClient { - @Generated - private final NullableFloatValuesImpl serviceClient; - - /** - * Initializes an instance of NullableFloatValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NullableFloatValueClient(NullableFloatValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_DOUBLE); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_DOUBLE = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueAsyncClient.java deleted file mode 100644 index fe69a1dcdc2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueAsyncClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.NullableInt32ValuesImpl; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class NullableInt32ValueAsyncClient { - @Generated - private final NullableInt32ValuesImpl serviceClient; - - /** - * Initializes an instance of NullableInt32ValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NullableInt32ValueAsyncClient(NullableInt32ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_INTEGER)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_INTEGER = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueClient.java deleted file mode 100644 index 6e035666975..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import type.array.implementation.NullableInt32ValuesImpl; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class NullableInt32ValueClient { - @Generated - private final NullableInt32ValuesImpl serviceClient; - - /** - * Initializes an instance of NullableInt32ValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NullableInt32ValueClient(NullableInt32ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_INTEGER); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_INTEGER = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueAsyncClient.java deleted file mode 100644 index c927f36fddc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueAsyncClient.java +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.NullableModelValuesImpl; -import type.array.models.InnerModel; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class NullableModelValueAsyncClient { - @Generated - private final NullableModelValuesImpl serviceClient; - - /** - * Initializes an instance of NullableModelValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NullableModelValueAsyncClient(NullableModelValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_INNER_MODEL)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_INNER_MODEL - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueClient.java deleted file mode 100644 index f591e6052b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueClient.java +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import type.array.implementation.NullableModelValuesImpl; -import type.array.models.InnerModel; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class NullableModelValueClient { - @Generated - private final NullableModelValuesImpl serviceClient; - - /** - * Initializes an instance of NullableModelValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NullableModelValueClient(NullableModelValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_INNER_MODEL); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_INNER_MODEL - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueAsyncClient.java deleted file mode 100644 index c7db9b11b31..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueAsyncClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.NullableStringValuesImpl; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class NullableStringValueAsyncClient { - @Generated - private final NullableStringValuesImpl serviceClient; - - /** - * Initializes an instance of NullableStringValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NullableStringValueAsyncClient(NullableStringValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_STRING)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_STRING = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueClient.java deleted file mode 100644 index aadd9cb42c6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import type.array.implementation.NullableStringValuesImpl; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class NullableStringValueClient { - @Generated - private final NullableStringValuesImpl serviceClient; - - /** - * Initializes an instance of NullableStringValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NullableStringValueClient(NullableStringValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_STRING); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_STRING = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueAsyncClient.java deleted file mode 100644 index def28fad6ed..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueAsyncClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.StringValuesImpl; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class StringValueAsyncClient { - @Generated - private final StringValuesImpl serviceClient; - - /** - * Initializes an instance of StringValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringValueAsyncClient(StringValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_STRING)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_STRING = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueClient.java deleted file mode 100644 index 1e84dd09242..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import type.array.implementation.StringValuesImpl; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class StringValueClient { - @Generated - private final StringValuesImpl serviceClient; - - /** - * Initializes an instance of StringValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringValueClient(StringValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_STRING); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_STRING = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueAsyncClient.java deleted file mode 100644 index 61d56f34f48..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueAsyncClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import reactor.core.publisher.Mono; -import type.array.implementation.UnknownValuesImpl; - -/** - * Initializes a new instance of the asynchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) -public final class UnknownValueAsyncClient { - @Generated - private final UnknownValuesImpl serviceClient; - - /** - * Initializes an instance of UnknownValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownValueAsyncClient(UnknownValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     Object (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     Object (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_OBJECT)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_OBJECT = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueClient.java deleted file mode 100644 index d6195f34cfc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.List; -import type.array.implementation.UnknownValuesImpl; - -/** - * Initializes a new instance of the synchronous ArrayClient type. - */ -@ServiceClient(builder = ArrayClientBuilder.class) -public final class UnknownValueClient { - @Generated - private final UnknownValuesImpl serviceClient; - - /** - * Initializes an instance of UnknownValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownValueClient(UnknownValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     Object (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     Object (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_OBJECT); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(List body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_OBJECT = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ArrayClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ArrayClientImpl.java deleted file mode 100644 index 893f261aa01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ArrayClientImpl.java +++ /dev/null @@ -1,302 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 ArrayClient type. - */ -public final class ArrayClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 Int32ValuesImpl object to access its operations. - */ - private final Int32ValuesImpl int32Values; - - /** - * Gets the Int32ValuesImpl object to access its operations. - * - * @return the Int32ValuesImpl object. - */ - public Int32ValuesImpl getInt32Values() { - return this.int32Values; - } - - /** - * The Int64ValuesImpl object to access its operations. - */ - private final Int64ValuesImpl int64Values; - - /** - * Gets the Int64ValuesImpl object to access its operations. - * - * @return the Int64ValuesImpl object. - */ - public Int64ValuesImpl getInt64Values() { - return this.int64Values; - } - - /** - * The BooleanValuesImpl object to access its operations. - */ - private final BooleanValuesImpl booleanValues; - - /** - * Gets the BooleanValuesImpl object to access its operations. - * - * @return the BooleanValuesImpl object. - */ - public BooleanValuesImpl getBooleanValues() { - return this.booleanValues; - } - - /** - * The StringValuesImpl object to access its operations. - */ - private final StringValuesImpl stringValues; - - /** - * Gets the StringValuesImpl object to access its operations. - * - * @return the StringValuesImpl object. - */ - public StringValuesImpl getStringValues() { - return this.stringValues; - } - - /** - * The Float32ValuesImpl object to access its operations. - */ - private final Float32ValuesImpl float32Values; - - /** - * Gets the Float32ValuesImpl object to access its operations. - * - * @return the Float32ValuesImpl object. - */ - public Float32ValuesImpl getFloat32Values() { - return this.float32Values; - } - - /** - * The DatetimeValuesImpl object to access its operations. - */ - private final DatetimeValuesImpl datetimeValues; - - /** - * Gets the DatetimeValuesImpl object to access its operations. - * - * @return the DatetimeValuesImpl object. - */ - public DatetimeValuesImpl getDatetimeValues() { - return this.datetimeValues; - } - - /** - * The DurationValuesImpl object to access its operations. - */ - private final DurationValuesImpl durationValues; - - /** - * Gets the DurationValuesImpl object to access its operations. - * - * @return the DurationValuesImpl object. - */ - public DurationValuesImpl getDurationValues() { - return this.durationValues; - } - - /** - * The UnknownValuesImpl object to access its operations. - */ - private final UnknownValuesImpl unknownValues; - - /** - * Gets the UnknownValuesImpl object to access its operations. - * - * @return the UnknownValuesImpl object. - */ - public UnknownValuesImpl getUnknownValues() { - return this.unknownValues; - } - - /** - * The ModelValuesImpl object to access its operations. - */ - private final ModelValuesImpl modelValues; - - /** - * Gets the ModelValuesImpl object to access its operations. - * - * @return the ModelValuesImpl object. - */ - public ModelValuesImpl getModelValues() { - return this.modelValues; - } - - /** - * The NullableFloatValuesImpl object to access its operations. - */ - private final NullableFloatValuesImpl nullableFloatValues; - - /** - * Gets the NullableFloatValuesImpl object to access its operations. - * - * @return the NullableFloatValuesImpl object. - */ - public NullableFloatValuesImpl getNullableFloatValues() { - return this.nullableFloatValues; - } - - /** - * The NullableInt32ValuesImpl object to access its operations. - */ - private final NullableInt32ValuesImpl nullableInt32Values; - - /** - * Gets the NullableInt32ValuesImpl object to access its operations. - * - * @return the NullableInt32ValuesImpl object. - */ - public NullableInt32ValuesImpl getNullableInt32Values() { - return this.nullableInt32Values; - } - - /** - * The NullableBooleanValuesImpl object to access its operations. - */ - private final NullableBooleanValuesImpl nullableBooleanValues; - - /** - * Gets the NullableBooleanValuesImpl object to access its operations. - * - * @return the NullableBooleanValuesImpl object. - */ - public NullableBooleanValuesImpl getNullableBooleanValues() { - return this.nullableBooleanValues; - } - - /** - * The NullableStringValuesImpl object to access its operations. - */ - private final NullableStringValuesImpl nullableStringValues; - - /** - * Gets the NullableStringValuesImpl object to access its operations. - * - * @return the NullableStringValuesImpl object. - */ - public NullableStringValuesImpl getNullableStringValues() { - return this.nullableStringValues; - } - - /** - * The NullableModelValuesImpl object to access its operations. - */ - private final NullableModelValuesImpl nullableModelValues; - - /** - * Gets the NullableModelValuesImpl object to access its operations. - * - * @return the NullableModelValuesImpl object. - */ - public NullableModelValuesImpl getNullableModelValues() { - return this.nullableModelValues; - } - - /** - * Initializes an instance of ArrayClient client. - * - * @param endpoint Service host. - */ - public ArrayClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ArrayClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ArrayClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ArrayClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ArrayClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.int32Values = new Int32ValuesImpl(this); - this.int64Values = new Int64ValuesImpl(this); - this.booleanValues = new BooleanValuesImpl(this); - this.stringValues = new StringValuesImpl(this); - this.float32Values = new Float32ValuesImpl(this); - this.datetimeValues = new DatetimeValuesImpl(this); - this.durationValues = new DurationValuesImpl(this); - this.unknownValues = new UnknownValuesImpl(this); - this.modelValues = new ModelValuesImpl(this); - this.nullableFloatValues = new NullableFloatValuesImpl(this); - this.nullableInt32Values = new NullableInt32ValuesImpl(this); - this.nullableBooleanValues = new NullableBooleanValuesImpl(this); - this.nullableStringValues = new NullableStringValuesImpl(this); - this.nullableModelValues = new NullableModelValuesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/BooleanValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/BooleanValuesImpl.java deleted file mode 100644 index aa3c3d9443b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/BooleanValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in BooleanValues. - */ -public final class BooleanValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BooleanValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of BooleanValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BooleanValuesImpl(ArrayClientImpl client) { - this.service - = RestProxy.create(BooleanValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientBooleanValues to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientBooleanValues") - public interface BooleanValuesService { - @Get("/type/array/boolean") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/boolean") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/boolean") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/boolean") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DatetimeValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DatetimeValuesImpl.java deleted file mode 100644 index cdd53816822..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DatetimeValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DatetimeValues. - */ -public final class DatetimeValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DatetimeValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of DatetimeValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DatetimeValuesImpl(ArrayClientImpl client) { - this.service - = RestProxy.create(DatetimeValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientDatetimeValues to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientDatetimeValues") - public interface DatetimeValuesService { - @Get("/type/array/datetime") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/datetime") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/datetime") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/datetime") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     OffsetDateTime (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     OffsetDateTime (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     OffsetDateTime (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     OffsetDateTime (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DurationValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DurationValuesImpl.java deleted file mode 100644 index 2786d40626e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DurationValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DurationValues. - */ -public final class DurationValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DurationValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of DurationValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DurationValuesImpl(ArrayClientImpl client) { - this.service - = RestProxy.create(DurationValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientDurationValues to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientDurationValues") - public interface DurationValuesService { - @Get("/type/array/duration") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/duration") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/duration") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/duration") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     Duration (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     Duration (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     Duration (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     Duration (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Float32ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Float32ValuesImpl.java deleted file mode 100644 index 4f8a5eb5fcc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Float32ValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Float32Values. - */ -public final class Float32ValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Float32ValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of Float32ValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Float32ValuesImpl(ArrayClientImpl client) { - this.service - = RestProxy.create(Float32ValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientFloat32Values to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientFloat32Values") - public interface Float32ValuesService { - @Get("/type/array/float32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/float32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/float32") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/float32") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int32ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int32ValuesImpl.java deleted file mode 100644 index f62ba702281..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int32ValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Int32Values. - */ -public final class Int32ValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Int32ValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of Int32ValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Int32ValuesImpl(ArrayClientImpl client) { - this.service - = RestProxy.create(Int32ValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientInt32Values to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientInt32Values") - public interface Int32ValuesService { - @Get("/type/array/int32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/int32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/int32") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/int32") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int64ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int64ValuesImpl.java deleted file mode 100644 index e2f1ba3ff11..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int64ValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Int64Values. - */ -public final class Int64ValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Int64ValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of Int64ValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Int64ValuesImpl(ArrayClientImpl client) { - this.service - = RestProxy.create(Int64ValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientInt64Values to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientInt64Values") - public interface Int64ValuesService { - @Get("/type/array/int64") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/int64") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/int64") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/int64") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     long (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     long (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     long (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     long (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ModelValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ModelValuesImpl.java deleted file mode 100644 index 6b4e459536a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ModelValuesImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ModelValues. - */ -public final class ModelValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ModelValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of ModelValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ModelValuesImpl(ArrayClientImpl client) { - this.service - = RestProxy.create(ModelValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientModelValues to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientModelValues") - public interface ModelValuesService { - @Get("/type/array/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableBooleanValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableBooleanValuesImpl.java deleted file mode 100644 index 29e8ceb5277..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableBooleanValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in NullableBooleanValues. - */ -public final class NullableBooleanValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NullableBooleanValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of NullableBooleanValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NullableBooleanValuesImpl(ArrayClientImpl client) { - this.service = RestProxy.create(NullableBooleanValuesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientNullableBooleanValues to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientNullableBooleanValues") - public interface NullableBooleanValuesService { - @Get("/type/array/nullable-boolean") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/nullable-boolean") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/nullable-boolean") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/nullable-boolean") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     boolean (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableFloatValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableFloatValuesImpl.java deleted file mode 100644 index 476dc3facd1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableFloatValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in NullableFloatValues. - */ -public final class NullableFloatValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NullableFloatValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of NullableFloatValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NullableFloatValuesImpl(ArrayClientImpl client) { - this.service = RestProxy.create(NullableFloatValuesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientNullableFloatValues to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientNullableFloatValues") - public interface NullableFloatValuesService { - @Get("/type/array/nullable-float") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/nullable-float") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/nullable-float") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/nullable-float") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     double (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableInt32ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableInt32ValuesImpl.java deleted file mode 100644 index 754ef970df4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableInt32ValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in NullableInt32Values. - */ -public final class NullableInt32ValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NullableInt32ValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of NullableInt32ValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NullableInt32ValuesImpl(ArrayClientImpl client) { - this.service = RestProxy.create(NullableInt32ValuesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientNullableInt32Values to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientNullableInt32Values") - public interface NullableInt32ValuesService { - @Get("/type/array/nullable-int32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/nullable-int32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/nullable-int32") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/nullable-int32") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     int (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableModelValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableModelValuesImpl.java deleted file mode 100644 index aab7f8fb8c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableModelValuesImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in NullableModelValues. - */ -public final class NullableModelValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NullableModelValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of NullableModelValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NullableModelValuesImpl(ArrayClientImpl client) { - this.service = RestProxy.create(NullableModelValuesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientNullableModelValues to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientNullableModelValues") - public interface NullableModelValuesService { - @Get("/type/array/nullable-model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/nullable-model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/nullable-model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/nullable-model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *      (Required){
-     *         property: String (Required)
-     *         children (Optional): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableStringValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableStringValuesImpl.java deleted file mode 100644 index 7f27e414ac4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableStringValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in NullableStringValues. - */ -public final class NullableStringValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NullableStringValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of NullableStringValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NullableStringValuesImpl(ArrayClientImpl client) { - this.service = RestProxy.create(NullableStringValuesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientNullableStringValues to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientNullableStringValues") - public interface NullableStringValuesService { - @Get("/type/array/nullable-string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/nullable-string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/nullable-string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/nullable-string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/StringValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/StringValuesImpl.java deleted file mode 100644 index 9694d285f4a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/StringValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringValues. - */ -public final class StringValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of StringValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringValuesImpl(ArrayClientImpl client) { - this.service - = RestProxy.create(StringValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientStringValues to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientStringValues") - public interface StringValuesService { - @Get("/type/array/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     String (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/UnknownValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/UnknownValuesImpl.java deleted file mode 100644 index dc82f2d5adc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/UnknownValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnknownValues. - */ -public final class UnknownValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnknownValuesService service; - - /** - * The service client containing this operation class. - */ - private final ArrayClientImpl client; - - /** - * Initializes an instance of UnknownValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnknownValuesImpl(ArrayClientImpl client) { - this.service - = RestProxy.create(UnknownValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ArrayClientUnknownValues to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ArrayClientUnknownValues") - public interface UnknownValuesService { - @Get("/type/array/unknown") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/array/unknown") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/array/unknown") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/array/unknown") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     Object (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     Object (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     Object (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * [
-     *     Object (Required)
-     * ]
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/package-info.java deleted file mode 100644 index 88ecb03506b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Array. - * Illustrates various types of arrays. - * - */ -package type.array.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/InnerModel.java deleted file mode 100644 index decd8bac966..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/InnerModel.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * Array inner model. - */ -@Fluent -public final class InnerModel implements JsonSerializable { - /* - * Required string property - */ - @Generated - private final String property; - - /* - * The children property. - */ - @Generated - private List children; - - /** - * Creates an instance of InnerModel class. - * - * @param property the property value to set. - */ - @Generated - public InnerModel(String property) { - this.property = property; - } - - /** - * Get the property property: Required string property. - * - * @return the property value. - */ - @Generated - public String getProperty() { - return this.property; - } - - /** - * Get the children property: The children property. - * - * @return the children value. - */ - @Generated - public List getChildren() { - return this.children; - } - - /** - * Set the children property: The children property. - * - * @param children the children value to set. - * @return the InnerModel object itself. - */ - @Generated - public InnerModel setChildren(List children) { - this.children = children; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property); - jsonWriter.writeArrayField("children", this.children, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InnerModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the InnerModel. - */ - @Generated - public static InnerModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String property = null; - List children = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getString(); - } else if ("children".equals(fieldName)) { - children = reader.readArray(reader1 -> InnerModel.fromJson(reader1)); - } else { - reader.skipChildren(); - } - } - InnerModel deserializedInnerModel = new InnerModel(property); - deserializedInnerModel.children = children; - - return deserializedInnerModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/package-info.java deleted file mode 100644 index 8b60200d2e7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Array. - * Illustrates various types of arrays. - * - */ -package type.array.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/package-info.java deleted file mode 100644 index 42102cc88fa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Array. - * Illustrates various types of arrays. - * - */ -package type.array; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueAsyncClient.java deleted file mode 100644 index 79e8b86247e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import reactor.core.publisher.Mono; -import type.dictionary.implementation.BooleanValuesImpl; - -/** - * Initializes a new instance of the asynchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) -public final class BooleanValueAsyncClient { - @Generated - private final BooleanValuesImpl serviceClient; - - /** - * Initializes an instance of BooleanValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BooleanValueAsyncClient(BooleanValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_BOOLEAN)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_BOOLEAN - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueClient.java deleted file mode 100644 index 0076abfae86..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import type.dictionary.implementation.BooleanValuesImpl; - -/** - * Initializes a new instance of the synchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class) -public final class BooleanValueClient { - @Generated - private final BooleanValuesImpl serviceClient; - - /** - * Initializes an instance of BooleanValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BooleanValueClient(BooleanValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Map get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_BOOLEAN); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_BOOLEAN - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueAsyncClient.java deleted file mode 100644 index ecb428b457a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueAsyncClient.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.time.OffsetDateTime; -import java.util.Map; -import reactor.core.publisher.Mono; -import type.dictionary.implementation.DatetimeValuesImpl; - -/** - * Initializes a new instance of the asynchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) -public final class DatetimeValueAsyncClient { - @Generated - private final DatetimeValuesImpl serviceClient; - - /** - * Initializes an instance of DatetimeValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DatetimeValueAsyncClient(DatetimeValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_OFFSET_DATE_TIME)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_OFFSET_DATE_TIME - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueClient.java deleted file mode 100644 index 77cb986ba8c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueClient.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.time.OffsetDateTime; -import java.util.Map; -import type.dictionary.implementation.DatetimeValuesImpl; - -/** - * Initializes a new instance of the synchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class) -public final class DatetimeValueClient { - @Generated - private final DatetimeValuesImpl serviceClient; - - /** - * Initializes an instance of DatetimeValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DatetimeValueClient(DatetimeValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Map get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_OFFSET_DATE_TIME); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_OFFSET_DATE_TIME - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DictionaryClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DictionaryClientBuilder.java deleted file mode 100644 index 937444a209a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DictionaryClientBuilder.java +++ /dev/null @@ -1,510 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.dictionary.implementation.DictionaryClientImpl; - -/** - * A builder for creating a new instance of the DictionaryClient type. - */ -@ServiceClientBuilder( - serviceClients = { - Int32ValueClient.class, - Int64ValueClient.class, - BooleanValueClient.class, - StringValueClient.class, - Float32ValueClient.class, - DatetimeValueClient.class, - DurationValueClient.class, - UnknownValueClient.class, - ModelValueClient.class, - RecursiveModelValueClient.class, - NullableFloatValueClient.class, - Int32ValueAsyncClient.class, - Int64ValueAsyncClient.class, - BooleanValueAsyncClient.class, - StringValueAsyncClient.class, - Float32ValueAsyncClient.class, - DatetimeValueAsyncClient.class, - DurationValueAsyncClient.class, - UnknownValueAsyncClient.class, - ModelValueAsyncClient.class, - RecursiveModelValueAsyncClient.class, - NullableFloatValueAsyncClient.class }) -public final class DictionaryClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("type-dictionary.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the DictionaryClientBuilder. - */ - @Generated - public DictionaryClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DictionaryClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DictionaryClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DictionaryClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DictionaryClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DictionaryClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DictionaryClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DictionaryClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DictionaryClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the DictionaryClientBuilder. - */ - @Generated - public DictionaryClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of DictionaryClientImpl with the provided parameters. - * - * @return an instance of DictionaryClientImpl. - */ - @Generated - private DictionaryClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - DictionaryClientImpl client - = new DictionaryClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of Int32ValueAsyncClient class. - * - * @return an instance of Int32ValueAsyncClient. - */ - @Generated - public Int32ValueAsyncClient buildInt32ValueAsyncClient() { - return new Int32ValueAsyncClient(buildInnerClient().getInt32Values()); - } - - /** - * Builds an instance of Int64ValueAsyncClient class. - * - * @return an instance of Int64ValueAsyncClient. - */ - @Generated - public Int64ValueAsyncClient buildInt64ValueAsyncClient() { - return new Int64ValueAsyncClient(buildInnerClient().getInt64Values()); - } - - /** - * Builds an instance of BooleanValueAsyncClient class. - * - * @return an instance of BooleanValueAsyncClient. - */ - @Generated - public BooleanValueAsyncClient buildBooleanValueAsyncClient() { - return new BooleanValueAsyncClient(buildInnerClient().getBooleanValues()); - } - - /** - * Builds an instance of StringValueAsyncClient class. - * - * @return an instance of StringValueAsyncClient. - */ - @Generated - public StringValueAsyncClient buildStringValueAsyncClient() { - return new StringValueAsyncClient(buildInnerClient().getStringValues()); - } - - /** - * Builds an instance of Float32ValueAsyncClient class. - * - * @return an instance of Float32ValueAsyncClient. - */ - @Generated - public Float32ValueAsyncClient buildFloat32ValueAsyncClient() { - return new Float32ValueAsyncClient(buildInnerClient().getFloat32Values()); - } - - /** - * Builds an instance of DatetimeValueAsyncClient class. - * - * @return an instance of DatetimeValueAsyncClient. - */ - @Generated - public DatetimeValueAsyncClient buildDatetimeValueAsyncClient() { - return new DatetimeValueAsyncClient(buildInnerClient().getDatetimeValues()); - } - - /** - * Builds an instance of DurationValueAsyncClient class. - * - * @return an instance of DurationValueAsyncClient. - */ - @Generated - public DurationValueAsyncClient buildDurationValueAsyncClient() { - return new DurationValueAsyncClient(buildInnerClient().getDurationValues()); - } - - /** - * Builds an instance of UnknownValueAsyncClient class. - * - * @return an instance of UnknownValueAsyncClient. - */ - @Generated - public UnknownValueAsyncClient buildUnknownValueAsyncClient() { - return new UnknownValueAsyncClient(buildInnerClient().getUnknownValues()); - } - - /** - * Builds an instance of ModelValueAsyncClient class. - * - * @return an instance of ModelValueAsyncClient. - */ - @Generated - public ModelValueAsyncClient buildModelValueAsyncClient() { - return new ModelValueAsyncClient(buildInnerClient().getModelValues()); - } - - /** - * Builds an instance of RecursiveModelValueAsyncClient class. - * - * @return an instance of RecursiveModelValueAsyncClient. - */ - @Generated - public RecursiveModelValueAsyncClient buildRecursiveModelValueAsyncClient() { - return new RecursiveModelValueAsyncClient(buildInnerClient().getRecursiveModelValues()); - } - - /** - * Builds an instance of NullableFloatValueAsyncClient class. - * - * @return an instance of NullableFloatValueAsyncClient. - */ - @Generated - public NullableFloatValueAsyncClient buildNullableFloatValueAsyncClient() { - return new NullableFloatValueAsyncClient(buildInnerClient().getNullableFloatValues()); - } - - /** - * Builds an instance of Int32ValueClient class. - * - * @return an instance of Int32ValueClient. - */ - @Generated - public Int32ValueClient buildInt32ValueClient() { - return new Int32ValueClient(buildInnerClient().getInt32Values()); - } - - /** - * Builds an instance of Int64ValueClient class. - * - * @return an instance of Int64ValueClient. - */ - @Generated - public Int64ValueClient buildInt64ValueClient() { - return new Int64ValueClient(buildInnerClient().getInt64Values()); - } - - /** - * Builds an instance of BooleanValueClient class. - * - * @return an instance of BooleanValueClient. - */ - @Generated - public BooleanValueClient buildBooleanValueClient() { - return new BooleanValueClient(buildInnerClient().getBooleanValues()); - } - - /** - * Builds an instance of StringValueClient class. - * - * @return an instance of StringValueClient. - */ - @Generated - public StringValueClient buildStringValueClient() { - return new StringValueClient(buildInnerClient().getStringValues()); - } - - /** - * Builds an instance of Float32ValueClient class. - * - * @return an instance of Float32ValueClient. - */ - @Generated - public Float32ValueClient buildFloat32ValueClient() { - return new Float32ValueClient(buildInnerClient().getFloat32Values()); - } - - /** - * Builds an instance of DatetimeValueClient class. - * - * @return an instance of DatetimeValueClient. - */ - @Generated - public DatetimeValueClient buildDatetimeValueClient() { - return new DatetimeValueClient(buildInnerClient().getDatetimeValues()); - } - - /** - * Builds an instance of DurationValueClient class. - * - * @return an instance of DurationValueClient. - */ - @Generated - public DurationValueClient buildDurationValueClient() { - return new DurationValueClient(buildInnerClient().getDurationValues()); - } - - /** - * Builds an instance of UnknownValueClient class. - * - * @return an instance of UnknownValueClient. - */ - @Generated - public UnknownValueClient buildUnknownValueClient() { - return new UnknownValueClient(buildInnerClient().getUnknownValues()); - } - - /** - * Builds an instance of ModelValueClient class. - * - * @return an instance of ModelValueClient. - */ - @Generated - public ModelValueClient buildModelValueClient() { - return new ModelValueClient(buildInnerClient().getModelValues()); - } - - /** - * Builds an instance of RecursiveModelValueClient class. - * - * @return an instance of RecursiveModelValueClient. - */ - @Generated - public RecursiveModelValueClient buildRecursiveModelValueClient() { - return new RecursiveModelValueClient(buildInnerClient().getRecursiveModelValues()); - } - - /** - * Builds an instance of NullableFloatValueClient class. - * - * @return an instance of NullableFloatValueClient. - */ - @Generated - public NullableFloatValueClient buildNullableFloatValueClient() { - return new NullableFloatValueClient(buildInnerClient().getNullableFloatValues()); - } - - private static final ClientLogger LOGGER = new ClientLogger(DictionaryClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueAsyncClient.java deleted file mode 100644 index a8d09e2c9b0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueAsyncClient.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.util.Map; -import reactor.core.publisher.Mono; -import type.dictionary.implementation.DurationValuesImpl; - -/** - * Initializes a new instance of the asynchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) -public final class DurationValueAsyncClient { - @Generated - private final DurationValuesImpl serviceClient; - - /** - * Initializes an instance of DurationValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DurationValueAsyncClient(DurationValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_DURATION)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_DURATION - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueClient.java deleted file mode 100644 index bd1f5390b11..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueClient.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.time.Duration; -import java.util.Map; -import type.dictionary.implementation.DurationValuesImpl; - -/** - * Initializes a new instance of the synchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class) -public final class DurationValueClient { - @Generated - private final DurationValuesImpl serviceClient; - - /** - * Initializes an instance of DurationValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DurationValueClient(DurationValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Map get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_DURATION); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_DURATION - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueAsyncClient.java deleted file mode 100644 index cc7d7846de9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import reactor.core.publisher.Mono; -import type.dictionary.implementation.Float32ValuesImpl; - -/** - * Initializes a new instance of the asynchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) -public final class Float32ValueAsyncClient { - @Generated - private final Float32ValuesImpl serviceClient; - - /** - * Initializes an instance of Float32ValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Float32ValueAsyncClient(Float32ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_DOUBLE)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_DOUBLE - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueClient.java deleted file mode 100644 index d817962bb16..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import type.dictionary.implementation.Float32ValuesImpl; - -/** - * Initializes a new instance of the synchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class) -public final class Float32ValueClient { - @Generated - private final Float32ValuesImpl serviceClient; - - /** - * Initializes an instance of Float32ValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Float32ValueClient(Float32ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Map get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_DOUBLE); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_DOUBLE - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueAsyncClient.java deleted file mode 100644 index 4d43ff75e68..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import reactor.core.publisher.Mono; -import type.dictionary.implementation.Int32ValuesImpl; - -/** - * Initializes a new instance of the asynchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) -public final class Int32ValueAsyncClient { - @Generated - private final Int32ValuesImpl serviceClient; - - /** - * Initializes an instance of Int32ValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Int32ValueAsyncClient(Int32ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_INTEGER)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_INTEGER - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueClient.java deleted file mode 100644 index 0cd6daa110a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import type.dictionary.implementation.Int32ValuesImpl; - -/** - * Initializes a new instance of the synchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class) -public final class Int32ValueClient { - @Generated - private final Int32ValuesImpl serviceClient; - - /** - * Initializes an instance of Int32ValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Int32ValueClient(Int32ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Map get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_INTEGER); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_INTEGER - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueAsyncClient.java deleted file mode 100644 index 25587345b30..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import reactor.core.publisher.Mono; -import type.dictionary.implementation.Int64ValuesImpl; - -/** - * Initializes a new instance of the asynchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) -public final class Int64ValueAsyncClient { - @Generated - private final Int64ValuesImpl serviceClient; - - /** - * Initializes an instance of Int64ValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Int64ValueAsyncClient(Int64ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: long (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_LONG)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_LONG - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueClient.java deleted file mode 100644 index 32ce36c0f72..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import type.dictionary.implementation.Int64ValuesImpl; - -/** - * Initializes a new instance of the synchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class) -public final class Int64ValueClient { - @Generated - private final Int64ValuesImpl serviceClient; - - /** - * Initializes an instance of Int64ValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Int64ValueClient(Int64ValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: long (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Map get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_LONG); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_LONG - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueAsyncClient.java deleted file mode 100644 index 65d4328f7f5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueAsyncClient.java +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import reactor.core.publisher.Mono; -import type.dictionary.implementation.ModelValuesImpl; -import type.dictionary.models.InnerModel; - -/** - * Initializes a new instance of the asynchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) -public final class ModelValueAsyncClient { - @Generated - private final ModelValuesImpl serviceClient; - - /** - * Initializes an instance of ModelValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelValueAsyncClient(ModelValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_INNER_MODEL)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_INNER_MODEL - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueClient.java deleted file mode 100644 index e7878acb97a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueClient.java +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import type.dictionary.implementation.ModelValuesImpl; -import type.dictionary.models.InnerModel; - -/** - * Initializes a new instance of the synchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class) -public final class ModelValueClient { - @Generated - private final ModelValuesImpl serviceClient; - - /** - * Initializes an instance of ModelValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelValueClient(ModelValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Map get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_INNER_MODEL); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_INNER_MODEL - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueAsyncClient.java deleted file mode 100644 index c788f835e19..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import reactor.core.publisher.Mono; -import type.dictionary.implementation.NullableFloatValuesImpl; - -/** - * Initializes a new instance of the asynchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) -public final class NullableFloatValueAsyncClient { - @Generated - private final NullableFloatValuesImpl serviceClient; - - /** - * Initializes an instance of NullableFloatValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NullableFloatValueAsyncClient(NullableFloatValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_DOUBLE)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_DOUBLE - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueClient.java deleted file mode 100644 index 0a1367bbd03..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import type.dictionary.implementation.NullableFloatValuesImpl; - -/** - * Initializes a new instance of the synchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class) -public final class NullableFloatValueClient { - @Generated - private final NullableFloatValuesImpl serviceClient; - - /** - * Initializes an instance of NullableFloatValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NullableFloatValueClient(NullableFloatValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Map get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_DOUBLE); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_DOUBLE - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueAsyncClient.java deleted file mode 100644 index 23469aaea18..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueAsyncClient.java +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import reactor.core.publisher.Mono; -import type.dictionary.implementation.RecursiveModelValuesImpl; -import type.dictionary.models.InnerModel; - -/** - * Initializes a new instance of the asynchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) -public final class RecursiveModelValueAsyncClient { - @Generated - private final RecursiveModelValuesImpl serviceClient; - - /** - * Initializes an instance of RecursiveModelValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RecursiveModelValueAsyncClient(RecursiveModelValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_INNER_MODEL)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_INNER_MODEL - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueClient.java deleted file mode 100644 index 98c6341f213..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueClient.java +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import type.dictionary.implementation.RecursiveModelValuesImpl; -import type.dictionary.models.InnerModel; - -/** - * Initializes a new instance of the synchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class) -public final class RecursiveModelValueClient { - @Generated - private final RecursiveModelValuesImpl serviceClient; - - /** - * Initializes an instance of RecursiveModelValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RecursiveModelValueClient(RecursiveModelValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Map get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_INNER_MODEL); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_INNER_MODEL - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueAsyncClient.java deleted file mode 100644 index e462708f0fb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import reactor.core.publisher.Mono; -import type.dictionary.implementation.StringValuesImpl; - -/** - * Initializes a new instance of the asynchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) -public final class StringValueAsyncClient { - @Generated - private final StringValuesImpl serviceClient; - - /** - * Initializes an instance of StringValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringValueAsyncClient(StringValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_STRING)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_STRING - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueClient.java deleted file mode 100644 index b8ffe7c9f1f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import type.dictionary.implementation.StringValuesImpl; - -/** - * Initializes a new instance of the synchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class) -public final class StringValueClient { - @Generated - private final StringValuesImpl serviceClient; - - /** - * Initializes an instance of StringValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringValueClient(StringValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Map get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_STRING); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_STRING - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueAsyncClient.java deleted file mode 100644 index e60710933ed..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import reactor.core.publisher.Mono; -import type.dictionary.implementation.UnknownValuesImpl; - -/** - * Initializes a new instance of the asynchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) -public final class UnknownValueAsyncClient { - @Generated - private final UnknownValuesImpl serviceClient; - - /** - * Initializes an instance of UnknownValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownValueAsyncClient(UnknownValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Object (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Object (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_OBJECT)); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_OBJECT - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueClient.java deleted file mode 100644 index 858d8ad9938..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.util.Map; -import type.dictionary.implementation.UnknownValuesImpl; - -/** - * Initializes a new instance of the synchronous DictionaryClient type. - */ -@ServiceClient(builder = DictionaryClientBuilder.class) -public final class UnknownValueClient { - @Generated - private final UnknownValuesImpl serviceClient; - - /** - * Initializes an instance of UnknownValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownValueClient(UnknownValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Object (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Object (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Map get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_OBJECT); - } - - /** - * The put operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Map body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_MAP_STRING_OBJECT - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/BooleanValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/BooleanValuesImpl.java deleted file mode 100644 index c0105012c92..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/BooleanValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in BooleanValues. - */ -public final class BooleanValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BooleanValuesService service; - - /** - * The service client containing this operation class. - */ - private final DictionaryClientImpl client; - - /** - * Initializes an instance of BooleanValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BooleanValuesImpl(DictionaryClientImpl client) { - this.service - = RestProxy.create(BooleanValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DictionaryClientBooleanValues to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DictionaryClientBooleanValues") - public interface BooleanValuesService { - @Get("/type/dictionary/boolean") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/dictionary/boolean") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/boolean") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/boolean") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DatetimeValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DatetimeValuesImpl.java deleted file mode 100644 index 955d34195ca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DatetimeValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DatetimeValues. - */ -public final class DatetimeValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DatetimeValuesService service; - - /** - * The service client containing this operation class. - */ - private final DictionaryClientImpl client; - - /** - * Initializes an instance of DatetimeValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DatetimeValuesImpl(DictionaryClientImpl client) { - this.service - = RestProxy.create(DatetimeValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DictionaryClientDatetimeValues to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DictionaryClientDatetimeValues") - public interface DatetimeValuesService { - @Get("/type/dictionary/datetime") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/dictionary/datetime") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/datetime") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/datetime") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DictionaryClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DictionaryClientImpl.java deleted file mode 100644 index 2fb37030f47..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DictionaryClientImpl.java +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 DictionaryClient type. - */ -public final class DictionaryClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 Int32ValuesImpl object to access its operations. - */ - private final Int32ValuesImpl int32Values; - - /** - * Gets the Int32ValuesImpl object to access its operations. - * - * @return the Int32ValuesImpl object. - */ - public Int32ValuesImpl getInt32Values() { - return this.int32Values; - } - - /** - * The Int64ValuesImpl object to access its operations. - */ - private final Int64ValuesImpl int64Values; - - /** - * Gets the Int64ValuesImpl object to access its operations. - * - * @return the Int64ValuesImpl object. - */ - public Int64ValuesImpl getInt64Values() { - return this.int64Values; - } - - /** - * The BooleanValuesImpl object to access its operations. - */ - private final BooleanValuesImpl booleanValues; - - /** - * Gets the BooleanValuesImpl object to access its operations. - * - * @return the BooleanValuesImpl object. - */ - public BooleanValuesImpl getBooleanValues() { - return this.booleanValues; - } - - /** - * The StringValuesImpl object to access its operations. - */ - private final StringValuesImpl stringValues; - - /** - * Gets the StringValuesImpl object to access its operations. - * - * @return the StringValuesImpl object. - */ - public StringValuesImpl getStringValues() { - return this.stringValues; - } - - /** - * The Float32ValuesImpl object to access its operations. - */ - private final Float32ValuesImpl float32Values; - - /** - * Gets the Float32ValuesImpl object to access its operations. - * - * @return the Float32ValuesImpl object. - */ - public Float32ValuesImpl getFloat32Values() { - return this.float32Values; - } - - /** - * The DatetimeValuesImpl object to access its operations. - */ - private final DatetimeValuesImpl datetimeValues; - - /** - * Gets the DatetimeValuesImpl object to access its operations. - * - * @return the DatetimeValuesImpl object. - */ - public DatetimeValuesImpl getDatetimeValues() { - return this.datetimeValues; - } - - /** - * The DurationValuesImpl object to access its operations. - */ - private final DurationValuesImpl durationValues; - - /** - * Gets the DurationValuesImpl object to access its operations. - * - * @return the DurationValuesImpl object. - */ - public DurationValuesImpl getDurationValues() { - return this.durationValues; - } - - /** - * The UnknownValuesImpl object to access its operations. - */ - private final UnknownValuesImpl unknownValues; - - /** - * Gets the UnknownValuesImpl object to access its operations. - * - * @return the UnknownValuesImpl object. - */ - public UnknownValuesImpl getUnknownValues() { - return this.unknownValues; - } - - /** - * The ModelValuesImpl object to access its operations. - */ - private final ModelValuesImpl modelValues; - - /** - * Gets the ModelValuesImpl object to access its operations. - * - * @return the ModelValuesImpl object. - */ - public ModelValuesImpl getModelValues() { - return this.modelValues; - } - - /** - * The RecursiveModelValuesImpl object to access its operations. - */ - private final RecursiveModelValuesImpl recursiveModelValues; - - /** - * Gets the RecursiveModelValuesImpl object to access its operations. - * - * @return the RecursiveModelValuesImpl object. - */ - public RecursiveModelValuesImpl getRecursiveModelValues() { - return this.recursiveModelValues; - } - - /** - * The NullableFloatValuesImpl object to access its operations. - */ - private final NullableFloatValuesImpl nullableFloatValues; - - /** - * Gets the NullableFloatValuesImpl object to access its operations. - * - * @return the NullableFloatValuesImpl object. - */ - public NullableFloatValuesImpl getNullableFloatValues() { - return this.nullableFloatValues; - } - - /** - * Initializes an instance of DictionaryClient client. - * - * @param endpoint Service host. - */ - public DictionaryClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DictionaryClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public DictionaryClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DictionaryClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public DictionaryClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.int32Values = new Int32ValuesImpl(this); - this.int64Values = new Int64ValuesImpl(this); - this.booleanValues = new BooleanValuesImpl(this); - this.stringValues = new StringValuesImpl(this); - this.float32Values = new Float32ValuesImpl(this); - this.datetimeValues = new DatetimeValuesImpl(this); - this.durationValues = new DurationValuesImpl(this); - this.unknownValues = new UnknownValuesImpl(this); - this.modelValues = new ModelValuesImpl(this); - this.recursiveModelValues = new RecursiveModelValuesImpl(this); - this.nullableFloatValues = new NullableFloatValuesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DurationValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DurationValuesImpl.java deleted file mode 100644 index a5da3d93d7e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DurationValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DurationValues. - */ -public final class DurationValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DurationValuesService service; - - /** - * The service client containing this operation class. - */ - private final DictionaryClientImpl client; - - /** - * Initializes an instance of DurationValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DurationValuesImpl(DictionaryClientImpl client) { - this.service - = RestProxy.create(DurationValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DictionaryClientDurationValues to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DictionaryClientDurationValues") - public interface DurationValuesService { - @Get("/type/dictionary/duration") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/dictionary/duration") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/duration") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/duration") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Float32ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Float32ValuesImpl.java deleted file mode 100644 index c2eb99529cc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Float32ValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Float32Values. - */ -public final class Float32ValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Float32ValuesService service; - - /** - * The service client containing this operation class. - */ - private final DictionaryClientImpl client; - - /** - * Initializes an instance of Float32ValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Float32ValuesImpl(DictionaryClientImpl client) { - this.service - = RestProxy.create(Float32ValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DictionaryClientFloat32Values to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DictionaryClientFloat32Values") - public interface Float32ValuesService { - @Get("/type/dictionary/float32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/dictionary/float32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/float32") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/float32") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: double (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int32ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int32ValuesImpl.java deleted file mode 100644 index 79ed16d7319..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int32ValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Int32Values. - */ -public final class Int32ValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Int32ValuesService service; - - /** - * The service client containing this operation class. - */ - private final DictionaryClientImpl client; - - /** - * Initializes an instance of Int32ValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Int32ValuesImpl(DictionaryClientImpl client) { - this.service - = RestProxy.create(Int32ValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DictionaryClientInt32Values to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DictionaryClientInt32Values") - public interface Int32ValuesService { - @Get("/type/dictionary/int32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/dictionary/int32") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/int32") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/int32") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int64ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int64ValuesImpl.java deleted file mode 100644 index bc068e5d4e0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int64ValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Int64Values. - */ -public final class Int64ValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Int64ValuesService service; - - /** - * The service client containing this operation class. - */ - private final DictionaryClientImpl client; - - /** - * Initializes an instance of Int64ValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Int64ValuesImpl(DictionaryClientImpl client) { - this.service - = RestProxy.create(Int64ValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DictionaryClientInt64Values to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DictionaryClientInt64Values") - public interface Int64ValuesService { - @Get("/type/dictionary/int64") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/dictionary/int64") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/int64") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/int64") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: long (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: long (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: long (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/ModelValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/ModelValuesImpl.java deleted file mode 100644 index 7938add53e1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/ModelValuesImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ModelValues. - */ -public final class ModelValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ModelValuesService service; - - /** - * The service client containing this operation class. - */ - private final DictionaryClientImpl client; - - /** - * Initializes an instance of ModelValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ModelValuesImpl(DictionaryClientImpl client) { - this.service - = RestProxy.create(ModelValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DictionaryClientModelValues to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DictionaryClientModelValues") - public interface ModelValuesService { - @Get("/type/dictionary/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/dictionary/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/NullableFloatValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/NullableFloatValuesImpl.java deleted file mode 100644 index cf4d90b2eb8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/NullableFloatValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in NullableFloatValues. - */ -public final class NullableFloatValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NullableFloatValuesService service; - - /** - * The service client containing this operation class. - */ - private final DictionaryClientImpl client; - - /** - * Initializes an instance of NullableFloatValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NullableFloatValuesImpl(DictionaryClientImpl client) { - this.service = RestProxy.create(NullableFloatValuesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DictionaryClientNullableFloatValues to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DictionaryClientNullableFloatValues") - public interface NullableFloatValuesService { - @Get("/type/dictionary/nullable-float") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/dictionary/nullable-float") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/nullable-float") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/nullable-float") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/RecursiveModelValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/RecursiveModelValuesImpl.java deleted file mode 100644 index c139317a6fa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/RecursiveModelValuesImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in RecursiveModelValues. - */ -public final class RecursiveModelValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RecursiveModelValuesService service; - - /** - * The service client containing this operation class. - */ - private final DictionaryClientImpl client; - - /** - * Initializes an instance of RecursiveModelValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - RecursiveModelValuesImpl(DictionaryClientImpl client) { - this.service = RestProxy.create(RecursiveModelValuesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DictionaryClientRecursiveModelValues to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DictionaryClientRecursiveModelValues") - public interface RecursiveModelValuesService { - @Get("/type/dictionary/model/recursive") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/dictionary/model/recursive") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/model/recursive") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/model/recursive") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String (Required): {
-     *         property: String (Required)
-     *         children (Optional): {
-     *             String (Required): (recursive schema, see String above)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/StringValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/StringValuesImpl.java deleted file mode 100644 index e8ba4fc5e33..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/StringValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringValues. - */ -public final class StringValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringValuesService service; - - /** - * The service client containing this operation class. - */ - private final DictionaryClientImpl client; - - /** - * Initializes an instance of StringValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringValuesImpl(DictionaryClientImpl client) { - this.service - = RestProxy.create(StringValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DictionaryClientStringValues to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DictionaryClientStringValues") - public interface StringValuesService { - @Get("/type/dictionary/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/dictionary/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/UnknownValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/UnknownValuesImpl.java deleted file mode 100644 index 23699055a5c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/UnknownValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnknownValues. - */ -public final class UnknownValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnknownValuesService service; - - /** - * The service client containing this operation class. - */ - private final DictionaryClientImpl client; - - /** - * Initializes an instance of UnknownValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnknownValuesImpl(DictionaryClientImpl client) { - this.service - = RestProxy.create(UnknownValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DictionaryClientUnknownValues to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DictionaryClientUnknownValues") - public interface UnknownValuesService { - @Get("/type/dictionary/unknown") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/dictionary/unknown") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/unknown") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/dictionary/unknown") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Object (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Object (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Object (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     String: Object (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/package-info.java deleted file mode 100644 index dcc02d01e90..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Dictionary. - * Illustrates various of dictionaries. - * - */ -package type.dictionary.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/InnerModel.java deleted file mode 100644 index 25afa3ef39e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/InnerModel.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Dictionary inner model. - */ -@Fluent -public final class InnerModel implements JsonSerializable { - /* - * Required string property - */ - @Generated - private final String property; - - /* - * The children property. - */ - @Generated - private Map children; - - /** - * Creates an instance of InnerModel class. - * - * @param property the property value to set. - */ - @Generated - public InnerModel(String property) { - this.property = property; - } - - /** - * Get the property property: Required string property. - * - * @return the property value. - */ - @Generated - public String getProperty() { - return this.property; - } - - /** - * Get the children property: The children property. - * - * @return the children value. - */ - @Generated - public Map getChildren() { - return this.children; - } - - /** - * Set the children property: The children property. - * - * @param children the children value to set. - * @return the InnerModel object itself. - */ - @Generated - public InnerModel setChildren(Map children) { - this.children = children; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property); - jsonWriter.writeMapField("children", this.children, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InnerModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the InnerModel. - */ - @Generated - public static InnerModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String property = null; - Map children = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getString(); - } else if ("children".equals(fieldName)) { - children = reader.readMap(reader1 -> InnerModel.fromJson(reader1)); - } else { - reader.skipChildren(); - } - } - InnerModel deserializedInnerModel = new InnerModel(property); - deserializedInnerModel.children = children; - - return deserializedInnerModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/package-info.java deleted file mode 100644 index babab74083c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Dictionary. - * Illustrates various of dictionaries. - * - */ -package type.dictionary.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/package-info.java deleted file mode 100644 index b9622d655da..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Dictionary. - * Illustrates various of dictionaries. - * - */ -package type.dictionary; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleAsyncClient.java deleted file mode 100644 index 789457d82b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleAsyncClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.extensible; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.enums.extensible.implementation.StringOperationsImpl; -import type.enums.extensible.models.DaysOfWeekExtensibleEnum; - -/** - * Initializes a new instance of the asynchronous ExtensibleClient type. - */ -@ServiceClient(builder = ExtensibleClientBuilder.class, isAsync = true) -public final class ExtensibleAsyncClient { - @Generated - private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of ExtensibleAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtensibleAsyncClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getKnownValue operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return days of the week along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getKnownValueWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getKnownValueWithResponseAsync(requestOptions); - } - - /** - * The getUnknownValue operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return days of the week along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getUnknownValueWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getUnknownValueWithResponseAsync(requestOptions); - } - - /** - * The putKnownValue operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putKnownValueWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putKnownValueWithResponseAsync(body, requestOptions); - } - - /** - * The putUnknownValue operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putUnknownValueWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putUnknownValueWithResponseAsync(body, requestOptions); - } - - /** - * The getKnownValue operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return days of the week on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getKnownValue() { - // Generated convenience method for getKnownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getKnownValueWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> DaysOfWeekExtensibleEnum.fromString(protocolMethodData.toObject(String.class))); - } - - /** - * The getUnknownValue operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return days of the week on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getUnknownValue() { - // Generated convenience method for getUnknownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getUnknownValueWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> DaysOfWeekExtensibleEnum.fromString(protocolMethodData.toObject(String.class))); - } - - /** - * The putKnownValue operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putKnownValue(DaysOfWeekExtensibleEnum body) { - // Generated convenience method for putKnownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putKnownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) - .flatMap(FluxUtil::toMono); - } - - /** - * The putUnknownValue operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putUnknownValue(DaysOfWeekExtensibleEnum body) { - // Generated convenience method for putUnknownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putUnknownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) - .flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClient.java deleted file mode 100644 index c8e8c9a9023..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClient.java +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.extensible; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.enums.extensible.implementation.StringOperationsImpl; -import type.enums.extensible.models.DaysOfWeekExtensibleEnum; - -/** - * Initializes a new instance of the synchronous ExtensibleClient type. - */ -@ServiceClient(builder = ExtensibleClientBuilder.class) -public final class ExtensibleClient { - @Generated - private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of ExtensibleClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtensibleClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getKnownValue operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return days of the week along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getKnownValueWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getKnownValueWithResponse(requestOptions); - } - - /** - * The getUnknownValue operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return days of the week along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getUnknownValueWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getUnknownValueWithResponse(requestOptions); - } - - /** - * The putKnownValue operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putKnownValueWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putKnownValueWithResponse(body, requestOptions); - } - - /** - * The putUnknownValue operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putUnknownValueWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putUnknownValueWithResponse(body, requestOptions); - } - - /** - * The getKnownValue operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return days of the week. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DaysOfWeekExtensibleEnum getKnownValue() { - // Generated convenience method for getKnownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - return DaysOfWeekExtensibleEnum - .fromString(getKnownValueWithResponse(requestOptions).getValue().toObject(String.class)); - } - - /** - * The getUnknownValue operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return days of the week. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DaysOfWeekExtensibleEnum getUnknownValue() { - // Generated convenience method for getUnknownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - return DaysOfWeekExtensibleEnum - .fromString(getUnknownValueWithResponse(requestOptions).getValue().toObject(String.class)); - } - - /** - * The putKnownValue operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putKnownValue(DaysOfWeekExtensibleEnum body) { - // Generated convenience method for putKnownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - putKnownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) - .getValue(); - } - - /** - * The putUnknownValue operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putUnknownValue(DaysOfWeekExtensibleEnum body) { - // Generated convenience method for putUnknownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - putUnknownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) - .getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClientBuilder.java deleted file mode 100644 index 035733b899b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.extensible; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.enums.extensible.implementation.ExtensibleClientImpl; - -/** - * A builder for creating a new instance of the ExtensibleClient type. - */ -@ServiceClientBuilder(serviceClients = { ExtensibleClient.class, ExtensibleAsyncClient.class }) -public final class ExtensibleClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("type-enums-extensible.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ExtensibleClientBuilder. - */ - @Generated - public ExtensibleClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ExtensibleClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ExtensibleClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ExtensibleClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ExtensibleClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ExtensibleClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ExtensibleClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ExtensibleClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ExtensibleClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ExtensibleClientBuilder. - */ - @Generated - public ExtensibleClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ExtensibleClientImpl with the provided parameters. - * - * @return an instance of ExtensibleClientImpl. - */ - @Generated - private ExtensibleClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ExtensibleClientImpl client - = new ExtensibleClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ExtensibleAsyncClient class. - * - * @return an instance of ExtensibleAsyncClient. - */ - @Generated - public ExtensibleAsyncClient buildAsyncClient() { - return new ExtensibleAsyncClient(buildInnerClient().getStringOperations()); - } - - /** - * Builds an instance of ExtensibleClient class. - * - * @return an instance of ExtensibleClient. - */ - @Generated - public ExtensibleClient buildClient() { - return new ExtensibleClient(buildInnerClient().getStringOperations()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ExtensibleClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java deleted file mode 100644 index 4431101f0dd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.extensible.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 ExtensibleClient type. - */ -public final class ExtensibleClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 StringOperationsImpl object to access its operations. - */ - private final StringOperationsImpl stringOperations; - - /** - * Gets the StringOperationsImpl object to access its operations. - * - * @return the StringOperationsImpl object. - */ - public StringOperationsImpl getStringOperations() { - return this.stringOperations; - } - - /** - * Initializes an instance of ExtensibleClient client. - * - * @param endpoint Service host. - */ - public ExtensibleClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ExtensibleClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ExtensibleClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ExtensibleClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ExtensibleClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.stringOperations = new StringOperationsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/StringOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/StringOperationsImpl.java deleted file mode 100644 index 661e7efc1d3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/StringOperationsImpl.java +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.extensible.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringOperations. - */ -public final class StringOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ExtensibleClientImpl client; - - /** - * Initializes an instance of StringOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringOperationsImpl(ExtensibleClientImpl client) { - this.service - = RestProxy.create(StringOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ExtensibleClientStringOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ExtensibleClientStringOperations") - public interface StringOperationsService { - @Get("/type/enum/extensible/string/known-value") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getKnownValue(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/enum/extensible/string/known-value") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getKnownValueSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/enum/extensible/string/unknown-value") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getUnknownValue(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/enum/extensible/string/unknown-value") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getUnknownValueSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/enum/extensible/string/known-value") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putKnownValue(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/enum/extensible/string/known-value") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putKnownValueSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/enum/extensible/string/unknown-value") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putUnknownValue(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/enum/extensible/string/unknown-value") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putUnknownValueSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The getKnownValue operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return days of the week along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getKnownValueWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getKnownValue(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getKnownValue operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return days of the week along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getKnownValueWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getKnownValueSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getUnknownValue operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return days of the week along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getUnknownValueWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getUnknownValue(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getUnknownValue operation. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return days of the week along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getUnknownValueWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getUnknownValueSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The putKnownValue operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putKnownValueWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putKnownValue(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The putKnownValue operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putKnownValueWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putKnownValueSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The putUnknownValue operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putUnknownValueWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putUnknownValue(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The putUnknownValue operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putUnknownValueWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putUnknownValueSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/package-info.java deleted file mode 100644 index 76941d9def1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Extensible. - * - */ -package type.enums.extensible.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/DaysOfWeekExtensibleEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/DaysOfWeekExtensibleEnum.java deleted file mode 100644 index bc9e1443b5b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/DaysOfWeekExtensibleEnum.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.extensible.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Days of the week. - */ -public final class DaysOfWeekExtensibleEnum extends ExpandableStringEnum { - /** - * Monday. - */ - @Generated - public static final DaysOfWeekExtensibleEnum MONDAY = fromString("Monday"); - - /** - * Tuesday. - */ - @Generated - public static final DaysOfWeekExtensibleEnum TUESDAY = fromString("Tuesday"); - - /** - * Wednesday. - */ - @Generated - public static final DaysOfWeekExtensibleEnum WEDNESDAY = fromString("Wednesday"); - - /** - * Thursday. - */ - @Generated - public static final DaysOfWeekExtensibleEnum THURSDAY = fromString("Thursday"); - - /** - * Friday. - */ - @Generated - public static final DaysOfWeekExtensibleEnum FRIDAY = fromString("Friday"); - - /** - * Saturday. - */ - @Generated - public static final DaysOfWeekExtensibleEnum SATURDAY = fromString("Saturday"); - - /** - * Sunday. - */ - @Generated - public static final DaysOfWeekExtensibleEnum SUNDAY = fromString("Sunday"); - - /** - * Creates a new instance of DaysOfWeekExtensibleEnum value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public DaysOfWeekExtensibleEnum() { - } - - /** - * Creates or finds a DaysOfWeekExtensibleEnum from its string representation. - * - * @param name a name to look for. - * @return the corresponding DaysOfWeekExtensibleEnum. - */ - @Generated - public static DaysOfWeekExtensibleEnum fromString(String name) { - return fromString(name, DaysOfWeekExtensibleEnum.class); - } - - /** - * Gets known DaysOfWeekExtensibleEnum values. - * - * @return known DaysOfWeekExtensibleEnum values. - */ - @Generated - public static Collection values() { - return values(DaysOfWeekExtensibleEnum.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/package-info.java deleted file mode 100644 index e22b559ddab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Extensible. - * - */ -package type.enums.extensible.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/package-info.java deleted file mode 100644 index 6dd0aa31113..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Extensible. - * - */ -package type.enums.extensible; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedAsyncClient.java deleted file mode 100644 index 028f968ed8e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedAsyncClient.java +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.fixed; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.enums.fixed.implementation.StringOperationsImpl; -import type.enums.fixed.models.DaysOfWeekEnum; - -/** - * Initializes a new instance of the asynchronous FixedClient type. - */ -@ServiceClient(builder = FixedClientBuilder.class, isAsync = true) -public final class FixedAsyncClient { - @Generated - private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of FixedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FixedAsyncClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * getKnownValue. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return days of the week along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getKnownValueWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getKnownValueWithResponseAsync(requestOptions); - } - - /** - * putKnownValue. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putKnownValueWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putKnownValueWithResponseAsync(body, requestOptions); - } - - /** - * putUnknownValue. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putUnknownValueWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putUnknownValueWithResponseAsync(body, requestOptions); - } - - /** - * getKnownValue. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return days of the week on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getKnownValue() { - // Generated convenience method for getKnownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getKnownValueWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> DaysOfWeekEnum.fromString(protocolMethodData.toObject(String.class))); - } - - /** - * putKnownValue. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putKnownValue(DaysOfWeekEnum body) { - // Generated convenience method for putKnownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putKnownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) - .flatMap(FluxUtil::toMono); - } - - /** - * putUnknownValue. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putUnknownValue(DaysOfWeekEnum body) { - // Generated convenience method for putUnknownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putUnknownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) - .flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClient.java deleted file mode 100644 index ad9edda7295..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClient.java +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.fixed; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.enums.fixed.implementation.StringOperationsImpl; -import type.enums.fixed.models.DaysOfWeekEnum; - -/** - * Initializes a new instance of the synchronous FixedClient type. - */ -@ServiceClient(builder = FixedClientBuilder.class) -public final class FixedClient { - @Generated - private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of FixedClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FixedClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * getKnownValue. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return days of the week along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getKnownValueWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getKnownValueWithResponse(requestOptions); - } - - /** - * putKnownValue. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putKnownValueWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putKnownValueWithResponse(body, requestOptions); - } - - /** - * putUnknownValue. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putUnknownValueWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putUnknownValueWithResponse(body, requestOptions); - } - - /** - * getKnownValue. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return days of the week. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DaysOfWeekEnum getKnownValue() { - // Generated convenience method for getKnownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - return DaysOfWeekEnum.fromString(getKnownValueWithResponse(requestOptions).getValue().toObject(String.class)); - } - - /** - * putKnownValue. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putKnownValue(DaysOfWeekEnum body) { - // Generated convenience method for putKnownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - putKnownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) - .getValue(); - } - - /** - * putUnknownValue. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putUnknownValue(DaysOfWeekEnum body) { - // Generated convenience method for putUnknownValueWithResponse - RequestOptions requestOptions = new RequestOptions(); - putUnknownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) - .getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClientBuilder.java deleted file mode 100644 index cdc6e468e61..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.fixed; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.enums.fixed.implementation.FixedClientImpl; - -/** - * A builder for creating a new instance of the FixedClient type. - */ -@ServiceClientBuilder(serviceClients = { FixedClient.class, FixedAsyncClient.class }) -public final class FixedClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("type-enums-fixed.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the FixedClientBuilder. - */ - @Generated - public FixedClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FixedClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FixedClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FixedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FixedClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FixedClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FixedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FixedClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public FixedClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the FixedClientBuilder. - */ - @Generated - public FixedClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of FixedClientImpl with the provided parameters. - * - * @return an instance of FixedClientImpl. - */ - @Generated - private FixedClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - FixedClientImpl client - = new FixedClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of FixedAsyncClient class. - * - * @return an instance of FixedAsyncClient. - */ - @Generated - public FixedAsyncClient buildAsyncClient() { - return new FixedAsyncClient(buildInnerClient().getStringOperations()); - } - - /** - * Builds an instance of FixedClient class. - * - * @return an instance of FixedClient. - */ - @Generated - public FixedClient buildClient() { - return new FixedClient(buildInnerClient().getStringOperations()); - } - - private static final ClientLogger LOGGER = new ClientLogger(FixedClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/FixedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/FixedClientImpl.java deleted file mode 100644 index d2f3f07d2b6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/FixedClientImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.fixed.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 FixedClient type. - */ -public final class FixedClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 StringOperationsImpl object to access its operations. - */ - private final StringOperationsImpl stringOperations; - - /** - * Gets the StringOperationsImpl object to access its operations. - * - * @return the StringOperationsImpl object. - */ - public StringOperationsImpl getStringOperations() { - return this.stringOperations; - } - - /** - * Initializes an instance of FixedClient client. - * - * @param endpoint Service host. - */ - public FixedClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of FixedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public FixedClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of FixedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public FixedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.stringOperations = new StringOperationsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/StringOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/StringOperationsImpl.java deleted file mode 100644 index e1e4c02b3dc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/StringOperationsImpl.java +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.fixed.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringOperations. - */ -public final class StringOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringOperationsService service; - - /** - * The service client containing this operation class. - */ - private final FixedClientImpl client; - - /** - * Initializes an instance of StringOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringOperationsImpl(FixedClientImpl client) { - this.service - = RestProxy.create(StringOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for FixedClientStringOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "FixedClientStringOperations") - public interface StringOperationsService { - @Get("/type/enum/fixed/string/known-value") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getKnownValue(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/enum/fixed/string/known-value") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getKnownValueSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/enum/fixed/string/known-value") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putKnownValue(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/enum/fixed/string/known-value") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putKnownValueSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/enum/fixed/string/unknown-value") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putUnknownValue(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/enum/fixed/string/unknown-value") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putUnknownValueSync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * getKnownValue. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return days of the week along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getKnownValueWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getKnownValue(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * getKnownValue. - *

Response Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return days of the week along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getKnownValueWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getKnownValueSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * putKnownValue. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putKnownValueWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putKnownValue(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * putKnownValue. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putKnownValueWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putKnownValueSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * putUnknownValue. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putUnknownValueWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putUnknownValue(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * putUnknownValue. - *

Request Body Schema

- * - *
-     * {@code
-     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putUnknownValueWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putUnknownValueSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/package-info.java deleted file mode 100644 index 04bc7d39540..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Fixed. - * - */ -package type.enums.fixed.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/DaysOfWeekEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/DaysOfWeekEnum.java deleted file mode 100644 index 70c01e482eb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/DaysOfWeekEnum.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.fixed.models; - -/** - * Days of the week. - */ -public enum DaysOfWeekEnum { - /** - * Monday. - */ - MONDAY("Monday"), - - /** - * Tuesday. - */ - TUESDAY("Tuesday"), - - /** - * Wednesday. - */ - WEDNESDAY("Wednesday"), - - /** - * Thursday. - */ - THURSDAY("Thursday"), - - /** - * Friday. - */ - FRIDAY("Friday"), - - /** - * Saturday. - */ - SATURDAY("Saturday"), - - /** - * Sunday. - */ - SUNDAY("Sunday"); - - /** - * The actual serialized value for a DaysOfWeekEnum instance. - */ - private final String value; - - DaysOfWeekEnum(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a DaysOfWeekEnum instance. - * - * @param value the serialized value to parse. - * @return the parsed DaysOfWeekEnum object, or null if unable to parse. - */ - public static DaysOfWeekEnum fromString(String value) { - if (value == null) { - return null; - } - DaysOfWeekEnum[] items = DaysOfWeekEnum.values(); - for (DaysOfWeekEnum item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/package-info.java deleted file mode 100644 index 8247a177399..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Fixed. - * - */ -package type.enums.fixed.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/package-info.java deleted file mode 100644 index 67f11341ce6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Fixed. - * - */ -package type.enums.fixed; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyAsyncClient.java deleted file mode 100644 index 99e85e3c409..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyAsyncClient.java +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.empty; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.model.empty.implementation.EmptyClientImpl; -import type.model.empty.models.EmptyInput; -import type.model.empty.models.EmptyInputOutput; -import type.model.empty.models.EmptyOutput; - -/** - * Initializes a new instance of the asynchronous EmptyClient type. - */ -@ServiceClient(builder = EmptyClientBuilder.class, isAsync = true) -public final class EmptyAsyncClient { - @Generated - private final EmptyClientImpl serviceClient; - - /** - * Initializes an instance of EmptyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EmptyAsyncClient(EmptyClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The putEmpty operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putEmptyWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putEmptyWithResponseAsync(input, requestOptions); - } - - /** - * The getEmpty operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return empty model used in operation return type along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getEmptyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getEmptyWithResponseAsync(requestOptions); - } - - /** - * The postRoundTripEmpty operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return empty model used in both parameter and return type along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postRoundTripEmptyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postRoundTripEmptyWithResponseAsync(body, requestOptions); - } - - /** - * The putEmpty operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putEmpty(EmptyInput input) { - // Generated convenience method for putEmptyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putEmptyWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getEmpty operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return empty model used in operation return type on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getEmpty() { - // Generated convenience method for getEmptyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getEmptyWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(EmptyOutput.class)); - } - - /** - * The postRoundTripEmpty operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return empty model used in both parameter and return type on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono postRoundTripEmpty(EmptyInputOutput body) { - // Generated convenience method for postRoundTripEmptyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postRoundTripEmptyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(EmptyInputOutput.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClient.java deleted file mode 100644 index 86c278e83a9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClient.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.empty; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.model.empty.implementation.EmptyClientImpl; -import type.model.empty.models.EmptyInput; -import type.model.empty.models.EmptyInputOutput; -import type.model.empty.models.EmptyOutput; - -/** - * Initializes a new instance of the synchronous EmptyClient type. - */ -@ServiceClient(builder = EmptyClientBuilder.class) -public final class EmptyClient { - @Generated - private final EmptyClientImpl serviceClient; - - /** - * Initializes an instance of EmptyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EmptyClient(EmptyClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The putEmpty operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putEmptyWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putEmptyWithResponse(input, requestOptions); - } - - /** - * The getEmpty operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return empty model used in operation return type along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getEmptyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getEmptyWithResponse(requestOptions); - } - - /** - * The postRoundTripEmpty operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return empty model used in both parameter and return type along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postRoundTripEmptyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.postRoundTripEmptyWithResponse(body, requestOptions); - } - - /** - * The putEmpty operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putEmpty(EmptyInput input) { - // Generated convenience method for putEmptyWithResponse - RequestOptions requestOptions = new RequestOptions(); - putEmptyWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The getEmpty operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return empty model used in operation return type. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public EmptyOutput getEmpty() { - // Generated convenience method for getEmptyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getEmptyWithResponse(requestOptions).getValue().toObject(EmptyOutput.class); - } - - /** - * The postRoundTripEmpty operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return empty model used in both parameter and return type. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public EmptyInputOutput postRoundTripEmpty(EmptyInputOutput body) { - // Generated convenience method for postRoundTripEmptyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postRoundTripEmptyWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(EmptyInputOutput.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClientBuilder.java deleted file mode 100644 index c70d5dcd270..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.empty; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.model.empty.implementation.EmptyClientImpl; - -/** - * A builder for creating a new instance of the EmptyClient type. - */ -@ServiceClientBuilder(serviceClients = { EmptyClient.class, EmptyAsyncClient.class }) -public final class EmptyClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("type-model-empty.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the EmptyClientBuilder. - */ - @Generated - public EmptyClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EmptyClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EmptyClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EmptyClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EmptyClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EmptyClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EmptyClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EmptyClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EmptyClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the EmptyClientBuilder. - */ - @Generated - public EmptyClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of EmptyClientImpl with the provided parameters. - * - * @return an instance of EmptyClientImpl. - */ - @Generated - private EmptyClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - EmptyClientImpl client - = new EmptyClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of EmptyAsyncClient class. - * - * @return an instance of EmptyAsyncClient. - */ - @Generated - public EmptyAsyncClient buildAsyncClient() { - return new EmptyAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of EmptyClient class. - * - * @return an instance of EmptyClient. - */ - @Generated - public EmptyClient buildClient() { - return new EmptyClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(EmptyClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/EmptyClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/EmptyClientImpl.java deleted file mode 100644 index 217ef782142..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/EmptyClientImpl.java +++ /dev/null @@ -1,360 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.empty.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the EmptyClient type. - */ -public final class EmptyClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final EmptyClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of EmptyClient client. - * - * @param endpoint Service host. - */ - public EmptyClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of EmptyClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public EmptyClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of EmptyClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public EmptyClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(EmptyClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for EmptyClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "EmptyClient") - public interface EmptyClientService { - @Put("/type/model/empty/alone") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putEmpty(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/empty/alone") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putEmptySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Get("/type/model/empty/alone") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getEmpty(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/empty/alone") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getEmptySync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/type/model/empty/round-trip") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> postRoundTripEmpty(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/type/model/empty/round-trip") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postRoundTripEmptySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The putEmpty operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putEmptyWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.putEmpty(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The putEmpty operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putEmptyWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putEmptySync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The getEmpty operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return empty model used in operation return type along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getEmptyWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getEmpty(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getEmpty operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return empty model used in operation return type along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getEmptyWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getEmptySync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The postRoundTripEmpty operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return empty model used in both parameter and return type along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postRoundTripEmptyWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.postRoundTripEmpty(this.getEndpoint(), contentType, accept, body, - requestOptions, context)); - } - - /** - * The postRoundTripEmpty operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return empty model used in both parameter and return type along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postRoundTripEmptyWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.postRoundTripEmptySync(this.getEndpoint(), contentType, accept, body, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/package-info.java deleted file mode 100644 index dda43e99b85..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Empty. - * Illustrates usage of empty model used in operation's parameters and responses. - * - */ -package type.model.empty.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInput.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInput.java deleted file mode 100644 index f69b2961f22..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInput.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.empty.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Empty model used in operation parameters. - */ -@Immutable -public final class EmptyInput implements JsonSerializable { - /** - * Creates an instance of EmptyInput class. - */ - @Generated - public EmptyInput() { - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of EmptyInput from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of EmptyInput if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IOException If an error occurs while reading the EmptyInput. - */ - @Generated - public static EmptyInput fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - EmptyInput deserializedEmptyInput = new EmptyInput(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedEmptyInput; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInputOutput.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInputOutput.java deleted file mode 100644 index 312f73ffca3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInputOutput.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.empty.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Empty model used in both parameter and return type. - */ -@Immutable -public final class EmptyInputOutput implements JsonSerializable { - /** - * Creates an instance of EmptyInputOutput class. - */ - @Generated - public EmptyInputOutput() { - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of EmptyInputOutput from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of EmptyInputOutput if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the EmptyInputOutput. - */ - @Generated - public static EmptyInputOutput fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - EmptyInputOutput deserializedEmptyInputOutput = new EmptyInputOutput(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedEmptyInputOutput; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyOutput.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyOutput.java deleted file mode 100644 index a4e01e1f70b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyOutput.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.empty.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Empty model used in operation return type. - */ -@Immutable -public final class EmptyOutput implements JsonSerializable { - /** - * Creates an instance of EmptyOutput class. - */ - @Generated - private EmptyOutput() { - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of EmptyOutput from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of EmptyOutput if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the EmptyOutput. - */ - @Generated - public static EmptyOutput fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - EmptyOutput deserializedEmptyOutput = new EmptyOutput(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedEmptyOutput; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/package-info.java deleted file mode 100644 index b7e1da3133a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Empty. - * Illustrates usage of empty model used in operation's parameters and responses. - * - */ -package type.model.empty.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/package-info.java deleted file mode 100644 index b6fadba48b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Empty. - * Illustrates usage of empty model used in operation's parameters and responses. - * - */ -package type.model.empty; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorAsyncClient.java deleted file mode 100644 index 8fb568f9f5c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorAsyncClient.java +++ /dev/null @@ -1,410 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.enumdiscriminator; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.model.inheritance.enumdiscriminator.implementation.EnumDiscriminatorClientImpl; -import type.model.inheritance.enumdiscriminator.models.Dog; -import type.model.inheritance.enumdiscriminator.models.Snake; - -/** - * Initializes a new instance of the asynchronous EnumDiscriminatorClient type. - */ -@ServiceClient(builder = EnumDiscriminatorClientBuilder.class, isAsync = true) -public final class EnumDiscriminatorAsyncClient { - @Generated - private final EnumDiscriminatorClientImpl serviceClient; - - /** - * Initializes an instance of EnumDiscriminatorAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnumDiscriminatorAsyncClient(EnumDiscriminatorClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Receive model with extensible enum discriminator type. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test extensible enum type for discriminator along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getExtensibleModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getExtensibleModelWithResponseAsync(requestOptions); - } - - /** - * Send model with extensible enum discriminator type. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param input Dog to create. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putExtensibleModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putExtensibleModelWithResponseAsync(input, requestOptions); - } - - /** - * Get a model omitting the discriminator. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model omitting the discriminator along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getExtensibleModelMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getExtensibleModelMissingDiscriminatorWithResponseAsync(requestOptions); - } - - /** - * Get a model containing discriminator value never defined. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model containing discriminator value never defined along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getExtensibleModelWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getExtensibleModelWrongDiscriminatorWithResponseAsync(requestOptions); - } - - /** - * Receive model with fixed enum discriminator type. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test fixed enum type for discriminator along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getFixedModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getFixedModelWithResponseAsync(requestOptions); - } - - /** - * Send model with fixed enum discriminator type. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param input Snake to create. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putFixedModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putFixedModelWithResponseAsync(input, requestOptions); - } - - /** - * Get a model omitting the discriminator. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model omitting the discriminator along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getFixedModelMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getFixedModelMissingDiscriminatorWithResponseAsync(requestOptions); - } - - /** - * Get a model containing discriminator value never defined. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model containing discriminator value never defined along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getFixedModelWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getFixedModelWrongDiscriminatorWithResponseAsync(requestOptions); - } - - /** - * Receive model with extensible enum discriminator type. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test extensible enum type for discriminator on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getExtensibleModel() { - // Generated convenience method for getExtensibleModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getExtensibleModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); - } - - /** - * Send model with extensible enum discriminator type. - * - * @param input Dog to create. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putExtensibleModel(Dog input) { - // Generated convenience method for putExtensibleModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putExtensibleModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Get a model omitting the discriminator. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a model omitting the discriminator on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getExtensibleModelMissingDiscriminator() { - // Generated convenience method for getExtensibleModelMissingDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getExtensibleModelMissingDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); - } - - /** - * Get a model containing discriminator value never defined. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a model containing discriminator value never defined on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getExtensibleModelWrongDiscriminator() { - // Generated convenience method for getExtensibleModelWrongDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getExtensibleModelWrongDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); - } - - /** - * Receive model with fixed enum discriminator type. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test fixed enum type for discriminator on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getFixedModel() { - // Generated convenience method for getFixedModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getFixedModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Snake.class)); - } - - /** - * Send model with fixed enum discriminator type. - * - * @param input Snake to create. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putFixedModel(Snake input) { - // Generated convenience method for putFixedModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putFixedModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Get a model omitting the discriminator. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a model omitting the discriminator on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getFixedModelMissingDiscriminator() { - // Generated convenience method for getFixedModelMissingDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getFixedModelMissingDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Snake.class)); - } - - /** - * Get a model containing discriminator value never defined. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a model containing discriminator value never defined on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getFixedModelWrongDiscriminator() { - // Generated convenience method for getFixedModelWrongDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getFixedModelWrongDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Snake.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClient.java deleted file mode 100644 index d22a71956e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClient.java +++ /dev/null @@ -1,395 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.enumdiscriminator; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.model.inheritance.enumdiscriminator.implementation.EnumDiscriminatorClientImpl; -import type.model.inheritance.enumdiscriminator.models.Dog; -import type.model.inheritance.enumdiscriminator.models.Snake; - -/** - * Initializes a new instance of the synchronous EnumDiscriminatorClient type. - */ -@ServiceClient(builder = EnumDiscriminatorClientBuilder.class) -public final class EnumDiscriminatorClient { - @Generated - private final EnumDiscriminatorClientImpl serviceClient; - - /** - * Initializes an instance of EnumDiscriminatorClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnumDiscriminatorClient(EnumDiscriminatorClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Receive model with extensible enum discriminator type. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test extensible enum type for discriminator along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getExtensibleModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getExtensibleModelWithResponse(requestOptions); - } - - /** - * Send model with extensible enum discriminator type. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param input Dog to create. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putExtensibleModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putExtensibleModelWithResponse(input, requestOptions); - } - - /** - * Get a model omitting the discriminator. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model omitting the discriminator along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getExtensibleModelMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getExtensibleModelMissingDiscriminatorWithResponse(requestOptions); - } - - /** - * Get a model containing discriminator value never defined. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model containing discriminator value never defined along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getExtensibleModelWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getExtensibleModelWrongDiscriminatorWithResponse(requestOptions); - } - - /** - * Receive model with fixed enum discriminator type. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test fixed enum type for discriminator along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getFixedModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getFixedModelWithResponse(requestOptions); - } - - /** - * Send model with fixed enum discriminator type. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param input Snake to create. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putFixedModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putFixedModelWithResponse(input, requestOptions); - } - - /** - * Get a model omitting the discriminator. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model omitting the discriminator along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getFixedModelMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getFixedModelMissingDiscriminatorWithResponse(requestOptions); - } - - /** - * Get a model containing discriminator value never defined. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model containing discriminator value never defined along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getFixedModelWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getFixedModelWrongDiscriminatorWithResponse(requestOptions); - } - - /** - * Receive model with extensible enum discriminator type. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test extensible enum type for discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Dog getExtensibleModel() { - // Generated convenience method for getExtensibleModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getExtensibleModelWithResponse(requestOptions).getValue().toObject(Dog.class); - } - - /** - * Send model with extensible enum discriminator type. - * - * @param input Dog to create. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putExtensibleModel(Dog input) { - // Generated convenience method for putExtensibleModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - putExtensibleModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * Get a model omitting the discriminator. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a model omitting the discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Dog getExtensibleModelMissingDiscriminator() { - // Generated convenience method for getExtensibleModelMissingDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getExtensibleModelMissingDiscriminatorWithResponse(requestOptions).getValue().toObject(Dog.class); - } - - /** - * Get a model containing discriminator value never defined. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a model containing discriminator value never defined. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Dog getExtensibleModelWrongDiscriminator() { - // Generated convenience method for getExtensibleModelWrongDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getExtensibleModelWrongDiscriminatorWithResponse(requestOptions).getValue().toObject(Dog.class); - } - - /** - * Receive model with fixed enum discriminator type. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test fixed enum type for discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Snake getFixedModel() { - // Generated convenience method for getFixedModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getFixedModelWithResponse(requestOptions).getValue().toObject(Snake.class); - } - - /** - * Send model with fixed enum discriminator type. - * - * @param input Snake to create. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putFixedModel(Snake input) { - // Generated convenience method for putFixedModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - putFixedModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * Get a model omitting the discriminator. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a model omitting the discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Snake getFixedModelMissingDiscriminator() { - // Generated convenience method for getFixedModelMissingDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getFixedModelMissingDiscriminatorWithResponse(requestOptions).getValue().toObject(Snake.class); - } - - /** - * Get a model containing discriminator value never defined. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a model containing discriminator value never defined. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Snake getFixedModelWrongDiscriminator() { - // Generated convenience method for getFixedModelWrongDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getFixedModelWrongDiscriminatorWithResponse(requestOptions).getValue().toObject(Snake.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClientBuilder.java deleted file mode 100644 index dd739440e03..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.enumdiscriminator; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.model.inheritance.enumdiscriminator.implementation.EnumDiscriminatorClientImpl; - -/** - * A builder for creating a new instance of the EnumDiscriminatorClient type. - */ -@ServiceClientBuilder(serviceClients = { EnumDiscriminatorClient.class, EnumDiscriminatorAsyncClient.class }) -public final class EnumDiscriminatorClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("type-model-inheritance-enumdiscriminator.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the EnumDiscriminatorClientBuilder. - */ - @Generated - public EnumDiscriminatorClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumDiscriminatorClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumDiscriminatorClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumDiscriminatorClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumDiscriminatorClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumDiscriminatorClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumDiscriminatorClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumDiscriminatorClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public EnumDiscriminatorClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the EnumDiscriminatorClientBuilder. - */ - @Generated - public EnumDiscriminatorClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of EnumDiscriminatorClientImpl with the provided parameters. - * - * @return an instance of EnumDiscriminatorClientImpl. - */ - @Generated - private EnumDiscriminatorClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - EnumDiscriminatorClientImpl client = new EnumDiscriminatorClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of EnumDiscriminatorAsyncClient class. - * - * @return an instance of EnumDiscriminatorAsyncClient. - */ - @Generated - public EnumDiscriminatorAsyncClient buildAsyncClient() { - return new EnumDiscriminatorAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of EnumDiscriminatorClient class. - * - * @return an instance of EnumDiscriminatorClient. - */ - @Generated - public EnumDiscriminatorClient buildClient() { - return new EnumDiscriminatorClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(EnumDiscriminatorClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java deleted file mode 100644 index 5026de86868..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java +++ /dev/null @@ -1,715 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.enumdiscriminator.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the EnumDiscriminatorClient type. - */ -public final class EnumDiscriminatorClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final EnumDiscriminatorClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of EnumDiscriminatorClient client. - * - * @param endpoint Service host. - */ - public EnumDiscriminatorClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of EnumDiscriminatorClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public EnumDiscriminatorClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of EnumDiscriminatorClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public EnumDiscriminatorClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(EnumDiscriminatorClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for EnumDiscriminatorClient to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "EnumDiscriminatorClient") - public interface EnumDiscriminatorClientService { - @Get("/type/model/inheritance/enum-discriminator/extensible-enum") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getExtensibleModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-discriminator/extensible-enum") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getExtensibleModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/enum-discriminator/extensible-enum") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putExtensibleModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/enum-discriminator/extensible-enum") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putExtensibleModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-discriminator/extensible-enum/missingdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getExtensibleModelMissingDiscriminator(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-discriminator/extensible-enum/missingdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getExtensibleModelMissingDiscriminatorSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-discriminator/extensible-enum/wrongdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getExtensibleModelWrongDiscriminator(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-discriminator/extensible-enum/wrongdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getExtensibleModelWrongDiscriminatorSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-discriminator/fixed-enum") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getFixedModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-discriminator/fixed-enum") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getFixedModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/enum-discriminator/fixed-enum") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putFixedModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/enum-discriminator/fixed-enum") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putFixedModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-discriminator/fixed-enum/missingdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getFixedModelMissingDiscriminator(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-discriminator/fixed-enum/missingdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getFixedModelMissingDiscriminatorSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-discriminator/fixed-enum/wrongdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getFixedModelWrongDiscriminator(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/enum-discriminator/fixed-enum/wrongdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getFixedModelWrongDiscriminatorSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * Receive model with extensible enum discriminator type. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test extensible enum type for discriminator along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getExtensibleModelWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getExtensibleModel(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Receive model with extensible enum discriminator type. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test extensible enum type for discriminator along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getExtensibleModelWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getExtensibleModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Send model with extensible enum discriminator type. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param input Dog to create. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putExtensibleModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putExtensibleModel(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * Send model with extensible enum discriminator type. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param input Dog to create. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putExtensibleModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putExtensibleModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * Get a model omitting the discriminator. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model omitting the discriminator along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getExtensibleModelMissingDiscriminatorWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getExtensibleModelMissingDiscriminator(this.getEndpoint(), - accept, requestOptions, context)); - } - - /** - * Get a model omitting the discriminator. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model omitting the discriminator along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getExtensibleModelMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getExtensibleModelMissingDiscriminatorSync(this.getEndpoint(), accept, requestOptions, - Context.NONE); - } - - /** - * Get a model containing discriminator value never defined. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model containing discriminator value never defined along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getExtensibleModelWrongDiscriminatorWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getExtensibleModelWrongDiscriminator(this.getEndpoint(), accept, - requestOptions, context)); - } - - /** - * Get a model containing discriminator value never defined. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(golden) (Required)
-     *     weight: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model containing discriminator value never defined along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getExtensibleModelWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getExtensibleModelWrongDiscriminatorSync(this.getEndpoint(), accept, requestOptions, - Context.NONE); - } - - /** - * Receive model with fixed enum discriminator type. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test fixed enum type for discriminator along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getFixedModelWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getFixedModel(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Receive model with fixed enum discriminator type. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test fixed enum type for discriminator along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getFixedModelWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getFixedModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Send model with fixed enum discriminator type. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param input Snake to create. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putFixedModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putFixedModel(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * Send model with fixed enum discriminator type. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param input Snake to create. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putFixedModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putFixedModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * Get a model omitting the discriminator. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model omitting the discriminator along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> - getFixedModelMissingDiscriminatorWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getFixedModelMissingDiscriminator(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get a model omitting the discriminator. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model omitting the discriminator along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getFixedModelMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getFixedModelMissingDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get a model containing discriminator value never defined. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model containing discriminator value never defined along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getFixedModelWrongDiscriminatorWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getFixedModelWrongDiscriminator(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get a model containing discriminator value never defined. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String(cobra) (Required)
-     *     length: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a model containing discriminator value never defined along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getFixedModelWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getFixedModelWrongDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/package-info.java deleted file mode 100644 index 7c498adcc80..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for EnumDiscriminator. - * Illustrates inheritance with enum discriminator. - * - */ -package type.model.inheritance.enumdiscriminator.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Cobra.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Cobra.java deleted file mode 100644 index 197808ae5dc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Cobra.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.enumdiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Cobra model. - */ -@Immutable -public final class Cobra extends Snake { - /* - * discriminator property - */ - @Generated - private SnakeKind kind = SnakeKind.COBRA; - - /** - * Creates an instance of Cobra class. - * - * @param length the length value to set. - */ - @Generated - public Cobra(int length) { - super(length); - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - @Generated - @Override - public SnakeKind getKind() { - return this.kind; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("length", getLength()); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Cobra from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Cobra if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Cobra. - */ - @Generated - public static Cobra fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int length = 0; - SnakeKind kind = SnakeKind.COBRA; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("length".equals(fieldName)) { - length = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = SnakeKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - Cobra deserializedCobra = new Cobra(length); - deserializedCobra.kind = kind; - - return deserializedCobra; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Dog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Dog.java deleted file mode 100644 index 29c283b93a9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Dog.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.enumdiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Test extensible enum type for discriminator. - */ -@Immutable -public class Dog implements JsonSerializable { - /* - * discriminator property - */ - @Generated - private DogKind kind = DogKind.fromString("Dog"); - - /* - * Weight of the dog - */ - @Generated - private final int weight; - - /** - * Creates an instance of Dog class. - * - * @param weight the weight value to set. - */ - @Generated - public Dog(int weight) { - this.weight = weight; - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - @Generated - public DogKind getKind() { - return this.kind; - } - - /** - * Get the weight property: Weight of the dog. - * - * @return the weight value. - */ - @Generated - public int getWeight() { - return this.weight; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("weight", this.weight); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Dog from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Dog if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Dog. - */ - @Generated - public static Dog fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("golden".equals(discriminatorValue)) { - return Golden.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Dog fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int weight = 0; - DogKind kind = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("weight".equals(fieldName)) { - weight = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = DogKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - Dog deserializedDog = new Dog(weight); - deserializedDog.kind = kind; - - return deserializedDog; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/DogKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/DogKind.java deleted file mode 100644 index ea58d06ad70..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/DogKind.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.enumdiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * extensible enum type for discriminator. - */ -public final class DogKind extends ExpandableStringEnum { - /** - * Species golden. - */ - @Generated - public static final DogKind GOLDEN = fromString("golden"); - - /** - * Creates a new instance of DogKind value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public DogKind() { - } - - /** - * Creates or finds a DogKind from its string representation. - * - * @param name a name to look for. - * @return the corresponding DogKind. - */ - @Generated - public static DogKind fromString(String name) { - return fromString(name, DogKind.class); - } - - /** - * Gets known DogKind values. - * - * @return known DogKind values. - */ - @Generated - public static Collection values() { - return values(DogKind.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Golden.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Golden.java deleted file mode 100644 index 733b5ba7fd1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Golden.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.enumdiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Golden dog model. - */ -@Immutable -public final class Golden extends Dog { - /* - * discriminator property - */ - @Generated - private DogKind kind = DogKind.GOLDEN; - - /** - * Creates an instance of Golden class. - * - * @param weight the weight value to set. - */ - @Generated - public Golden(int weight) { - super(weight); - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - @Generated - @Override - public DogKind getKind() { - return this.kind; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("weight", getWeight()); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Golden from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Golden if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Golden. - */ - @Generated - public static Golden fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int weight = 0; - DogKind kind = DogKind.GOLDEN; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("weight".equals(fieldName)) { - weight = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = DogKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - Golden deserializedGolden = new Golden(weight); - deserializedGolden.kind = kind; - - return deserializedGolden; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Snake.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Snake.java deleted file mode 100644 index c3fd6b2184e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Snake.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.enumdiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Test fixed enum type for discriminator. - */ -@Immutable -public class Snake implements JsonSerializable { - /* - * discriminator property - */ - @Generated - private SnakeKind kind; - - /* - * Length of the snake - */ - @Generated - private final int length; - - /** - * Creates an instance of Snake class. - * - * @param length the length value to set. - */ - @Generated - public Snake(int length) { - this.length = length; - } - - /** - * Get the kind property: discriminator property. - * - * @return the kind value. - */ - @Generated - public SnakeKind getKind() { - return this.kind; - } - - /** - * Get the length property: Length of the snake. - * - * @return the length value. - */ - @Generated - public int getLength() { - return this.length; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("length", this.length); - jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Snake from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Snake if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Snake. - */ - @Generated - public static Snake fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("cobra".equals(discriminatorValue)) { - return Cobra.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Snake fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int length = 0; - SnakeKind kind = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("length".equals(fieldName)) { - length = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = SnakeKind.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - Snake deserializedSnake = new Snake(length); - deserializedSnake.kind = kind; - - return deserializedSnake; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/SnakeKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/SnakeKind.java deleted file mode 100644 index 701a1a9a0db..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/SnakeKind.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.enumdiscriminator.models; - -/** - * fixed enum type for discriminator. - */ -public enum SnakeKind { - /** - * Species cobra. - */ - COBRA("cobra"); - - /** - * The actual serialized value for a SnakeKind instance. - */ - private final String value; - - SnakeKind(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a SnakeKind instance. - * - * @param value the serialized value to parse. - * @return the parsed SnakeKind object, or null if unable to parse. - */ - public static SnakeKind fromString(String value) { - if (value == null) { - return null; - } - SnakeKind[] items = SnakeKind.values(); - for (SnakeKind item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/package-info.java deleted file mode 100644 index 8535700a042..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for EnumDiscriminator. - * Illustrates inheritance with enum discriminator. - * - */ -package type.model.inheritance.enumdiscriminator.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/package-info.java deleted file mode 100644 index 95e67087487..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for EnumDiscriminator. - * Illustrates inheritance with enum discriminator. - * - */ -package type.model.inheritance.enumdiscriminator; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorAsyncClient.java deleted file mode 100644 index baf5603147e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorAsyncClient.java +++ /dev/null @@ -1,322 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.nesteddiscriminator; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.model.inheritance.nesteddiscriminator.implementation.NestedDiscriminatorClientImpl; -import type.model.inheritance.nesteddiscriminator.models.Fish; - -/** - * Initializes a new instance of the asynchronous NestedDiscriminatorClient type. - */ -@ServiceClient(builder = NestedDiscriminatorClientBuilder.class, isAsync = true) -public final class NestedDiscriminatorAsyncClient { - @Generated - private final NestedDiscriminatorClientImpl serviceClient; - - /** - * Initializes an instance of NestedDiscriminatorAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NestedDiscriminatorAsyncClient(NestedDiscriminatorClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getModelWithResponseAsync(requestOptions); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putModelWithResponseAsync(input, requestOptions); - } - - /** - * The getRecursiveModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getRecursiveModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getRecursiveModelWithResponseAsync(requestOptions); - } - - /** - * The putRecursiveModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putRecursiveModelWithResponseAsync(input, requestOptions); - } - - /** - * The getMissingDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getMissingDiscriminatorWithResponseAsync(requestOptions); - } - - /** - * The getWrongDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWrongDiscriminatorWithResponseAsync(requestOptions); - } - - /** - * The getModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getModel() { - // Generated convenience method for getModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); - } - - /** - * The putModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putModel(Fish input) { - // Generated convenience method for putModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getRecursiveModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getRecursiveModel() { - // Generated convenience method for getRecursiveModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getRecursiveModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); - } - - /** - * The putRecursiveModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putRecursiveModel(Fish input) { - // Generated convenience method for putRecursiveModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putRecursiveModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getMissingDiscriminator operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getMissingDiscriminator() { - // Generated convenience method for getMissingDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getMissingDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); - } - - /** - * The getWrongDiscriminator operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getWrongDiscriminator() { - // Generated convenience method for getWrongDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWrongDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClient.java deleted file mode 100644 index ac552183ab1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClient.java +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.nesteddiscriminator; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.model.inheritance.nesteddiscriminator.implementation.NestedDiscriminatorClientImpl; -import type.model.inheritance.nesteddiscriminator.models.Fish; - -/** - * Initializes a new instance of the synchronous NestedDiscriminatorClient type. - */ -@ServiceClient(builder = NestedDiscriminatorClientBuilder.class) -public final class NestedDiscriminatorClient { - @Generated - private final NestedDiscriminatorClientImpl serviceClient; - - /** - * Initializes an instance of NestedDiscriminatorClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NestedDiscriminatorClient(NestedDiscriminatorClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getModelWithResponse(requestOptions); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putModelWithResponse(input, requestOptions); - } - - /** - * The getRecursiveModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRecursiveModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getRecursiveModelWithResponse(requestOptions); - } - - /** - * The putRecursiveModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putRecursiveModelWithResponse(input, requestOptions); - } - - /** - * The getMissingDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getMissingDiscriminatorWithResponse(requestOptions); - } - - /** - * The getWrongDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWrongDiscriminatorWithResponse(requestOptions); - } - - /** - * The getModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Fish getModel() { - // Generated convenience method for getModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getModelWithResponse(requestOptions).getValue().toObject(Fish.class); - } - - /** - * The putModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putModel(Fish input) { - // Generated convenience method for putModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - putModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The getRecursiveModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Fish getRecursiveModel() { - // Generated convenience method for getRecursiveModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getRecursiveModelWithResponse(requestOptions).getValue().toObject(Fish.class); - } - - /** - * The putRecursiveModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putRecursiveModel(Fish input) { - // Generated convenience method for putRecursiveModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - putRecursiveModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The getMissingDiscriminator operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Fish getMissingDiscriminator() { - // Generated convenience method for getMissingDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getMissingDiscriminatorWithResponse(requestOptions).getValue().toObject(Fish.class); - } - - /** - * The getWrongDiscriminator operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Fish getWrongDiscriminator() { - // Generated convenience method for getWrongDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWrongDiscriminatorWithResponse(requestOptions).getValue().toObject(Fish.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClientBuilder.java deleted file mode 100644 index 96fc0b17d39..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.nesteddiscriminator; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.model.inheritance.nesteddiscriminator.implementation.NestedDiscriminatorClientImpl; - -/** - * A builder for creating a new instance of the NestedDiscriminatorClient type. - */ -@ServiceClientBuilder(serviceClients = { NestedDiscriminatorClient.class, NestedDiscriminatorAsyncClient.class }) -public final class NestedDiscriminatorClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("type-model-inheritance-nesteddiscriminator.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the NestedDiscriminatorClientBuilder. - */ - @Generated - public NestedDiscriminatorClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NestedDiscriminatorClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NestedDiscriminatorClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NestedDiscriminatorClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NestedDiscriminatorClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NestedDiscriminatorClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NestedDiscriminatorClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NestedDiscriminatorClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NestedDiscriminatorClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the NestedDiscriminatorClientBuilder. - */ - @Generated - public NestedDiscriminatorClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of NestedDiscriminatorClientImpl with the provided parameters. - * - * @return an instance of NestedDiscriminatorClientImpl. - */ - @Generated - private NestedDiscriminatorClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - NestedDiscriminatorClientImpl client = new NestedDiscriminatorClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of NestedDiscriminatorAsyncClient class. - * - * @return an instance of NestedDiscriminatorAsyncClient. - */ - @Generated - public NestedDiscriminatorAsyncClient buildAsyncClient() { - return new NestedDiscriminatorAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of NestedDiscriminatorClient class. - * - * @return an instance of NestedDiscriminatorClient. - */ - @Generated - public NestedDiscriminatorClient buildClient() { - return new NestedDiscriminatorClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(NestedDiscriminatorClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java deleted file mode 100644 index df2f0e65d03..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java +++ /dev/null @@ -1,571 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.nesteddiscriminator.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the NestedDiscriminatorClient type. - */ -public final class NestedDiscriminatorClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NestedDiscriminatorClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of NestedDiscriminatorClient client. - * - * @param endpoint Service host. - */ - public NestedDiscriminatorClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NestedDiscriminatorClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public NestedDiscriminatorClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NestedDiscriminatorClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public NestedDiscriminatorClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(NestedDiscriminatorClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for NestedDiscriminatorClient to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NestedDiscriminatorClient") - public interface NestedDiscriminatorClientService { - @Get("/type/model/inheritance/nested-discriminator/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/nested-discriminator/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getModelSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/nested-discriminator/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/nested-discriminator/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/nested-discriminator/recursivemodel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getRecursiveModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/nested-discriminator/recursivemodel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getRecursiveModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/nested-discriminator/recursivemodel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putRecursiveModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/nested-discriminator/recursivemodel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putRecursiveModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/nested-discriminator/missingdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getMissingDiscriminator(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/nested-discriminator/missingdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getMissingDiscriminatorSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/nested-discriminator/wrongdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getWrongDiscriminator(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/nested-discriminator/wrongdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getWrongDiscriminatorSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getModelWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getModel(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getModelWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.putModel(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The getRecursiveModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getRecursiveModelWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getRecursiveModel(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getRecursiveModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRecursiveModelWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getRecursiveModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The putRecursiveModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putRecursiveModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putRecursiveModel(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The putRecursiveModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putRecursiveModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The getMissingDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getMissingDiscriminatorWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getMissingDiscriminator(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getMissingDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getMissingDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getWrongDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWrongDiscriminatorWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getWrongDiscriminator(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getWrongDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     age: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getWrongDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/package-info.java deleted file mode 100644 index deb968c8752..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for NestedDiscriminator. - * Illustrates multiple level inheritance with multiple discriminators. - * - */ -package type.model.inheritance.nesteddiscriminator.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Fish.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Fish.java deleted file mode 100644 index c30dd9f908c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Fish.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.nesteddiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * This is base model for polymorphic multiple levels inheritance with a discriminator. - */ -@Immutable -public class Fish implements JsonSerializable { - /* - * Discriminator property for Fish. - */ - @Generated - private String kind = "Fish"; - - /* - * The age property. - */ - @Generated - private final int age; - - /** - * Creates an instance of Fish class. - * - * @param age the age value to set. - */ - @Generated - public Fish(int age) { - this.age = age; - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Generated - public String getKind() { - return this.kind; - } - - /** - * Get the age property: The age property. - * - * @return the age value. - */ - @Generated - public int getAge() { - return this.age; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("age", this.age); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Fish from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Fish if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Fish. - */ - @Generated - public static Fish fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("shark".equals(discriminatorValue)) { - return Shark.fromJson(readerToUse.reset()); - } else if ("salmon".equals(discriminatorValue)) { - return Salmon.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Fish fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int age = 0; - String kind = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - age = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - Fish deserializedFish = new Fish(age); - deserializedFish.kind = kind; - - return deserializedFish; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java deleted file mode 100644 index c852ed3cb50..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.nesteddiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The third level model GoblinShark in polymorphic multiple levels inheritance. - */ -@Immutable -public final class GoblinShark extends Shark { - /* - * Discriminator property for Fish. - */ - @Generated - private String kind = "shark"; - - /* - * The sharktype property. - */ - @Generated - private String sharktype = "goblin"; - - /** - * Creates an instance of GoblinShark class. - * - * @param age the age value to set. - */ - @Generated - public GoblinShark(int age) { - super(age); - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * Get the sharktype property: The sharktype property. - * - * @return the sharktype value. - */ - @Generated - @Override - public String getSharktype() { - return this.sharktype; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeIntField("age", getAge()); - jsonWriter.writeStringField("sharktype", this.sharktype); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GoblinShark from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GoblinShark if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GoblinShark. - */ - @Generated - public static GoblinShark fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int age = 0; - String sharktype = "goblin"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - age = reader.getInt(); - } else if ("sharktype".equals(fieldName)) { - sharktype = reader.getString(); - } else { - reader.skipChildren(); - } - } - GoblinShark deserializedGoblinShark = new GoblinShark(age); - deserializedGoblinShark.sharktype = sharktype; - - return deserializedGoblinShark; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Salmon.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Salmon.java deleted file mode 100644 index 1b624cf2a94..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Salmon.java +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.nesteddiscriminator.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic - * instances. - */ -@Fluent -public final class Salmon extends Fish { - /* - * Discriminator property for Fish. - */ - @Generated - private String kind = "salmon"; - - /* - * The friends property. - */ - @Generated - private List friends; - - /* - * The hate property. - */ - @Generated - private Map hate; - - /* - * The partner property. - */ - @Generated - private Fish partner; - - /** - * Creates an instance of Salmon class. - * - * @param age the age value to set. - */ - @Generated - public Salmon(int age) { - super(age); - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * Get the friends property: The friends property. - * - * @return the friends value. - */ - @Generated - public List getFriends() { - return this.friends; - } - - /** - * Set the friends property: The friends property. - * - * @param friends the friends value to set. - * @return the Salmon object itself. - */ - @Generated - public Salmon setFriends(List friends) { - this.friends = friends; - return this; - } - - /** - * Get the hate property: The hate property. - * - * @return the hate value. - */ - @Generated - public Map getHate() { - return this.hate; - } - - /** - * Set the hate property: The hate property. - * - * @param hate the hate value to set. - * @return the Salmon object itself. - */ - @Generated - public Salmon setHate(Map hate) { - this.hate = hate; - return this; - } - - /** - * Get the partner property: The partner property. - * - * @return the partner value. - */ - @Generated - public Fish getPartner() { - return this.partner; - } - - /** - * Set the partner property: The partner property. - * - * @param partner the partner value to set. - * @return the Salmon object itself. - */ - @Generated - public Salmon setPartner(Fish partner) { - this.partner = partner; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("age", getAge()); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeArrayField("friends", this.friends, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeMapField("hate", this.hate, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeJsonField("partner", this.partner); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Salmon from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Salmon if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Salmon. - */ - @Generated - public static Salmon fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int age = 0; - String kind = "salmon"; - List friends = null; - Map hate = null; - Fish partner = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - age = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else if ("friends".equals(fieldName)) { - friends = reader.readArray(reader1 -> Fish.fromJson(reader1)); - } else if ("hate".equals(fieldName)) { - hate = reader.readMap(reader1 -> Fish.fromJson(reader1)); - } else if ("partner".equals(fieldName)) { - partner = Fish.fromJson(reader); - } else { - reader.skipChildren(); - } - } - Salmon deserializedSalmon = new Salmon(age); - deserializedSalmon.kind = kind; - deserializedSalmon.friends = friends; - deserializedSalmon.hate = hate; - deserializedSalmon.partner = partner; - - return deserializedSalmon; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/SawShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/SawShark.java deleted file mode 100644 index a1f4a21c76d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/SawShark.java +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.nesteddiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The third level model SawShark in polymorphic multiple levels inheritance. - */ -@Immutable -public final class SawShark extends Shark { - /* - * Discriminator property for Fish. - */ - @Generated - private String kind = "shark"; - - /* - * The sharktype property. - */ - @Generated - private String sharktype = "saw"; - - /** - * Creates an instance of SawShark class. - * - * @param age the age value to set. - */ - @Generated - public SawShark(int age) { - super(age); - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * Get the sharktype property: The sharktype property. - * - * @return the sharktype value. - */ - @Generated - @Override - public String getSharktype() { - return this.sharktype; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeIntField("age", getAge()); - jsonWriter.writeStringField("sharktype", this.sharktype); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SawShark from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SawShark if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SawShark. - */ - @Generated - public static SawShark fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int age = 0; - String sharktype = "saw"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - age = reader.getInt(); - } else if ("sharktype".equals(fieldName)) { - sharktype = reader.getString(); - } else { - reader.skipChildren(); - } - } - SawShark deserializedSawShark = new SawShark(age); - deserializedSawShark.sharktype = sharktype; - - return deserializedSawShark; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Shark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Shark.java deleted file mode 100644 index 3b9f02f8e18..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Shark.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.nesteddiscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The second level model in polymorphic multiple levels inheritance and it defines a new discriminator. - */ -@Immutable -public class Shark extends Fish { - /* - * Discriminator property for Fish. - */ - @Generated - private String kind = "shark"; - - /* - * The sharktype property. - */ - @Generated - private String sharktype = "shark"; - - /** - * Creates an instance of Shark class. - * - * @param age the age value to set. - */ - @Generated - public Shark(int age) { - super(age); - } - - /** - * Get the kind property: Discriminator property for Fish. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * Get the sharktype property: The sharktype property. - * - * @return the sharktype value. - */ - @Generated - public String getSharktype() { - return this.sharktype; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeIntField("age", getAge()); - jsonWriter.writeStringField("sharktype", this.sharktype); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Shark from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Shark if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Shark. - */ - @Generated - public static Shark fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("sharktype".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("saw".equals(discriminatorValue)) { - return SawShark.fromJson(readerToUse.reset()); - } else if ("goblin".equals(discriminatorValue)) { - return GoblinShark.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Shark fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int age = 0; - String sharktype = "shark"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("age".equals(fieldName)) { - age = reader.getInt(); - } else if ("sharktype".equals(fieldName)) { - sharktype = reader.getString(); - } else { - reader.skipChildren(); - } - } - Shark deserializedShark = new Shark(age); - deserializedShark.sharktype = sharktype; - - return deserializedShark; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/package-info.java deleted file mode 100644 index cd42efe5425..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for NestedDiscriminator. - * Illustrates multiple level inheritance with multiple discriminators. - * - */ -package type.model.inheritance.nesteddiscriminator.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/package-info.java deleted file mode 100644 index 0f75dd1a6e2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for NestedDiscriminator. - * Illustrates multiple level inheritance with multiple discriminators. - * - */ -package type.model.inheritance.nesteddiscriminator; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedAsyncClient.java deleted file mode 100644 index 93fdecacc05..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedAsyncClient.java +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.notdiscriminated; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.model.inheritance.notdiscriminated.implementation.NotDiscriminatedClientImpl; -import type.model.inheritance.notdiscriminated.models.Siamese; - -/** - * Initializes a new instance of the asynchronous NotDiscriminatedClient type. - */ -@ServiceClient(builder = NotDiscriminatedClientBuilder.class, isAsync = true) -public final class NotDiscriminatedAsyncClient { - @Generated - private final NotDiscriminatedClientImpl serviceClient; - - /** - * Initializes an instance of NotDiscriminatedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NotDiscriminatedAsyncClient(NotDiscriminatedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The postValid operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postValidWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.postValidWithResponseAsync(input, requestOptions); - } - - /** - * The getValid operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the third level model in the normal multiple levels inheritance along with {@link Response} on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getValidWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getValidWithResponseAsync(requestOptions); - } - - /** - * The putValid operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the third level model in the normal multiple levels inheritance along with {@link Response} on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putValidWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putValidWithResponseAsync(input, requestOptions); - } - - /** - * The postValid operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono postValid(Siamese input) { - // Generated convenience method for postValidWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postValidWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getValid operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the third level model in the normal multiple levels inheritance on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getValid() { - // Generated convenience method for getValidWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getValidWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Siamese.class)); - } - - /** - * The putValid operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the third level model in the normal multiple levels inheritance on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putValid(Siamese input) { - // Generated convenience method for putValidWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putValidWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Siamese.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClient.java deleted file mode 100644 index c80e072a3ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClient.java +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.notdiscriminated; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.model.inheritance.notdiscriminated.implementation.NotDiscriminatedClientImpl; -import type.model.inheritance.notdiscriminated.models.Siamese; - -/** - * Initializes a new instance of the synchronous NotDiscriminatedClient type. - */ -@ServiceClient(builder = NotDiscriminatedClientBuilder.class) -public final class NotDiscriminatedClient { - @Generated - private final NotDiscriminatedClientImpl serviceClient; - - /** - * Initializes an instance of NotDiscriminatedClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NotDiscriminatedClient(NotDiscriminatedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The postValid operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postValidWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.postValidWithResponse(input, requestOptions); - } - - /** - * The getValid operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the third level model in the normal multiple levels inheritance along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getValidWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getValidWithResponse(requestOptions); - } - - /** - * The putValid operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the third level model in the normal multiple levels inheritance along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putValidWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putValidWithResponse(input, requestOptions); - } - - /** - * The postValid operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void postValid(Siamese input) { - // Generated convenience method for postValidWithResponse - RequestOptions requestOptions = new RequestOptions(); - postValidWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The getValid operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the third level model in the normal multiple levels inheritance. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Siamese getValid() { - // Generated convenience method for getValidWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getValidWithResponse(requestOptions).getValue().toObject(Siamese.class); - } - - /** - * The putValid operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the third level model in the normal multiple levels inheritance. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Siamese putValid(Siamese input) { - // Generated convenience method for putValidWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putValidWithResponse(BinaryData.fromObject(input), requestOptions).getValue().toObject(Siamese.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClientBuilder.java deleted file mode 100644 index 443bf41497c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.notdiscriminated; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.model.inheritance.notdiscriminated.implementation.NotDiscriminatedClientImpl; - -/** - * A builder for creating a new instance of the NotDiscriminatedClient type. - */ -@ServiceClientBuilder(serviceClients = { NotDiscriminatedClient.class, NotDiscriminatedAsyncClient.class }) -public final class NotDiscriminatedClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("type-model-inheritance-notdiscriminated.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the NotDiscriminatedClientBuilder. - */ - @Generated - public NotDiscriminatedClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDiscriminatedClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDiscriminatedClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDiscriminatedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDiscriminatedClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDiscriminatedClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDiscriminatedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDiscriminatedClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NotDiscriminatedClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the NotDiscriminatedClientBuilder. - */ - @Generated - public NotDiscriminatedClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of NotDiscriminatedClientImpl with the provided parameters. - * - * @return an instance of NotDiscriminatedClientImpl. - */ - @Generated - private NotDiscriminatedClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - NotDiscriminatedClientImpl client = new NotDiscriminatedClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of NotDiscriminatedAsyncClient class. - * - * @return an instance of NotDiscriminatedAsyncClient. - */ - @Generated - public NotDiscriminatedAsyncClient buildAsyncClient() { - return new NotDiscriminatedAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of NotDiscriminatedClient class. - * - * @return an instance of NotDiscriminatedClient. - */ - @Generated - public NotDiscriminatedClient buildClient() { - return new NotDiscriminatedClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(NotDiscriminatedClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java deleted file mode 100644 index 59f0edb04be..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java +++ /dev/null @@ -1,384 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.notdiscriminated.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the NotDiscriminatedClient type. - */ -public final class NotDiscriminatedClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NotDiscriminatedClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of NotDiscriminatedClient client. - * - * @param endpoint Service host. - */ - public NotDiscriminatedClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NotDiscriminatedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public NotDiscriminatedClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NotDiscriminatedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public NotDiscriminatedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(NotDiscriminatedClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for NotDiscriminatedClient to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NotDiscriminatedClient") - public interface NotDiscriminatedClientService { - @Post("/type/model/inheritance/not-discriminated/valid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> postValid(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Post("/type/model/inheritance/not-discriminated/valid") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postValidSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/not-discriminated/valid") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getValid(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/not-discriminated/valid") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getValidSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/not-discriminated/valid") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putValid(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/not-discriminated/valid") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putValidSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - } - - /** - * The postValid operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postValidWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.postValid(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The postValid operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postValidWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.postValidSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The getValid operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the third level model in the normal multiple levels inheritance along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getValidWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getValid(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getValid operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the third level model in the normal multiple levels inheritance along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getValidWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getValidSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The putValid operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the third level model in the normal multiple levels inheritance along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putValidWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.putValid(this.getEndpoint(), contentType, accept, input, requestOptions, context)); - } - - /** - * The putValid operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *     age: int (Required)
-     *     smart: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the third level model in the normal multiple levels inheritance along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putValidWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putValidSync(this.getEndpoint(), contentType, accept, input, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/package-info.java deleted file mode 100644 index e3fe76089dd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for NotDiscriminated. - * Illustrates not-discriminated inheritance model. - * - */ -package type.model.inheritance.notdiscriminated.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Cat.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Cat.java deleted file mode 100644 index a207a1c1b1d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Cat.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.notdiscriminated.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The second level model in the normal multiple levels inheritance. - */ -@Immutable -public class Cat extends Pet { - /* - * The age property. - */ - @Generated - private final int age; - - /** - * Creates an instance of Cat class. - * - * @param name the name value to set. - * @param age the age value to set. - */ - @Generated - public Cat(String name, int age) { - super(name); - this.age = age; - } - - /** - * Get the age property: The age property. - * - * @return the age value. - */ - @Generated - public int getAge() { - return this.age; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", getName()); - jsonWriter.writeIntField("age", this.age); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Cat from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Cat if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Cat. - */ - @Generated - public static Cat fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - int age = 0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("age".equals(fieldName)) { - age = reader.getInt(); - } else { - reader.skipChildren(); - } - } - return new Cat(name, age); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Pet.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Pet.java deleted file mode 100644 index 13bf3728a87..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Pet.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.notdiscriminated.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * This is base model for not-discriminated normal multiple levels inheritance. - */ -@Immutable -public class Pet implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Pet class. - * - * @param name the name value to set. - */ - @Generated - public Pet(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Pet from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Pet if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Pet. - */ - @Generated - public static Pet fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Pet(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Siamese.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Siamese.java deleted file mode 100644 index c410cf6c54d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Siamese.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.notdiscriminated.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The third level model in the normal multiple levels inheritance. - */ -@Immutable -public final class Siamese extends Cat { - /* - * The smart property. - */ - @Generated - private final boolean smart; - - /** - * Creates an instance of Siamese class. - * - * @param name the name value to set. - * @param age the age value to set. - * @param smart the smart value to set. - */ - @Generated - public Siamese(String name, int age, boolean smart) { - super(name, age); - this.smart = smart; - } - - /** - * Get the smart property: The smart property. - * - * @return the smart value. - */ - @Generated - public boolean isSmart() { - return this.smart; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", getName()); - jsonWriter.writeIntField("age", getAge()); - jsonWriter.writeBooleanField("smart", this.smart); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Siamese from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Siamese if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Siamese. - */ - @Generated - public static Siamese fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - int age = 0; - boolean smart = false; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("age".equals(fieldName)) { - age = reader.getInt(); - } else if ("smart".equals(fieldName)) { - smart = reader.getBoolean(); - } else { - reader.skipChildren(); - } - } - return new Siamese(name, age, smart); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/package-info.java deleted file mode 100644 index 9d3cf218184..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for NotDiscriminated. - * Illustrates not-discriminated inheritance model. - * - */ -package type.model.inheritance.notdiscriminated.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/package-info.java deleted file mode 100644 index 9a5e3f78c4a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for NotDiscriminated. - * Illustrates not-discriminated inheritance model. - * - */ -package type.model.inheritance.notdiscriminated; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveAsyncClient.java deleted file mode 100644 index 68a4f37d05a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.recursive; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.model.inheritance.recursive.implementation.RecursiveClientImpl; -import type.model.inheritance.recursive.models.Extension; - -/** - * Initializes a new instance of the asynchronous RecursiveClient type. - */ -@ServiceClient(builder = RecursiveClientBuilder.class, isAsync = true) -public final class RecursiveAsyncClient { - @Generated - private final RecursiveClientImpl serviceClient; - - /** - * Initializes an instance of RecursiveAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RecursiveAsyncClient(RecursiveClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     extension (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     level: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(input, requestOptions); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     extension (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     level: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return extension along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Extension input) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extension on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Extension.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClient.java deleted file mode 100644 index 23991ba91bd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.recursive; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.model.inheritance.recursive.implementation.RecursiveClientImpl; -import type.model.inheritance.recursive.models.Extension; - -/** - * Initializes a new instance of the synchronous RecursiveClient type. - */ -@ServiceClient(builder = RecursiveClientBuilder.class) -public final class RecursiveClient { - @Generated - private final RecursiveClientImpl serviceClient; - - /** - * Initializes an instance of RecursiveClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RecursiveClient(RecursiveClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     extension (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     level: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(input, requestOptions); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     extension (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     level: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return extension along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Extension input) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return extension. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Extension get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(Extension.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClientBuilder.java deleted file mode 100644 index 4a09e62c0c3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.recursive; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.model.inheritance.recursive.implementation.RecursiveClientImpl; - -/** - * A builder for creating a new instance of the RecursiveClient type. - */ -@ServiceClientBuilder(serviceClients = { RecursiveClient.class, RecursiveAsyncClient.class }) -public final class RecursiveClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("type-model-inheritance-recursive.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the RecursiveClientBuilder. - */ - @Generated - public RecursiveClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RecursiveClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RecursiveClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RecursiveClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RecursiveClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RecursiveClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RecursiveClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RecursiveClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RecursiveClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the RecursiveClientBuilder. - */ - @Generated - public RecursiveClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of RecursiveClientImpl with the provided parameters. - * - * @return an instance of RecursiveClientImpl. - */ - @Generated - private RecursiveClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - RecursiveClientImpl client - = new RecursiveClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of RecursiveAsyncClient class. - * - * @return an instance of RecursiveAsyncClient. - */ - @Generated - public RecursiveAsyncClient buildAsyncClient() { - return new RecursiveAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of RecursiveClient class. - * - * @return an instance of RecursiveClient. - */ - @Generated - public RecursiveClient buildClient() { - return new RecursiveClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(RecursiveClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java deleted file mode 100644 index 67b24ed388c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.recursive.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the RecursiveClient type. - */ -public final class RecursiveClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RecursiveClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of RecursiveClient client. - * - * @param endpoint Service host. - */ - public RecursiveClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of RecursiveClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public RecursiveClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of RecursiveClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public RecursiveClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(RecursiveClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for RecursiveClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "RecursiveClient") - public interface RecursiveClientService { - @Put("/type/model/inheritance/recursive") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/recursive") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/recursive") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/recursive") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     extension (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     level: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     extension (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     level: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     extension (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     level: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return extension along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     extension (Optional): [
-     *         (recursive schema, see above)
-     *     ]
-     *     level: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return extension along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/package-info.java deleted file mode 100644 index 40aaceb99df..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Recursive. - * Illustrates inheritance recursion. - * - */ -package type.model.inheritance.recursive.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Element.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Element.java deleted file mode 100644 index fc46eb75c75..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Element.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.recursive.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * element. - */ -@Fluent -public class Element implements JsonSerializable { - /* - * The extension property. - */ - @Generated - private List extension; - - /** - * Creates an instance of Element class. - */ - @Generated - public Element() { - } - - /** - * Get the extension property: The extension property. - * - * @return the extension value. - */ - @Generated - public List getExtension() { - return this.extension; - } - - /** - * Set the extension property: The extension property. - * - * @param extension the extension value to set. - * @return the Element object itself. - */ - @Generated - public Element setExtension(List extension) { - this.extension = extension; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("extension", this.extension, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Element from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Element if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IOException If an error occurs while reading the Element. - */ - @Generated - public static Element fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Element deserializedElement = new Element(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("extension".equals(fieldName)) { - List extension = reader.readArray(reader1 -> Extension.fromJson(reader1)); - deserializedElement.extension = extension; - } else { - reader.skipChildren(); - } - } - - return deserializedElement; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Extension.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Extension.java deleted file mode 100644 index 29b1361e769..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Extension.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.recursive.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * extension. - */ -@Fluent -public final class Extension extends Element { - /* - * The level property. - */ - @Generated - private final int level; - - /** - * Creates an instance of Extension class. - * - * @param level the level value to set. - */ - @Generated - public Extension(int level) { - this.level = level; - } - - /** - * Get the level property: The level property. - * - * @return the level value. - */ - @Generated - public int getLevel() { - return this.level; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public Extension setExtension(List extension) { - super.setExtension(extension); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("extension", getExtension(), (writer, element) -> writer.writeJson(element)); - jsonWriter.writeIntField("level", this.level); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Extension from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Extension if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Extension. - */ - @Generated - public static Extension fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List extension = null; - int level = 0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("extension".equals(fieldName)) { - extension = reader.readArray(reader1 -> Extension.fromJson(reader1)); - } else if ("level".equals(fieldName)) { - level = reader.getInt(); - } else { - reader.skipChildren(); - } - } - Extension deserializedExtension = new Extension(level); - deserializedExtension.setExtension(extension); - - return deserializedExtension; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/package-info.java deleted file mode 100644 index 7c2ee44abc3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Recursive. - * Illustrates inheritance recursion. - * - */ -package type.model.inheritance.recursive.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/package-info.java deleted file mode 100644 index 6b91169f366..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Recursive. - * Illustrates inheritance recursion. - * - */ -package type.model.inheritance.recursive; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorAsyncClient.java deleted file mode 100644 index 770d0e65de8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorAsyncClient.java +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.singlediscriminator; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.model.inheritance.singlediscriminator.implementation.SingleDiscriminatorClientImpl; -import type.model.inheritance.singlediscriminator.models.Bird; -import type.model.inheritance.singlediscriminator.models.Dinosaur; - -/** - * Initializes a new instance of the asynchronous SingleDiscriminatorClient type. - */ -@ServiceClient(builder = SingleDiscriminatorClientBuilder.class, isAsync = true) -public final class SingleDiscriminatorAsyncClient { - @Generated - private final SingleDiscriminatorClientImpl serviceClient; - - /** - * Initializes an instance of SingleDiscriminatorAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SingleDiscriminatorAsyncClient(SingleDiscriminatorClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getModelWithResponseAsync(requestOptions); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putModelWithResponseAsync(input, requestOptions); - } - - /** - * The getRecursiveModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getRecursiveModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getRecursiveModelWithResponseAsync(requestOptions); - } - - /** - * The putRecursiveModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putRecursiveModelWithResponseAsync(input, requestOptions); - } - - /** - * The getMissingDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getMissingDiscriminatorWithResponseAsync(requestOptions); - } - - /** - * The getWrongDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWrongDiscriminatorWithResponseAsync(requestOptions); - } - - /** - * The getLegacyModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     size: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return define a base class in the legacy way along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getLegacyModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getLegacyModelWithResponseAsync(requestOptions); - } - - /** - * The getModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic single level inheritance with a discriminator on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getModel() { - // Generated convenience method for getModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Bird.class)); - } - - /** - * The putModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putModel(Bird input) { - // Generated convenience method for putModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getRecursiveModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic single level inheritance with a discriminator on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getRecursiveModel() { - // Generated convenience method for getRecursiveModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getRecursiveModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Bird.class)); - } - - /** - * The putRecursiveModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putRecursiveModel(Bird input) { - // Generated convenience method for putRecursiveModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putRecursiveModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The getMissingDiscriminator operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic single level inheritance with a discriminator on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getMissingDiscriminator() { - // Generated convenience method for getMissingDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getMissingDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Bird.class)); - } - - /** - * The getWrongDiscriminator operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic single level inheritance with a discriminator on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getWrongDiscriminator() { - // Generated convenience method for getWrongDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWrongDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Bird.class)); - } - - /** - * The getLegacyModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return define a base class in the legacy way on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getLegacyModel() { - // Generated convenience method for getLegacyModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getLegacyModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Dinosaur.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClient.java deleted file mode 100644 index 004c639ff53..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClient.java +++ /dev/null @@ -1,355 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.singlediscriminator; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.model.inheritance.singlediscriminator.implementation.SingleDiscriminatorClientImpl; -import type.model.inheritance.singlediscriminator.models.Bird; -import type.model.inheritance.singlediscriminator.models.Dinosaur; - -/** - * Initializes a new instance of the synchronous SingleDiscriminatorClient type. - */ -@ServiceClient(builder = SingleDiscriminatorClientBuilder.class) -public final class SingleDiscriminatorClient { - @Generated - private final SingleDiscriminatorClientImpl serviceClient; - - /** - * Initializes an instance of SingleDiscriminatorClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SingleDiscriminatorClient(SingleDiscriminatorClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getModelWithResponse(requestOptions); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putModelWithResponse(input, requestOptions); - } - - /** - * The getRecursiveModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRecursiveModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getRecursiveModelWithResponse(requestOptions); - } - - /** - * The putRecursiveModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putRecursiveModelWithResponse(input, requestOptions); - } - - /** - * The getMissingDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getMissingDiscriminatorWithResponse(requestOptions); - } - - /** - * The getWrongDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWrongDiscriminatorWithResponse(requestOptions); - } - - /** - * The getLegacyModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     size: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return define a base class in the legacy way along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getLegacyModelWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getLegacyModelWithResponse(requestOptions); - } - - /** - * The getModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic single level inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Bird getModel() { - // Generated convenience method for getModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getModelWithResponse(requestOptions).getValue().toObject(Bird.class); - } - - /** - * The putModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putModel(Bird input) { - // Generated convenience method for putModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - putModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The getRecursiveModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic single level inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Bird getRecursiveModel() { - // Generated convenience method for getRecursiveModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getRecursiveModelWithResponse(requestOptions).getValue().toObject(Bird.class); - } - - /** - * The putRecursiveModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putRecursiveModel(Bird input) { - // Generated convenience method for putRecursiveModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - putRecursiveModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The getMissingDiscriminator operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic single level inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Bird getMissingDiscriminator() { - // Generated convenience method for getMissingDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getMissingDiscriminatorWithResponse(requestOptions).getValue().toObject(Bird.class); - } - - /** - * The getWrongDiscriminator operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return this is base model for polymorphic single level inheritance with a discriminator. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Bird getWrongDiscriminator() { - // Generated convenience method for getWrongDiscriminatorWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWrongDiscriminatorWithResponse(requestOptions).getValue().toObject(Bird.class); - } - - /** - * The getLegacyModel operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return define a base class in the legacy way. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Dinosaur getLegacyModel() { - // Generated convenience method for getLegacyModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getLegacyModelWithResponse(requestOptions).getValue().toObject(Dinosaur.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClientBuilder.java deleted file mode 100644 index a9cd6bbba06..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClientBuilder.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.singlediscriminator; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.model.inheritance.singlediscriminator.implementation.SingleDiscriminatorClientImpl; - -/** - * A builder for creating a new instance of the SingleDiscriminatorClient type. - */ -@ServiceClientBuilder(serviceClients = { SingleDiscriminatorClient.class, SingleDiscriminatorAsyncClient.class }) -public final class SingleDiscriminatorClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("type-model-inheritance-singlediscriminator.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the SingleDiscriminatorClientBuilder. - */ - @Generated - public SingleDiscriminatorClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleDiscriminatorClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleDiscriminatorClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleDiscriminatorClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleDiscriminatorClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleDiscriminatorClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleDiscriminatorClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleDiscriminatorClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public SingleDiscriminatorClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the SingleDiscriminatorClientBuilder. - */ - @Generated - public SingleDiscriminatorClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of SingleDiscriminatorClientImpl with the provided parameters. - * - * @return an instance of SingleDiscriminatorClientImpl. - */ - @Generated - private SingleDiscriminatorClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - SingleDiscriminatorClientImpl client = new SingleDiscriminatorClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of SingleDiscriminatorAsyncClient class. - * - * @return an instance of SingleDiscriminatorAsyncClient. - */ - @Generated - public SingleDiscriminatorAsyncClient buildAsyncClient() { - return new SingleDiscriminatorAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of SingleDiscriminatorClient class. - * - * @return an instance of SingleDiscriminatorClient. - */ - @Generated - public SingleDiscriminatorClient buildClient() { - return new SingleDiscriminatorClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(SingleDiscriminatorClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java deleted file mode 100644 index 59e696cf8e9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java +++ /dev/null @@ -1,643 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.singlediscriminator.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the SingleDiscriminatorClient type. - */ -public final class SingleDiscriminatorClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SingleDiscriminatorClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of SingleDiscriminatorClient client. - * - * @param endpoint Service host. - */ - public SingleDiscriminatorClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of SingleDiscriminatorClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public SingleDiscriminatorClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of SingleDiscriminatorClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public SingleDiscriminatorClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service - = RestProxy.create(SingleDiscriminatorClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for SingleDiscriminatorClient to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "SingleDiscriminatorClient") - public interface SingleDiscriminatorClientService { - @Get("/type/model/inheritance/single-discriminator/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/single-discriminator/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getModelSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/single-discriminator/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/single-discriminator/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/single-discriminator/recursivemodel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getRecursiveModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/single-discriminator/recursivemodel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getRecursiveModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/single-discriminator/recursivemodel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putRecursiveModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/inheritance/single-discriminator/recursivemodel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putRecursiveModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/single-discriminator/missingdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getMissingDiscriminator(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/single-discriminator/missingdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getMissingDiscriminatorSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/single-discriminator/wrongdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getWrongDiscriminator(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/single-discriminator/wrongdiscriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getWrongDiscriminatorSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/single-discriminator/legacy-model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getLegacyModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/model/inheritance/single-discriminator/legacy-model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getLegacyModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getModelWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getModel(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getModelWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.putModel(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The getRecursiveModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getRecursiveModelWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getRecursiveModel(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getRecursiveModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRecursiveModelWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getRecursiveModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The putRecursiveModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putRecursiveModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putRecursiveModel(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The putRecursiveModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putRecursiveModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The getMissingDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getMissingDiscriminatorWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getMissingDiscriminator(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getMissingDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getMissingDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getWrongDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWrongDiscriminatorWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getWrongDiscriminator(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getWrongDiscriminator operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     wingspan: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return this is base model for polymorphic single level inheritance with a discriminator along with - * {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getWrongDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The getLegacyModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     size: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return define a base class in the legacy way along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getLegacyModelWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getLegacyModel(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The getLegacyModel operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     size: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return define a base class in the legacy way along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getLegacyModelWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getLegacyModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/package-info.java deleted file mode 100644 index 0ab1d6d0508..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for SingleDiscriminator. - * Illustrates inheritance with single discriminator. - * - */ -package type.model.inheritance.singlediscriminator.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Bird.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Bird.java deleted file mode 100644 index d4dc3d0f90b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Bird.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.singlediscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * This is base model for polymorphic single level inheritance with a discriminator. - */ -@Immutable -public class Bird implements JsonSerializable { - /* - * The kind property. - */ - @Generated - private String kind = "Bird"; - - /* - * The wingspan property. - */ - @Generated - private final int wingspan; - - /** - * Creates an instance of Bird class. - * - * @param wingspan the wingspan value to set. - */ - @Generated - public Bird(int wingspan) { - this.wingspan = wingspan; - } - - /** - * Get the kind property: The kind property. - * - * @return the kind value. - */ - @Generated - public String getKind() { - return this.kind; - } - - /** - * Get the wingspan property: The wingspan property. - * - * @return the wingspan value. - */ - @Generated - public int getWingspan() { - return this.wingspan; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("wingspan", this.wingspan); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Bird from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Bird if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Bird. - */ - @Generated - public static Bird fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("seagull".equals(discriminatorValue)) { - return SeaGull.fromJson(readerToUse.reset()); - } else if ("sparrow".equals(discriminatorValue)) { - return Sparrow.fromJson(readerToUse.reset()); - } else if ("goose".equals(discriminatorValue)) { - return Goose.fromJson(readerToUse.reset()); - } else if ("eagle".equals(discriminatorValue)) { - return Eagle.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Bird fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int wingspan = 0; - String kind = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("wingspan".equals(fieldName)) { - wingspan = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - Bird deserializedBird = new Bird(wingspan); - deserializedBird.kind = kind; - - return deserializedBird; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Dinosaur.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Dinosaur.java deleted file mode 100644 index e1d01a8c1da..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Dinosaur.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.singlediscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Define a base class in the legacy way. Discriminator property is not explicitly defined in the model. - */ -@Immutable -public class Dinosaur implements JsonSerializable { - /* - * Discriminator property for Dinosaur. - */ - @Generated - private String kind = "Dinosaur"; - - /* - * The size property. - */ - @Generated - private final int size; - - /** - * Creates an instance of Dinosaur class. - * - * @param size the size value to set. - */ - @Generated - protected Dinosaur(int size) { - this.size = size; - } - - /** - * Get the kind property: Discriminator property for Dinosaur. - * - * @return the kind value. - */ - @Generated - public String getKind() { - return this.kind; - } - - /** - * Get the size property: The size property. - * - * @return the size value. - */ - @Generated - public int getSize() { - return this.size; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("size", this.size); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Dinosaur from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Dinosaur if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Dinosaur. - */ - @Generated - public static Dinosaur fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("t-rex".equals(discriminatorValue)) { - return TRex.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static Dinosaur fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int size = 0; - String kind = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("size".equals(fieldName)) { - size = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - Dinosaur deserializedDinosaur = new Dinosaur(size); - deserializedDinosaur.kind = kind; - - return deserializedDinosaur; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Eagle.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Eagle.java deleted file mode 100644 index 110c42ee2b1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Eagle.java +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.singlediscriminator.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * The second level model in polymorphic single levels inheritance which contains references to other polymorphic - * instances. - */ -@Fluent -public final class Eagle extends Bird { - /* - * The kind property. - */ - @Generated - private String kind = "eagle"; - - /* - * The friends property. - */ - @Generated - private List friends; - - /* - * The hate property. - */ - @Generated - private Map hate; - - /* - * The partner property. - */ - @Generated - private Bird partner; - - /** - * Creates an instance of Eagle class. - * - * @param wingspan the wingspan value to set. - */ - @Generated - public Eagle(int wingspan) { - super(wingspan); - } - - /** - * Get the kind property: The kind property. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * Get the friends property: The friends property. - * - * @return the friends value. - */ - @Generated - public List getFriends() { - return this.friends; - } - - /** - * Set the friends property: The friends property. - * - * @param friends the friends value to set. - * @return the Eagle object itself. - */ - @Generated - public Eagle setFriends(List friends) { - this.friends = friends; - return this; - } - - /** - * Get the hate property: The hate property. - * - * @return the hate value. - */ - @Generated - public Map getHate() { - return this.hate; - } - - /** - * Set the hate property: The hate property. - * - * @param hate the hate value to set. - * @return the Eagle object itself. - */ - @Generated - public Eagle setHate(Map hate) { - this.hate = hate; - return this; - } - - /** - * Get the partner property: The partner property. - * - * @return the partner value. - */ - @Generated - public Bird getPartner() { - return this.partner; - } - - /** - * Set the partner property: The partner property. - * - * @param partner the partner value to set. - * @return the Eagle object itself. - */ - @Generated - public Eagle setPartner(Bird partner) { - this.partner = partner; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("wingspan", getWingspan()); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeArrayField("friends", this.friends, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeMapField("hate", this.hate, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeJsonField("partner", this.partner); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Eagle from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Eagle if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Eagle. - */ - @Generated - public static Eagle fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int wingspan = 0; - String kind = "eagle"; - List friends = null; - Map hate = null; - Bird partner = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("wingspan".equals(fieldName)) { - wingspan = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else if ("friends".equals(fieldName)) { - friends = reader.readArray(reader1 -> Bird.fromJson(reader1)); - } else if ("hate".equals(fieldName)) { - hate = reader.readMap(reader1 -> Bird.fromJson(reader1)); - } else if ("partner".equals(fieldName)) { - partner = Bird.fromJson(reader); - } else { - reader.skipChildren(); - } - } - Eagle deserializedEagle = new Eagle(wingspan); - deserializedEagle.kind = kind; - deserializedEagle.friends = friends; - deserializedEagle.hate = hate; - deserializedEagle.partner = partner; - - return deserializedEagle; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Goose.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Goose.java deleted file mode 100644 index a4e875b89d7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Goose.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.singlediscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The second level model in polymorphic single level inheritance. - */ -@Immutable -public final class Goose extends Bird { - /* - * The kind property. - */ - @Generated - private String kind = "goose"; - - /** - * Creates an instance of Goose class. - * - * @param wingspan the wingspan value to set. - */ - @Generated - public Goose(int wingspan) { - super(wingspan); - } - - /** - * Get the kind property: The kind property. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("wingspan", getWingspan()); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Goose from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Goose if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Goose. - */ - @Generated - public static Goose fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int wingspan = 0; - String kind = "goose"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("wingspan".equals(fieldName)) { - wingspan = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - Goose deserializedGoose = new Goose(wingspan); - deserializedGoose.kind = kind; - - return deserializedGoose; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/SeaGull.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/SeaGull.java deleted file mode 100644 index f0877a6e2ef..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/SeaGull.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.singlediscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The second level model in polymorphic single level inheritance. - */ -@Immutable -public final class SeaGull extends Bird { - /* - * The kind property. - */ - @Generated - private String kind = "seagull"; - - /** - * Creates an instance of SeaGull class. - * - * @param wingspan the wingspan value to set. - */ - @Generated - public SeaGull(int wingspan) { - super(wingspan); - } - - /** - * Get the kind property: The kind property. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("wingspan", getWingspan()); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SeaGull from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SeaGull if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SeaGull. - */ - @Generated - public static SeaGull fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int wingspan = 0; - String kind = "seagull"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("wingspan".equals(fieldName)) { - wingspan = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - SeaGull deserializedSeaGull = new SeaGull(wingspan); - deserializedSeaGull.kind = kind; - - return deserializedSeaGull; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Sparrow.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Sparrow.java deleted file mode 100644 index b72d72c773c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Sparrow.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.singlediscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The second level model in polymorphic single level inheritance. - */ -@Immutable -public final class Sparrow extends Bird { - /* - * The kind property. - */ - @Generated - private String kind = "sparrow"; - - /** - * Creates an instance of Sparrow class. - * - * @param wingspan the wingspan value to set. - */ - @Generated - public Sparrow(int wingspan) { - super(wingspan); - } - - /** - * Get the kind property: The kind property. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("wingspan", getWingspan()); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Sparrow from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Sparrow if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Sparrow. - */ - @Generated - public static Sparrow fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int wingspan = 0; - String kind = "sparrow"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("wingspan".equals(fieldName)) { - wingspan = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - Sparrow deserializedSparrow = new Sparrow(wingspan); - deserializedSparrow.kind = kind; - - return deserializedSparrow; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/TRex.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/TRex.java deleted file mode 100644 index 075b6d1e3fd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/TRex.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.singlediscriminator.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The second level legacy model in polymorphic single level inheritance. - */ -@Immutable -public final class TRex extends Dinosaur { - /* - * Discriminator property for Dinosaur. - */ - @Generated - private String kind = "t-rex"; - - /** - * Creates an instance of TRex class. - * - * @param size the size value to set. - */ - @Generated - private TRex(int size) { - super(size); - } - - /** - * Get the kind property: Discriminator property for Dinosaur. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("size", getSize()); - jsonWriter.writeStringField("kind", this.kind); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TRex from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TRex if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TRex. - */ - @Generated - public static TRex fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int size = 0; - String kind = "t-rex"; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("size".equals(fieldName)) { - size = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - reader.skipChildren(); - } - } - TRex deserializedTRex = new TRex(size); - deserializedTRex.kind = kind; - - return deserializedTRex; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/package-info.java deleted file mode 100644 index e874635d950..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for SingleDiscriminator. - * Illustrates inheritance with single discriminator. - * - */ -package type.model.inheritance.singlediscriminator.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/package-info.java deleted file mode 100644 index 927e9328502..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for SingleDiscriminator. - * Illustrates inheritance with single discriminator. - * - */ -package type.model.inheritance.singlediscriminator; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageAsyncClient.java deleted file mode 100644 index dd91dadd2c9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageAsyncClient.java +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.usage; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.model.usage.implementation.UsageClientImpl; -import type.model.usage.models.InputOutputRecord; -import type.model.usage.models.InputRecord; -import type.model.usage.models.OutputRecord; - -/** - * Initializes a new instance of the asynchronous UsageClient type. - */ -@ServiceClient(builder = UsageClientBuilder.class, isAsync = true) -public final class UsageAsyncClient { - @Generated - private final UsageClientImpl serviceClient; - - /** - * Initializes an instance of UsageAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UsageAsyncClient(UsageClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The input operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> inputWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.inputWithResponseAsync(input, requestOptions); - } - - /** - * The output operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return record used in operation return type along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> outputWithResponse(RequestOptions requestOptions) { - return this.serviceClient.outputWithResponseAsync(requestOptions); - } - - /** - * The inputAndOutput operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return record used both as operation parameter and return type along with {@link Response} on successful - * completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> inputAndOutputWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.inputAndOutputWithResponseAsync(body, requestOptions); - } - - /** - * The input operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono input(InputRecord input) { - // Generated convenience method for inputWithResponse - RequestOptions requestOptions = new RequestOptions(); - return inputWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The output operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return record used in operation return type on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono output() { - // Generated convenience method for outputWithResponse - RequestOptions requestOptions = new RequestOptions(); - return outputWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(OutputRecord.class)); - } - - /** - * The inputAndOutput operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return record used both as operation parameter and return type on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono inputAndOutput(InputOutputRecord body) { - // Generated convenience method for inputAndOutputWithResponse - RequestOptions requestOptions = new RequestOptions(); - return inputAndOutputWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(InputOutputRecord.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClient.java deleted file mode 100644 index 16abc9a3be4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClient.java +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.usage; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.model.usage.implementation.UsageClientImpl; -import type.model.usage.models.InputOutputRecord; -import type.model.usage.models.InputRecord; -import type.model.usage.models.OutputRecord; - -/** - * Initializes a new instance of the synchronous UsageClient type. - */ -@ServiceClient(builder = UsageClientBuilder.class) -public final class UsageClient { - @Generated - private final UsageClientImpl serviceClient; - - /** - * Initializes an instance of UsageClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UsageClient(UsageClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The input operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response inputWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.inputWithResponse(input, requestOptions); - } - - /** - * The output operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return record used in operation return type along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response outputWithResponse(RequestOptions requestOptions) { - return this.serviceClient.outputWithResponse(requestOptions); - } - - /** - * The inputAndOutput operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return record used both as operation parameter and return type along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response inputAndOutputWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.inputAndOutputWithResponse(body, requestOptions); - } - - /** - * The input operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void input(InputRecord input) { - // Generated convenience method for inputWithResponse - RequestOptions requestOptions = new RequestOptions(); - inputWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The output operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return record used in operation return type. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public OutputRecord output() { - // Generated convenience method for outputWithResponse - RequestOptions requestOptions = new RequestOptions(); - return outputWithResponse(requestOptions).getValue().toObject(OutputRecord.class); - } - - /** - * The inputAndOutput operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return record used both as operation parameter and return type. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public InputOutputRecord inputAndOutput(InputOutputRecord body) { - // Generated convenience method for inputAndOutputWithResponse - RequestOptions requestOptions = new RequestOptions(); - return inputAndOutputWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(InputOutputRecord.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClientBuilder.java deleted file mode 100644 index 2ebffa68ae8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.usage; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.model.usage.implementation.UsageClientImpl; - -/** - * A builder for creating a new instance of the UsageClient type. - */ -@ServiceClientBuilder(serviceClients = { UsageClient.class, UsageAsyncClient.class }) -public final class UsageClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("type-model-usage.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the UsageClientBuilder. - */ - @Generated - public UsageClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UsageClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the UsageClientBuilder. - */ - @Generated - public UsageClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of UsageClientImpl with the provided parameters. - * - * @return an instance of UsageClientImpl. - */ - @Generated - private UsageClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - UsageClientImpl client - = new UsageClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of UsageAsyncClient class. - * - * @return an instance of UsageAsyncClient. - */ - @Generated - public UsageAsyncClient buildAsyncClient() { - return new UsageAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of UsageClient class. - * - * @return an instance of UsageClient. - */ - @Generated - public UsageClient buildClient() { - return new UsageClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(UsageClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/UsageClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/UsageClientImpl.java deleted file mode 100644 index c2439718c1e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/UsageClientImpl.java +++ /dev/null @@ -1,365 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.usage.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the UsageClient type. - */ -public final class UsageClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UsageClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of UsageClient client. - * - * @param endpoint Service host. - */ - public UsageClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of UsageClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public UsageClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of UsageClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public UsageClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(UsageClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for UsageClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UsageClient") - public interface UsageClientService { - @Post("/type/model/usage/input") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> input(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Post("/type/model/usage/input") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response inputSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Get("/type/model/usage/output") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> output(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/model/usage/output") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response outputSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/type/model/usage/input-output") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> inputAndOutput(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/type/model/usage/input-output") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response inputAndOutputSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The input operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> inputWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.input(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The input operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response inputWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.inputSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The output operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return record used in operation return type along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> outputWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.output(this.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The output operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return record used in operation return type along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response outputWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.outputSync(this.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The inputAndOutput operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return record used both as operation parameter and return type along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> inputAndOutputWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.inputAndOutput(this.getEndpoint(), contentType, accept, body, requestOptions, context)); - } - - /** - * The inputAndOutput operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return record used both as operation parameter and return type along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response inputAndOutputWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.inputAndOutputSync(this.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/package-info.java deleted file mode 100644 index 1ea39ce710b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Usage. - * Illustrates usage of Record in different places(Operation parameters, return type or both). - * - */ -package type.model.usage.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputOutputRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputOutputRecord.java deleted file mode 100644 index d7e2a862153..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputOutputRecord.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.usage.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Record used both as operation parameter and return type. - */ -@Immutable -public final class InputOutputRecord implements JsonSerializable { - /* - * The requiredProp property. - */ - @Generated - private final String requiredProp; - - /** - * Creates an instance of InputOutputRecord class. - * - * @param requiredProp the requiredProp value to set. - */ - @Generated - public InputOutputRecord(String requiredProp) { - this.requiredProp = requiredProp; - } - - /** - * Get the requiredProp property: The requiredProp property. - * - * @return the requiredProp value. - */ - @Generated - public String getRequiredProp() { - return this.requiredProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("requiredProp", this.requiredProp); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InputOutputRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InputOutputRecord if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the InputOutputRecord. - */ - @Generated - public static InputOutputRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String requiredProp = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("requiredProp".equals(fieldName)) { - requiredProp = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new InputOutputRecord(requiredProp); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputRecord.java deleted file mode 100644 index 31fe5844fd0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputRecord.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.usage.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Record used in operation parameters. - */ -@Immutable -public final class InputRecord implements JsonSerializable { - /* - * The requiredProp property. - */ - @Generated - private final String requiredProp; - - /** - * Creates an instance of InputRecord class. - * - * @param requiredProp the requiredProp value to set. - */ - @Generated - public InputRecord(String requiredProp) { - this.requiredProp = requiredProp; - } - - /** - * Get the requiredProp property: The requiredProp property. - * - * @return the requiredProp value. - */ - @Generated - public String getRequiredProp() { - return this.requiredProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("requiredProp", this.requiredProp); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InputRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InputRecord if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the InputRecord. - */ - @Generated - public static InputRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String requiredProp = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("requiredProp".equals(fieldName)) { - requiredProp = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new InputRecord(requiredProp); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/OutputRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/OutputRecord.java deleted file mode 100644 index 97bfd4dc4ca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/OutputRecord.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.usage.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Record used in operation return type. - */ -@Immutable -public final class OutputRecord implements JsonSerializable { - /* - * The requiredProp property. - */ - @Generated - private final String requiredProp; - - /** - * Creates an instance of OutputRecord class. - * - * @param requiredProp the requiredProp value to set. - */ - @Generated - private OutputRecord(String requiredProp) { - this.requiredProp = requiredProp; - } - - /** - * Get the requiredProp property: The requiredProp property. - * - * @return the requiredProp value. - */ - @Generated - public String getRequiredProp() { - return this.requiredProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("requiredProp", this.requiredProp); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OutputRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OutputRecord if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the OutputRecord. - */ - @Generated - public static OutputRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String requiredProp = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("requiredProp".equals(fieldName)) { - requiredProp = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new OutputRecord(requiredProp); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/package-info.java deleted file mode 100644 index 109ddb5d1ff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Usage. - * Illustrates usage of Record in different places(Operation parameters, return type or both). - * - */ -package type.model.usage.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/package-info.java deleted file mode 100644 index 2f3a163789e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Usage. - * Illustrates usage of Record in different places(Operation parameters, return type or both). - * - */ -package type.model.usage; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityAsyncClient.java deleted file mode 100644 index be2e7a77e3f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityAsyncClient.java +++ /dev/null @@ -1,451 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.visibility; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.model.visibility.implementation.VisibilityClientImpl; -import type.model.visibility.models.ReadOnlyModel; -import type.model.visibility.models.VisibilityModel; - -/** - * Initializes a new instance of the asynchronous VisibilityClient type. - */ -@ServiceClient(builder = VisibilityClientBuilder.class, isAsync = true) -public final class VisibilityAsyncClient { - @Generated - private final VisibilityClientImpl serviceClient; - - /** - * Initializes an instance of VisibilityAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - VisibilityAsyncClient(VisibilityClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param queryProp Required int32, illustrating a query property. - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return output model with visibility properties along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getModelWithResponse(int queryProp, BinaryData input, - RequestOptions requestOptions) { - return this.serviceClient.getModelWithResponseAsync(queryProp, input, requestOptions); - } - - /** - * The headModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param queryProp Required int32, illustrating a query property. - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> headModelWithResponse(int queryProp, BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.headModelWithResponseAsync(queryProp, input, requestOptions); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putModelWithResponseAsync(input, requestOptions); - } - - /** - * The patchModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.patchModelWithResponseAsync(input, requestOptions); - } - - /** - * The postModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.postModelWithResponseAsync(input, requestOptions); - } - - /** - * The deleteModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.deleteModelWithResponseAsync(input, requestOptions); - } - - /** - * The putReadOnlyModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalNullableIntList (Optional): [
-     *         int (Optional)
-     *     ]
-     *     optionalStringRecord (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalNullableIntList (Optional): [
-     *         int (Optional)
-     *     ]
-     *     optionalStringRecord (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return roundTrip model with readonly optional properties along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putReadOnlyModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putReadOnlyModelWithResponseAsync(input, requestOptions); - } - - /** - * The getModel operation. - * - * @param queryProp Required int32, illustrating a query property. - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return output model with visibility properties on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getModel(int queryProp, VisibilityModel input) { - // Generated convenience method for getModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getModelWithResponse(queryProp, BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(VisibilityModel.class)); - } - - /** - * The headModel operation. - * - * @param queryProp Required int32, illustrating a query property. - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono headModel(int queryProp, VisibilityModel input) { - // Generated convenience method for headModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return headModelWithResponse(queryProp, BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The putModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putModel(VisibilityModel input) { - // Generated convenience method for putModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The patchModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchModel(VisibilityModel input) { - // Generated convenience method for patchModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return patchModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The postModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono postModel(VisibilityModel input) { - // Generated convenience method for postModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return postModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The deleteModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteModel(VisibilityModel input) { - // Generated convenience method for deleteModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return deleteModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The putReadOnlyModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return roundTrip model with readonly optional properties on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putReadOnlyModel(ReadOnlyModel input) { - // Generated convenience method for putReadOnlyModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putReadOnlyModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ReadOnlyModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClient.java deleted file mode 100644 index b2790fb3990..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClient.java +++ /dev/null @@ -1,441 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.visibility; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.model.visibility.implementation.VisibilityClientImpl; -import type.model.visibility.models.ReadOnlyModel; -import type.model.visibility.models.VisibilityModel; - -/** - * Initializes a new instance of the synchronous VisibilityClient type. - */ -@ServiceClient(builder = VisibilityClientBuilder.class) -public final class VisibilityClient { - @Generated - private final VisibilityClientImpl serviceClient; - - /** - * Initializes an instance of VisibilityClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - VisibilityClient(VisibilityClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The getModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param queryProp Required int32, illustrating a query property. - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return output model with visibility properties along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getModelWithResponse(int queryProp, BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.getModelWithResponse(queryProp, input, requestOptions); - } - - /** - * The headModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param queryProp Required int32, illustrating a query property. - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response headModelWithResponse(int queryProp, BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.headModelWithResponse(queryProp, input, requestOptions); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putModelWithResponse(input, requestOptions); - } - - /** - * The patchModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.patchModelWithResponse(input, requestOptions); - } - - /** - * The postModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.postModelWithResponse(input, requestOptions); - } - - /** - * The deleteModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.deleteModelWithResponse(input, requestOptions); - } - - /** - * The putReadOnlyModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalNullableIntList (Optional): [
-     *         int (Optional)
-     *     ]
-     *     optionalStringRecord (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalNullableIntList (Optional): [
-     *         int (Optional)
-     *     ]
-     *     optionalStringRecord (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return roundTrip model with readonly optional properties along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putReadOnlyModelWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putReadOnlyModelWithResponse(input, requestOptions); - } - - /** - * The getModel operation. - * - * @param queryProp Required int32, illustrating a query property. - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return output model with visibility properties. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public VisibilityModel getModel(int queryProp, VisibilityModel input) { - // Generated convenience method for getModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getModelWithResponse(queryProp, BinaryData.fromObject(input), requestOptions).getValue() - .toObject(VisibilityModel.class); - } - - /** - * The headModel operation. - * - * @param queryProp Required int32, illustrating a query property. - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void headModel(int queryProp, VisibilityModel input) { - // Generated convenience method for headModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - headModelWithResponse(queryProp, BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The putModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putModel(VisibilityModel input) { - // Generated convenience method for putModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - putModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The patchModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchModel(VisibilityModel input) { - // Generated convenience method for patchModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - patchModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The postModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void postModel(VisibilityModel input) { - // Generated convenience method for postModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - postModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The deleteModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void deleteModel(VisibilityModel input) { - // Generated convenience method for deleteModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - deleteModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); - } - - /** - * The putReadOnlyModel operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return roundTrip model with readonly optional properties. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ReadOnlyModel putReadOnlyModel(ReadOnlyModel input) { - // Generated convenience method for putReadOnlyModelWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putReadOnlyModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue() - .toObject(ReadOnlyModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClientBuilder.java deleted file mode 100644 index dd673f3832f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClientBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.visibility; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.model.visibility.implementation.VisibilityClientImpl; - -/** - * A builder for creating a new instance of the VisibilityClient type. - */ -@ServiceClientBuilder(serviceClients = { VisibilityClient.class, VisibilityAsyncClient.class }) -public final class VisibilityClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("type-model-visibility.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the VisibilityClientBuilder. - */ - @Generated - public VisibilityClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public VisibilityClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the VisibilityClientBuilder. - */ - @Generated - public VisibilityClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of VisibilityClientImpl with the provided parameters. - * - * @return an instance of VisibilityClientImpl. - */ - @Generated - private VisibilityClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - VisibilityClientImpl client - = new VisibilityClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of VisibilityAsyncClient class. - * - * @return an instance of VisibilityAsyncClient. - */ - @Generated - public VisibilityAsyncClient buildAsyncClient() { - return new VisibilityAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of VisibilityClient class. - * - * @return an instance of VisibilityClient. - */ - @Generated - public VisibilityClient buildClient() { - return new VisibilityClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(VisibilityClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java deleted file mode 100644 index b5443c7d726..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java +++ /dev/null @@ -1,819 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.visibility.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.Head; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; - -/** - * Initializes a new instance of the VisibilityClient type. - */ -public final class VisibilityClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final VisibilityClientService service; - - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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; - } - - /** - * Initializes an instance of VisibilityClient client. - * - * @param endpoint Service host. - */ - public VisibilityClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of VisibilityClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public VisibilityClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of VisibilityClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public VisibilityClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.service = RestProxy.create(VisibilityClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for VisibilityClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "VisibilityClient") - public interface VisibilityClientService { - @Get("/type/model/visibility") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getModel(@HostParam("endpoint") String endpoint, - @QueryParam("queryProp") int queryProp, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Get("/type/model/visibility") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getModelSync(@HostParam("endpoint") String endpoint, - @QueryParam("queryProp") int queryProp, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Head("/type/model/visibility") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> headModel(@HostParam("endpoint") String endpoint, @QueryParam("queryProp") int queryProp, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Head("/type/model/visibility") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response headModelSync(@HostParam("endpoint") String endpoint, @QueryParam("queryProp") int queryProp, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/visibility") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/visibility") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Patch("/type/model/visibility") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Patch("/type/model/visibility") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Post("/type/model/visibility") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> postModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Post("/type/model/visibility") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response postModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Delete("/type/model/visibility") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> deleteModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Delete("/type/model/visibility") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response deleteModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, - RequestOptions requestOptions, Context context); - - @Put("/type/model/visibility/readonlyroundtrip") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putReadOnlyModel(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - - @Put("/type/model/visibility/readonlyroundtrip") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putReadOnlyModelSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - } - - /** - * The getModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param queryProp Required int32, illustrating a query property. - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return output model with visibility properties along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getModelWithResponseAsync(int queryProp, BinaryData input, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getModel(this.getEndpoint(), queryProp, contentType, accept, - input, requestOptions, context)); - } - - /** - * The getModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param queryProp Required int32, illustrating a query property. - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return output model with visibility properties along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getModelWithResponse(int queryProp, BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.getModelSync(this.getEndpoint(), queryProp, contentType, accept, input, requestOptions, - Context.NONE); - } - - /** - * The headModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param queryProp Required int32, illustrating a query property. - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> headModelWithResponseAsync(int queryProp, BinaryData input, - RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.headModel(this.getEndpoint(), queryProp, contentType, input, requestOptions, context)); - } - - /** - * The headModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param queryProp Required int32, illustrating a query property. - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response headModelWithResponse(int queryProp, BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.headModelSync(this.getEndpoint(), queryProp, contentType, input, requestOptions, Context.NONE); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.putModel(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The putModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The patchModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.patchModel(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The patchModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.patchModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The postModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> postModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.postModel(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The postModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response postModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.postModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The deleteModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.deleteModel(this.getEndpoint(), contentType, input, requestOptions, context)); - } - - /** - * The deleteModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     readProp: String (Required)
-     *     createProp (Required): [
-     *         String (Required)
-     *     ]
-     *     updateProp (Required): [
-     *         int (Required)
-     *     ]
-     *     deleteProp: Boolean (Required)
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.deleteModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); - } - - /** - * The putReadOnlyModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalNullableIntList (Optional): [
-     *         int (Optional)
-     *     ]
-     *     optionalStringRecord (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalNullableIntList (Optional): [
-     *         int (Optional)
-     *     ]
-     *     optionalStringRecord (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return roundTrip model with readonly optional properties along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putReadOnlyModelWithResponseAsync(BinaryData input, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.putReadOnlyModel(this.getEndpoint(), contentType, accept, input, - requestOptions, context)); - } - - /** - * The putReadOnlyModel operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalNullableIntList (Optional): [
-     *         int (Optional)
-     *     ]
-     *     optionalStringRecord (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalNullableIntList (Optional): [
-     *         int (Optional)
-     *     ]
-     *     optionalStringRecord (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return roundTrip model with readonly optional properties along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putReadOnlyModelWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putReadOnlyModelSync(this.getEndpoint(), contentType, accept, input, requestOptions, - Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/package-info.java deleted file mode 100644 index c23c028cb0a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Visibility. - * Illustrates models with visibility properties. - * - */ -package type.model.visibility.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/ReadOnlyModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/ReadOnlyModel.java deleted file mode 100644 index 846bb2e7d4e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/ReadOnlyModel.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.visibility.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * RoundTrip model with readonly optional properties. - */ -@Immutable -public final class ReadOnlyModel implements JsonSerializable { - /* - * Optional readonly nullable int list. - */ - @Generated - private List optionalNullableIntList; - - /* - * Optional readonly string dictionary. - */ - @Generated - private Map optionalStringRecord; - - /** - * Creates an instance of ReadOnlyModel class. - */ - @Generated - public ReadOnlyModel() { - } - - /** - * Get the optionalNullableIntList property: Optional readonly nullable int list. - * - * @return the optionalNullableIntList value. - */ - @Generated - public List getOptionalNullableIntList() { - return this.optionalNullableIntList; - } - - /** - * Get the optionalStringRecord property: Optional readonly string dictionary. - * - * @return the optionalStringRecord value. - */ - @Generated - public Map getOptionalStringRecord() { - return this.optionalStringRecord; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ReadOnlyModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ReadOnlyModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the ReadOnlyModel. - */ - @Generated - public static ReadOnlyModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ReadOnlyModel deserializedReadOnlyModel = new ReadOnlyModel(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("optionalNullableIntList".equals(fieldName)) { - List optionalNullableIntList = reader.readArray(reader1 -> reader1.getInt()); - deserializedReadOnlyModel.optionalNullableIntList = optionalNullableIntList; - } else if ("optionalStringRecord".equals(fieldName)) { - Map optionalStringRecord = reader.readMap(reader1 -> reader1.getString()); - deserializedReadOnlyModel.optionalStringRecord = optionalStringRecord; - } else { - reader.skipChildren(); - } - } - - return deserializedReadOnlyModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/VisibilityModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/VisibilityModel.java deleted file mode 100644 index 9fa6354f1f0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/VisibilityModel.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.visibility.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * Output model with visibility properties. - */ -@Immutable -public final class VisibilityModel implements JsonSerializable { - /* - * Required string, illustrating a readonly property. - */ - @Generated - private String readProp; - - /* - * Required string[], illustrating a create property. - */ - @Generated - private final List createProp; - - /* - * Required int32[], illustrating a update property. - */ - @Generated - private final List updateProp; - - /* - * Required bool, illustrating a delete property. - */ - @Generated - private final Boolean deleteProp; - - /** - * Creates an instance of VisibilityModel class. - * - * @param createProp the createProp value to set. - * @param updateProp the updateProp value to set. - * @param deleteProp the deleteProp value to set. - */ - @Generated - public VisibilityModel(List createProp, List updateProp, Boolean deleteProp) { - this.createProp = createProp; - this.updateProp = updateProp; - this.deleteProp = deleteProp; - } - - /** - * Get the readProp property: Required string, illustrating a readonly property. - * - * @return the readProp value. - */ - @Generated - public String getReadProp() { - return this.readProp; - } - - /** - * Get the createProp property: Required string[], illustrating a create property. - * - * @return the createProp value. - */ - @Generated - public List getCreateProp() { - return this.createProp; - } - - /** - * Get the updateProp property: Required int32[], illustrating a update property. - * - * @return the updateProp value. - */ - @Generated - public List getUpdateProp() { - return this.updateProp; - } - - /** - * Get the deleteProp property: Required bool, illustrating a delete property. - * - * @return the deleteProp value. - */ - @Generated - public Boolean isDeleteProp() { - return this.deleteProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("createProp", this.createProp, (writer, element) -> writer.writeString(element)); - jsonWriter.writeArrayField("updateProp", this.updateProp, (writer, element) -> writer.writeInt(element)); - jsonWriter.writeBooleanField("deleteProp", this.deleteProp); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of VisibilityModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of VisibilityModel if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the VisibilityModel. - */ - @Generated - public static VisibilityModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String readProp = null; - List createProp = null; - List updateProp = null; - Boolean deleteProp = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("readProp".equals(fieldName)) { - readProp = reader.getString(); - } else if ("createProp".equals(fieldName)) { - createProp = reader.readArray(reader1 -> reader1.getString()); - } else if ("updateProp".equals(fieldName)) { - updateProp = reader.readArray(reader1 -> reader1.getInt()); - } else if ("deleteProp".equals(fieldName)) { - deleteProp = reader.getNullable(JsonReader::getBoolean); - } else { - reader.skipChildren(); - } - } - VisibilityModel deserializedVisibilityModel = new VisibilityModel(createProp, updateProp, deleteProp); - deserializedVisibilityModel.readProp = readProp; - - return deserializedVisibilityModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/package-info.java deleted file mode 100644 index 36ebbab4db8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Visibility. - * Illustrates models with visibility properties. - * - */ -package type.model.visibility.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/package-info.java deleted file mode 100644 index 91ba00875be..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Visibility. - * Illustrates models with visibility properties. - * - */ -package type.model.visibility; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/AdditionalPropertiesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/AdditionalPropertiesClientBuilder.java deleted file mode 100644 index 487137c1b79..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/AdditionalPropertiesClientBuilder.java +++ /dev/null @@ -1,957 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.property.additionalproperties.implementation.AdditionalPropertiesClientImpl; - -/** - * A builder for creating a new instance of the AdditionalPropertiesClient type. - */ -@ServiceClientBuilder( - serviceClients = { - ExtendsUnknownClient.class, - ExtendsUnknownDerivedClient.class, - ExtendsUnknownDiscriminatedClient.class, - IsUnknownClient.class, - IsUnknownDerivedClient.class, - IsUnknownDiscriminatedClient.class, - ExtendsStringClient.class, - IsStringClient.class, - SpreadStringClient.class, - ExtendsFloatClient.class, - IsFloatClient.class, - SpreadFloatClient.class, - ExtendsModelClient.class, - IsModelClient.class, - SpreadModelClient.class, - ExtendsModelArrayClient.class, - IsModelArrayClient.class, - SpreadModelArrayClient.class, - SpreadDifferentStringClient.class, - SpreadDifferentFloatClient.class, - SpreadDifferentModelClient.class, - SpreadDifferentModelArrayClient.class, - ExtendsDifferentSpreadStringClient.class, - ExtendsDifferentSpreadFloatClient.class, - ExtendsDifferentSpreadModelClient.class, - ExtendsDifferentSpreadModelArrayClient.class, - MultipleSpreadClient.class, - SpreadRecordUnionClient.class, - SpreadRecordNonDiscriminatedUnionClient.class, - SpreadRecordNonDiscriminatedUnion2Client.class, - SpreadRecordNonDiscriminatedUnion3Client.class, - ExtendsUnknownAsyncClient.class, - ExtendsUnknownDerivedAsyncClient.class, - ExtendsUnknownDiscriminatedAsyncClient.class, - IsUnknownAsyncClient.class, - IsUnknownDerivedAsyncClient.class, - IsUnknownDiscriminatedAsyncClient.class, - ExtendsStringAsyncClient.class, - IsStringAsyncClient.class, - SpreadStringAsyncClient.class, - ExtendsFloatAsyncClient.class, - IsFloatAsyncClient.class, - SpreadFloatAsyncClient.class, - ExtendsModelAsyncClient.class, - IsModelAsyncClient.class, - SpreadModelAsyncClient.class, - ExtendsModelArrayAsyncClient.class, - IsModelArrayAsyncClient.class, - SpreadModelArrayAsyncClient.class, - SpreadDifferentStringAsyncClient.class, - SpreadDifferentFloatAsyncClient.class, - SpreadDifferentModelAsyncClient.class, - SpreadDifferentModelArrayAsyncClient.class, - ExtendsDifferentSpreadStringAsyncClient.class, - ExtendsDifferentSpreadFloatAsyncClient.class, - ExtendsDifferentSpreadModelAsyncClient.class, - ExtendsDifferentSpreadModelArrayAsyncClient.class, - MultipleSpreadAsyncClient.class, - SpreadRecordUnionAsyncClient.class, - SpreadRecordNonDiscriminatedUnionAsyncClient.class, - SpreadRecordNonDiscriminatedUnion2AsyncClient.class, - SpreadRecordNonDiscriminatedUnion3AsyncClient.class }) -public final class AdditionalPropertiesClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("type-property-additionalproperties.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the AdditionalPropertiesClientBuilder. - */ - @Generated - public AdditionalPropertiesClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AdditionalPropertiesClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AdditionalPropertiesClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AdditionalPropertiesClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AdditionalPropertiesClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AdditionalPropertiesClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AdditionalPropertiesClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AdditionalPropertiesClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AdditionalPropertiesClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the AdditionalPropertiesClientBuilder. - */ - @Generated - public AdditionalPropertiesClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of AdditionalPropertiesClientImpl with the provided parameters. - * - * @return an instance of AdditionalPropertiesClientImpl. - */ - @Generated - private AdditionalPropertiesClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - AdditionalPropertiesClientImpl client = new AdditionalPropertiesClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ExtendsUnknownAsyncClient class. - * - * @return an instance of ExtendsUnknownAsyncClient. - */ - @Generated - public ExtendsUnknownAsyncClient buildExtendsUnknownAsyncClient() { - return new ExtendsUnknownAsyncClient(buildInnerClient().getExtendsUnknowns()); - } - - /** - * Builds an instance of ExtendsUnknownDerivedAsyncClient class. - * - * @return an instance of ExtendsUnknownDerivedAsyncClient. - */ - @Generated - public ExtendsUnknownDerivedAsyncClient buildExtendsUnknownDerivedAsyncClient() { - return new ExtendsUnknownDerivedAsyncClient(buildInnerClient().getExtendsUnknownDeriveds()); - } - - /** - * Builds an instance of ExtendsUnknownDiscriminatedAsyncClient class. - * - * @return an instance of ExtendsUnknownDiscriminatedAsyncClient. - */ - @Generated - public ExtendsUnknownDiscriminatedAsyncClient buildExtendsUnknownDiscriminatedAsyncClient() { - return new ExtendsUnknownDiscriminatedAsyncClient(buildInnerClient().getExtendsUnknownDiscriminateds()); - } - - /** - * Builds an instance of IsUnknownAsyncClient class. - * - * @return an instance of IsUnknownAsyncClient. - */ - @Generated - public IsUnknownAsyncClient buildIsUnknownAsyncClient() { - return new IsUnknownAsyncClient(buildInnerClient().getIsUnknowns()); - } - - /** - * Builds an instance of IsUnknownDerivedAsyncClient class. - * - * @return an instance of IsUnknownDerivedAsyncClient. - */ - @Generated - public IsUnknownDerivedAsyncClient buildIsUnknownDerivedAsyncClient() { - return new IsUnknownDerivedAsyncClient(buildInnerClient().getIsUnknownDeriveds()); - } - - /** - * Builds an instance of IsUnknownDiscriminatedAsyncClient class. - * - * @return an instance of IsUnknownDiscriminatedAsyncClient. - */ - @Generated - public IsUnknownDiscriminatedAsyncClient buildIsUnknownDiscriminatedAsyncClient() { - return new IsUnknownDiscriminatedAsyncClient(buildInnerClient().getIsUnknownDiscriminateds()); - } - - /** - * Builds an instance of ExtendsStringAsyncClient class. - * - * @return an instance of ExtendsStringAsyncClient. - */ - @Generated - public ExtendsStringAsyncClient buildExtendsStringAsyncClient() { - return new ExtendsStringAsyncClient(buildInnerClient().getExtendsStrings()); - } - - /** - * Builds an instance of IsStringAsyncClient class. - * - * @return an instance of IsStringAsyncClient. - */ - @Generated - public IsStringAsyncClient buildIsStringAsyncClient() { - return new IsStringAsyncClient(buildInnerClient().getIsStrings()); - } - - /** - * Builds an instance of SpreadStringAsyncClient class. - * - * @return an instance of SpreadStringAsyncClient. - */ - @Generated - public SpreadStringAsyncClient buildSpreadStringAsyncClient() { - return new SpreadStringAsyncClient(buildInnerClient().getSpreadStrings()); - } - - /** - * Builds an instance of ExtendsFloatAsyncClient class. - * - * @return an instance of ExtendsFloatAsyncClient. - */ - @Generated - public ExtendsFloatAsyncClient buildExtendsFloatAsyncClient() { - return new ExtendsFloatAsyncClient(buildInnerClient().getExtendsFloats()); - } - - /** - * Builds an instance of IsFloatAsyncClient class. - * - * @return an instance of IsFloatAsyncClient. - */ - @Generated - public IsFloatAsyncClient buildIsFloatAsyncClient() { - return new IsFloatAsyncClient(buildInnerClient().getIsFloats()); - } - - /** - * Builds an instance of SpreadFloatAsyncClient class. - * - * @return an instance of SpreadFloatAsyncClient. - */ - @Generated - public SpreadFloatAsyncClient buildSpreadFloatAsyncClient() { - return new SpreadFloatAsyncClient(buildInnerClient().getSpreadFloats()); - } - - /** - * Builds an instance of ExtendsModelAsyncClient class. - * - * @return an instance of ExtendsModelAsyncClient. - */ - @Generated - public ExtendsModelAsyncClient buildExtendsModelAsyncClient() { - return new ExtendsModelAsyncClient(buildInnerClient().getExtendsModels()); - } - - /** - * Builds an instance of IsModelAsyncClient class. - * - * @return an instance of IsModelAsyncClient. - */ - @Generated - public IsModelAsyncClient buildIsModelAsyncClient() { - return new IsModelAsyncClient(buildInnerClient().getIsModels()); - } - - /** - * Builds an instance of SpreadModelAsyncClient class. - * - * @return an instance of SpreadModelAsyncClient. - */ - @Generated - public SpreadModelAsyncClient buildSpreadModelAsyncClient() { - return new SpreadModelAsyncClient(buildInnerClient().getSpreadModels()); - } - - /** - * Builds an instance of ExtendsModelArrayAsyncClient class. - * - * @return an instance of ExtendsModelArrayAsyncClient. - */ - @Generated - public ExtendsModelArrayAsyncClient buildExtendsModelArrayAsyncClient() { - return new ExtendsModelArrayAsyncClient(buildInnerClient().getExtendsModelArrays()); - } - - /** - * Builds an instance of IsModelArrayAsyncClient class. - * - * @return an instance of IsModelArrayAsyncClient. - */ - @Generated - public IsModelArrayAsyncClient buildIsModelArrayAsyncClient() { - return new IsModelArrayAsyncClient(buildInnerClient().getIsModelArrays()); - } - - /** - * Builds an instance of SpreadModelArrayAsyncClient class. - * - * @return an instance of SpreadModelArrayAsyncClient. - */ - @Generated - public SpreadModelArrayAsyncClient buildSpreadModelArrayAsyncClient() { - return new SpreadModelArrayAsyncClient(buildInnerClient().getSpreadModelArrays()); - } - - /** - * Builds an instance of SpreadDifferentStringAsyncClient class. - * - * @return an instance of SpreadDifferentStringAsyncClient. - */ - @Generated - public SpreadDifferentStringAsyncClient buildSpreadDifferentStringAsyncClient() { - return new SpreadDifferentStringAsyncClient(buildInnerClient().getSpreadDifferentStrings()); - } - - /** - * Builds an instance of SpreadDifferentFloatAsyncClient class. - * - * @return an instance of SpreadDifferentFloatAsyncClient. - */ - @Generated - public SpreadDifferentFloatAsyncClient buildSpreadDifferentFloatAsyncClient() { - return new SpreadDifferentFloatAsyncClient(buildInnerClient().getSpreadDifferentFloats()); - } - - /** - * Builds an instance of SpreadDifferentModelAsyncClient class. - * - * @return an instance of SpreadDifferentModelAsyncClient. - */ - @Generated - public SpreadDifferentModelAsyncClient buildSpreadDifferentModelAsyncClient() { - return new SpreadDifferentModelAsyncClient(buildInnerClient().getSpreadDifferentModels()); - } - - /** - * Builds an instance of SpreadDifferentModelArrayAsyncClient class. - * - * @return an instance of SpreadDifferentModelArrayAsyncClient. - */ - @Generated - public SpreadDifferentModelArrayAsyncClient buildSpreadDifferentModelArrayAsyncClient() { - return new SpreadDifferentModelArrayAsyncClient(buildInnerClient().getSpreadDifferentModelArrays()); - } - - /** - * Builds an instance of ExtendsDifferentSpreadStringAsyncClient class. - * - * @return an instance of ExtendsDifferentSpreadStringAsyncClient. - */ - @Generated - public ExtendsDifferentSpreadStringAsyncClient buildExtendsDifferentSpreadStringAsyncClient() { - return new ExtendsDifferentSpreadStringAsyncClient(buildInnerClient().getExtendsDifferentSpreadStrings()); - } - - /** - * Builds an instance of ExtendsDifferentSpreadFloatAsyncClient class. - * - * @return an instance of ExtendsDifferentSpreadFloatAsyncClient. - */ - @Generated - public ExtendsDifferentSpreadFloatAsyncClient buildExtendsDifferentSpreadFloatAsyncClient() { - return new ExtendsDifferentSpreadFloatAsyncClient(buildInnerClient().getExtendsDifferentSpreadFloats()); - } - - /** - * Builds an instance of ExtendsDifferentSpreadModelAsyncClient class. - * - * @return an instance of ExtendsDifferentSpreadModelAsyncClient. - */ - @Generated - public ExtendsDifferentSpreadModelAsyncClient buildExtendsDifferentSpreadModelAsyncClient() { - return new ExtendsDifferentSpreadModelAsyncClient(buildInnerClient().getExtendsDifferentSpreadModels()); - } - - /** - * Builds an instance of ExtendsDifferentSpreadModelArrayAsyncClient class. - * - * @return an instance of ExtendsDifferentSpreadModelArrayAsyncClient. - */ - @Generated - public ExtendsDifferentSpreadModelArrayAsyncClient buildExtendsDifferentSpreadModelArrayAsyncClient() { - return new ExtendsDifferentSpreadModelArrayAsyncClient( - buildInnerClient().getExtendsDifferentSpreadModelArrays()); - } - - /** - * Builds an instance of MultipleSpreadAsyncClient class. - * - * @return an instance of MultipleSpreadAsyncClient. - */ - @Generated - public MultipleSpreadAsyncClient buildMultipleSpreadAsyncClient() { - return new MultipleSpreadAsyncClient(buildInnerClient().getMultipleSpreads()); - } - - /** - * Builds an instance of SpreadRecordUnionAsyncClient class. - * - * @return an instance of SpreadRecordUnionAsyncClient. - */ - @Generated - public SpreadRecordUnionAsyncClient buildSpreadRecordUnionAsyncClient() { - return new SpreadRecordUnionAsyncClient(buildInnerClient().getSpreadRecordUnions()); - } - - /** - * Builds an instance of SpreadRecordNonDiscriminatedUnionAsyncClient class. - * - * @return an instance of SpreadRecordNonDiscriminatedUnionAsyncClient. - */ - @Generated - public SpreadRecordNonDiscriminatedUnionAsyncClient buildSpreadRecordNonDiscriminatedUnionAsyncClient() { - return new SpreadRecordNonDiscriminatedUnionAsyncClient( - buildInnerClient().getSpreadRecordNonDiscriminatedUnions()); - } - - /** - * Builds an instance of SpreadRecordNonDiscriminatedUnion2AsyncClient class. - * - * @return an instance of SpreadRecordNonDiscriminatedUnion2AsyncClient. - */ - @Generated - public SpreadRecordNonDiscriminatedUnion2AsyncClient buildSpreadRecordNonDiscriminatedUnion2AsyncClient() { - return new SpreadRecordNonDiscriminatedUnion2AsyncClient( - buildInnerClient().getSpreadRecordNonDiscriminatedUnion2s()); - } - - /** - * Builds an instance of SpreadRecordNonDiscriminatedUnion3AsyncClient class. - * - * @return an instance of SpreadRecordNonDiscriminatedUnion3AsyncClient. - */ - @Generated - public SpreadRecordNonDiscriminatedUnion3AsyncClient buildSpreadRecordNonDiscriminatedUnion3AsyncClient() { - return new SpreadRecordNonDiscriminatedUnion3AsyncClient( - buildInnerClient().getSpreadRecordNonDiscriminatedUnion3s()); - } - - /** - * Builds an instance of ExtendsUnknownClient class. - * - * @return an instance of ExtendsUnknownClient. - */ - @Generated - public ExtendsUnknownClient buildExtendsUnknownClient() { - return new ExtendsUnknownClient(buildInnerClient().getExtendsUnknowns()); - } - - /** - * Builds an instance of ExtendsUnknownDerivedClient class. - * - * @return an instance of ExtendsUnknownDerivedClient. - */ - @Generated - public ExtendsUnknownDerivedClient buildExtendsUnknownDerivedClient() { - return new ExtendsUnknownDerivedClient(buildInnerClient().getExtendsUnknownDeriveds()); - } - - /** - * Builds an instance of ExtendsUnknownDiscriminatedClient class. - * - * @return an instance of ExtendsUnknownDiscriminatedClient. - */ - @Generated - public ExtendsUnknownDiscriminatedClient buildExtendsUnknownDiscriminatedClient() { - return new ExtendsUnknownDiscriminatedClient(buildInnerClient().getExtendsUnknownDiscriminateds()); - } - - /** - * Builds an instance of IsUnknownClient class. - * - * @return an instance of IsUnknownClient. - */ - @Generated - public IsUnknownClient buildIsUnknownClient() { - return new IsUnknownClient(buildInnerClient().getIsUnknowns()); - } - - /** - * Builds an instance of IsUnknownDerivedClient class. - * - * @return an instance of IsUnknownDerivedClient. - */ - @Generated - public IsUnknownDerivedClient buildIsUnknownDerivedClient() { - return new IsUnknownDerivedClient(buildInnerClient().getIsUnknownDeriveds()); - } - - /** - * Builds an instance of IsUnknownDiscriminatedClient class. - * - * @return an instance of IsUnknownDiscriminatedClient. - */ - @Generated - public IsUnknownDiscriminatedClient buildIsUnknownDiscriminatedClient() { - return new IsUnknownDiscriminatedClient(buildInnerClient().getIsUnknownDiscriminateds()); - } - - /** - * Builds an instance of ExtendsStringClient class. - * - * @return an instance of ExtendsStringClient. - */ - @Generated - public ExtendsStringClient buildExtendsStringClient() { - return new ExtendsStringClient(buildInnerClient().getExtendsStrings()); - } - - /** - * Builds an instance of IsStringClient class. - * - * @return an instance of IsStringClient. - */ - @Generated - public IsStringClient buildIsStringClient() { - return new IsStringClient(buildInnerClient().getIsStrings()); - } - - /** - * Builds an instance of SpreadStringClient class. - * - * @return an instance of SpreadStringClient. - */ - @Generated - public SpreadStringClient buildSpreadStringClient() { - return new SpreadStringClient(buildInnerClient().getSpreadStrings()); - } - - /** - * Builds an instance of ExtendsFloatClient class. - * - * @return an instance of ExtendsFloatClient. - */ - @Generated - public ExtendsFloatClient buildExtendsFloatClient() { - return new ExtendsFloatClient(buildInnerClient().getExtendsFloats()); - } - - /** - * Builds an instance of IsFloatClient class. - * - * @return an instance of IsFloatClient. - */ - @Generated - public IsFloatClient buildIsFloatClient() { - return new IsFloatClient(buildInnerClient().getIsFloats()); - } - - /** - * Builds an instance of SpreadFloatClient class. - * - * @return an instance of SpreadFloatClient. - */ - @Generated - public SpreadFloatClient buildSpreadFloatClient() { - return new SpreadFloatClient(buildInnerClient().getSpreadFloats()); - } - - /** - * Builds an instance of ExtendsModelClient class. - * - * @return an instance of ExtendsModelClient. - */ - @Generated - public ExtendsModelClient buildExtendsModelClient() { - return new ExtendsModelClient(buildInnerClient().getExtendsModels()); - } - - /** - * Builds an instance of IsModelClient class. - * - * @return an instance of IsModelClient. - */ - @Generated - public IsModelClient buildIsModelClient() { - return new IsModelClient(buildInnerClient().getIsModels()); - } - - /** - * Builds an instance of SpreadModelClient class. - * - * @return an instance of SpreadModelClient. - */ - @Generated - public SpreadModelClient buildSpreadModelClient() { - return new SpreadModelClient(buildInnerClient().getSpreadModels()); - } - - /** - * Builds an instance of ExtendsModelArrayClient class. - * - * @return an instance of ExtendsModelArrayClient. - */ - @Generated - public ExtendsModelArrayClient buildExtendsModelArrayClient() { - return new ExtendsModelArrayClient(buildInnerClient().getExtendsModelArrays()); - } - - /** - * Builds an instance of IsModelArrayClient class. - * - * @return an instance of IsModelArrayClient. - */ - @Generated - public IsModelArrayClient buildIsModelArrayClient() { - return new IsModelArrayClient(buildInnerClient().getIsModelArrays()); - } - - /** - * Builds an instance of SpreadModelArrayClient class. - * - * @return an instance of SpreadModelArrayClient. - */ - @Generated - public SpreadModelArrayClient buildSpreadModelArrayClient() { - return new SpreadModelArrayClient(buildInnerClient().getSpreadModelArrays()); - } - - /** - * Builds an instance of SpreadDifferentStringClient class. - * - * @return an instance of SpreadDifferentStringClient. - */ - @Generated - public SpreadDifferentStringClient buildSpreadDifferentStringClient() { - return new SpreadDifferentStringClient(buildInnerClient().getSpreadDifferentStrings()); - } - - /** - * Builds an instance of SpreadDifferentFloatClient class. - * - * @return an instance of SpreadDifferentFloatClient. - */ - @Generated - public SpreadDifferentFloatClient buildSpreadDifferentFloatClient() { - return new SpreadDifferentFloatClient(buildInnerClient().getSpreadDifferentFloats()); - } - - /** - * Builds an instance of SpreadDifferentModelClient class. - * - * @return an instance of SpreadDifferentModelClient. - */ - @Generated - public SpreadDifferentModelClient buildSpreadDifferentModelClient() { - return new SpreadDifferentModelClient(buildInnerClient().getSpreadDifferentModels()); - } - - /** - * Builds an instance of SpreadDifferentModelArrayClient class. - * - * @return an instance of SpreadDifferentModelArrayClient. - */ - @Generated - public SpreadDifferentModelArrayClient buildSpreadDifferentModelArrayClient() { - return new SpreadDifferentModelArrayClient(buildInnerClient().getSpreadDifferentModelArrays()); - } - - /** - * Builds an instance of ExtendsDifferentSpreadStringClient class. - * - * @return an instance of ExtendsDifferentSpreadStringClient. - */ - @Generated - public ExtendsDifferentSpreadStringClient buildExtendsDifferentSpreadStringClient() { - return new ExtendsDifferentSpreadStringClient(buildInnerClient().getExtendsDifferentSpreadStrings()); - } - - /** - * Builds an instance of ExtendsDifferentSpreadFloatClient class. - * - * @return an instance of ExtendsDifferentSpreadFloatClient. - */ - @Generated - public ExtendsDifferentSpreadFloatClient buildExtendsDifferentSpreadFloatClient() { - return new ExtendsDifferentSpreadFloatClient(buildInnerClient().getExtendsDifferentSpreadFloats()); - } - - /** - * Builds an instance of ExtendsDifferentSpreadModelClient class. - * - * @return an instance of ExtendsDifferentSpreadModelClient. - */ - @Generated - public ExtendsDifferentSpreadModelClient buildExtendsDifferentSpreadModelClient() { - return new ExtendsDifferentSpreadModelClient(buildInnerClient().getExtendsDifferentSpreadModels()); - } - - /** - * Builds an instance of ExtendsDifferentSpreadModelArrayClient class. - * - * @return an instance of ExtendsDifferentSpreadModelArrayClient. - */ - @Generated - public ExtendsDifferentSpreadModelArrayClient buildExtendsDifferentSpreadModelArrayClient() { - return new ExtendsDifferentSpreadModelArrayClient(buildInnerClient().getExtendsDifferentSpreadModelArrays()); - } - - /** - * Builds an instance of MultipleSpreadClient class. - * - * @return an instance of MultipleSpreadClient. - */ - @Generated - public MultipleSpreadClient buildMultipleSpreadClient() { - return new MultipleSpreadClient(buildInnerClient().getMultipleSpreads()); - } - - /** - * Builds an instance of SpreadRecordUnionClient class. - * - * @return an instance of SpreadRecordUnionClient. - */ - @Generated - public SpreadRecordUnionClient buildSpreadRecordUnionClient() { - return new SpreadRecordUnionClient(buildInnerClient().getSpreadRecordUnions()); - } - - /** - * Builds an instance of SpreadRecordNonDiscriminatedUnionClient class. - * - * @return an instance of SpreadRecordNonDiscriminatedUnionClient. - */ - @Generated - public SpreadRecordNonDiscriminatedUnionClient buildSpreadRecordNonDiscriminatedUnionClient() { - return new SpreadRecordNonDiscriminatedUnionClient(buildInnerClient().getSpreadRecordNonDiscriminatedUnions()); - } - - /** - * Builds an instance of SpreadRecordNonDiscriminatedUnion2Client class. - * - * @return an instance of SpreadRecordNonDiscriminatedUnion2Client. - */ - @Generated - public SpreadRecordNonDiscriminatedUnion2Client buildSpreadRecordNonDiscriminatedUnion2Client() { - return new SpreadRecordNonDiscriminatedUnion2Client( - buildInnerClient().getSpreadRecordNonDiscriminatedUnion2s()); - } - - /** - * Builds an instance of SpreadRecordNonDiscriminatedUnion3Client class. - * - * @return an instance of SpreadRecordNonDiscriminatedUnion3Client. - */ - @Generated - public SpreadRecordNonDiscriminatedUnion3Client buildSpreadRecordNonDiscriminatedUnion3Client() { - return new SpreadRecordNonDiscriminatedUnion3Client( - buildInnerClient().getSpreadRecordNonDiscriminatedUnion3s()); - } - - private static final ClientLogger LOGGER = new ClientLogger(AdditionalPropertiesClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatAsyncClient.java deleted file mode 100644 index 13053e41d2b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatAsyncClient.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.ExtendsDifferentSpreadFloatsImpl; -import type.property.additionalproperties.models.DifferentSpreadFloatDerived; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class ExtendsDifferentSpreadFloatAsyncClient { - @Generated - private final ExtendsDifferentSpreadFloatsImpl serviceClient; - - /** - * Initializes an instance of ExtendsDifferentSpreadFloatAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsDifferentSpreadFloatAsyncClient(ExtendsDifferentSpreadFloatsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     *     derivedProp: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     *     derivedProp: double (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadFloatDerived.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(DifferentSpreadFloatDerived body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatClient.java deleted file mode 100644 index 73b7055ef81..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.ExtendsDifferentSpreadFloatsImpl; -import type.property.additionalproperties.models.DifferentSpreadFloatDerived; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class ExtendsDifferentSpreadFloatClient { - @Generated - private final ExtendsDifferentSpreadFloatsImpl serviceClient; - - /** - * Initializes an instance of ExtendsDifferentSpreadFloatClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsDifferentSpreadFloatClient(ExtendsDifferentSpreadFloatsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     *     derivedProp: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     *     derivedProp: double (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DifferentSpreadFloatDerived get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadFloatDerived.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(DifferentSpreadFloatDerived body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayAsyncClient.java deleted file mode 100644 index 9b4d3e47239..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayAsyncClient.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.ExtendsDifferentSpreadModelArraysImpl; -import type.property.additionalproperties.models.DifferentSpreadModelArrayDerived; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class ExtendsDifferentSpreadModelArrayAsyncClient { - @Generated - private final ExtendsDifferentSpreadModelArraysImpl serviceClient; - - /** - * Initializes an instance of ExtendsDifferentSpreadModelArrayAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsDifferentSpreadModelArrayAsyncClient(ExtendsDifferentSpreadModelArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     *     derivedProp (Required): [
-     *         (recursive schema, see above)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     *     derivedProp (Required): [
-     *         (recursive schema, see above)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadModelArrayDerived.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(DifferentSpreadModelArrayDerived body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayClient.java deleted file mode 100644 index a41988bc647..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.ExtendsDifferentSpreadModelArraysImpl; -import type.property.additionalproperties.models.DifferentSpreadModelArrayDerived; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class ExtendsDifferentSpreadModelArrayClient { - @Generated - private final ExtendsDifferentSpreadModelArraysImpl serviceClient; - - /** - * Initializes an instance of ExtendsDifferentSpreadModelArrayClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsDifferentSpreadModelArrayClient(ExtendsDifferentSpreadModelArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     *     derivedProp (Required): [
-     *         (recursive schema, see above)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     *     derivedProp (Required): [
-     *         (recursive schema, see above)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DifferentSpreadModelArrayDerived get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadModelArrayDerived.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(DifferentSpreadModelArrayDerived body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelAsyncClient.java deleted file mode 100644 index 9be82a4bfbd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelAsyncClient.java +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.ExtendsDifferentSpreadModelsImpl; -import type.property.additionalproperties.models.DifferentSpreadModelDerived; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class ExtendsDifferentSpreadModelAsyncClient { - @Generated - private final ExtendsDifferentSpreadModelsImpl serviceClient; - - /** - * Initializes an instance of ExtendsDifferentSpreadModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsDifferentSpreadModelAsyncClient(ExtendsDifferentSpreadModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     *     derivedProp (Required): (recursive schema, see derivedProp above)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     *     derivedProp (Required): (recursive schema, see derivedProp above)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadModelDerived.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(DifferentSpreadModelDerived body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelClient.java deleted file mode 100644 index 1965b07213b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelClient.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.ExtendsDifferentSpreadModelsImpl; -import type.property.additionalproperties.models.DifferentSpreadModelDerived; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class ExtendsDifferentSpreadModelClient { - @Generated - private final ExtendsDifferentSpreadModelsImpl serviceClient; - - /** - * Initializes an instance of ExtendsDifferentSpreadModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsDifferentSpreadModelClient(ExtendsDifferentSpreadModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     *     derivedProp (Required): (recursive schema, see derivedProp above)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     *     derivedProp (Required): (recursive schema, see derivedProp above)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DifferentSpreadModelDerived get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadModelDerived.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(DifferentSpreadModelDerived body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringAsyncClient.java deleted file mode 100644 index 18f05dfa34c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringAsyncClient.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.ExtendsDifferentSpreadStringsImpl; -import type.property.additionalproperties.models.DifferentSpreadStringDerived; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class ExtendsDifferentSpreadStringAsyncClient { - @Generated - private final ExtendsDifferentSpreadStringsImpl serviceClient; - - /** - * Initializes an instance of ExtendsDifferentSpreadStringAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsDifferentSpreadStringAsyncClient(ExtendsDifferentSpreadStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     *     derivedProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     *     derivedProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadStringDerived.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(DifferentSpreadStringDerived body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringClient.java deleted file mode 100644 index b714975614b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.ExtendsDifferentSpreadStringsImpl; -import type.property.additionalproperties.models.DifferentSpreadStringDerived; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class ExtendsDifferentSpreadStringClient { - @Generated - private final ExtendsDifferentSpreadStringsImpl serviceClient; - - /** - * Initializes an instance of ExtendsDifferentSpreadStringClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsDifferentSpreadStringClient(ExtendsDifferentSpreadStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     *     derivedProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     *     derivedProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DifferentSpreadStringDerived get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadStringDerived.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(DifferentSpreadStringDerived body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatAsyncClient.java deleted file mode 100644 index 026d0dc39fd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.ExtendsFloatsImpl; -import type.property.additionalproperties.models.ExtendsFloatAdditionalProperties; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class ExtendsFloatAsyncClient { - @Generated - private final ExtendsFloatsImpl serviceClient; - - /** - * Initializes an instance of ExtendsFloatAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsFloatAsyncClient(ExtendsFloatsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ExtendsFloatAdditionalProperties.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(ExtendsFloatAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatClient.java deleted file mode 100644 index 4ba052bdf7c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.ExtendsFloatsImpl; -import type.property.additionalproperties.models.ExtendsFloatAdditionalProperties; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class ExtendsFloatClient { - @Generated - private final ExtendsFloatsImpl serviceClient; - - /** - * Initializes an instance of ExtendsFloatClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsFloatClient(ExtendsFloatsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ExtendsFloatAdditionalProperties get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ExtendsFloatAdditionalProperties.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(ExtendsFloatAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayAsyncClient.java deleted file mode 100644 index 3196804de3a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayAsyncClient.java +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.ExtendsModelArraysImpl; -import type.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class ExtendsModelArrayAsyncClient { - @Generated - private final ExtendsModelArraysImpl serviceClient; - - /** - * Initializes an instance of ExtendsModelArrayAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsModelArrayAsyncClient(ExtendsModelArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ExtendsModelArrayAdditionalProperties.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(ExtendsModelArrayAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayClient.java deleted file mode 100644 index 77f0c39bfd4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayClient.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.ExtendsModelArraysImpl; -import type.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class ExtendsModelArrayClient { - @Generated - private final ExtendsModelArraysImpl serviceClient; - - /** - * Initializes an instance of ExtendsModelArrayClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsModelArrayClient(ExtendsModelArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ExtendsModelArrayAdditionalProperties get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ExtendsModelArrayAdditionalProperties.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(ExtendsModelArrayAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelAsyncClient.java deleted file mode 100644 index 92b48fb641d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelAsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.ExtendsModelsImpl; -import type.property.additionalproperties.models.ExtendsModelAdditionalProperties; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class ExtendsModelAsyncClient { - @Generated - private final ExtendsModelsImpl serviceClient; - - /** - * Initializes an instance of ExtendsModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsModelAsyncClient(ExtendsModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ExtendsModelAdditionalProperties.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(ExtendsModelAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelClient.java deleted file mode 100644 index 90f58c58ed3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.ExtendsModelsImpl; -import type.property.additionalproperties.models.ExtendsModelAdditionalProperties; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class ExtendsModelClient { - @Generated - private final ExtendsModelsImpl serviceClient; - - /** - * Initializes an instance of ExtendsModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsModelClient(ExtendsModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ExtendsModelAdditionalProperties get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ExtendsModelAdditionalProperties.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(ExtendsModelAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringAsyncClient.java deleted file mode 100644 index 3d1813be333..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.ExtendsStringsImpl; -import type.property.additionalproperties.models.ExtendsStringAdditionalProperties; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class ExtendsStringAsyncClient { - @Generated - private final ExtendsStringsImpl serviceClient; - - /** - * Initializes an instance of ExtendsStringAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsStringAsyncClient(ExtendsStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ExtendsStringAdditionalProperties.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(ExtendsStringAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringClient.java deleted file mode 100644 index cc4c841de6f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.ExtendsStringsImpl; -import type.property.additionalproperties.models.ExtendsStringAdditionalProperties; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class ExtendsStringClient { - @Generated - private final ExtendsStringsImpl serviceClient; - - /** - * Initializes an instance of ExtendsStringClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsStringClient(ExtendsStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ExtendsStringAdditionalProperties get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ExtendsStringAdditionalProperties.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(ExtendsStringAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownAsyncClient.java deleted file mode 100644 index a83a34c2c73..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.ExtendsUnknownsImpl; -import type.property.additionalproperties.models.ExtendsUnknownAdditionalProperties; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class ExtendsUnknownAsyncClient { - @Generated - private final ExtendsUnknownsImpl serviceClient; - - /** - * Initializes an instance of ExtendsUnknownAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsUnknownAsyncClient(ExtendsUnknownsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ExtendsUnknownAdditionalProperties.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(ExtendsUnknownAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownClient.java deleted file mode 100644 index 35cf068c973..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.ExtendsUnknownsImpl; -import type.property.additionalproperties.models.ExtendsUnknownAdditionalProperties; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class ExtendsUnknownClient { - @Generated - private final ExtendsUnknownsImpl serviceClient; - - /** - * Initializes an instance of ExtendsUnknownClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsUnknownClient(ExtendsUnknownsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ExtendsUnknownAdditionalProperties get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ExtendsUnknownAdditionalProperties.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(ExtendsUnknownAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedAsyncClient.java deleted file mode 100644 index 83873741213..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedAsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.ExtendsUnknownDerivedsImpl; -import type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDerived; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class ExtendsUnknownDerivedAsyncClient { - @Generated - private final ExtendsUnknownDerivedsImpl serviceClient; - - /** - * Initializes an instance of ExtendsUnknownDerivedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsUnknownDerivedAsyncClient(ExtendsUnknownDerivedsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ExtendsUnknownAdditionalPropertiesDerived.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(ExtendsUnknownAdditionalPropertiesDerived body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedClient.java deleted file mode 100644 index ff314b91165..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.ExtendsUnknownDerivedsImpl; -import type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDerived; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class ExtendsUnknownDerivedClient { - @Generated - private final ExtendsUnknownDerivedsImpl serviceClient; - - /** - * Initializes an instance of ExtendsUnknownDerivedClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsUnknownDerivedClient(ExtendsUnknownDerivedsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ExtendsUnknownAdditionalPropertiesDerived get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ExtendsUnknownAdditionalPropertiesDerived.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(ExtendsUnknownAdditionalPropertiesDerived body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedAsyncClient.java deleted file mode 100644 index 78defd46b24..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedAsyncClient.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.ExtendsUnknownDiscriminatedsImpl; -import type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminated; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class ExtendsUnknownDiscriminatedAsyncClient { - @Generated - private final ExtendsUnknownDiscriminatedsImpl serviceClient; - - /** - * Initializes an instance of ExtendsUnknownDiscriminatedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsUnknownDiscriminatedAsyncClient(ExtendsUnknownDiscriminatedsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData - .toObject(ExtendsUnknownAdditionalPropertiesDiscriminated.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(ExtendsUnknownAdditionalPropertiesDiscriminated body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedClient.java deleted file mode 100644 index 321ddff0590..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.ExtendsUnknownDiscriminatedsImpl; -import type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminated; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class ExtendsUnknownDiscriminatedClient { - @Generated - private final ExtendsUnknownDiscriminatedsImpl serviceClient; - - /** - * Initializes an instance of ExtendsUnknownDiscriminatedClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtendsUnknownDiscriminatedClient(ExtendsUnknownDiscriminatedsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ExtendsUnknownAdditionalPropertiesDiscriminated get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue() - .toObject(ExtendsUnknownAdditionalPropertiesDiscriminated.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(ExtendsUnknownAdditionalPropertiesDiscriminated body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatAsyncClient.java deleted file mode 100644 index bbfd446289d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.IsFloatsImpl; -import type.property.additionalproperties.models.IsFloatAdditionalProperties; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class IsFloatAsyncClient { - @Generated - private final IsFloatsImpl serviceClient; - - /** - * Initializes an instance of IsFloatAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsFloatAsyncClient(IsFloatsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(IsFloatAdditionalProperties.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(IsFloatAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatClient.java deleted file mode 100644 index 15496ad1301..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.IsFloatsImpl; -import type.property.additionalproperties.models.IsFloatAdditionalProperties; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class IsFloatClient { - @Generated - private final IsFloatsImpl serviceClient; - - /** - * Initializes an instance of IsFloatClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsFloatClient(IsFloatsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public IsFloatAdditionalProperties get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(IsFloatAdditionalProperties.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(IsFloatAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayAsyncClient.java deleted file mode 100644 index 4936465e71b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayAsyncClient.java +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.IsModelArraysImpl; -import type.property.additionalproperties.models.IsModelArrayAdditionalProperties; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class IsModelArrayAsyncClient { - @Generated - private final IsModelArraysImpl serviceClient; - - /** - * Initializes an instance of IsModelArrayAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsModelArrayAsyncClient(IsModelArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(IsModelArrayAdditionalProperties.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(IsModelArrayAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayClient.java deleted file mode 100644 index 9eb66c02163..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayClient.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.IsModelArraysImpl; -import type.property.additionalproperties.models.IsModelArrayAdditionalProperties; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class IsModelArrayClient { - @Generated - private final IsModelArraysImpl serviceClient; - - /** - * Initializes an instance of IsModelArrayClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsModelArrayClient(IsModelArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public IsModelArrayAdditionalProperties get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(IsModelArrayAdditionalProperties.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(IsModelArrayAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelAsyncClient.java deleted file mode 100644 index 7dd55a95f2a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelAsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.IsModelsImpl; -import type.property.additionalproperties.models.IsModelAdditionalProperties; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class IsModelAsyncClient { - @Generated - private final IsModelsImpl serviceClient; - - /** - * Initializes an instance of IsModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsModelAsyncClient(IsModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(IsModelAdditionalProperties.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(IsModelAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelClient.java deleted file mode 100644 index 0f2bcd58956..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.IsModelsImpl; -import type.property.additionalproperties.models.IsModelAdditionalProperties; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class IsModelClient { - @Generated - private final IsModelsImpl serviceClient; - - /** - * Initializes an instance of IsModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsModelClient(IsModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public IsModelAdditionalProperties get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(IsModelAdditionalProperties.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(IsModelAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringAsyncClient.java deleted file mode 100644 index 62382f7f0fb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.IsStringsImpl; -import type.property.additionalproperties.models.IsStringAdditionalProperties; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class IsStringAsyncClient { - @Generated - private final IsStringsImpl serviceClient; - - /** - * Initializes an instance of IsStringAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsStringAsyncClient(IsStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(IsStringAdditionalProperties.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(IsStringAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringClient.java deleted file mode 100644 index fcc567c50b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.IsStringsImpl; -import type.property.additionalproperties.models.IsStringAdditionalProperties; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class IsStringClient { - @Generated - private final IsStringsImpl serviceClient; - - /** - * Initializes an instance of IsStringClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsStringClient(IsStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public IsStringAdditionalProperties get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(IsStringAdditionalProperties.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(IsStringAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownAsyncClient.java deleted file mode 100644 index 46796a43ff9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.IsUnknownsImpl; -import type.property.additionalproperties.models.IsUnknownAdditionalProperties; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class IsUnknownAsyncClient { - @Generated - private final IsUnknownsImpl serviceClient; - - /** - * Initializes an instance of IsUnknownAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsUnknownAsyncClient(IsUnknownsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(IsUnknownAdditionalProperties.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(IsUnknownAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownClient.java deleted file mode 100644 index c495ef407b0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.IsUnknownsImpl; -import type.property.additionalproperties.models.IsUnknownAdditionalProperties; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class IsUnknownClient { - @Generated - private final IsUnknownsImpl serviceClient; - - /** - * Initializes an instance of IsUnknownClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsUnknownClient(IsUnknownsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public IsUnknownAdditionalProperties get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(IsUnknownAdditionalProperties.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(IsUnknownAdditionalProperties body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedAsyncClient.java deleted file mode 100644 index 7ab6f04400b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedAsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.IsUnknownDerivedsImpl; -import type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDerived; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class IsUnknownDerivedAsyncClient { - @Generated - private final IsUnknownDerivedsImpl serviceClient; - - /** - * Initializes an instance of IsUnknownDerivedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsUnknownDerivedAsyncClient(IsUnknownDerivedsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(IsUnknownAdditionalPropertiesDerived.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(IsUnknownAdditionalPropertiesDerived body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedClient.java deleted file mode 100644 index 5be516f05fa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.IsUnknownDerivedsImpl; -import type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDerived; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class IsUnknownDerivedClient { - @Generated - private final IsUnknownDerivedsImpl serviceClient; - - /** - * Initializes an instance of IsUnknownDerivedClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsUnknownDerivedClient(IsUnknownDerivedsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public IsUnknownAdditionalPropertiesDerived get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(IsUnknownAdditionalPropertiesDerived.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(IsUnknownAdditionalPropertiesDerived body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedAsyncClient.java deleted file mode 100644 index fc983f168fb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedAsyncClient.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.IsUnknownDiscriminatedsImpl; -import type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminated; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class IsUnknownDiscriminatedAsyncClient { - @Generated - private final IsUnknownDiscriminatedsImpl serviceClient; - - /** - * Initializes an instance of IsUnknownDiscriminatedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsUnknownDiscriminatedAsyncClient(IsUnknownDiscriminatedsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(IsUnknownAdditionalPropertiesDiscriminated.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(IsUnknownAdditionalPropertiesDiscriminated body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedClient.java deleted file mode 100644 index 62e6beaf161..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.IsUnknownDiscriminatedsImpl; -import type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminated; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class IsUnknownDiscriminatedClient { - @Generated - private final IsUnknownDiscriminatedsImpl serviceClient; - - /** - * Initializes an instance of IsUnknownDiscriminatedClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IsUnknownDiscriminatedClient(IsUnknownDiscriminatedsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public IsUnknownAdditionalPropertiesDiscriminated get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(IsUnknownAdditionalPropertiesDiscriminated.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(IsUnknownAdditionalPropertiesDiscriminated body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadAsyncClient.java deleted file mode 100644 index 8493e5adf43..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.MultipleSpreadsImpl; -import type.property.additionalproperties.models.MultipleSpreadRecord; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class MultipleSpreadAsyncClient { - @Generated - private final MultipleSpreadsImpl serviceClient; - - /** - * Initializes an instance of MultipleSpreadAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MultipleSpreadAsyncClient(MultipleSpreadsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(MultipleSpreadRecord.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(MultipleSpreadRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadClient.java deleted file mode 100644 index e4ebaaeee5b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.MultipleSpreadsImpl; -import type.property.additionalproperties.models.MultipleSpreadRecord; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class MultipleSpreadClient { - @Generated - private final MultipleSpreadsImpl serviceClient; - - /** - * Initializes an instance of MultipleSpreadClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MultipleSpreadClient(MultipleSpreadsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public MultipleSpreadRecord get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(MultipleSpreadRecord.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(MultipleSpreadRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatAsyncClient.java deleted file mode 100644 index a1f19a0bdac..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.SpreadDifferentFloatsImpl; -import type.property.additionalproperties.models.DifferentSpreadFloatRecord; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class SpreadDifferentFloatAsyncClient { - @Generated - private final SpreadDifferentFloatsImpl serviceClient; - - /** - * Initializes an instance of SpreadDifferentFloatAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadDifferentFloatAsyncClient(SpreadDifferentFloatsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadFloatRecord.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(DifferentSpreadFloatRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatClient.java deleted file mode 100644 index 1575f057cdf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.SpreadDifferentFloatsImpl; -import type.property.additionalproperties.models.DifferentSpreadFloatRecord; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class SpreadDifferentFloatClient { - @Generated - private final SpreadDifferentFloatsImpl serviceClient; - - /** - * Initializes an instance of SpreadDifferentFloatClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadDifferentFloatClient(SpreadDifferentFloatsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DifferentSpreadFloatRecord get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadFloatRecord.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(DifferentSpreadFloatRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayAsyncClient.java deleted file mode 100644 index a5f7683a6c3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayAsyncClient.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.SpreadDifferentModelArraysImpl; -import type.property.additionalproperties.models.DifferentSpreadModelArrayRecord; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class SpreadDifferentModelArrayAsyncClient { - @Generated - private final SpreadDifferentModelArraysImpl serviceClient; - - /** - * Initializes an instance of SpreadDifferentModelArrayAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadDifferentModelArrayAsyncClient(SpreadDifferentModelArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadModelArrayRecord.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(DifferentSpreadModelArrayRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayClient.java deleted file mode 100644 index 1f728a83a87..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.SpreadDifferentModelArraysImpl; -import type.property.additionalproperties.models.DifferentSpreadModelArrayRecord; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class SpreadDifferentModelArrayClient { - @Generated - private final SpreadDifferentModelArraysImpl serviceClient; - - /** - * Initializes an instance of SpreadDifferentModelArrayClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadDifferentModelArrayClient(SpreadDifferentModelArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DifferentSpreadModelArrayRecord get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadModelArrayRecord.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(DifferentSpreadModelArrayRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelAsyncClient.java deleted file mode 100644 index a581dea6ebc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelAsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.SpreadDifferentModelsImpl; -import type.property.additionalproperties.models.DifferentSpreadModelRecord; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class SpreadDifferentModelAsyncClient { - @Generated - private final SpreadDifferentModelsImpl serviceClient; - - /** - * Initializes an instance of SpreadDifferentModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadDifferentModelAsyncClient(SpreadDifferentModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadModelRecord.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(DifferentSpreadModelRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelClient.java deleted file mode 100644 index 884c9c47c14..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.SpreadDifferentModelsImpl; -import type.property.additionalproperties.models.DifferentSpreadModelRecord; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class SpreadDifferentModelClient { - @Generated - private final SpreadDifferentModelsImpl serviceClient; - - /** - * Initializes an instance of SpreadDifferentModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadDifferentModelClient(SpreadDifferentModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DifferentSpreadModelRecord get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadModelRecord.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(DifferentSpreadModelRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringAsyncClient.java deleted file mode 100644 index f77f71b350b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.SpreadDifferentStringsImpl; -import type.property.additionalproperties.models.DifferentSpreadStringRecord; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class SpreadDifferentStringAsyncClient { - @Generated - private final SpreadDifferentStringsImpl serviceClient; - - /** - * Initializes an instance of SpreadDifferentStringAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadDifferentStringAsyncClient(SpreadDifferentStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadStringRecord.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(DifferentSpreadStringRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringClient.java deleted file mode 100644 index c0e9155b535..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.SpreadDifferentStringsImpl; -import type.property.additionalproperties.models.DifferentSpreadStringRecord; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class SpreadDifferentStringClient { - @Generated - private final SpreadDifferentStringsImpl serviceClient; - - /** - * Initializes an instance of SpreadDifferentStringClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadDifferentStringClient(SpreadDifferentStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DifferentSpreadStringRecord get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadStringRecord.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(DifferentSpreadStringRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatAsyncClient.java deleted file mode 100644 index b8cc70c03f8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.SpreadFloatsImpl; -import type.property.additionalproperties.models.SpreadFloatRecord; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class SpreadFloatAsyncClient { - @Generated - private final SpreadFloatsImpl serviceClient; - - /** - * Initializes an instance of SpreadFloatAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadFloatAsyncClient(SpreadFloatsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SpreadFloatRecord.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(SpreadFloatRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatClient.java deleted file mode 100644 index 4a3b45ba4e0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.SpreadFloatsImpl; -import type.property.additionalproperties.models.SpreadFloatRecord; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class SpreadFloatClient { - @Generated - private final SpreadFloatsImpl serviceClient; - - /** - * Initializes an instance of SpreadFloatClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadFloatClient(SpreadFloatsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SpreadFloatRecord get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(SpreadFloatRecord.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(SpreadFloatRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayAsyncClient.java deleted file mode 100644 index 0e8a7bd9a5f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayAsyncClient.java +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.SpreadModelArraysImpl; -import type.property.additionalproperties.models.SpreadModelArrayRecord; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class SpreadModelArrayAsyncClient { - @Generated - private final SpreadModelArraysImpl serviceClient; - - /** - * Initializes an instance of SpreadModelArrayAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadModelArrayAsyncClient(SpreadModelArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SpreadModelArrayRecord.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(SpreadModelArrayRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayClient.java deleted file mode 100644 index 3b17690d0bb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayClient.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.SpreadModelArraysImpl; -import type.property.additionalproperties.models.SpreadModelArrayRecord; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class SpreadModelArrayClient { - @Generated - private final SpreadModelArraysImpl serviceClient; - - /** - * Initializes an instance of SpreadModelArrayClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadModelArrayClient(SpreadModelArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SpreadModelArrayRecord get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(SpreadModelArrayRecord.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(SpreadModelArrayRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelAsyncClient.java deleted file mode 100644 index c529744ee9d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelAsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.SpreadModelsImpl; -import type.property.additionalproperties.models.SpreadModelRecord; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class SpreadModelAsyncClient { - @Generated - private final SpreadModelsImpl serviceClient; - - /** - * Initializes an instance of SpreadModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadModelAsyncClient(SpreadModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SpreadModelRecord.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(SpreadModelRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelClient.java deleted file mode 100644 index 015ca294a19..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.SpreadModelsImpl; -import type.property.additionalproperties.models.SpreadModelRecord; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class SpreadModelClient { - @Generated - private final SpreadModelsImpl serviceClient; - - /** - * Initializes an instance of SpreadModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadModelClient(SpreadModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SpreadModelRecord get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(SpreadModelRecord.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(SpreadModelRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2AsyncClient.java deleted file mode 100644 index b478e1c6a0f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2AsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.SpreadRecordNonDiscriminatedUnion2sImpl; -import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion2; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class SpreadRecordNonDiscriminatedUnion2AsyncClient { - @Generated - private final SpreadRecordNonDiscriminatedUnion2sImpl serviceClient; - - /** - * Initializes an instance of SpreadRecordNonDiscriminatedUnion2AsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadRecordNonDiscriminatedUnion2AsyncClient(SpreadRecordNonDiscriminatedUnion2sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SpreadRecordForNonDiscriminatedUnion2.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(SpreadRecordForNonDiscriminatedUnion2 body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2Client.java deleted file mode 100644 index 7be6f856bc9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2Client.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.SpreadRecordNonDiscriminatedUnion2sImpl; -import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion2; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class SpreadRecordNonDiscriminatedUnion2Client { - @Generated - private final SpreadRecordNonDiscriminatedUnion2sImpl serviceClient; - - /** - * Initializes an instance of SpreadRecordNonDiscriminatedUnion2Client class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadRecordNonDiscriminatedUnion2Client(SpreadRecordNonDiscriminatedUnion2sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SpreadRecordForNonDiscriminatedUnion2 get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(SpreadRecordForNonDiscriminatedUnion2.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(SpreadRecordForNonDiscriminatedUnion2 body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3AsyncClient.java deleted file mode 100644 index 555caaa910b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3AsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.SpreadRecordNonDiscriminatedUnion3sImpl; -import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion3; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class SpreadRecordNonDiscriminatedUnion3AsyncClient { - @Generated - private final SpreadRecordNonDiscriminatedUnion3sImpl serviceClient; - - /** - * Initializes an instance of SpreadRecordNonDiscriminatedUnion3AsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadRecordNonDiscriminatedUnion3AsyncClient(SpreadRecordNonDiscriminatedUnion3sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SpreadRecordForNonDiscriminatedUnion3.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(SpreadRecordForNonDiscriminatedUnion3 body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3Client.java deleted file mode 100644 index ca1dc2ada9b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3Client.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.SpreadRecordNonDiscriminatedUnion3sImpl; -import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion3; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class SpreadRecordNonDiscriminatedUnion3Client { - @Generated - private final SpreadRecordNonDiscriminatedUnion3sImpl serviceClient; - - /** - * Initializes an instance of SpreadRecordNonDiscriminatedUnion3Client class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadRecordNonDiscriminatedUnion3Client(SpreadRecordNonDiscriminatedUnion3sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SpreadRecordForNonDiscriminatedUnion3 get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(SpreadRecordForNonDiscriminatedUnion3.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(SpreadRecordForNonDiscriminatedUnion3 body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionAsyncClient.java deleted file mode 100644 index a041cdf3173..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.SpreadRecordNonDiscriminatedUnionsImpl; -import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class SpreadRecordNonDiscriminatedUnionAsyncClient { - @Generated - private final SpreadRecordNonDiscriminatedUnionsImpl serviceClient; - - /** - * Initializes an instance of SpreadRecordNonDiscriminatedUnionAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadRecordNonDiscriminatedUnionAsyncClient(SpreadRecordNonDiscriminatedUnionsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SpreadRecordForNonDiscriminatedUnion.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(SpreadRecordForNonDiscriminatedUnion body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionClient.java deleted file mode 100644 index a283725fc7d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.SpreadRecordNonDiscriminatedUnionsImpl; -import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class SpreadRecordNonDiscriminatedUnionClient { - @Generated - private final SpreadRecordNonDiscriminatedUnionsImpl serviceClient; - - /** - * Initializes an instance of SpreadRecordNonDiscriminatedUnionClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadRecordNonDiscriminatedUnionClient(SpreadRecordNonDiscriminatedUnionsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SpreadRecordForNonDiscriminatedUnion get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(SpreadRecordForNonDiscriminatedUnion.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(SpreadRecordForNonDiscriminatedUnion body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionAsyncClient.java deleted file mode 100644 index 8b4780502e3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.SpreadRecordUnionsImpl; -import type.property.additionalproperties.models.SpreadRecordForUnion; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class SpreadRecordUnionAsyncClient { - @Generated - private final SpreadRecordUnionsImpl serviceClient; - - /** - * Initializes an instance of SpreadRecordUnionAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadRecordUnionAsyncClient(SpreadRecordUnionsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SpreadRecordForUnion.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(SpreadRecordForUnion body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionClient.java deleted file mode 100644 index afa33897247..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.SpreadRecordUnionsImpl; -import type.property.additionalproperties.models.SpreadRecordForUnion; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class SpreadRecordUnionClient { - @Generated - private final SpreadRecordUnionsImpl serviceClient; - - /** - * Initializes an instance of SpreadRecordUnionClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadRecordUnionClient(SpreadRecordUnionsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SpreadRecordForUnion get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(SpreadRecordForUnion.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(SpreadRecordForUnion body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringAsyncClient.java deleted file mode 100644 index e19da973725..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringAsyncClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.additionalproperties.implementation.SpreadStringsImpl; -import type.property.additionalproperties.models.SpreadStringRecord; - -/** - * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) -public final class SpreadStringAsyncClient { - @Generated - private final SpreadStringsImpl serviceClient; - - /** - * Initializes an instance of SpreadStringAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadStringAsyncClient(SpreadStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SpreadStringRecord.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(SpreadStringRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringClient.java deleted file mode 100644 index 533db341f90..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringClient.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.additionalproperties.implementation.SpreadStringsImpl; -import type.property.additionalproperties.models.SpreadStringRecord; - -/** - * Initializes a new instance of the synchronous AdditionalPropertiesClient type. - */ -@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) -public final class SpreadStringClient { - @Generated - private final SpreadStringsImpl serviceClient; - - /** - * Initializes an instance of SpreadStringClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - SpreadStringClient(SpreadStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public SpreadStringRecord get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(SpreadStringRecord.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(SpreadStringRecord body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java deleted file mode 100644 index 21a6a3dfe1c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java +++ /dev/null @@ -1,558 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 AdditionalPropertiesClient type. - */ -public final class AdditionalPropertiesClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 ExtendsUnknownsImpl object to access its operations. - */ - private final ExtendsUnknownsImpl extendsUnknowns; - - /** - * Gets the ExtendsUnknownsImpl object to access its operations. - * - * @return the ExtendsUnknownsImpl object. - */ - public ExtendsUnknownsImpl getExtendsUnknowns() { - return this.extendsUnknowns; - } - - /** - * The ExtendsUnknownDerivedsImpl object to access its operations. - */ - private final ExtendsUnknownDerivedsImpl extendsUnknownDeriveds; - - /** - * Gets the ExtendsUnknownDerivedsImpl object to access its operations. - * - * @return the ExtendsUnknownDerivedsImpl object. - */ - public ExtendsUnknownDerivedsImpl getExtendsUnknownDeriveds() { - return this.extendsUnknownDeriveds; - } - - /** - * The ExtendsUnknownDiscriminatedsImpl object to access its operations. - */ - private final ExtendsUnknownDiscriminatedsImpl extendsUnknownDiscriminateds; - - /** - * Gets the ExtendsUnknownDiscriminatedsImpl object to access its operations. - * - * @return the ExtendsUnknownDiscriminatedsImpl object. - */ - public ExtendsUnknownDiscriminatedsImpl getExtendsUnknownDiscriminateds() { - return this.extendsUnknownDiscriminateds; - } - - /** - * The IsUnknownsImpl object to access its operations. - */ - private final IsUnknownsImpl isUnknowns; - - /** - * Gets the IsUnknownsImpl object to access its operations. - * - * @return the IsUnknownsImpl object. - */ - public IsUnknownsImpl getIsUnknowns() { - return this.isUnknowns; - } - - /** - * The IsUnknownDerivedsImpl object to access its operations. - */ - private final IsUnknownDerivedsImpl isUnknownDeriveds; - - /** - * Gets the IsUnknownDerivedsImpl object to access its operations. - * - * @return the IsUnknownDerivedsImpl object. - */ - public IsUnknownDerivedsImpl getIsUnknownDeriveds() { - return this.isUnknownDeriveds; - } - - /** - * The IsUnknownDiscriminatedsImpl object to access its operations. - */ - private final IsUnknownDiscriminatedsImpl isUnknownDiscriminateds; - - /** - * Gets the IsUnknownDiscriminatedsImpl object to access its operations. - * - * @return the IsUnknownDiscriminatedsImpl object. - */ - public IsUnknownDiscriminatedsImpl getIsUnknownDiscriminateds() { - return this.isUnknownDiscriminateds; - } - - /** - * The ExtendsStringsImpl object to access its operations. - */ - private final ExtendsStringsImpl extendsStrings; - - /** - * Gets the ExtendsStringsImpl object to access its operations. - * - * @return the ExtendsStringsImpl object. - */ - public ExtendsStringsImpl getExtendsStrings() { - return this.extendsStrings; - } - - /** - * The IsStringsImpl object to access its operations. - */ - private final IsStringsImpl isStrings; - - /** - * Gets the IsStringsImpl object to access its operations. - * - * @return the IsStringsImpl object. - */ - public IsStringsImpl getIsStrings() { - return this.isStrings; - } - - /** - * The SpreadStringsImpl object to access its operations. - */ - private final SpreadStringsImpl spreadStrings; - - /** - * Gets the SpreadStringsImpl object to access its operations. - * - * @return the SpreadStringsImpl object. - */ - public SpreadStringsImpl getSpreadStrings() { - return this.spreadStrings; - } - - /** - * The ExtendsFloatsImpl object to access its operations. - */ - private final ExtendsFloatsImpl extendsFloats; - - /** - * Gets the ExtendsFloatsImpl object to access its operations. - * - * @return the ExtendsFloatsImpl object. - */ - public ExtendsFloatsImpl getExtendsFloats() { - return this.extendsFloats; - } - - /** - * The IsFloatsImpl object to access its operations. - */ - private final IsFloatsImpl isFloats; - - /** - * Gets the IsFloatsImpl object to access its operations. - * - * @return the IsFloatsImpl object. - */ - public IsFloatsImpl getIsFloats() { - return this.isFloats; - } - - /** - * The SpreadFloatsImpl object to access its operations. - */ - private final SpreadFloatsImpl spreadFloats; - - /** - * Gets the SpreadFloatsImpl object to access its operations. - * - * @return the SpreadFloatsImpl object. - */ - public SpreadFloatsImpl getSpreadFloats() { - return this.spreadFloats; - } - - /** - * The ExtendsModelsImpl object to access its operations. - */ - private final ExtendsModelsImpl extendsModels; - - /** - * Gets the ExtendsModelsImpl object to access its operations. - * - * @return the ExtendsModelsImpl object. - */ - public ExtendsModelsImpl getExtendsModels() { - return this.extendsModels; - } - - /** - * The IsModelsImpl object to access its operations. - */ - private final IsModelsImpl isModels; - - /** - * Gets the IsModelsImpl object to access its operations. - * - * @return the IsModelsImpl object. - */ - public IsModelsImpl getIsModels() { - return this.isModels; - } - - /** - * The SpreadModelsImpl object to access its operations. - */ - private final SpreadModelsImpl spreadModels; - - /** - * Gets the SpreadModelsImpl object to access its operations. - * - * @return the SpreadModelsImpl object. - */ - public SpreadModelsImpl getSpreadModels() { - return this.spreadModels; - } - - /** - * The ExtendsModelArraysImpl object to access its operations. - */ - private final ExtendsModelArraysImpl extendsModelArrays; - - /** - * Gets the ExtendsModelArraysImpl object to access its operations. - * - * @return the ExtendsModelArraysImpl object. - */ - public ExtendsModelArraysImpl getExtendsModelArrays() { - return this.extendsModelArrays; - } - - /** - * The IsModelArraysImpl object to access its operations. - */ - private final IsModelArraysImpl isModelArrays; - - /** - * Gets the IsModelArraysImpl object to access its operations. - * - * @return the IsModelArraysImpl object. - */ - public IsModelArraysImpl getIsModelArrays() { - return this.isModelArrays; - } - - /** - * The SpreadModelArraysImpl object to access its operations. - */ - private final SpreadModelArraysImpl spreadModelArrays; - - /** - * Gets the SpreadModelArraysImpl object to access its operations. - * - * @return the SpreadModelArraysImpl object. - */ - public SpreadModelArraysImpl getSpreadModelArrays() { - return this.spreadModelArrays; - } - - /** - * The SpreadDifferentStringsImpl object to access its operations. - */ - private final SpreadDifferentStringsImpl spreadDifferentStrings; - - /** - * Gets the SpreadDifferentStringsImpl object to access its operations. - * - * @return the SpreadDifferentStringsImpl object. - */ - public SpreadDifferentStringsImpl getSpreadDifferentStrings() { - return this.spreadDifferentStrings; - } - - /** - * The SpreadDifferentFloatsImpl object to access its operations. - */ - private final SpreadDifferentFloatsImpl spreadDifferentFloats; - - /** - * Gets the SpreadDifferentFloatsImpl object to access its operations. - * - * @return the SpreadDifferentFloatsImpl object. - */ - public SpreadDifferentFloatsImpl getSpreadDifferentFloats() { - return this.spreadDifferentFloats; - } - - /** - * The SpreadDifferentModelsImpl object to access its operations. - */ - private final SpreadDifferentModelsImpl spreadDifferentModels; - - /** - * Gets the SpreadDifferentModelsImpl object to access its operations. - * - * @return the SpreadDifferentModelsImpl object. - */ - public SpreadDifferentModelsImpl getSpreadDifferentModels() { - return this.spreadDifferentModels; - } - - /** - * The SpreadDifferentModelArraysImpl object to access its operations. - */ - private final SpreadDifferentModelArraysImpl spreadDifferentModelArrays; - - /** - * Gets the SpreadDifferentModelArraysImpl object to access its operations. - * - * @return the SpreadDifferentModelArraysImpl object. - */ - public SpreadDifferentModelArraysImpl getSpreadDifferentModelArrays() { - return this.spreadDifferentModelArrays; - } - - /** - * The ExtendsDifferentSpreadStringsImpl object to access its operations. - */ - private final ExtendsDifferentSpreadStringsImpl extendsDifferentSpreadStrings; - - /** - * Gets the ExtendsDifferentSpreadStringsImpl object to access its operations. - * - * @return the ExtendsDifferentSpreadStringsImpl object. - */ - public ExtendsDifferentSpreadStringsImpl getExtendsDifferentSpreadStrings() { - return this.extendsDifferentSpreadStrings; - } - - /** - * The ExtendsDifferentSpreadFloatsImpl object to access its operations. - */ - private final ExtendsDifferentSpreadFloatsImpl extendsDifferentSpreadFloats; - - /** - * Gets the ExtendsDifferentSpreadFloatsImpl object to access its operations. - * - * @return the ExtendsDifferentSpreadFloatsImpl object. - */ - public ExtendsDifferentSpreadFloatsImpl getExtendsDifferentSpreadFloats() { - return this.extendsDifferentSpreadFloats; - } - - /** - * The ExtendsDifferentSpreadModelsImpl object to access its operations. - */ - private final ExtendsDifferentSpreadModelsImpl extendsDifferentSpreadModels; - - /** - * Gets the ExtendsDifferentSpreadModelsImpl object to access its operations. - * - * @return the ExtendsDifferentSpreadModelsImpl object. - */ - public ExtendsDifferentSpreadModelsImpl getExtendsDifferentSpreadModels() { - return this.extendsDifferentSpreadModels; - } - - /** - * The ExtendsDifferentSpreadModelArraysImpl object to access its operations. - */ - private final ExtendsDifferentSpreadModelArraysImpl extendsDifferentSpreadModelArrays; - - /** - * Gets the ExtendsDifferentSpreadModelArraysImpl object to access its operations. - * - * @return the ExtendsDifferentSpreadModelArraysImpl object. - */ - public ExtendsDifferentSpreadModelArraysImpl getExtendsDifferentSpreadModelArrays() { - return this.extendsDifferentSpreadModelArrays; - } - - /** - * The MultipleSpreadsImpl object to access its operations. - */ - private final MultipleSpreadsImpl multipleSpreads; - - /** - * Gets the MultipleSpreadsImpl object to access its operations. - * - * @return the MultipleSpreadsImpl object. - */ - public MultipleSpreadsImpl getMultipleSpreads() { - return this.multipleSpreads; - } - - /** - * The SpreadRecordUnionsImpl object to access its operations. - */ - private final SpreadRecordUnionsImpl spreadRecordUnions; - - /** - * Gets the SpreadRecordUnionsImpl object to access its operations. - * - * @return the SpreadRecordUnionsImpl object. - */ - public SpreadRecordUnionsImpl getSpreadRecordUnions() { - return this.spreadRecordUnions; - } - - /** - * The SpreadRecordNonDiscriminatedUnionsImpl object to access its operations. - */ - private final SpreadRecordNonDiscriminatedUnionsImpl spreadRecordNonDiscriminatedUnions; - - /** - * Gets the SpreadRecordNonDiscriminatedUnionsImpl object to access its operations. - * - * @return the SpreadRecordNonDiscriminatedUnionsImpl object. - */ - public SpreadRecordNonDiscriminatedUnionsImpl getSpreadRecordNonDiscriminatedUnions() { - return this.spreadRecordNonDiscriminatedUnions; - } - - /** - * The SpreadRecordNonDiscriminatedUnion2sImpl object to access its operations. - */ - private final SpreadRecordNonDiscriminatedUnion2sImpl spreadRecordNonDiscriminatedUnion2s; - - /** - * Gets the SpreadRecordNonDiscriminatedUnion2sImpl object to access its operations. - * - * @return the SpreadRecordNonDiscriminatedUnion2sImpl object. - */ - public SpreadRecordNonDiscriminatedUnion2sImpl getSpreadRecordNonDiscriminatedUnion2s() { - return this.spreadRecordNonDiscriminatedUnion2s; - } - - /** - * The SpreadRecordNonDiscriminatedUnion3sImpl object to access its operations. - */ - private final SpreadRecordNonDiscriminatedUnion3sImpl spreadRecordNonDiscriminatedUnion3s; - - /** - * Gets the SpreadRecordNonDiscriminatedUnion3sImpl object to access its operations. - * - * @return the SpreadRecordNonDiscriminatedUnion3sImpl object. - */ - public SpreadRecordNonDiscriminatedUnion3sImpl getSpreadRecordNonDiscriminatedUnion3s() { - return this.spreadRecordNonDiscriminatedUnion3s; - } - - /** - * Initializes an instance of AdditionalPropertiesClient client. - * - * @param endpoint Service host. - */ - public AdditionalPropertiesClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of AdditionalPropertiesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public AdditionalPropertiesClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of AdditionalPropertiesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public AdditionalPropertiesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.extendsUnknowns = new ExtendsUnknownsImpl(this); - this.extendsUnknownDeriveds = new ExtendsUnknownDerivedsImpl(this); - this.extendsUnknownDiscriminateds = new ExtendsUnknownDiscriminatedsImpl(this); - this.isUnknowns = new IsUnknownsImpl(this); - this.isUnknownDeriveds = new IsUnknownDerivedsImpl(this); - this.isUnknownDiscriminateds = new IsUnknownDiscriminatedsImpl(this); - this.extendsStrings = new ExtendsStringsImpl(this); - this.isStrings = new IsStringsImpl(this); - this.spreadStrings = new SpreadStringsImpl(this); - this.extendsFloats = new ExtendsFloatsImpl(this); - this.isFloats = new IsFloatsImpl(this); - this.spreadFloats = new SpreadFloatsImpl(this); - this.extendsModels = new ExtendsModelsImpl(this); - this.isModels = new IsModelsImpl(this); - this.spreadModels = new SpreadModelsImpl(this); - this.extendsModelArrays = new ExtendsModelArraysImpl(this); - this.isModelArrays = new IsModelArraysImpl(this); - this.spreadModelArrays = new SpreadModelArraysImpl(this); - this.spreadDifferentStrings = new SpreadDifferentStringsImpl(this); - this.spreadDifferentFloats = new SpreadDifferentFloatsImpl(this); - this.spreadDifferentModels = new SpreadDifferentModelsImpl(this); - this.spreadDifferentModelArrays = new SpreadDifferentModelArraysImpl(this); - this.extendsDifferentSpreadStrings = new ExtendsDifferentSpreadStringsImpl(this); - this.extendsDifferentSpreadFloats = new ExtendsDifferentSpreadFloatsImpl(this); - this.extendsDifferentSpreadModels = new ExtendsDifferentSpreadModelsImpl(this); - this.extendsDifferentSpreadModelArrays = new ExtendsDifferentSpreadModelArraysImpl(this); - this.multipleSpreads = new MultipleSpreadsImpl(this); - this.spreadRecordUnions = new SpreadRecordUnionsImpl(this); - this.spreadRecordNonDiscriminatedUnions = new SpreadRecordNonDiscriminatedUnionsImpl(this); - this.spreadRecordNonDiscriminatedUnion2s = new SpreadRecordNonDiscriminatedUnion2sImpl(this); - this.spreadRecordNonDiscriminatedUnion3s = new SpreadRecordNonDiscriminatedUnion3sImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadFloatsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadFloatsImpl.java deleted file mode 100644 index 1024ee8e1c4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadFloatsImpl.java +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtendsDifferentSpreadFloats. - */ -public final class ExtendsDifferentSpreadFloatsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExtendsDifferentSpreadFloatsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of ExtendsDifferentSpreadFloatsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtendsDifferentSpreadFloatsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(ExtendsDifferentSpreadFloatsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientExtendsDifferentSpreadFloats to be used by - * the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientExtendsDifferentSpreadFloats") - public interface ExtendsDifferentSpreadFloatsService { - @Get("/type/property/additionalProperties/extendsDifferentSpreadFloat") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/extendsDifferentSpreadFloat") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsDifferentSpreadFloat") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsDifferentSpreadFloat") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     *     derivedProp: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     *     derivedProp: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     *     derivedProp: double (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     *     derivedProp: double (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelArraysImpl.java deleted file mode 100644 index 0114848d3c2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelArraysImpl.java +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtendsDifferentSpreadModelArrays. - */ -public final class ExtendsDifferentSpreadModelArraysImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExtendsDifferentSpreadModelArraysService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of ExtendsDifferentSpreadModelArraysImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtendsDifferentSpreadModelArraysImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(ExtendsDifferentSpreadModelArraysService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientExtendsDifferentSpreadModelArrays to be - * used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientExtendsDifferentSpreadModelArrays") - public interface ExtendsDifferentSpreadModelArraysService { - @Get("/type/property/additionalProperties/extendsDifferentSpreadModelArray") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/extendsDifferentSpreadModelArray") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsDifferentSpreadModelArray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsDifferentSpreadModelArray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     *     derivedProp (Required): [
-     *         (recursive schema, see above)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     *     derivedProp (Required): [
-     *         (recursive schema, see above)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     *     derivedProp (Required): [
-     *         (recursive schema, see above)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     *     derivedProp (Required): [
-     *         (recursive schema, see above)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelsImpl.java deleted file mode 100644 index 4789cfa39c6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelsImpl.java +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtendsDifferentSpreadModels. - */ -public final class ExtendsDifferentSpreadModelsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExtendsDifferentSpreadModelsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of ExtendsDifferentSpreadModelsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtendsDifferentSpreadModelsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(ExtendsDifferentSpreadModelsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientExtendsDifferentSpreadModels to be used by - * the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientExtendsDifferentSpreadModels") - public interface ExtendsDifferentSpreadModelsService { - @Get("/type/property/additionalProperties/extendsDifferentSpreadModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/extendsDifferentSpreadModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsDifferentSpreadModel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsDifferentSpreadModel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     *     derivedProp (Required): (recursive schema, see derivedProp above)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     *     derivedProp (Required): (recursive schema, see derivedProp above)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     *     derivedProp (Required): (recursive schema, see derivedProp above)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     *     derivedProp (Required): (recursive schema, see derivedProp above)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadStringsImpl.java deleted file mode 100644 index 0ec1959ce55..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadStringsImpl.java +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtendsDifferentSpreadStrings. - */ -public final class ExtendsDifferentSpreadStringsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExtendsDifferentSpreadStringsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of ExtendsDifferentSpreadStringsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtendsDifferentSpreadStringsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(ExtendsDifferentSpreadStringsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientExtendsDifferentSpreadStrings to be used by - * the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientExtendsDifferentSpreadStrings") - public interface ExtendsDifferentSpreadStringsService { - @Get("/type/property/additionalProperties/extendsDifferentSpreadString") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/extendsDifferentSpreadString") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsDifferentSpreadString") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsDifferentSpreadString") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     *     derivedProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     *     derivedProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     *     derivedProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     *     derivedProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsFloatsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsFloatsImpl.java deleted file mode 100644 index c5a7983168f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsFloatsImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtendsFloats. - */ -public final class ExtendsFloatsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExtendsFloatsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of ExtendsFloatsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtendsFloatsImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(ExtendsFloatsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientExtendsFloats to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientExtendsFloats") - public interface ExtendsFloatsService { - @Get("/type/property/additionalProperties/extendsRecordFloat") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/extendsRecordFloat") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsRecordFloat") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsRecordFloat") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelArraysImpl.java deleted file mode 100644 index 411548a28a7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelArraysImpl.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtendsModelArrays. - */ -public final class ExtendsModelArraysImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExtendsModelArraysService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of ExtendsModelArraysImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtendsModelArraysImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(ExtendsModelArraysService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientExtendsModelArrays to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientExtendsModelArrays") - public interface ExtendsModelArraysService { - @Get("/type/property/additionalProperties/extendsRecordModelArray") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/extendsRecordModelArray") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsRecordModelArray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsRecordModelArray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelsImpl.java deleted file mode 100644 index e1ee4666c67..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelsImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtendsModels. - */ -public final class ExtendsModelsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExtendsModelsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of ExtendsModelsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtendsModelsImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(ExtendsModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientExtendsModels to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientExtendsModels") - public interface ExtendsModelsService { - @Get("/type/property/additionalProperties/extendsRecordModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/extendsRecordModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsRecordModel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsRecordModel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsStringsImpl.java deleted file mode 100644 index fd660642c33..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsStringsImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtendsStrings. - */ -public final class ExtendsStringsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExtendsStringsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of ExtendsStringsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtendsStringsImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(ExtendsStringsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientExtendsStrings to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientExtendsStrings") - public interface ExtendsStringsService { - @Get("/type/property/additionalProperties/extendsRecordString") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/extendsRecordString") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsRecordString") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsRecordString") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDerivedsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDerivedsImpl.java deleted file mode 100644 index d4216469d0d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDerivedsImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtendsUnknownDeriveds. - */ -public final class ExtendsUnknownDerivedsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExtendsUnknownDerivedsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of ExtendsUnknownDerivedsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtendsUnknownDerivedsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(ExtendsUnknownDerivedsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientExtendsUnknownDeriveds to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientExtendsUnknownDeriveds") - public interface ExtendsUnknownDerivedsService { - @Get("/type/property/additionalProperties/extendsRecordUnknownDerived") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/extendsRecordUnknownDerived") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsRecordUnknownDerived") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsRecordUnknownDerived") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDiscriminatedsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDiscriminatedsImpl.java deleted file mode 100644 index e3aa5ddeb70..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDiscriminatedsImpl.java +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtendsUnknownDiscriminateds. - */ -public final class ExtendsUnknownDiscriminatedsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExtendsUnknownDiscriminatedsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of ExtendsUnknownDiscriminatedsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtendsUnknownDiscriminatedsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(ExtendsUnknownDiscriminatedsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientExtendsUnknownDiscriminateds to be used by - * the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientExtendsUnknownDiscriminateds") - public interface ExtendsUnknownDiscriminatedsService { - @Get("/type/property/additionalProperties/extendsUnknownDiscriminated") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/extendsUnknownDiscriminated") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsUnknownDiscriminated") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsUnknownDiscriminated") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownsImpl.java deleted file mode 100644 index 9ee415d04e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownsImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtendsUnknowns. - */ -public final class ExtendsUnknownsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExtendsUnknownsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of ExtendsUnknownsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtendsUnknownsImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(ExtendsUnknownsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientExtendsUnknowns to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientExtendsUnknowns") - public interface ExtendsUnknownsService { - @Get("/type/property/additionalProperties/extendsRecordUnknown") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/extendsRecordUnknown") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsRecordUnknown") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/extendsRecordUnknown") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsFloatsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsFloatsImpl.java deleted file mode 100644 index 0871bc5dfa0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsFloatsImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in IsFloats. - */ -public final class IsFloatsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final IsFloatsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of IsFloatsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - IsFloatsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(IsFloatsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientIsFloats to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientIsFloats") - public interface IsFloatsService { - @Get("/type/property/additionalProperties/isRecordFloat") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/isRecordFloat") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isRecordFloat") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isRecordFloat") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelArraysImpl.java deleted file mode 100644 index 66061612f1f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelArraysImpl.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in IsModelArrays. - */ -public final class IsModelArraysImpl { - /** - * The proxy service used to perform REST calls. - */ - private final IsModelArraysService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of IsModelArraysImpl. - * - * @param client the instance of the service client containing this operation class. - */ - IsModelArraysImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(IsModelArraysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientIsModelArrays to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientIsModelArrays") - public interface IsModelArraysService { - @Get("/type/property/additionalProperties/isRecordModelArray") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/isRecordModelArray") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isRecordModelArray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isRecordModelArray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelsImpl.java deleted file mode 100644 index 28fa32a18b8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelsImpl.java +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in IsModels. - */ -public final class IsModelsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final IsModelsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of IsModelsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - IsModelsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(IsModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientIsModels to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientIsModels") - public interface IsModelsService { - @Get("/type/property/additionalProperties/isRecordModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/isRecordModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isRecordModel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isRecordModel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsStringsImpl.java deleted file mode 100644 index 94a84b25b90..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsStringsImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in IsStrings. - */ -public final class IsStringsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final IsStringsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of IsStringsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - IsStringsImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(IsStringsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientIsStrings to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientIsStrings") - public interface IsStringsService { - @Get("/type/property/additionalProperties/isRecordstring") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/isRecordstring") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isRecordstring") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isRecordstring") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDerivedsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDerivedsImpl.java deleted file mode 100644 index 718d5c55c9e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDerivedsImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in IsUnknownDeriveds. - */ -public final class IsUnknownDerivedsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final IsUnknownDerivedsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of IsUnknownDerivedsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - IsUnknownDerivedsImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(IsUnknownDerivedsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientIsUnknownDeriveds to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientIsUnknownDeriveds") - public interface IsUnknownDerivedsService { - @Get("/type/property/additionalProperties/isRecordUnknownDerived") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/isRecordUnknownDerived") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isRecordUnknownDerived") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isRecordUnknownDerived") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     *     index: int (Required)
-     *     age: Double (Optional)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDiscriminatedsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDiscriminatedsImpl.java deleted file mode 100644 index 2d6fcdd3ab4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDiscriminatedsImpl.java +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in IsUnknownDiscriminateds. - */ -public final class IsUnknownDiscriminatedsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final IsUnknownDiscriminatedsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of IsUnknownDiscriminatedsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - IsUnknownDiscriminatedsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(IsUnknownDiscriminatedsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientIsUnknownDiscriminateds to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientIsUnknownDiscriminateds") - public interface IsUnknownDiscriminatedsService { - @Get("/type/property/additionalProperties/isUnknownDiscriminated") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/isUnknownDiscriminated") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isUnknownDiscriminated") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isUnknownDiscriminated") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     kind: String (Required)
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownsImpl.java deleted file mode 100644 index 777b6f85b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownsImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in IsUnknowns. - */ -public final class IsUnknownsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final IsUnknownsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of IsUnknownsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - IsUnknownsImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(IsUnknownsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientIsUnknowns to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientIsUnknowns") - public interface IsUnknownsService { - @Get("/type/property/additionalProperties/isRecordUnknown") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/isRecordUnknown") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isRecordUnknown") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/isRecordUnknown") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/MultipleSpreadsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/MultipleSpreadsImpl.java deleted file mode 100644 index 2b3b38386ab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/MultipleSpreadsImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in MultipleSpreads. - */ -public final class MultipleSpreadsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MultipleSpreadsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of MultipleSpreadsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - MultipleSpreadsImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(MultipleSpreadsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientMultipleSpreads to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientMultipleSpreads") - public interface MultipleSpreadsService { - @Get("/type/property/additionalProperties/multipleSpreadRecord") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/multipleSpreadRecord") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/multipleSpreadRecord") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/multipleSpreadRecord") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentFloatsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentFloatsImpl.java deleted file mode 100644 index 6e9577eb7a4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentFloatsImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SpreadDifferentFloats. - */ -public final class SpreadDifferentFloatsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SpreadDifferentFloatsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of SpreadDifferentFloatsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SpreadDifferentFloatsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(SpreadDifferentFloatsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientSpreadDifferentFloats to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientSpreadDifferentFloats") - public interface SpreadDifferentFloatsService { - @Get("/type/property/additionalProperties/spreadDifferentRecordFloat") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/spreadDifferentRecordFloat") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadDifferentRecordFloat") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadDifferentRecordFloat") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelArraysImpl.java deleted file mode 100644 index 3c7e9f60d7b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelArraysImpl.java +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SpreadDifferentModelArrays. - */ -public final class SpreadDifferentModelArraysImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SpreadDifferentModelArraysService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of SpreadDifferentModelArraysImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SpreadDifferentModelArraysImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(SpreadDifferentModelArraysService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientSpreadDifferentModelArrays to be used by - * the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientSpreadDifferentModelArrays") - public interface SpreadDifferentModelArraysService { - @Get("/type/property/additionalProperties/spreadDifferentRecordModelArray") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/spreadDifferentRecordModelArray") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadDifferentRecordModelArray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadDifferentRecordModelArray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): [
-     *              (Required){
-     *                 state: String (Required)
-     *             }
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelsImpl.java deleted file mode 100644 index ceb56449722..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelsImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SpreadDifferentModels. - */ -public final class SpreadDifferentModelsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SpreadDifferentModelsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of SpreadDifferentModelsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SpreadDifferentModelsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(SpreadDifferentModelsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientSpreadDifferentModels to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientSpreadDifferentModels") - public interface SpreadDifferentModelsService { - @Get("/type/property/additionalProperties/spreadDifferentRecordModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/spreadDifferentRecordModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadDifferentRecordModel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadDifferentRecordModel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp: String (Required)
-     *      (Optional): {
-     *         String (Required): {
-     *             state: String (Required)
-     *         }
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentStringsImpl.java deleted file mode 100644 index b7251b0ec51..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentStringsImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SpreadDifferentStrings. - */ -public final class SpreadDifferentStringsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SpreadDifferentStringsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of SpreadDifferentStringsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SpreadDifferentStringsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(SpreadDifferentStringsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientSpreadDifferentStrings to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientSpreadDifferentStrings") - public interface SpreadDifferentStringsService { - @Get("/type/property/additionalProperties/spreadDifferentRecordString") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/spreadDifferentRecordString") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadDifferentRecordString") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadDifferentRecordString") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadFloatsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadFloatsImpl.java deleted file mode 100644 index c52678eddef..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadFloatsImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SpreadFloats. - */ -public final class SpreadFloatsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SpreadFloatsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of SpreadFloatsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SpreadFloatsImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(SpreadFloatsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientSpreadFloats to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientSpreadFloats") - public interface SpreadFloatsService { - @Get("/type/property/additionalProperties/spreadRecordFloat") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/spreadRecordFloat") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordFloat") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordFloat") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: double (Required)
-     *      (Optional): {
-     *         String: double (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelArraysImpl.java deleted file mode 100644 index db75da471d2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelArraysImpl.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SpreadModelArrays. - */ -public final class SpreadModelArraysImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SpreadModelArraysService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of SpreadModelArraysImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SpreadModelArraysImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(SpreadModelArraysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientSpreadModelArrays to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientSpreadModelArrays") - public interface SpreadModelArraysService { - @Get("/type/property/additionalProperties/spreadRecordModelArray") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/spreadRecordModelArray") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordModelArray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordModelArray") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): [
-     *          (Required){
-     *             state: String (Required)
-     *         }
-     *     ]
-     *      (Optional): {
-     *         String (Required): [
-     *             (recursive schema, see above)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelsImpl.java deleted file mode 100644 index fa05c3377ff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelsImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SpreadModels. - */ -public final class SpreadModelsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SpreadModelsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of SpreadModelsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SpreadModelsImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(SpreadModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientSpreadModels to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientSpreadModels") - public interface SpreadModelsService { - @Get("/type/property/additionalProperties/spreadRecordModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/spreadRecordModel") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordModel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordModel") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     knownProp (Required): {
-     *         state: String (Required)
-     *     }
-     *      (Optional): {
-     *         String (Required): (recursive schema, see String above)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion2sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion2sImpl.java deleted file mode 100644 index fa590c42d18..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion2sImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SpreadRecordNonDiscriminatedUnion2s. - */ -public final class SpreadRecordNonDiscriminatedUnion2sImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SpreadRecordNonDiscriminatedUnion2sService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of SpreadRecordNonDiscriminatedUnion2sImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SpreadRecordNonDiscriminatedUnion2sImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(SpreadRecordNonDiscriminatedUnion2sService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientSpreadRecordNonDiscriminatedUnion2s to be - * used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientSpreadRecordNonDiscriminatedUnion2s") - public interface SpreadRecordNonDiscriminatedUnion2sService { - @Get("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion3sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion3sImpl.java deleted file mode 100644 index 362739a651c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion3sImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SpreadRecordNonDiscriminatedUnion3s. - */ -public final class SpreadRecordNonDiscriminatedUnion3sImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SpreadRecordNonDiscriminatedUnion3sService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of SpreadRecordNonDiscriminatedUnion3sImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SpreadRecordNonDiscriminatedUnion3sImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(SpreadRecordNonDiscriminatedUnion3sService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientSpreadRecordNonDiscriminatedUnion3s to be - * used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientSpreadRecordNonDiscriminatedUnion3s") - public interface SpreadRecordNonDiscriminatedUnion3sService { - @Get("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnionsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnionsImpl.java deleted file mode 100644 index 9676bf8054f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnionsImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SpreadRecordNonDiscriminatedUnions. - */ -public final class SpreadRecordNonDiscriminatedUnionsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SpreadRecordNonDiscriminatedUnionsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of SpreadRecordNonDiscriminatedUnionsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SpreadRecordNonDiscriminatedUnionsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(SpreadRecordNonDiscriminatedUnionsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientSpreadRecordNonDiscriminatedUnions to be - * used by the proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientSpreadRecordNonDiscriminatedUnions") - public interface SpreadRecordNonDiscriminatedUnionsService { - @Get("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordUnionsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordUnionsImpl.java deleted file mode 100644 index fd7e9fe7bae..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordUnionsImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SpreadRecordUnions. - */ -public final class SpreadRecordUnionsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SpreadRecordUnionsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of SpreadRecordUnionsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SpreadRecordUnionsImpl(AdditionalPropertiesClientImpl client) { - this.service = RestProxy.create(SpreadRecordUnionsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientSpreadRecordUnions to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientSpreadRecordUnions") - public interface SpreadRecordUnionsService { - @Get("/type/property/additionalProperties/spreadRecordUnion") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/spreadRecordUnion") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordUnion") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordUnion") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     flag: boolean (Required)
-     *      (Optional): {
-     *         String: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadStringsImpl.java deleted file mode 100644 index 93fe526ff58..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadStringsImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in SpreadStrings. - */ -public final class SpreadStringsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final SpreadStringsService service; - - /** - * The service client containing this operation class. - */ - private final AdditionalPropertiesClientImpl client; - - /** - * Initializes an instance of SpreadStringsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - SpreadStringsImpl(AdditionalPropertiesClientImpl client) { - this.service - = RestProxy.create(SpreadStringsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for AdditionalPropertiesClientSpreadStrings to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "AdditionalPropertiesClientSpreadStrings") - public interface SpreadStringsService { - @Get("/type/property/additionalProperties/spreadRecordString") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/additionalProperties/spreadRecordString") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordString") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/additionalProperties/spreadRecordString") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     name: String (Required)
-     *      (Optional): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/package-info.java deleted file mode 100644 index f3d085db11e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for AdditionalProperties. - * Tests for additional properties of models. - * - */ -package type.property.additionalproperties.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatDerived.java deleted file mode 100644 index db688404ebe..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatDerived.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model extends from a model that spread Record<float32> with the different known property type. - */ -@Immutable -public final class DifferentSpreadFloatDerived extends DifferentSpreadFloatRecord { - /* - * The index property - */ - @Generated - private final double derivedProp; - - /** - * Creates an instance of DifferentSpreadFloatDerived class. - * - * @param name the name value to set. - * @param derivedProp the derivedProp value to set. - */ - @Generated - public DifferentSpreadFloatDerived(String name, double derivedProp) { - super(name); - this.derivedProp = derivedProp; - } - - /** - * Get the derivedProp property: The index property. - * - * @return the derivedProp value. - */ - @Generated - public double getDerivedProp() { - return this.derivedProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", getName()); - jsonWriter.writeDoubleField("derivedProp", this.derivedProp); - if (getAdditionalProperties() != null) { - for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DifferentSpreadFloatDerived from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DifferentSpreadFloatDerived if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DifferentSpreadFloatDerived. - */ - @Generated - public static DifferentSpreadFloatDerived fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - double derivedProp = 0.0; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("derivedProp".equals(fieldName)) { - derivedProp = reader.getDouble(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, reader.getDouble()); - } - } - DifferentSpreadFloatDerived deserializedDifferentSpreadFloatDerived - = new DifferentSpreadFloatDerived(name, derivedProp); - deserializedDifferentSpreadFloatDerived.setAdditionalProperties(additionalProperties); - - return deserializedDifferentSpreadFloatDerived; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatRecord.java deleted file mode 100644 index 402d6976998..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatRecord.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model spread Record<float32> with the different known property type. - */ -@Fluent -public class DifferentSpreadFloatRecord implements JsonSerializable { - /* - * The id property - */ - @Generated - private final String name; - - /* - * The model spread Record with the different known property type - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of DifferentSpreadFloatRecord class. - * - * @param name the name value to set. - */ - @Generated - public DifferentSpreadFloatRecord(String name) { - this.name = name; - } - - /** - * Get the name property: The id property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the additionalProperties property: The model spread Record<float32> with the different known property - * type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model spread Record<float32> with the different known property - * type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the DifferentSpreadFloatRecord object itself. - */ - @Generated - public DifferentSpreadFloatRecord setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DifferentSpreadFloatRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DifferentSpreadFloatRecord if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DifferentSpreadFloatRecord. - */ - @Generated - public static DifferentSpreadFloatRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, reader.getDouble()); - } - } - DifferentSpreadFloatRecord deserializedDifferentSpreadFloatRecord = new DifferentSpreadFloatRecord(name); - deserializedDifferentSpreadFloatRecord.additionalProperties = additionalProperties; - - return deserializedDifferentSpreadFloatRecord; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayDerived.java deleted file mode 100644 index b386a8a5bfe..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayDerived.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * The model extends from a model that spread Record<ModelForRecord[]> with the different known property type. - */ -@Immutable -public final class DifferentSpreadModelArrayDerived extends DifferentSpreadModelArrayRecord { - /* - * The index property - */ - @Generated - private final List derivedProp; - - /** - * Creates an instance of DifferentSpreadModelArrayDerived class. - * - * @param knownProp the knownProp value to set. - * @param derivedProp the derivedProp value to set. - */ - @Generated - public DifferentSpreadModelArrayDerived(String knownProp, List derivedProp) { - super(knownProp); - this.derivedProp = derivedProp; - } - - /** - * Get the derivedProp property: The index property. - * - * @return the derivedProp value. - */ - @Generated - public List getDerivedProp() { - return this.derivedProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("knownProp", getKnownProp()); - jsonWriter.writeArrayField("derivedProp", this.derivedProp, (writer, element) -> writer.writeJson(element)); - if (getAdditionalProperties() != null) { - for (Map.Entry> additionalProperty : getAdditionalProperties().entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DifferentSpreadModelArrayDerived from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DifferentSpreadModelArrayDerived if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DifferentSpreadModelArrayDerived. - */ - @Generated - public static DifferentSpreadModelArrayDerived fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String knownProp = null; - List derivedProp = null; - Map> additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("knownProp".equals(fieldName)) { - knownProp = reader.getString(); - } else if ("derivedProp".equals(fieldName)) { - derivedProp = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - List additionalPropertiesArrayItem - = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); - additionalProperties.put(fieldName, additionalPropertiesArrayItem); - } - } - DifferentSpreadModelArrayDerived deserializedDifferentSpreadModelArrayDerived - = new DifferentSpreadModelArrayDerived(knownProp, derivedProp); - deserializedDifferentSpreadModelArrayDerived.setAdditionalProperties(additionalProperties); - - return deserializedDifferentSpreadModelArrayDerived; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayRecord.java deleted file mode 100644 index 22e5c5dad02..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayRecord.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * The model spread Record<ModelForRecord[]> with the different known property type. - */ -@Fluent -public class DifferentSpreadModelArrayRecord implements JsonSerializable { - /* - * The knownProp property. - */ - @Generated - private final String knownProp; - - /* - * The model spread Record with the different known property type - */ - @Generated - private Map> additionalProperties; - - /** - * Creates an instance of DifferentSpreadModelArrayRecord class. - * - * @param knownProp the knownProp value to set. - */ - @Generated - public DifferentSpreadModelArrayRecord(String knownProp) { - this.knownProp = knownProp; - } - - /** - * Get the knownProp property: The knownProp property. - * - * @return the knownProp value. - */ - @Generated - public String getKnownProp() { - return this.knownProp; - } - - /** - * Get the additionalProperties property: The model spread Record<ModelForRecord[]> with the different known - * property type. - * - * @return the additionalProperties value. - */ - @Generated - public Map> getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model spread Record<ModelForRecord[]> with the different known - * property type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the DifferentSpreadModelArrayRecord object itself. - */ - @Generated - public DifferentSpreadModelArrayRecord - setAdditionalProperties(Map> additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("knownProp", this.knownProp); - if (additionalProperties != null) { - for (Map.Entry> additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DifferentSpreadModelArrayRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DifferentSpreadModelArrayRecord if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DifferentSpreadModelArrayRecord. - */ - @Generated - public static DifferentSpreadModelArrayRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String knownProp = null; - Map> additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("knownProp".equals(fieldName)) { - knownProp = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - List additionalPropertiesArrayItem - = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); - additionalProperties.put(fieldName, additionalPropertiesArrayItem); - } - } - DifferentSpreadModelArrayRecord deserializedDifferentSpreadModelArrayRecord - = new DifferentSpreadModelArrayRecord(knownProp); - deserializedDifferentSpreadModelArrayRecord.additionalProperties = additionalProperties; - - return deserializedDifferentSpreadModelArrayRecord; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelDerived.java deleted file mode 100644 index cd02e25f57a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelDerived.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model extends from a model that spread Record<ModelForRecord> with the different known property type. - */ -@Immutable -public final class DifferentSpreadModelDerived extends DifferentSpreadModelRecord { - /* - * The index property - */ - @Generated - private final ModelForRecord derivedProp; - - /** - * Creates an instance of DifferentSpreadModelDerived class. - * - * @param knownProp the knownProp value to set. - * @param derivedProp the derivedProp value to set. - */ - @Generated - public DifferentSpreadModelDerived(String knownProp, ModelForRecord derivedProp) { - super(knownProp); - this.derivedProp = derivedProp; - } - - /** - * Get the derivedProp property: The index property. - * - * @return the derivedProp value. - */ - @Generated - public ModelForRecord getDerivedProp() { - return this.derivedProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("knownProp", getKnownProp()); - jsonWriter.writeJsonField("derivedProp", this.derivedProp); - if (getAdditionalProperties() != null) { - for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DifferentSpreadModelDerived from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DifferentSpreadModelDerived if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DifferentSpreadModelDerived. - */ - @Generated - public static DifferentSpreadModelDerived fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String knownProp = null; - ModelForRecord derivedProp = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("knownProp".equals(fieldName)) { - knownProp = reader.getString(); - } else if ("derivedProp".equals(fieldName)) { - derivedProp = ModelForRecord.fromJson(reader); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, ModelForRecord.fromJson(reader)); - } - } - DifferentSpreadModelDerived deserializedDifferentSpreadModelDerived - = new DifferentSpreadModelDerived(knownProp, derivedProp); - deserializedDifferentSpreadModelDerived.setAdditionalProperties(additionalProperties); - - return deserializedDifferentSpreadModelDerived; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelRecord.java deleted file mode 100644 index 3eb6eaef208..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelRecord.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model spread Record<ModelForRecord> with the different known property type. - */ -@Fluent -public class DifferentSpreadModelRecord implements JsonSerializable { - /* - * The knownProp property. - */ - @Generated - private final String knownProp; - - /* - * The model spread Record with the different known property type - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of DifferentSpreadModelRecord class. - * - * @param knownProp the knownProp value to set. - */ - @Generated - public DifferentSpreadModelRecord(String knownProp) { - this.knownProp = knownProp; - } - - /** - * Get the knownProp property: The knownProp property. - * - * @return the knownProp value. - */ - @Generated - public String getKnownProp() { - return this.knownProp; - } - - /** - * Get the additionalProperties property: The model spread Record<ModelForRecord> with the different known - * property type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model spread Record<ModelForRecord> with the different known - * property type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the DifferentSpreadModelRecord object itself. - */ - @Generated - public DifferentSpreadModelRecord setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("knownProp", this.knownProp); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DifferentSpreadModelRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DifferentSpreadModelRecord if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DifferentSpreadModelRecord. - */ - @Generated - public static DifferentSpreadModelRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String knownProp = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("knownProp".equals(fieldName)) { - knownProp = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, ModelForRecord.fromJson(reader)); - } - } - DifferentSpreadModelRecord deserializedDifferentSpreadModelRecord - = new DifferentSpreadModelRecord(knownProp); - deserializedDifferentSpreadModelRecord.additionalProperties = additionalProperties; - - return deserializedDifferentSpreadModelRecord; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringDerived.java deleted file mode 100644 index da8290c4857..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringDerived.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model extends from a model that spread Record<string> with the different known property type. - */ -@Immutable -public final class DifferentSpreadStringDerived extends DifferentSpreadStringRecord { - /* - * The index property - */ - @Generated - private final String derivedProp; - - /** - * Creates an instance of DifferentSpreadStringDerived class. - * - * @param id the id value to set. - * @param derivedProp the derivedProp value to set. - */ - @Generated - public DifferentSpreadStringDerived(double id, String derivedProp) { - super(id); - this.derivedProp = derivedProp; - } - - /** - * Get the derivedProp property: The index property. - * - * @return the derivedProp value. - */ - @Generated - public String getDerivedProp() { - return this.derivedProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("id", getId()); - jsonWriter.writeStringField("derivedProp", this.derivedProp); - if (getAdditionalProperties() != null) { - for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DifferentSpreadStringDerived from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DifferentSpreadStringDerived if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DifferentSpreadStringDerived. - */ - @Generated - public static DifferentSpreadStringDerived fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - double id = 0.0; - String derivedProp = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getDouble(); - } else if ("derivedProp".equals(fieldName)) { - derivedProp = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, reader.getString()); - } - } - DifferentSpreadStringDerived deserializedDifferentSpreadStringDerived - = new DifferentSpreadStringDerived(id, derivedProp); - deserializedDifferentSpreadStringDerived.setAdditionalProperties(additionalProperties); - - return deserializedDifferentSpreadStringDerived; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringRecord.java deleted file mode 100644 index b65a6e91f4a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringRecord.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model spread Record<string> with the different known property type. - */ -@Fluent -public class DifferentSpreadStringRecord implements JsonSerializable { - /* - * The name property - */ - @Generated - private final double id; - - /* - * The model spread Record with the different known property type - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of DifferentSpreadStringRecord class. - * - * @param id the id value to set. - */ - @Generated - public DifferentSpreadStringRecord(double id) { - this.id = id; - } - - /** - * Get the id property: The name property. - * - * @return the id value. - */ - @Generated - public double getId() { - return this.id; - } - - /** - * Get the additionalProperties property: The model spread Record<string> with the different known property - * type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model spread Record<string> with the different known property - * type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the DifferentSpreadStringRecord object itself. - */ - @Generated - public DifferentSpreadStringRecord setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("id", this.id); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DifferentSpreadStringRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DifferentSpreadStringRecord if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DifferentSpreadStringRecord. - */ - @Generated - public static DifferentSpreadStringRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - double id = 0.0; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getDouble(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, reader.getString()); - } - } - DifferentSpreadStringRecord deserializedDifferentSpreadStringRecord = new DifferentSpreadStringRecord(id); - deserializedDifferentSpreadStringRecord.additionalProperties = additionalProperties; - - return deserializedDifferentSpreadStringRecord; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsFloatAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsFloatAdditionalProperties.java deleted file mode 100644 index 22d0a632e99..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsFloatAdditionalProperties.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model extends from Record<float32> type. - */ -@Fluent -public final class ExtendsFloatAdditionalProperties implements JsonSerializable { - /* - * The id property - */ - @Generated - private final double id; - - /* - * The model extends from Record type. - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of ExtendsFloatAdditionalProperties class. - * - * @param id the id value to set. - */ - @Generated - public ExtendsFloatAdditionalProperties(double id) { - this.id = id; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public double getId() { - return this.id; - } - - /** - * Get the additionalProperties property: The model extends from Record<float32> type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model extends from Record<float32> type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the ExtendsFloatAdditionalProperties object itself. - */ - @Generated - public ExtendsFloatAdditionalProperties setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("id", this.id); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExtendsFloatAdditionalProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExtendsFloatAdditionalProperties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExtendsFloatAdditionalProperties. - */ - @Generated - public static ExtendsFloatAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - double id = 0.0; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getDouble(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, reader.getDouble()); - } - } - ExtendsFloatAdditionalProperties deserializedExtendsFloatAdditionalProperties - = new ExtendsFloatAdditionalProperties(id); - deserializedExtendsFloatAdditionalProperties.additionalProperties = additionalProperties; - - return deserializedExtendsFloatAdditionalProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelAdditionalProperties.java deleted file mode 100644 index a6469c0b509..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelAdditionalProperties.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model extends from Record<ModelForRecord> type. - */ -@Fluent -public final class ExtendsModelAdditionalProperties implements JsonSerializable { - /* - * The knownProp property. - */ - @Generated - private final ModelForRecord knownProp; - - /* - * The model extends from Record type. - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of ExtendsModelAdditionalProperties class. - * - * @param knownProp the knownProp value to set. - */ - @Generated - public ExtendsModelAdditionalProperties(ModelForRecord knownProp) { - this.knownProp = knownProp; - } - - /** - * Get the knownProp property: The knownProp property. - * - * @return the knownProp value. - */ - @Generated - public ModelForRecord getKnownProp() { - return this.knownProp; - } - - /** - * Get the additionalProperties property: The model extends from Record<ModelForRecord> type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model extends from Record<ModelForRecord> type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the ExtendsModelAdditionalProperties object itself. - */ - @Generated - public ExtendsModelAdditionalProperties setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("knownProp", this.knownProp); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExtendsModelAdditionalProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExtendsModelAdditionalProperties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExtendsModelAdditionalProperties. - */ - @Generated - public static ExtendsModelAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ModelForRecord knownProp = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("knownProp".equals(fieldName)) { - knownProp = ModelForRecord.fromJson(reader); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, ModelForRecord.fromJson(reader)); - } - } - ExtendsModelAdditionalProperties deserializedExtendsModelAdditionalProperties - = new ExtendsModelAdditionalProperties(knownProp); - deserializedExtendsModelAdditionalProperties.additionalProperties = additionalProperties; - - return deserializedExtendsModelAdditionalProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelArrayAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelArrayAdditionalProperties.java deleted file mode 100644 index ca7bde7ee08..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelArrayAdditionalProperties.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * The model extends from Record<ModelForRecord[]> type. - */ -@Fluent -public final class ExtendsModelArrayAdditionalProperties - implements JsonSerializable { - /* - * The knownProp property. - */ - @Generated - private final List knownProp; - - /* - * The model extends from Record type. - */ - @Generated - private Map> additionalProperties; - - /** - * Creates an instance of ExtendsModelArrayAdditionalProperties class. - * - * @param knownProp the knownProp value to set. - */ - @Generated - public ExtendsModelArrayAdditionalProperties(List knownProp) { - this.knownProp = knownProp; - } - - /** - * Get the knownProp property: The knownProp property. - * - * @return the knownProp value. - */ - @Generated - public List getKnownProp() { - return this.knownProp; - } - - /** - * Get the additionalProperties property: The model extends from Record<ModelForRecord[]> type. - * - * @return the additionalProperties value. - */ - @Generated - public Map> getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model extends from Record<ModelForRecord[]> type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the ExtendsModelArrayAdditionalProperties object itself. - */ - @Generated - public ExtendsModelArrayAdditionalProperties - setAdditionalProperties(Map> additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("knownProp", this.knownProp, (writer, element) -> writer.writeJson(element)); - if (additionalProperties != null) { - for (Map.Entry> additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExtendsModelArrayAdditionalProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExtendsModelArrayAdditionalProperties if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExtendsModelArrayAdditionalProperties. - */ - @Generated - public static ExtendsModelArrayAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List knownProp = null; - Map> additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("knownProp".equals(fieldName)) { - knownProp = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - List additionalPropertiesArrayItem - = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); - additionalProperties.put(fieldName, additionalPropertiesArrayItem); - } - } - ExtendsModelArrayAdditionalProperties deserializedExtendsModelArrayAdditionalProperties - = new ExtendsModelArrayAdditionalProperties(knownProp); - deserializedExtendsModelArrayAdditionalProperties.additionalProperties = additionalProperties; - - return deserializedExtendsModelArrayAdditionalProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsStringAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsStringAdditionalProperties.java deleted file mode 100644 index 53cc8cf60a4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsStringAdditionalProperties.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model extends from Record<string> type. - */ -@Fluent -public final class ExtendsStringAdditionalProperties implements JsonSerializable { - /* - * The name property - */ - @Generated - private final String name; - - /* - * The model extends from Record type. - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of ExtendsStringAdditionalProperties class. - * - * @param name the name value to set. - */ - @Generated - public ExtendsStringAdditionalProperties(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the additionalProperties property: The model extends from Record<string> type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model extends from Record<string> type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the ExtendsStringAdditionalProperties object itself. - */ - @Generated - public ExtendsStringAdditionalProperties setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExtendsStringAdditionalProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExtendsStringAdditionalProperties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExtendsStringAdditionalProperties. - */ - @Generated - public static ExtendsStringAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, reader.getString()); - } - } - ExtendsStringAdditionalProperties deserializedExtendsStringAdditionalProperties - = new ExtendsStringAdditionalProperties(name); - deserializedExtendsStringAdditionalProperties.additionalProperties = additionalProperties; - - return deserializedExtendsStringAdditionalProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalProperties.java deleted file mode 100644 index 6a17af35366..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalProperties.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model extends from Record<unknown> type. - */ -@Fluent -public class ExtendsUnknownAdditionalProperties implements JsonSerializable { - /* - * The name property - */ - @Generated - private final String name; - - /* - * The model extends from Record type. - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of ExtendsUnknownAdditionalProperties class. - * - * @param name the name value to set. - */ - @Generated - public ExtendsUnknownAdditionalProperties(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the additionalProperties property: The model extends from Record<unknown> type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model extends from Record<unknown> type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the ExtendsUnknownAdditionalProperties object itself. - */ - @Generated - public ExtendsUnknownAdditionalProperties setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExtendsUnknownAdditionalProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExtendsUnknownAdditionalProperties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExtendsUnknownAdditionalProperties. - */ - @Generated - public static ExtendsUnknownAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - ExtendsUnknownAdditionalProperties deserializedExtendsUnknownAdditionalProperties - = new ExtendsUnknownAdditionalProperties(name); - deserializedExtendsUnknownAdditionalProperties.additionalProperties = additionalProperties; - - return deserializedExtendsUnknownAdditionalProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDerived.java deleted file mode 100644 index 27263c25586..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDerived.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model extends from a type that extends from Record<unknown>. - */ -@Fluent -public final class ExtendsUnknownAdditionalPropertiesDerived extends ExtendsUnknownAdditionalProperties { - /* - * The index property - */ - @Generated - private final int index; - - /* - * The age property - */ - @Generated - private Double age; - - /** - * Creates an instance of ExtendsUnknownAdditionalPropertiesDerived class. - * - * @param name the name value to set. - * @param index the index value to set. - */ - @Generated - public ExtendsUnknownAdditionalPropertiesDerived(String name, int index) { - super(name); - this.index = index; - } - - /** - * Get the index property: The index property. - * - * @return the index value. - */ - @Generated - public int getIndex() { - return this.index; - } - - /** - * Get the age property: The age property. - * - * @return the age value. - */ - @Generated - public Double getAge() { - return this.age; - } - - /** - * Set the age property: The age property. - * - * @param age the age value to set. - * @return the ExtendsUnknownAdditionalPropertiesDerived object itself. - */ - @Generated - public ExtendsUnknownAdditionalPropertiesDerived setAge(Double age) { - this.age = age; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", getName()); - jsonWriter.writeIntField("index", this.index); - jsonWriter.writeNumberField("age", this.age); - if (getAdditionalProperties() != null) { - for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExtendsUnknownAdditionalPropertiesDerived from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExtendsUnknownAdditionalPropertiesDerived if the JsonReader was pointing to an instance of - * it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExtendsUnknownAdditionalPropertiesDerived. - */ - @Generated - public static ExtendsUnknownAdditionalPropertiesDerived fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - int index = 0; - Double age = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("index".equals(fieldName)) { - index = reader.getInt(); - } else if ("age".equals(fieldName)) { - age = reader.getNullable(JsonReader::getDouble); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - ExtendsUnknownAdditionalPropertiesDerived deserializedExtendsUnknownAdditionalPropertiesDerived - = new ExtendsUnknownAdditionalPropertiesDerived(name, index); - deserializedExtendsUnknownAdditionalPropertiesDerived.age = age; - deserializedExtendsUnknownAdditionalPropertiesDerived.setAdditionalProperties(additionalProperties); - - return deserializedExtendsUnknownAdditionalPropertiesDerived; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminated.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminated.java deleted file mode 100644 index 3f41acbeb3a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminated.java +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model extends from Record<unknown> with a discriminator. - */ -@Fluent -public class ExtendsUnknownAdditionalPropertiesDiscriminated - implements JsonSerializable { - /* - * The discriminator - */ - @Generated - private String kind = "ExtendsUnknownAdditionalPropertiesDiscriminated"; - - /* - * The name property - */ - @Generated - private final String name; - - /* - * The model extends from Record with a discriminator. - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of ExtendsUnknownAdditionalPropertiesDiscriminated class. - * - * @param name the name value to set. - */ - @Generated - public ExtendsUnknownAdditionalPropertiesDiscriminated(String name) { - this.name = name; - } - - /** - * Get the kind property: The discriminator. - * - * @return the kind value. - */ - @Generated - public String getKind() { - return this.kind; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the additionalProperties property: The model extends from Record<unknown> with a discriminator. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model extends from Record<unknown> with a discriminator. - * - * @param additionalProperties the additionalProperties value to set. - * @return the ExtendsUnknownAdditionalPropertiesDiscriminated object itself. - */ - @Generated - public ExtendsUnknownAdditionalPropertiesDiscriminated - setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("kind", this.kind); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExtendsUnknownAdditionalPropertiesDiscriminated from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExtendsUnknownAdditionalPropertiesDiscriminated if the JsonReader was pointing to an - * instance of it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExtendsUnknownAdditionalPropertiesDiscriminated. - */ - @Generated - public static ExtendsUnknownAdditionalPropertiesDiscriminated fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("derived".equals(discriminatorValue)) { - return ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static ExtendsUnknownAdditionalPropertiesDiscriminated fromJsonKnownDiscriminator(JsonReader jsonReader) - throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - String kind = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - ExtendsUnknownAdditionalPropertiesDiscriminated deserializedExtendsUnknownAdditionalPropertiesDiscriminated - = new ExtendsUnknownAdditionalPropertiesDiscriminated(name); - deserializedExtendsUnknownAdditionalPropertiesDiscriminated.kind = kind; - deserializedExtendsUnknownAdditionalPropertiesDiscriminated.additionalProperties = additionalProperties; - - return deserializedExtendsUnknownAdditionalPropertiesDiscriminated; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.java deleted file mode 100644 index 01c54d6f9be..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.java +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The derived discriminated type. - */ -@Fluent -public final class ExtendsUnknownAdditionalPropertiesDiscriminatedDerived - extends ExtendsUnknownAdditionalPropertiesDiscriminated { - /* - * The discriminator - */ - @Generated - private String kind = "derived"; - - /* - * The index property - */ - @Generated - private final int index; - - /* - * The age property - */ - @Generated - private Double age; - - /** - * Creates an instance of ExtendsUnknownAdditionalPropertiesDiscriminatedDerived class. - * - * @param name the name value to set. - * @param index the index value to set. - */ - @Generated - public ExtendsUnknownAdditionalPropertiesDiscriminatedDerived(String name, int index) { - super(name); - this.index = index; - } - - /** - * Get the kind property: The discriminator. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * Get the index property: The index property. - * - * @return the index value. - */ - @Generated - public int getIndex() { - return this.index; - } - - /** - * Get the age property: The age property. - * - * @return the age value. - */ - @Generated - public Double getAge() { - return this.age; - } - - /** - * Set the age property: The age property. - * - * @param age the age value to set. - * @return the ExtendsUnknownAdditionalPropertiesDiscriminatedDerived object itself. - */ - @Generated - public ExtendsUnknownAdditionalPropertiesDiscriminatedDerived setAge(Double age) { - this.age = age; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", getName()); - jsonWriter.writeIntField("index", this.index); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeNumberField("age", this.age); - if (getAdditionalProperties() != null) { - for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExtendsUnknownAdditionalPropertiesDiscriminatedDerived from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExtendsUnknownAdditionalPropertiesDiscriminatedDerived if the JsonReader was pointing to - * an instance of it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExtendsUnknownAdditionalPropertiesDiscriminatedDerived. - */ - @Generated - public static ExtendsUnknownAdditionalPropertiesDiscriminatedDerived fromJson(JsonReader jsonReader) - throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - int index = 0; - String kind = "derived"; - Double age = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("index".equals(fieldName)) { - index = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else if ("age".equals(fieldName)) { - age = reader.getNullable(JsonReader::getDouble); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - ExtendsUnknownAdditionalPropertiesDiscriminatedDerived deserializedExtendsUnknownAdditionalPropertiesDiscriminatedDerived - = new ExtendsUnknownAdditionalPropertiesDiscriminatedDerived(name, index); - deserializedExtendsUnknownAdditionalPropertiesDiscriminatedDerived.kind = kind; - deserializedExtendsUnknownAdditionalPropertiesDiscriminatedDerived.age = age; - deserializedExtendsUnknownAdditionalPropertiesDiscriminatedDerived - .setAdditionalProperties(additionalProperties); - - return deserializedExtendsUnknownAdditionalPropertiesDiscriminatedDerived; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsFloatAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsFloatAdditionalProperties.java deleted file mode 100644 index 7a9a8a27740..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsFloatAdditionalProperties.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model is from Record<float32> type. - */ -@Fluent -public final class IsFloatAdditionalProperties implements JsonSerializable { - /* - * The id property - */ - @Generated - private final double id; - - /* - * The model is from Record type. - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of IsFloatAdditionalProperties class. - * - * @param id the id value to set. - */ - @Generated - public IsFloatAdditionalProperties(double id) { - this.id = id; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public double getId() { - return this.id; - } - - /** - * Get the additionalProperties property: The model is from Record<float32> type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model is from Record<float32> type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the IsFloatAdditionalProperties object itself. - */ - @Generated - public IsFloatAdditionalProperties setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("id", this.id); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of IsFloatAdditionalProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of IsFloatAdditionalProperties if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the IsFloatAdditionalProperties. - */ - @Generated - public static IsFloatAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - double id = 0.0; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getDouble(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, reader.getDouble()); - } - } - IsFloatAdditionalProperties deserializedIsFloatAdditionalProperties = new IsFloatAdditionalProperties(id); - deserializedIsFloatAdditionalProperties.additionalProperties = additionalProperties; - - return deserializedIsFloatAdditionalProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelAdditionalProperties.java deleted file mode 100644 index 208b2cc4785..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelAdditionalProperties.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model is from Record<ModelForRecord> type. - */ -@Fluent -public final class IsModelAdditionalProperties implements JsonSerializable { - /* - * The knownProp property. - */ - @Generated - private final ModelForRecord knownProp; - - /* - * The model is from Record type. - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of IsModelAdditionalProperties class. - * - * @param knownProp the knownProp value to set. - */ - @Generated - public IsModelAdditionalProperties(ModelForRecord knownProp) { - this.knownProp = knownProp; - } - - /** - * Get the knownProp property: The knownProp property. - * - * @return the knownProp value. - */ - @Generated - public ModelForRecord getKnownProp() { - return this.knownProp; - } - - /** - * Get the additionalProperties property: The model is from Record<ModelForRecord> type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model is from Record<ModelForRecord> type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the IsModelAdditionalProperties object itself. - */ - @Generated - public IsModelAdditionalProperties setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("knownProp", this.knownProp); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of IsModelAdditionalProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of IsModelAdditionalProperties if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the IsModelAdditionalProperties. - */ - @Generated - public static IsModelAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ModelForRecord knownProp = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("knownProp".equals(fieldName)) { - knownProp = ModelForRecord.fromJson(reader); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, ModelForRecord.fromJson(reader)); - } - } - IsModelAdditionalProperties deserializedIsModelAdditionalProperties - = new IsModelAdditionalProperties(knownProp); - deserializedIsModelAdditionalProperties.additionalProperties = additionalProperties; - - return deserializedIsModelAdditionalProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelArrayAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelArrayAdditionalProperties.java deleted file mode 100644 index f70e1b4d64e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelArrayAdditionalProperties.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * The model is from Record<ModelForRecord[]> type. - */ -@Fluent -public final class IsModelArrayAdditionalProperties implements JsonSerializable { - /* - * The knownProp property. - */ - @Generated - private final List knownProp; - - /* - * The model is from Record type. - */ - @Generated - private Map> additionalProperties; - - /** - * Creates an instance of IsModelArrayAdditionalProperties class. - * - * @param knownProp the knownProp value to set. - */ - @Generated - public IsModelArrayAdditionalProperties(List knownProp) { - this.knownProp = knownProp; - } - - /** - * Get the knownProp property: The knownProp property. - * - * @return the knownProp value. - */ - @Generated - public List getKnownProp() { - return this.knownProp; - } - - /** - * Get the additionalProperties property: The model is from Record<ModelForRecord[]> type. - * - * @return the additionalProperties value. - */ - @Generated - public Map> getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model is from Record<ModelForRecord[]> type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the IsModelArrayAdditionalProperties object itself. - */ - @Generated - public IsModelArrayAdditionalProperties - setAdditionalProperties(Map> additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("knownProp", this.knownProp, (writer, element) -> writer.writeJson(element)); - if (additionalProperties != null) { - for (Map.Entry> additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of IsModelArrayAdditionalProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of IsModelArrayAdditionalProperties if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the IsModelArrayAdditionalProperties. - */ - @Generated - public static IsModelArrayAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List knownProp = null; - Map> additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("knownProp".equals(fieldName)) { - knownProp = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - List additionalPropertiesArrayItem - = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); - additionalProperties.put(fieldName, additionalPropertiesArrayItem); - } - } - IsModelArrayAdditionalProperties deserializedIsModelArrayAdditionalProperties - = new IsModelArrayAdditionalProperties(knownProp); - deserializedIsModelArrayAdditionalProperties.additionalProperties = additionalProperties; - - return deserializedIsModelArrayAdditionalProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsStringAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsStringAdditionalProperties.java deleted file mode 100644 index b747a2bef03..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsStringAdditionalProperties.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model is from Record<string> type. - */ -@Fluent -public final class IsStringAdditionalProperties implements JsonSerializable { - /* - * The name property - */ - @Generated - private final String name; - - /* - * The model is from Record type. - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of IsStringAdditionalProperties class. - * - * @param name the name value to set. - */ - @Generated - public IsStringAdditionalProperties(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the additionalProperties property: The model is from Record<string> type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model is from Record<string> type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the IsStringAdditionalProperties object itself. - */ - @Generated - public IsStringAdditionalProperties setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of IsStringAdditionalProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of IsStringAdditionalProperties if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the IsStringAdditionalProperties. - */ - @Generated - public static IsStringAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, reader.getString()); - } - } - IsStringAdditionalProperties deserializedIsStringAdditionalProperties - = new IsStringAdditionalProperties(name); - deserializedIsStringAdditionalProperties.additionalProperties = additionalProperties; - - return deserializedIsStringAdditionalProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalProperties.java deleted file mode 100644 index 285a2250055..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalProperties.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model is from Record<unknown> type. - */ -@Fluent -public class IsUnknownAdditionalProperties implements JsonSerializable { - /* - * The name property - */ - @Generated - private final String name; - - /* - * The model is from Record type. - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of IsUnknownAdditionalProperties class. - * - * @param name the name value to set. - */ - @Generated - public IsUnknownAdditionalProperties(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the additionalProperties property: The model is from Record<unknown> type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model is from Record<unknown> type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the IsUnknownAdditionalProperties object itself. - */ - @Generated - public IsUnknownAdditionalProperties setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of IsUnknownAdditionalProperties from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of IsUnknownAdditionalProperties if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the IsUnknownAdditionalProperties. - */ - @Generated - public static IsUnknownAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - IsUnknownAdditionalProperties deserializedIsUnknownAdditionalProperties - = new IsUnknownAdditionalProperties(name); - deserializedIsUnknownAdditionalProperties.additionalProperties = additionalProperties; - - return deserializedIsUnknownAdditionalProperties; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDerived.java deleted file mode 100644 index d099bd713a6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDerived.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model extends from a type that is Record<unknown> type. - */ -@Fluent -public final class IsUnknownAdditionalPropertiesDerived extends IsUnknownAdditionalProperties { - /* - * The index property - */ - @Generated - private final int index; - - /* - * The age property - */ - @Generated - private Double age; - - /** - * Creates an instance of IsUnknownAdditionalPropertiesDerived class. - * - * @param name the name value to set. - * @param index the index value to set. - */ - @Generated - public IsUnknownAdditionalPropertiesDerived(String name, int index) { - super(name); - this.index = index; - } - - /** - * Get the index property: The index property. - * - * @return the index value. - */ - @Generated - public int getIndex() { - return this.index; - } - - /** - * Get the age property: The age property. - * - * @return the age value. - */ - @Generated - public Double getAge() { - return this.age; - } - - /** - * Set the age property: The age property. - * - * @param age the age value to set. - * @return the IsUnknownAdditionalPropertiesDerived object itself. - */ - @Generated - public IsUnknownAdditionalPropertiesDerived setAge(Double age) { - this.age = age; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", getName()); - jsonWriter.writeIntField("index", this.index); - jsonWriter.writeNumberField("age", this.age); - if (getAdditionalProperties() != null) { - for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of IsUnknownAdditionalPropertiesDerived from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of IsUnknownAdditionalPropertiesDerived if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the IsUnknownAdditionalPropertiesDerived. - */ - @Generated - public static IsUnknownAdditionalPropertiesDerived fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - int index = 0; - Double age = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("index".equals(fieldName)) { - index = reader.getInt(); - } else if ("age".equals(fieldName)) { - age = reader.getNullable(JsonReader::getDouble); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - IsUnknownAdditionalPropertiesDerived deserializedIsUnknownAdditionalPropertiesDerived - = new IsUnknownAdditionalPropertiesDerived(name, index); - deserializedIsUnknownAdditionalPropertiesDerived.age = age; - deserializedIsUnknownAdditionalPropertiesDerived.setAdditionalProperties(additionalProperties); - - return deserializedIsUnknownAdditionalPropertiesDerived; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminated.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminated.java deleted file mode 100644 index b54c0569473..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminated.java +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model is Record<unknown> with a discriminator. - */ -@Fluent -public class IsUnknownAdditionalPropertiesDiscriminated - implements JsonSerializable { - /* - * The discriminator - */ - @Generated - private String kind = "IsUnknownAdditionalPropertiesDiscriminated"; - - /* - * The name property - */ - @Generated - private final String name; - - /* - * The model is Record with a discriminator. - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of IsUnknownAdditionalPropertiesDiscriminated class. - * - * @param name the name value to set. - */ - @Generated - public IsUnknownAdditionalPropertiesDiscriminated(String name) { - this.name = name; - } - - /** - * Get the kind property: The discriminator. - * - * @return the kind value. - */ - @Generated - public String getKind() { - return this.kind; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the additionalProperties property: The model is Record<unknown> with a discriminator. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model is Record<unknown> with a discriminator. - * - * @param additionalProperties the additionalProperties value to set. - * @return the IsUnknownAdditionalPropertiesDiscriminated object itself. - */ - @Generated - public IsUnknownAdditionalPropertiesDiscriminated - setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("kind", this.kind); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of IsUnknownAdditionalPropertiesDiscriminated from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of IsUnknownAdditionalPropertiesDiscriminated if the JsonReader was pointing to an instance - * of it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the IsUnknownAdditionalPropertiesDiscriminated. - */ - @Generated - public static IsUnknownAdditionalPropertiesDiscriminated fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String discriminatorValue = null; - try (JsonReader readerToUse = reader.bufferObject()) { - readerToUse.nextToken(); // Prepare for reading - while (readerToUse.nextToken() != JsonToken.END_OBJECT) { - String fieldName = readerToUse.getFieldName(); - readerToUse.nextToken(); - if ("kind".equals(fieldName)) { - discriminatorValue = readerToUse.getString(); - break; - } else { - readerToUse.skipChildren(); - } - } - // Use the discriminator value to determine which subtype should be deserialized. - if ("derived".equals(discriminatorValue)) { - return IsUnknownAdditionalPropertiesDiscriminatedDerived.fromJson(readerToUse.reset()); - } else { - return fromJsonKnownDiscriminator(readerToUse.reset()); - } - } - }); - } - - @Generated - static IsUnknownAdditionalPropertiesDiscriminated fromJsonKnownDiscriminator(JsonReader jsonReader) - throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - String kind = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - IsUnknownAdditionalPropertiesDiscriminated deserializedIsUnknownAdditionalPropertiesDiscriminated - = new IsUnknownAdditionalPropertiesDiscriminated(name); - deserializedIsUnknownAdditionalPropertiesDiscriminated.kind = kind; - deserializedIsUnknownAdditionalPropertiesDiscriminated.additionalProperties = additionalProperties; - - return deserializedIsUnknownAdditionalPropertiesDiscriminated; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminatedDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminatedDerived.java deleted file mode 100644 index 02d2821f705..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminatedDerived.java +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The derived discriminated type. - */ -@Fluent -public final class IsUnknownAdditionalPropertiesDiscriminatedDerived - extends IsUnknownAdditionalPropertiesDiscriminated { - /* - * The discriminator - */ - @Generated - private String kind = "derived"; - - /* - * The index property - */ - @Generated - private final int index; - - /* - * The age property - */ - @Generated - private Double age; - - /** - * Creates an instance of IsUnknownAdditionalPropertiesDiscriminatedDerived class. - * - * @param name the name value to set. - * @param index the index value to set. - */ - @Generated - public IsUnknownAdditionalPropertiesDiscriminatedDerived(String name, int index) { - super(name); - this.index = index; - } - - /** - * Get the kind property: The discriminator. - * - * @return the kind value. - */ - @Generated - @Override - public String getKind() { - return this.kind; - } - - /** - * Get the index property: The index property. - * - * @return the index value. - */ - @Generated - public int getIndex() { - return this.index; - } - - /** - * Get the age property: The age property. - * - * @return the age value. - */ - @Generated - public Double getAge() { - return this.age; - } - - /** - * Set the age property: The age property. - * - * @param age the age value to set. - * @return the IsUnknownAdditionalPropertiesDiscriminatedDerived object itself. - */ - @Generated - public IsUnknownAdditionalPropertiesDiscriminatedDerived setAge(Double age) { - this.age = age; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", getName()); - jsonWriter.writeIntField("index", this.index); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeNumberField("age", this.age); - if (getAdditionalProperties() != null) { - for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of IsUnknownAdditionalPropertiesDiscriminatedDerived from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of IsUnknownAdditionalPropertiesDiscriminatedDerived if the JsonReader was pointing to an - * instance of it, or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the IsUnknownAdditionalPropertiesDiscriminatedDerived. - */ - @Generated - public static IsUnknownAdditionalPropertiesDiscriminatedDerived fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - int index = 0; - String kind = "derived"; - Double age = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else if ("index".equals(fieldName)) { - index = reader.getInt(); - } else if ("kind".equals(fieldName)) { - kind = reader.getString(); - } else if ("age".equals(fieldName)) { - age = reader.getNullable(JsonReader::getDouble); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - IsUnknownAdditionalPropertiesDiscriminatedDerived deserializedIsUnknownAdditionalPropertiesDiscriminatedDerived - = new IsUnknownAdditionalPropertiesDiscriminatedDerived(name, index); - deserializedIsUnknownAdditionalPropertiesDiscriminatedDerived.kind = kind; - deserializedIsUnknownAdditionalPropertiesDiscriminatedDerived.age = age; - deserializedIsUnknownAdditionalPropertiesDiscriminatedDerived.setAdditionalProperties(additionalProperties); - - return deserializedIsUnknownAdditionalPropertiesDiscriminatedDerived; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ModelForRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ModelForRecord.java deleted file mode 100644 index d500ade1110..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ModelForRecord.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * model for record. - */ -@Immutable -public final class ModelForRecord implements JsonSerializable { - /* - * The state property - */ - @Generated - private final String state; - - /** - * Creates an instance of ModelForRecord class. - * - * @param state the state value to set. - */ - @Generated - public ModelForRecord(String state) { - this.state = state; - } - - /** - * Get the state property: The state property. - * - * @return the state value. - */ - @Generated - public String getState() { - return this.state; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("state", this.state); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ModelForRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ModelForRecord if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ModelForRecord. - */ - @Generated - public static ModelForRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String state = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("state".equals(fieldName)) { - state = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new ModelForRecord(state); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/MultipleSpreadRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/MultipleSpreadRecord.java deleted file mode 100644 index 1346a332c2c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/MultipleSpreadRecord.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model spread Record<string> and Record<float32>. - */ -@Fluent -public final class MultipleSpreadRecord implements JsonSerializable { - /* - * The name property - */ - @Generated - private final boolean flag; - - /* - * The model spread Record and Record - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of MultipleSpreadRecord class. - * - * @param flag the flag value to set. - */ - @Generated - public MultipleSpreadRecord(boolean flag) { - this.flag = flag; - } - - /** - * Get the flag property: The name property. - * - * @return the flag value. - */ - @Generated - public boolean isFlag() { - return this.flag; - } - - /** - * Get the additionalProperties property: The model spread Record<string> and Record<float32>. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model spread Record<string> and Record<float32>. - * - * @param additionalProperties the additionalProperties value to set. - * @return the MultipleSpreadRecord object itself. - */ - @Generated - public MultipleSpreadRecord setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("flag", this.flag); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of MultipleSpreadRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of MultipleSpreadRecord if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the MultipleSpreadRecord. - */ - @Generated - public static MultipleSpreadRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - boolean flag = false; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("flag".equals(fieldName)) { - flag = reader.getBoolean(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - MultipleSpreadRecord deserializedMultipleSpreadRecord = new MultipleSpreadRecord(flag); - deserializedMultipleSpreadRecord.additionalProperties = additionalProperties; - - return deserializedMultipleSpreadRecord; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadFloatRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadFloatRecord.java deleted file mode 100644 index 07f10c20961..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadFloatRecord.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model spread Record<float32> with the same known property type. - */ -@Fluent -public final class SpreadFloatRecord implements JsonSerializable { - /* - * The id property - */ - @Generated - private final double id; - - /* - * The model spread Record with the same known property type - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of SpreadFloatRecord class. - * - * @param id the id value to set. - */ - @Generated - public SpreadFloatRecord(double id) { - this.id = id; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public double getId() { - return this.id; - } - - /** - * Get the additionalProperties property: The model spread Record<float32> with the same known property type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model spread Record<float32> with the same known property type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the SpreadFloatRecord object itself. - */ - @Generated - public SpreadFloatRecord setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("id", this.id); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadFloatRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadFloatRecord if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadFloatRecord. - */ - @Generated - public static SpreadFloatRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - double id = 0.0; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getDouble(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, reader.getDouble()); - } - } - SpreadFloatRecord deserializedSpreadFloatRecord = new SpreadFloatRecord(id); - deserializedSpreadFloatRecord.additionalProperties = additionalProperties; - - return deserializedSpreadFloatRecord; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelArrayRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelArrayRecord.java deleted file mode 100644 index eb9a43c9285..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelArrayRecord.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * The SpreadModelArrayRecord model. - */ -@Fluent -public final class SpreadModelArrayRecord implements JsonSerializable { - /* - * The knownProp property. - */ - @Generated - private final List knownProp; - - /* - * Additional properties - */ - @Generated - private Map> additionalProperties; - - /** - * Creates an instance of SpreadModelArrayRecord class. - * - * @param knownProp the knownProp value to set. - */ - @Generated - public SpreadModelArrayRecord(List knownProp) { - this.knownProp = knownProp; - } - - /** - * Get the knownProp property: The knownProp property. - * - * @return the knownProp value. - */ - @Generated - public List getKnownProp() { - return this.knownProp; - } - - /** - * Get the additionalProperties property: Additional properties. - * - * @return the additionalProperties value. - */ - @Generated - public Map> getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: Additional properties. - * - * @param additionalProperties the additionalProperties value to set. - * @return the SpreadModelArrayRecord object itself. - */ - @Generated - public SpreadModelArrayRecord setAdditionalProperties(Map> additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("knownProp", this.knownProp, (writer, element) -> writer.writeJson(element)); - if (additionalProperties != null) { - for (Map.Entry> additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadModelArrayRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadModelArrayRecord if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadModelArrayRecord. - */ - @Generated - public static SpreadModelArrayRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List knownProp = null; - Map> additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("knownProp".equals(fieldName)) { - knownProp = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - List additionalPropertiesArrayItem - = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); - additionalProperties.put(fieldName, additionalPropertiesArrayItem); - } - } - SpreadModelArrayRecord deserializedSpreadModelArrayRecord = new SpreadModelArrayRecord(knownProp); - deserializedSpreadModelArrayRecord.additionalProperties = additionalProperties; - - return deserializedSpreadModelArrayRecord; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelRecord.java deleted file mode 100644 index edeef666ca4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelRecord.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model spread Record<ModelForRecord> with the same known property type. - */ -@Fluent -public final class SpreadModelRecord implements JsonSerializable { - /* - * The knownProp property. - */ - @Generated - private final ModelForRecord knownProp; - - /* - * The model spread Record with the same known property type - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of SpreadModelRecord class. - * - * @param knownProp the knownProp value to set. - */ - @Generated - public SpreadModelRecord(ModelForRecord knownProp) { - this.knownProp = knownProp; - } - - /** - * Get the knownProp property: The knownProp property. - * - * @return the knownProp value. - */ - @Generated - public ModelForRecord getKnownProp() { - return this.knownProp; - } - - /** - * Get the additionalProperties property: The model spread Record<ModelForRecord> with the same known property - * type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model spread Record<ModelForRecord> with the same known property - * type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the SpreadModelRecord object itself. - */ - @Generated - public SpreadModelRecord setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("knownProp", this.knownProp); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadModelRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadModelRecord if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadModelRecord. - */ - @Generated - public static SpreadModelRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ModelForRecord knownProp = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("knownProp".equals(fieldName)) { - knownProp = ModelForRecord.fromJson(reader); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, ModelForRecord.fromJson(reader)); - } - } - SpreadModelRecord deserializedSpreadModelRecord = new SpreadModelRecord(knownProp); - deserializedSpreadModelRecord.additionalProperties = additionalProperties; - - return deserializedSpreadModelRecord; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion.java deleted file mode 100644 index c5439806d6f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model spread Record<WidgetData0 | WidgetData1>. - */ -@Fluent -public final class SpreadRecordForNonDiscriminatedUnion - implements JsonSerializable { - /* - * The name property - */ - @Generated - private final String name; - - /* - * The model spread Record - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of SpreadRecordForNonDiscriminatedUnion class. - * - * @param name the name value to set. - */ - @Generated - public SpreadRecordForNonDiscriminatedUnion(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the additionalProperties property: The model spread Record<WidgetData0 | WidgetData1>. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model spread Record<WidgetData0 | WidgetData1>. - * - * @param additionalProperties the additionalProperties value to set. - * @return the SpreadRecordForNonDiscriminatedUnion object itself. - */ - @Generated - public SpreadRecordForNonDiscriminatedUnion setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadRecordForNonDiscriminatedUnion from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadRecordForNonDiscriminatedUnion if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadRecordForNonDiscriminatedUnion. - */ - @Generated - public static SpreadRecordForNonDiscriminatedUnion fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - SpreadRecordForNonDiscriminatedUnion deserializedSpreadRecordForNonDiscriminatedUnion - = new SpreadRecordForNonDiscriminatedUnion(name); - deserializedSpreadRecordForNonDiscriminatedUnion.additionalProperties = additionalProperties; - - return deserializedSpreadRecordForNonDiscriminatedUnion; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion2.java deleted file mode 100644 index b9514e5682d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion2.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model spread Record<WidgetData2 | WidgetData1>. - */ -@Fluent -public final class SpreadRecordForNonDiscriminatedUnion2 - implements JsonSerializable { - /* - * The name property - */ - @Generated - private final String name; - - /* - * The model spread Record - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of SpreadRecordForNonDiscriminatedUnion2 class. - * - * @param name the name value to set. - */ - @Generated - public SpreadRecordForNonDiscriminatedUnion2(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the additionalProperties property: The model spread Record<WidgetData2 | WidgetData1>. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model spread Record<WidgetData2 | WidgetData1>. - * - * @param additionalProperties the additionalProperties value to set. - * @return the SpreadRecordForNonDiscriminatedUnion2 object itself. - */ - @Generated - public SpreadRecordForNonDiscriminatedUnion2 setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadRecordForNonDiscriminatedUnion2 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadRecordForNonDiscriminatedUnion2 if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadRecordForNonDiscriminatedUnion2. - */ - @Generated - public static SpreadRecordForNonDiscriminatedUnion2 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - SpreadRecordForNonDiscriminatedUnion2 deserializedSpreadRecordForNonDiscriminatedUnion2 - = new SpreadRecordForNonDiscriminatedUnion2(name); - deserializedSpreadRecordForNonDiscriminatedUnion2.additionalProperties = additionalProperties; - - return deserializedSpreadRecordForNonDiscriminatedUnion2; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion3.java deleted file mode 100644 index 2e67d697252..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion3.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model spread Record<WidgetData2[] | WidgetData1>. - */ -@Fluent -public final class SpreadRecordForNonDiscriminatedUnion3 - implements JsonSerializable { - /* - * The name property - */ - @Generated - private final String name; - - /* - * The model spread Record - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of SpreadRecordForNonDiscriminatedUnion3 class. - * - * @param name the name value to set. - */ - @Generated - public SpreadRecordForNonDiscriminatedUnion3(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the additionalProperties property: The model spread Record<WidgetData2[] | WidgetData1>. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model spread Record<WidgetData2[] | WidgetData1>. - * - * @param additionalProperties the additionalProperties value to set. - * @return the SpreadRecordForNonDiscriminatedUnion3 object itself. - */ - @Generated - public SpreadRecordForNonDiscriminatedUnion3 setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadRecordForNonDiscriminatedUnion3 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadRecordForNonDiscriminatedUnion3 if the JsonReader was pointing to an instance of it, - * or null if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadRecordForNonDiscriminatedUnion3. - */ - @Generated - public static SpreadRecordForNonDiscriminatedUnion3 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - SpreadRecordForNonDiscriminatedUnion3 deserializedSpreadRecordForNonDiscriminatedUnion3 - = new SpreadRecordForNonDiscriminatedUnion3(name); - deserializedSpreadRecordForNonDiscriminatedUnion3.additionalProperties = additionalProperties; - - return deserializedSpreadRecordForNonDiscriminatedUnion3; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForUnion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForUnion.java deleted file mode 100644 index cc153342dc4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForUnion.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model spread Record<string | float32>. - */ -@Fluent -public final class SpreadRecordForUnion implements JsonSerializable { - /* - * The name property - */ - @Generated - private final boolean flag; - - /* - * The model spread Record - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of SpreadRecordForUnion class. - * - * @param flag the flag value to set. - */ - @Generated - public SpreadRecordForUnion(boolean flag) { - this.flag = flag; - } - - /** - * Get the flag property: The name property. - * - * @return the flag value. - */ - @Generated - public boolean isFlag() { - return this.flag; - } - - /** - * Get the additionalProperties property: The model spread Record<string | float32>. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model spread Record<string | float32>. - * - * @param additionalProperties the additionalProperties value to set. - * @return the SpreadRecordForUnion object itself. - */ - @Generated - public SpreadRecordForUnion setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("flag", this.flag); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeFieldName(additionalProperty.getKey()); - if (additionalProperty.getValue() == null) { - jsonWriter.writeNull(); - } else { - additionalProperty.getValue().writeTo(jsonWriter); - } - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadRecordForUnion from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadRecordForUnion if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadRecordForUnion. - */ - @Generated - public static SpreadRecordForUnion fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - boolean flag = false; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("flag".equals(fieldName)) { - flag = reader.getBoolean(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, - reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } - } - SpreadRecordForUnion deserializedSpreadRecordForUnion = new SpreadRecordForUnion(flag); - deserializedSpreadRecordForUnion.additionalProperties = additionalProperties; - - return deserializedSpreadRecordForUnion; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadStringRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadStringRecord.java deleted file mode 100644 index c2b6fa9ab51..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadStringRecord.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * The model spread Record<string> with the same known property type. - */ -@Fluent -public final class SpreadStringRecord implements JsonSerializable { - /* - * The name property - */ - @Generated - private final String name; - - /* - * The model spread Record with the same known property type - */ - @Generated - private Map additionalProperties; - - /** - * Creates an instance of SpreadStringRecord class. - * - * @param name the name value to set. - */ - @Generated - public SpreadStringRecord(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * Get the additionalProperties property: The model spread Record<string> with the same known property type. - * - * @return the additionalProperties value. - */ - @Generated - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: The model spread Record<string> with the same known property type. - * - * @param additionalProperties the additionalProperties value to set. - * @return the SpreadStringRecord object itself. - */ - @Generated - public SpreadStringRecord setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - if (additionalProperties != null) { - for (Map.Entry additionalProperty : additionalProperties.entrySet()) { - jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SpreadStringRecord from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SpreadStringRecord if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SpreadStringRecord. - */ - @Generated - public static SpreadStringRecord fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - Map additionalProperties = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - if (additionalProperties == null) { - additionalProperties = new LinkedHashMap<>(); - } - - additionalProperties.put(fieldName, reader.getString()); - } - } - SpreadStringRecord deserializedSpreadStringRecord = new SpreadStringRecord(name); - deserializedSpreadStringRecord.additionalProperties = additionalProperties; - - return deserializedSpreadStringRecord; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData0.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData0.java deleted file mode 100644 index d2db366fa2c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData0.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The WidgetData0 model. - */ -@Immutable -public final class WidgetData0 implements JsonSerializable { - /* - * The kind property. - */ - @Generated - private final String kind = "kind0"; - - /* - * The fooProp property. - */ - @Generated - private final String fooProp; - - /** - * Creates an instance of WidgetData0 class. - * - * @param fooProp the fooProp value to set. - */ - @Generated - public WidgetData0(String fooProp) { - this.fooProp = fooProp; - } - - /** - * Get the kind property: The kind property. - * - * @return the kind value. - */ - @Generated - public String getKind() { - return this.kind; - } - - /** - * Get the fooProp property: The fooProp property. - * - * @return the fooProp value. - */ - @Generated - public String getFooProp() { - return this.fooProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeStringField("fooProp", this.fooProp); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of WidgetData0 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of WidgetData0 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the WidgetData0. - */ - @Generated - public static WidgetData0 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String fooProp = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("fooProp".equals(fieldName)) { - fooProp = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new WidgetData0(fooProp); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData1.java deleted file mode 100644 index 10c5a5d2987..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData1.java +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; - -/** - * The WidgetData1 model. - */ -@Fluent -public final class WidgetData1 implements JsonSerializable { - /* - * The kind property. - */ - @Generated - private final String kind = "kind1"; - - /* - * The start property. - */ - @Generated - private final OffsetDateTime start; - - /* - * The end property. - */ - @Generated - private OffsetDateTime end; - - /** - * Creates an instance of WidgetData1 class. - * - * @param start the start value to set. - */ - @Generated - public WidgetData1(OffsetDateTime start) { - this.start = start; - } - - /** - * Get the kind property: The kind property. - * - * @return the kind value. - */ - @Generated - public String getKind() { - return this.kind; - } - - /** - * Get the start property: The start property. - * - * @return the start value. - */ - @Generated - public OffsetDateTime getStart() { - return this.start; - } - - /** - * Get the end property: The end property. - * - * @return the end value. - */ - @Generated - public OffsetDateTime getEnd() { - return this.end; - } - - /** - * Set the end property: The end property. - * - * @param end the end value to set. - * @return the WidgetData1 object itself. - */ - @Generated - public WidgetData1 setEnd(OffsetDateTime end) { - this.end = end; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeStringField("start", - this.start == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.start)); - jsonWriter.writeStringField("end", - this.end == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.end)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of WidgetData1 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of WidgetData1 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the WidgetData1. - */ - @Generated - public static WidgetData1 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OffsetDateTime start = null; - OffsetDateTime end = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("start".equals(fieldName)) { - start = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else if ("end".equals(fieldName)) { - end = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - WidgetData1 deserializedWidgetData1 = new WidgetData1(start); - deserializedWidgetData1.end = end; - - return deserializedWidgetData1; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData2.java deleted file mode 100644 index a102dd2134d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData2.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The WidgetData2 model. - */ -@Immutable -public final class WidgetData2 implements JsonSerializable { - /* - * The kind property. - */ - @Generated - private final String kind = "kind1"; - - /* - * The start property. - */ - @Generated - private final String start; - - /** - * Creates an instance of WidgetData2 class. - * - * @param start the start value to set. - */ - @Generated - public WidgetData2(String start) { - this.start = start; - } - - /** - * Get the kind property: The kind property. - * - * @return the kind value. - */ - @Generated - public String getKind() { - return this.kind; - } - - /** - * Get the start property: The start property. - * - * @return the start value. - */ - @Generated - public String getStart() { - return this.start; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("kind", this.kind); - jsonWriter.writeStringField("start", this.start); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of WidgetData2 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of WidgetData2 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the WidgetData2. - */ - @Generated - public static WidgetData2 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String start = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("start".equals(fieldName)) { - start = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new WidgetData2(start); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/package-info.java deleted file mode 100644 index f4204521cda..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for AdditionalProperties. - * Tests for additional properties of models. - * - */ -package type.property.additionalproperties.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/package-info.java deleted file mode 100644 index 8f44f96583d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for AdditionalProperties. - * Tests for additional properties of models. - * - */ -package type.property.additionalproperties; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesAsyncClient.java deleted file mode 100644 index 043ec1b639a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesAsyncClient.java +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.nullable.implementation.BytesImpl; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.models.BytesProperty; - -/** - * Initializes a new instance of the asynchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) -public final class BytesAsyncClient { - @Generated - private final BytesImpl serviceClient; - - /** - * Initializes an instance of BytesAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BytesAsyncClient(BytesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BytesProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BytesProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNonNull(BytesProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNull(BytesProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesClient.java deleted file mode 100644 index 540f8ac0356..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesClient.java +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.nullable.implementation.BytesImpl; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.models.BytesProperty; - -/** - * Initializes a new instance of the synchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class) -public final class BytesClient { - @Generated - private final BytesImpl serviceClient; - - /** - * Initializes an instance of BytesClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BytesClient(BytesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BytesProperty getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).getValue().toObject(BytesProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BytesProperty getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).getValue().toObject(BytesProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNonNull(BytesProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNull(BytesProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteAsyncClient.java deleted file mode 100644 index 9f6393f35c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteAsyncClient.java +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.nullable.implementation.CollectionsBytesImpl; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.models.CollectionsByteProperty; - -/** - * Initializes a new instance of the asynchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) -public final class CollectionsByteAsyncClient { - @Generated - private final CollectionsBytesImpl serviceClient; - - /** - * Initializes an instance of CollectionsByteAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsByteAsyncClient(CollectionsBytesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsByteProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsByteProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNonNull(CollectionsByteProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNull(CollectionsByteProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteClient.java deleted file mode 100644 index 392d1df30e0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteClient.java +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.nullable.implementation.CollectionsBytesImpl; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.models.CollectionsByteProperty; - -/** - * Initializes a new instance of the synchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class) -public final class CollectionsByteClient { - @Generated - private final CollectionsBytesImpl serviceClient; - - /** - * Initializes an instance of CollectionsByteClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsByteClient(CollectionsBytesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsByteProperty getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).getValue().toObject(CollectionsByteProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsByteProperty getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).getValue().toObject(CollectionsByteProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNonNull(CollectionsByteProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNull(CollectionsByteProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelAsyncClient.java deleted file mode 100644 index 0e6bceae132..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelAsyncClient.java +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.nullable.implementation.CollectionsModelsImpl; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.models.CollectionsModelProperty; - -/** - * Initializes a new instance of the asynchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) -public final class CollectionsModelAsyncClient { - @Generated - private final CollectionsModelsImpl serviceClient; - - /** - * Initializes an instance of CollectionsModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsModelAsyncClient(CollectionsModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsModelProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsModelProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNonNull(CollectionsModelProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNull(CollectionsModelProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelClient.java deleted file mode 100644 index 808a736e11d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelClient.java +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.nullable.implementation.CollectionsModelsImpl; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.models.CollectionsModelProperty; - -/** - * Initializes a new instance of the synchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class) -public final class CollectionsModelClient { - @Generated - private final CollectionsModelsImpl serviceClient; - - /** - * Initializes an instance of CollectionsModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsModelClient(CollectionsModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsModelProperty getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).getValue().toObject(CollectionsModelProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsModelProperty getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).getValue().toObject(CollectionsModelProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNonNull(CollectionsModelProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNull(CollectionsModelProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringAsyncClient.java deleted file mode 100644 index af95bdb4a90..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringAsyncClient.java +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.nullable.implementation.CollectionsStringsImpl; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.models.CollectionsStringProperty; - -/** - * Initializes a new instance of the asynchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) -public final class CollectionsStringAsyncClient { - @Generated - private final CollectionsStringsImpl serviceClient; - - /** - * Initializes an instance of CollectionsStringAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsStringAsyncClient(CollectionsStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsStringProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsStringProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNonNull(CollectionsStringProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNull(CollectionsStringProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringClient.java deleted file mode 100644 index daab00ae71e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringClient.java +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.nullable.implementation.CollectionsStringsImpl; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.models.CollectionsStringProperty; - -/** - * Initializes a new instance of the synchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class) -public final class CollectionsStringClient { - @Generated - private final CollectionsStringsImpl serviceClient; - - /** - * Initializes an instance of CollectionsStringClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsStringClient(CollectionsStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsStringProperty getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).getValue().toObject(CollectionsStringProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsStringProperty getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).getValue().toObject(CollectionsStringProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNonNull(CollectionsStringProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNull(CollectionsStringProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationAsyncClient.java deleted file mode 100644 index 26df3988dc1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationAsyncClient.java +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.nullable.implementation.DatetimeOperationsImpl; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.models.DatetimeProperty; - -/** - * Initializes a new instance of the asynchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) -public final class DatetimeOperationAsyncClient { - @Generated - private final DatetimeOperationsImpl serviceClient; - - /** - * Initializes an instance of DatetimeOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DatetimeOperationAsyncClient(DatetimeOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DatetimeProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DatetimeProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNonNull(DatetimeProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNull(DatetimeProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationClient.java deleted file mode 100644 index f064e5a6503..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationClient.java +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.nullable.implementation.DatetimeOperationsImpl; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.models.DatetimeProperty; - -/** - * Initializes a new instance of the synchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class) -public final class DatetimeOperationClient { - @Generated - private final DatetimeOperationsImpl serviceClient; - - /** - * Initializes an instance of DatetimeOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DatetimeOperationClient(DatetimeOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DatetimeProperty getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).getValue().toObject(DatetimeProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DatetimeProperty getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).getValue().toObject(DatetimeProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNonNull(DatetimeProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNull(DatetimeProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationAsyncClient.java deleted file mode 100644 index 19f327eb226..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationAsyncClient.java +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.nullable.implementation.DurationOperationsImpl; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.models.DurationProperty; - -/** - * Initializes a new instance of the asynchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) -public final class DurationOperationAsyncClient { - @Generated - private final DurationOperationsImpl serviceClient; - - /** - * Initializes an instance of DurationOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DurationOperationAsyncClient(DurationOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DurationProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DurationProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNonNull(DurationProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNull(DurationProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationClient.java deleted file mode 100644 index 088771de0c5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationClient.java +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.nullable.implementation.DurationOperationsImpl; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.models.DurationProperty; - -/** - * Initializes a new instance of the synchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class) -public final class DurationOperationClient { - @Generated - private final DurationOperationsImpl serviceClient; - - /** - * Initializes an instance of DurationOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DurationOperationClient(DurationOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DurationProperty getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).getValue().toObject(DurationProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DurationProperty getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).getValue().toObject(DurationProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNonNull(DurationProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNull(DurationProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/NullableClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/NullableClientBuilder.java deleted file mode 100644 index e67c78726f9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/NullableClientBuilder.java +++ /dev/null @@ -1,422 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.property.nullable.implementation.NullableClientImpl; - -/** - * A builder for creating a new instance of the NullableClient type. - */ -@ServiceClientBuilder( - serviceClients = { - StringOperationClient.class, - BytesClient.class, - DatetimeOperationClient.class, - DurationOperationClient.class, - CollectionsByteClient.class, - CollectionsModelClient.class, - CollectionsStringClient.class, - StringOperationAsyncClient.class, - BytesAsyncClient.class, - DatetimeOperationAsyncClient.class, - DurationOperationAsyncClient.class, - CollectionsByteAsyncClient.class, - CollectionsModelAsyncClient.class, - CollectionsStringAsyncClient.class }) -public final class NullableClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("type-property-nullable.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the NullableClientBuilder. - */ - @Generated - public NullableClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NullableClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NullableClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NullableClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NullableClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NullableClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NullableClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NullableClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public NullableClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the NullableClientBuilder. - */ - @Generated - public NullableClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of NullableClientImpl with the provided parameters. - * - * @return an instance of NullableClientImpl. - */ - @Generated - private NullableClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - NullableClientImpl client - = new NullableClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of StringOperationAsyncClient class. - * - * @return an instance of StringOperationAsyncClient. - */ - @Generated - public StringOperationAsyncClient buildStringOperationAsyncClient() { - return new StringOperationAsyncClient(buildInnerClient().getStringOperations()); - } - - /** - * Builds an instance of BytesAsyncClient class. - * - * @return an instance of BytesAsyncClient. - */ - @Generated - public BytesAsyncClient buildBytesAsyncClient() { - return new BytesAsyncClient(buildInnerClient().getBytes()); - } - - /** - * Builds an instance of DatetimeOperationAsyncClient class. - * - * @return an instance of DatetimeOperationAsyncClient. - */ - @Generated - public DatetimeOperationAsyncClient buildDatetimeOperationAsyncClient() { - return new DatetimeOperationAsyncClient(buildInnerClient().getDatetimeOperations()); - } - - /** - * Builds an instance of DurationOperationAsyncClient class. - * - * @return an instance of DurationOperationAsyncClient. - */ - @Generated - public DurationOperationAsyncClient buildDurationOperationAsyncClient() { - return new DurationOperationAsyncClient(buildInnerClient().getDurationOperations()); - } - - /** - * Builds an instance of CollectionsByteAsyncClient class. - * - * @return an instance of CollectionsByteAsyncClient. - */ - @Generated - public CollectionsByteAsyncClient buildCollectionsByteAsyncClient() { - return new CollectionsByteAsyncClient(buildInnerClient().getCollectionsBytes()); - } - - /** - * Builds an instance of CollectionsModelAsyncClient class. - * - * @return an instance of CollectionsModelAsyncClient. - */ - @Generated - public CollectionsModelAsyncClient buildCollectionsModelAsyncClient() { - return new CollectionsModelAsyncClient(buildInnerClient().getCollectionsModels()); - } - - /** - * Builds an instance of CollectionsStringAsyncClient class. - * - * @return an instance of CollectionsStringAsyncClient. - */ - @Generated - public CollectionsStringAsyncClient buildCollectionsStringAsyncClient() { - return new CollectionsStringAsyncClient(buildInnerClient().getCollectionsStrings()); - } - - /** - * Builds an instance of StringOperationClient class. - * - * @return an instance of StringOperationClient. - */ - @Generated - public StringOperationClient buildStringOperationClient() { - return new StringOperationClient(buildInnerClient().getStringOperations()); - } - - /** - * Builds an instance of BytesClient class. - * - * @return an instance of BytesClient. - */ - @Generated - public BytesClient buildBytesClient() { - return new BytesClient(buildInnerClient().getBytes()); - } - - /** - * Builds an instance of DatetimeOperationClient class. - * - * @return an instance of DatetimeOperationClient. - */ - @Generated - public DatetimeOperationClient buildDatetimeOperationClient() { - return new DatetimeOperationClient(buildInnerClient().getDatetimeOperations()); - } - - /** - * Builds an instance of DurationOperationClient class. - * - * @return an instance of DurationOperationClient. - */ - @Generated - public DurationOperationClient buildDurationOperationClient() { - return new DurationOperationClient(buildInnerClient().getDurationOperations()); - } - - /** - * Builds an instance of CollectionsByteClient class. - * - * @return an instance of CollectionsByteClient. - */ - @Generated - public CollectionsByteClient buildCollectionsByteClient() { - return new CollectionsByteClient(buildInnerClient().getCollectionsBytes()); - } - - /** - * Builds an instance of CollectionsModelClient class. - * - * @return an instance of CollectionsModelClient. - */ - @Generated - public CollectionsModelClient buildCollectionsModelClient() { - return new CollectionsModelClient(buildInnerClient().getCollectionsModels()); - } - - /** - * Builds an instance of CollectionsStringClient class. - * - * @return an instance of CollectionsStringClient. - */ - @Generated - public CollectionsStringClient buildCollectionsStringClient() { - return new CollectionsStringClient(buildInnerClient().getCollectionsStrings()); - } - - private static final ClientLogger LOGGER = new ClientLogger(NullableClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationAsyncClient.java deleted file mode 100644 index e9c45612e0f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationAsyncClient.java +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.implementation.StringOperationsImpl; -import type.property.nullable.models.StringProperty; - -/** - * Initializes a new instance of the asynchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) -public final class StringOperationAsyncClient { - @Generated - private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationAsyncClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(StringProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(StringProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNonNull(StringProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono patchNull(StringProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); - return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationClient.java deleted file mode 100644 index 8b688c77cc9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationClient.java +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.nullable.implementation.JsonMergePatchHelper; -import type.property.nullable.implementation.StringOperationsImpl; -import type.property.nullable.models.StringProperty; - -/** - * Initializes a new instance of the synchronous NullableClient type. - */ -@ServiceClient(builder = NullableClientBuilder.class) -public final class StringOperationClient { - @Generated - private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNonNullWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getNullWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNonNullWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.patchNullWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public StringProperty getNonNull() { - // Generated convenience method for getNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNonNullWithResponse(requestOptions).getValue().toObject(StringProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public StringProperty getNull() { - // Generated convenience method for getNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getNullWithResponse(requestOptions).getValue().toObject(StringProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNonNull(StringProperty body) { - // Generated convenience method for patchNonNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void patchNull(StringProperty body) { - // Generated convenience method for patchNullWithResponse - RequestOptions requestOptions = new RequestOptions(); - JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); - BinaryData bodyInBinaryData = BinaryData.fromObject(body); - // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. - bodyInBinaryData.getLength(); - JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); - patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/BytesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/BytesImpl.java deleted file mode 100644 index dbf83f2c3e8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/BytesImpl.java +++ /dev/null @@ -1,355 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Patch; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Bytes. - */ -public final class BytesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BytesService service; - - /** - * The service client containing this operation class. - */ - private final NullableClientImpl client; - - /** - * Initializes an instance of BytesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BytesImpl(NullableClientImpl client) { - this.service = RestProxy.create(BytesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NullableClientBytes to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NullableClientBytes") - public interface BytesService { - @Get("/type/property/nullable/bytes/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/bytes/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/bytes/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/bytes/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/bytes/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/bytes/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/bytes/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/bytes/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: byte[] (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsBytesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsBytesImpl.java deleted file mode 100644 index 37e8866f321..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsBytesImpl.java +++ /dev/null @@ -1,372 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Patch; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in CollectionsBytes. - */ -public final class CollectionsBytesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final CollectionsBytesService service; - - /** - * The service client containing this operation class. - */ - private final NullableClientImpl client; - - /** - * Initializes an instance of CollectionsBytesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - CollectionsBytesImpl(NullableClientImpl client) { - this.service - = RestProxy.create(CollectionsBytesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NullableClientCollectionsBytes to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NullableClientCollectionsBytes") - public interface CollectionsBytesService { - @Get("/type/property/nullable/collections/bytes/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/collections/bytes/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/collections/bytes/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/collections/bytes/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/collections/bytes/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/collections/bytes/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/collections/bytes/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/collections/bytes/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         byte[] (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsModelsImpl.java deleted file mode 100644 index bcd126f3816..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsModelsImpl.java +++ /dev/null @@ -1,388 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Patch; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in CollectionsModels. - */ -public final class CollectionsModelsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final CollectionsModelsService service; - - /** - * The service client containing this operation class. - */ - private final NullableClientImpl client; - - /** - * Initializes an instance of CollectionsModelsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - CollectionsModelsImpl(NullableClientImpl client) { - this.service - = RestProxy.create(CollectionsModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NullableClientCollectionsModels to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NullableClientCollectionsModels") - public interface CollectionsModelsService { - @Get("/type/property/nullable/collections/model/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/collections/model/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/collections/model/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/collections/model/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/collections/model/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/collections/model/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/collections/model/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/collections/model/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *          (Optional, Required on create){
-     *             property: String (Optional, Required on create)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsStringsImpl.java deleted file mode 100644 index be0345333cb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsStringsImpl.java +++ /dev/null @@ -1,372 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Patch; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in CollectionsStrings. - */ -public final class CollectionsStringsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final CollectionsStringsService service; - - /** - * The service client containing this operation class. - */ - private final NullableClientImpl client; - - /** - * Initializes an instance of CollectionsStringsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - CollectionsStringsImpl(NullableClientImpl client) { - this.service = RestProxy.create(CollectionsStringsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NullableClientCollectionsStrings to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NullableClientCollectionsStrings") - public interface CollectionsStringsService { - @Get("/type/property/nullable/collections/string/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/collections/string/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/collections/string/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/collections/string/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/collections/string/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/collections/string/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/collections/string/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/collections/string/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty (Optional, Required on create): [
-     *         String (Optional, Required on create)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DatetimeOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DatetimeOperationsImpl.java deleted file mode 100644 index e678bf2a7ce..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DatetimeOperationsImpl.java +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Patch; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DatetimeOperations. - */ -public final class DatetimeOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DatetimeOperationsService service; - - /** - * The service client containing this operation class. - */ - private final NullableClientImpl client; - - /** - * Initializes an instance of DatetimeOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DatetimeOperationsImpl(NullableClientImpl client) { - this.service = RestProxy.create(DatetimeOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NullableClientDatetimeOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NullableClientDatetimeOperations") - public interface DatetimeOperationsService { - @Get("/type/property/nullable/datetime/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/datetime/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/datetime/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/datetime/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/datetime/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/datetime/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/datetime/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/datetime/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: OffsetDateTime (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DurationOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DurationOperationsImpl.java deleted file mode 100644 index 7333f65647c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DurationOperationsImpl.java +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Patch; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DurationOperations. - */ -public final class DurationOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DurationOperationsService service; - - /** - * The service client containing this operation class. - */ - private final NullableClientImpl client; - - /** - * Initializes an instance of DurationOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DurationOperationsImpl(NullableClientImpl client) { - this.service = RestProxy.create(DurationOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NullableClientDurationOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NullableClientDurationOperations") - public interface DurationOperationsService { - @Get("/type/property/nullable/duration/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/duration/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/duration/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/duration/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/duration/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/duration/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/duration/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/duration/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: Duration (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/JsonMergePatchHelper.java deleted file mode 100644 index 0d66dcff9d5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/JsonMergePatchHelper.java +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.implementation; - -import type.property.nullable.models.BytesProperty; -import type.property.nullable.models.CollectionsByteProperty; -import type.property.nullable.models.CollectionsModelProperty; -import type.property.nullable.models.CollectionsStringProperty; -import type.property.nullable.models.DatetimeProperty; -import type.property.nullable.models.DurationProperty; -import type.property.nullable.models.InnerModel; -import type.property.nullable.models.StringProperty; - -/** - * This is the Helper class to enable json merge patch serialization for a model. - */ -public class JsonMergePatchHelper { - private static StringPropertyAccessor stringPropertyAccessor; - - public interface StringPropertyAccessor { - StringProperty prepareModelForJsonMergePatch(StringProperty stringProperty, boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(StringProperty stringProperty); - } - - public static void setStringPropertyAccessor(StringPropertyAccessor accessor) { - stringPropertyAccessor = accessor; - } - - public static StringPropertyAccessor getStringPropertyAccessor() { - return stringPropertyAccessor; - } - - private static BytesPropertyAccessor bytesPropertyAccessor; - - public interface BytesPropertyAccessor { - BytesProperty prepareModelForJsonMergePatch(BytesProperty bytesProperty, boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(BytesProperty bytesProperty); - } - - public static void setBytesPropertyAccessor(BytesPropertyAccessor accessor) { - bytesPropertyAccessor = accessor; - } - - public static BytesPropertyAccessor getBytesPropertyAccessor() { - return bytesPropertyAccessor; - } - - private static DatetimePropertyAccessor datetimePropertyAccessor; - - public interface DatetimePropertyAccessor { - DatetimeProperty prepareModelForJsonMergePatch(DatetimeProperty datetimeProperty, - boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(DatetimeProperty datetimeProperty); - } - - public static void setDatetimePropertyAccessor(DatetimePropertyAccessor accessor) { - datetimePropertyAccessor = accessor; - } - - public static DatetimePropertyAccessor getDatetimePropertyAccessor() { - return datetimePropertyAccessor; - } - - private static DurationPropertyAccessor durationPropertyAccessor; - - public interface DurationPropertyAccessor { - DurationProperty prepareModelForJsonMergePatch(DurationProperty durationProperty, - boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(DurationProperty durationProperty); - } - - public static void setDurationPropertyAccessor(DurationPropertyAccessor accessor) { - durationPropertyAccessor = accessor; - } - - public static DurationPropertyAccessor getDurationPropertyAccessor() { - return durationPropertyAccessor; - } - - private static CollectionsBytePropertyAccessor collectionsBytePropertyAccessor; - - public interface CollectionsBytePropertyAccessor { - CollectionsByteProperty prepareModelForJsonMergePatch(CollectionsByteProperty collectionsByteProperty, - boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(CollectionsByteProperty collectionsByteProperty); - } - - public static void setCollectionsBytePropertyAccessor(CollectionsBytePropertyAccessor accessor) { - collectionsBytePropertyAccessor = accessor; - } - - public static CollectionsBytePropertyAccessor getCollectionsBytePropertyAccessor() { - return collectionsBytePropertyAccessor; - } - - private static CollectionsModelPropertyAccessor collectionsModelPropertyAccessor; - - public interface CollectionsModelPropertyAccessor { - CollectionsModelProperty prepareModelForJsonMergePatch(CollectionsModelProperty collectionsModelProperty, - boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(CollectionsModelProperty collectionsModelProperty); - } - - public static void setCollectionsModelPropertyAccessor(CollectionsModelPropertyAccessor accessor) { - collectionsModelPropertyAccessor = accessor; - } - - public static CollectionsModelPropertyAccessor getCollectionsModelPropertyAccessor() { - return collectionsModelPropertyAccessor; - } - - private static InnerModelAccessor innerModelAccessor; - - public interface InnerModelAccessor { - InnerModel prepareModelForJsonMergePatch(InnerModel innerModel, boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(InnerModel innerModel); - } - - public static void setInnerModelAccessor(InnerModelAccessor accessor) { - innerModelAccessor = accessor; - } - - public static InnerModelAccessor getInnerModelAccessor() { - return innerModelAccessor; - } - - private static CollectionsStringPropertyAccessor collectionsStringPropertyAccessor; - - public interface CollectionsStringPropertyAccessor { - CollectionsStringProperty prepareModelForJsonMergePatch(CollectionsStringProperty collectionsStringProperty, - boolean jsonMergePatchEnabled); - - boolean isJsonMergePatch(CollectionsStringProperty collectionsStringProperty); - } - - public static void setCollectionsStringPropertyAccessor(CollectionsStringPropertyAccessor accessor) { - collectionsStringPropertyAccessor = accessor; - } - - public static CollectionsStringPropertyAccessor getCollectionsStringPropertyAccessor() { - return collectionsStringPropertyAccessor; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/NullableClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/NullableClientImpl.java deleted file mode 100644 index 770d2eae0ae..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/NullableClientImpl.java +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 NullableClient type. - */ -public final class NullableClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 StringOperationsImpl object to access its operations. - */ - private final StringOperationsImpl stringOperations; - - /** - * Gets the StringOperationsImpl object to access its operations. - * - * @return the StringOperationsImpl object. - */ - public StringOperationsImpl getStringOperations() { - return this.stringOperations; - } - - /** - * The BytesImpl object to access its operations. - */ - private final BytesImpl bytes; - - /** - * Gets the BytesImpl object to access its operations. - * - * @return the BytesImpl object. - */ - public BytesImpl getBytes() { - return this.bytes; - } - - /** - * The DatetimeOperationsImpl object to access its operations. - */ - private final DatetimeOperationsImpl datetimeOperations; - - /** - * Gets the DatetimeOperationsImpl object to access its operations. - * - * @return the DatetimeOperationsImpl object. - */ - public DatetimeOperationsImpl getDatetimeOperations() { - return this.datetimeOperations; - } - - /** - * The DurationOperationsImpl object to access its operations. - */ - private final DurationOperationsImpl durationOperations; - - /** - * Gets the DurationOperationsImpl object to access its operations. - * - * @return the DurationOperationsImpl object. - */ - public DurationOperationsImpl getDurationOperations() { - return this.durationOperations; - } - - /** - * The CollectionsBytesImpl object to access its operations. - */ - private final CollectionsBytesImpl collectionsBytes; - - /** - * Gets the CollectionsBytesImpl object to access its operations. - * - * @return the CollectionsBytesImpl object. - */ - public CollectionsBytesImpl getCollectionsBytes() { - return this.collectionsBytes; - } - - /** - * The CollectionsModelsImpl object to access its operations. - */ - private final CollectionsModelsImpl collectionsModels; - - /** - * Gets the CollectionsModelsImpl object to access its operations. - * - * @return the CollectionsModelsImpl object. - */ - public CollectionsModelsImpl getCollectionsModels() { - return this.collectionsModels; - } - - /** - * The CollectionsStringsImpl object to access its operations. - */ - private final CollectionsStringsImpl collectionsStrings; - - /** - * Gets the CollectionsStringsImpl object to access its operations. - * - * @return the CollectionsStringsImpl object. - */ - public CollectionsStringsImpl getCollectionsStrings() { - return this.collectionsStrings; - } - - /** - * Initializes an instance of NullableClient client. - * - * @param endpoint Service host. - */ - public NullableClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NullableClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public NullableClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of NullableClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public NullableClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.stringOperations = new StringOperationsImpl(this); - this.bytes = new BytesImpl(this); - this.datetimeOperations = new DatetimeOperationsImpl(this); - this.durationOperations = new DurationOperationsImpl(this); - this.collectionsBytes = new CollectionsBytesImpl(this); - this.collectionsModels = new CollectionsModelsImpl(this); - this.collectionsStrings = new CollectionsStringsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/StringOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/StringOperationsImpl.java deleted file mode 100644 index fa572e99032..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/StringOperationsImpl.java +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Patch; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringOperations. - */ -public final class StringOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringOperationsService service; - - /** - * The service client containing this operation class. - */ - private final NullableClientImpl client; - - /** - * Initializes an instance of StringOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringOperationsImpl(NullableClientImpl client) { - this.service - = RestProxy.create(StringOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for NullableClientStringOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "NullableClientStringOperations") - public interface StringOperationsService { - @Get("/type/property/nullable/string/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/string/non-null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/string/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/nullable/string/null") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/string/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNonNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/string/non-null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNonNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/string/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> patchNull(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Patch("/type/property/nullable/string/null") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response patchNullSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNonNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getNullWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return FluxUtil.withContext( - context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     requiredProperty: String (Optional, Required on create)
-     *     nullableProperty: String (Optional, Required on create)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/merge-patch+json"; - return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/package-info.java deleted file mode 100644 index 94ff0328a3c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Nullable. - * Illustrates models with nullable properties. - * - */ -package type.property.nullable.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/BytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/BytesProperty.java deleted file mode 100644 index a76b6c52ea4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/BytesProperty.java +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import type.property.nullable.implementation.JsonMergePatchHelper; - -/** - * Template type for testing models with nullable property. Pass in the type of the property you are looking for. - */ -@Fluent -public final class BytesProperty implements JsonSerializable { - /* - * Required property - */ - @Generated - private String requiredProperty; - - /* - * Property - */ - @Generated - private byte[] nullableProperty; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setBytesPropertyAccessor(new JsonMergePatchHelper.BytesPropertyAccessor() { - @Override - public BytesProperty prepareModelForJsonMergePatch(BytesProperty model, boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(BytesProperty model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of BytesProperty class. - */ - @Generated - public BytesProperty() { - } - - /** - * Get the requiredProperty property: Required property. - * - * @return the requiredProperty value. - */ - @Generated - public String getRequiredProperty() { - return this.requiredProperty; - } - - /** - * Set the requiredProperty property: Required property. - *

Required when create the resource.

- * - * @param requiredProperty the requiredProperty value to set. - * @return the BytesProperty object itself. - */ - @Generated - public BytesProperty setRequiredProperty(String requiredProperty) { - this.requiredProperty = requiredProperty; - this.updatedProperties.add("requiredProperty"); - return this; - } - - /** - * Get the nullableProperty property: Property. - * - * @return the nullableProperty value. - */ - @Generated - public byte[] getNullableProperty() { - return CoreUtils.clone(this.nullableProperty); - } - - /** - * Set the nullableProperty property: Property. - *

Required when create the resource.

- * - * @param nullableProperty the nullableProperty value to set. - * @return the BytesProperty object itself. - */ - @Generated - public BytesProperty setNullableProperty(byte[] nullableProperty) { - this.nullableProperty = CoreUtils.clone(nullableProperty); - this.updatedProperties.add("nullableProperty"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - jsonWriter.writeBinaryField("nullableProperty", this.nullableProperty); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("requiredProperty")) { - if (this.requiredProperty == null) { - jsonWriter.writeNullField("requiredProperty"); - } else { - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - } - } - if (updatedProperties.contains("nullableProperty")) { - if (this.nullableProperty == null) { - jsonWriter.writeNullField("nullableProperty"); - } else { - jsonWriter.writeBinaryField("nullableProperty", this.nullableProperty); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BytesProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BytesProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the BytesProperty. - */ - @Generated - public static BytesProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BytesProperty deserializedBytesProperty = new BytesProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("requiredProperty".equals(fieldName)) { - deserializedBytesProperty.requiredProperty = reader.getString(); - } else if ("nullableProperty".equals(fieldName)) { - deserializedBytesProperty.nullableProperty = reader.getBinary(); - } else { - reader.skipChildren(); - } - } - - return deserializedBytesProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsByteProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsByteProperty.java deleted file mode 100644 index 7d408cf9cae..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsByteProperty.java +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import type.property.nullable.implementation.JsonMergePatchHelper; - -/** - * Model with collection bytes properties. - */ -@Fluent -public final class CollectionsByteProperty implements JsonSerializable { - /* - * Required property - */ - @Generated - private String requiredProperty; - - /* - * Property - */ - @Generated - private List nullableProperty; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper - .setCollectionsBytePropertyAccessor(new JsonMergePatchHelper.CollectionsBytePropertyAccessor() { - @Override - public CollectionsByteProperty prepareModelForJsonMergePatch(CollectionsByteProperty model, - boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(CollectionsByteProperty model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of CollectionsByteProperty class. - */ - @Generated - public CollectionsByteProperty() { - } - - /** - * Get the requiredProperty property: Required property. - * - * @return the requiredProperty value. - */ - @Generated - public String getRequiredProperty() { - return this.requiredProperty; - } - - /** - * Set the requiredProperty property: Required property. - *

Required when create the resource.

- * - * @param requiredProperty the requiredProperty value to set. - * @return the CollectionsByteProperty object itself. - */ - @Generated - public CollectionsByteProperty setRequiredProperty(String requiredProperty) { - this.requiredProperty = requiredProperty; - this.updatedProperties.add("requiredProperty"); - return this; - } - - /** - * Get the nullableProperty property: Property. - * - * @return the nullableProperty value. - */ - @Generated - public List getNullableProperty() { - return this.nullableProperty; - } - - /** - * Set the nullableProperty property: Property. - *

Required when create the resource.

- * - * @param nullableProperty the nullableProperty value to set. - * @return the CollectionsByteProperty object itself. - */ - @Generated - public CollectionsByteProperty setNullableProperty(List nullableProperty) { - this.nullableProperty = nullableProperty; - this.updatedProperties.add("nullableProperty"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - jsonWriter.writeArrayField("nullableProperty", this.nullableProperty, - (writer, element) -> writer.writeBinary(element)); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("requiredProperty")) { - if (this.requiredProperty == null) { - jsonWriter.writeNullField("requiredProperty"); - } else { - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - } - } - if (updatedProperties.contains("nullableProperty")) { - if (this.nullableProperty == null) { - jsonWriter.writeNullField("nullableProperty"); - } else { - jsonWriter.writeArrayField("nullableProperty", this.nullableProperty, - (writer, element) -> writer.writeBinary(element)); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CollectionsByteProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CollectionsByteProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the CollectionsByteProperty. - */ - @Generated - public static CollectionsByteProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CollectionsByteProperty deserializedCollectionsByteProperty = new CollectionsByteProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("requiredProperty".equals(fieldName)) { - deserializedCollectionsByteProperty.requiredProperty = reader.getString(); - } else if ("nullableProperty".equals(fieldName)) { - List nullableProperty = reader.readArray(reader1 -> reader1.getBinary()); - deserializedCollectionsByteProperty.nullableProperty = nullableProperty; - } else { - reader.skipChildren(); - } - } - - return deserializedCollectionsByteProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsModelProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsModelProperty.java deleted file mode 100644 index 20efcfe9818..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsModelProperty.java +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import type.property.nullable.implementation.JsonMergePatchHelper; - -/** - * Model with collection models properties. - */ -@Fluent -public final class CollectionsModelProperty implements JsonSerializable { - /* - * Required property - */ - @Generated - private String requiredProperty; - - /* - * Property - */ - @Generated - private List nullableProperty; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper - .setCollectionsModelPropertyAccessor(new JsonMergePatchHelper.CollectionsModelPropertyAccessor() { - @Override - public CollectionsModelProperty prepareModelForJsonMergePatch(CollectionsModelProperty model, - boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(CollectionsModelProperty model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of CollectionsModelProperty class. - */ - @Generated - public CollectionsModelProperty() { - } - - /** - * Get the requiredProperty property: Required property. - * - * @return the requiredProperty value. - */ - @Generated - public String getRequiredProperty() { - return this.requiredProperty; - } - - /** - * Set the requiredProperty property: Required property. - *

Required when create the resource.

- * - * @param requiredProperty the requiredProperty value to set. - * @return the CollectionsModelProperty object itself. - */ - @Generated - public CollectionsModelProperty setRequiredProperty(String requiredProperty) { - this.requiredProperty = requiredProperty; - this.updatedProperties.add("requiredProperty"); - return this; - } - - /** - * Get the nullableProperty property: Property. - * - * @return the nullableProperty value. - */ - @Generated - public List getNullableProperty() { - return this.nullableProperty; - } - - /** - * Set the nullableProperty property: Property. - *

Required when create the resource.

- * - * @param nullableProperty the nullableProperty value to set. - * @return the CollectionsModelProperty object itself. - */ - @Generated - public CollectionsModelProperty setNullableProperty(List nullableProperty) { - this.nullableProperty = nullableProperty; - this.updatedProperties.add("nullableProperty"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - jsonWriter.writeArrayField("nullableProperty", this.nullableProperty, - (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("requiredProperty")) { - if (this.requiredProperty == null) { - jsonWriter.writeNullField("requiredProperty"); - } else { - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - } - } - if (updatedProperties.contains("nullableProperty")) { - if (this.nullableProperty == null) { - jsonWriter.writeNullField("nullableProperty"); - } else { - jsonWriter.writeArrayField("nullableProperty", this.nullableProperty, - (writer, element) -> writer.writeJson(element)); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CollectionsModelProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CollectionsModelProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the CollectionsModelProperty. - */ - @Generated - public static CollectionsModelProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CollectionsModelProperty deserializedCollectionsModelProperty = new CollectionsModelProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("requiredProperty".equals(fieldName)) { - deserializedCollectionsModelProperty.requiredProperty = reader.getString(); - } else if ("nullableProperty".equals(fieldName)) { - List nullableProperty = reader.readArray(reader1 -> InnerModel.fromJson(reader1)); - deserializedCollectionsModelProperty.nullableProperty = nullableProperty; - } else { - reader.skipChildren(); - } - } - - return deserializedCollectionsModelProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsStringProperty.java deleted file mode 100644 index 97bbfd35a11..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsStringProperty.java +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import type.property.nullable.implementation.JsonMergePatchHelper; - -/** - * Model with collection string properties. - */ -@Fluent -public final class CollectionsStringProperty implements JsonSerializable { - /* - * Required property - */ - @Generated - private String requiredProperty; - - /* - * Property - */ - @Generated - private List nullableProperty; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper - .setCollectionsStringPropertyAccessor(new JsonMergePatchHelper.CollectionsStringPropertyAccessor() { - @Override - public CollectionsStringProperty prepareModelForJsonMergePatch(CollectionsStringProperty model, - boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(CollectionsStringProperty model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of CollectionsStringProperty class. - */ - @Generated - public CollectionsStringProperty() { - } - - /** - * Get the requiredProperty property: Required property. - * - * @return the requiredProperty value. - */ - @Generated - public String getRequiredProperty() { - return this.requiredProperty; - } - - /** - * Set the requiredProperty property: Required property. - *

Required when create the resource.

- * - * @param requiredProperty the requiredProperty value to set. - * @return the CollectionsStringProperty object itself. - */ - @Generated - public CollectionsStringProperty setRequiredProperty(String requiredProperty) { - this.requiredProperty = requiredProperty; - this.updatedProperties.add("requiredProperty"); - return this; - } - - /** - * Get the nullableProperty property: Property. - * - * @return the nullableProperty value. - */ - @Generated - public List getNullableProperty() { - return this.nullableProperty; - } - - /** - * Set the nullableProperty property: Property. - *

Required when create the resource.

- * - * @param nullableProperty the nullableProperty value to set. - * @return the CollectionsStringProperty object itself. - */ - @Generated - public CollectionsStringProperty setNullableProperty(List nullableProperty) { - this.nullableProperty = nullableProperty; - this.updatedProperties.add("nullableProperty"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - jsonWriter.writeArrayField("nullableProperty", this.nullableProperty, - (writer, element) -> writer.writeString(element)); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("requiredProperty")) { - if (this.requiredProperty == null) { - jsonWriter.writeNullField("requiredProperty"); - } else { - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - } - } - if (updatedProperties.contains("nullableProperty")) { - if (this.nullableProperty == null) { - jsonWriter.writeNullField("nullableProperty"); - } else { - jsonWriter.writeArrayField("nullableProperty", this.nullableProperty, - (writer, element) -> writer.writeString(element)); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CollectionsStringProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CollectionsStringProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the CollectionsStringProperty. - */ - @Generated - public static CollectionsStringProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CollectionsStringProperty deserializedCollectionsStringProperty = new CollectionsStringProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("requiredProperty".equals(fieldName)) { - deserializedCollectionsStringProperty.requiredProperty = reader.getString(); - } else if ("nullableProperty".equals(fieldName)) { - List nullableProperty = reader.readArray(reader1 -> reader1.getString()); - deserializedCollectionsStringProperty.nullableProperty = nullableProperty; - } else { - reader.skipChildren(); - } - } - - return deserializedCollectionsStringProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DatetimeProperty.java deleted file mode 100644 index 0dd1566310b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DatetimeProperty.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.HashSet; -import java.util.Set; -import type.property.nullable.implementation.JsonMergePatchHelper; - -/** - * Model with a datetime property. - */ -@Fluent -public final class DatetimeProperty implements JsonSerializable { - /* - * Required property - */ - @Generated - private String requiredProperty; - - /* - * Property - */ - @Generated - private OffsetDateTime nullableProperty; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setDatetimePropertyAccessor(new JsonMergePatchHelper.DatetimePropertyAccessor() { - @Override - public DatetimeProperty prepareModelForJsonMergePatch(DatetimeProperty model, - boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(DatetimeProperty model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of DatetimeProperty class. - */ - @Generated - public DatetimeProperty() { - } - - /** - * Get the requiredProperty property: Required property. - * - * @return the requiredProperty value. - */ - @Generated - public String getRequiredProperty() { - return this.requiredProperty; - } - - /** - * Set the requiredProperty property: Required property. - *

Required when create the resource.

- * - * @param requiredProperty the requiredProperty value to set. - * @return the DatetimeProperty object itself. - */ - @Generated - public DatetimeProperty setRequiredProperty(String requiredProperty) { - this.requiredProperty = requiredProperty; - this.updatedProperties.add("requiredProperty"); - return this; - } - - /** - * Get the nullableProperty property: Property. - * - * @return the nullableProperty value. - */ - @Generated - public OffsetDateTime getNullableProperty() { - return this.nullableProperty; - } - - /** - * Set the nullableProperty property: Property. - *

Required when create the resource.

- * - * @param nullableProperty the nullableProperty value to set. - * @return the DatetimeProperty object itself. - */ - @Generated - public DatetimeProperty setNullableProperty(OffsetDateTime nullableProperty) { - this.nullableProperty = nullableProperty; - this.updatedProperties.add("nullableProperty"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - jsonWriter.writeStringField("nullableProperty", - this.nullableProperty == null - ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.nullableProperty)); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("requiredProperty")) { - if (this.requiredProperty == null) { - jsonWriter.writeNullField("requiredProperty"); - } else { - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - } - } - if (updatedProperties.contains("nullableProperty")) { - if (this.nullableProperty == null) { - jsonWriter.writeNullField("nullableProperty"); - } else { - jsonWriter.writeStringField("nullableProperty", - this.nullableProperty == null - ? null - : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.nullableProperty)); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DatetimeProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DatetimeProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the DatetimeProperty. - */ - @Generated - public static DatetimeProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - DatetimeProperty deserializedDatetimeProperty = new DatetimeProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("requiredProperty".equals(fieldName)) { - deserializedDatetimeProperty.requiredProperty = reader.getString(); - } else if ("nullableProperty".equals(fieldName)) { - deserializedDatetimeProperty.nullableProperty = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - - return deserializedDatetimeProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DurationProperty.java deleted file mode 100644 index 9d47c25fa9e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DurationProperty.java +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; -import java.util.HashSet; -import java.util.Set; -import type.property.nullable.implementation.JsonMergePatchHelper; - -/** - * Model with a duration property. - */ -@Fluent -public final class DurationProperty implements JsonSerializable { - /* - * Required property - */ - @Generated - private String requiredProperty; - - /* - * Property - */ - @Generated - private Duration nullableProperty; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setDurationPropertyAccessor(new JsonMergePatchHelper.DurationPropertyAccessor() { - @Override - public DurationProperty prepareModelForJsonMergePatch(DurationProperty model, - boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(DurationProperty model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of DurationProperty class. - */ - @Generated - public DurationProperty() { - } - - /** - * Get the requiredProperty property: Required property. - * - * @return the requiredProperty value. - */ - @Generated - public String getRequiredProperty() { - return this.requiredProperty; - } - - /** - * Set the requiredProperty property: Required property. - *

Required when create the resource.

- * - * @param requiredProperty the requiredProperty value to set. - * @return the DurationProperty object itself. - */ - @Generated - public DurationProperty setRequiredProperty(String requiredProperty) { - this.requiredProperty = requiredProperty; - this.updatedProperties.add("requiredProperty"); - return this; - } - - /** - * Get the nullableProperty property: Property. - * - * @return the nullableProperty value. - */ - @Generated - public Duration getNullableProperty() { - return this.nullableProperty; - } - - /** - * Set the nullableProperty property: Property. - *

Required when create the resource.

- * - * @param nullableProperty the nullableProperty value to set. - * @return the DurationProperty object itself. - */ - @Generated - public DurationProperty setNullableProperty(Duration nullableProperty) { - this.nullableProperty = nullableProperty; - this.updatedProperties.add("nullableProperty"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - jsonWriter.writeStringField("nullableProperty", CoreUtils.durationToStringWithDays(this.nullableProperty)); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("requiredProperty")) { - if (this.requiredProperty == null) { - jsonWriter.writeNullField("requiredProperty"); - } else { - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - } - } - if (updatedProperties.contains("nullableProperty")) { - if (this.nullableProperty == null) { - jsonWriter.writeNullField("nullableProperty"); - } else { - jsonWriter.writeStringField("nullableProperty", - CoreUtils.durationToStringWithDays(this.nullableProperty)); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DurationProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the DurationProperty. - */ - @Generated - public static DurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - DurationProperty deserializedDurationProperty = new DurationProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("requiredProperty".equals(fieldName)) { - deserializedDurationProperty.requiredProperty = reader.getString(); - } else if ("nullableProperty".equals(fieldName)) { - deserializedDurationProperty.nullableProperty - = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - - return deserializedDurationProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/InnerModel.java deleted file mode 100644 index d89e9a72513..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/InnerModel.java +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import type.property.nullable.implementation.JsonMergePatchHelper; - -/** - * Inner model used in collections model property. - */ -@Fluent -public final class InnerModel implements JsonSerializable { - /* - * Inner model property - */ - @Generated - private String property; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setInnerModelAccessor(new JsonMergePatchHelper.InnerModelAccessor() { - @Override - public InnerModel prepareModelForJsonMergePatch(InnerModel model, boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(InnerModel model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of InnerModel class. - */ - @Generated - public InnerModel() { - } - - /** - * Get the property property: Inner model property. - * - * @return the property value. - */ - @Generated - public String getProperty() { - return this.property; - } - - /** - * Set the property property: Inner model property. - *

Required when create the resource.

- * - * @param property the property value to set. - * @return the InnerModel object itself. - */ - @Generated - public InnerModel setProperty(String property) { - this.property = property; - this.updatedProperties.add("property"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("property")) { - if (this.property == null) { - jsonWriter.writeNullField("property"); - } else { - jsonWriter.writeStringField("property", this.property); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InnerModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IOException If an error occurs while reading the InnerModel. - */ - @Generated - public static InnerModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - InnerModel deserializedInnerModel = new InnerModel(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedInnerModel.property = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedInnerModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/StringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/StringProperty.java deleted file mode 100644 index b7ca52c3ab9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/StringProperty.java +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import type.property.nullable.implementation.JsonMergePatchHelper; - -/** - * Template type for testing models with nullable property. Pass in the type of the property you are looking for. - */ -@Fluent -public final class StringProperty implements JsonSerializable { - /* - * Required property - */ - @Generated - private String requiredProperty; - - /* - * Property - */ - @Generated - private String nullableProperty; - - /** - * Stores updated model property, the value is property name, not serialized name. - */ - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - private boolean jsonMergePatch; - - @Generated - private void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setStringPropertyAccessor(new JsonMergePatchHelper.StringPropertyAccessor() { - @Override - public StringProperty prepareModelForJsonMergePatch(StringProperty model, boolean jsonMergePatchEnabled) { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - } - - @Override - public boolean isJsonMergePatch(StringProperty model) { - return model.jsonMergePatch; - } - }); - } - - /** - * Creates an instance of StringProperty class. - */ - @Generated - public StringProperty() { - } - - /** - * Get the requiredProperty property: Required property. - * - * @return the requiredProperty value. - */ - @Generated - public String getRequiredProperty() { - return this.requiredProperty; - } - - /** - * Set the requiredProperty property: Required property. - *

Required when create the resource.

- * - * @param requiredProperty the requiredProperty value to set. - * @return the StringProperty object itself. - */ - @Generated - public StringProperty setRequiredProperty(String requiredProperty) { - this.requiredProperty = requiredProperty; - this.updatedProperties.add("requiredProperty"); - return this; - } - - /** - * Get the nullableProperty property: Property. - * - * @return the nullableProperty value. - */ - @Generated - public String getNullableProperty() { - return this.nullableProperty; - } - - /** - * Set the nullableProperty property: Property. - *

Required when create the resource.

- * - * @param nullableProperty the nullableProperty value to set. - * @return the StringProperty object itself. - */ - @Generated - public StringProperty setNullableProperty(String nullableProperty) { - this.nullableProperty = nullableProperty; - this.updatedProperties.add("nullableProperty"); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - if (jsonMergePatch) { - return toJsonMergePatch(jsonWriter); - } else { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - jsonWriter.writeStringField("nullableProperty", this.nullableProperty); - return jsonWriter.writeEndObject(); - } - } - - @Generated - private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - if (updatedProperties.contains("requiredProperty")) { - if (this.requiredProperty == null) { - jsonWriter.writeNullField("requiredProperty"); - } else { - jsonWriter.writeStringField("requiredProperty", this.requiredProperty); - } - } - if (updatedProperties.contains("nullableProperty")) { - if (this.nullableProperty == null) { - jsonWriter.writeNullField("nullableProperty"); - } else { - jsonWriter.writeStringField("nullableProperty", this.nullableProperty); - } - } - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of StringProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of StringProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the StringProperty. - */ - @Generated - public static StringProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - StringProperty deserializedStringProperty = new StringProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("requiredProperty".equals(fieldName)) { - deserializedStringProperty.requiredProperty = reader.getString(); - } else if ("nullableProperty".equals(fieldName)) { - deserializedStringProperty.nullableProperty = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedStringProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/package-info.java deleted file mode 100644 index 0f27592438e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Nullable. - * Illustrates models with nullable properties. - * - */ -package type.property.nullable.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/package-info.java deleted file mode 100644 index 7b84d6531fb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Nullable. - * Illustrates models with nullable properties. - * - */ -package type.property.nullable; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralAsyncClient.java deleted file mode 100644 index 1e8d3825404..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.BooleanLiteralsImpl; -import type.property.optional.models.BooleanLiteralProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class BooleanLiteralAsyncClient { - @Generated - private final BooleanLiteralsImpl serviceClient; - - /** - * Initializes an instance of BooleanLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BooleanLiteralAsyncClient(BooleanLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BooleanLiteralProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BooleanLiteralProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(BooleanLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(BooleanLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralClient.java deleted file mode 100644 index 70ec7fc3d8a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.BooleanLiteralsImpl; -import type.property.optional.models.BooleanLiteralProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class BooleanLiteralClient { - @Generated - private final BooleanLiteralsImpl serviceClient; - - /** - * Initializes an instance of BooleanLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BooleanLiteralClient(BooleanLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BooleanLiteralProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(BooleanLiteralProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BooleanLiteralProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(BooleanLiteralProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(BooleanLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(BooleanLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesAsyncClient.java deleted file mode 100644 index 2a2381e8793..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.BytesImpl; -import type.property.optional.models.BytesProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class BytesAsyncClient { - @Generated - private final BytesImpl serviceClient; - - /** - * Initializes an instance of BytesAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BytesAsyncClient(BytesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BytesProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BytesProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(BytesProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(BytesProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesClient.java deleted file mode 100644 index 24300b1b4fe..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.BytesImpl; -import type.property.optional.models.BytesProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class BytesClient { - @Generated - private final BytesImpl serviceClient; - - /** - * Initializes an instance of BytesClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BytesClient(BytesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BytesProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(BytesProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BytesProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(BytesProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(BytesProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(BytesProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteAsyncClient.java deleted file mode 100644 index 16f3060cd9e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteAsyncClient.java +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.CollectionsBytesImpl; -import type.property.optional.models.CollectionsByteProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class CollectionsByteAsyncClient { - @Generated - private final CollectionsBytesImpl serviceClient; - - /** - * Initializes an instance of CollectionsByteAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsByteAsyncClient(CollectionsBytesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsByteProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsByteProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(CollectionsByteProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(CollectionsByteProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteClient.java deleted file mode 100644 index 87d5c1aee64..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.CollectionsBytesImpl; -import type.property.optional.models.CollectionsByteProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class CollectionsByteClient { - @Generated - private final CollectionsBytesImpl serviceClient; - - /** - * Initializes an instance of CollectionsByteClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsByteClient(CollectionsBytesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsByteProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(CollectionsByteProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsByteProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(CollectionsByteProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(CollectionsByteProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(CollectionsByteProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelAsyncClient.java deleted file mode 100644 index 5e187936905..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelAsyncClient.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.CollectionsModelsImpl; -import type.property.optional.models.CollectionsModelProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class CollectionsModelAsyncClient { - @Generated - private final CollectionsModelsImpl serviceClient; - - /** - * Initializes an instance of CollectionsModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsModelAsyncClient(CollectionsModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsModelProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsModelProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(CollectionsModelProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(CollectionsModelProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelClient.java deleted file mode 100644 index d08ca801914..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelClient.java +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.CollectionsModelsImpl; -import type.property.optional.models.CollectionsModelProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class CollectionsModelClient { - @Generated - private final CollectionsModelsImpl serviceClient; - - /** - * Initializes an instance of CollectionsModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsModelClient(CollectionsModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsModelProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(CollectionsModelProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsModelProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(CollectionsModelProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(CollectionsModelProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(CollectionsModelProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationAsyncClient.java deleted file mode 100644 index c72d2239d91..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.DatetimeOperationsImpl; -import type.property.optional.models.DatetimeProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class DatetimeOperationAsyncClient { - @Generated - private final DatetimeOperationsImpl serviceClient; - - /** - * Initializes an instance of DatetimeOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DatetimeOperationAsyncClient(DatetimeOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DatetimeProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DatetimeProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(DatetimeProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(DatetimeProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationClient.java deleted file mode 100644 index 2b544e8e99f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.DatetimeOperationsImpl; -import type.property.optional.models.DatetimeProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class DatetimeOperationClient { - @Generated - private final DatetimeOperationsImpl serviceClient; - - /** - * Initializes an instance of DatetimeOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DatetimeOperationClient(DatetimeOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DatetimeProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(DatetimeProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DatetimeProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(DatetimeProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(DatetimeProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(DatetimeProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationAsyncClient.java deleted file mode 100644 index 55d013f8c25..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.DurationOperationsImpl; -import type.property.optional.models.DurationProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class DurationOperationAsyncClient { - @Generated - private final DurationOperationsImpl serviceClient; - - /** - * Initializes an instance of DurationOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DurationOperationAsyncClient(DurationOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DurationProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DurationProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(DurationProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(DurationProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationClient.java deleted file mode 100644 index 5ee4babd7cd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.DurationOperationsImpl; -import type.property.optional.models.DurationProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class DurationOperationClient { - @Generated - private final DurationOperationsImpl serviceClient; - - /** - * Initializes an instance of DurationOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DurationOperationClient(DurationOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DurationProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(DurationProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DurationProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(DurationProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(DurationProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(DurationProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralAsyncClient.java deleted file mode 100644 index c0b8e52347d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.FloatLiteralsImpl; -import type.property.optional.models.FloatLiteralProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class FloatLiteralAsyncClient { - @Generated - private final FloatLiteralsImpl serviceClient; - - /** - * Initializes an instance of FloatLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FloatLiteralAsyncClient(FloatLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FloatLiteralProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FloatLiteralProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(FloatLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(FloatLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralClient.java deleted file mode 100644 index 1d02d55a114..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.FloatLiteralsImpl; -import type.property.optional.models.FloatLiteralProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class FloatLiteralClient { - @Generated - private final FloatLiteralsImpl serviceClient; - - /** - * Initializes an instance of FloatLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FloatLiteralClient(FloatLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FloatLiteralProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(FloatLiteralProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FloatLiteralProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(FloatLiteralProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(FloatLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(FloatLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralAsyncClient.java deleted file mode 100644 index 45801eba251..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.IntLiteralsImpl; -import type.property.optional.models.IntLiteralProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class IntLiteralAsyncClient { - @Generated - private final IntLiteralsImpl serviceClient; - - /** - * Initializes an instance of IntLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IntLiteralAsyncClient(IntLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(IntLiteralProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(IntLiteralProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(IntLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(IntLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralClient.java deleted file mode 100644 index e66e3279165..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.IntLiteralsImpl; -import type.property.optional.models.IntLiteralProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class IntLiteralClient { - @Generated - private final IntLiteralsImpl serviceClient; - - /** - * Initializes an instance of IntLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IntLiteralClient(IntLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public IntLiteralProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(IntLiteralProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public IntLiteralProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(IntLiteralProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(IntLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(IntLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/OptionalClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/OptionalClientBuilder.java deleted file mode 100644 index 1f162b626b6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/OptionalClientBuilder.java +++ /dev/null @@ -1,620 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.property.optional.implementation.OptionalClientImpl; - -/** - * A builder for creating a new instance of the OptionalClient type. - */ -@ServiceClientBuilder( - serviceClients = { - StringOperationClient.class, - BytesClient.class, - DatetimeOperationClient.class, - DurationOperationClient.class, - PlainDateClient.class, - PlainTimeClient.class, - CollectionsByteClient.class, - CollectionsModelClient.class, - StringLiteralClient.class, - IntLiteralClient.class, - FloatLiteralClient.class, - BooleanLiteralClient.class, - UnionStringLiteralClient.class, - UnionIntLiteralClient.class, - UnionFloatLiteralClient.class, - RequiredAndOptionalClient.class, - StringOperationAsyncClient.class, - BytesAsyncClient.class, - DatetimeOperationAsyncClient.class, - DurationOperationAsyncClient.class, - PlainDateAsyncClient.class, - PlainTimeAsyncClient.class, - CollectionsByteAsyncClient.class, - CollectionsModelAsyncClient.class, - StringLiteralAsyncClient.class, - IntLiteralAsyncClient.class, - FloatLiteralAsyncClient.class, - BooleanLiteralAsyncClient.class, - UnionStringLiteralAsyncClient.class, - UnionIntLiteralAsyncClient.class, - UnionFloatLiteralAsyncClient.class, - RequiredAndOptionalAsyncClient.class }) -public final class OptionalClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("type-property-optional.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the OptionalClientBuilder. - */ - @Generated - public OptionalClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public OptionalClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the OptionalClientBuilder. - */ - @Generated - public OptionalClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of OptionalClientImpl with the provided parameters. - * - * @return an instance of OptionalClientImpl. - */ - @Generated - private OptionalClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - OptionalClientImpl client - = new OptionalClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of StringOperationAsyncClient class. - * - * @return an instance of StringOperationAsyncClient. - */ - @Generated - public StringOperationAsyncClient buildStringOperationAsyncClient() { - return new StringOperationAsyncClient(buildInnerClient().getStringOperations()); - } - - /** - * Builds an instance of BytesAsyncClient class. - * - * @return an instance of BytesAsyncClient. - */ - @Generated - public BytesAsyncClient buildBytesAsyncClient() { - return new BytesAsyncClient(buildInnerClient().getBytes()); - } - - /** - * Builds an instance of DatetimeOperationAsyncClient class. - * - * @return an instance of DatetimeOperationAsyncClient. - */ - @Generated - public DatetimeOperationAsyncClient buildDatetimeOperationAsyncClient() { - return new DatetimeOperationAsyncClient(buildInnerClient().getDatetimeOperations()); - } - - /** - * Builds an instance of DurationOperationAsyncClient class. - * - * @return an instance of DurationOperationAsyncClient. - */ - @Generated - public DurationOperationAsyncClient buildDurationOperationAsyncClient() { - return new DurationOperationAsyncClient(buildInnerClient().getDurationOperations()); - } - - /** - * Builds an instance of PlainDateAsyncClient class. - * - * @return an instance of PlainDateAsyncClient. - */ - @Generated - public PlainDateAsyncClient buildPlainDateAsyncClient() { - return new PlainDateAsyncClient(buildInnerClient().getPlainDates()); - } - - /** - * Builds an instance of PlainTimeAsyncClient class. - * - * @return an instance of PlainTimeAsyncClient. - */ - @Generated - public PlainTimeAsyncClient buildPlainTimeAsyncClient() { - return new PlainTimeAsyncClient(buildInnerClient().getPlainTimes()); - } - - /** - * Builds an instance of CollectionsByteAsyncClient class. - * - * @return an instance of CollectionsByteAsyncClient. - */ - @Generated - public CollectionsByteAsyncClient buildCollectionsByteAsyncClient() { - return new CollectionsByteAsyncClient(buildInnerClient().getCollectionsBytes()); - } - - /** - * Builds an instance of CollectionsModelAsyncClient class. - * - * @return an instance of CollectionsModelAsyncClient. - */ - @Generated - public CollectionsModelAsyncClient buildCollectionsModelAsyncClient() { - return new CollectionsModelAsyncClient(buildInnerClient().getCollectionsModels()); - } - - /** - * Builds an instance of StringLiteralAsyncClient class. - * - * @return an instance of StringLiteralAsyncClient. - */ - @Generated - public StringLiteralAsyncClient buildStringLiteralAsyncClient() { - return new StringLiteralAsyncClient(buildInnerClient().getStringLiterals()); - } - - /** - * Builds an instance of IntLiteralAsyncClient class. - * - * @return an instance of IntLiteralAsyncClient. - */ - @Generated - public IntLiteralAsyncClient buildIntLiteralAsyncClient() { - return new IntLiteralAsyncClient(buildInnerClient().getIntLiterals()); - } - - /** - * Builds an instance of FloatLiteralAsyncClient class. - * - * @return an instance of FloatLiteralAsyncClient. - */ - @Generated - public FloatLiteralAsyncClient buildFloatLiteralAsyncClient() { - return new FloatLiteralAsyncClient(buildInnerClient().getFloatLiterals()); - } - - /** - * Builds an instance of BooleanLiteralAsyncClient class. - * - * @return an instance of BooleanLiteralAsyncClient. - */ - @Generated - public BooleanLiteralAsyncClient buildBooleanLiteralAsyncClient() { - return new BooleanLiteralAsyncClient(buildInnerClient().getBooleanLiterals()); - } - - /** - * Builds an instance of UnionStringLiteralAsyncClient class. - * - * @return an instance of UnionStringLiteralAsyncClient. - */ - @Generated - public UnionStringLiteralAsyncClient buildUnionStringLiteralAsyncClient() { - return new UnionStringLiteralAsyncClient(buildInnerClient().getUnionStringLiterals()); - } - - /** - * Builds an instance of UnionIntLiteralAsyncClient class. - * - * @return an instance of UnionIntLiteralAsyncClient. - */ - @Generated - public UnionIntLiteralAsyncClient buildUnionIntLiteralAsyncClient() { - return new UnionIntLiteralAsyncClient(buildInnerClient().getUnionIntLiterals()); - } - - /** - * Builds an instance of UnionFloatLiteralAsyncClient class. - * - * @return an instance of UnionFloatLiteralAsyncClient. - */ - @Generated - public UnionFloatLiteralAsyncClient buildUnionFloatLiteralAsyncClient() { - return new UnionFloatLiteralAsyncClient(buildInnerClient().getUnionFloatLiterals()); - } - - /** - * Builds an instance of RequiredAndOptionalAsyncClient class. - * - * @return an instance of RequiredAndOptionalAsyncClient. - */ - @Generated - public RequiredAndOptionalAsyncClient buildRequiredAndOptionalAsyncClient() { - return new RequiredAndOptionalAsyncClient(buildInnerClient().getRequiredAndOptionals()); - } - - /** - * Builds an instance of StringOperationClient class. - * - * @return an instance of StringOperationClient. - */ - @Generated - public StringOperationClient buildStringOperationClient() { - return new StringOperationClient(buildInnerClient().getStringOperations()); - } - - /** - * Builds an instance of BytesClient class. - * - * @return an instance of BytesClient. - */ - @Generated - public BytesClient buildBytesClient() { - return new BytesClient(buildInnerClient().getBytes()); - } - - /** - * Builds an instance of DatetimeOperationClient class. - * - * @return an instance of DatetimeOperationClient. - */ - @Generated - public DatetimeOperationClient buildDatetimeOperationClient() { - return new DatetimeOperationClient(buildInnerClient().getDatetimeOperations()); - } - - /** - * Builds an instance of DurationOperationClient class. - * - * @return an instance of DurationOperationClient. - */ - @Generated - public DurationOperationClient buildDurationOperationClient() { - return new DurationOperationClient(buildInnerClient().getDurationOperations()); - } - - /** - * Builds an instance of PlainDateClient class. - * - * @return an instance of PlainDateClient. - */ - @Generated - public PlainDateClient buildPlainDateClient() { - return new PlainDateClient(buildInnerClient().getPlainDates()); - } - - /** - * Builds an instance of PlainTimeClient class. - * - * @return an instance of PlainTimeClient. - */ - @Generated - public PlainTimeClient buildPlainTimeClient() { - return new PlainTimeClient(buildInnerClient().getPlainTimes()); - } - - /** - * Builds an instance of CollectionsByteClient class. - * - * @return an instance of CollectionsByteClient. - */ - @Generated - public CollectionsByteClient buildCollectionsByteClient() { - return new CollectionsByteClient(buildInnerClient().getCollectionsBytes()); - } - - /** - * Builds an instance of CollectionsModelClient class. - * - * @return an instance of CollectionsModelClient. - */ - @Generated - public CollectionsModelClient buildCollectionsModelClient() { - return new CollectionsModelClient(buildInnerClient().getCollectionsModels()); - } - - /** - * Builds an instance of StringLiteralClient class. - * - * @return an instance of StringLiteralClient. - */ - @Generated - public StringLiteralClient buildStringLiteralClient() { - return new StringLiteralClient(buildInnerClient().getStringLiterals()); - } - - /** - * Builds an instance of IntLiteralClient class. - * - * @return an instance of IntLiteralClient. - */ - @Generated - public IntLiteralClient buildIntLiteralClient() { - return new IntLiteralClient(buildInnerClient().getIntLiterals()); - } - - /** - * Builds an instance of FloatLiteralClient class. - * - * @return an instance of FloatLiteralClient. - */ - @Generated - public FloatLiteralClient buildFloatLiteralClient() { - return new FloatLiteralClient(buildInnerClient().getFloatLiterals()); - } - - /** - * Builds an instance of BooleanLiteralClient class. - * - * @return an instance of BooleanLiteralClient. - */ - @Generated - public BooleanLiteralClient buildBooleanLiteralClient() { - return new BooleanLiteralClient(buildInnerClient().getBooleanLiterals()); - } - - /** - * Builds an instance of UnionStringLiteralClient class. - * - * @return an instance of UnionStringLiteralClient. - */ - @Generated - public UnionStringLiteralClient buildUnionStringLiteralClient() { - return new UnionStringLiteralClient(buildInnerClient().getUnionStringLiterals()); - } - - /** - * Builds an instance of UnionIntLiteralClient class. - * - * @return an instance of UnionIntLiteralClient. - */ - @Generated - public UnionIntLiteralClient buildUnionIntLiteralClient() { - return new UnionIntLiteralClient(buildInnerClient().getUnionIntLiterals()); - } - - /** - * Builds an instance of UnionFloatLiteralClient class. - * - * @return an instance of UnionFloatLiteralClient. - */ - @Generated - public UnionFloatLiteralClient buildUnionFloatLiteralClient() { - return new UnionFloatLiteralClient(buildInnerClient().getUnionFloatLiterals()); - } - - /** - * Builds an instance of RequiredAndOptionalClient class. - * - * @return an instance of RequiredAndOptionalClient. - */ - @Generated - public RequiredAndOptionalClient buildRequiredAndOptionalClient() { - return new RequiredAndOptionalClient(buildInnerClient().getRequiredAndOptionals()); - } - - private static final ClientLogger LOGGER = new ClientLogger(OptionalClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateAsyncClient.java deleted file mode 100644 index 629dc5073cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.PlainDatesImpl; -import type.property.optional.models.PlainDateProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class PlainDateAsyncClient { - @Generated - private final PlainDatesImpl serviceClient; - - /** - * Initializes an instance of PlainDateAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PlainDateAsyncClient(PlainDatesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(PlainDateProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(PlainDateProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(PlainDateProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(PlainDateProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateClient.java deleted file mode 100644 index 21c61dd509b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.PlainDatesImpl; -import type.property.optional.models.PlainDateProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class PlainDateClient { - @Generated - private final PlainDatesImpl serviceClient; - - /** - * Initializes an instance of PlainDateClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PlainDateClient(PlainDatesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public PlainDateProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(PlainDateProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public PlainDateProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(PlainDateProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(PlainDateProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(PlainDateProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeAsyncClient.java deleted file mode 100644 index b60d7519821..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.PlainTimesImpl; -import type.property.optional.models.PlainTimeProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class PlainTimeAsyncClient { - @Generated - private final PlainTimesImpl serviceClient; - - /** - * Initializes an instance of PlainTimeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PlainTimeAsyncClient(PlainTimesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(PlainTimeProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(PlainTimeProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(PlainTimeProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(PlainTimeProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeClient.java deleted file mode 100644 index e4bad0562c7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.PlainTimesImpl; -import type.property.optional.models.PlainTimeProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class PlainTimeClient { - @Generated - private final PlainTimesImpl serviceClient; - - /** - * Initializes an instance of PlainTimeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PlainTimeClient(PlainTimesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public PlainTimeProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(PlainTimeProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public PlainTimeProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(PlainTimeProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(PlainTimeProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(PlainTimeProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalAsyncClient.java deleted file mode 100644 index d8588abb66e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalAsyncClient.java +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.RequiredAndOptionalsImpl; -import type.property.optional.models.RequiredAndOptionalProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class RequiredAndOptionalAsyncClient { - @Generated - private final RequiredAndOptionalsImpl serviceClient; - - /** - * Initializes an instance of RequiredAndOptionalAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RequiredAndOptionalAsyncClient(RequiredAndOptionalsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return only the required properties. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return only the required properties along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getRequiredOnlyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getRequiredOnlyWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with only required properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putRequiredOnlyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putRequiredOnlyWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(RequiredAndOptionalProperty.class)); - } - - /** - * Get models that will return only the required properties. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return only the required properties on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getRequiredOnly() { - // Generated convenience method for getRequiredOnlyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getRequiredOnlyWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(RequiredAndOptionalProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(RequiredAndOptionalProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with only required properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putRequiredOnly(RequiredAndOptionalProperty body) { - // Generated convenience method for putRequiredOnlyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putRequiredOnlyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalClient.java deleted file mode 100644 index 7bc786f1278..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalClient.java +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.RequiredAndOptionalsImpl; -import type.property.optional.models.RequiredAndOptionalProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class RequiredAndOptionalClient { - @Generated - private final RequiredAndOptionalsImpl serviceClient; - - /** - * Initializes an instance of RequiredAndOptionalClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RequiredAndOptionalClient(RequiredAndOptionalsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return only the required properties. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return only the required properties along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRequiredOnlyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getRequiredOnlyWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with only required properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putRequiredOnlyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putRequiredOnlyWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public RequiredAndOptionalProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(RequiredAndOptionalProperty.class); - } - - /** - * Get models that will return only the required properties. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return only the required properties. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public RequiredAndOptionalProperty getRequiredOnly() { - // Generated convenience method for getRequiredOnlyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getRequiredOnlyWithResponse(requestOptions).getValue().toObject(RequiredAndOptionalProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(RequiredAndOptionalProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with only required properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putRequiredOnly(RequiredAndOptionalProperty body) { - // Generated convenience method for putRequiredOnlyWithResponse - RequestOptions requestOptions = new RequestOptions(); - putRequiredOnlyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralAsyncClient.java deleted file mode 100644 index 760503f7185..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.StringLiteralsImpl; -import type.property.optional.models.StringLiteralProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class StringLiteralAsyncClient { - @Generated - private final StringLiteralsImpl serviceClient; - - /** - * Initializes an instance of StringLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringLiteralAsyncClient(StringLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(StringLiteralProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(StringLiteralProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(StringLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(StringLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralClient.java deleted file mode 100644 index 8b1d61dbdd7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.StringLiteralsImpl; -import type.property.optional.models.StringLiteralProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class StringLiteralClient { - @Generated - private final StringLiteralsImpl serviceClient; - - /** - * Initializes an instance of StringLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringLiteralClient(StringLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public StringLiteralProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(StringLiteralProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public StringLiteralProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(StringLiteralProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(StringLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(StringLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationAsyncClient.java deleted file mode 100644 index 2c585627e91..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.StringOperationsImpl; -import type.property.optional.models.StringProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class StringOperationAsyncClient { - @Generated - private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationAsyncClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(StringProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(StringProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(StringProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(StringProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationClient.java deleted file mode 100644 index fe5ba11b2a7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.StringOperationsImpl; -import type.property.optional.models.StringProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class StringOperationClient { - @Generated - private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public StringProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(StringProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public StringProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(StringProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(StringProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(StringProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralAsyncClient.java deleted file mode 100644 index e5f5d21cdab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.UnionFloatLiteralsImpl; -import type.property.optional.models.UnionFloatLiteralProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class UnionFloatLiteralAsyncClient { - @Generated - private final UnionFloatLiteralsImpl serviceClient; - - /** - * Initializes an instance of UnionFloatLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionFloatLiteralAsyncClient(UnionFloatLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnionFloatLiteralProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnionFloatLiteralProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(UnionFloatLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(UnionFloatLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralClient.java deleted file mode 100644 index cf6f37ad30b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.UnionFloatLiteralsImpl; -import type.property.optional.models.UnionFloatLiteralProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class UnionFloatLiteralClient { - @Generated - private final UnionFloatLiteralsImpl serviceClient; - - /** - * Initializes an instance of UnionFloatLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionFloatLiteralClient(UnionFloatLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnionFloatLiteralProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(UnionFloatLiteralProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnionFloatLiteralProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(UnionFloatLiteralProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(UnionFloatLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(UnionFloatLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralAsyncClient.java deleted file mode 100644 index e454bcd3bd3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.UnionIntLiteralsImpl; -import type.property.optional.models.UnionIntLiteralProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class UnionIntLiteralAsyncClient { - @Generated - private final UnionIntLiteralsImpl serviceClient; - - /** - * Initializes an instance of UnionIntLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionIntLiteralAsyncClient(UnionIntLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnionIntLiteralProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnionIntLiteralProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(UnionIntLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(UnionIntLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralClient.java deleted file mode 100644 index b1766d8854a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.UnionIntLiteralsImpl; -import type.property.optional.models.UnionIntLiteralProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class UnionIntLiteralClient { - @Generated - private final UnionIntLiteralsImpl serviceClient; - - /** - * Initializes an instance of UnionIntLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionIntLiteralClient(UnionIntLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnionIntLiteralProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(UnionIntLiteralProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnionIntLiteralProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(UnionIntLiteralProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(UnionIntLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(UnionIntLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralAsyncClient.java deleted file mode 100644 index b503358b1d9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralAsyncClient.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.optional.implementation.UnionStringLiteralsImpl; -import type.property.optional.models.UnionStringLiteralProperty; - -/** - * Initializes a new instance of the asynchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) -public final class UnionStringLiteralAsyncClient { - @Generated - private final UnionStringLiteralsImpl serviceClient; - - /** - * Initializes an instance of UnionStringLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionStringLiteralAsyncClient(UnionStringLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponseAsync(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponseAsync(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponseAsync(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnionStringLiteralProperty.class)); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnionStringLiteralProperty.class)); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putAll(UnionStringLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono putDefault(UnionStringLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralClient.java deleted file mode 100644 index 3d9be4a21a2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralClient.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.optional.implementation.UnionStringLiteralsImpl; -import type.property.optional.models.UnionStringLiteralProperty; - -/** - * Initializes a new instance of the synchronous OptionalClient type. - */ -@ServiceClient(builder = OptionalClientBuilder.class) -public final class UnionStringLiteralClient { - @Generated - private final UnionStringLiteralsImpl serviceClient; - - /** - * Initializes an instance of UnionStringLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionStringLiteralClient(UnionStringLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getAllWithResponse(requestOptions); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getDefaultWithResponse(requestOptions); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putAllWithResponse(body, requestOptions); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putDefaultWithResponse(body, requestOptions); - } - - /** - * Get models that will return all properties in the model. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return all properties in the model. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnionStringLiteralProperty getAll() { - // Generated convenience method for getAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getAllWithResponse(requestOptions).getValue().toObject(UnionStringLiteralProperty.class); - } - - /** - * Get models that will return the default object. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return models that will return the default object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnionStringLiteralProperty getDefault() { - // Generated convenience method for getDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getDefaultWithResponse(requestOptions).getValue().toObject(UnionStringLiteralProperty.class); - } - - /** - * Put a body with all properties present. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putAll(UnionStringLiteralProperty body) { - // Generated convenience method for putAllWithResponse - RequestOptions requestOptions = new RequestOptions(); - putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * Put a body with default properties. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void putDefault(UnionStringLiteralProperty body) { - // Generated convenience method for putDefaultWithResponse - RequestOptions requestOptions = new RequestOptions(); - putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BooleanLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BooleanLiteralsImpl.java deleted file mode 100644 index 143fdda9060..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BooleanLiteralsImpl.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in BooleanLiterals. - */ -public final class BooleanLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BooleanLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of BooleanLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BooleanLiteralsImpl(OptionalClientImpl client) { - this.service - = RestProxy.create(BooleanLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientBooleanLiterals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientBooleanLiterals") - public interface BooleanLiteralsService { - @Get("/type/property/optional/boolean/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/boolean/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/boolean/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/boolean/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/boolean/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/boolean/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/boolean/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/boolean/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(true) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BytesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BytesImpl.java deleted file mode 100644 index 3251214372d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BytesImpl.java +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Bytes. - */ -public final class BytesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BytesService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of BytesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BytesImpl(OptionalClientImpl client) { - this.service = RestProxy.create(BytesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientBytes to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientBytes") - public interface BytesService { - @Get("/type/property/optional/bytes/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/bytes/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/bytes/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/bytes/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/bytes/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/bytes/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/bytes/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/bytes/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsBytesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsBytesImpl.java deleted file mode 100644 index a74b413e7f5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsBytesImpl.java +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in CollectionsBytes. - */ -public final class CollectionsBytesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final CollectionsBytesService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of CollectionsBytesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - CollectionsBytesImpl(OptionalClientImpl client) { - this.service - = RestProxy.create(CollectionsBytesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientCollectionsBytes to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientCollectionsBytes") - public interface CollectionsBytesService { - @Get("/type/property/optional/collections/bytes/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/collections/bytes/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/collections/bytes/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/collections/bytes/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/collections/bytes/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/collections/bytes/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/collections/bytes/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/collections/bytes/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *         byte[] (Optional)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsModelsImpl.java deleted file mode 100644 index 72e45db4dd9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsModelsImpl.java +++ /dev/null @@ -1,380 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in CollectionsModels. - */ -public final class CollectionsModelsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final CollectionsModelsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of CollectionsModelsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - CollectionsModelsImpl(OptionalClientImpl client) { - this.service - = RestProxy.create(CollectionsModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientCollectionsModels to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientCollectionsModels") - public interface CollectionsModelsService { - @Get("/type/property/optional/collections/model/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/collections/model/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/collections/model/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/collections/model/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/collections/model/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/collections/model/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/collections/model/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/collections/model/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Optional): [
-     *          (Optional){
-     *             property: String (Optional)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DatetimeOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DatetimeOperationsImpl.java deleted file mode 100644 index 3d28876cb7a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DatetimeOperationsImpl.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DatetimeOperations. - */ -public final class DatetimeOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DatetimeOperationsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of DatetimeOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DatetimeOperationsImpl(OptionalClientImpl client) { - this.service = RestProxy.create(DatetimeOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientDatetimeOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientDatetimeOperations") - public interface DatetimeOperationsService { - @Get("/type/property/optional/datetime/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/datetime/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/datetime/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/datetime/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/datetime/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/datetime/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/datetime/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/datetime/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DurationOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DurationOperationsImpl.java deleted file mode 100644 index 65b1e975592..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DurationOperationsImpl.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DurationOperations. - */ -public final class DurationOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DurationOperationsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of DurationOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DurationOperationsImpl(OptionalClientImpl client) { - this.service = RestProxy.create(DurationOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientDurationOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientDurationOperations") - public interface DurationOperationsService { - @Get("/type/property/optional/duration/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/duration/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/duration/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/duration/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/duration/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/duration/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/duration/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/duration/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/FloatLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/FloatLiteralsImpl.java deleted file mode 100644 index 2b4da625bf5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/FloatLiteralsImpl.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in FloatLiterals. - */ -public final class FloatLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FloatLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of FloatLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FloatLiteralsImpl(OptionalClientImpl client) { - this.service - = RestProxy.create(FloatLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientFloatLiterals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientFloatLiterals") - public interface FloatLiteralsService { - @Get("/type/property/optional/float/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/float/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/float/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/float/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/float/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/float/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/float/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/float/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/IntLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/IntLiteralsImpl.java deleted file mode 100644 index d1221cb8298..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/IntLiteralsImpl.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in IntLiterals. - */ -public final class IntLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final IntLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of IntLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - IntLiteralsImpl(OptionalClientImpl client) { - this.service - = RestProxy.create(IntLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientIntLiterals to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientIntLiterals") - public interface IntLiteralsService { - @Get("/type/property/optional/int/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/int/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/int/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/int/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/int/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/int/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/int/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/int/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/OptionalClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/OptionalClientImpl.java deleted file mode 100644 index 94201d25ad4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/OptionalClientImpl.java +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 OptionalClient type. - */ -public final class OptionalClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 StringOperationsImpl object to access its operations. - */ - private final StringOperationsImpl stringOperations; - - /** - * Gets the StringOperationsImpl object to access its operations. - * - * @return the StringOperationsImpl object. - */ - public StringOperationsImpl getStringOperations() { - return this.stringOperations; - } - - /** - * The BytesImpl object to access its operations. - */ - private final BytesImpl bytes; - - /** - * Gets the BytesImpl object to access its operations. - * - * @return the BytesImpl object. - */ - public BytesImpl getBytes() { - return this.bytes; - } - - /** - * The DatetimeOperationsImpl object to access its operations. - */ - private final DatetimeOperationsImpl datetimeOperations; - - /** - * Gets the DatetimeOperationsImpl object to access its operations. - * - * @return the DatetimeOperationsImpl object. - */ - public DatetimeOperationsImpl getDatetimeOperations() { - return this.datetimeOperations; - } - - /** - * The DurationOperationsImpl object to access its operations. - */ - private final DurationOperationsImpl durationOperations; - - /** - * Gets the DurationOperationsImpl object to access its operations. - * - * @return the DurationOperationsImpl object. - */ - public DurationOperationsImpl getDurationOperations() { - return this.durationOperations; - } - - /** - * The PlainDatesImpl object to access its operations. - */ - private final PlainDatesImpl plainDates; - - /** - * Gets the PlainDatesImpl object to access its operations. - * - * @return the PlainDatesImpl object. - */ - public PlainDatesImpl getPlainDates() { - return this.plainDates; - } - - /** - * The PlainTimesImpl object to access its operations. - */ - private final PlainTimesImpl plainTimes; - - /** - * Gets the PlainTimesImpl object to access its operations. - * - * @return the PlainTimesImpl object. - */ - public PlainTimesImpl getPlainTimes() { - return this.plainTimes; - } - - /** - * The CollectionsBytesImpl object to access its operations. - */ - private final CollectionsBytesImpl collectionsBytes; - - /** - * Gets the CollectionsBytesImpl object to access its operations. - * - * @return the CollectionsBytesImpl object. - */ - public CollectionsBytesImpl getCollectionsBytes() { - return this.collectionsBytes; - } - - /** - * The CollectionsModelsImpl object to access its operations. - */ - private final CollectionsModelsImpl collectionsModels; - - /** - * Gets the CollectionsModelsImpl object to access its operations. - * - * @return the CollectionsModelsImpl object. - */ - public CollectionsModelsImpl getCollectionsModels() { - return this.collectionsModels; - } - - /** - * The StringLiteralsImpl object to access its operations. - */ - private final StringLiteralsImpl stringLiterals; - - /** - * Gets the StringLiteralsImpl object to access its operations. - * - * @return the StringLiteralsImpl object. - */ - public StringLiteralsImpl getStringLiterals() { - return this.stringLiterals; - } - - /** - * The IntLiteralsImpl object to access its operations. - */ - private final IntLiteralsImpl intLiterals; - - /** - * Gets the IntLiteralsImpl object to access its operations. - * - * @return the IntLiteralsImpl object. - */ - public IntLiteralsImpl getIntLiterals() { - return this.intLiterals; - } - - /** - * The FloatLiteralsImpl object to access its operations. - */ - private final FloatLiteralsImpl floatLiterals; - - /** - * Gets the FloatLiteralsImpl object to access its operations. - * - * @return the FloatLiteralsImpl object. - */ - public FloatLiteralsImpl getFloatLiterals() { - return this.floatLiterals; - } - - /** - * The BooleanLiteralsImpl object to access its operations. - */ - private final BooleanLiteralsImpl booleanLiterals; - - /** - * Gets the BooleanLiteralsImpl object to access its operations. - * - * @return the BooleanLiteralsImpl object. - */ - public BooleanLiteralsImpl getBooleanLiterals() { - return this.booleanLiterals; - } - - /** - * The UnionStringLiteralsImpl object to access its operations. - */ - private final UnionStringLiteralsImpl unionStringLiterals; - - /** - * Gets the UnionStringLiteralsImpl object to access its operations. - * - * @return the UnionStringLiteralsImpl object. - */ - public UnionStringLiteralsImpl getUnionStringLiterals() { - return this.unionStringLiterals; - } - - /** - * The UnionIntLiteralsImpl object to access its operations. - */ - private final UnionIntLiteralsImpl unionIntLiterals; - - /** - * Gets the UnionIntLiteralsImpl object to access its operations. - * - * @return the UnionIntLiteralsImpl object. - */ - public UnionIntLiteralsImpl getUnionIntLiterals() { - return this.unionIntLiterals; - } - - /** - * The UnionFloatLiteralsImpl object to access its operations. - */ - private final UnionFloatLiteralsImpl unionFloatLiterals; - - /** - * Gets the UnionFloatLiteralsImpl object to access its operations. - * - * @return the UnionFloatLiteralsImpl object. - */ - public UnionFloatLiteralsImpl getUnionFloatLiterals() { - return this.unionFloatLiterals; - } - - /** - * The RequiredAndOptionalsImpl object to access its operations. - */ - private final RequiredAndOptionalsImpl requiredAndOptionals; - - /** - * Gets the RequiredAndOptionalsImpl object to access its operations. - * - * @return the RequiredAndOptionalsImpl object. - */ - public RequiredAndOptionalsImpl getRequiredAndOptionals() { - return this.requiredAndOptionals; - } - - /** - * Initializes an instance of OptionalClient client. - * - * @param endpoint Service host. - */ - public OptionalClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of OptionalClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public OptionalClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of OptionalClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public OptionalClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.stringOperations = new StringOperationsImpl(this); - this.bytes = new BytesImpl(this); - this.datetimeOperations = new DatetimeOperationsImpl(this); - this.durationOperations = new DurationOperationsImpl(this); - this.plainDates = new PlainDatesImpl(this); - this.plainTimes = new PlainTimesImpl(this); - this.collectionsBytes = new CollectionsBytesImpl(this); - this.collectionsModels = new CollectionsModelsImpl(this); - this.stringLiterals = new StringLiteralsImpl(this); - this.intLiterals = new IntLiteralsImpl(this); - this.floatLiterals = new FloatLiteralsImpl(this); - this.booleanLiterals = new BooleanLiteralsImpl(this); - this.unionStringLiterals = new UnionStringLiteralsImpl(this); - this.unionIntLiterals = new UnionIntLiteralsImpl(this); - this.unionFloatLiterals = new UnionFloatLiteralsImpl(this); - this.requiredAndOptionals = new RequiredAndOptionalsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainDatesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainDatesImpl.java deleted file mode 100644 index 81677c3cd2b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainDatesImpl.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PlainDates. - */ -public final class PlainDatesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PlainDatesService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of PlainDatesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PlainDatesImpl(OptionalClientImpl client) { - this.service - = RestProxy.create(PlainDatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientPlainDates to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientPlainDates") - public interface PlainDatesService { - @Get("/type/property/optional/plainDate/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/plainDate/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/plainDate/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/plainDate/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/plainDate/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/plainDate/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/plainDate/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/plainDate/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: LocalDate (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainTimesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainTimesImpl.java deleted file mode 100644 index 7aa7284829f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainTimesImpl.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in PlainTimes. - */ -public final class PlainTimesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final PlainTimesService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of PlainTimesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - PlainTimesImpl(OptionalClientImpl client) { - this.service - = RestProxy.create(PlainTimesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientPlainTimes to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientPlainTimes") - public interface PlainTimesService { - @Get("/type/property/optional/plainTime/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/plainTime/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/plainTime/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/plainTime/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/plainTime/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/plainTime/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/plainTime/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/plainTime/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/RequiredAndOptionalsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/RequiredAndOptionalsImpl.java deleted file mode 100644 index 1295973a803..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/RequiredAndOptionalsImpl.java +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in RequiredAndOptionals. - */ -public final class RequiredAndOptionalsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RequiredAndOptionalsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of RequiredAndOptionalsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - RequiredAndOptionalsImpl(OptionalClientImpl client) { - this.service = RestProxy.create(RequiredAndOptionalsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientRequiredAndOptionals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientRequiredAndOptionals") - public interface RequiredAndOptionalsService { - @Get("/type/property/optional/requiredAndOptional/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/requiredAndOptional/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/requiredAndOptional/requiredOnly") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getRequiredOnly(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/requiredAndOptional/requiredOnly") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getRequiredOnlySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/requiredAndOptional/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/requiredAndOptional/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/requiredAndOptional/requiredOnly") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putRequiredOnly(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/requiredAndOptional/requiredOnly") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putRequiredOnlySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return only the required properties. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return only the required properties along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getRequiredOnlyWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getRequiredOnly(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return only the required properties. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return only the required properties along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getRequiredOnlyWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getRequiredOnlySync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with only required properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putRequiredOnlyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putRequiredOnly(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with only required properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     optionalProperty: String (Optional)
-     *     requiredProperty: int (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putRequiredOnlyWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putRequiredOnlySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringLiteralsImpl.java deleted file mode 100644 index b24c53f9c0a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringLiteralsImpl.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringLiterals. - */ -public final class StringLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of StringLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringLiteralsImpl(OptionalClientImpl client) { - this.service - = RestProxy.create(StringLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientStringLiterals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientStringLiterals") - public interface StringLiteralsService { - @Get("/type/property/optional/string/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/string/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/string/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/string/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/string/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/string/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/string/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/string/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringOperationsImpl.java deleted file mode 100644 index a8c3edf48fa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringOperationsImpl.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringOperations. - */ -public final class StringOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringOperationsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of StringOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringOperationsImpl(OptionalClientImpl client) { - this.service - = RestProxy.create(StringOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientStringOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientStringOperations") - public interface StringOperationsService { - @Get("/type/property/optional/string/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/string/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/string/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/string/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/string/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/string/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/string/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/string/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionFloatLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionFloatLiteralsImpl.java deleted file mode 100644 index 4e36b16d121..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionFloatLiteralsImpl.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnionFloatLiterals. - */ -public final class UnionFloatLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnionFloatLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of UnionFloatLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnionFloatLiteralsImpl(OptionalClientImpl client) { - this.service = RestProxy.create(UnionFloatLiteralsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientUnionFloatLiterals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientUnionFloatLiterals") - public interface UnionFloatLiteralsService { - @Get("/type/property/optional/union/float/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/union/float/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/union/float/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/union/float/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/union/float/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/union/float/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/union/float/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/union/float/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1.25/2.375) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionIntLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionIntLiteralsImpl.java deleted file mode 100644 index 1818f04350f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionIntLiteralsImpl.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnionIntLiterals. - */ -public final class UnionIntLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnionIntLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of UnionIntLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnionIntLiteralsImpl(OptionalClientImpl client) { - this.service - = RestProxy.create(UnionIntLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientUnionIntLiterals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientUnionIntLiterals") - public interface UnionIntLiteralsService { - @Get("/type/property/optional/union/int/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/union/int/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/union/int/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/union/int/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/union/int/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/union/int/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/union/int/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/union/int/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(1/2) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionStringLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionStringLiteralsImpl.java deleted file mode 100644 index eabb37ea23d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionStringLiteralsImpl.java +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnionStringLiterals. - */ -public final class UnionStringLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnionStringLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final OptionalClientImpl client; - - /** - * Initializes an instance of UnionStringLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnionStringLiteralsImpl(OptionalClientImpl client) { - this.service = RestProxy.create(UnionStringLiteralsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for OptionalClientUnionStringLiterals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "OptionalClientUnionStringLiterals") - public interface UnionStringLiteralsService { - @Get("/type/property/optional/union/string/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/union/string/literal/all") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/union/string/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/property/optional/union/string/literal/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/union/string/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putAll(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/union/string/literal/all") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putAllSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/union/string/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> putDefault(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/optional/union/string/literal/default") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putDefaultSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return all properties in the model. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return all properties in the model along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAllWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get models that will return the default object. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return models that will return the default object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDefaultWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with all properties present. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put a body with default properties. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/package-info.java deleted file mode 100644 index 95e1d23851f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Optional. - * Illustrates models with optional properties. - * - */ -package type.property.optional.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralProperty.java deleted file mode 100644 index 5e79b380e83..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralProperty.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with boolean literal property. - */ -@Fluent -public final class BooleanLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private BooleanLiteralPropertyProperty property; - - /** - * Creates an instance of BooleanLiteralProperty class. - */ - @Generated - public BooleanLiteralProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public BooleanLiteralPropertyProperty getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the BooleanLiteralProperty object itself. - */ - @Generated - public BooleanLiteralProperty setProperty(BooleanLiteralPropertyProperty property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("property", this.property == null ? null : this.property.toBoolean()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BooleanLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BooleanLiteralProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the BooleanLiteralProperty. - */ - @Generated - public static BooleanLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BooleanLiteralProperty deserializedBooleanLiteralProperty = new BooleanLiteralProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedBooleanLiteralProperty.property - = BooleanLiteralPropertyProperty.fromBoolean(reader.getBoolean()); - } else { - reader.skipChildren(); - } - } - - return deserializedBooleanLiteralProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralPropertyProperty.java deleted file mode 100644 index fb21e83d316..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralPropertyProperty.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -/** - * Defines values for BooleanLiteralPropertyProperty. - */ -public enum BooleanLiteralPropertyProperty { - /** - * Enum value true. - */ - TRUE(true); - - /** - * The actual serialized value for a BooleanLiteralPropertyProperty instance. - */ - private final boolean value; - - BooleanLiteralPropertyProperty(boolean value) { - this.value = value; - } - - /** - * Parses a serialized value to a BooleanLiteralPropertyProperty instance. - * - * @param value the serialized value to parse. - * @return the parsed BooleanLiteralPropertyProperty object, or null if unable to parse. - */ - public static BooleanLiteralPropertyProperty fromBoolean(boolean value) { - BooleanLiteralPropertyProperty[] items = BooleanLiteralPropertyProperty.values(); - for (BooleanLiteralPropertyProperty item : items) { - if (item.toBoolean() == value) { - return item; - } - } - return null; - } - - /** - * De-serializes the instance to boolean value. - * - * @return the boolean value. - */ - public boolean toBoolean() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BytesProperty.java deleted file mode 100644 index 6a6181c64bb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BytesProperty.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Template type for testing models with optional property. Pass in the type of the property you are looking for. - */ -@Fluent -public final class BytesProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private byte[] property; - - /** - * Creates an instance of BytesProperty class. - */ - @Generated - public BytesProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public byte[] getProperty() { - return CoreUtils.clone(this.property); - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the BytesProperty object itself. - */ - @Generated - public BytesProperty setProperty(byte[] property) { - this.property = CoreUtils.clone(property); - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBinaryField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BytesProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BytesProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the BytesProperty. - */ - @Generated - public static BytesProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BytesProperty deserializedBytesProperty = new BytesProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedBytesProperty.property = reader.getBinary(); - } else { - reader.skipChildren(); - } - } - - return deserializedBytesProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsByteProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsByteProperty.java deleted file mode 100644 index 121200b2437..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsByteProperty.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * Model with collection bytes properties. - */ -@Fluent -public final class CollectionsByteProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private List property; - - /** - * Creates an instance of CollectionsByteProperty class. - */ - @Generated - public CollectionsByteProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public List getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the CollectionsByteProperty object itself. - */ - @Generated - public CollectionsByteProperty setProperty(List property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("property", this.property, (writer, element) -> writer.writeBinary(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CollectionsByteProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CollectionsByteProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the CollectionsByteProperty. - */ - @Generated - public static CollectionsByteProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CollectionsByteProperty deserializedCollectionsByteProperty = new CollectionsByteProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - List property = reader.readArray(reader1 -> reader1.getBinary()); - deserializedCollectionsByteProperty.property = property; - } else { - reader.skipChildren(); - } - } - - return deserializedCollectionsByteProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsModelProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsModelProperty.java deleted file mode 100644 index de2e57c216b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsModelProperty.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * Model with collection models properties. - */ -@Fluent -public final class CollectionsModelProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private List property; - - /** - * Creates an instance of CollectionsModelProperty class. - */ - @Generated - public CollectionsModelProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public List getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the CollectionsModelProperty object itself. - */ - @Generated - public CollectionsModelProperty setProperty(List property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("property", this.property, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CollectionsModelProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CollectionsModelProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the CollectionsModelProperty. - */ - @Generated - public static CollectionsModelProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CollectionsModelProperty deserializedCollectionsModelProperty = new CollectionsModelProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - List property = reader.readArray(reader1 -> StringProperty.fromJson(reader1)); - deserializedCollectionsModelProperty.property = property; - } else { - reader.skipChildren(); - } - } - - return deserializedCollectionsModelProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DatetimeProperty.java deleted file mode 100644 index be3594c8a5e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DatetimeProperty.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; - -/** - * Model with a datetime property. - */ -@Fluent -public final class DatetimeProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private OffsetDateTime property; - - /** - * Creates an instance of DatetimeProperty class. - */ - @Generated - public DatetimeProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public OffsetDateTime getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the DatetimeProperty object itself. - */ - @Generated - public DatetimeProperty setProperty(OffsetDateTime property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", - this.property == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.property)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DatetimeProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DatetimeProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the DatetimeProperty. - */ - @Generated - public static DatetimeProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - DatetimeProperty deserializedDatetimeProperty = new DatetimeProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedDatetimeProperty.property = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - - return deserializedDatetimeProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DurationProperty.java deleted file mode 100644 index dc88425a4ee..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DurationProperty.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; - -/** - * Model with a duration property. - */ -@Fluent -public final class DurationProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private Duration property; - - /** - * Creates an instance of DurationProperty class. - */ - @Generated - public DurationProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public Duration getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the DurationProperty object itself. - */ - @Generated - public DurationProperty setProperty(Duration property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", CoreUtils.durationToStringWithDays(this.property)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DurationProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the DurationProperty. - */ - @Generated - public static DurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - DurationProperty deserializedDurationProperty = new DurationProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedDurationProperty.property - = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - - return deserializedDurationProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralProperty.java deleted file mode 100644 index 3502ff9f412..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralProperty.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with float literal property. - */ -@Fluent -public final class FloatLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private FloatLiteralPropertyProperty property; - - /** - * Creates an instance of FloatLiteralProperty class. - */ - @Generated - public FloatLiteralProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public FloatLiteralPropertyProperty getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the FloatLiteralProperty object itself. - */ - @Generated - public FloatLiteralProperty setProperty(FloatLiteralPropertyProperty property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("property", this.property == null ? null : this.property.toDouble()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FloatLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FloatLiteralProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the FloatLiteralProperty. - */ - @Generated - public static FloatLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - FloatLiteralProperty deserializedFloatLiteralProperty = new FloatLiteralProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedFloatLiteralProperty.property - = FloatLiteralPropertyProperty.fromDouble(reader.getDouble()); - } else { - reader.skipChildren(); - } - } - - return deserializedFloatLiteralProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralPropertyProperty.java deleted file mode 100644 index f52f360a7d8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralPropertyProperty.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -/** - * Defines values for FloatLiteralPropertyProperty. - */ -public enum FloatLiteralPropertyProperty { - /** - * Enum value 1.25. - */ - ONE_TWO_FIVE(1.25); - - /** - * The actual serialized value for a FloatLiteralPropertyProperty instance. - */ - private final double value; - - FloatLiteralPropertyProperty(double value) { - this.value = value; - } - - /** - * Parses a serialized value to a FloatLiteralPropertyProperty instance. - * - * @param value the serialized value to parse. - * @return the parsed FloatLiteralPropertyProperty object, or null if unable to parse. - */ - public static FloatLiteralPropertyProperty fromDouble(double value) { - FloatLiteralPropertyProperty[] items = FloatLiteralPropertyProperty.values(); - for (FloatLiteralPropertyProperty item : items) { - if (Double.doubleToLongBits(item.toDouble()) == Double.doubleToLongBits(value)) { - return item; - } - } - return null; - } - - /** - * De-serializes the instance to double value. - * - * @return the double value. - */ - public double toDouble() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralProperty.java deleted file mode 100644 index c91cdc59657..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralProperty.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with int literal property. - */ -@Fluent -public final class IntLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private IntLiteralPropertyProperty property; - - /** - * Creates an instance of IntLiteralProperty class. - */ - @Generated - public IntLiteralProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public IntLiteralPropertyProperty getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the IntLiteralProperty object itself. - */ - @Generated - public IntLiteralProperty setProperty(IntLiteralPropertyProperty property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("property", this.property == null ? null : this.property.toInt()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of IntLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of IntLiteralProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the IntLiteralProperty. - */ - @Generated - public static IntLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - IntLiteralProperty deserializedIntLiteralProperty = new IntLiteralProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedIntLiteralProperty.property = IntLiteralPropertyProperty.fromInt(reader.getInt()); - } else { - reader.skipChildren(); - } - } - - return deserializedIntLiteralProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralPropertyProperty.java deleted file mode 100644 index 2b5ec41e17c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralPropertyProperty.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -/** - * Defines values for IntLiteralPropertyProperty. - */ -public enum IntLiteralPropertyProperty { - /** - * Enum value 1. - */ - ONE(1); - - /** - * The actual serialized value for a IntLiteralPropertyProperty instance. - */ - private final int value; - - IntLiteralPropertyProperty(int value) { - this.value = value; - } - - /** - * Parses a serialized value to a IntLiteralPropertyProperty instance. - * - * @param value the serialized value to parse. - * @return the parsed IntLiteralPropertyProperty object, or null if unable to parse. - */ - public static IntLiteralPropertyProperty fromInt(int value) { - IntLiteralPropertyProperty[] items = IntLiteralPropertyProperty.values(); - for (IntLiteralPropertyProperty item : items) { - if (item.toInt() == value) { - return item; - } - } - return null; - } - - /** - * De-serializes the instance to int value. - * - * @return the int value. - */ - public int toInt() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainDateProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainDateProperty.java deleted file mode 100644 index dc1ee163d81..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainDateProperty.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.LocalDate; -import java.util.Objects; - -/** - * Model with a plainDate property. - */ -@Fluent -public final class PlainDateProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private LocalDate property; - - /** - * Creates an instance of PlainDateProperty class. - */ - @Generated - public PlainDateProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public LocalDate getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the PlainDateProperty object itself. - */ - @Generated - public PlainDateProperty setProperty(LocalDate property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", Objects.toString(this.property, null)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PlainDateProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PlainDateProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the PlainDateProperty. - */ - @Generated - public static PlainDateProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - PlainDateProperty deserializedPlainDateProperty = new PlainDateProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedPlainDateProperty.property - = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - - return deserializedPlainDateProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainTimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainTimeProperty.java deleted file mode 100644 index b61179179c2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainTimeProperty.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a plainTime property. - */ -@Fluent -public final class PlainTimeProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private String property; - - /** - * Creates an instance of PlainTimeProperty class. - */ - @Generated - public PlainTimeProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public String getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the PlainTimeProperty object itself. - */ - @Generated - public PlainTimeProperty setProperty(String property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PlainTimeProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PlainTimeProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the PlainTimeProperty. - */ - @Generated - public static PlainTimeProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - PlainTimeProperty deserializedPlainTimeProperty = new PlainTimeProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedPlainTimeProperty.property = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedPlainTimeProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/RequiredAndOptionalProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/RequiredAndOptionalProperty.java deleted file mode 100644 index 671cf4f2496..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/RequiredAndOptionalProperty.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with required and optional properties. - */ -@Fluent -public final class RequiredAndOptionalProperty implements JsonSerializable { - /* - * optional string property - */ - @Generated - private String optionalProperty; - - /* - * required int property - */ - @Generated - private final int requiredProperty; - - /** - * Creates an instance of RequiredAndOptionalProperty class. - * - * @param requiredProperty the requiredProperty value to set. - */ - @Generated - public RequiredAndOptionalProperty(int requiredProperty) { - this.requiredProperty = requiredProperty; - } - - /** - * Get the optionalProperty property: optional string property. - * - * @return the optionalProperty value. - */ - @Generated - public String getOptionalProperty() { - return this.optionalProperty; - } - - /** - * Set the optionalProperty property: optional string property. - * - * @param optionalProperty the optionalProperty value to set. - * @return the RequiredAndOptionalProperty object itself. - */ - @Generated - public RequiredAndOptionalProperty setOptionalProperty(String optionalProperty) { - this.optionalProperty = optionalProperty; - return this; - } - - /** - * Get the requiredProperty property: required int property. - * - * @return the requiredProperty value. - */ - @Generated - public int getRequiredProperty() { - return this.requiredProperty; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("requiredProperty", this.requiredProperty); - jsonWriter.writeStringField("optionalProperty", this.optionalProperty); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of RequiredAndOptionalProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of RequiredAndOptionalProperty if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the RequiredAndOptionalProperty. - */ - @Generated - public static RequiredAndOptionalProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int requiredProperty = 0; - String optionalProperty = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("requiredProperty".equals(fieldName)) { - requiredProperty = reader.getInt(); - } else if ("optionalProperty".equals(fieldName)) { - optionalProperty = reader.getString(); - } else { - reader.skipChildren(); - } - } - RequiredAndOptionalProperty deserializedRequiredAndOptionalProperty - = new RequiredAndOptionalProperty(requiredProperty); - deserializedRequiredAndOptionalProperty.optionalProperty = optionalProperty; - - return deserializedRequiredAndOptionalProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralProperty.java deleted file mode 100644 index 472e8daa6b2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralProperty.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with string literal property. - */ -@Fluent -public final class StringLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private StringLiteralPropertyProperty property; - - /** - * Creates an instance of StringLiteralProperty class. - */ - @Generated - public StringLiteralProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public StringLiteralPropertyProperty getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the StringLiteralProperty object itself. - */ - @Generated - public StringLiteralProperty setProperty(StringLiteralPropertyProperty property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of StringLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of StringLiteralProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the StringLiteralProperty. - */ - @Generated - public static StringLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - StringLiteralProperty deserializedStringLiteralProperty = new StringLiteralProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedStringLiteralProperty.property - = StringLiteralPropertyProperty.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedStringLiteralProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralPropertyProperty.java deleted file mode 100644 index cbaebc95a3d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralPropertyProperty.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -/** - * Defines values for StringLiteralPropertyProperty. - */ -public enum StringLiteralPropertyProperty { - /** - * Enum value hello. - */ - HELLO("hello"); - - /** - * The actual serialized value for a StringLiteralPropertyProperty instance. - */ - private final String value; - - StringLiteralPropertyProperty(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a StringLiteralPropertyProperty instance. - * - * @param value the serialized value to parse. - * @return the parsed StringLiteralPropertyProperty object, or null if unable to parse. - */ - public static StringLiteralPropertyProperty fromString(String value) { - if (value == null) { - return null; - } - StringLiteralPropertyProperty[] items = StringLiteralPropertyProperty.values(); - for (StringLiteralPropertyProperty item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringProperty.java deleted file mode 100644 index 6d8740a245a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringProperty.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Template type for testing models with optional property. Pass in the type of the property you are looking for. - */ -@Fluent -public final class StringProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private String property; - - /** - * Creates an instance of StringProperty class. - */ - @Generated - public StringProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public String getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the StringProperty object itself. - */ - @Generated - public StringProperty setProperty(String property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of StringProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of StringProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the StringProperty. - */ - @Generated - public static StringProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - StringProperty deserializedStringProperty = new StringProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedStringProperty.property = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedStringProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralProperty.java deleted file mode 100644 index 773ce19ba68..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralProperty.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with union of float literal property. - */ -@Fluent -public final class UnionFloatLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private UnionFloatLiteralPropertyProperty property; - - /** - * Creates an instance of UnionFloatLiteralProperty class. - */ - @Generated - public UnionFloatLiteralProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public UnionFloatLiteralPropertyProperty getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the UnionFloatLiteralProperty object itself. - */ - @Generated - public UnionFloatLiteralProperty setProperty(UnionFloatLiteralPropertyProperty property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("property", this.property == null ? null : this.property.toDouble()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnionFloatLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnionFloatLiteralProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the UnionFloatLiteralProperty. - */ - @Generated - public static UnionFloatLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - UnionFloatLiteralProperty deserializedUnionFloatLiteralProperty = new UnionFloatLiteralProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedUnionFloatLiteralProperty.property - = UnionFloatLiteralPropertyProperty.fromDouble(reader.getDouble()); - } else { - reader.skipChildren(); - } - } - - return deserializedUnionFloatLiteralProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralPropertyProperty.java deleted file mode 100644 index cfde1f7c170..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralPropertyProperty.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -/** - * Defines values for UnionFloatLiteralPropertyProperty. - */ -public enum UnionFloatLiteralPropertyProperty { - /** - * Enum value 1.25. - */ - ONE_TWO_FIVE(1.25), - - /** - * Enum value 2.375. - */ - TWO_THREE_SEVEN_FIVE(2.375); - - /** - * The actual serialized value for a UnionFloatLiteralPropertyProperty instance. - */ - private final double value; - - UnionFloatLiteralPropertyProperty(double value) { - this.value = value; - } - - /** - * Parses a serialized value to a UnionFloatLiteralPropertyProperty instance. - * - * @param value the serialized value to parse. - * @return the parsed UnionFloatLiteralPropertyProperty object, or null if unable to parse. - */ - public static UnionFloatLiteralPropertyProperty fromDouble(double value) { - UnionFloatLiteralPropertyProperty[] items = UnionFloatLiteralPropertyProperty.values(); - for (UnionFloatLiteralPropertyProperty item : items) { - if (Double.doubleToLongBits(item.toDouble()) == Double.doubleToLongBits(value)) { - return item; - } - } - return null; - } - - /** - * De-serializes the instance to double value. - * - * @return the double value. - */ - public double toDouble() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralProperty.java deleted file mode 100644 index 96237e2351b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralProperty.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with union of int literal property. - */ -@Fluent -public final class UnionIntLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private UnionIntLiteralPropertyProperty property; - - /** - * Creates an instance of UnionIntLiteralProperty class. - */ - @Generated - public UnionIntLiteralProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public UnionIntLiteralPropertyProperty getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the UnionIntLiteralProperty object itself. - */ - @Generated - public UnionIntLiteralProperty setProperty(UnionIntLiteralPropertyProperty property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("property", this.property == null ? null : this.property.toInt()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnionIntLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnionIntLiteralProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the UnionIntLiteralProperty. - */ - @Generated - public static UnionIntLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - UnionIntLiteralProperty deserializedUnionIntLiteralProperty = new UnionIntLiteralProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedUnionIntLiteralProperty.property - = UnionIntLiteralPropertyProperty.fromInt(reader.getInt()); - } else { - reader.skipChildren(); - } - } - - return deserializedUnionIntLiteralProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralPropertyProperty.java deleted file mode 100644 index 703a2066b62..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralPropertyProperty.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -/** - * Defines values for UnionIntLiteralPropertyProperty. - */ -public enum UnionIntLiteralPropertyProperty { - /** - * Enum value 1. - */ - ONE(1), - - /** - * Enum value 2. - */ - TWO(2); - - /** - * The actual serialized value for a UnionIntLiteralPropertyProperty instance. - */ - private final int value; - - UnionIntLiteralPropertyProperty(int value) { - this.value = value; - } - - /** - * Parses a serialized value to a UnionIntLiteralPropertyProperty instance. - * - * @param value the serialized value to parse. - * @return the parsed UnionIntLiteralPropertyProperty object, or null if unable to parse. - */ - public static UnionIntLiteralPropertyProperty fromInt(int value) { - UnionIntLiteralPropertyProperty[] items = UnionIntLiteralPropertyProperty.values(); - for (UnionIntLiteralPropertyProperty item : items) { - if (item.toInt() == value) { - return item; - } - } - return null; - } - - /** - * De-serializes the instance to int value. - * - * @return the int value. - */ - public int toInt() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralProperty.java deleted file mode 100644 index c5271cd552d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralProperty.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with union of string literal property. - */ -@Fluent -public final class UnionStringLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private UnionStringLiteralPropertyProperty property; - - /** - * Creates an instance of UnionStringLiteralProperty class. - */ - @Generated - public UnionStringLiteralProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public UnionStringLiteralPropertyProperty getProperty() { - return this.property; - } - - /** - * Set the property property: Property. - * - * @param property the property value to set. - * @return the UnionStringLiteralProperty object itself. - */ - @Generated - public UnionStringLiteralProperty setProperty(UnionStringLiteralPropertyProperty property) { - this.property = property; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnionStringLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnionStringLiteralProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IOException If an error occurs while reading the UnionStringLiteralProperty. - */ - @Generated - public static UnionStringLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - UnionStringLiteralProperty deserializedUnionStringLiteralProperty = new UnionStringLiteralProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - deserializedUnionStringLiteralProperty.property - = UnionStringLiteralPropertyProperty.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - - return deserializedUnionStringLiteralProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralPropertyProperty.java deleted file mode 100644 index d38f242d770..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralPropertyProperty.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.models; - -/** - * Defines values for UnionStringLiteralPropertyProperty. - */ -public enum UnionStringLiteralPropertyProperty { - /** - * Enum value hello. - */ - HELLO("hello"), - - /** - * Enum value world. - */ - WORLD("world"); - - /** - * The actual serialized value for a UnionStringLiteralPropertyProperty instance. - */ - private final String value; - - UnionStringLiteralPropertyProperty(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a UnionStringLiteralPropertyProperty instance. - * - * @param value the serialized value to parse. - * @return the parsed UnionStringLiteralPropertyProperty object, or null if unable to parse. - */ - public static UnionStringLiteralPropertyProperty fromString(String value) { - if (value == null) { - return null; - } - UnionStringLiteralPropertyProperty[] items = UnionStringLiteralPropertyProperty.values(); - for (UnionStringLiteralPropertyProperty item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/package-info.java deleted file mode 100644 index 44d948e83d3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Optional. - * Illustrates models with optional properties. - * - */ -package type.property.optional.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/package-info.java deleted file mode 100644 index d28f3d60234..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Optional. - * Illustrates models with optional properties. - * - */ -package type.property.optional; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralAsyncClient.java deleted file mode 100644 index 257fd6e1b31..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.BooleanLiteralsImpl; -import type.property.valuetypes.models.BooleanLiteralProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class BooleanLiteralAsyncClient { - @Generated - private final BooleanLiteralsImpl serviceClient; - - /** - * Initializes an instance of BooleanLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BooleanLiteralAsyncClient(BooleanLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BooleanLiteralProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(BooleanLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralClient.java deleted file mode 100644 index e73faa591b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.BooleanLiteralsImpl; -import type.property.valuetypes.models.BooleanLiteralProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class BooleanLiteralClient { - @Generated - private final BooleanLiteralsImpl serviceClient; - - /** - * Initializes an instance of BooleanLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BooleanLiteralClient(BooleanLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BooleanLiteralProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(BooleanLiteralProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(BooleanLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationAsyncClient.java deleted file mode 100644 index acec6a32e22..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.BooleanOperationsImpl; -import type.property.valuetypes.models.BooleanProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class BooleanOperationAsyncClient { - @Generated - private final BooleanOperationsImpl serviceClient; - - /** - * Initializes an instance of BooleanOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BooleanOperationAsyncClient(BooleanOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BooleanProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(BooleanProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationClient.java deleted file mode 100644 index fe86e922450..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.BooleanOperationsImpl; -import type.property.valuetypes.models.BooleanProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class BooleanOperationClient { - @Generated - private final BooleanOperationsImpl serviceClient; - - /** - * Initializes an instance of BooleanOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BooleanOperationClient(BooleanOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BooleanProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(BooleanProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(BooleanProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesAsyncClient.java deleted file mode 100644 index d504e2423a0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.BytesImpl; -import type.property.valuetypes.models.BytesProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class BytesAsyncClient { - @Generated - private final BytesImpl serviceClient; - - /** - * Initializes an instance of BytesAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BytesAsyncClient(BytesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BytesProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(BytesProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesClient.java deleted file mode 100644 index 7a4d99fa1e8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.BytesImpl; -import type.property.valuetypes.models.BytesProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class BytesClient { - @Generated - private final BytesImpl serviceClient; - - /** - * Initializes an instance of BytesClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BytesClient(BytesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BytesProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(BytesProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(BytesProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntAsyncClient.java deleted file mode 100644 index 0910790dad3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntAsyncClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.CollectionsIntsImpl; -import type.property.valuetypes.models.CollectionsIntProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class CollectionsIntAsyncClient { - @Generated - private final CollectionsIntsImpl serviceClient; - - /** - * Initializes an instance of CollectionsIntAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsIntAsyncClient(CollectionsIntsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsIntProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(CollectionsIntProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntClient.java deleted file mode 100644 index 9c128f7e3c9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.CollectionsIntsImpl; -import type.property.valuetypes.models.CollectionsIntProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class CollectionsIntClient { - @Generated - private final CollectionsIntsImpl serviceClient; - - /** - * Initializes an instance of CollectionsIntClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsIntClient(CollectionsIntsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsIntProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(CollectionsIntProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(CollectionsIntProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelAsyncClient.java deleted file mode 100644 index 2dc7043cb00..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelAsyncClient.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.CollectionsModelsImpl; -import type.property.valuetypes.models.CollectionsModelProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class CollectionsModelAsyncClient { - @Generated - private final CollectionsModelsImpl serviceClient; - - /** - * Initializes an instance of CollectionsModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsModelAsyncClient(CollectionsModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *          (Required){
-     *             property: String (Required)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *          (Required){
-     *             property: String (Required)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsModelProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(CollectionsModelProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelClient.java deleted file mode 100644 index 15c3d9f5d95..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.CollectionsModelsImpl; -import type.property.valuetypes.models.CollectionsModelProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class CollectionsModelClient { - @Generated - private final CollectionsModelsImpl serviceClient; - - /** - * Initializes an instance of CollectionsModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsModelClient(CollectionsModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *          (Required){
-     *             property: String (Required)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *          (Required){
-     *             property: String (Required)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsModelProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(CollectionsModelProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(CollectionsModelProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringAsyncClient.java deleted file mode 100644 index b6e472a64cc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringAsyncClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.CollectionsStringsImpl; -import type.property.valuetypes.models.CollectionsStringProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class CollectionsStringAsyncClient { - @Generated - private final CollectionsStringsImpl serviceClient; - - /** - * Initializes an instance of CollectionsStringAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsStringAsyncClient(CollectionsStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(CollectionsStringProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(CollectionsStringProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringClient.java deleted file mode 100644 index 74093195e00..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.CollectionsStringsImpl; -import type.property.valuetypes.models.CollectionsStringProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class CollectionsStringClient { - @Generated - private final CollectionsStringsImpl serviceClient; - - /** - * Initializes an instance of CollectionsStringClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - CollectionsStringClient(CollectionsStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public CollectionsStringProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(CollectionsStringProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(CollectionsStringProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationAsyncClient.java deleted file mode 100644 index 464801eee86..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.DatetimeOperationsImpl; -import type.property.valuetypes.models.DatetimeProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class DatetimeOperationAsyncClient { - @Generated - private final DatetimeOperationsImpl serviceClient; - - /** - * Initializes an instance of DatetimeOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DatetimeOperationAsyncClient(DatetimeOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DatetimeProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(DatetimeProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationClient.java deleted file mode 100644 index 0e28cd46928..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.DatetimeOperationsImpl; -import type.property.valuetypes.models.DatetimeProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class DatetimeOperationClient { - @Generated - private final DatetimeOperationsImpl serviceClient; - - /** - * Initializes an instance of DatetimeOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DatetimeOperationClient(DatetimeOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DatetimeProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(DatetimeProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(DatetimeProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128AsyncClient.java deleted file mode 100644 index 937c62070a1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128AsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.Decimal128sImpl; -import type.property.valuetypes.models.Decimal128Property; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class Decimal128AsyncClient { - @Generated - private final Decimal128sImpl serviceClient; - - /** - * Initializes an instance of Decimal128AsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Decimal128AsyncClient(Decimal128sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Decimal128Property.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(Decimal128Property body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128Client.java deleted file mode 100644 index db977c18f52..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128Client.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.Decimal128sImpl; -import type.property.valuetypes.models.Decimal128Property; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class Decimal128Client { - @Generated - private final Decimal128sImpl serviceClient; - - /** - * Initializes an instance of Decimal128Client class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Decimal128Client(Decimal128sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Decimal128Property get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(Decimal128Property.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(Decimal128Property body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalAsyncClient.java deleted file mode 100644 index c0a245e6fd3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.DecimalsImpl; -import type.property.valuetypes.models.DecimalProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class DecimalAsyncClient { - @Generated - private final DecimalsImpl serviceClient; - - /** - * Initializes an instance of DecimalAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DecimalAsyncClient(DecimalsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DecimalProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(DecimalProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalClient.java deleted file mode 100644 index 0a0d4bb7572..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.DecimalsImpl; -import type.property.valuetypes.models.DecimalProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class DecimalClient { - @Generated - private final DecimalsImpl serviceClient; - - /** - * Initializes an instance of DecimalClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DecimalClient(DecimalsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DecimalProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(DecimalProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(DecimalProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringAsyncClient.java deleted file mode 100644 index 67e677f9ec7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringAsyncClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.DictionaryStringsImpl; -import type.property.valuetypes.models.DictionaryStringProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class DictionaryStringAsyncClient { - @Generated - private final DictionaryStringsImpl serviceClient; - - /** - * Initializes an instance of DictionaryStringAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DictionaryStringAsyncClient(DictionaryStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DictionaryStringProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(DictionaryStringProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringClient.java deleted file mode 100644 index 7a1795cc309..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.DictionaryStringsImpl; -import type.property.valuetypes.models.DictionaryStringProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class DictionaryStringClient { - @Generated - private final DictionaryStringsImpl serviceClient; - - /** - * Initializes an instance of DictionaryStringClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DictionaryStringClient(DictionaryStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DictionaryStringProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(DictionaryStringProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(DictionaryStringProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationAsyncClient.java deleted file mode 100644 index df025c1be88..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.DurationOperationsImpl; -import type.property.valuetypes.models.DurationProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class DurationOperationAsyncClient { - @Generated - private final DurationOperationsImpl serviceClient; - - /** - * Initializes an instance of DurationOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DurationOperationAsyncClient(DurationOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(DurationProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(DurationProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationClient.java deleted file mode 100644 index d8669e6dcae..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.DurationOperationsImpl; -import type.property.valuetypes.models.DurationProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class DurationOperationClient { - @Generated - private final DurationOperationsImpl serviceClient; - - /** - * Initializes an instance of DurationOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DurationOperationClient(DurationOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public DurationProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(DurationProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(DurationProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumAsyncClient.java deleted file mode 100644 index e9decfe2742..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.EnumsImpl; -import type.property.valuetypes.models.EnumProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class EnumAsyncClient { - @Generated - private final EnumsImpl serviceClient; - - /** - * Initializes an instance of EnumAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnumAsyncClient(EnumsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(EnumProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(EnumProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumClient.java deleted file mode 100644 index 7fb0a385291..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.EnumsImpl; -import type.property.valuetypes.models.EnumProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class EnumClient { - @Generated - private final EnumsImpl serviceClient; - - /** - * Initializes an instance of EnumClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnumClient(EnumsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public EnumProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(EnumProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(EnumProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumAsyncClient.java deleted file mode 100644 index 60ad21da1e5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.ExtensibleEnumsImpl; -import type.property.valuetypes.models.ExtensibleEnumProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class ExtensibleEnumAsyncClient { - @Generated - private final ExtensibleEnumsImpl serviceClient; - - /** - * Initializes an instance of ExtensibleEnumAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtensibleEnumAsyncClient(ExtensibleEnumsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ExtensibleEnumProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(ExtensibleEnumProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumClient.java deleted file mode 100644 index 7e8fd209b76..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.ExtensibleEnumsImpl; -import type.property.valuetypes.models.ExtensibleEnumProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class ExtensibleEnumClient { - @Generated - private final ExtensibleEnumsImpl serviceClient; - - /** - * Initializes an instance of ExtensibleEnumClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ExtensibleEnumClient(ExtensibleEnumsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ExtensibleEnumProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ExtensibleEnumProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(ExtensibleEnumProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralAsyncClient.java deleted file mode 100644 index 6fd89ca345b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.FloatLiteralsImpl; -import type.property.valuetypes.models.FloatLiteralProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class FloatLiteralAsyncClient { - @Generated - private final FloatLiteralsImpl serviceClient; - - /** - * Initializes an instance of FloatLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FloatLiteralAsyncClient(FloatLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FloatLiteralProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(FloatLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralClient.java deleted file mode 100644 index c5353dfca5d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.FloatLiteralsImpl; -import type.property.valuetypes.models.FloatLiteralProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class FloatLiteralClient { - @Generated - private final FloatLiteralsImpl serviceClient; - - /** - * Initializes an instance of FloatLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FloatLiteralClient(FloatLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FloatLiteralProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(FloatLiteralProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(FloatLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationAsyncClient.java deleted file mode 100644 index 8a88c6424d4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.FloatOperationsImpl; -import type.property.valuetypes.models.FloatProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class FloatOperationAsyncClient { - @Generated - private final FloatOperationsImpl serviceClient; - - /** - * Initializes an instance of FloatOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FloatOperationAsyncClient(FloatOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(FloatProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(FloatProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationClient.java deleted file mode 100644 index adf2ce0adf6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.FloatOperationsImpl; -import type.property.valuetypes.models.FloatProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class FloatOperationClient { - @Generated - private final FloatOperationsImpl serviceClient; - - /** - * Initializes an instance of FloatOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FloatOperationClient(FloatOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public FloatProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(FloatProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(FloatProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntAsyncClient.java deleted file mode 100644 index cc01bc396dc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.IntsImpl; -import type.property.valuetypes.models.IntProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class IntAsyncClient { - @Generated - private final IntsImpl serviceClient; - - /** - * Initializes an instance of IntAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IntAsyncClient(IntsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(IntProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(IntProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntClient.java deleted file mode 100644 index 443421301a6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.IntsImpl; -import type.property.valuetypes.models.IntProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class IntClient { - @Generated - private final IntsImpl serviceClient; - - /** - * Initializes an instance of IntClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IntClient(IntsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public IntProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(IntProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(IntProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralAsyncClient.java deleted file mode 100644 index 81992421f96..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.IntLiteralsImpl; -import type.property.valuetypes.models.IntLiteralProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class IntLiteralAsyncClient { - @Generated - private final IntLiteralsImpl serviceClient; - - /** - * Initializes an instance of IntLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IntLiteralAsyncClient(IntLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(IntLiteralProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(IntLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralClient.java deleted file mode 100644 index 24682c28370..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.IntLiteralsImpl; -import type.property.valuetypes.models.IntLiteralProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class IntLiteralClient { - @Generated - private final IntLiteralsImpl serviceClient; - - /** - * Initializes an instance of IntLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IntLiteralClient(IntLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public IntLiteralProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(IntLiteralProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(IntLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelAsyncClient.java deleted file mode 100644 index 5c06dde3802..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelAsyncClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.ModelsImpl; -import type.property.valuetypes.models.ModelProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class ModelAsyncClient { - @Generated - private final ModelsImpl serviceClient; - - /** - * Initializes an instance of ModelAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelAsyncClient(ModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         property: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         property: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(ModelProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelClient.java deleted file mode 100644 index 3b59f65f480..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.ModelsImpl; -import type.property.valuetypes.models.ModelProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class ModelClient { - @Generated - private final ModelsImpl serviceClient; - - /** - * Initializes an instance of ModelClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelClient(ModelsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         property: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         property: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ModelProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(ModelProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverAsyncClient.java deleted file mode 100644 index 9ee16bba40b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverAsyncClient.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.NeversImpl; -import type.property.valuetypes.models.NeverProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class NeverAsyncClient { - @Generated - private final NeversImpl serviceClient; - - /** - * Initializes an instance of NeverAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NeverAsyncClient(NeversImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(NeverProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(NeverProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverClient.java deleted file mode 100644 index 4f8fc2b6082..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverClient.java +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.NeversImpl; -import type.property.valuetypes.models.NeverProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class NeverClient { - @Generated - private final NeversImpl serviceClient; - - /** - * Initializes an instance of NeverClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NeverClient(NeversImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public NeverProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(NeverProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(NeverProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralAsyncClient.java deleted file mode 100644 index 5ef3cd57db0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.StringLiteralsImpl; -import type.property.valuetypes.models.StringLiteralProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class StringLiteralAsyncClient { - @Generated - private final StringLiteralsImpl serviceClient; - - /** - * Initializes an instance of StringLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringLiteralAsyncClient(StringLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(StringLiteralProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(StringLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralClient.java deleted file mode 100644 index 1392a584ca8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.StringLiteralsImpl; -import type.property.valuetypes.models.StringLiteralProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class StringLiteralClient { - @Generated - private final StringLiteralsImpl serviceClient; - - /** - * Initializes an instance of StringLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringLiteralClient(StringLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public StringLiteralProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(StringLiteralProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(StringLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationAsyncClient.java deleted file mode 100644 index b53bac74036..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.StringOperationsImpl; -import type.property.valuetypes.models.StringProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class StringOperationAsyncClient { - @Generated - private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationAsyncClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(StringProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(StringProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationClient.java deleted file mode 100644 index 3344a312fba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.StringOperationsImpl; -import type.property.valuetypes.models.StringProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class StringOperationClient { - @Generated - private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public StringProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(StringProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(StringProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueAsyncClient.java deleted file mode 100644 index 5090dabadab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.UnionEnumValuesImpl; -import type.property.valuetypes.models.UnionEnumValueProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class UnionEnumValueAsyncClient { - @Generated - private final UnionEnumValuesImpl serviceClient; - - /** - * Initializes an instance of UnionEnumValueAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionEnumValueAsyncClient(UnionEnumValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(value2) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(value2) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnionEnumValueProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(UnionEnumValueProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueClient.java deleted file mode 100644 index 3509d918976..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.UnionEnumValuesImpl; -import type.property.valuetypes.models.UnionEnumValueProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class UnionEnumValueClient { - @Generated - private final UnionEnumValuesImpl serviceClient; - - /** - * Initializes an instance of UnionEnumValueClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionEnumValueClient(UnionEnumValuesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(value2) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(value2) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnionEnumValueProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(UnionEnumValueProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(UnionEnumValueProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralAsyncClient.java deleted file mode 100644 index cdecf563fd1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.UnionFloatLiteralsImpl; -import type.property.valuetypes.models.UnionFloatLiteralProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class UnionFloatLiteralAsyncClient { - @Generated - private final UnionFloatLiteralsImpl serviceClient; - - /** - * Initializes an instance of UnionFloatLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionFloatLiteralAsyncClient(UnionFloatLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(43.125/46.875) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(43.125/46.875) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnionFloatLiteralProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(UnionFloatLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralClient.java deleted file mode 100644 index 46d85a2a14b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.UnionFloatLiteralsImpl; -import type.property.valuetypes.models.UnionFloatLiteralProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class UnionFloatLiteralClient { - @Generated - private final UnionFloatLiteralsImpl serviceClient; - - /** - * Initializes an instance of UnionFloatLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionFloatLiteralClient(UnionFloatLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(43.125/46.875) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(43.125/46.875) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnionFloatLiteralProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(UnionFloatLiteralProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(UnionFloatLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralAsyncClient.java deleted file mode 100644 index 247f2d7bf90..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.UnionIntLiteralsImpl; -import type.property.valuetypes.models.UnionIntLiteralProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class UnionIntLiteralAsyncClient { - @Generated - private final UnionIntLiteralsImpl serviceClient; - - /** - * Initializes an instance of UnionIntLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionIntLiteralAsyncClient(UnionIntLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(42/43) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(42/43) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnionIntLiteralProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(UnionIntLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralClient.java deleted file mode 100644 index 93b868a78a8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.UnionIntLiteralsImpl; -import type.property.valuetypes.models.UnionIntLiteralProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class UnionIntLiteralClient { - @Generated - private final UnionIntLiteralsImpl serviceClient; - - /** - * Initializes an instance of UnionIntLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionIntLiteralClient(UnionIntLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(42/43) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(42/43) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnionIntLiteralProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(UnionIntLiteralProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(UnionIntLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralAsyncClient.java deleted file mode 100644 index 3316d68e567..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.UnionStringLiteralsImpl; -import type.property.valuetypes.models.UnionStringLiteralProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class UnionStringLiteralAsyncClient { - @Generated - private final UnionStringLiteralsImpl serviceClient; - - /** - * Initializes an instance of UnionStringLiteralAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionStringLiteralAsyncClient(UnionStringLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnionStringLiteralProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(UnionStringLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralClient.java deleted file mode 100644 index 62c49e85731..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.UnionStringLiteralsImpl; -import type.property.valuetypes.models.UnionStringLiteralProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class UnionStringLiteralClient { - @Generated - private final UnionStringLiteralsImpl serviceClient; - - /** - * Initializes an instance of UnionStringLiteralClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnionStringLiteralClient(UnionStringLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnionStringLiteralProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(UnionStringLiteralProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(UnionStringLiteralProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayAsyncClient.java deleted file mode 100644 index 370a3785822..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.UnknownArraysImpl; -import type.property.valuetypes.models.UnknownArrayProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class UnknownArrayAsyncClient { - @Generated - private final UnknownArraysImpl serviceClient; - - /** - * Initializes an instance of UnknownArrayAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownArrayAsyncClient(UnknownArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnknownArrayProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(UnknownArrayProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayClient.java deleted file mode 100644 index c9b24de63b0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.UnknownArraysImpl; -import type.property.valuetypes.models.UnknownArrayProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class UnknownArrayClient { - @Generated - private final UnknownArraysImpl serviceClient; - - /** - * Initializes an instance of UnknownArrayClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownArrayClient(UnknownArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnknownArrayProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(UnknownArrayProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(UnknownArrayProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictAsyncClient.java deleted file mode 100644 index 51876b76ba7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.UnknownDictsImpl; -import type.property.valuetypes.models.UnknownDictProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class UnknownDictAsyncClient { - @Generated - private final UnknownDictsImpl serviceClient; - - /** - * Initializes an instance of UnknownDictAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownDictAsyncClient(UnknownDictsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnknownDictProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(UnknownDictProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictClient.java deleted file mode 100644 index ea45edc46b8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.UnknownDictsImpl; -import type.property.valuetypes.models.UnknownDictProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class UnknownDictClient { - @Generated - private final UnknownDictsImpl serviceClient; - - /** - * Initializes an instance of UnknownDictClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownDictClient(UnknownDictsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnknownDictProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(UnknownDictProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(UnknownDictProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntAsyncClient.java deleted file mode 100644 index 9a999c47093..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.UnknownIntsImpl; -import type.property.valuetypes.models.UnknownIntProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class UnknownIntAsyncClient { - @Generated - private final UnknownIntsImpl serviceClient; - - /** - * Initializes an instance of UnknownIntAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownIntAsyncClient(UnknownIntsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnknownIntProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(UnknownIntProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntClient.java deleted file mode 100644 index b0001613606..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.UnknownIntsImpl; -import type.property.valuetypes.models.UnknownIntProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class UnknownIntClient { - @Generated - private final UnknownIntsImpl serviceClient; - - /** - * Initializes an instance of UnknownIntClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownIntClient(UnknownIntsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnknownIntProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(UnknownIntProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(UnknownIntProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringAsyncClient.java deleted file mode 100644 index 21c6fd67676..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringAsyncClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.property.valuetypes.implementation.UnknownStringsImpl; -import type.property.valuetypes.models.UnknownStringProperty; - -/** - * Initializes a new instance of the asynchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) -public final class UnknownStringAsyncClient { - @Generated - private final UnknownStringsImpl serviceClient; - - /** - * Initializes an instance of UnknownStringAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownStringAsyncClient(UnknownStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(UnknownStringProperty.class)); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(UnknownStringProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringClient.java deleted file mode 100644 index c8cebe3b243..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringClient.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.property.valuetypes.implementation.UnknownStringsImpl; -import type.property.valuetypes.models.UnknownStringProperty; - -/** - * Initializes a new instance of the synchronous ValueTypesClient type. - */ -@ServiceClient(builder = ValueTypesClientBuilder.class) -public final class UnknownStringClient { - @Generated - private final UnknownStringsImpl serviceClient; - - /** - * Initializes an instance of UnknownStringClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownStringClient(UnknownStringsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * Get call. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return call. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public UnknownStringProperty get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(UnknownStringProperty.class); - } - - /** - * Put operation. - * - * @param body body. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(UnknownStringProperty body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ValueTypesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ValueTypesClientBuilder.java deleted file mode 100644 index 59ed21e1f79..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ValueTypesClientBuilder.java +++ /dev/null @@ -1,907 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.property.valuetypes.implementation.ValueTypesClientImpl; - -/** - * A builder for creating a new instance of the ValueTypesClient type. - */ -@ServiceClientBuilder( - serviceClients = { - BooleanOperationClient.class, - StringOperationClient.class, - BytesClient.class, - IntClient.class, - FloatOperationClient.class, - DecimalClient.class, - Decimal128Client.class, - DatetimeOperationClient.class, - DurationOperationClient.class, - EnumClient.class, - ExtensibleEnumClient.class, - ModelClient.class, - CollectionsStringClient.class, - CollectionsIntClient.class, - CollectionsModelClient.class, - DictionaryStringClient.class, - NeverClient.class, - UnknownStringClient.class, - UnknownIntClient.class, - UnknownDictClient.class, - UnknownArrayClient.class, - StringLiteralClient.class, - IntLiteralClient.class, - FloatLiteralClient.class, - BooleanLiteralClient.class, - UnionStringLiteralClient.class, - UnionIntLiteralClient.class, - UnionFloatLiteralClient.class, - UnionEnumValueClient.class, - BooleanOperationAsyncClient.class, - StringOperationAsyncClient.class, - BytesAsyncClient.class, - IntAsyncClient.class, - FloatOperationAsyncClient.class, - DecimalAsyncClient.class, - Decimal128AsyncClient.class, - DatetimeOperationAsyncClient.class, - DurationOperationAsyncClient.class, - EnumAsyncClient.class, - ExtensibleEnumAsyncClient.class, - ModelAsyncClient.class, - CollectionsStringAsyncClient.class, - CollectionsIntAsyncClient.class, - CollectionsModelAsyncClient.class, - DictionaryStringAsyncClient.class, - NeverAsyncClient.class, - UnknownStringAsyncClient.class, - UnknownIntAsyncClient.class, - UnknownDictAsyncClient.class, - UnknownArrayAsyncClient.class, - StringLiteralAsyncClient.class, - IntLiteralAsyncClient.class, - FloatLiteralAsyncClient.class, - BooleanLiteralAsyncClient.class, - UnionStringLiteralAsyncClient.class, - UnionIntLiteralAsyncClient.class, - UnionFloatLiteralAsyncClient.class, - UnionEnumValueAsyncClient.class }) -public final class ValueTypesClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("type-property-valuetypes.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ValueTypesClientBuilder. - */ - @Generated - public ValueTypesClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ValueTypesClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ValueTypesClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ValueTypesClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ValueTypesClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ValueTypesClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ValueTypesClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ValueTypesClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ValueTypesClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ValueTypesClientBuilder. - */ - @Generated - public ValueTypesClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ValueTypesClientImpl with the provided parameters. - * - * @return an instance of ValueTypesClientImpl. - */ - @Generated - private ValueTypesClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ValueTypesClientImpl client - = new ValueTypesClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of BooleanOperationAsyncClient class. - * - * @return an instance of BooleanOperationAsyncClient. - */ - @Generated - public BooleanOperationAsyncClient buildBooleanOperationAsyncClient() { - return new BooleanOperationAsyncClient(buildInnerClient().getBooleanOperations()); - } - - /** - * Builds an instance of StringOperationAsyncClient class. - * - * @return an instance of StringOperationAsyncClient. - */ - @Generated - public StringOperationAsyncClient buildStringOperationAsyncClient() { - return new StringOperationAsyncClient(buildInnerClient().getStringOperations()); - } - - /** - * Builds an instance of BytesAsyncClient class. - * - * @return an instance of BytesAsyncClient. - */ - @Generated - public BytesAsyncClient buildBytesAsyncClient() { - return new BytesAsyncClient(buildInnerClient().getBytes()); - } - - /** - * Builds an instance of IntAsyncClient class. - * - * @return an instance of IntAsyncClient. - */ - @Generated - public IntAsyncClient buildIntAsyncClient() { - return new IntAsyncClient(buildInnerClient().getInts()); - } - - /** - * Builds an instance of FloatOperationAsyncClient class. - * - * @return an instance of FloatOperationAsyncClient. - */ - @Generated - public FloatOperationAsyncClient buildFloatOperationAsyncClient() { - return new FloatOperationAsyncClient(buildInnerClient().getFloatOperations()); - } - - /** - * Builds an instance of DecimalAsyncClient class. - * - * @return an instance of DecimalAsyncClient. - */ - @Generated - public DecimalAsyncClient buildDecimalAsyncClient() { - return new DecimalAsyncClient(buildInnerClient().getDecimals()); - } - - /** - * Builds an instance of Decimal128AsyncClient class. - * - * @return an instance of Decimal128AsyncClient. - */ - @Generated - public Decimal128AsyncClient buildDecimal128AsyncClient() { - return new Decimal128AsyncClient(buildInnerClient().getDecimal128s()); - } - - /** - * Builds an instance of DatetimeOperationAsyncClient class. - * - * @return an instance of DatetimeOperationAsyncClient. - */ - @Generated - public DatetimeOperationAsyncClient buildDatetimeOperationAsyncClient() { - return new DatetimeOperationAsyncClient(buildInnerClient().getDatetimeOperations()); - } - - /** - * Builds an instance of DurationOperationAsyncClient class. - * - * @return an instance of DurationOperationAsyncClient. - */ - @Generated - public DurationOperationAsyncClient buildDurationOperationAsyncClient() { - return new DurationOperationAsyncClient(buildInnerClient().getDurationOperations()); - } - - /** - * Builds an instance of EnumAsyncClient class. - * - * @return an instance of EnumAsyncClient. - */ - @Generated - public EnumAsyncClient buildEnumAsyncClient() { - return new EnumAsyncClient(buildInnerClient().getEnums()); - } - - /** - * Builds an instance of ExtensibleEnumAsyncClient class. - * - * @return an instance of ExtensibleEnumAsyncClient. - */ - @Generated - public ExtensibleEnumAsyncClient buildExtensibleEnumAsyncClient() { - return new ExtensibleEnumAsyncClient(buildInnerClient().getExtensibleEnums()); - } - - /** - * Builds an instance of ModelAsyncClient class. - * - * @return an instance of ModelAsyncClient. - */ - @Generated - public ModelAsyncClient buildModelAsyncClient() { - return new ModelAsyncClient(buildInnerClient().getModels()); - } - - /** - * Builds an instance of CollectionsStringAsyncClient class. - * - * @return an instance of CollectionsStringAsyncClient. - */ - @Generated - public CollectionsStringAsyncClient buildCollectionsStringAsyncClient() { - return new CollectionsStringAsyncClient(buildInnerClient().getCollectionsStrings()); - } - - /** - * Builds an instance of CollectionsIntAsyncClient class. - * - * @return an instance of CollectionsIntAsyncClient. - */ - @Generated - public CollectionsIntAsyncClient buildCollectionsIntAsyncClient() { - return new CollectionsIntAsyncClient(buildInnerClient().getCollectionsInts()); - } - - /** - * Builds an instance of CollectionsModelAsyncClient class. - * - * @return an instance of CollectionsModelAsyncClient. - */ - @Generated - public CollectionsModelAsyncClient buildCollectionsModelAsyncClient() { - return new CollectionsModelAsyncClient(buildInnerClient().getCollectionsModels()); - } - - /** - * Builds an instance of DictionaryStringAsyncClient class. - * - * @return an instance of DictionaryStringAsyncClient. - */ - @Generated - public DictionaryStringAsyncClient buildDictionaryStringAsyncClient() { - return new DictionaryStringAsyncClient(buildInnerClient().getDictionaryStrings()); - } - - /** - * Builds an instance of NeverAsyncClient class. - * - * @return an instance of NeverAsyncClient. - */ - @Generated - public NeverAsyncClient buildNeverAsyncClient() { - return new NeverAsyncClient(buildInnerClient().getNevers()); - } - - /** - * Builds an instance of UnknownStringAsyncClient class. - * - * @return an instance of UnknownStringAsyncClient. - */ - @Generated - public UnknownStringAsyncClient buildUnknownStringAsyncClient() { - return new UnknownStringAsyncClient(buildInnerClient().getUnknownStrings()); - } - - /** - * Builds an instance of UnknownIntAsyncClient class. - * - * @return an instance of UnknownIntAsyncClient. - */ - @Generated - public UnknownIntAsyncClient buildUnknownIntAsyncClient() { - return new UnknownIntAsyncClient(buildInnerClient().getUnknownInts()); - } - - /** - * Builds an instance of UnknownDictAsyncClient class. - * - * @return an instance of UnknownDictAsyncClient. - */ - @Generated - public UnknownDictAsyncClient buildUnknownDictAsyncClient() { - return new UnknownDictAsyncClient(buildInnerClient().getUnknownDicts()); - } - - /** - * Builds an instance of UnknownArrayAsyncClient class. - * - * @return an instance of UnknownArrayAsyncClient. - */ - @Generated - public UnknownArrayAsyncClient buildUnknownArrayAsyncClient() { - return new UnknownArrayAsyncClient(buildInnerClient().getUnknownArrays()); - } - - /** - * Builds an instance of StringLiteralAsyncClient class. - * - * @return an instance of StringLiteralAsyncClient. - */ - @Generated - public StringLiteralAsyncClient buildStringLiteralAsyncClient() { - return new StringLiteralAsyncClient(buildInnerClient().getStringLiterals()); - } - - /** - * Builds an instance of IntLiteralAsyncClient class. - * - * @return an instance of IntLiteralAsyncClient. - */ - @Generated - public IntLiteralAsyncClient buildIntLiteralAsyncClient() { - return new IntLiteralAsyncClient(buildInnerClient().getIntLiterals()); - } - - /** - * Builds an instance of FloatLiteralAsyncClient class. - * - * @return an instance of FloatLiteralAsyncClient. - */ - @Generated - public FloatLiteralAsyncClient buildFloatLiteralAsyncClient() { - return new FloatLiteralAsyncClient(buildInnerClient().getFloatLiterals()); - } - - /** - * Builds an instance of BooleanLiteralAsyncClient class. - * - * @return an instance of BooleanLiteralAsyncClient. - */ - @Generated - public BooleanLiteralAsyncClient buildBooleanLiteralAsyncClient() { - return new BooleanLiteralAsyncClient(buildInnerClient().getBooleanLiterals()); - } - - /** - * Builds an instance of UnionStringLiteralAsyncClient class. - * - * @return an instance of UnionStringLiteralAsyncClient. - */ - @Generated - public UnionStringLiteralAsyncClient buildUnionStringLiteralAsyncClient() { - return new UnionStringLiteralAsyncClient(buildInnerClient().getUnionStringLiterals()); - } - - /** - * Builds an instance of UnionIntLiteralAsyncClient class. - * - * @return an instance of UnionIntLiteralAsyncClient. - */ - @Generated - public UnionIntLiteralAsyncClient buildUnionIntLiteralAsyncClient() { - return new UnionIntLiteralAsyncClient(buildInnerClient().getUnionIntLiterals()); - } - - /** - * Builds an instance of UnionFloatLiteralAsyncClient class. - * - * @return an instance of UnionFloatLiteralAsyncClient. - */ - @Generated - public UnionFloatLiteralAsyncClient buildUnionFloatLiteralAsyncClient() { - return new UnionFloatLiteralAsyncClient(buildInnerClient().getUnionFloatLiterals()); - } - - /** - * Builds an instance of UnionEnumValueAsyncClient class. - * - * @return an instance of UnionEnumValueAsyncClient. - */ - @Generated - public UnionEnumValueAsyncClient buildUnionEnumValueAsyncClient() { - return new UnionEnumValueAsyncClient(buildInnerClient().getUnionEnumValues()); - } - - /** - * Builds an instance of BooleanOperationClient class. - * - * @return an instance of BooleanOperationClient. - */ - @Generated - public BooleanOperationClient buildBooleanOperationClient() { - return new BooleanOperationClient(buildInnerClient().getBooleanOperations()); - } - - /** - * Builds an instance of StringOperationClient class. - * - * @return an instance of StringOperationClient. - */ - @Generated - public StringOperationClient buildStringOperationClient() { - return new StringOperationClient(buildInnerClient().getStringOperations()); - } - - /** - * Builds an instance of BytesClient class. - * - * @return an instance of BytesClient. - */ - @Generated - public BytesClient buildBytesClient() { - return new BytesClient(buildInnerClient().getBytes()); - } - - /** - * Builds an instance of IntClient class. - * - * @return an instance of IntClient. - */ - @Generated - public IntClient buildIntClient() { - return new IntClient(buildInnerClient().getInts()); - } - - /** - * Builds an instance of FloatOperationClient class. - * - * @return an instance of FloatOperationClient. - */ - @Generated - public FloatOperationClient buildFloatOperationClient() { - return new FloatOperationClient(buildInnerClient().getFloatOperations()); - } - - /** - * Builds an instance of DecimalClient class. - * - * @return an instance of DecimalClient. - */ - @Generated - public DecimalClient buildDecimalClient() { - return new DecimalClient(buildInnerClient().getDecimals()); - } - - /** - * Builds an instance of Decimal128Client class. - * - * @return an instance of Decimal128Client. - */ - @Generated - public Decimal128Client buildDecimal128Client() { - return new Decimal128Client(buildInnerClient().getDecimal128s()); - } - - /** - * Builds an instance of DatetimeOperationClient class. - * - * @return an instance of DatetimeOperationClient. - */ - @Generated - public DatetimeOperationClient buildDatetimeOperationClient() { - return new DatetimeOperationClient(buildInnerClient().getDatetimeOperations()); - } - - /** - * Builds an instance of DurationOperationClient class. - * - * @return an instance of DurationOperationClient. - */ - @Generated - public DurationOperationClient buildDurationOperationClient() { - return new DurationOperationClient(buildInnerClient().getDurationOperations()); - } - - /** - * Builds an instance of EnumClient class. - * - * @return an instance of EnumClient. - */ - @Generated - public EnumClient buildEnumClient() { - return new EnumClient(buildInnerClient().getEnums()); - } - - /** - * Builds an instance of ExtensibleEnumClient class. - * - * @return an instance of ExtensibleEnumClient. - */ - @Generated - public ExtensibleEnumClient buildExtensibleEnumClient() { - return new ExtensibleEnumClient(buildInnerClient().getExtensibleEnums()); - } - - /** - * Builds an instance of ModelClient class. - * - * @return an instance of ModelClient. - */ - @Generated - public ModelClient buildModelClient() { - return new ModelClient(buildInnerClient().getModels()); - } - - /** - * Builds an instance of CollectionsStringClient class. - * - * @return an instance of CollectionsStringClient. - */ - @Generated - public CollectionsStringClient buildCollectionsStringClient() { - return new CollectionsStringClient(buildInnerClient().getCollectionsStrings()); - } - - /** - * Builds an instance of CollectionsIntClient class. - * - * @return an instance of CollectionsIntClient. - */ - @Generated - public CollectionsIntClient buildCollectionsIntClient() { - return new CollectionsIntClient(buildInnerClient().getCollectionsInts()); - } - - /** - * Builds an instance of CollectionsModelClient class. - * - * @return an instance of CollectionsModelClient. - */ - @Generated - public CollectionsModelClient buildCollectionsModelClient() { - return new CollectionsModelClient(buildInnerClient().getCollectionsModels()); - } - - /** - * Builds an instance of DictionaryStringClient class. - * - * @return an instance of DictionaryStringClient. - */ - @Generated - public DictionaryStringClient buildDictionaryStringClient() { - return new DictionaryStringClient(buildInnerClient().getDictionaryStrings()); - } - - /** - * Builds an instance of NeverClient class. - * - * @return an instance of NeverClient. - */ - @Generated - public NeverClient buildNeverClient() { - return new NeverClient(buildInnerClient().getNevers()); - } - - /** - * Builds an instance of UnknownStringClient class. - * - * @return an instance of UnknownStringClient. - */ - @Generated - public UnknownStringClient buildUnknownStringClient() { - return new UnknownStringClient(buildInnerClient().getUnknownStrings()); - } - - /** - * Builds an instance of UnknownIntClient class. - * - * @return an instance of UnknownIntClient. - */ - @Generated - public UnknownIntClient buildUnknownIntClient() { - return new UnknownIntClient(buildInnerClient().getUnknownInts()); - } - - /** - * Builds an instance of UnknownDictClient class. - * - * @return an instance of UnknownDictClient. - */ - @Generated - public UnknownDictClient buildUnknownDictClient() { - return new UnknownDictClient(buildInnerClient().getUnknownDicts()); - } - - /** - * Builds an instance of UnknownArrayClient class. - * - * @return an instance of UnknownArrayClient. - */ - @Generated - public UnknownArrayClient buildUnknownArrayClient() { - return new UnknownArrayClient(buildInnerClient().getUnknownArrays()); - } - - /** - * Builds an instance of StringLiteralClient class. - * - * @return an instance of StringLiteralClient. - */ - @Generated - public StringLiteralClient buildStringLiteralClient() { - return new StringLiteralClient(buildInnerClient().getStringLiterals()); - } - - /** - * Builds an instance of IntLiteralClient class. - * - * @return an instance of IntLiteralClient. - */ - @Generated - public IntLiteralClient buildIntLiteralClient() { - return new IntLiteralClient(buildInnerClient().getIntLiterals()); - } - - /** - * Builds an instance of FloatLiteralClient class. - * - * @return an instance of FloatLiteralClient. - */ - @Generated - public FloatLiteralClient buildFloatLiteralClient() { - return new FloatLiteralClient(buildInnerClient().getFloatLiterals()); - } - - /** - * Builds an instance of BooleanLiteralClient class. - * - * @return an instance of BooleanLiteralClient. - */ - @Generated - public BooleanLiteralClient buildBooleanLiteralClient() { - return new BooleanLiteralClient(buildInnerClient().getBooleanLiterals()); - } - - /** - * Builds an instance of UnionStringLiteralClient class. - * - * @return an instance of UnionStringLiteralClient. - */ - @Generated - public UnionStringLiteralClient buildUnionStringLiteralClient() { - return new UnionStringLiteralClient(buildInnerClient().getUnionStringLiterals()); - } - - /** - * Builds an instance of UnionIntLiteralClient class. - * - * @return an instance of UnionIntLiteralClient. - */ - @Generated - public UnionIntLiteralClient buildUnionIntLiteralClient() { - return new UnionIntLiteralClient(buildInnerClient().getUnionIntLiterals()); - } - - /** - * Builds an instance of UnionFloatLiteralClient class. - * - * @return an instance of UnionFloatLiteralClient. - */ - @Generated - public UnionFloatLiteralClient buildUnionFloatLiteralClient() { - return new UnionFloatLiteralClient(buildInnerClient().getUnionFloatLiterals()); - } - - /** - * Builds an instance of UnionEnumValueClient class. - * - * @return an instance of UnionEnumValueClient. - */ - @Generated - public UnionEnumValueClient buildUnionEnumValueClient() { - return new UnionEnumValueClient(buildInnerClient().getUnionEnumValues()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ValueTypesClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanLiteralsImpl.java deleted file mode 100644 index 2f10aabc507..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanLiteralsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in BooleanLiterals. - */ -public final class BooleanLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BooleanLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of BooleanLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BooleanLiteralsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(BooleanLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientBooleanLiterals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientBooleanLiterals") - public interface BooleanLiteralsService { - @Get("/type/property/value-types/boolean/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/boolean/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/boolean/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/boolean/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanOperationsImpl.java deleted file mode 100644 index feb16123ee8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanOperationsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in BooleanOperations. - */ -public final class BooleanOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BooleanOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of BooleanOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BooleanOperationsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(BooleanOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientBooleanOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientBooleanOperations") - public interface BooleanOperationsService { - @Get("/type/property/value-types/boolean") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/boolean") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/boolean") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/boolean") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: boolean (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BytesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BytesImpl.java deleted file mode 100644 index a4438dfd871..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BytesImpl.java +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Bytes. - */ -public final class BytesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BytesService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of BytesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BytesImpl(ValueTypesClientImpl client) { - this.service = RestProxy.create(BytesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientBytes to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientBytes") - public interface BytesService { - @Get("/type/property/value-types/bytes") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/bytes") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/bytes") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/bytes") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: byte[] (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsIntsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsIntsImpl.java deleted file mode 100644 index ea7185bb581..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsIntsImpl.java +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in CollectionsInts. - */ -public final class CollectionsIntsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final CollectionsIntsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of CollectionsIntsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - CollectionsIntsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(CollectionsIntsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientCollectionsInts to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientCollectionsInts") - public interface CollectionsIntsService { - @Get("/type/property/value-types/collections/int") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/collections/int") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/collections/int") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/collections/int") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         int (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsModelsImpl.java deleted file mode 100644 index 6ec4d7806d1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsModelsImpl.java +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in CollectionsModels. - */ -public final class CollectionsModelsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final CollectionsModelsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of CollectionsModelsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - CollectionsModelsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(CollectionsModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientCollectionsModels to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientCollectionsModels") - public interface CollectionsModelsService { - @Get("/type/property/value-types/collections/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/collections/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/collections/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/collections/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *          (Required){
-     *             property: String (Required)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *          (Required){
-     *             property: String (Required)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *          (Required){
-     *             property: String (Required)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *          (Required){
-     *             property: String (Required)
-     *         }
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsStringsImpl.java deleted file mode 100644 index 6a3f8caf66c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsStringsImpl.java +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in CollectionsStrings. - */ -public final class CollectionsStringsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final CollectionsStringsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of CollectionsStringsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - CollectionsStringsImpl(ValueTypesClientImpl client) { - this.service = RestProxy.create(CollectionsStringsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientCollectionsStrings to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientCollectionsStrings") - public interface CollectionsStringsService { - @Get("/type/property/value-types/collections/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/collections/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/collections/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/collections/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): [
-     *         String (Required)
-     *     ]
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DatetimeOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DatetimeOperationsImpl.java deleted file mode 100644 index d6a9daa95bf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DatetimeOperationsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DatetimeOperations. - */ -public final class DatetimeOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DatetimeOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of DatetimeOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DatetimeOperationsImpl(ValueTypesClientImpl client) { - this.service = RestProxy.create(DatetimeOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientDatetimeOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientDatetimeOperations") - public interface DatetimeOperationsService { - @Get("/type/property/value-types/datetime") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/datetime") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/datetime") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/datetime") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: OffsetDateTime (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/Decimal128sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/Decimal128sImpl.java deleted file mode 100644 index 5a6efdc231b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/Decimal128sImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Decimal128s. - */ -public final class Decimal128sImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Decimal128sService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of Decimal128sImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Decimal128sImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(Decimal128sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientDecimal128s to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientDecimal128s") - public interface Decimal128sService { - @Get("/type/property/value-types/decimal128") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/decimal128") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/decimal128") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/decimal128") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DecimalsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DecimalsImpl.java deleted file mode 100644 index a6fe2c704ff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DecimalsImpl.java +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Decimals. - */ -public final class DecimalsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DecimalsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of DecimalsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DecimalsImpl(ValueTypesClientImpl client) { - this.service = RestProxy.create(DecimalsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientDecimals to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientDecimals") - public interface DecimalsService { - @Get("/type/property/value-types/decimal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/decimal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/decimal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/decimal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BigDecimal (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DictionaryStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DictionaryStringsImpl.java deleted file mode 100644 index 99379dae975..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DictionaryStringsImpl.java +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DictionaryStrings. - */ -public final class DictionaryStringsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DictionaryStringsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of DictionaryStringsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DictionaryStringsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(DictionaryStringsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientDictionaryStrings to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientDictionaryStrings") - public interface DictionaryStringsService { - @Get("/type/property/value-types/dictionary/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/dictionary/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/dictionary/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/dictionary/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         String: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DurationOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DurationOperationsImpl.java deleted file mode 100644 index 7d266fb303d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DurationOperationsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DurationOperations. - */ -public final class DurationOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DurationOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of DurationOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DurationOperationsImpl(ValueTypesClientImpl client) { - this.service = RestProxy.create(DurationOperationsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientDurationOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientDurationOperations") - public interface DurationOperationsService { - @Get("/type/property/value-types/duration") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/duration") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/duration") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/duration") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: Duration (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/EnumsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/EnumsImpl.java deleted file mode 100644 index 710e7945c2f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/EnumsImpl.java +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Enums. - */ -public final class EnumsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final EnumsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of EnumsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - EnumsImpl(ValueTypesClientImpl client) { - this.service = RestProxy.create(EnumsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientEnums to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientEnums") - public interface EnumsService { - @Get("/type/property/value-types/enum") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/enum") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/enum") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/enum") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ExtensibleEnumsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ExtensibleEnumsImpl.java deleted file mode 100644 index 9bb9da4c85d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ExtensibleEnumsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ExtensibleEnums. - */ -public final class ExtensibleEnumsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ExtensibleEnumsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of ExtensibleEnumsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ExtensibleEnumsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(ExtensibleEnumsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientExtensibleEnums to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientExtensibleEnums") - public interface ExtensibleEnumsService { - @Get("/type/property/value-types/extensible-enum") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/extensible-enum") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/extensible-enum") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/extensible-enum") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(ValueOne/ValueTwo) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatLiteralsImpl.java deleted file mode 100644 index c3e9adb82b0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatLiteralsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in FloatLiterals. - */ -public final class FloatLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FloatLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of FloatLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FloatLiteralsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(FloatLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientFloatLiterals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientFloatLiterals") - public interface FloatLiteralsService { - @Get("/type/property/value-types/float/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/float/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/float/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/float/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatOperationsImpl.java deleted file mode 100644 index eee81b8e6ca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatOperationsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in FloatOperations. - */ -public final class FloatOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FloatOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of FloatOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FloatOperationsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(FloatOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientFloatOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientFloatOperations") - public interface FloatOperationsService { - @Get("/type/property/value-types/float") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/float") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/float") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/float") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: double (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntLiteralsImpl.java deleted file mode 100644 index 780d6aa8971..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntLiteralsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in IntLiterals. - */ -public final class IntLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final IntLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of IntLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - IntLiteralsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(IntLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientIntLiterals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientIntLiterals") - public interface IntLiteralsService { - @Get("/type/property/value-types/int/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/int/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/int/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/int/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntsImpl.java deleted file mode 100644 index 191b2ff690c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntsImpl.java +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Ints. - */ -public final class IntsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final IntsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of IntsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - IntsImpl(ValueTypesClientImpl client) { - this.service = RestProxy.create(IntsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientInts to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientInts") - public interface IntsService { - @Get("/type/property/value-types/int") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/int") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/int") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/int") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: int (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ModelsImpl.java deleted file mode 100644 index 0b51fe6dba4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ModelsImpl.java +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Models. - */ -public final class ModelsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ModelsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of ModelsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ModelsImpl(ValueTypesClientImpl client) { - this.service = RestProxy.create(ModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientModels to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientModels") - public interface ModelsService { - @Get("/type/property/value-types/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/model") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/model") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         property: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         property: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         property: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property (Required): {
-     *         property: String (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/NeversImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/NeversImpl.java deleted file mode 100644 index f4f2ffbb86d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/NeversImpl.java +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Nevers. - */ -public final class NeversImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NeversService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of NeversImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NeversImpl(ValueTypesClientImpl client) { - this.service = RestProxy.create(NeversService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientNevers to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientNevers") - public interface NeversService { - @Get("/type/property/value-types/never") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/never") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/never") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/never") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringLiteralsImpl.java deleted file mode 100644 index 090022f5c9c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringLiteralsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringLiterals. - */ -public final class StringLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of StringLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringLiteralsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(StringLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientStringLiterals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientStringLiterals") - public interface StringLiteralsService { - @Get("/type/property/value-types/string/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/string/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/string/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/string/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringOperationsImpl.java deleted file mode 100644 index 8f55bc90ad3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringOperationsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringOperations. - */ -public final class StringOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of StringOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringOperationsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(StringOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientStringOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientStringOperations") - public interface StringOperationsService { - @Get("/type/property/value-types/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionEnumValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionEnumValuesImpl.java deleted file mode 100644 index 83f634d472a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionEnumValuesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnionEnumValues. - */ -public final class UnionEnumValuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnionEnumValuesService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of UnionEnumValuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnionEnumValuesImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(UnionEnumValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientUnionEnumValues to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientUnionEnumValues") - public interface UnionEnumValuesService { - @Get("/type/property/value-types/union-enum-value") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/union-enum-value") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/union-enum-value") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/union-enum-value") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(value2) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(value2) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(value2) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(value2) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionFloatLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionFloatLiteralsImpl.java deleted file mode 100644 index 2615c351363..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionFloatLiteralsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnionFloatLiterals. - */ -public final class UnionFloatLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnionFloatLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of UnionFloatLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnionFloatLiteralsImpl(ValueTypesClientImpl client) { - this.service = RestProxy.create(UnionFloatLiteralsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientUnionFloatLiterals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientUnionFloatLiterals") - public interface UnionFloatLiteralsService { - @Get("/type/property/value-types/union/float/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/union/float/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/union/float/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/union/float/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(43.125/46.875) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(43.125/46.875) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(43.125/46.875) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(43.125/46.875) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionIntLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionIntLiteralsImpl.java deleted file mode 100644 index 3dccc0e7500..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionIntLiteralsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnionIntLiterals. - */ -public final class UnionIntLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnionIntLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of UnionIntLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnionIntLiteralsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(UnionIntLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientUnionIntLiterals to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientUnionIntLiterals") - public interface UnionIntLiteralsService { - @Get("/type/property/value-types/union/int/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/union/int/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/union/int/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/union/int/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(42/43) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(42/43) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(42/43) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(42/43) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionStringLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionStringLiteralsImpl.java deleted file mode 100644 index 3e7b94df0c9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionStringLiteralsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnionStringLiterals. - */ -public final class UnionStringLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnionStringLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of UnionStringLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnionStringLiteralsImpl(ValueTypesClientImpl client) { - this.service = RestProxy.create(UnionStringLiteralsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientUnionStringLiterals to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientUnionStringLiterals") - public interface UnionStringLiteralsService { - @Get("/type/property/value-types/union/string/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/union/string/literal") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/union/string/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/union/string/literal") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: String(hello/world) (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownArraysImpl.java deleted file mode 100644 index 44999029889..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownArraysImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnknownArrays. - */ -public final class UnknownArraysImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnknownArraysService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of UnknownArraysImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnknownArraysImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(UnknownArraysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientUnknownArrays to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientUnknownArrays") - public interface UnknownArraysService { - @Get("/type/property/value-types/unknown/array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/unknown/array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/unknown/array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/unknown/array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownDictsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownDictsImpl.java deleted file mode 100644 index 9d3678c1db9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownDictsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnknownDicts. - */ -public final class UnknownDictsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnknownDictsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of UnknownDictsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnknownDictsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(UnknownDictsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientUnknownDicts to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientUnknownDicts") - public interface UnknownDictsService { - @Get("/type/property/value-types/unknown/dict") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/unknown/dict") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/unknown/dict") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/unknown/dict") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownIntsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownIntsImpl.java deleted file mode 100644 index f623cbed5a8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownIntsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnknownInts. - */ -public final class UnknownIntsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnknownIntsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of UnknownIntsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnknownIntsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(UnknownIntsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientUnknownInts to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientUnknownInts") - public interface UnknownIntsService { - @Get("/type/property/value-types/unknown/int") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/unknown/int") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/unknown/int") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/unknown/int") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownStringsImpl.java deleted file mode 100644 index 940ae7a573f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownStringsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in UnknownStrings. - */ -public final class UnknownStringsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnknownStringsService service; - - /** - * The service client containing this operation class. - */ - private final ValueTypesClientImpl client; - - /** - * Initializes an instance of UnknownStringsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnknownStringsImpl(ValueTypesClientImpl client) { - this.service - = RestProxy.create(UnknownStringsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ValueTypesClientUnknownStrings to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ValueTypesClientUnknownStrings") - public interface UnknownStringsService { - @Get("/type/property/value-types/unknown/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/property/value-types/unknown/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/unknown/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/property/value-types/unknown/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * Get call. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return call along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * Put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     property: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body body. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java deleted file mode 100644 index de487bcec45..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java +++ /dev/null @@ -1,527 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 ValueTypesClient type. - */ -public final class ValueTypesClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 BooleanOperationsImpl object to access its operations. - */ - private final BooleanOperationsImpl booleanOperations; - - /** - * Gets the BooleanOperationsImpl object to access its operations. - * - * @return the BooleanOperationsImpl object. - */ - public BooleanOperationsImpl getBooleanOperations() { - return this.booleanOperations; - } - - /** - * The StringOperationsImpl object to access its operations. - */ - private final StringOperationsImpl stringOperations; - - /** - * Gets the StringOperationsImpl object to access its operations. - * - * @return the StringOperationsImpl object. - */ - public StringOperationsImpl getStringOperations() { - return this.stringOperations; - } - - /** - * The BytesImpl object to access its operations. - */ - private final BytesImpl bytes; - - /** - * Gets the BytesImpl object to access its operations. - * - * @return the BytesImpl object. - */ - public BytesImpl getBytes() { - return this.bytes; - } - - /** - * The IntsImpl object to access its operations. - */ - private final IntsImpl ints; - - /** - * Gets the IntsImpl object to access its operations. - * - * @return the IntsImpl object. - */ - public IntsImpl getInts() { - return this.ints; - } - - /** - * The FloatOperationsImpl object to access its operations. - */ - private final FloatOperationsImpl floatOperations; - - /** - * Gets the FloatOperationsImpl object to access its operations. - * - * @return the FloatOperationsImpl object. - */ - public FloatOperationsImpl getFloatOperations() { - return this.floatOperations; - } - - /** - * The DecimalsImpl object to access its operations. - */ - private final DecimalsImpl decimals; - - /** - * Gets the DecimalsImpl object to access its operations. - * - * @return the DecimalsImpl object. - */ - public DecimalsImpl getDecimals() { - return this.decimals; - } - - /** - * The Decimal128sImpl object to access its operations. - */ - private final Decimal128sImpl decimal128s; - - /** - * Gets the Decimal128sImpl object to access its operations. - * - * @return the Decimal128sImpl object. - */ - public Decimal128sImpl getDecimal128s() { - return this.decimal128s; - } - - /** - * The DatetimeOperationsImpl object to access its operations. - */ - private final DatetimeOperationsImpl datetimeOperations; - - /** - * Gets the DatetimeOperationsImpl object to access its operations. - * - * @return the DatetimeOperationsImpl object. - */ - public DatetimeOperationsImpl getDatetimeOperations() { - return this.datetimeOperations; - } - - /** - * The DurationOperationsImpl object to access its operations. - */ - private final DurationOperationsImpl durationOperations; - - /** - * Gets the DurationOperationsImpl object to access its operations. - * - * @return the DurationOperationsImpl object. - */ - public DurationOperationsImpl getDurationOperations() { - return this.durationOperations; - } - - /** - * The EnumsImpl object to access its operations. - */ - private final EnumsImpl enums; - - /** - * Gets the EnumsImpl object to access its operations. - * - * @return the EnumsImpl object. - */ - public EnumsImpl getEnums() { - return this.enums; - } - - /** - * The ExtensibleEnumsImpl object to access its operations. - */ - private final ExtensibleEnumsImpl extensibleEnums; - - /** - * Gets the ExtensibleEnumsImpl object to access its operations. - * - * @return the ExtensibleEnumsImpl object. - */ - public ExtensibleEnumsImpl getExtensibleEnums() { - return this.extensibleEnums; - } - - /** - * The ModelsImpl object to access its operations. - */ - private final ModelsImpl models; - - /** - * Gets the ModelsImpl object to access its operations. - * - * @return the ModelsImpl object. - */ - public ModelsImpl getModels() { - return this.models; - } - - /** - * The CollectionsStringsImpl object to access its operations. - */ - private final CollectionsStringsImpl collectionsStrings; - - /** - * Gets the CollectionsStringsImpl object to access its operations. - * - * @return the CollectionsStringsImpl object. - */ - public CollectionsStringsImpl getCollectionsStrings() { - return this.collectionsStrings; - } - - /** - * The CollectionsIntsImpl object to access its operations. - */ - private final CollectionsIntsImpl collectionsInts; - - /** - * Gets the CollectionsIntsImpl object to access its operations. - * - * @return the CollectionsIntsImpl object. - */ - public CollectionsIntsImpl getCollectionsInts() { - return this.collectionsInts; - } - - /** - * The CollectionsModelsImpl object to access its operations. - */ - private final CollectionsModelsImpl collectionsModels; - - /** - * Gets the CollectionsModelsImpl object to access its operations. - * - * @return the CollectionsModelsImpl object. - */ - public CollectionsModelsImpl getCollectionsModels() { - return this.collectionsModels; - } - - /** - * The DictionaryStringsImpl object to access its operations. - */ - private final DictionaryStringsImpl dictionaryStrings; - - /** - * Gets the DictionaryStringsImpl object to access its operations. - * - * @return the DictionaryStringsImpl object. - */ - public DictionaryStringsImpl getDictionaryStrings() { - return this.dictionaryStrings; - } - - /** - * The NeversImpl object to access its operations. - */ - private final NeversImpl nevers; - - /** - * Gets the NeversImpl object to access its operations. - * - * @return the NeversImpl object. - */ - public NeversImpl getNevers() { - return this.nevers; - } - - /** - * The UnknownStringsImpl object to access its operations. - */ - private final UnknownStringsImpl unknownStrings; - - /** - * Gets the UnknownStringsImpl object to access its operations. - * - * @return the UnknownStringsImpl object. - */ - public UnknownStringsImpl getUnknownStrings() { - return this.unknownStrings; - } - - /** - * The UnknownIntsImpl object to access its operations. - */ - private final UnknownIntsImpl unknownInts; - - /** - * Gets the UnknownIntsImpl object to access its operations. - * - * @return the UnknownIntsImpl object. - */ - public UnknownIntsImpl getUnknownInts() { - return this.unknownInts; - } - - /** - * The UnknownDictsImpl object to access its operations. - */ - private final UnknownDictsImpl unknownDicts; - - /** - * Gets the UnknownDictsImpl object to access its operations. - * - * @return the UnknownDictsImpl object. - */ - public UnknownDictsImpl getUnknownDicts() { - return this.unknownDicts; - } - - /** - * The UnknownArraysImpl object to access its operations. - */ - private final UnknownArraysImpl unknownArrays; - - /** - * Gets the UnknownArraysImpl object to access its operations. - * - * @return the UnknownArraysImpl object. - */ - public UnknownArraysImpl getUnknownArrays() { - return this.unknownArrays; - } - - /** - * The StringLiteralsImpl object to access its operations. - */ - private final StringLiteralsImpl stringLiterals; - - /** - * Gets the StringLiteralsImpl object to access its operations. - * - * @return the StringLiteralsImpl object. - */ - public StringLiteralsImpl getStringLiterals() { - return this.stringLiterals; - } - - /** - * The IntLiteralsImpl object to access its operations. - */ - private final IntLiteralsImpl intLiterals; - - /** - * Gets the IntLiteralsImpl object to access its operations. - * - * @return the IntLiteralsImpl object. - */ - public IntLiteralsImpl getIntLiterals() { - return this.intLiterals; - } - - /** - * The FloatLiteralsImpl object to access its operations. - */ - private final FloatLiteralsImpl floatLiterals; - - /** - * Gets the FloatLiteralsImpl object to access its operations. - * - * @return the FloatLiteralsImpl object. - */ - public FloatLiteralsImpl getFloatLiterals() { - return this.floatLiterals; - } - - /** - * The BooleanLiteralsImpl object to access its operations. - */ - private final BooleanLiteralsImpl booleanLiterals; - - /** - * Gets the BooleanLiteralsImpl object to access its operations. - * - * @return the BooleanLiteralsImpl object. - */ - public BooleanLiteralsImpl getBooleanLiterals() { - return this.booleanLiterals; - } - - /** - * The UnionStringLiteralsImpl object to access its operations. - */ - private final UnionStringLiteralsImpl unionStringLiterals; - - /** - * Gets the UnionStringLiteralsImpl object to access its operations. - * - * @return the UnionStringLiteralsImpl object. - */ - public UnionStringLiteralsImpl getUnionStringLiterals() { - return this.unionStringLiterals; - } - - /** - * The UnionIntLiteralsImpl object to access its operations. - */ - private final UnionIntLiteralsImpl unionIntLiterals; - - /** - * Gets the UnionIntLiteralsImpl object to access its operations. - * - * @return the UnionIntLiteralsImpl object. - */ - public UnionIntLiteralsImpl getUnionIntLiterals() { - return this.unionIntLiterals; - } - - /** - * The UnionFloatLiteralsImpl object to access its operations. - */ - private final UnionFloatLiteralsImpl unionFloatLiterals; - - /** - * Gets the UnionFloatLiteralsImpl object to access its operations. - * - * @return the UnionFloatLiteralsImpl object. - */ - public UnionFloatLiteralsImpl getUnionFloatLiterals() { - return this.unionFloatLiterals; - } - - /** - * The UnionEnumValuesImpl object to access its operations. - */ - private final UnionEnumValuesImpl unionEnumValues; - - /** - * Gets the UnionEnumValuesImpl object to access its operations. - * - * @return the UnionEnumValuesImpl object. - */ - public UnionEnumValuesImpl getUnionEnumValues() { - return this.unionEnumValues; - } - - /** - * Initializes an instance of ValueTypesClient client. - * - * @param endpoint Service host. - */ - public ValueTypesClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ValueTypesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ValueTypesClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ValueTypesClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ValueTypesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.booleanOperations = new BooleanOperationsImpl(this); - this.stringOperations = new StringOperationsImpl(this); - this.bytes = new BytesImpl(this); - this.ints = new IntsImpl(this); - this.floatOperations = new FloatOperationsImpl(this); - this.decimals = new DecimalsImpl(this); - this.decimal128s = new Decimal128sImpl(this); - this.datetimeOperations = new DatetimeOperationsImpl(this); - this.durationOperations = new DurationOperationsImpl(this); - this.enums = new EnumsImpl(this); - this.extensibleEnums = new ExtensibleEnumsImpl(this); - this.models = new ModelsImpl(this); - this.collectionsStrings = new CollectionsStringsImpl(this); - this.collectionsInts = new CollectionsIntsImpl(this); - this.collectionsModels = new CollectionsModelsImpl(this); - this.dictionaryStrings = new DictionaryStringsImpl(this); - this.nevers = new NeversImpl(this); - this.unknownStrings = new UnknownStringsImpl(this); - this.unknownInts = new UnknownIntsImpl(this); - this.unknownDicts = new UnknownDictsImpl(this); - this.unknownArrays = new UnknownArraysImpl(this); - this.stringLiterals = new StringLiteralsImpl(this); - this.intLiterals = new IntLiteralsImpl(this); - this.floatLiterals = new FloatLiteralsImpl(this); - this.booleanLiterals = new BooleanLiteralsImpl(this); - this.unionStringLiterals = new UnionStringLiteralsImpl(this); - this.unionIntLiterals = new UnionIntLiteralsImpl(this); - this.unionFloatLiterals = new UnionFloatLiteralsImpl(this); - this.unionEnumValues = new UnionEnumValuesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/package-info.java deleted file mode 100644 index 34103951ba0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ValueTypes. - * Illustrates various property types for models. - * - */ -package type.property.valuetypes.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanLiteralProperty.java deleted file mode 100644 index b7a689e78ce..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanLiteralProperty.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a boolean literal property. - */ -@Immutable -public final class BooleanLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final boolean property = true; - - /** - * Creates an instance of BooleanLiteralProperty class. - */ - @Generated - public BooleanLiteralProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public boolean isProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BooleanLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BooleanLiteralProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BooleanLiteralProperty. - */ - @Generated - public static BooleanLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BooleanLiteralProperty deserializedBooleanLiteralProperty = new BooleanLiteralProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedBooleanLiteralProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanProperty.java deleted file mode 100644 index 41b64ac52e2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanProperty.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a boolean property. - */ -@Immutable -public final class BooleanProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final boolean property; - - /** - * Creates an instance of BooleanProperty class. - * - * @param property the property value to set. - */ - @Generated - public BooleanProperty(boolean property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public boolean isProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BooleanProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BooleanProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BooleanProperty. - */ - @Generated - public static BooleanProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - boolean property = false; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getBoolean(); - } else { - reader.skipChildren(); - } - } - return new BooleanProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BytesProperty.java deleted file mode 100644 index fbace5ecedb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BytesProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a bytes property. - */ -@Immutable -public final class BytesProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final byte[] property; - - /** - * Creates an instance of BytesProperty class. - * - * @param property the property value to set. - */ - @Generated - public BytesProperty(byte[] property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public byte[] getProperty() { - return CoreUtils.clone(this.property); - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBinaryField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of BytesProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of BytesProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the BytesProperty. - */ - @Generated - public static BytesProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - byte[] property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getBinary(); - } else { - reader.skipChildren(); - } - } - return new BytesProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsIntProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsIntProperty.java deleted file mode 100644 index c394910ff68..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsIntProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * Model with collection int properties. - */ -@Immutable -public final class CollectionsIntProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final List property; - - /** - * Creates an instance of CollectionsIntProperty class. - * - * @param property the property value to set. - */ - @Generated - public CollectionsIntProperty(List property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public List getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("property", this.property, (writer, element) -> writer.writeInt(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CollectionsIntProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CollectionsIntProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the CollectionsIntProperty. - */ - @Generated - public static CollectionsIntProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.readArray(reader1 -> reader1.getInt()); - } else { - reader.skipChildren(); - } - } - return new CollectionsIntProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsModelProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsModelProperty.java deleted file mode 100644 index 7088cc2dc7a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsModelProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * Model with collection model properties. - */ -@Immutable -public final class CollectionsModelProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final List property; - - /** - * Creates an instance of CollectionsModelProperty class. - * - * @param property the property value to set. - */ - @Generated - public CollectionsModelProperty(List property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public List getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("property", this.property, (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CollectionsModelProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CollectionsModelProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the CollectionsModelProperty. - */ - @Generated - public static CollectionsModelProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.readArray(reader1 -> InnerModel.fromJson(reader1)); - } else { - reader.skipChildren(); - } - } - return new CollectionsModelProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsStringProperty.java deleted file mode 100644 index f2f81d1de9d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsStringProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * Model with collection string properties. - */ -@Immutable -public final class CollectionsStringProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final List property; - - /** - * Creates an instance of CollectionsStringProperty class. - * - * @param property the property value to set. - */ - @Generated - public CollectionsStringProperty(List property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public List getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("property", this.property, (writer, element) -> writer.writeString(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CollectionsStringProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CollectionsStringProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the CollectionsStringProperty. - */ - @Generated - public static CollectionsStringProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - List property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.readArray(reader1 -> reader1.getString()); - } else { - reader.skipChildren(); - } - } - return new CollectionsStringProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DatetimeProperty.java deleted file mode 100644 index 501748838f1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DatetimeProperty.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; - -/** - * Model with a datetime property. - */ -@Immutable -public final class DatetimeProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final OffsetDateTime property; - - /** - * Creates an instance of DatetimeProperty class. - * - * @param property the property value to set. - */ - @Generated - public DatetimeProperty(OffsetDateTime property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public OffsetDateTime getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", - this.property == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.property)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DatetimeProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DatetimeProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DatetimeProperty. - */ - @Generated - public static DatetimeProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OffsetDateTime property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader - .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new DatetimeProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/Decimal128Property.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/Decimal128Property.java deleted file mode 100644 index da3abc59718..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/Decimal128Property.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.math.BigDecimal; - -/** - * Model with a decimal128 property. - */ -@Immutable -public final class Decimal128Property implements JsonSerializable { - /* - * Property - */ - @Generated - private final BigDecimal property; - - /** - * Creates an instance of Decimal128Property class. - * - * @param property the property value to set. - */ - @Generated - public Decimal128Property(BigDecimal property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public BigDecimal getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Decimal128Property from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Decimal128Property if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Decimal128Property. - */ - @Generated - public static Decimal128Property fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BigDecimal property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getNullable(nonNullReader -> new BigDecimal(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new Decimal128Property(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DecimalProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DecimalProperty.java deleted file mode 100644 index 0518fd901d8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DecimalProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.math.BigDecimal; - -/** - * Model with a decimal property. - */ -@Immutable -public final class DecimalProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final BigDecimal property; - - /** - * Creates an instance of DecimalProperty class. - * - * @param property the property value to set. - */ - @Generated - public DecimalProperty(BigDecimal property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public BigDecimal getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DecimalProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DecimalProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DecimalProperty. - */ - @Generated - public static DecimalProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BigDecimal property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getNullable(nonNullReader -> new BigDecimal(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new DecimalProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DictionaryStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DictionaryStringProperty.java deleted file mode 100644 index e21d23522c2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DictionaryStringProperty.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.Map; - -/** - * Model with dictionary string properties. - */ -@Immutable -public final class DictionaryStringProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final Map property; - - /** - * Creates an instance of DictionaryStringProperty class. - * - * @param property the property value to set. - */ - @Generated - public DictionaryStringProperty(Map property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public Map getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeMapField("property", this.property, (writer, element) -> writer.writeString(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DictionaryStringProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DictionaryStringProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DictionaryStringProperty. - */ - @Generated - public static DictionaryStringProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Map property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.readMap(reader1 -> reader1.getString()); - } else { - reader.skipChildren(); - } - } - return new DictionaryStringProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DurationProperty.java deleted file mode 100644 index ee759f6d195..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DurationProperty.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Duration; - -/** - * Model with a duration property. - */ -@Immutable -public final class DurationProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final Duration property; - - /** - * Creates an instance of DurationProperty class. - * - * @param property the property value to set. - */ - @Generated - public DurationProperty(Duration property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public Duration getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", CoreUtils.durationToStringWithDays(this.property)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DurationProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DurationProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the DurationProperty. - */ - @Generated - public static DurationProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Duration property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); - } else { - reader.skipChildren(); - } - } - return new DurationProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/EnumProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/EnumProperty.java deleted file mode 100644 index d871974fbe4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/EnumProperty.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with enum properties. - */ -@Immutable -public final class EnumProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final FixedInnerEnum property; - - /** - * Creates an instance of EnumProperty class. - * - * @param property the property value to set. - */ - @Generated - public EnumProperty(FixedInnerEnum property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public FixedInnerEnum getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of EnumProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of EnumProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the EnumProperty. - */ - @Generated - public static EnumProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - FixedInnerEnum property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = FixedInnerEnum.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new EnumProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtendedEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtendedEnum.java deleted file mode 100644 index 4656aed65e5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtendedEnum.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for ExtendedEnum. - */ -public final class ExtendedEnum extends ExpandableStringEnum { - /** - * Static value value2 for ExtendedEnum. - */ - @Generated - public static final ExtendedEnum ENUM_VALUE2 = fromString("value2"); - - /** - * Creates a new instance of ExtendedEnum value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public ExtendedEnum() { - } - - /** - * Creates or finds a ExtendedEnum from its string representation. - * - * @param name a name to look for. - * @return the corresponding ExtendedEnum. - */ - @Generated - public static ExtendedEnum fromString(String name) { - return fromString(name, ExtendedEnum.class); - } - - /** - * Gets known ExtendedEnum values. - * - * @return known ExtendedEnum values. - */ - @Generated - public static Collection values() { - return values(ExtendedEnum.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtensibleEnumProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtensibleEnumProperty.java deleted file mode 100644 index 71365e7fafd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtensibleEnumProperty.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with extensible enum properties. - */ -@Immutable -public final class ExtensibleEnumProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final InnerEnum property; - - /** - * Creates an instance of ExtensibleEnumProperty class. - * - * @param property the property value to set. - */ - @Generated - public ExtensibleEnumProperty(InnerEnum property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public InnerEnum getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ExtensibleEnumProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ExtensibleEnumProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ExtensibleEnumProperty. - */ - @Generated - public static ExtensibleEnumProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - InnerEnum property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = InnerEnum.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new ExtensibleEnumProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FixedInnerEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FixedInnerEnum.java deleted file mode 100644 index 84f48a0084f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FixedInnerEnum.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -/** - * Enum that will be used as a property for model EnumProperty. Non-extensible. - */ -public enum FixedInnerEnum { - /** - * First value. - */ - VALUE_ONE("ValueOne"), - - /** - * Second value. - */ - VALUE_TWO("ValueTwo"); - - /** - * The actual serialized value for a FixedInnerEnum instance. - */ - private final String value; - - FixedInnerEnum(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a FixedInnerEnum instance. - * - * @param value the serialized value to parse. - * @return the parsed FixedInnerEnum object, or null if unable to parse. - */ - public static FixedInnerEnum fromString(String value) { - if (value == null) { - return null; - } - FixedInnerEnum[] items = FixedInnerEnum.values(); - for (FixedInnerEnum item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatLiteralProperty.java deleted file mode 100644 index dfdda313680..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatLiteralProperty.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a float literal property. - */ -@Immutable -public final class FloatLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final double property = 43.125; - - /** - * Creates an instance of FloatLiteralProperty class. - */ - @Generated - public FloatLiteralProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public double getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FloatLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FloatLiteralProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FloatLiteralProperty. - */ - @Generated - public static FloatLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - FloatLiteralProperty deserializedFloatLiteralProperty = new FloatLiteralProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedFloatLiteralProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatProperty.java deleted file mode 100644 index a2ff3ab67dc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatProperty.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a float property. - */ -@Immutable -public final class FloatProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final double property; - - /** - * Creates an instance of FloatProperty class. - * - * @param property the property value to set. - */ - @Generated - public FloatProperty(double property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public double getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeDoubleField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of FloatProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of FloatProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the FloatProperty. - */ - @Generated - public static FloatProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - double property = 0.0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getDouble(); - } else { - reader.skipChildren(); - } - } - return new FloatProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerEnum.java deleted file mode 100644 index 727ca05bb31..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerEnum.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Enum that will be used as a property for model EnumProperty. Extensible. - */ -public final class InnerEnum extends ExpandableStringEnum { - /** - * First value. - */ - @Generated - public static final InnerEnum VALUE_ONE = fromString("ValueOne"); - - /** - * Second value. - */ - @Generated - public static final InnerEnum VALUE_TWO = fromString("ValueTwo"); - - /** - * Creates a new instance of InnerEnum value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public InnerEnum() { - } - - /** - * Creates or finds a InnerEnum from its string representation. - * - * @param name a name to look for. - * @return the corresponding InnerEnum. - */ - @Generated - public static InnerEnum fromString(String name) { - return fromString(name, InnerEnum.class); - } - - /** - * Gets known InnerEnum values. - * - * @return known InnerEnum values. - */ - @Generated - public static Collection values() { - return values(InnerEnum.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerModel.java deleted file mode 100644 index 0567649a5e0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerModel.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Inner model. Will be a property type for ModelWithModelProperties. - */ -@Immutable -public final class InnerModel implements JsonSerializable { - /* - * Required string property - */ - @Generated - private final String property; - - /** - * Creates an instance of InnerModel class. - * - * @param property the property value to set. - */ - @Generated - public InnerModel(String property) { - this.property = property; - } - - /** - * Get the property property: Required string property. - * - * @return the property value. - */ - @Generated - public String getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of InnerModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the InnerModel. - */ - @Generated - public static InnerModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new InnerModel(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntLiteralProperty.java deleted file mode 100644 index 46d15d77b1a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntLiteralProperty.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a int literal property. - */ -@Immutable -public final class IntLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final int property = 42; - - /** - * Creates an instance of IntLiteralProperty class. - */ - @Generated - public IntLiteralProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public int getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of IntLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of IntLiteralProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the IntLiteralProperty. - */ - @Generated - public static IntLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - IntLiteralProperty deserializedIntLiteralProperty = new IntLiteralProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedIntLiteralProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntProperty.java deleted file mode 100644 index 37e5a584e34..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntProperty.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a int property. - */ -@Immutable -public final class IntProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final int property; - - /** - * Creates an instance of IntProperty class. - * - * @param property the property value to set. - */ - @Generated - public IntProperty(int property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public int getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeIntField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of IntProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of IntProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the IntProperty. - */ - @Generated - public static IntProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - int property = 0; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getInt(); - } else { - reader.skipChildren(); - } - } - return new IntProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ModelProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ModelProperty.java deleted file mode 100644 index 1f431790702..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ModelProperty.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with model properties. - */ -@Immutable -public final class ModelProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final InnerModel property; - - /** - * Creates an instance of ModelProperty class. - * - * @param property the property value to set. - */ - @Generated - public ModelProperty(InnerModel property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public InnerModel getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ModelProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ModelProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ModelProperty. - */ - @Generated - public static ModelProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - InnerModel property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = InnerModel.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new ModelProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/NeverProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/NeverProperty.java deleted file mode 100644 index 61a92e165d3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/NeverProperty.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a property never. (This property should not be included). - */ -@Immutable -public final class NeverProperty implements JsonSerializable { - /** - * Creates an instance of NeverProperty class. - */ - @Generated - public NeverProperty() { - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NeverProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NeverProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the NeverProperty. - */ - @Generated - public static NeverProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - NeverProperty deserializedNeverProperty = new NeverProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedNeverProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringLiteralProperty.java deleted file mode 100644 index bb4de27a2f8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringLiteralProperty.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a string literal property. - */ -@Immutable -public final class StringLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final String property = "hello"; - - /** - * Creates an instance of StringLiteralProperty class. - */ - @Generated - public StringLiteralProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public String getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of StringLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of StringLiteralProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the StringLiteralProperty. - */ - @Generated - public static StringLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - StringLiteralProperty deserializedStringLiteralProperty = new StringLiteralProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedStringLiteralProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringProperty.java deleted file mode 100644 index d61a4dd096d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringProperty.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a string property. - */ -@Immutable -public final class StringProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final String property; - - /** - * Creates an instance of StringProperty class. - * - * @param property the property value to set. - */ - @Generated - public StringProperty(String property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public String getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of StringProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of StringProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the StringProperty. - */ - @Generated - public static StringProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new StringProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionEnumValueProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionEnumValueProperty.java deleted file mode 100644 index 98bfb03f502..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionEnumValueProperty.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Template type for testing models with specific properties. Pass in the type of the property you are looking for. - */ -@Immutable -public final class UnionEnumValueProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final ExtendedEnum property = ExtendedEnum.ENUM_VALUE2; - - /** - * Creates an instance of UnionEnumValueProperty class. - */ - @Generated - public UnionEnumValueProperty() { - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public ExtendedEnum getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnionEnumValueProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnionEnumValueProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UnionEnumValueProperty. - */ - @Generated - public static UnionEnumValueProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - UnionEnumValueProperty deserializedUnionEnumValueProperty = new UnionEnumValueProperty(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - reader.skipChildren(); - } - - return deserializedUnionEnumValueProperty; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralProperty.java deleted file mode 100644 index 115ced37d2b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralProperty.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a union of float literal as property. - */ -@Immutable -public final class UnionFloatLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final UnionFloatLiteralPropertyProperty property; - - /** - * Creates an instance of UnionFloatLiteralProperty class. - * - * @param property the property value to set. - */ - @Generated - public UnionFloatLiteralProperty(UnionFloatLiteralPropertyProperty property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public UnionFloatLiteralPropertyProperty getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("property", this.property == null ? null : this.property.toDouble()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnionFloatLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnionFloatLiteralProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UnionFloatLiteralProperty. - */ - @Generated - public static UnionFloatLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - UnionFloatLiteralPropertyProperty property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = UnionFloatLiteralPropertyProperty.fromDouble(reader.getDouble()); - } else { - reader.skipChildren(); - } - } - return new UnionFloatLiteralProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralPropertyProperty.java deleted file mode 100644 index a445f970692..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralPropertyProperty.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -/** - * Defines values for UnionFloatLiteralPropertyProperty. - */ -public enum UnionFloatLiteralPropertyProperty { - /** - * Enum value 43.125. - */ - FOUR_THREE_ONE_TWO_FIVE(43.125), - - /** - * Enum value 46.875. - */ - FOUR_SIX_EIGHT_SEVEN_FIVE(46.875); - - /** - * The actual serialized value for a UnionFloatLiteralPropertyProperty instance. - */ - private final double value; - - UnionFloatLiteralPropertyProperty(double value) { - this.value = value; - } - - /** - * Parses a serialized value to a UnionFloatLiteralPropertyProperty instance. - * - * @param value the serialized value to parse. - * @return the parsed UnionFloatLiteralPropertyProperty object, or null if unable to parse. - */ - public static UnionFloatLiteralPropertyProperty fromDouble(double value) { - UnionFloatLiteralPropertyProperty[] items = UnionFloatLiteralPropertyProperty.values(); - for (UnionFloatLiteralPropertyProperty item : items) { - if (Double.doubleToLongBits(item.toDouble()) == Double.doubleToLongBits(value)) { - return item; - } - } - return null; - } - - /** - * De-serializes the instance to double value. - * - * @return the double value. - */ - public double toDouble() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralProperty.java deleted file mode 100644 index bed531ef4e3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralProperty.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a union of int literal as property. - */ -@Immutable -public final class UnionIntLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final UnionIntLiteralPropertyProperty property; - - /** - * Creates an instance of UnionIntLiteralProperty class. - * - * @param property the property value to set. - */ - @Generated - public UnionIntLiteralProperty(UnionIntLiteralPropertyProperty property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public UnionIntLiteralPropertyProperty getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("property", this.property == null ? null : this.property.toInt()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnionIntLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnionIntLiteralProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UnionIntLiteralProperty. - */ - @Generated - public static UnionIntLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - UnionIntLiteralPropertyProperty property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = UnionIntLiteralPropertyProperty.fromInt(reader.getInt()); - } else { - reader.skipChildren(); - } - } - return new UnionIntLiteralProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralPropertyProperty.java deleted file mode 100644 index 4e266ea00cd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralPropertyProperty.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -/** - * Defines values for UnionIntLiteralPropertyProperty. - */ -public enum UnionIntLiteralPropertyProperty { - /** - * Enum value 42. - */ - FOUR_TWO(42), - - /** - * Enum value 43. - */ - FOUR_THREE(43); - - /** - * The actual serialized value for a UnionIntLiteralPropertyProperty instance. - */ - private final int value; - - UnionIntLiteralPropertyProperty(int value) { - this.value = value; - } - - /** - * Parses a serialized value to a UnionIntLiteralPropertyProperty instance. - * - * @param value the serialized value to parse. - * @return the parsed UnionIntLiteralPropertyProperty object, or null if unable to parse. - */ - public static UnionIntLiteralPropertyProperty fromInt(int value) { - UnionIntLiteralPropertyProperty[] items = UnionIntLiteralPropertyProperty.values(); - for (UnionIntLiteralPropertyProperty item : items) { - if (item.toInt() == value) { - return item; - } - } - return null; - } - - /** - * De-serializes the instance to int value. - * - * @return the int value. - */ - public int toInt() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralProperty.java deleted file mode 100644 index fabc9144c08..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralProperty.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a union of string literal as property. - */ -@Immutable -public final class UnionStringLiteralProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final UnionStringLiteralPropertyProperty property; - - /** - * Creates an instance of UnionStringLiteralProperty class. - * - * @param property the property value to set. - */ - @Generated - public UnionStringLiteralProperty(UnionStringLiteralPropertyProperty property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public UnionStringLiteralPropertyProperty getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnionStringLiteralProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnionStringLiteralProperty if the JsonReader was pointing to an instance of it, or null if - * it was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UnionStringLiteralProperty. - */ - @Generated - public static UnionStringLiteralProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - UnionStringLiteralPropertyProperty property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = UnionStringLiteralPropertyProperty.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new UnionStringLiteralProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralPropertyProperty.java deleted file mode 100644 index d1c1110a080..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralPropertyProperty.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -/** - * Defines values for UnionStringLiteralPropertyProperty. - */ -public enum UnionStringLiteralPropertyProperty { - /** - * Enum value hello. - */ - HELLO("hello"), - - /** - * Enum value world. - */ - WORLD("world"); - - /** - * The actual serialized value for a UnionStringLiteralPropertyProperty instance. - */ - private final String value; - - UnionStringLiteralPropertyProperty(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a UnionStringLiteralPropertyProperty instance. - * - * @param value the serialized value to parse. - * @return the parsed UnionStringLiteralPropertyProperty object, or null if unable to parse. - */ - public static UnionStringLiteralPropertyProperty fromString(String value) { - if (value == null) { - return null; - } - UnionStringLiteralPropertyProperty[] items = UnionStringLiteralPropertyProperty.values(); - for (UnionStringLiteralPropertyProperty item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownArrayProperty.java deleted file mode 100644 index adb0c54fdb9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownArrayProperty.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a property unknown, and the data is an array. - */ -@Immutable -public final class UnknownArrayProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final BinaryData property; - - /** - * Creates an instance of UnknownArrayProperty class. - * - * @param property the property value to set. - */ - @Generated - public UnknownArrayProperty(BinaryData property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public BinaryData getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeFieldName("property"); - this.property.writeTo(jsonWriter); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnknownArrayProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnknownArrayProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UnknownArrayProperty. - */ - @Generated - public static UnknownArrayProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BinaryData property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - return new UnknownArrayProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownDictProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownDictProperty.java deleted file mode 100644 index ab910ee8ba4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownDictProperty.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a property unknown, and the data is a dictionnary. - */ -@Immutable -public final class UnknownDictProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final BinaryData property; - - /** - * Creates an instance of UnknownDictProperty class. - * - * @param property the property value to set. - */ - @Generated - public UnknownDictProperty(BinaryData property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public BinaryData getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeFieldName("property"); - this.property.writeTo(jsonWriter); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnknownDictProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnknownDictProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UnknownDictProperty. - */ - @Generated - public static UnknownDictProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BinaryData property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - return new UnknownDictProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownIntProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownIntProperty.java deleted file mode 100644 index 5d2ac90a0f9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownIntProperty.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a property unknown, and the data is a int32. - */ -@Immutable -public final class UnknownIntProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final BinaryData property; - - /** - * Creates an instance of UnknownIntProperty class. - * - * @param property the property value to set. - */ - @Generated - public UnknownIntProperty(BinaryData property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public BinaryData getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeFieldName("property"); - this.property.writeTo(jsonWriter); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnknownIntProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnknownIntProperty if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UnknownIntProperty. - */ - @Generated - public static UnknownIntProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BinaryData property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - return new UnknownIntProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownStringProperty.java deleted file mode 100644 index 9afa18cc527..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownStringProperty.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Model with a property unknown, and the data is a string. - */ -@Immutable -public final class UnknownStringProperty implements JsonSerializable { - /* - * Property - */ - @Generated - private final BinaryData property; - - /** - * Creates an instance of UnknownStringProperty class. - * - * @param property the property value to set. - */ - @Generated - public UnknownStringProperty(BinaryData property) { - this.property = property; - } - - /** - * Get the property property: Property. - * - * @return the property value. - */ - @Generated - public BinaryData getProperty() { - return this.property; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeFieldName("property"); - this.property.writeTo(jsonWriter); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of UnknownStringProperty from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of UnknownStringProperty if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the UnknownStringProperty. - */ - @Generated - public static UnknownStringProperty fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BinaryData property = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("property".equals(fieldName)) { - property = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - return new UnknownStringProperty(property); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/package-info.java deleted file mode 100644 index 74b53764dd3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for ValueTypes. - * Illustrates various property types for models. - * - */ -package type.property.valuetypes.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/package-info.java deleted file mode 100644 index 0b9a128ae2f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ValueTypes. - * Illustrates various property types for models. - * - */ -package type.property.valuetypes; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationAsyncClient.java deleted file mode 100644 index 7546b6de7b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationAsyncClient.java +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.scalar.implementation.BooleanOperationsImpl; - -/** - * Initializes a new instance of the asynchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) -public final class BooleanOperationAsyncClient { - @Generated - private final BooleanOperationsImpl serviceClient; - - /** - * Initializes an instance of BooleanOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BooleanOperationAsyncClient(BooleanOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * get boolean value. - *

Response Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return boolean value along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * put boolean value. - *

Request Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * get boolean value. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return boolean value on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(Boolean.class)); - } - - /** - * put boolean value. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(boolean body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationClient.java deleted file mode 100644 index c9555540278..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationClient.java +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.scalar.implementation.BooleanOperationsImpl; - -/** - * Initializes a new instance of the synchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class) -public final class BooleanOperationClient { - @Generated - private final BooleanOperationsImpl serviceClient; - - /** - * Initializes an instance of BooleanOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - BooleanOperationClient(BooleanOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * get boolean value. - *

Response Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return boolean value along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * put boolean value. - *

Request Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * get boolean value. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return boolean value. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public boolean get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(Boolean.class); - } - - /** - * put boolean value. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(boolean body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeAsyncClient.java deleted file mode 100644 index 40e784d5185..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeAsyncClient.java +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import java.math.BigDecimal; -import reactor.core.publisher.Mono; -import type.scalar.implementation.Decimal128TypesImpl; - -/** - * Initializes a new instance of the asynchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) -public final class Decimal128TypeAsyncClient { - @Generated - private final Decimal128TypesImpl serviceClient; - - /** - * Initializes an instance of Decimal128TypeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Decimal128TypeAsyncClient(Decimal128TypesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The responseBody operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 128-bit decimal number along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> responseBodyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.responseBodyWithResponseAsync(requestOptions); - } - - /** - * The requestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requestBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.requestBodyWithResponseAsync(body, requestOptions); - } - - /** - * The requestParameter operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requestParameterWithResponse(BigDecimal value, RequestOptions requestOptions) { - return this.serviceClient.requestParameterWithResponseAsync(value, requestOptions); - } - - /** - * The responseBody operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 128-bit decimal number on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono responseBody() { - // Generated convenience method for responseBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return responseBodyWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BigDecimal.class)); - } - - /** - * The requestBody operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono requestBody(BigDecimal body) { - // Generated convenience method for requestBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return requestBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The requestParameter operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono requestParameter(BigDecimal value) { - // Generated convenience method for requestParameterWithResponse - RequestOptions requestOptions = new RequestOptions(); - return requestParameterWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeClient.java deleted file mode 100644 index 21e355a875b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeClient.java +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import java.math.BigDecimal; -import type.scalar.implementation.Decimal128TypesImpl; - -/** - * Initializes a new instance of the synchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class) -public final class Decimal128TypeClient { - @Generated - private final Decimal128TypesImpl serviceClient; - - /** - * Initializes an instance of Decimal128TypeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Decimal128TypeClient(Decimal128TypesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The responseBody operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 128-bit decimal number along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response responseBodyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.responseBodyWithResponse(requestOptions); - } - - /** - * The requestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requestBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.requestBodyWithResponse(body, requestOptions); - } - - /** - * The requestParameter operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requestParameterWithResponse(BigDecimal value, RequestOptions requestOptions) { - return this.serviceClient.requestParameterWithResponse(value, requestOptions); - } - - /** - * The responseBody operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a 128-bit decimal number. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BigDecimal responseBody() { - // Generated convenience method for responseBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return responseBodyWithResponse(requestOptions).getValue().toObject(BigDecimal.class); - } - - /** - * The requestBody operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void requestBody(BigDecimal body) { - // Generated convenience method for requestBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - requestBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The requestParameter operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void requestParameter(BigDecimal value) { - // Generated convenience method for requestParameterWithResponse - RequestOptions requestOptions = new RequestOptions(); - requestParameterWithResponse(value, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyAsyncClient.java deleted file mode 100644 index db2d9d7d300..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyAsyncClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.math.BigDecimal; -import java.util.List; -import reactor.core.publisher.Mono; -import type.scalar.implementation.Decimal128VerifiesImpl; - -/** - * Initializes a new instance of the asynchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) -public final class Decimal128VerifyAsyncClient { - @Generated - private final Decimal128VerifiesImpl serviceClient; - - /** - * Initializes an instance of Decimal128VerifyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Decimal128VerifyAsyncClient(Decimal128VerifiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The prepareVerify operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     BigDecimal (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> prepareVerifyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.prepareVerifyWithResponseAsync(requestOptions); - } - - /** - * The verify operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> verifyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.verifyWithResponseAsync(body, requestOptions); - } - - /** - * The prepareVerify operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> prepareVerify() { - // Generated convenience method for prepareVerifyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return prepareVerifyWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_BIG_DECIMAL)); - } - - /** - * The verify operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono verify(BigDecimal body) { - // Generated convenience method for verifyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return verifyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_BIG_DECIMAL - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyClient.java deleted file mode 100644 index 3ed157063ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.math.BigDecimal; -import java.util.List; -import type.scalar.implementation.Decimal128VerifiesImpl; - -/** - * Initializes a new instance of the synchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class) -public final class Decimal128VerifyClient { - @Generated - private final Decimal128VerifiesImpl serviceClient; - - /** - * Initializes an instance of Decimal128VerifyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - Decimal128VerifyClient(Decimal128VerifiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The prepareVerify operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     BigDecimal (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response prepareVerifyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.prepareVerifyWithResponse(requestOptions); - } - - /** - * The verify operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response verifyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.verifyWithResponse(body, requestOptions); - } - - /** - * The prepareVerify operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List prepareVerify() { - // Generated convenience method for prepareVerifyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return prepareVerifyWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_BIG_DECIMAL); - } - - /** - * The verify operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void verify(BigDecimal body) { - // Generated convenience method for verifyWithResponse - RequestOptions requestOptions = new RequestOptions(); - verifyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_BIG_DECIMAL - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeAsyncClient.java deleted file mode 100644 index 9f607bd3f29..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeAsyncClient.java +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import java.math.BigDecimal; -import reactor.core.publisher.Mono; -import type.scalar.implementation.DecimalTypesImpl; - -/** - * Initializes a new instance of the asynchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) -public final class DecimalTypeAsyncClient { - @Generated - private final DecimalTypesImpl serviceClient; - - /** - * Initializes an instance of DecimalTypeAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DecimalTypeAsyncClient(DecimalTypesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The responseBody operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a decimal number with any length and precision along with {@link Response} on successful completion of - * {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> responseBodyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.responseBodyWithResponseAsync(requestOptions); - } - - /** - * The requestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requestBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.requestBodyWithResponseAsync(body, requestOptions); - } - - /** - * The requestParameter operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requestParameterWithResponse(BigDecimal value, RequestOptions requestOptions) { - return this.serviceClient.requestParameterWithResponseAsync(value, requestOptions); - } - - /** - * The responseBody operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a decimal number with any length and precision on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono responseBody() { - // Generated convenience method for responseBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return responseBodyWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(BigDecimal.class)); - } - - /** - * The requestBody operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono requestBody(BigDecimal body) { - // Generated convenience method for requestBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return requestBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The requestParameter operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono requestParameter(BigDecimal value) { - // Generated convenience method for requestParameterWithResponse - RequestOptions requestOptions = new RequestOptions(); - return requestParameterWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeClient.java deleted file mode 100644 index 8d348699360..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeClient.java +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import java.math.BigDecimal; -import type.scalar.implementation.DecimalTypesImpl; - -/** - * Initializes a new instance of the synchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class) -public final class DecimalTypeClient { - @Generated - private final DecimalTypesImpl serviceClient; - - /** - * Initializes an instance of DecimalTypeClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DecimalTypeClient(DecimalTypesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The responseBody operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a decimal number with any length and precision along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response responseBodyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.responseBodyWithResponse(requestOptions); - } - - /** - * The requestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requestBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.requestBodyWithResponse(body, requestOptions); - } - - /** - * The requestParameter operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requestParameterWithResponse(BigDecimal value, RequestOptions requestOptions) { - return this.serviceClient.requestParameterWithResponse(value, requestOptions); - } - - /** - * The responseBody operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a decimal number with any length and precision. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BigDecimal responseBody() { - // Generated convenience method for responseBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return responseBodyWithResponse(requestOptions).getValue().toObject(BigDecimal.class); - } - - /** - * The requestBody operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void requestBody(BigDecimal body) { - // Generated convenience method for requestBodyWithResponse - RequestOptions requestOptions = new RequestOptions(); - requestBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - /** - * The requestParameter operation. - * - * @param value The value parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void requestParameter(BigDecimal value) { - // Generated convenience method for requestParameterWithResponse - RequestOptions requestOptions = new RequestOptions(); - requestParameterWithResponse(value, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyAsyncClient.java deleted file mode 100644 index 680599b58b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyAsyncClient.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.serializer.TypeReference; -import java.math.BigDecimal; -import java.util.List; -import reactor.core.publisher.Mono; -import type.scalar.implementation.DecimalVerifiesImpl; - -/** - * Initializes a new instance of the asynchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) -public final class DecimalVerifyAsyncClient { - @Generated - private final DecimalVerifiesImpl serviceClient; - - /** - * Initializes an instance of DecimalVerifyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DecimalVerifyAsyncClient(DecimalVerifiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The prepareVerify operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     BigDecimal (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> prepareVerifyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.prepareVerifyWithResponseAsync(requestOptions); - } - - /** - * The verify operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> verifyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.verifyWithResponseAsync(body, requestOptions); - } - - /** - * The prepareVerify operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> prepareVerify() { - // Generated convenience method for prepareVerifyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return prepareVerifyWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_BIG_DECIMAL)); - } - - /** - * The verify operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono verify(BigDecimal body) { - // Generated convenience method for verifyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return verifyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_BIG_DECIMAL - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyClient.java deleted file mode 100644 index 4626dbf214e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.serializer.TypeReference; -import java.math.BigDecimal; -import java.util.List; -import type.scalar.implementation.DecimalVerifiesImpl; - -/** - * Initializes a new instance of the synchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class) -public final class DecimalVerifyClient { - @Generated - private final DecimalVerifiesImpl serviceClient; - - /** - * Initializes an instance of DecimalVerifyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - DecimalVerifyClient(DecimalVerifiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The prepareVerify operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     BigDecimal (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response prepareVerifyWithResponse(RequestOptions requestOptions) { - return this.serviceClient.prepareVerifyWithResponse(requestOptions); - } - - /** - * The verify operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response verifyWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.verifyWithResponse(body, requestOptions); - } - - /** - * The prepareVerify operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public List prepareVerify() { - // Generated convenience method for prepareVerifyWithResponse - RequestOptions requestOptions = new RequestOptions(); - return prepareVerifyWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_BIG_DECIMAL); - } - - /** - * The verify operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void verify(BigDecimal body) { - // Generated convenience method for verifyWithResponse - RequestOptions requestOptions = new RequestOptions(); - verifyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } - - @Generated - private static final TypeReference> TYPE_REFERENCE_LIST_BIG_DECIMAL - = new TypeReference>() { - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/ScalarClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/ScalarClientBuilder.java deleted file mode 100644 index 8e56dfce0c3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/ScalarClientBuilder.java +++ /dev/null @@ -1,422 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.scalar.implementation.ScalarClientImpl; - -/** - * A builder for creating a new instance of the ScalarClient type. - */ -@ServiceClientBuilder( - serviceClients = { - StringOperationClient.class, - BooleanOperationClient.class, - UnknownClient.class, - DecimalTypeClient.class, - Decimal128TypeClient.class, - DecimalVerifyClient.class, - Decimal128VerifyClient.class, - StringOperationAsyncClient.class, - BooleanOperationAsyncClient.class, - UnknownAsyncClient.class, - DecimalTypeAsyncClient.class, - Decimal128TypeAsyncClient.class, - DecimalVerifyAsyncClient.class, - Decimal128VerifyAsyncClient.class }) -public final class ScalarClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("type-scalar.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ScalarClientBuilder. - */ - @Generated - public ScalarClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ScalarClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ScalarClientBuilder. - */ - @Generated - public ScalarClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ScalarClientImpl with the provided parameters. - * - * @return an instance of ScalarClientImpl. - */ - @Generated - private ScalarClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - ScalarClientImpl client - = new ScalarClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of StringOperationAsyncClient class. - * - * @return an instance of StringOperationAsyncClient. - */ - @Generated - public StringOperationAsyncClient buildStringOperationAsyncClient() { - return new StringOperationAsyncClient(buildInnerClient().getStringOperations()); - } - - /** - * Builds an instance of BooleanOperationAsyncClient class. - * - * @return an instance of BooleanOperationAsyncClient. - */ - @Generated - public BooleanOperationAsyncClient buildBooleanOperationAsyncClient() { - return new BooleanOperationAsyncClient(buildInnerClient().getBooleanOperations()); - } - - /** - * Builds an instance of UnknownAsyncClient class. - * - * @return an instance of UnknownAsyncClient. - */ - @Generated - public UnknownAsyncClient buildUnknownAsyncClient() { - return new UnknownAsyncClient(buildInnerClient().getUnknowns()); - } - - /** - * Builds an instance of DecimalTypeAsyncClient class. - * - * @return an instance of DecimalTypeAsyncClient. - */ - @Generated - public DecimalTypeAsyncClient buildDecimalTypeAsyncClient() { - return new DecimalTypeAsyncClient(buildInnerClient().getDecimalTypes()); - } - - /** - * Builds an instance of Decimal128TypeAsyncClient class. - * - * @return an instance of Decimal128TypeAsyncClient. - */ - @Generated - public Decimal128TypeAsyncClient buildDecimal128TypeAsyncClient() { - return new Decimal128TypeAsyncClient(buildInnerClient().getDecimal128Types()); - } - - /** - * Builds an instance of DecimalVerifyAsyncClient class. - * - * @return an instance of DecimalVerifyAsyncClient. - */ - @Generated - public DecimalVerifyAsyncClient buildDecimalVerifyAsyncClient() { - return new DecimalVerifyAsyncClient(buildInnerClient().getDecimalVerifies()); - } - - /** - * Builds an instance of Decimal128VerifyAsyncClient class. - * - * @return an instance of Decimal128VerifyAsyncClient. - */ - @Generated - public Decimal128VerifyAsyncClient buildDecimal128VerifyAsyncClient() { - return new Decimal128VerifyAsyncClient(buildInnerClient().getDecimal128Verifies()); - } - - /** - * Builds an instance of StringOperationClient class. - * - * @return an instance of StringOperationClient. - */ - @Generated - public StringOperationClient buildStringOperationClient() { - return new StringOperationClient(buildInnerClient().getStringOperations()); - } - - /** - * Builds an instance of BooleanOperationClient class. - * - * @return an instance of BooleanOperationClient. - */ - @Generated - public BooleanOperationClient buildBooleanOperationClient() { - return new BooleanOperationClient(buildInnerClient().getBooleanOperations()); - } - - /** - * Builds an instance of UnknownClient class. - * - * @return an instance of UnknownClient. - */ - @Generated - public UnknownClient buildUnknownClient() { - return new UnknownClient(buildInnerClient().getUnknowns()); - } - - /** - * Builds an instance of DecimalTypeClient class. - * - * @return an instance of DecimalTypeClient. - */ - @Generated - public DecimalTypeClient buildDecimalTypeClient() { - return new DecimalTypeClient(buildInnerClient().getDecimalTypes()); - } - - /** - * Builds an instance of Decimal128TypeClient class. - * - * @return an instance of Decimal128TypeClient. - */ - @Generated - public Decimal128TypeClient buildDecimal128TypeClient() { - return new Decimal128TypeClient(buildInnerClient().getDecimal128Types()); - } - - /** - * Builds an instance of DecimalVerifyClient class. - * - * @return an instance of DecimalVerifyClient. - */ - @Generated - public DecimalVerifyClient buildDecimalVerifyClient() { - return new DecimalVerifyClient(buildInnerClient().getDecimalVerifies()); - } - - /** - * Builds an instance of Decimal128VerifyClient class. - * - * @return an instance of Decimal128VerifyClient. - */ - @Generated - public Decimal128VerifyClient buildDecimal128VerifyClient() { - return new Decimal128VerifyClient(buildInnerClient().getDecimal128Verifies()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ScalarClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationAsyncClient.java deleted file mode 100644 index 74d3f15b231..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationAsyncClient.java +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.scalar.implementation.StringOperationsImpl; - -/** - * Initializes a new instance of the asynchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) -public final class StringOperationAsyncClient { - @Generated - private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperationAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationAsyncClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * get string value. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return string value along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * put string value. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * get string value. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return string value on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(String.class)); - } - - /** - * put string value. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(String body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationClient.java deleted file mode 100644 index 51fd1fe4a6e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationClient.java +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.scalar.implementation.StringOperationsImpl; - -/** - * Initializes a new instance of the synchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class) -public final class StringOperationClient { - @Generated - private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperationClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * get string value. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return string value along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * put string value. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * get string value. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return string value. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public String get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(String.class); - } - - /** - * put string value. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(String body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownAsyncClient.java deleted file mode 100644 index 6e4b478f45b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownAsyncClient.java +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.scalar.implementation.UnknownsImpl; - -/** - * Initializes a new instance of the asynchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) -public final class UnknownAsyncClient { - @Generated - private final UnknownsImpl serviceClient; - - /** - * Initializes an instance of UnknownAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownAsyncClient(UnknownsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * get unknown value. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return unknown value along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * put unknown value. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(body, requestOptions); - } - - /** - * get unknown value. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return unknown value on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * put unknown value. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(BinaryData body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(body, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownClient.java deleted file mode 100644 index d4346bfe0b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownClient.java +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.scalar.implementation.UnknownsImpl; - -/** - * Initializes a new instance of the synchronous ScalarClient type. - */ -@ServiceClient(builder = ScalarClientBuilder.class) -public final class UnknownClient { - @Generated - private final UnknownsImpl serviceClient; - - /** - * Initializes an instance of UnknownClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - UnknownClient(UnknownsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * get unknown value. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return unknown value along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * put unknown value. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(body, requestOptions); - } - - /** - * get unknown value. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return unknown value. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue(); - } - - /** - * put unknown value. - * - * @param body _. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void put(BinaryData body) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - putWithResponse(body, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/BooleanOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/BooleanOperationsImpl.java deleted file mode 100644 index e7caf161fb6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/BooleanOperationsImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in BooleanOperations. - */ -public final class BooleanOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final BooleanOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ScalarClientImpl client; - - /** - * Initializes an instance of BooleanOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - BooleanOperationsImpl(ScalarClientImpl client) { - this.service - = RestProxy.create(BooleanOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ScalarClientBooleanOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ScalarClientBooleanOperations") - public interface BooleanOperationsService { - @Get("/type/scalar/boolean") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/scalar/boolean") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/scalar/boolean") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/scalar/boolean") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * get boolean value. - *

Response Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return boolean value along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * get boolean value. - *

Response Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return boolean value along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * put boolean value. - *

Request Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * put boolean value. - *

Request Body Schema

- * - *
-     * {@code
-     * boolean
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128TypesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128TypesImpl.java deleted file mode 100644 index 989b7c7a9eb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128TypesImpl.java +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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.math.BigDecimal; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Decimal128Types. - */ -public final class Decimal128TypesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Decimal128TypesService service; - - /** - * The service client containing this operation class. - */ - private final ScalarClientImpl client; - - /** - * Initializes an instance of Decimal128TypesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Decimal128TypesImpl(ScalarClientImpl client) { - this.service - = RestProxy.create(Decimal128TypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ScalarClientDecimal128Types to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ScalarClientDecimal128Types") - public interface Decimal128TypesService { - @Get("/type/scalar/decimal128/response_body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> responseBody(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/scalar/decimal128/response_body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response responseBodySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/scalar/decimal128/resquest_body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> requestBody(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/scalar/decimal128/resquest_body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response requestBodySync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Get("/type/scalar/decimal128/request_parameter") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> requestParameter(@HostParam("endpoint") String endpoint, - @QueryParam("value") BigDecimal value, RequestOptions requestOptions, Context context); - - @Get("/type/scalar/decimal128/request_parameter") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response requestParameterSync(@HostParam("endpoint") String endpoint, - @QueryParam("value") BigDecimal value, RequestOptions requestOptions, Context context); - } - - /** - * The responseBody operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 128-bit decimal number along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> responseBodyWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.responseBody(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The responseBody operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a 128-bit decimal number along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response responseBodyWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.responseBodySync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The requestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requestBodyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.requestBody(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The requestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requestBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.requestBodySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The requestParameter operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requestParameterWithResponseAsync(BigDecimal value, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.requestParameter(this.client.getEndpoint(), value, requestOptions, context)); - } - - /** - * The requestParameter operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requestParameterWithResponse(BigDecimal value, RequestOptions requestOptions) { - return service.requestParameterSync(this.client.getEndpoint(), value, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128VerifiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128VerifiesImpl.java deleted file mode 100644 index da20cdb59e6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128VerifiesImpl.java +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Decimal128Verifies. - */ -public final class Decimal128VerifiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final Decimal128VerifiesService service; - - /** - * The service client containing this operation class. - */ - private final ScalarClientImpl client; - - /** - * Initializes an instance of Decimal128VerifiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - Decimal128VerifiesImpl(ScalarClientImpl client) { - this.service = RestProxy.create(Decimal128VerifiesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ScalarClientDecimal128Verifies to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ScalarClientDecimal128Verifies") - public interface Decimal128VerifiesService { - @Get("/type/scalar/decimal128/prepare_verify") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> prepareVerify(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/scalar/decimal128/prepare_verify") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response prepareVerifySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/type/scalar/decimal128/verify") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> verify(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/type/scalar/decimal128/verify") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response verifySync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The prepareVerify operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     BigDecimal (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> prepareVerifyWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.prepareVerify(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The prepareVerify operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     BigDecimal (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response prepareVerifyWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.prepareVerifySync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The verify operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> verifyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.verify(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The verify operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response verifyWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.verifySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalTypesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalTypesImpl.java deleted file mode 100644 index 19bd429ff62..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalTypesImpl.java +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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.math.BigDecimal; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DecimalTypes. - */ -public final class DecimalTypesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DecimalTypesService service; - - /** - * The service client containing this operation class. - */ - private final ScalarClientImpl client; - - /** - * Initializes an instance of DecimalTypesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DecimalTypesImpl(ScalarClientImpl client) { - this.service - = RestProxy.create(DecimalTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ScalarClientDecimalTypes to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ScalarClientDecimalTypes") - public interface DecimalTypesService { - @Get("/type/scalar/decimal/response_body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> responseBody(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/scalar/decimal/response_body") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response responseBodySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Put("/type/scalar/decimal/resquest_body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> requestBody(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/scalar/decimal/resquest_body") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response requestBodySync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Get("/type/scalar/decimal/request_parameter") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> requestParameter(@HostParam("endpoint") String endpoint, - @QueryParam("value") BigDecimal value, RequestOptions requestOptions, Context context); - - @Get("/type/scalar/decimal/request_parameter") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response requestParameterSync(@HostParam("endpoint") String endpoint, - @QueryParam("value") BigDecimal value, RequestOptions requestOptions, Context context); - } - - /** - * The responseBody operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a decimal number with any length and precision along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> responseBodyWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.responseBody(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The responseBody operation. - *

Response Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a decimal number with any length and precision along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response responseBodyWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.responseBodySync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The requestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requestBodyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.requestBody(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The requestBody operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requestBodyWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.requestBodySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } - - /** - * The requestParameter operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> requestParameterWithResponseAsync(BigDecimal value, RequestOptions requestOptions) { - return FluxUtil.withContext( - context -> service.requestParameter(this.client.getEndpoint(), value, requestOptions, context)); - } - - /** - * The requestParameter operation. - * - * @param value The value parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response requestParameterWithResponse(BigDecimal value, RequestOptions requestOptions) { - return service.requestParameterSync(this.client.getEndpoint(), value, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalVerifiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalVerifiesImpl.java deleted file mode 100644 index 71389141343..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalVerifiesImpl.java +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in DecimalVerifies. - */ -public final class DecimalVerifiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final DecimalVerifiesService service; - - /** - * The service client containing this operation class. - */ - private final ScalarClientImpl client; - - /** - * Initializes an instance of DecimalVerifiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - DecimalVerifiesImpl(ScalarClientImpl client) { - this.service - = RestProxy.create(DecimalVerifiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ScalarClientDecimalVerifies to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ScalarClientDecimalVerifies") - public interface DecimalVerifiesService { - @Get("/type/scalar/decimal/prepare_verify") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> prepareVerify(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Get("/type/scalar/decimal/prepare_verify") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response prepareVerifySync(@HostParam("endpoint") String endpoint, - @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); - - @Post("/type/scalar/decimal/verify") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> verify(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/type/scalar/decimal/verify") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response verifySync(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The prepareVerify operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     BigDecimal (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> prepareVerifyWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.prepareVerify(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The prepareVerify operation. - *

Response Body Schema

- * - *
-     * {@code
-     * [
-     *     BigDecimal (Required)
-     * ]
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response prepareVerifyWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.prepareVerifySync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The verify operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> verifyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.verify(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * The verify operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BigDecimal
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response verifyWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.verifySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/ScalarClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/ScalarClientImpl.java deleted file mode 100644 index ea22ed4ea3d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/ScalarClientImpl.java +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 ScalarClient type. - */ -public final class ScalarClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 StringOperationsImpl object to access its operations. - */ - private final StringOperationsImpl stringOperations; - - /** - * Gets the StringOperationsImpl object to access its operations. - * - * @return the StringOperationsImpl object. - */ - public StringOperationsImpl getStringOperations() { - return this.stringOperations; - } - - /** - * The BooleanOperationsImpl object to access its operations. - */ - private final BooleanOperationsImpl booleanOperations; - - /** - * Gets the BooleanOperationsImpl object to access its operations. - * - * @return the BooleanOperationsImpl object. - */ - public BooleanOperationsImpl getBooleanOperations() { - return this.booleanOperations; - } - - /** - * The UnknownsImpl object to access its operations. - */ - private final UnknownsImpl unknowns; - - /** - * Gets the UnknownsImpl object to access its operations. - * - * @return the UnknownsImpl object. - */ - public UnknownsImpl getUnknowns() { - return this.unknowns; - } - - /** - * The DecimalTypesImpl object to access its operations. - */ - private final DecimalTypesImpl decimalTypes; - - /** - * Gets the DecimalTypesImpl object to access its operations. - * - * @return the DecimalTypesImpl object. - */ - public DecimalTypesImpl getDecimalTypes() { - return this.decimalTypes; - } - - /** - * The Decimal128TypesImpl object to access its operations. - */ - private final Decimal128TypesImpl decimal128Types; - - /** - * Gets the Decimal128TypesImpl object to access its operations. - * - * @return the Decimal128TypesImpl object. - */ - public Decimal128TypesImpl getDecimal128Types() { - return this.decimal128Types; - } - - /** - * The DecimalVerifiesImpl object to access its operations. - */ - private final DecimalVerifiesImpl decimalVerifies; - - /** - * Gets the DecimalVerifiesImpl object to access its operations. - * - * @return the DecimalVerifiesImpl object. - */ - public DecimalVerifiesImpl getDecimalVerifies() { - return this.decimalVerifies; - } - - /** - * The Decimal128VerifiesImpl object to access its operations. - */ - private final Decimal128VerifiesImpl decimal128Verifies; - - /** - * Gets the Decimal128VerifiesImpl object to access its operations. - * - * @return the Decimal128VerifiesImpl object. - */ - public Decimal128VerifiesImpl getDecimal128Verifies() { - return this.decimal128Verifies; - } - - /** - * Initializes an instance of ScalarClient client. - * - * @param endpoint Service host. - */ - public ScalarClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ScalarClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public ScalarClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of ScalarClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public ScalarClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.stringOperations = new StringOperationsImpl(this); - this.booleanOperations = new BooleanOperationsImpl(this); - this.unknowns = new UnknownsImpl(this); - this.decimalTypes = new DecimalTypesImpl(this); - this.decimal128Types = new Decimal128TypesImpl(this); - this.decimalVerifies = new DecimalVerifiesImpl(this); - this.decimal128Verifies = new Decimal128VerifiesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/StringOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/StringOperationsImpl.java deleted file mode 100644 index 4ea1e8f4946..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/StringOperationsImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringOperations. - */ -public final class StringOperationsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringOperationsService service; - - /** - * The service client containing this operation class. - */ - private final ScalarClientImpl client; - - /** - * Initializes an instance of StringOperationsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringOperationsImpl(ScalarClientImpl client) { - this.service - = RestProxy.create(StringOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ScalarClientStringOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ScalarClientStringOperations") - public interface StringOperationsService { - @Get("/type/scalar/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/scalar/string") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/scalar/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/scalar/string") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * get string value. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return string value along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * get string value. - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return string value along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * put string value. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * put string value. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/UnknownsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/UnknownsImpl.java deleted file mode 100644 index 22a87883706..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/UnknownsImpl.java +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in Unknowns. - */ -public final class UnknownsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final UnknownsService service; - - /** - * The service client containing this operation class. - */ - private final ScalarClientImpl client; - - /** - * Initializes an instance of UnknownsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - UnknownsImpl(ScalarClientImpl client) { - this.service = RestProxy.create(UnknownsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for ScalarClientUnknowns to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "ScalarClientUnknowns") - public interface UnknownsService { - @Get("/type/scalar/unknown") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/scalar/unknown") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/scalar/unknown") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Put("/type/scalar/unknown") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * get unknown value. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return unknown value along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * get unknown value. - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return unknown value along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * put unknown value. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil - .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); - } - - /** - * put unknown value. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param body _. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/package-info.java deleted file mode 100644 index 2f86196a408..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Scalar. - * - */ -package type.scalar.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/package-info.java deleted file mode 100644 index 7d804ba2624..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Scalar. - * - */ -package type.scalar; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyAsyncClient.java deleted file mode 100644 index d225b1f6427..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyAsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.implementation.EnumsOnliesImpl; -import type.union.implementation.models.SendRequest6; -import type.union.models.EnumsOnlyCases; -import type.union.models.GetResponse6; - -/** - * Initializes a new instance of the asynchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) -public final class EnumsOnlyAsyncClient { - @Generated - private final EnumsOnliesImpl serviceClient; - - /** - * Initializes an instance of EnumsOnlyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnumsOnlyAsyncClient(EnumsOnliesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         lr: String(left/right/up/down) (Required)
-     *         ud: String(up/down) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         lr: String(left/right/up/down) (Required)
-     *         ud: String(up/down) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest6 The sendRequest6 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(BinaryData sendRequest6, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(sendRequest6, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GetResponse6.class)); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(EnumsOnlyCases prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest6 sendRequest6Obj = new SendRequest6(prop); - BinaryData sendRequest6 = BinaryData.fromObject(sendRequest6Obj); - return sendWithResponse(sendRequest6, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyClient.java deleted file mode 100644 index e620c35453d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.implementation.EnumsOnliesImpl; -import type.union.implementation.models.SendRequest6; -import type.union.models.EnumsOnlyCases; -import type.union.models.GetResponse6; - -/** - * Initializes a new instance of the synchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class) -public final class EnumsOnlyClient { - @Generated - private final EnumsOnliesImpl serviceClient; - - /** - * Initializes an instance of EnumsOnlyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnumsOnlyClient(EnumsOnliesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         lr: String(left/right/up/down) (Required)
-     *         ud: String(up/down) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         lr: String(left/right/up/down) (Required)
-     *         ud: String(up/down) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest6 The sendRequest6 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest6, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(sendRequest6, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GetResponse6 get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(GetResponse6.class); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(EnumsOnlyCases prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest6 sendRequest6Obj = new SendRequest6(prop); - BinaryData sendRequest6 = BinaryData.fromObject(sendRequest6Obj); - sendWithResponse(sendRequest6, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyAsyncClient.java deleted file mode 100644 index aa9e58f0d88..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyAsyncClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.implementation.FloatsOnliesImpl; -import type.union.implementation.models.SendRequest4; -import type.union.models.GetResponse4; -import type.union.models.GetResponseProp3; - -/** - * Initializes a new instance of the asynchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) -public final class FloatsOnlyAsyncClient { - @Generated - private final FloatsOnliesImpl serviceClient; - - /** - * Initializes an instance of FloatsOnlyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FloatsOnlyAsyncClient(FloatsOnliesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1.1/2.2/3.3) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1.1/2.2/3.3) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest4 The sendRequest4 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(BinaryData sendRequest4, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(sendRequest4, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GetResponse4.class)); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(GetResponseProp3 prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest4 sendRequest4Obj = new SendRequest4(prop); - BinaryData sendRequest4 = BinaryData.fromObject(sendRequest4Obj); - return sendWithResponse(sendRequest4, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyClient.java deleted file mode 100644 index 97cf78ffb2c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.implementation.FloatsOnliesImpl; -import type.union.implementation.models.SendRequest4; -import type.union.models.GetResponse4; -import type.union.models.GetResponseProp3; - -/** - * Initializes a new instance of the synchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class) -public final class FloatsOnlyClient { - @Generated - private final FloatsOnliesImpl serviceClient; - - /** - * Initializes an instance of FloatsOnlyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - FloatsOnlyClient(FloatsOnliesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1.1/2.2/3.3) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1.1/2.2/3.3) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest4 The sendRequest4 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest4, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(sendRequest4, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GetResponse4 get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(GetResponse4.class); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(GetResponseProp3 prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest4 sendRequest4Obj = new SendRequest4(prop); - BinaryData sendRequest4 = BinaryData.fromObject(sendRequest4Obj); - sendWithResponse(sendRequest4, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyAsyncClient.java deleted file mode 100644 index 5e4af5b1241..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyAsyncClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.implementation.IntsOnliesImpl; -import type.union.implementation.models.SendRequest3; -import type.union.models.GetResponse3; -import type.union.models.GetResponseProp2; - -/** - * Initializes a new instance of the asynchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) -public final class IntsOnlyAsyncClient { - @Generated - private final IntsOnliesImpl serviceClient; - - /** - * Initializes an instance of IntsOnlyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IntsOnlyAsyncClient(IntsOnliesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1/2/3) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1/2/3) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest3 The sendRequest3 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(BinaryData sendRequest3, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(sendRequest3, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GetResponse3.class)); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(GetResponseProp2 prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest3 sendRequest3Obj = new SendRequest3(prop); - BinaryData sendRequest3 = BinaryData.fromObject(sendRequest3Obj); - return sendWithResponse(sendRequest3, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyClient.java deleted file mode 100644 index cbe8fec8eb9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.implementation.IntsOnliesImpl; -import type.union.implementation.models.SendRequest3; -import type.union.models.GetResponse3; -import type.union.models.GetResponseProp2; - -/** - * Initializes a new instance of the synchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class) -public final class IntsOnlyClient { - @Generated - private final IntsOnliesImpl serviceClient; - - /** - * Initializes an instance of IntsOnlyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - IntsOnlyClient(IntsOnliesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1/2/3) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1/2/3) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest3 The sendRequest3 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest3, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(sendRequest3, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GetResponse3 get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(GetResponse3.class); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(GetResponseProp2 prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest3 sendRequest3Obj = new SendRequest3(prop); - BinaryData sendRequest3 = BinaryData.fromObject(sendRequest3Obj); - sendWithResponse(sendRequest3, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsAsyncClient.java deleted file mode 100644 index a60a7bcbbdf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsAsyncClient.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.implementation.MixedLiteralsImpl; -import type.union.implementation.models.SendRequest8; -import type.union.models.GetResponse8; -import type.union.models.MixedLiteralsCases; - -/** - * Initializes a new instance of the asynchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) -public final class MixedLiteralsAsyncClient { - @Generated - private final MixedLiteralsImpl serviceClient; - - /** - * Initializes an instance of MixedLiteralsAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MixedLiteralsAsyncClient(MixedLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         stringLiteral: BinaryData (Required)
-     *         intLiteral: BinaryData (Required)
-     *         floatLiteral: BinaryData (Required)
-     *         booleanLiteral: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         stringLiteral: BinaryData (Required)
-     *         intLiteral: BinaryData (Required)
-     *         floatLiteral: BinaryData (Required)
-     *         booleanLiteral: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest8 The sendRequest8 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(BinaryData sendRequest8, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(sendRequest8, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GetResponse8.class)); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(MixedLiteralsCases prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest8 sendRequest8Obj = new SendRequest8(prop); - BinaryData sendRequest8 = BinaryData.fromObject(sendRequest8Obj); - return sendWithResponse(sendRequest8, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsClient.java deleted file mode 100644 index a62ee7e90cd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.implementation.MixedLiteralsImpl; -import type.union.implementation.models.SendRequest8; -import type.union.models.GetResponse8; -import type.union.models.MixedLiteralsCases; - -/** - * Initializes a new instance of the synchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class) -public final class MixedLiteralsClient { - @Generated - private final MixedLiteralsImpl serviceClient; - - /** - * Initializes an instance of MixedLiteralsClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MixedLiteralsClient(MixedLiteralsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         stringLiteral: BinaryData (Required)
-     *         intLiteral: BinaryData (Required)
-     *         floatLiteral: BinaryData (Required)
-     *         booleanLiteral: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         stringLiteral: BinaryData (Required)
-     *         intLiteral: BinaryData (Required)
-     *         floatLiteral: BinaryData (Required)
-     *         booleanLiteral: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest8 The sendRequest8 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest8, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(sendRequest8, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GetResponse8 get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(GetResponse8.class); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(MixedLiteralsCases prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest8 sendRequest8Obj = new SendRequest8(prop); - BinaryData sendRequest8 = BinaryData.fromObject(sendRequest8Obj); - sendWithResponse(sendRequest8, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesAsyncClient.java deleted file mode 100644 index c13c976836e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesAsyncClient.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.implementation.MixedTypesImpl; -import type.union.implementation.models.SendRequest9; -import type.union.models.GetResponse9; -import type.union.models.MixedTypesCases; - -/** - * Initializes a new instance of the asynchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) -public final class MixedTypesAsyncClient { - @Generated - private final MixedTypesImpl serviceClient; - - /** - * Initializes an instance of MixedTypesAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MixedTypesAsyncClient(MixedTypesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         model: BinaryData (Required)
-     *         literal: BinaryData (Required)
-     *         int: BinaryData (Required)
-     *         boolean: BinaryData (Required)
-     *         array (Required): [
-     *             BinaryData (Required)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         model: BinaryData (Required)
-     *         literal: BinaryData (Required)
-     *         int: BinaryData (Required)
-     *         boolean: BinaryData (Required)
-     *         array (Required): [
-     *             BinaryData (Required)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest9 The sendRequest9 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(BinaryData sendRequest9, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(sendRequest9, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GetResponse9.class)); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(MixedTypesCases prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest9 sendRequest9Obj = new SendRequest9(prop); - BinaryData sendRequest9 = BinaryData.fromObject(sendRequest9Obj); - return sendWithResponse(sendRequest9, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesClient.java deleted file mode 100644 index eb19100770c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesClient.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.implementation.MixedTypesImpl; -import type.union.implementation.models.SendRequest9; -import type.union.models.GetResponse9; -import type.union.models.MixedTypesCases; - -/** - * Initializes a new instance of the synchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class) -public final class MixedTypesClient { - @Generated - private final MixedTypesImpl serviceClient; - - /** - * Initializes an instance of MixedTypesClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MixedTypesClient(MixedTypesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         model: BinaryData (Required)
-     *         literal: BinaryData (Required)
-     *         int: BinaryData (Required)
-     *         boolean: BinaryData (Required)
-     *         array (Required): [
-     *             BinaryData (Required)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         model: BinaryData (Required)
-     *         literal: BinaryData (Required)
-     *         int: BinaryData (Required)
-     *         boolean: BinaryData (Required)
-     *         array (Required): [
-     *             BinaryData (Required)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest9 The sendRequest9 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest9, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(sendRequest9, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GetResponse9 get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(GetResponse9.class); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(MixedTypesCases prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest9 sendRequest9Obj = new SendRequest9(prop); - BinaryData sendRequest9 = BinaryData.fromObject(sendRequest9Obj); - sendWithResponse(sendRequest9, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyAsyncClient.java deleted file mode 100644 index e4398ccff94..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyAsyncClient.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.implementation.ModelsOnliesImpl; -import type.union.implementation.models.SendRequest5; -import type.union.models.GetResponse5; - -/** - * Initializes a new instance of the asynchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) -public final class ModelsOnlyAsyncClient { - @Generated - private final ModelsOnliesImpl serviceClient; - - /** - * Initializes an instance of ModelsOnlyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelsOnlyAsyncClient(ModelsOnliesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest5 The sendRequest5 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(BinaryData sendRequest5, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(sendRequest5, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GetResponse5.class)); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(BinaryData prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest5 sendRequest5Obj = new SendRequest5(prop); - BinaryData sendRequest5 = BinaryData.fromObject(sendRequest5Obj); - return sendWithResponse(sendRequest5, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyClient.java deleted file mode 100644 index a9b173d6784..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyClient.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.implementation.ModelsOnliesImpl; -import type.union.implementation.models.SendRequest5; -import type.union.models.GetResponse5; - -/** - * Initializes a new instance of the synchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class) -public final class ModelsOnlyClient { - @Generated - private final ModelsOnliesImpl serviceClient; - - /** - * Initializes an instance of ModelsOnlyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ModelsOnlyClient(ModelsOnliesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest5 The sendRequest5 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest5, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(sendRequest5, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GetResponse5 get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(GetResponse5.class); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(BinaryData prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest5 sendRequest5Obj = new SendRequest5(prop); - BinaryData sendRequest5 = BinaryData.fromObject(sendRequest5Obj); - sendWithResponse(sendRequest5, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayAsyncClient.java deleted file mode 100644 index 56f4fb3b777..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayAsyncClient.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.implementation.StringAndArraysImpl; -import type.union.implementation.models.SendRequest7; -import type.union.models.GetResponse7; -import type.union.models.StringAndArrayCases; - -/** - * Initializes a new instance of the asynchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) -public final class StringAndArrayAsyncClient { - @Generated - private final StringAndArraysImpl serviceClient; - - /** - * Initializes an instance of StringAndArrayAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringAndArrayAsyncClient(StringAndArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         string: BinaryData (Required)
-     *         array: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         string: BinaryData (Required)
-     *         array: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest7 The sendRequest7 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(BinaryData sendRequest7, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(sendRequest7, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GetResponse7.class)); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(StringAndArrayCases prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest7 sendRequest7Obj = new SendRequest7(prop); - BinaryData sendRequest7 = BinaryData.fromObject(sendRequest7Obj); - return sendWithResponse(sendRequest7, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayClient.java deleted file mode 100644 index cdf00c9eaa3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayClient.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.implementation.StringAndArraysImpl; -import type.union.implementation.models.SendRequest7; -import type.union.models.GetResponse7; -import type.union.models.StringAndArrayCases; - -/** - * Initializes a new instance of the synchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class) -public final class StringAndArrayClient { - @Generated - private final StringAndArraysImpl serviceClient; - - /** - * Initializes an instance of StringAndArrayClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringAndArrayClient(StringAndArraysImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         string: BinaryData (Required)
-     *         array: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         string: BinaryData (Required)
-     *         array: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest7 The sendRequest7 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest7, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(sendRequest7, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GetResponse7 get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(GetResponse7.class); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(StringAndArrayCases prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest7 sendRequest7Obj = new SendRequest7(prop); - BinaryData sendRequest7 = BinaryData.fromObject(sendRequest7Obj); - sendWithResponse(sendRequest7, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleAsyncClient.java deleted file mode 100644 index 8d020845d73..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleAsyncClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.implementation.StringExtensiblesImpl; -import type.union.implementation.models.SendRequest1; -import type.union.models.GetResponse1; -import type.union.models.GetResponseProp1; - -/** - * Initializes a new instance of the asynchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) -public final class StringExtensibleAsyncClient { - @Generated - private final StringExtensiblesImpl serviceClient; - - /** - * Initializes an instance of StringExtensibleAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringExtensibleAsyncClient(StringExtensiblesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest1 The sendRequest1 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(BinaryData sendRequest1, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(sendRequest1, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GetResponse1.class)); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(GetResponseProp1 prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest1 sendRequest1Obj = new SendRequest1(prop); - BinaryData sendRequest1 = BinaryData.fromObject(sendRequest1Obj); - return sendWithResponse(sendRequest1, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleClient.java deleted file mode 100644 index 3149cdd1520..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.implementation.StringExtensiblesImpl; -import type.union.implementation.models.SendRequest1; -import type.union.models.GetResponse1; -import type.union.models.GetResponseProp1; - -/** - * Initializes a new instance of the synchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class) -public final class StringExtensibleClient { - @Generated - private final StringExtensiblesImpl serviceClient; - - /** - * Initializes an instance of StringExtensibleClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringExtensibleClient(StringExtensiblesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest1 The sendRequest1 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest1, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(sendRequest1, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GetResponse1 get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(GetResponse1.class); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(GetResponseProp1 prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest1 sendRequest1Obj = new SendRequest1(prop); - BinaryData sendRequest1 = BinaryData.fromObject(sendRequest1Obj); - sendWithResponse(sendRequest1, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedAsyncClient.java deleted file mode 100644 index 301fd440c80..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedAsyncClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.implementation.StringExtensibleNamedsImpl; -import type.union.implementation.models.SendRequest2; -import type.union.models.GetResponse2; -import type.union.models.StringExtensibleNamedUnion; - -/** - * Initializes a new instance of the asynchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) -public final class StringExtensibleNamedAsyncClient { - @Generated - private final StringExtensibleNamedsImpl serviceClient; - - /** - * Initializes an instance of StringExtensibleNamedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringExtensibleNamedAsyncClient(StringExtensibleNamedsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest2 The sendRequest2 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(BinaryData sendRequest2, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(sendRequest2, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GetResponse2.class)); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(StringExtensibleNamedUnion prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest2 sendRequest2Obj = new SendRequest2(prop); - BinaryData sendRequest2 = BinaryData.fromObject(sendRequest2Obj); - return sendWithResponse(sendRequest2, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedClient.java deleted file mode 100644 index 117fd1dd10d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.implementation.StringExtensibleNamedsImpl; -import type.union.implementation.models.SendRequest2; -import type.union.models.GetResponse2; -import type.union.models.StringExtensibleNamedUnion; - -/** - * Initializes a new instance of the synchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class) -public final class StringExtensibleNamedClient { - @Generated - private final StringExtensibleNamedsImpl serviceClient; - - /** - * Initializes an instance of StringExtensibleNamedClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringExtensibleNamedClient(StringExtensibleNamedsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest2 The sendRequest2 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest2, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(sendRequest2, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GetResponse2 get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(GetResponse2.class); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(StringExtensibleNamedUnion prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest2 sendRequest2Obj = new SendRequest2(prop); - BinaryData sendRequest2 = BinaryData.fromObject(sendRequest2Obj); - sendWithResponse(sendRequest2, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyAsyncClient.java deleted file mode 100644 index 20b34eb175c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyAsyncClient.java +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.implementation.StringsOnliesImpl; -import type.union.implementation.models.SendRequest; -import type.union.models.GetResponse; -import type.union.models.GetResponseProp; - -/** - * Initializes a new instance of the asynchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) -public final class StringsOnlyAsyncClient { - @Generated - private final StringsOnliesImpl serviceClient; - - /** - * Initializes an instance of StringsOnlyAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringsOnlyAsyncClient(StringsOnliesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(a/b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(a/b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest The sendRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponse(BinaryData sendRequest, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponseAsync(sendRequest, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(GetResponse.class)); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono send(GetResponseProp prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest sendRequestObj = new SendRequest(prop); - BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); - return sendWithResponse(sendRequest, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyClient.java deleted file mode 100644 index 2bc76714898..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyClient.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.implementation.StringsOnliesImpl; -import type.union.implementation.models.SendRequest; -import type.union.models.GetResponse; -import type.union.models.GetResponseProp; - -/** - * Initializes a new instance of the synchronous UnionClient type. - */ -@ServiceClient(builder = UnionClientBuilder.class) -public final class StringsOnlyClient { - @Generated - private final StringsOnliesImpl serviceClient; - - /** - * Initializes an instance of StringsOnlyClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringsOnlyClient(StringsOnliesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(a/b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(a/b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest The sendRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest, RequestOptions requestOptions) { - return this.serviceClient.sendWithResponse(sendRequest, requestOptions); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public GetResponse get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(GetResponse.class); - } - - /** - * The send operation. - * - * @param prop The prop parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public void send(GetResponseProp prop) { - // Generated convenience method for sendWithResponse - RequestOptions requestOptions = new RequestOptions(); - SendRequest sendRequestObj = new SendRequest(prop); - BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); - sendWithResponse(sendRequest, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/UnionClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/UnionClientBuilder.java deleted file mode 100644 index 6d99e9f8194..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/UnionClientBuilder.java +++ /dev/null @@ -1,488 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.union.implementation.UnionClientImpl; - -/** - * A builder for creating a new instance of the UnionClient type. - */ -@ServiceClientBuilder( - serviceClients = { - StringsOnlyClient.class, - StringExtensibleClient.class, - StringExtensibleNamedClient.class, - IntsOnlyClient.class, - FloatsOnlyClient.class, - ModelsOnlyClient.class, - EnumsOnlyClient.class, - StringAndArrayClient.class, - MixedLiteralsClient.class, - MixedTypesClient.class, - StringsOnlyAsyncClient.class, - StringExtensibleAsyncClient.class, - StringExtensibleNamedAsyncClient.class, - IntsOnlyAsyncClient.class, - FloatsOnlyAsyncClient.class, - ModelsOnlyAsyncClient.class, - EnumsOnlyAsyncClient.class, - StringAndArrayAsyncClient.class, - MixedLiteralsAsyncClient.class, - MixedTypesAsyncClient.class }) -public final class UnionClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("type-union.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the UnionClientBuilder. - */ - @Generated - public UnionClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public UnionClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the UnionClientBuilder. - */ - @Generated - public UnionClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of UnionClientImpl with the provided parameters. - * - * @return an instance of UnionClientImpl. - */ - @Generated - private UnionClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - UnionClientImpl client - = new UnionClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of StringsOnlyAsyncClient class. - * - * @return an instance of StringsOnlyAsyncClient. - */ - @Generated - public StringsOnlyAsyncClient buildStringsOnlyAsyncClient() { - return new StringsOnlyAsyncClient(buildInnerClient().getStringsOnlies()); - } - - /** - * Builds an instance of StringExtensibleAsyncClient class. - * - * @return an instance of StringExtensibleAsyncClient. - */ - @Generated - public StringExtensibleAsyncClient buildStringExtensibleAsyncClient() { - return new StringExtensibleAsyncClient(buildInnerClient().getStringExtensibles()); - } - - /** - * Builds an instance of StringExtensibleNamedAsyncClient class. - * - * @return an instance of StringExtensibleNamedAsyncClient. - */ - @Generated - public StringExtensibleNamedAsyncClient buildStringExtensibleNamedAsyncClient() { - return new StringExtensibleNamedAsyncClient(buildInnerClient().getStringExtensibleNameds()); - } - - /** - * Builds an instance of IntsOnlyAsyncClient class. - * - * @return an instance of IntsOnlyAsyncClient. - */ - @Generated - public IntsOnlyAsyncClient buildIntsOnlyAsyncClient() { - return new IntsOnlyAsyncClient(buildInnerClient().getIntsOnlies()); - } - - /** - * Builds an instance of FloatsOnlyAsyncClient class. - * - * @return an instance of FloatsOnlyAsyncClient. - */ - @Generated - public FloatsOnlyAsyncClient buildFloatsOnlyAsyncClient() { - return new FloatsOnlyAsyncClient(buildInnerClient().getFloatsOnlies()); - } - - /** - * Builds an instance of ModelsOnlyAsyncClient class. - * - * @return an instance of ModelsOnlyAsyncClient. - */ - @Generated - public ModelsOnlyAsyncClient buildModelsOnlyAsyncClient() { - return new ModelsOnlyAsyncClient(buildInnerClient().getModelsOnlies()); - } - - /** - * Builds an instance of EnumsOnlyAsyncClient class. - * - * @return an instance of EnumsOnlyAsyncClient. - */ - @Generated - public EnumsOnlyAsyncClient buildEnumsOnlyAsyncClient() { - return new EnumsOnlyAsyncClient(buildInnerClient().getEnumsOnlies()); - } - - /** - * Builds an instance of StringAndArrayAsyncClient class. - * - * @return an instance of StringAndArrayAsyncClient. - */ - @Generated - public StringAndArrayAsyncClient buildStringAndArrayAsyncClient() { - return new StringAndArrayAsyncClient(buildInnerClient().getStringAndArrays()); - } - - /** - * Builds an instance of MixedLiteralsAsyncClient class. - * - * @return an instance of MixedLiteralsAsyncClient. - */ - @Generated - public MixedLiteralsAsyncClient buildMixedLiteralsAsyncClient() { - return new MixedLiteralsAsyncClient(buildInnerClient().getMixedLiterals()); - } - - /** - * Builds an instance of MixedTypesAsyncClient class. - * - * @return an instance of MixedTypesAsyncClient. - */ - @Generated - public MixedTypesAsyncClient buildMixedTypesAsyncClient() { - return new MixedTypesAsyncClient(buildInnerClient().getMixedTypes()); - } - - /** - * Builds an instance of StringsOnlyClient class. - * - * @return an instance of StringsOnlyClient. - */ - @Generated - public StringsOnlyClient buildStringsOnlyClient() { - return new StringsOnlyClient(buildInnerClient().getStringsOnlies()); - } - - /** - * Builds an instance of StringExtensibleClient class. - * - * @return an instance of StringExtensibleClient. - */ - @Generated - public StringExtensibleClient buildStringExtensibleClient() { - return new StringExtensibleClient(buildInnerClient().getStringExtensibles()); - } - - /** - * Builds an instance of StringExtensibleNamedClient class. - * - * @return an instance of StringExtensibleNamedClient. - */ - @Generated - public StringExtensibleNamedClient buildStringExtensibleNamedClient() { - return new StringExtensibleNamedClient(buildInnerClient().getStringExtensibleNameds()); - } - - /** - * Builds an instance of IntsOnlyClient class. - * - * @return an instance of IntsOnlyClient. - */ - @Generated - public IntsOnlyClient buildIntsOnlyClient() { - return new IntsOnlyClient(buildInnerClient().getIntsOnlies()); - } - - /** - * Builds an instance of FloatsOnlyClient class. - * - * @return an instance of FloatsOnlyClient. - */ - @Generated - public FloatsOnlyClient buildFloatsOnlyClient() { - return new FloatsOnlyClient(buildInnerClient().getFloatsOnlies()); - } - - /** - * Builds an instance of ModelsOnlyClient class. - * - * @return an instance of ModelsOnlyClient. - */ - @Generated - public ModelsOnlyClient buildModelsOnlyClient() { - return new ModelsOnlyClient(buildInnerClient().getModelsOnlies()); - } - - /** - * Builds an instance of EnumsOnlyClient class. - * - * @return an instance of EnumsOnlyClient. - */ - @Generated - public EnumsOnlyClient buildEnumsOnlyClient() { - return new EnumsOnlyClient(buildInnerClient().getEnumsOnlies()); - } - - /** - * Builds an instance of StringAndArrayClient class. - * - * @return an instance of StringAndArrayClient. - */ - @Generated - public StringAndArrayClient buildStringAndArrayClient() { - return new StringAndArrayClient(buildInnerClient().getStringAndArrays()); - } - - /** - * Builds an instance of MixedLiteralsClient class. - * - * @return an instance of MixedLiteralsClient. - */ - @Generated - public MixedLiteralsClient buildMixedLiteralsClient() { - return new MixedLiteralsClient(buildInnerClient().getMixedLiterals()); - } - - /** - * Builds an instance of MixedTypesClient class. - * - * @return an instance of MixedTypesClient. - */ - @Generated - public MixedTypesClient buildMixedTypesClient() { - return new MixedTypesClient(buildInnerClient().getMixedTypes()); - } - - private static final ClientLogger LOGGER = new ClientLogger(UnionClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/DiscriminatedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/DiscriminatedClientBuilder.java deleted file mode 100644 index 345d218fae4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/DiscriminatedClientBuilder.java +++ /dev/null @@ -1,357 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import type.union.discriminated.implementation.DiscriminatedClientImpl; - -/** - * A builder for creating a new instance of the DiscriminatedClient type. - */ -@ServiceClientBuilder( - serviceClients = { - EnvelopeObjectDefaultClient.class, - EnvelopeObjectCustomPropertiesClient.class, - NoEnvelopeDefaultClient.class, - NoEnvelopeCustomDiscriminatorClient.class, - EnvelopeObjectDefaultAsyncClient.class, - EnvelopeObjectCustomPropertiesAsyncClient.class, - NoEnvelopeDefaultAsyncClient.class, - NoEnvelopeCustomDiscriminatorAsyncClient.class }) -public final class DiscriminatedClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("type-union-discriminated.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the DiscriminatedClientBuilder. - */ - @Generated - public DiscriminatedClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatedClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatedClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatedClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatedClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatedClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public DiscriminatedClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the DiscriminatedClientBuilder. - */ - @Generated - public DiscriminatedClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of DiscriminatedClientImpl with the provided parameters. - * - * @return an instance of DiscriminatedClientImpl. - */ - @Generated - private DiscriminatedClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; - DiscriminatedClientImpl client = new DiscriminatedClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of EnvelopeObjectDefaultAsyncClient class. - * - * @return an instance of EnvelopeObjectDefaultAsyncClient. - */ - @Generated - public EnvelopeObjectDefaultAsyncClient buildEnvelopeObjectDefaultAsyncClient() { - return new EnvelopeObjectDefaultAsyncClient(buildInnerClient().getEnvelopeObjectDefaults()); - } - - /** - * Builds an instance of EnvelopeObjectCustomPropertiesAsyncClient class. - * - * @return an instance of EnvelopeObjectCustomPropertiesAsyncClient. - */ - @Generated - public EnvelopeObjectCustomPropertiesAsyncClient buildEnvelopeObjectCustomPropertiesAsyncClient() { - return new EnvelopeObjectCustomPropertiesAsyncClient(buildInnerClient().getEnvelopeObjectCustomProperties()); - } - - /** - * Builds an instance of NoEnvelopeDefaultAsyncClient class. - * - * @return an instance of NoEnvelopeDefaultAsyncClient. - */ - @Generated - public NoEnvelopeDefaultAsyncClient buildNoEnvelopeDefaultAsyncClient() { - return new NoEnvelopeDefaultAsyncClient(buildInnerClient().getNoEnvelopeDefaults()); - } - - /** - * Builds an instance of NoEnvelopeCustomDiscriminatorAsyncClient class. - * - * @return an instance of NoEnvelopeCustomDiscriminatorAsyncClient. - */ - @Generated - public NoEnvelopeCustomDiscriminatorAsyncClient buildNoEnvelopeCustomDiscriminatorAsyncClient() { - return new NoEnvelopeCustomDiscriminatorAsyncClient(buildInnerClient().getNoEnvelopeCustomDiscriminators()); - } - - /** - * Builds an instance of EnvelopeObjectDefaultClient class. - * - * @return an instance of EnvelopeObjectDefaultClient. - */ - @Generated - public EnvelopeObjectDefaultClient buildEnvelopeObjectDefaultClient() { - return new EnvelopeObjectDefaultClient(buildInnerClient().getEnvelopeObjectDefaults()); - } - - /** - * Builds an instance of EnvelopeObjectCustomPropertiesClient class. - * - * @return an instance of EnvelopeObjectCustomPropertiesClient. - */ - @Generated - public EnvelopeObjectCustomPropertiesClient buildEnvelopeObjectCustomPropertiesClient() { - return new EnvelopeObjectCustomPropertiesClient(buildInnerClient().getEnvelopeObjectCustomProperties()); - } - - /** - * Builds an instance of NoEnvelopeDefaultClient class. - * - * @return an instance of NoEnvelopeDefaultClient. - */ - @Generated - public NoEnvelopeDefaultClient buildNoEnvelopeDefaultClient() { - return new NoEnvelopeDefaultClient(buildInnerClient().getNoEnvelopeDefaults()); - } - - /** - * Builds an instance of NoEnvelopeCustomDiscriminatorClient class. - * - * @return an instance of NoEnvelopeCustomDiscriminatorClient. - */ - @Generated - public NoEnvelopeCustomDiscriminatorClient buildNoEnvelopeCustomDiscriminatorClient() { - return new NoEnvelopeCustomDiscriminatorClient(buildInnerClient().getNoEnvelopeCustomDiscriminators()); - } - - private static final ClientLogger LOGGER = new ClientLogger(DiscriminatedClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesAsyncClient.java deleted file mode 100644 index 3370506269c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesAsyncClient.java +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.discriminated.implementation.EnvelopeObjectCustomPropertiesImpl; - -/** - * Initializes a new instance of the asynchronous DiscriminatedClient type. - */ -@ServiceClient(builder = DiscriminatedClientBuilder.class, isAsync = true) -public final class EnvelopeObjectCustomPropertiesAsyncClient { - @Generated - private final EnvelopeObjectCustomPropertiesImpl serviceClient; - - /** - * Initializes an instance of EnvelopeObjectCustomPropertiesAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnvelopeObjectCustomPropertiesAsyncClient(EnvelopeObjectCustomPropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
petTypeStringNoThe petType parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(input, requestOptions); - } - - /** - * The get operation. - * - * @param petType The petType parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get(String petType) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (petType != null) { - requestOptions.addQueryParam("petType", petType, false); - } - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The put operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(BinaryData input) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesClient.java deleted file mode 100644 index 52889b34ac7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesClient.java +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.discriminated.implementation.EnvelopeObjectCustomPropertiesImpl; - -/** - * Initializes a new instance of the synchronous DiscriminatedClient type. - */ -@ServiceClient(builder = DiscriminatedClientBuilder.class) -public final class EnvelopeObjectCustomPropertiesClient { - @Generated - private final EnvelopeObjectCustomPropertiesImpl serviceClient; - - /** - * Initializes an instance of EnvelopeObjectCustomPropertiesClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnvelopeObjectCustomPropertiesClient(EnvelopeObjectCustomPropertiesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
petTypeStringNoThe petType parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(input, requestOptions); - } - - /** - * The get operation. - * - * @param petType The petType parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData get(String petType) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (petType != null) { - requestOptions.addQueryParam("petType", petType, false); - } - return getWithResponse(requestOptions).getValue(); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue(); - } - - /** - * The put operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData put(BinaryData input) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(input, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultAsyncClient.java deleted file mode 100644 index ad437fbc0b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultAsyncClient.java +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.discriminated.implementation.EnvelopeObjectDefaultsImpl; - -/** - * Initializes a new instance of the asynchronous DiscriminatedClient type. - */ -@ServiceClient(builder = DiscriminatedClientBuilder.class, isAsync = true) -public final class EnvelopeObjectDefaultAsyncClient { - @Generated - private final EnvelopeObjectDefaultsImpl serviceClient; - - /** - * Initializes an instance of EnvelopeObjectDefaultAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnvelopeObjectDefaultAsyncClient(EnvelopeObjectDefaultsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(input, requestOptions); - } - - /** - * The get operation. - * - * @param kind The kind parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get(String kind) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (kind != null) { - requestOptions.addQueryParam("kind", kind, false); - } - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The put operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(BinaryData input) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultClient.java deleted file mode 100644 index 5d4c5073765..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultClient.java +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.discriminated.implementation.EnvelopeObjectDefaultsImpl; - -/** - * Initializes a new instance of the synchronous DiscriminatedClient type. - */ -@ServiceClient(builder = DiscriminatedClientBuilder.class) -public final class EnvelopeObjectDefaultClient { - @Generated - private final EnvelopeObjectDefaultsImpl serviceClient; - - /** - * Initializes an instance of EnvelopeObjectDefaultClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - EnvelopeObjectDefaultClient(EnvelopeObjectDefaultsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(input, requestOptions); - } - - /** - * The get operation. - * - * @param kind The kind parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData get(String kind) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (kind != null) { - requestOptions.addQueryParam("kind", kind, false); - } - return getWithResponse(requestOptions).getValue(); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue(); - } - - /** - * The put operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData put(BinaryData input) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(input, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorAsyncClient.java deleted file mode 100644 index 759e359c721..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorAsyncClient.java +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.discriminated.implementation.NoEnvelopeCustomDiscriminatorsImpl; - -/** - * Initializes a new instance of the asynchronous DiscriminatedClient type. - */ -@ServiceClient(builder = DiscriminatedClientBuilder.class, isAsync = true) -public final class NoEnvelopeCustomDiscriminatorAsyncClient { - @Generated - private final NoEnvelopeCustomDiscriminatorsImpl serviceClient; - - /** - * Initializes an instance of NoEnvelopeCustomDiscriminatorAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NoEnvelopeCustomDiscriminatorAsyncClient(NoEnvelopeCustomDiscriminatorsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
typeStringNoThe type parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(input, requestOptions); - } - - /** - * The get operation. - * - * @param type The type parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get(String type) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (type != null) { - requestOptions.addQueryParam("type", type, false); - } - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The put operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(BinaryData input) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorClient.java deleted file mode 100644 index 916d32c18ae..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorClient.java +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.discriminated.implementation.NoEnvelopeCustomDiscriminatorsImpl; - -/** - * Initializes a new instance of the synchronous DiscriminatedClient type. - */ -@ServiceClient(builder = DiscriminatedClientBuilder.class) -public final class NoEnvelopeCustomDiscriminatorClient { - @Generated - private final NoEnvelopeCustomDiscriminatorsImpl serviceClient; - - /** - * Initializes an instance of NoEnvelopeCustomDiscriminatorClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NoEnvelopeCustomDiscriminatorClient(NoEnvelopeCustomDiscriminatorsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
typeStringNoThe type parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(input, requestOptions); - } - - /** - * The get operation. - * - * @param type The type parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData get(String type) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (type != null) { - requestOptions.addQueryParam("type", type, false); - } - return getWithResponse(requestOptions).getValue(); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue(); - } - - /** - * The put operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData put(BinaryData input) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(input, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultAsyncClient.java deleted file mode 100644 index 5ca3d2bf82c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultAsyncClient.java +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import type.union.discriminated.implementation.NoEnvelopeDefaultsImpl; - -/** - * Initializes a new instance of the asynchronous DiscriminatedClient type. - */ -@ServiceClient(builder = DiscriminatedClientBuilder.class, isAsync = true) -public final class NoEnvelopeDefaultAsyncClient { - @Generated - private final NoEnvelopeDefaultsImpl serviceClient; - - /** - * Initializes an instance of NoEnvelopeDefaultAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NoEnvelopeDefaultAsyncClient(NoEnvelopeDefaultsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponseAsync(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putWithResponseAsync(input, requestOptions); - } - - /** - * The get operation. - * - * @param kind The kind parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get(String kind) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (kind != null) { - requestOptions.addQueryParam("kind", kind, false); - } - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); - } - - /** - * The put operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono put(BinaryData input) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultClient.java deleted file mode 100644 index a1c255b645f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultClient.java +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import type.union.discriminated.implementation.NoEnvelopeDefaultsImpl; - -/** - * Initializes a new instance of the synchronous DiscriminatedClient type. - */ -@ServiceClient(builder = DiscriminatedClientBuilder.class) -public final class NoEnvelopeDefaultClient { - @Generated - private final NoEnvelopeDefaultsImpl serviceClient; - - /** - * Initializes an instance of NoEnvelopeDefaultClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NoEnvelopeDefaultClient(NoEnvelopeDefaultsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWithResponse(requestOptions); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { - return this.serviceClient.putWithResponse(input, requestOptions); - } - - /** - * The get operation. - * - * @param kind The kind parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData get(String kind) { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (kind != null) { - requestOptions.addQueryParam("kind", kind, false); - } - return getWithResponse(requestOptions).getValue(); - } - - /** - * The get operation. - * - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData get() { - // Generated convenience method for getWithResponse - RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue(); - } - - /** - * The put operation. - * - * @param input The input parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public BinaryData put(BinaryData input) { - // Generated convenience method for putWithResponse - RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(input, requestOptions).getValue(); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/DiscriminatedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/DiscriminatedClientImpl.java deleted file mode 100644 index 4e8f70e56d5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/DiscriminatedClientImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 DiscriminatedClient type. - */ -public final class DiscriminatedClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 EnvelopeObjectDefaultsImpl object to access its operations. - */ - private final EnvelopeObjectDefaultsImpl envelopeObjectDefaults; - - /** - * Gets the EnvelopeObjectDefaultsImpl object to access its operations. - * - * @return the EnvelopeObjectDefaultsImpl object. - */ - public EnvelopeObjectDefaultsImpl getEnvelopeObjectDefaults() { - return this.envelopeObjectDefaults; - } - - /** - * The EnvelopeObjectCustomPropertiesImpl object to access its operations. - */ - private final EnvelopeObjectCustomPropertiesImpl envelopeObjectCustomProperties; - - /** - * Gets the EnvelopeObjectCustomPropertiesImpl object to access its operations. - * - * @return the EnvelopeObjectCustomPropertiesImpl object. - */ - public EnvelopeObjectCustomPropertiesImpl getEnvelopeObjectCustomProperties() { - return this.envelopeObjectCustomProperties; - } - - /** - * The NoEnvelopeDefaultsImpl object to access its operations. - */ - private final NoEnvelopeDefaultsImpl noEnvelopeDefaults; - - /** - * Gets the NoEnvelopeDefaultsImpl object to access its operations. - * - * @return the NoEnvelopeDefaultsImpl object. - */ - public NoEnvelopeDefaultsImpl getNoEnvelopeDefaults() { - return this.noEnvelopeDefaults; - } - - /** - * The NoEnvelopeCustomDiscriminatorsImpl object to access its operations. - */ - private final NoEnvelopeCustomDiscriminatorsImpl noEnvelopeCustomDiscriminators; - - /** - * Gets the NoEnvelopeCustomDiscriminatorsImpl object to access its operations. - * - * @return the NoEnvelopeCustomDiscriminatorsImpl object. - */ - public NoEnvelopeCustomDiscriminatorsImpl getNoEnvelopeCustomDiscriminators() { - return this.noEnvelopeCustomDiscriminators; - } - - /** - * Initializes an instance of DiscriminatedClient client. - * - * @param endpoint Service host. - */ - public DiscriminatedClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DiscriminatedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public DiscriminatedClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of DiscriminatedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public DiscriminatedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.envelopeObjectDefaults = new EnvelopeObjectDefaultsImpl(this); - this.envelopeObjectCustomProperties = new EnvelopeObjectCustomPropertiesImpl(this); - this.noEnvelopeDefaults = new NoEnvelopeDefaultsImpl(this); - this.noEnvelopeCustomDiscriminators = new NoEnvelopeCustomDiscriminatorsImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectCustomPropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectCustomPropertiesImpl.java deleted file mode 100644 index 445e19e84c7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectCustomPropertiesImpl.java +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in EnvelopeObjectCustomProperties. - */ -public final class EnvelopeObjectCustomPropertiesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final EnvelopeObjectCustomPropertiesService service; - - /** - * The service client containing this operation class. - */ - private final DiscriminatedClientImpl client; - - /** - * Initializes an instance of EnvelopeObjectCustomPropertiesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - EnvelopeObjectCustomPropertiesImpl(DiscriminatedClientImpl client) { - this.service = RestProxy.create(EnvelopeObjectCustomPropertiesService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DiscriminatedClientEnvelopeObjectCustomProperties to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DiscriminatedClientEnvelopeObjectCustomProperties") - public interface EnvelopeObjectCustomPropertiesService { - @Get("/type/union/discriminated/envelope/object/custom-properties") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/discriminated/envelope/object/custom-properties") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/union/discriminated/envelope/object/custom-properties") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - - @Put("/type/union/discriminated/envelope/object/custom-properties") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
petTypeStringNoThe petType parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
petTypeStringNoThe petType parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.put(this.client.getEndpoint(), contentType, accept, input, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, accept, input, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectDefaultsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectDefaultsImpl.java deleted file mode 100644 index 5714bdcb19d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectDefaultsImpl.java +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in EnvelopeObjectDefaults. - */ -public final class EnvelopeObjectDefaultsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final EnvelopeObjectDefaultsService service; - - /** - * The service client containing this operation class. - */ - private final DiscriminatedClientImpl client; - - /** - * Initializes an instance of EnvelopeObjectDefaultsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - EnvelopeObjectDefaultsImpl(DiscriminatedClientImpl client) { - this.service = RestProxy.create(EnvelopeObjectDefaultsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DiscriminatedClientEnvelopeObjectDefaults to be used by the proxy - * service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DiscriminatedClientEnvelopeObjectDefaults") - public interface EnvelopeObjectDefaultsService { - @Get("/type/union/discriminated/envelope/object/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/discriminated/envelope/object/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/union/discriminated/envelope/object/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - - @Put("/type/union/discriminated/envelope/object/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.put(this.client.getEndpoint(), contentType, accept, input, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, accept, input, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeCustomDiscriminatorsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeCustomDiscriminatorsImpl.java deleted file mode 100644 index 9eb018e59d5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeCustomDiscriminatorsImpl.java +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in NoEnvelopeCustomDiscriminators. - */ -public final class NoEnvelopeCustomDiscriminatorsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NoEnvelopeCustomDiscriminatorsService service; - - /** - * The service client containing this operation class. - */ - private final DiscriminatedClientImpl client; - - /** - * Initializes an instance of NoEnvelopeCustomDiscriminatorsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NoEnvelopeCustomDiscriminatorsImpl(DiscriminatedClientImpl client) { - this.service = RestProxy.create(NoEnvelopeCustomDiscriminatorsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DiscriminatedClientNoEnvelopeCustomDiscriminators to be used by the - * proxy service to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DiscriminatedClientNoEnvelopeCustomDiscriminators") - public interface NoEnvelopeCustomDiscriminatorsService { - @Get("/type/union/discriminated/no-envelope/custom-discriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/discriminated/no-envelope/custom-discriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/union/discriminated/no-envelope/custom-discriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - - @Put("/type/union/discriminated/no-envelope/custom-discriminator") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
typeStringNoThe type parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
typeStringNoThe type parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.put(this.client.getEndpoint(), contentType, accept, input, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, accept, input, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeDefaultsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeDefaultsImpl.java deleted file mode 100644 index b9b5016e201..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeDefaultsImpl.java +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Put; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in NoEnvelopeDefaults. - */ -public final class NoEnvelopeDefaultsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NoEnvelopeDefaultsService service; - - /** - * The service client containing this operation class. - */ - private final DiscriminatedClientImpl client; - - /** - * Initializes an instance of NoEnvelopeDefaultsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NoEnvelopeDefaultsImpl(DiscriminatedClientImpl client) { - this.service = RestProxy.create(NoEnvelopeDefaultsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for DiscriminatedClientNoEnvelopeDefaults to be used by the proxy service - * to perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "DiscriminatedClientNoEnvelopeDefaults") - public interface NoEnvelopeDefaultsService { - @Get("/type/union/discriminated/no-envelope/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/discriminated/no-envelope/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Put("/type/union/discriminated/no-envelope/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> put(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - - @Put("/type/union/discriminated/no-envelope/default") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response putSync(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> putWithResponseAsync(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.put(this.client.getEndpoint(), contentType, accept, input, requestOptions, context)); - } - - /** - * The put operation. - *

Request Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * BinaryData
-     * }
-     * 
- * - * @param input The input parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.putSync(this.client.getEndpoint(), contentType, accept, input, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/package-info.java deleted file mode 100644 index 6871c6c6f53..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Discriminated. - * Describe scenarios for discriminated unions. - * - */ -package type.union.discriminated.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/package-info.java deleted file mode 100644 index 7b54fc1b574..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Discriminated. - * Describe scenarios for discriminated unions. - * - */ -package type.union.discriminated; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/EnumsOnliesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/EnumsOnliesImpl.java deleted file mode 100644 index 608a4c002a2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/EnumsOnliesImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in EnumsOnlies. - */ -public final class EnumsOnliesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final EnumsOnliesService service; - - /** - * The service client containing this operation class. - */ - private final UnionClientImpl client; - - /** - * Initializes an instance of EnumsOnliesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - EnumsOnliesImpl(UnionClientImpl client) { - this.service - = RestProxy.create(EnumsOnliesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UnionClientEnumsOnlies to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UnionClientEnumsOnlies") - public interface EnumsOnliesService { - @Get("/type/union/enums-only") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/enums-only") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/type/union/enums-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest6, - RequestOptions requestOptions, Context context); - - @Post("/type/union/enums-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendRequest6, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         lr: String(left/right/up/down) (Required)
-     *         ud: String(up/down) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         lr: String(left/right/up/down) (Required)
-     *         ud: String(up/down) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         lr: String(left/right/up/down) (Required)
-     *         ud: String(up/down) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest6 The sendRequest6 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(BinaryData sendRequest6, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.send(this.client.getEndpoint(), contentType, sendRequest6, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         lr: String(left/right/up/down) (Required)
-     *         ud: String(up/down) (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest6 The sendRequest6 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest6, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendSync(this.client.getEndpoint(), contentType, sendRequest6, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/FloatsOnliesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/FloatsOnliesImpl.java deleted file mode 100644 index ef68f5571ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/FloatsOnliesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in FloatsOnlies. - */ -public final class FloatsOnliesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final FloatsOnliesService service; - - /** - * The service client containing this operation class. - */ - private final UnionClientImpl client; - - /** - * Initializes an instance of FloatsOnliesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - FloatsOnliesImpl(UnionClientImpl client) { - this.service - = RestProxy.create(FloatsOnliesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UnionClientFloatsOnlies to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UnionClientFloatsOnlies") - public interface FloatsOnliesService { - @Get("/type/union/floats-only") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/floats-only") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/type/union/floats-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest4, - RequestOptions requestOptions, Context context); - - @Post("/type/union/floats-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendRequest4, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1.1/2.2/3.3) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1.1/2.2/3.3) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1.1/2.2/3.3) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest4 The sendRequest4 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(BinaryData sendRequest4, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.send(this.client.getEndpoint(), contentType, sendRequest4, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1.1/2.2/3.3) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest4 The sendRequest4 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest4, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendSync(this.client.getEndpoint(), contentType, sendRequest4, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/IntsOnliesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/IntsOnliesImpl.java deleted file mode 100644 index a2a3eca8b13..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/IntsOnliesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in IntsOnlies. - */ -public final class IntsOnliesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final IntsOnliesService service; - - /** - * The service client containing this operation class. - */ - private final UnionClientImpl client; - - /** - * Initializes an instance of IntsOnliesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - IntsOnliesImpl(UnionClientImpl client) { - this.service - = RestProxy.create(IntsOnliesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UnionClientIntsOnlies to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UnionClientIntsOnlies") - public interface IntsOnliesService { - @Get("/type/union/ints-only") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/ints-only") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/type/union/ints-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest3, - RequestOptions requestOptions, Context context); - - @Post("/type/union/ints-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendRequest3, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1/2/3) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1/2/3) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1/2/3) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest3 The sendRequest3 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(BinaryData sendRequest3, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.send(this.client.getEndpoint(), contentType, sendRequest3, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(1/2/3) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest3 The sendRequest3 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest3, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendSync(this.client.getEndpoint(), contentType, sendRequest3, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedLiteralsImpl.java deleted file mode 100644 index f2d48e7f5a0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedLiteralsImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in MixedLiterals. - */ -public final class MixedLiteralsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MixedLiteralsService service; - - /** - * The service client containing this operation class. - */ - private final UnionClientImpl client; - - /** - * Initializes an instance of MixedLiteralsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - MixedLiteralsImpl(UnionClientImpl client) { - this.service - = RestProxy.create(MixedLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UnionClientMixedLiterals to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UnionClientMixedLiterals") - public interface MixedLiteralsService { - @Get("/type/union/mixed-literals") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/mixed-literals") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/type/union/mixed-literals") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest8, - RequestOptions requestOptions, Context context); - - @Post("/type/union/mixed-literals") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendRequest8, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         stringLiteral: BinaryData (Required)
-     *         intLiteral: BinaryData (Required)
-     *         floatLiteral: BinaryData (Required)
-     *         booleanLiteral: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         stringLiteral: BinaryData (Required)
-     *         intLiteral: BinaryData (Required)
-     *         floatLiteral: BinaryData (Required)
-     *         booleanLiteral: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         stringLiteral: BinaryData (Required)
-     *         intLiteral: BinaryData (Required)
-     *         floatLiteral: BinaryData (Required)
-     *         booleanLiteral: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest8 The sendRequest8 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(BinaryData sendRequest8, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.send(this.client.getEndpoint(), contentType, sendRequest8, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         stringLiteral: BinaryData (Required)
-     *         intLiteral: BinaryData (Required)
-     *         floatLiteral: BinaryData (Required)
-     *         booleanLiteral: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest8 The sendRequest8 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest8, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendSync(this.client.getEndpoint(), contentType, sendRequest8, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedTypesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedTypesImpl.java deleted file mode 100644 index 5b3bb182b15..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedTypesImpl.java +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in MixedTypes. - */ -public final class MixedTypesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MixedTypesService service; - - /** - * The service client containing this operation class. - */ - private final UnionClientImpl client; - - /** - * Initializes an instance of MixedTypesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - MixedTypesImpl(UnionClientImpl client) { - this.service - = RestProxy.create(MixedTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UnionClientMixedTypes to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UnionClientMixedTypes") - public interface MixedTypesService { - @Get("/type/union/mixed-types") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/mixed-types") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/type/union/mixed-types") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest9, - RequestOptions requestOptions, Context context); - - @Post("/type/union/mixed-types") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendRequest9, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         model: BinaryData (Required)
-     *         literal: BinaryData (Required)
-     *         int: BinaryData (Required)
-     *         boolean: BinaryData (Required)
-     *         array (Required): [
-     *             BinaryData (Required)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         model: BinaryData (Required)
-     *         literal: BinaryData (Required)
-     *         int: BinaryData (Required)
-     *         boolean: BinaryData (Required)
-     *         array (Required): [
-     *             BinaryData (Required)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         model: BinaryData (Required)
-     *         literal: BinaryData (Required)
-     *         int: BinaryData (Required)
-     *         boolean: BinaryData (Required)
-     *         array (Required): [
-     *             BinaryData (Required)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest9 The sendRequest9 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(BinaryData sendRequest9, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.send(this.client.getEndpoint(), contentType, sendRequest9, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         model: BinaryData (Required)
-     *         literal: BinaryData (Required)
-     *         int: BinaryData (Required)
-     *         boolean: BinaryData (Required)
-     *         array (Required): [
-     *             BinaryData (Required)
-     *         ]
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest9 The sendRequest9 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest9, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendSync(this.client.getEndpoint(), contentType, sendRequest9, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/ModelsOnliesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/ModelsOnliesImpl.java deleted file mode 100644 index 7a8e9a1e0a3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/ModelsOnliesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in ModelsOnlies. - */ -public final class ModelsOnliesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ModelsOnliesService service; - - /** - * The service client containing this operation class. - */ - private final UnionClientImpl client; - - /** - * Initializes an instance of ModelsOnliesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - ModelsOnliesImpl(UnionClientImpl client) { - this.service - = RestProxy.create(ModelsOnliesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UnionClientModelsOnlies to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UnionClientModelsOnlies") - public interface ModelsOnliesService { - @Get("/type/union/models-only") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/models-only") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/type/union/models-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest5, - RequestOptions requestOptions, Context context); - - @Post("/type/union/models-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendRequest5, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest5 The sendRequest5 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(BinaryData sendRequest5, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.send(this.client.getEndpoint(), contentType, sendRequest5, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest5 The sendRequest5 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest5, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendSync(this.client.getEndpoint(), contentType, sendRequest5, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringAndArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringAndArraysImpl.java deleted file mode 100644 index 78c6b3c35ff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringAndArraysImpl.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringAndArrays. - */ -public final class StringAndArraysImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringAndArraysService service; - - /** - * The service client containing this operation class. - */ - private final UnionClientImpl client; - - /** - * Initializes an instance of StringAndArraysImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringAndArraysImpl(UnionClientImpl client) { - this.service - = RestProxy.create(StringAndArraysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UnionClientStringAndArrays to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UnionClientStringAndArrays") - public interface StringAndArraysService { - @Get("/type/union/string-and-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/string-and-array") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/type/union/string-and-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest7, - RequestOptions requestOptions, Context context); - - @Post("/type/union/string-and-array") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendRequest7, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         string: BinaryData (Required)
-     *         array: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         string: BinaryData (Required)
-     *         array: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         string: BinaryData (Required)
-     *         array: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest7 The sendRequest7 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(BinaryData sendRequest7, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.send(this.client.getEndpoint(), contentType, sendRequest7, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop (Required): {
-     *         string: BinaryData (Required)
-     *         array: BinaryData (Required)
-     *     }
-     * }
-     * }
-     * 
- * - * @param sendRequest7 The sendRequest7 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest7, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendSync(this.client.getEndpoint(), contentType, sendRequest7, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensibleNamedsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensibleNamedsImpl.java deleted file mode 100644 index 0c8c9298bb1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensibleNamedsImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringExtensibleNameds. - */ -public final class StringExtensibleNamedsImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringExtensibleNamedsService service; - - /** - * The service client containing this operation class. - */ - private final UnionClientImpl client; - - /** - * Initializes an instance of StringExtensibleNamedsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringExtensibleNamedsImpl(UnionClientImpl client) { - this.service = RestProxy.create(StringExtensibleNamedsService.class, client.getHttpPipeline(), - client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UnionClientStringExtensibleNameds to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UnionClientStringExtensibleNameds") - public interface StringExtensibleNamedsService { - @Get("/type/union/string-extensible-named") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/string-extensible-named") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/type/union/string-extensible-named") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest2, - RequestOptions requestOptions, Context context); - - @Post("/type/union/string-extensible-named") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendRequest2, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest2 The sendRequest2 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(BinaryData sendRequest2, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.send(this.client.getEndpoint(), contentType, sendRequest2, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest2 The sendRequest2 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest2, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendSync(this.client.getEndpoint(), contentType, sendRequest2, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensiblesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensiblesImpl.java deleted file mode 100644 index a2e13ed210c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensiblesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringExtensibles. - */ -public final class StringExtensiblesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringExtensiblesService service; - - /** - * The service client containing this operation class. - */ - private final UnionClientImpl client; - - /** - * Initializes an instance of StringExtensiblesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringExtensiblesImpl(UnionClientImpl client) { - this.service - = RestProxy.create(StringExtensiblesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UnionClientStringExtensibles to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UnionClientStringExtensibles") - public interface StringExtensiblesService { - @Get("/type/union/string-extensible") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/string-extensible") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/type/union/string-extensible") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest1, - RequestOptions requestOptions, Context context); - - @Post("/type/union/string-extensible") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendRequest1, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest1 The sendRequest1 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(BinaryData sendRequest1, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.send(this.client.getEndpoint(), contentType, sendRequest1, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest1 The sendRequest1 parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest1, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendSync(this.client.getEndpoint(), contentType, sendRequest1, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringsOnliesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringsOnliesImpl.java deleted file mode 100644 index dcd4a865e38..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringsOnliesImpl.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -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.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in StringsOnlies. - */ -public final class StringsOnliesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final StringsOnliesService service; - - /** - * The service client containing this operation class. - */ - private final UnionClientImpl client; - - /** - * Initializes an instance of StringsOnliesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - StringsOnliesImpl(UnionClientImpl client) { - this.service - = RestProxy.create(StringsOnliesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for UnionClientStringsOnlies to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}") - @ServiceInterface(name = "UnionClientStringsOnlies") - public interface StringsOnliesService { - @Get("/type/union/strings-only") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Get("/type/union/strings-only") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, - RequestOptions requestOptions, Context context); - - @Post("/type/union/strings-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> send(@HostParam("endpoint") String endpoint, - @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest, - RequestOptions requestOptions, Context context); - - @Post("/type/union/strings-only") - @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, - @BodyParam("application/json") BinaryData sendRequest, RequestOptions requestOptions, Context context); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(a/b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getWithResponseAsync(RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); - } - - /** - * The get operation. - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(a/b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(RequestOptions requestOptions) { - final String accept = "application/json"; - return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(a/b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest The sendRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> sendWithResponseAsync(BinaryData sendRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return FluxUtil.withContext( - context -> service.send(this.client.getEndpoint(), contentType, sendRequest, requestOptions, context)); - } - - /** - * The send operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String(a/b/c) (Required)
-     * }
-     * }
-     * 
- * - * @param sendRequest The sendRequest parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response sendWithResponse(BinaryData sendRequest, RequestOptions requestOptions) { - final String contentType = "application/json"; - return service.sendSync(this.client.getEndpoint(), contentType, sendRequest, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/UnionClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/UnionClientImpl.java deleted file mode 100644 index d551d7e26cc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/UnionClientImpl.java +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -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 UnionClient type. - */ -public final class UnionClientImpl { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * 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 StringsOnliesImpl object to access its operations. - */ - private final StringsOnliesImpl stringsOnlies; - - /** - * Gets the StringsOnliesImpl object to access its operations. - * - * @return the StringsOnliesImpl object. - */ - public StringsOnliesImpl getStringsOnlies() { - return this.stringsOnlies; - } - - /** - * The StringExtensiblesImpl object to access its operations. - */ - private final StringExtensiblesImpl stringExtensibles; - - /** - * Gets the StringExtensiblesImpl object to access its operations. - * - * @return the StringExtensiblesImpl object. - */ - public StringExtensiblesImpl getStringExtensibles() { - return this.stringExtensibles; - } - - /** - * The StringExtensibleNamedsImpl object to access its operations. - */ - private final StringExtensibleNamedsImpl stringExtensibleNameds; - - /** - * Gets the StringExtensibleNamedsImpl object to access its operations. - * - * @return the StringExtensibleNamedsImpl object. - */ - public StringExtensibleNamedsImpl getStringExtensibleNameds() { - return this.stringExtensibleNameds; - } - - /** - * The IntsOnliesImpl object to access its operations. - */ - private final IntsOnliesImpl intsOnlies; - - /** - * Gets the IntsOnliesImpl object to access its operations. - * - * @return the IntsOnliesImpl object. - */ - public IntsOnliesImpl getIntsOnlies() { - return this.intsOnlies; - } - - /** - * The FloatsOnliesImpl object to access its operations. - */ - private final FloatsOnliesImpl floatsOnlies; - - /** - * Gets the FloatsOnliesImpl object to access its operations. - * - * @return the FloatsOnliesImpl object. - */ - public FloatsOnliesImpl getFloatsOnlies() { - return this.floatsOnlies; - } - - /** - * The ModelsOnliesImpl object to access its operations. - */ - private final ModelsOnliesImpl modelsOnlies; - - /** - * Gets the ModelsOnliesImpl object to access its operations. - * - * @return the ModelsOnliesImpl object. - */ - public ModelsOnliesImpl getModelsOnlies() { - return this.modelsOnlies; - } - - /** - * The EnumsOnliesImpl object to access its operations. - */ - private final EnumsOnliesImpl enumsOnlies; - - /** - * Gets the EnumsOnliesImpl object to access its operations. - * - * @return the EnumsOnliesImpl object. - */ - public EnumsOnliesImpl getEnumsOnlies() { - return this.enumsOnlies; - } - - /** - * The StringAndArraysImpl object to access its operations. - */ - private final StringAndArraysImpl stringAndArrays; - - /** - * Gets the StringAndArraysImpl object to access its operations. - * - * @return the StringAndArraysImpl object. - */ - public StringAndArraysImpl getStringAndArrays() { - return this.stringAndArrays; - } - - /** - * The MixedLiteralsImpl object to access its operations. - */ - private final MixedLiteralsImpl mixedLiterals; - - /** - * Gets the MixedLiteralsImpl object to access its operations. - * - * @return the MixedLiteralsImpl object. - */ - public MixedLiteralsImpl getMixedLiterals() { - return this.mixedLiterals; - } - - /** - * The MixedTypesImpl object to access its operations. - */ - private final MixedTypesImpl mixedTypes; - - /** - * Gets the MixedTypesImpl object to access its operations. - * - * @return the MixedTypesImpl object. - */ - public MixedTypesImpl getMixedTypes() { - return this.mixedTypes; - } - - /** - * Initializes an instance of UnionClient client. - * - * @param endpoint Service host. - */ - public UnionClientImpl(String endpoint) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of UnionClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Service host. - */ - public UnionClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); - } - - /** - * Initializes an instance of UnionClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Service host. - */ - public UnionClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.stringsOnlies = new StringsOnliesImpl(this); - this.stringExtensibles = new StringExtensiblesImpl(this); - this.stringExtensibleNameds = new StringExtensibleNamedsImpl(this); - this.intsOnlies = new IntsOnliesImpl(this); - this.floatsOnlies = new FloatsOnliesImpl(this); - this.modelsOnlies = new ModelsOnliesImpl(this); - this.enumsOnlies = new EnumsOnliesImpl(this); - this.stringAndArrays = new StringAndArraysImpl(this); - this.mixedLiterals = new MixedLiteralsImpl(this); - this.mixedTypes = new MixedTypesImpl(this); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest.java deleted file mode 100644 index 7ba57041bf7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import type.union.models.GetResponseProp; - -/** - * The SendRequest model. - */ -@Immutable -public final class SendRequest implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final GetResponseProp prop; - - /** - * Creates an instance of SendRequest class. - * - * @param prop the prop value to set. - */ - @Generated - public SendRequest(GetResponseProp prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public GetResponseProp getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendRequest from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendRequest if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendRequest. - */ - @Generated - public static SendRequest fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GetResponseProp prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = GetResponseProp.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new SendRequest(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest1.java deleted file mode 100644 index b544425e4a6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest1.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import type.union.models.GetResponseProp1; - -/** - * The SendRequest1 model. - */ -@Immutable -public final class SendRequest1 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final GetResponseProp1 prop; - - /** - * Creates an instance of SendRequest1 class. - * - * @param prop the prop value to set. - */ - @Generated - public SendRequest1(GetResponseProp1 prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public GetResponseProp1 getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendRequest1 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendRequest1 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendRequest1. - */ - @Generated - public static SendRequest1 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GetResponseProp1 prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = GetResponseProp1.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new SendRequest1(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest2.java deleted file mode 100644 index dcdf65ef1e1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest2.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import type.union.models.StringExtensibleNamedUnion; - -/** - * The SendRequest2 model. - */ -@Immutable -public final class SendRequest2 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final StringExtensibleNamedUnion prop; - - /** - * Creates an instance of SendRequest2 class. - * - * @param prop the prop value to set. - */ - @Generated - public SendRequest2(StringExtensibleNamedUnion prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public StringExtensibleNamedUnion getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendRequest2 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendRequest2 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendRequest2. - */ - @Generated - public static SendRequest2 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - StringExtensibleNamedUnion prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = StringExtensibleNamedUnion.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new SendRequest2(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest3.java deleted file mode 100644 index e75175b093d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest3.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import type.union.models.GetResponseProp2; - -/** - * The SendRequest3 model. - */ -@Immutable -public final class SendRequest3 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final GetResponseProp2 prop; - - /** - * Creates an instance of SendRequest3 class. - * - * @param prop the prop value to set. - */ - @Generated - public SendRequest3(GetResponseProp2 prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public GetResponseProp2 getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("prop", this.prop == null ? null : this.prop.toInt()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendRequest3 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendRequest3 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendRequest3. - */ - @Generated - public static SendRequest3 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GetResponseProp2 prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = GetResponseProp2.fromInt(reader.getInt()); - } else { - reader.skipChildren(); - } - } - return new SendRequest3(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest4.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest4.java deleted file mode 100644 index 4e9e1c58a1b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest4.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import type.union.models.GetResponseProp3; - -/** - * The SendRequest4 model. - */ -@Immutable -public final class SendRequest4 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final GetResponseProp3 prop; - - /** - * Creates an instance of SendRequest4 class. - * - * @param prop the prop value to set. - */ - @Generated - public SendRequest4(GetResponseProp3 prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public GetResponseProp3 getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("prop", this.prop == null ? null : this.prop.toDouble()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendRequest4 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendRequest4 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendRequest4. - */ - @Generated - public static SendRequest4 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GetResponseProp3 prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = GetResponseProp3.fromDouble(reader.getDouble()); - } else { - reader.skipChildren(); - } - } - return new SendRequest4(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest5.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest5.java deleted file mode 100644 index 81e96e991c6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest5.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The SendRequest5 model. - */ -@Immutable -public final class SendRequest5 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final BinaryData prop; - - /** - * Creates an instance of SendRequest5 class. - * - * @param prop the prop value to set. - */ - @Generated - public SendRequest5(BinaryData prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public BinaryData getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeFieldName("prop"); - this.prop.writeTo(jsonWriter); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendRequest5 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendRequest5 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendRequest5. - */ - @Generated - public static SendRequest5 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BinaryData prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - return new SendRequest5(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest6.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest6.java deleted file mode 100644 index b50d494c717..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest6.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import type.union.models.EnumsOnlyCases; - -/** - * The SendRequest6 model. - */ -@Immutable -public final class SendRequest6 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final EnumsOnlyCases prop; - - /** - * Creates an instance of SendRequest6 class. - * - * @param prop the prop value to set. - */ - @Generated - public SendRequest6(EnumsOnlyCases prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public EnumsOnlyCases getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("prop", this.prop); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendRequest6 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendRequest6 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendRequest6. - */ - @Generated - public static SendRequest6 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - EnumsOnlyCases prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = EnumsOnlyCases.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new SendRequest6(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest7.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest7.java deleted file mode 100644 index 6f82043a2f2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest7.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import type.union.models.StringAndArrayCases; - -/** - * The SendRequest7 model. - */ -@Immutable -public final class SendRequest7 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final StringAndArrayCases prop; - - /** - * Creates an instance of SendRequest7 class. - * - * @param prop the prop value to set. - */ - @Generated - public SendRequest7(StringAndArrayCases prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public StringAndArrayCases getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("prop", this.prop); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendRequest7 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendRequest7 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendRequest7. - */ - @Generated - public static SendRequest7 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - StringAndArrayCases prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = StringAndArrayCases.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new SendRequest7(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest8.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest8.java deleted file mode 100644 index 6f16d979b89..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest8.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import type.union.models.MixedLiteralsCases; - -/** - * The SendRequest8 model. - */ -@Immutable -public final class SendRequest8 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final MixedLiteralsCases prop; - - /** - * Creates an instance of SendRequest8 class. - * - * @param prop the prop value to set. - */ - @Generated - public SendRequest8(MixedLiteralsCases prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public MixedLiteralsCases getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("prop", this.prop); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendRequest8 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendRequest8 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendRequest8. - */ - @Generated - public static SendRequest8 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - MixedLiteralsCases prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = MixedLiteralsCases.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new SendRequest8(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest9.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest9.java deleted file mode 100644 index ebcd173d226..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest9.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.implementation.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import type.union.models.MixedTypesCases; - -/** - * The SendRequest9 model. - */ -@Immutable -public final class SendRequest9 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final MixedTypesCases prop; - - /** - * Creates an instance of SendRequest9 class. - * - * @param prop the prop value to set. - */ - @Generated - public SendRequest9(MixedTypesCases prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public MixedTypesCases getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("prop", this.prop); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SendRequest9 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SendRequest9 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the SendRequest9. - */ - @Generated - public static SendRequest9 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - MixedTypesCases prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = MixedTypesCases.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new SendRequest9(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/package-info.java deleted file mode 100644 index 55893730844..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Union. - * Describe scenarios for various combinations of unions. - * - */ -package type.union.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/package-info.java deleted file mode 100644 index 8bda5a7c044..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Union. - * Describe scenarios for various combinations of unions. - * - */ -package type.union.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Cat.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Cat.java deleted file mode 100644 index 6146f45a215..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Cat.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Cat model. - */ -@Immutable -public final class Cat implements JsonSerializable { - /* - * The name property. - */ - @Generated - private final String name; - - /** - * Creates an instance of Cat class. - * - * @param name the name value to set. - */ - @Generated - public Cat(String name) { - this.name = name; - } - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - @Generated - public String getName() { - return this.name; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("name", this.name); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Cat from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Cat if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Cat. - */ - @Generated - public static Cat fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String name = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("name".equals(fieldName)) { - name = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Cat(name); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Dog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Dog.java deleted file mode 100644 index abb730302b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Dog.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The Dog model. - */ -@Immutable -public final class Dog implements JsonSerializable { - /* - * The bark property. - */ - @Generated - private final String bark; - - /** - * Creates an instance of Dog class. - * - * @param bark the bark value to set. - */ - @Generated - public Dog(String bark) { - this.bark = bark; - } - - /** - * Get the bark property: The bark property. - * - * @return the bark value. - */ - @Generated - public String getBark() { - return this.bark; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("bark", this.bark); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Dog from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Dog if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the Dog. - */ - @Generated - public static Dog fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String bark = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("bark".equals(fieldName)) { - bark = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new Dog(bark); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCases.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCases.java deleted file mode 100644 index 3cbc47d0a4b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCases.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The EnumsOnlyCases model. - */ -@Immutable -public final class EnumsOnlyCases implements JsonSerializable { - /* - * This should be receive/send the left variant - */ - @Generated - private final EnumsOnlyCasesLr lr; - - /* - * This should be receive/send the up variant - */ - @Generated - private final EnumsOnlyCasesUd ud; - - /** - * Creates an instance of EnumsOnlyCases class. - * - * @param lr the lr value to set. - * @param ud the ud value to set. - */ - @Generated - public EnumsOnlyCases(EnumsOnlyCasesLr lr, EnumsOnlyCasesUd ud) { - this.lr = lr; - this.ud = ud; - } - - /** - * Get the lr property: This should be receive/send the left variant. - * - * @return the lr value. - */ - @Generated - public EnumsOnlyCasesLr getLr() { - return this.lr; - } - - /** - * Get the ud property: This should be receive/send the up variant. - * - * @return the ud value. - */ - @Generated - public EnumsOnlyCasesUd getUd() { - return this.ud; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("lr", this.lr == null ? null : this.lr.toString()); - jsonWriter.writeStringField("ud", this.ud == null ? null : this.ud.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of EnumsOnlyCases from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of EnumsOnlyCases if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the EnumsOnlyCases. - */ - @Generated - public static EnumsOnlyCases fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - EnumsOnlyCasesLr lr = null; - EnumsOnlyCasesUd ud = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("lr".equals(fieldName)) { - lr = EnumsOnlyCasesLr.fromString(reader.getString()); - } else if ("ud".equals(fieldName)) { - ud = EnumsOnlyCasesUd.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new EnumsOnlyCases(lr, ud); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesLr.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesLr.java deleted file mode 100644 index 6e9db0957e9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesLr.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -/** - * Defines values for EnumsOnlyCasesLr. - */ -public enum EnumsOnlyCasesLr { - /** - * Enum value left. - */ - LEFT("left"), - - /** - * Enum value right. - */ - RIGHT("right"), - - /** - * Enum value up. - */ - UP("up"), - - /** - * Enum value down. - */ - DOWN("down"); - - /** - * The actual serialized value for a EnumsOnlyCasesLr instance. - */ - private final String value; - - EnumsOnlyCasesLr(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a EnumsOnlyCasesLr instance. - * - * @param value the serialized value to parse. - * @return the parsed EnumsOnlyCasesLr object, or null if unable to parse. - */ - public static EnumsOnlyCasesLr fromString(String value) { - if (value == null) { - return null; - } - EnumsOnlyCasesLr[] items = EnumsOnlyCasesLr.values(); - for (EnumsOnlyCasesLr item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesUd.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesUd.java deleted file mode 100644 index 2c050adca51..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesUd.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -/** - * Defines values for EnumsOnlyCasesUd. - */ -public enum EnumsOnlyCasesUd { - /** - * Enum value up. - */ - UP("up"), - - /** - * Enum value down. - */ - DOWN("down"); - - /** - * The actual serialized value for a EnumsOnlyCasesUd instance. - */ - private final String value; - - EnumsOnlyCasesUd(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a EnumsOnlyCasesUd instance. - * - * @param value the serialized value to parse. - * @return the parsed EnumsOnlyCasesUd object, or null if unable to parse. - */ - public static EnumsOnlyCasesUd fromString(String value) { - if (value == null) { - return null; - } - EnumsOnlyCasesUd[] items = EnumsOnlyCasesUd.values(); - for (EnumsOnlyCasesUd item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse.java deleted file mode 100644 index 32ef7aecc2c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GetResponse model. - */ -@Immutable -public final class GetResponse implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final GetResponseProp prop; - - /** - * Creates an instance of GetResponse class. - * - * @param prop the prop value to set. - */ - @Generated - private GetResponse(GetResponseProp prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public GetResponseProp getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GetResponse from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GetResponse if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GetResponse. - */ - @Generated - public static GetResponse fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GetResponseProp prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = GetResponseProp.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new GetResponse(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse1.java deleted file mode 100644 index f54657a3fcd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse1.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GetResponse1 model. - */ -@Immutable -public final class GetResponse1 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final GetResponseProp1 prop; - - /** - * Creates an instance of GetResponse1 class. - * - * @param prop the prop value to set. - */ - @Generated - private GetResponse1(GetResponseProp1 prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public GetResponseProp1 getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GetResponse1 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GetResponse1 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GetResponse1. - */ - @Generated - public static GetResponse1 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GetResponseProp1 prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = GetResponseProp1.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new GetResponse1(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse2.java deleted file mode 100644 index 01741b1e390..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse2.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GetResponse2 model. - */ -@Immutable -public final class GetResponse2 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final StringExtensibleNamedUnion prop; - - /** - * Creates an instance of GetResponse2 class. - * - * @param prop the prop value to set. - */ - @Generated - private GetResponse2(StringExtensibleNamedUnion prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public StringExtensibleNamedUnion getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GetResponse2 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GetResponse2 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GetResponse2. - */ - @Generated - public static GetResponse2 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - StringExtensibleNamedUnion prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = StringExtensibleNamedUnion.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new GetResponse2(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse3.java deleted file mode 100644 index 8446ee1dbdc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse3.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GetResponse3 model. - */ -@Immutable -public final class GetResponse3 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final GetResponseProp2 prop; - - /** - * Creates an instance of GetResponse3 class. - * - * @param prop the prop value to set. - */ - @Generated - private GetResponse3(GetResponseProp2 prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public GetResponseProp2 getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("prop", this.prop == null ? null : this.prop.toInt()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GetResponse3 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GetResponse3 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GetResponse3. - */ - @Generated - public static GetResponse3 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GetResponseProp2 prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = GetResponseProp2.fromInt(reader.getInt()); - } else { - reader.skipChildren(); - } - } - return new GetResponse3(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse4.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse4.java deleted file mode 100644 index 45273d70bec..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse4.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GetResponse4 model. - */ -@Immutable -public final class GetResponse4 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final GetResponseProp3 prop; - - /** - * Creates an instance of GetResponse4 class. - * - * @param prop the prop value to set. - */ - @Generated - private GetResponse4(GetResponseProp3 prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public GetResponseProp3 getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("prop", this.prop == null ? null : this.prop.toDouble()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GetResponse4 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GetResponse4 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GetResponse4. - */ - @Generated - public static GetResponse4 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - GetResponseProp3 prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = GetResponseProp3.fromDouble(reader.getDouble()); - } else { - reader.skipChildren(); - } - } - return new GetResponse4(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse5.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse5.java deleted file mode 100644 index 55ab59cfe85..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse5.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GetResponse5 model. - */ -@Immutable -public final class GetResponse5 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final BinaryData prop; - - /** - * Creates an instance of GetResponse5 class. - * - * @param prop the prop value to set. - */ - @Generated - private GetResponse5(BinaryData prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public BinaryData getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeFieldName("prop"); - this.prop.writeTo(jsonWriter); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GetResponse5 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GetResponse5 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GetResponse5. - */ - @Generated - public static GetResponse5 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BinaryData prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - return new GetResponse5(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse6.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse6.java deleted file mode 100644 index 6cd2c8b3355..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse6.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GetResponse6 model. - */ -@Immutable -public final class GetResponse6 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final EnumsOnlyCases prop; - - /** - * Creates an instance of GetResponse6 class. - * - * @param prop the prop value to set. - */ - @Generated - private GetResponse6(EnumsOnlyCases prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public EnumsOnlyCases getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("prop", this.prop); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GetResponse6 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GetResponse6 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GetResponse6. - */ - @Generated - public static GetResponse6 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - EnumsOnlyCases prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = EnumsOnlyCases.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new GetResponse6(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse7.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse7.java deleted file mode 100644 index 587c4542752..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse7.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GetResponse7 model. - */ -@Immutable -public final class GetResponse7 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final StringAndArrayCases prop; - - /** - * Creates an instance of GetResponse7 class. - * - * @param prop the prop value to set. - */ - @Generated - private GetResponse7(StringAndArrayCases prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public StringAndArrayCases getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("prop", this.prop); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GetResponse7 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GetResponse7 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GetResponse7. - */ - @Generated - public static GetResponse7 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - StringAndArrayCases prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = StringAndArrayCases.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new GetResponse7(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse8.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse8.java deleted file mode 100644 index a6b9d01fd0f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse8.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GetResponse8 model. - */ -@Immutable -public final class GetResponse8 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final MixedLiteralsCases prop; - - /** - * Creates an instance of GetResponse8 class. - * - * @param prop the prop value to set. - */ - @Generated - private GetResponse8(MixedLiteralsCases prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public MixedLiteralsCases getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("prop", this.prop); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GetResponse8 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GetResponse8 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GetResponse8. - */ - @Generated - public static GetResponse8 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - MixedLiteralsCases prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = MixedLiteralsCases.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new GetResponse8(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse9.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse9.java deleted file mode 100644 index 5bbe7e395de..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse9.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The GetResponse9 model. - */ -@Immutable -public final class GetResponse9 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final MixedTypesCases prop; - - /** - * Creates an instance of GetResponse9 class. - * - * @param prop the prop value to set. - */ - @Generated - private GetResponse9(MixedTypesCases prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public MixedTypesCases getProp() { - return this.prop; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeJsonField("prop", this.prop); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of GetResponse9 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of GetResponse9 if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the GetResponse9. - */ - @Generated - public static GetResponse9 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - MixedTypesCases prop = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = MixedTypesCases.fromJson(reader); - } else { - reader.skipChildren(); - } - } - return new GetResponse9(prop); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp.java deleted file mode 100644 index 337c2615dac..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -/** - * Defines values for GetResponseProp. - */ -public enum GetResponseProp { - /** - * Enum value a. - */ - A("a"), - - /** - * Enum value b. - */ - B("b"), - - /** - * Enum value c. - */ - C("c"); - - /** - * The actual serialized value for a GetResponseProp instance. - */ - private final String value; - - GetResponseProp(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a GetResponseProp instance. - * - * @param value the serialized value to parse. - * @return the parsed GetResponseProp object, or null if unable to parse. - */ - public static GetResponseProp fromString(String value) { - if (value == null) { - return null; - } - GetResponseProp[] items = GetResponseProp.values(); - for (GetResponseProp item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp1.java deleted file mode 100644 index 6e80a4a4003..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp1.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for GetResponseProp1. - */ -public final class GetResponseProp1 extends ExpandableStringEnum { - /** - * Static value b for GetResponseProp1. - */ - @Generated - public static final GetResponseProp1 B = fromString("b"); - - /** - * Static value c for GetResponseProp1. - */ - @Generated - public static final GetResponseProp1 C = fromString("c"); - - /** - * Creates a new instance of GetResponseProp1 value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public GetResponseProp1() { - } - - /** - * Creates or finds a GetResponseProp1 from its string representation. - * - * @param name a name to look for. - * @return the corresponding GetResponseProp1. - */ - @Generated - public static GetResponseProp1 fromString(String name) { - return fromString(name, GetResponseProp1.class); - } - - /** - * Gets known GetResponseProp1 values. - * - * @return known GetResponseProp1 values. - */ - @Generated - public static Collection values() { - return values(GetResponseProp1.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp2.java deleted file mode 100644 index 3cd208970c3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp2.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -/** - * Defines values for GetResponseProp2. - */ -public enum GetResponseProp2 { - /** - * Enum value 1. - */ - ONE(1), - - /** - * Enum value 2. - */ - TWO(2), - - /** - * Enum value 3. - */ - THREE(3); - - /** - * The actual serialized value for a GetResponseProp2 instance. - */ - private final int value; - - GetResponseProp2(int value) { - this.value = value; - } - - /** - * Parses a serialized value to a GetResponseProp2 instance. - * - * @param value the serialized value to parse. - * @return the parsed GetResponseProp2 object, or null if unable to parse. - */ - public static GetResponseProp2 fromInt(int value) { - GetResponseProp2[] items = GetResponseProp2.values(); - for (GetResponseProp2 item : items) { - if (item.toInt() == value) { - return item; - } - } - return null; - } - - /** - * De-serializes the instance to int value. - * - * @return the int value. - */ - public int toInt() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp3.java deleted file mode 100644 index f35ff836f58..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp3.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -/** - * Defines values for GetResponseProp3. - */ -public enum GetResponseProp3 { - /** - * Enum value 1.1. - */ - ONE_ONE(1.1), - - /** - * Enum value 2.2. - */ - TWO_TWO(2.2), - - /** - * Enum value 3.3. - */ - THREE_THREE(3.3); - - /** - * The actual serialized value for a GetResponseProp3 instance. - */ - private final double value; - - GetResponseProp3(double value) { - this.value = value; - } - - /** - * Parses a serialized value to a GetResponseProp3 instance. - * - * @param value the serialized value to parse. - * @return the parsed GetResponseProp3 object, or null if unable to parse. - */ - public static GetResponseProp3 fromDouble(double value) { - GetResponseProp3[] items = GetResponseProp3.values(); - for (GetResponseProp3 item : items) { - if (Double.doubleToLongBits(item.toDouble()) == Double.doubleToLongBits(value)) { - return item; - } - } - return null; - } - - /** - * De-serializes the instance to double value. - * - * @return the double value. - */ - public double toDouble() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedLiteralsCases.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedLiteralsCases.java deleted file mode 100644 index e6ac56e2a88..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedLiteralsCases.java +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The MixedLiteralsCases model. - */ -@Immutable -public final class MixedLiteralsCases implements JsonSerializable { - /* - * This should be receive/send the "a" variant - */ - @Generated - private final BinaryData stringLiteral; - - /* - * This should be receive/send the 2 variant - */ - @Generated - private final BinaryData intLiteral; - - /* - * This should be receive/send the 3.3 variant - */ - @Generated - private final BinaryData floatLiteral; - - /* - * This should be receive/send the true variant - */ - @Generated - private final BinaryData booleanLiteral; - - /** - * Creates an instance of MixedLiteralsCases class. - * - * @param stringLiteral the stringLiteral value to set. - * @param intLiteral the intLiteral value to set. - * @param floatLiteral the floatLiteral value to set. - * @param booleanLiteral the booleanLiteral value to set. - */ - @Generated - public MixedLiteralsCases(BinaryData stringLiteral, BinaryData intLiteral, BinaryData floatLiteral, - BinaryData booleanLiteral) { - this.stringLiteral = stringLiteral; - this.intLiteral = intLiteral; - this.floatLiteral = floatLiteral; - this.booleanLiteral = booleanLiteral; - } - - /** - * Get the stringLiteral property: This should be receive/send the "a" variant. - * - * @return the stringLiteral value. - */ - @Generated - public BinaryData getStringLiteral() { - return this.stringLiteral; - } - - /** - * Get the intLiteral property: This should be receive/send the 2 variant. - * - * @return the intLiteral value. - */ - @Generated - public BinaryData getIntLiteral() { - return this.intLiteral; - } - - /** - * Get the floatLiteral property: This should be receive/send the 3.3 variant. - * - * @return the floatLiteral value. - */ - @Generated - public BinaryData getFloatLiteral() { - return this.floatLiteral; - } - - /** - * Get the booleanLiteral property: This should be receive/send the true variant. - * - * @return the booleanLiteral value. - */ - @Generated - public BinaryData getBooleanLiteral() { - return this.booleanLiteral; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeFieldName("stringLiteral"); - this.stringLiteral.writeTo(jsonWriter); - jsonWriter.writeFieldName("intLiteral"); - this.intLiteral.writeTo(jsonWriter); - jsonWriter.writeFieldName("floatLiteral"); - this.floatLiteral.writeTo(jsonWriter); - jsonWriter.writeFieldName("booleanLiteral"); - this.booleanLiteral.writeTo(jsonWriter); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of MixedLiteralsCases from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of MixedLiteralsCases if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the MixedLiteralsCases. - */ - @Generated - public static MixedLiteralsCases fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BinaryData stringLiteral = null; - BinaryData intLiteral = null; - BinaryData floatLiteral = null; - BinaryData booleanLiteral = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("stringLiteral".equals(fieldName)) { - stringLiteral - = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else if ("intLiteral".equals(fieldName)) { - intLiteral - = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else if ("floatLiteral".equals(fieldName)) { - floatLiteral - = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else if ("booleanLiteral".equals(fieldName)) { - booleanLiteral - = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - return new MixedLiteralsCases(stringLiteral, intLiteral, floatLiteral, booleanLiteral); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedTypesCases.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedTypesCases.java deleted file mode 100644 index a1432230f8b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedTypesCases.java +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The MixedTypesCases model. - */ -@Immutable -public final class MixedTypesCases implements JsonSerializable { - /* - * This should be receive/send the Cat variant - */ - @Generated - private final BinaryData model; - - /* - * This should be receive/send the "a" variant - */ - @Generated - private final BinaryData literal; - - /* - * This should be receive/send the int variant - */ - @Generated - private final BinaryData intProperty; - - /* - * This should be receive/send the boolean variant - */ - @Generated - private final BinaryData booleanProperty; - - /* - * This should be receive/send 4 element with Cat, "a", int, and boolean - */ - @Generated - private final List array; - - /** - * Creates an instance of MixedTypesCases class. - * - * @param model the model value to set. - * @param literal the literal value to set. - * @param intProperty the intProperty value to set. - * @param booleanProperty the booleanProperty value to set. - * @param array the array value to set. - */ - @Generated - public MixedTypesCases(BinaryData model, BinaryData literal, BinaryData intProperty, BinaryData booleanProperty, - List array) { - this.model = model; - this.literal = literal; - this.intProperty = intProperty; - this.booleanProperty = booleanProperty; - this.array = array; - } - - /** - * Get the model property: This should be receive/send the Cat variant. - * - * @return the model value. - */ - @Generated - public BinaryData getModel() { - return this.model; - } - - /** - * Get the literal property: This should be receive/send the "a" variant. - * - * @return the literal value. - */ - @Generated - public BinaryData getLiteral() { - return this.literal; - } - - /** - * Get the intProperty property: This should be receive/send the int variant. - * - * @return the intProperty value. - */ - @Generated - public BinaryData getIntProperty() { - return this.intProperty; - } - - /** - * Get the booleanProperty property: This should be receive/send the boolean variant. - * - * @return the booleanProperty value. - */ - @Generated - public BinaryData getBooleanProperty() { - return this.booleanProperty; - } - - /** - * Get the array property: This should be receive/send 4 element with Cat, "a", int, and boolean. - * - * @return the array value. - */ - @Generated - public List getArray() { - return this.array; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeFieldName("model"); - this.model.writeTo(jsonWriter); - jsonWriter.writeFieldName("literal"); - this.literal.writeTo(jsonWriter); - jsonWriter.writeFieldName("int"); - this.intProperty.writeTo(jsonWriter); - jsonWriter.writeFieldName("boolean"); - this.booleanProperty.writeTo(jsonWriter); - jsonWriter.writeArrayField("array", this.array, - (writer, element) -> writer.writeUntyped(element == null ? null : element.toObject(Object.class))); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of MixedTypesCases from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of MixedTypesCases if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the MixedTypesCases. - */ - @Generated - public static MixedTypesCases fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BinaryData model = null; - BinaryData literal = null; - BinaryData intProperty = null; - BinaryData booleanProperty = null; - List array = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("model".equals(fieldName)) { - model = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else if ("literal".equals(fieldName)) { - literal = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else if ("int".equals(fieldName)) { - intProperty - = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else if ("boolean".equals(fieldName)) { - booleanProperty - = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else if ("array".equals(fieldName)) { - array = reader.readArray(reader1 -> reader1 - .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); - } else { - reader.skipChildren(); - } - } - return new MixedTypesCases(model, literal, intProperty, booleanProperty, array); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringAndArrayCases.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringAndArrayCases.java deleted file mode 100644 index 23fdda9c499..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringAndArrayCases.java +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The StringAndArrayCases model. - */ -@Immutable -public final class StringAndArrayCases implements JsonSerializable { - /* - * This should be receive/send the string variant - */ - @Generated - private final BinaryData string; - - /* - * This should be receive/send the array variant - */ - @Generated - private final BinaryData array; - - /** - * Creates an instance of StringAndArrayCases class. - * - * @param string the string value to set. - * @param array the array value to set. - */ - @Generated - public StringAndArrayCases(BinaryData string, BinaryData array) { - this.string = string; - this.array = array; - } - - /** - * Get the string property: This should be receive/send the string variant. - * - * @return the string value. - */ - @Generated - public BinaryData getString() { - return this.string; - } - - /** - * Get the array property: This should be receive/send the array variant. - * - * @return the array value. - */ - @Generated - public BinaryData getArray() { - return this.array; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeFieldName("string"); - this.string.writeTo(jsonWriter); - jsonWriter.writeFieldName("array"); - this.array.writeTo(jsonWriter); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of StringAndArrayCases from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of StringAndArrayCases if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the StringAndArrayCases. - */ - @Generated - public static StringAndArrayCases fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - BinaryData string = null; - BinaryData array = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("string".equals(fieldName)) { - string = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else if ("array".equals(fieldName)) { - array = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - return new StringAndArrayCases(string, array); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringExtensibleNamedUnion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringExtensibleNamedUnion.java deleted file mode 100644 index c4f2c185d8b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringExtensibleNamedUnion.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines values for StringExtensibleNamedUnion. - */ -public final class StringExtensibleNamedUnion extends ExpandableStringEnum { - /** - * Static value b for StringExtensibleNamedUnion. - */ - @Generated - public static final StringExtensibleNamedUnion OPTIONB = fromString("b"); - - /** - * Static value c for StringExtensibleNamedUnion. - */ - @Generated - public static final StringExtensibleNamedUnion C = fromString("c"); - - /** - * Creates a new instance of StringExtensibleNamedUnion value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Generated - @Deprecated - public StringExtensibleNamedUnion() { - } - - /** - * Creates or finds a StringExtensibleNamedUnion from its string representation. - * - * @param name a name to look for. - * @return the corresponding StringExtensibleNamedUnion. - */ - @Generated - public static StringExtensibleNamedUnion fromString(String name) { - return fromString(name, StringExtensibleNamedUnion.class); - } - - /** - * Gets known StringExtensibleNamedUnion values. - * - * @return known StringExtensibleNamedUnion values. - */ - @Generated - public static Collection values() { - return values(StringExtensibleNamedUnion.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/package-info.java deleted file mode 100644 index 7dd0ed7f5d4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Union. - * Describe scenarios for various combinations of unions. - * - */ -package type.union.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/package-info.java deleted file mode 100644 index 5df10c6a5d3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Union. - * Describe scenarios for various combinations of unions. - * - */ -package type.union; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedAsyncClient.java deleted file mode 100644 index 54243e275b1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedAsyncClient.java +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import versioning.added.implementation.AddedClientImpl; -import versioning.added.models.ModelV1; -import versioning.added.models.ModelV2; - -/** - * Initializes a new instance of the asynchronous AddedClient type. - */ -@ServiceClient(builder = AddedClientBuilder.class, isAsync = true) -public final class AddedAsyncClient { - @Generated - private final AddedClientImpl serviceClient; - - /** - * Initializes an instance of AddedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - AddedAsyncClient(AddedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The v1 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param headerV2 The headerV2 parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> v1WithResponse(String headerV2, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.v1WithResponseAsync(headerV2, body, requestOptions); - } - - /** - * The v2 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> v2WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.v2WithResponseAsync(body, requestOptions); - } - - /** - * The v1 operation. - * - * @param headerV2 The headerV2 parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono v1(String headerV2, ModelV1 body) { - // Generated convenience method for v1WithResponse - RequestOptions requestOptions = new RequestOptions(); - return v1WithResponse(headerV2, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelV1.class)); - } - - /** - * The v2 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono v2(ModelV2 body) { - // Generated convenience method for v2WithResponse - RequestOptions requestOptions = new RequestOptions(); - return v2WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelV2.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClient.java deleted file mode 100644 index 837a5b72a50..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClient.java +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import versioning.added.implementation.AddedClientImpl; -import versioning.added.models.ModelV1; -import versioning.added.models.ModelV2; - -/** - * Initializes a new instance of the synchronous AddedClient type. - */ -@ServiceClient(builder = AddedClientBuilder.class) -public final class AddedClient { - @Generated - private final AddedClientImpl serviceClient; - - /** - * Initializes an instance of AddedClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - AddedClient(AddedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The v1 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param headerV2 The headerV2 parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response v1WithResponse(String headerV2, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.v1WithResponse(headerV2, body, requestOptions); - } - - /** - * The v2 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response v2WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.v2WithResponse(body, requestOptions); - } - - /** - * The v1 operation. - * - * @param headerV2 The headerV2 parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ModelV1 v1(String headerV2, ModelV1 body) { - // Generated convenience method for v1WithResponse - RequestOptions requestOptions = new RequestOptions(); - return v1WithResponse(headerV2, BinaryData.fromObject(body), requestOptions).getValue().toObject(ModelV1.class); - } - - /** - * The v2 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ModelV2 v2(ModelV2 body) { - // Generated convenience method for v2WithResponse - RequestOptions requestOptions = new RequestOptions(); - return v2WithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(ModelV2.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClientBuilder.java deleted file mode 100644 index a2268237c87..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClientBuilder.java +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import versioning.added.implementation.AddedClientImpl; - -/** - * A builder for creating a new instance of the AddedClient type. - */ -@ServiceClientBuilder( - serviceClients = { - AddedClient.class, - InterfaceV2Client.class, - AddedAsyncClient.class, - InterfaceV2AsyncClient.class }) -public final class AddedClientBuilder implements HttpTrait, ConfigurationTrait, - EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("versioning-added.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the AddedClientBuilder. - */ - @Generated - public AddedClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AddedClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AddedClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AddedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AddedClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AddedClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AddedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AddedClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public AddedClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private AddedServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the AddedClientBuilder. - */ - @Generated - public AddedClientBuilder serviceVersion(AddedServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the AddedClientBuilder. - */ - @Generated - public AddedClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of AddedClientImpl with the provided parameters. - * - * @return an instance of AddedClientImpl. - */ - @Generated - private AddedClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - AddedServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : AddedServiceVersion.getLatest(); - AddedClientImpl client = new AddedClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of AddedAsyncClient class. - * - * @return an instance of AddedAsyncClient. - */ - @Generated - public AddedAsyncClient buildAsyncClient() { - return new AddedAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of InterfaceV2AsyncClient class. - * - * @return an instance of InterfaceV2AsyncClient. - */ - @Generated - public InterfaceV2AsyncClient buildInterfaceV2AsyncClient() { - return new InterfaceV2AsyncClient(buildInnerClient().getInterfaceV2s()); - } - - /** - * Builds an instance of AddedClient class. - * - * @return an instance of AddedClient. - */ - @Generated - public AddedClient buildClient() { - return new AddedClient(buildInnerClient()); - } - - /** - * Builds an instance of InterfaceV2Client class. - * - * @return an instance of InterfaceV2Client. - */ - @Generated - public InterfaceV2Client buildInterfaceV2Client() { - return new InterfaceV2Client(buildInnerClient().getInterfaceV2s()); - } - - private static final ClientLogger LOGGER = new ClientLogger(AddedClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedServiceVersion.java deleted file mode 100644 index 88c3c16cca2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedServiceVersion.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of AddedClient. - */ -public enum AddedServiceVersion implements ServiceVersion { - /** - * Enum value v1. - */ - V1("v1"), - - /** - * Enum value v2. - */ - V2("v2"); - - private final String version; - - AddedServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link AddedServiceVersion}. - */ - public static AddedServiceVersion getLatest() { - return V2; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2AsyncClient.java deleted file mode 100644 index 006a4e8c4df..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2AsyncClient.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import versioning.added.implementation.InterfaceV2sImpl; -import versioning.added.models.ModelV2; - -/** - * Initializes a new instance of the asynchronous AddedClient type. - */ -@ServiceClient(builder = AddedClientBuilder.class, isAsync = true) -public final class InterfaceV2AsyncClient { - @Generated - private final InterfaceV2sImpl serviceClient; - - /** - * Initializes an instance of InterfaceV2AsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - InterfaceV2AsyncClient(InterfaceV2sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The v2InInterface operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> v2InInterfaceWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.v2InInterfaceWithResponseAsync(body, requestOptions); - } - - /** - * The v2InInterface operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono v2InInterface(ModelV2 body) { - // Generated convenience method for v2InInterfaceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return v2InInterfaceWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelV2.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2Client.java deleted file mode 100644 index 7414b02dc3b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2Client.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import versioning.added.implementation.InterfaceV2sImpl; -import versioning.added.models.ModelV2; - -/** - * Initializes a new instance of the synchronous AddedClient type. - */ -@ServiceClient(builder = AddedClientBuilder.class) -public final class InterfaceV2Client { - @Generated - private final InterfaceV2sImpl serviceClient; - - /** - * Initializes an instance of InterfaceV2Client class. - * - * @param serviceClient the service client implementation. - */ - @Generated - InterfaceV2Client(InterfaceV2sImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The v2InInterface operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response v2InInterfaceWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.v2InInterfaceWithResponse(body, requestOptions); - } - - /** - * The v2InInterface operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ModelV2 v2InInterface(ModelV2 body) { - // Generated convenience method for v2InInterfaceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return v2InInterfaceWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(ModelV2.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/AddedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/AddedClientImpl.java deleted file mode 100644 index 496d8ffc241..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/AddedClientImpl.java +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; -import versioning.added.AddedServiceVersion; - -/** - * Initializes a new instance of the AddedClient type. - */ -public final class AddedClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final AddedClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final AddedServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public AddedServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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 InterfaceV2sImpl object to access its operations. - */ - private final InterfaceV2sImpl interfaceV2s; - - /** - * Gets the InterfaceV2sImpl object to access its operations. - * - * @return the InterfaceV2sImpl object. - */ - public InterfaceV2sImpl getInterfaceV2s() { - return this.interfaceV2s; - } - - /** - * Initializes an instance of AddedClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public AddedClientImpl(String endpoint, AddedServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of AddedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public AddedClientImpl(HttpPipeline httpPipeline, String endpoint, AddedServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of AddedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public AddedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - AddedServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.interfaceV2s = new InterfaceV2sImpl(this); - this.service = RestProxy.create(AddedClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for AddedClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}/versioning/added/api-version:{version}") - @ServiceInterface(name = "AddedClient") - public interface AddedClientService { - @Post("/v1") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> v1(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @HeaderParam("header-v2") String headerV2, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/v1") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response v1Sync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @HeaderParam("header-v2") String headerV2, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/v2") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> v2(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/v2") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response v2Sync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The v1 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param headerV2 The headerV2 parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> v1WithResponseAsync(String headerV2, BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.v1(this.getEndpoint(), this.getServiceVersion().getVersion(), - headerV2, contentType, accept, body, requestOptions, context)); - } - - /** - * The v1 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param headerV2 The headerV2 parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response v1WithResponse(String headerV2, BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.v1Sync(this.getEndpoint(), this.getServiceVersion().getVersion(), headerV2, contentType, accept, - body, requestOptions, Context.NONE); - } - - /** - * The v2 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> v2WithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.v2(this.getEndpoint(), this.getServiceVersion().getVersion(), - contentType, accept, body, requestOptions, context)); - } - - /** - * The v2 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response v2WithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.v2Sync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, body, - requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/InterfaceV2sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/InterfaceV2sImpl.java deleted file mode 100644 index 986cd873e9c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/InterfaceV2sImpl.java +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; -import versioning.added.AddedServiceVersion; - -/** - * An instance of this class provides access to all the operations defined in InterfaceV2s. - */ -public final class InterfaceV2sImpl { - /** - * The proxy service used to perform REST calls. - */ - private final InterfaceV2sService service; - - /** - * The service client containing this operation class. - */ - private final AddedClientImpl client; - - /** - * Initializes an instance of InterfaceV2sImpl. - * - * @param client the instance of the service client containing this operation class. - */ - InterfaceV2sImpl(AddedClientImpl client) { - this.service - = RestProxy.create(InterfaceV2sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public AddedServiceVersion getServiceVersion() { - return client.getServiceVersion(); - } - - /** - * The interface defining all the services for AddedClientInterfaceV2s to be used by the proxy service to perform - * REST calls. - */ - @Host("{endpoint}/versioning/added/api-version:{version}") - @ServiceInterface(name = "AddedClientInterfaceV2s") - public interface InterfaceV2sService { - @Post("/interface-v2/v2") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> v2InInterface(@HostParam("endpoint") String endpoint, - @HostParam("version") String version, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/interface-v2/v2") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response v2InInterfaceSync(@HostParam("endpoint") String endpoint, - @HostParam("version") String version, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The v2InInterface operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> v2InInterfaceWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.v2InInterface(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context)); - } - - /** - * The v2InInterface operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response v2InInterfaceWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.v2InInterfaceSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), - contentType, accept, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/package-info.java deleted file mode 100644 index 9e36e96b627..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Added. - * Test for the `@added` decorator. - * - */ -package versioning.added.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV1.java deleted file mode 100644 index 13616b3bfda..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV1.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added.models; - -/** - * Defines values for EnumV1. - */ -public enum EnumV1 { - /** - * Enum value enumMemberV1. - */ - ENUM_MEMBER_V1("enumMemberV1"), - - /** - * Enum value enumMemberV2. - */ - ENUM_MEMBER_V2("enumMemberV2"); - - /** - * The actual serialized value for a EnumV1 instance. - */ - private final String value; - - EnumV1(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a EnumV1 instance. - * - * @param value the serialized value to parse. - * @return the parsed EnumV1 object, or null if unable to parse. - */ - public static EnumV1 fromString(String value) { - if (value == null) { - return null; - } - EnumV1[] items = EnumV1.values(); - for (EnumV1 item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV2.java deleted file mode 100644 index e26df1b7793..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV2.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added.models; - -/** - * Defines values for EnumV2. - */ -public enum EnumV2 { - /** - * Enum value enumMember. - */ - ENUM_MEMBER("enumMember"); - - /** - * The actual serialized value for a EnumV2 instance. - */ - private final String value; - - EnumV2(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a EnumV2 instance. - * - * @param value the serialized value to parse. - * @return the parsed EnumV2 object, or null if unable to parse. - */ - public static EnumV2 fromString(String value) { - if (value == null) { - return null; - } - EnumV2[] items = EnumV2.values(); - for (EnumV2 item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV1.java deleted file mode 100644 index a2fd46728ac..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV1.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ModelV1 model. - */ -@Immutable -public final class ModelV1 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final String prop; - - /* - * The enumProp property. - */ - @Generated - private final EnumV1 enumProp; - - /* - * The unionProp property. - */ - @Generated - private final BinaryData unionProp; - - /** - * Creates an instance of ModelV1 class. - * - * @param prop the prop value to set. - * @param enumProp the enumProp value to set. - * @param unionProp the unionProp value to set. - */ - @Generated - public ModelV1(String prop, EnumV1 enumProp, BinaryData unionProp) { - this.prop = prop; - this.enumProp = enumProp; - this.unionProp = unionProp; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public String getProp() { - return this.prop; - } - - /** - * Get the enumProp property: The enumProp property. - * - * @return the enumProp value. - */ - @Generated - public EnumV1 getEnumProp() { - return this.enumProp; - } - - /** - * Get the unionProp property: The unionProp property. - * - * @return the unionProp value. - */ - @Generated - public BinaryData getUnionProp() { - return this.unionProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop); - jsonWriter.writeStringField("enumProp", this.enumProp == null ? null : this.enumProp.toString()); - jsonWriter.writeFieldName("unionProp"); - this.unionProp.writeTo(jsonWriter); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ModelV1 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ModelV1 if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ModelV1. - */ - @Generated - public static ModelV1 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String prop = null; - EnumV1 enumProp = null; - BinaryData unionProp = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = reader.getString(); - } else if ("enumProp".equals(fieldName)) { - enumProp = EnumV1.fromString(reader.getString()); - } else if ("unionProp".equals(fieldName)) { - unionProp = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - return new ModelV1(prop, enumProp, unionProp); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV2.java deleted file mode 100644 index 08cfe783489..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV2.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ModelV2 model. - */ -@Immutable -public final class ModelV2 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final String prop; - - /* - * The enumProp property. - */ - @Generated - private final EnumV2 enumProp; - - /* - * The unionProp property. - */ - @Generated - private final BinaryData unionProp; - - /** - * Creates an instance of ModelV2 class. - * - * @param prop the prop value to set. - * @param enumProp the enumProp value to set. - * @param unionProp the unionProp value to set. - */ - @Generated - public ModelV2(String prop, EnumV2 enumProp, BinaryData unionProp) { - this.prop = prop; - this.enumProp = enumProp; - this.unionProp = unionProp; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public String getProp() { - return this.prop; - } - - /** - * Get the enumProp property: The enumProp property. - * - * @return the enumProp value. - */ - @Generated - public EnumV2 getEnumProp() { - return this.enumProp; - } - - /** - * Get the unionProp property: The unionProp property. - * - * @return the unionProp value. - */ - @Generated - public BinaryData getUnionProp() { - return this.unionProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop); - jsonWriter.writeStringField("enumProp", this.enumProp == null ? null : this.enumProp.toString()); - jsonWriter.writeFieldName("unionProp"); - this.unionProp.writeTo(jsonWriter); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ModelV2 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ModelV2 if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ModelV2. - */ - @Generated - public static ModelV2 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String prop = null; - EnumV2 enumProp = null; - BinaryData unionProp = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = reader.getString(); - } else if ("enumProp".equals(fieldName)) { - enumProp = EnumV2.fromString(reader.getString()); - } else if ("unionProp".equals(fieldName)) { - unionProp = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - return new ModelV2(prop, enumProp, unionProp); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/package-info.java deleted file mode 100644 index a62e257ebff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Added. - * Test for the `@added` decorator. - * - */ -package versioning.added.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/package-info.java deleted file mode 100644 index ad44d5bef04..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Added. - * Test for the `@added` decorator. - * - */ -package versioning.added; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalAsyncClient.java deleted file mode 100644 index 96d61d6a017..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalAsyncClient.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.madeoptional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import versioning.madeoptional.implementation.MadeOptionalClientImpl; -import versioning.madeoptional.models.TestModel; - -/** - * Initializes a new instance of the asynchronous MadeOptionalClient type. - */ -@ServiceClient(builder = MadeOptionalClientBuilder.class, isAsync = true) -public final class MadeOptionalAsyncClient { - @Generated - private final MadeOptionalClientImpl serviceClient; - - /** - * Initializes an instance of MadeOptionalAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MadeOptionalAsyncClient(MadeOptionalClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The test operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
paramStringNoThe param parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> testWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.testWithResponseAsync(body, requestOptions); - } - - /** - * The test operation. - * - * @param body The body parameter. - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono test(TestModel body, String param) { - // Generated convenience method for testWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (param != null) { - requestOptions.addQueryParam("param", param, false); - } - return testWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TestModel.class)); - } - - /** - * The test operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono test(TestModel body) { - // Generated convenience method for testWithResponse - RequestOptions requestOptions = new RequestOptions(); - return testWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TestModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClient.java deleted file mode 100644 index ef8c7ccc333..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClient.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.madeoptional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import versioning.madeoptional.implementation.MadeOptionalClientImpl; -import versioning.madeoptional.models.TestModel; - -/** - * Initializes a new instance of the synchronous MadeOptionalClient type. - */ -@ServiceClient(builder = MadeOptionalClientBuilder.class) -public final class MadeOptionalClient { - @Generated - private final MadeOptionalClientImpl serviceClient; - - /** - * Initializes an instance of MadeOptionalClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - MadeOptionalClient(MadeOptionalClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The test operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
paramStringNoThe param parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response testWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.testWithResponse(body, requestOptions); - } - - /** - * The test operation. - * - * @param body The body parameter. - * @param param The param parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public TestModel test(TestModel body, String param) { - // Generated convenience method for testWithResponse - RequestOptions requestOptions = new RequestOptions(); - if (param != null) { - requestOptions.addQueryParam("param", param, false); - } - return testWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(TestModel.class); - } - - /** - * The test operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public TestModel test(TestModel body) { - // Generated convenience method for testWithResponse - RequestOptions requestOptions = new RequestOptions(); - return testWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(TestModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClientBuilder.java deleted file mode 100644 index e9b490d5c16..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.madeoptional; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import versioning.madeoptional.implementation.MadeOptionalClientImpl; - -/** - * A builder for creating a new instance of the MadeOptionalClient type. - */ -@ServiceClientBuilder(serviceClients = { MadeOptionalClient.class, MadeOptionalAsyncClient.class }) -public final class MadeOptionalClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("versioning-madeoptional.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the MadeOptionalClientBuilder. - */ - @Generated - public MadeOptionalClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MadeOptionalClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MadeOptionalClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MadeOptionalClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MadeOptionalClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MadeOptionalClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MadeOptionalClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MadeOptionalClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public MadeOptionalClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private MadeOptionalServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the MadeOptionalClientBuilder. - */ - @Generated - public MadeOptionalClientBuilder serviceVersion(MadeOptionalServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the MadeOptionalClientBuilder. - */ - @Generated - public MadeOptionalClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of MadeOptionalClientImpl with the provided parameters. - * - * @return an instance of MadeOptionalClientImpl. - */ - @Generated - private MadeOptionalClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - MadeOptionalServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : MadeOptionalServiceVersion.getLatest(); - MadeOptionalClientImpl client = new MadeOptionalClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of MadeOptionalAsyncClient class. - * - * @return an instance of MadeOptionalAsyncClient. - */ - @Generated - public MadeOptionalAsyncClient buildAsyncClient() { - return new MadeOptionalAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of MadeOptionalClient class. - * - * @return an instance of MadeOptionalClient. - */ - @Generated - public MadeOptionalClient buildClient() { - return new MadeOptionalClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(MadeOptionalClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalServiceVersion.java deleted file mode 100644 index a533c131e89..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalServiceVersion.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.madeoptional; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of MadeOptionalClient. - */ -public enum MadeOptionalServiceVersion implements ServiceVersion { - /** - * Enum value v1. - */ - V1("v1"), - - /** - * Enum value v2. - */ - V2("v2"); - - private final String version; - - MadeOptionalServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link MadeOptionalServiceVersion}. - */ - public static MadeOptionalServiceVersion getLatest() { - return V2; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java deleted file mode 100644 index 3a3bfba439c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.madeoptional.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; -import versioning.madeoptional.MadeOptionalServiceVersion; - -/** - * Initializes a new instance of the MadeOptionalClient type. - */ -public final class MadeOptionalClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final MadeOptionalClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final MadeOptionalServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public MadeOptionalServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of MadeOptionalClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public MadeOptionalClientImpl(String endpoint, MadeOptionalServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of MadeOptionalClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public MadeOptionalClientImpl(HttpPipeline httpPipeline, String endpoint, - MadeOptionalServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of MadeOptionalClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public MadeOptionalClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - MadeOptionalServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service - = RestProxy.create(MadeOptionalClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for MadeOptionalClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}/versioning/made-optional/api-version:{version}") - @ServiceInterface(name = "MadeOptionalClient") - public interface MadeOptionalClientService { - @Post("/test") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> test(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/test") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response testSync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The test operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
paramStringNoThe param parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> testWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.test(this.getEndpoint(), this.getServiceVersion().getVersion(), - contentType, accept, body, requestOptions, context)); - } - - /** - * The test operation. - *

Query Parameters

- * - * - * - * - *
Query Parameters
NameTypeRequiredDescription
paramStringNoThe param parameter
- * You can add these to a request with {@link RequestOptions#addQueryParam} - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Optional)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Optional)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response testWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.testSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, body, - requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/package-info.java deleted file mode 100644 index 4bce0955ce5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for MadeOptional. - * Test for the `@madeOptional` decorator. - * - */ -package versioning.madeoptional.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/TestModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/TestModel.java deleted file mode 100644 index e7bf16492ca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/TestModel.java +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.madeoptional.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The TestModel model. - */ -@Fluent -public final class TestModel implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final String prop; - - /* - * The changedProp property. - */ - @Generated - private String changedProp; - - /** - * Creates an instance of TestModel class. - * - * @param prop the prop value to set. - */ - @Generated - public TestModel(String prop) { - this.prop = prop; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public String getProp() { - return this.prop; - } - - /** - * Get the changedProp property: The changedProp property. - * - * @return the changedProp value. - */ - @Generated - public String getChangedProp() { - return this.changedProp; - } - - /** - * Set the changedProp property: The changedProp property. - * - * @param changedProp the changedProp value to set. - * @return the TestModel object itself. - */ - @Generated - public TestModel setChangedProp(String changedProp) { - this.changedProp = changedProp; - return this; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop); - jsonWriter.writeStringField("changedProp", this.changedProp); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TestModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TestModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TestModel. - */ - @Generated - public static TestModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String prop = null; - String changedProp = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = reader.getString(); - } else if ("changedProp".equals(fieldName)) { - changedProp = reader.getString(); - } else { - reader.skipChildren(); - } - } - TestModel deserializedTestModel = new TestModel(prop); - deserializedTestModel.changedProp = changedProp; - - return deserializedTestModel; - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/package-info.java deleted file mode 100644 index bc77f60eaec..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for MadeOptional. - * Test for the `@madeOptional` decorator. - * - */ -package versioning.madeoptional.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/package-info.java deleted file mode 100644 index 8fef006f20b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for MadeOptional. - * Test for the `@madeOptional` decorator. - * - */ -package versioning.madeoptional; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedAsyncClient.java deleted file mode 100644 index 96e804cb0f2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedAsyncClient.java +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.removed; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import versioning.removed.implementation.RemovedClientImpl; -import versioning.removed.models.ModelV2; -import versioning.removed.models.ModelV3; - -/** - * Initializes a new instance of the asynchronous RemovedClient type. - */ -@ServiceClient(builder = RemovedClientBuilder.class, isAsync = true) -public final class RemovedAsyncClient { - @Generated - private final RemovedClientImpl serviceClient; - - /** - * Initializes an instance of RemovedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RemovedAsyncClient(RemovedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The v2 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> v2WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.v2WithResponseAsync(body, requestOptions); - } - - /** - * This operation will pass different paths and different request bodies based on different versions. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> modelV3WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.modelV3WithResponseAsync(body, requestOptions); - } - - /** - * The v2 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono v2(ModelV2 body) { - // Generated convenience method for v2WithResponse - RequestOptions requestOptions = new RequestOptions(); - return v2WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelV2.class)); - } - - /** - * This operation will pass different paths and different request bodies based on different versions. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono modelV3(ModelV3 body) { - // Generated convenience method for modelV3WithResponse - RequestOptions requestOptions = new RequestOptions(); - return modelV3WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelV3.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClient.java deleted file mode 100644 index 1c973172360..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClient.java +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.removed; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import versioning.removed.implementation.RemovedClientImpl; -import versioning.removed.models.ModelV2; -import versioning.removed.models.ModelV3; - -/** - * Initializes a new instance of the synchronous RemovedClient type. - */ -@ServiceClient(builder = RemovedClientBuilder.class) -public final class RemovedClient { - @Generated - private final RemovedClientImpl serviceClient; - - /** - * Initializes an instance of RemovedClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RemovedClient(RemovedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The v2 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response v2WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.v2WithResponse(body, requestOptions); - } - - /** - * This operation will pass different paths and different request bodies based on different versions. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response modelV3WithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.modelV3WithResponse(body, requestOptions); - } - - /** - * The v2 operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ModelV2 v2(ModelV2 body) { - // Generated convenience method for v2WithResponse - RequestOptions requestOptions = new RequestOptions(); - return v2WithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(ModelV2.class); - } - - /** - * This operation will pass different paths and different request bodies based on different versions. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public ModelV3 modelV3(ModelV3 body) { - // Generated convenience method for modelV3WithResponse - RequestOptions requestOptions = new RequestOptions(); - return modelV3WithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(ModelV3.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClientBuilder.java deleted file mode 100644 index 26d588337a1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClientBuilder.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.removed; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import versioning.removed.implementation.RemovedClientImpl; - -/** - * A builder for creating a new instance of the RemovedClient type. - */ -@ServiceClientBuilder(serviceClients = { RemovedClient.class, RemovedAsyncClient.class }) -public final class RemovedClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("versioning-removed.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the RemovedClientBuilder. - */ - @Generated - public RemovedClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RemovedClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RemovedClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RemovedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RemovedClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RemovedClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RemovedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RemovedClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RemovedClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private RemovedServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the RemovedClientBuilder. - */ - @Generated - public RemovedClientBuilder serviceVersion(RemovedServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the RemovedClientBuilder. - */ - @Generated - public RemovedClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of RemovedClientImpl with the provided parameters. - * - * @return an instance of RemovedClientImpl. - */ - @Generated - private RemovedClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - RemovedServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : RemovedServiceVersion.getLatest(); - RemovedClientImpl client = new RemovedClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), - this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of RemovedAsyncClient class. - * - * @return an instance of RemovedAsyncClient. - */ - @Generated - public RemovedAsyncClient buildAsyncClient() { - return new RemovedAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of RemovedClient class. - * - * @return an instance of RemovedClient. - */ - @Generated - public RemovedClient buildClient() { - return new RemovedClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(RemovedClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedServiceVersion.java deleted file mode 100644 index 58346a683f5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedServiceVersion.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.removed; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of RemovedClient. - */ -public enum RemovedServiceVersion implements ServiceVersion { - /** - * Enum value v1. - */ - V1("v1"), - - /** - * Enum value v2preview. - */ - V2PREVIEW("v2preview"), - - /** - * Enum value v2. - */ - V2("v2"); - - private final String version; - - RemovedServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link RemovedServiceVersion}. - */ - public static RemovedServiceVersion getLatest() { - return V2; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/RemovedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/RemovedClientImpl.java deleted file mode 100644 index 1ed0e073f48..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/RemovedClientImpl.java +++ /dev/null @@ -1,350 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.removed.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; -import versioning.removed.RemovedServiceVersion; - -/** - * Initializes a new instance of the RemovedClient type. - */ -public final class RemovedClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RemovedClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final RemovedServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public RemovedServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of RemovedClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public RemovedClientImpl(String endpoint, RemovedServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of RemovedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public RemovedClientImpl(HttpPipeline httpPipeline, String endpoint, RemovedServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of RemovedClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public RemovedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - RemovedServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(RemovedClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for RemovedClient to be used by the proxy service to perform REST calls. - */ - @Host("{endpoint}/versioning/removed/api-version:{version}") - @ServiceInterface(name = "RemovedClient") - public interface RemovedClientService { - @Post("/v2") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> v2(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/v2") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response v2Sync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/v3") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> modelV3(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/v3") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response modelV3Sync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The v2 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> v2WithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.v2(this.getEndpoint(), this.getServiceVersion().getVersion(), - contentType, accept, body, requestOptions, context)); - } - - /** - * The v2 operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     enumProp: String(enumMemberV2) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response v2WithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.v2Sync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, body, - requestOptions, Context.NONE); - } - - /** - * This operation will pass different paths and different request bodies based on different versions. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> modelV3WithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.modelV3(this.getEndpoint(), - this.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context)); - } - - /** - * This operation will pass different paths and different request bodies based on different versions. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     id: String (Required)
-     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response modelV3WithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.modelV3Sync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, body, - requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/package-info.java deleted file mode 100644 index 8030c5a13e8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for Removed. - * Test for the `@removed` decorator. - * - */ -package versioning.removed.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV2.java deleted file mode 100644 index ad9b193be64..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV2.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.removed.models; - -/** - * Defines values for EnumV2. - */ -public enum EnumV2 { - /** - * Enum value enumMemberV2. - */ - ENUM_MEMBER_V2("enumMemberV2"); - - /** - * The actual serialized value for a EnumV2 instance. - */ - private final String value; - - EnumV2(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a EnumV2 instance. - * - * @param value the serialized value to parse. - * @return the parsed EnumV2 object, or null if unable to parse. - */ - public static EnumV2 fromString(String value) { - if (value == null) { - return null; - } - EnumV2[] items = EnumV2.values(); - for (EnumV2 item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV3.java deleted file mode 100644 index 1d20a268df3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV3.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.removed.models; - -/** - * Defines values for EnumV3. - */ -public enum EnumV3 { - /** - * Enum value enumMemberV1. - */ - ENUM_MEMBER_V1("enumMemberV1"), - - /** - * Enum value enumMemberV2Preview. - */ - ENUM_MEMBER_V2PREVIEW("enumMemberV2Preview"); - - /** - * The actual serialized value for a EnumV3 instance. - */ - private final String value; - - EnumV3(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a EnumV3 instance. - * - * @param value the serialized value to parse. - * @return the parsed EnumV3 object, or null if unable to parse. - */ - public static EnumV3 fromString(String value) { - if (value == null) { - return null; - } - EnumV3[] items = EnumV3.values(); - for (EnumV3 item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV2.java deleted file mode 100644 index beac0a213da..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV2.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.removed.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ModelV2 model. - */ -@Immutable -public final class ModelV2 implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final String prop; - - /* - * The enumProp property. - */ - @Generated - private final EnumV2 enumProp; - - /* - * The unionProp property. - */ - @Generated - private final BinaryData unionProp; - - /** - * Creates an instance of ModelV2 class. - * - * @param prop the prop value to set. - * @param enumProp the enumProp value to set. - * @param unionProp the unionProp value to set. - */ - @Generated - public ModelV2(String prop, EnumV2 enumProp, BinaryData unionProp) { - this.prop = prop; - this.enumProp = enumProp; - this.unionProp = unionProp; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public String getProp() { - return this.prop; - } - - /** - * Get the enumProp property: The enumProp property. - * - * @return the enumProp value. - */ - @Generated - public EnumV2 getEnumProp() { - return this.enumProp; - } - - /** - * Get the unionProp property: The unionProp property. - * - * @return the unionProp value. - */ - @Generated - public BinaryData getUnionProp() { - return this.unionProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop); - jsonWriter.writeStringField("enumProp", this.enumProp == null ? null : this.enumProp.toString()); - jsonWriter.writeFieldName("unionProp"); - this.unionProp.writeTo(jsonWriter); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ModelV2 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ModelV2 if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ModelV2. - */ - @Generated - public static ModelV2 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String prop = null; - EnumV2 enumProp = null; - BinaryData unionProp = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = reader.getString(); - } else if ("enumProp".equals(fieldName)) { - enumProp = EnumV2.fromString(reader.getString()); - } else if ("unionProp".equals(fieldName)) { - unionProp = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - return new ModelV2(prop, enumProp, unionProp); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV3.java deleted file mode 100644 index bb624e06a68..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV3.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.removed.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The ModelV3 model. - */ -@Immutable -public final class ModelV3 implements JsonSerializable { - /* - * The id property. - */ - @Generated - private final String id; - - /* - * The enumProp property. - */ - @Generated - private final EnumV3 enumProp; - - /** - * Creates an instance of ModelV3 class. - * - * @param id the id value to set. - * @param enumProp the enumProp value to set. - */ - @Generated - public ModelV3(String id, EnumV3 enumProp) { - this.id = id; - this.enumProp = enumProp; - } - - /** - * Get the id property: The id property. - * - * @return the id value. - */ - @Generated - public String getId() { - return this.id; - } - - /** - * Get the enumProp property: The enumProp property. - * - * @return the enumProp value. - */ - @Generated - public EnumV3 getEnumProp() { - return this.enumProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - jsonWriter.writeStringField("enumProp", this.enumProp == null ? null : this.enumProp.toString()); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ModelV3 from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ModelV3 if the JsonReader was pointing to an instance of it, or null if it was pointing to - * JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the ModelV3. - */ - @Generated - public static ModelV3 fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String id = null; - EnumV3 enumProp = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("id".equals(fieldName)) { - id = reader.getString(); - } else if ("enumProp".equals(fieldName)) { - enumProp = EnumV3.fromString(reader.getString()); - } else { - reader.skipChildren(); - } - } - return new ModelV3(id, enumProp); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/package-info.java deleted file mode 100644 index bf1d0bf094b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for Removed. - * Test for the `@removed` decorator. - * - */ -package versioning.removed.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/package-info.java deleted file mode 100644 index 21d69c27367..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for Removed. - * Test for the `@removed` decorator. - * - */ -package versioning.removed; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceAsyncClient.java deleted file mode 100644 index 05559102f22..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceAsyncClient.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.renamedfrom; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import versioning.renamedfrom.implementation.NewInterfacesImpl; -import versioning.renamedfrom.models.NewModel; - -/** - * Initializes a new instance of the asynchronous RenamedFromClient type. - */ -@ServiceClient(builder = RenamedFromClientBuilder.class, isAsync = true) -public final class NewInterfaceAsyncClient { - @Generated - private final NewInterfacesImpl serviceClient; - - /** - * Initializes an instance of NewInterfaceAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NewInterfaceAsyncClient(NewInterfacesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The newOpInNewInterface operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> newOpInNewInterfaceWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.newOpInNewInterfaceWithResponseAsync(body, requestOptions); - } - - /** - * The newOpInNewInterface operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono newOpInNewInterface(NewModel body) { - // Generated convenience method for newOpInNewInterfaceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return newOpInNewInterfaceWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(NewModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceClient.java deleted file mode 100644 index e5c384153a5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceClient.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.renamedfrom; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import versioning.renamedfrom.implementation.NewInterfacesImpl; -import versioning.renamedfrom.models.NewModel; - -/** - * Initializes a new instance of the synchronous RenamedFromClient type. - */ -@ServiceClient(builder = RenamedFromClientBuilder.class) -public final class NewInterfaceClient { - @Generated - private final NewInterfacesImpl serviceClient; - - /** - * Initializes an instance of NewInterfaceClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - NewInterfaceClient(NewInterfacesImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The newOpInNewInterface operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response newOpInNewInterfaceWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.newOpInNewInterfaceWithResponse(body, requestOptions); - } - - /** - * The newOpInNewInterface operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public NewModel newOpInNewInterface(NewModel body) { - // Generated convenience method for newOpInNewInterfaceWithResponse - RequestOptions requestOptions = new RequestOptions(); - return newOpInNewInterfaceWithResponse(BinaryData.fromObject(body), requestOptions).getValue() - .toObject(NewModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromAsyncClient.java deleted file mode 100644 index 488df96fc82..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromAsyncClient.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.renamedfrom; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import versioning.renamedfrom.implementation.RenamedFromClientImpl; -import versioning.renamedfrom.models.NewModel; - -/** - * Initializes a new instance of the asynchronous RenamedFromClient type. - */ -@ServiceClient(builder = RenamedFromClientBuilder.class, isAsync = true) -public final class RenamedFromAsyncClient { - @Generated - private final RenamedFromClientImpl serviceClient; - - /** - * Initializes an instance of RenamedFromAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RenamedFromAsyncClient(RenamedFromClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The newOp operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param newQuery The newQuery parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> newOpWithResponse(String newQuery, BinaryData body, - RequestOptions requestOptions) { - return this.serviceClient.newOpWithResponseAsync(newQuery, body, requestOptions); - } - - /** - * The newOp operation. - * - * @param newQuery The newQuery parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono newOp(String newQuery, NewModel body) { - // Generated convenience method for newOpWithResponse - RequestOptions requestOptions = new RequestOptions(); - return newOpWithResponse(newQuery, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(NewModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClient.java deleted file mode 100644 index 2f292a1ba34..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClient.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.renamedfrom; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import versioning.renamedfrom.implementation.RenamedFromClientImpl; -import versioning.renamedfrom.models.NewModel; - -/** - * Initializes a new instance of the synchronous RenamedFromClient type. - */ -@ServiceClient(builder = RenamedFromClientBuilder.class) -public final class RenamedFromClient { - @Generated - private final RenamedFromClientImpl serviceClient; - - /** - * Initializes an instance of RenamedFromClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - RenamedFromClient(RenamedFromClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The newOp operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param newQuery The newQuery parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response newOpWithResponse(String newQuery, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.newOpWithResponse(newQuery, body, requestOptions); - } - - /** - * The newOp operation. - * - * @param newQuery The newQuery parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public NewModel newOp(String newQuery, NewModel body) { - // Generated convenience method for newOpWithResponse - RequestOptions requestOptions = new RequestOptions(); - return newOpWithResponse(newQuery, BinaryData.fromObject(body), requestOptions).getValue() - .toObject(NewModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClientBuilder.java deleted file mode 100644 index 144a97dd4a3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClientBuilder.java +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.renamedfrom; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import versioning.renamedfrom.implementation.RenamedFromClientImpl; - -/** - * A builder for creating a new instance of the RenamedFromClient type. - */ -@ServiceClientBuilder( - serviceClients = { - RenamedFromClient.class, - NewInterfaceClient.class, - RenamedFromAsyncClient.class, - NewInterfaceAsyncClient.class }) -public final class RenamedFromClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES = CoreUtils.getProperties("versioning-renamedfrom.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the RenamedFromClientBuilder. - */ - @Generated - public RenamedFromClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedFromClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedFromClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedFromClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedFromClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedFromClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedFromClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedFromClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public RenamedFromClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private RenamedFromServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the RenamedFromClientBuilder. - */ - @Generated - public RenamedFromClientBuilder serviceVersion(RenamedFromServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the RenamedFromClientBuilder. - */ - @Generated - public RenamedFromClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of RenamedFromClientImpl with the provided parameters. - * - * @return an instance of RenamedFromClientImpl. - */ - @Generated - private RenamedFromClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - RenamedFromServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : RenamedFromServiceVersion.getLatest(); - RenamedFromClientImpl client = new RenamedFromClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of RenamedFromAsyncClient class. - * - * @return an instance of RenamedFromAsyncClient. - */ - @Generated - public RenamedFromAsyncClient buildAsyncClient() { - return new RenamedFromAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of NewInterfaceAsyncClient class. - * - * @return an instance of NewInterfaceAsyncClient. - */ - @Generated - public NewInterfaceAsyncClient buildNewInterfaceAsyncClient() { - return new NewInterfaceAsyncClient(buildInnerClient().getNewInterfaces()); - } - - /** - * Builds an instance of RenamedFromClient class. - * - * @return an instance of RenamedFromClient. - */ - @Generated - public RenamedFromClient buildClient() { - return new RenamedFromClient(buildInnerClient()); - } - - /** - * Builds an instance of NewInterfaceClient class. - * - * @return an instance of NewInterfaceClient. - */ - @Generated - public NewInterfaceClient buildNewInterfaceClient() { - return new NewInterfaceClient(buildInnerClient().getNewInterfaces()); - } - - private static final ClientLogger LOGGER = new ClientLogger(RenamedFromClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromServiceVersion.java deleted file mode 100644 index 4d282157ff5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromServiceVersion.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.renamedfrom; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of RenamedFromClient. - */ -public enum RenamedFromServiceVersion implements ServiceVersion { - /** - * Enum value v1. - */ - V1("v1"), - - /** - * Enum value v2. - */ - V2("v2"); - - private final String version; - - RenamedFromServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link RenamedFromServiceVersion}. - */ - public static RenamedFromServiceVersion getLatest() { - return V2; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/NewInterfacesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/NewInterfacesImpl.java deleted file mode 100644 index 1f53d9600b3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/NewInterfacesImpl.java +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.renamedfrom.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -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 reactor.core.publisher.Mono; -import versioning.renamedfrom.RenamedFromServiceVersion; - -/** - * An instance of this class provides access to all the operations defined in NewInterfaces. - */ -public final class NewInterfacesImpl { - /** - * The proxy service used to perform REST calls. - */ - private final NewInterfacesService service; - - /** - * The service client containing this operation class. - */ - private final RenamedFromClientImpl client; - - /** - * Initializes an instance of NewInterfacesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - NewInterfacesImpl(RenamedFromClientImpl client) { - this.service - = RestProxy.create(NewInterfacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public RenamedFromServiceVersion getServiceVersion() { - return client.getServiceVersion(); - } - - /** - * The interface defining all the services for RenamedFromClientNewInterfaces to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}/versioning/renamed-from/api-version:{version}") - @ServiceInterface(name = "RenamedFromClientNewInterfaces") - public interface NewInterfacesService { - @Post("/interface/test") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> newOpInNewInterface(@HostParam("endpoint") String endpoint, - @HostParam("version") String version, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/interface/test") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response newOpInNewInterfaceSync(@HostParam("endpoint") String endpoint, - @HostParam("version") String version, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The newOpInNewInterface operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> newOpInNewInterfaceWithResponseAsync(BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.newOpInNewInterface(this.client.getEndpoint(), - this.client.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context)); - } - - /** - * The newOpInNewInterface operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response newOpInNewInterfaceWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.newOpInNewInterfaceSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), - contentType, accept, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java deleted file mode 100644 index c2c0fcac86a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.renamedfrom.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; -import versioning.renamedfrom.RenamedFromServiceVersion; - -/** - * Initializes a new instance of the RenamedFromClient type. - */ -public final class RenamedFromClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final RenamedFromClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final RenamedFromServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public RenamedFromServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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 NewInterfacesImpl object to access its operations. - */ - private final NewInterfacesImpl newInterfaces; - - /** - * Gets the NewInterfacesImpl object to access its operations. - * - * @return the NewInterfacesImpl object. - */ - public NewInterfacesImpl getNewInterfaces() { - return this.newInterfaces; - } - - /** - * Initializes an instance of RenamedFromClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public RenamedFromClientImpl(String endpoint, RenamedFromServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of RenamedFromClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public RenamedFromClientImpl(HttpPipeline httpPipeline, String endpoint, RenamedFromServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of RenamedFromClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public RenamedFromClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - RenamedFromServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.newInterfaces = new NewInterfacesImpl(this); - this.service = RestProxy.create(RenamedFromClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for RenamedFromClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}/versioning/renamed-from/api-version:{version}") - @ServiceInterface(name = "RenamedFromClient") - public interface RenamedFromClientService { - @Post("/test") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> newOp(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @QueryParam("newQuery") String newQuery, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/test") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response newOpSync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @QueryParam("newQuery") String newQuery, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The newOp operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param newQuery The newQuery parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> newOpWithResponseAsync(String newQuery, BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.newOp(this.getEndpoint(), this.getServiceVersion().getVersion(), - newQuery, contentType, accept, body, requestOptions, context)); - } - - /** - * The newOp operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     newProp: String (Required)
-     *     enumProp: String(newEnumMember) (Required)
-     *     unionProp: BinaryData (Required)
-     * }
-     * }
-     * 
- * - * @param newQuery The newQuery parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response newOpWithResponse(String newQuery, BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.newOpSync(this.getEndpoint(), this.getServiceVersion().getVersion(), newQuery, contentType, - accept, body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/package-info.java deleted file mode 100644 index b867ec5e2e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for RenamedFrom. - * Test for the `@renamedFrom` decorator. - * - */ -package versioning.renamedfrom.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewEnum.java deleted file mode 100644 index c247ad3cdc3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewEnum.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.renamedfrom.models; - -/** - * Defines values for NewEnum. - */ -public enum NewEnum { - /** - * Enum value newEnumMember. - */ - NEW_ENUM_MEMBER("newEnumMember"); - - /** - * The actual serialized value for a NewEnum instance. - */ - private final String value; - - NewEnum(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a NewEnum instance. - * - * @param value the serialized value to parse. - * @return the parsed NewEnum object, or null if unable to parse. - */ - public static NewEnum fromString(String value) { - if (value == null) { - return null; - } - NewEnum[] items = NewEnum.values(); - for (NewEnum item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewModel.java deleted file mode 100644 index 166c4086290..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewModel.java +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.renamedfrom.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.core.util.BinaryData; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The NewModel model. - */ -@Immutable -public final class NewModel implements JsonSerializable { - /* - * The newProp property. - */ - @Generated - private final String newProp; - - /* - * The enumProp property. - */ - @Generated - private final NewEnum enumProp; - - /* - * The unionProp property. - */ - @Generated - private final BinaryData unionProp; - - /** - * Creates an instance of NewModel class. - * - * @param newProp the newProp value to set. - * @param enumProp the enumProp value to set. - * @param unionProp the unionProp value to set. - */ - @Generated - public NewModel(String newProp, NewEnum enumProp, BinaryData unionProp) { - this.newProp = newProp; - this.enumProp = enumProp; - this.unionProp = unionProp; - } - - /** - * Get the newProp property: The newProp property. - * - * @return the newProp value. - */ - @Generated - public String getNewProp() { - return this.newProp; - } - - /** - * Get the enumProp property: The enumProp property. - * - * @return the enumProp value. - */ - @Generated - public NewEnum getEnumProp() { - return this.enumProp; - } - - /** - * Get the unionProp property: The unionProp property. - * - * @return the unionProp value. - */ - @Generated - public BinaryData getUnionProp() { - return this.unionProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("newProp", this.newProp); - jsonWriter.writeStringField("enumProp", this.enumProp == null ? null : this.enumProp.toString()); - jsonWriter.writeFieldName("unionProp"); - this.unionProp.writeTo(jsonWriter); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of NewModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of NewModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the NewModel. - */ - @Generated - public static NewModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String newProp = null; - NewEnum enumProp = null; - BinaryData unionProp = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("newProp".equals(fieldName)) { - newProp = reader.getString(); - } else if ("enumProp".equals(fieldName)) { - enumProp = NewEnum.fromString(reader.getString()); - } else if ("unionProp".equals(fieldName)) { - unionProp = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); - } else { - reader.skipChildren(); - } - } - return new NewModel(newProp, enumProp, unionProp); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/package-info.java deleted file mode 100644 index ae226cc9bc0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for RenamedFrom. - * Test for the `@renamedFrom` decorator. - * - */ -package versioning.renamedfrom.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/package-info.java deleted file mode 100644 index 034c4381e79..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for RenamedFrom. - * Test for the `@renamedFrom` decorator. - * - */ -package versioning.renamedfrom; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromAsyncClient.java deleted file mode 100644 index 730393bf272..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromAsyncClient.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.returntypechangedfrom; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import versioning.returntypechangedfrom.implementation.ReturnTypeChangedFromClientImpl; - -/** - * Initializes a new instance of the asynchronous ReturnTypeChangedFromClient type. - */ -@ServiceClient(builder = ReturnTypeChangedFromClientBuilder.class, isAsync = true) -public final class ReturnTypeChangedFromAsyncClient { - @Generated - private final ReturnTypeChangedFromClientImpl serviceClient; - - /** - * Initializes an instance of ReturnTypeChangedFromAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ReturnTypeChangedFromAsyncClient(ReturnTypeChangedFromClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The test operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> testWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.testWithResponseAsync(body, requestOptions); - } - - /** - * The test operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a sequence of textual characters on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono test(String body) { - // Generated convenience method for testWithResponse - RequestOptions requestOptions = new RequestOptions(); - return testWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(String.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClient.java deleted file mode 100644 index 4bb0ffa8918..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClient.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.returntypechangedfrom; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import versioning.returntypechangedfrom.implementation.ReturnTypeChangedFromClientImpl; - -/** - * Initializes a new instance of the synchronous ReturnTypeChangedFromClient type. - */ -@ServiceClient(builder = ReturnTypeChangedFromClientBuilder.class) -public final class ReturnTypeChangedFromClient { - @Generated - private final ReturnTypeChangedFromClientImpl serviceClient; - - /** - * Initializes an instance of ReturnTypeChangedFromClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - ReturnTypeChangedFromClient(ReturnTypeChangedFromClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The test operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response testWithResponse(BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.testWithResponse(body, requestOptions); - } - - /** - * The test operation. - * - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a sequence of textual characters. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public String test(String body) { - // Generated convenience method for testWithResponse - RequestOptions requestOptions = new RequestOptions(); - return testWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(String.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClientBuilder.java deleted file mode 100644 index 0d63f6ec55c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClientBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.returntypechangedfrom; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import versioning.returntypechangedfrom.implementation.ReturnTypeChangedFromClientImpl; - -/** - * A builder for creating a new instance of the ReturnTypeChangedFromClient type. - */ -@ServiceClientBuilder(serviceClients = { ReturnTypeChangedFromClient.class, ReturnTypeChangedFromAsyncClient.class }) -public final class ReturnTypeChangedFromClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("versioning-returntypechangedfrom.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the ReturnTypeChangedFromClientBuilder. - */ - @Generated - public ReturnTypeChangedFromClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ReturnTypeChangedFromClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ReturnTypeChangedFromClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ReturnTypeChangedFromClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ReturnTypeChangedFromClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ReturnTypeChangedFromClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ReturnTypeChangedFromClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ReturnTypeChangedFromClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public ReturnTypeChangedFromClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private ReturnTypeChangedFromServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the ReturnTypeChangedFromClientBuilder. - */ - @Generated - public ReturnTypeChangedFromClientBuilder serviceVersion(ReturnTypeChangedFromServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the ReturnTypeChangedFromClientBuilder. - */ - @Generated - public ReturnTypeChangedFromClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of ReturnTypeChangedFromClientImpl with the provided parameters. - * - * @return an instance of ReturnTypeChangedFromClientImpl. - */ - @Generated - private ReturnTypeChangedFromClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - ReturnTypeChangedFromServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : ReturnTypeChangedFromServiceVersion.getLatest(); - ReturnTypeChangedFromClientImpl client = new ReturnTypeChangedFromClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of ReturnTypeChangedFromAsyncClient class. - * - * @return an instance of ReturnTypeChangedFromAsyncClient. - */ - @Generated - public ReturnTypeChangedFromAsyncClient buildAsyncClient() { - return new ReturnTypeChangedFromAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of ReturnTypeChangedFromClient class. - * - * @return an instance of ReturnTypeChangedFromClient. - */ - @Generated - public ReturnTypeChangedFromClient buildClient() { - return new ReturnTypeChangedFromClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(ReturnTypeChangedFromClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromServiceVersion.java deleted file mode 100644 index 14bd3fee5fa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromServiceVersion.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.returntypechangedfrom; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of ReturnTypeChangedFromClient. - */ -public enum ReturnTypeChangedFromServiceVersion implements ServiceVersion { - /** - * Enum value v1. - */ - V1("v1"), - - /** - * Enum value v2. - */ - V2("v2"); - - private final String version; - - ReturnTypeChangedFromServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link ReturnTypeChangedFromServiceVersion}. - */ - public static ReturnTypeChangedFromServiceVersion getLatest() { - return V2; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java deleted file mode 100644 index 54858014fdd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.returntypechangedfrom.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; -import versioning.returntypechangedfrom.ReturnTypeChangedFromServiceVersion; - -/** - * Initializes a new instance of the ReturnTypeChangedFromClient type. - */ -public final class ReturnTypeChangedFromClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final ReturnTypeChangedFromClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final ReturnTypeChangedFromServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public ReturnTypeChangedFromServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of ReturnTypeChangedFromClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public ReturnTypeChangedFromClientImpl(String endpoint, ReturnTypeChangedFromServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of ReturnTypeChangedFromClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public ReturnTypeChangedFromClientImpl(HttpPipeline httpPipeline, String endpoint, - ReturnTypeChangedFromServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of ReturnTypeChangedFromClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public ReturnTypeChangedFromClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - String endpoint, ReturnTypeChangedFromServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service = RestProxy.create(ReturnTypeChangedFromClientService.class, this.httpPipeline, - this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for ReturnTypeChangedFromClient to be used by the proxy service to - * perform REST calls. - */ - @Host("{endpoint}/versioning/return-type-changed-from/api-version:{version}") - @ServiceInterface(name = "ReturnTypeChangedFromClient") - public interface ReturnTypeChangedFromClientService { - @Post("/test") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> test(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - - @Post("/test") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response testSync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, - @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); - } - - /** - * The test operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> testWithResponseAsync(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.test(this.getEndpoint(), this.getServiceVersion().getVersion(), - contentType, accept, body, requestOptions, context)); - } - - /** - * The test operation. - *

Request Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * String
-     * }
-     * 
- * - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return a sequence of textual characters along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response testWithResponse(BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.testSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, body, - requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/package-info.java deleted file mode 100644 index f92fb10e32c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for ReturnTypeChangedFrom. - * Test for the `@returnTypeChangedFrom` decorator. - * - */ -package versioning.returntypechangedfrom.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/package-info.java deleted file mode 100644 index 69575d6326b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for ReturnTypeChangedFrom. - * Test for the `@returnTypeChangedFrom` decorator. - * - */ -package versioning.returntypechangedfrom; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromAsyncClient.java deleted file mode 100644 index d1863fca3cc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromAsyncClient.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.typechangedfrom; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Mono; -import versioning.typechangedfrom.implementation.TypeChangedFromClientImpl; -import versioning.typechangedfrom.models.TestModel; - -/** - * Initializes a new instance of the asynchronous TypeChangedFromClient type. - */ -@ServiceClient(builder = TypeChangedFromClientBuilder.class, isAsync = true) -public final class TypeChangedFromAsyncClient { - @Generated - private final TypeChangedFromClientImpl serviceClient; - - /** - * Initializes an instance of TypeChangedFromAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - TypeChangedFromAsyncClient(TypeChangedFromClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The test operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param param The param parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> testWithResponse(String param, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.testWithResponseAsync(param, body, requestOptions); - } - - /** - * The test operation. - * - * @param param The param parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono test(String param, TestModel body) { - // Generated convenience method for testWithResponse - RequestOptions requestOptions = new RequestOptions(); - return testWithResponse(param, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(TestModel.class)); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClient.java deleted file mode 100644 index e1ee88b4841..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClient.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.typechangedfrom; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import com.azure.core.util.BinaryData; -import versioning.typechangedfrom.implementation.TypeChangedFromClientImpl; -import versioning.typechangedfrom.models.TestModel; - -/** - * Initializes a new instance of the synchronous TypeChangedFromClient type. - */ -@ServiceClient(builder = TypeChangedFromClientBuilder.class) -public final class TypeChangedFromClient { - @Generated - private final TypeChangedFromClientImpl serviceClient; - - /** - * Initializes an instance of TypeChangedFromClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - TypeChangedFromClient(TypeChangedFromClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The test operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param param The param parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response testWithResponse(String param, BinaryData body, RequestOptions requestOptions) { - return this.serviceClient.testWithResponse(param, body, requestOptions); - } - - /** - * The test operation. - * - * @param param The param parameter. - * @param body The body parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public TestModel test(String param, TestModel body) { - // Generated convenience method for testWithResponse - RequestOptions requestOptions = new RequestOptions(); - return testWithResponse(param, BinaryData.fromObject(body), requestOptions).getValue() - .toObject(TestModel.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClientBuilder.java deleted file mode 100644 index 25a8e6f43cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClientBuilder.java +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.typechangedfrom; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ServiceClientBuilder; -import com.azure.core.client.traits.ConfigurationTrait; -import com.azure.core.client.traits.EndpointTrait; -import com.azure.core.client.traits.HttpTrait; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpPipelinePosition; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.AddHeadersPolicy; -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.RequestIdPolicy; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.util.ClientOptions; -import com.azure.core.util.Configuration; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.builder.ClientBuilderUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.serializer.JacksonAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import versioning.typechangedfrom.implementation.TypeChangedFromClientImpl; - -/** - * A builder for creating a new instance of the TypeChangedFromClient type. - */ -@ServiceClientBuilder(serviceClients = { TypeChangedFromClient.class, TypeChangedFromAsyncClient.class }) -public final class TypeChangedFromClientBuilder implements HttpTrait, - ConfigurationTrait, EndpointTrait { - @Generated - private static final String SDK_NAME = "name"; - - @Generated - private static final String SDK_VERSION = "version"; - - @Generated - private static final Map PROPERTIES - = CoreUtils.getProperties("versioning-typechangedfrom.properties"); - - @Generated - private final List pipelinePolicies; - - /** - * Create an instance of the TypeChangedFromClientBuilder. - */ - @Generated - public TypeChangedFromClientBuilder() { - this.pipelinePolicies = new ArrayList<>(); - } - - /* - * The HTTP client used to send the request. - */ - @Generated - private HttpClient httpClient; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TypeChangedFromClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /* - * The HTTP pipeline to send requests through. - */ - @Generated - private HttpPipeline pipeline; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TypeChangedFromClientBuilder pipeline(HttpPipeline pipeline) { - if (this.pipeline != null && pipeline == null) { - LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); - } - this.pipeline = pipeline; - return this; - } - - /* - * The logging configuration for HTTP requests and responses. - */ - @Generated - private HttpLogOptions httpLogOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TypeChangedFromClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; - return this; - } - - /* - * The client options such as application ID and custom headers to set on a request. - */ - @Generated - private ClientOptions clientOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TypeChangedFromClientBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - return this; - } - - /* - * The retry options to configure retry policy for failed requests. - */ - @Generated - private RetryOptions retryOptions; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TypeChangedFromClientBuilder retryOptions(RetryOptions retryOptions) { - this.retryOptions = retryOptions; - return this; - } - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TypeChangedFromClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { - Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); - pipelinePolicies.add(customPolicy); - return this; - } - - /* - * The configuration store that is used during construction of the service client. - */ - @Generated - private Configuration configuration; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TypeChangedFromClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /* - * The service endpoint - */ - @Generated - private String endpoint; - - /** - * {@inheritDoc}. - */ - @Generated - @Override - public TypeChangedFromClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * Service version - */ - @Generated - private TypeChangedFromServiceVersion serviceVersion; - - /** - * Sets Service version. - * - * @param serviceVersion the serviceVersion value. - * @return the TypeChangedFromClientBuilder. - */ - @Generated - public TypeChangedFromClientBuilder serviceVersion(TypeChangedFromServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - return this; - } - - /* - * The retry policy that will attempt to retry failed requests, if applicable. - */ - @Generated - private RetryPolicy retryPolicy; - - /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. - * - * @param retryPolicy the retryPolicy value. - * @return the TypeChangedFromClientBuilder. - */ - @Generated - public TypeChangedFromClientBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - return this; - } - - /** - * Builds an instance of TypeChangedFromClientImpl with the provided parameters. - * - * @return an instance of TypeChangedFromClientImpl. - */ - @Generated - private TypeChangedFromClientImpl buildInnerClient() { - this.validateClient(); - HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - TypeChangedFromServiceVersion localServiceVersion - = (serviceVersion != null) ? serviceVersion : TypeChangedFromServiceVersion.getLatest(); - TypeChangedFromClientImpl client = new TypeChangedFromClientImpl(localPipeline, - JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); - return client; - } - - @Generated - private void validateClient() { - // This method is invoked from 'buildInnerClient'/'buildClient' method. - // Developer can customize this method, to validate that the necessary conditions are met for the new client. - Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); - } - - @Generated - private HttpPipeline createHttpPipeline() { - Configuration buildConfiguration - = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; - HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; - ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; - List policies = new ArrayList<>(); - String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); - String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); - String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); - policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddHeadersFromContextPolicy()); - HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); - if (headers != null) { - policies.add(new AddHeadersPolicy(headers)); - } - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); - policies.add(new AddDatePolicy()); - this.pipelinePolicies.stream() - .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) - .forEach(p -> policies.add(p)); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(localHttpLogOptions)); - HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .clientOptions(localClientOptions) - .build(); - return httpPipeline; - } - - /** - * Builds an instance of TypeChangedFromAsyncClient class. - * - * @return an instance of TypeChangedFromAsyncClient. - */ - @Generated - public TypeChangedFromAsyncClient buildAsyncClient() { - return new TypeChangedFromAsyncClient(buildInnerClient()); - } - - /** - * Builds an instance of TypeChangedFromClient class. - * - * @return an instance of TypeChangedFromClient. - */ - @Generated - public TypeChangedFromClient buildClient() { - return new TypeChangedFromClient(buildInnerClient()); - } - - private static final ClientLogger LOGGER = new ClientLogger(TypeChangedFromClientBuilder.class); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromServiceVersion.java deleted file mode 100644 index 9aeb02e2411..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromServiceVersion.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.typechangedfrom; - -import com.azure.core.util.ServiceVersion; - -/** - * Service version of TypeChangedFromClient. - */ -public enum TypeChangedFromServiceVersion implements ServiceVersion { - /** - * Enum value v1. - */ - V1("v1"), - - /** - * Enum value v2. - */ - V2("v2"); - - private final String version; - - TypeChangedFromServiceVersion(String version) { - this.version = version; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return this.version; - } - - /** - * Gets the latest service version supported by this client library. - * - * @return The latest {@link TypeChangedFromServiceVersion}. - */ - public static TypeChangedFromServiceVersion getLatest() { - return V2; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java deleted file mode 100644 index c91db882420..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.typechangedfrom.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -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.annotation.UnexpectedResponseExceptionType; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.http.rest.RequestOptions; -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 com.azure.core.util.serializer.JacksonAdapter; -import com.azure.core.util.serializer.SerializerAdapter; -import reactor.core.publisher.Mono; -import versioning.typechangedfrom.TypeChangedFromServiceVersion; - -/** - * Initializes a new instance of the TypeChangedFromClient type. - */ -public final class TypeChangedFromClientImpl { - /** - * The proxy service used to perform REST calls. - */ - private final TypeChangedFromClientService service; - - /** - * Need to be set as 'http://localhost:3000' in client. - */ - private final String endpoint; - - /** - * Gets Need to be set as 'http://localhost:3000' in client. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Service version. - */ - private final TypeChangedFromServiceVersion serviceVersion; - - /** - * Gets Service version. - * - * @return the serviceVersion value. - */ - public TypeChangedFromServiceVersion getServiceVersion() { - return this.serviceVersion; - } - - /** - * 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; - } - - /** - * Initializes an instance of TypeChangedFromClient client. - * - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public TypeChangedFromClientImpl(String endpoint, TypeChangedFromServiceVersion serviceVersion) { - this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of TypeChangedFromClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public TypeChangedFromClientImpl(HttpPipeline httpPipeline, String endpoint, - TypeChangedFromServiceVersion serviceVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); - } - - /** - * Initializes an instance of TypeChangedFromClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param endpoint Need to be set as 'http://localhost:3000' in client. - * @param serviceVersion Service version. - */ - public TypeChangedFromClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, - TypeChangedFromServiceVersion serviceVersion) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.endpoint = endpoint; - this.serviceVersion = serviceVersion; - this.service - = RestProxy.create(TypeChangedFromClientService.class, this.httpPipeline, this.getSerializerAdapter()); - } - - /** - * The interface defining all the services for TypeChangedFromClient to be used by the proxy service to perform REST - * calls. - */ - @Host("{endpoint}/versioning/type-changed-from/api-version:{version}") - @ServiceInterface(name = "TypeChangedFromClient") - public interface TypeChangedFromClientService { - @Post("/test") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> test(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @QueryParam("param") String param, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - - @Post("/test") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) - @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) - @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) - @UnexpectedResponseExceptionType(HttpResponseException.class) - Response testSync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, - @QueryParam("param") String param, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, - RequestOptions requestOptions, Context context); - } - - /** - * The test operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param param The param parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> testWithResponseAsync(String param, BinaryData body, - RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return FluxUtil.withContext(context -> service.test(this.getEndpoint(), this.getServiceVersion().getVersion(), - param, contentType, accept, body, requestOptions, context)); - } - - /** - * The test operation. - *

Request Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Required)
-     * }
-     * }
-     * 
- * - *

Response Body Schema

- * - *
-     * {@code
-     * {
-     *     prop: String (Required)
-     *     changedProp: String (Required)
-     * }
-     * }
-     * 
- * - * @param param The param parameter. - * @param body The body parameter. - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response testWithResponse(String param, BinaryData body, RequestOptions requestOptions) { - final String contentType = "application/json"; - final String accept = "application/json"; - return service.testSync(this.getEndpoint(), this.getServiceVersion().getVersion(), param, contentType, accept, - body, requestOptions, Context.NONE); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/package-info.java deleted file mode 100644 index a762818a80e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the implementations for TypeChangedFrom. - * Test for the `@typeChangedFrom` decorator. - * - */ -package versioning.typechangedfrom.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/TestModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/TestModel.java deleted file mode 100644 index 42dd4af3301..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/TestModel.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.typechangedfrom.models; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The TestModel model. - */ -@Immutable -public final class TestModel implements JsonSerializable { - /* - * The prop property. - */ - @Generated - private final String prop; - - /* - * The changedProp property. - */ - @Generated - private final String changedProp; - - /** - * Creates an instance of TestModel class. - * - * @param prop the prop value to set. - * @param changedProp the changedProp value to set. - */ - @Generated - public TestModel(String prop, String changedProp) { - this.prop = prop; - this.changedProp = changedProp; - } - - /** - * Get the prop property: The prop property. - * - * @return the prop value. - */ - @Generated - public String getProp() { - return this.prop; - } - - /** - * Get the changedProp property: The changedProp property. - * - * @return the changedProp value. - */ - @Generated - public String getChangedProp() { - return this.changedProp; - } - - /** - * {@inheritDoc} - */ - @Generated - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("prop", this.prop); - jsonWriter.writeStringField("changedProp", this.changedProp); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TestModel from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TestModel if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TestModel. - */ - @Generated - public static TestModel fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - String prop = null; - String changedProp = null; - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("prop".equals(fieldName)) { - prop = reader.getString(); - } else if ("changedProp".equals(fieldName)) { - changedProp = reader.getString(); - } else { - reader.skipChildren(); - } - } - return new TestModel(prop, changedProp); - }); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/package-info.java deleted file mode 100644 index feabc53edbe..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the data models for TypeChangedFrom. - * Test for the `@typeChangedFrom` decorator. - * - */ -package versioning.typechangedfrom.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/package-info.java deleted file mode 100644 index 114593801f6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -/** - * - * Package containing the classes for TypeChangedFrom. - * Test for the `@typeChangedFrom` decorator. - * - */ -package versioning.typechangedfrom; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_apiview_properties.json deleted file mode 100644 index d4b49f747a6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_apiview_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "authentication.apikey.ApiKeyAsyncClient": "Authentication.ApiKey", - "authentication.apikey.ApiKeyAsyncClient.invalid": "Authentication.ApiKey.invalid", - "authentication.apikey.ApiKeyAsyncClient.invalidWithResponse": "Authentication.ApiKey.invalid", - "authentication.apikey.ApiKeyAsyncClient.valid": "Authentication.ApiKey.valid", - "authentication.apikey.ApiKeyAsyncClient.validWithResponse": "Authentication.ApiKey.valid", - "authentication.apikey.ApiKeyClient": "Authentication.ApiKey", - "authentication.apikey.ApiKeyClient.invalid": "Authentication.ApiKey.invalid", - "authentication.apikey.ApiKeyClient.invalidWithResponse": "Authentication.ApiKey.invalid", - "authentication.apikey.ApiKeyClient.valid": "Authentication.ApiKey.valid", - "authentication.apikey.ApiKeyClient.validWithResponse": "Authentication.ApiKey.valid", - "authentication.apikey.ApiKeyClientBuilder": "Authentication.ApiKey" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_metadata.json deleted file mode 100644 index 697b8c7027b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"authentication.apikey.ApiKeyAsyncClient":"Authentication.ApiKey","authentication.apikey.ApiKeyAsyncClient.invalid":"Authentication.ApiKey.invalid","authentication.apikey.ApiKeyAsyncClient.invalidWithResponse":"Authentication.ApiKey.invalid","authentication.apikey.ApiKeyAsyncClient.valid":"Authentication.ApiKey.valid","authentication.apikey.ApiKeyAsyncClient.validWithResponse":"Authentication.ApiKey.valid","authentication.apikey.ApiKeyClient":"Authentication.ApiKey","authentication.apikey.ApiKeyClient.invalid":"Authentication.ApiKey.invalid","authentication.apikey.ApiKeyClient.invalidWithResponse":"Authentication.ApiKey.invalid","authentication.apikey.ApiKeyClient.valid":"Authentication.ApiKey.valid","authentication.apikey.ApiKeyClient.validWithResponse":"Authentication.ApiKey.valid","authentication.apikey.ApiKeyClientBuilder":"Authentication.ApiKey"},"generatedFiles":["src/main/java/authentication/apikey/ApiKeyAsyncClient.java","src/main/java/authentication/apikey/ApiKeyClient.java","src/main/java/authentication/apikey/ApiKeyClientBuilder.java","src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java","src/main/java/authentication/apikey/implementation/package-info.java","src/main/java/authentication/apikey/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_apiview_properties.json deleted file mode 100644 index 5cb55d8a990..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_apiview_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "authentication.http.custom.CustomAsyncClient": "Authentication.Http.Custom", - "authentication.http.custom.CustomAsyncClient.invalid": "Authentication.Http.Custom.invalid", - "authentication.http.custom.CustomAsyncClient.invalidWithResponse": "Authentication.Http.Custom.invalid", - "authentication.http.custom.CustomAsyncClient.valid": "Authentication.Http.Custom.valid", - "authentication.http.custom.CustomAsyncClient.validWithResponse": "Authentication.Http.Custom.valid", - "authentication.http.custom.CustomClient": "Authentication.Http.Custom", - "authentication.http.custom.CustomClient.invalid": "Authentication.Http.Custom.invalid", - "authentication.http.custom.CustomClient.invalidWithResponse": "Authentication.Http.Custom.invalid", - "authentication.http.custom.CustomClient.valid": "Authentication.Http.Custom.valid", - "authentication.http.custom.CustomClient.validWithResponse": "Authentication.Http.Custom.valid", - "authentication.http.custom.CustomClientBuilder": "Authentication.Http.Custom" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_metadata.json deleted file mode 100644 index 2b83d16a831..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"authentication.http.custom.CustomAsyncClient":"Authentication.Http.Custom","authentication.http.custom.CustomAsyncClient.invalid":"Authentication.Http.Custom.invalid","authentication.http.custom.CustomAsyncClient.invalidWithResponse":"Authentication.Http.Custom.invalid","authentication.http.custom.CustomAsyncClient.valid":"Authentication.Http.Custom.valid","authentication.http.custom.CustomAsyncClient.validWithResponse":"Authentication.Http.Custom.valid","authentication.http.custom.CustomClient":"Authentication.Http.Custom","authentication.http.custom.CustomClient.invalid":"Authentication.Http.Custom.invalid","authentication.http.custom.CustomClient.invalidWithResponse":"Authentication.Http.Custom.invalid","authentication.http.custom.CustomClient.valid":"Authentication.Http.Custom.valid","authentication.http.custom.CustomClient.validWithResponse":"Authentication.Http.Custom.valid","authentication.http.custom.CustomClientBuilder":"Authentication.Http.Custom"},"generatedFiles":["src/main/java/authentication/http/custom/CustomAsyncClient.java","src/main/java/authentication/http/custom/CustomClient.java","src/main/java/authentication/http/custom/CustomClientBuilder.java","src/main/java/authentication/http/custom/implementation/CustomClientImpl.java","src/main/java/authentication/http/custom/implementation/package-info.java","src/main/java/authentication/http/custom/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_apiview_properties.json deleted file mode 100644 index fce42c74766..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_apiview_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "authentication.oauth2.OAuth2AsyncClient": "Authentication.OAuth2", - "authentication.oauth2.OAuth2AsyncClient.invalid": "Authentication.OAuth2.invalid", - "authentication.oauth2.OAuth2AsyncClient.invalidWithResponse": "Authentication.OAuth2.invalid", - "authentication.oauth2.OAuth2AsyncClient.valid": "Authentication.OAuth2.valid", - "authentication.oauth2.OAuth2AsyncClient.validWithResponse": "Authentication.OAuth2.valid", - "authentication.oauth2.OAuth2Client": "Authentication.OAuth2", - "authentication.oauth2.OAuth2Client.invalid": "Authentication.OAuth2.invalid", - "authentication.oauth2.OAuth2Client.invalidWithResponse": "Authentication.OAuth2.invalid", - "authentication.oauth2.OAuth2Client.valid": "Authentication.OAuth2.valid", - "authentication.oauth2.OAuth2Client.validWithResponse": "Authentication.OAuth2.valid", - "authentication.oauth2.OAuth2ClientBuilder": "Authentication.OAuth2" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_metadata.json deleted file mode 100644 index bf1691010b7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"authentication.oauth2.OAuth2AsyncClient":"Authentication.OAuth2","authentication.oauth2.OAuth2AsyncClient.invalid":"Authentication.OAuth2.invalid","authentication.oauth2.OAuth2AsyncClient.invalidWithResponse":"Authentication.OAuth2.invalid","authentication.oauth2.OAuth2AsyncClient.valid":"Authentication.OAuth2.valid","authentication.oauth2.OAuth2AsyncClient.validWithResponse":"Authentication.OAuth2.valid","authentication.oauth2.OAuth2Client":"Authentication.OAuth2","authentication.oauth2.OAuth2Client.invalid":"Authentication.OAuth2.invalid","authentication.oauth2.OAuth2Client.invalidWithResponse":"Authentication.OAuth2.invalid","authentication.oauth2.OAuth2Client.valid":"Authentication.OAuth2.valid","authentication.oauth2.OAuth2Client.validWithResponse":"Authentication.OAuth2.valid","authentication.oauth2.OAuth2ClientBuilder":"Authentication.OAuth2"},"generatedFiles":["src/main/java/authentication/oauth2/OAuth2AsyncClient.java","src/main/java/authentication/oauth2/OAuth2Client.java","src/main/java/authentication/oauth2/OAuth2ClientBuilder.java","src/main/java/authentication/oauth2/implementation/OAuth2ClientImpl.java","src/main/java/authentication/oauth2/implementation/package-info.java","src/main/java/authentication/oauth2/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_apiview_properties.json deleted file mode 100644 index e1703358e43..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_apiview_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "authentication.union.UnionAsyncClient": "Authentication.Union", - "authentication.union.UnionAsyncClient.validKey": "Authentication.Union.validKey", - "authentication.union.UnionAsyncClient.validKeyWithResponse": "Authentication.Union.validKey", - "authentication.union.UnionAsyncClient.validToken": "Authentication.Union.validToken", - "authentication.union.UnionAsyncClient.validTokenWithResponse": "Authentication.Union.validToken", - "authentication.union.UnionClient": "Authentication.Union", - "authentication.union.UnionClient.validKey": "Authentication.Union.validKey", - "authentication.union.UnionClient.validKeyWithResponse": "Authentication.Union.validKey", - "authentication.union.UnionClient.validToken": "Authentication.Union.validToken", - "authentication.union.UnionClient.validTokenWithResponse": "Authentication.Union.validToken", - "authentication.union.UnionClientBuilder": "Authentication.Union" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_metadata.json deleted file mode 100644 index af664fefa6a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"authentication.union.UnionAsyncClient":"Authentication.Union","authentication.union.UnionAsyncClient.validKey":"Authentication.Union.validKey","authentication.union.UnionAsyncClient.validKeyWithResponse":"Authentication.Union.validKey","authentication.union.UnionAsyncClient.validToken":"Authentication.Union.validToken","authentication.union.UnionAsyncClient.validTokenWithResponse":"Authentication.Union.validToken","authentication.union.UnionClient":"Authentication.Union","authentication.union.UnionClient.validKey":"Authentication.Union.validKey","authentication.union.UnionClient.validKeyWithResponse":"Authentication.Union.validKey","authentication.union.UnionClient.validToken":"Authentication.Union.validToken","authentication.union.UnionClient.validTokenWithResponse":"Authentication.Union.validToken","authentication.union.UnionClientBuilder":"Authentication.Union"},"generatedFiles":["src/main/java/authentication/union/UnionAsyncClient.java","src/main/java/authentication/union/UnionClient.java","src/main/java/authentication/union/UnionClientBuilder.java","src/main/java/authentication/union/implementation/UnionClientImpl.java","src/main/java/authentication/union/implementation/package-info.java","src/main/java/authentication/union/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_apiview_properties.json deleted file mode 100644 index b2ecacca094..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_apiview_properties.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.access.AccessClientBuilder": "_Specs_.Azure.ClientGenerator.Core.Access", - "azure.clientgenerator.core.access.InternalOperationAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation", - "azure.clientgenerator.core.access.InternalOperationAsyncClient.internalDecoratorInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal", - "azure.clientgenerator.core.access.InternalOperationAsyncClient.internalDecoratorInInternalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal", - "azure.clientgenerator.core.access.InternalOperationAsyncClient.noDecoratorInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal", - "azure.clientgenerator.core.access.InternalOperationAsyncClient.noDecoratorInInternalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal", - "azure.clientgenerator.core.access.InternalOperationAsyncClient.publicDecoratorInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal", - "azure.clientgenerator.core.access.InternalOperationAsyncClient.publicDecoratorInInternalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal", - "azure.clientgenerator.core.access.InternalOperationClient": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation", - "azure.clientgenerator.core.access.InternalOperationClient.internalDecoratorInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal", - "azure.clientgenerator.core.access.InternalOperationClient.internalDecoratorInInternalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal", - "azure.clientgenerator.core.access.InternalOperationClient.noDecoratorInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal", - "azure.clientgenerator.core.access.InternalOperationClient.noDecoratorInInternalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal", - "azure.clientgenerator.core.access.InternalOperationClient.publicDecoratorInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal", - "azure.clientgenerator.core.access.InternalOperationClient.publicDecoratorInInternalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal", - "azure.clientgenerator.core.access.PublicOperationAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation", - "azure.clientgenerator.core.access.PublicOperationAsyncClient.noDecoratorInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic", - "azure.clientgenerator.core.access.PublicOperationAsyncClient.noDecoratorInPublicWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic", - "azure.clientgenerator.core.access.PublicOperationAsyncClient.publicDecoratorInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic", - "azure.clientgenerator.core.access.PublicOperationAsyncClient.publicDecoratorInPublicWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic", - "azure.clientgenerator.core.access.PublicOperationClient": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation", - "azure.clientgenerator.core.access.PublicOperationClient.noDecoratorInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic", - "azure.clientgenerator.core.access.PublicOperationClient.noDecoratorInPublicWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic", - "azure.clientgenerator.core.access.PublicOperationClient.publicDecoratorInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic", - "azure.clientgenerator.core.access.PublicOperationClient.publicDecoratorInPublicWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic", - "azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation", - "azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.discriminator": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator", - "azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.discriminatorWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator", - "azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.operation": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation", - "azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.operationWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation", - "azure.clientgenerator.core.access.RelativeModelInOperationClient": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation", - "azure.clientgenerator.core.access.RelativeModelInOperationClient.discriminator": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator", - "azure.clientgenerator.core.access.RelativeModelInOperationClient.discriminatorWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator", - "azure.clientgenerator.core.access.RelativeModelInOperationClient.operation": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation", - "azure.clientgenerator.core.access.RelativeModelInOperationClient.operationWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation", - "azure.clientgenerator.core.access.SharedModelInOperationAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation", - "azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.internal": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal", - "azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.internalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal", - "azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.publicMethod": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public", - "azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.publicMethodWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public", - "azure.clientgenerator.core.access.SharedModelInOperationClient": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation", - "azure.clientgenerator.core.access.SharedModelInOperationClient.internal": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal", - "azure.clientgenerator.core.access.SharedModelInOperationClient.internalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal", - "azure.clientgenerator.core.access.SharedModelInOperationClient.publicMethod": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public", - "azure.clientgenerator.core.access.SharedModelInOperationClient.publicMethodWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public", - "azure.clientgenerator.core.access.internaloperation.implementation.models.InternalDecoratorModelInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.InternalDecoratorModelInInternal", - "azure.clientgenerator.core.access.internaloperation.implementation.models.NoDecoratorModelInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.NoDecoratorModelInInternal", - "azure.clientgenerator.core.access.internaloperation.models.PublicDecoratorModelInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.PublicDecoratorModelInInternal", - "azure.clientgenerator.core.access.publicoperation.models.NoDecoratorModelInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.NoDecoratorModelInPublic", - "azure.clientgenerator.core.access.publicoperation.models.PublicDecoratorModelInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.PublicDecoratorModelInPublic", - "azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.AbstractModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.AbstractModel", - "azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.BaseModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.BaseModel", - "azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.InnerModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.InnerModel", - "azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.OuterModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.OuterModel", - "azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.RealModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.RealModel", - "azure.clientgenerator.core.access.sharedmodelinoperation.models.SharedModel": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.SharedModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_metadata.json deleted file mode 100644 index 15214167dd7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.access.AccessClientBuilder":"_Specs_.Azure.ClientGenerator.Core.Access","azure.clientgenerator.core.access.InternalOperationAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation","azure.clientgenerator.core.access.InternalOperationAsyncClient.internalDecoratorInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationAsyncClient.internalDecoratorInInternalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationAsyncClient.noDecoratorInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationAsyncClient.noDecoratorInInternalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationAsyncClient.publicDecoratorInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationAsyncClient.publicDecoratorInInternalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationClient":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation","azure.clientgenerator.core.access.InternalOperationClient.internalDecoratorInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationClient.internalDecoratorInInternalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationClient.noDecoratorInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationClient.noDecoratorInInternalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationClient.publicDecoratorInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationClient.publicDecoratorInInternalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal","azure.clientgenerator.core.access.PublicOperationAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation","azure.clientgenerator.core.access.PublicOperationAsyncClient.noDecoratorInPublic":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationAsyncClient.noDecoratorInPublicWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationAsyncClient.publicDecoratorInPublic":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationAsyncClient.publicDecoratorInPublicWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationClient":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation","azure.clientgenerator.core.access.PublicOperationClient.noDecoratorInPublic":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationClient.noDecoratorInPublicWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationClient.publicDecoratorInPublic":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationClient.publicDecoratorInPublicWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic","azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation","azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.discriminator":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator","azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.discriminatorWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator","azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.operation":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation","azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.operationWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation","azure.clientgenerator.core.access.RelativeModelInOperationClient":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation","azure.clientgenerator.core.access.RelativeModelInOperationClient.discriminator":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator","azure.clientgenerator.core.access.RelativeModelInOperationClient.discriminatorWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator","azure.clientgenerator.core.access.RelativeModelInOperationClient.operation":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation","azure.clientgenerator.core.access.RelativeModelInOperationClient.operationWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation","azure.clientgenerator.core.access.SharedModelInOperationAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation","azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.internal":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal","azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.internalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal","azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.publicMethod":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public","azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.publicMethodWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public","azure.clientgenerator.core.access.SharedModelInOperationClient":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation","azure.clientgenerator.core.access.SharedModelInOperationClient.internal":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal","azure.clientgenerator.core.access.SharedModelInOperationClient.internalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal","azure.clientgenerator.core.access.SharedModelInOperationClient.publicMethod":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public","azure.clientgenerator.core.access.SharedModelInOperationClient.publicMethodWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public","azure.clientgenerator.core.access.internaloperation.implementation.models.InternalDecoratorModelInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.InternalDecoratorModelInInternal","azure.clientgenerator.core.access.internaloperation.implementation.models.NoDecoratorModelInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.NoDecoratorModelInInternal","azure.clientgenerator.core.access.internaloperation.models.PublicDecoratorModelInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.PublicDecoratorModelInInternal","azure.clientgenerator.core.access.publicoperation.models.NoDecoratorModelInPublic":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.NoDecoratorModelInPublic","azure.clientgenerator.core.access.publicoperation.models.PublicDecoratorModelInPublic":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.PublicDecoratorModelInPublic","azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.AbstractModel":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.AbstractModel","azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.BaseModel":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.BaseModel","azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.InnerModel":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.InnerModel","azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.OuterModel":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.OuterModel","azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.RealModel":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.RealModel","azure.clientgenerator.core.access.sharedmodelinoperation.models.SharedModel":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.SharedModel"},"generatedFiles":["src/main/java/azure/clientgenerator/core/access/AccessClientBuilder.java","src/main/java/azure/clientgenerator/core/access/InternalOperationAsyncClient.java","src/main/java/azure/clientgenerator/core/access/InternalOperationClient.java","src/main/java/azure/clientgenerator/core/access/PublicOperationAsyncClient.java","src/main/java/azure/clientgenerator/core/access/PublicOperationClient.java","src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationAsyncClient.java","src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationClient.java","src/main/java/azure/clientgenerator/core/access/SharedModelInOperationAsyncClient.java","src/main/java/azure/clientgenerator/core/access/SharedModelInOperationClient.java","src/main/java/azure/clientgenerator/core/access/implementation/AccessClientImpl.java","src/main/java/azure/clientgenerator/core/access/implementation/InternalOperationsImpl.java","src/main/java/azure/clientgenerator/core/access/implementation/PublicOperationsImpl.java","src/main/java/azure/clientgenerator/core/access/implementation/RelativeModelInOperationsImpl.java","src/main/java/azure/clientgenerator/core/access/implementation/SharedModelInOperationsImpl.java","src/main/java/azure/clientgenerator/core/access/implementation/package-info.java","src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/InternalDecoratorModelInInternal.java","src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/NoDecoratorModelInInternal.java","src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/package-info.java","src/main/java/azure/clientgenerator/core/access/internaloperation/models/PublicDecoratorModelInInternal.java","src/main/java/azure/clientgenerator/core/access/internaloperation/models/package-info.java","src/main/java/azure/clientgenerator/core/access/package-info.java","src/main/java/azure/clientgenerator/core/access/publicoperation/models/NoDecoratorModelInPublic.java","src/main/java/azure/clientgenerator/core/access/publicoperation/models/PublicDecoratorModelInPublic.java","src/main/java/azure/clientgenerator/core/access/publicoperation/models/package-info.java","src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/AbstractModel.java","src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/BaseModel.java","src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/InnerModel.java","src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/OuterModel.java","src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/RealModel.java","src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/package-info.java","src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/SharedModel.java","src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_apiview_properties.json deleted file mode 100644 index 7c00ee0f7d6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_apiview_properties.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType", - "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getModel": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel", - "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel", - "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getProperty": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty", - "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getPropertyWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty", - "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putModel": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel", - "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel", - "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putProperty": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty", - "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putPropertyWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty", - "azure.clientgenerator.core.alternatetype.AlternateTypeClient": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType", - "azure.clientgenerator.core.alternatetype.AlternateTypeClient.getModel": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel", - "azure.clientgenerator.core.alternatetype.AlternateTypeClient.getModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel", - "azure.clientgenerator.core.alternatetype.AlternateTypeClient.getProperty": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty", - "azure.clientgenerator.core.alternatetype.AlternateTypeClient.getPropertyWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty", - "azure.clientgenerator.core.alternatetype.AlternateTypeClient.putModel": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel", - "azure.clientgenerator.core.alternatetype.AlternateTypeClient.putModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel", - "azure.clientgenerator.core.alternatetype.AlternateTypeClient.putProperty": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty", - "azure.clientgenerator.core.alternatetype.AlternateTypeClient.putPropertyWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty", - "azure.clientgenerator.core.alternatetype.AlternateTypeClientBuilder": "_Specs_.Azure.ClientGenerator.Core.AlternateType", - "azure.clientgenerator.core.alternatetype.externaltype.models.ModelWithFeatureProperty": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.ModelWithFeatureProperty" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_metadata.json deleted file mode 100644 index fb0167e921f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getModel":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getProperty":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getPropertyWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putModel":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putProperty":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putPropertyWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty","azure.clientgenerator.core.alternatetype.AlternateTypeClient":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType","azure.clientgenerator.core.alternatetype.AlternateTypeClient.getModel":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel","azure.clientgenerator.core.alternatetype.AlternateTypeClient.getModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel","azure.clientgenerator.core.alternatetype.AlternateTypeClient.getProperty":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty","azure.clientgenerator.core.alternatetype.AlternateTypeClient.getPropertyWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty","azure.clientgenerator.core.alternatetype.AlternateTypeClient.putModel":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel","azure.clientgenerator.core.alternatetype.AlternateTypeClient.putModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel","azure.clientgenerator.core.alternatetype.AlternateTypeClient.putProperty":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty","azure.clientgenerator.core.alternatetype.AlternateTypeClient.putPropertyWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty","azure.clientgenerator.core.alternatetype.AlternateTypeClientBuilder":"_Specs_.Azure.ClientGenerator.Core.AlternateType","azure.clientgenerator.core.alternatetype.externaltype.models.ModelWithFeatureProperty":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.ModelWithFeatureProperty"},"generatedFiles":["src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeAsyncClient.java","src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClient.java","src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClientBuilder.java","src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/ModelWithFeatureProperty.java","src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/package-info.java","src/main/java/azure/clientgenerator/core/alternatetype/implementation/AlternateTypeClientImpl.java","src/main/java/azure/clientgenerator/core/alternatetype/implementation/ExternalTypesImpl.java","src/main/java/azure/clientgenerator/core/alternatetype/implementation/package-info.java","src/main/java/azure/clientgenerator/core/alternatetype/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_apiview_properties.json deleted file mode 100644 index a8c48566d57..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_apiview_properties.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.apiversion.header.HeaderAsyncClient": "Client.AlternateApiVersion.Service.Header", - "azure.clientgenerator.core.apiversion.header.HeaderAsyncClient.headerApiVersion": "Client.AlternateApiVersion.Service.Header.headerApiVersion", - "azure.clientgenerator.core.apiversion.header.HeaderAsyncClient.headerApiVersionWithResponse": "Client.AlternateApiVersion.Service.Header.headerApiVersion", - "azure.clientgenerator.core.apiversion.header.HeaderClient": "Client.AlternateApiVersion.Service.Header", - "azure.clientgenerator.core.apiversion.header.HeaderClient.headerApiVersion": "Client.AlternateApiVersion.Service.Header.headerApiVersion", - "azure.clientgenerator.core.apiversion.header.HeaderClient.headerApiVersionWithResponse": "Client.AlternateApiVersion.Service.Header.headerApiVersion", - "azure.clientgenerator.core.apiversion.header.HeaderClientBuilder": "Client.AlternateApiVersion.Service.Header" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_metadata.json deleted file mode 100644 index 7fc6eb21f72..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2025-01-01","crossLanguageDefinitions":{"azure.clientgenerator.core.apiversion.header.HeaderAsyncClient":"Client.AlternateApiVersion.Service.Header","azure.clientgenerator.core.apiversion.header.HeaderAsyncClient.headerApiVersion":"Client.AlternateApiVersion.Service.Header.headerApiVersion","azure.clientgenerator.core.apiversion.header.HeaderAsyncClient.headerApiVersionWithResponse":"Client.AlternateApiVersion.Service.Header.headerApiVersion","azure.clientgenerator.core.apiversion.header.HeaderClient":"Client.AlternateApiVersion.Service.Header","azure.clientgenerator.core.apiversion.header.HeaderClient.headerApiVersion":"Client.AlternateApiVersion.Service.Header.headerApiVersion","azure.clientgenerator.core.apiversion.header.HeaderClient.headerApiVersionWithResponse":"Client.AlternateApiVersion.Service.Header.headerApiVersion","azure.clientgenerator.core.apiversion.header.HeaderClientBuilder":"Client.AlternateApiVersion.Service.Header"},"generatedFiles":["src/main/java/azure/clientgenerator/core/apiversion/header/HeaderAsyncClient.java","src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClient.java","src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClientBuilder.java","src/main/java/azure/clientgenerator/core/apiversion/header/HeaderServiceVersion.java","src/main/java/azure/clientgenerator/core/apiversion/header/implementation/HeaderClientImpl.java","src/main/java/azure/clientgenerator/core/apiversion/header/implementation/package-info.java","src/main/java/azure/clientgenerator/core/apiversion/header/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_apiview_properties.json deleted file mode 100644 index 01e17170519..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_apiview_properties.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.apiversion.path.PathAsyncClient": "Client.AlternateApiVersion.Service.Path", - "azure.clientgenerator.core.apiversion.path.PathAsyncClient.pathApiVersion": "Client.AlternateApiVersion.Service.Path.pathApiVersion", - "azure.clientgenerator.core.apiversion.path.PathAsyncClient.pathApiVersionWithResponse": "Client.AlternateApiVersion.Service.Path.pathApiVersion", - "azure.clientgenerator.core.apiversion.path.PathClient": "Client.AlternateApiVersion.Service.Path", - "azure.clientgenerator.core.apiversion.path.PathClient.pathApiVersion": "Client.AlternateApiVersion.Service.Path.pathApiVersion", - "azure.clientgenerator.core.apiversion.path.PathClient.pathApiVersionWithResponse": "Client.AlternateApiVersion.Service.Path.pathApiVersion", - "azure.clientgenerator.core.apiversion.path.PathClientBuilder": "Client.AlternateApiVersion.Service.Path" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_metadata.json deleted file mode 100644 index 48a19a365c1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2025-01-01","crossLanguageDefinitions":{"azure.clientgenerator.core.apiversion.path.PathAsyncClient":"Client.AlternateApiVersion.Service.Path","azure.clientgenerator.core.apiversion.path.PathAsyncClient.pathApiVersion":"Client.AlternateApiVersion.Service.Path.pathApiVersion","azure.clientgenerator.core.apiversion.path.PathAsyncClient.pathApiVersionWithResponse":"Client.AlternateApiVersion.Service.Path.pathApiVersion","azure.clientgenerator.core.apiversion.path.PathClient":"Client.AlternateApiVersion.Service.Path","azure.clientgenerator.core.apiversion.path.PathClient.pathApiVersion":"Client.AlternateApiVersion.Service.Path.pathApiVersion","azure.clientgenerator.core.apiversion.path.PathClient.pathApiVersionWithResponse":"Client.AlternateApiVersion.Service.Path.pathApiVersion","azure.clientgenerator.core.apiversion.path.PathClientBuilder":"Client.AlternateApiVersion.Service.Path"},"generatedFiles":["src/main/java/azure/clientgenerator/core/apiversion/path/PathAsyncClient.java","src/main/java/azure/clientgenerator/core/apiversion/path/PathClient.java","src/main/java/azure/clientgenerator/core/apiversion/path/PathClientBuilder.java","src/main/java/azure/clientgenerator/core/apiversion/path/PathServiceVersion.java","src/main/java/azure/clientgenerator/core/apiversion/path/implementation/PathClientImpl.java","src/main/java/azure/clientgenerator/core/apiversion/path/implementation/package-info.java","src/main/java/azure/clientgenerator/core/apiversion/path/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_apiview_properties.json deleted file mode 100644 index ab6b566870b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_apiview_properties.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.apiversion.query.QueryAsyncClient": "Client.AlternateApiVersion.Service.Query", - "azure.clientgenerator.core.apiversion.query.QueryAsyncClient.queryApiVersion": "Client.AlternateApiVersion.Service.Query.queryApiVersion", - "azure.clientgenerator.core.apiversion.query.QueryAsyncClient.queryApiVersionWithResponse": "Client.AlternateApiVersion.Service.Query.queryApiVersion", - "azure.clientgenerator.core.apiversion.query.QueryClient": "Client.AlternateApiVersion.Service.Query", - "azure.clientgenerator.core.apiversion.query.QueryClient.queryApiVersion": "Client.AlternateApiVersion.Service.Query.queryApiVersion", - "azure.clientgenerator.core.apiversion.query.QueryClient.queryApiVersionWithResponse": "Client.AlternateApiVersion.Service.Query.queryApiVersion", - "azure.clientgenerator.core.apiversion.query.QueryClientBuilder": "Client.AlternateApiVersion.Service.Query" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_metadata.json deleted file mode 100644 index 2f0a64f5572..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2025-01-01","crossLanguageDefinitions":{"azure.clientgenerator.core.apiversion.query.QueryAsyncClient":"Client.AlternateApiVersion.Service.Query","azure.clientgenerator.core.apiversion.query.QueryAsyncClient.queryApiVersion":"Client.AlternateApiVersion.Service.Query.queryApiVersion","azure.clientgenerator.core.apiversion.query.QueryAsyncClient.queryApiVersionWithResponse":"Client.AlternateApiVersion.Service.Query.queryApiVersion","azure.clientgenerator.core.apiversion.query.QueryClient":"Client.AlternateApiVersion.Service.Query","azure.clientgenerator.core.apiversion.query.QueryClient.queryApiVersion":"Client.AlternateApiVersion.Service.Query.queryApiVersion","azure.clientgenerator.core.apiversion.query.QueryClient.queryApiVersionWithResponse":"Client.AlternateApiVersion.Service.Query.queryApiVersion","azure.clientgenerator.core.apiversion.query.QueryClientBuilder":"Client.AlternateApiVersion.Service.Query"},"generatedFiles":["src/main/java/azure/clientgenerator/core/apiversion/query/QueryAsyncClient.java","src/main/java/azure/clientgenerator/core/apiversion/query/QueryClient.java","src/main/java/azure/clientgenerator/core/apiversion/query/QueryClientBuilder.java","src/main/java/azure/clientgenerator/core/apiversion/query/QueryServiceVersion.java","src/main/java/azure/clientgenerator/core/apiversion/query/implementation/QueryClientImpl.java","src/main/java/azure/clientgenerator/core/apiversion/query/implementation/package-info.java","src/main/java/azure/clientgenerator/core/apiversion/query/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_apiview_properties.json deleted file mode 100644 index c7da87b4bf0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_apiview_properties.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam", - "azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withBody": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody", - "azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withBodyWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody", - "azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery", - "azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery", - "azure.clientgenerator.core.clientinitialization.HeaderParamClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam", - "azure.clientgenerator.core.clientinitialization.HeaderParamClient.withBody": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody", - "azure.clientgenerator.core.clientinitialization.HeaderParamClient.withBodyWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody", - "azure.clientgenerator.core.clientinitialization.HeaderParamClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery", - "azure.clientgenerator.core.clientinitialization.HeaderParamClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery", - "azure.clientgenerator.core.clientinitialization.HeaderParamClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam", - "azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams", - "azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withBody": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody", - "azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withBodyWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody", - "azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery", - "azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery", - "azure.clientgenerator.core.clientinitialization.MixedParamsClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams", - "azure.clientgenerator.core.clientinitialization.MixedParamsClient.withBody": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody", - "azure.clientgenerator.core.clientinitialization.MixedParamsClient.withBodyWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody", - "azure.clientgenerator.core.clientinitialization.MixedParamsClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery", - "azure.clientgenerator.core.clientinitialization.MixedParamsClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery", - "azure.clientgenerator.core.clientinitialization.MixedParamsClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams", - "azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams", - "azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withBody": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody", - "azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withBodyWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody", - "azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery", - "azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery", - "azure.clientgenerator.core.clientinitialization.MultipleParamsClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams", - "azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withBody": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody", - "azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withBodyWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody", - "azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery", - "azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery", - "azure.clientgenerator.core.clientinitialization.MultipleParamsClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams", - "azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias", - "azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withAliasedName": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName", - "azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withAliasedNameWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName", - "azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withOriginalName": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName", - "azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withOriginalNameWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName", - "azure.clientgenerator.core.clientinitialization.ParamAliasClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias", - "azure.clientgenerator.core.clientinitialization.ParamAliasClient.withAliasedName": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName", - "azure.clientgenerator.core.clientinitialization.ParamAliasClient.withAliasedNameWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName", - "azure.clientgenerator.core.clientinitialization.ParamAliasClient.withOriginalName": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName", - "azure.clientgenerator.core.clientinitialization.ParamAliasClient.withOriginalNameWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName", - "azure.clientgenerator.core.clientinitialization.ParamAliasClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias", - "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam", - "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.deleteStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone", - "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.deleteStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone", - "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.getStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone", - "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.getStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone", - "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery", - "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery", - "azure.clientgenerator.core.clientinitialization.PathParamClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam", - "azure.clientgenerator.core.clientinitialization.PathParamClient.deleteStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone", - "azure.clientgenerator.core.clientinitialization.PathParamClient.deleteStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone", - "azure.clientgenerator.core.clientinitialization.PathParamClient.getStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone", - "azure.clientgenerator.core.clientinitialization.PathParamClient.getStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone", - "azure.clientgenerator.core.clientinitialization.PathParamClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery", - "azure.clientgenerator.core.clientinitialization.PathParamClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery", - "azure.clientgenerator.core.clientinitialization.PathParamClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam", - "azure.clientgenerator.core.clientinitialization.models.BlobProperties": "Service.BlobProperties", - "azure.clientgenerator.core.clientinitialization.models.Input": "Service.Input", - "azure.clientgenerator.core.clientinitialization.models.WithBodyRequest": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.withBody.Request.anonymous", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.deleteStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.deleteStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.getStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.getStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.deleteStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.deleteStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.getStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.getStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery", - "azure.clientgenerator.core.clientinitialization.parentclient.ChildClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient", - "azure.clientgenerator.core.clientinitialization.parentclient.ParentAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient", - "azure.clientgenerator.core.clientinitialization.parentclient.ParentClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient", - "azure.clientgenerator.core.clientinitialization.parentclient.ParentClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_metadata.json deleted file mode 100644 index 8b2cc8b5ed8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam","azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withBody":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody","azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withBodyWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody","azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery","azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery","azure.clientgenerator.core.clientinitialization.HeaderParamClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam","azure.clientgenerator.core.clientinitialization.HeaderParamClient.withBody":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody","azure.clientgenerator.core.clientinitialization.HeaderParamClient.withBodyWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody","azure.clientgenerator.core.clientinitialization.HeaderParamClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery","azure.clientgenerator.core.clientinitialization.HeaderParamClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery","azure.clientgenerator.core.clientinitialization.HeaderParamClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam","azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams","azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withBody":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody","azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withBodyWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody","azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery","azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery","azure.clientgenerator.core.clientinitialization.MixedParamsClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams","azure.clientgenerator.core.clientinitialization.MixedParamsClient.withBody":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody","azure.clientgenerator.core.clientinitialization.MixedParamsClient.withBodyWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody","azure.clientgenerator.core.clientinitialization.MixedParamsClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery","azure.clientgenerator.core.clientinitialization.MixedParamsClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery","azure.clientgenerator.core.clientinitialization.MixedParamsClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams","azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams","azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withBody":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody","azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withBodyWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody","azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery","azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery","azure.clientgenerator.core.clientinitialization.MultipleParamsClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams","azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withBody":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody","azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withBodyWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody","azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery","azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery","azure.clientgenerator.core.clientinitialization.MultipleParamsClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams","azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias","azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withAliasedName":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName","azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withAliasedNameWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName","azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withOriginalName":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName","azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withOriginalNameWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName","azure.clientgenerator.core.clientinitialization.ParamAliasClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias","azure.clientgenerator.core.clientinitialization.ParamAliasClient.withAliasedName":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName","azure.clientgenerator.core.clientinitialization.ParamAliasClient.withAliasedNameWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName","azure.clientgenerator.core.clientinitialization.ParamAliasClient.withOriginalName":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName","azure.clientgenerator.core.clientinitialization.ParamAliasClient.withOriginalNameWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName","azure.clientgenerator.core.clientinitialization.ParamAliasClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.deleteStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.deleteStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.getStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.getStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery","azure.clientgenerator.core.clientinitialization.PathParamClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam","azure.clientgenerator.core.clientinitialization.PathParamClient.deleteStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone","azure.clientgenerator.core.clientinitialization.PathParamClient.deleteStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone","azure.clientgenerator.core.clientinitialization.PathParamClient.getStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone","azure.clientgenerator.core.clientinitialization.PathParamClient.getStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone","azure.clientgenerator.core.clientinitialization.PathParamClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery","azure.clientgenerator.core.clientinitialization.PathParamClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery","azure.clientgenerator.core.clientinitialization.PathParamClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam","azure.clientgenerator.core.clientinitialization.models.BlobProperties":"Service.BlobProperties","azure.clientgenerator.core.clientinitialization.models.Input":"Service.Input","azure.clientgenerator.core.clientinitialization.models.WithBodyRequest":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.withBody.Request.anonymous","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.deleteStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.deleteStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.getStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.getStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.deleteStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.deleteStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.getStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.getStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery","azure.clientgenerator.core.clientinitialization.parentclient.ChildClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient","azure.clientgenerator.core.clientinitialization.parentclient.ParentAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient","azure.clientgenerator.core.clientinitialization.parentclient.ParentClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient","azure.clientgenerator.core.clientinitialization.parentclient.ParentClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient"},"generatedFiles":["src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/PathParamAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ChildClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/HeaderParamClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MixedParamsClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MultipleParamsClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParamAliasClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParentClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/PathParamClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/package-info.java","src/main/java/azure/clientgenerator/core/clientinitialization/models/BlobProperties.java","src/main/java/azure/clientgenerator/core/clientinitialization/models/Input.java","src/main/java/azure/clientgenerator/core/clientinitialization/models/WithBodyRequest.java","src/main/java/azure/clientgenerator/core/clientinitialization/models/package-info.java","src/main/java/azure/clientgenerator/core/clientinitialization/package-info.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_apiview_properties.json deleted file mode 100644 index 68719194733..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_apiview_properties.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.clientlocation.ArchiveOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation", - "azure.clientgenerator.core.clientlocation.ArchiveOperationsAsyncClient.archiveProduct": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct", - "azure.clientgenerator.core.clientlocation.ArchiveOperationsAsyncClient.archiveProductWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct", - "azure.clientgenerator.core.clientlocation.ArchiveOperationsClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation", - "azure.clientgenerator.core.clientlocation.ArchiveOperationsClient.archiveProduct": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct", - "azure.clientgenerator.core.clientlocation.ArchiveOperationsClient.archiveProductWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct", - "azure.clientgenerator.core.clientlocation.ClientLocationAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation", - "azure.clientgenerator.core.clientlocation.ClientLocationAsyncClient.getHealthStatus": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus", - "azure.clientgenerator.core.clientlocation.ClientLocationAsyncClient.getHealthStatusWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus", - "azure.clientgenerator.core.clientlocation.ClientLocationClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation", - "azure.clientgenerator.core.clientlocation.ClientLocationClient.getHealthStatus": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus", - "azure.clientgenerator.core.clientlocation.ClientLocationClient.getHealthStatusWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus", - "azure.clientgenerator.core.clientlocation.ClientLocationClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientLocation", - "azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations", - "azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsAsyncClient.getBlob": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob", - "azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsAsyncClient.getBlobWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob", - "azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations", - "azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient.getBlob": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob", - "azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient.getBlobWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.deleteUser": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.deleteUserWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.getAdminInfo": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.getAdminInfoWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.deleteUser": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.deleteUserWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.getAdminInfo": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.getAdminInfoWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsAsyncClient.getUser": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsAsyncClient.getUserWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient.getUser": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser", - "azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient.getUserWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser", - "azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations", - "azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsAsyncClient.listProducts": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts", - "azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsAsyncClient.listProductsWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts", - "azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations", - "azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient.listProducts": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts", - "azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient.listProductsWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts", - "azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations", - "azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsAsyncClient.getResource": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource", - "azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsAsyncClient.getResourceWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource", - "azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations", - "azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient.getResource": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource", - "azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient.getResourceWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource", - "azure.clientgenerator.core.clientlocation.movemethodparametertoclient.models.Blob": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.Blob" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_metadata.json deleted file mode 100644 index 18eab65464b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.clientlocation.ArchiveOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation","azure.clientgenerator.core.clientlocation.ArchiveOperationsAsyncClient.archiveProduct":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct","azure.clientgenerator.core.clientlocation.ArchiveOperationsAsyncClient.archiveProductWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct","azure.clientgenerator.core.clientlocation.ArchiveOperationsClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation","azure.clientgenerator.core.clientlocation.ArchiveOperationsClient.archiveProduct":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct","azure.clientgenerator.core.clientlocation.ArchiveOperationsClient.archiveProductWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct","azure.clientgenerator.core.clientlocation.ClientLocationAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation","azure.clientgenerator.core.clientlocation.ClientLocationAsyncClient.getHealthStatus":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus","azure.clientgenerator.core.clientlocation.ClientLocationAsyncClient.getHealthStatusWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus","azure.clientgenerator.core.clientlocation.ClientLocationClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation","azure.clientgenerator.core.clientlocation.ClientLocationClient.getHealthStatus":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus","azure.clientgenerator.core.clientlocation.ClientLocationClient.getHealthStatusWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus","azure.clientgenerator.core.clientlocation.ClientLocationClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientLocation","azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations","azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsAsyncClient.getBlob":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob","azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsAsyncClient.getBlobWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob","azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations","azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient.getBlob":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob","azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient.getBlobWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.deleteUser":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.deleteUserWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.getAdminInfo":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.getAdminInfoWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.deleteUser":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.deleteUserWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.getAdminInfo":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.getAdminInfoWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo","azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations","azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsAsyncClient.getUser":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsAsyncClient.getUserWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations","azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient.getUser":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient.getUserWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser","azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations","azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsAsyncClient.listProducts":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts","azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsAsyncClient.listProductsWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts","azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations","azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient.listProducts":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts","azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient.listProductsWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts","azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations","azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsAsyncClient.getResource":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource","azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsAsyncClient.getResourceWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource","azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations","azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient.getResource":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource","azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient.getResourceWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource","azure.clientgenerator.core.clientlocation.movemethodparametertoclient.models.Blob":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.Blob"},"generatedFiles":["src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsClient.java","src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClient.java","src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClientBuilder.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsClient.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/ArchiveOperationsImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/ClientLocationClientImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveMethodParameterToBlobOperationsImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubAdminOperationsImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubUserOperationsImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToNewSubProductOperationsImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToRootResourceOperationsImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/package-info.java","src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/Blob.java","src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/package-info.java","src/main/java/azure/clientgenerator/core/clientlocation/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_apiview_properties.json deleted file mode 100644 index 7b58226868c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_apiview_properties.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullAsyncClient": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull", - "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullAsyncClient.get": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get", - "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullAsyncClient.getWithResponse": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get", - "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull", - "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient.get": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get", - "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient.getWithResponse": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get", - "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClientBuilder": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull", - "azure.clientgenerator.core.deserialize.emptystringnull.models.ResponseModel": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.ResponseModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_metadata.json deleted file mode 100644 index b584ce2c196..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullAsyncClient":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull","azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullAsyncClient.get":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get","azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullAsyncClient.getWithResponse":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get","azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull","azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient.get":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get","azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient.getWithResponse":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get","azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClientBuilder":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull","azure.clientgenerator.core.deserialize.emptystringnull.models.ResponseModel":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.ResponseModel"},"generatedFiles":["src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullAsyncClient.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClient.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClientBuilder.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/DeserializeEmptyStringAsNullClientImpl.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/package-info.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/ResponseModel.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/package-info.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_apiview_properties.json deleted file mode 100644 index b62a2cbecf0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_apiview_properties.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty", - "azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel", - "azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putFlattenModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel", - "azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putNestedFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel", - "azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putNestedFlattenModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel", - "azure.clientgenerator.core.flattenproperty.FlattenPropertyClient": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty", - "azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel", - "azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putFlattenModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel", - "azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putNestedFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel", - "azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putNestedFlattenModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel", - "azure.clientgenerator.core.flattenproperty.FlattenPropertyClientBuilder": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty", - "azure.clientgenerator.core.flattenproperty.models.ChildFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.ChildFlattenModel", - "azure.clientgenerator.core.flattenproperty.models.ChildModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.ChildModel", - "azure.clientgenerator.core.flattenproperty.models.FlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.FlattenModel", - "azure.clientgenerator.core.flattenproperty.models.NestedFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.NestedFlattenModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_metadata.json deleted file mode 100644 index 91781c5335f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty","azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putFlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putFlattenModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putNestedFlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putNestedFlattenModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyClient":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty","azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putFlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putFlattenModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putNestedFlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putNestedFlattenModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyClientBuilder":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty","azure.clientgenerator.core.flattenproperty.models.ChildFlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.ChildFlattenModel","azure.clientgenerator.core.flattenproperty.models.ChildModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.ChildModel","azure.clientgenerator.core.flattenproperty.models.FlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.FlattenModel","azure.clientgenerator.core.flattenproperty.models.NestedFlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.NestedFlattenModel"},"generatedFiles":["src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyAsyncClient.java","src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClient.java","src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClientBuilder.java","src/main/java/azure/clientgenerator/core/flattenproperty/implementation/FlattenPropertyClientImpl.java","src/main/java/azure/clientgenerator/core/flattenproperty/implementation/package-info.java","src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildFlattenModel.java","src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildModel.java","src/main/java/azure/clientgenerator/core/flattenproperty/models/FlattenModel.java","src/main/java/azure/clientgenerator/core/flattenproperty/models/NestedFlattenModel.java","src/main/java/azure/clientgenerator/core/flattenproperty/models/package-info.java","src/main/java/azure/clientgenerator/core/flattenproperty/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_apiview_properties.json deleted file mode 100644 index eb9b9c02053..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_apiview_properties.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations", - "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updateDogAsAnimal": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal", - "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updateDogAsAnimalWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal", - "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updatePetAsAnimal": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal", - "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updatePetAsAnimalWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal", - "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations", - "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updateDogAsAnimal": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal", - "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updateDogAsAnimalWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal", - "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updatePetAsAnimal": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal", - "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updatePetAsAnimalWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal", - "azure.clientgenerator.core.hierarchybuilding.DogOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations", - "azure.clientgenerator.core.hierarchybuilding.DogOperationsAsyncClient.updateDogAsDog": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog", - "azure.clientgenerator.core.hierarchybuilding.DogOperationsAsyncClient.updateDogAsDogWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog", - "azure.clientgenerator.core.hierarchybuilding.DogOperationsClient": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations", - "azure.clientgenerator.core.hierarchybuilding.DogOperationsClient.updateDogAsDog": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog", - "azure.clientgenerator.core.hierarchybuilding.DogOperationsClient.updateDogAsDogWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog", - "azure.clientgenerator.core.hierarchybuilding.HierarchyBuildingClientBuilder": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding", - "azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations", - "azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updateDogAsPet": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet", - "azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updateDogAsPetWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet", - "azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updatePetAsPet": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet", - "azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updatePetAsPetWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet", - "azure.clientgenerator.core.hierarchybuilding.PetOperationsClient": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations", - "azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updateDogAsPet": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet", - "azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updateDogAsPetWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet", - "azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updatePetAsPet": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet", - "azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updatePetAsPetWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet", - "azure.clientgenerator.core.hierarchybuilding.models.Animal": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.Animal", - "azure.clientgenerator.core.hierarchybuilding.models.Dog": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.Dog", - "azure.clientgenerator.core.hierarchybuilding.models.Pet": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.Pet" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_metadata.json deleted file mode 100644 index 495d8219de7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updateDogAsAnimal":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updateDogAsAnimalWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updatePetAsAnimal":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updatePetAsAnimalWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updateDogAsAnimal":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updateDogAsAnimalWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updatePetAsAnimal":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updatePetAsAnimalWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal","azure.clientgenerator.core.hierarchybuilding.DogOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations","azure.clientgenerator.core.hierarchybuilding.DogOperationsAsyncClient.updateDogAsDog":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog","azure.clientgenerator.core.hierarchybuilding.DogOperationsAsyncClient.updateDogAsDogWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog","azure.clientgenerator.core.hierarchybuilding.DogOperationsClient":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations","azure.clientgenerator.core.hierarchybuilding.DogOperationsClient.updateDogAsDog":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog","azure.clientgenerator.core.hierarchybuilding.DogOperationsClient.updateDogAsDogWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog","azure.clientgenerator.core.hierarchybuilding.HierarchyBuildingClientBuilder":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding","azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations","azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updateDogAsPet":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updateDogAsPetWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updatePetAsPet":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updatePetAsPetWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsClient":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations","azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updateDogAsPet":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updateDogAsPetWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updatePetAsPet":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updatePetAsPetWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet","azure.clientgenerator.core.hierarchybuilding.models.Animal":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.Animal","azure.clientgenerator.core.hierarchybuilding.models.Dog":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.Dog","azure.clientgenerator.core.hierarchybuilding.models.Pet":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.Pet"},"generatedFiles":["src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsClient.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsClient.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/HierarchyBuildingClientBuilder.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsClient.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/AnimalOperationsImpl.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/DogOperationsImpl.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/HierarchyBuildingClientImpl.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/PetOperationsImpl.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/package-info.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Animal.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Dog.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Pet.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/models/package-info.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_apiview_properties.json deleted file mode 100644 index e731f5daf59..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_apiview_properties.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.methodoverride.GroupParametersAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters", - "azure.clientgenerator.core.methodoverride.GroupParametersAsyncClient.group": "_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group", - "azure.clientgenerator.core.methodoverride.GroupParametersAsyncClient.groupWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group", - "azure.clientgenerator.core.methodoverride.GroupParametersClient": "_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters", - "azure.clientgenerator.core.methodoverride.GroupParametersClient.group": "_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group", - "azure.clientgenerator.core.methodoverride.GroupParametersClient.groupWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group", - "azure.clientgenerator.core.methodoverride.OverrideClientBuilder": "_Specs_.Azure.ClientGenerator.Core.Override", - "azure.clientgenerator.core.methodoverride.RemoveOptionalParameterAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter", - "azure.clientgenerator.core.methodoverride.RemoveOptionalParameterAsyncClient.removeOptional": "_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional", - "azure.clientgenerator.core.methodoverride.RemoveOptionalParameterAsyncClient.removeOptionalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional", - "azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient": "_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter", - "azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient.removeOptional": "_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional", - "azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient.removeOptionalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional", - "azure.clientgenerator.core.methodoverride.ReorderParametersAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters", - "azure.clientgenerator.core.methodoverride.ReorderParametersAsyncClient.reorder": "_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder", - "azure.clientgenerator.core.methodoverride.ReorderParametersAsyncClient.reorderWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder", - "azure.clientgenerator.core.methodoverride.ReorderParametersClient": "_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters", - "azure.clientgenerator.core.methodoverride.ReorderParametersClient.reorder": "_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder", - "azure.clientgenerator.core.methodoverride.ReorderParametersClient.reorderWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder", - "azure.clientgenerator.core.methodoverride.RequireOptionalParameterAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter", - "azure.clientgenerator.core.methodoverride.RequireOptionalParameterAsyncClient.requireOptional": "_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional", - "azure.clientgenerator.core.methodoverride.RequireOptionalParameterAsyncClient.requireOptionalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional", - "azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient": "_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter", - "azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient.requireOptional": "_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional", - "azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient.requireOptionalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional", - "azure.clientgenerator.core.methodoverride.models.GroupParametersOptions": null - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_metadata.json deleted file mode 100644 index d57f5228241..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.methodoverride.GroupParametersAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters","azure.clientgenerator.core.methodoverride.GroupParametersAsyncClient.group":"_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group","azure.clientgenerator.core.methodoverride.GroupParametersAsyncClient.groupWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group","azure.clientgenerator.core.methodoverride.GroupParametersClient":"_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters","azure.clientgenerator.core.methodoverride.GroupParametersClient.group":"_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group","azure.clientgenerator.core.methodoverride.GroupParametersClient.groupWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group","azure.clientgenerator.core.methodoverride.OverrideClientBuilder":"_Specs_.Azure.ClientGenerator.Core.Override","azure.clientgenerator.core.methodoverride.RemoveOptionalParameterAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter","azure.clientgenerator.core.methodoverride.RemoveOptionalParameterAsyncClient.removeOptional":"_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional","azure.clientgenerator.core.methodoverride.RemoveOptionalParameterAsyncClient.removeOptionalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional","azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient":"_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter","azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient.removeOptional":"_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional","azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient.removeOptionalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional","azure.clientgenerator.core.methodoverride.ReorderParametersAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters","azure.clientgenerator.core.methodoverride.ReorderParametersAsyncClient.reorder":"_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder","azure.clientgenerator.core.methodoverride.ReorderParametersAsyncClient.reorderWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder","azure.clientgenerator.core.methodoverride.ReorderParametersClient":"_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters","azure.clientgenerator.core.methodoverride.ReorderParametersClient.reorder":"_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder","azure.clientgenerator.core.methodoverride.ReorderParametersClient.reorderWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder","azure.clientgenerator.core.methodoverride.RequireOptionalParameterAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter","azure.clientgenerator.core.methodoverride.RequireOptionalParameterAsyncClient.requireOptional":"_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional","azure.clientgenerator.core.methodoverride.RequireOptionalParameterAsyncClient.requireOptionalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional","azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient":"_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter","azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient.requireOptional":"_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional","azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient.requireOptionalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional","azure.clientgenerator.core.methodoverride.models.GroupParametersOptions":null},"generatedFiles":["src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java","src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java","src/main/java/azure/clientgenerator/core/methodoverride/OverrideClientBuilder.java","src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterAsyncClient.java","src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterClient.java","src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersAsyncClient.java","src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersClient.java","src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterAsyncClient.java","src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterClient.java","src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java","src/main/java/azure/clientgenerator/core/methodoverride/implementation/OverrideClientImpl.java","src/main/java/azure/clientgenerator/core/methodoverride/implementation/RemoveOptionalParametersImpl.java","src/main/java/azure/clientgenerator/core/methodoverride/implementation/ReorderParametersImpl.java","src/main/java/azure/clientgenerator/core/methodoverride/implementation/RequireOptionalParametersImpl.java","src/main/java/azure/clientgenerator/core/methodoverride/implementation/package-info.java","src/main/java/azure/clientgenerator/core/methodoverride/models/GroupParametersOptions.java","src/main/java/azure/clientgenerator/core/methodoverride/models/package-info.java","src/main/java/azure/clientgenerator/core/methodoverride/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_apiview_properties.json deleted file mode 100644 index c07cf51fbfc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_apiview_properties.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.nextlinkverb.NextLinkVerbAsyncClient": "_Specs_.Azure.ClientGenerator.Core.NextLinkVerb", - "azure.clientgenerator.core.nextlinkverb.NextLinkVerbAsyncClient.listItems": "_Specs_.Azure.ClientGenerator.Core.NextLinkVerb.listItems", - "azure.clientgenerator.core.nextlinkverb.NextLinkVerbClient": "_Specs_.Azure.ClientGenerator.Core.NextLinkVerb", - "azure.clientgenerator.core.nextlinkverb.NextLinkVerbClient.listItems": "_Specs_.Azure.ClientGenerator.Core.NextLinkVerb.listItems", - "azure.clientgenerator.core.nextlinkverb.NextLinkVerbClientBuilder": "_Specs_.Azure.ClientGenerator.Core.NextLinkVerb", - "azure.clientgenerator.core.nextlinkverb.models.Test": "_Specs_.Azure.ClientGenerator.Core.NextLinkVerb.Test" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_metadata.json deleted file mode 100644 index 052cd7c74fe..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.nextlinkverb.NextLinkVerbAsyncClient":"_Specs_.Azure.ClientGenerator.Core.NextLinkVerb","azure.clientgenerator.core.nextlinkverb.NextLinkVerbAsyncClient.listItems":"_Specs_.Azure.ClientGenerator.Core.NextLinkVerb.listItems","azure.clientgenerator.core.nextlinkverb.NextLinkVerbClient":"_Specs_.Azure.ClientGenerator.Core.NextLinkVerb","azure.clientgenerator.core.nextlinkverb.NextLinkVerbClient.listItems":"_Specs_.Azure.ClientGenerator.Core.NextLinkVerb.listItems","azure.clientgenerator.core.nextlinkverb.NextLinkVerbClientBuilder":"_Specs_.Azure.ClientGenerator.Core.NextLinkVerb","azure.clientgenerator.core.nextlinkverb.models.Test":"_Specs_.Azure.ClientGenerator.Core.NextLinkVerb.Test"},"generatedFiles":["src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbAsyncClient.java","src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClient.java","src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClientBuilder.java","src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/NextLinkVerbClientImpl.java","src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/package-info.java","src/main/java/azure/clientgenerator/core/nextlinkverb/models/Test.java","src/main/java/azure/clientgenerator/core/nextlinkverb/models/package-info.java","src/main/java/azure/clientgenerator/core/nextlinkverb/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_apiview_properties.json deleted file mode 100644 index 0fc1637b80a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_apiview_properties.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.clientgenerator.core.usage.UsageAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation", - "azure.clientgenerator.core.usage.UsageAsyncClient.inputToInputOutput": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput", - "azure.clientgenerator.core.usage.UsageAsyncClient.inputToInputOutputWithResponse": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput", - "azure.clientgenerator.core.usage.UsageAsyncClient.modelInReadOnlyProperty": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty", - "azure.clientgenerator.core.usage.UsageAsyncClient.modelInReadOnlyPropertyWithResponse": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty", - "azure.clientgenerator.core.usage.UsageAsyncClient.outputToInputOutput": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput", - "azure.clientgenerator.core.usage.UsageAsyncClient.outputToInputOutputWithResponse": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput", - "azure.clientgenerator.core.usage.UsageClient": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation", - "azure.clientgenerator.core.usage.UsageClient.inputToInputOutput": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput", - "azure.clientgenerator.core.usage.UsageClient.inputToInputOutputWithResponse": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput", - "azure.clientgenerator.core.usage.UsageClient.modelInReadOnlyProperty": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty", - "azure.clientgenerator.core.usage.UsageClient.modelInReadOnlyPropertyWithResponse": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty", - "azure.clientgenerator.core.usage.UsageClient.outputToInputOutput": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput", - "azure.clientgenerator.core.usage.UsageClient.outputToInputOutputWithResponse": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput", - "azure.clientgenerator.core.usage.UsageClientBuilder": "_Specs_.Azure.ClientGenerator.Core.Usage", - "azure.clientgenerator.core.usage.models.InputModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.InputModel", - "azure.clientgenerator.core.usage.models.OrphanModel": "_Specs_.Azure.ClientGenerator.Core.Usage.OrphanModel", - "azure.clientgenerator.core.usage.models.OutputModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.OutputModel", - "azure.clientgenerator.core.usage.models.ResultModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.ResultModel", - "azure.clientgenerator.core.usage.models.RoundTripModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.RoundTripModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_metadata.json deleted file mode 100644 index 8b43ddbb1ba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.usage.UsageAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation","azure.clientgenerator.core.usage.UsageAsyncClient.inputToInputOutput":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput","azure.clientgenerator.core.usage.UsageAsyncClient.inputToInputOutputWithResponse":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput","azure.clientgenerator.core.usage.UsageAsyncClient.modelInReadOnlyProperty":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty","azure.clientgenerator.core.usage.UsageAsyncClient.modelInReadOnlyPropertyWithResponse":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty","azure.clientgenerator.core.usage.UsageAsyncClient.outputToInputOutput":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput","azure.clientgenerator.core.usage.UsageAsyncClient.outputToInputOutputWithResponse":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput","azure.clientgenerator.core.usage.UsageClient":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation","azure.clientgenerator.core.usage.UsageClient.inputToInputOutput":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput","azure.clientgenerator.core.usage.UsageClient.inputToInputOutputWithResponse":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput","azure.clientgenerator.core.usage.UsageClient.modelInReadOnlyProperty":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty","azure.clientgenerator.core.usage.UsageClient.modelInReadOnlyPropertyWithResponse":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty","azure.clientgenerator.core.usage.UsageClient.outputToInputOutput":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput","azure.clientgenerator.core.usage.UsageClient.outputToInputOutputWithResponse":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput","azure.clientgenerator.core.usage.UsageClientBuilder":"_Specs_.Azure.ClientGenerator.Core.Usage","azure.clientgenerator.core.usage.models.InputModel":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.InputModel","azure.clientgenerator.core.usage.models.OrphanModel":"_Specs_.Azure.ClientGenerator.Core.Usage.OrphanModel","azure.clientgenerator.core.usage.models.OutputModel":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.OutputModel","azure.clientgenerator.core.usage.models.ResultModel":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.ResultModel","azure.clientgenerator.core.usage.models.RoundTripModel":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.RoundTripModel"},"generatedFiles":["src/main/java/azure/clientgenerator/core/usage/UsageAsyncClient.java","src/main/java/azure/clientgenerator/core/usage/UsageClient.java","src/main/java/azure/clientgenerator/core/usage/UsageClientBuilder.java","src/main/java/azure/clientgenerator/core/usage/implementation/ModelInOperationsImpl.java","src/main/java/azure/clientgenerator/core/usage/implementation/UsageClientImpl.java","src/main/java/azure/clientgenerator/core/usage/implementation/package-info.java","src/main/java/azure/clientgenerator/core/usage/models/InputModel.java","src/main/java/azure/clientgenerator/core/usage/models/OrphanModel.java","src/main/java/azure/clientgenerator/core/usage/models/OutputModel.java","src/main/java/azure/clientgenerator/core/usage/models/ResultModel.java","src/main/java/azure/clientgenerator/core/usage/models/RoundTripModel.java","src/main/java/azure/clientgenerator/core/usage/models/package-info.java","src/main/java/azure/clientgenerator/core/usage/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_apiview_properties.json deleted file mode 100644 index 6adeef17226..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_apiview_properties.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.core.basic.BasicAsyncClient": "_Specs_.Azure.Core.Basic", - "azure.core.basic.BasicAsyncClient.createOrReplace": "_Specs_.Azure.Core.Basic.createOrReplace", - "azure.core.basic.BasicAsyncClient.createOrReplaceWithResponse": "_Specs_.Azure.Core.Basic.createOrReplace", - "azure.core.basic.BasicAsyncClient.createOrUpdate": "_Specs_.Azure.Core.Basic.createOrUpdate", - "azure.core.basic.BasicAsyncClient.createOrUpdateWithResponse": "_Specs_.Azure.Core.Basic.createOrUpdate", - "azure.core.basic.BasicAsyncClient.delete": "_Specs_.Azure.Core.Basic.delete", - "azure.core.basic.BasicAsyncClient.deleteWithResponse": "_Specs_.Azure.Core.Basic.delete", - "azure.core.basic.BasicAsyncClient.export": "_Specs_.Azure.Core.Basic.export", - "azure.core.basic.BasicAsyncClient.exportAllUsers": "_Specs_.Azure.Core.Basic.exportAllUsers", - "azure.core.basic.BasicAsyncClient.exportAllUsersWithResponse": "_Specs_.Azure.Core.Basic.exportAllUsers", - "azure.core.basic.BasicAsyncClient.exportWithResponse": "_Specs_.Azure.Core.Basic.export", - "azure.core.basic.BasicAsyncClient.get": "_Specs_.Azure.Core.Basic.get", - "azure.core.basic.BasicAsyncClient.getWithResponse": "_Specs_.Azure.Core.Basic.get", - "azure.core.basic.BasicAsyncClient.list": "_Specs_.Azure.Core.Basic.list", - "azure.core.basic.BasicClient": "_Specs_.Azure.Core.Basic", - "azure.core.basic.BasicClient.createOrReplace": "_Specs_.Azure.Core.Basic.createOrReplace", - "azure.core.basic.BasicClient.createOrReplaceWithResponse": "_Specs_.Azure.Core.Basic.createOrReplace", - "azure.core.basic.BasicClient.createOrUpdate": "_Specs_.Azure.Core.Basic.createOrUpdate", - "azure.core.basic.BasicClient.createOrUpdateWithResponse": "_Specs_.Azure.Core.Basic.createOrUpdate", - "azure.core.basic.BasicClient.delete": "_Specs_.Azure.Core.Basic.delete", - "azure.core.basic.BasicClient.deleteWithResponse": "_Specs_.Azure.Core.Basic.delete", - "azure.core.basic.BasicClient.export": "_Specs_.Azure.Core.Basic.export", - "azure.core.basic.BasicClient.exportAllUsers": "_Specs_.Azure.Core.Basic.exportAllUsers", - "azure.core.basic.BasicClient.exportAllUsersWithResponse": "_Specs_.Azure.Core.Basic.exportAllUsers", - "azure.core.basic.BasicClient.exportWithResponse": "_Specs_.Azure.Core.Basic.export", - "azure.core.basic.BasicClient.get": "_Specs_.Azure.Core.Basic.get", - "azure.core.basic.BasicClient.getWithResponse": "_Specs_.Azure.Core.Basic.get", - "azure.core.basic.BasicClient.list": "_Specs_.Azure.Core.Basic.list", - "azure.core.basic.BasicClientBuilder": "_Specs_.Azure.Core.Basic", - "azure.core.basic.models.User": "_Specs_.Azure.Core.Basic.User", - "azure.core.basic.models.UserList": "_Specs_.Azure.Core.Basic.UserList", - "azure.core.basic.models.UserOrder": "_Specs_.Azure.Core.Basic.UserOrder" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_metadata.json deleted file mode 100644 index af3ee916621..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.basic.BasicAsyncClient":"_Specs_.Azure.Core.Basic","azure.core.basic.BasicAsyncClient.createOrReplace":"_Specs_.Azure.Core.Basic.createOrReplace","azure.core.basic.BasicAsyncClient.createOrReplaceWithResponse":"_Specs_.Azure.Core.Basic.createOrReplace","azure.core.basic.BasicAsyncClient.createOrUpdate":"_Specs_.Azure.Core.Basic.createOrUpdate","azure.core.basic.BasicAsyncClient.createOrUpdateWithResponse":"_Specs_.Azure.Core.Basic.createOrUpdate","azure.core.basic.BasicAsyncClient.delete":"_Specs_.Azure.Core.Basic.delete","azure.core.basic.BasicAsyncClient.deleteWithResponse":"_Specs_.Azure.Core.Basic.delete","azure.core.basic.BasicAsyncClient.export":"_Specs_.Azure.Core.Basic.export","azure.core.basic.BasicAsyncClient.exportAllUsers":"_Specs_.Azure.Core.Basic.exportAllUsers","azure.core.basic.BasicAsyncClient.exportAllUsersWithResponse":"_Specs_.Azure.Core.Basic.exportAllUsers","azure.core.basic.BasicAsyncClient.exportWithResponse":"_Specs_.Azure.Core.Basic.export","azure.core.basic.BasicAsyncClient.get":"_Specs_.Azure.Core.Basic.get","azure.core.basic.BasicAsyncClient.getWithResponse":"_Specs_.Azure.Core.Basic.get","azure.core.basic.BasicAsyncClient.list":"_Specs_.Azure.Core.Basic.list","azure.core.basic.BasicClient":"_Specs_.Azure.Core.Basic","azure.core.basic.BasicClient.createOrReplace":"_Specs_.Azure.Core.Basic.createOrReplace","azure.core.basic.BasicClient.createOrReplaceWithResponse":"_Specs_.Azure.Core.Basic.createOrReplace","azure.core.basic.BasicClient.createOrUpdate":"_Specs_.Azure.Core.Basic.createOrUpdate","azure.core.basic.BasicClient.createOrUpdateWithResponse":"_Specs_.Azure.Core.Basic.createOrUpdate","azure.core.basic.BasicClient.delete":"_Specs_.Azure.Core.Basic.delete","azure.core.basic.BasicClient.deleteWithResponse":"_Specs_.Azure.Core.Basic.delete","azure.core.basic.BasicClient.export":"_Specs_.Azure.Core.Basic.export","azure.core.basic.BasicClient.exportAllUsers":"_Specs_.Azure.Core.Basic.exportAllUsers","azure.core.basic.BasicClient.exportAllUsersWithResponse":"_Specs_.Azure.Core.Basic.exportAllUsers","azure.core.basic.BasicClient.exportWithResponse":"_Specs_.Azure.Core.Basic.export","azure.core.basic.BasicClient.get":"_Specs_.Azure.Core.Basic.get","azure.core.basic.BasicClient.getWithResponse":"_Specs_.Azure.Core.Basic.get","azure.core.basic.BasicClient.list":"_Specs_.Azure.Core.Basic.list","azure.core.basic.BasicClientBuilder":"_Specs_.Azure.Core.Basic","azure.core.basic.models.User":"_Specs_.Azure.Core.Basic.User","azure.core.basic.models.UserList":"_Specs_.Azure.Core.Basic.UserList","azure.core.basic.models.UserOrder":"_Specs_.Azure.Core.Basic.UserOrder"},"generatedFiles":["src/main/java/azure/core/basic/BasicAsyncClient.java","src/main/java/azure/core/basic/BasicClient.java","src/main/java/azure/core/basic/BasicClientBuilder.java","src/main/java/azure/core/basic/BasicServiceVersion.java","src/main/java/azure/core/basic/implementation/BasicClientImpl.java","src/main/java/azure/core/basic/implementation/JsonMergePatchHelper.java","src/main/java/azure/core/basic/implementation/package-info.java","src/main/java/azure/core/basic/models/User.java","src/main/java/azure/core/basic/models/UserList.java","src/main/java/azure/core/basic/models/UserOrder.java","src/main/java/azure/core/basic/models/package-info.java","src/main/java/azure/core/basic/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_apiview_properties.json deleted file mode 100644 index 2f41d55d8dc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_apiview_properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.core.lro.rpc.RpcAsyncClient": "_Specs_.Azure.Core.Lro.Rpc", - "azure.core.lro.rpc.RpcAsyncClient.beginLongRunningRpc": "_Specs_.Azure.Core.Lro.Rpc.longRunningRpc", - "azure.core.lro.rpc.RpcAsyncClient.beginLongRunningRpcWithModel": "_Specs_.Azure.Core.Lro.Rpc.longRunningRpc", - "azure.core.lro.rpc.RpcClient": "_Specs_.Azure.Core.Lro.Rpc", - "azure.core.lro.rpc.RpcClient.beginLongRunningRpc": "_Specs_.Azure.Core.Lro.Rpc.longRunningRpc", - "azure.core.lro.rpc.RpcClient.beginLongRunningRpcWithModel": "_Specs_.Azure.Core.Lro.Rpc.longRunningRpc", - "azure.core.lro.rpc.RpcClientBuilder": "_Specs_.Azure.Core.Lro.Rpc", - "azure.core.lro.rpc.models.GenerationOptions": "_Specs_.Azure.Core.Lro.Rpc.GenerationOptions", - "azure.core.lro.rpc.models.GenerationResult": "_Specs_.Azure.Core.Lro.Rpc.GenerationResult" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_metadata.json deleted file mode 100644 index 779d36e24f7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.lro.rpc.RpcAsyncClient":"_Specs_.Azure.Core.Lro.Rpc","azure.core.lro.rpc.RpcAsyncClient.beginLongRunningRpc":"_Specs_.Azure.Core.Lro.Rpc.longRunningRpc","azure.core.lro.rpc.RpcAsyncClient.beginLongRunningRpcWithModel":"_Specs_.Azure.Core.Lro.Rpc.longRunningRpc","azure.core.lro.rpc.RpcClient":"_Specs_.Azure.Core.Lro.Rpc","azure.core.lro.rpc.RpcClient.beginLongRunningRpc":"_Specs_.Azure.Core.Lro.Rpc.longRunningRpc","azure.core.lro.rpc.RpcClient.beginLongRunningRpcWithModel":"_Specs_.Azure.Core.Lro.Rpc.longRunningRpc","azure.core.lro.rpc.RpcClientBuilder":"_Specs_.Azure.Core.Lro.Rpc","azure.core.lro.rpc.models.GenerationOptions":"_Specs_.Azure.Core.Lro.Rpc.GenerationOptions","azure.core.lro.rpc.models.GenerationResult":"_Specs_.Azure.Core.Lro.Rpc.GenerationResult"},"generatedFiles":["src/main/java/azure/core/lro/rpc/RpcAsyncClient.java","src/main/java/azure/core/lro/rpc/RpcClient.java","src/main/java/azure/core/lro/rpc/RpcClientBuilder.java","src/main/java/azure/core/lro/rpc/RpcServiceVersion.java","src/main/java/azure/core/lro/rpc/implementation/OperationLocationPollingStrategy.java","src/main/java/azure/core/lro/rpc/implementation/PollingUtils.java","src/main/java/azure/core/lro/rpc/implementation/RpcClientImpl.java","src/main/java/azure/core/lro/rpc/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/azure/core/lro/rpc/implementation/package-info.java","src/main/java/azure/core/lro/rpc/models/GenerationOptions.java","src/main/java/azure/core/lro/rpc/models/GenerationResult.java","src/main/java/azure/core/lro/rpc/models/package-info.java","src/main/java/azure/core/lro/rpc/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_apiview_properties.json deleted file mode 100644 index f595608fbe1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_apiview_properties.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.core.lro.standard.StandardAsyncClient": "_Specs_.Azure.Core.Lro.Standard", - "azure.core.lro.standard.StandardAsyncClient.beginCreateOrReplace": "_Specs_.Azure.Core.Lro.Standard.createOrReplace", - "azure.core.lro.standard.StandardAsyncClient.beginCreateOrReplaceWithModel": "_Specs_.Azure.Core.Lro.Standard.createOrReplace", - "azure.core.lro.standard.StandardAsyncClient.beginDelete": "_Specs_.Azure.Core.Lro.Standard.delete", - "azure.core.lro.standard.StandardAsyncClient.beginDeleteWithModel": "_Specs_.Azure.Core.Lro.Standard.delete", - "azure.core.lro.standard.StandardAsyncClient.beginExport": "_Specs_.Azure.Core.Lro.Standard.export", - "azure.core.lro.standard.StandardAsyncClient.beginExportWithModel": "_Specs_.Azure.Core.Lro.Standard.export", - "azure.core.lro.standard.StandardClient": "_Specs_.Azure.Core.Lro.Standard", - "azure.core.lro.standard.StandardClient.beginCreateOrReplace": "_Specs_.Azure.Core.Lro.Standard.createOrReplace", - "azure.core.lro.standard.StandardClient.beginCreateOrReplaceWithModel": "_Specs_.Azure.Core.Lro.Standard.createOrReplace", - "azure.core.lro.standard.StandardClient.beginDelete": "_Specs_.Azure.Core.Lro.Standard.delete", - "azure.core.lro.standard.StandardClient.beginDeleteWithModel": "_Specs_.Azure.Core.Lro.Standard.delete", - "azure.core.lro.standard.StandardClient.beginExport": "_Specs_.Azure.Core.Lro.Standard.export", - "azure.core.lro.standard.StandardClient.beginExportWithModel": "_Specs_.Azure.Core.Lro.Standard.export", - "azure.core.lro.standard.StandardClientBuilder": "_Specs_.Azure.Core.Lro.Standard", - "azure.core.lro.standard.models.ExportedUser": "_Specs_.Azure.Core.Lro.Standard.ExportedUser", - "azure.core.lro.standard.models.User": "_Specs_.Azure.Core.Lro.Standard.User" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_metadata.json deleted file mode 100644 index e826d2e20c1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.lro.standard.StandardAsyncClient":"_Specs_.Azure.Core.Lro.Standard","azure.core.lro.standard.StandardAsyncClient.beginCreateOrReplace":"_Specs_.Azure.Core.Lro.Standard.createOrReplace","azure.core.lro.standard.StandardAsyncClient.beginCreateOrReplaceWithModel":"_Specs_.Azure.Core.Lro.Standard.createOrReplace","azure.core.lro.standard.StandardAsyncClient.beginDelete":"_Specs_.Azure.Core.Lro.Standard.delete","azure.core.lro.standard.StandardAsyncClient.beginDeleteWithModel":"_Specs_.Azure.Core.Lro.Standard.delete","azure.core.lro.standard.StandardAsyncClient.beginExport":"_Specs_.Azure.Core.Lro.Standard.export","azure.core.lro.standard.StandardAsyncClient.beginExportWithModel":"_Specs_.Azure.Core.Lro.Standard.export","azure.core.lro.standard.StandardClient":"_Specs_.Azure.Core.Lro.Standard","azure.core.lro.standard.StandardClient.beginCreateOrReplace":"_Specs_.Azure.Core.Lro.Standard.createOrReplace","azure.core.lro.standard.StandardClient.beginCreateOrReplaceWithModel":"_Specs_.Azure.Core.Lro.Standard.createOrReplace","azure.core.lro.standard.StandardClient.beginDelete":"_Specs_.Azure.Core.Lro.Standard.delete","azure.core.lro.standard.StandardClient.beginDeleteWithModel":"_Specs_.Azure.Core.Lro.Standard.delete","azure.core.lro.standard.StandardClient.beginExport":"_Specs_.Azure.Core.Lro.Standard.export","azure.core.lro.standard.StandardClient.beginExportWithModel":"_Specs_.Azure.Core.Lro.Standard.export","azure.core.lro.standard.StandardClientBuilder":"_Specs_.Azure.Core.Lro.Standard","azure.core.lro.standard.models.ExportedUser":"_Specs_.Azure.Core.Lro.Standard.ExportedUser","azure.core.lro.standard.models.User":"_Specs_.Azure.Core.Lro.Standard.User"},"generatedFiles":["src/main/java/azure/core/lro/standard/StandardAsyncClient.java","src/main/java/azure/core/lro/standard/StandardClient.java","src/main/java/azure/core/lro/standard/StandardClientBuilder.java","src/main/java/azure/core/lro/standard/StandardServiceVersion.java","src/main/java/azure/core/lro/standard/implementation/OperationLocationPollingStrategy.java","src/main/java/azure/core/lro/standard/implementation/PollingUtils.java","src/main/java/azure/core/lro/standard/implementation/StandardClientImpl.java","src/main/java/azure/core/lro/standard/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/azure/core/lro/standard/implementation/package-info.java","src/main/java/azure/core/lro/standard/models/ExportedUser.java","src/main/java/azure/core/lro/standard/models/User.java","src/main/java/azure/core/lro/standard/models/package-info.java","src/main/java/azure/core/lro/standard/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_apiview_properties.json deleted file mode 100644 index 2d2610f90c8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_apiview_properties.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.core.model.ModelAsyncClient": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector", - "azure.core.model.ModelAsyncClient.get": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get", - "azure.core.model.ModelAsyncClient.getWithResponse": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get", - "azure.core.model.ModelAsyncClient.post": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post", - "azure.core.model.ModelAsyncClient.postWithResponse": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post", - "azure.core.model.ModelAsyncClient.put": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put", - "azure.core.model.ModelAsyncClient.putWithResponse": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put", - "azure.core.model.ModelClient": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector", - "azure.core.model.ModelClient.get": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get", - "azure.core.model.ModelClient.getWithResponse": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get", - "azure.core.model.ModelClient.post": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post", - "azure.core.model.ModelClient.postWithResponse": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post", - "azure.core.model.ModelClient.put": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put", - "azure.core.model.ModelClient.putWithResponse": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put", - "azure.core.model.ModelClientBuilder": "_Specs_.Azure.Core.Model", - "azure.core.model.models.AzureEmbeddingModel": "_Specs_.Azure.Core.Model.AzureEmbeddingModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_metadata.json deleted file mode 100644 index d33186735b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.model.ModelAsyncClient":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector","azure.core.model.ModelAsyncClient.get":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get","azure.core.model.ModelAsyncClient.getWithResponse":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get","azure.core.model.ModelAsyncClient.post":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post","azure.core.model.ModelAsyncClient.postWithResponse":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post","azure.core.model.ModelAsyncClient.put":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put","azure.core.model.ModelAsyncClient.putWithResponse":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put","azure.core.model.ModelClient":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector","azure.core.model.ModelClient.get":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get","azure.core.model.ModelClient.getWithResponse":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get","azure.core.model.ModelClient.post":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post","azure.core.model.ModelClient.postWithResponse":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post","azure.core.model.ModelClient.put":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put","azure.core.model.ModelClient.putWithResponse":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put","azure.core.model.ModelClientBuilder":"_Specs_.Azure.Core.Model","azure.core.model.models.AzureEmbeddingModel":"_Specs_.Azure.Core.Model.AzureEmbeddingModel"},"generatedFiles":["src/main/java/azure/core/model/ModelAsyncClient.java","src/main/java/azure/core/model/ModelClient.java","src/main/java/azure/core/model/ModelClientBuilder.java","src/main/java/azure/core/model/ModelServiceVersion.java","src/main/java/azure/core/model/implementation/AzureCoreEmbeddingVectorsImpl.java","src/main/java/azure/core/model/implementation/ModelClientImpl.java","src/main/java/azure/core/model/implementation/package-info.java","src/main/java/azure/core/model/models/AzureEmbeddingModel.java","src/main/java/azure/core/model/models/package-info.java","src/main/java/azure/core/model/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_apiview_properties.json deleted file mode 100644 index bbd2a4eae5d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_apiview_properties.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.core.page.PageAsyncClient": "_Specs_.Azure.Core.Page", - "azure.core.page.PageAsyncClient.listWithCustomPageModel": "_Specs_.Azure.Core.Page.listWithCustomPageModel", - "azure.core.page.PageAsyncClient.listWithPage": "_Specs_.Azure.Core.Page.listWithPage", - "azure.core.page.PageAsyncClient.listWithParameters": "_Specs_.Azure.Core.Page.listWithParameters", - "azure.core.page.PageAsyncClient.withParameterizedNextLink": "_Specs_.Azure.Core.Page.withParameterizedNextLink", - "azure.core.page.PageClient": "_Specs_.Azure.Core.Page", - "azure.core.page.PageClient.listWithCustomPageModel": "_Specs_.Azure.Core.Page.listWithCustomPageModel", - "azure.core.page.PageClient.listWithPage": "_Specs_.Azure.Core.Page.listWithPage", - "azure.core.page.PageClient.listWithParameters": "_Specs_.Azure.Core.Page.listWithParameters", - "azure.core.page.PageClient.withParameterizedNextLink": "_Specs_.Azure.Core.Page.withParameterizedNextLink", - "azure.core.page.PageClientBuilder": "_Specs_.Azure.Core.Page", - "azure.core.page.TwoModelsAsPageItemAsyncClient": "_Specs_.Azure.Core.Page.TwoModelsAsPageItem", - "azure.core.page.TwoModelsAsPageItemAsyncClient.listFirstItem": "_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listFirstItem", - "azure.core.page.TwoModelsAsPageItemAsyncClient.listSecondItem": "_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listSecondItem", - "azure.core.page.TwoModelsAsPageItemClient": "_Specs_.Azure.Core.Page.TwoModelsAsPageItem", - "azure.core.page.TwoModelsAsPageItemClient.listFirstItem": "_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listFirstItem", - "azure.core.page.TwoModelsAsPageItemClient.listSecondItem": "_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listSecondItem", - "azure.core.page.models.FirstItem": "_Specs_.Azure.Core.Page.FirstItem", - "azure.core.page.models.ListItemInputBody": "_Specs_.Azure.Core.Page.ListItemInputBody", - "azure.core.page.models.ListItemInputExtensibleEnum": "_Specs_.Azure.Core.Page.ListItemInputExtensibleEnum", - "azure.core.page.models.SecondItem": "_Specs_.Azure.Core.Page.SecondItem", - "azure.core.page.models.User": "_Specs_.Azure.Core.Page.User", - "azure.core.page.models.UserOrder": "_Specs_.Azure.Core.Page.UserOrder" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_metadata.json deleted file mode 100644 index fb07c449bde..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.page.PageAsyncClient":"_Specs_.Azure.Core.Page","azure.core.page.PageAsyncClient.listWithCustomPageModel":"_Specs_.Azure.Core.Page.listWithCustomPageModel","azure.core.page.PageAsyncClient.listWithPage":"_Specs_.Azure.Core.Page.listWithPage","azure.core.page.PageAsyncClient.listWithParameters":"_Specs_.Azure.Core.Page.listWithParameters","azure.core.page.PageAsyncClient.withParameterizedNextLink":"_Specs_.Azure.Core.Page.withParameterizedNextLink","azure.core.page.PageClient":"_Specs_.Azure.Core.Page","azure.core.page.PageClient.listWithCustomPageModel":"_Specs_.Azure.Core.Page.listWithCustomPageModel","azure.core.page.PageClient.listWithPage":"_Specs_.Azure.Core.Page.listWithPage","azure.core.page.PageClient.listWithParameters":"_Specs_.Azure.Core.Page.listWithParameters","azure.core.page.PageClient.withParameterizedNextLink":"_Specs_.Azure.Core.Page.withParameterizedNextLink","azure.core.page.PageClientBuilder":"_Specs_.Azure.Core.Page","azure.core.page.TwoModelsAsPageItemAsyncClient":"_Specs_.Azure.Core.Page.TwoModelsAsPageItem","azure.core.page.TwoModelsAsPageItemAsyncClient.listFirstItem":"_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listFirstItem","azure.core.page.TwoModelsAsPageItemAsyncClient.listSecondItem":"_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listSecondItem","azure.core.page.TwoModelsAsPageItemClient":"_Specs_.Azure.Core.Page.TwoModelsAsPageItem","azure.core.page.TwoModelsAsPageItemClient.listFirstItem":"_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listFirstItem","azure.core.page.TwoModelsAsPageItemClient.listSecondItem":"_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listSecondItem","azure.core.page.models.FirstItem":"_Specs_.Azure.Core.Page.FirstItem","azure.core.page.models.ListItemInputBody":"_Specs_.Azure.Core.Page.ListItemInputBody","azure.core.page.models.ListItemInputExtensibleEnum":"_Specs_.Azure.Core.Page.ListItemInputExtensibleEnum","azure.core.page.models.SecondItem":"_Specs_.Azure.Core.Page.SecondItem","azure.core.page.models.User":"_Specs_.Azure.Core.Page.User","azure.core.page.models.UserOrder":"_Specs_.Azure.Core.Page.UserOrder"},"generatedFiles":["src/main/java/azure/core/page/PageAsyncClient.java","src/main/java/azure/core/page/PageClient.java","src/main/java/azure/core/page/PageClientBuilder.java","src/main/java/azure/core/page/PageServiceVersion.java","src/main/java/azure/core/page/TwoModelsAsPageItemAsyncClient.java","src/main/java/azure/core/page/TwoModelsAsPageItemClient.java","src/main/java/azure/core/page/implementation/PageClientImpl.java","src/main/java/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java","src/main/java/azure/core/page/implementation/package-info.java","src/main/java/azure/core/page/models/FirstItem.java","src/main/java/azure/core/page/models/ListItemInputBody.java","src/main/java/azure/core/page/models/ListItemInputExtensibleEnum.java","src/main/java/azure/core/page/models/SecondItem.java","src/main/java/azure/core/page/models/User.java","src/main/java/azure/core/page/models/UserOrder.java","src/main/java/azure/core/page/models/package-info.java","src/main/java/azure/core/page/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_apiview_properties.json deleted file mode 100644 index 5f4385ca34e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_apiview_properties.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.core.scalar.ScalarAsyncClient": "_Specs_.Azure.Core.Scalar.AzureLocationScalar", - "azure.core.scalar.ScalarAsyncClient.get": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.get", - "azure.core.scalar.ScalarAsyncClient.getWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.get", - "azure.core.scalar.ScalarAsyncClient.headerMethod": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.header", - "azure.core.scalar.ScalarAsyncClient.headerMethodWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.header", - "azure.core.scalar.ScalarAsyncClient.post": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.post", - "azure.core.scalar.ScalarAsyncClient.postWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.post", - "azure.core.scalar.ScalarAsyncClient.put": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.put", - "azure.core.scalar.ScalarAsyncClient.putWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.put", - "azure.core.scalar.ScalarAsyncClient.query": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.query", - "azure.core.scalar.ScalarAsyncClient.queryWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.query", - "azure.core.scalar.ScalarClient": "_Specs_.Azure.Core.Scalar.AzureLocationScalar", - "azure.core.scalar.ScalarClient.get": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.get", - "azure.core.scalar.ScalarClient.getWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.get", - "azure.core.scalar.ScalarClient.headerMethod": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.header", - "azure.core.scalar.ScalarClient.headerMethodWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.header", - "azure.core.scalar.ScalarClient.post": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.post", - "azure.core.scalar.ScalarClient.postWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.post", - "azure.core.scalar.ScalarClient.put": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.put", - "azure.core.scalar.ScalarClient.putWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.put", - "azure.core.scalar.ScalarClient.query": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.query", - "azure.core.scalar.ScalarClient.queryWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.query", - "azure.core.scalar.ScalarClientBuilder": "_Specs_.Azure.Core.Scalar", - "azure.core.scalar.models.AzureLocationModel": "_Specs_.Azure.Core.Scalar.AzureLocationModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_metadata.json deleted file mode 100644 index 9751e756fd3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.scalar.ScalarAsyncClient":"_Specs_.Azure.Core.Scalar.AzureLocationScalar","azure.core.scalar.ScalarAsyncClient.get":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.get","azure.core.scalar.ScalarAsyncClient.getWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.get","azure.core.scalar.ScalarAsyncClient.headerMethod":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.header","azure.core.scalar.ScalarAsyncClient.headerMethodWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.header","azure.core.scalar.ScalarAsyncClient.post":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.post","azure.core.scalar.ScalarAsyncClient.postWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.post","azure.core.scalar.ScalarAsyncClient.put":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.put","azure.core.scalar.ScalarAsyncClient.putWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.put","azure.core.scalar.ScalarAsyncClient.query":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.query","azure.core.scalar.ScalarAsyncClient.queryWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.query","azure.core.scalar.ScalarClient":"_Specs_.Azure.Core.Scalar.AzureLocationScalar","azure.core.scalar.ScalarClient.get":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.get","azure.core.scalar.ScalarClient.getWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.get","azure.core.scalar.ScalarClient.headerMethod":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.header","azure.core.scalar.ScalarClient.headerMethodWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.header","azure.core.scalar.ScalarClient.post":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.post","azure.core.scalar.ScalarClient.postWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.post","azure.core.scalar.ScalarClient.put":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.put","azure.core.scalar.ScalarClient.putWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.put","azure.core.scalar.ScalarClient.query":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.query","azure.core.scalar.ScalarClient.queryWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.query","azure.core.scalar.ScalarClientBuilder":"_Specs_.Azure.Core.Scalar","azure.core.scalar.models.AzureLocationModel":"_Specs_.Azure.Core.Scalar.AzureLocationModel"},"generatedFiles":["src/main/java/azure/core/scalar/ScalarAsyncClient.java","src/main/java/azure/core/scalar/ScalarClient.java","src/main/java/azure/core/scalar/ScalarClientBuilder.java","src/main/java/azure/core/scalar/ScalarServiceVersion.java","src/main/java/azure/core/scalar/implementation/AzureLocationScalarsImpl.java","src/main/java/azure/core/scalar/implementation/ScalarClientImpl.java","src/main/java/azure/core/scalar/implementation/package-info.java","src/main/java/azure/core/scalar/models/AzureLocationModel.java","src/main/java/azure/core/scalar/models/package-info.java","src/main/java/azure/core/scalar/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_apiview_properties.json deleted file mode 100644 index 1818e714dfc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_apiview_properties.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.core.traits.TraitsAsyncClient": "_Specs_.Azure.Core.Traits", - "azure.core.traits.TraitsAsyncClient.repeatableAction": "_Specs_.Azure.Core.Traits.repeatableAction", - "azure.core.traits.TraitsAsyncClient.repeatableActionWithResponse": "_Specs_.Azure.Core.Traits.repeatableAction", - "azure.core.traits.TraitsAsyncClient.smokeTest": "_Specs_.Azure.Core.Traits.smokeTest", - "azure.core.traits.TraitsAsyncClient.smokeTestWithResponse": "_Specs_.Azure.Core.Traits.smokeTest", - "azure.core.traits.TraitsClient": "_Specs_.Azure.Core.Traits", - "azure.core.traits.TraitsClient.repeatableAction": "_Specs_.Azure.Core.Traits.repeatableAction", - "azure.core.traits.TraitsClient.repeatableActionWithResponse": "_Specs_.Azure.Core.Traits.repeatableAction", - "azure.core.traits.TraitsClient.smokeTest": "_Specs_.Azure.Core.Traits.smokeTest", - "azure.core.traits.TraitsClient.smokeTestWithResponse": "_Specs_.Azure.Core.Traits.smokeTest", - "azure.core.traits.TraitsClientBuilder": "_Specs_.Azure.Core.Traits", - "azure.core.traits.models.User": "_Specs_.Azure.Core.Traits.User", - "azure.core.traits.models.UserActionParam": "_Specs_.Azure.Core.Traits.UserActionParam", - "azure.core.traits.models.UserActionResponse": "_Specs_.Azure.Core.Traits.UserActionResponse" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_metadata.json deleted file mode 100644 index 44321ed9606..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.traits.TraitsAsyncClient":"_Specs_.Azure.Core.Traits","azure.core.traits.TraitsAsyncClient.repeatableAction":"_Specs_.Azure.Core.Traits.repeatableAction","azure.core.traits.TraitsAsyncClient.repeatableActionWithResponse":"_Specs_.Azure.Core.Traits.repeatableAction","azure.core.traits.TraitsAsyncClient.smokeTest":"_Specs_.Azure.Core.Traits.smokeTest","azure.core.traits.TraitsAsyncClient.smokeTestWithResponse":"_Specs_.Azure.Core.Traits.smokeTest","azure.core.traits.TraitsClient":"_Specs_.Azure.Core.Traits","azure.core.traits.TraitsClient.repeatableAction":"_Specs_.Azure.Core.Traits.repeatableAction","azure.core.traits.TraitsClient.repeatableActionWithResponse":"_Specs_.Azure.Core.Traits.repeatableAction","azure.core.traits.TraitsClient.smokeTest":"_Specs_.Azure.Core.Traits.smokeTest","azure.core.traits.TraitsClient.smokeTestWithResponse":"_Specs_.Azure.Core.Traits.smokeTest","azure.core.traits.TraitsClientBuilder":"_Specs_.Azure.Core.Traits","azure.core.traits.models.User":"_Specs_.Azure.Core.Traits.User","azure.core.traits.models.UserActionParam":"_Specs_.Azure.Core.Traits.UserActionParam","azure.core.traits.models.UserActionResponse":"_Specs_.Azure.Core.Traits.UserActionResponse"},"generatedFiles":["src/main/java/azure/core/traits/TraitsAsyncClient.java","src/main/java/azure/core/traits/TraitsClient.java","src/main/java/azure/core/traits/TraitsClientBuilder.java","src/main/java/azure/core/traits/TraitsServiceVersion.java","src/main/java/azure/core/traits/implementation/TraitsClientImpl.java","src/main/java/azure/core/traits/implementation/package-info.java","src/main/java/azure/core/traits/models/User.java","src/main/java/azure/core/traits/models/UserActionParam.java","src/main/java/azure/core/traits/models/UserActionResponse.java","src/main/java/azure/core/traits/models/package-info.java","src/main/java/azure/core/traits/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_apiview_properties.json deleted file mode 100644 index 26e8454c342..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_apiview_properties.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.encode.duration.DurationAsyncClient": "_Specs_.Azure.Encode.Duration", - "azure.encode.duration.DurationAsyncClient.durationConstant": "_Specs_.Azure.Encode.Duration.durationConstant", - "azure.encode.duration.DurationAsyncClient.durationConstantWithResponse": "_Specs_.Azure.Encode.Duration.durationConstant", - "azure.encode.duration.DurationClient": "_Specs_.Azure.Encode.Duration", - "azure.encode.duration.DurationClient.durationConstant": "_Specs_.Azure.Encode.Duration.durationConstant", - "azure.encode.duration.DurationClient.durationConstantWithResponse": "_Specs_.Azure.Encode.Duration.durationConstant", - "azure.encode.duration.DurationClientBuilder": "_Specs_.Azure.Encode.Duration", - "azure.encode.duration.models.DurationModel": "_Specs_.Azure.Encode.Duration.DurationModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_metadata.json deleted file mode 100644 index 31f801694b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.encode.duration.DurationAsyncClient":"_Specs_.Azure.Encode.Duration","azure.encode.duration.DurationAsyncClient.durationConstant":"_Specs_.Azure.Encode.Duration.durationConstant","azure.encode.duration.DurationAsyncClient.durationConstantWithResponse":"_Specs_.Azure.Encode.Duration.durationConstant","azure.encode.duration.DurationClient":"_Specs_.Azure.Encode.Duration","azure.encode.duration.DurationClient.durationConstant":"_Specs_.Azure.Encode.Duration.durationConstant","azure.encode.duration.DurationClient.durationConstantWithResponse":"_Specs_.Azure.Encode.Duration.durationConstant","azure.encode.duration.DurationClientBuilder":"_Specs_.Azure.Encode.Duration","azure.encode.duration.models.DurationModel":"_Specs_.Azure.Encode.Duration.DurationModel"},"generatedFiles":["src/main/java/azure/encode/duration/DurationAsyncClient.java","src/main/java/azure/encode/duration/DurationClient.java","src/main/java/azure/encode/duration/DurationClientBuilder.java","src/main/java/azure/encode/duration/implementation/DurationClientImpl.java","src/main/java/azure/encode/duration/implementation/package-info.java","src/main/java/azure/encode/duration/models/DurationModel.java","src/main/java/azure/encode/duration/models/package-info.java","src/main/java/azure/encode/duration/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_apiview_properties.json deleted file mode 100644 index bfdc0a71ff3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_apiview_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.example.basic.AzureExampleAsyncClient": "AzureExampleBasicClient.AzureExampleClient", - "azure.example.basic.AzureExampleAsyncClient.basicAction": "AzureExampleBasicClient.AzureExampleClient.basicAction", - "azure.example.basic.AzureExampleAsyncClient.basicActionWithResponse": "AzureExampleBasicClient.AzureExampleClient.basicAction", - "azure.example.basic.AzureExampleClient": "AzureExampleBasicClient.AzureExampleClient", - "azure.example.basic.AzureExampleClient.basicAction": "AzureExampleBasicClient.AzureExampleClient.basicAction", - "azure.example.basic.AzureExampleClient.basicActionWithResponse": "AzureExampleBasicClient.AzureExampleClient.basicAction", - "azure.example.basic.AzureExampleClientBuilder": "AzureExampleBasicClient.AzureExampleClient", - "azure.example.basic.models.ActionRequest": "_Specs_.Azure.Example.Basic.ActionRequest", - "azure.example.basic.models.ActionResponse": "_Specs_.Azure.Example.Basic.ActionResponse", - "azure.example.basic.models.Enum": "_Specs_.Azure.Example.Basic.Enum", - "azure.example.basic.models.Model": "_Specs_.Azure.Example.Basic.Model" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_metadata.json deleted file mode 100644 index 1bfd695c8ce..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.example.basic.AzureExampleAsyncClient":"AzureExampleBasicClient.AzureExampleClient","azure.example.basic.AzureExampleAsyncClient.basicAction":"AzureExampleBasicClient.AzureExampleClient.basicAction","azure.example.basic.AzureExampleAsyncClient.basicActionWithResponse":"AzureExampleBasicClient.AzureExampleClient.basicAction","azure.example.basic.AzureExampleClient":"AzureExampleBasicClient.AzureExampleClient","azure.example.basic.AzureExampleClient.basicAction":"AzureExampleBasicClient.AzureExampleClient.basicAction","azure.example.basic.AzureExampleClient.basicActionWithResponse":"AzureExampleBasicClient.AzureExampleClient.basicAction","azure.example.basic.AzureExampleClientBuilder":"AzureExampleBasicClient.AzureExampleClient","azure.example.basic.models.ActionRequest":"_Specs_.Azure.Example.Basic.ActionRequest","azure.example.basic.models.ActionResponse":"_Specs_.Azure.Example.Basic.ActionResponse","azure.example.basic.models.Enum":"_Specs_.Azure.Example.Basic.Enum","azure.example.basic.models.Model":"_Specs_.Azure.Example.Basic.Model"},"generatedFiles":["src/main/java/azure/example/basic/AzureExampleAsyncClient.java","src/main/java/azure/example/basic/AzureExampleClient.java","src/main/java/azure/example/basic/AzureExampleClientBuilder.java","src/main/java/azure/example/basic/BasicServiceVersion.java","src/main/java/azure/example/basic/implementation/AzureExampleClientImpl.java","src/main/java/azure/example/basic/implementation/package-info.java","src/main/java/azure/example/basic/models/ActionRequest.java","src/main/java/azure/example/basic/models/ActionResponse.java","src/main/java/azure/example/basic/models/Enum.java","src/main/java/azure/example/basic/models/Model.java","src/main/java/azure/example/basic/models/package-info.java","src/main/java/azure/example/basic/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_apiview_properties.json deleted file mode 100644 index bd89a3061c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_apiview_properties.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.payload.pageable.PageableAsyncClient": "_Specs_.Azure.Payload.Pageable", - "azure.payload.pageable.PageableAsyncClient.list": "_Specs_.Azure.Payload.Pageable.list", - "azure.payload.pageable.PageableClient": "_Specs_.Azure.Payload.Pageable", - "azure.payload.pageable.PageableClient.list": "_Specs_.Azure.Payload.Pageable.list", - "azure.payload.pageable.PageableClientBuilder": "_Specs_.Azure.Payload.Pageable", - "azure.payload.pageable.models.User": "_Specs_.Azure.Payload.Pageable.User" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_metadata.json deleted file mode 100644 index 008a93f1d53..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.payload.pageable.PageableAsyncClient":"_Specs_.Azure.Payload.Pageable","azure.payload.pageable.PageableAsyncClient.list":"_Specs_.Azure.Payload.Pageable.list","azure.payload.pageable.PageableClient":"_Specs_.Azure.Payload.Pageable","azure.payload.pageable.PageableClient.list":"_Specs_.Azure.Payload.Pageable.list","azure.payload.pageable.PageableClientBuilder":"_Specs_.Azure.Payload.Pageable","azure.payload.pageable.models.User":"_Specs_.Azure.Payload.Pageable.User"},"generatedFiles":["src/main/java/azure/payload/pageable/PageableAsyncClient.java","src/main/java/azure/payload/pageable/PageableClient.java","src/main/java/azure/payload/pageable/PageableClientBuilder.java","src/main/java/azure/payload/pageable/implementation/PageableClientImpl.java","src/main/java/azure/payload/pageable/implementation/package-info.java","src/main/java/azure/payload/pageable/models/User.java","src/main/java/azure/payload/pageable/models/package-info.java","src/main/java/azure/payload/pageable/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_apiview_properties.json deleted file mode 100644 index 2ed6a3a2d01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_apiview_properties.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.armcustomization.fluent.ArmCustomizationClient": "TspTest.ArmCustomization", - "tsptest.armcustomization.fluent.VaultsClient": "TspTest.ArmCustomization.Vaults", - "tsptest.armcustomization.fluent.VaultsClient.getByResourceGroup": "TspTest.ArmCustomization.Vaults.get", - "tsptest.armcustomization.fluent.VaultsClient.getByResourceGroupWithResponse": "TspTest.ArmCustomization.Vaults.get", - "tsptest.armcustomization.fluent.models.VaultInner": "TspTest.ArmCustomization.Vault", - "tsptest.armcustomization.implementation.ArmCustomizationClientBuilder": "TspTest.ArmCustomization", - "tsptest.armcustomization.models.VaultProperties": "TspTest.ArmCustomization.VaultProperties" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_metadata.json deleted file mode 100644 index e75ad0ce598..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"tsptest.armcustomization.fluent.ArmCustomizationClient":"TspTest.ArmCustomization","tsptest.armcustomization.fluent.VaultsClient":"TspTest.ArmCustomization.Vaults","tsptest.armcustomization.fluent.VaultsClient.getByResourceGroup":"TspTest.ArmCustomization.Vaults.get","tsptest.armcustomization.fluent.VaultsClient.getByResourceGroupWithResponse":"TspTest.ArmCustomization.Vaults.get","tsptest.armcustomization.fluent.models.VaultInner":"TspTest.ArmCustomization.Vault","tsptest.armcustomization.implementation.ArmCustomizationClientBuilder":"TspTest.ArmCustomization","tsptest.armcustomization.models.VaultProperties":"TspTest.ArmCustomization.VaultProperties"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/armcustomization/ArmCustomizationManager.java","src/main/java/tsptest/armcustomization/fluent/ArmCustomizationClient.java","src/main/java/tsptest/armcustomization/fluent/VaultsClient.java","src/main/java/tsptest/armcustomization/fluent/models/VaultInner.java","src/main/java/tsptest/armcustomization/fluent/models/package-info.java","src/main/java/tsptest/armcustomization/fluent/package-info.java","src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientBuilder.java","src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientImpl.java","src/main/java/tsptest/armcustomization/implementation/ResourceManagerUtils.java","src/main/java/tsptest/armcustomization/implementation/VaultImpl.java","src/main/java/tsptest/armcustomization/implementation/VaultsClientImpl.java","src/main/java/tsptest/armcustomization/implementation/VaultsImpl.java","src/main/java/tsptest/armcustomization/implementation/package-info.java","src/main/java/tsptest/armcustomization/models/Vault.java","src/main/java/tsptest/armcustomization/models/VaultProperties.java","src/main/java/tsptest/armcustomization/models/Vaults.java","src/main/java/tsptest/armcustomization/models/package-info.java","src/main/java/tsptest/armcustomization/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_apiview_properties.json deleted file mode 100644 index f1496f1c481..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_apiview_properties.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.armlegacy.fluent.ArmLegacyClient": "TspTest.ArmLegacy", - "tsptest.armlegacy.fluent.SkusClient": "TspTest.ArmLegacy.Skus", - "tsptest.armlegacy.fluent.SkusClient.createNested": "TspTest.ArmLegacy.Skus.createNested", - "tsptest.armlegacy.fluent.SkusClient.createNestedWithResponse": "TspTest.ArmLegacy.Skus.createNested", - "tsptest.armlegacy.fluent.SkusClient.createRoot": "TspTest.ArmLegacy.Skus.createRoot", - "tsptest.armlegacy.fluent.SkusClient.createRootWithResponse": "TspTest.ArmLegacy.Skus.createRoot", - "tsptest.armlegacy.fluent.SkusClient.deleteNested": "TspTest.ArmLegacy.Skus.deleteNested", - "tsptest.armlegacy.fluent.SkusClient.deleteNestedWithResponse": "TspTest.ArmLegacy.Skus.deleteNested", - "tsptest.armlegacy.fluent.SkusClient.deleteRoot": "TspTest.ArmLegacy.Skus.deleteRoot", - "tsptest.armlegacy.fluent.SkusClient.deleteRootWithResponse": "TspTest.ArmLegacy.Skus.deleteRoot", - "tsptest.armlegacy.fluent.SkusClient.getNested": "TspTest.ArmLegacy.Skus.getNested", - "tsptest.armlegacy.fluent.SkusClient.getNestedWithResponse": "TspTest.ArmLegacy.Skus.getNested", - "tsptest.armlegacy.fluent.SkusClient.getRoot": "TspTest.ArmLegacy.Skus.getRoot", - "tsptest.armlegacy.fluent.SkusClient.getRootWithResponse": "TspTest.ArmLegacy.Skus.getRoot", - "tsptest.armlegacy.fluent.models.SkuResourceInner": "TspTest.ArmLegacy.SkuResource", - "tsptest.armlegacy.implementation.ArmLegacyClientBuilder": "TspTest.ArmLegacy", - "tsptest.armlegacy.models.ProvisioningState": "TspTest.ArmLegacy.ProvisioningState", - "tsptest.armlegacy.models.ResourceTypeSku": "TspTest.ArmLegacy.ResourceTypeSku" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_metadata.json deleted file mode 100644 index e73fd1e1c9d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2024-12-01","crossLanguageDefinitions":{"tsptest.armlegacy.fluent.ArmLegacyClient":"TspTest.ArmLegacy","tsptest.armlegacy.fluent.SkusClient":"TspTest.ArmLegacy.Skus","tsptest.armlegacy.fluent.SkusClient.createNested":"TspTest.ArmLegacy.Skus.createNested","tsptest.armlegacy.fluent.SkusClient.createNestedWithResponse":"TspTest.ArmLegacy.Skus.createNested","tsptest.armlegacy.fluent.SkusClient.createRoot":"TspTest.ArmLegacy.Skus.createRoot","tsptest.armlegacy.fluent.SkusClient.createRootWithResponse":"TspTest.ArmLegacy.Skus.createRoot","tsptest.armlegacy.fluent.SkusClient.deleteNested":"TspTest.ArmLegacy.Skus.deleteNested","tsptest.armlegacy.fluent.SkusClient.deleteNestedWithResponse":"TspTest.ArmLegacy.Skus.deleteNested","tsptest.armlegacy.fluent.SkusClient.deleteRoot":"TspTest.ArmLegacy.Skus.deleteRoot","tsptest.armlegacy.fluent.SkusClient.deleteRootWithResponse":"TspTest.ArmLegacy.Skus.deleteRoot","tsptest.armlegacy.fluent.SkusClient.getNested":"TspTest.ArmLegacy.Skus.getNested","tsptest.armlegacy.fluent.SkusClient.getNestedWithResponse":"TspTest.ArmLegacy.Skus.getNested","tsptest.armlegacy.fluent.SkusClient.getRoot":"TspTest.ArmLegacy.Skus.getRoot","tsptest.armlegacy.fluent.SkusClient.getRootWithResponse":"TspTest.ArmLegacy.Skus.getRoot","tsptest.armlegacy.fluent.models.SkuResourceInner":"TspTest.ArmLegacy.SkuResource","tsptest.armlegacy.implementation.ArmLegacyClientBuilder":"TspTest.ArmLegacy","tsptest.armlegacy.models.ProvisioningState":"TspTest.ArmLegacy.ProvisioningState","tsptest.armlegacy.models.ResourceTypeSku":"TspTest.ArmLegacy.ResourceTypeSku"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/armlegacy/ArmLegacyManager.java","src/main/java/tsptest/armlegacy/fluent/ArmLegacyClient.java","src/main/java/tsptest/armlegacy/fluent/SkusClient.java","src/main/java/tsptest/armlegacy/fluent/models/SkuResourceInner.java","src/main/java/tsptest/armlegacy/fluent/models/package-info.java","src/main/java/tsptest/armlegacy/fluent/package-info.java","src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientBuilder.java","src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientImpl.java","src/main/java/tsptest/armlegacy/implementation/ResourceManagerUtils.java","src/main/java/tsptest/armlegacy/implementation/SkuResourceImpl.java","src/main/java/tsptest/armlegacy/implementation/SkusClientImpl.java","src/main/java/tsptest/armlegacy/implementation/SkusImpl.java","src/main/java/tsptest/armlegacy/implementation/package-info.java","src/main/java/tsptest/armlegacy/models/ProvisioningState.java","src/main/java/tsptest/armlegacy/models/ResourceTypeSku.java","src/main/java/tsptest/armlegacy/models/SkuResource.java","src/main/java/tsptest/armlegacy/models/Skus.java","src/main/java/tsptest/armlegacy/models/package-info.java","src/main/java/tsptest/armlegacy/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_apiview_properties.json deleted file mode 100644 index f3403663ed7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_apiview_properties.json +++ /dev/null @@ -1,174 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.armresourceprovider.fluent.ArmClient": "TspTest.ArmResourceProvider", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient": "TspTest.ArmResourceProvider.ChildExtensionResourceInterface", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginCreateOrUpdate": "Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginCreateOrUpdateAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginDelete": "Azure.ResourceManager.ChildExtensionResourceInterface.delete", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginDeleteAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.delete", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdate": "Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdateAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdateWithResponseAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.delete": "Azure.ResourceManager.ChildExtensionResourceInterface.delete", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.deleteAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.delete", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.deleteWithResponseAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.delete", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.get": "Azure.ResourceManager.ChildExtensionResourceInterface.get", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.get", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getWithResponse": "Azure.ResourceManager.ChildExtensionResourceInterface.get", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getWithResponseAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.get", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.listByTopLevelArmResource": "Azure.ResourceManager.ChildExtensionResourceInterface.listByTopLevelArmResource", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.listByTopLevelArmResourceAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.listByTopLevelArmResource", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.update": "Azure.ResourceManager.ChildExtensionResourceInterface.update", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.update", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateWithResponse": "Azure.ResourceManager.ChildExtensionResourceInterface.update", - "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateWithResponseAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.update", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient": "TspTest.ArmResourceProvider.ChildResourcesInterface", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBody": "TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBodyAsync": "TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBodyWithResponseAsync": "TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginActionWithoutBody": "TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginActionWithoutBodyAsync": "TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginCreateOrUpdate": "Azure.ResourceManager.ChildResourcesInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginCreateOrUpdateAsync": "Azure.ResourceManager.ChildResourcesInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginDelete": "Azure.ResourceManager.ChildResourcesInterface.delete", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginDeleteAsync": "Azure.ResourceManager.ChildResourcesInterface.delete", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdate": "Azure.ResourceManager.ChildResourcesInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdateAsync": "Azure.ResourceManager.ChildResourcesInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdateWithResponseAsync": "Azure.ResourceManager.ChildResourcesInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.delete": "Azure.ResourceManager.ChildResourcesInterface.delete", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.deleteAsync": "Azure.ResourceManager.ChildResourcesInterface.delete", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.deleteWithResponseAsync": "Azure.ResourceManager.ChildResourcesInterface.delete", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.get": "Azure.ResourceManager.ChildResourcesInterface.get", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getAsync": "Azure.ResourceManager.ChildResourcesInterface.get", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getWithResponse": "Azure.ResourceManager.ChildResourcesInterface.get", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getWithResponseAsync": "Azure.ResourceManager.ChildResourcesInterface.get", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.listByTopLevelArmResource": "TspTest.ArmResourceProvider.ChildResourcesInterface.listByTopLevelArmResource", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.listByTopLevelArmResourceAsync": "TspTest.ArmResourceProvider.ChildResourcesInterface.listByTopLevelArmResource", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.update": "Azure.ResourceManager.ChildResourcesInterface.update", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateAsync": "Azure.ResourceManager.ChildResourcesInterface.update", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateWithResponse": "Azure.ResourceManager.ChildResourcesInterface.update", - "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateWithResponseAsync": "Azure.ResourceManager.ChildResourcesInterface.update", - "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface", - "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginCreateOrUpdate": "Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginCreateOrUpdateAsync": "Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginUpdateLongRunning": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning", - "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginUpdateLongRunningAsync": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning", - "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdate": "Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdateAsync": "Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdateWithResponseAsync": "Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunning": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning", - "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunningAsync": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning", - "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunningWithResponseAsync": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning", - "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient": "TspTest.ArmResourceProvider.ImmutableResourceModel", - "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.beginCreateOrUpdate": "TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate", - "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.beginCreateOrUpdateAsync": "TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate", - "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdate": "TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate", - "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdateAsync": "TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate", - "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdateWithResponseAsync": "TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate", - "tsptest.armresourceprovider.fluent.LroNoBodiesClient": "TspTest.ArmResourceProvider.LroNoBody", - "tsptest.armresourceprovider.fluent.LroNoBodiesClient.action": "TspTest.ArmResourceProvider.LroNoBody.action", - "tsptest.armresourceprovider.fluent.LroNoBodiesClient.actionAsync": "TspTest.ArmResourceProvider.LroNoBody.action", - "tsptest.armresourceprovider.fluent.LroNoBodiesClient.actionWithResponseAsync": "TspTest.ArmResourceProvider.LroNoBody.action", - "tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginAction": "TspTest.ArmResourceProvider.LroNoBody.action", - "tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginActionAsync": "TspTest.ArmResourceProvider.LroNoBody.action", - "tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginCreateOrUpdate": "TspTest.ArmResourceProvider.LroNoBody.createOrUpdate", - "tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginCreateOrUpdateAsync": "TspTest.ArmResourceProvider.LroNoBody.createOrUpdate", - "tsptest.armresourceprovider.fluent.LroNoBodiesClient.createOrUpdate": "TspTest.ArmResourceProvider.LroNoBody.createOrUpdate", - "tsptest.armresourceprovider.fluent.LroNoBodiesClient.createOrUpdateAsync": "TspTest.ArmResourceProvider.LroNoBody.createOrUpdate", - "tsptest.armresourceprovider.fluent.LroNoBodiesClient.createOrUpdateWithResponseAsync": "TspTest.ArmResourceProvider.LroNoBody.createOrUpdate", - "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus", - "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.beginDelete": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete", - "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.beginDeleteAsync": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete", - "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.delete": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete", - "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.deleteAsync": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete", - "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.deleteWithResponseAsync": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete", - "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroup": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get", - "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupAsync": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get", - "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupWithResponse": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get", - "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupWithResponseAsync": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get", - "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient": "TspTest.ArmResourceProvider.ModelInterfaceSameName", - "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.delete": "TspTest.ArmResourceProvider.ModelInterfaceSameName.delete", - "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.deleteAsync": "TspTest.ArmResourceProvider.ModelInterfaceSameName.delete", - "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.deleteWithResponse": "TspTest.ArmResourceProvider.ModelInterfaceSameName.delete", - "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.deleteWithResponseAsync": "TspTest.ArmResourceProvider.ModelInterfaceSameName.delete", - "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroup": "TspTest.ArmResourceProvider.ModelInterfaceSameName.get", - "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupAsync": "TspTest.ArmResourceProvider.ModelInterfaceSameName.get", - "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupWithResponse": "TspTest.ArmResourceProvider.ModelInterfaceSameName.get", - "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupWithResponseAsync": "TspTest.ArmResourceProvider.ModelInterfaceSameName.get", - "tsptest.armresourceprovider.fluent.OperationsClient": "TspTest.ArmResourceProvider.Operations", - "tsptest.armresourceprovider.fluent.OperationsClient.list": "Azure.ResourceManager.Operations.list", - "tsptest.armresourceprovider.fluent.OperationsClient.listAsync": "Azure.ResourceManager.Operations.list", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient": "TspTest.ArmResourceProvider.TopLevelArmResourceInterface", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.action": "TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.actionAsync": "TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.actionWithResponseAsync": "TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginAction": "TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginActionAsync": "TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginCreateOrUpdate": "Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginCreateOrUpdateAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginDelete": "Azure.ResourceManager.TopLevelArmResourceInterface.delete", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginDeleteAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.delete", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdate": "Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdateAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdateWithResponseAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.delete": "Azure.ResourceManager.TopLevelArmResourceInterface.delete", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.deleteAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.delete", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.deleteWithResponseAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.delete", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroup": "Azure.ResourceManager.TopLevelArmResourceInterface.get", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.get", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupWithResponse": "Azure.ResourceManager.TopLevelArmResourceInterface.get", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupWithResponseAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.get", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.list": "Azure.ResourceManager.TopLevelArmResourceInterface.listBySubscription", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.listBySubscription", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listByResourceGroup": "Azure.ResourceManager.TopLevelArmResourceInterface.listByResourceGroup", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listByResourceGroupAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.listByResourceGroup", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.update": "Azure.ResourceManager.TopLevelArmResourceInterface.update", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.update", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateWithResponse": "Azure.ResourceManager.TopLevelArmResourceInterface.update", - "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateWithResponseAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.update", - "tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner": "TspTest.ArmResourceProvider.ChildExtensionResource", - "tsptest.armresourceprovider.fluent.models.ChildResourceInner": "TspTest.ArmResourceProvider.ChildResource", - "tsptest.armresourceprovider.fluent.models.ChildResourceProperties": "TspTest.ArmResourceProvider.ChildResourceProperties", - "tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner": "TspTest.ArmResourceProvider.CustomTemplateResource", - "tsptest.armresourceprovider.fluent.models.CustomTemplateResourceProperties": "TspTest.ArmResourceProvider.CustomTemplateResourceProperties", - "tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusContentProperties": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContentProperties", - "tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContent", - "tsptest.armresourceprovider.fluent.models.ModelInterfaceDifferentNameProperties": "TspTest.ArmResourceProvider.ModelInterfaceDifferentNameProperties", - "tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner": "TspTest.ArmResourceProvider.ModelInterfaceDifferentName", - "tsptest.armresourceprovider.fluent.models.OperationInner": "Azure.ResourceManager.CommonTypes.Operation", - "tsptest.armresourceprovider.fluent.models.ResourceLroNoBodyProperties": "TspTest.ArmResourceProvider.ResourceLroNoBodyProperties", - "tsptest.armresourceprovider.fluent.models.ResultInner": "TspTest.ArmResourceProvider.Result", - "tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner": "TspTest.ArmResourceProvider.TopLevelArmResource", - "tsptest.armresourceprovider.fluent.models.TopLevelArmResourceProperties": "TspTest.ArmResourceProvider.TopLevelArmResourceProperties", - "tsptest.armresourceprovider.fluent.models.TopLevelArmResourceUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", - "tsptest.armresourceprovider.implementation.ArmClientBuilder": "TspTest.ArmResourceProvider", - "tsptest.armresourceprovider.implementation.models.ChildExtensionResourceListResult": "Azure.ResourceManager.ResourceListResult", - "tsptest.armresourceprovider.implementation.models.ChildResourceListResult": "TspTest.ArmResourceProvider.ChildResourceListResult", - "tsptest.armresourceprovider.implementation.models.OperationListResult": "Azure.ResourceManager.CommonTypes.OperationListResult", - "tsptest.armresourceprovider.implementation.models.ResourceListResult": "Azure.ResourceManager.ResourceListResult", - "tsptest.armresourceprovider.models.ActionFinalResult": "TspTest.ArmResourceProvider.ActionFinalResult", - "tsptest.armresourceprovider.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", - "tsptest.armresourceprovider.models.AnonymousEmptyModel": "TspTest.ArmResourceProvider.CustomTemplateResourceProperties.anonymousEmptyModel.anonymous", - "tsptest.armresourceprovider.models.ChildExtensionResourceProperties": "TspTest.ArmResourceProvider.ChildExtensionResourceProperties", - "tsptest.armresourceprovider.models.ChildExtensionResourceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "tsptest.armresourceprovider.models.ChildResourceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "tsptest.armresourceprovider.models.CustomTemplateResourcePatch": "TspTest.ArmResourceProvider.CustomTemplateResourcePatch", - "tsptest.armresourceprovider.models.Dog": "TspTest.ArmResourceProvider.Dog", - "tsptest.armresourceprovider.models.DogKind": "TspTest.ArmResourceProvider.DogKind", - "tsptest.armresourceprovider.models.EmptyModel": "TspTest.ArmResourceProvider.EmptyModel", - "tsptest.armresourceprovider.models.Golden": "TspTest.ArmResourceProvider.Golden", - "tsptest.armresourceprovider.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", - "tsptest.armresourceprovider.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", - "tsptest.armresourceprovider.models.NginxConfigurationRequest": "TspTest.ArmResourceProvider.NginxConfigurationRequest", - "tsptest.armresourceprovider.models.NginxConfigurationResponse": "TspTest.ArmResourceProvider.NginxConfigurationResponse", - "tsptest.armresourceprovider.models.NginxConfigurationResponseProperties": "TspTest.ArmResourceProvider.NginxConfigurationResponseProperties", - "tsptest.armresourceprovider.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", - "tsptest.armresourceprovider.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", - "tsptest.armresourceprovider.models.PriorityModel": "TspTest.ArmResourceProvider.PriorityModel", - "tsptest.armresourceprovider.models.ProvisioningState": "TspTest.ArmResourceProvider.ProvisioningState", - "tsptest.armresourceprovider.models.ResourceLroNoBody": "TspTest.ArmResourceProvider.ResourceLroNoBody", - "tsptest.armresourceprovider.models.TopLevelArmResourceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", - "tsptest.armresourceprovider.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_metadata.json deleted file mode 100644 index 89702dc97a1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2023-11-01","crossLanguageDefinitions":{"tsptest.armresourceprovider.fluent.ArmClient":"TspTest.ArmResourceProvider","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient":"TspTest.ArmResourceProvider.ChildExtensionResourceInterface","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginCreateOrUpdateAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginDelete":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginDeleteAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdate":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdateAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdateWithResponseAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.delete":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.deleteAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.deleteWithResponseAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.get":"Azure.ResourceManager.ChildExtensionResourceInterface.get","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.get","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getWithResponse":"Azure.ResourceManager.ChildExtensionResourceInterface.get","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getWithResponseAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.get","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.listByTopLevelArmResource":"Azure.ResourceManager.ChildExtensionResourceInterface.listByTopLevelArmResource","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.listByTopLevelArmResourceAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.listByTopLevelArmResource","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.update":"Azure.ResourceManager.ChildExtensionResourceInterface.update","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.update","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateWithResponse":"Azure.ResourceManager.ChildExtensionResourceInterface.update","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateWithResponseAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.update","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient":"TspTest.ArmResourceProvider.ChildResourcesInterface","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBody":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBodyAsync":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBodyWithResponseAsync":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginActionWithoutBody":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginActionWithoutBodyAsync":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginCreateOrUpdateAsync":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginDelete":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginDeleteAsync":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdate":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdateAsync":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdateWithResponseAsync":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.delete":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.deleteAsync":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.deleteWithResponseAsync":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.get":"Azure.ResourceManager.ChildResourcesInterface.get","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getAsync":"Azure.ResourceManager.ChildResourcesInterface.get","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getWithResponse":"Azure.ResourceManager.ChildResourcesInterface.get","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getWithResponseAsync":"Azure.ResourceManager.ChildResourcesInterface.get","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.listByTopLevelArmResource":"TspTest.ArmResourceProvider.ChildResourcesInterface.listByTopLevelArmResource","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.listByTopLevelArmResourceAsync":"TspTest.ArmResourceProvider.ChildResourcesInterface.listByTopLevelArmResource","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.update":"Azure.ResourceManager.ChildResourcesInterface.update","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateAsync":"Azure.ResourceManager.ChildResourcesInterface.update","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateWithResponse":"Azure.ResourceManager.ChildResourcesInterface.update","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateWithResponseAsync":"Azure.ResourceManager.ChildResourcesInterface.update","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginCreateOrUpdateAsync":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginUpdateLongRunning":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginUpdateLongRunningAsync":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdate":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdateAsync":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdateWithResponseAsync":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunning":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunningAsync":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunningWithResponseAsync":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient":"TspTest.ArmResourceProvider.ImmutableResourceModel","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.beginCreateOrUpdate":"TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.beginCreateOrUpdateAsync":"TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdate":"TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdateAsync":"TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdateWithResponseAsync":"TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate","tsptest.armresourceprovider.fluent.LroNoBodiesClient":"TspTest.ArmResourceProvider.LroNoBody","tsptest.armresourceprovider.fluent.LroNoBodiesClient.action":"TspTest.ArmResourceProvider.LroNoBody.action","tsptest.armresourceprovider.fluent.LroNoBodiesClient.actionAsync":"TspTest.ArmResourceProvider.LroNoBody.action","tsptest.armresourceprovider.fluent.LroNoBodiesClient.actionWithResponseAsync":"TspTest.ArmResourceProvider.LroNoBody.action","tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginAction":"TspTest.ArmResourceProvider.LroNoBody.action","tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginActionAsync":"TspTest.ArmResourceProvider.LroNoBody.action","tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginCreateOrUpdate":"TspTest.ArmResourceProvider.LroNoBody.createOrUpdate","tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginCreateOrUpdateAsync":"TspTest.ArmResourceProvider.LroNoBody.createOrUpdate","tsptest.armresourceprovider.fluent.LroNoBodiesClient.createOrUpdate":"TspTest.ArmResourceProvider.LroNoBody.createOrUpdate","tsptest.armresourceprovider.fluent.LroNoBodiesClient.createOrUpdateAsync":"TspTest.ArmResourceProvider.LroNoBody.createOrUpdate","tsptest.armresourceprovider.fluent.LroNoBodiesClient.createOrUpdateWithResponseAsync":"TspTest.ArmResourceProvider.LroNoBody.createOrUpdate","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.beginDelete":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.beginDeleteAsync":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.delete":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.deleteAsync":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.deleteWithResponseAsync":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroup":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupAsync":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupWithResponse":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupWithResponseAsync":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient":"TspTest.ArmResourceProvider.ModelInterfaceSameName","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.delete":"TspTest.ArmResourceProvider.ModelInterfaceSameName.delete","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.deleteAsync":"TspTest.ArmResourceProvider.ModelInterfaceSameName.delete","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.deleteWithResponse":"TspTest.ArmResourceProvider.ModelInterfaceSameName.delete","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.deleteWithResponseAsync":"TspTest.ArmResourceProvider.ModelInterfaceSameName.delete","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroup":"TspTest.ArmResourceProvider.ModelInterfaceSameName.get","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupAsync":"TspTest.ArmResourceProvider.ModelInterfaceSameName.get","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupWithResponse":"TspTest.ArmResourceProvider.ModelInterfaceSameName.get","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupWithResponseAsync":"TspTest.ArmResourceProvider.ModelInterfaceSameName.get","tsptest.armresourceprovider.fluent.OperationsClient":"TspTest.ArmResourceProvider.Operations","tsptest.armresourceprovider.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","tsptest.armresourceprovider.fluent.OperationsClient.listAsync":"Azure.ResourceManager.Operations.list","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.action":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.actionAsync":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.actionWithResponseAsync":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginAction":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginActionAsync":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginCreateOrUpdateAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginDelete":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginDeleteAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdate":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdateAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdateWithResponseAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.delete":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.deleteAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.deleteWithResponseAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroup":"Azure.ResourceManager.TopLevelArmResourceInterface.get","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.get","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupWithResponse":"Azure.ResourceManager.TopLevelArmResourceInterface.get","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupWithResponseAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.get","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.list":"Azure.ResourceManager.TopLevelArmResourceInterface.listBySubscription","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.listBySubscription","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listByResourceGroup":"Azure.ResourceManager.TopLevelArmResourceInterface.listByResourceGroup","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listByResourceGroupAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.listByResourceGroup","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.update":"Azure.ResourceManager.TopLevelArmResourceInterface.update","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.update","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateWithResponse":"Azure.ResourceManager.TopLevelArmResourceInterface.update","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateWithResponseAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.update","tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner":"TspTest.ArmResourceProvider.ChildExtensionResource","tsptest.armresourceprovider.fluent.models.ChildResourceInner":"TspTest.ArmResourceProvider.ChildResource","tsptest.armresourceprovider.fluent.models.ChildResourceProperties":"TspTest.ArmResourceProvider.ChildResourceProperties","tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner":"TspTest.ArmResourceProvider.CustomTemplateResource","tsptest.armresourceprovider.fluent.models.CustomTemplateResourceProperties":"TspTest.ArmResourceProvider.CustomTemplateResourceProperties","tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusContentProperties":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContentProperties","tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContent","tsptest.armresourceprovider.fluent.models.ModelInterfaceDifferentNameProperties":"TspTest.ArmResourceProvider.ModelInterfaceDifferentNameProperties","tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner":"TspTest.ArmResourceProvider.ModelInterfaceDifferentName","tsptest.armresourceprovider.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","tsptest.armresourceprovider.fluent.models.ResourceLroNoBodyProperties":"TspTest.ArmResourceProvider.ResourceLroNoBodyProperties","tsptest.armresourceprovider.fluent.models.ResultInner":"TspTest.ArmResourceProvider.Result","tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner":"TspTest.ArmResourceProvider.TopLevelArmResource","tsptest.armresourceprovider.fluent.models.TopLevelArmResourceProperties":"TspTest.ArmResourceProvider.TopLevelArmResourceProperties","tsptest.armresourceprovider.fluent.models.TopLevelArmResourceUpdateProperties":"Azure.ResourceManager.Foundations.ResourceUpdateModelProperties","tsptest.armresourceprovider.implementation.ArmClientBuilder":"TspTest.ArmResourceProvider","tsptest.armresourceprovider.implementation.models.ChildExtensionResourceListResult":"Azure.ResourceManager.ResourceListResult","tsptest.armresourceprovider.implementation.models.ChildResourceListResult":"TspTest.ArmResourceProvider.ChildResourceListResult","tsptest.armresourceprovider.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","tsptest.armresourceprovider.implementation.models.ResourceListResult":"Azure.ResourceManager.ResourceListResult","tsptest.armresourceprovider.models.ActionFinalResult":"TspTest.ArmResourceProvider.ActionFinalResult","tsptest.armresourceprovider.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","tsptest.armresourceprovider.models.AnonymousEmptyModel":"TspTest.ArmResourceProvider.CustomTemplateResourceProperties.anonymousEmptyModel.anonymous","tsptest.armresourceprovider.models.ChildExtensionResourceProperties":"TspTest.ArmResourceProvider.ChildExtensionResourceProperties","tsptest.armresourceprovider.models.ChildExtensionResourceUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","tsptest.armresourceprovider.models.ChildResourceUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","tsptest.armresourceprovider.models.CustomTemplateResourcePatch":"TspTest.ArmResourceProvider.CustomTemplateResourcePatch","tsptest.armresourceprovider.models.Dog":"TspTest.ArmResourceProvider.Dog","tsptest.armresourceprovider.models.DogKind":"TspTest.ArmResourceProvider.DogKind","tsptest.armresourceprovider.models.EmptyModel":"TspTest.ArmResourceProvider.EmptyModel","tsptest.armresourceprovider.models.Golden":"TspTest.ArmResourceProvider.Golden","tsptest.armresourceprovider.models.ManagedServiceIdentity":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentity","tsptest.armresourceprovider.models.ManagedServiceIdentityType":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType","tsptest.armresourceprovider.models.NginxConfigurationRequest":"TspTest.ArmResourceProvider.NginxConfigurationRequest","tsptest.armresourceprovider.models.NginxConfigurationResponse":"TspTest.ArmResourceProvider.NginxConfigurationResponse","tsptest.armresourceprovider.models.NginxConfigurationResponseProperties":"TspTest.ArmResourceProvider.NginxConfigurationResponseProperties","tsptest.armresourceprovider.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","tsptest.armresourceprovider.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","tsptest.armresourceprovider.models.PriorityModel":"TspTest.ArmResourceProvider.PriorityModel","tsptest.armresourceprovider.models.ProvisioningState":"TspTest.ArmResourceProvider.ProvisioningState","tsptest.armresourceprovider.models.ResourceLroNoBody":"TspTest.ArmResourceProvider.ResourceLroNoBody","tsptest.armresourceprovider.models.TopLevelArmResourceUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","tsptest.armresourceprovider.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java","src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java","src/main/java/tsptest/armresourceprovider/fluent/ChildExtensionResourceInterfacesClient.java","src/main/java/tsptest/armresourceprovider/fluent/ChildResourcesInterfacesClient.java","src/main/java/tsptest/armresourceprovider/fluent/CustomTemplateResourceInterfacesClient.java","src/main/java/tsptest/armresourceprovider/fluent/ImmutableResourceModelsClient.java","src/main/java/tsptest/armresourceprovider/fluent/LroNoBodiesClient.java","src/main/java/tsptest/armresourceprovider/fluent/ManagedMaintenanceWindowStatusOperationsClient.java","src/main/java/tsptest/armresourceprovider/fluent/ModelInterfaceSameNamesClient.java","src/main/java/tsptest/armresourceprovider/fluent/OperationsClient.java","src/main/java/tsptest/armresourceprovider/fluent/TopLevelArmResourceInterfacesClient.java","src/main/java/tsptest/armresourceprovider/fluent/models/ChildExtensionResourceInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusContentProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceDifferentNameProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceSameNameInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/OperationInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/ResourceLroNoBodyProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/ResultInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceUpdateProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/package-info.java","src/main/java/tsptest/armresourceprovider/fluent/package-info.java","src/main/java/tsptest/armresourceprovider/implementation/ArmClientBuilder.java","src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesImpl.java","src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java","src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsImpl.java","src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNameImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesImpl.java","src/main/java/tsptest/armresourceprovider/implementation/OperationImpl.java","src/main/java/tsptest/armresourceprovider/implementation/OperationsClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/OperationsImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ResourceManagerUtils.java","src/main/java/tsptest/armresourceprovider/implementation/ResultImpl.java","src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java","src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesImpl.java","src/main/java/tsptest/armresourceprovider/implementation/models/ChildExtensionResourceListResult.java","src/main/java/tsptest/armresourceprovider/implementation/models/ChildResourceListResult.java","src/main/java/tsptest/armresourceprovider/implementation/models/OperationListResult.java","src/main/java/tsptest/armresourceprovider/implementation/models/ResourceListResult.java","src/main/java/tsptest/armresourceprovider/implementation/package-info.java","src/main/java/tsptest/armresourceprovider/models/ActionFinalResult.java","src/main/java/tsptest/armresourceprovider/models/ActionType.java","src/main/java/tsptest/armresourceprovider/models/AnonymousEmptyModel.java","src/main/java/tsptest/armresourceprovider/models/ChildExtensionResource.java","src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceInterfaces.java","src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceProperties.java","src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceUpdate.java","src/main/java/tsptest/armresourceprovider/models/ChildResource.java","src/main/java/tsptest/armresourceprovider/models/ChildResourceUpdate.java","src/main/java/tsptest/armresourceprovider/models/ChildResourcesInterfaces.java","src/main/java/tsptest/armresourceprovider/models/CustomTemplateResource.java","src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourceInterfaces.java","src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourcePatch.java","src/main/java/tsptest/armresourceprovider/models/Dog.java","src/main/java/tsptest/armresourceprovider/models/DogKind.java","src/main/java/tsptest/armresourceprovider/models/EmptyModel.java","src/main/java/tsptest/armresourceprovider/models/Golden.java","src/main/java/tsptest/armresourceprovider/models/ImmutableResourceModels.java","src/main/java/tsptest/armresourceprovider/models/LroNoBodies.java","src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatus.java","src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatusOperations.java","src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentity.java","src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentityType.java","src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameName.java","src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameNames.java","src/main/java/tsptest/armresourceprovider/models/NginxConfigurationRequest.java","src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponse.java","src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponseProperties.java","src/main/java/tsptest/armresourceprovider/models/Operation.java","src/main/java/tsptest/armresourceprovider/models/OperationDisplay.java","src/main/java/tsptest/armresourceprovider/models/Operations.java","src/main/java/tsptest/armresourceprovider/models/Origin.java","src/main/java/tsptest/armresourceprovider/models/PriorityModel.java","src/main/java/tsptest/armresourceprovider/models/ProvisioningState.java","src/main/java/tsptest/armresourceprovider/models/ResourceLroNoBody.java","src/main/java/tsptest/armresourceprovider/models/Result.java","src/main/java/tsptest/armresourceprovider/models/TopLevelArmResource.java","src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceInterfaces.java","src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceUpdate.java","src/main/java/tsptest/armresourceprovider/models/UserAssignedIdentity.java","src/main/java/tsptest/armresourceprovider/models/package-info.java","src/main/java/tsptest/armresourceprovider/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_apiview_properties.json deleted file mode 100644 index aeb257e3cca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_apiview_properties.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.armstreamstyleserialization.fluent.ArmResourceProviderManagementClient": "TspTest.ArmStreamStyleSerialization", - "tsptest.armstreamstyleserialization.fluent.FishesClient": "TspTest.ArmStreamStyleSerialization.Fishes", - "tsptest.armstreamstyleserialization.fluent.FishesClient.getModel": "TspTest.ArmStreamStyleSerialization.Fishes.getModel", - "tsptest.armstreamstyleserialization.fluent.FishesClient.getModelWithResponse": "TspTest.ArmStreamStyleSerialization.Fishes.getModel", - "tsptest.armstreamstyleserialization.fluent.FishesClient.getOutputOnlyModel": "TspTest.ArmStreamStyleSerialization.Fishes.getOutputOnlyModel", - "tsptest.armstreamstyleserialization.fluent.FishesClient.getOutputOnlyModelWithResponse": "TspTest.ArmStreamStyleSerialization.Fishes.getOutputOnlyModel", - "tsptest.armstreamstyleserialization.fluent.FishesClient.putModel": "TspTest.ArmStreamStyleSerialization.Fishes.putModel", - "tsptest.armstreamstyleserialization.fluent.FishesClient.putModelWithResponse": "TspTest.ArmStreamStyleSerialization.Fishes.putModel", - "tsptest.armstreamstyleserialization.fluent.FunctionsClient": "TspTest.ArmStreamStyleSerialization.Functions", - "tsptest.armstreamstyleserialization.fluent.FunctionsClient.createFunction": "TspTest.ArmStreamStyleSerialization.Functions.createFunction", - "tsptest.armstreamstyleserialization.fluent.FunctionsClient.createFunctionWithResponse": "TspTest.ArmStreamStyleSerialization.Functions.createFunction", - "tsptest.armstreamstyleserialization.fluent.ItemsClient": "TspTest.ArmStreamStyleSerialization.Items", - "tsptest.armstreamstyleserialization.fluent.ItemsClient.list": "TspTest.ArmStreamStyleSerialization.Items.list", - "tsptest.armstreamstyleserialization.fluent.PrioritiesClient": "TspTest.ArmStreamStyleSerialization.Priorities", - "tsptest.armstreamstyleserialization.fluent.PrioritiesClient.setPriority": "TspTest.ArmStreamStyleSerialization.Priorities.setPriority", - "tsptest.armstreamstyleserialization.fluent.PrioritiesClient.setPriorityWithResponse": "TspTest.ArmStreamStyleSerialization.Priorities.setPriority", - "tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient": "TspTest.ArmStreamStyleSerialization.TopLevelArmResources", - "tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient.beginUpdate": "TspTest.ArmStreamStyleSerialization.TopLevelArmResources.update", - "tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient.update": "TspTest.ArmStreamStyleSerialization.TopLevelArmResources.update", - "tsptest.armstreamstyleserialization.fluent.models.AnotherFishProperties": "TspTest.ArmStreamStyleSerialization.AnotherFishProperties", - "tsptest.armstreamstyleserialization.fluent.models.EyeProperties": "TspTest.ArmStreamStyleSerialization.EyeProperties", - "tsptest.armstreamstyleserialization.fluent.models.FishInner": "TspTest.ArmStreamStyleSerialization.Fish", - "tsptest.armstreamstyleserialization.fluent.models.FishProperties": "TspTest.ArmStreamStyleSerialization.FishProperties", - "tsptest.armstreamstyleserialization.fluent.models.FunctionConfiguration": "TspTest.ArmStreamStyleSerialization.FunctionConfiguration", - "tsptest.armstreamstyleserialization.fluent.models.FunctionInner": "TspTest.ArmStreamStyleSerialization.Function", - "tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner": "TspTest.ArmStreamStyleSerialization.OutputOnlyModel", - "tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelProperties": "TspTest.ArmStreamStyleSerialization.OutputOnlyModelProperties", - "tsptest.armstreamstyleserialization.fluent.models.ResultData": "TspTest.ArmStreamStyleSerialization.ResultData", - "tsptest.armstreamstyleserialization.fluent.models.SalmonInner": "TspTest.ArmStreamStyleSerialization.Salmon", - "tsptest.armstreamstyleserialization.fluent.models.TailProperties": "TspTest.ArmStreamStyleSerialization.TailProperties", - "tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner": "TspTest.ArmStreamStyleSerialization.TopLevelArmResource", - "tsptest.armstreamstyleserialization.implementation.ArmResourceProviderManagementClientBuilder": "TspTest.ArmStreamStyleSerialization", - "tsptest.armstreamstyleserialization.implementation.models.ListResult": "TspTest.ArmStreamStyleSerialization.ListResult", - "tsptest.armstreamstyleserialization.models.AggregateFunctionProperties": "TspTest.ArmStreamStyleSerialization.AggregateFunctionProperties", - "tsptest.armstreamstyleserialization.models.Builtin": "TspTest.ArmStreamStyleSerialization.Builtin", - "tsptest.armstreamstyleserialization.models.Dog": "TspTest.ArmStreamStyleSerialization.Dog", - "tsptest.armstreamstyleserialization.models.DogKind": "TspTest.ArmStreamStyleSerialization.DogKind", - "tsptest.armstreamstyleserialization.models.Encoded": "TspTest.ArmStreamStyleSerialization.Encoded", - "tsptest.armstreamstyleserialization.models.Error": "TspTest.ArmStreamStyleSerialization.ErrorResponse", - "tsptest.armstreamstyleserialization.models.ErrorMin": "TspTest.ArmStreamStyleSerialization.ErrorResponseMin", - "tsptest.armstreamstyleserialization.models.FunctionProperties": "TspTest.ArmStreamStyleSerialization.FunctionProperties", - "tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionHeaders": null, - "tsptest.armstreamstyleserialization.models.GoblinShark": "TspTest.ArmStreamStyleSerialization.GoblinShark", - "tsptest.armstreamstyleserialization.models.Golden": "TspTest.ArmStreamStyleSerialization.Golden", - "tsptest.armstreamstyleserialization.models.OutputOnlyModelChild": "TspTest.ArmStreamStyleSerialization.OutputOnlyModelChild", - "tsptest.armstreamstyleserialization.models.Priority": "TspTest.ArmStreamStyleSerialization.Priority", - "tsptest.armstreamstyleserialization.models.Result": "TspTest.ArmStreamStyleSerialization.Result", - "tsptest.armstreamstyleserialization.models.SawShark": "TspTest.ArmStreamStyleSerialization.SawShark", - "tsptest.armstreamstyleserialization.models.Shark": "TspTest.ArmStreamStyleSerialization.Shark", - "tsptest.armstreamstyleserialization.models.TopLevelArmResourceProperties": "TspTest.ArmStreamStyleSerialization.TopLevelArmResourceProperties", - "tsptest.armstreamstyleserialization.models.TopLevelArmResourceTagsUpdate": "Azure.ResourceManager.Foundations.TagsUpdateModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_metadata.json deleted file mode 100644 index e039ab6fcb4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"tsptest.armstreamstyleserialization.fluent.ArmResourceProviderManagementClient":"TspTest.ArmStreamStyleSerialization","tsptest.armstreamstyleserialization.fluent.FishesClient":"TspTest.ArmStreamStyleSerialization.Fishes","tsptest.armstreamstyleserialization.fluent.FishesClient.getModel":"TspTest.ArmStreamStyleSerialization.Fishes.getModel","tsptest.armstreamstyleserialization.fluent.FishesClient.getModelWithResponse":"TspTest.ArmStreamStyleSerialization.Fishes.getModel","tsptest.armstreamstyleserialization.fluent.FishesClient.getOutputOnlyModel":"TspTest.ArmStreamStyleSerialization.Fishes.getOutputOnlyModel","tsptest.armstreamstyleserialization.fluent.FishesClient.getOutputOnlyModelWithResponse":"TspTest.ArmStreamStyleSerialization.Fishes.getOutputOnlyModel","tsptest.armstreamstyleserialization.fluent.FishesClient.putModel":"TspTest.ArmStreamStyleSerialization.Fishes.putModel","tsptest.armstreamstyleserialization.fluent.FishesClient.putModelWithResponse":"TspTest.ArmStreamStyleSerialization.Fishes.putModel","tsptest.armstreamstyleserialization.fluent.FunctionsClient":"TspTest.ArmStreamStyleSerialization.Functions","tsptest.armstreamstyleserialization.fluent.FunctionsClient.createFunction":"TspTest.ArmStreamStyleSerialization.Functions.createFunction","tsptest.armstreamstyleserialization.fluent.FunctionsClient.createFunctionWithResponse":"TspTest.ArmStreamStyleSerialization.Functions.createFunction","tsptest.armstreamstyleserialization.fluent.ItemsClient":"TspTest.ArmStreamStyleSerialization.Items","tsptest.armstreamstyleserialization.fluent.ItemsClient.list":"TspTest.ArmStreamStyleSerialization.Items.list","tsptest.armstreamstyleserialization.fluent.PrioritiesClient":"TspTest.ArmStreamStyleSerialization.Priorities","tsptest.armstreamstyleserialization.fluent.PrioritiesClient.setPriority":"TspTest.ArmStreamStyleSerialization.Priorities.setPriority","tsptest.armstreamstyleserialization.fluent.PrioritiesClient.setPriorityWithResponse":"TspTest.ArmStreamStyleSerialization.Priorities.setPriority","tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient":"TspTest.ArmStreamStyleSerialization.TopLevelArmResources","tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient.beginUpdate":"TspTest.ArmStreamStyleSerialization.TopLevelArmResources.update","tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient.update":"TspTest.ArmStreamStyleSerialization.TopLevelArmResources.update","tsptest.armstreamstyleserialization.fluent.models.AnotherFishProperties":"TspTest.ArmStreamStyleSerialization.AnotherFishProperties","tsptest.armstreamstyleserialization.fluent.models.EyeProperties":"TspTest.ArmStreamStyleSerialization.EyeProperties","tsptest.armstreamstyleserialization.fluent.models.FishInner":"TspTest.ArmStreamStyleSerialization.Fish","tsptest.armstreamstyleserialization.fluent.models.FishProperties":"TspTest.ArmStreamStyleSerialization.FishProperties","tsptest.armstreamstyleserialization.fluent.models.FunctionConfiguration":"TspTest.ArmStreamStyleSerialization.FunctionConfiguration","tsptest.armstreamstyleserialization.fluent.models.FunctionInner":"TspTest.ArmStreamStyleSerialization.Function","tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner":"TspTest.ArmStreamStyleSerialization.OutputOnlyModel","tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelProperties":"TspTest.ArmStreamStyleSerialization.OutputOnlyModelProperties","tsptest.armstreamstyleserialization.fluent.models.ResultData":"TspTest.ArmStreamStyleSerialization.ResultData","tsptest.armstreamstyleserialization.fluent.models.SalmonInner":"TspTest.ArmStreamStyleSerialization.Salmon","tsptest.armstreamstyleserialization.fluent.models.TailProperties":"TspTest.ArmStreamStyleSerialization.TailProperties","tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner":"TspTest.ArmStreamStyleSerialization.TopLevelArmResource","tsptest.armstreamstyleserialization.implementation.ArmResourceProviderManagementClientBuilder":"TspTest.ArmStreamStyleSerialization","tsptest.armstreamstyleserialization.implementation.models.ListResult":"TspTest.ArmStreamStyleSerialization.ListResult","tsptest.armstreamstyleserialization.models.AggregateFunctionProperties":"TspTest.ArmStreamStyleSerialization.AggregateFunctionProperties","tsptest.armstreamstyleserialization.models.Builtin":"TspTest.ArmStreamStyleSerialization.Builtin","tsptest.armstreamstyleserialization.models.Dog":"TspTest.ArmStreamStyleSerialization.Dog","tsptest.armstreamstyleserialization.models.DogKind":"TspTest.ArmStreamStyleSerialization.DogKind","tsptest.armstreamstyleserialization.models.Encoded":"TspTest.ArmStreamStyleSerialization.Encoded","tsptest.armstreamstyleserialization.models.Error":"TspTest.ArmStreamStyleSerialization.ErrorResponse","tsptest.armstreamstyleserialization.models.ErrorMin":"TspTest.ArmStreamStyleSerialization.ErrorResponseMin","tsptest.armstreamstyleserialization.models.FunctionProperties":"TspTest.ArmStreamStyleSerialization.FunctionProperties","tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionHeaders":null,"tsptest.armstreamstyleserialization.models.GoblinShark":"TspTest.ArmStreamStyleSerialization.GoblinShark","tsptest.armstreamstyleserialization.models.Golden":"TspTest.ArmStreamStyleSerialization.Golden","tsptest.armstreamstyleserialization.models.OutputOnlyModelChild":"TspTest.ArmStreamStyleSerialization.OutputOnlyModelChild","tsptest.armstreamstyleserialization.models.Priority":"TspTest.ArmStreamStyleSerialization.Priority","tsptest.armstreamstyleserialization.models.Result":"TspTest.ArmStreamStyleSerialization.Result","tsptest.armstreamstyleserialization.models.SawShark":"TspTest.ArmStreamStyleSerialization.SawShark","tsptest.armstreamstyleserialization.models.Shark":"TspTest.ArmStreamStyleSerialization.Shark","tsptest.armstreamstyleserialization.models.TopLevelArmResourceProperties":"TspTest.ArmStreamStyleSerialization.TopLevelArmResourceProperties","tsptest.armstreamstyleserialization.models.TopLevelArmResourceTagsUpdate":"Azure.ResourceManager.Foundations.TagsUpdateModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/armstreamstyleserialization/ArmResourceProviderManager.java","src/main/java/tsptest/armstreamstyleserialization/fluent/ArmResourceProviderManagementClient.java","src/main/java/tsptest/armstreamstyleserialization/fluent/FishesClient.java","src/main/java/tsptest/armstreamstyleserialization/fluent/FunctionsClient.java","src/main/java/tsptest/armstreamstyleserialization/fluent/ItemsClient.java","src/main/java/tsptest/armstreamstyleserialization/fluent/PrioritiesClient.java","src/main/java/tsptest/armstreamstyleserialization/fluent/TopLevelArmResourcesClient.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/AnotherFishProperties.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/EyeProperties.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishInner.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishProperties.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionConfiguration.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionInner.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelInner.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelProperties.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/ResultData.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/SalmonInner.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/TailProperties.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/TopLevelArmResourceInner.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/package-info.java","src/main/java/tsptest/armstreamstyleserialization/fluent/package-info.java","src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientBuilder.java","src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/FishImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/FishesClientImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/FishesImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsClientImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsClientImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/OutputOnlyModelImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesClientImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/ResourceManagerUtils.java","src/main/java/tsptest/armstreamstyleserialization/implementation/SalmonImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourceImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesClientImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/models/ListResult.java","src/main/java/tsptest/armstreamstyleserialization/implementation/package-info.java","src/main/java/tsptest/armstreamstyleserialization/models/AggregateFunctionProperties.java","src/main/java/tsptest/armstreamstyleserialization/models/Builtin.java","src/main/java/tsptest/armstreamstyleserialization/models/Dog.java","src/main/java/tsptest/armstreamstyleserialization/models/DogKind.java","src/main/java/tsptest/armstreamstyleserialization/models/Encoded.java","src/main/java/tsptest/armstreamstyleserialization/models/Error.java","src/main/java/tsptest/armstreamstyleserialization/models/ErrorException.java","src/main/java/tsptest/armstreamstyleserialization/models/ErrorMin.java","src/main/java/tsptest/armstreamstyleserialization/models/ErrorMinException.java","src/main/java/tsptest/armstreamstyleserialization/models/Fish.java","src/main/java/tsptest/armstreamstyleserialization/models/Fishes.java","src/main/java/tsptest/armstreamstyleserialization/models/Function.java","src/main/java/tsptest/armstreamstyleserialization/models/FunctionProperties.java","src/main/java/tsptest/armstreamstyleserialization/models/Functions.java","src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionHeaders.java","src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionResponse.java","src/main/java/tsptest/armstreamstyleserialization/models/GoblinShark.java","src/main/java/tsptest/armstreamstyleserialization/models/Golden.java","src/main/java/tsptest/armstreamstyleserialization/models/Items.java","src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModel.java","src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModelChild.java","src/main/java/tsptest/armstreamstyleserialization/models/Priorities.java","src/main/java/tsptest/armstreamstyleserialization/models/Priority.java","src/main/java/tsptest/armstreamstyleserialization/models/Result.java","src/main/java/tsptest/armstreamstyleserialization/models/Salmon.java","src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java","src/main/java/tsptest/armstreamstyleserialization/models/Shark.java","src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResource.java","src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceProperties.java","src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceTagsUpdate.java","src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResources.java","src/main/java/tsptest/armstreamstyleserialization/models/package-info.java","src/main/java/tsptest/armstreamstyleserialization/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_apiview_properties.json deleted file mode 100644 index 6f845da1398..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_apiview_properties.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.armversioned.fluent.ArmVersionedClient": "TspTest.ArmVersioned", - "tsptest.armversioned.fluent.TopLevelArmResourcesClient": "TspTest.ArmVersioned.TopLevelArmResources", - "tsptest.armversioned.fluent.TopLevelArmResourcesClient.action": "TspTest.ArmVersioned.TopLevelArmResources.action", - "tsptest.armversioned.fluent.TopLevelArmResourcesClient.actionWithResponse": "TspTest.ArmVersioned.TopLevelArmResources.action", - "tsptest.armversioned.fluent.TopLevelArmResourcesClient.beginCreateOrUpdate": "TspTest.ArmVersioned.TopLevelArmResources.createOrUpdate", - "tsptest.armversioned.fluent.TopLevelArmResourcesClient.createOrUpdate": "TspTest.ArmVersioned.TopLevelArmResources.createOrUpdate", - "tsptest.armversioned.fluent.TopLevelArmResourcesClient.delete": "TspTest.ArmVersioned.TopLevelArmResources.delete", - "tsptest.armversioned.fluent.TopLevelArmResourcesClient.deleteWithResponse": "TspTest.ArmVersioned.TopLevelArmResources.delete", - "tsptest.armversioned.fluent.TopLevelArmResourcesClient.getByResourceGroup": "TspTest.ArmVersioned.TopLevelArmResources.get", - "tsptest.armversioned.fluent.TopLevelArmResourcesClient.getByResourceGroupWithResponse": "TspTest.ArmVersioned.TopLevelArmResources.get", - "tsptest.armversioned.fluent.TopLevelArmResourcesClient.list": "TspTest.ArmVersioned.TopLevelArmResources.listBySubscription", - "tsptest.armversioned.fluent.TopLevelArmResourcesClient.listByResourceGroup": "TspTest.ArmVersioned.TopLevelArmResources.listByResourceGroup", - "tsptest.armversioned.fluent.models.TopLevelArmResourceInner": "TspTest.ArmVersioned.TopLevelArmResource", - "tsptest.armversioned.implementation.ArmVersionedClientBuilder": "TspTest.ArmVersioned", - "tsptest.armversioned.implementation.models.TopLevelArmResourceListResult": "Azure.ResourceManager.ResourceListResult", - "tsptest.armversioned.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", - "tsptest.armversioned.models.TopLevelArmResourceProperties": "TspTest.ArmVersioned.TopLevelArmResourceProperties" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_metadata.json deleted file mode 100644 index 5eb8d805513..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2024-12-01","crossLanguageDefinitions":{"tsptest.armversioned.fluent.ArmVersionedClient":"TspTest.ArmVersioned","tsptest.armversioned.fluent.TopLevelArmResourcesClient":"TspTest.ArmVersioned.TopLevelArmResources","tsptest.armversioned.fluent.TopLevelArmResourcesClient.action":"TspTest.ArmVersioned.TopLevelArmResources.action","tsptest.armversioned.fluent.TopLevelArmResourcesClient.actionWithResponse":"TspTest.ArmVersioned.TopLevelArmResources.action","tsptest.armversioned.fluent.TopLevelArmResourcesClient.beginCreateOrUpdate":"TspTest.ArmVersioned.TopLevelArmResources.createOrUpdate","tsptest.armversioned.fluent.TopLevelArmResourcesClient.createOrUpdate":"TspTest.ArmVersioned.TopLevelArmResources.createOrUpdate","tsptest.armversioned.fluent.TopLevelArmResourcesClient.delete":"TspTest.ArmVersioned.TopLevelArmResources.delete","tsptest.armversioned.fluent.TopLevelArmResourcesClient.deleteWithResponse":"TspTest.ArmVersioned.TopLevelArmResources.delete","tsptest.armversioned.fluent.TopLevelArmResourcesClient.getByResourceGroup":"TspTest.ArmVersioned.TopLevelArmResources.get","tsptest.armversioned.fluent.TopLevelArmResourcesClient.getByResourceGroupWithResponse":"TspTest.ArmVersioned.TopLevelArmResources.get","tsptest.armversioned.fluent.TopLevelArmResourcesClient.list":"TspTest.ArmVersioned.TopLevelArmResources.listBySubscription","tsptest.armversioned.fluent.TopLevelArmResourcesClient.listByResourceGroup":"TspTest.ArmVersioned.TopLevelArmResources.listByResourceGroup","tsptest.armversioned.fluent.models.TopLevelArmResourceInner":"TspTest.ArmVersioned.TopLevelArmResource","tsptest.armversioned.implementation.ArmVersionedClientBuilder":"TspTest.ArmVersioned","tsptest.armversioned.implementation.models.TopLevelArmResourceListResult":"Azure.ResourceManager.ResourceListResult","tsptest.armversioned.models.ResourceProvisioningState":"Azure.ResourceManager.ResourceProvisioningState","tsptest.armversioned.models.TopLevelArmResourceProperties":"TspTest.ArmVersioned.TopLevelArmResourceProperties"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/armversioned/ArmVersionedManager.java","src/main/java/tsptest/armversioned/fluent/ArmVersionedClient.java","src/main/java/tsptest/armversioned/fluent/TopLevelArmResourcesClient.java","src/main/java/tsptest/armversioned/fluent/models/TopLevelArmResourceInner.java","src/main/java/tsptest/armversioned/fluent/models/package-info.java","src/main/java/tsptest/armversioned/fluent/package-info.java","src/main/java/tsptest/armversioned/implementation/ArmVersionedClientBuilder.java","src/main/java/tsptest/armversioned/implementation/ArmVersionedClientImpl.java","src/main/java/tsptest/armversioned/implementation/ResourceManagerUtils.java","src/main/java/tsptest/armversioned/implementation/TopLevelArmResourceImpl.java","src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesClientImpl.java","src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesImpl.java","src/main/java/tsptest/armversioned/implementation/models/TopLevelArmResourceListResult.java","src/main/java/tsptest/armversioned/implementation/package-info.java","src/main/java/tsptest/armversioned/models/ResourceProvisioningState.java","src/main/java/tsptest/armversioned/models/TopLevelArmResource.java","src/main/java/tsptest/armversioned/models/TopLevelArmResourceProperties.java","src/main/java/tsptest/armversioned/models/TopLevelArmResources.java","src/main/java/tsptest/armversioned/models/package-info.java","src/main/java/tsptest/armversioned/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_apiview_properties.json deleted file mode 100644 index 0dd670209e9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_apiview_properties.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.resourcemanager.multiservice.combined.fluent.Combined": "Azure.ResourceManager.MultiService.Combined", - "azure.resourcemanager.multiservice.combined.fluent.DisksClient": "Azure.ResourceManager.MultiService.ComputeDisk.Disks", - "azure.resourcemanager.multiservice.combined.fluent.DisksClient.beginCreateOrUpdate": "Azure.ResourceManager.MultiService.ComputeDisk.Disks.createOrUpdate", - "azure.resourcemanager.multiservice.combined.fluent.DisksClient.createOrUpdate": "Azure.ResourceManager.MultiService.ComputeDisk.Disks.createOrUpdate", - "azure.resourcemanager.multiservice.combined.fluent.DisksClient.getByResourceGroup": "Azure.ResourceManager.MultiService.ComputeDisk.Disks.get", - "azure.resourcemanager.multiservice.combined.fluent.DisksClient.getByResourceGroupWithResponse": "Azure.ResourceManager.MultiService.ComputeDisk.Disks.get", - "azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient": "Azure.ResourceManager.MultiService.Compute.VirtualMachines", - "azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.beginCreateOrUpdate": "Azure.ResourceManager.MultiService.Compute.VirtualMachines.createOrUpdate", - "azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.createOrUpdate": "Azure.ResourceManager.MultiService.Compute.VirtualMachines.createOrUpdate", - "azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.getByResourceGroup": "Azure.ResourceManager.MultiService.Compute.VirtualMachines.get", - "azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.getByResourceGroupWithResponse": "Azure.ResourceManager.MultiService.Compute.VirtualMachines.get", - "azure.resourcemanager.multiservice.combined.fluent.models.DiskInner": "Azure.ResourceManager.MultiService.ComputeDisk.Disk", - "azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner": "Azure.ResourceManager.MultiService.Compute.VirtualMachine", - "azure.resourcemanager.multiservice.combined.implementation.CombinedBuilder": "Azure.ResourceManager.MultiService.Combined", - "azure.resourcemanager.multiservice.combined.models.DiskProperties": "Azure.ResourceManager.MultiService.ComputeDisk.DiskProperties", - "azure.resourcemanager.multiservice.combined.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", - "azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties": "Azure.ResourceManager.MultiService.Compute.VirtualMachineProperties" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_metadata.json deleted file mode 100644 index 234887d5b64..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.resourcemanager.multiservice.combined.fluent.Combined":"Azure.ResourceManager.MultiService.Combined","azure.resourcemanager.multiservice.combined.fluent.DisksClient":"Azure.ResourceManager.MultiService.ComputeDisk.Disks","azure.resourcemanager.multiservice.combined.fluent.DisksClient.beginCreateOrUpdate":"Azure.ResourceManager.MultiService.ComputeDisk.Disks.createOrUpdate","azure.resourcemanager.multiservice.combined.fluent.DisksClient.createOrUpdate":"Azure.ResourceManager.MultiService.ComputeDisk.Disks.createOrUpdate","azure.resourcemanager.multiservice.combined.fluent.DisksClient.getByResourceGroup":"Azure.ResourceManager.MultiService.ComputeDisk.Disks.get","azure.resourcemanager.multiservice.combined.fluent.DisksClient.getByResourceGroupWithResponse":"Azure.ResourceManager.MultiService.ComputeDisk.Disks.get","azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient":"Azure.ResourceManager.MultiService.Compute.VirtualMachines","azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.beginCreateOrUpdate":"Azure.ResourceManager.MultiService.Compute.VirtualMachines.createOrUpdate","azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.createOrUpdate":"Azure.ResourceManager.MultiService.Compute.VirtualMachines.createOrUpdate","azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.getByResourceGroup":"Azure.ResourceManager.MultiService.Compute.VirtualMachines.get","azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.getByResourceGroupWithResponse":"Azure.ResourceManager.MultiService.Compute.VirtualMachines.get","azure.resourcemanager.multiservice.combined.fluent.models.DiskInner":"Azure.ResourceManager.MultiService.ComputeDisk.Disk","azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner":"Azure.ResourceManager.MultiService.Compute.VirtualMachine","azure.resourcemanager.multiservice.combined.implementation.CombinedBuilder":"Azure.ResourceManager.MultiService.Combined","azure.resourcemanager.multiservice.combined.models.DiskProperties":"Azure.ResourceManager.MultiService.ComputeDisk.DiskProperties","azure.resourcemanager.multiservice.combined.models.ResourceProvisioningState":"Azure.ResourceManager.ResourceProvisioningState","azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties":"Azure.ResourceManager.MultiService.Compute.VirtualMachineProperties"},"generatedFiles":["src/main/java/azure/resourcemanager/multiservice/combined/CombinedManager.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/Combined.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/DisksClient.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/VirtualMachinesClient.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/DiskInner.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/VirtualMachineInner.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/package-info.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/package-info.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedBuilder.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/DiskImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksClientImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachineImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesClientImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/package-info.java","src/main/java/azure/resourcemanager/multiservice/combined/models/Disk.java","src/main/java/azure/resourcemanager/multiservice/combined/models/DiskProperties.java","src/main/java/azure/resourcemanager/multiservice/combined/models/Disks.java","src/main/java/azure/resourcemanager/multiservice/combined/models/ResourceProvisioningState.java","src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachine.java","src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachineProperties.java","src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachines.java","src/main/java/azure/resourcemanager/multiservice/combined/models/package-info.java","src/main/java/azure/resourcemanager/multiservice/combined/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_apiview_properties.json deleted file mode 100644 index b89c3621c4b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_apiview_properties.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.resourcemanager.commonproperties.fluent.CommonPropertiesClient": "Azure.ResourceManager.CommonProperties", - "azure.resourcemanager.commonproperties.fluent.ErrorsClient": "Azure.ResourceManager.CommonProperties.Error", - "azure.resourcemanager.commonproperties.fluent.ErrorsClient.createForUserDefinedError": "Azure.ResourceManager.CommonProperties.Error.createForUserDefinedError", - "azure.resourcemanager.commonproperties.fluent.ErrorsClient.createForUserDefinedErrorWithResponse": "Azure.ResourceManager.CommonProperties.Error.createForUserDefinedError", - "azure.resourcemanager.commonproperties.fluent.ErrorsClient.getByResourceGroup": "Azure.ResourceManager.CommonProperties.Error.getForPredefinedError", - "azure.resourcemanager.commonproperties.fluent.ErrorsClient.getByResourceGroupWithResponse": "Azure.ResourceManager.CommonProperties.Error.getForPredefinedError", - "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient": "Azure.ResourceManager.CommonProperties.ManagedIdentity", - "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.createWithSystemAssigned": "Azure.ResourceManager.CommonProperties.ManagedIdentity.createWithSystemAssigned", - "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.createWithSystemAssignedWithResponse": "Azure.ResourceManager.CommonProperties.ManagedIdentity.createWithSystemAssigned", - "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.getByResourceGroup": "Azure.ResourceManager.CommonProperties.ManagedIdentity.get", - "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.getByResourceGroupWithResponse": "Azure.ResourceManager.CommonProperties.ManagedIdentity.get", - "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.updateWithUserAssignedAndSystemAssigned": "Azure.ResourceManager.CommonProperties.ManagedIdentity.updateWithUserAssignedAndSystemAssigned", - "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.updateWithUserAssignedAndSystemAssignedWithResponse": "Azure.ResourceManager.CommonProperties.ManagedIdentity.updateWithUserAssignedAndSystemAssigned", - "azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner": "Azure.ResourceManager.CommonProperties.ConfidentialResource", - "azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner": "Azure.ResourceManager.CommonProperties.ManagedIdentityTrackedResource", - "azure.resourcemanager.commonproperties.implementation.CommonPropertiesClientBuilder": "Azure.ResourceManager.CommonProperties", - "azure.resourcemanager.commonproperties.models.ApiError": "Azure.ResourceManager.CommonProperties.CloudError", - "azure.resourcemanager.commonproperties.models.ConfidentialResourceProperties": "Azure.ResourceManager.CommonProperties.ConfidentialResourceProperties", - "azure.resourcemanager.commonproperties.models.InnerError": "Azure.ResourceManager.CommonProperties.InnerError", - "azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResourceProperties": "Azure.ResourceManager.CommonProperties.ManagedIdentityTrackedResourceProperties", - "azure.resourcemanager.commonproperties.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", - "azure.resourcemanager.commonproperties.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", - "azure.resourcemanager.commonproperties.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_metadata.json deleted file mode 100644 index f93f7490097..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"azure.resourcemanager.commonproperties.fluent.CommonPropertiesClient":"Azure.ResourceManager.CommonProperties","azure.resourcemanager.commonproperties.fluent.ErrorsClient":"Azure.ResourceManager.CommonProperties.Error","azure.resourcemanager.commonproperties.fluent.ErrorsClient.createForUserDefinedError":"Azure.ResourceManager.CommonProperties.Error.createForUserDefinedError","azure.resourcemanager.commonproperties.fluent.ErrorsClient.createForUserDefinedErrorWithResponse":"Azure.ResourceManager.CommonProperties.Error.createForUserDefinedError","azure.resourcemanager.commonproperties.fluent.ErrorsClient.getByResourceGroup":"Azure.ResourceManager.CommonProperties.Error.getForPredefinedError","azure.resourcemanager.commonproperties.fluent.ErrorsClient.getByResourceGroupWithResponse":"Azure.ResourceManager.CommonProperties.Error.getForPredefinedError","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient":"Azure.ResourceManager.CommonProperties.ManagedIdentity","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.createWithSystemAssigned":"Azure.ResourceManager.CommonProperties.ManagedIdentity.createWithSystemAssigned","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.createWithSystemAssignedWithResponse":"Azure.ResourceManager.CommonProperties.ManagedIdentity.createWithSystemAssigned","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.getByResourceGroup":"Azure.ResourceManager.CommonProperties.ManagedIdentity.get","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.getByResourceGroupWithResponse":"Azure.ResourceManager.CommonProperties.ManagedIdentity.get","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.updateWithUserAssignedAndSystemAssigned":"Azure.ResourceManager.CommonProperties.ManagedIdentity.updateWithUserAssignedAndSystemAssigned","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.updateWithUserAssignedAndSystemAssignedWithResponse":"Azure.ResourceManager.CommonProperties.ManagedIdentity.updateWithUserAssignedAndSystemAssigned","azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner":"Azure.ResourceManager.CommonProperties.ConfidentialResource","azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner":"Azure.ResourceManager.CommonProperties.ManagedIdentityTrackedResource","azure.resourcemanager.commonproperties.implementation.CommonPropertiesClientBuilder":"Azure.ResourceManager.CommonProperties","azure.resourcemanager.commonproperties.models.ApiError":"Azure.ResourceManager.CommonProperties.CloudError","azure.resourcemanager.commonproperties.models.ConfidentialResourceProperties":"Azure.ResourceManager.CommonProperties.ConfidentialResourceProperties","azure.resourcemanager.commonproperties.models.InnerError":"Azure.ResourceManager.CommonProperties.InnerError","azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResourceProperties":"Azure.ResourceManager.CommonProperties.ManagedIdentityTrackedResourceProperties","azure.resourcemanager.commonproperties.models.ManagedServiceIdentity":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentity","azure.resourcemanager.commonproperties.models.ManagedServiceIdentityType":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType","azure.resourcemanager.commonproperties.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity"},"generatedFiles":["src/main/java/azure/resourcemanager/commonproperties/CommonPropertiesManager.java","src/main/java/azure/resourcemanager/commonproperties/fluent/CommonPropertiesClient.java","src/main/java/azure/resourcemanager/commonproperties/fluent/ErrorsClient.java","src/main/java/azure/resourcemanager/commonproperties/fluent/ManagedIdentitiesClient.java","src/main/java/azure/resourcemanager/commonproperties/fluent/models/ConfidentialResourceInner.java","src/main/java/azure/resourcemanager/commonproperties/fluent/models/ManagedIdentityTrackedResourceInner.java","src/main/java/azure/resourcemanager/commonproperties/fluent/models/package-info.java","src/main/java/azure/resourcemanager/commonproperties/fluent/package-info.java","src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientBuilder.java","src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ConfidentialResourceImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsClientImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesClientImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentityTrackedResourceImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/commonproperties/implementation/package-info.java","src/main/java/azure/resourcemanager/commonproperties/models/ApiError.java","src/main/java/azure/resourcemanager/commonproperties/models/ApiErrorException.java","src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResource.java","src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResourceProperties.java","src/main/java/azure/resourcemanager/commonproperties/models/Errors.java","src/main/java/azure/resourcemanager/commonproperties/models/InnerError.java","src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentities.java","src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResource.java","src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResourceProperties.java","src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentity.java","src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentityType.java","src/main/java/azure/resourcemanager/commonproperties/models/UserAssignedIdentity.java","src/main/java/azure/resourcemanager/commonproperties/models/package-info.java","src/main/java/azure/resourcemanager/commonproperties/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_apiview_properties.json deleted file mode 100644 index dfb9414cee4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_apiview_properties.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.resourcemanager.largeheader.fluent.LargeHeaderClient": "Azure.ResourceManager.LargeHeader", - "azure.resourcemanager.largeheader.fluent.LargeHeadersClient": "Azure.ResourceManager.LargeHeader.LargeHeaders", - "azure.resourcemanager.largeheader.fluent.LargeHeadersClient.beginTwo6k": "Azure.ResourceManager.LargeHeader.LargeHeaders.two6k", - "azure.resourcemanager.largeheader.fluent.LargeHeadersClient.two6k": "Azure.ResourceManager.LargeHeader.LargeHeaders.two6k", - "azure.resourcemanager.largeheader.fluent.models.CancelResultInner": "Azure.ResourceManager.LargeHeader.CancelResult", - "azure.resourcemanager.largeheader.implementation.LargeHeaderClientBuilder": "Azure.ResourceManager.LargeHeader" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_metadata.json deleted file mode 100644 index c508ef0d333..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"azure.resourcemanager.largeheader.fluent.LargeHeaderClient":"Azure.ResourceManager.LargeHeader","azure.resourcemanager.largeheader.fluent.LargeHeadersClient":"Azure.ResourceManager.LargeHeader.LargeHeaders","azure.resourcemanager.largeheader.fluent.LargeHeadersClient.beginTwo6k":"Azure.ResourceManager.LargeHeader.LargeHeaders.two6k","azure.resourcemanager.largeheader.fluent.LargeHeadersClient.two6k":"Azure.ResourceManager.LargeHeader.LargeHeaders.two6k","azure.resourcemanager.largeheader.fluent.models.CancelResultInner":"Azure.ResourceManager.LargeHeader.CancelResult","azure.resourcemanager.largeheader.implementation.LargeHeaderClientBuilder":"Azure.ResourceManager.LargeHeader"},"generatedFiles":["src/main/java/azure/resourcemanager/largeheader/LargeHeaderManager.java","src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeaderClient.java","src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeadersClient.java","src/main/java/azure/resourcemanager/largeheader/fluent/models/CancelResultInner.java","src/main/java/azure/resourcemanager/largeheader/fluent/models/package-info.java","src/main/java/azure/resourcemanager/largeheader/fluent/package-info.java","src/main/java/azure/resourcemanager/largeheader/implementation/CancelResultImpl.java","src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientBuilder.java","src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientImpl.java","src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersClientImpl.java","src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersImpl.java","src/main/java/azure/resourcemanager/largeheader/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/largeheader/implementation/package-info.java","src/main/java/azure/resourcemanager/largeheader/models/CancelResult.java","src/main/java/azure/resourcemanager/largeheader/models/LargeHeaders.java","src/main/java/azure/resourcemanager/largeheader/models/package-info.java","src/main/java/azure/resourcemanager/largeheader/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_apiview_properties.json deleted file mode 100644 index 70b60f8e8d0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_apiview_properties.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.resourcemanager.methodsubscriptionid.fluent.MethodSubscriptionIdClient": "Azure.ResourceManager.MethodSubscriptionId", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.delete": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.delete", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.deleteWithResponse": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.delete", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.getByResourceGroup": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.get", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.getByResourceGroupWithResponse": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.get", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.put": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.put", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.putWithResponse": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.put", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.delete": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.delete", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.deleteWithResponse": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.delete", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.get": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.get", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.getWithResponse": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.get", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.put": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.put", - "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.putWithResponse": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.put", - "azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient": "Azure.ResourceManager.MethodSubscriptionId.Operations", - "azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient.list": "Azure.ResourceManager.Operations.list", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.delete": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.delete", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.deleteWithResponse": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.delete", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.get": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.get", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.getWithResponse": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.get", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.put": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.put", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.putWithResponse": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.put", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.delete": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.delete", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.deleteWithResponse": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.delete", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.get": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.get", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.getWithResponse": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.get", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.put": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.put", - "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.putWithResponse": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.put", - "azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner": "Azure.ResourceManager.CommonTypes.Operation", - "azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResource", - "azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1", - "azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2", - "azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResource", - "azure.resourcemanager.methodsubscriptionid.implementation.MethodSubscriptionIdClientBuilder": "Azure.ResourceManager.MethodSubscriptionId", - "azure.resourcemanager.methodsubscriptionid.implementation.models.OperationListResult": "Azure.ResourceManager.CommonTypes.OperationListResult", - "azure.resourcemanager.methodsubscriptionid.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", - "azure.resourcemanager.methodsubscriptionid.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", - "azure.resourcemanager.methodsubscriptionid.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", - "azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceProperties", - "azure.resourcemanager.methodsubscriptionid.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", - "azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Properties", - "azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Properties", - "azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceProperties" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_metadata.json deleted file mode 100644 index 40c9aa31aa7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"azure.resourcemanager.methodsubscriptionid.fluent.MethodSubscriptionIdClient":"Azure.ResourceManager.MethodSubscriptionId","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.delete":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.delete","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.deleteWithResponse":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.delete","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.getByResourceGroup":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.get","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.getByResourceGroupWithResponse":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.get","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.put":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.put","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.putWithResponse":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.put","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.delete":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.delete","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.deleteWithResponse":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.delete","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.get":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.get","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.getWithResponse":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.get","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.put":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.put","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.putWithResponse":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.put","azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient":"Azure.ResourceManager.MethodSubscriptionId.Operations","azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.delete":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.delete","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.deleteWithResponse":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.delete","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.get":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.get","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.getWithResponse":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.get","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.put":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.put","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.putWithResponse":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.put","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.delete":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.delete","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.deleteWithResponse":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.delete","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.get":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.get","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.getWithResponse":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.get","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.put":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.put","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.putWithResponse":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.put","azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResource","azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1","azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2","azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResource","azure.resourcemanager.methodsubscriptionid.implementation.MethodSubscriptionIdClientBuilder":"Azure.ResourceManager.MethodSubscriptionId","azure.resourcemanager.methodsubscriptionid.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","azure.resourcemanager.methodsubscriptionid.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","azure.resourcemanager.methodsubscriptionid.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","azure.resourcemanager.methodsubscriptionid.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceProperties","azure.resourcemanager.methodsubscriptionid.models.ResourceProvisioningState":"Azure.ResourceManager.ResourceProvisioningState","azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Properties","azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Properties","azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceProperties"},"generatedFiles":["src/main/java/azure/resourcemanager/methodsubscriptionid/MethodSubscriptionIdManager.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MethodSubscriptionIdClient.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementResourceGroupResourceOperationsClient.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementSubscriptionResourceOperationsClient.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/OperationsClient.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/OperationInner.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/ResourceGroupResourceInner.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource1Inner.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource2Inner.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResourceInner.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/package-info.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/package-info.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientBuilder.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsClientImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceGroupResourceImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource1Impl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource2Impl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResourceImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/models/OperationListResult.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/package-info.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/ActionType.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementResourceGroupResourceOperations.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementSubscriptionResourceOperations.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operation.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/OperationDisplay.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operations.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/Origin.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResource.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResourceProperties.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceProvisioningState.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1Properties.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2Properties.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResourceProperties.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/package-info.java","src/main/java/azure/resourcemanager/methodsubscriptionid/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_apiview_properties.json deleted file mode 100644 index 0128abdd54d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_apiview_properties.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.resourcemanager.nonresource.fluent.NonResourceClient": "Azure.ResourceManager.NonResource", - "azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient": "Azure.ResourceManager.NonResource.NonResourceOperations", - "azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.create": "Azure.ResourceManager.NonResource.NonResourceOperations.create", - "azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.createWithResponse": "Azure.ResourceManager.NonResource.NonResourceOperations.create", - "azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.get": "Azure.ResourceManager.NonResource.NonResourceOperations.get", - "azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.getWithResponse": "Azure.ResourceManager.NonResource.NonResourceOperations.get", - "azure.resourcemanager.nonresource.fluent.models.NonResourceInner": "Azure.ResourceManager.NonResource.NonResource", - "azure.resourcemanager.nonresource.implementation.NonResourceClientBuilder": "Azure.ResourceManager.NonResource" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_metadata.json deleted file mode 100644 index f06e8dd7c98..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"azure.resourcemanager.nonresource.fluent.NonResourceClient":"Azure.ResourceManager.NonResource","azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient":"Azure.ResourceManager.NonResource.NonResourceOperations","azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.create":"Azure.ResourceManager.NonResource.NonResourceOperations.create","azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.createWithResponse":"Azure.ResourceManager.NonResource.NonResourceOperations.create","azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.get":"Azure.ResourceManager.NonResource.NonResourceOperations.get","azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.getWithResponse":"Azure.ResourceManager.NonResource.NonResourceOperations.get","azure.resourcemanager.nonresource.fluent.models.NonResourceInner":"Azure.ResourceManager.NonResource.NonResource","azure.resourcemanager.nonresource.implementation.NonResourceClientBuilder":"Azure.ResourceManager.NonResource"},"generatedFiles":["src/main/java/azure/resourcemanager/nonresource/NonResourceManager.java","src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceClient.java","src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceOperationsClient.java","src/main/java/azure/resourcemanager/nonresource/fluent/models/NonResourceInner.java","src/main/java/azure/resourcemanager/nonresource/fluent/models/package-info.java","src/main/java/azure/resourcemanager/nonresource/fluent/package-info.java","src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientBuilder.java","src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientImpl.java","src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceImpl.java","src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsClientImpl.java","src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsImpl.java","src/main/java/azure/resourcemanager/nonresource/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/nonresource/implementation/package-info.java","src/main/java/azure/resourcemanager/nonresource/models/NonResource.java","src/main/java/azure/resourcemanager/nonresource/models/NonResourceOperations.java","src/main/java/azure/resourcemanager/nonresource/models/package-info.java","src/main/java/azure/resourcemanager/nonresource/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_apiview_properties.json deleted file mode 100644 index ecbc75a98aa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_apiview_properties.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient": "Azure.ResourceManager.OperationTemplates.CheckNameAvailability", - "azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkGlobal": "Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkGlobal", - "azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkGlobalWithResponse": "Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkGlobal", - "azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkLocal": "Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkLocal", - "azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkLocalWithResponse": "Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkLocal", - "azure.resourcemanager.operationtemplates.fluent.LroesClient": "Azure.ResourceManager.OperationTemplates.Lro", - "azure.resourcemanager.operationtemplates.fluent.LroesClient.beginCreateOrReplace": "Azure.ResourceManager.OperationTemplates.Lro.createOrReplace", - "azure.resourcemanager.operationtemplates.fluent.LroesClient.beginDelete": "Azure.ResourceManager.OperationTemplates.Lro.delete", - "azure.resourcemanager.operationtemplates.fluent.LroesClient.beginExport": "Azure.ResourceManager.OperationTemplates.Lro.export", - "azure.resourcemanager.operationtemplates.fluent.LroesClient.createOrReplace": "Azure.ResourceManager.OperationTemplates.Lro.createOrReplace", - "azure.resourcemanager.operationtemplates.fluent.LroesClient.delete": "Azure.ResourceManager.OperationTemplates.Lro.delete", - "azure.resourcemanager.operationtemplates.fluent.LroesClient.export": "Azure.ResourceManager.OperationTemplates.Lro.export", - "azure.resourcemanager.operationtemplates.fluent.OperationTemplatesClient": "Azure.ResourceManager.OperationTemplates", - "azure.resourcemanager.operationtemplates.fluent.OperationsClient": "Azure.ResourceManager.OperationTemplates.Operations", - "azure.resourcemanager.operationtemplates.fluent.OperationsClient.list": "Azure.ResourceManager.Operations.list", - "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient": "Azure.ResourceManager.OperationTemplates.OptionalBody", - "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.getByResourceGroup": "Azure.ResourceManager.OperationTemplates.OptionalBody.get", - "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.getByResourceGroupWithResponse": "Azure.ResourceManager.OperationTemplates.OptionalBody.get", - "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.patch": "Azure.ResourceManager.OperationTemplates.OptionalBody.patch", - "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.patchWithResponse": "Azure.ResourceManager.OperationTemplates.OptionalBody.patch", - "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.post": "Azure.ResourceManager.OperationTemplates.OptionalBody.post", - "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.postWithResponse": "Azure.ResourceManager.OperationTemplates.OptionalBody.post", - "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.providerPost": "Azure.ResourceManager.OperationTemplates.OptionalBody.providerPost", - "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.providerPostWithResponse": "Azure.ResourceManager.OperationTemplates.OptionalBody.providerPost", - "azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner": "Azure.ResourceManager.OperationTemplates.ActionResult", - "azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner": "Azure.ResourceManager.OperationTemplates.ChangeAllowanceResult", - "azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse", - "azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner": "Azure.ResourceManager.OperationTemplates.ExportResult", - "azure.resourcemanager.operationtemplates.fluent.models.OperationInner": "Azure.ResourceManager.CommonTypes.Operation", - "azure.resourcemanager.operationtemplates.fluent.models.OrderInner": "Azure.ResourceManager.OperationTemplates.Order", - "azure.resourcemanager.operationtemplates.fluent.models.WidgetInner": "Azure.ResourceManager.OperationTemplates.Widget", - "azure.resourcemanager.operationtemplates.implementation.OperationTemplatesClientBuilder": "Azure.ResourceManager.OperationTemplates", - "azure.resourcemanager.operationtemplates.implementation.models.OperationListResult": "Azure.ResourceManager.CommonTypes.OperationListResult", - "azure.resourcemanager.operationtemplates.models.ActionRequest": "Azure.ResourceManager.OperationTemplates.ActionRequest", - "azure.resourcemanager.operationtemplates.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", - "azure.resourcemanager.operationtemplates.models.ChangeAllowanceRequest": "Azure.ResourceManager.OperationTemplates.ChangeAllowanceRequest", - "azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityReason": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason", - "azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityRequest": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest", - "azure.resourcemanager.operationtemplates.models.ExportRequest": "Azure.ResourceManager.OperationTemplates.ExportRequest", - "azure.resourcemanager.operationtemplates.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", - "azure.resourcemanager.operationtemplates.models.OrderProperties": "Azure.ResourceManager.OperationTemplates.OrderProperties", - "azure.resourcemanager.operationtemplates.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", - "azure.resourcemanager.operationtemplates.models.WidgetProperties": "Azure.ResourceManager.OperationTemplates.WidgetProperties" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_metadata.json deleted file mode 100644 index 90229b18af4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient":"Azure.ResourceManager.OperationTemplates.CheckNameAvailability","azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkGlobal":"Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkGlobal","azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkGlobalWithResponse":"Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkGlobal","azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkLocal":"Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkLocal","azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkLocalWithResponse":"Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkLocal","azure.resourcemanager.operationtemplates.fluent.LroesClient":"Azure.ResourceManager.OperationTemplates.Lro","azure.resourcemanager.operationtemplates.fluent.LroesClient.beginCreateOrReplace":"Azure.ResourceManager.OperationTemplates.Lro.createOrReplace","azure.resourcemanager.operationtemplates.fluent.LroesClient.beginDelete":"Azure.ResourceManager.OperationTemplates.Lro.delete","azure.resourcemanager.operationtemplates.fluent.LroesClient.beginExport":"Azure.ResourceManager.OperationTemplates.Lro.export","azure.resourcemanager.operationtemplates.fluent.LroesClient.createOrReplace":"Azure.ResourceManager.OperationTemplates.Lro.createOrReplace","azure.resourcemanager.operationtemplates.fluent.LroesClient.delete":"Azure.ResourceManager.OperationTemplates.Lro.delete","azure.resourcemanager.operationtemplates.fluent.LroesClient.export":"Azure.ResourceManager.OperationTemplates.Lro.export","azure.resourcemanager.operationtemplates.fluent.OperationTemplatesClient":"Azure.ResourceManager.OperationTemplates","azure.resourcemanager.operationtemplates.fluent.OperationsClient":"Azure.ResourceManager.OperationTemplates.Operations","azure.resourcemanager.operationtemplates.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient":"Azure.ResourceManager.OperationTemplates.OptionalBody","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.getByResourceGroup":"Azure.ResourceManager.OperationTemplates.OptionalBody.get","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.getByResourceGroupWithResponse":"Azure.ResourceManager.OperationTemplates.OptionalBody.get","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.patch":"Azure.ResourceManager.OperationTemplates.OptionalBody.patch","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.patchWithResponse":"Azure.ResourceManager.OperationTemplates.OptionalBody.patch","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.post":"Azure.ResourceManager.OperationTemplates.OptionalBody.post","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.postWithResponse":"Azure.ResourceManager.OperationTemplates.OptionalBody.post","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.providerPost":"Azure.ResourceManager.OperationTemplates.OptionalBody.providerPost","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.providerPostWithResponse":"Azure.ResourceManager.OperationTemplates.OptionalBody.providerPost","azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner":"Azure.ResourceManager.OperationTemplates.ActionResult","azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner":"Azure.ResourceManager.OperationTemplates.ChangeAllowanceResult","azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner":"Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse","azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner":"Azure.ResourceManager.OperationTemplates.ExportResult","azure.resourcemanager.operationtemplates.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","azure.resourcemanager.operationtemplates.fluent.models.OrderInner":"Azure.ResourceManager.OperationTemplates.Order","azure.resourcemanager.operationtemplates.fluent.models.WidgetInner":"Azure.ResourceManager.OperationTemplates.Widget","azure.resourcemanager.operationtemplates.implementation.OperationTemplatesClientBuilder":"Azure.ResourceManager.OperationTemplates","azure.resourcemanager.operationtemplates.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","azure.resourcemanager.operationtemplates.models.ActionRequest":"Azure.ResourceManager.OperationTemplates.ActionRequest","azure.resourcemanager.operationtemplates.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","azure.resourcemanager.operationtemplates.models.ChangeAllowanceRequest":"Azure.ResourceManager.OperationTemplates.ChangeAllowanceRequest","azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityReason":"Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason","azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityRequest":"Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest","azure.resourcemanager.operationtemplates.models.ExportRequest":"Azure.ResourceManager.OperationTemplates.ExportRequest","azure.resourcemanager.operationtemplates.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","azure.resourcemanager.operationtemplates.models.OrderProperties":"Azure.ResourceManager.OperationTemplates.OrderProperties","azure.resourcemanager.operationtemplates.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","azure.resourcemanager.operationtemplates.models.WidgetProperties":"Azure.ResourceManager.OperationTemplates.WidgetProperties"},"generatedFiles":["src/main/java/azure/resourcemanager/operationtemplates/OperationTemplatesManager.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/CheckNameAvailabilitiesClient.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/LroesClient.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationTemplatesClient.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationsClient.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/OptionalBodiesClient.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ActionResultInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ChangeAllowanceResultInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/CheckNameAvailabilityResponseInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ExportResultInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OperationInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OrderInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/WidgetInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/package-info.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/package-info.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/ActionResultImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/ChangeAllowanceResultImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesClientImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilityResponseImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/ExportResultImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesClientImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientBuilder.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsClientImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesClientImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OrderImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/WidgetImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/models/OperationListResult.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/package-info.java","src/main/java/azure/resourcemanager/operationtemplates/models/ActionRequest.java","src/main/java/azure/resourcemanager/operationtemplates/models/ActionResult.java","src/main/java/azure/resourcemanager/operationtemplates/models/ActionType.java","src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceRequest.java","src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceResult.java","src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilities.java","src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityReason.java","src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityRequest.java","src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityResponse.java","src/main/java/azure/resourcemanager/operationtemplates/models/ExportRequest.java","src/main/java/azure/resourcemanager/operationtemplates/models/ExportResult.java","src/main/java/azure/resourcemanager/operationtemplates/models/Lroes.java","src/main/java/azure/resourcemanager/operationtemplates/models/Operation.java","src/main/java/azure/resourcemanager/operationtemplates/models/OperationDisplay.java","src/main/java/azure/resourcemanager/operationtemplates/models/Operations.java","src/main/java/azure/resourcemanager/operationtemplates/models/OptionalBodies.java","src/main/java/azure/resourcemanager/operationtemplates/models/Order.java","src/main/java/azure/resourcemanager/operationtemplates/models/OrderProperties.java","src/main/java/azure/resourcemanager/operationtemplates/models/Origin.java","src/main/java/azure/resourcemanager/operationtemplates/models/Widget.java","src/main/java/azure/resourcemanager/operationtemplates/models/WidgetProperties.java","src/main/java/azure/resourcemanager/operationtemplates/models/package-info.java","src/main/java/azure/resourcemanager/operationtemplates/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_apiview_properties.json deleted file mode 100644 index 817067252c9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_apiview_properties.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient": "Azure.ResourceManager.Resources.ExtensionsResources", - "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.beginCreateOrUpdate": "Azure.ResourceManager.Resources.ExtensionsResources.createOrUpdate", - "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.createOrUpdate": "Azure.ResourceManager.Resources.ExtensionsResources.createOrUpdate", - "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.delete": "Azure.ResourceManager.Resources.ExtensionsResources.delete", - "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.deleteWithResponse": "Azure.ResourceManager.Resources.ExtensionsResources.delete", - "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.get": "Azure.ResourceManager.Resources.ExtensionsResources.get", - "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.getWithResponse": "Azure.ResourceManager.Resources.ExtensionsResources.get", - "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.listByScope": "Azure.ResourceManager.Resources.ExtensionsResources.listByScope", - "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.update": "Azure.ResourceManager.Resources.ExtensionsResources.update", - "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.updateWithResponse": "Azure.ResourceManager.Resources.ExtensionsResources.update", - "azure.resourcemanager.resources.fluent.LocationResourcesClient": "Azure.ResourceManager.Resources.LocationResources", - "azure.resourcemanager.resources.fluent.LocationResourcesClient.createOrUpdate": "Azure.ResourceManager.Resources.LocationResources.createOrUpdate", - "azure.resourcemanager.resources.fluent.LocationResourcesClient.createOrUpdateWithResponse": "Azure.ResourceManager.Resources.LocationResources.createOrUpdate", - "azure.resourcemanager.resources.fluent.LocationResourcesClient.delete": "Azure.ResourceManager.Resources.LocationResources.delete", - "azure.resourcemanager.resources.fluent.LocationResourcesClient.deleteWithResponse": "Azure.ResourceManager.Resources.LocationResources.delete", - "azure.resourcemanager.resources.fluent.LocationResourcesClient.get": "Azure.ResourceManager.Resources.LocationResources.get", - "azure.resourcemanager.resources.fluent.LocationResourcesClient.getWithResponse": "Azure.ResourceManager.Resources.LocationResources.get", - "azure.resourcemanager.resources.fluent.LocationResourcesClient.listByLocation": "Azure.ResourceManager.Resources.LocationResources.listByLocation", - "azure.resourcemanager.resources.fluent.LocationResourcesClient.update": "Azure.ResourceManager.Resources.LocationResources.update", - "azure.resourcemanager.resources.fluent.LocationResourcesClient.updateWithResponse": "Azure.ResourceManager.Resources.LocationResources.update", - "azure.resourcemanager.resources.fluent.NestedsClient": "Azure.ResourceManager.Resources.Nested", - "azure.resourcemanager.resources.fluent.NestedsClient.beginCreateOrReplace": "Azure.ResourceManager.Resources.Nested.createOrReplace", - "azure.resourcemanager.resources.fluent.NestedsClient.beginDelete": "Azure.ResourceManager.Resources.Nested.delete", - "azure.resourcemanager.resources.fluent.NestedsClient.beginUpdate": "Azure.ResourceManager.Resources.Nested.update", - "azure.resourcemanager.resources.fluent.NestedsClient.createOrReplace": "Azure.ResourceManager.Resources.Nested.createOrReplace", - "azure.resourcemanager.resources.fluent.NestedsClient.delete": "Azure.ResourceManager.Resources.Nested.delete", - "azure.resourcemanager.resources.fluent.NestedsClient.get": "Azure.ResourceManager.Resources.Nested.get", - "azure.resourcemanager.resources.fluent.NestedsClient.getWithResponse": "Azure.ResourceManager.Resources.Nested.get", - "azure.resourcemanager.resources.fluent.NestedsClient.listByTopLevelTrackedResource": "Azure.ResourceManager.Resources.Nested.listByTopLevelTrackedResource", - "azure.resourcemanager.resources.fluent.NestedsClient.update": "Azure.ResourceManager.Resources.Nested.update", - "azure.resourcemanager.resources.fluent.ResourcesClient": "Azure.ResourceManager.Resources", - "azure.resourcemanager.resources.fluent.SingletonsClient": "Azure.ResourceManager.Resources.Singleton", - "azure.resourcemanager.resources.fluent.SingletonsClient.beginCreateOrUpdate": "Azure.ResourceManager.Resources.Singleton.createOrUpdate", - "azure.resourcemanager.resources.fluent.SingletonsClient.createOrUpdate": "Azure.ResourceManager.Resources.Singleton.createOrUpdate", - "azure.resourcemanager.resources.fluent.SingletonsClient.getByResourceGroup": "Azure.ResourceManager.Resources.Singleton.getByResourceGroup", - "azure.resourcemanager.resources.fluent.SingletonsClient.getByResourceGroupWithResponse": "Azure.ResourceManager.Resources.Singleton.getByResourceGroup", - "azure.resourcemanager.resources.fluent.SingletonsClient.listByResourceGroup": "Azure.ResourceManager.Resources.Singleton.listByResourceGroup", - "azure.resourcemanager.resources.fluent.SingletonsClient.update": "Azure.ResourceManager.Resources.Singleton.update", - "azure.resourcemanager.resources.fluent.SingletonsClient.updateWithResponse": "Azure.ResourceManager.Resources.Singleton.update", - "azure.resourcemanager.resources.fluent.TopLevelsClient": "Azure.ResourceManager.Resources.TopLevel", - "azure.resourcemanager.resources.fluent.TopLevelsClient.actionSync": "Azure.ResourceManager.Resources.TopLevel.actionSync", - "azure.resourcemanager.resources.fluent.TopLevelsClient.actionSyncWithResponse": "Azure.ResourceManager.Resources.TopLevel.actionSync", - "azure.resourcemanager.resources.fluent.TopLevelsClient.beginCreateOrReplace": "Azure.ResourceManager.Resources.TopLevel.createOrReplace", - "azure.resourcemanager.resources.fluent.TopLevelsClient.beginDelete": "Azure.ResourceManager.Resources.TopLevel.delete", - "azure.resourcemanager.resources.fluent.TopLevelsClient.beginUpdate": "Azure.ResourceManager.Resources.TopLevel.update", - "azure.resourcemanager.resources.fluent.TopLevelsClient.createOrReplace": "Azure.ResourceManager.Resources.TopLevel.createOrReplace", - "azure.resourcemanager.resources.fluent.TopLevelsClient.delete": "Azure.ResourceManager.Resources.TopLevel.delete", - "azure.resourcemanager.resources.fluent.TopLevelsClient.getByResourceGroup": "Azure.ResourceManager.Resources.TopLevel.get", - "azure.resourcemanager.resources.fluent.TopLevelsClient.getByResourceGroupWithResponse": "Azure.ResourceManager.Resources.TopLevel.get", - "azure.resourcemanager.resources.fluent.TopLevelsClient.list": "Azure.ResourceManager.Resources.TopLevel.listBySubscription", - "azure.resourcemanager.resources.fluent.TopLevelsClient.listByResourceGroup": "Azure.ResourceManager.Resources.TopLevel.listByResourceGroup", - "azure.resourcemanager.resources.fluent.TopLevelsClient.update": "Azure.ResourceManager.Resources.TopLevel.update", - "azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner": "Azure.ResourceManager.Resources.ExtensionsResource", - "azure.resourcemanager.resources.fluent.models.LocationResourceInner": "Azure.ResourceManager.Resources.LocationResource", - "azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner": "Azure.ResourceManager.Resources.NestedProxyResource", - "azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner": "Azure.ResourceManager.Resources.SingletonTrackedResource", - "azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner": "Azure.ResourceManager.Resources.TopLevelTrackedResource", - "azure.resourcemanager.resources.implementation.ResourcesClientBuilder": "Azure.ResourceManager.Resources", - "azure.resourcemanager.resources.implementation.models.ExtensionsResourceListResult": "Azure.ResourceManager.ResourceListResult", - "azure.resourcemanager.resources.implementation.models.LocationResourceListResult": "Azure.ResourceManager.ResourceListResult", - "azure.resourcemanager.resources.implementation.models.NestedProxyResourceListResult": "Azure.ResourceManager.ResourceListResult", - "azure.resourcemanager.resources.implementation.models.SingletonTrackedResourceListResult": "Azure.ResourceManager.ResourceListResult", - "azure.resourcemanager.resources.implementation.models.TopLevelTrackedResourceListResult": "Azure.ResourceManager.ResourceListResult", - "azure.resourcemanager.resources.models.ExtensionsResourceProperties": "Azure.ResourceManager.Resources.ExtensionsResourceProperties", - "azure.resourcemanager.resources.models.LocationResourceProperties": "Azure.ResourceManager.Resources.LocationResourceProperties", - "azure.resourcemanager.resources.models.NestedProxyResourceProperties": "Azure.ResourceManager.Resources.NestedProxyResourceProperties", - "azure.resourcemanager.resources.models.NotificationDetails": "Azure.ResourceManager.Resources.NotificationDetails", - "azure.resourcemanager.resources.models.ProvisioningState": "Azure.ResourceManager.Resources.ProvisioningState", - "azure.resourcemanager.resources.models.SingletonTrackedResourceProperties": "Azure.ResourceManager.Resources.SingletonTrackedResourceProperties", - "azure.resourcemanager.resources.models.TopLevelTrackedResourceProperties": "Azure.ResourceManager.Resources.TopLevelTrackedResourceProperties" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_metadata.json deleted file mode 100644 index bf88404e1d9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"azure.resourcemanager.resources.fluent.ExtensionsResourcesClient":"Azure.ResourceManager.Resources.ExtensionsResources","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.beginCreateOrUpdate":"Azure.ResourceManager.Resources.ExtensionsResources.createOrUpdate","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.createOrUpdate":"Azure.ResourceManager.Resources.ExtensionsResources.createOrUpdate","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.delete":"Azure.ResourceManager.Resources.ExtensionsResources.delete","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.deleteWithResponse":"Azure.ResourceManager.Resources.ExtensionsResources.delete","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.get":"Azure.ResourceManager.Resources.ExtensionsResources.get","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.getWithResponse":"Azure.ResourceManager.Resources.ExtensionsResources.get","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.listByScope":"Azure.ResourceManager.Resources.ExtensionsResources.listByScope","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.update":"Azure.ResourceManager.Resources.ExtensionsResources.update","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.updateWithResponse":"Azure.ResourceManager.Resources.ExtensionsResources.update","azure.resourcemanager.resources.fluent.LocationResourcesClient":"Azure.ResourceManager.Resources.LocationResources","azure.resourcemanager.resources.fluent.LocationResourcesClient.createOrUpdate":"Azure.ResourceManager.Resources.LocationResources.createOrUpdate","azure.resourcemanager.resources.fluent.LocationResourcesClient.createOrUpdateWithResponse":"Azure.ResourceManager.Resources.LocationResources.createOrUpdate","azure.resourcemanager.resources.fluent.LocationResourcesClient.delete":"Azure.ResourceManager.Resources.LocationResources.delete","azure.resourcemanager.resources.fluent.LocationResourcesClient.deleteWithResponse":"Azure.ResourceManager.Resources.LocationResources.delete","azure.resourcemanager.resources.fluent.LocationResourcesClient.get":"Azure.ResourceManager.Resources.LocationResources.get","azure.resourcemanager.resources.fluent.LocationResourcesClient.getWithResponse":"Azure.ResourceManager.Resources.LocationResources.get","azure.resourcemanager.resources.fluent.LocationResourcesClient.listByLocation":"Azure.ResourceManager.Resources.LocationResources.listByLocation","azure.resourcemanager.resources.fluent.LocationResourcesClient.update":"Azure.ResourceManager.Resources.LocationResources.update","azure.resourcemanager.resources.fluent.LocationResourcesClient.updateWithResponse":"Azure.ResourceManager.Resources.LocationResources.update","azure.resourcemanager.resources.fluent.NestedsClient":"Azure.ResourceManager.Resources.Nested","azure.resourcemanager.resources.fluent.NestedsClient.beginCreateOrReplace":"Azure.ResourceManager.Resources.Nested.createOrReplace","azure.resourcemanager.resources.fluent.NestedsClient.beginDelete":"Azure.ResourceManager.Resources.Nested.delete","azure.resourcemanager.resources.fluent.NestedsClient.beginUpdate":"Azure.ResourceManager.Resources.Nested.update","azure.resourcemanager.resources.fluent.NestedsClient.createOrReplace":"Azure.ResourceManager.Resources.Nested.createOrReplace","azure.resourcemanager.resources.fluent.NestedsClient.delete":"Azure.ResourceManager.Resources.Nested.delete","azure.resourcemanager.resources.fluent.NestedsClient.get":"Azure.ResourceManager.Resources.Nested.get","azure.resourcemanager.resources.fluent.NestedsClient.getWithResponse":"Azure.ResourceManager.Resources.Nested.get","azure.resourcemanager.resources.fluent.NestedsClient.listByTopLevelTrackedResource":"Azure.ResourceManager.Resources.Nested.listByTopLevelTrackedResource","azure.resourcemanager.resources.fluent.NestedsClient.update":"Azure.ResourceManager.Resources.Nested.update","azure.resourcemanager.resources.fluent.ResourcesClient":"Azure.ResourceManager.Resources","azure.resourcemanager.resources.fluent.SingletonsClient":"Azure.ResourceManager.Resources.Singleton","azure.resourcemanager.resources.fluent.SingletonsClient.beginCreateOrUpdate":"Azure.ResourceManager.Resources.Singleton.createOrUpdate","azure.resourcemanager.resources.fluent.SingletonsClient.createOrUpdate":"Azure.ResourceManager.Resources.Singleton.createOrUpdate","azure.resourcemanager.resources.fluent.SingletonsClient.getByResourceGroup":"Azure.ResourceManager.Resources.Singleton.getByResourceGroup","azure.resourcemanager.resources.fluent.SingletonsClient.getByResourceGroupWithResponse":"Azure.ResourceManager.Resources.Singleton.getByResourceGroup","azure.resourcemanager.resources.fluent.SingletonsClient.listByResourceGroup":"Azure.ResourceManager.Resources.Singleton.listByResourceGroup","azure.resourcemanager.resources.fluent.SingletonsClient.update":"Azure.ResourceManager.Resources.Singleton.update","azure.resourcemanager.resources.fluent.SingletonsClient.updateWithResponse":"Azure.ResourceManager.Resources.Singleton.update","azure.resourcemanager.resources.fluent.TopLevelsClient":"Azure.ResourceManager.Resources.TopLevel","azure.resourcemanager.resources.fluent.TopLevelsClient.actionSync":"Azure.ResourceManager.Resources.TopLevel.actionSync","azure.resourcemanager.resources.fluent.TopLevelsClient.actionSyncWithResponse":"Azure.ResourceManager.Resources.TopLevel.actionSync","azure.resourcemanager.resources.fluent.TopLevelsClient.beginCreateOrReplace":"Azure.ResourceManager.Resources.TopLevel.createOrReplace","azure.resourcemanager.resources.fluent.TopLevelsClient.beginDelete":"Azure.ResourceManager.Resources.TopLevel.delete","azure.resourcemanager.resources.fluent.TopLevelsClient.beginUpdate":"Azure.ResourceManager.Resources.TopLevel.update","azure.resourcemanager.resources.fluent.TopLevelsClient.createOrReplace":"Azure.ResourceManager.Resources.TopLevel.createOrReplace","azure.resourcemanager.resources.fluent.TopLevelsClient.delete":"Azure.ResourceManager.Resources.TopLevel.delete","azure.resourcemanager.resources.fluent.TopLevelsClient.getByResourceGroup":"Azure.ResourceManager.Resources.TopLevel.get","azure.resourcemanager.resources.fluent.TopLevelsClient.getByResourceGroupWithResponse":"Azure.ResourceManager.Resources.TopLevel.get","azure.resourcemanager.resources.fluent.TopLevelsClient.list":"Azure.ResourceManager.Resources.TopLevel.listBySubscription","azure.resourcemanager.resources.fluent.TopLevelsClient.listByResourceGroup":"Azure.ResourceManager.Resources.TopLevel.listByResourceGroup","azure.resourcemanager.resources.fluent.TopLevelsClient.update":"Azure.ResourceManager.Resources.TopLevel.update","azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner":"Azure.ResourceManager.Resources.ExtensionsResource","azure.resourcemanager.resources.fluent.models.LocationResourceInner":"Azure.ResourceManager.Resources.LocationResource","azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner":"Azure.ResourceManager.Resources.NestedProxyResource","azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner":"Azure.ResourceManager.Resources.SingletonTrackedResource","azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner":"Azure.ResourceManager.Resources.TopLevelTrackedResource","azure.resourcemanager.resources.implementation.ResourcesClientBuilder":"Azure.ResourceManager.Resources","azure.resourcemanager.resources.implementation.models.ExtensionsResourceListResult":"Azure.ResourceManager.ResourceListResult","azure.resourcemanager.resources.implementation.models.LocationResourceListResult":"Azure.ResourceManager.ResourceListResult","azure.resourcemanager.resources.implementation.models.NestedProxyResourceListResult":"Azure.ResourceManager.ResourceListResult","azure.resourcemanager.resources.implementation.models.SingletonTrackedResourceListResult":"Azure.ResourceManager.ResourceListResult","azure.resourcemanager.resources.implementation.models.TopLevelTrackedResourceListResult":"Azure.ResourceManager.ResourceListResult","azure.resourcemanager.resources.models.ExtensionsResourceProperties":"Azure.ResourceManager.Resources.ExtensionsResourceProperties","azure.resourcemanager.resources.models.LocationResourceProperties":"Azure.ResourceManager.Resources.LocationResourceProperties","azure.resourcemanager.resources.models.NestedProxyResourceProperties":"Azure.ResourceManager.Resources.NestedProxyResourceProperties","azure.resourcemanager.resources.models.NotificationDetails":"Azure.ResourceManager.Resources.NotificationDetails","azure.resourcemanager.resources.models.ProvisioningState":"Azure.ResourceManager.Resources.ProvisioningState","azure.resourcemanager.resources.models.SingletonTrackedResourceProperties":"Azure.ResourceManager.Resources.SingletonTrackedResourceProperties","azure.resourcemanager.resources.models.TopLevelTrackedResourceProperties":"Azure.ResourceManager.Resources.TopLevelTrackedResourceProperties"},"generatedFiles":["src/main/java/azure/resourcemanager/resources/ResourcesManager.java","src/main/java/azure/resourcemanager/resources/fluent/ExtensionsResourcesClient.java","src/main/java/azure/resourcemanager/resources/fluent/LocationResourcesClient.java","src/main/java/azure/resourcemanager/resources/fluent/NestedsClient.java","src/main/java/azure/resourcemanager/resources/fluent/ResourcesClient.java","src/main/java/azure/resourcemanager/resources/fluent/SingletonsClient.java","src/main/java/azure/resourcemanager/resources/fluent/TopLevelsClient.java","src/main/java/azure/resourcemanager/resources/fluent/models/ExtensionsResourceInner.java","src/main/java/azure/resourcemanager/resources/fluent/models/LocationResourceInner.java","src/main/java/azure/resourcemanager/resources/fluent/models/NestedProxyResourceInner.java","src/main/java/azure/resourcemanager/resources/fluent/models/SingletonTrackedResourceInner.java","src/main/java/azure/resourcemanager/resources/fluent/models/TopLevelTrackedResourceInner.java","src/main/java/azure/resourcemanager/resources/fluent/models/package-info.java","src/main/java/azure/resourcemanager/resources/fluent/package-info.java","src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourceImpl.java","src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesClientImpl.java","src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesImpl.java","src/main/java/azure/resourcemanager/resources/implementation/LocationResourceImpl.java","src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesClientImpl.java","src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesImpl.java","src/main/java/azure/resourcemanager/resources/implementation/NestedProxyResourceImpl.java","src/main/java/azure/resourcemanager/resources/implementation/NestedsClientImpl.java","src/main/java/azure/resourcemanager/resources/implementation/NestedsImpl.java","src/main/java/azure/resourcemanager/resources/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientBuilder.java","src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientImpl.java","src/main/java/azure/resourcemanager/resources/implementation/SingletonTrackedResourceImpl.java","src/main/java/azure/resourcemanager/resources/implementation/SingletonsClientImpl.java","src/main/java/azure/resourcemanager/resources/implementation/SingletonsImpl.java","src/main/java/azure/resourcemanager/resources/implementation/TopLevelTrackedResourceImpl.java","src/main/java/azure/resourcemanager/resources/implementation/TopLevelsClientImpl.java","src/main/java/azure/resourcemanager/resources/implementation/TopLevelsImpl.java","src/main/java/azure/resourcemanager/resources/implementation/models/ExtensionsResourceListResult.java","src/main/java/azure/resourcemanager/resources/implementation/models/LocationResourceListResult.java","src/main/java/azure/resourcemanager/resources/implementation/models/NestedProxyResourceListResult.java","src/main/java/azure/resourcemanager/resources/implementation/models/SingletonTrackedResourceListResult.java","src/main/java/azure/resourcemanager/resources/implementation/models/TopLevelTrackedResourceListResult.java","src/main/java/azure/resourcemanager/resources/implementation/package-info.java","src/main/java/azure/resourcemanager/resources/models/ExtensionsResource.java","src/main/java/azure/resourcemanager/resources/models/ExtensionsResourceProperties.java","src/main/java/azure/resourcemanager/resources/models/ExtensionsResources.java","src/main/java/azure/resourcemanager/resources/models/LocationResource.java","src/main/java/azure/resourcemanager/resources/models/LocationResourceProperties.java","src/main/java/azure/resourcemanager/resources/models/LocationResources.java","src/main/java/azure/resourcemanager/resources/models/NestedProxyResource.java","src/main/java/azure/resourcemanager/resources/models/NestedProxyResourceProperties.java","src/main/java/azure/resourcemanager/resources/models/Nesteds.java","src/main/java/azure/resourcemanager/resources/models/NotificationDetails.java","src/main/java/azure/resourcemanager/resources/models/ProvisioningState.java","src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResource.java","src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResourceProperties.java","src/main/java/azure/resourcemanager/resources/models/Singletons.java","src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResource.java","src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResourceProperties.java","src/main/java/azure/resourcemanager/resources/models/TopLevels.java","src/main/java/azure/resourcemanager/resources/models/package-info.java","src/main/java/azure/resourcemanager/resources/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_apiview_properties.json deleted file mode 100644 index ab80c581358..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_apiview_properties.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdAsyncClient": "Azure.SpecialHeaders.XmsClientRequestId", - "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdAsyncClient.get": "Azure.SpecialHeaders.XmsClientRequestId.get", - "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdAsyncClient.getWithResponse": "Azure.SpecialHeaders.XmsClientRequestId.get", - "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient": "Azure.SpecialHeaders.XmsClientRequestId", - "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient.get": "Azure.SpecialHeaders.XmsClientRequestId.get", - "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient.getWithResponse": "Azure.SpecialHeaders.XmsClientRequestId.get", - "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClientBuilder": "Azure.SpecialHeaders.XmsClientRequestId" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_metadata.json deleted file mode 100644 index 86eec9b4669..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"azure.specialheaders.xmsclientrequestid.XmsClientRequestIdAsyncClient":"Azure.SpecialHeaders.XmsClientRequestId","azure.specialheaders.xmsclientrequestid.XmsClientRequestIdAsyncClient.get":"Azure.SpecialHeaders.XmsClientRequestId.get","azure.specialheaders.xmsclientrequestid.XmsClientRequestIdAsyncClient.getWithResponse":"Azure.SpecialHeaders.XmsClientRequestId.get","azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient":"Azure.SpecialHeaders.XmsClientRequestId","azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient.get":"Azure.SpecialHeaders.XmsClientRequestId.get","azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient.getWithResponse":"Azure.SpecialHeaders.XmsClientRequestId.get","azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClientBuilder":"Azure.SpecialHeaders.XmsClientRequestId"},"generatedFiles":["src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdAsyncClient.java","src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClient.java","src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClientBuilder.java","src/main/java/azure/specialheaders/xmsclientrequestid/implementation/XmsClientRequestIdClientImpl.java","src/main/java/azure/specialheaders/xmsclientrequestid/implementation/package-info.java","src/main/java/azure/specialheaders/xmsclientrequestid/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_apiview_properties.json deleted file mode 100644 index bd69a696a6d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_apiview_properties.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "azure.versioning.previewversion.PreviewVersionAsyncClient": "_Specs_.Azure.Versioning.PreviewVersion", - "azure.versioning.previewversion.PreviewVersionAsyncClient.getWidget": "_Specs_.Azure.Versioning.PreviewVersion.getWidget", - "azure.versioning.previewversion.PreviewVersionAsyncClient.getWidgetWithResponse": "_Specs_.Azure.Versioning.PreviewVersion.getWidget", - "azure.versioning.previewversion.PreviewVersionAsyncClient.listWidgets": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets", - "azure.versioning.previewversion.PreviewVersionAsyncClient.listWidgetsWithResponse": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets", - "azure.versioning.previewversion.PreviewVersionAsyncClient.updateWidgetColor": "_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor", - "azure.versioning.previewversion.PreviewVersionAsyncClient.updateWidgetColorWithResponse": "_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor", - "azure.versioning.previewversion.PreviewVersionClient": "_Specs_.Azure.Versioning.PreviewVersion", - "azure.versioning.previewversion.PreviewVersionClient.getWidget": "_Specs_.Azure.Versioning.PreviewVersion.getWidget", - "azure.versioning.previewversion.PreviewVersionClient.getWidgetWithResponse": "_Specs_.Azure.Versioning.PreviewVersion.getWidget", - "azure.versioning.previewversion.PreviewVersionClient.listWidgets": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets", - "azure.versioning.previewversion.PreviewVersionClient.listWidgetsWithResponse": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets", - "azure.versioning.previewversion.PreviewVersionClient.updateWidgetColor": "_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor", - "azure.versioning.previewversion.PreviewVersionClient.updateWidgetColorWithResponse": "_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor", - "azure.versioning.previewversion.PreviewVersionClientBuilder": "_Specs_.Azure.Versioning.PreviewVersion", - "azure.versioning.previewversion.models.ListWidgetsResponse": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets.Response.anonymous", - "azure.versioning.previewversion.models.UpdateWidgetColorRequest": "_Specs_.Azure.Versioning.PreviewVersion.UpdateWidgetColorRequest", - "azure.versioning.previewversion.models.Widget": "_Specs_.Azure.Versioning.PreviewVersion.Widget" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_metadata.json deleted file mode 100644 index 036009afc6f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2024-12-01-preview","crossLanguageDefinitions":{"azure.versioning.previewversion.PreviewVersionAsyncClient":"_Specs_.Azure.Versioning.PreviewVersion","azure.versioning.previewversion.PreviewVersionAsyncClient.getWidget":"_Specs_.Azure.Versioning.PreviewVersion.getWidget","azure.versioning.previewversion.PreviewVersionAsyncClient.getWidgetWithResponse":"_Specs_.Azure.Versioning.PreviewVersion.getWidget","azure.versioning.previewversion.PreviewVersionAsyncClient.listWidgets":"_Specs_.Azure.Versioning.PreviewVersion.listWidgets","azure.versioning.previewversion.PreviewVersionAsyncClient.listWidgetsWithResponse":"_Specs_.Azure.Versioning.PreviewVersion.listWidgets","azure.versioning.previewversion.PreviewVersionAsyncClient.updateWidgetColor":"_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor","azure.versioning.previewversion.PreviewVersionAsyncClient.updateWidgetColorWithResponse":"_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor","azure.versioning.previewversion.PreviewVersionClient":"_Specs_.Azure.Versioning.PreviewVersion","azure.versioning.previewversion.PreviewVersionClient.getWidget":"_Specs_.Azure.Versioning.PreviewVersion.getWidget","azure.versioning.previewversion.PreviewVersionClient.getWidgetWithResponse":"_Specs_.Azure.Versioning.PreviewVersion.getWidget","azure.versioning.previewversion.PreviewVersionClient.listWidgets":"_Specs_.Azure.Versioning.PreviewVersion.listWidgets","azure.versioning.previewversion.PreviewVersionClient.listWidgetsWithResponse":"_Specs_.Azure.Versioning.PreviewVersion.listWidgets","azure.versioning.previewversion.PreviewVersionClient.updateWidgetColor":"_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor","azure.versioning.previewversion.PreviewVersionClient.updateWidgetColorWithResponse":"_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor","azure.versioning.previewversion.PreviewVersionClientBuilder":"_Specs_.Azure.Versioning.PreviewVersion","azure.versioning.previewversion.models.ListWidgetsResponse":"_Specs_.Azure.Versioning.PreviewVersion.listWidgets.Response.anonymous","azure.versioning.previewversion.models.UpdateWidgetColorRequest":"_Specs_.Azure.Versioning.PreviewVersion.UpdateWidgetColorRequest","azure.versioning.previewversion.models.Widget":"_Specs_.Azure.Versioning.PreviewVersion.Widget"},"generatedFiles":["src/main/java/azure/versioning/previewversion/PreviewVersionAsyncClient.java","src/main/java/azure/versioning/previewversion/PreviewVersionClient.java","src/main/java/azure/versioning/previewversion/PreviewVersionClientBuilder.java","src/main/java/azure/versioning/previewversion/PreviewVersionServiceVersion.java","src/main/java/azure/versioning/previewversion/implementation/JsonMergePatchHelper.java","src/main/java/azure/versioning/previewversion/implementation/PreviewVersionClientImpl.java","src/main/java/azure/versioning/previewversion/implementation/package-info.java","src/main/java/azure/versioning/previewversion/models/ListWidgetsResponse.java","src/main/java/azure/versioning/previewversion/models/UpdateWidgetColorRequest.java","src/main/java/azure/versioning/previewversion/models/Widget.java","src/main/java/azure/versioning/previewversion/models/package-info.java","src/main/java/azure/versioning/previewversion/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_apiview_properties.json deleted file mode 100644 index d59cf7dae7c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_apiview_properties.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "client.clientnamespace.ClientNamespaceFirstAsyncClient": "ClientNameSpaceClient.ClientNamespaceFirstClient", - "client.clientnamespace.ClientNamespaceFirstAsyncClient.getFirst": "ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst", - "client.clientnamespace.ClientNamespaceFirstAsyncClient.getFirstWithResponse": "ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst", - "client.clientnamespace.ClientNamespaceFirstClient": "ClientNameSpaceClient.ClientNamespaceFirstClient", - "client.clientnamespace.ClientNamespaceFirstClient.getFirst": "ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst", - "client.clientnamespace.ClientNamespaceFirstClient.getFirstWithResponse": "ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst", - "client.clientnamespace.ClientNamespaceFirstClientBuilder": "ClientNameSpaceClient.ClientNamespaceFirstClient", - "client.clientnamespace.first.models.FirstClientResult": "Client.ClientNamespace.FirstModel.FirstClientResult", - "client.clientnamespace.second.ClientNamespaceSecondAsyncClient": "ClientNameSpaceClient.ClientNamespaceSecondClient", - "client.clientnamespace.second.ClientNamespaceSecondAsyncClient.getSecond": "ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond", - "client.clientnamespace.second.ClientNamespaceSecondAsyncClient.getSecondWithResponse": "ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond", - "client.clientnamespace.second.ClientNamespaceSecondClient": "ClientNameSpaceClient.ClientNamespaceSecondClient", - "client.clientnamespace.second.ClientNamespaceSecondClient.getSecond": "ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond", - "client.clientnamespace.second.ClientNamespaceSecondClient.getSecondWithResponse": "ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond", - "client.clientnamespace.second.ClientNamespaceSecondClientBuilder": "ClientNameSpaceClient.ClientNamespaceSecondClient", - "client.clientnamespace.second.models.SecondClientResult": "Client.ClientNamespace.Second.Model.SecondClientResult", - "client.clientnamespace.second.sub.models.SecondClientEnumType": "Client.ClientNamespace.Second.Model.SecondClientEnumType" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_metadata.json deleted file mode 100644 index cfa23759df2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"client.clientnamespace.ClientNamespaceFirstAsyncClient":"ClientNameSpaceClient.ClientNamespaceFirstClient","client.clientnamespace.ClientNamespaceFirstAsyncClient.getFirst":"ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst","client.clientnamespace.ClientNamespaceFirstAsyncClient.getFirstWithResponse":"ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst","client.clientnamespace.ClientNamespaceFirstClient":"ClientNameSpaceClient.ClientNamespaceFirstClient","client.clientnamespace.ClientNamespaceFirstClient.getFirst":"ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst","client.clientnamespace.ClientNamespaceFirstClient.getFirstWithResponse":"ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst","client.clientnamespace.ClientNamespaceFirstClientBuilder":"ClientNameSpaceClient.ClientNamespaceFirstClient","client.clientnamespace.first.models.FirstClientResult":"Client.ClientNamespace.FirstModel.FirstClientResult","client.clientnamespace.second.ClientNamespaceSecondAsyncClient":"ClientNameSpaceClient.ClientNamespaceSecondClient","client.clientnamespace.second.ClientNamespaceSecondAsyncClient.getSecond":"ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond","client.clientnamespace.second.ClientNamespaceSecondAsyncClient.getSecondWithResponse":"ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond","client.clientnamespace.second.ClientNamespaceSecondClient":"ClientNameSpaceClient.ClientNamespaceSecondClient","client.clientnamespace.second.ClientNamespaceSecondClient.getSecond":"ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond","client.clientnamespace.second.ClientNamespaceSecondClient.getSecondWithResponse":"ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond","client.clientnamespace.second.ClientNamespaceSecondClientBuilder":"ClientNameSpaceClient.ClientNamespaceSecondClient","client.clientnamespace.second.models.SecondClientResult":"Client.ClientNamespace.Second.Model.SecondClientResult","client.clientnamespace.second.sub.models.SecondClientEnumType":"Client.ClientNamespace.Second.Model.SecondClientEnumType"},"generatedFiles":["src/main/java/client/clientnamespace/ClientNamespaceFirstAsyncClient.java","src/main/java/client/clientnamespace/ClientNamespaceFirstClient.java","src/main/java/client/clientnamespace/ClientNamespaceFirstClientBuilder.java","src/main/java/client/clientnamespace/first/models/FirstClientResult.java","src/main/java/client/clientnamespace/first/models/package-info.java","src/main/java/client/clientnamespace/implementation/ClientNamespaceFirstClientImpl.java","src/main/java/client/clientnamespace/implementation/ClientNamespaceSecondClientImpl.java","src/main/java/client/clientnamespace/implementation/package-info.java","src/main/java/client/clientnamespace/package-info.java","src/main/java/client/clientnamespace/second/ClientNamespaceSecondAsyncClient.java","src/main/java/client/clientnamespace/second/ClientNamespaceSecondClient.java","src/main/java/client/clientnamespace/second/ClientNamespaceSecondClientBuilder.java","src/main/java/client/clientnamespace/second/models/SecondClientResult.java","src/main/java/client/clientnamespace/second/models/package-info.java","src/main/java/client/clientnamespace/second/package-info.java","src/main/java/client/clientnamespace/second/sub/models/SecondClientEnumType.java","src/main/java/client/clientnamespace/second/sub/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_apiview_properties.json deleted file mode 100644 index a4831a5f744..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_apiview_properties.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "client.naming.enumconflict.EnumConflictClientBuilder": "Client.Naming.EnumConflict", - "client.naming.enumconflict.FirstOperationsAsyncClient": "Client.Naming.EnumConflict.FirstOperations", - "client.naming.enumconflict.FirstOperationsAsyncClient.first": "Client.Naming.EnumConflict.FirstOperations.first", - "client.naming.enumconflict.FirstOperationsAsyncClient.firstWithResponse": "Client.Naming.EnumConflict.FirstOperations.first", - "client.naming.enumconflict.FirstOperationsClient": "Client.Naming.EnumConflict.FirstOperations", - "client.naming.enumconflict.FirstOperationsClient.first": "Client.Naming.EnumConflict.FirstOperations.first", - "client.naming.enumconflict.FirstOperationsClient.firstWithResponse": "Client.Naming.EnumConflict.FirstOperations.first", - "client.naming.enumconflict.SecondOperationsAsyncClient": "Client.Naming.EnumConflict.SecondOperations", - "client.naming.enumconflict.SecondOperationsAsyncClient.second": "Client.Naming.EnumConflict.SecondOperations.second", - "client.naming.enumconflict.SecondOperationsAsyncClient.secondWithResponse": "Client.Naming.EnumConflict.SecondOperations.second", - "client.naming.enumconflict.SecondOperationsClient": "Client.Naming.EnumConflict.SecondOperations", - "client.naming.enumconflict.SecondOperationsClient.second": "Client.Naming.EnumConflict.SecondOperations.second", - "client.naming.enumconflict.SecondOperationsClient.secondWithResponse": "Client.Naming.EnumConflict.SecondOperations.second", - "client.naming.enumconflict.firstnamespace.models.FirstModel": "Client.Naming.EnumConflict.FirstNamespace.FirstModel", - "client.naming.enumconflict.firstnamespace.models.Status": "Client.Naming.EnumConflict.FirstNamespace.Status", - "client.naming.enumconflict.secondnamespace.models.SecondModel": "Client.Naming.EnumConflict.SecondNamespace.SecondModel", - "client.naming.enumconflict.secondnamespace.models.SecondStatus": "Client.Naming.EnumConflict.SecondNamespace.Status" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_metadata.json deleted file mode 100644 index 654827ac5b6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"client.naming.enumconflict.EnumConflictClientBuilder":"Client.Naming.EnumConflict","client.naming.enumconflict.FirstOperationsAsyncClient":"Client.Naming.EnumConflict.FirstOperations","client.naming.enumconflict.FirstOperationsAsyncClient.first":"Client.Naming.EnumConflict.FirstOperations.first","client.naming.enumconflict.FirstOperationsAsyncClient.firstWithResponse":"Client.Naming.EnumConflict.FirstOperations.first","client.naming.enumconflict.FirstOperationsClient":"Client.Naming.EnumConflict.FirstOperations","client.naming.enumconflict.FirstOperationsClient.first":"Client.Naming.EnumConflict.FirstOperations.first","client.naming.enumconflict.FirstOperationsClient.firstWithResponse":"Client.Naming.EnumConflict.FirstOperations.first","client.naming.enumconflict.SecondOperationsAsyncClient":"Client.Naming.EnumConflict.SecondOperations","client.naming.enumconflict.SecondOperationsAsyncClient.second":"Client.Naming.EnumConflict.SecondOperations.second","client.naming.enumconflict.SecondOperationsAsyncClient.secondWithResponse":"Client.Naming.EnumConflict.SecondOperations.second","client.naming.enumconflict.SecondOperationsClient":"Client.Naming.EnumConflict.SecondOperations","client.naming.enumconflict.SecondOperationsClient.second":"Client.Naming.EnumConflict.SecondOperations.second","client.naming.enumconflict.SecondOperationsClient.secondWithResponse":"Client.Naming.EnumConflict.SecondOperations.second","client.naming.enumconflict.firstnamespace.models.FirstModel":"Client.Naming.EnumConflict.FirstNamespace.FirstModel","client.naming.enumconflict.firstnamespace.models.Status":"Client.Naming.EnumConflict.FirstNamespace.Status","client.naming.enumconflict.secondnamespace.models.SecondModel":"Client.Naming.EnumConflict.SecondNamespace.SecondModel","client.naming.enumconflict.secondnamespace.models.SecondStatus":"Client.Naming.EnumConflict.SecondNamespace.Status"},"generatedFiles":["src/main/java/client/naming/enumconflict/EnumConflictClientBuilder.java","src/main/java/client/naming/enumconflict/FirstOperationsAsyncClient.java","src/main/java/client/naming/enumconflict/FirstOperationsClient.java","src/main/java/client/naming/enumconflict/SecondOperationsAsyncClient.java","src/main/java/client/naming/enumconflict/SecondOperationsClient.java","src/main/java/client/naming/enumconflict/firstnamespace/models/FirstModel.java","src/main/java/client/naming/enumconflict/firstnamespace/models/Status.java","src/main/java/client/naming/enumconflict/firstnamespace/models/package-info.java","src/main/java/client/naming/enumconflict/implementation/EnumConflictClientImpl.java","src/main/java/client/naming/enumconflict/implementation/FirstOperationsImpl.java","src/main/java/client/naming/enumconflict/implementation/SecondOperationsImpl.java","src/main/java/client/naming/enumconflict/implementation/package-info.java","src/main/java/client/naming/enumconflict/package-info.java","src/main/java/client/naming/enumconflict/secondnamespace/models/SecondModel.java","src/main/java/client/naming/enumconflict/secondnamespace/models/SecondStatus.java","src/main/java/client/naming/enumconflict/secondnamespace/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_apiview_properties.json deleted file mode 100644 index 40f6085435d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_apiview_properties.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "client.naming.ModelAsyncClient": "Client.Naming.Model", - "client.naming.ModelAsyncClient.client": "Client.Naming.Model.client", - "client.naming.ModelAsyncClient.clientWithResponse": "Client.Naming.Model.client", - "client.naming.ModelAsyncClient.language": "Client.Naming.Model.language", - "client.naming.ModelAsyncClient.languageWithResponse": "Client.Naming.Model.language", - "client.naming.ModelClient": "Client.Naming.Model", - "client.naming.ModelClient.client": "Client.Naming.Model.client", - "client.naming.ModelClient.clientWithResponse": "Client.Naming.Model.client", - "client.naming.ModelClient.language": "Client.Naming.Model.language", - "client.naming.ModelClient.languageWithResponse": "Client.Naming.Model.language", - "client.naming.NamingAsyncClient": "Client.Naming", - "client.naming.NamingAsyncClient.client": "Client.Naming.Property.client", - "client.naming.NamingAsyncClient.clientName": "Client.Naming.operation", - "client.naming.NamingAsyncClient.clientNameWithResponse": "Client.Naming.operation", - "client.naming.NamingAsyncClient.clientWithResponse": "Client.Naming.Property.client", - "client.naming.NamingAsyncClient.compatibleWithEncodedName": "Client.Naming.Property.compatibleWithEncodedName", - "client.naming.NamingAsyncClient.compatibleWithEncodedNameWithResponse": "Client.Naming.Property.compatibleWithEncodedName", - "client.naming.NamingAsyncClient.language": "Client.Naming.Property.language", - "client.naming.NamingAsyncClient.languageWithResponse": "Client.Naming.Property.language", - "client.naming.NamingAsyncClient.parameter": "Client.Naming.parameter", - "client.naming.NamingAsyncClient.parameterWithResponse": "Client.Naming.parameter", - "client.naming.NamingAsyncClient.request": "Client.Naming.Header.request", - "client.naming.NamingAsyncClient.requestWithResponse": "Client.Naming.Header.request", - "client.naming.NamingAsyncClient.response": "Client.Naming.Header.response", - "client.naming.NamingAsyncClient.responseWithResponse": "Client.Naming.Header.response", - "client.naming.NamingClient": "Client.Naming", - "client.naming.NamingClient.client": "Client.Naming.Property.client", - "client.naming.NamingClient.clientName": "Client.Naming.operation", - "client.naming.NamingClient.clientNameWithResponse": "Client.Naming.operation", - "client.naming.NamingClient.clientWithResponse": "Client.Naming.Property.client", - "client.naming.NamingClient.compatibleWithEncodedName": "Client.Naming.Property.compatibleWithEncodedName", - "client.naming.NamingClient.compatibleWithEncodedNameWithResponse": "Client.Naming.Property.compatibleWithEncodedName", - "client.naming.NamingClient.language": "Client.Naming.Property.language", - "client.naming.NamingClient.languageWithResponse": "Client.Naming.Property.language", - "client.naming.NamingClient.parameter": "Client.Naming.parameter", - "client.naming.NamingClient.parameterWithResponse": "Client.Naming.parameter", - "client.naming.NamingClient.request": "Client.Naming.Header.request", - "client.naming.NamingClient.requestWithResponse": "Client.Naming.Header.request", - "client.naming.NamingClient.response": "Client.Naming.Header.response", - "client.naming.NamingClient.responseWithResponse": "Client.Naming.Header.response", - "client.naming.NamingClientBuilder": "Client.Naming", - "client.naming.UnionEnumAsyncClient": "Client.Naming.UnionEnum", - "client.naming.UnionEnumAsyncClient.unionEnumMemberName": "Client.Naming.UnionEnum.unionEnumMemberName", - "client.naming.UnionEnumAsyncClient.unionEnumMemberNameWithResponse": "Client.Naming.UnionEnum.unionEnumMemberName", - "client.naming.UnionEnumAsyncClient.unionEnumName": "Client.Naming.UnionEnum.unionEnumName", - "client.naming.UnionEnumAsyncClient.unionEnumNameWithResponse": "Client.Naming.UnionEnum.unionEnumName", - "client.naming.UnionEnumClient": "Client.Naming.UnionEnum", - "client.naming.UnionEnumClient.unionEnumMemberName": "Client.Naming.UnionEnum.unionEnumMemberName", - "client.naming.UnionEnumClient.unionEnumMemberNameWithResponse": "Client.Naming.UnionEnum.unionEnumMemberName", - "client.naming.UnionEnumClient.unionEnumName": "Client.Naming.UnionEnum.unionEnumName", - "client.naming.UnionEnumClient.unionEnumNameWithResponse": "Client.Naming.UnionEnum.unionEnumName", - "client.naming.model.models.ClientModel": "Client.Naming.Model.ModelWithClientClientName", - "client.naming.model.models.JavaModel": "Client.Naming.Model.ModelWithLanguageClientName", - "client.naming.property.models.ClientNameAndJsonEncodedNameModel": "Client.Naming.Property.ClientNameAndJsonEncodedNameModel", - "client.naming.property.models.ClientNameModel": "Client.Naming.Property.ClientNameModel", - "client.naming.property.models.LanguageClientNameModel": "Client.Naming.Property.LanguageClientNameModel", - "client.naming.unionenum.models.ClientExtensibleEnum": "Client.Naming.UnionEnum.ServerExtensibleEnum", - "client.naming.unionenum.models.ExtensibleEnum": "Client.Naming.UnionEnum.ExtensibleEnum" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_metadata.json deleted file mode 100644 index 310a52df4d1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"client.naming.ModelAsyncClient":"Client.Naming.Model","client.naming.ModelAsyncClient.client":"Client.Naming.Model.client","client.naming.ModelAsyncClient.clientWithResponse":"Client.Naming.Model.client","client.naming.ModelAsyncClient.language":"Client.Naming.Model.language","client.naming.ModelAsyncClient.languageWithResponse":"Client.Naming.Model.language","client.naming.ModelClient":"Client.Naming.Model","client.naming.ModelClient.client":"Client.Naming.Model.client","client.naming.ModelClient.clientWithResponse":"Client.Naming.Model.client","client.naming.ModelClient.language":"Client.Naming.Model.language","client.naming.ModelClient.languageWithResponse":"Client.Naming.Model.language","client.naming.NamingAsyncClient":"Client.Naming","client.naming.NamingAsyncClient.client":"Client.Naming.Property.client","client.naming.NamingAsyncClient.clientName":"Client.Naming.operation","client.naming.NamingAsyncClient.clientNameWithResponse":"Client.Naming.operation","client.naming.NamingAsyncClient.clientWithResponse":"Client.Naming.Property.client","client.naming.NamingAsyncClient.compatibleWithEncodedName":"Client.Naming.Property.compatibleWithEncodedName","client.naming.NamingAsyncClient.compatibleWithEncodedNameWithResponse":"Client.Naming.Property.compatibleWithEncodedName","client.naming.NamingAsyncClient.language":"Client.Naming.Property.language","client.naming.NamingAsyncClient.languageWithResponse":"Client.Naming.Property.language","client.naming.NamingAsyncClient.parameter":"Client.Naming.parameter","client.naming.NamingAsyncClient.parameterWithResponse":"Client.Naming.parameter","client.naming.NamingAsyncClient.request":"Client.Naming.Header.request","client.naming.NamingAsyncClient.requestWithResponse":"Client.Naming.Header.request","client.naming.NamingAsyncClient.response":"Client.Naming.Header.response","client.naming.NamingAsyncClient.responseWithResponse":"Client.Naming.Header.response","client.naming.NamingClient":"Client.Naming","client.naming.NamingClient.client":"Client.Naming.Property.client","client.naming.NamingClient.clientName":"Client.Naming.operation","client.naming.NamingClient.clientNameWithResponse":"Client.Naming.operation","client.naming.NamingClient.clientWithResponse":"Client.Naming.Property.client","client.naming.NamingClient.compatibleWithEncodedName":"Client.Naming.Property.compatibleWithEncodedName","client.naming.NamingClient.compatibleWithEncodedNameWithResponse":"Client.Naming.Property.compatibleWithEncodedName","client.naming.NamingClient.language":"Client.Naming.Property.language","client.naming.NamingClient.languageWithResponse":"Client.Naming.Property.language","client.naming.NamingClient.parameter":"Client.Naming.parameter","client.naming.NamingClient.parameterWithResponse":"Client.Naming.parameter","client.naming.NamingClient.request":"Client.Naming.Header.request","client.naming.NamingClient.requestWithResponse":"Client.Naming.Header.request","client.naming.NamingClient.response":"Client.Naming.Header.response","client.naming.NamingClient.responseWithResponse":"Client.Naming.Header.response","client.naming.NamingClientBuilder":"Client.Naming","client.naming.UnionEnumAsyncClient":"Client.Naming.UnionEnum","client.naming.UnionEnumAsyncClient.unionEnumMemberName":"Client.Naming.UnionEnum.unionEnumMemberName","client.naming.UnionEnumAsyncClient.unionEnumMemberNameWithResponse":"Client.Naming.UnionEnum.unionEnumMemberName","client.naming.UnionEnumAsyncClient.unionEnumName":"Client.Naming.UnionEnum.unionEnumName","client.naming.UnionEnumAsyncClient.unionEnumNameWithResponse":"Client.Naming.UnionEnum.unionEnumName","client.naming.UnionEnumClient":"Client.Naming.UnionEnum","client.naming.UnionEnumClient.unionEnumMemberName":"Client.Naming.UnionEnum.unionEnumMemberName","client.naming.UnionEnumClient.unionEnumMemberNameWithResponse":"Client.Naming.UnionEnum.unionEnumMemberName","client.naming.UnionEnumClient.unionEnumName":"Client.Naming.UnionEnum.unionEnumName","client.naming.UnionEnumClient.unionEnumNameWithResponse":"Client.Naming.UnionEnum.unionEnumName","client.naming.model.models.ClientModel":"Client.Naming.Model.ModelWithClientClientName","client.naming.model.models.JavaModel":"Client.Naming.Model.ModelWithLanguageClientName","client.naming.property.models.ClientNameAndJsonEncodedNameModel":"Client.Naming.Property.ClientNameAndJsonEncodedNameModel","client.naming.property.models.ClientNameModel":"Client.Naming.Property.ClientNameModel","client.naming.property.models.LanguageClientNameModel":"Client.Naming.Property.LanguageClientNameModel","client.naming.unionenum.models.ClientExtensibleEnum":"Client.Naming.UnionEnum.ServerExtensibleEnum","client.naming.unionenum.models.ExtensibleEnum":"Client.Naming.UnionEnum.ExtensibleEnum"},"generatedFiles":["src/main/java/client/naming/ModelAsyncClient.java","src/main/java/client/naming/ModelClient.java","src/main/java/client/naming/NamingAsyncClient.java","src/main/java/client/naming/NamingClient.java","src/main/java/client/naming/NamingClientBuilder.java","src/main/java/client/naming/UnionEnumAsyncClient.java","src/main/java/client/naming/UnionEnumClient.java","src/main/java/client/naming/implementation/ModelClientsImpl.java","src/main/java/client/naming/implementation/NamingClientImpl.java","src/main/java/client/naming/implementation/UnionEnumsImpl.java","src/main/java/client/naming/implementation/package-info.java","src/main/java/client/naming/model/models/ClientModel.java","src/main/java/client/naming/model/models/JavaModel.java","src/main/java/client/naming/model/models/package-info.java","src/main/java/client/naming/package-info.java","src/main/java/client/naming/property/models/ClientNameAndJsonEncodedNameModel.java","src/main/java/client/naming/property/models/ClientNameModel.java","src/main/java/client/naming/property/models/LanguageClientNameModel.java","src/main/java/client/naming/property/models/package-info.java","src/main/java/client/naming/unionenum/models/ClientExtensibleEnum.java","src/main/java/client/naming/unionenum/models/ExtensibleEnum.java","src/main/java/client/naming/unionenum/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_apiview_properties.json deleted file mode 100644 index 7f451d6a2d4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_apiview_properties.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "client.overload.OverloadAsyncClient": "Client.Overload", - "client.overload.OverloadAsyncClient.list": "Client.Overload.list", - "client.overload.OverloadAsyncClient.listByScope": "Client.Overload.listByScope", - "client.overload.OverloadAsyncClient.listByScopeWithResponse": "Client.Overload.listByScope", - "client.overload.OverloadAsyncClient.listWithResponse": "Client.Overload.list", - "client.overload.OverloadClient": "Client.Overload", - "client.overload.OverloadClient.list": "Client.Overload.list", - "client.overload.OverloadClient.listByScope": "Client.Overload.listByScope", - "client.overload.OverloadClient.listByScopeWithResponse": "Client.Overload.listByScope", - "client.overload.OverloadClient.listWithResponse": "Client.Overload.list", - "client.overload.OverloadClientBuilder": "Client.Overload", - "client.overload.models.Resource": "Client.Overload.Resource" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_metadata.json deleted file mode 100644 index 05ce1b694de..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"client.overload.OverloadAsyncClient":"Client.Overload","client.overload.OverloadAsyncClient.list":"Client.Overload.list","client.overload.OverloadAsyncClient.listByScope":"Client.Overload.listByScope","client.overload.OverloadAsyncClient.listByScopeWithResponse":"Client.Overload.listByScope","client.overload.OverloadAsyncClient.listWithResponse":"Client.Overload.list","client.overload.OverloadClient":"Client.Overload","client.overload.OverloadClient.list":"Client.Overload.list","client.overload.OverloadClient.listByScope":"Client.Overload.listByScope","client.overload.OverloadClient.listByScopeWithResponse":"Client.Overload.listByScope","client.overload.OverloadClient.listWithResponse":"Client.Overload.list","client.overload.OverloadClientBuilder":"Client.Overload","client.overload.models.Resource":"Client.Overload.Resource"},"generatedFiles":["src/main/java/client/overload/OverloadAsyncClient.java","src/main/java/client/overload/OverloadClient.java","src/main/java/client/overload/OverloadClientBuilder.java","src/main/java/client/overload/implementation/OverloadClientImpl.java","src/main/java/client/overload/implementation/package-info.java","src/main/java/client/overload/models/Resource.java","src/main/java/client/overload/models/package-info.java","src/main/java/client/overload/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_apiview_properties.json deleted file mode 100644 index 190ae590faf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_apiview_properties.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "client.structure.anotherclientoperationgroup.subnamespace.Group5AsyncClient": "Client.Structure.AnotherClientOperationGroup.Group5", - "client.structure.anotherclientoperationgroup.subnamespace.Group5AsyncClient.six": "Client.Structure.AnotherClientOperationGroup.Group5.six", - "client.structure.anotherclientoperationgroup.subnamespace.Group5AsyncClient.sixWithResponse": "Client.Structure.AnotherClientOperationGroup.Group5.six", - "client.structure.anotherclientoperationgroup.subnamespace.Group5Client": "Client.Structure.AnotherClientOperationGroup.Group5", - "client.structure.anotherclientoperationgroup.subnamespace.Group5Client.six": "Client.Structure.AnotherClientOperationGroup.Group5.six", - "client.structure.anotherclientoperationgroup.subnamespace.Group5Client.sixWithResponse": "Client.Structure.AnotherClientOperationGroup.Group5.six", - "client.structure.anotherclientoperationgroup.subnamespace.SecondAsyncClient": "Client.Structure.AnotherClientOperationGroup", - "client.structure.anotherclientoperationgroup.subnamespace.SecondAsyncClient.five": "Client.Structure.AnotherClientOperationGroup.five", - "client.structure.anotherclientoperationgroup.subnamespace.SecondAsyncClient.fiveWithResponse": "Client.Structure.AnotherClientOperationGroup.five", - "client.structure.anotherclientoperationgroup.subnamespace.SecondClient": "Client.Structure.AnotherClientOperationGroup", - "client.structure.anotherclientoperationgroup.subnamespace.SecondClient.five": "Client.Structure.AnotherClientOperationGroup.five", - "client.structure.anotherclientoperationgroup.subnamespace.SecondClient.fiveWithResponse": "Client.Structure.AnotherClientOperationGroup.five", - "client.structure.anotherclientoperationgroup.subnamespace.SecondClientBuilder": "Client.Structure.AnotherClientOperationGroup", - "client.structure.clientoperationgroup.FirstAsyncClient": "Client.Structure.ClientOperationGroup", - "client.structure.clientoperationgroup.FirstAsyncClient.one": "Client.Structure.ClientOperationGroup.one", - "client.structure.clientoperationgroup.FirstAsyncClient.oneWithResponse": "Client.Structure.ClientOperationGroup.one", - "client.structure.clientoperationgroup.FirstClient": "Client.Structure.ClientOperationGroup", - "client.structure.clientoperationgroup.FirstClient.one": "Client.Structure.ClientOperationGroup.one", - "client.structure.clientoperationgroup.FirstClient.oneWithResponse": "Client.Structure.ClientOperationGroup.one", - "client.structure.clientoperationgroup.FirstClientBuilder": "Client.Structure.ClientOperationGroup", - "client.structure.clientoperationgroup.Group3AsyncClient": "Client.Structure.ClientOperationGroup.Group3", - "client.structure.clientoperationgroup.Group3AsyncClient.three": "Client.Structure.ClientOperationGroup.Group3.three", - "client.structure.clientoperationgroup.Group3AsyncClient.threeWithResponse": "Client.Structure.ClientOperationGroup.Group3.three", - "client.structure.clientoperationgroup.Group3AsyncClient.two": "Client.Structure.ClientOperationGroup.Group3.two", - "client.structure.clientoperationgroup.Group3AsyncClient.twoWithResponse": "Client.Structure.ClientOperationGroup.Group3.two", - "client.structure.clientoperationgroup.Group3Client": "Client.Structure.ClientOperationGroup.Group3", - "client.structure.clientoperationgroup.Group3Client.three": "Client.Structure.ClientOperationGroup.Group3.three", - "client.structure.clientoperationgroup.Group3Client.threeWithResponse": "Client.Structure.ClientOperationGroup.Group3.three", - "client.structure.clientoperationgroup.Group3Client.two": "Client.Structure.ClientOperationGroup.Group3.two", - "client.structure.clientoperationgroup.Group3Client.twoWithResponse": "Client.Structure.ClientOperationGroup.Group3.two", - "client.structure.clientoperationgroup.Group4AsyncClient": "Client.Structure.ClientOperationGroup.Group4", - "client.structure.clientoperationgroup.Group4AsyncClient.four": "Client.Structure.ClientOperationGroup.Group4.four", - "client.structure.clientoperationgroup.Group4AsyncClient.fourWithResponse": "Client.Structure.ClientOperationGroup.Group4.four", - "client.structure.clientoperationgroup.Group4Client": "Client.Structure.ClientOperationGroup.Group4", - "client.structure.clientoperationgroup.Group4Client.four": "Client.Structure.ClientOperationGroup.Group4.four", - "client.structure.clientoperationgroup.Group4Client.fourWithResponse": "Client.Structure.ClientOperationGroup.Group4.four", - "client.structure.service.models.ClientType": "Client.Structure.Service.ClientType" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_metadata.json deleted file mode 100644 index 5cdad377d8d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"client.structure.anotherclientoperationgroup.subnamespace.Group5AsyncClient":"Client.Structure.AnotherClientOperationGroup.Group5","client.structure.anotherclientoperationgroup.subnamespace.Group5AsyncClient.six":"Client.Structure.AnotherClientOperationGroup.Group5.six","client.structure.anotherclientoperationgroup.subnamespace.Group5AsyncClient.sixWithResponse":"Client.Structure.AnotherClientOperationGroup.Group5.six","client.structure.anotherclientoperationgroup.subnamespace.Group5Client":"Client.Structure.AnotherClientOperationGroup.Group5","client.structure.anotherclientoperationgroup.subnamespace.Group5Client.six":"Client.Structure.AnotherClientOperationGroup.Group5.six","client.structure.anotherclientoperationgroup.subnamespace.Group5Client.sixWithResponse":"Client.Structure.AnotherClientOperationGroup.Group5.six","client.structure.anotherclientoperationgroup.subnamespace.SecondAsyncClient":"Client.Structure.AnotherClientOperationGroup","client.structure.anotherclientoperationgroup.subnamespace.SecondAsyncClient.five":"Client.Structure.AnotherClientOperationGroup.five","client.structure.anotherclientoperationgroup.subnamespace.SecondAsyncClient.fiveWithResponse":"Client.Structure.AnotherClientOperationGroup.five","client.structure.anotherclientoperationgroup.subnamespace.SecondClient":"Client.Structure.AnotherClientOperationGroup","client.structure.anotherclientoperationgroup.subnamespace.SecondClient.five":"Client.Structure.AnotherClientOperationGroup.five","client.structure.anotherclientoperationgroup.subnamespace.SecondClient.fiveWithResponse":"Client.Structure.AnotherClientOperationGroup.five","client.structure.anotherclientoperationgroup.subnamespace.SecondClientBuilder":"Client.Structure.AnotherClientOperationGroup","client.structure.clientoperationgroup.FirstAsyncClient":"Client.Structure.ClientOperationGroup","client.structure.clientoperationgroup.FirstAsyncClient.one":"Client.Structure.ClientOperationGroup.one","client.structure.clientoperationgroup.FirstAsyncClient.oneWithResponse":"Client.Structure.ClientOperationGroup.one","client.structure.clientoperationgroup.FirstClient":"Client.Structure.ClientOperationGroup","client.structure.clientoperationgroup.FirstClient.one":"Client.Structure.ClientOperationGroup.one","client.structure.clientoperationgroup.FirstClient.oneWithResponse":"Client.Structure.ClientOperationGroup.one","client.structure.clientoperationgroup.FirstClientBuilder":"Client.Structure.ClientOperationGroup","client.structure.clientoperationgroup.Group3AsyncClient":"Client.Structure.ClientOperationGroup.Group3","client.structure.clientoperationgroup.Group3AsyncClient.three":"Client.Structure.ClientOperationGroup.Group3.three","client.structure.clientoperationgroup.Group3AsyncClient.threeWithResponse":"Client.Structure.ClientOperationGroup.Group3.three","client.structure.clientoperationgroup.Group3AsyncClient.two":"Client.Structure.ClientOperationGroup.Group3.two","client.structure.clientoperationgroup.Group3AsyncClient.twoWithResponse":"Client.Structure.ClientOperationGroup.Group3.two","client.structure.clientoperationgroup.Group3Client":"Client.Structure.ClientOperationGroup.Group3","client.structure.clientoperationgroup.Group3Client.three":"Client.Structure.ClientOperationGroup.Group3.three","client.structure.clientoperationgroup.Group3Client.threeWithResponse":"Client.Structure.ClientOperationGroup.Group3.three","client.structure.clientoperationgroup.Group3Client.two":"Client.Structure.ClientOperationGroup.Group3.two","client.structure.clientoperationgroup.Group3Client.twoWithResponse":"Client.Structure.ClientOperationGroup.Group3.two","client.structure.clientoperationgroup.Group4AsyncClient":"Client.Structure.ClientOperationGroup.Group4","client.structure.clientoperationgroup.Group4AsyncClient.four":"Client.Structure.ClientOperationGroup.Group4.four","client.structure.clientoperationgroup.Group4AsyncClient.fourWithResponse":"Client.Structure.ClientOperationGroup.Group4.four","client.structure.clientoperationgroup.Group4Client":"Client.Structure.ClientOperationGroup.Group4","client.structure.clientoperationgroup.Group4Client.four":"Client.Structure.ClientOperationGroup.Group4.four","client.structure.clientoperationgroup.Group4Client.fourWithResponse":"Client.Structure.ClientOperationGroup.Group4.four","client.structure.service.models.ClientType":"Client.Structure.Service.ClientType"},"generatedFiles":["src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5AsyncClient.java","src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5Client.java","src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondAsyncClient.java","src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClient.java","src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClientBuilder.java","src/main/java/client/structure/anotherclientoperationgroup/subnamespace/package-info.java","src/main/java/client/structure/clientoperationgroup/FirstAsyncClient.java","src/main/java/client/structure/clientoperationgroup/FirstClient.java","src/main/java/client/structure/clientoperationgroup/FirstClientBuilder.java","src/main/java/client/structure/clientoperationgroup/Group3AsyncClient.java","src/main/java/client/structure/clientoperationgroup/Group3Client.java","src/main/java/client/structure/clientoperationgroup/Group4AsyncClient.java","src/main/java/client/structure/clientoperationgroup/Group4Client.java","src/main/java/client/structure/clientoperationgroup/implementation/FirstClientImpl.java","src/main/java/client/structure/clientoperationgroup/implementation/Group3sImpl.java","src/main/java/client/structure/clientoperationgroup/implementation/Group4sImpl.java","src/main/java/client/structure/clientoperationgroup/implementation/Group5sImpl.java","src/main/java/client/structure/clientoperationgroup/implementation/SecondClientImpl.java","src/main/java/client/structure/clientoperationgroup/implementation/package-info.java","src/main/java/client/structure/clientoperationgroup/package-info.java","src/main/java/client/structure/service/models/ClientType.java","src/main/java/client/structure/service/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_apiview_properties.json deleted file mode 100644 index d75958e00ec..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_apiview_properties.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "client.structure.multiclient.ClientAAsyncClient": "Client.Structure.MultiClient.ClientA", - "client.structure.multiclient.ClientAAsyncClient.renamedFive": "Client.Structure.MultiClient.ClientA.renamedFive", - "client.structure.multiclient.ClientAAsyncClient.renamedFiveWithResponse": "Client.Structure.MultiClient.ClientA.renamedFive", - "client.structure.multiclient.ClientAAsyncClient.renamedOne": "Client.Structure.MultiClient.ClientA.renamedOne", - "client.structure.multiclient.ClientAAsyncClient.renamedOneWithResponse": "Client.Structure.MultiClient.ClientA.renamedOne", - "client.structure.multiclient.ClientAAsyncClient.renamedThree": "Client.Structure.MultiClient.ClientA.renamedThree", - "client.structure.multiclient.ClientAAsyncClient.renamedThreeWithResponse": "Client.Structure.MultiClient.ClientA.renamedThree", - "client.structure.multiclient.ClientAClient": "Client.Structure.MultiClient.ClientA", - "client.structure.multiclient.ClientAClient.renamedFive": "Client.Structure.MultiClient.ClientA.renamedFive", - "client.structure.multiclient.ClientAClient.renamedFiveWithResponse": "Client.Structure.MultiClient.ClientA.renamedFive", - "client.structure.multiclient.ClientAClient.renamedOne": "Client.Structure.MultiClient.ClientA.renamedOne", - "client.structure.multiclient.ClientAClient.renamedOneWithResponse": "Client.Structure.MultiClient.ClientA.renamedOne", - "client.structure.multiclient.ClientAClient.renamedThree": "Client.Structure.MultiClient.ClientA.renamedThree", - "client.structure.multiclient.ClientAClient.renamedThreeWithResponse": "Client.Structure.MultiClient.ClientA.renamedThree", - "client.structure.multiclient.ClientAClientBuilder": "Client.Structure.MultiClient.ClientA", - "client.structure.multiclient.ClientBAsyncClient": "Client.Structure.MultiClient.ClientB", - "client.structure.multiclient.ClientBAsyncClient.renamedFour": "Client.Structure.MultiClient.ClientB.renamedFour", - "client.structure.multiclient.ClientBAsyncClient.renamedFourWithResponse": "Client.Structure.MultiClient.ClientB.renamedFour", - "client.structure.multiclient.ClientBAsyncClient.renamedSix": "Client.Structure.MultiClient.ClientB.renamedSix", - "client.structure.multiclient.ClientBAsyncClient.renamedSixWithResponse": "Client.Structure.MultiClient.ClientB.renamedSix", - "client.structure.multiclient.ClientBAsyncClient.renamedTwo": "Client.Structure.MultiClient.ClientB.renamedTwo", - "client.structure.multiclient.ClientBAsyncClient.renamedTwoWithResponse": "Client.Structure.MultiClient.ClientB.renamedTwo", - "client.structure.multiclient.ClientBClient": "Client.Structure.MultiClient.ClientB", - "client.structure.multiclient.ClientBClient.renamedFour": "Client.Structure.MultiClient.ClientB.renamedFour", - "client.structure.multiclient.ClientBClient.renamedFourWithResponse": "Client.Structure.MultiClient.ClientB.renamedFour", - "client.structure.multiclient.ClientBClient.renamedSix": "Client.Structure.MultiClient.ClientB.renamedSix", - "client.structure.multiclient.ClientBClient.renamedSixWithResponse": "Client.Structure.MultiClient.ClientB.renamedSix", - "client.structure.multiclient.ClientBClient.renamedTwo": "Client.Structure.MultiClient.ClientB.renamedTwo", - "client.structure.multiclient.ClientBClient.renamedTwoWithResponse": "Client.Structure.MultiClient.ClientB.renamedTwo", - "client.structure.multiclient.ClientBClientBuilder": "Client.Structure.MultiClient.ClientB", - "client.structure.service.models.ClientType": "Client.Structure.Service.ClientType" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_metadata.json deleted file mode 100644 index 3405ed1cf36..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"client.structure.multiclient.ClientAAsyncClient":"Client.Structure.MultiClient.ClientA","client.structure.multiclient.ClientAAsyncClient.renamedFive":"Client.Structure.MultiClient.ClientA.renamedFive","client.structure.multiclient.ClientAAsyncClient.renamedFiveWithResponse":"Client.Structure.MultiClient.ClientA.renamedFive","client.structure.multiclient.ClientAAsyncClient.renamedOne":"Client.Structure.MultiClient.ClientA.renamedOne","client.structure.multiclient.ClientAAsyncClient.renamedOneWithResponse":"Client.Structure.MultiClient.ClientA.renamedOne","client.structure.multiclient.ClientAAsyncClient.renamedThree":"Client.Structure.MultiClient.ClientA.renamedThree","client.structure.multiclient.ClientAAsyncClient.renamedThreeWithResponse":"Client.Structure.MultiClient.ClientA.renamedThree","client.structure.multiclient.ClientAClient":"Client.Structure.MultiClient.ClientA","client.structure.multiclient.ClientAClient.renamedFive":"Client.Structure.MultiClient.ClientA.renamedFive","client.structure.multiclient.ClientAClient.renamedFiveWithResponse":"Client.Structure.MultiClient.ClientA.renamedFive","client.structure.multiclient.ClientAClient.renamedOne":"Client.Structure.MultiClient.ClientA.renamedOne","client.structure.multiclient.ClientAClient.renamedOneWithResponse":"Client.Structure.MultiClient.ClientA.renamedOne","client.structure.multiclient.ClientAClient.renamedThree":"Client.Structure.MultiClient.ClientA.renamedThree","client.structure.multiclient.ClientAClient.renamedThreeWithResponse":"Client.Structure.MultiClient.ClientA.renamedThree","client.structure.multiclient.ClientAClientBuilder":"Client.Structure.MultiClient.ClientA","client.structure.multiclient.ClientBAsyncClient":"Client.Structure.MultiClient.ClientB","client.structure.multiclient.ClientBAsyncClient.renamedFour":"Client.Structure.MultiClient.ClientB.renamedFour","client.structure.multiclient.ClientBAsyncClient.renamedFourWithResponse":"Client.Structure.MultiClient.ClientB.renamedFour","client.structure.multiclient.ClientBAsyncClient.renamedSix":"Client.Structure.MultiClient.ClientB.renamedSix","client.structure.multiclient.ClientBAsyncClient.renamedSixWithResponse":"Client.Structure.MultiClient.ClientB.renamedSix","client.structure.multiclient.ClientBAsyncClient.renamedTwo":"Client.Structure.MultiClient.ClientB.renamedTwo","client.structure.multiclient.ClientBAsyncClient.renamedTwoWithResponse":"Client.Structure.MultiClient.ClientB.renamedTwo","client.structure.multiclient.ClientBClient":"Client.Structure.MultiClient.ClientB","client.structure.multiclient.ClientBClient.renamedFour":"Client.Structure.MultiClient.ClientB.renamedFour","client.structure.multiclient.ClientBClient.renamedFourWithResponse":"Client.Structure.MultiClient.ClientB.renamedFour","client.structure.multiclient.ClientBClient.renamedSix":"Client.Structure.MultiClient.ClientB.renamedSix","client.structure.multiclient.ClientBClient.renamedSixWithResponse":"Client.Structure.MultiClient.ClientB.renamedSix","client.structure.multiclient.ClientBClient.renamedTwo":"Client.Structure.MultiClient.ClientB.renamedTwo","client.structure.multiclient.ClientBClient.renamedTwoWithResponse":"Client.Structure.MultiClient.ClientB.renamedTwo","client.structure.multiclient.ClientBClientBuilder":"Client.Structure.MultiClient.ClientB","client.structure.service.models.ClientType":"Client.Structure.Service.ClientType"},"generatedFiles":["src/main/java/client/structure/multiclient/ClientAAsyncClient.java","src/main/java/client/structure/multiclient/ClientAClient.java","src/main/java/client/structure/multiclient/ClientAClientBuilder.java","src/main/java/client/structure/multiclient/ClientBAsyncClient.java","src/main/java/client/structure/multiclient/ClientBClient.java","src/main/java/client/structure/multiclient/ClientBClientBuilder.java","src/main/java/client/structure/multiclient/implementation/ClientAClientImpl.java","src/main/java/client/structure/multiclient/implementation/ClientBClientImpl.java","src/main/java/client/structure/multiclient/implementation/package-info.java","src/main/java/client/structure/multiclient/package-info.java","src/main/java/client/structure/service/models/ClientType.java","src/main/java/client/structure/service/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_apiview_properties.json deleted file mode 100644 index c3b92699425..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_apiview_properties.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "client.structure.renamedoperation.GroupAsyncClient": "Client.Structure.RenamedOperation.Group", - "client.structure.renamedoperation.GroupAsyncClient.renamedFour": "Client.Structure.RenamedOperation.Group.renamedFour", - "client.structure.renamedoperation.GroupAsyncClient.renamedFourWithResponse": "Client.Structure.RenamedOperation.Group.renamedFour", - "client.structure.renamedoperation.GroupAsyncClient.renamedSix": "Client.Structure.RenamedOperation.Group.renamedSix", - "client.structure.renamedoperation.GroupAsyncClient.renamedSixWithResponse": "Client.Structure.RenamedOperation.Group.renamedSix", - "client.structure.renamedoperation.GroupAsyncClient.renamedTwo": "Client.Structure.RenamedOperation.Group.renamedTwo", - "client.structure.renamedoperation.GroupAsyncClient.renamedTwoWithResponse": "Client.Structure.RenamedOperation.Group.renamedTwo", - "client.structure.renamedoperation.GroupClient": "Client.Structure.RenamedOperation.Group", - "client.structure.renamedoperation.GroupClient.renamedFour": "Client.Structure.RenamedOperation.Group.renamedFour", - "client.structure.renamedoperation.GroupClient.renamedFourWithResponse": "Client.Structure.RenamedOperation.Group.renamedFour", - "client.structure.renamedoperation.GroupClient.renamedSix": "Client.Structure.RenamedOperation.Group.renamedSix", - "client.structure.renamedoperation.GroupClient.renamedSixWithResponse": "Client.Structure.RenamedOperation.Group.renamedSix", - "client.structure.renamedoperation.GroupClient.renamedTwo": "Client.Structure.RenamedOperation.Group.renamedTwo", - "client.structure.renamedoperation.GroupClient.renamedTwoWithResponse": "Client.Structure.RenamedOperation.Group.renamedTwo", - "client.structure.renamedoperation.RenamedOperationAsyncClient": "Client.Structure.RenamedOperation", - "client.structure.renamedoperation.RenamedOperationAsyncClient.renamedFive": "Client.Structure.RenamedOperation.renamedFive", - "client.structure.renamedoperation.RenamedOperationAsyncClient.renamedFiveWithResponse": "Client.Structure.RenamedOperation.renamedFive", - "client.structure.renamedoperation.RenamedOperationAsyncClient.renamedOne": "Client.Structure.RenamedOperation.renamedOne", - "client.structure.renamedoperation.RenamedOperationAsyncClient.renamedOneWithResponse": "Client.Structure.RenamedOperation.renamedOne", - "client.structure.renamedoperation.RenamedOperationAsyncClient.renamedThree": "Client.Structure.RenamedOperation.renamedThree", - "client.structure.renamedoperation.RenamedOperationAsyncClient.renamedThreeWithResponse": "Client.Structure.RenamedOperation.renamedThree", - "client.structure.renamedoperation.RenamedOperationClient": "Client.Structure.RenamedOperation", - "client.structure.renamedoperation.RenamedOperationClient.renamedFive": "Client.Structure.RenamedOperation.renamedFive", - "client.structure.renamedoperation.RenamedOperationClient.renamedFiveWithResponse": "Client.Structure.RenamedOperation.renamedFive", - "client.structure.renamedoperation.RenamedOperationClient.renamedOne": "Client.Structure.RenamedOperation.renamedOne", - "client.structure.renamedoperation.RenamedOperationClient.renamedOneWithResponse": "Client.Structure.RenamedOperation.renamedOne", - "client.structure.renamedoperation.RenamedOperationClient.renamedThree": "Client.Structure.RenamedOperation.renamedThree", - "client.structure.renamedoperation.RenamedOperationClient.renamedThreeWithResponse": "Client.Structure.RenamedOperation.renamedThree", - "client.structure.renamedoperation.RenamedOperationClientBuilder": "Client.Structure.RenamedOperation", - "client.structure.service.models.ClientType": "Client.Structure.Service.ClientType" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_metadata.json deleted file mode 100644 index ac8f98b7c9a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"client.structure.renamedoperation.GroupAsyncClient":"Client.Structure.RenamedOperation.Group","client.structure.renamedoperation.GroupAsyncClient.renamedFour":"Client.Structure.RenamedOperation.Group.renamedFour","client.structure.renamedoperation.GroupAsyncClient.renamedFourWithResponse":"Client.Structure.RenamedOperation.Group.renamedFour","client.structure.renamedoperation.GroupAsyncClient.renamedSix":"Client.Structure.RenamedOperation.Group.renamedSix","client.structure.renamedoperation.GroupAsyncClient.renamedSixWithResponse":"Client.Structure.RenamedOperation.Group.renamedSix","client.structure.renamedoperation.GroupAsyncClient.renamedTwo":"Client.Structure.RenamedOperation.Group.renamedTwo","client.structure.renamedoperation.GroupAsyncClient.renamedTwoWithResponse":"Client.Structure.RenamedOperation.Group.renamedTwo","client.structure.renamedoperation.GroupClient":"Client.Structure.RenamedOperation.Group","client.structure.renamedoperation.GroupClient.renamedFour":"Client.Structure.RenamedOperation.Group.renamedFour","client.structure.renamedoperation.GroupClient.renamedFourWithResponse":"Client.Structure.RenamedOperation.Group.renamedFour","client.structure.renamedoperation.GroupClient.renamedSix":"Client.Structure.RenamedOperation.Group.renamedSix","client.structure.renamedoperation.GroupClient.renamedSixWithResponse":"Client.Structure.RenamedOperation.Group.renamedSix","client.structure.renamedoperation.GroupClient.renamedTwo":"Client.Structure.RenamedOperation.Group.renamedTwo","client.structure.renamedoperation.GroupClient.renamedTwoWithResponse":"Client.Structure.RenamedOperation.Group.renamedTwo","client.structure.renamedoperation.RenamedOperationAsyncClient":"Client.Structure.RenamedOperation","client.structure.renamedoperation.RenamedOperationAsyncClient.renamedFive":"Client.Structure.RenamedOperation.renamedFive","client.structure.renamedoperation.RenamedOperationAsyncClient.renamedFiveWithResponse":"Client.Structure.RenamedOperation.renamedFive","client.structure.renamedoperation.RenamedOperationAsyncClient.renamedOne":"Client.Structure.RenamedOperation.renamedOne","client.structure.renamedoperation.RenamedOperationAsyncClient.renamedOneWithResponse":"Client.Structure.RenamedOperation.renamedOne","client.structure.renamedoperation.RenamedOperationAsyncClient.renamedThree":"Client.Structure.RenamedOperation.renamedThree","client.structure.renamedoperation.RenamedOperationAsyncClient.renamedThreeWithResponse":"Client.Structure.RenamedOperation.renamedThree","client.structure.renamedoperation.RenamedOperationClient":"Client.Structure.RenamedOperation","client.structure.renamedoperation.RenamedOperationClient.renamedFive":"Client.Structure.RenamedOperation.renamedFive","client.structure.renamedoperation.RenamedOperationClient.renamedFiveWithResponse":"Client.Structure.RenamedOperation.renamedFive","client.structure.renamedoperation.RenamedOperationClient.renamedOne":"Client.Structure.RenamedOperation.renamedOne","client.structure.renamedoperation.RenamedOperationClient.renamedOneWithResponse":"Client.Structure.RenamedOperation.renamedOne","client.structure.renamedoperation.RenamedOperationClient.renamedThree":"Client.Structure.RenamedOperation.renamedThree","client.structure.renamedoperation.RenamedOperationClient.renamedThreeWithResponse":"Client.Structure.RenamedOperation.renamedThree","client.structure.renamedoperation.RenamedOperationClientBuilder":"Client.Structure.RenamedOperation","client.structure.service.models.ClientType":"Client.Structure.Service.ClientType"},"generatedFiles":["src/main/java/client/structure/renamedoperation/GroupAsyncClient.java","src/main/java/client/structure/renamedoperation/GroupClient.java","src/main/java/client/structure/renamedoperation/RenamedOperationAsyncClient.java","src/main/java/client/structure/renamedoperation/RenamedOperationClient.java","src/main/java/client/structure/renamedoperation/RenamedOperationClientBuilder.java","src/main/java/client/structure/renamedoperation/implementation/GroupsImpl.java","src/main/java/client/structure/renamedoperation/implementation/RenamedOperationClientImpl.java","src/main/java/client/structure/renamedoperation/implementation/package-info.java","src/main/java/client/structure/renamedoperation/package-info.java","src/main/java/client/structure/service/models/ClientType.java","src/main/java/client/structure/service/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-service_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-service_apiview_properties.json deleted file mode 100644 index c57c264820f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-service_apiview_properties.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "client.structure.service.BarAsyncClient": "Client.Structure.Service.Bar", - "client.structure.service.BarAsyncClient.five": "Client.Structure.Service.Bar.five", - "client.structure.service.BarAsyncClient.fiveWithResponse": "Client.Structure.Service.Bar.five", - "client.structure.service.BarAsyncClient.six": "Client.Structure.Service.Bar.six", - "client.structure.service.BarAsyncClient.sixWithResponse": "Client.Structure.Service.Bar.six", - "client.structure.service.BarClient": "Client.Structure.Service.Bar", - "client.structure.service.BarClient.five": "Client.Structure.Service.Bar.five", - "client.structure.service.BarClient.fiveWithResponse": "Client.Structure.Service.Bar.five", - "client.structure.service.BarClient.six": "Client.Structure.Service.Bar.six", - "client.structure.service.BarClient.sixWithResponse": "Client.Structure.Service.Bar.six", - "client.structure.service.BazFooAsyncClient": "Client.Structure.Service.Baz.Foo", - "client.structure.service.BazFooAsyncClient.seven": "Client.Structure.Service.Baz.Foo.seven", - "client.structure.service.BazFooAsyncClient.sevenWithResponse": "Client.Structure.Service.Baz.Foo.seven", - "client.structure.service.BazFooClient": "Client.Structure.Service.Baz.Foo", - "client.structure.service.BazFooClient.seven": "Client.Structure.Service.Baz.Foo.seven", - "client.structure.service.BazFooClient.sevenWithResponse": "Client.Structure.Service.Baz.Foo.seven", - "client.structure.service.FooAsyncClient": "Client.Structure.Service.Foo", - "client.structure.service.FooAsyncClient.four": "Client.Structure.Service.Foo.four", - "client.structure.service.FooAsyncClient.fourWithResponse": "Client.Structure.Service.Foo.four", - "client.structure.service.FooAsyncClient.three": "Client.Structure.Service.Foo.three", - "client.structure.service.FooAsyncClient.threeWithResponse": "Client.Structure.Service.Foo.three", - "client.structure.service.FooClient": "Client.Structure.Service.Foo", - "client.structure.service.FooClient.four": "Client.Structure.Service.Foo.four", - "client.structure.service.FooClient.fourWithResponse": "Client.Structure.Service.Foo.four", - "client.structure.service.FooClient.three": "Client.Structure.Service.Foo.three", - "client.structure.service.FooClient.threeWithResponse": "Client.Structure.Service.Foo.three", - "client.structure.service.QuxAsyncClient": "Client.Structure.Service.Qux", - "client.structure.service.QuxAsyncClient.eight": "Client.Structure.Service.Qux.eight", - "client.structure.service.QuxAsyncClient.eightWithResponse": "Client.Structure.Service.Qux.eight", - "client.structure.service.QuxBarAsyncClient": "Client.Structure.Service.Qux.Bar", - "client.structure.service.QuxBarAsyncClient.nine": "Client.Structure.Service.Qux.Bar.nine", - "client.structure.service.QuxBarAsyncClient.nineWithResponse": "Client.Structure.Service.Qux.Bar.nine", - "client.structure.service.QuxBarClient": "Client.Structure.Service.Qux.Bar", - "client.structure.service.QuxBarClient.nine": "Client.Structure.Service.Qux.Bar.nine", - "client.structure.service.QuxBarClient.nineWithResponse": "Client.Structure.Service.Qux.Bar.nine", - "client.structure.service.QuxClient": "Client.Structure.Service.Qux", - "client.structure.service.QuxClient.eight": "Client.Structure.Service.Qux.eight", - "client.structure.service.QuxClient.eightWithResponse": "Client.Structure.Service.Qux.eight", - "client.structure.service.ServiceClientAsyncClient": "Client.Structure.Service", - "client.structure.service.ServiceClientAsyncClient.one": "Client.Structure.Service.one", - "client.structure.service.ServiceClientAsyncClient.oneWithResponse": "Client.Structure.Service.one", - "client.structure.service.ServiceClientAsyncClient.two": "Client.Structure.Service.two", - "client.structure.service.ServiceClientAsyncClient.twoWithResponse": "Client.Structure.Service.two", - "client.structure.service.ServiceClientClient": "Client.Structure.Service", - "client.structure.service.ServiceClientClient.one": "Client.Structure.Service.one", - "client.structure.service.ServiceClientClient.oneWithResponse": "Client.Structure.Service.one", - "client.structure.service.ServiceClientClient.two": "Client.Structure.Service.two", - "client.structure.service.ServiceClientClient.twoWithResponse": "Client.Structure.Service.two", - "client.structure.service.ServiceClientClientBuilder": "Client.Structure.Service", - "client.structure.service.models.ClientType": "Client.Structure.Service.ClientType" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_apiview_properties.json deleted file mode 100644 index 4e8b278c515..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_apiview_properties.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "client.structure.service.models.ClientType": "Client.Structure.Service.ClientType", - "client.structure.twooperationgroup.Group1AsyncClient": "Client.Structure.TwoOperationGroup.Group1", - "client.structure.twooperationgroup.Group1AsyncClient.four": "Client.Structure.TwoOperationGroup.Group1.four", - "client.structure.twooperationgroup.Group1AsyncClient.fourWithResponse": "Client.Structure.TwoOperationGroup.Group1.four", - "client.structure.twooperationgroup.Group1AsyncClient.one": "Client.Structure.TwoOperationGroup.Group1.one", - "client.structure.twooperationgroup.Group1AsyncClient.oneWithResponse": "Client.Structure.TwoOperationGroup.Group1.one", - "client.structure.twooperationgroup.Group1AsyncClient.three": "Client.Structure.TwoOperationGroup.Group1.three", - "client.structure.twooperationgroup.Group1AsyncClient.threeWithResponse": "Client.Structure.TwoOperationGroup.Group1.three", - "client.structure.twooperationgroup.Group1Client": "Client.Structure.TwoOperationGroup.Group1", - "client.structure.twooperationgroup.Group1Client.four": "Client.Structure.TwoOperationGroup.Group1.four", - "client.structure.twooperationgroup.Group1Client.fourWithResponse": "Client.Structure.TwoOperationGroup.Group1.four", - "client.structure.twooperationgroup.Group1Client.one": "Client.Structure.TwoOperationGroup.Group1.one", - "client.structure.twooperationgroup.Group1Client.oneWithResponse": "Client.Structure.TwoOperationGroup.Group1.one", - "client.structure.twooperationgroup.Group1Client.three": "Client.Structure.TwoOperationGroup.Group1.three", - "client.structure.twooperationgroup.Group1Client.threeWithResponse": "Client.Structure.TwoOperationGroup.Group1.three", - "client.structure.twooperationgroup.Group2AsyncClient": "Client.Structure.TwoOperationGroup.Group2", - "client.structure.twooperationgroup.Group2AsyncClient.five": "Client.Structure.TwoOperationGroup.Group2.five", - "client.structure.twooperationgroup.Group2AsyncClient.fiveWithResponse": "Client.Structure.TwoOperationGroup.Group2.five", - "client.structure.twooperationgroup.Group2AsyncClient.six": "Client.Structure.TwoOperationGroup.Group2.six", - "client.structure.twooperationgroup.Group2AsyncClient.sixWithResponse": "Client.Structure.TwoOperationGroup.Group2.six", - "client.structure.twooperationgroup.Group2AsyncClient.two": "Client.Structure.TwoOperationGroup.Group2.two", - "client.structure.twooperationgroup.Group2AsyncClient.twoWithResponse": "Client.Structure.TwoOperationGroup.Group2.two", - "client.structure.twooperationgroup.Group2Client": "Client.Structure.TwoOperationGroup.Group2", - "client.structure.twooperationgroup.Group2Client.five": "Client.Structure.TwoOperationGroup.Group2.five", - "client.structure.twooperationgroup.Group2Client.fiveWithResponse": "Client.Structure.TwoOperationGroup.Group2.five", - "client.structure.twooperationgroup.Group2Client.six": "Client.Structure.TwoOperationGroup.Group2.six", - "client.structure.twooperationgroup.Group2Client.sixWithResponse": "Client.Structure.TwoOperationGroup.Group2.six", - "client.structure.twooperationgroup.Group2Client.two": "Client.Structure.TwoOperationGroup.Group2.two", - "client.structure.twooperationgroup.Group2Client.twoWithResponse": "Client.Structure.TwoOperationGroup.Group2.two", - "client.structure.twooperationgroup.TwoOperationGroupClientBuilder": "Client.Structure.TwoOperationGroup" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_metadata.json deleted file mode 100644 index a3c5969f803..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"client.structure.service.models.ClientType":"Client.Structure.Service.ClientType","client.structure.twooperationgroup.Group1AsyncClient":"Client.Structure.TwoOperationGroup.Group1","client.structure.twooperationgroup.Group1AsyncClient.four":"Client.Structure.TwoOperationGroup.Group1.four","client.structure.twooperationgroup.Group1AsyncClient.fourWithResponse":"Client.Structure.TwoOperationGroup.Group1.four","client.structure.twooperationgroup.Group1AsyncClient.one":"Client.Structure.TwoOperationGroup.Group1.one","client.structure.twooperationgroup.Group1AsyncClient.oneWithResponse":"Client.Structure.TwoOperationGroup.Group1.one","client.structure.twooperationgroup.Group1AsyncClient.three":"Client.Structure.TwoOperationGroup.Group1.three","client.structure.twooperationgroup.Group1AsyncClient.threeWithResponse":"Client.Structure.TwoOperationGroup.Group1.three","client.structure.twooperationgroup.Group1Client":"Client.Structure.TwoOperationGroup.Group1","client.structure.twooperationgroup.Group1Client.four":"Client.Structure.TwoOperationGroup.Group1.four","client.structure.twooperationgroup.Group1Client.fourWithResponse":"Client.Structure.TwoOperationGroup.Group1.four","client.structure.twooperationgroup.Group1Client.one":"Client.Structure.TwoOperationGroup.Group1.one","client.structure.twooperationgroup.Group1Client.oneWithResponse":"Client.Structure.TwoOperationGroup.Group1.one","client.structure.twooperationgroup.Group1Client.three":"Client.Structure.TwoOperationGroup.Group1.three","client.structure.twooperationgroup.Group1Client.threeWithResponse":"Client.Structure.TwoOperationGroup.Group1.three","client.structure.twooperationgroup.Group2AsyncClient":"Client.Structure.TwoOperationGroup.Group2","client.structure.twooperationgroup.Group2AsyncClient.five":"Client.Structure.TwoOperationGroup.Group2.five","client.structure.twooperationgroup.Group2AsyncClient.fiveWithResponse":"Client.Structure.TwoOperationGroup.Group2.five","client.structure.twooperationgroup.Group2AsyncClient.six":"Client.Structure.TwoOperationGroup.Group2.six","client.structure.twooperationgroup.Group2AsyncClient.sixWithResponse":"Client.Structure.TwoOperationGroup.Group2.six","client.structure.twooperationgroup.Group2AsyncClient.two":"Client.Structure.TwoOperationGroup.Group2.two","client.structure.twooperationgroup.Group2AsyncClient.twoWithResponse":"Client.Structure.TwoOperationGroup.Group2.two","client.structure.twooperationgroup.Group2Client":"Client.Structure.TwoOperationGroup.Group2","client.structure.twooperationgroup.Group2Client.five":"Client.Structure.TwoOperationGroup.Group2.five","client.structure.twooperationgroup.Group2Client.fiveWithResponse":"Client.Structure.TwoOperationGroup.Group2.five","client.structure.twooperationgroup.Group2Client.six":"Client.Structure.TwoOperationGroup.Group2.six","client.structure.twooperationgroup.Group2Client.sixWithResponse":"Client.Structure.TwoOperationGroup.Group2.six","client.structure.twooperationgroup.Group2Client.two":"Client.Structure.TwoOperationGroup.Group2.two","client.structure.twooperationgroup.Group2Client.twoWithResponse":"Client.Structure.TwoOperationGroup.Group2.two","client.structure.twooperationgroup.TwoOperationGroupClientBuilder":"Client.Structure.TwoOperationGroup"},"generatedFiles":["src/main/java/client/structure/service/models/ClientType.java","src/main/java/client/structure/service/models/package-info.java","src/main/java/client/structure/twooperationgroup/Group1AsyncClient.java","src/main/java/client/structure/twooperationgroup/Group1Client.java","src/main/java/client/structure/twooperationgroup/Group2AsyncClient.java","src/main/java/client/structure/twooperationgroup/Group2Client.java","src/main/java/client/structure/twooperationgroup/TwoOperationGroupClientBuilder.java","src/main/java/client/structure/twooperationgroup/implementation/Group1sImpl.java","src/main/java/client/structure/twooperationgroup/implementation/Group2sImpl.java","src/main/java/client/structure/twooperationgroup/implementation/TwoOperationGroupClientImpl.java","src/main/java/client/structure/twooperationgroup/implementation/package-info.java","src/main/java/client/structure/twooperationgroup/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_apiview_properties.json deleted file mode 100644 index d2aa92134d7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_apiview_properties.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "documentation.DocumentationClientBuilder": "Documentation", - "documentation.ListsAsyncClient": "Documentation.Lists", - "documentation.ListsAsyncClient.bulletPointsModel": "Documentation.Lists.bulletPointsModel", - "documentation.ListsAsyncClient.bulletPointsModelWithResponse": "Documentation.Lists.bulletPointsModel", - "documentation.ListsAsyncClient.bulletPointsOp": "Documentation.Lists.bulletPointsOp", - "documentation.ListsAsyncClient.bulletPointsOpWithResponse": "Documentation.Lists.bulletPointsOp", - "documentation.ListsAsyncClient.numbered": "Documentation.Lists.numbered", - "documentation.ListsAsyncClient.numberedWithResponse": "Documentation.Lists.numbered", - "documentation.ListsClient": "Documentation.Lists", - "documentation.ListsClient.bulletPointsModel": "Documentation.Lists.bulletPointsModel", - "documentation.ListsClient.bulletPointsModelWithResponse": "Documentation.Lists.bulletPointsModel", - "documentation.ListsClient.bulletPointsOp": "Documentation.Lists.bulletPointsOp", - "documentation.ListsClient.bulletPointsOpWithResponse": "Documentation.Lists.bulletPointsOp", - "documentation.ListsClient.numbered": "Documentation.Lists.numbered", - "documentation.ListsClient.numberedWithResponse": "Documentation.Lists.numbered", - "documentation.TextFormattingAsyncClient": "Documentation.TextFormatting", - "documentation.TextFormattingAsyncClient.boldText": "Documentation.TextFormatting.boldText", - "documentation.TextFormattingAsyncClient.boldTextWithResponse": "Documentation.TextFormatting.boldText", - "documentation.TextFormattingAsyncClient.combinedFormatting": "Documentation.TextFormatting.combinedFormatting", - "documentation.TextFormattingAsyncClient.combinedFormattingWithResponse": "Documentation.TextFormatting.combinedFormatting", - "documentation.TextFormattingAsyncClient.italicText": "Documentation.TextFormatting.italicText", - "documentation.TextFormattingAsyncClient.italicTextWithResponse": "Documentation.TextFormatting.italicText", - "documentation.TextFormattingClient": "Documentation.TextFormatting", - "documentation.TextFormattingClient.boldText": "Documentation.TextFormatting.boldText", - "documentation.TextFormattingClient.boldTextWithResponse": "Documentation.TextFormatting.boldText", - "documentation.TextFormattingClient.combinedFormatting": "Documentation.TextFormatting.combinedFormatting", - "documentation.TextFormattingClient.combinedFormattingWithResponse": "Documentation.TextFormatting.combinedFormatting", - "documentation.TextFormattingClient.italicText": "Documentation.TextFormatting.italicText", - "documentation.TextFormattingClient.italicTextWithResponse": "Documentation.TextFormatting.italicText", - "documentation.lists.implementation.models.BulletPointsModelRequest": "Documentation.Lists.bulletPointsModel.Request.anonymous", - "documentation.lists.models.BulletPointsEnum": "Documentation.Lists.BulletPointsEnum", - "documentation.lists.models.BulletPointsModel": "Documentation.Lists.BulletPointsModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_metadata.json deleted file mode 100644 index 8e1a954c7f1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"documentation.DocumentationClientBuilder":"Documentation","documentation.ListsAsyncClient":"Documentation.Lists","documentation.ListsAsyncClient.bulletPointsModel":"Documentation.Lists.bulletPointsModel","documentation.ListsAsyncClient.bulletPointsModelWithResponse":"Documentation.Lists.bulletPointsModel","documentation.ListsAsyncClient.bulletPointsOp":"Documentation.Lists.bulletPointsOp","documentation.ListsAsyncClient.bulletPointsOpWithResponse":"Documentation.Lists.bulletPointsOp","documentation.ListsAsyncClient.numbered":"Documentation.Lists.numbered","documentation.ListsAsyncClient.numberedWithResponse":"Documentation.Lists.numbered","documentation.ListsClient":"Documentation.Lists","documentation.ListsClient.bulletPointsModel":"Documentation.Lists.bulletPointsModel","documentation.ListsClient.bulletPointsModelWithResponse":"Documentation.Lists.bulletPointsModel","documentation.ListsClient.bulletPointsOp":"Documentation.Lists.bulletPointsOp","documentation.ListsClient.bulletPointsOpWithResponse":"Documentation.Lists.bulletPointsOp","documentation.ListsClient.numbered":"Documentation.Lists.numbered","documentation.ListsClient.numberedWithResponse":"Documentation.Lists.numbered","documentation.TextFormattingAsyncClient":"Documentation.TextFormatting","documentation.TextFormattingAsyncClient.boldText":"Documentation.TextFormatting.boldText","documentation.TextFormattingAsyncClient.boldTextWithResponse":"Documentation.TextFormatting.boldText","documentation.TextFormattingAsyncClient.combinedFormatting":"Documentation.TextFormatting.combinedFormatting","documentation.TextFormattingAsyncClient.combinedFormattingWithResponse":"Documentation.TextFormatting.combinedFormatting","documentation.TextFormattingAsyncClient.italicText":"Documentation.TextFormatting.italicText","documentation.TextFormattingAsyncClient.italicTextWithResponse":"Documentation.TextFormatting.italicText","documentation.TextFormattingClient":"Documentation.TextFormatting","documentation.TextFormattingClient.boldText":"Documentation.TextFormatting.boldText","documentation.TextFormattingClient.boldTextWithResponse":"Documentation.TextFormatting.boldText","documentation.TextFormattingClient.combinedFormatting":"Documentation.TextFormatting.combinedFormatting","documentation.TextFormattingClient.combinedFormattingWithResponse":"Documentation.TextFormatting.combinedFormatting","documentation.TextFormattingClient.italicText":"Documentation.TextFormatting.italicText","documentation.TextFormattingClient.italicTextWithResponse":"Documentation.TextFormatting.italicText","documentation.lists.implementation.models.BulletPointsModelRequest":"Documentation.Lists.bulletPointsModel.Request.anonymous","documentation.lists.models.BulletPointsEnum":"Documentation.Lists.BulletPointsEnum","documentation.lists.models.BulletPointsModel":"Documentation.Lists.BulletPointsModel"},"generatedFiles":["src/main/java/documentation/DocumentationClientBuilder.java","src/main/java/documentation/ListsAsyncClient.java","src/main/java/documentation/ListsClient.java","src/main/java/documentation/TextFormattingAsyncClient.java","src/main/java/documentation/TextFormattingClient.java","src/main/java/documentation/implementation/DocumentationClientImpl.java","src/main/java/documentation/implementation/ListsImpl.java","src/main/java/documentation/implementation/TextFormattingsImpl.java","src/main/java/documentation/implementation/package-info.java","src/main/java/documentation/lists/implementation/models/BulletPointsModelRequest.java","src/main/java/documentation/lists/implementation/models/package-info.java","src/main/java/documentation/lists/models/BulletPointsEnum.java","src/main/java/documentation/lists/models/BulletPointsModel.java","src/main/java/documentation/lists/models/package-info.java","src/main/java/documentation/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_apiview_properties.json deleted file mode 100644 index 47a20deb2f2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_apiview_properties.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "encode.array.ArrayAsyncClient": "Encode.Array.Property", - "encode.array.ArrayAsyncClient.commaDelimited": "Encode.Array.Property.commaDelimited", - "encode.array.ArrayAsyncClient.commaDelimitedWithResponse": "Encode.Array.Property.commaDelimited", - "encode.array.ArrayAsyncClient.newlineDelimited": "Encode.Array.Property.newlineDelimited", - "encode.array.ArrayAsyncClient.newlineDelimitedWithResponse": "Encode.Array.Property.newlineDelimited", - "encode.array.ArrayAsyncClient.pipeDelimited": "Encode.Array.Property.pipeDelimited", - "encode.array.ArrayAsyncClient.pipeDelimitedWithResponse": "Encode.Array.Property.pipeDelimited", - "encode.array.ArrayAsyncClient.spaceDelimited": "Encode.Array.Property.spaceDelimited", - "encode.array.ArrayAsyncClient.spaceDelimitedWithResponse": "Encode.Array.Property.spaceDelimited", - "encode.array.ArrayClient": "Encode.Array.Property", - "encode.array.ArrayClient.commaDelimited": "Encode.Array.Property.commaDelimited", - "encode.array.ArrayClient.commaDelimitedWithResponse": "Encode.Array.Property.commaDelimited", - "encode.array.ArrayClient.newlineDelimited": "Encode.Array.Property.newlineDelimited", - "encode.array.ArrayClient.newlineDelimitedWithResponse": "Encode.Array.Property.newlineDelimited", - "encode.array.ArrayClient.pipeDelimited": "Encode.Array.Property.pipeDelimited", - "encode.array.ArrayClient.pipeDelimitedWithResponse": "Encode.Array.Property.pipeDelimited", - "encode.array.ArrayClient.spaceDelimited": "Encode.Array.Property.spaceDelimited", - "encode.array.ArrayClient.spaceDelimitedWithResponse": "Encode.Array.Property.spaceDelimited", - "encode.array.ArrayClientBuilder": "Encode.Array", - "encode.array.models.CommaDelimitedArrayProperty": "Encode.Array.CommaDelimitedArrayProperty", - "encode.array.models.NewlineDelimitedArrayProperty": "Encode.Array.NewlineDelimitedArrayProperty", - "encode.array.models.PipeDelimitedArrayProperty": "Encode.Array.PipeDelimitedArrayProperty", - "encode.array.models.SpaceDelimitedArrayProperty": "Encode.Array.SpaceDelimitedArrayProperty" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_metadata.json deleted file mode 100644 index a094a17ad8f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"encode.array.ArrayAsyncClient":"Encode.Array.Property","encode.array.ArrayAsyncClient.commaDelimited":"Encode.Array.Property.commaDelimited","encode.array.ArrayAsyncClient.commaDelimitedWithResponse":"Encode.Array.Property.commaDelimited","encode.array.ArrayAsyncClient.newlineDelimited":"Encode.Array.Property.newlineDelimited","encode.array.ArrayAsyncClient.newlineDelimitedWithResponse":"Encode.Array.Property.newlineDelimited","encode.array.ArrayAsyncClient.pipeDelimited":"Encode.Array.Property.pipeDelimited","encode.array.ArrayAsyncClient.pipeDelimitedWithResponse":"Encode.Array.Property.pipeDelimited","encode.array.ArrayAsyncClient.spaceDelimited":"Encode.Array.Property.spaceDelimited","encode.array.ArrayAsyncClient.spaceDelimitedWithResponse":"Encode.Array.Property.spaceDelimited","encode.array.ArrayClient":"Encode.Array.Property","encode.array.ArrayClient.commaDelimited":"Encode.Array.Property.commaDelimited","encode.array.ArrayClient.commaDelimitedWithResponse":"Encode.Array.Property.commaDelimited","encode.array.ArrayClient.newlineDelimited":"Encode.Array.Property.newlineDelimited","encode.array.ArrayClient.newlineDelimitedWithResponse":"Encode.Array.Property.newlineDelimited","encode.array.ArrayClient.pipeDelimited":"Encode.Array.Property.pipeDelimited","encode.array.ArrayClient.pipeDelimitedWithResponse":"Encode.Array.Property.pipeDelimited","encode.array.ArrayClient.spaceDelimited":"Encode.Array.Property.spaceDelimited","encode.array.ArrayClient.spaceDelimitedWithResponse":"Encode.Array.Property.spaceDelimited","encode.array.ArrayClientBuilder":"Encode.Array","encode.array.models.CommaDelimitedArrayProperty":"Encode.Array.CommaDelimitedArrayProperty","encode.array.models.NewlineDelimitedArrayProperty":"Encode.Array.NewlineDelimitedArrayProperty","encode.array.models.PipeDelimitedArrayProperty":"Encode.Array.PipeDelimitedArrayProperty","encode.array.models.SpaceDelimitedArrayProperty":"Encode.Array.SpaceDelimitedArrayProperty"},"generatedFiles":["src/main/java/encode/array/ArrayAsyncClient.java","src/main/java/encode/array/ArrayClient.java","src/main/java/encode/array/ArrayClientBuilder.java","src/main/java/encode/array/implementation/ArrayClientImpl.java","src/main/java/encode/array/implementation/PropertiesImpl.java","src/main/java/encode/array/implementation/package-info.java","src/main/java/encode/array/models/CommaDelimitedArrayProperty.java","src/main/java/encode/array/models/NewlineDelimitedArrayProperty.java","src/main/java/encode/array/models/PipeDelimitedArrayProperty.java","src/main/java/encode/array/models/SpaceDelimitedArrayProperty.java","src/main/java/encode/array/models/package-info.java","src/main/java/encode/array/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_apiview_properties.json deleted file mode 100644 index 1497454c2d1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_apiview_properties.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "encode.bytes.BytesClientBuilder": "Encode.Bytes", - "encode.bytes.HeaderAsyncClient": "Encode.Bytes.Header", - "encode.bytes.HeaderAsyncClient.base64": "Encode.Bytes.Header.base64", - "encode.bytes.HeaderAsyncClient.base64WithResponse": "Encode.Bytes.Header.base64", - "encode.bytes.HeaderAsyncClient.base64url": "Encode.Bytes.Header.base64url", - "encode.bytes.HeaderAsyncClient.base64urlArray": "Encode.Bytes.Header.base64urlArray", - "encode.bytes.HeaderAsyncClient.base64urlArrayWithResponse": "Encode.Bytes.Header.base64urlArray", - "encode.bytes.HeaderAsyncClient.base64urlWithResponse": "Encode.Bytes.Header.base64url", - "encode.bytes.HeaderAsyncClient.defaultMethod": "Encode.Bytes.Header.default", - "encode.bytes.HeaderAsyncClient.defaultMethodWithResponse": "Encode.Bytes.Header.default", - "encode.bytes.HeaderClient": "Encode.Bytes.Header", - "encode.bytes.HeaderClient.base64": "Encode.Bytes.Header.base64", - "encode.bytes.HeaderClient.base64WithResponse": "Encode.Bytes.Header.base64", - "encode.bytes.HeaderClient.base64url": "Encode.Bytes.Header.base64url", - "encode.bytes.HeaderClient.base64urlArray": "Encode.Bytes.Header.base64urlArray", - "encode.bytes.HeaderClient.base64urlArrayWithResponse": "Encode.Bytes.Header.base64urlArray", - "encode.bytes.HeaderClient.base64urlWithResponse": "Encode.Bytes.Header.base64url", - "encode.bytes.HeaderClient.defaultMethod": "Encode.Bytes.Header.default", - "encode.bytes.HeaderClient.defaultMethodWithResponse": "Encode.Bytes.Header.default", - "encode.bytes.PropertyAsyncClient": "Encode.Bytes.Property", - "encode.bytes.PropertyAsyncClient.base64": "Encode.Bytes.Property.base64", - "encode.bytes.PropertyAsyncClient.base64WithResponse": "Encode.Bytes.Property.base64", - "encode.bytes.PropertyAsyncClient.base64url": "Encode.Bytes.Property.base64url", - "encode.bytes.PropertyAsyncClient.base64urlArray": "Encode.Bytes.Property.base64urlArray", - "encode.bytes.PropertyAsyncClient.base64urlArrayWithResponse": "Encode.Bytes.Property.base64urlArray", - "encode.bytes.PropertyAsyncClient.base64urlWithResponse": "Encode.Bytes.Property.base64url", - "encode.bytes.PropertyAsyncClient.defaultMethod": "Encode.Bytes.Property.default", - "encode.bytes.PropertyAsyncClient.defaultMethodWithResponse": "Encode.Bytes.Property.default", - "encode.bytes.PropertyClient": "Encode.Bytes.Property", - "encode.bytes.PropertyClient.base64": "Encode.Bytes.Property.base64", - "encode.bytes.PropertyClient.base64WithResponse": "Encode.Bytes.Property.base64", - "encode.bytes.PropertyClient.base64url": "Encode.Bytes.Property.base64url", - "encode.bytes.PropertyClient.base64urlArray": "Encode.Bytes.Property.base64urlArray", - "encode.bytes.PropertyClient.base64urlArrayWithResponse": "Encode.Bytes.Property.base64urlArray", - "encode.bytes.PropertyClient.base64urlWithResponse": "Encode.Bytes.Property.base64url", - "encode.bytes.PropertyClient.defaultMethod": "Encode.Bytes.Property.default", - "encode.bytes.PropertyClient.defaultMethodWithResponse": "Encode.Bytes.Property.default", - "encode.bytes.QueryAsyncClient": "Encode.Bytes.Query", - "encode.bytes.QueryAsyncClient.base64": "Encode.Bytes.Query.base64", - "encode.bytes.QueryAsyncClient.base64WithResponse": "Encode.Bytes.Query.base64", - "encode.bytes.QueryAsyncClient.base64url": "Encode.Bytes.Query.base64url", - "encode.bytes.QueryAsyncClient.base64urlArray": "Encode.Bytes.Query.base64urlArray", - "encode.bytes.QueryAsyncClient.base64urlArrayWithResponse": "Encode.Bytes.Query.base64urlArray", - "encode.bytes.QueryAsyncClient.base64urlWithResponse": "Encode.Bytes.Query.base64url", - "encode.bytes.QueryAsyncClient.defaultMethod": "Encode.Bytes.Query.default", - "encode.bytes.QueryAsyncClient.defaultMethodWithResponse": "Encode.Bytes.Query.default", - "encode.bytes.QueryClient": "Encode.Bytes.Query", - "encode.bytes.QueryClient.base64": "Encode.Bytes.Query.base64", - "encode.bytes.QueryClient.base64WithResponse": "Encode.Bytes.Query.base64", - "encode.bytes.QueryClient.base64url": "Encode.Bytes.Query.base64url", - "encode.bytes.QueryClient.base64urlArray": "Encode.Bytes.Query.base64urlArray", - "encode.bytes.QueryClient.base64urlArrayWithResponse": "Encode.Bytes.Query.base64urlArray", - "encode.bytes.QueryClient.base64urlWithResponse": "Encode.Bytes.Query.base64url", - "encode.bytes.QueryClient.defaultMethod": "Encode.Bytes.Query.default", - "encode.bytes.QueryClient.defaultMethodWithResponse": "Encode.Bytes.Query.default", - "encode.bytes.RequestBodyAsyncClient": "Encode.Bytes.RequestBody", - "encode.bytes.RequestBodyAsyncClient.base64": "Encode.Bytes.RequestBody.base64", - "encode.bytes.RequestBodyAsyncClient.base64WithResponse": "Encode.Bytes.RequestBody.base64", - "encode.bytes.RequestBodyAsyncClient.base64url": "Encode.Bytes.RequestBody.base64url", - "encode.bytes.RequestBodyAsyncClient.base64urlWithResponse": "Encode.Bytes.RequestBody.base64url", - "encode.bytes.RequestBodyAsyncClient.customContentType": "Encode.Bytes.RequestBody.customContentType", - "encode.bytes.RequestBodyAsyncClient.customContentTypeWithResponse": "Encode.Bytes.RequestBody.customContentType", - "encode.bytes.RequestBodyAsyncClient.defaultMethod": "Encode.Bytes.RequestBody.default", - "encode.bytes.RequestBodyAsyncClient.defaultMethodWithResponse": "Encode.Bytes.RequestBody.default", - "encode.bytes.RequestBodyAsyncClient.octetStream": "Encode.Bytes.RequestBody.octetStream", - "encode.bytes.RequestBodyAsyncClient.octetStreamWithResponse": "Encode.Bytes.RequestBody.octetStream", - "encode.bytes.RequestBodyClient": "Encode.Bytes.RequestBody", - "encode.bytes.RequestBodyClient.base64": "Encode.Bytes.RequestBody.base64", - "encode.bytes.RequestBodyClient.base64WithResponse": "Encode.Bytes.RequestBody.base64", - "encode.bytes.RequestBodyClient.base64url": "Encode.Bytes.RequestBody.base64url", - "encode.bytes.RequestBodyClient.base64urlWithResponse": "Encode.Bytes.RequestBody.base64url", - "encode.bytes.RequestBodyClient.customContentType": "Encode.Bytes.RequestBody.customContentType", - "encode.bytes.RequestBodyClient.customContentTypeWithResponse": "Encode.Bytes.RequestBody.customContentType", - "encode.bytes.RequestBodyClient.defaultMethod": "Encode.Bytes.RequestBody.default", - "encode.bytes.RequestBodyClient.defaultMethodWithResponse": "Encode.Bytes.RequestBody.default", - "encode.bytes.RequestBodyClient.octetStream": "Encode.Bytes.RequestBody.octetStream", - "encode.bytes.RequestBodyClient.octetStreamWithResponse": "Encode.Bytes.RequestBody.octetStream", - "encode.bytes.ResponseBodyAsyncClient": "Encode.Bytes.ResponseBody", - "encode.bytes.ResponseBodyAsyncClient.base64": "Encode.Bytes.ResponseBody.base64", - "encode.bytes.ResponseBodyAsyncClient.base64WithResponse": "Encode.Bytes.ResponseBody.base64", - "encode.bytes.ResponseBodyAsyncClient.base64url": "Encode.Bytes.ResponseBody.base64url", - "encode.bytes.ResponseBodyAsyncClient.base64urlWithResponse": "Encode.Bytes.ResponseBody.base64url", - "encode.bytes.ResponseBodyAsyncClient.customContentType": "Encode.Bytes.ResponseBody.customContentType", - "encode.bytes.ResponseBodyAsyncClient.customContentTypeWithResponse": "Encode.Bytes.ResponseBody.customContentType", - "encode.bytes.ResponseBodyAsyncClient.defaultMethod": "Encode.Bytes.ResponseBody.default", - "encode.bytes.ResponseBodyAsyncClient.defaultMethodWithResponse": "Encode.Bytes.ResponseBody.default", - "encode.bytes.ResponseBodyAsyncClient.octetStream": "Encode.Bytes.ResponseBody.octetStream", - "encode.bytes.ResponseBodyAsyncClient.octetStreamWithResponse": "Encode.Bytes.ResponseBody.octetStream", - "encode.bytes.ResponseBodyClient": "Encode.Bytes.ResponseBody", - "encode.bytes.ResponseBodyClient.base64": "Encode.Bytes.ResponseBody.base64", - "encode.bytes.ResponseBodyClient.base64WithResponse": "Encode.Bytes.ResponseBody.base64", - "encode.bytes.ResponseBodyClient.base64url": "Encode.Bytes.ResponseBody.base64url", - "encode.bytes.ResponseBodyClient.base64urlWithResponse": "Encode.Bytes.ResponseBody.base64url", - "encode.bytes.ResponseBodyClient.customContentType": "Encode.Bytes.ResponseBody.customContentType", - "encode.bytes.ResponseBodyClient.customContentTypeWithResponse": "Encode.Bytes.ResponseBody.customContentType", - "encode.bytes.ResponseBodyClient.defaultMethod": "Encode.Bytes.ResponseBody.default", - "encode.bytes.ResponseBodyClient.defaultMethodWithResponse": "Encode.Bytes.ResponseBody.default", - "encode.bytes.ResponseBodyClient.octetStream": "Encode.Bytes.ResponseBody.octetStream", - "encode.bytes.ResponseBodyClient.octetStreamWithResponse": "Encode.Bytes.ResponseBody.octetStream", - "encode.bytes.models.Base64BytesProperty": "Encode.Bytes.Base64BytesProperty", - "encode.bytes.models.Base64urlArrayBytesProperty": "Encode.Bytes.Base64urlArrayBytesProperty", - "encode.bytes.models.Base64urlBytesProperty": "Encode.Bytes.Base64urlBytesProperty", - "encode.bytes.models.DefaultBytesProperty": "Encode.Bytes.DefaultBytesProperty" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_metadata.json deleted file mode 100644 index 3654d682d58..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"encode.bytes.BytesClientBuilder":"Encode.Bytes","encode.bytes.HeaderAsyncClient":"Encode.Bytes.Header","encode.bytes.HeaderAsyncClient.base64":"Encode.Bytes.Header.base64","encode.bytes.HeaderAsyncClient.base64WithResponse":"Encode.Bytes.Header.base64","encode.bytes.HeaderAsyncClient.base64url":"Encode.Bytes.Header.base64url","encode.bytes.HeaderAsyncClient.base64urlArray":"Encode.Bytes.Header.base64urlArray","encode.bytes.HeaderAsyncClient.base64urlArrayWithResponse":"Encode.Bytes.Header.base64urlArray","encode.bytes.HeaderAsyncClient.base64urlWithResponse":"Encode.Bytes.Header.base64url","encode.bytes.HeaderAsyncClient.defaultMethod":"Encode.Bytes.Header.default","encode.bytes.HeaderAsyncClient.defaultMethodWithResponse":"Encode.Bytes.Header.default","encode.bytes.HeaderClient":"Encode.Bytes.Header","encode.bytes.HeaderClient.base64":"Encode.Bytes.Header.base64","encode.bytes.HeaderClient.base64WithResponse":"Encode.Bytes.Header.base64","encode.bytes.HeaderClient.base64url":"Encode.Bytes.Header.base64url","encode.bytes.HeaderClient.base64urlArray":"Encode.Bytes.Header.base64urlArray","encode.bytes.HeaderClient.base64urlArrayWithResponse":"Encode.Bytes.Header.base64urlArray","encode.bytes.HeaderClient.base64urlWithResponse":"Encode.Bytes.Header.base64url","encode.bytes.HeaderClient.defaultMethod":"Encode.Bytes.Header.default","encode.bytes.HeaderClient.defaultMethodWithResponse":"Encode.Bytes.Header.default","encode.bytes.PropertyAsyncClient":"Encode.Bytes.Property","encode.bytes.PropertyAsyncClient.base64":"Encode.Bytes.Property.base64","encode.bytes.PropertyAsyncClient.base64WithResponse":"Encode.Bytes.Property.base64","encode.bytes.PropertyAsyncClient.base64url":"Encode.Bytes.Property.base64url","encode.bytes.PropertyAsyncClient.base64urlArray":"Encode.Bytes.Property.base64urlArray","encode.bytes.PropertyAsyncClient.base64urlArrayWithResponse":"Encode.Bytes.Property.base64urlArray","encode.bytes.PropertyAsyncClient.base64urlWithResponse":"Encode.Bytes.Property.base64url","encode.bytes.PropertyAsyncClient.defaultMethod":"Encode.Bytes.Property.default","encode.bytes.PropertyAsyncClient.defaultMethodWithResponse":"Encode.Bytes.Property.default","encode.bytes.PropertyClient":"Encode.Bytes.Property","encode.bytes.PropertyClient.base64":"Encode.Bytes.Property.base64","encode.bytes.PropertyClient.base64WithResponse":"Encode.Bytes.Property.base64","encode.bytes.PropertyClient.base64url":"Encode.Bytes.Property.base64url","encode.bytes.PropertyClient.base64urlArray":"Encode.Bytes.Property.base64urlArray","encode.bytes.PropertyClient.base64urlArrayWithResponse":"Encode.Bytes.Property.base64urlArray","encode.bytes.PropertyClient.base64urlWithResponse":"Encode.Bytes.Property.base64url","encode.bytes.PropertyClient.defaultMethod":"Encode.Bytes.Property.default","encode.bytes.PropertyClient.defaultMethodWithResponse":"Encode.Bytes.Property.default","encode.bytes.QueryAsyncClient":"Encode.Bytes.Query","encode.bytes.QueryAsyncClient.base64":"Encode.Bytes.Query.base64","encode.bytes.QueryAsyncClient.base64WithResponse":"Encode.Bytes.Query.base64","encode.bytes.QueryAsyncClient.base64url":"Encode.Bytes.Query.base64url","encode.bytes.QueryAsyncClient.base64urlArray":"Encode.Bytes.Query.base64urlArray","encode.bytes.QueryAsyncClient.base64urlArrayWithResponse":"Encode.Bytes.Query.base64urlArray","encode.bytes.QueryAsyncClient.base64urlWithResponse":"Encode.Bytes.Query.base64url","encode.bytes.QueryAsyncClient.defaultMethod":"Encode.Bytes.Query.default","encode.bytes.QueryAsyncClient.defaultMethodWithResponse":"Encode.Bytes.Query.default","encode.bytes.QueryClient":"Encode.Bytes.Query","encode.bytes.QueryClient.base64":"Encode.Bytes.Query.base64","encode.bytes.QueryClient.base64WithResponse":"Encode.Bytes.Query.base64","encode.bytes.QueryClient.base64url":"Encode.Bytes.Query.base64url","encode.bytes.QueryClient.base64urlArray":"Encode.Bytes.Query.base64urlArray","encode.bytes.QueryClient.base64urlArrayWithResponse":"Encode.Bytes.Query.base64urlArray","encode.bytes.QueryClient.base64urlWithResponse":"Encode.Bytes.Query.base64url","encode.bytes.QueryClient.defaultMethod":"Encode.Bytes.Query.default","encode.bytes.QueryClient.defaultMethodWithResponse":"Encode.Bytes.Query.default","encode.bytes.RequestBodyAsyncClient":"Encode.Bytes.RequestBody","encode.bytes.RequestBodyAsyncClient.base64":"Encode.Bytes.RequestBody.base64","encode.bytes.RequestBodyAsyncClient.base64WithResponse":"Encode.Bytes.RequestBody.base64","encode.bytes.RequestBodyAsyncClient.base64url":"Encode.Bytes.RequestBody.base64url","encode.bytes.RequestBodyAsyncClient.base64urlWithResponse":"Encode.Bytes.RequestBody.base64url","encode.bytes.RequestBodyAsyncClient.customContentType":"Encode.Bytes.RequestBody.customContentType","encode.bytes.RequestBodyAsyncClient.customContentTypeWithResponse":"Encode.Bytes.RequestBody.customContentType","encode.bytes.RequestBodyAsyncClient.defaultMethod":"Encode.Bytes.RequestBody.default","encode.bytes.RequestBodyAsyncClient.defaultMethodWithResponse":"Encode.Bytes.RequestBody.default","encode.bytes.RequestBodyAsyncClient.octetStream":"Encode.Bytes.RequestBody.octetStream","encode.bytes.RequestBodyAsyncClient.octetStreamWithResponse":"Encode.Bytes.RequestBody.octetStream","encode.bytes.RequestBodyClient":"Encode.Bytes.RequestBody","encode.bytes.RequestBodyClient.base64":"Encode.Bytes.RequestBody.base64","encode.bytes.RequestBodyClient.base64WithResponse":"Encode.Bytes.RequestBody.base64","encode.bytes.RequestBodyClient.base64url":"Encode.Bytes.RequestBody.base64url","encode.bytes.RequestBodyClient.base64urlWithResponse":"Encode.Bytes.RequestBody.base64url","encode.bytes.RequestBodyClient.customContentType":"Encode.Bytes.RequestBody.customContentType","encode.bytes.RequestBodyClient.customContentTypeWithResponse":"Encode.Bytes.RequestBody.customContentType","encode.bytes.RequestBodyClient.defaultMethod":"Encode.Bytes.RequestBody.default","encode.bytes.RequestBodyClient.defaultMethodWithResponse":"Encode.Bytes.RequestBody.default","encode.bytes.RequestBodyClient.octetStream":"Encode.Bytes.RequestBody.octetStream","encode.bytes.RequestBodyClient.octetStreamWithResponse":"Encode.Bytes.RequestBody.octetStream","encode.bytes.ResponseBodyAsyncClient":"Encode.Bytes.ResponseBody","encode.bytes.ResponseBodyAsyncClient.base64":"Encode.Bytes.ResponseBody.base64","encode.bytes.ResponseBodyAsyncClient.base64WithResponse":"Encode.Bytes.ResponseBody.base64","encode.bytes.ResponseBodyAsyncClient.base64url":"Encode.Bytes.ResponseBody.base64url","encode.bytes.ResponseBodyAsyncClient.base64urlWithResponse":"Encode.Bytes.ResponseBody.base64url","encode.bytes.ResponseBodyAsyncClient.customContentType":"Encode.Bytes.ResponseBody.customContentType","encode.bytes.ResponseBodyAsyncClient.customContentTypeWithResponse":"Encode.Bytes.ResponseBody.customContentType","encode.bytes.ResponseBodyAsyncClient.defaultMethod":"Encode.Bytes.ResponseBody.default","encode.bytes.ResponseBodyAsyncClient.defaultMethodWithResponse":"Encode.Bytes.ResponseBody.default","encode.bytes.ResponseBodyAsyncClient.octetStream":"Encode.Bytes.ResponseBody.octetStream","encode.bytes.ResponseBodyAsyncClient.octetStreamWithResponse":"Encode.Bytes.ResponseBody.octetStream","encode.bytes.ResponseBodyClient":"Encode.Bytes.ResponseBody","encode.bytes.ResponseBodyClient.base64":"Encode.Bytes.ResponseBody.base64","encode.bytes.ResponseBodyClient.base64WithResponse":"Encode.Bytes.ResponseBody.base64","encode.bytes.ResponseBodyClient.base64url":"Encode.Bytes.ResponseBody.base64url","encode.bytes.ResponseBodyClient.base64urlWithResponse":"Encode.Bytes.ResponseBody.base64url","encode.bytes.ResponseBodyClient.customContentType":"Encode.Bytes.ResponseBody.customContentType","encode.bytes.ResponseBodyClient.customContentTypeWithResponse":"Encode.Bytes.ResponseBody.customContentType","encode.bytes.ResponseBodyClient.defaultMethod":"Encode.Bytes.ResponseBody.default","encode.bytes.ResponseBodyClient.defaultMethodWithResponse":"Encode.Bytes.ResponseBody.default","encode.bytes.ResponseBodyClient.octetStream":"Encode.Bytes.ResponseBody.octetStream","encode.bytes.ResponseBodyClient.octetStreamWithResponse":"Encode.Bytes.ResponseBody.octetStream","encode.bytes.models.Base64BytesProperty":"Encode.Bytes.Base64BytesProperty","encode.bytes.models.Base64urlArrayBytesProperty":"Encode.Bytes.Base64urlArrayBytesProperty","encode.bytes.models.Base64urlBytesProperty":"Encode.Bytes.Base64urlBytesProperty","encode.bytes.models.DefaultBytesProperty":"Encode.Bytes.DefaultBytesProperty"},"generatedFiles":["src/main/java/encode/bytes/BytesClientBuilder.java","src/main/java/encode/bytes/HeaderAsyncClient.java","src/main/java/encode/bytes/HeaderClient.java","src/main/java/encode/bytes/PropertyAsyncClient.java","src/main/java/encode/bytes/PropertyClient.java","src/main/java/encode/bytes/QueryAsyncClient.java","src/main/java/encode/bytes/QueryClient.java","src/main/java/encode/bytes/RequestBodyAsyncClient.java","src/main/java/encode/bytes/RequestBodyClient.java","src/main/java/encode/bytes/ResponseBodyAsyncClient.java","src/main/java/encode/bytes/ResponseBodyClient.java","src/main/java/encode/bytes/implementation/BytesClientImpl.java","src/main/java/encode/bytes/implementation/HeadersImpl.java","src/main/java/encode/bytes/implementation/PropertiesImpl.java","src/main/java/encode/bytes/implementation/QueriesImpl.java","src/main/java/encode/bytes/implementation/RequestBodiesImpl.java","src/main/java/encode/bytes/implementation/ResponseBodiesImpl.java","src/main/java/encode/bytes/implementation/package-info.java","src/main/java/encode/bytes/models/Base64BytesProperty.java","src/main/java/encode/bytes/models/Base64urlArrayBytesProperty.java","src/main/java/encode/bytes/models/Base64urlBytesProperty.java","src/main/java/encode/bytes/models/DefaultBytesProperty.java","src/main/java/encode/bytes/models/package-info.java","src/main/java/encode/bytes/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_apiview_properties.json deleted file mode 100644 index 0ccdfc55975..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_apiview_properties.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "encode.datetime.DatetimeClientBuilder": "Encode.Datetime", - "encode.datetime.HeaderAsyncClient": "Encode.Datetime.Header", - "encode.datetime.HeaderAsyncClient.defaultMethod": "Encode.Datetime.Header.default", - "encode.datetime.HeaderAsyncClient.defaultMethodWithResponse": "Encode.Datetime.Header.default", - "encode.datetime.HeaderAsyncClient.rfc3339": "Encode.Datetime.Header.rfc3339", - "encode.datetime.HeaderAsyncClient.rfc3339WithResponse": "Encode.Datetime.Header.rfc3339", - "encode.datetime.HeaderAsyncClient.rfc7231": "Encode.Datetime.Header.rfc7231", - "encode.datetime.HeaderAsyncClient.rfc7231WithResponse": "Encode.Datetime.Header.rfc7231", - "encode.datetime.HeaderAsyncClient.unixTimestamp": "Encode.Datetime.Header.unixTimestamp", - "encode.datetime.HeaderAsyncClient.unixTimestampArray": "Encode.Datetime.Header.unixTimestampArray", - "encode.datetime.HeaderAsyncClient.unixTimestampArrayWithResponse": "Encode.Datetime.Header.unixTimestampArray", - "encode.datetime.HeaderAsyncClient.unixTimestampWithResponse": "Encode.Datetime.Header.unixTimestamp", - "encode.datetime.HeaderClient": "Encode.Datetime.Header", - "encode.datetime.HeaderClient.defaultMethod": "Encode.Datetime.Header.default", - "encode.datetime.HeaderClient.defaultMethodWithResponse": "Encode.Datetime.Header.default", - "encode.datetime.HeaderClient.rfc3339": "Encode.Datetime.Header.rfc3339", - "encode.datetime.HeaderClient.rfc3339WithResponse": "Encode.Datetime.Header.rfc3339", - "encode.datetime.HeaderClient.rfc7231": "Encode.Datetime.Header.rfc7231", - "encode.datetime.HeaderClient.rfc7231WithResponse": "Encode.Datetime.Header.rfc7231", - "encode.datetime.HeaderClient.unixTimestamp": "Encode.Datetime.Header.unixTimestamp", - "encode.datetime.HeaderClient.unixTimestampArray": "Encode.Datetime.Header.unixTimestampArray", - "encode.datetime.HeaderClient.unixTimestampArrayWithResponse": "Encode.Datetime.Header.unixTimestampArray", - "encode.datetime.HeaderClient.unixTimestampWithResponse": "Encode.Datetime.Header.unixTimestamp", - "encode.datetime.PropertyAsyncClient": "Encode.Datetime.Property", - "encode.datetime.PropertyAsyncClient.defaultMethod": "Encode.Datetime.Property.default", - "encode.datetime.PropertyAsyncClient.defaultMethodWithResponse": "Encode.Datetime.Property.default", - "encode.datetime.PropertyAsyncClient.rfc3339": "Encode.Datetime.Property.rfc3339", - "encode.datetime.PropertyAsyncClient.rfc3339WithResponse": "Encode.Datetime.Property.rfc3339", - "encode.datetime.PropertyAsyncClient.rfc7231": "Encode.Datetime.Property.rfc7231", - "encode.datetime.PropertyAsyncClient.rfc7231WithResponse": "Encode.Datetime.Property.rfc7231", - "encode.datetime.PropertyAsyncClient.unixTimestamp": "Encode.Datetime.Property.unixTimestamp", - "encode.datetime.PropertyAsyncClient.unixTimestampArray": "Encode.Datetime.Property.unixTimestampArray", - "encode.datetime.PropertyAsyncClient.unixTimestampArrayWithResponse": "Encode.Datetime.Property.unixTimestampArray", - "encode.datetime.PropertyAsyncClient.unixTimestampWithResponse": "Encode.Datetime.Property.unixTimestamp", - "encode.datetime.PropertyClient": "Encode.Datetime.Property", - "encode.datetime.PropertyClient.defaultMethod": "Encode.Datetime.Property.default", - "encode.datetime.PropertyClient.defaultMethodWithResponse": "Encode.Datetime.Property.default", - "encode.datetime.PropertyClient.rfc3339": "Encode.Datetime.Property.rfc3339", - "encode.datetime.PropertyClient.rfc3339WithResponse": "Encode.Datetime.Property.rfc3339", - "encode.datetime.PropertyClient.rfc7231": "Encode.Datetime.Property.rfc7231", - "encode.datetime.PropertyClient.rfc7231WithResponse": "Encode.Datetime.Property.rfc7231", - "encode.datetime.PropertyClient.unixTimestamp": "Encode.Datetime.Property.unixTimestamp", - "encode.datetime.PropertyClient.unixTimestampArray": "Encode.Datetime.Property.unixTimestampArray", - "encode.datetime.PropertyClient.unixTimestampArrayWithResponse": "Encode.Datetime.Property.unixTimestampArray", - "encode.datetime.PropertyClient.unixTimestampWithResponse": "Encode.Datetime.Property.unixTimestamp", - "encode.datetime.QueryAsyncClient": "Encode.Datetime.Query", - "encode.datetime.QueryAsyncClient.defaultMethod": "Encode.Datetime.Query.default", - "encode.datetime.QueryAsyncClient.defaultMethodWithResponse": "Encode.Datetime.Query.default", - "encode.datetime.QueryAsyncClient.rfc3339": "Encode.Datetime.Query.rfc3339", - "encode.datetime.QueryAsyncClient.rfc3339WithResponse": "Encode.Datetime.Query.rfc3339", - "encode.datetime.QueryAsyncClient.rfc7231": "Encode.Datetime.Query.rfc7231", - "encode.datetime.QueryAsyncClient.rfc7231WithResponse": "Encode.Datetime.Query.rfc7231", - "encode.datetime.QueryAsyncClient.unixTimestamp": "Encode.Datetime.Query.unixTimestamp", - "encode.datetime.QueryAsyncClient.unixTimestampArray": "Encode.Datetime.Query.unixTimestampArray", - "encode.datetime.QueryAsyncClient.unixTimestampArrayWithResponse": "Encode.Datetime.Query.unixTimestampArray", - "encode.datetime.QueryAsyncClient.unixTimestampWithResponse": "Encode.Datetime.Query.unixTimestamp", - "encode.datetime.QueryClient": "Encode.Datetime.Query", - "encode.datetime.QueryClient.defaultMethod": "Encode.Datetime.Query.default", - "encode.datetime.QueryClient.defaultMethodWithResponse": "Encode.Datetime.Query.default", - "encode.datetime.QueryClient.rfc3339": "Encode.Datetime.Query.rfc3339", - "encode.datetime.QueryClient.rfc3339WithResponse": "Encode.Datetime.Query.rfc3339", - "encode.datetime.QueryClient.rfc7231": "Encode.Datetime.Query.rfc7231", - "encode.datetime.QueryClient.rfc7231WithResponse": "Encode.Datetime.Query.rfc7231", - "encode.datetime.QueryClient.unixTimestamp": "Encode.Datetime.Query.unixTimestamp", - "encode.datetime.QueryClient.unixTimestampArray": "Encode.Datetime.Query.unixTimestampArray", - "encode.datetime.QueryClient.unixTimestampArrayWithResponse": "Encode.Datetime.Query.unixTimestampArray", - "encode.datetime.QueryClient.unixTimestampWithResponse": "Encode.Datetime.Query.unixTimestamp", - "encode.datetime.ResponseHeaderAsyncClient": "Encode.Datetime.ResponseHeader", - "encode.datetime.ResponseHeaderAsyncClient.defaultMethod": "Encode.Datetime.ResponseHeader.default", - "encode.datetime.ResponseHeaderAsyncClient.defaultMethodWithResponse": "Encode.Datetime.ResponseHeader.default", - "encode.datetime.ResponseHeaderAsyncClient.rfc3339": "Encode.Datetime.ResponseHeader.rfc3339", - "encode.datetime.ResponseHeaderAsyncClient.rfc3339WithResponse": "Encode.Datetime.ResponseHeader.rfc3339", - "encode.datetime.ResponseHeaderAsyncClient.rfc7231": "Encode.Datetime.ResponseHeader.rfc7231", - "encode.datetime.ResponseHeaderAsyncClient.rfc7231WithResponse": "Encode.Datetime.ResponseHeader.rfc7231", - "encode.datetime.ResponseHeaderAsyncClient.unixTimestamp": "Encode.Datetime.ResponseHeader.unixTimestamp", - "encode.datetime.ResponseHeaderAsyncClient.unixTimestampWithResponse": "Encode.Datetime.ResponseHeader.unixTimestamp", - "encode.datetime.ResponseHeaderClient": "Encode.Datetime.ResponseHeader", - "encode.datetime.ResponseHeaderClient.defaultMethod": "Encode.Datetime.ResponseHeader.default", - "encode.datetime.ResponseHeaderClient.defaultMethodWithResponse": "Encode.Datetime.ResponseHeader.default", - "encode.datetime.ResponseHeaderClient.rfc3339": "Encode.Datetime.ResponseHeader.rfc3339", - "encode.datetime.ResponseHeaderClient.rfc3339WithResponse": "Encode.Datetime.ResponseHeader.rfc3339", - "encode.datetime.ResponseHeaderClient.rfc7231": "Encode.Datetime.ResponseHeader.rfc7231", - "encode.datetime.ResponseHeaderClient.rfc7231WithResponse": "Encode.Datetime.ResponseHeader.rfc7231", - "encode.datetime.ResponseHeaderClient.unixTimestamp": "Encode.Datetime.ResponseHeader.unixTimestamp", - "encode.datetime.ResponseHeaderClient.unixTimestampWithResponse": "Encode.Datetime.ResponseHeader.unixTimestamp", - "encode.datetime.models.DefaultDatetimeProperty": "Encode.Datetime.DefaultDatetimeProperty", - "encode.datetime.models.Rfc3339DatetimeProperty": "Encode.Datetime.Rfc3339DatetimeProperty", - "encode.datetime.models.Rfc7231DatetimeProperty": "Encode.Datetime.Rfc7231DatetimeProperty", - "encode.datetime.models.UnixTimestampArrayDatetimeProperty": "Encode.Datetime.UnixTimestampArrayDatetimeProperty", - "encode.datetime.models.UnixTimestampDatetimeProperty": "Encode.Datetime.UnixTimestampDatetimeProperty" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_metadata.json deleted file mode 100644 index 84ce62f87c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"encode.datetime.DatetimeClientBuilder":"Encode.Datetime","encode.datetime.HeaderAsyncClient":"Encode.Datetime.Header","encode.datetime.HeaderAsyncClient.defaultMethod":"Encode.Datetime.Header.default","encode.datetime.HeaderAsyncClient.defaultMethodWithResponse":"Encode.Datetime.Header.default","encode.datetime.HeaderAsyncClient.rfc3339":"Encode.Datetime.Header.rfc3339","encode.datetime.HeaderAsyncClient.rfc3339WithResponse":"Encode.Datetime.Header.rfc3339","encode.datetime.HeaderAsyncClient.rfc7231":"Encode.Datetime.Header.rfc7231","encode.datetime.HeaderAsyncClient.rfc7231WithResponse":"Encode.Datetime.Header.rfc7231","encode.datetime.HeaderAsyncClient.unixTimestamp":"Encode.Datetime.Header.unixTimestamp","encode.datetime.HeaderAsyncClient.unixTimestampArray":"Encode.Datetime.Header.unixTimestampArray","encode.datetime.HeaderAsyncClient.unixTimestampArrayWithResponse":"Encode.Datetime.Header.unixTimestampArray","encode.datetime.HeaderAsyncClient.unixTimestampWithResponse":"Encode.Datetime.Header.unixTimestamp","encode.datetime.HeaderClient":"Encode.Datetime.Header","encode.datetime.HeaderClient.defaultMethod":"Encode.Datetime.Header.default","encode.datetime.HeaderClient.defaultMethodWithResponse":"Encode.Datetime.Header.default","encode.datetime.HeaderClient.rfc3339":"Encode.Datetime.Header.rfc3339","encode.datetime.HeaderClient.rfc3339WithResponse":"Encode.Datetime.Header.rfc3339","encode.datetime.HeaderClient.rfc7231":"Encode.Datetime.Header.rfc7231","encode.datetime.HeaderClient.rfc7231WithResponse":"Encode.Datetime.Header.rfc7231","encode.datetime.HeaderClient.unixTimestamp":"Encode.Datetime.Header.unixTimestamp","encode.datetime.HeaderClient.unixTimestampArray":"Encode.Datetime.Header.unixTimestampArray","encode.datetime.HeaderClient.unixTimestampArrayWithResponse":"Encode.Datetime.Header.unixTimestampArray","encode.datetime.HeaderClient.unixTimestampWithResponse":"Encode.Datetime.Header.unixTimestamp","encode.datetime.PropertyAsyncClient":"Encode.Datetime.Property","encode.datetime.PropertyAsyncClient.defaultMethod":"Encode.Datetime.Property.default","encode.datetime.PropertyAsyncClient.defaultMethodWithResponse":"Encode.Datetime.Property.default","encode.datetime.PropertyAsyncClient.rfc3339":"Encode.Datetime.Property.rfc3339","encode.datetime.PropertyAsyncClient.rfc3339WithResponse":"Encode.Datetime.Property.rfc3339","encode.datetime.PropertyAsyncClient.rfc7231":"Encode.Datetime.Property.rfc7231","encode.datetime.PropertyAsyncClient.rfc7231WithResponse":"Encode.Datetime.Property.rfc7231","encode.datetime.PropertyAsyncClient.unixTimestamp":"Encode.Datetime.Property.unixTimestamp","encode.datetime.PropertyAsyncClient.unixTimestampArray":"Encode.Datetime.Property.unixTimestampArray","encode.datetime.PropertyAsyncClient.unixTimestampArrayWithResponse":"Encode.Datetime.Property.unixTimestampArray","encode.datetime.PropertyAsyncClient.unixTimestampWithResponse":"Encode.Datetime.Property.unixTimestamp","encode.datetime.PropertyClient":"Encode.Datetime.Property","encode.datetime.PropertyClient.defaultMethod":"Encode.Datetime.Property.default","encode.datetime.PropertyClient.defaultMethodWithResponse":"Encode.Datetime.Property.default","encode.datetime.PropertyClient.rfc3339":"Encode.Datetime.Property.rfc3339","encode.datetime.PropertyClient.rfc3339WithResponse":"Encode.Datetime.Property.rfc3339","encode.datetime.PropertyClient.rfc7231":"Encode.Datetime.Property.rfc7231","encode.datetime.PropertyClient.rfc7231WithResponse":"Encode.Datetime.Property.rfc7231","encode.datetime.PropertyClient.unixTimestamp":"Encode.Datetime.Property.unixTimestamp","encode.datetime.PropertyClient.unixTimestampArray":"Encode.Datetime.Property.unixTimestampArray","encode.datetime.PropertyClient.unixTimestampArrayWithResponse":"Encode.Datetime.Property.unixTimestampArray","encode.datetime.PropertyClient.unixTimestampWithResponse":"Encode.Datetime.Property.unixTimestamp","encode.datetime.QueryAsyncClient":"Encode.Datetime.Query","encode.datetime.QueryAsyncClient.defaultMethod":"Encode.Datetime.Query.default","encode.datetime.QueryAsyncClient.defaultMethodWithResponse":"Encode.Datetime.Query.default","encode.datetime.QueryAsyncClient.rfc3339":"Encode.Datetime.Query.rfc3339","encode.datetime.QueryAsyncClient.rfc3339WithResponse":"Encode.Datetime.Query.rfc3339","encode.datetime.QueryAsyncClient.rfc7231":"Encode.Datetime.Query.rfc7231","encode.datetime.QueryAsyncClient.rfc7231WithResponse":"Encode.Datetime.Query.rfc7231","encode.datetime.QueryAsyncClient.unixTimestamp":"Encode.Datetime.Query.unixTimestamp","encode.datetime.QueryAsyncClient.unixTimestampArray":"Encode.Datetime.Query.unixTimestampArray","encode.datetime.QueryAsyncClient.unixTimestampArrayWithResponse":"Encode.Datetime.Query.unixTimestampArray","encode.datetime.QueryAsyncClient.unixTimestampWithResponse":"Encode.Datetime.Query.unixTimestamp","encode.datetime.QueryClient":"Encode.Datetime.Query","encode.datetime.QueryClient.defaultMethod":"Encode.Datetime.Query.default","encode.datetime.QueryClient.defaultMethodWithResponse":"Encode.Datetime.Query.default","encode.datetime.QueryClient.rfc3339":"Encode.Datetime.Query.rfc3339","encode.datetime.QueryClient.rfc3339WithResponse":"Encode.Datetime.Query.rfc3339","encode.datetime.QueryClient.rfc7231":"Encode.Datetime.Query.rfc7231","encode.datetime.QueryClient.rfc7231WithResponse":"Encode.Datetime.Query.rfc7231","encode.datetime.QueryClient.unixTimestamp":"Encode.Datetime.Query.unixTimestamp","encode.datetime.QueryClient.unixTimestampArray":"Encode.Datetime.Query.unixTimestampArray","encode.datetime.QueryClient.unixTimestampArrayWithResponse":"Encode.Datetime.Query.unixTimestampArray","encode.datetime.QueryClient.unixTimestampWithResponse":"Encode.Datetime.Query.unixTimestamp","encode.datetime.ResponseHeaderAsyncClient":"Encode.Datetime.ResponseHeader","encode.datetime.ResponseHeaderAsyncClient.defaultMethod":"Encode.Datetime.ResponseHeader.default","encode.datetime.ResponseHeaderAsyncClient.defaultMethodWithResponse":"Encode.Datetime.ResponseHeader.default","encode.datetime.ResponseHeaderAsyncClient.rfc3339":"Encode.Datetime.ResponseHeader.rfc3339","encode.datetime.ResponseHeaderAsyncClient.rfc3339WithResponse":"Encode.Datetime.ResponseHeader.rfc3339","encode.datetime.ResponseHeaderAsyncClient.rfc7231":"Encode.Datetime.ResponseHeader.rfc7231","encode.datetime.ResponseHeaderAsyncClient.rfc7231WithResponse":"Encode.Datetime.ResponseHeader.rfc7231","encode.datetime.ResponseHeaderAsyncClient.unixTimestamp":"Encode.Datetime.ResponseHeader.unixTimestamp","encode.datetime.ResponseHeaderAsyncClient.unixTimestampWithResponse":"Encode.Datetime.ResponseHeader.unixTimestamp","encode.datetime.ResponseHeaderClient":"Encode.Datetime.ResponseHeader","encode.datetime.ResponseHeaderClient.defaultMethod":"Encode.Datetime.ResponseHeader.default","encode.datetime.ResponseHeaderClient.defaultMethodWithResponse":"Encode.Datetime.ResponseHeader.default","encode.datetime.ResponseHeaderClient.rfc3339":"Encode.Datetime.ResponseHeader.rfc3339","encode.datetime.ResponseHeaderClient.rfc3339WithResponse":"Encode.Datetime.ResponseHeader.rfc3339","encode.datetime.ResponseHeaderClient.rfc7231":"Encode.Datetime.ResponseHeader.rfc7231","encode.datetime.ResponseHeaderClient.rfc7231WithResponse":"Encode.Datetime.ResponseHeader.rfc7231","encode.datetime.ResponseHeaderClient.unixTimestamp":"Encode.Datetime.ResponseHeader.unixTimestamp","encode.datetime.ResponseHeaderClient.unixTimestampWithResponse":"Encode.Datetime.ResponseHeader.unixTimestamp","encode.datetime.models.DefaultDatetimeProperty":"Encode.Datetime.DefaultDatetimeProperty","encode.datetime.models.Rfc3339DatetimeProperty":"Encode.Datetime.Rfc3339DatetimeProperty","encode.datetime.models.Rfc7231DatetimeProperty":"Encode.Datetime.Rfc7231DatetimeProperty","encode.datetime.models.UnixTimestampArrayDatetimeProperty":"Encode.Datetime.UnixTimestampArrayDatetimeProperty","encode.datetime.models.UnixTimestampDatetimeProperty":"Encode.Datetime.UnixTimestampDatetimeProperty"},"generatedFiles":["src/main/java/encode/datetime/DatetimeClientBuilder.java","src/main/java/encode/datetime/HeaderAsyncClient.java","src/main/java/encode/datetime/HeaderClient.java","src/main/java/encode/datetime/PropertyAsyncClient.java","src/main/java/encode/datetime/PropertyClient.java","src/main/java/encode/datetime/QueryAsyncClient.java","src/main/java/encode/datetime/QueryClient.java","src/main/java/encode/datetime/ResponseHeaderAsyncClient.java","src/main/java/encode/datetime/ResponseHeaderClient.java","src/main/java/encode/datetime/implementation/DatetimeClientImpl.java","src/main/java/encode/datetime/implementation/HeadersImpl.java","src/main/java/encode/datetime/implementation/PropertiesImpl.java","src/main/java/encode/datetime/implementation/QueriesImpl.java","src/main/java/encode/datetime/implementation/ResponseHeadersImpl.java","src/main/java/encode/datetime/implementation/package-info.java","src/main/java/encode/datetime/models/DefaultDatetimeProperty.java","src/main/java/encode/datetime/models/Rfc3339DatetimeProperty.java","src/main/java/encode/datetime/models/Rfc7231DatetimeProperty.java","src/main/java/encode/datetime/models/UnixTimestampArrayDatetimeProperty.java","src/main/java/encode/datetime/models/UnixTimestampDatetimeProperty.java","src/main/java/encode/datetime/models/package-info.java","src/main/java/encode/datetime/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_apiview_properties.json deleted file mode 100644 index 821255378ba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_apiview_properties.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "encode.duration.DurationClientBuilder": "Encode.Duration", - "encode.duration.HeaderAsyncClient": "Encode.Duration.Header", - "encode.duration.HeaderAsyncClient.defaultMethod": "Encode.Duration.Header.default", - "encode.duration.HeaderAsyncClient.defaultMethodWithResponse": "Encode.Duration.Header.default", - "encode.duration.HeaderAsyncClient.float64Milliseconds": "Encode.Duration.Header.float64Milliseconds", - "encode.duration.HeaderAsyncClient.float64MillisecondsWithResponse": "Encode.Duration.Header.float64Milliseconds", - "encode.duration.HeaderAsyncClient.float64Seconds": "Encode.Duration.Header.float64Seconds", - "encode.duration.HeaderAsyncClient.float64SecondsWithResponse": "Encode.Duration.Header.float64Seconds", - "encode.duration.HeaderAsyncClient.floatMilliseconds": "Encode.Duration.Header.floatMilliseconds", - "encode.duration.HeaderAsyncClient.floatMillisecondsLargerUnit": "Encode.Duration.Header.floatMillisecondsLargerUnit", - "encode.duration.HeaderAsyncClient.floatMillisecondsLargerUnitWithResponse": "Encode.Duration.Header.floatMillisecondsLargerUnit", - "encode.duration.HeaderAsyncClient.floatMillisecondsWithResponse": "Encode.Duration.Header.floatMilliseconds", - "encode.duration.HeaderAsyncClient.floatSeconds": "Encode.Duration.Header.floatSeconds", - "encode.duration.HeaderAsyncClient.floatSecondsLargerUnit": "Encode.Duration.Header.floatSecondsLargerUnit", - "encode.duration.HeaderAsyncClient.floatSecondsLargerUnitWithResponse": "Encode.Duration.Header.floatSecondsLargerUnit", - "encode.duration.HeaderAsyncClient.floatSecondsWithResponse": "Encode.Duration.Header.floatSeconds", - "encode.duration.HeaderAsyncClient.int32Milliseconds": "Encode.Duration.Header.int32Milliseconds", - "encode.duration.HeaderAsyncClient.int32MillisecondsArray": "Encode.Duration.Header.int32MillisecondsArray", - "encode.duration.HeaderAsyncClient.int32MillisecondsArrayWithResponse": "Encode.Duration.Header.int32MillisecondsArray", - "encode.duration.HeaderAsyncClient.int32MillisecondsLargerUnit": "Encode.Duration.Header.int32MillisecondsLargerUnit", - "encode.duration.HeaderAsyncClient.int32MillisecondsLargerUnitWithResponse": "Encode.Duration.Header.int32MillisecondsLargerUnit", - "encode.duration.HeaderAsyncClient.int32MillisecondsWithResponse": "Encode.Duration.Header.int32Milliseconds", - "encode.duration.HeaderAsyncClient.int32Seconds": "Encode.Duration.Header.int32Seconds", - "encode.duration.HeaderAsyncClient.int32SecondsLargerUnit": "Encode.Duration.Header.int32SecondsLargerUnit", - "encode.duration.HeaderAsyncClient.int32SecondsLargerUnitWithResponse": "Encode.Duration.Header.int32SecondsLargerUnit", - "encode.duration.HeaderAsyncClient.int32SecondsWithResponse": "Encode.Duration.Header.int32Seconds", - "encode.duration.HeaderAsyncClient.iso8601": "Encode.Duration.Header.iso8601", - "encode.duration.HeaderAsyncClient.iso8601Array": "Encode.Duration.Header.iso8601Array", - "encode.duration.HeaderAsyncClient.iso8601ArrayWithResponse": "Encode.Duration.Header.iso8601Array", - "encode.duration.HeaderAsyncClient.iso8601WithResponse": "Encode.Duration.Header.iso8601", - "encode.duration.HeaderClient": "Encode.Duration.Header", - "encode.duration.HeaderClient.defaultMethod": "Encode.Duration.Header.default", - "encode.duration.HeaderClient.defaultMethodWithResponse": "Encode.Duration.Header.default", - "encode.duration.HeaderClient.float64Milliseconds": "Encode.Duration.Header.float64Milliseconds", - "encode.duration.HeaderClient.float64MillisecondsWithResponse": "Encode.Duration.Header.float64Milliseconds", - "encode.duration.HeaderClient.float64Seconds": "Encode.Duration.Header.float64Seconds", - "encode.duration.HeaderClient.float64SecondsWithResponse": "Encode.Duration.Header.float64Seconds", - "encode.duration.HeaderClient.floatMilliseconds": "Encode.Duration.Header.floatMilliseconds", - "encode.duration.HeaderClient.floatMillisecondsLargerUnit": "Encode.Duration.Header.floatMillisecondsLargerUnit", - "encode.duration.HeaderClient.floatMillisecondsLargerUnitWithResponse": "Encode.Duration.Header.floatMillisecondsLargerUnit", - "encode.duration.HeaderClient.floatMillisecondsWithResponse": "Encode.Duration.Header.floatMilliseconds", - "encode.duration.HeaderClient.floatSeconds": "Encode.Duration.Header.floatSeconds", - "encode.duration.HeaderClient.floatSecondsLargerUnit": "Encode.Duration.Header.floatSecondsLargerUnit", - "encode.duration.HeaderClient.floatSecondsLargerUnitWithResponse": "Encode.Duration.Header.floatSecondsLargerUnit", - "encode.duration.HeaderClient.floatSecondsWithResponse": "Encode.Duration.Header.floatSeconds", - "encode.duration.HeaderClient.int32Milliseconds": "Encode.Duration.Header.int32Milliseconds", - "encode.duration.HeaderClient.int32MillisecondsArray": "Encode.Duration.Header.int32MillisecondsArray", - "encode.duration.HeaderClient.int32MillisecondsArrayWithResponse": "Encode.Duration.Header.int32MillisecondsArray", - "encode.duration.HeaderClient.int32MillisecondsLargerUnit": "Encode.Duration.Header.int32MillisecondsLargerUnit", - "encode.duration.HeaderClient.int32MillisecondsLargerUnitWithResponse": "Encode.Duration.Header.int32MillisecondsLargerUnit", - "encode.duration.HeaderClient.int32MillisecondsWithResponse": "Encode.Duration.Header.int32Milliseconds", - "encode.duration.HeaderClient.int32Seconds": "Encode.Duration.Header.int32Seconds", - "encode.duration.HeaderClient.int32SecondsLargerUnit": "Encode.Duration.Header.int32SecondsLargerUnit", - "encode.duration.HeaderClient.int32SecondsLargerUnitWithResponse": "Encode.Duration.Header.int32SecondsLargerUnit", - "encode.duration.HeaderClient.int32SecondsWithResponse": "Encode.Duration.Header.int32Seconds", - "encode.duration.HeaderClient.iso8601": "Encode.Duration.Header.iso8601", - "encode.duration.HeaderClient.iso8601Array": "Encode.Duration.Header.iso8601Array", - "encode.duration.HeaderClient.iso8601ArrayWithResponse": "Encode.Duration.Header.iso8601Array", - "encode.duration.HeaderClient.iso8601WithResponse": "Encode.Duration.Header.iso8601", - "encode.duration.PropertyAsyncClient": "Encode.Duration.Property", - "encode.duration.PropertyAsyncClient.defaultMethod": "Encode.Duration.Property.default", - "encode.duration.PropertyAsyncClient.defaultMethodWithResponse": "Encode.Duration.Property.default", - "encode.duration.PropertyAsyncClient.float64Milliseconds": "Encode.Duration.Property.float64Milliseconds", - "encode.duration.PropertyAsyncClient.float64MillisecondsWithResponse": "Encode.Duration.Property.float64Milliseconds", - "encode.duration.PropertyAsyncClient.float64Seconds": "Encode.Duration.Property.float64Seconds", - "encode.duration.PropertyAsyncClient.float64SecondsWithResponse": "Encode.Duration.Property.float64Seconds", - "encode.duration.PropertyAsyncClient.floatMilliseconds": "Encode.Duration.Property.floatMilliseconds", - "encode.duration.PropertyAsyncClient.floatMillisecondsArray": "Encode.Duration.Property.floatMillisecondsArray", - "encode.duration.PropertyAsyncClient.floatMillisecondsArrayWithResponse": "Encode.Duration.Property.floatMillisecondsArray", - "encode.duration.PropertyAsyncClient.floatMillisecondsLargerUnit": "Encode.Duration.Property.floatMillisecondsLargerUnit", - "encode.duration.PropertyAsyncClient.floatMillisecondsLargerUnitWithResponse": "Encode.Duration.Property.floatMillisecondsLargerUnit", - "encode.duration.PropertyAsyncClient.floatMillisecondsWithResponse": "Encode.Duration.Property.floatMilliseconds", - "encode.duration.PropertyAsyncClient.floatSeconds": "Encode.Duration.Property.floatSeconds", - "encode.duration.PropertyAsyncClient.floatSecondsArray": "Encode.Duration.Property.floatSecondsArray", - "encode.duration.PropertyAsyncClient.floatSecondsArrayWithResponse": "Encode.Duration.Property.floatSecondsArray", - "encode.duration.PropertyAsyncClient.floatSecondsLargerUnit": "Encode.Duration.Property.floatSecondsLargerUnit", - "encode.duration.PropertyAsyncClient.floatSecondsLargerUnitWithResponse": "Encode.Duration.Property.floatSecondsLargerUnit", - "encode.duration.PropertyAsyncClient.floatSecondsWithResponse": "Encode.Duration.Property.floatSeconds", - "encode.duration.PropertyAsyncClient.int32Milliseconds": "Encode.Duration.Property.int32Milliseconds", - "encode.duration.PropertyAsyncClient.int32MillisecondsLargerUnit": "Encode.Duration.Property.int32MillisecondsLargerUnit", - "encode.duration.PropertyAsyncClient.int32MillisecondsLargerUnitWithResponse": "Encode.Duration.Property.int32MillisecondsLargerUnit", - "encode.duration.PropertyAsyncClient.int32MillisecondsWithResponse": "Encode.Duration.Property.int32Milliseconds", - "encode.duration.PropertyAsyncClient.int32Seconds": "Encode.Duration.Property.int32Seconds", - "encode.duration.PropertyAsyncClient.int32SecondsLargerUnit": "Encode.Duration.Property.int32SecondsLargerUnit", - "encode.duration.PropertyAsyncClient.int32SecondsLargerUnitWithResponse": "Encode.Duration.Property.int32SecondsLargerUnit", - "encode.duration.PropertyAsyncClient.int32SecondsWithResponse": "Encode.Duration.Property.int32Seconds", - "encode.duration.PropertyAsyncClient.iso8601": "Encode.Duration.Property.iso8601", - "encode.duration.PropertyAsyncClient.iso8601WithResponse": "Encode.Duration.Property.iso8601", - "encode.duration.PropertyClient": "Encode.Duration.Property", - "encode.duration.PropertyClient.defaultMethod": "Encode.Duration.Property.default", - "encode.duration.PropertyClient.defaultMethodWithResponse": "Encode.Duration.Property.default", - "encode.duration.PropertyClient.float64Milliseconds": "Encode.Duration.Property.float64Milliseconds", - "encode.duration.PropertyClient.float64MillisecondsWithResponse": "Encode.Duration.Property.float64Milliseconds", - "encode.duration.PropertyClient.float64Seconds": "Encode.Duration.Property.float64Seconds", - "encode.duration.PropertyClient.float64SecondsWithResponse": "Encode.Duration.Property.float64Seconds", - "encode.duration.PropertyClient.floatMilliseconds": "Encode.Duration.Property.floatMilliseconds", - "encode.duration.PropertyClient.floatMillisecondsArray": "Encode.Duration.Property.floatMillisecondsArray", - "encode.duration.PropertyClient.floatMillisecondsArrayWithResponse": "Encode.Duration.Property.floatMillisecondsArray", - "encode.duration.PropertyClient.floatMillisecondsLargerUnit": "Encode.Duration.Property.floatMillisecondsLargerUnit", - "encode.duration.PropertyClient.floatMillisecondsLargerUnitWithResponse": "Encode.Duration.Property.floatMillisecondsLargerUnit", - "encode.duration.PropertyClient.floatMillisecondsWithResponse": "Encode.Duration.Property.floatMilliseconds", - "encode.duration.PropertyClient.floatSeconds": "Encode.Duration.Property.floatSeconds", - "encode.duration.PropertyClient.floatSecondsArray": "Encode.Duration.Property.floatSecondsArray", - "encode.duration.PropertyClient.floatSecondsArrayWithResponse": "Encode.Duration.Property.floatSecondsArray", - "encode.duration.PropertyClient.floatSecondsLargerUnit": "Encode.Duration.Property.floatSecondsLargerUnit", - "encode.duration.PropertyClient.floatSecondsLargerUnitWithResponse": "Encode.Duration.Property.floatSecondsLargerUnit", - "encode.duration.PropertyClient.floatSecondsWithResponse": "Encode.Duration.Property.floatSeconds", - "encode.duration.PropertyClient.int32Milliseconds": "Encode.Duration.Property.int32Milliseconds", - "encode.duration.PropertyClient.int32MillisecondsLargerUnit": "Encode.Duration.Property.int32MillisecondsLargerUnit", - "encode.duration.PropertyClient.int32MillisecondsLargerUnitWithResponse": "Encode.Duration.Property.int32MillisecondsLargerUnit", - "encode.duration.PropertyClient.int32MillisecondsWithResponse": "Encode.Duration.Property.int32Milliseconds", - "encode.duration.PropertyClient.int32Seconds": "Encode.Duration.Property.int32Seconds", - "encode.duration.PropertyClient.int32SecondsLargerUnit": "Encode.Duration.Property.int32SecondsLargerUnit", - "encode.duration.PropertyClient.int32SecondsLargerUnitWithResponse": "Encode.Duration.Property.int32SecondsLargerUnit", - "encode.duration.PropertyClient.int32SecondsWithResponse": "Encode.Duration.Property.int32Seconds", - "encode.duration.PropertyClient.iso8601": "Encode.Duration.Property.iso8601", - "encode.duration.PropertyClient.iso8601WithResponse": "Encode.Duration.Property.iso8601", - "encode.duration.QueryAsyncClient": "Encode.Duration.Query", - "encode.duration.QueryAsyncClient.defaultMethod": "Encode.Duration.Query.default", - "encode.duration.QueryAsyncClient.defaultMethodWithResponse": "Encode.Duration.Query.default", - "encode.duration.QueryAsyncClient.float64Milliseconds": "Encode.Duration.Query.float64Milliseconds", - "encode.duration.QueryAsyncClient.float64MillisecondsWithResponse": "Encode.Duration.Query.float64Milliseconds", - "encode.duration.QueryAsyncClient.float64Seconds": "Encode.Duration.Query.float64Seconds", - "encode.duration.QueryAsyncClient.float64SecondsWithResponse": "Encode.Duration.Query.float64Seconds", - "encode.duration.QueryAsyncClient.floatMilliseconds": "Encode.Duration.Query.floatMilliseconds", - "encode.duration.QueryAsyncClient.floatMillisecondsLargerUnit": "Encode.Duration.Query.floatMillisecondsLargerUnit", - "encode.duration.QueryAsyncClient.floatMillisecondsLargerUnitWithResponse": "Encode.Duration.Query.floatMillisecondsLargerUnit", - "encode.duration.QueryAsyncClient.floatMillisecondsWithResponse": "Encode.Duration.Query.floatMilliseconds", - "encode.duration.QueryAsyncClient.floatSeconds": "Encode.Duration.Query.floatSeconds", - "encode.duration.QueryAsyncClient.floatSecondsLargerUnit": "Encode.Duration.Query.floatSecondsLargerUnit", - "encode.duration.QueryAsyncClient.floatSecondsLargerUnitWithResponse": "Encode.Duration.Query.floatSecondsLargerUnit", - "encode.duration.QueryAsyncClient.floatSecondsWithResponse": "Encode.Duration.Query.floatSeconds", - "encode.duration.QueryAsyncClient.int32Milliseconds": "Encode.Duration.Query.int32Milliseconds", - "encode.duration.QueryAsyncClient.int32MillisecondsArray": "Encode.Duration.Query.int32MillisecondsArray", - "encode.duration.QueryAsyncClient.int32MillisecondsArrayWithResponse": "Encode.Duration.Query.int32MillisecondsArray", - "encode.duration.QueryAsyncClient.int32MillisecondsLargerUnit": "Encode.Duration.Query.int32MillisecondsLargerUnit", - "encode.duration.QueryAsyncClient.int32MillisecondsLargerUnitWithResponse": "Encode.Duration.Query.int32MillisecondsLargerUnit", - "encode.duration.QueryAsyncClient.int32MillisecondsWithResponse": "Encode.Duration.Query.int32Milliseconds", - "encode.duration.QueryAsyncClient.int32Seconds": "Encode.Duration.Query.int32Seconds", - "encode.duration.QueryAsyncClient.int32SecondsArray": "Encode.Duration.Query.int32SecondsArray", - "encode.duration.QueryAsyncClient.int32SecondsArrayWithResponse": "Encode.Duration.Query.int32SecondsArray", - "encode.duration.QueryAsyncClient.int32SecondsLargerUnit": "Encode.Duration.Query.int32SecondsLargerUnit", - "encode.duration.QueryAsyncClient.int32SecondsLargerUnitWithResponse": "Encode.Duration.Query.int32SecondsLargerUnit", - "encode.duration.QueryAsyncClient.int32SecondsWithResponse": "Encode.Duration.Query.int32Seconds", - "encode.duration.QueryAsyncClient.iso8601": "Encode.Duration.Query.iso8601", - "encode.duration.QueryAsyncClient.iso8601WithResponse": "Encode.Duration.Query.iso8601", - "encode.duration.QueryClient": "Encode.Duration.Query", - "encode.duration.QueryClient.defaultMethod": "Encode.Duration.Query.default", - "encode.duration.QueryClient.defaultMethodWithResponse": "Encode.Duration.Query.default", - "encode.duration.QueryClient.float64Milliseconds": "Encode.Duration.Query.float64Milliseconds", - "encode.duration.QueryClient.float64MillisecondsWithResponse": "Encode.Duration.Query.float64Milliseconds", - "encode.duration.QueryClient.float64Seconds": "Encode.Duration.Query.float64Seconds", - "encode.duration.QueryClient.float64SecondsWithResponse": "Encode.Duration.Query.float64Seconds", - "encode.duration.QueryClient.floatMilliseconds": "Encode.Duration.Query.floatMilliseconds", - "encode.duration.QueryClient.floatMillisecondsLargerUnit": "Encode.Duration.Query.floatMillisecondsLargerUnit", - "encode.duration.QueryClient.floatMillisecondsLargerUnitWithResponse": "Encode.Duration.Query.floatMillisecondsLargerUnit", - "encode.duration.QueryClient.floatMillisecondsWithResponse": "Encode.Duration.Query.floatMilliseconds", - "encode.duration.QueryClient.floatSeconds": "Encode.Duration.Query.floatSeconds", - "encode.duration.QueryClient.floatSecondsLargerUnit": "Encode.Duration.Query.floatSecondsLargerUnit", - "encode.duration.QueryClient.floatSecondsLargerUnitWithResponse": "Encode.Duration.Query.floatSecondsLargerUnit", - "encode.duration.QueryClient.floatSecondsWithResponse": "Encode.Duration.Query.floatSeconds", - "encode.duration.QueryClient.int32Milliseconds": "Encode.Duration.Query.int32Milliseconds", - "encode.duration.QueryClient.int32MillisecondsArray": "Encode.Duration.Query.int32MillisecondsArray", - "encode.duration.QueryClient.int32MillisecondsArrayWithResponse": "Encode.Duration.Query.int32MillisecondsArray", - "encode.duration.QueryClient.int32MillisecondsLargerUnit": "Encode.Duration.Query.int32MillisecondsLargerUnit", - "encode.duration.QueryClient.int32MillisecondsLargerUnitWithResponse": "Encode.Duration.Query.int32MillisecondsLargerUnit", - "encode.duration.QueryClient.int32MillisecondsWithResponse": "Encode.Duration.Query.int32Milliseconds", - "encode.duration.QueryClient.int32Seconds": "Encode.Duration.Query.int32Seconds", - "encode.duration.QueryClient.int32SecondsArray": "Encode.Duration.Query.int32SecondsArray", - "encode.duration.QueryClient.int32SecondsArrayWithResponse": "Encode.Duration.Query.int32SecondsArray", - "encode.duration.QueryClient.int32SecondsLargerUnit": "Encode.Duration.Query.int32SecondsLargerUnit", - "encode.duration.QueryClient.int32SecondsLargerUnitWithResponse": "Encode.Duration.Query.int32SecondsLargerUnit", - "encode.duration.QueryClient.int32SecondsWithResponse": "Encode.Duration.Query.int32Seconds", - "encode.duration.QueryClient.iso8601": "Encode.Duration.Query.iso8601", - "encode.duration.QueryClient.iso8601WithResponse": "Encode.Duration.Query.iso8601", - "encode.duration.property.models.DefaultDurationProperty": "Encode.Duration.Property.DefaultDurationProperty", - "encode.duration.property.models.Float64MillisecondsDurationProperty": "Encode.Duration.Property.Float64MillisecondsDurationProperty", - "encode.duration.property.models.Float64SecondsDurationProperty": "Encode.Duration.Property.Float64SecondsDurationProperty", - "encode.duration.property.models.FloatMillisecondsDurationArrayProperty": "Encode.Duration.Property.FloatMillisecondsDurationArrayProperty", - "encode.duration.property.models.FloatMillisecondsDurationProperty": "Encode.Duration.Property.FloatMillisecondsDurationProperty", - "encode.duration.property.models.FloatMillisecondsLargerUnitDurationProperty": "Encode.Duration.Property.FloatMillisecondsLargerUnitDurationProperty", - "encode.duration.property.models.FloatSecondsDurationArrayProperty": "Encode.Duration.Property.FloatSecondsDurationArrayProperty", - "encode.duration.property.models.FloatSecondsDurationProperty": "Encode.Duration.Property.FloatSecondsDurationProperty", - "encode.duration.property.models.FloatSecondsLargerUnitDurationProperty": "Encode.Duration.Property.FloatSecondsLargerUnitDurationProperty", - "encode.duration.property.models.ISO8601DurationProperty": "Encode.Duration.Property.ISO8601DurationProperty", - "encode.duration.property.models.Int32MillisecondsDurationProperty": "Encode.Duration.Property.Int32MillisecondsDurationProperty", - "encode.duration.property.models.Int32MillisecondsLargerUnitDurationProperty": "Encode.Duration.Property.Int32MillisecondsLargerUnitDurationProperty", - "encode.duration.property.models.Int32SecondsDurationProperty": "Encode.Duration.Property.Int32SecondsDurationProperty", - "encode.duration.property.models.Int32SecondsLargerUnitDurationProperty": "Encode.Duration.Property.Int32SecondsLargerUnitDurationProperty" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_metadata.json deleted file mode 100644 index 14ef5931425..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"encode.duration.DurationClientBuilder":"Encode.Duration","encode.duration.HeaderAsyncClient":"Encode.Duration.Header","encode.duration.HeaderAsyncClient.defaultMethod":"Encode.Duration.Header.default","encode.duration.HeaderAsyncClient.defaultMethodWithResponse":"Encode.Duration.Header.default","encode.duration.HeaderAsyncClient.float64Milliseconds":"Encode.Duration.Header.float64Milliseconds","encode.duration.HeaderAsyncClient.float64MillisecondsWithResponse":"Encode.Duration.Header.float64Milliseconds","encode.duration.HeaderAsyncClient.float64Seconds":"Encode.Duration.Header.float64Seconds","encode.duration.HeaderAsyncClient.float64SecondsWithResponse":"Encode.Duration.Header.float64Seconds","encode.duration.HeaderAsyncClient.floatMilliseconds":"Encode.Duration.Header.floatMilliseconds","encode.duration.HeaderAsyncClient.floatMillisecondsLargerUnit":"Encode.Duration.Header.floatMillisecondsLargerUnit","encode.duration.HeaderAsyncClient.floatMillisecondsLargerUnitWithResponse":"Encode.Duration.Header.floatMillisecondsLargerUnit","encode.duration.HeaderAsyncClient.floatMillisecondsWithResponse":"Encode.Duration.Header.floatMilliseconds","encode.duration.HeaderAsyncClient.floatSeconds":"Encode.Duration.Header.floatSeconds","encode.duration.HeaderAsyncClient.floatSecondsLargerUnit":"Encode.Duration.Header.floatSecondsLargerUnit","encode.duration.HeaderAsyncClient.floatSecondsLargerUnitWithResponse":"Encode.Duration.Header.floatSecondsLargerUnit","encode.duration.HeaderAsyncClient.floatSecondsWithResponse":"Encode.Duration.Header.floatSeconds","encode.duration.HeaderAsyncClient.int32Milliseconds":"Encode.Duration.Header.int32Milliseconds","encode.duration.HeaderAsyncClient.int32MillisecondsArray":"Encode.Duration.Header.int32MillisecondsArray","encode.duration.HeaderAsyncClient.int32MillisecondsArrayWithResponse":"Encode.Duration.Header.int32MillisecondsArray","encode.duration.HeaderAsyncClient.int32MillisecondsLargerUnit":"Encode.Duration.Header.int32MillisecondsLargerUnit","encode.duration.HeaderAsyncClient.int32MillisecondsLargerUnitWithResponse":"Encode.Duration.Header.int32MillisecondsLargerUnit","encode.duration.HeaderAsyncClient.int32MillisecondsWithResponse":"Encode.Duration.Header.int32Milliseconds","encode.duration.HeaderAsyncClient.int32Seconds":"Encode.Duration.Header.int32Seconds","encode.duration.HeaderAsyncClient.int32SecondsLargerUnit":"Encode.Duration.Header.int32SecondsLargerUnit","encode.duration.HeaderAsyncClient.int32SecondsLargerUnitWithResponse":"Encode.Duration.Header.int32SecondsLargerUnit","encode.duration.HeaderAsyncClient.int32SecondsWithResponse":"Encode.Duration.Header.int32Seconds","encode.duration.HeaderAsyncClient.iso8601":"Encode.Duration.Header.iso8601","encode.duration.HeaderAsyncClient.iso8601Array":"Encode.Duration.Header.iso8601Array","encode.duration.HeaderAsyncClient.iso8601ArrayWithResponse":"Encode.Duration.Header.iso8601Array","encode.duration.HeaderAsyncClient.iso8601WithResponse":"Encode.Duration.Header.iso8601","encode.duration.HeaderClient":"Encode.Duration.Header","encode.duration.HeaderClient.defaultMethod":"Encode.Duration.Header.default","encode.duration.HeaderClient.defaultMethodWithResponse":"Encode.Duration.Header.default","encode.duration.HeaderClient.float64Milliseconds":"Encode.Duration.Header.float64Milliseconds","encode.duration.HeaderClient.float64MillisecondsWithResponse":"Encode.Duration.Header.float64Milliseconds","encode.duration.HeaderClient.float64Seconds":"Encode.Duration.Header.float64Seconds","encode.duration.HeaderClient.float64SecondsWithResponse":"Encode.Duration.Header.float64Seconds","encode.duration.HeaderClient.floatMilliseconds":"Encode.Duration.Header.floatMilliseconds","encode.duration.HeaderClient.floatMillisecondsLargerUnit":"Encode.Duration.Header.floatMillisecondsLargerUnit","encode.duration.HeaderClient.floatMillisecondsLargerUnitWithResponse":"Encode.Duration.Header.floatMillisecondsLargerUnit","encode.duration.HeaderClient.floatMillisecondsWithResponse":"Encode.Duration.Header.floatMilliseconds","encode.duration.HeaderClient.floatSeconds":"Encode.Duration.Header.floatSeconds","encode.duration.HeaderClient.floatSecondsLargerUnit":"Encode.Duration.Header.floatSecondsLargerUnit","encode.duration.HeaderClient.floatSecondsLargerUnitWithResponse":"Encode.Duration.Header.floatSecondsLargerUnit","encode.duration.HeaderClient.floatSecondsWithResponse":"Encode.Duration.Header.floatSeconds","encode.duration.HeaderClient.int32Milliseconds":"Encode.Duration.Header.int32Milliseconds","encode.duration.HeaderClient.int32MillisecondsArray":"Encode.Duration.Header.int32MillisecondsArray","encode.duration.HeaderClient.int32MillisecondsArrayWithResponse":"Encode.Duration.Header.int32MillisecondsArray","encode.duration.HeaderClient.int32MillisecondsLargerUnit":"Encode.Duration.Header.int32MillisecondsLargerUnit","encode.duration.HeaderClient.int32MillisecondsLargerUnitWithResponse":"Encode.Duration.Header.int32MillisecondsLargerUnit","encode.duration.HeaderClient.int32MillisecondsWithResponse":"Encode.Duration.Header.int32Milliseconds","encode.duration.HeaderClient.int32Seconds":"Encode.Duration.Header.int32Seconds","encode.duration.HeaderClient.int32SecondsLargerUnit":"Encode.Duration.Header.int32SecondsLargerUnit","encode.duration.HeaderClient.int32SecondsLargerUnitWithResponse":"Encode.Duration.Header.int32SecondsLargerUnit","encode.duration.HeaderClient.int32SecondsWithResponse":"Encode.Duration.Header.int32Seconds","encode.duration.HeaderClient.iso8601":"Encode.Duration.Header.iso8601","encode.duration.HeaderClient.iso8601Array":"Encode.Duration.Header.iso8601Array","encode.duration.HeaderClient.iso8601ArrayWithResponse":"Encode.Duration.Header.iso8601Array","encode.duration.HeaderClient.iso8601WithResponse":"Encode.Duration.Header.iso8601","encode.duration.PropertyAsyncClient":"Encode.Duration.Property","encode.duration.PropertyAsyncClient.defaultMethod":"Encode.Duration.Property.default","encode.duration.PropertyAsyncClient.defaultMethodWithResponse":"Encode.Duration.Property.default","encode.duration.PropertyAsyncClient.float64Milliseconds":"Encode.Duration.Property.float64Milliseconds","encode.duration.PropertyAsyncClient.float64MillisecondsWithResponse":"Encode.Duration.Property.float64Milliseconds","encode.duration.PropertyAsyncClient.float64Seconds":"Encode.Duration.Property.float64Seconds","encode.duration.PropertyAsyncClient.float64SecondsWithResponse":"Encode.Duration.Property.float64Seconds","encode.duration.PropertyAsyncClient.floatMilliseconds":"Encode.Duration.Property.floatMilliseconds","encode.duration.PropertyAsyncClient.floatMillisecondsArray":"Encode.Duration.Property.floatMillisecondsArray","encode.duration.PropertyAsyncClient.floatMillisecondsArrayWithResponse":"Encode.Duration.Property.floatMillisecondsArray","encode.duration.PropertyAsyncClient.floatMillisecondsLargerUnit":"Encode.Duration.Property.floatMillisecondsLargerUnit","encode.duration.PropertyAsyncClient.floatMillisecondsLargerUnitWithResponse":"Encode.Duration.Property.floatMillisecondsLargerUnit","encode.duration.PropertyAsyncClient.floatMillisecondsWithResponse":"Encode.Duration.Property.floatMilliseconds","encode.duration.PropertyAsyncClient.floatSeconds":"Encode.Duration.Property.floatSeconds","encode.duration.PropertyAsyncClient.floatSecondsArray":"Encode.Duration.Property.floatSecondsArray","encode.duration.PropertyAsyncClient.floatSecondsArrayWithResponse":"Encode.Duration.Property.floatSecondsArray","encode.duration.PropertyAsyncClient.floatSecondsLargerUnit":"Encode.Duration.Property.floatSecondsLargerUnit","encode.duration.PropertyAsyncClient.floatSecondsLargerUnitWithResponse":"Encode.Duration.Property.floatSecondsLargerUnit","encode.duration.PropertyAsyncClient.floatSecondsWithResponse":"Encode.Duration.Property.floatSeconds","encode.duration.PropertyAsyncClient.int32Milliseconds":"Encode.Duration.Property.int32Milliseconds","encode.duration.PropertyAsyncClient.int32MillisecondsLargerUnit":"Encode.Duration.Property.int32MillisecondsLargerUnit","encode.duration.PropertyAsyncClient.int32MillisecondsLargerUnitWithResponse":"Encode.Duration.Property.int32MillisecondsLargerUnit","encode.duration.PropertyAsyncClient.int32MillisecondsWithResponse":"Encode.Duration.Property.int32Milliseconds","encode.duration.PropertyAsyncClient.int32Seconds":"Encode.Duration.Property.int32Seconds","encode.duration.PropertyAsyncClient.int32SecondsLargerUnit":"Encode.Duration.Property.int32SecondsLargerUnit","encode.duration.PropertyAsyncClient.int32SecondsLargerUnitWithResponse":"Encode.Duration.Property.int32SecondsLargerUnit","encode.duration.PropertyAsyncClient.int32SecondsWithResponse":"Encode.Duration.Property.int32Seconds","encode.duration.PropertyAsyncClient.iso8601":"Encode.Duration.Property.iso8601","encode.duration.PropertyAsyncClient.iso8601WithResponse":"Encode.Duration.Property.iso8601","encode.duration.PropertyClient":"Encode.Duration.Property","encode.duration.PropertyClient.defaultMethod":"Encode.Duration.Property.default","encode.duration.PropertyClient.defaultMethodWithResponse":"Encode.Duration.Property.default","encode.duration.PropertyClient.float64Milliseconds":"Encode.Duration.Property.float64Milliseconds","encode.duration.PropertyClient.float64MillisecondsWithResponse":"Encode.Duration.Property.float64Milliseconds","encode.duration.PropertyClient.float64Seconds":"Encode.Duration.Property.float64Seconds","encode.duration.PropertyClient.float64SecondsWithResponse":"Encode.Duration.Property.float64Seconds","encode.duration.PropertyClient.floatMilliseconds":"Encode.Duration.Property.floatMilliseconds","encode.duration.PropertyClient.floatMillisecondsArray":"Encode.Duration.Property.floatMillisecondsArray","encode.duration.PropertyClient.floatMillisecondsArrayWithResponse":"Encode.Duration.Property.floatMillisecondsArray","encode.duration.PropertyClient.floatMillisecondsLargerUnit":"Encode.Duration.Property.floatMillisecondsLargerUnit","encode.duration.PropertyClient.floatMillisecondsLargerUnitWithResponse":"Encode.Duration.Property.floatMillisecondsLargerUnit","encode.duration.PropertyClient.floatMillisecondsWithResponse":"Encode.Duration.Property.floatMilliseconds","encode.duration.PropertyClient.floatSeconds":"Encode.Duration.Property.floatSeconds","encode.duration.PropertyClient.floatSecondsArray":"Encode.Duration.Property.floatSecondsArray","encode.duration.PropertyClient.floatSecondsArrayWithResponse":"Encode.Duration.Property.floatSecondsArray","encode.duration.PropertyClient.floatSecondsLargerUnit":"Encode.Duration.Property.floatSecondsLargerUnit","encode.duration.PropertyClient.floatSecondsLargerUnitWithResponse":"Encode.Duration.Property.floatSecondsLargerUnit","encode.duration.PropertyClient.floatSecondsWithResponse":"Encode.Duration.Property.floatSeconds","encode.duration.PropertyClient.int32Milliseconds":"Encode.Duration.Property.int32Milliseconds","encode.duration.PropertyClient.int32MillisecondsLargerUnit":"Encode.Duration.Property.int32MillisecondsLargerUnit","encode.duration.PropertyClient.int32MillisecondsLargerUnitWithResponse":"Encode.Duration.Property.int32MillisecondsLargerUnit","encode.duration.PropertyClient.int32MillisecondsWithResponse":"Encode.Duration.Property.int32Milliseconds","encode.duration.PropertyClient.int32Seconds":"Encode.Duration.Property.int32Seconds","encode.duration.PropertyClient.int32SecondsLargerUnit":"Encode.Duration.Property.int32SecondsLargerUnit","encode.duration.PropertyClient.int32SecondsLargerUnitWithResponse":"Encode.Duration.Property.int32SecondsLargerUnit","encode.duration.PropertyClient.int32SecondsWithResponse":"Encode.Duration.Property.int32Seconds","encode.duration.PropertyClient.iso8601":"Encode.Duration.Property.iso8601","encode.duration.PropertyClient.iso8601WithResponse":"Encode.Duration.Property.iso8601","encode.duration.QueryAsyncClient":"Encode.Duration.Query","encode.duration.QueryAsyncClient.defaultMethod":"Encode.Duration.Query.default","encode.duration.QueryAsyncClient.defaultMethodWithResponse":"Encode.Duration.Query.default","encode.duration.QueryAsyncClient.float64Milliseconds":"Encode.Duration.Query.float64Milliseconds","encode.duration.QueryAsyncClient.float64MillisecondsWithResponse":"Encode.Duration.Query.float64Milliseconds","encode.duration.QueryAsyncClient.float64Seconds":"Encode.Duration.Query.float64Seconds","encode.duration.QueryAsyncClient.float64SecondsWithResponse":"Encode.Duration.Query.float64Seconds","encode.duration.QueryAsyncClient.floatMilliseconds":"Encode.Duration.Query.floatMilliseconds","encode.duration.QueryAsyncClient.floatMillisecondsLargerUnit":"Encode.Duration.Query.floatMillisecondsLargerUnit","encode.duration.QueryAsyncClient.floatMillisecondsLargerUnitWithResponse":"Encode.Duration.Query.floatMillisecondsLargerUnit","encode.duration.QueryAsyncClient.floatMillisecondsWithResponse":"Encode.Duration.Query.floatMilliseconds","encode.duration.QueryAsyncClient.floatSeconds":"Encode.Duration.Query.floatSeconds","encode.duration.QueryAsyncClient.floatSecondsLargerUnit":"Encode.Duration.Query.floatSecondsLargerUnit","encode.duration.QueryAsyncClient.floatSecondsLargerUnitWithResponse":"Encode.Duration.Query.floatSecondsLargerUnit","encode.duration.QueryAsyncClient.floatSecondsWithResponse":"Encode.Duration.Query.floatSeconds","encode.duration.QueryAsyncClient.int32Milliseconds":"Encode.Duration.Query.int32Milliseconds","encode.duration.QueryAsyncClient.int32MillisecondsArray":"Encode.Duration.Query.int32MillisecondsArray","encode.duration.QueryAsyncClient.int32MillisecondsArrayWithResponse":"Encode.Duration.Query.int32MillisecondsArray","encode.duration.QueryAsyncClient.int32MillisecondsLargerUnit":"Encode.Duration.Query.int32MillisecondsLargerUnit","encode.duration.QueryAsyncClient.int32MillisecondsLargerUnitWithResponse":"Encode.Duration.Query.int32MillisecondsLargerUnit","encode.duration.QueryAsyncClient.int32MillisecondsWithResponse":"Encode.Duration.Query.int32Milliseconds","encode.duration.QueryAsyncClient.int32Seconds":"Encode.Duration.Query.int32Seconds","encode.duration.QueryAsyncClient.int32SecondsArray":"Encode.Duration.Query.int32SecondsArray","encode.duration.QueryAsyncClient.int32SecondsArrayWithResponse":"Encode.Duration.Query.int32SecondsArray","encode.duration.QueryAsyncClient.int32SecondsLargerUnit":"Encode.Duration.Query.int32SecondsLargerUnit","encode.duration.QueryAsyncClient.int32SecondsLargerUnitWithResponse":"Encode.Duration.Query.int32SecondsLargerUnit","encode.duration.QueryAsyncClient.int32SecondsWithResponse":"Encode.Duration.Query.int32Seconds","encode.duration.QueryAsyncClient.iso8601":"Encode.Duration.Query.iso8601","encode.duration.QueryAsyncClient.iso8601WithResponse":"Encode.Duration.Query.iso8601","encode.duration.QueryClient":"Encode.Duration.Query","encode.duration.QueryClient.defaultMethod":"Encode.Duration.Query.default","encode.duration.QueryClient.defaultMethodWithResponse":"Encode.Duration.Query.default","encode.duration.QueryClient.float64Milliseconds":"Encode.Duration.Query.float64Milliseconds","encode.duration.QueryClient.float64MillisecondsWithResponse":"Encode.Duration.Query.float64Milliseconds","encode.duration.QueryClient.float64Seconds":"Encode.Duration.Query.float64Seconds","encode.duration.QueryClient.float64SecondsWithResponse":"Encode.Duration.Query.float64Seconds","encode.duration.QueryClient.floatMilliseconds":"Encode.Duration.Query.floatMilliseconds","encode.duration.QueryClient.floatMillisecondsLargerUnit":"Encode.Duration.Query.floatMillisecondsLargerUnit","encode.duration.QueryClient.floatMillisecondsLargerUnitWithResponse":"Encode.Duration.Query.floatMillisecondsLargerUnit","encode.duration.QueryClient.floatMillisecondsWithResponse":"Encode.Duration.Query.floatMilliseconds","encode.duration.QueryClient.floatSeconds":"Encode.Duration.Query.floatSeconds","encode.duration.QueryClient.floatSecondsLargerUnit":"Encode.Duration.Query.floatSecondsLargerUnit","encode.duration.QueryClient.floatSecondsLargerUnitWithResponse":"Encode.Duration.Query.floatSecondsLargerUnit","encode.duration.QueryClient.floatSecondsWithResponse":"Encode.Duration.Query.floatSeconds","encode.duration.QueryClient.int32Milliseconds":"Encode.Duration.Query.int32Milliseconds","encode.duration.QueryClient.int32MillisecondsArray":"Encode.Duration.Query.int32MillisecondsArray","encode.duration.QueryClient.int32MillisecondsArrayWithResponse":"Encode.Duration.Query.int32MillisecondsArray","encode.duration.QueryClient.int32MillisecondsLargerUnit":"Encode.Duration.Query.int32MillisecondsLargerUnit","encode.duration.QueryClient.int32MillisecondsLargerUnitWithResponse":"Encode.Duration.Query.int32MillisecondsLargerUnit","encode.duration.QueryClient.int32MillisecondsWithResponse":"Encode.Duration.Query.int32Milliseconds","encode.duration.QueryClient.int32Seconds":"Encode.Duration.Query.int32Seconds","encode.duration.QueryClient.int32SecondsArray":"Encode.Duration.Query.int32SecondsArray","encode.duration.QueryClient.int32SecondsArrayWithResponse":"Encode.Duration.Query.int32SecondsArray","encode.duration.QueryClient.int32SecondsLargerUnit":"Encode.Duration.Query.int32SecondsLargerUnit","encode.duration.QueryClient.int32SecondsLargerUnitWithResponse":"Encode.Duration.Query.int32SecondsLargerUnit","encode.duration.QueryClient.int32SecondsWithResponse":"Encode.Duration.Query.int32Seconds","encode.duration.QueryClient.iso8601":"Encode.Duration.Query.iso8601","encode.duration.QueryClient.iso8601WithResponse":"Encode.Duration.Query.iso8601","encode.duration.property.models.DefaultDurationProperty":"Encode.Duration.Property.DefaultDurationProperty","encode.duration.property.models.Float64MillisecondsDurationProperty":"Encode.Duration.Property.Float64MillisecondsDurationProperty","encode.duration.property.models.Float64SecondsDurationProperty":"Encode.Duration.Property.Float64SecondsDurationProperty","encode.duration.property.models.FloatMillisecondsDurationArrayProperty":"Encode.Duration.Property.FloatMillisecondsDurationArrayProperty","encode.duration.property.models.FloatMillisecondsDurationProperty":"Encode.Duration.Property.FloatMillisecondsDurationProperty","encode.duration.property.models.FloatMillisecondsLargerUnitDurationProperty":"Encode.Duration.Property.FloatMillisecondsLargerUnitDurationProperty","encode.duration.property.models.FloatSecondsDurationArrayProperty":"Encode.Duration.Property.FloatSecondsDurationArrayProperty","encode.duration.property.models.FloatSecondsDurationProperty":"Encode.Duration.Property.FloatSecondsDurationProperty","encode.duration.property.models.FloatSecondsLargerUnitDurationProperty":"Encode.Duration.Property.FloatSecondsLargerUnitDurationProperty","encode.duration.property.models.ISO8601DurationProperty":"Encode.Duration.Property.ISO8601DurationProperty","encode.duration.property.models.Int32MillisecondsDurationProperty":"Encode.Duration.Property.Int32MillisecondsDurationProperty","encode.duration.property.models.Int32MillisecondsLargerUnitDurationProperty":"Encode.Duration.Property.Int32MillisecondsLargerUnitDurationProperty","encode.duration.property.models.Int32SecondsDurationProperty":"Encode.Duration.Property.Int32SecondsDurationProperty","encode.duration.property.models.Int32SecondsLargerUnitDurationProperty":"Encode.Duration.Property.Int32SecondsLargerUnitDurationProperty"},"generatedFiles":["src/main/java/encode/duration/DurationClientBuilder.java","src/main/java/encode/duration/HeaderAsyncClient.java","src/main/java/encode/duration/HeaderClient.java","src/main/java/encode/duration/PropertyAsyncClient.java","src/main/java/encode/duration/PropertyClient.java","src/main/java/encode/duration/QueryAsyncClient.java","src/main/java/encode/duration/QueryClient.java","src/main/java/encode/duration/implementation/DurationClientImpl.java","src/main/java/encode/duration/implementation/HeadersImpl.java","src/main/java/encode/duration/implementation/PropertiesImpl.java","src/main/java/encode/duration/implementation/QueriesImpl.java","src/main/java/encode/duration/implementation/package-info.java","src/main/java/encode/duration/package-info.java","src/main/java/encode/duration/property/models/DefaultDurationProperty.java","src/main/java/encode/duration/property/models/Float64MillisecondsDurationProperty.java","src/main/java/encode/duration/property/models/Float64SecondsDurationProperty.java","src/main/java/encode/duration/property/models/FloatMillisecondsDurationArrayProperty.java","src/main/java/encode/duration/property/models/FloatMillisecondsDurationProperty.java","src/main/java/encode/duration/property/models/FloatMillisecondsLargerUnitDurationProperty.java","src/main/java/encode/duration/property/models/FloatSecondsDurationArrayProperty.java","src/main/java/encode/duration/property/models/FloatSecondsDurationProperty.java","src/main/java/encode/duration/property/models/FloatSecondsLargerUnitDurationProperty.java","src/main/java/encode/duration/property/models/ISO8601DurationProperty.java","src/main/java/encode/duration/property/models/Int32MillisecondsDurationProperty.java","src/main/java/encode/duration/property/models/Int32MillisecondsLargerUnitDurationProperty.java","src/main/java/encode/duration/property/models/Int32SecondsDurationProperty.java","src/main/java/encode/duration/property/models/Int32SecondsLargerUnitDurationProperty.java","src/main/java/encode/duration/property/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_apiview_properties.json deleted file mode 100644 index 33f149d361d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_apiview_properties.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "encode.numeric.NumericAsyncClient": "Encode.Numeric.Property", - "encode.numeric.NumericAsyncClient.safeintAsString": "Encode.Numeric.Property.safeintAsString", - "encode.numeric.NumericAsyncClient.safeintAsStringWithResponse": "Encode.Numeric.Property.safeintAsString", - "encode.numeric.NumericAsyncClient.uint32AsStringOptional": "Encode.Numeric.Property.uint32AsStringOptional", - "encode.numeric.NumericAsyncClient.uint32AsStringOptionalWithResponse": "Encode.Numeric.Property.uint32AsStringOptional", - "encode.numeric.NumericAsyncClient.uint8AsString": "Encode.Numeric.Property.uint8AsString", - "encode.numeric.NumericAsyncClient.uint8AsStringWithResponse": "Encode.Numeric.Property.uint8AsString", - "encode.numeric.NumericClient": "Encode.Numeric.Property", - "encode.numeric.NumericClient.safeintAsString": "Encode.Numeric.Property.safeintAsString", - "encode.numeric.NumericClient.safeintAsStringWithResponse": "Encode.Numeric.Property.safeintAsString", - "encode.numeric.NumericClient.uint32AsStringOptional": "Encode.Numeric.Property.uint32AsStringOptional", - "encode.numeric.NumericClient.uint32AsStringOptionalWithResponse": "Encode.Numeric.Property.uint32AsStringOptional", - "encode.numeric.NumericClient.uint8AsString": "Encode.Numeric.Property.uint8AsString", - "encode.numeric.NumericClient.uint8AsStringWithResponse": "Encode.Numeric.Property.uint8AsString", - "encode.numeric.NumericClientBuilder": "Encode.Numeric", - "encode.numeric.property.models.SafeintAsStringProperty": "Encode.Numeric.Property.SafeintAsStringProperty", - "encode.numeric.property.models.Uint32AsStringProperty": "Encode.Numeric.Property.Uint32AsStringProperty", - "encode.numeric.property.models.Uint8AsStringProperty": "Encode.Numeric.Property.Uint8AsStringProperty" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_metadata.json deleted file mode 100644 index 8db4b2db574..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"encode.numeric.NumericAsyncClient":"Encode.Numeric.Property","encode.numeric.NumericAsyncClient.safeintAsString":"Encode.Numeric.Property.safeintAsString","encode.numeric.NumericAsyncClient.safeintAsStringWithResponse":"Encode.Numeric.Property.safeintAsString","encode.numeric.NumericAsyncClient.uint32AsStringOptional":"Encode.Numeric.Property.uint32AsStringOptional","encode.numeric.NumericAsyncClient.uint32AsStringOptionalWithResponse":"Encode.Numeric.Property.uint32AsStringOptional","encode.numeric.NumericAsyncClient.uint8AsString":"Encode.Numeric.Property.uint8AsString","encode.numeric.NumericAsyncClient.uint8AsStringWithResponse":"Encode.Numeric.Property.uint8AsString","encode.numeric.NumericClient":"Encode.Numeric.Property","encode.numeric.NumericClient.safeintAsString":"Encode.Numeric.Property.safeintAsString","encode.numeric.NumericClient.safeintAsStringWithResponse":"Encode.Numeric.Property.safeintAsString","encode.numeric.NumericClient.uint32AsStringOptional":"Encode.Numeric.Property.uint32AsStringOptional","encode.numeric.NumericClient.uint32AsStringOptionalWithResponse":"Encode.Numeric.Property.uint32AsStringOptional","encode.numeric.NumericClient.uint8AsString":"Encode.Numeric.Property.uint8AsString","encode.numeric.NumericClient.uint8AsStringWithResponse":"Encode.Numeric.Property.uint8AsString","encode.numeric.NumericClientBuilder":"Encode.Numeric","encode.numeric.property.models.SafeintAsStringProperty":"Encode.Numeric.Property.SafeintAsStringProperty","encode.numeric.property.models.Uint32AsStringProperty":"Encode.Numeric.Property.Uint32AsStringProperty","encode.numeric.property.models.Uint8AsStringProperty":"Encode.Numeric.Property.Uint8AsStringProperty"},"generatedFiles":["src/main/java/encode/numeric/NumericAsyncClient.java","src/main/java/encode/numeric/NumericClient.java","src/main/java/encode/numeric/NumericClientBuilder.java","src/main/java/encode/numeric/implementation/NumericClientImpl.java","src/main/java/encode/numeric/implementation/PropertiesImpl.java","src/main/java/encode/numeric/implementation/package-info.java","src/main/java/encode/numeric/package-info.java","src/main/java/encode/numeric/property/models/SafeintAsStringProperty.java","src/main/java/encode/numeric/property/models/Uint32AsStringProperty.java","src/main/java/encode/numeric/property/models/Uint8AsStringProperty.java","src/main/java/encode/numeric/property/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/proxy-config.json deleted file mode 100644 index 0160328f55f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/proxy-config.json +++ /dev/null @@ -1 +0,0 @@ -[["tsptest.armstreamstyleserialization.implementation.FishesClientImpl$FishesService"],["tsptest.armstreamstyleserialization.implementation.FunctionsClientImpl$FunctionsService"],["tsptest.armstreamstyleserialization.implementation.ItemsClientImpl$ItemsService"],["tsptest.armstreamstyleserialization.implementation.PrioritiesClientImpl$PrioritiesService"],["tsptest.armstreamstyleserialization.implementation.TopLevelArmResourcesClientImpl$TopLevelArmResourcesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/reflect-config.json deleted file mode 100644 index 04b770df5e9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/reflect-config.json +++ /dev/null @@ -1 +0,0 @@ -[{"name":"tsptest.armstreamstyleserialization.models.Error","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true},{"name":"tsptest.armstreamstyleserialization.models.ErrorException","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true},{"name":"tsptest.armstreamstyleserialization.models.ErrorMin","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true},{"name":"tsptest.armstreamstyleserialization.models.ErrorMinException","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true}] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/proxy-config.json deleted file mode 100644 index cb9419fe3c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/proxy-config.json +++ /dev/null @@ -1 +0,0 @@ -[["tsptest.armcustomization.implementation.VaultsClientImpl$VaultsService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/reflect-config.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/reflect-config.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/proxy-config.json deleted file mode 100644 index 14dc57b73cb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/proxy-config.json +++ /dev/null @@ -1 +0,0 @@ -[["tsptest.armlegacy.implementation.SkusClientImpl$SkusService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/reflect-config.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/reflect-config.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/proxy-config.json deleted file mode 100644 index 5c06442deb0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/proxy-config.json +++ /dev/null @@ -1 +0,0 @@ -[["tsptest.armresourceprovider.implementation.ChildExtensionResourceInterfacesClientImpl$ChildExtensionResourceInterfacesService"],["tsptest.armresourceprovider.implementation.ChildResourcesInterfacesClientImpl$ChildResourcesInterfacesService"],["tsptest.armresourceprovider.implementation.CustomTemplateResourceInterfacesClientImpl$CustomTemplateResourceInterfacesService"],["tsptest.armresourceprovider.implementation.ImmutableResourceModelsClientImpl$ImmutableResourceModelsService"],["tsptest.armresourceprovider.implementation.LroNoBodiesClientImpl$LroNoBodiesService"],["tsptest.armresourceprovider.implementation.ManagedMaintenanceWindowStatusOperationsClientImpl$ManagedMaintenanceWindowStatusOperationsService"],["tsptest.armresourceprovider.implementation.ModelInterfaceSameNamesClientImpl$ModelInterfaceSameNamesService"],["tsptest.armresourceprovider.implementation.OperationsClientImpl$OperationsService"],["tsptest.armresourceprovider.implementation.TopLevelArmResourceInterfacesClientImpl$TopLevelArmResourceInterfacesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/reflect-config.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/reflect-config.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/proxy-config.json deleted file mode 100644 index 12fd27ce30c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/proxy-config.json +++ /dev/null @@ -1 +0,0 @@ -[["tsptest.armversioned.implementation.TopLevelArmResourcesClientImpl$TopLevelArmResourcesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/reflect-config.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/reflect-config.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/proxy-config.json deleted file mode 100644 index 425f1c93bd9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/proxy-config.json +++ /dev/null @@ -1 +0,0 @@ -[["azure.resourcemanager.multiservice.combined.implementation.DisksClientImpl$DisksService"],["azure.resourcemanager.multiservice.combined.implementation.VirtualMachinesClientImpl$VirtualMachinesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/reflect-config.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/reflect-config.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/proxy-config.json deleted file mode 100644 index cdd07e3847c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/proxy-config.json +++ /dev/null @@ -1 +0,0 @@ -[["azure.resourcemanager.commonproperties.implementation.ErrorsClientImpl$ErrorsService"],["azure.resourcemanager.commonproperties.implementation.ManagedIdentitiesClientImpl$ManagedIdentitiesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/reflect-config.json deleted file mode 100644 index a1c7b24fb3e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/reflect-config.json +++ /dev/null @@ -1 +0,0 @@ -[{"name":"azure.resourcemanager.commonproperties.models.ApiError","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true},{"name":"azure.resourcemanager.commonproperties.models.ApiErrorException","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true},{"name":"azure.resourcemanager.commonproperties.models.InnerError","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true}] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/proxy-config.json deleted file mode 100644 index 3210cb4cd07..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/proxy-config.json +++ /dev/null @@ -1 +0,0 @@ -[["azure.resourcemanager.largeheader.implementation.LargeHeadersClientImpl$LargeHeadersService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/reflect-config.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/reflect-config.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/proxy-config.json deleted file mode 100644 index 1455274376c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/proxy-config.json +++ /dev/null @@ -1 +0,0 @@ -[["azure.resourcemanager.methodsubscriptionid.implementation.MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl$MixedSubscriptionPlacementResourceGroupResourceOperationsService"],["azure.resourcemanager.methodsubscriptionid.implementation.MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl$MixedSubscriptionPlacementSubscriptionResourceOperationsService"],["azure.resourcemanager.methodsubscriptionid.implementation.OperationsClientImpl$OperationsService"],["azure.resourcemanager.methodsubscriptionid.implementation.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl$TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsService"],["azure.resourcemanager.methodsubscriptionid.implementation.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl$TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/reflect-config.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/reflect-config.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/proxy-config.json deleted file mode 100644 index 0c77726d610..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/proxy-config.json +++ /dev/null @@ -1 +0,0 @@ -[["azure.resourcemanager.nonresource.implementation.NonResourceOperationsClientImpl$NonResourceOperationsService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/reflect-config.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/reflect-config.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/proxy-config.json deleted file mode 100644 index 8d7e9644d75..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/proxy-config.json +++ /dev/null @@ -1 +0,0 @@ -[["azure.resourcemanager.operationtemplates.implementation.CheckNameAvailabilitiesClientImpl$CheckNameAvailabilitiesService"],["azure.resourcemanager.operationtemplates.implementation.LroesClientImpl$LroesService"],["azure.resourcemanager.operationtemplates.implementation.OperationsClientImpl$OperationsService"],["azure.resourcemanager.operationtemplates.implementation.OptionalBodiesClientImpl$OptionalBodiesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/reflect-config.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/reflect-config.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/proxy-config.json deleted file mode 100644 index e9a02cb07be..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/proxy-config.json +++ /dev/null @@ -1 +0,0 @@ -[["azure.resourcemanager.resources.implementation.ExtensionsResourcesClientImpl$ExtensionsResourcesService"],["azure.resourcemanager.resources.implementation.LocationResourcesClientImpl$LocationResourcesService"],["azure.resourcemanager.resources.implementation.NestedsClientImpl$NestedsService"],["azure.resourcemanager.resources.implementation.SingletonsClientImpl$SingletonsService"],["azure.resourcemanager.resources.implementation.TopLevelsClientImpl$TopLevelsService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/reflect-config.json deleted file mode 100644 index 0637a088a01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/reflect-config.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_apiview_properties.json deleted file mode 100644 index f6f9142402b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_apiview_properties.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "parameters.basic.BasicClientBuilder": "Parameters.Basic", - "parameters.basic.ExplicitBodyAsyncClient": "Parameters.Basic.ExplicitBody", - "parameters.basic.ExplicitBodyAsyncClient.simple": "Parameters.Basic.ExplicitBody.simple", - "parameters.basic.ExplicitBodyAsyncClient.simpleWithResponse": "Parameters.Basic.ExplicitBody.simple", - "parameters.basic.ExplicitBodyClient": "Parameters.Basic.ExplicitBody", - "parameters.basic.ExplicitBodyClient.simple": "Parameters.Basic.ExplicitBody.simple", - "parameters.basic.ExplicitBodyClient.simpleWithResponse": "Parameters.Basic.ExplicitBody.simple", - "parameters.basic.ImplicitBodyAsyncClient": "Parameters.Basic.ImplicitBody", - "parameters.basic.ImplicitBodyAsyncClient.simple": "Parameters.Basic.ImplicitBody.simple", - "parameters.basic.ImplicitBodyAsyncClient.simpleWithResponse": "Parameters.Basic.ImplicitBody.simple", - "parameters.basic.ImplicitBodyClient": "Parameters.Basic.ImplicitBody", - "parameters.basic.ImplicitBodyClient.simple": "Parameters.Basic.ImplicitBody.simple", - "parameters.basic.ImplicitBodyClient.simpleWithResponse": "Parameters.Basic.ImplicitBody.simple", - "parameters.basic.explicitbody.models.User": "Parameters.Basic.ExplicitBody.User", - "parameters.basic.implicitbody.implementation.models.SimpleRequest": "Parameters.Basic.ImplicitBody.simple.Request.anonymous" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_metadata.json deleted file mode 100644 index 3a597d991b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"parameters.basic.BasicClientBuilder":"Parameters.Basic","parameters.basic.ExplicitBodyAsyncClient":"Parameters.Basic.ExplicitBody","parameters.basic.ExplicitBodyAsyncClient.simple":"Parameters.Basic.ExplicitBody.simple","parameters.basic.ExplicitBodyAsyncClient.simpleWithResponse":"Parameters.Basic.ExplicitBody.simple","parameters.basic.ExplicitBodyClient":"Parameters.Basic.ExplicitBody","parameters.basic.ExplicitBodyClient.simple":"Parameters.Basic.ExplicitBody.simple","parameters.basic.ExplicitBodyClient.simpleWithResponse":"Parameters.Basic.ExplicitBody.simple","parameters.basic.ImplicitBodyAsyncClient":"Parameters.Basic.ImplicitBody","parameters.basic.ImplicitBodyAsyncClient.simple":"Parameters.Basic.ImplicitBody.simple","parameters.basic.ImplicitBodyAsyncClient.simpleWithResponse":"Parameters.Basic.ImplicitBody.simple","parameters.basic.ImplicitBodyClient":"Parameters.Basic.ImplicitBody","parameters.basic.ImplicitBodyClient.simple":"Parameters.Basic.ImplicitBody.simple","parameters.basic.ImplicitBodyClient.simpleWithResponse":"Parameters.Basic.ImplicitBody.simple","parameters.basic.explicitbody.models.User":"Parameters.Basic.ExplicitBody.User","parameters.basic.implicitbody.implementation.models.SimpleRequest":"Parameters.Basic.ImplicitBody.simple.Request.anonymous"},"generatedFiles":["src/main/java/module-info.java","src/main/java/parameters/basic/BasicClientBuilder.java","src/main/java/parameters/basic/ExplicitBodyAsyncClient.java","src/main/java/parameters/basic/ExplicitBodyClient.java","src/main/java/parameters/basic/ImplicitBodyAsyncClient.java","src/main/java/parameters/basic/ImplicitBodyClient.java","src/main/java/parameters/basic/explicitbody/models/User.java","src/main/java/parameters/basic/explicitbody/models/package-info.java","src/main/java/parameters/basic/implementation/BasicClientImpl.java","src/main/java/parameters/basic/implementation/ExplicitBodiesImpl.java","src/main/java/parameters/basic/implementation/ImplicitBodiesImpl.java","src/main/java/parameters/basic/implementation/package-info.java","src/main/java/parameters/basic/implicitbody/implementation/models/SimpleRequest.java","src/main/java/parameters/basic/implicitbody/implementation/models/package-info.java","src/main/java/parameters/basic/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_apiview_properties.json deleted file mode 100644 index 36ee4a51333..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_apiview_properties.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "parameters.bodyoptionality.BodyOptionalityAsyncClient": "Parameters.BodyOptionality", - "parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredExplicit": "Parameters.BodyOptionality.requiredExplicit", - "parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredExplicitWithResponse": "Parameters.BodyOptionality.requiredExplicit", - "parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredImplicit": "Parameters.BodyOptionality.requiredImplicit", - "parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredImplicitWithResponse": "Parameters.BodyOptionality.requiredImplicit", - "parameters.bodyoptionality.BodyOptionalityClient": "Parameters.BodyOptionality", - "parameters.bodyoptionality.BodyOptionalityClient.requiredExplicit": "Parameters.BodyOptionality.requiredExplicit", - "parameters.bodyoptionality.BodyOptionalityClient.requiredExplicitWithResponse": "Parameters.BodyOptionality.requiredExplicit", - "parameters.bodyoptionality.BodyOptionalityClient.requiredImplicit": "Parameters.BodyOptionality.requiredImplicit", - "parameters.bodyoptionality.BodyOptionalityClient.requiredImplicitWithResponse": "Parameters.BodyOptionality.requiredImplicit", - "parameters.bodyoptionality.BodyOptionalityClientBuilder": "Parameters.BodyOptionality", - "parameters.bodyoptionality.OptionalExplicitAsyncClient": "Parameters.BodyOptionality.OptionalExplicit", - "parameters.bodyoptionality.OptionalExplicitAsyncClient.omit": "Parameters.BodyOptionality.OptionalExplicit.omit", - "parameters.bodyoptionality.OptionalExplicitAsyncClient.omitWithResponse": "Parameters.BodyOptionality.OptionalExplicit.omit", - "parameters.bodyoptionality.OptionalExplicitAsyncClient.set": "Parameters.BodyOptionality.OptionalExplicit.set", - "parameters.bodyoptionality.OptionalExplicitAsyncClient.setWithResponse": "Parameters.BodyOptionality.OptionalExplicit.set", - "parameters.bodyoptionality.OptionalExplicitClient": "Parameters.BodyOptionality.OptionalExplicit", - "parameters.bodyoptionality.OptionalExplicitClient.omit": "Parameters.BodyOptionality.OptionalExplicit.omit", - "parameters.bodyoptionality.OptionalExplicitClient.omitWithResponse": "Parameters.BodyOptionality.OptionalExplicit.omit", - "parameters.bodyoptionality.OptionalExplicitClient.set": "Parameters.BodyOptionality.OptionalExplicit.set", - "parameters.bodyoptionality.OptionalExplicitClient.setWithResponse": "Parameters.BodyOptionality.OptionalExplicit.set", - "parameters.bodyoptionality.models.BodyModel": "Parameters.BodyOptionality.BodyModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_metadata.json deleted file mode 100644 index 4b8826c036a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"parameters.bodyoptionality.BodyOptionalityAsyncClient":"Parameters.BodyOptionality","parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredExplicit":"Parameters.BodyOptionality.requiredExplicit","parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredExplicitWithResponse":"Parameters.BodyOptionality.requiredExplicit","parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredImplicit":"Parameters.BodyOptionality.requiredImplicit","parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredImplicitWithResponse":"Parameters.BodyOptionality.requiredImplicit","parameters.bodyoptionality.BodyOptionalityClient":"Parameters.BodyOptionality","parameters.bodyoptionality.BodyOptionalityClient.requiredExplicit":"Parameters.BodyOptionality.requiredExplicit","parameters.bodyoptionality.BodyOptionalityClient.requiredExplicitWithResponse":"Parameters.BodyOptionality.requiredExplicit","parameters.bodyoptionality.BodyOptionalityClient.requiredImplicit":"Parameters.BodyOptionality.requiredImplicit","parameters.bodyoptionality.BodyOptionalityClient.requiredImplicitWithResponse":"Parameters.BodyOptionality.requiredImplicit","parameters.bodyoptionality.BodyOptionalityClientBuilder":"Parameters.BodyOptionality","parameters.bodyoptionality.OptionalExplicitAsyncClient":"Parameters.BodyOptionality.OptionalExplicit","parameters.bodyoptionality.OptionalExplicitAsyncClient.omit":"Parameters.BodyOptionality.OptionalExplicit.omit","parameters.bodyoptionality.OptionalExplicitAsyncClient.omitWithResponse":"Parameters.BodyOptionality.OptionalExplicit.omit","parameters.bodyoptionality.OptionalExplicitAsyncClient.set":"Parameters.BodyOptionality.OptionalExplicit.set","parameters.bodyoptionality.OptionalExplicitAsyncClient.setWithResponse":"Parameters.BodyOptionality.OptionalExplicit.set","parameters.bodyoptionality.OptionalExplicitClient":"Parameters.BodyOptionality.OptionalExplicit","parameters.bodyoptionality.OptionalExplicitClient.omit":"Parameters.BodyOptionality.OptionalExplicit.omit","parameters.bodyoptionality.OptionalExplicitClient.omitWithResponse":"Parameters.BodyOptionality.OptionalExplicit.omit","parameters.bodyoptionality.OptionalExplicitClient.set":"Parameters.BodyOptionality.OptionalExplicit.set","parameters.bodyoptionality.OptionalExplicitClient.setWithResponse":"Parameters.BodyOptionality.OptionalExplicit.set","parameters.bodyoptionality.models.BodyModel":"Parameters.BodyOptionality.BodyModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/parameters/bodyoptionality/BodyOptionalityAsyncClient.java","src/main/java/parameters/bodyoptionality/BodyOptionalityClient.java","src/main/java/parameters/bodyoptionality/BodyOptionalityClientBuilder.java","src/main/java/parameters/bodyoptionality/OptionalExplicitAsyncClient.java","src/main/java/parameters/bodyoptionality/OptionalExplicitClient.java","src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java","src/main/java/parameters/bodyoptionality/implementation/OptionalExplicitsImpl.java","src/main/java/parameters/bodyoptionality/implementation/package-info.java","src/main/java/parameters/bodyoptionality/models/BodyModel.java","src/main/java/parameters/bodyoptionality/models/package-info.java","src/main/java/parameters/bodyoptionality/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_apiview_properties.json deleted file mode 100644 index 22010c897f1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_apiview_properties.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "parameters.collectionformat.CollectionFormatClientBuilder": "Parameters.CollectionFormat", - "parameters.collectionformat.HeaderAsyncClient": "Parameters.CollectionFormat.Header", - "parameters.collectionformat.HeaderAsyncClient.csv": "Parameters.CollectionFormat.Header.csv", - "parameters.collectionformat.HeaderAsyncClient.csvWithResponse": "Parameters.CollectionFormat.Header.csv", - "parameters.collectionformat.HeaderClient": "Parameters.CollectionFormat.Header", - "parameters.collectionformat.HeaderClient.csv": "Parameters.CollectionFormat.Header.csv", - "parameters.collectionformat.HeaderClient.csvWithResponse": "Parameters.CollectionFormat.Header.csv", - "parameters.collectionformat.QueryAsyncClient": "Parameters.CollectionFormat.Query", - "parameters.collectionformat.QueryAsyncClient.csv": "Parameters.CollectionFormat.Query.csv", - "parameters.collectionformat.QueryAsyncClient.csvWithResponse": "Parameters.CollectionFormat.Query.csv", - "parameters.collectionformat.QueryAsyncClient.multi": "Parameters.CollectionFormat.Query.multi", - "parameters.collectionformat.QueryAsyncClient.multiWithResponse": "Parameters.CollectionFormat.Query.multi", - "parameters.collectionformat.QueryAsyncClient.pipes": "Parameters.CollectionFormat.Query.pipes", - "parameters.collectionformat.QueryAsyncClient.pipesWithResponse": "Parameters.CollectionFormat.Query.pipes", - "parameters.collectionformat.QueryAsyncClient.ssv": "Parameters.CollectionFormat.Query.ssv", - "parameters.collectionformat.QueryAsyncClient.ssvWithResponse": "Parameters.CollectionFormat.Query.ssv", - "parameters.collectionformat.QueryClient": "Parameters.CollectionFormat.Query", - "parameters.collectionformat.QueryClient.csv": "Parameters.CollectionFormat.Query.csv", - "parameters.collectionformat.QueryClient.csvWithResponse": "Parameters.CollectionFormat.Query.csv", - "parameters.collectionformat.QueryClient.multi": "Parameters.CollectionFormat.Query.multi", - "parameters.collectionformat.QueryClient.multiWithResponse": "Parameters.CollectionFormat.Query.multi", - "parameters.collectionformat.QueryClient.pipes": "Parameters.CollectionFormat.Query.pipes", - "parameters.collectionformat.QueryClient.pipesWithResponse": "Parameters.CollectionFormat.Query.pipes", - "parameters.collectionformat.QueryClient.ssv": "Parameters.CollectionFormat.Query.ssv", - "parameters.collectionformat.QueryClient.ssvWithResponse": "Parameters.CollectionFormat.Query.ssv" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_metadata.json deleted file mode 100644 index e105e86b5f3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"parameters.collectionformat.CollectionFormatClientBuilder":"Parameters.CollectionFormat","parameters.collectionformat.HeaderAsyncClient":"Parameters.CollectionFormat.Header","parameters.collectionformat.HeaderAsyncClient.csv":"Parameters.CollectionFormat.Header.csv","parameters.collectionformat.HeaderAsyncClient.csvWithResponse":"Parameters.CollectionFormat.Header.csv","parameters.collectionformat.HeaderClient":"Parameters.CollectionFormat.Header","parameters.collectionformat.HeaderClient.csv":"Parameters.CollectionFormat.Header.csv","parameters.collectionformat.HeaderClient.csvWithResponse":"Parameters.CollectionFormat.Header.csv","parameters.collectionformat.QueryAsyncClient":"Parameters.CollectionFormat.Query","parameters.collectionformat.QueryAsyncClient.csv":"Parameters.CollectionFormat.Query.csv","parameters.collectionformat.QueryAsyncClient.csvWithResponse":"Parameters.CollectionFormat.Query.csv","parameters.collectionformat.QueryAsyncClient.multi":"Parameters.CollectionFormat.Query.multi","parameters.collectionformat.QueryAsyncClient.multiWithResponse":"Parameters.CollectionFormat.Query.multi","parameters.collectionformat.QueryAsyncClient.pipes":"Parameters.CollectionFormat.Query.pipes","parameters.collectionformat.QueryAsyncClient.pipesWithResponse":"Parameters.CollectionFormat.Query.pipes","parameters.collectionformat.QueryAsyncClient.ssv":"Parameters.CollectionFormat.Query.ssv","parameters.collectionformat.QueryAsyncClient.ssvWithResponse":"Parameters.CollectionFormat.Query.ssv","parameters.collectionformat.QueryClient":"Parameters.CollectionFormat.Query","parameters.collectionformat.QueryClient.csv":"Parameters.CollectionFormat.Query.csv","parameters.collectionformat.QueryClient.csvWithResponse":"Parameters.CollectionFormat.Query.csv","parameters.collectionformat.QueryClient.multi":"Parameters.CollectionFormat.Query.multi","parameters.collectionformat.QueryClient.multiWithResponse":"Parameters.CollectionFormat.Query.multi","parameters.collectionformat.QueryClient.pipes":"Parameters.CollectionFormat.Query.pipes","parameters.collectionformat.QueryClient.pipesWithResponse":"Parameters.CollectionFormat.Query.pipes","parameters.collectionformat.QueryClient.ssv":"Parameters.CollectionFormat.Query.ssv","parameters.collectionformat.QueryClient.ssvWithResponse":"Parameters.CollectionFormat.Query.ssv"},"generatedFiles":["src/main/java/module-info.java","src/main/java/parameters/collectionformat/CollectionFormatClientBuilder.java","src/main/java/parameters/collectionformat/HeaderAsyncClient.java","src/main/java/parameters/collectionformat/HeaderClient.java","src/main/java/parameters/collectionformat/QueryAsyncClient.java","src/main/java/parameters/collectionformat/QueryClient.java","src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java","src/main/java/parameters/collectionformat/implementation/HeadersImpl.java","src/main/java/parameters/collectionformat/implementation/QueriesImpl.java","src/main/java/parameters/collectionformat/implementation/package-info.java","src/main/java/parameters/collectionformat/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_apiview_properties.json deleted file mode 100644 index 66d5687efad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_apiview_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "parameters.path.PathAsyncClient": "Parameters.Path", - "parameters.path.PathAsyncClient.normal": "Parameters.Path.normal", - "parameters.path.PathAsyncClient.normalWithResponse": "Parameters.Path.normal", - "parameters.path.PathAsyncClient.optional": "Parameters.Path.optional", - "parameters.path.PathAsyncClient.optionalWithResponse": "Parameters.Path.optional", - "parameters.path.PathClient": "Parameters.Path", - "parameters.path.PathClient.normal": "Parameters.Path.normal", - "parameters.path.PathClient.normalWithResponse": "Parameters.Path.normal", - "parameters.path.PathClient.optional": "Parameters.Path.optional", - "parameters.path.PathClient.optionalWithResponse": "Parameters.Path.optional", - "parameters.path.PathClientBuilder": "Parameters.Path" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_metadata.json deleted file mode 100644 index 02ff582ae64..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"parameters.path.PathAsyncClient":"Parameters.Path","parameters.path.PathAsyncClient.normal":"Parameters.Path.normal","parameters.path.PathAsyncClient.normalWithResponse":"Parameters.Path.normal","parameters.path.PathAsyncClient.optional":"Parameters.Path.optional","parameters.path.PathAsyncClient.optionalWithResponse":"Parameters.Path.optional","parameters.path.PathClient":"Parameters.Path","parameters.path.PathClient.normal":"Parameters.Path.normal","parameters.path.PathClient.normalWithResponse":"Parameters.Path.normal","parameters.path.PathClient.optional":"Parameters.Path.optional","parameters.path.PathClient.optionalWithResponse":"Parameters.Path.optional","parameters.path.PathClientBuilder":"Parameters.Path"},"generatedFiles":["src/main/java/module-info.java","src/main/java/parameters/path/PathAsyncClient.java","src/main/java/parameters/path/PathClient.java","src/main/java/parameters/path/PathClientBuilder.java","src/main/java/parameters/path/implementation/PathClientImpl.java","src/main/java/parameters/path/implementation/package-info.java","src/main/java/parameters/path/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_apiview_properties.json deleted file mode 100644 index 94bb7ef9d28..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_apiview_properties.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "parameters.spread.AliasAsyncClient": "Parameters.Spread.Alias", - "parameters.spread.AliasAsyncClient.spreadAsRequestBody": "Parameters.Spread.Alias.spreadAsRequestBody", - "parameters.spread.AliasAsyncClient.spreadAsRequestBodyWithResponse": "Parameters.Spread.Alias.spreadAsRequestBody", - "parameters.spread.AliasAsyncClient.spreadAsRequestParameter": "Parameters.Spread.Alias.spreadAsRequestParameter", - "parameters.spread.AliasAsyncClient.spreadAsRequestParameterWithResponse": "Parameters.Spread.Alias.spreadAsRequestParameter", - "parameters.spread.AliasAsyncClient.spreadParameterWithInnerAlias": "Parameters.Spread.Alias.spreadParameterWithInnerAlias", - "parameters.spread.AliasAsyncClient.spreadParameterWithInnerAliasWithResponse": "Parameters.Spread.Alias.spreadParameterWithInnerAlias", - "parameters.spread.AliasAsyncClient.spreadParameterWithInnerModel": "Parameters.Spread.Alias.spreadParameterWithInnerModel", - "parameters.spread.AliasAsyncClient.spreadParameterWithInnerModelWithResponse": "Parameters.Spread.Alias.spreadParameterWithInnerModel", - "parameters.spread.AliasAsyncClient.spreadWithMultipleParameters": "Parameters.Spread.Alias.spreadWithMultipleParameters", - "parameters.spread.AliasAsyncClient.spreadWithMultipleParametersWithResponse": "Parameters.Spread.Alias.spreadWithMultipleParameters", - "parameters.spread.AliasClient": "Parameters.Spread.Alias", - "parameters.spread.AliasClient.spreadAsRequestBody": "Parameters.Spread.Alias.spreadAsRequestBody", - "parameters.spread.AliasClient.spreadAsRequestBodyWithResponse": "Parameters.Spread.Alias.spreadAsRequestBody", - "parameters.spread.AliasClient.spreadAsRequestParameter": "Parameters.Spread.Alias.spreadAsRequestParameter", - "parameters.spread.AliasClient.spreadAsRequestParameterWithResponse": "Parameters.Spread.Alias.spreadAsRequestParameter", - "parameters.spread.AliasClient.spreadParameterWithInnerAlias": "Parameters.Spread.Alias.spreadParameterWithInnerAlias", - "parameters.spread.AliasClient.spreadParameterWithInnerAliasWithResponse": "Parameters.Spread.Alias.spreadParameterWithInnerAlias", - "parameters.spread.AliasClient.spreadParameterWithInnerModel": "Parameters.Spread.Alias.spreadParameterWithInnerModel", - "parameters.spread.AliasClient.spreadParameterWithInnerModelWithResponse": "Parameters.Spread.Alias.spreadParameterWithInnerModel", - "parameters.spread.AliasClient.spreadWithMultipleParameters": "Parameters.Spread.Alias.spreadWithMultipleParameters", - "parameters.spread.AliasClient.spreadWithMultipleParametersWithResponse": "Parameters.Spread.Alias.spreadWithMultipleParameters", - "parameters.spread.ModelAsyncClient": "Parameters.Spread.Model", - "parameters.spread.ModelAsyncClient.spreadAsRequestBody": "Parameters.Spread.Model.spreadAsRequestBody", - "parameters.spread.ModelAsyncClient.spreadAsRequestBodyWithResponse": "Parameters.Spread.Model.spreadAsRequestBody", - "parameters.spread.ModelAsyncClient.spreadCompositeRequest": "Parameters.Spread.Model.spreadCompositeRequest", - "parameters.spread.ModelAsyncClient.spreadCompositeRequestMix": "Parameters.Spread.Model.spreadCompositeRequestMix", - "parameters.spread.ModelAsyncClient.spreadCompositeRequestMixWithResponse": "Parameters.Spread.Model.spreadCompositeRequestMix", - "parameters.spread.ModelAsyncClient.spreadCompositeRequestOnlyWithBody": "Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody", - "parameters.spread.ModelAsyncClient.spreadCompositeRequestOnlyWithBodyWithResponse": "Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody", - "parameters.spread.ModelAsyncClient.spreadCompositeRequestWithResponse": "Parameters.Spread.Model.spreadCompositeRequest", - "parameters.spread.ModelAsyncClient.spreadCompositeRequestWithoutBody": "Parameters.Spread.Model.spreadCompositeRequestWithoutBody", - "parameters.spread.ModelAsyncClient.spreadCompositeRequestWithoutBodyWithResponse": "Parameters.Spread.Model.spreadCompositeRequestWithoutBody", - "parameters.spread.ModelClient": "Parameters.Spread.Model", - "parameters.spread.ModelClient.spreadAsRequestBody": "Parameters.Spread.Model.spreadAsRequestBody", - "parameters.spread.ModelClient.spreadAsRequestBodyWithResponse": "Parameters.Spread.Model.spreadAsRequestBody", - "parameters.spread.ModelClient.spreadCompositeRequest": "Parameters.Spread.Model.spreadCompositeRequest", - "parameters.spread.ModelClient.spreadCompositeRequestMix": "Parameters.Spread.Model.spreadCompositeRequestMix", - "parameters.spread.ModelClient.spreadCompositeRequestMixWithResponse": "Parameters.Spread.Model.spreadCompositeRequestMix", - "parameters.spread.ModelClient.spreadCompositeRequestOnlyWithBody": "Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody", - "parameters.spread.ModelClient.spreadCompositeRequestOnlyWithBodyWithResponse": "Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody", - "parameters.spread.ModelClient.spreadCompositeRequestWithResponse": "Parameters.Spread.Model.spreadCompositeRequest", - "parameters.spread.ModelClient.spreadCompositeRequestWithoutBody": "Parameters.Spread.Model.spreadCompositeRequestWithoutBody", - "parameters.spread.ModelClient.spreadCompositeRequestWithoutBodyWithResponse": "Parameters.Spread.Model.spreadCompositeRequestWithoutBody", - "parameters.spread.SpreadClientBuilder": "Parameters.Spread", - "parameters.spread.alias.implementation.models.SpreadAsRequestBodyRequest": "Parameters.Spread.Alias.spreadAsRequestBody.Request.anonymous", - "parameters.spread.implementation.models.SpreadAsRequestParameterRequest": "Parameters.Spread.Alias.spreadAsRequestParameter.Request.anonymous", - "parameters.spread.implementation.models.SpreadCompositeRequestMixRequest": "Parameters.Spread.Model.spreadCompositeRequestMix.Request.anonymous", - "parameters.spread.implementation.models.SpreadParameterWithInnerAliasRequest": "Parameters.Spread.Alias.spreadParameterWithInnerAlias.Request.anonymous", - "parameters.spread.implementation.models.SpreadParameterWithInnerModelRequest": "Parameters.Spread.Alias.spreadParameterWithInnerModel.Request.anonymous", - "parameters.spread.implementation.models.SpreadWithMultipleParametersRequest": "Parameters.Spread.Alias.spreadWithMultipleParameters.Request.anonymous", - "parameters.spread.model.models.BodyParameter": "Parameters.Spread.Model.BodyParameter" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_metadata.json deleted file mode 100644 index d746a4940bb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"parameters.spread.AliasAsyncClient":"Parameters.Spread.Alias","parameters.spread.AliasAsyncClient.spreadAsRequestBody":"Parameters.Spread.Alias.spreadAsRequestBody","parameters.spread.AliasAsyncClient.spreadAsRequestBodyWithResponse":"Parameters.Spread.Alias.spreadAsRequestBody","parameters.spread.AliasAsyncClient.spreadAsRequestParameter":"Parameters.Spread.Alias.spreadAsRequestParameter","parameters.spread.AliasAsyncClient.spreadAsRequestParameterWithResponse":"Parameters.Spread.Alias.spreadAsRequestParameter","parameters.spread.AliasAsyncClient.spreadParameterWithInnerAlias":"Parameters.Spread.Alias.spreadParameterWithInnerAlias","parameters.spread.AliasAsyncClient.spreadParameterWithInnerAliasWithResponse":"Parameters.Spread.Alias.spreadParameterWithInnerAlias","parameters.spread.AliasAsyncClient.spreadParameterWithInnerModel":"Parameters.Spread.Alias.spreadParameterWithInnerModel","parameters.spread.AliasAsyncClient.spreadParameterWithInnerModelWithResponse":"Parameters.Spread.Alias.spreadParameterWithInnerModel","parameters.spread.AliasAsyncClient.spreadWithMultipleParameters":"Parameters.Spread.Alias.spreadWithMultipleParameters","parameters.spread.AliasAsyncClient.spreadWithMultipleParametersWithResponse":"Parameters.Spread.Alias.spreadWithMultipleParameters","parameters.spread.AliasClient":"Parameters.Spread.Alias","parameters.spread.AliasClient.spreadAsRequestBody":"Parameters.Spread.Alias.spreadAsRequestBody","parameters.spread.AliasClient.spreadAsRequestBodyWithResponse":"Parameters.Spread.Alias.spreadAsRequestBody","parameters.spread.AliasClient.spreadAsRequestParameter":"Parameters.Spread.Alias.spreadAsRequestParameter","parameters.spread.AliasClient.spreadAsRequestParameterWithResponse":"Parameters.Spread.Alias.spreadAsRequestParameter","parameters.spread.AliasClient.spreadParameterWithInnerAlias":"Parameters.Spread.Alias.spreadParameterWithInnerAlias","parameters.spread.AliasClient.spreadParameterWithInnerAliasWithResponse":"Parameters.Spread.Alias.spreadParameterWithInnerAlias","parameters.spread.AliasClient.spreadParameterWithInnerModel":"Parameters.Spread.Alias.spreadParameterWithInnerModel","parameters.spread.AliasClient.spreadParameterWithInnerModelWithResponse":"Parameters.Spread.Alias.spreadParameterWithInnerModel","parameters.spread.AliasClient.spreadWithMultipleParameters":"Parameters.Spread.Alias.spreadWithMultipleParameters","parameters.spread.AliasClient.spreadWithMultipleParametersWithResponse":"Parameters.Spread.Alias.spreadWithMultipleParameters","parameters.spread.ModelAsyncClient":"Parameters.Spread.Model","parameters.spread.ModelAsyncClient.spreadAsRequestBody":"Parameters.Spread.Model.spreadAsRequestBody","parameters.spread.ModelAsyncClient.spreadAsRequestBodyWithResponse":"Parameters.Spread.Model.spreadAsRequestBody","parameters.spread.ModelAsyncClient.spreadCompositeRequest":"Parameters.Spread.Model.spreadCompositeRequest","parameters.spread.ModelAsyncClient.spreadCompositeRequestMix":"Parameters.Spread.Model.spreadCompositeRequestMix","parameters.spread.ModelAsyncClient.spreadCompositeRequestMixWithResponse":"Parameters.Spread.Model.spreadCompositeRequestMix","parameters.spread.ModelAsyncClient.spreadCompositeRequestOnlyWithBody":"Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody","parameters.spread.ModelAsyncClient.spreadCompositeRequestOnlyWithBodyWithResponse":"Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody","parameters.spread.ModelAsyncClient.spreadCompositeRequestWithResponse":"Parameters.Spread.Model.spreadCompositeRequest","parameters.spread.ModelAsyncClient.spreadCompositeRequestWithoutBody":"Parameters.Spread.Model.spreadCompositeRequestWithoutBody","parameters.spread.ModelAsyncClient.spreadCompositeRequestWithoutBodyWithResponse":"Parameters.Spread.Model.spreadCompositeRequestWithoutBody","parameters.spread.ModelClient":"Parameters.Spread.Model","parameters.spread.ModelClient.spreadAsRequestBody":"Parameters.Spread.Model.spreadAsRequestBody","parameters.spread.ModelClient.spreadAsRequestBodyWithResponse":"Parameters.Spread.Model.spreadAsRequestBody","parameters.spread.ModelClient.spreadCompositeRequest":"Parameters.Spread.Model.spreadCompositeRequest","parameters.spread.ModelClient.spreadCompositeRequestMix":"Parameters.Spread.Model.spreadCompositeRequestMix","parameters.spread.ModelClient.spreadCompositeRequestMixWithResponse":"Parameters.Spread.Model.spreadCompositeRequestMix","parameters.spread.ModelClient.spreadCompositeRequestOnlyWithBody":"Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody","parameters.spread.ModelClient.spreadCompositeRequestOnlyWithBodyWithResponse":"Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody","parameters.spread.ModelClient.spreadCompositeRequestWithResponse":"Parameters.Spread.Model.spreadCompositeRequest","parameters.spread.ModelClient.spreadCompositeRequestWithoutBody":"Parameters.Spread.Model.spreadCompositeRequestWithoutBody","parameters.spread.ModelClient.spreadCompositeRequestWithoutBodyWithResponse":"Parameters.Spread.Model.spreadCompositeRequestWithoutBody","parameters.spread.SpreadClientBuilder":"Parameters.Spread","parameters.spread.alias.implementation.models.SpreadAsRequestBodyRequest":"Parameters.Spread.Alias.spreadAsRequestBody.Request.anonymous","parameters.spread.implementation.models.SpreadAsRequestParameterRequest":"Parameters.Spread.Alias.spreadAsRequestParameter.Request.anonymous","parameters.spread.implementation.models.SpreadCompositeRequestMixRequest":"Parameters.Spread.Model.spreadCompositeRequestMix.Request.anonymous","parameters.spread.implementation.models.SpreadParameterWithInnerAliasRequest":"Parameters.Spread.Alias.spreadParameterWithInnerAlias.Request.anonymous","parameters.spread.implementation.models.SpreadParameterWithInnerModelRequest":"Parameters.Spread.Alias.spreadParameterWithInnerModel.Request.anonymous","parameters.spread.implementation.models.SpreadWithMultipleParametersRequest":"Parameters.Spread.Alias.spreadWithMultipleParameters.Request.anonymous","parameters.spread.model.models.BodyParameter":"Parameters.Spread.Model.BodyParameter"},"generatedFiles":["src/main/java/module-info.java","src/main/java/parameters/spread/AliasAsyncClient.java","src/main/java/parameters/spread/AliasClient.java","src/main/java/parameters/spread/ModelAsyncClient.java","src/main/java/parameters/spread/ModelClient.java","src/main/java/parameters/spread/SpreadClientBuilder.java","src/main/java/parameters/spread/alias/implementation/models/SpreadAsRequestBodyRequest.java","src/main/java/parameters/spread/alias/implementation/models/package-info.java","src/main/java/parameters/spread/implementation/AliasImpl.java","src/main/java/parameters/spread/implementation/ModelsImpl.java","src/main/java/parameters/spread/implementation/SpreadClientImpl.java","src/main/java/parameters/spread/implementation/models/SpreadAsRequestParameterRequest.java","src/main/java/parameters/spread/implementation/models/SpreadCompositeRequestMixRequest.java","src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerAliasRequest.java","src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerModelRequest.java","src/main/java/parameters/spread/implementation/models/SpreadWithMultipleParametersRequest.java","src/main/java/parameters/spread/implementation/models/package-info.java","src/main/java/parameters/spread/implementation/package-info.java","src/main/java/parameters/spread/model/models/BodyParameter.java","src/main/java/parameters/spread/model/models/package-info.java","src/main/java/parameters/spread/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_apiview_properties.json deleted file mode 100644 index a545c0caa95..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_apiview_properties.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "payload.contentnegotiation.ContentNegotiationClientBuilder": "Payload.ContentNegotiation", - "payload.contentnegotiation.DifferentBodyAsyncClient": "Payload.ContentNegotiation.DifferentBody", - "payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsJson": "Payload.ContentNegotiation.DifferentBody.getAvatarAsJson", - "payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsJsonWithResponse": "Payload.ContentNegotiation.DifferentBody.getAvatarAsJson", - "payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsPng": "Payload.ContentNegotiation.DifferentBody.getAvatarAsPng", - "payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsPngWithResponse": "Payload.ContentNegotiation.DifferentBody.getAvatarAsPng", - "payload.contentnegotiation.DifferentBodyClient": "Payload.ContentNegotiation.DifferentBody", - "payload.contentnegotiation.DifferentBodyClient.getAvatarAsJson": "Payload.ContentNegotiation.DifferentBody.getAvatarAsJson", - "payload.contentnegotiation.DifferentBodyClient.getAvatarAsJsonWithResponse": "Payload.ContentNegotiation.DifferentBody.getAvatarAsJson", - "payload.contentnegotiation.DifferentBodyClient.getAvatarAsPng": "Payload.ContentNegotiation.DifferentBody.getAvatarAsPng", - "payload.contentnegotiation.DifferentBodyClient.getAvatarAsPngWithResponse": "Payload.ContentNegotiation.DifferentBody.getAvatarAsPng", - "payload.contentnegotiation.SameBodyAsyncClient": "Payload.ContentNegotiation.SameBody", - "payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsJpeg": "Payload.ContentNegotiation.SameBody.getAvatarAsJpeg", - "payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsJpegWithResponse": "Payload.ContentNegotiation.SameBody.getAvatarAsJpeg", - "payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsPng": "Payload.ContentNegotiation.SameBody.getAvatarAsPng", - "payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsPngWithResponse": "Payload.ContentNegotiation.SameBody.getAvatarAsPng", - "payload.contentnegotiation.SameBodyClient": "Payload.ContentNegotiation.SameBody", - "payload.contentnegotiation.SameBodyClient.getAvatarAsJpeg": "Payload.ContentNegotiation.SameBody.getAvatarAsJpeg", - "payload.contentnegotiation.SameBodyClient.getAvatarAsJpegWithResponse": "Payload.ContentNegotiation.SameBody.getAvatarAsJpeg", - "payload.contentnegotiation.SameBodyClient.getAvatarAsPng": "Payload.ContentNegotiation.SameBody.getAvatarAsPng", - "payload.contentnegotiation.SameBodyClient.getAvatarAsPngWithResponse": "Payload.ContentNegotiation.SameBody.getAvatarAsPng", - "payload.contentnegotiation.differentbody.models.PngImageAsJson": "Payload.ContentNegotiation.DifferentBody.PngImageAsJson" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_metadata.json deleted file mode 100644 index d136feae480..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"payload.contentnegotiation.ContentNegotiationClientBuilder":"Payload.ContentNegotiation","payload.contentnegotiation.DifferentBodyAsyncClient":"Payload.ContentNegotiation.DifferentBody","payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsJson":"Payload.ContentNegotiation.DifferentBody.getAvatarAsJson","payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsJsonWithResponse":"Payload.ContentNegotiation.DifferentBody.getAvatarAsJson","payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsPng":"Payload.ContentNegotiation.DifferentBody.getAvatarAsPng","payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsPngWithResponse":"Payload.ContentNegotiation.DifferentBody.getAvatarAsPng","payload.contentnegotiation.DifferentBodyClient":"Payload.ContentNegotiation.DifferentBody","payload.contentnegotiation.DifferentBodyClient.getAvatarAsJson":"Payload.ContentNegotiation.DifferentBody.getAvatarAsJson","payload.contentnegotiation.DifferentBodyClient.getAvatarAsJsonWithResponse":"Payload.ContentNegotiation.DifferentBody.getAvatarAsJson","payload.contentnegotiation.DifferentBodyClient.getAvatarAsPng":"Payload.ContentNegotiation.DifferentBody.getAvatarAsPng","payload.contentnegotiation.DifferentBodyClient.getAvatarAsPngWithResponse":"Payload.ContentNegotiation.DifferentBody.getAvatarAsPng","payload.contentnegotiation.SameBodyAsyncClient":"Payload.ContentNegotiation.SameBody","payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsJpeg":"Payload.ContentNegotiation.SameBody.getAvatarAsJpeg","payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsJpegWithResponse":"Payload.ContentNegotiation.SameBody.getAvatarAsJpeg","payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsPng":"Payload.ContentNegotiation.SameBody.getAvatarAsPng","payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsPngWithResponse":"Payload.ContentNegotiation.SameBody.getAvatarAsPng","payload.contentnegotiation.SameBodyClient":"Payload.ContentNegotiation.SameBody","payload.contentnegotiation.SameBodyClient.getAvatarAsJpeg":"Payload.ContentNegotiation.SameBody.getAvatarAsJpeg","payload.contentnegotiation.SameBodyClient.getAvatarAsJpegWithResponse":"Payload.ContentNegotiation.SameBody.getAvatarAsJpeg","payload.contentnegotiation.SameBodyClient.getAvatarAsPng":"Payload.ContentNegotiation.SameBody.getAvatarAsPng","payload.contentnegotiation.SameBodyClient.getAvatarAsPngWithResponse":"Payload.ContentNegotiation.SameBody.getAvatarAsPng","payload.contentnegotiation.differentbody.models.PngImageAsJson":"Payload.ContentNegotiation.DifferentBody.PngImageAsJson"},"generatedFiles":["src/main/java/module-info.java","src/main/java/payload/contentnegotiation/ContentNegotiationClientBuilder.java","src/main/java/payload/contentnegotiation/DifferentBodyAsyncClient.java","src/main/java/payload/contentnegotiation/DifferentBodyClient.java","src/main/java/payload/contentnegotiation/SameBodyAsyncClient.java","src/main/java/payload/contentnegotiation/SameBodyClient.java","src/main/java/payload/contentnegotiation/differentbody/models/PngImageAsJson.java","src/main/java/payload/contentnegotiation/differentbody/models/package-info.java","src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java","src/main/java/payload/contentnegotiation/implementation/DifferentBodiesImpl.java","src/main/java/payload/contentnegotiation/implementation/SameBodiesImpl.java","src/main/java/payload/contentnegotiation/implementation/package-info.java","src/main/java/payload/contentnegotiation/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_apiview_properties.json deleted file mode 100644 index 0f127fc8f9c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_apiview_properties.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "payload.jsonmergepatch.JsonMergePatchAsyncClient": "Payload.JsonMergePatch", - "payload.jsonmergepatch.JsonMergePatchAsyncClient.createResource": "Payload.JsonMergePatch.createResource", - "payload.jsonmergepatch.JsonMergePatchAsyncClient.createResourceWithResponse": "Payload.JsonMergePatch.createResource", - "payload.jsonmergepatch.JsonMergePatchAsyncClient.updateOptionalResource": "Payload.JsonMergePatch.updateOptionalResource", - "payload.jsonmergepatch.JsonMergePatchAsyncClient.updateOptionalResourceWithResponse": "Payload.JsonMergePatch.updateOptionalResource", - "payload.jsonmergepatch.JsonMergePatchAsyncClient.updateResource": "Payload.JsonMergePatch.updateResource", - "payload.jsonmergepatch.JsonMergePatchAsyncClient.updateResourceWithResponse": "Payload.JsonMergePatch.updateResource", - "payload.jsonmergepatch.JsonMergePatchClient": "Payload.JsonMergePatch", - "payload.jsonmergepatch.JsonMergePatchClient.createResource": "Payload.JsonMergePatch.createResource", - "payload.jsonmergepatch.JsonMergePatchClient.createResourceWithResponse": "Payload.JsonMergePatch.createResource", - "payload.jsonmergepatch.JsonMergePatchClient.updateOptionalResource": "Payload.JsonMergePatch.updateOptionalResource", - "payload.jsonmergepatch.JsonMergePatchClient.updateOptionalResourceWithResponse": "Payload.JsonMergePatch.updateOptionalResource", - "payload.jsonmergepatch.JsonMergePatchClient.updateResource": "Payload.JsonMergePatch.updateResource", - "payload.jsonmergepatch.JsonMergePatchClient.updateResourceWithResponse": "Payload.JsonMergePatch.updateResource", - "payload.jsonmergepatch.JsonMergePatchClientBuilder": "Payload.JsonMergePatch", - "payload.jsonmergepatch.models.InnerModel": "Payload.JsonMergePatch.InnerModel", - "payload.jsonmergepatch.models.Resource": "Payload.JsonMergePatch.Resource", - "payload.jsonmergepatch.models.ResourcePatch": "Payload.JsonMergePatch.ResourcePatch" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_metadata.json deleted file mode 100644 index 45056ffa48e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"payload.jsonmergepatch.JsonMergePatchAsyncClient":"Payload.JsonMergePatch","payload.jsonmergepatch.JsonMergePatchAsyncClient.createResource":"Payload.JsonMergePatch.createResource","payload.jsonmergepatch.JsonMergePatchAsyncClient.createResourceWithResponse":"Payload.JsonMergePatch.createResource","payload.jsonmergepatch.JsonMergePatchAsyncClient.updateOptionalResource":"Payload.JsonMergePatch.updateOptionalResource","payload.jsonmergepatch.JsonMergePatchAsyncClient.updateOptionalResourceWithResponse":"Payload.JsonMergePatch.updateOptionalResource","payload.jsonmergepatch.JsonMergePatchAsyncClient.updateResource":"Payload.JsonMergePatch.updateResource","payload.jsonmergepatch.JsonMergePatchAsyncClient.updateResourceWithResponse":"Payload.JsonMergePatch.updateResource","payload.jsonmergepatch.JsonMergePatchClient":"Payload.JsonMergePatch","payload.jsonmergepatch.JsonMergePatchClient.createResource":"Payload.JsonMergePatch.createResource","payload.jsonmergepatch.JsonMergePatchClient.createResourceWithResponse":"Payload.JsonMergePatch.createResource","payload.jsonmergepatch.JsonMergePatchClient.updateOptionalResource":"Payload.JsonMergePatch.updateOptionalResource","payload.jsonmergepatch.JsonMergePatchClient.updateOptionalResourceWithResponse":"Payload.JsonMergePatch.updateOptionalResource","payload.jsonmergepatch.JsonMergePatchClient.updateResource":"Payload.JsonMergePatch.updateResource","payload.jsonmergepatch.JsonMergePatchClient.updateResourceWithResponse":"Payload.JsonMergePatch.updateResource","payload.jsonmergepatch.JsonMergePatchClientBuilder":"Payload.JsonMergePatch","payload.jsonmergepatch.models.InnerModel":"Payload.JsonMergePatch.InnerModel","payload.jsonmergepatch.models.Resource":"Payload.JsonMergePatch.Resource","payload.jsonmergepatch.models.ResourcePatch":"Payload.JsonMergePatch.ResourcePatch"},"generatedFiles":["src/main/java/module-info.java","src/main/java/payload/jsonmergepatch/JsonMergePatchAsyncClient.java","src/main/java/payload/jsonmergepatch/JsonMergePatchClient.java","src/main/java/payload/jsonmergepatch/JsonMergePatchClientBuilder.java","src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java","src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchHelper.java","src/main/java/payload/jsonmergepatch/implementation/package-info.java","src/main/java/payload/jsonmergepatch/models/InnerModel.java","src/main/java/payload/jsonmergepatch/models/Resource.java","src/main/java/payload/jsonmergepatch/models/ResourcePatch.java","src/main/java/payload/jsonmergepatch/models/package-info.java","src/main/java/payload/jsonmergepatch/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_apiview_properties.json deleted file mode 100644 index 6e003b50b54..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_apiview_properties.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "payload.mediatype.MediaTypeAsyncClient": "Payload.MediaType.StringBody", - "payload.mediatype.MediaTypeAsyncClient.getAsJson": "Payload.MediaType.StringBody.getAsJson", - "payload.mediatype.MediaTypeAsyncClient.getAsJsonWithResponse": "Payload.MediaType.StringBody.getAsJson", - "payload.mediatype.MediaTypeAsyncClient.getAsText": "Payload.MediaType.StringBody.getAsText", - "payload.mediatype.MediaTypeAsyncClient.getAsTextWithResponse": "Payload.MediaType.StringBody.getAsText", - "payload.mediatype.MediaTypeAsyncClient.sendAsJson": "Payload.MediaType.StringBody.sendAsJson", - "payload.mediatype.MediaTypeAsyncClient.sendAsJsonWithResponse": "Payload.MediaType.StringBody.sendAsJson", - "payload.mediatype.MediaTypeAsyncClient.sendAsText": "Payload.MediaType.StringBody.sendAsText", - "payload.mediatype.MediaTypeAsyncClient.sendAsTextWithResponse": "Payload.MediaType.StringBody.sendAsText", - "payload.mediatype.MediaTypeClient": "Payload.MediaType.StringBody", - "payload.mediatype.MediaTypeClient.getAsJson": "Payload.MediaType.StringBody.getAsJson", - "payload.mediatype.MediaTypeClient.getAsJsonWithResponse": "Payload.MediaType.StringBody.getAsJson", - "payload.mediatype.MediaTypeClient.getAsText": "Payload.MediaType.StringBody.getAsText", - "payload.mediatype.MediaTypeClient.getAsTextWithResponse": "Payload.MediaType.StringBody.getAsText", - "payload.mediatype.MediaTypeClient.sendAsJson": "Payload.MediaType.StringBody.sendAsJson", - "payload.mediatype.MediaTypeClient.sendAsJsonWithResponse": "Payload.MediaType.StringBody.sendAsJson", - "payload.mediatype.MediaTypeClient.sendAsText": "Payload.MediaType.StringBody.sendAsText", - "payload.mediatype.MediaTypeClient.sendAsTextWithResponse": "Payload.MediaType.StringBody.sendAsText", - "payload.mediatype.MediaTypeClientBuilder": "Payload.MediaType" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_metadata.json deleted file mode 100644 index 7cfedb7a6a9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"payload.mediatype.MediaTypeAsyncClient":"Payload.MediaType.StringBody","payload.mediatype.MediaTypeAsyncClient.getAsJson":"Payload.MediaType.StringBody.getAsJson","payload.mediatype.MediaTypeAsyncClient.getAsJsonWithResponse":"Payload.MediaType.StringBody.getAsJson","payload.mediatype.MediaTypeAsyncClient.getAsText":"Payload.MediaType.StringBody.getAsText","payload.mediatype.MediaTypeAsyncClient.getAsTextWithResponse":"Payload.MediaType.StringBody.getAsText","payload.mediatype.MediaTypeAsyncClient.sendAsJson":"Payload.MediaType.StringBody.sendAsJson","payload.mediatype.MediaTypeAsyncClient.sendAsJsonWithResponse":"Payload.MediaType.StringBody.sendAsJson","payload.mediatype.MediaTypeAsyncClient.sendAsText":"Payload.MediaType.StringBody.sendAsText","payload.mediatype.MediaTypeAsyncClient.sendAsTextWithResponse":"Payload.MediaType.StringBody.sendAsText","payload.mediatype.MediaTypeClient":"Payload.MediaType.StringBody","payload.mediatype.MediaTypeClient.getAsJson":"Payload.MediaType.StringBody.getAsJson","payload.mediatype.MediaTypeClient.getAsJsonWithResponse":"Payload.MediaType.StringBody.getAsJson","payload.mediatype.MediaTypeClient.getAsText":"Payload.MediaType.StringBody.getAsText","payload.mediatype.MediaTypeClient.getAsTextWithResponse":"Payload.MediaType.StringBody.getAsText","payload.mediatype.MediaTypeClient.sendAsJson":"Payload.MediaType.StringBody.sendAsJson","payload.mediatype.MediaTypeClient.sendAsJsonWithResponse":"Payload.MediaType.StringBody.sendAsJson","payload.mediatype.MediaTypeClient.sendAsText":"Payload.MediaType.StringBody.sendAsText","payload.mediatype.MediaTypeClient.sendAsTextWithResponse":"Payload.MediaType.StringBody.sendAsText","payload.mediatype.MediaTypeClientBuilder":"Payload.MediaType"},"generatedFiles":["src/main/java/module-info.java","src/main/java/payload/mediatype/MediaTypeAsyncClient.java","src/main/java/payload/mediatype/MediaTypeClient.java","src/main/java/payload/mediatype/MediaTypeClientBuilder.java","src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java","src/main/java/payload/mediatype/implementation/StringBodiesImpl.java","src/main/java/payload/mediatype/implementation/package-info.java","src/main/java/payload/mediatype/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_apiview_properties.json deleted file mode 100644 index 36f7a51cedf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_apiview_properties.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "payload.multipart.FormDataAsyncClient": "Payload.MultiPart.FormData", - "payload.multipart.FormDataAsyncClient.anonymousModel": "Payload.MultiPart.FormData.anonymousModel", - "payload.multipart.FormDataAsyncClient.anonymousModelWithResponse": "Payload.MultiPart.FormData.anonymousModel", - "payload.multipart.FormDataAsyncClient.basic": "Payload.MultiPart.FormData.basic", - "payload.multipart.FormDataAsyncClient.basicWithResponse": "Payload.MultiPart.FormData.basic", - "payload.multipart.FormDataAsyncClient.binaryArrayParts": "Payload.MultiPart.FormData.binaryArrayParts", - "payload.multipart.FormDataAsyncClient.binaryArrayPartsWithResponse": "Payload.MultiPart.FormData.binaryArrayParts", - "payload.multipart.FormDataAsyncClient.checkFileNameAndContentType": "Payload.MultiPart.FormData.checkFileNameAndContentType", - "payload.multipart.FormDataAsyncClient.checkFileNameAndContentTypeWithResponse": "Payload.MultiPart.FormData.checkFileNameAndContentType", - "payload.multipart.FormDataAsyncClient.fileArrayAndBasic": "Payload.MultiPart.FormData.fileArrayAndBasic", - "payload.multipart.FormDataAsyncClient.fileArrayAndBasicWithResponse": "Payload.MultiPart.FormData.fileArrayAndBasic", - "payload.multipart.FormDataAsyncClient.jsonPart": "Payload.MultiPart.FormData.jsonPart", - "payload.multipart.FormDataAsyncClient.jsonPartWithResponse": "Payload.MultiPart.FormData.jsonPart", - "payload.multipart.FormDataAsyncClient.multiBinaryParts": "Payload.MultiPart.FormData.multiBinaryParts", - "payload.multipart.FormDataAsyncClient.multiBinaryPartsWithResponse": "Payload.MultiPart.FormData.multiBinaryParts", - "payload.multipart.FormDataClient": "Payload.MultiPart.FormData", - "payload.multipart.FormDataClient.anonymousModel": "Payload.MultiPart.FormData.anonymousModel", - "payload.multipart.FormDataClient.anonymousModelWithResponse": "Payload.MultiPart.FormData.anonymousModel", - "payload.multipart.FormDataClient.basic": "Payload.MultiPart.FormData.basic", - "payload.multipart.FormDataClient.basicWithResponse": "Payload.MultiPart.FormData.basic", - "payload.multipart.FormDataClient.binaryArrayParts": "Payload.MultiPart.FormData.binaryArrayParts", - "payload.multipart.FormDataClient.binaryArrayPartsWithResponse": "Payload.MultiPart.FormData.binaryArrayParts", - "payload.multipart.FormDataClient.checkFileNameAndContentType": "Payload.MultiPart.FormData.checkFileNameAndContentType", - "payload.multipart.FormDataClient.checkFileNameAndContentTypeWithResponse": "Payload.MultiPart.FormData.checkFileNameAndContentType", - "payload.multipart.FormDataClient.fileArrayAndBasic": "Payload.MultiPart.FormData.fileArrayAndBasic", - "payload.multipart.FormDataClient.fileArrayAndBasicWithResponse": "Payload.MultiPart.FormData.fileArrayAndBasic", - "payload.multipart.FormDataClient.jsonPart": "Payload.MultiPart.FormData.jsonPart", - "payload.multipart.FormDataClient.jsonPartWithResponse": "Payload.MultiPart.FormData.jsonPart", - "payload.multipart.FormDataClient.multiBinaryParts": "Payload.MultiPart.FormData.multiBinaryParts", - "payload.multipart.FormDataClient.multiBinaryPartsWithResponse": "Payload.MultiPart.FormData.multiBinaryParts", - "payload.multipart.FormDataHttpPartsAsyncClient": "Payload.MultiPart.FormData.HttpParts", - "payload.multipart.FormDataHttpPartsAsyncClient.jsonArrayAndFileArray": "Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray", - "payload.multipart.FormDataHttpPartsAsyncClient.jsonArrayAndFileArrayWithResponse": "Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray", - "payload.multipart.FormDataHttpPartsClient": "Payload.MultiPart.FormData.HttpParts", - "payload.multipart.FormDataHttpPartsClient.jsonArrayAndFileArray": "Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray", - "payload.multipart.FormDataHttpPartsClient.jsonArrayAndFileArrayWithResponse": "Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray", - "payload.multipart.FormDataHttpPartsContentTypeAsyncClient": "Payload.MultiPart.FormData.HttpParts.ContentType", - "payload.multipart.FormDataHttpPartsContentTypeAsyncClient.imageJpegContentType": "Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType", - "payload.multipart.FormDataHttpPartsContentTypeAsyncClient.imageJpegContentTypeWithResponse": "Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType", - "payload.multipart.FormDataHttpPartsContentTypeAsyncClient.optionalContentType": "Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType", - "payload.multipart.FormDataHttpPartsContentTypeAsyncClient.optionalContentTypeWithResponse": "Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType", - "payload.multipart.FormDataHttpPartsContentTypeAsyncClient.requiredContentType": "Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType", - "payload.multipart.FormDataHttpPartsContentTypeAsyncClient.requiredContentTypeWithResponse": "Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType", - "payload.multipart.FormDataHttpPartsContentTypeClient": "Payload.MultiPart.FormData.HttpParts.ContentType", - "payload.multipart.FormDataHttpPartsContentTypeClient.imageJpegContentType": "Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType", - "payload.multipart.FormDataHttpPartsContentTypeClient.imageJpegContentTypeWithResponse": "Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType", - "payload.multipart.FormDataHttpPartsContentTypeClient.optionalContentType": "Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType", - "payload.multipart.FormDataHttpPartsContentTypeClient.optionalContentTypeWithResponse": "Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType", - "payload.multipart.FormDataHttpPartsContentTypeClient.requiredContentType": "Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType", - "payload.multipart.FormDataHttpPartsContentTypeClient.requiredContentTypeWithResponse": "Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType", - "payload.multipart.FormDataHttpPartsNonStringAsyncClient": "Payload.MultiPart.FormData.HttpParts.NonString", - "payload.multipart.FormDataHttpPartsNonStringAsyncClient.floatMethod": "Payload.MultiPart.FormData.HttpParts.NonString.float", - "payload.multipart.FormDataHttpPartsNonStringAsyncClient.floatMethodWithResponse": "Payload.MultiPart.FormData.HttpParts.NonString.float", - "payload.multipart.FormDataHttpPartsNonStringClient": "Payload.MultiPart.FormData.HttpParts.NonString", - "payload.multipart.FormDataHttpPartsNonStringClient.floatMethod": "Payload.MultiPart.FormData.HttpParts.NonString.float", - "payload.multipart.FormDataHttpPartsNonStringClient.floatMethodWithResponse": "Payload.MultiPart.FormData.HttpParts.NonString.float", - "payload.multipart.MultiPartClientBuilder": "Payload.MultiPart", - "payload.multipart.formdata.httpparts.nonstring.models.FloatRequest": "Payload.MultiPart.FormData.HttpParts.NonString.float.Request.anonymous", - "payload.multipart.formdata.models.AnonymousModelRequest": "Payload.MultiPart.FormData.anonymousModel.Request.anonymous", - "payload.multipart.models.Address": "Payload.MultiPart.Address", - "payload.multipart.models.BinaryArrayPartsRequest": "Payload.MultiPart.BinaryArrayPartsRequest", - "payload.multipart.models.ComplexHttpPartsModelRequest": "Payload.MultiPart.ComplexHttpPartsModelRequest", - "payload.multipart.models.ComplexPartsRequest": "Payload.MultiPart.ComplexPartsRequest", - "payload.multipart.models.FileOptionalContentType": "Payload.MultiPart.FileOptionalContentType", - "payload.multipart.models.FileRequiredMetaData": "Payload.MultiPart.FileRequiredMetaData", - "payload.multipart.models.FileSpecificContentType": "Payload.MultiPart.FileSpecificContentType", - "payload.multipart.models.FileWithHttpPartOptionalContentTypeRequest": "Payload.MultiPart.FileWithHttpPartOptionalContentTypeRequest", - "payload.multipart.models.FileWithHttpPartRequiredContentTypeRequest": "Payload.MultiPart.FileWithHttpPartRequiredContentTypeRequest", - "payload.multipart.models.FileWithHttpPartSpecificContentTypeRequest": "Payload.MultiPart.FileWithHttpPartSpecificContentTypeRequest", - "payload.multipart.models.JsonPartRequest": "Payload.MultiPart.JsonPartRequest", - "payload.multipart.models.MultiBinaryPartsRequest": "Payload.MultiPart.MultiBinaryPartsRequest", - "payload.multipart.models.MultiPartRequest": "Payload.MultiPart.MultiPartRequest", - "payload.multipart.models.PictureFileDetails": null, - "payload.multipart.models.PicturesFileDetails": null, - "payload.multipart.models.ProfileImageFileDetails": null - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_metadata.json deleted file mode 100644 index 3d6ba8c801f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"payload.multipart.FormDataAsyncClient":"Payload.MultiPart.FormData","payload.multipart.FormDataAsyncClient.anonymousModel":"Payload.MultiPart.FormData.anonymousModel","payload.multipart.FormDataAsyncClient.anonymousModelWithResponse":"Payload.MultiPart.FormData.anonymousModel","payload.multipart.FormDataAsyncClient.basic":"Payload.MultiPart.FormData.basic","payload.multipart.FormDataAsyncClient.basicWithResponse":"Payload.MultiPart.FormData.basic","payload.multipart.FormDataAsyncClient.binaryArrayParts":"Payload.MultiPart.FormData.binaryArrayParts","payload.multipart.FormDataAsyncClient.binaryArrayPartsWithResponse":"Payload.MultiPart.FormData.binaryArrayParts","payload.multipart.FormDataAsyncClient.checkFileNameAndContentType":"Payload.MultiPart.FormData.checkFileNameAndContentType","payload.multipart.FormDataAsyncClient.checkFileNameAndContentTypeWithResponse":"Payload.MultiPart.FormData.checkFileNameAndContentType","payload.multipart.FormDataAsyncClient.fileArrayAndBasic":"Payload.MultiPart.FormData.fileArrayAndBasic","payload.multipart.FormDataAsyncClient.fileArrayAndBasicWithResponse":"Payload.MultiPart.FormData.fileArrayAndBasic","payload.multipart.FormDataAsyncClient.jsonPart":"Payload.MultiPart.FormData.jsonPart","payload.multipart.FormDataAsyncClient.jsonPartWithResponse":"Payload.MultiPart.FormData.jsonPart","payload.multipart.FormDataAsyncClient.multiBinaryParts":"Payload.MultiPart.FormData.multiBinaryParts","payload.multipart.FormDataAsyncClient.multiBinaryPartsWithResponse":"Payload.MultiPart.FormData.multiBinaryParts","payload.multipart.FormDataClient":"Payload.MultiPart.FormData","payload.multipart.FormDataClient.anonymousModel":"Payload.MultiPart.FormData.anonymousModel","payload.multipart.FormDataClient.anonymousModelWithResponse":"Payload.MultiPart.FormData.anonymousModel","payload.multipart.FormDataClient.basic":"Payload.MultiPart.FormData.basic","payload.multipart.FormDataClient.basicWithResponse":"Payload.MultiPart.FormData.basic","payload.multipart.FormDataClient.binaryArrayParts":"Payload.MultiPart.FormData.binaryArrayParts","payload.multipart.FormDataClient.binaryArrayPartsWithResponse":"Payload.MultiPart.FormData.binaryArrayParts","payload.multipart.FormDataClient.checkFileNameAndContentType":"Payload.MultiPart.FormData.checkFileNameAndContentType","payload.multipart.FormDataClient.checkFileNameAndContentTypeWithResponse":"Payload.MultiPart.FormData.checkFileNameAndContentType","payload.multipart.FormDataClient.fileArrayAndBasic":"Payload.MultiPart.FormData.fileArrayAndBasic","payload.multipart.FormDataClient.fileArrayAndBasicWithResponse":"Payload.MultiPart.FormData.fileArrayAndBasic","payload.multipart.FormDataClient.jsonPart":"Payload.MultiPart.FormData.jsonPart","payload.multipart.FormDataClient.jsonPartWithResponse":"Payload.MultiPart.FormData.jsonPart","payload.multipart.FormDataClient.multiBinaryParts":"Payload.MultiPart.FormData.multiBinaryParts","payload.multipart.FormDataClient.multiBinaryPartsWithResponse":"Payload.MultiPart.FormData.multiBinaryParts","payload.multipart.FormDataHttpPartsAsyncClient":"Payload.MultiPart.FormData.HttpParts","payload.multipart.FormDataHttpPartsAsyncClient.jsonArrayAndFileArray":"Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray","payload.multipart.FormDataHttpPartsAsyncClient.jsonArrayAndFileArrayWithResponse":"Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray","payload.multipart.FormDataHttpPartsClient":"Payload.MultiPart.FormData.HttpParts","payload.multipart.FormDataHttpPartsClient.jsonArrayAndFileArray":"Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray","payload.multipart.FormDataHttpPartsClient.jsonArrayAndFileArrayWithResponse":"Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray","payload.multipart.FormDataHttpPartsContentTypeAsyncClient":"Payload.MultiPart.FormData.HttpParts.ContentType","payload.multipart.FormDataHttpPartsContentTypeAsyncClient.imageJpegContentType":"Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType","payload.multipart.FormDataHttpPartsContentTypeAsyncClient.imageJpegContentTypeWithResponse":"Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType","payload.multipart.FormDataHttpPartsContentTypeAsyncClient.optionalContentType":"Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType","payload.multipart.FormDataHttpPartsContentTypeAsyncClient.optionalContentTypeWithResponse":"Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType","payload.multipart.FormDataHttpPartsContentTypeAsyncClient.requiredContentType":"Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType","payload.multipart.FormDataHttpPartsContentTypeAsyncClient.requiredContentTypeWithResponse":"Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType","payload.multipart.FormDataHttpPartsContentTypeClient":"Payload.MultiPart.FormData.HttpParts.ContentType","payload.multipart.FormDataHttpPartsContentTypeClient.imageJpegContentType":"Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType","payload.multipart.FormDataHttpPartsContentTypeClient.imageJpegContentTypeWithResponse":"Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType","payload.multipart.FormDataHttpPartsContentTypeClient.optionalContentType":"Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType","payload.multipart.FormDataHttpPartsContentTypeClient.optionalContentTypeWithResponse":"Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType","payload.multipart.FormDataHttpPartsContentTypeClient.requiredContentType":"Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType","payload.multipart.FormDataHttpPartsContentTypeClient.requiredContentTypeWithResponse":"Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType","payload.multipart.FormDataHttpPartsNonStringAsyncClient":"Payload.MultiPart.FormData.HttpParts.NonString","payload.multipart.FormDataHttpPartsNonStringAsyncClient.floatMethod":"Payload.MultiPart.FormData.HttpParts.NonString.float","payload.multipart.FormDataHttpPartsNonStringAsyncClient.floatMethodWithResponse":"Payload.MultiPart.FormData.HttpParts.NonString.float","payload.multipart.FormDataHttpPartsNonStringClient":"Payload.MultiPart.FormData.HttpParts.NonString","payload.multipart.FormDataHttpPartsNonStringClient.floatMethod":"Payload.MultiPart.FormData.HttpParts.NonString.float","payload.multipart.FormDataHttpPartsNonStringClient.floatMethodWithResponse":"Payload.MultiPart.FormData.HttpParts.NonString.float","payload.multipart.MultiPartClientBuilder":"Payload.MultiPart","payload.multipart.formdata.httpparts.nonstring.models.FloatRequest":"Payload.MultiPart.FormData.HttpParts.NonString.float.Request.anonymous","payload.multipart.formdata.models.AnonymousModelRequest":"Payload.MultiPart.FormData.anonymousModel.Request.anonymous","payload.multipart.models.Address":"Payload.MultiPart.Address","payload.multipart.models.BinaryArrayPartsRequest":"Payload.MultiPart.BinaryArrayPartsRequest","payload.multipart.models.ComplexHttpPartsModelRequest":"Payload.MultiPart.ComplexHttpPartsModelRequest","payload.multipart.models.ComplexPartsRequest":"Payload.MultiPart.ComplexPartsRequest","payload.multipart.models.FileOptionalContentType":"Payload.MultiPart.FileOptionalContentType","payload.multipart.models.FileRequiredMetaData":"Payload.MultiPart.FileRequiredMetaData","payload.multipart.models.FileSpecificContentType":"Payload.MultiPart.FileSpecificContentType","payload.multipart.models.FileWithHttpPartOptionalContentTypeRequest":"Payload.MultiPart.FileWithHttpPartOptionalContentTypeRequest","payload.multipart.models.FileWithHttpPartRequiredContentTypeRequest":"Payload.MultiPart.FileWithHttpPartRequiredContentTypeRequest","payload.multipart.models.FileWithHttpPartSpecificContentTypeRequest":"Payload.MultiPart.FileWithHttpPartSpecificContentTypeRequest","payload.multipart.models.JsonPartRequest":"Payload.MultiPart.JsonPartRequest","payload.multipart.models.MultiBinaryPartsRequest":"Payload.MultiPart.MultiBinaryPartsRequest","payload.multipart.models.MultiPartRequest":"Payload.MultiPart.MultiPartRequest","payload.multipart.models.PictureFileDetails":null,"payload.multipart.models.PicturesFileDetails":null,"payload.multipart.models.ProfileImageFileDetails":null},"generatedFiles":["src/main/java/module-info.java","src/main/java/payload/multipart/FormDataAsyncClient.java","src/main/java/payload/multipart/FormDataClient.java","src/main/java/payload/multipart/FormDataHttpPartsAsyncClient.java","src/main/java/payload/multipart/FormDataHttpPartsClient.java","src/main/java/payload/multipart/FormDataHttpPartsContentTypeAsyncClient.java","src/main/java/payload/multipart/FormDataHttpPartsContentTypeClient.java","src/main/java/payload/multipart/FormDataHttpPartsNonStringAsyncClient.java","src/main/java/payload/multipart/FormDataHttpPartsNonStringClient.java","src/main/java/payload/multipart/MultiPartClientBuilder.java","src/main/java/payload/multipart/formdata/httpparts/nonstring/models/FloatRequest.java","src/main/java/payload/multipart/formdata/httpparts/nonstring/models/package-info.java","src/main/java/payload/multipart/formdata/models/AnonymousModelRequest.java","src/main/java/payload/multipart/formdata/models/package-info.java","src/main/java/payload/multipart/implementation/FormDataHttpPartsContentTypesImpl.java","src/main/java/payload/multipart/implementation/FormDataHttpPartsImpl.java","src/main/java/payload/multipart/implementation/FormDataHttpPartsNonStringsImpl.java","src/main/java/payload/multipart/implementation/FormDatasImpl.java","src/main/java/payload/multipart/implementation/MultiPartClientImpl.java","src/main/java/payload/multipart/implementation/MultipartFormDataHelper.java","src/main/java/payload/multipart/implementation/package-info.java","src/main/java/payload/multipart/models/Address.java","src/main/java/payload/multipart/models/BinaryArrayPartsRequest.java","src/main/java/payload/multipart/models/ComplexHttpPartsModelRequest.java","src/main/java/payload/multipart/models/ComplexPartsRequest.java","src/main/java/payload/multipart/models/FileOptionalContentType.java","src/main/java/payload/multipart/models/FileRequiredMetaData.java","src/main/java/payload/multipart/models/FileSpecificContentType.java","src/main/java/payload/multipart/models/FileWithHttpPartOptionalContentTypeRequest.java","src/main/java/payload/multipart/models/FileWithHttpPartRequiredContentTypeRequest.java","src/main/java/payload/multipart/models/FileWithHttpPartSpecificContentTypeRequest.java","src/main/java/payload/multipart/models/JsonPartRequest.java","src/main/java/payload/multipart/models/MultiBinaryPartsRequest.java","src/main/java/payload/multipart/models/MultiPartRequest.java","src/main/java/payload/multipart/models/PictureFileDetails.java","src/main/java/payload/multipart/models/PicturesFileDetails.java","src/main/java/payload/multipart/models/ProfileImageFileDetails.java","src/main/java/payload/multipart/models/package-info.java","src/main/java/payload/multipart/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_apiview_properties.json deleted file mode 100644 index a9628906051..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_apiview_properties.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient": "Resiliency.ServiceDriven", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromNone": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromNoneWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneOptional": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneOptionalWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneRequired": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneRequiredWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient": "Resiliency.ServiceDriven", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromNone": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromNoneWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneOptional": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneOptionalWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneRequired": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneRequiredWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", - "resiliency.servicedriven.v1.ResiliencyServiceDrivenClientBuilder": "Resiliency.ServiceDriven" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_metadata.json deleted file mode 100644 index 916871c2b60..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"all","crossLanguageDefinitions":{"resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient":"Resiliency.ServiceDriven","resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromNone":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromNoneWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneOptional":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneOptionalWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneRequired":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneRequiredWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient":"Resiliency.ServiceDriven","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromNone":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromNoneWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneOptional":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneOptionalWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneRequired":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneRequiredWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.v1.ResiliencyServiceDrivenClientBuilder":"Resiliency.ServiceDriven"},"generatedFiles":["src/main/java/module-info.java","src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenAsyncClient.java","src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClient.java","src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClientBuilder.java","src/main/java/resiliency/servicedriven/v1/ServiceDrivenServiceVersion.java","src/main/java/resiliency/servicedriven/v1/implementation/ResiliencyServiceDrivenClientImpl.java","src/main/java/resiliency/servicedriven/v1/implementation/package-info.java","src/main/java/resiliency/servicedriven/v1/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_apiview_properties.json deleted file mode 100644 index 46deca191e8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_apiview_properties.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient": "Resiliency.ServiceDriven", - "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.addOperation": "Resiliency.ServiceDriven.addOperation", - "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.addOperationWithResponse": "Resiliency.ServiceDriven.addOperation", - "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromNone": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", - "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromNoneWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", - "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneOptional": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", - "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneOptionalWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", - "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneRequired": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", - "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneRequiredWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", - "resiliency.servicedriven.ResiliencyServiceDrivenClient": "Resiliency.ServiceDriven", - "resiliency.servicedriven.ResiliencyServiceDrivenClient.addOperation": "Resiliency.ServiceDriven.addOperation", - "resiliency.servicedriven.ResiliencyServiceDrivenClient.addOperationWithResponse": "Resiliency.ServiceDriven.addOperation", - "resiliency.servicedriven.ResiliencyServiceDrivenClient.fromNone": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", - "resiliency.servicedriven.ResiliencyServiceDrivenClient.fromNoneWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", - "resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneOptional": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", - "resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneOptionalWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", - "resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneRequired": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", - "resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneRequiredWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", - "resiliency.servicedriven.ResiliencyServiceDrivenClientBuilder": "Resiliency.ServiceDriven" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_metadata.json deleted file mode 100644 index 15907f7f4a4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"all","crossLanguageDefinitions":{"resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient":"Resiliency.ServiceDriven","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.addOperation":"Resiliency.ServiceDriven.addOperation","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.addOperationWithResponse":"Resiliency.ServiceDriven.addOperation","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromNone":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromNoneWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneOptional":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneOptionalWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneRequired":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneRequiredWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.ResiliencyServiceDrivenClient":"Resiliency.ServiceDriven","resiliency.servicedriven.ResiliencyServiceDrivenClient.addOperation":"Resiliency.ServiceDriven.addOperation","resiliency.servicedriven.ResiliencyServiceDrivenClient.addOperationWithResponse":"Resiliency.ServiceDriven.addOperation","resiliency.servicedriven.ResiliencyServiceDrivenClient.fromNone":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.ResiliencyServiceDrivenClient.fromNoneWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneOptional":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneOptionalWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneRequired":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneRequiredWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.ResiliencyServiceDrivenClientBuilder":"Resiliency.ServiceDriven"},"generatedFiles":["src/main/java/module-info.java","src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenAsyncClient.java","src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClient.java","src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClientBuilder.java","src/main/java/resiliency/servicedriven/ServiceDrivenServiceVersion.java","src/main/java/resiliency/servicedriven/implementation/ResiliencyServiceDrivenClientImpl.java","src/main/java/resiliency/servicedriven/implementation/package-info.java","src/main/java/resiliency/servicedriven/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_apiview_properties.json deleted file mode 100644 index 916a08548b1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_apiview_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "response.statuscoderange.StatusCodeRangeAsyncClient": "Response.StatusCodeRange", - "response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCode404": "Response.StatusCodeRange.errorResponseStatusCode404", - "response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCode404WithResponse": "Response.StatusCodeRange.errorResponseStatusCode404", - "response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCodeInRange": "Response.StatusCodeRange.errorResponseStatusCodeInRange", - "response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCodeInRangeWithResponse": "Response.StatusCodeRange.errorResponseStatusCodeInRange", - "response.statuscoderange.StatusCodeRangeClient": "Response.StatusCodeRange", - "response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCode404": "Response.StatusCodeRange.errorResponseStatusCode404", - "response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCode404WithResponse": "Response.StatusCodeRange.errorResponseStatusCode404", - "response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCodeInRange": "Response.StatusCodeRange.errorResponseStatusCodeInRange", - "response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCodeInRangeWithResponse": "Response.StatusCodeRange.errorResponseStatusCodeInRange", - "response.statuscoderange.StatusCodeRangeClientBuilder": "Response.StatusCodeRange" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_metadata.json deleted file mode 100644 index 15d6f0b192d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"response.statuscoderange.StatusCodeRangeAsyncClient":"Response.StatusCodeRange","response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCode404":"Response.StatusCodeRange.errorResponseStatusCode404","response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCode404WithResponse":"Response.StatusCodeRange.errorResponseStatusCode404","response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCodeInRange":"Response.StatusCodeRange.errorResponseStatusCodeInRange","response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCodeInRangeWithResponse":"Response.StatusCodeRange.errorResponseStatusCodeInRange","response.statuscoderange.StatusCodeRangeClient":"Response.StatusCodeRange","response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCode404":"Response.StatusCodeRange.errorResponseStatusCode404","response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCode404WithResponse":"Response.StatusCodeRange.errorResponseStatusCode404","response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCodeInRange":"Response.StatusCodeRange.errorResponseStatusCodeInRange","response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCodeInRangeWithResponse":"Response.StatusCodeRange.errorResponseStatusCodeInRange","response.statuscoderange.StatusCodeRangeClientBuilder":"Response.StatusCodeRange"},"generatedFiles":["src/main/java/module-info.java","src/main/java/response/statuscoderange/StatusCodeRangeAsyncClient.java","src/main/java/response/statuscoderange/StatusCodeRangeClient.java","src/main/java/response/statuscoderange/StatusCodeRangeClientBuilder.java","src/main/java/response/statuscoderange/implementation/StatusCodeRangeClientImpl.java","src/main/java/response/statuscoderange/implementation/package-info.java","src/main/java/response/statuscoderange/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_apiview_properties.json deleted file mode 100644 index f2c4c80ec03..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_apiview_properties.json +++ /dev/null @@ -1,224 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "routes.InInterfaceAsyncClient": "Routes.InInterface", - "routes.InInterfaceAsyncClient.fixed": "Routes.InInterface.fixed", - "routes.InInterfaceAsyncClient.fixedWithResponse": "Routes.InInterface.fixed", - "routes.InInterfaceClient": "Routes.InInterface", - "routes.InInterfaceClient.fixed": "Routes.InInterface.fixed", - "routes.InInterfaceClient.fixedWithResponse": "Routes.InInterface.fixed", - "routes.PathParametersAsyncClient": "Routes.PathParameters", - "routes.PathParametersAsyncClient.annotationOnly": "Routes.PathParameters.annotationOnly", - "routes.PathParametersAsyncClient.annotationOnlyWithResponse": "Routes.PathParameters.annotationOnly", - "routes.PathParametersAsyncClient.explicit": "Routes.PathParameters.explicit", - "routes.PathParametersAsyncClient.explicitWithResponse": "Routes.PathParameters.explicit", - "routes.PathParametersAsyncClient.templateOnly": "Routes.PathParameters.templateOnly", - "routes.PathParametersAsyncClient.templateOnlyWithResponse": "Routes.PathParameters.templateOnly", - "routes.PathParametersClient": "Routes.PathParameters", - "routes.PathParametersClient.annotationOnly": "Routes.PathParameters.annotationOnly", - "routes.PathParametersClient.annotationOnlyWithResponse": "Routes.PathParameters.annotationOnly", - "routes.PathParametersClient.explicit": "Routes.PathParameters.explicit", - "routes.PathParametersClient.explicitWithResponse": "Routes.PathParameters.explicit", - "routes.PathParametersClient.templateOnly": "Routes.PathParameters.templateOnly", - "routes.PathParametersClient.templateOnlyWithResponse": "Routes.PathParameters.templateOnly", - "routes.PathParametersLabelExpansionExplodeAsyncClient": "Routes.PathParameters.LabelExpansion.Explode", - "routes.PathParametersLabelExpansionExplodeAsyncClient.array": "Routes.PathParameters.LabelExpansion.Explode.array", - "routes.PathParametersLabelExpansionExplodeAsyncClient.arrayWithResponse": "Routes.PathParameters.LabelExpansion.Explode.array", - "routes.PathParametersLabelExpansionExplodeAsyncClient.primitive": "Routes.PathParameters.LabelExpansion.Explode.primitive", - "routes.PathParametersLabelExpansionExplodeAsyncClient.primitiveWithResponse": "Routes.PathParameters.LabelExpansion.Explode.primitive", - "routes.PathParametersLabelExpansionExplodeAsyncClient.record": "Routes.PathParameters.LabelExpansion.Explode.record", - "routes.PathParametersLabelExpansionExplodeAsyncClient.recordWithResponse": "Routes.PathParameters.LabelExpansion.Explode.record", - "routes.PathParametersLabelExpansionExplodeClient": "Routes.PathParameters.LabelExpansion.Explode", - "routes.PathParametersLabelExpansionExplodeClient.array": "Routes.PathParameters.LabelExpansion.Explode.array", - "routes.PathParametersLabelExpansionExplodeClient.arrayWithResponse": "Routes.PathParameters.LabelExpansion.Explode.array", - "routes.PathParametersLabelExpansionExplodeClient.primitive": "Routes.PathParameters.LabelExpansion.Explode.primitive", - "routes.PathParametersLabelExpansionExplodeClient.primitiveWithResponse": "Routes.PathParameters.LabelExpansion.Explode.primitive", - "routes.PathParametersLabelExpansionExplodeClient.record": "Routes.PathParameters.LabelExpansion.Explode.record", - "routes.PathParametersLabelExpansionExplodeClient.recordWithResponse": "Routes.PathParameters.LabelExpansion.Explode.record", - "routes.PathParametersLabelExpansionStandardAsyncClient": "Routes.PathParameters.LabelExpansion.Standard", - "routes.PathParametersLabelExpansionStandardAsyncClient.array": "Routes.PathParameters.LabelExpansion.Standard.array", - "routes.PathParametersLabelExpansionStandardAsyncClient.arrayWithResponse": "Routes.PathParameters.LabelExpansion.Standard.array", - "routes.PathParametersLabelExpansionStandardAsyncClient.primitive": "Routes.PathParameters.LabelExpansion.Standard.primitive", - "routes.PathParametersLabelExpansionStandardAsyncClient.primitiveWithResponse": "Routes.PathParameters.LabelExpansion.Standard.primitive", - "routes.PathParametersLabelExpansionStandardAsyncClient.record": "Routes.PathParameters.LabelExpansion.Standard.record", - "routes.PathParametersLabelExpansionStandardAsyncClient.recordWithResponse": "Routes.PathParameters.LabelExpansion.Standard.record", - "routes.PathParametersLabelExpansionStandardClient": "Routes.PathParameters.LabelExpansion.Standard", - "routes.PathParametersLabelExpansionStandardClient.array": "Routes.PathParameters.LabelExpansion.Standard.array", - "routes.PathParametersLabelExpansionStandardClient.arrayWithResponse": "Routes.PathParameters.LabelExpansion.Standard.array", - "routes.PathParametersLabelExpansionStandardClient.primitive": "Routes.PathParameters.LabelExpansion.Standard.primitive", - "routes.PathParametersLabelExpansionStandardClient.primitiveWithResponse": "Routes.PathParameters.LabelExpansion.Standard.primitive", - "routes.PathParametersLabelExpansionStandardClient.record": "Routes.PathParameters.LabelExpansion.Standard.record", - "routes.PathParametersLabelExpansionStandardClient.recordWithResponse": "Routes.PathParameters.LabelExpansion.Standard.record", - "routes.PathParametersMatrixExpansionExplodeAsyncClient": "Routes.PathParameters.MatrixExpansion.Explode", - "routes.PathParametersMatrixExpansionExplodeAsyncClient.array": "Routes.PathParameters.MatrixExpansion.Explode.array", - "routes.PathParametersMatrixExpansionExplodeAsyncClient.arrayWithResponse": "Routes.PathParameters.MatrixExpansion.Explode.array", - "routes.PathParametersMatrixExpansionExplodeAsyncClient.primitive": "Routes.PathParameters.MatrixExpansion.Explode.primitive", - "routes.PathParametersMatrixExpansionExplodeAsyncClient.primitiveWithResponse": "Routes.PathParameters.MatrixExpansion.Explode.primitive", - "routes.PathParametersMatrixExpansionExplodeAsyncClient.record": "Routes.PathParameters.MatrixExpansion.Explode.record", - "routes.PathParametersMatrixExpansionExplodeAsyncClient.recordWithResponse": "Routes.PathParameters.MatrixExpansion.Explode.record", - "routes.PathParametersMatrixExpansionExplodeClient": "Routes.PathParameters.MatrixExpansion.Explode", - "routes.PathParametersMatrixExpansionExplodeClient.array": "Routes.PathParameters.MatrixExpansion.Explode.array", - "routes.PathParametersMatrixExpansionExplodeClient.arrayWithResponse": "Routes.PathParameters.MatrixExpansion.Explode.array", - "routes.PathParametersMatrixExpansionExplodeClient.primitive": "Routes.PathParameters.MatrixExpansion.Explode.primitive", - "routes.PathParametersMatrixExpansionExplodeClient.primitiveWithResponse": "Routes.PathParameters.MatrixExpansion.Explode.primitive", - "routes.PathParametersMatrixExpansionExplodeClient.record": "Routes.PathParameters.MatrixExpansion.Explode.record", - "routes.PathParametersMatrixExpansionExplodeClient.recordWithResponse": "Routes.PathParameters.MatrixExpansion.Explode.record", - "routes.PathParametersMatrixExpansionStandardAsyncClient": "Routes.PathParameters.MatrixExpansion.Standard", - "routes.PathParametersMatrixExpansionStandardAsyncClient.array": "Routes.PathParameters.MatrixExpansion.Standard.array", - "routes.PathParametersMatrixExpansionStandardAsyncClient.arrayWithResponse": "Routes.PathParameters.MatrixExpansion.Standard.array", - "routes.PathParametersMatrixExpansionStandardAsyncClient.primitive": "Routes.PathParameters.MatrixExpansion.Standard.primitive", - "routes.PathParametersMatrixExpansionStandardAsyncClient.primitiveWithResponse": "Routes.PathParameters.MatrixExpansion.Standard.primitive", - "routes.PathParametersMatrixExpansionStandardAsyncClient.record": "Routes.PathParameters.MatrixExpansion.Standard.record", - "routes.PathParametersMatrixExpansionStandardAsyncClient.recordWithResponse": "Routes.PathParameters.MatrixExpansion.Standard.record", - "routes.PathParametersMatrixExpansionStandardClient": "Routes.PathParameters.MatrixExpansion.Standard", - "routes.PathParametersMatrixExpansionStandardClient.array": "Routes.PathParameters.MatrixExpansion.Standard.array", - "routes.PathParametersMatrixExpansionStandardClient.arrayWithResponse": "Routes.PathParameters.MatrixExpansion.Standard.array", - "routes.PathParametersMatrixExpansionStandardClient.primitive": "Routes.PathParameters.MatrixExpansion.Standard.primitive", - "routes.PathParametersMatrixExpansionStandardClient.primitiveWithResponse": "Routes.PathParameters.MatrixExpansion.Standard.primitive", - "routes.PathParametersMatrixExpansionStandardClient.record": "Routes.PathParameters.MatrixExpansion.Standard.record", - "routes.PathParametersMatrixExpansionStandardClient.recordWithResponse": "Routes.PathParameters.MatrixExpansion.Standard.record", - "routes.PathParametersPathExpansionExplodeAsyncClient": "Routes.PathParameters.PathExpansion.Explode", - "routes.PathParametersPathExpansionExplodeAsyncClient.array": "Routes.PathParameters.PathExpansion.Explode.array", - "routes.PathParametersPathExpansionExplodeAsyncClient.arrayWithResponse": "Routes.PathParameters.PathExpansion.Explode.array", - "routes.PathParametersPathExpansionExplodeAsyncClient.primitive": "Routes.PathParameters.PathExpansion.Explode.primitive", - "routes.PathParametersPathExpansionExplodeAsyncClient.primitiveWithResponse": "Routes.PathParameters.PathExpansion.Explode.primitive", - "routes.PathParametersPathExpansionExplodeAsyncClient.record": "Routes.PathParameters.PathExpansion.Explode.record", - "routes.PathParametersPathExpansionExplodeAsyncClient.recordWithResponse": "Routes.PathParameters.PathExpansion.Explode.record", - "routes.PathParametersPathExpansionExplodeClient": "Routes.PathParameters.PathExpansion.Explode", - "routes.PathParametersPathExpansionExplodeClient.array": "Routes.PathParameters.PathExpansion.Explode.array", - "routes.PathParametersPathExpansionExplodeClient.arrayWithResponse": "Routes.PathParameters.PathExpansion.Explode.array", - "routes.PathParametersPathExpansionExplodeClient.primitive": "Routes.PathParameters.PathExpansion.Explode.primitive", - "routes.PathParametersPathExpansionExplodeClient.primitiveWithResponse": "Routes.PathParameters.PathExpansion.Explode.primitive", - "routes.PathParametersPathExpansionExplodeClient.record": "Routes.PathParameters.PathExpansion.Explode.record", - "routes.PathParametersPathExpansionExplodeClient.recordWithResponse": "Routes.PathParameters.PathExpansion.Explode.record", - "routes.PathParametersPathExpansionStandardAsyncClient": "Routes.PathParameters.PathExpansion.Standard", - "routes.PathParametersPathExpansionStandardAsyncClient.array": "Routes.PathParameters.PathExpansion.Standard.array", - "routes.PathParametersPathExpansionStandardAsyncClient.arrayWithResponse": "Routes.PathParameters.PathExpansion.Standard.array", - "routes.PathParametersPathExpansionStandardAsyncClient.primitive": "Routes.PathParameters.PathExpansion.Standard.primitive", - "routes.PathParametersPathExpansionStandardAsyncClient.primitiveWithResponse": "Routes.PathParameters.PathExpansion.Standard.primitive", - "routes.PathParametersPathExpansionStandardAsyncClient.record": "Routes.PathParameters.PathExpansion.Standard.record", - "routes.PathParametersPathExpansionStandardAsyncClient.recordWithResponse": "Routes.PathParameters.PathExpansion.Standard.record", - "routes.PathParametersPathExpansionStandardClient": "Routes.PathParameters.PathExpansion.Standard", - "routes.PathParametersPathExpansionStandardClient.array": "Routes.PathParameters.PathExpansion.Standard.array", - "routes.PathParametersPathExpansionStandardClient.arrayWithResponse": "Routes.PathParameters.PathExpansion.Standard.array", - "routes.PathParametersPathExpansionStandardClient.primitive": "Routes.PathParameters.PathExpansion.Standard.primitive", - "routes.PathParametersPathExpansionStandardClient.primitiveWithResponse": "Routes.PathParameters.PathExpansion.Standard.primitive", - "routes.PathParametersPathExpansionStandardClient.record": "Routes.PathParameters.PathExpansion.Standard.record", - "routes.PathParametersPathExpansionStandardClient.recordWithResponse": "Routes.PathParameters.PathExpansion.Standard.record", - "routes.PathParametersReservedExpansionAsyncClient": "Routes.PathParameters.ReservedExpansion", - "routes.PathParametersReservedExpansionAsyncClient.annotation": "Routes.PathParameters.ReservedExpansion.annotation", - "routes.PathParametersReservedExpansionAsyncClient.annotationWithResponse": "Routes.PathParameters.ReservedExpansion.annotation", - "routes.PathParametersReservedExpansionAsyncClient.template": "Routes.PathParameters.ReservedExpansion.template", - "routes.PathParametersReservedExpansionAsyncClient.templateWithResponse": "Routes.PathParameters.ReservedExpansion.template", - "routes.PathParametersReservedExpansionClient": "Routes.PathParameters.ReservedExpansion", - "routes.PathParametersReservedExpansionClient.annotation": "Routes.PathParameters.ReservedExpansion.annotation", - "routes.PathParametersReservedExpansionClient.annotationWithResponse": "Routes.PathParameters.ReservedExpansion.annotation", - "routes.PathParametersReservedExpansionClient.template": "Routes.PathParameters.ReservedExpansion.template", - "routes.PathParametersReservedExpansionClient.templateWithResponse": "Routes.PathParameters.ReservedExpansion.template", - "routes.PathParametersSimpleExpansionExplodeAsyncClient": "Routes.PathParameters.SimpleExpansion.Explode", - "routes.PathParametersSimpleExpansionExplodeAsyncClient.array": "Routes.PathParameters.SimpleExpansion.Explode.array", - "routes.PathParametersSimpleExpansionExplodeAsyncClient.arrayWithResponse": "Routes.PathParameters.SimpleExpansion.Explode.array", - "routes.PathParametersSimpleExpansionExplodeAsyncClient.primitive": "Routes.PathParameters.SimpleExpansion.Explode.primitive", - "routes.PathParametersSimpleExpansionExplodeAsyncClient.primitiveWithResponse": "Routes.PathParameters.SimpleExpansion.Explode.primitive", - "routes.PathParametersSimpleExpansionExplodeAsyncClient.record": "Routes.PathParameters.SimpleExpansion.Explode.record", - "routes.PathParametersSimpleExpansionExplodeAsyncClient.recordWithResponse": "Routes.PathParameters.SimpleExpansion.Explode.record", - "routes.PathParametersSimpleExpansionExplodeClient": "Routes.PathParameters.SimpleExpansion.Explode", - "routes.PathParametersSimpleExpansionExplodeClient.array": "Routes.PathParameters.SimpleExpansion.Explode.array", - "routes.PathParametersSimpleExpansionExplodeClient.arrayWithResponse": "Routes.PathParameters.SimpleExpansion.Explode.array", - "routes.PathParametersSimpleExpansionExplodeClient.primitive": "Routes.PathParameters.SimpleExpansion.Explode.primitive", - "routes.PathParametersSimpleExpansionExplodeClient.primitiveWithResponse": "Routes.PathParameters.SimpleExpansion.Explode.primitive", - "routes.PathParametersSimpleExpansionExplodeClient.record": "Routes.PathParameters.SimpleExpansion.Explode.record", - "routes.PathParametersSimpleExpansionExplodeClient.recordWithResponse": "Routes.PathParameters.SimpleExpansion.Explode.record", - "routes.PathParametersSimpleExpansionStandardAsyncClient": "Routes.PathParameters.SimpleExpansion.Standard", - "routes.PathParametersSimpleExpansionStandardAsyncClient.array": "Routes.PathParameters.SimpleExpansion.Standard.array", - "routes.PathParametersSimpleExpansionStandardAsyncClient.arrayWithResponse": "Routes.PathParameters.SimpleExpansion.Standard.array", - "routes.PathParametersSimpleExpansionStandardAsyncClient.primitive": "Routes.PathParameters.SimpleExpansion.Standard.primitive", - "routes.PathParametersSimpleExpansionStandardAsyncClient.primitiveWithResponse": "Routes.PathParameters.SimpleExpansion.Standard.primitive", - "routes.PathParametersSimpleExpansionStandardAsyncClient.record": "Routes.PathParameters.SimpleExpansion.Standard.record", - "routes.PathParametersSimpleExpansionStandardAsyncClient.recordWithResponse": "Routes.PathParameters.SimpleExpansion.Standard.record", - "routes.PathParametersSimpleExpansionStandardClient": "Routes.PathParameters.SimpleExpansion.Standard", - "routes.PathParametersSimpleExpansionStandardClient.array": "Routes.PathParameters.SimpleExpansion.Standard.array", - "routes.PathParametersSimpleExpansionStandardClient.arrayWithResponse": "Routes.PathParameters.SimpleExpansion.Standard.array", - "routes.PathParametersSimpleExpansionStandardClient.primitive": "Routes.PathParameters.SimpleExpansion.Standard.primitive", - "routes.PathParametersSimpleExpansionStandardClient.primitiveWithResponse": "Routes.PathParameters.SimpleExpansion.Standard.primitive", - "routes.PathParametersSimpleExpansionStandardClient.record": "Routes.PathParameters.SimpleExpansion.Standard.record", - "routes.PathParametersSimpleExpansionStandardClient.recordWithResponse": "Routes.PathParameters.SimpleExpansion.Standard.record", - "routes.QueryParametersAsyncClient": "Routes.QueryParameters", - "routes.QueryParametersAsyncClient.annotationOnly": "Routes.QueryParameters.annotationOnly", - "routes.QueryParametersAsyncClient.annotationOnlyWithResponse": "Routes.QueryParameters.annotationOnly", - "routes.QueryParametersAsyncClient.explicit": "Routes.QueryParameters.explicit", - "routes.QueryParametersAsyncClient.explicitWithResponse": "Routes.QueryParameters.explicit", - "routes.QueryParametersAsyncClient.templateOnly": "Routes.QueryParameters.templateOnly", - "routes.QueryParametersAsyncClient.templateOnlyWithResponse": "Routes.QueryParameters.templateOnly", - "routes.QueryParametersClient": "Routes.QueryParameters", - "routes.QueryParametersClient.annotationOnly": "Routes.QueryParameters.annotationOnly", - "routes.QueryParametersClient.annotationOnlyWithResponse": "Routes.QueryParameters.annotationOnly", - "routes.QueryParametersClient.explicit": "Routes.QueryParameters.explicit", - "routes.QueryParametersClient.explicitWithResponse": "Routes.QueryParameters.explicit", - "routes.QueryParametersClient.templateOnly": "Routes.QueryParameters.templateOnly", - "routes.QueryParametersClient.templateOnlyWithResponse": "Routes.QueryParameters.templateOnly", - "routes.QueryParametersQueryContinuationExplodeAsyncClient": "Routes.QueryParameters.QueryContinuation.Explode", - "routes.QueryParametersQueryContinuationExplodeAsyncClient.array": "Routes.QueryParameters.QueryContinuation.Explode.array", - "routes.QueryParametersQueryContinuationExplodeAsyncClient.arrayWithResponse": "Routes.QueryParameters.QueryContinuation.Explode.array", - "routes.QueryParametersQueryContinuationExplodeAsyncClient.primitive": "Routes.QueryParameters.QueryContinuation.Explode.primitive", - "routes.QueryParametersQueryContinuationExplodeAsyncClient.primitiveWithResponse": "Routes.QueryParameters.QueryContinuation.Explode.primitive", - "routes.QueryParametersQueryContinuationExplodeAsyncClient.record": "Routes.QueryParameters.QueryContinuation.Explode.record", - "routes.QueryParametersQueryContinuationExplodeAsyncClient.recordWithResponse": "Routes.QueryParameters.QueryContinuation.Explode.record", - "routes.QueryParametersQueryContinuationExplodeClient": "Routes.QueryParameters.QueryContinuation.Explode", - "routes.QueryParametersQueryContinuationExplodeClient.array": "Routes.QueryParameters.QueryContinuation.Explode.array", - "routes.QueryParametersQueryContinuationExplodeClient.arrayWithResponse": "Routes.QueryParameters.QueryContinuation.Explode.array", - "routes.QueryParametersQueryContinuationExplodeClient.primitive": "Routes.QueryParameters.QueryContinuation.Explode.primitive", - "routes.QueryParametersQueryContinuationExplodeClient.primitiveWithResponse": "Routes.QueryParameters.QueryContinuation.Explode.primitive", - "routes.QueryParametersQueryContinuationExplodeClient.record": "Routes.QueryParameters.QueryContinuation.Explode.record", - "routes.QueryParametersQueryContinuationExplodeClient.recordWithResponse": "Routes.QueryParameters.QueryContinuation.Explode.record", - "routes.QueryParametersQueryContinuationStandardAsyncClient": "Routes.QueryParameters.QueryContinuation.Standard", - "routes.QueryParametersQueryContinuationStandardAsyncClient.array": "Routes.QueryParameters.QueryContinuation.Standard.array", - "routes.QueryParametersQueryContinuationStandardAsyncClient.arrayWithResponse": "Routes.QueryParameters.QueryContinuation.Standard.array", - "routes.QueryParametersQueryContinuationStandardAsyncClient.primitive": "Routes.QueryParameters.QueryContinuation.Standard.primitive", - "routes.QueryParametersQueryContinuationStandardAsyncClient.primitiveWithResponse": "Routes.QueryParameters.QueryContinuation.Standard.primitive", - "routes.QueryParametersQueryContinuationStandardAsyncClient.record": "Routes.QueryParameters.QueryContinuation.Standard.record", - "routes.QueryParametersQueryContinuationStandardAsyncClient.recordWithResponse": "Routes.QueryParameters.QueryContinuation.Standard.record", - "routes.QueryParametersQueryContinuationStandardClient": "Routes.QueryParameters.QueryContinuation.Standard", - "routes.QueryParametersQueryContinuationStandardClient.array": "Routes.QueryParameters.QueryContinuation.Standard.array", - "routes.QueryParametersQueryContinuationStandardClient.arrayWithResponse": "Routes.QueryParameters.QueryContinuation.Standard.array", - "routes.QueryParametersQueryContinuationStandardClient.primitive": "Routes.QueryParameters.QueryContinuation.Standard.primitive", - "routes.QueryParametersQueryContinuationStandardClient.primitiveWithResponse": "Routes.QueryParameters.QueryContinuation.Standard.primitive", - "routes.QueryParametersQueryContinuationStandardClient.record": "Routes.QueryParameters.QueryContinuation.Standard.record", - "routes.QueryParametersQueryContinuationStandardClient.recordWithResponse": "Routes.QueryParameters.QueryContinuation.Standard.record", - "routes.QueryParametersQueryExpansionExplodeAsyncClient": "Routes.QueryParameters.QueryExpansion.Explode", - "routes.QueryParametersQueryExpansionExplodeAsyncClient.array": "Routes.QueryParameters.QueryExpansion.Explode.array", - "routes.QueryParametersQueryExpansionExplodeAsyncClient.arrayWithResponse": "Routes.QueryParameters.QueryExpansion.Explode.array", - "routes.QueryParametersQueryExpansionExplodeAsyncClient.primitive": "Routes.QueryParameters.QueryExpansion.Explode.primitive", - "routes.QueryParametersQueryExpansionExplodeAsyncClient.primitiveWithResponse": "Routes.QueryParameters.QueryExpansion.Explode.primitive", - "routes.QueryParametersQueryExpansionExplodeAsyncClient.record": "Routes.QueryParameters.QueryExpansion.Explode.record", - "routes.QueryParametersQueryExpansionExplodeAsyncClient.recordWithResponse": "Routes.QueryParameters.QueryExpansion.Explode.record", - "routes.QueryParametersQueryExpansionExplodeClient": "Routes.QueryParameters.QueryExpansion.Explode", - "routes.QueryParametersQueryExpansionExplodeClient.array": "Routes.QueryParameters.QueryExpansion.Explode.array", - "routes.QueryParametersQueryExpansionExplodeClient.arrayWithResponse": "Routes.QueryParameters.QueryExpansion.Explode.array", - "routes.QueryParametersQueryExpansionExplodeClient.primitive": "Routes.QueryParameters.QueryExpansion.Explode.primitive", - "routes.QueryParametersQueryExpansionExplodeClient.primitiveWithResponse": "Routes.QueryParameters.QueryExpansion.Explode.primitive", - "routes.QueryParametersQueryExpansionExplodeClient.record": "Routes.QueryParameters.QueryExpansion.Explode.record", - "routes.QueryParametersQueryExpansionExplodeClient.recordWithResponse": "Routes.QueryParameters.QueryExpansion.Explode.record", - "routes.QueryParametersQueryExpansionStandardAsyncClient": "Routes.QueryParameters.QueryExpansion.Standard", - "routes.QueryParametersQueryExpansionStandardAsyncClient.array": "Routes.QueryParameters.QueryExpansion.Standard.array", - "routes.QueryParametersQueryExpansionStandardAsyncClient.arrayWithResponse": "Routes.QueryParameters.QueryExpansion.Standard.array", - "routes.QueryParametersQueryExpansionStandardAsyncClient.primitive": "Routes.QueryParameters.QueryExpansion.Standard.primitive", - "routes.QueryParametersQueryExpansionStandardAsyncClient.primitiveWithResponse": "Routes.QueryParameters.QueryExpansion.Standard.primitive", - "routes.QueryParametersQueryExpansionStandardAsyncClient.record": "Routes.QueryParameters.QueryExpansion.Standard.record", - "routes.QueryParametersQueryExpansionStandardAsyncClient.recordWithResponse": "Routes.QueryParameters.QueryExpansion.Standard.record", - "routes.QueryParametersQueryExpansionStandardClient": "Routes.QueryParameters.QueryExpansion.Standard", - "routes.QueryParametersQueryExpansionStandardClient.array": "Routes.QueryParameters.QueryExpansion.Standard.array", - "routes.QueryParametersQueryExpansionStandardClient.arrayWithResponse": "Routes.QueryParameters.QueryExpansion.Standard.array", - "routes.QueryParametersQueryExpansionStandardClient.primitive": "Routes.QueryParameters.QueryExpansion.Standard.primitive", - "routes.QueryParametersQueryExpansionStandardClient.primitiveWithResponse": "Routes.QueryParameters.QueryExpansion.Standard.primitive", - "routes.QueryParametersQueryExpansionStandardClient.record": "Routes.QueryParameters.QueryExpansion.Standard.record", - "routes.QueryParametersQueryExpansionStandardClient.recordWithResponse": "Routes.QueryParameters.QueryExpansion.Standard.record", - "routes.RoutesAsyncClient": "Routes", - "routes.RoutesAsyncClient.fixed": "Routes.fixed", - "routes.RoutesAsyncClient.fixedWithResponse": "Routes.fixed", - "routes.RoutesClient": "Routes", - "routes.RoutesClient.fixed": "Routes.fixed", - "routes.RoutesClient.fixedWithResponse": "Routes.fixed", - "routes.RoutesClientBuilder": "Routes" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_metadata.json deleted file mode 100644 index 1e82f42b581..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"routes.InInterfaceAsyncClient":"Routes.InInterface","routes.InInterfaceAsyncClient.fixed":"Routes.InInterface.fixed","routes.InInterfaceAsyncClient.fixedWithResponse":"Routes.InInterface.fixed","routes.InInterfaceClient":"Routes.InInterface","routes.InInterfaceClient.fixed":"Routes.InInterface.fixed","routes.InInterfaceClient.fixedWithResponse":"Routes.InInterface.fixed","routes.PathParametersAsyncClient":"Routes.PathParameters","routes.PathParametersAsyncClient.annotationOnly":"Routes.PathParameters.annotationOnly","routes.PathParametersAsyncClient.annotationOnlyWithResponse":"Routes.PathParameters.annotationOnly","routes.PathParametersAsyncClient.explicit":"Routes.PathParameters.explicit","routes.PathParametersAsyncClient.explicitWithResponse":"Routes.PathParameters.explicit","routes.PathParametersAsyncClient.templateOnly":"Routes.PathParameters.templateOnly","routes.PathParametersAsyncClient.templateOnlyWithResponse":"Routes.PathParameters.templateOnly","routes.PathParametersClient":"Routes.PathParameters","routes.PathParametersClient.annotationOnly":"Routes.PathParameters.annotationOnly","routes.PathParametersClient.annotationOnlyWithResponse":"Routes.PathParameters.annotationOnly","routes.PathParametersClient.explicit":"Routes.PathParameters.explicit","routes.PathParametersClient.explicitWithResponse":"Routes.PathParameters.explicit","routes.PathParametersClient.templateOnly":"Routes.PathParameters.templateOnly","routes.PathParametersClient.templateOnlyWithResponse":"Routes.PathParameters.templateOnly","routes.PathParametersLabelExpansionExplodeAsyncClient":"Routes.PathParameters.LabelExpansion.Explode","routes.PathParametersLabelExpansionExplodeAsyncClient.array":"Routes.PathParameters.LabelExpansion.Explode.array","routes.PathParametersLabelExpansionExplodeAsyncClient.arrayWithResponse":"Routes.PathParameters.LabelExpansion.Explode.array","routes.PathParametersLabelExpansionExplodeAsyncClient.primitive":"Routes.PathParameters.LabelExpansion.Explode.primitive","routes.PathParametersLabelExpansionExplodeAsyncClient.primitiveWithResponse":"Routes.PathParameters.LabelExpansion.Explode.primitive","routes.PathParametersLabelExpansionExplodeAsyncClient.record":"Routes.PathParameters.LabelExpansion.Explode.record","routes.PathParametersLabelExpansionExplodeAsyncClient.recordWithResponse":"Routes.PathParameters.LabelExpansion.Explode.record","routes.PathParametersLabelExpansionExplodeClient":"Routes.PathParameters.LabelExpansion.Explode","routes.PathParametersLabelExpansionExplodeClient.array":"Routes.PathParameters.LabelExpansion.Explode.array","routes.PathParametersLabelExpansionExplodeClient.arrayWithResponse":"Routes.PathParameters.LabelExpansion.Explode.array","routes.PathParametersLabelExpansionExplodeClient.primitive":"Routes.PathParameters.LabelExpansion.Explode.primitive","routes.PathParametersLabelExpansionExplodeClient.primitiveWithResponse":"Routes.PathParameters.LabelExpansion.Explode.primitive","routes.PathParametersLabelExpansionExplodeClient.record":"Routes.PathParameters.LabelExpansion.Explode.record","routes.PathParametersLabelExpansionExplodeClient.recordWithResponse":"Routes.PathParameters.LabelExpansion.Explode.record","routes.PathParametersLabelExpansionStandardAsyncClient":"Routes.PathParameters.LabelExpansion.Standard","routes.PathParametersLabelExpansionStandardAsyncClient.array":"Routes.PathParameters.LabelExpansion.Standard.array","routes.PathParametersLabelExpansionStandardAsyncClient.arrayWithResponse":"Routes.PathParameters.LabelExpansion.Standard.array","routes.PathParametersLabelExpansionStandardAsyncClient.primitive":"Routes.PathParameters.LabelExpansion.Standard.primitive","routes.PathParametersLabelExpansionStandardAsyncClient.primitiveWithResponse":"Routes.PathParameters.LabelExpansion.Standard.primitive","routes.PathParametersLabelExpansionStandardAsyncClient.record":"Routes.PathParameters.LabelExpansion.Standard.record","routes.PathParametersLabelExpansionStandardAsyncClient.recordWithResponse":"Routes.PathParameters.LabelExpansion.Standard.record","routes.PathParametersLabelExpansionStandardClient":"Routes.PathParameters.LabelExpansion.Standard","routes.PathParametersLabelExpansionStandardClient.array":"Routes.PathParameters.LabelExpansion.Standard.array","routes.PathParametersLabelExpansionStandardClient.arrayWithResponse":"Routes.PathParameters.LabelExpansion.Standard.array","routes.PathParametersLabelExpansionStandardClient.primitive":"Routes.PathParameters.LabelExpansion.Standard.primitive","routes.PathParametersLabelExpansionStandardClient.primitiveWithResponse":"Routes.PathParameters.LabelExpansion.Standard.primitive","routes.PathParametersLabelExpansionStandardClient.record":"Routes.PathParameters.LabelExpansion.Standard.record","routes.PathParametersLabelExpansionStandardClient.recordWithResponse":"Routes.PathParameters.LabelExpansion.Standard.record","routes.PathParametersMatrixExpansionExplodeAsyncClient":"Routes.PathParameters.MatrixExpansion.Explode","routes.PathParametersMatrixExpansionExplodeAsyncClient.array":"Routes.PathParameters.MatrixExpansion.Explode.array","routes.PathParametersMatrixExpansionExplodeAsyncClient.arrayWithResponse":"Routes.PathParameters.MatrixExpansion.Explode.array","routes.PathParametersMatrixExpansionExplodeAsyncClient.primitive":"Routes.PathParameters.MatrixExpansion.Explode.primitive","routes.PathParametersMatrixExpansionExplodeAsyncClient.primitiveWithResponse":"Routes.PathParameters.MatrixExpansion.Explode.primitive","routes.PathParametersMatrixExpansionExplodeAsyncClient.record":"Routes.PathParameters.MatrixExpansion.Explode.record","routes.PathParametersMatrixExpansionExplodeAsyncClient.recordWithResponse":"Routes.PathParameters.MatrixExpansion.Explode.record","routes.PathParametersMatrixExpansionExplodeClient":"Routes.PathParameters.MatrixExpansion.Explode","routes.PathParametersMatrixExpansionExplodeClient.array":"Routes.PathParameters.MatrixExpansion.Explode.array","routes.PathParametersMatrixExpansionExplodeClient.arrayWithResponse":"Routes.PathParameters.MatrixExpansion.Explode.array","routes.PathParametersMatrixExpansionExplodeClient.primitive":"Routes.PathParameters.MatrixExpansion.Explode.primitive","routes.PathParametersMatrixExpansionExplodeClient.primitiveWithResponse":"Routes.PathParameters.MatrixExpansion.Explode.primitive","routes.PathParametersMatrixExpansionExplodeClient.record":"Routes.PathParameters.MatrixExpansion.Explode.record","routes.PathParametersMatrixExpansionExplodeClient.recordWithResponse":"Routes.PathParameters.MatrixExpansion.Explode.record","routes.PathParametersMatrixExpansionStandardAsyncClient":"Routes.PathParameters.MatrixExpansion.Standard","routes.PathParametersMatrixExpansionStandardAsyncClient.array":"Routes.PathParameters.MatrixExpansion.Standard.array","routes.PathParametersMatrixExpansionStandardAsyncClient.arrayWithResponse":"Routes.PathParameters.MatrixExpansion.Standard.array","routes.PathParametersMatrixExpansionStandardAsyncClient.primitive":"Routes.PathParameters.MatrixExpansion.Standard.primitive","routes.PathParametersMatrixExpansionStandardAsyncClient.primitiveWithResponse":"Routes.PathParameters.MatrixExpansion.Standard.primitive","routes.PathParametersMatrixExpansionStandardAsyncClient.record":"Routes.PathParameters.MatrixExpansion.Standard.record","routes.PathParametersMatrixExpansionStandardAsyncClient.recordWithResponse":"Routes.PathParameters.MatrixExpansion.Standard.record","routes.PathParametersMatrixExpansionStandardClient":"Routes.PathParameters.MatrixExpansion.Standard","routes.PathParametersMatrixExpansionStandardClient.array":"Routes.PathParameters.MatrixExpansion.Standard.array","routes.PathParametersMatrixExpansionStandardClient.arrayWithResponse":"Routes.PathParameters.MatrixExpansion.Standard.array","routes.PathParametersMatrixExpansionStandardClient.primitive":"Routes.PathParameters.MatrixExpansion.Standard.primitive","routes.PathParametersMatrixExpansionStandardClient.primitiveWithResponse":"Routes.PathParameters.MatrixExpansion.Standard.primitive","routes.PathParametersMatrixExpansionStandardClient.record":"Routes.PathParameters.MatrixExpansion.Standard.record","routes.PathParametersMatrixExpansionStandardClient.recordWithResponse":"Routes.PathParameters.MatrixExpansion.Standard.record","routes.PathParametersPathExpansionExplodeAsyncClient":"Routes.PathParameters.PathExpansion.Explode","routes.PathParametersPathExpansionExplodeAsyncClient.array":"Routes.PathParameters.PathExpansion.Explode.array","routes.PathParametersPathExpansionExplodeAsyncClient.arrayWithResponse":"Routes.PathParameters.PathExpansion.Explode.array","routes.PathParametersPathExpansionExplodeAsyncClient.primitive":"Routes.PathParameters.PathExpansion.Explode.primitive","routes.PathParametersPathExpansionExplodeAsyncClient.primitiveWithResponse":"Routes.PathParameters.PathExpansion.Explode.primitive","routes.PathParametersPathExpansionExplodeAsyncClient.record":"Routes.PathParameters.PathExpansion.Explode.record","routes.PathParametersPathExpansionExplodeAsyncClient.recordWithResponse":"Routes.PathParameters.PathExpansion.Explode.record","routes.PathParametersPathExpansionExplodeClient":"Routes.PathParameters.PathExpansion.Explode","routes.PathParametersPathExpansionExplodeClient.array":"Routes.PathParameters.PathExpansion.Explode.array","routes.PathParametersPathExpansionExplodeClient.arrayWithResponse":"Routes.PathParameters.PathExpansion.Explode.array","routes.PathParametersPathExpansionExplodeClient.primitive":"Routes.PathParameters.PathExpansion.Explode.primitive","routes.PathParametersPathExpansionExplodeClient.primitiveWithResponse":"Routes.PathParameters.PathExpansion.Explode.primitive","routes.PathParametersPathExpansionExplodeClient.record":"Routes.PathParameters.PathExpansion.Explode.record","routes.PathParametersPathExpansionExplodeClient.recordWithResponse":"Routes.PathParameters.PathExpansion.Explode.record","routes.PathParametersPathExpansionStandardAsyncClient":"Routes.PathParameters.PathExpansion.Standard","routes.PathParametersPathExpansionStandardAsyncClient.array":"Routes.PathParameters.PathExpansion.Standard.array","routes.PathParametersPathExpansionStandardAsyncClient.arrayWithResponse":"Routes.PathParameters.PathExpansion.Standard.array","routes.PathParametersPathExpansionStandardAsyncClient.primitive":"Routes.PathParameters.PathExpansion.Standard.primitive","routes.PathParametersPathExpansionStandardAsyncClient.primitiveWithResponse":"Routes.PathParameters.PathExpansion.Standard.primitive","routes.PathParametersPathExpansionStandardAsyncClient.record":"Routes.PathParameters.PathExpansion.Standard.record","routes.PathParametersPathExpansionStandardAsyncClient.recordWithResponse":"Routes.PathParameters.PathExpansion.Standard.record","routes.PathParametersPathExpansionStandardClient":"Routes.PathParameters.PathExpansion.Standard","routes.PathParametersPathExpansionStandardClient.array":"Routes.PathParameters.PathExpansion.Standard.array","routes.PathParametersPathExpansionStandardClient.arrayWithResponse":"Routes.PathParameters.PathExpansion.Standard.array","routes.PathParametersPathExpansionStandardClient.primitive":"Routes.PathParameters.PathExpansion.Standard.primitive","routes.PathParametersPathExpansionStandardClient.primitiveWithResponse":"Routes.PathParameters.PathExpansion.Standard.primitive","routes.PathParametersPathExpansionStandardClient.record":"Routes.PathParameters.PathExpansion.Standard.record","routes.PathParametersPathExpansionStandardClient.recordWithResponse":"Routes.PathParameters.PathExpansion.Standard.record","routes.PathParametersReservedExpansionAsyncClient":"Routes.PathParameters.ReservedExpansion","routes.PathParametersReservedExpansionAsyncClient.annotation":"Routes.PathParameters.ReservedExpansion.annotation","routes.PathParametersReservedExpansionAsyncClient.annotationWithResponse":"Routes.PathParameters.ReservedExpansion.annotation","routes.PathParametersReservedExpansionAsyncClient.template":"Routes.PathParameters.ReservedExpansion.template","routes.PathParametersReservedExpansionAsyncClient.templateWithResponse":"Routes.PathParameters.ReservedExpansion.template","routes.PathParametersReservedExpansionClient":"Routes.PathParameters.ReservedExpansion","routes.PathParametersReservedExpansionClient.annotation":"Routes.PathParameters.ReservedExpansion.annotation","routes.PathParametersReservedExpansionClient.annotationWithResponse":"Routes.PathParameters.ReservedExpansion.annotation","routes.PathParametersReservedExpansionClient.template":"Routes.PathParameters.ReservedExpansion.template","routes.PathParametersReservedExpansionClient.templateWithResponse":"Routes.PathParameters.ReservedExpansion.template","routes.PathParametersSimpleExpansionExplodeAsyncClient":"Routes.PathParameters.SimpleExpansion.Explode","routes.PathParametersSimpleExpansionExplodeAsyncClient.array":"Routes.PathParameters.SimpleExpansion.Explode.array","routes.PathParametersSimpleExpansionExplodeAsyncClient.arrayWithResponse":"Routes.PathParameters.SimpleExpansion.Explode.array","routes.PathParametersSimpleExpansionExplodeAsyncClient.primitive":"Routes.PathParameters.SimpleExpansion.Explode.primitive","routes.PathParametersSimpleExpansionExplodeAsyncClient.primitiveWithResponse":"Routes.PathParameters.SimpleExpansion.Explode.primitive","routes.PathParametersSimpleExpansionExplodeAsyncClient.record":"Routes.PathParameters.SimpleExpansion.Explode.record","routes.PathParametersSimpleExpansionExplodeAsyncClient.recordWithResponse":"Routes.PathParameters.SimpleExpansion.Explode.record","routes.PathParametersSimpleExpansionExplodeClient":"Routes.PathParameters.SimpleExpansion.Explode","routes.PathParametersSimpleExpansionExplodeClient.array":"Routes.PathParameters.SimpleExpansion.Explode.array","routes.PathParametersSimpleExpansionExplodeClient.arrayWithResponse":"Routes.PathParameters.SimpleExpansion.Explode.array","routes.PathParametersSimpleExpansionExplodeClient.primitive":"Routes.PathParameters.SimpleExpansion.Explode.primitive","routes.PathParametersSimpleExpansionExplodeClient.primitiveWithResponse":"Routes.PathParameters.SimpleExpansion.Explode.primitive","routes.PathParametersSimpleExpansionExplodeClient.record":"Routes.PathParameters.SimpleExpansion.Explode.record","routes.PathParametersSimpleExpansionExplodeClient.recordWithResponse":"Routes.PathParameters.SimpleExpansion.Explode.record","routes.PathParametersSimpleExpansionStandardAsyncClient":"Routes.PathParameters.SimpleExpansion.Standard","routes.PathParametersSimpleExpansionStandardAsyncClient.array":"Routes.PathParameters.SimpleExpansion.Standard.array","routes.PathParametersSimpleExpansionStandardAsyncClient.arrayWithResponse":"Routes.PathParameters.SimpleExpansion.Standard.array","routes.PathParametersSimpleExpansionStandardAsyncClient.primitive":"Routes.PathParameters.SimpleExpansion.Standard.primitive","routes.PathParametersSimpleExpansionStandardAsyncClient.primitiveWithResponse":"Routes.PathParameters.SimpleExpansion.Standard.primitive","routes.PathParametersSimpleExpansionStandardAsyncClient.record":"Routes.PathParameters.SimpleExpansion.Standard.record","routes.PathParametersSimpleExpansionStandardAsyncClient.recordWithResponse":"Routes.PathParameters.SimpleExpansion.Standard.record","routes.PathParametersSimpleExpansionStandardClient":"Routes.PathParameters.SimpleExpansion.Standard","routes.PathParametersSimpleExpansionStandardClient.array":"Routes.PathParameters.SimpleExpansion.Standard.array","routes.PathParametersSimpleExpansionStandardClient.arrayWithResponse":"Routes.PathParameters.SimpleExpansion.Standard.array","routes.PathParametersSimpleExpansionStandardClient.primitive":"Routes.PathParameters.SimpleExpansion.Standard.primitive","routes.PathParametersSimpleExpansionStandardClient.primitiveWithResponse":"Routes.PathParameters.SimpleExpansion.Standard.primitive","routes.PathParametersSimpleExpansionStandardClient.record":"Routes.PathParameters.SimpleExpansion.Standard.record","routes.PathParametersSimpleExpansionStandardClient.recordWithResponse":"Routes.PathParameters.SimpleExpansion.Standard.record","routes.QueryParametersAsyncClient":"Routes.QueryParameters","routes.QueryParametersAsyncClient.annotationOnly":"Routes.QueryParameters.annotationOnly","routes.QueryParametersAsyncClient.annotationOnlyWithResponse":"Routes.QueryParameters.annotationOnly","routes.QueryParametersAsyncClient.explicit":"Routes.QueryParameters.explicit","routes.QueryParametersAsyncClient.explicitWithResponse":"Routes.QueryParameters.explicit","routes.QueryParametersAsyncClient.templateOnly":"Routes.QueryParameters.templateOnly","routes.QueryParametersAsyncClient.templateOnlyWithResponse":"Routes.QueryParameters.templateOnly","routes.QueryParametersClient":"Routes.QueryParameters","routes.QueryParametersClient.annotationOnly":"Routes.QueryParameters.annotationOnly","routes.QueryParametersClient.annotationOnlyWithResponse":"Routes.QueryParameters.annotationOnly","routes.QueryParametersClient.explicit":"Routes.QueryParameters.explicit","routes.QueryParametersClient.explicitWithResponse":"Routes.QueryParameters.explicit","routes.QueryParametersClient.templateOnly":"Routes.QueryParameters.templateOnly","routes.QueryParametersClient.templateOnlyWithResponse":"Routes.QueryParameters.templateOnly","routes.QueryParametersQueryContinuationExplodeAsyncClient":"Routes.QueryParameters.QueryContinuation.Explode","routes.QueryParametersQueryContinuationExplodeAsyncClient.array":"Routes.QueryParameters.QueryContinuation.Explode.array","routes.QueryParametersQueryContinuationExplodeAsyncClient.arrayWithResponse":"Routes.QueryParameters.QueryContinuation.Explode.array","routes.QueryParametersQueryContinuationExplodeAsyncClient.primitive":"Routes.QueryParameters.QueryContinuation.Explode.primitive","routes.QueryParametersQueryContinuationExplodeAsyncClient.primitiveWithResponse":"Routes.QueryParameters.QueryContinuation.Explode.primitive","routes.QueryParametersQueryContinuationExplodeAsyncClient.record":"Routes.QueryParameters.QueryContinuation.Explode.record","routes.QueryParametersQueryContinuationExplodeAsyncClient.recordWithResponse":"Routes.QueryParameters.QueryContinuation.Explode.record","routes.QueryParametersQueryContinuationExplodeClient":"Routes.QueryParameters.QueryContinuation.Explode","routes.QueryParametersQueryContinuationExplodeClient.array":"Routes.QueryParameters.QueryContinuation.Explode.array","routes.QueryParametersQueryContinuationExplodeClient.arrayWithResponse":"Routes.QueryParameters.QueryContinuation.Explode.array","routes.QueryParametersQueryContinuationExplodeClient.primitive":"Routes.QueryParameters.QueryContinuation.Explode.primitive","routes.QueryParametersQueryContinuationExplodeClient.primitiveWithResponse":"Routes.QueryParameters.QueryContinuation.Explode.primitive","routes.QueryParametersQueryContinuationExplodeClient.record":"Routes.QueryParameters.QueryContinuation.Explode.record","routes.QueryParametersQueryContinuationExplodeClient.recordWithResponse":"Routes.QueryParameters.QueryContinuation.Explode.record","routes.QueryParametersQueryContinuationStandardAsyncClient":"Routes.QueryParameters.QueryContinuation.Standard","routes.QueryParametersQueryContinuationStandardAsyncClient.array":"Routes.QueryParameters.QueryContinuation.Standard.array","routes.QueryParametersQueryContinuationStandardAsyncClient.arrayWithResponse":"Routes.QueryParameters.QueryContinuation.Standard.array","routes.QueryParametersQueryContinuationStandardAsyncClient.primitive":"Routes.QueryParameters.QueryContinuation.Standard.primitive","routes.QueryParametersQueryContinuationStandardAsyncClient.primitiveWithResponse":"Routes.QueryParameters.QueryContinuation.Standard.primitive","routes.QueryParametersQueryContinuationStandardAsyncClient.record":"Routes.QueryParameters.QueryContinuation.Standard.record","routes.QueryParametersQueryContinuationStandardAsyncClient.recordWithResponse":"Routes.QueryParameters.QueryContinuation.Standard.record","routes.QueryParametersQueryContinuationStandardClient":"Routes.QueryParameters.QueryContinuation.Standard","routes.QueryParametersQueryContinuationStandardClient.array":"Routes.QueryParameters.QueryContinuation.Standard.array","routes.QueryParametersQueryContinuationStandardClient.arrayWithResponse":"Routes.QueryParameters.QueryContinuation.Standard.array","routes.QueryParametersQueryContinuationStandardClient.primitive":"Routes.QueryParameters.QueryContinuation.Standard.primitive","routes.QueryParametersQueryContinuationStandardClient.primitiveWithResponse":"Routes.QueryParameters.QueryContinuation.Standard.primitive","routes.QueryParametersQueryContinuationStandardClient.record":"Routes.QueryParameters.QueryContinuation.Standard.record","routes.QueryParametersQueryContinuationStandardClient.recordWithResponse":"Routes.QueryParameters.QueryContinuation.Standard.record","routes.QueryParametersQueryExpansionExplodeAsyncClient":"Routes.QueryParameters.QueryExpansion.Explode","routes.QueryParametersQueryExpansionExplodeAsyncClient.array":"Routes.QueryParameters.QueryExpansion.Explode.array","routes.QueryParametersQueryExpansionExplodeAsyncClient.arrayWithResponse":"Routes.QueryParameters.QueryExpansion.Explode.array","routes.QueryParametersQueryExpansionExplodeAsyncClient.primitive":"Routes.QueryParameters.QueryExpansion.Explode.primitive","routes.QueryParametersQueryExpansionExplodeAsyncClient.primitiveWithResponse":"Routes.QueryParameters.QueryExpansion.Explode.primitive","routes.QueryParametersQueryExpansionExplodeAsyncClient.record":"Routes.QueryParameters.QueryExpansion.Explode.record","routes.QueryParametersQueryExpansionExplodeAsyncClient.recordWithResponse":"Routes.QueryParameters.QueryExpansion.Explode.record","routes.QueryParametersQueryExpansionExplodeClient":"Routes.QueryParameters.QueryExpansion.Explode","routes.QueryParametersQueryExpansionExplodeClient.array":"Routes.QueryParameters.QueryExpansion.Explode.array","routes.QueryParametersQueryExpansionExplodeClient.arrayWithResponse":"Routes.QueryParameters.QueryExpansion.Explode.array","routes.QueryParametersQueryExpansionExplodeClient.primitive":"Routes.QueryParameters.QueryExpansion.Explode.primitive","routes.QueryParametersQueryExpansionExplodeClient.primitiveWithResponse":"Routes.QueryParameters.QueryExpansion.Explode.primitive","routes.QueryParametersQueryExpansionExplodeClient.record":"Routes.QueryParameters.QueryExpansion.Explode.record","routes.QueryParametersQueryExpansionExplodeClient.recordWithResponse":"Routes.QueryParameters.QueryExpansion.Explode.record","routes.QueryParametersQueryExpansionStandardAsyncClient":"Routes.QueryParameters.QueryExpansion.Standard","routes.QueryParametersQueryExpansionStandardAsyncClient.array":"Routes.QueryParameters.QueryExpansion.Standard.array","routes.QueryParametersQueryExpansionStandardAsyncClient.arrayWithResponse":"Routes.QueryParameters.QueryExpansion.Standard.array","routes.QueryParametersQueryExpansionStandardAsyncClient.primitive":"Routes.QueryParameters.QueryExpansion.Standard.primitive","routes.QueryParametersQueryExpansionStandardAsyncClient.primitiveWithResponse":"Routes.QueryParameters.QueryExpansion.Standard.primitive","routes.QueryParametersQueryExpansionStandardAsyncClient.record":"Routes.QueryParameters.QueryExpansion.Standard.record","routes.QueryParametersQueryExpansionStandardAsyncClient.recordWithResponse":"Routes.QueryParameters.QueryExpansion.Standard.record","routes.QueryParametersQueryExpansionStandardClient":"Routes.QueryParameters.QueryExpansion.Standard","routes.QueryParametersQueryExpansionStandardClient.array":"Routes.QueryParameters.QueryExpansion.Standard.array","routes.QueryParametersQueryExpansionStandardClient.arrayWithResponse":"Routes.QueryParameters.QueryExpansion.Standard.array","routes.QueryParametersQueryExpansionStandardClient.primitive":"Routes.QueryParameters.QueryExpansion.Standard.primitive","routes.QueryParametersQueryExpansionStandardClient.primitiveWithResponse":"Routes.QueryParameters.QueryExpansion.Standard.primitive","routes.QueryParametersQueryExpansionStandardClient.record":"Routes.QueryParameters.QueryExpansion.Standard.record","routes.QueryParametersQueryExpansionStandardClient.recordWithResponse":"Routes.QueryParameters.QueryExpansion.Standard.record","routes.RoutesAsyncClient":"Routes","routes.RoutesAsyncClient.fixed":"Routes.fixed","routes.RoutesAsyncClient.fixedWithResponse":"Routes.fixed","routes.RoutesClient":"Routes","routes.RoutesClient.fixed":"Routes.fixed","routes.RoutesClient.fixedWithResponse":"Routes.fixed","routes.RoutesClientBuilder":"Routes"},"generatedFiles":["src/main/java/module-info.java","src/main/java/routes/InInterfaceAsyncClient.java","src/main/java/routes/InInterfaceClient.java","src/main/java/routes/PathParametersAsyncClient.java","src/main/java/routes/PathParametersClient.java","src/main/java/routes/PathParametersLabelExpansionExplodeAsyncClient.java","src/main/java/routes/PathParametersLabelExpansionExplodeClient.java","src/main/java/routes/PathParametersLabelExpansionStandardAsyncClient.java","src/main/java/routes/PathParametersLabelExpansionStandardClient.java","src/main/java/routes/PathParametersMatrixExpansionExplodeAsyncClient.java","src/main/java/routes/PathParametersMatrixExpansionExplodeClient.java","src/main/java/routes/PathParametersMatrixExpansionStandardAsyncClient.java","src/main/java/routes/PathParametersMatrixExpansionStandardClient.java","src/main/java/routes/PathParametersPathExpansionExplodeAsyncClient.java","src/main/java/routes/PathParametersPathExpansionExplodeClient.java","src/main/java/routes/PathParametersPathExpansionStandardAsyncClient.java","src/main/java/routes/PathParametersPathExpansionStandardClient.java","src/main/java/routes/PathParametersReservedExpansionAsyncClient.java","src/main/java/routes/PathParametersReservedExpansionClient.java","src/main/java/routes/PathParametersSimpleExpansionExplodeAsyncClient.java","src/main/java/routes/PathParametersSimpleExpansionExplodeClient.java","src/main/java/routes/PathParametersSimpleExpansionStandardAsyncClient.java","src/main/java/routes/PathParametersSimpleExpansionStandardClient.java","src/main/java/routes/QueryParametersAsyncClient.java","src/main/java/routes/QueryParametersClient.java","src/main/java/routes/QueryParametersQueryContinuationExplodeAsyncClient.java","src/main/java/routes/QueryParametersQueryContinuationExplodeClient.java","src/main/java/routes/QueryParametersQueryContinuationStandardAsyncClient.java","src/main/java/routes/QueryParametersQueryContinuationStandardClient.java","src/main/java/routes/QueryParametersQueryExpansionExplodeAsyncClient.java","src/main/java/routes/QueryParametersQueryExpansionExplodeClient.java","src/main/java/routes/QueryParametersQueryExpansionStandardAsyncClient.java","src/main/java/routes/QueryParametersQueryExpansionStandardClient.java","src/main/java/routes/RoutesAsyncClient.java","src/main/java/routes/RoutesClient.java","src/main/java/routes/RoutesClientBuilder.java","src/main/java/routes/implementation/InInterfacesImpl.java","src/main/java/routes/implementation/PathParametersImpl.java","src/main/java/routes/implementation/PathParametersLabelExpansionExplodesImpl.java","src/main/java/routes/implementation/PathParametersLabelExpansionStandardsImpl.java","src/main/java/routes/implementation/PathParametersMatrixExpansionExplodesImpl.java","src/main/java/routes/implementation/PathParametersMatrixExpansionStandardsImpl.java","src/main/java/routes/implementation/PathParametersPathExpansionExplodesImpl.java","src/main/java/routes/implementation/PathParametersPathExpansionStandardsImpl.java","src/main/java/routes/implementation/PathParametersReservedExpansionsImpl.java","src/main/java/routes/implementation/PathParametersSimpleExpansionExplodesImpl.java","src/main/java/routes/implementation/PathParametersSimpleExpansionStandardsImpl.java","src/main/java/routes/implementation/QueryParametersImpl.java","src/main/java/routes/implementation/QueryParametersQueryContinuationExplodesImpl.java","src/main/java/routes/implementation/QueryParametersQueryContinuationStandardsImpl.java","src/main/java/routes/implementation/QueryParametersQueryExpansionExplodesImpl.java","src/main/java/routes/implementation/QueryParametersQueryExpansionStandardsImpl.java","src/main/java/routes/implementation/RoutesClientImpl.java","src/main/java/routes/implementation/package-info.java","src/main/java/routes/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_apiview_properties.json deleted file mode 100644 index 92d2b385806..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_apiview_properties.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "serialization.encodedname.json.JsonAsyncClient": "Serialization.EncodedName.Json.Property", - "serialization.encodedname.json.JsonAsyncClient.get": "Serialization.EncodedName.Json.Property.get", - "serialization.encodedname.json.JsonAsyncClient.getWithResponse": "Serialization.EncodedName.Json.Property.get", - "serialization.encodedname.json.JsonAsyncClient.send": "Serialization.EncodedName.Json.Property.send", - "serialization.encodedname.json.JsonAsyncClient.sendWithResponse": "Serialization.EncodedName.Json.Property.send", - "serialization.encodedname.json.JsonClient": "Serialization.EncodedName.Json.Property", - "serialization.encodedname.json.JsonClient.get": "Serialization.EncodedName.Json.Property.get", - "serialization.encodedname.json.JsonClient.getWithResponse": "Serialization.EncodedName.Json.Property.get", - "serialization.encodedname.json.JsonClient.send": "Serialization.EncodedName.Json.Property.send", - "serialization.encodedname.json.JsonClient.sendWithResponse": "Serialization.EncodedName.Json.Property.send", - "serialization.encodedname.json.JsonClientBuilder": "Serialization.EncodedName.Json", - "serialization.encodedname.json.property.models.JsonEncodedNameModel": "Serialization.EncodedName.Json.Property.JsonEncodedNameModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_metadata.json deleted file mode 100644 index bbcad97db1a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"serialization.encodedname.json.JsonAsyncClient":"Serialization.EncodedName.Json.Property","serialization.encodedname.json.JsonAsyncClient.get":"Serialization.EncodedName.Json.Property.get","serialization.encodedname.json.JsonAsyncClient.getWithResponse":"Serialization.EncodedName.Json.Property.get","serialization.encodedname.json.JsonAsyncClient.send":"Serialization.EncodedName.Json.Property.send","serialization.encodedname.json.JsonAsyncClient.sendWithResponse":"Serialization.EncodedName.Json.Property.send","serialization.encodedname.json.JsonClient":"Serialization.EncodedName.Json.Property","serialization.encodedname.json.JsonClient.get":"Serialization.EncodedName.Json.Property.get","serialization.encodedname.json.JsonClient.getWithResponse":"Serialization.EncodedName.Json.Property.get","serialization.encodedname.json.JsonClient.send":"Serialization.EncodedName.Json.Property.send","serialization.encodedname.json.JsonClient.sendWithResponse":"Serialization.EncodedName.Json.Property.send","serialization.encodedname.json.JsonClientBuilder":"Serialization.EncodedName.Json","serialization.encodedname.json.property.models.JsonEncodedNameModel":"Serialization.EncodedName.Json.Property.JsonEncodedNameModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/serialization/encodedname/json/JsonAsyncClient.java","src/main/java/serialization/encodedname/json/JsonClient.java","src/main/java/serialization/encodedname/json/JsonClientBuilder.java","src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java","src/main/java/serialization/encodedname/json/implementation/PropertiesImpl.java","src/main/java/serialization/encodedname/json/implementation/package-info.java","src/main/java/serialization/encodedname/json/package-info.java","src/main/java/serialization/encodedname/json/property/models/JsonEncodedNameModel.java","src/main/java/serialization/encodedname/json/property/models/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_apiview_properties.json deleted file mode 100644 index eaeafddebd3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_apiview_properties.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "server.endpoint.notdefined.NotDefinedAsyncClient": "Server.Endpoint.NotDefined", - "server.endpoint.notdefined.NotDefinedAsyncClient.valid": "Server.Endpoint.NotDefined.valid", - "server.endpoint.notdefined.NotDefinedAsyncClient.validWithResponse": "Server.Endpoint.NotDefined.valid", - "server.endpoint.notdefined.NotDefinedClient": "Server.Endpoint.NotDefined", - "server.endpoint.notdefined.NotDefinedClient.valid": "Server.Endpoint.NotDefined.valid", - "server.endpoint.notdefined.NotDefinedClient.validWithResponse": "Server.Endpoint.NotDefined.valid", - "server.endpoint.notdefined.NotDefinedClientBuilder": "Server.Endpoint.NotDefined" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_metadata.json deleted file mode 100644 index eda20fc720a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"server.endpoint.notdefined.NotDefinedAsyncClient":"Server.Endpoint.NotDefined","server.endpoint.notdefined.NotDefinedAsyncClient.valid":"Server.Endpoint.NotDefined.valid","server.endpoint.notdefined.NotDefinedAsyncClient.validWithResponse":"Server.Endpoint.NotDefined.valid","server.endpoint.notdefined.NotDefinedClient":"Server.Endpoint.NotDefined","server.endpoint.notdefined.NotDefinedClient.valid":"Server.Endpoint.NotDefined.valid","server.endpoint.notdefined.NotDefinedClient.validWithResponse":"Server.Endpoint.NotDefined.valid","server.endpoint.notdefined.NotDefinedClientBuilder":"Server.Endpoint.NotDefined"},"generatedFiles":["src/main/java/module-info.java","src/main/java/server/endpoint/notdefined/NotDefinedAsyncClient.java","src/main/java/server/endpoint/notdefined/NotDefinedClient.java","src/main/java/server/endpoint/notdefined/NotDefinedClientBuilder.java","src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java","src/main/java/server/endpoint/notdefined/implementation/package-info.java","src/main/java/server/endpoint/notdefined/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_apiview_properties.json deleted file mode 100644 index 354265e93d4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_apiview_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "server.path.multiple.MultipleAsyncClient": "Server.Path.Multiple", - "server.path.multiple.MultipleAsyncClient.noOperationParams": "Server.Path.Multiple.noOperationParams", - "server.path.multiple.MultipleAsyncClient.noOperationParamsWithResponse": "Server.Path.Multiple.noOperationParams", - "server.path.multiple.MultipleAsyncClient.withOperationPathParam": "Server.Path.Multiple.withOperationPathParam", - "server.path.multiple.MultipleAsyncClient.withOperationPathParamWithResponse": "Server.Path.Multiple.withOperationPathParam", - "server.path.multiple.MultipleClient": "Server.Path.Multiple", - "server.path.multiple.MultipleClient.noOperationParams": "Server.Path.Multiple.noOperationParams", - "server.path.multiple.MultipleClient.noOperationParamsWithResponse": "Server.Path.Multiple.noOperationParams", - "server.path.multiple.MultipleClient.withOperationPathParam": "Server.Path.Multiple.withOperationPathParam", - "server.path.multiple.MultipleClient.withOperationPathParamWithResponse": "Server.Path.Multiple.withOperationPathParam", - "server.path.multiple.MultipleClientBuilder": "Server.Path.Multiple" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_metadata.json deleted file mode 100644 index 24c2aa4f6d0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"v1.0","crossLanguageDefinitions":{"server.path.multiple.MultipleAsyncClient":"Server.Path.Multiple","server.path.multiple.MultipleAsyncClient.noOperationParams":"Server.Path.Multiple.noOperationParams","server.path.multiple.MultipleAsyncClient.noOperationParamsWithResponse":"Server.Path.Multiple.noOperationParams","server.path.multiple.MultipleAsyncClient.withOperationPathParam":"Server.Path.Multiple.withOperationPathParam","server.path.multiple.MultipleAsyncClient.withOperationPathParamWithResponse":"Server.Path.Multiple.withOperationPathParam","server.path.multiple.MultipleClient":"Server.Path.Multiple","server.path.multiple.MultipleClient.noOperationParams":"Server.Path.Multiple.noOperationParams","server.path.multiple.MultipleClient.noOperationParamsWithResponse":"Server.Path.Multiple.noOperationParams","server.path.multiple.MultipleClient.withOperationPathParam":"Server.Path.Multiple.withOperationPathParam","server.path.multiple.MultipleClient.withOperationPathParamWithResponse":"Server.Path.Multiple.withOperationPathParam","server.path.multiple.MultipleClientBuilder":"Server.Path.Multiple"},"generatedFiles":["src/main/java/module-info.java","src/main/java/server/path/multiple/MultipleAsyncClient.java","src/main/java/server/path/multiple/MultipleClient.java","src/main/java/server/path/multiple/MultipleClientBuilder.java","src/main/java/server/path/multiple/MultipleServiceVersion.java","src/main/java/server/path/multiple/implementation/MultipleClientImpl.java","src/main/java/server/path/multiple/implementation/package-info.java","src/main/java/server/path/multiple/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_apiview_properties.json deleted file mode 100644 index a15da207d9f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_apiview_properties.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "server.path.single.SingleAsyncClient": "Server.Path.Single", - "server.path.single.SingleAsyncClient.myOp": "Server.Path.Single.myOp", - "server.path.single.SingleAsyncClient.myOpWithResponse": "Server.Path.Single.myOp", - "server.path.single.SingleClient": "Server.Path.Single", - "server.path.single.SingleClient.myOp": "Server.Path.Single.myOp", - "server.path.single.SingleClient.myOpWithResponse": "Server.Path.Single.myOp", - "server.path.single.SingleClientBuilder": "Server.Path.Single" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_metadata.json deleted file mode 100644 index 41b5ee625b3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"server.path.single.SingleAsyncClient":"Server.Path.Single","server.path.single.SingleAsyncClient.myOp":"Server.Path.Single.myOp","server.path.single.SingleAsyncClient.myOpWithResponse":"Server.Path.Single.myOp","server.path.single.SingleClient":"Server.Path.Single","server.path.single.SingleClient.myOp":"Server.Path.Single.myOp","server.path.single.SingleClient.myOpWithResponse":"Server.Path.Single.myOp","server.path.single.SingleClientBuilder":"Server.Path.Single"},"generatedFiles":["src/main/java/module-info.java","src/main/java/server/path/single/SingleAsyncClient.java","src/main/java/server/path/single/SingleClient.java","src/main/java/server/path/single/SingleClientBuilder.java","src/main/java/server/path/single/implementation/SingleClientImpl.java","src/main/java/server/path/single/implementation/package-info.java","src/main/java/server/path/single/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_apiview_properties.json deleted file mode 100644 index 7e8c0612518..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_apiview_properties.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "server.versions.notversioned.NotVersionedAsyncClient": "Server.Versions.NotVersioned", - "server.versions.notversioned.NotVersionedAsyncClient.withPathApiVersion": "Server.Versions.NotVersioned.withPathApiVersion", - "server.versions.notversioned.NotVersionedAsyncClient.withPathApiVersionWithResponse": "Server.Versions.NotVersioned.withPathApiVersion", - "server.versions.notversioned.NotVersionedAsyncClient.withQueryApiVersion": "Server.Versions.NotVersioned.withQueryApiVersion", - "server.versions.notversioned.NotVersionedAsyncClient.withQueryApiVersionWithResponse": "Server.Versions.NotVersioned.withQueryApiVersion", - "server.versions.notversioned.NotVersionedAsyncClient.withoutApiVersion": "Server.Versions.NotVersioned.withoutApiVersion", - "server.versions.notversioned.NotVersionedAsyncClient.withoutApiVersionWithResponse": "Server.Versions.NotVersioned.withoutApiVersion", - "server.versions.notversioned.NotVersionedClient": "Server.Versions.NotVersioned", - "server.versions.notversioned.NotVersionedClient.withPathApiVersion": "Server.Versions.NotVersioned.withPathApiVersion", - "server.versions.notversioned.NotVersionedClient.withPathApiVersionWithResponse": "Server.Versions.NotVersioned.withPathApiVersion", - "server.versions.notversioned.NotVersionedClient.withQueryApiVersion": "Server.Versions.NotVersioned.withQueryApiVersion", - "server.versions.notversioned.NotVersionedClient.withQueryApiVersionWithResponse": "Server.Versions.NotVersioned.withQueryApiVersion", - "server.versions.notversioned.NotVersionedClient.withoutApiVersion": "Server.Versions.NotVersioned.withoutApiVersion", - "server.versions.notversioned.NotVersionedClient.withoutApiVersionWithResponse": "Server.Versions.NotVersioned.withoutApiVersion", - "server.versions.notversioned.NotVersionedClientBuilder": "Server.Versions.NotVersioned" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_metadata.json deleted file mode 100644 index 1e7846fb03b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"server.versions.notversioned.NotVersionedAsyncClient":"Server.Versions.NotVersioned","server.versions.notversioned.NotVersionedAsyncClient.withPathApiVersion":"Server.Versions.NotVersioned.withPathApiVersion","server.versions.notversioned.NotVersionedAsyncClient.withPathApiVersionWithResponse":"Server.Versions.NotVersioned.withPathApiVersion","server.versions.notversioned.NotVersionedAsyncClient.withQueryApiVersion":"Server.Versions.NotVersioned.withQueryApiVersion","server.versions.notversioned.NotVersionedAsyncClient.withQueryApiVersionWithResponse":"Server.Versions.NotVersioned.withQueryApiVersion","server.versions.notversioned.NotVersionedAsyncClient.withoutApiVersion":"Server.Versions.NotVersioned.withoutApiVersion","server.versions.notversioned.NotVersionedAsyncClient.withoutApiVersionWithResponse":"Server.Versions.NotVersioned.withoutApiVersion","server.versions.notversioned.NotVersionedClient":"Server.Versions.NotVersioned","server.versions.notversioned.NotVersionedClient.withPathApiVersion":"Server.Versions.NotVersioned.withPathApiVersion","server.versions.notversioned.NotVersionedClient.withPathApiVersionWithResponse":"Server.Versions.NotVersioned.withPathApiVersion","server.versions.notversioned.NotVersionedClient.withQueryApiVersion":"Server.Versions.NotVersioned.withQueryApiVersion","server.versions.notversioned.NotVersionedClient.withQueryApiVersionWithResponse":"Server.Versions.NotVersioned.withQueryApiVersion","server.versions.notversioned.NotVersionedClient.withoutApiVersion":"Server.Versions.NotVersioned.withoutApiVersion","server.versions.notversioned.NotVersionedClient.withoutApiVersionWithResponse":"Server.Versions.NotVersioned.withoutApiVersion","server.versions.notversioned.NotVersionedClientBuilder":"Server.Versions.NotVersioned"},"generatedFiles":["src/main/java/module-info.java","src/main/java/server/versions/notversioned/NotVersionedAsyncClient.java","src/main/java/server/versions/notversioned/NotVersionedClient.java","src/main/java/server/versions/notversioned/NotVersionedClientBuilder.java","src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java","src/main/java/server/versions/notversioned/implementation/package-info.java","src/main/java/server/versions/notversioned/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_apiview_properties.json deleted file mode 100644 index 4ef1c621313..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_apiview_properties.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "server.versions.versioned.VersionedAsyncClient": "Server.Versions.Versioned", - "server.versions.versioned.VersionedAsyncClient.withPathApiVersion": "Server.Versions.Versioned.withPathApiVersion", - "server.versions.versioned.VersionedAsyncClient.withPathApiVersionWithResponse": "Server.Versions.Versioned.withPathApiVersion", - "server.versions.versioned.VersionedAsyncClient.withQueryApiVersion": "Server.Versions.Versioned.withQueryApiVersion", - "server.versions.versioned.VersionedAsyncClient.withQueryApiVersionWithResponse": "Server.Versions.Versioned.withQueryApiVersion", - "server.versions.versioned.VersionedAsyncClient.withQueryOldApiVersion": "Server.Versions.Versioned.withQueryOldApiVersion", - "server.versions.versioned.VersionedAsyncClient.withQueryOldApiVersionWithResponse": "Server.Versions.Versioned.withQueryOldApiVersion", - "server.versions.versioned.VersionedAsyncClient.withoutApiVersion": "Server.Versions.Versioned.withoutApiVersion", - "server.versions.versioned.VersionedAsyncClient.withoutApiVersionWithResponse": "Server.Versions.Versioned.withoutApiVersion", - "server.versions.versioned.VersionedClient": "Server.Versions.Versioned", - "server.versions.versioned.VersionedClient.withPathApiVersion": "Server.Versions.Versioned.withPathApiVersion", - "server.versions.versioned.VersionedClient.withPathApiVersionWithResponse": "Server.Versions.Versioned.withPathApiVersion", - "server.versions.versioned.VersionedClient.withQueryApiVersion": "Server.Versions.Versioned.withQueryApiVersion", - "server.versions.versioned.VersionedClient.withQueryApiVersionWithResponse": "Server.Versions.Versioned.withQueryApiVersion", - "server.versions.versioned.VersionedClient.withQueryOldApiVersion": "Server.Versions.Versioned.withQueryOldApiVersion", - "server.versions.versioned.VersionedClient.withQueryOldApiVersionWithResponse": "Server.Versions.Versioned.withQueryOldApiVersion", - "server.versions.versioned.VersionedClient.withoutApiVersion": "Server.Versions.Versioned.withoutApiVersion", - "server.versions.versioned.VersionedClient.withoutApiVersionWithResponse": "Server.Versions.Versioned.withoutApiVersion", - "server.versions.versioned.VersionedClientBuilder": "Server.Versions.Versioned" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_metadata.json deleted file mode 100644 index 168a72c64a6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"server.versions.versioned.VersionedAsyncClient":"Server.Versions.Versioned","server.versions.versioned.VersionedAsyncClient.withPathApiVersion":"Server.Versions.Versioned.withPathApiVersion","server.versions.versioned.VersionedAsyncClient.withPathApiVersionWithResponse":"Server.Versions.Versioned.withPathApiVersion","server.versions.versioned.VersionedAsyncClient.withQueryApiVersion":"Server.Versions.Versioned.withQueryApiVersion","server.versions.versioned.VersionedAsyncClient.withQueryApiVersionWithResponse":"Server.Versions.Versioned.withQueryApiVersion","server.versions.versioned.VersionedAsyncClient.withQueryOldApiVersion":"Server.Versions.Versioned.withQueryOldApiVersion","server.versions.versioned.VersionedAsyncClient.withQueryOldApiVersionWithResponse":"Server.Versions.Versioned.withQueryOldApiVersion","server.versions.versioned.VersionedAsyncClient.withoutApiVersion":"Server.Versions.Versioned.withoutApiVersion","server.versions.versioned.VersionedAsyncClient.withoutApiVersionWithResponse":"Server.Versions.Versioned.withoutApiVersion","server.versions.versioned.VersionedClient":"Server.Versions.Versioned","server.versions.versioned.VersionedClient.withPathApiVersion":"Server.Versions.Versioned.withPathApiVersion","server.versions.versioned.VersionedClient.withPathApiVersionWithResponse":"Server.Versions.Versioned.withPathApiVersion","server.versions.versioned.VersionedClient.withQueryApiVersion":"Server.Versions.Versioned.withQueryApiVersion","server.versions.versioned.VersionedClient.withQueryApiVersionWithResponse":"Server.Versions.Versioned.withQueryApiVersion","server.versions.versioned.VersionedClient.withQueryOldApiVersion":"Server.Versions.Versioned.withQueryOldApiVersion","server.versions.versioned.VersionedClient.withQueryOldApiVersionWithResponse":"Server.Versions.Versioned.withQueryOldApiVersion","server.versions.versioned.VersionedClient.withoutApiVersion":"Server.Versions.Versioned.withoutApiVersion","server.versions.versioned.VersionedClient.withoutApiVersionWithResponse":"Server.Versions.Versioned.withoutApiVersion","server.versions.versioned.VersionedClientBuilder":"Server.Versions.Versioned"},"generatedFiles":["src/main/java/module-info.java","src/main/java/server/versions/versioned/VersionedAsyncClient.java","src/main/java/server/versions/versioned/VersionedClient.java","src/main/java/server/versions/versioned/VersionedClientBuilder.java","src/main/java/server/versions/versioned/VersionedServiceVersion.java","src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java","src/main/java/server/versions/versioned/implementation/package-info.java","src/main/java/server/versions/versioned/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_apiview_properties.json deleted file mode 100644 index 1d0bb376bda..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_apiview_properties.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "service.multiservice.combined.BarAsyncClient": "Service.MultiService.ServiceB.Bar", - "service.multiservice.combined.BarAsyncClient.test": "Service.MultiService.ServiceB.Bar.test", - "service.multiservice.combined.BarAsyncClient.testWithResponse": "Service.MultiService.ServiceB.Bar.test", - "service.multiservice.combined.BarClient": "Service.MultiService.ServiceB.Bar", - "service.multiservice.combined.BarClient.test": "Service.MultiService.ServiceB.Bar.test", - "service.multiservice.combined.BarClient.testWithResponse": "Service.MultiService.ServiceB.Bar.test", - "service.multiservice.combined.CombinedBuilder": "Service.MultiService.Combined", - "service.multiservice.combined.FooAsyncClient": "Service.MultiService.ServiceA.Foo", - "service.multiservice.combined.FooAsyncClient.test": "Service.MultiService.ServiceA.Foo.test", - "service.multiservice.combined.FooAsyncClient.testWithResponse": "Service.MultiService.ServiceA.Foo.test", - "service.multiservice.combined.FooClient": "Service.MultiService.ServiceA.Foo", - "service.multiservice.combined.FooClient.test": "Service.MultiService.ServiceA.Foo.test", - "service.multiservice.combined.FooClient.testWithResponse": "Service.MultiService.ServiceA.Foo.test" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_metadata.json deleted file mode 100644 index 614135013ef..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"service.multiservice.combined.BarAsyncClient":"Service.MultiService.ServiceB.Bar","service.multiservice.combined.BarAsyncClient.test":"Service.MultiService.ServiceB.Bar.test","service.multiservice.combined.BarAsyncClient.testWithResponse":"Service.MultiService.ServiceB.Bar.test","service.multiservice.combined.BarClient":"Service.MultiService.ServiceB.Bar","service.multiservice.combined.BarClient.test":"Service.MultiService.ServiceB.Bar.test","service.multiservice.combined.BarClient.testWithResponse":"Service.MultiService.ServiceB.Bar.test","service.multiservice.combined.CombinedBuilder":"Service.MultiService.Combined","service.multiservice.combined.FooAsyncClient":"Service.MultiService.ServiceA.Foo","service.multiservice.combined.FooAsyncClient.test":"Service.MultiService.ServiceA.Foo.test","service.multiservice.combined.FooAsyncClient.testWithResponse":"Service.MultiService.ServiceA.Foo.test","service.multiservice.combined.FooClient":"Service.MultiService.ServiceA.Foo","service.multiservice.combined.FooClient.test":"Service.MultiService.ServiceA.Foo.test","service.multiservice.combined.FooClient.testWithResponse":"Service.MultiService.ServiceA.Foo.test"},"generatedFiles":["src/main/java/module-info.java","src/main/java/service/multiservice/combined/BarAsyncClient.java","src/main/java/service/multiservice/combined/BarClient.java","src/main/java/service/multiservice/combined/CombinedBuilder.java","src/main/java/service/multiservice/combined/FooAsyncClient.java","src/main/java/service/multiservice/combined/FooClient.java","src/main/java/service/multiservice/combined/implementation/BarsImpl.java","src/main/java/service/multiservice/combined/implementation/CombinedImpl.java","src/main/java/service/multiservice/combined/implementation/FoosImpl.java","src/main/java/service/multiservice/combined/implementation/package-info.java","src/main/java/service/multiservice/combined/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_apiview_properties.json deleted file mode 100644 index 2755cb3e3aa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_apiview_properties.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "specialheaders.conditionalrequest.ConditionalRequestAsyncClient": "SpecialHeaders.ConditionalRequest", - "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.headIfModifiedSince": "SpecialHeaders.ConditionalRequest.headIfModifiedSince", - "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.headIfModifiedSinceWithResponse": "SpecialHeaders.ConditionalRequest.headIfModifiedSince", - "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfMatch": "SpecialHeaders.ConditionalRequest.postIfMatch", - "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfMatchWithResponse": "SpecialHeaders.ConditionalRequest.postIfMatch", - "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfNoneMatch": "SpecialHeaders.ConditionalRequest.postIfNoneMatch", - "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfNoneMatchWithResponse": "SpecialHeaders.ConditionalRequest.postIfNoneMatch", - "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfUnmodifiedSince": "SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince", - "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfUnmodifiedSinceWithResponse": "SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince", - "specialheaders.conditionalrequest.ConditionalRequestClient": "SpecialHeaders.ConditionalRequest", - "specialheaders.conditionalrequest.ConditionalRequestClient.headIfModifiedSince": "SpecialHeaders.ConditionalRequest.headIfModifiedSince", - "specialheaders.conditionalrequest.ConditionalRequestClient.headIfModifiedSinceWithResponse": "SpecialHeaders.ConditionalRequest.headIfModifiedSince", - "specialheaders.conditionalrequest.ConditionalRequestClient.postIfMatch": "SpecialHeaders.ConditionalRequest.postIfMatch", - "specialheaders.conditionalrequest.ConditionalRequestClient.postIfMatchWithResponse": "SpecialHeaders.ConditionalRequest.postIfMatch", - "specialheaders.conditionalrequest.ConditionalRequestClient.postIfNoneMatch": "SpecialHeaders.ConditionalRequest.postIfNoneMatch", - "specialheaders.conditionalrequest.ConditionalRequestClient.postIfNoneMatchWithResponse": "SpecialHeaders.ConditionalRequest.postIfNoneMatch", - "specialheaders.conditionalrequest.ConditionalRequestClient.postIfUnmodifiedSince": "SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince", - "specialheaders.conditionalrequest.ConditionalRequestClient.postIfUnmodifiedSinceWithResponse": "SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince", - "specialheaders.conditionalrequest.ConditionalRequestClientBuilder": "SpecialHeaders.ConditionalRequest" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_metadata.json deleted file mode 100644 index badcb6ee5c3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"specialheaders.conditionalrequest.ConditionalRequestAsyncClient":"SpecialHeaders.ConditionalRequest","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.headIfModifiedSince":"SpecialHeaders.ConditionalRequest.headIfModifiedSince","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.headIfModifiedSinceWithResponse":"SpecialHeaders.ConditionalRequest.headIfModifiedSince","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfMatch":"SpecialHeaders.ConditionalRequest.postIfMatch","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfMatchWithResponse":"SpecialHeaders.ConditionalRequest.postIfMatch","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfNoneMatch":"SpecialHeaders.ConditionalRequest.postIfNoneMatch","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfNoneMatchWithResponse":"SpecialHeaders.ConditionalRequest.postIfNoneMatch","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfUnmodifiedSince":"SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfUnmodifiedSinceWithResponse":"SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince","specialheaders.conditionalrequest.ConditionalRequestClient":"SpecialHeaders.ConditionalRequest","specialheaders.conditionalrequest.ConditionalRequestClient.headIfModifiedSince":"SpecialHeaders.ConditionalRequest.headIfModifiedSince","specialheaders.conditionalrequest.ConditionalRequestClient.headIfModifiedSinceWithResponse":"SpecialHeaders.ConditionalRequest.headIfModifiedSince","specialheaders.conditionalrequest.ConditionalRequestClient.postIfMatch":"SpecialHeaders.ConditionalRequest.postIfMatch","specialheaders.conditionalrequest.ConditionalRequestClient.postIfMatchWithResponse":"SpecialHeaders.ConditionalRequest.postIfMatch","specialheaders.conditionalrequest.ConditionalRequestClient.postIfNoneMatch":"SpecialHeaders.ConditionalRequest.postIfNoneMatch","specialheaders.conditionalrequest.ConditionalRequestClient.postIfNoneMatchWithResponse":"SpecialHeaders.ConditionalRequest.postIfNoneMatch","specialheaders.conditionalrequest.ConditionalRequestClient.postIfUnmodifiedSince":"SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince","specialheaders.conditionalrequest.ConditionalRequestClient.postIfUnmodifiedSinceWithResponse":"SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince","specialheaders.conditionalrequest.ConditionalRequestClientBuilder":"SpecialHeaders.ConditionalRequest"},"generatedFiles":["src/main/java/module-info.java","src/main/java/specialheaders/conditionalrequest/ConditionalRequestAsyncClient.java","src/main/java/specialheaders/conditionalrequest/ConditionalRequestClient.java","src/main/java/specialheaders/conditionalrequest/ConditionalRequestClientBuilder.java","src/main/java/specialheaders/conditionalrequest/implementation/ConditionalRequestClientImpl.java","src/main/java/specialheaders/conditionalrequest/implementation/package-info.java","src/main/java/specialheaders/conditionalrequest/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_apiview_properties.json deleted file mode 100644 index 78b61690bc4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_apiview_properties.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "specialheaders.repeatability.RepeatabilityAsyncClient": "SpecialHeaders.Repeatability", - "specialheaders.repeatability.RepeatabilityAsyncClient.immediateSuccess": "SpecialHeaders.Repeatability.immediateSuccess", - "specialheaders.repeatability.RepeatabilityAsyncClient.immediateSuccessWithResponse": "SpecialHeaders.Repeatability.immediateSuccess", - "specialheaders.repeatability.RepeatabilityClient": "SpecialHeaders.Repeatability", - "specialheaders.repeatability.RepeatabilityClient.immediateSuccess": "SpecialHeaders.Repeatability.immediateSuccess", - "specialheaders.repeatability.RepeatabilityClient.immediateSuccessWithResponse": "SpecialHeaders.Repeatability.immediateSuccess", - "specialheaders.repeatability.RepeatabilityClientBuilder": "SpecialHeaders.Repeatability" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_metadata.json deleted file mode 100644 index 82460b3991f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"specialheaders.repeatability.RepeatabilityAsyncClient":"SpecialHeaders.Repeatability","specialheaders.repeatability.RepeatabilityAsyncClient.immediateSuccess":"SpecialHeaders.Repeatability.immediateSuccess","specialheaders.repeatability.RepeatabilityAsyncClient.immediateSuccessWithResponse":"SpecialHeaders.Repeatability.immediateSuccess","specialheaders.repeatability.RepeatabilityClient":"SpecialHeaders.Repeatability","specialheaders.repeatability.RepeatabilityClient.immediateSuccess":"SpecialHeaders.Repeatability.immediateSuccess","specialheaders.repeatability.RepeatabilityClient.immediateSuccessWithResponse":"SpecialHeaders.Repeatability.immediateSuccess","specialheaders.repeatability.RepeatabilityClientBuilder":"SpecialHeaders.Repeatability"},"generatedFiles":["src/main/java/module-info.java","src/main/java/specialheaders/repeatability/RepeatabilityAsyncClient.java","src/main/java/specialheaders/repeatability/RepeatabilityClient.java","src/main/java/specialheaders/repeatability/RepeatabilityClientBuilder.java","src/main/java/specialheaders/repeatability/implementation/RepeatabilityClientImpl.java","src/main/java/specialheaders/repeatability/implementation/package-info.java","src/main/java/specialheaders/repeatability/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_apiview_properties.json deleted file mode 100644 index 8884bf558b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_apiview_properties.json +++ /dev/null @@ -1,453 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "specialwords.ModelPropertiesAsyncClient": "SpecialWords.ModelProperties", - "specialwords.ModelPropertiesAsyncClient.dictMethods": "SpecialWords.ModelProperties.dictMethods", - "specialwords.ModelPropertiesAsyncClient.dictMethodsWithResponse": "SpecialWords.ModelProperties.dictMethods", - "specialwords.ModelPropertiesAsyncClient.sameAsModel": "SpecialWords.ModelProperties.sameAsModel", - "specialwords.ModelPropertiesAsyncClient.sameAsModelWithResponse": "SpecialWords.ModelProperties.sameAsModel", - "specialwords.ModelPropertiesClient": "SpecialWords.ModelProperties", - "specialwords.ModelPropertiesClient.dictMethods": "SpecialWords.ModelProperties.dictMethods", - "specialwords.ModelPropertiesClient.dictMethodsWithResponse": "SpecialWords.ModelProperties.dictMethods", - "specialwords.ModelPropertiesClient.sameAsModel": "SpecialWords.ModelProperties.sameAsModel", - "specialwords.ModelPropertiesClient.sameAsModelWithResponse": "SpecialWords.ModelProperties.sameAsModel", - "specialwords.ModelsAsyncClient": "SpecialWords.Models", - "specialwords.ModelsAsyncClient.withAnd": "SpecialWords.Models.withAnd", - "specialwords.ModelsAsyncClient.withAndWithResponse": "SpecialWords.Models.withAnd", - "specialwords.ModelsAsyncClient.withAs": "SpecialWords.Models.withAs", - "specialwords.ModelsAsyncClient.withAsWithResponse": "SpecialWords.Models.withAs", - "specialwords.ModelsAsyncClient.withAssert": "SpecialWords.Models.withAssert", - "specialwords.ModelsAsyncClient.withAssertWithResponse": "SpecialWords.Models.withAssert", - "specialwords.ModelsAsyncClient.withAsyncWithResponse": "SpecialWords.Models.withAsync", - "specialwords.ModelsAsyncClient.withAwait": "SpecialWords.Models.withAwait", - "specialwords.ModelsAsyncClient.withAwaitWithResponse": "SpecialWords.Models.withAwait", - "specialwords.ModelsAsyncClient.withBreak": "SpecialWords.Models.withBreak", - "specialwords.ModelsAsyncClient.withBreakWithResponse": "SpecialWords.Models.withBreak", - "specialwords.ModelsAsyncClient.withClass": "SpecialWords.Models.withClass", - "specialwords.ModelsAsyncClient.withClassWithResponse": "SpecialWords.Models.withClass", - "specialwords.ModelsAsyncClient.withConstructor": "SpecialWords.Models.withConstructor", - "specialwords.ModelsAsyncClient.withConstructorWithResponse": "SpecialWords.Models.withConstructor", - "specialwords.ModelsAsyncClient.withContinue": "SpecialWords.Models.withContinue", - "specialwords.ModelsAsyncClient.withContinueWithResponse": "SpecialWords.Models.withContinue", - "specialwords.ModelsAsyncClient.withDef": "SpecialWords.Models.withDef", - "specialwords.ModelsAsyncClient.withDefWithResponse": "SpecialWords.Models.withDef", - "specialwords.ModelsAsyncClient.withDel": "SpecialWords.Models.withDel", - "specialwords.ModelsAsyncClient.withDelWithResponse": "SpecialWords.Models.withDel", - "specialwords.ModelsAsyncClient.withElif": "SpecialWords.Models.withElif", - "specialwords.ModelsAsyncClient.withElifWithResponse": "SpecialWords.Models.withElif", - "specialwords.ModelsAsyncClient.withElse": "SpecialWords.Models.withElse", - "specialwords.ModelsAsyncClient.withElseWithResponse": "SpecialWords.Models.withElse", - "specialwords.ModelsAsyncClient.withExcept": "SpecialWords.Models.withExcept", - "specialwords.ModelsAsyncClient.withExceptWithResponse": "SpecialWords.Models.withExcept", - "specialwords.ModelsAsyncClient.withExec": "SpecialWords.Models.withExec", - "specialwords.ModelsAsyncClient.withExecWithResponse": "SpecialWords.Models.withExec", - "specialwords.ModelsAsyncClient.withFinally": "SpecialWords.Models.withFinally", - "specialwords.ModelsAsyncClient.withFinallyWithResponse": "SpecialWords.Models.withFinally", - "specialwords.ModelsAsyncClient.withFor": "SpecialWords.Models.withFor", - "specialwords.ModelsAsyncClient.withForWithResponse": "SpecialWords.Models.withFor", - "specialwords.ModelsAsyncClient.withFrom": "SpecialWords.Models.withFrom", - "specialwords.ModelsAsyncClient.withFromWithResponse": "SpecialWords.Models.withFrom", - "specialwords.ModelsAsyncClient.withGlobal": "SpecialWords.Models.withGlobal", - "specialwords.ModelsAsyncClient.withGlobalWithResponse": "SpecialWords.Models.withGlobal", - "specialwords.ModelsAsyncClient.withIf": "SpecialWords.Models.withIf", - "specialwords.ModelsAsyncClient.withIfWithResponse": "SpecialWords.Models.withIf", - "specialwords.ModelsAsyncClient.withImport": "SpecialWords.Models.withImport", - "specialwords.ModelsAsyncClient.withImportWithResponse": "SpecialWords.Models.withImport", - "specialwords.ModelsAsyncClient.withIn": "SpecialWords.Models.withIn", - "specialwords.ModelsAsyncClient.withInWithResponse": "SpecialWords.Models.withIn", - "specialwords.ModelsAsyncClient.withIs": "SpecialWords.Models.withIs", - "specialwords.ModelsAsyncClient.withIsWithResponse": "SpecialWords.Models.withIs", - "specialwords.ModelsAsyncClient.withLambda": "SpecialWords.Models.withLambda", - "specialwords.ModelsAsyncClient.withLambdaWithResponse": "SpecialWords.Models.withLambda", - "specialwords.ModelsAsyncClient.withNot": "SpecialWords.Models.withNot", - "specialwords.ModelsAsyncClient.withNotWithResponse": "SpecialWords.Models.withNot", - "specialwords.ModelsAsyncClient.withOr": "SpecialWords.Models.withOr", - "specialwords.ModelsAsyncClient.withOrWithResponse": "SpecialWords.Models.withOr", - "specialwords.ModelsAsyncClient.withPass": "SpecialWords.Models.withPass", - "specialwords.ModelsAsyncClient.withPassWithResponse": "SpecialWords.Models.withPass", - "specialwords.ModelsAsyncClient.withRaise": "SpecialWords.Models.withRaise", - "specialwords.ModelsAsyncClient.withRaiseWithResponse": "SpecialWords.Models.withRaise", - "specialwords.ModelsAsyncClient.withReturn": "SpecialWords.Models.withReturn", - "specialwords.ModelsAsyncClient.withReturnWithResponse": "SpecialWords.Models.withReturn", - "specialwords.ModelsAsyncClient.withTry": "SpecialWords.Models.withTry", - "specialwords.ModelsAsyncClient.withTryWithResponse": "SpecialWords.Models.withTry", - "specialwords.ModelsAsyncClient.withWhile": "SpecialWords.Models.withWhile", - "specialwords.ModelsAsyncClient.withWhileWithResponse": "SpecialWords.Models.withWhile", - "specialwords.ModelsAsyncClient.withWith": "SpecialWords.Models.withWith", - "specialwords.ModelsAsyncClient.withWithWithResponse": "SpecialWords.Models.withWith", - "specialwords.ModelsAsyncClient.withYield": "SpecialWords.Models.withYield", - "specialwords.ModelsAsyncClient.withYieldWithResponse": "SpecialWords.Models.withYield", - "specialwords.ModelsClient": "SpecialWords.Models", - "specialwords.ModelsClient.withAnd": "SpecialWords.Models.withAnd", - "specialwords.ModelsClient.withAndWithResponse": "SpecialWords.Models.withAnd", - "specialwords.ModelsClient.withAs": "SpecialWords.Models.withAs", - "specialwords.ModelsClient.withAsWithResponse": "SpecialWords.Models.withAs", - "specialwords.ModelsClient.withAssert": "SpecialWords.Models.withAssert", - "specialwords.ModelsClient.withAssertWithResponse": "SpecialWords.Models.withAssert", - "specialwords.ModelsClient.withAsyncWithResponse": "SpecialWords.Models.withAsync", - "specialwords.ModelsClient.withAwait": "SpecialWords.Models.withAwait", - "specialwords.ModelsClient.withAwaitWithResponse": "SpecialWords.Models.withAwait", - "specialwords.ModelsClient.withBreak": "SpecialWords.Models.withBreak", - "specialwords.ModelsClient.withBreakWithResponse": "SpecialWords.Models.withBreak", - "specialwords.ModelsClient.withClass": "SpecialWords.Models.withClass", - "specialwords.ModelsClient.withClassWithResponse": "SpecialWords.Models.withClass", - "specialwords.ModelsClient.withConstructor": "SpecialWords.Models.withConstructor", - "specialwords.ModelsClient.withConstructorWithResponse": "SpecialWords.Models.withConstructor", - "specialwords.ModelsClient.withContinue": "SpecialWords.Models.withContinue", - "specialwords.ModelsClient.withContinueWithResponse": "SpecialWords.Models.withContinue", - "specialwords.ModelsClient.withDef": "SpecialWords.Models.withDef", - "specialwords.ModelsClient.withDefWithResponse": "SpecialWords.Models.withDef", - "specialwords.ModelsClient.withDel": "SpecialWords.Models.withDel", - "specialwords.ModelsClient.withDelWithResponse": "SpecialWords.Models.withDel", - "specialwords.ModelsClient.withElif": "SpecialWords.Models.withElif", - "specialwords.ModelsClient.withElifWithResponse": "SpecialWords.Models.withElif", - "specialwords.ModelsClient.withElse": "SpecialWords.Models.withElse", - "specialwords.ModelsClient.withElseWithResponse": "SpecialWords.Models.withElse", - "specialwords.ModelsClient.withExcept": "SpecialWords.Models.withExcept", - "specialwords.ModelsClient.withExceptWithResponse": "SpecialWords.Models.withExcept", - "specialwords.ModelsClient.withExec": "SpecialWords.Models.withExec", - "specialwords.ModelsClient.withExecWithResponse": "SpecialWords.Models.withExec", - "specialwords.ModelsClient.withFinally": "SpecialWords.Models.withFinally", - "specialwords.ModelsClient.withFinallyWithResponse": "SpecialWords.Models.withFinally", - "specialwords.ModelsClient.withFor": "SpecialWords.Models.withFor", - "specialwords.ModelsClient.withForWithResponse": "SpecialWords.Models.withFor", - "specialwords.ModelsClient.withFrom": "SpecialWords.Models.withFrom", - "specialwords.ModelsClient.withFromWithResponse": "SpecialWords.Models.withFrom", - "specialwords.ModelsClient.withGlobal": "SpecialWords.Models.withGlobal", - "specialwords.ModelsClient.withGlobalWithResponse": "SpecialWords.Models.withGlobal", - "specialwords.ModelsClient.withIf": "SpecialWords.Models.withIf", - "specialwords.ModelsClient.withIfWithResponse": "SpecialWords.Models.withIf", - "specialwords.ModelsClient.withImport": "SpecialWords.Models.withImport", - "specialwords.ModelsClient.withImportWithResponse": "SpecialWords.Models.withImport", - "specialwords.ModelsClient.withIn": "SpecialWords.Models.withIn", - "specialwords.ModelsClient.withInWithResponse": "SpecialWords.Models.withIn", - "specialwords.ModelsClient.withIs": "SpecialWords.Models.withIs", - "specialwords.ModelsClient.withIsWithResponse": "SpecialWords.Models.withIs", - "specialwords.ModelsClient.withLambda": "SpecialWords.Models.withLambda", - "specialwords.ModelsClient.withLambdaWithResponse": "SpecialWords.Models.withLambda", - "specialwords.ModelsClient.withNot": "SpecialWords.Models.withNot", - "specialwords.ModelsClient.withNotWithResponse": "SpecialWords.Models.withNot", - "specialwords.ModelsClient.withOr": "SpecialWords.Models.withOr", - "specialwords.ModelsClient.withOrWithResponse": "SpecialWords.Models.withOr", - "specialwords.ModelsClient.withPass": "SpecialWords.Models.withPass", - "specialwords.ModelsClient.withPassWithResponse": "SpecialWords.Models.withPass", - "specialwords.ModelsClient.withRaise": "SpecialWords.Models.withRaise", - "specialwords.ModelsClient.withRaiseWithResponse": "SpecialWords.Models.withRaise", - "specialwords.ModelsClient.withReturn": "SpecialWords.Models.withReturn", - "specialwords.ModelsClient.withReturnWithResponse": "SpecialWords.Models.withReturn", - "specialwords.ModelsClient.withTry": "SpecialWords.Models.withTry", - "specialwords.ModelsClient.withTryWithResponse": "SpecialWords.Models.withTry", - "specialwords.ModelsClient.withWhile": "SpecialWords.Models.withWhile", - "specialwords.ModelsClient.withWhileWithResponse": "SpecialWords.Models.withWhile", - "specialwords.ModelsClient.withWith": "SpecialWords.Models.withWith", - "specialwords.ModelsClient.withWithWithResponse": "SpecialWords.Models.withWith", - "specialwords.ModelsClient.withYield": "SpecialWords.Models.withYield", - "specialwords.ModelsClient.withYieldWithResponse": "SpecialWords.Models.withYield", - "specialwords.OperationsAsyncClient": "SpecialWords.Operations", - "specialwords.OperationsAsyncClient.and": "SpecialWords.Operations.and", - "specialwords.OperationsAsyncClient.andWithResponse": "SpecialWords.Operations.and", - "specialwords.OperationsAsyncClient.as": "SpecialWords.Operations.as", - "specialwords.OperationsAsyncClient.asWithResponse": "SpecialWords.Operations.as", - "specialwords.OperationsAsyncClient.assertMethod": "SpecialWords.Operations.assert", - "specialwords.OperationsAsyncClient.assertMethodWithResponse": "SpecialWords.Operations.assert", - "specialwords.OperationsAsyncClient.async": "SpecialWords.Operations.async", - "specialwords.OperationsAsyncClient.asyncWithResponse": "SpecialWords.Operations.async", - "specialwords.OperationsAsyncClient.await": "SpecialWords.Operations.await", - "specialwords.OperationsAsyncClient.awaitWithResponse": "SpecialWords.Operations.await", - "specialwords.OperationsAsyncClient.breakMethod": "SpecialWords.Operations.break", - "specialwords.OperationsAsyncClient.breakMethodWithResponse": "SpecialWords.Operations.break", - "specialwords.OperationsAsyncClient.classMethod": "SpecialWords.Operations.class", - "specialwords.OperationsAsyncClient.classMethodWithResponse": "SpecialWords.Operations.class", - "specialwords.OperationsAsyncClient.constructor": "SpecialWords.Operations.constructor", - "specialwords.OperationsAsyncClient.constructorWithResponse": "SpecialWords.Operations.constructor", - "specialwords.OperationsAsyncClient.continueMethod": "SpecialWords.Operations.continue", - "specialwords.OperationsAsyncClient.continueMethodWithResponse": "SpecialWords.Operations.continue", - "specialwords.OperationsAsyncClient.def": "SpecialWords.Operations.def", - "specialwords.OperationsAsyncClient.defWithResponse": "SpecialWords.Operations.def", - "specialwords.OperationsAsyncClient.del": "SpecialWords.Operations.del", - "specialwords.OperationsAsyncClient.delWithResponse": "SpecialWords.Operations.del", - "specialwords.OperationsAsyncClient.elif": "SpecialWords.Operations.elif", - "specialwords.OperationsAsyncClient.elifWithResponse": "SpecialWords.Operations.elif", - "specialwords.OperationsAsyncClient.elseMethod": "SpecialWords.Operations.else", - "specialwords.OperationsAsyncClient.elseMethodWithResponse": "SpecialWords.Operations.else", - "specialwords.OperationsAsyncClient.except": "SpecialWords.Operations.except", - "specialwords.OperationsAsyncClient.exceptWithResponse": "SpecialWords.Operations.except", - "specialwords.OperationsAsyncClient.exec": "SpecialWords.Operations.exec", - "specialwords.OperationsAsyncClient.execWithResponse": "SpecialWords.Operations.exec", - "specialwords.OperationsAsyncClient.finallyMethod": "SpecialWords.Operations.finally", - "specialwords.OperationsAsyncClient.finallyMethodWithResponse": "SpecialWords.Operations.finally", - "specialwords.OperationsAsyncClient.forMethod": "SpecialWords.Operations.for", - "specialwords.OperationsAsyncClient.forMethodWithResponse": "SpecialWords.Operations.for", - "specialwords.OperationsAsyncClient.from": "SpecialWords.Operations.from", - "specialwords.OperationsAsyncClient.fromWithResponse": "SpecialWords.Operations.from", - "specialwords.OperationsAsyncClient.global": "SpecialWords.Operations.global", - "specialwords.OperationsAsyncClient.globalWithResponse": "SpecialWords.Operations.global", - "specialwords.OperationsAsyncClient.ifMethod": "SpecialWords.Operations.if", - "specialwords.OperationsAsyncClient.ifMethodWithResponse": "SpecialWords.Operations.if", - "specialwords.OperationsAsyncClient.importMethod": "SpecialWords.Operations.import", - "specialwords.OperationsAsyncClient.importMethodWithResponse": "SpecialWords.Operations.import", - "specialwords.OperationsAsyncClient.in": "SpecialWords.Operations.in", - "specialwords.OperationsAsyncClient.inWithResponse": "SpecialWords.Operations.in", - "specialwords.OperationsAsyncClient.is": "SpecialWords.Operations.is", - "specialwords.OperationsAsyncClient.isWithResponse": "SpecialWords.Operations.is", - "specialwords.OperationsAsyncClient.lambda": "SpecialWords.Operations.lambda", - "specialwords.OperationsAsyncClient.lambdaWithResponse": "SpecialWords.Operations.lambda", - "specialwords.OperationsAsyncClient.not": "SpecialWords.Operations.not", - "specialwords.OperationsAsyncClient.notWithResponse": "SpecialWords.Operations.not", - "specialwords.OperationsAsyncClient.or": "SpecialWords.Operations.or", - "specialwords.OperationsAsyncClient.orWithResponse": "SpecialWords.Operations.or", - "specialwords.OperationsAsyncClient.pass": "SpecialWords.Operations.pass", - "specialwords.OperationsAsyncClient.passWithResponse": "SpecialWords.Operations.pass", - "specialwords.OperationsAsyncClient.raise": "SpecialWords.Operations.raise", - "specialwords.OperationsAsyncClient.raiseWithResponse": "SpecialWords.Operations.raise", - "specialwords.OperationsAsyncClient.returnMethod": "SpecialWords.Operations.return", - "specialwords.OperationsAsyncClient.returnMethodWithResponse": "SpecialWords.Operations.return", - "specialwords.OperationsAsyncClient.tryMethod": "SpecialWords.Operations.try", - "specialwords.OperationsAsyncClient.tryMethodWithResponse": "SpecialWords.Operations.try", - "specialwords.OperationsAsyncClient.whileMethod": "SpecialWords.Operations.while", - "specialwords.OperationsAsyncClient.whileMethodWithResponse": "SpecialWords.Operations.while", - "specialwords.OperationsAsyncClient.with": "SpecialWords.Operations.with", - "specialwords.OperationsAsyncClient.withWithResponse": "SpecialWords.Operations.with", - "specialwords.OperationsAsyncClient.yield": "SpecialWords.Operations.yield", - "specialwords.OperationsAsyncClient.yieldWithResponse": "SpecialWords.Operations.yield", - "specialwords.OperationsClient": "SpecialWords.Operations", - "specialwords.OperationsClient.and": "SpecialWords.Operations.and", - "specialwords.OperationsClient.andWithResponse": "SpecialWords.Operations.and", - "specialwords.OperationsClient.as": "SpecialWords.Operations.as", - "specialwords.OperationsClient.asWithResponse": "SpecialWords.Operations.as", - "specialwords.OperationsClient.assertMethod": "SpecialWords.Operations.assert", - "specialwords.OperationsClient.assertMethodWithResponse": "SpecialWords.Operations.assert", - "specialwords.OperationsClient.async": "SpecialWords.Operations.async", - "specialwords.OperationsClient.asyncWithResponse": "SpecialWords.Operations.async", - "specialwords.OperationsClient.await": "SpecialWords.Operations.await", - "specialwords.OperationsClient.awaitWithResponse": "SpecialWords.Operations.await", - "specialwords.OperationsClient.breakMethod": "SpecialWords.Operations.break", - "specialwords.OperationsClient.breakMethodWithResponse": "SpecialWords.Operations.break", - "specialwords.OperationsClient.classMethod": "SpecialWords.Operations.class", - "specialwords.OperationsClient.classMethodWithResponse": "SpecialWords.Operations.class", - "specialwords.OperationsClient.constructor": "SpecialWords.Operations.constructor", - "specialwords.OperationsClient.constructorWithResponse": "SpecialWords.Operations.constructor", - "specialwords.OperationsClient.continueMethod": "SpecialWords.Operations.continue", - "specialwords.OperationsClient.continueMethodWithResponse": "SpecialWords.Operations.continue", - "specialwords.OperationsClient.def": "SpecialWords.Operations.def", - "specialwords.OperationsClient.defWithResponse": "SpecialWords.Operations.def", - "specialwords.OperationsClient.del": "SpecialWords.Operations.del", - "specialwords.OperationsClient.delWithResponse": "SpecialWords.Operations.del", - "specialwords.OperationsClient.elif": "SpecialWords.Operations.elif", - "specialwords.OperationsClient.elifWithResponse": "SpecialWords.Operations.elif", - "specialwords.OperationsClient.elseMethod": "SpecialWords.Operations.else", - "specialwords.OperationsClient.elseMethodWithResponse": "SpecialWords.Operations.else", - "specialwords.OperationsClient.except": "SpecialWords.Operations.except", - "specialwords.OperationsClient.exceptWithResponse": "SpecialWords.Operations.except", - "specialwords.OperationsClient.exec": "SpecialWords.Operations.exec", - "specialwords.OperationsClient.execWithResponse": "SpecialWords.Operations.exec", - "specialwords.OperationsClient.finallyMethod": "SpecialWords.Operations.finally", - "specialwords.OperationsClient.finallyMethodWithResponse": "SpecialWords.Operations.finally", - "specialwords.OperationsClient.forMethod": "SpecialWords.Operations.for", - "specialwords.OperationsClient.forMethodWithResponse": "SpecialWords.Operations.for", - "specialwords.OperationsClient.from": "SpecialWords.Operations.from", - "specialwords.OperationsClient.fromWithResponse": "SpecialWords.Operations.from", - "specialwords.OperationsClient.global": "SpecialWords.Operations.global", - "specialwords.OperationsClient.globalWithResponse": "SpecialWords.Operations.global", - "specialwords.OperationsClient.ifMethod": "SpecialWords.Operations.if", - "specialwords.OperationsClient.ifMethodWithResponse": "SpecialWords.Operations.if", - "specialwords.OperationsClient.importMethod": "SpecialWords.Operations.import", - "specialwords.OperationsClient.importMethodWithResponse": "SpecialWords.Operations.import", - "specialwords.OperationsClient.in": "SpecialWords.Operations.in", - "specialwords.OperationsClient.inWithResponse": "SpecialWords.Operations.in", - "specialwords.OperationsClient.is": "SpecialWords.Operations.is", - "specialwords.OperationsClient.isWithResponse": "SpecialWords.Operations.is", - "specialwords.OperationsClient.lambda": "SpecialWords.Operations.lambda", - "specialwords.OperationsClient.lambdaWithResponse": "SpecialWords.Operations.lambda", - "specialwords.OperationsClient.not": "SpecialWords.Operations.not", - "specialwords.OperationsClient.notWithResponse": "SpecialWords.Operations.not", - "specialwords.OperationsClient.or": "SpecialWords.Operations.or", - "specialwords.OperationsClient.orWithResponse": "SpecialWords.Operations.or", - "specialwords.OperationsClient.pass": "SpecialWords.Operations.pass", - "specialwords.OperationsClient.passWithResponse": "SpecialWords.Operations.pass", - "specialwords.OperationsClient.raise": "SpecialWords.Operations.raise", - "specialwords.OperationsClient.raiseWithResponse": "SpecialWords.Operations.raise", - "specialwords.OperationsClient.returnMethod": "SpecialWords.Operations.return", - "specialwords.OperationsClient.returnMethodWithResponse": "SpecialWords.Operations.return", - "specialwords.OperationsClient.tryMethod": "SpecialWords.Operations.try", - "specialwords.OperationsClient.tryMethodWithResponse": "SpecialWords.Operations.try", - "specialwords.OperationsClient.whileMethod": "SpecialWords.Operations.while", - "specialwords.OperationsClient.whileMethodWithResponse": "SpecialWords.Operations.while", - "specialwords.OperationsClient.with": "SpecialWords.Operations.with", - "specialwords.OperationsClient.withWithResponse": "SpecialWords.Operations.with", - "specialwords.OperationsClient.yield": "SpecialWords.Operations.yield", - "specialwords.OperationsClient.yieldWithResponse": "SpecialWords.Operations.yield", - "specialwords.ParametersAsyncClient": "SpecialWords.Parameters", - "specialwords.ParametersAsyncClient.withAnd": "SpecialWords.Parameters.withAnd", - "specialwords.ParametersAsyncClient.withAndWithResponse": "SpecialWords.Parameters.withAnd", - "specialwords.ParametersAsyncClient.withAs": "SpecialWords.Parameters.withAs", - "specialwords.ParametersAsyncClient.withAsWithResponse": "SpecialWords.Parameters.withAs", - "specialwords.ParametersAsyncClient.withAssert": "SpecialWords.Parameters.withAssert", - "specialwords.ParametersAsyncClient.withAssertWithResponse": "SpecialWords.Parameters.withAssert", - "specialwords.ParametersAsyncClient.withAsyncWithResponse": "SpecialWords.Parameters.withAsync", - "specialwords.ParametersAsyncClient.withAwait": "SpecialWords.Parameters.withAwait", - "specialwords.ParametersAsyncClient.withAwaitWithResponse": "SpecialWords.Parameters.withAwait", - "specialwords.ParametersAsyncClient.withBreak": "SpecialWords.Parameters.withBreak", - "specialwords.ParametersAsyncClient.withBreakWithResponse": "SpecialWords.Parameters.withBreak", - "specialwords.ParametersAsyncClient.withCancellationToken": "SpecialWords.Parameters.withCancellationToken", - "specialwords.ParametersAsyncClient.withCancellationTokenWithResponse": "SpecialWords.Parameters.withCancellationToken", - "specialwords.ParametersAsyncClient.withClass": "SpecialWords.Parameters.withClass", - "specialwords.ParametersAsyncClient.withClassWithResponse": "SpecialWords.Parameters.withClass", - "specialwords.ParametersAsyncClient.withConstructor": "SpecialWords.Parameters.withConstructor", - "specialwords.ParametersAsyncClient.withConstructorWithResponse": "SpecialWords.Parameters.withConstructor", - "specialwords.ParametersAsyncClient.withContinue": "SpecialWords.Parameters.withContinue", - "specialwords.ParametersAsyncClient.withContinueWithResponse": "SpecialWords.Parameters.withContinue", - "specialwords.ParametersAsyncClient.withDef": "SpecialWords.Parameters.withDef", - "specialwords.ParametersAsyncClient.withDefWithResponse": "SpecialWords.Parameters.withDef", - "specialwords.ParametersAsyncClient.withDel": "SpecialWords.Parameters.withDel", - "specialwords.ParametersAsyncClient.withDelWithResponse": "SpecialWords.Parameters.withDel", - "specialwords.ParametersAsyncClient.withElif": "SpecialWords.Parameters.withElif", - "specialwords.ParametersAsyncClient.withElifWithResponse": "SpecialWords.Parameters.withElif", - "specialwords.ParametersAsyncClient.withElse": "SpecialWords.Parameters.withElse", - "specialwords.ParametersAsyncClient.withElseWithResponse": "SpecialWords.Parameters.withElse", - "specialwords.ParametersAsyncClient.withExcept": "SpecialWords.Parameters.withExcept", - "specialwords.ParametersAsyncClient.withExceptWithResponse": "SpecialWords.Parameters.withExcept", - "specialwords.ParametersAsyncClient.withExec": "SpecialWords.Parameters.withExec", - "specialwords.ParametersAsyncClient.withExecWithResponse": "SpecialWords.Parameters.withExec", - "specialwords.ParametersAsyncClient.withFinally": "SpecialWords.Parameters.withFinally", - "specialwords.ParametersAsyncClient.withFinallyWithResponse": "SpecialWords.Parameters.withFinally", - "specialwords.ParametersAsyncClient.withFor": "SpecialWords.Parameters.withFor", - "specialwords.ParametersAsyncClient.withForWithResponse": "SpecialWords.Parameters.withFor", - "specialwords.ParametersAsyncClient.withFrom": "SpecialWords.Parameters.withFrom", - "specialwords.ParametersAsyncClient.withFromWithResponse": "SpecialWords.Parameters.withFrom", - "specialwords.ParametersAsyncClient.withGlobal": "SpecialWords.Parameters.withGlobal", - "specialwords.ParametersAsyncClient.withGlobalWithResponse": "SpecialWords.Parameters.withGlobal", - "specialwords.ParametersAsyncClient.withIf": "SpecialWords.Parameters.withIf", - "specialwords.ParametersAsyncClient.withIfWithResponse": "SpecialWords.Parameters.withIf", - "specialwords.ParametersAsyncClient.withImport": "SpecialWords.Parameters.withImport", - "specialwords.ParametersAsyncClient.withImportWithResponse": "SpecialWords.Parameters.withImport", - "specialwords.ParametersAsyncClient.withIn": "SpecialWords.Parameters.withIn", - "specialwords.ParametersAsyncClient.withInWithResponse": "SpecialWords.Parameters.withIn", - "specialwords.ParametersAsyncClient.withIs": "SpecialWords.Parameters.withIs", - "specialwords.ParametersAsyncClient.withIsWithResponse": "SpecialWords.Parameters.withIs", - "specialwords.ParametersAsyncClient.withLambda": "SpecialWords.Parameters.withLambda", - "specialwords.ParametersAsyncClient.withLambdaWithResponse": "SpecialWords.Parameters.withLambda", - "specialwords.ParametersAsyncClient.withNot": "SpecialWords.Parameters.withNot", - "specialwords.ParametersAsyncClient.withNotWithResponse": "SpecialWords.Parameters.withNot", - "specialwords.ParametersAsyncClient.withOr": "SpecialWords.Parameters.withOr", - "specialwords.ParametersAsyncClient.withOrWithResponse": "SpecialWords.Parameters.withOr", - "specialwords.ParametersAsyncClient.withPass": "SpecialWords.Parameters.withPass", - "specialwords.ParametersAsyncClient.withPassWithResponse": "SpecialWords.Parameters.withPass", - "specialwords.ParametersAsyncClient.withRaise": "SpecialWords.Parameters.withRaise", - "specialwords.ParametersAsyncClient.withRaiseWithResponse": "SpecialWords.Parameters.withRaise", - "specialwords.ParametersAsyncClient.withReturn": "SpecialWords.Parameters.withReturn", - "specialwords.ParametersAsyncClient.withReturnWithResponse": "SpecialWords.Parameters.withReturn", - "specialwords.ParametersAsyncClient.withTry": "SpecialWords.Parameters.withTry", - "specialwords.ParametersAsyncClient.withTryWithResponse": "SpecialWords.Parameters.withTry", - "specialwords.ParametersAsyncClient.withWhile": "SpecialWords.Parameters.withWhile", - "specialwords.ParametersAsyncClient.withWhileWithResponse": "SpecialWords.Parameters.withWhile", - "specialwords.ParametersAsyncClient.withWith": "SpecialWords.Parameters.withWith", - "specialwords.ParametersAsyncClient.withWithWithResponse": "SpecialWords.Parameters.withWith", - "specialwords.ParametersAsyncClient.withYield": "SpecialWords.Parameters.withYield", - "specialwords.ParametersAsyncClient.withYieldWithResponse": "SpecialWords.Parameters.withYield", - "specialwords.ParametersClient": "SpecialWords.Parameters", - "specialwords.ParametersClient.withAnd": "SpecialWords.Parameters.withAnd", - "specialwords.ParametersClient.withAndWithResponse": "SpecialWords.Parameters.withAnd", - "specialwords.ParametersClient.withAs": "SpecialWords.Parameters.withAs", - "specialwords.ParametersClient.withAsWithResponse": "SpecialWords.Parameters.withAs", - "specialwords.ParametersClient.withAssert": "SpecialWords.Parameters.withAssert", - "specialwords.ParametersClient.withAssertWithResponse": "SpecialWords.Parameters.withAssert", - "specialwords.ParametersClient.withAsyncWithResponse": "SpecialWords.Parameters.withAsync", - "specialwords.ParametersClient.withAwait": "SpecialWords.Parameters.withAwait", - "specialwords.ParametersClient.withAwaitWithResponse": "SpecialWords.Parameters.withAwait", - "specialwords.ParametersClient.withBreak": "SpecialWords.Parameters.withBreak", - "specialwords.ParametersClient.withBreakWithResponse": "SpecialWords.Parameters.withBreak", - "specialwords.ParametersClient.withCancellationToken": "SpecialWords.Parameters.withCancellationToken", - "specialwords.ParametersClient.withCancellationTokenWithResponse": "SpecialWords.Parameters.withCancellationToken", - "specialwords.ParametersClient.withClass": "SpecialWords.Parameters.withClass", - "specialwords.ParametersClient.withClassWithResponse": "SpecialWords.Parameters.withClass", - "specialwords.ParametersClient.withConstructor": "SpecialWords.Parameters.withConstructor", - "specialwords.ParametersClient.withConstructorWithResponse": "SpecialWords.Parameters.withConstructor", - "specialwords.ParametersClient.withContinue": "SpecialWords.Parameters.withContinue", - "specialwords.ParametersClient.withContinueWithResponse": "SpecialWords.Parameters.withContinue", - "specialwords.ParametersClient.withDef": "SpecialWords.Parameters.withDef", - "specialwords.ParametersClient.withDefWithResponse": "SpecialWords.Parameters.withDef", - "specialwords.ParametersClient.withDel": "SpecialWords.Parameters.withDel", - "specialwords.ParametersClient.withDelWithResponse": "SpecialWords.Parameters.withDel", - "specialwords.ParametersClient.withElif": "SpecialWords.Parameters.withElif", - "specialwords.ParametersClient.withElifWithResponse": "SpecialWords.Parameters.withElif", - "specialwords.ParametersClient.withElse": "SpecialWords.Parameters.withElse", - "specialwords.ParametersClient.withElseWithResponse": "SpecialWords.Parameters.withElse", - "specialwords.ParametersClient.withExcept": "SpecialWords.Parameters.withExcept", - "specialwords.ParametersClient.withExceptWithResponse": "SpecialWords.Parameters.withExcept", - "specialwords.ParametersClient.withExec": "SpecialWords.Parameters.withExec", - "specialwords.ParametersClient.withExecWithResponse": "SpecialWords.Parameters.withExec", - "specialwords.ParametersClient.withFinally": "SpecialWords.Parameters.withFinally", - "specialwords.ParametersClient.withFinallyWithResponse": "SpecialWords.Parameters.withFinally", - "specialwords.ParametersClient.withFor": "SpecialWords.Parameters.withFor", - "specialwords.ParametersClient.withForWithResponse": "SpecialWords.Parameters.withFor", - "specialwords.ParametersClient.withFrom": "SpecialWords.Parameters.withFrom", - "specialwords.ParametersClient.withFromWithResponse": "SpecialWords.Parameters.withFrom", - "specialwords.ParametersClient.withGlobal": "SpecialWords.Parameters.withGlobal", - "specialwords.ParametersClient.withGlobalWithResponse": "SpecialWords.Parameters.withGlobal", - "specialwords.ParametersClient.withIf": "SpecialWords.Parameters.withIf", - "specialwords.ParametersClient.withIfWithResponse": "SpecialWords.Parameters.withIf", - "specialwords.ParametersClient.withImport": "SpecialWords.Parameters.withImport", - "specialwords.ParametersClient.withImportWithResponse": "SpecialWords.Parameters.withImport", - "specialwords.ParametersClient.withIn": "SpecialWords.Parameters.withIn", - "specialwords.ParametersClient.withInWithResponse": "SpecialWords.Parameters.withIn", - "specialwords.ParametersClient.withIs": "SpecialWords.Parameters.withIs", - "specialwords.ParametersClient.withIsWithResponse": "SpecialWords.Parameters.withIs", - "specialwords.ParametersClient.withLambda": "SpecialWords.Parameters.withLambda", - "specialwords.ParametersClient.withLambdaWithResponse": "SpecialWords.Parameters.withLambda", - "specialwords.ParametersClient.withNot": "SpecialWords.Parameters.withNot", - "specialwords.ParametersClient.withNotWithResponse": "SpecialWords.Parameters.withNot", - "specialwords.ParametersClient.withOr": "SpecialWords.Parameters.withOr", - "specialwords.ParametersClient.withOrWithResponse": "SpecialWords.Parameters.withOr", - "specialwords.ParametersClient.withPass": "SpecialWords.Parameters.withPass", - "specialwords.ParametersClient.withPassWithResponse": "SpecialWords.Parameters.withPass", - "specialwords.ParametersClient.withRaise": "SpecialWords.Parameters.withRaise", - "specialwords.ParametersClient.withRaiseWithResponse": "SpecialWords.Parameters.withRaise", - "specialwords.ParametersClient.withReturn": "SpecialWords.Parameters.withReturn", - "specialwords.ParametersClient.withReturnWithResponse": "SpecialWords.Parameters.withReturn", - "specialwords.ParametersClient.withTry": "SpecialWords.Parameters.withTry", - "specialwords.ParametersClient.withTryWithResponse": "SpecialWords.Parameters.withTry", - "specialwords.ParametersClient.withWhile": "SpecialWords.Parameters.withWhile", - "specialwords.ParametersClient.withWhileWithResponse": "SpecialWords.Parameters.withWhile", - "specialwords.ParametersClient.withWith": "SpecialWords.Parameters.withWith", - "specialwords.ParametersClient.withWithWithResponse": "SpecialWords.Parameters.withWith", - "specialwords.ParametersClient.withYield": "SpecialWords.Parameters.withYield", - "specialwords.ParametersClient.withYieldWithResponse": "SpecialWords.Parameters.withYield", - "specialwords.SpecialWordsClientBuilder": "SpecialWords", - "specialwords.modelproperties.models.DictMethods": "SpecialWords.ModelProperties.DictMethods", - "specialwords.modelproperties.models.SameAsModel": "SpecialWords.ModelProperties.SameAsModel", - "specialwords.models.models.And": "SpecialWords.Models.and", - "specialwords.models.models.As": "SpecialWords.Models.as", - "specialwords.models.models.Assert": "SpecialWords.Models.assert", - "specialwords.models.models.Async": "SpecialWords.Models.async", - "specialwords.models.models.Await": "SpecialWords.Models.await", - "specialwords.models.models.Break": "SpecialWords.Models.break", - "specialwords.models.models.ClassModel": "SpecialWords.Models.class", - "specialwords.models.models.Constructor": "SpecialWords.Models.constructor", - "specialwords.models.models.Continue": "SpecialWords.Models.continue", - "specialwords.models.models.Def": "SpecialWords.Models.def", - "specialwords.models.models.Del": "SpecialWords.Models.del", - "specialwords.models.models.Elif": "SpecialWords.Models.elif", - "specialwords.models.models.Else": "SpecialWords.Models.else", - "specialwords.models.models.Except": "SpecialWords.Models.except", - "specialwords.models.models.Exec": "SpecialWords.Models.exec", - "specialwords.models.models.Finally": "SpecialWords.Models.finally", - "specialwords.models.models.For": "SpecialWords.Models.for", - "specialwords.models.models.From": "SpecialWords.Models.from", - "specialwords.models.models.Global": "SpecialWords.Models.global", - "specialwords.models.models.If": "SpecialWords.Models.if", - "specialwords.models.models.Import": "SpecialWords.Models.import", - "specialwords.models.models.In": "SpecialWords.Models.in", - "specialwords.models.models.Is": "SpecialWords.Models.is", - "specialwords.models.models.Lambda": "SpecialWords.Models.lambda", - "specialwords.models.models.Not": "SpecialWords.Models.not", - "specialwords.models.models.Or": "SpecialWords.Models.or", - "specialwords.models.models.Pass": "SpecialWords.Models.pass", - "specialwords.models.models.Raise": "SpecialWords.Models.raise", - "specialwords.models.models.Return": "SpecialWords.Models.return", - "specialwords.models.models.Try": "SpecialWords.Models.try", - "specialwords.models.models.While": "SpecialWords.Models.while", - "specialwords.models.models.With": "SpecialWords.Models.with", - "specialwords.models.models.Yield": "SpecialWords.Models.yield" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_metadata.json deleted file mode 100644 index b15d6bfff0e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"specialwords.ModelPropertiesAsyncClient":"SpecialWords.ModelProperties","specialwords.ModelPropertiesAsyncClient.dictMethods":"SpecialWords.ModelProperties.dictMethods","specialwords.ModelPropertiesAsyncClient.dictMethodsWithResponse":"SpecialWords.ModelProperties.dictMethods","specialwords.ModelPropertiesAsyncClient.sameAsModel":"SpecialWords.ModelProperties.sameAsModel","specialwords.ModelPropertiesAsyncClient.sameAsModelWithResponse":"SpecialWords.ModelProperties.sameAsModel","specialwords.ModelPropertiesClient":"SpecialWords.ModelProperties","specialwords.ModelPropertiesClient.dictMethods":"SpecialWords.ModelProperties.dictMethods","specialwords.ModelPropertiesClient.dictMethodsWithResponse":"SpecialWords.ModelProperties.dictMethods","specialwords.ModelPropertiesClient.sameAsModel":"SpecialWords.ModelProperties.sameAsModel","specialwords.ModelPropertiesClient.sameAsModelWithResponse":"SpecialWords.ModelProperties.sameAsModel","specialwords.ModelsAsyncClient":"SpecialWords.Models","specialwords.ModelsAsyncClient.withAnd":"SpecialWords.Models.withAnd","specialwords.ModelsAsyncClient.withAndWithResponse":"SpecialWords.Models.withAnd","specialwords.ModelsAsyncClient.withAs":"SpecialWords.Models.withAs","specialwords.ModelsAsyncClient.withAsWithResponse":"SpecialWords.Models.withAs","specialwords.ModelsAsyncClient.withAssert":"SpecialWords.Models.withAssert","specialwords.ModelsAsyncClient.withAssertWithResponse":"SpecialWords.Models.withAssert","specialwords.ModelsAsyncClient.withAsyncWithResponse":"SpecialWords.Models.withAsync","specialwords.ModelsAsyncClient.withAwait":"SpecialWords.Models.withAwait","specialwords.ModelsAsyncClient.withAwaitWithResponse":"SpecialWords.Models.withAwait","specialwords.ModelsAsyncClient.withBreak":"SpecialWords.Models.withBreak","specialwords.ModelsAsyncClient.withBreakWithResponse":"SpecialWords.Models.withBreak","specialwords.ModelsAsyncClient.withClass":"SpecialWords.Models.withClass","specialwords.ModelsAsyncClient.withClassWithResponse":"SpecialWords.Models.withClass","specialwords.ModelsAsyncClient.withConstructor":"SpecialWords.Models.withConstructor","specialwords.ModelsAsyncClient.withConstructorWithResponse":"SpecialWords.Models.withConstructor","specialwords.ModelsAsyncClient.withContinue":"SpecialWords.Models.withContinue","specialwords.ModelsAsyncClient.withContinueWithResponse":"SpecialWords.Models.withContinue","specialwords.ModelsAsyncClient.withDef":"SpecialWords.Models.withDef","specialwords.ModelsAsyncClient.withDefWithResponse":"SpecialWords.Models.withDef","specialwords.ModelsAsyncClient.withDel":"SpecialWords.Models.withDel","specialwords.ModelsAsyncClient.withDelWithResponse":"SpecialWords.Models.withDel","specialwords.ModelsAsyncClient.withElif":"SpecialWords.Models.withElif","specialwords.ModelsAsyncClient.withElifWithResponse":"SpecialWords.Models.withElif","specialwords.ModelsAsyncClient.withElse":"SpecialWords.Models.withElse","specialwords.ModelsAsyncClient.withElseWithResponse":"SpecialWords.Models.withElse","specialwords.ModelsAsyncClient.withExcept":"SpecialWords.Models.withExcept","specialwords.ModelsAsyncClient.withExceptWithResponse":"SpecialWords.Models.withExcept","specialwords.ModelsAsyncClient.withExec":"SpecialWords.Models.withExec","specialwords.ModelsAsyncClient.withExecWithResponse":"SpecialWords.Models.withExec","specialwords.ModelsAsyncClient.withFinally":"SpecialWords.Models.withFinally","specialwords.ModelsAsyncClient.withFinallyWithResponse":"SpecialWords.Models.withFinally","specialwords.ModelsAsyncClient.withFor":"SpecialWords.Models.withFor","specialwords.ModelsAsyncClient.withForWithResponse":"SpecialWords.Models.withFor","specialwords.ModelsAsyncClient.withFrom":"SpecialWords.Models.withFrom","specialwords.ModelsAsyncClient.withFromWithResponse":"SpecialWords.Models.withFrom","specialwords.ModelsAsyncClient.withGlobal":"SpecialWords.Models.withGlobal","specialwords.ModelsAsyncClient.withGlobalWithResponse":"SpecialWords.Models.withGlobal","specialwords.ModelsAsyncClient.withIf":"SpecialWords.Models.withIf","specialwords.ModelsAsyncClient.withIfWithResponse":"SpecialWords.Models.withIf","specialwords.ModelsAsyncClient.withImport":"SpecialWords.Models.withImport","specialwords.ModelsAsyncClient.withImportWithResponse":"SpecialWords.Models.withImport","specialwords.ModelsAsyncClient.withIn":"SpecialWords.Models.withIn","specialwords.ModelsAsyncClient.withInWithResponse":"SpecialWords.Models.withIn","specialwords.ModelsAsyncClient.withIs":"SpecialWords.Models.withIs","specialwords.ModelsAsyncClient.withIsWithResponse":"SpecialWords.Models.withIs","specialwords.ModelsAsyncClient.withLambda":"SpecialWords.Models.withLambda","specialwords.ModelsAsyncClient.withLambdaWithResponse":"SpecialWords.Models.withLambda","specialwords.ModelsAsyncClient.withNot":"SpecialWords.Models.withNot","specialwords.ModelsAsyncClient.withNotWithResponse":"SpecialWords.Models.withNot","specialwords.ModelsAsyncClient.withOr":"SpecialWords.Models.withOr","specialwords.ModelsAsyncClient.withOrWithResponse":"SpecialWords.Models.withOr","specialwords.ModelsAsyncClient.withPass":"SpecialWords.Models.withPass","specialwords.ModelsAsyncClient.withPassWithResponse":"SpecialWords.Models.withPass","specialwords.ModelsAsyncClient.withRaise":"SpecialWords.Models.withRaise","specialwords.ModelsAsyncClient.withRaiseWithResponse":"SpecialWords.Models.withRaise","specialwords.ModelsAsyncClient.withReturn":"SpecialWords.Models.withReturn","specialwords.ModelsAsyncClient.withReturnWithResponse":"SpecialWords.Models.withReturn","specialwords.ModelsAsyncClient.withTry":"SpecialWords.Models.withTry","specialwords.ModelsAsyncClient.withTryWithResponse":"SpecialWords.Models.withTry","specialwords.ModelsAsyncClient.withWhile":"SpecialWords.Models.withWhile","specialwords.ModelsAsyncClient.withWhileWithResponse":"SpecialWords.Models.withWhile","specialwords.ModelsAsyncClient.withWith":"SpecialWords.Models.withWith","specialwords.ModelsAsyncClient.withWithWithResponse":"SpecialWords.Models.withWith","specialwords.ModelsAsyncClient.withYield":"SpecialWords.Models.withYield","specialwords.ModelsAsyncClient.withYieldWithResponse":"SpecialWords.Models.withYield","specialwords.ModelsClient":"SpecialWords.Models","specialwords.ModelsClient.withAnd":"SpecialWords.Models.withAnd","specialwords.ModelsClient.withAndWithResponse":"SpecialWords.Models.withAnd","specialwords.ModelsClient.withAs":"SpecialWords.Models.withAs","specialwords.ModelsClient.withAsWithResponse":"SpecialWords.Models.withAs","specialwords.ModelsClient.withAssert":"SpecialWords.Models.withAssert","specialwords.ModelsClient.withAssertWithResponse":"SpecialWords.Models.withAssert","specialwords.ModelsClient.withAsyncWithResponse":"SpecialWords.Models.withAsync","specialwords.ModelsClient.withAwait":"SpecialWords.Models.withAwait","specialwords.ModelsClient.withAwaitWithResponse":"SpecialWords.Models.withAwait","specialwords.ModelsClient.withBreak":"SpecialWords.Models.withBreak","specialwords.ModelsClient.withBreakWithResponse":"SpecialWords.Models.withBreak","specialwords.ModelsClient.withClass":"SpecialWords.Models.withClass","specialwords.ModelsClient.withClassWithResponse":"SpecialWords.Models.withClass","specialwords.ModelsClient.withConstructor":"SpecialWords.Models.withConstructor","specialwords.ModelsClient.withConstructorWithResponse":"SpecialWords.Models.withConstructor","specialwords.ModelsClient.withContinue":"SpecialWords.Models.withContinue","specialwords.ModelsClient.withContinueWithResponse":"SpecialWords.Models.withContinue","specialwords.ModelsClient.withDef":"SpecialWords.Models.withDef","specialwords.ModelsClient.withDefWithResponse":"SpecialWords.Models.withDef","specialwords.ModelsClient.withDel":"SpecialWords.Models.withDel","specialwords.ModelsClient.withDelWithResponse":"SpecialWords.Models.withDel","specialwords.ModelsClient.withElif":"SpecialWords.Models.withElif","specialwords.ModelsClient.withElifWithResponse":"SpecialWords.Models.withElif","specialwords.ModelsClient.withElse":"SpecialWords.Models.withElse","specialwords.ModelsClient.withElseWithResponse":"SpecialWords.Models.withElse","specialwords.ModelsClient.withExcept":"SpecialWords.Models.withExcept","specialwords.ModelsClient.withExceptWithResponse":"SpecialWords.Models.withExcept","specialwords.ModelsClient.withExec":"SpecialWords.Models.withExec","specialwords.ModelsClient.withExecWithResponse":"SpecialWords.Models.withExec","specialwords.ModelsClient.withFinally":"SpecialWords.Models.withFinally","specialwords.ModelsClient.withFinallyWithResponse":"SpecialWords.Models.withFinally","specialwords.ModelsClient.withFor":"SpecialWords.Models.withFor","specialwords.ModelsClient.withForWithResponse":"SpecialWords.Models.withFor","specialwords.ModelsClient.withFrom":"SpecialWords.Models.withFrom","specialwords.ModelsClient.withFromWithResponse":"SpecialWords.Models.withFrom","specialwords.ModelsClient.withGlobal":"SpecialWords.Models.withGlobal","specialwords.ModelsClient.withGlobalWithResponse":"SpecialWords.Models.withGlobal","specialwords.ModelsClient.withIf":"SpecialWords.Models.withIf","specialwords.ModelsClient.withIfWithResponse":"SpecialWords.Models.withIf","specialwords.ModelsClient.withImport":"SpecialWords.Models.withImport","specialwords.ModelsClient.withImportWithResponse":"SpecialWords.Models.withImport","specialwords.ModelsClient.withIn":"SpecialWords.Models.withIn","specialwords.ModelsClient.withInWithResponse":"SpecialWords.Models.withIn","specialwords.ModelsClient.withIs":"SpecialWords.Models.withIs","specialwords.ModelsClient.withIsWithResponse":"SpecialWords.Models.withIs","specialwords.ModelsClient.withLambda":"SpecialWords.Models.withLambda","specialwords.ModelsClient.withLambdaWithResponse":"SpecialWords.Models.withLambda","specialwords.ModelsClient.withNot":"SpecialWords.Models.withNot","specialwords.ModelsClient.withNotWithResponse":"SpecialWords.Models.withNot","specialwords.ModelsClient.withOr":"SpecialWords.Models.withOr","specialwords.ModelsClient.withOrWithResponse":"SpecialWords.Models.withOr","specialwords.ModelsClient.withPass":"SpecialWords.Models.withPass","specialwords.ModelsClient.withPassWithResponse":"SpecialWords.Models.withPass","specialwords.ModelsClient.withRaise":"SpecialWords.Models.withRaise","specialwords.ModelsClient.withRaiseWithResponse":"SpecialWords.Models.withRaise","specialwords.ModelsClient.withReturn":"SpecialWords.Models.withReturn","specialwords.ModelsClient.withReturnWithResponse":"SpecialWords.Models.withReturn","specialwords.ModelsClient.withTry":"SpecialWords.Models.withTry","specialwords.ModelsClient.withTryWithResponse":"SpecialWords.Models.withTry","specialwords.ModelsClient.withWhile":"SpecialWords.Models.withWhile","specialwords.ModelsClient.withWhileWithResponse":"SpecialWords.Models.withWhile","specialwords.ModelsClient.withWith":"SpecialWords.Models.withWith","specialwords.ModelsClient.withWithWithResponse":"SpecialWords.Models.withWith","specialwords.ModelsClient.withYield":"SpecialWords.Models.withYield","specialwords.ModelsClient.withYieldWithResponse":"SpecialWords.Models.withYield","specialwords.OperationsAsyncClient":"SpecialWords.Operations","specialwords.OperationsAsyncClient.and":"SpecialWords.Operations.and","specialwords.OperationsAsyncClient.andWithResponse":"SpecialWords.Operations.and","specialwords.OperationsAsyncClient.as":"SpecialWords.Operations.as","specialwords.OperationsAsyncClient.asWithResponse":"SpecialWords.Operations.as","specialwords.OperationsAsyncClient.assertMethod":"SpecialWords.Operations.assert","specialwords.OperationsAsyncClient.assertMethodWithResponse":"SpecialWords.Operations.assert","specialwords.OperationsAsyncClient.async":"SpecialWords.Operations.async","specialwords.OperationsAsyncClient.asyncWithResponse":"SpecialWords.Operations.async","specialwords.OperationsAsyncClient.await":"SpecialWords.Operations.await","specialwords.OperationsAsyncClient.awaitWithResponse":"SpecialWords.Operations.await","specialwords.OperationsAsyncClient.breakMethod":"SpecialWords.Operations.break","specialwords.OperationsAsyncClient.breakMethodWithResponse":"SpecialWords.Operations.break","specialwords.OperationsAsyncClient.classMethod":"SpecialWords.Operations.class","specialwords.OperationsAsyncClient.classMethodWithResponse":"SpecialWords.Operations.class","specialwords.OperationsAsyncClient.constructor":"SpecialWords.Operations.constructor","specialwords.OperationsAsyncClient.constructorWithResponse":"SpecialWords.Operations.constructor","specialwords.OperationsAsyncClient.continueMethod":"SpecialWords.Operations.continue","specialwords.OperationsAsyncClient.continueMethodWithResponse":"SpecialWords.Operations.continue","specialwords.OperationsAsyncClient.def":"SpecialWords.Operations.def","specialwords.OperationsAsyncClient.defWithResponse":"SpecialWords.Operations.def","specialwords.OperationsAsyncClient.del":"SpecialWords.Operations.del","specialwords.OperationsAsyncClient.delWithResponse":"SpecialWords.Operations.del","specialwords.OperationsAsyncClient.elif":"SpecialWords.Operations.elif","specialwords.OperationsAsyncClient.elifWithResponse":"SpecialWords.Operations.elif","specialwords.OperationsAsyncClient.elseMethod":"SpecialWords.Operations.else","specialwords.OperationsAsyncClient.elseMethodWithResponse":"SpecialWords.Operations.else","specialwords.OperationsAsyncClient.except":"SpecialWords.Operations.except","specialwords.OperationsAsyncClient.exceptWithResponse":"SpecialWords.Operations.except","specialwords.OperationsAsyncClient.exec":"SpecialWords.Operations.exec","specialwords.OperationsAsyncClient.execWithResponse":"SpecialWords.Operations.exec","specialwords.OperationsAsyncClient.finallyMethod":"SpecialWords.Operations.finally","specialwords.OperationsAsyncClient.finallyMethodWithResponse":"SpecialWords.Operations.finally","specialwords.OperationsAsyncClient.forMethod":"SpecialWords.Operations.for","specialwords.OperationsAsyncClient.forMethodWithResponse":"SpecialWords.Operations.for","specialwords.OperationsAsyncClient.from":"SpecialWords.Operations.from","specialwords.OperationsAsyncClient.fromWithResponse":"SpecialWords.Operations.from","specialwords.OperationsAsyncClient.global":"SpecialWords.Operations.global","specialwords.OperationsAsyncClient.globalWithResponse":"SpecialWords.Operations.global","specialwords.OperationsAsyncClient.ifMethod":"SpecialWords.Operations.if","specialwords.OperationsAsyncClient.ifMethodWithResponse":"SpecialWords.Operations.if","specialwords.OperationsAsyncClient.importMethod":"SpecialWords.Operations.import","specialwords.OperationsAsyncClient.importMethodWithResponse":"SpecialWords.Operations.import","specialwords.OperationsAsyncClient.in":"SpecialWords.Operations.in","specialwords.OperationsAsyncClient.inWithResponse":"SpecialWords.Operations.in","specialwords.OperationsAsyncClient.is":"SpecialWords.Operations.is","specialwords.OperationsAsyncClient.isWithResponse":"SpecialWords.Operations.is","specialwords.OperationsAsyncClient.lambda":"SpecialWords.Operations.lambda","specialwords.OperationsAsyncClient.lambdaWithResponse":"SpecialWords.Operations.lambda","specialwords.OperationsAsyncClient.not":"SpecialWords.Operations.not","specialwords.OperationsAsyncClient.notWithResponse":"SpecialWords.Operations.not","specialwords.OperationsAsyncClient.or":"SpecialWords.Operations.or","specialwords.OperationsAsyncClient.orWithResponse":"SpecialWords.Operations.or","specialwords.OperationsAsyncClient.pass":"SpecialWords.Operations.pass","specialwords.OperationsAsyncClient.passWithResponse":"SpecialWords.Operations.pass","specialwords.OperationsAsyncClient.raise":"SpecialWords.Operations.raise","specialwords.OperationsAsyncClient.raiseWithResponse":"SpecialWords.Operations.raise","specialwords.OperationsAsyncClient.returnMethod":"SpecialWords.Operations.return","specialwords.OperationsAsyncClient.returnMethodWithResponse":"SpecialWords.Operations.return","specialwords.OperationsAsyncClient.tryMethod":"SpecialWords.Operations.try","specialwords.OperationsAsyncClient.tryMethodWithResponse":"SpecialWords.Operations.try","specialwords.OperationsAsyncClient.whileMethod":"SpecialWords.Operations.while","specialwords.OperationsAsyncClient.whileMethodWithResponse":"SpecialWords.Operations.while","specialwords.OperationsAsyncClient.with":"SpecialWords.Operations.with","specialwords.OperationsAsyncClient.withWithResponse":"SpecialWords.Operations.with","specialwords.OperationsAsyncClient.yield":"SpecialWords.Operations.yield","specialwords.OperationsAsyncClient.yieldWithResponse":"SpecialWords.Operations.yield","specialwords.OperationsClient":"SpecialWords.Operations","specialwords.OperationsClient.and":"SpecialWords.Operations.and","specialwords.OperationsClient.andWithResponse":"SpecialWords.Operations.and","specialwords.OperationsClient.as":"SpecialWords.Operations.as","specialwords.OperationsClient.asWithResponse":"SpecialWords.Operations.as","specialwords.OperationsClient.assertMethod":"SpecialWords.Operations.assert","specialwords.OperationsClient.assertMethodWithResponse":"SpecialWords.Operations.assert","specialwords.OperationsClient.async":"SpecialWords.Operations.async","specialwords.OperationsClient.asyncWithResponse":"SpecialWords.Operations.async","specialwords.OperationsClient.await":"SpecialWords.Operations.await","specialwords.OperationsClient.awaitWithResponse":"SpecialWords.Operations.await","specialwords.OperationsClient.breakMethod":"SpecialWords.Operations.break","specialwords.OperationsClient.breakMethodWithResponse":"SpecialWords.Operations.break","specialwords.OperationsClient.classMethod":"SpecialWords.Operations.class","specialwords.OperationsClient.classMethodWithResponse":"SpecialWords.Operations.class","specialwords.OperationsClient.constructor":"SpecialWords.Operations.constructor","specialwords.OperationsClient.constructorWithResponse":"SpecialWords.Operations.constructor","specialwords.OperationsClient.continueMethod":"SpecialWords.Operations.continue","specialwords.OperationsClient.continueMethodWithResponse":"SpecialWords.Operations.continue","specialwords.OperationsClient.def":"SpecialWords.Operations.def","specialwords.OperationsClient.defWithResponse":"SpecialWords.Operations.def","specialwords.OperationsClient.del":"SpecialWords.Operations.del","specialwords.OperationsClient.delWithResponse":"SpecialWords.Operations.del","specialwords.OperationsClient.elif":"SpecialWords.Operations.elif","specialwords.OperationsClient.elifWithResponse":"SpecialWords.Operations.elif","specialwords.OperationsClient.elseMethod":"SpecialWords.Operations.else","specialwords.OperationsClient.elseMethodWithResponse":"SpecialWords.Operations.else","specialwords.OperationsClient.except":"SpecialWords.Operations.except","specialwords.OperationsClient.exceptWithResponse":"SpecialWords.Operations.except","specialwords.OperationsClient.exec":"SpecialWords.Operations.exec","specialwords.OperationsClient.execWithResponse":"SpecialWords.Operations.exec","specialwords.OperationsClient.finallyMethod":"SpecialWords.Operations.finally","specialwords.OperationsClient.finallyMethodWithResponse":"SpecialWords.Operations.finally","specialwords.OperationsClient.forMethod":"SpecialWords.Operations.for","specialwords.OperationsClient.forMethodWithResponse":"SpecialWords.Operations.for","specialwords.OperationsClient.from":"SpecialWords.Operations.from","specialwords.OperationsClient.fromWithResponse":"SpecialWords.Operations.from","specialwords.OperationsClient.global":"SpecialWords.Operations.global","specialwords.OperationsClient.globalWithResponse":"SpecialWords.Operations.global","specialwords.OperationsClient.ifMethod":"SpecialWords.Operations.if","specialwords.OperationsClient.ifMethodWithResponse":"SpecialWords.Operations.if","specialwords.OperationsClient.importMethod":"SpecialWords.Operations.import","specialwords.OperationsClient.importMethodWithResponse":"SpecialWords.Operations.import","specialwords.OperationsClient.in":"SpecialWords.Operations.in","specialwords.OperationsClient.inWithResponse":"SpecialWords.Operations.in","specialwords.OperationsClient.is":"SpecialWords.Operations.is","specialwords.OperationsClient.isWithResponse":"SpecialWords.Operations.is","specialwords.OperationsClient.lambda":"SpecialWords.Operations.lambda","specialwords.OperationsClient.lambdaWithResponse":"SpecialWords.Operations.lambda","specialwords.OperationsClient.not":"SpecialWords.Operations.not","specialwords.OperationsClient.notWithResponse":"SpecialWords.Operations.not","specialwords.OperationsClient.or":"SpecialWords.Operations.or","specialwords.OperationsClient.orWithResponse":"SpecialWords.Operations.or","specialwords.OperationsClient.pass":"SpecialWords.Operations.pass","specialwords.OperationsClient.passWithResponse":"SpecialWords.Operations.pass","specialwords.OperationsClient.raise":"SpecialWords.Operations.raise","specialwords.OperationsClient.raiseWithResponse":"SpecialWords.Operations.raise","specialwords.OperationsClient.returnMethod":"SpecialWords.Operations.return","specialwords.OperationsClient.returnMethodWithResponse":"SpecialWords.Operations.return","specialwords.OperationsClient.tryMethod":"SpecialWords.Operations.try","specialwords.OperationsClient.tryMethodWithResponse":"SpecialWords.Operations.try","specialwords.OperationsClient.whileMethod":"SpecialWords.Operations.while","specialwords.OperationsClient.whileMethodWithResponse":"SpecialWords.Operations.while","specialwords.OperationsClient.with":"SpecialWords.Operations.with","specialwords.OperationsClient.withWithResponse":"SpecialWords.Operations.with","specialwords.OperationsClient.yield":"SpecialWords.Operations.yield","specialwords.OperationsClient.yieldWithResponse":"SpecialWords.Operations.yield","specialwords.ParametersAsyncClient":"SpecialWords.Parameters","specialwords.ParametersAsyncClient.withAnd":"SpecialWords.Parameters.withAnd","specialwords.ParametersAsyncClient.withAndWithResponse":"SpecialWords.Parameters.withAnd","specialwords.ParametersAsyncClient.withAs":"SpecialWords.Parameters.withAs","specialwords.ParametersAsyncClient.withAsWithResponse":"SpecialWords.Parameters.withAs","specialwords.ParametersAsyncClient.withAssert":"SpecialWords.Parameters.withAssert","specialwords.ParametersAsyncClient.withAssertWithResponse":"SpecialWords.Parameters.withAssert","specialwords.ParametersAsyncClient.withAsyncWithResponse":"SpecialWords.Parameters.withAsync","specialwords.ParametersAsyncClient.withAwait":"SpecialWords.Parameters.withAwait","specialwords.ParametersAsyncClient.withAwaitWithResponse":"SpecialWords.Parameters.withAwait","specialwords.ParametersAsyncClient.withBreak":"SpecialWords.Parameters.withBreak","specialwords.ParametersAsyncClient.withBreakWithResponse":"SpecialWords.Parameters.withBreak","specialwords.ParametersAsyncClient.withCancellationToken":"SpecialWords.Parameters.withCancellationToken","specialwords.ParametersAsyncClient.withCancellationTokenWithResponse":"SpecialWords.Parameters.withCancellationToken","specialwords.ParametersAsyncClient.withClass":"SpecialWords.Parameters.withClass","specialwords.ParametersAsyncClient.withClassWithResponse":"SpecialWords.Parameters.withClass","specialwords.ParametersAsyncClient.withConstructor":"SpecialWords.Parameters.withConstructor","specialwords.ParametersAsyncClient.withConstructorWithResponse":"SpecialWords.Parameters.withConstructor","specialwords.ParametersAsyncClient.withContinue":"SpecialWords.Parameters.withContinue","specialwords.ParametersAsyncClient.withContinueWithResponse":"SpecialWords.Parameters.withContinue","specialwords.ParametersAsyncClient.withDef":"SpecialWords.Parameters.withDef","specialwords.ParametersAsyncClient.withDefWithResponse":"SpecialWords.Parameters.withDef","specialwords.ParametersAsyncClient.withDel":"SpecialWords.Parameters.withDel","specialwords.ParametersAsyncClient.withDelWithResponse":"SpecialWords.Parameters.withDel","specialwords.ParametersAsyncClient.withElif":"SpecialWords.Parameters.withElif","specialwords.ParametersAsyncClient.withElifWithResponse":"SpecialWords.Parameters.withElif","specialwords.ParametersAsyncClient.withElse":"SpecialWords.Parameters.withElse","specialwords.ParametersAsyncClient.withElseWithResponse":"SpecialWords.Parameters.withElse","specialwords.ParametersAsyncClient.withExcept":"SpecialWords.Parameters.withExcept","specialwords.ParametersAsyncClient.withExceptWithResponse":"SpecialWords.Parameters.withExcept","specialwords.ParametersAsyncClient.withExec":"SpecialWords.Parameters.withExec","specialwords.ParametersAsyncClient.withExecWithResponse":"SpecialWords.Parameters.withExec","specialwords.ParametersAsyncClient.withFinally":"SpecialWords.Parameters.withFinally","specialwords.ParametersAsyncClient.withFinallyWithResponse":"SpecialWords.Parameters.withFinally","specialwords.ParametersAsyncClient.withFor":"SpecialWords.Parameters.withFor","specialwords.ParametersAsyncClient.withForWithResponse":"SpecialWords.Parameters.withFor","specialwords.ParametersAsyncClient.withFrom":"SpecialWords.Parameters.withFrom","specialwords.ParametersAsyncClient.withFromWithResponse":"SpecialWords.Parameters.withFrom","specialwords.ParametersAsyncClient.withGlobal":"SpecialWords.Parameters.withGlobal","specialwords.ParametersAsyncClient.withGlobalWithResponse":"SpecialWords.Parameters.withGlobal","specialwords.ParametersAsyncClient.withIf":"SpecialWords.Parameters.withIf","specialwords.ParametersAsyncClient.withIfWithResponse":"SpecialWords.Parameters.withIf","specialwords.ParametersAsyncClient.withImport":"SpecialWords.Parameters.withImport","specialwords.ParametersAsyncClient.withImportWithResponse":"SpecialWords.Parameters.withImport","specialwords.ParametersAsyncClient.withIn":"SpecialWords.Parameters.withIn","specialwords.ParametersAsyncClient.withInWithResponse":"SpecialWords.Parameters.withIn","specialwords.ParametersAsyncClient.withIs":"SpecialWords.Parameters.withIs","specialwords.ParametersAsyncClient.withIsWithResponse":"SpecialWords.Parameters.withIs","specialwords.ParametersAsyncClient.withLambda":"SpecialWords.Parameters.withLambda","specialwords.ParametersAsyncClient.withLambdaWithResponse":"SpecialWords.Parameters.withLambda","specialwords.ParametersAsyncClient.withNot":"SpecialWords.Parameters.withNot","specialwords.ParametersAsyncClient.withNotWithResponse":"SpecialWords.Parameters.withNot","specialwords.ParametersAsyncClient.withOr":"SpecialWords.Parameters.withOr","specialwords.ParametersAsyncClient.withOrWithResponse":"SpecialWords.Parameters.withOr","specialwords.ParametersAsyncClient.withPass":"SpecialWords.Parameters.withPass","specialwords.ParametersAsyncClient.withPassWithResponse":"SpecialWords.Parameters.withPass","specialwords.ParametersAsyncClient.withRaise":"SpecialWords.Parameters.withRaise","specialwords.ParametersAsyncClient.withRaiseWithResponse":"SpecialWords.Parameters.withRaise","specialwords.ParametersAsyncClient.withReturn":"SpecialWords.Parameters.withReturn","specialwords.ParametersAsyncClient.withReturnWithResponse":"SpecialWords.Parameters.withReturn","specialwords.ParametersAsyncClient.withTry":"SpecialWords.Parameters.withTry","specialwords.ParametersAsyncClient.withTryWithResponse":"SpecialWords.Parameters.withTry","specialwords.ParametersAsyncClient.withWhile":"SpecialWords.Parameters.withWhile","specialwords.ParametersAsyncClient.withWhileWithResponse":"SpecialWords.Parameters.withWhile","specialwords.ParametersAsyncClient.withWith":"SpecialWords.Parameters.withWith","specialwords.ParametersAsyncClient.withWithWithResponse":"SpecialWords.Parameters.withWith","specialwords.ParametersAsyncClient.withYield":"SpecialWords.Parameters.withYield","specialwords.ParametersAsyncClient.withYieldWithResponse":"SpecialWords.Parameters.withYield","specialwords.ParametersClient":"SpecialWords.Parameters","specialwords.ParametersClient.withAnd":"SpecialWords.Parameters.withAnd","specialwords.ParametersClient.withAndWithResponse":"SpecialWords.Parameters.withAnd","specialwords.ParametersClient.withAs":"SpecialWords.Parameters.withAs","specialwords.ParametersClient.withAsWithResponse":"SpecialWords.Parameters.withAs","specialwords.ParametersClient.withAssert":"SpecialWords.Parameters.withAssert","specialwords.ParametersClient.withAssertWithResponse":"SpecialWords.Parameters.withAssert","specialwords.ParametersClient.withAsyncWithResponse":"SpecialWords.Parameters.withAsync","specialwords.ParametersClient.withAwait":"SpecialWords.Parameters.withAwait","specialwords.ParametersClient.withAwaitWithResponse":"SpecialWords.Parameters.withAwait","specialwords.ParametersClient.withBreak":"SpecialWords.Parameters.withBreak","specialwords.ParametersClient.withBreakWithResponse":"SpecialWords.Parameters.withBreak","specialwords.ParametersClient.withCancellationToken":"SpecialWords.Parameters.withCancellationToken","specialwords.ParametersClient.withCancellationTokenWithResponse":"SpecialWords.Parameters.withCancellationToken","specialwords.ParametersClient.withClass":"SpecialWords.Parameters.withClass","specialwords.ParametersClient.withClassWithResponse":"SpecialWords.Parameters.withClass","specialwords.ParametersClient.withConstructor":"SpecialWords.Parameters.withConstructor","specialwords.ParametersClient.withConstructorWithResponse":"SpecialWords.Parameters.withConstructor","specialwords.ParametersClient.withContinue":"SpecialWords.Parameters.withContinue","specialwords.ParametersClient.withContinueWithResponse":"SpecialWords.Parameters.withContinue","specialwords.ParametersClient.withDef":"SpecialWords.Parameters.withDef","specialwords.ParametersClient.withDefWithResponse":"SpecialWords.Parameters.withDef","specialwords.ParametersClient.withDel":"SpecialWords.Parameters.withDel","specialwords.ParametersClient.withDelWithResponse":"SpecialWords.Parameters.withDel","specialwords.ParametersClient.withElif":"SpecialWords.Parameters.withElif","specialwords.ParametersClient.withElifWithResponse":"SpecialWords.Parameters.withElif","specialwords.ParametersClient.withElse":"SpecialWords.Parameters.withElse","specialwords.ParametersClient.withElseWithResponse":"SpecialWords.Parameters.withElse","specialwords.ParametersClient.withExcept":"SpecialWords.Parameters.withExcept","specialwords.ParametersClient.withExceptWithResponse":"SpecialWords.Parameters.withExcept","specialwords.ParametersClient.withExec":"SpecialWords.Parameters.withExec","specialwords.ParametersClient.withExecWithResponse":"SpecialWords.Parameters.withExec","specialwords.ParametersClient.withFinally":"SpecialWords.Parameters.withFinally","specialwords.ParametersClient.withFinallyWithResponse":"SpecialWords.Parameters.withFinally","specialwords.ParametersClient.withFor":"SpecialWords.Parameters.withFor","specialwords.ParametersClient.withForWithResponse":"SpecialWords.Parameters.withFor","specialwords.ParametersClient.withFrom":"SpecialWords.Parameters.withFrom","specialwords.ParametersClient.withFromWithResponse":"SpecialWords.Parameters.withFrom","specialwords.ParametersClient.withGlobal":"SpecialWords.Parameters.withGlobal","specialwords.ParametersClient.withGlobalWithResponse":"SpecialWords.Parameters.withGlobal","specialwords.ParametersClient.withIf":"SpecialWords.Parameters.withIf","specialwords.ParametersClient.withIfWithResponse":"SpecialWords.Parameters.withIf","specialwords.ParametersClient.withImport":"SpecialWords.Parameters.withImport","specialwords.ParametersClient.withImportWithResponse":"SpecialWords.Parameters.withImport","specialwords.ParametersClient.withIn":"SpecialWords.Parameters.withIn","specialwords.ParametersClient.withInWithResponse":"SpecialWords.Parameters.withIn","specialwords.ParametersClient.withIs":"SpecialWords.Parameters.withIs","specialwords.ParametersClient.withIsWithResponse":"SpecialWords.Parameters.withIs","specialwords.ParametersClient.withLambda":"SpecialWords.Parameters.withLambda","specialwords.ParametersClient.withLambdaWithResponse":"SpecialWords.Parameters.withLambda","specialwords.ParametersClient.withNot":"SpecialWords.Parameters.withNot","specialwords.ParametersClient.withNotWithResponse":"SpecialWords.Parameters.withNot","specialwords.ParametersClient.withOr":"SpecialWords.Parameters.withOr","specialwords.ParametersClient.withOrWithResponse":"SpecialWords.Parameters.withOr","specialwords.ParametersClient.withPass":"SpecialWords.Parameters.withPass","specialwords.ParametersClient.withPassWithResponse":"SpecialWords.Parameters.withPass","specialwords.ParametersClient.withRaise":"SpecialWords.Parameters.withRaise","specialwords.ParametersClient.withRaiseWithResponse":"SpecialWords.Parameters.withRaise","specialwords.ParametersClient.withReturn":"SpecialWords.Parameters.withReturn","specialwords.ParametersClient.withReturnWithResponse":"SpecialWords.Parameters.withReturn","specialwords.ParametersClient.withTry":"SpecialWords.Parameters.withTry","specialwords.ParametersClient.withTryWithResponse":"SpecialWords.Parameters.withTry","specialwords.ParametersClient.withWhile":"SpecialWords.Parameters.withWhile","specialwords.ParametersClient.withWhileWithResponse":"SpecialWords.Parameters.withWhile","specialwords.ParametersClient.withWith":"SpecialWords.Parameters.withWith","specialwords.ParametersClient.withWithWithResponse":"SpecialWords.Parameters.withWith","specialwords.ParametersClient.withYield":"SpecialWords.Parameters.withYield","specialwords.ParametersClient.withYieldWithResponse":"SpecialWords.Parameters.withYield","specialwords.SpecialWordsClientBuilder":"SpecialWords","specialwords.modelproperties.models.DictMethods":"SpecialWords.ModelProperties.DictMethods","specialwords.modelproperties.models.SameAsModel":"SpecialWords.ModelProperties.SameAsModel","specialwords.models.models.And":"SpecialWords.Models.and","specialwords.models.models.As":"SpecialWords.Models.as","specialwords.models.models.Assert":"SpecialWords.Models.assert","specialwords.models.models.Async":"SpecialWords.Models.async","specialwords.models.models.Await":"SpecialWords.Models.await","specialwords.models.models.Break":"SpecialWords.Models.break","specialwords.models.models.ClassModel":"SpecialWords.Models.class","specialwords.models.models.Constructor":"SpecialWords.Models.constructor","specialwords.models.models.Continue":"SpecialWords.Models.continue","specialwords.models.models.Def":"SpecialWords.Models.def","specialwords.models.models.Del":"SpecialWords.Models.del","specialwords.models.models.Elif":"SpecialWords.Models.elif","specialwords.models.models.Else":"SpecialWords.Models.else","specialwords.models.models.Except":"SpecialWords.Models.except","specialwords.models.models.Exec":"SpecialWords.Models.exec","specialwords.models.models.Finally":"SpecialWords.Models.finally","specialwords.models.models.For":"SpecialWords.Models.for","specialwords.models.models.From":"SpecialWords.Models.from","specialwords.models.models.Global":"SpecialWords.Models.global","specialwords.models.models.If":"SpecialWords.Models.if","specialwords.models.models.Import":"SpecialWords.Models.import","specialwords.models.models.In":"SpecialWords.Models.in","specialwords.models.models.Is":"SpecialWords.Models.is","specialwords.models.models.Lambda":"SpecialWords.Models.lambda","specialwords.models.models.Not":"SpecialWords.Models.not","specialwords.models.models.Or":"SpecialWords.Models.or","specialwords.models.models.Pass":"SpecialWords.Models.pass","specialwords.models.models.Raise":"SpecialWords.Models.raise","specialwords.models.models.Return":"SpecialWords.Models.return","specialwords.models.models.Try":"SpecialWords.Models.try","specialwords.models.models.While":"SpecialWords.Models.while","specialwords.models.models.With":"SpecialWords.Models.with","specialwords.models.models.Yield":"SpecialWords.Models.yield"},"generatedFiles":["src/main/java/module-info.java","src/main/java/specialwords/ModelPropertiesAsyncClient.java","src/main/java/specialwords/ModelPropertiesClient.java","src/main/java/specialwords/ModelsAsyncClient.java","src/main/java/specialwords/ModelsClient.java","src/main/java/specialwords/OperationsAsyncClient.java","src/main/java/specialwords/OperationsClient.java","src/main/java/specialwords/ParametersAsyncClient.java","src/main/java/specialwords/ParametersClient.java","src/main/java/specialwords/SpecialWordsClientBuilder.java","src/main/java/specialwords/implementation/ModelPropertiesImpl.java","src/main/java/specialwords/implementation/ModelsImpl.java","src/main/java/specialwords/implementation/OperationsImpl.java","src/main/java/specialwords/implementation/ParametersImpl.java","src/main/java/specialwords/implementation/SpecialWordsClientImpl.java","src/main/java/specialwords/implementation/package-info.java","src/main/java/specialwords/modelproperties/models/DictMethods.java","src/main/java/specialwords/modelproperties/models/SameAsModel.java","src/main/java/specialwords/modelproperties/models/package-info.java","src/main/java/specialwords/models/models/And.java","src/main/java/specialwords/models/models/As.java","src/main/java/specialwords/models/models/Assert.java","src/main/java/specialwords/models/models/Async.java","src/main/java/specialwords/models/models/Await.java","src/main/java/specialwords/models/models/Break.java","src/main/java/specialwords/models/models/ClassModel.java","src/main/java/specialwords/models/models/Constructor.java","src/main/java/specialwords/models/models/Continue.java","src/main/java/specialwords/models/models/Def.java","src/main/java/specialwords/models/models/Del.java","src/main/java/specialwords/models/models/Elif.java","src/main/java/specialwords/models/models/Else.java","src/main/java/specialwords/models/models/Except.java","src/main/java/specialwords/models/models/Exec.java","src/main/java/specialwords/models/models/Finally.java","src/main/java/specialwords/models/models/For.java","src/main/java/specialwords/models/models/From.java","src/main/java/specialwords/models/models/Global.java","src/main/java/specialwords/models/models/If.java","src/main/java/specialwords/models/models/Import.java","src/main/java/specialwords/models/models/In.java","src/main/java/specialwords/models/models/Is.java","src/main/java/specialwords/models/models/Lambda.java","src/main/java/specialwords/models/models/Not.java","src/main/java/specialwords/models/models/Or.java","src/main/java/specialwords/models/models/Pass.java","src/main/java/specialwords/models/models/Raise.java","src/main/java/specialwords/models/models/Return.java","src/main/java/specialwords/models/models/Try.java","src/main/java/specialwords/models/models/While.java","src/main/java/specialwords/models/models/With.java","src/main/java/specialwords/models/models/Yield.java","src/main/java/specialwords/models/models/package-info.java","src/main/java/specialwords/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_apiview_properties.json deleted file mode 100644 index 3deb2426e93..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_apiview_properties.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "streaming.jsonl.JsonlAsyncClient": "Streaming.Jsonl.Basic", - "streaming.jsonl.JsonlAsyncClient.receive": "Streaming.Jsonl.Basic.receive", - "streaming.jsonl.JsonlAsyncClient.receiveWithResponse": "Streaming.Jsonl.Basic.receive", - "streaming.jsonl.JsonlAsyncClient.send": "Streaming.Jsonl.Basic.send", - "streaming.jsonl.JsonlAsyncClient.sendWithResponse": "Streaming.Jsonl.Basic.send", - "streaming.jsonl.JsonlClient": "Streaming.Jsonl.Basic", - "streaming.jsonl.JsonlClient.receive": "Streaming.Jsonl.Basic.receive", - "streaming.jsonl.JsonlClient.receiveWithResponse": "Streaming.Jsonl.Basic.receive", - "streaming.jsonl.JsonlClient.send": "Streaming.Jsonl.Basic.send", - "streaming.jsonl.JsonlClient.sendWithResponse": "Streaming.Jsonl.Basic.send", - "streaming.jsonl.JsonlClientBuilder": "Streaming.Jsonl" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_metadata.json deleted file mode 100644 index 28c0c75f2ce..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"streaming.jsonl.JsonlAsyncClient":"Streaming.Jsonl.Basic","streaming.jsonl.JsonlAsyncClient.receive":"Streaming.Jsonl.Basic.receive","streaming.jsonl.JsonlAsyncClient.receiveWithResponse":"Streaming.Jsonl.Basic.receive","streaming.jsonl.JsonlAsyncClient.send":"Streaming.Jsonl.Basic.send","streaming.jsonl.JsonlAsyncClient.sendWithResponse":"Streaming.Jsonl.Basic.send","streaming.jsonl.JsonlClient":"Streaming.Jsonl.Basic","streaming.jsonl.JsonlClient.receive":"Streaming.Jsonl.Basic.receive","streaming.jsonl.JsonlClient.receiveWithResponse":"Streaming.Jsonl.Basic.receive","streaming.jsonl.JsonlClient.send":"Streaming.Jsonl.Basic.send","streaming.jsonl.JsonlClient.sendWithResponse":"Streaming.Jsonl.Basic.send","streaming.jsonl.JsonlClientBuilder":"Streaming.Jsonl"},"generatedFiles":["src/main/java/module-info.java","src/main/java/streaming/jsonl/JsonlAsyncClient.java","src/main/java/streaming/jsonl/JsonlClient.java","src/main/java/streaming/jsonl/JsonlClientBuilder.java","src/main/java/streaming/jsonl/implementation/BasicsImpl.java","src/main/java/streaming/jsonl/implementation/JsonlClientImpl.java","src/main/java/streaming/jsonl/implementation/package-info.java","src/main/java/streaming/jsonl/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_apiview_properties.json deleted file mode 100644 index 4f2f513124e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_apiview_properties.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.builtin.BuiltinAsyncClient": "TspTest.Builtin.BuiltinOp", - "tsptest.builtin.BuiltinAsyncClient.read": "TspTest.Builtin.BuiltinOp.read", - "tsptest.builtin.BuiltinAsyncClient.readWithResponse": "TspTest.Builtin.BuiltinOp.read", - "tsptest.builtin.BuiltinAsyncClient.write": "TspTest.Builtin.BuiltinOp.write", - "tsptest.builtin.BuiltinAsyncClient.writeWithResponse": "TspTest.Builtin.BuiltinOp.write", - "tsptest.builtin.BuiltinClient": "TspTest.Builtin.BuiltinOp", - "tsptest.builtin.BuiltinClient.read": "TspTest.Builtin.BuiltinOp.read", - "tsptest.builtin.BuiltinClient.readWithResponse": "TspTest.Builtin.BuiltinOp.read", - "tsptest.builtin.BuiltinClient.write": "TspTest.Builtin.BuiltinOp.write", - "tsptest.builtin.BuiltinClient.writeWithResponse": "TspTest.Builtin.BuiltinOp.write", - "tsptest.builtin.BuiltinClientBuilder": "TspTest.Builtin", - "tsptest.builtin.models.Builtin": "TspTest.Builtin.Builtin", - "tsptest.builtin.models.Encoded": "TspTest.Builtin.Encoded" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_metadata.json deleted file mode 100644 index 8e0acdcd6f0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.builtin.BuiltinAsyncClient":"TspTest.Builtin.BuiltinOp","tsptest.builtin.BuiltinAsyncClient.read":"TspTest.Builtin.BuiltinOp.read","tsptest.builtin.BuiltinAsyncClient.readWithResponse":"TspTest.Builtin.BuiltinOp.read","tsptest.builtin.BuiltinAsyncClient.write":"TspTest.Builtin.BuiltinOp.write","tsptest.builtin.BuiltinAsyncClient.writeWithResponse":"TspTest.Builtin.BuiltinOp.write","tsptest.builtin.BuiltinClient":"TspTest.Builtin.BuiltinOp","tsptest.builtin.BuiltinClient.read":"TspTest.Builtin.BuiltinOp.read","tsptest.builtin.BuiltinClient.readWithResponse":"TspTest.Builtin.BuiltinOp.read","tsptest.builtin.BuiltinClient.write":"TspTest.Builtin.BuiltinOp.write","tsptest.builtin.BuiltinClient.writeWithResponse":"TspTest.Builtin.BuiltinOp.write","tsptest.builtin.BuiltinClientBuilder":"TspTest.Builtin","tsptest.builtin.models.Builtin":"TspTest.Builtin.Builtin","tsptest.builtin.models.Encoded":"TspTest.Builtin.Encoded"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/builtin/BuiltinAsyncClient.java","src/main/java/tsptest/builtin/BuiltinClient.java","src/main/java/tsptest/builtin/BuiltinClientBuilder.java","src/main/java/tsptest/builtin/implementation/BuiltinClientImpl.java","src/main/java/tsptest/builtin/implementation/BuiltinOpsImpl.java","src/main/java/tsptest/builtin/implementation/package-info.java","src/main/java/tsptest/builtin/models/Builtin.java","src/main/java/tsptest/builtin/models/Encoded.java","src/main/java/tsptest/builtin/models/package-info.java","src/main/java/tsptest/builtin/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_apiview_properties.json deleted file mode 100644 index 155252204bc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_apiview_properties.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp", - "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildNewDiscrim": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim", - "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildNewDiscrimWithResponse": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim", - "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildRequiredDiscrim": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim", - "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildRequiredDiscrimWithResponse": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim", - "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp", - "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildNewDiscrim": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim", - "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildNewDiscrimWithResponse": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim", - "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildRequiredDiscrim": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim", - "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildRequiredDiscrimWithResponse": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim", - "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClientBuilder": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp", - "tsptest.discriminatoredgecases.models.ChildWithAnotherDiscriminator": "TspTest.DiscriminatorEdgeCases.ChildWithAnotherDiscriminator", - "tsptest.discriminatoredgecases.models.ChildWithRequiredPropertyAsDiscriminator": "TspTest.DiscriminatorEdgeCases.ChildWithRequiredPropertyAsDiscriminator", - "tsptest.discriminatoredgecases.models.GrandChildWithAnotherDiscriminator": "TspTest.DiscriminatorEdgeCases.GrandChildWithAnotherDiscriminator", - "tsptest.discriminatoredgecases.models.GrandChildWithRequiredProperty": "TspTest.DiscriminatorEdgeCases.GrandChildWithRequiredProperty", - "tsptest.discriminatoredgecases.models.ParentWithRequiredProperty": "TspTest.DiscriminatorEdgeCases.ParentWithRequiredProperty" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_metadata.json deleted file mode 100644 index e873bad3cba..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildNewDiscrim":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildNewDiscrimWithResponse":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildRequiredDiscrim":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildRequiredDiscrimWithResponse":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildNewDiscrim":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildNewDiscrimWithResponse":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildRequiredDiscrim":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildRequiredDiscrimWithResponse":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClientBuilder":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp","tsptest.discriminatoredgecases.models.ChildWithAnotherDiscriminator":"TspTest.DiscriminatorEdgeCases.ChildWithAnotherDiscriminator","tsptest.discriminatoredgecases.models.ChildWithRequiredPropertyAsDiscriminator":"TspTest.DiscriminatorEdgeCases.ChildWithRequiredPropertyAsDiscriminator","tsptest.discriminatoredgecases.models.GrandChildWithAnotherDiscriminator":"TspTest.DiscriminatorEdgeCases.GrandChildWithAnotherDiscriminator","tsptest.discriminatoredgecases.models.GrandChildWithRequiredProperty":"TspTest.DiscriminatorEdgeCases.GrandChildWithRequiredProperty","tsptest.discriminatoredgecases.models.ParentWithRequiredProperty":"TspTest.DiscriminatorEdgeCases.ParentWithRequiredProperty"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesAsyncClient.java","src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClient.java","src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClientBuilder.java","src/main/java/tsptest/discriminatoredgecases/implementation/DiscriminatorEdgeCasesClientImpl.java","src/main/java/tsptest/discriminatoredgecases/implementation/package-info.java","src/main/java/tsptest/discriminatoredgecases/models/ChildWithAnotherDiscriminator.java","src/main/java/tsptest/discriminatoredgecases/models/ChildWithRequiredPropertyAsDiscriminator.java","src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithAnotherDiscriminator.java","src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithRequiredProperty.java","src/main/java/tsptest/discriminatoredgecases/models/ParentWithRequiredProperty.java","src/main/java/tsptest/discriminatoredgecases/models/package-info.java","src/main/java/tsptest/discriminatoredgecases/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_apiview_properties.json deleted file mode 100644 index c3c3c809f34..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_apiview_properties.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient": "TspTest.EnumNestedDiscriminator", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getMissingDiscriminator": "TspTest.EnumNestedDiscriminator.getMissingDiscriminator", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getMissingDiscriminatorWithResponse": "TspTest.EnumNestedDiscriminator.getMissingDiscriminator", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getModel": "TspTest.EnumNestedDiscriminator.getModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getModelWithResponse": "TspTest.EnumNestedDiscriminator.getModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getRecursiveModel": "TspTest.EnumNestedDiscriminator.getRecursiveModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getRecursiveModelWithResponse": "TspTest.EnumNestedDiscriminator.getRecursiveModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getWrongDiscriminator": "TspTest.EnumNestedDiscriminator.getWrongDiscriminator", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getWrongDiscriminatorWithResponse": "TspTest.EnumNestedDiscriminator.getWrongDiscriminator", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putModel": "TspTest.EnumNestedDiscriminator.putModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putModelWithResponse": "TspTest.EnumNestedDiscriminator.putModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putRecursiveModel": "TspTest.EnumNestedDiscriminator.putRecursiveModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putRecursiveModelWithResponse": "TspTest.EnumNestedDiscriminator.putRecursiveModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient": "TspTest.EnumNestedDiscriminator", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getMissingDiscriminator": "TspTest.EnumNestedDiscriminator.getMissingDiscriminator", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getMissingDiscriminatorWithResponse": "TspTest.EnumNestedDiscriminator.getMissingDiscriminator", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getModel": "TspTest.EnumNestedDiscriminator.getModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getModelWithResponse": "TspTest.EnumNestedDiscriminator.getModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getRecursiveModel": "TspTest.EnumNestedDiscriminator.getRecursiveModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getRecursiveModelWithResponse": "TspTest.EnumNestedDiscriminator.getRecursiveModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getWrongDiscriminator": "TspTest.EnumNestedDiscriminator.getWrongDiscriminator", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getWrongDiscriminatorWithResponse": "TspTest.EnumNestedDiscriminator.getWrongDiscriminator", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putModel": "TspTest.EnumNestedDiscriminator.putModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putModelWithResponse": "TspTest.EnumNestedDiscriminator.putModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putRecursiveModel": "TspTest.EnumNestedDiscriminator.putRecursiveModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putRecursiveModelWithResponse": "TspTest.EnumNestedDiscriminator.putRecursiveModel", - "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClientBuilder": "TspTest.EnumNestedDiscriminator", - "tsptest.enumnesteddiscriminator.models.Fish": "TspTest.EnumNestedDiscriminator.Fish", - "tsptest.enumnesteddiscriminator.models.FishKind": "TspTest.EnumNestedDiscriminator.FishKind", - "tsptest.enumnesteddiscriminator.models.GoblinShark": "TspTest.EnumNestedDiscriminator.GoblinShark", - "tsptest.enumnesteddiscriminator.models.Salmon": "TspTest.EnumNestedDiscriminator.Salmon", - "tsptest.enumnesteddiscriminator.models.SawShark": "TspTest.EnumNestedDiscriminator.SawShark", - "tsptest.enumnesteddiscriminator.models.Shark": "TspTest.EnumNestedDiscriminator.Shark", - "tsptest.enumnesteddiscriminator.models.SharkKind": "TspTest.EnumNestedDiscriminator.SharkKind" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_metadata.json deleted file mode 100644 index 266addcdb29..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient":"TspTest.EnumNestedDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getMissingDiscriminator":"TspTest.EnumNestedDiscriminator.getMissingDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getMissingDiscriminatorWithResponse":"TspTest.EnumNestedDiscriminator.getMissingDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getModel":"TspTest.EnumNestedDiscriminator.getModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getModelWithResponse":"TspTest.EnumNestedDiscriminator.getModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getRecursiveModel":"TspTest.EnumNestedDiscriminator.getRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getRecursiveModelWithResponse":"TspTest.EnumNestedDiscriminator.getRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getWrongDiscriminator":"TspTest.EnumNestedDiscriminator.getWrongDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getWrongDiscriminatorWithResponse":"TspTest.EnumNestedDiscriminator.getWrongDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putModel":"TspTest.EnumNestedDiscriminator.putModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putModelWithResponse":"TspTest.EnumNestedDiscriminator.putModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putRecursiveModel":"TspTest.EnumNestedDiscriminator.putRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putRecursiveModelWithResponse":"TspTest.EnumNestedDiscriminator.putRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient":"TspTest.EnumNestedDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getMissingDiscriminator":"TspTest.EnumNestedDiscriminator.getMissingDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getMissingDiscriminatorWithResponse":"TspTest.EnumNestedDiscriminator.getMissingDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getModel":"TspTest.EnumNestedDiscriminator.getModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getModelWithResponse":"TspTest.EnumNestedDiscriminator.getModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getRecursiveModel":"TspTest.EnumNestedDiscriminator.getRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getRecursiveModelWithResponse":"TspTest.EnumNestedDiscriminator.getRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getWrongDiscriminator":"TspTest.EnumNestedDiscriminator.getWrongDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getWrongDiscriminatorWithResponse":"TspTest.EnumNestedDiscriminator.getWrongDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putModel":"TspTest.EnumNestedDiscriminator.putModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putModelWithResponse":"TspTest.EnumNestedDiscriminator.putModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putRecursiveModel":"TspTest.EnumNestedDiscriminator.putRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putRecursiveModelWithResponse":"TspTest.EnumNestedDiscriminator.putRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClientBuilder":"TspTest.EnumNestedDiscriminator","tsptest.enumnesteddiscriminator.models.Fish":"TspTest.EnumNestedDiscriminator.Fish","tsptest.enumnesteddiscriminator.models.FishKind":"TspTest.EnumNestedDiscriminator.FishKind","tsptest.enumnesteddiscriminator.models.GoblinShark":"TspTest.EnumNestedDiscriminator.GoblinShark","tsptest.enumnesteddiscriminator.models.Salmon":"TspTest.EnumNestedDiscriminator.Salmon","tsptest.enumnesteddiscriminator.models.SawShark":"TspTest.EnumNestedDiscriminator.SawShark","tsptest.enumnesteddiscriminator.models.Shark":"TspTest.EnumNestedDiscriminator.Shark","tsptest.enumnesteddiscriminator.models.SharkKind":"TspTest.EnumNestedDiscriminator.SharkKind"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorAsyncClient.java","src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClient.java","src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClientBuilder.java","src/main/java/tsptest/enumnesteddiscriminator/implementation/EnumNestedDiscriminatorClientImpl.java","src/main/java/tsptest/enumnesteddiscriminator/implementation/package-info.java","src/main/java/tsptest/enumnesteddiscriminator/models/Fish.java","src/main/java/tsptest/enumnesteddiscriminator/models/FishKind.java","src/main/java/tsptest/enumnesteddiscriminator/models/GoblinShark.java","src/main/java/tsptest/enumnesteddiscriminator/models/Salmon.java","src/main/java/tsptest/enumnesteddiscriminator/models/SawShark.java","src/main/java/tsptest/enumnesteddiscriminator/models/Shark.java","src/main/java/tsptest/enumnesteddiscriminator/models/SharkKind.java","src/main/java/tsptest/enumnesteddiscriminator/models/package-info.java","src/main/java/tsptest/enumnesteddiscriminator/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_apiview_properties.json deleted file mode 100644 index b6e62977f28..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_apiview_properties.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.enumservice.EnumServiceAsyncClient": "TspTest.EnumService.EnumOp", - "tsptest.enumservice.EnumServiceAsyncClient.getColor": "TspTest.EnumService.EnumOp.getColor", - "tsptest.enumservice.EnumServiceAsyncClient.getColorModel": "TspTest.EnumService.EnumOp.getColorModel", - "tsptest.enumservice.EnumServiceAsyncClient.getColorModelWithResponse": "TspTest.EnumService.EnumOp.getColorModel", - "tsptest.enumservice.EnumServiceAsyncClient.getColorWithResponse": "TspTest.EnumService.EnumOp.getColor", - "tsptest.enumservice.EnumServiceAsyncClient.getOperation": "TspTest.EnumService.EnumOp.getOperation", - "tsptest.enumservice.EnumServiceAsyncClient.getOperationWithResponse": "TspTest.EnumService.EnumOp.getOperation", - "tsptest.enumservice.EnumServiceAsyncClient.getRunningOperation": "TspTest.EnumService.EnumOp.getRunningOperation", - "tsptest.enumservice.EnumServiceAsyncClient.getRunningOperationWithResponse": "TspTest.EnumService.EnumOp.getRunningOperation", - "tsptest.enumservice.EnumServiceAsyncClient.setColorModel": "TspTest.EnumService.EnumOp.setColorModel", - "tsptest.enumservice.EnumServiceAsyncClient.setColorModelWithResponse": "TspTest.EnumService.EnumOp.setColorModel", - "tsptest.enumservice.EnumServiceAsyncClient.setIntArray": "TspTest.EnumService.EnumOp.setIntArray", - "tsptest.enumservice.EnumServiceAsyncClient.setIntArrayWithResponse": "TspTest.EnumService.EnumOp.setIntArray", - "tsptest.enumservice.EnumServiceAsyncClient.setIntEnumArray": "TspTest.EnumService.EnumOp.setIntEnumArray", - "tsptest.enumservice.EnumServiceAsyncClient.setIntEnumArrayWithResponse": "TspTest.EnumService.EnumOp.setIntEnumArray", - "tsptest.enumservice.EnumServiceAsyncClient.setIntEnumMulti": "TspTest.EnumService.EnumOp.setIntEnumMulti", - "tsptest.enumservice.EnumServiceAsyncClient.setIntEnumMultiWithResponse": "TspTest.EnumService.EnumOp.setIntEnumMulti", - "tsptest.enumservice.EnumServiceAsyncClient.setIntMulti": "TspTest.EnumService.EnumOp.setIntMulti", - "tsptest.enumservice.EnumServiceAsyncClient.setIntMultiWithResponse": "TspTest.EnumService.EnumOp.setIntMulti", - "tsptest.enumservice.EnumServiceAsyncClient.setPriority": "TspTest.EnumService.EnumOp.setPriority", - "tsptest.enumservice.EnumServiceAsyncClient.setPriorityWithResponse": "TspTest.EnumService.EnumOp.setPriority", - "tsptest.enumservice.EnumServiceAsyncClient.setStringArray": "TspTest.EnumService.EnumOp.setStringArray", - "tsptest.enumservice.EnumServiceAsyncClient.setStringArrayWithResponse": "TspTest.EnumService.EnumOp.setStringArray", - "tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArray": "TspTest.EnumService.EnumOp.setStringEnumArray", - "tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArrayHeader": "TspTest.EnumService.EnumOp.setStringEnumArrayHeader", - "tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArrayHeaderWithResponse": "TspTest.EnumService.EnumOp.setStringEnumArrayHeader", - "tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArrayWithResponse": "TspTest.EnumService.EnumOp.setStringEnumArray", - "tsptest.enumservice.EnumServiceAsyncClient.setStringEnumMulti": "TspTest.EnumService.EnumOp.setStringEnumMulti", - "tsptest.enumservice.EnumServiceAsyncClient.setStringEnumMultiWithResponse": "TspTest.EnumService.EnumOp.setStringEnumMulti", - "tsptest.enumservice.EnumServiceAsyncClient.setStringMulti": "TspTest.EnumService.EnumOp.setStringMulti", - "tsptest.enumservice.EnumServiceAsyncClient.setStringMultiWithResponse": "TspTest.EnumService.EnumOp.setStringMulti", - "tsptest.enumservice.EnumServiceClient": "TspTest.EnumService.EnumOp", - "tsptest.enumservice.EnumServiceClient.getColor": "TspTest.EnumService.EnumOp.getColor", - "tsptest.enumservice.EnumServiceClient.getColorModel": "TspTest.EnumService.EnumOp.getColorModel", - "tsptest.enumservice.EnumServiceClient.getColorModelWithResponse": "TspTest.EnumService.EnumOp.getColorModel", - "tsptest.enumservice.EnumServiceClient.getColorWithResponse": "TspTest.EnumService.EnumOp.getColor", - "tsptest.enumservice.EnumServiceClient.getOperation": "TspTest.EnumService.EnumOp.getOperation", - "tsptest.enumservice.EnumServiceClient.getOperationWithResponse": "TspTest.EnumService.EnumOp.getOperation", - "tsptest.enumservice.EnumServiceClient.getRunningOperation": "TspTest.EnumService.EnumOp.getRunningOperation", - "tsptest.enumservice.EnumServiceClient.getRunningOperationWithResponse": "TspTest.EnumService.EnumOp.getRunningOperation", - "tsptest.enumservice.EnumServiceClient.setColorModel": "TspTest.EnumService.EnumOp.setColorModel", - "tsptest.enumservice.EnumServiceClient.setColorModelWithResponse": "TspTest.EnumService.EnumOp.setColorModel", - "tsptest.enumservice.EnumServiceClient.setIntArray": "TspTest.EnumService.EnumOp.setIntArray", - "tsptest.enumservice.EnumServiceClient.setIntArrayWithResponse": "TspTest.EnumService.EnumOp.setIntArray", - "tsptest.enumservice.EnumServiceClient.setIntEnumArray": "TspTest.EnumService.EnumOp.setIntEnumArray", - "tsptest.enumservice.EnumServiceClient.setIntEnumArrayWithResponse": "TspTest.EnumService.EnumOp.setIntEnumArray", - "tsptest.enumservice.EnumServiceClient.setIntEnumMulti": "TspTest.EnumService.EnumOp.setIntEnumMulti", - "tsptest.enumservice.EnumServiceClient.setIntEnumMultiWithResponse": "TspTest.EnumService.EnumOp.setIntEnumMulti", - "tsptest.enumservice.EnumServiceClient.setIntMulti": "TspTest.EnumService.EnumOp.setIntMulti", - "tsptest.enumservice.EnumServiceClient.setIntMultiWithResponse": "TspTest.EnumService.EnumOp.setIntMulti", - "tsptest.enumservice.EnumServiceClient.setPriority": "TspTest.EnumService.EnumOp.setPriority", - "tsptest.enumservice.EnumServiceClient.setPriorityWithResponse": "TspTest.EnumService.EnumOp.setPriority", - "tsptest.enumservice.EnumServiceClient.setStringArray": "TspTest.EnumService.EnumOp.setStringArray", - "tsptest.enumservice.EnumServiceClient.setStringArrayWithResponse": "TspTest.EnumService.EnumOp.setStringArray", - "tsptest.enumservice.EnumServiceClient.setStringEnumArray": "TspTest.EnumService.EnumOp.setStringEnumArray", - "tsptest.enumservice.EnumServiceClient.setStringEnumArrayHeader": "TspTest.EnumService.EnumOp.setStringEnumArrayHeader", - "tsptest.enumservice.EnumServiceClient.setStringEnumArrayHeaderWithResponse": "TspTest.EnumService.EnumOp.setStringEnumArrayHeader", - "tsptest.enumservice.EnumServiceClient.setStringEnumArrayWithResponse": "TspTest.EnumService.EnumOp.setStringEnumArray", - "tsptest.enumservice.EnumServiceClient.setStringEnumMulti": "TspTest.EnumService.EnumOp.setStringEnumMulti", - "tsptest.enumservice.EnumServiceClient.setStringEnumMultiWithResponse": "TspTest.EnumService.EnumOp.setStringEnumMulti", - "tsptest.enumservice.EnumServiceClient.setStringMulti": "TspTest.EnumService.EnumOp.setStringMulti", - "tsptest.enumservice.EnumServiceClient.setStringMultiWithResponse": "TspTest.EnumService.EnumOp.setStringMulti", - "tsptest.enumservice.EnumServiceClientBuilder": "TspTest.EnumService.EnumOp", - "tsptest.enumservice.models.Color": "TspTest.EnumService.Color", - "tsptest.enumservice.models.ColorModel": "TspTest.EnumService.ColorModel", - "tsptest.enumservice.models.OlympicRecordModel": "TspTest.EnumService.OlympicRecordModel", - "tsptest.enumservice.models.Operation": "TspTest.EnumService.Operation", - "tsptest.enumservice.models.OperationName": "TspTest.EnumService.Operation.name.anonymous", - "tsptest.enumservice.models.OperationStateValues": "TspTest.EnumService.OperationStateValues", - "tsptest.enumservice.models.Priority": "TspTest.EnumService.Priority", - "tsptest.enumservice.models.PriorityModel": "TspTest.EnumService.PriorityModel", - "tsptest.enumservice.models.Unit": "TspTest.EnumService.Unit" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_metadata.json deleted file mode 100644 index 169c50ba56d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.enumservice.EnumServiceAsyncClient":"TspTest.EnumService.EnumOp","tsptest.enumservice.EnumServiceAsyncClient.getColor":"TspTest.EnumService.EnumOp.getColor","tsptest.enumservice.EnumServiceAsyncClient.getColorModel":"TspTest.EnumService.EnumOp.getColorModel","tsptest.enumservice.EnumServiceAsyncClient.getColorModelWithResponse":"TspTest.EnumService.EnumOp.getColorModel","tsptest.enumservice.EnumServiceAsyncClient.getColorWithResponse":"TspTest.EnumService.EnumOp.getColor","tsptest.enumservice.EnumServiceAsyncClient.getOperation":"TspTest.EnumService.EnumOp.getOperation","tsptest.enumservice.EnumServiceAsyncClient.getOperationWithResponse":"TspTest.EnumService.EnumOp.getOperation","tsptest.enumservice.EnumServiceAsyncClient.getRunningOperation":"TspTest.EnumService.EnumOp.getRunningOperation","tsptest.enumservice.EnumServiceAsyncClient.getRunningOperationWithResponse":"TspTest.EnumService.EnumOp.getRunningOperation","tsptest.enumservice.EnumServiceAsyncClient.setColorModel":"TspTest.EnumService.EnumOp.setColorModel","tsptest.enumservice.EnumServiceAsyncClient.setColorModelWithResponse":"TspTest.EnumService.EnumOp.setColorModel","tsptest.enumservice.EnumServiceAsyncClient.setIntArray":"TspTest.EnumService.EnumOp.setIntArray","tsptest.enumservice.EnumServiceAsyncClient.setIntArrayWithResponse":"TspTest.EnumService.EnumOp.setIntArray","tsptest.enumservice.EnumServiceAsyncClient.setIntEnumArray":"TspTest.EnumService.EnumOp.setIntEnumArray","tsptest.enumservice.EnumServiceAsyncClient.setIntEnumArrayWithResponse":"TspTest.EnumService.EnumOp.setIntEnumArray","tsptest.enumservice.EnumServiceAsyncClient.setIntEnumMulti":"TspTest.EnumService.EnumOp.setIntEnumMulti","tsptest.enumservice.EnumServiceAsyncClient.setIntEnumMultiWithResponse":"TspTest.EnumService.EnumOp.setIntEnumMulti","tsptest.enumservice.EnumServiceAsyncClient.setIntMulti":"TspTest.EnumService.EnumOp.setIntMulti","tsptest.enumservice.EnumServiceAsyncClient.setIntMultiWithResponse":"TspTest.EnumService.EnumOp.setIntMulti","tsptest.enumservice.EnumServiceAsyncClient.setPriority":"TspTest.EnumService.EnumOp.setPriority","tsptest.enumservice.EnumServiceAsyncClient.setPriorityWithResponse":"TspTest.EnumService.EnumOp.setPriority","tsptest.enumservice.EnumServiceAsyncClient.setStringArray":"TspTest.EnumService.EnumOp.setStringArray","tsptest.enumservice.EnumServiceAsyncClient.setStringArrayWithResponse":"TspTest.EnumService.EnumOp.setStringArray","tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArray":"TspTest.EnumService.EnumOp.setStringEnumArray","tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArrayHeader":"TspTest.EnumService.EnumOp.setStringEnumArrayHeader","tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArrayHeaderWithResponse":"TspTest.EnumService.EnumOp.setStringEnumArrayHeader","tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArrayWithResponse":"TspTest.EnumService.EnumOp.setStringEnumArray","tsptest.enumservice.EnumServiceAsyncClient.setStringEnumMulti":"TspTest.EnumService.EnumOp.setStringEnumMulti","tsptest.enumservice.EnumServiceAsyncClient.setStringEnumMultiWithResponse":"TspTest.EnumService.EnumOp.setStringEnumMulti","tsptest.enumservice.EnumServiceAsyncClient.setStringMulti":"TspTest.EnumService.EnumOp.setStringMulti","tsptest.enumservice.EnumServiceAsyncClient.setStringMultiWithResponse":"TspTest.EnumService.EnumOp.setStringMulti","tsptest.enumservice.EnumServiceClient":"TspTest.EnumService.EnumOp","tsptest.enumservice.EnumServiceClient.getColor":"TspTest.EnumService.EnumOp.getColor","tsptest.enumservice.EnumServiceClient.getColorModel":"TspTest.EnumService.EnumOp.getColorModel","tsptest.enumservice.EnumServiceClient.getColorModelWithResponse":"TspTest.EnumService.EnumOp.getColorModel","tsptest.enumservice.EnumServiceClient.getColorWithResponse":"TspTest.EnumService.EnumOp.getColor","tsptest.enumservice.EnumServiceClient.getOperation":"TspTest.EnumService.EnumOp.getOperation","tsptest.enumservice.EnumServiceClient.getOperationWithResponse":"TspTest.EnumService.EnumOp.getOperation","tsptest.enumservice.EnumServiceClient.getRunningOperation":"TspTest.EnumService.EnumOp.getRunningOperation","tsptest.enumservice.EnumServiceClient.getRunningOperationWithResponse":"TspTest.EnumService.EnumOp.getRunningOperation","tsptest.enumservice.EnumServiceClient.setColorModel":"TspTest.EnumService.EnumOp.setColorModel","tsptest.enumservice.EnumServiceClient.setColorModelWithResponse":"TspTest.EnumService.EnumOp.setColorModel","tsptest.enumservice.EnumServiceClient.setIntArray":"TspTest.EnumService.EnumOp.setIntArray","tsptest.enumservice.EnumServiceClient.setIntArrayWithResponse":"TspTest.EnumService.EnumOp.setIntArray","tsptest.enumservice.EnumServiceClient.setIntEnumArray":"TspTest.EnumService.EnumOp.setIntEnumArray","tsptest.enumservice.EnumServiceClient.setIntEnumArrayWithResponse":"TspTest.EnumService.EnumOp.setIntEnumArray","tsptest.enumservice.EnumServiceClient.setIntEnumMulti":"TspTest.EnumService.EnumOp.setIntEnumMulti","tsptest.enumservice.EnumServiceClient.setIntEnumMultiWithResponse":"TspTest.EnumService.EnumOp.setIntEnumMulti","tsptest.enumservice.EnumServiceClient.setIntMulti":"TspTest.EnumService.EnumOp.setIntMulti","tsptest.enumservice.EnumServiceClient.setIntMultiWithResponse":"TspTest.EnumService.EnumOp.setIntMulti","tsptest.enumservice.EnumServiceClient.setPriority":"TspTest.EnumService.EnumOp.setPriority","tsptest.enumservice.EnumServiceClient.setPriorityWithResponse":"TspTest.EnumService.EnumOp.setPriority","tsptest.enumservice.EnumServiceClient.setStringArray":"TspTest.EnumService.EnumOp.setStringArray","tsptest.enumservice.EnumServiceClient.setStringArrayWithResponse":"TspTest.EnumService.EnumOp.setStringArray","tsptest.enumservice.EnumServiceClient.setStringEnumArray":"TspTest.EnumService.EnumOp.setStringEnumArray","tsptest.enumservice.EnumServiceClient.setStringEnumArrayHeader":"TspTest.EnumService.EnumOp.setStringEnumArrayHeader","tsptest.enumservice.EnumServiceClient.setStringEnumArrayHeaderWithResponse":"TspTest.EnumService.EnumOp.setStringEnumArrayHeader","tsptest.enumservice.EnumServiceClient.setStringEnumArrayWithResponse":"TspTest.EnumService.EnumOp.setStringEnumArray","tsptest.enumservice.EnumServiceClient.setStringEnumMulti":"TspTest.EnumService.EnumOp.setStringEnumMulti","tsptest.enumservice.EnumServiceClient.setStringEnumMultiWithResponse":"TspTest.EnumService.EnumOp.setStringEnumMulti","tsptest.enumservice.EnumServiceClient.setStringMulti":"TspTest.EnumService.EnumOp.setStringMulti","tsptest.enumservice.EnumServiceClient.setStringMultiWithResponse":"TspTest.EnumService.EnumOp.setStringMulti","tsptest.enumservice.EnumServiceClientBuilder":"TspTest.EnumService.EnumOp","tsptest.enumservice.models.Color":"TspTest.EnumService.Color","tsptest.enumservice.models.ColorModel":"TspTest.EnumService.ColorModel","tsptest.enumservice.models.OlympicRecordModel":"TspTest.EnumService.OlympicRecordModel","tsptest.enumservice.models.Operation":"TspTest.EnumService.Operation","tsptest.enumservice.models.OperationName":"TspTest.EnumService.Operation.name.anonymous","tsptest.enumservice.models.OperationStateValues":"TspTest.EnumService.OperationStateValues","tsptest.enumservice.models.Priority":"TspTest.EnumService.Priority","tsptest.enumservice.models.PriorityModel":"TspTest.EnumService.PriorityModel","tsptest.enumservice.models.Unit":"TspTest.EnumService.Unit"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/enumservice/EnumServiceAsyncClient.java","src/main/java/tsptest/enumservice/EnumServiceClient.java","src/main/java/tsptest/enumservice/EnumServiceClientBuilder.java","src/main/java/tsptest/enumservice/implementation/EnumServiceClientImpl.java","src/main/java/tsptest/enumservice/implementation/package-info.java","src/main/java/tsptest/enumservice/models/Color.java","src/main/java/tsptest/enumservice/models/ColorModel.java","src/main/java/tsptest/enumservice/models/OlympicRecordModel.java","src/main/java/tsptest/enumservice/models/Operation.java","src/main/java/tsptest/enumservice/models/OperationName.java","src/main/java/tsptest/enumservice/models/OperationStateValues.java","src/main/java/tsptest/enumservice/models/Priority.java","src/main/java/tsptest/enumservice/models/PriorityModel.java","src/main/java/tsptest/enumservice/models/Unit.java","src/main/java/tsptest/enumservice/models/package-info.java","src/main/java/tsptest/enumservice/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_apiview_properties.json deleted file mode 100644 index 5b466208aee..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_apiview_properties.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.errormodel.ErrorModelAsyncClient": "TspTest.ErrorModel.ErrorOp", - "tsptest.errormodel.ErrorModelAsyncClient.read": "TspTest.ErrorModel.ErrorOp.read", - "tsptest.errormodel.ErrorModelAsyncClient.readWithResponse": "TspTest.ErrorModel.ErrorOp.read", - "tsptest.errormodel.ErrorModelClient": "TspTest.ErrorModel.ErrorOp", - "tsptest.errormodel.ErrorModelClient.read": "TspTest.ErrorModel.ErrorOp.read", - "tsptest.errormodel.ErrorModelClient.readWithResponse": "TspTest.ErrorModel.ErrorOp.read", - "tsptest.errormodel.ErrorModelClientBuilder": "TspTest.ErrorModel", - "tsptest.errormodel.models.BadResponseError": "TspTest.ErrorModel.BadResponseError", - "tsptest.errormodel.models.BatchError": "TspTest.ErrorModel.BatchError", - "tsptest.errormodel.models.BatchErrorMessage": "TspTest.ErrorModel.BatchErrorMessage", - "tsptest.errormodel.models.Details": "TspTest.ErrorModel.Details", - "tsptest.errormodel.models.Diagnostic": "TspTest.ErrorModel.Diagnostic", - "tsptest.errormodel.models.InnerError": "Azure.Core.Foundations.InnerError", - "tsptest.errormodel.models.SubError": "TspTest.ErrorModel.SubError" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_metadata.json deleted file mode 100644 index ec105b0f181..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.errormodel.ErrorModelAsyncClient":"TspTest.ErrorModel.ErrorOp","tsptest.errormodel.ErrorModelAsyncClient.read":"TspTest.ErrorModel.ErrorOp.read","tsptest.errormodel.ErrorModelAsyncClient.readWithResponse":"TspTest.ErrorModel.ErrorOp.read","tsptest.errormodel.ErrorModelClient":"TspTest.ErrorModel.ErrorOp","tsptest.errormodel.ErrorModelClient.read":"TspTest.ErrorModel.ErrorOp.read","tsptest.errormodel.ErrorModelClient.readWithResponse":"TspTest.ErrorModel.ErrorOp.read","tsptest.errormodel.ErrorModelClientBuilder":"TspTest.ErrorModel","tsptest.errormodel.models.BadResponseError":"TspTest.ErrorModel.BadResponseError","tsptest.errormodel.models.BatchError":"TspTest.ErrorModel.BatchError","tsptest.errormodel.models.BatchErrorMessage":"TspTest.ErrorModel.BatchErrorMessage","tsptest.errormodel.models.Details":"TspTest.ErrorModel.Details","tsptest.errormodel.models.Diagnostic":"TspTest.ErrorModel.Diagnostic","tsptest.errormodel.models.InnerError":"Azure.Core.Foundations.InnerError","tsptest.errormodel.models.SubError":"TspTest.ErrorModel.SubError"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/errormodel/ErrorModelAsyncClient.java","src/main/java/tsptest/errormodel/ErrorModelClient.java","src/main/java/tsptest/errormodel/ErrorModelClientBuilder.java","src/main/java/tsptest/errormodel/implementation/ErrorModelClientImpl.java","src/main/java/tsptest/errormodel/implementation/ErrorOpsImpl.java","src/main/java/tsptest/errormodel/implementation/package-info.java","src/main/java/tsptest/errormodel/models/BadResponseError.java","src/main/java/tsptest/errormodel/models/BadResponseErrorException.java","src/main/java/tsptest/errormodel/models/BatchError.java","src/main/java/tsptest/errormodel/models/BatchErrorException.java","src/main/java/tsptest/errormodel/models/BatchErrorMessage.java","src/main/java/tsptest/errormodel/models/Details.java","src/main/java/tsptest/errormodel/models/Diagnostic.java","src/main/java/tsptest/errormodel/models/InnerError.java","src/main/java/tsptest/errormodel/models/SubError.java","src/main/java/tsptest/errormodel/models/package-info.java","src/main/java/tsptest/errormodel/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_apiview_properties.json deleted file mode 100644 index 27ab30ca8e6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_apiview_properties.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.flatten.FlattenAsyncClient": "TspTest.Flatten.FlattenOp", - "tsptest.flatten.FlattenAsyncClient.send": "TspTest.Flatten.FlattenOp.send", - "tsptest.flatten.FlattenAsyncClient.sendLong": "TspTest.Flatten.FlattenOp.sendLong", - "tsptest.flatten.FlattenAsyncClient.sendLongWithResponse": "TspTest.Flatten.FlattenOp.sendLong", - "tsptest.flatten.FlattenAsyncClient.sendOptionalBody": "TspTest.Flatten.FlattenOp.sendOptionalBody", - "tsptest.flatten.FlattenAsyncClient.sendOptionalBodyWithResponse": "TspTest.Flatten.FlattenOp.sendOptionalBody", - "tsptest.flatten.FlattenAsyncClient.sendProjectedName": "TspTest.Flatten.FlattenOp.sendProjectedName", - "tsptest.flatten.FlattenAsyncClient.sendProjectedNameWithResponse": "TspTest.Flatten.FlattenOp.sendProjectedName", - "tsptest.flatten.FlattenAsyncClient.sendWithResponse": "TspTest.Flatten.FlattenOp.send", - "tsptest.flatten.FlattenAsyncClient.update": "TspTest.Flatten.FlattenOp.update", - "tsptest.flatten.FlattenAsyncClient.updateWithResponse": "TspTest.Flatten.FlattenOp.update", - "tsptest.flatten.FlattenClient": "TspTest.Flatten.FlattenOp", - "tsptest.flatten.FlattenClient.send": "TspTest.Flatten.FlattenOp.send", - "tsptest.flatten.FlattenClient.sendLong": "TspTest.Flatten.FlattenOp.sendLong", - "tsptest.flatten.FlattenClient.sendLongWithResponse": "TspTest.Flatten.FlattenOp.sendLong", - "tsptest.flatten.FlattenClient.sendOptionalBody": "TspTest.Flatten.FlattenOp.sendOptionalBody", - "tsptest.flatten.FlattenClient.sendOptionalBodyWithResponse": "TspTest.Flatten.FlattenOp.sendOptionalBody", - "tsptest.flatten.FlattenClient.sendProjectedName": "TspTest.Flatten.FlattenOp.sendProjectedName", - "tsptest.flatten.FlattenClient.sendProjectedNameWithResponse": "TspTest.Flatten.FlattenOp.sendProjectedName", - "tsptest.flatten.FlattenClient.sendWithResponse": "TspTest.Flatten.FlattenOp.send", - "tsptest.flatten.FlattenClient.update": "TspTest.Flatten.FlattenOp.update", - "tsptest.flatten.FlattenClient.updateWithResponse": "TspTest.Flatten.FlattenOp.update", - "tsptest.flatten.FlattenClientBuilder": "TspTest.Flatten.FlattenOp", - "tsptest.flatten.implementation.models.SendLongRequest": "TspTest.Flatten.sendLong.Request.anonymous", - "tsptest.flatten.implementation.models.SendOptionalBodyRequest": "TspTest.Flatten.sendOptionalBody.Request.anonymous", - "tsptest.flatten.implementation.models.SendProjectedNameRequest": "TspTest.Flatten.sendProjectedName.Request.anonymous", - "tsptest.flatten.implementation.models.SendRequest": "TspTest.Flatten.send.Request.anonymous", - "tsptest.flatten.models.SendLongOptions": null, - "tsptest.flatten.models.SendLongRequestStatus": "TspTest.Flatten.sendLong.Request.status.anonymous", - "tsptest.flatten.models.TodoItem": "TspTest.Flatten.TodoItem", - "tsptest.flatten.models.TodoItemPatch": "TspTest.Flatten.TodoItemPatch", - "tsptest.flatten.models.TodoItemPatchStatus": "TspTest.Flatten.TodoItemPatch.status.anonymous", - "tsptest.flatten.models.UpdatePatchRequest": "TspTest.Flatten.update.Request.anonymous", - "tsptest.flatten.models.User": "TspTest.Flatten.User" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_metadata.json deleted file mode 100644 index 027b10c8709..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-06-01-preview","crossLanguageDefinitions":{"tsptest.flatten.FlattenAsyncClient":"TspTest.Flatten.FlattenOp","tsptest.flatten.FlattenAsyncClient.send":"TspTest.Flatten.FlattenOp.send","tsptest.flatten.FlattenAsyncClient.sendLong":"TspTest.Flatten.FlattenOp.sendLong","tsptest.flatten.FlattenAsyncClient.sendLongWithResponse":"TspTest.Flatten.FlattenOp.sendLong","tsptest.flatten.FlattenAsyncClient.sendOptionalBody":"TspTest.Flatten.FlattenOp.sendOptionalBody","tsptest.flatten.FlattenAsyncClient.sendOptionalBodyWithResponse":"TspTest.Flatten.FlattenOp.sendOptionalBody","tsptest.flatten.FlattenAsyncClient.sendProjectedName":"TspTest.Flatten.FlattenOp.sendProjectedName","tsptest.flatten.FlattenAsyncClient.sendProjectedNameWithResponse":"TspTest.Flatten.FlattenOp.sendProjectedName","tsptest.flatten.FlattenAsyncClient.sendWithResponse":"TspTest.Flatten.FlattenOp.send","tsptest.flatten.FlattenAsyncClient.update":"TspTest.Flatten.FlattenOp.update","tsptest.flatten.FlattenAsyncClient.updateWithResponse":"TspTest.Flatten.FlattenOp.update","tsptest.flatten.FlattenClient":"TspTest.Flatten.FlattenOp","tsptest.flatten.FlattenClient.send":"TspTest.Flatten.FlattenOp.send","tsptest.flatten.FlattenClient.sendLong":"TspTest.Flatten.FlattenOp.sendLong","tsptest.flatten.FlattenClient.sendLongWithResponse":"TspTest.Flatten.FlattenOp.sendLong","tsptest.flatten.FlattenClient.sendOptionalBody":"TspTest.Flatten.FlattenOp.sendOptionalBody","tsptest.flatten.FlattenClient.sendOptionalBodyWithResponse":"TspTest.Flatten.FlattenOp.sendOptionalBody","tsptest.flatten.FlattenClient.sendProjectedName":"TspTest.Flatten.FlattenOp.sendProjectedName","tsptest.flatten.FlattenClient.sendProjectedNameWithResponse":"TspTest.Flatten.FlattenOp.sendProjectedName","tsptest.flatten.FlattenClient.sendWithResponse":"TspTest.Flatten.FlattenOp.send","tsptest.flatten.FlattenClient.update":"TspTest.Flatten.FlattenOp.update","tsptest.flatten.FlattenClient.updateWithResponse":"TspTest.Flatten.FlattenOp.update","tsptest.flatten.FlattenClientBuilder":"TspTest.Flatten.FlattenOp","tsptest.flatten.implementation.models.SendLongRequest":"TspTest.Flatten.sendLong.Request.anonymous","tsptest.flatten.implementation.models.SendOptionalBodyRequest":"TspTest.Flatten.sendOptionalBody.Request.anonymous","tsptest.flatten.implementation.models.SendProjectedNameRequest":"TspTest.Flatten.sendProjectedName.Request.anonymous","tsptest.flatten.implementation.models.SendRequest":"TspTest.Flatten.send.Request.anonymous","tsptest.flatten.models.SendLongOptions":null,"tsptest.flatten.models.SendLongRequestStatus":"TspTest.Flatten.sendLong.Request.status.anonymous","tsptest.flatten.models.TodoItem":"TspTest.Flatten.TodoItem","tsptest.flatten.models.TodoItemPatch":"TspTest.Flatten.TodoItemPatch","tsptest.flatten.models.TodoItemPatchStatus":"TspTest.Flatten.TodoItemPatch.status.anonymous","tsptest.flatten.models.UpdatePatchRequest":"TspTest.Flatten.update.Request.anonymous","tsptest.flatten.models.User":"TspTest.Flatten.User"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/flatten/FlattenAsyncClient.java","src/main/java/tsptest/flatten/FlattenClient.java","src/main/java/tsptest/flatten/FlattenClientBuilder.java","src/main/java/tsptest/flatten/FlattenServiceVersion.java","src/main/java/tsptest/flatten/implementation/FlattenClientImpl.java","src/main/java/tsptest/flatten/implementation/JsonMergePatchHelper.java","src/main/java/tsptest/flatten/implementation/models/SendLongRequest.java","src/main/java/tsptest/flatten/implementation/models/SendOptionalBodyRequest.java","src/main/java/tsptest/flatten/implementation/models/SendProjectedNameRequest.java","src/main/java/tsptest/flatten/implementation/models/SendRequest.java","src/main/java/tsptest/flatten/implementation/models/package-info.java","src/main/java/tsptest/flatten/implementation/package-info.java","src/main/java/tsptest/flatten/models/SendLongOptions.java","src/main/java/tsptest/flatten/models/SendLongRequestStatus.java","src/main/java/tsptest/flatten/models/TodoItem.java","src/main/java/tsptest/flatten/models/TodoItemPatch.java","src/main/java/tsptest/flatten/models/TodoItemPatchStatus.java","src/main/java/tsptest/flatten/models/UpdatePatchRequest.java","src/main/java/tsptest/flatten/models/User.java","src/main/java/tsptest/flatten/models/package-info.java","src/main/java/tsptest/flatten/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_apiview_properties.json deleted file mode 100644 index 0f72102f872..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_apiview_properties.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.internal.InternalAsyncClient": "TspTest.Internal.InternalOp", - "tsptest.internal.InternalAsyncClient.getInternal": "TspTest.Internal.InternalOp.getInternal", - "tsptest.internal.InternalAsyncClient.getInternalWithResponse": "TspTest.Internal.InternalOp.getInternal", - "tsptest.internal.InternalAsyncClient.postInternal": "TspTest.Internal.InternalOp.postInternal", - "tsptest.internal.InternalAsyncClient.postInternalWithResponse": "TspTest.Internal.InternalOp.postInternal", - "tsptest.internal.InternalClient": "TspTest.Internal.InternalOp", - "tsptest.internal.InternalClient.getInternal": "TspTest.Internal.InternalOp.getInternal", - "tsptest.internal.InternalClient.getInternalWithResponse": "TspTest.Internal.InternalOp.getInternal", - "tsptest.internal.InternalClient.postInternal": "TspTest.Internal.InternalOp.postInternal", - "tsptest.internal.InternalClient.postInternalWithResponse": "TspTest.Internal.InternalOp.postInternal", - "tsptest.internal.InternalClientBuilder": "TspTest.Internal", - "tsptest.internal.implementation.models.Color": "TspTest.Internal.Color", - "tsptest.internal.implementation.models.ColorModel": "TspTest.Internal.ColorModel", - "tsptest.internal.models.ApiRequest": "TspTest.Internal.ApiRequest", - "tsptest.internal.models.ApiResponse": "TspTest.Internal.ApiResponse", - "tsptest.internal.models.RequestInner": "TspTest.Internal.RequestInner", - "tsptest.internal.models.ResponseInternal": "TspTest.Internal.ResponseInternal", - "tsptest.internal.models.ResponseInternalInner": "TspTest.Internal.ResponseInternalInner", - "tsptest.internal.models.StandAloneData": "TspTest.Internal.StandAloneData", - "tsptest.internal.models.StandAloneDataInner": "TspTest.Internal.StandAloneDataInner", - "tsptest.internal.models.UnusedEnum": "TspTest.Internal.UnusedEnum" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_metadata.json deleted file mode 100644 index 0725b185a36..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.internal.InternalAsyncClient":"TspTest.Internal.InternalOp","tsptest.internal.InternalAsyncClient.getInternal":"TspTest.Internal.InternalOp.getInternal","tsptest.internal.InternalAsyncClient.getInternalWithResponse":"TspTest.Internal.InternalOp.getInternal","tsptest.internal.InternalAsyncClient.postInternal":"TspTest.Internal.InternalOp.postInternal","tsptest.internal.InternalAsyncClient.postInternalWithResponse":"TspTest.Internal.InternalOp.postInternal","tsptest.internal.InternalClient":"TspTest.Internal.InternalOp","tsptest.internal.InternalClient.getInternal":"TspTest.Internal.InternalOp.getInternal","tsptest.internal.InternalClient.getInternalWithResponse":"TspTest.Internal.InternalOp.getInternal","tsptest.internal.InternalClient.postInternal":"TspTest.Internal.InternalOp.postInternal","tsptest.internal.InternalClient.postInternalWithResponse":"TspTest.Internal.InternalOp.postInternal","tsptest.internal.InternalClientBuilder":"TspTest.Internal","tsptest.internal.implementation.models.Color":"TspTest.Internal.Color","tsptest.internal.implementation.models.ColorModel":"TspTest.Internal.ColorModel","tsptest.internal.models.ApiRequest":"TspTest.Internal.ApiRequest","tsptest.internal.models.ApiResponse":"TspTest.Internal.ApiResponse","tsptest.internal.models.RequestInner":"TspTest.Internal.RequestInner","tsptest.internal.models.ResponseInternal":"TspTest.Internal.ResponseInternal","tsptest.internal.models.ResponseInternalInner":"TspTest.Internal.ResponseInternalInner","tsptest.internal.models.StandAloneData":"TspTest.Internal.StandAloneData","tsptest.internal.models.StandAloneDataInner":"TspTest.Internal.StandAloneDataInner","tsptest.internal.models.UnusedEnum":"TspTest.Internal.UnusedEnum"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/internal/InternalAsyncClient.java","src/main/java/tsptest/internal/InternalClient.java","src/main/java/tsptest/internal/InternalClientBuilder.java","src/main/java/tsptest/internal/implementation/InternalClientImpl.java","src/main/java/tsptest/internal/implementation/InternalOpsImpl.java","src/main/java/tsptest/internal/implementation/models/Color.java","src/main/java/tsptest/internal/implementation/models/ColorModel.java","src/main/java/tsptest/internal/implementation/models/package-info.java","src/main/java/tsptest/internal/implementation/package-info.java","src/main/java/tsptest/internal/models/ApiRequest.java","src/main/java/tsptest/internal/models/ApiResponse.java","src/main/java/tsptest/internal/models/RequestInner.java","src/main/java/tsptest/internal/models/ResponseInternal.java","src/main/java/tsptest/internal/models/ResponseInternalInner.java","src/main/java/tsptest/internal/models/StandAloneData.java","src/main/java/tsptest/internal/models/StandAloneDataInner.java","src/main/java/tsptest/internal/models/UnusedEnum.java","src/main/java/tsptest/internal/models/package-info.java","src/main/java/tsptest/internal/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_apiview_properties.json deleted file mode 100644 index 70163b04f02..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_apiview_properties.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.literalservice.LiteralServiceAsyncClient": "TspTest.LiteralService.LiteralOp", - "tsptest.literalservice.LiteralServiceAsyncClient.put": "TspTest.LiteralService.LiteralOp.put", - "tsptest.literalservice.LiteralServiceAsyncClient.putWithResponse": "TspTest.LiteralService.LiteralOp.put", - "tsptest.literalservice.LiteralServiceClient": "TspTest.LiteralService.LiteralOp", - "tsptest.literalservice.LiteralServiceClient.put": "TspTest.LiteralService.LiteralOp.put", - "tsptest.literalservice.LiteralServiceClient.putWithResponse": "TspTest.LiteralService.LiteralOp.put", - "tsptest.literalservice.LiteralServiceClientBuilder": "TspTest.LiteralService", - "tsptest.literalservice.models.Model": "TspTest.LiteralService.Model", - "tsptest.literalservice.models.ModelOptionalLiteral": null, - "tsptest.literalservice.models.PutRequestOptionalLiteralParam": null - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_metadata.json deleted file mode 100644 index 625e4dcfa65..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.literalservice.LiteralServiceAsyncClient":"TspTest.LiteralService.LiteralOp","tsptest.literalservice.LiteralServiceAsyncClient.put":"TspTest.LiteralService.LiteralOp.put","tsptest.literalservice.LiteralServiceAsyncClient.putWithResponse":"TspTest.LiteralService.LiteralOp.put","tsptest.literalservice.LiteralServiceClient":"TspTest.LiteralService.LiteralOp","tsptest.literalservice.LiteralServiceClient.put":"TspTest.LiteralService.LiteralOp.put","tsptest.literalservice.LiteralServiceClient.putWithResponse":"TspTest.LiteralService.LiteralOp.put","tsptest.literalservice.LiteralServiceClientBuilder":"TspTest.LiteralService","tsptest.literalservice.models.Model":"TspTest.LiteralService.Model","tsptest.literalservice.models.ModelOptionalLiteral":null,"tsptest.literalservice.models.PutRequestOptionalLiteralParam":null},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/literalservice/LiteralServiceAsyncClient.java","src/main/java/tsptest/literalservice/LiteralServiceClient.java","src/main/java/tsptest/literalservice/LiteralServiceClientBuilder.java","src/main/java/tsptest/literalservice/implementation/LiteralOpsImpl.java","src/main/java/tsptest/literalservice/implementation/LiteralServiceClientImpl.java","src/main/java/tsptest/literalservice/implementation/package-info.java","src/main/java/tsptest/literalservice/models/Model.java","src/main/java/tsptest/literalservice/models/ModelOptionalLiteral.java","src/main/java/tsptest/literalservice/models/PutRequestOptionalLiteralParam.java","src/main/java/tsptest/literalservice/models/package-info.java","src/main/java/tsptest/literalservice/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_apiview_properties.json deleted file mode 100644 index df246d16cf3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_apiview_properties.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.longrunning.LongRunningAsyncClient": "TspTest.LongRunning", - "tsptest.longrunning.LongRunningAsyncClient.beginCreateJob": "TspTest.LongRunning.createJob", - "tsptest.longrunning.LongRunningAsyncClient.beginCreateJobWithModel": "TspTest.LongRunning.createJob", - "tsptest.longrunning.LongRunningAsyncClient.beginLongRunning": "TspTest.LongRunning.longRunning", - "tsptest.longrunning.LongRunningAsyncClient.beginLongRunningWithModel": "TspTest.LongRunning.longRunning", - "tsptest.longrunning.LongRunningAsyncClient.getJob": "TspTest.LongRunning.getJob", - "tsptest.longrunning.LongRunningAsyncClient.getJobWithResponse": "TspTest.LongRunning.getJob", - "tsptest.longrunning.LongRunningClient": "TspTest.LongRunning", - "tsptest.longrunning.LongRunningClient.beginCreateJob": "TspTest.LongRunning.createJob", - "tsptest.longrunning.LongRunningClient.beginCreateJobWithModel": "TspTest.LongRunning.createJob", - "tsptest.longrunning.LongRunningClient.beginLongRunning": "TspTest.LongRunning.longRunning", - "tsptest.longrunning.LongRunningClient.beginLongRunningWithModel": "TspTest.LongRunning.longRunning", - "tsptest.longrunning.LongRunningClient.getJob": "TspTest.LongRunning.getJob", - "tsptest.longrunning.LongRunningClient.getJobWithResponse": "TspTest.LongRunning.getJob", - "tsptest.longrunning.LongRunningClientBuilder": "TspTest.LongRunning", - "tsptest.longrunning.models.JobData": "TspTest.LongRunning.JobData", - "tsptest.longrunning.models.JobResult": "TspTest.LongRunning.JobResult", - "tsptest.longrunning.models.JobResultResult": "TspTest.LongRunning.JobResult.result.anonymous", - "tsptest.longrunning.models.JobStatus": "TspTest.LongRunning.JobStatus", - "tsptest.longrunning.models.OperationState": "Azure.Core.Foundations.OperationState", - "tsptest.longrunning.models.PollResponse": "TspTest.LongRunning.PollResponse" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_metadata.json deleted file mode 100644 index 838cd158488..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-06-01-preview","crossLanguageDefinitions":{"tsptest.longrunning.LongRunningAsyncClient":"TspTest.LongRunning","tsptest.longrunning.LongRunningAsyncClient.beginCreateJob":"TspTest.LongRunning.createJob","tsptest.longrunning.LongRunningAsyncClient.beginCreateJobWithModel":"TspTest.LongRunning.createJob","tsptest.longrunning.LongRunningAsyncClient.beginLongRunning":"TspTest.LongRunning.longRunning","tsptest.longrunning.LongRunningAsyncClient.beginLongRunningWithModel":"TspTest.LongRunning.longRunning","tsptest.longrunning.LongRunningAsyncClient.getJob":"TspTest.LongRunning.getJob","tsptest.longrunning.LongRunningAsyncClient.getJobWithResponse":"TspTest.LongRunning.getJob","tsptest.longrunning.LongRunningClient":"TspTest.LongRunning","tsptest.longrunning.LongRunningClient.beginCreateJob":"TspTest.LongRunning.createJob","tsptest.longrunning.LongRunningClient.beginCreateJobWithModel":"TspTest.LongRunning.createJob","tsptest.longrunning.LongRunningClient.beginLongRunning":"TspTest.LongRunning.longRunning","tsptest.longrunning.LongRunningClient.beginLongRunningWithModel":"TspTest.LongRunning.longRunning","tsptest.longrunning.LongRunningClient.getJob":"TspTest.LongRunning.getJob","tsptest.longrunning.LongRunningClient.getJobWithResponse":"TspTest.LongRunning.getJob","tsptest.longrunning.LongRunningClientBuilder":"TspTest.LongRunning","tsptest.longrunning.models.JobData":"TspTest.LongRunning.JobData","tsptest.longrunning.models.JobResult":"TspTest.LongRunning.JobResult","tsptest.longrunning.models.JobResultResult":"TspTest.LongRunning.JobResult.result.anonymous","tsptest.longrunning.models.JobStatus":"TspTest.LongRunning.JobStatus","tsptest.longrunning.models.OperationState":"Azure.Core.Foundations.OperationState","tsptest.longrunning.models.PollResponse":"TspTest.LongRunning.PollResponse"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/longrunning/LongRunningAsyncClient.java","src/main/java/tsptest/longrunning/LongRunningClient.java","src/main/java/tsptest/longrunning/LongRunningClientBuilder.java","src/main/java/tsptest/longrunning/LongRunningServiceVersion.java","src/main/java/tsptest/longrunning/implementation/LongRunningClientImpl.java","src/main/java/tsptest/longrunning/implementation/OperationLocationPollingStrategy.java","src/main/java/tsptest/longrunning/implementation/PollingUtils.java","src/main/java/tsptest/longrunning/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/tsptest/longrunning/implementation/package-info.java","src/main/java/tsptest/longrunning/models/JobData.java","src/main/java/tsptest/longrunning/models/JobResult.java","src/main/java/tsptest/longrunning/models/JobResultResult.java","src/main/java/tsptest/longrunning/models/JobStatus.java","src/main/java/tsptest/longrunning/models/OperationState.java","src/main/java/tsptest/longrunning/models/PollResponse.java","src/main/java/tsptest/longrunning/models/package-info.java","src/main/java/tsptest/longrunning/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_apiview_properties.json deleted file mode 100644 index 10851663be0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_apiview_properties.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.methodoverride.MethodOverrideAsyncClient": "TspTest.MethodOverride", - "tsptest.methodoverride.MethodOverrideAsyncClient.groupAll": "TspTest.MethodOverride.groupAll", - "tsptest.methodoverride.MethodOverrideAsyncClient.groupAllWithResponse": "TspTest.MethodOverride.groupAll", - "tsptest.methodoverride.MethodOverrideAsyncClient.groupExcludeBody": "TspTest.MethodOverride.groupExcludeBody", - "tsptest.methodoverride.MethodOverrideAsyncClient.groupExcludeBodyWithResponse": "TspTest.MethodOverride.groupExcludeBody", - "tsptest.methodoverride.MethodOverrideAsyncClient.groupNone": "TspTest.MethodOverride.groupNone", - "tsptest.methodoverride.MethodOverrideAsyncClient.groupNoneWithResponse": "TspTest.MethodOverride.groupNone", - "tsptest.methodoverride.MethodOverrideAsyncClient.groupPart": "TspTest.MethodOverride.groupPart", - "tsptest.methodoverride.MethodOverrideAsyncClient.groupPartETag": "TspTest.MethodOverride.groupPartETag", - "tsptest.methodoverride.MethodOverrideAsyncClient.groupPartETagWithResponse": "TspTest.MethodOverride.groupPartETag", - "tsptest.methodoverride.MethodOverrideAsyncClient.groupPartWithResponse": "TspTest.MethodOverride.groupPart", - "tsptest.methodoverride.MethodOverrideAsyncClient.groupQuery": "TspTest.MethodOverride.groupQuery", - "tsptest.methodoverride.MethodOverrideAsyncClient.groupQueryWithResponse": "TspTest.MethodOverride.groupQuery", - "tsptest.methodoverride.MethodOverrideClient": "TspTest.MethodOverride", - "tsptest.methodoverride.MethodOverrideClient.groupAll": "TspTest.MethodOverride.groupAll", - "tsptest.methodoverride.MethodOverrideClient.groupAllWithResponse": "TspTest.MethodOverride.groupAll", - "tsptest.methodoverride.MethodOverrideClient.groupExcludeBody": "TspTest.MethodOverride.groupExcludeBody", - "tsptest.methodoverride.MethodOverrideClient.groupExcludeBodyWithResponse": "TspTest.MethodOverride.groupExcludeBody", - "tsptest.methodoverride.MethodOverrideClient.groupNone": "TspTest.MethodOverride.groupNone", - "tsptest.methodoverride.MethodOverrideClient.groupNoneWithResponse": "TspTest.MethodOverride.groupNone", - "tsptest.methodoverride.MethodOverrideClient.groupPart": "TspTest.MethodOverride.groupPart", - "tsptest.methodoverride.MethodOverrideClient.groupPartETag": "TspTest.MethodOverride.groupPartETag", - "tsptest.methodoverride.MethodOverrideClient.groupPartETagWithResponse": "TspTest.MethodOverride.groupPartETag", - "tsptest.methodoverride.MethodOverrideClient.groupPartWithResponse": "TspTest.MethodOverride.groupPart", - "tsptest.methodoverride.MethodOverrideClient.groupQuery": "TspTest.MethodOverride.groupQuery", - "tsptest.methodoverride.MethodOverrideClient.groupQueryWithResponse": "TspTest.MethodOverride.groupQuery", - "tsptest.methodoverride.MethodOverrideClientBuilder": "TspTest.MethodOverride", - "tsptest.methodoverride.implementation.models.GroupAllRequest": "TspTest.MethodOverride.groupAll.Request.anonymous", - "tsptest.methodoverride.implementation.models.GroupNoneRequest": "TspTest.MethodOverride.groupNone.Request.anonymous", - "tsptest.methodoverride.implementation.models.GroupPartETagRequest": "TspTest.MethodOverride.groupPartETag.Request.anonymous", - "tsptest.methodoverride.implementation.models.GroupPartRequest": "TspTest.MethodOverride.groupPart.Request.anonymous", - "tsptest.methodoverride.models.GroupAllOptions": null, - "tsptest.methodoverride.models.GroupExcludeBodyModel": "TspTest.MethodOverride.GroupExcludeBodyModel", - "tsptest.methodoverride.models.GroupPartETagOptions": null, - "tsptest.methodoverride.models.GroupPartOptions": null, - "tsptest.methodoverride.models.GroupQueryOptions": null - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_metadata.json deleted file mode 100644 index d3b5b3eab8c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"tsptest.methodoverride.MethodOverrideAsyncClient":"TspTest.MethodOverride","tsptest.methodoverride.MethodOverrideAsyncClient.groupAll":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideAsyncClient.groupAllWithResponse":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideAsyncClient.groupExcludeBody":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideAsyncClient.groupExcludeBodyWithResponse":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideAsyncClient.groupNone":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideAsyncClient.groupNoneWithResponse":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideAsyncClient.groupPart":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideAsyncClient.groupPartETag":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideAsyncClient.groupPartETagWithResponse":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideAsyncClient.groupPartWithResponse":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideAsyncClient.groupQuery":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideAsyncClient.groupQueryWithResponse":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideClient":"TspTest.MethodOverride","tsptest.methodoverride.MethodOverrideClient.groupAll":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideClient.groupAllWithResponse":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideClient.groupExcludeBody":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideClient.groupExcludeBodyWithResponse":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideClient.groupNone":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideClient.groupNoneWithResponse":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideClient.groupPart":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideClient.groupPartETag":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideClient.groupPartETagWithResponse":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideClient.groupPartWithResponse":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideClient.groupQuery":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideClient.groupQueryWithResponse":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideClientBuilder":"TspTest.MethodOverride","tsptest.methodoverride.implementation.models.GroupAllRequest":"TspTest.MethodOverride.groupAll.Request.anonymous","tsptest.methodoverride.implementation.models.GroupNoneRequest":"TspTest.MethodOverride.groupNone.Request.anonymous","tsptest.methodoverride.implementation.models.GroupPartETagRequest":"TspTest.MethodOverride.groupPartETag.Request.anonymous","tsptest.methodoverride.implementation.models.GroupPartRequest":"TspTest.MethodOverride.groupPart.Request.anonymous","tsptest.methodoverride.models.GroupAllOptions":null,"tsptest.methodoverride.models.GroupExcludeBodyModel":"TspTest.MethodOverride.GroupExcludeBodyModel","tsptest.methodoverride.models.GroupPartETagOptions":null,"tsptest.methodoverride.models.GroupPartOptions":null,"tsptest.methodoverride.models.GroupQueryOptions":null},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java","src/main/java/tsptest/methodoverride/MethodOverrideClient.java","src/main/java/tsptest/methodoverride/MethodOverrideClientBuilder.java","src/main/java/tsptest/methodoverride/MethodOverrideServiceVersion.java","src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java","src/main/java/tsptest/methodoverride/implementation/models/GroupAllRequest.java","src/main/java/tsptest/methodoverride/implementation/models/GroupNoneRequest.java","src/main/java/tsptest/methodoverride/implementation/models/GroupPartETagRequest.java","src/main/java/tsptest/methodoverride/implementation/models/GroupPartRequest.java","src/main/java/tsptest/methodoverride/implementation/models/package-info.java","src/main/java/tsptest/methodoverride/implementation/package-info.java","src/main/java/tsptest/methodoverride/models/GroupAllOptions.java","src/main/java/tsptest/methodoverride/models/GroupExcludeBodyModel.java","src/main/java/tsptest/methodoverride/models/GroupPartETagOptions.java","src/main/java/tsptest/methodoverride/models/GroupPartOptions.java","src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java","src/main/java/tsptest/methodoverride/models/package-info.java","src/main/java/tsptest/methodoverride/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_apiview_properties.json deleted file mode 100644 index 4e61494580d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_apiview_properties.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.model.ModelAsyncClient": "TspTest.Model.ModelOp", - "tsptest.model.ModelAsyncClient.get3": "TspTest.Model.ModelOp.get3", - "tsptest.model.ModelAsyncClient.get3WithResponse": "TspTest.Model.ModelOp.get3", - "tsptest.model.ModelAsyncClient.put1": "TspTest.Model.ModelOp.put1", - "tsptest.model.ModelAsyncClient.put1WithResponse": "TspTest.Model.ModelOp.put1", - "tsptest.model.ModelAsyncClient.put2": "TspTest.Model.ModelOp.put2", - "tsptest.model.ModelAsyncClient.put2WithResponse": "TspTest.Model.ModelOp.put2", - "tsptest.model.ModelAsyncClient.putNested": "TspTest.Model.ModelOp.putNested", - "tsptest.model.ModelAsyncClient.putNestedWithResponse": "TspTest.Model.ModelOp.putNested", - "tsptest.model.ModelClient": "TspTest.Model.ModelOp", - "tsptest.model.ModelClient.get3": "TspTest.Model.ModelOp.get3", - "tsptest.model.ModelClient.get3WithResponse": "TspTest.Model.ModelOp.get3", - "tsptest.model.ModelClient.put1": "TspTest.Model.ModelOp.put1", - "tsptest.model.ModelClient.put1WithResponse": "TspTest.Model.ModelOp.put1", - "tsptest.model.ModelClient.put2": "TspTest.Model.ModelOp.put2", - "tsptest.model.ModelClient.put2WithResponse": "TspTest.Model.ModelOp.put2", - "tsptest.model.ModelClient.putNested": "TspTest.Model.ModelOp.putNested", - "tsptest.model.ModelClient.putNestedWithResponse": "TspTest.Model.ModelOp.putNested", - "tsptest.model.ModelClientBuilder": "TspTest.Model", - "tsptest.model.models.InputOutputData2": "TspTest.Model.InputOutputData2", - "tsptest.model.models.NestedModel": "TspTest.Model.NestedModel", - "tsptest.model.models.NestedModel1": "TspTest.Model.NestedModel1", - "tsptest.model.models.NestedModel2": "TspTest.Model.NestedModel2", - "tsptest.model.models.OutputData": "TspTest.Model.OutputData", - "tsptest.model.models.OutputData3": "TspTest.Model.OutputData3", - "tsptest.model.models.Resource1": "TspTest.Model.Resource1", - "tsptest.model.models.Resource2": "TspTest.Model.Resource2", - "tsptest.model.models.Resource3": "TspTest.Model.Resource3" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_metadata.json deleted file mode 100644 index b046c907fc0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.model.ModelAsyncClient":"TspTest.Model.ModelOp","tsptest.model.ModelAsyncClient.get3":"TspTest.Model.ModelOp.get3","tsptest.model.ModelAsyncClient.get3WithResponse":"TspTest.Model.ModelOp.get3","tsptest.model.ModelAsyncClient.put1":"TspTest.Model.ModelOp.put1","tsptest.model.ModelAsyncClient.put1WithResponse":"TspTest.Model.ModelOp.put1","tsptest.model.ModelAsyncClient.put2":"TspTest.Model.ModelOp.put2","tsptest.model.ModelAsyncClient.put2WithResponse":"TspTest.Model.ModelOp.put2","tsptest.model.ModelAsyncClient.putNested":"TspTest.Model.ModelOp.putNested","tsptest.model.ModelAsyncClient.putNestedWithResponse":"TspTest.Model.ModelOp.putNested","tsptest.model.ModelClient":"TspTest.Model.ModelOp","tsptest.model.ModelClient.get3":"TspTest.Model.ModelOp.get3","tsptest.model.ModelClient.get3WithResponse":"TspTest.Model.ModelOp.get3","tsptest.model.ModelClient.put1":"TspTest.Model.ModelOp.put1","tsptest.model.ModelClient.put1WithResponse":"TspTest.Model.ModelOp.put1","tsptest.model.ModelClient.put2":"TspTest.Model.ModelOp.put2","tsptest.model.ModelClient.put2WithResponse":"TspTest.Model.ModelOp.put2","tsptest.model.ModelClient.putNested":"TspTest.Model.ModelOp.putNested","tsptest.model.ModelClient.putNestedWithResponse":"TspTest.Model.ModelOp.putNested","tsptest.model.ModelClientBuilder":"TspTest.Model","tsptest.model.models.InputOutputData2":"TspTest.Model.InputOutputData2","tsptest.model.models.NestedModel":"TspTest.Model.NestedModel","tsptest.model.models.NestedModel1":"TspTest.Model.NestedModel1","tsptest.model.models.NestedModel2":"TspTest.Model.NestedModel2","tsptest.model.models.OutputData":"TspTest.Model.OutputData","tsptest.model.models.OutputData3":"TspTest.Model.OutputData3","tsptest.model.models.Resource1":"TspTest.Model.Resource1","tsptest.model.models.Resource2":"TspTest.Model.Resource2","tsptest.model.models.Resource3":"TspTest.Model.Resource3"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/model/ModelAsyncClient.java","src/main/java/tsptest/model/ModelClient.java","src/main/java/tsptest/model/ModelClientBuilder.java","src/main/java/tsptest/model/implementation/ModelClientImpl.java","src/main/java/tsptest/model/implementation/ModelOpsImpl.java","src/main/java/tsptest/model/implementation/package-info.java","src/main/java/tsptest/model/models/InputOutputData2.java","src/main/java/tsptest/model/models/NestedModel.java","src/main/java/tsptest/model/models/NestedModel1.java","src/main/java/tsptest/model/models/NestedModel2.java","src/main/java/tsptest/model/models/OutputData.java","src/main/java/tsptest/model/models/OutputData3.java","src/main/java/tsptest/model/models/Resource1.java","src/main/java/tsptest/model/models/Resource2.java","src/main/java/tsptest/model/models/Resource3.java","src/main/java/tsptest/model/models/package-info.java","src/main/java/tsptest/model/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_apiview_properties.json deleted file mode 100644 index e22e3a1a0a4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_apiview_properties.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.multicontenttypes.MultiContentTypesAsyncClient": "TspTest.MultiContentTypes", - "tsptest.multicontenttypes.MultiContentTypesClient": "TspTest.MultiContentTypes", - "tsptest.multicontenttypes.MultiContentTypesClientBuilder": "TspTest.MultiContentTypes", - "tsptest.multicontenttypes.MultipleContentTypesOnRequestAsyncClient": "TspTest.MultiContentTypes.MultipleContentTypesOnRequest", - "tsptest.multicontenttypes.MultipleContentTypesOnRequestAsyncClient.uploadJsonWithMultiBodyTypesForMultiContentTypes": "TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes", - "tsptest.multicontenttypes.MultipleContentTypesOnRequestAsyncClient.uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse": "TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes", - "tsptest.multicontenttypes.MultipleContentTypesOnRequestClient": "TspTest.MultiContentTypes.MultipleContentTypesOnRequest", - "tsptest.multicontenttypes.MultipleContentTypesOnRequestClient.uploadJsonWithMultiBodyTypesForMultiContentTypes": "TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes", - "tsptest.multicontenttypes.MultipleContentTypesOnRequestClient.uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse": "TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes", - "tsptest.multicontenttypes.SingleContentTypeAsyncClient": "TspTest.MultiContentTypes.SingleContentType", - "tsptest.multicontenttypes.SingleContentTypeAsyncClient.downloadImageForSingleContentType": "TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType", - "tsptest.multicontenttypes.SingleContentTypeAsyncClient.downloadImageForSingleContentTypeWithResponse": "TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType", - "tsptest.multicontenttypes.SingleContentTypeAsyncClient.uploadImageForSingleContentType": "TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType", - "tsptest.multicontenttypes.SingleContentTypeAsyncClient.uploadImageForSingleContentTypeWithResponse": "TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType", - "tsptest.multicontenttypes.SingleContentTypeClient": "TspTest.MultiContentTypes.SingleContentType", - "tsptest.multicontenttypes.SingleContentTypeClient.downloadImageForSingleContentType": "TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType", - "tsptest.multicontenttypes.SingleContentTypeClient.downloadImageForSingleContentTypeWithResponse": "TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType", - "tsptest.multicontenttypes.SingleContentTypeClient.uploadImageForSingleContentType": "TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType", - "tsptest.multicontenttypes.SingleContentTypeClient.uploadImageForSingleContentTypeWithResponse": "TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType", - "tsptest.multicontenttypes.models.Resource": "TspTest.MultiContentTypes.Resource" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_metadata.json deleted file mode 100644 index c6679c3d9ac..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.multicontenttypes.MultiContentTypesAsyncClient":"TspTest.MultiContentTypes","tsptest.multicontenttypes.MultiContentTypesClient":"TspTest.MultiContentTypes","tsptest.multicontenttypes.MultiContentTypesClientBuilder":"TspTest.MultiContentTypes","tsptest.multicontenttypes.MultipleContentTypesOnRequestAsyncClient":"TspTest.MultiContentTypes.MultipleContentTypesOnRequest","tsptest.multicontenttypes.MultipleContentTypesOnRequestAsyncClient.uploadJsonWithMultiBodyTypesForMultiContentTypes":"TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes","tsptest.multicontenttypes.MultipleContentTypesOnRequestAsyncClient.uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse":"TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes","tsptest.multicontenttypes.MultipleContentTypesOnRequestClient":"TspTest.MultiContentTypes.MultipleContentTypesOnRequest","tsptest.multicontenttypes.MultipleContentTypesOnRequestClient.uploadJsonWithMultiBodyTypesForMultiContentTypes":"TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes","tsptest.multicontenttypes.MultipleContentTypesOnRequestClient.uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse":"TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes","tsptest.multicontenttypes.SingleContentTypeAsyncClient":"TspTest.MultiContentTypes.SingleContentType","tsptest.multicontenttypes.SingleContentTypeAsyncClient.downloadImageForSingleContentType":"TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeAsyncClient.downloadImageForSingleContentTypeWithResponse":"TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeAsyncClient.uploadImageForSingleContentType":"TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeAsyncClient.uploadImageForSingleContentTypeWithResponse":"TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeClient":"TspTest.MultiContentTypes.SingleContentType","tsptest.multicontenttypes.SingleContentTypeClient.downloadImageForSingleContentType":"TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeClient.downloadImageForSingleContentTypeWithResponse":"TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeClient.uploadImageForSingleContentType":"TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeClient.uploadImageForSingleContentTypeWithResponse":"TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType","tsptest.multicontenttypes.models.Resource":"TspTest.MultiContentTypes.Resource"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/multicontenttypes/MultiContentTypesAsyncClient.java","src/main/java/tsptest/multicontenttypes/MultiContentTypesClient.java","src/main/java/tsptest/multicontenttypes/MultiContentTypesClientBuilder.java","src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestAsyncClient.java","src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestClient.java","src/main/java/tsptest/multicontenttypes/SingleContentTypeAsyncClient.java","src/main/java/tsptest/multicontenttypes/SingleContentTypeClient.java","src/main/java/tsptest/multicontenttypes/implementation/MultiContentTypesClientImpl.java","src/main/java/tsptest/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java","src/main/java/tsptest/multicontenttypes/implementation/SingleContentTypesImpl.java","src/main/java/tsptest/multicontenttypes/implementation/package-info.java","src/main/java/tsptest/multicontenttypes/models/Resource.java","src/main/java/tsptest/multicontenttypes/models/package-info.java","src/main/java/tsptest/multicontenttypes/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_apiview_properties.json deleted file mode 100644 index 80c378ecf48..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_apiview_properties.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.multipart.MultipartAsyncClient": "TspTest.Multipart", - "tsptest.multipart.MultipartAsyncClient.upload": "TspTest.Multipart.upload", - "tsptest.multipart.MultipartAsyncClient.uploadHttpPart": "TspTest.Multipart.uploadHttpPart", - "tsptest.multipart.MultipartAsyncClient.uploadHttpPartWithResponse": "TspTest.Multipart.uploadHttpPart", - "tsptest.multipart.MultipartAsyncClient.uploadWithResponse": "TspTest.Multipart.upload", - "tsptest.multipart.MultipartClient": "TspTest.Multipart", - "tsptest.multipart.MultipartClient.upload": "TspTest.Multipart.upload", - "tsptest.multipart.MultipartClient.uploadHttpPart": "TspTest.Multipart.uploadHttpPart", - "tsptest.multipart.MultipartClient.uploadHttpPartWithResponse": "TspTest.Multipart.uploadHttpPart", - "tsptest.multipart.MultipartClient.uploadWithResponse": "TspTest.Multipart.upload", - "tsptest.multipart.MultipartClientBuilder": "TspTest.Multipart", - "tsptest.multipart.models.FileDataFileDetails": null, - "tsptest.multipart.models.FileDetails": "TypeSpec.Http.File", - "tsptest.multipart.models.FormData": "TspTest.Multipart.FormData", - "tsptest.multipart.models.ImageFileDetails": null, - "tsptest.multipart.models.ImageType": "TspTest.Multipart.ImageType", - "tsptest.multipart.models.InheritFileData": "TspTest.Multipart.Inherit2File", - "tsptest.multipart.models.Size": "TspTest.Multipart.Size", - "tsptest.multipart.models.UploadHttpPartRequest": "TspTest.Multipart.uploadHttpPart.Request.anonymous" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_metadata.json deleted file mode 100644 index ebc522ead6f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.multipart.MultipartAsyncClient":"TspTest.Multipart","tsptest.multipart.MultipartAsyncClient.upload":"TspTest.Multipart.upload","tsptest.multipart.MultipartAsyncClient.uploadHttpPart":"TspTest.Multipart.uploadHttpPart","tsptest.multipart.MultipartAsyncClient.uploadHttpPartWithResponse":"TspTest.Multipart.uploadHttpPart","tsptest.multipart.MultipartAsyncClient.uploadWithResponse":"TspTest.Multipart.upload","tsptest.multipart.MultipartClient":"TspTest.Multipart","tsptest.multipart.MultipartClient.upload":"TspTest.Multipart.upload","tsptest.multipart.MultipartClient.uploadHttpPart":"TspTest.Multipart.uploadHttpPart","tsptest.multipart.MultipartClient.uploadHttpPartWithResponse":"TspTest.Multipart.uploadHttpPart","tsptest.multipart.MultipartClient.uploadWithResponse":"TspTest.Multipart.upload","tsptest.multipart.MultipartClientBuilder":"TspTest.Multipart","tsptest.multipart.models.FileDataFileDetails":null,"tsptest.multipart.models.FileDetails":"TypeSpec.Http.File","tsptest.multipart.models.FormData":"TspTest.Multipart.FormData","tsptest.multipart.models.ImageFileDetails":null,"tsptest.multipart.models.ImageType":"TspTest.Multipart.ImageType","tsptest.multipart.models.InheritFileData":"TspTest.Multipart.Inherit2File","tsptest.multipart.models.Size":"TspTest.Multipart.Size","tsptest.multipart.models.UploadHttpPartRequest":"TspTest.Multipart.uploadHttpPart.Request.anonymous"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/multipart/MultipartAsyncClient.java","src/main/java/tsptest/multipart/MultipartClient.java","src/main/java/tsptest/multipart/MultipartClientBuilder.java","src/main/java/tsptest/multipart/implementation/MultipartClientImpl.java","src/main/java/tsptest/multipart/implementation/MultipartFormDataHelper.java","src/main/java/tsptest/multipart/implementation/package-info.java","src/main/java/tsptest/multipart/models/FileDataFileDetails.java","src/main/java/tsptest/multipart/models/FileDetails.java","src/main/java/tsptest/multipart/models/FormData.java","src/main/java/tsptest/multipart/models/ImageFileDetails.java","src/main/java/tsptest/multipart/models/ImageType.java","src/main/java/tsptest/multipart/models/InheritFileData.java","src/main/java/tsptest/multipart/models/Size.java","src/main/java/tsptest/multipart/models/UploadHttpPartRequest.java","src/main/java/tsptest/multipart/models/package-info.java","src/main/java/tsptest/multipart/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_apiview_properties.json deleted file mode 100644 index a177c21a899..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_apiview_properties.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.namespaceclient.NamespaceAsyncClient": "TspTest.NamespaceClient", - "tsptest.namespaceclient.NamespaceAsyncClient.get": "TspTest.NamespaceClient.get", - "tsptest.namespaceclient.NamespaceAsyncClient.getWithResponse": "TspTest.NamespaceClient.get", - "tsptest.namespaceclient.NamespaceClient": "TspTest.NamespaceClient", - "tsptest.namespaceclient.NamespaceClient.get": "TspTest.NamespaceClient.get", - "tsptest.namespaceclient.NamespaceClient.getWithResponse": "TspTest.NamespaceClient.get", - "tsptest.namespaceclient.NamespaceClientBuilder": "TspTest.NamespaceClient", - "tsptest.namespacemodel.models.Model": "TspTest.NamespaceModel.Model" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_metadata.json deleted file mode 100644 index c559630f57e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.namespaceclient.NamespaceAsyncClient":"TspTest.NamespaceClient","tsptest.namespaceclient.NamespaceAsyncClient.get":"TspTest.NamespaceClient.get","tsptest.namespaceclient.NamespaceAsyncClient.getWithResponse":"TspTest.NamespaceClient.get","tsptest.namespaceclient.NamespaceClient":"TspTest.NamespaceClient","tsptest.namespaceclient.NamespaceClient.get":"TspTest.NamespaceClient.get","tsptest.namespaceclient.NamespaceClient.getWithResponse":"TspTest.NamespaceClient.get","tsptest.namespaceclient.NamespaceClientBuilder":"TspTest.NamespaceClient","tsptest.namespacemodel.models.Model":"TspTest.NamespaceModel.Model"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/namespaceclient/NamespaceAsyncClient.java","src/main/java/tsptest/namespaceclient/NamespaceClient.java","src/main/java/tsptest/namespaceclient/NamespaceClientBuilder.java","src/main/java/tsptest/namespaceclient/implementation/NamespaceClientImpl.java","src/main/java/tsptest/namespaceclient/implementation/package-info.java","src/main/java/tsptest/namespaceclient/package-info.java","src/main/java/tsptest/namespacemodel/models/Model.java","src/main/java/tsptest/namespacemodel/models/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_apiview_properties.json deleted file mode 100644 index 4fcd275ff4b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_apiview_properties.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.naming.NamingAsyncClient": "TspTest.Naming.NamingOp", - "tsptest.naming.NamingAsyncClient.getAnonymous": "TspTest.Naming.NamingOp.getAnonymous", - "tsptest.naming.NamingAsyncClient.getAnonymousWithResponse": "TspTest.Naming.NamingOp.getAnonymous", - "tsptest.naming.NamingAsyncClient.post": "TspTest.Naming.NamingOp.post", - "tsptest.naming.NamingAsyncClient.postWithResponse": "TspTest.Naming.NamingOp.post", - "tsptest.naming.NamingClient": "TspTest.Naming.NamingOp", - "tsptest.naming.NamingClient.getAnonymous": "TspTest.Naming.NamingOp.getAnonymous", - "tsptest.naming.NamingClient.getAnonymousWithResponse": "TspTest.Naming.NamingOp.getAnonymous", - "tsptest.naming.NamingClient.post": "TspTest.Naming.NamingOp.post", - "tsptest.naming.NamingClient.postWithResponse": "TspTest.Naming.NamingOp.post", - "tsptest.naming.NamingClientBuilder": "TspTest.Naming", - "tsptest.naming.models.BinaryData": "TspTest.Naming.DataModel", - "tsptest.naming.models.BytesData": "TspTest.Naming.BytesData", - "tsptest.naming.models.Data": "TspTest.Naming.Data", - "tsptest.naming.models.DataRequest": "TspTest.Naming.Request", - "tsptest.naming.models.DataResponse": "TspTest.Naming.Response", - "tsptest.naming.models.DataStatus": "TspTest.Naming.StatusModel", - "tsptest.naming.models.GetAnonymousResponse": "TspTest.Naming.getAnonymous.Response.anonymous", - "tsptest.naming.models.RequestParameters": "TspTest.Naming.Request.parameters.anonymous", - "tsptest.naming.models.RequestParametersType": "TspTest.Naming.Request.parameters.type.anonymous", - "tsptest.naming.models.RunObject": "TspTest.Naming.RunObject", - "tsptest.naming.models.RunObjectLastErrorCodeRenamed": "TspTest.Naming.RunObject.last_error.code.anonymous", - "tsptest.naming.models.RunObjectLastErrorRenamed": "TspTest.Naming.RunObject.last_error.anonymous", - "tsptest.naming.models.TypesModel": "TspTest.Naming.TypesModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_metadata.json deleted file mode 100644 index eec462e5b7c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.naming.NamingAsyncClient":"TspTest.Naming.NamingOp","tsptest.naming.NamingAsyncClient.getAnonymous":"TspTest.Naming.NamingOp.getAnonymous","tsptest.naming.NamingAsyncClient.getAnonymousWithResponse":"TspTest.Naming.NamingOp.getAnonymous","tsptest.naming.NamingAsyncClient.post":"TspTest.Naming.NamingOp.post","tsptest.naming.NamingAsyncClient.postWithResponse":"TspTest.Naming.NamingOp.post","tsptest.naming.NamingClient":"TspTest.Naming.NamingOp","tsptest.naming.NamingClient.getAnonymous":"TspTest.Naming.NamingOp.getAnonymous","tsptest.naming.NamingClient.getAnonymousWithResponse":"TspTest.Naming.NamingOp.getAnonymous","tsptest.naming.NamingClient.post":"TspTest.Naming.NamingOp.post","tsptest.naming.NamingClient.postWithResponse":"TspTest.Naming.NamingOp.post","tsptest.naming.NamingClientBuilder":"TspTest.Naming","tsptest.naming.models.BinaryData":"TspTest.Naming.DataModel","tsptest.naming.models.BytesData":"TspTest.Naming.BytesData","tsptest.naming.models.Data":"TspTest.Naming.Data","tsptest.naming.models.DataRequest":"TspTest.Naming.Request","tsptest.naming.models.DataResponse":"TspTest.Naming.Response","tsptest.naming.models.DataStatus":"TspTest.Naming.StatusModel","tsptest.naming.models.GetAnonymousResponse":"TspTest.Naming.getAnonymous.Response.anonymous","tsptest.naming.models.RequestParameters":"TspTest.Naming.Request.parameters.anonymous","tsptest.naming.models.RequestParametersType":"TspTest.Naming.Request.parameters.type.anonymous","tsptest.naming.models.RunObject":"TspTest.Naming.RunObject","tsptest.naming.models.RunObjectLastErrorCodeRenamed":"TspTest.Naming.RunObject.last_error.code.anonymous","tsptest.naming.models.RunObjectLastErrorRenamed":"TspTest.Naming.RunObject.last_error.anonymous","tsptest.naming.models.TypesModel":"TspTest.Naming.TypesModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/naming/NamingAsyncClient.java","src/main/java/tsptest/naming/NamingClient.java","src/main/java/tsptest/naming/NamingClientBuilder.java","src/main/java/tsptest/naming/implementation/NamingClientImpl.java","src/main/java/tsptest/naming/implementation/NamingOpsImpl.java","src/main/java/tsptest/naming/implementation/package-info.java","src/main/java/tsptest/naming/models/BinaryData.java","src/main/java/tsptest/naming/models/BytesData.java","src/main/java/tsptest/naming/models/Data.java","src/main/java/tsptest/naming/models/DataRequest.java","src/main/java/tsptest/naming/models/DataResponse.java","src/main/java/tsptest/naming/models/DataStatus.java","src/main/java/tsptest/naming/models/GetAnonymousResponse.java","src/main/java/tsptest/naming/models/RequestParameters.java","src/main/java/tsptest/naming/models/RequestParametersType.java","src/main/java/tsptest/naming/models/RunObject.java","src/main/java/tsptest/naming/models/RunObjectLastErrorCodeRenamed.java","src/main/java/tsptest/naming/models/RunObjectLastErrorRenamed.java","src/main/java/tsptest/naming/models/TypesModel.java","src/main/java/tsptest/naming/models/package-info.java","src/main/java/tsptest/naming/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_apiview_properties.json deleted file mode 100644 index b9a1873b662..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_apiview_properties.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.namingjavaparser.NamingJavaParserAsyncClient": "TspTest.NamingJavaParser.NamingOp", - "tsptest.namingjavaparser.NamingJavaParserAsyncClient.getAnonymous": "TspTest.NamingJavaParser.NamingOp.getAnonymous", - "tsptest.namingjavaparser.NamingJavaParserAsyncClient.getAnonymousWithResponse": "TspTest.NamingJavaParser.NamingOp.getAnonymous", - "tsptest.namingjavaparser.NamingJavaParserAsyncClient.post": "TspTest.NamingJavaParser.NamingOp.post", - "tsptest.namingjavaparser.NamingJavaParserAsyncClient.postWithResponse": "TspTest.NamingJavaParser.NamingOp.post", - "tsptest.namingjavaparser.NamingJavaParserClient": "TspTest.NamingJavaParser.NamingOp", - "tsptest.namingjavaparser.NamingJavaParserClient.getAnonymous": "TspTest.NamingJavaParser.NamingOp.getAnonymous", - "tsptest.namingjavaparser.NamingJavaParserClient.getAnonymousWithResponse": "TspTest.NamingJavaParser.NamingOp.getAnonymous", - "tsptest.namingjavaparser.NamingJavaParserClient.post": "TspTest.NamingJavaParser.NamingOp.post", - "tsptest.namingjavaparser.NamingJavaParserClient.postWithResponse": "TspTest.NamingJavaParser.NamingOp.post", - "tsptest.namingjavaparser.NamingJavaParserClientBuilder": "TspTest.NamingJavaParser", - "tsptest.namingjavaparser.models.BinaryData": "TspTest.NamingJavaParser.DataModel", - "tsptest.namingjavaparser.models.BytesData": "TspTest.NamingJavaParser.BytesData", - "tsptest.namingjavaparser.models.Data": "TspTest.NamingJavaParser.Data", - "tsptest.namingjavaparser.models.DataRequest": "TspTest.NamingJavaParser.Request", - "tsptest.namingjavaparser.models.DataResponse": "TspTest.NamingJavaParser.Response", - "tsptest.namingjavaparser.models.DataStatus": "TspTest.NamingJavaParser.StatusModel", - "tsptest.namingjavaparser.models.GetAnonymousResponse": "TspTest.NamingJavaParser.getAnonymous.Response.anonymous", - "tsptest.namingjavaparser.models.RequestParameters": "TspTest.NamingJavaParser.Request.parameters.anonymous", - "tsptest.namingjavaparser.models.RequestParametersType": "TspTest.NamingJavaParser.Request.parameters.type.anonymous", - "tsptest.namingjavaparser.models.RunObject": "TspTest.NamingJavaParser.RunObject", - "tsptest.namingjavaparser.models.RunObjectLastError1": "TspTest.NamingJavaParser.RunObject.last_error.anonymous", - "tsptest.namingjavaparser.models.RunObjectLastErrorCode": "TspTest.NamingJavaParser.RunObject.last_error.code.anonymous", - "tsptest.namingjavaparser.models.TypesModel": "TspTest.NamingJavaParser.TypesModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_metadata.json deleted file mode 100644 index 0cb93e61ec2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.namingjavaparser.NamingJavaParserAsyncClient":"TspTest.NamingJavaParser.NamingOp","tsptest.namingjavaparser.NamingJavaParserAsyncClient.getAnonymous":"TspTest.NamingJavaParser.NamingOp.getAnonymous","tsptest.namingjavaparser.NamingJavaParserAsyncClient.getAnonymousWithResponse":"TspTest.NamingJavaParser.NamingOp.getAnonymous","tsptest.namingjavaparser.NamingJavaParserAsyncClient.post":"TspTest.NamingJavaParser.NamingOp.post","tsptest.namingjavaparser.NamingJavaParserAsyncClient.postWithResponse":"TspTest.NamingJavaParser.NamingOp.post","tsptest.namingjavaparser.NamingJavaParserClient":"TspTest.NamingJavaParser.NamingOp","tsptest.namingjavaparser.NamingJavaParserClient.getAnonymous":"TspTest.NamingJavaParser.NamingOp.getAnonymous","tsptest.namingjavaparser.NamingJavaParserClient.getAnonymousWithResponse":"TspTest.NamingJavaParser.NamingOp.getAnonymous","tsptest.namingjavaparser.NamingJavaParserClient.post":"TspTest.NamingJavaParser.NamingOp.post","tsptest.namingjavaparser.NamingJavaParserClient.postWithResponse":"TspTest.NamingJavaParser.NamingOp.post","tsptest.namingjavaparser.NamingJavaParserClientBuilder":"TspTest.NamingJavaParser","tsptest.namingjavaparser.models.BinaryData":"TspTest.NamingJavaParser.DataModel","tsptest.namingjavaparser.models.BytesData":"TspTest.NamingJavaParser.BytesData","tsptest.namingjavaparser.models.Data":"TspTest.NamingJavaParser.Data","tsptest.namingjavaparser.models.DataRequest":"TspTest.NamingJavaParser.Request","tsptest.namingjavaparser.models.DataResponse":"TspTest.NamingJavaParser.Response","tsptest.namingjavaparser.models.DataStatus":"TspTest.NamingJavaParser.StatusModel","tsptest.namingjavaparser.models.GetAnonymousResponse":"TspTest.NamingJavaParser.getAnonymous.Response.anonymous","tsptest.namingjavaparser.models.RequestParameters":"TspTest.NamingJavaParser.Request.parameters.anonymous","tsptest.namingjavaparser.models.RequestParametersType":"TspTest.NamingJavaParser.Request.parameters.type.anonymous","tsptest.namingjavaparser.models.RunObject":"TspTest.NamingJavaParser.RunObject","tsptest.namingjavaparser.models.RunObjectLastError1":"TspTest.NamingJavaParser.RunObject.last_error.anonymous","tsptest.namingjavaparser.models.RunObjectLastErrorCode":"TspTest.NamingJavaParser.RunObject.last_error.code.anonymous","tsptest.namingjavaparser.models.TypesModel":"TspTest.NamingJavaParser.TypesModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/namingjavaparser/NamingJavaParserAsyncClient.java","src/main/java/tsptest/namingjavaparser/NamingJavaParserClient.java","src/main/java/tsptest/namingjavaparser/NamingJavaParserClientBuilder.java","src/main/java/tsptest/namingjavaparser/implementation/NamingJavaParserClientImpl.java","src/main/java/tsptest/namingjavaparser/implementation/NamingOpsImpl.java","src/main/java/tsptest/namingjavaparser/implementation/package-info.java","src/main/java/tsptest/namingjavaparser/models/BinaryData.java","src/main/java/tsptest/namingjavaparser/models/BytesData.java","src/main/java/tsptest/namingjavaparser/models/Data.java","src/main/java/tsptest/namingjavaparser/models/DataRequest.java","src/main/java/tsptest/namingjavaparser/models/DataResponse.java","src/main/java/tsptest/namingjavaparser/models/DataStatus.java","src/main/java/tsptest/namingjavaparser/models/GetAnonymousResponse.java","src/main/java/tsptest/namingjavaparser/models/RequestParameters.java","src/main/java/tsptest/namingjavaparser/models/RequestParametersType.java","src/main/java/tsptest/namingjavaparser/models/RunObject.java","src/main/java/tsptest/namingjavaparser/models/RunObjectLastError1.java","src/main/java/tsptest/namingjavaparser/models/RunObjectLastErrorCode.java","src/main/java/tsptest/namingjavaparser/models/TypesModel.java","src/main/java/tsptest/namingjavaparser/models/package-info.java","src/main/java/tsptest/namingjavaparser/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_apiview_properties.json deleted file mode 100644 index 41b50abc027..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_apiview_properties.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.optional.OptionalAsyncClient": "TspTest.Optional.OptionalOp", - "tsptest.optional.OptionalAsyncClient.put": "TspTest.Optional.OptionalOp.put", - "tsptest.optional.OptionalAsyncClient.putWithResponse": "TspTest.Optional.OptionalOp.put", - "tsptest.optional.OptionalClient": "TspTest.Optional.OptionalOp", - "tsptest.optional.OptionalClient.put": "TspTest.Optional.OptionalOp.put", - "tsptest.optional.OptionalClient.putWithResponse": "TspTest.Optional.OptionalOp.put", - "tsptest.optional.OptionalClientBuilder": "TspTest.Optional", - "tsptest.optional.models.AllPropertiesOptional": "TspTest.Optional.AllPropertiesOptional", - "tsptest.optional.models.ImmutableModel": "TspTest.Optional.Immutable", - "tsptest.optional.models.Optional": "TspTest.Optional.Optional" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_metadata.json deleted file mode 100644 index dae73d46a49..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.optional.OptionalAsyncClient":"TspTest.Optional.OptionalOp","tsptest.optional.OptionalAsyncClient.put":"TspTest.Optional.OptionalOp.put","tsptest.optional.OptionalAsyncClient.putWithResponse":"TspTest.Optional.OptionalOp.put","tsptest.optional.OptionalClient":"TspTest.Optional.OptionalOp","tsptest.optional.OptionalClient.put":"TspTest.Optional.OptionalOp.put","tsptest.optional.OptionalClient.putWithResponse":"TspTest.Optional.OptionalOp.put","tsptest.optional.OptionalClientBuilder":"TspTest.Optional","tsptest.optional.models.AllPropertiesOptional":"TspTest.Optional.AllPropertiesOptional","tsptest.optional.models.ImmutableModel":"TspTest.Optional.Immutable","tsptest.optional.models.Optional":"TspTest.Optional.Optional"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/optional/OptionalAsyncClient.java","src/main/java/tsptest/optional/OptionalClient.java","src/main/java/tsptest/optional/OptionalClientBuilder.java","src/main/java/tsptest/optional/implementation/OptionalClientImpl.java","src/main/java/tsptest/optional/implementation/OptionalOpsImpl.java","src/main/java/tsptest/optional/implementation/package-info.java","src/main/java/tsptest/optional/models/AllPropertiesOptional.java","src/main/java/tsptest/optional/models/ImmutableModel.java","src/main/java/tsptest/optional/models/Optional.java","src/main/java/tsptest/optional/models/package-info.java","src/main/java/tsptest/optional/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_apiview_properties.json deleted file mode 100644 index 6fa1ea824c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_apiview_properties.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.patch.PatchAsyncClient": "TspTest.Patch.Patch", - "tsptest.patch.PatchAsyncClient.createOrUpdateFish": "TspTest.Patch.Patch.createOrUpdateFish", - "tsptest.patch.PatchAsyncClient.createOrUpdateFishWithResponse": "TspTest.Patch.Patch.createOrUpdateFish", - "tsptest.patch.PatchAsyncClient.createOrUpdateOptionalResource": "TspTest.Patch.Patch.createOrUpdateOptionalResource", - "tsptest.patch.PatchAsyncClient.createOrUpdateOptionalResourceWithResponse": "TspTest.Patch.Patch.createOrUpdateOptionalResource", - "tsptest.patch.PatchAsyncClient.createOrUpdateResource": "TspTest.Patch.Patch.createOrUpdateResource", - "tsptest.patch.PatchAsyncClient.createOrUpdateResourceWithResponse": "TspTest.Patch.Patch.createOrUpdateResource", - "tsptest.patch.PatchAsyncClient.createOrUpdateSalmon": "TspTest.Patch.Patch.createOrUpdateSalmon", - "tsptest.patch.PatchAsyncClient.createOrUpdateSalmonWithResponse": "TspTest.Patch.Patch.createOrUpdateSalmon", - "tsptest.patch.PatchClient": "TspTest.Patch.Patch", - "tsptest.patch.PatchClient.createOrUpdateFish": "TspTest.Patch.Patch.createOrUpdateFish", - "tsptest.patch.PatchClient.createOrUpdateFishWithResponse": "TspTest.Patch.Patch.createOrUpdateFish", - "tsptest.patch.PatchClient.createOrUpdateOptionalResource": "TspTest.Patch.Patch.createOrUpdateOptionalResource", - "tsptest.patch.PatchClient.createOrUpdateOptionalResourceWithResponse": "TspTest.Patch.Patch.createOrUpdateOptionalResource", - "tsptest.patch.PatchClient.createOrUpdateResource": "TspTest.Patch.Patch.createOrUpdateResource", - "tsptest.patch.PatchClient.createOrUpdateResourceWithResponse": "TspTest.Patch.Patch.createOrUpdateResource", - "tsptest.patch.PatchClient.createOrUpdateSalmon": "TspTest.Patch.Patch.createOrUpdateSalmon", - "tsptest.patch.PatchClient.createOrUpdateSalmonWithResponse": "TspTest.Patch.Patch.createOrUpdateSalmon", - "tsptest.patch.PatchClientBuilder": "TspTest.Patch", - "tsptest.patch.models.Fish": "TspTest.Patch.Fish", - "tsptest.patch.models.InnerModel": "TspTest.Patch.InnerModel", - "tsptest.patch.models.Resource": "TspTest.Patch.Resource", - "tsptest.patch.models.ResourceEnumValue": "TspTest.Patch.Resource.enumValue.anonymous", - "tsptest.patch.models.Salmon": "TspTest.Patch.Salmon", - "tsptest.patch.models.SawShark": "TspTest.Patch.SawShark", - "tsptest.patch.models.Shark": "TspTest.Patch.Shark" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_metadata.json deleted file mode 100644 index 6bb6967928e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.patch.PatchAsyncClient":"TspTest.Patch.Patch","tsptest.patch.PatchAsyncClient.createOrUpdateFish":"TspTest.Patch.Patch.createOrUpdateFish","tsptest.patch.PatchAsyncClient.createOrUpdateFishWithResponse":"TspTest.Patch.Patch.createOrUpdateFish","tsptest.patch.PatchAsyncClient.createOrUpdateOptionalResource":"TspTest.Patch.Patch.createOrUpdateOptionalResource","tsptest.patch.PatchAsyncClient.createOrUpdateOptionalResourceWithResponse":"TspTest.Patch.Patch.createOrUpdateOptionalResource","tsptest.patch.PatchAsyncClient.createOrUpdateResource":"TspTest.Patch.Patch.createOrUpdateResource","tsptest.patch.PatchAsyncClient.createOrUpdateResourceWithResponse":"TspTest.Patch.Patch.createOrUpdateResource","tsptest.patch.PatchAsyncClient.createOrUpdateSalmon":"TspTest.Patch.Patch.createOrUpdateSalmon","tsptest.patch.PatchAsyncClient.createOrUpdateSalmonWithResponse":"TspTest.Patch.Patch.createOrUpdateSalmon","tsptest.patch.PatchClient":"TspTest.Patch.Patch","tsptest.patch.PatchClient.createOrUpdateFish":"TspTest.Patch.Patch.createOrUpdateFish","tsptest.patch.PatchClient.createOrUpdateFishWithResponse":"TspTest.Patch.Patch.createOrUpdateFish","tsptest.patch.PatchClient.createOrUpdateOptionalResource":"TspTest.Patch.Patch.createOrUpdateOptionalResource","tsptest.patch.PatchClient.createOrUpdateOptionalResourceWithResponse":"TspTest.Patch.Patch.createOrUpdateOptionalResource","tsptest.patch.PatchClient.createOrUpdateResource":"TspTest.Patch.Patch.createOrUpdateResource","tsptest.patch.PatchClient.createOrUpdateResourceWithResponse":"TspTest.Patch.Patch.createOrUpdateResource","tsptest.patch.PatchClient.createOrUpdateSalmon":"TspTest.Patch.Patch.createOrUpdateSalmon","tsptest.patch.PatchClient.createOrUpdateSalmonWithResponse":"TspTest.Patch.Patch.createOrUpdateSalmon","tsptest.patch.PatchClientBuilder":"TspTest.Patch","tsptest.patch.models.Fish":"TspTest.Patch.Fish","tsptest.patch.models.InnerModel":"TspTest.Patch.InnerModel","tsptest.patch.models.Resource":"TspTest.Patch.Resource","tsptest.patch.models.ResourceEnumValue":"TspTest.Patch.Resource.enumValue.anonymous","tsptest.patch.models.Salmon":"TspTest.Patch.Salmon","tsptest.patch.models.SawShark":"TspTest.Patch.SawShark","tsptest.patch.models.Shark":"TspTest.Patch.Shark"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/patch/PatchAsyncClient.java","src/main/java/tsptest/patch/PatchClient.java","src/main/java/tsptest/patch/PatchClientBuilder.java","src/main/java/tsptest/patch/implementation/JsonMergePatchHelper.java","src/main/java/tsptest/patch/implementation/PatchClientImpl.java","src/main/java/tsptest/patch/implementation/PatchesImpl.java","src/main/java/tsptest/patch/implementation/package-info.java","src/main/java/tsptest/patch/models/Fish.java","src/main/java/tsptest/patch/models/InnerModel.java","src/main/java/tsptest/patch/models/Resource.java","src/main/java/tsptest/patch/models/ResourceEnumValue.java","src/main/java/tsptest/patch/models/Salmon.java","src/main/java/tsptest/patch/models/SawShark.java","src/main/java/tsptest/patch/models/Shark.java","src/main/java/tsptest/patch/models/package-info.java","src/main/java/tsptest/patch/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_apiview_properties.json deleted file mode 100644 index 27d8b6340dc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_apiview_properties.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp", - "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.beginCreateOrReplace": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace", - "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.beginCreateOrReplaceWithModel": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace", - "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.bothConvenientAndProtocol": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol", - "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.bothConvenientAndProtocolWithResponse": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol", - "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.list": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.list", - "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.onlyConvenient": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient", - "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.onlyConvenientWithResponse": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient", - "tsptest.protocolandconvenient.ProtocolAndConvenientClient": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp", - "tsptest.protocolandconvenient.ProtocolAndConvenientClient.beginCreateOrReplace": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace", - "tsptest.protocolandconvenient.ProtocolAndConvenientClient.beginCreateOrReplaceWithModel": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace", - "tsptest.protocolandconvenient.ProtocolAndConvenientClient.bothConvenientAndProtocol": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol", - "tsptest.protocolandconvenient.ProtocolAndConvenientClient.bothConvenientAndProtocolWithResponse": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol", - "tsptest.protocolandconvenient.ProtocolAndConvenientClient.list": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.list", - "tsptest.protocolandconvenient.ProtocolAndConvenientClient.onlyConvenient": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient", - "tsptest.protocolandconvenient.ProtocolAndConvenientClient.onlyConvenientWithResponse": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient", - "tsptest.protocolandconvenient.ProtocolAndConvenientClientBuilder": "TspTest.ProtocolAndConvenient", - "tsptest.protocolandconvenient.models.ResourceA": "TspTest.ProtocolAndConvenient.ResourceA", - "tsptest.protocolandconvenient.models.ResourceB": "TspTest.ProtocolAndConvenient.ResourceB", - "tsptest.protocolandconvenient.models.ResourceE": "TspTest.ProtocolAndConvenient.ResourceE", - "tsptest.protocolandconvenient.models.ResourceF": "TspTest.ProtocolAndConvenient.ResourceF", - "tsptest.protocolandconvenient.models.ResourceI": "TspTest.ProtocolAndConvenient.ResourceI", - "tsptest.protocolandconvenient.models.ResourceJ": "TspTest.ProtocolAndConvenient.ResourceJ" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_metadata.json deleted file mode 100644 index f51cf29b1e9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-06-01-preview","crossLanguageDefinitions":{"tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.beginCreateOrReplace":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.beginCreateOrReplaceWithModel":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.bothConvenientAndProtocol":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.bothConvenientAndProtocolWithResponse":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.list":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.list","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.onlyConvenient":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.onlyConvenientWithResponse":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient","tsptest.protocolandconvenient.ProtocolAndConvenientClient":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp","tsptest.protocolandconvenient.ProtocolAndConvenientClient.beginCreateOrReplace":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace","tsptest.protocolandconvenient.ProtocolAndConvenientClient.beginCreateOrReplaceWithModel":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace","tsptest.protocolandconvenient.ProtocolAndConvenientClient.bothConvenientAndProtocol":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol","tsptest.protocolandconvenient.ProtocolAndConvenientClient.bothConvenientAndProtocolWithResponse":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol","tsptest.protocolandconvenient.ProtocolAndConvenientClient.list":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.list","tsptest.protocolandconvenient.ProtocolAndConvenientClient.onlyConvenient":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient","tsptest.protocolandconvenient.ProtocolAndConvenientClient.onlyConvenientWithResponse":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient","tsptest.protocolandconvenient.ProtocolAndConvenientClientBuilder":"TspTest.ProtocolAndConvenient","tsptest.protocolandconvenient.models.ResourceA":"TspTest.ProtocolAndConvenient.ResourceA","tsptest.protocolandconvenient.models.ResourceB":"TspTest.ProtocolAndConvenient.ResourceB","tsptest.protocolandconvenient.models.ResourceE":"TspTest.ProtocolAndConvenient.ResourceE","tsptest.protocolandconvenient.models.ResourceF":"TspTest.ProtocolAndConvenient.ResourceF","tsptest.protocolandconvenient.models.ResourceI":"TspTest.ProtocolAndConvenient.ResourceI","tsptest.protocolandconvenient.models.ResourceJ":"TspTest.ProtocolAndConvenient.ResourceJ"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientAsyncClient.java","src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClient.java","src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClientBuilder.java","src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientServiceVersion.java","src/main/java/tsptest/protocolandconvenient/implementation/OperationLocationPollingStrategy.java","src/main/java/tsptest/protocolandconvenient/implementation/PollingUtils.java","src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java","src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenientClientImpl.java","src/main/java/tsptest/protocolandconvenient/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/tsptest/protocolandconvenient/implementation/package-info.java","src/main/java/tsptest/protocolandconvenient/models/ResourceA.java","src/main/java/tsptest/protocolandconvenient/models/ResourceB.java","src/main/java/tsptest/protocolandconvenient/models/ResourceE.java","src/main/java/tsptest/protocolandconvenient/models/ResourceF.java","src/main/java/tsptest/protocolandconvenient/models/ResourceI.java","src/main/java/tsptest/protocolandconvenient/models/ResourceJ.java","src/main/java/tsptest/protocolandconvenient/models/package-info.java","src/main/java/tsptest/protocolandconvenient/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_apiview_properties.json deleted file mode 100644 index 90a2ed4ab6c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_apiview_properties.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.response.ResponseAsyncClient": "TspTest.Response.ResponseOp", - "tsptest.response.ResponseAsyncClient.beginLroInvalidPollResponse": "TspTest.Response.ResponseOp.lroInvalidPollResponse", - "tsptest.response.ResponseAsyncClient.beginLroInvalidPollResponseWithModel": "TspTest.Response.ResponseOp.lroInvalidPollResponse", - "tsptest.response.ResponseAsyncClient.beginLroInvalidResult": "TspTest.Response.ResponseOp.lroInvalidResult", - "tsptest.response.ResponseAsyncClient.beginLroInvalidResultWithModel": "TspTest.Response.ResponseOp.lroInvalidResult", - "tsptest.response.ResponseAsyncClient.createWithHeaders": "TspTest.Response.ResponseOp.createWithHeaders", - "tsptest.response.ResponseAsyncClient.createWithHeadersWithResponse": "TspTest.Response.ResponseOp.createWithHeaders", - "tsptest.response.ResponseAsyncClient.deleteWithHeaders": "TspTest.Response.ResponseOp.deleteWithHeaders", - "tsptest.response.ResponseAsyncClient.deleteWithHeadersWithResponse": "TspTest.Response.ResponseOp.deleteWithHeaders", - "tsptest.response.ResponseAsyncClient.exists": "TspTest.Response.ResponseOp.exists", - "tsptest.response.ResponseAsyncClient.existsWithResponse": "TspTest.Response.ResponseOp.exists", - "tsptest.response.ResponseAsyncClient.getAnotherArray": "TspTest.Response.ResponseOp.getAnotherArray", - "tsptest.response.ResponseAsyncClient.getAnotherArrayWithResponse": "TspTest.Response.ResponseOp.getAnotherArray", - "tsptest.response.ResponseAsyncClient.getArray": "TspTest.Response.ResponseOp.getArray", - "tsptest.response.ResponseAsyncClient.getArrayWithResponse": "TspTest.Response.ResponseOp.getArray", - "tsptest.response.ResponseAsyncClient.getBinary": "TspTest.Response.ResponseOp.getBinary", - "tsptest.response.ResponseAsyncClient.getBinaryWithResponse": "TspTest.Response.ResponseOp.getBinary", - "tsptest.response.ResponseAsyncClient.getJsonUtf8Response": "TspTest.Response.ResponseOp.getJsonUtf8Response", - "tsptest.response.ResponseAsyncClient.getJsonUtf8ResponseWithResponse": "TspTest.Response.ResponseOp.getJsonUtf8Response", - "tsptest.response.ResponseAsyncClient.getPlusJsonResponse": "TspTest.Response.ResponseOp.getPlusJsonResponse", - "tsptest.response.ResponseAsyncClient.getPlusJsonResponseWithResponse": "TspTest.Response.ResponseOp.getPlusJsonResponse", - "tsptest.response.ResponseAsyncClient.getTextBoolean": "TspTest.Response.ResponseOp.getTextBoolean", - "tsptest.response.ResponseAsyncClient.getTextBooleanWithResponse": "TspTest.Response.ResponseOp.getTextBoolean", - "tsptest.response.ResponseAsyncClient.getTextByte": "TspTest.Response.ResponseOp.getTextByte", - "tsptest.response.ResponseAsyncClient.getTextByteWithResponse": "TspTest.Response.ResponseOp.getTextByte", - "tsptest.response.ResponseAsyncClient.getTextChar": "TspTest.Response.ResponseOp.getTextChar", - "tsptest.response.ResponseAsyncClient.getTextCharWithResponse": "TspTest.Response.ResponseOp.getTextChar", - "tsptest.response.ResponseAsyncClient.getTextFloat32": "TspTest.Response.ResponseOp.getTextFloat32", - "tsptest.response.ResponseAsyncClient.getTextFloat32WithResponse": "TspTest.Response.ResponseOp.getTextFloat32", - "tsptest.response.ResponseAsyncClient.getTextFloat64": "TspTest.Response.ResponseOp.getTextFloat64", - "tsptest.response.ResponseAsyncClient.getTextFloat64WithResponse": "TspTest.Response.ResponseOp.getTextFloat64", - "tsptest.response.ResponseAsyncClient.getTextInt32": "TspTest.Response.ResponseOp.getTextInt32", - "tsptest.response.ResponseAsyncClient.getTextInt32WithResponse": "TspTest.Response.ResponseOp.getTextInt32", - "tsptest.response.ResponseAsyncClient.getTextInt64": "TspTest.Response.ResponseOp.getTextInt64", - "tsptest.response.ResponseAsyncClient.getTextInt64WithResponse": "TspTest.Response.ResponseOp.getTextInt64", - "tsptest.response.ResponseAsyncClient.getUnionResponse": "TspTest.Response.ResponseOp.getUnionResponse", - "tsptest.response.ResponseAsyncClient.getUnionResponseWithResponse": "TspTest.Response.ResponseOp.getUnionResponse", - "tsptest.response.ResponseAsyncClient.listIntegers": "TspTest.Response.ResponseOp.listIntegers", - "tsptest.response.ResponseAsyncClient.listStrings": "TspTest.Response.ResponseOp.listStrings", - "tsptest.response.ResponseClient": "TspTest.Response.ResponseOp", - "tsptest.response.ResponseClient.beginLroInvalidPollResponse": "TspTest.Response.ResponseOp.lroInvalidPollResponse", - "tsptest.response.ResponseClient.beginLroInvalidPollResponseWithModel": "TspTest.Response.ResponseOp.lroInvalidPollResponse", - "tsptest.response.ResponseClient.beginLroInvalidResult": "TspTest.Response.ResponseOp.lroInvalidResult", - "tsptest.response.ResponseClient.beginLroInvalidResultWithModel": "TspTest.Response.ResponseOp.lroInvalidResult", - "tsptest.response.ResponseClient.createWithHeaders": "TspTest.Response.ResponseOp.createWithHeaders", - "tsptest.response.ResponseClient.createWithHeadersWithResponse": "TspTest.Response.ResponseOp.createWithHeaders", - "tsptest.response.ResponseClient.deleteWithHeaders": "TspTest.Response.ResponseOp.deleteWithHeaders", - "tsptest.response.ResponseClient.deleteWithHeadersWithResponse": "TspTest.Response.ResponseOp.deleteWithHeaders", - "tsptest.response.ResponseClient.exists": "TspTest.Response.ResponseOp.exists", - "tsptest.response.ResponseClient.existsWithResponse": "TspTest.Response.ResponseOp.exists", - "tsptest.response.ResponseClient.getAnotherArray": "TspTest.Response.ResponseOp.getAnotherArray", - "tsptest.response.ResponseClient.getAnotherArrayWithResponse": "TspTest.Response.ResponseOp.getAnotherArray", - "tsptest.response.ResponseClient.getArray": "TspTest.Response.ResponseOp.getArray", - "tsptest.response.ResponseClient.getArrayWithResponse": "TspTest.Response.ResponseOp.getArray", - "tsptest.response.ResponseClient.getBinary": "TspTest.Response.ResponseOp.getBinary", - "tsptest.response.ResponseClient.getBinaryWithResponse": "TspTest.Response.ResponseOp.getBinary", - "tsptest.response.ResponseClient.getJsonUtf8Response": "TspTest.Response.ResponseOp.getJsonUtf8Response", - "tsptest.response.ResponseClient.getJsonUtf8ResponseWithResponse": "TspTest.Response.ResponseOp.getJsonUtf8Response", - "tsptest.response.ResponseClient.getPlusJsonResponse": "TspTest.Response.ResponseOp.getPlusJsonResponse", - "tsptest.response.ResponseClient.getPlusJsonResponseWithResponse": "TspTest.Response.ResponseOp.getPlusJsonResponse", - "tsptest.response.ResponseClient.getTextBoolean": "TspTest.Response.ResponseOp.getTextBoolean", - "tsptest.response.ResponseClient.getTextBooleanWithResponse": "TspTest.Response.ResponseOp.getTextBoolean", - "tsptest.response.ResponseClient.getTextByte": "TspTest.Response.ResponseOp.getTextByte", - "tsptest.response.ResponseClient.getTextByteWithResponse": "TspTest.Response.ResponseOp.getTextByte", - "tsptest.response.ResponseClient.getTextChar": "TspTest.Response.ResponseOp.getTextChar", - "tsptest.response.ResponseClient.getTextCharWithResponse": "TspTest.Response.ResponseOp.getTextChar", - "tsptest.response.ResponseClient.getTextFloat32": "TspTest.Response.ResponseOp.getTextFloat32", - "tsptest.response.ResponseClient.getTextFloat32WithResponse": "TspTest.Response.ResponseOp.getTextFloat32", - "tsptest.response.ResponseClient.getTextFloat64": "TspTest.Response.ResponseOp.getTextFloat64", - "tsptest.response.ResponseClient.getTextFloat64WithResponse": "TspTest.Response.ResponseOp.getTextFloat64", - "tsptest.response.ResponseClient.getTextInt32": "TspTest.Response.ResponseOp.getTextInt32", - "tsptest.response.ResponseClient.getTextInt32WithResponse": "TspTest.Response.ResponseOp.getTextInt32", - "tsptest.response.ResponseClient.getTextInt64": "TspTest.Response.ResponseOp.getTextInt64", - "tsptest.response.ResponseClient.getTextInt64WithResponse": "TspTest.Response.ResponseOp.getTextInt64", - "tsptest.response.ResponseClient.getUnionResponse": "TspTest.Response.ResponseOp.getUnionResponse", - "tsptest.response.ResponseClient.getUnionResponseWithResponse": "TspTest.Response.ResponseOp.getUnionResponse", - "tsptest.response.ResponseClient.listIntegers": "TspTest.Response.ResponseOp.listIntegers", - "tsptest.response.ResponseClient.listStrings": "TspTest.Response.ResponseOp.listStrings", - "tsptest.response.ResponseClientBuilder": "TspTest.Response.ResponseOp", - "tsptest.response.models.OperationDetails1": "TspTest.Response.OperationDetails1", - "tsptest.response.models.OperationDetails2": "TspTest.Response.OperationDetails2", - "tsptest.response.models.OperationState": "Azure.Core.Foundations.OperationState", - "tsptest.response.models.Resource": "TspTest.Response.Resource" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_metadata.json deleted file mode 100644 index 0710c8eb04e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-06-01-preview","crossLanguageDefinitions":{"tsptest.response.ResponseAsyncClient":"TspTest.Response.ResponseOp","tsptest.response.ResponseAsyncClient.beginLroInvalidPollResponse":"TspTest.Response.ResponseOp.lroInvalidPollResponse","tsptest.response.ResponseAsyncClient.beginLroInvalidPollResponseWithModel":"TspTest.Response.ResponseOp.lroInvalidPollResponse","tsptest.response.ResponseAsyncClient.beginLroInvalidResult":"TspTest.Response.ResponseOp.lroInvalidResult","tsptest.response.ResponseAsyncClient.beginLroInvalidResultWithModel":"TspTest.Response.ResponseOp.lroInvalidResult","tsptest.response.ResponseAsyncClient.createWithHeaders":"TspTest.Response.ResponseOp.createWithHeaders","tsptest.response.ResponseAsyncClient.createWithHeadersWithResponse":"TspTest.Response.ResponseOp.createWithHeaders","tsptest.response.ResponseAsyncClient.deleteWithHeaders":"TspTest.Response.ResponseOp.deleteWithHeaders","tsptest.response.ResponseAsyncClient.deleteWithHeadersWithResponse":"TspTest.Response.ResponseOp.deleteWithHeaders","tsptest.response.ResponseAsyncClient.exists":"TspTest.Response.ResponseOp.exists","tsptest.response.ResponseAsyncClient.existsWithResponse":"TspTest.Response.ResponseOp.exists","tsptest.response.ResponseAsyncClient.getAnotherArray":"TspTest.Response.ResponseOp.getAnotherArray","tsptest.response.ResponseAsyncClient.getAnotherArrayWithResponse":"TspTest.Response.ResponseOp.getAnotherArray","tsptest.response.ResponseAsyncClient.getArray":"TspTest.Response.ResponseOp.getArray","tsptest.response.ResponseAsyncClient.getArrayWithResponse":"TspTest.Response.ResponseOp.getArray","tsptest.response.ResponseAsyncClient.getBinary":"TspTest.Response.ResponseOp.getBinary","tsptest.response.ResponseAsyncClient.getBinaryWithResponse":"TspTest.Response.ResponseOp.getBinary","tsptest.response.ResponseAsyncClient.getJsonUtf8Response":"TspTest.Response.ResponseOp.getJsonUtf8Response","tsptest.response.ResponseAsyncClient.getJsonUtf8ResponseWithResponse":"TspTest.Response.ResponseOp.getJsonUtf8Response","tsptest.response.ResponseAsyncClient.getPlusJsonResponse":"TspTest.Response.ResponseOp.getPlusJsonResponse","tsptest.response.ResponseAsyncClient.getPlusJsonResponseWithResponse":"TspTest.Response.ResponseOp.getPlusJsonResponse","tsptest.response.ResponseAsyncClient.getTextBoolean":"TspTest.Response.ResponseOp.getTextBoolean","tsptest.response.ResponseAsyncClient.getTextBooleanWithResponse":"TspTest.Response.ResponseOp.getTextBoolean","tsptest.response.ResponseAsyncClient.getTextByte":"TspTest.Response.ResponseOp.getTextByte","tsptest.response.ResponseAsyncClient.getTextByteWithResponse":"TspTest.Response.ResponseOp.getTextByte","tsptest.response.ResponseAsyncClient.getTextChar":"TspTest.Response.ResponseOp.getTextChar","tsptest.response.ResponseAsyncClient.getTextCharWithResponse":"TspTest.Response.ResponseOp.getTextChar","tsptest.response.ResponseAsyncClient.getTextFloat32":"TspTest.Response.ResponseOp.getTextFloat32","tsptest.response.ResponseAsyncClient.getTextFloat32WithResponse":"TspTest.Response.ResponseOp.getTextFloat32","tsptest.response.ResponseAsyncClient.getTextFloat64":"TspTest.Response.ResponseOp.getTextFloat64","tsptest.response.ResponseAsyncClient.getTextFloat64WithResponse":"TspTest.Response.ResponseOp.getTextFloat64","tsptest.response.ResponseAsyncClient.getTextInt32":"TspTest.Response.ResponseOp.getTextInt32","tsptest.response.ResponseAsyncClient.getTextInt32WithResponse":"TspTest.Response.ResponseOp.getTextInt32","tsptest.response.ResponseAsyncClient.getTextInt64":"TspTest.Response.ResponseOp.getTextInt64","tsptest.response.ResponseAsyncClient.getTextInt64WithResponse":"TspTest.Response.ResponseOp.getTextInt64","tsptest.response.ResponseAsyncClient.getUnionResponse":"TspTest.Response.ResponseOp.getUnionResponse","tsptest.response.ResponseAsyncClient.getUnionResponseWithResponse":"TspTest.Response.ResponseOp.getUnionResponse","tsptest.response.ResponseAsyncClient.listIntegers":"TspTest.Response.ResponseOp.listIntegers","tsptest.response.ResponseAsyncClient.listStrings":"TspTest.Response.ResponseOp.listStrings","tsptest.response.ResponseClient":"TspTest.Response.ResponseOp","tsptest.response.ResponseClient.beginLroInvalidPollResponse":"TspTest.Response.ResponseOp.lroInvalidPollResponse","tsptest.response.ResponseClient.beginLroInvalidPollResponseWithModel":"TspTest.Response.ResponseOp.lroInvalidPollResponse","tsptest.response.ResponseClient.beginLroInvalidResult":"TspTest.Response.ResponseOp.lroInvalidResult","tsptest.response.ResponseClient.beginLroInvalidResultWithModel":"TspTest.Response.ResponseOp.lroInvalidResult","tsptest.response.ResponseClient.createWithHeaders":"TspTest.Response.ResponseOp.createWithHeaders","tsptest.response.ResponseClient.createWithHeadersWithResponse":"TspTest.Response.ResponseOp.createWithHeaders","tsptest.response.ResponseClient.deleteWithHeaders":"TspTest.Response.ResponseOp.deleteWithHeaders","tsptest.response.ResponseClient.deleteWithHeadersWithResponse":"TspTest.Response.ResponseOp.deleteWithHeaders","tsptest.response.ResponseClient.exists":"TspTest.Response.ResponseOp.exists","tsptest.response.ResponseClient.existsWithResponse":"TspTest.Response.ResponseOp.exists","tsptest.response.ResponseClient.getAnotherArray":"TspTest.Response.ResponseOp.getAnotherArray","tsptest.response.ResponseClient.getAnotherArrayWithResponse":"TspTest.Response.ResponseOp.getAnotherArray","tsptest.response.ResponseClient.getArray":"TspTest.Response.ResponseOp.getArray","tsptest.response.ResponseClient.getArrayWithResponse":"TspTest.Response.ResponseOp.getArray","tsptest.response.ResponseClient.getBinary":"TspTest.Response.ResponseOp.getBinary","tsptest.response.ResponseClient.getBinaryWithResponse":"TspTest.Response.ResponseOp.getBinary","tsptest.response.ResponseClient.getJsonUtf8Response":"TspTest.Response.ResponseOp.getJsonUtf8Response","tsptest.response.ResponseClient.getJsonUtf8ResponseWithResponse":"TspTest.Response.ResponseOp.getJsonUtf8Response","tsptest.response.ResponseClient.getPlusJsonResponse":"TspTest.Response.ResponseOp.getPlusJsonResponse","tsptest.response.ResponseClient.getPlusJsonResponseWithResponse":"TspTest.Response.ResponseOp.getPlusJsonResponse","tsptest.response.ResponseClient.getTextBoolean":"TspTest.Response.ResponseOp.getTextBoolean","tsptest.response.ResponseClient.getTextBooleanWithResponse":"TspTest.Response.ResponseOp.getTextBoolean","tsptest.response.ResponseClient.getTextByte":"TspTest.Response.ResponseOp.getTextByte","tsptest.response.ResponseClient.getTextByteWithResponse":"TspTest.Response.ResponseOp.getTextByte","tsptest.response.ResponseClient.getTextChar":"TspTest.Response.ResponseOp.getTextChar","tsptest.response.ResponseClient.getTextCharWithResponse":"TspTest.Response.ResponseOp.getTextChar","tsptest.response.ResponseClient.getTextFloat32":"TspTest.Response.ResponseOp.getTextFloat32","tsptest.response.ResponseClient.getTextFloat32WithResponse":"TspTest.Response.ResponseOp.getTextFloat32","tsptest.response.ResponseClient.getTextFloat64":"TspTest.Response.ResponseOp.getTextFloat64","tsptest.response.ResponseClient.getTextFloat64WithResponse":"TspTest.Response.ResponseOp.getTextFloat64","tsptest.response.ResponseClient.getTextInt32":"TspTest.Response.ResponseOp.getTextInt32","tsptest.response.ResponseClient.getTextInt32WithResponse":"TspTest.Response.ResponseOp.getTextInt32","tsptest.response.ResponseClient.getTextInt64":"TspTest.Response.ResponseOp.getTextInt64","tsptest.response.ResponseClient.getTextInt64WithResponse":"TspTest.Response.ResponseOp.getTextInt64","tsptest.response.ResponseClient.getUnionResponse":"TspTest.Response.ResponseOp.getUnionResponse","tsptest.response.ResponseClient.getUnionResponseWithResponse":"TspTest.Response.ResponseOp.getUnionResponse","tsptest.response.ResponseClient.listIntegers":"TspTest.Response.ResponseOp.listIntegers","tsptest.response.ResponseClient.listStrings":"TspTest.Response.ResponseOp.listStrings","tsptest.response.ResponseClientBuilder":"TspTest.Response.ResponseOp","tsptest.response.models.OperationDetails1":"TspTest.Response.OperationDetails1","tsptest.response.models.OperationDetails2":"TspTest.Response.OperationDetails2","tsptest.response.models.OperationState":"Azure.Core.Foundations.OperationState","tsptest.response.models.Resource":"TspTest.Response.Resource"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/response/ResponseAsyncClient.java","src/main/java/tsptest/response/ResponseClient.java","src/main/java/tsptest/response/ResponseClientBuilder.java","src/main/java/tsptest/response/ResponseServiceVersion.java","src/main/java/tsptest/response/implementation/OperationLocationPollingStrategy.java","src/main/java/tsptest/response/implementation/PollingUtils.java","src/main/java/tsptest/response/implementation/ResponseClientImpl.java","src/main/java/tsptest/response/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/tsptest/response/implementation/package-info.java","src/main/java/tsptest/response/models/OperationDetails1.java","src/main/java/tsptest/response/models/OperationDetails2.java","src/main/java/tsptest/response/models/OperationState.java","src/main/java/tsptest/response/models/Resource.java","src/main/java/tsptest/response/models/package-info.java","src/main/java/tsptest/response/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_apiview_properties.json deleted file mode 100644 index 466eacde758..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_apiview_properties.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.specialchars.SpecialCharsAsyncClient": "TspTest.SpecialChars.BuiltinOp", - "tsptest.specialchars.SpecialCharsAsyncClient.read": "TspTest.SpecialChars.BuiltinOp.read", - "tsptest.specialchars.SpecialCharsAsyncClient.readWithResponse": "TspTest.SpecialChars.BuiltinOp.read", - "tsptest.specialchars.SpecialCharsClient": "TspTest.SpecialChars.BuiltinOp", - "tsptest.specialchars.SpecialCharsClient.read": "TspTest.SpecialChars.BuiltinOp.read", - "tsptest.specialchars.SpecialCharsClient.readWithResponse": "TspTest.SpecialChars.BuiltinOp.read", - "tsptest.specialchars.SpecialCharsClientBuilder": "TspTest.SpecialChars", - "tsptest.specialchars.implementation.models.ReadRequest": "TspTest.SpecialChars.read.Request.anonymous", - "tsptest.specialchars.models.Resource": "TspTest.SpecialChars.Resource" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_metadata.json deleted file mode 100644 index 06830ca0c57..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.specialchars.SpecialCharsAsyncClient":"TspTest.SpecialChars.BuiltinOp","tsptest.specialchars.SpecialCharsAsyncClient.read":"TspTest.SpecialChars.BuiltinOp.read","tsptest.specialchars.SpecialCharsAsyncClient.readWithResponse":"TspTest.SpecialChars.BuiltinOp.read","tsptest.specialchars.SpecialCharsClient":"TspTest.SpecialChars.BuiltinOp","tsptest.specialchars.SpecialCharsClient.read":"TspTest.SpecialChars.BuiltinOp.read","tsptest.specialchars.SpecialCharsClient.readWithResponse":"TspTest.SpecialChars.BuiltinOp.read","tsptest.specialchars.SpecialCharsClientBuilder":"TspTest.SpecialChars","tsptest.specialchars.implementation.models.ReadRequest":"TspTest.SpecialChars.read.Request.anonymous","tsptest.specialchars.models.Resource":"TspTest.SpecialChars.Resource"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/specialchars/SpecialCharsAsyncClient.java","src/main/java/tsptest/specialchars/SpecialCharsClient.java","src/main/java/tsptest/specialchars/SpecialCharsClientBuilder.java","src/main/java/tsptest/specialchars/implementation/BuiltinOpsImpl.java","src/main/java/tsptest/specialchars/implementation/SpecialCharsClientImpl.java","src/main/java/tsptest/specialchars/implementation/models/ReadRequest.java","src/main/java/tsptest/specialchars/implementation/models/package-info.java","src/main/java/tsptest/specialchars/implementation/package-info.java","src/main/java/tsptest/specialchars/models/Resource.java","src/main/java/tsptest/specialchars/models/package-info.java","src/main/java/tsptest/specialchars/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_apiview_properties.json deleted file mode 100644 index 7b25f95aa3d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_apiview_properties.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.specialheaders.EtagHeadersAsyncClient": "TspTest.SpecialHeaders.EtagHeaders", - "tsptest.specialheaders.EtagHeadersAsyncClient.listWithEtag": "TspTest.SpecialHeaders.EtagHeaders.listWithEtag", - "tsptest.specialheaders.EtagHeadersAsyncClient.patchWithMatchHeaders": "TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders", - "tsptest.specialheaders.EtagHeadersAsyncClient.patchWithMatchHeadersWithResponse": "TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders", - "tsptest.specialheaders.EtagHeadersAsyncClient.putWithRequestHeaders": "TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders", - "tsptest.specialheaders.EtagHeadersAsyncClient.putWithRequestHeadersWithResponse": "TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders", - "tsptest.specialheaders.EtagHeadersClient": "TspTest.SpecialHeaders.EtagHeaders", - "tsptest.specialheaders.EtagHeadersClient.listWithEtag": "TspTest.SpecialHeaders.EtagHeaders.listWithEtag", - "tsptest.specialheaders.EtagHeadersClient.patchWithMatchHeaders": "TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders", - "tsptest.specialheaders.EtagHeadersClient.patchWithMatchHeadersWithResponse": "TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders", - "tsptest.specialheaders.EtagHeadersClient.putWithRequestHeaders": "TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders", - "tsptest.specialheaders.EtagHeadersClient.putWithRequestHeadersWithResponse": "TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders", - "tsptest.specialheaders.EtagHeadersOptionalBodyAsyncClient": "TspTest.SpecialHeaders.EtagHeadersOptionalBody", - "tsptest.specialheaders.EtagHeadersOptionalBodyAsyncClient.putWithOptionalBody": "TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody", - "tsptest.specialheaders.EtagHeadersOptionalBodyAsyncClient.putWithOptionalBodyWithResponse": "TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody", - "tsptest.specialheaders.EtagHeadersOptionalBodyClient": "TspTest.SpecialHeaders.EtagHeadersOptionalBody", - "tsptest.specialheaders.EtagHeadersOptionalBodyClient.putWithOptionalBody": "TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody", - "tsptest.specialheaders.EtagHeadersOptionalBodyClient.putWithOptionalBodyWithResponse": "TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody", - "tsptest.specialheaders.RepeatabilityHeadersAsyncClient": "TspTest.SpecialHeaders.RepeatabilityHeaders", - "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.beginCreateLro": "TspTest.SpecialHeaders.RepeatabilityHeaders.createLro", - "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.beginCreateLroWithModel": "TspTest.SpecialHeaders.RepeatabilityHeaders.createLro", - "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.get": "TspTest.SpecialHeaders.RepeatabilityHeaders.get", - "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.getWithResponse": "TspTest.SpecialHeaders.RepeatabilityHeaders.get", - "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.post": "TspTest.SpecialHeaders.RepeatabilityHeaders.post", - "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.postWithResponse": "TspTest.SpecialHeaders.RepeatabilityHeaders.post", - "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.put": "TspTest.SpecialHeaders.RepeatabilityHeaders.put", - "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.putWithResponse": "TspTest.SpecialHeaders.RepeatabilityHeaders.put", - "tsptest.specialheaders.RepeatabilityHeadersClient": "TspTest.SpecialHeaders.RepeatabilityHeaders", - "tsptest.specialheaders.RepeatabilityHeadersClient.beginCreateLro": "TspTest.SpecialHeaders.RepeatabilityHeaders.createLro", - "tsptest.specialheaders.RepeatabilityHeadersClient.beginCreateLroWithModel": "TspTest.SpecialHeaders.RepeatabilityHeaders.createLro", - "tsptest.specialheaders.RepeatabilityHeadersClient.get": "TspTest.SpecialHeaders.RepeatabilityHeaders.get", - "tsptest.specialheaders.RepeatabilityHeadersClient.getWithResponse": "TspTest.SpecialHeaders.RepeatabilityHeaders.get", - "tsptest.specialheaders.RepeatabilityHeadersClient.post": "TspTest.SpecialHeaders.RepeatabilityHeaders.post", - "tsptest.specialheaders.RepeatabilityHeadersClient.postWithResponse": "TspTest.SpecialHeaders.RepeatabilityHeaders.post", - "tsptest.specialheaders.RepeatabilityHeadersClient.put": "TspTest.SpecialHeaders.RepeatabilityHeaders.put", - "tsptest.specialheaders.RepeatabilityHeadersClient.putWithResponse": "TspTest.SpecialHeaders.RepeatabilityHeaders.put", - "tsptest.specialheaders.SkipSpecialHeadersAsyncClient": "TspTest.SpecialHeaders.SkipSpecialHeaders", - "tsptest.specialheaders.SkipSpecialHeadersAsyncClient.deleteWithSpecialHeaders": "TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders", - "tsptest.specialheaders.SkipSpecialHeadersAsyncClient.deleteWithSpecialHeadersWithResponse": "TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders", - "tsptest.specialheaders.SkipSpecialHeadersClient": "TspTest.SpecialHeaders.SkipSpecialHeaders", - "tsptest.specialheaders.SkipSpecialHeadersClient.deleteWithSpecialHeaders": "TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders", - "tsptest.specialheaders.SkipSpecialHeadersClient.deleteWithSpecialHeadersWithResponse": "TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders", - "tsptest.specialheaders.SpecialHeadersClientBuilder": "TspTest.SpecialHeaders", - "tsptest.specialheaders.models.Resource": "TspTest.SpecialHeaders.Resource" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_metadata.json deleted file mode 100644 index c9ff49456bb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-06-01-preview","crossLanguageDefinitions":{"tsptest.specialheaders.EtagHeadersAsyncClient":"TspTest.SpecialHeaders.EtagHeaders","tsptest.specialheaders.EtagHeadersAsyncClient.listWithEtag":"TspTest.SpecialHeaders.EtagHeaders.listWithEtag","tsptest.specialheaders.EtagHeadersAsyncClient.patchWithMatchHeaders":"TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders","tsptest.specialheaders.EtagHeadersAsyncClient.patchWithMatchHeadersWithResponse":"TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders","tsptest.specialheaders.EtagHeadersAsyncClient.putWithRequestHeaders":"TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders","tsptest.specialheaders.EtagHeadersAsyncClient.putWithRequestHeadersWithResponse":"TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders","tsptest.specialheaders.EtagHeadersClient":"TspTest.SpecialHeaders.EtagHeaders","tsptest.specialheaders.EtagHeadersClient.listWithEtag":"TspTest.SpecialHeaders.EtagHeaders.listWithEtag","tsptest.specialheaders.EtagHeadersClient.patchWithMatchHeaders":"TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders","tsptest.specialheaders.EtagHeadersClient.patchWithMatchHeadersWithResponse":"TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders","tsptest.specialheaders.EtagHeadersClient.putWithRequestHeaders":"TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders","tsptest.specialheaders.EtagHeadersClient.putWithRequestHeadersWithResponse":"TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders","tsptest.specialheaders.EtagHeadersOptionalBodyAsyncClient":"TspTest.SpecialHeaders.EtagHeadersOptionalBody","tsptest.specialheaders.EtagHeadersOptionalBodyAsyncClient.putWithOptionalBody":"TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody","tsptest.specialheaders.EtagHeadersOptionalBodyAsyncClient.putWithOptionalBodyWithResponse":"TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody","tsptest.specialheaders.EtagHeadersOptionalBodyClient":"TspTest.SpecialHeaders.EtagHeadersOptionalBody","tsptest.specialheaders.EtagHeadersOptionalBodyClient.putWithOptionalBody":"TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody","tsptest.specialheaders.EtagHeadersOptionalBodyClient.putWithOptionalBodyWithResponse":"TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody","tsptest.specialheaders.RepeatabilityHeadersAsyncClient":"TspTest.SpecialHeaders.RepeatabilityHeaders","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.beginCreateLro":"TspTest.SpecialHeaders.RepeatabilityHeaders.createLro","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.beginCreateLroWithModel":"TspTest.SpecialHeaders.RepeatabilityHeaders.createLro","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.get":"TspTest.SpecialHeaders.RepeatabilityHeaders.get","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.getWithResponse":"TspTest.SpecialHeaders.RepeatabilityHeaders.get","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.post":"TspTest.SpecialHeaders.RepeatabilityHeaders.post","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.postWithResponse":"TspTest.SpecialHeaders.RepeatabilityHeaders.post","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.put":"TspTest.SpecialHeaders.RepeatabilityHeaders.put","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.putWithResponse":"TspTest.SpecialHeaders.RepeatabilityHeaders.put","tsptest.specialheaders.RepeatabilityHeadersClient":"TspTest.SpecialHeaders.RepeatabilityHeaders","tsptest.specialheaders.RepeatabilityHeadersClient.beginCreateLro":"TspTest.SpecialHeaders.RepeatabilityHeaders.createLro","tsptest.specialheaders.RepeatabilityHeadersClient.beginCreateLroWithModel":"TspTest.SpecialHeaders.RepeatabilityHeaders.createLro","tsptest.specialheaders.RepeatabilityHeadersClient.get":"TspTest.SpecialHeaders.RepeatabilityHeaders.get","tsptest.specialheaders.RepeatabilityHeadersClient.getWithResponse":"TspTest.SpecialHeaders.RepeatabilityHeaders.get","tsptest.specialheaders.RepeatabilityHeadersClient.post":"TspTest.SpecialHeaders.RepeatabilityHeaders.post","tsptest.specialheaders.RepeatabilityHeadersClient.postWithResponse":"TspTest.SpecialHeaders.RepeatabilityHeaders.post","tsptest.specialheaders.RepeatabilityHeadersClient.put":"TspTest.SpecialHeaders.RepeatabilityHeaders.put","tsptest.specialheaders.RepeatabilityHeadersClient.putWithResponse":"TspTest.SpecialHeaders.RepeatabilityHeaders.put","tsptest.specialheaders.SkipSpecialHeadersAsyncClient":"TspTest.SpecialHeaders.SkipSpecialHeaders","tsptest.specialheaders.SkipSpecialHeadersAsyncClient.deleteWithSpecialHeaders":"TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders","tsptest.specialheaders.SkipSpecialHeadersAsyncClient.deleteWithSpecialHeadersWithResponse":"TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders","tsptest.specialheaders.SkipSpecialHeadersClient":"TspTest.SpecialHeaders.SkipSpecialHeaders","tsptest.specialheaders.SkipSpecialHeadersClient.deleteWithSpecialHeaders":"TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders","tsptest.specialheaders.SkipSpecialHeadersClient.deleteWithSpecialHeadersWithResponse":"TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders","tsptest.specialheaders.SpecialHeadersClientBuilder":"TspTest.SpecialHeaders","tsptest.specialheaders.models.Resource":"TspTest.SpecialHeaders.Resource"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java","src/main/java/tsptest/specialheaders/EtagHeadersClient.java","src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java","src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java","src/main/java/tsptest/specialheaders/RepeatabilityHeadersAsyncClient.java","src/main/java/tsptest/specialheaders/RepeatabilityHeadersClient.java","src/main/java/tsptest/specialheaders/SkipSpecialHeadersAsyncClient.java","src/main/java/tsptest/specialheaders/SkipSpecialHeadersClient.java","src/main/java/tsptest/specialheaders/SpecialHeadersClientBuilder.java","src/main/java/tsptest/specialheaders/SpecialHeadersServiceVersion.java","src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java","src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java","src/main/java/tsptest/specialheaders/implementation/JsonMergePatchHelper.java","src/main/java/tsptest/specialheaders/implementation/OperationLocationPollingStrategy.java","src/main/java/tsptest/specialheaders/implementation/PollingUtils.java","src/main/java/tsptest/specialheaders/implementation/RepeatabilityHeadersImpl.java","src/main/java/tsptest/specialheaders/implementation/SkipSpecialHeadersImpl.java","src/main/java/tsptest/specialheaders/implementation/SpecialHeadersClientImpl.java","src/main/java/tsptest/specialheaders/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/tsptest/specialheaders/implementation/package-info.java","src/main/java/tsptest/specialheaders/models/Resource.java","src/main/java/tsptest/specialheaders/models/package-info.java","src/main/java/tsptest/specialheaders/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_apiview_properties.json deleted file mode 100644 index e4eb8cba216..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_apiview_properties.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.subclass.SubclassAsyncClient": "TspTest.Subclass.Subclass", - "tsptest.subclass.SubclassAsyncClient.propertyInSubclass": "TspTest.Subclass.Subclass.propertyInSubclass", - "tsptest.subclass.SubclassAsyncClient.propertyInSubclassWithResponse": "TspTest.Subclass.Subclass.propertyInSubclass", - "tsptest.subclass.SubclassClient": "TspTest.Subclass.Subclass", - "tsptest.subclass.SubclassClient.propertyInSubclass": "TspTest.Subclass.Subclass.propertyInSubclass", - "tsptest.subclass.SubclassClient.propertyInSubclassWithResponse": "TspTest.Subclass.Subclass.propertyInSubclass", - "tsptest.subclass.SubclassClientBuilder": "TspTest.Subclass", - "tsptest.subclass.models.Body": "TspTest.Subclass.Body", - "tsptest.subclass.models.DuplicateRequiredProperty": "TspTest.Subclass.DuplicateRequiredProperty", - "tsptest.subclass.models.DuplicateRequiredPropertyParent": "TspTest.Subclass.DuplicateRequiredPropertyParent", - "tsptest.subclass.models.PropertyChangedToConstant": "TspTest.Subclass.PropertyChangedToConstant", - "tsptest.subclass.models.PropertyChangedToConstantParent": "TspTest.Subclass.PropertyChangedToConstantParent", - "tsptest.subclass.models.PropertyChangedToRequired": "TspTest.Subclass.PropertyChangedToRequired", - "tsptest.subclass.models.PropertyChangedToRequiredParent": "TspTest.Subclass.PropertyChangedToRequiredParent" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_metadata.json deleted file mode 100644 index 2ad8bd225c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.subclass.SubclassAsyncClient":"TspTest.Subclass.Subclass","tsptest.subclass.SubclassAsyncClient.propertyInSubclass":"TspTest.Subclass.Subclass.propertyInSubclass","tsptest.subclass.SubclassAsyncClient.propertyInSubclassWithResponse":"TspTest.Subclass.Subclass.propertyInSubclass","tsptest.subclass.SubclassClient":"TspTest.Subclass.Subclass","tsptest.subclass.SubclassClient.propertyInSubclass":"TspTest.Subclass.Subclass.propertyInSubclass","tsptest.subclass.SubclassClient.propertyInSubclassWithResponse":"TspTest.Subclass.Subclass.propertyInSubclass","tsptest.subclass.SubclassClientBuilder":"TspTest.Subclass","tsptest.subclass.models.Body":"TspTest.Subclass.Body","tsptest.subclass.models.DuplicateRequiredProperty":"TspTest.Subclass.DuplicateRequiredProperty","tsptest.subclass.models.DuplicateRequiredPropertyParent":"TspTest.Subclass.DuplicateRequiredPropertyParent","tsptest.subclass.models.PropertyChangedToConstant":"TspTest.Subclass.PropertyChangedToConstant","tsptest.subclass.models.PropertyChangedToConstantParent":"TspTest.Subclass.PropertyChangedToConstantParent","tsptest.subclass.models.PropertyChangedToRequired":"TspTest.Subclass.PropertyChangedToRequired","tsptest.subclass.models.PropertyChangedToRequiredParent":"TspTest.Subclass.PropertyChangedToRequiredParent"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/subclass/SubclassAsyncClient.java","src/main/java/tsptest/subclass/SubclassClient.java","src/main/java/tsptest/subclass/SubclassClientBuilder.java","src/main/java/tsptest/subclass/implementation/SubclassClientImpl.java","src/main/java/tsptest/subclass/implementation/SubclassImpl.java","src/main/java/tsptest/subclass/implementation/package-info.java","src/main/java/tsptest/subclass/models/Body.java","src/main/java/tsptest/subclass/models/DuplicateRequiredProperty.java","src/main/java/tsptest/subclass/models/DuplicateRequiredPropertyParent.java","src/main/java/tsptest/subclass/models/PropertyChangedToConstant.java","src/main/java/tsptest/subclass/models/PropertyChangedToConstantParent.java","src/main/java/tsptest/subclass/models/PropertyChangedToRequired.java","src/main/java/tsptest/subclass/models/PropertyChangedToRequiredParent.java","src/main/java/tsptest/subclass/models/package-info.java","src/main/java/tsptest/subclass/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_apiview_properties.json deleted file mode 100644 index 14a7ce16492..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_apiview_properties.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.union.UnionAsyncClient": "TspTest.Union.UnionFlattenOp", - "tsptest.union.UnionAsyncClient.beginGenerate": "TspTest.Union.UnionFlattenOp.generate", - "tsptest.union.UnionAsyncClient.beginGenerateWithModel": "TspTest.Union.UnionFlattenOp.generate", - "tsptest.union.UnionAsyncClient.get": "TspTest.Union.UnionFlattenOp.get", - "tsptest.union.UnionAsyncClient.getWithResponse": "TspTest.Union.UnionFlattenOp.get", - "tsptest.union.UnionAsyncClient.send": "TspTest.Union.UnionFlattenOp.send", - "tsptest.union.UnionAsyncClient.sendLong": "TspTest.Union.UnionFlattenOp.sendLong", - "tsptest.union.UnionAsyncClient.sendLongWithResponse": "TspTest.Union.UnionFlattenOp.sendLong", - "tsptest.union.UnionAsyncClient.sendWithResponse": "TspTest.Union.UnionFlattenOp.send", - "tsptest.union.UnionClient": "TspTest.Union.UnionFlattenOp", - "tsptest.union.UnionClient.beginGenerate": "TspTest.Union.UnionFlattenOp.generate", - "tsptest.union.UnionClient.beginGenerateWithModel": "TspTest.Union.UnionFlattenOp.generate", - "tsptest.union.UnionClient.get": "TspTest.Union.UnionFlattenOp.get", - "tsptest.union.UnionClient.getWithResponse": "TspTest.Union.UnionFlattenOp.get", - "tsptest.union.UnionClient.send": "TspTest.Union.UnionFlattenOp.send", - "tsptest.union.UnionClient.sendLong": "TspTest.Union.UnionFlattenOp.sendLong", - "tsptest.union.UnionClient.sendLongWithResponse": "TspTest.Union.UnionFlattenOp.sendLong", - "tsptest.union.UnionClient.sendWithResponse": "TspTest.Union.UnionFlattenOp.send", - "tsptest.union.UnionClientBuilder": "TspTest.Union", - "tsptest.union.implementation.models.SendLongRequest": "TspTest.Union.sendLong.Request.anonymous", - "tsptest.union.implementation.models.SendRequest": "TspTest.Union.send.Request.anonymous", - "tsptest.union.implementation.models.SubResult": "TspTest.Union.SubResult", - "tsptest.union.models.ArrayData": "TspTest.Union.ArrayData", - "tsptest.union.models.Result": "TspTest.Union.Result", - "tsptest.union.models.SendLongOptions": null, - "tsptest.union.models.User": "TspTest.Union.User" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_metadata.json deleted file mode 100644 index 7a720173441..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-06-01-preview","crossLanguageDefinitions":{"tsptest.union.UnionAsyncClient":"TspTest.Union.UnionFlattenOp","tsptest.union.UnionAsyncClient.beginGenerate":"TspTest.Union.UnionFlattenOp.generate","tsptest.union.UnionAsyncClient.beginGenerateWithModel":"TspTest.Union.UnionFlattenOp.generate","tsptest.union.UnionAsyncClient.get":"TspTest.Union.UnionFlattenOp.get","tsptest.union.UnionAsyncClient.getWithResponse":"TspTest.Union.UnionFlattenOp.get","tsptest.union.UnionAsyncClient.send":"TspTest.Union.UnionFlattenOp.send","tsptest.union.UnionAsyncClient.sendLong":"TspTest.Union.UnionFlattenOp.sendLong","tsptest.union.UnionAsyncClient.sendLongWithResponse":"TspTest.Union.UnionFlattenOp.sendLong","tsptest.union.UnionAsyncClient.sendWithResponse":"TspTest.Union.UnionFlattenOp.send","tsptest.union.UnionClient":"TspTest.Union.UnionFlattenOp","tsptest.union.UnionClient.beginGenerate":"TspTest.Union.UnionFlattenOp.generate","tsptest.union.UnionClient.beginGenerateWithModel":"TspTest.Union.UnionFlattenOp.generate","tsptest.union.UnionClient.get":"TspTest.Union.UnionFlattenOp.get","tsptest.union.UnionClient.getWithResponse":"TspTest.Union.UnionFlattenOp.get","tsptest.union.UnionClient.send":"TspTest.Union.UnionFlattenOp.send","tsptest.union.UnionClient.sendLong":"TspTest.Union.UnionFlattenOp.sendLong","tsptest.union.UnionClient.sendLongWithResponse":"TspTest.Union.UnionFlattenOp.sendLong","tsptest.union.UnionClient.sendWithResponse":"TspTest.Union.UnionFlattenOp.send","tsptest.union.UnionClientBuilder":"TspTest.Union","tsptest.union.implementation.models.SendLongRequest":"TspTest.Union.sendLong.Request.anonymous","tsptest.union.implementation.models.SendRequest":"TspTest.Union.send.Request.anonymous","tsptest.union.implementation.models.SubResult":"TspTest.Union.SubResult","tsptest.union.models.ArrayData":"TspTest.Union.ArrayData","tsptest.union.models.Result":"TspTest.Union.Result","tsptest.union.models.SendLongOptions":null,"tsptest.union.models.User":"TspTest.Union.User"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/union/UnionAsyncClient.java","src/main/java/tsptest/union/UnionClient.java","src/main/java/tsptest/union/UnionClientBuilder.java","src/main/java/tsptest/union/UnionServiceVersion.java","src/main/java/tsptest/union/implementation/OperationLocationPollingStrategy.java","src/main/java/tsptest/union/implementation/PollingUtils.java","src/main/java/tsptest/union/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/tsptest/union/implementation/UnionClientImpl.java","src/main/java/tsptest/union/implementation/UnionFlattenOpsImpl.java","src/main/java/tsptest/union/implementation/models/SendLongRequest.java","src/main/java/tsptest/union/implementation/models/SendRequest.java","src/main/java/tsptest/union/implementation/models/SubResult.java","src/main/java/tsptest/union/implementation/models/package-info.java","src/main/java/tsptest/union/implementation/package-info.java","src/main/java/tsptest/union/models/ArrayData.java","src/main/java/tsptest/union/models/Result.java","src/main/java/tsptest/union/models/SendLongOptions.java","src/main/java/tsptest/union/models/User.java","src/main/java/tsptest/union/models/package-info.java","src/main/java/tsptest/union/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_apiview_properties.json deleted file mode 100644 index 04355f40b29..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_apiview_properties.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.versioning.VersioningAsyncClient": "TspTest.Versioning.VersioningOp", - "tsptest.versioning.VersioningAsyncClient.beginCreateLongRunning": "TspTest.Versioning.VersioningOp.createLongRunning", - "tsptest.versioning.VersioningAsyncClient.beginCreateLongRunningWithModel": "TspTest.Versioning.VersioningOp.createLongRunning", - "tsptest.versioning.VersioningAsyncClient.beginExport": "TspTest.Versioning.VersioningOp.export", - "tsptest.versioning.VersioningAsyncClient.beginExportWithModel": "TspTest.Versioning.VersioningOp.export", - "tsptest.versioning.VersioningAsyncClient.list": "TspTest.Versioning.VersioningOp.list", - "tsptest.versioning.VersioningClient": "TspTest.Versioning.VersioningOp", - "tsptest.versioning.VersioningClient.beginCreateLongRunning": "TspTest.Versioning.VersioningOp.createLongRunning", - "tsptest.versioning.VersioningClient.beginCreateLongRunningWithModel": "TspTest.Versioning.VersioningOp.createLongRunning", - "tsptest.versioning.VersioningClient.beginExport": "TspTest.Versioning.VersioningOp.export", - "tsptest.versioning.VersioningClient.beginExportWithModel": "TspTest.Versioning.VersioningOp.export", - "tsptest.versioning.VersioningClient.list": "TspTest.Versioning.VersioningOp.list", - "tsptest.versioning.VersioningClientBuilder": "TspTest.Versioning", - "tsptest.versioning.models.ExportedResource": "TspTest.Versioning.ExportedResource", - "tsptest.versioning.models.Resource": "TspTest.Versioning.Resource" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_metadata.json deleted file mode 100644 index 777fb73eb68..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"2022-09-01","crossLanguageDefinitions":{"tsptest.versioning.VersioningAsyncClient":"TspTest.Versioning.VersioningOp","tsptest.versioning.VersioningAsyncClient.beginCreateLongRunning":"TspTest.Versioning.VersioningOp.createLongRunning","tsptest.versioning.VersioningAsyncClient.beginCreateLongRunningWithModel":"TspTest.Versioning.VersioningOp.createLongRunning","tsptest.versioning.VersioningAsyncClient.beginExport":"TspTest.Versioning.VersioningOp.export","tsptest.versioning.VersioningAsyncClient.beginExportWithModel":"TspTest.Versioning.VersioningOp.export","tsptest.versioning.VersioningAsyncClient.list":"TspTest.Versioning.VersioningOp.list","tsptest.versioning.VersioningClient":"TspTest.Versioning.VersioningOp","tsptest.versioning.VersioningClient.beginCreateLongRunning":"TspTest.Versioning.VersioningOp.createLongRunning","tsptest.versioning.VersioningClient.beginCreateLongRunningWithModel":"TspTest.Versioning.VersioningOp.createLongRunning","tsptest.versioning.VersioningClient.beginExport":"TspTest.Versioning.VersioningOp.export","tsptest.versioning.VersioningClient.beginExportWithModel":"TspTest.Versioning.VersioningOp.export","tsptest.versioning.VersioningClient.list":"TspTest.Versioning.VersioningOp.list","tsptest.versioning.VersioningClientBuilder":"TspTest.Versioning","tsptest.versioning.models.ExportedResource":"TspTest.Versioning.ExportedResource","tsptest.versioning.models.Resource":"TspTest.Versioning.Resource"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/versioning/VersioningAsyncClient.java","src/main/java/tsptest/versioning/VersioningClient.java","src/main/java/tsptest/versioning/VersioningClientBuilder.java","src/main/java/tsptest/versioning/VersioningServiceVersion.java","src/main/java/tsptest/versioning/implementation/OperationLocationPollingStrategy.java","src/main/java/tsptest/versioning/implementation/PollingUtils.java","src/main/java/tsptest/versioning/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/tsptest/versioning/implementation/VersioningClientImpl.java","src/main/java/tsptest/versioning/implementation/VersioningOpsImpl.java","src/main/java/tsptest/versioning/implementation/package-info.java","src/main/java/tsptest/versioning/models/ExportedResource.java","src/main/java/tsptest/versioning/models/Resource.java","src/main/java/tsptest/versioning/models/package-info.java","src/main/java/tsptest/versioning/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_apiview_properties.json deleted file mode 100644 index ded2032de86..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_apiview_properties.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.visibility.VisibilityAsyncClient": "TspTest.Visibility", - "tsptest.visibility.VisibilityAsyncClient.create": "TspTest.Visibility.VisibilityOp.create", - "tsptest.visibility.VisibilityAsyncClient.createWithResponse": "TspTest.Visibility.VisibilityOp.create", - "tsptest.visibility.VisibilityAsyncClient.get": "TspTest.Visibility.VisibilityOp.get", - "tsptest.visibility.VisibilityAsyncClient.getWithResponse": "TspTest.Visibility.VisibilityOp.get", - "tsptest.visibility.VisibilityAsyncClient.query": "TspTest.Visibility.VisibilityOp.query", - "tsptest.visibility.VisibilityAsyncClient.queryWithResponse": "TspTest.Visibility.VisibilityOp.query", - "tsptest.visibility.VisibilityAsyncClient.roundtrip": "TspTest.Visibility.VisibilityOp.roundtrip", - "tsptest.visibility.VisibilityAsyncClient.roundtripWithResponse": "TspTest.Visibility.VisibilityOp.roundtrip", - "tsptest.visibility.VisibilityClient": "TspTest.Visibility", - "tsptest.visibility.VisibilityClient.create": "TspTest.Visibility.VisibilityOp.create", - "tsptest.visibility.VisibilityClient.createWithResponse": "TspTest.Visibility.VisibilityOp.create", - "tsptest.visibility.VisibilityClient.get": "TspTest.Visibility.VisibilityOp.get", - "tsptest.visibility.VisibilityClient.getWithResponse": "TspTest.Visibility.VisibilityOp.get", - "tsptest.visibility.VisibilityClient.query": "TspTest.Visibility.VisibilityOp.query", - "tsptest.visibility.VisibilityClient.queryWithResponse": "TspTest.Visibility.VisibilityOp.query", - "tsptest.visibility.VisibilityClient.roundtrip": "TspTest.Visibility.VisibilityOp.roundtrip", - "tsptest.visibility.VisibilityClient.roundtripWithResponse": "TspTest.Visibility.VisibilityOp.roundtrip", - "tsptest.visibility.VisibilityClientBuilder": "TspTest.Visibility", - "tsptest.visibility.VisibilityReadAsyncClient": "TspTest.Visibility.VisibilityRead", - "tsptest.visibility.VisibilityReadAsyncClient.get": "TspTest.Visibility.VisibilityRead.get", - "tsptest.visibility.VisibilityReadAsyncClient.getWithResponse": "TspTest.Visibility.VisibilityRead.get", - "tsptest.visibility.VisibilityReadClient": "TspTest.Visibility.VisibilityRead", - "tsptest.visibility.VisibilityReadClient.get": "TspTest.Visibility.VisibilityRead.get", - "tsptest.visibility.VisibilityReadClient.getWithResponse": "TspTest.Visibility.VisibilityRead.get", - "tsptest.visibility.VisibilityWriteAsyncClient": "TspTest.Visibility.VisibilityWrite", - "tsptest.visibility.VisibilityWriteAsyncClient.create": "TspTest.Visibility.VisibilityWrite.create", - "tsptest.visibility.VisibilityWriteAsyncClient.createWithResponse": "TspTest.Visibility.VisibilityWrite.create", - "tsptest.visibility.VisibilityWriteClient": "TspTest.Visibility.VisibilityWrite", - "tsptest.visibility.VisibilityWriteClient.create": "TspTest.Visibility.VisibilityWrite.create", - "tsptest.visibility.VisibilityWriteClient.createWithResponse": "TspTest.Visibility.VisibilityWrite.create", - "tsptest.visibility.models.Dog": "TspTest.Visibility.Dog", - "tsptest.visibility.models.ReadDog": "TspTest.Visibility.ReadDog", - "tsptest.visibility.models.RoundTripModel": "TspTest.Visibility.RoundTripModel", - "tsptest.visibility.models.WriteDog": "TspTest.Visibility.WriteDog" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_metadata.json deleted file mode 100644 index 8782e235654..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.visibility.VisibilityAsyncClient":"TspTest.Visibility","tsptest.visibility.VisibilityAsyncClient.create":"TspTest.Visibility.VisibilityOp.create","tsptest.visibility.VisibilityAsyncClient.createWithResponse":"TspTest.Visibility.VisibilityOp.create","tsptest.visibility.VisibilityAsyncClient.get":"TspTest.Visibility.VisibilityOp.get","tsptest.visibility.VisibilityAsyncClient.getWithResponse":"TspTest.Visibility.VisibilityOp.get","tsptest.visibility.VisibilityAsyncClient.query":"TspTest.Visibility.VisibilityOp.query","tsptest.visibility.VisibilityAsyncClient.queryWithResponse":"TspTest.Visibility.VisibilityOp.query","tsptest.visibility.VisibilityAsyncClient.roundtrip":"TspTest.Visibility.VisibilityOp.roundtrip","tsptest.visibility.VisibilityAsyncClient.roundtripWithResponse":"TspTest.Visibility.VisibilityOp.roundtrip","tsptest.visibility.VisibilityClient":"TspTest.Visibility","tsptest.visibility.VisibilityClient.create":"TspTest.Visibility.VisibilityOp.create","tsptest.visibility.VisibilityClient.createWithResponse":"TspTest.Visibility.VisibilityOp.create","tsptest.visibility.VisibilityClient.get":"TspTest.Visibility.VisibilityOp.get","tsptest.visibility.VisibilityClient.getWithResponse":"TspTest.Visibility.VisibilityOp.get","tsptest.visibility.VisibilityClient.query":"TspTest.Visibility.VisibilityOp.query","tsptest.visibility.VisibilityClient.queryWithResponse":"TspTest.Visibility.VisibilityOp.query","tsptest.visibility.VisibilityClient.roundtrip":"TspTest.Visibility.VisibilityOp.roundtrip","tsptest.visibility.VisibilityClient.roundtripWithResponse":"TspTest.Visibility.VisibilityOp.roundtrip","tsptest.visibility.VisibilityClientBuilder":"TspTest.Visibility","tsptest.visibility.VisibilityReadAsyncClient":"TspTest.Visibility.VisibilityRead","tsptest.visibility.VisibilityReadAsyncClient.get":"TspTest.Visibility.VisibilityRead.get","tsptest.visibility.VisibilityReadAsyncClient.getWithResponse":"TspTest.Visibility.VisibilityRead.get","tsptest.visibility.VisibilityReadClient":"TspTest.Visibility.VisibilityRead","tsptest.visibility.VisibilityReadClient.get":"TspTest.Visibility.VisibilityRead.get","tsptest.visibility.VisibilityReadClient.getWithResponse":"TspTest.Visibility.VisibilityRead.get","tsptest.visibility.VisibilityWriteAsyncClient":"TspTest.Visibility.VisibilityWrite","tsptest.visibility.VisibilityWriteAsyncClient.create":"TspTest.Visibility.VisibilityWrite.create","tsptest.visibility.VisibilityWriteAsyncClient.createWithResponse":"TspTest.Visibility.VisibilityWrite.create","tsptest.visibility.VisibilityWriteClient":"TspTest.Visibility.VisibilityWrite","tsptest.visibility.VisibilityWriteClient.create":"TspTest.Visibility.VisibilityWrite.create","tsptest.visibility.VisibilityWriteClient.createWithResponse":"TspTest.Visibility.VisibilityWrite.create","tsptest.visibility.models.Dog":"TspTest.Visibility.Dog","tsptest.visibility.models.ReadDog":"TspTest.Visibility.ReadDog","tsptest.visibility.models.RoundTripModel":"TspTest.Visibility.RoundTripModel","tsptest.visibility.models.WriteDog":"TspTest.Visibility.WriteDog"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/visibility/VisibilityAsyncClient.java","src/main/java/tsptest/visibility/VisibilityClient.java","src/main/java/tsptest/visibility/VisibilityClientBuilder.java","src/main/java/tsptest/visibility/VisibilityReadAsyncClient.java","src/main/java/tsptest/visibility/VisibilityReadClient.java","src/main/java/tsptest/visibility/VisibilityWriteAsyncClient.java","src/main/java/tsptest/visibility/VisibilityWriteClient.java","src/main/java/tsptest/visibility/implementation/VisibilityClientImpl.java","src/main/java/tsptest/visibility/implementation/VisibilityReadsImpl.java","src/main/java/tsptest/visibility/implementation/VisibilityWritesImpl.java","src/main/java/tsptest/visibility/implementation/package-info.java","src/main/java/tsptest/visibility/models/Dog.java","src/main/java/tsptest/visibility/models/ReadDog.java","src/main/java/tsptest/visibility/models/RoundTripModel.java","src/main/java/tsptest/visibility/models/WriteDog.java","src/main/java/tsptest/visibility/models/package-info.java","src/main/java/tsptest/visibility/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_apiview_properties.json deleted file mode 100644 index 05715761071..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_apiview_properties.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "tsptest.wiretype.WireTypeAsyncClient": "TspTest.WireType.WireTypeOp", - "tsptest.wiretype.WireTypeAsyncClient.bothClassMismatch": "TspTest.WireType.WireTypeOp.bothClassMismatch", - "tsptest.wiretype.WireTypeAsyncClient.bothClassMismatchWithResponse": "TspTest.WireType.WireTypeOp.bothClassMismatch", - "tsptest.wiretype.WireTypeAsyncClient.subClassMismatch": "TspTest.WireType.WireTypeOp.subClassMismatch", - "tsptest.wiretype.WireTypeAsyncClient.subClassMismatchWithResponse": "TspTest.WireType.WireTypeOp.subClassMismatch", - "tsptest.wiretype.WireTypeAsyncClient.superClassMismatch": "TspTest.WireType.WireTypeOp.superClassMismatch", - "tsptest.wiretype.WireTypeAsyncClient.superClassMismatchWithResponse": "TspTest.WireType.WireTypeOp.superClassMismatch", - "tsptest.wiretype.WireTypeClient": "TspTest.WireType.WireTypeOp", - "tsptest.wiretype.WireTypeClient.bothClassMismatch": "TspTest.WireType.WireTypeOp.bothClassMismatch", - "tsptest.wiretype.WireTypeClient.bothClassMismatchWithResponse": "TspTest.WireType.WireTypeOp.bothClassMismatch", - "tsptest.wiretype.WireTypeClient.subClassMismatch": "TspTest.WireType.WireTypeOp.subClassMismatch", - "tsptest.wiretype.WireTypeClient.subClassMismatchWithResponse": "TspTest.WireType.WireTypeOp.subClassMismatch", - "tsptest.wiretype.WireTypeClient.superClassMismatch": "TspTest.WireType.WireTypeOp.superClassMismatch", - "tsptest.wiretype.WireTypeClient.superClassMismatchWithResponse": "TspTest.WireType.WireTypeOp.superClassMismatch", - "tsptest.wiretype.WireTypeClientBuilder": "TspTest.WireType", - "tsptest.wiretype.models.SubClass": "TspTest.WireType.SubClass", - "tsptest.wiretype.models.SubClassBothMismatch": "TspTest.WireType.SubClassBothMismatch", - "tsptest.wiretype.models.SubClassMismatch": "TspTest.WireType.SubClassMismatch", - "tsptest.wiretype.models.SuperClass": "TspTest.WireType.SuperClass", - "tsptest.wiretype.models.SuperClassMismatch": "TspTest.WireType.SuperClassMismatch" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_metadata.json deleted file mode 100644 index 457ca6191f3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.wiretype.WireTypeAsyncClient":"TspTest.WireType.WireTypeOp","tsptest.wiretype.WireTypeAsyncClient.bothClassMismatch":"TspTest.WireType.WireTypeOp.bothClassMismatch","tsptest.wiretype.WireTypeAsyncClient.bothClassMismatchWithResponse":"TspTest.WireType.WireTypeOp.bothClassMismatch","tsptest.wiretype.WireTypeAsyncClient.subClassMismatch":"TspTest.WireType.WireTypeOp.subClassMismatch","tsptest.wiretype.WireTypeAsyncClient.subClassMismatchWithResponse":"TspTest.WireType.WireTypeOp.subClassMismatch","tsptest.wiretype.WireTypeAsyncClient.superClassMismatch":"TspTest.WireType.WireTypeOp.superClassMismatch","tsptest.wiretype.WireTypeAsyncClient.superClassMismatchWithResponse":"TspTest.WireType.WireTypeOp.superClassMismatch","tsptest.wiretype.WireTypeClient":"TspTest.WireType.WireTypeOp","tsptest.wiretype.WireTypeClient.bothClassMismatch":"TspTest.WireType.WireTypeOp.bothClassMismatch","tsptest.wiretype.WireTypeClient.bothClassMismatchWithResponse":"TspTest.WireType.WireTypeOp.bothClassMismatch","tsptest.wiretype.WireTypeClient.subClassMismatch":"TspTest.WireType.WireTypeOp.subClassMismatch","tsptest.wiretype.WireTypeClient.subClassMismatchWithResponse":"TspTest.WireType.WireTypeOp.subClassMismatch","tsptest.wiretype.WireTypeClient.superClassMismatch":"TspTest.WireType.WireTypeOp.superClassMismatch","tsptest.wiretype.WireTypeClient.superClassMismatchWithResponse":"TspTest.WireType.WireTypeOp.superClassMismatch","tsptest.wiretype.WireTypeClientBuilder":"TspTest.WireType","tsptest.wiretype.models.SubClass":"TspTest.WireType.SubClass","tsptest.wiretype.models.SubClassBothMismatch":"TspTest.WireType.SubClassBothMismatch","tsptest.wiretype.models.SubClassMismatch":"TspTest.WireType.SubClassMismatch","tsptest.wiretype.models.SuperClass":"TspTest.WireType.SuperClass","tsptest.wiretype.models.SuperClassMismatch":"TspTest.WireType.SuperClassMismatch"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/wiretype/WireTypeAsyncClient.java","src/main/java/tsptest/wiretype/WireTypeClient.java","src/main/java/tsptest/wiretype/WireTypeClientBuilder.java","src/main/java/tsptest/wiretype/implementation/WireTypeClientImpl.java","src/main/java/tsptest/wiretype/implementation/WireTypeOpsImpl.java","src/main/java/tsptest/wiretype/implementation/package-info.java","src/main/java/tsptest/wiretype/models/SubClass.java","src/main/java/tsptest/wiretype/models/SubClassBothMismatch.java","src/main/java/tsptest/wiretype/models/SubClassMismatch.java","src/main/java/tsptest/wiretype/models/SuperClass.java","src/main/java/tsptest/wiretype/models/SuperClassMismatch.java","src/main/java/tsptest/wiretype/models/package-info.java","src/main/java/tsptest/wiretype/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_apiview_properties.json deleted file mode 100644 index d93e42231f3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_apiview_properties.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.array.ArrayClientBuilder": "Type.Array", - "type.array.BooleanValueAsyncClient": "Type.Array.BooleanValue", - "type.array.BooleanValueAsyncClient.get": "Type.Array.BooleanValue.get", - "type.array.BooleanValueAsyncClient.getWithResponse": "Type.Array.BooleanValue.get", - "type.array.BooleanValueAsyncClient.put": "Type.Array.BooleanValue.put", - "type.array.BooleanValueAsyncClient.putWithResponse": "Type.Array.BooleanValue.put", - "type.array.BooleanValueClient": "Type.Array.BooleanValue", - "type.array.BooleanValueClient.get": "Type.Array.BooleanValue.get", - "type.array.BooleanValueClient.getWithResponse": "Type.Array.BooleanValue.get", - "type.array.BooleanValueClient.put": "Type.Array.BooleanValue.put", - "type.array.BooleanValueClient.putWithResponse": "Type.Array.BooleanValue.put", - "type.array.DatetimeValueAsyncClient": "Type.Array.DatetimeValue", - "type.array.DatetimeValueAsyncClient.get": "Type.Array.DatetimeValue.get", - "type.array.DatetimeValueAsyncClient.getWithResponse": "Type.Array.DatetimeValue.get", - "type.array.DatetimeValueAsyncClient.put": "Type.Array.DatetimeValue.put", - "type.array.DatetimeValueAsyncClient.putWithResponse": "Type.Array.DatetimeValue.put", - "type.array.DatetimeValueClient": "Type.Array.DatetimeValue", - "type.array.DatetimeValueClient.get": "Type.Array.DatetimeValue.get", - "type.array.DatetimeValueClient.getWithResponse": "Type.Array.DatetimeValue.get", - "type.array.DatetimeValueClient.put": "Type.Array.DatetimeValue.put", - "type.array.DatetimeValueClient.putWithResponse": "Type.Array.DatetimeValue.put", - "type.array.DurationValueAsyncClient": "Type.Array.DurationValue", - "type.array.DurationValueAsyncClient.get": "Type.Array.DurationValue.get", - "type.array.DurationValueAsyncClient.getWithResponse": "Type.Array.DurationValue.get", - "type.array.DurationValueAsyncClient.put": "Type.Array.DurationValue.put", - "type.array.DurationValueAsyncClient.putWithResponse": "Type.Array.DurationValue.put", - "type.array.DurationValueClient": "Type.Array.DurationValue", - "type.array.DurationValueClient.get": "Type.Array.DurationValue.get", - "type.array.DurationValueClient.getWithResponse": "Type.Array.DurationValue.get", - "type.array.DurationValueClient.put": "Type.Array.DurationValue.put", - "type.array.DurationValueClient.putWithResponse": "Type.Array.DurationValue.put", - "type.array.Float32ValueAsyncClient": "Type.Array.Float32Value", - "type.array.Float32ValueAsyncClient.get": "Type.Array.Float32Value.get", - "type.array.Float32ValueAsyncClient.getWithResponse": "Type.Array.Float32Value.get", - "type.array.Float32ValueAsyncClient.put": "Type.Array.Float32Value.put", - "type.array.Float32ValueAsyncClient.putWithResponse": "Type.Array.Float32Value.put", - "type.array.Float32ValueClient": "Type.Array.Float32Value", - "type.array.Float32ValueClient.get": "Type.Array.Float32Value.get", - "type.array.Float32ValueClient.getWithResponse": "Type.Array.Float32Value.get", - "type.array.Float32ValueClient.put": "Type.Array.Float32Value.put", - "type.array.Float32ValueClient.putWithResponse": "Type.Array.Float32Value.put", - "type.array.Int32ValueAsyncClient": "Type.Array.Int32Value", - "type.array.Int32ValueAsyncClient.get": "Type.Array.Int32Value.get", - "type.array.Int32ValueAsyncClient.getWithResponse": "Type.Array.Int32Value.get", - "type.array.Int32ValueAsyncClient.put": "Type.Array.Int32Value.put", - "type.array.Int32ValueAsyncClient.putWithResponse": "Type.Array.Int32Value.put", - "type.array.Int32ValueClient": "Type.Array.Int32Value", - "type.array.Int32ValueClient.get": "Type.Array.Int32Value.get", - "type.array.Int32ValueClient.getWithResponse": "Type.Array.Int32Value.get", - "type.array.Int32ValueClient.put": "Type.Array.Int32Value.put", - "type.array.Int32ValueClient.putWithResponse": "Type.Array.Int32Value.put", - "type.array.Int64ValueAsyncClient": "Type.Array.Int64Value", - "type.array.Int64ValueAsyncClient.get": "Type.Array.Int64Value.get", - "type.array.Int64ValueAsyncClient.getWithResponse": "Type.Array.Int64Value.get", - "type.array.Int64ValueAsyncClient.put": "Type.Array.Int64Value.put", - "type.array.Int64ValueAsyncClient.putWithResponse": "Type.Array.Int64Value.put", - "type.array.Int64ValueClient": "Type.Array.Int64Value", - "type.array.Int64ValueClient.get": "Type.Array.Int64Value.get", - "type.array.Int64ValueClient.getWithResponse": "Type.Array.Int64Value.get", - "type.array.Int64ValueClient.put": "Type.Array.Int64Value.put", - "type.array.Int64ValueClient.putWithResponse": "Type.Array.Int64Value.put", - "type.array.ModelValueAsyncClient": "Type.Array.ModelValue", - "type.array.ModelValueAsyncClient.get": "Type.Array.ModelValue.get", - "type.array.ModelValueAsyncClient.getWithResponse": "Type.Array.ModelValue.get", - "type.array.ModelValueAsyncClient.put": "Type.Array.ModelValue.put", - "type.array.ModelValueAsyncClient.putWithResponse": "Type.Array.ModelValue.put", - "type.array.ModelValueClient": "Type.Array.ModelValue", - "type.array.ModelValueClient.get": "Type.Array.ModelValue.get", - "type.array.ModelValueClient.getWithResponse": "Type.Array.ModelValue.get", - "type.array.ModelValueClient.put": "Type.Array.ModelValue.put", - "type.array.ModelValueClient.putWithResponse": "Type.Array.ModelValue.put", - "type.array.NullableBooleanValueAsyncClient": "Type.Array.NullableBooleanValue", - "type.array.NullableBooleanValueAsyncClient.get": "Type.Array.NullableBooleanValue.get", - "type.array.NullableBooleanValueAsyncClient.getWithResponse": "Type.Array.NullableBooleanValue.get", - "type.array.NullableBooleanValueAsyncClient.put": "Type.Array.NullableBooleanValue.put", - "type.array.NullableBooleanValueAsyncClient.putWithResponse": "Type.Array.NullableBooleanValue.put", - "type.array.NullableBooleanValueClient": "Type.Array.NullableBooleanValue", - "type.array.NullableBooleanValueClient.get": "Type.Array.NullableBooleanValue.get", - "type.array.NullableBooleanValueClient.getWithResponse": "Type.Array.NullableBooleanValue.get", - "type.array.NullableBooleanValueClient.put": "Type.Array.NullableBooleanValue.put", - "type.array.NullableBooleanValueClient.putWithResponse": "Type.Array.NullableBooleanValue.put", - "type.array.NullableFloatValueAsyncClient": "Type.Array.NullableFloatValue", - "type.array.NullableFloatValueAsyncClient.get": "Type.Array.NullableFloatValue.get", - "type.array.NullableFloatValueAsyncClient.getWithResponse": "Type.Array.NullableFloatValue.get", - "type.array.NullableFloatValueAsyncClient.put": "Type.Array.NullableFloatValue.put", - "type.array.NullableFloatValueAsyncClient.putWithResponse": "Type.Array.NullableFloatValue.put", - "type.array.NullableFloatValueClient": "Type.Array.NullableFloatValue", - "type.array.NullableFloatValueClient.get": "Type.Array.NullableFloatValue.get", - "type.array.NullableFloatValueClient.getWithResponse": "Type.Array.NullableFloatValue.get", - "type.array.NullableFloatValueClient.put": "Type.Array.NullableFloatValue.put", - "type.array.NullableFloatValueClient.putWithResponse": "Type.Array.NullableFloatValue.put", - "type.array.NullableInt32ValueAsyncClient": "Type.Array.NullableInt32Value", - "type.array.NullableInt32ValueAsyncClient.get": "Type.Array.NullableInt32Value.get", - "type.array.NullableInt32ValueAsyncClient.getWithResponse": "Type.Array.NullableInt32Value.get", - "type.array.NullableInt32ValueAsyncClient.put": "Type.Array.NullableInt32Value.put", - "type.array.NullableInt32ValueAsyncClient.putWithResponse": "Type.Array.NullableInt32Value.put", - "type.array.NullableInt32ValueClient": "Type.Array.NullableInt32Value", - "type.array.NullableInt32ValueClient.get": "Type.Array.NullableInt32Value.get", - "type.array.NullableInt32ValueClient.getWithResponse": "Type.Array.NullableInt32Value.get", - "type.array.NullableInt32ValueClient.put": "Type.Array.NullableInt32Value.put", - "type.array.NullableInt32ValueClient.putWithResponse": "Type.Array.NullableInt32Value.put", - "type.array.NullableModelValueAsyncClient": "Type.Array.NullableModelValue", - "type.array.NullableModelValueAsyncClient.get": "Type.Array.NullableModelValue.get", - "type.array.NullableModelValueAsyncClient.getWithResponse": "Type.Array.NullableModelValue.get", - "type.array.NullableModelValueAsyncClient.put": "Type.Array.NullableModelValue.put", - "type.array.NullableModelValueAsyncClient.putWithResponse": "Type.Array.NullableModelValue.put", - "type.array.NullableModelValueClient": "Type.Array.NullableModelValue", - "type.array.NullableModelValueClient.get": "Type.Array.NullableModelValue.get", - "type.array.NullableModelValueClient.getWithResponse": "Type.Array.NullableModelValue.get", - "type.array.NullableModelValueClient.put": "Type.Array.NullableModelValue.put", - "type.array.NullableModelValueClient.putWithResponse": "Type.Array.NullableModelValue.put", - "type.array.NullableStringValueAsyncClient": "Type.Array.NullableStringValue", - "type.array.NullableStringValueAsyncClient.get": "Type.Array.NullableStringValue.get", - "type.array.NullableStringValueAsyncClient.getWithResponse": "Type.Array.NullableStringValue.get", - "type.array.NullableStringValueAsyncClient.put": "Type.Array.NullableStringValue.put", - "type.array.NullableStringValueAsyncClient.putWithResponse": "Type.Array.NullableStringValue.put", - "type.array.NullableStringValueClient": "Type.Array.NullableStringValue", - "type.array.NullableStringValueClient.get": "Type.Array.NullableStringValue.get", - "type.array.NullableStringValueClient.getWithResponse": "Type.Array.NullableStringValue.get", - "type.array.NullableStringValueClient.put": "Type.Array.NullableStringValue.put", - "type.array.NullableStringValueClient.putWithResponse": "Type.Array.NullableStringValue.put", - "type.array.StringValueAsyncClient": "Type.Array.StringValue", - "type.array.StringValueAsyncClient.get": "Type.Array.StringValue.get", - "type.array.StringValueAsyncClient.getWithResponse": "Type.Array.StringValue.get", - "type.array.StringValueAsyncClient.put": "Type.Array.StringValue.put", - "type.array.StringValueAsyncClient.putWithResponse": "Type.Array.StringValue.put", - "type.array.StringValueClient": "Type.Array.StringValue", - "type.array.StringValueClient.get": "Type.Array.StringValue.get", - "type.array.StringValueClient.getWithResponse": "Type.Array.StringValue.get", - "type.array.StringValueClient.put": "Type.Array.StringValue.put", - "type.array.StringValueClient.putWithResponse": "Type.Array.StringValue.put", - "type.array.UnknownValueAsyncClient": "Type.Array.UnknownValue", - "type.array.UnknownValueAsyncClient.get": "Type.Array.UnknownValue.get", - "type.array.UnknownValueAsyncClient.getWithResponse": "Type.Array.UnknownValue.get", - "type.array.UnknownValueAsyncClient.put": "Type.Array.UnknownValue.put", - "type.array.UnknownValueAsyncClient.putWithResponse": "Type.Array.UnknownValue.put", - "type.array.UnknownValueClient": "Type.Array.UnknownValue", - "type.array.UnknownValueClient.get": "Type.Array.UnknownValue.get", - "type.array.UnknownValueClient.getWithResponse": "Type.Array.UnknownValue.get", - "type.array.UnknownValueClient.put": "Type.Array.UnknownValue.put", - "type.array.UnknownValueClient.putWithResponse": "Type.Array.UnknownValue.put", - "type.array.models.InnerModel": "Type.Array.InnerModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_metadata.json deleted file mode 100644 index e3fee9b1ce4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.array.ArrayClientBuilder":"Type.Array","type.array.BooleanValueAsyncClient":"Type.Array.BooleanValue","type.array.BooleanValueAsyncClient.get":"Type.Array.BooleanValue.get","type.array.BooleanValueAsyncClient.getWithResponse":"Type.Array.BooleanValue.get","type.array.BooleanValueAsyncClient.put":"Type.Array.BooleanValue.put","type.array.BooleanValueAsyncClient.putWithResponse":"Type.Array.BooleanValue.put","type.array.BooleanValueClient":"Type.Array.BooleanValue","type.array.BooleanValueClient.get":"Type.Array.BooleanValue.get","type.array.BooleanValueClient.getWithResponse":"Type.Array.BooleanValue.get","type.array.BooleanValueClient.put":"Type.Array.BooleanValue.put","type.array.BooleanValueClient.putWithResponse":"Type.Array.BooleanValue.put","type.array.DatetimeValueAsyncClient":"Type.Array.DatetimeValue","type.array.DatetimeValueAsyncClient.get":"Type.Array.DatetimeValue.get","type.array.DatetimeValueAsyncClient.getWithResponse":"Type.Array.DatetimeValue.get","type.array.DatetimeValueAsyncClient.put":"Type.Array.DatetimeValue.put","type.array.DatetimeValueAsyncClient.putWithResponse":"Type.Array.DatetimeValue.put","type.array.DatetimeValueClient":"Type.Array.DatetimeValue","type.array.DatetimeValueClient.get":"Type.Array.DatetimeValue.get","type.array.DatetimeValueClient.getWithResponse":"Type.Array.DatetimeValue.get","type.array.DatetimeValueClient.put":"Type.Array.DatetimeValue.put","type.array.DatetimeValueClient.putWithResponse":"Type.Array.DatetimeValue.put","type.array.DurationValueAsyncClient":"Type.Array.DurationValue","type.array.DurationValueAsyncClient.get":"Type.Array.DurationValue.get","type.array.DurationValueAsyncClient.getWithResponse":"Type.Array.DurationValue.get","type.array.DurationValueAsyncClient.put":"Type.Array.DurationValue.put","type.array.DurationValueAsyncClient.putWithResponse":"Type.Array.DurationValue.put","type.array.DurationValueClient":"Type.Array.DurationValue","type.array.DurationValueClient.get":"Type.Array.DurationValue.get","type.array.DurationValueClient.getWithResponse":"Type.Array.DurationValue.get","type.array.DurationValueClient.put":"Type.Array.DurationValue.put","type.array.DurationValueClient.putWithResponse":"Type.Array.DurationValue.put","type.array.Float32ValueAsyncClient":"Type.Array.Float32Value","type.array.Float32ValueAsyncClient.get":"Type.Array.Float32Value.get","type.array.Float32ValueAsyncClient.getWithResponse":"Type.Array.Float32Value.get","type.array.Float32ValueAsyncClient.put":"Type.Array.Float32Value.put","type.array.Float32ValueAsyncClient.putWithResponse":"Type.Array.Float32Value.put","type.array.Float32ValueClient":"Type.Array.Float32Value","type.array.Float32ValueClient.get":"Type.Array.Float32Value.get","type.array.Float32ValueClient.getWithResponse":"Type.Array.Float32Value.get","type.array.Float32ValueClient.put":"Type.Array.Float32Value.put","type.array.Float32ValueClient.putWithResponse":"Type.Array.Float32Value.put","type.array.Int32ValueAsyncClient":"Type.Array.Int32Value","type.array.Int32ValueAsyncClient.get":"Type.Array.Int32Value.get","type.array.Int32ValueAsyncClient.getWithResponse":"Type.Array.Int32Value.get","type.array.Int32ValueAsyncClient.put":"Type.Array.Int32Value.put","type.array.Int32ValueAsyncClient.putWithResponse":"Type.Array.Int32Value.put","type.array.Int32ValueClient":"Type.Array.Int32Value","type.array.Int32ValueClient.get":"Type.Array.Int32Value.get","type.array.Int32ValueClient.getWithResponse":"Type.Array.Int32Value.get","type.array.Int32ValueClient.put":"Type.Array.Int32Value.put","type.array.Int32ValueClient.putWithResponse":"Type.Array.Int32Value.put","type.array.Int64ValueAsyncClient":"Type.Array.Int64Value","type.array.Int64ValueAsyncClient.get":"Type.Array.Int64Value.get","type.array.Int64ValueAsyncClient.getWithResponse":"Type.Array.Int64Value.get","type.array.Int64ValueAsyncClient.put":"Type.Array.Int64Value.put","type.array.Int64ValueAsyncClient.putWithResponse":"Type.Array.Int64Value.put","type.array.Int64ValueClient":"Type.Array.Int64Value","type.array.Int64ValueClient.get":"Type.Array.Int64Value.get","type.array.Int64ValueClient.getWithResponse":"Type.Array.Int64Value.get","type.array.Int64ValueClient.put":"Type.Array.Int64Value.put","type.array.Int64ValueClient.putWithResponse":"Type.Array.Int64Value.put","type.array.ModelValueAsyncClient":"Type.Array.ModelValue","type.array.ModelValueAsyncClient.get":"Type.Array.ModelValue.get","type.array.ModelValueAsyncClient.getWithResponse":"Type.Array.ModelValue.get","type.array.ModelValueAsyncClient.put":"Type.Array.ModelValue.put","type.array.ModelValueAsyncClient.putWithResponse":"Type.Array.ModelValue.put","type.array.ModelValueClient":"Type.Array.ModelValue","type.array.ModelValueClient.get":"Type.Array.ModelValue.get","type.array.ModelValueClient.getWithResponse":"Type.Array.ModelValue.get","type.array.ModelValueClient.put":"Type.Array.ModelValue.put","type.array.ModelValueClient.putWithResponse":"Type.Array.ModelValue.put","type.array.NullableBooleanValueAsyncClient":"Type.Array.NullableBooleanValue","type.array.NullableBooleanValueAsyncClient.get":"Type.Array.NullableBooleanValue.get","type.array.NullableBooleanValueAsyncClient.getWithResponse":"Type.Array.NullableBooleanValue.get","type.array.NullableBooleanValueAsyncClient.put":"Type.Array.NullableBooleanValue.put","type.array.NullableBooleanValueAsyncClient.putWithResponse":"Type.Array.NullableBooleanValue.put","type.array.NullableBooleanValueClient":"Type.Array.NullableBooleanValue","type.array.NullableBooleanValueClient.get":"Type.Array.NullableBooleanValue.get","type.array.NullableBooleanValueClient.getWithResponse":"Type.Array.NullableBooleanValue.get","type.array.NullableBooleanValueClient.put":"Type.Array.NullableBooleanValue.put","type.array.NullableBooleanValueClient.putWithResponse":"Type.Array.NullableBooleanValue.put","type.array.NullableFloatValueAsyncClient":"Type.Array.NullableFloatValue","type.array.NullableFloatValueAsyncClient.get":"Type.Array.NullableFloatValue.get","type.array.NullableFloatValueAsyncClient.getWithResponse":"Type.Array.NullableFloatValue.get","type.array.NullableFloatValueAsyncClient.put":"Type.Array.NullableFloatValue.put","type.array.NullableFloatValueAsyncClient.putWithResponse":"Type.Array.NullableFloatValue.put","type.array.NullableFloatValueClient":"Type.Array.NullableFloatValue","type.array.NullableFloatValueClient.get":"Type.Array.NullableFloatValue.get","type.array.NullableFloatValueClient.getWithResponse":"Type.Array.NullableFloatValue.get","type.array.NullableFloatValueClient.put":"Type.Array.NullableFloatValue.put","type.array.NullableFloatValueClient.putWithResponse":"Type.Array.NullableFloatValue.put","type.array.NullableInt32ValueAsyncClient":"Type.Array.NullableInt32Value","type.array.NullableInt32ValueAsyncClient.get":"Type.Array.NullableInt32Value.get","type.array.NullableInt32ValueAsyncClient.getWithResponse":"Type.Array.NullableInt32Value.get","type.array.NullableInt32ValueAsyncClient.put":"Type.Array.NullableInt32Value.put","type.array.NullableInt32ValueAsyncClient.putWithResponse":"Type.Array.NullableInt32Value.put","type.array.NullableInt32ValueClient":"Type.Array.NullableInt32Value","type.array.NullableInt32ValueClient.get":"Type.Array.NullableInt32Value.get","type.array.NullableInt32ValueClient.getWithResponse":"Type.Array.NullableInt32Value.get","type.array.NullableInt32ValueClient.put":"Type.Array.NullableInt32Value.put","type.array.NullableInt32ValueClient.putWithResponse":"Type.Array.NullableInt32Value.put","type.array.NullableModelValueAsyncClient":"Type.Array.NullableModelValue","type.array.NullableModelValueAsyncClient.get":"Type.Array.NullableModelValue.get","type.array.NullableModelValueAsyncClient.getWithResponse":"Type.Array.NullableModelValue.get","type.array.NullableModelValueAsyncClient.put":"Type.Array.NullableModelValue.put","type.array.NullableModelValueAsyncClient.putWithResponse":"Type.Array.NullableModelValue.put","type.array.NullableModelValueClient":"Type.Array.NullableModelValue","type.array.NullableModelValueClient.get":"Type.Array.NullableModelValue.get","type.array.NullableModelValueClient.getWithResponse":"Type.Array.NullableModelValue.get","type.array.NullableModelValueClient.put":"Type.Array.NullableModelValue.put","type.array.NullableModelValueClient.putWithResponse":"Type.Array.NullableModelValue.put","type.array.NullableStringValueAsyncClient":"Type.Array.NullableStringValue","type.array.NullableStringValueAsyncClient.get":"Type.Array.NullableStringValue.get","type.array.NullableStringValueAsyncClient.getWithResponse":"Type.Array.NullableStringValue.get","type.array.NullableStringValueAsyncClient.put":"Type.Array.NullableStringValue.put","type.array.NullableStringValueAsyncClient.putWithResponse":"Type.Array.NullableStringValue.put","type.array.NullableStringValueClient":"Type.Array.NullableStringValue","type.array.NullableStringValueClient.get":"Type.Array.NullableStringValue.get","type.array.NullableStringValueClient.getWithResponse":"Type.Array.NullableStringValue.get","type.array.NullableStringValueClient.put":"Type.Array.NullableStringValue.put","type.array.NullableStringValueClient.putWithResponse":"Type.Array.NullableStringValue.put","type.array.StringValueAsyncClient":"Type.Array.StringValue","type.array.StringValueAsyncClient.get":"Type.Array.StringValue.get","type.array.StringValueAsyncClient.getWithResponse":"Type.Array.StringValue.get","type.array.StringValueAsyncClient.put":"Type.Array.StringValue.put","type.array.StringValueAsyncClient.putWithResponse":"Type.Array.StringValue.put","type.array.StringValueClient":"Type.Array.StringValue","type.array.StringValueClient.get":"Type.Array.StringValue.get","type.array.StringValueClient.getWithResponse":"Type.Array.StringValue.get","type.array.StringValueClient.put":"Type.Array.StringValue.put","type.array.StringValueClient.putWithResponse":"Type.Array.StringValue.put","type.array.UnknownValueAsyncClient":"Type.Array.UnknownValue","type.array.UnknownValueAsyncClient.get":"Type.Array.UnknownValue.get","type.array.UnknownValueAsyncClient.getWithResponse":"Type.Array.UnknownValue.get","type.array.UnknownValueAsyncClient.put":"Type.Array.UnknownValue.put","type.array.UnknownValueAsyncClient.putWithResponse":"Type.Array.UnknownValue.put","type.array.UnknownValueClient":"Type.Array.UnknownValue","type.array.UnknownValueClient.get":"Type.Array.UnknownValue.get","type.array.UnknownValueClient.getWithResponse":"Type.Array.UnknownValue.get","type.array.UnknownValueClient.put":"Type.Array.UnknownValue.put","type.array.UnknownValueClient.putWithResponse":"Type.Array.UnknownValue.put","type.array.models.InnerModel":"Type.Array.InnerModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/array/ArrayClientBuilder.java","src/main/java/type/array/BooleanValueAsyncClient.java","src/main/java/type/array/BooleanValueClient.java","src/main/java/type/array/DatetimeValueAsyncClient.java","src/main/java/type/array/DatetimeValueClient.java","src/main/java/type/array/DurationValueAsyncClient.java","src/main/java/type/array/DurationValueClient.java","src/main/java/type/array/Float32ValueAsyncClient.java","src/main/java/type/array/Float32ValueClient.java","src/main/java/type/array/Int32ValueAsyncClient.java","src/main/java/type/array/Int32ValueClient.java","src/main/java/type/array/Int64ValueAsyncClient.java","src/main/java/type/array/Int64ValueClient.java","src/main/java/type/array/ModelValueAsyncClient.java","src/main/java/type/array/ModelValueClient.java","src/main/java/type/array/NullableBooleanValueAsyncClient.java","src/main/java/type/array/NullableBooleanValueClient.java","src/main/java/type/array/NullableFloatValueAsyncClient.java","src/main/java/type/array/NullableFloatValueClient.java","src/main/java/type/array/NullableInt32ValueAsyncClient.java","src/main/java/type/array/NullableInt32ValueClient.java","src/main/java/type/array/NullableModelValueAsyncClient.java","src/main/java/type/array/NullableModelValueClient.java","src/main/java/type/array/NullableStringValueAsyncClient.java","src/main/java/type/array/NullableStringValueClient.java","src/main/java/type/array/StringValueAsyncClient.java","src/main/java/type/array/StringValueClient.java","src/main/java/type/array/UnknownValueAsyncClient.java","src/main/java/type/array/UnknownValueClient.java","src/main/java/type/array/implementation/ArrayClientImpl.java","src/main/java/type/array/implementation/BooleanValuesImpl.java","src/main/java/type/array/implementation/DatetimeValuesImpl.java","src/main/java/type/array/implementation/DurationValuesImpl.java","src/main/java/type/array/implementation/Float32ValuesImpl.java","src/main/java/type/array/implementation/Int32ValuesImpl.java","src/main/java/type/array/implementation/Int64ValuesImpl.java","src/main/java/type/array/implementation/ModelValuesImpl.java","src/main/java/type/array/implementation/NullableBooleanValuesImpl.java","src/main/java/type/array/implementation/NullableFloatValuesImpl.java","src/main/java/type/array/implementation/NullableInt32ValuesImpl.java","src/main/java/type/array/implementation/NullableModelValuesImpl.java","src/main/java/type/array/implementation/NullableStringValuesImpl.java","src/main/java/type/array/implementation/StringValuesImpl.java","src/main/java/type/array/implementation/UnknownValuesImpl.java","src/main/java/type/array/implementation/package-info.java","src/main/java/type/array/models/InnerModel.java","src/main/java/type/array/models/package-info.java","src/main/java/type/array/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_apiview_properties.json deleted file mode 100644 index 8cc56c8c284..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_apiview_properties.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.dictionary.BooleanValueAsyncClient": "Type.Dictionary.BooleanValue", - "type.dictionary.BooleanValueAsyncClient.get": "Type.Dictionary.BooleanValue.get", - "type.dictionary.BooleanValueAsyncClient.getWithResponse": "Type.Dictionary.BooleanValue.get", - "type.dictionary.BooleanValueAsyncClient.put": "Type.Dictionary.BooleanValue.put", - "type.dictionary.BooleanValueAsyncClient.putWithResponse": "Type.Dictionary.BooleanValue.put", - "type.dictionary.BooleanValueClient": "Type.Dictionary.BooleanValue", - "type.dictionary.BooleanValueClient.get": "Type.Dictionary.BooleanValue.get", - "type.dictionary.BooleanValueClient.getWithResponse": "Type.Dictionary.BooleanValue.get", - "type.dictionary.BooleanValueClient.put": "Type.Dictionary.BooleanValue.put", - "type.dictionary.BooleanValueClient.putWithResponse": "Type.Dictionary.BooleanValue.put", - "type.dictionary.DatetimeValueAsyncClient": "Type.Dictionary.DatetimeValue", - "type.dictionary.DatetimeValueAsyncClient.get": "Type.Dictionary.DatetimeValue.get", - "type.dictionary.DatetimeValueAsyncClient.getWithResponse": "Type.Dictionary.DatetimeValue.get", - "type.dictionary.DatetimeValueAsyncClient.put": "Type.Dictionary.DatetimeValue.put", - "type.dictionary.DatetimeValueAsyncClient.putWithResponse": "Type.Dictionary.DatetimeValue.put", - "type.dictionary.DatetimeValueClient": "Type.Dictionary.DatetimeValue", - "type.dictionary.DatetimeValueClient.get": "Type.Dictionary.DatetimeValue.get", - "type.dictionary.DatetimeValueClient.getWithResponse": "Type.Dictionary.DatetimeValue.get", - "type.dictionary.DatetimeValueClient.put": "Type.Dictionary.DatetimeValue.put", - "type.dictionary.DatetimeValueClient.putWithResponse": "Type.Dictionary.DatetimeValue.put", - "type.dictionary.DictionaryClientBuilder": "Type.Dictionary", - "type.dictionary.DurationValueAsyncClient": "Type.Dictionary.DurationValue", - "type.dictionary.DurationValueAsyncClient.get": "Type.Dictionary.DurationValue.get", - "type.dictionary.DurationValueAsyncClient.getWithResponse": "Type.Dictionary.DurationValue.get", - "type.dictionary.DurationValueAsyncClient.put": "Type.Dictionary.DurationValue.put", - "type.dictionary.DurationValueAsyncClient.putWithResponse": "Type.Dictionary.DurationValue.put", - "type.dictionary.DurationValueClient": "Type.Dictionary.DurationValue", - "type.dictionary.DurationValueClient.get": "Type.Dictionary.DurationValue.get", - "type.dictionary.DurationValueClient.getWithResponse": "Type.Dictionary.DurationValue.get", - "type.dictionary.DurationValueClient.put": "Type.Dictionary.DurationValue.put", - "type.dictionary.DurationValueClient.putWithResponse": "Type.Dictionary.DurationValue.put", - "type.dictionary.Float32ValueAsyncClient": "Type.Dictionary.Float32Value", - "type.dictionary.Float32ValueAsyncClient.get": "Type.Dictionary.Float32Value.get", - "type.dictionary.Float32ValueAsyncClient.getWithResponse": "Type.Dictionary.Float32Value.get", - "type.dictionary.Float32ValueAsyncClient.put": "Type.Dictionary.Float32Value.put", - "type.dictionary.Float32ValueAsyncClient.putWithResponse": "Type.Dictionary.Float32Value.put", - "type.dictionary.Float32ValueClient": "Type.Dictionary.Float32Value", - "type.dictionary.Float32ValueClient.get": "Type.Dictionary.Float32Value.get", - "type.dictionary.Float32ValueClient.getWithResponse": "Type.Dictionary.Float32Value.get", - "type.dictionary.Float32ValueClient.put": "Type.Dictionary.Float32Value.put", - "type.dictionary.Float32ValueClient.putWithResponse": "Type.Dictionary.Float32Value.put", - "type.dictionary.Int32ValueAsyncClient": "Type.Dictionary.Int32Value", - "type.dictionary.Int32ValueAsyncClient.get": "Type.Dictionary.Int32Value.get", - "type.dictionary.Int32ValueAsyncClient.getWithResponse": "Type.Dictionary.Int32Value.get", - "type.dictionary.Int32ValueAsyncClient.put": "Type.Dictionary.Int32Value.put", - "type.dictionary.Int32ValueAsyncClient.putWithResponse": "Type.Dictionary.Int32Value.put", - "type.dictionary.Int32ValueClient": "Type.Dictionary.Int32Value", - "type.dictionary.Int32ValueClient.get": "Type.Dictionary.Int32Value.get", - "type.dictionary.Int32ValueClient.getWithResponse": "Type.Dictionary.Int32Value.get", - "type.dictionary.Int32ValueClient.put": "Type.Dictionary.Int32Value.put", - "type.dictionary.Int32ValueClient.putWithResponse": "Type.Dictionary.Int32Value.put", - "type.dictionary.Int64ValueAsyncClient": "Type.Dictionary.Int64Value", - "type.dictionary.Int64ValueAsyncClient.get": "Type.Dictionary.Int64Value.get", - "type.dictionary.Int64ValueAsyncClient.getWithResponse": "Type.Dictionary.Int64Value.get", - "type.dictionary.Int64ValueAsyncClient.put": "Type.Dictionary.Int64Value.put", - "type.dictionary.Int64ValueAsyncClient.putWithResponse": "Type.Dictionary.Int64Value.put", - "type.dictionary.Int64ValueClient": "Type.Dictionary.Int64Value", - "type.dictionary.Int64ValueClient.get": "Type.Dictionary.Int64Value.get", - "type.dictionary.Int64ValueClient.getWithResponse": "Type.Dictionary.Int64Value.get", - "type.dictionary.Int64ValueClient.put": "Type.Dictionary.Int64Value.put", - "type.dictionary.Int64ValueClient.putWithResponse": "Type.Dictionary.Int64Value.put", - "type.dictionary.ModelValueAsyncClient": "Type.Dictionary.ModelValue", - "type.dictionary.ModelValueAsyncClient.get": "Type.Dictionary.ModelValue.get", - "type.dictionary.ModelValueAsyncClient.getWithResponse": "Type.Dictionary.ModelValue.get", - "type.dictionary.ModelValueAsyncClient.put": "Type.Dictionary.ModelValue.put", - "type.dictionary.ModelValueAsyncClient.putWithResponse": "Type.Dictionary.ModelValue.put", - "type.dictionary.ModelValueClient": "Type.Dictionary.ModelValue", - "type.dictionary.ModelValueClient.get": "Type.Dictionary.ModelValue.get", - "type.dictionary.ModelValueClient.getWithResponse": "Type.Dictionary.ModelValue.get", - "type.dictionary.ModelValueClient.put": "Type.Dictionary.ModelValue.put", - "type.dictionary.ModelValueClient.putWithResponse": "Type.Dictionary.ModelValue.put", - "type.dictionary.NullableFloatValueAsyncClient": "Type.Dictionary.NullableFloatValue", - "type.dictionary.NullableFloatValueAsyncClient.get": "Type.Dictionary.NullableFloatValue.get", - "type.dictionary.NullableFloatValueAsyncClient.getWithResponse": "Type.Dictionary.NullableFloatValue.get", - "type.dictionary.NullableFloatValueAsyncClient.put": "Type.Dictionary.NullableFloatValue.put", - "type.dictionary.NullableFloatValueAsyncClient.putWithResponse": "Type.Dictionary.NullableFloatValue.put", - "type.dictionary.NullableFloatValueClient": "Type.Dictionary.NullableFloatValue", - "type.dictionary.NullableFloatValueClient.get": "Type.Dictionary.NullableFloatValue.get", - "type.dictionary.NullableFloatValueClient.getWithResponse": "Type.Dictionary.NullableFloatValue.get", - "type.dictionary.NullableFloatValueClient.put": "Type.Dictionary.NullableFloatValue.put", - "type.dictionary.NullableFloatValueClient.putWithResponse": "Type.Dictionary.NullableFloatValue.put", - "type.dictionary.RecursiveModelValueAsyncClient": "Type.Dictionary.RecursiveModelValue", - "type.dictionary.RecursiveModelValueAsyncClient.get": "Type.Dictionary.RecursiveModelValue.get", - "type.dictionary.RecursiveModelValueAsyncClient.getWithResponse": "Type.Dictionary.RecursiveModelValue.get", - "type.dictionary.RecursiveModelValueAsyncClient.put": "Type.Dictionary.RecursiveModelValue.put", - "type.dictionary.RecursiveModelValueAsyncClient.putWithResponse": "Type.Dictionary.RecursiveModelValue.put", - "type.dictionary.RecursiveModelValueClient": "Type.Dictionary.RecursiveModelValue", - "type.dictionary.RecursiveModelValueClient.get": "Type.Dictionary.RecursiveModelValue.get", - "type.dictionary.RecursiveModelValueClient.getWithResponse": "Type.Dictionary.RecursiveModelValue.get", - "type.dictionary.RecursiveModelValueClient.put": "Type.Dictionary.RecursiveModelValue.put", - "type.dictionary.RecursiveModelValueClient.putWithResponse": "Type.Dictionary.RecursiveModelValue.put", - "type.dictionary.StringValueAsyncClient": "Type.Dictionary.StringValue", - "type.dictionary.StringValueAsyncClient.get": "Type.Dictionary.StringValue.get", - "type.dictionary.StringValueAsyncClient.getWithResponse": "Type.Dictionary.StringValue.get", - "type.dictionary.StringValueAsyncClient.put": "Type.Dictionary.StringValue.put", - "type.dictionary.StringValueAsyncClient.putWithResponse": "Type.Dictionary.StringValue.put", - "type.dictionary.StringValueClient": "Type.Dictionary.StringValue", - "type.dictionary.StringValueClient.get": "Type.Dictionary.StringValue.get", - "type.dictionary.StringValueClient.getWithResponse": "Type.Dictionary.StringValue.get", - "type.dictionary.StringValueClient.put": "Type.Dictionary.StringValue.put", - "type.dictionary.StringValueClient.putWithResponse": "Type.Dictionary.StringValue.put", - "type.dictionary.UnknownValueAsyncClient": "Type.Dictionary.UnknownValue", - "type.dictionary.UnknownValueAsyncClient.get": "Type.Dictionary.UnknownValue.get", - "type.dictionary.UnknownValueAsyncClient.getWithResponse": "Type.Dictionary.UnknownValue.get", - "type.dictionary.UnknownValueAsyncClient.put": "Type.Dictionary.UnknownValue.put", - "type.dictionary.UnknownValueAsyncClient.putWithResponse": "Type.Dictionary.UnknownValue.put", - "type.dictionary.UnknownValueClient": "Type.Dictionary.UnknownValue", - "type.dictionary.UnknownValueClient.get": "Type.Dictionary.UnknownValue.get", - "type.dictionary.UnknownValueClient.getWithResponse": "Type.Dictionary.UnknownValue.get", - "type.dictionary.UnknownValueClient.put": "Type.Dictionary.UnknownValue.put", - "type.dictionary.UnknownValueClient.putWithResponse": "Type.Dictionary.UnknownValue.put", - "type.dictionary.models.InnerModel": "Type.Dictionary.InnerModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_metadata.json deleted file mode 100644 index 6a781e5c329..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.dictionary.BooleanValueAsyncClient":"Type.Dictionary.BooleanValue","type.dictionary.BooleanValueAsyncClient.get":"Type.Dictionary.BooleanValue.get","type.dictionary.BooleanValueAsyncClient.getWithResponse":"Type.Dictionary.BooleanValue.get","type.dictionary.BooleanValueAsyncClient.put":"Type.Dictionary.BooleanValue.put","type.dictionary.BooleanValueAsyncClient.putWithResponse":"Type.Dictionary.BooleanValue.put","type.dictionary.BooleanValueClient":"Type.Dictionary.BooleanValue","type.dictionary.BooleanValueClient.get":"Type.Dictionary.BooleanValue.get","type.dictionary.BooleanValueClient.getWithResponse":"Type.Dictionary.BooleanValue.get","type.dictionary.BooleanValueClient.put":"Type.Dictionary.BooleanValue.put","type.dictionary.BooleanValueClient.putWithResponse":"Type.Dictionary.BooleanValue.put","type.dictionary.DatetimeValueAsyncClient":"Type.Dictionary.DatetimeValue","type.dictionary.DatetimeValueAsyncClient.get":"Type.Dictionary.DatetimeValue.get","type.dictionary.DatetimeValueAsyncClient.getWithResponse":"Type.Dictionary.DatetimeValue.get","type.dictionary.DatetimeValueAsyncClient.put":"Type.Dictionary.DatetimeValue.put","type.dictionary.DatetimeValueAsyncClient.putWithResponse":"Type.Dictionary.DatetimeValue.put","type.dictionary.DatetimeValueClient":"Type.Dictionary.DatetimeValue","type.dictionary.DatetimeValueClient.get":"Type.Dictionary.DatetimeValue.get","type.dictionary.DatetimeValueClient.getWithResponse":"Type.Dictionary.DatetimeValue.get","type.dictionary.DatetimeValueClient.put":"Type.Dictionary.DatetimeValue.put","type.dictionary.DatetimeValueClient.putWithResponse":"Type.Dictionary.DatetimeValue.put","type.dictionary.DictionaryClientBuilder":"Type.Dictionary","type.dictionary.DurationValueAsyncClient":"Type.Dictionary.DurationValue","type.dictionary.DurationValueAsyncClient.get":"Type.Dictionary.DurationValue.get","type.dictionary.DurationValueAsyncClient.getWithResponse":"Type.Dictionary.DurationValue.get","type.dictionary.DurationValueAsyncClient.put":"Type.Dictionary.DurationValue.put","type.dictionary.DurationValueAsyncClient.putWithResponse":"Type.Dictionary.DurationValue.put","type.dictionary.DurationValueClient":"Type.Dictionary.DurationValue","type.dictionary.DurationValueClient.get":"Type.Dictionary.DurationValue.get","type.dictionary.DurationValueClient.getWithResponse":"Type.Dictionary.DurationValue.get","type.dictionary.DurationValueClient.put":"Type.Dictionary.DurationValue.put","type.dictionary.DurationValueClient.putWithResponse":"Type.Dictionary.DurationValue.put","type.dictionary.Float32ValueAsyncClient":"Type.Dictionary.Float32Value","type.dictionary.Float32ValueAsyncClient.get":"Type.Dictionary.Float32Value.get","type.dictionary.Float32ValueAsyncClient.getWithResponse":"Type.Dictionary.Float32Value.get","type.dictionary.Float32ValueAsyncClient.put":"Type.Dictionary.Float32Value.put","type.dictionary.Float32ValueAsyncClient.putWithResponse":"Type.Dictionary.Float32Value.put","type.dictionary.Float32ValueClient":"Type.Dictionary.Float32Value","type.dictionary.Float32ValueClient.get":"Type.Dictionary.Float32Value.get","type.dictionary.Float32ValueClient.getWithResponse":"Type.Dictionary.Float32Value.get","type.dictionary.Float32ValueClient.put":"Type.Dictionary.Float32Value.put","type.dictionary.Float32ValueClient.putWithResponse":"Type.Dictionary.Float32Value.put","type.dictionary.Int32ValueAsyncClient":"Type.Dictionary.Int32Value","type.dictionary.Int32ValueAsyncClient.get":"Type.Dictionary.Int32Value.get","type.dictionary.Int32ValueAsyncClient.getWithResponse":"Type.Dictionary.Int32Value.get","type.dictionary.Int32ValueAsyncClient.put":"Type.Dictionary.Int32Value.put","type.dictionary.Int32ValueAsyncClient.putWithResponse":"Type.Dictionary.Int32Value.put","type.dictionary.Int32ValueClient":"Type.Dictionary.Int32Value","type.dictionary.Int32ValueClient.get":"Type.Dictionary.Int32Value.get","type.dictionary.Int32ValueClient.getWithResponse":"Type.Dictionary.Int32Value.get","type.dictionary.Int32ValueClient.put":"Type.Dictionary.Int32Value.put","type.dictionary.Int32ValueClient.putWithResponse":"Type.Dictionary.Int32Value.put","type.dictionary.Int64ValueAsyncClient":"Type.Dictionary.Int64Value","type.dictionary.Int64ValueAsyncClient.get":"Type.Dictionary.Int64Value.get","type.dictionary.Int64ValueAsyncClient.getWithResponse":"Type.Dictionary.Int64Value.get","type.dictionary.Int64ValueAsyncClient.put":"Type.Dictionary.Int64Value.put","type.dictionary.Int64ValueAsyncClient.putWithResponse":"Type.Dictionary.Int64Value.put","type.dictionary.Int64ValueClient":"Type.Dictionary.Int64Value","type.dictionary.Int64ValueClient.get":"Type.Dictionary.Int64Value.get","type.dictionary.Int64ValueClient.getWithResponse":"Type.Dictionary.Int64Value.get","type.dictionary.Int64ValueClient.put":"Type.Dictionary.Int64Value.put","type.dictionary.Int64ValueClient.putWithResponse":"Type.Dictionary.Int64Value.put","type.dictionary.ModelValueAsyncClient":"Type.Dictionary.ModelValue","type.dictionary.ModelValueAsyncClient.get":"Type.Dictionary.ModelValue.get","type.dictionary.ModelValueAsyncClient.getWithResponse":"Type.Dictionary.ModelValue.get","type.dictionary.ModelValueAsyncClient.put":"Type.Dictionary.ModelValue.put","type.dictionary.ModelValueAsyncClient.putWithResponse":"Type.Dictionary.ModelValue.put","type.dictionary.ModelValueClient":"Type.Dictionary.ModelValue","type.dictionary.ModelValueClient.get":"Type.Dictionary.ModelValue.get","type.dictionary.ModelValueClient.getWithResponse":"Type.Dictionary.ModelValue.get","type.dictionary.ModelValueClient.put":"Type.Dictionary.ModelValue.put","type.dictionary.ModelValueClient.putWithResponse":"Type.Dictionary.ModelValue.put","type.dictionary.NullableFloatValueAsyncClient":"Type.Dictionary.NullableFloatValue","type.dictionary.NullableFloatValueAsyncClient.get":"Type.Dictionary.NullableFloatValue.get","type.dictionary.NullableFloatValueAsyncClient.getWithResponse":"Type.Dictionary.NullableFloatValue.get","type.dictionary.NullableFloatValueAsyncClient.put":"Type.Dictionary.NullableFloatValue.put","type.dictionary.NullableFloatValueAsyncClient.putWithResponse":"Type.Dictionary.NullableFloatValue.put","type.dictionary.NullableFloatValueClient":"Type.Dictionary.NullableFloatValue","type.dictionary.NullableFloatValueClient.get":"Type.Dictionary.NullableFloatValue.get","type.dictionary.NullableFloatValueClient.getWithResponse":"Type.Dictionary.NullableFloatValue.get","type.dictionary.NullableFloatValueClient.put":"Type.Dictionary.NullableFloatValue.put","type.dictionary.NullableFloatValueClient.putWithResponse":"Type.Dictionary.NullableFloatValue.put","type.dictionary.RecursiveModelValueAsyncClient":"Type.Dictionary.RecursiveModelValue","type.dictionary.RecursiveModelValueAsyncClient.get":"Type.Dictionary.RecursiveModelValue.get","type.dictionary.RecursiveModelValueAsyncClient.getWithResponse":"Type.Dictionary.RecursiveModelValue.get","type.dictionary.RecursiveModelValueAsyncClient.put":"Type.Dictionary.RecursiveModelValue.put","type.dictionary.RecursiveModelValueAsyncClient.putWithResponse":"Type.Dictionary.RecursiveModelValue.put","type.dictionary.RecursiveModelValueClient":"Type.Dictionary.RecursiveModelValue","type.dictionary.RecursiveModelValueClient.get":"Type.Dictionary.RecursiveModelValue.get","type.dictionary.RecursiveModelValueClient.getWithResponse":"Type.Dictionary.RecursiveModelValue.get","type.dictionary.RecursiveModelValueClient.put":"Type.Dictionary.RecursiveModelValue.put","type.dictionary.RecursiveModelValueClient.putWithResponse":"Type.Dictionary.RecursiveModelValue.put","type.dictionary.StringValueAsyncClient":"Type.Dictionary.StringValue","type.dictionary.StringValueAsyncClient.get":"Type.Dictionary.StringValue.get","type.dictionary.StringValueAsyncClient.getWithResponse":"Type.Dictionary.StringValue.get","type.dictionary.StringValueAsyncClient.put":"Type.Dictionary.StringValue.put","type.dictionary.StringValueAsyncClient.putWithResponse":"Type.Dictionary.StringValue.put","type.dictionary.StringValueClient":"Type.Dictionary.StringValue","type.dictionary.StringValueClient.get":"Type.Dictionary.StringValue.get","type.dictionary.StringValueClient.getWithResponse":"Type.Dictionary.StringValue.get","type.dictionary.StringValueClient.put":"Type.Dictionary.StringValue.put","type.dictionary.StringValueClient.putWithResponse":"Type.Dictionary.StringValue.put","type.dictionary.UnknownValueAsyncClient":"Type.Dictionary.UnknownValue","type.dictionary.UnknownValueAsyncClient.get":"Type.Dictionary.UnknownValue.get","type.dictionary.UnknownValueAsyncClient.getWithResponse":"Type.Dictionary.UnknownValue.get","type.dictionary.UnknownValueAsyncClient.put":"Type.Dictionary.UnknownValue.put","type.dictionary.UnknownValueAsyncClient.putWithResponse":"Type.Dictionary.UnknownValue.put","type.dictionary.UnknownValueClient":"Type.Dictionary.UnknownValue","type.dictionary.UnknownValueClient.get":"Type.Dictionary.UnknownValue.get","type.dictionary.UnknownValueClient.getWithResponse":"Type.Dictionary.UnknownValue.get","type.dictionary.UnknownValueClient.put":"Type.Dictionary.UnknownValue.put","type.dictionary.UnknownValueClient.putWithResponse":"Type.Dictionary.UnknownValue.put","type.dictionary.models.InnerModel":"Type.Dictionary.InnerModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/dictionary/BooleanValueAsyncClient.java","src/main/java/type/dictionary/BooleanValueClient.java","src/main/java/type/dictionary/DatetimeValueAsyncClient.java","src/main/java/type/dictionary/DatetimeValueClient.java","src/main/java/type/dictionary/DictionaryClientBuilder.java","src/main/java/type/dictionary/DurationValueAsyncClient.java","src/main/java/type/dictionary/DurationValueClient.java","src/main/java/type/dictionary/Float32ValueAsyncClient.java","src/main/java/type/dictionary/Float32ValueClient.java","src/main/java/type/dictionary/Int32ValueAsyncClient.java","src/main/java/type/dictionary/Int32ValueClient.java","src/main/java/type/dictionary/Int64ValueAsyncClient.java","src/main/java/type/dictionary/Int64ValueClient.java","src/main/java/type/dictionary/ModelValueAsyncClient.java","src/main/java/type/dictionary/ModelValueClient.java","src/main/java/type/dictionary/NullableFloatValueAsyncClient.java","src/main/java/type/dictionary/NullableFloatValueClient.java","src/main/java/type/dictionary/RecursiveModelValueAsyncClient.java","src/main/java/type/dictionary/RecursiveModelValueClient.java","src/main/java/type/dictionary/StringValueAsyncClient.java","src/main/java/type/dictionary/StringValueClient.java","src/main/java/type/dictionary/UnknownValueAsyncClient.java","src/main/java/type/dictionary/UnknownValueClient.java","src/main/java/type/dictionary/implementation/BooleanValuesImpl.java","src/main/java/type/dictionary/implementation/DatetimeValuesImpl.java","src/main/java/type/dictionary/implementation/DictionaryClientImpl.java","src/main/java/type/dictionary/implementation/DurationValuesImpl.java","src/main/java/type/dictionary/implementation/Float32ValuesImpl.java","src/main/java/type/dictionary/implementation/Int32ValuesImpl.java","src/main/java/type/dictionary/implementation/Int64ValuesImpl.java","src/main/java/type/dictionary/implementation/ModelValuesImpl.java","src/main/java/type/dictionary/implementation/NullableFloatValuesImpl.java","src/main/java/type/dictionary/implementation/RecursiveModelValuesImpl.java","src/main/java/type/dictionary/implementation/StringValuesImpl.java","src/main/java/type/dictionary/implementation/UnknownValuesImpl.java","src/main/java/type/dictionary/implementation/package-info.java","src/main/java/type/dictionary/models/InnerModel.java","src/main/java/type/dictionary/models/package-info.java","src/main/java/type/dictionary/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_apiview_properties.json deleted file mode 100644 index 68ae6fa5542..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_apiview_properties.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.enums.extensible.ExtensibleAsyncClient": "Type.Enum.Extensible.String", - "type.enums.extensible.ExtensibleAsyncClient.getKnownValue": "Type.Enum.Extensible.String.getKnownValue", - "type.enums.extensible.ExtensibleAsyncClient.getKnownValueWithResponse": "Type.Enum.Extensible.String.getKnownValue", - "type.enums.extensible.ExtensibleAsyncClient.getUnknownValue": "Type.Enum.Extensible.String.getUnknownValue", - "type.enums.extensible.ExtensibleAsyncClient.getUnknownValueWithResponse": "Type.Enum.Extensible.String.getUnknownValue", - "type.enums.extensible.ExtensibleAsyncClient.putKnownValue": "Type.Enum.Extensible.String.putKnownValue", - "type.enums.extensible.ExtensibleAsyncClient.putKnownValueWithResponse": "Type.Enum.Extensible.String.putKnownValue", - "type.enums.extensible.ExtensibleAsyncClient.putUnknownValue": "Type.Enum.Extensible.String.putUnknownValue", - "type.enums.extensible.ExtensibleAsyncClient.putUnknownValueWithResponse": "Type.Enum.Extensible.String.putUnknownValue", - "type.enums.extensible.ExtensibleClient": "Type.Enum.Extensible.String", - "type.enums.extensible.ExtensibleClient.getKnownValue": "Type.Enum.Extensible.String.getKnownValue", - "type.enums.extensible.ExtensibleClient.getKnownValueWithResponse": "Type.Enum.Extensible.String.getKnownValue", - "type.enums.extensible.ExtensibleClient.getUnknownValue": "Type.Enum.Extensible.String.getUnknownValue", - "type.enums.extensible.ExtensibleClient.getUnknownValueWithResponse": "Type.Enum.Extensible.String.getUnknownValue", - "type.enums.extensible.ExtensibleClient.putKnownValue": "Type.Enum.Extensible.String.putKnownValue", - "type.enums.extensible.ExtensibleClient.putKnownValueWithResponse": "Type.Enum.Extensible.String.putKnownValue", - "type.enums.extensible.ExtensibleClient.putUnknownValue": "Type.Enum.Extensible.String.putUnknownValue", - "type.enums.extensible.ExtensibleClient.putUnknownValueWithResponse": "Type.Enum.Extensible.String.putUnknownValue", - "type.enums.extensible.ExtensibleClientBuilder": "Type.Enum.Extensible", - "type.enums.extensible.models.DaysOfWeekExtensibleEnum": "Type.Enum.Extensible.DaysOfWeekExtensibleEnum" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_metadata.json deleted file mode 100644 index 075d5fc74f9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.enums.extensible.ExtensibleAsyncClient":"Type.Enum.Extensible.String","type.enums.extensible.ExtensibleAsyncClient.getKnownValue":"Type.Enum.Extensible.String.getKnownValue","type.enums.extensible.ExtensibleAsyncClient.getKnownValueWithResponse":"Type.Enum.Extensible.String.getKnownValue","type.enums.extensible.ExtensibleAsyncClient.getUnknownValue":"Type.Enum.Extensible.String.getUnknownValue","type.enums.extensible.ExtensibleAsyncClient.getUnknownValueWithResponse":"Type.Enum.Extensible.String.getUnknownValue","type.enums.extensible.ExtensibleAsyncClient.putKnownValue":"Type.Enum.Extensible.String.putKnownValue","type.enums.extensible.ExtensibleAsyncClient.putKnownValueWithResponse":"Type.Enum.Extensible.String.putKnownValue","type.enums.extensible.ExtensibleAsyncClient.putUnknownValue":"Type.Enum.Extensible.String.putUnknownValue","type.enums.extensible.ExtensibleAsyncClient.putUnknownValueWithResponse":"Type.Enum.Extensible.String.putUnknownValue","type.enums.extensible.ExtensibleClient":"Type.Enum.Extensible.String","type.enums.extensible.ExtensibleClient.getKnownValue":"Type.Enum.Extensible.String.getKnownValue","type.enums.extensible.ExtensibleClient.getKnownValueWithResponse":"Type.Enum.Extensible.String.getKnownValue","type.enums.extensible.ExtensibleClient.getUnknownValue":"Type.Enum.Extensible.String.getUnknownValue","type.enums.extensible.ExtensibleClient.getUnknownValueWithResponse":"Type.Enum.Extensible.String.getUnknownValue","type.enums.extensible.ExtensibleClient.putKnownValue":"Type.Enum.Extensible.String.putKnownValue","type.enums.extensible.ExtensibleClient.putKnownValueWithResponse":"Type.Enum.Extensible.String.putKnownValue","type.enums.extensible.ExtensibleClient.putUnknownValue":"Type.Enum.Extensible.String.putUnknownValue","type.enums.extensible.ExtensibleClient.putUnknownValueWithResponse":"Type.Enum.Extensible.String.putUnknownValue","type.enums.extensible.ExtensibleClientBuilder":"Type.Enum.Extensible","type.enums.extensible.models.DaysOfWeekExtensibleEnum":"Type.Enum.Extensible.DaysOfWeekExtensibleEnum"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/enums/extensible/ExtensibleAsyncClient.java","src/main/java/type/enums/extensible/ExtensibleClient.java","src/main/java/type/enums/extensible/ExtensibleClientBuilder.java","src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java","src/main/java/type/enums/extensible/implementation/StringOperationsImpl.java","src/main/java/type/enums/extensible/implementation/package-info.java","src/main/java/type/enums/extensible/models/DaysOfWeekExtensibleEnum.java","src/main/java/type/enums/extensible/models/package-info.java","src/main/java/type/enums/extensible/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_apiview_properties.json deleted file mode 100644 index 1db0b5526e2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_apiview_properties.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.enums.fixed.FixedAsyncClient": "Type.Enum.Fixed.String", - "type.enums.fixed.FixedAsyncClient.getKnownValue": "Type.Enum.Fixed.String.getKnownValue", - "type.enums.fixed.FixedAsyncClient.getKnownValueWithResponse": "Type.Enum.Fixed.String.getKnownValue", - "type.enums.fixed.FixedAsyncClient.putKnownValue": "Type.Enum.Fixed.String.putKnownValue", - "type.enums.fixed.FixedAsyncClient.putKnownValueWithResponse": "Type.Enum.Fixed.String.putKnownValue", - "type.enums.fixed.FixedAsyncClient.putUnknownValue": "Type.Enum.Fixed.String.putUnknownValue", - "type.enums.fixed.FixedAsyncClient.putUnknownValueWithResponse": "Type.Enum.Fixed.String.putUnknownValue", - "type.enums.fixed.FixedClient": "Type.Enum.Fixed.String", - "type.enums.fixed.FixedClient.getKnownValue": "Type.Enum.Fixed.String.getKnownValue", - "type.enums.fixed.FixedClient.getKnownValueWithResponse": "Type.Enum.Fixed.String.getKnownValue", - "type.enums.fixed.FixedClient.putKnownValue": "Type.Enum.Fixed.String.putKnownValue", - "type.enums.fixed.FixedClient.putKnownValueWithResponse": "Type.Enum.Fixed.String.putKnownValue", - "type.enums.fixed.FixedClient.putUnknownValue": "Type.Enum.Fixed.String.putUnknownValue", - "type.enums.fixed.FixedClient.putUnknownValueWithResponse": "Type.Enum.Fixed.String.putUnknownValue", - "type.enums.fixed.FixedClientBuilder": "Type.Enum.Fixed", - "type.enums.fixed.models.DaysOfWeekEnum": "Type.Enum.Fixed.DaysOfWeekEnum" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_metadata.json deleted file mode 100644 index 7ac8ef536fd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.enums.fixed.FixedAsyncClient":"Type.Enum.Fixed.String","type.enums.fixed.FixedAsyncClient.getKnownValue":"Type.Enum.Fixed.String.getKnownValue","type.enums.fixed.FixedAsyncClient.getKnownValueWithResponse":"Type.Enum.Fixed.String.getKnownValue","type.enums.fixed.FixedAsyncClient.putKnownValue":"Type.Enum.Fixed.String.putKnownValue","type.enums.fixed.FixedAsyncClient.putKnownValueWithResponse":"Type.Enum.Fixed.String.putKnownValue","type.enums.fixed.FixedAsyncClient.putUnknownValue":"Type.Enum.Fixed.String.putUnknownValue","type.enums.fixed.FixedAsyncClient.putUnknownValueWithResponse":"Type.Enum.Fixed.String.putUnknownValue","type.enums.fixed.FixedClient":"Type.Enum.Fixed.String","type.enums.fixed.FixedClient.getKnownValue":"Type.Enum.Fixed.String.getKnownValue","type.enums.fixed.FixedClient.getKnownValueWithResponse":"Type.Enum.Fixed.String.getKnownValue","type.enums.fixed.FixedClient.putKnownValue":"Type.Enum.Fixed.String.putKnownValue","type.enums.fixed.FixedClient.putKnownValueWithResponse":"Type.Enum.Fixed.String.putKnownValue","type.enums.fixed.FixedClient.putUnknownValue":"Type.Enum.Fixed.String.putUnknownValue","type.enums.fixed.FixedClient.putUnknownValueWithResponse":"Type.Enum.Fixed.String.putUnknownValue","type.enums.fixed.FixedClientBuilder":"Type.Enum.Fixed","type.enums.fixed.models.DaysOfWeekEnum":"Type.Enum.Fixed.DaysOfWeekEnum"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/enums/fixed/FixedAsyncClient.java","src/main/java/type/enums/fixed/FixedClient.java","src/main/java/type/enums/fixed/FixedClientBuilder.java","src/main/java/type/enums/fixed/implementation/FixedClientImpl.java","src/main/java/type/enums/fixed/implementation/StringOperationsImpl.java","src/main/java/type/enums/fixed/implementation/package-info.java","src/main/java/type/enums/fixed/models/DaysOfWeekEnum.java","src/main/java/type/enums/fixed/models/package-info.java","src/main/java/type/enums/fixed/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_apiview_properties.json deleted file mode 100644 index 23111e92cea..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_apiview_properties.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.model.empty.EmptyAsyncClient": "Type.Model.Empty", - "type.model.empty.EmptyAsyncClient.getEmpty": "Type.Model.Empty.getEmpty", - "type.model.empty.EmptyAsyncClient.getEmptyWithResponse": "Type.Model.Empty.getEmpty", - "type.model.empty.EmptyAsyncClient.postRoundTripEmpty": "Type.Model.Empty.postRoundTripEmpty", - "type.model.empty.EmptyAsyncClient.postRoundTripEmptyWithResponse": "Type.Model.Empty.postRoundTripEmpty", - "type.model.empty.EmptyAsyncClient.putEmpty": "Type.Model.Empty.putEmpty", - "type.model.empty.EmptyAsyncClient.putEmptyWithResponse": "Type.Model.Empty.putEmpty", - "type.model.empty.EmptyClient": "Type.Model.Empty", - "type.model.empty.EmptyClient.getEmpty": "Type.Model.Empty.getEmpty", - "type.model.empty.EmptyClient.getEmptyWithResponse": "Type.Model.Empty.getEmpty", - "type.model.empty.EmptyClient.postRoundTripEmpty": "Type.Model.Empty.postRoundTripEmpty", - "type.model.empty.EmptyClient.postRoundTripEmptyWithResponse": "Type.Model.Empty.postRoundTripEmpty", - "type.model.empty.EmptyClient.putEmpty": "Type.Model.Empty.putEmpty", - "type.model.empty.EmptyClient.putEmptyWithResponse": "Type.Model.Empty.putEmpty", - "type.model.empty.EmptyClientBuilder": "Type.Model.Empty", - "type.model.empty.models.EmptyInput": "Type.Model.Empty.EmptyInput", - "type.model.empty.models.EmptyInputOutput": "Type.Model.Empty.EmptyInputOutput", - "type.model.empty.models.EmptyOutput": "Type.Model.Empty.EmptyOutput" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_metadata.json deleted file mode 100644 index 155723389ed..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.model.empty.EmptyAsyncClient":"Type.Model.Empty","type.model.empty.EmptyAsyncClient.getEmpty":"Type.Model.Empty.getEmpty","type.model.empty.EmptyAsyncClient.getEmptyWithResponse":"Type.Model.Empty.getEmpty","type.model.empty.EmptyAsyncClient.postRoundTripEmpty":"Type.Model.Empty.postRoundTripEmpty","type.model.empty.EmptyAsyncClient.postRoundTripEmptyWithResponse":"Type.Model.Empty.postRoundTripEmpty","type.model.empty.EmptyAsyncClient.putEmpty":"Type.Model.Empty.putEmpty","type.model.empty.EmptyAsyncClient.putEmptyWithResponse":"Type.Model.Empty.putEmpty","type.model.empty.EmptyClient":"Type.Model.Empty","type.model.empty.EmptyClient.getEmpty":"Type.Model.Empty.getEmpty","type.model.empty.EmptyClient.getEmptyWithResponse":"Type.Model.Empty.getEmpty","type.model.empty.EmptyClient.postRoundTripEmpty":"Type.Model.Empty.postRoundTripEmpty","type.model.empty.EmptyClient.postRoundTripEmptyWithResponse":"Type.Model.Empty.postRoundTripEmpty","type.model.empty.EmptyClient.putEmpty":"Type.Model.Empty.putEmpty","type.model.empty.EmptyClient.putEmptyWithResponse":"Type.Model.Empty.putEmpty","type.model.empty.EmptyClientBuilder":"Type.Model.Empty","type.model.empty.models.EmptyInput":"Type.Model.Empty.EmptyInput","type.model.empty.models.EmptyInputOutput":"Type.Model.Empty.EmptyInputOutput","type.model.empty.models.EmptyOutput":"Type.Model.Empty.EmptyOutput"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/empty/EmptyAsyncClient.java","src/main/java/type/model/empty/EmptyClient.java","src/main/java/type/model/empty/EmptyClientBuilder.java","src/main/java/type/model/empty/implementation/EmptyClientImpl.java","src/main/java/type/model/empty/implementation/package-info.java","src/main/java/type/model/empty/models/EmptyInput.java","src/main/java/type/model/empty/models/EmptyInputOutput.java","src/main/java/type/model/empty/models/EmptyOutput.java","src/main/java/type/model/empty/models/package-info.java","src/main/java/type/model/empty/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_apiview_properties.json deleted file mode 100644 index a2ac2ec8474..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_apiview_properties.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient": "Type.Model.Inheritance.EnumDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModel": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelMissingDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelMissingDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelWrongDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelWrongDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModel": "Type.Model.Inheritance.EnumDiscriminator.getFixedModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelMissingDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelMissingDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getFixedModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelWrongDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelWrongDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putExtensibleModel": "Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putExtensibleModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putFixedModel": "Type.Model.Inheritance.EnumDiscriminator.putFixedModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putFixedModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.putFixedModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient": "Type.Model.Inheritance.EnumDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModel": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelMissingDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelMissingDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelWrongDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelWrongDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModel": "Type.Model.Inheritance.EnumDiscriminator.getFixedModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelMissingDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelMissingDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getFixedModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelWrongDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelWrongDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putExtensibleModel": "Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putExtensibleModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putFixedModel": "Type.Model.Inheritance.EnumDiscriminator.putFixedModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putFixedModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.putFixedModel", - "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClientBuilder": "Type.Model.Inheritance.EnumDiscriminator", - "type.model.inheritance.enumdiscriminator.models.Cobra": "Type.Model.Inheritance.EnumDiscriminator.Cobra", - "type.model.inheritance.enumdiscriminator.models.Dog": "Type.Model.Inheritance.EnumDiscriminator.Dog", - "type.model.inheritance.enumdiscriminator.models.DogKind": "Type.Model.Inheritance.EnumDiscriminator.DogKind", - "type.model.inheritance.enumdiscriminator.models.Golden": "Type.Model.Inheritance.EnumDiscriminator.Golden", - "type.model.inheritance.enumdiscriminator.models.Snake": "Type.Model.Inheritance.EnumDiscriminator.Snake", - "type.model.inheritance.enumdiscriminator.models.SnakeKind": "Type.Model.Inheritance.EnumDiscriminator.SnakeKind" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_metadata.json deleted file mode 100644 index 5720ee41028..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient":"Type.Model.Inheritance.EnumDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModel":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelMissingDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelMissingDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelWrongDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelWrongDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModel":"Type.Model.Inheritance.EnumDiscriminator.getFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelMissingDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelMissingDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelWrongDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelWrongDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putExtensibleModel":"Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putExtensibleModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putFixedModel":"Type.Model.Inheritance.EnumDiscriminator.putFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putFixedModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.putFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient":"Type.Model.Inheritance.EnumDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModel":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelMissingDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelMissingDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelWrongDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelWrongDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModel":"Type.Model.Inheritance.EnumDiscriminator.getFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelMissingDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelMissingDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelWrongDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelWrongDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putExtensibleModel":"Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putExtensibleModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putFixedModel":"Type.Model.Inheritance.EnumDiscriminator.putFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putFixedModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.putFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClientBuilder":"Type.Model.Inheritance.EnumDiscriminator","type.model.inheritance.enumdiscriminator.models.Cobra":"Type.Model.Inheritance.EnumDiscriminator.Cobra","type.model.inheritance.enumdiscriminator.models.Dog":"Type.Model.Inheritance.EnumDiscriminator.Dog","type.model.inheritance.enumdiscriminator.models.DogKind":"Type.Model.Inheritance.EnumDiscriminator.DogKind","type.model.inheritance.enumdiscriminator.models.Golden":"Type.Model.Inheritance.EnumDiscriminator.Golden","type.model.inheritance.enumdiscriminator.models.Snake":"Type.Model.Inheritance.EnumDiscriminator.Snake","type.model.inheritance.enumdiscriminator.models.SnakeKind":"Type.Model.Inheritance.EnumDiscriminator.SnakeKind"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorAsyncClient.java","src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClient.java","src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClientBuilder.java","src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java","src/main/java/type/model/inheritance/enumdiscriminator/implementation/package-info.java","src/main/java/type/model/inheritance/enumdiscriminator/models/Cobra.java","src/main/java/type/model/inheritance/enumdiscriminator/models/Dog.java","src/main/java/type/model/inheritance/enumdiscriminator/models/DogKind.java","src/main/java/type/model/inheritance/enumdiscriminator/models/Golden.java","src/main/java/type/model/inheritance/enumdiscriminator/models/Snake.java","src/main/java/type/model/inheritance/enumdiscriminator/models/SnakeKind.java","src/main/java/type/model/inheritance/enumdiscriminator/models/package-info.java","src/main/java/type/model/inheritance/enumdiscriminator/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_apiview_properties.json deleted file mode 100644 index 16c4638dfda..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_apiview_properties.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient": "Type.Model.Inheritance.NestedDiscriminator", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getMissingDiscriminator": "Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getMissingDiscriminatorWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getModel": "Type.Model.Inheritance.NestedDiscriminator.getModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getRecursiveModel": "Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getRecursiveModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getWrongDiscriminator": "Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getWrongDiscriminatorWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putModel": "Type.Model.Inheritance.NestedDiscriminator.putModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.putModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putRecursiveModel": "Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putRecursiveModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient": "Type.Model.Inheritance.NestedDiscriminator", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getMissingDiscriminator": "Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getMissingDiscriminatorWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getModel": "Type.Model.Inheritance.NestedDiscriminator.getModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getRecursiveModel": "Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getRecursiveModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getWrongDiscriminator": "Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getWrongDiscriminatorWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putModel": "Type.Model.Inheritance.NestedDiscriminator.putModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.putModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putRecursiveModel": "Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putRecursiveModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel", - "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClientBuilder": "Type.Model.Inheritance.NestedDiscriminator", - "type.model.inheritance.nesteddiscriminator.models.Fish": "Type.Model.Inheritance.NestedDiscriminator.Fish", - "type.model.inheritance.nesteddiscriminator.models.GoblinShark": "Type.Model.Inheritance.NestedDiscriminator.GoblinShark", - "type.model.inheritance.nesteddiscriminator.models.Salmon": "Type.Model.Inheritance.NestedDiscriminator.Salmon", - "type.model.inheritance.nesteddiscriminator.models.SawShark": "Type.Model.Inheritance.NestedDiscriminator.SawShark", - "type.model.inheritance.nesteddiscriminator.models.Shark": "Type.Model.Inheritance.NestedDiscriminator.Shark" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_metadata.json deleted file mode 100644 index 6ce5aa5e40a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient":"Type.Model.Inheritance.NestedDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getMissingDiscriminator":"Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getMissingDiscriminatorWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getModel":"Type.Model.Inheritance.NestedDiscriminator.getModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getRecursiveModel":"Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getRecursiveModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getWrongDiscriminator":"Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getWrongDiscriminatorWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putModel":"Type.Model.Inheritance.NestedDiscriminator.putModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.putModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putRecursiveModel":"Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putRecursiveModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient":"Type.Model.Inheritance.NestedDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getMissingDiscriminator":"Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getMissingDiscriminatorWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getModel":"Type.Model.Inheritance.NestedDiscriminator.getModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getRecursiveModel":"Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getRecursiveModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getWrongDiscriminator":"Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getWrongDiscriminatorWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putModel":"Type.Model.Inheritance.NestedDiscriminator.putModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.putModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putRecursiveModel":"Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putRecursiveModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClientBuilder":"Type.Model.Inheritance.NestedDiscriminator","type.model.inheritance.nesteddiscriminator.models.Fish":"Type.Model.Inheritance.NestedDiscriminator.Fish","type.model.inheritance.nesteddiscriminator.models.GoblinShark":"Type.Model.Inheritance.NestedDiscriminator.GoblinShark","type.model.inheritance.nesteddiscriminator.models.Salmon":"Type.Model.Inheritance.NestedDiscriminator.Salmon","type.model.inheritance.nesteddiscriminator.models.SawShark":"Type.Model.Inheritance.NestedDiscriminator.SawShark","type.model.inheritance.nesteddiscriminator.models.Shark":"Type.Model.Inheritance.NestedDiscriminator.Shark"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorAsyncClient.java","src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClient.java","src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClientBuilder.java","src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java","src/main/java/type/model/inheritance/nesteddiscriminator/implementation/package-info.java","src/main/java/type/model/inheritance/nesteddiscriminator/models/Fish.java","src/main/java/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java","src/main/java/type/model/inheritance/nesteddiscriminator/models/Salmon.java","src/main/java/type/model/inheritance/nesteddiscriminator/models/SawShark.java","src/main/java/type/model/inheritance/nesteddiscriminator/models/Shark.java","src/main/java/type/model/inheritance/nesteddiscriminator/models/package-info.java","src/main/java/type/model/inheritance/nesteddiscriminator/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_apiview_properties.json deleted file mode 100644 index c46978d245b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_apiview_properties.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient": "Type.Model.Inheritance.NotDiscriminated", - "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.getValid": "Type.Model.Inheritance.NotDiscriminated.getValid", - "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.getValidWithResponse": "Type.Model.Inheritance.NotDiscriminated.getValid", - "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.postValid": "Type.Model.Inheritance.NotDiscriminated.postValid", - "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.postValidWithResponse": "Type.Model.Inheritance.NotDiscriminated.postValid", - "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.putValid": "Type.Model.Inheritance.NotDiscriminated.putValid", - "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.putValidWithResponse": "Type.Model.Inheritance.NotDiscriminated.putValid", - "type.model.inheritance.notdiscriminated.NotDiscriminatedClient": "Type.Model.Inheritance.NotDiscriminated", - "type.model.inheritance.notdiscriminated.NotDiscriminatedClient.getValid": "Type.Model.Inheritance.NotDiscriminated.getValid", - "type.model.inheritance.notdiscriminated.NotDiscriminatedClient.getValidWithResponse": "Type.Model.Inheritance.NotDiscriminated.getValid", - "type.model.inheritance.notdiscriminated.NotDiscriminatedClient.postValid": "Type.Model.Inheritance.NotDiscriminated.postValid", - "type.model.inheritance.notdiscriminated.NotDiscriminatedClient.postValidWithResponse": "Type.Model.Inheritance.NotDiscriminated.postValid", - "type.model.inheritance.notdiscriminated.NotDiscriminatedClient.putValid": "Type.Model.Inheritance.NotDiscriminated.putValid", - "type.model.inheritance.notdiscriminated.NotDiscriminatedClient.putValidWithResponse": "Type.Model.Inheritance.NotDiscriminated.putValid", - "type.model.inheritance.notdiscriminated.NotDiscriminatedClientBuilder": "Type.Model.Inheritance.NotDiscriminated", - "type.model.inheritance.notdiscriminated.models.Cat": "Type.Model.Inheritance.NotDiscriminated.Cat", - "type.model.inheritance.notdiscriminated.models.Pet": "Type.Model.Inheritance.NotDiscriminated.Pet", - "type.model.inheritance.notdiscriminated.models.Siamese": "Type.Model.Inheritance.NotDiscriminated.Siamese" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_metadata.json deleted file mode 100644 index 2d2dd758f5c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient":"Type.Model.Inheritance.NotDiscriminated","type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.getValid":"Type.Model.Inheritance.NotDiscriminated.getValid","type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.getValidWithResponse":"Type.Model.Inheritance.NotDiscriminated.getValid","type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.postValid":"Type.Model.Inheritance.NotDiscriminated.postValid","type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.postValidWithResponse":"Type.Model.Inheritance.NotDiscriminated.postValid","type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.putValid":"Type.Model.Inheritance.NotDiscriminated.putValid","type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.putValidWithResponse":"Type.Model.Inheritance.NotDiscriminated.putValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClient":"Type.Model.Inheritance.NotDiscriminated","type.model.inheritance.notdiscriminated.NotDiscriminatedClient.getValid":"Type.Model.Inheritance.NotDiscriminated.getValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClient.getValidWithResponse":"Type.Model.Inheritance.NotDiscriminated.getValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClient.postValid":"Type.Model.Inheritance.NotDiscriminated.postValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClient.postValidWithResponse":"Type.Model.Inheritance.NotDiscriminated.postValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClient.putValid":"Type.Model.Inheritance.NotDiscriminated.putValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClient.putValidWithResponse":"Type.Model.Inheritance.NotDiscriminated.putValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClientBuilder":"Type.Model.Inheritance.NotDiscriminated","type.model.inheritance.notdiscriminated.models.Cat":"Type.Model.Inheritance.NotDiscriminated.Cat","type.model.inheritance.notdiscriminated.models.Pet":"Type.Model.Inheritance.NotDiscriminated.Pet","type.model.inheritance.notdiscriminated.models.Siamese":"Type.Model.Inheritance.NotDiscriminated.Siamese"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedAsyncClient.java","src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClient.java","src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClientBuilder.java","src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java","src/main/java/type/model/inheritance/notdiscriminated/implementation/package-info.java","src/main/java/type/model/inheritance/notdiscriminated/models/Cat.java","src/main/java/type/model/inheritance/notdiscriminated/models/Pet.java","src/main/java/type/model/inheritance/notdiscriminated/models/Siamese.java","src/main/java/type/model/inheritance/notdiscriminated/models/package-info.java","src/main/java/type/model/inheritance/notdiscriminated/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_apiview_properties.json deleted file mode 100644 index 3aa7ccfa566..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_apiview_properties.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.model.inheritance.recursive.RecursiveAsyncClient": "Type.Model.Inheritance.Recursive", - "type.model.inheritance.recursive.RecursiveAsyncClient.get": "Type.Model.Inheritance.Recursive.get", - "type.model.inheritance.recursive.RecursiveAsyncClient.getWithResponse": "Type.Model.Inheritance.Recursive.get", - "type.model.inheritance.recursive.RecursiveAsyncClient.put": "Type.Model.Inheritance.Recursive.put", - "type.model.inheritance.recursive.RecursiveAsyncClient.putWithResponse": "Type.Model.Inheritance.Recursive.put", - "type.model.inheritance.recursive.RecursiveClient": "Type.Model.Inheritance.Recursive", - "type.model.inheritance.recursive.RecursiveClient.get": "Type.Model.Inheritance.Recursive.get", - "type.model.inheritance.recursive.RecursiveClient.getWithResponse": "Type.Model.Inheritance.Recursive.get", - "type.model.inheritance.recursive.RecursiveClient.put": "Type.Model.Inheritance.Recursive.put", - "type.model.inheritance.recursive.RecursiveClient.putWithResponse": "Type.Model.Inheritance.Recursive.put", - "type.model.inheritance.recursive.RecursiveClientBuilder": "Type.Model.Inheritance.Recursive", - "type.model.inheritance.recursive.models.Element": "Type.Model.Inheritance.Recursive.Element", - "type.model.inheritance.recursive.models.Extension": "Type.Model.Inheritance.Recursive.Extension" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_metadata.json deleted file mode 100644 index d7a2cbc5660..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.model.inheritance.recursive.RecursiveAsyncClient":"Type.Model.Inheritance.Recursive","type.model.inheritance.recursive.RecursiveAsyncClient.get":"Type.Model.Inheritance.Recursive.get","type.model.inheritance.recursive.RecursiveAsyncClient.getWithResponse":"Type.Model.Inheritance.Recursive.get","type.model.inheritance.recursive.RecursiveAsyncClient.put":"Type.Model.Inheritance.Recursive.put","type.model.inheritance.recursive.RecursiveAsyncClient.putWithResponse":"Type.Model.Inheritance.Recursive.put","type.model.inheritance.recursive.RecursiveClient":"Type.Model.Inheritance.Recursive","type.model.inheritance.recursive.RecursiveClient.get":"Type.Model.Inheritance.Recursive.get","type.model.inheritance.recursive.RecursiveClient.getWithResponse":"Type.Model.Inheritance.Recursive.get","type.model.inheritance.recursive.RecursiveClient.put":"Type.Model.Inheritance.Recursive.put","type.model.inheritance.recursive.RecursiveClient.putWithResponse":"Type.Model.Inheritance.Recursive.put","type.model.inheritance.recursive.RecursiveClientBuilder":"Type.Model.Inheritance.Recursive","type.model.inheritance.recursive.models.Element":"Type.Model.Inheritance.Recursive.Element","type.model.inheritance.recursive.models.Extension":"Type.Model.Inheritance.Recursive.Extension"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/inheritance/recursive/RecursiveAsyncClient.java","src/main/java/type/model/inheritance/recursive/RecursiveClient.java","src/main/java/type/model/inheritance/recursive/RecursiveClientBuilder.java","src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java","src/main/java/type/model/inheritance/recursive/implementation/package-info.java","src/main/java/type/model/inheritance/recursive/models/Element.java","src/main/java/type/model/inheritance/recursive/models/Extension.java","src/main/java/type/model/inheritance/recursive/models/package-info.java","src/main/java/type/model/inheritance/recursive/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_apiview_properties.json deleted file mode 100644 index f4ba5935669..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_apiview_properties.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient": "Type.Model.Inheritance.SingleDiscriminator", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getLegacyModel": "Type.Model.Inheritance.SingleDiscriminator.getLegacyModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getLegacyModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getLegacyModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getMissingDiscriminator": "Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getMissingDiscriminatorWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getModel": "Type.Model.Inheritance.SingleDiscriminator.getModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getRecursiveModel": "Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getRecursiveModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getWrongDiscriminator": "Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getWrongDiscriminatorWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putModel": "Type.Model.Inheritance.SingleDiscriminator.putModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.putModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putRecursiveModel": "Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putRecursiveModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient": "Type.Model.Inheritance.SingleDiscriminator", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getLegacyModel": "Type.Model.Inheritance.SingleDiscriminator.getLegacyModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getLegacyModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getLegacyModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getMissingDiscriminator": "Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getMissingDiscriminatorWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getModel": "Type.Model.Inheritance.SingleDiscriminator.getModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getRecursiveModel": "Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getRecursiveModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getWrongDiscriminator": "Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getWrongDiscriminatorWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putModel": "Type.Model.Inheritance.SingleDiscriminator.putModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.putModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putRecursiveModel": "Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putRecursiveModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel", - "type.model.inheritance.singlediscriminator.SingleDiscriminatorClientBuilder": "Type.Model.Inheritance.SingleDiscriminator", - "type.model.inheritance.singlediscriminator.models.Bird": "Type.Model.Inheritance.SingleDiscriminator.Bird", - "type.model.inheritance.singlediscriminator.models.Dinosaur": "Type.Model.Inheritance.SingleDiscriminator.Dinosaur", - "type.model.inheritance.singlediscriminator.models.Eagle": "Type.Model.Inheritance.SingleDiscriminator.Eagle", - "type.model.inheritance.singlediscriminator.models.Goose": "Type.Model.Inheritance.SingleDiscriminator.Goose", - "type.model.inheritance.singlediscriminator.models.SeaGull": "Type.Model.Inheritance.SingleDiscriminator.SeaGull", - "type.model.inheritance.singlediscriminator.models.Sparrow": "Type.Model.Inheritance.SingleDiscriminator.Sparrow", - "type.model.inheritance.singlediscriminator.models.TRex": "Type.Model.Inheritance.SingleDiscriminator.TRex" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_metadata.json deleted file mode 100644 index b3d3a183378..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient":"Type.Model.Inheritance.SingleDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getLegacyModel":"Type.Model.Inheritance.SingleDiscriminator.getLegacyModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getLegacyModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getLegacyModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getMissingDiscriminator":"Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getMissingDiscriminatorWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getModel":"Type.Model.Inheritance.SingleDiscriminator.getModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getRecursiveModel":"Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getRecursiveModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getWrongDiscriminator":"Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getWrongDiscriminatorWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putModel":"Type.Model.Inheritance.SingleDiscriminator.putModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.putModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putRecursiveModel":"Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putRecursiveModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient":"Type.Model.Inheritance.SingleDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getLegacyModel":"Type.Model.Inheritance.SingleDiscriminator.getLegacyModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getLegacyModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getLegacyModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getMissingDiscriminator":"Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getMissingDiscriminatorWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getModel":"Type.Model.Inheritance.SingleDiscriminator.getModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getRecursiveModel":"Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getRecursiveModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getWrongDiscriminator":"Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getWrongDiscriminatorWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putModel":"Type.Model.Inheritance.SingleDiscriminator.putModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.putModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putRecursiveModel":"Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putRecursiveModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClientBuilder":"Type.Model.Inheritance.SingleDiscriminator","type.model.inheritance.singlediscriminator.models.Bird":"Type.Model.Inheritance.SingleDiscriminator.Bird","type.model.inheritance.singlediscriminator.models.Dinosaur":"Type.Model.Inheritance.SingleDiscriminator.Dinosaur","type.model.inheritance.singlediscriminator.models.Eagle":"Type.Model.Inheritance.SingleDiscriminator.Eagle","type.model.inheritance.singlediscriminator.models.Goose":"Type.Model.Inheritance.SingleDiscriminator.Goose","type.model.inheritance.singlediscriminator.models.SeaGull":"Type.Model.Inheritance.SingleDiscriminator.SeaGull","type.model.inheritance.singlediscriminator.models.Sparrow":"Type.Model.Inheritance.SingleDiscriminator.Sparrow","type.model.inheritance.singlediscriminator.models.TRex":"Type.Model.Inheritance.SingleDiscriminator.TRex"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorAsyncClient.java","src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClient.java","src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClientBuilder.java","src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java","src/main/java/type/model/inheritance/singlediscriminator/implementation/package-info.java","src/main/java/type/model/inheritance/singlediscriminator/models/Bird.java","src/main/java/type/model/inheritance/singlediscriminator/models/Dinosaur.java","src/main/java/type/model/inheritance/singlediscriminator/models/Eagle.java","src/main/java/type/model/inheritance/singlediscriminator/models/Goose.java","src/main/java/type/model/inheritance/singlediscriminator/models/SeaGull.java","src/main/java/type/model/inheritance/singlediscriminator/models/Sparrow.java","src/main/java/type/model/inheritance/singlediscriminator/models/TRex.java","src/main/java/type/model/inheritance/singlediscriminator/models/package-info.java","src/main/java/type/model/inheritance/singlediscriminator/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_apiview_properties.json deleted file mode 100644 index f61716112e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_apiview_properties.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.model.usage.UsageAsyncClient": "Type.Model.Usage", - "type.model.usage.UsageAsyncClient.input": "Type.Model.Usage.input", - "type.model.usage.UsageAsyncClient.inputAndOutput": "Type.Model.Usage.inputAndOutput", - "type.model.usage.UsageAsyncClient.inputAndOutputWithResponse": "Type.Model.Usage.inputAndOutput", - "type.model.usage.UsageAsyncClient.inputWithResponse": "Type.Model.Usage.input", - "type.model.usage.UsageAsyncClient.output": "Type.Model.Usage.output", - "type.model.usage.UsageAsyncClient.outputWithResponse": "Type.Model.Usage.output", - "type.model.usage.UsageClient": "Type.Model.Usage", - "type.model.usage.UsageClient.input": "Type.Model.Usage.input", - "type.model.usage.UsageClient.inputAndOutput": "Type.Model.Usage.inputAndOutput", - "type.model.usage.UsageClient.inputAndOutputWithResponse": "Type.Model.Usage.inputAndOutput", - "type.model.usage.UsageClient.inputWithResponse": "Type.Model.Usage.input", - "type.model.usage.UsageClient.output": "Type.Model.Usage.output", - "type.model.usage.UsageClient.outputWithResponse": "Type.Model.Usage.output", - "type.model.usage.UsageClientBuilder": "Type.Model.Usage", - "type.model.usage.models.InputOutputRecord": "Type.Model.Usage.InputOutputRecord", - "type.model.usage.models.InputRecord": "Type.Model.Usage.InputRecord", - "type.model.usage.models.OutputRecord": "Type.Model.Usage.OutputRecord" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_metadata.json deleted file mode 100644 index fd6f78b5843..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.model.usage.UsageAsyncClient":"Type.Model.Usage","type.model.usage.UsageAsyncClient.input":"Type.Model.Usage.input","type.model.usage.UsageAsyncClient.inputAndOutput":"Type.Model.Usage.inputAndOutput","type.model.usage.UsageAsyncClient.inputAndOutputWithResponse":"Type.Model.Usage.inputAndOutput","type.model.usage.UsageAsyncClient.inputWithResponse":"Type.Model.Usage.input","type.model.usage.UsageAsyncClient.output":"Type.Model.Usage.output","type.model.usage.UsageAsyncClient.outputWithResponse":"Type.Model.Usage.output","type.model.usage.UsageClient":"Type.Model.Usage","type.model.usage.UsageClient.input":"Type.Model.Usage.input","type.model.usage.UsageClient.inputAndOutput":"Type.Model.Usage.inputAndOutput","type.model.usage.UsageClient.inputAndOutputWithResponse":"Type.Model.Usage.inputAndOutput","type.model.usage.UsageClient.inputWithResponse":"Type.Model.Usage.input","type.model.usage.UsageClient.output":"Type.Model.Usage.output","type.model.usage.UsageClient.outputWithResponse":"Type.Model.Usage.output","type.model.usage.UsageClientBuilder":"Type.Model.Usage","type.model.usage.models.InputOutputRecord":"Type.Model.Usage.InputOutputRecord","type.model.usage.models.InputRecord":"Type.Model.Usage.InputRecord","type.model.usage.models.OutputRecord":"Type.Model.Usage.OutputRecord"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/usage/UsageAsyncClient.java","src/main/java/type/model/usage/UsageClient.java","src/main/java/type/model/usage/UsageClientBuilder.java","src/main/java/type/model/usage/implementation/UsageClientImpl.java","src/main/java/type/model/usage/implementation/package-info.java","src/main/java/type/model/usage/models/InputOutputRecord.java","src/main/java/type/model/usage/models/InputRecord.java","src/main/java/type/model/usage/models/OutputRecord.java","src/main/java/type/model/usage/models/package-info.java","src/main/java/type/model/usage/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_apiview_properties.json deleted file mode 100644 index 5104cc3c1c6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_apiview_properties.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.model.visibility.VisibilityAsyncClient": "Type.Model.Visibility", - "type.model.visibility.VisibilityAsyncClient.deleteModel": "Type.Model.Visibility.deleteModel", - "type.model.visibility.VisibilityAsyncClient.deleteModelWithResponse": "Type.Model.Visibility.deleteModel", - "type.model.visibility.VisibilityAsyncClient.getModel": "Type.Model.Visibility.getModel", - "type.model.visibility.VisibilityAsyncClient.getModelWithResponse": "Type.Model.Visibility.getModel", - "type.model.visibility.VisibilityAsyncClient.headModel": "Type.Model.Visibility.headModel", - "type.model.visibility.VisibilityAsyncClient.headModelWithResponse": "Type.Model.Visibility.headModel", - "type.model.visibility.VisibilityAsyncClient.patchModel": "Type.Model.Visibility.patchModel", - "type.model.visibility.VisibilityAsyncClient.patchModelWithResponse": "Type.Model.Visibility.patchModel", - "type.model.visibility.VisibilityAsyncClient.postModel": "Type.Model.Visibility.postModel", - "type.model.visibility.VisibilityAsyncClient.postModelWithResponse": "Type.Model.Visibility.postModel", - "type.model.visibility.VisibilityAsyncClient.putModel": "Type.Model.Visibility.putModel", - "type.model.visibility.VisibilityAsyncClient.putModelWithResponse": "Type.Model.Visibility.putModel", - "type.model.visibility.VisibilityAsyncClient.putReadOnlyModel": "Type.Model.Visibility.putReadOnlyModel", - "type.model.visibility.VisibilityAsyncClient.putReadOnlyModelWithResponse": "Type.Model.Visibility.putReadOnlyModel", - "type.model.visibility.VisibilityClient": "Type.Model.Visibility", - "type.model.visibility.VisibilityClient.deleteModel": "Type.Model.Visibility.deleteModel", - "type.model.visibility.VisibilityClient.deleteModelWithResponse": "Type.Model.Visibility.deleteModel", - "type.model.visibility.VisibilityClient.getModel": "Type.Model.Visibility.getModel", - "type.model.visibility.VisibilityClient.getModelWithResponse": "Type.Model.Visibility.getModel", - "type.model.visibility.VisibilityClient.headModel": "Type.Model.Visibility.headModel", - "type.model.visibility.VisibilityClient.headModelWithResponse": "Type.Model.Visibility.headModel", - "type.model.visibility.VisibilityClient.patchModel": "Type.Model.Visibility.patchModel", - "type.model.visibility.VisibilityClient.patchModelWithResponse": "Type.Model.Visibility.patchModel", - "type.model.visibility.VisibilityClient.postModel": "Type.Model.Visibility.postModel", - "type.model.visibility.VisibilityClient.postModelWithResponse": "Type.Model.Visibility.postModel", - "type.model.visibility.VisibilityClient.putModel": "Type.Model.Visibility.putModel", - "type.model.visibility.VisibilityClient.putModelWithResponse": "Type.Model.Visibility.putModel", - "type.model.visibility.VisibilityClient.putReadOnlyModel": "Type.Model.Visibility.putReadOnlyModel", - "type.model.visibility.VisibilityClient.putReadOnlyModelWithResponse": "Type.Model.Visibility.putReadOnlyModel", - "type.model.visibility.VisibilityClientBuilder": "Type.Model.Visibility", - "type.model.visibility.models.ReadOnlyModel": "Type.Model.Visibility.ReadOnlyModel", - "type.model.visibility.models.VisibilityModel": "Type.Model.Visibility.VisibilityModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_metadata.json deleted file mode 100644 index b60ec1a653a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.model.visibility.VisibilityAsyncClient":"Type.Model.Visibility","type.model.visibility.VisibilityAsyncClient.deleteModel":"Type.Model.Visibility.deleteModel","type.model.visibility.VisibilityAsyncClient.deleteModelWithResponse":"Type.Model.Visibility.deleteModel","type.model.visibility.VisibilityAsyncClient.getModel":"Type.Model.Visibility.getModel","type.model.visibility.VisibilityAsyncClient.getModelWithResponse":"Type.Model.Visibility.getModel","type.model.visibility.VisibilityAsyncClient.headModel":"Type.Model.Visibility.headModel","type.model.visibility.VisibilityAsyncClient.headModelWithResponse":"Type.Model.Visibility.headModel","type.model.visibility.VisibilityAsyncClient.patchModel":"Type.Model.Visibility.patchModel","type.model.visibility.VisibilityAsyncClient.patchModelWithResponse":"Type.Model.Visibility.patchModel","type.model.visibility.VisibilityAsyncClient.postModel":"Type.Model.Visibility.postModel","type.model.visibility.VisibilityAsyncClient.postModelWithResponse":"Type.Model.Visibility.postModel","type.model.visibility.VisibilityAsyncClient.putModel":"Type.Model.Visibility.putModel","type.model.visibility.VisibilityAsyncClient.putModelWithResponse":"Type.Model.Visibility.putModel","type.model.visibility.VisibilityAsyncClient.putReadOnlyModel":"Type.Model.Visibility.putReadOnlyModel","type.model.visibility.VisibilityAsyncClient.putReadOnlyModelWithResponse":"Type.Model.Visibility.putReadOnlyModel","type.model.visibility.VisibilityClient":"Type.Model.Visibility","type.model.visibility.VisibilityClient.deleteModel":"Type.Model.Visibility.deleteModel","type.model.visibility.VisibilityClient.deleteModelWithResponse":"Type.Model.Visibility.deleteModel","type.model.visibility.VisibilityClient.getModel":"Type.Model.Visibility.getModel","type.model.visibility.VisibilityClient.getModelWithResponse":"Type.Model.Visibility.getModel","type.model.visibility.VisibilityClient.headModel":"Type.Model.Visibility.headModel","type.model.visibility.VisibilityClient.headModelWithResponse":"Type.Model.Visibility.headModel","type.model.visibility.VisibilityClient.patchModel":"Type.Model.Visibility.patchModel","type.model.visibility.VisibilityClient.patchModelWithResponse":"Type.Model.Visibility.patchModel","type.model.visibility.VisibilityClient.postModel":"Type.Model.Visibility.postModel","type.model.visibility.VisibilityClient.postModelWithResponse":"Type.Model.Visibility.postModel","type.model.visibility.VisibilityClient.putModel":"Type.Model.Visibility.putModel","type.model.visibility.VisibilityClient.putModelWithResponse":"Type.Model.Visibility.putModel","type.model.visibility.VisibilityClient.putReadOnlyModel":"Type.Model.Visibility.putReadOnlyModel","type.model.visibility.VisibilityClient.putReadOnlyModelWithResponse":"Type.Model.Visibility.putReadOnlyModel","type.model.visibility.VisibilityClientBuilder":"Type.Model.Visibility","type.model.visibility.models.ReadOnlyModel":"Type.Model.Visibility.ReadOnlyModel","type.model.visibility.models.VisibilityModel":"Type.Model.Visibility.VisibilityModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/visibility/VisibilityAsyncClient.java","src/main/java/type/model/visibility/VisibilityClient.java","src/main/java/type/model/visibility/VisibilityClientBuilder.java","src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java","src/main/java/type/model/visibility/implementation/package-info.java","src/main/java/type/model/visibility/models/ReadOnlyModel.java","src/main/java/type/model/visibility/models/VisibilityModel.java","src/main/java/type/model/visibility/models/package-info.java","src/main/java/type/model/visibility/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_apiview_properties.json deleted file mode 100644 index c7e092788c9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_apiview_properties.json +++ /dev/null @@ -1,353 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.property.additionalproperties.AdditionalPropertiesClientBuilder": "Type.Property.AdditionalProperties", - "type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat", - "type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get", - "type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get", - "type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put", - "type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put", - "type.property.additionalproperties.ExtendsDifferentSpreadFloatClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat", - "type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get", - "type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get", - "type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put", - "type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put", - "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray", - "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get", - "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get", - "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put", - "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put", - "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray", - "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get", - "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get", - "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put", - "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put", - "type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel", - "type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get", - "type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get", - "type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put", - "type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put", - "type.property.additionalproperties.ExtendsDifferentSpreadModelClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel", - "type.property.additionalproperties.ExtendsDifferentSpreadModelClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get", - "type.property.additionalproperties.ExtendsDifferentSpreadModelClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get", - "type.property.additionalproperties.ExtendsDifferentSpreadModelClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put", - "type.property.additionalproperties.ExtendsDifferentSpreadModelClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put", - "type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString", - "type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get", - "type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get", - "type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put", - "type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put", - "type.property.additionalproperties.ExtendsDifferentSpreadStringClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString", - "type.property.additionalproperties.ExtendsDifferentSpreadStringClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get", - "type.property.additionalproperties.ExtendsDifferentSpreadStringClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get", - "type.property.additionalproperties.ExtendsDifferentSpreadStringClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put", - "type.property.additionalproperties.ExtendsDifferentSpreadStringClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put", - "type.property.additionalproperties.ExtendsFloatAsyncClient": "Type.Property.AdditionalProperties.ExtendsFloat", - "type.property.additionalproperties.ExtendsFloatAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsFloat.get", - "type.property.additionalproperties.ExtendsFloatAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsFloat.get", - "type.property.additionalproperties.ExtendsFloatAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsFloat.put", - "type.property.additionalproperties.ExtendsFloatAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsFloat.put", - "type.property.additionalproperties.ExtendsFloatClient": "Type.Property.AdditionalProperties.ExtendsFloat", - "type.property.additionalproperties.ExtendsFloatClient.get": "Type.Property.AdditionalProperties.ExtendsFloat.get", - "type.property.additionalproperties.ExtendsFloatClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsFloat.get", - "type.property.additionalproperties.ExtendsFloatClient.put": "Type.Property.AdditionalProperties.ExtendsFloat.put", - "type.property.additionalproperties.ExtendsFloatClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsFloat.put", - "type.property.additionalproperties.ExtendsModelArrayAsyncClient": "Type.Property.AdditionalProperties.ExtendsModelArray", - "type.property.additionalproperties.ExtendsModelArrayAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsModelArray.get", - "type.property.additionalproperties.ExtendsModelArrayAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsModelArray.get", - "type.property.additionalproperties.ExtendsModelArrayAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsModelArray.put", - "type.property.additionalproperties.ExtendsModelArrayAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsModelArray.put", - "type.property.additionalproperties.ExtendsModelArrayClient": "Type.Property.AdditionalProperties.ExtendsModelArray", - "type.property.additionalproperties.ExtendsModelArrayClient.get": "Type.Property.AdditionalProperties.ExtendsModelArray.get", - "type.property.additionalproperties.ExtendsModelArrayClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsModelArray.get", - "type.property.additionalproperties.ExtendsModelArrayClient.put": "Type.Property.AdditionalProperties.ExtendsModelArray.put", - "type.property.additionalproperties.ExtendsModelArrayClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsModelArray.put", - "type.property.additionalproperties.ExtendsModelAsyncClient": "Type.Property.AdditionalProperties.ExtendsModel", - "type.property.additionalproperties.ExtendsModelAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsModel.get", - "type.property.additionalproperties.ExtendsModelAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsModel.get", - "type.property.additionalproperties.ExtendsModelAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsModel.put", - "type.property.additionalproperties.ExtendsModelAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsModel.put", - "type.property.additionalproperties.ExtendsModelClient": "Type.Property.AdditionalProperties.ExtendsModel", - "type.property.additionalproperties.ExtendsModelClient.get": "Type.Property.AdditionalProperties.ExtendsModel.get", - "type.property.additionalproperties.ExtendsModelClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsModel.get", - "type.property.additionalproperties.ExtendsModelClient.put": "Type.Property.AdditionalProperties.ExtendsModel.put", - "type.property.additionalproperties.ExtendsModelClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsModel.put", - "type.property.additionalproperties.ExtendsStringAsyncClient": "Type.Property.AdditionalProperties.ExtendsString", - "type.property.additionalproperties.ExtendsStringAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsString.get", - "type.property.additionalproperties.ExtendsStringAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsString.get", - "type.property.additionalproperties.ExtendsStringAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsString.put", - "type.property.additionalproperties.ExtendsStringAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsString.put", - "type.property.additionalproperties.ExtendsStringClient": "Type.Property.AdditionalProperties.ExtendsString", - "type.property.additionalproperties.ExtendsStringClient.get": "Type.Property.AdditionalProperties.ExtendsString.get", - "type.property.additionalproperties.ExtendsStringClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsString.get", - "type.property.additionalproperties.ExtendsStringClient.put": "Type.Property.AdditionalProperties.ExtendsString.put", - "type.property.additionalproperties.ExtendsStringClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsString.put", - "type.property.additionalproperties.ExtendsUnknownAsyncClient": "Type.Property.AdditionalProperties.ExtendsUnknown", - "type.property.additionalproperties.ExtendsUnknownAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsUnknown.get", - "type.property.additionalproperties.ExtendsUnknownAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknown.get", - "type.property.additionalproperties.ExtendsUnknownAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsUnknown.put", - "type.property.additionalproperties.ExtendsUnknownAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknown.put", - "type.property.additionalproperties.ExtendsUnknownClient": "Type.Property.AdditionalProperties.ExtendsUnknown", - "type.property.additionalproperties.ExtendsUnknownClient.get": "Type.Property.AdditionalProperties.ExtendsUnknown.get", - "type.property.additionalproperties.ExtendsUnknownClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknown.get", - "type.property.additionalproperties.ExtendsUnknownClient.put": "Type.Property.AdditionalProperties.ExtendsUnknown.put", - "type.property.additionalproperties.ExtendsUnknownClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknown.put", - "type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient": "Type.Property.AdditionalProperties.ExtendsUnknownDerived", - "type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.get", - "type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.get", - "type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.put", - "type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.put", - "type.property.additionalproperties.ExtendsUnknownDerivedClient": "Type.Property.AdditionalProperties.ExtendsUnknownDerived", - "type.property.additionalproperties.ExtendsUnknownDerivedClient.get": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.get", - "type.property.additionalproperties.ExtendsUnknownDerivedClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.get", - "type.property.additionalproperties.ExtendsUnknownDerivedClient.put": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.put", - "type.property.additionalproperties.ExtendsUnknownDerivedClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.put", - "type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated", - "type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get", - "type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get", - "type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put", - "type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put", - "type.property.additionalproperties.ExtendsUnknownDiscriminatedClient": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated", - "type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.get": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get", - "type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get", - "type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.put": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put", - "type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put", - "type.property.additionalproperties.IsFloatAsyncClient": "Type.Property.AdditionalProperties.IsFloat", - "type.property.additionalproperties.IsFloatAsyncClient.get": "Type.Property.AdditionalProperties.IsFloat.get", - "type.property.additionalproperties.IsFloatAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsFloat.get", - "type.property.additionalproperties.IsFloatAsyncClient.put": "Type.Property.AdditionalProperties.IsFloat.put", - "type.property.additionalproperties.IsFloatAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsFloat.put", - "type.property.additionalproperties.IsFloatClient": "Type.Property.AdditionalProperties.IsFloat", - "type.property.additionalproperties.IsFloatClient.get": "Type.Property.AdditionalProperties.IsFloat.get", - "type.property.additionalproperties.IsFloatClient.getWithResponse": "Type.Property.AdditionalProperties.IsFloat.get", - "type.property.additionalproperties.IsFloatClient.put": "Type.Property.AdditionalProperties.IsFloat.put", - "type.property.additionalproperties.IsFloatClient.putWithResponse": "Type.Property.AdditionalProperties.IsFloat.put", - "type.property.additionalproperties.IsModelArrayAsyncClient": "Type.Property.AdditionalProperties.IsModelArray", - "type.property.additionalproperties.IsModelArrayAsyncClient.get": "Type.Property.AdditionalProperties.IsModelArray.get", - "type.property.additionalproperties.IsModelArrayAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsModelArray.get", - "type.property.additionalproperties.IsModelArrayAsyncClient.put": "Type.Property.AdditionalProperties.IsModelArray.put", - "type.property.additionalproperties.IsModelArrayAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsModelArray.put", - "type.property.additionalproperties.IsModelArrayClient": "Type.Property.AdditionalProperties.IsModelArray", - "type.property.additionalproperties.IsModelArrayClient.get": "Type.Property.AdditionalProperties.IsModelArray.get", - "type.property.additionalproperties.IsModelArrayClient.getWithResponse": "Type.Property.AdditionalProperties.IsModelArray.get", - "type.property.additionalproperties.IsModelArrayClient.put": "Type.Property.AdditionalProperties.IsModelArray.put", - "type.property.additionalproperties.IsModelArrayClient.putWithResponse": "Type.Property.AdditionalProperties.IsModelArray.put", - "type.property.additionalproperties.IsModelAsyncClient": "Type.Property.AdditionalProperties.IsModel", - "type.property.additionalproperties.IsModelAsyncClient.get": "Type.Property.AdditionalProperties.IsModel.get", - "type.property.additionalproperties.IsModelAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsModel.get", - "type.property.additionalproperties.IsModelAsyncClient.put": "Type.Property.AdditionalProperties.IsModel.put", - "type.property.additionalproperties.IsModelAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsModel.put", - "type.property.additionalproperties.IsModelClient": "Type.Property.AdditionalProperties.IsModel", - "type.property.additionalproperties.IsModelClient.get": "Type.Property.AdditionalProperties.IsModel.get", - "type.property.additionalproperties.IsModelClient.getWithResponse": "Type.Property.AdditionalProperties.IsModel.get", - "type.property.additionalproperties.IsModelClient.put": "Type.Property.AdditionalProperties.IsModel.put", - "type.property.additionalproperties.IsModelClient.putWithResponse": "Type.Property.AdditionalProperties.IsModel.put", - "type.property.additionalproperties.IsStringAsyncClient": "Type.Property.AdditionalProperties.IsString", - "type.property.additionalproperties.IsStringAsyncClient.get": "Type.Property.AdditionalProperties.IsString.get", - "type.property.additionalproperties.IsStringAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsString.get", - "type.property.additionalproperties.IsStringAsyncClient.put": "Type.Property.AdditionalProperties.IsString.put", - "type.property.additionalproperties.IsStringAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsString.put", - "type.property.additionalproperties.IsStringClient": "Type.Property.AdditionalProperties.IsString", - "type.property.additionalproperties.IsStringClient.get": "Type.Property.AdditionalProperties.IsString.get", - "type.property.additionalproperties.IsStringClient.getWithResponse": "Type.Property.AdditionalProperties.IsString.get", - "type.property.additionalproperties.IsStringClient.put": "Type.Property.AdditionalProperties.IsString.put", - "type.property.additionalproperties.IsStringClient.putWithResponse": "Type.Property.AdditionalProperties.IsString.put", - "type.property.additionalproperties.IsUnknownAsyncClient": "Type.Property.AdditionalProperties.IsUnknown", - "type.property.additionalproperties.IsUnknownAsyncClient.get": "Type.Property.AdditionalProperties.IsUnknown.get", - "type.property.additionalproperties.IsUnknownAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsUnknown.get", - "type.property.additionalproperties.IsUnknownAsyncClient.put": "Type.Property.AdditionalProperties.IsUnknown.put", - "type.property.additionalproperties.IsUnknownAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsUnknown.put", - "type.property.additionalproperties.IsUnknownClient": "Type.Property.AdditionalProperties.IsUnknown", - "type.property.additionalproperties.IsUnknownClient.get": "Type.Property.AdditionalProperties.IsUnknown.get", - "type.property.additionalproperties.IsUnknownClient.getWithResponse": "Type.Property.AdditionalProperties.IsUnknown.get", - "type.property.additionalproperties.IsUnknownClient.put": "Type.Property.AdditionalProperties.IsUnknown.put", - "type.property.additionalproperties.IsUnknownClient.putWithResponse": "Type.Property.AdditionalProperties.IsUnknown.put", - "type.property.additionalproperties.IsUnknownDerivedAsyncClient": "Type.Property.AdditionalProperties.IsUnknownDerived", - "type.property.additionalproperties.IsUnknownDerivedAsyncClient.get": "Type.Property.AdditionalProperties.IsUnknownDerived.get", - "type.property.additionalproperties.IsUnknownDerivedAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsUnknownDerived.get", - "type.property.additionalproperties.IsUnknownDerivedAsyncClient.put": "Type.Property.AdditionalProperties.IsUnknownDerived.put", - "type.property.additionalproperties.IsUnknownDerivedAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsUnknownDerived.put", - "type.property.additionalproperties.IsUnknownDerivedClient": "Type.Property.AdditionalProperties.IsUnknownDerived", - "type.property.additionalproperties.IsUnknownDerivedClient.get": "Type.Property.AdditionalProperties.IsUnknownDerived.get", - "type.property.additionalproperties.IsUnknownDerivedClient.getWithResponse": "Type.Property.AdditionalProperties.IsUnknownDerived.get", - "type.property.additionalproperties.IsUnknownDerivedClient.put": "Type.Property.AdditionalProperties.IsUnknownDerived.put", - "type.property.additionalproperties.IsUnknownDerivedClient.putWithResponse": "Type.Property.AdditionalProperties.IsUnknownDerived.put", - "type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient": "Type.Property.AdditionalProperties.IsUnknownDiscriminated", - "type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.get": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.get", - "type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.get", - "type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.put": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.put", - "type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.put", - "type.property.additionalproperties.IsUnknownDiscriminatedClient": "Type.Property.AdditionalProperties.IsUnknownDiscriminated", - "type.property.additionalproperties.IsUnknownDiscriminatedClient.get": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.get", - "type.property.additionalproperties.IsUnknownDiscriminatedClient.getWithResponse": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.get", - "type.property.additionalproperties.IsUnknownDiscriminatedClient.put": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.put", - "type.property.additionalproperties.IsUnknownDiscriminatedClient.putWithResponse": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.put", - "type.property.additionalproperties.MultipleSpreadAsyncClient": "Type.Property.AdditionalProperties.MultipleSpread", - "type.property.additionalproperties.MultipleSpreadAsyncClient.get": "Type.Property.AdditionalProperties.MultipleSpread.get", - "type.property.additionalproperties.MultipleSpreadAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.MultipleSpread.get", - "type.property.additionalproperties.MultipleSpreadAsyncClient.put": "Type.Property.AdditionalProperties.MultipleSpread.put", - "type.property.additionalproperties.MultipleSpreadAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.MultipleSpread.put", - "type.property.additionalproperties.MultipleSpreadClient": "Type.Property.AdditionalProperties.MultipleSpread", - "type.property.additionalproperties.MultipleSpreadClient.get": "Type.Property.AdditionalProperties.MultipleSpread.get", - "type.property.additionalproperties.MultipleSpreadClient.getWithResponse": "Type.Property.AdditionalProperties.MultipleSpread.get", - "type.property.additionalproperties.MultipleSpreadClient.put": "Type.Property.AdditionalProperties.MultipleSpread.put", - "type.property.additionalproperties.MultipleSpreadClient.putWithResponse": "Type.Property.AdditionalProperties.MultipleSpread.put", - "type.property.additionalproperties.SpreadDifferentFloatAsyncClient": "Type.Property.AdditionalProperties.SpreadDifferentFloat", - "type.property.additionalproperties.SpreadDifferentFloatAsyncClient.get": "Type.Property.AdditionalProperties.SpreadDifferentFloat.get", - "type.property.additionalproperties.SpreadDifferentFloatAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentFloat.get", - "type.property.additionalproperties.SpreadDifferentFloatAsyncClient.put": "Type.Property.AdditionalProperties.SpreadDifferentFloat.put", - "type.property.additionalproperties.SpreadDifferentFloatAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentFloat.put", - "type.property.additionalproperties.SpreadDifferentFloatClient": "Type.Property.AdditionalProperties.SpreadDifferentFloat", - "type.property.additionalproperties.SpreadDifferentFloatClient.get": "Type.Property.AdditionalProperties.SpreadDifferentFloat.get", - "type.property.additionalproperties.SpreadDifferentFloatClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentFloat.get", - "type.property.additionalproperties.SpreadDifferentFloatClient.put": "Type.Property.AdditionalProperties.SpreadDifferentFloat.put", - "type.property.additionalproperties.SpreadDifferentFloatClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentFloat.put", - "type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient": "Type.Property.AdditionalProperties.SpreadDifferentModelArray", - "type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.get": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.get", - "type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.get", - "type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.put": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.put", - "type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.put", - "type.property.additionalproperties.SpreadDifferentModelArrayClient": "Type.Property.AdditionalProperties.SpreadDifferentModelArray", - "type.property.additionalproperties.SpreadDifferentModelArrayClient.get": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.get", - "type.property.additionalproperties.SpreadDifferentModelArrayClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.get", - "type.property.additionalproperties.SpreadDifferentModelArrayClient.put": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.put", - "type.property.additionalproperties.SpreadDifferentModelArrayClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.put", - "type.property.additionalproperties.SpreadDifferentModelAsyncClient": "Type.Property.AdditionalProperties.SpreadDifferentModel", - "type.property.additionalproperties.SpreadDifferentModelAsyncClient.get": "Type.Property.AdditionalProperties.SpreadDifferentModel.get", - "type.property.additionalproperties.SpreadDifferentModelAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModel.get", - "type.property.additionalproperties.SpreadDifferentModelAsyncClient.put": "Type.Property.AdditionalProperties.SpreadDifferentModel.put", - "type.property.additionalproperties.SpreadDifferentModelAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModel.put", - "type.property.additionalproperties.SpreadDifferentModelClient": "Type.Property.AdditionalProperties.SpreadDifferentModel", - "type.property.additionalproperties.SpreadDifferentModelClient.get": "Type.Property.AdditionalProperties.SpreadDifferentModel.get", - "type.property.additionalproperties.SpreadDifferentModelClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModel.get", - "type.property.additionalproperties.SpreadDifferentModelClient.put": "Type.Property.AdditionalProperties.SpreadDifferentModel.put", - "type.property.additionalproperties.SpreadDifferentModelClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModel.put", - "type.property.additionalproperties.SpreadDifferentStringAsyncClient": "Type.Property.AdditionalProperties.SpreadDifferentString", - "type.property.additionalproperties.SpreadDifferentStringAsyncClient.get": "Type.Property.AdditionalProperties.SpreadDifferentString.get", - "type.property.additionalproperties.SpreadDifferentStringAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentString.get", - "type.property.additionalproperties.SpreadDifferentStringAsyncClient.put": "Type.Property.AdditionalProperties.SpreadDifferentString.put", - "type.property.additionalproperties.SpreadDifferentStringAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentString.put", - "type.property.additionalproperties.SpreadDifferentStringClient": "Type.Property.AdditionalProperties.SpreadDifferentString", - "type.property.additionalproperties.SpreadDifferentStringClient.get": "Type.Property.AdditionalProperties.SpreadDifferentString.get", - "type.property.additionalproperties.SpreadDifferentStringClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentString.get", - "type.property.additionalproperties.SpreadDifferentStringClient.put": "Type.Property.AdditionalProperties.SpreadDifferentString.put", - "type.property.additionalproperties.SpreadDifferentStringClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentString.put", - "type.property.additionalproperties.SpreadFloatAsyncClient": "Type.Property.AdditionalProperties.SpreadFloat", - "type.property.additionalproperties.SpreadFloatAsyncClient.get": "Type.Property.AdditionalProperties.SpreadFloat.get", - "type.property.additionalproperties.SpreadFloatAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadFloat.get", - "type.property.additionalproperties.SpreadFloatAsyncClient.put": "Type.Property.AdditionalProperties.SpreadFloat.put", - "type.property.additionalproperties.SpreadFloatAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadFloat.put", - "type.property.additionalproperties.SpreadFloatClient": "Type.Property.AdditionalProperties.SpreadFloat", - "type.property.additionalproperties.SpreadFloatClient.get": "Type.Property.AdditionalProperties.SpreadFloat.get", - "type.property.additionalproperties.SpreadFloatClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadFloat.get", - "type.property.additionalproperties.SpreadFloatClient.put": "Type.Property.AdditionalProperties.SpreadFloat.put", - "type.property.additionalproperties.SpreadFloatClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadFloat.put", - "type.property.additionalproperties.SpreadModelArrayAsyncClient": "Type.Property.AdditionalProperties.SpreadModelArray", - "type.property.additionalproperties.SpreadModelArrayAsyncClient.get": "Type.Property.AdditionalProperties.SpreadModelArray.get", - "type.property.additionalproperties.SpreadModelArrayAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadModelArray.get", - "type.property.additionalproperties.SpreadModelArrayAsyncClient.put": "Type.Property.AdditionalProperties.SpreadModelArray.put", - "type.property.additionalproperties.SpreadModelArrayAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadModelArray.put", - "type.property.additionalproperties.SpreadModelArrayClient": "Type.Property.AdditionalProperties.SpreadModelArray", - "type.property.additionalproperties.SpreadModelArrayClient.get": "Type.Property.AdditionalProperties.SpreadModelArray.get", - "type.property.additionalproperties.SpreadModelArrayClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadModelArray.get", - "type.property.additionalproperties.SpreadModelArrayClient.put": "Type.Property.AdditionalProperties.SpreadModelArray.put", - "type.property.additionalproperties.SpreadModelArrayClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadModelArray.put", - "type.property.additionalproperties.SpreadModelAsyncClient": "Type.Property.AdditionalProperties.SpreadModel", - "type.property.additionalproperties.SpreadModelAsyncClient.get": "Type.Property.AdditionalProperties.SpreadModel.get", - "type.property.additionalproperties.SpreadModelAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadModel.get", - "type.property.additionalproperties.SpreadModelAsyncClient.put": "Type.Property.AdditionalProperties.SpreadModel.put", - "type.property.additionalproperties.SpreadModelAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadModel.put", - "type.property.additionalproperties.SpreadModelClient": "Type.Property.AdditionalProperties.SpreadModel", - "type.property.additionalproperties.SpreadModelClient.get": "Type.Property.AdditionalProperties.SpreadModel.get", - "type.property.additionalproperties.SpreadModelClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadModel.get", - "type.property.additionalproperties.SpreadModelClient.put": "Type.Property.AdditionalProperties.SpreadModel.put", - "type.property.additionalproperties.SpreadModelClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadModel.put", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.get": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.put": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.get": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.put": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.get": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.put": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.get": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.put": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.get": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.put": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.get": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.put": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put", - "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put", - "type.property.additionalproperties.SpreadRecordUnionAsyncClient": "Type.Property.AdditionalProperties.SpreadRecordUnion", - "type.property.additionalproperties.SpreadRecordUnionAsyncClient.get": "Type.Property.AdditionalProperties.SpreadRecordUnion.get", - "type.property.additionalproperties.SpreadRecordUnionAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordUnion.get", - "type.property.additionalproperties.SpreadRecordUnionAsyncClient.put": "Type.Property.AdditionalProperties.SpreadRecordUnion.put", - "type.property.additionalproperties.SpreadRecordUnionAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordUnion.put", - "type.property.additionalproperties.SpreadRecordUnionClient": "Type.Property.AdditionalProperties.SpreadRecordUnion", - "type.property.additionalproperties.SpreadRecordUnionClient.get": "Type.Property.AdditionalProperties.SpreadRecordUnion.get", - "type.property.additionalproperties.SpreadRecordUnionClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordUnion.get", - "type.property.additionalproperties.SpreadRecordUnionClient.put": "Type.Property.AdditionalProperties.SpreadRecordUnion.put", - "type.property.additionalproperties.SpreadRecordUnionClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordUnion.put", - "type.property.additionalproperties.SpreadStringAsyncClient": "Type.Property.AdditionalProperties.SpreadString", - "type.property.additionalproperties.SpreadStringAsyncClient.get": "Type.Property.AdditionalProperties.SpreadString.get", - "type.property.additionalproperties.SpreadStringAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadString.get", - "type.property.additionalproperties.SpreadStringAsyncClient.put": "Type.Property.AdditionalProperties.SpreadString.put", - "type.property.additionalproperties.SpreadStringAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadString.put", - "type.property.additionalproperties.SpreadStringClient": "Type.Property.AdditionalProperties.SpreadString", - "type.property.additionalproperties.SpreadStringClient.get": "Type.Property.AdditionalProperties.SpreadString.get", - "type.property.additionalproperties.SpreadStringClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadString.get", - "type.property.additionalproperties.SpreadStringClient.put": "Type.Property.AdditionalProperties.SpreadString.put", - "type.property.additionalproperties.SpreadStringClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadString.put", - "type.property.additionalproperties.models.DifferentSpreadFloatDerived": "Type.Property.AdditionalProperties.DifferentSpreadFloatDerived", - "type.property.additionalproperties.models.DifferentSpreadFloatRecord": "Type.Property.AdditionalProperties.DifferentSpreadFloatRecord", - "type.property.additionalproperties.models.DifferentSpreadModelArrayDerived": "Type.Property.AdditionalProperties.DifferentSpreadModelArrayDerived", - "type.property.additionalproperties.models.DifferentSpreadModelArrayRecord": "Type.Property.AdditionalProperties.DifferentSpreadModelArrayRecord", - "type.property.additionalproperties.models.DifferentSpreadModelDerived": "Type.Property.AdditionalProperties.DifferentSpreadModelDerived", - "type.property.additionalproperties.models.DifferentSpreadModelRecord": "Type.Property.AdditionalProperties.DifferentSpreadModelRecord", - "type.property.additionalproperties.models.DifferentSpreadStringDerived": "Type.Property.AdditionalProperties.DifferentSpreadStringDerived", - "type.property.additionalproperties.models.DifferentSpreadStringRecord": "Type.Property.AdditionalProperties.DifferentSpreadStringRecord", - "type.property.additionalproperties.models.ExtendsFloatAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsFloatAdditionalProperties", - "type.property.additionalproperties.models.ExtendsModelAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsModelAdditionalProperties", - "type.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsModelArrayAdditionalProperties", - "type.property.additionalproperties.models.ExtendsStringAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsStringAdditionalProperties", - "type.property.additionalproperties.models.ExtendsUnknownAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalProperties", - "type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDerived": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDerived", - "type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminated": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDiscriminated", - "type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived", - "type.property.additionalproperties.models.IsFloatAdditionalProperties": "Type.Property.AdditionalProperties.IsFloatAdditionalProperties", - "type.property.additionalproperties.models.IsModelAdditionalProperties": "Type.Property.AdditionalProperties.IsModelAdditionalProperties", - "type.property.additionalproperties.models.IsModelArrayAdditionalProperties": "Type.Property.AdditionalProperties.IsModelArrayAdditionalProperties", - "type.property.additionalproperties.models.IsStringAdditionalProperties": "Type.Property.AdditionalProperties.IsStringAdditionalProperties", - "type.property.additionalproperties.models.IsUnknownAdditionalProperties": "Type.Property.AdditionalProperties.IsUnknownAdditionalProperties", - "type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDerived": "Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDerived", - "type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminated": "Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDiscriminated", - "type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminatedDerived": "Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDiscriminatedDerived", - "type.property.additionalproperties.models.ModelForRecord": "Type.Property.AdditionalProperties.ModelForRecord", - "type.property.additionalproperties.models.MultipleSpreadRecord": "Type.Property.AdditionalProperties.MultipleSpreadRecord", - "type.property.additionalproperties.models.SpreadFloatRecord": "Type.Property.AdditionalProperties.SpreadFloatRecord", - "type.property.additionalproperties.models.SpreadModelArrayRecord": "Type.Property.AdditionalProperties.SpreadModelArrayRecord", - "type.property.additionalproperties.models.SpreadModelRecord": "Type.Property.AdditionalProperties.SpreadModelRecord", - "type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion": "Type.Property.AdditionalProperties.SpreadRecordForNonDiscriminatedUnion", - "type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion2": "Type.Property.AdditionalProperties.SpreadRecordForNonDiscriminatedUnion2", - "type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion3": "Type.Property.AdditionalProperties.SpreadRecordForNonDiscriminatedUnion3", - "type.property.additionalproperties.models.SpreadRecordForUnion": "Type.Property.AdditionalProperties.SpreadRecordForUnion", - "type.property.additionalproperties.models.SpreadStringRecord": "Type.Property.AdditionalProperties.SpreadStringRecord", - "type.property.additionalproperties.models.WidgetData0": "Type.Property.AdditionalProperties.WidgetData0", - "type.property.additionalproperties.models.WidgetData1": "Type.Property.AdditionalProperties.WidgetData1", - "type.property.additionalproperties.models.WidgetData2": "Type.Property.AdditionalProperties.WidgetData2" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_metadata.json deleted file mode 100644 index 62d49c881f7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.property.additionalproperties.AdditionalPropertiesClientBuilder":"Type.Property.AdditionalProperties","type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat","type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get","type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get","type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put","type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put","type.property.additionalproperties.ExtendsDifferentSpreadFloatClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat","type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get","type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get","type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put","type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put","type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel","type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get","type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get","type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put","type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put","type.property.additionalproperties.ExtendsDifferentSpreadModelClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel","type.property.additionalproperties.ExtendsDifferentSpreadModelClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get","type.property.additionalproperties.ExtendsDifferentSpreadModelClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get","type.property.additionalproperties.ExtendsDifferentSpreadModelClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put","type.property.additionalproperties.ExtendsDifferentSpreadModelClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put","type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString","type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get","type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get","type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put","type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put","type.property.additionalproperties.ExtendsDifferentSpreadStringClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString","type.property.additionalproperties.ExtendsDifferentSpreadStringClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get","type.property.additionalproperties.ExtendsDifferentSpreadStringClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get","type.property.additionalproperties.ExtendsDifferentSpreadStringClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put","type.property.additionalproperties.ExtendsDifferentSpreadStringClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put","type.property.additionalproperties.ExtendsFloatAsyncClient":"Type.Property.AdditionalProperties.ExtendsFloat","type.property.additionalproperties.ExtendsFloatAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsFloat.get","type.property.additionalproperties.ExtendsFloatAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsFloat.get","type.property.additionalproperties.ExtendsFloatAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsFloat.put","type.property.additionalproperties.ExtendsFloatAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsFloat.put","type.property.additionalproperties.ExtendsFloatClient":"Type.Property.AdditionalProperties.ExtendsFloat","type.property.additionalproperties.ExtendsFloatClient.get":"Type.Property.AdditionalProperties.ExtendsFloat.get","type.property.additionalproperties.ExtendsFloatClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsFloat.get","type.property.additionalproperties.ExtendsFloatClient.put":"Type.Property.AdditionalProperties.ExtendsFloat.put","type.property.additionalproperties.ExtendsFloatClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsFloat.put","type.property.additionalproperties.ExtendsModelArrayAsyncClient":"Type.Property.AdditionalProperties.ExtendsModelArray","type.property.additionalproperties.ExtendsModelArrayAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsModelArray.get","type.property.additionalproperties.ExtendsModelArrayAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsModelArray.get","type.property.additionalproperties.ExtendsModelArrayAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsModelArray.put","type.property.additionalproperties.ExtendsModelArrayAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsModelArray.put","type.property.additionalproperties.ExtendsModelArrayClient":"Type.Property.AdditionalProperties.ExtendsModelArray","type.property.additionalproperties.ExtendsModelArrayClient.get":"Type.Property.AdditionalProperties.ExtendsModelArray.get","type.property.additionalproperties.ExtendsModelArrayClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsModelArray.get","type.property.additionalproperties.ExtendsModelArrayClient.put":"Type.Property.AdditionalProperties.ExtendsModelArray.put","type.property.additionalproperties.ExtendsModelArrayClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsModelArray.put","type.property.additionalproperties.ExtendsModelAsyncClient":"Type.Property.AdditionalProperties.ExtendsModel","type.property.additionalproperties.ExtendsModelAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsModel.get","type.property.additionalproperties.ExtendsModelAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsModel.get","type.property.additionalproperties.ExtendsModelAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsModel.put","type.property.additionalproperties.ExtendsModelAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsModel.put","type.property.additionalproperties.ExtendsModelClient":"Type.Property.AdditionalProperties.ExtendsModel","type.property.additionalproperties.ExtendsModelClient.get":"Type.Property.AdditionalProperties.ExtendsModel.get","type.property.additionalproperties.ExtendsModelClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsModel.get","type.property.additionalproperties.ExtendsModelClient.put":"Type.Property.AdditionalProperties.ExtendsModel.put","type.property.additionalproperties.ExtendsModelClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsModel.put","type.property.additionalproperties.ExtendsStringAsyncClient":"Type.Property.AdditionalProperties.ExtendsString","type.property.additionalproperties.ExtendsStringAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsString.get","type.property.additionalproperties.ExtendsStringAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsString.get","type.property.additionalproperties.ExtendsStringAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsString.put","type.property.additionalproperties.ExtendsStringAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsString.put","type.property.additionalproperties.ExtendsStringClient":"Type.Property.AdditionalProperties.ExtendsString","type.property.additionalproperties.ExtendsStringClient.get":"Type.Property.AdditionalProperties.ExtendsString.get","type.property.additionalproperties.ExtendsStringClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsString.get","type.property.additionalproperties.ExtendsStringClient.put":"Type.Property.AdditionalProperties.ExtendsString.put","type.property.additionalproperties.ExtendsStringClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsString.put","type.property.additionalproperties.ExtendsUnknownAsyncClient":"Type.Property.AdditionalProperties.ExtendsUnknown","type.property.additionalproperties.ExtendsUnknownAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsUnknown.get","type.property.additionalproperties.ExtendsUnknownAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknown.get","type.property.additionalproperties.ExtendsUnknownAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsUnknown.put","type.property.additionalproperties.ExtendsUnknownAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknown.put","type.property.additionalproperties.ExtendsUnknownClient":"Type.Property.AdditionalProperties.ExtendsUnknown","type.property.additionalproperties.ExtendsUnknownClient.get":"Type.Property.AdditionalProperties.ExtendsUnknown.get","type.property.additionalproperties.ExtendsUnknownClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknown.get","type.property.additionalproperties.ExtendsUnknownClient.put":"Type.Property.AdditionalProperties.ExtendsUnknown.put","type.property.additionalproperties.ExtendsUnknownClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknown.put","type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient":"Type.Property.AdditionalProperties.ExtendsUnknownDerived","type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.get","type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.get","type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.put","type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.put","type.property.additionalproperties.ExtendsUnknownDerivedClient":"Type.Property.AdditionalProperties.ExtendsUnknownDerived","type.property.additionalproperties.ExtendsUnknownDerivedClient.get":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.get","type.property.additionalproperties.ExtendsUnknownDerivedClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.get","type.property.additionalproperties.ExtendsUnknownDerivedClient.put":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.put","type.property.additionalproperties.ExtendsUnknownDerivedClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.put","type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated","type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get","type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get","type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put","type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put","type.property.additionalproperties.ExtendsUnknownDiscriminatedClient":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated","type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.get":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get","type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get","type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.put":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put","type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put","type.property.additionalproperties.IsFloatAsyncClient":"Type.Property.AdditionalProperties.IsFloat","type.property.additionalproperties.IsFloatAsyncClient.get":"Type.Property.AdditionalProperties.IsFloat.get","type.property.additionalproperties.IsFloatAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsFloat.get","type.property.additionalproperties.IsFloatAsyncClient.put":"Type.Property.AdditionalProperties.IsFloat.put","type.property.additionalproperties.IsFloatAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsFloat.put","type.property.additionalproperties.IsFloatClient":"Type.Property.AdditionalProperties.IsFloat","type.property.additionalproperties.IsFloatClient.get":"Type.Property.AdditionalProperties.IsFloat.get","type.property.additionalproperties.IsFloatClient.getWithResponse":"Type.Property.AdditionalProperties.IsFloat.get","type.property.additionalproperties.IsFloatClient.put":"Type.Property.AdditionalProperties.IsFloat.put","type.property.additionalproperties.IsFloatClient.putWithResponse":"Type.Property.AdditionalProperties.IsFloat.put","type.property.additionalproperties.IsModelArrayAsyncClient":"Type.Property.AdditionalProperties.IsModelArray","type.property.additionalproperties.IsModelArrayAsyncClient.get":"Type.Property.AdditionalProperties.IsModelArray.get","type.property.additionalproperties.IsModelArrayAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsModelArray.get","type.property.additionalproperties.IsModelArrayAsyncClient.put":"Type.Property.AdditionalProperties.IsModelArray.put","type.property.additionalproperties.IsModelArrayAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsModelArray.put","type.property.additionalproperties.IsModelArrayClient":"Type.Property.AdditionalProperties.IsModelArray","type.property.additionalproperties.IsModelArrayClient.get":"Type.Property.AdditionalProperties.IsModelArray.get","type.property.additionalproperties.IsModelArrayClient.getWithResponse":"Type.Property.AdditionalProperties.IsModelArray.get","type.property.additionalproperties.IsModelArrayClient.put":"Type.Property.AdditionalProperties.IsModelArray.put","type.property.additionalproperties.IsModelArrayClient.putWithResponse":"Type.Property.AdditionalProperties.IsModelArray.put","type.property.additionalproperties.IsModelAsyncClient":"Type.Property.AdditionalProperties.IsModel","type.property.additionalproperties.IsModelAsyncClient.get":"Type.Property.AdditionalProperties.IsModel.get","type.property.additionalproperties.IsModelAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsModel.get","type.property.additionalproperties.IsModelAsyncClient.put":"Type.Property.AdditionalProperties.IsModel.put","type.property.additionalproperties.IsModelAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsModel.put","type.property.additionalproperties.IsModelClient":"Type.Property.AdditionalProperties.IsModel","type.property.additionalproperties.IsModelClient.get":"Type.Property.AdditionalProperties.IsModel.get","type.property.additionalproperties.IsModelClient.getWithResponse":"Type.Property.AdditionalProperties.IsModel.get","type.property.additionalproperties.IsModelClient.put":"Type.Property.AdditionalProperties.IsModel.put","type.property.additionalproperties.IsModelClient.putWithResponse":"Type.Property.AdditionalProperties.IsModel.put","type.property.additionalproperties.IsStringAsyncClient":"Type.Property.AdditionalProperties.IsString","type.property.additionalproperties.IsStringAsyncClient.get":"Type.Property.AdditionalProperties.IsString.get","type.property.additionalproperties.IsStringAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsString.get","type.property.additionalproperties.IsStringAsyncClient.put":"Type.Property.AdditionalProperties.IsString.put","type.property.additionalproperties.IsStringAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsString.put","type.property.additionalproperties.IsStringClient":"Type.Property.AdditionalProperties.IsString","type.property.additionalproperties.IsStringClient.get":"Type.Property.AdditionalProperties.IsString.get","type.property.additionalproperties.IsStringClient.getWithResponse":"Type.Property.AdditionalProperties.IsString.get","type.property.additionalproperties.IsStringClient.put":"Type.Property.AdditionalProperties.IsString.put","type.property.additionalproperties.IsStringClient.putWithResponse":"Type.Property.AdditionalProperties.IsString.put","type.property.additionalproperties.IsUnknownAsyncClient":"Type.Property.AdditionalProperties.IsUnknown","type.property.additionalproperties.IsUnknownAsyncClient.get":"Type.Property.AdditionalProperties.IsUnknown.get","type.property.additionalproperties.IsUnknownAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsUnknown.get","type.property.additionalproperties.IsUnknownAsyncClient.put":"Type.Property.AdditionalProperties.IsUnknown.put","type.property.additionalproperties.IsUnknownAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsUnknown.put","type.property.additionalproperties.IsUnknownClient":"Type.Property.AdditionalProperties.IsUnknown","type.property.additionalproperties.IsUnknownClient.get":"Type.Property.AdditionalProperties.IsUnknown.get","type.property.additionalproperties.IsUnknownClient.getWithResponse":"Type.Property.AdditionalProperties.IsUnknown.get","type.property.additionalproperties.IsUnknownClient.put":"Type.Property.AdditionalProperties.IsUnknown.put","type.property.additionalproperties.IsUnknownClient.putWithResponse":"Type.Property.AdditionalProperties.IsUnknown.put","type.property.additionalproperties.IsUnknownDerivedAsyncClient":"Type.Property.AdditionalProperties.IsUnknownDerived","type.property.additionalproperties.IsUnknownDerivedAsyncClient.get":"Type.Property.AdditionalProperties.IsUnknownDerived.get","type.property.additionalproperties.IsUnknownDerivedAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsUnknownDerived.get","type.property.additionalproperties.IsUnknownDerivedAsyncClient.put":"Type.Property.AdditionalProperties.IsUnknownDerived.put","type.property.additionalproperties.IsUnknownDerivedAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsUnknownDerived.put","type.property.additionalproperties.IsUnknownDerivedClient":"Type.Property.AdditionalProperties.IsUnknownDerived","type.property.additionalproperties.IsUnknownDerivedClient.get":"Type.Property.AdditionalProperties.IsUnknownDerived.get","type.property.additionalproperties.IsUnknownDerivedClient.getWithResponse":"Type.Property.AdditionalProperties.IsUnknownDerived.get","type.property.additionalproperties.IsUnknownDerivedClient.put":"Type.Property.AdditionalProperties.IsUnknownDerived.put","type.property.additionalproperties.IsUnknownDerivedClient.putWithResponse":"Type.Property.AdditionalProperties.IsUnknownDerived.put","type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient":"Type.Property.AdditionalProperties.IsUnknownDiscriminated","type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.get":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.get","type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.get","type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.put":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.put","type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.put","type.property.additionalproperties.IsUnknownDiscriminatedClient":"Type.Property.AdditionalProperties.IsUnknownDiscriminated","type.property.additionalproperties.IsUnknownDiscriminatedClient.get":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.get","type.property.additionalproperties.IsUnknownDiscriminatedClient.getWithResponse":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.get","type.property.additionalproperties.IsUnknownDiscriminatedClient.put":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.put","type.property.additionalproperties.IsUnknownDiscriminatedClient.putWithResponse":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.put","type.property.additionalproperties.MultipleSpreadAsyncClient":"Type.Property.AdditionalProperties.MultipleSpread","type.property.additionalproperties.MultipleSpreadAsyncClient.get":"Type.Property.AdditionalProperties.MultipleSpread.get","type.property.additionalproperties.MultipleSpreadAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.MultipleSpread.get","type.property.additionalproperties.MultipleSpreadAsyncClient.put":"Type.Property.AdditionalProperties.MultipleSpread.put","type.property.additionalproperties.MultipleSpreadAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.MultipleSpread.put","type.property.additionalproperties.MultipleSpreadClient":"Type.Property.AdditionalProperties.MultipleSpread","type.property.additionalproperties.MultipleSpreadClient.get":"Type.Property.AdditionalProperties.MultipleSpread.get","type.property.additionalproperties.MultipleSpreadClient.getWithResponse":"Type.Property.AdditionalProperties.MultipleSpread.get","type.property.additionalproperties.MultipleSpreadClient.put":"Type.Property.AdditionalProperties.MultipleSpread.put","type.property.additionalproperties.MultipleSpreadClient.putWithResponse":"Type.Property.AdditionalProperties.MultipleSpread.put","type.property.additionalproperties.SpreadDifferentFloatAsyncClient":"Type.Property.AdditionalProperties.SpreadDifferentFloat","type.property.additionalproperties.SpreadDifferentFloatAsyncClient.get":"Type.Property.AdditionalProperties.SpreadDifferentFloat.get","type.property.additionalproperties.SpreadDifferentFloatAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentFloat.get","type.property.additionalproperties.SpreadDifferentFloatAsyncClient.put":"Type.Property.AdditionalProperties.SpreadDifferentFloat.put","type.property.additionalproperties.SpreadDifferentFloatAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentFloat.put","type.property.additionalproperties.SpreadDifferentFloatClient":"Type.Property.AdditionalProperties.SpreadDifferentFloat","type.property.additionalproperties.SpreadDifferentFloatClient.get":"Type.Property.AdditionalProperties.SpreadDifferentFloat.get","type.property.additionalproperties.SpreadDifferentFloatClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentFloat.get","type.property.additionalproperties.SpreadDifferentFloatClient.put":"Type.Property.AdditionalProperties.SpreadDifferentFloat.put","type.property.additionalproperties.SpreadDifferentFloatClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentFloat.put","type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient":"Type.Property.AdditionalProperties.SpreadDifferentModelArray","type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.get":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.get","type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.get","type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.put":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.put","type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.put","type.property.additionalproperties.SpreadDifferentModelArrayClient":"Type.Property.AdditionalProperties.SpreadDifferentModelArray","type.property.additionalproperties.SpreadDifferentModelArrayClient.get":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.get","type.property.additionalproperties.SpreadDifferentModelArrayClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.get","type.property.additionalproperties.SpreadDifferentModelArrayClient.put":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.put","type.property.additionalproperties.SpreadDifferentModelArrayClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.put","type.property.additionalproperties.SpreadDifferentModelAsyncClient":"Type.Property.AdditionalProperties.SpreadDifferentModel","type.property.additionalproperties.SpreadDifferentModelAsyncClient.get":"Type.Property.AdditionalProperties.SpreadDifferentModel.get","type.property.additionalproperties.SpreadDifferentModelAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModel.get","type.property.additionalproperties.SpreadDifferentModelAsyncClient.put":"Type.Property.AdditionalProperties.SpreadDifferentModel.put","type.property.additionalproperties.SpreadDifferentModelAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModel.put","type.property.additionalproperties.SpreadDifferentModelClient":"Type.Property.AdditionalProperties.SpreadDifferentModel","type.property.additionalproperties.SpreadDifferentModelClient.get":"Type.Property.AdditionalProperties.SpreadDifferentModel.get","type.property.additionalproperties.SpreadDifferentModelClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModel.get","type.property.additionalproperties.SpreadDifferentModelClient.put":"Type.Property.AdditionalProperties.SpreadDifferentModel.put","type.property.additionalproperties.SpreadDifferentModelClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModel.put","type.property.additionalproperties.SpreadDifferentStringAsyncClient":"Type.Property.AdditionalProperties.SpreadDifferentString","type.property.additionalproperties.SpreadDifferentStringAsyncClient.get":"Type.Property.AdditionalProperties.SpreadDifferentString.get","type.property.additionalproperties.SpreadDifferentStringAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentString.get","type.property.additionalproperties.SpreadDifferentStringAsyncClient.put":"Type.Property.AdditionalProperties.SpreadDifferentString.put","type.property.additionalproperties.SpreadDifferentStringAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentString.put","type.property.additionalproperties.SpreadDifferentStringClient":"Type.Property.AdditionalProperties.SpreadDifferentString","type.property.additionalproperties.SpreadDifferentStringClient.get":"Type.Property.AdditionalProperties.SpreadDifferentString.get","type.property.additionalproperties.SpreadDifferentStringClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentString.get","type.property.additionalproperties.SpreadDifferentStringClient.put":"Type.Property.AdditionalProperties.SpreadDifferentString.put","type.property.additionalproperties.SpreadDifferentStringClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentString.put","type.property.additionalproperties.SpreadFloatAsyncClient":"Type.Property.AdditionalProperties.SpreadFloat","type.property.additionalproperties.SpreadFloatAsyncClient.get":"Type.Property.AdditionalProperties.SpreadFloat.get","type.property.additionalproperties.SpreadFloatAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadFloat.get","type.property.additionalproperties.SpreadFloatAsyncClient.put":"Type.Property.AdditionalProperties.SpreadFloat.put","type.property.additionalproperties.SpreadFloatAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadFloat.put","type.property.additionalproperties.SpreadFloatClient":"Type.Property.AdditionalProperties.SpreadFloat","type.property.additionalproperties.SpreadFloatClient.get":"Type.Property.AdditionalProperties.SpreadFloat.get","type.property.additionalproperties.SpreadFloatClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadFloat.get","type.property.additionalproperties.SpreadFloatClient.put":"Type.Property.AdditionalProperties.SpreadFloat.put","type.property.additionalproperties.SpreadFloatClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadFloat.put","type.property.additionalproperties.SpreadModelArrayAsyncClient":"Type.Property.AdditionalProperties.SpreadModelArray","type.property.additionalproperties.SpreadModelArrayAsyncClient.get":"Type.Property.AdditionalProperties.SpreadModelArray.get","type.property.additionalproperties.SpreadModelArrayAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadModelArray.get","type.property.additionalproperties.SpreadModelArrayAsyncClient.put":"Type.Property.AdditionalProperties.SpreadModelArray.put","type.property.additionalproperties.SpreadModelArrayAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadModelArray.put","type.property.additionalproperties.SpreadModelArrayClient":"Type.Property.AdditionalProperties.SpreadModelArray","type.property.additionalproperties.SpreadModelArrayClient.get":"Type.Property.AdditionalProperties.SpreadModelArray.get","type.property.additionalproperties.SpreadModelArrayClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadModelArray.get","type.property.additionalproperties.SpreadModelArrayClient.put":"Type.Property.AdditionalProperties.SpreadModelArray.put","type.property.additionalproperties.SpreadModelArrayClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadModelArray.put","type.property.additionalproperties.SpreadModelAsyncClient":"Type.Property.AdditionalProperties.SpreadModel","type.property.additionalproperties.SpreadModelAsyncClient.get":"Type.Property.AdditionalProperties.SpreadModel.get","type.property.additionalproperties.SpreadModelAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadModel.get","type.property.additionalproperties.SpreadModelAsyncClient.put":"Type.Property.AdditionalProperties.SpreadModel.put","type.property.additionalproperties.SpreadModelAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadModel.put","type.property.additionalproperties.SpreadModelClient":"Type.Property.AdditionalProperties.SpreadModel","type.property.additionalproperties.SpreadModelClient.get":"Type.Property.AdditionalProperties.SpreadModel.get","type.property.additionalproperties.SpreadModelClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadModel.get","type.property.additionalproperties.SpreadModelClient.put":"Type.Property.AdditionalProperties.SpreadModel.put","type.property.additionalproperties.SpreadModelClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadModel.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.get":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.put":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.get":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.put":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.get":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.put":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.get":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.put":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.get":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.put":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.get":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.put":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put","type.property.additionalproperties.SpreadRecordUnionAsyncClient":"Type.Property.AdditionalProperties.SpreadRecordUnion","type.property.additionalproperties.SpreadRecordUnionAsyncClient.get":"Type.Property.AdditionalProperties.SpreadRecordUnion.get","type.property.additionalproperties.SpreadRecordUnionAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordUnion.get","type.property.additionalproperties.SpreadRecordUnionAsyncClient.put":"Type.Property.AdditionalProperties.SpreadRecordUnion.put","type.property.additionalproperties.SpreadRecordUnionAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordUnion.put","type.property.additionalproperties.SpreadRecordUnionClient":"Type.Property.AdditionalProperties.SpreadRecordUnion","type.property.additionalproperties.SpreadRecordUnionClient.get":"Type.Property.AdditionalProperties.SpreadRecordUnion.get","type.property.additionalproperties.SpreadRecordUnionClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordUnion.get","type.property.additionalproperties.SpreadRecordUnionClient.put":"Type.Property.AdditionalProperties.SpreadRecordUnion.put","type.property.additionalproperties.SpreadRecordUnionClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordUnion.put","type.property.additionalproperties.SpreadStringAsyncClient":"Type.Property.AdditionalProperties.SpreadString","type.property.additionalproperties.SpreadStringAsyncClient.get":"Type.Property.AdditionalProperties.SpreadString.get","type.property.additionalproperties.SpreadStringAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadString.get","type.property.additionalproperties.SpreadStringAsyncClient.put":"Type.Property.AdditionalProperties.SpreadString.put","type.property.additionalproperties.SpreadStringAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadString.put","type.property.additionalproperties.SpreadStringClient":"Type.Property.AdditionalProperties.SpreadString","type.property.additionalproperties.SpreadStringClient.get":"Type.Property.AdditionalProperties.SpreadString.get","type.property.additionalproperties.SpreadStringClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadString.get","type.property.additionalproperties.SpreadStringClient.put":"Type.Property.AdditionalProperties.SpreadString.put","type.property.additionalproperties.SpreadStringClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadString.put","type.property.additionalproperties.models.DifferentSpreadFloatDerived":"Type.Property.AdditionalProperties.DifferentSpreadFloatDerived","type.property.additionalproperties.models.DifferentSpreadFloatRecord":"Type.Property.AdditionalProperties.DifferentSpreadFloatRecord","type.property.additionalproperties.models.DifferentSpreadModelArrayDerived":"Type.Property.AdditionalProperties.DifferentSpreadModelArrayDerived","type.property.additionalproperties.models.DifferentSpreadModelArrayRecord":"Type.Property.AdditionalProperties.DifferentSpreadModelArrayRecord","type.property.additionalproperties.models.DifferentSpreadModelDerived":"Type.Property.AdditionalProperties.DifferentSpreadModelDerived","type.property.additionalproperties.models.DifferentSpreadModelRecord":"Type.Property.AdditionalProperties.DifferentSpreadModelRecord","type.property.additionalproperties.models.DifferentSpreadStringDerived":"Type.Property.AdditionalProperties.DifferentSpreadStringDerived","type.property.additionalproperties.models.DifferentSpreadStringRecord":"Type.Property.AdditionalProperties.DifferentSpreadStringRecord","type.property.additionalproperties.models.ExtendsFloatAdditionalProperties":"Type.Property.AdditionalProperties.ExtendsFloatAdditionalProperties","type.property.additionalproperties.models.ExtendsModelAdditionalProperties":"Type.Property.AdditionalProperties.ExtendsModelAdditionalProperties","type.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties":"Type.Property.AdditionalProperties.ExtendsModelArrayAdditionalProperties","type.property.additionalproperties.models.ExtendsStringAdditionalProperties":"Type.Property.AdditionalProperties.ExtendsStringAdditionalProperties","type.property.additionalproperties.models.ExtendsUnknownAdditionalProperties":"Type.Property.AdditionalProperties.ExtendsUnknownAdditionalProperties","type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDerived":"Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDerived","type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminated":"Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDiscriminated","type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived":"Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived","type.property.additionalproperties.models.IsFloatAdditionalProperties":"Type.Property.AdditionalProperties.IsFloatAdditionalProperties","type.property.additionalproperties.models.IsModelAdditionalProperties":"Type.Property.AdditionalProperties.IsModelAdditionalProperties","type.property.additionalproperties.models.IsModelArrayAdditionalProperties":"Type.Property.AdditionalProperties.IsModelArrayAdditionalProperties","type.property.additionalproperties.models.IsStringAdditionalProperties":"Type.Property.AdditionalProperties.IsStringAdditionalProperties","type.property.additionalproperties.models.IsUnknownAdditionalProperties":"Type.Property.AdditionalProperties.IsUnknownAdditionalProperties","type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDerived":"Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDerived","type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminated":"Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDiscriminated","type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminatedDerived":"Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDiscriminatedDerived","type.property.additionalproperties.models.ModelForRecord":"Type.Property.AdditionalProperties.ModelForRecord","type.property.additionalproperties.models.MultipleSpreadRecord":"Type.Property.AdditionalProperties.MultipleSpreadRecord","type.property.additionalproperties.models.SpreadFloatRecord":"Type.Property.AdditionalProperties.SpreadFloatRecord","type.property.additionalproperties.models.SpreadModelArrayRecord":"Type.Property.AdditionalProperties.SpreadModelArrayRecord","type.property.additionalproperties.models.SpreadModelRecord":"Type.Property.AdditionalProperties.SpreadModelRecord","type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion":"Type.Property.AdditionalProperties.SpreadRecordForNonDiscriminatedUnion","type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion2":"Type.Property.AdditionalProperties.SpreadRecordForNonDiscriminatedUnion2","type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion3":"Type.Property.AdditionalProperties.SpreadRecordForNonDiscriminatedUnion3","type.property.additionalproperties.models.SpreadRecordForUnion":"Type.Property.AdditionalProperties.SpreadRecordForUnion","type.property.additionalproperties.models.SpreadStringRecord":"Type.Property.AdditionalProperties.SpreadStringRecord","type.property.additionalproperties.models.WidgetData0":"Type.Property.AdditionalProperties.WidgetData0","type.property.additionalproperties.models.WidgetData1":"Type.Property.AdditionalProperties.WidgetData1","type.property.additionalproperties.models.WidgetData2":"Type.Property.AdditionalProperties.WidgetData2"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/property/additionalproperties/AdditionalPropertiesClientBuilder.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringClient.java","src/main/java/type/property/additionalproperties/ExtendsFloatAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsFloatClient.java","src/main/java/type/property/additionalproperties/ExtendsModelArrayAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsModelArrayClient.java","src/main/java/type/property/additionalproperties/ExtendsModelAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsModelClient.java","src/main/java/type/property/additionalproperties/ExtendsStringAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsStringClient.java","src/main/java/type/property/additionalproperties/ExtendsUnknownAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsUnknownClient.java","src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedClient.java","src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedClient.java","src/main/java/type/property/additionalproperties/IsFloatAsyncClient.java","src/main/java/type/property/additionalproperties/IsFloatClient.java","src/main/java/type/property/additionalproperties/IsModelArrayAsyncClient.java","src/main/java/type/property/additionalproperties/IsModelArrayClient.java","src/main/java/type/property/additionalproperties/IsModelAsyncClient.java","src/main/java/type/property/additionalproperties/IsModelClient.java","src/main/java/type/property/additionalproperties/IsStringAsyncClient.java","src/main/java/type/property/additionalproperties/IsStringClient.java","src/main/java/type/property/additionalproperties/IsUnknownAsyncClient.java","src/main/java/type/property/additionalproperties/IsUnknownClient.java","src/main/java/type/property/additionalproperties/IsUnknownDerivedAsyncClient.java","src/main/java/type/property/additionalproperties/IsUnknownDerivedClient.java","src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedAsyncClient.java","src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedClient.java","src/main/java/type/property/additionalproperties/MultipleSpreadAsyncClient.java","src/main/java/type/property/additionalproperties/MultipleSpreadClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentFloatAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentFloatClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentModelAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentModelClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentStringAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentStringClient.java","src/main/java/type/property/additionalproperties/SpreadFloatAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadFloatClient.java","src/main/java/type/property/additionalproperties/SpreadModelArrayAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadModelArrayClient.java","src/main/java/type/property/additionalproperties/SpreadModelAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadModelClient.java","src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2AsyncClient.java","src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2Client.java","src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3AsyncClient.java","src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3Client.java","src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionClient.java","src/main/java/type/property/additionalproperties/SpreadRecordUnionAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadRecordUnionClient.java","src/main/java/type/property/additionalproperties/SpreadStringAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadStringClient.java","src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadFloatsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelArraysImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadStringsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsFloatsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsModelArraysImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsModelsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsStringsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDerivedsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDiscriminatedsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownsImpl.java","src/main/java/type/property/additionalproperties/implementation/IsFloatsImpl.java","src/main/java/type/property/additionalproperties/implementation/IsModelArraysImpl.java","src/main/java/type/property/additionalproperties/implementation/IsModelsImpl.java","src/main/java/type/property/additionalproperties/implementation/IsStringsImpl.java","src/main/java/type/property/additionalproperties/implementation/IsUnknownDerivedsImpl.java","src/main/java/type/property/additionalproperties/implementation/IsUnknownDiscriminatedsImpl.java","src/main/java/type/property/additionalproperties/implementation/IsUnknownsImpl.java","src/main/java/type/property/additionalproperties/implementation/MultipleSpreadsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadDifferentFloatsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelArraysImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadDifferentStringsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadFloatsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadModelArraysImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadModelsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion2sImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion3sImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnionsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadRecordUnionsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadStringsImpl.java","src/main/java/type/property/additionalproperties/implementation/package-info.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatDerived.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatRecord.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayDerived.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayRecord.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadModelDerived.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadModelRecord.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadStringDerived.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadStringRecord.java","src/main/java/type/property/additionalproperties/models/ExtendsFloatAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/ExtendsModelAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/ExtendsModelArrayAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/ExtendsStringAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDerived.java","src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminated.java","src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.java","src/main/java/type/property/additionalproperties/models/IsFloatAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/IsModelAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/IsModelArrayAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/IsStringAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDerived.java","src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminated.java","src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminatedDerived.java","src/main/java/type/property/additionalproperties/models/ModelForRecord.java","src/main/java/type/property/additionalproperties/models/MultipleSpreadRecord.java","src/main/java/type/property/additionalproperties/models/SpreadFloatRecord.java","src/main/java/type/property/additionalproperties/models/SpreadModelArrayRecord.java","src/main/java/type/property/additionalproperties/models/SpreadModelRecord.java","src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion.java","src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion2.java","src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion3.java","src/main/java/type/property/additionalproperties/models/SpreadRecordForUnion.java","src/main/java/type/property/additionalproperties/models/SpreadStringRecord.java","src/main/java/type/property/additionalproperties/models/WidgetData0.java","src/main/java/type/property/additionalproperties/models/WidgetData1.java","src/main/java/type/property/additionalproperties/models/WidgetData2.java","src/main/java/type/property/additionalproperties/models/package-info.java","src/main/java/type/property/additionalproperties/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_apiview_properties.json deleted file mode 100644 index 55a6f1c60f9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_apiview_properties.json +++ /dev/null @@ -1,140 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.property.nullable.BytesAsyncClient": "Type.Property.Nullable.Bytes", - "type.property.nullable.BytesAsyncClient.getNonNull": "Type.Property.Nullable.Bytes.getNonNull", - "type.property.nullable.BytesAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.Bytes.getNonNull", - "type.property.nullable.BytesAsyncClient.getNull": "Type.Property.Nullable.Bytes.getNull", - "type.property.nullable.BytesAsyncClient.getNullWithResponse": "Type.Property.Nullable.Bytes.getNull", - "type.property.nullable.BytesAsyncClient.patchNonNull": "Type.Property.Nullable.Bytes.patchNonNull", - "type.property.nullable.BytesAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.Bytes.patchNonNull", - "type.property.nullable.BytesAsyncClient.patchNull": "Type.Property.Nullable.Bytes.patchNull", - "type.property.nullable.BytesAsyncClient.patchNullWithResponse": "Type.Property.Nullable.Bytes.patchNull", - "type.property.nullable.BytesClient": "Type.Property.Nullable.Bytes", - "type.property.nullable.BytesClient.getNonNull": "Type.Property.Nullable.Bytes.getNonNull", - "type.property.nullable.BytesClient.getNonNullWithResponse": "Type.Property.Nullable.Bytes.getNonNull", - "type.property.nullable.BytesClient.getNull": "Type.Property.Nullable.Bytes.getNull", - "type.property.nullable.BytesClient.getNullWithResponse": "Type.Property.Nullable.Bytes.getNull", - "type.property.nullable.BytesClient.patchNonNull": "Type.Property.Nullable.Bytes.patchNonNull", - "type.property.nullable.BytesClient.patchNonNullWithResponse": "Type.Property.Nullable.Bytes.patchNonNull", - "type.property.nullable.BytesClient.patchNull": "Type.Property.Nullable.Bytes.patchNull", - "type.property.nullable.BytesClient.patchNullWithResponse": "Type.Property.Nullable.Bytes.patchNull", - "type.property.nullable.CollectionsByteAsyncClient": "Type.Property.Nullable.CollectionsByte", - "type.property.nullable.CollectionsByteAsyncClient.getNonNull": "Type.Property.Nullable.CollectionsByte.getNonNull", - "type.property.nullable.CollectionsByteAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.CollectionsByte.getNonNull", - "type.property.nullable.CollectionsByteAsyncClient.getNull": "Type.Property.Nullable.CollectionsByte.getNull", - "type.property.nullable.CollectionsByteAsyncClient.getNullWithResponse": "Type.Property.Nullable.CollectionsByte.getNull", - "type.property.nullable.CollectionsByteAsyncClient.patchNonNull": "Type.Property.Nullable.CollectionsByte.patchNonNull", - "type.property.nullable.CollectionsByteAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.CollectionsByte.patchNonNull", - "type.property.nullable.CollectionsByteAsyncClient.patchNull": "Type.Property.Nullable.CollectionsByte.patchNull", - "type.property.nullable.CollectionsByteAsyncClient.patchNullWithResponse": "Type.Property.Nullable.CollectionsByte.patchNull", - "type.property.nullable.CollectionsByteClient": "Type.Property.Nullable.CollectionsByte", - "type.property.nullable.CollectionsByteClient.getNonNull": "Type.Property.Nullable.CollectionsByte.getNonNull", - "type.property.nullable.CollectionsByteClient.getNonNullWithResponse": "Type.Property.Nullable.CollectionsByte.getNonNull", - "type.property.nullable.CollectionsByteClient.getNull": "Type.Property.Nullable.CollectionsByte.getNull", - "type.property.nullable.CollectionsByteClient.getNullWithResponse": "Type.Property.Nullable.CollectionsByte.getNull", - "type.property.nullable.CollectionsByteClient.patchNonNull": "Type.Property.Nullable.CollectionsByte.patchNonNull", - "type.property.nullable.CollectionsByteClient.patchNonNullWithResponse": "Type.Property.Nullable.CollectionsByte.patchNonNull", - "type.property.nullable.CollectionsByteClient.patchNull": "Type.Property.Nullable.CollectionsByte.patchNull", - "type.property.nullable.CollectionsByteClient.patchNullWithResponse": "Type.Property.Nullable.CollectionsByte.patchNull", - "type.property.nullable.CollectionsModelAsyncClient": "Type.Property.Nullable.CollectionsModel", - "type.property.nullable.CollectionsModelAsyncClient.getNonNull": "Type.Property.Nullable.CollectionsModel.getNonNull", - "type.property.nullable.CollectionsModelAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.CollectionsModel.getNonNull", - "type.property.nullable.CollectionsModelAsyncClient.getNull": "Type.Property.Nullable.CollectionsModel.getNull", - "type.property.nullable.CollectionsModelAsyncClient.getNullWithResponse": "Type.Property.Nullable.CollectionsModel.getNull", - "type.property.nullable.CollectionsModelAsyncClient.patchNonNull": "Type.Property.Nullable.CollectionsModel.patchNonNull", - "type.property.nullable.CollectionsModelAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.CollectionsModel.patchNonNull", - "type.property.nullable.CollectionsModelAsyncClient.patchNull": "Type.Property.Nullable.CollectionsModel.patchNull", - "type.property.nullable.CollectionsModelAsyncClient.patchNullWithResponse": "Type.Property.Nullable.CollectionsModel.patchNull", - "type.property.nullable.CollectionsModelClient": "Type.Property.Nullable.CollectionsModel", - "type.property.nullable.CollectionsModelClient.getNonNull": "Type.Property.Nullable.CollectionsModel.getNonNull", - "type.property.nullable.CollectionsModelClient.getNonNullWithResponse": "Type.Property.Nullable.CollectionsModel.getNonNull", - "type.property.nullable.CollectionsModelClient.getNull": "Type.Property.Nullable.CollectionsModel.getNull", - "type.property.nullable.CollectionsModelClient.getNullWithResponse": "Type.Property.Nullable.CollectionsModel.getNull", - "type.property.nullable.CollectionsModelClient.patchNonNull": "Type.Property.Nullable.CollectionsModel.patchNonNull", - "type.property.nullable.CollectionsModelClient.patchNonNullWithResponse": "Type.Property.Nullable.CollectionsModel.patchNonNull", - "type.property.nullable.CollectionsModelClient.patchNull": "Type.Property.Nullable.CollectionsModel.patchNull", - "type.property.nullable.CollectionsModelClient.patchNullWithResponse": "Type.Property.Nullable.CollectionsModel.patchNull", - "type.property.nullable.CollectionsStringAsyncClient": "Type.Property.Nullable.CollectionsString", - "type.property.nullable.CollectionsStringAsyncClient.getNonNull": "Type.Property.Nullable.CollectionsString.getNonNull", - "type.property.nullable.CollectionsStringAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.CollectionsString.getNonNull", - "type.property.nullable.CollectionsStringAsyncClient.getNull": "Type.Property.Nullable.CollectionsString.getNull", - "type.property.nullable.CollectionsStringAsyncClient.getNullWithResponse": "Type.Property.Nullable.CollectionsString.getNull", - "type.property.nullable.CollectionsStringAsyncClient.patchNonNull": "Type.Property.Nullable.CollectionsString.patchNonNull", - "type.property.nullable.CollectionsStringAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.CollectionsString.patchNonNull", - "type.property.nullable.CollectionsStringAsyncClient.patchNull": "Type.Property.Nullable.CollectionsString.patchNull", - "type.property.nullable.CollectionsStringAsyncClient.patchNullWithResponse": "Type.Property.Nullable.CollectionsString.patchNull", - "type.property.nullable.CollectionsStringClient": "Type.Property.Nullable.CollectionsString", - "type.property.nullable.CollectionsStringClient.getNonNull": "Type.Property.Nullable.CollectionsString.getNonNull", - "type.property.nullable.CollectionsStringClient.getNonNullWithResponse": "Type.Property.Nullable.CollectionsString.getNonNull", - "type.property.nullable.CollectionsStringClient.getNull": "Type.Property.Nullable.CollectionsString.getNull", - "type.property.nullable.CollectionsStringClient.getNullWithResponse": "Type.Property.Nullable.CollectionsString.getNull", - "type.property.nullable.CollectionsStringClient.patchNonNull": "Type.Property.Nullable.CollectionsString.patchNonNull", - "type.property.nullable.CollectionsStringClient.patchNonNullWithResponse": "Type.Property.Nullable.CollectionsString.patchNonNull", - "type.property.nullable.CollectionsStringClient.patchNull": "Type.Property.Nullable.CollectionsString.patchNull", - "type.property.nullable.CollectionsStringClient.patchNullWithResponse": "Type.Property.Nullable.CollectionsString.patchNull", - "type.property.nullable.DatetimeOperationAsyncClient": "Type.Property.Nullable.Datetime", - "type.property.nullable.DatetimeOperationAsyncClient.getNonNull": "Type.Property.Nullable.Datetime.getNonNull", - "type.property.nullable.DatetimeOperationAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.Datetime.getNonNull", - "type.property.nullable.DatetimeOperationAsyncClient.getNull": "Type.Property.Nullable.Datetime.getNull", - "type.property.nullable.DatetimeOperationAsyncClient.getNullWithResponse": "Type.Property.Nullable.Datetime.getNull", - "type.property.nullable.DatetimeOperationAsyncClient.patchNonNull": "Type.Property.Nullable.Datetime.patchNonNull", - "type.property.nullable.DatetimeOperationAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.Datetime.patchNonNull", - "type.property.nullable.DatetimeOperationAsyncClient.patchNull": "Type.Property.Nullable.Datetime.patchNull", - "type.property.nullable.DatetimeOperationAsyncClient.patchNullWithResponse": "Type.Property.Nullable.Datetime.patchNull", - "type.property.nullable.DatetimeOperationClient": "Type.Property.Nullable.Datetime", - "type.property.nullable.DatetimeOperationClient.getNonNull": "Type.Property.Nullable.Datetime.getNonNull", - "type.property.nullable.DatetimeOperationClient.getNonNullWithResponse": "Type.Property.Nullable.Datetime.getNonNull", - "type.property.nullable.DatetimeOperationClient.getNull": "Type.Property.Nullable.Datetime.getNull", - "type.property.nullable.DatetimeOperationClient.getNullWithResponse": "Type.Property.Nullable.Datetime.getNull", - "type.property.nullable.DatetimeOperationClient.patchNonNull": "Type.Property.Nullable.Datetime.patchNonNull", - "type.property.nullable.DatetimeOperationClient.patchNonNullWithResponse": "Type.Property.Nullable.Datetime.patchNonNull", - "type.property.nullable.DatetimeOperationClient.patchNull": "Type.Property.Nullable.Datetime.patchNull", - "type.property.nullable.DatetimeOperationClient.patchNullWithResponse": "Type.Property.Nullable.Datetime.patchNull", - "type.property.nullable.DurationOperationAsyncClient": "Type.Property.Nullable.Duration", - "type.property.nullable.DurationOperationAsyncClient.getNonNull": "Type.Property.Nullable.Duration.getNonNull", - "type.property.nullable.DurationOperationAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.Duration.getNonNull", - "type.property.nullable.DurationOperationAsyncClient.getNull": "Type.Property.Nullable.Duration.getNull", - "type.property.nullable.DurationOperationAsyncClient.getNullWithResponse": "Type.Property.Nullable.Duration.getNull", - "type.property.nullable.DurationOperationAsyncClient.patchNonNull": "Type.Property.Nullable.Duration.patchNonNull", - "type.property.nullable.DurationOperationAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.Duration.patchNonNull", - "type.property.nullable.DurationOperationAsyncClient.patchNull": "Type.Property.Nullable.Duration.patchNull", - "type.property.nullable.DurationOperationAsyncClient.patchNullWithResponse": "Type.Property.Nullable.Duration.patchNull", - "type.property.nullable.DurationOperationClient": "Type.Property.Nullable.Duration", - "type.property.nullable.DurationOperationClient.getNonNull": "Type.Property.Nullable.Duration.getNonNull", - "type.property.nullable.DurationOperationClient.getNonNullWithResponse": "Type.Property.Nullable.Duration.getNonNull", - "type.property.nullable.DurationOperationClient.getNull": "Type.Property.Nullable.Duration.getNull", - "type.property.nullable.DurationOperationClient.getNullWithResponse": "Type.Property.Nullable.Duration.getNull", - "type.property.nullable.DurationOperationClient.patchNonNull": "Type.Property.Nullable.Duration.patchNonNull", - "type.property.nullable.DurationOperationClient.patchNonNullWithResponse": "Type.Property.Nullable.Duration.patchNonNull", - "type.property.nullable.DurationOperationClient.patchNull": "Type.Property.Nullable.Duration.patchNull", - "type.property.nullable.DurationOperationClient.patchNullWithResponse": "Type.Property.Nullable.Duration.patchNull", - "type.property.nullable.NullableClientBuilder": "Type.Property.Nullable", - "type.property.nullable.StringOperationAsyncClient": "Type.Property.Nullable.String", - "type.property.nullable.StringOperationAsyncClient.getNonNull": "Type.Property.Nullable.String.getNonNull", - "type.property.nullable.StringOperationAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.String.getNonNull", - "type.property.nullable.StringOperationAsyncClient.getNull": "Type.Property.Nullable.String.getNull", - "type.property.nullable.StringOperationAsyncClient.getNullWithResponse": "Type.Property.Nullable.String.getNull", - "type.property.nullable.StringOperationAsyncClient.patchNonNull": "Type.Property.Nullable.String.patchNonNull", - "type.property.nullable.StringOperationAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.String.patchNonNull", - "type.property.nullable.StringOperationAsyncClient.patchNull": "Type.Property.Nullable.String.patchNull", - "type.property.nullable.StringOperationAsyncClient.patchNullWithResponse": "Type.Property.Nullable.String.patchNull", - "type.property.nullable.StringOperationClient": "Type.Property.Nullable.String", - "type.property.nullable.StringOperationClient.getNonNull": "Type.Property.Nullable.String.getNonNull", - "type.property.nullable.StringOperationClient.getNonNullWithResponse": "Type.Property.Nullable.String.getNonNull", - "type.property.nullable.StringOperationClient.getNull": "Type.Property.Nullable.String.getNull", - "type.property.nullable.StringOperationClient.getNullWithResponse": "Type.Property.Nullable.String.getNull", - "type.property.nullable.StringOperationClient.patchNonNull": "Type.Property.Nullable.String.patchNonNull", - "type.property.nullable.StringOperationClient.patchNonNullWithResponse": "Type.Property.Nullable.String.patchNonNull", - "type.property.nullable.StringOperationClient.patchNull": "Type.Property.Nullable.String.patchNull", - "type.property.nullable.StringOperationClient.patchNullWithResponse": "Type.Property.Nullable.String.patchNull", - "type.property.nullable.models.BytesProperty": "Type.Property.Nullable.BytesProperty", - "type.property.nullable.models.CollectionsByteProperty": "Type.Property.Nullable.CollectionsByteProperty", - "type.property.nullable.models.CollectionsModelProperty": "Type.Property.Nullable.CollectionsModelProperty", - "type.property.nullable.models.CollectionsStringProperty": "Type.Property.Nullable.CollectionsStringProperty", - "type.property.nullable.models.DatetimeProperty": "Type.Property.Nullable.DatetimeProperty", - "type.property.nullable.models.DurationProperty": "Type.Property.Nullable.DurationProperty", - "type.property.nullable.models.InnerModel": "Type.Property.Nullable.InnerModel", - "type.property.nullable.models.StringProperty": "Type.Property.Nullable.StringProperty" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_metadata.json deleted file mode 100644 index c2b21d66665..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.property.nullable.BytesAsyncClient":"Type.Property.Nullable.Bytes","type.property.nullable.BytesAsyncClient.getNonNull":"Type.Property.Nullable.Bytes.getNonNull","type.property.nullable.BytesAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.Bytes.getNonNull","type.property.nullable.BytesAsyncClient.getNull":"Type.Property.Nullable.Bytes.getNull","type.property.nullable.BytesAsyncClient.getNullWithResponse":"Type.Property.Nullable.Bytes.getNull","type.property.nullable.BytesAsyncClient.patchNonNull":"Type.Property.Nullable.Bytes.patchNonNull","type.property.nullable.BytesAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.Bytes.patchNonNull","type.property.nullable.BytesAsyncClient.patchNull":"Type.Property.Nullable.Bytes.patchNull","type.property.nullable.BytesAsyncClient.patchNullWithResponse":"Type.Property.Nullable.Bytes.patchNull","type.property.nullable.BytesClient":"Type.Property.Nullable.Bytes","type.property.nullable.BytesClient.getNonNull":"Type.Property.Nullable.Bytes.getNonNull","type.property.nullable.BytesClient.getNonNullWithResponse":"Type.Property.Nullable.Bytes.getNonNull","type.property.nullable.BytesClient.getNull":"Type.Property.Nullable.Bytes.getNull","type.property.nullable.BytesClient.getNullWithResponse":"Type.Property.Nullable.Bytes.getNull","type.property.nullable.BytesClient.patchNonNull":"Type.Property.Nullable.Bytes.patchNonNull","type.property.nullable.BytesClient.patchNonNullWithResponse":"Type.Property.Nullable.Bytes.patchNonNull","type.property.nullable.BytesClient.patchNull":"Type.Property.Nullable.Bytes.patchNull","type.property.nullable.BytesClient.patchNullWithResponse":"Type.Property.Nullable.Bytes.patchNull","type.property.nullable.CollectionsByteAsyncClient":"Type.Property.Nullable.CollectionsByte","type.property.nullable.CollectionsByteAsyncClient.getNonNull":"Type.Property.Nullable.CollectionsByte.getNonNull","type.property.nullable.CollectionsByteAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.CollectionsByte.getNonNull","type.property.nullable.CollectionsByteAsyncClient.getNull":"Type.Property.Nullable.CollectionsByte.getNull","type.property.nullable.CollectionsByteAsyncClient.getNullWithResponse":"Type.Property.Nullable.CollectionsByte.getNull","type.property.nullable.CollectionsByteAsyncClient.patchNonNull":"Type.Property.Nullable.CollectionsByte.patchNonNull","type.property.nullable.CollectionsByteAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.CollectionsByte.patchNonNull","type.property.nullable.CollectionsByteAsyncClient.patchNull":"Type.Property.Nullable.CollectionsByte.patchNull","type.property.nullable.CollectionsByteAsyncClient.patchNullWithResponse":"Type.Property.Nullable.CollectionsByte.patchNull","type.property.nullable.CollectionsByteClient":"Type.Property.Nullable.CollectionsByte","type.property.nullable.CollectionsByteClient.getNonNull":"Type.Property.Nullable.CollectionsByte.getNonNull","type.property.nullable.CollectionsByteClient.getNonNullWithResponse":"Type.Property.Nullable.CollectionsByte.getNonNull","type.property.nullable.CollectionsByteClient.getNull":"Type.Property.Nullable.CollectionsByte.getNull","type.property.nullable.CollectionsByteClient.getNullWithResponse":"Type.Property.Nullable.CollectionsByte.getNull","type.property.nullable.CollectionsByteClient.patchNonNull":"Type.Property.Nullable.CollectionsByte.patchNonNull","type.property.nullable.CollectionsByteClient.patchNonNullWithResponse":"Type.Property.Nullable.CollectionsByte.patchNonNull","type.property.nullable.CollectionsByteClient.patchNull":"Type.Property.Nullable.CollectionsByte.patchNull","type.property.nullable.CollectionsByteClient.patchNullWithResponse":"Type.Property.Nullable.CollectionsByte.patchNull","type.property.nullable.CollectionsModelAsyncClient":"Type.Property.Nullable.CollectionsModel","type.property.nullable.CollectionsModelAsyncClient.getNonNull":"Type.Property.Nullable.CollectionsModel.getNonNull","type.property.nullable.CollectionsModelAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.CollectionsModel.getNonNull","type.property.nullable.CollectionsModelAsyncClient.getNull":"Type.Property.Nullable.CollectionsModel.getNull","type.property.nullable.CollectionsModelAsyncClient.getNullWithResponse":"Type.Property.Nullable.CollectionsModel.getNull","type.property.nullable.CollectionsModelAsyncClient.patchNonNull":"Type.Property.Nullable.CollectionsModel.patchNonNull","type.property.nullable.CollectionsModelAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.CollectionsModel.patchNonNull","type.property.nullable.CollectionsModelAsyncClient.patchNull":"Type.Property.Nullable.CollectionsModel.patchNull","type.property.nullable.CollectionsModelAsyncClient.patchNullWithResponse":"Type.Property.Nullable.CollectionsModel.patchNull","type.property.nullable.CollectionsModelClient":"Type.Property.Nullable.CollectionsModel","type.property.nullable.CollectionsModelClient.getNonNull":"Type.Property.Nullable.CollectionsModel.getNonNull","type.property.nullable.CollectionsModelClient.getNonNullWithResponse":"Type.Property.Nullable.CollectionsModel.getNonNull","type.property.nullable.CollectionsModelClient.getNull":"Type.Property.Nullable.CollectionsModel.getNull","type.property.nullable.CollectionsModelClient.getNullWithResponse":"Type.Property.Nullable.CollectionsModel.getNull","type.property.nullable.CollectionsModelClient.patchNonNull":"Type.Property.Nullable.CollectionsModel.patchNonNull","type.property.nullable.CollectionsModelClient.patchNonNullWithResponse":"Type.Property.Nullable.CollectionsModel.patchNonNull","type.property.nullable.CollectionsModelClient.patchNull":"Type.Property.Nullable.CollectionsModel.patchNull","type.property.nullable.CollectionsModelClient.patchNullWithResponse":"Type.Property.Nullable.CollectionsModel.patchNull","type.property.nullable.CollectionsStringAsyncClient":"Type.Property.Nullable.CollectionsString","type.property.nullable.CollectionsStringAsyncClient.getNonNull":"Type.Property.Nullable.CollectionsString.getNonNull","type.property.nullable.CollectionsStringAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.CollectionsString.getNonNull","type.property.nullable.CollectionsStringAsyncClient.getNull":"Type.Property.Nullable.CollectionsString.getNull","type.property.nullable.CollectionsStringAsyncClient.getNullWithResponse":"Type.Property.Nullable.CollectionsString.getNull","type.property.nullable.CollectionsStringAsyncClient.patchNonNull":"Type.Property.Nullable.CollectionsString.patchNonNull","type.property.nullable.CollectionsStringAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.CollectionsString.patchNonNull","type.property.nullable.CollectionsStringAsyncClient.patchNull":"Type.Property.Nullable.CollectionsString.patchNull","type.property.nullable.CollectionsStringAsyncClient.patchNullWithResponse":"Type.Property.Nullable.CollectionsString.patchNull","type.property.nullable.CollectionsStringClient":"Type.Property.Nullable.CollectionsString","type.property.nullable.CollectionsStringClient.getNonNull":"Type.Property.Nullable.CollectionsString.getNonNull","type.property.nullable.CollectionsStringClient.getNonNullWithResponse":"Type.Property.Nullable.CollectionsString.getNonNull","type.property.nullable.CollectionsStringClient.getNull":"Type.Property.Nullable.CollectionsString.getNull","type.property.nullable.CollectionsStringClient.getNullWithResponse":"Type.Property.Nullable.CollectionsString.getNull","type.property.nullable.CollectionsStringClient.patchNonNull":"Type.Property.Nullable.CollectionsString.patchNonNull","type.property.nullable.CollectionsStringClient.patchNonNullWithResponse":"Type.Property.Nullable.CollectionsString.patchNonNull","type.property.nullable.CollectionsStringClient.patchNull":"Type.Property.Nullable.CollectionsString.patchNull","type.property.nullable.CollectionsStringClient.patchNullWithResponse":"Type.Property.Nullable.CollectionsString.patchNull","type.property.nullable.DatetimeOperationAsyncClient":"Type.Property.Nullable.Datetime","type.property.nullable.DatetimeOperationAsyncClient.getNonNull":"Type.Property.Nullable.Datetime.getNonNull","type.property.nullable.DatetimeOperationAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.Datetime.getNonNull","type.property.nullable.DatetimeOperationAsyncClient.getNull":"Type.Property.Nullable.Datetime.getNull","type.property.nullable.DatetimeOperationAsyncClient.getNullWithResponse":"Type.Property.Nullable.Datetime.getNull","type.property.nullable.DatetimeOperationAsyncClient.patchNonNull":"Type.Property.Nullable.Datetime.patchNonNull","type.property.nullable.DatetimeOperationAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.Datetime.patchNonNull","type.property.nullable.DatetimeOperationAsyncClient.patchNull":"Type.Property.Nullable.Datetime.patchNull","type.property.nullable.DatetimeOperationAsyncClient.patchNullWithResponse":"Type.Property.Nullable.Datetime.patchNull","type.property.nullable.DatetimeOperationClient":"Type.Property.Nullable.Datetime","type.property.nullable.DatetimeOperationClient.getNonNull":"Type.Property.Nullable.Datetime.getNonNull","type.property.nullable.DatetimeOperationClient.getNonNullWithResponse":"Type.Property.Nullable.Datetime.getNonNull","type.property.nullable.DatetimeOperationClient.getNull":"Type.Property.Nullable.Datetime.getNull","type.property.nullable.DatetimeOperationClient.getNullWithResponse":"Type.Property.Nullable.Datetime.getNull","type.property.nullable.DatetimeOperationClient.patchNonNull":"Type.Property.Nullable.Datetime.patchNonNull","type.property.nullable.DatetimeOperationClient.patchNonNullWithResponse":"Type.Property.Nullable.Datetime.patchNonNull","type.property.nullable.DatetimeOperationClient.patchNull":"Type.Property.Nullable.Datetime.patchNull","type.property.nullable.DatetimeOperationClient.patchNullWithResponse":"Type.Property.Nullable.Datetime.patchNull","type.property.nullable.DurationOperationAsyncClient":"Type.Property.Nullable.Duration","type.property.nullable.DurationOperationAsyncClient.getNonNull":"Type.Property.Nullable.Duration.getNonNull","type.property.nullable.DurationOperationAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.Duration.getNonNull","type.property.nullable.DurationOperationAsyncClient.getNull":"Type.Property.Nullable.Duration.getNull","type.property.nullable.DurationOperationAsyncClient.getNullWithResponse":"Type.Property.Nullable.Duration.getNull","type.property.nullable.DurationOperationAsyncClient.patchNonNull":"Type.Property.Nullable.Duration.patchNonNull","type.property.nullable.DurationOperationAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.Duration.patchNonNull","type.property.nullable.DurationOperationAsyncClient.patchNull":"Type.Property.Nullable.Duration.patchNull","type.property.nullable.DurationOperationAsyncClient.patchNullWithResponse":"Type.Property.Nullable.Duration.patchNull","type.property.nullable.DurationOperationClient":"Type.Property.Nullable.Duration","type.property.nullable.DurationOperationClient.getNonNull":"Type.Property.Nullable.Duration.getNonNull","type.property.nullable.DurationOperationClient.getNonNullWithResponse":"Type.Property.Nullable.Duration.getNonNull","type.property.nullable.DurationOperationClient.getNull":"Type.Property.Nullable.Duration.getNull","type.property.nullable.DurationOperationClient.getNullWithResponse":"Type.Property.Nullable.Duration.getNull","type.property.nullable.DurationOperationClient.patchNonNull":"Type.Property.Nullable.Duration.patchNonNull","type.property.nullable.DurationOperationClient.patchNonNullWithResponse":"Type.Property.Nullable.Duration.patchNonNull","type.property.nullable.DurationOperationClient.patchNull":"Type.Property.Nullable.Duration.patchNull","type.property.nullable.DurationOperationClient.patchNullWithResponse":"Type.Property.Nullable.Duration.patchNull","type.property.nullable.NullableClientBuilder":"Type.Property.Nullable","type.property.nullable.StringOperationAsyncClient":"Type.Property.Nullable.String","type.property.nullable.StringOperationAsyncClient.getNonNull":"Type.Property.Nullable.String.getNonNull","type.property.nullable.StringOperationAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.String.getNonNull","type.property.nullable.StringOperationAsyncClient.getNull":"Type.Property.Nullable.String.getNull","type.property.nullable.StringOperationAsyncClient.getNullWithResponse":"Type.Property.Nullable.String.getNull","type.property.nullable.StringOperationAsyncClient.patchNonNull":"Type.Property.Nullable.String.patchNonNull","type.property.nullable.StringOperationAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.String.patchNonNull","type.property.nullable.StringOperationAsyncClient.patchNull":"Type.Property.Nullable.String.patchNull","type.property.nullable.StringOperationAsyncClient.patchNullWithResponse":"Type.Property.Nullable.String.patchNull","type.property.nullable.StringOperationClient":"Type.Property.Nullable.String","type.property.nullable.StringOperationClient.getNonNull":"Type.Property.Nullable.String.getNonNull","type.property.nullable.StringOperationClient.getNonNullWithResponse":"Type.Property.Nullable.String.getNonNull","type.property.nullable.StringOperationClient.getNull":"Type.Property.Nullable.String.getNull","type.property.nullable.StringOperationClient.getNullWithResponse":"Type.Property.Nullable.String.getNull","type.property.nullable.StringOperationClient.patchNonNull":"Type.Property.Nullable.String.patchNonNull","type.property.nullable.StringOperationClient.patchNonNullWithResponse":"Type.Property.Nullable.String.patchNonNull","type.property.nullable.StringOperationClient.patchNull":"Type.Property.Nullable.String.patchNull","type.property.nullable.StringOperationClient.patchNullWithResponse":"Type.Property.Nullable.String.patchNull","type.property.nullable.models.BytesProperty":"Type.Property.Nullable.BytesProperty","type.property.nullable.models.CollectionsByteProperty":"Type.Property.Nullable.CollectionsByteProperty","type.property.nullable.models.CollectionsModelProperty":"Type.Property.Nullable.CollectionsModelProperty","type.property.nullable.models.CollectionsStringProperty":"Type.Property.Nullable.CollectionsStringProperty","type.property.nullable.models.DatetimeProperty":"Type.Property.Nullable.DatetimeProperty","type.property.nullable.models.DurationProperty":"Type.Property.Nullable.DurationProperty","type.property.nullable.models.InnerModel":"Type.Property.Nullable.InnerModel","type.property.nullable.models.StringProperty":"Type.Property.Nullable.StringProperty"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/property/nullable/BytesAsyncClient.java","src/main/java/type/property/nullable/BytesClient.java","src/main/java/type/property/nullable/CollectionsByteAsyncClient.java","src/main/java/type/property/nullable/CollectionsByteClient.java","src/main/java/type/property/nullable/CollectionsModelAsyncClient.java","src/main/java/type/property/nullable/CollectionsModelClient.java","src/main/java/type/property/nullable/CollectionsStringAsyncClient.java","src/main/java/type/property/nullable/CollectionsStringClient.java","src/main/java/type/property/nullable/DatetimeOperationAsyncClient.java","src/main/java/type/property/nullable/DatetimeOperationClient.java","src/main/java/type/property/nullable/DurationOperationAsyncClient.java","src/main/java/type/property/nullable/DurationOperationClient.java","src/main/java/type/property/nullable/NullableClientBuilder.java","src/main/java/type/property/nullable/StringOperationAsyncClient.java","src/main/java/type/property/nullable/StringOperationClient.java","src/main/java/type/property/nullable/implementation/BytesImpl.java","src/main/java/type/property/nullable/implementation/CollectionsBytesImpl.java","src/main/java/type/property/nullable/implementation/CollectionsModelsImpl.java","src/main/java/type/property/nullable/implementation/CollectionsStringsImpl.java","src/main/java/type/property/nullable/implementation/DatetimeOperationsImpl.java","src/main/java/type/property/nullable/implementation/DurationOperationsImpl.java","src/main/java/type/property/nullable/implementation/JsonMergePatchHelper.java","src/main/java/type/property/nullable/implementation/NullableClientImpl.java","src/main/java/type/property/nullable/implementation/StringOperationsImpl.java","src/main/java/type/property/nullable/implementation/package-info.java","src/main/java/type/property/nullable/models/BytesProperty.java","src/main/java/type/property/nullable/models/CollectionsByteProperty.java","src/main/java/type/property/nullable/models/CollectionsModelProperty.java","src/main/java/type/property/nullable/models/CollectionsStringProperty.java","src/main/java/type/property/nullable/models/DatetimeProperty.java","src/main/java/type/property/nullable/models/DurationProperty.java","src/main/java/type/property/nullable/models/InnerModel.java","src/main/java/type/property/nullable/models/StringProperty.java","src/main/java/type/property/nullable/models/package-info.java","src/main/java/type/property/nullable/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_apiview_properties.json deleted file mode 100644 index c584d938ab6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_apiview_properties.json +++ /dev/null @@ -1,317 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.property.optional.BooleanLiteralAsyncClient": "Type.Property.Optional.BooleanLiteral", - "type.property.optional.BooleanLiteralAsyncClient.getAll": "Type.Property.Optional.BooleanLiteral.getAll", - "type.property.optional.BooleanLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.BooleanLiteral.getAll", - "type.property.optional.BooleanLiteralAsyncClient.getDefault": "Type.Property.Optional.BooleanLiteral.getDefault", - "type.property.optional.BooleanLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.BooleanLiteral.getDefault", - "type.property.optional.BooleanLiteralAsyncClient.putAll": "Type.Property.Optional.BooleanLiteral.putAll", - "type.property.optional.BooleanLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.BooleanLiteral.putAll", - "type.property.optional.BooleanLiteralAsyncClient.putDefault": "Type.Property.Optional.BooleanLiteral.putDefault", - "type.property.optional.BooleanLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.BooleanLiteral.putDefault", - "type.property.optional.BooleanLiteralClient": "Type.Property.Optional.BooleanLiteral", - "type.property.optional.BooleanLiteralClient.getAll": "Type.Property.Optional.BooleanLiteral.getAll", - "type.property.optional.BooleanLiteralClient.getAllWithResponse": "Type.Property.Optional.BooleanLiteral.getAll", - "type.property.optional.BooleanLiteralClient.getDefault": "Type.Property.Optional.BooleanLiteral.getDefault", - "type.property.optional.BooleanLiteralClient.getDefaultWithResponse": "Type.Property.Optional.BooleanLiteral.getDefault", - "type.property.optional.BooleanLiteralClient.putAll": "Type.Property.Optional.BooleanLiteral.putAll", - "type.property.optional.BooleanLiteralClient.putAllWithResponse": "Type.Property.Optional.BooleanLiteral.putAll", - "type.property.optional.BooleanLiteralClient.putDefault": "Type.Property.Optional.BooleanLiteral.putDefault", - "type.property.optional.BooleanLiteralClient.putDefaultWithResponse": "Type.Property.Optional.BooleanLiteral.putDefault", - "type.property.optional.BytesAsyncClient": "Type.Property.Optional.Bytes", - "type.property.optional.BytesAsyncClient.getAll": "Type.Property.Optional.Bytes.getAll", - "type.property.optional.BytesAsyncClient.getAllWithResponse": "Type.Property.Optional.Bytes.getAll", - "type.property.optional.BytesAsyncClient.getDefault": "Type.Property.Optional.Bytes.getDefault", - "type.property.optional.BytesAsyncClient.getDefaultWithResponse": "Type.Property.Optional.Bytes.getDefault", - "type.property.optional.BytesAsyncClient.putAll": "Type.Property.Optional.Bytes.putAll", - "type.property.optional.BytesAsyncClient.putAllWithResponse": "Type.Property.Optional.Bytes.putAll", - "type.property.optional.BytesAsyncClient.putDefault": "Type.Property.Optional.Bytes.putDefault", - "type.property.optional.BytesAsyncClient.putDefaultWithResponse": "Type.Property.Optional.Bytes.putDefault", - "type.property.optional.BytesClient": "Type.Property.Optional.Bytes", - "type.property.optional.BytesClient.getAll": "Type.Property.Optional.Bytes.getAll", - "type.property.optional.BytesClient.getAllWithResponse": "Type.Property.Optional.Bytes.getAll", - "type.property.optional.BytesClient.getDefault": "Type.Property.Optional.Bytes.getDefault", - "type.property.optional.BytesClient.getDefaultWithResponse": "Type.Property.Optional.Bytes.getDefault", - "type.property.optional.BytesClient.putAll": "Type.Property.Optional.Bytes.putAll", - "type.property.optional.BytesClient.putAllWithResponse": "Type.Property.Optional.Bytes.putAll", - "type.property.optional.BytesClient.putDefault": "Type.Property.Optional.Bytes.putDefault", - "type.property.optional.BytesClient.putDefaultWithResponse": "Type.Property.Optional.Bytes.putDefault", - "type.property.optional.CollectionsByteAsyncClient": "Type.Property.Optional.CollectionsByte", - "type.property.optional.CollectionsByteAsyncClient.getAll": "Type.Property.Optional.CollectionsByte.getAll", - "type.property.optional.CollectionsByteAsyncClient.getAllWithResponse": "Type.Property.Optional.CollectionsByte.getAll", - "type.property.optional.CollectionsByteAsyncClient.getDefault": "Type.Property.Optional.CollectionsByte.getDefault", - "type.property.optional.CollectionsByteAsyncClient.getDefaultWithResponse": "Type.Property.Optional.CollectionsByte.getDefault", - "type.property.optional.CollectionsByteAsyncClient.putAll": "Type.Property.Optional.CollectionsByte.putAll", - "type.property.optional.CollectionsByteAsyncClient.putAllWithResponse": "Type.Property.Optional.CollectionsByte.putAll", - "type.property.optional.CollectionsByteAsyncClient.putDefault": "Type.Property.Optional.CollectionsByte.putDefault", - "type.property.optional.CollectionsByteAsyncClient.putDefaultWithResponse": "Type.Property.Optional.CollectionsByte.putDefault", - "type.property.optional.CollectionsByteClient": "Type.Property.Optional.CollectionsByte", - "type.property.optional.CollectionsByteClient.getAll": "Type.Property.Optional.CollectionsByte.getAll", - "type.property.optional.CollectionsByteClient.getAllWithResponse": "Type.Property.Optional.CollectionsByte.getAll", - "type.property.optional.CollectionsByteClient.getDefault": "Type.Property.Optional.CollectionsByte.getDefault", - "type.property.optional.CollectionsByteClient.getDefaultWithResponse": "Type.Property.Optional.CollectionsByte.getDefault", - "type.property.optional.CollectionsByteClient.putAll": "Type.Property.Optional.CollectionsByte.putAll", - "type.property.optional.CollectionsByteClient.putAllWithResponse": "Type.Property.Optional.CollectionsByte.putAll", - "type.property.optional.CollectionsByteClient.putDefault": "Type.Property.Optional.CollectionsByte.putDefault", - "type.property.optional.CollectionsByteClient.putDefaultWithResponse": "Type.Property.Optional.CollectionsByte.putDefault", - "type.property.optional.CollectionsModelAsyncClient": "Type.Property.Optional.CollectionsModel", - "type.property.optional.CollectionsModelAsyncClient.getAll": "Type.Property.Optional.CollectionsModel.getAll", - "type.property.optional.CollectionsModelAsyncClient.getAllWithResponse": "Type.Property.Optional.CollectionsModel.getAll", - "type.property.optional.CollectionsModelAsyncClient.getDefault": "Type.Property.Optional.CollectionsModel.getDefault", - "type.property.optional.CollectionsModelAsyncClient.getDefaultWithResponse": "Type.Property.Optional.CollectionsModel.getDefault", - "type.property.optional.CollectionsModelAsyncClient.putAll": "Type.Property.Optional.CollectionsModel.putAll", - "type.property.optional.CollectionsModelAsyncClient.putAllWithResponse": "Type.Property.Optional.CollectionsModel.putAll", - "type.property.optional.CollectionsModelAsyncClient.putDefault": "Type.Property.Optional.CollectionsModel.putDefault", - "type.property.optional.CollectionsModelAsyncClient.putDefaultWithResponse": "Type.Property.Optional.CollectionsModel.putDefault", - "type.property.optional.CollectionsModelClient": "Type.Property.Optional.CollectionsModel", - "type.property.optional.CollectionsModelClient.getAll": "Type.Property.Optional.CollectionsModel.getAll", - "type.property.optional.CollectionsModelClient.getAllWithResponse": "Type.Property.Optional.CollectionsModel.getAll", - "type.property.optional.CollectionsModelClient.getDefault": "Type.Property.Optional.CollectionsModel.getDefault", - "type.property.optional.CollectionsModelClient.getDefaultWithResponse": "Type.Property.Optional.CollectionsModel.getDefault", - "type.property.optional.CollectionsModelClient.putAll": "Type.Property.Optional.CollectionsModel.putAll", - "type.property.optional.CollectionsModelClient.putAllWithResponse": "Type.Property.Optional.CollectionsModel.putAll", - "type.property.optional.CollectionsModelClient.putDefault": "Type.Property.Optional.CollectionsModel.putDefault", - "type.property.optional.CollectionsModelClient.putDefaultWithResponse": "Type.Property.Optional.CollectionsModel.putDefault", - "type.property.optional.DatetimeOperationAsyncClient": "Type.Property.Optional.Datetime", - "type.property.optional.DatetimeOperationAsyncClient.getAll": "Type.Property.Optional.Datetime.getAll", - "type.property.optional.DatetimeOperationAsyncClient.getAllWithResponse": "Type.Property.Optional.Datetime.getAll", - "type.property.optional.DatetimeOperationAsyncClient.getDefault": "Type.Property.Optional.Datetime.getDefault", - "type.property.optional.DatetimeOperationAsyncClient.getDefaultWithResponse": "Type.Property.Optional.Datetime.getDefault", - "type.property.optional.DatetimeOperationAsyncClient.putAll": "Type.Property.Optional.Datetime.putAll", - "type.property.optional.DatetimeOperationAsyncClient.putAllWithResponse": "Type.Property.Optional.Datetime.putAll", - "type.property.optional.DatetimeOperationAsyncClient.putDefault": "Type.Property.Optional.Datetime.putDefault", - "type.property.optional.DatetimeOperationAsyncClient.putDefaultWithResponse": "Type.Property.Optional.Datetime.putDefault", - "type.property.optional.DatetimeOperationClient": "Type.Property.Optional.Datetime", - "type.property.optional.DatetimeOperationClient.getAll": "Type.Property.Optional.Datetime.getAll", - "type.property.optional.DatetimeOperationClient.getAllWithResponse": "Type.Property.Optional.Datetime.getAll", - "type.property.optional.DatetimeOperationClient.getDefault": "Type.Property.Optional.Datetime.getDefault", - "type.property.optional.DatetimeOperationClient.getDefaultWithResponse": "Type.Property.Optional.Datetime.getDefault", - "type.property.optional.DatetimeOperationClient.putAll": "Type.Property.Optional.Datetime.putAll", - "type.property.optional.DatetimeOperationClient.putAllWithResponse": "Type.Property.Optional.Datetime.putAll", - "type.property.optional.DatetimeOperationClient.putDefault": "Type.Property.Optional.Datetime.putDefault", - "type.property.optional.DatetimeOperationClient.putDefaultWithResponse": "Type.Property.Optional.Datetime.putDefault", - "type.property.optional.DurationOperationAsyncClient": "Type.Property.Optional.Duration", - "type.property.optional.DurationOperationAsyncClient.getAll": "Type.Property.Optional.Duration.getAll", - "type.property.optional.DurationOperationAsyncClient.getAllWithResponse": "Type.Property.Optional.Duration.getAll", - "type.property.optional.DurationOperationAsyncClient.getDefault": "Type.Property.Optional.Duration.getDefault", - "type.property.optional.DurationOperationAsyncClient.getDefaultWithResponse": "Type.Property.Optional.Duration.getDefault", - "type.property.optional.DurationOperationAsyncClient.putAll": "Type.Property.Optional.Duration.putAll", - "type.property.optional.DurationOperationAsyncClient.putAllWithResponse": "Type.Property.Optional.Duration.putAll", - "type.property.optional.DurationOperationAsyncClient.putDefault": "Type.Property.Optional.Duration.putDefault", - "type.property.optional.DurationOperationAsyncClient.putDefaultWithResponse": "Type.Property.Optional.Duration.putDefault", - "type.property.optional.DurationOperationClient": "Type.Property.Optional.Duration", - "type.property.optional.DurationOperationClient.getAll": "Type.Property.Optional.Duration.getAll", - "type.property.optional.DurationOperationClient.getAllWithResponse": "Type.Property.Optional.Duration.getAll", - "type.property.optional.DurationOperationClient.getDefault": "Type.Property.Optional.Duration.getDefault", - "type.property.optional.DurationOperationClient.getDefaultWithResponse": "Type.Property.Optional.Duration.getDefault", - "type.property.optional.DurationOperationClient.putAll": "Type.Property.Optional.Duration.putAll", - "type.property.optional.DurationOperationClient.putAllWithResponse": "Type.Property.Optional.Duration.putAll", - "type.property.optional.DurationOperationClient.putDefault": "Type.Property.Optional.Duration.putDefault", - "type.property.optional.DurationOperationClient.putDefaultWithResponse": "Type.Property.Optional.Duration.putDefault", - "type.property.optional.FloatLiteralAsyncClient": "Type.Property.Optional.FloatLiteral", - "type.property.optional.FloatLiteralAsyncClient.getAll": "Type.Property.Optional.FloatLiteral.getAll", - "type.property.optional.FloatLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.FloatLiteral.getAll", - "type.property.optional.FloatLiteralAsyncClient.getDefault": "Type.Property.Optional.FloatLiteral.getDefault", - "type.property.optional.FloatLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.FloatLiteral.getDefault", - "type.property.optional.FloatLiteralAsyncClient.putAll": "Type.Property.Optional.FloatLiteral.putAll", - "type.property.optional.FloatLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.FloatLiteral.putAll", - "type.property.optional.FloatLiteralAsyncClient.putDefault": "Type.Property.Optional.FloatLiteral.putDefault", - "type.property.optional.FloatLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.FloatLiteral.putDefault", - "type.property.optional.FloatLiteralClient": "Type.Property.Optional.FloatLiteral", - "type.property.optional.FloatLiteralClient.getAll": "Type.Property.Optional.FloatLiteral.getAll", - "type.property.optional.FloatLiteralClient.getAllWithResponse": "Type.Property.Optional.FloatLiteral.getAll", - "type.property.optional.FloatLiteralClient.getDefault": "Type.Property.Optional.FloatLiteral.getDefault", - "type.property.optional.FloatLiteralClient.getDefaultWithResponse": "Type.Property.Optional.FloatLiteral.getDefault", - "type.property.optional.FloatLiteralClient.putAll": "Type.Property.Optional.FloatLiteral.putAll", - "type.property.optional.FloatLiteralClient.putAllWithResponse": "Type.Property.Optional.FloatLiteral.putAll", - "type.property.optional.FloatLiteralClient.putDefault": "Type.Property.Optional.FloatLiteral.putDefault", - "type.property.optional.FloatLiteralClient.putDefaultWithResponse": "Type.Property.Optional.FloatLiteral.putDefault", - "type.property.optional.IntLiteralAsyncClient": "Type.Property.Optional.IntLiteral", - "type.property.optional.IntLiteralAsyncClient.getAll": "Type.Property.Optional.IntLiteral.getAll", - "type.property.optional.IntLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.IntLiteral.getAll", - "type.property.optional.IntLiteralAsyncClient.getDefault": "Type.Property.Optional.IntLiteral.getDefault", - "type.property.optional.IntLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.IntLiteral.getDefault", - "type.property.optional.IntLiteralAsyncClient.putAll": "Type.Property.Optional.IntLiteral.putAll", - "type.property.optional.IntLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.IntLiteral.putAll", - "type.property.optional.IntLiteralAsyncClient.putDefault": "Type.Property.Optional.IntLiteral.putDefault", - "type.property.optional.IntLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.IntLiteral.putDefault", - "type.property.optional.IntLiteralClient": "Type.Property.Optional.IntLiteral", - "type.property.optional.IntLiteralClient.getAll": "Type.Property.Optional.IntLiteral.getAll", - "type.property.optional.IntLiteralClient.getAllWithResponse": "Type.Property.Optional.IntLiteral.getAll", - "type.property.optional.IntLiteralClient.getDefault": "Type.Property.Optional.IntLiteral.getDefault", - "type.property.optional.IntLiteralClient.getDefaultWithResponse": "Type.Property.Optional.IntLiteral.getDefault", - "type.property.optional.IntLiteralClient.putAll": "Type.Property.Optional.IntLiteral.putAll", - "type.property.optional.IntLiteralClient.putAllWithResponse": "Type.Property.Optional.IntLiteral.putAll", - "type.property.optional.IntLiteralClient.putDefault": "Type.Property.Optional.IntLiteral.putDefault", - "type.property.optional.IntLiteralClient.putDefaultWithResponse": "Type.Property.Optional.IntLiteral.putDefault", - "type.property.optional.OptionalClientBuilder": "Type.Property.Optional", - "type.property.optional.PlainDateAsyncClient": "Type.Property.Optional.PlainDate", - "type.property.optional.PlainDateAsyncClient.getAll": "Type.Property.Optional.PlainDate.getAll", - "type.property.optional.PlainDateAsyncClient.getAllWithResponse": "Type.Property.Optional.PlainDate.getAll", - "type.property.optional.PlainDateAsyncClient.getDefault": "Type.Property.Optional.PlainDate.getDefault", - "type.property.optional.PlainDateAsyncClient.getDefaultWithResponse": "Type.Property.Optional.PlainDate.getDefault", - "type.property.optional.PlainDateAsyncClient.putAll": "Type.Property.Optional.PlainDate.putAll", - "type.property.optional.PlainDateAsyncClient.putAllWithResponse": "Type.Property.Optional.PlainDate.putAll", - "type.property.optional.PlainDateAsyncClient.putDefault": "Type.Property.Optional.PlainDate.putDefault", - "type.property.optional.PlainDateAsyncClient.putDefaultWithResponse": "Type.Property.Optional.PlainDate.putDefault", - "type.property.optional.PlainDateClient": "Type.Property.Optional.PlainDate", - "type.property.optional.PlainDateClient.getAll": "Type.Property.Optional.PlainDate.getAll", - "type.property.optional.PlainDateClient.getAllWithResponse": "Type.Property.Optional.PlainDate.getAll", - "type.property.optional.PlainDateClient.getDefault": "Type.Property.Optional.PlainDate.getDefault", - "type.property.optional.PlainDateClient.getDefaultWithResponse": "Type.Property.Optional.PlainDate.getDefault", - "type.property.optional.PlainDateClient.putAll": "Type.Property.Optional.PlainDate.putAll", - "type.property.optional.PlainDateClient.putAllWithResponse": "Type.Property.Optional.PlainDate.putAll", - "type.property.optional.PlainDateClient.putDefault": "Type.Property.Optional.PlainDate.putDefault", - "type.property.optional.PlainDateClient.putDefaultWithResponse": "Type.Property.Optional.PlainDate.putDefault", - "type.property.optional.PlainTimeAsyncClient": "Type.Property.Optional.PlainTime", - "type.property.optional.PlainTimeAsyncClient.getAll": "Type.Property.Optional.PlainTime.getAll", - "type.property.optional.PlainTimeAsyncClient.getAllWithResponse": "Type.Property.Optional.PlainTime.getAll", - "type.property.optional.PlainTimeAsyncClient.getDefault": "Type.Property.Optional.PlainTime.getDefault", - "type.property.optional.PlainTimeAsyncClient.getDefaultWithResponse": "Type.Property.Optional.PlainTime.getDefault", - "type.property.optional.PlainTimeAsyncClient.putAll": "Type.Property.Optional.PlainTime.putAll", - "type.property.optional.PlainTimeAsyncClient.putAllWithResponse": "Type.Property.Optional.PlainTime.putAll", - "type.property.optional.PlainTimeAsyncClient.putDefault": "Type.Property.Optional.PlainTime.putDefault", - "type.property.optional.PlainTimeAsyncClient.putDefaultWithResponse": "Type.Property.Optional.PlainTime.putDefault", - "type.property.optional.PlainTimeClient": "Type.Property.Optional.PlainTime", - "type.property.optional.PlainTimeClient.getAll": "Type.Property.Optional.PlainTime.getAll", - "type.property.optional.PlainTimeClient.getAllWithResponse": "Type.Property.Optional.PlainTime.getAll", - "type.property.optional.PlainTimeClient.getDefault": "Type.Property.Optional.PlainTime.getDefault", - "type.property.optional.PlainTimeClient.getDefaultWithResponse": "Type.Property.Optional.PlainTime.getDefault", - "type.property.optional.PlainTimeClient.putAll": "Type.Property.Optional.PlainTime.putAll", - "type.property.optional.PlainTimeClient.putAllWithResponse": "Type.Property.Optional.PlainTime.putAll", - "type.property.optional.PlainTimeClient.putDefault": "Type.Property.Optional.PlainTime.putDefault", - "type.property.optional.PlainTimeClient.putDefaultWithResponse": "Type.Property.Optional.PlainTime.putDefault", - "type.property.optional.RequiredAndOptionalAsyncClient": "Type.Property.Optional.RequiredAndOptional", - "type.property.optional.RequiredAndOptionalAsyncClient.getAll": "Type.Property.Optional.RequiredAndOptional.getAll", - "type.property.optional.RequiredAndOptionalAsyncClient.getAllWithResponse": "Type.Property.Optional.RequiredAndOptional.getAll", - "type.property.optional.RequiredAndOptionalAsyncClient.getRequiredOnly": "Type.Property.Optional.RequiredAndOptional.getRequiredOnly", - "type.property.optional.RequiredAndOptionalAsyncClient.getRequiredOnlyWithResponse": "Type.Property.Optional.RequiredAndOptional.getRequiredOnly", - "type.property.optional.RequiredAndOptionalAsyncClient.putAll": "Type.Property.Optional.RequiredAndOptional.putAll", - "type.property.optional.RequiredAndOptionalAsyncClient.putAllWithResponse": "Type.Property.Optional.RequiredAndOptional.putAll", - "type.property.optional.RequiredAndOptionalAsyncClient.putRequiredOnly": "Type.Property.Optional.RequiredAndOptional.putRequiredOnly", - "type.property.optional.RequiredAndOptionalAsyncClient.putRequiredOnlyWithResponse": "Type.Property.Optional.RequiredAndOptional.putRequiredOnly", - "type.property.optional.RequiredAndOptionalClient": "Type.Property.Optional.RequiredAndOptional", - "type.property.optional.RequiredAndOptionalClient.getAll": "Type.Property.Optional.RequiredAndOptional.getAll", - "type.property.optional.RequiredAndOptionalClient.getAllWithResponse": "Type.Property.Optional.RequiredAndOptional.getAll", - "type.property.optional.RequiredAndOptionalClient.getRequiredOnly": "Type.Property.Optional.RequiredAndOptional.getRequiredOnly", - "type.property.optional.RequiredAndOptionalClient.getRequiredOnlyWithResponse": "Type.Property.Optional.RequiredAndOptional.getRequiredOnly", - "type.property.optional.RequiredAndOptionalClient.putAll": "Type.Property.Optional.RequiredAndOptional.putAll", - "type.property.optional.RequiredAndOptionalClient.putAllWithResponse": "Type.Property.Optional.RequiredAndOptional.putAll", - "type.property.optional.RequiredAndOptionalClient.putRequiredOnly": "Type.Property.Optional.RequiredAndOptional.putRequiredOnly", - "type.property.optional.RequiredAndOptionalClient.putRequiredOnlyWithResponse": "Type.Property.Optional.RequiredAndOptional.putRequiredOnly", - "type.property.optional.StringLiteralAsyncClient": "Type.Property.Optional.StringLiteral", - "type.property.optional.StringLiteralAsyncClient.getAll": "Type.Property.Optional.StringLiteral.getAll", - "type.property.optional.StringLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.StringLiteral.getAll", - "type.property.optional.StringLiteralAsyncClient.getDefault": "Type.Property.Optional.StringLiteral.getDefault", - "type.property.optional.StringLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.StringLiteral.getDefault", - "type.property.optional.StringLiteralAsyncClient.putAll": "Type.Property.Optional.StringLiteral.putAll", - "type.property.optional.StringLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.StringLiteral.putAll", - "type.property.optional.StringLiteralAsyncClient.putDefault": "Type.Property.Optional.StringLiteral.putDefault", - "type.property.optional.StringLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.StringLiteral.putDefault", - "type.property.optional.StringLiteralClient": "Type.Property.Optional.StringLiteral", - "type.property.optional.StringLiteralClient.getAll": "Type.Property.Optional.StringLiteral.getAll", - "type.property.optional.StringLiteralClient.getAllWithResponse": "Type.Property.Optional.StringLiteral.getAll", - "type.property.optional.StringLiteralClient.getDefault": "Type.Property.Optional.StringLiteral.getDefault", - "type.property.optional.StringLiteralClient.getDefaultWithResponse": "Type.Property.Optional.StringLiteral.getDefault", - "type.property.optional.StringLiteralClient.putAll": "Type.Property.Optional.StringLiteral.putAll", - "type.property.optional.StringLiteralClient.putAllWithResponse": "Type.Property.Optional.StringLiteral.putAll", - "type.property.optional.StringLiteralClient.putDefault": "Type.Property.Optional.StringLiteral.putDefault", - "type.property.optional.StringLiteralClient.putDefaultWithResponse": "Type.Property.Optional.StringLiteral.putDefault", - "type.property.optional.StringOperationAsyncClient": "Type.Property.Optional.String", - "type.property.optional.StringOperationAsyncClient.getAll": "Type.Property.Optional.String.getAll", - "type.property.optional.StringOperationAsyncClient.getAllWithResponse": "Type.Property.Optional.String.getAll", - "type.property.optional.StringOperationAsyncClient.getDefault": "Type.Property.Optional.String.getDefault", - "type.property.optional.StringOperationAsyncClient.getDefaultWithResponse": "Type.Property.Optional.String.getDefault", - "type.property.optional.StringOperationAsyncClient.putAll": "Type.Property.Optional.String.putAll", - "type.property.optional.StringOperationAsyncClient.putAllWithResponse": "Type.Property.Optional.String.putAll", - "type.property.optional.StringOperationAsyncClient.putDefault": "Type.Property.Optional.String.putDefault", - "type.property.optional.StringOperationAsyncClient.putDefaultWithResponse": "Type.Property.Optional.String.putDefault", - "type.property.optional.StringOperationClient": "Type.Property.Optional.String", - "type.property.optional.StringOperationClient.getAll": "Type.Property.Optional.String.getAll", - "type.property.optional.StringOperationClient.getAllWithResponse": "Type.Property.Optional.String.getAll", - "type.property.optional.StringOperationClient.getDefault": "Type.Property.Optional.String.getDefault", - "type.property.optional.StringOperationClient.getDefaultWithResponse": "Type.Property.Optional.String.getDefault", - "type.property.optional.StringOperationClient.putAll": "Type.Property.Optional.String.putAll", - "type.property.optional.StringOperationClient.putAllWithResponse": "Type.Property.Optional.String.putAll", - "type.property.optional.StringOperationClient.putDefault": "Type.Property.Optional.String.putDefault", - "type.property.optional.StringOperationClient.putDefaultWithResponse": "Type.Property.Optional.String.putDefault", - "type.property.optional.UnionFloatLiteralAsyncClient": "Type.Property.Optional.UnionFloatLiteral", - "type.property.optional.UnionFloatLiteralAsyncClient.getAll": "Type.Property.Optional.UnionFloatLiteral.getAll", - "type.property.optional.UnionFloatLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.UnionFloatLiteral.getAll", - "type.property.optional.UnionFloatLiteralAsyncClient.getDefault": "Type.Property.Optional.UnionFloatLiteral.getDefault", - "type.property.optional.UnionFloatLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.UnionFloatLiteral.getDefault", - "type.property.optional.UnionFloatLiteralAsyncClient.putAll": "Type.Property.Optional.UnionFloatLiteral.putAll", - "type.property.optional.UnionFloatLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.UnionFloatLiteral.putAll", - "type.property.optional.UnionFloatLiteralAsyncClient.putDefault": "Type.Property.Optional.UnionFloatLiteral.putDefault", - "type.property.optional.UnionFloatLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.UnionFloatLiteral.putDefault", - "type.property.optional.UnionFloatLiteralClient": "Type.Property.Optional.UnionFloatLiteral", - "type.property.optional.UnionFloatLiteralClient.getAll": "Type.Property.Optional.UnionFloatLiteral.getAll", - "type.property.optional.UnionFloatLiteralClient.getAllWithResponse": "Type.Property.Optional.UnionFloatLiteral.getAll", - "type.property.optional.UnionFloatLiteralClient.getDefault": "Type.Property.Optional.UnionFloatLiteral.getDefault", - "type.property.optional.UnionFloatLiteralClient.getDefaultWithResponse": "Type.Property.Optional.UnionFloatLiteral.getDefault", - "type.property.optional.UnionFloatLiteralClient.putAll": "Type.Property.Optional.UnionFloatLiteral.putAll", - "type.property.optional.UnionFloatLiteralClient.putAllWithResponse": "Type.Property.Optional.UnionFloatLiteral.putAll", - "type.property.optional.UnionFloatLiteralClient.putDefault": "Type.Property.Optional.UnionFloatLiteral.putDefault", - "type.property.optional.UnionFloatLiteralClient.putDefaultWithResponse": "Type.Property.Optional.UnionFloatLiteral.putDefault", - "type.property.optional.UnionIntLiteralAsyncClient": "Type.Property.Optional.UnionIntLiteral", - "type.property.optional.UnionIntLiteralAsyncClient.getAll": "Type.Property.Optional.UnionIntLiteral.getAll", - "type.property.optional.UnionIntLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.UnionIntLiteral.getAll", - "type.property.optional.UnionIntLiteralAsyncClient.getDefault": "Type.Property.Optional.UnionIntLiteral.getDefault", - "type.property.optional.UnionIntLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.UnionIntLiteral.getDefault", - "type.property.optional.UnionIntLiteralAsyncClient.putAll": "Type.Property.Optional.UnionIntLiteral.putAll", - "type.property.optional.UnionIntLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.UnionIntLiteral.putAll", - "type.property.optional.UnionIntLiteralAsyncClient.putDefault": "Type.Property.Optional.UnionIntLiteral.putDefault", - "type.property.optional.UnionIntLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.UnionIntLiteral.putDefault", - "type.property.optional.UnionIntLiteralClient": "Type.Property.Optional.UnionIntLiteral", - "type.property.optional.UnionIntLiteralClient.getAll": "Type.Property.Optional.UnionIntLiteral.getAll", - "type.property.optional.UnionIntLiteralClient.getAllWithResponse": "Type.Property.Optional.UnionIntLiteral.getAll", - "type.property.optional.UnionIntLiteralClient.getDefault": "Type.Property.Optional.UnionIntLiteral.getDefault", - "type.property.optional.UnionIntLiteralClient.getDefaultWithResponse": "Type.Property.Optional.UnionIntLiteral.getDefault", - "type.property.optional.UnionIntLiteralClient.putAll": "Type.Property.Optional.UnionIntLiteral.putAll", - "type.property.optional.UnionIntLiteralClient.putAllWithResponse": "Type.Property.Optional.UnionIntLiteral.putAll", - "type.property.optional.UnionIntLiteralClient.putDefault": "Type.Property.Optional.UnionIntLiteral.putDefault", - "type.property.optional.UnionIntLiteralClient.putDefaultWithResponse": "Type.Property.Optional.UnionIntLiteral.putDefault", - "type.property.optional.UnionStringLiteralAsyncClient": "Type.Property.Optional.UnionStringLiteral", - "type.property.optional.UnionStringLiteralAsyncClient.getAll": "Type.Property.Optional.UnionStringLiteral.getAll", - "type.property.optional.UnionStringLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.UnionStringLiteral.getAll", - "type.property.optional.UnionStringLiteralAsyncClient.getDefault": "Type.Property.Optional.UnionStringLiteral.getDefault", - "type.property.optional.UnionStringLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.UnionStringLiteral.getDefault", - "type.property.optional.UnionStringLiteralAsyncClient.putAll": "Type.Property.Optional.UnionStringLiteral.putAll", - "type.property.optional.UnionStringLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.UnionStringLiteral.putAll", - "type.property.optional.UnionStringLiteralAsyncClient.putDefault": "Type.Property.Optional.UnionStringLiteral.putDefault", - "type.property.optional.UnionStringLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.UnionStringLiteral.putDefault", - "type.property.optional.UnionStringLiteralClient": "Type.Property.Optional.UnionStringLiteral", - "type.property.optional.UnionStringLiteralClient.getAll": "Type.Property.Optional.UnionStringLiteral.getAll", - "type.property.optional.UnionStringLiteralClient.getAllWithResponse": "Type.Property.Optional.UnionStringLiteral.getAll", - "type.property.optional.UnionStringLiteralClient.getDefault": "Type.Property.Optional.UnionStringLiteral.getDefault", - "type.property.optional.UnionStringLiteralClient.getDefaultWithResponse": "Type.Property.Optional.UnionStringLiteral.getDefault", - "type.property.optional.UnionStringLiteralClient.putAll": "Type.Property.Optional.UnionStringLiteral.putAll", - "type.property.optional.UnionStringLiteralClient.putAllWithResponse": "Type.Property.Optional.UnionStringLiteral.putAll", - "type.property.optional.UnionStringLiteralClient.putDefault": "Type.Property.Optional.UnionStringLiteral.putDefault", - "type.property.optional.UnionStringLiteralClient.putDefaultWithResponse": "Type.Property.Optional.UnionStringLiteral.putDefault", - "type.property.optional.models.BooleanLiteralProperty": "Type.Property.Optional.BooleanLiteralProperty", - "type.property.optional.models.BooleanLiteralPropertyProperty": null, - "type.property.optional.models.BytesProperty": "Type.Property.Optional.BytesProperty", - "type.property.optional.models.CollectionsByteProperty": "Type.Property.Optional.CollectionsByteProperty", - "type.property.optional.models.CollectionsModelProperty": "Type.Property.Optional.CollectionsModelProperty", - "type.property.optional.models.DatetimeProperty": "Type.Property.Optional.DatetimeProperty", - "type.property.optional.models.DurationProperty": "Type.Property.Optional.DurationProperty", - "type.property.optional.models.FloatLiteralProperty": "Type.Property.Optional.FloatLiteralProperty", - "type.property.optional.models.FloatLiteralPropertyProperty": null, - "type.property.optional.models.IntLiteralProperty": "Type.Property.Optional.IntLiteralProperty", - "type.property.optional.models.IntLiteralPropertyProperty": null, - "type.property.optional.models.PlainDateProperty": "Type.Property.Optional.PlainDateProperty", - "type.property.optional.models.PlainTimeProperty": "Type.Property.Optional.PlainTimeProperty", - "type.property.optional.models.RequiredAndOptionalProperty": "Type.Property.Optional.RequiredAndOptionalProperty", - "type.property.optional.models.StringLiteralProperty": "Type.Property.Optional.StringLiteralProperty", - "type.property.optional.models.StringLiteralPropertyProperty": null, - "type.property.optional.models.StringProperty": "Type.Property.Optional.StringProperty", - "type.property.optional.models.UnionFloatLiteralProperty": "Type.Property.Optional.UnionFloatLiteralProperty", - "type.property.optional.models.UnionFloatLiteralPropertyProperty": "Type.Property.Optional.UnionFloatLiteralProperty.property.anonymous", - "type.property.optional.models.UnionIntLiteralProperty": "Type.Property.Optional.UnionIntLiteralProperty", - "type.property.optional.models.UnionIntLiteralPropertyProperty": "Type.Property.Optional.UnionIntLiteralProperty.property.anonymous", - "type.property.optional.models.UnionStringLiteralProperty": "Type.Property.Optional.UnionStringLiteralProperty", - "type.property.optional.models.UnionStringLiteralPropertyProperty": "Type.Property.Optional.UnionStringLiteralProperty.property.anonymous" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_metadata.json deleted file mode 100644 index d42e370e0f1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.property.optional.BooleanLiteralAsyncClient":"Type.Property.Optional.BooleanLiteral","type.property.optional.BooleanLiteralAsyncClient.getAll":"Type.Property.Optional.BooleanLiteral.getAll","type.property.optional.BooleanLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.BooleanLiteral.getAll","type.property.optional.BooleanLiteralAsyncClient.getDefault":"Type.Property.Optional.BooleanLiteral.getDefault","type.property.optional.BooleanLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.BooleanLiteral.getDefault","type.property.optional.BooleanLiteralAsyncClient.putAll":"Type.Property.Optional.BooleanLiteral.putAll","type.property.optional.BooleanLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.BooleanLiteral.putAll","type.property.optional.BooleanLiteralAsyncClient.putDefault":"Type.Property.Optional.BooleanLiteral.putDefault","type.property.optional.BooleanLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.BooleanLiteral.putDefault","type.property.optional.BooleanLiteralClient":"Type.Property.Optional.BooleanLiteral","type.property.optional.BooleanLiteralClient.getAll":"Type.Property.Optional.BooleanLiteral.getAll","type.property.optional.BooleanLiteralClient.getAllWithResponse":"Type.Property.Optional.BooleanLiteral.getAll","type.property.optional.BooleanLiteralClient.getDefault":"Type.Property.Optional.BooleanLiteral.getDefault","type.property.optional.BooleanLiteralClient.getDefaultWithResponse":"Type.Property.Optional.BooleanLiteral.getDefault","type.property.optional.BooleanLiteralClient.putAll":"Type.Property.Optional.BooleanLiteral.putAll","type.property.optional.BooleanLiteralClient.putAllWithResponse":"Type.Property.Optional.BooleanLiteral.putAll","type.property.optional.BooleanLiteralClient.putDefault":"Type.Property.Optional.BooleanLiteral.putDefault","type.property.optional.BooleanLiteralClient.putDefaultWithResponse":"Type.Property.Optional.BooleanLiteral.putDefault","type.property.optional.BytesAsyncClient":"Type.Property.Optional.Bytes","type.property.optional.BytesAsyncClient.getAll":"Type.Property.Optional.Bytes.getAll","type.property.optional.BytesAsyncClient.getAllWithResponse":"Type.Property.Optional.Bytes.getAll","type.property.optional.BytesAsyncClient.getDefault":"Type.Property.Optional.Bytes.getDefault","type.property.optional.BytesAsyncClient.getDefaultWithResponse":"Type.Property.Optional.Bytes.getDefault","type.property.optional.BytesAsyncClient.putAll":"Type.Property.Optional.Bytes.putAll","type.property.optional.BytesAsyncClient.putAllWithResponse":"Type.Property.Optional.Bytes.putAll","type.property.optional.BytesAsyncClient.putDefault":"Type.Property.Optional.Bytes.putDefault","type.property.optional.BytesAsyncClient.putDefaultWithResponse":"Type.Property.Optional.Bytes.putDefault","type.property.optional.BytesClient":"Type.Property.Optional.Bytes","type.property.optional.BytesClient.getAll":"Type.Property.Optional.Bytes.getAll","type.property.optional.BytesClient.getAllWithResponse":"Type.Property.Optional.Bytes.getAll","type.property.optional.BytesClient.getDefault":"Type.Property.Optional.Bytes.getDefault","type.property.optional.BytesClient.getDefaultWithResponse":"Type.Property.Optional.Bytes.getDefault","type.property.optional.BytesClient.putAll":"Type.Property.Optional.Bytes.putAll","type.property.optional.BytesClient.putAllWithResponse":"Type.Property.Optional.Bytes.putAll","type.property.optional.BytesClient.putDefault":"Type.Property.Optional.Bytes.putDefault","type.property.optional.BytesClient.putDefaultWithResponse":"Type.Property.Optional.Bytes.putDefault","type.property.optional.CollectionsByteAsyncClient":"Type.Property.Optional.CollectionsByte","type.property.optional.CollectionsByteAsyncClient.getAll":"Type.Property.Optional.CollectionsByte.getAll","type.property.optional.CollectionsByteAsyncClient.getAllWithResponse":"Type.Property.Optional.CollectionsByte.getAll","type.property.optional.CollectionsByteAsyncClient.getDefault":"Type.Property.Optional.CollectionsByte.getDefault","type.property.optional.CollectionsByteAsyncClient.getDefaultWithResponse":"Type.Property.Optional.CollectionsByte.getDefault","type.property.optional.CollectionsByteAsyncClient.putAll":"Type.Property.Optional.CollectionsByte.putAll","type.property.optional.CollectionsByteAsyncClient.putAllWithResponse":"Type.Property.Optional.CollectionsByte.putAll","type.property.optional.CollectionsByteAsyncClient.putDefault":"Type.Property.Optional.CollectionsByte.putDefault","type.property.optional.CollectionsByteAsyncClient.putDefaultWithResponse":"Type.Property.Optional.CollectionsByte.putDefault","type.property.optional.CollectionsByteClient":"Type.Property.Optional.CollectionsByte","type.property.optional.CollectionsByteClient.getAll":"Type.Property.Optional.CollectionsByte.getAll","type.property.optional.CollectionsByteClient.getAllWithResponse":"Type.Property.Optional.CollectionsByte.getAll","type.property.optional.CollectionsByteClient.getDefault":"Type.Property.Optional.CollectionsByte.getDefault","type.property.optional.CollectionsByteClient.getDefaultWithResponse":"Type.Property.Optional.CollectionsByte.getDefault","type.property.optional.CollectionsByteClient.putAll":"Type.Property.Optional.CollectionsByte.putAll","type.property.optional.CollectionsByteClient.putAllWithResponse":"Type.Property.Optional.CollectionsByte.putAll","type.property.optional.CollectionsByteClient.putDefault":"Type.Property.Optional.CollectionsByte.putDefault","type.property.optional.CollectionsByteClient.putDefaultWithResponse":"Type.Property.Optional.CollectionsByte.putDefault","type.property.optional.CollectionsModelAsyncClient":"Type.Property.Optional.CollectionsModel","type.property.optional.CollectionsModelAsyncClient.getAll":"Type.Property.Optional.CollectionsModel.getAll","type.property.optional.CollectionsModelAsyncClient.getAllWithResponse":"Type.Property.Optional.CollectionsModel.getAll","type.property.optional.CollectionsModelAsyncClient.getDefault":"Type.Property.Optional.CollectionsModel.getDefault","type.property.optional.CollectionsModelAsyncClient.getDefaultWithResponse":"Type.Property.Optional.CollectionsModel.getDefault","type.property.optional.CollectionsModelAsyncClient.putAll":"Type.Property.Optional.CollectionsModel.putAll","type.property.optional.CollectionsModelAsyncClient.putAllWithResponse":"Type.Property.Optional.CollectionsModel.putAll","type.property.optional.CollectionsModelAsyncClient.putDefault":"Type.Property.Optional.CollectionsModel.putDefault","type.property.optional.CollectionsModelAsyncClient.putDefaultWithResponse":"Type.Property.Optional.CollectionsModel.putDefault","type.property.optional.CollectionsModelClient":"Type.Property.Optional.CollectionsModel","type.property.optional.CollectionsModelClient.getAll":"Type.Property.Optional.CollectionsModel.getAll","type.property.optional.CollectionsModelClient.getAllWithResponse":"Type.Property.Optional.CollectionsModel.getAll","type.property.optional.CollectionsModelClient.getDefault":"Type.Property.Optional.CollectionsModel.getDefault","type.property.optional.CollectionsModelClient.getDefaultWithResponse":"Type.Property.Optional.CollectionsModel.getDefault","type.property.optional.CollectionsModelClient.putAll":"Type.Property.Optional.CollectionsModel.putAll","type.property.optional.CollectionsModelClient.putAllWithResponse":"Type.Property.Optional.CollectionsModel.putAll","type.property.optional.CollectionsModelClient.putDefault":"Type.Property.Optional.CollectionsModel.putDefault","type.property.optional.CollectionsModelClient.putDefaultWithResponse":"Type.Property.Optional.CollectionsModel.putDefault","type.property.optional.DatetimeOperationAsyncClient":"Type.Property.Optional.Datetime","type.property.optional.DatetimeOperationAsyncClient.getAll":"Type.Property.Optional.Datetime.getAll","type.property.optional.DatetimeOperationAsyncClient.getAllWithResponse":"Type.Property.Optional.Datetime.getAll","type.property.optional.DatetimeOperationAsyncClient.getDefault":"Type.Property.Optional.Datetime.getDefault","type.property.optional.DatetimeOperationAsyncClient.getDefaultWithResponse":"Type.Property.Optional.Datetime.getDefault","type.property.optional.DatetimeOperationAsyncClient.putAll":"Type.Property.Optional.Datetime.putAll","type.property.optional.DatetimeOperationAsyncClient.putAllWithResponse":"Type.Property.Optional.Datetime.putAll","type.property.optional.DatetimeOperationAsyncClient.putDefault":"Type.Property.Optional.Datetime.putDefault","type.property.optional.DatetimeOperationAsyncClient.putDefaultWithResponse":"Type.Property.Optional.Datetime.putDefault","type.property.optional.DatetimeOperationClient":"Type.Property.Optional.Datetime","type.property.optional.DatetimeOperationClient.getAll":"Type.Property.Optional.Datetime.getAll","type.property.optional.DatetimeOperationClient.getAllWithResponse":"Type.Property.Optional.Datetime.getAll","type.property.optional.DatetimeOperationClient.getDefault":"Type.Property.Optional.Datetime.getDefault","type.property.optional.DatetimeOperationClient.getDefaultWithResponse":"Type.Property.Optional.Datetime.getDefault","type.property.optional.DatetimeOperationClient.putAll":"Type.Property.Optional.Datetime.putAll","type.property.optional.DatetimeOperationClient.putAllWithResponse":"Type.Property.Optional.Datetime.putAll","type.property.optional.DatetimeOperationClient.putDefault":"Type.Property.Optional.Datetime.putDefault","type.property.optional.DatetimeOperationClient.putDefaultWithResponse":"Type.Property.Optional.Datetime.putDefault","type.property.optional.DurationOperationAsyncClient":"Type.Property.Optional.Duration","type.property.optional.DurationOperationAsyncClient.getAll":"Type.Property.Optional.Duration.getAll","type.property.optional.DurationOperationAsyncClient.getAllWithResponse":"Type.Property.Optional.Duration.getAll","type.property.optional.DurationOperationAsyncClient.getDefault":"Type.Property.Optional.Duration.getDefault","type.property.optional.DurationOperationAsyncClient.getDefaultWithResponse":"Type.Property.Optional.Duration.getDefault","type.property.optional.DurationOperationAsyncClient.putAll":"Type.Property.Optional.Duration.putAll","type.property.optional.DurationOperationAsyncClient.putAllWithResponse":"Type.Property.Optional.Duration.putAll","type.property.optional.DurationOperationAsyncClient.putDefault":"Type.Property.Optional.Duration.putDefault","type.property.optional.DurationOperationAsyncClient.putDefaultWithResponse":"Type.Property.Optional.Duration.putDefault","type.property.optional.DurationOperationClient":"Type.Property.Optional.Duration","type.property.optional.DurationOperationClient.getAll":"Type.Property.Optional.Duration.getAll","type.property.optional.DurationOperationClient.getAllWithResponse":"Type.Property.Optional.Duration.getAll","type.property.optional.DurationOperationClient.getDefault":"Type.Property.Optional.Duration.getDefault","type.property.optional.DurationOperationClient.getDefaultWithResponse":"Type.Property.Optional.Duration.getDefault","type.property.optional.DurationOperationClient.putAll":"Type.Property.Optional.Duration.putAll","type.property.optional.DurationOperationClient.putAllWithResponse":"Type.Property.Optional.Duration.putAll","type.property.optional.DurationOperationClient.putDefault":"Type.Property.Optional.Duration.putDefault","type.property.optional.DurationOperationClient.putDefaultWithResponse":"Type.Property.Optional.Duration.putDefault","type.property.optional.FloatLiteralAsyncClient":"Type.Property.Optional.FloatLiteral","type.property.optional.FloatLiteralAsyncClient.getAll":"Type.Property.Optional.FloatLiteral.getAll","type.property.optional.FloatLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.FloatLiteral.getAll","type.property.optional.FloatLiteralAsyncClient.getDefault":"Type.Property.Optional.FloatLiteral.getDefault","type.property.optional.FloatLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.FloatLiteral.getDefault","type.property.optional.FloatLiteralAsyncClient.putAll":"Type.Property.Optional.FloatLiteral.putAll","type.property.optional.FloatLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.FloatLiteral.putAll","type.property.optional.FloatLiteralAsyncClient.putDefault":"Type.Property.Optional.FloatLiteral.putDefault","type.property.optional.FloatLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.FloatLiteral.putDefault","type.property.optional.FloatLiteralClient":"Type.Property.Optional.FloatLiteral","type.property.optional.FloatLiteralClient.getAll":"Type.Property.Optional.FloatLiteral.getAll","type.property.optional.FloatLiteralClient.getAllWithResponse":"Type.Property.Optional.FloatLiteral.getAll","type.property.optional.FloatLiteralClient.getDefault":"Type.Property.Optional.FloatLiteral.getDefault","type.property.optional.FloatLiteralClient.getDefaultWithResponse":"Type.Property.Optional.FloatLiteral.getDefault","type.property.optional.FloatLiteralClient.putAll":"Type.Property.Optional.FloatLiteral.putAll","type.property.optional.FloatLiteralClient.putAllWithResponse":"Type.Property.Optional.FloatLiteral.putAll","type.property.optional.FloatLiteralClient.putDefault":"Type.Property.Optional.FloatLiteral.putDefault","type.property.optional.FloatLiteralClient.putDefaultWithResponse":"Type.Property.Optional.FloatLiteral.putDefault","type.property.optional.IntLiteralAsyncClient":"Type.Property.Optional.IntLiteral","type.property.optional.IntLiteralAsyncClient.getAll":"Type.Property.Optional.IntLiteral.getAll","type.property.optional.IntLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.IntLiteral.getAll","type.property.optional.IntLiteralAsyncClient.getDefault":"Type.Property.Optional.IntLiteral.getDefault","type.property.optional.IntLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.IntLiteral.getDefault","type.property.optional.IntLiteralAsyncClient.putAll":"Type.Property.Optional.IntLiteral.putAll","type.property.optional.IntLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.IntLiteral.putAll","type.property.optional.IntLiteralAsyncClient.putDefault":"Type.Property.Optional.IntLiteral.putDefault","type.property.optional.IntLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.IntLiteral.putDefault","type.property.optional.IntLiteralClient":"Type.Property.Optional.IntLiteral","type.property.optional.IntLiteralClient.getAll":"Type.Property.Optional.IntLiteral.getAll","type.property.optional.IntLiteralClient.getAllWithResponse":"Type.Property.Optional.IntLiteral.getAll","type.property.optional.IntLiteralClient.getDefault":"Type.Property.Optional.IntLiteral.getDefault","type.property.optional.IntLiteralClient.getDefaultWithResponse":"Type.Property.Optional.IntLiteral.getDefault","type.property.optional.IntLiteralClient.putAll":"Type.Property.Optional.IntLiteral.putAll","type.property.optional.IntLiteralClient.putAllWithResponse":"Type.Property.Optional.IntLiteral.putAll","type.property.optional.IntLiteralClient.putDefault":"Type.Property.Optional.IntLiteral.putDefault","type.property.optional.IntLiteralClient.putDefaultWithResponse":"Type.Property.Optional.IntLiteral.putDefault","type.property.optional.OptionalClientBuilder":"Type.Property.Optional","type.property.optional.PlainDateAsyncClient":"Type.Property.Optional.PlainDate","type.property.optional.PlainDateAsyncClient.getAll":"Type.Property.Optional.PlainDate.getAll","type.property.optional.PlainDateAsyncClient.getAllWithResponse":"Type.Property.Optional.PlainDate.getAll","type.property.optional.PlainDateAsyncClient.getDefault":"Type.Property.Optional.PlainDate.getDefault","type.property.optional.PlainDateAsyncClient.getDefaultWithResponse":"Type.Property.Optional.PlainDate.getDefault","type.property.optional.PlainDateAsyncClient.putAll":"Type.Property.Optional.PlainDate.putAll","type.property.optional.PlainDateAsyncClient.putAllWithResponse":"Type.Property.Optional.PlainDate.putAll","type.property.optional.PlainDateAsyncClient.putDefault":"Type.Property.Optional.PlainDate.putDefault","type.property.optional.PlainDateAsyncClient.putDefaultWithResponse":"Type.Property.Optional.PlainDate.putDefault","type.property.optional.PlainDateClient":"Type.Property.Optional.PlainDate","type.property.optional.PlainDateClient.getAll":"Type.Property.Optional.PlainDate.getAll","type.property.optional.PlainDateClient.getAllWithResponse":"Type.Property.Optional.PlainDate.getAll","type.property.optional.PlainDateClient.getDefault":"Type.Property.Optional.PlainDate.getDefault","type.property.optional.PlainDateClient.getDefaultWithResponse":"Type.Property.Optional.PlainDate.getDefault","type.property.optional.PlainDateClient.putAll":"Type.Property.Optional.PlainDate.putAll","type.property.optional.PlainDateClient.putAllWithResponse":"Type.Property.Optional.PlainDate.putAll","type.property.optional.PlainDateClient.putDefault":"Type.Property.Optional.PlainDate.putDefault","type.property.optional.PlainDateClient.putDefaultWithResponse":"Type.Property.Optional.PlainDate.putDefault","type.property.optional.PlainTimeAsyncClient":"Type.Property.Optional.PlainTime","type.property.optional.PlainTimeAsyncClient.getAll":"Type.Property.Optional.PlainTime.getAll","type.property.optional.PlainTimeAsyncClient.getAllWithResponse":"Type.Property.Optional.PlainTime.getAll","type.property.optional.PlainTimeAsyncClient.getDefault":"Type.Property.Optional.PlainTime.getDefault","type.property.optional.PlainTimeAsyncClient.getDefaultWithResponse":"Type.Property.Optional.PlainTime.getDefault","type.property.optional.PlainTimeAsyncClient.putAll":"Type.Property.Optional.PlainTime.putAll","type.property.optional.PlainTimeAsyncClient.putAllWithResponse":"Type.Property.Optional.PlainTime.putAll","type.property.optional.PlainTimeAsyncClient.putDefault":"Type.Property.Optional.PlainTime.putDefault","type.property.optional.PlainTimeAsyncClient.putDefaultWithResponse":"Type.Property.Optional.PlainTime.putDefault","type.property.optional.PlainTimeClient":"Type.Property.Optional.PlainTime","type.property.optional.PlainTimeClient.getAll":"Type.Property.Optional.PlainTime.getAll","type.property.optional.PlainTimeClient.getAllWithResponse":"Type.Property.Optional.PlainTime.getAll","type.property.optional.PlainTimeClient.getDefault":"Type.Property.Optional.PlainTime.getDefault","type.property.optional.PlainTimeClient.getDefaultWithResponse":"Type.Property.Optional.PlainTime.getDefault","type.property.optional.PlainTimeClient.putAll":"Type.Property.Optional.PlainTime.putAll","type.property.optional.PlainTimeClient.putAllWithResponse":"Type.Property.Optional.PlainTime.putAll","type.property.optional.PlainTimeClient.putDefault":"Type.Property.Optional.PlainTime.putDefault","type.property.optional.PlainTimeClient.putDefaultWithResponse":"Type.Property.Optional.PlainTime.putDefault","type.property.optional.RequiredAndOptionalAsyncClient":"Type.Property.Optional.RequiredAndOptional","type.property.optional.RequiredAndOptionalAsyncClient.getAll":"Type.Property.Optional.RequiredAndOptional.getAll","type.property.optional.RequiredAndOptionalAsyncClient.getAllWithResponse":"Type.Property.Optional.RequiredAndOptional.getAll","type.property.optional.RequiredAndOptionalAsyncClient.getRequiredOnly":"Type.Property.Optional.RequiredAndOptional.getRequiredOnly","type.property.optional.RequiredAndOptionalAsyncClient.getRequiredOnlyWithResponse":"Type.Property.Optional.RequiredAndOptional.getRequiredOnly","type.property.optional.RequiredAndOptionalAsyncClient.putAll":"Type.Property.Optional.RequiredAndOptional.putAll","type.property.optional.RequiredAndOptionalAsyncClient.putAllWithResponse":"Type.Property.Optional.RequiredAndOptional.putAll","type.property.optional.RequiredAndOptionalAsyncClient.putRequiredOnly":"Type.Property.Optional.RequiredAndOptional.putRequiredOnly","type.property.optional.RequiredAndOptionalAsyncClient.putRequiredOnlyWithResponse":"Type.Property.Optional.RequiredAndOptional.putRequiredOnly","type.property.optional.RequiredAndOptionalClient":"Type.Property.Optional.RequiredAndOptional","type.property.optional.RequiredAndOptionalClient.getAll":"Type.Property.Optional.RequiredAndOptional.getAll","type.property.optional.RequiredAndOptionalClient.getAllWithResponse":"Type.Property.Optional.RequiredAndOptional.getAll","type.property.optional.RequiredAndOptionalClient.getRequiredOnly":"Type.Property.Optional.RequiredAndOptional.getRequiredOnly","type.property.optional.RequiredAndOptionalClient.getRequiredOnlyWithResponse":"Type.Property.Optional.RequiredAndOptional.getRequiredOnly","type.property.optional.RequiredAndOptionalClient.putAll":"Type.Property.Optional.RequiredAndOptional.putAll","type.property.optional.RequiredAndOptionalClient.putAllWithResponse":"Type.Property.Optional.RequiredAndOptional.putAll","type.property.optional.RequiredAndOptionalClient.putRequiredOnly":"Type.Property.Optional.RequiredAndOptional.putRequiredOnly","type.property.optional.RequiredAndOptionalClient.putRequiredOnlyWithResponse":"Type.Property.Optional.RequiredAndOptional.putRequiredOnly","type.property.optional.StringLiteralAsyncClient":"Type.Property.Optional.StringLiteral","type.property.optional.StringLiteralAsyncClient.getAll":"Type.Property.Optional.StringLiteral.getAll","type.property.optional.StringLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.StringLiteral.getAll","type.property.optional.StringLiteralAsyncClient.getDefault":"Type.Property.Optional.StringLiteral.getDefault","type.property.optional.StringLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.StringLiteral.getDefault","type.property.optional.StringLiteralAsyncClient.putAll":"Type.Property.Optional.StringLiteral.putAll","type.property.optional.StringLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.StringLiteral.putAll","type.property.optional.StringLiteralAsyncClient.putDefault":"Type.Property.Optional.StringLiteral.putDefault","type.property.optional.StringLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.StringLiteral.putDefault","type.property.optional.StringLiteralClient":"Type.Property.Optional.StringLiteral","type.property.optional.StringLiteralClient.getAll":"Type.Property.Optional.StringLiteral.getAll","type.property.optional.StringLiteralClient.getAllWithResponse":"Type.Property.Optional.StringLiteral.getAll","type.property.optional.StringLiteralClient.getDefault":"Type.Property.Optional.StringLiteral.getDefault","type.property.optional.StringLiteralClient.getDefaultWithResponse":"Type.Property.Optional.StringLiteral.getDefault","type.property.optional.StringLiteralClient.putAll":"Type.Property.Optional.StringLiteral.putAll","type.property.optional.StringLiteralClient.putAllWithResponse":"Type.Property.Optional.StringLiteral.putAll","type.property.optional.StringLiteralClient.putDefault":"Type.Property.Optional.StringLiteral.putDefault","type.property.optional.StringLiteralClient.putDefaultWithResponse":"Type.Property.Optional.StringLiteral.putDefault","type.property.optional.StringOperationAsyncClient":"Type.Property.Optional.String","type.property.optional.StringOperationAsyncClient.getAll":"Type.Property.Optional.String.getAll","type.property.optional.StringOperationAsyncClient.getAllWithResponse":"Type.Property.Optional.String.getAll","type.property.optional.StringOperationAsyncClient.getDefault":"Type.Property.Optional.String.getDefault","type.property.optional.StringOperationAsyncClient.getDefaultWithResponse":"Type.Property.Optional.String.getDefault","type.property.optional.StringOperationAsyncClient.putAll":"Type.Property.Optional.String.putAll","type.property.optional.StringOperationAsyncClient.putAllWithResponse":"Type.Property.Optional.String.putAll","type.property.optional.StringOperationAsyncClient.putDefault":"Type.Property.Optional.String.putDefault","type.property.optional.StringOperationAsyncClient.putDefaultWithResponse":"Type.Property.Optional.String.putDefault","type.property.optional.StringOperationClient":"Type.Property.Optional.String","type.property.optional.StringOperationClient.getAll":"Type.Property.Optional.String.getAll","type.property.optional.StringOperationClient.getAllWithResponse":"Type.Property.Optional.String.getAll","type.property.optional.StringOperationClient.getDefault":"Type.Property.Optional.String.getDefault","type.property.optional.StringOperationClient.getDefaultWithResponse":"Type.Property.Optional.String.getDefault","type.property.optional.StringOperationClient.putAll":"Type.Property.Optional.String.putAll","type.property.optional.StringOperationClient.putAllWithResponse":"Type.Property.Optional.String.putAll","type.property.optional.StringOperationClient.putDefault":"Type.Property.Optional.String.putDefault","type.property.optional.StringOperationClient.putDefaultWithResponse":"Type.Property.Optional.String.putDefault","type.property.optional.UnionFloatLiteralAsyncClient":"Type.Property.Optional.UnionFloatLiteral","type.property.optional.UnionFloatLiteralAsyncClient.getAll":"Type.Property.Optional.UnionFloatLiteral.getAll","type.property.optional.UnionFloatLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.UnionFloatLiteral.getAll","type.property.optional.UnionFloatLiteralAsyncClient.getDefault":"Type.Property.Optional.UnionFloatLiteral.getDefault","type.property.optional.UnionFloatLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.UnionFloatLiteral.getDefault","type.property.optional.UnionFloatLiteralAsyncClient.putAll":"Type.Property.Optional.UnionFloatLiteral.putAll","type.property.optional.UnionFloatLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.UnionFloatLiteral.putAll","type.property.optional.UnionFloatLiteralAsyncClient.putDefault":"Type.Property.Optional.UnionFloatLiteral.putDefault","type.property.optional.UnionFloatLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.UnionFloatLiteral.putDefault","type.property.optional.UnionFloatLiteralClient":"Type.Property.Optional.UnionFloatLiteral","type.property.optional.UnionFloatLiteralClient.getAll":"Type.Property.Optional.UnionFloatLiteral.getAll","type.property.optional.UnionFloatLiteralClient.getAllWithResponse":"Type.Property.Optional.UnionFloatLiteral.getAll","type.property.optional.UnionFloatLiteralClient.getDefault":"Type.Property.Optional.UnionFloatLiteral.getDefault","type.property.optional.UnionFloatLiteralClient.getDefaultWithResponse":"Type.Property.Optional.UnionFloatLiteral.getDefault","type.property.optional.UnionFloatLiteralClient.putAll":"Type.Property.Optional.UnionFloatLiteral.putAll","type.property.optional.UnionFloatLiteralClient.putAllWithResponse":"Type.Property.Optional.UnionFloatLiteral.putAll","type.property.optional.UnionFloatLiteralClient.putDefault":"Type.Property.Optional.UnionFloatLiteral.putDefault","type.property.optional.UnionFloatLiteralClient.putDefaultWithResponse":"Type.Property.Optional.UnionFloatLiteral.putDefault","type.property.optional.UnionIntLiteralAsyncClient":"Type.Property.Optional.UnionIntLiteral","type.property.optional.UnionIntLiteralAsyncClient.getAll":"Type.Property.Optional.UnionIntLiteral.getAll","type.property.optional.UnionIntLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.UnionIntLiteral.getAll","type.property.optional.UnionIntLiteralAsyncClient.getDefault":"Type.Property.Optional.UnionIntLiteral.getDefault","type.property.optional.UnionIntLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.UnionIntLiteral.getDefault","type.property.optional.UnionIntLiteralAsyncClient.putAll":"Type.Property.Optional.UnionIntLiteral.putAll","type.property.optional.UnionIntLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.UnionIntLiteral.putAll","type.property.optional.UnionIntLiteralAsyncClient.putDefault":"Type.Property.Optional.UnionIntLiteral.putDefault","type.property.optional.UnionIntLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.UnionIntLiteral.putDefault","type.property.optional.UnionIntLiteralClient":"Type.Property.Optional.UnionIntLiteral","type.property.optional.UnionIntLiteralClient.getAll":"Type.Property.Optional.UnionIntLiteral.getAll","type.property.optional.UnionIntLiteralClient.getAllWithResponse":"Type.Property.Optional.UnionIntLiteral.getAll","type.property.optional.UnionIntLiteralClient.getDefault":"Type.Property.Optional.UnionIntLiteral.getDefault","type.property.optional.UnionIntLiteralClient.getDefaultWithResponse":"Type.Property.Optional.UnionIntLiteral.getDefault","type.property.optional.UnionIntLiteralClient.putAll":"Type.Property.Optional.UnionIntLiteral.putAll","type.property.optional.UnionIntLiteralClient.putAllWithResponse":"Type.Property.Optional.UnionIntLiteral.putAll","type.property.optional.UnionIntLiteralClient.putDefault":"Type.Property.Optional.UnionIntLiteral.putDefault","type.property.optional.UnionIntLiteralClient.putDefaultWithResponse":"Type.Property.Optional.UnionIntLiteral.putDefault","type.property.optional.UnionStringLiteralAsyncClient":"Type.Property.Optional.UnionStringLiteral","type.property.optional.UnionStringLiteralAsyncClient.getAll":"Type.Property.Optional.UnionStringLiteral.getAll","type.property.optional.UnionStringLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.UnionStringLiteral.getAll","type.property.optional.UnionStringLiteralAsyncClient.getDefault":"Type.Property.Optional.UnionStringLiteral.getDefault","type.property.optional.UnionStringLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.UnionStringLiteral.getDefault","type.property.optional.UnionStringLiteralAsyncClient.putAll":"Type.Property.Optional.UnionStringLiteral.putAll","type.property.optional.UnionStringLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.UnionStringLiteral.putAll","type.property.optional.UnionStringLiteralAsyncClient.putDefault":"Type.Property.Optional.UnionStringLiteral.putDefault","type.property.optional.UnionStringLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.UnionStringLiteral.putDefault","type.property.optional.UnionStringLiteralClient":"Type.Property.Optional.UnionStringLiteral","type.property.optional.UnionStringLiteralClient.getAll":"Type.Property.Optional.UnionStringLiteral.getAll","type.property.optional.UnionStringLiteralClient.getAllWithResponse":"Type.Property.Optional.UnionStringLiteral.getAll","type.property.optional.UnionStringLiteralClient.getDefault":"Type.Property.Optional.UnionStringLiteral.getDefault","type.property.optional.UnionStringLiteralClient.getDefaultWithResponse":"Type.Property.Optional.UnionStringLiteral.getDefault","type.property.optional.UnionStringLiteralClient.putAll":"Type.Property.Optional.UnionStringLiteral.putAll","type.property.optional.UnionStringLiteralClient.putAllWithResponse":"Type.Property.Optional.UnionStringLiteral.putAll","type.property.optional.UnionStringLiteralClient.putDefault":"Type.Property.Optional.UnionStringLiteral.putDefault","type.property.optional.UnionStringLiteralClient.putDefaultWithResponse":"Type.Property.Optional.UnionStringLiteral.putDefault","type.property.optional.models.BooleanLiteralProperty":"Type.Property.Optional.BooleanLiteralProperty","type.property.optional.models.BooleanLiteralPropertyProperty":null,"type.property.optional.models.BytesProperty":"Type.Property.Optional.BytesProperty","type.property.optional.models.CollectionsByteProperty":"Type.Property.Optional.CollectionsByteProperty","type.property.optional.models.CollectionsModelProperty":"Type.Property.Optional.CollectionsModelProperty","type.property.optional.models.DatetimeProperty":"Type.Property.Optional.DatetimeProperty","type.property.optional.models.DurationProperty":"Type.Property.Optional.DurationProperty","type.property.optional.models.FloatLiteralProperty":"Type.Property.Optional.FloatLiteralProperty","type.property.optional.models.FloatLiteralPropertyProperty":null,"type.property.optional.models.IntLiteralProperty":"Type.Property.Optional.IntLiteralProperty","type.property.optional.models.IntLiteralPropertyProperty":null,"type.property.optional.models.PlainDateProperty":"Type.Property.Optional.PlainDateProperty","type.property.optional.models.PlainTimeProperty":"Type.Property.Optional.PlainTimeProperty","type.property.optional.models.RequiredAndOptionalProperty":"Type.Property.Optional.RequiredAndOptionalProperty","type.property.optional.models.StringLiteralProperty":"Type.Property.Optional.StringLiteralProperty","type.property.optional.models.StringLiteralPropertyProperty":null,"type.property.optional.models.StringProperty":"Type.Property.Optional.StringProperty","type.property.optional.models.UnionFloatLiteralProperty":"Type.Property.Optional.UnionFloatLiteralProperty","type.property.optional.models.UnionFloatLiteralPropertyProperty":"Type.Property.Optional.UnionFloatLiteralProperty.property.anonymous","type.property.optional.models.UnionIntLiteralProperty":"Type.Property.Optional.UnionIntLiteralProperty","type.property.optional.models.UnionIntLiteralPropertyProperty":"Type.Property.Optional.UnionIntLiteralProperty.property.anonymous","type.property.optional.models.UnionStringLiteralProperty":"Type.Property.Optional.UnionStringLiteralProperty","type.property.optional.models.UnionStringLiteralPropertyProperty":"Type.Property.Optional.UnionStringLiteralProperty.property.anonymous"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/property/optional/BooleanLiteralAsyncClient.java","src/main/java/type/property/optional/BooleanLiteralClient.java","src/main/java/type/property/optional/BytesAsyncClient.java","src/main/java/type/property/optional/BytesClient.java","src/main/java/type/property/optional/CollectionsByteAsyncClient.java","src/main/java/type/property/optional/CollectionsByteClient.java","src/main/java/type/property/optional/CollectionsModelAsyncClient.java","src/main/java/type/property/optional/CollectionsModelClient.java","src/main/java/type/property/optional/DatetimeOperationAsyncClient.java","src/main/java/type/property/optional/DatetimeOperationClient.java","src/main/java/type/property/optional/DurationOperationAsyncClient.java","src/main/java/type/property/optional/DurationOperationClient.java","src/main/java/type/property/optional/FloatLiteralAsyncClient.java","src/main/java/type/property/optional/FloatLiteralClient.java","src/main/java/type/property/optional/IntLiteralAsyncClient.java","src/main/java/type/property/optional/IntLiteralClient.java","src/main/java/type/property/optional/OptionalClientBuilder.java","src/main/java/type/property/optional/PlainDateAsyncClient.java","src/main/java/type/property/optional/PlainDateClient.java","src/main/java/type/property/optional/PlainTimeAsyncClient.java","src/main/java/type/property/optional/PlainTimeClient.java","src/main/java/type/property/optional/RequiredAndOptionalAsyncClient.java","src/main/java/type/property/optional/RequiredAndOptionalClient.java","src/main/java/type/property/optional/StringLiteralAsyncClient.java","src/main/java/type/property/optional/StringLiteralClient.java","src/main/java/type/property/optional/StringOperationAsyncClient.java","src/main/java/type/property/optional/StringOperationClient.java","src/main/java/type/property/optional/UnionFloatLiteralAsyncClient.java","src/main/java/type/property/optional/UnionFloatLiteralClient.java","src/main/java/type/property/optional/UnionIntLiteralAsyncClient.java","src/main/java/type/property/optional/UnionIntLiteralClient.java","src/main/java/type/property/optional/UnionStringLiteralAsyncClient.java","src/main/java/type/property/optional/UnionStringLiteralClient.java","src/main/java/type/property/optional/implementation/BooleanLiteralsImpl.java","src/main/java/type/property/optional/implementation/BytesImpl.java","src/main/java/type/property/optional/implementation/CollectionsBytesImpl.java","src/main/java/type/property/optional/implementation/CollectionsModelsImpl.java","src/main/java/type/property/optional/implementation/DatetimeOperationsImpl.java","src/main/java/type/property/optional/implementation/DurationOperationsImpl.java","src/main/java/type/property/optional/implementation/FloatLiteralsImpl.java","src/main/java/type/property/optional/implementation/IntLiteralsImpl.java","src/main/java/type/property/optional/implementation/OptionalClientImpl.java","src/main/java/type/property/optional/implementation/PlainDatesImpl.java","src/main/java/type/property/optional/implementation/PlainTimesImpl.java","src/main/java/type/property/optional/implementation/RequiredAndOptionalsImpl.java","src/main/java/type/property/optional/implementation/StringLiteralsImpl.java","src/main/java/type/property/optional/implementation/StringOperationsImpl.java","src/main/java/type/property/optional/implementation/UnionFloatLiteralsImpl.java","src/main/java/type/property/optional/implementation/UnionIntLiteralsImpl.java","src/main/java/type/property/optional/implementation/UnionStringLiteralsImpl.java","src/main/java/type/property/optional/implementation/package-info.java","src/main/java/type/property/optional/models/BooleanLiteralProperty.java","src/main/java/type/property/optional/models/BooleanLiteralPropertyProperty.java","src/main/java/type/property/optional/models/BytesProperty.java","src/main/java/type/property/optional/models/CollectionsByteProperty.java","src/main/java/type/property/optional/models/CollectionsModelProperty.java","src/main/java/type/property/optional/models/DatetimeProperty.java","src/main/java/type/property/optional/models/DurationProperty.java","src/main/java/type/property/optional/models/FloatLiteralProperty.java","src/main/java/type/property/optional/models/FloatLiteralPropertyProperty.java","src/main/java/type/property/optional/models/IntLiteralProperty.java","src/main/java/type/property/optional/models/IntLiteralPropertyProperty.java","src/main/java/type/property/optional/models/PlainDateProperty.java","src/main/java/type/property/optional/models/PlainTimeProperty.java","src/main/java/type/property/optional/models/RequiredAndOptionalProperty.java","src/main/java/type/property/optional/models/StringLiteralProperty.java","src/main/java/type/property/optional/models/StringLiteralPropertyProperty.java","src/main/java/type/property/optional/models/StringProperty.java","src/main/java/type/property/optional/models/UnionFloatLiteralProperty.java","src/main/java/type/property/optional/models/UnionFloatLiteralPropertyProperty.java","src/main/java/type/property/optional/models/UnionIntLiteralProperty.java","src/main/java/type/property/optional/models/UnionIntLiteralPropertyProperty.java","src/main/java/type/property/optional/models/UnionStringLiteralProperty.java","src/main/java/type/property/optional/models/UnionStringLiteralPropertyProperty.java","src/main/java/type/property/optional/models/package-info.java","src/main/java/type/property/optional/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_apiview_properties.json deleted file mode 100644 index 77ed3a46f1d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_apiview_properties.json +++ /dev/null @@ -1,332 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.property.valuetypes.BooleanLiteralAsyncClient": "Type.Property.ValueTypes.BooleanLiteral", - "type.property.valuetypes.BooleanLiteralAsyncClient.get": "Type.Property.ValueTypes.BooleanLiteral.get", - "type.property.valuetypes.BooleanLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.BooleanLiteral.get", - "type.property.valuetypes.BooleanLiteralAsyncClient.put": "Type.Property.ValueTypes.BooleanLiteral.put", - "type.property.valuetypes.BooleanLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.BooleanLiteral.put", - "type.property.valuetypes.BooleanLiteralClient": "Type.Property.ValueTypes.BooleanLiteral", - "type.property.valuetypes.BooleanLiteralClient.get": "Type.Property.ValueTypes.BooleanLiteral.get", - "type.property.valuetypes.BooleanLiteralClient.getWithResponse": "Type.Property.ValueTypes.BooleanLiteral.get", - "type.property.valuetypes.BooleanLiteralClient.put": "Type.Property.ValueTypes.BooleanLiteral.put", - "type.property.valuetypes.BooleanLiteralClient.putWithResponse": "Type.Property.ValueTypes.BooleanLiteral.put", - "type.property.valuetypes.BooleanOperationAsyncClient": "Type.Property.ValueTypes.Boolean", - "type.property.valuetypes.BooleanOperationAsyncClient.get": "Type.Property.ValueTypes.Boolean.get", - "type.property.valuetypes.BooleanOperationAsyncClient.getWithResponse": "Type.Property.ValueTypes.Boolean.get", - "type.property.valuetypes.BooleanOperationAsyncClient.put": "Type.Property.ValueTypes.Boolean.put", - "type.property.valuetypes.BooleanOperationAsyncClient.putWithResponse": "Type.Property.ValueTypes.Boolean.put", - "type.property.valuetypes.BooleanOperationClient": "Type.Property.ValueTypes.Boolean", - "type.property.valuetypes.BooleanOperationClient.get": "Type.Property.ValueTypes.Boolean.get", - "type.property.valuetypes.BooleanOperationClient.getWithResponse": "Type.Property.ValueTypes.Boolean.get", - "type.property.valuetypes.BooleanOperationClient.put": "Type.Property.ValueTypes.Boolean.put", - "type.property.valuetypes.BooleanOperationClient.putWithResponse": "Type.Property.ValueTypes.Boolean.put", - "type.property.valuetypes.BytesAsyncClient": "Type.Property.ValueTypes.Bytes", - "type.property.valuetypes.BytesAsyncClient.get": "Type.Property.ValueTypes.Bytes.get", - "type.property.valuetypes.BytesAsyncClient.getWithResponse": "Type.Property.ValueTypes.Bytes.get", - "type.property.valuetypes.BytesAsyncClient.put": "Type.Property.ValueTypes.Bytes.put", - "type.property.valuetypes.BytesAsyncClient.putWithResponse": "Type.Property.ValueTypes.Bytes.put", - "type.property.valuetypes.BytesClient": "Type.Property.ValueTypes.Bytes", - "type.property.valuetypes.BytesClient.get": "Type.Property.ValueTypes.Bytes.get", - "type.property.valuetypes.BytesClient.getWithResponse": "Type.Property.ValueTypes.Bytes.get", - "type.property.valuetypes.BytesClient.put": "Type.Property.ValueTypes.Bytes.put", - "type.property.valuetypes.BytesClient.putWithResponse": "Type.Property.ValueTypes.Bytes.put", - "type.property.valuetypes.CollectionsIntAsyncClient": "Type.Property.ValueTypes.CollectionsInt", - "type.property.valuetypes.CollectionsIntAsyncClient.get": "Type.Property.ValueTypes.CollectionsInt.get", - "type.property.valuetypes.CollectionsIntAsyncClient.getWithResponse": "Type.Property.ValueTypes.CollectionsInt.get", - "type.property.valuetypes.CollectionsIntAsyncClient.put": "Type.Property.ValueTypes.CollectionsInt.put", - "type.property.valuetypes.CollectionsIntAsyncClient.putWithResponse": "Type.Property.ValueTypes.CollectionsInt.put", - "type.property.valuetypes.CollectionsIntClient": "Type.Property.ValueTypes.CollectionsInt", - "type.property.valuetypes.CollectionsIntClient.get": "Type.Property.ValueTypes.CollectionsInt.get", - "type.property.valuetypes.CollectionsIntClient.getWithResponse": "Type.Property.ValueTypes.CollectionsInt.get", - "type.property.valuetypes.CollectionsIntClient.put": "Type.Property.ValueTypes.CollectionsInt.put", - "type.property.valuetypes.CollectionsIntClient.putWithResponse": "Type.Property.ValueTypes.CollectionsInt.put", - "type.property.valuetypes.CollectionsModelAsyncClient": "Type.Property.ValueTypes.CollectionsModel", - "type.property.valuetypes.CollectionsModelAsyncClient.get": "Type.Property.ValueTypes.CollectionsModel.get", - "type.property.valuetypes.CollectionsModelAsyncClient.getWithResponse": "Type.Property.ValueTypes.CollectionsModel.get", - "type.property.valuetypes.CollectionsModelAsyncClient.put": "Type.Property.ValueTypes.CollectionsModel.put", - "type.property.valuetypes.CollectionsModelAsyncClient.putWithResponse": "Type.Property.ValueTypes.CollectionsModel.put", - "type.property.valuetypes.CollectionsModelClient": "Type.Property.ValueTypes.CollectionsModel", - "type.property.valuetypes.CollectionsModelClient.get": "Type.Property.ValueTypes.CollectionsModel.get", - "type.property.valuetypes.CollectionsModelClient.getWithResponse": "Type.Property.ValueTypes.CollectionsModel.get", - "type.property.valuetypes.CollectionsModelClient.put": "Type.Property.ValueTypes.CollectionsModel.put", - "type.property.valuetypes.CollectionsModelClient.putWithResponse": "Type.Property.ValueTypes.CollectionsModel.put", - "type.property.valuetypes.CollectionsStringAsyncClient": "Type.Property.ValueTypes.CollectionsString", - "type.property.valuetypes.CollectionsStringAsyncClient.get": "Type.Property.ValueTypes.CollectionsString.get", - "type.property.valuetypes.CollectionsStringAsyncClient.getWithResponse": "Type.Property.ValueTypes.CollectionsString.get", - "type.property.valuetypes.CollectionsStringAsyncClient.put": "Type.Property.ValueTypes.CollectionsString.put", - "type.property.valuetypes.CollectionsStringAsyncClient.putWithResponse": "Type.Property.ValueTypes.CollectionsString.put", - "type.property.valuetypes.CollectionsStringClient": "Type.Property.ValueTypes.CollectionsString", - "type.property.valuetypes.CollectionsStringClient.get": "Type.Property.ValueTypes.CollectionsString.get", - "type.property.valuetypes.CollectionsStringClient.getWithResponse": "Type.Property.ValueTypes.CollectionsString.get", - "type.property.valuetypes.CollectionsStringClient.put": "Type.Property.ValueTypes.CollectionsString.put", - "type.property.valuetypes.CollectionsStringClient.putWithResponse": "Type.Property.ValueTypes.CollectionsString.put", - "type.property.valuetypes.DatetimeOperationAsyncClient": "Type.Property.ValueTypes.Datetime", - "type.property.valuetypes.DatetimeOperationAsyncClient.get": "Type.Property.ValueTypes.Datetime.get", - "type.property.valuetypes.DatetimeOperationAsyncClient.getWithResponse": "Type.Property.ValueTypes.Datetime.get", - "type.property.valuetypes.DatetimeOperationAsyncClient.put": "Type.Property.ValueTypes.Datetime.put", - "type.property.valuetypes.DatetimeOperationAsyncClient.putWithResponse": "Type.Property.ValueTypes.Datetime.put", - "type.property.valuetypes.DatetimeOperationClient": "Type.Property.ValueTypes.Datetime", - "type.property.valuetypes.DatetimeOperationClient.get": "Type.Property.ValueTypes.Datetime.get", - "type.property.valuetypes.DatetimeOperationClient.getWithResponse": "Type.Property.ValueTypes.Datetime.get", - "type.property.valuetypes.DatetimeOperationClient.put": "Type.Property.ValueTypes.Datetime.put", - "type.property.valuetypes.DatetimeOperationClient.putWithResponse": "Type.Property.ValueTypes.Datetime.put", - "type.property.valuetypes.Decimal128AsyncClient": "Type.Property.ValueTypes.Decimal128", - "type.property.valuetypes.Decimal128AsyncClient.get": "Type.Property.ValueTypes.Decimal128.get", - "type.property.valuetypes.Decimal128AsyncClient.getWithResponse": "Type.Property.ValueTypes.Decimal128.get", - "type.property.valuetypes.Decimal128AsyncClient.put": "Type.Property.ValueTypes.Decimal128.put", - "type.property.valuetypes.Decimal128AsyncClient.putWithResponse": "Type.Property.ValueTypes.Decimal128.put", - "type.property.valuetypes.Decimal128Client": "Type.Property.ValueTypes.Decimal128", - "type.property.valuetypes.Decimal128Client.get": "Type.Property.ValueTypes.Decimal128.get", - "type.property.valuetypes.Decimal128Client.getWithResponse": "Type.Property.ValueTypes.Decimal128.get", - "type.property.valuetypes.Decimal128Client.put": "Type.Property.ValueTypes.Decimal128.put", - "type.property.valuetypes.Decimal128Client.putWithResponse": "Type.Property.ValueTypes.Decimal128.put", - "type.property.valuetypes.DecimalAsyncClient": "Type.Property.ValueTypes.Decimal", - "type.property.valuetypes.DecimalAsyncClient.get": "Type.Property.ValueTypes.Decimal.get", - "type.property.valuetypes.DecimalAsyncClient.getWithResponse": "Type.Property.ValueTypes.Decimal.get", - "type.property.valuetypes.DecimalAsyncClient.put": "Type.Property.ValueTypes.Decimal.put", - "type.property.valuetypes.DecimalAsyncClient.putWithResponse": "Type.Property.ValueTypes.Decimal.put", - "type.property.valuetypes.DecimalClient": "Type.Property.ValueTypes.Decimal", - "type.property.valuetypes.DecimalClient.get": "Type.Property.ValueTypes.Decimal.get", - "type.property.valuetypes.DecimalClient.getWithResponse": "Type.Property.ValueTypes.Decimal.get", - "type.property.valuetypes.DecimalClient.put": "Type.Property.ValueTypes.Decimal.put", - "type.property.valuetypes.DecimalClient.putWithResponse": "Type.Property.ValueTypes.Decimal.put", - "type.property.valuetypes.DictionaryStringAsyncClient": "Type.Property.ValueTypes.DictionaryString", - "type.property.valuetypes.DictionaryStringAsyncClient.get": "Type.Property.ValueTypes.DictionaryString.get", - "type.property.valuetypes.DictionaryStringAsyncClient.getWithResponse": "Type.Property.ValueTypes.DictionaryString.get", - "type.property.valuetypes.DictionaryStringAsyncClient.put": "Type.Property.ValueTypes.DictionaryString.put", - "type.property.valuetypes.DictionaryStringAsyncClient.putWithResponse": "Type.Property.ValueTypes.DictionaryString.put", - "type.property.valuetypes.DictionaryStringClient": "Type.Property.ValueTypes.DictionaryString", - "type.property.valuetypes.DictionaryStringClient.get": "Type.Property.ValueTypes.DictionaryString.get", - "type.property.valuetypes.DictionaryStringClient.getWithResponse": "Type.Property.ValueTypes.DictionaryString.get", - "type.property.valuetypes.DictionaryStringClient.put": "Type.Property.ValueTypes.DictionaryString.put", - "type.property.valuetypes.DictionaryStringClient.putWithResponse": "Type.Property.ValueTypes.DictionaryString.put", - "type.property.valuetypes.DurationOperationAsyncClient": "Type.Property.ValueTypes.Duration", - "type.property.valuetypes.DurationOperationAsyncClient.get": "Type.Property.ValueTypes.Duration.get", - "type.property.valuetypes.DurationOperationAsyncClient.getWithResponse": "Type.Property.ValueTypes.Duration.get", - "type.property.valuetypes.DurationOperationAsyncClient.put": "Type.Property.ValueTypes.Duration.put", - "type.property.valuetypes.DurationOperationAsyncClient.putWithResponse": "Type.Property.ValueTypes.Duration.put", - "type.property.valuetypes.DurationOperationClient": "Type.Property.ValueTypes.Duration", - "type.property.valuetypes.DurationOperationClient.get": "Type.Property.ValueTypes.Duration.get", - "type.property.valuetypes.DurationOperationClient.getWithResponse": "Type.Property.ValueTypes.Duration.get", - "type.property.valuetypes.DurationOperationClient.put": "Type.Property.ValueTypes.Duration.put", - "type.property.valuetypes.DurationOperationClient.putWithResponse": "Type.Property.ValueTypes.Duration.put", - "type.property.valuetypes.EnumAsyncClient": "Type.Property.ValueTypes.Enum", - "type.property.valuetypes.EnumAsyncClient.get": "Type.Property.ValueTypes.Enum.get", - "type.property.valuetypes.EnumAsyncClient.getWithResponse": "Type.Property.ValueTypes.Enum.get", - "type.property.valuetypes.EnumAsyncClient.put": "Type.Property.ValueTypes.Enum.put", - "type.property.valuetypes.EnumAsyncClient.putWithResponse": "Type.Property.ValueTypes.Enum.put", - "type.property.valuetypes.EnumClient": "Type.Property.ValueTypes.Enum", - "type.property.valuetypes.EnumClient.get": "Type.Property.ValueTypes.Enum.get", - "type.property.valuetypes.EnumClient.getWithResponse": "Type.Property.ValueTypes.Enum.get", - "type.property.valuetypes.EnumClient.put": "Type.Property.ValueTypes.Enum.put", - "type.property.valuetypes.EnumClient.putWithResponse": "Type.Property.ValueTypes.Enum.put", - "type.property.valuetypes.ExtensibleEnumAsyncClient": "Type.Property.ValueTypes.ExtensibleEnum", - "type.property.valuetypes.ExtensibleEnumAsyncClient.get": "Type.Property.ValueTypes.ExtensibleEnum.get", - "type.property.valuetypes.ExtensibleEnumAsyncClient.getWithResponse": "Type.Property.ValueTypes.ExtensibleEnum.get", - "type.property.valuetypes.ExtensibleEnumAsyncClient.put": "Type.Property.ValueTypes.ExtensibleEnum.put", - "type.property.valuetypes.ExtensibleEnumAsyncClient.putWithResponse": "Type.Property.ValueTypes.ExtensibleEnum.put", - "type.property.valuetypes.ExtensibleEnumClient": "Type.Property.ValueTypes.ExtensibleEnum", - "type.property.valuetypes.ExtensibleEnumClient.get": "Type.Property.ValueTypes.ExtensibleEnum.get", - "type.property.valuetypes.ExtensibleEnumClient.getWithResponse": "Type.Property.ValueTypes.ExtensibleEnum.get", - "type.property.valuetypes.ExtensibleEnumClient.put": "Type.Property.ValueTypes.ExtensibleEnum.put", - "type.property.valuetypes.ExtensibleEnumClient.putWithResponse": "Type.Property.ValueTypes.ExtensibleEnum.put", - "type.property.valuetypes.FloatLiteralAsyncClient": "Type.Property.ValueTypes.FloatLiteral", - "type.property.valuetypes.FloatLiteralAsyncClient.get": "Type.Property.ValueTypes.FloatLiteral.get", - "type.property.valuetypes.FloatLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.FloatLiteral.get", - "type.property.valuetypes.FloatLiteralAsyncClient.put": "Type.Property.ValueTypes.FloatLiteral.put", - "type.property.valuetypes.FloatLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.FloatLiteral.put", - "type.property.valuetypes.FloatLiteralClient": "Type.Property.ValueTypes.FloatLiteral", - "type.property.valuetypes.FloatLiteralClient.get": "Type.Property.ValueTypes.FloatLiteral.get", - "type.property.valuetypes.FloatLiteralClient.getWithResponse": "Type.Property.ValueTypes.FloatLiteral.get", - "type.property.valuetypes.FloatLiteralClient.put": "Type.Property.ValueTypes.FloatLiteral.put", - "type.property.valuetypes.FloatLiteralClient.putWithResponse": "Type.Property.ValueTypes.FloatLiteral.put", - "type.property.valuetypes.FloatOperationAsyncClient": "Type.Property.ValueTypes.Float", - "type.property.valuetypes.FloatOperationAsyncClient.get": "Type.Property.ValueTypes.Float.get", - "type.property.valuetypes.FloatOperationAsyncClient.getWithResponse": "Type.Property.ValueTypes.Float.get", - "type.property.valuetypes.FloatOperationAsyncClient.put": "Type.Property.ValueTypes.Float.put", - "type.property.valuetypes.FloatOperationAsyncClient.putWithResponse": "Type.Property.ValueTypes.Float.put", - "type.property.valuetypes.FloatOperationClient": "Type.Property.ValueTypes.Float", - "type.property.valuetypes.FloatOperationClient.get": "Type.Property.ValueTypes.Float.get", - "type.property.valuetypes.FloatOperationClient.getWithResponse": "Type.Property.ValueTypes.Float.get", - "type.property.valuetypes.FloatOperationClient.put": "Type.Property.ValueTypes.Float.put", - "type.property.valuetypes.FloatOperationClient.putWithResponse": "Type.Property.ValueTypes.Float.put", - "type.property.valuetypes.IntAsyncClient": "Type.Property.ValueTypes.Int", - "type.property.valuetypes.IntAsyncClient.get": "Type.Property.ValueTypes.Int.get", - "type.property.valuetypes.IntAsyncClient.getWithResponse": "Type.Property.ValueTypes.Int.get", - "type.property.valuetypes.IntAsyncClient.put": "Type.Property.ValueTypes.Int.put", - "type.property.valuetypes.IntAsyncClient.putWithResponse": "Type.Property.ValueTypes.Int.put", - "type.property.valuetypes.IntClient": "Type.Property.ValueTypes.Int", - "type.property.valuetypes.IntClient.get": "Type.Property.ValueTypes.Int.get", - "type.property.valuetypes.IntClient.getWithResponse": "Type.Property.ValueTypes.Int.get", - "type.property.valuetypes.IntClient.put": "Type.Property.ValueTypes.Int.put", - "type.property.valuetypes.IntClient.putWithResponse": "Type.Property.ValueTypes.Int.put", - "type.property.valuetypes.IntLiteralAsyncClient": "Type.Property.ValueTypes.IntLiteral", - "type.property.valuetypes.IntLiteralAsyncClient.get": "Type.Property.ValueTypes.IntLiteral.get", - "type.property.valuetypes.IntLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.IntLiteral.get", - "type.property.valuetypes.IntLiteralAsyncClient.put": "Type.Property.ValueTypes.IntLiteral.put", - "type.property.valuetypes.IntLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.IntLiteral.put", - "type.property.valuetypes.IntLiteralClient": "Type.Property.ValueTypes.IntLiteral", - "type.property.valuetypes.IntLiteralClient.get": "Type.Property.ValueTypes.IntLiteral.get", - "type.property.valuetypes.IntLiteralClient.getWithResponse": "Type.Property.ValueTypes.IntLiteral.get", - "type.property.valuetypes.IntLiteralClient.put": "Type.Property.ValueTypes.IntLiteral.put", - "type.property.valuetypes.IntLiteralClient.putWithResponse": "Type.Property.ValueTypes.IntLiteral.put", - "type.property.valuetypes.ModelAsyncClient": "Type.Property.ValueTypes.Model", - "type.property.valuetypes.ModelAsyncClient.get": "Type.Property.ValueTypes.Model.get", - "type.property.valuetypes.ModelAsyncClient.getWithResponse": "Type.Property.ValueTypes.Model.get", - "type.property.valuetypes.ModelAsyncClient.put": "Type.Property.ValueTypes.Model.put", - "type.property.valuetypes.ModelAsyncClient.putWithResponse": "Type.Property.ValueTypes.Model.put", - "type.property.valuetypes.ModelClient": "Type.Property.ValueTypes.Model", - "type.property.valuetypes.ModelClient.get": "Type.Property.ValueTypes.Model.get", - "type.property.valuetypes.ModelClient.getWithResponse": "Type.Property.ValueTypes.Model.get", - "type.property.valuetypes.ModelClient.put": "Type.Property.ValueTypes.Model.put", - "type.property.valuetypes.ModelClient.putWithResponse": "Type.Property.ValueTypes.Model.put", - "type.property.valuetypes.NeverAsyncClient": "Type.Property.ValueTypes.Never", - "type.property.valuetypes.NeverAsyncClient.get": "Type.Property.ValueTypes.Never.get", - "type.property.valuetypes.NeverAsyncClient.getWithResponse": "Type.Property.ValueTypes.Never.get", - "type.property.valuetypes.NeverAsyncClient.put": "Type.Property.ValueTypes.Never.put", - "type.property.valuetypes.NeverAsyncClient.putWithResponse": "Type.Property.ValueTypes.Never.put", - "type.property.valuetypes.NeverClient": "Type.Property.ValueTypes.Never", - "type.property.valuetypes.NeverClient.get": "Type.Property.ValueTypes.Never.get", - "type.property.valuetypes.NeverClient.getWithResponse": "Type.Property.ValueTypes.Never.get", - "type.property.valuetypes.NeverClient.put": "Type.Property.ValueTypes.Never.put", - "type.property.valuetypes.NeverClient.putWithResponse": "Type.Property.ValueTypes.Never.put", - "type.property.valuetypes.StringLiteralAsyncClient": "Type.Property.ValueTypes.StringLiteral", - "type.property.valuetypes.StringLiteralAsyncClient.get": "Type.Property.ValueTypes.StringLiteral.get", - "type.property.valuetypes.StringLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.StringLiteral.get", - "type.property.valuetypes.StringLiteralAsyncClient.put": "Type.Property.ValueTypes.StringLiteral.put", - "type.property.valuetypes.StringLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.StringLiteral.put", - "type.property.valuetypes.StringLiteralClient": "Type.Property.ValueTypes.StringLiteral", - "type.property.valuetypes.StringLiteralClient.get": "Type.Property.ValueTypes.StringLiteral.get", - "type.property.valuetypes.StringLiteralClient.getWithResponse": "Type.Property.ValueTypes.StringLiteral.get", - "type.property.valuetypes.StringLiteralClient.put": "Type.Property.ValueTypes.StringLiteral.put", - "type.property.valuetypes.StringLiteralClient.putWithResponse": "Type.Property.ValueTypes.StringLiteral.put", - "type.property.valuetypes.StringOperationAsyncClient": "Type.Property.ValueTypes.String", - "type.property.valuetypes.StringOperationAsyncClient.get": "Type.Property.ValueTypes.String.get", - "type.property.valuetypes.StringOperationAsyncClient.getWithResponse": "Type.Property.ValueTypes.String.get", - "type.property.valuetypes.StringOperationAsyncClient.put": "Type.Property.ValueTypes.String.put", - "type.property.valuetypes.StringOperationAsyncClient.putWithResponse": "Type.Property.ValueTypes.String.put", - "type.property.valuetypes.StringOperationClient": "Type.Property.ValueTypes.String", - "type.property.valuetypes.StringOperationClient.get": "Type.Property.ValueTypes.String.get", - "type.property.valuetypes.StringOperationClient.getWithResponse": "Type.Property.ValueTypes.String.get", - "type.property.valuetypes.StringOperationClient.put": "Type.Property.ValueTypes.String.put", - "type.property.valuetypes.StringOperationClient.putWithResponse": "Type.Property.ValueTypes.String.put", - "type.property.valuetypes.UnionEnumValueAsyncClient": "Type.Property.ValueTypes.UnionEnumValue", - "type.property.valuetypes.UnionEnumValueAsyncClient.get": "Type.Property.ValueTypes.UnionEnumValue.get", - "type.property.valuetypes.UnionEnumValueAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnionEnumValue.get", - "type.property.valuetypes.UnionEnumValueAsyncClient.put": "Type.Property.ValueTypes.UnionEnumValue.put", - "type.property.valuetypes.UnionEnumValueAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnionEnumValue.put", - "type.property.valuetypes.UnionEnumValueClient": "Type.Property.ValueTypes.UnionEnumValue", - "type.property.valuetypes.UnionEnumValueClient.get": "Type.Property.ValueTypes.UnionEnumValue.get", - "type.property.valuetypes.UnionEnumValueClient.getWithResponse": "Type.Property.ValueTypes.UnionEnumValue.get", - "type.property.valuetypes.UnionEnumValueClient.put": "Type.Property.ValueTypes.UnionEnumValue.put", - "type.property.valuetypes.UnionEnumValueClient.putWithResponse": "Type.Property.ValueTypes.UnionEnumValue.put", - "type.property.valuetypes.UnionFloatLiteralAsyncClient": "Type.Property.ValueTypes.UnionFloatLiteral", - "type.property.valuetypes.UnionFloatLiteralAsyncClient.get": "Type.Property.ValueTypes.UnionFloatLiteral.get", - "type.property.valuetypes.UnionFloatLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnionFloatLiteral.get", - "type.property.valuetypes.UnionFloatLiteralAsyncClient.put": "Type.Property.ValueTypes.UnionFloatLiteral.put", - "type.property.valuetypes.UnionFloatLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnionFloatLiteral.put", - "type.property.valuetypes.UnionFloatLiteralClient": "Type.Property.ValueTypes.UnionFloatLiteral", - "type.property.valuetypes.UnionFloatLiteralClient.get": "Type.Property.ValueTypes.UnionFloatLiteral.get", - "type.property.valuetypes.UnionFloatLiteralClient.getWithResponse": "Type.Property.ValueTypes.UnionFloatLiteral.get", - "type.property.valuetypes.UnionFloatLiteralClient.put": "Type.Property.ValueTypes.UnionFloatLiteral.put", - "type.property.valuetypes.UnionFloatLiteralClient.putWithResponse": "Type.Property.ValueTypes.UnionFloatLiteral.put", - "type.property.valuetypes.UnionIntLiteralAsyncClient": "Type.Property.ValueTypes.UnionIntLiteral", - "type.property.valuetypes.UnionIntLiteralAsyncClient.get": "Type.Property.ValueTypes.UnionIntLiteral.get", - "type.property.valuetypes.UnionIntLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnionIntLiteral.get", - "type.property.valuetypes.UnionIntLiteralAsyncClient.put": "Type.Property.ValueTypes.UnionIntLiteral.put", - "type.property.valuetypes.UnionIntLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnionIntLiteral.put", - "type.property.valuetypes.UnionIntLiteralClient": "Type.Property.ValueTypes.UnionIntLiteral", - "type.property.valuetypes.UnionIntLiteralClient.get": "Type.Property.ValueTypes.UnionIntLiteral.get", - "type.property.valuetypes.UnionIntLiteralClient.getWithResponse": "Type.Property.ValueTypes.UnionIntLiteral.get", - "type.property.valuetypes.UnionIntLiteralClient.put": "Type.Property.ValueTypes.UnionIntLiteral.put", - "type.property.valuetypes.UnionIntLiteralClient.putWithResponse": "Type.Property.ValueTypes.UnionIntLiteral.put", - "type.property.valuetypes.UnionStringLiteralAsyncClient": "Type.Property.ValueTypes.UnionStringLiteral", - "type.property.valuetypes.UnionStringLiteralAsyncClient.get": "Type.Property.ValueTypes.UnionStringLiteral.get", - "type.property.valuetypes.UnionStringLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnionStringLiteral.get", - "type.property.valuetypes.UnionStringLiteralAsyncClient.put": "Type.Property.ValueTypes.UnionStringLiteral.put", - "type.property.valuetypes.UnionStringLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnionStringLiteral.put", - "type.property.valuetypes.UnionStringLiteralClient": "Type.Property.ValueTypes.UnionStringLiteral", - "type.property.valuetypes.UnionStringLiteralClient.get": "Type.Property.ValueTypes.UnionStringLiteral.get", - "type.property.valuetypes.UnionStringLiteralClient.getWithResponse": "Type.Property.ValueTypes.UnionStringLiteral.get", - "type.property.valuetypes.UnionStringLiteralClient.put": "Type.Property.ValueTypes.UnionStringLiteral.put", - "type.property.valuetypes.UnionStringLiteralClient.putWithResponse": "Type.Property.ValueTypes.UnionStringLiteral.put", - "type.property.valuetypes.UnknownArrayAsyncClient": "Type.Property.ValueTypes.UnknownArray", - "type.property.valuetypes.UnknownArrayAsyncClient.get": "Type.Property.ValueTypes.UnknownArray.get", - "type.property.valuetypes.UnknownArrayAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnknownArray.get", - "type.property.valuetypes.UnknownArrayAsyncClient.put": "Type.Property.ValueTypes.UnknownArray.put", - "type.property.valuetypes.UnknownArrayAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnknownArray.put", - "type.property.valuetypes.UnknownArrayClient": "Type.Property.ValueTypes.UnknownArray", - "type.property.valuetypes.UnknownArrayClient.get": "Type.Property.ValueTypes.UnknownArray.get", - "type.property.valuetypes.UnknownArrayClient.getWithResponse": "Type.Property.ValueTypes.UnknownArray.get", - "type.property.valuetypes.UnknownArrayClient.put": "Type.Property.ValueTypes.UnknownArray.put", - "type.property.valuetypes.UnknownArrayClient.putWithResponse": "Type.Property.ValueTypes.UnknownArray.put", - "type.property.valuetypes.UnknownDictAsyncClient": "Type.Property.ValueTypes.UnknownDict", - "type.property.valuetypes.UnknownDictAsyncClient.get": "Type.Property.ValueTypes.UnknownDict.get", - "type.property.valuetypes.UnknownDictAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnknownDict.get", - "type.property.valuetypes.UnknownDictAsyncClient.put": "Type.Property.ValueTypes.UnknownDict.put", - "type.property.valuetypes.UnknownDictAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnknownDict.put", - "type.property.valuetypes.UnknownDictClient": "Type.Property.ValueTypes.UnknownDict", - "type.property.valuetypes.UnknownDictClient.get": "Type.Property.ValueTypes.UnknownDict.get", - "type.property.valuetypes.UnknownDictClient.getWithResponse": "Type.Property.ValueTypes.UnknownDict.get", - "type.property.valuetypes.UnknownDictClient.put": "Type.Property.ValueTypes.UnknownDict.put", - "type.property.valuetypes.UnknownDictClient.putWithResponse": "Type.Property.ValueTypes.UnknownDict.put", - "type.property.valuetypes.UnknownIntAsyncClient": "Type.Property.ValueTypes.UnknownInt", - "type.property.valuetypes.UnknownIntAsyncClient.get": "Type.Property.ValueTypes.UnknownInt.get", - "type.property.valuetypes.UnknownIntAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnknownInt.get", - "type.property.valuetypes.UnknownIntAsyncClient.put": "Type.Property.ValueTypes.UnknownInt.put", - "type.property.valuetypes.UnknownIntAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnknownInt.put", - "type.property.valuetypes.UnknownIntClient": "Type.Property.ValueTypes.UnknownInt", - "type.property.valuetypes.UnknownIntClient.get": "Type.Property.ValueTypes.UnknownInt.get", - "type.property.valuetypes.UnknownIntClient.getWithResponse": "Type.Property.ValueTypes.UnknownInt.get", - "type.property.valuetypes.UnknownIntClient.put": "Type.Property.ValueTypes.UnknownInt.put", - "type.property.valuetypes.UnknownIntClient.putWithResponse": "Type.Property.ValueTypes.UnknownInt.put", - "type.property.valuetypes.UnknownStringAsyncClient": "Type.Property.ValueTypes.UnknownString", - "type.property.valuetypes.UnknownStringAsyncClient.get": "Type.Property.ValueTypes.UnknownString.get", - "type.property.valuetypes.UnknownStringAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnknownString.get", - "type.property.valuetypes.UnknownStringAsyncClient.put": "Type.Property.ValueTypes.UnknownString.put", - "type.property.valuetypes.UnknownStringAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnknownString.put", - "type.property.valuetypes.UnknownStringClient": "Type.Property.ValueTypes.UnknownString", - "type.property.valuetypes.UnknownStringClient.get": "Type.Property.ValueTypes.UnknownString.get", - "type.property.valuetypes.UnknownStringClient.getWithResponse": "Type.Property.ValueTypes.UnknownString.get", - "type.property.valuetypes.UnknownStringClient.put": "Type.Property.ValueTypes.UnknownString.put", - "type.property.valuetypes.UnknownStringClient.putWithResponse": "Type.Property.ValueTypes.UnknownString.put", - "type.property.valuetypes.ValueTypesClientBuilder": "Type.Property.ValueTypes", - "type.property.valuetypes.models.BooleanLiteralProperty": "Type.Property.ValueTypes.BooleanLiteralProperty", - "type.property.valuetypes.models.BooleanProperty": "Type.Property.ValueTypes.BooleanProperty", - "type.property.valuetypes.models.BytesProperty": "Type.Property.ValueTypes.BytesProperty", - "type.property.valuetypes.models.CollectionsIntProperty": "Type.Property.ValueTypes.CollectionsIntProperty", - "type.property.valuetypes.models.CollectionsModelProperty": "Type.Property.ValueTypes.CollectionsModelProperty", - "type.property.valuetypes.models.CollectionsStringProperty": "Type.Property.ValueTypes.CollectionsStringProperty", - "type.property.valuetypes.models.DatetimeProperty": "Type.Property.ValueTypes.DatetimeProperty", - "type.property.valuetypes.models.Decimal128Property": "Type.Property.ValueTypes.Decimal128Property", - "type.property.valuetypes.models.DecimalProperty": "Type.Property.ValueTypes.DecimalProperty", - "type.property.valuetypes.models.DictionaryStringProperty": "Type.Property.ValueTypes.DictionaryStringProperty", - "type.property.valuetypes.models.DurationProperty": "Type.Property.ValueTypes.DurationProperty", - "type.property.valuetypes.models.EnumProperty": "Type.Property.ValueTypes.EnumProperty", - "type.property.valuetypes.models.ExtendedEnum": "Type.Property.ValueTypes.ExtendedEnum", - "type.property.valuetypes.models.ExtensibleEnumProperty": "Type.Property.ValueTypes.ExtensibleEnumProperty", - "type.property.valuetypes.models.FixedInnerEnum": "Type.Property.ValueTypes.FixedInnerEnum", - "type.property.valuetypes.models.FloatLiteralProperty": "Type.Property.ValueTypes.FloatLiteralProperty", - "type.property.valuetypes.models.FloatProperty": "Type.Property.ValueTypes.FloatProperty", - "type.property.valuetypes.models.InnerEnum": "Type.Property.ValueTypes.InnerEnum", - "type.property.valuetypes.models.InnerModel": "Type.Property.ValueTypes.InnerModel", - "type.property.valuetypes.models.IntLiteralProperty": "Type.Property.ValueTypes.IntLiteralProperty", - "type.property.valuetypes.models.IntProperty": "Type.Property.ValueTypes.IntProperty", - "type.property.valuetypes.models.ModelProperty": "Type.Property.ValueTypes.ModelProperty", - "type.property.valuetypes.models.NeverProperty": "Type.Property.ValueTypes.NeverProperty", - "type.property.valuetypes.models.StringLiteralProperty": "Type.Property.ValueTypes.StringLiteralProperty", - "type.property.valuetypes.models.StringProperty": "Type.Property.ValueTypes.StringProperty", - "type.property.valuetypes.models.UnionEnumValueProperty": "Type.Property.ValueTypes.UnionEnumValueProperty", - "type.property.valuetypes.models.UnionFloatLiteralProperty": "Type.Property.ValueTypes.UnionFloatLiteralProperty", - "type.property.valuetypes.models.UnionFloatLiteralPropertyProperty": "Type.Property.ValueTypes.UnionFloatLiteralProperty.property.anonymous", - "type.property.valuetypes.models.UnionIntLiteralProperty": "Type.Property.ValueTypes.UnionIntLiteralProperty", - "type.property.valuetypes.models.UnionIntLiteralPropertyProperty": "Type.Property.ValueTypes.UnionIntLiteralProperty.property.anonymous", - "type.property.valuetypes.models.UnionStringLiteralProperty": "Type.Property.ValueTypes.UnionStringLiteralProperty", - "type.property.valuetypes.models.UnionStringLiteralPropertyProperty": "Type.Property.ValueTypes.UnionStringLiteralProperty.property.anonymous", - "type.property.valuetypes.models.UnknownArrayProperty": "Type.Property.ValueTypes.UnknownArrayProperty", - "type.property.valuetypes.models.UnknownDictProperty": "Type.Property.ValueTypes.UnknownDictProperty", - "type.property.valuetypes.models.UnknownIntProperty": "Type.Property.ValueTypes.UnknownIntProperty", - "type.property.valuetypes.models.UnknownStringProperty": "Type.Property.ValueTypes.UnknownStringProperty" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_metadata.json deleted file mode 100644 index 8be7c6e3ac4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.property.valuetypes.BooleanLiteralAsyncClient":"Type.Property.ValueTypes.BooleanLiteral","type.property.valuetypes.BooleanLiteralAsyncClient.get":"Type.Property.ValueTypes.BooleanLiteral.get","type.property.valuetypes.BooleanLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.BooleanLiteral.get","type.property.valuetypes.BooleanLiteralAsyncClient.put":"Type.Property.ValueTypes.BooleanLiteral.put","type.property.valuetypes.BooleanLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.BooleanLiteral.put","type.property.valuetypes.BooleanLiteralClient":"Type.Property.ValueTypes.BooleanLiteral","type.property.valuetypes.BooleanLiteralClient.get":"Type.Property.ValueTypes.BooleanLiteral.get","type.property.valuetypes.BooleanLiteralClient.getWithResponse":"Type.Property.ValueTypes.BooleanLiteral.get","type.property.valuetypes.BooleanLiteralClient.put":"Type.Property.ValueTypes.BooleanLiteral.put","type.property.valuetypes.BooleanLiteralClient.putWithResponse":"Type.Property.ValueTypes.BooleanLiteral.put","type.property.valuetypes.BooleanOperationAsyncClient":"Type.Property.ValueTypes.Boolean","type.property.valuetypes.BooleanOperationAsyncClient.get":"Type.Property.ValueTypes.Boolean.get","type.property.valuetypes.BooleanOperationAsyncClient.getWithResponse":"Type.Property.ValueTypes.Boolean.get","type.property.valuetypes.BooleanOperationAsyncClient.put":"Type.Property.ValueTypes.Boolean.put","type.property.valuetypes.BooleanOperationAsyncClient.putWithResponse":"Type.Property.ValueTypes.Boolean.put","type.property.valuetypes.BooleanOperationClient":"Type.Property.ValueTypes.Boolean","type.property.valuetypes.BooleanOperationClient.get":"Type.Property.ValueTypes.Boolean.get","type.property.valuetypes.BooleanOperationClient.getWithResponse":"Type.Property.ValueTypes.Boolean.get","type.property.valuetypes.BooleanOperationClient.put":"Type.Property.ValueTypes.Boolean.put","type.property.valuetypes.BooleanOperationClient.putWithResponse":"Type.Property.ValueTypes.Boolean.put","type.property.valuetypes.BytesAsyncClient":"Type.Property.ValueTypes.Bytes","type.property.valuetypes.BytesAsyncClient.get":"Type.Property.ValueTypes.Bytes.get","type.property.valuetypes.BytesAsyncClient.getWithResponse":"Type.Property.ValueTypes.Bytes.get","type.property.valuetypes.BytesAsyncClient.put":"Type.Property.ValueTypes.Bytes.put","type.property.valuetypes.BytesAsyncClient.putWithResponse":"Type.Property.ValueTypes.Bytes.put","type.property.valuetypes.BytesClient":"Type.Property.ValueTypes.Bytes","type.property.valuetypes.BytesClient.get":"Type.Property.ValueTypes.Bytes.get","type.property.valuetypes.BytesClient.getWithResponse":"Type.Property.ValueTypes.Bytes.get","type.property.valuetypes.BytesClient.put":"Type.Property.ValueTypes.Bytes.put","type.property.valuetypes.BytesClient.putWithResponse":"Type.Property.ValueTypes.Bytes.put","type.property.valuetypes.CollectionsIntAsyncClient":"Type.Property.ValueTypes.CollectionsInt","type.property.valuetypes.CollectionsIntAsyncClient.get":"Type.Property.ValueTypes.CollectionsInt.get","type.property.valuetypes.CollectionsIntAsyncClient.getWithResponse":"Type.Property.ValueTypes.CollectionsInt.get","type.property.valuetypes.CollectionsIntAsyncClient.put":"Type.Property.ValueTypes.CollectionsInt.put","type.property.valuetypes.CollectionsIntAsyncClient.putWithResponse":"Type.Property.ValueTypes.CollectionsInt.put","type.property.valuetypes.CollectionsIntClient":"Type.Property.ValueTypes.CollectionsInt","type.property.valuetypes.CollectionsIntClient.get":"Type.Property.ValueTypes.CollectionsInt.get","type.property.valuetypes.CollectionsIntClient.getWithResponse":"Type.Property.ValueTypes.CollectionsInt.get","type.property.valuetypes.CollectionsIntClient.put":"Type.Property.ValueTypes.CollectionsInt.put","type.property.valuetypes.CollectionsIntClient.putWithResponse":"Type.Property.ValueTypes.CollectionsInt.put","type.property.valuetypes.CollectionsModelAsyncClient":"Type.Property.ValueTypes.CollectionsModel","type.property.valuetypes.CollectionsModelAsyncClient.get":"Type.Property.ValueTypes.CollectionsModel.get","type.property.valuetypes.CollectionsModelAsyncClient.getWithResponse":"Type.Property.ValueTypes.CollectionsModel.get","type.property.valuetypes.CollectionsModelAsyncClient.put":"Type.Property.ValueTypes.CollectionsModel.put","type.property.valuetypes.CollectionsModelAsyncClient.putWithResponse":"Type.Property.ValueTypes.CollectionsModel.put","type.property.valuetypes.CollectionsModelClient":"Type.Property.ValueTypes.CollectionsModel","type.property.valuetypes.CollectionsModelClient.get":"Type.Property.ValueTypes.CollectionsModel.get","type.property.valuetypes.CollectionsModelClient.getWithResponse":"Type.Property.ValueTypes.CollectionsModel.get","type.property.valuetypes.CollectionsModelClient.put":"Type.Property.ValueTypes.CollectionsModel.put","type.property.valuetypes.CollectionsModelClient.putWithResponse":"Type.Property.ValueTypes.CollectionsModel.put","type.property.valuetypes.CollectionsStringAsyncClient":"Type.Property.ValueTypes.CollectionsString","type.property.valuetypes.CollectionsStringAsyncClient.get":"Type.Property.ValueTypes.CollectionsString.get","type.property.valuetypes.CollectionsStringAsyncClient.getWithResponse":"Type.Property.ValueTypes.CollectionsString.get","type.property.valuetypes.CollectionsStringAsyncClient.put":"Type.Property.ValueTypes.CollectionsString.put","type.property.valuetypes.CollectionsStringAsyncClient.putWithResponse":"Type.Property.ValueTypes.CollectionsString.put","type.property.valuetypes.CollectionsStringClient":"Type.Property.ValueTypes.CollectionsString","type.property.valuetypes.CollectionsStringClient.get":"Type.Property.ValueTypes.CollectionsString.get","type.property.valuetypes.CollectionsStringClient.getWithResponse":"Type.Property.ValueTypes.CollectionsString.get","type.property.valuetypes.CollectionsStringClient.put":"Type.Property.ValueTypes.CollectionsString.put","type.property.valuetypes.CollectionsStringClient.putWithResponse":"Type.Property.ValueTypes.CollectionsString.put","type.property.valuetypes.DatetimeOperationAsyncClient":"Type.Property.ValueTypes.Datetime","type.property.valuetypes.DatetimeOperationAsyncClient.get":"Type.Property.ValueTypes.Datetime.get","type.property.valuetypes.DatetimeOperationAsyncClient.getWithResponse":"Type.Property.ValueTypes.Datetime.get","type.property.valuetypes.DatetimeOperationAsyncClient.put":"Type.Property.ValueTypes.Datetime.put","type.property.valuetypes.DatetimeOperationAsyncClient.putWithResponse":"Type.Property.ValueTypes.Datetime.put","type.property.valuetypes.DatetimeOperationClient":"Type.Property.ValueTypes.Datetime","type.property.valuetypes.DatetimeOperationClient.get":"Type.Property.ValueTypes.Datetime.get","type.property.valuetypes.DatetimeOperationClient.getWithResponse":"Type.Property.ValueTypes.Datetime.get","type.property.valuetypes.DatetimeOperationClient.put":"Type.Property.ValueTypes.Datetime.put","type.property.valuetypes.DatetimeOperationClient.putWithResponse":"Type.Property.ValueTypes.Datetime.put","type.property.valuetypes.Decimal128AsyncClient":"Type.Property.ValueTypes.Decimal128","type.property.valuetypes.Decimal128AsyncClient.get":"Type.Property.ValueTypes.Decimal128.get","type.property.valuetypes.Decimal128AsyncClient.getWithResponse":"Type.Property.ValueTypes.Decimal128.get","type.property.valuetypes.Decimal128AsyncClient.put":"Type.Property.ValueTypes.Decimal128.put","type.property.valuetypes.Decimal128AsyncClient.putWithResponse":"Type.Property.ValueTypes.Decimal128.put","type.property.valuetypes.Decimal128Client":"Type.Property.ValueTypes.Decimal128","type.property.valuetypes.Decimal128Client.get":"Type.Property.ValueTypes.Decimal128.get","type.property.valuetypes.Decimal128Client.getWithResponse":"Type.Property.ValueTypes.Decimal128.get","type.property.valuetypes.Decimal128Client.put":"Type.Property.ValueTypes.Decimal128.put","type.property.valuetypes.Decimal128Client.putWithResponse":"Type.Property.ValueTypes.Decimal128.put","type.property.valuetypes.DecimalAsyncClient":"Type.Property.ValueTypes.Decimal","type.property.valuetypes.DecimalAsyncClient.get":"Type.Property.ValueTypes.Decimal.get","type.property.valuetypes.DecimalAsyncClient.getWithResponse":"Type.Property.ValueTypes.Decimal.get","type.property.valuetypes.DecimalAsyncClient.put":"Type.Property.ValueTypes.Decimal.put","type.property.valuetypes.DecimalAsyncClient.putWithResponse":"Type.Property.ValueTypes.Decimal.put","type.property.valuetypes.DecimalClient":"Type.Property.ValueTypes.Decimal","type.property.valuetypes.DecimalClient.get":"Type.Property.ValueTypes.Decimal.get","type.property.valuetypes.DecimalClient.getWithResponse":"Type.Property.ValueTypes.Decimal.get","type.property.valuetypes.DecimalClient.put":"Type.Property.ValueTypes.Decimal.put","type.property.valuetypes.DecimalClient.putWithResponse":"Type.Property.ValueTypes.Decimal.put","type.property.valuetypes.DictionaryStringAsyncClient":"Type.Property.ValueTypes.DictionaryString","type.property.valuetypes.DictionaryStringAsyncClient.get":"Type.Property.ValueTypes.DictionaryString.get","type.property.valuetypes.DictionaryStringAsyncClient.getWithResponse":"Type.Property.ValueTypes.DictionaryString.get","type.property.valuetypes.DictionaryStringAsyncClient.put":"Type.Property.ValueTypes.DictionaryString.put","type.property.valuetypes.DictionaryStringAsyncClient.putWithResponse":"Type.Property.ValueTypes.DictionaryString.put","type.property.valuetypes.DictionaryStringClient":"Type.Property.ValueTypes.DictionaryString","type.property.valuetypes.DictionaryStringClient.get":"Type.Property.ValueTypes.DictionaryString.get","type.property.valuetypes.DictionaryStringClient.getWithResponse":"Type.Property.ValueTypes.DictionaryString.get","type.property.valuetypes.DictionaryStringClient.put":"Type.Property.ValueTypes.DictionaryString.put","type.property.valuetypes.DictionaryStringClient.putWithResponse":"Type.Property.ValueTypes.DictionaryString.put","type.property.valuetypes.DurationOperationAsyncClient":"Type.Property.ValueTypes.Duration","type.property.valuetypes.DurationOperationAsyncClient.get":"Type.Property.ValueTypes.Duration.get","type.property.valuetypes.DurationOperationAsyncClient.getWithResponse":"Type.Property.ValueTypes.Duration.get","type.property.valuetypes.DurationOperationAsyncClient.put":"Type.Property.ValueTypes.Duration.put","type.property.valuetypes.DurationOperationAsyncClient.putWithResponse":"Type.Property.ValueTypes.Duration.put","type.property.valuetypes.DurationOperationClient":"Type.Property.ValueTypes.Duration","type.property.valuetypes.DurationOperationClient.get":"Type.Property.ValueTypes.Duration.get","type.property.valuetypes.DurationOperationClient.getWithResponse":"Type.Property.ValueTypes.Duration.get","type.property.valuetypes.DurationOperationClient.put":"Type.Property.ValueTypes.Duration.put","type.property.valuetypes.DurationOperationClient.putWithResponse":"Type.Property.ValueTypes.Duration.put","type.property.valuetypes.EnumAsyncClient":"Type.Property.ValueTypes.Enum","type.property.valuetypes.EnumAsyncClient.get":"Type.Property.ValueTypes.Enum.get","type.property.valuetypes.EnumAsyncClient.getWithResponse":"Type.Property.ValueTypes.Enum.get","type.property.valuetypes.EnumAsyncClient.put":"Type.Property.ValueTypes.Enum.put","type.property.valuetypes.EnumAsyncClient.putWithResponse":"Type.Property.ValueTypes.Enum.put","type.property.valuetypes.EnumClient":"Type.Property.ValueTypes.Enum","type.property.valuetypes.EnumClient.get":"Type.Property.ValueTypes.Enum.get","type.property.valuetypes.EnumClient.getWithResponse":"Type.Property.ValueTypes.Enum.get","type.property.valuetypes.EnumClient.put":"Type.Property.ValueTypes.Enum.put","type.property.valuetypes.EnumClient.putWithResponse":"Type.Property.ValueTypes.Enum.put","type.property.valuetypes.ExtensibleEnumAsyncClient":"Type.Property.ValueTypes.ExtensibleEnum","type.property.valuetypes.ExtensibleEnumAsyncClient.get":"Type.Property.ValueTypes.ExtensibleEnum.get","type.property.valuetypes.ExtensibleEnumAsyncClient.getWithResponse":"Type.Property.ValueTypes.ExtensibleEnum.get","type.property.valuetypes.ExtensibleEnumAsyncClient.put":"Type.Property.ValueTypes.ExtensibleEnum.put","type.property.valuetypes.ExtensibleEnumAsyncClient.putWithResponse":"Type.Property.ValueTypes.ExtensibleEnum.put","type.property.valuetypes.ExtensibleEnumClient":"Type.Property.ValueTypes.ExtensibleEnum","type.property.valuetypes.ExtensibleEnumClient.get":"Type.Property.ValueTypes.ExtensibleEnum.get","type.property.valuetypes.ExtensibleEnumClient.getWithResponse":"Type.Property.ValueTypes.ExtensibleEnum.get","type.property.valuetypes.ExtensibleEnumClient.put":"Type.Property.ValueTypes.ExtensibleEnum.put","type.property.valuetypes.ExtensibleEnumClient.putWithResponse":"Type.Property.ValueTypes.ExtensibleEnum.put","type.property.valuetypes.FloatLiteralAsyncClient":"Type.Property.ValueTypes.FloatLiteral","type.property.valuetypes.FloatLiteralAsyncClient.get":"Type.Property.ValueTypes.FloatLiteral.get","type.property.valuetypes.FloatLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.FloatLiteral.get","type.property.valuetypes.FloatLiteralAsyncClient.put":"Type.Property.ValueTypes.FloatLiteral.put","type.property.valuetypes.FloatLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.FloatLiteral.put","type.property.valuetypes.FloatLiteralClient":"Type.Property.ValueTypes.FloatLiteral","type.property.valuetypes.FloatLiteralClient.get":"Type.Property.ValueTypes.FloatLiteral.get","type.property.valuetypes.FloatLiteralClient.getWithResponse":"Type.Property.ValueTypes.FloatLiteral.get","type.property.valuetypes.FloatLiteralClient.put":"Type.Property.ValueTypes.FloatLiteral.put","type.property.valuetypes.FloatLiteralClient.putWithResponse":"Type.Property.ValueTypes.FloatLiteral.put","type.property.valuetypes.FloatOperationAsyncClient":"Type.Property.ValueTypes.Float","type.property.valuetypes.FloatOperationAsyncClient.get":"Type.Property.ValueTypes.Float.get","type.property.valuetypes.FloatOperationAsyncClient.getWithResponse":"Type.Property.ValueTypes.Float.get","type.property.valuetypes.FloatOperationAsyncClient.put":"Type.Property.ValueTypes.Float.put","type.property.valuetypes.FloatOperationAsyncClient.putWithResponse":"Type.Property.ValueTypes.Float.put","type.property.valuetypes.FloatOperationClient":"Type.Property.ValueTypes.Float","type.property.valuetypes.FloatOperationClient.get":"Type.Property.ValueTypes.Float.get","type.property.valuetypes.FloatOperationClient.getWithResponse":"Type.Property.ValueTypes.Float.get","type.property.valuetypes.FloatOperationClient.put":"Type.Property.ValueTypes.Float.put","type.property.valuetypes.FloatOperationClient.putWithResponse":"Type.Property.ValueTypes.Float.put","type.property.valuetypes.IntAsyncClient":"Type.Property.ValueTypes.Int","type.property.valuetypes.IntAsyncClient.get":"Type.Property.ValueTypes.Int.get","type.property.valuetypes.IntAsyncClient.getWithResponse":"Type.Property.ValueTypes.Int.get","type.property.valuetypes.IntAsyncClient.put":"Type.Property.ValueTypes.Int.put","type.property.valuetypes.IntAsyncClient.putWithResponse":"Type.Property.ValueTypes.Int.put","type.property.valuetypes.IntClient":"Type.Property.ValueTypes.Int","type.property.valuetypes.IntClient.get":"Type.Property.ValueTypes.Int.get","type.property.valuetypes.IntClient.getWithResponse":"Type.Property.ValueTypes.Int.get","type.property.valuetypes.IntClient.put":"Type.Property.ValueTypes.Int.put","type.property.valuetypes.IntClient.putWithResponse":"Type.Property.ValueTypes.Int.put","type.property.valuetypes.IntLiteralAsyncClient":"Type.Property.ValueTypes.IntLiteral","type.property.valuetypes.IntLiteralAsyncClient.get":"Type.Property.ValueTypes.IntLiteral.get","type.property.valuetypes.IntLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.IntLiteral.get","type.property.valuetypes.IntLiteralAsyncClient.put":"Type.Property.ValueTypes.IntLiteral.put","type.property.valuetypes.IntLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.IntLiteral.put","type.property.valuetypes.IntLiteralClient":"Type.Property.ValueTypes.IntLiteral","type.property.valuetypes.IntLiteralClient.get":"Type.Property.ValueTypes.IntLiteral.get","type.property.valuetypes.IntLiteralClient.getWithResponse":"Type.Property.ValueTypes.IntLiteral.get","type.property.valuetypes.IntLiteralClient.put":"Type.Property.ValueTypes.IntLiteral.put","type.property.valuetypes.IntLiteralClient.putWithResponse":"Type.Property.ValueTypes.IntLiteral.put","type.property.valuetypes.ModelAsyncClient":"Type.Property.ValueTypes.Model","type.property.valuetypes.ModelAsyncClient.get":"Type.Property.ValueTypes.Model.get","type.property.valuetypes.ModelAsyncClient.getWithResponse":"Type.Property.ValueTypes.Model.get","type.property.valuetypes.ModelAsyncClient.put":"Type.Property.ValueTypes.Model.put","type.property.valuetypes.ModelAsyncClient.putWithResponse":"Type.Property.ValueTypes.Model.put","type.property.valuetypes.ModelClient":"Type.Property.ValueTypes.Model","type.property.valuetypes.ModelClient.get":"Type.Property.ValueTypes.Model.get","type.property.valuetypes.ModelClient.getWithResponse":"Type.Property.ValueTypes.Model.get","type.property.valuetypes.ModelClient.put":"Type.Property.ValueTypes.Model.put","type.property.valuetypes.ModelClient.putWithResponse":"Type.Property.ValueTypes.Model.put","type.property.valuetypes.NeverAsyncClient":"Type.Property.ValueTypes.Never","type.property.valuetypes.NeverAsyncClient.get":"Type.Property.ValueTypes.Never.get","type.property.valuetypes.NeverAsyncClient.getWithResponse":"Type.Property.ValueTypes.Never.get","type.property.valuetypes.NeverAsyncClient.put":"Type.Property.ValueTypes.Never.put","type.property.valuetypes.NeverAsyncClient.putWithResponse":"Type.Property.ValueTypes.Never.put","type.property.valuetypes.NeverClient":"Type.Property.ValueTypes.Never","type.property.valuetypes.NeverClient.get":"Type.Property.ValueTypes.Never.get","type.property.valuetypes.NeverClient.getWithResponse":"Type.Property.ValueTypes.Never.get","type.property.valuetypes.NeverClient.put":"Type.Property.ValueTypes.Never.put","type.property.valuetypes.NeverClient.putWithResponse":"Type.Property.ValueTypes.Never.put","type.property.valuetypes.StringLiteralAsyncClient":"Type.Property.ValueTypes.StringLiteral","type.property.valuetypes.StringLiteralAsyncClient.get":"Type.Property.ValueTypes.StringLiteral.get","type.property.valuetypes.StringLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.StringLiteral.get","type.property.valuetypes.StringLiteralAsyncClient.put":"Type.Property.ValueTypes.StringLiteral.put","type.property.valuetypes.StringLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.StringLiteral.put","type.property.valuetypes.StringLiteralClient":"Type.Property.ValueTypes.StringLiteral","type.property.valuetypes.StringLiteralClient.get":"Type.Property.ValueTypes.StringLiteral.get","type.property.valuetypes.StringLiteralClient.getWithResponse":"Type.Property.ValueTypes.StringLiteral.get","type.property.valuetypes.StringLiteralClient.put":"Type.Property.ValueTypes.StringLiteral.put","type.property.valuetypes.StringLiteralClient.putWithResponse":"Type.Property.ValueTypes.StringLiteral.put","type.property.valuetypes.StringOperationAsyncClient":"Type.Property.ValueTypes.String","type.property.valuetypes.StringOperationAsyncClient.get":"Type.Property.ValueTypes.String.get","type.property.valuetypes.StringOperationAsyncClient.getWithResponse":"Type.Property.ValueTypes.String.get","type.property.valuetypes.StringOperationAsyncClient.put":"Type.Property.ValueTypes.String.put","type.property.valuetypes.StringOperationAsyncClient.putWithResponse":"Type.Property.ValueTypes.String.put","type.property.valuetypes.StringOperationClient":"Type.Property.ValueTypes.String","type.property.valuetypes.StringOperationClient.get":"Type.Property.ValueTypes.String.get","type.property.valuetypes.StringOperationClient.getWithResponse":"Type.Property.ValueTypes.String.get","type.property.valuetypes.StringOperationClient.put":"Type.Property.ValueTypes.String.put","type.property.valuetypes.StringOperationClient.putWithResponse":"Type.Property.ValueTypes.String.put","type.property.valuetypes.UnionEnumValueAsyncClient":"Type.Property.ValueTypes.UnionEnumValue","type.property.valuetypes.UnionEnumValueAsyncClient.get":"Type.Property.ValueTypes.UnionEnumValue.get","type.property.valuetypes.UnionEnumValueAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnionEnumValue.get","type.property.valuetypes.UnionEnumValueAsyncClient.put":"Type.Property.ValueTypes.UnionEnumValue.put","type.property.valuetypes.UnionEnumValueAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnionEnumValue.put","type.property.valuetypes.UnionEnumValueClient":"Type.Property.ValueTypes.UnionEnumValue","type.property.valuetypes.UnionEnumValueClient.get":"Type.Property.ValueTypes.UnionEnumValue.get","type.property.valuetypes.UnionEnumValueClient.getWithResponse":"Type.Property.ValueTypes.UnionEnumValue.get","type.property.valuetypes.UnionEnumValueClient.put":"Type.Property.ValueTypes.UnionEnumValue.put","type.property.valuetypes.UnionEnumValueClient.putWithResponse":"Type.Property.ValueTypes.UnionEnumValue.put","type.property.valuetypes.UnionFloatLiteralAsyncClient":"Type.Property.ValueTypes.UnionFloatLiteral","type.property.valuetypes.UnionFloatLiteralAsyncClient.get":"Type.Property.ValueTypes.UnionFloatLiteral.get","type.property.valuetypes.UnionFloatLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnionFloatLiteral.get","type.property.valuetypes.UnionFloatLiteralAsyncClient.put":"Type.Property.ValueTypes.UnionFloatLiteral.put","type.property.valuetypes.UnionFloatLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnionFloatLiteral.put","type.property.valuetypes.UnionFloatLiteralClient":"Type.Property.ValueTypes.UnionFloatLiteral","type.property.valuetypes.UnionFloatLiteralClient.get":"Type.Property.ValueTypes.UnionFloatLiteral.get","type.property.valuetypes.UnionFloatLiteralClient.getWithResponse":"Type.Property.ValueTypes.UnionFloatLiteral.get","type.property.valuetypes.UnionFloatLiteralClient.put":"Type.Property.ValueTypes.UnionFloatLiteral.put","type.property.valuetypes.UnionFloatLiteralClient.putWithResponse":"Type.Property.ValueTypes.UnionFloatLiteral.put","type.property.valuetypes.UnionIntLiteralAsyncClient":"Type.Property.ValueTypes.UnionIntLiteral","type.property.valuetypes.UnionIntLiteralAsyncClient.get":"Type.Property.ValueTypes.UnionIntLiteral.get","type.property.valuetypes.UnionIntLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnionIntLiteral.get","type.property.valuetypes.UnionIntLiteralAsyncClient.put":"Type.Property.ValueTypes.UnionIntLiteral.put","type.property.valuetypes.UnionIntLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnionIntLiteral.put","type.property.valuetypes.UnionIntLiteralClient":"Type.Property.ValueTypes.UnionIntLiteral","type.property.valuetypes.UnionIntLiteralClient.get":"Type.Property.ValueTypes.UnionIntLiteral.get","type.property.valuetypes.UnionIntLiteralClient.getWithResponse":"Type.Property.ValueTypes.UnionIntLiteral.get","type.property.valuetypes.UnionIntLiteralClient.put":"Type.Property.ValueTypes.UnionIntLiteral.put","type.property.valuetypes.UnionIntLiteralClient.putWithResponse":"Type.Property.ValueTypes.UnionIntLiteral.put","type.property.valuetypes.UnionStringLiteralAsyncClient":"Type.Property.ValueTypes.UnionStringLiteral","type.property.valuetypes.UnionStringLiteralAsyncClient.get":"Type.Property.ValueTypes.UnionStringLiteral.get","type.property.valuetypes.UnionStringLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnionStringLiteral.get","type.property.valuetypes.UnionStringLiteralAsyncClient.put":"Type.Property.ValueTypes.UnionStringLiteral.put","type.property.valuetypes.UnionStringLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnionStringLiteral.put","type.property.valuetypes.UnionStringLiteralClient":"Type.Property.ValueTypes.UnionStringLiteral","type.property.valuetypes.UnionStringLiteralClient.get":"Type.Property.ValueTypes.UnionStringLiteral.get","type.property.valuetypes.UnionStringLiteralClient.getWithResponse":"Type.Property.ValueTypes.UnionStringLiteral.get","type.property.valuetypes.UnionStringLiteralClient.put":"Type.Property.ValueTypes.UnionStringLiteral.put","type.property.valuetypes.UnionStringLiteralClient.putWithResponse":"Type.Property.ValueTypes.UnionStringLiteral.put","type.property.valuetypes.UnknownArrayAsyncClient":"Type.Property.ValueTypes.UnknownArray","type.property.valuetypes.UnknownArrayAsyncClient.get":"Type.Property.ValueTypes.UnknownArray.get","type.property.valuetypes.UnknownArrayAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnknownArray.get","type.property.valuetypes.UnknownArrayAsyncClient.put":"Type.Property.ValueTypes.UnknownArray.put","type.property.valuetypes.UnknownArrayAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnknownArray.put","type.property.valuetypes.UnknownArrayClient":"Type.Property.ValueTypes.UnknownArray","type.property.valuetypes.UnknownArrayClient.get":"Type.Property.ValueTypes.UnknownArray.get","type.property.valuetypes.UnknownArrayClient.getWithResponse":"Type.Property.ValueTypes.UnknownArray.get","type.property.valuetypes.UnknownArrayClient.put":"Type.Property.ValueTypes.UnknownArray.put","type.property.valuetypes.UnknownArrayClient.putWithResponse":"Type.Property.ValueTypes.UnknownArray.put","type.property.valuetypes.UnknownDictAsyncClient":"Type.Property.ValueTypes.UnknownDict","type.property.valuetypes.UnknownDictAsyncClient.get":"Type.Property.ValueTypes.UnknownDict.get","type.property.valuetypes.UnknownDictAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnknownDict.get","type.property.valuetypes.UnknownDictAsyncClient.put":"Type.Property.ValueTypes.UnknownDict.put","type.property.valuetypes.UnknownDictAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnknownDict.put","type.property.valuetypes.UnknownDictClient":"Type.Property.ValueTypes.UnknownDict","type.property.valuetypes.UnknownDictClient.get":"Type.Property.ValueTypes.UnknownDict.get","type.property.valuetypes.UnknownDictClient.getWithResponse":"Type.Property.ValueTypes.UnknownDict.get","type.property.valuetypes.UnknownDictClient.put":"Type.Property.ValueTypes.UnknownDict.put","type.property.valuetypes.UnknownDictClient.putWithResponse":"Type.Property.ValueTypes.UnknownDict.put","type.property.valuetypes.UnknownIntAsyncClient":"Type.Property.ValueTypes.UnknownInt","type.property.valuetypes.UnknownIntAsyncClient.get":"Type.Property.ValueTypes.UnknownInt.get","type.property.valuetypes.UnknownIntAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnknownInt.get","type.property.valuetypes.UnknownIntAsyncClient.put":"Type.Property.ValueTypes.UnknownInt.put","type.property.valuetypes.UnknownIntAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnknownInt.put","type.property.valuetypes.UnknownIntClient":"Type.Property.ValueTypes.UnknownInt","type.property.valuetypes.UnknownIntClient.get":"Type.Property.ValueTypes.UnknownInt.get","type.property.valuetypes.UnknownIntClient.getWithResponse":"Type.Property.ValueTypes.UnknownInt.get","type.property.valuetypes.UnknownIntClient.put":"Type.Property.ValueTypes.UnknownInt.put","type.property.valuetypes.UnknownIntClient.putWithResponse":"Type.Property.ValueTypes.UnknownInt.put","type.property.valuetypes.UnknownStringAsyncClient":"Type.Property.ValueTypes.UnknownString","type.property.valuetypes.UnknownStringAsyncClient.get":"Type.Property.ValueTypes.UnknownString.get","type.property.valuetypes.UnknownStringAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnknownString.get","type.property.valuetypes.UnknownStringAsyncClient.put":"Type.Property.ValueTypes.UnknownString.put","type.property.valuetypes.UnknownStringAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnknownString.put","type.property.valuetypes.UnknownStringClient":"Type.Property.ValueTypes.UnknownString","type.property.valuetypes.UnknownStringClient.get":"Type.Property.ValueTypes.UnknownString.get","type.property.valuetypes.UnknownStringClient.getWithResponse":"Type.Property.ValueTypes.UnknownString.get","type.property.valuetypes.UnknownStringClient.put":"Type.Property.ValueTypes.UnknownString.put","type.property.valuetypes.UnknownStringClient.putWithResponse":"Type.Property.ValueTypes.UnknownString.put","type.property.valuetypes.ValueTypesClientBuilder":"Type.Property.ValueTypes","type.property.valuetypes.models.BooleanLiteralProperty":"Type.Property.ValueTypes.BooleanLiteralProperty","type.property.valuetypes.models.BooleanProperty":"Type.Property.ValueTypes.BooleanProperty","type.property.valuetypes.models.BytesProperty":"Type.Property.ValueTypes.BytesProperty","type.property.valuetypes.models.CollectionsIntProperty":"Type.Property.ValueTypes.CollectionsIntProperty","type.property.valuetypes.models.CollectionsModelProperty":"Type.Property.ValueTypes.CollectionsModelProperty","type.property.valuetypes.models.CollectionsStringProperty":"Type.Property.ValueTypes.CollectionsStringProperty","type.property.valuetypes.models.DatetimeProperty":"Type.Property.ValueTypes.DatetimeProperty","type.property.valuetypes.models.Decimal128Property":"Type.Property.ValueTypes.Decimal128Property","type.property.valuetypes.models.DecimalProperty":"Type.Property.ValueTypes.DecimalProperty","type.property.valuetypes.models.DictionaryStringProperty":"Type.Property.ValueTypes.DictionaryStringProperty","type.property.valuetypes.models.DurationProperty":"Type.Property.ValueTypes.DurationProperty","type.property.valuetypes.models.EnumProperty":"Type.Property.ValueTypes.EnumProperty","type.property.valuetypes.models.ExtendedEnum":"Type.Property.ValueTypes.ExtendedEnum","type.property.valuetypes.models.ExtensibleEnumProperty":"Type.Property.ValueTypes.ExtensibleEnumProperty","type.property.valuetypes.models.FixedInnerEnum":"Type.Property.ValueTypes.FixedInnerEnum","type.property.valuetypes.models.FloatLiteralProperty":"Type.Property.ValueTypes.FloatLiteralProperty","type.property.valuetypes.models.FloatProperty":"Type.Property.ValueTypes.FloatProperty","type.property.valuetypes.models.InnerEnum":"Type.Property.ValueTypes.InnerEnum","type.property.valuetypes.models.InnerModel":"Type.Property.ValueTypes.InnerModel","type.property.valuetypes.models.IntLiteralProperty":"Type.Property.ValueTypes.IntLiteralProperty","type.property.valuetypes.models.IntProperty":"Type.Property.ValueTypes.IntProperty","type.property.valuetypes.models.ModelProperty":"Type.Property.ValueTypes.ModelProperty","type.property.valuetypes.models.NeverProperty":"Type.Property.ValueTypes.NeverProperty","type.property.valuetypes.models.StringLiteralProperty":"Type.Property.ValueTypes.StringLiteralProperty","type.property.valuetypes.models.StringProperty":"Type.Property.ValueTypes.StringProperty","type.property.valuetypes.models.UnionEnumValueProperty":"Type.Property.ValueTypes.UnionEnumValueProperty","type.property.valuetypes.models.UnionFloatLiteralProperty":"Type.Property.ValueTypes.UnionFloatLiteralProperty","type.property.valuetypes.models.UnionFloatLiteralPropertyProperty":"Type.Property.ValueTypes.UnionFloatLiteralProperty.property.anonymous","type.property.valuetypes.models.UnionIntLiteralProperty":"Type.Property.ValueTypes.UnionIntLiteralProperty","type.property.valuetypes.models.UnionIntLiteralPropertyProperty":"Type.Property.ValueTypes.UnionIntLiteralProperty.property.anonymous","type.property.valuetypes.models.UnionStringLiteralProperty":"Type.Property.ValueTypes.UnionStringLiteralProperty","type.property.valuetypes.models.UnionStringLiteralPropertyProperty":"Type.Property.ValueTypes.UnionStringLiteralProperty.property.anonymous","type.property.valuetypes.models.UnknownArrayProperty":"Type.Property.ValueTypes.UnknownArrayProperty","type.property.valuetypes.models.UnknownDictProperty":"Type.Property.ValueTypes.UnknownDictProperty","type.property.valuetypes.models.UnknownIntProperty":"Type.Property.ValueTypes.UnknownIntProperty","type.property.valuetypes.models.UnknownStringProperty":"Type.Property.ValueTypes.UnknownStringProperty"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/property/valuetypes/BooleanLiteralAsyncClient.java","src/main/java/type/property/valuetypes/BooleanLiteralClient.java","src/main/java/type/property/valuetypes/BooleanOperationAsyncClient.java","src/main/java/type/property/valuetypes/BooleanOperationClient.java","src/main/java/type/property/valuetypes/BytesAsyncClient.java","src/main/java/type/property/valuetypes/BytesClient.java","src/main/java/type/property/valuetypes/CollectionsIntAsyncClient.java","src/main/java/type/property/valuetypes/CollectionsIntClient.java","src/main/java/type/property/valuetypes/CollectionsModelAsyncClient.java","src/main/java/type/property/valuetypes/CollectionsModelClient.java","src/main/java/type/property/valuetypes/CollectionsStringAsyncClient.java","src/main/java/type/property/valuetypes/CollectionsStringClient.java","src/main/java/type/property/valuetypes/DatetimeOperationAsyncClient.java","src/main/java/type/property/valuetypes/DatetimeOperationClient.java","src/main/java/type/property/valuetypes/Decimal128AsyncClient.java","src/main/java/type/property/valuetypes/Decimal128Client.java","src/main/java/type/property/valuetypes/DecimalAsyncClient.java","src/main/java/type/property/valuetypes/DecimalClient.java","src/main/java/type/property/valuetypes/DictionaryStringAsyncClient.java","src/main/java/type/property/valuetypes/DictionaryStringClient.java","src/main/java/type/property/valuetypes/DurationOperationAsyncClient.java","src/main/java/type/property/valuetypes/DurationOperationClient.java","src/main/java/type/property/valuetypes/EnumAsyncClient.java","src/main/java/type/property/valuetypes/EnumClient.java","src/main/java/type/property/valuetypes/ExtensibleEnumAsyncClient.java","src/main/java/type/property/valuetypes/ExtensibleEnumClient.java","src/main/java/type/property/valuetypes/FloatLiteralAsyncClient.java","src/main/java/type/property/valuetypes/FloatLiteralClient.java","src/main/java/type/property/valuetypes/FloatOperationAsyncClient.java","src/main/java/type/property/valuetypes/FloatOperationClient.java","src/main/java/type/property/valuetypes/IntAsyncClient.java","src/main/java/type/property/valuetypes/IntClient.java","src/main/java/type/property/valuetypes/IntLiteralAsyncClient.java","src/main/java/type/property/valuetypes/IntLiteralClient.java","src/main/java/type/property/valuetypes/ModelAsyncClient.java","src/main/java/type/property/valuetypes/ModelClient.java","src/main/java/type/property/valuetypes/NeverAsyncClient.java","src/main/java/type/property/valuetypes/NeverClient.java","src/main/java/type/property/valuetypes/StringLiteralAsyncClient.java","src/main/java/type/property/valuetypes/StringLiteralClient.java","src/main/java/type/property/valuetypes/StringOperationAsyncClient.java","src/main/java/type/property/valuetypes/StringOperationClient.java","src/main/java/type/property/valuetypes/UnionEnumValueAsyncClient.java","src/main/java/type/property/valuetypes/UnionEnumValueClient.java","src/main/java/type/property/valuetypes/UnionFloatLiteralAsyncClient.java","src/main/java/type/property/valuetypes/UnionFloatLiteralClient.java","src/main/java/type/property/valuetypes/UnionIntLiteralAsyncClient.java","src/main/java/type/property/valuetypes/UnionIntLiteralClient.java","src/main/java/type/property/valuetypes/UnionStringLiteralAsyncClient.java","src/main/java/type/property/valuetypes/UnionStringLiteralClient.java","src/main/java/type/property/valuetypes/UnknownArrayAsyncClient.java","src/main/java/type/property/valuetypes/UnknownArrayClient.java","src/main/java/type/property/valuetypes/UnknownDictAsyncClient.java","src/main/java/type/property/valuetypes/UnknownDictClient.java","src/main/java/type/property/valuetypes/UnknownIntAsyncClient.java","src/main/java/type/property/valuetypes/UnknownIntClient.java","src/main/java/type/property/valuetypes/UnknownStringAsyncClient.java","src/main/java/type/property/valuetypes/UnknownStringClient.java","src/main/java/type/property/valuetypes/ValueTypesClientBuilder.java","src/main/java/type/property/valuetypes/implementation/BooleanLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/BooleanOperationsImpl.java","src/main/java/type/property/valuetypes/implementation/BytesImpl.java","src/main/java/type/property/valuetypes/implementation/CollectionsIntsImpl.java","src/main/java/type/property/valuetypes/implementation/CollectionsModelsImpl.java","src/main/java/type/property/valuetypes/implementation/CollectionsStringsImpl.java","src/main/java/type/property/valuetypes/implementation/DatetimeOperationsImpl.java","src/main/java/type/property/valuetypes/implementation/Decimal128sImpl.java","src/main/java/type/property/valuetypes/implementation/DecimalsImpl.java","src/main/java/type/property/valuetypes/implementation/DictionaryStringsImpl.java","src/main/java/type/property/valuetypes/implementation/DurationOperationsImpl.java","src/main/java/type/property/valuetypes/implementation/EnumsImpl.java","src/main/java/type/property/valuetypes/implementation/ExtensibleEnumsImpl.java","src/main/java/type/property/valuetypes/implementation/FloatLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/FloatOperationsImpl.java","src/main/java/type/property/valuetypes/implementation/IntLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/IntsImpl.java","src/main/java/type/property/valuetypes/implementation/ModelsImpl.java","src/main/java/type/property/valuetypes/implementation/NeversImpl.java","src/main/java/type/property/valuetypes/implementation/StringLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/StringOperationsImpl.java","src/main/java/type/property/valuetypes/implementation/UnionEnumValuesImpl.java","src/main/java/type/property/valuetypes/implementation/UnionFloatLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/UnionIntLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/UnionStringLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/UnknownArraysImpl.java","src/main/java/type/property/valuetypes/implementation/UnknownDictsImpl.java","src/main/java/type/property/valuetypes/implementation/UnknownIntsImpl.java","src/main/java/type/property/valuetypes/implementation/UnknownStringsImpl.java","src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java","src/main/java/type/property/valuetypes/implementation/package-info.java","src/main/java/type/property/valuetypes/models/BooleanLiteralProperty.java","src/main/java/type/property/valuetypes/models/BooleanProperty.java","src/main/java/type/property/valuetypes/models/BytesProperty.java","src/main/java/type/property/valuetypes/models/CollectionsIntProperty.java","src/main/java/type/property/valuetypes/models/CollectionsModelProperty.java","src/main/java/type/property/valuetypes/models/CollectionsStringProperty.java","src/main/java/type/property/valuetypes/models/DatetimeProperty.java","src/main/java/type/property/valuetypes/models/Decimal128Property.java","src/main/java/type/property/valuetypes/models/DecimalProperty.java","src/main/java/type/property/valuetypes/models/DictionaryStringProperty.java","src/main/java/type/property/valuetypes/models/DurationProperty.java","src/main/java/type/property/valuetypes/models/EnumProperty.java","src/main/java/type/property/valuetypes/models/ExtendedEnum.java","src/main/java/type/property/valuetypes/models/ExtensibleEnumProperty.java","src/main/java/type/property/valuetypes/models/FixedInnerEnum.java","src/main/java/type/property/valuetypes/models/FloatLiteralProperty.java","src/main/java/type/property/valuetypes/models/FloatProperty.java","src/main/java/type/property/valuetypes/models/InnerEnum.java","src/main/java/type/property/valuetypes/models/InnerModel.java","src/main/java/type/property/valuetypes/models/IntLiteralProperty.java","src/main/java/type/property/valuetypes/models/IntProperty.java","src/main/java/type/property/valuetypes/models/ModelProperty.java","src/main/java/type/property/valuetypes/models/NeverProperty.java","src/main/java/type/property/valuetypes/models/StringLiteralProperty.java","src/main/java/type/property/valuetypes/models/StringProperty.java","src/main/java/type/property/valuetypes/models/UnionEnumValueProperty.java","src/main/java/type/property/valuetypes/models/UnionFloatLiteralProperty.java","src/main/java/type/property/valuetypes/models/UnionFloatLiteralPropertyProperty.java","src/main/java/type/property/valuetypes/models/UnionIntLiteralProperty.java","src/main/java/type/property/valuetypes/models/UnionIntLiteralPropertyProperty.java","src/main/java/type/property/valuetypes/models/UnionStringLiteralProperty.java","src/main/java/type/property/valuetypes/models/UnionStringLiteralPropertyProperty.java","src/main/java/type/property/valuetypes/models/UnknownArrayProperty.java","src/main/java/type/property/valuetypes/models/UnknownDictProperty.java","src/main/java/type/property/valuetypes/models/UnknownIntProperty.java","src/main/java/type/property/valuetypes/models/UnknownStringProperty.java","src/main/java/type/property/valuetypes/models/package-info.java","src/main/java/type/property/valuetypes/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_apiview_properties.json deleted file mode 100644 index bc0e915353d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_apiview_properties.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.scalar.BooleanOperationAsyncClient": "Type.Scalar.Boolean", - "type.scalar.BooleanOperationAsyncClient.get": "Type.Scalar.Boolean.get", - "type.scalar.BooleanOperationAsyncClient.getWithResponse": "Type.Scalar.Boolean.get", - "type.scalar.BooleanOperationAsyncClient.put": "Type.Scalar.Boolean.put", - "type.scalar.BooleanOperationAsyncClient.putWithResponse": "Type.Scalar.Boolean.put", - "type.scalar.BooleanOperationClient": "Type.Scalar.Boolean", - "type.scalar.BooleanOperationClient.get": "Type.Scalar.Boolean.get", - "type.scalar.BooleanOperationClient.getWithResponse": "Type.Scalar.Boolean.get", - "type.scalar.BooleanOperationClient.put": "Type.Scalar.Boolean.put", - "type.scalar.BooleanOperationClient.putWithResponse": "Type.Scalar.Boolean.put", - "type.scalar.Decimal128TypeAsyncClient": "Type.Scalar.Decimal128Type", - "type.scalar.Decimal128TypeAsyncClient.requestBody": "Type.Scalar.Decimal128Type.requestBody", - "type.scalar.Decimal128TypeAsyncClient.requestBodyWithResponse": "Type.Scalar.Decimal128Type.requestBody", - "type.scalar.Decimal128TypeAsyncClient.requestParameter": "Type.Scalar.Decimal128Type.requestParameter", - "type.scalar.Decimal128TypeAsyncClient.requestParameterWithResponse": "Type.Scalar.Decimal128Type.requestParameter", - "type.scalar.Decimal128TypeAsyncClient.responseBody": "Type.Scalar.Decimal128Type.responseBody", - "type.scalar.Decimal128TypeAsyncClient.responseBodyWithResponse": "Type.Scalar.Decimal128Type.responseBody", - "type.scalar.Decimal128TypeClient": "Type.Scalar.Decimal128Type", - "type.scalar.Decimal128TypeClient.requestBody": "Type.Scalar.Decimal128Type.requestBody", - "type.scalar.Decimal128TypeClient.requestBodyWithResponse": "Type.Scalar.Decimal128Type.requestBody", - "type.scalar.Decimal128TypeClient.requestParameter": "Type.Scalar.Decimal128Type.requestParameter", - "type.scalar.Decimal128TypeClient.requestParameterWithResponse": "Type.Scalar.Decimal128Type.requestParameter", - "type.scalar.Decimal128TypeClient.responseBody": "Type.Scalar.Decimal128Type.responseBody", - "type.scalar.Decimal128TypeClient.responseBodyWithResponse": "Type.Scalar.Decimal128Type.responseBody", - "type.scalar.Decimal128VerifyAsyncClient": "Type.Scalar.Decimal128Verify", - "type.scalar.Decimal128VerifyAsyncClient.prepareVerify": "Type.Scalar.Decimal128Verify.prepareVerify", - "type.scalar.Decimal128VerifyAsyncClient.prepareVerifyWithResponse": "Type.Scalar.Decimal128Verify.prepareVerify", - "type.scalar.Decimal128VerifyAsyncClient.verify": "Type.Scalar.Decimal128Verify.verify", - "type.scalar.Decimal128VerifyAsyncClient.verifyWithResponse": "Type.Scalar.Decimal128Verify.verify", - "type.scalar.Decimal128VerifyClient": "Type.Scalar.Decimal128Verify", - "type.scalar.Decimal128VerifyClient.prepareVerify": "Type.Scalar.Decimal128Verify.prepareVerify", - "type.scalar.Decimal128VerifyClient.prepareVerifyWithResponse": "Type.Scalar.Decimal128Verify.prepareVerify", - "type.scalar.Decimal128VerifyClient.verify": "Type.Scalar.Decimal128Verify.verify", - "type.scalar.Decimal128VerifyClient.verifyWithResponse": "Type.Scalar.Decimal128Verify.verify", - "type.scalar.DecimalTypeAsyncClient": "Type.Scalar.DecimalType", - "type.scalar.DecimalTypeAsyncClient.requestBody": "Type.Scalar.DecimalType.requestBody", - "type.scalar.DecimalTypeAsyncClient.requestBodyWithResponse": "Type.Scalar.DecimalType.requestBody", - "type.scalar.DecimalTypeAsyncClient.requestParameter": "Type.Scalar.DecimalType.requestParameter", - "type.scalar.DecimalTypeAsyncClient.requestParameterWithResponse": "Type.Scalar.DecimalType.requestParameter", - "type.scalar.DecimalTypeAsyncClient.responseBody": "Type.Scalar.DecimalType.responseBody", - "type.scalar.DecimalTypeAsyncClient.responseBodyWithResponse": "Type.Scalar.DecimalType.responseBody", - "type.scalar.DecimalTypeClient": "Type.Scalar.DecimalType", - "type.scalar.DecimalTypeClient.requestBody": "Type.Scalar.DecimalType.requestBody", - "type.scalar.DecimalTypeClient.requestBodyWithResponse": "Type.Scalar.DecimalType.requestBody", - "type.scalar.DecimalTypeClient.requestParameter": "Type.Scalar.DecimalType.requestParameter", - "type.scalar.DecimalTypeClient.requestParameterWithResponse": "Type.Scalar.DecimalType.requestParameter", - "type.scalar.DecimalTypeClient.responseBody": "Type.Scalar.DecimalType.responseBody", - "type.scalar.DecimalTypeClient.responseBodyWithResponse": "Type.Scalar.DecimalType.responseBody", - "type.scalar.DecimalVerifyAsyncClient": "Type.Scalar.DecimalVerify", - "type.scalar.DecimalVerifyAsyncClient.prepareVerify": "Type.Scalar.DecimalVerify.prepareVerify", - "type.scalar.DecimalVerifyAsyncClient.prepareVerifyWithResponse": "Type.Scalar.DecimalVerify.prepareVerify", - "type.scalar.DecimalVerifyAsyncClient.verify": "Type.Scalar.DecimalVerify.verify", - "type.scalar.DecimalVerifyAsyncClient.verifyWithResponse": "Type.Scalar.DecimalVerify.verify", - "type.scalar.DecimalVerifyClient": "Type.Scalar.DecimalVerify", - "type.scalar.DecimalVerifyClient.prepareVerify": "Type.Scalar.DecimalVerify.prepareVerify", - "type.scalar.DecimalVerifyClient.prepareVerifyWithResponse": "Type.Scalar.DecimalVerify.prepareVerify", - "type.scalar.DecimalVerifyClient.verify": "Type.Scalar.DecimalVerify.verify", - "type.scalar.DecimalVerifyClient.verifyWithResponse": "Type.Scalar.DecimalVerify.verify", - "type.scalar.ScalarClientBuilder": "Type.Scalar", - "type.scalar.StringOperationAsyncClient": "Type.Scalar.String", - "type.scalar.StringOperationAsyncClient.get": "Type.Scalar.String.get", - "type.scalar.StringOperationAsyncClient.getWithResponse": "Type.Scalar.String.get", - "type.scalar.StringOperationAsyncClient.put": "Type.Scalar.String.put", - "type.scalar.StringOperationAsyncClient.putWithResponse": "Type.Scalar.String.put", - "type.scalar.StringOperationClient": "Type.Scalar.String", - "type.scalar.StringOperationClient.get": "Type.Scalar.String.get", - "type.scalar.StringOperationClient.getWithResponse": "Type.Scalar.String.get", - "type.scalar.StringOperationClient.put": "Type.Scalar.String.put", - "type.scalar.StringOperationClient.putWithResponse": "Type.Scalar.String.put", - "type.scalar.UnknownAsyncClient": "Type.Scalar.Unknown", - "type.scalar.UnknownAsyncClient.get": "Type.Scalar.Unknown.get", - "type.scalar.UnknownAsyncClient.getWithResponse": "Type.Scalar.Unknown.get", - "type.scalar.UnknownAsyncClient.put": "Type.Scalar.Unknown.put", - "type.scalar.UnknownAsyncClient.putWithResponse": "Type.Scalar.Unknown.put", - "type.scalar.UnknownClient": "Type.Scalar.Unknown", - "type.scalar.UnknownClient.get": "Type.Scalar.Unknown.get", - "type.scalar.UnknownClient.getWithResponse": "Type.Scalar.Unknown.get", - "type.scalar.UnknownClient.put": "Type.Scalar.Unknown.put", - "type.scalar.UnknownClient.putWithResponse": "Type.Scalar.Unknown.put" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_metadata.json deleted file mode 100644 index 7111fed4641..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.scalar.BooleanOperationAsyncClient":"Type.Scalar.Boolean","type.scalar.BooleanOperationAsyncClient.get":"Type.Scalar.Boolean.get","type.scalar.BooleanOperationAsyncClient.getWithResponse":"Type.Scalar.Boolean.get","type.scalar.BooleanOperationAsyncClient.put":"Type.Scalar.Boolean.put","type.scalar.BooleanOperationAsyncClient.putWithResponse":"Type.Scalar.Boolean.put","type.scalar.BooleanOperationClient":"Type.Scalar.Boolean","type.scalar.BooleanOperationClient.get":"Type.Scalar.Boolean.get","type.scalar.BooleanOperationClient.getWithResponse":"Type.Scalar.Boolean.get","type.scalar.BooleanOperationClient.put":"Type.Scalar.Boolean.put","type.scalar.BooleanOperationClient.putWithResponse":"Type.Scalar.Boolean.put","type.scalar.Decimal128TypeAsyncClient":"Type.Scalar.Decimal128Type","type.scalar.Decimal128TypeAsyncClient.requestBody":"Type.Scalar.Decimal128Type.requestBody","type.scalar.Decimal128TypeAsyncClient.requestBodyWithResponse":"Type.Scalar.Decimal128Type.requestBody","type.scalar.Decimal128TypeAsyncClient.requestParameter":"Type.Scalar.Decimal128Type.requestParameter","type.scalar.Decimal128TypeAsyncClient.requestParameterWithResponse":"Type.Scalar.Decimal128Type.requestParameter","type.scalar.Decimal128TypeAsyncClient.responseBody":"Type.Scalar.Decimal128Type.responseBody","type.scalar.Decimal128TypeAsyncClient.responseBodyWithResponse":"Type.Scalar.Decimal128Type.responseBody","type.scalar.Decimal128TypeClient":"Type.Scalar.Decimal128Type","type.scalar.Decimal128TypeClient.requestBody":"Type.Scalar.Decimal128Type.requestBody","type.scalar.Decimal128TypeClient.requestBodyWithResponse":"Type.Scalar.Decimal128Type.requestBody","type.scalar.Decimal128TypeClient.requestParameter":"Type.Scalar.Decimal128Type.requestParameter","type.scalar.Decimal128TypeClient.requestParameterWithResponse":"Type.Scalar.Decimal128Type.requestParameter","type.scalar.Decimal128TypeClient.responseBody":"Type.Scalar.Decimal128Type.responseBody","type.scalar.Decimal128TypeClient.responseBodyWithResponse":"Type.Scalar.Decimal128Type.responseBody","type.scalar.Decimal128VerifyAsyncClient":"Type.Scalar.Decimal128Verify","type.scalar.Decimal128VerifyAsyncClient.prepareVerify":"Type.Scalar.Decimal128Verify.prepareVerify","type.scalar.Decimal128VerifyAsyncClient.prepareVerifyWithResponse":"Type.Scalar.Decimal128Verify.prepareVerify","type.scalar.Decimal128VerifyAsyncClient.verify":"Type.Scalar.Decimal128Verify.verify","type.scalar.Decimal128VerifyAsyncClient.verifyWithResponse":"Type.Scalar.Decimal128Verify.verify","type.scalar.Decimal128VerifyClient":"Type.Scalar.Decimal128Verify","type.scalar.Decimal128VerifyClient.prepareVerify":"Type.Scalar.Decimal128Verify.prepareVerify","type.scalar.Decimal128VerifyClient.prepareVerifyWithResponse":"Type.Scalar.Decimal128Verify.prepareVerify","type.scalar.Decimal128VerifyClient.verify":"Type.Scalar.Decimal128Verify.verify","type.scalar.Decimal128VerifyClient.verifyWithResponse":"Type.Scalar.Decimal128Verify.verify","type.scalar.DecimalTypeAsyncClient":"Type.Scalar.DecimalType","type.scalar.DecimalTypeAsyncClient.requestBody":"Type.Scalar.DecimalType.requestBody","type.scalar.DecimalTypeAsyncClient.requestBodyWithResponse":"Type.Scalar.DecimalType.requestBody","type.scalar.DecimalTypeAsyncClient.requestParameter":"Type.Scalar.DecimalType.requestParameter","type.scalar.DecimalTypeAsyncClient.requestParameterWithResponse":"Type.Scalar.DecimalType.requestParameter","type.scalar.DecimalTypeAsyncClient.responseBody":"Type.Scalar.DecimalType.responseBody","type.scalar.DecimalTypeAsyncClient.responseBodyWithResponse":"Type.Scalar.DecimalType.responseBody","type.scalar.DecimalTypeClient":"Type.Scalar.DecimalType","type.scalar.DecimalTypeClient.requestBody":"Type.Scalar.DecimalType.requestBody","type.scalar.DecimalTypeClient.requestBodyWithResponse":"Type.Scalar.DecimalType.requestBody","type.scalar.DecimalTypeClient.requestParameter":"Type.Scalar.DecimalType.requestParameter","type.scalar.DecimalTypeClient.requestParameterWithResponse":"Type.Scalar.DecimalType.requestParameter","type.scalar.DecimalTypeClient.responseBody":"Type.Scalar.DecimalType.responseBody","type.scalar.DecimalTypeClient.responseBodyWithResponse":"Type.Scalar.DecimalType.responseBody","type.scalar.DecimalVerifyAsyncClient":"Type.Scalar.DecimalVerify","type.scalar.DecimalVerifyAsyncClient.prepareVerify":"Type.Scalar.DecimalVerify.prepareVerify","type.scalar.DecimalVerifyAsyncClient.prepareVerifyWithResponse":"Type.Scalar.DecimalVerify.prepareVerify","type.scalar.DecimalVerifyAsyncClient.verify":"Type.Scalar.DecimalVerify.verify","type.scalar.DecimalVerifyAsyncClient.verifyWithResponse":"Type.Scalar.DecimalVerify.verify","type.scalar.DecimalVerifyClient":"Type.Scalar.DecimalVerify","type.scalar.DecimalVerifyClient.prepareVerify":"Type.Scalar.DecimalVerify.prepareVerify","type.scalar.DecimalVerifyClient.prepareVerifyWithResponse":"Type.Scalar.DecimalVerify.prepareVerify","type.scalar.DecimalVerifyClient.verify":"Type.Scalar.DecimalVerify.verify","type.scalar.DecimalVerifyClient.verifyWithResponse":"Type.Scalar.DecimalVerify.verify","type.scalar.ScalarClientBuilder":"Type.Scalar","type.scalar.StringOperationAsyncClient":"Type.Scalar.String","type.scalar.StringOperationAsyncClient.get":"Type.Scalar.String.get","type.scalar.StringOperationAsyncClient.getWithResponse":"Type.Scalar.String.get","type.scalar.StringOperationAsyncClient.put":"Type.Scalar.String.put","type.scalar.StringOperationAsyncClient.putWithResponse":"Type.Scalar.String.put","type.scalar.StringOperationClient":"Type.Scalar.String","type.scalar.StringOperationClient.get":"Type.Scalar.String.get","type.scalar.StringOperationClient.getWithResponse":"Type.Scalar.String.get","type.scalar.StringOperationClient.put":"Type.Scalar.String.put","type.scalar.StringOperationClient.putWithResponse":"Type.Scalar.String.put","type.scalar.UnknownAsyncClient":"Type.Scalar.Unknown","type.scalar.UnknownAsyncClient.get":"Type.Scalar.Unknown.get","type.scalar.UnknownAsyncClient.getWithResponse":"Type.Scalar.Unknown.get","type.scalar.UnknownAsyncClient.put":"Type.Scalar.Unknown.put","type.scalar.UnknownAsyncClient.putWithResponse":"Type.Scalar.Unknown.put","type.scalar.UnknownClient":"Type.Scalar.Unknown","type.scalar.UnknownClient.get":"Type.Scalar.Unknown.get","type.scalar.UnknownClient.getWithResponse":"Type.Scalar.Unknown.get","type.scalar.UnknownClient.put":"Type.Scalar.Unknown.put","type.scalar.UnknownClient.putWithResponse":"Type.Scalar.Unknown.put"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/scalar/BooleanOperationAsyncClient.java","src/main/java/type/scalar/BooleanOperationClient.java","src/main/java/type/scalar/Decimal128TypeAsyncClient.java","src/main/java/type/scalar/Decimal128TypeClient.java","src/main/java/type/scalar/Decimal128VerifyAsyncClient.java","src/main/java/type/scalar/Decimal128VerifyClient.java","src/main/java/type/scalar/DecimalTypeAsyncClient.java","src/main/java/type/scalar/DecimalTypeClient.java","src/main/java/type/scalar/DecimalVerifyAsyncClient.java","src/main/java/type/scalar/DecimalVerifyClient.java","src/main/java/type/scalar/ScalarClientBuilder.java","src/main/java/type/scalar/StringOperationAsyncClient.java","src/main/java/type/scalar/StringOperationClient.java","src/main/java/type/scalar/UnknownAsyncClient.java","src/main/java/type/scalar/UnknownClient.java","src/main/java/type/scalar/implementation/BooleanOperationsImpl.java","src/main/java/type/scalar/implementation/Decimal128TypesImpl.java","src/main/java/type/scalar/implementation/Decimal128VerifiesImpl.java","src/main/java/type/scalar/implementation/DecimalTypesImpl.java","src/main/java/type/scalar/implementation/DecimalVerifiesImpl.java","src/main/java/type/scalar/implementation/ScalarClientImpl.java","src/main/java/type/scalar/implementation/StringOperationsImpl.java","src/main/java/type/scalar/implementation/UnknownsImpl.java","src/main/java/type/scalar/implementation/package-info.java","src/main/java/type/scalar/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_apiview_properties.json deleted file mode 100644 index 95c1b7aafc0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_apiview_properties.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.union.discriminated.DiscriminatedClientBuilder": "Type.Union.Discriminated", - "type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient": "Type.Union.Discriminated.Envelope.Object.CustomProperties", - "type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.get": "Type.Union.Discriminated.Envelope.Object.CustomProperties.get", - "type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.getWithResponse": "Type.Union.Discriminated.Envelope.Object.CustomProperties.get", - "type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.put": "Type.Union.Discriminated.Envelope.Object.CustomProperties.put", - "type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.putWithResponse": "Type.Union.Discriminated.Envelope.Object.CustomProperties.put", - "type.union.discriminated.EnvelopeObjectCustomPropertiesClient": "Type.Union.Discriminated.Envelope.Object.CustomProperties", - "type.union.discriminated.EnvelopeObjectCustomPropertiesClient.get": "Type.Union.Discriminated.Envelope.Object.CustomProperties.get", - "type.union.discriminated.EnvelopeObjectCustomPropertiesClient.getWithResponse": "Type.Union.Discriminated.Envelope.Object.CustomProperties.get", - "type.union.discriminated.EnvelopeObjectCustomPropertiesClient.put": "Type.Union.Discriminated.Envelope.Object.CustomProperties.put", - "type.union.discriminated.EnvelopeObjectCustomPropertiesClient.putWithResponse": "Type.Union.Discriminated.Envelope.Object.CustomProperties.put", - "type.union.discriminated.EnvelopeObjectDefaultAsyncClient": "Type.Union.Discriminated.Envelope.Object.Default", - "type.union.discriminated.EnvelopeObjectDefaultAsyncClient.get": "Type.Union.Discriminated.Envelope.Object.Default.get", - "type.union.discriminated.EnvelopeObjectDefaultAsyncClient.getWithResponse": "Type.Union.Discriminated.Envelope.Object.Default.get", - "type.union.discriminated.EnvelopeObjectDefaultAsyncClient.put": "Type.Union.Discriminated.Envelope.Object.Default.put", - "type.union.discriminated.EnvelopeObjectDefaultAsyncClient.putWithResponse": "Type.Union.Discriminated.Envelope.Object.Default.put", - "type.union.discriminated.EnvelopeObjectDefaultClient": "Type.Union.Discriminated.Envelope.Object.Default", - "type.union.discriminated.EnvelopeObjectDefaultClient.get": "Type.Union.Discriminated.Envelope.Object.Default.get", - "type.union.discriminated.EnvelopeObjectDefaultClient.getWithResponse": "Type.Union.Discriminated.Envelope.Object.Default.get", - "type.union.discriminated.EnvelopeObjectDefaultClient.put": "Type.Union.Discriminated.Envelope.Object.Default.put", - "type.union.discriminated.EnvelopeObjectDefaultClient.putWithResponse": "Type.Union.Discriminated.Envelope.Object.Default.put", - "type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator", - "type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.get": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get", - "type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.getWithResponse": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get", - "type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.put": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put", - "type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.putWithResponse": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put", - "type.union.discriminated.NoEnvelopeCustomDiscriminatorClient": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator", - "type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.get": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get", - "type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.getWithResponse": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get", - "type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.put": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put", - "type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.putWithResponse": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put", - "type.union.discriminated.NoEnvelopeDefaultAsyncClient": "Type.Union.Discriminated.NoEnvelope.Default", - "type.union.discriminated.NoEnvelopeDefaultAsyncClient.get": "Type.Union.Discriminated.NoEnvelope.Default.get", - "type.union.discriminated.NoEnvelopeDefaultAsyncClient.getWithResponse": "Type.Union.Discriminated.NoEnvelope.Default.get", - "type.union.discriminated.NoEnvelopeDefaultAsyncClient.put": "Type.Union.Discriminated.NoEnvelope.Default.put", - "type.union.discriminated.NoEnvelopeDefaultAsyncClient.putWithResponse": "Type.Union.Discriminated.NoEnvelope.Default.put", - "type.union.discriminated.NoEnvelopeDefaultClient": "Type.Union.Discriminated.NoEnvelope.Default", - "type.union.discriminated.NoEnvelopeDefaultClient.get": "Type.Union.Discriminated.NoEnvelope.Default.get", - "type.union.discriminated.NoEnvelopeDefaultClient.getWithResponse": "Type.Union.Discriminated.NoEnvelope.Default.get", - "type.union.discriminated.NoEnvelopeDefaultClient.put": "Type.Union.Discriminated.NoEnvelope.Default.put", - "type.union.discriminated.NoEnvelopeDefaultClient.putWithResponse": "Type.Union.Discriminated.NoEnvelope.Default.put" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_metadata.json deleted file mode 100644 index 1b64e37521d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.union.discriminated.DiscriminatedClientBuilder":"Type.Union.Discriminated","type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient":"Type.Union.Discriminated.Envelope.Object.CustomProperties","type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.get":"Type.Union.Discriminated.Envelope.Object.CustomProperties.get","type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.getWithResponse":"Type.Union.Discriminated.Envelope.Object.CustomProperties.get","type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.put":"Type.Union.Discriminated.Envelope.Object.CustomProperties.put","type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.putWithResponse":"Type.Union.Discriminated.Envelope.Object.CustomProperties.put","type.union.discriminated.EnvelopeObjectCustomPropertiesClient":"Type.Union.Discriminated.Envelope.Object.CustomProperties","type.union.discriminated.EnvelopeObjectCustomPropertiesClient.get":"Type.Union.Discriminated.Envelope.Object.CustomProperties.get","type.union.discriminated.EnvelopeObjectCustomPropertiesClient.getWithResponse":"Type.Union.Discriminated.Envelope.Object.CustomProperties.get","type.union.discriminated.EnvelopeObjectCustomPropertiesClient.put":"Type.Union.Discriminated.Envelope.Object.CustomProperties.put","type.union.discriminated.EnvelopeObjectCustomPropertiesClient.putWithResponse":"Type.Union.Discriminated.Envelope.Object.CustomProperties.put","type.union.discriminated.EnvelopeObjectDefaultAsyncClient":"Type.Union.Discriminated.Envelope.Object.Default","type.union.discriminated.EnvelopeObjectDefaultAsyncClient.get":"Type.Union.Discriminated.Envelope.Object.Default.get","type.union.discriminated.EnvelopeObjectDefaultAsyncClient.getWithResponse":"Type.Union.Discriminated.Envelope.Object.Default.get","type.union.discriminated.EnvelopeObjectDefaultAsyncClient.put":"Type.Union.Discriminated.Envelope.Object.Default.put","type.union.discriminated.EnvelopeObjectDefaultAsyncClient.putWithResponse":"Type.Union.Discriminated.Envelope.Object.Default.put","type.union.discriminated.EnvelopeObjectDefaultClient":"Type.Union.Discriminated.Envelope.Object.Default","type.union.discriminated.EnvelopeObjectDefaultClient.get":"Type.Union.Discriminated.Envelope.Object.Default.get","type.union.discriminated.EnvelopeObjectDefaultClient.getWithResponse":"Type.Union.Discriminated.Envelope.Object.Default.get","type.union.discriminated.EnvelopeObjectDefaultClient.put":"Type.Union.Discriminated.Envelope.Object.Default.put","type.union.discriminated.EnvelopeObjectDefaultClient.putWithResponse":"Type.Union.Discriminated.Envelope.Object.Default.put","type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator","type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.get":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get","type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.getWithResponse":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get","type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.put":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put","type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.putWithResponse":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put","type.union.discriminated.NoEnvelopeCustomDiscriminatorClient":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator","type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.get":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get","type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.getWithResponse":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get","type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.put":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put","type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.putWithResponse":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put","type.union.discriminated.NoEnvelopeDefaultAsyncClient":"Type.Union.Discriminated.NoEnvelope.Default","type.union.discriminated.NoEnvelopeDefaultAsyncClient.get":"Type.Union.Discriminated.NoEnvelope.Default.get","type.union.discriminated.NoEnvelopeDefaultAsyncClient.getWithResponse":"Type.Union.Discriminated.NoEnvelope.Default.get","type.union.discriminated.NoEnvelopeDefaultAsyncClient.put":"Type.Union.Discriminated.NoEnvelope.Default.put","type.union.discriminated.NoEnvelopeDefaultAsyncClient.putWithResponse":"Type.Union.Discriminated.NoEnvelope.Default.put","type.union.discriminated.NoEnvelopeDefaultClient":"Type.Union.Discriminated.NoEnvelope.Default","type.union.discriminated.NoEnvelopeDefaultClient.get":"Type.Union.Discriminated.NoEnvelope.Default.get","type.union.discriminated.NoEnvelopeDefaultClient.getWithResponse":"Type.Union.Discriminated.NoEnvelope.Default.get","type.union.discriminated.NoEnvelopeDefaultClient.put":"Type.Union.Discriminated.NoEnvelope.Default.put","type.union.discriminated.NoEnvelopeDefaultClient.putWithResponse":"Type.Union.Discriminated.NoEnvelope.Default.put"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/union/discriminated/DiscriminatedClientBuilder.java","src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesAsyncClient.java","src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesClient.java","src/main/java/type/union/discriminated/EnvelopeObjectDefaultAsyncClient.java","src/main/java/type/union/discriminated/EnvelopeObjectDefaultClient.java","src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorAsyncClient.java","src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorClient.java","src/main/java/type/union/discriminated/NoEnvelopeDefaultAsyncClient.java","src/main/java/type/union/discriminated/NoEnvelopeDefaultClient.java","src/main/java/type/union/discriminated/implementation/DiscriminatedClientImpl.java","src/main/java/type/union/discriminated/implementation/EnvelopeObjectCustomPropertiesImpl.java","src/main/java/type/union/discriminated/implementation/EnvelopeObjectDefaultsImpl.java","src/main/java/type/union/discriminated/implementation/NoEnvelopeCustomDiscriminatorsImpl.java","src/main/java/type/union/discriminated/implementation/NoEnvelopeDefaultsImpl.java","src/main/java/type/union/discriminated/implementation/package-info.java","src/main/java/type/union/discriminated/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_apiview_properties.json deleted file mode 100644 index 7a6a8d03465..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_apiview_properties.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "type.union.EnumsOnlyAsyncClient": "Type.Union.EnumsOnly", - "type.union.EnumsOnlyAsyncClient.get": "Type.Union.EnumsOnly.get", - "type.union.EnumsOnlyAsyncClient.getWithResponse": "Type.Union.EnumsOnly.get", - "type.union.EnumsOnlyAsyncClient.send": "Type.Union.EnumsOnly.send", - "type.union.EnumsOnlyAsyncClient.sendWithResponse": "Type.Union.EnumsOnly.send", - "type.union.EnumsOnlyClient": "Type.Union.EnumsOnly", - "type.union.EnumsOnlyClient.get": "Type.Union.EnumsOnly.get", - "type.union.EnumsOnlyClient.getWithResponse": "Type.Union.EnumsOnly.get", - "type.union.EnumsOnlyClient.send": "Type.Union.EnumsOnly.send", - "type.union.EnumsOnlyClient.sendWithResponse": "Type.Union.EnumsOnly.send", - "type.union.FloatsOnlyAsyncClient": "Type.Union.FloatsOnly", - "type.union.FloatsOnlyAsyncClient.get": "Type.Union.FloatsOnly.get", - "type.union.FloatsOnlyAsyncClient.getWithResponse": "Type.Union.FloatsOnly.get", - "type.union.FloatsOnlyAsyncClient.send": "Type.Union.FloatsOnly.send", - "type.union.FloatsOnlyAsyncClient.sendWithResponse": "Type.Union.FloatsOnly.send", - "type.union.FloatsOnlyClient": "Type.Union.FloatsOnly", - "type.union.FloatsOnlyClient.get": "Type.Union.FloatsOnly.get", - "type.union.FloatsOnlyClient.getWithResponse": "Type.Union.FloatsOnly.get", - "type.union.FloatsOnlyClient.send": "Type.Union.FloatsOnly.send", - "type.union.FloatsOnlyClient.sendWithResponse": "Type.Union.FloatsOnly.send", - "type.union.IntsOnlyAsyncClient": "Type.Union.IntsOnly", - "type.union.IntsOnlyAsyncClient.get": "Type.Union.IntsOnly.get", - "type.union.IntsOnlyAsyncClient.getWithResponse": "Type.Union.IntsOnly.get", - "type.union.IntsOnlyAsyncClient.send": "Type.Union.IntsOnly.send", - "type.union.IntsOnlyAsyncClient.sendWithResponse": "Type.Union.IntsOnly.send", - "type.union.IntsOnlyClient": "Type.Union.IntsOnly", - "type.union.IntsOnlyClient.get": "Type.Union.IntsOnly.get", - "type.union.IntsOnlyClient.getWithResponse": "Type.Union.IntsOnly.get", - "type.union.IntsOnlyClient.send": "Type.Union.IntsOnly.send", - "type.union.IntsOnlyClient.sendWithResponse": "Type.Union.IntsOnly.send", - "type.union.MixedLiteralsAsyncClient": "Type.Union.MixedLiterals", - "type.union.MixedLiteralsAsyncClient.get": "Type.Union.MixedLiterals.get", - "type.union.MixedLiteralsAsyncClient.getWithResponse": "Type.Union.MixedLiterals.get", - "type.union.MixedLiteralsAsyncClient.send": "Type.Union.MixedLiterals.send", - "type.union.MixedLiteralsAsyncClient.sendWithResponse": "Type.Union.MixedLiterals.send", - "type.union.MixedLiteralsClient": "Type.Union.MixedLiterals", - "type.union.MixedLiteralsClient.get": "Type.Union.MixedLiterals.get", - "type.union.MixedLiteralsClient.getWithResponse": "Type.Union.MixedLiterals.get", - "type.union.MixedLiteralsClient.send": "Type.Union.MixedLiterals.send", - "type.union.MixedLiteralsClient.sendWithResponse": "Type.Union.MixedLiterals.send", - "type.union.MixedTypesAsyncClient": "Type.Union.MixedTypes", - "type.union.MixedTypesAsyncClient.get": "Type.Union.MixedTypes.get", - "type.union.MixedTypesAsyncClient.getWithResponse": "Type.Union.MixedTypes.get", - "type.union.MixedTypesAsyncClient.send": "Type.Union.MixedTypes.send", - "type.union.MixedTypesAsyncClient.sendWithResponse": "Type.Union.MixedTypes.send", - "type.union.MixedTypesClient": "Type.Union.MixedTypes", - "type.union.MixedTypesClient.get": "Type.Union.MixedTypes.get", - "type.union.MixedTypesClient.getWithResponse": "Type.Union.MixedTypes.get", - "type.union.MixedTypesClient.send": "Type.Union.MixedTypes.send", - "type.union.MixedTypesClient.sendWithResponse": "Type.Union.MixedTypes.send", - "type.union.ModelsOnlyAsyncClient": "Type.Union.ModelsOnly", - "type.union.ModelsOnlyAsyncClient.get": "Type.Union.ModelsOnly.get", - "type.union.ModelsOnlyAsyncClient.getWithResponse": "Type.Union.ModelsOnly.get", - "type.union.ModelsOnlyAsyncClient.send": "Type.Union.ModelsOnly.send", - "type.union.ModelsOnlyAsyncClient.sendWithResponse": "Type.Union.ModelsOnly.send", - "type.union.ModelsOnlyClient": "Type.Union.ModelsOnly", - "type.union.ModelsOnlyClient.get": "Type.Union.ModelsOnly.get", - "type.union.ModelsOnlyClient.getWithResponse": "Type.Union.ModelsOnly.get", - "type.union.ModelsOnlyClient.send": "Type.Union.ModelsOnly.send", - "type.union.ModelsOnlyClient.sendWithResponse": "Type.Union.ModelsOnly.send", - "type.union.StringAndArrayAsyncClient": "Type.Union.StringAndArray", - "type.union.StringAndArrayAsyncClient.get": "Type.Union.StringAndArray.get", - "type.union.StringAndArrayAsyncClient.getWithResponse": "Type.Union.StringAndArray.get", - "type.union.StringAndArrayAsyncClient.send": "Type.Union.StringAndArray.send", - "type.union.StringAndArrayAsyncClient.sendWithResponse": "Type.Union.StringAndArray.send", - "type.union.StringAndArrayClient": "Type.Union.StringAndArray", - "type.union.StringAndArrayClient.get": "Type.Union.StringAndArray.get", - "type.union.StringAndArrayClient.getWithResponse": "Type.Union.StringAndArray.get", - "type.union.StringAndArrayClient.send": "Type.Union.StringAndArray.send", - "type.union.StringAndArrayClient.sendWithResponse": "Type.Union.StringAndArray.send", - "type.union.StringExtensibleAsyncClient": "Type.Union.StringExtensible", - "type.union.StringExtensibleAsyncClient.get": "Type.Union.StringExtensible.get", - "type.union.StringExtensibleAsyncClient.getWithResponse": "Type.Union.StringExtensible.get", - "type.union.StringExtensibleAsyncClient.send": "Type.Union.StringExtensible.send", - "type.union.StringExtensibleAsyncClient.sendWithResponse": "Type.Union.StringExtensible.send", - "type.union.StringExtensibleClient": "Type.Union.StringExtensible", - "type.union.StringExtensibleClient.get": "Type.Union.StringExtensible.get", - "type.union.StringExtensibleClient.getWithResponse": "Type.Union.StringExtensible.get", - "type.union.StringExtensibleClient.send": "Type.Union.StringExtensible.send", - "type.union.StringExtensibleClient.sendWithResponse": "Type.Union.StringExtensible.send", - "type.union.StringExtensibleNamedAsyncClient": "Type.Union.StringExtensibleNamed", - "type.union.StringExtensibleNamedAsyncClient.get": "Type.Union.StringExtensibleNamed.get", - "type.union.StringExtensibleNamedAsyncClient.getWithResponse": "Type.Union.StringExtensibleNamed.get", - "type.union.StringExtensibleNamedAsyncClient.send": "Type.Union.StringExtensibleNamed.send", - "type.union.StringExtensibleNamedAsyncClient.sendWithResponse": "Type.Union.StringExtensibleNamed.send", - "type.union.StringExtensibleNamedClient": "Type.Union.StringExtensibleNamed", - "type.union.StringExtensibleNamedClient.get": "Type.Union.StringExtensibleNamed.get", - "type.union.StringExtensibleNamedClient.getWithResponse": "Type.Union.StringExtensibleNamed.get", - "type.union.StringExtensibleNamedClient.send": "Type.Union.StringExtensibleNamed.send", - "type.union.StringExtensibleNamedClient.sendWithResponse": "Type.Union.StringExtensibleNamed.send", - "type.union.StringsOnlyAsyncClient": "Type.Union.StringsOnly", - "type.union.StringsOnlyAsyncClient.get": "Type.Union.StringsOnly.get", - "type.union.StringsOnlyAsyncClient.getWithResponse": "Type.Union.StringsOnly.get", - "type.union.StringsOnlyAsyncClient.send": "Type.Union.StringsOnly.send", - "type.union.StringsOnlyAsyncClient.sendWithResponse": "Type.Union.StringsOnly.send", - "type.union.StringsOnlyClient": "Type.Union.StringsOnly", - "type.union.StringsOnlyClient.get": "Type.Union.StringsOnly.get", - "type.union.StringsOnlyClient.getWithResponse": "Type.Union.StringsOnly.get", - "type.union.StringsOnlyClient.send": "Type.Union.StringsOnly.send", - "type.union.StringsOnlyClient.sendWithResponse": "Type.Union.StringsOnly.send", - "type.union.UnionClientBuilder": "Type.Union", - "type.union.implementation.models.SendRequest": "Type.Union.send.Request.anonymous", - "type.union.implementation.models.SendRequest1": "Type.Union.send.Request.anonymous", - "type.union.implementation.models.SendRequest2": "Type.Union.send.Request.anonymous", - "type.union.implementation.models.SendRequest3": "Type.Union.send.Request.anonymous", - "type.union.implementation.models.SendRequest4": "Type.Union.send.Request.anonymous", - "type.union.implementation.models.SendRequest5": "Type.Union.send.Request.anonymous", - "type.union.implementation.models.SendRequest6": "Type.Union.send.Request.anonymous", - "type.union.implementation.models.SendRequest7": "Type.Union.send.Request.anonymous", - "type.union.implementation.models.SendRequest8": "Type.Union.send.Request.anonymous", - "type.union.implementation.models.SendRequest9": "Type.Union.send.Request.anonymous", - "type.union.models.Cat": "Type.Union.Cat", - "type.union.models.Dog": "Type.Union.Dog", - "type.union.models.EnumsOnlyCases": "Type.Union.EnumsOnlyCases", - "type.union.models.EnumsOnlyCasesLr": "Type.Union.EnumsOnlyCases.lr.anonymous", - "type.union.models.EnumsOnlyCasesUd": "Type.Union.EnumsOnlyCases.ud.anonymous", - "type.union.models.GetResponse": "Type.Union.get.Response.anonymous", - "type.union.models.GetResponse1": "Type.Union.get.Response.anonymous", - "type.union.models.GetResponse2": "Type.Union.get.Response.anonymous", - "type.union.models.GetResponse3": "Type.Union.get.Response.anonymous", - "type.union.models.GetResponse4": "Type.Union.get.Response.anonymous", - "type.union.models.GetResponse5": "Type.Union.get.Response.anonymous", - "type.union.models.GetResponse6": "Type.Union.get.Response.anonymous", - "type.union.models.GetResponse7": "Type.Union.get.Response.anonymous", - "type.union.models.GetResponse8": "Type.Union.get.Response.anonymous", - "type.union.models.GetResponse9": "Type.Union.get.Response.anonymous", - "type.union.models.GetResponseProp": "Type.Union.get.Response.prop.anonymous", - "type.union.models.GetResponseProp1": "Type.Union.get.Response.prop.anonymous", - "type.union.models.GetResponseProp2": "Type.Union.get.Response.prop.anonymous", - "type.union.models.GetResponseProp3": "Type.Union.get.Response.prop.anonymous", - "type.union.models.MixedLiteralsCases": "Type.Union.MixedLiteralsCases", - "type.union.models.MixedTypesCases": "Type.Union.MixedTypesCases", - "type.union.models.StringAndArrayCases": "Type.Union.StringAndArrayCases", - "type.union.models.StringExtensibleNamedUnion": "Type.Union.StringExtensibleNamedUnion" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_metadata.json deleted file mode 100644 index 076eb870da1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","crossLanguageDefinitions":{"type.union.EnumsOnlyAsyncClient":"Type.Union.EnumsOnly","type.union.EnumsOnlyAsyncClient.get":"Type.Union.EnumsOnly.get","type.union.EnumsOnlyAsyncClient.getWithResponse":"Type.Union.EnumsOnly.get","type.union.EnumsOnlyAsyncClient.send":"Type.Union.EnumsOnly.send","type.union.EnumsOnlyAsyncClient.sendWithResponse":"Type.Union.EnumsOnly.send","type.union.EnumsOnlyClient":"Type.Union.EnumsOnly","type.union.EnumsOnlyClient.get":"Type.Union.EnumsOnly.get","type.union.EnumsOnlyClient.getWithResponse":"Type.Union.EnumsOnly.get","type.union.EnumsOnlyClient.send":"Type.Union.EnumsOnly.send","type.union.EnumsOnlyClient.sendWithResponse":"Type.Union.EnumsOnly.send","type.union.FloatsOnlyAsyncClient":"Type.Union.FloatsOnly","type.union.FloatsOnlyAsyncClient.get":"Type.Union.FloatsOnly.get","type.union.FloatsOnlyAsyncClient.getWithResponse":"Type.Union.FloatsOnly.get","type.union.FloatsOnlyAsyncClient.send":"Type.Union.FloatsOnly.send","type.union.FloatsOnlyAsyncClient.sendWithResponse":"Type.Union.FloatsOnly.send","type.union.FloatsOnlyClient":"Type.Union.FloatsOnly","type.union.FloatsOnlyClient.get":"Type.Union.FloatsOnly.get","type.union.FloatsOnlyClient.getWithResponse":"Type.Union.FloatsOnly.get","type.union.FloatsOnlyClient.send":"Type.Union.FloatsOnly.send","type.union.FloatsOnlyClient.sendWithResponse":"Type.Union.FloatsOnly.send","type.union.IntsOnlyAsyncClient":"Type.Union.IntsOnly","type.union.IntsOnlyAsyncClient.get":"Type.Union.IntsOnly.get","type.union.IntsOnlyAsyncClient.getWithResponse":"Type.Union.IntsOnly.get","type.union.IntsOnlyAsyncClient.send":"Type.Union.IntsOnly.send","type.union.IntsOnlyAsyncClient.sendWithResponse":"Type.Union.IntsOnly.send","type.union.IntsOnlyClient":"Type.Union.IntsOnly","type.union.IntsOnlyClient.get":"Type.Union.IntsOnly.get","type.union.IntsOnlyClient.getWithResponse":"Type.Union.IntsOnly.get","type.union.IntsOnlyClient.send":"Type.Union.IntsOnly.send","type.union.IntsOnlyClient.sendWithResponse":"Type.Union.IntsOnly.send","type.union.MixedLiteralsAsyncClient":"Type.Union.MixedLiterals","type.union.MixedLiteralsAsyncClient.get":"Type.Union.MixedLiterals.get","type.union.MixedLiteralsAsyncClient.getWithResponse":"Type.Union.MixedLiterals.get","type.union.MixedLiteralsAsyncClient.send":"Type.Union.MixedLiterals.send","type.union.MixedLiteralsAsyncClient.sendWithResponse":"Type.Union.MixedLiterals.send","type.union.MixedLiteralsClient":"Type.Union.MixedLiterals","type.union.MixedLiteralsClient.get":"Type.Union.MixedLiterals.get","type.union.MixedLiteralsClient.getWithResponse":"Type.Union.MixedLiterals.get","type.union.MixedLiteralsClient.send":"Type.Union.MixedLiterals.send","type.union.MixedLiteralsClient.sendWithResponse":"Type.Union.MixedLiterals.send","type.union.MixedTypesAsyncClient":"Type.Union.MixedTypes","type.union.MixedTypesAsyncClient.get":"Type.Union.MixedTypes.get","type.union.MixedTypesAsyncClient.getWithResponse":"Type.Union.MixedTypes.get","type.union.MixedTypesAsyncClient.send":"Type.Union.MixedTypes.send","type.union.MixedTypesAsyncClient.sendWithResponse":"Type.Union.MixedTypes.send","type.union.MixedTypesClient":"Type.Union.MixedTypes","type.union.MixedTypesClient.get":"Type.Union.MixedTypes.get","type.union.MixedTypesClient.getWithResponse":"Type.Union.MixedTypes.get","type.union.MixedTypesClient.send":"Type.Union.MixedTypes.send","type.union.MixedTypesClient.sendWithResponse":"Type.Union.MixedTypes.send","type.union.ModelsOnlyAsyncClient":"Type.Union.ModelsOnly","type.union.ModelsOnlyAsyncClient.get":"Type.Union.ModelsOnly.get","type.union.ModelsOnlyAsyncClient.getWithResponse":"Type.Union.ModelsOnly.get","type.union.ModelsOnlyAsyncClient.send":"Type.Union.ModelsOnly.send","type.union.ModelsOnlyAsyncClient.sendWithResponse":"Type.Union.ModelsOnly.send","type.union.ModelsOnlyClient":"Type.Union.ModelsOnly","type.union.ModelsOnlyClient.get":"Type.Union.ModelsOnly.get","type.union.ModelsOnlyClient.getWithResponse":"Type.Union.ModelsOnly.get","type.union.ModelsOnlyClient.send":"Type.Union.ModelsOnly.send","type.union.ModelsOnlyClient.sendWithResponse":"Type.Union.ModelsOnly.send","type.union.StringAndArrayAsyncClient":"Type.Union.StringAndArray","type.union.StringAndArrayAsyncClient.get":"Type.Union.StringAndArray.get","type.union.StringAndArrayAsyncClient.getWithResponse":"Type.Union.StringAndArray.get","type.union.StringAndArrayAsyncClient.send":"Type.Union.StringAndArray.send","type.union.StringAndArrayAsyncClient.sendWithResponse":"Type.Union.StringAndArray.send","type.union.StringAndArrayClient":"Type.Union.StringAndArray","type.union.StringAndArrayClient.get":"Type.Union.StringAndArray.get","type.union.StringAndArrayClient.getWithResponse":"Type.Union.StringAndArray.get","type.union.StringAndArrayClient.send":"Type.Union.StringAndArray.send","type.union.StringAndArrayClient.sendWithResponse":"Type.Union.StringAndArray.send","type.union.StringExtensibleAsyncClient":"Type.Union.StringExtensible","type.union.StringExtensibleAsyncClient.get":"Type.Union.StringExtensible.get","type.union.StringExtensibleAsyncClient.getWithResponse":"Type.Union.StringExtensible.get","type.union.StringExtensibleAsyncClient.send":"Type.Union.StringExtensible.send","type.union.StringExtensibleAsyncClient.sendWithResponse":"Type.Union.StringExtensible.send","type.union.StringExtensibleClient":"Type.Union.StringExtensible","type.union.StringExtensibleClient.get":"Type.Union.StringExtensible.get","type.union.StringExtensibleClient.getWithResponse":"Type.Union.StringExtensible.get","type.union.StringExtensibleClient.send":"Type.Union.StringExtensible.send","type.union.StringExtensibleClient.sendWithResponse":"Type.Union.StringExtensible.send","type.union.StringExtensibleNamedAsyncClient":"Type.Union.StringExtensibleNamed","type.union.StringExtensibleNamedAsyncClient.get":"Type.Union.StringExtensibleNamed.get","type.union.StringExtensibleNamedAsyncClient.getWithResponse":"Type.Union.StringExtensibleNamed.get","type.union.StringExtensibleNamedAsyncClient.send":"Type.Union.StringExtensibleNamed.send","type.union.StringExtensibleNamedAsyncClient.sendWithResponse":"Type.Union.StringExtensibleNamed.send","type.union.StringExtensibleNamedClient":"Type.Union.StringExtensibleNamed","type.union.StringExtensibleNamedClient.get":"Type.Union.StringExtensibleNamed.get","type.union.StringExtensibleNamedClient.getWithResponse":"Type.Union.StringExtensibleNamed.get","type.union.StringExtensibleNamedClient.send":"Type.Union.StringExtensibleNamed.send","type.union.StringExtensibleNamedClient.sendWithResponse":"Type.Union.StringExtensibleNamed.send","type.union.StringsOnlyAsyncClient":"Type.Union.StringsOnly","type.union.StringsOnlyAsyncClient.get":"Type.Union.StringsOnly.get","type.union.StringsOnlyAsyncClient.getWithResponse":"Type.Union.StringsOnly.get","type.union.StringsOnlyAsyncClient.send":"Type.Union.StringsOnly.send","type.union.StringsOnlyAsyncClient.sendWithResponse":"Type.Union.StringsOnly.send","type.union.StringsOnlyClient":"Type.Union.StringsOnly","type.union.StringsOnlyClient.get":"Type.Union.StringsOnly.get","type.union.StringsOnlyClient.getWithResponse":"Type.Union.StringsOnly.get","type.union.StringsOnlyClient.send":"Type.Union.StringsOnly.send","type.union.StringsOnlyClient.sendWithResponse":"Type.Union.StringsOnly.send","type.union.UnionClientBuilder":"Type.Union","type.union.implementation.models.SendRequest":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest1":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest2":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest3":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest4":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest5":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest6":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest7":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest8":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest9":"Type.Union.send.Request.anonymous","type.union.models.Cat":"Type.Union.Cat","type.union.models.Dog":"Type.Union.Dog","type.union.models.EnumsOnlyCases":"Type.Union.EnumsOnlyCases","type.union.models.EnumsOnlyCasesLr":"Type.Union.EnumsOnlyCases.lr.anonymous","type.union.models.EnumsOnlyCasesUd":"Type.Union.EnumsOnlyCases.ud.anonymous","type.union.models.GetResponse":"Type.Union.get.Response.anonymous","type.union.models.GetResponse1":"Type.Union.get.Response.anonymous","type.union.models.GetResponse2":"Type.Union.get.Response.anonymous","type.union.models.GetResponse3":"Type.Union.get.Response.anonymous","type.union.models.GetResponse4":"Type.Union.get.Response.anonymous","type.union.models.GetResponse5":"Type.Union.get.Response.anonymous","type.union.models.GetResponse6":"Type.Union.get.Response.anonymous","type.union.models.GetResponse7":"Type.Union.get.Response.anonymous","type.union.models.GetResponse8":"Type.Union.get.Response.anonymous","type.union.models.GetResponse9":"Type.Union.get.Response.anonymous","type.union.models.GetResponseProp":"Type.Union.get.Response.prop.anonymous","type.union.models.GetResponseProp1":"Type.Union.get.Response.prop.anonymous","type.union.models.GetResponseProp2":"Type.Union.get.Response.prop.anonymous","type.union.models.GetResponseProp3":"Type.Union.get.Response.prop.anonymous","type.union.models.MixedLiteralsCases":"Type.Union.MixedLiteralsCases","type.union.models.MixedTypesCases":"Type.Union.MixedTypesCases","type.union.models.StringAndArrayCases":"Type.Union.StringAndArrayCases","type.union.models.StringExtensibleNamedUnion":"Type.Union.StringExtensibleNamedUnion"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/union/EnumsOnlyAsyncClient.java","src/main/java/type/union/EnumsOnlyClient.java","src/main/java/type/union/FloatsOnlyAsyncClient.java","src/main/java/type/union/FloatsOnlyClient.java","src/main/java/type/union/IntsOnlyAsyncClient.java","src/main/java/type/union/IntsOnlyClient.java","src/main/java/type/union/MixedLiteralsAsyncClient.java","src/main/java/type/union/MixedLiteralsClient.java","src/main/java/type/union/MixedTypesAsyncClient.java","src/main/java/type/union/MixedTypesClient.java","src/main/java/type/union/ModelsOnlyAsyncClient.java","src/main/java/type/union/ModelsOnlyClient.java","src/main/java/type/union/StringAndArrayAsyncClient.java","src/main/java/type/union/StringAndArrayClient.java","src/main/java/type/union/StringExtensibleAsyncClient.java","src/main/java/type/union/StringExtensibleClient.java","src/main/java/type/union/StringExtensibleNamedAsyncClient.java","src/main/java/type/union/StringExtensibleNamedClient.java","src/main/java/type/union/StringsOnlyAsyncClient.java","src/main/java/type/union/StringsOnlyClient.java","src/main/java/type/union/UnionClientBuilder.java","src/main/java/type/union/implementation/EnumsOnliesImpl.java","src/main/java/type/union/implementation/FloatsOnliesImpl.java","src/main/java/type/union/implementation/IntsOnliesImpl.java","src/main/java/type/union/implementation/MixedLiteralsImpl.java","src/main/java/type/union/implementation/MixedTypesImpl.java","src/main/java/type/union/implementation/ModelsOnliesImpl.java","src/main/java/type/union/implementation/StringAndArraysImpl.java","src/main/java/type/union/implementation/StringExtensibleNamedsImpl.java","src/main/java/type/union/implementation/StringExtensiblesImpl.java","src/main/java/type/union/implementation/StringsOnliesImpl.java","src/main/java/type/union/implementation/UnionClientImpl.java","src/main/java/type/union/implementation/models/SendRequest.java","src/main/java/type/union/implementation/models/SendRequest1.java","src/main/java/type/union/implementation/models/SendRequest2.java","src/main/java/type/union/implementation/models/SendRequest3.java","src/main/java/type/union/implementation/models/SendRequest4.java","src/main/java/type/union/implementation/models/SendRequest5.java","src/main/java/type/union/implementation/models/SendRequest6.java","src/main/java/type/union/implementation/models/SendRequest7.java","src/main/java/type/union/implementation/models/SendRequest8.java","src/main/java/type/union/implementation/models/SendRequest9.java","src/main/java/type/union/implementation/models/package-info.java","src/main/java/type/union/implementation/package-info.java","src/main/java/type/union/models/Cat.java","src/main/java/type/union/models/Dog.java","src/main/java/type/union/models/EnumsOnlyCases.java","src/main/java/type/union/models/EnumsOnlyCasesLr.java","src/main/java/type/union/models/EnumsOnlyCasesUd.java","src/main/java/type/union/models/GetResponse.java","src/main/java/type/union/models/GetResponse1.java","src/main/java/type/union/models/GetResponse2.java","src/main/java/type/union/models/GetResponse3.java","src/main/java/type/union/models/GetResponse4.java","src/main/java/type/union/models/GetResponse5.java","src/main/java/type/union/models/GetResponse6.java","src/main/java/type/union/models/GetResponse7.java","src/main/java/type/union/models/GetResponse8.java","src/main/java/type/union/models/GetResponse9.java","src/main/java/type/union/models/GetResponseProp.java","src/main/java/type/union/models/GetResponseProp1.java","src/main/java/type/union/models/GetResponseProp2.java","src/main/java/type/union/models/GetResponseProp3.java","src/main/java/type/union/models/MixedLiteralsCases.java","src/main/java/type/union/models/MixedTypesCases.java","src/main/java/type/union/models/StringAndArrayCases.java","src/main/java/type/union/models/StringExtensibleNamedUnion.java","src/main/java/type/union/models/package-info.java","src/main/java/type/union/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_apiview_properties.json deleted file mode 100644 index c8dde1279f5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_apiview_properties.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "versioning.added.AddedAsyncClient": "Versioning.Added", - "versioning.added.AddedAsyncClient.v1": "Versioning.Added.v1", - "versioning.added.AddedAsyncClient.v1WithResponse": "Versioning.Added.v1", - "versioning.added.AddedAsyncClient.v2": "Versioning.Added.v2", - "versioning.added.AddedAsyncClient.v2WithResponse": "Versioning.Added.v2", - "versioning.added.AddedClient": "Versioning.Added", - "versioning.added.AddedClient.v1": "Versioning.Added.v1", - "versioning.added.AddedClient.v1WithResponse": "Versioning.Added.v1", - "versioning.added.AddedClient.v2": "Versioning.Added.v2", - "versioning.added.AddedClient.v2WithResponse": "Versioning.Added.v2", - "versioning.added.AddedClientBuilder": "Versioning.Added", - "versioning.added.InterfaceV2AsyncClient": "Versioning.Added.InterfaceV2", - "versioning.added.InterfaceV2AsyncClient.v2InInterface": "Versioning.Added.InterfaceV2.v2InInterface", - "versioning.added.InterfaceV2AsyncClient.v2InInterfaceWithResponse": "Versioning.Added.InterfaceV2.v2InInterface", - "versioning.added.InterfaceV2Client": "Versioning.Added.InterfaceV2", - "versioning.added.InterfaceV2Client.v2InInterface": "Versioning.Added.InterfaceV2.v2InInterface", - "versioning.added.InterfaceV2Client.v2InInterfaceWithResponse": "Versioning.Added.InterfaceV2.v2InInterface", - "versioning.added.models.EnumV1": "Versioning.Added.EnumV1", - "versioning.added.models.EnumV2": "Versioning.Added.EnumV2", - "versioning.added.models.ModelV1": "Versioning.Added.ModelV1", - "versioning.added.models.ModelV2": "Versioning.Added.ModelV2" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_metadata.json deleted file mode 100644 index 4a0f5f82c05..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"v2","crossLanguageDefinitions":{"versioning.added.AddedAsyncClient":"Versioning.Added","versioning.added.AddedAsyncClient.v1":"Versioning.Added.v1","versioning.added.AddedAsyncClient.v1WithResponse":"Versioning.Added.v1","versioning.added.AddedAsyncClient.v2":"Versioning.Added.v2","versioning.added.AddedAsyncClient.v2WithResponse":"Versioning.Added.v2","versioning.added.AddedClient":"Versioning.Added","versioning.added.AddedClient.v1":"Versioning.Added.v1","versioning.added.AddedClient.v1WithResponse":"Versioning.Added.v1","versioning.added.AddedClient.v2":"Versioning.Added.v2","versioning.added.AddedClient.v2WithResponse":"Versioning.Added.v2","versioning.added.AddedClientBuilder":"Versioning.Added","versioning.added.InterfaceV2AsyncClient":"Versioning.Added.InterfaceV2","versioning.added.InterfaceV2AsyncClient.v2InInterface":"Versioning.Added.InterfaceV2.v2InInterface","versioning.added.InterfaceV2AsyncClient.v2InInterfaceWithResponse":"Versioning.Added.InterfaceV2.v2InInterface","versioning.added.InterfaceV2Client":"Versioning.Added.InterfaceV2","versioning.added.InterfaceV2Client.v2InInterface":"Versioning.Added.InterfaceV2.v2InInterface","versioning.added.InterfaceV2Client.v2InInterfaceWithResponse":"Versioning.Added.InterfaceV2.v2InInterface","versioning.added.models.EnumV1":"Versioning.Added.EnumV1","versioning.added.models.EnumV2":"Versioning.Added.EnumV2","versioning.added.models.ModelV1":"Versioning.Added.ModelV1","versioning.added.models.ModelV2":"Versioning.Added.ModelV2"},"generatedFiles":["src/main/java/module-info.java","src/main/java/versioning/added/AddedAsyncClient.java","src/main/java/versioning/added/AddedClient.java","src/main/java/versioning/added/AddedClientBuilder.java","src/main/java/versioning/added/AddedServiceVersion.java","src/main/java/versioning/added/InterfaceV2AsyncClient.java","src/main/java/versioning/added/InterfaceV2Client.java","src/main/java/versioning/added/implementation/AddedClientImpl.java","src/main/java/versioning/added/implementation/InterfaceV2sImpl.java","src/main/java/versioning/added/implementation/package-info.java","src/main/java/versioning/added/models/EnumV1.java","src/main/java/versioning/added/models/EnumV2.java","src/main/java/versioning/added/models/ModelV1.java","src/main/java/versioning/added/models/ModelV2.java","src/main/java/versioning/added/models/package-info.java","src/main/java/versioning/added/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_apiview_properties.json deleted file mode 100644 index 81a95b261fd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_apiview_properties.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "versioning.madeoptional.MadeOptionalAsyncClient": "Versioning.MadeOptional", - "versioning.madeoptional.MadeOptionalAsyncClient.test": "Versioning.MadeOptional.test", - "versioning.madeoptional.MadeOptionalAsyncClient.testWithResponse": "Versioning.MadeOptional.test", - "versioning.madeoptional.MadeOptionalClient": "Versioning.MadeOptional", - "versioning.madeoptional.MadeOptionalClient.test": "Versioning.MadeOptional.test", - "versioning.madeoptional.MadeOptionalClient.testWithResponse": "Versioning.MadeOptional.test", - "versioning.madeoptional.MadeOptionalClientBuilder": "Versioning.MadeOptional", - "versioning.madeoptional.models.TestModel": "Versioning.MadeOptional.TestModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_metadata.json deleted file mode 100644 index ccebfd95958..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"v2","crossLanguageDefinitions":{"versioning.madeoptional.MadeOptionalAsyncClient":"Versioning.MadeOptional","versioning.madeoptional.MadeOptionalAsyncClient.test":"Versioning.MadeOptional.test","versioning.madeoptional.MadeOptionalAsyncClient.testWithResponse":"Versioning.MadeOptional.test","versioning.madeoptional.MadeOptionalClient":"Versioning.MadeOptional","versioning.madeoptional.MadeOptionalClient.test":"Versioning.MadeOptional.test","versioning.madeoptional.MadeOptionalClient.testWithResponse":"Versioning.MadeOptional.test","versioning.madeoptional.MadeOptionalClientBuilder":"Versioning.MadeOptional","versioning.madeoptional.models.TestModel":"Versioning.MadeOptional.TestModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/versioning/madeoptional/MadeOptionalAsyncClient.java","src/main/java/versioning/madeoptional/MadeOptionalClient.java","src/main/java/versioning/madeoptional/MadeOptionalClientBuilder.java","src/main/java/versioning/madeoptional/MadeOptionalServiceVersion.java","src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java","src/main/java/versioning/madeoptional/implementation/package-info.java","src/main/java/versioning/madeoptional/models/TestModel.java","src/main/java/versioning/madeoptional/models/package-info.java","src/main/java/versioning/madeoptional/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_apiview_properties.json deleted file mode 100644 index 8bff65100c9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_apiview_properties.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "versioning.removed.RemovedAsyncClient": "Versioning.Removed", - "versioning.removed.RemovedAsyncClient.modelV3": "Versioning.Removed.modelV3", - "versioning.removed.RemovedAsyncClient.modelV3WithResponse": "Versioning.Removed.modelV3", - "versioning.removed.RemovedAsyncClient.v2": "Versioning.Removed.v2", - "versioning.removed.RemovedAsyncClient.v2WithResponse": "Versioning.Removed.v2", - "versioning.removed.RemovedClient": "Versioning.Removed", - "versioning.removed.RemovedClient.modelV3": "Versioning.Removed.modelV3", - "versioning.removed.RemovedClient.modelV3WithResponse": "Versioning.Removed.modelV3", - "versioning.removed.RemovedClient.v2": "Versioning.Removed.v2", - "versioning.removed.RemovedClient.v2WithResponse": "Versioning.Removed.v2", - "versioning.removed.RemovedClientBuilder": "Versioning.Removed", - "versioning.removed.models.EnumV2": "Versioning.Removed.EnumV2", - "versioning.removed.models.EnumV3": "Versioning.Removed.EnumV3", - "versioning.removed.models.ModelV2": "Versioning.Removed.ModelV2", - "versioning.removed.models.ModelV3": "Versioning.Removed.ModelV3" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_metadata.json deleted file mode 100644 index 3cbb6843d41..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"v2","crossLanguageDefinitions":{"versioning.removed.RemovedAsyncClient":"Versioning.Removed","versioning.removed.RemovedAsyncClient.modelV3":"Versioning.Removed.modelV3","versioning.removed.RemovedAsyncClient.modelV3WithResponse":"Versioning.Removed.modelV3","versioning.removed.RemovedAsyncClient.v2":"Versioning.Removed.v2","versioning.removed.RemovedAsyncClient.v2WithResponse":"Versioning.Removed.v2","versioning.removed.RemovedClient":"Versioning.Removed","versioning.removed.RemovedClient.modelV3":"Versioning.Removed.modelV3","versioning.removed.RemovedClient.modelV3WithResponse":"Versioning.Removed.modelV3","versioning.removed.RemovedClient.v2":"Versioning.Removed.v2","versioning.removed.RemovedClient.v2WithResponse":"Versioning.Removed.v2","versioning.removed.RemovedClientBuilder":"Versioning.Removed","versioning.removed.models.EnumV2":"Versioning.Removed.EnumV2","versioning.removed.models.EnumV3":"Versioning.Removed.EnumV3","versioning.removed.models.ModelV2":"Versioning.Removed.ModelV2","versioning.removed.models.ModelV3":"Versioning.Removed.ModelV3"},"generatedFiles":["src/main/java/module-info.java","src/main/java/versioning/removed/RemovedAsyncClient.java","src/main/java/versioning/removed/RemovedClient.java","src/main/java/versioning/removed/RemovedClientBuilder.java","src/main/java/versioning/removed/RemovedServiceVersion.java","src/main/java/versioning/removed/implementation/RemovedClientImpl.java","src/main/java/versioning/removed/implementation/package-info.java","src/main/java/versioning/removed/models/EnumV2.java","src/main/java/versioning/removed/models/EnumV3.java","src/main/java/versioning/removed/models/ModelV2.java","src/main/java/versioning/removed/models/ModelV3.java","src/main/java/versioning/removed/models/package-info.java","src/main/java/versioning/removed/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_apiview_properties.json deleted file mode 100644 index 700b2cc4909..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_apiview_properties.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "versioning.renamedfrom.NewInterfaceAsyncClient": "Versioning.RenamedFrom.NewInterface", - "versioning.renamedfrom.NewInterfaceAsyncClient.newOpInNewInterface": "Versioning.RenamedFrom.NewInterface.newOpInNewInterface", - "versioning.renamedfrom.NewInterfaceAsyncClient.newOpInNewInterfaceWithResponse": "Versioning.RenamedFrom.NewInterface.newOpInNewInterface", - "versioning.renamedfrom.NewInterfaceClient": "Versioning.RenamedFrom.NewInterface", - "versioning.renamedfrom.NewInterfaceClient.newOpInNewInterface": "Versioning.RenamedFrom.NewInterface.newOpInNewInterface", - "versioning.renamedfrom.NewInterfaceClient.newOpInNewInterfaceWithResponse": "Versioning.RenamedFrom.NewInterface.newOpInNewInterface", - "versioning.renamedfrom.RenamedFromAsyncClient": "Versioning.RenamedFrom", - "versioning.renamedfrom.RenamedFromAsyncClient.newOp": "Versioning.RenamedFrom.newOp", - "versioning.renamedfrom.RenamedFromAsyncClient.newOpWithResponse": "Versioning.RenamedFrom.newOp", - "versioning.renamedfrom.RenamedFromClient": "Versioning.RenamedFrom", - "versioning.renamedfrom.RenamedFromClient.newOp": "Versioning.RenamedFrom.newOp", - "versioning.renamedfrom.RenamedFromClient.newOpWithResponse": "Versioning.RenamedFrom.newOp", - "versioning.renamedfrom.RenamedFromClientBuilder": "Versioning.RenamedFrom", - "versioning.renamedfrom.models.NewEnum": "Versioning.RenamedFrom.NewEnum", - "versioning.renamedfrom.models.NewModel": "Versioning.RenamedFrom.NewModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_metadata.json deleted file mode 100644 index 4259526620d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"v2","crossLanguageDefinitions":{"versioning.renamedfrom.NewInterfaceAsyncClient":"Versioning.RenamedFrom.NewInterface","versioning.renamedfrom.NewInterfaceAsyncClient.newOpInNewInterface":"Versioning.RenamedFrom.NewInterface.newOpInNewInterface","versioning.renamedfrom.NewInterfaceAsyncClient.newOpInNewInterfaceWithResponse":"Versioning.RenamedFrom.NewInterface.newOpInNewInterface","versioning.renamedfrom.NewInterfaceClient":"Versioning.RenamedFrom.NewInterface","versioning.renamedfrom.NewInterfaceClient.newOpInNewInterface":"Versioning.RenamedFrom.NewInterface.newOpInNewInterface","versioning.renamedfrom.NewInterfaceClient.newOpInNewInterfaceWithResponse":"Versioning.RenamedFrom.NewInterface.newOpInNewInterface","versioning.renamedfrom.RenamedFromAsyncClient":"Versioning.RenamedFrom","versioning.renamedfrom.RenamedFromAsyncClient.newOp":"Versioning.RenamedFrom.newOp","versioning.renamedfrom.RenamedFromAsyncClient.newOpWithResponse":"Versioning.RenamedFrom.newOp","versioning.renamedfrom.RenamedFromClient":"Versioning.RenamedFrom","versioning.renamedfrom.RenamedFromClient.newOp":"Versioning.RenamedFrom.newOp","versioning.renamedfrom.RenamedFromClient.newOpWithResponse":"Versioning.RenamedFrom.newOp","versioning.renamedfrom.RenamedFromClientBuilder":"Versioning.RenamedFrom","versioning.renamedfrom.models.NewEnum":"Versioning.RenamedFrom.NewEnum","versioning.renamedfrom.models.NewModel":"Versioning.RenamedFrom.NewModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/versioning/renamedfrom/NewInterfaceAsyncClient.java","src/main/java/versioning/renamedfrom/NewInterfaceClient.java","src/main/java/versioning/renamedfrom/RenamedFromAsyncClient.java","src/main/java/versioning/renamedfrom/RenamedFromClient.java","src/main/java/versioning/renamedfrom/RenamedFromClientBuilder.java","src/main/java/versioning/renamedfrom/RenamedFromServiceVersion.java","src/main/java/versioning/renamedfrom/implementation/NewInterfacesImpl.java","src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java","src/main/java/versioning/renamedfrom/implementation/package-info.java","src/main/java/versioning/renamedfrom/models/NewEnum.java","src/main/java/versioning/renamedfrom/models/NewModel.java","src/main/java/versioning/renamedfrom/models/package-info.java","src/main/java/versioning/renamedfrom/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_apiview_properties.json deleted file mode 100644 index 991d9caa878..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_apiview_properties.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "versioning.returntypechangedfrom.ReturnTypeChangedFromAsyncClient": "Versioning.ReturnTypeChangedFrom", - "versioning.returntypechangedfrom.ReturnTypeChangedFromAsyncClient.test": "Versioning.ReturnTypeChangedFrom.test", - "versioning.returntypechangedfrom.ReturnTypeChangedFromAsyncClient.testWithResponse": "Versioning.ReturnTypeChangedFrom.test", - "versioning.returntypechangedfrom.ReturnTypeChangedFromClient": "Versioning.ReturnTypeChangedFrom", - "versioning.returntypechangedfrom.ReturnTypeChangedFromClient.test": "Versioning.ReturnTypeChangedFrom.test", - "versioning.returntypechangedfrom.ReturnTypeChangedFromClient.testWithResponse": "Versioning.ReturnTypeChangedFrom.test", - "versioning.returntypechangedfrom.ReturnTypeChangedFromClientBuilder": "Versioning.ReturnTypeChangedFrom" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_metadata.json deleted file mode 100644 index ee35c59516f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"v2","crossLanguageDefinitions":{"versioning.returntypechangedfrom.ReturnTypeChangedFromAsyncClient":"Versioning.ReturnTypeChangedFrom","versioning.returntypechangedfrom.ReturnTypeChangedFromAsyncClient.test":"Versioning.ReturnTypeChangedFrom.test","versioning.returntypechangedfrom.ReturnTypeChangedFromAsyncClient.testWithResponse":"Versioning.ReturnTypeChangedFrom.test","versioning.returntypechangedfrom.ReturnTypeChangedFromClient":"Versioning.ReturnTypeChangedFrom","versioning.returntypechangedfrom.ReturnTypeChangedFromClient.test":"Versioning.ReturnTypeChangedFrom.test","versioning.returntypechangedfrom.ReturnTypeChangedFromClient.testWithResponse":"Versioning.ReturnTypeChangedFrom.test","versioning.returntypechangedfrom.ReturnTypeChangedFromClientBuilder":"Versioning.ReturnTypeChangedFrom"},"generatedFiles":["src/main/java/module-info.java","src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromAsyncClient.java","src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClient.java","src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClientBuilder.java","src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromServiceVersion.java","src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java","src/main/java/versioning/returntypechangedfrom/implementation/package-info.java","src/main/java/versioning/returntypechangedfrom/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_apiview_properties.json deleted file mode 100644 index 0f0f6a1972a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_apiview_properties.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "flavor": "Azure", - "CrossLanguageDefinitionId": { - "versioning.typechangedfrom.TypeChangedFromAsyncClient": "Versioning.TypeChangedFrom", - "versioning.typechangedfrom.TypeChangedFromAsyncClient.test": "Versioning.TypeChangedFrom.test", - "versioning.typechangedfrom.TypeChangedFromAsyncClient.testWithResponse": "Versioning.TypeChangedFrom.test", - "versioning.typechangedfrom.TypeChangedFromClient": "Versioning.TypeChangedFrom", - "versioning.typechangedfrom.TypeChangedFromClient.test": "Versioning.TypeChangedFrom.test", - "versioning.typechangedfrom.TypeChangedFromClient.testWithResponse": "Versioning.TypeChangedFrom.test", - "versioning.typechangedfrom.TypeChangedFromClientBuilder": "Versioning.TypeChangedFrom", - "versioning.typechangedfrom.models.TestModel": "Versioning.TypeChangedFrom.TestModel" - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_metadata.json deleted file mode 100644 index 231b4596ca8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"flavor":"Azure","apiVersion":"v2","crossLanguageDefinitions":{"versioning.typechangedfrom.TypeChangedFromAsyncClient":"Versioning.TypeChangedFrom","versioning.typechangedfrom.TypeChangedFromAsyncClient.test":"Versioning.TypeChangedFrom.test","versioning.typechangedfrom.TypeChangedFromAsyncClient.testWithResponse":"Versioning.TypeChangedFrom.test","versioning.typechangedfrom.TypeChangedFromClient":"Versioning.TypeChangedFrom","versioning.typechangedfrom.TypeChangedFromClient.test":"Versioning.TypeChangedFrom.test","versioning.typechangedfrom.TypeChangedFromClient.testWithResponse":"Versioning.TypeChangedFrom.test","versioning.typechangedfrom.TypeChangedFromClientBuilder":"Versioning.TypeChangedFrom","versioning.typechangedfrom.models.TestModel":"Versioning.TypeChangedFrom.TestModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/versioning/typechangedfrom/TypeChangedFromAsyncClient.java","src/main/java/versioning/typechangedfrom/TypeChangedFromClient.java","src/main/java/versioning/typechangedfrom/TypeChangedFromClientBuilder.java","src/main/java/versioning/typechangedfrom/TypeChangedFromServiceVersion.java","src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java","src/main/java/versioning/typechangedfrom/implementation/package-info.java","src/main/java/versioning/typechangedfrom/models/TestModel.java","src/main/java/versioning/typechangedfrom/models/package-info.java","src/main/java/versioning/typechangedfrom/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-apikey.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-apikey.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-apikey.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-http-custom.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-http-custom.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-http-custom.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-oauth2.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-oauth2.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-oauth2.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-union.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-union.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-union.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-access.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-access.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-access.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-alternatetype.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-alternatetype.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-alternatetype.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-header.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-header.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-header.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-path.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-path.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-path.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-query.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-query.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-query.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientinitialization.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientinitialization.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientinitialization.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientlocation.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientlocation.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientlocation.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-deserialize-emptystringnull.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-deserialize-emptystringnull.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-deserialize-emptystringnull.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-flattenproperty.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-flattenproperty.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-flattenproperty.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-hierarchybuilding.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-hierarchybuilding.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-hierarchybuilding.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-methodoverride.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-methodoverride.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-methodoverride.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-nextlinkverb.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-nextlinkverb.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-nextlinkverb.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-usage.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-usage.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-usage.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-basic.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-basic.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-basic.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-rpc.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-rpc.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-rpc.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-standard.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-standard.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-standard.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-model.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-model.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-model.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-page.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-page.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-page.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-scalar.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-scalar.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-scalar.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-traits.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-traits.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-traits.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-encode-duration.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-encode-duration.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-encode-duration.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-example-basic.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-example-basic.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-example-basic.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-payload-pageable.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-payload-pageable.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-payload-pageable.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armcustomization-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armcustomization-generated.properties deleted file mode 100644 index defbd48204e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armcustomization-generated.properties +++ /dev/null @@ -1 +0,0 @@ -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armlegacy-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armlegacy-generated.properties deleted file mode 100644 index defbd48204e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armlegacy-generated.properties +++ /dev/null @@ -1 +0,0 @@ -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armresourceprovider-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armresourceprovider-generated.properties deleted file mode 100644 index defbd48204e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armresourceprovider-generated.properties +++ /dev/null @@ -1 +0,0 @@ -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armstreamstyleserialization-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armstreamstyleserialization-generated.properties deleted file mode 100644 index defbd48204e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armstreamstyleserialization-generated.properties +++ /dev/null @@ -1 +0,0 @@ -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armversioned-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armversioned-generated.properties deleted file mode 100644 index defbd48204e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armversioned-generated.properties +++ /dev/null @@ -1 +0,0 @@ -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-combined-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-combined-generated.properties deleted file mode 100644 index defbd48204e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-combined-generated.properties +++ /dev/null @@ -1 +0,0 @@ -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-commonproperties-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-commonproperties-generated.properties deleted file mode 100644 index defbd48204e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-commonproperties-generated.properties +++ /dev/null @@ -1 +0,0 @@ -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-largeheader-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-largeheader-generated.properties deleted file mode 100644 index defbd48204e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-largeheader-generated.properties +++ /dev/null @@ -1 +0,0 @@ -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-methodsubscriptionid-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-methodsubscriptionid-generated.properties deleted file mode 100644 index defbd48204e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-methodsubscriptionid-generated.properties +++ /dev/null @@ -1 +0,0 @@ -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-nonresource-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-nonresource-generated.properties deleted file mode 100644 index defbd48204e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-nonresource-generated.properties +++ /dev/null @@ -1 +0,0 @@ -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-operationtemplates-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-operationtemplates-generated.properties deleted file mode 100644 index defbd48204e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-operationtemplates-generated.properties +++ /dev/null @@ -1 +0,0 @@ -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-resources-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-resources-generated.properties deleted file mode 100644 index defbd48204e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-resources-generated.properties +++ /dev/null @@ -1 +0,0 @@ -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-specialheaders-xmsclientrequestid.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-specialheaders-xmsclientrequestid.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-specialheaders-xmsclientrequestid.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-versioning-previewversion.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-versioning-previewversion.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-versioning-previewversion.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-clientnamespace.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-clientnamespace.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-clientnamespace.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming-enumconflict.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming-enumconflict.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming-enumconflict.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-overload.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-overload.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-overload.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-clientoperationgroup.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-clientoperationgroup.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-clientoperationgroup.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-multiclient.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-multiclient.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-multiclient.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-renamedoperation.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-renamedoperation.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-renamedoperation.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-service.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-service.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-service.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-twooperationgroup.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-twooperationgroup.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-twooperationgroup.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/documentation.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/documentation.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/documentation.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-array.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-array.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-array.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-bytes.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-bytes.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-bytes.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-datetime.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-datetime.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-datetime.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-duration.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-duration.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-duration.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-numeric.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-numeric.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-numeric.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-basic.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-basic.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-basic.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-bodyoptionality.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-bodyoptionality.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-bodyoptionality.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-collectionformat.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-collectionformat.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-collectionformat.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-path.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-path.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-path.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-spread.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-spread.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-spread.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-contentnegotiation.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-contentnegotiation.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-contentnegotiation.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-jsonmergepatch.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-jsonmergepatch.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-jsonmergepatch.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-mediatype.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-mediatype.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-mediatype.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-multipart.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-multipart.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-multipart.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven-v1.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven-v1.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven-v1.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/response-statuscoderange.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/response-statuscoderange.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/response-statuscoderange.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/routes.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/routes.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/routes.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/serialization-encodedname-json.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/serialization-encodedname-json.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/serialization-encodedname-json.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-endpoint-notdefined.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-endpoint-notdefined.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-endpoint-notdefined.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-multiple.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-multiple.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-multiple.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-single.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-single.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-single.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-notversioned.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-notversioned.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-notversioned.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-versioned.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-versioned.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-versioned.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/service-multiservice-combined.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/service-multiservice-combined.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/service-multiservice-combined.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-conditionalrequest.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-conditionalrequest.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-conditionalrequest.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-repeatability.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-repeatability.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-repeatability.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialwords.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialwords.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialwords.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/streaming-jsonl.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/streaming-jsonl.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/streaming-jsonl.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-builtin.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-builtin.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-builtin.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-clientinitialization.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-clientinitialization.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-clientinitialization.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-discriminatoredgecases.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-discriminatoredgecases.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-discriminatoredgecases.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumnesteddiscriminator.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumnesteddiscriminator.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumnesteddiscriminator.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumservice.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumservice.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumservice.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-errormodel.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-errormodel.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-errormodel.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-flatten.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-flatten.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-flatten.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-internal.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-internal.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-internal.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-literalservice.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-literalservice.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-literalservice.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-longrunning.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-longrunning.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-longrunning.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-methodoverride.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-methodoverride.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-methodoverride.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-model.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-model.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-model.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multicontenttypes.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multicontenttypes.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multicontenttypes.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multipart.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multipart.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multipart.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namespaceclient.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namespaceclient.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namespaceclient.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-naming.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-naming.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-naming.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namingjavaparser.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namingjavaparser.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namingjavaparser.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-optional.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-optional.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-optional.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-patch.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-patch.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-patch.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-protocolandconvenient.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-protocolandconvenient.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-protocolandconvenient.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-response.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-response.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-response.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialchars.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialchars.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialchars.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialheaders.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialheaders.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialheaders.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-subclass.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-subclass.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-subclass.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-union.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-union.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-union.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-versioning.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-versioning.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-versioning.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-visibility.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-visibility.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-visibility.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-wiretype.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-wiretype.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-wiretype.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-array.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-array.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-array.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-dictionary.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-dictionary.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-dictionary.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-extensible.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-extensible.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-extensible.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-fixed.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-fixed.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-fixed.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-empty.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-empty.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-empty.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-enumdiscriminator.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-enumdiscriminator.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-enumdiscriminator.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-nesteddiscriminator.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-nesteddiscriminator.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-nesteddiscriminator.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-notdiscriminated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-notdiscriminated.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-notdiscriminated.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-recursive.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-recursive.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-recursive.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-singlediscriminator.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-singlediscriminator.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-singlediscriminator.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-usage.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-usage.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-usage.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-visibility.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-visibility.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-visibility.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-additionalproperties.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-additionalproperties.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-additionalproperties.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-nullable.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-nullable.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-nullable.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-optional.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-optional.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-optional.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-valuetypes.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-valuetypes.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-valuetypes.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-scalar.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-scalar.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-scalar.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union-discriminated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union-discriminated.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union-discriminated.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-added.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-added.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-added.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-madeoptional.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-madeoptional.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-madeoptional.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-removed.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-removed.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-removed.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-renamedfrom.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-renamedfrom.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-renamedfrom.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-returntypechangedfrom.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-returntypechangedfrom.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-returntypechangedfrom.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-typechangedfrom.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-typechangedfrom.properties deleted file mode 100644 index ca812989b4f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-typechangedfrom.properties +++ /dev/null @@ -1,2 +0,0 @@ -name=${project.artifactId} -version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/azure/example/basic/generated/BasicAction.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/azure/example/basic/generated/BasicAction.java deleted file mode 100644 index 245407b1313..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/azure/example/basic/generated/BasicAction.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.example.basic.generated; - -import azure.example.basic.AzureExampleClient; -import azure.example.basic.AzureExampleClientBuilder; -import azure.example.basic.models.ActionRequest; -import azure.example.basic.models.ActionResponse; -import azure.example.basic.models.Enum; -import azure.example.basic.models.Model; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -public class BasicAction { - public static void main(String[] args) { - AzureExampleClient azureExampleClient - = new AzureExampleClientBuilder().endpoint("http://localhost:3000").buildClient(); - // BEGIN:azure.example.basic.generated.basic-action.basic-action - ActionResponse response = azureExampleClient.basicAction("query", "header", - new ActionRequest("text") - .setModelProperty( - new Model().setInt32Property(1).setFloat32Property(1.5D).setEnumProperty(Enum.ENUM_VALUE1)) - .setArrayProperty(Arrays.asList("item")) - .setRecordProperty(mapOf("record", "value"))); - // END:azure.example.basic.generated.basic-action.basic-action - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpRead.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpRead.java deleted file mode 100644 index d6e2abe2255..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpRead.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.builtin.generated; - -import com.azure.core.util.Configuration; -import tsptest.builtin.BuiltinClient; -import tsptest.builtin.BuiltinClientBuilder; -import tsptest.builtin.models.Builtin; - -public class BuiltinOpRead { - public static void main(String[] args) { - BuiltinClient builtinClient - = new BuiltinClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")).buildClient(); - // BEGIN:tsptest.builtin.generated.builtin-op-read.builtin-op-read - Builtin response = builtinClient.read(null, null, null, "myFilter", null, null); - // END:tsptest.builtin.generated.builtin-op-read.builtin-op-read - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpWrite.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpWrite.java deleted file mode 100644 index daabacae809..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpWrite.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.builtin.generated; - -import com.azure.core.util.Configuration; -import java.time.Duration; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import tsptest.builtin.BuiltinClient; -import tsptest.builtin.BuiltinClientBuilder; -import tsptest.builtin.models.Builtin; -import tsptest.builtin.models.Encoded; - -public class BuiltinOpWrite { - public static void main(String[] args) { - BuiltinClient builtinClient - = new BuiltinClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")).buildClient(); - // BEGIN:tsptest.builtin.generated.builtin-op-write.builtin-op-write - builtinClient.write(new Builtin(true, "myString", null, 0, 32L, null, 64L, 32.0, 64.0, Duration.parse("PT15M"), - LocalDate.parse("2023-08-29"), OffsetDateTime.parse("2019-10-12T07:20:50.520Z"), - Arrays.asList("a", "b", "c"), null, "https://www.github.com", - mapOf("max", 15.0D, "min", 14.0D, "average", 14.3D), - new Encoded().setTimeInSeconds(Duration.parse("PT15M")) - .setTimeInSecondsFraction(Duration.parse("PT20M0.345S")) - .setDateTime(OffsetDateTime.parse("1966-03-03T00:06:56.52Z")) - .setDateTimeRfc7231(OffsetDateTime.parse("1994-11-06T08:49:37Z")) - .setUnixTimestamp(OffsetDateTime.parse("2023-08-30T02:35:03Z")) - .setBase64("aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==".getBytes()) - .setBase64url("aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==".getBytes()) - .setCommaDeliminatedArray(Arrays.asList("a", "b", "c")), - null)); - // END:tsptest.builtin.generated.builtin-op-write.builtin-op-write - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSend.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSend.java deleted file mode 100644 index fca52e8cf66..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSend.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.generated; - -import com.azure.core.util.Configuration; -import tsptest.flatten.FlattenClient; -import tsptest.flatten.FlattenClientBuilder; -import tsptest.flatten.models.User; - -public class FlattenOpSend { - public static void main(String[] args) { - FlattenClient flattenClient - = new FlattenClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")).buildClient(); - // BEGIN:tsptest.flatten.generated.send.flatten-op-send - flattenClient.send("myRequiredId", null, "myRequiredInput", 0, 50, new User("myOptionalUser")); - // END:tsptest.flatten.generated.send.flatten-op-send - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSendLong.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSendLong.java deleted file mode 100644 index 60132dd01f2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSendLong.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.generated; - -import com.azure.core.util.Configuration; -import tsptest.flatten.FlattenClient; -import tsptest.flatten.FlattenClientBuilder; -import tsptest.flatten.models.SendLongOptions; -import tsptest.flatten.models.SendLongRequestStatus; -import tsptest.flatten.models.User; - -public class FlattenOpSendLong { - public static void main(String[] args) { - FlattenClient flattenClient - = new FlattenClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")).buildClient(); - // BEGIN:tsptest.flatten.generated.send-long.flatten-op-send-long - flattenClient.sendLong( - new SendLongOptions("myRequiredId", "myRequiredInput", 11, null, "title", SendLongRequestStatus.NOT_STARTED) - .setFilter("name=myName") - .setUser(new User("myOptionalUser")) - .setDataIntOptional(12) - .setDataLong(13L) - .setDataFloat(14.0D) - .setDescription("description")); - // END:tsptest.flatten.generated.send-long.flatten-op-send-long - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/longrunning/generated/LongRunningCreateJob.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/longrunning/generated/LongRunningCreateJob.java deleted file mode 100644 index 83751b149b7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/longrunning/generated/LongRunningCreateJob.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.generated; - -import com.azure.core.util.Configuration; -import com.azure.core.util.polling.SyncPoller; -import java.util.HashMap; -import java.util.Map; -import tsptest.longrunning.LongRunningClient; -import tsptest.longrunning.LongRunningClientBuilder; -import tsptest.longrunning.models.JobData; -import tsptest.longrunning.models.JobResult; -import tsptest.longrunning.models.JobResultResult; - -public class LongRunningCreateJob { - public static void main(String[] args) { - LongRunningClient longRunningClient - = new LongRunningClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) - .buildClient(); - // BEGIN:tsptest.longrunning.generated.create-job.long-running-create-job - SyncPoller response = longRunningClient - .beginCreateJob(new JobData(mapOf("max", 15.0D, "min", 14.0D, "average", 14.3D)).setConfiguration("{}")); - // END:tsptest.longrunning.generated.create-job.long-running-create-job - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/model/generated/ModelOpPutNested.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/model/generated/ModelOpPutNested.java deleted file mode 100644 index 8a31ccb2712..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/model/generated/ModelOpPutNested.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.generated; - -import com.azure.core.util.Configuration; -import tsptest.model.ModelClient; -import tsptest.model.ModelClientBuilder; -import tsptest.model.models.NestedModel; - -public class ModelOpPutNested { - public static void main(String[] args) { - ModelClient modelClient - = new ModelClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")).buildClient(); - // BEGIN:tsptest.model.generated.model-op-put-nested.model-op-put-nested - NestedModel response = modelClient.putNested(null); - // END:tsptest.model.generated.model-op-put-nested.model-op-put-nested - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentType.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentType.java deleted file mode 100644 index eb614198330..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentType.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes.generated; - -import com.azure.core.util.BinaryData; -import com.azure.core.util.Configuration; -import java.nio.charset.StandardCharsets; -import tsptest.multicontenttypes.MultiContentTypesClientBuilder; -import tsptest.multicontenttypes.SingleContentTypeClient; - -public class SingleContentTypeUploadImageForSingleContentType { - public static void main(String[] args) { - SingleContentTypeClient singleContentTypeClient - = new MultiContentTypesClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) - .buildSingleContentTypeClient(); - // BEGIN:tsptest.multicontenttypes.generated.single-content-type-upload-image-for-single-content-type.single-content-type-upload-image-for-single-content-type - singleContentTypeClient.uploadImageForSingleContentType( - BinaryData.fromBytes("\"D:\\Program Files\"".getBytes(StandardCharsets.UTF_8))); - // END:tsptest.multicontenttypes.generated.single-content-type-upload-image-for-single-content-type.single-content-type-upload-image-for-single-content-type - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpExists.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpExists.java deleted file mode 100644 index 76d3e2ce7db..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpExists.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.generated; - -import com.azure.core.util.Configuration; -import tsptest.response.ResponseClient; -import tsptest.response.ResponseClientBuilder; - -public class ResponseOpExists { - public static void main(String[] args) { - ResponseClient responseClient - = new ResponseClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) - .buildClient(); - // BEGIN:tsptest.response.generated.exists.response-op-exists - boolean response = responseClient.exists(); - // END:tsptest.response.generated.exists.response-op-exists - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpListStrings.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpListStrings.java deleted file mode 100644 index 89a4560026f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpListStrings.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.generated; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Configuration; -import tsptest.response.ResponseClient; -import tsptest.response.ResponseClientBuilder; - -public class ResponseOpListStrings { - public static void main(String[] args) { - ResponseClient responseClient - = new ResponseClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) - .buildClient(); - // BEGIN:tsptest.response.generated.list-strings.response-op-list-strings - PagedIterable response = responseClient.listStrings(); - // END:tsptest.response.generated.list-strings.response-op-list-strings - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialchars/generated/BuiltinOpRead.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialchars/generated/BuiltinOpRead.java deleted file mode 100644 index 4dd26ace46b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialchars/generated/BuiltinOpRead.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialchars.generated; - -import com.azure.core.util.Configuration; -import tsptest.specialchars.SpecialCharsClient; -import tsptest.specialchars.SpecialCharsClientBuilder; -import tsptest.specialchars.models.Resource; - -public class BuiltinOpRead { - public static void main(String[] args) { - SpecialCharsClient specialCharsClient - = new SpecialCharsClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) - .buildClient(); - // BEGIN:tsptest.specialchars.generated.builtin-op-read.builtin-op-read - Resource response = specialCharsClient.read(null); - // END:tsptest.specialchars.generated.builtin-op-read.builtin-op-read - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersListWithEtag.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersListWithEtag.java deleted file mode 100644 index a5540ca7d34..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersListWithEtag.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.generated; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Configuration; -import tsptest.specialheaders.EtagHeadersClient; -import tsptest.specialheaders.SpecialHeadersClientBuilder; -import tsptest.specialheaders.models.Resource; - -public class EtagHeadersListWithEtag { - public static void main(String[] args) { - EtagHeadersClient etagHeadersClient - = new SpecialHeadersClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) - .buildEtagHeadersClient(); - // BEGIN:tsptest.specialheaders.generated.etag-headers-list-with-etag.etag-headers-list-with-etag - PagedIterable response = etagHeadersClient.listWithEtag(); - // END:tsptest.specialheaders.generated.etag-headers-list-with-etag.etag-headers-list-with-etag - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeaders.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeaders.java deleted file mode 100644 index 14c07ba70e8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeaders.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.generated; - -import com.azure.core.http.RequestConditions; -import com.azure.core.util.Configuration; -import tsptest.specialheaders.EtagHeadersClient; -import tsptest.specialheaders.SpecialHeadersClientBuilder; -import tsptest.specialheaders.models.Resource; - -public class EtagHeadersPutWithRequestHeaders { - public static void main(String[] args) { - EtagHeadersClient etagHeadersClient - = new SpecialHeadersClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) - .buildEtagHeadersClient(); - // BEGIN:tsptest.specialheaders.generated.etag-headers-put-with-request-headers.etag-headers-put-with-request-headers - Resource response = etagHeadersClient.putWithRequestHeaders("name", - new Resource().setDescription("This is sample for Etag headers").setType("myType"), - new RequestConditions().setIfMatch("\"64e005\"")); - // END:tsptest.specialheaders.generated.etag-headers-put-with-request-headers.etag-headers-put-with-request-headers - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/versioning/generated/VersioningOpList.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/versioning/generated/VersioningOpList.java deleted file mode 100644 index 85f33ac976f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/versioning/generated/VersioningOpList.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning.generated; - -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.util.Configuration; -import java.util.Arrays; -import tsptest.versioning.VersioningClient; -import tsptest.versioning.VersioningClientBuilder; -import tsptest.versioning.models.Resource; - -public class VersioningOpList { - public static void main(String[] args) { - VersioningClient versioningClient - = new VersioningClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) - .buildClient(); - // BEGIN:tsptest.versioning.generated.versioning-op-list.versioning-op-list - PagedIterable response = versioningClient.list(Arrays.asList("name=name"), null); - // END:tsptest.versioning.generated.versioning-op-list.versioning-op-list - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/apikey/generated/ApiKeyClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/apikey/generated/ApiKeyClientTestBase.java deleted file mode 100644 index def14e7d7c6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/apikey/generated/ApiKeyClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.apikey.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import authentication.apikey.ApiKeyClient; -import authentication.apikey.ApiKeyClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class ApiKeyClientTestBase extends TestProxyTestBase { - protected ApiKeyClient apiKeyClient; - - @Override - protected void beforeTest() { - ApiKeyClientBuilder apiKeyClientbuilder = new ApiKeyClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - apiKeyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - apiKeyClient = apiKeyClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/http/custom/generated/CustomClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/http/custom/generated/CustomClientTestBase.java deleted file mode 100644 index 378314a1d3c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/http/custom/generated/CustomClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.http.custom.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import authentication.http.custom.CustomClient; -import authentication.http.custom.CustomClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class CustomClientTestBase extends TestProxyTestBase { - protected CustomClient customClient; - - @Override - protected void beforeTest() { - CustomClientBuilder customClientbuilder = new CustomClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - customClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - customClient = customClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/oauth2/generated/OAuth2ClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/oauth2/generated/OAuth2ClientTestBase.java deleted file mode 100644 index 1ef211fea3a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/oauth2/generated/OAuth2ClientTestBase.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.oauth2.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import authentication.oauth2.OAuth2Client; -import authentication.oauth2.OAuth2ClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.test.utils.MockTokenCredential; -import com.azure.core.util.Configuration; -import com.azure.identity.DefaultAzureCredentialBuilder; - -class OAuth2ClientTestBase extends TestProxyTestBase { - protected OAuth2Client oAuth2Client; - - @Override - protected void beforeTest() { - OAuth2ClientBuilder oAuth2Clientbuilder = new OAuth2ClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.PLAYBACK) { - oAuth2Clientbuilder.credential(new MockTokenCredential()); - } else if (getTestMode() == TestMode.RECORD) { - oAuth2Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()) - .credential(new DefaultAzureCredentialBuilder().build()); - } else if (getTestMode() == TestMode.LIVE) { - oAuth2Clientbuilder.credential(new DefaultAzureCredentialBuilder().build()); - } - oAuth2Client = oAuth2Clientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/union/generated/UnionClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/union/generated/UnionClientTestBase.java deleted file mode 100644 index 49878353b43..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/union/generated/UnionClientTestBase.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package authentication.union.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import authentication.union.UnionClient; -import authentication.union.UnionClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.test.utils.MockTokenCredential; -import com.azure.core.util.Configuration; -import com.azure.identity.DefaultAzureCredentialBuilder; - -class UnionClientTestBase extends TestProxyTestBase { - protected UnionClient unionClient; - - @Override - protected void beforeTest() { - UnionClientBuilder unionClientbuilder = new UnionClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.PLAYBACK) { - unionClientbuilder.credential(new MockTokenCredential()); - } else if (getTestMode() == TestMode.RECORD) { - unionClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) - .credential(new DefaultAzureCredentialBuilder().build()); - } else if (getTestMode() == TestMode.LIVE) { - unionClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); - } - unionClient = unionClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/access/generated/AccessClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/access/generated/AccessClientTestBase.java deleted file mode 100644 index b76c4f1c9d4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/access/generated/AccessClientTestBase.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.access.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.access.AccessClientBuilder; -import azure.clientgenerator.core.access.InternalOperationClient; -import azure.clientgenerator.core.access.PublicOperationClient; -import azure.clientgenerator.core.access.RelativeModelInOperationClient; -import azure.clientgenerator.core.access.SharedModelInOperationClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class AccessClientTestBase extends TestProxyTestBase { - protected PublicOperationClient publicOperationClient; - - protected InternalOperationClient internalOperationClient; - - protected SharedModelInOperationClient sharedModelInOperationClient; - - protected RelativeModelInOperationClient relativeModelInOperationClient; - - @Override - protected void beforeTest() { - AccessClientBuilder publicOperationClientbuilder = new AccessClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - publicOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - publicOperationClient = publicOperationClientbuilder.buildPublicOperationClient(); - - AccessClientBuilder internalOperationClientbuilder = new AccessClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - internalOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - internalOperationClient = internalOperationClientbuilder.buildInternalOperationClient(); - - AccessClientBuilder sharedModelInOperationClientbuilder = new AccessClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - sharedModelInOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - sharedModelInOperationClient = sharedModelInOperationClientbuilder.buildSharedModelInOperationClient(); - - AccessClientBuilder relativeModelInOperationClientbuilder = new AccessClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - relativeModelInOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - relativeModelInOperationClient = relativeModelInOperationClientbuilder.buildRelativeModelInOperationClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/alternatetype/generated/AlternateTypeClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/alternatetype/generated/AlternateTypeClientTestBase.java deleted file mode 100644 index 31de5ac4b24..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/alternatetype/generated/AlternateTypeClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.alternatetype.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.alternatetype.AlternateTypeClient; -import azure.clientgenerator.core.alternatetype.AlternateTypeClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class AlternateTypeClientTestBase extends TestProxyTestBase { - protected AlternateTypeClient alternateTypeClient; - - @Override - protected void beforeTest() { - AlternateTypeClientBuilder alternateTypeClientbuilder = new AlternateTypeClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - alternateTypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - alternateTypeClient = alternateTypeClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/header/generated/HeaderClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/header/generated/HeaderClientTestBase.java deleted file mode 100644 index 474a3ae6474..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/header/generated/HeaderClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.header.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.apiversion.header.HeaderClient; -import azure.clientgenerator.core.apiversion.header.HeaderClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class HeaderClientTestBase extends TestProxyTestBase { - protected HeaderClient headerClient; - - @Override - protected void beforeTest() { - HeaderClientBuilder headerClientbuilder = new HeaderClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - headerClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - headerClient = headerClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/path/generated/PathClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/path/generated/PathClientTestBase.java deleted file mode 100644 index ac80074243c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/path/generated/PathClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.path.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.apiversion.path.PathClient; -import azure.clientgenerator.core.apiversion.path.PathClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class PathClientTestBase extends TestProxyTestBase { - protected PathClient pathClient; - - @Override - protected void beforeTest() { - PathClientBuilder pathClientbuilder = new PathClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathClient = pathClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/query/generated/QueryClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/query/generated/QueryClientTestBase.java deleted file mode 100644 index 2c87eea46ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/query/generated/QueryClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.apiversion.query.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.apiversion.query.QueryClient; -import azure.clientgenerator.core.apiversion.query.QueryClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class QueryClientTestBase extends TestProxyTestBase { - protected QueryClient queryClient; - - @Override - protected void beforeTest() { - QueryClientBuilder queryClientbuilder = new QueryClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - queryClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - queryClient = queryClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientinitialization/generated/HeaderParamClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientinitialization/generated/HeaderParamClientTestBase.java deleted file mode 100644 index 16d677e966d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientinitialization/generated/HeaderParamClientTestBase.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientinitialization.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.clientinitialization.HeaderParamClient; -import azure.clientgenerator.core.clientinitialization.HeaderParamClientBuilder; -import azure.clientgenerator.core.clientinitialization.MixedParamsClient; -import azure.clientgenerator.core.clientinitialization.MixedParamsClientBuilder; -import azure.clientgenerator.core.clientinitialization.MultipleParamsClient; -import azure.clientgenerator.core.clientinitialization.MultipleParamsClientBuilder; -import azure.clientgenerator.core.clientinitialization.ParamAliasClient; -import azure.clientgenerator.core.clientinitialization.ParamAliasClientBuilder; -import azure.clientgenerator.core.clientinitialization.PathParamClient; -import azure.clientgenerator.core.clientinitialization.PathParamClientBuilder; -import azure.clientgenerator.core.clientinitialization.parentclient.ChildClient; -import azure.clientgenerator.core.clientinitialization.parentclient.ChildClientBuilder; -import azure.clientgenerator.core.clientinitialization.parentclient.ParentClient; -import azure.clientgenerator.core.clientinitialization.parentclient.ParentClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class HeaderParamClientTestBase extends TestProxyTestBase { - protected HeaderParamClient headerParamClient; - - protected MultipleParamsClient multipleParamsClient; - - protected MixedParamsClient mixedParamsClient; - - protected PathParamClient pathParamClient; - - protected ParamAliasClient paramAliasClient; - - protected ChildClient childClient; - - protected ParentClient parentClient; - - @Override - protected void beforeTest() { - HeaderParamClientBuilder headerParamClientbuilder = new HeaderParamClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .name(Configuration.getGlobalConfiguration().get("NAME", "name")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - headerParamClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - headerParamClient = headerParamClientbuilder.buildClient(); - - MultipleParamsClientBuilder multipleParamsClientbuilder = new MultipleParamsClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .name(Configuration.getGlobalConfiguration().get("NAME", "name")) - .region(Configuration.getGlobalConfiguration().get("REGION", "region")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - multipleParamsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - multipleParamsClient = multipleParamsClientbuilder.buildClient(); - - MixedParamsClientBuilder mixedParamsClientbuilder = new MixedParamsClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .name(Configuration.getGlobalConfiguration().get("NAME", "name")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - mixedParamsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - mixedParamsClient = mixedParamsClientbuilder.buildClient(); - - PathParamClientBuilder pathParamClientbuilder = new PathParamClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .blobName(Configuration.getGlobalConfiguration().get("BLOBNAME", "blobname")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathParamClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathParamClient = pathParamClientbuilder.buildClient(); - - ParamAliasClientBuilder paramAliasClientbuilder = new ParamAliasClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .blobName(Configuration.getGlobalConfiguration().get("BLOBNAME", "blobname")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - paramAliasClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - paramAliasClient = paramAliasClientbuilder.buildClient(); - - ChildClientBuilder childClientbuilder = new ChildClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .blobName(Configuration.getGlobalConfiguration().get("BLOBNAME", "blobname")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - childClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - childClient = childClientbuilder.buildClient(); - - ParentClientBuilder parentClientbuilder = new ParentClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - parentClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - parentClient = parentClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientlocation/generated/ClientLocationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientlocation/generated/ClientLocationClientTestBase.java deleted file mode 100644 index 6886b0f18f0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientlocation/generated/ClientLocationClientTestBase.java +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.clientlocation.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.clientlocation.ArchiveOperationsClient; -import azure.clientgenerator.core.clientlocation.ClientLocationClient; -import azure.clientgenerator.core.clientlocation.ClientLocationClientBuilder; -import azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient; -import azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient; -import azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient; -import azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient; -import azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class ClientLocationClientTestBase extends TestProxyTestBase { - protected ClientLocationClient clientLocationClient; - - protected MoveToExistingSubAdminOperationsClient moveToExistingSubAdminOperationsClient; - - protected MoveToExistingSubUserOperationsClient moveToExistingSubUserOperationsClient; - - protected MoveToNewSubProductOperationsClient moveToNewSubProductOperationsClient; - - protected MoveToRootResourceOperationsClient moveToRootResourceOperationsClient; - - protected MoveMethodParameterToBlobOperationsClient moveMethodParameterToBlobOperationsClient; - - protected ArchiveOperationsClient archiveOperationsClient; - - @Override - protected void beforeTest() { - ClientLocationClientBuilder clientLocationClientbuilder = new ClientLocationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - clientLocationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - clientLocationClient = clientLocationClientbuilder.buildClient(); - - ClientLocationClientBuilder moveToExistingSubAdminOperationsClientbuilder = new ClientLocationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - moveToExistingSubAdminOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - moveToExistingSubAdminOperationsClient - = moveToExistingSubAdminOperationsClientbuilder.buildMoveToExistingSubAdminOperationsClient(); - - ClientLocationClientBuilder moveToExistingSubUserOperationsClientbuilder = new ClientLocationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - moveToExistingSubUserOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - moveToExistingSubUserOperationsClient - = moveToExistingSubUserOperationsClientbuilder.buildMoveToExistingSubUserOperationsClient(); - - ClientLocationClientBuilder moveToNewSubProductOperationsClientbuilder = new ClientLocationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - moveToNewSubProductOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - moveToNewSubProductOperationsClient - = moveToNewSubProductOperationsClientbuilder.buildMoveToNewSubProductOperationsClient(); - - ClientLocationClientBuilder moveToRootResourceOperationsClientbuilder = new ClientLocationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - moveToRootResourceOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - moveToRootResourceOperationsClient - = moveToRootResourceOperationsClientbuilder.buildMoveToRootResourceOperationsClient(); - - ClientLocationClientBuilder moveMethodParameterToBlobOperationsClientbuilder = new ClientLocationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - moveMethodParameterToBlobOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - moveMethodParameterToBlobOperationsClient - = moveMethodParameterToBlobOperationsClientbuilder.buildMoveMethodParameterToBlobOperationsClient(); - - ClientLocationClientBuilder archiveOperationsClientbuilder = new ClientLocationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - archiveOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - archiveOperationsClient = archiveOperationsClientbuilder.buildArchiveOperationsClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/deserialize/emptystringnull/generated/DeserializeEmptyStringAsNullClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/deserialize/emptystringnull/generated/DeserializeEmptyStringAsNullClientTestBase.java deleted file mode 100644 index 595296653eb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/deserialize/emptystringnull/generated/DeserializeEmptyStringAsNullClientTestBase.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.deserialize.emptystringnull.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient; -import azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class DeserializeEmptyStringAsNullClientTestBase extends TestProxyTestBase { - protected DeserializeEmptyStringAsNullClient deserializeEmptyStringAsNullClient; - - @Override - protected void beforeTest() { - DeserializeEmptyStringAsNullClientBuilder deserializeEmptyStringAsNullClientbuilder - = new DeserializeEmptyStringAsNullClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - deserializeEmptyStringAsNullClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - deserializeEmptyStringAsNullClient = deserializeEmptyStringAsNullClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/flattenproperty/generated/FlattenPropertyClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/flattenproperty/generated/FlattenPropertyClientTestBase.java deleted file mode 100644 index c8d833fc248..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/flattenproperty/generated/FlattenPropertyClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.flattenproperty.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.flattenproperty.FlattenPropertyClient; -import azure.clientgenerator.core.flattenproperty.FlattenPropertyClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class FlattenPropertyClientTestBase extends TestProxyTestBase { - protected FlattenPropertyClient flattenPropertyClient; - - @Override - protected void beforeTest() { - FlattenPropertyClientBuilder flattenPropertyClientbuilder = new FlattenPropertyClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - flattenPropertyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - flattenPropertyClient = flattenPropertyClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/hierarchybuilding/generated/HierarchyBuildingClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/hierarchybuilding/generated/HierarchyBuildingClientTestBase.java deleted file mode 100644 index 74869f676d6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/hierarchybuilding/generated/HierarchyBuildingClientTestBase.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.hierarchybuilding.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient; -import azure.clientgenerator.core.hierarchybuilding.DogOperationsClient; -import azure.clientgenerator.core.hierarchybuilding.HierarchyBuildingClientBuilder; -import azure.clientgenerator.core.hierarchybuilding.PetOperationsClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class HierarchyBuildingClientTestBase extends TestProxyTestBase { - protected AnimalOperationsClient animalOperationsClient; - - protected PetOperationsClient petOperationsClient; - - protected DogOperationsClient dogOperationsClient; - - @Override - protected void beforeTest() { - HierarchyBuildingClientBuilder animalOperationsClientbuilder = new HierarchyBuildingClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - animalOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - animalOperationsClient = animalOperationsClientbuilder.buildAnimalOperationsClient(); - - HierarchyBuildingClientBuilder petOperationsClientbuilder = new HierarchyBuildingClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - petOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - petOperationsClient = petOperationsClientbuilder.buildPetOperationsClient(); - - HierarchyBuildingClientBuilder dogOperationsClientbuilder = new HierarchyBuildingClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - dogOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - dogOperationsClient = dogOperationsClientbuilder.buildDogOperationsClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/methodoverride/generated/OverrideClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/methodoverride/generated/OverrideClientTestBase.java deleted file mode 100644 index 2ac2556e974..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/methodoverride/generated/OverrideClientTestBase.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.methodoverride.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.methodoverride.GroupParametersClient; -import azure.clientgenerator.core.methodoverride.OverrideClientBuilder; -import azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient; -import azure.clientgenerator.core.methodoverride.ReorderParametersClient; -import azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class OverrideClientTestBase extends TestProxyTestBase { - protected ReorderParametersClient reorderParametersClient; - - protected GroupParametersClient groupParametersClient; - - protected RequireOptionalParameterClient requireOptionalParameterClient; - - protected RemoveOptionalParameterClient removeOptionalParameterClient; - - @Override - protected void beforeTest() { - OverrideClientBuilder reorderParametersClientbuilder = new OverrideClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - reorderParametersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - reorderParametersClient = reorderParametersClientbuilder.buildReorderParametersClient(); - - OverrideClientBuilder groupParametersClientbuilder = new OverrideClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - groupParametersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - groupParametersClient = groupParametersClientbuilder.buildGroupParametersClient(); - - OverrideClientBuilder requireOptionalParameterClientbuilder = new OverrideClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - requireOptionalParameterClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - requireOptionalParameterClient = requireOptionalParameterClientbuilder.buildRequireOptionalParameterClient(); - - OverrideClientBuilder removeOptionalParameterClientbuilder = new OverrideClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - removeOptionalParameterClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - removeOptionalParameterClient = removeOptionalParameterClientbuilder.buildRemoveOptionalParameterClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/nextlinkverb/generated/NextLinkVerbClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/nextlinkverb/generated/NextLinkVerbClientTestBase.java deleted file mode 100644 index a32b4984cd7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/nextlinkverb/generated/NextLinkVerbClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.nextlinkverb.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.nextlinkverb.NextLinkVerbClient; -import azure.clientgenerator.core.nextlinkverb.NextLinkVerbClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class NextLinkVerbClientTestBase extends TestProxyTestBase { - protected NextLinkVerbClient nextLinkVerbClient; - - @Override - protected void beforeTest() { - NextLinkVerbClientBuilder nextLinkVerbClientbuilder = new NextLinkVerbClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - nextLinkVerbClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - nextLinkVerbClient = nextLinkVerbClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/usage/generated/UsageClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/usage/generated/UsageClientTestBase.java deleted file mode 100644 index b2185ab0cb5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/usage/generated/UsageClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.clientgenerator.core.usage.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.clientgenerator.core.usage.UsageClient; -import azure.clientgenerator.core.usage.UsageClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class UsageClientTestBase extends TestProxyTestBase { - protected UsageClient usageClient; - - @Override - protected void beforeTest() { - UsageClientBuilder usageClientbuilder = new UsageClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - usageClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - usageClient = usageClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/basic/generated/BasicClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/basic/generated/BasicClientTestBase.java deleted file mode 100644 index 6c3873f4ca3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/basic/generated/BasicClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.basic.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.core.basic.BasicClient; -import azure.core.basic.BasicClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class BasicClientTestBase extends TestProxyTestBase { - protected BasicClient basicClient; - - @Override - protected void beforeTest() { - BasicClientBuilder basicClientbuilder = new BasicClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - basicClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - basicClient = basicClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/rpc/generated/RpcClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/rpc/generated/RpcClientTestBase.java deleted file mode 100644 index 5aee892ce5a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/rpc/generated/RpcClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.rpc.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.core.lro.rpc.RpcClient; -import azure.core.lro.rpc.RpcClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class RpcClientTestBase extends TestProxyTestBase { - protected RpcClient rpcClient; - - @Override - protected void beforeTest() { - RpcClientBuilder rpcClientbuilder = new RpcClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - rpcClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - rpcClient = rpcClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/standard/generated/StandardClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/standard/generated/StandardClientTestBase.java deleted file mode 100644 index 4e1942d4967..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/standard/generated/StandardClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.lro.standard.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.core.lro.standard.StandardClient; -import azure.core.lro.standard.StandardClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class StandardClientTestBase extends TestProxyTestBase { - protected StandardClient standardClient; - - @Override - protected void beforeTest() { - StandardClientBuilder standardClientbuilder = new StandardClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - standardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - standardClient = standardClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/model/generated/ModelClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/model/generated/ModelClientTestBase.java deleted file mode 100644 index ad31efa5c9d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/model/generated/ModelClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.model.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.core.model.ModelClient; -import azure.core.model.ModelClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class ModelClientTestBase extends TestProxyTestBase { - protected ModelClient modelClient; - - @Override - protected void beforeTest() { - ModelClientBuilder modelClientbuilder = new ModelClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - modelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - modelClient = modelClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/page/generated/PageClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/page/generated/PageClientTestBase.java deleted file mode 100644 index c9b74851b8b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/page/generated/PageClientTestBase.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.page.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.core.page.PageClient; -import azure.core.page.PageClientBuilder; -import azure.core.page.TwoModelsAsPageItemClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class PageClientTestBase extends TestProxyTestBase { - protected PageClient pageClient; - - protected TwoModelsAsPageItemClient twoModelsAsPageItemClient; - - @Override - protected void beforeTest() { - PageClientBuilder pageClientbuilder = new PageClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pageClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pageClient = pageClientbuilder.buildClient(); - - PageClientBuilder twoModelsAsPageItemClientbuilder = new PageClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - twoModelsAsPageItemClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - twoModelsAsPageItemClient = twoModelsAsPageItemClientbuilder.buildTwoModelsAsPageItemClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/scalar/generated/ScalarClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/scalar/generated/ScalarClientTestBase.java deleted file mode 100644 index 36cf0c939ca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/scalar/generated/ScalarClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.scalar.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.core.scalar.ScalarClient; -import azure.core.scalar.ScalarClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class ScalarClientTestBase extends TestProxyTestBase { - protected ScalarClient scalarClient; - - @Override - protected void beforeTest() { - ScalarClientBuilder scalarClientbuilder = new ScalarClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - scalarClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - scalarClient = scalarClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/traits/generated/TraitsClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/traits/generated/TraitsClientTestBase.java deleted file mode 100644 index c92e418b805..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/traits/generated/TraitsClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.core.traits.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.core.traits.TraitsClient; -import azure.core.traits.TraitsClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class TraitsClientTestBase extends TestProxyTestBase { - protected TraitsClient traitsClient; - - @Override - protected void beforeTest() { - TraitsClientBuilder traitsClientbuilder = new TraitsClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - traitsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - traitsClient = traitsClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/encode/duration/generated/DurationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/encode/duration/generated/DurationClientTestBase.java deleted file mode 100644 index 80f6bcc786b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/encode/duration/generated/DurationClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.encode.duration.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.encode.duration.DurationClient; -import azure.encode.duration.DurationClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class DurationClientTestBase extends TestProxyTestBase { - protected DurationClient durationClient; - - @Override - protected void beforeTest() { - DurationClientBuilder durationClientbuilder = new DurationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - durationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - durationClient = durationClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/AzureExampleClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/AzureExampleClientTestBase.java deleted file mode 100644 index 2362cab6525..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/AzureExampleClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.example.basic.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.example.basic.AzureExampleClient; -import azure.example.basic.AzureExampleClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class AzureExampleClientTestBase extends TestProxyTestBase { - protected AzureExampleClient azureExampleClient; - - @Override - protected void beforeTest() { - AzureExampleClientBuilder azureExampleClientbuilder = new AzureExampleClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - azureExampleClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - azureExampleClient = azureExampleClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/BasicActionTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/BasicActionTests.java deleted file mode 100644 index 326af4d4f2c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/BasicActionTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.example.basic.generated; - -import azure.example.basic.models.ActionRequest; -import azure.example.basic.models.ActionResponse; -import azure.example.basic.models.Enum; -import azure.example.basic.models.Model; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -@Disabled -public final class BasicActionTests extends AzureExampleClientTestBase { - @Test - @Disabled - public void testBasicActionTests() { - // method invocation - ActionResponse response = azureExampleClient.basicAction("query", "header", - new ActionRequest("text") - .setModelProperty( - new Model().setInt32Property(1).setFloat32Property(1.5D).setEnumProperty(Enum.ENUM_VALUE1)) - .setArrayProperty(Arrays.asList("item")) - .setRecordProperty(mapOf("record", "value"))); - - // response assertion - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/payload/pageable/generated/PageableClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/payload/pageable/generated/PageableClientTestBase.java deleted file mode 100644 index b9e8543f58d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/payload/pageable/generated/PageableClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.payload.pageable.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.payload.pageable.PageableClient; -import azure.payload.pageable.PageableClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class PageableClientTestBase extends TestProxyTestBase { - protected PageableClient pageableClient; - - @Override - protected void beforeTest() { - PageableClientBuilder pageableClientbuilder = new PageableClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pageableClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pageableClient = pageableClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationDisplayTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationDisplayTests.java deleted file mode 100644 index 99c7e1b597a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationDisplayTests.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.generated; - -import azure.resourcemanager.methodsubscriptionid.models.OperationDisplay; -import com.azure.core.util.BinaryData; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = BinaryData - .fromString( - "{\"provider\":\"cs\",\"resource\":\"s\",\"operation\":\"nyejhkryhtnap\",\"description\":\"wlokjyem\"}") - .toObject(OperationDisplay.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationInnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationInnerTests.java deleted file mode 100644 index 23ddd14bc29..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationInnerTests.java +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.generated; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; -import com.azure.core.util.BinaryData; - -public final class OperationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationInner model = BinaryData.fromString( - "{\"name\":\"hiv\",\"isDataAction\":false,\"display\":{\"provider\":\"b\",\"resource\":\"rkxvdum\",\"operation\":\"rtfw\",\"description\":\"k\"},\"origin\":\"user\",\"actionType\":\"Internal\"}") - .toObject(OperationInner.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationListResultTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationListResultTests.java deleted file mode 100644 index e2d715ecdea..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationListResultTests.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.generated; - -import azure.resourcemanager.methodsubscriptionid.implementation.models.OperationListResult; -import com.azure.core.util.BinaryData; -import org.junit.jupiter.api.Assertions; - -public final class OperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResult model = BinaryData.fromString( - "{\"value\":[{\"name\":\"dtmlxhekuksjt\",\"isDataAction\":false,\"display\":{\"provider\":\"mparcryuanzw\",\"resource\":\"zdxtayrlhmwhf\",\"operation\":\"rqobmtuk\",\"description\":\"ryrtihfxtijbpzv\"},\"origin\":\"user\",\"actionType\":\"Internal\"},{\"name\":\"mglzufcy\",\"isDataAction\":true,\"display\":{\"provider\":\"bihanuf\",\"resource\":\"cbjy\",\"operation\":\"git\",\"description\":\"qhabifpikxwcz\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"q\"}") - .toObject(OperationListResult.class); - Assertions.assertEquals("q", model.nextLink()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourceInnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourceInnerTests.java deleted file mode 100644 index 6a6d3399dfa..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourceInnerTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.generated; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner; -import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties; -import com.azure.core.util.BinaryData; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ResourceGroupResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceGroupResourceInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Failed\",\"resourceGroupSetting\":\"wmrvktsizntocipa\"},\"location\":\"ajpsquc\",\"tags\":{\"kfo\":\"yf\"},\"id\":\"knygjofjddeq\",\"name\":\"rd\",\"type\":\"upewnwreitjzy\"}") - .toObject(ResourceGroupResourceInner.class); - Assertions.assertEquals("ajpsquc", model.location()); - Assertions.assertEquals("yf", model.tags().get("kfo")); - Assertions.assertEquals("wmrvktsizntocipa", model.properties().resourceGroupSetting()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceGroupResourceInner model = new ResourceGroupResourceInner().withLocation("ajpsquc") - .withTags(mapOf("kfo", "yf")) - .withProperties(new ResourceGroupResourceProperties().withResourceGroupSetting("wmrvktsizntocipa")); - model = BinaryData.fromObject(model).toObject(ResourceGroupResourceInner.class); - Assertions.assertEquals("ajpsquc", model.location()); - Assertions.assertEquals("yf", model.tags().get("kfo")); - Assertions.assertEquals("wmrvktsizntocipa", model.properties().resourceGroupSetting()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourcePropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourcePropertiesTests.java deleted file mode 100644 index efbb282e688..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourcePropertiesTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.generated; - -import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties; -import com.azure.core.util.BinaryData; -import org.junit.jupiter.api.Assertions; - -public final class ResourceGroupResourcePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceGroupResourceProperties model - = BinaryData.fromString("{\"provisioningState\":\"Canceled\",\"resourceGroupSetting\":\"arhmofcqhsmy\"}") - .toObject(ResourceGroupResourceProperties.class); - Assertions.assertEquals("arhmofcqhsmy", model.resourceGroupSetting()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceGroupResourceProperties model - = new ResourceGroupResourceProperties().withResourceGroupSetting("arhmofcqhsmy"); - model = BinaryData.fromObject(model).toObject(ResourceGroupResourceProperties.class); - Assertions.assertEquals("arhmofcqhsmy", model.resourceGroupSetting()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1InnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1InnerTests.java deleted file mode 100644 index bac821c19a7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1InnerTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.generated; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties; -import com.azure.core.util.BinaryData; -import org.junit.jupiter.api.Assertions; - -public final class SubscriptionResource1InnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubscriptionResource1Inner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"description\":\"uv\"},\"id\":\"xpyb\",\"name\":\"zm\",\"type\":\"hmtzopbsphrup\"}") - .toObject(SubscriptionResource1Inner.class); - Assertions.assertEquals("uv", model.properties().description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubscriptionResource1Inner model = new SubscriptionResource1Inner() - .withProperties(new SubscriptionResource1Properties().withDescription("uv")); - model = BinaryData.fromObject(model).toObject(SubscriptionResource1Inner.class); - Assertions.assertEquals("uv", model.properties().description()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1PropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1PropertiesTests.java deleted file mode 100644 index 83f6907b751..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1PropertiesTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.generated; - -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties; -import com.azure.core.util.BinaryData; -import org.junit.jupiter.api.Assertions; - -public final class SubscriptionResource1PropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubscriptionResource1Properties model - = BinaryData.fromString("{\"provisioningState\":\"Canceled\",\"description\":\"ybbejhph\"}") - .toObject(SubscriptionResource1Properties.class); - Assertions.assertEquals("ybbejhph", model.description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubscriptionResource1Properties model = new SubscriptionResource1Properties().withDescription("ybbejhph"); - model = BinaryData.fromObject(model).toObject(SubscriptionResource1Properties.class); - Assertions.assertEquals("ybbejhph", model.description()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2InnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2InnerTests.java deleted file mode 100644 index 3265f3db8ff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2InnerTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.generated; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties; -import com.azure.core.util.BinaryData; -import org.junit.jupiter.api.Assertions; - -public final class SubscriptionResource2InnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubscriptionResource2Inner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Canceled\",\"configValue\":\"xaobhdxbmtqioqjz\"},\"id\":\"tbmufpo\",\"name\":\"noi\",\"type\":\"hwlrx\"}") - .toObject(SubscriptionResource2Inner.class); - Assertions.assertEquals("xaobhdxbmtqioqjz", model.properties().configValue()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubscriptionResource2Inner model = new SubscriptionResource2Inner() - .withProperties(new SubscriptionResource2Properties().withConfigValue("xaobhdxbmtqioqjz")); - model = BinaryData.fromObject(model).toObject(SubscriptionResource2Inner.class); - Assertions.assertEquals("xaobhdxbmtqioqjz", model.properties().configValue()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2PropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2PropertiesTests.java deleted file mode 100644 index 9c807099f3d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2PropertiesTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.generated; - -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties; -import com.azure.core.util.BinaryData; -import org.junit.jupiter.api.Assertions; - -public final class SubscriptionResource2PropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubscriptionResource2Properties model - = BinaryData.fromString("{\"provisioningState\":\"Succeeded\",\"configValue\":\"oqijgkdmbpaz\"}") - .toObject(SubscriptionResource2Properties.class); - Assertions.assertEquals("oqijgkdmbpaz", model.configValue()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubscriptionResource2Properties model = new SubscriptionResource2Properties().withConfigValue("oqijgkdmbpaz"); - model = BinaryData.fromObject(model).toObject(SubscriptionResource2Properties.class); - Assertions.assertEquals("oqijgkdmbpaz", model.configValue()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourceInnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourceInnerTests.java deleted file mode 100644 index 1954d0bb03c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourceInnerTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.generated; - -import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties; -import com.azure.core.util.BinaryData; -import org.junit.jupiter.api.Assertions; - -public final class SubscriptionResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubscriptionResourceInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Canceled\",\"subscriptionSetting\":\"fp\"},\"id\":\"nrbtcqqjnq\",\"name\":\"lhqgnufooojy\",\"type\":\"ifsqesaagdfmg\"}") - .toObject(SubscriptionResourceInner.class); - Assertions.assertEquals("fp", model.properties().subscriptionSetting()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubscriptionResourceInner model = new SubscriptionResourceInner() - .withProperties(new SubscriptionResourceProperties().withSubscriptionSetting("fp")); - model = BinaryData.fromObject(model).toObject(SubscriptionResourceInner.class); - Assertions.assertEquals("fp", model.properties().subscriptionSetting()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourcePropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourcePropertiesTests.java deleted file mode 100644 index 950637c8525..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourcePropertiesTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.methodsubscriptionid.generated; - -import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties; -import com.azure.core.util.BinaryData; -import org.junit.jupiter.api.Assertions; - -public final class SubscriptionResourcePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubscriptionResourceProperties model - = BinaryData.fromString("{\"provisioningState\":\"Canceled\",\"subscriptionSetting\":\"j\"}") - .toObject(SubscriptionResourceProperties.class); - Assertions.assertEquals("j", model.subscriptionSetting()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubscriptionResourceProperties model = new SubscriptionResourceProperties().withSubscriptionSetting("j"); - model = BinaryData.fromObject(model).toObject(SubscriptionResourceProperties.class); - Assertions.assertEquals("j", model.subscriptionSetting()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskInnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskInnerTests.java deleted file mode 100644 index 531354b48f7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskInnerTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.generated; - -import azure.resourcemanager.multiservice.combined.fluent.models.DiskInner; -import azure.resourcemanager.multiservice.combined.models.DiskProperties; -import com.azure.core.util.BinaryData; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DiskInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DiskInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"zhwlrxy\",\"tags\":{\"obcu\":\"oqijgkdmbpaz\",\"qgn\":\"pdznrbtcqqjnqgl\"},\"id\":\"foooj\",\"name\":\"wifsq\",\"type\":\"saagdf\"}") - .toObject(DiskInner.class); - Assertions.assertEquals("zhwlrxy", model.location()); - Assertions.assertEquals("oqijgkdmbpaz", model.tags().get("obcu")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DiskInner model = new DiskInner().withLocation("zhwlrxy") - .withTags(mapOf("obcu", "oqijgkdmbpaz", "qgn", "pdznrbtcqqjnqgl")) - .withProperties(new DiskProperties()); - model = BinaryData.fromObject(model).toObject(DiskInner.class); - Assertions.assertEquals("zhwlrxy", model.location()); - Assertions.assertEquals("oqijgkdmbpaz", model.tags().get("obcu")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskPropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskPropertiesTests.java deleted file mode 100644 index 1afcf64161c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskPropertiesTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.generated; - -import azure.resourcemanager.multiservice.combined.models.DiskProperties; -import com.azure.core.util.BinaryData; - -public final class DiskPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DiskProperties model - = BinaryData.fromString("{\"provisioningState\":\"Failed\"}").toObject(DiskProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DiskProperties model = new DiskProperties(); - model = BinaryData.fromObject(model).toObject(DiskProperties.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachineInnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachineInnerTests.java deleted file mode 100644 index 88ae3ff1b4a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachineInnerTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.generated; - -import azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner; -import azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties; -import com.azure.core.util.BinaryData; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class VirtualMachineInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VirtualMachineInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"uv\",\"tags\":{\"phrupidgsybbejhp\":\"pybczmehmtzopb\"},\"id\":\"oycmsxaobhdxbmt\",\"name\":\"ioq\",\"type\":\"zehtbmu\"}") - .toObject(VirtualMachineInner.class); - Assertions.assertEquals("uv", model.location()); - Assertions.assertEquals("pybczmehmtzopb", model.tags().get("phrupidgsybbejhp")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VirtualMachineInner model = new VirtualMachineInner().withLocation("uv") - .withTags(mapOf("phrupidgsybbejhp", "pybczmehmtzopb")) - .withProperties(new VirtualMachineProperties()); - model = BinaryData.fromObject(model).toObject(VirtualMachineInner.class); - Assertions.assertEquals("uv", model.location()); - Assertions.assertEquals("pybczmehmtzopb", model.tags().get("phrupidgsybbejhp")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachinePropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachinePropertiesTests.java deleted file mode 100644 index d55bd6b30a0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachinePropertiesTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.resourcemanager.multiservice.combined.generated; - -import azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties; -import com.azure.core.util.BinaryData; - -public final class VirtualMachinePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VirtualMachineProperties model - = BinaryData.fromString("{\"provisioningState\":\"Canceled\"}").toObject(VirtualMachineProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VirtualMachineProperties model = new VirtualMachineProperties(); - model = BinaryData.fromObject(model).toObject(VirtualMachineProperties.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/specialheaders/xmsclientrequestid/generated/XmsClientRequestIdClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/specialheaders/xmsclientrequestid/generated/XmsClientRequestIdClientTestBase.java deleted file mode 100644 index 00b6c8d031d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/specialheaders/xmsclientrequestid/generated/XmsClientRequestIdClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.specialheaders.xmsclientrequestid.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient; -import azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class XmsClientRequestIdClientTestBase extends TestProxyTestBase { - protected XmsClientRequestIdClient xmsClientRequestIdClient; - - @Override - protected void beforeTest() { - XmsClientRequestIdClientBuilder xmsClientRequestIdClientbuilder = new XmsClientRequestIdClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - xmsClientRequestIdClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - xmsClientRequestIdClient = xmsClientRequestIdClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/versioning/previewversion/generated/PreviewVersionClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/versioning/previewversion/generated/PreviewVersionClientTestBase.java deleted file mode 100644 index 309d44ccf15..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/versioning/previewversion/generated/PreviewVersionClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package azure.versioning.previewversion.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import azure.versioning.previewversion.PreviewVersionClient; -import azure.versioning.previewversion.PreviewVersionClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class PreviewVersionClientTestBase extends TestProxyTestBase { - protected PreviewVersionClient previewVersionClient; - - @Override - protected void beforeTest() { - PreviewVersionClientBuilder previewVersionClientbuilder = new PreviewVersionClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - previewVersionClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - previewVersionClient = previewVersionClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/clientnamespace/generated/ClientNamespaceFirstClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/clientnamespace/generated/ClientNamespaceFirstClientTestBase.java deleted file mode 100644 index b0736dc0e30..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/clientnamespace/generated/ClientNamespaceFirstClientTestBase.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.clientnamespace.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import client.clientnamespace.ClientNamespaceFirstClient; -import client.clientnamespace.ClientNamespaceFirstClientBuilder; -import client.clientnamespace.second.ClientNamespaceSecondClient; -import client.clientnamespace.second.ClientNamespaceSecondClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class ClientNamespaceFirstClientTestBase extends TestProxyTestBase { - protected ClientNamespaceFirstClient clientNamespaceFirstClient; - - protected ClientNamespaceSecondClient clientNamespaceSecondClient; - - @Override - protected void beforeTest() { - ClientNamespaceFirstClientBuilder clientNamespaceFirstClientbuilder = new ClientNamespaceFirstClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - clientNamespaceFirstClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - clientNamespaceFirstClient = clientNamespaceFirstClientbuilder.buildClient(); - - ClientNamespaceSecondClientBuilder clientNamespaceSecondClientbuilder = new ClientNamespaceSecondClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - clientNamespaceSecondClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - clientNamespaceSecondClient = clientNamespaceSecondClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/enumconflict/generated/EnumConflictClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/enumconflict/generated/EnumConflictClientTestBase.java deleted file mode 100644 index 2984e47e125..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/enumconflict/generated/EnumConflictClientTestBase.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.enumconflict.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import client.naming.enumconflict.EnumConflictClientBuilder; -import client.naming.enumconflict.FirstOperationsClient; -import client.naming.enumconflict.SecondOperationsClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class EnumConflictClientTestBase extends TestProxyTestBase { - protected FirstOperationsClient firstOperationsClient; - - protected SecondOperationsClient secondOperationsClient; - - @Override - protected void beforeTest() { - EnumConflictClientBuilder firstOperationsClientbuilder = new EnumConflictClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - firstOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - firstOperationsClient = firstOperationsClientbuilder.buildFirstOperationsClient(); - - EnumConflictClientBuilder secondOperationsClientbuilder = new EnumConflictClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - secondOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - secondOperationsClient = secondOperationsClientbuilder.buildSecondOperationsClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/generated/NamingClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/generated/NamingClientTestBase.java deleted file mode 100644 index 56ab4a928bb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/generated/NamingClientTestBase.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.naming.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import client.naming.ModelClient; -import client.naming.NamingClient; -import client.naming.NamingClientBuilder; -import client.naming.UnionEnumClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class NamingClientTestBase extends TestProxyTestBase { - protected NamingClient namingClient; - - protected ModelClient modelClient; - - protected UnionEnumClient unionEnumClient; - - @Override - protected void beforeTest() { - NamingClientBuilder namingClientbuilder = new NamingClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - namingClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - namingClient = namingClientbuilder.buildClient(); - - NamingClientBuilder modelClientbuilder = new NamingClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - modelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - modelClient = modelClientbuilder.buildModelClient(); - - NamingClientBuilder unionEnumClientbuilder = new NamingClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unionEnumClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unionEnumClient = unionEnumClientbuilder.buildUnionEnumClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/overload/generated/OverloadClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/overload/generated/OverloadClientTestBase.java deleted file mode 100644 index 8644d8fb893..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/overload/generated/OverloadClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.overload.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import client.overload.OverloadClient; -import client.overload.OverloadClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class OverloadClientTestBase extends TestProxyTestBase { - protected OverloadClient overloadClient; - - @Override - protected void beforeTest() { - OverloadClientBuilder overloadClientbuilder = new OverloadClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - overloadClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - overloadClient = overloadClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/clientoperationgroup/generated/FirstClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/clientoperationgroup/generated/FirstClientTestBase.java deleted file mode 100644 index 1ab39e9696e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/clientoperationgroup/generated/FirstClientTestBase.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.clientoperationgroup.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import client.structure.anotherclientoperationgroup.subnamespace.Group5Client; -import client.structure.anotherclientoperationgroup.subnamespace.SecondClient; -import client.structure.anotherclientoperationgroup.subnamespace.SecondClientBuilder; -import client.structure.clientoperationgroup.FirstClient; -import client.structure.clientoperationgroup.FirstClientBuilder; -import client.structure.clientoperationgroup.Group3Client; -import client.structure.clientoperationgroup.Group4Client; -import client.structure.service.models.ClientType; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class FirstClientTestBase extends TestProxyTestBase { - protected FirstClient firstClient; - - protected Group3Client group3Client; - - protected Group4Client group4Client; - - protected SecondClient secondClient; - - protected Group5Client group5Client; - - @Override - protected void beforeTest() { - FirstClientBuilder firstClientbuilder - = new FirstClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - firstClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - firstClient = firstClientbuilder.buildClient(); - - FirstClientBuilder group3Clientbuilder - = new FirstClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - group3Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - group3Client = group3Clientbuilder.buildGroup3Client(); - - FirstClientBuilder group4Clientbuilder - = new FirstClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - group4Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - group4Client = group4Clientbuilder.buildGroup4Client(); - - SecondClientBuilder secondClientbuilder - = new SecondClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - secondClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - secondClient = secondClientbuilder.buildClient(); - - SecondClientBuilder group5Clientbuilder - = new SecondClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - group5Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - group5Client = group5Clientbuilder.buildGroup5Client(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/multiclient/generated/ClientAClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/multiclient/generated/ClientAClientTestBase.java deleted file mode 100644 index 88228b9cda6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/multiclient/generated/ClientAClientTestBase.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.multiclient.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import client.structure.multiclient.ClientAClient; -import client.structure.multiclient.ClientAClientBuilder; -import client.structure.multiclient.ClientBClient; -import client.structure.multiclient.ClientBClientBuilder; -import client.structure.service.models.ClientType; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class ClientAClientTestBase extends TestProxyTestBase { - protected ClientAClient clientAClient; - - protected ClientBClient clientBClient; - - @Override - protected void beforeTest() { - ClientAClientBuilder clientAClientbuilder - = new ClientAClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - clientAClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - clientAClient = clientAClientbuilder.buildClient(); - - ClientBClientBuilder clientBClientbuilder - = new ClientBClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - clientBClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - clientBClient = clientBClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/renamedoperation/generated/RenamedOperationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/renamedoperation/generated/RenamedOperationClientTestBase.java deleted file mode 100644 index 8b56c102df1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/renamedoperation/generated/RenamedOperationClientTestBase.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.renamedoperation.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import client.structure.renamedoperation.GroupClient; -import client.structure.renamedoperation.RenamedOperationClient; -import client.structure.renamedoperation.RenamedOperationClientBuilder; -import client.structure.service.models.ClientType; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class RenamedOperationClientTestBase extends TestProxyTestBase { - protected RenamedOperationClient renamedOperationClient; - - protected GroupClient groupClient; - - @Override - protected void beforeTest() { - RenamedOperationClientBuilder renamedOperationClientbuilder = new RenamedOperationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - renamedOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - renamedOperationClient = renamedOperationClientbuilder.buildClient(); - - RenamedOperationClientBuilder groupClientbuilder = new RenamedOperationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - groupClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - groupClient = groupClientbuilder.buildGroupClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/service/generated/ServiceClientClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/service/generated/ServiceClientClientTestBase.java deleted file mode 100644 index e9a538d4cfb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/service/generated/ServiceClientClientTestBase.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.service.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import client.structure.service.BarClient; -import client.structure.service.BazFooClient; -import client.structure.service.FooClient; -import client.structure.service.QuxBarClient; -import client.structure.service.QuxClient; -import client.structure.service.ServiceClientClient; -import client.structure.service.ServiceClientClientBuilder; -import client.structure.service.models.ClientType; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class ServiceClientClientTestBase extends TestProxyTestBase { - protected ServiceClientClient serviceClientClient; - - protected BazFooClient bazFooClient; - - protected QuxClient quxClient; - - protected QuxBarClient quxBarClient; - - protected FooClient fooClient; - - protected BarClient barClient; - - @Override - protected void beforeTest() { - ServiceClientClientBuilder serviceClientClientbuilder = new ServiceClientClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - serviceClientClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - serviceClientClient = serviceClientClientbuilder.buildClient(); - - ServiceClientClientBuilder bazFooClientbuilder = new ServiceClientClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - bazFooClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - bazFooClient = bazFooClientbuilder.buildBazFooClient(); - - ServiceClientClientBuilder quxClientbuilder = new ServiceClientClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - quxClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - quxClient = quxClientbuilder.buildQuxClient(); - - ServiceClientClientBuilder quxBarClientbuilder = new ServiceClientClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - quxBarClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - quxBarClient = quxBarClientbuilder.buildQuxBarClient(); - - ServiceClientClientBuilder fooClientbuilder = new ServiceClientClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - fooClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - fooClient = fooClientbuilder.buildFooClient(); - - ServiceClientClientBuilder barClientbuilder = new ServiceClientClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - barClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - barClient = barClientbuilder.buildBarClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/twooperationgroup/generated/TwoOperationGroupClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/twooperationgroup/generated/TwoOperationGroupClientTestBase.java deleted file mode 100644 index 09816fda0a0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/twooperationgroup/generated/TwoOperationGroupClientTestBase.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package client.structure.twooperationgroup.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import client.structure.service.models.ClientType; -import client.structure.twooperationgroup.Group1Client; -import client.structure.twooperationgroup.Group2Client; -import client.structure.twooperationgroup.TwoOperationGroupClientBuilder; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; - -class TwoOperationGroupClientTestBase extends TestProxyTestBase { - protected Group1Client group1Client; - - protected Group2Client group2Client; - - @Override - protected void beforeTest() { - TwoOperationGroupClientBuilder group1Clientbuilder = new TwoOperationGroupClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - group1Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - group1Client = group1Clientbuilder.buildGroup1Client(); - - TwoOperationGroupClientBuilder group2Clientbuilder = new TwoOperationGroupClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - group2Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - group2Client = group2Clientbuilder.buildGroup2Client(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/documentation/generated/DocumentationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/documentation/generated/DocumentationClientTestBase.java deleted file mode 100644 index 21b8d2c836b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/documentation/generated/DocumentationClientTestBase.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package documentation.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import documentation.DocumentationClientBuilder; -import documentation.ListsClient; -import documentation.TextFormattingClient; - -class DocumentationClientTestBase extends TestProxyTestBase { - protected ListsClient listsClient; - - protected TextFormattingClient textFormattingClient; - - @Override - protected void beforeTest() { - DocumentationClientBuilder listsClientbuilder = new DocumentationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - listsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - listsClient = listsClientbuilder.buildListsClient(); - - DocumentationClientBuilder textFormattingClientbuilder = new DocumentationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - textFormattingClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - textFormattingClient = textFormattingClientbuilder.buildTextFormattingClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/array/generated/ArrayClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/array/generated/ArrayClientTestBase.java deleted file mode 100644 index 225f9f2497e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/array/generated/ArrayClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.array.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import encode.array.ArrayClient; -import encode.array.ArrayClientBuilder; - -class ArrayClientTestBase extends TestProxyTestBase { - protected ArrayClient arrayClient; - - @Override - protected void beforeTest() { - ArrayClientBuilder arrayClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - arrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - arrayClient = arrayClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/bytes/generated/BytesClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/bytes/generated/BytesClientTestBase.java deleted file mode 100644 index 4ddae28782f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/bytes/generated/BytesClientTestBase.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.bytes.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import encode.bytes.BytesClientBuilder; -import encode.bytes.HeaderClient; -import encode.bytes.PropertyClient; -import encode.bytes.QueryClient; -import encode.bytes.RequestBodyClient; -import encode.bytes.ResponseBodyClient; - -class BytesClientTestBase extends TestProxyTestBase { - protected QueryClient queryClient; - - protected PropertyClient propertyClient; - - protected HeaderClient headerClient; - - protected RequestBodyClient requestBodyClient; - - protected ResponseBodyClient responseBodyClient; - - @Override - protected void beforeTest() { - BytesClientBuilder queryClientbuilder = new BytesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - queryClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - queryClient = queryClientbuilder.buildQueryClient(); - - BytesClientBuilder propertyClientbuilder = new BytesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - propertyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - propertyClient = propertyClientbuilder.buildPropertyClient(); - - BytesClientBuilder headerClientbuilder = new BytesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - headerClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - headerClient = headerClientbuilder.buildHeaderClient(); - - BytesClientBuilder requestBodyClientbuilder = new BytesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - requestBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - requestBodyClient = requestBodyClientbuilder.buildRequestBodyClient(); - - BytesClientBuilder responseBodyClientbuilder = new BytesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - responseBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - responseBodyClient = responseBodyClientbuilder.buildResponseBodyClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/datetime/generated/DatetimeClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/datetime/generated/DatetimeClientTestBase.java deleted file mode 100644 index 40860cec643..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/datetime/generated/DatetimeClientTestBase.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.datetime.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import encode.datetime.DatetimeClientBuilder; -import encode.datetime.HeaderClient; -import encode.datetime.PropertyClient; -import encode.datetime.QueryClient; -import encode.datetime.ResponseHeaderClient; - -class DatetimeClientTestBase extends TestProxyTestBase { - protected QueryClient queryClient; - - protected PropertyClient propertyClient; - - protected HeaderClient headerClient; - - protected ResponseHeaderClient responseHeaderClient; - - @Override - protected void beforeTest() { - DatetimeClientBuilder queryClientbuilder = new DatetimeClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - queryClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - queryClient = queryClientbuilder.buildQueryClient(); - - DatetimeClientBuilder propertyClientbuilder = new DatetimeClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - propertyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - propertyClient = propertyClientbuilder.buildPropertyClient(); - - DatetimeClientBuilder headerClientbuilder = new DatetimeClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - headerClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - headerClient = headerClientbuilder.buildHeaderClient(); - - DatetimeClientBuilder responseHeaderClientbuilder = new DatetimeClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - responseHeaderClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - responseHeaderClient = responseHeaderClientbuilder.buildResponseHeaderClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/duration/generated/DurationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/duration/generated/DurationClientTestBase.java deleted file mode 100644 index 950f6c711fe..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/duration/generated/DurationClientTestBase.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.duration.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import encode.duration.DurationClientBuilder; -import encode.duration.HeaderClient; -import encode.duration.PropertyClient; -import encode.duration.QueryClient; - -class DurationClientTestBase extends TestProxyTestBase { - protected QueryClient queryClient; - - protected PropertyClient propertyClient; - - protected HeaderClient headerClient; - - @Override - protected void beforeTest() { - DurationClientBuilder queryClientbuilder = new DurationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - queryClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - queryClient = queryClientbuilder.buildQueryClient(); - - DurationClientBuilder propertyClientbuilder = new DurationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - propertyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - propertyClient = propertyClientbuilder.buildPropertyClient(); - - DurationClientBuilder headerClientbuilder = new DurationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - headerClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - headerClient = headerClientbuilder.buildHeaderClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/numeric/generated/NumericClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/numeric/generated/NumericClientTestBase.java deleted file mode 100644 index ac27b6b84b8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/numeric/generated/NumericClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package encode.numeric.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import encode.numeric.NumericClient; -import encode.numeric.NumericClientBuilder; - -class NumericClientTestBase extends TestProxyTestBase { - protected NumericClient numericClient; - - @Override - protected void beforeTest() { - NumericClientBuilder numericClientbuilder = new NumericClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - numericClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - numericClient = numericClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/basic/generated/BasicClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/basic/generated/BasicClientTestBase.java deleted file mode 100644 index aea2c3bdd81..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/basic/generated/BasicClientTestBase.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.basic.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import parameters.basic.BasicClientBuilder; -import parameters.basic.ExplicitBodyClient; -import parameters.basic.ImplicitBodyClient; - -class BasicClientTestBase extends TestProxyTestBase { - protected ExplicitBodyClient explicitBodyClient; - - protected ImplicitBodyClient implicitBodyClient; - - @Override - protected void beforeTest() { - BasicClientBuilder explicitBodyClientbuilder = new BasicClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - explicitBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - explicitBodyClient = explicitBodyClientbuilder.buildExplicitBodyClient(); - - BasicClientBuilder implicitBodyClientbuilder = new BasicClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - implicitBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - implicitBodyClient = implicitBodyClientbuilder.buildImplicitBodyClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/bodyoptionality/generated/BodyOptionalityClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/bodyoptionality/generated/BodyOptionalityClientTestBase.java deleted file mode 100644 index 04872666ca2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/bodyoptionality/generated/BodyOptionalityClientTestBase.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.bodyoptionality.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import parameters.bodyoptionality.BodyOptionalityClient; -import parameters.bodyoptionality.BodyOptionalityClientBuilder; -import parameters.bodyoptionality.OptionalExplicitClient; - -class BodyOptionalityClientTestBase extends TestProxyTestBase { - protected BodyOptionalityClient bodyOptionalityClient; - - protected OptionalExplicitClient optionalExplicitClient; - - @Override - protected void beforeTest() { - BodyOptionalityClientBuilder bodyOptionalityClientbuilder = new BodyOptionalityClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - bodyOptionalityClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - bodyOptionalityClient = bodyOptionalityClientbuilder.buildClient(); - - BodyOptionalityClientBuilder optionalExplicitClientbuilder = new BodyOptionalityClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - optionalExplicitClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - optionalExplicitClient = optionalExplicitClientbuilder.buildOptionalExplicitClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/collectionformat/generated/CollectionFormatClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/collectionformat/generated/CollectionFormatClientTestBase.java deleted file mode 100644 index dd9b716e132..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/collectionformat/generated/CollectionFormatClientTestBase.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.collectionformat.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import parameters.collectionformat.CollectionFormatClientBuilder; -import parameters.collectionformat.HeaderClient; -import parameters.collectionformat.QueryClient; - -class CollectionFormatClientTestBase extends TestProxyTestBase { - protected QueryClient queryClient; - - protected HeaderClient headerClient; - - @Override - protected void beforeTest() { - CollectionFormatClientBuilder queryClientbuilder = new CollectionFormatClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - queryClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - queryClient = queryClientbuilder.buildQueryClient(); - - CollectionFormatClientBuilder headerClientbuilder = new CollectionFormatClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - headerClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - headerClient = headerClientbuilder.buildHeaderClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/path/generated/PathClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/path/generated/PathClientTestBase.java deleted file mode 100644 index 573d1415554..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/path/generated/PathClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.path.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import parameters.path.PathClient; -import parameters.path.PathClientBuilder; - -class PathClientTestBase extends TestProxyTestBase { - protected PathClient pathClient; - - @Override - protected void beforeTest() { - PathClientBuilder pathClientbuilder = new PathClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathClient = pathClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/spread/generated/SpreadClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/spread/generated/SpreadClientTestBase.java deleted file mode 100644 index 22c3cd60266..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/spread/generated/SpreadClientTestBase.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package parameters.spread.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import parameters.spread.AliasClient; -import parameters.spread.ModelClient; -import parameters.spread.SpreadClientBuilder; - -class SpreadClientTestBase extends TestProxyTestBase { - protected ModelClient modelClient; - - protected AliasClient aliasClient; - - @Override - protected void beforeTest() { - SpreadClientBuilder modelClientbuilder = new SpreadClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - modelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - modelClient = modelClientbuilder.buildModelClient(); - - SpreadClientBuilder aliasClientbuilder = new SpreadClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - aliasClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - aliasClient = aliasClientbuilder.buildAliasClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/contentnegotiation/generated/ContentNegotiationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/contentnegotiation/generated/ContentNegotiationClientTestBase.java deleted file mode 100644 index bdb898a4ad6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/contentnegotiation/generated/ContentNegotiationClientTestBase.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.contentnegotiation.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import payload.contentnegotiation.ContentNegotiationClientBuilder; -import payload.contentnegotiation.DifferentBodyClient; -import payload.contentnegotiation.SameBodyClient; - -class ContentNegotiationClientTestBase extends TestProxyTestBase { - protected SameBodyClient sameBodyClient; - - protected DifferentBodyClient differentBodyClient; - - @Override - protected void beforeTest() { - ContentNegotiationClientBuilder sameBodyClientbuilder = new ContentNegotiationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - sameBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - sameBodyClient = sameBodyClientbuilder.buildSameBodyClient(); - - ContentNegotiationClientBuilder differentBodyClientbuilder = new ContentNegotiationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - differentBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - differentBodyClient = differentBodyClientbuilder.buildDifferentBodyClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/jsonmergepatch/generated/JsonMergePatchClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/jsonmergepatch/generated/JsonMergePatchClientTestBase.java deleted file mode 100644 index 3becae65f1e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/jsonmergepatch/generated/JsonMergePatchClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.jsonmergepatch.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import payload.jsonmergepatch.JsonMergePatchClient; -import payload.jsonmergepatch.JsonMergePatchClientBuilder; - -class JsonMergePatchClientTestBase extends TestProxyTestBase { - protected JsonMergePatchClient jsonMergePatchClient; - - @Override - protected void beforeTest() { - JsonMergePatchClientBuilder jsonMergePatchClientbuilder = new JsonMergePatchClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - jsonMergePatchClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - jsonMergePatchClient = jsonMergePatchClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/mediatype/generated/MediaTypeClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/mediatype/generated/MediaTypeClientTestBase.java deleted file mode 100644 index 58a24aadb71..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/mediatype/generated/MediaTypeClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.mediatype.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import payload.mediatype.MediaTypeClient; -import payload.mediatype.MediaTypeClientBuilder; - -class MediaTypeClientTestBase extends TestProxyTestBase { - protected MediaTypeClient mediaTypeClient; - - @Override - protected void beforeTest() { - MediaTypeClientBuilder mediaTypeClientbuilder = new MediaTypeClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - mediaTypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - mediaTypeClient = mediaTypeClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/multipart/generated/MultiPartClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/multipart/generated/MultiPartClientTestBase.java deleted file mode 100644 index 24d5eeb281f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/multipart/generated/MultiPartClientTestBase.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package payload.multipart.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import payload.multipart.FormDataClient; -import payload.multipart.FormDataHttpPartsClient; -import payload.multipart.FormDataHttpPartsContentTypeClient; -import payload.multipart.FormDataHttpPartsNonStringClient; -import payload.multipart.MultiPartClientBuilder; - -class MultiPartClientTestBase extends TestProxyTestBase { - protected FormDataClient formDataClient; - - protected FormDataHttpPartsClient formDataHttpPartsClient; - - protected FormDataHttpPartsContentTypeClient formDataHttpPartsContentTypeClient; - - protected FormDataHttpPartsNonStringClient formDataHttpPartsNonStringClient; - - @Override - protected void beforeTest() { - MultiPartClientBuilder formDataClientbuilder = new MultiPartClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - formDataClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - formDataClient = formDataClientbuilder.buildFormDataClient(); - - MultiPartClientBuilder formDataHttpPartsClientbuilder = new MultiPartClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - formDataHttpPartsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - formDataHttpPartsClient = formDataHttpPartsClientbuilder.buildFormDataHttpPartsClient(); - - MultiPartClientBuilder formDataHttpPartsContentTypeClientbuilder = new MultiPartClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - formDataHttpPartsContentTypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - formDataHttpPartsContentTypeClient - = formDataHttpPartsContentTypeClientbuilder.buildFormDataHttpPartsContentTypeClient(); - - MultiPartClientBuilder formDataHttpPartsNonStringClientbuilder = new MultiPartClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - formDataHttpPartsNonStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - formDataHttpPartsNonStringClient - = formDataHttpPartsNonStringClientbuilder.buildFormDataHttpPartsNonStringClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/generated/ResiliencyServiceDrivenClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/generated/ResiliencyServiceDrivenClientTestBase.java deleted file mode 100644 index 0eb4edcba82..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/generated/ResiliencyServiceDrivenClientTestBase.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package resiliency.servicedriven.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import resiliency.servicedriven.ResiliencyServiceDrivenClient; -import resiliency.servicedriven.ResiliencyServiceDrivenClientBuilder; - -class ResiliencyServiceDrivenClientTestBase extends TestProxyTestBase { - protected ResiliencyServiceDrivenClient resiliencyServiceDrivenClient; - - @Override - protected void beforeTest() { - ResiliencyServiceDrivenClientBuilder resiliencyServiceDrivenClientbuilder - = new ResiliencyServiceDrivenClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .serviceDeploymentVersion( - Configuration.getGlobalConfiguration().get("SERVICEDEPLOYMENTVERSION", "servicedeploymentversion")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - resiliencyServiceDrivenClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - resiliencyServiceDrivenClient = resiliencyServiceDrivenClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/v1/generated/ResiliencyServiceDrivenClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/v1/generated/ResiliencyServiceDrivenClientTestBase.java deleted file mode 100644 index afac6adc8c9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/v1/generated/ResiliencyServiceDrivenClientTestBase.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package resiliency.servicedriven.v1.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import resiliency.servicedriven.v1.ResiliencyServiceDrivenClient; -import resiliency.servicedriven.v1.ResiliencyServiceDrivenClientBuilder; - -class ResiliencyServiceDrivenClientTestBase extends TestProxyTestBase { - protected ResiliencyServiceDrivenClient resiliencyServiceDrivenClient; - - @Override - protected void beforeTest() { - ResiliencyServiceDrivenClientBuilder resiliencyServiceDrivenClientbuilder - = new ResiliencyServiceDrivenClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .serviceDeploymentVersion( - Configuration.getGlobalConfiguration().get("SERVICEDEPLOYMENTVERSION", "servicedeploymentversion")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - resiliencyServiceDrivenClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - resiliencyServiceDrivenClient = resiliencyServiceDrivenClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/response/statuscoderange/generated/StatusCodeRangeClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/response/statuscoderange/generated/StatusCodeRangeClientTestBase.java deleted file mode 100644 index 68df0911d9d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/response/statuscoderange/generated/StatusCodeRangeClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package response.statuscoderange.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import response.statuscoderange.StatusCodeRangeClient; -import response.statuscoderange.StatusCodeRangeClientBuilder; - -class StatusCodeRangeClientTestBase extends TestProxyTestBase { - protected StatusCodeRangeClient statusCodeRangeClient; - - @Override - protected void beforeTest() { - StatusCodeRangeClientBuilder statusCodeRangeClientbuilder = new StatusCodeRangeClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - statusCodeRangeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - statusCodeRangeClient = statusCodeRangeClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/routes/generated/RoutesClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/routes/generated/RoutesClientTestBase.java deleted file mode 100644 index 0160bfaa21f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/routes/generated/RoutesClientTestBase.java +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package routes.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import routes.InInterfaceClient; -import routes.PathParametersClient; -import routes.PathParametersLabelExpansionExplodeClient; -import routes.PathParametersLabelExpansionStandardClient; -import routes.PathParametersMatrixExpansionExplodeClient; -import routes.PathParametersMatrixExpansionStandardClient; -import routes.PathParametersPathExpansionExplodeClient; -import routes.PathParametersPathExpansionStandardClient; -import routes.PathParametersReservedExpansionClient; -import routes.PathParametersSimpleExpansionExplodeClient; -import routes.PathParametersSimpleExpansionStandardClient; -import routes.QueryParametersClient; -import routes.QueryParametersQueryContinuationExplodeClient; -import routes.QueryParametersQueryContinuationStandardClient; -import routes.QueryParametersQueryExpansionExplodeClient; -import routes.QueryParametersQueryExpansionStandardClient; -import routes.RoutesClient; -import routes.RoutesClientBuilder; - -class RoutesClientTestBase extends TestProxyTestBase { - protected RoutesClient routesClient; - - protected PathParametersClient pathParametersClient; - - protected PathParametersReservedExpansionClient pathParametersReservedExpansionClient; - - protected PathParametersSimpleExpansionStandardClient pathParametersSimpleExpansionStandardClient; - - protected PathParametersSimpleExpansionExplodeClient pathParametersSimpleExpansionExplodeClient; - - protected PathParametersPathExpansionStandardClient pathParametersPathExpansionStandardClient; - - protected PathParametersPathExpansionExplodeClient pathParametersPathExpansionExplodeClient; - - protected PathParametersLabelExpansionStandardClient pathParametersLabelExpansionStandardClient; - - protected PathParametersLabelExpansionExplodeClient pathParametersLabelExpansionExplodeClient; - - protected PathParametersMatrixExpansionStandardClient pathParametersMatrixExpansionStandardClient; - - protected PathParametersMatrixExpansionExplodeClient pathParametersMatrixExpansionExplodeClient; - - protected QueryParametersClient queryParametersClient; - - protected QueryParametersQueryExpansionStandardClient queryParametersQueryExpansionStandardClient; - - protected QueryParametersQueryExpansionExplodeClient queryParametersQueryExpansionExplodeClient; - - protected QueryParametersQueryContinuationStandardClient queryParametersQueryContinuationStandardClient; - - protected QueryParametersQueryContinuationExplodeClient queryParametersQueryContinuationExplodeClient; - - protected InInterfaceClient inInterfaceClient; - - @Override - protected void beforeTest() { - RoutesClientBuilder routesClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - routesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - routesClient = routesClientbuilder.buildClient(); - - RoutesClientBuilder pathParametersClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathParametersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathParametersClient = pathParametersClientbuilder.buildPathParametersClient(); - - RoutesClientBuilder pathParametersReservedExpansionClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathParametersReservedExpansionClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathParametersReservedExpansionClient - = pathParametersReservedExpansionClientbuilder.buildPathParametersReservedExpansionClient(); - - RoutesClientBuilder pathParametersSimpleExpansionStandardClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathParametersSimpleExpansionStandardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathParametersSimpleExpansionStandardClient - = pathParametersSimpleExpansionStandardClientbuilder.buildPathParametersSimpleExpansionStandardClient(); - - RoutesClientBuilder pathParametersSimpleExpansionExplodeClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathParametersSimpleExpansionExplodeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathParametersSimpleExpansionExplodeClient - = pathParametersSimpleExpansionExplodeClientbuilder.buildPathParametersSimpleExpansionExplodeClient(); - - RoutesClientBuilder pathParametersPathExpansionStandardClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathParametersPathExpansionStandardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathParametersPathExpansionStandardClient - = pathParametersPathExpansionStandardClientbuilder.buildPathParametersPathExpansionStandardClient(); - - RoutesClientBuilder pathParametersPathExpansionExplodeClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathParametersPathExpansionExplodeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathParametersPathExpansionExplodeClient - = pathParametersPathExpansionExplodeClientbuilder.buildPathParametersPathExpansionExplodeClient(); - - RoutesClientBuilder pathParametersLabelExpansionStandardClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathParametersLabelExpansionStandardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathParametersLabelExpansionStandardClient - = pathParametersLabelExpansionStandardClientbuilder.buildPathParametersLabelExpansionStandardClient(); - - RoutesClientBuilder pathParametersLabelExpansionExplodeClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathParametersLabelExpansionExplodeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathParametersLabelExpansionExplodeClient - = pathParametersLabelExpansionExplodeClientbuilder.buildPathParametersLabelExpansionExplodeClient(); - - RoutesClientBuilder pathParametersMatrixExpansionStandardClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathParametersMatrixExpansionStandardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathParametersMatrixExpansionStandardClient - = pathParametersMatrixExpansionStandardClientbuilder.buildPathParametersMatrixExpansionStandardClient(); - - RoutesClientBuilder pathParametersMatrixExpansionExplodeClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - pathParametersMatrixExpansionExplodeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - pathParametersMatrixExpansionExplodeClient - = pathParametersMatrixExpansionExplodeClientbuilder.buildPathParametersMatrixExpansionExplodeClient(); - - RoutesClientBuilder queryParametersClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - queryParametersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - queryParametersClient = queryParametersClientbuilder.buildQueryParametersClient(); - - RoutesClientBuilder queryParametersQueryExpansionStandardClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - queryParametersQueryExpansionStandardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - queryParametersQueryExpansionStandardClient - = queryParametersQueryExpansionStandardClientbuilder.buildQueryParametersQueryExpansionStandardClient(); - - RoutesClientBuilder queryParametersQueryExpansionExplodeClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - queryParametersQueryExpansionExplodeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - queryParametersQueryExpansionExplodeClient - = queryParametersQueryExpansionExplodeClientbuilder.buildQueryParametersQueryExpansionExplodeClient(); - - RoutesClientBuilder queryParametersQueryContinuationStandardClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - queryParametersQueryContinuationStandardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - queryParametersQueryContinuationStandardClient = queryParametersQueryContinuationStandardClientbuilder - .buildQueryParametersQueryContinuationStandardClient(); - - RoutesClientBuilder queryParametersQueryContinuationExplodeClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - queryParametersQueryContinuationExplodeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - queryParametersQueryContinuationExplodeClient - = queryParametersQueryContinuationExplodeClientbuilder.buildQueryParametersQueryContinuationExplodeClient(); - - RoutesClientBuilder inInterfaceClientbuilder = new RoutesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - inInterfaceClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - inInterfaceClient = inInterfaceClientbuilder.buildInInterfaceClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/serialization/encodedname/json/generated/JsonClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/serialization/encodedname/json/generated/JsonClientTestBase.java deleted file mode 100644 index 2cccc578ec8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/serialization/encodedname/json/generated/JsonClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package serialization.encodedname.json.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import serialization.encodedname.json.JsonClient; -import serialization.encodedname.json.JsonClientBuilder; - -class JsonClientTestBase extends TestProxyTestBase { - protected JsonClient jsonClient; - - @Override - protected void beforeTest() { - JsonClientBuilder jsonClientbuilder = new JsonClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - jsonClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - jsonClient = jsonClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/endpoint/notdefined/generated/NotDefinedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/endpoint/notdefined/generated/NotDefinedClientTestBase.java deleted file mode 100644 index f0f479c425e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/endpoint/notdefined/generated/NotDefinedClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.endpoint.notdefined.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import server.endpoint.notdefined.NotDefinedClient; -import server.endpoint.notdefined.NotDefinedClientBuilder; - -class NotDefinedClientTestBase extends TestProxyTestBase { - protected NotDefinedClient notDefinedClient; - - @Override - protected void beforeTest() { - NotDefinedClientBuilder notDefinedClientbuilder - = new NotDefinedClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - notDefinedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - notDefinedClient = notDefinedClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/multiple/generated/MultipleClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/multiple/generated/MultipleClientTestBase.java deleted file mode 100644 index 3fce7a29c4b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/multiple/generated/MultipleClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.path.multiple.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import server.path.multiple.MultipleClient; -import server.path.multiple.MultipleClientBuilder; - -class MultipleClientTestBase extends TestProxyTestBase { - protected MultipleClient multipleClient; - - @Override - protected void beforeTest() { - MultipleClientBuilder multipleClientbuilder - = new MultipleClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - multipleClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - multipleClient = multipleClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/single/generated/SingleClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/single/generated/SingleClientTestBase.java deleted file mode 100644 index 4dd3e8effd5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/single/generated/SingleClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.path.single.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import server.path.single.SingleClient; -import server.path.single.SingleClientBuilder; - -class SingleClientTestBase extends TestProxyTestBase { - protected SingleClient singleClient; - - @Override - protected void beforeTest() { - SingleClientBuilder singleClientbuilder - = new SingleClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - singleClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - singleClient = singleClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/notversioned/generated/NotVersionedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/notversioned/generated/NotVersionedClientTestBase.java deleted file mode 100644 index 966a2937ab5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/notversioned/generated/NotVersionedClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.versions.notversioned.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import server.versions.notversioned.NotVersionedClient; -import server.versions.notversioned.NotVersionedClientBuilder; - -class NotVersionedClientTestBase extends TestProxyTestBase { - protected NotVersionedClient notVersionedClient; - - @Override - protected void beforeTest() { - NotVersionedClientBuilder notVersionedClientbuilder = new NotVersionedClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - notVersionedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - notVersionedClient = notVersionedClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/versioned/generated/VersionedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/versioned/generated/VersionedClientTestBase.java deleted file mode 100644 index e1eb4a91434..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/versioned/generated/VersionedClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package server.versions.versioned.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import server.versions.versioned.VersionedClient; -import server.versions.versioned.VersionedClientBuilder; - -class VersionedClientTestBase extends TestProxyTestBase { - protected VersionedClient versionedClient; - - @Override - protected void beforeTest() { - VersionedClientBuilder versionedClientbuilder - = new VersionedClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - versionedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - versionedClient = versionedClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/service/multiservice/combined/generated/CombinedTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/service/multiservice/combined/generated/CombinedTestBase.java deleted file mode 100644 index 9cfd19eabb5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/service/multiservice/combined/generated/CombinedTestBase.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package service.multiservice.combined.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import service.multiservice.combined.BarClient; -import service.multiservice.combined.CombinedBuilder; -import service.multiservice.combined.FooClient; - -class CombinedTestBase extends TestProxyTestBase { - protected FooClient fooClient; - - protected BarClient barClient; - - @Override - protected void beforeTest() { - CombinedBuilder fooClientbuilder = new CombinedBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - fooClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - fooClient = fooClientbuilder.buildFooClient(); - - CombinedBuilder barClientbuilder = new CombinedBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - barClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - barClient = barClientbuilder.buildBarClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/conditionalrequest/generated/ConditionalRequestClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/conditionalrequest/generated/ConditionalRequestClientTestBase.java deleted file mode 100644 index 3435febec89..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/conditionalrequest/generated/ConditionalRequestClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialheaders.conditionalrequest.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import specialheaders.conditionalrequest.ConditionalRequestClient; -import specialheaders.conditionalrequest.ConditionalRequestClientBuilder; - -class ConditionalRequestClientTestBase extends TestProxyTestBase { - protected ConditionalRequestClient conditionalRequestClient; - - @Override - protected void beforeTest() { - ConditionalRequestClientBuilder conditionalRequestClientbuilder = new ConditionalRequestClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - conditionalRequestClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - conditionalRequestClient = conditionalRequestClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/repeatability/generated/RepeatabilityClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/repeatability/generated/RepeatabilityClientTestBase.java deleted file mode 100644 index d3d07216f40..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/repeatability/generated/RepeatabilityClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialheaders.repeatability.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import specialheaders.repeatability.RepeatabilityClient; -import specialheaders.repeatability.RepeatabilityClientBuilder; - -class RepeatabilityClientTestBase extends TestProxyTestBase { - protected RepeatabilityClient repeatabilityClient; - - @Override - protected void beforeTest() { - RepeatabilityClientBuilder repeatabilityClientbuilder = new RepeatabilityClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - repeatabilityClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - repeatabilityClient = repeatabilityClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialwords/generated/SpecialWordsClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialwords/generated/SpecialWordsClientTestBase.java deleted file mode 100644 index 20be242ec4c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialwords/generated/SpecialWordsClientTestBase.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package specialwords.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import specialwords.ModelPropertiesClient; -import specialwords.ModelsClient; -import specialwords.OperationsClient; -import specialwords.ParametersClient; -import specialwords.SpecialWordsClientBuilder; - -class SpecialWordsClientTestBase extends TestProxyTestBase { - protected ModelsClient modelsClient; - - protected ModelPropertiesClient modelPropertiesClient; - - protected OperationsClient operationsClient; - - protected ParametersClient parametersClient; - - @Override - protected void beforeTest() { - SpecialWordsClientBuilder modelsClientbuilder = new SpecialWordsClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - modelsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - modelsClient = modelsClientbuilder.buildModelsClient(); - - SpecialWordsClientBuilder modelPropertiesClientbuilder = new SpecialWordsClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - modelPropertiesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - modelPropertiesClient = modelPropertiesClientbuilder.buildModelPropertiesClient(); - - SpecialWordsClientBuilder operationsClientbuilder = new SpecialWordsClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - operationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - operationsClient = operationsClientbuilder.buildOperationsClient(); - - SpecialWordsClientBuilder parametersClientbuilder = new SpecialWordsClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - parametersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - parametersClient = parametersClientbuilder.buildParametersClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/streaming/jsonl/generated/JsonlClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/streaming/jsonl/generated/JsonlClientTestBase.java deleted file mode 100644 index 82d776fe4c3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/streaming/jsonl/generated/JsonlClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package streaming.jsonl.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import streaming.jsonl.JsonlClient; -import streaming.jsonl.JsonlClientBuilder; - -class JsonlClientTestBase extends TestProxyTestBase { - protected JsonlClient jsonlClient; - - @Override - protected void beforeTest() { - JsonlClientBuilder jsonlClientbuilder = new JsonlClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - jsonlClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - jsonlClient = jsonlClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceInnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceInnerTests.java deleted file mode 100644 index c0f8f2fc1ee..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceInnerTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.generated; - -import com.azure.core.util.BinaryData; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; -import tsptest.armversioned.models.TopLevelArmResourceProperties; - -public final class TopLevelArmResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TopLevelArmResourceInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"uv\",\"tags\":{\"phrupidgsybbejhp\":\"pybczmehmtzopb\"},\"id\":\"oycmsxaobhdxbmt\",\"name\":\"ioq\",\"type\":\"zehtbmu\"}") - .toObject(TopLevelArmResourceInner.class); - Assertions.assertEquals("uv", model.location()); - Assertions.assertEquals("pybczmehmtzopb", model.tags().get("phrupidgsybbejhp")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TopLevelArmResourceInner model = new TopLevelArmResourceInner().withLocation("uv") - .withTags(mapOf("phrupidgsybbejhp", "pybczmehmtzopb")) - .withProperties(new TopLevelArmResourceProperties()); - model = BinaryData.fromObject(model).toObject(TopLevelArmResourceInner.class); - Assertions.assertEquals("uv", model.location()); - Assertions.assertEquals("pybczmehmtzopb", model.tags().get("phrupidgsybbejhp")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceListResultTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceListResultTests.java deleted file mode 100644 index bc7524675a2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceListResultTests.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.generated; - -import com.azure.core.util.BinaryData; -import org.junit.jupiter.api.Assertions; -import tsptest.armversioned.implementation.models.TopLevelArmResourceListResult; - -public final class TopLevelArmResourceListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TopLevelArmResourceListResult model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\"},\"location\":\"hwlrx\",\"tags\":{\"dmbpazlobcufpdz\":\"soqijg\",\"qqjnqgl\":\"rbt\",\"foooj\":\"qgn\"},\"id\":\"wifsq\",\"name\":\"saagdf\",\"type\":\"glzlhjxrifkwmrv\"}],\"nextLink\":\"siznto\"}") - .toObject(TopLevelArmResourceListResult.class); - Assertions.assertEquals("hwlrx", model.value().get(0).location()); - Assertions.assertEquals("soqijg", model.value().get(0).tags().get("dmbpazlobcufpdz")); - Assertions.assertEquals("siznto", model.nextLink()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourcePropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourcePropertiesTests.java deleted file mode 100644 index fe3644035e9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourcePropertiesTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.armversioned.generated; - -import com.azure.core.util.BinaryData; -import tsptest.armversioned.models.TopLevelArmResourceProperties; - -public final class TopLevelArmResourcePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TopLevelArmResourceProperties model = BinaryData.fromString("{\"provisioningState\":\"Canceled\"}") - .toObject(TopLevelArmResourceProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TopLevelArmResourceProperties model = new TopLevelArmResourceProperties(); - model = BinaryData.fromObject(model).toObject(TopLevelArmResourceProperties.class); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinClientTestBase.java deleted file mode 100644 index 3112ad7f814..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.builtin.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.builtin.BuiltinClient; -import tsptest.builtin.BuiltinClientBuilder; - -class BuiltinClientTestBase extends TestProxyTestBase { - protected BuiltinClient builtinClient; - - @Override - protected void beforeTest() { - BuiltinClientBuilder builtinClientbuilder - = new BuiltinClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - builtinClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - builtinClient = builtinClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpReadTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpReadTests.java deleted file mode 100644 index 8fa08f909c1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpReadTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.builtin.generated; - -import java.util.List; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import tsptest.builtin.models.Builtin; -import tsptest.builtin.models.Encoded; - -@Disabled -public final class BuiltinOpReadTests extends BuiltinClientTestBase { - @Test - @Disabled - public void testBuiltinOpReadTests() { - // method invocation - Builtin response = builtinClient.read(null, null, null, "myFilter", null, null); - - // response assertion - Assertions.assertNotNull(response); - // verify property "booleanProperty" - Assertions.assertEquals(true, response.isBooleanProperty()); - // verify property "string" - Assertions.assertEquals("myString", response.getString()); - // verify property "safeint" - Assertions.assertEquals(32L, response.getSafeint()); - // verify property "longProperty" - Assertions.assertEquals(64L, response.getLongProperty()); - // verify property "floatProperty" - Assertions.assertEquals(32.0, response.getFloatProperty()); - // verify property "doubleProperty" - Assertions.assertEquals(64.0, response.getDoubleProperty()); - // verify property "duration" - Assertions.assertNotNull(response.getDuration()); - // verify property "date" - Assertions.assertNotNull(response.getDate()); - // verify property "dateTime" - Assertions.assertNotNull(response.getDateTime()); - // verify property "stringList" - List responseStringList = response.getStringList(); - Assertions.assertEquals("a", responseStringList.iterator().next()); - // verify property "url" - Assertions.assertEquals("https://www.github.com", response.getUrl()); - // verify property "nullableFloatDict" - Assertions.assertNotNull(response.getNullableFloatDict()); - // verify property "encoded" - Encoded responseEncoded = response.getEncoded(); - Assertions.assertNotNull(responseEncoded); - Assertions.assertNotNull(responseEncoded.getTimeInSeconds()); - Assertions.assertNotNull(responseEncoded.getTimeInSecondsFraction()); - Assertions.assertNotNull(responseEncoded.getDateTime()); - Assertions.assertNotNull(responseEncoded.getDateTimeRfc7231()); - Assertions.assertNotNull(responseEncoded.getUnixTimestamp()); - Assertions.assertNotNull(responseEncoded.getBase64()); - Assertions.assertNotNull(responseEncoded.getBase64url()); - Assertions.assertNotNull(responseEncoded.getCommaDeliminatedArray()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpWriteTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpWriteTests.java deleted file mode 100644 index 1f8e4e16d7a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpWriteTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.builtin.generated; - -import java.time.Duration; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import tsptest.builtin.models.Builtin; -import tsptest.builtin.models.Encoded; - -@Disabled -public final class BuiltinOpWriteTests extends BuiltinClientTestBase { - @Test - @Disabled - public void testBuiltinOpWriteTests() { - // method invocation - builtinClient.write(new Builtin(true, "myString", null, 0, 32L, null, 64L, 32.0, 64.0, Duration.parse("PT15M"), - LocalDate.parse("2023-08-29"), OffsetDateTime.parse("2019-10-12T07:20:50.520Z"), - Arrays.asList("a", "b", "c"), null, "https://www.github.com", - mapOf("max", 15.0D, "min", 14.0D, "average", 14.3D), - new Encoded().setTimeInSeconds(Duration.parse("PT15M")) - .setTimeInSecondsFraction(Duration.parse("PT20M0.345S")) - .setDateTime(OffsetDateTime.parse("1966-03-03T00:06:56.52Z")) - .setDateTimeRfc7231(OffsetDateTime.parse("1994-11-06T08:49:37Z")) - .setUnixTimestamp(OffsetDateTime.parse("2023-08-30T02:35:03Z")) - .setBase64("aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==".getBytes()) - .setBase64url("aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==".getBytes()) - .setCommaDeliminatedArray(Arrays.asList("a", "b", "c")), - null)); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/clientinitialization/generated/ClientInitializationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/clientinitialization/generated/ClientInitializationClientTestBase.java deleted file mode 100644 index 593cce4525c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/clientinitialization/generated/ClientInitializationClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.clientinitialization.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.clientinitialization.ClientInitializationClient; -import tsptest.clientinitialization.ClientInitializationClientBuilder; - -class ClientInitializationClientTestBase extends TestProxyTestBase { - protected ClientInitializationClient clientInitializationClient; - - @Override - protected void beforeTest() { - ClientInitializationClientBuilder clientInitializationClientbuilder = new ClientInitializationClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - clientInitializationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - clientInitializationClient = clientInitializationClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/discriminatoredgecases/generated/DiscriminatorEdgeCasesClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/discriminatoredgecases/generated/DiscriminatorEdgeCasesClientTestBase.java deleted file mode 100644 index 370a1fb5d48..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/discriminatoredgecases/generated/DiscriminatorEdgeCasesClientTestBase.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.discriminatoredgecases.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient; -import tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClientBuilder; - -class DiscriminatorEdgeCasesClientTestBase extends TestProxyTestBase { - protected DiscriminatorEdgeCasesClient discriminatorEdgeCasesClient; - - @Override - protected void beforeTest() { - DiscriminatorEdgeCasesClientBuilder discriminatorEdgeCasesClientbuilder - = new DiscriminatorEdgeCasesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - discriminatorEdgeCasesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - discriminatorEdgeCasesClient = discriminatorEdgeCasesClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumnesteddiscriminator/generated/EnumNestedDiscriminatorClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumnesteddiscriminator/generated/EnumNestedDiscriminatorClientTestBase.java deleted file mode 100644 index a82fc558ce6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumnesteddiscriminator/generated/EnumNestedDiscriminatorClientTestBase.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumnesteddiscriminator.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient; -import tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClientBuilder; - -class EnumNestedDiscriminatorClientTestBase extends TestProxyTestBase { - protected EnumNestedDiscriminatorClient enumNestedDiscriminatorClient; - - @Override - protected void beforeTest() { - EnumNestedDiscriminatorClientBuilder enumNestedDiscriminatorClientbuilder - = new EnumNestedDiscriminatorClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - enumNestedDiscriminatorClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - enumNestedDiscriminatorClient = enumNestedDiscriminatorClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumservice/generated/EnumServiceClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumservice/generated/EnumServiceClientTestBase.java deleted file mode 100644 index 9dd80313b05..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumservice/generated/EnumServiceClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.enumservice.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.enumservice.EnumServiceClient; -import tsptest.enumservice.EnumServiceClientBuilder; - -class EnumServiceClientTestBase extends TestProxyTestBase { - protected EnumServiceClient enumServiceClient; - - @Override - protected void beforeTest() { - EnumServiceClientBuilder enumServiceClientbuilder = new EnumServiceClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - enumServiceClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - enumServiceClient = enumServiceClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/errormodel/generated/ErrorModelClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/errormodel/generated/ErrorModelClientTestBase.java deleted file mode 100644 index dc11b649137..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/errormodel/generated/ErrorModelClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.errormodel.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.errormodel.ErrorModelClient; -import tsptest.errormodel.ErrorModelClientBuilder; - -class ErrorModelClientTestBase extends TestProxyTestBase { - protected ErrorModelClient errorModelClient; - - @Override - protected void beforeTest() { - ErrorModelClientBuilder errorModelClientbuilder - = new ErrorModelClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - errorModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - errorModelClient = errorModelClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenClientTestBase.java deleted file mode 100644 index 666dcf2cc21..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.flatten.FlattenClient; -import tsptest.flatten.FlattenClientBuilder; - -class FlattenClientTestBase extends TestProxyTestBase { - protected FlattenClient flattenClient; - - @Override - protected void beforeTest() { - FlattenClientBuilder flattenClientbuilder - = new FlattenClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - flattenClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - flattenClient = flattenClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendLongTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendLongTests.java deleted file mode 100644 index 7d20f808991..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendLongTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.generated; - -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import tsptest.flatten.models.SendLongOptions; -import tsptest.flatten.models.SendLongRequestStatus; -import tsptest.flatten.models.User; - -@Disabled -public final class FlattenOpSendLongTests extends FlattenClientTestBase { - @Test - @Disabled - public void testFlattenOpSendLongTests() { - // method invocation - flattenClient.sendLong( - new SendLongOptions("myRequiredId", "myRequiredInput", 11, null, "title", SendLongRequestStatus.NOT_STARTED) - .setFilter("name=myName") - .setUser(new User("myOptionalUser")) - .setDataIntOptional(12) - .setDataLong(13L) - .setDataFloat(14.0D) - .setDescription("description")); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendTests.java deleted file mode 100644 index a968457260e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendTests.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.flatten.generated; - -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import tsptest.flatten.models.User; - -@Disabled -public final class FlattenOpSendTests extends FlattenClientTestBase { - @Test - @Disabled - public void testFlattenOpSendTests() { - // method invocation - flattenClient.send("myRequiredId", null, "myRequiredInput", 0, 50, new User("myOptionalUser")); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/internal/generated/InternalClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/internal/generated/InternalClientTestBase.java deleted file mode 100644 index 2536d1e9fc4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/internal/generated/InternalClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.internal.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.internal.InternalClient; -import tsptest.internal.InternalClientBuilder; - -class InternalClientTestBase extends TestProxyTestBase { - protected InternalClient internalClient; - - @Override - protected void beforeTest() { - InternalClientBuilder internalClientbuilder - = new InternalClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - internalClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - internalClient = internalClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/literalservice/generated/LiteralServiceClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/literalservice/generated/LiteralServiceClientTestBase.java deleted file mode 100644 index b54d4a93042..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/literalservice/generated/LiteralServiceClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.literalservice.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.literalservice.LiteralServiceClient; -import tsptest.literalservice.LiteralServiceClientBuilder; - -class LiteralServiceClientTestBase extends TestProxyTestBase { - protected LiteralServiceClient literalServiceClient; - - @Override - protected void beforeTest() { - LiteralServiceClientBuilder literalServiceClientbuilder = new LiteralServiceClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - literalServiceClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - literalServiceClient = literalServiceClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningClientTestBase.java deleted file mode 100644 index b1682f88100..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.longrunning.LongRunningClient; -import tsptest.longrunning.LongRunningClientBuilder; - -class LongRunningClientTestBase extends TestProxyTestBase { - protected LongRunningClient longRunningClient; - - @Override - protected void beforeTest() { - LongRunningClientBuilder longRunningClientbuilder = new LongRunningClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - longRunningClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - longRunningClient = longRunningClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningCreateJobTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningCreateJobTests.java deleted file mode 100644 index 7b6d7a34583..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningCreateJobTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.longrunning.generated; - -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.SyncPoller; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import tsptest.longrunning.models.JobData; -import tsptest.longrunning.models.JobResult; -import tsptest.longrunning.models.JobResultResult; - -@Disabled -public final class LongRunningCreateJobTests extends LongRunningClientTestBase { - @Test - @Disabled - public void testLongRunningCreateJobTests() { - // method invocation - SyncPoller response = setPlaybackSyncPollerPollInterval(longRunningClient - .beginCreateJob(new JobData(mapOf("max", 15.0D, "min", 14.0D, "average", 14.3D)).setConfiguration("{}"))); - - // response assertion - Assertions.assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, - response.waitForCompletion().getStatus()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/methodoverride/generated/MethodOverrideClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/methodoverride/generated/MethodOverrideClientTestBase.java deleted file mode 100644 index 20e12ef3aed..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/methodoverride/generated/MethodOverrideClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.methodoverride.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.methodoverride.MethodOverrideClient; -import tsptest.methodoverride.MethodOverrideClientBuilder; - -class MethodOverrideClientTestBase extends TestProxyTestBase { - protected MethodOverrideClient methodOverrideClient; - - @Override - protected void beforeTest() { - MethodOverrideClientBuilder methodOverrideClientbuilder = new MethodOverrideClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - methodOverrideClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - methodOverrideClient = methodOverrideClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelClientTestBase.java deleted file mode 100644 index 97f6f498216..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.model.ModelClient; -import tsptest.model.ModelClientBuilder; - -class ModelClientTestBase extends TestProxyTestBase { - protected ModelClient modelClient; - - @Override - protected void beforeTest() { - ModelClientBuilder modelClientbuilder - = new ModelClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - modelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - modelClient = modelClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelOpPutNestedTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelOpPutNestedTests.java deleted file mode 100644 index 7b090e408a7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelOpPutNestedTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.model.generated; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import tsptest.model.models.NestedModel; -import tsptest.model.models.NestedModel1; -import tsptest.model.models.NestedModel2; - -@Disabled -public final class ModelOpPutNestedTests extends ModelClientTestBase { - @Test - @Disabled - public void testModelOpPutNestedTests() { - // method invocation - NestedModel response = modelClient.putNested(null); - - // response assertion - Assertions.assertNotNull(response); - // verify property "nested1" - NestedModel1 responseNested1 = response.getNested1(); - Assertions.assertNotNull(responseNested1); - NestedModel2 responseNested1Nested2 = responseNested1.getNested2(); - Assertions.assertNotNull(responseNested1Nested2); - Assertions.assertEquals("123", responseNested1Nested2.getData()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/MultiContentTypesClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/MultiContentTypesClientTestBase.java deleted file mode 100644 index b895a57f738..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/MultiContentTypesClientTestBase.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.multicontenttypes.MultiContentTypesClient; -import tsptest.multicontenttypes.MultiContentTypesClientBuilder; -import tsptest.multicontenttypes.MultipleContentTypesOnRequestClient; -import tsptest.multicontenttypes.SingleContentTypeClient; - -class MultiContentTypesClientTestBase extends TestProxyTestBase { - protected MultiContentTypesClient multiContentTypesClient; - - protected SingleContentTypeClient singleContentTypeClient; - - protected MultipleContentTypesOnRequestClient multipleContentTypesOnRequestClient; - - @Override - protected void beforeTest() { - MultiContentTypesClientBuilder multiContentTypesClientbuilder = new MultiContentTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - multiContentTypesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - multiContentTypesClient = multiContentTypesClientbuilder.buildClient(); - - MultiContentTypesClientBuilder singleContentTypeClientbuilder = new MultiContentTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - singleContentTypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - singleContentTypeClient = singleContentTypeClientbuilder.buildSingleContentTypeClient(); - - MultiContentTypesClientBuilder multipleContentTypesOnRequestClientbuilder = new MultiContentTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - multipleContentTypesOnRequestClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - multipleContentTypesOnRequestClient - = multipleContentTypesOnRequestClientbuilder.buildMultipleContentTypesOnRequestClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentTypeTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentTypeTests.java deleted file mode 100644 index 18de83445ee..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentTypeTests.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multicontenttypes.generated; - -import com.azure.core.util.BinaryData; -import java.nio.charset.StandardCharsets; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -@Disabled -public final class SingleContentTypeUploadImageForSingleContentTypeTests extends MultiContentTypesClientTestBase { - @Test - @Disabled - public void testSingleContentTypeUploadImageForSingleContentTypeTests() { - // method invocation - singleContentTypeClient.uploadImageForSingleContentType( - BinaryData.fromBytes("\"D:\\Program Files\"".getBytes(StandardCharsets.UTF_8))); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multipart/generated/MultipartClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multipart/generated/MultipartClientTestBase.java deleted file mode 100644 index fe72d08112e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multipart/generated/MultipartClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.multipart.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.multipart.MultipartClient; -import tsptest.multipart.MultipartClientBuilder; - -class MultipartClientTestBase extends TestProxyTestBase { - protected MultipartClient multipartClient; - - @Override - protected void beforeTest() { - MultipartClientBuilder multipartClientbuilder - = new MultipartClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - multipartClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - multipartClient = multipartClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namespaceclient/generated/NamespaceClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namespaceclient/generated/NamespaceClientTestBase.java deleted file mode 100644 index f0721c907ab..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namespaceclient/generated/NamespaceClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namespaceclient.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.namespaceclient.NamespaceClient; -import tsptest.namespaceclient.NamespaceClientBuilder; - -class NamespaceClientTestBase extends TestProxyTestBase { - protected NamespaceClient namespaceClient; - - @Override - protected void beforeTest() { - NamespaceClientBuilder namespaceClientbuilder - = new NamespaceClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - namespaceClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - namespaceClient = namespaceClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/naming/generated/NamingClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/naming/generated/NamingClientTestBase.java deleted file mode 100644 index 906de0756af..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/naming/generated/NamingClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.naming.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.naming.NamingClient; -import tsptest.naming.NamingClientBuilder; - -class NamingClientTestBase extends TestProxyTestBase { - protected NamingClient namingClient; - - @Override - protected void beforeTest() { - NamingClientBuilder namingClientbuilder - = new NamingClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - namingClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - namingClient = namingClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namingjavaparser/generated/NamingJavaParserClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namingjavaparser/generated/NamingJavaParserClientTestBase.java deleted file mode 100644 index 3f5054bbec1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namingjavaparser/generated/NamingJavaParserClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.namingjavaparser.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.namingjavaparser.NamingJavaParserClient; -import tsptest.namingjavaparser.NamingJavaParserClientBuilder; - -class NamingJavaParserClientTestBase extends TestProxyTestBase { - protected NamingJavaParserClient namingJavaParserClient; - - @Override - protected void beforeTest() { - NamingJavaParserClientBuilder namingJavaParserClientbuilder = new NamingJavaParserClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - namingJavaParserClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - namingJavaParserClient = namingJavaParserClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/optional/generated/OptionalClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/optional/generated/OptionalClientTestBase.java deleted file mode 100644 index bdcb8e1f601..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/optional/generated/OptionalClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.optional.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.optional.OptionalClient; -import tsptest.optional.OptionalClientBuilder; - -class OptionalClientTestBase extends TestProxyTestBase { - protected OptionalClient optionalClient; - - @Override - protected void beforeTest() { - OptionalClientBuilder optionalClientbuilder - = new OptionalClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - optionalClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - optionalClient = optionalClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/patch/generated/PatchClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/patch/generated/PatchClientTestBase.java deleted file mode 100644 index 52da5c9c820..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/patch/generated/PatchClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.patch.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.patch.PatchClient; -import tsptest.patch.PatchClientBuilder; - -class PatchClientTestBase extends TestProxyTestBase { - protected PatchClient patchClient; - - @Override - protected void beforeTest() { - PatchClientBuilder patchClientbuilder - = new PatchClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - patchClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - patchClient = patchClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/protocolandconvenient/generated/ProtocolAndConvenientClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/protocolandconvenient/generated/ProtocolAndConvenientClientTestBase.java deleted file mode 100644 index 933f047dc84..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/protocolandconvenient/generated/ProtocolAndConvenientClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.protocolandconvenient.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.protocolandconvenient.ProtocolAndConvenientClient; -import tsptest.protocolandconvenient.ProtocolAndConvenientClientBuilder; - -class ProtocolAndConvenientClientTestBase extends TestProxyTestBase { - protected ProtocolAndConvenientClient protocolAndConvenientClient; - - @Override - protected void beforeTest() { - ProtocolAndConvenientClientBuilder protocolAndConvenientClientbuilder = new ProtocolAndConvenientClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - protocolAndConvenientClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - protocolAndConvenientClient = protocolAndConvenientClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseClientTestBase.java deleted file mode 100644 index 29aaa1541f0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.response.ResponseClient; -import tsptest.response.ResponseClientBuilder; - -class ResponseClientTestBase extends TestProxyTestBase { - protected ResponseClient responseClient; - - @Override - protected void beforeTest() { - ResponseClientBuilder responseClientbuilder - = new ResponseClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - responseClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - responseClient = responseClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpExistsTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpExistsTests.java deleted file mode 100644 index 350106599e6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpExistsTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.generated; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -@Disabled -public final class ResponseOpExistsTests extends ResponseClientTestBase { - @Test - @Disabled - public void testResponseOpExistsTests() { - // method invocation - boolean response = responseClient.exists(); - - // response assertion - Assertions.assertTrue(response); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpListStringsTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpListStringsTests.java deleted file mode 100644 index c6ef3a2f788..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpListStringsTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.response.generated; - -import com.azure.core.http.rest.PagedIterable; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -@Disabled -public final class ResponseOpListStringsTests extends ResponseClientTestBase { - @Test - @Disabled - public void testResponseOpListStringsTests() { - // method invocation - PagedIterable response = responseClient.listStrings(); - - // response assertion - Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/BuiltinOpReadTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/BuiltinOpReadTests.java deleted file mode 100644 index 528efd7f53a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/BuiltinOpReadTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialchars.generated; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import tsptest.specialchars.models.Resource; - -@Disabled -public final class BuiltinOpReadTests extends SpecialCharsClientTestBase { - @Test - @Disabled - public void testBuiltinOpReadTests() { - // method invocation - Resource response = specialCharsClient.read(null); - - // response assertion - Assertions.assertNotNull(response); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/SpecialCharsClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/SpecialCharsClientTestBase.java deleted file mode 100644 index 1a0b709fddc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/SpecialCharsClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialchars.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.specialchars.SpecialCharsClient; -import tsptest.specialchars.SpecialCharsClientBuilder; - -class SpecialCharsClientTestBase extends TestProxyTestBase { - protected SpecialCharsClient specialCharsClient; - - @Override - protected void beforeTest() { - SpecialCharsClientBuilder specialCharsClientbuilder = new SpecialCharsClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - specialCharsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - specialCharsClient = specialCharsClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersListWithEtagTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersListWithEtagTests.java deleted file mode 100644 index 84cf79074f3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersListWithEtagTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.generated; - -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.rest.PagedIterable; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import tsptest.specialheaders.models.Resource; - -@Disabled -public final class EtagHeadersListWithEtagTests extends SpecialHeadersClientTestBase { - @Test - @Disabled - public void testEtagHeadersListWithEtagTests() { - // method invocation - PagedIterable response = etagHeadersClient.listWithEtag(); - - // response assertion - Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); - Assertions.assertEquals("\"64e005\"", - response.iterableByPage().iterator().next().getHeaders().get(HttpHeaderName.fromString("ETag")).getValue()); - Resource firstItem = response.iterator().next(); - Assertions.assertNotNull(firstItem); - // verify property "id" - Assertions.assertEquals("myId", firstItem.getId()); - // verify property "name" - Assertions.assertEquals("name", firstItem.getName()); - // verify property "description" - Assertions.assertEquals("This is sample for Etag headers", firstItem.getDescription()); - // verify property "type" - Assertions.assertEquals("myType", firstItem.getType()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeadersTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeadersTests.java deleted file mode 100644 index a0f27011eca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeadersTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.generated; - -import com.azure.core.http.RequestConditions; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import tsptest.specialheaders.models.Resource; - -@Disabled -public final class EtagHeadersPutWithRequestHeadersTests extends SpecialHeadersClientTestBase { - @Test - @Disabled - public void testEtagHeadersPutWithRequestHeadersTests() { - // method invocation - Resource response = etagHeadersClient.putWithRequestHeaders("name", - new Resource().setDescription("This is sample for Etag headers").setType("myType"), - new RequestConditions().setIfMatch("\"64e005\"")); - - // response assertion - Assertions.assertNotNull(response); - // verify property "id" - Assertions.assertEquals("myId", response.getId()); - // verify property "name" - Assertions.assertEquals("name", response.getName()); - // verify property "description" - Assertions.assertEquals("This is sample for Etag headers", response.getDescription()); - // verify property "type" - Assertions.assertEquals("myType", response.getType()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/SpecialHeadersClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/SpecialHeadersClientTestBase.java deleted file mode 100644 index 16f1a7b3bda..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/SpecialHeadersClientTestBase.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.specialheaders.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.specialheaders.EtagHeadersClient; -import tsptest.specialheaders.EtagHeadersOptionalBodyClient; -import tsptest.specialheaders.RepeatabilityHeadersClient; -import tsptest.specialheaders.SkipSpecialHeadersClient; -import tsptest.specialheaders.SpecialHeadersClientBuilder; - -class SpecialHeadersClientTestBase extends TestProxyTestBase { - protected RepeatabilityHeadersClient repeatabilityHeadersClient; - - protected EtagHeadersClient etagHeadersClient; - - protected EtagHeadersOptionalBodyClient etagHeadersOptionalBodyClient; - - protected SkipSpecialHeadersClient skipSpecialHeadersClient; - - @Override - protected void beforeTest() { - SpecialHeadersClientBuilder repeatabilityHeadersClientbuilder = new SpecialHeadersClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - repeatabilityHeadersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - repeatabilityHeadersClient = repeatabilityHeadersClientbuilder.buildRepeatabilityHeadersClient(); - - SpecialHeadersClientBuilder etagHeadersClientbuilder = new SpecialHeadersClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - etagHeadersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - etagHeadersClient = etagHeadersClientbuilder.buildEtagHeadersClient(); - - SpecialHeadersClientBuilder etagHeadersOptionalBodyClientbuilder = new SpecialHeadersClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - etagHeadersOptionalBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - etagHeadersOptionalBodyClient = etagHeadersOptionalBodyClientbuilder.buildEtagHeadersOptionalBodyClient(); - - SpecialHeadersClientBuilder skipSpecialHeadersClientbuilder = new SpecialHeadersClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - skipSpecialHeadersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - skipSpecialHeadersClient = skipSpecialHeadersClientbuilder.buildSkipSpecialHeadersClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/subclass/generated/SubclassClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/subclass/generated/SubclassClientTestBase.java deleted file mode 100644 index 5ade858bbcf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/subclass/generated/SubclassClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.subclass.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.subclass.SubclassClient; -import tsptest.subclass.SubclassClientBuilder; - -class SubclassClientTestBase extends TestProxyTestBase { - protected SubclassClient subclassClient; - - @Override - protected void beforeTest() { - SubclassClientBuilder subclassClientbuilder - = new SubclassClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - subclassClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - subclassClient = subclassClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/union/generated/UnionClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/union/generated/UnionClientTestBase.java deleted file mode 100644 index a1e04ef7073..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/union/generated/UnionClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.union.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.union.UnionClient; -import tsptest.union.UnionClientBuilder; - -class UnionClientTestBase extends TestProxyTestBase { - protected UnionClient unionClient; - - @Override - protected void beforeTest() { - UnionClientBuilder unionClientbuilder - = new UnionClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unionClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unionClient = unionClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningClientTestBase.java deleted file mode 100644 index 10afb98ad7b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.versioning.VersioningClient; -import tsptest.versioning.VersioningClientBuilder; - -class VersioningClientTestBase extends TestProxyTestBase { - protected VersioningClient versioningClient; - - @Override - protected void beforeTest() { - VersioningClientBuilder versioningClientbuilder - = new VersioningClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - versioningClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - versioningClient = versioningClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningOpListTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningOpListTests.java deleted file mode 100644 index a5a7574b420..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningOpListTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.versioning.generated; - -import com.azure.core.http.rest.PagedIterable; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import tsptest.versioning.models.Resource; - -@Disabled -public final class VersioningOpListTests extends VersioningClientTestBase { - @Test - @Disabled - public void testVersioningOpListTests() { - // method invocation - PagedIterable response = versioningClient.list(Arrays.asList("name=name"), null); - - // response assertion - Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); - Resource firstItem = response.iterator().next(); - Assertions.assertNotNull(firstItem); - // verify property "id" - Assertions.assertEquals("myId", firstItem.getId()); - // verify property "name" - Assertions.assertEquals("name", firstItem.getName()); - // verify property "type" - Assertions.assertEquals("type", firstItem.getType()); - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/visibility/generated/VisibilityClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/visibility/generated/VisibilityClientTestBase.java deleted file mode 100644 index 1a2f22b26c4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/visibility/generated/VisibilityClientTestBase.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.visibility.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.visibility.VisibilityClient; -import tsptest.visibility.VisibilityClientBuilder; -import tsptest.visibility.VisibilityReadClient; -import tsptest.visibility.VisibilityWriteClient; - -class VisibilityClientTestBase extends TestProxyTestBase { - protected VisibilityClient visibilityClient; - - protected VisibilityReadClient visibilityReadClient; - - protected VisibilityWriteClient visibilityWriteClient; - - @Override - protected void beforeTest() { - VisibilityClientBuilder visibilityClientbuilder - = new VisibilityClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - visibilityClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - visibilityClient = visibilityClientbuilder.buildClient(); - - VisibilityClientBuilder visibilityReadClientbuilder - = new VisibilityClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - visibilityReadClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - visibilityReadClient = visibilityReadClientbuilder.buildVisibilityReadClient(); - - VisibilityClientBuilder visibilityWriteClientbuilder - = new VisibilityClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - visibilityWriteClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - visibilityWriteClient = visibilityWriteClientbuilder.buildVisibilityWriteClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/wiretype/generated/WireTypeClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/wiretype/generated/WireTypeClientTestBase.java deleted file mode 100644 index 2d869221135..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/wiretype/generated/WireTypeClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package tsptest.wiretype.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import tsptest.wiretype.WireTypeClient; -import tsptest.wiretype.WireTypeClientBuilder; - -class WireTypeClientTestBase extends TestProxyTestBase { - protected WireTypeClient wireTypeClient; - - @Override - protected void beforeTest() { - WireTypeClientBuilder wireTypeClientbuilder - = new WireTypeClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - wireTypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - wireTypeClient = wireTypeClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/array/generated/ArrayClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/array/generated/ArrayClientTestBase.java deleted file mode 100644 index abba8c122df..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/array/generated/ArrayClientTestBase.java +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.array.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.array.ArrayClientBuilder; -import type.array.BooleanValueClient; -import type.array.DatetimeValueClient; -import type.array.DurationValueClient; -import type.array.Float32ValueClient; -import type.array.Int32ValueClient; -import type.array.Int64ValueClient; -import type.array.ModelValueClient; -import type.array.NullableBooleanValueClient; -import type.array.NullableFloatValueClient; -import type.array.NullableInt32ValueClient; -import type.array.NullableModelValueClient; -import type.array.NullableStringValueClient; -import type.array.StringValueClient; -import type.array.UnknownValueClient; - -class ArrayClientTestBase extends TestProxyTestBase { - protected Int32ValueClient int32ValueClient; - - protected Int64ValueClient int64ValueClient; - - protected BooleanValueClient booleanValueClient; - - protected StringValueClient stringValueClient; - - protected Float32ValueClient float32ValueClient; - - protected DatetimeValueClient datetimeValueClient; - - protected DurationValueClient durationValueClient; - - protected UnknownValueClient unknownValueClient; - - protected ModelValueClient modelValueClient; - - protected NullableFloatValueClient nullableFloatValueClient; - - protected NullableInt32ValueClient nullableInt32ValueClient; - - protected NullableBooleanValueClient nullableBooleanValueClient; - - protected NullableStringValueClient nullableStringValueClient; - - protected NullableModelValueClient nullableModelValueClient; - - @Override - protected void beforeTest() { - ArrayClientBuilder int32ValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - int32ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - int32ValueClient = int32ValueClientbuilder.buildInt32ValueClient(); - - ArrayClientBuilder int64ValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - int64ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - int64ValueClient = int64ValueClientbuilder.buildInt64ValueClient(); - - ArrayClientBuilder booleanValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - booleanValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - booleanValueClient = booleanValueClientbuilder.buildBooleanValueClient(); - - ArrayClientBuilder stringValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - stringValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - stringValueClient = stringValueClientbuilder.buildStringValueClient(); - - ArrayClientBuilder float32ValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - float32ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - float32ValueClient = float32ValueClientbuilder.buildFloat32ValueClient(); - - ArrayClientBuilder datetimeValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - datetimeValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - datetimeValueClient = datetimeValueClientbuilder.buildDatetimeValueClient(); - - ArrayClientBuilder durationValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - durationValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - durationValueClient = durationValueClientbuilder.buildDurationValueClient(); - - ArrayClientBuilder unknownValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unknownValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unknownValueClient = unknownValueClientbuilder.buildUnknownValueClient(); - - ArrayClientBuilder modelValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - modelValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - modelValueClient = modelValueClientbuilder.buildModelValueClient(); - - ArrayClientBuilder nullableFloatValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - nullableFloatValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - nullableFloatValueClient = nullableFloatValueClientbuilder.buildNullableFloatValueClient(); - - ArrayClientBuilder nullableInt32ValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - nullableInt32ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - nullableInt32ValueClient = nullableInt32ValueClientbuilder.buildNullableInt32ValueClient(); - - ArrayClientBuilder nullableBooleanValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - nullableBooleanValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - nullableBooleanValueClient = nullableBooleanValueClientbuilder.buildNullableBooleanValueClient(); - - ArrayClientBuilder nullableStringValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - nullableStringValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - nullableStringValueClient = nullableStringValueClientbuilder.buildNullableStringValueClient(); - - ArrayClientBuilder nullableModelValueClientbuilder = new ArrayClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - nullableModelValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - nullableModelValueClient = nullableModelValueClientbuilder.buildNullableModelValueClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/dictionary/generated/DictionaryClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/dictionary/generated/DictionaryClientTestBase.java deleted file mode 100644 index c2ef40d1d2b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/dictionary/generated/DictionaryClientTestBase.java +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.dictionary.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.dictionary.BooleanValueClient; -import type.dictionary.DatetimeValueClient; -import type.dictionary.DictionaryClientBuilder; -import type.dictionary.DurationValueClient; -import type.dictionary.Float32ValueClient; -import type.dictionary.Int32ValueClient; -import type.dictionary.Int64ValueClient; -import type.dictionary.ModelValueClient; -import type.dictionary.NullableFloatValueClient; -import type.dictionary.RecursiveModelValueClient; -import type.dictionary.StringValueClient; -import type.dictionary.UnknownValueClient; - -class DictionaryClientTestBase extends TestProxyTestBase { - protected Int32ValueClient int32ValueClient; - - protected Int64ValueClient int64ValueClient; - - protected BooleanValueClient booleanValueClient; - - protected StringValueClient stringValueClient; - - protected Float32ValueClient float32ValueClient; - - protected DatetimeValueClient datetimeValueClient; - - protected DurationValueClient durationValueClient; - - protected UnknownValueClient unknownValueClient; - - protected ModelValueClient modelValueClient; - - protected RecursiveModelValueClient recursiveModelValueClient; - - protected NullableFloatValueClient nullableFloatValueClient; - - @Override - protected void beforeTest() { - DictionaryClientBuilder int32ValueClientbuilder = new DictionaryClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - int32ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - int32ValueClient = int32ValueClientbuilder.buildInt32ValueClient(); - - DictionaryClientBuilder int64ValueClientbuilder = new DictionaryClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - int64ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - int64ValueClient = int64ValueClientbuilder.buildInt64ValueClient(); - - DictionaryClientBuilder booleanValueClientbuilder = new DictionaryClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - booleanValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - booleanValueClient = booleanValueClientbuilder.buildBooleanValueClient(); - - DictionaryClientBuilder stringValueClientbuilder = new DictionaryClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - stringValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - stringValueClient = stringValueClientbuilder.buildStringValueClient(); - - DictionaryClientBuilder float32ValueClientbuilder = new DictionaryClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - float32ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - float32ValueClient = float32ValueClientbuilder.buildFloat32ValueClient(); - - DictionaryClientBuilder datetimeValueClientbuilder = new DictionaryClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - datetimeValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - datetimeValueClient = datetimeValueClientbuilder.buildDatetimeValueClient(); - - DictionaryClientBuilder durationValueClientbuilder = new DictionaryClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - durationValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - durationValueClient = durationValueClientbuilder.buildDurationValueClient(); - - DictionaryClientBuilder unknownValueClientbuilder = new DictionaryClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unknownValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unknownValueClient = unknownValueClientbuilder.buildUnknownValueClient(); - - DictionaryClientBuilder modelValueClientbuilder = new DictionaryClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - modelValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - modelValueClient = modelValueClientbuilder.buildModelValueClient(); - - DictionaryClientBuilder recursiveModelValueClientbuilder = new DictionaryClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - recursiveModelValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - recursiveModelValueClient = recursiveModelValueClientbuilder.buildRecursiveModelValueClient(); - - DictionaryClientBuilder nullableFloatValueClientbuilder = new DictionaryClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - nullableFloatValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - nullableFloatValueClient = nullableFloatValueClientbuilder.buildNullableFloatValueClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/extensible/generated/ExtensibleClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/extensible/generated/ExtensibleClientTestBase.java deleted file mode 100644 index 038458f064a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/extensible/generated/ExtensibleClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.extensible.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.enums.extensible.ExtensibleClient; -import type.enums.extensible.ExtensibleClientBuilder; - -class ExtensibleClientTestBase extends TestProxyTestBase { - protected ExtensibleClient extensibleClient; - - @Override - protected void beforeTest() { - ExtensibleClientBuilder extensibleClientbuilder = new ExtensibleClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extensibleClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extensibleClient = extensibleClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/fixed/generated/FixedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/fixed/generated/FixedClientTestBase.java deleted file mode 100644 index 99e1909d7ef..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/fixed/generated/FixedClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.enums.fixed.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.enums.fixed.FixedClient; -import type.enums.fixed.FixedClientBuilder; - -class FixedClientTestBase extends TestProxyTestBase { - protected FixedClient fixedClient; - - @Override - protected void beforeTest() { - FixedClientBuilder fixedClientbuilder = new FixedClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - fixedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - fixedClient = fixedClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/empty/generated/EmptyClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/empty/generated/EmptyClientTestBase.java deleted file mode 100644 index 2a37097e8bf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/empty/generated/EmptyClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.empty.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.model.empty.EmptyClient; -import type.model.empty.EmptyClientBuilder; - -class EmptyClientTestBase extends TestProxyTestBase { - protected EmptyClient emptyClient; - - @Override - protected void beforeTest() { - EmptyClientBuilder emptyClientbuilder = new EmptyClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - emptyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - emptyClient = emptyClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/enumdiscriminator/generated/EnumDiscriminatorClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/enumdiscriminator/generated/EnumDiscriminatorClientTestBase.java deleted file mode 100644 index 23d0fb02e38..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/enumdiscriminator/generated/EnumDiscriminatorClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.enumdiscriminator.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient; -import type.model.inheritance.enumdiscriminator.EnumDiscriminatorClientBuilder; - -class EnumDiscriminatorClientTestBase extends TestProxyTestBase { - protected EnumDiscriminatorClient enumDiscriminatorClient; - - @Override - protected void beforeTest() { - EnumDiscriminatorClientBuilder enumDiscriminatorClientbuilder = new EnumDiscriminatorClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - enumDiscriminatorClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - enumDiscriminatorClient = enumDiscriminatorClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/nesteddiscriminator/generated/NestedDiscriminatorClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/nesteddiscriminator/generated/NestedDiscriminatorClientTestBase.java deleted file mode 100644 index adab1f9b5cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/nesteddiscriminator/generated/NestedDiscriminatorClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.nesteddiscriminator.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient; -import type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClientBuilder; - -class NestedDiscriminatorClientTestBase extends TestProxyTestBase { - protected NestedDiscriminatorClient nestedDiscriminatorClient; - - @Override - protected void beforeTest() { - NestedDiscriminatorClientBuilder nestedDiscriminatorClientbuilder = new NestedDiscriminatorClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - nestedDiscriminatorClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - nestedDiscriminatorClient = nestedDiscriminatorClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/notdiscriminated/generated/NotDiscriminatedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/notdiscriminated/generated/NotDiscriminatedClientTestBase.java deleted file mode 100644 index d0d88992f48..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/notdiscriminated/generated/NotDiscriminatedClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.notdiscriminated.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.model.inheritance.notdiscriminated.NotDiscriminatedClient; -import type.model.inheritance.notdiscriminated.NotDiscriminatedClientBuilder; - -class NotDiscriminatedClientTestBase extends TestProxyTestBase { - protected NotDiscriminatedClient notDiscriminatedClient; - - @Override - protected void beforeTest() { - NotDiscriminatedClientBuilder notDiscriminatedClientbuilder = new NotDiscriminatedClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - notDiscriminatedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - notDiscriminatedClient = notDiscriminatedClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/recursive/generated/RecursiveClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/recursive/generated/RecursiveClientTestBase.java deleted file mode 100644 index 06bc7a46240..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/recursive/generated/RecursiveClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.recursive.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.model.inheritance.recursive.RecursiveClient; -import type.model.inheritance.recursive.RecursiveClientBuilder; - -class RecursiveClientTestBase extends TestProxyTestBase { - protected RecursiveClient recursiveClient; - - @Override - protected void beforeTest() { - RecursiveClientBuilder recursiveClientbuilder = new RecursiveClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - recursiveClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - recursiveClient = recursiveClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/singlediscriminator/generated/SingleDiscriminatorClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/singlediscriminator/generated/SingleDiscriminatorClientTestBase.java deleted file mode 100644 index fae99d0b2f5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/singlediscriminator/generated/SingleDiscriminatorClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.inheritance.singlediscriminator.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.model.inheritance.singlediscriminator.SingleDiscriminatorClient; -import type.model.inheritance.singlediscriminator.SingleDiscriminatorClientBuilder; - -class SingleDiscriminatorClientTestBase extends TestProxyTestBase { - protected SingleDiscriminatorClient singleDiscriminatorClient; - - @Override - protected void beforeTest() { - SingleDiscriminatorClientBuilder singleDiscriminatorClientbuilder = new SingleDiscriminatorClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - singleDiscriminatorClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - singleDiscriminatorClient = singleDiscriminatorClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/usage/generated/UsageClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/usage/generated/UsageClientTestBase.java deleted file mode 100644 index 711f198b038..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/usage/generated/UsageClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.usage.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.model.usage.UsageClient; -import type.model.usage.UsageClientBuilder; - -class UsageClientTestBase extends TestProxyTestBase { - protected UsageClient usageClient; - - @Override - protected void beforeTest() { - UsageClientBuilder usageClientbuilder = new UsageClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - usageClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - usageClient = usageClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/visibility/generated/VisibilityClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/visibility/generated/VisibilityClientTestBase.java deleted file mode 100644 index 12159b49749..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/visibility/generated/VisibilityClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.model.visibility.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.model.visibility.VisibilityClient; -import type.model.visibility.VisibilityClientBuilder; - -class VisibilityClientTestBase extends TestProxyTestBase { - protected VisibilityClient visibilityClient; - - @Override - protected void beforeTest() { - VisibilityClientBuilder visibilityClientbuilder = new VisibilityClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - visibilityClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - visibilityClient = visibilityClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/additionalproperties/generated/AdditionalPropertiesClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/additionalproperties/generated/AdditionalPropertiesClientTestBase.java deleted file mode 100644 index 283dd23022c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/additionalproperties/generated/AdditionalPropertiesClientTestBase.java +++ /dev/null @@ -1,411 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.additionalproperties.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.property.additionalproperties.AdditionalPropertiesClientBuilder; -import type.property.additionalproperties.ExtendsDifferentSpreadFloatClient; -import type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient; -import type.property.additionalproperties.ExtendsDifferentSpreadModelClient; -import type.property.additionalproperties.ExtendsDifferentSpreadStringClient; -import type.property.additionalproperties.ExtendsFloatClient; -import type.property.additionalproperties.ExtendsModelArrayClient; -import type.property.additionalproperties.ExtendsModelClient; -import type.property.additionalproperties.ExtendsStringClient; -import type.property.additionalproperties.ExtendsUnknownClient; -import type.property.additionalproperties.ExtendsUnknownDerivedClient; -import type.property.additionalproperties.ExtendsUnknownDiscriminatedClient; -import type.property.additionalproperties.IsFloatClient; -import type.property.additionalproperties.IsModelArrayClient; -import type.property.additionalproperties.IsModelClient; -import type.property.additionalproperties.IsStringClient; -import type.property.additionalproperties.IsUnknownClient; -import type.property.additionalproperties.IsUnknownDerivedClient; -import type.property.additionalproperties.IsUnknownDiscriminatedClient; -import type.property.additionalproperties.MultipleSpreadClient; -import type.property.additionalproperties.SpreadDifferentFloatClient; -import type.property.additionalproperties.SpreadDifferentModelArrayClient; -import type.property.additionalproperties.SpreadDifferentModelClient; -import type.property.additionalproperties.SpreadDifferentStringClient; -import type.property.additionalproperties.SpreadFloatClient; -import type.property.additionalproperties.SpreadModelArrayClient; -import type.property.additionalproperties.SpreadModelClient; -import type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client; -import type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client; -import type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient; -import type.property.additionalproperties.SpreadRecordUnionClient; -import type.property.additionalproperties.SpreadStringClient; - -class AdditionalPropertiesClientTestBase extends TestProxyTestBase { - protected ExtendsUnknownClient extendsUnknownClient; - - protected ExtendsUnknownDerivedClient extendsUnknownDerivedClient; - - protected ExtendsUnknownDiscriminatedClient extendsUnknownDiscriminatedClient; - - protected IsUnknownClient isUnknownClient; - - protected IsUnknownDerivedClient isUnknownDerivedClient; - - protected IsUnknownDiscriminatedClient isUnknownDiscriminatedClient; - - protected ExtendsStringClient extendsStringClient; - - protected IsStringClient isStringClient; - - protected SpreadStringClient spreadStringClient; - - protected ExtendsFloatClient extendsFloatClient; - - protected IsFloatClient isFloatClient; - - protected SpreadFloatClient spreadFloatClient; - - protected ExtendsModelClient extendsModelClient; - - protected IsModelClient isModelClient; - - protected SpreadModelClient spreadModelClient; - - protected ExtendsModelArrayClient extendsModelArrayClient; - - protected IsModelArrayClient isModelArrayClient; - - protected SpreadModelArrayClient spreadModelArrayClient; - - protected SpreadDifferentStringClient spreadDifferentStringClient; - - protected SpreadDifferentFloatClient spreadDifferentFloatClient; - - protected SpreadDifferentModelClient spreadDifferentModelClient; - - protected SpreadDifferentModelArrayClient spreadDifferentModelArrayClient; - - protected ExtendsDifferentSpreadStringClient extendsDifferentSpreadStringClient; - - protected ExtendsDifferentSpreadFloatClient extendsDifferentSpreadFloatClient; - - protected ExtendsDifferentSpreadModelClient extendsDifferentSpreadModelClient; - - protected ExtendsDifferentSpreadModelArrayClient extendsDifferentSpreadModelArrayClient; - - protected MultipleSpreadClient multipleSpreadClient; - - protected SpreadRecordUnionClient spreadRecordUnionClient; - - protected SpreadRecordNonDiscriminatedUnionClient spreadRecordNonDiscriminatedUnionClient; - - protected SpreadRecordNonDiscriminatedUnion2Client spreadRecordNonDiscriminatedUnion2Client; - - protected SpreadRecordNonDiscriminatedUnion3Client spreadRecordNonDiscriminatedUnion3Client; - - @Override - protected void beforeTest() { - AdditionalPropertiesClientBuilder extendsUnknownClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extendsUnknownClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extendsUnknownClient = extendsUnknownClientbuilder.buildExtendsUnknownClient(); - - AdditionalPropertiesClientBuilder extendsUnknownDerivedClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extendsUnknownDerivedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extendsUnknownDerivedClient = extendsUnknownDerivedClientbuilder.buildExtendsUnknownDerivedClient(); - - AdditionalPropertiesClientBuilder extendsUnknownDiscriminatedClientbuilder - = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extendsUnknownDiscriminatedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extendsUnknownDiscriminatedClient - = extendsUnknownDiscriminatedClientbuilder.buildExtendsUnknownDiscriminatedClient(); - - AdditionalPropertiesClientBuilder isUnknownClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - isUnknownClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - isUnknownClient = isUnknownClientbuilder.buildIsUnknownClient(); - - AdditionalPropertiesClientBuilder isUnknownDerivedClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - isUnknownDerivedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - isUnknownDerivedClient = isUnknownDerivedClientbuilder.buildIsUnknownDerivedClient(); - - AdditionalPropertiesClientBuilder isUnknownDiscriminatedClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - isUnknownDiscriminatedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - isUnknownDiscriminatedClient = isUnknownDiscriminatedClientbuilder.buildIsUnknownDiscriminatedClient(); - - AdditionalPropertiesClientBuilder extendsStringClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extendsStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extendsStringClient = extendsStringClientbuilder.buildExtendsStringClient(); - - AdditionalPropertiesClientBuilder isStringClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - isStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - isStringClient = isStringClientbuilder.buildIsStringClient(); - - AdditionalPropertiesClientBuilder spreadStringClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - spreadStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - spreadStringClient = spreadStringClientbuilder.buildSpreadStringClient(); - - AdditionalPropertiesClientBuilder extendsFloatClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extendsFloatClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extendsFloatClient = extendsFloatClientbuilder.buildExtendsFloatClient(); - - AdditionalPropertiesClientBuilder isFloatClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - isFloatClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - isFloatClient = isFloatClientbuilder.buildIsFloatClient(); - - AdditionalPropertiesClientBuilder spreadFloatClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - spreadFloatClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - spreadFloatClient = spreadFloatClientbuilder.buildSpreadFloatClient(); - - AdditionalPropertiesClientBuilder extendsModelClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extendsModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extendsModelClient = extendsModelClientbuilder.buildExtendsModelClient(); - - AdditionalPropertiesClientBuilder isModelClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - isModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - isModelClient = isModelClientbuilder.buildIsModelClient(); - - AdditionalPropertiesClientBuilder spreadModelClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - spreadModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - spreadModelClient = spreadModelClientbuilder.buildSpreadModelClient(); - - AdditionalPropertiesClientBuilder extendsModelArrayClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extendsModelArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extendsModelArrayClient = extendsModelArrayClientbuilder.buildExtendsModelArrayClient(); - - AdditionalPropertiesClientBuilder isModelArrayClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - isModelArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - isModelArrayClient = isModelArrayClientbuilder.buildIsModelArrayClient(); - - AdditionalPropertiesClientBuilder spreadModelArrayClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - spreadModelArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - spreadModelArrayClient = spreadModelArrayClientbuilder.buildSpreadModelArrayClient(); - - AdditionalPropertiesClientBuilder spreadDifferentStringClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - spreadDifferentStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - spreadDifferentStringClient = spreadDifferentStringClientbuilder.buildSpreadDifferentStringClient(); - - AdditionalPropertiesClientBuilder spreadDifferentFloatClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - spreadDifferentFloatClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - spreadDifferentFloatClient = spreadDifferentFloatClientbuilder.buildSpreadDifferentFloatClient(); - - AdditionalPropertiesClientBuilder spreadDifferentModelClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - spreadDifferentModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - spreadDifferentModelClient = spreadDifferentModelClientbuilder.buildSpreadDifferentModelClient(); - - AdditionalPropertiesClientBuilder spreadDifferentModelArrayClientbuilder - = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - spreadDifferentModelArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - spreadDifferentModelArrayClient = spreadDifferentModelArrayClientbuilder.buildSpreadDifferentModelArrayClient(); - - AdditionalPropertiesClientBuilder extendsDifferentSpreadStringClientbuilder - = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extendsDifferentSpreadStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extendsDifferentSpreadStringClient - = extendsDifferentSpreadStringClientbuilder.buildExtendsDifferentSpreadStringClient(); - - AdditionalPropertiesClientBuilder extendsDifferentSpreadFloatClientbuilder - = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extendsDifferentSpreadFloatClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extendsDifferentSpreadFloatClient - = extendsDifferentSpreadFloatClientbuilder.buildExtendsDifferentSpreadFloatClient(); - - AdditionalPropertiesClientBuilder extendsDifferentSpreadModelClientbuilder - = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extendsDifferentSpreadModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extendsDifferentSpreadModelClient - = extendsDifferentSpreadModelClientbuilder.buildExtendsDifferentSpreadModelClient(); - - AdditionalPropertiesClientBuilder extendsDifferentSpreadModelArrayClientbuilder - = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extendsDifferentSpreadModelArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extendsDifferentSpreadModelArrayClient - = extendsDifferentSpreadModelArrayClientbuilder.buildExtendsDifferentSpreadModelArrayClient(); - - AdditionalPropertiesClientBuilder multipleSpreadClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - multipleSpreadClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - multipleSpreadClient = multipleSpreadClientbuilder.buildMultipleSpreadClient(); - - AdditionalPropertiesClientBuilder spreadRecordUnionClientbuilder = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - spreadRecordUnionClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - spreadRecordUnionClient = spreadRecordUnionClientbuilder.buildSpreadRecordUnionClient(); - - AdditionalPropertiesClientBuilder spreadRecordNonDiscriminatedUnionClientbuilder - = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - spreadRecordNonDiscriminatedUnionClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - spreadRecordNonDiscriminatedUnionClient - = spreadRecordNonDiscriminatedUnionClientbuilder.buildSpreadRecordNonDiscriminatedUnionClient(); - - AdditionalPropertiesClientBuilder spreadRecordNonDiscriminatedUnion2Clientbuilder - = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - spreadRecordNonDiscriminatedUnion2Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - spreadRecordNonDiscriminatedUnion2Client - = spreadRecordNonDiscriminatedUnion2Clientbuilder.buildSpreadRecordNonDiscriminatedUnion2Client(); - - AdditionalPropertiesClientBuilder spreadRecordNonDiscriminatedUnion3Clientbuilder - = new AdditionalPropertiesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - spreadRecordNonDiscriminatedUnion3Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - spreadRecordNonDiscriminatedUnion3Client - = spreadRecordNonDiscriminatedUnion3Clientbuilder.buildSpreadRecordNonDiscriminatedUnion3Client(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/nullable/generated/NullableClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/nullable/generated/NullableClientTestBase.java deleted file mode 100644 index 90b52ac3463..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/nullable/generated/NullableClientTestBase.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.nullable.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.property.nullable.BytesClient; -import type.property.nullable.CollectionsByteClient; -import type.property.nullable.CollectionsModelClient; -import type.property.nullable.CollectionsStringClient; -import type.property.nullable.DatetimeOperationClient; -import type.property.nullable.DurationOperationClient; -import type.property.nullable.NullableClientBuilder; -import type.property.nullable.StringOperationClient; - -class NullableClientTestBase extends TestProxyTestBase { - protected StringOperationClient stringOperationClient; - - protected BytesClient bytesClient; - - protected DatetimeOperationClient datetimeOperationClient; - - protected DurationOperationClient durationOperationClient; - - protected CollectionsByteClient collectionsByteClient; - - protected CollectionsModelClient collectionsModelClient; - - protected CollectionsStringClient collectionsStringClient; - - @Override - protected void beforeTest() { - NullableClientBuilder stringOperationClientbuilder = new NullableClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - stringOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - stringOperationClient = stringOperationClientbuilder.buildStringOperationClient(); - - NullableClientBuilder bytesClientbuilder = new NullableClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - bytesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - bytesClient = bytesClientbuilder.buildBytesClient(); - - NullableClientBuilder datetimeOperationClientbuilder = new NullableClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - datetimeOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - datetimeOperationClient = datetimeOperationClientbuilder.buildDatetimeOperationClient(); - - NullableClientBuilder durationOperationClientbuilder = new NullableClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - durationOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - durationOperationClient = durationOperationClientbuilder.buildDurationOperationClient(); - - NullableClientBuilder collectionsByteClientbuilder = new NullableClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - collectionsByteClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - collectionsByteClient = collectionsByteClientbuilder.buildCollectionsByteClient(); - - NullableClientBuilder collectionsModelClientbuilder = new NullableClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - collectionsModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - collectionsModelClient = collectionsModelClientbuilder.buildCollectionsModelClient(); - - NullableClientBuilder collectionsStringClientbuilder = new NullableClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - collectionsStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - collectionsStringClient = collectionsStringClientbuilder.buildCollectionsStringClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/optional/generated/OptionalClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/optional/generated/OptionalClientTestBase.java deleted file mode 100644 index 61b2a5e4b7a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/optional/generated/OptionalClientTestBase.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.optional.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.property.optional.BooleanLiteralClient; -import type.property.optional.BytesClient; -import type.property.optional.CollectionsByteClient; -import type.property.optional.CollectionsModelClient; -import type.property.optional.DatetimeOperationClient; -import type.property.optional.DurationOperationClient; -import type.property.optional.FloatLiteralClient; -import type.property.optional.IntLiteralClient; -import type.property.optional.OptionalClientBuilder; -import type.property.optional.PlainDateClient; -import type.property.optional.PlainTimeClient; -import type.property.optional.RequiredAndOptionalClient; -import type.property.optional.StringLiteralClient; -import type.property.optional.StringOperationClient; -import type.property.optional.UnionFloatLiteralClient; -import type.property.optional.UnionIntLiteralClient; -import type.property.optional.UnionStringLiteralClient; - -class OptionalClientTestBase extends TestProxyTestBase { - protected StringOperationClient stringOperationClient; - - protected BytesClient bytesClient; - - protected DatetimeOperationClient datetimeOperationClient; - - protected DurationOperationClient durationOperationClient; - - protected PlainDateClient plainDateClient; - - protected PlainTimeClient plainTimeClient; - - protected CollectionsByteClient collectionsByteClient; - - protected CollectionsModelClient collectionsModelClient; - - protected StringLiteralClient stringLiteralClient; - - protected IntLiteralClient intLiteralClient; - - protected FloatLiteralClient floatLiteralClient; - - protected BooleanLiteralClient booleanLiteralClient; - - protected UnionStringLiteralClient unionStringLiteralClient; - - protected UnionIntLiteralClient unionIntLiteralClient; - - protected UnionFloatLiteralClient unionFloatLiteralClient; - - protected RequiredAndOptionalClient requiredAndOptionalClient; - - @Override - protected void beforeTest() { - OptionalClientBuilder stringOperationClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - stringOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - stringOperationClient = stringOperationClientbuilder.buildStringOperationClient(); - - OptionalClientBuilder bytesClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - bytesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - bytesClient = bytesClientbuilder.buildBytesClient(); - - OptionalClientBuilder datetimeOperationClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - datetimeOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - datetimeOperationClient = datetimeOperationClientbuilder.buildDatetimeOperationClient(); - - OptionalClientBuilder durationOperationClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - durationOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - durationOperationClient = durationOperationClientbuilder.buildDurationOperationClient(); - - OptionalClientBuilder plainDateClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - plainDateClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - plainDateClient = plainDateClientbuilder.buildPlainDateClient(); - - OptionalClientBuilder plainTimeClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - plainTimeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - plainTimeClient = plainTimeClientbuilder.buildPlainTimeClient(); - - OptionalClientBuilder collectionsByteClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - collectionsByteClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - collectionsByteClient = collectionsByteClientbuilder.buildCollectionsByteClient(); - - OptionalClientBuilder collectionsModelClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - collectionsModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - collectionsModelClient = collectionsModelClientbuilder.buildCollectionsModelClient(); - - OptionalClientBuilder stringLiteralClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - stringLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - stringLiteralClient = stringLiteralClientbuilder.buildStringLiteralClient(); - - OptionalClientBuilder intLiteralClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - intLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - intLiteralClient = intLiteralClientbuilder.buildIntLiteralClient(); - - OptionalClientBuilder floatLiteralClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - floatLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - floatLiteralClient = floatLiteralClientbuilder.buildFloatLiteralClient(); - - OptionalClientBuilder booleanLiteralClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - booleanLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - booleanLiteralClient = booleanLiteralClientbuilder.buildBooleanLiteralClient(); - - OptionalClientBuilder unionStringLiteralClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unionStringLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unionStringLiteralClient = unionStringLiteralClientbuilder.buildUnionStringLiteralClient(); - - OptionalClientBuilder unionIntLiteralClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unionIntLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unionIntLiteralClient = unionIntLiteralClientbuilder.buildUnionIntLiteralClient(); - - OptionalClientBuilder unionFloatLiteralClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unionFloatLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unionFloatLiteralClient = unionFloatLiteralClientbuilder.buildUnionFloatLiteralClient(); - - OptionalClientBuilder requiredAndOptionalClientbuilder = new OptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - requiredAndOptionalClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - requiredAndOptionalClient = requiredAndOptionalClientbuilder.buildRequiredAndOptionalClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/valuetypes/generated/ValueTypesClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/valuetypes/generated/ValueTypesClientTestBase.java deleted file mode 100644 index 3a7e3736cf8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/valuetypes/generated/ValueTypesClientTestBase.java +++ /dev/null @@ -1,370 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.property.valuetypes.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.property.valuetypes.BooleanLiteralClient; -import type.property.valuetypes.BooleanOperationClient; -import type.property.valuetypes.BytesClient; -import type.property.valuetypes.CollectionsIntClient; -import type.property.valuetypes.CollectionsModelClient; -import type.property.valuetypes.CollectionsStringClient; -import type.property.valuetypes.DatetimeOperationClient; -import type.property.valuetypes.Decimal128Client; -import type.property.valuetypes.DecimalClient; -import type.property.valuetypes.DictionaryStringClient; -import type.property.valuetypes.DurationOperationClient; -import type.property.valuetypes.EnumClient; -import type.property.valuetypes.ExtensibleEnumClient; -import type.property.valuetypes.FloatLiteralClient; -import type.property.valuetypes.FloatOperationClient; -import type.property.valuetypes.IntClient; -import type.property.valuetypes.IntLiteralClient; -import type.property.valuetypes.ModelClient; -import type.property.valuetypes.NeverClient; -import type.property.valuetypes.StringLiteralClient; -import type.property.valuetypes.StringOperationClient; -import type.property.valuetypes.UnionEnumValueClient; -import type.property.valuetypes.UnionFloatLiteralClient; -import type.property.valuetypes.UnionIntLiteralClient; -import type.property.valuetypes.UnionStringLiteralClient; -import type.property.valuetypes.UnknownArrayClient; -import type.property.valuetypes.UnknownDictClient; -import type.property.valuetypes.UnknownIntClient; -import type.property.valuetypes.UnknownStringClient; -import type.property.valuetypes.ValueTypesClientBuilder; - -class ValueTypesClientTestBase extends TestProxyTestBase { - protected BooleanOperationClient booleanOperationClient; - - protected StringOperationClient stringOperationClient; - - protected BytesClient bytesClient; - - protected IntClient intClient; - - protected FloatOperationClient floatOperationClient; - - protected DecimalClient decimalClient; - - protected Decimal128Client decimal128Client; - - protected DatetimeOperationClient datetimeOperationClient; - - protected DurationOperationClient durationOperationClient; - - protected EnumClient enumClient; - - protected ExtensibleEnumClient extensibleEnumClient; - - protected ModelClient modelClient; - - protected CollectionsStringClient collectionsStringClient; - - protected CollectionsIntClient collectionsIntClient; - - protected CollectionsModelClient collectionsModelClient; - - protected DictionaryStringClient dictionaryStringClient; - - protected NeverClient neverClient; - - protected UnknownStringClient unknownStringClient; - - protected UnknownIntClient unknownIntClient; - - protected UnknownDictClient unknownDictClient; - - protected UnknownArrayClient unknownArrayClient; - - protected StringLiteralClient stringLiteralClient; - - protected IntLiteralClient intLiteralClient; - - protected FloatLiteralClient floatLiteralClient; - - protected BooleanLiteralClient booleanLiteralClient; - - protected UnionStringLiteralClient unionStringLiteralClient; - - protected UnionIntLiteralClient unionIntLiteralClient; - - protected UnionFloatLiteralClient unionFloatLiteralClient; - - protected UnionEnumValueClient unionEnumValueClient; - - @Override - protected void beforeTest() { - ValueTypesClientBuilder booleanOperationClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - booleanOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - booleanOperationClient = booleanOperationClientbuilder.buildBooleanOperationClient(); - - ValueTypesClientBuilder stringOperationClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - stringOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - stringOperationClient = stringOperationClientbuilder.buildStringOperationClient(); - - ValueTypesClientBuilder bytesClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - bytesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - bytesClient = bytesClientbuilder.buildBytesClient(); - - ValueTypesClientBuilder intClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - intClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - intClient = intClientbuilder.buildIntClient(); - - ValueTypesClientBuilder floatOperationClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - floatOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - floatOperationClient = floatOperationClientbuilder.buildFloatOperationClient(); - - ValueTypesClientBuilder decimalClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - decimalClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - decimalClient = decimalClientbuilder.buildDecimalClient(); - - ValueTypesClientBuilder decimal128Clientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - decimal128Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - decimal128Client = decimal128Clientbuilder.buildDecimal128Client(); - - ValueTypesClientBuilder datetimeOperationClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - datetimeOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - datetimeOperationClient = datetimeOperationClientbuilder.buildDatetimeOperationClient(); - - ValueTypesClientBuilder durationOperationClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - durationOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - durationOperationClient = durationOperationClientbuilder.buildDurationOperationClient(); - - ValueTypesClientBuilder enumClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - enumClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - enumClient = enumClientbuilder.buildEnumClient(); - - ValueTypesClientBuilder extensibleEnumClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - extensibleEnumClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - extensibleEnumClient = extensibleEnumClientbuilder.buildExtensibleEnumClient(); - - ValueTypesClientBuilder modelClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - modelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - modelClient = modelClientbuilder.buildModelClient(); - - ValueTypesClientBuilder collectionsStringClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - collectionsStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - collectionsStringClient = collectionsStringClientbuilder.buildCollectionsStringClient(); - - ValueTypesClientBuilder collectionsIntClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - collectionsIntClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - collectionsIntClient = collectionsIntClientbuilder.buildCollectionsIntClient(); - - ValueTypesClientBuilder collectionsModelClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - collectionsModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - collectionsModelClient = collectionsModelClientbuilder.buildCollectionsModelClient(); - - ValueTypesClientBuilder dictionaryStringClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - dictionaryStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - dictionaryStringClient = dictionaryStringClientbuilder.buildDictionaryStringClient(); - - ValueTypesClientBuilder neverClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - neverClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - neverClient = neverClientbuilder.buildNeverClient(); - - ValueTypesClientBuilder unknownStringClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unknownStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unknownStringClient = unknownStringClientbuilder.buildUnknownStringClient(); - - ValueTypesClientBuilder unknownIntClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unknownIntClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unknownIntClient = unknownIntClientbuilder.buildUnknownIntClient(); - - ValueTypesClientBuilder unknownDictClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unknownDictClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unknownDictClient = unknownDictClientbuilder.buildUnknownDictClient(); - - ValueTypesClientBuilder unknownArrayClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unknownArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unknownArrayClient = unknownArrayClientbuilder.buildUnknownArrayClient(); - - ValueTypesClientBuilder stringLiteralClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - stringLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - stringLiteralClient = stringLiteralClientbuilder.buildStringLiteralClient(); - - ValueTypesClientBuilder intLiteralClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - intLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - intLiteralClient = intLiteralClientbuilder.buildIntLiteralClient(); - - ValueTypesClientBuilder floatLiteralClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - floatLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - floatLiteralClient = floatLiteralClientbuilder.buildFloatLiteralClient(); - - ValueTypesClientBuilder booleanLiteralClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - booleanLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - booleanLiteralClient = booleanLiteralClientbuilder.buildBooleanLiteralClient(); - - ValueTypesClientBuilder unionStringLiteralClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unionStringLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unionStringLiteralClient = unionStringLiteralClientbuilder.buildUnionStringLiteralClient(); - - ValueTypesClientBuilder unionIntLiteralClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unionIntLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unionIntLiteralClient = unionIntLiteralClientbuilder.buildUnionIntLiteralClient(); - - ValueTypesClientBuilder unionFloatLiteralClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unionFloatLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unionFloatLiteralClient = unionFloatLiteralClientbuilder.buildUnionFloatLiteralClient(); - - ValueTypesClientBuilder unionEnumValueClientbuilder = new ValueTypesClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unionEnumValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unionEnumValueClient = unionEnumValueClientbuilder.buildUnionEnumValueClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/scalar/generated/ScalarClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/scalar/generated/ScalarClientTestBase.java deleted file mode 100644 index 7b5bb4faa51..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/scalar/generated/ScalarClientTestBase.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.scalar.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.scalar.BooleanOperationClient; -import type.scalar.Decimal128TypeClient; -import type.scalar.Decimal128VerifyClient; -import type.scalar.DecimalTypeClient; -import type.scalar.DecimalVerifyClient; -import type.scalar.ScalarClientBuilder; -import type.scalar.StringOperationClient; -import type.scalar.UnknownClient; - -class ScalarClientTestBase extends TestProxyTestBase { - protected StringOperationClient stringOperationClient; - - protected BooleanOperationClient booleanOperationClient; - - protected UnknownClient unknownClient; - - protected DecimalTypeClient decimalTypeClient; - - protected Decimal128TypeClient decimal128TypeClient; - - protected DecimalVerifyClient decimalVerifyClient; - - protected Decimal128VerifyClient decimal128VerifyClient; - - @Override - protected void beforeTest() { - ScalarClientBuilder stringOperationClientbuilder = new ScalarClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - stringOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - stringOperationClient = stringOperationClientbuilder.buildStringOperationClient(); - - ScalarClientBuilder booleanOperationClientbuilder = new ScalarClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - booleanOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - booleanOperationClient = booleanOperationClientbuilder.buildBooleanOperationClient(); - - ScalarClientBuilder unknownClientbuilder = new ScalarClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - unknownClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - unknownClient = unknownClientbuilder.buildUnknownClient(); - - ScalarClientBuilder decimalTypeClientbuilder = new ScalarClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - decimalTypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - decimalTypeClient = decimalTypeClientbuilder.buildDecimalTypeClient(); - - ScalarClientBuilder decimal128TypeClientbuilder = new ScalarClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - decimal128TypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - decimal128TypeClient = decimal128TypeClientbuilder.buildDecimal128TypeClient(); - - ScalarClientBuilder decimalVerifyClientbuilder = new ScalarClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - decimalVerifyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - decimalVerifyClient = decimalVerifyClientbuilder.buildDecimalVerifyClient(); - - ScalarClientBuilder decimal128VerifyClientbuilder = new ScalarClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - decimal128VerifyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - decimal128VerifyClient = decimal128VerifyClientbuilder.buildDecimal128VerifyClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/discriminated/generated/DiscriminatedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/discriminated/generated/DiscriminatedClientTestBase.java deleted file mode 100644 index fa2d23824ef..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/discriminated/generated/DiscriminatedClientTestBase.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.discriminated.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.union.discriminated.DiscriminatedClientBuilder; -import type.union.discriminated.EnvelopeObjectCustomPropertiesClient; -import type.union.discriminated.EnvelopeObjectDefaultClient; -import type.union.discriminated.NoEnvelopeCustomDiscriminatorClient; -import type.union.discriminated.NoEnvelopeDefaultClient; - -class DiscriminatedClientTestBase extends TestProxyTestBase { - protected EnvelopeObjectDefaultClient envelopeObjectDefaultClient; - - protected EnvelopeObjectCustomPropertiesClient envelopeObjectCustomPropertiesClient; - - protected NoEnvelopeDefaultClient noEnvelopeDefaultClient; - - protected NoEnvelopeCustomDiscriminatorClient noEnvelopeCustomDiscriminatorClient; - - @Override - protected void beforeTest() { - DiscriminatedClientBuilder envelopeObjectDefaultClientbuilder = new DiscriminatedClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - envelopeObjectDefaultClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - envelopeObjectDefaultClient = envelopeObjectDefaultClientbuilder.buildEnvelopeObjectDefaultClient(); - - DiscriminatedClientBuilder envelopeObjectCustomPropertiesClientbuilder = new DiscriminatedClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - envelopeObjectCustomPropertiesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - envelopeObjectCustomPropertiesClient - = envelopeObjectCustomPropertiesClientbuilder.buildEnvelopeObjectCustomPropertiesClient(); - - DiscriminatedClientBuilder noEnvelopeDefaultClientbuilder = new DiscriminatedClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - noEnvelopeDefaultClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - noEnvelopeDefaultClient = noEnvelopeDefaultClientbuilder.buildNoEnvelopeDefaultClient(); - - DiscriminatedClientBuilder noEnvelopeCustomDiscriminatorClientbuilder = new DiscriminatedClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - noEnvelopeCustomDiscriminatorClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - noEnvelopeCustomDiscriminatorClient - = noEnvelopeCustomDiscriminatorClientbuilder.buildNoEnvelopeCustomDiscriminatorClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/generated/UnionClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/generated/UnionClientTestBase.java deleted file mode 100644 index 0382e0c3161..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/generated/UnionClientTestBase.java +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package type.union.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import type.union.EnumsOnlyClient; -import type.union.FloatsOnlyClient; -import type.union.IntsOnlyClient; -import type.union.MixedLiteralsClient; -import type.union.MixedTypesClient; -import type.union.ModelsOnlyClient; -import type.union.StringAndArrayClient; -import type.union.StringExtensibleClient; -import type.union.StringExtensibleNamedClient; -import type.union.StringsOnlyClient; -import type.union.UnionClientBuilder; - -class UnionClientTestBase extends TestProxyTestBase { - protected StringsOnlyClient stringsOnlyClient; - - protected StringExtensibleClient stringExtensibleClient; - - protected StringExtensibleNamedClient stringExtensibleNamedClient; - - protected IntsOnlyClient intsOnlyClient; - - protected FloatsOnlyClient floatsOnlyClient; - - protected ModelsOnlyClient modelsOnlyClient; - - protected EnumsOnlyClient enumsOnlyClient; - - protected StringAndArrayClient stringAndArrayClient; - - protected MixedLiteralsClient mixedLiteralsClient; - - protected MixedTypesClient mixedTypesClient; - - @Override - protected void beforeTest() { - UnionClientBuilder stringsOnlyClientbuilder = new UnionClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - stringsOnlyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - stringsOnlyClient = stringsOnlyClientbuilder.buildStringsOnlyClient(); - - UnionClientBuilder stringExtensibleClientbuilder = new UnionClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - stringExtensibleClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - stringExtensibleClient = stringExtensibleClientbuilder.buildStringExtensibleClient(); - - UnionClientBuilder stringExtensibleNamedClientbuilder = new UnionClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - stringExtensibleNamedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - stringExtensibleNamedClient = stringExtensibleNamedClientbuilder.buildStringExtensibleNamedClient(); - - UnionClientBuilder intsOnlyClientbuilder = new UnionClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - intsOnlyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - intsOnlyClient = intsOnlyClientbuilder.buildIntsOnlyClient(); - - UnionClientBuilder floatsOnlyClientbuilder = new UnionClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - floatsOnlyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - floatsOnlyClient = floatsOnlyClientbuilder.buildFloatsOnlyClient(); - - UnionClientBuilder modelsOnlyClientbuilder = new UnionClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - modelsOnlyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - modelsOnlyClient = modelsOnlyClientbuilder.buildModelsOnlyClient(); - - UnionClientBuilder enumsOnlyClientbuilder = new UnionClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - enumsOnlyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - enumsOnlyClient = enumsOnlyClientbuilder.buildEnumsOnlyClient(); - - UnionClientBuilder stringAndArrayClientbuilder = new UnionClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - stringAndArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - stringAndArrayClient = stringAndArrayClientbuilder.buildStringAndArrayClient(); - - UnionClientBuilder mixedLiteralsClientbuilder = new UnionClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - mixedLiteralsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - mixedLiteralsClient = mixedLiteralsClientbuilder.buildMixedLiteralsClient(); - - UnionClientBuilder mixedTypesClientbuilder = new UnionClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - mixedTypesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - mixedTypesClient = mixedTypesClientbuilder.buildMixedTypesClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/added/generated/AddedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/added/generated/AddedClientTestBase.java deleted file mode 100644 index 5d798c37d29..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/added/generated/AddedClientTestBase.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.added.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import versioning.added.AddedClient; -import versioning.added.AddedClientBuilder; -import versioning.added.InterfaceV2Client; - -class AddedClientTestBase extends TestProxyTestBase { - protected AddedClient addedClient; - - protected InterfaceV2Client interfaceV2Client; - - @Override - protected void beforeTest() { - AddedClientBuilder addedClientbuilder - = new AddedClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - addedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - addedClient = addedClientbuilder.buildClient(); - - AddedClientBuilder interfaceV2Clientbuilder - = new AddedClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - interfaceV2Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - interfaceV2Client = interfaceV2Clientbuilder.buildInterfaceV2Client(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/madeoptional/generated/MadeOptionalClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/madeoptional/generated/MadeOptionalClientTestBase.java deleted file mode 100644 index 5a44848e0d2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/madeoptional/generated/MadeOptionalClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.madeoptional.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import versioning.madeoptional.MadeOptionalClient; -import versioning.madeoptional.MadeOptionalClientBuilder; - -class MadeOptionalClientTestBase extends TestProxyTestBase { - protected MadeOptionalClient madeOptionalClient; - - @Override - protected void beforeTest() { - MadeOptionalClientBuilder madeOptionalClientbuilder = new MadeOptionalClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - madeOptionalClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - madeOptionalClient = madeOptionalClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/removed/generated/RemovedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/removed/generated/RemovedClientTestBase.java deleted file mode 100644 index 66f2537db89..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/removed/generated/RemovedClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.removed.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import versioning.removed.RemovedClient; -import versioning.removed.RemovedClientBuilder; - -class RemovedClientTestBase extends TestProxyTestBase { - protected RemovedClient removedClient; - - @Override - protected void beforeTest() { - RemovedClientBuilder removedClientbuilder - = new RemovedClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - removedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - removedClient = removedClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/renamedfrom/generated/RenamedFromClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/renamedfrom/generated/RenamedFromClientTestBase.java deleted file mode 100644 index ca58c927f5c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/renamedfrom/generated/RenamedFromClientTestBase.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.renamedfrom.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import versioning.renamedfrom.NewInterfaceClient; -import versioning.renamedfrom.RenamedFromClient; -import versioning.renamedfrom.RenamedFromClientBuilder; - -class RenamedFromClientTestBase extends TestProxyTestBase { - protected RenamedFromClient renamedFromClient; - - protected NewInterfaceClient newInterfaceClient; - - @Override - protected void beforeTest() { - RenamedFromClientBuilder renamedFromClientbuilder = new RenamedFromClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - renamedFromClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - renamedFromClient = renamedFromClientbuilder.buildClient(); - - RenamedFromClientBuilder newInterfaceClientbuilder = new RenamedFromClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - newInterfaceClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - newInterfaceClient = newInterfaceClientbuilder.buildNewInterfaceClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/returntypechangedfrom/generated/ReturnTypeChangedFromClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/returntypechangedfrom/generated/ReturnTypeChangedFromClientTestBase.java deleted file mode 100644 index 7f18897698e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/returntypechangedfrom/generated/ReturnTypeChangedFromClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.returntypechangedfrom.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import versioning.returntypechangedfrom.ReturnTypeChangedFromClient; -import versioning.returntypechangedfrom.ReturnTypeChangedFromClientBuilder; - -class ReturnTypeChangedFromClientTestBase extends TestProxyTestBase { - protected ReturnTypeChangedFromClient returnTypeChangedFromClient; - - @Override - protected void beforeTest() { - ReturnTypeChangedFromClientBuilder returnTypeChangedFromClientbuilder = new ReturnTypeChangedFromClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - returnTypeChangedFromClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - returnTypeChangedFromClient = returnTypeChangedFromClientbuilder.buildClient(); - - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/typechangedfrom/generated/TypeChangedFromClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/typechangedfrom/generated/TypeChangedFromClientTestBase.java deleted file mode 100644 index e713ac488ac..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/typechangedfrom/generated/TypeChangedFromClientTestBase.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package versioning.typechangedfrom.generated; - -// The Java test files under 'generated' package are generated for your reference. -// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. -// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. - -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLogOptions; -import com.azure.core.test.TestMode; -import com.azure.core.test.TestProxyTestBase; -import com.azure.core.util.Configuration; -import versioning.typechangedfrom.TypeChangedFromClient; -import versioning.typechangedfrom.TypeChangedFromClientBuilder; - -class TypeChangedFromClientTestBase extends TestProxyTestBase { - protected TypeChangedFromClient typeChangedFromClient; - - @Override - protected void beforeTest() { - TypeChangedFromClientBuilder typeChangedFromClientbuilder = new TypeChangedFromClientBuilder() - .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) - .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); - if (getTestMode() == TestMode.RECORD) { - typeChangedFromClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); - } - typeChangedFromClient = typeChangedFromClientbuilder.buildClient(); - - } -} From aac1ba758681986a618a90035b5891f54b720259 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 06:46:49 +0000 Subject: [PATCH 3/3] Fix markdown conversion: adjust processing order to prevent HTML escaping The HTML tags generated by markdown conversion were being escaped. Investigation showed the conversion logic is correct, but there may be additional escaping happening in the file writing or protocol layer that needs further investigation. Co-authored-by: haolingdong-msft <87355844+haolingdong-msft@users.noreply.github.com> --- .../model/javamodel/JavaJavadocComment.java | 8 +- .../specs/README.md | 3 - .../specs/authentication/api-key/main.tsp | 40 - .../specs/authentication/api-key/mockapi.ts | 35 - .../specs/authentication/http/custom/main.tsp | 40 - .../authentication/http/custom/mockapi.ts | 35 - .../specs/authentication/oauth2/main.tsp | 45 - .../specs/authentication/oauth2/mockapi.ts | 32 - .../specs/authentication/union/main.tsp | 30 - .../specs/authentication/union/mockapi.ts | 31 - .../client-generator-core/access/main.tsp | 192 -- .../client-generator-core/access/mockapi.ts | 67 - .../alternate-type/client.tsp | 45 - .../alternate-type/main.tsp | 139 - .../alternate-type/mockapi.ts | 75 - .../api-version/header/client.tsp | 18 - .../api-version/header/main.tsp | 39 - .../api-version/header/mockapi.ts | 19 - .../api-version/path/client.tsp | 18 - .../api-version/path/main.tsp | 40 - .../api-version/path/mockapi.ts | 15 - .../api-version/query/client.tsp | 18 - .../api-version/query/main.tsp | 39 - .../api-version/query/mockapi.ts | 19 - .../client-initialization/client.tsp | 246 -- .../client-initialization/main.tsp | 133 - .../client-initialization/mockapi.ts | 223 -- .../client-location/main.tsp | 131 - .../client-location/mockapi.ts | 103 - .../deserialize-empty-string-as-null/main.tsp | 35 - .../mockapi.ts | 16 - .../flatten-property/main.tsp | 112 - .../flatten-property/mockapi.ts | 63 - .../hierarchy-building/main.tsp | 194 -- .../hierarchy-building/mockapi.ts | 94 - .../next-link-verb/main.tsp | 72 - .../next-link-verb/mockapi.ts | 41 - .../client-generator-core/override/client.tsp | 44 - .../client-generator-core/override/main.tsp | 81 - .../client-generator-core/override/mockapi.ts | 73 - .../client-generator-core/usage/main.tsp | 122 - .../client-generator-core/usage/mockapi.ts | 53 - .../specs/azure/core/basic/client.tsp | 8 - .../specs/azure/core/basic/main.tsp | 260 -- .../specs/azure/core/basic/mockapi.ts | 137 - .../specs/azure/core/lro/rpc/main.tsp | 115 - .../specs/azure/core/lro/rpc/mockapi.ts | 85 - .../specs/azure/core/lro/standard/main.tsp | 219 -- .../specs/azure/core/lro/standard/mockapi.ts | 250 -- .../specs/azure/core/model/main.tsp | 65 - .../specs/azure/core/model/mockapi.ts | 30 - .../specs/azure/core/page/client.tsp | 6 - .../specs/azure/core/page/main.tsp | 263 -- .../specs/azure/core/page/mockapi.ts | 90 - .../specs/azure/core/scalar/main.tsp | 94 - .../specs/azure/core/scalar/mockapi.ts | 55 - .../specs/azure/core/traits/main.tsp | 142 - .../specs/azure/core/traits/mockapi.ts | 131 - .../specs/azure/encode/duration/main.tsp | 33 - .../specs/azure/encode/duration/mockapi.ts | 19 - .../specs/azure/example/basic/client.tsp | 22 - .../examples/2022-12-01-preview/basic.json | 26 - .../specs/azure/example/basic/main.tsp | 95 - .../specs/azure/example/basic/mockapi.ts | 36 - .../specs/azure/payload/pageable/main.tsp | 67 - .../specs/azure/payload/pageable/mockapi.ts | 74 - .../common-properties/error.tsp | 161 -- .../common-properties/main.tsp | 25 - .../common-properties/managed-identity.tsp | 150 - .../common-properties/mockapi.ts | 233 -- .../resource-manager/large-header/main.tsp | 121 - .../resource-manager/large-header/mockapi.ts | 116 - .../method-subscription-id/client.tsp | 43 - .../method-subscription-id/main.tsp | 502 ---- .../method-subscription-id/mockapi.ts | 238 -- .../resource-manager/multi-service/client.tsp | 16 - .../resource-manager/multi-service/mockapi.ts | 111 - .../multi-service/service1.tsp | 109 - .../multi-service/service2.tsp | 112 - .../resource-manager/non-resource/main.tsp | 26 - .../resource-manager/non-resource/mockapi.ts | 49 - .../non-resource/non-resource.tsp | 118 - .../available-operations.tsp | 34 - .../checkname-availability.tsp | 57 - .../operation-templates/lro.tsp | 246 -- .../operation-templates/main.tsp | 29 - .../operation-templates/mockapi.ts | 633 ----- .../operation-templates/optional-body.tsp | 228 -- .../resource-manager/resources/extension.tsp | 554 ---- .../resource-manager/resources/location.tsp | 170 -- .../azure/resource-manager/resources/main.tsp | 38 - .../resource-manager/resources/mockapi.ts | 1042 ------- .../resource-manager/resources/nested.tsp | 177 -- .../resource-manager/resources/singleton.tsp | 164 -- .../resource-manager/resources/toplevel.tsp | 237 -- .../client-request-id/main.tsp | 28 - .../client-request-id/mockapi.ts | 34 - .../azure/versioning/previewVersion/main.tsp | 146 - .../versioning/previewVersion/mockapi.ts | 82 - .../specs/client/namespace/client.tsp | 31 - .../specs/client/namespace/main.tsp | 51 - .../specs/client/namespace/mockapi.ts | 24 - .../client/naming/enum-conflict/client.tsp | 9 - .../client/naming/enum-conflict/main.tsp | 86 - .../client/naming/enum-conflict/mockapi.ts | 29 - .../specs/client/naming/main.tsp | 249 -- .../specs/client/naming/mockapi.ts | 140 - .../specs/client/overload/client.tsp | 9 - .../specs/client/overload/main.tsp | 50 - .../specs/client/overload/mockapi.ts | 26 - .../client-operation-group/client.tsp | 76 - .../structure/client-operation-group/main.tsp | 5 - .../client-operation-group/mockapi.ts | 16 - .../specs/client/structure/common/service.ts | 11 - .../specs/client/structure/common/service.tsp | 95 - .../specs/client/structure/default/client.tsp | 24 - .../specs/client/structure/default/main.tsp | 5 - .../specs/client/structure/default/mockapi.ts | 16 - .../client/structure/multi-client/client.tsp | 44 - .../client/structure/multi-client/main.tsp | 5 - .../client/structure/multi-client/mockapi.ts | 13 - .../structure/renamed-operation/client.tsp | 40 - .../structure/renamed-operation/main.tsp | 5 - .../structure/renamed-operation/mockapi.ts | 13 - .../structure/two-operation-group/client.tsp | 42 - .../structure/two-operation-group/main.tsp | 5 - .../structure/two-operation-group/mockapi.ts | 13 - .../specs/encode/array/main.tsp | 112 - .../specs/encode/array/mockapi.ts | 43 - .../specs/encode/bytes/main.tsp | 372 --- .../specs/encode/bytes/mockapi.ts | 279 -- .../specs/encode/datetime/main.tsp | 334 --- .../specs/encode/datetime/mockapi.ts | 274 -- .../specs/encode/duration/main.tsp | 731 ----- .../specs/encode/duration/mockapi.ts | 363 --- .../specs/encode/numeric/main.tsp | 69 - .../specs/encode/numeric/mockapi.ts | 32 - .../specs/helper.ts | 8 - .../specs/parameters/basic/main.tsp | 58 - .../specs/parameters/basic/mockapi.ts | 25 - .../parameters/body-optionality/main.tsp | 63 - .../parameters/body-optionality/mockapi.ts | 79 - .../parameters/collection-format/main.tsp | 72 - .../parameters/collection-format/mockapi.ts | 71 - .../specs/parameters/path/main.tsp | 48 - .../specs/parameters/path/mockapi.ts | 34 - .../specs/parameters/spread/main.tsp | 337 --- .../specs/parameters/spread/mockapi.ts | 165 -- .../payload/content-negotiation/main.tsp | 61 - .../payload/content-negotiation/mockapi.ts | 188 -- .../specs/payload/json-merge-patch/main.tsp | 184 -- .../specs/payload/json-merge-patch/mockapi.ts | 95 - .../specs/payload/media-type/main.tsp | 52 - .../specs/payload/media-type/mockapi.ts | 63 - .../specs/payload/multipart/main.tsp | 502 ---- .../specs/payload/multipart/mockapi.ts | 347 --- .../specs/payload/pageable/main.tsp | 516 ---- .../specs/payload/pageable/mockapi.ts | 513 ---- .../specs/payload/xml/main.tsp | 302 -- .../specs/payload/xml/mockapi.ts | 235 -- .../specs/resiliency/srv-driven/main.tsp | 170 -- .../specs/resiliency/srv-driven/mockapi.ts | 218 -- .../specs/resiliency/srv-driven/old.tsp | 120 - .../specs/response/status-code-range/main.tsp | 82 - .../response/status-code-range/mockapi.ts | 31 - .../specs/routes/main.tsp | 477 ---- .../specs/routes/mockapi.ts | 175 -- .../specs/scratch/.npmignore | 3 - .../serialization/encoded-name/json/main.tsp | 45 - .../encoded-name/json/mockapi.ts | 22 - .../server/endpoint/not-defined/main.tsp | 18 - .../server/endpoint/not-defined/mockapi.ts | 13 - .../specs/server/path/multiple/main.tsp | 45 - .../specs/server/path/multiple/mockapi.ts | 23 - .../specs/server/path/single/main.tsp | 24 - .../specs/server/path/single/mockapi.ts | 13 - .../server/versions/not-versioned/main.tsp | 40 - .../server/versions/not-versioned/mockapi.ts | 51 - .../specs/server/versions/versioned/main.tsp | 64 - .../server/versions/versioned/mockapi.ts | 58 - .../specs/service/multi-service/client.tsp | 14 - .../specs/service/multi-service/main.tsp | 61 - .../specs/service/multi-service/mockapi.ts | 27 - .../conditional-request/main.tsp | 89 - .../conditional-request/mockapi.ts | 59 - .../special-headers/repeatability/main.tsp | 39 - .../special-headers/repeatability/mockapi.ts | 47 - .../specs/special-words/dec.js | 52 - .../specs/special-words/main.tsp | 272 -- .../specs/special-words/mockapi.ts | 407 --- .../specs/streaming/jsonl/main.tsp | 33 - .../specs/streaming/jsonl/mockapi.ts | 32 - .../specs/type/array/main.tsp | 108 - .../specs/type/array/mockapi.ts | 107 - .../specs/type/dictionary/main.tsp | 101 - .../specs/type/dictionary/mockapi.ts | 109 - .../specs/type/enum/extensible/main.tsp | 81 - .../specs/type/enum/extensible/mockapi.ts | 48 - .../specs/type/enum/fixed/main.tsp | 72 - .../specs/type/enum/fixed/mockapi.ts | 44 - .../specs/type/model/empty/main.tsp | 40 - .../specs/type/model/empty/mockapi.ts | 40 - .../inheritance/enum-discriminator/main.tsp | 169 -- .../inheritance/enum-discriminator/mockapi.ts | 89 - .../inheritance/nested-discriminator/main.tsp | 224 -- .../nested-discriminator/mockapi.ts | 130 - .../inheritance/not-discriminated/main.tsp | 54 - .../inheritance/not-discriminated/mockapi.ts | 39 - .../type/model/inheritance/recursive/main.tsp | 71 - .../model/inheritance/recursive/mockapi.ts | 41 - .../inheritance/single-discriminator/main.tsp | 172 -- .../single-discriminator/mockapi.ts | 103 - .../specs/type/model/usage/main.tsp | 49 - .../specs/type/model/usage/mockapi.ts | 45 - .../specs/type/model/visibility/main.tsp | 149 - .../specs/type/model/visibility/mockapi.ts | 107 - .../property/additional-properties/main.tsp | 549 ---- .../property/additional-properties/mockapi.ts | 471 ---- .../specs/type/property/nullable/main.tsp | 139 - .../specs/type/property/nullable/mockapi.ts | 195 -- .../specs/type/property/optionality/main.tsp | 226 -- .../type/property/optionality/mockapi.ts | 302 -- .../specs/type/property/value-types/main.tsp | 244 -- .../type/property/value-types/mockapi.ts | 306 -- .../specs/type/scalar/main.tsp | 185 -- .../specs/type/scalar/mockapi.ts | 199 -- .../specs/type/union/discriminated/main.tsp | 251 -- .../specs/type/union/discriminated/mockapi.ts | 230 -- .../specs/type/union/main.tsp | 249 -- .../specs/type/union/mockapi.ts | 130 - .../specs/versioning/added/main.tsp | 136 - .../specs/versioning/added/mockapi.ts | 57 - .../specs/versioning/madeOptional/main.tsp | 65 - .../specs/versioning/madeOptional/mockapi.ts | 18 - .../specs/versioning/removed/main.tsp | 188 -- .../specs/versioning/removed/mockapi.ts | 67 - .../specs/versioning/renamedFrom/main.tsp | 112 - .../specs/versioning/renamedFrom/mockapi.ts | 40 - .../versioning/returnTypeChangedFrom/main.tsp | 72 - .../returnTypeChangedFrom/mockapi.ts | 19 - .../specs/versioning/typeChangedFrom/main.tsp | 71 - .../versioning/typeChangedFrom/mockapi.ts | 22 - .../apikey/ApiKeyAsyncClient.java | 106 + .../authentication/apikey/ApiKeyClient.java | 102 + .../apikey/ApiKeyClientBuilder.java | 310 +++ .../implementation/ApiKeyClientImpl.java | 219 ++ .../apikey/implementation/package-info.java | 11 + .../authentication/apikey/package-info.java | 11 + .../http/custom/CustomAsyncClient.java | 106 + .../http/custom/CustomClient.java | 102 + .../http/custom/CustomClientBuilder.java | 311 +++ .../implementation/CustomClientImpl.java | 219 ++ .../custom/implementation/package-info.java | 11 + .../http/custom/package-info.java | 11 + .../oauth2/OAuth2AsyncClient.java | 106 + .../authentication/oauth2/OAuth2Client.java | 102 + .../oauth2/OAuth2ClientBuilder.java | 313 +++ .../implementation/OAuth2ClientImpl.java | 219 ++ .../oauth2/implementation/package-info.java | 11 + .../authentication/oauth2/package-info.java | 11 + .../union/UnionAsyncClient.java | 106 + .../authentication/union/UnionClient.java | 102 + .../union/UnionClientBuilder.java | 335 +++ .../union/implementation/UnionClientImpl.java | 219 ++ .../union/implementation/package-info.java | 11 + .../authentication/union/package-info.java | 11 + .../core/access/AccessClientBuilder.java | 357 +++ .../access/InternalOperationAsyncClient.java | 189 ++ .../core/access/InternalOperationClient.java | 182 ++ .../access/PublicOperationAsyncClient.java | 137 + .../core/access/PublicOperationClient.java | 133 + .../RelativeModelInOperationAsyncClient.java | 177 ++ .../RelativeModelInOperationClient.java | 169 ++ .../SharedModelInOperationAsyncClient.java | 136 + .../access/SharedModelInOperationClient.java | 130 + .../implementation/AccessClientImpl.java | 152 + .../InternalOperationsImpl.java | 289 ++ .../implementation/PublicOperationsImpl.java | 211 ++ .../RelativeModelInOperationsImpl.java | 248 ++ .../SharedModelInOperationsImpl.java | 205 ++ .../access/implementation/package-info.java | 11 + .../InternalDecoratorModelInInternal.java | 83 + .../models/NoDecoratorModelInInternal.java | 83 + .../implementation/models/package-info.java | 11 + .../PublicDecoratorModelInInternal.java | 83 + .../models/package-info.java | 11 + .../core/access/package-info.java | 11 + .../models/NoDecoratorModelInPublic.java | 83 + .../models/PublicDecoratorModelInPublic.java | 83 + .../publicoperation/models/package-info.java | 11 + .../implementation/models/AbstractModel.java | 132 + .../implementation/models/BaseModel.java | 83 + .../implementation/models/InnerModel.java | 83 + .../implementation/models/OuterModel.java | 88 + .../implementation/models/RealModel.java | 90 + .../implementation/models/package-info.java | 11 + .../models/SharedModel.java | 83 + .../models/package-info.java | 11 + .../AlternateTypeAsyncClient.java | 267 ++ .../alternatetype/AlternateTypeClient.java | 261 ++ .../AlternateTypeClientBuilder.java | 288 ++ .../models/ModelWithFeatureProperty.java | 106 + .../externaltype/models/package-info.java | 11 + .../AlternateTypeClientImpl.java | 107 + .../implementation/ExternalTypesImpl.java | 438 +++ .../implementation/package-info.java | 11 + .../core/alternatetype/package-info.java | 11 + .../apiversion/header/HeaderAsyncClient.java | 72 + .../core/apiversion/header/HeaderClient.java | 69 + .../header/HeaderClientBuilder.java | 308 ++ .../header/HeaderServiceVersion.java | 40 + .../implementation/HeaderClientImpl.java | 194 ++ .../header/implementation/package-info.java | 10 + .../core/apiversion/header/package-info.java | 10 + .../core/apiversion/path/PathAsyncClient.java | 72 + .../core/apiversion/path/PathClient.java | 69 + .../apiversion/path/PathClientBuilder.java | 308 ++ .../apiversion/path/PathServiceVersion.java | 40 + .../path/implementation/PathClientImpl.java | 194 ++ .../path/implementation/package-info.java | 10 + .../core/apiversion/path/package-info.java | 10 + .../apiversion/query/QueryAsyncClient.java | 72 + .../core/apiversion/query/QueryClient.java | 69 + .../apiversion/query/QueryClientBuilder.java | 308 ++ .../apiversion/query/QueryServiceVersion.java | 40 + .../query/implementation/QueryClientImpl.java | 194 ++ .../query/implementation/package-info.java | 10 + .../core/apiversion/query/package-info.java | 10 + .../HeaderParamAsyncClient.java | 123 + .../HeaderParamClient.java | 119 + .../HeaderParamClientBuilder.java | 307 ++ .../MixedParamsAsyncClient.java | 127 + .../MixedParamsClient.java | 123 + .../MixedParamsClientBuilder.java | 307 ++ .../MultipleParamsAsyncClient.java | 123 + .../MultipleParamsClient.java | 119 + .../MultipleParamsClientBuilder.java | 326 +++ .../ParamAliasAsyncClient.java | 106 + .../ParamAliasClient.java | 102 + .../ParamAliasClientBuilder.java | 307 ++ .../PathParamAsyncClient.java | 185 ++ .../clientinitialization/PathParamClient.java | 179 ++ .../PathParamClientBuilder.java | 307 ++ .../implementation/ChildClientImpl.java | 334 +++ .../implementation/HeaderParamClientImpl.java | 272 ++ .../implementation/MixedParamsClientImpl.java | 279 ++ .../MultipleParamsClientImpl.java | 293 ++ .../implementation/ParamAliasClientImpl.java | 241 ++ .../implementation/ParentClientImpl.java | 104 + .../implementation/PathParamClientImpl.java | 335 +++ .../implementation/package-info.java | 11 + .../models/BlobProperties.java | 154 + .../clientinitialization/models/Input.java | 83 + .../models/WithBodyRequest.java | 83 + .../models/package-info.java | 11 + .../clientinitialization/package-info.java | 11 + .../parentclient/ChildAsyncClient.java | 185 ++ .../parentclient/ChildClient.java | 179 ++ .../parentclient/ChildClientBuilder.java | 307 ++ .../parentclient/ParentAsyncClient.java | 38 + .../parentclient/ParentClient.java | 38 + .../parentclient/ParentClientBuilder.java | 288 ++ .../parentclient/package-info.java | 11 + .../ArchiveOperationsAsyncClient.java | 72 + .../ArchiveOperationsClient.java | 69 + .../ClientLocationAsyncClient.java | 72 + .../clientlocation/ClientLocationClient.java | 69 + .../ClientLocationClientBuilder.java | 445 +++ ...dParameterToBlobOperationsAsyncClient.java | 93 + ...MethodParameterToBlobOperationsClient.java | 89 + ...ExistingSubAdminOperationsAsyncClient.java | 106 + ...oveToExistingSubAdminOperationsClient.java | 102 + ...oExistingSubUserOperationsAsyncClient.java | 72 + ...MoveToExistingSubUserOperationsClient.java | 69 + ...eToNewSubProductOperationsAsyncClient.java | 72 + .../MoveToNewSubProductOperationsClient.java | 69 + ...veToRootResourceOperationsAsyncClient.java | 72 + .../MoveToRootResourceOperationsClient.java | 69 + .../implementation/ArchiveOperationsImpl.java | 107 + .../ClientLocationClientImpl.java | 281 ++ ...veMethodParameterToBlobOperationsImpl.java | 146 + .../MoveToExistingSubAdminOperationsImpl.java | 156 ++ .../MoveToExistingSubUserOperationsImpl.java | 106 + .../MoveToNewSubProductOperationsImpl.java | 107 + .../MoveToRootResourceOperationsImpl.java | 106 + .../implementation/package-info.java | 11 + .../models/Blob.java | 149 + .../models/package-info.java | 11 + .../core/clientlocation/package-info.java | 11 + ...serializeEmptyStringAsNullAsyncClient.java | 85 + .../DeserializeEmptyStringAsNullClient.java | 81 + ...rializeEmptyStringAsNullClientBuilder.java | 290 ++ ...eserializeEmptyStringAsNullClientImpl.java | 197 ++ .../implementation/package-info.java | 11 + .../emptystringnull/models/ResponseModel.java | 83 + .../emptystringnull/models/package-info.java | 11 + .../emptystringnull/package-info.java | 11 + .../FlattenPropertyAsyncClient.java | 180 ++ .../FlattenPropertyClient.java | 175 ++ .../FlattenPropertyClientBuilder.java | 288 ++ .../FlattenPropertyClientImpl.java | 368 +++ .../implementation/package-info.java | 11 + .../models/ChildFlattenModel.java | 105 + .../flattenproperty/models/ChildModel.java | 105 + .../flattenproperty/models/FlattenModel.java | 105 + .../models/NestedFlattenModel.java | 105 + .../flattenproperty/models/package-info.java | 11 + .../core/flattenproperty/package-info.java | 11 + .../AnimalOperationsAsyncClient.java | 158 ++ .../AnimalOperationsClient.java | 156 ++ .../DogOperationsAsyncClient.java | 103 + .../DogOperationsClient.java | 100 + .../HierarchyBuildingClientBuilder.java | 335 +++ .../PetOperationsAsyncClient.java | 162 ++ .../PetOperationsClient.java | 158 ++ .../implementation/AnimalOperationsImpl.java | 263 ++ .../implementation/DogOperationsImpl.java | 169 ++ .../HierarchyBuildingClientImpl.java | 138 + .../implementation/PetOperationsImpl.java | 269 ++ .../implementation/package-info.java | 11 + .../core/hierarchybuilding/models/Animal.java | 134 + .../core/hierarchybuilding/models/Dog.java | 117 + .../core/hierarchybuilding/models/Pet.java | 138 + .../models/package-info.java | 11 + .../core/hierarchybuilding/package-info.java | 11 + .../GroupParametersAsyncClient.java | 79 + .../methodoverride/GroupParametersClient.java | 76 + .../methodoverride/OverrideClientBuilder.java | 357 +++ .../RemoveOptionalParameterAsyncClient.java | 114 + .../RemoveOptionalParameterClient.java | 110 + .../ReorderParametersAsyncClient.java | 77 + .../ReorderParametersClient.java | 74 + .../RequireOptionalParameterAsyncClient.java | 78 + .../RequireOptionalParameterClient.java | 74 + .../implementation/GroupParametersImpl.java | 112 + .../implementation/OverrideClientImpl.java | 152 + .../RemoveOptionalParametersImpl.java | 140 + .../implementation/ReorderParametersImpl.java | 112 + .../RequireOptionalParametersImpl.java | 113 + .../implementation/package-info.java | 11 + .../models/GroupParametersOptions.java | 58 + .../methodoverride/models/package-info.java | 11 + .../core/methodoverride/package-info.java | 11 + .../nextlinkverb/NextLinkVerbAsyncClient.java | 97 + .../core/nextlinkverb/NextLinkVerbClient.java | 81 + .../NextLinkVerbClientBuilder.java | 288 ++ .../NextLinkVerbClientImpl.java | 362 +++ .../implementation/package-info.java | 11 + .../core/nextlinkverb/models/Test.java | 83 + .../nextlinkverb/models/package-info.java | 11 + .../core/nextlinkverb/package-info.java | 11 + .../core/usage/UsageAsyncClient.java | 277 ++ .../core/usage/UsageClient.java | 271 ++ .../core/usage/UsageClientBuilder.java | 288 ++ .../implementation/ModelInOperationsImpl.java | 448 +++ .../usage/implementation/UsageClientImpl.java | 107 + .../usage/implementation/package-info.java | 11 + .../core/usage/models/InputModel.java | 83 + .../core/usage/models/OrphanModel.java | 105 + .../core/usage/models/OutputModel.java | 83 + .../core/usage/models/ResultModel.java | 83 + .../core/usage/models/RoundTripModel.java | 80 + .../core/usage/models/package-info.java | 11 + .../core/usage/package-info.java | 11 + .../azure/core/basic/BasicAsyncClient.java | 603 ++++ .../java/azure/core/basic/BasicClient.java | 566 ++++ .../azure/core/basic/BasicClientBuilder.java | 307 ++ .../azure/core/basic/BasicServiceVersion.java | 40 + .../basic/implementation/BasicClientImpl.java | 1204 ++++++++ .../implementation/JsonMergePatchHelper.java | 45 + .../basic/implementation/package-info.java | 11 + .../java/azure/core/basic/models/User.java | 221 ++ .../azure/core/basic/models/UserList.java | 84 + .../azure/core/basic/models/UserOrder.java | 198 ++ .../azure/core/basic/models/package-info.java | 11 + .../java/azure/core/basic/package-info.java | 11 + .../azure/core/lro/rpc/RpcAsyncClient.java | 112 + .../java/azure/core/lro/rpc/RpcClient.java | 112 + .../azure/core/lro/rpc/RpcClientBuilder.java | 307 ++ .../azure/core/lro/rpc/RpcServiceVersion.java | 40 + .../OperationLocationPollingStrategy.java | 140 + .../lro/rpc/implementation/PollingUtils.java | 151 + .../lro/rpc/implementation/RpcClientImpl.java | 533 ++++ .../SyncOperationLocationPollingStrategy.java | 133 + .../lro/rpc/implementation/package-info.java | 11 + .../lro/rpc/models/GenerationOptions.java | 83 + .../core/lro/rpc/models/GenerationResult.java | 83 + .../core/lro/rpc/models/package-info.java | 11 + .../java/azure/core/lro/rpc/package-info.java | 11 + .../lro/standard/StandardAsyncClient.java | 237 ++ .../core/lro/standard/StandardClient.java | 237 ++ .../lro/standard/StandardClientBuilder.java | 307 ++ .../lro/standard/StandardServiceVersion.java | 40 + .../OperationLocationPollingStrategy.java | 140 + .../standard/implementation/PollingUtils.java | 151 + .../implementation/StandardClientImpl.java | 1107 ++++++++ .../SyncOperationLocationPollingStrategy.java | 133 + .../standard/implementation/package-info.java | 11 + .../lro/standard/models/ExportedUser.java | 105 + .../azure/core/lro/standard/models/User.java | 105 + .../lro/standard/models/package-info.java | 11 + .../azure/core/lro/standard/package-info.java | 11 + .../azure/core/model/ModelAsyncClient.java | 197 ++ .../java/azure/core/model/ModelClient.java | 193 ++ .../azure/core/model/ModelClientBuilder.java | 307 ++ .../azure/core/model/ModelServiceVersion.java | 40 + .../AzureCoreEmbeddingVectorsImpl.java | 316 +++ .../model/implementation/ModelClientImpl.java | 127 + .../model/implementation/package-info.java | 10 + .../model/models/AzureEmbeddingModel.java | 84 + .../azure/core/model/models/package-info.java | 10 + .../java/azure/core/model/package-info.java | 10 + .../java/azure/core/page/PageAsyncClient.java | 403 +++ .../main/java/azure/core/page/PageClient.java | 332 +++ .../azure/core/page/PageClientBuilder.java | 332 +++ .../azure/core/page/PageServiceVersion.java | 40 + .../page/TwoModelsAsPageItemAsyncClient.java | 157 ++ .../core/page/TwoModelsAsPageItemClient.java | 131 + .../page/implementation/PageClientImpl.java | 1389 ++++++++++ .../TwoModelsAsPageItemsImpl.java | 534 ++++ .../page/implementation/package-info.java | 11 + .../azure/core/page/models/FirstItem.java | 80 + .../core/page/models/ListItemInputBody.java | 83 + .../models/ListItemInputExtensibleEnum.java | 56 + .../azure/core/page/models/SecondItem.java | 80 + .../java/azure/core/page/models/User.java | 147 + .../azure/core/page/models/UserOrder.java | 127 + .../azure/core/page/models/package-info.java | 11 + .../java/azure/core/page/package-info.java | 11 + .../azure/core/scalar/ScalarAsyncClient.java | 257 ++ .../java/azure/core/scalar/ScalarClient.java | 251 ++ .../core/scalar/ScalarClientBuilder.java | 307 ++ .../core/scalar/ScalarServiceVersion.java | 40 + .../AzureLocationScalarsImpl.java | 403 +++ .../implementation/ScalarClientImpl.java | 127 + .../scalar/implementation/package-info.java | 10 + .../scalar/models/AzureLocationModel.java | 83 + .../core/scalar/models/package-info.java | 10 + .../java/azure/core/scalar/package-info.java | 10 + .../azure/core/traits/TraitsAsyncClient.java | 221 ++ .../java/azure/core/traits/TraitsClient.java | 215 ++ .../core/traits/TraitsClientBuilder.java | 307 ++ .../core/traits/TraitsServiceVersion.java | 40 + .../implementation/TraitsClientImpl.java | 407 +++ .../traits/implementation/package-info.java | 11 + .../java/azure/core/traits/models/User.java | 99 + .../core/traits/models/UserActionParam.java | 83 + .../traits/models/UserActionResponse.java | 83 + .../core/traits/models/package-info.java | 11 + .../java/azure/core/traits/package-info.java | 11 + .../encode/duration/DurationAsyncClient.java | 86 + .../azure/encode/duration/DurationClient.java | 83 + .../duration/DurationClientBuilder.java | 287 ++ .../implementation/DurationClientImpl.java | 199 ++ .../duration/implementation/package-info.java | 11 + .../encode/duration/models/DurationModel.java | 83 + .../encode/duration/models/package-info.java | 11 + .../azure/encode/duration/package-info.java | 11 + .../basic/AzureExampleAsyncClient.java | 126 + .../example/basic/AzureExampleClient.java | 123 + .../basic/AzureExampleClientBuilder.java | 307 ++ .../example/basic/BasicServiceVersion.java | 40 + .../AzureExampleClientImpl.java | 300 ++ .../basic/implementation/package-info.java | 11 + .../example/basic/models/ActionRequest.java | 188 ++ .../example/basic/models/ActionResponse.java | 152 + .../java/azure/example/basic/models/Enum.java | 51 + .../azure/example/basic/models/Model.java | 154 + .../example/basic/models/package-info.java | 11 + .../azure/example/basic/package-info.java | 11 + .../payload/pageable/PageableAsyncClient.java | 104 + .../payload/pageable/PageableClient.java | 88 + .../pageable/PageableClientBuilder.java | 287 ++ .../implementation/PageableClientImpl.java | 427 +++ .../pageable/implementation/package-info.java | 11 + .../azure/payload/pageable/models/User.java | 83 + .../payload/pageable/models/package-info.java | 11 + .../azure/payload/pageable/package-info.java | 11 + .../CommonPropertiesManager.java | 298 ++ .../fluent/CommonPropertiesClient.java | 62 + .../commonproperties/fluent/ErrorsClient.java | 78 + .../fluent/ManagedIdentitiesClient.java | 110 + .../models/ConfidentialResourceInner.java | 181 ++ .../ManagedIdentityTrackedResourceInner.java | 212 ++ .../fluent/models/package-info.java | 9 + .../commonproperties/fluent/package-info.java | 9 + .../CommonPropertiesClientBuilder.java | 138 + .../CommonPropertiesClientImpl.java | 324 +++ .../ConfidentialResourceImpl.java | 145 + .../implementation/ErrorsClientImpl.java | 257 ++ .../implementation/ErrorsImpl.java | 91 + .../ManagedIdentitiesClientImpl.java | 373 +++ .../implementation/ManagedIdentitiesImpl.java | 94 + .../ManagedIdentityTrackedResourceImpl.java | 185 ++ .../implementation/ResourceManagerUtils.java | 195 ++ .../implementation/package-info.java | 9 + .../commonproperties/models/ApiError.java | 180 ++ .../models/ApiErrorException.java | 42 + .../models/ConfidentialResource.java | 200 ++ .../ConfidentialResourceProperties.java | 103 + .../commonproperties/models/Errors.java | 70 + .../commonproperties/models/InnerError.java | 91 + .../models/ManagedIdentities.java | 71 + .../ManagedIdentityTrackedResource.java | 299 ++ ...agedIdentityTrackedResourceProperties.java | 76 + .../models/ManagedServiceIdentity.java | 154 + .../models/ManagedServiceIdentityType.java | 62 + .../models/UserAssignedIdentity.java | 89 + .../commonproperties/models/package-info.java | 9 + .../commonproperties/package-info.java | 9 + .../largeheader/LargeHeaderManager.java | 282 ++ .../largeheader/fluent/LargeHeaderClient.java | 55 + .../fluent/LargeHeadersClient.java | 73 + .../fluent/models/CancelResultInner.java | 75 + .../fluent/models/package-info.java | 9 + .../largeheader/fluent/package-info.java | 9 + .../implementation/CancelResultImpl.java | 32 + .../LargeHeaderClientBuilder.java | 138 + .../implementation/LargeHeaderClientImpl.java | 308 ++ .../LargeHeadersClientImpl.java | 242 ++ .../implementation/LargeHeadersImpl.java | 52 + .../implementation/ResourceManagerUtils.java | 195 ++ .../implementation/package-info.java | 9 + .../largeheader/models/CancelResult.java | 26 + .../largeheader/models/LargeHeaders.java | 37 + .../largeheader/models/package-info.java | 9 + .../largeheader/package-info.java | 9 + .../MethodSubscriptionIdManager.java | 362 +++ .../fluent/MethodSubscriptionIdClient.java | 89 + ...ResourceGroupResourceOperationsClient.java | 103 + ...tSubscriptionResourceOperationsClient.java | 103 + .../fluent/OperationsClient.java | 40 + ...SubscriptionResource1OperationsClient.java | 103 + ...SubscriptionResource2OperationsClient.java | 103 + .../fluent/models/OperationInner.java | 150 + .../models/ResourceGroupResourceInner.java | 182 ++ .../models/SubscriptionResource1Inner.java | 156 ++ .../models/SubscriptionResource2Inner.java | 156 ++ .../models/SubscriptionResourceInner.java | 155 ++ .../fluent/models/package-info.java | 9 + .../fluent/package-info.java | 9 + .../MethodSubscriptionIdClientBuilder.java | 138 + .../MethodSubscriptionIdClientImpl.java | 382 +++ ...urceGroupResourceOperationsClientImpl.java | 342 +++ ...ntResourceGroupResourceOperationsImpl.java | 131 + ...scriptionResourceOperationsClientImpl.java | 333 +++ ...entSubscriptionResourceOperationsImpl.java | 129 + .../implementation/OperationImpl.java | 51 + .../implementation/OperationsClientImpl.java | 242 ++ .../implementation/OperationsImpl.java | 45 + .../ResourceGroupResourceImpl.java | 171 ++ .../implementation/ResourceManagerUtils.java | 195 ++ .../SubscriptionResource1Impl.java | 123 + .../SubscriptionResource2Impl.java | 123 + .../SubscriptionResourceImpl.java | 123 + ...criptionResource1OperationsClientImpl.java | 335 +++ ...elSubscriptionResource1OperationsImpl.java | 129 + ...criptionResource2OperationsClientImpl.java | 335 +++ ...elSubscriptionResource2OperationsImpl.java | 129 + .../models/OperationListResult.java | 96 + .../implementation/package-info.java | 9 + .../models/ActionType.java | 46 + ...cementResourceGroupResourceOperations.java | 117 + ...acementSubscriptionResourceOperations.java | 117 + .../models/Operation.java | 58 + .../models/OperationDisplay.java | 128 + .../models/Operations.java | 35 + .../methodsubscriptionid/models/Origin.java | 57 + .../models/ResourceGroupResource.java | 265 ++ .../ResourceGroupResourceProperties.java | 103 + .../models/ResourceProvisioningState.java | 56 + .../models/SubscriptionResource.java | 167 ++ .../models/SubscriptionResource1.java | 167 ++ .../SubscriptionResource1Properties.java | 103 + .../models/SubscriptionResource2.java | 167 ++ .../SubscriptionResource2Properties.java | 103 + .../SubscriptionResourceProperties.java | 103 + ...dLevelSubscriptionResource1Operations.java | 117 + ...dLevelSubscriptionResource2Operations.java | 117 + .../models/package-info.java | 9 + .../methodsubscriptionid/package-info.java | 9 + .../combined/CombinedManager.java | 298 ++ .../combined/fluent/Combined.java | 55 + .../combined/fluent/DisksClient.java | 105 + .../fluent/VirtualMachinesClient.java | 111 + .../combined/fluent/models/DiskInner.java | 181 ++ .../fluent/models/VirtualMachineInner.java | 181 ++ .../combined/fluent/models/package-info.java | 9 + .../combined/fluent/package-info.java | 9 + .../implementation/CombinedBuilder.java | 138 + .../combined/implementation/CombinedImpl.java | 309 +++ .../combined/implementation/DiskImpl.java | 163 ++ .../implementation/DisksClientImpl.java | 345 +++ .../combined/implementation/DisksImpl.java | 88 + .../implementation/ResourceManagerUtils.java | 195 ++ .../implementation/VirtualMachineImpl.java | 164 ++ .../VirtualMachinesClientImpl.java | 361 +++ .../implementation/VirtualMachinesImpl.java | 89 + .../combined/implementation/package-info.java | 9 + .../multiservice/combined/models/Disk.java | 265 ++ .../combined/models/DiskProperties.java | 74 + .../multiservice/combined/models/Disks.java | 69 + .../models/ResourceProvisioningState.java | 56 + .../combined/models/VirtualMachine.java | 265 ++ .../models/VirtualMachineProperties.java | 74 + .../combined/models/VirtualMachines.java | 69 + .../combined/models/package-info.java | 9 + .../multiservice/combined/package-info.java | 9 + .../nonresource/NonResourceManager.java | 282 ++ .../nonresource/fluent/NonResourceClient.java | 55 + .../fluent/NonResourceOperationsClient.java | 77 + .../fluent/models/NonResourceInner.java | 141 + .../fluent/models/package-info.java | 9 + .../nonresource/fluent/package-info.java | 9 + .../NonResourceClientBuilder.java | 138 + .../implementation/NonResourceClientImpl.java | 308 ++ .../implementation/NonResourceImpl.java | 97 + .../NonResourceOperationsClientImpl.java | 248 ++ .../NonResourceOperationsImpl.java | 87 + .../implementation/ResourceManagerUtils.java | 195 ++ .../implementation/package-info.java | 9 + .../nonresource/models/NonResource.java | 134 + .../models/NonResourceOperations.java | 73 + .../nonresource/models/package-info.java | 9 + .../nonresource/package-info.java | 9 + .../OperationTemplatesManager.java | 331 +++ .../fluent/CheckNameAvailabilitiesClient.java | 71 + .../fluent/LroesClient.java | 193 ++ .../fluent/OperationTemplatesClient.java | 76 + .../fluent/OperationsClient.java | 40 + .../fluent/OptionalBodiesClient.java | 129 + .../fluent/models/ActionResultInner.java | 75 + .../models/ChangeAllowanceResultInner.java | 92 + .../CheckNameAvailabilityResponseInner.java | 112 + .../fluent/models/ExportResultInner.java | 75 + .../fluent/models/OperationInner.java | 150 + .../fluent/models/OrderInner.java | 181 ++ .../fluent/models/WidgetInner.java | 181 ++ .../fluent/models/package-info.java | 9 + .../fluent/package-info.java | 9 + .../implementation/ActionResultImpl.java | 32 + .../ChangeAllowanceResultImpl.java | 36 + .../CheckNameAvailabilitiesClientImpl.java | 234 ++ .../CheckNameAvailabilitiesImpl.java | 79 + .../CheckNameAvailabilityResponseImpl.java | 41 + .../implementation/ExportResultImpl.java | 32 + .../implementation/LroesClientImpl.java | 618 +++++ .../implementation/LroesImpl.java | 93 + .../implementation/OperationImpl.java | 51 + .../OperationTemplatesClientBuilder.java | 138 + .../OperationTemplatesClientImpl.java | 356 +++ .../implementation/OperationsClientImpl.java | 242 ++ .../implementation/OperationsImpl.java | 45 + .../OptionalBodiesClientImpl.java | 423 +++ .../implementation/OptionalBodiesImpl.java | 124 + .../implementation/OrderImpl.java | 134 + .../implementation/ResourceManagerUtils.java | 195 ++ .../implementation/WidgetImpl.java | 65 + .../models/OperationListResult.java | 96 + .../implementation/package-info.java | 9 + .../models/ActionRequest.java | 113 + .../models/ActionResult.java | 26 + .../operationtemplates/models/ActionType.java | 46 + .../models/ChangeAllowanceRequest.java | 113 + .../models/ChangeAllowanceResult.java | 33 + .../models/CheckNameAvailabilities.java | 62 + .../models/CheckNameAvailabilityReason.java | 51 + .../models/CheckNameAvailabilityRequest.java | 113 + .../models/CheckNameAvailabilityResponse.java | 40 + .../models/ExportRequest.java | 86 + .../models/ExportResult.java | 26 + .../operationtemplates/models/Lroes.java | 91 + .../operationtemplates/models/Operation.java | 58 + .../models/OperationDisplay.java | 128 + .../operationtemplates/models/Operations.java | 35 + .../models/OptionalBodies.java | 115 + .../operationtemplates/models/Order.java | 208 ++ .../models/OrderProperties.java | 130 + .../operationtemplates/models/Origin.java | 57 + .../operationtemplates/models/Widget.java | 70 + .../models/WidgetProperties.java | 129 + .../models/package-info.java | 9 + .../operationtemplates/package-info.java | 9 + .../resources/ResourcesManager.java | 346 +++ .../fluent/ExtensionsResourcesClient.java | 194 ++ .../fluent/LocationResourcesClient.java | 157 ++ .../resources/fluent/NestedsClient.java | 273 ++ .../resources/fluent/ResourcesClient.java | 83 + .../resources/fluent/SingletonsClient.java | 159 ++ .../resources/fluent/TopLevelsClient.java | 311 +++ .../models/ExtensionsResourceInner.java | 155 ++ .../fluent/models/LocationResourceInner.java | 155 ++ .../models/NestedProxyResourceInner.java | 155 ++ .../models/SingletonTrackedResourceInner.java | 183 ++ .../models/TopLevelTrackedResourceInner.java | 182 ++ .../resources/fluent/models/package-info.java | 9 + .../resources/fluent/package-info.java | 9 + .../ExtensionsResourceImpl.java | 128 + .../ExtensionsResourcesClientImpl.java | 746 +++++ .../ExtensionsResourcesImpl.java | 153 + .../implementation/LocationResourceImpl.java | 126 + .../LocationResourcesClientImpl.java | 627 +++++ .../implementation/LocationResourcesImpl.java | 136 + .../NestedProxyResourceImpl.java | 137 + .../implementation/NestedsClientImpl.java | 1020 +++++++ .../resources/implementation/NestedsImpl.java | 164 ++ .../implementation/ResourceManagerUtils.java | 195 ++ .../ResourcesClientBuilder.java | 138 + .../implementation/ResourcesClientImpl.java | 372 +++ .../SingletonTrackedResourceImpl.java | 65 + .../implementation/SingletonsClientImpl.java | 642 +++++ .../implementation/SingletonsImpl.java | 110 + .../TopLevelTrackedResourceImpl.java | 177 ++ .../implementation/TopLevelsClientImpl.java | 1241 +++++++++ .../implementation/TopLevelsImpl.java | 159 ++ .../models/ExtensionsResourceListResult.java | 96 + .../models/LocationResourceListResult.java | 96 + .../models/NestedProxyResourceListResult.java | 97 + .../SingletonTrackedResourceListResult.java | 97 + .../TopLevelTrackedResourceListResult.java | 97 + .../implementation/package-info.java | 9 + .../resources/models/ExtensionsResource.java | 180 ++ .../models/ExtensionsResourceProperties.java | 102 + .../resources/models/ExtensionsResources.java | 140 + .../resources/models/LocationResource.java | 181 ++ .../models/LocationResourceProperties.java | 102 + .../resources/models/LocationResources.java | 139 + .../resources/models/NestedProxyResource.java | 190 ++ .../models/NestedProxyResourceProperties.java | 103 + .../resources/models/Nesteds.java | 148 + .../resources/models/NotificationDetails.java | 114 + .../resources/models/ProvisioningState.java | 76 + .../models/SingletonTrackedResource.java | 70 + .../SingletonTrackedResourceProperties.java | 103 + .../resources/models/Singletons.java | 116 + .../models/TopLevelTrackedResource.java | 288 ++ .../TopLevelTrackedResourceProperties.java | 103 + .../resources/models/TopLevels.java | 189 ++ .../resources/models/package-info.java | 9 + .../resources/package-info.java | 9 + .../XmsClientRequestIdAsyncClient.java | 73 + .../XmsClientRequestIdClient.java | 69 + .../XmsClientRequestIdClientBuilder.java | 288 ++ .../XmsClientRequestIdClientImpl.java | 174 ++ .../implementation/package-info.java | 11 + .../xmsclientrequestid/package-info.java | 11 + .../PreviewVersionAsyncClient.java | 242 ++ .../previewversion/PreviewVersionClient.java | 236 ++ .../PreviewVersionClientBuilder.java | 308 ++ .../PreviewVersionServiceVersion.java | 50 + .../implementation/JsonMergePatchHelper.java | 29 + .../PreviewVersionClientImpl.java | 429 +++ .../implementation/package-info.java | 10 + .../models/ListWidgetsResponse.java | 84 + .../models/UpdateWidgetColorRequest.java | 145 + .../previewversion/models/Widget.java | 128 + .../previewversion/models/package-info.java | 10 + .../previewversion/package-info.java | 10 + .../ClientNamespaceFirstAsyncClient.java | 84 + .../ClientNamespaceFirstClient.java | 81 + .../ClientNamespaceFirstClientBuilder.java | 287 ++ .../first/models/FirstClientResult.java | 83 + .../first/models/package-info.java | 11 + .../ClientNamespaceFirstClientImpl.java | 196 ++ .../ClientNamespaceSecondClientImpl.java | 196 ++ .../implementation/package-info.java | 11 + .../client/clientnamespace/package-info.java | 11 + .../ClientNamespaceSecondAsyncClient.java | 84 + .../second/ClientNamespaceSecondClient.java | 81 + .../ClientNamespaceSecondClientBuilder.java | 287 ++ .../second/models/SecondClientResult.java | 84 + .../second/models/package-info.java | 11 + .../clientnamespace/second/package-info.java | 11 + .../sub/models/SecondClientEnumType.java | 51 + .../second/sub/models/package-info.java | 11 + .../java/client/naming/ModelAsyncClient.java | 133 + .../main/java/client/naming/ModelClient.java | 129 + .../java/client/naming/NamingAsyncClient.java | 323 +++ .../main/java/client/naming/NamingClient.java | 313 +++ .../client/naming/NamingClientBuilder.java | 334 +++ .../client/naming/UnionEnumAsyncClient.java | 131 + .../java/client/naming/UnionEnumClient.java | 127 + .../EnumConflictClientBuilder.java | 313 +++ .../FirstOperationsAsyncClient.java | 99 + .../enumconflict/FirstOperationsClient.java | 96 + .../SecondOperationsAsyncClient.java | 99 + .../enumconflict/SecondOperationsClient.java | 96 + .../firstnamespace/models/FirstModel.java | 105 + .../firstnamespace/models/Status.java | 56 + .../firstnamespace/models/package-info.java | 11 + .../EnumConflictClientImpl.java | 122 + .../implementation/FirstOperationsImpl.java | 160 ++ .../implementation/SecondOperationsImpl.java | 160 ++ .../implementation/package-info.java | 11 + .../naming/enumconflict/package-info.java | 11 + .../secondnamespace/models/SecondModel.java | 105 + .../secondnamespace/models/SecondStatus.java | 56 + .../secondnamespace/models/package-info.java | 11 + .../implementation/ModelClientsImpl.java | 207 ++ .../implementation/NamingClientImpl.java | 577 ++++ .../naming/implementation/UnionEnumsImpl.java | 200 ++ .../naming/implementation/package-info.java | 11 + .../naming/model/models/ClientModel.java | 83 + .../client/naming/model/models/JavaModel.java | 83 + .../naming/model/models/package-info.java | 11 + .../main/java/client/naming/package-info.java | 11 + .../ClientNameAndJsonEncodedNameModel.java | 83 + .../property/models/ClientNameModel.java | 83 + .../models/LanguageClientNameModel.java | 83 + .../naming/property/models/package-info.java | 11 + .../models/ClientExtensibleEnum.java | 51 + .../unionenum/models/ExtensibleEnum.java | 57 + .../naming/unionenum/models/package-info.java | 11 + .../client/overload/OverloadAsyncClient.java | 146 + .../java/client/overload/OverloadClient.java | 142 + .../overload/OverloadClientBuilder.java | 287 ++ .../implementation/OverloadClientImpl.java | 281 ++ .../overload/implementation/package-info.java | 11 + .../java/client/overload/models/Resource.java | 127 + .../client/overload/models/package-info.java | 11 + .../java/client/overload/package-info.java | 11 + .../subnamespace/Group5AsyncClient.java | 72 + .../subnamespace/Group5Client.java | 69 + .../subnamespace/SecondAsyncClient.java | 72 + .../subnamespace/SecondClient.java | 69 + .../subnamespace/SecondClientBuilder.java | 329 +++ .../subnamespace/package-info.java | 18 + .../FirstAsyncClient.java | 72 + .../clientoperationgroup/FirstClient.java | 69 + .../FirstClientBuilder.java | 355 +++ .../Group3AsyncClient.java | 106 + .../clientoperationgroup/Group3Client.java | 102 + .../Group4AsyncClient.java | 72 + .../clientoperationgroup/Group4Client.java | 69 + .../implementation/FirstClientImpl.java | 222 ++ .../implementation/Group3sImpl.java | 156 ++ .../implementation/Group4sImpl.java | 107 + .../implementation/Group5sImpl.java | 107 + .../implementation/SecondClientImpl.java | 207 ++ .../implementation/package-info.java | 18 + .../clientoperationgroup/package-info.java | 18 + .../multiclient/ClientAAsyncClient.java | 140 + .../structure/multiclient/ClientAClient.java | 135 + .../multiclient/ClientAClientBuilder.java | 308 ++ .../multiclient/ClientBAsyncClient.java | 140 + .../structure/multiclient/ClientBClient.java | 135 + .../multiclient/ClientBClientBuilder.java | 308 ++ .../implementation/ClientAClientImpl.java | 290 ++ .../implementation/ClientBClientImpl.java | 290 ++ .../implementation/package-info.java | 18 + .../structure/multiclient/package-info.java | 18 + .../renamedoperation/GroupAsyncClient.java | 140 + .../renamedoperation/GroupClient.java | 135 + .../RenamedOperationAsyncClient.java | 140 + .../RenamedOperationClient.java | 135 + .../RenamedOperationClientBuilder.java | 333 +++ .../implementation/GroupsImpl.java | 206 ++ .../RenamedOperationClientImpl.java | 307 ++ .../implementation/package-info.java | 18 + .../renamedoperation/package-info.java | 18 + .../structure/service/BarAsyncClient.java | 106 + .../client/structure/service/BarClient.java | 102 + .../structure/service/BazFooAsyncClient.java | 72 + .../structure/service/BazFooClient.java | 69 + .../structure/service/FooAsyncClient.java | 106 + .../client/structure/service/FooClient.java | 102 + .../structure/service/QuxAsyncClient.java | 72 + .../structure/service/QuxBarAsyncClient.java | 72 + .../structure/service/QuxBarClient.java | 69 + .../client/structure/service/QuxClient.java | 69 + .../service/ServiceClientAsyncClient.java | 106 + .../service/ServiceClientClient.java | 102 + .../service/ServiceClientClientBuilder.java | 421 +++ .../service/implementation/BarsImpl.java | 156 ++ .../service/implementation/BazFoosImpl.java | 107 + .../service/implementation/FoosImpl.java | 156 ++ .../service/implementation/QuxBarsImpl.java | 107 + .../service/implementation/QuxesImpl.java | 107 + .../ServiceClientClientImpl.java | 318 +++ .../service/implementation/package-info.java | 18 + .../structure/service/models/ClientType.java | 71 + .../service/models/package-info.java | 18 + .../structure/service/package-info.java | 18 + .../twooperationgroup/Group1AsyncClient.java | 140 + .../twooperationgroup/Group1Client.java | 135 + .../twooperationgroup/Group2AsyncClient.java | 140 + .../twooperationgroup/Group2Client.java | 135 + .../TwoOperationGroupClientBuilder.java | 329 +++ .../implementation/Group1sImpl.java | 205 ++ .../implementation/Group2sImpl.java | 205 ++ .../TwoOperationGroupClientImpl.java | 142 + .../implementation/package-info.java | 18 + .../twooperationgroup/package-info.java | 18 + .../DocumentationClientBuilder.java | 312 +++ .../java/documentation/ListsAsyncClient.java | 192 ++ .../main/java/documentation/ListsClient.java | 187 ++ .../TextFormattingAsyncClient.java | 154 + .../documentation/TextFormattingClient.java | 149 + .../DocumentationClientImpl.java | 122 + .../implementation/ListsImpl.java | 272 ++ .../implementation/TextFormattingsImpl.java | 217 ++ .../implementation/package-info.java | 11 + .../models/BulletPointsModelRequest.java | 84 + .../implementation/models/package-info.java | 11 + .../lists/models/BulletPointsEnum.java | 89 + .../lists/models/BulletPointsModel.java | 117 + .../lists/models/package-info.java | 11 + .../main/java/documentation/package-info.java | 11 + .../java/encode/array/ArrayAsyncClient.java | 287 ++ .../main/java/encode/array/ArrayClient.java | 285 ++ .../java/encode/array/ArrayClientBuilder.java | 287 ++ .../array/implementation/ArrayClientImpl.java | 107 + .../array/implementation/PropertiesImpl.java | 478 ++++ .../array/implementation/package-info.java | 11 + .../models/CommaDelimitedArrayProperty.java | 95 + .../models/NewlineDelimitedArrayProperty.java | 95 + .../models/PipeDelimitedArrayProperty.java | 95 + .../models/SpaceDelimitedArrayProperty.java | 95 + .../encode/array/models/package-info.java | 11 + .../main/java/encode/array/package-info.java | 11 + .../java/encode/bytes/BytesClientBuilder.java | 378 +++ .../java/encode/bytes/HeaderAsyncClient.java | 187 ++ .../main/java/encode/bytes/HeaderClient.java | 181 ++ .../encode/bytes/PropertyAsyncClient.java | 275 ++ .../java/encode/bytes/PropertyClient.java | 273 ++ .../java/encode/bytes/QueryAsyncClient.java | 187 ++ .../main/java/encode/bytes/QueryClient.java | 181 ++ .../encode/bytes/RequestBodyAsyncClient.java | 261 ++ .../java/encode/bytes/RequestBodyClient.java | 253 ++ .../encode/bytes/ResponseBodyAsyncClient.java | 247 ++ .../java/encode/bytes/ResponseBodyClient.java | 243 ++ .../bytes/implementation/BytesClientImpl.java | 167 ++ .../bytes/implementation/HeadersImpl.java | 282 ++ .../bytes/implementation/PropertiesImpl.java | 452 +++ .../bytes/implementation/QueriesImpl.java | 282 ++ .../implementation/RequestBodiesImpl.java | 407 +++ .../implementation/ResponseBodiesImpl.java | 385 +++ .../bytes/implementation/package-info.java | 11 + .../bytes/models/Base64BytesProperty.java | 84 + .../models/Base64urlArrayBytesProperty.java | 102 + .../bytes/models/Base64urlBytesProperty.java | 96 + .../bytes/models/DefaultBytesProperty.java | 84 + .../encode/bytes/models/package-info.java | 11 + .../main/java/encode/bytes/package-info.java | 11 + .../datetime/DatetimeClientBuilder.java | 356 +++ .../encode/datetime/HeaderAsyncClient.java | 226 ++ .../java/encode/datetime/HeaderClient.java | 218 ++ .../encode/datetime/PropertyAsyncClient.java | 333 +++ .../java/encode/datetime/PropertyClient.java | 331 +++ .../encode/datetime/QueryAsyncClient.java | 226 ++ .../java/encode/datetime/QueryClient.java | 218 ++ .../datetime/ResponseHeaderAsyncClient.java | 174 ++ .../encode/datetime/ResponseHeaderClient.java | 168 ++ .../implementation/DatetimeClientImpl.java | 152 + .../datetime/implementation/HeadersImpl.java | 334 +++ .../implementation/PropertiesImpl.java | 548 ++++ .../datetime/implementation/QueriesImpl.java | 332 +++ .../implementation/ResponseHeadersImpl.java | 252 ++ .../datetime/implementation/package-info.java | 11 + .../models/DefaultDatetimeProperty.java | 88 + .../models/Rfc3339DatetimeProperty.java | 88 + .../models/Rfc7231DatetimeProperty.java | 97 + .../UnixTimestampArrayDatetimeProperty.java | 97 + .../models/UnixTimestampDatetimeProperty.java | 90 + .../encode/datetime/models/package-info.java | 11 + .../java/encode/datetime/package-info.java | 11 + .../duration/DurationClientBuilder.java | 334 +++ .../encode/duration/HeaderAsyncClient.java | 560 ++++ .../java/encode/duration/HeaderClient.java | 542 ++++ .../encode/duration/PropertyAsyncClient.java | 871 ++++++ .../java/encode/duration/PropertyClient.java | 861 ++++++ .../encode/duration/QueryAsyncClient.java | 558 ++++ .../java/encode/duration/QueryClient.java | 542 ++++ .../implementation/DurationClientImpl.java | 137 + .../duration/implementation/HeadersImpl.java | 804 ++++++ .../implementation/PropertiesImpl.java | 1431 ++++++++++ .../duration/implementation/QueriesImpl.java | 805 ++++++ .../duration/implementation/package-info.java | 11 + .../java/encode/duration/package-info.java | 11 + .../models/DefaultDurationProperty.java | 85 + .../Float64MillisecondsDurationProperty.java | 84 + .../Float64SecondsDurationProperty.java | 88 + ...loatMillisecondsDurationArrayProperty.java | 85 + .../FloatMillisecondsDurationProperty.java | 83 + ...illisecondsLargerUnitDurationProperty.java | 84 + .../FloatSecondsDurationArrayProperty.java | 96 + .../models/FloatSecondsDurationProperty.java | 88 + ...loatSecondsLargerUnitDurationProperty.java | 89 + .../models/ISO8601DurationProperty.java | 85 + .../Int32MillisecondsDurationProperty.java | 83 + ...illisecondsLargerUnitDurationProperty.java | 84 + .../models/Int32SecondsDurationProperty.java | 88 + ...nt32SecondsLargerUnitDurationProperty.java | 89 + .../property/models/package-info.java | 11 + .../encode/numeric/NumericAsyncClient.java | 215 ++ .../java/encode/numeric/NumericClient.java | 211 ++ .../encode/numeric/NumericClientBuilder.java | 287 ++ .../implementation/NumericClientImpl.java | 107 + .../implementation/PropertiesImpl.java | 351 +++ .../numeric/implementation/package-info.java | 11 + .../java/encode/numeric/package-info.java | 11 + .../models/SafeintAsStringProperty.java | 84 + .../models/Uint32AsStringProperty.java | 94 + .../models/Uint8AsStringProperty.java | 84 + .../numeric/property/models/package-info.java | 11 + .../parameters/basic/BasicClientBuilder.java | 312 +++ .../basic/ExplicitBodyAsyncClient.java | 86 + .../parameters/basic/ExplicitBodyClient.java | 83 + .../basic/ImplicitBodyAsyncClient.java | 88 + .../parameters/basic/ImplicitBodyClient.java | 85 + .../basic/explicitbody/models/User.java | 83 + .../explicitbody/models/package-info.java | 11 + .../basic/implementation/BasicClientImpl.java | 122 + .../implementation/ExplicitBodiesImpl.java | 134 + .../implementation/ImplicitBodiesImpl.java | 134 + .../basic/implementation/package-info.java | 11 + .../implementation/models/SimpleRequest.java | 83 + .../implementation/models/package-info.java | 11 + .../java/parameters/basic/package-info.java | 11 + .../BodyOptionalityAsyncClient.java | 134 + .../BodyOptionalityClient.java | 130 + .../BodyOptionalityClientBuilder.java | 313 +++ .../OptionalExplicitAsyncClient.java | 188 ++ .../OptionalExplicitClient.java | 182 ++ .../BodyOptionalityClientImpl.java | 289 ++ .../implementation/OptionalExplicitsImpl.java | 245 ++ .../implementation/package-info.java | 11 + .../bodyoptionality/models/BodyModel.java | 83 + .../bodyoptionality/models/package-info.java | 11 + .../bodyoptionality/package-info.java | 11 + .../CollectionFormatClientBuilder.java | 309 +++ .../collectionformat/HeaderAsyncClient.java | 76 + .../collectionformat/HeaderClient.java | 73 + .../collectionformat/QueryAsyncClient.java | 187 ++ .../collectionformat/QueryClient.java | 181 ++ .../CollectionFormatClientImpl.java | 122 + .../implementation/HeadersImpl.java | 118 + .../implementation/QueriesImpl.java | 289 ++ .../implementation/package-info.java | 11 + .../collectionformat/package-info.java | 11 + .../java/parameters/path/PathAsyncClient.java | 129 + .../main/java/parameters/path/PathClient.java | 124 + .../parameters/path/PathClientBuilder.java | 287 ++ .../path/implementation/PathClientImpl.java | 222 ++ .../path/implementation/package-info.java | 11 + .../java/parameters/path/package-info.java | 11 + .../parameters/spread/AliasAsyncClient.java | 361 +++ .../java/parameters/spread/AliasClient.java | 353 +++ .../parameters/spread/ModelAsyncClient.java | 287 ++ .../java/parameters/spread/ModelClient.java | 276 ++ .../spread/SpreadClientBuilder.java | 308 ++ .../models/SpreadAsRequestBodyRequest.java | 83 + .../implementation/models/package-info.java | 11 + .../spread/implementation/AliasImpl.java | 491 ++++ .../spread/implementation/ModelsImpl.java | 436 +++ .../implementation/SpreadClientImpl.java | 122 + .../SpreadAsRequestParameterRequest.java | 83 + .../SpreadCompositeRequestMixRequest.java | 83 + .../SpreadParameterWithInnerAliasRequest.java | 106 + .../SpreadParameterWithInnerModelRequest.java | 84 + .../SpreadWithMultipleParametersRequest.java | 178 ++ .../implementation/models/package-info.java | 11 + .../spread/implementation/package-info.java | 11 + .../spread/model/models/BodyParameter.java | 83 + .../spread/model/models/package-info.java | 11 + .../java/parameters/spread/package-info.java | 11 + .../ContentNegotiationClientBuilder.java | 313 +++ .../DifferentBodyAsyncClient.java | 125 + .../DifferentBodyClient.java | 122 + .../SameBodyAsyncClient.java | 121 + .../contentnegotiation/SameBodyClient.java | 119 + .../differentbody/models/PngImageAsJson.java | 84 + .../differentbody/models/package-info.java | 11 + .../ContentNegotiationClientImpl.java | 123 + .../implementation/DifferentBodiesImpl.java | 194 ++ .../implementation/SameBodiesImpl.java | 190 ++ .../implementation/package-info.java | 11 + .../contentnegotiation/package-info.java | 11 + .../JsonMergePatchAsyncClient.java | 346 +++ .../jsonmergepatch/JsonMergePatchClient.java | 341 +++ .../JsonMergePatchClientBuilder.java | 287 ++ .../JsonMergePatchClientImpl.java | 625 +++++ .../implementation/JsonMergePatchHelper.java | 45 + .../implementation/package-info.java | 11 + .../jsonmergepatch/models/InnerModel.java | 181 ++ .../jsonmergepatch/models/Resource.java | 318 +++ .../jsonmergepatch/models/ResourcePatch.java | 391 +++ .../jsonmergepatch/models/package-info.java | 11 + .../payload/jsonmergepatch/package-info.java | 11 + .../mediatype/MediaTypeAsyncClient.java | 211 ++ .../payload/mediatype/MediaTypeClient.java | 205 ++ .../mediatype/MediaTypeClientBuilder.java | 287 ++ .../implementation/MediaTypeClientImpl.java | 107 + .../implementation/StringBodiesImpl.java | 330 +++ .../implementation/package-info.java | 11 + .../java/payload/mediatype/package-info.java | 11 + .../multipart/FormDataAsyncClient.java | 369 +++ .../payload/multipart/FormDataClient.java | 356 +++ .../FormDataHttpPartsAsyncClient.java | 94 + .../multipart/FormDataHttpPartsClient.java | 91 + ...rmDataHttpPartsContentTypeAsyncClient.java | 178 ++ .../FormDataHttpPartsContentTypeClient.java | 173 ++ ...FormDataHttpPartsNonStringAsyncClient.java | 83 + .../FormDataHttpPartsNonStringClient.java | 80 + .../multipart/MultiPartClientBuilder.java | 356 +++ .../nonstring/models/FloatRequest.java | 40 + .../nonstring/models/package-info.java | 11 + .../models/AnonymousModelRequest.java | 41 + .../formdata/models/package-info.java | 11 + .../FormDataHttpPartsContentTypesImpl.java | 235 ++ .../implementation/FormDataHttpPartsImpl.java | 119 + .../FormDataHttpPartsNonStringsImpl.java | 118 + .../implementation/FormDatasImpl.java | 463 ++++ .../implementation/MultiPartClientImpl.java | 152 + .../MultipartFormDataHelper.java | 209 ++ .../implementation/package-info.java | 11 + .../payload/multipart/models/Address.java | 83 + .../models/BinaryArrayPartsRequest.java | 59 + .../models/ComplexHttpPartsModelRequest.java | 114 + .../multipart/models/ComplexPartsRequest.java | 96 + .../models/FileOptionalContentType.java | 87 + .../models/FileRequiredMetaData.java | 77 + .../models/FileSpecificContentType.java | 75 + ...ithHttpPartOptionalContentTypeRequest.java | 40 + ...ithHttpPartRequiredContentTypeRequest.java | 40 + ...ithHttpPartSpecificContentTypeRequest.java | 40 + .../multipart/models/JsonPartRequest.java | 58 + .../models/MultiBinaryPartsRequest.java | 68 + .../multipart/models/MultiPartRequest.java | 58 + .../multipart/models/PictureFileDetails.java | 97 + .../multipart/models/PicturesFileDetails.java | 97 + .../models/ProfileImageFileDetails.java | 97 + .../multipart/models/package-info.java | 11 + .../java/payload/multipart/package-info.java | 11 + .../ResiliencyServiceDrivenAsyncClient.java | 316 +++ .../ResiliencyServiceDrivenClient.java | 309 +++ .../ResiliencyServiceDrivenClientBuilder.java | 333 +++ .../ServiceDrivenServiceVersion.java | 45 + .../ResiliencyServiceDrivenClientImpl.java | 440 +++ .../implementation/package-info.java | 24 + .../servicedriven/package-info.java | 24 + .../ResiliencyServiceDrivenAsyncClient.java | 180 ++ .../v1/ResiliencyServiceDrivenClient.java | 174 ++ .../ResiliencyServiceDrivenClientBuilder.java | 333 +++ .../v1/ServiceDrivenServiceVersion.java | 40 + .../ResiliencyServiceDrivenClientImpl.java | 359 +++ .../v1/implementation/package-info.java | 12 + .../servicedriven/v1/package-info.java | 12 + .../StatusCodeRangeAsyncClient.java | 106 + .../StatusCodeRangeClient.java | 102 + .../StatusCodeRangeClientBuilder.java | 288 ++ .../StatusCodeRangeClientImpl.java | 223 ++ .../implementation/package-info.java | 11 + .../statuscoderange/package-info.java | 11 + .../java/routes/InInterfaceAsyncClient.java | 72 + .../main/java/routes/InInterfaceClient.java | 69 + .../routes/PathParametersAsyncClient.java | 149 + .../java/routes/PathParametersClient.java | 144 + ...etersLabelExpansionExplodeAsyncClient.java | 151 + ...ParametersLabelExpansionExplodeClient.java | 146 + ...tersLabelExpansionStandardAsyncClient.java | 151 + ...arametersLabelExpansionStandardClient.java | 146 + ...tersMatrixExpansionExplodeAsyncClient.java | 151 + ...arametersMatrixExpansionExplodeClient.java | 146 + ...ersMatrixExpansionStandardAsyncClient.java | 151 + ...rametersMatrixExpansionStandardClient.java | 146 + ...metersPathExpansionExplodeAsyncClient.java | 151 + ...hParametersPathExpansionExplodeClient.java | 146 + ...etersPathExpansionStandardAsyncClient.java | 151 + ...ParametersPathExpansionStandardClient.java | 146 + ...arametersReservedExpansionAsyncClient.java | 112 + ...PathParametersReservedExpansionClient.java | 108 + ...tersSimpleExpansionExplodeAsyncClient.java | 151 + ...arametersSimpleExpansionExplodeClient.java | 146 + ...ersSimpleExpansionStandardAsyncClient.java | 151 + ...rametersSimpleExpansionStandardClient.java | 146 + .../routes/QueryParametersAsyncClient.java | 149 + .../java/routes/QueryParametersClient.java | 144 + ...rsQueryContinuationExplodeAsyncClient.java | 151 + ...ametersQueryContinuationExplodeClient.java | 146 + ...sQueryContinuationStandardAsyncClient.java | 151 + ...metersQueryContinuationStandardClient.java | 146 + ...etersQueryExpansionExplodeAsyncClient.java | 151 + ...ParametersQueryExpansionExplodeClient.java | 146 + ...tersQueryExpansionStandardAsyncClient.java | 151 + ...arametersQueryExpansionStandardClient.java | 146 + .../main/java/routes/RoutesAsyncClient.java | 72 + .../src/main/java/routes/RoutesClient.java | 69 + .../main/java/routes/RoutesClientBuilder.java | 668 +++++ .../implementation/InInterfacesImpl.java | 106 + .../implementation/PathParametersImpl.java | 212 ++ ...hParametersLabelExpansionExplodesImpl.java | 222 ++ ...ParametersLabelExpansionStandardsImpl.java | 222 ++ ...ParametersMatrixExpansionExplodesImpl.java | 222 ++ ...arametersMatrixExpansionStandardsImpl.java | 222 ++ ...thParametersPathExpansionExplodesImpl.java | 222 ++ ...hParametersPathExpansionStandardsImpl.java | 222 ++ .../PathParametersReservedExpansionsImpl.java | 161 ++ ...ParametersSimpleExpansionExplodesImpl.java | 222 ++ ...arametersSimpleExpansionStandardsImpl.java | 222 ++ .../implementation/QueryParametersImpl.java | 212 ++ ...rametersQueryContinuationExplodesImpl.java | 222 ++ ...ametersQueryContinuationStandardsImpl.java | 222 ++ ...yParametersQueryExpansionExplodesImpl.java | 222 ++ ...ParametersQueryExpansionStandardsImpl.java | 222 ++ .../implementation/RoutesClientImpl.java | 411 +++ .../routes/implementation/package-info.java | 11 + .../src/main/java/routes/package-info.java | 11 + .../encodedname/json/JsonAsyncClient.java | 130 + .../encodedname/json/JsonClient.java | 126 + .../encodedname/json/JsonClientBuilder.java | 288 ++ .../json/implementation/JsonClientImpl.java | 107 + .../json/implementation/PropertiesImpl.java | 202 ++ .../json/implementation/package-info.java | 11 + .../encodedname/json/package-info.java | 11 + .../property/models/JsonEncodedNameModel.java | 83 + .../json/property/models/package-info.java | 11 + .../notdefined/NotDefinedAsyncClient.java | 72 + .../endpoint/notdefined/NotDefinedClient.java | 69 + .../notdefined/NotDefinedClientBuilder.java | 288 ++ .../implementation/NotDefinedClientImpl.java | 172 ++ .../implementation/package-info.java | 11 + .../endpoint/notdefined/package-info.java | 11 + .../path/multiple/MultipleAsyncClient.java | 109 + .../server/path/multiple/MultipleClient.java | 105 + .../path/multiple/MultipleClientBuilder.java | 307 ++ .../path/multiple/MultipleServiceVersion.java | 40 + .../implementation/MultipleClientImpl.java | 248 ++ .../multiple/implementation/package-info.java | 10 + .../server/path/multiple/package-info.java | 10 + .../server/path/single/SingleAsyncClient.java | 72 + .../java/server/path/single/SingleClient.java | 69 + .../path/single/SingleClientBuilder.java | 287 ++ .../implementation/SingleClientImpl.java | 170 ++ .../single/implementation/package-info.java | 11 + .../java/server/path/single/package-info.java | 11 + .../notversioned/NotVersionedAsyncClient.java | 146 + .../notversioned/NotVersionedClient.java | 141 + .../NotVersionedClientBuilder.java | 288 ++ .../NotVersionedClientImpl.java | 277 ++ .../implementation/package-info.java | 11 + .../versions/notversioned/package-info.java | 11 + .../versioned/VersionedAsyncClient.java | 174 ++ .../versions/versioned/VersionedClient.java | 168 ++ .../versioned/VersionedClientBuilder.java | 308 ++ .../versioned/VersionedServiceVersion.java | 45 + .../implementation/VersionedClientImpl.java | 344 +++ .../implementation/package-info.java | 11 + .../versions/versioned/package-info.java | 11 + .../multiservice/combined/BarAsyncClient.java | 72 + .../multiservice/combined/BarClient.java | 69 + .../combined/CombinedBuilder.java | 308 ++ .../multiservice/combined/FooAsyncClient.java | 72 + .../multiservice/combined/FooClient.java | 69 + .../combined/implementation/BarsImpl.java | 108 + .../combined/implementation/CombinedImpl.java | 122 + .../combined/implementation/FoosImpl.java | 108 + .../combined/implementation/package-info.java | 10 + .../multiservice/combined/package-info.java | 10 + .../ConditionalRequestAsyncClient.java | 311 +++ .../ConditionalRequestClient.java | 301 ++ .../ConditionalRequestClientBuilder.java | 288 ++ .../ConditionalRequestClientImpl.java | 393 +++ .../implementation/package-info.java | 11 + .../conditionalrequest/package-info.java | 11 + .../RepeatabilityAsyncClient.java | 81 + .../repeatability/RepeatabilityClient.java | 78 + .../RepeatabilityClientBuilder.java | 288 ++ .../RepeatabilityClientImpl.java | 224 ++ .../implementation/package-info.java | 11 + .../repeatability/package-info.java | 11 + .../ModelPropertiesAsyncClient.java | 142 + .../specialwords/ModelPropertiesClient.java | 138 + .../java/specialwords/ModelsAsyncClient.java | 1590 +++++++++++ .../main/java/specialwords/ModelsClient.java | 1555 +++++++++++ .../specialwords/OperationsAsyncClient.java | 1160 ++++++++ .../java/specialwords/OperationsClient.java | 1125 ++++++++ .../specialwords/ParametersAsyncClient.java | 1297 +++++++++ .../java/specialwords/ParametersClient.java | 1260 +++++++++ .../SpecialWordsClientBuilder.java | 356 +++ .../implementation/ModelPropertiesImpl.java | 225 ++ .../implementation/ModelsImpl.java | 2469 +++++++++++++++++ .../implementation/OperationsImpl.java | 1630 +++++++++++ .../implementation/ParametersImpl.java | 1791 ++++++++++++ .../SpecialWordsClientImpl.java | 152 + .../implementation/package-info.java | 48 + .../modelproperties/models/DictMethods.java | 282 ++ .../modelproperties/models/SameAsModel.java | 83 + .../modelproperties/models/package-info.java | 48 + .../java/specialwords/models/models/And.java | 83 + .../java/specialwords/models/models/As.java | 83 + .../specialwords/models/models/Assert.java | 83 + .../specialwords/models/models/Async.java | 83 + .../specialwords/models/models/Await.java | 83 + .../specialwords/models/models/Break.java | 83 + .../models/models/ClassModel.java | 83 + .../models/models/Constructor.java | 83 + .../specialwords/models/models/Continue.java | 83 + .../java/specialwords/models/models/Def.java | 83 + .../java/specialwords/models/models/Del.java | 83 + .../java/specialwords/models/models/Elif.java | 83 + .../java/specialwords/models/models/Else.java | 83 + .../specialwords/models/models/Except.java | 83 + .../java/specialwords/models/models/Exec.java | 83 + .../specialwords/models/models/Finally.java | 83 + .../java/specialwords/models/models/For.java | 83 + .../java/specialwords/models/models/From.java | 83 + .../specialwords/models/models/Global.java | 83 + .../java/specialwords/models/models/If.java | 83 + .../specialwords/models/models/Import.java | 83 + .../java/specialwords/models/models/In.java | 83 + .../java/specialwords/models/models/Is.java | 83 + .../specialwords/models/models/Lambda.java | 83 + .../java/specialwords/models/models/Not.java | 83 + .../java/specialwords/models/models/Or.java | 83 + .../java/specialwords/models/models/Pass.java | 83 + .../specialwords/models/models/Raise.java | 83 + .../specialwords/models/models/Return.java | 83 + .../java/specialwords/models/models/Try.java | 83 + .../specialwords/models/models/While.java | 83 + .../java/specialwords/models/models/With.java | 83 + .../specialwords/models/models/Yield.java | 83 + .../models/models/package-info.java | 48 + .../main/java/specialwords/package-info.java | 48 + .../streaming/jsonl/JsonlAsyncClient.java | 124 + .../java/streaming/jsonl/JsonlClient.java | 121 + .../streaming/jsonl/JsonlClientBuilder.java | 287 ++ .../jsonl/implementation/BasicsImpl.java | 194 ++ .../jsonl/implementation/JsonlClientImpl.java | 107 + .../jsonl/implementation/package-info.java | 11 + .../java/streaming/jsonl/package-info.java | 11 + .../ArmCustomizationManager.java | 282 ++ .../fluent/ArmCustomizationClient.java | 55 + .../armcustomization/fluent/VaultsClient.java | 43 + .../fluent/models/VaultInner.java | 178 ++ .../fluent/models/package-info.java | 9 + .../armcustomization/fluent/package-info.java | 9 + .../ArmCustomizationClientBuilder.java | 138 + .../ArmCustomizationClientImpl.java | 308 ++ .../implementation/ResourceManagerUtils.java | 195 ++ .../implementation/VaultImpl.java | 64 + .../implementation/VaultsClientImpl.java | 146 + .../implementation/VaultsImpl.java | 55 + .../implementation/package-info.java | 9 + .../armcustomization/models/Vault.java | 70 + .../models/VaultProperties.java | 79 + .../armcustomization/models/Vaults.java | 38 + .../armcustomization/models/package-info.java | 9 + .../armcustomization/package-info.java | 9 + .../tsptest/armlegacy/ArmLegacyManager.java | 282 ++ .../armlegacy/fluent/ArmLegacyClient.java | 55 + .../tsptest/armlegacy/fluent/SkusClient.java | 207 ++ .../fluent/models/SkuResourceInner.java | 155 ++ .../armlegacy/fluent/models/package-info.java | 9 + .../armlegacy/fluent/package-info.java | 9 + .../ArmLegacyClientBuilder.java | 138 + .../implementation/ArmLegacyClientImpl.java | 308 ++ .../implementation/ResourceManagerUtils.java | 195 ++ .../implementation/SkuResourceImpl.java | 105 + .../implementation/SkusClientImpl.java | 662 +++++ .../armlegacy/implementation/SkusImpl.java | 202 ++ .../implementation/package-info.java | 9 + .../armlegacy/models/ProvisioningState.java | 76 + .../armlegacy/models/ResourceTypeSku.java | 73 + .../tsptest/armlegacy/models/SkuResource.java | 137 + .../java/tsptest/armlegacy/models/Skus.java | 214 ++ .../armlegacy/models/package-info.java | 9 + .../java/tsptest/armlegacy/package-info.java | 9 + .../ArmResourceProviderManager.java | 417 +++ .../armresourceprovider/fluent/ArmClient.java | 111 + ...hildExtensionResourceInterfacesClient.java | 415 +++ .../ChildResourcesInterfacesClient.java | 515 ++++ ...ustomTemplateResourceInterfacesClient.java | 292 ++ .../fluent/ImmutableResourceModelsClient.java | 161 ++ .../fluent/LroNoBodiesClient.java | 226 ++ ...intenanceWindowStatusOperationsClient.java | 215 ++ .../fluent/ModelInterfaceSameNamesClient.java | 131 + .../fluent/OperationsClient.java | 52 + .../TopLevelArmResourceInterfacesClient.java | 514 ++++ .../models/ChildExtensionResourceInner.java | 156 ++ .../fluent/models/ChildResourceInner.java | 179 ++ .../models/ChildResourceProperties.java | 75 + .../models/CustomTemplateResourceInner.java | 305 ++ .../CustomTemplateResourceProperties.java | 194 ++ ...ntenanceWindowStatusContentProperties.java | 76 + .../ManagedMaintenanceWindowStatusInner.java | 162 ++ ...ModelInterfaceDifferentNameProperties.java | 76 + .../models/ModelInterfaceSameNameInner.java | 161 ++ .../fluent/models/OperationInner.java | 150 + .../models/ResourceLroNoBodyProperties.java | 75 + .../fluent/models/ResultInner.java | 74 + .../models/TopLevelArmResourceInner.java | 292 ++ .../models/TopLevelArmResourceProperties.java | 228 ++ .../TopLevelArmResourceUpdateProperties.java | 143 + .../fluent/models/package-info.java | 9 + .../fluent/package-info.java | 9 + .../implementation/ArmClientBuilder.java | 138 + .../implementation/ArmClientImpl.java | 436 +++ .../ChildExtensionResourceImpl.java | 143 + ...ExtensionResourceInterfacesClientImpl.java | 899 ++++++ .../ChildExtensionResourceInterfacesImpl.java | 188 ++ .../implementation/ChildResourceImpl.java | 192 ++ .../ChildResourcesInterfacesClientImpl.java | 1088 ++++++++ .../ChildResourcesInterfacesImpl.java | 172 ++ .../CustomTemplateResourceImpl.java | 226 ++ ...mTemplateResourceInterfacesClientImpl.java | 581 ++++ .../CustomTemplateResourceInterfacesImpl.java | 35 + .../ImmutableResourceModelsClientImpl.java | 328 +++ .../ImmutableResourceModelsImpl.java | 43 + .../implementation/LroNoBodiesClientImpl.java | 444 +++ .../implementation/LroNoBodiesImpl.java | 52 + .../ManagedMaintenanceWindowStatusImpl.java | 64 + ...nanceWindowStatusOperationsClientImpl.java | 426 +++ ...MaintenanceWindowStatusOperationsImpl.java | 69 + .../ModelInterfaceSameNameImpl.java | 64 + .../ModelInterfaceSameNamesClientImpl.java | 251 ++ .../ModelInterfaceSameNamesImpl.java | 68 + .../implementation/OperationImpl.java | 50 + .../implementation/OperationsClientImpl.java | 242 ++ .../implementation/OperationsImpl.java | 45 + .../implementation/ResourceManagerUtils.java | 195 ++ .../implementation/ResultImpl.java | 31 + .../TopLevelArmResourceImpl.java | 252 ++ ...pLevelArmResourceInterfacesClientImpl.java | 1207 ++++++++ .../TopLevelArmResourceInterfacesImpl.java | 168 ++ .../ChildExtensionResourceListResult.java | 97 + .../models/ChildResourceListResult.java | 95 + .../models/OperationListResult.java | 96 + .../models/ResourceListResult.java | 96 + .../implementation/package-info.java | 9 + .../models/ActionFinalResult.java | 75 + .../models/ActionType.java | 46 + .../models/AnonymousEmptyModel.java | 55 + .../models/ChildExtensionResource.java | 170 ++ .../ChildExtensionResourceInterfaces.java | 145 + .../ChildExtensionResourceProperties.java | 75 + .../models/ChildExtensionResourceUpdate.java | 55 + .../models/ChildResource.java | 258 ++ .../models/ChildResourceUpdate.java | 87 + .../models/ChildResourcesInterfaces.java | 171 ++ .../models/CustomTemplateResource.java | 352 +++ .../CustomTemplateResourceInterfaces.java | 18 + .../models/CustomTemplateResourcePatch.java | 85 + .../armresourceprovider/models/Dog.java | 128 + .../armresourceprovider/models/DogKind.java | 46 + .../models/EmptyModel.java | 55 + .../armresourceprovider/models/Golden.java | 87 + .../models/ImmutableResourceModels.java | 39 + .../models/LroNoBodies.java | 66 + .../ManagedMaintenanceWindowStatus.java | 70 + ...agedMaintenanceWindowStatusOperations.java | 66 + .../models/ManagedServiceIdentity.java | 157 ++ .../models/ManagedServiceIdentityType.java | 62 + .../models/ModelInterfaceSameName.java | 70 + .../models/ModelInterfaceSameNames.java | 66 + .../models/NginxConfigurationRequest.java | 85 + .../models/NginxConfigurationResponse.java | 144 + .../NginxConfigurationResponseProperties.java | 93 + .../armresourceprovider/models/Operation.java | 58 + .../models/OperationDisplay.java | 128 + .../models/Operations.java | 35 + .../armresourceprovider/models/Origin.java | 57 + .../models/PriorityModel.java | 120 + .../models/ProvisioningState.java | 76 + .../models/ResourceLroNoBody.java | 179 ++ .../armresourceprovider/models/Result.java | 26 + .../models/TopLevelArmResource.java | 396 +++ .../models/TopLevelArmResourceInterfaces.java | 183 ++ .../models/TopLevelArmResourceUpdate.java | 175 ++ .../models/UserAssignedIdentity.java | 92 + .../models/package-info.java | 9 + .../armresourceprovider/package-info.java | 9 + .../ArmResourceProviderManager.java | 346 +++ .../ArmResourceProviderManagementClient.java | 83 + .../fluent/FishesClient.java | 88 + .../fluent/FunctionsClient.java | 41 + .../fluent/ItemsClient.java | 38 + .../fluent/PrioritiesClient.java | 41 + .../fluent/TopLevelArmResourcesClient.java | 82 + .../fluent/models/AnotherFishProperties.java | 148 + .../fluent/models/EyeProperties.java | 145 + .../fluent/models/FishInner.java | 348 +++ .../fluent/models/FishProperties.java | 148 + .../fluent/models/FunctionConfiguration.java | 125 + .../fluent/models/FunctionInner.java | 104 + .../fluent/models/OutputOnlyModelInner.java | 225 ++ .../models/OutputOnlyModelProperties.java | 115 + .../fluent/models/ResultData.java | 106 + .../fluent/models/SalmonInner.java | 375 +++ .../fluent/models/TailProperties.java | 145 + .../models/TopLevelArmResourceInner.java | 163 ++ .../fluent/models/package-info.java | 9 + .../fluent/package-info.java | 9 + ...sourceProviderManagementClientBuilder.java | 138 + ...mResourceProviderManagementClientImpl.java | 372 +++ .../implementation/FishImpl.java | 63 + .../implementation/FishesClientImpl.java | 320 +++ .../implementation/FishesImpl.java | 95 + .../implementation/FunctionImpl.java | 33 + .../implementation/FunctionsClientImpl.java | 159 ++ .../implementation/FunctionsImpl.java | 56 + .../implementation/ItemsClientImpl.java | 290 ++ .../implementation/ItemsImpl.java | 42 + .../implementation/OutputOnlyModelImpl.java | 49 + .../implementation/PrioritiesClientImpl.java | 153 + .../implementation/PrioritiesImpl.java | 42 + .../implementation/ResourceManagerUtils.java | 195 ++ .../implementation/SalmonImpl.java | 100 + .../TopLevelArmResourceImpl.java | 65 + .../TopLevelArmResourcesClientImpl.java | 347 +++ .../TopLevelArmResourcesImpl.java | 57 + .../implementation/models/ListResult.java | 112 + .../implementation/package-info.java | 9 + .../models/AggregateFunctionProperties.java | 144 + .../models/Builtin.java | 441 +++ .../models/Dog.java | 163 ++ .../models/DogKind.java | 46 + .../models/Encoded.java | 333 +++ .../models/Error.java | 192 ++ .../models/ErrorException.java | 42 + .../models/ErrorMin.java | 189 ++ .../models/ErrorMinException.java | 42 + .../models/Fish.java | 82 + .../models/Fishes.java | 79 + .../models/Function.java | 26 + .../models/FunctionProperties.java | 193 ++ .../models/Functions.java | 37 + .../FunctionsCreateFunctionHeaders.java | 47 + .../FunctionsCreateFunctionResponse.java | 39 + .../models/GoblinShark.java | 291 ++ .../models/Golden.java | 89 + .../models/Items.java | 33 + .../models/OutputOnlyModel.java | 54 + .../models/OutputOnlyModelChild.java | 191 ++ .../models/Priorities.java | 36 + .../models/Priority.java | 120 + .../models/Result.java | 127 + .../models/Salmon.java | 105 + .../models/SawShark.java | 321 +++ .../models/Shark.java | 317 +++ .../models/TopLevelArmResource.java | 70 + .../models/TopLevelArmResourceProperties.java | 111 + .../models/TopLevelArmResourceTagsUpdate.java | 96 + .../models/TopLevelArmResources.java | 41 + .../models/package-info.java | 9 + .../package-info.java | 9 + .../armversioned/ArmVersionedManager.java | 282 ++ .../fluent/ArmVersionedClient.java | 55 + .../fluent/TopLevelArmResourcesClient.java | 340 +++ .../models/TopLevelArmResourceInner.java | 181 ++ .../fluent/models/package-info.java | 9 + .../armversioned/fluent/package-info.java | 9 + .../ArmVersionedClientBuilder.java | 138 + .../ArmVersionedClientImpl.java | 308 ++ .../implementation/ResourceManagerUtils.java | 195 ++ .../TopLevelArmResourceImpl.java | 227 ++ .../TopLevelArmResourcesClientImpl.java | 1346 +++++++++ .../TopLevelArmResourcesImpl.java | 228 ++ .../models/TopLevelArmResourceListResult.java | 97 + .../implementation/package-info.java | 9 + .../models/ResourceProvisioningState.java | 56 + .../models/TopLevelArmResource.java | 353 +++ .../models/TopLevelArmResourceProperties.java | 75 + .../models/TopLevelArmResources.java | 285 ++ .../armversioned/models/package-info.java | 9 + .../tsptest/armversioned/package-info.java | 9 + .../tsptest/builtin/BuiltinAsyncClient.java | 268 ++ .../java/tsptest/builtin/BuiltinClient.java | 263 ++ .../tsptest/builtin/BuiltinClientBuilder.java | 287 ++ .../implementation/BuiltinClientImpl.java | 107 + .../implementation/BuiltinOpsImpl.java | 394 +++ .../builtin/implementation/package-info.java | 10 + .../java/tsptest/builtin/models/Builtin.java | 474 ++++ .../java/tsptest/builtin/models/Encoded.java | 465 ++++ .../tsptest/builtin/models/package-info.java | 10 + .../java/tsptest/builtin/package-info.java | 10 + .../ClientInitializationAsyncClient.java | 38 + .../ClientInitializationClient.java | 38 + .../ClientInitializationClientBuilder.java | 293 ++ .../clientinitialization/SubAsyncClient.java | 75 + .../clientinitialization/SubClient.java | 72 + .../ClientInitializationClientImpl.java | 105 + .../implementation/SubClientImpl.java | 193 ++ .../implementation/package-info.java | 11 + .../clientinitialization/package-info.java | 11 + .../DiscriminatorEdgeCasesAsyncClient.java | 134 + .../DiscriminatorEdgeCasesClient.java | 131 + .../DiscriminatorEdgeCasesClientBuilder.java | 288 ++ .../DiscriminatorEdgeCasesClientImpl.java | 276 ++ .../implementation/package-info.java | 10 + .../models/ChildWithAnotherDiscriminator.java | 143 + ...ldWithRequiredPropertyAsDiscriminator.java | 141 + .../GrandChildWithAnotherDiscriminator.java | 101 + .../GrandChildWithRequiredProperty.java | 97 + .../models/ParentWithRequiredProperty.java | 105 + .../models/package-info.java | 10 + .../discriminatoredgecases/package-info.java | 10 + .../EnumNestedDiscriminatorAsyncClient.java | 322 +++ .../EnumNestedDiscriminatorClient.java | 310 +++ .../EnumNestedDiscriminatorClientBuilder.java | 289 ++ .../EnumNestedDiscriminatorClientImpl.java | 571 ++++ .../implementation/package-info.java | 11 + .../enumnesteddiscriminator/models/Fish.java | 134 + .../models/FishKind.java | 57 + .../models/GoblinShark.java | 108 + .../models/Salmon.java | 192 ++ .../models/SawShark.java | 108 + .../enumnesteddiscriminator/models/Shark.java | 135 + .../models/SharkKind.java | 57 + .../models/package-info.java | 11 + .../enumnesteddiscriminator/package-info.java | 11 + .../enumservice/EnumServiceAsyncClient.java | 1045 +++++++ .../enumservice/EnumServiceClient.java | 1018 +++++++ .../enumservice/EnumServiceClientBuilder.java | 287 ++ .../implementation/EnumServiceClientImpl.java | 1320 +++++++++ .../implementation/package-info.java | 10 + .../tsptest/enumservice/models/Color.java | 61 + .../enumservice/models/ColorModel.java | 63 + .../models/OlympicRecordModel.java | 131 + .../tsptest/enumservice/models/Operation.java | 337 +++ .../enumservice/models/OperationName.java | 56 + .../models/OperationStateValues.java | 61 + .../tsptest/enumservice/models/Priority.java | 54 + .../enumservice/models/PriorityModel.java | 131 + .../java/tsptest/enumservice/models/Unit.java | 59 + .../enumservice/models/package-info.java | 10 + .../tsptest/enumservice/package-info.java | 10 + .../errormodel/ErrorModelAsyncClient.java | 103 + .../tsptest/errormodel/ErrorModelClient.java | 100 + .../errormodel/ErrorModelClientBuilder.java | 287 ++ .../implementation/ErrorModelClientImpl.java | 107 + .../implementation/ErrorOpsImpl.java | 167 ++ .../implementation/package-info.java | 10 + .../errormodel/models/BadResponseError.java | 105 + .../models/BadResponseErrorException.java | 42 + .../tsptest/errormodel/models/BatchError.java | 99 + .../models/BatchErrorException.java | 42 + .../errormodel/models/BatchErrorMessage.java | 99 + .../tsptest/errormodel/models/Details.java | 83 + .../tsptest/errormodel/models/Diagnostic.java | 128 + .../tsptest/errormodel/models/InnerError.java | 100 + .../tsptest/errormodel/models/SubError.java | 195 ++ .../errormodel/models/package-info.java | 10 + .../java/tsptest/errormodel/package-info.java | 10 + .../tsptest/flatten/FlattenAsyncClient.java | 422 +++ .../java/tsptest/flatten/FlattenClient.java | 411 +++ .../tsptest/flatten/FlattenClientBuilder.java | 307 ++ .../flatten/FlattenServiceVersion.java | 40 + .../implementation/FlattenClientImpl.java | 655 +++++ .../implementation/JsonMergePatchHelper.java | 46 + .../models/SendLongRequest.java | 424 +++ .../models/SendOptionalBodyRequest.java | 92 + .../models/SendProjectedNameRequest.java | 83 + .../implementation/models/SendRequest.java | 180 ++ .../implementation/models/package-info.java | 10 + .../flatten/implementation/package-info.java | 10 + .../flatten/models/SendLongOptions.java | 355 +++ .../flatten/models/SendLongRequestStatus.java | 61 + .../java/tsptest/flatten/models/TodoItem.java | 234 ++ .../tsptest/flatten/models/TodoItemPatch.java | 220 ++ .../flatten/models/TodoItemPatchStatus.java | 61 + .../flatten/models/UpdatePatchRequest.java | 146 + .../java/tsptest/flatten/models/User.java | 83 + .../tsptest/flatten/models/package-info.java | 10 + .../java/tsptest/flatten/package-info.java | 10 + .../tsptest/internal/InternalAsyncClient.java | 173 ++ .../java/tsptest/internal/InternalClient.java | 170 ++ .../internal/InternalClientBuilder.java | 287 ++ .../implementation/InternalClientImpl.java | 107 + .../implementation/InternalOpsImpl.java | 309 +++ .../internal/implementation/models/Color.java | 61 + .../implementation/models/ColorModel.java | 63 + .../implementation/models/package-info.java | 10 + .../internal/implementation/package-info.java | 10 + .../tsptest/internal/models/ApiRequest.java | 83 + .../tsptest/internal/models/ApiResponse.java | 83 + .../tsptest/internal/models/RequestInner.java | 83 + .../internal/models/ResponseInternal.java | 83 + .../models/ResponseInternalInner.java | 83 + .../internal/models/StandAloneData.java | 83 + .../internal/models/StandAloneDataInner.java | 83 + .../tsptest/internal/models/UnusedEnum.java | 57 + .../tsptest/internal/models/package-info.java | 10 + .../java/tsptest/internal/package-info.java | 10 + .../LiteralServiceAsyncClient.java | 133 + .../literalservice/LiteralServiceClient.java | 129 + .../LiteralServiceClientBuilder.java | 287 ++ .../implementation/LiteralOpsImpl.java | 182 ++ .../LiteralServiceClientImpl.java | 107 + .../implementation/package-info.java | 10 + .../tsptest/literalservice/models/Model.java | 111 + .../models/ModelOptionalLiteral.java | 51 + .../PutRequestOptionalLiteralParam.java | 51 + .../literalservice/models/package-info.java | 10 + .../tsptest/literalservice/package-info.java | 10 + .../longrunning/LongRunningAsyncClient.java | 228 ++ .../longrunning/LongRunningClient.java | 225 ++ .../longrunning/LongRunningClientBuilder.java | 307 ++ .../LongRunningServiceVersion.java | 40 + .../implementation/LongRunningClientImpl.java | 880 ++++++ .../OperationLocationPollingStrategy.java | 140 + .../implementation/PollingUtils.java | 151 + .../SyncOperationLocationPollingStrategy.java | 133 + .../implementation/package-info.java | 10 + .../tsptest/longrunning/models/JobData.java | 120 + .../tsptest/longrunning/models/JobResult.java | 196 ++ .../longrunning/models/JobResultResult.java | 83 + .../tsptest/longrunning/models/JobStatus.java | 75 + .../longrunning/models/OperationState.java | 75 + .../longrunning/models/PollResponse.java | 105 + .../longrunning/models/package-info.java | 10 + .../tsptest/longrunning/package-info.java | 10 + .../MethodOverrideAsyncClient.java | 585 ++++ .../methodoverride/MethodOverrideClient.java | 571 ++++ .../MethodOverrideClientBuilder.java | 307 ++ .../MethodOverrideServiceVersion.java | 40 + .../MethodOverrideClientImpl.java | 720 +++++ .../models/GroupAllRequest.java | 118 + .../models/GroupNoneRequest.java | 250 ++ .../models/GroupPartETagRequest.java | 118 + .../models/GroupPartRequest.java | 118 + .../implementation/models/package-info.java | 10 + .../implementation/package-info.java | 10 + .../models/GroupAllOptions.java | 124 + .../models/GroupExcludeBodyModel.java | 118 + .../models/GroupPartETagOptions.java | 77 + .../models/GroupPartOptions.java | 77 + .../models/GroupQueryOptions.java | 77 + .../methodoverride/models/package-info.java | 10 + .../tsptest/methodoverride/package-info.java | 10 + .../java/tsptest/model/ModelAsyncClient.java | 287 ++ .../main/java/tsptest/model/ModelClient.java | 282 ++ .../tsptest/model/ModelClientBuilder.java | 287 ++ .../model/implementation/ModelClientImpl.java | 107 + .../model/implementation/ModelOpsImpl.java | 474 ++++ .../model/implementation/package-info.java | 10 + .../model/models/InputOutputData2.java | 83 + .../tsptest/model/models/NestedModel.java | 83 + .../tsptest/model/models/NestedModel1.java | 83 + .../tsptest/model/models/NestedModel2.java | 83 + .../java/tsptest/model/models/OutputData.java | 83 + .../tsptest/model/models/OutputData3.java | 83 + .../java/tsptest/model/models/Resource1.java | 125 + .../java/tsptest/model/models/Resource2.java | 105 + .../java/tsptest/model/models/Resource3.java | 105 + .../tsptest/model/models/package-info.java | 10 + .../main/java/tsptest/model/package-info.java | 10 + .../MultiContentTypesAsyncClient.java | 67 + .../MultiContentTypesClient.java | 66 + .../MultiContentTypesClientBuilder.java | 335 +++ ...tipleContentTypesOnRequestAsyncClient.java | 183 ++ .../MultipleContentTypesOnRequestClient.java | 179 ++ .../SingleContentTypeAsyncClient.java | 125 + .../SingleContentTypeClient.java | 121 + .../MultiContentTypesClientImpl.java | 232 ++ .../MultipleContentTypesOnRequestsImpl.java | 364 +++ .../SingleContentTypesImpl.java | 200 ++ .../implementation/package-info.java | 10 + .../multicontenttypes/models/Resource.java | 98 + .../models/package-info.java | 10 + .../multicontenttypes/package-info.java | 10 + .../multipart/MultipartAsyncClient.java | 245 ++ .../tsptest/multipart/MultipartClient.java | 237 ++ .../multipart/MultipartClientBuilder.java | 287 ++ .../implementation/MultipartClientImpl.java | 275 ++ .../MultipartFormDataHelper.java | 209 ++ .../implementation/package-info.java | 10 + .../multipart/models/FileDataFileDetails.java | 97 + .../tsptest/multipart/models/FileDetails.java | 137 + .../tsptest/multipart/models/FormData.java | 141 + .../multipart/models/ImageFileDetails.java | 97 + .../tsptest/multipart/models/ImageType.java | 57 + .../multipart/models/InheritFileData.java | 75 + .../java/tsptest/multipart/models/Size.java | 105 + .../models/UploadHttpPartRequest.java | 76 + .../multipart/models/package-info.java | 10 + .../java/tsptest/multipart/package-info.java | 10 + .../namespaceclient/NamespaceAsyncClient.java | 84 + .../namespaceclient/NamespaceClient.java | 81 + .../NamespaceClientBuilder.java | 287 ++ .../implementation/NamespaceClientImpl.java | 194 ++ .../implementation/package-info.java | 10 + .../tsptest/namespaceclient/package-info.java | 10 + .../tsptest/namespacemodel/models/Model.java | 83 + .../namespacemodel/models/package-info.java | 10 + .../tsptest/naming/NamingAsyncClient.java | 210 ++ .../java/tsptest/naming/NamingClient.java | 162 ++ .../tsptest/naming/NamingClientBuilder.java | 287 ++ .../implementation/NamingClientImpl.java | 107 + .../naming/implementation/NamingOpsImpl.java | 287 ++ .../naming/implementation/package-info.java | 11 + .../tsptest/naming/models/BinaryData.java | 89 + .../java/tsptest/naming/models/BytesData.java | 107 + .../main/java/tsptest/naming/models/Data.java | 107 + .../tsptest/naming/models/DataRequest.java | 94 + .../tsptest/naming/models/DataResponse.java | 212 ++ .../tsptest/naming/models/DataStatus.java | 65 + .../naming/models/GetAnonymousResponse.java | 83 + .../naming/models/RequestParameters.java | 83 + .../naming/models/RequestParametersType.java | 56 + .../java/tsptest/naming/models/RunObject.java | 83 + .../models/RunObjectLastErrorCodeRenamed.java | 61 + .../models/RunObjectLastErrorRenamed.java | 83 + .../tsptest/naming/models/TypesModel.java | 58 + .../tsptest/naming/models/package-info.java | 11 + .../java/tsptest/naming/package-info.java | 11 + .../NamingJavaParserAsyncClient.java | 209 ++ .../NamingJavaParserClient.java | 206 ++ .../NamingJavaParserClientBuilder.java | 288 ++ .../NamingJavaParserClientImpl.java | 107 + .../implementation/NamingOpsImpl.java | 285 ++ .../implementation/package-info.java | 11 + .../namingjavaparser/models/BinaryData.java | 89 + .../namingjavaparser/models/BytesData.java | 107 + .../tsptest/namingjavaparser/models/Data.java | 107 + .../namingjavaparser/models/DataRequest.java | 94 + .../namingjavaparser/models/DataResponse.java | 189 ++ .../namingjavaparser/models/DataStatus.java | 65 + .../models/GetAnonymousResponse.java | 83 + .../models/RequestParameters.java | 83 + .../models/RequestParametersType.java | 56 + .../namingjavaparser/models/RunObject.java | 83 + .../models/RunObjectLastError1.java | 83 + .../models/RunObjectLastErrorCode.java | 61 + .../namingjavaparser/models/TypesModel.java | 58 + .../namingjavaparser/models/package-info.java | 11 + .../namingjavaparser/package-info.java | 11 + .../tsptest/optional/OptionalAsyncClient.java | 227 ++ .../java/tsptest/optional/OptionalClient.java | 223 ++ .../optional/OptionalClientBuilder.java | 287 ++ .../implementation/OptionalClientImpl.java | 107 + .../implementation/OptionalOpsImpl.java | 321 +++ .../optional/implementation/package-info.java | 10 + .../models/AllPropertiesOptional.java | 462 +++ .../optional/models/ImmutableModel.java | 105 + .../tsptest/optional/models/Optional.java | 665 +++++ .../tsptest/optional/models/package-info.java | 10 + .../java/tsptest/optional/package-info.java | 10 + .../models/PartialUpdateModel.java | 4 +- .../java/tsptest/patch/PatchAsyncClient.java | 455 +++ .../main/java/tsptest/patch/PatchClient.java | 447 +++ .../tsptest/patch/PatchClientBuilder.java | 287 ++ .../implementation/JsonMergePatchHelper.java | 85 + .../patch/implementation/PatchClientImpl.java | 107 + .../patch/implementation/PatchesImpl.java | 736 +++++ .../patch/implementation/package-info.java | 10 + .../main/java/tsptest/patch/models/Fish.java | 283 ++ .../java/tsptest/patch/models/InnerModel.java | 182 ++ .../java/tsptest/patch/models/Resource.java | 471 ++++ .../patch/models/ResourceEnumValue.java | 61 + .../java/tsptest/patch/models/Salmon.java | 275 ++ .../java/tsptest/patch/models/SawShark.java | 184 ++ .../main/java/tsptest/patch/models/Shark.java | 235 ++ .../tsptest/patch/models/package-info.java | 10 + .../main/java/tsptest/patch/package-info.java | 10 + .../ProtocolAndConvenientAsyncClient.java | 376 +++ .../ProtocolAndConvenientClient.java | 356 +++ .../ProtocolAndConvenientClientBuilder.java | 308 ++ .../ProtocolAndConvenientServiceVersion.java | 40 + .../OperationLocationPollingStrategy.java | 140 + .../implementation/PollingUtils.java | 151 + .../ProtocolAndConvenienceOpsImpl.java | 1117 ++++++++ .../ProtocolAndConvenientClientImpl.java | 128 + .../SyncOperationLocationPollingStrategy.java | 133 + .../implementation/package-info.java | 10 + .../models/ResourceA.java | 105 + .../models/ResourceB.java | 105 + .../models/ResourceE.java | 105 + .../models/ResourceF.java | 105 + .../models/ResourceI.java | 125 + .../models/ResourceJ.java | 125 + .../models/package-info.java | 10 + .../protocolandconvenient/package-info.java | 10 + .../tsptest/response/ResponseAsyncClient.java | 952 +++++++ .../java/tsptest/response/ResponseClient.java | 909 ++++++ .../response/ResponseClientBuilder.java | 307 ++ .../response/ResponseServiceVersion.java | 40 + .../OperationLocationPollingStrategy.java | 140 + .../response/implementation/PollingUtils.java | 151 + .../implementation/ResponseClientImpl.java | 2042 ++++++++++++++ .../SyncOperationLocationPollingStrategy.java | 133 + .../response/implementation/package-info.java | 10 + .../response/models/OperationDetails1.java | 150 + .../response/models/OperationDetails2.java | 150 + .../response/models/OperationState.java | 75 + .../tsptest/response/models/Resource.java | 158 ++ .../tsptest/response/models/package-info.java | 10 + .../java/tsptest/response/package-info.java | 10 + .../specialchars/SpecialCharsAsyncClient.java | 104 + .../specialchars/SpecialCharsClient.java | 101 + .../SpecialCharsClientBuilder.java | 287 ++ .../implementation/BuiltinOpsImpl.java | 165 ++ .../SpecialCharsClientImpl.java | 107 + .../implementation/models/ReadRequest.java | 83 + .../implementation/models/package-info.java | 10 + .../implementation/package-info.java | 10 + .../tsptest/specialchars/models/Resource.java | 177 ++ .../specialchars/models/package-info.java | 10 + .../tsptest/specialchars/package-info.java | 10 + .../EtagHeadersAsyncClient.java | 349 +++ .../specialheaders/EtagHeadersClient.java | 330 +++ .../EtagHeadersOptionalBodyAsyncClient.java | 184 ++ .../EtagHeadersOptionalBodyClient.java | 180 ++ .../RepeatabilityHeadersAsyncClient.java | 305 ++ .../RepeatabilityHeadersClient.java | 301 ++ .../SkipSpecialHeadersAsyncClient.java | 78 + .../SkipSpecialHeadersClient.java | 74 + .../SpecialHeadersClientBuilder.java | 376 +++ .../SpecialHeadersServiceVersion.java | 40 + .../implementation/EtagHeadersImpl.java | 615 ++++ .../EtagHeadersOptionalBodiesImpl.java | 239 ++ .../implementation/JsonMergePatchHelper.java | 28 + .../OperationLocationPollingStrategy.java | 140 + .../implementation/PollingUtils.java | 151 + .../RepeatabilityHeadersImpl.java | 864 ++++++ .../SkipSpecialHeadersImpl.java | 128 + .../SpecialHeadersClientImpl.java | 173 ++ .../SyncOperationLocationPollingStrategy.java | 133 + .../implementation/package-info.java | 10 + .../specialheaders/models/Resource.java | 219 ++ .../specialheaders/models/package-info.java | 10 + .../tsptest/specialheaders/package-info.java | 10 + .../tsptest/subclass/SubclassAsyncClient.java | 115 + .../java/tsptest/subclass/SubclassClient.java | 113 + .../subclass/SubclassClientBuilder.java | 287 ++ .../implementation/SubclassClientImpl.java | 107 + .../subclass/implementation/SubclassImpl.java | 193 ++ .../subclass/implementation/package-info.java | 10 + .../java/tsptest/subclass/models/Body.java | 154 + .../models/DuplicateRequiredProperty.java | 88 + .../DuplicateRequiredPropertyParent.java | 105 + .../models/PropertyChangedToConstant.java | 77 + .../PropertyChangedToConstantParent.java | 83 + .../models/PropertyChangedToRequired.java | 82 + .../PropertyChangedToRequiredParent.java | 93 + .../tsptest/subclass/models/package-info.java | 10 + .../java/tsptest/subclass/package-info.java | 10 + .../java/tsptest/union/UnionAsyncClient.java | 321 +++ .../main/java/tsptest/union/UnionClient.java | 313 +++ .../tsptest/union/UnionClientBuilder.java | 307 ++ .../tsptest/union/UnionServiceVersion.java | 45 + .../OperationLocationPollingStrategy.java | 140 + .../union/implementation/PollingUtils.java | 151 + .../SyncOperationLocationPollingStrategy.java | 133 + .../union/implementation/UnionClientImpl.java | 126 + .../implementation/UnionFlattenOpsImpl.java | 642 +++++ .../models/SendLongRequest.java | 244 ++ .../implementation/models/SendRequest.java | 121 + .../implementation/models/SubResult.java | 160 ++ .../implementation/models/package-info.java | 10 + .../union/implementation/package-info.java | 10 + .../java/tsptest/union/models/ArrayData.java | 84 + .../java/tsptest/union/models/Result.java | 142 + .../tsptest/union/models/SendLongOptions.java | 217 ++ .../main/java/tsptest/union/models/User.java | 83 + .../tsptest/union/models/package-info.java | 10 + .../main/java/tsptest/union/package-info.java | 10 + .../versioning/VersioningAsyncClient.java | 313 +++ .../tsptest/versioning/VersioningClient.java | 284 ++ .../versioning/VersioningClientBuilder.java | 307 ++ .../versioning/VersioningServiceVersion.java | 40 + .../OperationLocationPollingStrategy.java | 140 + .../implementation/PollingUtils.java | 151 + .../SyncOperationLocationPollingStrategy.java | 133 + .../implementation/VersioningClientImpl.java | 127 + .../implementation/VersioningOpsImpl.java | 1041 +++++++ .../implementation/package-info.java | 10 + .../versioning/models/ExportedResource.java | 105 + .../tsptest/versioning/models/Resource.java | 125 + .../versioning/models/package-info.java | 10 + .../java/tsptest/versioning/package-info.java | 10 + .../visibility/VisibilityAsyncClient.java | 267 ++ .../tsptest/visibility/VisibilityClient.java | 262 ++ .../visibility/VisibilityClientBuilder.java | 334 +++ .../visibility/VisibilityReadAsyncClient.java | 86 + .../visibility/VisibilityReadClient.java | 83 + .../VisibilityWriteAsyncClient.java | 101 + .../visibility/VisibilityWriteClient.java | 98 + .../implementation/VisibilityClientImpl.java | 530 ++++ .../implementation/VisibilityReadsImpl.java | 132 + .../implementation/VisibilityWritesImpl.java | 162 ++ .../implementation/package-info.java | 10 + .../java/tsptest/visibility/models/Dog.java | 127 + .../tsptest/visibility/models/ReadDog.java | 105 + .../visibility/models/RoundTripModel.java | 105 + .../tsptest/visibility/models/WriteDog.java | 105 + .../visibility/models/package-info.java | 10 + .../java/tsptest/visibility/package-info.java | 10 + .../tsptest/wiretype/WireTypeAsyncClient.java | 219 ++ .../java/tsptest/wiretype/WireTypeClient.java | 217 ++ .../wiretype/WireTypeClientBuilder.java | 287 ++ .../implementation/WireTypeClientImpl.java | 107 + .../implementation/WireTypeOpsImpl.java | 364 +++ .../wiretype/implementation/package-info.java | 11 + .../tsptest/wiretype/models/SubClass.java | 102 + .../wiretype/models/SubClassBothMismatch.java | 110 + .../wiretype/models/SubClassMismatch.java | 106 + .../tsptest/wiretype/models/SuperClass.java | 88 + .../wiretype/models/SuperClassMismatch.java | 97 + .../tsptest/wiretype/models/package-info.java | 11 + .../java/tsptest/wiretype/package-info.java | 11 + .../java/type/array/ArrayClientBuilder.java | 576 ++++ .../type/array/BooleanValueAsyncClient.java | 135 + .../java/type/array/BooleanValueClient.java | 131 + .../type/array/DatetimeValueAsyncClient.java | 137 + .../java/type/array/DatetimeValueClient.java | 133 + .../type/array/DurationValueAsyncClient.java | 137 + .../java/type/array/DurationValueClient.java | 133 + .../type/array/Float32ValueAsyncClient.java | 135 + .../java/type/array/Float32ValueClient.java | 131 + .../type/array/Int32ValueAsyncClient.java | 135 + .../java/type/array/Int32ValueClient.java | 131 + .../type/array/Int64ValueAsyncClient.java | 135 + .../java/type/array/Int64ValueClient.java | 131 + .../type/array/ModelValueAsyncClient.java | 147 + .../java/type/array/ModelValueClient.java | 143 + .../NullableBooleanValueAsyncClient.java | 135 + .../array/NullableBooleanValueClient.java | 131 + .../array/NullableFloatValueAsyncClient.java | 135 + .../type/array/NullableFloatValueClient.java | 131 + .../array/NullableInt32ValueAsyncClient.java | 135 + .../type/array/NullableInt32ValueClient.java | 131 + .../array/NullableModelValueAsyncClient.java | 147 + .../type/array/NullableModelValueClient.java | 143 + .../array/NullableStringValueAsyncClient.java | 135 + .../type/array/NullableStringValueClient.java | 131 + .../type/array/StringValueAsyncClient.java | 135 + .../java/type/array/StringValueClient.java | 131 + .../type/array/UnknownValueAsyncClient.java | 135 + .../java/type/array/UnknownValueClient.java | 131 + .../array/implementation/ArrayClientImpl.java | 302 ++ .../implementation/BooleanValuesImpl.java | 202 ++ .../implementation/DatetimeValuesImpl.java | 202 ++ .../implementation/DurationValuesImpl.java | 202 ++ .../implementation/Float32ValuesImpl.java | 202 ++ .../array/implementation/Int32ValuesImpl.java | 202 ++ .../array/implementation/Int64ValuesImpl.java | 202 ++ .../array/implementation/ModelValuesImpl.java | 222 ++ .../NullableBooleanValuesImpl.java | 202 ++ .../NullableFloatValuesImpl.java | 202 ++ .../NullableInt32ValuesImpl.java | 202 ++ .../NullableModelValuesImpl.java | 222 ++ .../NullableStringValuesImpl.java | 202 ++ .../implementation/StringValuesImpl.java | 202 ++ .../implementation/UnknownValuesImpl.java | 202 ++ .../array/implementation/package-info.java | 11 + .../java/type/array/models/InnerModel.java | 119 + .../java/type/array/models/package-info.java | 11 + .../main/java/type/array/package-info.java | 11 + .../dictionary/BooleanValueAsyncClient.java | 136 + .../type/dictionary/BooleanValueClient.java | 132 + .../dictionary/DatetimeValueAsyncClient.java | 137 + .../type/dictionary/DatetimeValueClient.java | 133 + .../dictionary/DictionaryClientBuilder.java | 510 ++++ .../dictionary/DurationValueAsyncClient.java | 137 + .../type/dictionary/DurationValueClient.java | 133 + .../dictionary/Float32ValueAsyncClient.java | 136 + .../type/dictionary/Float32ValueClient.java | 132 + .../dictionary/Int32ValueAsyncClient.java | 136 + .../type/dictionary/Int32ValueClient.java | 132 + .../dictionary/Int64ValueAsyncClient.java | 136 + .../type/dictionary/Int64ValueClient.java | 132 + .../dictionary/ModelValueAsyncClient.java | 147 + .../type/dictionary/ModelValueClient.java | 143 + .../NullableFloatValueAsyncClient.java | 136 + .../dictionary/NullableFloatValueClient.java | 132 + .../RecursiveModelValueAsyncClient.java | 147 + .../dictionary/RecursiveModelValueClient.java | 143 + .../dictionary/StringValueAsyncClient.java | 136 + .../type/dictionary/StringValueClient.java | 132 + .../dictionary/UnknownValueAsyncClient.java | 136 + .../type/dictionary/UnknownValueClient.java | 132 + .../implementation/BooleanValuesImpl.java | 202 ++ .../implementation/DatetimeValuesImpl.java | 202 ++ .../implementation/DictionaryClientImpl.java | 257 ++ .../implementation/DurationValuesImpl.java | 202 ++ .../implementation/Float32ValuesImpl.java | 202 ++ .../implementation/Int32ValuesImpl.java | 202 ++ .../implementation/Int64ValuesImpl.java | 202 ++ .../implementation/ModelValuesImpl.java | 222 ++ .../NullableFloatValuesImpl.java | 202 ++ .../RecursiveModelValuesImpl.java | 222 ++ .../implementation/StringValuesImpl.java | 202 ++ .../implementation/UnknownValuesImpl.java | 202 ++ .../implementation/package-info.java | 11 + .../type/dictionary/models/InnerModel.java | 119 + .../type/dictionary/models/package-info.java | 11 + .../java/type/dictionary/package-info.java | 11 + .../extensible/ExtensibleAsyncClient.java | 214 ++ .../enums/extensible/ExtensibleClient.java | 210 ++ .../extensible/ExtensibleClientBuilder.java | 287 ++ .../implementation/ExtensibleClientImpl.java | 107 + .../implementation/StringOperationsImpl.java | 330 +++ .../implementation/package-info.java | 10 + .../models/DaysOfWeekExtensibleEnum.java | 87 + .../enums/extensible/models/package-info.java | 10 + .../type/enums/extensible/package-info.java | 10 + .../type/enums/fixed/FixedAsyncClient.java | 172 ++ .../java/type/enums/fixed/FixedClient.java | 167 ++ .../type/enums/fixed/FixedClientBuilder.java | 287 ++ .../fixed/implementation/FixedClientImpl.java | 107 + .../implementation/StringOperationsImpl.java | 265 ++ .../fixed/implementation/package-info.java | 10 + .../enums/fixed/models/DaysOfWeekEnum.java | 81 + .../type/enums/fixed/models/package-info.java | 10 + .../java/type/enums/fixed/package-info.java | 10 + .../type/model/empty/EmptyAsyncClient.java | 187 ++ .../java/type/model/empty/EmptyClient.java | 181 ++ .../type/model/empty/EmptyClientBuilder.java | 287 ++ .../empty/implementation/EmptyClientImpl.java | 360 +++ .../empty/implementation/package-info.java | 11 + .../type/model/empty/models/EmptyInput.java | 59 + .../model/empty/models/EmptyInputOutput.java | 59 + .../type/model/empty/models/EmptyOutput.java | 59 + .../type/model/empty/models/package-info.java | 11 + .../java/type/model/empty/package-info.java | 11 + .../EnumDiscriminatorAsyncClient.java | 410 +++ .../EnumDiscriminatorClient.java | 395 +++ .../EnumDiscriminatorClientBuilder.java | 288 ++ .../EnumDiscriminatorClientImpl.java | 715 +++++ .../implementation/package-info.java | 11 + .../enumdiscriminator/models/Cobra.java | 90 + .../enumdiscriminator/models/Dog.java | 132 + .../enumdiscriminator/models/DogKind.java | 51 + .../enumdiscriminator/models/Golden.java | 90 + .../enumdiscriminator/models/Snake.java | 132 + .../enumdiscriminator/models/SnakeKind.java | 51 + .../models/package-info.java | 11 + .../enumdiscriminator/package-info.java | 11 + .../NestedDiscriminatorAsyncClient.java | 322 +++ .../NestedDiscriminatorClient.java | 310 +++ .../NestedDiscriminatorClientBuilder.java | 288 ++ .../NestedDiscriminatorClientImpl.java | 571 ++++ .../implementation/package-info.java | 11 + .../nesteddiscriminator/models/Fish.java | 134 + .../models/GoblinShark.java | 108 + .../nesteddiscriminator/models/Salmon.java | 192 ++ .../nesteddiscriminator/models/SawShark.java | 108 + .../nesteddiscriminator/models/Shark.java | 135 + .../models/package-info.java | 11 + .../nesteddiscriminator/package-info.java | 11 + .../NotDiscriminatedAsyncClient.java | 197 ++ .../NotDiscriminatedClient.java | 190 ++ .../NotDiscriminatedClientBuilder.java | 288 ++ .../NotDiscriminatedClientImpl.java | 384 +++ .../implementation/package-info.java | 11 + .../notdiscriminated/models/Cat.java | 88 + .../notdiscriminated/models/Pet.java | 83 + .../notdiscriminated/models/Siamese.java | 93 + .../notdiscriminated/models/package-info.java | 11 + .../notdiscriminated/package-info.java | 11 + .../recursive/RecursiveAsyncClient.java | 136 + .../recursive/RecursiveClient.java | 132 + .../recursive/RecursiveClientBuilder.java | 288 ++ .../implementation/RecursiveClientImpl.java | 280 ++ .../implementation/package-info.java | 11 + .../inheritance/recursive/models/Element.java | 94 + .../recursive/models/Extension.java | 100 + .../recursive/models/package-info.java | 11 + .../inheritance/recursive/package-info.java | 11 + .../SingleDiscriminatorAsyncClient.java | 369 +++ .../SingleDiscriminatorClient.java | 355 +++ .../SingleDiscriminatorClientBuilder.java | 288 ++ .../SingleDiscriminatorClientImpl.java | 643 +++++ .../implementation/package-info.java | 11 + .../singlediscriminator/models/Bird.java | 138 + .../singlediscriminator/models/Dinosaur.java | 132 + .../singlediscriminator/models/Eagle.java | 192 ++ .../singlediscriminator/models/Goose.java | 90 + .../singlediscriminator/models/SeaGull.java | 90 + .../singlediscriminator/models/Sparrow.java | 90 + .../singlediscriminator/models/TRex.java | 90 + .../models/package-info.java | 11 + .../singlediscriminator/package-info.java | 11 + .../type/model/usage/UsageAsyncClient.java | 191 ++ .../java/type/model/usage/UsageClient.java | 185 ++ .../type/model/usage/UsageClientBuilder.java | 287 ++ .../usage/implementation/UsageClientImpl.java | 365 +++ .../usage/implementation/package-info.java | 11 + .../model/usage/models/InputOutputRecord.java | 83 + .../type/model/usage/models/InputRecord.java | 83 + .../type/model/usage/models/OutputRecord.java | 83 + .../type/model/usage/models/package-info.java | 11 + .../java/type/model/usage/package-info.java | 11 + .../visibility/VisibilityAsyncClient.java | 451 +++ .../model/visibility/VisibilityClient.java | 441 +++ .../visibility/VisibilityClientBuilder.java | 287 ++ .../implementation/VisibilityClientImpl.java | 819 ++++++ .../implementation/package-info.java | 11 + .../visibility/models/ReadOnlyModel.java | 101 + .../visibility/models/VisibilityModel.java | 150 + .../model/visibility/models/package-info.java | 11 + .../type/model/visibility/package-info.java | 11 + .../AdditionalPropertiesClientBuilder.java | 957 +++++++ ...xtendsDifferentSpreadFloatAsyncClient.java | 138 + .../ExtendsDifferentSpreadFloatClient.java | 134 + ...sDifferentSpreadModelArrayAsyncClient.java | 150 + ...xtendsDifferentSpreadModelArrayClient.java | 146 + ...xtendsDifferentSpreadModelAsyncClient.java | 142 + .../ExtendsDifferentSpreadModelClient.java | 138 + ...tendsDifferentSpreadStringAsyncClient.java | 138 + .../ExtendsDifferentSpreadStringClient.java | 134 + .../ExtendsFloatAsyncClient.java | 136 + .../ExtendsFloatClient.java | 132 + .../ExtendsModelArrayAsyncClient.java | 148 + .../ExtendsModelArrayClient.java | 144 + .../ExtendsModelAsyncClient.java | 140 + .../ExtendsModelClient.java | 136 + .../ExtendsStringAsyncClient.java | 136 + .../ExtendsStringClient.java | 132 + .../ExtendsUnknownAsyncClient.java | 136 + .../ExtendsUnknownClient.java | 132 + .../ExtendsUnknownDerivedAsyncClient.java | 140 + .../ExtendsUnknownDerivedClient.java | 136 + ...xtendsUnknownDiscriminatedAsyncClient.java | 139 + .../ExtendsUnknownDiscriminatedClient.java | 135 + .../IsFloatAsyncClient.java | 136 + .../additionalproperties/IsFloatClient.java | 132 + .../IsModelArrayAsyncClient.java | 148 + .../IsModelArrayClient.java | 144 + .../IsModelAsyncClient.java | 140 + .../additionalproperties/IsModelClient.java | 136 + .../IsStringAsyncClient.java | 136 + .../additionalproperties/IsStringClient.java | 132 + .../IsUnknownAsyncClient.java | 136 + .../additionalproperties/IsUnknownClient.java | 132 + .../IsUnknownDerivedAsyncClient.java | 140 + .../IsUnknownDerivedClient.java | 136 + .../IsUnknownDiscriminatedAsyncClient.java | 138 + .../IsUnknownDiscriminatedClient.java | 134 + .../MultipleSpreadAsyncClient.java | 136 + .../MultipleSpreadClient.java | 132 + .../SpreadDifferentFloatAsyncClient.java | 136 + .../SpreadDifferentFloatClient.java | 132 + .../SpreadDifferentModelArrayAsyncClient.java | 144 + .../SpreadDifferentModelArrayClient.java | 140 + .../SpreadDifferentModelAsyncClient.java | 140 + .../SpreadDifferentModelClient.java | 136 + .../SpreadDifferentStringAsyncClient.java | 136 + .../SpreadDifferentStringClient.java | 132 + .../SpreadFloatAsyncClient.java | 136 + .../SpreadFloatClient.java | 132 + .../SpreadModelArrayAsyncClient.java | 148 + .../SpreadModelArrayClient.java | 144 + .../SpreadModelAsyncClient.java | 140 + .../SpreadModelClient.java | 136 + ...cordNonDiscriminatedUnion2AsyncClient.java | 136 + ...eadRecordNonDiscriminatedUnion2Client.java | 132 + ...cordNonDiscriminatedUnion3AsyncClient.java | 136 + ...eadRecordNonDiscriminatedUnion3Client.java | 132 + ...ecordNonDiscriminatedUnionAsyncClient.java | 136 + ...readRecordNonDiscriminatedUnionClient.java | 132 + .../SpreadRecordUnionAsyncClient.java | 136 + .../SpreadRecordUnionClient.java | 132 + .../SpreadStringAsyncClient.java | 136 + .../SpreadStringClient.java | 132 + .../AdditionalPropertiesClientImpl.java | 558 ++++ .../ExtendsDifferentSpreadFloatsImpl.java | 218 ++ ...ExtendsDifferentSpreadModelArraysImpl.java | 242 ++ .../ExtendsDifferentSpreadModelsImpl.java | 226 ++ .../ExtendsDifferentSpreadStringsImpl.java | 218 ++ .../implementation/ExtendsFloatsImpl.java | 214 ++ .../ExtendsModelArraysImpl.java | 238 ++ .../implementation/ExtendsModelsImpl.java | 222 ++ .../implementation/ExtendsStringsImpl.java | 214 ++ .../ExtendsUnknownDerivedsImpl.java | 222 ++ .../ExtendsUnknownDiscriminatedsImpl.java | 218 ++ .../implementation/ExtendsUnknownsImpl.java | 214 ++ .../implementation/IsFloatsImpl.java | 213 ++ .../implementation/IsModelArraysImpl.java | 238 ++ .../implementation/IsModelsImpl.java | 221 ++ .../implementation/IsStringsImpl.java | 214 ++ .../implementation/IsUnknownDerivedsImpl.java | 222 ++ .../IsUnknownDiscriminatedsImpl.java | 218 ++ .../implementation/IsUnknownsImpl.java | 214 ++ .../implementation/MultipleSpreadsImpl.java | 214 ++ .../SpreadDifferentFloatsImpl.java | 214 ++ .../SpreadDifferentModelArraysImpl.java | 230 ++ .../SpreadDifferentModelsImpl.java | 222 ++ .../SpreadDifferentStringsImpl.java | 214 ++ .../implementation/SpreadFloatsImpl.java | 214 ++ .../implementation/SpreadModelArraysImpl.java | 238 ++ .../implementation/SpreadModelsImpl.java | 222 ++ ...readRecordNonDiscriminatedUnion2sImpl.java | 214 ++ ...readRecordNonDiscriminatedUnion3sImpl.java | 214 ++ ...preadRecordNonDiscriminatedUnionsImpl.java | 214 ++ .../SpreadRecordUnionsImpl.java | 214 ++ .../implementation/SpreadStringsImpl.java | 214 ++ .../implementation/package-info.java | 11 + .../models/DifferentSpreadFloatDerived.java | 104 + .../models/DifferentSpreadFloatRecord.java | 128 + .../DifferentSpreadModelArrayDerived.java | 107 + .../DifferentSpreadModelArrayRecord.java | 133 + .../models/DifferentSpreadModelDerived.java | 104 + .../models/DifferentSpreadModelRecord.java | 129 + .../models/DifferentSpreadStringDerived.java | 104 + .../models/DifferentSpreadStringRecord.java | 128 + .../ExtendsFloatAdditionalProperties.java | 127 + .../ExtendsModelAdditionalProperties.java | 127 + ...ExtendsModelArrayAdditionalProperties.java | 132 + .../ExtendsStringAdditionalProperties.java | 127 + .../ExtendsUnknownAdditionalProperties.java | 134 + ...ndsUnknownAdditionalPropertiesDerived.java | 144 + ...nownAdditionalPropertiesDiscriminated.java | 184 ++ ...itionalPropertiesDiscriminatedDerived.java | 169 ++ .../models/IsFloatAdditionalProperties.java | 126 + .../models/IsModelAdditionalProperties.java | 127 + .../IsModelArrayAdditionalProperties.java | 131 + .../models/IsStringAdditionalProperties.java | 127 + .../models/IsUnknownAdditionalProperties.java | 134 + .../IsUnknownAdditionalPropertiesDerived.java | 144 + ...nownAdditionalPropertiesDiscriminated.java | 184 ++ ...itionalPropertiesDiscriminatedDerived.java | 167 ++ .../models/ModelForRecord.java | 83 + .../models/MultipleSpreadRecord.java | 133 + .../models/SpreadFloatRecord.java | 126 + .../models/SpreadModelArrayRecord.java | 129 + .../models/SpreadModelRecord.java | 128 + .../SpreadRecordForNonDiscriminatedUnion.java | 135 + ...SpreadRecordForNonDiscriminatedUnion2.java | 135 + ...SpreadRecordForNonDiscriminatedUnion3.java | 135 + .../models/SpreadRecordForUnion.java | 133 + .../models/SpreadStringRecord.java | 126 + .../models/WidgetData0.java | 100 + .../models/WidgetData1.java | 142 + .../models/WidgetData2.java | 100 + .../models/package-info.java | 11 + .../additionalproperties/package-info.java | 11 + .../property/nullable/BytesAsyncClient.java | 237 ++ .../type/property/nullable/BytesClient.java | 229 ++ .../nullable/CollectionsByteAsyncClient.java | 245 ++ .../nullable/CollectionsByteClient.java | 237 ++ .../nullable/CollectionsModelAsyncClient.java | 253 ++ .../nullable/CollectionsModelClient.java | 245 ++ .../CollectionsStringAsyncClient.java | 245 ++ .../nullable/CollectionsStringClient.java | 237 ++ .../DatetimeOperationAsyncClient.java | 237 ++ .../nullable/DatetimeOperationClient.java | 229 ++ .../DurationOperationAsyncClient.java | 237 ++ .../nullable/DurationOperationClient.java | 229 ++ .../nullable/NullableClientBuilder.java | 422 +++ .../nullable/StringOperationAsyncClient.java | 237 ++ .../nullable/StringOperationClient.java | 229 ++ .../nullable/implementation/BytesImpl.java | 355 +++ .../implementation/CollectionsBytesImpl.java | 372 +++ .../implementation/CollectionsModelsImpl.java | 388 +++ .../CollectionsStringsImpl.java | 372 +++ .../DatetimeOperationsImpl.java | 356 +++ .../DurationOperationsImpl.java | 356 +++ .../implementation/JsonMergePatchHelper.java | 152 + .../implementation/NullableClientImpl.java | 197 ++ .../implementation/StringOperationsImpl.java | 356 +++ .../nullable/implementation/package-info.java | 11 + .../nullable/models/BytesProperty.java | 184 ++ .../models/CollectionsByteProperty.java | 189 ++ .../models/CollectionsModelProperty.java | 189 ++ .../models/CollectionsStringProperty.java | 189 ++ .../nullable/models/DatetimeProperty.java | 194 ++ .../nullable/models/DurationProperty.java | 188 ++ .../property/nullable/models/InnerModel.java | 143 + .../nullable/models/StringProperty.java | 183 ++ .../nullable/models/package-info.java | 11 + .../type/property/nullable/package-info.java | 11 + .../optional/BooleanLiteralAsyncClient.java | 222 ++ .../optional/BooleanLiteralClient.java | 214 ++ .../property/optional/BytesAsyncClient.java | 222 ++ .../type/property/optional/BytesClient.java | 214 ++ .../optional/CollectionsByteAsyncClient.java | 230 ++ .../optional/CollectionsByteClient.java | 222 ++ .../optional/CollectionsModelAsyncClient.java | 238 ++ .../optional/CollectionsModelClient.java | 230 ++ .../DatetimeOperationAsyncClient.java | 222 ++ .../optional/DatetimeOperationClient.java | 214 ++ .../DurationOperationAsyncClient.java | 222 ++ .../optional/DurationOperationClient.java | 214 ++ .../optional/FloatLiteralAsyncClient.java | 222 ++ .../property/optional/FloatLiteralClient.java | 214 ++ .../optional/IntLiteralAsyncClient.java | 222 ++ .../property/optional/IntLiteralClient.java | 214 ++ .../optional/OptionalClientBuilder.java | 620 +++++ .../optional/PlainDateAsyncClient.java | 222 ++ .../property/optional/PlainDateClient.java | 214 ++ .../optional/PlainTimeAsyncClient.java | 222 ++ .../property/optional/PlainTimeClient.java | 214 ++ .../RequiredAndOptionalAsyncClient.java | 226 ++ .../optional/RequiredAndOptionalClient.java | 218 ++ .../optional/StringLiteralAsyncClient.java | 222 ++ .../optional/StringLiteralClient.java | 214 ++ .../optional/StringOperationAsyncClient.java | 222 ++ .../optional/StringOperationClient.java | 214 ++ .../UnionFloatLiteralAsyncClient.java | 222 ++ .../optional/UnionFloatLiteralClient.java | 214 ++ .../optional/UnionIntLiteralAsyncClient.java | 222 ++ .../optional/UnionIntLiteralClient.java | 214 ++ .../UnionStringLiteralAsyncClient.java | 222 ++ .../optional/UnionStringLiteralClient.java | 214 ++ .../implementation/BooleanLiteralsImpl.java | 348 +++ .../optional/implementation/BytesImpl.java | 347 +++ .../implementation/CollectionsBytesImpl.java | 364 +++ .../implementation/CollectionsModelsImpl.java | 380 +++ .../DatetimeOperationsImpl.java | 348 +++ .../DurationOperationsImpl.java | 348 +++ .../implementation/FloatLiteralsImpl.java | 348 +++ .../implementation/IntLiteralsImpl.java | 348 +++ .../implementation/OptionalClientImpl.java | 332 +++ .../implementation/PlainDatesImpl.java | 348 +++ .../implementation/PlainTimesImpl.java | 348 +++ .../RequiredAndOptionalsImpl.java | 356 +++ .../implementation/StringLiteralsImpl.java | 348 +++ .../implementation/StringOperationsImpl.java | 348 +++ .../UnionFloatLiteralsImpl.java | 348 +++ .../implementation/UnionIntLiteralsImpl.java | 348 +++ .../UnionStringLiteralsImpl.java | 348 +++ .../optional/implementation/package-info.java | 11 + .../models/BooleanLiteralProperty.java | 93 + .../BooleanLiteralPropertyProperty.java | 49 + .../optional/models/BytesProperty.java | 93 + .../models/CollectionsByteProperty.java | 94 + .../models/CollectionsModelProperty.java | 94 + .../optional/models/DatetimeProperty.java | 97 + .../optional/models/DurationProperty.java | 95 + .../optional/models/FloatLiteralProperty.java | 93 + .../models/FloatLiteralPropertyProperty.java | 49 + .../optional/models/IntLiteralProperty.java | 92 + .../models/IntLiteralPropertyProperty.java | 49 + .../optional/models/PlainDateProperty.java | 95 + .../optional/models/PlainTimeProperty.java | 92 + .../models/RequiredAndOptionalProperty.java | 119 + .../models/StringLiteralProperty.java | 93 + .../models/StringLiteralPropertyProperty.java | 51 + .../optional/models/StringProperty.java | 92 + .../models/UnionFloatLiteralProperty.java | 93 + .../UnionFloatLiteralPropertyProperty.java | 54 + .../models/UnionIntLiteralProperty.java | 93 + .../UnionIntLiteralPropertyProperty.java | 54 + .../models/UnionStringLiteralProperty.java | 93 + .../UnionStringLiteralPropertyProperty.java | 56 + .../optional/models/package-info.java | 11 + .../type/property/optional/package-info.java | 11 + .../valuetypes/BooleanLiteralAsyncClient.java | 130 + .../valuetypes/BooleanLiteralClient.java | 126 + .../BooleanOperationAsyncClient.java | 130 + .../valuetypes/BooleanOperationClient.java | 126 + .../property/valuetypes/BytesAsyncClient.java | 130 + .../type/property/valuetypes/BytesClient.java | 126 + .../valuetypes/CollectionsIntAsyncClient.java | 134 + .../valuetypes/CollectionsIntClient.java | 130 + .../CollectionsModelAsyncClient.java | 138 + .../valuetypes/CollectionsModelClient.java | 134 + .../CollectionsStringAsyncClient.java | 134 + .../valuetypes/CollectionsStringClient.java | 130 + .../DatetimeOperationAsyncClient.java | 130 + .../valuetypes/DatetimeOperationClient.java | 126 + .../valuetypes/Decimal128AsyncClient.java | 130 + .../property/valuetypes/Decimal128Client.java | 126 + .../valuetypes/DecimalAsyncClient.java | 130 + .../property/valuetypes/DecimalClient.java | 126 + .../DictionaryStringAsyncClient.java | 134 + .../valuetypes/DictionaryStringClient.java | 130 + .../DurationOperationAsyncClient.java | 130 + .../valuetypes/DurationOperationClient.java | 126 + .../property/valuetypes/EnumAsyncClient.java | 130 + .../type/property/valuetypes/EnumClient.java | 126 + .../valuetypes/ExtensibleEnumAsyncClient.java | 130 + .../valuetypes/ExtensibleEnumClient.java | 126 + .../valuetypes/FloatLiteralAsyncClient.java | 130 + .../valuetypes/FloatLiteralClient.java | 126 + .../valuetypes/FloatOperationAsyncClient.java | 130 + .../valuetypes/FloatOperationClient.java | 126 + .../property/valuetypes/IntAsyncClient.java | 130 + .../type/property/valuetypes/IntClient.java | 126 + .../valuetypes/IntLiteralAsyncClient.java | 130 + .../property/valuetypes/IntLiteralClient.java | 126 + .../property/valuetypes/ModelAsyncClient.java | 134 + .../type/property/valuetypes/ModelClient.java | 130 + .../property/valuetypes/NeverAsyncClient.java | 128 + .../type/property/valuetypes/NeverClient.java | 124 + .../valuetypes/StringLiteralAsyncClient.java | 130 + .../valuetypes/StringLiteralClient.java | 126 + .../StringOperationAsyncClient.java | 130 + .../valuetypes/StringOperationClient.java | 126 + .../valuetypes/UnionEnumValueAsyncClient.java | 130 + .../valuetypes/UnionEnumValueClient.java | 126 + .../UnionFloatLiteralAsyncClient.java | 130 + .../valuetypes/UnionFloatLiteralClient.java | 126 + .../UnionIntLiteralAsyncClient.java | 130 + .../valuetypes/UnionIntLiteralClient.java | 126 + .../UnionStringLiteralAsyncClient.java | 130 + .../valuetypes/UnionStringLiteralClient.java | 126 + .../valuetypes/UnknownArrayAsyncClient.java | 130 + .../valuetypes/UnknownArrayClient.java | 126 + .../valuetypes/UnknownDictAsyncClient.java | 130 + .../valuetypes/UnknownDictClient.java | 126 + .../valuetypes/UnknownIntAsyncClient.java | 130 + .../property/valuetypes/UnknownIntClient.java | 126 + .../valuetypes/UnknownStringAsyncClient.java | 130 + .../valuetypes/UnknownStringClient.java | 126 + .../valuetypes/ValueTypesClientBuilder.java | 907 ++++++ .../implementation/BooleanLiteralsImpl.java | 202 ++ .../implementation/BooleanOperationsImpl.java | 202 ++ .../valuetypes/implementation/BytesImpl.java | 201 ++ .../implementation/CollectionsIntsImpl.java | 210 ++ .../implementation/CollectionsModelsImpl.java | 218 ++ .../CollectionsStringsImpl.java | 210 ++ .../DatetimeOperationsImpl.java | 202 ++ .../implementation/Decimal128sImpl.java | 202 ++ .../implementation/DecimalsImpl.java | 201 ++ .../implementation/DictionaryStringsImpl.java | 210 ++ .../DurationOperationsImpl.java | 202 ++ .../valuetypes/implementation/EnumsImpl.java | 201 ++ .../implementation/ExtensibleEnumsImpl.java | 202 ++ .../implementation/FloatLiteralsImpl.java | 202 ++ .../implementation/FloatOperationsImpl.java | 202 ++ .../implementation/IntLiteralsImpl.java | 202 ++ .../valuetypes/implementation/IntsImpl.java | 201 ++ .../valuetypes/implementation/ModelsImpl.java | 209 ++ .../valuetypes/implementation/NeversImpl.java | 197 ++ .../implementation/StringLiteralsImpl.java | 202 ++ .../implementation/StringOperationsImpl.java | 202 ++ .../implementation/UnionEnumValuesImpl.java | 202 ++ .../UnionFloatLiteralsImpl.java | 202 ++ .../implementation/UnionIntLiteralsImpl.java | 202 ++ .../UnionStringLiteralsImpl.java | 202 ++ .../implementation/UnknownArraysImpl.java | 202 ++ .../implementation/UnknownDictsImpl.java | 202 ++ .../implementation/UnknownIntsImpl.java | 202 ++ .../implementation/UnknownStringsImpl.java | 202 ++ .../implementation/ValueTypesClientImpl.java | 527 ++++ .../implementation/package-info.java | 11 + .../models/BooleanLiteralProperty.java | 77 + .../valuetypes/models/BooleanProperty.java | 83 + .../valuetypes/models/BytesProperty.java | 84 + .../models/CollectionsIntProperty.java | 84 + .../models/CollectionsModelProperty.java | 84 + .../models/CollectionsStringProperty.java | 84 + .../valuetypes/models/DatetimeProperty.java | 88 + .../valuetypes/models/Decimal128Property.java | 84 + .../valuetypes/models/DecimalProperty.java | 84 + .../models/DictionaryStringProperty.java | 84 + .../valuetypes/models/DurationProperty.java | 85 + .../valuetypes/models/EnumProperty.java | 83 + .../valuetypes/models/ExtendedEnum.java | 51 + .../models/ExtensibleEnumProperty.java | 83 + .../valuetypes/models/FixedInnerEnum.java | 56 + .../models/FloatLiteralProperty.java | 77 + .../valuetypes/models/FloatProperty.java | 83 + .../property/valuetypes/models/InnerEnum.java | 57 + .../valuetypes/models/InnerModel.java | 83 + .../valuetypes/models/IntLiteralProperty.java | 77 + .../valuetypes/models/IntProperty.java | 83 + .../valuetypes/models/ModelProperty.java | 83 + .../valuetypes/models/NeverProperty.java | 59 + .../models/StringLiteralProperty.java | 77 + .../valuetypes/models/StringProperty.java | 83 + .../models/UnionEnumValueProperty.java | 77 + .../models/UnionFloatLiteralProperty.java | 83 + .../UnionFloatLiteralPropertyProperty.java | 54 + .../models/UnionIntLiteralProperty.java | 83 + .../UnionIntLiteralPropertyProperty.java | 54 + .../models/UnionStringLiteralProperty.java | 83 + .../UnionStringLiteralPropertyProperty.java | 56 + .../models/UnknownArrayProperty.java | 85 + .../models/UnknownDictProperty.java | 85 + .../valuetypes/models/UnknownIntProperty.java | 85 + .../models/UnknownStringProperty.java | 85 + .../valuetypes/models/package-info.java | 11 + .../property/valuetypes/package-info.java | 11 + .../scalar/BooleanOperationAsyncClient.java | 125 + .../type/scalar/BooleanOperationClient.java | 121 + .../scalar/Decimal128TypeAsyncClient.java | 163 ++ .../type/scalar/Decimal128TypeClient.java | 158 ++ .../scalar/Decimal128VerifyAsyncClient.java | 135 + .../type/scalar/Decimal128VerifyClient.java | 131 + .../type/scalar/DecimalTypeAsyncClient.java | 164 ++ .../java/type/scalar/DecimalTypeClient.java | 158 ++ .../type/scalar/DecimalVerifyAsyncClient.java | 135 + .../java/type/scalar/DecimalVerifyClient.java | 131 + .../java/type/scalar/ScalarClientBuilder.java | 422 +++ .../scalar/StringOperationAsyncClient.java | 125 + .../type/scalar/StringOperationClient.java | 121 + .../java/type/scalar/UnknownAsyncClient.java | 124 + .../main/java/type/scalar/UnknownClient.java | 121 + .../implementation/BooleanOperationsImpl.java | 194 ++ .../implementation/Decimal128TypesImpl.java | 249 ++ .../Decimal128VerifiesImpl.java | 200 ++ .../implementation/DecimalTypesImpl.java | 250 ++ .../implementation/DecimalVerifiesImpl.java | 200 ++ .../implementation/ScalarClientImpl.java | 197 ++ .../implementation/StringOperationsImpl.java | 194 ++ .../scalar/implementation/UnknownsImpl.java | 193 ++ .../scalar/implementation/package-info.java | 10 + .../main/java/type/scalar/package-info.java | 10 + .../java/type/union/EnumsOnlyAsyncClient.java | 140 + .../main/java/type/union/EnumsOnlyClient.java | 136 + .../type/union/FloatsOnlyAsyncClient.java | 134 + .../java/type/union/FloatsOnlyClient.java | 130 + .../java/type/union/IntsOnlyAsyncClient.java | 134 + .../main/java/type/union/IntsOnlyClient.java | 130 + .../type/union/MixedLiteralsAsyncClient.java | 144 + .../java/type/union/MixedLiteralsClient.java | 140 + .../type/union/MixedTypesAsyncClient.java | 150 + .../java/type/union/MixedTypesClient.java | 146 + .../type/union/ModelsOnlyAsyncClient.java | 133 + .../java/type/union/ModelsOnlyClient.java | 129 + .../type/union/StringAndArrayAsyncClient.java | 140 + .../java/type/union/StringAndArrayClient.java | 136 + .../union/StringExtensibleAsyncClient.java | 134 + .../type/union/StringExtensibleClient.java | 130 + .../StringExtensibleNamedAsyncClient.java | 134 + .../union/StringExtensibleNamedClient.java | 130 + .../type/union/StringsOnlyAsyncClient.java | 134 + .../java/type/union/StringsOnlyClient.java | 130 + .../java/type/union/UnionClientBuilder.java | 488 ++++ .../DiscriminatedClientBuilder.java | 357 +++ ...lopeObjectCustomPropertiesAsyncClient.java | 172 ++ .../EnvelopeObjectCustomPropertiesClient.java | 170 ++ .../EnvelopeObjectDefaultAsyncClient.java | 172 ++ .../EnvelopeObjectDefaultClient.java | 170 ++ ...nvelopeCustomDiscriminatorAsyncClient.java | 172 ++ .../NoEnvelopeCustomDiscriminatorClient.java | 170 ++ .../NoEnvelopeDefaultAsyncClient.java | 172 ++ .../NoEnvelopeDefaultClient.java | 170 ++ .../DiscriminatedClientImpl.java | 152 + .../EnvelopeObjectCustomPropertiesImpl.java | 235 ++ .../EnvelopeObjectDefaultsImpl.java | 235 ++ .../NoEnvelopeCustomDiscriminatorsImpl.java | 235 ++ .../NoEnvelopeDefaultsImpl.java | 235 ++ .../implementation/package-info.java | 11 + .../union/discriminated/package-info.java | 11 + .../union/implementation/EnumsOnliesImpl.java | 214 ++ .../implementation/FloatsOnliesImpl.java | 202 ++ .../union/implementation/IntsOnliesImpl.java | 202 ++ .../implementation/MixedLiteralsImpl.java | 222 ++ .../union/implementation/MixedTypesImpl.java | 234 ++ .../implementation/ModelsOnliesImpl.java | 202 ++ .../implementation/StringAndArraysImpl.java | 214 ++ .../StringExtensibleNamedsImpl.java | 202 ++ .../implementation/StringExtensiblesImpl.java | 202 ++ .../implementation/StringsOnliesImpl.java | 202 ++ .../union/implementation/UnionClientImpl.java | 242 ++ .../implementation/models/SendRequest.java | 84 + .../implementation/models/SendRequest1.java | 84 + .../implementation/models/SendRequest2.java | 84 + .../implementation/models/SendRequest3.java | 84 + .../implementation/models/SendRequest4.java | 84 + .../implementation/models/SendRequest5.java | 85 + .../implementation/models/SendRequest6.java | 84 + .../implementation/models/SendRequest7.java | 84 + .../implementation/models/SendRequest8.java | 84 + .../implementation/models/SendRequest9.java | 84 + .../implementation/models/package-info.java | 11 + .../union/implementation/package-info.java | 11 + .../src/main/java/type/union/models/Cat.java | 83 + .../src/main/java/type/union/models/Dog.java | 83 + .../type/union/models/EnumsOnlyCases.java | 105 + .../type/union/models/EnumsOnlyCasesLr.java | 66 + .../type/union/models/EnumsOnlyCasesUd.java | 56 + .../java/type/union/models/GetResponse.java | 83 + .../java/type/union/models/GetResponse1.java | 83 + .../java/type/union/models/GetResponse2.java | 83 + .../java/type/union/models/GetResponse3.java | 83 + .../java/type/union/models/GetResponse4.java | 83 + .../java/type/union/models/GetResponse5.java | 85 + .../java/type/union/models/GetResponse6.java | 83 + .../java/type/union/models/GetResponse7.java | 83 + .../java/type/union/models/GetResponse8.java | 83 + .../java/type/union/models/GetResponse9.java | 83 + .../type/union/models/GetResponseProp.java | 61 + .../type/union/models/GetResponseProp1.java | 57 + .../type/union/models/GetResponseProp2.java | 59 + .../type/union/models/GetResponseProp3.java | 59 + .../type/union/models/MixedLiteralsCases.java | 159 ++ .../type/union/models/MixedTypesCases.java | 182 ++ .../union/models/StringAndArrayCases.java | 108 + .../models/StringExtensibleNamedUnion.java | 57 + .../java/type/union/models/package-info.java | 11 + .../main/java/type/union/package-info.java | 11 + .../versioning/added/AddedAsyncClient.java | 165 ++ .../java/versioning/added/AddedClient.java | 161 ++ .../versioning/added/AddedClientBuilder.java | 332 +++ .../versioning/added/AddedServiceVersion.java | 45 + .../added/InterfaceV2AsyncClient.java | 101 + .../versioning/added/InterfaceV2Client.java | 99 + .../added/implementation/AddedClientImpl.java | 374 +++ .../implementation/InterfaceV2sImpl.java | 177 ++ .../added/implementation/package-info.java | 11 + .../java/versioning/added/models/EnumV1.java | 56 + .../java/versioning/added/models/EnumV2.java | 51 + .../java/versioning/added/models/ModelV1.java | 129 + .../java/versioning/added/models/ModelV2.java | 129 + .../versioning/added/models/package-info.java | 11 + .../java/versioning/added/package-info.java | 11 + .../madeoptional/MadeOptionalAsyncClient.java | 131 + .../madeoptional/MadeOptionalClient.java | 127 + .../MadeOptionalClientBuilder.java | 307 ++ .../MadeOptionalServiceVersion.java | 45 + .../MadeOptionalClientImpl.java | 263 ++ .../implementation/package-info.java | 11 + .../madeoptional/models/TestModel.java | 118 + .../madeoptional/models/package-info.java | 11 + .../versioning/madeoptional/package-info.java | 11 + .../removed/RemovedAsyncClient.java | 161 ++ .../versioning/removed/RemovedClient.java | 157 ++ .../removed/RemovedClientBuilder.java | 307 ++ .../removed/RemovedServiceVersion.java | 50 + .../implementation/RemovedClientImpl.java | 350 +++ .../removed/implementation/package-info.java | 11 + .../versioning/removed/models/EnumV2.java | 51 + .../versioning/removed/models/EnumV3.java | 56 + .../versioning/removed/models/ModelV2.java | 129 + .../versioning/removed/models/ModelV3.java | 105 + .../removed/models/package-info.java | 11 + .../java/versioning/removed/package-info.java | 11 + .../renamedfrom/NewInterfaceAsyncClient.java | 101 + .../renamedfrom/NewInterfaceClient.java | 99 + .../renamedfrom/RenamedFromAsyncClient.java | 104 + .../renamedfrom/RenamedFromClient.java | 101 + .../renamedfrom/RenamedFromClientBuilder.java | 332 +++ .../RenamedFromServiceVersion.java | 45 + .../implementation/NewInterfacesImpl.java | 178 ++ .../implementation/RenamedFromClientImpl.java | 272 ++ .../implementation/package-info.java | 11 + .../renamedfrom/models/NewEnum.java | 51 + .../renamedfrom/models/NewModel.java | 129 + .../renamedfrom/models/package-info.java | 11 + .../versioning/renamedfrom/package-info.java | 11 + .../ReturnTypeChangedFromAsyncClient.java | 92 + .../ReturnTypeChangedFromClient.java | 89 + .../ReturnTypeChangedFromClientBuilder.java | 308 ++ .../ReturnTypeChangedFromServiceVersion.java | 45 + .../ReturnTypeChangedFromClientImpl.java | 237 ++ .../implementation/package-info.java | 11 + .../returntypechangedfrom/package-info.java | 11 + .../TypeChangedFromAsyncClient.java | 101 + .../TypeChangedFromClient.java | 99 + .../TypeChangedFromClientBuilder.java | 308 ++ .../TypeChangedFromServiceVersion.java | 45 + .../TypeChangedFromClientImpl.java | 255 ++ .../implementation/package-info.java | 11 + .../typechangedfrom/models/TestModel.java | 105 + .../typechangedfrom/models/package-info.java | 11 + .../typechangedfrom/package-info.java | 11 + ...hentication-apikey_apiview_properties.json | 16 + .../authentication-apikey_metadata.json | 1 + ...cation-http-custom_apiview_properties.json | 16 + .../authentication-http-custom_metadata.json | 1 + ...hentication-oauth2_apiview_properties.json | 16 + .../authentication-oauth2_metadata.json | 1 + ...thentication-union_apiview_properties.json | 16 + .../authentication-union_metadata.json | 1 + ...erator-core-access_apiview_properties.json | 61 + ...-clientgenerator-core-access_metadata.json | 1 + ...core-alternatetype_apiview_properties.json | 25 + ...generator-core-alternatetype_metadata.json | 1 + ...-apiversion-header_apiview_properties.json | 12 + ...rator-core-apiversion-header_metadata.json | 1 + ...re-apiversion-path_apiview_properties.json | 12 + ...nerator-core-apiversion-path_metadata.json | 1 + ...e-apiversion-query_apiview_properties.json | 12 + ...erator-core-apiversion-query_metadata.json | 1 + ...ientinitialization_apiview_properties.json | 85 + ...or-core-clientinitialization_metadata.json | 1 + ...ore-clientlocation_apiview_properties.json | 53 + ...enerator-core-clientlocation_metadata.json | 1 + ...ze-emptystringnull_apiview_properties.json | 13 + ...-deserialize-emptystringnull_metadata.json | 1 + ...re-flattenproperty_apiview_properties.json | 20 + ...nerator-core-flattenproperty_metadata.json | 1 + ...-hierarchybuilding_apiview_properties.json | 35 + ...rator-core-hierarchybuilding_metadata.json | 1 + ...ore-methodoverride_apiview_properties.json | 31 + ...enerator-core-methodoverride_metadata.json | 1 + ...-core-nextlinkverb_apiview_properties.json | 11 + ...tgenerator-core-nextlinkverb_metadata.json | 1 + ...nerator-core-usage_apiview_properties.json | 25 + ...e-clientgenerator-core-usage_metadata.json | 1 + .../azure-core-basic_apiview_properties.json | 37 + .../META-INF/azure-core-basic_metadata.json | 1 + ...azure-core-lro-rpc_apiview_properties.json | 14 + .../META-INF/azure-core-lro-rpc_metadata.json | 1 + ...-core-lro-standard_apiview_properties.json | 22 + .../azure-core-lro-standard_metadata.json | 1 + .../azure-core-model_apiview_properties.json | 21 + .../META-INF/azure-core-model_metadata.json | 1 + .../azure-core-page_apiview_properties.json | 28 + .../META-INF/azure-core-page_metadata.json | 1 + .../azure-core-scalar_apiview_properties.json | 29 + .../META-INF/azure-core-scalar_metadata.json | 1 + .../azure-core-traits_apiview_properties.json | 19 + .../META-INF/azure-core-traits_metadata.json | 1 + ...re-encode-duration_apiview_properties.json | 13 + .../azure-encode-duration_metadata.json | 1 + ...zure-example-basic_apiview_properties.json | 16 + .../azure-example-basic_metadata.json | 1 + ...e-payload-pageable_apiview_properties.json | 11 + .../azure-payload-pageable_metadata.json | 1 + ...mization-generated_apiview_properties.json | 12 + ...r-armcustomization-generated_metadata.json | 1 + ...rmlegacy-generated_apiview_properties.json | 23 + ...emanager-armlegacy-generated_metadata.json | 1 + ...provider-generated_apiview_properties.json | 174 ++ ...rmresourceprovider-generated_metadata.json | 1 + ...lization-generated_apiview_properties.json | 56 + ...styleserialization-generated_metadata.json | 1 + ...ersioned-generated_apiview_properties.json | 22 + ...nager-armversioned-generated_metadata.json | 1 + ...combined-generated_apiview_properties.json | 22 + ...cemanager-combined-generated_metadata.json | 1 + ...operties-generated_apiview_properties.json | 28 + ...r-commonproperties-generated_metadata.json | 1 + ...geheader-generated_apiview_properties.json | 11 + ...anager-largeheader-generated_metadata.json | 1 + ...iptionid-generated_apiview_properties.json | 51 + ...thodsubscriptionid-generated_metadata.json | 1 + ...resource-generated_apiview_properties.json | 13 + ...anager-nonresource-generated_metadata.json | 1 + ...emplates-generated_apiview_properties.json | 48 + ...operationtemplates-generated_metadata.json | 1 + ...esources-generated_apiview_properties.json | 75 + ...emanager-resources-generated_metadata.json | 1 + ...xmsclientrequestid_apiview_properties.json | 12 + ...alheaders-xmsclientrequestid_metadata.json | 1 + ...ing-previewversion_apiview_properties.json | 23 + ...re-versioning-previewversion_metadata.json | 1 + ...nt-clientnamespace_apiview_properties.json | 22 + .../client-clientnamespace_metadata.json | 1 + ...aming-enumconflict_apiview_properties.json | 22 + .../client-naming-enumconflict_metadata.json | 1 + .../client-naming_apiview_properties.json | 63 + .../META-INF/client-naming_metadata.json | 1 + .../client-overload_apiview_properties.json | 17 + .../META-INF/client-overload_metadata.json | 1 + ...ientoperationgroup_apiview_properties.json | 42 + ...ructure-clientoperationgroup_metadata.json | 1 + ...ucture-multiclient_apiview_properties.json | 36 + ...client-structure-multiclient_metadata.json | 1 + ...e-renamedoperation_apiview_properties.json | 35 + ...t-structure-renamedoperation_metadata.json | 1 + ...-structure-service_apiview_properties.json | 55 + ...-twooperationgroup_apiview_properties.json | 35 + ...-structure-twooperationgroup_metadata.json | 1 + .../documentation_apiview_properties.json | 37 + .../META-INF/documentation_metadata.json | 1 + .../encode-array_apiview_properties.json | 28 + .../META-INF/encode-array_metadata.json | 1 + .../encode-bytes_apiview_properties.json | 108 + .../META-INF/encode-bytes_metadata.json | 1 + .../encode-datetime_apiview_properties.json | 95 + .../META-INF/encode-datetime_metadata.json | 1 + .../encode-duration_apiview_properties.json | 194 ++ .../META-INF/encode-duration_metadata.json | 1 + .../encode-numeric_apiview_properties.json | 23 + .../META-INF/encode-numeric_metadata.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../parameters-basic_apiview_properties.json | 20 + .../META-INF/parameters-basic_metadata.json | 1 + ...rs-bodyoptionality_apiview_properties.json | 27 + .../parameters-bodyoptionality_metadata.json | 1 + ...s-collectionformat_apiview_properties.json | 30 + .../parameters-collectionformat_metadata.json | 1 + .../parameters-path_apiview_properties.json | 16 + .../META-INF/parameters-path_metadata.json | 1 + .../parameters-spread_apiview_properties.json | 57 + .../META-INF/parameters-spread_metadata.json | 1 + ...contentnegotiation_apiview_properties.json | 27 + .../payload-contentnegotiation_metadata.json | 1 + ...oad-jsonmergepatch_apiview_properties.json | 23 + .../payload-jsonmergepatch_metadata.json | 1 + .../payload-mediatype_apiview_properties.json | 24 + .../META-INF/payload-mediatype_metadata.json | 1 + .../payload-multipart_apiview_properties.json | 80 + .../META-INF/payload-multipart_metadata.json | 1 + ...y-servicedriven-v1_apiview_properties.json | 20 + .../resiliency-servicedriven-v1_metadata.json | 1 + ...ency-servicedriven_apiview_properties.json | 24 + .../resiliency-servicedriven_metadata.json | 1 + ...se-statuscoderange_apiview_properties.json | 16 + .../response-statuscoderange_metadata.json | 1 + .../META-INF/routes_apiview_properties.json | 224 ++ .../resources/META-INF/routes_metadata.json | 1 + ...n-encodedname-json_apiview_properties.json | 17 + ...rialization-encodedname-json_metadata.json | 1 + ...ndpoint-notdefined_apiview_properties.json | 12 + .../server-endpoint-notdefined_metadata.json | 1 + ...rver-path-multiple_apiview_properties.json | 16 + .../server-path-multiple_metadata.json | 1 + ...server-path-single_apiview_properties.json | 12 + .../META-INF/server-path-single_metadata.json | 1 + ...sions-notversioned_apiview_properties.json | 20 + ...server-versions-notversioned_metadata.json | 1 + ...versions-versioned_apiview_properties.json | 24 + .../server-versions-versioned_metadata.json | 1 + ...tiservice-combined_apiview_properties.json | 18 + ...ervice-multiservice-combined_metadata.json | 1 + ...conditionalrequest_apiview_properties.json | 24 + ...alheaders-conditionalrequest_metadata.json | 1 + ...ders-repeatability_apiview_properties.json | 12 + ...specialheaders-repeatability_metadata.json | 1 + .../specialwords_apiview_properties.json | 453 +++ .../META-INF/specialwords_metadata.json | 1 + .../streaming-jsonl_apiview_properties.json | 16 + .../META-INF/streaming-jsonl_metadata.json | 1 + .../tsptest-builtin_apiview_properties.json | 18 + .../META-INF/tsptest-builtin_metadata.json | 1 + ...riminatoredgecases_apiview_properties.json | 21 + ...ptest-discriminatoredgecases_metadata.json | 1 + ...esteddiscriminator_apiview_properties.json | 39 + ...test-enumnesteddiscriminator_metadata.json | 1 + ...sptest-enumservice_apiview_properties.json | 77 + .../tsptest-enumservice_metadata.json | 1 + ...tsptest-errormodel_apiview_properties.json | 19 + .../META-INF/tsptest-errormodel_metadata.json | 1 + .../tsptest-flatten_apiview_properties.json | 39 + .../META-INF/tsptest-flatten_metadata.json | 1 + .../tsptest-internal_apiview_properties.json | 26 + .../META-INF/tsptest-internal_metadata.json | 1 + ...est-literalservice_apiview_properties.json | 15 + .../tsptest-literalservice_metadata.json | 1 + ...sptest-longrunning_apiview_properties.json | 26 + .../tsptest-longrunning_metadata.json | 1 + ...est-methodoverride_apiview_properties.json | 41 + .../tsptest-methodoverride_metadata.json | 1 + .../tsptest-model_apiview_properties.json | 33 + .../META-INF/tsptest-model_metadata.json | 1 + ...-multicontenttypes_apiview_properties.json | 25 + .../tsptest-multicontenttypes_metadata.json | 1 + .../tsptest-multipart_apiview_properties.json | 24 + .../META-INF/tsptest-multipart_metadata.json | 1 + ...st-namespaceclient_apiview_properties.json | 13 + .../tsptest-namespaceclient_metadata.json | 1 + .../tsptest-naming_apiview_properties.json | 29 + .../META-INF/tsptest-naming_metadata.json | 1 + ...t-namingjavaparser_apiview_properties.json | 29 + .../tsptest-namingjavaparser_metadata.json | 1 + .../tsptest-optional_apiview_properties.json | 15 + .../META-INF/tsptest-optional_metadata.json | 1 + .../tsptest-patch_apiview_properties.json | 31 + .../META-INF/tsptest-patch_metadata.json | 1 + ...tocolandconvenient_apiview_properties.json | 28 + ...sptest-protocolandconvenient_metadata.json | 1 + .../tsptest-response_apiview_properties.json | 88 + .../META-INF/tsptest-response_metadata.json | 1 + ...ptest-specialchars_apiview_properties.json | 14 + .../tsptest-specialchars_metadata.json | 1 + ...est-specialheaders_apiview_properties.json | 49 + .../tsptest-specialheaders_metadata.json | 1 + .../tsptest-subclass_apiview_properties.json | 19 + .../META-INF/tsptest-subclass_metadata.json | 1 + .../tsptest-union_apiview_properties.json | 31 + .../META-INF/tsptest-union_metadata.json | 1 + ...tsptest-versioning_apiview_properties.json | 20 + .../META-INF/tsptest-versioning_metadata.json | 1 + ...tsptest-visibility_apiview_properties.json | 40 + .../META-INF/tsptest-visibility_metadata.json | 1 + .../tsptest-wiretype_apiview_properties.json | 25 + .../META-INF/tsptest-wiretype_metadata.json | 1 + .../type-array_apiview_properties.json | 147 + .../META-INF/type-array_metadata.json | 1 + .../type-dictionary_apiview_properties.json | 117 + .../META-INF/type-dictionary_metadata.json | 1 + ...e-enums-extensible_apiview_properties.json | 25 + .../type-enums-extensible_metadata.json | 1 + .../type-enums-fixed_apiview_properties.json | 21 + .../META-INF/type-enums-fixed_metadata.json | 1 + .../type-model-empty_apiview_properties.json | 23 + .../META-INF/type-model-empty_metadata.json | 1 + ...-enumdiscriminator_apiview_properties.json | 46 + ...nheritance-enumdiscriminator_metadata.json | 1 + ...esteddiscriminator_apiview_properties.json | 37 + ...eritance-nesteddiscriminator_metadata.json | 1 + ...e-notdiscriminated_apiview_properties.json | 23 + ...inheritance-notdiscriminated_metadata.json | 1 + ...eritance-recursive_apiview_properties.json | 18 + ...-model-inheritance-recursive_metadata.json | 1 + ...inglediscriminator_apiview_properties.json | 43 + ...eritance-singlediscriminator_metadata.json | 1 + .../type-model-usage_apiview_properties.json | 23 + .../META-INF/type-model-usage_metadata.json | 1 + ...e-model-visibility_apiview_properties.json | 38 + .../type-model-visibility_metadata.json | 1 + ...ditionalproperties_apiview_properties.json | 353 +++ ...roperty-additionalproperties_metadata.json | 1 + ...-property-nullable_apiview_properties.json | 140 + .../type-property-nullable_metadata.json | 1 + ...-property-optional_apiview_properties.json | 317 +++ .../type-property-optional_metadata.json | 1 + ...roperty-valuetypes_apiview_properties.json | 332 +++ .../type-property-valuetypes_metadata.json | 1 + .../type-scalar_apiview_properties.json | 84 + .../META-INF/type-scalar_metadata.json | 1 + ...nion-discriminated_apiview_properties.json | 46 + .../type-union-discriminated_metadata.json | 1 + .../type-union_apiview_properties.json | 139 + .../META-INF/type-union_metadata.json | 1 + .../versioning-added_apiview_properties.json | 26 + .../META-INF/versioning-added_metadata.json | 1 + ...oning-madeoptional_apiview_properties.json | 13 + .../versioning-madeoptional_metadata.json | 1 + ...versioning-removed_apiview_properties.json | 20 + .../META-INF/versioning-removed_metadata.json | 1 + ...ioning-renamedfrom_apiview_properties.json | 20 + .../versioning-renamedfrom_metadata.json | 1 + ...urntypechangedfrom_apiview_properties.json | 12 + ...ioning-returntypechangedfrom_metadata.json | 1 + ...ng-typechangedfrom_apiview_properties.json | 13 + .../versioning-typechangedfrom_metadata.json | 1 + .../authentication-apikey.properties | 2 + .../authentication-http-custom.properties | 2 + .../authentication-oauth2.properties | 2 + .../resources/authentication-union.properties | 2 + ...ure-clientgenerator-core-access.properties | 2 + ...entgenerator-core-alternatetype.properties | 2 + ...enerator-core-apiversion-header.properties | 2 + ...tgenerator-core-apiversion-path.properties | 2 + ...generator-core-apiversion-query.properties | 2 + ...rator-core-clientinitialization.properties | 2 + ...ntgenerator-core-clientlocation.properties | 2 + ...ore-deserialize-emptystringnull.properties | 2 + ...tgenerator-core-flattenproperty.properties | 2 + ...enerator-core-hierarchybuilding.properties | 2 + ...ntgenerator-core-methodoverride.properties | 2 + ...ientgenerator-core-nextlinkverb.properties | 2 + ...zure-clientgenerator-core-usage.properties | 2 + .../resources/azure-core-basic.properties | 2 + .../resources/azure-core-lro-rpc.properties | 2 + .../azure-core-lro-standard.properties | 2 + .../resources/azure-core-model.properties | 2 + .../main/resources/azure-core-page.properties | 2 + .../resources/azure-core-scalar.properties | 2 + .../resources/azure-core-traits.properties | 2 + .../azure-encode-duration.properties | 2 + .../resources/azure-example-basic.properties | 2 + .../azure-payload-pageable.properties | 2 + ...ager-armcustomization-generated.properties | 1 + ...urcemanager-armlegacy-generated.properties | 1 + ...r-armresourceprovider-generated.properties | 1 + ...eamstyleserialization-generated.properties | 1 + ...emanager-armversioned-generated.properties | 1 + ...ourcemanager-combined-generated.properties | 1 + ...ager-commonproperties-generated.properties | 1 + ...cemanager-largeheader-generated.properties | 1 + ...-methodsubscriptionid-generated.properties | 1 + ...cemanager-nonresource-generated.properties | 1 + ...er-operationtemplates-generated.properties | 1 + ...urcemanager-resources-generated.properties | 1 + ...ecialheaders-xmsclientrequestid.properties | 2 + ...azure-versioning-previewversion.properties | 2 + .../client-clientnamespace.properties | 2 + .../client-naming-enumconflict.properties | 2 + .../main/resources/client-naming.properties | 2 + .../main/resources/client-overload.properties | 2 + ...-structure-clientoperationgroup.properties | 2 + .../client-structure-multiclient.properties | 2 + ...ient-structure-renamedoperation.properties | 2 + .../client-structure-service.properties | 2 + ...ent-structure-twooperationgroup.properties | 2 + .../main/resources/documentation.properties | 2 + .../main/resources/encode-array.properties | 2 + .../main/resources/encode-bytes.properties | 2 + .../main/resources/encode-datetime.properties | 2 + .../main/resources/encode-duration.properties | 2 + .../main/resources/encode-numeric.properties | 2 + .../resources/parameters-basic.properties | 2 + .../parameters-bodyoptionality.properties | 2 + .../parameters-collectionformat.properties | 2 + .../main/resources/parameters-path.properties | 2 + .../resources/parameters-spread.properties | 2 + .../payload-contentnegotiation.properties | 2 + .../payload-jsonmergepatch.properties | 2 + .../resources/payload-mediatype.properties | 2 + .../resources/payload-multipart.properties | 2 + .../resiliency-servicedriven-v1.properties | 2 + .../resiliency-servicedriven.properties | 2 + .../response-statuscoderange.properties | 2 + .../src/main/resources/routes.properties | 2 + .../serialization-encodedname-json.properties | 2 + .../server-endpoint-notdefined.properties | 2 + .../resources/server-path-multiple.properties | 2 + .../resources/server-path-single.properties | 2 + .../server-versions-notversioned.properties | 2 + .../server-versions-versioned.properties | 2 + .../service-multiservice-combined.properties | 2 + ...ecialheaders-conditionalrequest.properties | 2 + .../specialheaders-repeatability.properties | 2 + .../main/resources/specialwords.properties | 2 + .../main/resources/streaming-jsonl.properties | 2 + .../main/resources/tsptest-builtin.properties | 2 + .../tsptest-clientinitialization.properties | 2 + .../tsptest-discriminatoredgecases.properties | 2 + ...tsptest-enumnesteddiscriminator.properties | 2 + .../resources/tsptest-enumservice.properties | 2 + .../resources/tsptest-errormodel.properties | 2 + .../main/resources/tsptest-flatten.properties | 2 + .../resources/tsptest-internal.properties | 2 + .../tsptest-literalservice.properties | 2 + .../resources/tsptest-longrunning.properties | 2 + .../tsptest-methodoverride.properties | 2 + .../main/resources/tsptest-model.properties | 2 + .../tsptest-multicontenttypes.properties | 2 + .../resources/tsptest-multipart.properties | 2 + .../tsptest-namespaceclient.properties | 2 + .../main/resources/tsptest-naming.properties | 2 + .../tsptest-namingjavaparser.properties | 2 + .../resources/tsptest-optional.properties | 2 + .../main/resources/tsptest-patch.properties | 2 + .../tsptest-protocolandconvenient.properties | 2 + .../resources/tsptest-response.properties | 2 + .../resources/tsptest-specialchars.properties | 2 + .../tsptest-specialheaders.properties | 2 + .../resources/tsptest-subclass.properties | 2 + .../main/resources/tsptest-union.properties | 2 + .../resources/tsptest-versioning.properties | 2 + .../resources/tsptest-visibility.properties | 2 + .../resources/tsptest-wiretype.properties | 2 + .../src/main/resources/type-array.properties | 2 + .../main/resources/type-dictionary.properties | 2 + .../type-enums-extensible.properties | 2 + .../resources/type-enums-fixed.properties | 2 + .../resources/type-model-empty.properties | 2 + ...l-inheritance-enumdiscriminator.properties | 2 + ...inheritance-nesteddiscriminator.properties | 2 + ...el-inheritance-notdiscriminated.properties | 2 + ...ype-model-inheritance-recursive.properties | 2 + ...inheritance-singlediscriminator.properties | 2 + .../resources/type-model-usage.properties | 2 + .../type-model-visibility.properties | 2 + ...e-property-additionalproperties.properties | 2 + .../type-property-nullable.properties | 2 + .../type-property-optional.properties | 2 + .../type-property-valuetypes.properties | 2 + .../src/main/resources/type-scalar.properties | 2 + .../type-union-discriminated.properties | 2 + .../src/main/resources/type-union.properties | 2 + .../resources/versioning-added.properties | 2 + .../versioning-madeoptional.properties | 2 + .../resources/versioning-removed.properties | 2 + .../versioning-renamedfrom.properties | 2 + ...ersioning-returntypechangedfrom.properties | 2 + .../versioning-typechangedfrom.properties | 2 + .../example/basic/generated/BasicAction.java | 42 + .../builtin/generated/BuiltinOpRead.java | 20 + .../builtin/generated/BuiltinOpWrite.java | 51 + .../flatten/generated/FlattenOpSend.java | 20 + .../flatten/generated/FlattenOpSendLong.java | 29 + .../generated/LongRunningCreateJob.java | 39 + .../model/generated/ModelOpPutNested.java | 20 + ...ntTypeUploadImageForSingleContentType.java | 23 + .../response/generated/ResponseOpExists.java | 20 + .../generated/ResponseOpListStrings.java | 21 + .../specialchars/generated/BuiltinOpRead.java | 21 + .../generated/EtagHeadersListWithEtag.java | 22 + .../EtagHeadersPutWithRequestHeaders.java | 24 + .../generated/VersioningOpList.java | 23 + .../generated/ApiKeyClientTestBase.java | 34 + .../generated/CustomClientTestBase.java | 34 + .../generated/OAuth2ClientTestBase.java | 41 + .../union/generated/UnionClientTestBase.java | 41 + .../generated/AccessClientTestBase.java | 70 + .../AlternateTypeClientTestBase.java | 34 + .../generated/HeaderClientTestBase.java | 34 + .../path/generated/PathClientTestBase.java | 34 + .../query/generated/QueryClientTestBase.java | 34 + .../generated/HeaderParamClientTestBase.java | 119 + .../ClientLocationClientTestBase.java | 118 + ...ializeEmptyStringAsNullClientTestBase.java | 35 + .../FlattenPropertyClientTestBase.java | 34 + .../HierarchyBuildingClientTestBase.java | 58 + .../generated/OverrideClientTestBase.java | 70 + .../generated/NextLinkVerbClientTestBase.java | 34 + .../usage/generated/UsageClientTestBase.java | 34 + .../basic/generated/BasicClientTestBase.java | 34 + .../lro/rpc/generated/RpcClientTestBase.java | 34 + .../generated/StandardClientTestBase.java | 34 + .../model/generated/ModelClientTestBase.java | 34 + .../page/generated/PageClientTestBase.java | 46 + .../generated/ScalarClientTestBase.java | 34 + .../generated/TraitsClientTestBase.java | 34 + .../generated/DurationClientTestBase.java | 34 + .../generated/AzureExampleClientTestBase.java | 34 + .../basic/generated/BasicActionTests.java | 44 + .../generated/PageableClientTestBase.java | 34 + .../generated/OperationDisplayTests.java | 18 + .../generated/OperationInnerTests.java | 17 + .../generated/OperationListResultTests.java | 19 + .../ResourceGroupResourceInnerTests.java | 47 + .../ResourceGroupResourcePropertiesTests.java | 27 + .../SubscriptionResource1InnerTests.java | 28 + .../SubscriptionResource1PropertiesTests.java | 26 + .../SubscriptionResource2InnerTests.java | 28 + .../SubscriptionResource2PropertiesTests.java | 26 + .../SubscriptionResourceInnerTests.java | 28 + .../SubscriptionResourcePropertiesTests.java | 26 + .../combined/generated/DiskInnerTests.java | 45 + .../generated/DiskPropertiesTests.java | 22 + .../generated/VirtualMachineInnerTests.java | 45 + .../VirtualMachinePropertiesTests.java | 22 + .../XmsClientRequestIdClientTestBase.java | 34 + .../PreviewVersionClientTestBase.java | 34 + .../ClientNamespaceFirstClientTestBase.java | 47 + .../generated/EnumConflictClientTestBase.java | 46 + .../generated/NamingClientTestBase.java | 58 + .../generated/OverloadClientTestBase.java | 34 + .../generated/FirstClientTestBase.java | 89 + .../generated/ClientAClientTestBase.java | 50 + .../RenamedOperationClientTestBase.java | 49 + .../ServiceClientClientTestBase.java | 101 + .../TwoOperationGroupClientTestBase.java | 49 + .../DocumentationClientTestBase.java | 46 + .../array/generated/ArrayClientTestBase.java | 34 + .../bytes/generated/BytesClientTestBase.java | 82 + .../generated/DatetimeClientTestBase.java | 70 + .../generated/DurationClientTestBase.java | 58 + .../generated/NumericClientTestBase.java | 34 + .../basic/generated/BasicClientTestBase.java | 46 + .../BodyOptionalityClientTestBase.java | 46 + .../CollectionFormatClientTestBase.java | 46 + .../path/generated/PathClientTestBase.java | 34 + .../generated/SpreadClientTestBase.java | 46 + .../ContentNegotiationClientTestBase.java | 46 + .../JsonMergePatchClientTestBase.java | 34 + .../generated/MediaTypeClientTestBase.java | 34 + .../generated/MultiPartClientTestBase.java | 72 + ...ResiliencyServiceDrivenClientTestBase.java | 37 + ...ResiliencyServiceDrivenClientTestBase.java | 37 + .../StatusCodeRangeClientTestBase.java | 34 + .../generated/RoutesClientTestBase.java | 239 ++ .../json/generated/JsonClientTestBase.java | 34 + .../generated/NotDefinedClientTestBase.java | 34 + .../generated/MultipleClientTestBase.java | 34 + .../generated/SingleClientTestBase.java | 34 + .../generated/NotVersionedClientTestBase.java | 34 + .../generated/VersionedClientTestBase.java | 34 + .../combined/generated/CombinedTestBase.java | 46 + .../ConditionalRequestClientTestBase.java | 34 + .../RepeatabilityClientTestBase.java | 34 + .../generated/SpecialWordsClientTestBase.java | 70 + .../jsonl/generated/JsonlClientTestBase.java | 34 + .../TopLevelArmResourceInnerTests.java | 45 + .../TopLevelArmResourceListResultTests.java | 21 + .../TopLevelArmResourcePropertiesTests.java | 22 + .../generated/BuiltinClientTestBase.java | 34 + .../builtin/generated/BuiltinOpReadTests.java | 61 + .../generated/BuiltinOpWriteTests.java | 50 + .../ClientInitializationClientTestBase.java | 34 + .../DiscriminatorEdgeCasesClientTestBase.java | 35 + ...EnumNestedDiscriminatorClientTestBase.java | 35 + .../generated/EnumServiceClientTestBase.java | 34 + .../generated/ErrorModelClientTestBase.java | 34 + .../generated/FlattenClientTestBase.java | 34 + .../generated/FlattenOpSendLongTests.java | 28 + .../flatten/generated/FlattenOpSendTests.java | 19 + .../generated/InternalClientTestBase.java | 34 + .../LiteralServiceClientTestBase.java | 34 + .../generated/LongRunningClientTestBase.java | 34 + .../generated/LongRunningCreateJobTests.java | 43 + .../MethodOverrideClientTestBase.java | 34 + .../model/generated/ModelClientTestBase.java | 34 + .../generated/ModelOpPutNestedTests.java | 31 + .../MultiContentTypesClientTestBase.java | 59 + ...eUploadImageForSingleContentTypeTests.java | 21 + .../generated/MultipartClientTestBase.java | 34 + .../generated/NamespaceClientTestBase.java | 34 + .../generated/NamingClientTestBase.java | 34 + .../NamingJavaParserClientTestBase.java | 34 + .../generated/OptionalClientTestBase.java | 34 + .../patch/generated/PatchClientTestBase.java | 34 + .../ProtocolAndConvenientClientTestBase.java | 34 + .../generated/ResponseClientTestBase.java | 34 + .../generated/ResponseOpExistsTests.java | 22 + .../generated/ResponseOpListStringsTests.java | 23 + .../generated/BuiltinOpReadTests.java | 23 + .../generated/SpecialCharsClientTestBase.java | 34 + .../EtagHeadersListWithEtagTests.java | 37 + ...EtagHeadersPutWithRequestHeadersTests.java | 34 + .../SpecialHeadersClientTestBase.java | 70 + .../generated/SubclassClientTestBase.java | 34 + .../union/generated/UnionClientTestBase.java | 34 + .../generated/VersioningClientTestBase.java | 34 + .../generated/VersioningOpListTests.java | 33 + .../generated/VisibilityClientTestBase.java | 58 + .../generated/WireTypeClientTestBase.java | 34 + .../array/generated/ArrayClientTestBase.java | 190 ++ .../generated/DictionaryClientTestBase.java | 154 + .../generated/ExtensibleClientTestBase.java | 34 + .../fixed/generated/FixedClientTestBase.java | 34 + .../empty/generated/EmptyClientTestBase.java | 34 + .../EnumDiscriminatorClientTestBase.java | 34 + .../NestedDiscriminatorClientTestBase.java | 34 + .../NotDiscriminatedClientTestBase.java | 34 + .../generated/RecursiveClientTestBase.java | 34 + .../SingleDiscriminatorClientTestBase.java | 34 + .../usage/generated/UsageClientTestBase.java | 34 + .../generated/VisibilityClientTestBase.java | 34 + .../AdditionalPropertiesClientTestBase.java | 411 +++ .../generated/NullableClientTestBase.java | 106 + .../generated/OptionalClientTestBase.java | 214 ++ .../generated/ValueTypesClientTestBase.java | 370 +++ .../generated/ScalarClientTestBase.java | 106 + .../DiscriminatedClientTestBase.java | 72 + .../union/generated/UnionClientTestBase.java | 142 + .../added/generated/AddedClientTestBase.java | 46 + .../generated/MadeOptionalClientTestBase.java | 34 + .../generated/RemovedClientTestBase.java | 34 + .../generated/RenamedFromClientTestBase.java | 46 + .../ReturnTypeChangedFromClientTestBase.java | 34 + .../TypeChangedFromClientTestBase.java | 34 + 3429 files changed, 422336 insertions(+), 28546 deletions(-) delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/README.md delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/examples/2022-12-01-preview/basic.json delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/error.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/managed-identity.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service1.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service2.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/non-resource.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/available-operations.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/checkname-availability.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/lro.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/optional-body.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/extension.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/location.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/nested.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/singleton.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/toplevel.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/naming/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/naming/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/overload/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/overload/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/overload/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/encode/array/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/encode/array/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/helper.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/old.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/routes/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/routes/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/scratch/.npmignore delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/client.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/special-words/dec.js delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/special-words/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/special-words/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/array/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/array/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/union/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/type/union/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/mockapi.ts delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/main.tsp delete mode 100644 packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/mockapi.ts create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/CustomClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2AsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2Client.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2ClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/OAuth2ClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/UnionClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/AccessClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/AccessClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/InternalOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/PublicOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/RelativeModelInOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/SharedModelInOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/InternalDecoratorModelInInternal.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/NoDecoratorModelInInternal.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/PublicDecoratorModelInInternal.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/NoDecoratorModelInPublic.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/PublicDecoratorModelInPublic.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/AbstractModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/BaseModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/InnerModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/OuterModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/RealModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/SharedModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/ModelWithFeatureProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/AlternateTypeClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/ExternalTypesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/HeaderClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/PathClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/QueryClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ChildClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/HeaderParamClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MixedParamsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MultipleParamsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParamAliasClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParentClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/PathParamClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/BlobProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/Input.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/WithBodyRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ArchiveOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ClientLocationClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveMethodParameterToBlobOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubAdminOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubUserOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToNewSubProductOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToRootResourceOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/Blob.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/DeserializeEmptyStringAsNullClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/ResponseModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/FlattenPropertyClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildFlattenModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/FlattenModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/NestedFlattenModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/HierarchyBuildingClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/AnimalOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/DogOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/HierarchyBuildingClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/PetOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Animal.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Dog.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Pet.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/OverrideClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/OverrideClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RemoveOptionalParametersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/ReorderParametersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RequireOptionalParametersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/GroupParametersOptions.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/NextLinkVerbClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/Test.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/ModelInOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/UsageClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/InputModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OrphanModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OutputModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/ResultModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/RoundTripModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/BasicClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/JsonMergePatchHelper.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/User.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserList.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserOrder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/OperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/PollingUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/RpcClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/SyncOperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationOptions.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/OperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/PollingUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/StandardClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/SyncOperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/ExportedUser.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/User.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/AzureCoreEmbeddingVectorsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/ModelClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/AzureEmbeddingModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/PageClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/FirstItem.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputBody.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputExtensibleEnum.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/SecondItem.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/User.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/UserOrder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/AzureLocationScalarsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/ScalarClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/AzureLocationModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/TraitsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/User.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionParam.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/DurationClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/DurationModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/BasicServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/AzureExampleClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Enum.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Model.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/PageableClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/User.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/CommonPropertiesManager.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/CommonPropertiesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ErrorsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ManagedIdentitiesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ConfidentialResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ManagedIdentityTrackedResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ConfidentialResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentityTrackedResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ResourceManagerUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiError.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiErrorException.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/Errors.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/InnerError.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentities.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentity.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentityType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/UserAssignedIdentity.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/LargeHeaderManager.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeaderClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeadersClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/CancelResultInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/CancelResultImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/ResourceManagerUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/CancelResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/LargeHeaders.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/MethodSubscriptionIdManager.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MethodSubscriptionIdClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementResourceGroupResourceOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementSubscriptionResourceOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/OperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/OperationInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/ResourceGroupResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource1Inner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource2Inner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceGroupResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceManagerUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource1Impl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource2Impl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/models/OperationListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ActionType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementResourceGroupResourceOperations.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementSubscriptionResourceOperations.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operation.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/OperationDisplay.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operations.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Origin.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceProvisioningState.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1Properties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2Properties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/CombinedManager.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/Combined.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/DisksClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/VirtualMachinesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/DiskInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/VirtualMachineInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DiskImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/ResourceManagerUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachineImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disk.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/DiskProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disks.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/ResourceProvisioningState.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachine.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachineProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachines.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/NonResourceManager.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/NonResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/ResourceManagerUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResourceOperations.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/OperationTemplatesManager.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/CheckNameAvailabilitiesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/LroesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationTemplatesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OptionalBodiesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ActionResultInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ChangeAllowanceResultInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/CheckNameAvailabilityResponseInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ExportResultInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OperationInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OrderInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/WidgetInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ActionResultImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ChangeAllowanceResultImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilityResponseImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ExportResultImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OrderImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ResourceManagerUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/WidgetImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/models/OperationListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilities.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityReason.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Lroes.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operation.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OperationDisplay.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operations.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OptionalBodies.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Order.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OrderProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Origin.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Widget.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/WidgetProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/ResourcesManager.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ExtensionsResourcesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/LocationResourcesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/NestedsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ResourcesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/SingletonsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/TopLevelsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/ExtensionsResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/LocationResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/NestedProxyResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/SingletonTrackedResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/TopLevelTrackedResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedProxyResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourceManagerUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonTrackedResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelTrackedResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/ExtensionsResourceListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/LocationResourceListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/NestedProxyResourceListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/SingletonTrackedResourceListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/TopLevelTrackedResourceListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResources.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResources.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Nesteds.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NotificationDetails.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ProvisioningState.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Singletons.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevels.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/XmsClientRequestIdClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/JsonMergePatchHelper.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/PreviewVersionClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/ListWidgetsResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/UpdateWidgetColorRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/Widget.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/FirstClientResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceFirstClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceSecondClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/SecondClientResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/SecondClientEnumType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/EnumConflictClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/FirstModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/Status.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/EnumConflictClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/FirstOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/SecondOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondStatus.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/ModelClientsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/NamingClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/UnionEnumsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/ClientModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/JavaModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameAndJsonEncodedNameModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/LanguageClientNameModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ClientExtensibleEnum.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ExtensibleEnum.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/OverloadClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/Resource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5AsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5Client.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3AsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3Client.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4AsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4Client.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/FirstClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group3sImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group4sImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group5sImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/SecondClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientAClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientBClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/GroupsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/RenamedOperationClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BarsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BazFoosImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/FoosImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxBarsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/ServiceClientClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/ClientType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1AsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1Client.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2AsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2Client.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/TwoOperationGroupClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group1sImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group2sImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/TwoOperationGroupClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/DocumentationClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/DocumentationClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/ListsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/TextFormattingsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/BulletPointsModelRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsEnum.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/ArrayClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/PropertiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/CommaDelimitedArrayProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/NewlineDelimitedArrayProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/PipeDelimitedArrayProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/SpaceDelimitedArrayProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/BytesClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/BytesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/HeadersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/PropertiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/QueriesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/RequestBodiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/ResponseBodiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64BytesProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlArrayBytesProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlBytesProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/DefaultBytesProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/DatetimeClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/DatetimeClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/HeadersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/PropertiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/QueriesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/ResponseHeadersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/DefaultDatetimeProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc3339DatetimeProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc7231DatetimeProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampArrayDatetimeProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampDatetimeProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/DurationClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/DurationClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/HeadersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/PropertiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/QueriesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/DefaultDurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64MillisecondsDurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64SecondsDurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationArrayProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsLargerUnitDurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationArrayProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsLargerUnitDurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/ISO8601DurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsDurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsLargerUnitDurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsDurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsLargerUnitDurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/NumericClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/PropertiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/SafeintAsStringProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint32AsStringProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint8AsStringProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/BasicClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/User.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/BasicClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ExplicitBodiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ImplicitBodiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/SimpleRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/OptionalExplicitsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/BodyModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/CollectionFormatClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/HeadersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/QueriesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/PathClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/SpreadClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/SpreadAsRequestBodyRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/AliasImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/ModelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/SpreadClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadAsRequestParameterRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadCompositeRequestMixRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerAliasRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerModelRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadWithMultipleParametersRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/BodyParameter.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/ContentNegotiationClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/PngImageAsJson.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/DifferentBodiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/SameBodiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchHelper.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/InnerModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/Resource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/ResourcePatch.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/StringBodiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/MultiPartClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/FloatRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/AnonymousModelRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsContentTypesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsNonStringsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDatasImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultiPartClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultipartFormDataHelper.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/Address.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/BinaryArrayPartsRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexHttpPartsModelRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexPartsRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileOptionalContentType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileRequiredMetaData.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileSpecificContentType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartOptionalContentTypeRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartRequiredContentTypeRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartSpecificContentTypeRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/JsonPartRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiBinaryPartsRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiPartRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PictureFileDetails.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PicturesFileDetails.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ProfileImageFileDetails.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ServiceDrivenServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/ResiliencyServiceDrivenClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ServiceDrivenServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/ResiliencyServiceDrivenClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/StatusCodeRangeClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/InInterfacesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionExplodesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionStandardsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionExplodesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionStandardsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionExplodesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionStandardsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersReservedExpansionsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionExplodesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionStandardsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationExplodesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationStandardsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionExplodesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionStandardsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/RoutesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/PropertiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/JsonEncodedNameModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/MultipleClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/SingleClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/CombinedBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/BarsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/CombinedImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/FoosImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/ConditionalRequestClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/RepeatabilityClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/SpecialWordsClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelPropertiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/OperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ParametersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/SpecialWordsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/DictMethods.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/SameAsModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/And.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/As.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Assert.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Async.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Await.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Break.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/ClassModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Constructor.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Continue.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Def.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Del.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Elif.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Else.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Except.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Exec.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Finally.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/For.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/From.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Global.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/If.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Import.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/In.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Is.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Lambda.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Not.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Or.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Pass.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Raise.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Return.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Try.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/While.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/With.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Yield.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/BasicsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/JsonlClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/ArmCustomizationManager.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/ArmCustomizationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/VaultsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/VaultInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ResourceManagerUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vault.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/VaultProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vaults.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/ArmLegacyManager.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/ArmLegacyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/SkusClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/SkuResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ResourceManagerUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkuResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ProvisioningState.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ResourceTypeSku.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/SkuResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/Skus.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildExtensionResourceInterfacesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildResourcesInterfacesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/CustomTemplateResourceInterfacesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ImmutableResourceModelsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/LroNoBodiesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ManagedMaintenanceWindowStatusOperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ModelInterfaceSameNamesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/OperationsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/TopLevelArmResourceInterfacesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildExtensionResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusContentProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceDifferentNameProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceSameNameInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/OperationInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResourceLroNoBodyProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResultInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceUpdateProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNameImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResourceManagerUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResultImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildExtensionResourceListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildResourceListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/OperationListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ResourceListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionFinalResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/AnonymousEmptyModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceInterfaces.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceUpdate.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourceUpdate.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourcesInterfaces.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourceInterfaces.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourcePatch.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Dog.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/DogKind.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/EmptyModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Golden.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ImmutableResourceModels.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/LroNoBodies.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatus.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatusOperations.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentity.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentityType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameName.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameNames.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponseProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operation.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/OperationDisplay.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operations.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Origin.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/PriorityModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ProvisioningState.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ResourceLroNoBody.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Result.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceInterfaces.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceUpdate.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/UserAssignedIdentity.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/ArmResourceProviderManager.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ArmResourceProviderManagementClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FishesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FunctionsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ItemsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/PrioritiesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/TopLevelArmResourcesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/AnotherFishProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/EyeProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionConfiguration.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/ResultData.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/SalmonInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TailProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TopLevelArmResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/OutputOnlyModelImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ResourceManagerUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/SalmonImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/models/ListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/AggregateFunctionProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Builtin.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Dog.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/DogKind.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Encoded.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Error.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorException.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMin.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMinException.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fish.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fishes.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Function.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Functions.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionHeaders.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/GoblinShark.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Golden.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Items.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModelChild.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priorities.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priority.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Result.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Salmon.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Shark.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceTagsUpdate.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResources.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/ArmVersionedManager.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/ArmVersionedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/TopLevelArmResourcesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/TopLevelArmResourceInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ResourceManagerUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourceImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/models/TopLevelArmResourceListResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/ResourceProvisioningState.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResourceProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResources.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Builtin.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Encoded.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/ClientInitializationClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/SubClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/DiscriminatorEdgeCasesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithAnotherDiscriminator.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithRequiredPropertyAsDiscriminator.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithAnotherDiscriminator.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithRequiredProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ParentWithRequiredProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/EnumNestedDiscriminatorClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Fish.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/FishKind.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/GoblinShark.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Salmon.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SawShark.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Shark.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SharkKind.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/EnumServiceClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Color.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/ColorModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OlympicRecordModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Operation.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationName.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationStateValues.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Priority.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/PriorityModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Unit.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorModelClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseError.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseErrorException.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchError.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorException.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorMessage.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Details.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Diagnostic.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/InnerError.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/SubError.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/FlattenClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/JsonMergePatchHelper.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendLongRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendOptionalBodyRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendProjectedNameRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongOptions.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongRequestStatus.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItem.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatch.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatchStatus.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/UpdatePatchRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/User.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/Color.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/ColorModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/RequestInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternal.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternalInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneData.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneDataInner.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/UnusedEnum.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralServiceClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/Model.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/ModelOptionalLiteral.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/PutRequestOptionalLiteralParam.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/LongRunningClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/OperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/PollingUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/SyncOperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobData.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResultResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobStatus.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/OperationState.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/PollResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupAllRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupNoneRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartETagRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupAllOptions.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupExcludeBodyModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartETagOptions.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartOptions.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/InputOutputData2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel1.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData3.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource1.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource3.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultiContentTypesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/SingleContentTypesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/Resource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartFormDataHelper.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDataFileDetails.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDetails.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FormData.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageFileDetails.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/InheritFileData.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/Size.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/UploadHttpPartRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/NamespaceClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/Model.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BinaryData.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BytesData.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/Data.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataStatus.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/GetAnonymousResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParameters.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParametersType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObject.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorCodeRenamed.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorRenamed.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/TypesModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingJavaParserClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BinaryData.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BytesData.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/Data.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataStatus.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/GetAnonymousResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParameters.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParametersType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObject.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastError1.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastErrorCode.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/TypesModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/AllPropertiesOptional.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/ImmutableModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/Optional.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/JsonMergePatchHelper.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Fish.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/InnerModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Resource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/ResourceEnumValue.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Salmon.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/SawShark.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Shark.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/OperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/PollingUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenientClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/SyncOperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceA.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceB.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceE.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceF.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceI.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceJ.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/OperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/PollingUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/ResponseClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/SyncOperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails1.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationState.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/Resource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/BuiltinOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/SpecialCharsClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/ReadRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/Resource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/JsonMergePatchHelper.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/OperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/PollingUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/RepeatabilityHeadersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SkipSpecialHeadersImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SpecialHeadersClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SyncOperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/Resource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/Body.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredPropertyParent.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstant.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstantParent.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequired.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequiredParent.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/OperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/PollingUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/SyncOperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionFlattenOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendLongRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SubResult.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/ArrayData.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/Result.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/SendLongOptions.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/User.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/OperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/PollingUtils.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/SyncOperationLocationPollingStrategy.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/ExportedResource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/Resource.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityReadsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityWritesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/Dog.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/ReadDog.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/RoundTripModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/WriteDog.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeOpsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClass.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassBothMismatch.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassMismatch.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClass.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClassMismatch.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ArrayClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ArrayClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/BooleanValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DatetimeValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DurationValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Float32ValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int32ValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int64ValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ModelValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableBooleanValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableFloatValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableInt32ValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableModelValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableStringValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/StringValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/UnknownValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/InnerModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DictionaryClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/BooleanValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DatetimeValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DictionaryClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DurationValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Float32ValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int32ValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int64ValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/ModelValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/NullableFloatValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/RecursiveModelValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/StringValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/UnknownValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/InnerModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/StringOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/DaysOfWeekExtensibleEnum.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/FixedClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/StringOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/DaysOfWeekEnum.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/EmptyClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInput.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInputOutput.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyOutput.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Cobra.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Dog.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/DogKind.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Golden.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Snake.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/SnakeKind.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Fish.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Salmon.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/SawShark.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Shark.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Cat.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Pet.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Siamese.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Element.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Extension.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Bird.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Dinosaur.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Eagle.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Goose.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/SeaGull.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Sparrow.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/TRex.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/UsageClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputOutputRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/OutputRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/ReadOnlyModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/VisibilityModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/AdditionalPropertiesClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2AsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2Client.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3AsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3Client.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadFloatsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelArraysImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadStringsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsFloatsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelArraysImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsStringsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDerivedsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDiscriminatedsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsFloatsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelArraysImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsStringsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDerivedsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDiscriminatedsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/MultipleSpreadsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentFloatsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelArraysImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentStringsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadFloatsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelArraysImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion2sImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion3sImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnionsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordUnionsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadStringsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatDerived.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayDerived.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelDerived.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringDerived.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsFloatAdditionalProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelAdditionalProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelArrayAdditionalProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsStringAdditionalProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDerived.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminated.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsFloatAdditionalProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelAdditionalProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelArrayAdditionalProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsStringAdditionalProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalProperties.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDerived.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminated.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminatedDerived.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ModelForRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/MultipleSpreadRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadFloatRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelArrayRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion3.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForUnion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadStringRecord.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData0.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData1.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/NullableClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/BytesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsBytesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsModelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsStringsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DatetimeOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DurationOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/JsonMergePatchHelper.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/NullableClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/StringOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/BytesProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsByteProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsModelProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsStringProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DatetimeProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/InnerModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/StringProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/OptionalClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BooleanLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BytesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsBytesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsModelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DatetimeOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DurationOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/FloatLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/IntLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/OptionalClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainDatesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainTimesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/RequiredAndOptionalsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionFloatLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionIntLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionStringLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralPropertyProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BytesProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsByteProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsModelProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DatetimeProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralPropertyProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralPropertyProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainDateProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainTimeProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/RequiredAndOptionalProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralPropertyProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralPropertyProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralPropertyProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralPropertyProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128AsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128Client.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ValueTypesClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BytesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsIntsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsModelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsStringsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DatetimeOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/Decimal128sImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DecimalsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DictionaryStringsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DurationOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/EnumsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ExtensibleEnumsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ModelsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/NeversImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionEnumValuesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionFloatLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionIntLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionStringLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownArraysImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownDictsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownIntsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownStringsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BytesProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsIntProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsModelProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsStringProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DatetimeProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/Decimal128Property.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DecimalProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DictionaryStringProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DurationProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/EnumProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtendedEnum.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtensibleEnumProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FixedInnerEnum.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerEnum.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ModelProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/NeverProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionEnumValueProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralPropertyProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralPropertyProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralPropertyProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownArrayProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownDictProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownIntProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownStringProperty.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/ScalarClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/BooleanOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128TypesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128VerifiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalTypesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalVerifiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/ScalarClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/StringOperationsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/UnknownsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/UnionClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/DiscriminatedClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/DiscriminatedClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectCustomPropertiesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectDefaultsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeCustomDiscriminatorsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeDefaultsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/EnumsOnliesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/FloatsOnliesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/IntsOnliesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedLiteralsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedTypesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/ModelsOnliesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringAndArraysImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensibleNamedsImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensiblesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringsOnliesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/UnionClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest1.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest3.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest4.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest5.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest6.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest7.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest8.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest9.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Cat.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Dog.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCases.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesLr.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesUd.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse1.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse3.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse4.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse5.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse6.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse7.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse8.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse9.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp1.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp3.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedLiteralsCases.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedTypesCases.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringAndArrayCases.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringExtensibleNamedUnion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2AsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2Client.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/AddedClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/InterfaceV2sImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV1.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV1.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/TestModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/RemovedClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV3.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV2.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV3.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/NewInterfacesImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewEnum.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromAsyncClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClient.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClientBuilder.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromServiceVersion.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/TestModel.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/package-info.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-service_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/proxy-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/reflect-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/proxy-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/reflect-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/proxy-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/reflect-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/proxy-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/reflect-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/proxy-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/reflect-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/proxy-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/reflect-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/proxy-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/reflect-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/proxy-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/reflect-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/proxy-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/reflect-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/proxy-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/reflect-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/proxy-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/reflect-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/proxy-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/reflect-config.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_apiview_properties.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_metadata.json create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-apikey.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-http-custom.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-oauth2.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-union.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-access.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-alternatetype.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-header.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-path.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-query.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientinitialization.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientlocation.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-deserialize-emptystringnull.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-flattenproperty.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-hierarchybuilding.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-methodoverride.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-nextlinkverb.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-usage.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-basic.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-rpc.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-standard.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-model.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-page.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-scalar.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-traits.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-encode-duration.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-example-basic.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-payload-pageable.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armcustomization-generated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armlegacy-generated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armresourceprovider-generated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armstreamstyleserialization-generated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armversioned-generated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-combined-generated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-commonproperties-generated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-largeheader-generated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-methodsubscriptionid-generated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-nonresource-generated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-operationtemplates-generated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-resources-generated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-specialheaders-xmsclientrequestid.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-versioning-previewversion.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-clientnamespace.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming-enumconflict.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-overload.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-clientoperationgroup.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-multiclient.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-renamedoperation.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-service.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-twooperationgroup.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/documentation.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-array.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-bytes.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-datetime.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-duration.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-numeric.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-basic.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-bodyoptionality.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-collectionformat.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-path.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-spread.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-contentnegotiation.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-jsonmergepatch.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-mediatype.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-multipart.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven-v1.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/response-statuscoderange.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/routes.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/serialization-encodedname-json.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-endpoint-notdefined.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-multiple.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-single.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-notversioned.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-versioned.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/service-multiservice-combined.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-conditionalrequest.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-repeatability.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialwords.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/streaming-jsonl.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-builtin.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-clientinitialization.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-discriminatoredgecases.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumnesteddiscriminator.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumservice.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-errormodel.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-flatten.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-internal.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-literalservice.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-longrunning.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-methodoverride.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-model.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multicontenttypes.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multipart.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namespaceclient.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-naming.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namingjavaparser.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-optional.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-patch.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-protocolandconvenient.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-response.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialchars.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialheaders.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-subclass.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-union.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-versioning.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-visibility.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-wiretype.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-array.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-dictionary.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-extensible.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-fixed.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-empty.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-enumdiscriminator.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-nesteddiscriminator.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-notdiscriminated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-recursive.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-singlediscriminator.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-usage.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-visibility.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-additionalproperties.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-nullable.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-optional.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-valuetypes.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-scalar.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union-discriminated.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-added.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-madeoptional.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-removed.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-renamedfrom.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-returntypechangedfrom.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-typechangedfrom.properties create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/azure/example/basic/generated/BasicAction.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpRead.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpWrite.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSend.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSendLong.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/longrunning/generated/LongRunningCreateJob.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/model/generated/ModelOpPutNested.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentType.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpExists.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpListStrings.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialchars/generated/BuiltinOpRead.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersListWithEtag.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeaders.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/versioning/generated/VersioningOpList.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/apikey/generated/ApiKeyClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/http/custom/generated/CustomClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/oauth2/generated/OAuth2ClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/union/generated/UnionClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/access/generated/AccessClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/alternatetype/generated/AlternateTypeClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/header/generated/HeaderClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/path/generated/PathClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/query/generated/QueryClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientinitialization/generated/HeaderParamClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientlocation/generated/ClientLocationClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/deserialize/emptystringnull/generated/DeserializeEmptyStringAsNullClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/flattenproperty/generated/FlattenPropertyClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/hierarchybuilding/generated/HierarchyBuildingClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/methodoverride/generated/OverrideClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/nextlinkverb/generated/NextLinkVerbClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/usage/generated/UsageClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/basic/generated/BasicClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/rpc/generated/RpcClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/standard/generated/StandardClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/model/generated/ModelClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/page/generated/PageClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/scalar/generated/ScalarClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/traits/generated/TraitsClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/encode/duration/generated/DurationClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/AzureExampleClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/BasicActionTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/payload/pageable/generated/PageableClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationDisplayTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationInnerTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationListResultTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourceInnerTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourcePropertiesTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1InnerTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1PropertiesTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2InnerTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2PropertiesTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourceInnerTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourcePropertiesTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskInnerTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskPropertiesTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachineInnerTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachinePropertiesTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/specialheaders/xmsclientrequestid/generated/XmsClientRequestIdClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/versioning/previewversion/generated/PreviewVersionClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/client/clientnamespace/generated/ClientNamespaceFirstClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/enumconflict/generated/EnumConflictClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/generated/NamingClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/client/overload/generated/OverloadClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/clientoperationgroup/generated/FirstClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/multiclient/generated/ClientAClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/renamedoperation/generated/RenamedOperationClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/service/generated/ServiceClientClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/twooperationgroup/generated/TwoOperationGroupClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/documentation/generated/DocumentationClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/array/generated/ArrayClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/bytes/generated/BytesClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/datetime/generated/DatetimeClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/duration/generated/DurationClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/numeric/generated/NumericClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/basic/generated/BasicClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/bodyoptionality/generated/BodyOptionalityClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/collectionformat/generated/CollectionFormatClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/path/generated/PathClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/spread/generated/SpreadClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/contentnegotiation/generated/ContentNegotiationClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/jsonmergepatch/generated/JsonMergePatchClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/mediatype/generated/MediaTypeClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/multipart/generated/MultiPartClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/generated/ResiliencyServiceDrivenClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/v1/generated/ResiliencyServiceDrivenClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/response/statuscoderange/generated/StatusCodeRangeClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/routes/generated/RoutesClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/serialization/encodedname/json/generated/JsonClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/server/endpoint/notdefined/generated/NotDefinedClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/multiple/generated/MultipleClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/single/generated/SingleClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/notversioned/generated/NotVersionedClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/versioned/generated/VersionedClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/service/multiservice/combined/generated/CombinedTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/conditionalrequest/generated/ConditionalRequestClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/repeatability/generated/RepeatabilityClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/specialwords/generated/SpecialWordsClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/streaming/jsonl/generated/JsonlClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceInnerTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceListResultTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourcePropertiesTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpReadTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpWriteTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/clientinitialization/generated/ClientInitializationClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/discriminatoredgecases/generated/DiscriminatorEdgeCasesClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumnesteddiscriminator/generated/EnumNestedDiscriminatorClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumservice/generated/EnumServiceClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/errormodel/generated/ErrorModelClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendLongTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/internal/generated/InternalClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/literalservice/generated/LiteralServiceClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningCreateJobTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/methodoverride/generated/MethodOverrideClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelOpPutNestedTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/MultiContentTypesClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentTypeTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multipart/generated/MultipartClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namespaceclient/generated/NamespaceClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/naming/generated/NamingClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namingjavaparser/generated/NamingJavaParserClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/optional/generated/OptionalClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/patch/generated/PatchClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/protocolandconvenient/generated/ProtocolAndConvenientClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpExistsTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpListStringsTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/BuiltinOpReadTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/SpecialCharsClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersListWithEtagTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeadersTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/SpecialHeadersClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/subclass/generated/SubclassClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/union/generated/UnionClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningOpListTests.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/visibility/generated/VisibilityClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/wiretype/generated/WireTypeClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/array/generated/ArrayClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/dictionary/generated/DictionaryClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/extensible/generated/ExtensibleClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/fixed/generated/FixedClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/empty/generated/EmptyClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/enumdiscriminator/generated/EnumDiscriminatorClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/nesteddiscriminator/generated/NestedDiscriminatorClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/notdiscriminated/generated/NotDiscriminatedClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/recursive/generated/RecursiveClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/singlediscriminator/generated/SingleDiscriminatorClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/usage/generated/UsageClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/visibility/generated/VisibilityClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/additionalproperties/generated/AdditionalPropertiesClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/nullable/generated/NullableClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/optional/generated/OptionalClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/valuetypes/generated/ValueTypesClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/scalar/generated/ScalarClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/discriminated/generated/DiscriminatedClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/generated/UnionClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/added/generated/AddedClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/madeoptional/generated/MadeOptionalClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/removed/generated/RemovedClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/renamedfrom/generated/RenamedFromClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/returntypechangedfrom/generated/ReturnTypeChangedFromClientTestBase.java create mode 100644 packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/typechangedfrom/generated/TypeChangedFromClientTestBase.java diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/model/javamodel/JavaJavadocComment.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/model/javamodel/JavaJavadocComment.java index f479ea81f32..0ca0fb6fcb1 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/model/javamodel/JavaJavadocComment.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/model/javamodel/JavaJavadocComment.java @@ -147,16 +147,16 @@ private static String convertInlineFormatting(String text) { private static String processText(String value) { String text = trim(value); if (text != null && !text.isEmpty()) { - // Convert Markdown formatting to JavaDoc HTML tags - text = convertMarkdownToJavadoc(text); - // Ensure period at the end + // Ensure period at the end before any processing text = ensurePeriod(text); - // Escape XML special characters + // Escape XML special characters FIRST (before markdown conversion) text = CodeNamer.escapeXmlComment(text); // escape "@" that isn't prefixed with "{" text = ESCAPE_AT.matcher(text).replaceAll("@"); // escape tab text = text.replace("\t", " "); + // Convert Markdown formatting to JavaDoc HTML tags AFTER escaping + text = convertMarkdownToJavadoc(text); } return CodeNamer.escapeIllegalUnicodeEscape(CodeNamer.escapeComment(text)); } diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/README.md b/packages/http-client-java/generator/http-client-generator-test/specs/README.md deleted file mode 100644 index fb1e5e7d92a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# HTTP Test scenarios - -**_Pending_** diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/main.tsp deleted file mode 100644 index e7ee63add64..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/main.tsp +++ /dev/null @@ -1,40 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@scenarioService("/authentication/api-key") -@doc("Illustrates clients generated with ApiKey authentication.") -@useAuth(ApiKeyAuth) -namespace Authentication.ApiKey; - -@scenario -@scenarioDoc("Expects header 'x-ms-api-key': 'valid-key'") -@doc("Check whether client is authenticated") -@get -@route("/valid") -op valid(): NoContentResponse; - -@scenario -@scenarioDoc(""" - Expect error code 403 and error body: - ```json - { - "error": { - "code": "InvalidApiKey", - "message": "API key is invalid" - } - } - ``` - """) -@doc("Check whether client is authenticated.") -@get -@route("/invalid") -op invalid(): NoContentResponse | InvalidAuth; - -@error -model InvalidAuth { - @statusCode _: 403; - error: string; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/mockapi.ts deleted file mode 100644 index db82b7319cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/api-key/mockapi.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { json, passOnCode, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Authentication_ApiKey_invalid = passOnCode(403, { - uri: `/authentication/api-key/invalid`, - method: `get`, - request: { - headers: { - "x-ms-api-key": "invalid-key", - }, - status: 403, - }, - response: { - status: 403, - body: json({ - error: "invalid-api-key", - }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Authentication_ApiKey_valid = passOnSuccess({ - uri: `/authentication/api-key/valid`, - method: `get`, - request: { - headers: { - "x-ms-api-key": "valid-key", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/main.tsp deleted file mode 100644 index 6165727803f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/main.tsp +++ /dev/null @@ -1,40 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using TypeSpec.Http; -using Spector; - -@scenarioService("/authentication/http/custom") -@doc("Illustrates clients generated with generic HTTP auth.") -@useAuth({ - type: AuthType.http, - scheme: "SharedAccessKey", -}) -namespace Authentication.Http.Custom; - -@scenario -@scenarioDoc("Expects header 'Authorization': 'SharedAccessKey valid-key'") -@doc("Check whether client is authenticated") -@get -@route("/valid") -op valid(): NoContentResponse; - -@scenario -@scenarioDoc(""" - Expect error code 403 and error body: - ```json - { - "error": "invalid-api-key" - } - ``` - """) -@doc("Check whether client is authenticated.") -@get -@route("/invalid") -op invalid(): NoContentResponse | InvalidAuth; - -@error -model InvalidAuth { - @statusCode _: 403; - error: string; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/mockapi.ts deleted file mode 100644 index 1d9e4e5ac0b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/http/custom/mockapi.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { json, passOnCode, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Authentication_Http_Custom_valid = passOnSuccess({ - uri: `/authentication/http/custom/valid`, - method: "get", - request: { - headers: { - authorization: "SharedAccessKey valid-key", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Authentication_Http_Custom_invalid = passOnCode(403, { - uri: `/authentication/http/custom/invalid`, - method: "get", - request: { - headers: { - authorization: "SharedAccessKey invalid-key", - }, - status: 403, - }, - response: { - status: 403, - body: json({ - error: "invalid-api-key", - }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/main.tsp deleted file mode 100644 index ced1738a657..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/main.tsp +++ /dev/null @@ -1,45 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@scenarioService("/authentication/oauth2") -@doc("Illustrates clients generated with OAuth2 authentication.") -@useAuth(OAuth2Auth<[MyFlow]>) -namespace Authentication.OAuth2; - -model MyFlow { - type: OAuth2FlowType.implicit; - authorizationUrl: "https://login.microsoftonline.com/common/oauth2/authorize"; - scopes: ["https://security.microsoft.com/.default"]; -} - -@scenario -@scenarioDoc("Expects header 'authorization': 'Bearer https://security.microsoft.com/.default'") -@doc("Check whether client is authenticated") -@get -@route("/valid") -op valid(): NoContentResponse; - -@scenario -@scenarioDoc(""" - Expect error code 400 and error body: - ```json - { - "message": "Expected Bearer x but got Bearer y", - "expected": "Bearer x", - "actual": "Bearer y", - } - ``` - """) -@doc("Check whether client is authenticated. Will return an invalid bearer error.") -@get -@route("/invalid") -op invalid(): NoContentResponse | InvalidAuth; - -@error -model InvalidAuth { - @statusCode _: 403; - error: string; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/mockapi.ts deleted file mode 100644 index 3911a1e37de..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/oauth2/mockapi.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { json, passOnCode, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Authentication_OAuth2_valid = passOnSuccess({ - uri: `/authentication/oauth2/valid`, - method: "get", - request: { - headers: { - authorization: "Bearer https://security.microsoft.com/.default", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Authentication_OAuth2_invalid = passOnCode(403, { - uri: `/authentication/oauth2/invalid`, - method: "get", - request: { - status: 403, - }, - response: { - status: 403, - body: json({ - error: "invalid-grant", - }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/main.tsp deleted file mode 100644 index 9d6afef5c87..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/main.tsp +++ /dev/null @@ -1,30 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@scenarioService("/authentication/union") -@doc("Illustrates clients generated with ApiKey and OAuth2 authentication.") -@useAuth(ApiKeyAuth | OAuth2Auth<[MyFlow]>) -namespace Authentication.Union; - -model MyFlow { - type: OAuth2FlowType.implicit; - authorizationUrl: "https://login.microsoftonline.com/common/oauth2/authorize"; - scopes: ["https://security.microsoft.com/.default"]; -} - -@scenario -@scenarioDoc("Expects header 'x-ms-api-key': 'valid-key'") -@doc("Check whether client is authenticated") -@get -@route("/validkey") -op validKey(): NoContentResponse; - -@scenario -@scenarioDoc("Expects header 'authorization': 'Bearer https://security.microsoft.com/.default'") -@doc("Check whether client is authenticated") -@get -@route("/validtoken") -op validToken(): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/mockapi.ts deleted file mode 100644 index e52e327ec34..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/authentication/union/mockapi.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Authentication_Union_validKey = passOnSuccess({ - uri: `/authentication/union/validkey`, - method: "get", - request: { - headers: { - "x-ms-api-key": "valid-key", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Authentication_Union_validToken = passOnSuccess({ - uri: `/authentication/union/validtoken`, - method: "get", - request: { - headers: { - authorization: "Bearer https://security.microsoft.com/.default", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/main.tsp deleted file mode 100644 index e3c17c5b5d8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/main.tsp +++ /dev/null @@ -1,192 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Azure.ClientGenerator.Core; -using Spector; - -@doc("Test for internal decorator.") -@scenarioService("/azure/client-generator-core/access") -@global.Azure.ClientGenerator.Core.clientNamespace("azure.clientgenerator.core.access", "java") -namespace _Specs_.Azure.ClientGenerator.Core.Access; - -@route("/publicOperation") -@global.Azure.ClientGenerator.Core.operationGroup -@scenario -@scenarioDoc(""" - This scenario contains public operations. It should be generated and exported. - Expected query parameter: name="sample" - Expected response body: - ```json - { - "name": "sample" - } - ``` - """) -namespace PublicOperation { - @doc("Used in a public operation, should be generated and exported.") - model NoDecoratorModelInPublic { - name: string; - } - - @doc("Used in a public operation, should be generated and exported.") - @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.public) - model PublicDecoratorModelInPublic { - name: string; - } - - @route("/noDecoratorInPublic") - @get - @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.public) - op noDecoratorInPublic(@query name: string): NoDecoratorModelInPublic; - - @route("/publicDecoratorInPublic") - @get - @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.public) - op publicDecoratorInPublic(@query name: string): PublicDecoratorModelInPublic; -} - -@route("/internalOperation") -@global.Azure.ClientGenerator.Core.operationGroup -@scenario -@scenarioDoc(""" - This scenario contains internal operations. All should be generated but not exposed. - Expected query parameter: name="sample" - Expected response body: - ```json - { - "name": "sample" - } - ``` - """) -namespace InternalOperation { - @doc("Used in an internal operation, should be generated but not exported.") - model NoDecoratorModelInInternal { - name: string; - } - - @doc("Used in an internal operation, should be generated but not exported.") - @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) - model InternalDecoratorModelInInternal { - name: string; - } - - @doc("Used in an internal operation but with public decorator, should be generated and exported.") - @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.public) - model PublicDecoratorModelInInternal { - name: string; - } - - @route("/noDecoratorInInternal") - @get - @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) - op noDecoratorInInternal(@query name: string): NoDecoratorModelInInternal; - - @route("/internalDecoratorInInternal") - @get - @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) - op internalDecoratorInInternal(@query name: string): InternalDecoratorModelInInternal; - - @route("/publicDecoratorInInternal") - @get - @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) - op publicDecoratorInInternal(@query name: string): PublicDecoratorModelInInternal; -} - -@route("/sharedModelInOperation") -@global.Azure.ClientGenerator.Core.operationGroup -@scenario -@scenarioDoc(""" - This scenario contains two operations, one public, another internal. The public one should be generated and exported while the internal one should be generated but not exposed. - Expected query parameter: name="sample" - Expected response body: - ```json - { - "name": "sample" - } - ``` - """) -namespace SharedModelInOperation { - @doc("Used by both public and internal operation. It should be generated and exported.") - model SharedModel { - name: string; - } - - @route("/public") - @get - @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.public) - op `public`(@query name: string): SharedModel; - - @route("/internal") - @get - @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) - op `internal`(@query name: string): SharedModel; -} - -@route("/relativeModelInOperation") -@global.Azure.ClientGenerator.Core.operationGroup -@scenario -@scenarioDoc(""" - This scenario contains internal operations. All should be generated but not exposed. - """) -namespace RelativeModelInOperation { - @doc("Used in internal operations, should be generated but not exported.") - model OuterModel extends BaseModel { - inner: InnerModel; - } - - @doc("Used in internal operations, should be generated but not exported.") - model InnerModel { - name: string; - } - - @doc("Used in internal operations, should be generated but not exported.") - model BaseModel { - name: string; - } - - @doc("Used in internal operations, should be generated but not exported.") - @discriminator("kind") - model AbstractModel { - name: string; - } - - @doc("Used in internal operations, should be generated but not exported.") - model RealModel extends AbstractModel { - kind: "real"; - } - - @doc(""" - Expected query parameter: name="Madge" - Expected response body: - ```json - { - "name": "Madge", - "inner": - { - "name": "Madge" - } - } - ``` - """) - @route("/operation") - @get - @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) - op operation(@query name: string): OuterModel; - - @doc(""" - Expected query parameter: kind="real" - Expected response body: - ```json - { - "name": "Madge", - "kind": "real" - } - ``` - """) - @route("/discriminator") - @get - @global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.internal) - op discriminator(@query kind: string): AbstractModel; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/mockapi.ts deleted file mode 100644 index eff4874cc81..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/access/mockapi.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { json, MockApiDefinition, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createMockApiDefinitions(route: string): MockApiDefinition { - return { - uri: `/azure/client-generator-core/access/${route}`, - method: "get", - request: { - query: { - name: "sample", - }, - }, - response: { - status: 200, - body: json({ name: "sample" }), - }, - kind: "MockApiDefinition", - }; -} - -Scenarios.Azure_ClientGenerator_Core_Access_PublicOperation = passOnSuccess([ - createMockApiDefinitions("publicOperation/noDecoratorInPublic"), - createMockApiDefinitions("publicOperation/publicDecoratorInPublic"), -]); - -Scenarios.Azure_ClientGenerator_Core_Access_InternalOperation = passOnSuccess([ - createMockApiDefinitions("internalOperation/noDecoratorInInternal"), - createMockApiDefinitions("internalOperation/internalDecoratorInInternal"), - createMockApiDefinitions("internalOperation/publicDecoratorInInternal"), -]); - -Scenarios.Azure_ClientGenerator_Core_Access_SharedModelInOperation = passOnSuccess([ - createMockApiDefinitions("sharedModelInOperation/public"), - createMockApiDefinitions("sharedModelInOperation/internal"), -]); - -Scenarios.Azure_ClientGenerator_Core_Access_RelativeModelInOperation = passOnSuccess([ - { - uri: "/azure/client-generator-core/access/relativeModelInOperation/operation", - method: "get", - request: { - query: { - name: "Madge", - }, - }, - response: { - status: 200, - body: json({ name: "Madge", inner: { name: "Madge" } }), - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/access/relativeModelInOperation/discriminator", - method: "get", - request: { - query: { - kind: "real", - }, - }, - response: { - status: 200, - body: json({ name: "Madge", kind: "real" }), - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/client.tsp deleted file mode 100644 index 737b57f8f0e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/client.tsp +++ /dev/null @@ -1,45 +0,0 @@ -import "@azure-tools/typespec-client-generator-core"; -import "./main.tsp"; - -using Azure.ClientGenerator.Core; - -@@global.Azure.ClientGenerator.Core.clientNamespace(_Specs_.Azure.ClientGenerator.Core.AlternateType, - "azure.clientgenerator.core.alternatetype", - "java" -); - -@@alternateType(_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.Feature, - { - identity: "geojson.Feature", - package: "geojson", - minVersion: "3.2.0", - }, - "python" -); - -@@alternateType(_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.Feature, - { - identity: "com.azure.core.models.GeoObject", // cSpell:ignore GeoObject - package: "com.azure.core", - minVersion: "1.14.0", - }, - "java" -); - -@@alternateType(_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.Feature, - { - identity: "NetTopologySuite.IO.GeoJSON.Feature", - package: "NetTopologySuite.IO.GeoJSON", - minVersion: "4.0.0", - }, - "csharp" -); - -@@alternateType(_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.Feature, - { - identity: "NetTopologySuite.IO.GeoJSON.Feature", - package: "@types/geojson", - minVersion: "7946.0.0", - }, - "typescript" -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/main.tsp deleted file mode 100644 index ba27cca219d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/main.tsp +++ /dev/null @@ -1,139 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Azure.ClientGenerator.Core; -using Spector; - -@doc("Test for alternate type decorator") -@scenarioService("/azure/client-generator-core/alternate-type") -@service -namespace _Specs_.Azure.ClientGenerator.Core.AlternateType; - -@global.Azure.ClientGenerator.Core.operationGroup -@route("/external") -@doc("Test using language-idiomatic external types for defined TypeSpec types") -namespace ExternalType { - model Geometry { - type: string; - coordinates: numeric[]; - } - - model Feature { - type: "Feature"; - geometry: Geometry | null; - properties: Record; - id?: string | numeric; - } - - model ModelWithFeatureProperty { - feature: Feature; - additionalProperty: string; - } - @scenario - @scenarioDoc(""" - Input: None - Output: Feature object with geometry, properties, and optional id fields. - Example response: - ```json - { - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [-122.25, 37.87] - }, - "properties": { - "name": "A single point of interest", - "category": "landmark", - "elevation": 100 - }, - "id": "feature-1" - } - ``` - """) - @route("/model") - @get - op getModel(): Feature; - - @scenario - @scenarioDoc(""" - Input: Feature object in request body. - Example input: - ```json - { - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [-122.25, 37.87] - }, - "properties": { - "name": "A single point of interest", - "category": "landmark", - "elevation": 100 - }, - "id": "feature-1" - } - ``` - Output: None (204/empty response) - """) - @route("/model") - @put - op putModel(@body body: Feature): void; - - @scenario - @scenarioDoc(""" - Input: None - Output: ModelWithFeatureProperty object with feature and additionalProperty fields. - Example response: - ```json - { - "feature": { - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [-122.25, 37.87] - }, - "properties": { - "name": "A single point of interest", - "category": "landmark", - "elevation": 100 - }, - "id": "feature-1" - }, - "additionalProperty": "extra" - } - ``` - """) - @route("/property") - @get - op getProperty(): ModelWithFeatureProperty; - - @scenario - @scenarioDoc(""" - Input: ModelWithFeatureProperty object in request body. - Example input: - ```json - { - "feature": { - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [-122.25, 37.87] - }, - "properties": { - "name": "A single point of interest", - "category": "landmark", - "elevation": 100 - }, - "id": "feature-1" - }, - "additionalProperty": "extra" - } - ``` - Output: None (204/empty response) - """) - @route("/property") - @put - op putProperty(@body body: ModelWithFeatureProperty): void; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/mockapi.ts deleted file mode 100644 index ed83dd8632f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/alternate-type/mockapi.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - json, - MockApiDefinition, - MockBody, - passOnSuccess, - ScenarioMockApi, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createMockApiDefinitions( - route: string, - body: MockBody, -): [MockApiDefinition, MockApiDefinition] { - return [ - { - uri: `/azure/client-generator-core/alternate-type/external/${route}`, - method: "get", - response: { - status: 200, - body: body, - }, - kind: "MockApiDefinition", - }, - { - uri: `/azure/client-generator-core/alternate-type/external/${route}`, - method: "put", - request: { - body, - }, - response: { status: 204 }, - kind: "MockApiDefinition", - }, - ]; -} - -const feature = { - type: "Feature", - geometry: { - type: "Point", - coordinates: [-122.25, 37.87], - }, - properties: { - name: "A single point of interest", - category: "landmark", - elevation: 100, - }, - id: "feature-1", -}; - -const modelScenarioTypes = createMockApiDefinitions("model", json(feature)); - -Scenarios.Azure_ClientGenerator_Core_AlternateType_ExternalType_getModel = passOnSuccess( - modelScenarioTypes[0], -); -Scenarios.Azure_ClientGenerator_Core_AlternateType_ExternalType_putModel = passOnSuccess( - modelScenarioTypes[1], -); - -const modelWithFeatureProperty = { - feature, - additionalProperty: "extra", -}; - -const modelPropertyScenarioTypes = createMockApiDefinitions( - "property", - json(modelWithFeatureProperty), -); - -Scenarios.Azure_ClientGenerator_Core_AlternateType_ExternalType_getProperty = passOnSuccess( - modelPropertyScenarioTypes[0], -); -Scenarios.Azure_ClientGenerator_Core_AlternateType_ExternalType_putProperty = passOnSuccess( - modelPropertyScenarioTypes[1], -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/client.tsp deleted file mode 100644 index 5465aeb240f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/client.tsp +++ /dev/null @@ -1,18 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; -import "./main.tsp"; - -using Http; -using Azure.ClientGenerator.Core; -using Client.AlternateApiVersion.Service.Header; -using Spector; - -namespace Customizations; - -@@apiVersion(HeaderApiVersionParam.version); - -@@clientNamespace(Client.AlternateApiVersion.Service.Header, - "azure.clientgenerator.core.apiversion.header", - "java" -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/main.tsp deleted file mode 100644 index 71be3af005d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/main.tsp +++ /dev/null @@ -1,39 +0,0 @@ -/** - * DO NOT GENERATE FROM THIS FILE USE client.tsp - * This is just to simulate a service entrypoint - */ -import "@typespec/http"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Versioning; -using Azure.ClientGenerator.Core; -using Spector; - -@scenarioService( - "/azure/client-generator-core/api-version/header", - { - versioned: ApiVersions, - } -) -namespace Client.AlternateApiVersion.Service.Header; - -@doc("Supported api versions.") -enum ApiVersions { - @doc("Api version 2025-01-01.") - v2025_01_01: "2025-01-01", -} - -model HeaderApiVersionParam { - @header("x-ms-version") - version: string; -} - -@scenario -@scenarioDoc("Set a header as the service api version") -@doc("Header api version parameter.") -@post -op headerApiVersion(...HeaderApiVersionParam): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/mockapi.ts deleted file mode 100644 index 554c04fc7c1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/header/mockapi.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Client_AlternateApiVersion_Service_Header_headerApiVersion = passOnSuccess([ - { - uri: "/azure/client-generator-core/api-version/header", - method: "post", - request: { - headers: { - "x-ms-version": "2025-01-01", - }, - }, - response: { - status: 200, - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/client.tsp deleted file mode 100644 index bfa8b654f84..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/client.tsp +++ /dev/null @@ -1,18 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; -import "./main.tsp"; - -using Http; -using Azure.ClientGenerator.Core; -using Client.AlternateApiVersion.Service.Path; -using Spector; - -namespace Customizations; - -@@apiVersion(PathApiVersionParam.version); - -@@clientNamespace(Client.AlternateApiVersion.Service.Path, - "azure.clientgenerator.core.apiversion.path", - "java" -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/main.tsp deleted file mode 100644 index fe395284d26..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/main.tsp +++ /dev/null @@ -1,40 +0,0 @@ -/** - * DO NOT GENERATE FROM THIS FILE USE client.tsp - * This is just to simulate a service entrypoint - */ -import "@typespec/http"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Versioning; -using Azure.ClientGenerator.Core; -using Spector; - -@scenarioService( - "/azure/client-generator-core/api-version/path", - { - versioned: ApiVersions, - } -) -namespace Client.AlternateApiVersion.Service.Path; - -@doc("Supported api versions.") -enum ApiVersions { - @doc("Api version 2025-01-01.") - v2025_01_01: "2025-01-01", -} - -model PathApiVersionParam { - @path - version: string; -} - -@scenario -@scenarioDoc("Set a path service api version") -@doc("Path api version parameter.") -@route("{version}") -@post -op pathApiVersion(...PathApiVersionParam): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/mockapi.ts deleted file mode 100644 index 18905d1f368..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/path/mockapi.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Client_AlternateApiVersion_Service_Path_pathApiVersion = passOnSuccess([ - { - uri: "/azure/client-generator-core/api-version/path/2025-01-01", - method: "post", - request: {}, - response: { - status: 200, - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/client.tsp deleted file mode 100644 index 97c588069d7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/client.tsp +++ /dev/null @@ -1,18 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; -import "./main.tsp"; - -using Http; -using Azure.ClientGenerator.Core; -using Client.AlternateApiVersion.Service.Query; -using Spector; - -namespace Customizations; - -@@apiVersion(QueryApiVersionParam.version); - -@@clientNamespace(Client.AlternateApiVersion.Service.Query, - "azure.clientgenerator.core.apiversion.query", - "java" -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/main.tsp deleted file mode 100644 index 68319c24913..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/main.tsp +++ /dev/null @@ -1,39 +0,0 @@ -/** - * DO NOT GENERATE FROM THIS FILE USE client.tsp - * This is just to simulate a service entrypoint - */ -import "@typespec/http"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Versioning; -using Azure.ClientGenerator.Core; -using Spector; - -@scenarioService( - "/azure/client-generator-core/api-version/query", - { - versioned: ApiVersions, - } -) -namespace Client.AlternateApiVersion.Service.Query; - -@doc("Supported api versions.") -enum ApiVersions { - @doc("Api version 2025-01-01.") - v2025_01_01: "2025-01-01", -} - -model QueryApiVersionParam { - @query - version: string; -} - -@scenario -@scenarioDoc("Set a query parameter as the service api version") -@doc("Query api version parameter.") -@post -op queryApiVersion(...QueryApiVersionParam): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/mockapi.ts deleted file mode 100644 index 782ffb6687d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/api-version/query/mockapi.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Client_AlternateApiVersion_Service_Query_queryApiVersion = passOnSuccess([ - { - uri: "/azure/client-generator-core/api-version/query", - method: "post", - request: { - query: { - version: "2025-01-01", - }, - }, - response: { - status: 200, - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/client.tsp deleted file mode 100644 index 6859e310883..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/client.tsp +++ /dev/null @@ -1,246 +0,0 @@ -import "./main.tsp"; -import "@azure-tools/typespec-client-generator-core"; -import "@typespec/spector"; -import "@typespec/http"; - -using Spector; -using Http; - -@route("/azure/client-generator-core/client-initialization") -namespace _Specs_.Azure.ClientGenerator.Core.ClientInitialization; - -@@global.Azure.ClientGenerator.Core.clientNamespace(_Specs_.Azure.ClientGenerator.Core.ClientInitialization, - "azure.clientgenerator.core.clientinitialization", - "java" -); -@@global.Azure.ClientGenerator.Core.clientNamespace(Service, - "azure.clientgenerator.core.clientinitialization", - "java" -); - -model HeaderParamClientOptions { - @doc("The name of the client. This parameter is used as a header in all operations.") - name: string; -} - -model MultipleParamsClientOptions { - @doc("The name of the client. This parameter is used as a header in all operations.") - name: string; - - @doc("The region to use for all operations. This parameter is used as a query parameter.") - region: string; -} - -model MixedParamsClientOptions { - @doc("The name of the client. This parameter is used as a header in all operations.") - name: string; -} - -model PathParamClientOptions { - @doc("The name of the blob. This parameter is used as a path parameter in all operations.") - blobName: string; -} - -model ParamAliasClientOptions { - @doc("Blob name for the client.") - @global.Azure.ClientGenerator.Core.paramAlias("blob") - blobName: string; -} - -// Scenario 1: Header parameter moved to client level -@scenarioDoc(""" - Client for testing header parameter moved to client level. - - Parameters elevated to client level: - - name: "test-name-value" (header parameter) - - Expected client usage: - ```ts - const client = new HeaderParamClient({ - name: "test-name-value" - }); - - client.withQuery(id: "test-id"); // No need to pass name here - client.withBody({ name: "test-name" }); // No need to pass name here - ``` - """) -@scenario -@doc("Client for testing header parameter moved to client level.") -@global.Azure.ClientGenerator.Core.client({ - name: "HeaderParamClient", - service: Service, -}) -@global.Azure.ClientGenerator.Core.clientInitialization(HeaderParamClientOptions) -@route("/header-param") -interface HeaderParam { - withQuery is Service.HeaderParam.withQuery; - withBody is Service.HeaderParam.withBody; -} - -// Scenario 2: Multiple parameters (header and query) moved to client level -@scenarioDoc(""" - Client for testing multiple parameters (header and query) moved to client level. - - Parameters elevated to client level: - - name: "test-name-value" (header parameter) - - region: "us-west" (query parameter) - - Expected client usage: - ```ts - const client = new MultipleParamsClient({ - name: "test-name-value", - region: "us-west" - }); - - client.withQuery(id: "test-id"); // No need to pass name or region here - client.withBody({ name: "test-name" }); // No need to pass name or region here - ``` - """) -@scenario -@global.Azure.ClientGenerator.Core.client({ - name: "MultipleParamsClient", - service: Service, -}) -@global.Azure.ClientGenerator.Core.clientInitialization(MultipleParamsClientOptions) -@route("/multiple-params") -interface MultipleParams { - withQuery is Service.MultipleParams.withQuery; - withBody is Service.MultipleParams.withBody; -} - -// Scenario 3: Mix of client-level and method-level parameters -@scenarioDoc(""" - Client for testing a mix of client-level and method-level parameters. - - Parameters elevated to client level: - - name: "test-name-value" (header parameter) - - Parameters remaining at method level: - - region: "us-west" (query parameter) - - Expected client usage: - ```ts - const client = new MixedParamsClient({ - name: "test-name-value" - }); - - client.withQuery(region: "us-west", id: "test-id"); // region stays as method param - client.withBody( region: "us-west", body: { name: "test-name" }); // region stays as method param - ``` - """) -@scenario -@global.Azure.ClientGenerator.Core.client({ - name: "MixedParamsClient", - service: Service, -}) -@global.Azure.ClientGenerator.Core.clientInitialization(MixedParamsClientOptions) -@route("/mixed-params") -interface MixedParams { - withQuery is Service.MixedParams.withQuery; - withBody is Service.MixedParams.withBody; -} - -// Scenario 4: Path parameter moved to client level -@scenarioDoc(""" - Client for testing a path parameter (blobName) moved to client level. - - Parameters elevated to client level: - - blobName: "sample-blob" (path parameter) - - Expected client usage: - ```ts - const client = new PathParamClient({ - blobName: "sample-blob" - }); - - // No need to pass blobName to any operations - client.withQuery(format: "text"); - client.getStandalone(); - client.deleteStandalone(); - ``` - """) -@scenario -@global.Azure.ClientGenerator.Core.client({ - name: "PathParamClient", - service: Service, -}) -@global.Azure.ClientGenerator.Core.clientInitialization(PathParamClientOptions) -@route("/path") -interface PathParam { - withQuery is Service.PathParam.withQuery; - getStandalone is Service.PathParam.getStandalone; - deleteStandalone is Service.PathParam.deleteStandalone; -} - -// Scenario 5: Parameter aliases for better client API names -@scenarioDoc(""" - Client for testing the @paramAlias decorator for renaming parameters in client code. - - Parameters elevated to client level: - - blobName: "sample-blob" (path parameter) - - Expected client usage: - ```ts - // Elevated to client level via alias - client.withAliasedName(); - - // Elevated to client level via original name - client.withOriginalName(); - ``` - """) -@scenario -@global.Azure.ClientGenerator.Core.clientInitialization(ParamAliasClientOptions) -@global.Azure.ClientGenerator.Core.client({ - name: "ParamAliasClient", - service: Service, -}) -@route("/param-alias") -interface ParamAlias { - withAliasedName is Service.ParamAlias.withAliasedName; - withOriginalName is Service.ParamAlias.withOriginalName; -} - -@global.Azure.ClientGenerator.Core.client({ - name: "ParentClient", - service: Service, -}) -namespace ParentClient { - @scenarioDoc(""" - Client for testing a path parameter (blobName) moved to client level, in child client. - - The child client can be initialized individually, or via its parent client. - - Parameters elevated to client level: - - blobName: "sample-blob" (path parameter) - - Expected client usage: - ```ts - // via ParentClient - const client = new ParentClient.getChildClient({ - blobName: "sample-blob" - }); - - // directly - const client = new ChildClient({ - blobName: "sample-blob" - }); - - // No need to pass blobName to any operations - client.withQuery(format: "text"); - client.getStandalone(); - client.deleteStandalone(); - ``` - """) - @scenario - @global.Azure.ClientGenerator.Core.operationGroup - @global.Azure.ClientGenerator.Core.clientInitialization({ - parameters: PathParamClientOptions, - initializedBy: global.Azure.ClientGenerator.Core.InitializedBy.individually | global.Azure.ClientGenerator.Core.InitializedBy.parent, - }) - @route("/child-client") - interface ChildClient { - withQuery is Service.ChildClient.withQuery; - getStandalone is Service.ChildClient.getStandalone; - deleteStandalone is Service.ChildClient.deleteStandalone; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/main.tsp deleted file mode 100644 index 883e1218aa8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/main.tsp +++ /dev/null @@ -1,133 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Spector; -using Azure.ClientGenerator.Core; - -@doc("Test for client initialization decorator - moving parameters from method to client level") -@scenarioService("/azure/client-generator-core/client-initialization") -namespace Service; - -// Common parameter types and models - -model NameHeaderParam { - @header("name") - name: string; -} - -model RegionQueryParam { - @query - region: string; -} - -model Input { - name: string; -} - -// Scenario 1: Header parameter moved to client level - -@route("/header-param") -interface HeaderParam { - @route("/with-query") - @get - withQuery(...NameHeaderParam, @query id: string): void; - - @route("/with-body") - @post - withBody(...NameHeaderParam, @body body: Input): void; -} - -// Scenario 2: Multiple parameters (header and query) moved to client level - -@route("/multiple-params") -interface MultipleParams { - @route("/with-query") - @get - withQuery(...NameHeaderParam, ...RegionQueryParam, @query id: string): void; - - @route("/with-body") - @post - withBody(...NameHeaderParam, ...RegionQueryParam, @body body: Input): void; -} - -// Scenario 3: Mix of client-level and method-level parameters - -@route("/mixed-params") -interface MixedParams { - @route("/with-query") - @get - withQuery(...NameHeaderParam, ...RegionQueryParam, @query id: string): void; - - @route("/with-body") - @post - withBody( - ...NameHeaderParam, - ...RegionQueryParam, - @body body: { - name: string; - }, - ): void; -} - -// Scenario 4: Path parameter moved to client level -@doc("Blob operations with path parameter that should be moved to client level") -@route("/path") -interface PathParam { - @route("/{blobName}/with-query") - @get - withQuery(@path blobName: string, @query format?: string): void; - - @route("/{blobName}/get-standalone") - @get - getStandalone(@path blobName: string): BlobProperties; - - @route("/{blobName}") - @delete - deleteStandalone(@path blobName: string): void; -} - -// Scenario 5: Parameter aliases for better client API names -@doc("Operations demonstrating the @paramAlias decorator for renaming parameters in client code") -@route("/param-alias") -interface ParamAlias { - @route("/{blob}/with-aliased-name") - @get - withAliasedName( - @path - blob: string, - ): void; - - @route("/{blobName}/with-original-name") - @get - withOriginalName( - @path - blobName: string, - ): void; -} - -@doc("Properties of a blob") -model BlobProperties { - name: string; - size: int64; - contentType: string; - createdOn: utcDateTime; -} - -// Scenario 6: Client initialization on child client -@doc("Blob operations with path parameter that should be moved to client level, in child client") -@route("/child-client") -interface ChildClient { - @route("/{blobName}/with-query") - @get - withQuery(@path blobName: string, @query format?: string): void; - - @route("/{blobName}/get-standalone") - @get - getStandalone(@path blobName: string): BlobProperties; - - @route("/{blobName}") - @delete - deleteStandalone(@path blobName: string): void; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/mockapi.ts deleted file mode 100644 index 0b6df10133c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-initialization/mockapi.ts +++ /dev/null @@ -1,223 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -// Mock responses for HeaderParam scenario -Scenarios.Azure_ClientGenerator_Core_ClientInitialization_HeaderParam = passOnSuccess([ - { - uri: "/azure/client-generator-core/client-initialization/header-param/with-query", - method: "get", - request: { - query: { - id: "test-id", - }, - headers: { - name: "test-name-value", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/client-initialization/header-param/with-body", - method: "post", - request: { - headers: { - name: "test-name-value", - }, - body: json({ - name: "test-name", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -// Mock responses for MultipleParams scenario -Scenarios.Azure_ClientGenerator_Core_ClientInitialization_MultipleParams = passOnSuccess([ - { - uri: "/azure/client-generator-core/client-initialization/multiple-params/with-query", - method: "get", - request: { - query: { - id: "test-id", - region: "us-west", - }, - headers: { - name: "test-name-value", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/client-initialization/multiple-params/with-body", - method: "post", - request: { - query: { - region: "us-west", - }, - headers: { - name: "test-name-value", - }, - body: json({ - name: "test-name", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -// Mock responses for MixedParams scenario -Scenarios.Azure_ClientGenerator_Core_ClientInitialization_MixedParams = passOnSuccess([ - { - uri: "/azure/client-generator-core/client-initialization/mixed-params/with-query", - method: "get", - request: { - query: { - id: "test-id", - region: "us-west", - }, - headers: { - name: "test-name-value", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/client-initialization/mixed-params/with-body", - method: "post", - request: { - query: { - region: "us-west", - }, - headers: { - name: "test-name-value", - }, - body: json({ - name: "test-name", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -// Mock responses for PathParam scenario -Scenarios.Azure_ClientGenerator_Core_ClientInitialization_PathParam = passOnSuccess([ - { - uri: "/azure/client-generator-core/client-initialization/path/sample-blob/with-query", - method: "get", - request: { - query: { - format: "text", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/client-initialization/path/sample-blob/get-standalone", - method: "get", - request: {}, - response: { - status: 200, - body: json({ - name: "sample-blob", - size: 42, - contentType: "text/plain", - createdOn: "2025-04-01T12:00:00Z", - }), - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/client-initialization/path/sample-blob", - method: "delete", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -// Mock responses for ParamAlias scenario -Scenarios.Azure_ClientGenerator_Core_ClientInitialization_ParamAlias = passOnSuccess([ - { - uri: "/azure/client-generator-core/client-initialization/param-alias/sample-blob/with-aliased-name", - method: "get", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/client-initialization/param-alias/sample-blob/with-original-name", - method: "get", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -// Mock responses for ParentClient/ChildClient scenario -Scenarios.Azure_ClientGenerator_Core_ClientInitialization_ParentClient_ChildClient = passOnSuccess([ - { - uri: "/azure/client-generator-core/client-initialization/child-client/sample-blob/with-query", - method: "get", - request: { - query: { - format: "text", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/client-initialization/child-client/sample-blob/get-standalone", - method: "get", - request: {}, - response: { - status: 200, - body: json({ - name: "sample-blob", - size: 42, - contentType: "text/plain", - createdOn: "2025-04-01T12:00:00Z", - }), - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/client-initialization/child-client/sample-blob", - method: "delete", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/main.tsp deleted file mode 100644 index 622437a5925..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/main.tsp +++ /dev/null @@ -1,131 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Spector; -using Azure.ClientGenerator.Core; - -@doc("Test for @clientLocation decorator - moving operations between clients") -@scenarioService("/azure/client-generator-core/client-location") -@global.Azure.ClientGenerator.Core.clientNamespace( - "azure.clientgenerator.core.clientlocation", - "java" -) -namespace _Specs_.Azure.ClientGenerator.Core.ClientLocation; - -// Scenario 1: Move an operation to another sub client (existing interface) -@scenarioDoc(""" - Test moving an operation from one sub client to another existing sub client. - - Operation `deleteUser` from interface `UserOperations` should be moved to interface `AdminOperations` using @clientLocation(AdminOperations). - - Expected client structure: - - Interface UserOperations should contain only operation `getUser` - - Interface AdminOperations should contain operations `getAdminInfo` and `deleteUser` (moved from UserOperations) - """) -@scenario -namespace MoveToExistingSubClient { - interface UserOperations { - @route("/user") - @get - getUser(): void; - - @route("/user") - @delete - @global.Azure.ClientGenerator.Core.clientLocation(AdminOperations) - deleteUser(): void; - } - - interface AdminOperations { - @route("/admin") - @get - getAdminInfo(): void; - } -} - -// Scenario 2: Move an operation to a new sub client (string name) -@scenarioDoc(""" - Test moving an operation to a new sub client specified by string name. - - Operation `archiveProduct` from interface `ProductOperations` should be moved to a new sub client named "ArchiveOperations" using @clientLocation("ArchiveOperations"). - - Expected client structure: - - Interface ProductOperations should contain only operation `listProducts` - - A new sub client "ArchiveOperations" should be created containing operation `archiveProduct` - """) -@scenario -namespace MoveToNewSubClient { - interface ProductOperations { - @route("/products") - @get - listProducts(): void; - - @route("/products/archive") - @post - @global.Azure.ClientGenerator.Core.clientLocation("ArchiveOperations") - archiveProduct(): void; - } -} - -// Scenario 3: Move an operation to root client -@scenarioDoc(""" - Test moving an operation to the root client. - - Operation `getHealthStatus` from interface `ResourceOperations` should be moved to the root client using @clientLocation(service namespace). - - Expected client structure: - - Interface ResourceOperations should contain only operation `getResource` - - Root client should contain operation `getHealthStatus` (moved from ResourceOperations) - """) -@scenario -namespace MoveToRootClient { - interface ResourceOperations { - @route("/resource") - @get - getResource(): void; - - @route("/health") - @get - @global.Azure.ClientGenerator.Core.clientLocation( - _Specs_.Azure.ClientGenerator.Core.ClientLocation - ) - getHealthStatus(): void; - } -} - -// Scenario 4: Move method parameter to client -@scenarioDoc(""" - Test moving a method parameter to client. - - The parameter `storageAccount` from operation `getBlob` should be moved to the `MoveMethodParameterToClient` in the generated code. - - Expected request: - - GET /blob?storageAccount=testaccount&container=testcontainer&blob=testblob.txt - - Expected response: - - Status: 200 - - Body: {"id": "blob-001", "name": "testblob.txt", "size": 1024, "path": "/testcontainer/testblob.txt"} - """) -@scenario -namespace MoveMethodParameterToClient { - model Blob { - id: string; - name: string; - size: int32; - path: string; - } - - interface BlobOperations { - @route("/blob") - @get - getBlob( - @query - @global.Azure.ClientGenerator.Core.clientLocation(MoveMethodParameterToClient) - storageAccount: string, - - @query container: string, - @query blob: string, - ): Blob; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/mockapi.ts deleted file mode 100644 index d0bb342d9f6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/client-location/mockapi.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -// Scenario 1: Move to existing sub client - Mock responses -Scenarios.Azure_ClientGenerator_Core_ClientLocation_MoveToExistingSubClient = passOnSuccess([ - { - uri: "/azure/client-generator-core/client-location/user", - method: "get", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/client-location/user", - method: "delete", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/client-location/admin", - method: "get", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -// Scenario 2: Move to new sub client - Mock responses -Scenarios.Azure_ClientGenerator_Core_ClientLocation_MoveToNewSubClient = passOnSuccess([ - { - uri: "/azure/client-generator-core/client-location/products", - method: "get", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/client-location/products/archive", - method: "post", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -// Scenario 3: Move to root client - Mock responses -Scenarios.Azure_ClientGenerator_Core_ClientLocation_MoveToRootClient = passOnSuccess([ - { - uri: "/azure/client-generator-core/client-location/resource", - method: "get", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/client-location/health", - method: "get", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -// Scenario 4: Move method parameter to client - Mock responses -Scenarios.Azure_ClientGenerator_Core_ClientLocation_MoveMethodParameterToClient = passOnSuccess([ - { - uri: "/azure/client-generator-core/client-location/blob", - method: "get", - request: { - query: { - storageAccount: "testaccount", - container: "testcontainer", - blob: "testblob.txt", - }, - }, - response: { - status: 200, - body: json({ - id: "blob-001", - name: "testblob.txt", - size: 1024, - path: "/testcontainer/testblob.txt", - }), - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/main.tsp deleted file mode 100644 index e41c72f5931..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/main.tsp +++ /dev/null @@ -1,35 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using global.Azure.ClientGenerator.Core; -using Spector; - -@doc("Test decorator @deserializeEmptyStringAsNull.") -@scenarioService("/azure/client-generator-core/deserialize-empty-string-as-null") -@global.Azure.ClientGenerator.Core.clientNamespace( - "azure.clientgenerator.core.deserialize.emptystringnull", - "java" -) -namespace _Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull; - -@doc("This is a Model contains a string-like property of type url.") -model ResponseModel { - @deserializeEmptyStringAsNull - sampleUrl: url; -} - -@scenario -@scenarioDoc(""" - This scenario will be used to test if client code can correctly deserializes an empty url as null. - Expected response body: - ```json - { - "serviceUrl": "" - } - ``` - """) -@route("/responseModel") -@get -op get(): ResponseModel; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/mockapi.ts deleted file mode 100644 index 8a2efdc5521..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/deserialize-empty-string-as-null/mockapi.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Azure_ClientGenerator_Core_DeserializeEmptyStringAsNull_get = passOnSuccess({ - uri: "/azure/client-generator-core/deserialize-empty-string-as-null/responseModel", - method: "get", - request: {}, - response: { - status: 200, - body: json({ - sampleUrl: "", - }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/main.tsp deleted file mode 100644 index 242d49ece4e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/main.tsp +++ /dev/null @@ -1,112 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using global.Azure.ClientGenerator.Core; -using Spector; - -@doc("Illustrates the model flatten cases.") -@scenarioService("/azure/client-generator-core/flatten-property") -@global.Azure.ClientGenerator.Core.clientNamespace( - "azure.clientgenerator.core.flattenproperty", - "java" -) -namespace _Specs_.Azure.ClientGenerator.Core.FlattenProperty; - -@doc("This is the model with one level of flattening.") -model FlattenModel { - name: string; - - #suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Testing backcompat" - @global.Azure.ClientGenerator.Core.Legacy.flattenProperty - properties: ChildModel; -} - -@doc("This is the model with two levels of flattening.") -model NestedFlattenModel { - name: string; - - #suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Testing backcompat" - @global.Azure.ClientGenerator.Core.Legacy.flattenProperty - properties: ChildFlattenModel; -} - -@doc("This is the child model to be flattened.") -model ChildModel { - description: string; - age: int32; -} - -@doc("This is the child model to be flattened. And it has flattened property as well.") -model ChildFlattenModel { - summary: string; - - #suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "Testing backcompat" - @global.Azure.ClientGenerator.Core.Legacy.flattenProperty - properties: ChildModel; -} - -@scenario -@route("/flattenModel") -@scenarioDoc(""" - Update and receive model with 1 level of flattening. - Expected input body: - ```json - { - "name": "foo", - "properties": { - "description": "bar", - "age": 10 - } - } - ``` - - Expected response body: - ```json - { - "name": "test", - "properties": { - "description": "test", - "age": 1 - } - } - ``` - """) -@put -op putFlattenModel(@body input: FlattenModel): FlattenModel; - -@scenario -@route("/nestedFlattenModel") -@scenarioDoc(""" - Update and receive model with 2 levels of flattening. - Expected input body: - ```json - { - "name": "foo", - "properties": { - "summary": "bar", - "properties": { - "description": "test", - "age": 10 - } - } - } - ``` - - Expected response body: - ```json - { - "name": "test", - "properties": { - "summary": "test", - "properties": { - "description": "foo", - "age": 1 - } - } - } - ``` - """) -@put -op putNestedFlattenModel(@body input: NestedFlattenModel): NestedFlattenModel; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/mockapi.ts deleted file mode 100644 index 8b5205d8f99..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/flatten-property/mockapi.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { json, MockApiDefinition, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; -function createMockApiDefinitions(route: string, request: any, response: any): MockApiDefinition { - return { - uri: `/azure/client-generator-core/flatten-property/${route}`, - method: "put", - request: { - body: json(request), - }, - response: { - status: 200, - body: json(response), - }, - kind: "MockApiDefinition", - }; -} - -Scenarios.Azure_ClientGenerator_Core_FlattenProperty_putFlattenModel = passOnSuccess( - createMockApiDefinitions( - "flattenModel", - { - name: "foo", - properties: { - description: "bar", - age: 10, - }, - }, - { - name: "test", - properties: { - description: "test", - age: 1, - }, - }, - ), -); - -Scenarios.Azure_ClientGenerator_Core_FlattenProperty_putNestedFlattenModel = passOnSuccess( - createMockApiDefinitions( - "nestedFlattenModel", - { - name: "foo", - properties: { - summary: "bar", - properties: { - description: "test", - age: 10, - }, - }, - }, - { - name: "test", - properties: { - summary: "test", - properties: { - description: "foo", - age: 1, - }, - }, - }, - ), -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/main.tsp deleted file mode 100644 index 4f95e3598f3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/main.tsp +++ /dev/null @@ -1,194 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Spector; -using Azure.ClientGenerator.Core; - -@doc("Test for @hierarchyBuilding decorator.") -@scenarioService("/azure/client-generator-core/hierarchy-building") -@global.Azure.ClientGenerator.Core.clientNamespace( - "specs.azure.clientgenerator.core.hierarchybuilding", - "python" -) -@global.Azure.ClientGenerator.Core.clientNamespace( - "azure.clientgenerator.core.hierarchybuilding", - "java" -) -namespace _Specs_.Azure.ClientGenerator.Core.HierarchyBuilding; - -@discriminator("kind") -model Animal { - @doc("The kind of animal") - kind: string; - - @doc("Name of the animal") - name: string; -} - -alias PetContent = { - @doc("Whether the pet is trained") - trained: boolean; -}; - -model Pet extends Animal { - kind: "pet"; - ...PetContent; -} - -alias DogContent = { - @doc("The breed of the dog") - breed: string; -}; - -@global.Azure.ClientGenerator.Core.Legacy.hierarchyBuilding(Pet) -model Dog extends Animal { - kind: "dog"; - ...PetContent; - ...DogContent; -} - -interface AnimalOperations { - @scenario - @route("/pet/as-animal") - @scenarioDoc(""" - Test operation that accepts Animal input and returns Animal output. - Service expects Pet data and returns Pet data. - Expected request body: - ```json - { - "kind": "pet", - "name": "Buddy", - "trained": true - } - ``` - Expected response body: - ```json - { - "kind": "pet", - "name": "Buddy", - "trained": true - } - ``` - """) - @doc("Update a pet as an animal") - @put - updatePetAsAnimal(@body animal: Animal): Animal; - - @scenario - @route("/dog/as-animal") - @scenarioDoc(""" - Test operation that accepts Animal input and returns Animal output. - Service expects Dog data and returns Dog data. - Due to @hierarchyBuilding(Pet), Dog should inherit from Pet rather than Animal directly. - Expected request body: - ```json - { - "kind": "dog", - "name": "Rex", - "trained": true, - "breed": "German Shepherd" - } - ``` - Expected response body: - ```json - { - "kind": "dog", - "name": "Rex", - "trained": true, - "breed": "German Shepherd" - } - ``` - """) - @doc("Update a dog as an animal") - @put - updateDogAsAnimal(@body animal: Animal): Animal; -} - -interface PetOperations { - @scenario - @route("/pet/as-pet") - @scenarioDoc(""" - Test operation that accepts Pet input and returns Pet output. - This operation validates Pet type directly. - Expected request body: - ```json - { - "kind": "pet", - "name": "Buddy", - "trained": true - } - ``` - Expected response body: - ```json - { - "kind": "pet", - "name": "Buddy", - "trained": true - } - ``` - """) - @doc("Update a pet as a pet") - @put - updatePetAsPet(@body pet: Pet): Pet; - - @scenario - @route("/dog/as-pet") - @scenarioDoc(""" - Test operation that accepts Pet input and returns Pet output. - Service expects Dog data and returns Dog data. - This validates that Dog can be used as Pet due to @hierarchyBuilding decorator. - Expected request body: - ```json - { - "kind": "dog", - "name": "Rex", - "trained": true, - "breed": "German Shepherd" - } - ``` - Expected response body: - ```json - { - "kind": "dog", - "name": "Rex", - "trained": true, - "breed": "German Shepherd" - } - ``` - """) - @doc("Update a dog as a pet") - @put - updateDogAsPet(@body pet: Pet): Pet; -} - -interface DogOperations { - @scenario - @route("/dog/as-dog") - @scenarioDoc(""" - Test operation that accepts Dog input and returns Dog output. - This operation validates Dog type directly. - Expected request body: - ```json - { - "kind": "dog", - "name": "Rex", - "trained": true, - "breed": "German Shepherd" - } - ``` - Expected response body: - ```json - { - "kind": "dog", - "name": "Rex", - "trained": true, - "breed": "German Shepherd" - } - ``` - """) - @doc("Update a dog as a dog") - @put - updateDogAsDog(@body dog: Dog): Dog; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/mockapi.ts deleted file mode 100644 index fee2df64327..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/hierarchy-building/mockapi.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -// Sample data for testing -const samplePet = { - kind: "pet", - name: "Buddy", - trained: true, -}; - -const sampleDog = { - kind: "dog", - name: "Rex", - trained: true, - breed: "German Shepherd", -}; - -// Animal operations - -Scenarios.Azure_ClientGenerator_Core_HierarchyBuilding_AnimalOperations_updatePetAsAnimal = - passOnSuccess({ - uri: "/azure/client-generator-core/hierarchy-building/pet/as-animal", - method: "put", - request: { - body: json(samplePet), - }, - response: { - status: 200, - body: json(samplePet), - }, - kind: "MockApiDefinition", - }); - -Scenarios.Azure_ClientGenerator_Core_HierarchyBuilding_AnimalOperations_updateDogAsAnimal = - passOnSuccess({ - uri: "/azure/client-generator-core/hierarchy-building/dog/as-animal", - method: "put", - request: { - body: json(sampleDog), - }, - response: { - status: 200, - body: json(sampleDog), - }, - kind: "MockApiDefinition", - }); - -// Pet operations -Scenarios.Azure_ClientGenerator_Core_HierarchyBuilding_PetOperations_updatePetAsPet = passOnSuccess( - { - uri: "/azure/client-generator-core/hierarchy-building/pet/as-pet", - method: "put", - request: { - body: json(samplePet), - }, - response: { - status: 200, - body: json(samplePet), - }, - kind: "MockApiDefinition", - }, -); - -Scenarios.Azure_ClientGenerator_Core_HierarchyBuilding_PetOperations_updateDogAsPet = passOnSuccess( - { - uri: "/azure/client-generator-core/hierarchy-building/dog/as-pet", - method: "put", - request: { - body: json(sampleDog), - }, - response: { - status: 200, - body: json(sampleDog), - }, - kind: "MockApiDefinition", - }, -); - -// Dog operations -Scenarios.Azure_ClientGenerator_Core_HierarchyBuilding_DogOperations_updateDogAsDog = passOnSuccess( - { - uri: "/azure/client-generator-core/hierarchy-building/dog/as-dog", - method: "put", - request: { - body: json(sampleDog), - }, - response: { - status: 200, - body: json(sampleDog), - }, - kind: "MockApiDefinition", - }, -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/main.tsp deleted file mode 100644 index d2690c4045b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/main.tsp +++ /dev/null @@ -1,72 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Spector; -using Azure.ClientGenerator.Core; - -@doc("Test for @nextLinkVerb decorator.") -@scenarioService("/azure/client-generator-core/next-link-verb") -@global.Azure.ClientGenerator.Core.clientNamespace( - "azure.clientgenerator.core.nextlinkverb", - "java" -) -@global.Azure.ClientGenerator.Core.clientNamespace( - "specs.azure.clientgenerator.core.nextlinkverb", - "python" -) -namespace _Specs_.Azure.ClientGenerator.Core.NextLinkVerb; - -@doc("Test model.") -model Test { - @doc("The id of the test.") - id: string; -} - -@doc("Paged response model.") -model ListTestResult { - @pageItems - @doc("List of items.") - items: Test[]; - - @nextLink - @doc("Link to fetch more items.") - nextLink?: string; -} - -@scenario -@scenarioDoc(""" - Test for @nextLinkVerb decorator with POST verb. - This operation should use POST for both the initial request and the next link request. - - Expected initial request: POST /azure/client-generator-core/next-link-verb/items - Expected response body: - ```json - { - "items": [ - { - "id": "test1" - } - ], - "nextLink": "http://localhost:3000/azure/client-generator-core/next-link-verb/items/page/2" - } - ``` - - Expected next link request: POST /azure/client-generator-core/next-link-verb/items/page/2 - Expected response body: - ```json - { - "items": [ - { - "id": "test2" - } - ] - } - ``` - """) -@global.Azure.ClientGenerator.Core.Legacy.nextLinkVerb("POST") -@list -@route("/items") -@post -op listItems(): ListTestResult; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/mockapi.ts deleted file mode 100644 index f6cd63d392a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/next-link-verb/mockapi.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { dyn, dynItem, json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Azure_ClientGenerator_Core_NextLinkVerb_listItems = passOnSuccess([ - { - // First page request - uri: "/azure/client-generator-core/next-link-verb/items", - method: "post", - request: {}, - response: { - status: 200, - body: json({ - items: [ - { - id: "test1", - }, - ], - nextLink: dyn`${dynItem("baseUrl")}/azure/client-generator-core/next-link-verb/items/page/2`, - }), - }, - kind: "MockApiDefinition", - }, - { - // Second page request - uri: "/azure/client-generator-core/next-link-verb/items/page/2", - method: "post", - request: {}, - response: { - status: 200, - body: json({ - items: [ - { - id: "test2", - }, - ], - }), - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/client.tsp deleted file mode 100644 index ef51ac5e22d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/client.tsp +++ /dev/null @@ -1,44 +0,0 @@ -import "./main.tsp"; -import "@azure-tools/typespec-client-generator-core"; -import "@typespec/http"; - -using Http; -using global.Azure.ClientGenerator.Core; - -@clientNamespace("azure.clientgenerator.core.methodoverride", "java") -namespace Customization; - -@@clientNamespace(_Specs_.Azure.ClientGenerator.Core.Override, - "azure.clientgenerator.core.methodoverride", - "java" -); - -op reorderCustomized(@path param1: string, @path param2: string): void; - -@@override(_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder, - reorderCustomized -); - -model GroupParametersOptions { - @query param1: string; - @query param2: string; -} - -op groupCustomized(options: GroupParametersOptions): void; - -@@override(_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group, - groupCustomized, - "!javascript" -); - -op requireOptionalCustomized(@path param1: string, @path param2: string): void; - -@@override(_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional, - requireOptionalCustomized -); - -op removeOptionalCustomized(@path param1: string, @query param2?: string): void; - -@@override(_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional, - removeOptionalCustomized -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/main.tsp deleted file mode 100644 index 982ccc65f96..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/main.tsp +++ /dev/null @@ -1,81 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Spector; - -@doc("Test scenarios for client override behavior.") -@scenarioService("/azure/client-generator-core/override") -namespace _Specs_.Azure.ClientGenerator.Core.Override; - -interface ReorderParameters { - @scenario - @scenarioDoc(""" - Verify that after `@override` the parameters are reordered correctly in the client method signature. - - Expected path parameter: - param1: param1 - param2: param2 - - Expected response: 204 No Content - """) - @route("/reorder/{param2}/{param1}") - @get - reorder(@path param2: string, @path param1: string): void; -} - -interface GroupParameters { - @scenario - @scenarioDoc(""" - Verify that after `@override` the parameters are grouped correctly to `GroupParametersOptions` in the client method signature. - - Expected query parameter: - param1: param1 - param2: param2 - - Expected response: 204 No Content - """) - @route("/group") - @get - group(@query param1: string, @query param2: string): void; -} - -interface RequireOptionalParameter { - @scenario - @scenarioDoc(""" - Verify that after `@override` an optional parameter can be made required in the client method signature. - - Expected path parameter: - param1: param1 - param2: param2 - - Expected response: 204 No Content - """) - @route("/require-optional/{param1}/{param2}") - @get - requireOptional(@path param1: string, @path param2?: string): void; -} - -interface RemoveOptionalParameter { - @scenario - @scenarioDoc(""" - Verify that after `@override`, optional parameters can be removed from the client method signature. - - Expected path parameter: - param1: param1 - - Expected query parameter: - param2: param2 - - Expected response: 204 No Content - """) - @route("/remove-optional/{param1}") - @get - removeOptional( - @path param1: string, - @query param2?: string, - @query param3?: string, - @header param4?: string, - ): void; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/mockapi.ts deleted file mode 100644 index 1a1f7203f49..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/override/mockapi.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -// Test parameter reordering with @override decorator -// Verifies that parameters are reordered correctly in client method signature -// Expected path: /azure/client-generator-core/override/reorder/{param2}/{param1} -// Where param1="param1" and param2="param2" -Scenarios.Azure_ClientGenerator_Core_Override_ReorderParameters_reorder = passOnSuccess([ - { - uri: "/azure/client-generator-core/override/reorder/param2/param1", - method: "get", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -// Test parameter grouping with @override decorator -// Verifies that parameters are grouped correctly into GroupParametersOptions -// Expected query parameters: param1="param1", param2="param2" -Scenarios.Azure_ClientGenerator_Core_Override_GroupParameters_group = passOnSuccess([ - { - uri: "/azure/client-generator-core/override/group", - method: "get", - request: { - query: { - param1: "param1", - param2: "param2", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -// Test parameter requirement with @override decorator -// Verifies that optional parameters can be made required via @override -Scenarios.Azure_ClientGenerator_Core_Override_RequireOptionalParameter_requireOptional = - passOnSuccess([ - { - uri: "/azure/client-generator-core/override/require-optional/param1/param2", - method: "get", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - ]); - -// Test parameter requirement with @override decorator -// Verifies that optional parameters can be removed via @override -Scenarios.Azure_ClientGenerator_Core_Override_RemoveOptionalParameter_removeOptional = - passOnSuccess([ - { - uri: "/azure/client-generator-core/override/remove-optional/param1", - method: "get", - request: { - query: { - param2: "param2", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - ]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/main.tsp deleted file mode 100644 index 326b229c2e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/main.tsp +++ /dev/null @@ -1,122 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Spector; - -@doc("Test for internal decorator.") -@scenarioService("/azure/client-generator-core/usage") -@global.Azure.ClientGenerator.Core.clientNamespace("azure.clientgenerator.core.usage", "java") -namespace _Specs_.Azure.ClientGenerator.Core.Usage; - -@scenario -@scenarioDoc(""" - This scenario contains 4 public operations. All should be generated and exported. - 'OrphanModel' is not used but specified as 'public' and 'input', so it should be generated in SDK. The 'orphanModelSerializable' operation verifies that the model can be serialized to JSON. - The other models' usage is additive to roundtrip, so they should be generated and exported as well. - """) -@global.Azure.ClientGenerator.Core.clientNamespace("azure.clientgenerator.core.usage", "java") -namespace ModelInOperation { - @doc("Usage additive to roundtrip.") - @global.Azure.ClientGenerator.Core.usage( - global.Azure.ClientGenerator.Core.Usage.input | global.Azure.ClientGenerator.Core.Usage.output - ) - model InputModel { - name: string; - } - - @doc(""" - Expected body parameter: - ```json - { - "name": "Madge" - } - ``` - """) - @route("/inputToInputOutput") - @post - op inputToInputOutput(@body body: InputModel): void; - - @doc("Usage additive to roundtrip.") - @global.Azure.ClientGenerator.Core.usage( - global.Azure.ClientGenerator.Core.Usage.input | global.Azure.ClientGenerator.Core.Usage.output - ) - model OutputModel { - name: string; - } - - @doc(""" - Expected response body: - ```json - { - "name": "Madge" - } - ``` - """) - @route("/outputToInputOutput") - @get - op outputToInputOutput(): OutputModel; - - model ResultModel { - name: string; - } - - model RoundTripModel { - @visibility(Lifecycle.Read) - result: ResultModel; - } - - @doc(""" - "ResultModel" should be usage=output, as it is read-only and does not exist in request body. - - Expected body parameter: - ```json - { - } - ``` - - Expected response body: - ```json - { - "result": { - "name": "Madge" - } - } - ``` - """) - @route("/modelInReadOnlyProperty") - @put - op modelInReadOnlyProperty(@body body: RoundTripModel): { - @body body: RoundTripModel; - }; - - @doc(""" - Serialize the 'OrphanModel' as request body. - - Expected body parameter: - ```json - { - "name": "name", - "desc": "desc" - } - ``` - """) - @global.Azure.ClientGenerator.Core.convenientAPI(false) - @route("/orphanModelSerializable") - @put - op orphanModelSerializable(@body body: unknown): NoContentResponse; -} - -@doc("Not used anywhere, but access is override to public so still need to be generated and exported with serialization.") -@global.Azure.ClientGenerator.Core.usage( - global.Azure.ClientGenerator.Core.Usage.input | global.Azure.ClientGenerator.Core.Usage.json -) -@global.Azure.ClientGenerator.Core.access(global.Azure.ClientGenerator.Core.Access.public) -model OrphanModel { - @global.Azure.ClientGenerator.Core.clientName("modelName") - name: string; - - @encodedName("application/json", "desc") - description: string; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/mockapi.ts deleted file mode 100644 index 3added595a8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/client-generator-core/usage/mockapi.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Azure_ClientGenerator_Core_Usage_ModelInOperation = passOnSuccess([ - { - uri: "/azure/client-generator-core/usage/inputToInputOutput", - method: "post", - request: { - body: json({ - name: "Madge", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/usage/outputToInputOutput", - method: "get", - request: {}, - response: { - status: 200, - body: json({ name: "Madge" }), - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/usage/modelInReadOnlyProperty", - method: "put", - request: {}, - response: { - status: 200, - body: json({ result: { name: "Madge" } }), - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/client-generator-core/usage/orphanModelSerializable", - method: "put", - request: { - body: json({ - name: "name", - desc: "desc", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/client.tsp deleted file mode 100644 index 474b89b83f1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/client.tsp +++ /dev/null @@ -1,8 +0,0 @@ -import "@azure-tools/typespec-client-generator-core"; -import "./main.tsp"; - -using Azure.ClientGenerator.Core; - -@@convenientAPI(_Specs_.Azure.Core.Basic.createOrUpdate, false, "csharp"); - -@@clientNamespace(_Specs_.Azure.Core.Basic, "azure.core.basic", "java"); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/main.tsp deleted file mode 100644 index f1bbb4a6c2a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/main.tsp +++ /dev/null @@ -1,260 +0,0 @@ -import "@typespec/spector"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-client-generator-core"; -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; - -using Azure.Core; -using global.Azure.Core.Traits; -using global.Azure.Core.Foundations; -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using Spector; - -#suppress "@azure-tools/typespec-azure-core/casing-style" "For spec" -@doc("Illustrates bodies templated with Azure Core") -@scenarioService( - "/azure/core/basic", - { - versioned: Versions, - } -) -namespace _Specs_.Azure.Core.Basic; - -@doc("The version of the API.") -enum Versions { - @doc("The version 2022-12-01-preview.") - v2022_12_01_preview: "2022-12-01-preview", -} - -alias ResourceOperations = global.Azure.Core.ResourceOperations; - -@resource("users") -@doc("Details about a user.") -model User { - @key - @doc("The user's id.") - @visibility(Lifecycle.Read) - id: int32; - - @doc("The user's name.") - name: string; - - @doc("The user's order list") - orders?: UserOrder[]; - - ...global.Azure.Core.EtagProperty; -} - -@doc("UserOrder for testing list with expand.") -@resource("user") -model UserOrder { - @key - @doc("The user's id.") - @visibility(Lifecycle.Read) - id: int32; - - @doc("The user's id.") - userId: int32; - - @doc("The user's order detail") - detail: string; -} - -@doc("The parameters for exporting a user.") -model UserExportParams { - @query - @doc("The format of the data.") - format: string; -} - -@scenario -@doc("Creates or updates a User") -@summary("Adds a user or updates a user's fields.") -@scenarioDoc(""" - Should only generate models named User and UserOrder. - - Expected path parameter: id=1 - Expected query parameter: api-version=2022-12-01-preview - - Expected input body: - ```json - { - "name": "Madge" - } - ``` - - Expected response body: - ```json - { - "id": 1, - "name": "Madge" - } - ``` - """) -op createOrUpdate is ResourceOperations.ResourceCreateOrUpdate; - -@scenario -@doc("Creates or replaces a User") -@summary("Adds a user or replaces a user's fields.") -@scenarioDoc(""" - Should only generate models named User and UserOrder. - - Expected path parameter: id=1 - Expected query parameter: api-version=2022-12-01-preview - - Expected input body: - ```json - { - "name": "Madge" - } - ``` - - Expected response body: - ```json - { - "id": 1, - "name": "Madge", - "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" - } - ``` - """) -op createOrReplace is ResourceOperations.ResourceCreateOrReplace; - -@scenario -@doc("Gets a User") -@summary("Gets a user.") -@scenarioDoc(""" - Should only generate models named User and UserOrder. - - Expected path parameter: id=1 - Expected query parameter: api-version=2022-12-01-preview - - Expected response body: - ```json - { - "id": 1, - "name": "Madge", - "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" - } - ``` - """) -op get is ResourceOperations.ResourceRead; - -@scenario -@doc("Lists all Users") -@summary("Lists all users.") -@scenarioDoc(""" - Should only generate models named User and UserOrder. - - Should not generate visible model like CustomPage. - - Expected query parameter: api-version=2022-12-01-preview&top=5&skip=10&orderby=id&filter=id%20lt%2010&select=id&select=orders&select=etag&expand=orders - - Expected response body: - ```json - { - "value":[ - { - "id":1, - "name":"Madge", - "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59", - "orders": [{ "id": 1, "userId": 1, detail: "a recorder" }] - }, - { - "id":2, - "name":"John", - "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b5a", - "orders": [{ "id": 2, "userId": 2, "detail": "a TV" }] - } - ] - } - ``` - """) -op list is ResourceOperations.ResourceList< - User, - ListQueryParametersTrait ->; - -@scenario -@doc("Deletes a User") -@summary("Deletes a user.") -@scenarioDoc(""" - Expected path parameter: id=1 - - Expected query parameter: api-version=2022-12-01-preview - - Expected response of status code 204 with empty body. - """) -op delete is ResourceOperations.ResourceDelete; - -@scenario -@doc("Exports a User") -@summary("Exports a user.") -@scenarioDoc(""" - Should only generate models named User and UserOrder. - - Expected path parameter: id=1 - Expected query parameter: format=json - Expected query parameter: api-version=2022-12-01-preview - - Expected response body: - ```json - { - "id": 1, - "name": "Madge", - "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" - } - ``` - """) -op export is ResourceOperations.ResourceAction; - -model UserList { - users: User[]; -} - -@scenario -@doc("Exports all users") -@summary("Exports all users.") -@scenarioDoc(""" - Should generate a model named User. - - Expected query parameter: format=json - Expected query parameter: api-version=2022-12-01-preview - - Expected response body: - ```json - { - "users":[ - { - "id": 1, - "name": "Madge", - "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" - }, - { - "id": 2, - "name": "John", - "etag": "22bdc430-65e8-45ad-81d9-8ffa60d55b59" - } - ] - } - ``` - """) -@collectionAction(User, "exportallusers") -@post -op exportAllUsers is ResourceOperations.ResourceCollectionAction< - User, - UserExportParams, - UserList, - { - apiVersion: "2022-12-01-preview"; - } ->; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/mockapi.ts deleted file mode 100644 index f0fcae86bf8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/basic/mockapi.ts +++ /dev/null @@ -1,137 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; -const validUser = { id: 1, name: "Madge", etag: "11bdc430-65e8-45ad-81d9-8ffa60d55b59" }; -const validUser2 = { id: 2, name: "John", etag: "22bdc430-65e8-45ad-81d9-8ffa60d55b59" }; -Scenarios.Azure_Core_Basic_createOrUpdate = passOnSuccess({ - uri: "/azure/core/basic/users/:id", - method: "patch", - request: { - pathParams: { - id: "1", - }, - query: { - "api-version": "2022-12-01-preview", - }, - headers: { - "Content-Type": "application/merge-patch+json", - }, - body: json({ name: "Madge" }), - }, - response: { status: 200, body: json(validUser) }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_Core_Basic_createOrReplace = passOnSuccess({ - uri: "/azure/core/basic/users/:id", - method: "put", - request: { - pathParams: { - id: "1", - }, - query: { - "api-version": "2022-12-01-preview", - }, - body: json({ name: "Madge" }), - }, - response: { status: 200, body: json(validUser) }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_Core_Basic_get = passOnSuccess({ - uri: "/azure/core/basic/users/:id", - method: "get", - request: { - pathParams: { - id: "1", - }, - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { status: 200, body: json(validUser) }, - kind: "MockApiDefinition", -}); -const responseBody = { - value: [ - { - id: 1, - name: "Madge", - etag: "11bdc430-65e8-45ad-81d9-8ffa60d55b59", - orders: [{ id: 1, userId: 1, detail: "a recorder" }], - }, - { - id: 2, - name: "John", - etag: "11bdc430-65e8-45ad-81d9-8ffa60d55b5a", - orders: [{ id: 2, userId: 2, detail: "a TV" }], - }, - ], -}; -Scenarios.Azure_Core_Basic_list = passOnSuccess({ - uri: "/azure/core/basic/users", - method: "get", - request: { - query: { - "api-version": "2022-12-01-preview", - top: 5, - skip: 10, - orderby: "id", - filter: "id lt 10", - select: ["id", "orders", "etag"], - expand: "orders", - }, - }, - response: { status: 200, body: json(responseBody) }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_Core_Basic_delete = passOnSuccess({ - uri: "/azure/core/basic/users/:id", - method: "delete", - request: { - pathParams: { - id: "1", - }, - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_Core_Basic_export = passOnSuccess({ - uri: "/azure/core/basic/users/:id\\:export", - method: "post", - request: { - pathParams: { - id: "1", - }, - query: { - format: "json", - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validUser), - }, - kind: "MockApiDefinition", -}); - -const expectBody = { users: [validUser, validUser2] }; -Scenarios.Azure_Core_Basic_exportAllUsers = passOnSuccess({ - uri: "/azure/core/basic/users:exportallusers", - method: "post", - request: { - query: { - format: "json", - "api-version": "2022-12-01-preview", - }, - }, - response: { status: 200, body: json(expectBody) }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/main.tsp deleted file mode 100644 index 552ecfae7d4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/main.tsp +++ /dev/null @@ -1,115 +0,0 @@ -import "@azure-tools/typespec-azure-core"; -import "@typespec/spector"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-client-generator-core"; - -using Azure.Core; -using global.Azure.Core.Traits; -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using Spector; - -#suppress "@azure-tools/typespec-azure-core/casing-style" "For spec" -@doc("Illustrates bodies templated with Azure Core with long-running RPC operation") -@scenarioService( - "/azure/core/lro/rpc", - { - versioned: Versions, - } -) -@global.Azure.ClientGenerator.Core.clientNamespace("azure.core.lro.rpc", "java") -namespace _Specs_.Azure.Core.Lro.Rpc; - -@doc("The API version.") -enum Versions { - @doc("The 2022-12-01-preview version.") - v2022_12_01_preview: "2022-12-01-preview", -} - -@doc("Options for the generation.") -model GenerationOptions { - @doc("Prompt.") - prompt: string; -} - -model GenerationResponse is global.Azure.Core.Foundations.OperationStatus; -// fix warning in Azure.Core.Foundations.OperationStatus -@@visibility(global.Azure.Core.Foundations.OperationStatus.id, Lifecycle.Read); - -@doc("Result of the generation.") -model GenerationResult { - @doc("The data.") - data: string; -} - -@scenario -@doc("Generate data.") -@summary("Generate data.") -@scenarioDoc(""" - Should generate model GenerationOptions and GenerationResult. - GenerationResponse could be generated, depending on implementation. - - Expected verb: POST - Expected request body: - ```json - { - "prompt": "text" - } - ``` - - Expected status code: 202 - Expected response header: operation-location={endpoint}/generations/operations/operation1 - Expected response body: - ```json - { - "id": "operation1", - "status": "InProgress" - } - ``` - - Expected verb: GET - Expected URL: {endpoint}/generations/operations/operation1 - - Expected status code: 200 - Expected response body: - ```json - { - "id": "operation1", - "status": "InProgress" - } - ``` - - Expected verb: GET - Expected URL: {endpoint}/generations/operations/operation1 - - Expected status code: 200 - Expected response body: - ```json - { - "id": "operation1", - "status": "Succeeded", - "result": { - "data": "text data" - } - } - ``` - """) -@route("/generations:submit") -op longRunningRpc is global.Azure.Core.LongRunningRpcOperation< - BodyParameter, - GenerationResponse, - GenerationResult ->; - -alias BodyParameter< - T, - TName extends valueof string = "body", - TDoc extends valueof string = "The body parameter." -> = { - @doc(TDoc) - @friendlyName(TName) - @bodyRoot - body: T; -}; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/mockapi.ts deleted file mode 100644 index 0043ce0d159..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/rpc/mockapi.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { - dyn, - dynItem, - json, - MockRequest, - passOnSuccess, - ScenarioMockApi, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -let generationPollCount = 0; - -Scenarios.Azure_Core_Lro_Rpc_longRunningRpc = passOnSuccess([ - { - uri: "/azure/core/lro/rpc/generations:submit", - method: "post", - request: { - body: json({ prompt: "text" }), - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 202, - headers: { - "operation-location": dyn`${dynItem("baseUrl")}/azure/core/lro/rpc/generations/operations/operation1`, - }, - body: json({ id: "operation1", status: "InProgress" }), - }, - handler: (req: MockRequest) => { - req.expect.containsQueryParam("api-version", "2022-12-01-preview"); - req.expect.bodyEquals({ prompt: "text" }); - generationPollCount = 0; - return { - status: 202, - headers: { - "operation-location": `${req.baseUrl}/azure/core/lro/rpc/generations/operations/operation1`, - }, - body: json({ id: "operation1", status: "InProgress" }), - }; - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/core/lro/rpc/generations/operations/operation1", - method: "get", - request: { - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ id: "operation1", status: "InProgress" }), - }, - handler: lroHandler, - kind: "MockApiDefinition", - }, - { - uri: "/azure/core/lro/rpc/generations/operations/operation1", - method: "get", - request: { - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ id: "operation1", status: "Succeeded", result: { data: "text data" } }), - }, - handler: lroHandler, - kind: "MockApiDefinition", - }, -]); - -function lroHandler(req: MockRequest) { - req.expect.containsQueryParam("api-version", "2022-12-01-preview"); - const response = - generationPollCount > 0 - ? { id: "operation1", status: "Succeeded", result: { data: "text data" } } - : { id: "operation1", status: "InProgress" }; - generationPollCount += 1; - return { status: 200, body: json(response) }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/main.tsp deleted file mode 100644 index 5cfce610798..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/main.tsp +++ /dev/null @@ -1,219 +0,0 @@ -import "@azure-tools/typespec-azure-core"; -import "@typespec/spector"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-client-generator-core"; - -using Azure.Core; -using global.Azure.Core.Traits; -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using Spector; - -#suppress "@azure-tools/typespec-azure-core/casing-style" "For spec" -@doc("Illustrates bodies templated with Azure Core with long-running operation") -@scenarioService( - "/azure/core/lro/standard", - { - versioned: Versions, - } -) -@global.Azure.ClientGenerator.Core.clientNamespace("azure.core.lro.standard", "java") -namespace _Specs_.Azure.Core.Lro.Standard; - -@doc("The API version.") -enum Versions { - @doc("The 2022-12-01-preview version.") - v2022_12_01_preview: "2022-12-01-preview", -} - -alias ResourceOperations = global.Azure.Core.ResourceOperations; - -@resource("users") -@doc("Details about a user.") -model User { - @key - @visibility(Lifecycle.Read) - @doc("The name of user.") - name: string; - - @doc("The role of user") - role: string; -} - -@doc("The parameters for exporting a user.") -model UserExportParams { - @query - @doc("The format of the data.") - format: string; -} - -@doc("The exported user data.") -model ExportedUser { - @doc("The name of user.") - name: string; - - @doc("The exported URI.") - resourceUri: string; -} - -@scenario -@doc("Creates or replaces a User") -@summary("Adds a user or replaces a user's fields.") -@scenarioDoc(""" - Should only generate one model named User. - - Expected verb: PUT - Expected path parameter: name=madge - - Expected request body: - ```json - { - "role": "contributor" - } - ``` - - Expected status code: 201 - Expected response header: operation-location={endpoint}/users/madge/operations/operation1 - Expected response body: - ```json - { - "name": "madge", - "role": "contributor" - } - ``` - - Expected verb: GET - Expected URL: {endpoint}/users/madge/operations/operation1 - - Expected status code: 200 - Expected response body: - ```json - { - "id": "operation1", - "status": "InProgress" - } - ``` - - Expected verb: GET - Expected URL: {endpoint}/users/madge/operations/operation1 - - Expected status code: 200 - Expected response body: - ```json - { - "id": "operation1", - "status": "Succeeded" - } - ``` - - (The last GET call on resource URL is optional) - Expected verb: GET - Expected URL: {endpoint}/users/madge - - Expected status code: 200 - Expected response body: - ```json - { - "name": "madge", - "role": "contributor" - } - ``` - """) -op createOrReplace is ResourceOperations.LongRunningResourceCreateOrReplace; - -@scenario -@doc("Deletes a User") -@summary("Deletes a user.") -@scenarioDoc(""" - Expected verb: DELETE - Expected path parameter: name=madge - - Expected status code: 202 - Expected response header: operation-location={endpoint}/users/madge/operations/operation2 - Expected response body: - ```json - { - "id": "operation2", - "status": "InProgress" - } - ``` - - Expected verb: GET - Expected URL: {endpoint}/users/madge/operations/operation2 - - Expected status code: 200 - Expected response body: - ```json - { - "id": "operation2", - "status": "InProgress" - } - ``` - - Expected verb: GET - Expected URL: {endpoint}/users/madge/operations/operation2 - - Expected status code: 200 - Expected response body: - ```json - { - "id": "operation2", - "status": "Succeeded" - } - ``` - """) -op delete is ResourceOperations.LongRunningResourceDelete; - -@scenario -@doc("Exports a User") -@summary("Exports a user.") -@scenarioDoc(""" - Should only generate one model named ExportedUser. - - Expected verb: POST - Expected path parameter: name=madge - Expected query parameter: format=json - - Expected status code: 202 - Expected response header: operation-location={endpoint}/users/madge/operations/operation3 - Expected response body: - ```json - { - "id": "operation3", - "status": "InProgress" - } - ``` - - Expected verb: GET - Expected URL: {endpoint}/users/madge/operations/operation3 - - Expected status code: 200 - Expected response body: - ```json - { - "id": "operation3", - "status": "InProgress" - } - ``` - - Expected verb: GET - Expected URL: {endpoint}/users/madge/operations/operation3 - - Expected status code: 200 - Expected response body: - ```json - { - "id": "operation3", - "status": "Succeeded", - "result": { - "name": "madge", - "resourceUri": "/users/madge" - } - } - ``` - """) -op export is ResourceOperations.LongRunningResourceAction; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/mockapi.ts deleted file mode 100644 index d298890ca92..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/lro/standard/mockapi.ts +++ /dev/null @@ -1,250 +0,0 @@ -import { - dyn, - dynItem, - json, - MockRequest, - passOnSuccess, - ScenarioMockApi, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const validUser = { name: "madge", role: "contributor" }; -let createOrReplacePollCount = 0; -let deletePollCount = 0; -let exportPollCount = 0; - -function createOrReplaceLroHandler(req: MockRequest) { - req.expect.containsQueryParam("api-version", "2022-12-01-preview"); - const response = - createOrReplacePollCount > 0 - ? { id: "operation1", status: "Succeeded" } - : { id: "operation1", status: "InProgress" }; - createOrReplacePollCount += 1; - return { status: 200, body: json(response) }; -} - -function deleteLroHandler(req: MockRequest) { - req.expect.containsQueryParam("api-version", "2022-12-01-preview"); - const response = - deletePollCount > 0 - ? { id: "operation2", status: "Succeeded" } - : { id: "operation2", status: "InProgress" }; - deletePollCount += 1; - return { status: 200, body: json(response) }; -} - -function exportLroHandler(req: MockRequest) { - req.expect.containsQueryParam("api-version", "2022-12-01-preview"); - const response = - exportPollCount > 0 - ? { - id: "operation3", - status: "Succeeded", - result: { name: "madge", resourceUri: "/users/madge" }, - } - : { id: "operation3", status: "InProgress" }; - exportPollCount += 1; - return { status: 200, body: json(response) }; -} - -Scenarios.Azure_Core_Lro_Standard_createOrReplace = passOnSuccess([ - { - uri: "/azure/core/lro/standard/users/madge", - method: "put", - request: { - body: json({ role: "contributor" }), - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 201, - headers: { - "operation-location": dyn`${dynItem("baseUrl")}/azure/core/lro/standard/users/madge/operations/operation1`, - }, - body: json(validUser), - }, - handler: (req: MockRequest) => { - req.expect.containsQueryParam("api-version", "2022-12-01-preview"); - req.expect.bodyEquals({ role: "contributor" }); - createOrReplacePollCount = 0; - return { - status: 201, - headers: { - "operation-location": `${req.baseUrl}/azure/core/lro/standard/users/madge/operations/operation1`, - }, - body: json(validUser), - }; - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/core/lro/standard/users/madge/operations/operation1", - method: "get", - request: { - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ id: "operation1", status: "InProgress" }), - }, - handler: createOrReplaceLroHandler, - kind: "MockApiDefinition", - }, - { - uri: "/azure/core/lro/standard/users/madge/operations/operation1", - method: "get", - request: { - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ id: "operation1", status: "Succeeded" }), - }, - handler: createOrReplaceLroHandler, - kind: "MockApiDefinition", - }, - { - uri: "/azure/core/lro/standard/users/madge", - method: "get", - request: {}, - response: { - status: 200, - body: json(validUser), - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Azure_Core_Lro_Standard_delete = passOnSuccess([ - { - uri: "/azure/core/lro/standard/users/madge", - method: "delete", - request: { - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 202, - headers: { - "operation-location": dyn`${dynItem("baseUrl")}/azure/core/lro/standard/users/madge/operations/operation2`, - }, - body: json({ id: "operation2", status: "InProgress" }), - }, - handler: (req: MockRequest) => { - req.expect.containsQueryParam("api-version", "2022-12-01-preview"); - deletePollCount = 0; - return { - status: 202, - headers: { - "operation-location": `${req.baseUrl}/azure/core/lro/standard/users/madge/operations/operation2`, - }, - body: json({ id: "operation2", status: "InProgress" }), - }; - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/core/lro/standard/users/madge/operations/operation2", - method: "get", - request: { - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ id: "operation2", status: "InProgress" }), - }, - handler: deleteLroHandler, - kind: "MockApiDefinition", - }, - { - uri: "/azure/core/lro/standard/users/madge/operations/operation2", - method: "get", - request: { - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ id: "operation2", status: "Succeeded" }), - }, - handler: deleteLroHandler, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Azure_Core_Lro_Standard_export = passOnSuccess([ - { - uri: "/azure/core/lro/standard/users/madge:export", - method: "post", - request: { - query: { - "api-version": "2022-12-01-preview", - format: "json", - }, - }, - response: { - status: 202, - headers: { - "operation-location": dyn`${dynItem("baseUrl")}/azure/core/lro/standard/users/madge/operations/operation3`, - }, - body: json({ id: "operation3", status: "InProgress" }), - }, - handler: (req: MockRequest) => { - req.expect.containsQueryParam("api-version", "2022-12-01-preview"); - req.expect.containsQueryParam("format", "json"); - exportPollCount = 0; - return { - status: 202, - headers: { - "operation-location": `${req.baseUrl}/azure/core/lro/standard/users/madge/operations/operation3`, - }, - body: json({ id: "operation3", status: "InProgress" }), - }; - }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/core/lro/standard/users/madge/operations/operation3", - method: "get", - request: { - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ id: "operation3", status: "InProgress" }), - }, - handler: exportLroHandler, - kind: "MockApiDefinition", - }, - { - uri: "/azure/core/lro/standard/users/madge/operations/operation3", - method: "get", - request: { - query: { - "api-version": "2022-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ - id: "operation3", - status: "Succeeded", - result: { name: "madge", resourceUri: "/users/madge" }, - }), - }, - handler: exportLroHandler, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/main.tsp deleted file mode 100644 index e21ce5d3132..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/main.tsp +++ /dev/null @@ -1,65 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; -import "@azure-tools/typespec-azure-core"; -import "@typespec/versioning"; - -using TypeSpec.Http; -using global.Azure.ClientGenerator.Core; -using global.Azure.Core; -using TypeSpec.Versioning; -using Spector; - -@scenarioService( - "/azure/core/model", - { - versioned: Versions, - } -) -@global.Azure.ClientGenerator.Core.clientNamespace("azure.core.model", "java") -namespace _Specs_.Azure.Core.Model; -@doc("The version of the API.") -enum Versions { - @doc("The version 2022-12-01-preview.") - v2022_12_01_preview: "2022-12-01-preview", -} -model AzureEmbeddingModel { - embedding: EmbeddingVector; -} - -@operationGroup -@route("/embeddingVector") -interface AzureCoreEmbeddingVector { - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to handle an embedding vector. Mock api will return [0, 1, 2, 3, 4]") - @get - @doc("get an embedding vector") - get(): EmbeddingVector; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to send an embedding vector. Mock api expect to receive [0, 1, 2, 3, 4]") - @put - @doc("put an embedding vector") - put(@body @doc("_") body: EmbeddingVector): void; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc(""" - Expect to send a model which has an embedding vector property. - - Expected request body: - ```json - {"embedding": [0, 1, 2, 3, 4]} - ``` - - Expected response body: - ```json - {"embedding": [5, 6, 7, 8, 9]} - ``` - """) - @post - @doc("post a model which has an embeddingVector property") - post(@body @doc("_") body: AzureEmbeddingModel): AzureEmbeddingModel; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/mockapi.ts deleted file mode 100644 index 7be54031567..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/model/mockapi.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Azure_Core_Model_AzureCoreEmbeddingVector_get = passOnSuccess({ - uri: "/azure/core/model/embeddingVector", - method: "get", - request: {}, - response: { status: 200, body: json([0, 1, 2, 3, 4]) }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_Core_Model_AzureCoreEmbeddingVector_put = passOnSuccess({ - uri: "/azure/core/model/embeddingVector", - method: "put", - request: { - body: json([0, 1, 2, 3, 4]), - }, - response: { status: 204 }, - kind: "MockApiDefinition", -}); - -const responseBody = { embedding: [5, 6, 7, 8, 9] }; -Scenarios.Azure_Core_Model_AzureCoreEmbeddingVector_post = passOnSuccess({ - uri: "/azure/core/model/embeddingVector", - method: "post", - request: { body: json({ embedding: [0, 1, 2, 3, 4] }) }, - response: { status: 200, body: json(responseBody) }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/client.tsp deleted file mode 100644 index d26030665dd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/client.tsp +++ /dev/null @@ -1,6 +0,0 @@ -import "@azure-tools/typespec-client-generator-core"; -import "./main.tsp"; - -using Azure.ClientGenerator.Core; - -@@scope(_Specs_.Azure.Core.Page.withParameterizedNextLink, "!go"); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/main.tsp deleted file mode 100644 index 458652361e7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/main.tsp +++ /dev/null @@ -1,263 +0,0 @@ -import "@azure-tools/typespec-azure-core"; -import "@typespec/spector"; -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-client-generator-core"; - -using Azure.Core; -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using Spector; - -#suppress "@azure-tools/typespec-azure-core/casing-style" "For spec" -@doc("Illustrates bodies templated with Azure Core with paging support") -@scenarioService( - "/azure/core/page", - { - versioned: Versions, - } -) -@global.Azure.ClientGenerator.Core.clientNamespace("azure.core.page", "java") -namespace _Specs_.Azure.Core.Page; - -@doc("The version of the API.") -enum Versions { - @doc("The version 2022-12-01-preview.") - v2022_12_01_preview: "2022-12-01-preview", -} - -@resource("users") -@doc("Details about a user.") -model User { - @key - @doc("The user's id.") - @visibility(Lifecycle.Read) - id: int32; - - @doc("The user's name.") - name: string; - - @doc("The user's order list") - orders?: UserOrder[]; - - ...global.Azure.Core.EtagProperty; -} - -@doc("UserOrder for testing list with expand.") -@resource("user") -model UserOrder { - @key - @doc("The user's id.") - @visibility(Lifecycle.Read) - id: int32; - - @doc("The user's id.") - userId: int32; - - @doc("The user's order detail") - detail: string; -} - -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing global.Azure.Core.Page" -@scenario -@doc("List with Azure.Core.Page<>.") -@route("/page") -@scenarioDoc(""" - Should only generate models named User and UserOrder. - - Should not generate visible model like Page. - - Expected query parameter: api-version=2022-12-01-preview - - Expected response body: - ```json - { - "value":[ - { - "id":1, - "name":"Madge", - "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" - } - ] - } - ``` - """) -@list -op listWithPage is global.Azure.Core.Foundations.Operation<{}, global.Azure.Core.Page>; - -@doc("The parameters for listing users.") -model ListItemInput { - @doc("The body of the input.") - @body - bodyInput: ListItemInputBody; - - @doc("Another query parameter.") - @query - another?: ListItemInputExtensibleEnum; -} - -@doc("An extensible enum input parameter.") -enum ListItemInputExtensibleEnum { - @doc("The first enum value.") - First, - - @doc("The second enum value.") - Second, -} - -@doc("The body of the input.") -model ListItemInputBody { - @doc("The name of the input.") - inputName: string; -} - -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing global.Azure.Core.Page" -@scenario -@doc("List with extensible enum parameter Azure.Core.Page<>.") -@route("/parameters") -@scenarioDoc(""" - Expected query parameter: api-version=2022-12-01-preview&another=Second - - Expected body parameter: {"inputName": "Madge"} - - Expected response body: - ```json - { - "value":[ - { - "id": 1, - "name": "Madge", - "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" - } - ] - } - ``` - """) -@post -@list -op listWithParameters is global.Azure.Core.Foundations.Operation< - ListItemInput, - global.Azure.Core.Page ->; - -@friendlyName("{name}ListResults", T) -model CustomPageModel { - @pageItems - @doc("List of items.") - items: T[]; - - @nextLink - @doc("Link to fetch more items.") - nextLink?: string; -} - -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing global.Azure.Core.Page" -@scenario -@doc("List with custom page model.") -@route("/custom-page") -@scenarioDoc(""" - Should ideally only generate models named User and UserOrder. If your language has to, you can also generate CustomPageModel - - Expected query parameter: api-version=2022-12-01-preview - - Expected response body: - ```json - { - "items":[ - { - "id":1, - "name":"Madge", - "etag": "11bdc430-65e8-45ad-81d9-8ffa60d55b59" - } - ] - } - ``` - """) -@list -op listWithCustomPageModel is global.Azure.Core.Foundations.Operation<{}, CustomPageModel>; - -@doc("First item.") -model FirstItem { - @doc("The id of the item.") - @visibility(Lifecycle.Read) - id: int32; -} - -@doc("Second item.") -model SecondItem { - @doc("The name of the item.") - @visibility(Lifecycle.Read) - name: string; -} - -@scenario -@scenarioDoc(""" - This scenario is to test two operations with two different page item types. - """) -interface TwoModelsAsPageItem { - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing global.Azure.Core.Page" - @doc("Two operations with two different page item types should be successfully generated. Should generate model for FirstItem.") - @route("/first-item") - @list - listFirstItem is global.Azure.Core.Foundations.Operation<{}, global.Azure.Core.Page>; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing global.Azure.Core.Page" - @doc("Two operations with two different page item types should be successfully generated. Should generate model for SecondItem.") - @route("/second-item") - @list - listSecondItem is global.Azure.Core.Foundations.Operation<{}, global.Azure.Core.Page>; -} - -model IncludePendingOptions { - @query - includePending?: boolean; -} - -model ParameterizedNextLinkPagingResult { - @pageItems - values: User[]; - - @nextLink - nextLink: global.Azure.Core.Legacy.parameterizedNextLink<[IncludePendingOptions.includePending]>; -} - -@scenario -@doc("List with parameterized next link that re-injects parameters.") -@route("/with-parameterized-next-link") -@scenarioDoc(""" - This scenario tests the Azure.Core.Legacy.parameterizedNextLink decorator which ensures original request - parameters are maintained in next link URLs. - - Expected query parameters on initial request: - - includePending=true - - select=name - - Expected query parameters on next link request. Note: the SDK will need to re-inject this parameter: - - includePending=true (note: the client will need to manually re-inject this parameter into the next link) - - select=name (note: this is returned in the next link, the client does NOT need to manually re-inject this parameter) - - Expected concatenation of the paged items: - ```json - { - "value":[ - { - "id": 1, - "name": "User1", - }, - { - "id": 2, - "name": "User2", - } - ] - } - ``` - - Note that the nextLink preserves the original filter and select parameters. - """) -@list -op withParameterizedNextLink( - ...IncludePendingOptions, - @query select: string, -): ParameterizedNextLinkPagingResult; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/mockapi.ts deleted file mode 100644 index 4515c445f93..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/page/mockapi.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { dyn, dynItem, json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; -const validUser = { id: 1, name: "Madge", etag: "11bdc430-65e8-45ad-81d9-8ffa60d55b59" }; - -Scenarios.Azure_Core_Page_listWithPage = passOnSuccess({ - uri: "/azure/core/page/page", - method: "get", - request: {}, - response: { status: 200, body: json({ value: [validUser] }) }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_Core_Page_listWithParameters = passOnSuccess({ - uri: "/azure/core/page/parameters", - method: "post", - request: { - query: { - another: "Second", - }, - body: json({ inputName: "Madge" }), - }, - response: { status: 200, body: json({ value: [validUser] }) }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_Core_Page_TwoModelsAsPageItem = passOnSuccess([ - { - uri: "/azure/core/page/first-item", - method: "get", - request: {}, - response: { status: 200, body: json({ value: [{ id: 1 }] }) }, - kind: "MockApiDefinition", - }, - { - uri: "/azure/core/page/second-item", - method: "get", - request: {}, - response: { status: 200, body: json({ value: [{ name: "Madge" }] }) }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Azure_Core_Page_listWithCustomPageModel = passOnSuccess({ - uri: "/azure/core/page/custom-page", - method: "get", - request: {}, - response: { status: 200, body: json({ items: [validUser] }) }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_Core_Page_withParameterizedNextLink = passOnSuccess([ - { - // First page request - uri: "/azure/core/page/with-parameterized-next-link", - method: "get", - request: { - query: { - includePending: true, - select: "name", - }, - }, - response: { - status: 200, - body: json({ - values: [{ id: 1, name: "User1" }], - nextLink: dyn`${dynItem("baseUrl")}/azure/core/page/with-parameterized-next-link/second-page?select=name`, - }), - }, - kind: "MockApiDefinition", - }, - { - // Follow-up page request - uri: "/azure/core/page/with-parameterized-next-link/second-page", - method: "get", - request: { - query: { - includePending: true, - select: "name", - }, - }, - response: { - status: 200, - body: json({ - values: [{ id: 2, name: "User2" }], - }), - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/main.tsp deleted file mode 100644 index cc6ef505971..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/main.tsp +++ /dev/null @@ -1,94 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; -import "@azure-tools/typespec-azure-core"; -import "@typespec/versioning"; - -using TypeSpec.Http; -using global.Azure.ClientGenerator.Core; -using global.Azure.Core; -using TypeSpec.Versioning; -using Spector; - -@scenarioService( - "/azure/core/scalar", - { - versioned: Versions, - } -) -@global.Azure.ClientGenerator.Core.clientNamespace("azure.core.scalar", "java") -namespace _Specs_.Azure.Core.Scalar; -@doc("The version of the API.") -enum Versions { - @doc("The version 2022-12-01-preview.") - v2022_12_01_preview: "2022-12-01-preview", -} -model AzureLocationModel { - location: azureLocation; -} - -@operationGroup -@route("/azureLocation") -interface AzureLocationScalar { - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to handle a azureLocation value. Mock api will return 'eastus'") - @get - @doc("get azureLocation value") - get(): { - @header contentType: "application/json"; - @body body: azureLocation; - }; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to send a azureLocation value. Mock api expect to receive 'eastus'") - @put - @doc("put azureLocation value") - put(@header contentType: "application/json", @body @doc("_") body: azureLocation): void; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc(""" - Expect to send a model which has an azureLocation property. - - Expected request body: - ```json - {"location": "eastus"} - ``` - - Expected response body: - ```json - {"location": "eastus"} - ``` - """) - @scenarioDoc("Expect to send a model who has an azureLocation property. Mock api expect to receive '{location: eastus}'") - @post - @doc("post a model which has azureLocation property") - post( - @header contentType: "application/json", - @body @doc("_") body: AzureLocationModel, - ): AzureLocationModel; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc(""" - Expect to send a azureLocation value as header. - Expected header parameter: `region="eastus"` - """) - @post - @route("/header") - @doc("azureLocation value header") - header(@header @doc("_") region: azureLocation): void; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc(""" - Expect to send a azureLocation value as query. - Expected query parameter: `region="eastus"` - """) - @post - @doc("azureLocation value query") - @route("/query") - query(@query @doc("_") region: azureLocation): void; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/mockapi.ts deleted file mode 100644 index 19a3f8c6183..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/scalar/mockapi.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -// string value -Scenarios.Azure_Core_Scalar_AzureLocationScalar_get = passOnSuccess({ - uri: "/azure/core/scalar/azureLocation", - method: "get", - request: {}, - response: { status: 200, body: json("eastus") }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_Core_Scalar_AzureLocationScalar_put = passOnSuccess({ - uri: "/azure/core/scalar/azureLocation", - method: "put", - request: { - body: json("eastus"), - }, - response: { status: 204 }, - kind: "MockApiDefinition", -}); - -const azureLocation = { location: "eastus" }; -Scenarios.Azure_Core_Scalar_AzureLocationScalar_post = passOnSuccess({ - uri: "/azure/core/scalar/azureLocation", - method: "post", - request: { body: json(azureLocation) }, - response: { status: 200, body: json(azureLocation) }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_Core_Scalar_AzureLocationScalar_header = passOnSuccess({ - uri: "/azure/core/scalar/azureLocation/header", - method: "post", - request: { - headers: { - region: "eastus", - }, - }, - response: { status: 204 }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_Core_Scalar_AzureLocationScalar_query = passOnSuccess({ - uri: "/azure/core/scalar/azureLocation/query", - method: "post", - request: { - query: { - region: "eastus", - }, - }, - response: { status: 204 }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/main.tsp deleted file mode 100644 index a99a83023b9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/main.tsp +++ /dev/null @@ -1,142 +0,0 @@ -import "@azure-tools/typespec-azure-core"; -import "@typespec/spector"; -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-client-generator-core"; - -using global.Azure.Core; -using global.Azure.Core.Traits; -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using Spector; - -#suppress "@azure-tools/typespec-azure-core/casing-style" "For spec" -@doc("Illustrates Azure Core operation customizations by traits") -@scenarioService( - "/azure/core/traits", - { - versioned: Versions, - } -) -@versioned(Versions) -@global.Azure.ClientGenerator.Core.clientNamespace("azure.core.traits", "java") -namespace _Specs_.Azure.Core.Traits; - -@doc("Service versions") -enum Versions { - @doc("2022-12-01-preview") - v2022_12_01_preview: "2022-12-01-preview", -} - -alias SmokeOperationsWithTraits = global.Azure.Core.ResourceOperations; - -alias RepeatableOperationsWithTraits = global.Azure.Core.ResourceOperations; - -@doc("Sample Model") -@resource("user") -model User { - @key - @doc("The user's id.") - @visibility(Lifecycle.Read) - id: int32; - - @doc("The user's name.") - name?: string; -} - -@scenario -@doc("Get a resource, sending and receiving headers.") -@scenarioDoc(""" - SDK should not genreate `clientRequestId` paramerter but use policy to auto-set the header. - Expected path parameter: id=1 - Expected query parameter: api-version=2022-12-01-preview - Expected header parameters: - - foo=123 - - if-match=valid - - if-none-match=invalid - - if-unmodified-since=Fri, 26 Aug 2022 14:38:00 GMT - - if-modified-since=Thu, 26 Aug 2021 14:38:00 GMT - - x-ms-client-request-id= - - Expected response header: - - bar="456" - - x-ms-client-request-id= - - etag="11bdc430-65e8-45ad-81d9-8ffa60d55b59" - - Expected response body: - ```json - { - "id": 1, - "name": "Madge" - } - ``` - """) -op smokeTest is SmokeOperationsWithTraits.ResourceRead< - User, - RequestHeadersTrait<{ - @doc("header in request") - @header - foo: string; - }> & - ResponseHeadersTrait<{ - @header bar: string; - }> ->; - -@doc("User action param") -model UserActionParam { - @doc("User action value.") - userActionValue: string; -} - -@doc("User action response") -model UserActionResponse { - @doc("User action result.") - userActionResult: string; -} - -@scenario -@doc("Test for repeatable requests") -@scenarioDoc(""" - Expected path parameter: id=1 - Expected header parameters: - - repeatability-request-id= - - repeatability-first-sent= - Expected request body: - ```json - { - "userActionValue": "test" - } - ``` - - Expected response header: - - repeatability-result=accepted - Expected response body: - ```json - { - "userActionResult": "test" - } - ``` - """) -op repeatableAction is RepeatableOperationsWithTraits.ResourceAction< - User, - BodyParameter, - UserActionResponse ->; - -alias BodyParameter< - T, - TName extends valueof string = "body", - TDoc extends valueof string = "The body parameter." -> = { - @doc(TDoc) - @friendlyName(TName) - @bodyRoot - body: T; -}; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/mockapi.ts deleted file mode 100644 index e76ed359798..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/core/traits/mockapi.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { - json, - MockRequest, - passOnSuccess, - ScenarioMockApi, - validateValueFormat, - ValidationError, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const validUser = { - id: 1, - name: "Madge", -}; - -Scenarios.Azure_Core_Traits_smokeTest = passOnSuccess({ - uri: "/azure/core/traits/user/:id", - method: "get", - request: { - pathParams: { - id: "1", - }, - headers: { - foo: "123", - "If-Match": '"valid"', - "If-None-Match": '"invalid"', - "If-Modified-Since": "Thu, 26 Aug 2021 14:38:00 GMT", - "If-Unmodified-Since": "Fri, 26 Aug 2022 14:38:00 GMT", - "x-ms-client-request-id": "86aede1f-96fa-4e7f-b1e1-bf8a947cb804", - }, - }, - response: { - status: 200, - body: json(validUser), - headers: { - bar: "456", - etag: "11bdc430-65e8-45ad-81d9-8ffa60d55b59", - "x-ms-client-request-id": "86aede1f-96fa-4e7f-b1e1-bf8a947cb804", - }, - }, - handler: (req: MockRequest) => { - if (!("x-ms-client-request-id" in req.headers)) { - throw new ValidationError( - "Should submit header x-ms-client-request-id", - "any uuid", - undefined, - ); - } - if (req.params.id !== "1") { - throw new ValidationError("Expected path param id=1", "1", req.params.id); - } - req.expect.containsHeader("foo", "123"); - const if_none_match = req.headers["if-none-match"]; - const if_match = req.headers["if-match"]; - if (if_none_match !== '"invalid"' && if_match !== '"valid"') { - throw new ValidationError( - `Expected header "if-none-match" equals "invalid" but got ${if_none_match} or "if-match" equals "valid" but got ${if_match}`, - `"if-match": "valid" or "if-none-match": "invalid"`, - `"if-match": ${if_match} or "if-none-match": ${if_none_match}`, - ); - } - req.expect.containsHeader("if-unmodified-since", "Fri, 26 Aug 2022 14:38:00 GMT"); - req.expect.containsHeader("if-modified-since", "Thu, 26 Aug 2021 14:38:00 GMT"); - return { - status: 200, - body: json(validUser), - headers: { - bar: "456", - etag: "11bdc430-65e8-45ad-81d9-8ffa60d55b59", - "x-ms-client-request-id": req.headers["x-ms-client-request-id"], - }, - }; - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_Core_Traits_repeatableAction = passOnSuccess({ - uri: "/azure/core/traits/user/:id\\:repeatableAction", - method: "post", - request: { - body: json({ - userActionValue: "test", - }), - headers: { - "Repeatability-Request-ID": "86aede1f-96fa-4e7f-b1e1-bf8a947cb804", - "Repeatability-First-Sent": "Mon, 27 Nov 2023 11:58:00 GMT", - }, - pathParams: { - id: "1", - }, - }, - response: { - status: 200, - body: json({ userActionResult: "test" }), - headers: { - "repeatability-result": "accepted", - }, - }, - handler: (req: MockRequest) => { - if (req.params.id !== "1") { - throw new ValidationError("Expected path param id=1", "1", req.params.id); - } - - if (!("repeatability-request-id" in req.headers)) { - throw new ValidationError("Repeatability-Request-ID is missing", "A UUID string", undefined); - } - if (!("repeatability-first-sent" in req.headers)) { - throw new ValidationError( - "Repeatability-First-Sent is missing", - "A date-time in headers format", - undefined, - ); - } - - validateValueFormat(req.headers["repeatability-request-id"], "uuid"); - validateValueFormat(req.headers["repeatability-first-sent"], "rfc7231"); - - const validBody = { userActionValue: "test" }; - req.expect.bodyEquals(validBody); - - return { - status: 200, - body: json({ userActionResult: "test" }), - headers: { - "repeatability-result": "accepted", - }, - }; - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/main.tsp deleted file mode 100644 index 35381e467fd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/main.tsp +++ /dev/null @@ -1,33 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using global.Azure.ClientGenerator.Core; -using Spector; - -@doc("Test for azure related encode decorator.") -@scenarioService("/azure/encode/duration") -namespace _Specs_.Azure.Encode.Duration; - -@@clientNamespace(_Specs_.Azure.Encode.Duration, "azure.encode.duration", "java"); - -model DurationModel { - @encode("duration-constant") - input: duration; -} - -@scenario -@scenarioDoc(""" - Test case for azure specific encoding. SDK should generate correct serialization format according to the set encoding. - Expected request body: - ```json - { - "input": "1.02:59:59.5000000" - } - ``` - """) -@doc("Test duration with azure specific encoding.") -@put -@route("/duration-constant") -op durationConstant(@body body: DurationModel): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/mockapi.ts deleted file mode 100644 index d053fe63a5e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/encode/duration/mockapi.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Azure_Encode_Duration_durationConstant = passOnSuccess([ - { - uri: "/azure/encode/duration/duration-constant", - method: "put", - request: { - body: json({ - input: "1.02:59:59.5000000", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/client.tsp deleted file mode 100644 index 4b84ea8a42f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/client.tsp +++ /dev/null @@ -1,22 +0,0 @@ -import "@azure-tools/typespec-client-generator-core"; -import "@typespec/spector"; -import "./main.tsp"; - -using Http; -using Azure.ClientGenerator.Core; -using Spector; - -@TypeSpec.Versioning.useDependency(_Specs_.Azure.Example.Basic.Versions.v2022_12_01_preview) -@route("/azure/example/basic") -namespace AzureExampleBasicClient; - -@@clientNamespace(AzureExampleBasicClient, "azure.example.basic", "java"); -@@clientNamespace(_Specs_.Azure.Example.Basic, "azure.example.basic", "java"); - -@client({ - name: "AzureExampleClient", - service: _Specs_.Azure.Example.Basic, -}) -interface AzureExampleClient { - basicAction is _Specs_.Azure.Example.Basic.ServiceOperationGroup.basic; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/examples/2022-12-01-preview/basic.json b/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/examples/2022-12-01-preview/basic.json deleted file mode 100644 index 0583374b7cd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/examples/2022-12-01-preview/basic.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "operationId": "ServiceOperationGroup_Basic", - "title": "Basic action", - "parameters": { - "api-version": "2022-12-01-preview", - "query-param": "query", - "header-param": "header", - "body": { - "stringProperty": "text", - "modelProperty": { - "int32Property": 1, - "float32Property": 1.5, - "enumProperty": "EnumValue1" - }, - "arrayProperty": ["item"], - "recordProperty": { - "record": "value" - } - } - }, - "responses": { - "200": { - "stringProperty": "text" - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/main.tsp deleted file mode 100644 index e127430d5cc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/main.tsp +++ /dev/null @@ -1,95 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/spector"; -import "@typespec/versioning"; - -using Http; -using Rest; -using Versioning; -using Spector; - -/** Test for loading JSON example and generating sample code. */ -@scenarioService( - "/azure/example/basic", - { - versioned: Versions, - } -) -@scenario -@scenarioDoc(""" - Expected request and response is same as the JSON example at examples/2022-12-01-preview/basic.json - - When generate the code, one need to set the "examples-dir" option. - - Expected query parameter: query-param=query&api-version=2022-12-01-preview - Expected header parameter: header-param=header - - Expected input body: - ```json - { - "stringProperty": "text", - "modelProperty": { - "int32Property": 1, - "float32Property": 1.5, - "enumProperty": "EnumValue1" - }, - "arrayProperty": [ - "item" - ], - "recordProperty": { - "record": "value" - } - } - ``` - - Expected response body: - ```json - { - "stringProperty": "text" - } - ``` - """) -namespace _Specs_.Azure.Example.Basic; - -enum Versions { - v2022_12_01_preview: "2022-12-01-preview", -} - -model ApiVersionParameter { - @query("api-version") - @minLength(1) - @doc("The API version to use for this operation.") - apiVersion: string; -} - -model ActionRequest { - stringProperty: string; - modelProperty?: Model; - arrayProperty?: Array; - recordProperty?: Record; -} - -model Model { - int32Property?: int32; - float32Property?: float32; - enumProperty?: Enum; -} - -union Enum { - string, - "EnumValue1", -} - -model ActionResponse is ActionRequest; - -interface ServiceOperationGroup { - #suppress "@typespec/spector/missing-scenario" "scenario defined in client.tsp" - @route("/basic") - @post - basic( - ...ApiVersionParameter, - @query("query-param") queryParam: string, - @header("header-param") headerParam: string, - @body body: ActionRequest, - ): ActionResponse; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/mockapi.ts deleted file mode 100644 index 32b8ea97f83..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/example/basic/mockapi.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Azure_Example_Basic = passOnSuccess({ - uri: "/azure/example/basic/basic", - method: "post", - request: { - query: { - "api-version": "2022-12-01-preview", - "query-param": "query", - }, - headers: { - "header-param": "header", - }, - body: json({ - stringProperty: "text", - modelProperty: { - int32Property: 1, - float32Property: 1.5, - enumProperty: "EnumValue1", - }, - arrayProperty: ["item"], - recordProperty: { - record: "value", - }, - }), - }, - response: { - status: 200, - body: json({ - stringProperty: "text", - }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/main.tsp deleted file mode 100644 index 4845317ef26..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/main.tsp +++ /dev/null @@ -1,67 +0,0 @@ -import "@typespec/spector"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-client-generator-core"; - -using Spector; -using Versioning; -using global.Azure.Core; -using global.Azure.ClientGenerator.Core; - -@doc("Test describing pageable.") -@scenarioService("/azure/payload/pageable") -namespace _Specs_.Azure.Payload.Pageable; - -@@clientNamespace(_Specs_.Azure.Payload.Pageable, "azure.payload.pageable", "java"); - -@doc("User model") -model User { - @doc("User name") - name: string; -} - -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing pageable" -@scenario -@scenarioDoc(""" - List users. - - SDK may hide the "maxpagesize" from API signature. The functionality of "maxpagesize" could be in related language Page model. - - Expected query parameter: - maxpagesize=3 - - Expected response body: - ```json - { - "value":[ - { - "name":"user5" - }, - { - "name":"user6" - }, - { - "name":"user7" - } - ], - "nextLink": "{endpoint}/azure/payload/pageable?skipToken=name-user7&maxpagesize=3" - } - ``` - - Expected query parameter: - skipToken=name-user7 - maxpagesize=3 - - ```json - { - "value":[ - { - "name":"user8" - } - ] - } - ``` - """) -@doc("List users") -@list -op list(...MaxPageSizeQueryParameter): Page; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/mockapi.ts deleted file mode 100644 index a7cdf96462f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/payload/pageable/mockapi.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { - json, - MockRequest, - ScenarioMockApi, - ValidationError, - withServiceKeys, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function pageableHandler(req: MockRequest) { - req.expect.containsQueryParam("maxpagesize", "3"); - const skipToken = req.query["skipToken"]; - if (skipToken === undefined) { - return { - pass: "firstPage", - status: 200, - body: json({ - value: [{ name: "user5" }, { name: "user6" }, { name: "user7" }], - nextLink: `${req.baseUrl}/azure/payload/pageable?skipToken=name-user7&maxpagesize=3`, - }), - } as const; - } else if (skipToken === "name-user7") { - return { - pass: "secondPage", - status: 200, - body: json({ value: [{ name: "user8" }] }), - } as const; - } else { - throw new ValidationError( - "Unsupported skipToken query parameter", - `Not provided for first page, "name-user7" for second page`, - req.query["skipToken"], - ); - } -} - -Scenarios.Azure_Payload_Pageable_list = withServiceKeys(["firstPage", "secondPage"]).pass([ - { - uri: "/azure/payload/pageable", - method: "get", - request: { - query: { - maxpagesize: "3", - }, - }, - response: { - status: 200, - // TODO: next link not working as it should include the base url - // body: json({ - // value: [{ name: "user5" }, { name: "user6" }, { name: "user7" }], - // nextLink: `/azure/payload/pageable?skipToken=name-user7&maxpagesize=3`, - // }), - }, - handler: pageableHandler, - kind: "MockApiDefinition", - }, - { - uri: "/azure/payload/pageable", - method: "get", - request: { - query: { - maxpagesize: "3", - skipToken: "name-user7", - }, - }, - response: { - status: 200, - body: json({ value: [{ name: "user8" }] }), - }, - handler: pageableHandler, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/error.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/error.tsp deleted file mode 100644 index e7a40bb0696..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/error.tsp +++ /dev/null @@ -1,161 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using Http; -using Rest; -using Versioning; -using Azure.Core; -using Azure.ResourceManager; -using Spector; - -namespace Azure.ResourceManager.CommonProperties; - -@resource("confidentialResources") -model ConfidentialResource is TrackedResource { - ...ResourceNameParameter; -} - -@doc("Confidential Resource Properties.") -model ConfidentialResourceProperties { - @visibility(Lifecycle.Read) - @doc("The status of the last operation.") - provisioningState: string; - - username: string; -} - -/** - * Api error. - */ -model ApiError { - /** - * The Api error details - */ - details?: ApiErrorBase[]; - - /** - * The Api inner error - */ - innererror?: InnerError; - - /** - * The error code. - */ - code?: string; - - /** - * The target of the particular error. - */ - target?: string; - - /** - * The error message. - */ - message?: string; -} - -/** - * Api error base. - */ -model ApiErrorBase { - /** - * The error code. - */ - code?: string; - - /** - * The target of the particular error. - */ - target?: string; - - /** - * The error message. - */ - message?: string; -} - -/** - * Inner error details. - */ -model InnerError { - /** - * The exception type. - */ - exceptiontype?: string; - - /** - * The internal error message or exception dump. - */ - errordetail?: string; -} - -/** - * An error response. - */ -@error -model CloudError { - /** - * Api error. - */ - error?: ApiError; -} - -@armResourceOperations -interface Error { - @scenario - @scenarioDoc(""" - Resource GET operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/confidentialResources/confidential", - Expected query parameter: api-version=2023-12-01-preview - - Expected response status code: 404 - Expected response body: - ```json - { - "error": { - "code": "ResourceNotFound", - "message": "The Resource 'Azure.ResourceManager.CommonProperties/confidentialResources/confidential' under resource group 'test-rg' was not found." - } - } - ``` - """) - getForPredefinedError is ArmResourceRead; - - @scenario - @scenarioDoc(""" - Resource PUT operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/confidentialResources/confidential", - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "location": , - "properties": { - "username": "00" - } - } - ``` - - Expected response status code: 400 - Expected response body: - ```json - { - "error": { - "code": "BadRequest", - "message": "Username should not contain only numbers.", - "innererror": { - "exceptiontype": "general" - } - } - } - ``` - """) - createForUserDefinedError is ArmResourceCreateOrReplaceSync< - ConfidentialResource, - Error = CloudError - >; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/main.tsp deleted file mode 100644 index c534559bd05..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/main.tsp +++ /dev/null @@ -1,25 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "./managed-identity.tsp"; -import "./error.tsp"; - -using Http; -using Rest; -using Versioning; -using Azure.Core; -using Azure.ResourceManager; - -@armProviderNamespace -@service -@versioned(Versions) -@doc("Arm Managed Identity Provider management API.") -namespace Azure.ResourceManager.CommonProperties; - -@doc("Azure API versions.") -enum Versions { - @doc("Preview API version 2023-12-01-preview.") - v2023_12_01_preview: "2023-12-01-preview", -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/managed-identity.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/managed-identity.tsp deleted file mode 100644 index 1499dfc17a1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/managed-identity.tsp +++ /dev/null @@ -1,150 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using Http; -using Rest; -using Versioning; -using Azure.Core; -using Azure.ResourceManager; -using Spector; - -namespace Azure.ResourceManager.CommonProperties; - -@resource("managedIdentityTrackedResources") -model ManagedIdentityTrackedResource - is Azure.ResourceManager.TrackedResource { - @key("managedIdentityTrackedResourceName") - @path - @segment("managedIdentityTrackedResources") - @doc("arm resource name for path") - @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") - name: string; - - ...ManagedServiceIdentityProperty; -} - -@doc("Managed Identity Arm Resource Properties.") -model ManagedIdentityTrackedResourceProperties { - @visibility(Lifecycle.Read) - @doc("The status of the last operation.") - provisioningState: string; -} - -@armResourceOperations -interface ManagedIdentity { - @scenario - @scenarioDoc(""" - Resource GET operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity", - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity", - "location": "eastus", - "tags": { - "tagKey1": "tagValue1" - }, - "identity": { - "type": "SystemAssigned", - "principalId": - "tenantId": - }, - "properties": { - "provisioningState": "Succeeded" - } - } - ``` - """) - get is ArmResourceRead; - - @scenario - @scenarioDoc(""" - Resource PUT operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity", - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "location": "eastus", - "tags": { - "tagKey1": "tagValue1" - }, - "properties": {}, - "identity": { - "type": "SystemAssigned" - } - } - ``` - Expected response body: - ```json - { - "id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity", - "location": "eastus", - "tags": { - "tagKey1": "tagValue1" - }, - "identity": { - "type": "SystemAssigned", - "principalId": , - "tenantId": - }, - "properties": { - "provisioningState": "Succeeded" - } - } - ``` - """) - createWithSystemAssigned is ArmResourceCreateOrReplaceSync; - - @scenario - @scenarioDoc(""" - Resource PATCH operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity", - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "identity": { - "type": "SystemAssigned,UserAssigned", - "userAssignedIdentities": { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {} - } - } - } - ``` - Expected response body: - ```json - { - "id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity", - "location": "eastus", - "tags": { - "tagKey1": "tagValue1" - }, - "identity": { - "type": "SystemAssigned,UserAssigned", - "userAssignedIdentities": { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": { - "principalId": , - "clientId": - }, - }, - "principalId": , - "tenantId": - }, - "properties": { - "provisioningState": "Succeeded" - } - } - ``` - """) - updateWithUserAssignedAndSystemAssigned is ArmCustomPatchSync< - ManagedIdentityTrackedResource, - ManagedIdentityTrackedResource - >; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/mockapi.ts deleted file mode 100644 index d07f6b9898f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/common-properties/mockapi.ts +++ /dev/null @@ -1,233 +0,0 @@ -import { deepEquals } from "@typespec/compiler/utils"; -import { - json, - passOnCode, - passOnSuccess, - ScenarioMockApi, - ValidationError, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const SUBSCRIPTION_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; -const PRINCIPAL_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; -const TENANT_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; -const CLIENT_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; -const LOCATION_REGION_EXPECTED = "eastus"; -const RESOURCE_GROUP_EXPECTED = "test-rg"; -const IDENTITY_TYPE_SYSTEM_ASSIGNED_EXPECTED = "SystemAssigned"; -const IDENTITY_TYPE_SYSTEM_USER_ASSIGNED_EXPECTED = "SystemAssigned,UserAssigned"; -const validSystemAssignedManagedIdentityResource = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity`, - location: `${LOCATION_REGION_EXPECTED}`, - tags: { - tagKey1: "tagValue1", - }, - identity: { - type: `${IDENTITY_TYPE_SYSTEM_ASSIGNED_EXPECTED}`, - principalId: `${PRINCIPAL_ID_EXPECTED}`, - tenantId: `${TENANT_ID_EXPECTED}`, - }, - properties: { - provisioningState: "Succeeded", - }, -}; - -const validUserAssignedAndSystemAssignedManagedIdentityResource = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/identity`, - location: `${LOCATION_REGION_EXPECTED}`, - tags: { - tagKey1: "tagValue1", - }, - identity: { - type: `${IDENTITY_TYPE_SYSTEM_USER_ASSIGNED_EXPECTED}`, - userAssignedIdentities: { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": - { - principalId: `${PRINCIPAL_ID_EXPECTED}`, - clientId: `${CLIENT_ID_EXPECTED}`, - }, - }, - principalId: `${PRINCIPAL_ID_EXPECTED}`, - tenantId: `${TENANT_ID_EXPECTED}`, - }, - properties: { - provisioningState: "Succeeded", - }, -}; - -const createExpectedIdentity = { - type: `${IDENTITY_TYPE_SYSTEM_ASSIGNED_EXPECTED}`, -}; - -const updateExpectedIdentity = { - type: `${IDENTITY_TYPE_SYSTEM_USER_ASSIGNED_EXPECTED}`, - userAssignedIdentities: { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": - {}, - }, -}; - -// managed identity tracked resource -Scenarios.Azure_ResourceManager_CommonProperties_ManagedIdentity_get = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/:managedIdentityResourceName", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - managedIdentityResourceName: "identity", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validSystemAssignedManagedIdentityResource), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_CommonProperties_ManagedIdentity_createWithSystemAssigned = - passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/:managedIdentityResourceName", - method: "put", - request: { - body: json({ - location: "eastus", - tags: { - tagKey1: "tagValue1", - }, - properties: {}, - identity: createExpectedIdentity, - }), - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - managedIdentityResourceName: "identity", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validSystemAssignedManagedIdentityResource), - }, - kind: "MockApiDefinition", - handler: (req) => { - // .NET SDK would not send "properties" property, if it is empty. - // Hence here we only verify "identity" property. - if (!deepEquals(req.body["identity"], createExpectedIdentity)) { - throw new ValidationError( - "Body should contain 'identity' property", - createExpectedIdentity, - req.body, - ); - } - return { - status: 200, - body: json(validSystemAssignedManagedIdentityResource), - }; - }, - }); - -Scenarios.Azure_ResourceManager_CommonProperties_ManagedIdentity_updateWithUserAssignedAndSystemAssigned = - passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/:managedIdentityResourceName", - method: "patch", - request: { - body: json({ - identity: updateExpectedIdentity, - }), - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - managedIdentityResourceName: "identity", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validUserAssignedAndSystemAssignedManagedIdentityResource), - }, - kind: "MockApiDefinition", - handler: (req) => { - if (!deepEquals(req.body["identity"], updateExpectedIdentity)) { - throw new ValidationError( - "Body should contain 'identity' property", - updateExpectedIdentity, - req.body, - ); - } - return { - status: 200, - body: json(validUserAssignedAndSystemAssignedManagedIdentityResource), - }; - }, - }); - -Scenarios.Azure_ResourceManager_CommonProperties_Error_getForPredefinedError = passOnCode(404, { - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.CommonProperties/confidentialResources/:resourceName", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - resourceName: "confidential", - }, - query: { - "api-version": "2023-12-01-preview", - }, - status: 404, - }, - response: { - status: 404, - body: json({ - error: { - code: "ResourceNotFound", - message: - "The Resource 'Azure.ResourceManager.CommonProperties/confidentialResources/confidential' under resource group 'test-rg' was not found.", - }, - }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_CommonProperties_Error_createForUserDefinedError = passOnCode(400, { - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.CommonProperties/confidentialResources/:resourceName", - method: "put", - request: { - body: json({ - location: "eastus", - properties: { - username: "00", - }, - }), - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - resourceName: "confidential", - }, - query: { - "api-version": "2023-12-01-preview", - }, - status: 400, - }, - response: { - status: 400, - body: json({ - error: { - code: "BadRequest", - message: "Username should not contain only numbers.", - innererror: { - exceptiontype: "general", - }, - }, - }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/main.tsp deleted file mode 100644 index 085fe16d295..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/main.tsp +++ /dev/null @@ -1,121 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@azure-tools/typespec-client-generator-core"; -import "@typespec/spector"; - -using Http; -using Rest; -using Versioning; -using Azure.Core; -using Azure.ResourceManager; -using Spector; - -@armProviderNamespace -@service -@versioned(Versions) -@doc("Arm Resource Provider management API.") -namespace Azure.ResourceManager.LargeHeader; - -@doc("Azure API versions.") -enum Versions { - @armCommonTypesVersion(CommonTypes.Versions.v5) - @doc("Preview API version 2023-12-01-preview.") - v2023_12_01_preview: "2023-12-01-preview", -} - -@resource("largeHeaders") -model LargeHeader is TrackedResource { - ...ResourceNameParameter; -} - -model LargeHeaderProperties { - @doc("The provisioning state of the resource.") - @visibility(Lifecycle.Read) - provisioningState?: string; -} - -model CancelResult { - succeeded: boolean; -} - -@armResourceOperations -interface LargeHeaders { - @scenario - @scenarioDoc(""" - Resource POST operation with long LRO headers(> 6KB + 6KB = 12KB). - To pass the test, client should accept both: - 1. Single header size that's more than 6KB. 7KB is sure to pass the test. - 2. Total headers size that's more than 12KB. 13KB is sure to pass the test. - - Service returns both Location and Azure-AsyncOperation header on initial request. - final-state-via: location - - Expected verb: POST - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.LargeHeader/largeHeaders/header1/two6k - Expected query parameter: api-version=2023-12-01-preview - Expected response status code: 202 - Expected response headers: - - Azure-AsyncOperation={endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post?userContext=<6KB-string> - - Location={endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/operations/post?userContext=<6KB-string> - Expected no response body - - Whether you do polling through AAO, Location or combined, first one will respond with provisioning state "InProgress", second one with "Succeeded". - - AAO first poll. - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post_aao?userContext=<6KB-string> - Expected status code: 200 - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post_aao?userContext=<6KB-string>", - "name": "post_aao", - "status" : "InProgress", - "startTime": "2024-11-08T01:41:53.5508583+00:00" - } - ``` - - AAO second poll. - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post_aao?userContext=<6KB-string> - Expected status code: 200 - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post_aao?userContext=<6KB-string>", - "name": "post_aao", - "status" : "Succeeded", - "startTime": "2024-11-08T01:41:53.5508583+00:00", - "endTime": "2024-11-08T01:42:41.5354192+00:00" - } - ``` - - Location first poll. - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post_location?userContext=<6KB-string> - Expected status code: 202 - Expected no response body - - Location second poll. - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.LargeHeader/locations/eastus/operations/post_location?userContext=<6KB-string> - Expected status code: 200 - Expected response body: - ```json - { - "succeeded": true - } - ``` - """) - two6k is ArmResourceActionAsync< - LargeHeader, - void, - CancelResult, - LroHeaders = ArmCombinedLroHeaders & - Azure.Core.Foundations.RetryAfterHeader, - OptionalRequestBody = true - >; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/mockapi.ts deleted file mode 100644 index 948ccabf9d2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/large-header/mockapi.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { - dyn, - dynItem, - json, - MockRequest, - passOnSuccess, - ScenarioMockApi, - ValidationError, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const SUBSCRIPTION_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; -const RESOURCE_GROUP_EXPECTED = "test-rg"; -const SIX_KB_STRING = "a".repeat(1024 * 6); -let pollCount = 0; - -Scenarios.Azure_ResourceManager_LargeHeader_LargeHeaders_two6k = passOnSuccess([ - { - // LRO POST initial request - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.LargeHeader/largeHeaders/header1/two6k", - method: "post", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 202, - headers: { - location: dyn`${dynItem("baseUrl")}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.LargeHeaders/locations/eastus/operations/post_location?userContext=${SIX_KB_STRING}`, - "azure-asyncoperation": dyn`${dynItem("baseUrl")}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.LargeHeaders/locations/eastus/operations/post_aao?userContext=${SIX_KB_STRING}`, - }, - }, - handler: (req: MockRequest) => { - pollCount = 0; - return { - status: 202, - headers: { - location: `${req.baseUrl}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.LargeHeaders/locations/eastus/operations/post_location?userContext=${SIX_KB_STRING}`, - "azure-asyncoperation": `${req.baseUrl}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.LargeHeaders/locations/eastus/operations/post_aao?userContext=${SIX_KB_STRING}`, - }, - }; - }, - kind: "MockApiDefinition", - }, - { - // LRO POST poll intermediate/get final result - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.LargeHeaders/locations/eastus/operations/:operation_name", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - operation_name: "post_aao", // operation_name can be "post_location" or "post_aao", depending on the header you choose to poll. "post_aao" here is just for passing e2e test - }, - query: { - "api-version": "2023-12-01-preview", - userContext: SIX_KB_STRING, - }, - }, - response: { - status: 200, // This is for passing e2e test. For actual status code, see "handler" definition below - }, - handler: (req: MockRequest) => { - let response; - const operation_name = req.params["operation_name"]; - if (operation_name === "post_location") { - response = - // first status will be 200, second and forward be 204 - pollCount > 0 - ? { - status: 200, - body: json({ - succeeded: true, - }), - } - : { status: 202 }; - } else if (operation_name === "post_aao") { - const aaoResponse = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.LargeHeaders/locations/eastus/operations/post_aao?userContext=${SIX_KB_STRING}`, - name: "lro_post_aao", - startTime: "2024-11-08T01:41:53.5508583+00:00", - }; - // first provisioningState will be "InProgress", second and forward be "Succeeded" - const responseBody = - pollCount > 0 - ? { - ...aaoResponse, - status: "Succeeded", - endTime: "2024-11-08T01:42:41.5354192+00:00", - } - : { ...aaoResponse, status: "InProgress" }; - - response = { - status: 200, // aao always returns 200 with response body - body: json(responseBody), - }; - } else { - throw new ValidationError( - `Unexpected lro poll operation: ${operation_name}`, - undefined, - undefined, - ); - } - - pollCount += 1; - - return response; - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/client.tsp deleted file mode 100644 index d53bc046852..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/client.tsp +++ /dev/null @@ -1,43 +0,0 @@ -import "./main.tsp"; -import "@azure-tools/typespec-client-generator-core"; - -using Azure.ClientGenerator.Core; -using Azure.ResourceManager.MethodSubscriptionId; - -// Scenario 1: Two subscription resources - move all subscriptionId parameters to method level -@@clientLocation(TwoSubscriptionResourcesMethodLevel.GetSubscriptionResource1BaseParameter.subscriptionId, - TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.get -); - -@@clientLocation(TwoSubscriptionResourcesMethodLevel.PutSubscriptionResource1BaseParameter.subscriptionId, - TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.put -); - -@@clientLocation(TwoSubscriptionResourcesMethodLevel.DeleteSubscriptionResource1BaseParameter.subscriptionId, - TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.delete -); - -@@clientLocation(TwoSubscriptionResourcesMethodLevel.GetSubscriptionResource2BaseParameter.subscriptionId, - TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.get -); - -@@clientLocation(TwoSubscriptionResourcesMethodLevel.PutSubscriptionResource2BaseParameter.subscriptionId, - TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.put -); - -@@clientLocation(TwoSubscriptionResourcesMethodLevel.DeleteSubscriptionResource2BaseParameter.subscriptionId, - TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.delete -); - -// Scenario 2: Mixed placement - only move subscriptionId for subscription resource operations to method level -@@clientLocation(MixedSubscriptionPlacement.GetSubscriptionResourceBaseParameter.subscriptionId, - MixedSubscriptionPlacement.SubscriptionResourceOperations.get -); - -@@clientLocation(MixedSubscriptionPlacement.PutSubscriptionResourceBaseParameter.subscriptionId, - MixedSubscriptionPlacement.SubscriptionResourceOperations.put -); - -@@clientLocation(MixedSubscriptionPlacement.DeleteSubscriptionResourceBaseParameter.subscriptionId, - MixedSubscriptionPlacement.SubscriptionResourceOperations.delete -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/main.tsp deleted file mode 100644 index cbdec4b1a3c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/main.tsp +++ /dev/null @@ -1,502 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/spector"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@azure-tools/typespec-client-generator-core"; - -using Rest; -using Spector; -using Versioning; -using Azure.ResourceManager.Foundations; - -@armProviderNamespace -@service -@versioned(Versions) -@doc("Test for ARM method level subscription ID parameter placement") -namespace Azure.ResourceManager.MethodSubscriptionId; - -@doc("Azure API versions.") -enum Versions { - @armCommonTypesVersion(CommonTypes.Versions.v5) - @doc("Preview API version 2023-12-01-preview.") - v2023_12_01_preview: "2023-12-01-preview", -} - -@scenario -@scenarioDoc(""" - Operations list GET operation for Azure.ResourceManager.MethodSubscriptionId. - Expected path: /providers/Azure.ResourceManager.MethodSubscriptionId/operations - Expected query parameter: api-version=2023-12-01-preview - Expected response body: - ```json - { - "value": [ - { - "name": "Azure.ResourceManager.MethodSubscriptionId/services/read", - "isDataAction": false, - "display": { - "provider": "Azure.ResourceManager.MethodSubscriptionId", - "resource": "services", - "operation": "Lists services", - "description": "Lists registered services" - } - } - ] - } - ``` - """) -interface Operations extends Azure.ResourceManager.Operations {} - -/** - * Scenario 1: Two subscription level resources with subscriptionId at method level for all operations - * - * Test that subscriptionId parameter stays at method level for all operations on subscription-scoped resources. - * - * This scenario has two subscription-level resources (SubscriptionResource1 and SubscriptionResource2) where - * the subscriptionId parameter is explicitly moved from client level to method level for all operations - * using @clientLocation decorator. - * - * Expected behavior: - * - Client should not have subscriptionId parameter in initialization - * - All operations (get, put, delete) should have subscriptionId as method-level parameter - */ -namespace TwoSubscriptionResourcesMethodLevel { - @subscriptionResource - @resource("subscriptionResource1s") - model SubscriptionResource1 is ProxyResource { - ...ResourceNameParameter; - } - - @doc("Properties of subscription resource 1.") - model SubscriptionResource1Properties { - @visibility(Lifecycle.Read) - @doc("The status of the last operation.") - provisioningState?: ResourceProvisioningState; - - @doc("The description of the resource.") - description?: string; - } - - @subscriptionResource - @resource("subscriptionResource2s") - model SubscriptionResource2 is ProxyResource { - ...ResourceNameParameter; - } - - @doc("Properties of subscription resource 2.") - model SubscriptionResource2Properties { - @visibility(Lifecycle.Read) - @doc("The status of the last operation.") - provisioningState?: ResourceProvisioningState; - - @doc("The configuration value.") - configValue?: string; - } - - // Define base parameter models to enable subscriptionId parameter access - model GetSubscriptionResource1BaseParameter - is Azure.ResourceManager.Foundations.DefaultBaseParameters; - model PutSubscriptionResource1BaseParameter - is Azure.ResourceManager.Foundations.DefaultBaseParameters; - model DeleteSubscriptionResource1BaseParameter - is Azure.ResourceManager.Foundations.DefaultBaseParameters; - - model GetSubscriptionResource2BaseParameter - is Azure.ResourceManager.Foundations.DefaultBaseParameters; - model PutSubscriptionResource2BaseParameter - is Azure.ResourceManager.Foundations.DefaultBaseParameters; - model DeleteSubscriptionResource2BaseParameter - is Azure.ResourceManager.Foundations.DefaultBaseParameters; - - @armResourceOperations - interface SubscriptionResource1Operations { - @scenario - @scenarioDoc(""" - Resource GET operation for SubscriptionResource1 with method-level subscriptionId. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/sub-resource-1 - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/sub-resource-1", - "name": "sub-resource-1", - "type": "Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s", - "properties":{ - "description": "Valid subscription resource 1", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": "2023-01-01T00:00:00.000Z", - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": "2023-01-01T00:00:00.000Z", - "lastModifiedByType": "User" - } - } - ``` - """) - get is ArmResourceRead< - SubscriptionResource1, - BaseParameters = GetSubscriptionResource1BaseParameter - >; - - @scenario - @scenarioDoc(""" - Resource PUT operation for SubscriptionResource1 with method-level subscriptionId. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/sub-resource-1 - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "properties":{ - "description": "Valid subscription resource 1" - } - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/sub-resource-1", - "name": "sub-resource-1", - "type": "Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s", - "properties":{ - "description": "Valid subscription resource 1", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": "2023-01-01T00:00:00.000Z", - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": "2023-01-01T00:00:00.000Z", - "lastModifiedByType": "User" - } - } - ``` - """) - put is ArmResourceCreateOrReplaceSync< - SubscriptionResource1, - BaseParameters = PutSubscriptionResource1BaseParameter - >; - - @scenario - @scenarioDoc(""" - Resource DELETE operation for SubscriptionResource1 with method-level subscriptionId. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/sub-resource-1 - Expected query parameter: api-version=2023-12-01-preview - Expected response status code: 204 - """) - delete is ArmResourceDeleteSync< - SubscriptionResource1, - BaseParameters = DeleteSubscriptionResource1BaseParameter - >; - } - - @armResourceOperations - interface SubscriptionResource2Operations { - @scenario - @scenarioDoc(""" - Resource GET operation for SubscriptionResource2 with method-level subscriptionId. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/sub-resource-2 - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/sub-resource-2", - "name": "sub-resource-2", - "type": "Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s", - "properties":{ - "configValue": "test-config", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": "2023-01-01T00:00:00.000Z", - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": "2023-01-01T00:00:00.000Z", - "lastModifiedByType": "User" - } - } - ``` - """) - get is ArmResourceRead< - SubscriptionResource2, - BaseParameters = GetSubscriptionResource2BaseParameter - >; - - @scenario - @scenarioDoc(""" - Resource PUT operation for SubscriptionResource2 with method-level subscriptionId. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/sub-resource-2 - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "properties":{ - "configValue": "test-config" - } - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/sub-resource-2", - "name": "sub-resource-2", - "type": "Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s", - "properties":{ - "configValue": "test-config", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": "2023-01-01T00:00:00.000Z", - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": "2023-01-01T00:00:00.000Z", - "lastModifiedByType": "User" - } - } - ``` - """) - put is ArmResourceCreateOrReplaceSync< - SubscriptionResource2, - BaseParameters = PutSubscriptionResource2BaseParameter - >; - - @scenario - @scenarioDoc(""" - Resource DELETE operation for SubscriptionResource2 with method-level subscriptionId. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/sub-resource-2 - Expected query parameter: api-version=2023-12-01-preview - Expected response status code: 204 - """) - delete is ArmResourceDeleteSync< - SubscriptionResource2, - BaseParameters = DeleteSubscriptionResource2BaseParameter - >; - } -} - -/** - * Scenario 2: One subscription level resource (method-level subscriptionId) and one resource group level resource (client-level subscriptionId) - * - * Test mixed parameter placement: subscription resource with method-level subscriptionId and resource group resource with client-level subscriptionId. - * - * This scenario has: - * 1. One subscription-level resource (SubscriptionResource) with subscriptionId moved to method level - * 2. One resource group-level resource (ResourceGroupResource) with subscriptionId staying at client level - * - * Expected behavior: - * - Client should have subscriptionId parameter in initialization (for ResourceGroupResource operations) - * - SubscriptionResource operations should have subscriptionId as method-level parameter - * - ResourceGroupResource operations should not have subscriptionId as method-level parameter (uses client-level) - */ -namespace MixedSubscriptionPlacement { - @subscriptionResource - @resource("subscriptionResources") - model SubscriptionResource is ProxyResource { - ...ResourceNameParameter; - } - - @doc("Properties of subscription resource.") - model SubscriptionResourceProperties { - @visibility(Lifecycle.Read) - @doc("The status of the last operation.") - provisioningState?: ResourceProvisioningState; - - @doc("The subscription-scoped setting.") - subscriptionSetting?: string; - } - - @resource("resourceGroupResources") - model ResourceGroupResource is TrackedResource { - ...ResourceNameParameter; - } - - @doc("Properties of resource group resource.") - model ResourceGroupResourceProperties { - @visibility(Lifecycle.Read) - @doc("The status of the last operation.") - provisioningState?: ResourceProvisioningState; - - @doc("The resource group-scoped setting.") - resourceGroupSetting?: string; - } - - // Define base parameter models only for subscription resource to enable subscriptionId parameter access - model GetSubscriptionResourceBaseParameter is DefaultBaseParameters; - model PutSubscriptionResourceBaseParameter is DefaultBaseParameters; - model DeleteSubscriptionResourceBaseParameter is DefaultBaseParameters; - - @armResourceOperations - interface SubscriptionResourceOperations { - @scenario - @scenarioDoc(""" - Resource GET operation for subscription-scoped resource with method-level subscriptionId in mixed scenario. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/sub-resource - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/sub-resource", - "name": "sub-resource", - "type": "Azure.ResourceManager.MethodSubscriptionId/subscriptionResources", - "properties":{ - "subscriptionSetting": "test-sub-setting", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": "2023-01-01T00:00:00.000Z", - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": "2023-01-01T00:00:00.000Z", - "lastModifiedByType": "User" - } - } - ``` - """) - get is ArmResourceRead< - SubscriptionResource, - BaseParameters = GetSubscriptionResourceBaseParameter - >; - - @scenario - @scenarioDoc(""" - Resource PUT operation for subscription-scoped resource with method-level subscriptionId in mixed scenario. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/sub-resource - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "properties":{ - "subscriptionSetting": "test-sub-setting" - } - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/sub-resource", - "name": "sub-resource", - "type": "Azure.ResourceManager.MethodSubscriptionId/subscriptionResources", - "properties":{ - "subscriptionSetting": "test-sub-setting", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": "2023-01-01T00:00:00.000Z", - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": "2023-01-01T00:00:00.000Z", - "lastModifiedByType": "User" - } - } - ``` - """) - put is ArmResourceCreateOrReplaceSync< - SubscriptionResource, - BaseParameters = PutSubscriptionResourceBaseParameter - >; - - @scenario - @scenarioDoc(""" - Resource DELETE operation for subscription-scoped resource with method-level subscriptionId in mixed scenario. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/sub-resource - Expected query parameter: api-version=2023-12-01-preview - Expected response status code: 204 - """) - delete is ArmResourceDeleteSync< - SubscriptionResource, - BaseParameters = DeleteSubscriptionResourceBaseParameter - >; - } - - @armResourceOperations - interface ResourceGroupResourceOperations { - @scenario - @scenarioDoc(""" - Resource GET operation for resource group-scoped resource with client-level subscriptionId in mixed scenario. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/rg-resource - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/rg-resource", - "name": "rg-resource", - "type": "Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources", - "location": "eastus", - "properties":{ - "resourceGroupSetting": "test-setting", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": "2023-01-01T00:00:00.000Z", - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": "2023-01-01T00:00:00.000Z", - "lastModifiedByType": "User" - } - } - ``` - """) - get is ArmResourceRead; - - @scenario - @scenarioDoc(""" - Resource PUT operation for resource group-scoped resource with client-level subscriptionId in mixed scenario. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/rg-resource - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "location": "eastus", - "properties":{ - "resourceGroupSetting": "test-setting" - } - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/rg-resource", - "name": "rg-resource", - "type": "Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources", - "location": "eastus", - "properties":{ - "resourceGroupSetting": "test-setting", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": "2023-01-01T00:00:00.000Z", - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": "2023-01-01T00:00:00.000Z", - "lastModifiedByType": "User" - } - } - ``` - """) - put is ArmResourceCreateOrReplaceSync; - - @scenario - @scenarioDoc(""" - Resource DELETE operation for resource group-scoped resource with client-level subscriptionId in mixed scenario. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/rg-resource - Expected query parameter: api-version=2023-12-01-preview - Expected response status code: 204 - """) - delete is ArmResourceDeleteSync; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/mockapi.ts deleted file mode 100644 index 22d4c8aca01..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/method-subscription-id/mockapi.ts +++ /dev/null @@ -1,238 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const SUBSCRIPTION_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; -const RESOURCE_GROUP_EXPECTED = "test-rg"; -const LOCATION_EXPECTED = "eastus"; -const API_VERSION = "2023-12-01-preview"; - -// Resource objects -const validSubscriptionResource1 = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/sub-resource-1`, - name: "sub-resource-1", - type: "Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s", - properties: { - provisioningState: "Succeeded", - description: "Valid subscription resource 1", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2023-01-01T00:00:00.000Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2023-01-01T00:00:00.000Z", - lastModifiedByType: "User", - }, -}; - -const validSubscriptionResource2 = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/sub-resource-2`, - name: "sub-resource-2", - type: "Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s", - properties: { - provisioningState: "Succeeded", - configValue: "test-config", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2023-01-01T00:00:00.000Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2023-01-01T00:00:00.000Z", - lastModifiedByType: "User", - }, -}; - -const validMixedSubscriptionResource = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/sub-resource`, - name: "sub-resource", - type: "Azure.ResourceManager.MethodSubscriptionId/subscriptionResources", - properties: { - provisioningState: "Succeeded", - subscriptionSetting: "test-sub-setting", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2023-01-01T00:00:00.000Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2023-01-01T00:00:00.000Z", - lastModifiedByType: "User", - }, -}; - -const validResourceGroupResource = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/rg-resource`, - name: "rg-resource", - type: "Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources", - location: LOCATION_EXPECTED, - properties: { - provisioningState: "Succeeded", - resourceGroupSetting: "test-setting", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2023-01-01T00:00:00.000Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2023-01-01T00:00:00.000Z", - lastModifiedByType: "User", - }, -}; - -// Helper function to create resource operations -function createResourceOperations( - resourceTypePattern: string, - resourceName: string, - resourceObject: any, - requestBody: any, - isResourceGroupScoped = false, -) { - const baseUri = isResourceGroupScoped - ? `/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Azure.ResourceManager.MethodSubscriptionId/${resourceTypePattern}` - : `/subscriptions/:subscriptionId/providers/Azure.ResourceManager.MethodSubscriptionId/${resourceTypePattern}`; - - const basePathParams = isResourceGroupScoped - ? { subscriptionId: SUBSCRIPTION_ID_EXPECTED, resourceGroupName: RESOURCE_GROUP_EXPECTED } - : { subscriptionId: SUBSCRIPTION_ID_EXPECTED }; - - return { - get: { - uri: `${baseUri}/:name`, - method: "get" as const, - request: { - pathParams: { ...basePathParams, name: resourceName }, - query: { "api-version": API_VERSION }, - }, - response: { - status: 200, - body: json(resourceObject), - }, - kind: "MockApiDefinition" as const, - }, - put: { - uri: `${baseUri}/:name`, - method: "put" as const, - request: { - body: json(requestBody), - pathParams: { ...basePathParams, name: resourceName }, - query: { "api-version": API_VERSION }, - }, - response: { - status: 200, - body: json(resourceObject), - }, - kind: "MockApiDefinition" as const, - }, - delete: { - uri: `${baseUri}/:name`, - method: "delete" as const, - request: { - pathParams: { ...basePathParams, name: resourceName }, - query: { "api-version": API_VERSION }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition" as const, - }, - }; -} - -// Resource operations using helper function -const subscriptionResource1Ops = createResourceOperations( - "subscriptionResource1s", - "sub-resource-1", - validSubscriptionResource1, - { properties: { description: "Valid subscription resource 1" } }, -); - -const subscriptionResource2Ops = createResourceOperations( - "subscriptionResource2s", - "sub-resource-2", - validSubscriptionResource2, - { properties: { configValue: "test-config" } }, -); - -const mixedSubscriptionResourceOps = createResourceOperations( - "subscriptionResources", - "sub-resource", - validMixedSubscriptionResource, - { properties: { subscriptionSetting: "test-sub-setting" } }, -); - -const resourceGroupResourceOps = createResourceOperations( - "resourceGroupResources", - "rg-resource", - validResourceGroupResource, - { - location: LOCATION_EXPECTED, - properties: { resourceGroupSetting: "test-setting" }, - }, - true, -); - -// Operations scenario -Scenarios.Azure_ResourceManager_MethodSubscriptionId_Operations = passOnSuccess({ - uri: "/providers/Azure.ResourceManager.MethodSubscriptionId/operations", - method: "get" as const, - request: { - query: { "api-version": API_VERSION }, - }, - response: { - status: 200, - body: json({ - value: [ - { - name: "Azure.ResourceManager.MethodSubscriptionId/services/read", - isDataAction: false, - display: { - provider: "Azure.ResourceManager.MethodSubscriptionId", - resource: "services", - operation: "Lists services", - description: "Lists registered services", - }, - }, - ], - }), - }, - kind: "MockApiDefinition" as const, -}); - -// Scenario assignments -Scenarios.Azure_ResourceManager_MethodSubscriptionId_TwoSubscriptionResourcesMethodLevel_SubscriptionResource1Operations_get = - passOnSuccess(subscriptionResource1Ops.get); - -Scenarios.Azure_ResourceManager_MethodSubscriptionId_TwoSubscriptionResourcesMethodLevel_SubscriptionResource1Operations_put = - passOnSuccess(subscriptionResource1Ops.put); - -Scenarios.Azure_ResourceManager_MethodSubscriptionId_TwoSubscriptionResourcesMethodLevel_SubscriptionResource1Operations_delete = - passOnSuccess(subscriptionResource1Ops.delete); - -Scenarios.Azure_ResourceManager_MethodSubscriptionId_TwoSubscriptionResourcesMethodLevel_SubscriptionResource2Operations_get = - passOnSuccess(subscriptionResource2Ops.get); - -Scenarios.Azure_ResourceManager_MethodSubscriptionId_TwoSubscriptionResourcesMethodLevel_SubscriptionResource2Operations_put = - passOnSuccess(subscriptionResource2Ops.put); - -Scenarios.Azure_ResourceManager_MethodSubscriptionId_TwoSubscriptionResourcesMethodLevel_SubscriptionResource2Operations_delete = - passOnSuccess(subscriptionResource2Ops.delete); - -Scenarios.Azure_ResourceManager_MethodSubscriptionId_MixedSubscriptionPlacement_SubscriptionResourceOperations_get = - passOnSuccess(mixedSubscriptionResourceOps.get); - -Scenarios.Azure_ResourceManager_MethodSubscriptionId_MixedSubscriptionPlacement_SubscriptionResourceOperations_put = - passOnSuccess(mixedSubscriptionResourceOps.put); - -Scenarios.Azure_ResourceManager_MethodSubscriptionId_MixedSubscriptionPlacement_SubscriptionResourceOperations_delete = - passOnSuccess(mixedSubscriptionResourceOps.delete); - -Scenarios.Azure_ResourceManager_MethodSubscriptionId_MixedSubscriptionPlacement_ResourceGroupResourceOperations_get = - passOnSuccess(resourceGroupResourceOps.get); - -Scenarios.Azure_ResourceManager_MethodSubscriptionId_MixedSubscriptionPlacement_ResourceGroupResourceOperations_put = - passOnSuccess(resourceGroupResourceOps.put); - -Scenarios.Azure_ResourceManager_MethodSubscriptionId_MixedSubscriptionPlacement_ResourceGroupResourceOperations_delete = - passOnSuccess(resourceGroupResourceOps.delete); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/client.tsp deleted file mode 100644 index 7dbee9a6815..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/client.tsp +++ /dev/null @@ -1,16 +0,0 @@ -import "./service1.tsp"; -import "./service2.tsp"; -import "@azure-tools/typespec-client-generator-core"; - -using Versioning; -using Azure.Core; -using Azure.ResourceManager; -using Azure.ClientGenerator.Core; - -@client({ - service: [ - Azure.ResourceManager.MultiService.Compute, - Azure.ResourceManager.MultiService.ComputeDisk - ], -}) -namespace Azure.ResourceManager.MultiService.Combined; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/mockapi.ts deleted file mode 100644 index a7098899ddf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/mockapi.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -// Mock data for Compute (VirtualMachine) -const SUBSCRIPTION_ID = "00000000-0000-0000-0000-000000000000"; -const RESOURCE_GROUP = "test-rg"; -const LOCATION = "eastus"; - -const virtualMachine = { - id: `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Compute/virtualMachines/vm1`, - name: "vm1", - type: "Microsoft.Compute/virtualMachines", - location: LOCATION, - properties: { - provisioningState: "Succeeded", - }, -}; - -// Mock data for ComputeDisk (Disk) -const disk = { - id: `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Compute/disks/disk1`, - name: "disk1", - type: "Microsoft.Compute/disks", - location: LOCATION, - properties: { - provisioningState: "Succeeded", - }, -}; - -// Scenario: Get Virtual Machine -Scenarios.Azure_ResourceManager_MultiService_Compute_VirtualMachines_get = passOnSuccess([ - { - uri: `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Compute/virtualMachines/vm1`, - method: "get", - request: { - query: { - "api-version": "2025-04-01", - }, - }, - response: { - status: 200, - body: json(virtualMachine), - }, - kind: "MockApiDefinition", - }, -]); - -// Scenario: Create or Update Virtual Machine -Scenarios.Azure_ResourceManager_MultiService_Compute_VirtualMachines_createOrUpdate = passOnSuccess( - [ - { - uri: `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Compute/virtualMachines/vm1`, - method: "put", - request: { - query: { - "api-version": "2025-04-01", - }, - body: json({ - location: LOCATION, - properties: {}, - }), - }, - response: { - status: 200, - body: json(virtualMachine), - }, - kind: "MockApiDefinition", - }, - ], -); - -// Scenario: Get Disk -Scenarios.Azure_ResourceManager_MultiService_ComputeDisk_Disks_get = passOnSuccess([ - { - uri: `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Compute/disks/disk1`, - method: "get", - request: { - query: { - "api-version": "2025-01-02", - }, - }, - response: { - status: 200, - body: json(disk), - }, - kind: "MockApiDefinition", - }, -]); - -// Scenario: Create or Update Disk -Scenarios.Azure_ResourceManager_MultiService_ComputeDisk_Disks_createOrUpdate = passOnSuccess([ - { - uri: `/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Compute/disks/disk1`, - method: "put", - request: { - query: { - "api-version": "2025-01-02", - }, - body: json({ - location: LOCATION, - properties: {}, - }), - }, - response: { - status: 200, - body: json(disk), - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service1.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service1.tsp deleted file mode 100644 index 131c840b388..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service1.tsp +++ /dev/null @@ -1,109 +0,0 @@ -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using TypeSpec.Versioning; -using Spector; - -/** - * Compute Client - */ -@armProviderNamespace("Microsoft.Compute") -@service(#{ title: "Azure Compute resource management API." }) -@versioned(Versions) -namespace Azure.ResourceManager.MultiService.Compute; - -/** - * The available API versions. - */ -enum Versions { - /** - * The 2024-11-01 API version. - */ - @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) - v2024_11_01: "2024-11-01", - - /** - * The 2025-04-01 API version. - */ - @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) - v2025_04_01: "2025-04-01", -} - -/** - * Describes a Virtual Machine. - */ -model VirtualMachine is Azure.ResourceManager.TrackedResource { - ...ResourceNameParameter< - Resource = VirtualMachine, - KeyName = "vmName", - SegmentName = "virtualMachines", - NamePattern = "" - >; -} - -model VirtualMachineProperties { - @visibility(Lifecycle.Read) - provisioningState?: ResourceProvisioningState; -} - -@armResourceOperations -interface VirtualMachines { - /** - * Retrieves information about the model view or the instance view of a virtual machine. - */ - @scenario - @scenarioDoc(""" - Test that a client can expose operations from multiple services. This operaton should be called like this: `client.virtualMachines.get(...)`. - - GET a Virtual Machine. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/vm1 - Expected query parameter: api-version=2025-04-01 - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/vm1", - "name": "vm1", - "type": "Microsoft.Compute/virtualMachines", - "location": "eastus", - "properties": { - "provisioningState": "Succeeded" - } - } - ``` - """) - get is ArmResourceRead; - - /** - * The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. - */ - @scenario - @scenarioDoc(""" - Test that a client can expose operations from multiple services. This operaton should be called like this: `client.virtualMachines.createOrUpdate(...)`. - - PUT (create or update) a Virtual Machine. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/vm1 - Expected query parameter: api-version=2025-04-01 - Expected request body: - ```json - { - "location": "eastus", - "properties": {} - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/vm1", - "name": "vm1", - "type": "Microsoft.Compute/virtualMachines", - "location": "eastus", - "properties": { - "provisioningState": "Succeeded" - } - } - ``` - """) - createOrUpdate is ArmResourceCreateOrUpdateAsync; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service2.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service2.tsp deleted file mode 100644 index 528b78779d5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/multi-service/service2.tsp +++ /dev/null @@ -1,112 +0,0 @@ -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using TypeSpec.Versioning; -using Spector; - -/** - * Compute Client - */ -@armProviderNamespace("Microsoft.Compute") -@service(#{ title: "Azure Compute resource management API." }) -@versioned(Versions) -namespace Azure.ResourceManager.MultiService.ComputeDisk; - -/** - * The available API versions. - */ -enum Versions { - /** - * The 2024-03-02 API version. - */ - @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) - v2024_03_02: "2024-03-02", - - /** - * The 2025-01-02 API version. - */ - @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v3) - v2025_01_02: "2025-01-02", -} - -/** - * Disk resource. - */ -model Disk is Azure.ResourceManager.TrackedResource { - ...ResourceNameParameter< - Resource = Disk, - KeyName = "diskName", - SegmentName = "disks", - NamePattern = "" - >; -} - -/** - * Disk resource properties. - */ -model DiskProperties { - @visibility(Lifecycle.Read) - provisioningState?: ResourceProvisioningState; -} - -@armResourceOperations -interface Disks { - /** - * Gets information about a disk. - */ - @scenario - @scenarioDoc(""" - Test that a client can expose operations from multiple services. This operaton should be called like this: `client.disks.get(...)`. - - GET a Disk resource. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/disks/disk1 - Expected query parameter: api-version=2025-01-02 - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/disks/disk1", - "name": "disk1", - "type": "Microsoft.Compute/disks", - "location": "eastus", - "properties": { - "provisioningState": "Succeeded" - } - } - ``` - """) - get is ArmResourceRead; - - /** - * Creates or updates a disk. - */ - @scenario - @scenarioDoc(""" - Test that a client can expose operations from multiple services. This operaton should be called like this: `client.disks.createOrUpdate(...)`. - - PUT (create or update) a Disk resource. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/disks/disk1 - Expected query parameter: api-version=2025-01-02 - Expected request body: - ```json - { - "location": "eastus", - "properties": {} - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Compute/disks/disk1", - "name": "disk1", - "type": "Microsoft.Compute/disks", - "location": "eastus", - "properties": { - "provisioningState": "Succeeded" - } - } - ``` - """) - createOrUpdate is ArmResourceCreateOrUpdateAsync; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/main.tsp deleted file mode 100644 index 27fb4aa4562..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/main.tsp +++ /dev/null @@ -1,26 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@azure-tools/typespec-client-generator-core"; -import "./non-resource.tsp"; - -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.Core; -using Azure.ResourceManager; - -@armProviderNamespace -@service -@versioned(Versions) -@doc("Arm Resource Provider management API.") -namespace Azure.ResourceManager.NonResource; - -@doc("Azure API versions.") -enum Versions { - @armCommonTypesVersion(CommonTypes.Versions.v5) - @doc("Preview API version 2023-12-01-preview.") - v2023_12_01_preview: "2023-12-01-preview", -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/mockapi.ts deleted file mode 100644 index 751f22f92c6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/mockapi.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const SUBSCRIPTION_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; -const LOCATION_EXPECTED = "eastus"; - -const nonResource = { - id: "id", - name: "hello", - type: "nonResource", -}; - -Scenarios.Azure_ResourceManager_NonResource_NonResourceOperations_get = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/providers/Microsoft.NonResource/locations/:location/otherParameters/:parameter", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - location: LOCATION_EXPECTED, - parameter: "hello", - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(nonResource), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_NonResource_NonResourceOperations_create = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/providers/Microsoft.NonResource/locations/:location/otherParameters/:parameter", - method: "put", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - location: LOCATION_EXPECTED, - parameter: "hello", - "api-version": "2023-12-01-preview", - }, - body: json(nonResource), - }, - response: { - status: 200, - body: json(nonResource), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/non-resource.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/non-resource.tsp deleted file mode 100644 index 1dedd80d230..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/non-resource/non-resource.tsp +++ /dev/null @@ -1,118 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using Http; -using Spector; - -namespace Azure.ResourceManager.NonResource; - -/** - * Though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends `Resource`. - */ -model NonResource { - /** - * An id. - */ - id?: string; - - /** - * A name. - */ - name?: string; - - /** - * A type. - */ - type?: string; -} - -/** - * Operations on non resource model should not be marked as `@armResourceOperations`. - */ -interface NonResourceOperations { - @scenario - @scenarioDoc(""" - It's non-resource get operation operating on non-resource model, though the model has `id`, `name`, `type` properties. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NonResource/locations/eastus/otherParameters/hello - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "id", - "name": "hello", - "type": "nonResource" - } - ``` - """) - @route("/subscriptions/{subscriptionId}/providers/Microsoft.NonResource/locations/{location}/otherParameters/{parameter}") - @get - get( - ...ApiVersionParameter, - ...SubscriptionIdParameter, - - /** - * The location parameter. - */ - @path - location: string, - - /** - * Another parameter. - */ - @path - parameter: string, - ): ArmResponse | ErrorResponse; - - @scenario - @scenarioDoc(""" - It's non-resource put operation operating on non-resource model, though the model has `id`, `name`, `type` properties. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NonResource/locations/eastus/otherParameters/hello - Expected query parameter: api-version=2023-12-01-preview - - Expected request body: - ```json - { - "id": "id", - "name": "hello", - "type": "nonResource" - } - ``` - - Expected response body: - ```json - { - "id": "id", - "name": "hello", - "type": "nonResource" - } - ``` - """) - @route("/subscriptions/{subscriptionId}/providers/Microsoft.NonResource/locations/{location}/otherParameters/{parameter}") - @put - create( - ...ApiVersionParameter, - ...SubscriptionIdParameter, - - /** - * The location parameter. - */ - @path - location: string, - - /** - * Another parameter. - */ - @path - parameter: string, - - /** - * The request body. - */ - @body - body: NonResource, - ): ArmResponse | ErrorResponse; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/available-operations.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/available-operations.tsp deleted file mode 100644 index b1daac655b2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/available-operations.tsp +++ /dev/null @@ -1,34 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using Spector; - -namespace Azure.ResourceManager.OperationTemplates; - -@scenario("ListAvailableOperations") -@scenarioDoc(""" - Resource GET operation. - Expected path: /providers/Azure.ResourceManager.OperationTemplates/operations - Expected query parameter: api-version=2023-12-01-preview - Expected response body: - ```json - { - "value": [{ - "name": "Microsoft.Compute/virtualMachines/write", - "isDataAction": false, - "display": { - "provider": "Microsoft Compute", - "resource": "Virtual Machines", - "operation": "Create or Update Virtual Machine.", - "description": "Add or modify virtual machines.", - }, - "origin": "user,system", - "actionType": "Internal", - }] - } - ``` - """) -interface Operations extends Azure.ResourceManager.Operations {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/checkname-availability.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/checkname-availability.tsp deleted file mode 100644 index 624d7ae18b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/checkname-availability.tsp +++ /dev/null @@ -1,57 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using Spector; - -namespace Azure.ResourceManager.OperationTemplates; - -interface CheckNameAvailability { - @scenario - @scenarioDoc(""" - Resource POST operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/checkNameAvailability - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "name": "checkName", - "type": "Microsoft.Web/site" - } - ``` - Expected response body: - ```json - { - "nameAvailable": false, - "reason": "AlreadyExists", - "message": "Hostname 'checkName' already exists. Please select a different name." - } - ``` - """) - checkGlobal is checkGlobalNameAvailability; - - @scenario - @scenarioDoc(""" - Resource POST operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/westus/checkNameAvailability - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "name": "checkName", - "type": "Microsoft.Web/site", - } - ``` - Expected response body: - ```json - { - "nameAvailable": false, - "reason": "AlreadyExists", - "message": "Hostname 'checkName' already exists. Please select a different name." - } - ``` - """) - checkLocal is checkLocalNameAvailability; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/lro.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/lro.tsp deleted file mode 100644 index 6d5d6f21875..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/lro.tsp +++ /dev/null @@ -1,246 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using Rest; -using Spector; - -namespace Azure.ResourceManager.OperationTemplates; - -@resource("orders") -model Order is TrackedResource { - ...ResourceNameParameter; -} - -model OrderProperties { - @doc("The product ID of the order.") - productId: string; - - @doc("Amount of the product.") - amount: int32; - - @doc("The provisioning state of the product.") - @visibility(Lifecycle.Read) - provisioningState?: string; -} - -model ExportRequest { - @doc("Format of the exported order.") - format: string; -} - -model ExportResult { - @doc("Content of the exported order.") - content: string; -} - -@armResourceOperations -interface Lro { - @scenario - @scenarioDoc(""" - Resource PUT operation. - Service returns "Azure-AsyncOperation" on initial request. - final-state-via: Azure-AsyncOperation - - Expected verb: PUT - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1 - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "location": "eastus", - "properties": { - "productId": "product1", - "amount": 1 - } - } - ``` - Expected status code: 201 - Expected response header: Azure-AsyncOperation={endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1", - "name": "order1", - "type": "Azure.ResourceManager.Resources/orders", - "location": "eastus", - "properties": { - "productId": "product1", - "amount": 1, - "provisioningState": "InProgress" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao - - Expected status code: 200 - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao", - "name": "lro_create_aao", - "startTime": "2024-11-08T01:41:53.5508583+00:00", - "status" : "InProgress" - } - ``` - - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao - - Expected status code: 200 - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao", - "name": "lro_create_aao", - "status" : "Succeeded", - "startTime": "2024-11-08T01:41:53.5508583+00:00", - "endTime": "2024-11-08T01:42:41.5354192+00:00" - } - ``` - - Last get call on resource URL - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1 - - Expected status code: 200 - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1", - "name": "order1", - "type": "Azure.ResourceManager.Resources/orders", - "location": "eastus", - "properties": { - "productId": "product1", - "amount": 1, - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - createOrReplace is ArmResourceCreateOrReplaceAsync; - - @scenario - @scenarioDoc(""" - Resource POST operation. - Service returns both Location and Azure-AsyncOperation header on initial request. - final-state-via: location - - Expected verb: POST - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1/export - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "format": "csv" - } - ``` - Expected response status code: 202 - Expected response headers: - - Azure-AsyncOperation={endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao - - Location={endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/operations/lro_post_location - Expected no response body - - Whether you do polling through AAO, Location or combined, first one will respond with provisioning state "InProgress", second one with "Succeeded". - - AAO first poll. - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao - Expected status code: 200 - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao", - "name": "lro_post_aao", - "status" : "InProgress", - "startTime": "2024-11-08T01:41:53.5508583+00:00" - } - ``` - - AAO second poll. - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao - Expected status code: 200 - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao", - "name": "lro_post_aao", - "status" : "Succeeded", - "startTime": "2024-11-08T01:41:53.5508583+00:00", - "endTime": "2024-11-08T01:42:41.5354192+00:00" - } - ``` - - Location first poll. - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_location - Expected status code: 202 - Expected no response body - - Location second poll. - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_location - Expected status code: 200 - Expected response body: - ```json - { - "content": "order1,product1,1" - } - ``` - """) - export is ArmResourceActionAsync< - Order, - ExportRequest, - ExportResult, - LroHeaders = ArmCombinedLroHeaders & - Azure.Core.Foundations.RetryAfterHeader - >; - - @scenario - @scenarioDoc(""" - Resource DELETE operation. - Service returns both Location header on initial request. - - Expected verb: DELETE - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/orders/order1 - Expected query parameter: api-version=2023-12-01-preview - Expected response status code: 202 - Expected response header: Location={endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operationResults/lro_delete_location - Expected no response body - - Location first poll. - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operationResults/lro_delete_location - Expected status code: 202 - Expected no response body - - Location second poll. - Expected verb: GET - Expected URL: {endpoint}/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operationResults/lro_delete_location - Expected status code: 204 - Expected no response body - """) - delete is ArmResourceDeleteWithoutOkAsync; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/main.tsp deleted file mode 100644 index 58b70b79e5f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/main.tsp +++ /dev/null @@ -1,29 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@azure-tools/typespec-client-generator-core"; -import "./available-operations.tsp"; -import "./checkname-availability.tsp"; -import "./lro.tsp"; -import "./optional-body.tsp"; - -using Http; -using Rest; -using Versioning; -using Azure.Core; -using Azure.ResourceManager; - -@armProviderNamespace -@service -@versioned(Versions) -@doc("Arm Resource Provider management API.") -namespace Azure.ResourceManager.OperationTemplates; - -@doc("Azure API versions.") -enum Versions { - @armCommonTypesVersion(CommonTypes.Versions.v5) - @doc("Preview API version 2023-12-01-preview.") - v2023_12_01_preview: "2023-12-01-preview", -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/mockapi.ts deleted file mode 100644 index 5f38dbd1c77..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/mockapi.ts +++ /dev/null @@ -1,633 +0,0 @@ -import { - dyn, - dynItem, - json, - MockRequest, - passOnSuccess, - ScenarioMockApi, - ValidationError, - withServiceKeys, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const SUBSCRIPTION_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; -const RESOURCE_GROUP_EXPECTED = "test-rg"; -const validOrder = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/orders/order1`, - name: "order1", - type: "Azure.ResourceManager.Resources/orders", - location: "eastus", - properties: { - provisioningState: "Succeeded", - productId: "product1", - amount: 1, - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2024-10-04T00:56:07.442Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2024-10-04T00:56:07.442Z", - lastModifiedByType: "User", - }, -}; -const validOperation = { - name: "Microsoft.Compute/virtualMachines/write", - isDataAction: false, - display: { - provider: "Microsoft Compute", - resource: "Virtual Machines", - operation: "Create or Update Virtual Machine.", - description: "Add or modify virtual machines.", - }, - origin: "user,system", - actionType: "Internal", -}; -const checkNameAvailabilityResponse = { - nameAvailable: false, - reason: "AlreadyExists", - message: "Hostname 'checkName' already exists. Please select a different name.", -}; -let createOrReplacePollCount = 0; -let postPollCount = 0; -let deletePollCount = 0; - -// operation list -Scenarios.Azure_ResourceManager_OperationTemplates_ListAvailableOperations = passOnSuccess({ - uri: "/providers/Azure.ResourceManager.OperationTemplates/operations", - method: "get", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ - value: [validOperation], - }), - }, - kind: "MockApiDefinition", -}); - -// Check Global Name Availability -Scenarios.Azure_ResourceManager_OperationTemplates_CheckNameAvailability_checkGlobal = - passOnSuccess({ - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.OperationTemplates/checkNameAvailability", - method: "post", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - }, - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - name: "checkName", - type: "Microsoft.Web/site", - }), - }, - response: { - status: 200, - body: json(checkNameAvailabilityResponse), - }, - kind: "MockApiDefinition", - }); - -// Check Local Name Availability -Scenarios.Azure_ResourceManager_OperationTemplates_CheckNameAvailability_checkLocal = passOnSuccess( - { - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.OperationTemplates/locations/:location/checkNameAvailability", - method: "post", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - location: "westus", - }, - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - name: "checkName", - type: "Microsoft.Web/site", - }), - }, - response: { - status: 200, - body: json(checkNameAvailabilityResponse), - }, - kind: "MockApiDefinition", - }, -); - -// lro resource -Scenarios.Azure_ResourceManager_OperationTemplates_Lro_createOrReplace = passOnSuccess([ - { - // LRO PUT initial request - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/orders/:orderName", - method: "put", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - orderName: "order1", - }, - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - location: "eastus", - properties: { - productId: "product1", - amount: 1, - }, - }), - }, - response: { - status: 201, - headers: { - "azure-asyncoperation": dyn`${dynItem("baseUrl")}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao`, - }, - body: json({ - ...validOrder, - properties: { - provisioningState: "InProgress", - }, - }), - }, - handler: (req: MockRequest) => { - createOrReplacePollCount = 0; - return { - status: 201, - headers: { - "azure-asyncoperation": `${req.baseUrl}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao`, - }, - body: json({ - ...validOrder, - properties: { - provisioningState: "InProgress", - }, - }), - }; - }, - kind: "MockApiDefinition", - }, - { - // LRO PUT poll intermediate/get final result - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao`, - name: "lro_create_aao", - startTime: "2024-11-08T01:41:53.5508583+00:00", - status: "InProgress", - }), - }, - handler: (req: MockRequest) => { - const aaoResponse = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_create_aao`, - name: "lro_create_aao", - startTime: "2024-11-08T01:41:53.5508583+00:00", - }; - const response = - createOrReplacePollCount > 0 - ? { - ...aaoResponse, - status: "Succeeded", - endTime: "2024-11-08T01:42:41.5354192+00:00", - ...validOrder, - } - : { ...aaoResponse, status: "InProgress" }; - const statusCode = 200; - createOrReplacePollCount += 1; - return { - status: statusCode, - body: json(response), - }; - }, - kind: "MockApiDefinition", - }, - { - // LRO PUT get final result through initial request uri - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/orders/:orderName", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - orderName: "order1", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validOrder), - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Azure_ResourceManager_OperationTemplates_Lro_export = passOnSuccess([ - { - // LRO POST initial request - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/orders/:orderName/export", - method: "post", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - orderName: "order1", - }, - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - format: "csv", - }), - }, - response: { - status: 202, - headers: { - location: dyn`${dynItem("baseUrl")}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_location`, - "azure-asyncoperation": dyn`${dynItem("baseUrl")}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao`, - }, - }, - handler: (req: MockRequest) => { - postPollCount = 0; - return { - status: 202, - headers: { - location: `${req.baseUrl}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_location`, - "azure-asyncoperation": `${req.baseUrl}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao`, - }, - }; - }, - kind: "MockApiDefinition", - }, - { - // LRO POST poll intermediate/get final result - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/:operation_name", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - operation_name: "lro_post_aao", // operation_name can be "lro_post_location" or "lro_post_aao", depending on the header you choose to poll. "lro_post_aao" here is just for passing e2e test - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, // This is for passing e2e test. For actual status code, see "handler" definition below - }, - handler: (req: MockRequest) => { - let response; - const operation_name = req.params["operation_name"]; - if (operation_name === "lro_post_location") { - response = - // first status will be 200, second and forward be 204 - postPollCount > 0 - ? { - status: 200, - body: json({ - content: "order1,product1,1", - }), - } - : { status: 202 }; - } else if (operation_name === "lro_post_aao") { - const aaoResponse = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operations/lro_post_aao`, - name: "lro_post_aao", - startTime: "2024-11-08T01:41:53.5508583+00:00", - }; - // first provisioningState will be "InProgress", second and forward be "Succeeded" - const responseBody = - postPollCount > 0 - ? { - ...aaoResponse, - status: "Succeeded", - endTime: "2024-11-08T01:42:41.5354192+00:00", - } - : { ...aaoResponse, status: "InProgress" }; - - response = { - status: 200, // aao always returns 200 with response body - body: json(responseBody), - }; - } else { - throw new ValidationError( - `Unexpected lro poll operation: ${operation_name}`, - undefined, - undefined, - ); - } - - postPollCount += 1; - - return response; - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Azure_ResourceManager_OperationTemplates_Lro_delete = passOnSuccess([ - { - // LRO DELETE initial request - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/orders/:orderName", - method: "delete", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - orderName: "order1", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 202, - headers: { - location: dyn`${dynItem("baseUrl")}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operationResults/lro_delete_location`, - }, - }, - handler: (req: MockRequest) => { - deletePollCount = 0; - return { - status: 202, - headers: { - location: `${req.baseUrl}/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operationResults/lro_delete_location`, - }, - }; - }, - kind: "MockApiDefinition", - }, - { - // LRO DELETE poll intermediate/get final result - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.OperationTemplates/locations/eastus/operationResults/lro_delete_location", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 202, // This is for passing e2e test. For actual status code, see "handler" definition below - }, - handler: (req: MockRequest) => { - const response = - // first status will be 202, second and forward be 204 - deletePollCount > 0 ? { status: 204 } : { status: 202 }; - - deletePollCount += 1; - - return response; - }, - kind: "MockApiDefinition", - }, -]); - -// Optional Body scenarios -const validWidget = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1`, - name: "widget1", - type: "Azure.ResourceManager.OperationTemplates/widgets", - location: "eastus", - properties: { - name: "widget1", - description: "A test widget", - provisioningState: "Succeeded", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2024-10-04T00:56:07.442Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2024-10-04T00:56:07.442Z", - lastModifiedByType: "User", - }, -}; - -// GET operation -Scenarios.Azure_ResourceManager_OperationTemplates_OptionalBody_get = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/widgets/:widgetName", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - widgetName: "widget1", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validWidget), - }, - kind: "MockApiDefinition", -}); - -// PATCH operation with optional body - test both with and without body -Scenarios.Azure_ResourceManager_OperationTemplates_OptionalBody_patch = withServiceKeys([ - "EmptyBody", - "WithBody", -]).pass({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/widgets/:widgetName", - method: "patch", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - widgetName: "widget1", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - }, - handler: (req: MockRequest) => { - // Check if request has a body with content - if (req.body && Object.keys(req.body).length > 0) { - // WithBody scenario - validate and merge request body with existing widget - const requestBody = req.body as { properties?: { name?: string; description?: string } }; - - // Validate expected values - if ( - requestBody.properties?.name === "updated-widget" && - requestBody.properties?.description === "Updated description" - ) { - const updatedWidget = { - ...validWidget, - properties: { - ...validWidget.properties, - name: requestBody.properties.name, - description: requestBody.properties.description, - }, - }; - return { - pass: "WithBody", - status: 200, - body: json(updatedWidget), - }; - } else { - // Invalid request body values - return { - pass: "WithBody", - status: 400, - body: json({ - error: - "Invalid request body values. Expected properties: {name: 'updated-widget', description: 'Updated description'}", - }), - }; - } - } else { - // EmptyBody scenario - return original widget - return { - pass: "EmptyBody", - status: 200, - body: json(validWidget), - }; - } - }, - kind: "MockApiDefinition", -}); - -// POST action operation with optional body - test both with and without body -Scenarios.Azure_ResourceManager_OperationTemplates_OptionalBody_post = withServiceKeys([ - "EmptyBody", - "WithBody", -]).pass({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.OperationTemplates/widgets/:widgetName/post", - method: "post", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - widgetName: "widget1", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - }, - handler: (req: MockRequest) => { - // Check if request has a body with content - if (req.body && Object.keys(req.body).length > 0) { - // WithBody scenario - validate request body values - const requestBody = req.body as { actionType?: string; parameters?: string }; - - // Validate expected values - if (requestBody.actionType === "perform" && requestBody.parameters === "test-parameters") { - return { - pass: "WithBody", - status: 200, - body: json({ - result: "Action completed successfully with parameters", - }), - }; - } else { - // Invalid request body values - return { - pass: "WithBody", - status: 400, - body: json({ - error: - "Invalid request body values. Expected actionType: 'perform', parameters: 'test-parameters'", - }), - }; - } - } else { - // EmptyBody scenario - action completed without parameters - return { - pass: "EmptyBody", - status: 200, - body: json({ - result: "Action completed successfully", - }), - }; - } - }, - kind: "MockApiDefinition", -}); - -// Provider POST action operation with optional body - test both with and without body -Scenarios.Azure_ResourceManager_OperationTemplates_OptionalBody_providerPost = withServiceKeys([ - "EmptyBody", - "WithBody", -]).pass({ - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.OperationTemplates/providerPost", - method: "post", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - }, - handler: (req: MockRequest) => { - // Check if request has a body with content - if (req.body && Object.keys(req.body).length > 0) { - // WithBody scenario - validate request body values - const requestBody = req.body as { totalAllowed?: number; reason?: string }; - - // Validate expected values - if (requestBody.totalAllowed === 100 && requestBody.reason === "Increased demand") { - return { - pass: "WithBody", - status: 200, - body: json({ - totalAllowed: requestBody.totalAllowed, - status: "Changed to requested allowance", - }), - }; - } else { - // Invalid request body values - return { - pass: "WithBody", - status: 400, - body: json({ - error: - "Invalid request body values. Expected totalAllowed: 100, reason: 'Increased demand'", - }), - }; - } - } else { - // EmptyBody scenario - use default allowance - return { - pass: "EmptyBody", - status: 200, - body: json({ - totalAllowed: 50, - status: "Changed to default allowance", - }), - }; - } - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/optional-body.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/optional-body.tsp deleted file mode 100644 index 569f4481e27..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/operation-templates/optional-body.tsp +++ /dev/null @@ -1,228 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using Rest; -using Spector; - -namespace Azure.ResourceManager.OperationTemplates; - -@resource("widgets") -model Widget is TrackedResource { - ...ResourceNameParameter; -} - -model WidgetProperties { - @doc("The name of the widget.") - name?: string; - - @doc("The description of the widget.") - description?: string; - - @doc("The provisioning state of the widget.") - @visibility(Lifecycle.Read) - provisioningState?: string; -} - -// Request models for optional body scenarios - -model ActionRequest { - @doc("The action type to perform.") - actionType?: string; - - @doc("Additional action parameters.") - parameters?: string; -} - -model ActionResult { - @doc("The result of the action.") - result: string; -} - -model ChangeAllowanceRequest { - @doc("The new total allowed widgets.") - totalAllowed?: int32; - - @doc("The reason for the change.") - reason?: string; -} - -model ChangeAllowanceResult { - @doc("The new total allowed widgets.") - totalAllowed: int32; - - @doc("The status of the change.") - status: string; -} - -@armResourceOperations -interface OptionalBody { - @scenario - @scenarioDoc(""" - Resource GET operation to retrieve a widget. - - Expected verb: GET - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1 - Expected query parameter: api-version=2023-12-01-preview - Expected status code: 200 - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1", - "name": "widget1", - "type": "Azure.ResourceManager.OperationTemplates/widgets", - "location": "eastus", - "properties": { - "name": "widget1", - "description": "A test widget", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User" - } - } - ``` - """) - get is ArmResourceRead; - - @scenario - @scenarioDoc(""" - Resource PATCH operation using Legacy.CustomPatchSync with optional request body. - This tests the optional body functionality in two scenarios: - 1. Empty body scenario: Request body is not sent - 2. With body scenario: Request body contains update data - - Expected verb: PATCH - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1 - Expected query parameter: api-version=2023-12-01-preview - - Scenario 1 - Expected request body: None (empty body) - Scenario 2 - Expected request body: {"properties": {"name": "updated-widget", "description": "Updated description"}} - - Expected status code: 200 - Expected response body (empty body scenario): - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1", - "name": "widget1", - "type": "Azure.ResourceManager.OperationTemplates/widgets", - "location": "eastus", - "properties": { - "name": "widget1", - "description": "A test widget", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User" - } - } - ``` - - Expected response body (with body scenario): - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1", - "name": "widget1", - "type": "Azure.ResourceManager.OperationTemplates/widgets", - "location": "eastus", - "properties": { - "name": "updated-widget", - "description": "Updated description", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User" - } - } - ``` - """) - patch is Azure.ResourceManager.Legacy.CustomPatchSync; - - @scenario - @scenarioDoc(""" - Resource POST action operation using ArmResourceActionSync with optional request body. - This tests the optional body functionality in two scenarios: - 1. Empty body scenario: Request body is not sent - 2. With body scenario: Request body contains action data - - Expected verb: POST - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.OperationTemplates/widgets/widget1/post - Expected query parameter: api-version=2023-12-01-preview - - Scenario 1 - Expected request body: None (empty body) - Scenario 2 - Expected request body: {"actionType": "perform", "parameters": "test-parameters"} - - Expected status code: 200 - Expected response body (empty body scenario): - ```json - { - "result": "Action completed successfully" - } - ``` - - Expected response body (with body scenario): - ```json - { - "result": "Action completed successfully with parameters" - } - ``` - """) - post is ArmResourceActionSync; - - @scenario - @scenarioDoc(""" - Provider POST action operation using ArmProviderActionSync with optional request body. - This tests the optional body functionality for subscription-scoped provider actions in two scenarios: - 1. Empty body scenario: Request body is not sent (uses default allowance) - 2. With body scenario: Request body contains allowance change data - - Expected verb: POST - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.OperationTemplates/providerPost - Expected query parameter: api-version=2023-12-01-preview - - Scenario 1 - Expected request body: None (empty body) - Scenario 2 - Expected request body: {"totalAllowed": 100, "reason": "Increased demand"} - - Expected status code: 200 - Expected response body (empty body scenario): - ```json - { - "totalAllowed": 50, - "status": "Changed to default allowance" - } - ``` - - Expected response body (with body scenario): - ```json - { - "totalAllowed": 100, - "status": "Changed to requested allowance" - } - ``` - """) - providerPost is ArmProviderActionSync< - ChangeAllowanceRequest, - ChangeAllowanceResult, - SubscriptionActionScope, - {}, - ErrorResponse, - OptionalRequestBody = true - >; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/extension.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/extension.tsp deleted file mode 100644 index 41bb1006ad2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/extension.tsp +++ /dev/null @@ -1,554 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using Spector; - -namespace Azure.ResourceManager.Resources; - -model ExtensionsResource is ExtensionResource { - ...ResourceNameParameter; -} - -/** ExtensionsResource properties */ -model ExtensionsResourceProperties { - @doc("The description of the resource.") - description?: string; - - /** The status of the last operation. */ - @visibility(Lifecycle.Read) - provisioningState?: ProvisioningState; -} - -/** The interface of extensions resources, - * it contains 4 kinds of scopes (resource, resource group, subscription and tenant) - */ -@armResourceOperations -interface ExtensionsResources { - @scenario - @scenarioDoc(""" - This test is passed by calling the API 4 times, by providing different parameters. - Resource GET extension resource by tenant. - Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - - Resource GET extension resource by subscription. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - - Resource GET extension resource by resource group. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - - Resource GET extension resource by resource. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - get is ArmResourceRead; - - @scenario - @scenarioDoc(""" - This test is passed by calling the API 4 times, by providing different parameters. - Resource PUT extension resource by tenant. - Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - - Expected request body: - ```json - { - "properties":{ - "description": "valid", - } - } - ``` - - Expected response body: - ```json - { - "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - - Resource PUT extension resource by subscription. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - - Expected request body: - ```json - { - "properties":{ - "description": "valid", - } - } - ``` - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - - Resource PUT extension resource by resource group. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - - Expected request body: - ```json - { - "properties":{ - "description": "valid", - } - } - ``` - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - - Resource PUT extension resource by resource. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - - Expected request body: - ```json - { - "properties":{ - "description": "valid", - } - } - ``` - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - createOrUpdate is ArmResourceCreateOrReplaceAsync; - - @scenario - @scenarioDoc(""" - This test is passed by calling the API 4 times, by providing different parameters. - Resource Patch extension resource by tenant. - Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - - Expected request body: - ```json - { - "properties":{ - "description": "valid2", - } - } - ``` - - Expected response body: - ```json - { - "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid2", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - - Resource Patch extension resource by subscription. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - - Expected request body: - ```json - { - "properties":{ - "description": "valid2", - } - } - ``` - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid2", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - - Resource Patch extension resource by resource group. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - - Expected request body: - ```json - { - "properties":{ - "description": "valid2", - } - } - ``` - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid2", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - - Resource Patch extension resource by resource. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - - Expected request body: - ```json - { - "properties":{ - "description": "valid2", - } - } - ``` - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid2", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - update is ArmCustomPatchSync; - - @scenario - @scenarioDoc(""" - This test is passed by calling the API 4 times, by providing different parameters. - Resource DELETE extension resource by tenant. - Expected path: /providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - Expected response status code: 204 - - Resource DELETE extension resource by subscription. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - Expected response status code: 204 - - Resource DELETE extension resource by resource group. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - Expected response status code: 204 - - Resource DELETE extension resource by resource. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension - Expected query parameter: api-version=2023-12-01-preview - Expected response status code: 204 - """) - delete is ArmResourceDeleteSync; - - @scenario - @scenarioDoc(""" - This test is passed by calling the API 4 times, by providing different parameters. - Resource LIST extension resources by tenant. - Expected path: /providers/Azure.ResourceManager.Resources/extensionResources - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "value": [{ - "id": "/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - }] - } - ``` - - Resource LIST extension resources by subscription. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionResources - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "value": [{ - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - }] - } - ``` - - Resource LIST extension resources by resource group. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionResources - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "value": [{ - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - }] - } - ``` - - Resource LIST extension resources by resource. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionResources - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "value": [{ - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/extension", - "name": "extension", - "type": "Azure.ResourceManager.Resources/extensionsResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - }] - } - ``` - """) - listByScope is ArmResourceListByParent; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/location.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/location.tsp deleted file mode 100644 index 894c8f08013..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/location.tsp +++ /dev/null @@ -1,170 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using Rest; -using Spector; - -namespace Azure.ResourceManager.Resources; - -@resource("locationResources") -@parentResource(SubscriptionLocationResource) -model LocationResource is ProxyResource { - ...ResourceNameParameter; -} - -/** Location resource properties */ -model LocationResourceProperties { - @doc("The description of the resource.") - description?: string; - - /** The status of the last operation. */ - @visibility(Lifecycle.Read) - provisioningState?: ProvisioningState; -} - -@armResourceOperations -interface LocationResources { - @scenario - @scenarioDoc(""" - Resource GET operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", - "name": "resource", - "type": "Azure.ResourceManager.Resources/locationResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - get is ArmResourceRead; - - @scenario - @scenarioDoc(""" - Resource PUT operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource - Expected query parameter: api-version=2022-12-01-preview - Expected request body: - ```json - { - "properties": { - "description": "valid", - } - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", - "name": "resource", - "type": "Azure.ResourceManager.Resources/locationResources", - "properties": { - "description": "valid", - "provisioningState": "Succeeded", - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - createOrUpdate is ArmResourceCreateOrReplaceSync; - - @scenario - @scenarioDoc(""" - Resource PATCH operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "properties": { - "description": "valid2", - } - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", - "name": "resource", - "type": "Azure.ResourceManager.Resources/locationResources", - "properties":{ - "description": "valid2", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - update is ArmCustomPatchSync; - - @scenario - @scenarioDoc(""" - Resource DELETE operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource - Expected query parameter: api-version=2023-12-01-preview - Expected response status code: 204 - """) - delete is ArmResourceDeleteSync; - - @scenario - @scenarioDoc(""" - Resource List operation by location. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "value": [{ - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource", - "name": "resource", - "type": "Azure.ResourceManager.Resources/locationResources", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - }] - } - ``` - """) - listByLocation is ArmResourceListByParent; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/main.tsp deleted file mode 100644 index f2088bd38ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/main.tsp +++ /dev/null @@ -1,38 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@azure-tools/typespec-client-generator-core"; -import "./toplevel.tsp"; -import "./nested.tsp"; -import "./singleton.tsp"; -import "./extension.tsp"; -import "./location.tsp"; - -using Http; -using Rest; -using Versioning; -using Azure.Core; -using Azure.ResourceManager; - -@armProviderNamespace -@service -@versioned(Versions) -@doc("Arm Resource Provider management API.") -namespace Azure.ResourceManager.Resources; - -@doc("Azure API versions.") -enum Versions { - @armCommonTypesVersion(CommonTypes.Versions.v5) - @doc("Preview API version 2023-12-01-preview.") - v2023_12_01_preview: "2023-12-01-preview", -} - -union ProvisioningState { - ResourceProvisioningState, - Provisioning: "Provisioning", - Updating: "Updating", - Deleting: "Deleting", - Accepted: "Accepted", -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/mockapi.ts deleted file mode 100644 index 79067f0ff23..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/mockapi.ts +++ /dev/null @@ -1,1042 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi, ValidationError } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const SUBSCRIPTION_ID_EXPECTED = "00000000-0000-0000-0000-000000000000"; -const RESOURCE_GROUP_EXPECTED = "test-rg"; -const LOCATION_EXPECTED = "eastus"; -const SUBSCRIPTION_SCOPE_URI = `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}`; -const RESOURCE_GROUP_SCOPE_URI = `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}`; -const RESOURCE_SCOPE_URI = `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top`; -const EXTENSION_RESOURCE_NAME = "extension"; -const validTopLevelResource = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top`, - name: "top", - type: "Azure.ResourceManager.Resources/topLevelTrackedResources", - location: "eastus", - properties: { - provisioningState: "Succeeded", - description: "valid", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2024-10-04T00:56:07.442Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2024-10-04T00:56:07.442Z", - lastModifiedByType: "User", - }, -}; - -const validNestedResource = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested`, - name: "nested", - type: "Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources", - properties: { - provisioningState: "Succeeded", - description: "valid", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2024-10-04T00:56:07.442Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2024-10-04T00:56:07.442Z", - lastModifiedByType: "User", - }, -}; - -const validSingletonResource = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default`, - name: "default", - type: "Azure.ResourceManager.Resources/singletonTrackedResources", - location: "eastus", - properties: { - provisioningState: "Succeeded", - description: "valid", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2024-10-04T00:56:07.442Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2024-10-04T00:56:07.442Z", - lastModifiedByType: "User", - }, -}; - -const validLocationResource = { - id: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/locations/${LOCATION_EXPECTED}/locationResources/resource`, - name: "resource", - type: "Azure.ResourceManager.Resources/locationResources", - properties: { - description: "valid", - provisioningState: "Succeeded", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2024-10-04T00:56:07.442Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2024-10-04T00:56:07.442Z", - lastModifiedByType: "User", - }, -}; - -const validResourceGroupExtensionsResource = { - id: `${RESOURCE_GROUP_SCOPE_URI}/providers/Azure.ResourceManager.Resources/extensionsResources/extension`, - name: EXTENSION_RESOURCE_NAME, - type: "Azure.ResourceManager.Resources/extensionsResources", - properties: { - description: "valid", - provisioningState: "Succeeded", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2024-10-04T00:56:07.442Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2024-10-04T00:56:07.442Z", - lastModifiedByType: "User", - }, -}; - -const validSubscriptionExtensionsResource = { - id: `${SUBSCRIPTION_SCOPE_URI}/providers/Azure.ResourceManager.Resources/extensionsResources/extension`, - name: EXTENSION_RESOURCE_NAME, - type: "Azure.ResourceManager.Resources/extensionsResources", - properties: { - description: "valid", - provisioningState: "Succeeded", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2024-10-04T00:56:07.442Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2024-10-04T00:56:07.442Z", - lastModifiedByType: "User", - }, -}; - -const validTenantExtensionsResource = { - id: `/providers/Azure.ResourceManager.Resources/extensionsResources/extension`, - name: EXTENSION_RESOURCE_NAME, - type: "Azure.ResourceManager.Resources/extensionsResources", - properties: { - description: "valid", - provisioningState: "Succeeded", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2024-10-04T00:56:07.442Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2024-10-04T00:56:07.442Z", - lastModifiedByType: "User", - }, -}; - -const validResourceExtensionsResource = { - id: `${RESOURCE_SCOPE_URI}/providers/Azure.ResourceManager.Resources/extensionsResources/extension`, - name: EXTENSION_RESOURCE_NAME, - type: "Azure.ResourceManager.Resources/extensionsResources", - properties: { - description: "valid", - provisioningState: "Succeeded", - }, - systemData: { - createdBy: "AzureSDK", - createdByType: "User", - createdAt: "2024-10-04T00:56:07.442Z", - lastModifiedBy: "AzureSDK", - lastModifiedAt: "2024-10-04T00:56:07.442Z", - lastModifiedByType: "User", - }, -}; - -// extension tracked resource -Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_get = passOnSuccess([ - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "get", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validResourceGroupExtensionsResource), - }, - kind: "MockApiDefinition", - }, - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "get", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validSubscriptionExtensionsResource), - }, - kind: "MockApiDefinition", - }, - { - uri: `/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "get", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validTenantExtensionsResource), - }, - kind: "MockApiDefinition", - }, - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "get", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validResourceExtensionsResource), - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_createOrUpdate = passOnSuccess([ - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "put", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - properties: { - description: "valid", - }, - }), - }, - response: { - status: 200, - body: json(validResourceGroupExtensionsResource), - }, - kind: "MockApiDefinition", - }, - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "put", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - properties: { - description: "valid", - }, - }), - }, - response: { - status: 200, - body: json(validSubscriptionExtensionsResource), - }, - kind: "MockApiDefinition", - }, - { - uri: `/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "put", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - properties: { - description: "valid", - }, - }), - }, - response: { - status: 200, - body: json(validTenantExtensionsResource), - }, - kind: "MockApiDefinition", - }, - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "put", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - properties: { - description: "valid", - }, - }), - }, - response: { - status: 200, - body: json(validResourceExtensionsResource), - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_update = passOnSuccess([ - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "patch", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - properties: { - description: "valid2", - }, - }), - }, - response: { - status: 200, - body: json({ - ...validResourceGroupExtensionsResource, - properties: { - provisioningState: "Succeeded", - description: "valid2", - }, - }), - }, - kind: "MockApiDefinition", - }, - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "patch", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - properties: { - description: "valid2", - }, - }), - }, - response: { - status: 200, - body: json({ - ...validSubscriptionExtensionsResource, - properties: { - provisioningState: "Succeeded", - description: "valid2", - }, - }), - }, - kind: "MockApiDefinition", - }, - { - uri: `/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "patch", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - properties: { - description: "valid2", - }, - }), - }, - response: { - status: 200, - body: json({ - ...validTenantExtensionsResource, - properties: { - provisioningState: "Succeeded", - description: "valid2", - }, - }), - }, - kind: "MockApiDefinition", - }, - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "patch", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - properties: { - description: "valid2", - }, - }), - }, - response: { - status: 200, - body: json({ - ...validResourceExtensionsResource, - properties: { - provisioningState: "Succeeded", - description: "valid2", - }, - }), - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_delete = passOnSuccess([ - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "delete", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "delete", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: `/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "delete", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources/${EXTENSION_RESOURCE_NAME}`, - method: "delete", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Azure_ResourceManager_Resources_ExtensionsResources_listByScope = passOnSuccess([ - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources`, - method: "get", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ - value: [validResourceGroupExtensionsResource], - }), - }, - kind: "MockApiDefinition", - }, - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/providers/Azure.ResourceManager.Resources/extensionsResources`, - method: "get", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ - value: [validSubscriptionExtensionsResource], - }), - }, - kind: "MockApiDefinition", - }, - { - uri: `/providers/Azure.ResourceManager.Resources/extensionsResources`, - method: "get", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ - value: [validTenantExtensionsResource], - }), - }, - kind: "MockApiDefinition", - }, - { - uri: `/subscriptions/${SUBSCRIPTION_ID_EXPECTED}/resourceGroups/${RESOURCE_GROUP_EXPECTED}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/providers/Azure.ResourceManager.Resources/extensionsResources`, - method: "get", - request: { - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ - value: [validResourceExtensionsResource], - }), - }, - kind: "MockApiDefinition", - }, -]); - -// location resource -Scenarios.Azure_ResourceManager_Resources_LocationResources_get = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/locations/:location/locationResources/:locationResourceName", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validLocationResource), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_LocationResources_createOrUpdate = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/locations/:location/locationResources/:locationResourceName", - method: "put", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - }, - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - properties: { - description: "valid", - }, - }), - }, - response: { - status: 200, - body: json(validLocationResource), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_LocationResources_update = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/locations/:location/locationResources/:locationResourceName", - method: "patch", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - }, - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - properties: { - description: "valid2", - }, - }), - }, - response: { - status: 200, - body: json({ - ...validLocationResource, - properties: { - provisioningState: "Succeeded", - description: "valid2", - }, - }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_LocationResources_delete = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/locations/:location/locationResources/:locationResourceName", - method: "delete", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_LocationResources_listByLocation = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/locations/:location/locationResources", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - location: LOCATION_EXPECTED, - }, - query: { "api-version": "2023-12-01-preview" }, - }, - response: { - status: 200, - body: json({ - value: [validLocationResource], - }), - }, - kind: "MockApiDefinition", -}); - -// singleton tracked resource -Scenarios.Azure_ResourceManager_Resources_Singleton_getByResourceGroup = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validSingletonResource), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_Singleton_createOrUpdate = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", - method: "put", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - }, - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - location: "eastus", - properties: { - description: "valid", - }, - }), - }, - response: { - status: 200, - body: json(validSingletonResource), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_Singleton_update = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", - method: "patch", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - }, - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - properties: { - description: "valid2", - }, - }), - }, - response: { - status: 200, - body: json({ - ...validSingletonResource, - properties: { - provisioningState: "Succeeded", - description: "valid2", - }, - }), - }, - kind: "MockApiDefinition", - handler: (req) => { - if (req.body["properties"]["description"] !== "valid2") { - throw new ValidationError( - "Body should contain 'properties.description' property", - "valid2", - req.body, - ); - } - return { - status: 200, - body: json({ - ...validSingletonResource, - properties: { - provisioningState: "Succeeded", - description: "valid2", - }, - }), - }; - }, -}); - -Scenarios.Azure_ResourceManager_Resources_Singleton_listByResourceGroup = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/singletonTrackedResources", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ - value: [validSingletonResource], - }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_TopLevel_actionSync = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/actionSync", - method: "post", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - }, - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - message: "Resource action at top level.", - urgent: true, - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -// top level tracked resource -Scenarios.Azure_ResourceManager_Resources_TopLevel_get = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json(validTopLevelResource), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_TopLevel_createOrReplace = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName", - method: "put", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - }, - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - location: "eastus", - properties: { - description: "valid", - }, - }), - }, - response: { - status: 200, - body: json(validTopLevelResource), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_TopLevel_update = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName", - method: "patch", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - }, - query: { - "api-version": "2023-12-01-preview", - }, - body: json({ - properties: { - description: "valid2", - }, - }), - }, - response: { - status: 200, - body: json({ - ...validTopLevelResource, - properties: { - provisioningState: "Succeeded", - description: "valid2", - }, - }), - }, - kind: "MockApiDefinition", - handler: (req) => { - if (req.body["properties"]["description"] !== "valid2") { - throw new ValidationError( - "Body should contain 'properties.description' property", - "valid2", - req.body, - ); - } - return { - status: 200, - body: json({ - ...validTopLevelResource, - properties: { - provisioningState: "Succeeded", - description: "valid2", - }, - }), - }; - }, -}); - -Scenarios.Azure_ResourceManager_Resources_TopLevel_delete = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName", - method: "delete", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_TopLevel_listByResourceGroup = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ - value: [validTopLevelResource], - }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_TopLevel_listBySubscription = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/providers/Azure.ResourceManager.Resources/topLevelTrackedResources", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - }, - query: { "api-version": "2023-12-01-preview" }, - }, - response: { - status: 200, - body: json({ - value: [validTopLevelResource], - }), - }, - kind: "MockApiDefinition", -}); - -// nested proxy resource -Scenarios.Azure_ResourceManager_Resources_Nested_get = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/nestedProxyResources/:nestedResourceName", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - nestedResourceName: "nested", - }, - query: { "api-version": "2023-12-01-preview" }, - }, - response: { - status: 200, - body: json(validNestedResource), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_Nested_createOrReplace = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/nestedProxyResources/:nestedResourceName", - method: "put", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - nestedResourceName: "nested", - }, - query: { "api-version": "2023-12-01-preview" }, - body: json({ - properties: { - description: "valid", - }, - }), - }, - response: { - status: 200, - body: json(validNestedResource), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_Nested_update = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/nestedProxyResources/:nestedResourceName", - method: "patch", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - nestedResourceName: "nested", - }, - query: { "api-version": "2023-12-01-preview" }, - body: json({ - properties: { - description: "valid2", - }, - }), - }, - response: { - status: 200, - body: json({ - ...validNestedResource, - properties: { - provisioningState: "Succeeded", - description: "valid2", - }, - }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_Nested_delete = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/nestedProxyResources/:nestedResourceName", - method: "delete", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - nestedResourceName: "nested", - }, - query: { "api-version": "2023-12-01-preview" }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Azure_ResourceManager_Resources_Nested_listByTopLevelTrackedResource = passOnSuccess({ - uri: "/subscriptions/:subscriptionId/resourceGroups/:resourceGroup/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/:topLevelResourceName/nestedProxyResources", - method: "get", - request: { - pathParams: { - subscriptionId: SUBSCRIPTION_ID_EXPECTED, - resourceGroup: RESOURCE_GROUP_EXPECTED, - topLevelResourceName: "top", - }, - query: { - "api-version": "2023-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ - value: [validNestedResource], - }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/nested.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/nested.tsp deleted file mode 100644 index 15f203b18ed..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/nested.tsp +++ /dev/null @@ -1,177 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using Http; -using Rest; -using Spector; - -namespace Azure.ResourceManager.Resources; - -@doc("Nested child of Top Level Tracked Resource.") -@parentResource(TopLevelTrackedResource) -model NestedProxyResource is ProxyResource { - @key("nextedProxyResourceName") - @doc("Name of the nested resource.") - @visibility(Lifecycle.Read) - @path - @segment("nestedProxyResources") - @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") - name: string; -} - -@doc("Nested Proxy Resource Properties.") -model NestedProxyResourceProperties { - @visibility(Lifecycle.Read) - @doc("Provisioning State of the nested child Resource") - provisioningState?: ProvisioningState; - - @doc("Nested resource description.") - description?: string; -} - -@armResourceOperations -interface Nested { - @scenario - @scenarioDoc(""" - Resource GET operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested", - "name": "nested", - "type": "nested", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - get is ArmResourceRead; - - @scenario - @scenarioDoc(""" - Resource PUT operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "properties":{ - "description": "valid" - } - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested", - "name": "nested", - "type": "nested", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - createOrReplace is ArmResourceCreateOrReplaceAsync; - - @scenario - @scenarioDoc(""" - Resource PATCH operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "properties":{ - "description": "valid2" - } - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested", - "name": "nested", - "type": "nested", - "properties":{ - "description": "valid2", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - update is ArmCustomPatchAsync; - - @scenario - @scenarioDoc(""" - Resource DELETE operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested - Expected query parameter: api-version=2023-12-01-preview - Expected response status code: 204 - """) - delete is ArmResourceDeleteWithoutOkAsync; - - @scenario - @scenarioDoc(""" - Resource LIST by parent resource operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "value": [{ - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested", - "name": "nested", - "type": "nested", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - }] - } - ``` - """) - listByTopLevelTrackedResource is ArmResourceListByParent; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/singleton.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/singleton.tsp deleted file mode 100644 index 1ae36732406..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/singleton.tsp +++ /dev/null @@ -1,164 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using Spector; - -namespace Azure.ResourceManager.Resources; - -@singleton("default") -model SingletonTrackedResource is TrackedResource { - ...ResourceNameParameter; -} - -@doc("Singleton Arm Resource Properties.") -model SingletonTrackedResourceProperties { - @visibility(Lifecycle.Read) - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; - - @doc("The description of the resource.") - description?: string; -} - -@armResourceOperations -interface Singleton { - @scenario - @scenarioDoc(""" - Resource GET operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", - "name": "default", - "type": "Azure.ResourceManager.Resources/singletonTrackedResources", - "location": "eastus", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - getByResourceGroup is ArmResourceRead; - - @scenario - @scenarioDoc(""" - Resource PUT operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "location": "eastus", - "properties": { - "description": "valid" - } - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", - "name": "default", - "type": "Azure.ResourceManager.Resources/singletonTrackedResources", - "location": "eastus", - "properties": { - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - createOrUpdate is ArmResourceCreateOrReplaceAsync; - - @scenario - @scenarioDoc(""" - Resource PATCH operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "properties": { - "description": "valid2" - } - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", - "name": "default", - "type": "Azure.ResourceManager.Resources/singletonTrackedResources", - "location": "eastus", - "properties":{ - "description": "valid2", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - update is ArmCustomPatchSync; - - @scenario - @scenarioDoc(""" - Resource LIST by resource group operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "value": [{ - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default", - "name": "default", - "type": "Azure.ResourceManager.Resources/singletonTrackedResources", - "location": "eastus", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - }] - } - ``` - """) - listByResourceGroup is ArmResourceListByParent; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/toplevel.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/toplevel.tsp deleted file mode 100644 index bc300db74e2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/resource-manager/resources/toplevel.tsp +++ /dev/null @@ -1,237 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; -import "@typespec/spector"; - -using Http; -using Rest; -using Spector; - -namespace Azure.ResourceManager.Resources; - -@resource("topLevelTrackedResources") -model TopLevelTrackedResource is TrackedResource { - @key("topLevelTrackedResourceName") - @path - @segment("topLevelTrackedResources") - @doc("arm resource name for path") - @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") - name: string; -} - -@doc("Top Level Arm Resource Properties.") -model TopLevelTrackedResourceProperties { - @visibility(Lifecycle.Read) - @doc("The status of the last operation.") - provisioningState?: ProvisioningState; - - @doc("The description of the resource.") - description?: string; -} - -@doc("The details of a user notification.") -model NotificationDetails { - @doc("The notification message.") - message: string; - - @doc("If true, the notification is urgent.") - urgent: boolean; -} - -@armResourceOperations -interface TopLevel { - @scenario - @scenarioDoc(""" - Resource GET operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top", - "name": "top", - "type": "topLevel", - "location": "eastus", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - get is ArmResourceRead; - - @scenario - @scenarioDoc(""" - Resource PUT operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "location": "eastus", - "properties": { - "description": "valid" - } - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top", - "name": "top", - "type": "topLevel", - "location": "eastus", - "properties": { - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - createOrReplace is ArmResourceCreateOrReplaceAsync; - - @scenario - @scenarioDoc(""" - Resource PATCH operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "properties": { - "description": "valid2" - } - } - ``` - Expected response body: - ```json - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top", - "name": "top", - "type": "topLevel", - "location": "eastus", - "properties":{ - "description": "valid2", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - } - ``` - """) - update is ArmCustomPatchAsync; - - @scenario - @scenarioDoc(""" - Resource DELETE operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top - Expected query parameter: api-version=2023-12-01-preview - ``` - Expected response status code: 204 - """) - delete is ArmResourceDeleteWithoutOkAsync; - - @scenario - @scenarioDoc(""" - Resource LIST by resource group operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "value": [{ - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top", - "name": "top", - "type": "topLevel", - "location": "eastus", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - }] - } - ``` - """) - listByResourceGroup is ArmResourceListByParent; - - @scenario - @scenarioDoc(""" - Resource LIST by subscription operation. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources - Expected query parameter: api-version=2023-12-01-preview - - Expected response body: - ```json - { - "value": [{ - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top", - "name": "top", - "type": "topLevel", - "location": "eastus", - "properties":{ - "description": "valid", - "provisioningState": "Succeeded" - }, - "systemData": { - "createdBy": "AzureSDK", - "createdByType": "User", - "createdAt": , - "lastModifiedBy": "AzureSDK", - "lastModifiedAt": , - "lastModifiedByType": "User", - } - }] - } - ``` - """) - listBySubscription is ArmListBySubscription; - - @scenario - @scenarioDoc(""" - Resource sync action. - Expected path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/actionSync - Expected query parameter: api-version=2023-12-01-preview - Expected request body: - ```json - { - "message": "Resource action at top level.", - "urgent": true - } - ``` - """) - actionSync is ArmResourceActionNoContentSync; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/main.tsp deleted file mode 100644 index a381c72064c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/main.tsp +++ /dev/null @@ -1,28 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Spector; - -@doc("Azure client request id header configurations.") -@scenarioService("/azure/special-headers/x-ms-client-request-id") -@scenario -@scenarioDoc(""" - Test case for azure client request id header. SDK should not generate `clientRequestId` paramerter but use policy to auto-set the header. - Expected header parameters: - - x-ms-client-request-id= - Expected response header: - - x-ms-client-request-id= - """) -namespace Azure.SpecialHeaders.XmsClientRequestId; - -@doc(""" - Get operation with azure `x-ms-client-request-id` header. - """) -@get -@route("/") -op get( - @header("x-ms-client-request-id") - clientRequestId?: string, -): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/mockapi.ts deleted file mode 100644 index bc3f62b0f97..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/special-headers/client-request-id/mockapi.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { - MockRequest, - passOnSuccess, - ScenarioMockApi, - validateValueFormat, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Azure_SpecialHeaders_XmsClientRequestId = passOnSuccess({ - uri: "/azure/special-headers/x-ms-client-request-id", - method: "get", - request: { - headers: { - "x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000", - }, - }, - response: { - status: 204, - headers: { - "x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000", - }, - }, - handler: (req: MockRequest) => { - validateValueFormat(req.headers["x-ms-client-request-id"], "uuid"); - return { - status: 204, - headers: { - ["x-ms-client-request-id"]: req.headers["x-ms-client-request-id"], - }, - }; - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/main.tsp deleted file mode 100644 index c8e7bb8bb0e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/main.tsp +++ /dev/null @@ -1,146 +0,0 @@ -/** - * Test for @previewVersion decorator functionality - * This verifies that emitters correctly handle preview versions - */ -import "@typespec/http"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using TypeSpec.Versioning; -using Spector; -using global.Azure.Core; - -@scenarioService( - "/azure/versioning/previewVersion", - { - versioned: ApiVersions, - } -) -@global.Azure.ClientGenerator.Core.clientNamespace("azure.versioning.previewversion", "java") -namespace _Specs_.Azure.Versioning.PreviewVersion; - -@doc("Supported api versions including preview.") -enum ApiVersions { - @doc("Api version 2024-01-01.") - v2024_01_01: "2024-01-01", - - @doc("Api version 2024-06-01.") - v2024_06_01: "2024-06-01", - - @doc("Preview api version 2024-12-01-preview.") - @previewVersion - v2024_12_01_preview: "2024-12-01-preview", -} - -@doc("A simple model for testing.") -model Widget { - @doc("Widget identifier.") - id: string; - - @doc("Widget name.") - name: string; - - @doc("Widget color, only available in preview version.") - @added(ApiVersions.v2024_12_01_preview) - color?: string; -} - -@scenario -@scenarioDoc(""" - Test @previewVersion decorator with stable operations. - Should send a preview api-version and response should contain color field. - - Expected path parameter: id=widget-123 - Expected query parameter: api-version=2024-12-01-preview - - Expected response body: - ```json - { - "id": "widget-123", - "name": "Sample Widget", - "color": "blue" - } - ``` - """) -@doc("Get widget by id (available in all versions)") -@get -@route("/widgets/{id}") -op getWidget( - @path id: string, - ...global.Azure.Core.Foundations.ApiVersionParameter, -): Widget | NotFoundResponse; - -@doc("Update widget color request.") -model UpdateWidgetColorRequest { - @doc("New color for the widget.") - color: string; -} - -@scenario -@scenarioDoc(""" - Test @previewVersion decorator with preview-only operations. - Only available in preview API versions. - - Expected path parameter: id=widget-123 - Expected query parameter: api-version=2024-12-01-preview - - Expected input body: - ```json - { - "color": "red" - } - ``` - - Expected response body: - ```json - { - "id": "widget-123", - "name": "Sample Widget", - "color": "red" - } - ``` - """) -@doc("Update widget color (preview only)") -@patch(#{ implicitOptionality: true }) -@route("/widgets/{id}/color") -@added(ApiVersions.v2024_12_01_preview) -op updateWidgetColor( - @path id: string, - @header("Content-Type") contentType: "application/merge-patch+json", - @body colorUpdate: UpdateWidgetColorRequest, - ...global.Azure.Core.Foundations.ApiVersionParameter, -): Widget | NotFoundResponse; - -@scenario -@scenarioDoc(""" - Test @previewVersion decorator with version-specific query parameters. - Request should send stable api-version and response should not contain color field. - - Expected query parameter: api-version=2024-06-01 - Expected query parameter: name=test (color not available in stable version) - - Expected response body: - ```json - { - "widgets": [ - { - "id": "widget-1", - "name": "test" - } - ] - } - ``` - """) -@doc("List widgets with optional color filtering") -@get -@route("/widgets") -op listWidgets( - @query name?: string, - @query @added(ApiVersions.v2024_12_01_preview) color?: string, - ...global.Azure.Core.Foundations.ApiVersionParameter, -): { - widgets: Widget[]; -}; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/mockapi.ts deleted file mode 100644 index 6aae334d190..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/azure/versioning/previewVersion/mockapi.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -// Test @previewVersion with stable operations - should work across all versions -// Color is expected in the response because we are passing api-version "2024-12-01-preview" -Scenarios.Azure_Versioning_PreviewVersion_getWidget = passOnSuccess({ - uri: "/azure/versioning/previewVersion/widgets/:id", - method: "get", - request: { - pathParams: { - id: "widget-123", - }, - query: { - "api-version": "2024-12-01-preview", - }, - }, - response: { - status: 200, - body: json({ - id: "widget-123", - name: "Sample Widget", - color: "blue", - }), - }, - kind: "MockApiDefinition", -}); - -// Test @previewVersion with preview-only operations - only available in preview version -// This operation can be called because the request uses api-version "2024-12-01-preview" -Scenarios.Azure_Versioning_PreviewVersion_updateWidgetColor = passOnSuccess({ - uri: "/azure/versioning/previewVersion/widgets/:id/color", - method: "patch", - request: { - pathParams: { - id: "widget-123", - }, - query: { - "api-version": "2024-12-01-preview", - }, - headers: { - "Content-Type": "application/merge-patch+json", - }, - body: json({ - color: "red", - }), - }, - response: { - status: 200, - body: json({ - id: "widget-123", - name: "Sample Widget", - color: "red", - }), - }, - kind: "MockApiDefinition", -}); - -// Test @previewVersion with version-specific query parameters -// api-version "2024-06-01" is stable, so color is not expected in the response -Scenarios.Azure_Versioning_PreviewVersion_listWidgets = passOnSuccess({ - uri: "/azure/versioning/previewVersion/widgets", - method: "get", - request: { - query: { - "api-version": "2024-06-01", - name: "test", - }, - }, - response: { - status: 200, - body: json({ - widgets: [ - { - id: "widget-1", - name: "test", - }, - ], - }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/client.tsp deleted file mode 100644 index f5eb8ecd1c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/client.tsp +++ /dev/null @@ -1,31 +0,0 @@ -import "./main.tsp"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Spector; -using Azure.ClientGenerator.Core; -using Client.ClientNamespace; - -@route("/client/client-namespace") -namespace ClientNameSpaceClient; - -@client({ - name: "ClientNamespaceFirstClient", - service: Client.ClientNamespace, -}) -@clientNamespace("client.clientnamespace") -interface ClientNamespaceFirstClient { - getFirst is First.getFirst; -} -@@clientNamespace(FirstModel, "client.clientnamespace.first"); - -@client({ - name: "ClientNamespaceSecondClient", - service: Client.ClientNamespace, -}) -@clientNamespace("client.clientnamespace.second") -namespace ClientNamespaceSecondClient { - op getSecond is Second.getSecond; -} -@@clientNamespace(Second.Model, "client.clientnamespace.second"); -@@clientNamespace(Second.Model.SecondClientEnumType, "client.clientnamespace.second.sub"); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/main.tsp deleted file mode 100644 index 7bd95064f12..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/main.tsp +++ /dev/null @@ -1,51 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -/** Illustrates the clientNamespace cases. */ -@scenarioService("/client/client-namespace") -@scenario -@scenarioDoc(""" - Expected client namespace for clients: - - ClientNamespaceFirstClient: Client.ClientNamespace - - ClientNamespaceSecondClient: Client.ClientNamespace.Second - - Expected client namespace for models: - - FirstClientResult: Client.ClientNamespace.First - - SecondClientResult: Client.ClientNamespace.Second - - SecondClientEnumType: Client.ClientNamespace.Second.Sub - """) -namespace Client.ClientNamespace; - -interface First { - #suppress "@azure-tools/cadl-ranch-expect/missing-scenario" "scenario defined in client.tsp" - @route("/first") - @get - getFirst(): FirstModel.FirstClientResult; -} - -namespace FirstModel { - model FirstClientResult { - name: string; - } -} - -namespace Second { - #suppress "@azure-tools/cadl-ranch-expect/missing-scenario" "scenario defined in client.tsp" - @route("/second") - @get - op getSecond(): Model.SecondClientResult; - - namespace Model { - model SecondClientResult { - type: SecondClientEnumType; - } - - union SecondClientEnumType { - string, - Second: "second", - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/mockapi.ts deleted file mode 100644 index 60f06ee2e09..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/namespace/mockapi.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Client_ClientNamespace = passOnSuccess([ - { - uri: "/client/client-namespace/first", - method: "get", - response: { - status: 200, - body: json({ name: "first" }), - }, - kind: "MockApiDefinition", - }, - { - uri: "/client/client-namespace/second", - method: "get", - response: { - status: 200, - body: json({ type: "second" }), - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/client.tsp deleted file mode 100644 index 9d74dc29069..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/client.tsp +++ /dev/null @@ -1,9 +0,0 @@ -import "@azure-tools/typespec-client-generator-core"; -import "./main.tsp"; - -using Azure.ClientGenerator.Core; -using Client.Naming.EnumConflict; - -// Resolve enum naming conflict: Rename SecondNamespace.Status to SecondStatus -// Client should generate FirstNamespace.Status as `Status` and SecondNamespace.Status as `SecondStatus`. -@@clientName(SecondNamespace.Status, "SecondStatus"); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/main.tsp deleted file mode 100644 index c42564e807c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/main.tsp +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Test for enum with same name in different namespace - * This is valid in TypeSpec, but will cause SDK generation problem. - * For such cases, we should use client.tsp to rename one of them. - */ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Azure.ClientGenerator.Core; -using Spector; - -@doc("Test for enum with same name in different namespace.") -@scenarioService("/client/naming/enum-conflict") -namespace Client.Naming.EnumConflict; - -namespace FirstNamespace { - @doc("Status enum in first namespace") - enum Status { - @doc("Active status") - Active: "active", - - @doc("Inactive status") - Inactive: "inactive", - } - - model FirstModel { - @doc("Status from first namespace") - status: Status; - - @doc("Name of the item") - name: string; - } -} - -namespace SecondNamespace { - @doc("Status enum in second namespace") - enum Status { - @doc("Running status") - Running: "running", - - @doc("Stopped status") - Stopped: "stopped", - } - - model SecondModel { - @doc("Status from second namespace") - status: Status; - - @doc("Description of the item") - description: string; - } -} - -@operationGroup -@route("/first") -interface FirstOperations { - @scenario - @scenarioDoc(""" - Test enum with same name in different namespace - first namespace. - Expected request body: - ```json - {"status": "active", "name": "test"} - ``` - """) - @post - @doc("Operation using first namespace Status enum") - first(@body body: FirstNamespace.FirstModel): FirstNamespace.FirstModel; -} - -@operationGroup -@route("/second") -interface SecondOperations { - @scenario - @scenarioDoc(""" - Test enum with same name in different namespace - second namespace. - Expected request body: - ```json - {"status": "running", "description": "test description"} - ``` - """) - @post - @doc("Operation using second namespace Status enum") - second(@body body: SecondNamespace.SecondModel): SecondNamespace.SecondModel; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/mockapi.ts deleted file mode 100644 index 85919fa72b4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/enum-conflict/mockapi.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Client_Naming_EnumConflict_FirstOperations_first = passOnSuccess({ - uri: "/client/naming/enum-conflict/first", - method: "post", - request: { - body: json({ status: "active", name: "test" }), - }, - response: { - status: 200, - body: json({ status: "active", name: "test" }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Client_Naming_EnumConflict_SecondOperations_second = passOnSuccess({ - uri: "/client/naming/enum-conflict/second", - method: "post", - request: { - body: json({ status: "running", description: "test description" }), - }, - response: { - status: 200, - body: json({ status: "running", description: "test description" }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/main.tsp deleted file mode 100644 index b71dbafa529..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/main.tsp +++ /dev/null @@ -1,249 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Azure.ClientGenerator.Core; -using Spector; - -/** - * Describe changing names of types in a client with `@clientName` - */ -@scenarioService("/client/naming") -namespace Client.Naming; - -@route("/property") -namespace Property { - model LanguageClientNameModel { - @doc("Pass in true") - @clientName("CSName", "csharp") - @clientName("GoName", "go") - @clientName("JavaName", "java") - @clientName("TSName", "javascript") - @clientName("python_name", "python") - @clientName("rustName", "rust") - defaultName: boolean; - } - - model ClientNameModel { - @doc("Pass in true") - @clientName("clientName") - defaultName: boolean; - } - - model ClientNameAndJsonEncodedNameModel { - @doc("Pass in true") - @clientName("clientName") - @encodedName("application/json", "wireName") - defaultName: boolean; - } - - @scenario - @scenarioDoc(""" - Testing that we can project the client name in our generated SDKs. - Your generated SDK should generate ClientNameModel with one property `clientName` with wire name `defaultName`. - - Expected request body: - ```json - {"defaultName": true} - ``` - """) - @route("/client") - @post - op client(@body body: ClientNameModel): NoContentResponse; - - @scenario - @scenarioDoc(""" - Testing that we can project the language specific name in our generated SDKs. - Your generated SDK should generate LanguageClientNameModel with one property with your language specific property name and wire name `defaultName`. - - Expected request body: - ```json - {"defaultName": true} - ``` - """) - @route("/language") - @post - op language(@body body: LanguageClientNameModel): NoContentResponse; - - @scenario - @scenarioDoc(""" - Testing that we can project the client name and the wire name. - Your generated SDK should generate ClientNameAndJsonEncodedNameModel with one property with client name `clientName` and wire name `wireName`. - - Expected request body: - ```json - {"wireName": true} - ``` - """) - @route("/compatible-with-encoded-name") - @post - op compatibleWithEncodedName(@body body: ClientNameAndJsonEncodedNameModel): NoContentResponse; -} - -@scenario -@scenarioDoc(""" - Testing that we can project the operation name. - Your generated SDK should generate an operation called `clientName`. - - Expected status code: 204 - """) -@route("/operation") -@clientName("clientName") -@post -op operation(): NoContentResponse; - -@scenario -@scenarioDoc(""" - Testing that we can project a parameter name. - Your generated SDK should generate an operation `parameter` with a single parameter called `clientName`. - - Expected query parameter: `defaultName="true"` - - """) -@route("/parameter") -@post -op parameter( - @clientName("clientName") - @query - defaultName: string, -): NoContentResponse; - -@route("/header") -namespace Header { - @scenario - @scenarioDoc(""" - Testing that we can project a header name. - Your generated SDK should generate an operation header `parameter` with a single parameter called `clientName`. - - Expected header parameter: `default-name="true"` - """) - @post - op request( - @clientName("clientName") - @header - `default-name`: string, - ): void; - - @scenario - @scenarioDoc(""" - Testing that we can project a header name. - Your generated SDK should generate an operation header `parameter` with a single parameter called `clientName`. - - Expected response header: `default-name="true"` - """) - @get - op response(): { - @statusCode _: 204; - - @clientName("clientName") - @header - `default-name`: string; - }; -} - -@route("/model") -@operationGroup -@clientName("ModelClient") -namespace Model { - @clientName("CSModel", "csharp") - @clientName("GoModel", "go") - @clientName("JavaModel", "java") - @clientName("TSModel", "javascript") - @clientName("PythonModel", "python") - @clientName("rustName", "rust") - model ModelWithLanguageClientName { - @doc("Pass in true") - defaultName: boolean; - } - - @clientName("ClientModel") - model ModelWithClientClientName { - @doc("Pass in true") - defaultName: boolean; - } - - @scenario - @scenarioDoc(""" - Testing that we can project the client name in our generated SDKs. - Your generated SDK should generate the model with name `ClientModel`. - - Expected request body: - ```json - {"defaultName": true} - ``` - """) - @route("/client") - @post - op client(@bodyRoot body: ModelWithClientClientName): NoContentResponse; - - @scenario - @scenarioDoc(""" - Testing that we can project the language specific name in our generated SDKs. - Your generated SDK should generate the model with your language specific model name. - - Expected request body: - ```json - {"defaultName": true} - ``` - """) - @route("/language") - @post - op language(@bodyRoot body: ModelWithLanguageClientName): NoContentResponse; -} - -@operationGroup -@route("/union-enum") -namespace UnionEnum { - @clientName("ClientExtensibleEnum") - union ServerExtensibleEnum { - string, - EnumValue1: "value1", - } - - union ExtensibleEnum { - string, - - @clientName("ClientEnumValue1") - EnumValue1: "value1", - - @clientName("ClientEnumValue2") - "value2", - } - - @scenario - @scenarioDoc(""" - Testing that we can project a enum name and enum value name. - Your generated SDK should generate an Enum "ClientExtensibleEnum". - (The exact name may depend on language convention) - - Expected request body: - ```json - "value1" - ``` - """) - @route("/union-enum-name") - @post - op unionEnumName( - @header contentType: "application/json", - @body body: ServerExtensibleEnum, - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - Testing that we can project a enum name and enum value name. - Your generated SDK should generate an Enum with members "ClientEnumValue1", "ClientEnumValue2". - (The exact name may depend on language convention) - - Expected request body: - ```json - "value1" - ``` - """) - @route("/union-enum-member-name") - @post - op unionEnumMemberName( - @header contentType: "application/json", - @body body: ExtensibleEnum, - ): NoContentResponse; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/mockapi.ts deleted file mode 100644 index 5c88f98c8ce..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/naming/mockapi.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Client_Naming_Property_client = passOnSuccess({ - uri: "/client/naming/property/client", - method: "post", - request: { - body: json({ defaultName: true }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Client_Naming_Property_language = passOnSuccess({ - uri: "/client/naming/property/language", - method: "post", - request: { - body: json({ defaultName: true }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Client_Naming_Property_compatibleWithEncodedName = passOnSuccess({ - uri: `/client/naming/property/compatible-with-encoded-name`, - method: "post", - request: { - body: json({ wireName: true }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Client_Naming_operation = passOnSuccess({ - uri: `/client/naming/operation`, - method: "post", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Client_Naming_parameter = passOnSuccess({ - uri: `/client/naming/parameter`, - method: "post", - request: { - query: { defaultName: "true" }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Client_Naming_Header_request = passOnSuccess({ - uri: `/client/naming/header`, - method: "post", - request: { - headers: { "default-name": "true" }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Client_Naming_Header_response = passOnSuccess({ - uri: `/client/naming/header`, - method: "get", - request: {}, - response: { - status: 204, - headers: { - "default-name": "true", - }, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Client_Naming_Model_client = passOnSuccess({ - uri: `/client/naming/model/client`, - method: "post", - request: { - body: json({ defaultName: true }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Client_Naming_Model_language = passOnSuccess({ - uri: `/client/naming/model/language`, - method: "post", - request: { - body: json({ defaultName: true }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Client_Naming_UnionEnum_unionEnumName = passOnSuccess({ - uri: `/client/naming/union-enum/union-enum-name`, - method: "post", - request: { - body: json("value1"), - headers: { - "Content-Type": "text/plain", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Client_Naming_UnionEnum_unionEnumMemberName = passOnSuccess({ - uri: `/client/naming/union-enum/union-enum-member-name`, - method: "post", - request: { - body: json("value1"), - headers: { - "Content-Type": "text/plain", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/client.tsp deleted file mode 100644 index 49df6edd273..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/client.tsp +++ /dev/null @@ -1,9 +0,0 @@ -import "./main.tsp"; -import "@azure-tools/typespec-client-generator-core"; - -using Azure.ClientGenerator.Core; -using Client.Overload; - -// This creates an overload in C# where both `list()` and `list(scope)` methods exist -#suppress "@azure-tools/typespec-client-generator-core/duplicate-client-name-warning" "Intentional overload for testing method overloading in C#" -@@clientName(listByScope, "list", "csharp"); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/main.tsp deleted file mode 100644 index a38e08c52d6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/main.tsp +++ /dev/null @@ -1,50 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Spector; - -/** - * Test for overload operation in .NET. - */ -@scenarioService("/client/overload") -namespace Client.Overload; - -model Resource { - id: string; - name: string; - scope: string; -} - -#suppress "@azure-tools/typespec-client-generator-core/duplicate-client-name-warning" "Intentional overload for testing method overloading in C#" -@scenario -@scenarioDoc(""" - List all resources operation. - - Expected request: GET /client/overload/resources - Expected response body: - ```json - [ - {"id": "1", "name": "foo", "scope": "car"}, - {"id": "2", "name": "bar", "scope": "bike"} - ] - ``` - """) -@route("/resources") -op list(): Resource[]; - -@scenario -@scenarioDoc(""" - List resources by scope operation. This operation uses `@clientName("list", "csharp")` to generate it as an overload method named "list" in C# client code, demonstrating method overloading capabilities. - - Expected request: GET /client/overload/resources/car - Expected response body: - ```json - [ - {"id": "1", "name": "foo", "scope": "car"} - ] - ``` - """) -@route("/resources/{scope}") -op listByScope(@path scope: string): Resource[]; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/mockapi.ts deleted file mode 100644 index f5f21edee35..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/overload/mockapi.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Client_Overload_list = passOnSuccess({ - uri: "/client/overload/resources", - method: "get", - response: { - status: 200, - body: json([ - { id: "1", name: "foo", scope: "car" }, - { id: "2", name: "bar", scope: "bike" }, - ]), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Client_Overload_listByScope = passOnSuccess({ - uri: "/client/overload/resources/car", - method: "get", - response: { - status: 200, - body: json([{ id: "1", name: "foo", scope: "car" }]), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/client.tsp deleted file mode 100644 index a95b7aab8eb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/client.tsp +++ /dev/null @@ -1,76 +0,0 @@ -import "./main.tsp"; -import "@azure-tools/typespec-client-generator-core"; -import "@typespec/spector"; - -using Azure.ClientGenerator.Core; -using Spector; - -@scenarioDoc(""" - This is to show we can have multiple clients, with multiple operation groups in each client. - - ```ts - const client1 = new FirstClient("client-operation-group"); - - client1.one(); - - client1.group3.two(); - client1.group3.three(); - - client1.group4.four(); - ``` - """) -@scenario -@client({ - name: "FirstClient", - service: Client.Structure.Service, -}) -namespace Client.Structure.ClientOperationGroup { - op one is Client.Structure.Service.one; - - @operationGroup - interface Group3 { - two is Client.Structure.Service.two; - three is Client.Structure.Service.Foo.three; - } - - @operationGroup - interface Group4 { - four is Client.Structure.Service.Foo.four; - } -} - -@scenarioDoc(""" - This is to show we can have multiple clients, with multiple operation groups in each client. - The client and its operation groups can be moved to a sub namespace/package. - - ```ts - const client2 = new SubNamespace.SecondClient("client-operation-group"); - - client2.five(); - client2.group5.six(); - ``` - """) -@scenario -@client( - { - name: "SubNamespace.SecondClient", - service: Client.Structure.Service, - }, - "csharp,java" -) -@client( - { - name: "SecondClient", - service: Client.Structure.Service, - }, - "javascript,go,python,rust" -) -namespace Client.Structure.AnotherClientOperationGroup { - op five is Client.Structure.Service.Bar.five; - - #suppress "@azure-tools/typespec-client-generator-core/client-service" "issue https://github.com/Azure/typespec-azure/issues/1326" - @operationGroup - interface Group5 { - six is Client.Structure.Service.Bar.six; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/main.tsp deleted file mode 100644 index c57c79ee2e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/main.tsp +++ /dev/null @@ -1,5 +0,0 @@ -/** - * DO NOT GENERATE FROM THIS FILE USE client.tsp - * This is just to simulate a service entrypoint - */ -import "../common/service.tsp"; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/mockapi.ts deleted file mode 100644 index 899e029b85f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/client-operation-group/mockapi.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; -import { createServerTests } from "../common/service.js"; - -export const Scenarios: Record = {}; - -Scenarios.Client_Structure_ClientOperationGroup = passOnSuccess([ - createServerTests("/client/structure/client-operation-group/one"), - createServerTests("/client/structure/client-operation-group/two"), - createServerTests("/client/structure/client-operation-group/three"), - createServerTests("/client/structure/client-operation-group/four"), -]); - -Scenarios.Client_Structure_AnotherClientOperationGroup = passOnSuccess([ - createServerTests("/client/structure/client-operation-group/five"), - createServerTests("/client/structure/client-operation-group/six"), -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.ts deleted file mode 100644 index 854ae2a0928..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { MockApiDefinition } from "@typespec/spec-api"; - -export function createServerTests(uri: string): MockApiDefinition { - return { - uri: uri, - method: "post", - request: {}, - response: { status: 204 }, - kind: "MockApiDefinition", - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.tsp deleted file mode 100644 index 7eab0ee73f4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/common/service.tsp +++ /dev/null @@ -1,95 +0,0 @@ -import "@typespec/rest"; -import "@azure-tools/typespec-client-generator-core"; -import "@typespec/spector"; - -using Http; -using Rest; -using Azure.ClientGenerator; -using Azure.ClientGenerator.Core; - -@doc(""" - Test that we can use @client and @operationGroup decorators to customize client side code structure, such as: - 1. have everything as default. - 2. to rename client or operation group - 3. one client can have more than one operations groups - 4. split one interface into two clients - 5. have two clients with operations come from different interfaces - 6. have two clients with a hierarchy relation. - """) -@server( - "{endpoint}/client/structure/{client}", - "", - { - @doc("Need to be set as 'http://localhost:3000' in client.") - endpoint: url, - - @doc("Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client.") - client: ClientType, - } -) -@service(#{ title: "MultiClient" }) -namespace Client.Structure.Service; - -enum ClientType { - Default: "default", - MultiClient: "multi-client", - RenamedOperation: "renamed-operation", - TwoOperationGroup: "two-operation-group", - ClientOperationGroup: "client-operation-group", -} - -#suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" -@route("/one") -@post -op one(): void; - -#suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" -@route("/two") -@post -op two(): void; - -interface Foo { - #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" - @route("/three") - @post - three(): void; - - #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" - @route("/four") - @post - four(): void; -} - -interface Bar { - #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" - @route("/five") - @post - five(): void; - #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" - @route("/six") - @post - six(): void; -} - -namespace Baz { - interface Foo { - #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" - @route("/seven") - @post - seven(): void; - } -} - -namespace Qux { - #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" - @route("/eight") - @post - op eight(): void; - - interface Bar { - #suppress "@typespec/spector/missing-scenario" "This is by design those operations get defined as scenarios in the client" - @route("/nine") - @post - nine(): void; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/client.tsp deleted file mode 100644 index 871f9b725f9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/client.tsp +++ /dev/null @@ -1,24 +0,0 @@ -import "./main.tsp"; -import "@azure-tools/typespec-client-generator-core"; -import "@typespec/spector"; - -using Spector; - -@@scenario(Client.Structure.Service); -@@scenarioDoc(Client.Structure.Service, - """ - This is to show that if we don't do any customization. The client side should be able to call the api like - ```ts - const client = new ServiceClient("default"); - client.one(); - client.two(); - client.foo.three(); - client.foo.four(); - client.bar.five(); - client.bar.six(); - client.baz.foo.seven(); - client.qux.eight(); - client.qux.bar.nine(); - ``` - """ -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/main.tsp deleted file mode 100644 index c57c79ee2e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/main.tsp +++ /dev/null @@ -1,5 +0,0 @@ -/** - * DO NOT GENERATE FROM THIS FILE USE client.tsp - * This is just to simulate a service entrypoint - */ -import "../common/service.tsp"; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/mockapi.ts deleted file mode 100644 index 8dd29c23226..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/default/mockapi.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; -import { createServerTests } from "../common/service.js"; - -export const Scenarios: Record = {}; - -Scenarios.Client_Structure_Service = passOnSuccess([ - createServerTests("/client/structure/default/one"), - createServerTests("/client/structure/default/two"), - createServerTests("/client/structure/default/three"), - createServerTests("/client/structure/default/four"), - createServerTests("/client/structure/default/five"), - createServerTests("/client/structure/default/six"), - createServerTests("/client/structure/default/seven"), - createServerTests("/client/structure/default/eight"), - createServerTests("/client/structure/default/nine"), -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/client.tsp deleted file mode 100644 index 7d5908de331..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/client.tsp +++ /dev/null @@ -1,44 +0,0 @@ -import "./main.tsp"; -import "@azure-tools/typespec-client-generator-core"; -import "@typespec/spector"; - -using Azure.ClientGenerator.Core; -using Spector; - -@scenarioDoc(""" - Include multiple clients in the same spec. - ```ts - const clientA = new ClientAClient("multi-client"); - const clientB = new ClientBClient("multi-client"); - - clientA.renamedOne(); - clientA.renamedThree(); - clientA.renamedFive(); - - clientB.renamedTwo(); - clientB.renamedFour(); - clientB.renamedSix(); - ``` - """) -@scenario -namespace Client.Structure.MultiClient; - -@client({ - name: "ClientAClient", - service: Client.Structure.Service, -}) -interface ClientA { - renamedOne is Client.Structure.Service.one; - renamedThree is Client.Structure.Service.Foo.three; - renamedFive is Client.Structure.Service.Bar.five; -} - -@client({ - name: "ClientBClient", - service: Client.Structure.Service, -}) -interface ClientB { - renamedTwo is Client.Structure.Service.two; - renamedFour is Client.Structure.Service.Foo.four; - renamedSix is Client.Structure.Service.Bar.six; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/main.tsp deleted file mode 100644 index c57c79ee2e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/main.tsp +++ /dev/null @@ -1,5 +0,0 @@ -/** - * DO NOT GENERATE FROM THIS FILE USE client.tsp - * This is just to simulate a service entrypoint - */ -import "../common/service.tsp"; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/mockapi.ts deleted file mode 100644 index 4a7dcf1a01d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/multi-client/mockapi.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; -import { createServerTests } from "../common/service.js"; - -export const Scenarios: Record = {}; - -Scenarios.Client_Structure_MultiClient = passOnSuccess([ - createServerTests("/client/structure/multi-client/one"), - createServerTests("/client/structure/multi-client/two"), - createServerTests("/client/structure/multi-client/three"), - createServerTests("/client/structure/multi-client/four"), - createServerTests("/client/structure/multi-client/five"), - createServerTests("/client/structure/multi-client/six"), -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/client.tsp deleted file mode 100644 index 316153e9f0f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/client.tsp +++ /dev/null @@ -1,40 +0,0 @@ -import "./main.tsp"; -import "@azure-tools/typespec-client-generator-core"; -import "@typespec/spector"; - -using Azure.ClientGenerator.Core; -using Spector; - -@scenarioDoc(""" - This is to show we can have more than one operation group in a client. The client side should be able to call the api like - ```ts - const client = new RenamedOperationClient("renamed-operation"); - - client.renamedOne(); - client.renamedThree(); - client.renamedFive(); - - client.group.renamedTwo(); - client.group.renamedFour(); - client.group.renamedSix(); - ``` - """) -@client({ - name: "RenamedOperationClient", - service: Client.Structure.Service, -}) -@scenario -namespace Client.Structure.RenamedOperation; - -// Those operations are renamed at the root -op renamedOne is Client.Structure.Service.one; -op renamedThree is Client.Structure.Service.Foo.three; -op renamedFive is Client.Structure.Service.Bar.five; - -// Those operations are renamed inside an operation group -@operationGroup -interface Group { - renamedTwo is Client.Structure.Service.two; - renamedFour is Client.Structure.Service.Foo.four; - renamedSix is Client.Structure.Service.Bar.six; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/main.tsp deleted file mode 100644 index c57c79ee2e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/main.tsp +++ /dev/null @@ -1,5 +0,0 @@ -/** - * DO NOT GENERATE FROM THIS FILE USE client.tsp - * This is just to simulate a service entrypoint - */ -import "../common/service.tsp"; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/mockapi.ts deleted file mode 100644 index 6bc25321481..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/renamed-operation/mockapi.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; -import { createServerTests } from "../common/service.js"; - -export const Scenarios: Record = {}; - -Scenarios.Client_Structure_RenamedOperation = passOnSuccess([ - createServerTests("/client/structure/renamed-operation/one"), - createServerTests("/client/structure/renamed-operation/two"), - createServerTests("/client/structure/renamed-operation/three"), - createServerTests("/client/structure/renamed-operation/four"), - createServerTests("/client/structure/renamed-operation/five"), - createServerTests("/client/structure/renamed-operation/six"), -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/client.tsp deleted file mode 100644 index 07e112eba94..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/client.tsp +++ /dev/null @@ -1,42 +0,0 @@ -import "./main.tsp"; -import "@azure-tools/typespec-client-generator-core"; -import "@typespec/spector"; - -using Azure.ClientGenerator.Core; -using Spector; - -@scenarioDoc(""" - This is to show we can have more than one operation group in a client. The client side should be able to call the api like - - ```ts - const client = new TwoOperationGroupClient("two-operation-group"); - - client.group1.one(); - client.group1.three(); - client.group1.four(); - - client.group2.two(); - client.group2.five(); - client.group2.six(); - ``` - """) -@client({ - name: "TwoOperationGroupClient", - service: Client.Structure.Service, -}) -@scenario -namespace Client.Structure.TwoOperationGroup; - -@operationGroup -interface Group1 { - one is Client.Structure.Service.one; - three is Client.Structure.Service.Foo.three; - four is Client.Structure.Service.Foo.four; -} - -@operationGroup -interface Group2 { - two is Client.Structure.Service.two; - five is Client.Structure.Service.Bar.five; - six is Client.Structure.Service.Bar.six; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/main.tsp deleted file mode 100644 index c57c79ee2e4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/main.tsp +++ /dev/null @@ -1,5 +0,0 @@ -/** - * DO NOT GENERATE FROM THIS FILE USE client.tsp - * This is just to simulate a service entrypoint - */ -import "../common/service.tsp"; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/mockapi.ts deleted file mode 100644 index 1fb9a03da75..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/client/structure/two-operation-group/mockapi.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; -import { createServerTests } from "../common/service.js"; - -export const Scenarios: Record = {}; - -Scenarios.Client_Structure_TwoOperationGroup = passOnSuccess([ - createServerTests("/client/structure/two-operation-group/one"), - createServerTests("/client/structure/two-operation-group/two"), - createServerTests("/client/structure/two-operation-group/three"), - createServerTests("/client/structure/two-operation-group/four"), - createServerTests("/client/structure/two-operation-group/five"), - createServerTests("/client/structure/two-operation-group/six"), -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/array/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/encode/array/main.tsp deleted file mode 100644 index 4e707eeb41d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/encode/array/main.tsp +++ /dev/null @@ -1,112 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test for encode decorator on array.") -@scenarioService("/encode/array") -namespace Encode.Array; - -model CommaDelimitedArrayProperty { - @encode(ArrayEncoding.commaDelimited) - value: string[]; -} - -model SpaceDelimitedArrayProperty { - @encode(ArrayEncoding.spaceDelimited) - value: string[]; -} - -model PipeDelimitedArrayProperty { - @encode(ArrayEncoding.pipeDelimited) - value: string[]; -} - -model NewlineDelimitedArrayProperty { - @encode(ArrayEncoding.newlineDelimited) - value: string[]; -} - -@route("/property") -namespace Property { - @route("/comma-delimited") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a string array property with commaDelimited encode. - Expected request body: - ```json - { - "value": "blue,red,green" - } - ``` - Expected response body: - ```json - { - "value": "blue,red,green" - } - ``` - """) - @post - op commaDelimited(@body body: CommaDelimitedArrayProperty): CommaDelimitedArrayProperty; - - @route("/space-delimited") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a string array property with spaceDelimited encode. - Expected request body: - ```json - { - "value": "blue red green" - } - ``` - Expected response body: - ```json - { - "value": "blue red green" - } - ``` - """) - @post - op spaceDelimited(@body body: SpaceDelimitedArrayProperty): SpaceDelimitedArrayProperty; - - @route("/pipe-delimited") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a string array property with pipeDelimited encode. - Expected request body: - ```json - { - "value": "blue|red|green" - } - ``` - Expected response body: - ```json - { - "value": "blue|red|green" - } - ``` - """) - @post - op pipeDelimited(@body body: PipeDelimitedArrayProperty): PipeDelimitedArrayProperty; - - @route("/newline-delimited") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a string array property with newlineDelimited encode. - Expected request body: - ```json - { - "value": "blue\\nred\\ngreen" - } - ``` - Expected response body: - ```json - { - "value": "blue\\nred\\ngreen" - } - ``` - """) - @post - op newlineDelimited(@body body: NewlineDelimitedArrayProperty): NewlineDelimitedArrayProperty; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/array/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/encode/array/mockapi.ts deleted file mode 100644 index 8b22eeb67ea..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/encode/array/mockapi.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const colors = ["blue", "red", "green"]; - -function createPropertyServerTests(uri: string, delimiter: string) { - const encodedValue = colors.join(delimiter); - return passOnSuccess({ - uri, - method: "post", - request: { - body: json({ - value: encodedValue, - }), - }, - response: { - status: 200, - body: json({ value: encodedValue }), - }, - kind: "MockApiDefinition", - }); -} - -Scenarios.Encode_Array_Property_commaDelimited = createPropertyServerTests( - "/encode/array/property/comma-delimited", - ",", -); - -Scenarios.Encode_Array_Property_spaceDelimited = createPropertyServerTests( - "/encode/array/property/space-delimited", - " ", -); - -Scenarios.Encode_Array_Property_pipeDelimited = createPropertyServerTests( - "/encode/array/property/pipe-delimited", - "|", -); - -Scenarios.Encode_Array_Property_newlineDelimited = createPropertyServerTests( - "/encode/array/property/newline-delimited", - "\n", -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/main.tsp deleted file mode 100644 index 9a462c78a29..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/main.tsp +++ /dev/null @@ -1,372 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test for encode decorator on bytes.") -@scenarioService("/encode/bytes") -namespace Encode.Bytes; - -@encode(BytesKnownEncoding.base64url) -scalar base64urlBytes extends bytes; - -@route("/query") -namespace Query { - @route("/default") - @scenario - @scenarioDoc(""" - Test default encode (base64) for bytes query parameter. - Expected query parameter: - value=dGVzdA== (base64 encode of test) - """) - op default( - @query - value: bytes, - ): NoContentResponse; - - @route("/base64") - @scenario - @scenarioDoc(""" - Test base64 encode for bytes query parameter. - Expected query parameter: - value=dGVzdA== (base64 encode of test) - """) - op base64( - @query - @encode(BytesKnownEncoding.base64) - value: bytes, - ): NoContentResponse; - - @route("/base64url") - @scenario - @scenarioDoc(""" - Test base64url encode for bytes query parameter. - Expected query parameter: - value=dGVzdA (base64url encode of test) - """) - op base64url( - @query - @encode(BytesKnownEncoding.base64url) - value: bytes, - ): NoContentResponse; - - @route("/base64url-array") - @scenario - @scenarioDoc(""" - Test base64url encode for bytes array query parameter. - Expected query parameter: - value=dGVzdA, dGVzdA - """) - op base64urlArray( - @query - value: base64urlBytes[], - ): NoContentResponse; -} - -model DefaultBytesProperty { - value: bytes; -} - -model Base64BytesProperty { - @encode(BytesKnownEncoding.base64) - value: bytes; -} - -model Base64urlBytesProperty { - @encode(BytesKnownEncoding.base64url) - value: bytes; -} - -model Base64urlArrayBytesProperty { - value: base64urlBytes[]; -} - -@route("/property") -namespace Property { - @route("/default") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains bytes properties with default encode (base64). - Expected request body: - ```json - { - "value": "dGVzdA==" // base64 encode of test - } - ``` - Expected response body: - ```json - { - "value": "dGVzdA==" - } - ``` - """) - @post - op default(@body body: DefaultBytesProperty): DefaultBytesProperty; - - @route("/base64") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains bytes properties with base64 encode. - Expected request body: - ```json - { - "value": "dGVzdA==" // base64 encode of test - } - ``` - Expected response body: - ```json - { - "value": "dGVzdA==" - } - ``` - """) - @post - op base64(@body body: Base64BytesProperty): Base64BytesProperty; - - @route("/base64url") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains bytes properties with base64url encode. - Expected request body: - ```json - { - "value": "dGVzdA" // base64url encode of test - } - ``` - Expected response body: - ```json - { - "value": "dGVzdA" - } - ``` - """) - @post - op base64url(@body body: Base64urlBytesProperty): Base64urlBytesProperty; - - @route("/base64url-array") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains bytes array properties with base64url encode. - Expected request body: - ```json - { - "value": ["dGVzdA", "dGVzdA"] - } - ``` - Expected response body: - ```json - { - "value": ["dGVzdA", "dGVzdA"] - } - ``` - """) - @post - op base64urlArray(@body body: Base64urlArrayBytesProperty): Base64urlArrayBytesProperty; -} - -@route("/header") -namespace Header { - @route("/default") - @scenario - @scenarioDoc(""" - Test default encode (base64) for bytes header. - Expected header: - value=dGVzdA== (base64 encode of test) - """) - op default( - @header - value: bytes, - ): NoContentResponse; - - @route("/base64") - @scenario - @scenarioDoc(""" - Test base64 encode for bytes header. - Expected header: - value=dGVzdA== (base64 encode of test) - """) - op base64( - @header - @encode(BytesKnownEncoding.base64) - value: bytes, - ): NoContentResponse; - - @route("/base64url") - @scenario - @scenarioDoc(""" - Test base64url encode for bytes header. - Expected header: - value=dGVzdA (base64url encode of test) - """) - op base64url( - @header - @encode(BytesKnownEncoding.base64url) - value: bytes, - ): NoContentResponse; - - @route("/base64url-array") - @scenario - @scenarioDoc(""" - Test base64url encode for bytes array header. - Expected header: - value=dGVzdA,dGVzdA - """) - op base64urlArray( - @header - value: base64urlBytes[], - ): NoContentResponse; -} - -@route("/body/request") -namespace RequestBody { - @route("/default") - @scenario - @scenarioDoc(""" - When content type is not defined and body is `bytes` the payload is a binary stream. - Stream should match packages/http-specs/assets/image.png file. - """) - @post - op default( - @body - value: bytes, - ): NoContentResponse; - - @route("/octet-stream") - @scenario - @scenarioDoc(""" - When content type is application/octet-stream and body is `bytes` the payload is a binary stream. - Stream should match packages/http-specs/assets/image.png file. - """) - @post - op octetStream( - @header - contentType: "application/octet-stream", - - @body - value: bytes, - ): NoContentResponse; - - @route("/custom-content-type") - @scenario - @scenarioDoc(""" - When content type is a custom type(image/png here) and body is `bytes` the payload is a binary file. - File should match packages/http-specs/assets/image.png. - """) - @post - op customContentType( - @header - contentType: "image/png", - - @body - value: bytes, - ): NoContentResponse; - - @route("/base64") - @scenario - @scenarioDoc(""" - Test base64 encode for bytes body. - Expected body: - "dGVzdA==" (base64 encode of test, in JSON string) - """) - @post - op base64( - @header - contentType: "application/json", - - @body - @encode(BytesKnownEncoding.base64) - value: bytes, - ): NoContentResponse; - - @route("/base64url") - @scenario - @scenarioDoc(""" - Test base64url encode for bytes body. - Expected body: - "dGVzdA" (base64url encode of test, in JSON string) - """) - @post - op base64url( - @header - contentType: "application/json", - - @body - @encode(BytesKnownEncoding.base64url) - value: bytes, - ): NoContentResponse; -} - -@route("/body/response") -namespace ResponseBody { - @route("/default") - @scenario - @scenarioDoc(""" - When content type is not defined and body is `bytes` the payload is a binary stream. - Stream should match packages/http-specs/assets/image.png file. - """) - op default(): { - @body - value: bytes; - }; - - @route("/octet-stream") - @scenario - @scenarioDoc(""" - When content type is application/octet-stream and body is `bytes` the payload is a binary stream. - Stream should match packages/http-specs/assets/image.png file. - """) - op octetStream(): { - @header - contentType: "application/octet-stream"; - - @body - value: bytes; - }; - - @route("/custom-content-type") - @scenario - @scenarioDoc(""" - When content type is a custom type(image/png here) and body is `bytes` the payload is a binary file. - File should match packages/http-specs/assets/image.png - """) - op customContentType(): { - @header - contentType: "image/png"; - - @body - value: bytes; - }; - - @route("/base64") - @scenario - @scenarioDoc(""" - Test base64 encode for bytes body. - Expected body: - "dGVzdA==" (base64 encode of test, in JSON string) - """) - op base64(): { - @header - contentType: "application/json"; - - @body - @encode(BytesKnownEncoding.base64) - value: bytes; - }; - - @route("/base64url") - @scenario - @scenarioDoc(""" - Test base64url encode for bytes body. - Expected body: - "dGVzdA" (base64url encode of test, in JSON string) - """) - op base64url(): { - @header - contentType: "application/json"; - - @body - @encode(BytesKnownEncoding.base64url) - body: base64urlBytes; - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/mockapi.ts deleted file mode 100644 index a65099d3b2a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/encode/bytes/mockapi.ts +++ /dev/null @@ -1,279 +0,0 @@ -import { resolvePath } from "@typespec/compiler"; -import { - CollectionFormat, - json, - MockRequest, - passOnSuccess, - ScenarioMockApi, -} from "@typespec/spec-api"; -import { readFileSync } from "fs"; -import { fileURLToPath } from "url"; - -const root = resolvePath(fileURLToPath(import.meta.url), "../../../../../"); - -const pngFile = readFileSync(resolvePath(root, "assets/image.png")); - -export const Scenarios: Record = {}; - -function createQueryServerTests( - uri: string, - data: any, - value: any, - collectionFormat?: CollectionFormat, -) { - return passOnSuccess({ - uri, - method: "get", - request: { - query: data, - }, - response: { - status: 204, - }, - handler: (req: MockRequest) => { - req.expect.containsQueryParam("value", value, collectionFormat); - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }); -} -Scenarios.Encode_Bytes_Query_default = createQueryServerTests( - "/encode/bytes/query/default", - { - value: "dGVzdA==", - }, - "dGVzdA==", -); -Scenarios.Encode_Bytes_Query_base64 = createQueryServerTests( - "/encode/bytes/query/base64", - { - value: "dGVzdA==", - }, - "dGVzdA==", -); -Scenarios.Encode_Bytes_Query_base64url = createQueryServerTests( - "/encode/bytes/query/base64url", - { - value: "dGVzdA", - }, - "dGVzdA", -); -Scenarios.Encode_Bytes_Query_base64urlArray = createQueryServerTests( - "/encode/bytes/query/base64url-array", - { - value: ["dGVzdA", "dGVzdA"].join(","), - }, - ["dGVzdA", "dGVzdA"], - "csv", -); -function createPropertyServerTests(uri: string, data: any, value: any) { - return passOnSuccess({ - uri, - method: "post", - request: { - body: json(data), - }, - response: { - status: 200, - body: json({ value: value }), - }, - kind: "MockApiDefinition", - }); -} -Scenarios.Encode_Bytes_Property_default = createPropertyServerTests( - "/encode/bytes/property/default", - { - value: "dGVzdA==", - }, - "dGVzdA==", -); -Scenarios.Encode_Bytes_Property_base64 = createPropertyServerTests( - "/encode/bytes/property/base64", - { - value: "dGVzdA==", - }, - "dGVzdA==", -); -Scenarios.Encode_Bytes_Property_base64url = createPropertyServerTests( - "/encode/bytes/property/base64url", - { - value: "dGVzdA", - }, - "dGVzdA", -); -Scenarios.Encode_Bytes_Property_base64urlArray = createPropertyServerTests( - "/encode/bytes/property/base64url-array", - { - value: ["dGVzdA", "dGVzdA"], - }, - ["dGVzdA", "dGVzdA"], -); -function createHeaderServerTests(uri: string, data: any, value: any) { - return passOnSuccess({ - uri, - method: "get", - request: { - headers: data, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }); -} -Scenarios.Encode_Bytes_Header_default = createHeaderServerTests( - "/encode/bytes/header/default", - { - value: "dGVzdA==", - }, - "dGVzdA==", -); -Scenarios.Encode_Bytes_Header_base64 = createHeaderServerTests( - "/encode/bytes/header/base64", - { - value: "dGVzdA==", - }, - "dGVzdA==", -); -Scenarios.Encode_Bytes_Header_base64url = createHeaderServerTests( - "/encode/bytes/header/base64url", - { - value: "dGVzdA", - }, - "dGVzdA", -); -Scenarios.Encode_Bytes_Header_base64urlArray = createHeaderServerTests( - "/encode/bytes/header/base64url-array", - { - value: ["dGVzdA", "dGVzdA"].join(","), - }, - ["dGVzdA", "dGVzdA"].join(","), -); -function createRequestBodyServerTests( - uri: string, - data: any, - contentType: string = "application/json", -) { - return passOnSuccess({ - uri, - method: "post", - request: { - body: { - contentType: contentType, - rawContent: data, - }, - }, - response: { - status: 204, - }, - handler(req: MockRequest) { - req.expect.containsHeader("content-type", contentType); - req.expect.rawBodyEquals(data); - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }); -} -Scenarios.Encode_Bytes_RequestBody_default = createRequestBodyServerTests( - "/encode/bytes/body/request/default", - pngFile, - "application/octet-stream", -); -Scenarios.Encode_Bytes_RequestBody_base64 = createRequestBodyServerTests( - "/encode/bytes/body/request/base64", - '"dGVzdA=="', -); -Scenarios.Encode_Bytes_RequestBody_base64url = createRequestBodyServerTests( - "/encode/bytes/body/request/base64url", - '"dGVzdA"', -); - -Scenarios.Encode_Bytes_RequestBody_customContentType = createRequestBodyServerTests( - "/encode/bytes/body/request/custom-content-type", - pngFile, - "image/png", -); -Scenarios.Encode_Bytes_RequestBody_octetStream = createRequestBodyServerTests( - "/encode/bytes/body/request/octet-stream", - pngFile, - "application/octet-stream", -); -function createResponseBodyServerTests( - uri: string, - data: any, - headerData: any, - value: any, - contentType: string = "application/json", -) { - return passOnSuccess({ - uri, - method: "get", - request: { - headers: headerData, - }, - response: { - status: 200, - body: { - contentType: contentType, - rawContent: data, - }, - }, - handler(req: MockRequest) { - return { - status: 200, - body: { - contentType: contentType, - rawContent: value, - }, - }; - }, - kind: "MockApiDefinition", - }); -} -Scenarios.Encode_Bytes_ResponseBody_default = createResponseBodyServerTests( - "/encode/bytes/body/response/default", - pngFile, - { - "Content-Type": "application/octet-stream", - }, - pngFile, - "application/octet-stream", -); -Scenarios.Encode_Bytes_ResponseBody_base64 = createResponseBodyServerTests( - "/encode/bytes/body/response/base64", - JSON.stringify("dGVzdA=="), - { - "Content-Type": "application/json", - }, - JSON.stringify("dGVzdA=="), -); -Scenarios.Encode_Bytes_ResponseBody_base64url = createResponseBodyServerTests( - "/encode/bytes/body/response/base64url", - JSON.stringify("dGVzdA"), - { - "Content-Type": "application/json", - }, - JSON.stringify("dGVzdA"), -); -Scenarios.Encode_Bytes_ResponseBody_customContentType = createResponseBodyServerTests( - "/encode/bytes/body/response/custom-content-type", - pngFile, - { - "Content-Type": "image/png", - }, - pngFile, - "image/png", -); -Scenarios.Encode_Bytes_ResponseBody_octetStream = createResponseBodyServerTests( - "/encode/bytes/body/response/octet-stream", - pngFile, - { - "Content-Type": "application/octet-stream", - }, - pngFile, - "application/octet-stream", -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/main.tsp deleted file mode 100644 index c78fd9afbf1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/main.tsp +++ /dev/null @@ -1,334 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test for encode decorator on datetime.") -@scenarioService("/encode/datetime") -namespace Encode.Datetime; - -@encode(DateTimeKnownEncoding.unixTimestamp, int64) -scalar unixTimestampDatetime extends utcDateTime; - -@route("/query") -namespace Query { - @route("/default") - @scenario - @scenarioDoc(""" - Test default encode (rfc3339) for datetime query parameter. - Expected query parameter: - value=2022-08-26T18:38:00.000Z - """) - op default( - @query - value: utcDateTime, - ): NoContentResponse; - - @route("/rfc3339") - @scenario - @scenarioDoc(""" - Test rfc3339 encode for datetime query parameter. - Expected query parameter: - value=2022-08-26T18:38:00.000Z - """) - op rfc3339( - @query - @encode(DateTimeKnownEncoding.rfc3339) - value: utcDateTime, - ): NoContentResponse; - - @route("/rfc7231") - @scenario - @scenarioDoc(""" - Test rfc7231 encode for datetime query parameter. - Expected query parameter: - value=Fri, 26 Aug 2022 14:38:00 GMT - """) - op rfc7231( - @query - @encode(DateTimeKnownEncoding.rfc7231) - value: utcDateTime, - ): NoContentResponse; - - @route("/unix-timestamp") - @scenario - @scenarioDoc(""" - Test unixTimestamp encode for datetime query parameter. - Expected query parameter: - value=1686566864 - """) - op unixTimestamp( - @query - @encode(DateTimeKnownEncoding.unixTimestamp, int64) - value: utcDateTime, - ): NoContentResponse; - - @route("/unix-timestamp-array") - @scenario - @scenarioDoc(""" - Test unixTimestamp encode for datetime array query parameter. - Expected query parameter: - value=1686566864, 1686734256 - """) - op unixTimestampArray( - @query - value: unixTimestampDatetime[], - ): NoContentResponse; -} - -model DefaultDatetimeProperty { - value: utcDateTime; -} - -model Rfc3339DatetimeProperty { - @encode(DateTimeKnownEncoding.rfc3339) - value: utcDateTime; -} - -model Rfc7231DatetimeProperty { - @encode(DateTimeKnownEncoding.rfc7231) - value: utcDateTime; -} - -model UnixTimestampDatetimeProperty { - @encode(DateTimeKnownEncoding.unixTimestamp, int64) - value: utcDateTime; -} - -model UnixTimestampArrayDatetimeProperty { - value: unixTimestampDatetime[]; -} - -@route("/property") -namespace Property { - @route("/default") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains datetime property with default encode (rfc3339). - Expected request body: - ```json - { - "value": "2022-08-26T18:38:00.000Z" - } - ``` - Expected response body: - ```json - { - "value": "2022-08-26T18:38:00.000Z" - } - ``` - """) - @post - op default(@body body: DefaultDatetimeProperty): DefaultDatetimeProperty; - - @route("/rfc3339") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains datetime property with rfc3339 encode. - Expected request body: - ```json - { - "value": "2022-08-26T18:38:00.000Z" - } - ``` - Expected response body: - ```json - { - "value": "2022-08-26T18:38:00.000Z" - } - ``` - """) - @post - op rfc3339(@body body: Rfc3339DatetimeProperty): Rfc3339DatetimeProperty; - - @route("/rfc7231") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains datetime property with rfc7231 encode. - Expected request body: - ```json - { - "value": "Fri, 26 Aug 2022 14:38:00 GMT" - } - ``` - Expected response body: - ```json - { - "value": "Fri, 26 Aug 2022 14:38:00 GMT" - } - ``` - """) - @post - op rfc7231(@body body: Rfc7231DatetimeProperty): Rfc7231DatetimeProperty; - - @route("/unix-timestamp") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains datetime property with unixTimestamp encode. - Expected request body: - ```json - { - "value": 1686566864 - } - ``` - Expected response body: - ```json - { - "value": 1686566864 - } - ``` - """) - @post - op unixTimestamp(@body body: UnixTimestampDatetimeProperty): UnixTimestampDatetimeProperty; - - @route("/unix-timestamp-array") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains datetime array property with unixTimestamp encode. - Expected request body:f - ```json - { - "value": [1686566864, 1686734256] - } - ``` - Expected response body: - ```json - { - "value": [1686566864, 1686734256] - } - ``` - """) - @post - op unixTimestampArray( - @body body: UnixTimestampArrayDatetimeProperty, - ): UnixTimestampArrayDatetimeProperty; -} - -@route("/header") -namespace Header { - @route("/default") - @scenario - @scenarioDoc(""" - Test default encode (rfc7231) for datetime header. - Expected header: - value=Fri, 26 Aug 2022 14:38:00 GMT - """) - op default( - @header - value: utcDateTime, - ): NoContentResponse; - - @route("/rfc3339") - @scenario - @scenarioDoc(""" - Test rfc3339 encode for datetime header. - Expected header: - value=2022-08-26T18:38:00.000Z - """) - op rfc3339( - @header - @encode(DateTimeKnownEncoding.rfc3339) - value: utcDateTime, - ): NoContentResponse; - - @route("/rfc7231") - @scenario - @scenarioDoc(""" - Test rfc7231 encode for datetime header. - Expected header: - value=Fri, 26 Aug 2022 14:38:00 GMT - """) - op rfc7231( - @header - @encode(DateTimeKnownEncoding.rfc7231) - value: utcDateTime, - ): NoContentResponse; - - @route("/unix-timestamp") - @scenario - @scenarioDoc(""" - Test unixTimestamp encode for datetime header. - Expected header: - value=1686566864 - """) - op unixTimestamp( - @header - @encode(DateTimeKnownEncoding.unixTimestamp, int64) - value: utcDateTime, - ): NoContentResponse; - - @route("/unix-timestamp-array") - @scenario - @scenarioDoc(""" - Test unixTimestamp encode for datetime array header. - Expected header: - value=1686566864,1686734256 - """) - op unixTimestampArray( - @header - value: unixTimestampDatetime[], - ): NoContentResponse; -} - -model DefaultDatetimeHeader { - @header - value: utcDateTime; -} - -model Rfc3339DatetimeHeader { - @encode(DateTimeKnownEncoding.rfc3339) - @header - value: utcDateTime; -} - -model Rfc7231DatetimeHeader { - @encode(DateTimeKnownEncoding.rfc7231) - @header - value: utcDateTime; -} - -model UnixTimestampDatetimeHeader { - @encode(DateTimeKnownEncoding.unixTimestamp, int64) - @header - value: utcDateTime; -} - -@route("/responseheader") -namespace ResponseHeader { - @route("/default") - @scenario - @scenarioDoc(""" - Test default encode (rfc7231) for datetime header. - Expected response header: - value=Fri, 26 Aug 2022 14:38:00 GMT - """) - op default(): NoContentResponse & DefaultDatetimeHeader; - - @route("/rfc3339") - @scenario - @scenarioDoc(""" - Test rfc3339 encode for datetime header. - Expected response header: - value=2022-08-26T18:38:00.000Z - """) - op rfc3339(): NoContentResponse & Rfc3339DatetimeHeader; - - @route("/rfc7231") - @scenario - @scenarioDoc(""" - Test rfc7231 encode for datetime header. - Expected response header: - value=Fri, 26 Aug 2022 14:38:00 GMT - """) - op rfc7231(): NoContentResponse & Rfc7231DatetimeHeader; - - @route("/unix-timestamp") - @scenario - @scenarioDoc(""" - Test unixTimestamp encode for datetime header. - Expected response header: - value=1686566864 - """) - op unixTimestamp(): NoContentResponse & UnixTimestampDatetimeHeader; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/mockapi.ts deleted file mode 100644 index 00d21397026..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/encode/datetime/mockapi.ts +++ /dev/null @@ -1,274 +0,0 @@ -import { - CollectionFormat, - json, - MockRequest, - passOnSuccess, - ScenarioMockApi, - validateValueFormat, - ValidationError, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createQueryServerTests( - uri: string, - paramData: any, - format: "rfc7231" | "rfc3339" | undefined, - value: any, - collectionFormat?: CollectionFormat, -) { - return passOnSuccess({ - uri, - method: "get", - request: { - query: paramData, - }, - response: { - status: 204, - }, - handler(req: MockRequest) { - if (format) { - validateValueFormat(req.query["value"] as string, format); - if (Date.parse(req.query["value"] as string) !== Date.parse(value)) { - throw new ValidationError(`Wrong value`, value, req.query["value"]); - } - } else { - req.expect.containsQueryParam("value", value, collectionFormat); - } - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }); -} -Scenarios.Encode_Datetime_Query_default = createQueryServerTests( - "/encode/datetime/query/default", - { - value: "2022-08-26T18:38:00.000Z", - }, - "rfc3339", - "2022-08-26T18:38:00.000Z", -); -Scenarios.Encode_Datetime_Query_rfc3339 = createQueryServerTests( - "/encode/datetime/query/rfc3339", - { - value: "2022-08-26T18:38:00.000Z", - }, - "rfc3339", - "2022-08-26T18:38:00.000Z", -); -Scenarios.Encode_Datetime_Query_rfc7231 = createQueryServerTests( - "/encode/datetime/query/rfc7231", - { - value: "Fri, 26 Aug 2022 14:38:00 GMT", - }, - "rfc7231", - "Fri, 26 Aug 2022 14:38:00 GMT", -); -Scenarios.Encode_Datetime_Query_unixTimestamp = createQueryServerTests( - "/encode/datetime/query/unix-timestamp", - { - value: 1686566864, - }, - undefined, - "1686566864", -); -Scenarios.Encode_Datetime_Query_unixTimestampArray = createQueryServerTests( - "/encode/datetime/query/unix-timestamp-array", - { - value: [1686566864, 1686734256].join(","), - }, - undefined, - ["1686566864", "1686734256"], - "csv", -); -function createPropertyServerTests( - uri: string, - data: any, - format: "rfc7231" | "rfc3339" | undefined, - value: any, -) { - return passOnSuccess({ - uri, - method: "post", - request: { - body: json(data), - }, - response: { - status: 200, - }, - handler: (req: MockRequest) => { - if (format) { - validateValueFormat(req.body["value"], format); - if (Date.parse(req.body["value"]) !== Date.parse(value)) { - throw new ValidationError(`Wrong value`, value, req.body["value"]); - } - } else { - req.expect.coercedBodyEquals({ value: value }); - } - return { - status: 200, - body: json({ value: value }), - }; - }, - kind: "MockApiDefinition", - }); -} -Scenarios.Encode_Datetime_Property_default = createPropertyServerTests( - "/encode/datetime/property/default", - { - value: "2022-08-26T18:38:00.000Z", - }, - "rfc3339", - "2022-08-26T18:38:00.000Z", -); -Scenarios.Encode_Datetime_Property_rfc3339 = createPropertyServerTests( - "/encode/datetime/property/rfc3339", - { - value: "2022-08-26T18:38:00.000Z", - }, - "rfc3339", - "2022-08-26T18:38:00.000Z", -); -Scenarios.Encode_Datetime_Property_rfc7231 = createPropertyServerTests( - "/encode/datetime/property/rfc7231", - { - value: "Fri, 26 Aug 2022 14:38:00 GMT", - }, - "rfc7231", - "Fri, 26 Aug 2022 14:38:00 GMT", -); -Scenarios.Encode_Datetime_Property_unixTimestamp = createPropertyServerTests( - "/encode/datetime/property/unix-timestamp", - { - value: 1686566864, - }, - undefined, - 1686566864, -); -Scenarios.Encode_Datetime_Property_unixTimestampArray = createPropertyServerTests( - "/encode/datetime/property/unix-timestamp-array", - { - value: [1686566864, 1686734256], - }, - undefined, - [1686566864, 1686734256], -); -function createHeaderServerTests( - uri: string, - data: any, - format: "rfc7231" | "rfc3339" | undefined, - value: any, -) { - return passOnSuccess({ - uri, - method: "get", - request: { - headers: data, - }, - response: { - status: 204, - }, - handler(req: MockRequest) { - if (format) { - validateValueFormat(req.headers["value"], format); - if (Date.parse(req.headers["value"]) !== Date.parse(value)) { - throw new ValidationError(`Wrong value`, value, req.headers["value"]); - } - } else { - req.expect.containsHeader("value", value); - } - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }); -} -Scenarios.Encode_Datetime_Header_default = createHeaderServerTests( - "/encode/datetime/header/default", - { - value: "Fri, 26 Aug 2022 14:38:00 GMT", - }, - "rfc7231", - "Fri, 26 Aug 2022 14:38:00 GMT", -); -Scenarios.Encode_Datetime_Header_rfc3339 = createHeaderServerTests( - "/encode/datetime/header/rfc3339", - { - value: "2022-08-26T18:38:00.000Z", - }, - "rfc3339", - "2022-08-26T18:38:00.000Z", -); -Scenarios.Encode_Datetime_Header_rfc7231 = createHeaderServerTests( - "/encode/datetime/header/rfc7231", - { - value: "Fri, 26 Aug 2022 14:38:00 GMT", - }, - "rfc7231", - "Fri, 26 Aug 2022 14:38:00 GMT", -); -Scenarios.Encode_Datetime_Header_unixTimestamp = createHeaderServerTests( - "/encode/datetime/header/unix-timestamp", - { - value: 1686566864, - }, - undefined, - "1686566864", -); -Scenarios.Encode_Datetime_Header_unixTimestampArray = createHeaderServerTests( - "/encode/datetime/header/unix-timestamp-array", - { - value: [1686566864, 1686734256].join(","), - }, - undefined, - "1686566864,1686734256", -); -function createResponseHeaderServerTests(uri: string, data: any, value: any) { - return passOnSuccess({ - uri, - method: "get", - request: {}, - response: { - status: 204, - headers: data, - }, - handler: (req: MockRequest) => { - return { - status: 204, - headers: { value: value }, - }; - }, - kind: "MockApiDefinition", - }); -} -Scenarios.Encode_Datetime_ResponseHeader_default = createResponseHeaderServerTests( - "/encode/datetime/responseheader/default", - { - value: "Fri, 26 Aug 2022 14:38:00 GMT", - }, - "Fri, 26 Aug 2022 14:38:00 GMT", -); -Scenarios.Encode_Datetime_ResponseHeader_rfc3339 = createResponseHeaderServerTests( - "/encode/datetime/responseheader/rfc3339", - { - value: "2022-08-26T18:38:00.000Z", - }, - "2022-08-26T18:38:00.000Z", -); -Scenarios.Encode_Datetime_ResponseHeader_rfc7231 = createResponseHeaderServerTests( - "/encode/datetime/responseheader/rfc7231", - { - value: "Fri, 26 Aug 2022 14:38:00 GMT", - }, - "Fri, 26 Aug 2022 14:38:00 GMT", -); -Scenarios.Encode_Datetime_ResponseHeader_unixTimestamp = createResponseHeaderServerTests( - "/encode/datetime/responseheader/unix-timestamp", - { - value: "1686566864", - }, - 1686566864, -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/main.tsp deleted file mode 100644 index cb0cf16aee0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/main.tsp +++ /dev/null @@ -1,731 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test for encode decorator on duration.") -@scenarioService("/encode/duration") -namespace Encode.Duration; - -@route("/query") -namespace Query { - @route("/default") - @scenario - @scenarioDoc(""" - Test default encode for a duration parameter. - Expected query parameter `input=P40D` - """) - op default( - @query - input: duration, - ): NoContentResponse; - - @route("/iso8601") - @scenario - @scenarioDoc(""" - Test iso8601 encode for a duration parameter. - Expected query parameter `input=P40D` - """) - op iso8601( - @query - @encode(DurationKnownEncoding.ISO8601) - input: duration, - ): NoContentResponse; - - @route("/int32-seconds") - @scenario - @scenarioDoc(""" - Test int32 seconds encode for a duration parameter. - Expected query parameter `input=36` - """) - op int32Seconds( - @query - @encode(DurationKnownEncoding.seconds, int32) - input: duration, - ): NoContentResponse; - - @route("/int32-seconds-larger-unit") - @scenario - @scenarioDoc(""" - Test int32 seconds encode for a duration parameter where the duration is several minutes. - Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2) in C#. - Expected query parameter `input=120` - """) - op int32SecondsLargerUnit( - @query - @encode(DurationKnownEncoding.seconds, int32) - input: duration, - ): NoContentResponse; - - @route("/float-seconds") - @scenario - @scenarioDoc(""" - Test float seconds encode for a duration parameter. - Expected query parameter `input=35.625` - """) - op floatSeconds( - @query - @encode(DurationKnownEncoding.seconds, float) - input: duration, - ): NoContentResponse; - - @route("/float-seconds-larger-unit") - @scenario - @scenarioDoc(""" - Test float seconds encode for a duration parameter where the duration is several minutes. - Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2.5) in C#. - Expected query parameter `input=150.0` - """) - op floatSecondsLargerUnit( - @query - @encode(DurationKnownEncoding.seconds, float) - input: duration, - ): NoContentResponse; - - @route("/float64-seconds") - @scenario - @scenarioDoc(""" - Test float64 seconds encode for a duration parameter. - Expected query parameter `input=35.625` - """) - op float64Seconds( - @query - @encode(DurationKnownEncoding.seconds, float64) - input: duration, - ): NoContentResponse; - - @route("/int32-milliseconds") - @scenario - @scenarioDoc(""" - Test int32 milliseconds encode for a duration parameter. - Expected query parameter `input=36000` - """) - op int32Milliseconds( - @query - @encode(DurationKnownEncoding.milliseconds, int32) - input: duration, - ): NoContentResponse; - - @route("/int32-milliseconds-larger-unit") - @scenario - @scenarioDoc(""" - Test int32 milliseconds encode for a duration parameter where the duration is several minutes. - Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3) in C#. - Expected query parameter `input=180000` - """) - op int32MillisecondsLargerUnit( - @query - @encode(DurationKnownEncoding.milliseconds, int32) - input: duration, - ): NoContentResponse; - - @route("/float-milliseconds") - @scenario - @scenarioDoc(""" - Test float milliseconds encode for a duration parameter. - Expected query parameter `input=35625` - """) - op floatMilliseconds( - @query - @encode(DurationKnownEncoding.milliseconds, float) - input: duration, - ): NoContentResponse; - - @route("/float-milliseconds-larger-unit") - @scenario - @scenarioDoc(""" - Test float milliseconds encode for a duration parameter where the duration is several minutes. - Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3.5) in C#. - Expected query parameter `input=210000.0` - """) - op floatMillisecondsLargerUnit( - @query - @encode(DurationKnownEncoding.milliseconds, float) - input: duration, - ): NoContentResponse; - - @route("/float64-milliseconds") - @scenario - @scenarioDoc(""" - Test float64 milliseconds encode for a duration parameter. - Expected query parameter `input=35625` - """) - op float64Milliseconds( - @query - @encode(DurationKnownEncoding.milliseconds, float64) - input: duration, - ): NoContentResponse; - - @encode(DurationKnownEncoding.seconds, int32) - scalar Int32Duration extends duration; - - @route("/int32-seconds-array") - @scenario - @scenarioDoc(""" - Test int32 seconds encode for a duration array parameter. - Expected query parameter `input=36,47` - """) - op int32SecondsArray( - @query - input: Int32Duration[], - ): NoContentResponse; - - @encode(DurationKnownEncoding.milliseconds, int32) - scalar Int32MillisecondsDuration extends duration; - - @route("/int32-milliseconds-array") - @scenario - @scenarioDoc(""" - Test int32 milliseconds encode for a duration array parameter. - Expected query parameter `input=36000,47000` - """) - op int32MillisecondsArray( - @query - input: Int32MillisecondsDuration[], - ): NoContentResponse; -} - -@route("/property") -namespace Property { - model DefaultDurationProperty { - value: duration; - } - - model ISO8601DurationProperty { - @encode(DurationKnownEncoding.ISO8601) - value: duration; - } - - model Int32SecondsDurationProperty { - @encode(DurationKnownEncoding.seconds, int32) - value: duration; - } - - model FloatSecondsDurationProperty { - @encode(DurationKnownEncoding.seconds, float) - value: duration; - } - - model Float64SecondsDurationProperty { - @encode(DurationKnownEncoding.seconds, float64) - value: duration; - } - - model Int32MillisecondsDurationProperty { - @encode(DurationKnownEncoding.milliseconds, int32) - value: duration; - } - - model FloatMillisecondsDurationProperty { - @encode(DurationKnownEncoding.milliseconds, float) - value: duration; - } - - model Float64MillisecondsDurationProperty { - @encode(DurationKnownEncoding.milliseconds, float64) - value: duration; - } - - model Int32SecondsLargerUnitDurationProperty { - @encode(DurationKnownEncoding.seconds, int32) - value: duration; - } - - model FloatSecondsLargerUnitDurationProperty { - @encode(DurationKnownEncoding.seconds, float) - value: duration; - } - - model Int32MillisecondsLargerUnitDurationProperty { - @encode(DurationKnownEncoding.milliseconds, int32) - value: duration; - } - - model FloatMillisecondsLargerUnitDurationProperty { - @encode(DurationKnownEncoding.milliseconds, float) - value: duration; - } - - @encode(DurationKnownEncoding.seconds, float32) - scalar Float32Duration extends duration; - - model FloatSecondsDurationArrayProperty { - value: Float32Duration[]; - } - - @encode(DurationKnownEncoding.milliseconds, float32) - scalar Float32MillisecondsDuration extends duration; - - model FloatMillisecondsDurationArrayProperty { - value: Float32MillisecondsDuration[]; - } - - @route("/default") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a duration property with default encode. - Expected request body: - ```json - { - "value": "P40D" - } - ``` - Expected response body: - ```json - { - "value": "P40D" - } - ``` - """) - @post - op default(@body body: DefaultDurationProperty): DefaultDurationProperty; - - @route("/iso8601") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a duration property with iso8601 encode. - Expected request body: - ```json - { - "value": "P40D" - } - ``` - Expected response body: - ```json - { - "value": "P40D" - } - ``` - """) - @post - op iso8601(@body body: ISO8601DurationProperty): ISO8601DurationProperty; - - @route("/int32-seconds") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a duration property with int32 seconds encode. - Expected request body: - ```json - { - "value": 36 - } - ``` - Expected response body: - ```json - { - "value": 36 - } - ``` - """) - op int32Seconds(@body body: Int32SecondsDurationProperty): Int32SecondsDurationProperty; - - @route("/float-seconds") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a duration property with float seconds encode. - Expected request body: - ```json - { - "value": 35.625 - } - ``` - Expected response body: - ```json - { - "value": 35.625 - } - ``` - """) - op floatSeconds(@body body: FloatSecondsDurationProperty): FloatSecondsDurationProperty; - - @route("/float64-seconds") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a duration property with float64 seconds encode. - Expected request body: - ```json - { - "value": 35.625 - } - ``` - Expected response body: - ```json - { - "value": 35.625 - } - ``` - """) - op float64Seconds(@body body: Float64SecondsDurationProperty): Float64SecondsDurationProperty; - - @route("/int32-milliseconds") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a duration property with int32 milliseconds encode. - Expected request body: - ```json - { - "value": 36000 - } - ``` - Expected response body: - ```json - { - "value": 36000 - } - ``` - """) - op int32Milliseconds( - @body body: Int32MillisecondsDurationProperty, - ): Int32MillisecondsDurationProperty; - - @route("/float-milliseconds") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a duration property with float milliseconds encode. - Expected request body: - ```json - { - "value": 35625 - } - ``` - Expected response body: - ```json - { - "value": 35625 - } - ``` - """) - op floatMilliseconds( - @body body: FloatMillisecondsDurationProperty, - ): FloatMillisecondsDurationProperty; - - @route("/float64-milliseconds") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a duration property with float64 milliseconds encode. - Expected request body: - ```json - { - "value": 35625 - } - ``` - Expected response body: - ```json - { - "value": 35625 - } - ``` - """) - op float64Milliseconds( - @body body: Float64MillisecondsDurationProperty, - ): Float64MillisecondsDurationProperty; - - @route("/float-seconds-array") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains an array property which elements are duration with float seconds encode. - Expected request body: - ```json - { - "value": [35.625, 46.75] - } - ``` - Expected response body: - ```json - { - "value": [35.625, 46.75] - } - ``` - """) - op floatSecondsArray( - @body body: FloatSecondsDurationArrayProperty, - ): FloatSecondsDurationArrayProperty; - - @route("/float-milliseconds-array") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains an array property which elements are duration with float milliseconds encode. - Expected request body: - ```json - { - "value": [35625, 46750] - } - ``` - Expected response body: - ```json - { - "value": [35625, 46750] - } - ``` - """) - op floatMillisecondsArray( - @body body: FloatMillisecondsDurationArrayProperty, - ): FloatMillisecondsDurationArrayProperty; - - @route("/int32-seconds-larger-unit") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a duration property with int32 seconds encode where the duration is several minutes. - Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2) in C#. - Expected request body: - ```json - { - "value": 120 - } - ``` - Expected response body: - ```json - { - "value": 120 - } - ``` - """) - op int32SecondsLargerUnit( - @body body: Int32SecondsLargerUnitDurationProperty, - ): Int32SecondsLargerUnitDurationProperty; - - @route("/float-seconds-larger-unit") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a duration property with float seconds encode where the duration is several minutes. - Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2.5) in C#. - Expected request body: - ```json - { - "value": 150.0 - } - ``` - Expected response body: - ```json - { - "value": 150.0 - } - ``` - """) - op floatSecondsLargerUnit( - @body body: FloatSecondsLargerUnitDurationProperty, - ): FloatSecondsLargerUnitDurationProperty; - - @route("/int32-milliseconds-larger-unit") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a duration property with int32 milliseconds encode where the duration is several minutes. - Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3) in C#. - Expected request body: - ```json - { - "value": 180000 - } - ``` - Expected response body: - ```json - { - "value": 180000 - } - ``` - """) - op int32MillisecondsLargerUnit( - @body body: Int32MillisecondsLargerUnitDurationProperty, - ): Int32MillisecondsLargerUnitDurationProperty; - - @route("/float-milliseconds-larger-unit") - @scenario - @scenarioDoc(""" - Test operation with request and response model contains a duration property with float milliseconds encode where the duration is several minutes. - Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3.5) in C#. - Expected request body: - ```json - { - "value": 210000.0 - } - ``` - Expected response body: - ```json - { - "value": 210000.0 - } - ``` - """) - op floatMillisecondsLargerUnit( - @body body: FloatMillisecondsLargerUnitDurationProperty, - ): FloatMillisecondsLargerUnitDurationProperty; -} - -@route("/header") -namespace Header { - @route("/default") - @scenario - @scenarioDoc(""" - Test default encode for a duration header. - Expected header `input=P40D` - """) - op default( - @header - duration: duration, - ): NoContentResponse; - - @route("/iso8601") - @scenario - @scenarioDoc(""" - Test iso8601 encode for a duration header. - Expected header `duration: P40D` - """) - op iso8601( - @header - @encode(DurationKnownEncoding.ISO8601) - duration: duration, - ): NoContentResponse; - - @encode(DurationKnownEncoding.ISO8601) - scalar Iso8601Duration extends duration; - - @route("/iso8601-array") - @scenario - @scenarioDoc(""" - Test iso8601 encode for a duration array header. - Expected header `duration: [P40D,P50D]` - """) - op iso8601Array( - @header - duration: Iso8601Duration[], - ): NoContentResponse; - - @route("/int32-seconds") - @scenario - @scenarioDoc(""" - Test int32 seconds encode for a duration header. - Expected header `duration: 36` - """) - op int32Seconds( - @header - @encode(DurationKnownEncoding.seconds, int32) - duration: duration, - ): NoContentResponse; - - @route("/int32-seconds-larger-unit") - @scenario - @scenarioDoc(""" - Test int32 seconds encode for a duration header where the duration is several minutes. - Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2) in C#. - Expected header `duration: 120` - """) - op int32SecondsLargerUnit( - @header - @encode(DurationKnownEncoding.seconds, int32) - duration: duration, - ): NoContentResponse; - - @route("/float-seconds") - @scenario - @scenarioDoc(""" - Test float seconds encode for a duration header. - Expected header `duration: 35.625` - """) - op floatSeconds( - @header - @encode(DurationKnownEncoding.seconds, float) - duration: duration, - ): NoContentResponse; - - @route("/float-seconds-larger-unit") - @scenario - @scenarioDoc(""" - Test float seconds encode for a duration header where the duration is several minutes. - Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(2.5) in C#. - Expected header `duration: 150.0` - """) - op floatSecondsLargerUnit( - @header - @encode(DurationKnownEncoding.seconds, float) - duration: duration, - ): NoContentResponse; - - @route("/float64-seconds") - @scenario - @scenarioDoc(""" - Test float64 seconds encode for a duration header. - Expected header `duration: 35.625` - """) - op float64Seconds( - @header - @encode(DurationKnownEncoding.seconds, float64) - duration: duration, - ): NoContentResponse; - - @route("/int32-milliseconds") - @scenario - @scenarioDoc(""" - Test int32 milliseconds encode for a duration header. - Expected header `duration: 36000` - """) - op int32Milliseconds( - @header - @encode(DurationKnownEncoding.milliseconds, int32) - duration: duration, - ): NoContentResponse; - - @route("/int32-milliseconds-larger-unit") - @scenario - @scenarioDoc(""" - Test int32 milliseconds encode for a duration header where the duration is several minutes. - Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3) in C#. - Expected header `duration: 180000` - """) - op int32MillisecondsLargerUnit( - @header - @encode(DurationKnownEncoding.milliseconds, int32) - duration: duration, - ): NoContentResponse; - - @route("/float-milliseconds") - @scenario - @scenarioDoc(""" - Test float milliseconds encode for a duration header. - Expected header `duration: 35625` - """) - op floatMilliseconds( - @header - @encode(DurationKnownEncoding.milliseconds, float) - duration: duration, - ): NoContentResponse; - - @route("/float-milliseconds-larger-unit") - @scenario - @scenarioDoc(""" - Test float milliseconds encode for a duration header where the duration is several minutes. - Languages that support duration primitives should use the largest possible unit, e.g. TimeSpan.FromMinutes(3.5) in C#. - Expected header `duration: 210000.0` - """) - op floatMillisecondsLargerUnit( - @header - @encode(DurationKnownEncoding.milliseconds, float) - duration: duration, - ): NoContentResponse; - - @route("/float64-milliseconds") - @scenario - @scenarioDoc(""" - Test float64 milliseconds encode for a duration header. - Expected header `duration: 35625` - """) - op float64Milliseconds( - @header - @encode(DurationKnownEncoding.milliseconds, float64) - duration: duration, - ): NoContentResponse; - - @encode(DurationKnownEncoding.milliseconds, int32) - scalar Int32MillisecondsDuration extends duration; - - @route("/int32-milliseconds-array") - @scenario - @scenarioDoc(""" - Test int32 milliseconds encode for a duration array header. - Expected header `duration: [36000,47000]` - """) - op int32MillisecondsArray( - @header - duration: Int32MillisecondsDuration[], - ): NoContentResponse; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/mockapi.ts deleted file mode 100644 index e77b3f4ab90..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/encode/duration/mockapi.ts +++ /dev/null @@ -1,363 +0,0 @@ -import { - CollectionFormat, - json, - MockRequest, - passOnSuccess, - ScenarioMockApi, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createBodyServerTests(uri: string, data: any, value: any) { - return passOnSuccess({ - uri, - method: "post", - request: { - body: json(data), - }, - response: { - status: 200, - body: json(data), - }, - kind: "MockApiDefinition", - }); -} -Scenarios.Encode_Duration_Property_default = createBodyServerTests( - "/encode/duration/property/default", - { - value: "P40D", - }, - "P40D", -); -Scenarios.Encode_Duration_Property_floatSeconds = createBodyServerTests( - "/encode/duration/property/float-seconds", - { - value: 35.625, - }, - 35.625, -); -Scenarios.Encode_Duration_Property_float64Seconds = createBodyServerTests( - "/encode/duration/property/float64-seconds", - { - value: 35.625, - }, - 35.625, -); -Scenarios.Encode_Duration_Property_int32Seconds = createBodyServerTests( - "/encode/duration/property/int32-seconds", - { - value: 36, - }, - 36, -); -Scenarios.Encode_Duration_Property_iso8601 = createBodyServerTests( - "/encode/duration/property/iso8601", - { - value: "P40D", - }, - "P40D", -); -Scenarios.Encode_Duration_Property_floatSecondsArray = createBodyServerTests( - "/encode/duration/property/float-seconds-array", - { - value: [35.625, 46.75], - }, - [35.625, 46.75], -); - -Scenarios.Encode_Duration_Property_int32Milliseconds = createBodyServerTests( - "/encode/duration/property/int32-milliseconds", - { - value: 36000, - }, - 36000, -); -Scenarios.Encode_Duration_Property_floatMilliseconds = createBodyServerTests( - "/encode/duration/property/float-milliseconds", - { - value: 35625, - }, - 35625, -); -Scenarios.Encode_Duration_Property_float64Milliseconds = createBodyServerTests( - "/encode/duration/property/float64-milliseconds", - { - value: 35625, - }, - 35625, -); -Scenarios.Encode_Duration_Property_floatMillisecondsArray = createBodyServerTests( - "/encode/duration/property/float-milliseconds-array", - { - value: [35625, 46750], - }, - [35625, 46750], -); -Scenarios.Encode_Duration_Property_int32SecondsLargerUnit = createBodyServerTests( - "/encode/duration/property/int32-seconds-larger-unit", - { - value: 120, - }, - 120, -); -Scenarios.Encode_Duration_Property_floatSecondsLargerUnit = createBodyServerTests( - "/encode/duration/property/float-seconds-larger-unit", - { - value: 150.0, - }, - 150.0, -); -Scenarios.Encode_Duration_Property_int32MillisecondsLargerUnit = createBodyServerTests( - "/encode/duration/property/int32-milliseconds-larger-unit", - { - value: 180000, - }, - 180000, -); -Scenarios.Encode_Duration_Property_floatMillisecondsLargerUnit = createBodyServerTests( - "/encode/duration/property/float-milliseconds-larger-unit", - { - value: 210000.0, - }, - 210000.0, -); - -function createQueryServerTests( - uri: string, - paramData: any, - value: any, - collectionFormat?: CollectionFormat, -) { - return passOnSuccess({ - uri, - method: "get", - request: { - query: paramData, - }, - response: { - status: 204, - }, - handler: (req: MockRequest) => { - req.expect.containsQueryParam("input", value, collectionFormat); - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }); -} -Scenarios.Encode_Duration_Query_default = createQueryServerTests( - "/encode/duration/query/default", - { - input: "P40D", - }, - "P40D", -); -Scenarios.Encode_Duration_Query_iso8601 = createQueryServerTests( - "/encode/duration/query/iso8601", - { - input: "P40D", - }, - "P40D", -); -Scenarios.Encode_Duration_Query_int32Seconds = createQueryServerTests( - "/encode/duration/query/int32-seconds", - { - input: 36, - }, - "36", -); -Scenarios.Encode_Duration_Query_int32SecondsArray = createQueryServerTests( - "/encode/duration/query/int32-seconds-array", - { - input: [36, 47].join(","), - }, - ["36", "47"], - "csv", -); -Scenarios.Encode_Duration_Query_floatSeconds = createQueryServerTests( - "/encode/duration/query/float-seconds", - { - input: 35.625, - }, - "35.625", -); -Scenarios.Encode_Duration_Query_float64Seconds = createQueryServerTests( - "/encode/duration/query/float64-seconds", - { - input: 35.625, - }, - "35.625", -); - -Scenarios.Encode_Duration_Query_int32Milliseconds = createQueryServerTests( - "/encode/duration/query/int32-milliseconds", - { - input: 36000, - }, - "36000", -); -Scenarios.Encode_Duration_Query_floatMilliseconds = createQueryServerTests( - "/encode/duration/query/float-milliseconds", - { - input: 35625, - }, - "35625", -); -Scenarios.Encode_Duration_Query_float64Milliseconds = createQueryServerTests( - "/encode/duration/query/float64-milliseconds", - { - input: 35625, - }, - "35625", -); -Scenarios.Encode_Duration_Query_int32MillisecondsArray = createQueryServerTests( - "/encode/duration/query/int32-milliseconds-array", - { - input: [36000, 47000].join(","), - }, - ["36000", "47000"], - "csv", -); -Scenarios.Encode_Duration_Query_int32SecondsLargerUnit = createQueryServerTests( - "/encode/duration/query/int32-seconds-larger-unit", - { - input: 120, - }, - "120", -); -Scenarios.Encode_Duration_Query_floatSecondsLargerUnit = createQueryServerTests( - "/encode/duration/query/float-seconds-larger-unit", - { - input: 150, - }, - 150, -); -Scenarios.Encode_Duration_Query_int32MillisecondsLargerUnit = createQueryServerTests( - "/encode/duration/query/int32-milliseconds-larger-unit", - { - input: 180000, - }, - "180000", -); -Scenarios.Encode_Duration_Query_floatMillisecondsLargerUnit = createQueryServerTests( - "/encode/duration/query/float-milliseconds-larger-unit", - { - input: 210000, - }, - 210000, -); - -function createHeaderServerTests(uri: string, headersData: any, value: any) { - return passOnSuccess({ - uri, - method: "get", - request: { - headers: headersData, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }); -} - -Scenarios.Encode_Duration_Header_default = createHeaderServerTests( - "/encode/duration/header/default", - { - duration: "P40D", - }, - "P40D", -); -Scenarios.Encode_Duration_Header_iso8601 = createHeaderServerTests( - "/encode/duration/header/iso8601", - { - duration: "P40D", - }, - "P40D", -); -Scenarios.Encode_Duration_Header_int32Seconds = createHeaderServerTests( - "/encode/duration/header/int32-seconds", - { - duration: "36", - }, - "36", -); -Scenarios.Encode_Duration_Header_floatSeconds = createHeaderServerTests( - "/encode/duration/header/float-seconds", - { - duration: "35.625", - }, - "35.625", -); -Scenarios.Encode_Duration_Header_float64Seconds = createHeaderServerTests( - "/encode/duration/header/float64-seconds", - { - duration: "35.625", - }, - "35.625", -); -Scenarios.Encode_Duration_Header_iso8601Array = createHeaderServerTests( - "/encode/duration/header/iso8601-array", - { - duration: ["P40D", "P50D"].join(","), - }, - "P40D,P50D", -); - -Scenarios.Encode_Duration_Header_int32Milliseconds = createHeaderServerTests( - "/encode/duration/header/int32-milliseconds", - { - duration: "36000", - }, - "36000", -); -Scenarios.Encode_Duration_Header_floatMilliseconds = createHeaderServerTests( - "/encode/duration/header/float-milliseconds", - { - duration: "35625", - }, - "35625", -); -Scenarios.Encode_Duration_Header_float64Milliseconds = createHeaderServerTests( - "/encode/duration/header/float64-milliseconds", - { - duration: "35625", - }, - "35625", -); -Scenarios.Encode_Duration_Header_int32MillisecondsArray = createHeaderServerTests( - "/encode/duration/header/int32-milliseconds-array", - { - duration: ["36000", "47000"].join(","), - }, - "36000,47000", -); -Scenarios.Encode_Duration_Header_int32SecondsLargerUnit = createHeaderServerTests( - "/encode/duration/header/int32-seconds-larger-unit", - { - duration: "120", - }, - "120", -); -Scenarios.Encode_Duration_Header_floatSecondsLargerUnit = createHeaderServerTests( - "/encode/duration/header/float-seconds-larger-unit", - { - duration: "150", - }, - "150", -); -Scenarios.Encode_Duration_Header_int32MillisecondsLargerUnit = createHeaderServerTests( - "/encode/duration/header/int32-milliseconds-larger-unit", - { - duration: "180000", - }, - "180000", -); -Scenarios.Encode_Duration_Header_floatMillisecondsLargerUnit = createHeaderServerTests( - "/encode/duration/header/float-milliseconds-larger-unit", - { - duration: "210000", - }, - "210000", -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/main.tsp deleted file mode 100644 index 5677d2c673c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/main.tsp +++ /dev/null @@ -1,69 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test for encode decorator on integer.") -@scenarioService("/encode/numeric") -namespace Encode.Numeric; - -@route("/property") -namespace Property { - alias SendSafeIntAsString = SendIntAsString; - - @route("/safeint") - op safeintAsString is SendSafeIntAsString.sendIntAsString; - - model SafeintAsStringProperty { - @encode(string) - value: safeint; - } - - alias SendUint32AsString = SendIntAsString; - - @route("/uint32") - op uint32AsStringOptional is SendUint32AsString.sendIntAsString; - - model Uint32AsStringProperty { - @encode(string) - value?: uint32; - } - - alias SendUint8AsString = SendIntAsString; - - @route("/uint8") - op uint8AsString is SendUint8AsString.sendIntAsString; - - model Uint8AsStringProperty { - @encode(string) - value: uint8; - } - - interface SendIntAsString { - @scenario - @scenarioDoc( - """ - Test operation with request and response model contains property of {type} type with string encode. - Expected request body: - ```json - { - "value": "{value}" - } - ``` - Expected response body: - ```json - { - "value": "{value}" - } - ``` - """, - { - type: IntType, - value: StringValue, - } - ) - @post - sendIntAsString(@body value: Payload): Payload; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/mockapi.ts deleted file mode 100644 index fe5feaaed25..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/encode/numeric/mockapi.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createTests(uri: string, value: any) { - return passOnSuccess({ - uri, - method: "post", - request: { - body: json({ - value, - }), - }, - response: { - status: 200, - body: json({ value }), - }, - kind: "MockApiDefinition", - }); -} -Scenarios.Encode_Numeric_Property_safeintAsString = createTests( - "/encode/numeric/property/safeint", - "10000000000", -); -Scenarios.Encode_Numeric_Property_uint32AsStringOptional = createTests( - "/encode/numeric/property/uint32", - "1", -); -Scenarios.Encode_Numeric_Property_uint8AsString = createTests( - "/encode/numeric/property/uint8", - "255", -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/helper.ts b/packages/http-client-java/generator/http-client-generator-test/specs/helper.ts deleted file mode 100644 index 2fa9acec5ff..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/helper.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { resolvePath } from "@typespec/compiler"; -import { readFileSync } from "fs"; -import { fileURLToPath } from "url"; - -const root = resolvePath(fileURLToPath(import.meta.url), "../../../"); - -export const pngFile = readFileSync(resolvePath(root, "assets/image.png")); -export const jpgFile = readFileSync(resolvePath(root, "assets/image.jpg")); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/main.tsp deleted file mode 100644 index d797a05cec8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/main.tsp +++ /dev/null @@ -1,58 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test for basic parameters cases.") -@scenarioService("/parameters/basic") -namespace Parameters.Basic; - -@route("/explicit-body") -namespace ExplicitBody { - @doc("This is a simple model.") - model User { - name: string; - } - - @scenario - @scenarioDoc(""" - Test case for simple explicit body. - - Should generate request body model named `User`. - Should generate an operation like below: - ``` - spreadAsRequestBody(bodyParameter: BodyParameter) - ``` - Note the parameter name is guessed from the model name and it may vary by language. - - Expected request body: - ```json - { "name": "foo" } - ``` - """) - @route("/simple") - @put - op simple(@body body: User): NoContentResponse; -} - -@route("/implicit-body") -namespace ImplicitBody { - @scenario - @scenarioDoc(""" - Test case for simple implicit body. - - Should generate an operation like below: - ``` - simple(name: string) - ``` - - Expected request body: - ```json - { "name": "foo" } - ``` - """) - @route("/simple") - @put - op simple(name: string): NoContentResponse; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/mockapi.ts deleted file mode 100644 index dbe4976ec33..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/basic/mockapi.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; -function createServerTests(uri: string) { - return passOnSuccess({ - uri, - method: "put", - request: { - body: json({ - name: "foo", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }); -} - -Scenarios.Parameters_Basic_ExplicitBody_simple = createServerTests( - "/parameters/basic/explicit-body/simple", -); -Scenarios.Parameters_Basic_ImplicitBody_simple = createServerTests( - "/parameters/basic/implicit-body/simple", -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/main.tsp deleted file mode 100644 index 567f757df5e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/main.tsp +++ /dev/null @@ -1,63 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test describing optionality of the request body.") -@scenarioService("/parameters/body-optionality") -namespace Parameters.BodyOptionality; - -model BodyModel { - name: string; -} - -@scenario -@scenarioDoc(""" - Scenario defining how an explicit required body parameter is specified. - - Expected request body: - ```json - { "name": "foo" } - ``` - """) -@route("/required-explicit") -@post -op requiredExplicit(@body body: BodyModel): NoContentResponse; - -@scenario -@scenarioDoc(""" - Scenario defining how an explicit optional body parameter is specified. - - Expected request body for `set` - ```json - { "name": "foo" } - ``` - Expected Content-Type header: application/json - - Expected no request body for `omit` - Expected Content-Type header: must NOT be present - """) -@route("/optional-explicit") -namespace OptionalExplicit { - @route("/set") - @post - op set(@body body?: BodyModel): NoContentResponse; - - @route("/omit") - @post - op omit(@body body?: BodyModel): NoContentResponse; -} - -@scenario -@scenarioDoc(""" - Scenario defining how an implicit required body parameter is specified. - - Expected request body: - ```json - { "name": "foo" } - ``` - """) -@route("/required-implicit") -@post -op requiredImplicit(...BodyModel): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/mockapi.ts deleted file mode 100644 index f0350f1c176..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/body-optionality/mockapi.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { - json, - MockRequest, - passOnSuccess, - ScenarioMockApi, - ValidationError, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; -function createServerTests(uri: string, data: any) { - return passOnSuccess({ - uri, - method: "post", - request: { - body: json(data), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }); -} - -Scenarios.Parameters_BodyOptionality_requiredExplicit = createServerTests( - "/parameters/body-optionality/required-explicit", - { - name: "foo", - }, -); - -Scenarios.Parameters_BodyOptionality_OptionalExplicit = passOnSuccess([ - { - uri: "/parameters/body-optionality/optional-explicit/set", - method: "post", - request: { - body: json({ - name: "foo", - }), - }, - response: { - status: 204, - }, - handler: (req: MockRequest) => { - // Validate that Content-Type header is present when body is provided - req.expect.containsHeader("content-type", "application/json"); - return { status: 204 }; - }, - kind: "MockApiDefinition", - }, - { - uri: "/parameters/body-optionality/optional-explicit/omit", - method: "post", - request: {}, - response: { - status: 204, - }, - handler: (req: MockRequest) => { - req.expect.rawBodyEquals(undefined); - // Validate that Content-Type header is NOT present when body is omitted - const contentTypeHeader = req.headers["content-type"]; - if (contentTypeHeader !== undefined) { - throw new ValidationError( - "Content-Type header must NOT be present when body is omitted", - undefined, - contentTypeHeader, - ); - } - return { status: 204 }; - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Parameters_BodyOptionality_requiredImplicit = createServerTests( - "/parameters/body-optionality/required-implicit", - { - name: "foo", - }, -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/main.tsp deleted file mode 100644 index 620cf14c3f8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/main.tsp +++ /dev/null @@ -1,72 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test for collectionFormat.") -@scenarioService("/parameters/collection-format") -namespace Parameters.CollectionFormat; - -@route("/query") -namespace Query { - @scenario - @scenarioDoc(""" - This test is testing sending a multi collection format array query parameters - """) - @route("/multi") - op multi( - @doc("Possible values for colors are [blue,red,green]") - @query(#{ explode: true }) - colors: string[], - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - This test is testing sending a ssv collection format array query parameters - """) - @route("/ssv") - op ssv( - @doc("Possible values for colors are [blue,red,green]") - @query - @encode(ArrayEncoding.spaceDelimited) - colors: string[], - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - This test is testing sending a pipes collection format array query parameters - """) - @route("/pipes") - op pipes( - @doc("Possible values for colors are [blue,red,green]") - @query - @encode(ArrayEncoding.pipeDelimited) - colors: string[], - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - This test is testing sending a csv collection format array query parameters - """) - @route("/csv") - op csv( - @doc("Possible values for colors are [blue,red,green]") - @query - colors: string[], - ): NoContentResponse; -} - -@route("/header") -namespace Header { - @scenario - @scenarioDoc(""" - This test is testing sending a csv collection format array header parameters - """) - @route("/csv") - op csv( - @doc("Possible values for colors are [blue,red,green]") - @header - colors: string[], - ): NoContentResponse; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/mockapi.ts deleted file mode 100644 index 724b794c59c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/collection-format/mockapi.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { MockRequest, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const colors = ["blue", "red", "green"]; - -Scenarios.Parameters_CollectionFormat_Query_multi = passOnSuccess({ - uri: `/parameters/collection-format/query/multi`, - method: "get", - request: { - query: { colors: ["blue", "red", "green"] }, - }, - response: { - status: 204, - }, - handler: (req: MockRequest) => { - req.expect.containsQueryParam("colors", ["blue", "red", "green"], "multi"); - return { - status: 204, - }; - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_CollectionFormat_Query_csv = passOnSuccess({ - uri: `/parameters/collection-format/query/csv`, - method: "get", - request: { - query: { colors: colors.join(",") }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_CollectionFormat_Query_ssv = passOnSuccess({ - uri: `/parameters/collection-format/query/ssv`, - method: "get", - request: { - query: { colors: colors.join(" ") }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_CollectionFormat_Query_pipes = passOnSuccess({ - uri: `/parameters/collection-format/query/pipes`, - method: "get", - request: { - query: { colors: colors.join("|") }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_CollectionFormat_Header_csv = passOnSuccess({ - uri: `/parameters/collection-format/header/csv`, - method: "get", - request: { - headers: { colors: colors.join(",") }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/main.tsp deleted file mode 100644 index f985369972c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/main.tsp +++ /dev/null @@ -1,48 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test for path parameters cases.") -@scenarioService("/parameters/path") -namespace Parameters.Path; - -@scenario -@scenarioDoc(""" - Test case for normal path parameter. - - Should generate an operation like below: - ``` - normal(name: string) - ``` - - Expected request path: - ``` - /normal/foo - ``` - """) -@route("/normal/{name}") -op normal(@path name: string): NoContentResponse; - -@scenario -@scenarioDoc(""" - Test case for optional path parameter. - - Should generate an operation like below: - ``` - optional(name?: string) - ``` - - Expected two request: - First request path: - ``` - /optional - ``` - Second request path: - ``` - /optional/foo - ``` - """) -@route("/optional{/name}") -op optional(@path name?: string): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/mockapi.ts deleted file mode 100644 index 22eb68e9a1f..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/path/mockapi.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Parameters_Path_normal = passOnSuccess({ - uri: "/parameters/path/normal/foo", - method: "get", - - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_Path_optional = passOnSuccess([ - { - uri: "/parameters/path/optional", - method: "get", - - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: "/parameters/path/optional/foo", - method: "get", - - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/main.tsp deleted file mode 100644 index 5d8d3488445..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/main.tsp +++ /dev/null @@ -1,337 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test for the spread operator.") -@scenarioService("/parameters/spread") -namespace Parameters.Spread; - -@route("/model") -namespace Model { - @doc("This is a simple model.") - model BodyParameter { - name: string; - } - - @scenario - @scenarioDoc(""" - Test case for spread named model. - - Should not generate request body model named `BodyParameter`. - Should generate an operation like below: - ``` - spreadAsRequestBody(name: string) - ``` - Note the parameter name is guessed from the model name and it may vary by language. - - Expected request body: - ```json - { "name": "foo" } - ``` - """) - @route("/request-body") - @put - op spreadAsRequestBody(...BodyParameter): NoContentResponse; - - @doc("This is a model only with `@body` property.") - model CompositeRequestOnlyWithBody { - @body body: BodyParameter; - } - - @scenario - @scenarioDoc(""" - Test case for spread model only with `@body` property. - - Should generate request body model named `BodyParameter`. - Should not generate model named `CompositeRequestOnlyWithBody`. - Should generate an operation like below: - ``` - spreadCompositeRequestOnlyWithBody(bodyParameter: BodyParameter) - ``` - Note the parameter name is guessed from the model name and it may vary by language. - - Expected request body: - ```json - { "name": "foo" } - ``` - """) - @route("/composite-request-only-with-body") - @put - op spreadCompositeRequestOnlyWithBody(...CompositeRequestOnlyWithBody): NoContentResponse; - - @doc("This is a model without `@body` property.") - model CompositeRequestWithoutBody { - @path - name: string; - - @header - testHeader: string; - } - - @scenario - @scenarioDoc(""" - Test case for spread model without `@body` property. - - Should not generate model named `CompositeRequestOnlyWithBody`. - Should generate an operation like below: - ``` - spreadCompositeRequestWithoutBody(name: string, testHeader: string) - ``` - - Expected path parameter: name="foo" - Expected header parameter: testHeader="bar" - """) - @route("/composite-request-without-body/{name}") - @put - op spreadCompositeRequestWithoutBody(...CompositeRequestWithoutBody): NoContentResponse; - - @doc("This is a model with all http request decorator.") - model CompositeRequest { - @path - name: string; - - @header - testHeader: string; - - @body - body: BodyParameter; - } - - @scenario - @scenarioDoc(""" - Test case for spread model with all http request decorator. - - Should generate request body model named `BodyParameter`. - Should not generate model named `CompositeRequest`. - Should generate an operation like below: - ``` - spreadCompositeRequest(name: string, testHeader: string, bodyParameter: BodyParameter) - ``` - Note the parameter name is guessed from the model name and it may vary by language. - - Expected path parameter: name="foo" - Expected header parameter: testHeader="bar" - Expected request body: - ```json - { "name": "foo" } - ``` - """) - @route("/composite-request/{name}") - @put - op spreadCompositeRequest(...CompositeRequest): NoContentResponse; - - @doc("This is a model with non-body http request decorator.") - model CompositeRequestMix { - @path - name: string; - - @header - testHeader: string; - - prop: string; - } - - @scenario - @scenarioDoc(""" - Test case for spread model with non-body http request decorator. - - Should not generate model named `CompositeRequestMix`. - Should generate an operation like below: - ``` - spreadCompositeRequestMix(name: string, testHeader: string, prop: string) - ``` - Note the parameter name is guessed from the model name and it may vary by language. - - Expected path parameter: name="foo" - Expected header parameter: testHeader="bar" - Expected request body: - ```json - { "prop": "foo" } - ``` - """) - @route("/composite-request-mix/{name}") - @put - op spreadCompositeRequestMix(...CompositeRequestMix): NoContentResponse; -} - -@route("/alias") -namespace Alias { - alias BodyParameter = { - name: string; - }; - - @scenario - @scenarioDoc(""" - Test case for spread alias. - - Should not generate any model named `BodyParameter`. - Should generate an operation like: - ``` - spreadAsRequestBody(name: string) - ``` - - Expected request body: - ```json - { "name": "foo" } - ``` - """) - @route("/request-body") - @put - op spreadAsRequestBody(...BodyParameter): NoContentResponse; - - model InnerModel { - name: string; - } - - alias InnerModelParameter = { - @path - id: string; - - ...InnerModel; - - @header - `x-ms-test-header`: string; - }; - - @scenario - @scenarioDoc(""" - Test case for spread alias. - - Should not generate any model named `InnerModel`. - Should not generate any model named `InnerModelParameter`. - Should generate an operation like: - ``` - spreadParameterWithInnerModel(id: string, x_ms_test_header: string, name: string) - ``` - Note the parameter name is guessed from the model name and it may vary by language. - - Expected path parameter: id="1" - Expected header parameter: x-ms-test-header="bar" - Expected request body: - ```json - { "name": "foo" } - ``` - """) - @route("/inner-model-parameter/{id}") - @post - op spreadParameterWithInnerModel(...InnerModelParameter): NoContentResponse; - - alias RequestParameter = { - @path - id: string; - - @header - `x-ms-test-header`: string; - - name: string; - }; - - @scenario - @scenarioDoc(""" - Test case for spread alias with path and header parameter. - - Should not generate any model named `RequestParameter`. - Should generate an operation like below: - ``` - spreadAsRequestParameter(id: string, x_ms_test_header: string, name: string) - ``` - Note the parameter name may be normalized and vary by language. - - Expected path parameter: id="1" - Expected header parameter: x-ms-test-header="bar" - Expected request body: - ```json - { "name": "foo" } - ``` - """) - @route("/request-parameter/{id}") - @put - op spreadAsRequestParameter(...RequestParameter): NoContentResponse; - - alias MultipleRequestParameters = { - @path - id: string; - - @header - `x-ms-test-header`: string; - - /** required string */ - requiredString: string; - - /** optional int */ - optionalInt?: int32; - - /** required int */ - requiredIntList: int32[]; - - /** optional string */ - optionalStringList?: string[]; - }; - - @scenario - @scenarioDoc(""" - Test case for spread alias including 6 parameters. May handle as property bag for these parameters. - - Should not generate any model named `MultipleRequestParameters`. - Since it contains both optional properties and required properties, the method signature might vary across different languages. - Note it's also acceptable if some languages handle it as property bag. - - Expected path parameter: id="1" - Expected header parameter: x-ms-test-header="bar" - Expected request body: - ```json - { - "requiredString": "foo", - "optionalInt": 1, - "requiredIntList": [1, 2], - "optionalStringList": ["foo", "bar"] - } - ``` - """) - @route("/multiple-parameters/{id}") - @put - op spreadWithMultipleParameters(...MultipleRequestParameters): NoContentResponse; - - alias InnerAlias = { - @doc("name of the Thing") - name: string; - - @doc("age of the Thing") - age: int32; - }; - - alias InnerAliasParameter = { - @path id: string; - ...InnerAlias; - - @header - `x-ms-test-header`: string; - }; - - @scenario - @scenarioDoc(""" - Test case for spread alias with contains another alias property as body. - - Should not generate any model named `InnerAlias` and `InnerAliasParameter`. - Should generate an operation like below: - ``` - spreadParameterWithInnerAlias(id: string, name: string, age: int32, x_ms_test_header: string) - ``` - Note the parameter name is guessed from the model name and it may vary by language. - Expected path parameter: id="1" - Expected header parameter: x-ms-test-header="bar" - Expected request body: - ```json - { - "name": "foo", - "age": 1 - } - ``` - """) - @route("/inner-alias-parameter") - @doc("spread an alias with contains another alias property as body.") - @post - op spreadParameterWithInnerAlias(...InnerAliasParameter): NoContentResponse; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/mockapi.ts deleted file mode 100644 index 6e223f720bb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/parameters/spread/mockapi.ts +++ /dev/null @@ -1,165 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Parameters_Spread_Model_spreadAsRequestBody = passOnSuccess({ - uri: `/parameters/spread/model/request-body`, - method: "put", - request: { - body: json({ - name: "foo", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_Spread_Model_spreadCompositeRequestOnlyWithBody = passOnSuccess({ - uri: `/parameters/spread/model/composite-request-only-with-body`, - method: "put", - request: { - body: json({ - name: "foo", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_Spread_Model_spreadCompositeRequestWithoutBody = passOnSuccess({ - uri: `/parameters/spread/model/composite-request-without-body/foo`, - method: "put", - request: { - headers: { - "test-header": "bar", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_Spread_Model_spreadCompositeRequest = passOnSuccess({ - uri: `/parameters/spread/model/composite-request/foo`, - method: "put", - request: { - body: json({ - name: "foo", - }), - headers: { - "test-header": "bar", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_Spread_Model_spreadCompositeRequestMix = passOnSuccess({ - uri: `/parameters/spread/model/composite-request-mix/foo`, - method: "put", - request: { - body: json({ - prop: "foo", - }), - headers: { - "test-header": "bar", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_Spread_Alias_spreadAsRequestBody = passOnSuccess({ - uri: `/parameters/spread/alias/request-body`, - method: "put", - request: { - body: json({ - name: "foo", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_Spread_Alias_spreadAsRequestParameter = passOnSuccess({ - uri: `/parameters/spread/alias/request-parameter/1`, - method: "put", - request: { - body: json({ - name: "foo", - }), - headers: { - "x-ms-test-header": "bar", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_Spread_Alias_spreadWithMultipleParameters = passOnSuccess({ - uri: `/parameters/spread/alias/multiple-parameters/1`, - method: "put", - request: { - body: json({ - requiredString: "foo", - optionalInt: 1, - requiredIntList: [1, 2], - optionalStringList: ["foo", "bar"], - }), - headers: { - "x-ms-test-header": "bar", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_Spread_Alias_spreadParameterWithInnerModel = passOnSuccess({ - uri: `/parameters/spread/alias/inner-model-parameter/1`, - method: "post", - request: { - body: json({ - name: "foo", - }), - headers: { - "x-ms-test-header": "bar", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Parameters_Spread_Alias_spreadParameterWithInnerAlias = passOnSuccess({ - uri: `/parameters/spread/alias/inner-alias-parameter/1`, - method: "post", - request: { - body: json({ - name: "foo", - age: 1, - }), - headers: { - "x-ms-test-header": "bar", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/main.tsp deleted file mode 100644 index 7dc2ad3c3c8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/main.tsp +++ /dev/null @@ -1,61 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test describing optionality of the request body.") -@scenarioService("/content-negotiation") -namespace Payload.ContentNegotiation; - -@scenario -@scenarioDoc(""" - Scenario that returns a different file encoding depending on the accept header. - - - image/png return a png image - - image/jpeg return a jpeg image - """) -@route("same-body") -namespace SameBody { - model PngImage { - @header contentType: "image/png"; - @body image: bytes; - } - - model JpegImage { - @header contentType: "image/jpeg"; - @body image: bytes; - } - - @sharedRoute - op getAvatarAsPng(@header accept: "image/png"): PngImage; - - @sharedRoute - op getAvatarAsJpeg(@header accept: "image/jpeg"): JpegImage; -} - -@scenario -@scenarioDoc(""" - Scenario that a different payload depending on the accept header. - - - application/json return a png image in a Json object - - image/png return the png image - """) -@route("different-body") -namespace DifferentBody { - model PngImage { - @header contentType: "image/png"; - @body image: bytes; - } - - model PngImageAsJson { - @header contentType: "application/json"; - content: bytes; - } - - @sharedRoute - op getAvatarAsPng(@header accept: "image/png"): PngImage; - - @sharedRoute - op getAvatarAsJson(@header accept: "application/json"): PngImageAsJson; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/mockapi.ts deleted file mode 100644 index 355a82eaaad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/payload/content-negotiation/mockapi.ts +++ /dev/null @@ -1,188 +0,0 @@ -import { - json, - MockRequest, - ScenarioMockApi, - ValidationError, - withServiceKeys, -} from "@typespec/spec-api"; -import { jpgFile, pngFile } from "../../helper.js"; - -export const Scenarios: Record = {}; - -function sameBodyHandler(req: MockRequest) { - switch (req.headers["accept"]) { - case "image/png": - return { - pass: "image/png", - status: 200, - body: { - contentType: "image/png", - rawContent: pngFile, - }, - } as const; - case "image/jpeg": - return { - pass: "image/jpeg", - - status: 200, - body: { - contentType: "image/jpeg", - rawContent: jpgFile, - }, - } as const; - default: - throw new ValidationError( - "Unsupported Accept header", - `"image/png" | "image/jpeg"`, - req.headers["accept"], - ); - } -} - -function differentBodyHandler(req: MockRequest) { - switch (req.headers["accept"]) { - case "image/png": - return { - pass: "image/png", - status: 200, - body: { - contentType: "image/png", - rawContent: pngFile, - }, - } as const; - case "application/json": - return { - pass: "application/json", - status: 200, - body: json({ - content: pngFile.toString("base64"), - }), - } as const; - default: - throw new ValidationError( - "Unsupported Accept header", - `"image/png" | "application/json"`, - req.headers["accept"], - ); - } -} - -Scenarios.Payload_ContentNegotiation_SameBody = withServiceKeys(["image/png", "image/jpeg"]).pass([ - { - uri: "/content-negotiation/same-body", - method: "get", - request: { - headers: { - accept: "image/png", - }, - }, - response: { - body: { - contentType: "image/png", - rawContent: pngFile, - }, - status: 200, - }, - handler: (req) => sameBodyHandler(req), - kind: "MockApiDefinition", - }, - { - uri: "/content-negotiation/same-body", - method: "get", - request: { - headers: { - accept: "image/jpeg", - }, - }, - response: { - body: { - contentType: "image/jpeg", - rawContent: jpgFile, - }, - status: 200, - }, - handler: (req) => sameBodyHandler(req), - kind: "MockApiDefinition", - }, - { - uri: "/content-negotiation/same-body", - method: "get", - request: { - status: 400, - headers: { - accept: "wrongAccept", - }, - }, - response: { - status: 400, - body: json({ - message: "Unsupported Accept header", - expected: `"image/png" | "image/jpeg"`, - actual: "wrongAccept", - }), - }, - handler: sameBodyHandler, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Payload_ContentNegotiation_DifferentBody = withServiceKeys([ - "image/png", - "application/json", -]).pass([ - { - uri: "/content-negotiation/different-body", - method: "get", - request: { - headers: { - accept: "image/png", - }, - }, - response: { - status: 200, - body: { - contentType: "image/png", - rawContent: pngFile, - }, - }, - handler: differentBodyHandler, - kind: "MockApiDefinition", - }, - { - uri: "/content-negotiation/different-body", - method: "get", - request: { - headers: { - accept: "application/json", - }, - }, - response: { - status: 200, - body: json({ - content: pngFile.toString("base64"), - }), - }, - handler: differentBodyHandler, - kind: "MockApiDefinition", - }, - { - uri: "/content-negotiation/different-body", - method: "get", - request: { - status: 400, - headers: { - accept: "wrongAccept", - }, - }, - response: { - status: 400, - body: json({ - message: "Unsupported Accept header", - expected: `"image/png" | "application/json"`, - actual: "wrongAccept", - }), - }, - handler: differentBodyHandler, - kind: "MockApiDefinition", - }, -]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/main.tsp deleted file mode 100644 index cb2ae6bc02a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/main.tsp +++ /dev/null @@ -1,184 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test for merge-patch+json content-type") -@scenarioService("/json-merge-patch") -namespace Payload.JsonMergePatch; - -@doc("Details about a resource.") -model Resource { - name: string; - description?: string; - map?: Record; - array?: InnerModel[]; - intValue?: int32; - floatValue?: float32; - innerModel?: InnerModel; - intArray?: int32[]; -} - -@doc("Details about a resource for patch operation.") -model ResourcePatch { - description?: string; - map?: Record; - array?: InnerModel[]; - intValue?: int32; - floatValue?: float32; - innerModel?: InnerModel; - intArray?: int32[]; -} - -@doc("It is the model used by Resource model") -model InnerModel { - name?: string; - description?: string; -} - -@scenario -@scenarioDoc(""" - - Expected input body: - ```json - { - "name": "Madge", - "description": "desc", - "map": { - "key": { - "name": "InnerMadge", - "description": "innerDesc" - } - }, - "array": [ - { - "name": "InnerMadge", - "description": "innerDesc" - } - ], - "intValue": 1, - "floatValue": 1.25, - "innerModel": { - "name": "InnerMadge", - "description": "innerDesc" - }, - "intArray": [1, 2, 3] - } - ``` - - Expected response body: - ```json - { - "name": "Madge", - "description": "desc", - "map": { - "key": { - "name": "InnerMadge", - "description": "innerDesc" - } - }, - "array": [ - { - "name": "InnerMadge", - "description": "innerDesc" - } - ], - "intValue": 1, - "floatValue": 1.25, - "innerModel": { - "name": "InnerMadge", - "description": "innerDesc" - }, - "intArray": [1, 2, 3] - } - ``` - """) -@doc("Test content-type: application/merge-patch+json with required body") -@route("/create/resource") -@put -op createResource(@body body: Resource): Resource; - -@scenario -@scenarioDoc(""" - Should serialize null values with merge-patch+json enabled. - - Expected input body: - ```json - { - "description": null, - "map": { - "key": { - "description": null - }, - "key2": null - }, - "array": null, - "intValue": null, - "floatValue": null, - "innerModel": null, - "intArray": null - } - ``` - - Expected response body: - ```json - { - name: "Madge", - map: { - key: { - name: "InnerMadge" - } - } - } - ``` - """) -@doc("Test content-type: application/merge-patch+json with required body") -@route("/update/resource") -@patch -op updateResource( - @header("content-type") contentType: "application/merge-patch+json", - @body body: ResourcePatch, -): Resource; - -@scenario -@scenarioDoc(""" - Should serialize null values with merge-patch+json enabled. - - Expected input body: - ```json - { - "description": null, - "map": { - "key": { - "description": null - }, - "key2": null - }, - "array": null, - "intValue": null, - "floatValue": null, - "innerModel": null, - "intArray": null - } - ``` - - Expected response body: - ```json - { - name: "Madge", - map: { - key: { - name: "InnerMadge" - } - } - } - ``` - """) -@doc("Test content-type: application/merge-patch+json with optional body") -@route("/update/resource/optional") -@patch -op updateOptionalResource( - @header("content-type") contentType: "application/merge-patch+json", - @body body?: ResourcePatch, -): Resource; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/mockapi.ts deleted file mode 100644 index 0f1412a1b75..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/payload/json-merge-patch/mockapi.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -export const expectedCreateBody = { - name: "Madge", - description: "desc", - map: { - key: { - name: "InnerMadge", - description: "innerDesc", - }, - }, - array: [ - { - name: "InnerMadge", - description: "innerDesc", - }, - ], - intValue: 1, - floatValue: 1.25, - innerModel: { - name: "InnerMadge", - description: "innerDesc", - }, - intArray: [1, 2, 3], -}; - -export const expectedUpdateBody = { - description: null, - map: { - key: { - description: null, - }, - key2: null, - }, - array: null, - intValue: null, - floatValue: null, - innerModel: null, - intArray: null, -}; - -Scenarios.Payload_JsonMergePatch_createResource = passOnSuccess({ - uri: "/json-merge-patch/create/resource", - method: "put", - request: { - body: json(expectedCreateBody), - }, - response: { - status: 200, - body: json(expectedCreateBody), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Payload_JsonMergePatch_updateResource = passOnSuccess({ - uri: "/json-merge-patch/update/resource", - method: "patch", - request: { - body: json(expectedUpdateBody), - }, - response: { - status: 200, - body: json({ - name: "Madge", - map: { - key: { - name: "InnerMadge", - }, - }, - }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Payload_JsonMergePatch_updateOptionalResource = passOnSuccess({ - uri: "/json-merge-patch/update/resource/optional", - method: "patch", - request: { - body: json(expectedUpdateBody), - }, - response: { - status: 200, - body: json({ - name: "Madge", - map: { - key: { - name: "InnerMadge", - }, - }, - }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/main.tsp deleted file mode 100644 index 3ced443cbbc..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/main.tsp +++ /dev/null @@ -1,52 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -/** - * Test the payload with different media types and different types of the payload itself. - */ -@scenarioService("/payload/media-type") -namespace Payload.MediaType; - -@route("/string-body") -namespace StringBody { - @scenario - @scenarioDoc(""" - Expected request body is a string '{cat}'. - """) - @post - @route("/sendAsText") - op sendAsText(@header contentType: "text/plain", @body text: string): OkResponse; - - @scenario - @scenarioDoc(""" - Expected response body is a string '{cat}'. - """) - @get - @route("/getAsText") - op getAsText(): { - @header contentType: "text/plain"; - @body text: string; - }; - - @scenario - @scenarioDoc(""" - Expected request body is "foo". - """) - @post - @route("/sendAsJson") - op sendAsJson(@header contentType: "application/json", @body text: string): OkResponse; - - @scenario - @scenarioDoc(""" - Expected response body is "foo". - """) - @get - @route("/getAsJson") - op getAsJson(): { - @header contentType: "application/json"; - @body text: string; - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/mockapi.ts deleted file mode 100644 index 159931f4dd9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/payload/media-type/mockapi.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Payload_MediaType_StringBody_sendAsText = passOnSuccess({ - uri: "/payload/media-type/string-body/sendAsText", - method: "post", - request: { - body: json("{cat}"), - headers: { - "Content-Type": "text/plain", - }, - }, - response: { - status: 200, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Payload_MediaType_StringBody_getAsText = passOnSuccess({ - uri: "/payload/media-type/string-body/getAsText", - method: "get", - request: { - headers: { - accept: "text/plain", - }, - }, - response: { - status: 200, - body: { rawContent: "{cat}", contentType: "text/plain" }, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Payload_MediaType_StringBody_sendAsJson = passOnSuccess({ - uri: "/payload/media-type/string-body/sendAsJson", - method: "post", - request: { - body: json("foo"), - headers: { - "Content-Type": "application/json", - }, - }, - response: { - status: 200, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Payload_MediaType_StringBody_getAsJson = passOnSuccess({ - uri: "/payload/media-type/string-body/getAsJson", - method: "get", - request: { - headers: { - accept: "application/json", - }, - }, - response: { - status: 200, - body: json("foo"), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/main.tsp deleted file mode 100644 index 618f0ba18b5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/main.tsp +++ /dev/null @@ -1,502 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Test for multipart") -@scenarioService("/multipart") -namespace Payload.MultiPart; - -model MultiPartRequest { - id: HttpPart; - profileImage: HttpPart; -} - -model Address { - city: string; -} - -model FileSpecificContentType extends File { - filename: string; - contentType: "image/jpg"; -} - -model FileWithHttpPartSpecificContentTypeRequest { - profileImage: HttpPart; -} - -model FileRequiredMetaData extends File { - filename: string; - contentType: string; -} - -model FileWithHttpPartRequiredContentTypeRequest { - profileImage: HttpPart; -} - -model FileOptionalContentType extends File { - filename: string; -} - -model FileWithHttpPartOptionalContentTypeRequest { - profileImage: HttpPart; -} - -model ComplexHttpPartsModelRequest { - id: HttpPart; - address: HttpPart
; - profileImage: HttpPart; - previousAddresses: HttpPart; - pictures: HttpPart[]; -} - -model ComplexPartsRequest { - id: HttpPart; - address: HttpPart
; - profileImage: HttpPart; - pictures: HttpPart[]; -} - -model JsonPartRequest { - address: HttpPart
; - profileImage: HttpPart; -} - -model BinaryArrayPartsRequest { - id: HttpPart; - pictures: HttpPart[]; -} - -model MultiBinaryPartsRequest { - profileImage: HttpPart; - picture?: HttpPart; -} - -@route("/form-data") -namespace FormData { - @scenario - @scenarioDoc(""" - Expect request ( - - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.4, content-type of file part shall be labeled with - appropriate media type, server will check it; content-type of other parts is optional, server will ignore it. - - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.2, filename of file part SHOULD be supplied. - If there are duplicated filename in same fieldName, server can't parse them all. - ): - ``` - POST /upload HTTP/1.1 - Content-Length: 428 - Content-Type: multipart/form-data; boundary=abcde12345 - - --abcde12345 - Content-Disposition: form-data; name="id" - Content-Type: text/plain - - 123 - --abcde12345 - Content-Disposition: form-data; name="profileImage"; filename="" - Content-Type: application/octet-stream; - - {…file content of .jpg file…} - --abcde12345-- - ``` - """) - @doc("Test content-type: multipart/form-data") - @post - @route("/mixed-parts") - op basic( - @header contentType: "multipart/form-data", - @multipartBody body: MultiPartRequest, - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - Expect request ( - - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.4, content-type of file part shall be labeled with - appropriate media type, server will check it; content-type of other parts is optional, server will ignore it. - - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.2, filename of file part SHOULD be supplied. - If there are duplicated filename in same fieldName, server can't parse them all. - ): - ``` - POST /upload HTTP/1.1 - Content-Length: 428 - Content-Type: multipart/form-data; boundary=abcde12345 - - --abcde12345 - Content-Disposition: form-data; name="id" - Content-Type: text/plain - - 123 - --abcde12345 - Content-Disposition: form-data; name="address" - Content-Type: application/json - - { - "city": "X" - } - --abcde12345 - Content-Disposition: form-data; name="profileImage"; filename="" - Content-Type: application/octet-stream - - {…file content of .jpg file…} - --abcde12345-- - Content-Disposition: form-data; name="previousAddresses" - Content-Type: application/json - - [{ - "city": "Y" - },{ - "city": "Z" - }] - --abcde12345 - Content-Disposition: form-data; name="pictures"; filename="" - Content-Type: application/octet-stream - - {…file content of .png file…} - --abcde12345 - Content-Disposition: form-data; name="pictures"; filename="" - Content-Type: application/octet-stream - - {…file content of .png file…} - --abcde12345-- - ``` - """) - @doc("Test content-type: multipart/form-data for mixed scenarios") - @post - @route("/complex-parts") - op fileArrayAndBasic( - @header contentType: "multipart/form-data", - @multipartBody body: ComplexPartsRequest, - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - Expect request ( - - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.4, content-type of file part shall be labeled with - appropriate media type, server will check it; content-type of other parts is optional, server will ignore it. - - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.2, filename of file part SHOULD be supplied. - If there are duplicated filename in same fieldName, server can't parse them all. - ): - ``` - POST /upload HTTP/1.1 - Content-Length: 428 - Content-Type: multipart/form-data; boundary=abcde12345 - - --abcde12345 - Content-Disposition: form-data; name="address" - Content-Type: application/json - - { - "city": "X" - } - --abcde12345 - Content-Disposition: form-data; name="profileImage"; filename="" - Content-Type: application/octet-stream - - {…file content of .jpg file…} - --abcde12345-- - ``` - """) - @doc("Test content-type: multipart/form-data for scenario contains json part and binary part ") - @post - @route("/json-part") - op jsonPart( - @header contentType: "multipart/form-data", - @multipartBody body: JsonPartRequest, - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - Expect request ( - - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.4, content-type of file part shall be labeled with - appropriate media type, server will check it; content-type of other parts is optional, server will ignore it. - - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.2, filename of file part SHOULD be supplied. - If there are duplicated filename in same fieldName, server can't parse them all. - ): - ``` - POST /upload HTTP/1.1 - Content-Length: 428 - Content-Type: multipart/form-data; boundary=abcde12345 - - --abcde12345 - Content-Disposition: form-data; name="id" - Content-Type: text/plain - - 123 - --abcde12345 - Content-Disposition: form-data; name="pictures"; filename="" - Content-Type: application/octet-stream - - {…file content of .png file…} - --abcde12345 - Content-Disposition: form-data; name="pictures"; filename="" - Content-Type: application/octet-stream - - {…file content of .png file…} - --abcde12345-- - ``` - """) - @doc("Test content-type: multipart/form-data for scenario contains multi binary parts") - @post - @route("/binary-array-parts") - op binaryArrayParts( - @header contentType: "multipart/form-data", - @multipartBody body: BinaryArrayPartsRequest, - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - Please send request twice, first time with only profileImage, second time with both profileImage and picture( - - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.4, content-type of file part shall be labeled with - appropriate media type, server will check it; content-type of other parts is optional, server will ignore it. - - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.2, filename of file part SHOULD be supplied. - If there are duplicated filename in same fieldName, server can't parse them all. - ): - ``` - POST /upload HTTP/1.1 - Content-Length: 428 - Content-Type: multipart/form-data; boundary=abcde12345 - - --abcde12345 - Content-Disposition: form-data; name="profileImage"; filename="" - Content-Type: application/octet-stream - - {…file content of .jpg file…} - --abcde12345 - Content-Disposition: form-data; name="picture"; filename="" - Content-Type: application/octet-stream - - {…file content of .png file…} - --abcde12345-- - ``` - """) - @doc("Test content-type: multipart/form-data for scenario contains multi binary parts") - @post - @route("/multi-binary-parts") - op multiBinaryParts( - @header contentType: "multipart/form-data", - @multipartBody body: MultiBinaryPartsRequest, - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - this case will check filename and content-type of file part, so expect request: - ``` - POST /upload HTTP/1.1 - Content-Length: 428 - Content-Type: multipart/form-data; boundary=abcde12345 - - --abcde12345 - Content-Disposition: form-data; name="id" - Content-Type: text/plain - - 123 - --abcde12345 - Content-Disposition: form-data; name="profileImage"; filename="hello.jpg" - Content-Type: image/jpg - - {…file content of .jpg file…} - --abcde12345-- - ``` - """) - @doc("Test content-type: multipart/form-data") - @post - @route("/check-filename-and-content-type") - op checkFileNameAndContentType( - @header contentType: "multipart/form-data", - @multipartBody body: MultiPartRequest, - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - Expect request ( - - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.4, content-type of file part shall be labeled with - appropriate media type, server will check it; content-type of other parts is optional, server will ignore it. - - according to https://datatracker.ietf.org/doc/html/rfc7578#section-4.2, filename of file part SHOULD be supplied. - If there are duplicated filename in same filedName, server can't parse them all. - ): - ``` - POST /multipart/form-data/anonymous-model HTTP/1.1 - Content-Length: 428 - Content-Type: multipart/form-data; boundary=abcde12345 - - --abcde12345 - Content-Disposition: form-data; name="profileImage"; filename="" - Content-Type: application/octet-stream; - - {…file content of .jpg file…} - --abcde12345-- - ``` - """) - @doc("Test content-type: multipart/form-data") - @post - @route("/anonymous-model") - op anonymousModel( - @header contentType: "multipart/form-data", - @multipartBody body: { - profileImage: HttpPart; - }, - ): NoContentResponse; - - namespace HttpParts { - namespace ContentType { - @scenario - @scenarioDoc(""" - This case will check filename and specific content-type of file part, so expect request: - ``` - POST /upload HTTP/1.1 - Content-Length: 428 - Content-Type: multipart/form-data; boundary=abcde12345 - - --abcde12345 - Content-Disposition: form-data; name="profileImage"; filename="hello.jpg" - Content-Type: image/jpg - - {…file content of .jpg file…} - --abcde12345-- - ``` - """) - @doc("Test content-type: multipart/form-data") - @post - @route("/check-filename-and-specific-content-type-with-httppart") - op imageJpegContentType( - @header contentType: "multipart/form-data", - @multipartBody body: FileWithHttpPartSpecificContentTypeRequest, - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - This case will check required content-type of file part, so expect request: - ``` - POST /upload HTTP/1.1 - Content-Length: 428 - Content-Type: multipart/form-data; boundary=abcde12345 - - --abcde12345 - Content-Disposition: form-data; name="profileImage"; filename="" - Content-Type: application/octet-stream - - {…file content of .jpg file…} - --abcde12345-- - ``` - """) - @doc("Test content-type: multipart/form-data") - @post - @route("/check-filename-and-required-content-type-with-httppart") - op requiredContentType( - @header contentType: "multipart/form-data", - @multipartBody body: FileWithHttpPartRequiredContentTypeRequest, - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - Please send request twice, first time with no content-type and second time with content-type "application/octet-stream". Expect request: - ``` - POST /upload HTTP/1.1 - Content-Length: 428 - Content-Type: multipart/form-data; boundary=abcde12345 - - --abcde12345 - Content-Disposition: form-data; name="profileImage"; filename="" - Content-Type: application/octet-stream - - {…file content of .jpg file…} - --abcde12345 - ``` - """) - @doc("Test content-type: multipart/form-data for optional content type") - @post - @route("/file-with-http-part-optional-content-type") - op optionalContentType( - @header contentType: "multipart/form-data", - @multipartBody body: FileWithHttpPartOptionalContentTypeRequest, - ): NoContentResponse; - } - @scenario - @scenarioDoc(""" - For File part, filename will not be checked but it is necessary otherwise server can't parse it; - content-type will be checked with value "application/octet-stream". Expect request: - ``` - POST /upload HTTP/1.1 - Content-Length: 428 - Content-Type: multipart/form-data; boundary=abcde12345 - - --abcde12345 - Content-Disposition: form-data; name="id" - Content-Type: text/plain - - 123 - --abcde12345 - Content-Disposition: form-data; name="address" - Content-Type: application/json - - { - "city": "X" - } - --abcde12345 - Content-Disposition: form-data; name="profileImage"; filename="" - Content-Type: application/octet-stream - - {…file content of .jpg file…} - --abcde12345-- - Content-Disposition: form-data; name="previousAddresses" - Content-Type: application/json - - [{ - "city": "Y" - },{ - "city": "Z" - }] - --abcde12345 - Content-Disposition: form-data; name="pictures"; filename="" - Content-Type: application/octet-stream - - {…file content of .png file…} - --abcde12345 - Content-Disposition: form-data; name="pictures"; filename="" - Content-Type: application/octet-stream - - {…file content of .png file…} - --abcde12345-- - ``` - """) - @doc("Test content-type: multipart/form-data for mixed scenarios") - @post - @route("/complex-parts-with-httppart") - op jsonArrayAndFileArray( - @header contentType: "multipart/form-data", - @multipartBody body: ComplexHttpPartsModelRequest, - ): NoContentResponse; - - namespace NonString { - @scenario - @scenarioDoc(""" - Expect request: - ``` - POST /upload HTTP/1.1 - Content-Length: 428 - Content-Type: multipart/form-data; boundary=abcde12345 - - --abcde12345 - Content-Disposition: form-data; name="temperature" - Content-Type: text/plain - - 0.5 - --abcde12345 - ``` - """) - @doc("Test content-type: multipart/form-data for non string") - @post - @route("/non-string-float") - op float( - @header contentType: "multipart/form-data", - @multipartBody body: { - temperature: HttpPart<{ - @body body: float64; - @header contentType: "text/plain"; - }>; - }, - ): NoContentResponse; - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/mockapi.ts deleted file mode 100644 index 0c78709535a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/payload/multipart/mockapi.ts +++ /dev/null @@ -1,347 +0,0 @@ -import { - MockRequest, - multipart, - passOnSuccess, - ScenarioMockApi, - ValidationError, - withServiceKeys, -} from "@typespec/spec-api"; -import { jpgFile, pngFile } from "../../helper.js"; - -export const Scenarios: Record = {}; - -function checkId(req: MockRequest) { - req.expect.deepEqual(req.body.id, "123"); -} - -function checkAddress(req: MockRequest) { - req.expect.deepEqual(JSON.parse(req.body.address), { city: "X" }); -} - -function checkPreviousAddresses(req: MockRequest) { - req.expect.deepEqual(JSON.parse(req.body.previousAddresses), [{ city: "Y" }, { city: "Z" }]); -} - -function checkFile( - req: MockRequest, - file: Record, - expected: Buffer, - contentType: string = "application/octet-stream", - fileName: string | undefined = undefined, - mustCheckContentType: boolean = true, -) { - // server depends on multer, which sets the mimetype to "text/plain" if this part has no content-type header - if (mustCheckContentType || file.mimetype !== "text/plain") { - req.expect.deepEqual(file.mimetype, contentType); - } - req.expect.deepEqual(file.buffer, expected); - if (fileName) { - req.expect.deepEqual(file.originalname, fileName); - } -} - -function checkJpgFile( - req: MockRequest, - file: Record, - contentType: string = "application/octet-stream", - fileName: string | undefined = undefined, - mustCheckContentType: boolean = true, -) { - req.expect.deepEqual(file.fieldname, "profileImage"); - checkFile(req, file, jpgFile, contentType, fileName, mustCheckContentType); -} - -function checkOptionalContentType(req: MockRequest) { - if (req.files instanceof Array && req.files?.length > 0) { - checkJpgFile(req, req.files[0], "application/octet-stream", undefined, false); - } else { - throw new ValidationError("No profileImage found", "jpg file is expected", req.body); - } -} - -function checkPngFile(req: MockRequest, file: Record, fieldName: string = "pictures") { - req.expect.deepEqual(file.fieldname, fieldName); - checkFile(req, file, pngFile); -} - -function checkProfileImage(req: MockRequest) { - if (req.files instanceof Array && req.files?.length > 0) { - checkJpgFile(req, req.files[0]); - } else { - throw new ValidationError("No profileImage found", "jpg file is expected", req.body); - } -} - -function checkFileNameAndContentType(req: MockRequest) { - if (req.files instanceof Array && req.files?.length > 0) { - checkJpgFile(req, req.files[0], "image/jpg", "hello.jpg"); - } else { - throw new ValidationError("No profileImage found", "jpg file is expected", req.body); - } -} - -function checkAllFiles(req: MockRequest) { - if (req.files instanceof Array && req.files?.length === 3) { - for (const file of req.files) { - if (file.fieldname === "profileImage") { - checkJpgFile(req, file); - } else if (file.fieldname === "pictures") { - checkPngFile(req, file); - } else { - throw new ValidationError( - "unexpected fieldname", - "profileImage or pictures", - file.fieldname, - ); - } - } - } else { - throw new ValidationError( - "Can't parse files from request", - "jpg/png files are expected", - req.body, - ); - } -} -function checkPictures(req: MockRequest) { - if (req.files instanceof Array && req.files?.length === 2) { - for (const file of req.files) { - checkPngFile(req, file); - } - } else { - throw new ValidationError("No pictures found", "png files are expected", req.body); - } -} -function checkFloat(req: MockRequest) { - req.expect.deepEqual(parseFloat(req.body.temperature), 0.5); -} -const files = [ - { - fieldname: "profileImage", - originalname: "image.jpg", - buffer: jpgFile, - mimetype: "application/octet-stream", - }, - { - fieldname: "pictures", - originalname: "image.png", - buffer: pngFile, - mimetype: "application/octet-stream", - }, -]; -function createHandler(req: MockRequest, checkList: ((req: MockRequest) => void)[]) { - for (const callback of checkList) { - callback(req); - } - return { status: 204 }; -} - -function createMultiBinaryPartsHandler(req: MockRequest) { - if (req.files instanceof Array) { - switch (req.files.length) { - case 1: - checkJpgFile(req, req.files[0]); - return { pass: "profileImage", status: 204 } as const; - case 2: - let profileImage = false; - let picture = false; - for (const file of req.files) { - if (file.fieldname === "profileImage") { - checkJpgFile(req, file); - profileImage = true; - } else if (file.fieldname === "picture") { - checkPngFile(req, file, "picture"); - picture = true; - } else { - throw new ValidationError( - "unexpected fieldname", - "profileImage or picture", - file.fieldname, - ); - } - } - if (!profileImage) { - throw new ValidationError("No profileImage found", "jpg file is expected", req.body); - } else if (!picture) { - throw new ValidationError("No picture found", "png file are expected", req.body); - } - return { pass: "profileImage,picture", status: 204 } as const; - default: - throw new ValidationError( - "number of files is incorrect", - "1 or 2 files are expected", - req.body, - ); - } - } else { - throw new ValidationError( - "Can't parse files from request", - "jpg/png files are expected", - req.body, - ); - } -} - -Scenarios.Payload_MultiPart_FormData_basic = passOnSuccess({ - uri: "/multipart/form-data/mixed-parts", - method: "post", - request: { - body: multipart({ parts: { id: 123 }, files: [files[0]] }), - }, - response: { status: 204 }, - handler: (req: MockRequest) => createHandler(req, [checkId, checkProfileImage]), - kind: "MockApiDefinition", -}); -Scenarios.Payload_MultiPart_FormData_fileArrayAndBasic = passOnSuccess({ - uri: "/multipart/form-data/complex-parts", - method: "post", - request: { - body: multipart({ - parts: { id: 123, address: { city: "X" } }, - files: [files[0], files[1], files[1]], - }), - }, - response: { status: 204 }, - handler: (req: MockRequest) => createHandler(req, [checkId, checkAddress, checkAllFiles]), - kind: "MockApiDefinition", -}); -Scenarios.Payload_MultiPart_FormData_jsonPart = passOnSuccess({ - uri: "/multipart/form-data/json-part", - method: "post", - request: { - body: multipart({ parts: { address: { city: "X" } }, files: [files[0]] }), - }, - response: { status: 204 }, - handler: (req: MockRequest) => createHandler(req, [checkAddress, checkProfileImage]), - kind: "MockApiDefinition", -}); -Scenarios.Payload_MultiPart_FormData_binaryArrayParts = passOnSuccess({ - uri: "/multipart/form-data/binary-array-parts", - method: "post", - request: { - body: multipart({ parts: { id: 123 }, files: [files[1], files[1]] }), - }, - response: { status: 204 }, - handler: (req: MockRequest) => createHandler(req, [checkId, checkPictures]), - kind: "MockApiDefinition", -}); -Scenarios.Payload_MultiPart_FormData_multiBinaryParts = withServiceKeys([ - "profileImage", - "profileImage,picture", -]).pass([ - { - uri: "/multipart/form-data/multi-binary-parts", - method: "post", - request: { - body: multipart({ - files: [files[0]], - }), - }, - response: { status: 204 }, - handler: createMultiBinaryPartsHandler, - kind: "MockApiDefinition", - }, - { - uri: "/multipart/form-data/multi-binary-parts", - method: "post", - request: { - body: multipart({ - files: [files[0], { ...files[1], fieldname: "picture" }], - }), - }, - response: { status: 204 }, - handler: createMultiBinaryPartsHandler, - kind: "MockApiDefinition", - }, -]); -Scenarios.Payload_MultiPart_FormData_checkFileNameAndContentType = passOnSuccess({ - uri: "/multipart/form-data/check-filename-and-content-type", - method: "post", - request: { - body: multipart({ - parts: { id: 123 }, - files: [{ ...files[0], mimetype: "image/jpg", originalname: "hello.jpg" }], - }), - }, - response: { status: 204 }, - handler: (req: MockRequest) => createHandler(req, [checkId, checkFileNameAndContentType]), - kind: "MockApiDefinition", -}); -Scenarios.Payload_MultiPart_FormData_anonymousModel = passOnSuccess({ - uri: "/multipart/form-data/anonymous-model", - method: "post", - request: { - body: multipart({ - files: [files[0]], - }), - }, - response: { status: 204 }, - handler: (req: MockRequest) => createHandler(req, [checkProfileImage]), - kind: "MockApiDefinition", -}); -Scenarios.Payload_MultiPart_FormData_HttpParts_ContentType_imageJpegContentType = passOnSuccess({ - uri: "/multipart/form-data/check-filename-and-specific-content-type-with-httppart", - method: "post", - request: { - body: multipart({ - files: [{ ...files[0], mimetype: "image/jpg", originalname: "hello.jpg" }], - }), - }, - response: { status: 204 }, - handler: (req: MockRequest) => createHandler(req, [checkFileNameAndContentType]), - kind: "MockApiDefinition", -}); -Scenarios.Payload_MultiPart_FormData_HttpParts_ContentType_requiredContentType = passOnSuccess({ - uri: "/multipart/form-data/check-filename-and-required-content-type-with-httppart", - method: "post", - request: { - body: multipart({ - files: [files[0]], - }), - }, - response: { status: 204 }, - handler: (req: MockRequest) => createHandler(req, [checkProfileImage]), - kind: "MockApiDefinition", -}); -Scenarios.Payload_MultiPart_FormData_HttpParts_ContentType_optionalContentType = passOnSuccess({ - uri: "/multipart/form-data/file-with-http-part-optional-content-type", - method: "post", - request: { - body: multipart({ - files: [files[0]], - }), - }, - response: { status: 204 }, - handler: (req: MockRequest) => createHandler(req, [checkOptionalContentType]), - kind: "MockApiDefinition", -}); -Scenarios.Payload_MultiPart_FormData_HttpParts_jsonArrayAndFileArray = passOnSuccess({ - uri: "/multipart/form-data/complex-parts-with-httppart", - method: "post", - request: { - body: multipart({ - parts: { - id: 123, - address: { city: "X" }, - previousAddresses: [{ city: "Y" }, { city: "Z" }], - }, - files: [files[0], files[1], files[1]], - }), - }, - response: { status: 204 }, - handler: (req: MockRequest) => - createHandler(req, [checkId, checkAddress, checkPreviousAddresses, checkAllFiles]), - kind: "MockApiDefinition", -}); -Scenarios.Payload_MultiPart_FormData_HttpParts_NonString_float = passOnSuccess({ - uri: "/multipart/form-data/non-string-float", - method: "post", - request: { - body: multipart({ - parts: { temperature: 0.5 }, - }), - }, - response: { status: 204 }, - handler: (req: MockRequest) => createHandler(req, [checkFloat]), - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/main.tsp deleted file mode 100644 index 63f7d30e4ee..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/main.tsp +++ /dev/null @@ -1,516 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -/** - * Test for pageable payload. - */ -@scenarioService("/payload/pageable") -namespace Payload.Pageable; - -model Pet { - id: string; - name: string; -} - -alias HeaderAndQuery = { - @header foo?: string; - @query bar?: string; -}; - -@route("/server-driven-pagination") -namespace ServerDrivenPagination { - @scenario - @scenarioDoc(""" - Test case for using link as pagination. - - Two requests need to be tested. - 1. Initial request: - Expected route: /payload/pageable/server-driven-pagination/link - Expected response body: - ```json - { "pets": [ - { "id": "1", "name": "dog" }, - { "id": "2", "name": "cat" } - ], - "next": "http://[host]:[port]/payload/pageable/server-driven-pagination/link/nextPage" - } - ``` - 2. Next page request: - Expected route: /payload/pageable/server-driven-pagination/link/nextPage - Expected response body: - ```json - { "pets": [ - { "id": "3", "name": "bird" }, - { "id": "4", "name": "fish" } - ] - } - ``` - """) - @route("/link") - @list - op link(): { - @pageItems - pets: Pet[]; - - @nextLink next?: url; - }; - - @scenario - @scenarioDoc(""" - Test case for using link as pagination with string nextLink. - - Two requests need to be tested. - 1. Initial request: - Expected route: /payload/pageable/server-driven-pagination/link-string - Expected response body: - ```json - { "pets": [ - { "id": "1", "name": "dog" }, - { "id": "2", "name": "cat" } - ], - "next": "http://[host]:[port]/payload/pageable/server-driven-pagination/link-string/nextPage" - } - ``` - 2. Next page request: - Expected route: /payload/pageable/server-driven-pagination/link-string/nextPage - Expected response body: - ```json - { "pets": [ - { "id": "3", "name": "bird" }, - { "id": "4", "name": "fish" } - ] - } - ``` - """) - @route("/link-string") - @list - op linkString(): { - @pageItems - pets: Pet[]; - - @nextLink next?: string; - }; - - @scenario - @scenarioDoc(""" - Test case for using link as pagination with nested structure. - - Two requests need to be tested. - 1. Initial request: - Expected route: /payload/pageable/server-driven-pagination/nested-link - Expected response body: - ```json - { "nestedItems": { - "pets": [ - { "id": "1", "name": "dog" }, - { "id": "2", "name": "cat" } - ] - }, - "nestedNext": { - "next": "http://[host]:[port]/payload/pageable/server-driven-pagination/nested-link/nextPage" - } - } - ``` - 2. Next page request: - Expected route: /payload/pageable/server-driven-pagination/nested-link/nextPage - Expected response body: - ```json - { "nestedItems": { - "pets": [ - { "id": "3", "name": "bird" }, - { "id": "4", "name": "fish" } - ] - } - } - ``` - """) - @route("/nested-link") - @list - op nestedLink(): { - nestedItems: { - @pageItems - pets: Pet[]; - }; - nestedNext: { - @nextLink next?: url; - }; - }; - - @route("/continuationtoken") - namespace ContinuationToken { - @scenario - @scenarioDoc(""" - Test case for using continuation token as pagination. Continuation token is passed in the request query and response body. - - Two requests need to be tested. - - 1. Initial request: - Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-body?bar=bar - - Expected request header: - foo=foo - - Expected response body: - ```json - { "pets": [ - { "id": "1", "name": "dog" }, - { "id": "2", "name": "cat" } - ], - "nextToken": "page2" - } - ``` - - 2. Next page request: - Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-body?bar=bar&token=page2 - - Expected request header: - foo=foo - - Expected response body: - ```json - { "pets": [ - { "id": "3", "name": "bird" }, - { "id": "4", "name": "fish" } - ] - } - ``` - """) - @route("/request-query-response-body") - @list - op requestQueryResponseBody(@continuationToken @query token?: string, ...HeaderAndQuery): { - @pageItems - pets: Pet[]; - - @continuationToken nextToken?: string; - }; - - @scenario - @scenarioDoc(""" - Test case for using continuation token as pagination. Continuation token is passed in the request header and response body. - - Two requests need to be tested. - - 1. Initial request: - Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-body?bar=bar - - Expected request header: - foo=foo - - Expected response body: - ```json - { "pets": [ - { "id": "1", "name": "dog" }, - { "id": "2", "name": "cat" } - ], - "nextToken": "page2" - } - ``` - - 2. Next page request: - Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-body?bar=bar - - Expected request header: - token=page2 - foo=foo - - Expected response body: - ```json - { "pets": [ - { "id": "3", "name": "bird" }, - { "id": "4", "name": "fish" } - ] - } - ``` - """) - @route("/request-header-response-body") - @list - op requestHeaderResponseBody(@continuationToken @header token?: string, ...HeaderAndQuery): { - @pageItems - pets: Pet[]; - - @continuationToken nextToken?: string; - }; - - @scenario - @scenarioDoc(""" - Test case for using continuation token as pagination. Continuation token is passed in the request query and response header. - - Two requests need to be tested. - - 1. Initial request: - Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-header?bar=bar - - Expected request header: - foo=foo - - Expected response body: - ```json - { "pets": [ - { "id": "1", "name": "dog" }, - { "id": "2", "name": "cat" } - ] - } - ``` - - Expected response header: - next-token=page2 - - 2. Next page request: - Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-response-header?bar=bar&token=page2 - - Expected request header: - foo=foo - - Expected response body: - ```json - { "pets": [ - { "id": "3", "name": "bird" }, - { "id": "4", "name": "fish" } - ] - } - ``` - """) - @route("/request-query-response-header") - @list - op requestQueryResponseHeader(@continuationToken @query token?: string, ...HeaderAndQuery): { - @pageItems - pets: Pet[]; - - @continuationToken @header nextToken?: string; - }; - - @scenario - @scenarioDoc(""" - Test case for using continuation token as pagination. Continuation token is passed in the request header and response header. - - Two requests need to be tested. - 1. Initial request: - Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-header?bar=bar - - Expected request header: - foo=foo - - Expected response body: - ```json - { "pets": [ - { "id": "1", "name": "dog" }, - { "id": "2", "name": "cat" } - ] - } - ``` - - Expected response header: - next-token=page2 - - 2. Next page request: - Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-response-header?bar=bar - - Expected request header: - token=page2 - foo=foo - - Expected response body: - ```json - { "pets": [ - { "id": "3", "name": "bird" }, - { "id": "4", "name": "fish" } - ] - } - ``` - """) - @route("/request-header-response-header") - @list - op requestHeaderResponseHeader(@continuationToken @header token?: string, ...HeaderAndQuery): { - @pageItems - pets: Pet[]; - - @continuationToken @header nextToken?: string; - }; - - @scenario - @scenarioDoc(""" - Test case for using continuation token as pagination with nested response structure. Continuation token is passed in the request query and nested within response body. - - Two requests need to be tested. - - 1. Initial request: - Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-nested-response-body?bar=bar - - Expected request header: - foo=foo - - Expected response body: - ```json - { "nestedItems": { - "pets": [ - { "id": "1", "name": "dog" }, - { "id": "2", "name": "cat" } - ] - }, - "nestedNext": { - "nextToken": "page2" - } - } - ``` - - 2. Next page request: - Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-query-nested-response-body?bar=bar&token=page2 - - Expected request header: - foo=foo - - Expected response body: - ```json - { "nestedItems": { - "pets": [ - { "id": "3", "name": "bird" }, - { "id": "4", "name": "fish" } - ] - } - } - ``` - """) - @route("/request-query-nested-response-body") - @list - op requestQueryNestedResponseBody( - @continuationToken @query token?: string, - ...HeaderAndQuery, - ): { - nestedItems: { - @pageItems - pets: Pet[]; - }; - nestedNext?: { - @continuationToken nextToken?: string; - }; - }; - - @scenario - @scenarioDoc(""" - Test case for using continuation token as pagination with nested response structure. Continuation token is passed in the request header and nested within response body. - - Two requests need to be tested. - - 1. Initial request: - Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-nested-response-body?bar=bar - - Expected request header: - foo=foo - - Expected response body: - ```json - { "nestedItems": { - "pets": [ - { "id": "1", "name": "dog" }, - { "id": "2", "name": "cat" } - ] - }, - "next": { - "nextToken": "page2" - } - } - ``` - - 2. Next page request: - Expected route: /payload/pageable/server-driven-pagination/continuationtoken/request-header-nested-response-body?bar=bar - - Expected request header: - token=page2 - foo=foo - - Expected response body: - ```json - { "nestedItems": { - "pets": [ - { "id": "3", "name": "bird" }, - { "id": "4", "name": "fish" } - ] - } - } - ``` - """) - @route("/request-header-nested-response-body") - @list - op requestHeaderNestedResponseBody( - @continuationToken @header token?: string, - ...HeaderAndQuery, - ): { - nestedItems: { - @pageItems - pets: Pet[]; - }; - nestedNext?: { - @continuationToken nextToken?: string; - }; - }; - } -} - -@route("/pagesize") -namespace PageSize { - @scenario - @scenarioDoc(""" - Test case for simple pagination without nextlink or continuationToken. - - Single request: - Expected route: /payload/pageable/pagesize/without-continuation - - Expected response body: - ```json - { "pets": [ - { "id": "1", "name": "dog" }, - { "id": "2", "name": "cat" }, - { "id": "3", "name": "bird" }, - { "id": "4", "name": "fish" } - ] - } - ``` - """) - @route("/without-continuation") - @list - op listWithoutContinuation(): { - @pageItems - pets: Pet[]; - }; - - @scenario - @scenarioDoc(""" - Test case for pagination with a regular @pageSize parameter. - - Two requests need to be tested: - 1. Request with pageSize=2: - Expected route: /payload/pageable/pagesize/list?pageSize=2 - - Expected response body: - ```json - { "pets": [ - { "id": "1", "name": "dog" }, - { "id": "2", "name": "cat" } - ] - } - ``` - - 2. Request with pageSize=4: - Expected route: /payload/pageable/pagesize/list?pageSize=4 - - Expected response body: - ```json - { "pets": [ - { "id": "1", "name": "dog" }, - { "id": "2", "name": "cat" }, - { "id": "3", "name": "bird" }, - { "id": "4", "name": "fish" } - ] - } - ``` - """) - @route("/list") - @list - op listWithPageSize(@pageSize @query pageSize?: int32): { - @pageItems - pets: Pet[]; - }; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/mockapi.ts deleted file mode 100644 index 565bfde9ace..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/payload/pageable/mockapi.ts +++ /dev/null @@ -1,513 +0,0 @@ -import { - dyn, - dynItem, - json, - MockRequest, - passOnSuccess, - ScenarioMockApi, - ValidationError, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const FirstPage = [ - { id: "1", name: "dog" }, - { id: "2", name: "cat" }, -]; - -const SecondPage = [ - { id: "3", name: "bird" }, - { id: "4", name: "fish" }, -]; - -const FirstResponseTokenInBody = { - status: 200, - body: json({ - pets: FirstPage, - nextToken: "page2", - }), -}; - -const SecondResponse = { - status: 200, - body: json({ - pets: SecondPage, - }), -}; - -const FirstResponseTokenInHeader = { - status: 200, - body: json({ - pets: FirstPage, - }), - headers: { - "next-token": "page2", - foo: "foo", - }, -}; - -const RequestTokenInQuery = { - query: { token: "page2", bar: "bar" }, - headers: { foo: "foo" }, -}; - -const RequestTokenInHeader = { headers: { token: "page2", foo: "foo" }, query: { bar: "bar" } }; - -function createTests(reqInfo: "query" | "header", resInfo: "body" | "header") { - const uri = `/payload/pageable/server-driven-pagination/continuationtoken/request-${reqInfo}-response-${resInfo}`; - function createHandler() { - return (req: MockRequest) => { - req.expect.containsHeader("foo", "foo"); - req.expect.containsQueryParam("bar", "bar"); - const token = reqInfo === "header" ? req.headers?.token : req.query?.token; - switch (token) { - case undefined: - return resInfo === "header" ? FirstResponseTokenInHeader : FirstResponseTokenInBody; - case "page2": - return SecondResponse; - default: - throw new ValidationError( - "Unsupported continuation token", - `"undefined" | "page2"`, - token, - ); - } - }; - } - - return passOnSuccess([ - { - uri: uri, - method: "get", - request: { headers: { foo: "foo" }, query: { bar: "bar" } }, - response: resInfo === "header" ? FirstResponseTokenInHeader : FirstResponseTokenInBody, - handler: createHandler(), - kind: "MockApiDefinition", - }, - { - uri: uri, - method: "get", - request: reqInfo === "header" ? RequestTokenInHeader : RequestTokenInQuery, - response: SecondResponse, - handler: createHandler(), - kind: "MockApiDefinition", - }, - ]); -} - -Scenarios.Payload_Pageable_ServerDrivenPagination_link = passOnSuccess([ - { - uri: "/payload/pageable/server-driven-pagination/link", - method: "get", - request: {}, - response: { - status: 200, - body: json({ - pets: FirstPage, - next: dyn`${dynItem("baseUrl")}/payload/pageable/server-driven-pagination/link/nextPage`, - }), - }, - kind: "MockApiDefinition", - }, - { - uri: "/payload/pageable/server-driven-pagination/link/nextPage", - method: "get", - request: {}, - response: SecondResponse, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Payload_Pageable_ServerDrivenPagination_linkString = passOnSuccess([ - { - uri: "/payload/pageable/server-driven-pagination/link-string", - method: "get", - request: {}, - response: { - status: 200, - body: json({ - pets: FirstPage, - next: dyn`${dynItem("baseUrl")}/payload/pageable/server-driven-pagination/link-string/nextPage`, - }), - }, - kind: "MockApiDefinition", - }, - { - uri: "/payload/pageable/server-driven-pagination/link-string/nextPage", - method: "get", - request: {}, - response: SecondResponse, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Payload_Pageable_ServerDrivenPagination_nestedLink = passOnSuccess([ - { - uri: "/payload/pageable/server-driven-pagination/nested-link", - method: "get", - request: {}, - response: { - status: 200, - body: json({ - nestedItems: { - pets: FirstPage, - }, - nestedNext: { - next: dyn`${dynItem("baseUrl")}/payload/pageable/server-driven-pagination/nested-link/nextPage`, - }, - }), - }, - kind: "MockApiDefinition", - }, - { - uri: "/payload/pageable/server-driven-pagination/nested-link/nextPage", - method: "get", - request: {}, - response: { - status: 200, - body: json({ - nestedItems: { - pets: SecondPage, - }, - }), - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestQueryResponseBody = - createTests("query", "body"); - -Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestHeaderResponseBody = - createTests("header", "body"); - -Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestQueryResponseHeader = - createTests("query", "header"); - -Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestHeaderResponseHeader = - createTests("header", "header"); - -Scenarios.Payload_Pageable_PageSize_listWithoutContinuation = passOnSuccess([ - { - uri: "/payload/pageable/pagesize/without-continuation", - method: "get", - request: {}, - response: { - status: 200, - body: json({ - pets: [ - { id: "1", name: "dog" }, - { id: "2", name: "cat" }, - { id: "3", name: "bird" }, - { id: "4", name: "fish" }, - ], - }), - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Payload_Pageable_PageSize_listWithPageSize = passOnSuccess([ - { - uri: "/payload/pageable/pagesize/list", - method: "get", - request: { query: { pageSize: "2" } }, - response: { - status: 200, - body: json({ - pets: [ - { id: "1", name: "dog" }, - { id: "2", name: "cat" }, - ], - }), - }, - handler: (req: MockRequest) => { - const pageSize = req.query?.pageSize; - - switch (pageSize) { - case "2": - return { - status: 200, - body: json({ - pets: [ - { id: "1", name: "dog" }, - { id: "2", name: "cat" }, - ], - }), - }; - case "4": - return { - status: 200, - body: json({ - pets: [ - { id: "1", name: "dog" }, - { id: "2", name: "cat" }, - { id: "3", name: "bird" }, - { id: "4", name: "fish" }, - ], - }), - }; - default: - throw new ValidationError("Unsupported page size", `"2" | "4"`, pageSize); - } - }, - kind: "MockApiDefinition", - }, - { - uri: "/payload/pageable/pagesize/list", - method: "get", - request: { query: { pageSize: "4" } }, - response: { - status: 200, - body: json({ - pets: [ - { id: "1", name: "dog" }, - { id: "2", name: "cat" }, - { id: "3", name: "bird" }, - { id: "4", name: "fish" }, - ], - }), - }, - handler: (req: MockRequest) => { - const pageSize = req.query?.pageSize; - - switch (pageSize) { - case "2": - return { - status: 200, - body: json({ - pets: [ - { id: "1", name: "dog" }, - { id: "2", name: "cat" }, - ], - }), - }; - case "4": - return { - status: 200, - body: json({ - pets: [ - { id: "1", name: "dog" }, - { id: "2", name: "cat" }, - { id: "3", name: "bird" }, - { id: "4", name: "fish" }, - ], - }), - }; - default: - throw new ValidationError("Unsupported page size", `"2" | "4"`, pageSize); - } - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestQueryNestedResponseBody = - passOnSuccess([ - { - uri: "/payload/pageable/server-driven-pagination/continuationtoken/request-query-nested-response-body", - method: "get", - request: { headers: { foo: "foo" }, query: { bar: "bar" } }, - response: { - status: 200, - body: json({ - nestedItems: { - pets: FirstPage, - }, - nestedNext: { - nextToken: "page2", - }, - }), - }, - handler: (req: MockRequest) => { - req.expect.containsHeader("foo", "foo"); - req.expect.containsQueryParam("bar", "bar"); - const token = req.query?.token; - - switch (token) { - case undefined: - return { - status: 200, - body: json({ - nestedItems: { - pets: FirstPage, - }, - nestedNext: { - nextToken: "page2", - }, - }), - }; - case "page2": - return { - status: 200, - body: json({ - nestedItems: { - pets: SecondPage, - }, - }), - }; - default: - throw new ValidationError( - "Unsupported continuation token", - `"undefined" | "page2"`, - token, - ); - } - }, - kind: "MockApiDefinition", - }, - { - uri: "/payload/pageable/server-driven-pagination/continuationtoken/request-query-nested-response-body", - method: "get", - request: RequestTokenInQuery, - response: { - status: 200, - body: json({ - nestedItems: { - pets: SecondPage, - }, - }), - }, - handler: (req: MockRequest) => { - req.expect.containsHeader("foo", "foo"); - req.expect.containsQueryParam("bar", "bar"); - const token = req.query?.token; - - switch (token) { - case undefined: - return { - status: 200, - body: json({ - nestedItems: { - pets: FirstPage, - }, - nestedNext: { - nextToken: "page2", - }, - }), - }; - case "page2": - return { - status: 200, - body: json({ - nestedItems: { - pets: SecondPage, - }, - }), - }; - default: - throw new ValidationError( - "Unsupported continuation token", - `"undefined" | "page2"`, - token, - ); - } - }, - kind: "MockApiDefinition", - }, - ]); - -Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestHeaderNestedResponseBody = - passOnSuccess([ - { - uri: "/payload/pageable/server-driven-pagination/continuationtoken/request-header-nested-response-body", - method: "get", - request: { headers: { foo: "foo" }, query: { bar: "bar" } }, - response: { - status: 200, - body: json({ - nestedItems: { - pets: FirstPage, - }, - nestedNext: { - nextToken: "page2", - }, - }), - }, - handler: (req: MockRequest) => { - req.expect.containsHeader("foo", "foo"); - req.expect.containsQueryParam("bar", "bar"); - const token = req.headers?.token; - - switch (token) { - case undefined: - return { - status: 200, - body: json({ - nestedItems: { - pets: FirstPage, - }, - nestedNext: { - nextToken: "page2", - }, - }), - }; - case "page2": - return { - status: 200, - body: json({ - nestedItems: { - pets: SecondPage, - }, - }), - }; - default: - throw new ValidationError( - "Unsupported continuation token", - `"undefined" | "page2"`, - token, - ); - } - }, - kind: "MockApiDefinition", - }, - { - uri: "/payload/pageable/server-driven-pagination/continuationtoken/request-header-nested-response-body", - method: "get", - request: RequestTokenInHeader, - response: { - status: 200, - body: json({ - nestedItems: { - pets: SecondPage, - }, - }), - }, - handler: (req: MockRequest) => { - req.expect.containsHeader("foo", "foo"); - req.expect.containsQueryParam("bar", "bar"); - const token = req.headers?.token; - - switch (token) { - case undefined: - return { - status: 200, - body: json({ - nestedItems: { - pets: FirstPage, - }, - nestedNext: { - nextToken: "page2", - }, - }), - }; - case "page2": - return { - status: 200, - body: json({ - nestedItems: { - pets: SecondPage, - }, - }), - }; - default: - throw new ValidationError( - "Unsupported continuation token", - `"undefined" | "page2"`, - token, - ); - } - }, - kind: "MockApiDefinition", - }, - ]); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/main.tsp deleted file mode 100644 index 68bf621eb81..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/main.tsp +++ /dev/null @@ -1,302 +0,0 @@ -import "@typespec/http"; -import "@typespec/xml"; -import "@typespec/spector"; - -using Http; -using Spector; -using TypeSpec.Xml; - -@doc("Sends and receives bodies in XML format.") -@scenarioService("/payload/xml") -namespace Payload.Xml; - -@doc("Contains fields of primitive types.") -model SimpleModel { - name: string; - age: int32; -} - -@doc("Contains fields of arrays of primitive types.") -model ModelWithSimpleArrays { - colors: string[]; - counts: int32[]; -} - -@doc("Contains an array of models.") -model ModelWithArrayOfModel { - items: SimpleModel[]; -} - -@doc("Contains an optional field.") -model ModelWithOptionalField { - item: string; - value?: int32; -} - -@doc("Contains fields that are XML attributes.") -model ModelWithAttributes { - @attribute id1: int32; - @attribute id2: string; - enabled: boolean; -} - -@doc("Contains fields of wrapped and unwrapped arrays of primitive types.") -model ModelWithUnwrappedArray { - @unwrapped colors: string[]; - counts: int32[]; -} - -@doc("Contains fields of wrapped and unwrapped arrays of primitive types that have different XML representations.") -model ModelWithRenamedArrays { - @name("Colors") @unwrapped colors: string[]; - @name("Counts") counts: int32[]; -} - -@doc("Contains fields of the same type that have different XML representation.") -@name("ModelWithRenamedFieldsSrc") -model ModelWithRenamedFields { - @name("InputData") inputData: SimpleModel; - @name("OutputData") outputData: SimpleModel; -} - -@doc("Contains an array of models that's supposed to be sent/received as an empty XML element.") -model ModelWithEmptyArray { - items: SimpleModel[]; -} - -@doc("Contains an attribute and text.") -model ModelWithText { - @attribute language: string; - @unwrapped content: string; -} - -@doc("Contains a dictionary of key value pairs.") -model ModelWithDictionary { - metadata: Record; -} - -@doc("Uses encodedName instead of Xml.Name which is functionally equivalent.") -@encodedName("application/xml", "ModelWithEncodedNamesSrc") -model ModelWithEncodedNames { - @encodedName("application/xml", "SimpleModelData") modelData: SimpleModel; - @encodedName("application/xml", "PossibleColors") colors: string[]; -} - -@doc("Template for XML operations") -interface XmlOperations { - @scenario - @scenarioDoc(""" - Expected response body: - ```xml - ${TDoc} - ``` - """) - @get - get(): { - @header("content-type") contentType: "application/xml"; - @body body: TModel; - }; - - @scenario - @scenarioDoc(""" - Expected request body: - ```xml - ${TDoc} - ``` - """) - @put - put(@header("content-type") contentType: "application/xml", @body input: TModel): void; -} - -@doc("Operations for the SimpleModel type.") -@route("/simpleModel") -interface SimpleModelValue - extends XmlOperations< - SimpleModel, - """ - - foo - 123 - - """ - > {} - -@doc("Operations for the ModelWithSimpleArrays type.") -@route("/modelWithSimpleArrays") -interface ModelWithSimpleArraysValue - extends XmlOperations< - ModelWithSimpleArrays, - """ - - - red - green - blue - - - 1 - 2 - - - """ - > {} - -@doc("Operations for the ModelWithArrayOfModel type.") -@route("/modelWithArrayOfModel") -interface ModelWithArrayOfModelValue - extends XmlOperations< - ModelWithArrayOfModel, - """ - - - - foo - 123 - - - bar - 456 - - - - """ - > {} - -@doc("Operations for the ModelWithOptionalField type.") -@route("/modelWithOptionalField") -interface ModelWithOptionalFieldValue - extends XmlOperations< - ModelWithOptionalField, - """ - - widget - - """ - > {} - -@doc("Operations for the ModelWithAttributes type.") -@route("/modelWithAttributes") -interface ModelWithAttributesValue - extends XmlOperations< - ModelWithAttributes, - """ - - true - - """ - > {} - -@doc("Operations for the ModelWithUnwrappedArray type.") -@route("/modelWithUnwrappedArray") -interface ModelWithUnwrappedArrayValue - extends XmlOperations< - ModelWithUnwrappedArray, - """ - - red - green - blue - - 1 - 2 - - - """ - > {} - -@doc("Operations for the ModelWithRenamedArrays type.") -@route("/modelWithRenamedArrays") -interface ModelWithRenamedArraysValue - extends XmlOperations< - ModelWithRenamedArrays, - """ - - red - green - blue - - 1 - 2 - - - """ - > {} - -@doc("Operations for the ModelWithRenamedFields type.") -@route("/modelWithRenamedFields") -interface ModelWithRenamedFieldsValue - extends XmlOperations< - ModelWithRenamedFields, - """ - - - foo - 123 - - - bar - 456 - - - """ - > {} - -@doc("Operations for the ModelWithEmptyArray type.") -@route("/modelWithEmptyArray") -interface ModelWithEmptyArrayValue - extends XmlOperations< - ModelWithEmptyArray, - """ - - - - """ - > {} - -@doc("Operations for the ModelWithText type.") -@route("/modelWithText") -interface ModelWithTextValue - extends XmlOperations< - ModelWithText, - """ - - This is some text. - - """ - > {} - -@doc("Operations for the ModelWithDictionary type.") -@route("/modelWithDictionary") -interface ModelWithDictionaryValue - extends XmlOperations< - ModelWithDictionary, - """ - - - blue - 123 - false - - - """ - > {} - -@doc("Operations for the ModelWithEncodedNames type.") -@route("/modelWithEncodedNames") -interface ModelWithEncodedNamesValue - extends XmlOperations< - ModelWithEncodedNames, - """ - - - foo - 123 - - - red - green - blue - - - """ - > {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/mockapi.ts deleted file mode 100644 index af06ef9c039..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/payload/xml/mockapi.ts +++ /dev/null @@ -1,235 +0,0 @@ -import { MockRequest, passOnSuccess, ScenarioMockApi, xml } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -export const simpleModel = ` - - foo - 123 - -`; - -export const modelWithSimpleArrays = ` - - - red - green - blue - - - 1 - 2 - - -`; - -export const modelWithArrayOfModel = ` - - - - foo - 123 - - - bar - 456 - - - -`; - -export const modelWithOptionalField = ` - - widget - -`; - -export const modelWithAttributes = ` - - true - -`; - -export const modelWithUnwrappedArray = ` - - red - green - blue - - 1 - 2 - - -`; - -export const modelWithRenamedArrays = ` - - red - green - blue - - 1 - 2 - - -`; - -export const modelWithRenamedFields = ` - - - foo - 123 - - - bar - 456 - - -`; - -export const modelWithEmptyArray = ` - - - -`; - -export const modelWithText = ` - - This is some text. - -`; - -export const modelWithDictionary = ` - - - blue - 123 - false - - -`; - -export const modelWithEncodedNames = ` - - - foo - 123 - - - red - green - blue - - -`; - -function createServerTests(uri: string, data?: any) { - return { - get: passOnSuccess({ - uri, - method: "get", - request: {}, - response: { - status: 200, - body: xml(data), - }, - kind: "MockApiDefinition", - }), - put: passOnSuccess({ - uri, - method: "put", - request: { - body: xml(data), - }, - handler: (req: MockRequest) => { - req.expect.containsHeader("content-type", "application/xml"); - req.expect.xmlBodyEquals(data); - return { - status: 204, - }; - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }), - }; -} - -const Payload_Xml_SimpleModel = createServerTests("/payload/xml/simpleModel", simpleModel); -Scenarios.Payload_Xml_SimpleModelValue_get = Payload_Xml_SimpleModel.get; -Scenarios.Payload_Xml_SimpleModelValue_put = Payload_Xml_SimpleModel.put; - -const Payload_Xml_ModelWithSimpleArrays = createServerTests( - "/payload/xml/modelWithSimpleArrays", - modelWithSimpleArrays, -); -Scenarios.Payload_Xml_ModelWithSimpleArraysValue_get = Payload_Xml_ModelWithSimpleArrays.get; -Scenarios.Payload_Xml_ModelWithSimpleArraysValue_put = Payload_Xml_ModelWithSimpleArrays.put; - -const Payload_Xml_ModelWithArrayOfModel = createServerTests( - "/payload/xml/modelWithArrayOfModel", - modelWithArrayOfModel, -); -Scenarios.Payload_Xml_ModelWithArrayOfModelValue_get = Payload_Xml_ModelWithArrayOfModel.get; -Scenarios.Payload_Xml_ModelWithArrayOfModelValue_put = Payload_Xml_ModelWithArrayOfModel.put; - -const Payload_Xml_ModelWithOptionalField = createServerTests( - "/payload/xml/modelWithOptionalField", - modelWithOptionalField, -); -Scenarios.Payload_Xml_ModelWithOptionalFieldValue_get = Payload_Xml_ModelWithOptionalField.get; -Scenarios.Payload_Xml_ModelWithOptionalFieldValue_put = Payload_Xml_ModelWithOptionalField.put; - -const Payload_Xml_ModelWithAttributes = createServerTests( - "/payload/xml/modelWithAttributes", - modelWithAttributes, -); -Scenarios.Payload_Xml_ModelWithAttributesValue_get = Payload_Xml_ModelWithAttributes.get; -Scenarios.Payload_Xml_ModelWithAttributesValue_put = Payload_Xml_ModelWithAttributes.put; - -const Payload_Xml_ModelWithUnwrappedArray = createServerTests( - "/payload/xml/modelWithUnwrappedArray", - modelWithUnwrappedArray, -); -Scenarios.Payload_Xml_ModelWithUnwrappedArrayValue_get = Payload_Xml_ModelWithUnwrappedArray.get; -Scenarios.Payload_Xml_ModelWithUnwrappedArrayValue_put = Payload_Xml_ModelWithUnwrappedArray.put; - -const Payload_Xml_ModelWithRenamedArrays = createServerTests( - "/payload/xml/modelWithRenamedArrays", - modelWithRenamedArrays, -); -Scenarios.Payload_Xml_ModelWithRenamedArraysValue_get = Payload_Xml_ModelWithRenamedArrays.get; -Scenarios.Payload_Xml_ModelWithRenamedArraysValue_put = Payload_Xml_ModelWithRenamedArrays.put; - -const Payload_Xml_ModelWithRenamedFields = createServerTests( - "/payload/xml/modelWithRenamedFields", - modelWithRenamedFields, -); -Scenarios.Payload_Xml_ModelWithRenamedFieldsValue_get = Payload_Xml_ModelWithRenamedFields.get; -Scenarios.Payload_Xml_ModelWithRenamedFieldsValue_put = Payload_Xml_ModelWithRenamedFields.put; - -const Payload_Xml_ModelWithEmptyArray = createServerTests( - "/payload/xml/modelWithEmptyArray", - modelWithEmptyArray, -); -Scenarios.Payload_Xml_ModelWithEmptyArrayValue_get = Payload_Xml_ModelWithEmptyArray.get; -Scenarios.Payload_Xml_ModelWithEmptyArrayValue_put = Payload_Xml_ModelWithEmptyArray.put; - -const Payload_Xml_ModelWithText = createServerTests("/payload/xml/modelWithText", modelWithText); -Scenarios.Payload_Xml_ModelWithTextValue_get = Payload_Xml_ModelWithText.get; -Scenarios.Payload_Xml_ModelWithTextValue_put = Payload_Xml_ModelWithText.put; - -const Payload_Xml_ModelWithDictionary = createServerTests( - "/payload/xml/modelWithDictionary", - modelWithDictionary, -); -Scenarios.Payload_Xml_ModelWithDictionaryValue_get = Payload_Xml_ModelWithDictionary.get; -Scenarios.Payload_Xml_ModelWithDictionaryValue_put = Payload_Xml_ModelWithDictionary.put; - -const Payload_Xml_ModelWithEncodedNames = createServerTests( - "/payload/xml/modelWithEncodedNames", - modelWithEncodedNames, -); -Scenarios.Payload_Xml_ModelWithEncodedNamesValue_get = Payload_Xml_ModelWithEncodedNames.get; -Scenarios.Payload_Xml_ModelWithEncodedNamesValue_put = Payload_Xml_ModelWithEncodedNames.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/main.tsp deleted file mode 100644 index a397060ac2d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/main.tsp +++ /dev/null @@ -1,170 +0,0 @@ -import "@typespec/http"; -import "@typespec/versioning"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Versioning; -using Azure.ClientGenerator.Core; -using Http; -using Spector; - -@versioned(Versions) -@doc(""" - Test that we can grow up a service spec and service deployment into a multi-versioned service with full client support. - - There are three concepts that should be clarified: - 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. - 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions - 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. - - We test the following configurations from this service spec: - - A client generated from the second service spec can call the second deployment of a service with api version v1 - - A client generated from the second service spec can call the second deployment of a service with api version v2 - """) -@client({ - name: "ResiliencyServiceDrivenClient", -}) -@service -@server( - "{endpoint}/resiliency/service-driven/client:v2/service:{serviceDeploymentVersion}/api-version:{apiVersion}", - "Testserver endpoint", - { - @doc("Need to be set as 'http://localhost:3000' in client.") - endpoint: url, - - @doc("Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when the service had api-versions 'v1' and 'v2'.") - serviceDeploymentVersion: string, - - @doc("Pass in either 'v1' or 'v2'. This represents the API version of a service.") - apiVersion: string, - } -) -namespace Resiliency.ServiceDriven; - -@doc("Service versions") -enum Versions { - @doc("Version 1") - v1, - - @doc("Version 2") - v2, -} - -model PostInput { - url: string; -} - -@route("/add-optional-param") -interface AddOptionalParam { - @scenario - @scenarioDoc(""" - Need the following two calls: - - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v1"` with no parameters. - - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v2"` with query parameter `new-parameter="new"`. - - There are three concepts that should be clarified: - 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. - 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions - 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. - - With the above two calls, we test the following configurations from this service spec: - - A client generated from the second service spec can call the second deployment of a service with api version v1 - - A client generated from the second service spec can call the second deployment of a service with api version v2 with the updated changes - - Tests that we can grow up an operation from accepting no parameters to accepting an optional input parameter. - """) - @route("/from-none") - @doc("Test that grew up from accepting no parameters to an optional input parameter") - @head - fromNone( - @added(Versions.v2) - @doc("I'm a new input optional parameter") - @query - `new-parameter`?: string, - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - Need the following two calls: - - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v1"` with query parameter `parameter="required"`. - - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v2"` with query parameter `parameter="required"` and query parameter `new-parameter="new"`. - - There are three concepts that should be clarified: - 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. - 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions - 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. - - With the above two calls, we test the following configurations from this service spec: - - A client generated from the second service spec can call the second deployment of a service with api version v1 - - A client generated from the second service spec can call the second deployment of a service with api version v2 with the updated changes - - Tests that we can grow up an operation from accepting one required parameter to accepting a required parameter and an optional parameter. - """) - @route("/from-one-required") - @doc("Operation that grew up from accepting one required parameter to accepting a required parameter and an optional parameter.") - @get - fromOneRequired( - @doc("I am a required parameter") - @query - parameter: string, - - @added(Versions.v2) - @doc("I'm a new input optional parameter") - @query - `new-parameter`?: string, - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - Need the following two calls: - - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v1"` with query parameter `parameter="optional"`. - - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v2"` with query parameter `parameter="optional"` and query parameter `new-parameter="new"`. - - There are three concepts that should be clarified: - 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. - 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions - 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. - - With the above two calls, we test the following configurations from this service spec: - - A client generated from the second service spec can call the second deployment of a service with api version v1 - - A client generated from the second service spec can call the second deployment of a service with api version v2 with the updated changes - - Tests that we can grow up an operation from accepting one optional parameter to accepting two optional parameters. - """) - @route("/from-one-optional") - @doc("Tests that we can grow up an operation from accepting one optional parameter to accepting two optional parameters.") - @get - fromOneOptional( - @doc("I am an optional parameter") - @query - parameter?: string, - - @added(Versions.v2) - @doc("I'm a new input optional parameter") - @query - `new-parameter`?: string, - ): NoContentResponse; -} - -@scenario -@scenarioDoc(""" - Need the following two calls: - - Call with client spec version "v1" with `serviceDeploymentVersion="v2"` and `apiVersion="v2"` - - Call with client spec version "v2" with `serviceDeploymentVersion="v2"` and `apiVersion="v2"` - - There are three concepts that should be clarified: - 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. - 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions - 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. - - With the above two calls, we test the following configurations from this service spec: - - A client generated from the first service spec can break the glass and call the second deployment of a service with api version v2 - - A client generated from the second service spec can call the second deployment of a service with api version v2 with the updated changes - - Tests that we can grow up by adding an operation. - """) -@added(Versions.v2) -@route("/add-operation") -@doc("Added operation") -@delete -op addOperation(): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/mockapi.ts deleted file mode 100644 index f025bb65da2..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/mockapi.ts +++ /dev/null @@ -1,218 +0,0 @@ -import { MockRequest, ScenarioMockApi, ValidationError, passOnSuccess } from "@typespec/spec-api"; - -export const commonBase = "/resiliency/service-driven"; - -export const Scenarios: Record = {}; - -Scenarios.Resiliency_ServiceDriven_AddOptionalParam_fromNone = passOnSuccess([ - { - uri: `${commonBase}/client\\:v1/service\\:v1/api-version\\:v1/add-optional-param/from-none`, - method: "head", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: `${commonBase}/client\\:v1/service\\:v2/api-version\\:v1/add-optional-param/from-none`, - method: "head", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v1/add-optional-param/from-none`, - method: "head", - request: {}, - response: { - status: 204, - }, - handler: (req: MockRequest) => { - if (req.params["new-parameter"] !== undefined) { - throw new ValidationError( - "Did not expect 'new-parameter'", - undefined, - req.params["new-parameter"], - ); - } - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }, - { - uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v2/add-optional-param/from-none`, - method: "head", - request: { - query: { - "new-parameter": "new", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Resiliency_ServiceDriven_AddOptionalParam_fromOneRequired = passOnSuccess([ - { - uri: `${commonBase}/client\\:v1/service\\:v1/api-version\\:v1/add-optional-param/from-one-required`, - method: "get", - request: { - query: { - parameter: "required", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: `${commonBase}/client\\:v1/service\\:v2/api-version\\:v1/add-optional-param/from-one-required`, - method: "get", - request: { - query: { - parameter: "required", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v1/add-optional-param/from-one-required`, - method: "get", - request: { - query: { - parameter: "required", - }, - }, - response: { - status: 204, - }, - handler: (req: MockRequest) => { - req.expect.containsQueryParam("parameter", "required"); - if (req.params["new-parameter"] !== undefined) { - throw new ValidationError( - "Did not expect 'new-parameter'", - undefined, - req.params["new-parameter"], - ); - } - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }, - { - uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v2/add-optional-param/from-one-required`, - method: "get", - request: { - query: { - parameter: "required", - "new-parameter": "new", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Resiliency_ServiceDriven_AddOptionalParam_fromOneOptional = passOnSuccess([ - { - uri: `${commonBase}/client\\:v1/service\\:v1/api-version\\:v1/add-optional-param/from-one-optional`, - method: "get", - request: { - query: { - parameter: "optional", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: `${commonBase}/client\\:v1/service\\:v2/api-version\\:v1/add-optional-param/from-one-optional`, - method: "get", - request: { - query: { - parameter: "optional", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, - { - uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v1/add-optional-param/from-one-optional`, - method: "get", - request: { - query: { - parameter: "optional", - }, - }, - response: { - status: 204, - }, - handler: (req: MockRequest) => { - req.expect.containsQueryParam("parameter", "optional"); - if (req.params["new-parameter"] !== undefined) { - throw new ValidationError( - "Did not expect 'new-parameter'", - undefined, - req.params["new-parameter"], - ); - } - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }, - { - uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v2/add-optional-param/from-one-optional`, - method: "get", - request: { - query: { - parameter: "optional", - "new-parameter": "new", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }, -]); - -Scenarios.Resiliency_ServiceDriven_breakTheGlass = passOnSuccess({ - uri: `${commonBase}/client\\:v1/service\\:v2/api-version\\:v2/add-operation`, - method: "delete", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Resiliency_ServiceDriven_addOperation = passOnSuccess({ - uri: `${commonBase}/client\\:v2/service\\:v2/api-version\\:v2/add-operation`, - method: "delete", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/old.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/old.tsp deleted file mode 100644 index 38e8ddf1c18..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/resiliency/srv-driven/old.tsp +++ /dev/null @@ -1,120 +0,0 @@ -import "@typespec/http"; -import "@typespec/versioning"; -import "@typespec/spector"; -import "@azure-tools/typespec-client-generator-core"; - -using Http; -using Azure.ClientGenerator.Core; -using Versioning; -using Spector; - -@versioned(Versions) -@doc(""" - Test that we can grow up a service spec and service deployment into a multi-versioned service with full client support. - """) -@client({ - name: "ResiliencyServiceDrivenClient", -}) -@service -@server( - "{endpoint}/resiliency/service-driven/client:v1/service:{serviceDeploymentVersion}/api-version:{apiVersion}", - "Testserver endpoint", - { - @doc("Need to be set as 'http://localhost:3000' in client.") - endpoint: url, - - @doc("Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when the service had api-versions 'v1' and 'v2'.") - serviceDeploymentVersion: string, - - @doc("Pass in 'v1'. This represents the API version of the service. Will grow up in the next deployment to be both 'v1' and 'v2'") - apiVersion: string, - } -) -namespace Resiliency.ServiceDriven; - -@doc("Service versions.") -enum Versions { - @doc("Version 1") - v1, -} - -model PostInput { - url: string; -} - -@route("/add-optional-param") -interface AddOptionalParam { - @scenario - @scenarioDoc(""" - Need the following two calls: - - Pass in `serviceDeploymentVersion="v1"` and `apiVersion="v1"` with no parameters. - - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v1"` with no parameters. - - There are three concepts that should be clarified: - 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. - 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions - 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. - - With the above two calls, we test the following configurations from this service spec: - - A client generated from the first service spec can call the first deployment of a service with api version v1 - - A client generated from the first service spec can call the second deployment of a service with api version v1 - - In the next service spec, we will test that we can grow this operation from accepting no parameters to accepting an optional parameter. - """) - @route("/from-none") - @doc("Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as well") - @head - fromNone(): NoContentResponse; - - @scenario - @scenarioDoc(""" - Need the following two calls: - - Pass in `serviceDeploymentVersion="v1"` and `apiVersion="v1"` with query parameter `parameter="required"`. - - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v1"` with query parameter `parameter="required"`. - - There are three concepts that should be clarified: - 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. - 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions - 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. - - With the above two calls, we test the following configurations from this service spec: - - A client generated from the first service spec can call the first deployment of a service with api version v1 - - A client generated from the first service spec can call the second deployment of a service with api version v1 - - In the next service spec, we will test that we can grow this operation from accepting one required parameter to accepting both a required and an optional parameter. - """) - @route("/from-one-required") - @doc("Test that currently accepts one required parameter, will be updated in next spec to accept a new optional parameter as well") - @get - fromOneRequired( - @doc("I am a required parameter") - @query - parameter: string, - ): NoContentResponse; - - @scenario - @scenarioDoc(""" - Need the following two calls: - - Pass in `serviceDeploymentVersion="v1"` and `apiVersion="v1"` with query parameter `parameter="optional"`. - - Pass in `serviceDeploymentVersion="v2"` and `apiVersion="v1"` with query parameter `parameter="optional"`. - - There are three concepts that should be clarified: - 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp and 'v2' is a client generated from main.tsp. - 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions - 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the service supports api versions 'v1' and 'v2'. - - With the above two calls, we test the following configurations from this service spec: - - A client generated from the first service spec can call the first deployment of a service with api version v1 - - A client generated from the first service spec can call the second deployment of a service with api version v1 - - In the next service spec, we will test that we can grow this operation from accepting one optional parameter to accepting two optional parameters. - """) - @route("/from-one-optional") - @doc("Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional parameter as well") - @get - fromOneOptional( - @doc("I am an optional parameter") - @query - parameter?: string, - ): NoContentResponse; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/main.tsp deleted file mode 100644 index d103490e840..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/main.tsp +++ /dev/null @@ -1,82 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -/** - * Test for range of status code. - */ -@scenarioService("/response/status-code-range") -namespace Response.StatusCodeRange; - -@scenario -@scenarioDoc(""" - Test case for range of status code in error response. - - Verify that the result of the API is an error/exception in client, and the error response can be de-serialized to ErrorInRange model (instead of DefaultError model). - - Expected status code 494 and response body: - ```json - { - "code": "request-header-too-large", - "message": "Request header too large" - } - ``` - """) -@route("/error-response-status-code-in-range") -@get -op errorResponseStatusCodeInRange(): NoContentResponse | ErrorInRange | DefaultError; - -@scenario -@scenarioDoc(""" - Test case for range of status code in error response. - - Verify that the result of the API is an error/exception in client, and the error response can be de-serialized to NotFoundError model (instead of Standard4XXError model). - - Expected status code 404 and response body: - ```json - { - "code": "not-found", - "resourceId": "resource1" - } - ``` - """) -@route("/error-response-status-code-404") -@get -op errorResponseStatusCode404(): NoContentResponse | NotFoundError | Standard4XXError; - -@error -model NotFoundError { - @statusCode - _: 404; - - code: string; - resourceId: string; -} - -@error -model ErrorInRange { - @minValue(494) - @maxValue(499) - @statusCode - _: int32; - - code: string; - message: string; -} - -@error -model Standard4XXError { - @minValue(400) - @maxValue(499) - @statusCode - _: int32; - - code: string; -} - -@error -model DefaultError { - code: string; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/mockapi.ts deleted file mode 100644 index 6621059e050..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/response/status-code-range/mockapi.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { json, passOnCode, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Response_StatusCodeRange_errorResponseStatusCodeInRange = passOnCode(494, { - uri: "/response/status-code-range/error-response-status-code-in-range", - method: "get", - request: {}, - response: { - status: 494, - body: json({ - code: "request-header-too-large", - message: "Request header too large", - }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Response_StatusCodeRange_errorResponseStatusCode404 = passOnCode(404, { - uri: "/response/status-code-range/error-response-status-code-404", - method: "get", - request: {}, - response: { - status: 404, - body: json({ - code: "not-found", - resourceId: "resource1", - }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/routes/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/routes/main.tsp deleted file mode 100644 index d87580ec6c0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/routes/main.tsp +++ /dev/null @@ -1,477 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -/** - * Define scenario in building the http route/uri - */ -@scenarioService("/routes") -namespace Routes; - -@scenario -@scenarioDoc(""" - Simple operation at a fixed in an interface - Expected path: /routes/fixed - """) -@route("fixed") -op fixed(): void; - -@scenario -@scenarioDoc(""" - Simple operation at a fixed in an interface - Expected path: /routes/in-interface/fixed - """) -@route("in-interface") -interface InInterface { - @route("fixed") - fixed(): void; -} - -@route("path") -namespace PathParameters { - @scenario - @scenarioDoc(""" - Path parameter defined implicitly - Value: "a" - Expected path: /routes/path/template-only/a - """) - @route("template-only/{param}") - op templateOnly(param: string): void; - - @scenario - @scenarioDoc(""" - Path parameter defined explicitly - Value: "a" - Expected path: /routes/path/explicit/a - """) - @route("explicit/{param}") - op explicit(@path param: string): void; - - @scenario - @scenarioDoc(""" - Path parameter annotated with @path but not defined explicitly in the route - Value: "a" - Expected path: /routes/path/annotation-only/a - """) - @route("annotation-only") - op annotationOnly(@path param: string): void; - - @route("reserved-expansion") - namespace ReservedExpansion { - @scenario - @scenarioDoc(""" - Defines a path parameter that shouldn't encode reserved characters. It should however still encode the other url characters. - Param value: "foo/bar baz" - Expected path: "/routes/path/reserved-expansion/template/foo/bar%20baz" - """) - @route("template/{+param}") - op template(param: string): void; - - @scenario - @scenarioDoc(""" - Defines a path parameter that shouldn't encode reserved characters. It should however still encode the other url characters. - Param value: "foo/bar baz" - Expected path: "/routes/path/reserved-expansion/annotation/foo/bar%20baz" - """) - @route("annotation") - op annotation(@path(#{ allowReserved: true }) param: string): void; - } - - @route("simple") - namespace SimpleExpansion { - @route("standard") - namespace Standard { - @scenario - @scenarioDoc(""" - Test simple expansion with explode: false when passed a primitive value. - Param value: "a" - Expected path: /routes/path/simple/standard/primitivea - """) - @route("primitive{param}") - op primitive(param: string): void; - - @scenario - @scenarioDoc(""" - Test simple expansion with explode: false when passed an array value. - Param value: ["a","b"] - Expected path: /routes/path/simple/standard/arraya,b - """) - @route("array{param}") - op `array`(param: string[]): void; - - @scenario - @scenarioDoc(""" - Test simple expansion with explode: false when passed a record value. - Param value: {a: 1, b: 2} - Expected path: /routes/path/simple/standard/recorda,1,b,2 - """) - @route("record{param}") - op `record`(param: Record): void; - } - - @route("explode") - namespace Explode { - @scenario - @scenarioDoc(""" - Test simple expansion with explode: true when passed a primitive value. - Param value: "a" - Expected path: /routes/path/simple/explode/primitivea - """) - @route("primitive{param*}") - op primitive(param: string): void; - - @scenario - @scenarioDoc(""" - Test simple expansion with explode: true when passed an array value. - Param value: ["a","b"] - Expected path: /routes/path/simple/explode/arraya.b - """) - @route("array{param*}") - op `array`(param: string[]): void; - - @scenario - @scenarioDoc(""" - Test simple expansion with explode: true when passed a record value. - Param value: {a: 1, b: 2} - Expected path: /routes/path/simple/explode/recorda=1,b=2 - """) - @route("record{param*}") - op `record`(param: Record): void; - } - } - - @route("path") - namespace PathExpansion { - @route("standard") - namespace Standard { - @scenario - @scenarioDoc(""" - Test path expansion with explode: false when passed a primitive value. - Param value: "a" - Expected path: /routes/path/path/standard/primitive/a - """) - @route("primitive{/param}") - op primitive(param: string): void; - - @scenario - @scenarioDoc(""" - Test path expansion with explode: false when passed an array value. - Param value: ["a","b"] - Expected path: /routes/path/path/standard/array/a,b - """) - @route("array{/param}") - op `array`(param: string[]): void; - - @scenario - @scenarioDoc(""" - Test path expansion with explode: false when passed a record value. - Param value: {a: 1, b: 2} - Expected path: /routes/path/path/standard/record/a,1,b,2 - """) - @route("record{/param}") - op `record`(param: Record): void; - } - - @route("explode") - namespace Explode { - @scenario - @scenarioDoc(""" - Test path expansion with explode: true when passed a primitive value. - Param value: "a" - Expected path: /routes/path/path/explode/primitive/a - """) - @route("primitive{/param*}") - op primitive(param: string): void; - - @scenario - @scenarioDoc(""" - Test path expansion with explode: true when passed an array value. - Param value: ["a","b"] - Expected path: /routes/path/path/explode/array/a/b - """) - @route("array{/param*}") - op `array`(param: string[]): void; - - @scenario - @scenarioDoc(""" - Test path expansion with explode: true when passed a record value. - Param value: {a: 1, b: 2} - Expected path: /routes/path/path/explode/record/a=1/b=2 - """) - @route("record{/param*}") - op `record`(param: Record): void; - } - } - - @route("label") - namespace LabelExpansion { - @route("standard") - namespace Standard { - @scenario - @scenarioDoc(""" - Test label expansion with explode: false when passed a primitive value. - Param value: "a" - Expected path: /routes/path/label/standard/primitive.a - """) - @route("primitive{.param}") - op primitive(param: string): void; - - @scenario - @scenarioDoc(""" - Test label expansion with explode: false when passed an array value. - Param value: ["a","b"] - Expected path: /routes/path/label/standard/array.a,b - """) - @route("array{.param}") - op `array`(param: string[]): void; - - @scenario - @scenarioDoc(""" - Test label expansion with explode: false when passed a record value. - Param value: {a: 1, b: 2} - Expected path: /routes/path/label/standard/record.a,1,b,2 - """) - @route("record{.param}") - op `record`(param: Record): void; - } - - @route("explode") - namespace Explode { - @scenario - @scenarioDoc(""" - Test label expansion with explode: true when passed a primitive value. - Param value: "a" - Expected path: /routes/path/label/explode/primitive.a - """) - @route("primitive{.param*}") - op primitive(param: string): void; - - @scenario - @scenarioDoc(""" - Test label expansion with explode: true when passed an array value. - Param value: ["a","b"] - Expected path: /routes/path/label/explode/array.a.b - """) - @route("array{.param*}") - op `array`(param: string[]): void; - - @scenario - @scenarioDoc(""" - Test label expansion with explode: true when passed a record value. - Param value: {a: 1, b: 2} - Expected path: /routes/path/label/explode/record.a=1.b=2 - """) - @route("record{.param*}") - op `record`(param: Record): void; - } - } - - @route("matrix") - namespace MatrixExpansion { - @route("standard") - namespace Standard { - @scenario - @scenarioDoc(""" - Test matrix expansion with explode: false when passed a primitive value. - Param value: "a" - Expected path: /routes/path/matrix/standard/primitive;param=a - """) - @route("primitive{;param}") - op primitive(param: string): void; - - @scenario - @scenarioDoc(""" - Test matrix expansion with explode: false when passed an array value. - Param value: ["a","b"] - Expected path: /routes/path/matrix/standard/array;param=a;param=b - """) - @route("array{;param}") - op `array`(param: string[]): void; - - @scenario - @scenarioDoc(""" - Test matrix expansion with explode: false when passed a record value. - Param value: {a: 1, b: 2} - Expected path: /routes/path/matrix/standard/record;a=1;b=2 - """) - @route("record{;param}") - op `record`(param: Record): void; - } - - @route("explode") - namespace Explode { - @scenario - @scenarioDoc(""" - Test matrix expansion with explode: true when passed a primitive value. - Param value: "a" - Expected path: /routes/path/matrix/explode/primitive;param=a - """) - @route("primitive{;param*}") - op primitive(param: string): void; - - @scenario - @scenarioDoc(""" - Test matrix expansion with explode: true when passed an array value. - Param value: ["a","b"] - Expected path: /routes/path/matrix/explode/array;param=a;param=b - """) - @route("array{;param*}") - op `array`(param: string[]): void; - - @scenario - @scenarioDoc(""" - Test matrix expansion with explode: true when passed a record value. - Param value: {a: 1, b: 2} - Expected path: /routes/path/matrix/explode/record;a=1;b=2 - """) - @route("record{;param*}") - op `record`(param: Record): void; - } - } -} - -@route("query") -namespace QueryParameters { - @scenario - @scenarioDoc("Query parameter defined implicitly") - @route("template-only{?param}") - op templateOnly(param: string): void; - - @scenario - @scenarioDoc("Query parameter marked with explicit @query") - @route("explicit{?param}") - op explicit(@query param: string): void; - - @scenario - @scenarioDoc("Query parameter annotated with @query but not defined explicitly in the route") - @route("annotation-only") - op annotationOnly(@query param: string): void; - - @route("query-expansion") - namespace QueryExpansion { - @route("standard") - namespace Standard { - @scenario - @scenarioDoc(""" - Test query expansion with explode: false when passed a primitive value. - Param value: "a" - Expected path: /routes/query/query-expansion/standard/primitive?param=a - """) - @route("primitive{?param}") - op primitive(param: string): void; - - @scenario - @scenarioDoc(""" - Test query expansion with explode: false when passed an array value. - Param value: ["a","b"] - Expected path: /routes/query/query-expansion/standard/array?param=a,b - """) - @route("array{?param}") - op `array`(param: string[]): void; - - @scenario - @scenarioDoc(""" - Test query expansion with explode: false when passed a record value. - Param value: {a: 1, b: 2} - Expected path: /routes/query/query-expansion/standard/record?param=a,1,b,2 - """) - @route("record{?param}") - op `record`(param: Record): void; - } - - @route("explode") - namespace Explode { - @scenario - @scenarioDoc(""" - Test query expansion with explode: true when passed a primitive value. - Param value: "a" - Expected path: /routes/query/query-expansion/explode/primitive?param=a - """) - @route("primitive{?param*}") - op primitive(param: string): void; - - @scenario - @scenarioDoc(""" - Test query expansion with explode: true when passed an array value. - Param value: ["a","b"] - Expected path: /routes/query/query-expansion/explode/array?param=a¶m=b - """) - @route("array{?param*}") - op `array`(param: string[]): void; - - @scenario - @scenarioDoc(""" - Test query expansion with explode: true when passed a record value. - Param value: {a: 1, b: 2} - Expected path: /routes/query/query-expansion/explode/record?a=1&b=2 - """) - @route("record{?param*}") - op `record`(param: Record): void; - } - } - - @route("query-continuation") - namespace QueryContinuation { - @route("standard") - namespace Standard { - @scenario - @scenarioDoc(""" - Test query continuation expansion with explode: false when passed a primitive value. - Param value: "a" - Expected path: /routes/query/query-continuation/standard/primitive?fixed=true¶m=a - """) - @route("primitive?fixed=true{¶m}") - op primitive(param: string): void; - - @scenario - @scenarioDoc(""" - Test query continuation expansion with explode: false when passed an array value. - Param value: ["a","b"] - Expected path: /routes/query/query-continuation/standard/array?fixed=true¶m=a,b - """) - @route("array?fixed=true{¶m}") - op `array`(param: string[]): void; - - @scenario - @scenarioDoc(""" - Test query continuation expansion with explode: false when passed a record value. - Param value: {a: 1, b: 2} - Expected path: /routes/query/query-continuation/standard/record?fixed=true¶m=a,1,b,2 - """) - @route("record?fixed=true{¶m}") - op `record`(param: Record): void; - } - - @route("explode") - namespace Explode { - @scenario - @scenarioDoc(""" - Test query continuation expansion with explode: true when passed a primitive value. - Param value: "a" - Expected path: /routes/query/query-continuation/explode/primitive?fixed=true¶m=a - """) - @route("primitive?fixed=true{¶m*}") - op primitive(param: string): void; - - @scenario - @scenarioDoc(""" - Test query continuation expansion with explode: true when passed an array value. - Param value: ["a","b"] - Expected path: /routes/query/query-continuation/explode/array?fixed=true¶m=a¶m=b - """) - @route("array?fixed=true{¶m*}") - op `array`(param: string[]): void; - - @scenario - @scenarioDoc(""" - Test query continuation expansion with explode: true when passed a record value. - Param value: {a: 1, b: 2} - Expected path: /routes/query/query-continuation/explode/record?fixed=true&a=1&b=2 - """) - @route("record?fixed=true{¶m*}") - op `record`(param: Record): void; - } - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/routes/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/routes/mockapi.ts deleted file mode 100644 index 8b1a0728a97..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/routes/mockapi.ts +++ /dev/null @@ -1,175 +0,0 @@ -import { MockRequest, passOnSuccess, ScenarioMockApi, ValidationError } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createTests(uri: string) { - const url = new URL("http://example.com" + uri); - const queryMap = new Map(); - for (const [key, value] of url.searchParams.entries()) { - if (queryMap.has(key)) { - const existing = queryMap.get(key)!; - if (Array.isArray(existing)) { - existing.push(value); - } else { - queryMap.set(key, [existing, value]); - } - } else { - queryMap.set(key, value); - } - } - return passOnSuccess({ - uri: url.pathname, - method: "get", - request: { - query: Object.fromEntries(queryMap), - }, - response: { - status: 204, - }, - handler: (req: MockRequest) => { - for (const [key, value] of queryMap.entries()) { - if (Array.isArray(value)) { - req.expect.containsQueryParam(key, value, "multi"); - } else { - req.expect.containsQueryParam(key, value); - } - } - for (const param of Object.keys(req.query)) { - if (!url.searchParams.has(param)) { - throw new ValidationError( - `Unexpected query parameter ${param}`, - undefined, - req.query[param], - ); - } - } - return { status: 204 }; - }, - kind: "MockApiDefinition", - }); -} - -Scenarios.Routes_InInterface = createTests("/routes/fixed"); -Scenarios.Routes_fixed = createTests("/routes/in-interface/fixed"); -Scenarios.Routes_PathParameters_templateOnly = createTests("/routes/path/template-only/a"); -Scenarios.Routes_PathParameters_explicit = createTests("/routes/path/explicit/a"); -Scenarios.Routes_PathParameters_annotationOnly = createTests("/routes/path/annotation-only/a"); -Scenarios.Routes_PathParameters_ReservedExpansion_template = createTests( - "/routes/path/reserved-expansion/template/foo/bar%20baz", -); -Scenarios.Routes_PathParameters_ReservedExpansion_annotation = createTests( - "/routes/path/reserved-expansion/annotation/foo/bar%20baz", -); -Scenarios.Routes_PathParameters_SimpleExpansion_Standard_primitive = createTests( - "/routes/path/simple/standard/primitivea", -); -Scenarios.Routes_PathParameters_SimpleExpansion_Standard_array = createTests( - "/routes/path/simple/standard/arraya,b", -); -Scenarios.Routes_PathParameters_SimpleExpansion_Standard_record = createTests( - "/routes/path/simple/standard/recorda,1,b,2", -); -Scenarios.Routes_PathParameters_SimpleExpansion_Explode_primitive = createTests( - "/routes/path/simple/explode/primitivea", -); -Scenarios.Routes_PathParameters_SimpleExpansion_Explode_array = createTests( - "/routes/path/simple/explode/arraya,b", -); -Scenarios.Routes_PathParameters_SimpleExpansion_Explode_record = createTests( - "/routes/path/simple/explode/recorda=1,b=2", -); -Scenarios.Routes_PathParameters_PathExpansion_Standard_primitive = createTests( - "/routes/path/path/standard/primitive/a", -); -Scenarios.Routes_PathParameters_PathExpansion_Standard_array = createTests( - "/routes/path/path/standard/array/a,b", -); -Scenarios.Routes_PathParameters_PathExpansion_Standard_record = createTests( - "/routes/path/path/standard/record/a,1,b,2", -); -Scenarios.Routes_PathParameters_PathExpansion_Explode_primitive = createTests( - "/routes/path/path/explode/primitive/a", -); -Scenarios.Routes_PathParameters_PathExpansion_Explode_array = createTests( - "/routes/path/path/explode/array/a/b", -); -Scenarios.Routes_PathParameters_PathExpansion_Explode_record = createTests( - "/routes/path/path/explode/record/a=1/b=2", -); -Scenarios.Routes_PathParameters_LabelExpansion_Standard_primitive = createTests( - "/routes/path/label/standard/primitive.a", -); -Scenarios.Routes_PathParameters_LabelExpansion_Standard_array = createTests( - "/routes/path/label/standard/array.a,b", -); -Scenarios.Routes_PathParameters_LabelExpansion_Standard_record = createTests( - "/routes/path/label/standard/record.a,1,b,2", -); -Scenarios.Routes_PathParameters_LabelExpansion_Explode_primitive = createTests( - "/routes/path/label/explode/primitive.a", -); -Scenarios.Routes_PathParameters_LabelExpansion_Explode_array = createTests( - "/routes/path/label/explode/array.a.b", -); -Scenarios.Routes_PathParameters_LabelExpansion_Explode_record = createTests( - "/routes/path/label/explode/record.a=1.b=2", -); -Scenarios.Routes_PathParameters_MatrixExpansion_Standard_primitive = createTests( - "/routes/path/matrix/standard/primitive;param=a", -); -Scenarios.Routes_PathParameters_MatrixExpansion_Standard_array = createTests( - "/routes/path/matrix/standard/array;param=a,b", -); -Scenarios.Routes_PathParameters_MatrixExpansion_Standard_record = createTests( - "/routes/path/matrix/standard/record;param=a,1,b,2", -); -Scenarios.Routes_PathParameters_MatrixExpansion_Explode_primitive = createTests( - "/routes/path/matrix/explode/primitive;param=a", -); -Scenarios.Routes_PathParameters_MatrixExpansion_Explode_array = createTests( - "/routes/path/matrix/explode/array;param=a;param=b", -); -Scenarios.Routes_PathParameters_MatrixExpansion_Explode_record = createTests( - "/routes/path/matrix/explode/record;a=1;b=2", -); -Scenarios.Routes_QueryParameters_templateOnly = createTests("/routes/query/template-only?param=a"); -Scenarios.Routes_QueryParameters_explicit = createTests("/routes/query/explicit?param=a"); -Scenarios.Routes_QueryParameters_annotationOnly = createTests( - "/routes/query/annotation-only?param=a", -); -Scenarios.Routes_QueryParameters_QueryExpansion_Standard_primitive = createTests( - "/routes/query/query-expansion/standard/primitive?param=a", -); -Scenarios.Routes_QueryParameters_QueryExpansion_Standard_array = createTests( - "/routes/query/query-expansion/standard/array?param=a,b", -); -Scenarios.Routes_QueryParameters_QueryExpansion_Standard_record = createTests( - "/routes/query/query-expansion/standard/record?param=a,1,b,2", -); -Scenarios.Routes_QueryParameters_QueryExpansion_Explode_primitive = createTests( - "/routes/query/query-expansion/explode/primitive?param=a", -); -Scenarios.Routes_QueryParameters_QueryExpansion_Explode_array = createTests( - "/routes/query/query-expansion/explode/array?param=a¶m=b", -); -Scenarios.Routes_QueryParameters_QueryExpansion_Explode_record = createTests( - "/routes/query/query-expansion/explode/record?a=1&b=2", -); -Scenarios.Routes_QueryParameters_QueryContinuation_Standard_primitive = createTests( - "/routes/query/query-continuation/standard/primitive?fixed=true¶m=a", -); -Scenarios.Routes_QueryParameters_QueryContinuation_Standard_array = createTests( - "/routes/query/query-continuation/standard/array?fixed=true¶m=a,b", -); -Scenarios.Routes_QueryParameters_QueryContinuation_Standard_record = createTests( - "/routes/query/query-continuation/standard/record?fixed=true¶m=a,1,b,2", -); -Scenarios.Routes_QueryParameters_QueryContinuation_Explode_primitive = createTests( - "/routes/query/query-continuation/explode/primitive?fixed=true¶m=a", -); -Scenarios.Routes_QueryParameters_QueryContinuation_Explode_array = createTests( - "/routes/query/query-continuation/explode/array?fixed=true¶m=a¶m=b", -); -Scenarios.Routes_QueryParameters_QueryContinuation_Explode_record = createTests( - "/routes/query/query-continuation/explode/record?fixed=true&a=1&b=2", -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/scratch/.npmignore b/packages/http-client-java/generator/http-client-generator-test/specs/scratch/.npmignore deleted file mode 100644 index ae140cafe73..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/scratch/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -# This directory reserved for creating scratch *.tsp for testing/experimentation -**/* -!.gitignore diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/main.tsp deleted file mode 100644 index 8d1d0e006f9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/main.tsp +++ /dev/null @@ -1,45 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Encoded names") -@scenarioService("/serialization/encoded-name/json") -namespace Serialization.EncodedName.Json; - -@route("/property") -namespace Property { - model JsonEncodedNameModel { - /** Pass in true */ - @encodedName("application/json", "wireName") - defaultName: boolean; - } - - @scenario - @scenarioDoc(""" - Testing that you send the right JSON name on the wire. - Your generated SDK should generate JsonEncodedNameModel with one property `defaultName` with wire name `wireName`. - - Expected request body: - ```json - {"wireName": true} - ``` - """) - @post - op send(@bodyRoot body: JsonEncodedNameModel): NoContentResponse; - - @scenario - @scenarioDoc(""" - Testing that you deserialize the right json name over the wire. - - Your generated SDK should generate JsonEncodedNameModel with one property `defaultName` with wire name `wireName`. - - Expected response body: - ```json - {"wireName": true} - ``` - """) - @get - op get(): JsonEncodedNameModel; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/mockapi.ts deleted file mode 100644 index 5087a954e8a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/serialization/encoded-name/json/mockapi.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Serialization_EncodedName_Json_Property_send = passOnSuccess({ - uri: "/serialization/encoded-name/json/property", - method: "post", - request: { body: json({ wireName: true }) }, - response: { status: 204 }, - kind: "MockApiDefinition", -}); - -Scenarios.Serialization_EncodedName_Json_Property_get = passOnSuccess({ - uri: "/serialization/encoded-name/json/property", - method: "get", - request: {}, - response: { - status: 200, - body: json({ wireName: true }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/main.tsp deleted file mode 100644 index d477ddb8130..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/main.tsp +++ /dev/null @@ -1,18 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -/** - * Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let user pass in. - */ -@route("/server/endpoint/not-defined") -@service(#{ title: "Testserver without any endpoint" }) -namespace Server.Endpoint.NotDefined; - -@scenario -@scenarioDoc("A simple operation in a server without defining a endpoint. Expected uri: '/valid'") -@route("/valid") -@head -op valid(): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/mockapi.ts deleted file mode 100644 index c3a58c08826..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/server/endpoint/not-defined/mockapi.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Server_Endpoint_NotDefined_valid = passOnSuccess({ - uri: "/server/endpoint/not-defined/valid", - method: "head", - request: {}, - response: { - status: 200, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/main.tsp deleted file mode 100644 index 8910fd834b8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/main.tsp +++ /dev/null @@ -1,45 +0,0 @@ -import "@typespec/rest"; -import "@typespec/spector"; -import "@typespec/versioning"; - -using Http; -using Spector; -using Versioning; -using Rest; - -@versioned(Versions) -@service(#{ title: "ServerPathMultiple" }) -@server( - "{endpoint}/server/path/multiple/{apiVersion}", - "Test server with path parameters.", - { - @doc("Pass in http://localhost:3000 for endpoint.") - endpoint: url, - - @doc("Pass in v1.0 for API version.") - apiVersion: Versions, - } -) -namespace Server.Path.Multiple; - -@doc("Service versions") -enum Versions { - @doc("Version 1.0") - v1_0: "v1.0", -} - -@scenario -@scenarioDoc(""" - Operation with client path parameters. - - Expected path parameter: apiVersion=v1.0 - """) -op noOperationParams(): NoContentResponse; - -@scenario -@scenarioDoc(""" - Operation with client and method path parameters. - - Expected path parameter: apiVersion=v1.0, keyword=test - """) -op withOperationPathParam(@path keyword: string): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/mockapi.ts deleted file mode 100644 index 8c5fef06e1c..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/server/path/multiple/mockapi.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Server_Path_Multiple_noOperationParams = passOnSuccess({ - uri: "/server/path/multiple/v1.0", - method: "get", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Server_Path_Multiple_withOperationPathParam = passOnSuccess({ - uri: "/server/path/multiple/v1.0/test", - method: "get", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/main.tsp deleted file mode 100644 index fd8713c47a6..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/main.tsp +++ /dev/null @@ -1,24 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates server with a single path parameter @server") -@service -@server( - "{endpoint}", - "Testserver endpoint", - { - @doc("Need to be set as 'http://localhost:3000' in client.") - endpoint: url, - } -) -@route("/server/path/single") -namespace Server.Path.Single; - -@scenario -@scenarioDoc("An simple operation in a parameterized server.") -@route("/myOp") -@head -op myOp(): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/mockapi.ts deleted file mode 100644 index 93619e73574..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/server/path/single/mockapi.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Server_Path_Single_myOp = passOnSuccess({ - uri: "/server/path/single/myOp", - method: "head", - request: {}, - response: { - status: 200, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/main.tsp deleted file mode 100644 index 0f8bafb36cf..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/main.tsp +++ /dev/null @@ -1,40 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -/** - * Illustrates not-versioned server. - */ -@service -@server( - "{endpoint}", - "Testserver endpoint", - { - /** - * Need to be set as 'http://localhost:3000' in client. - */ - endpoint: url, - } -) -@route("/server/versions/not-versioned") -namespace Server.Versions.NotVersioned; - -@scenario -@scenarioDoc("A simple operation without api-version. Expected url: '/without-api-version', it should not contain any api-version.") -@route("/without-api-version") -@head -op withoutApiVersion(): OkResponse; - -@scenario -@scenarioDoc("A simple operation with query api-version, which doesn't have any default value. Expected url: '/with-query-api-version?api-version=v1.0'.") -@route("/with-query-api-version") -@head -op withQueryApiVersion(@query("api-version") apiVersion: string): OkResponse; - -@scenario -@scenarioDoc("A simple operation with path api-version, which doesn't have any default value. Expected url: '/with-path-api-version/v1.0'.") -@route("/with-path-api-version") -@head -op withPathApiVersion(@path apiVersion: string): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/mockapi.ts deleted file mode 100644 index c08ac66b0cb..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/not-versioned/mockapi.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { MockRequest, passOnSuccess, ScenarioMockApi, ValidationError } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createServerTests(uri: string, requestData?: any) { - let requestObject: any; - if (requestData) { - requestObject = requestData; - } else { - requestObject = {}; - } - return passOnSuccess({ - uri, - method: "head", - request: requestObject, - response: { - status: 200, - }, - handler: (req: MockRequest) => { - if (Object.keys(req.query).length > 0) { - throw new ValidationError( - "Expected no query parameters including api-version", - "No query parameters", - req.query, - ); - } - return { status: 200 }; - }, - kind: "MockApiDefinition", - }); -} - -Scenarios.Server_Versions_NotVersioned_withoutApiVersion = createServerTests( - "/server/versions/not-versioned/without-api-version", -); -Scenarios.Server_Versions_NotVersioned_withPathApiVersion = createServerTests( - "/server/versions/not-versioned/with-path-api-version/v1.0", -); -Scenarios.Server_Versions_NotVersioned_withQueryApiVersion = passOnSuccess({ - uri: "/server/versions/not-versioned/with-query-api-version", - method: "head", - request: { - query: { - "api-version": "v1.0", - }, - }, - response: { - status: 200, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/main.tsp deleted file mode 100644 index d8fc46e3c05..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/main.tsp +++ /dev/null @@ -1,64 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@typespec/versioning"; - -using Http; -using Spector; -using Versioning; - -/** - * Illustrates versioned server. - */ -@service -@versioned(Versions) -@server( - "{endpoint}", - "Testserver endpoint", - { - /** - * Need to be set as 'http://localhost:3000' in client. - */ - endpoint: url, - } -) -@route("/server/versions/versioned") -namespace Server.Versions.Versioned; - -/** - * The version of the API. - */ -enum Versions { - /** - * The version 2022-12-01-preview. - */ - v2021_01_01_preview: "2021-01-01-preview", - - /** - * The version 2022-12-01-preview. - */ - v2022_12_01_preview: "2022-12-01-preview", -} - -@scenario -@scenarioDoc("A simple operation without api-version. Expected url: '/without-api-version', it should not contain any api-version.") -@route("/without-api-version") -@head -op withoutApiVersion(): OkResponse; - -@scenario -@scenarioDoc("A simple operation with query api-version, whose default value is defined as '2022-12-01-preview'. Expected url: '/with-query-api-version?api-version=2022-12-01-preview'.") -@route("/with-query-api-version") -@head -op withQueryApiVersion(@query("api-version") apiVersion: string): OkResponse; - -@scenario -@scenarioDoc("A simple operation with path api-version, whose default value is defined as '2022-12-01-preview'. Expected url: '/with-path-api-version/2022-12-01-preview'.") -@route("/with-path-api-version") -@head -op withPathApiVersion(@path apiVersion: string): OkResponse; - -@scenario -@scenarioDoc("A simple operation with query api-version, that do NOT use the default but '2021-01-01-preview'. It's expected to be set at the client level. Expected url: '/with-old-query-api-version?api-version=2021-01-01-preview'.") -@route("/with-query-old-api-version") -@head -op withQueryOldApiVersion(@query("api-version") apiVersion: string): OkResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/mockapi.ts deleted file mode 100644 index 2e3e41d9236..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/server/versions/versioned/mockapi.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { MockRequest, passOnSuccess, ScenarioMockApi, ValidationError } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createServerTests(uri: string) { - return passOnSuccess({ - uri, - method: "head", - request: {}, - response: { - status: 200, - }, - handler: (req: MockRequest) => { - if (Object.keys(req.query).length > 0) { - throw new ValidationError( - "Expected no query parameters including api-version", - "No query parameters", - req.query, - ); - } - return { status: 200 }; - }, - kind: "MockApiDefinition", - }); -} - -Scenarios.Server_Versions_Versioned_withoutApiVersion = createServerTests( - "/server/versions/versioned/without-api-version", -); -Scenarios.Server_Versions_Versioned_withPathApiVersion = createServerTests( - "/server/versions/versioned/with-path-api-version/2022-12-01-preview", -); - -function createAPIVersionTests(uri: string, version: string) { - return passOnSuccess({ - uri, - method: "head", - request: { - query: { - "api-version": version, - }, - }, - response: { - status: 200, - }, - kind: "MockApiDefinition", - }); -} - -Scenarios.Server_Versions_Versioned_withQueryOldApiVersion = createAPIVersionTests( - "/server/versions/versioned/with-query-old-api-version", - "2021-01-01-preview", -); - -Scenarios.Server_Versions_Versioned_withQueryApiVersion = createAPIVersionTests( - "/server/versions/versioned/with-query-api-version", - "2022-12-01-preview", -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/client.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/client.tsp deleted file mode 100644 index 53215701eb8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/client.tsp +++ /dev/null @@ -1,14 +0,0 @@ -import "./main.tsp"; -import "@azure-tools/typespec-client-generator-core"; -import "@typespec/spector"; -import "@typespec/http"; -import "@typespec/versioning"; - -using Azure.ClientGenerator.Core; -using Spector; -using Versioning; - -@client({ - service: [Service.MultiService.ServiceA, Service.MultiService.ServiceB], -}) -namespace Service.MultiService.Combined; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/main.tsp deleted file mode 100644 index 6f71022f937..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/main.tsp +++ /dev/null @@ -1,61 +0,0 @@ -import "@typespec/versioning"; -import "@typespec/http"; -import "@typespec/spector"; - -using Versioning; -using Http; -using Spector; - -namespace Service.MultiService; - -/* - * First service definition in a multi-service package with versioning - */ -@scenarioService("/service/multi-service/service-a") -@versioned(VersionsA) -namespace ServiceA { - enum VersionsA { - av1, - av2, - } - - @route("foo") - interface Foo { - @scenario - @scenarioDoc(""" - Test that a client can expose operations from multiple services. This operaton should be called like this: `client.foo.test(...)`. - - Expected path: /service/multi-service/service-a/foo/test - Expected query parameter: api-version=av2 - Expected 204 response. - """) - @route("/test") - test(@query("api-version") apiVersion: VersionsA): void; - } -} - -/** - * Second service definition in a multi-service package with versioning - */ -@scenarioService("/service/multi-service/service-b") -@versioned(VersionsB) -namespace ServiceB { - enum VersionsB { - bv1, - bv2, - } - - @route("bar") - interface Bar { - @scenario - @scenarioDoc(""" - Test that a client can expose operations from multiple services. This operaton should be called like this: `client.bar.test(...)`. - - Expected path: /service/multi-service/service-b/bar/test - Expected query parameter: api-version=bv2 - Expected 204 response. - """) - @route("/test") - test(@query("api-version") apiVersion: VersionsB): void; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/mockapi.ts deleted file mode 100644 index 0f819722353..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/service/multi-service/mockapi.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Service_MultiService_ServiceA_Foo_test = passOnSuccess({ - uri: "/service/multi-service/service-a/foo/test", - method: "get", - request: { - query: { - "api-version": "av2", - }, - }, - response: { status: 204 }, - kind: "MockApiDefinition", -}); - -Scenarios.Service_MultiService_ServiceB_Bar_test = passOnSuccess({ - uri: "/service/multi-service/service-b/bar/test", - method: "get", - request: { - query: { - "api-version": "bv2", - }, - }, - response: { status: 204 }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/main.tsp deleted file mode 100644 index eb621c54438..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/main.tsp +++ /dev/null @@ -1,89 +0,0 @@ -import "@typespec/http"; -import "@typespec/versioning"; -import "@typespec/spector"; - -using Http; -using Spector; -using Versioning; - -@doc("Illustrates conditional request headers") -@scenarioService("/special-headers/conditional-request") -namespace SpecialHeaders.ConditionalRequest; - -@scenario -@doc(""" - Check when only If-Match in header is defined. - """) -@scenarioDoc(""" - Check when only If-Match in header is defined. - Expected header parameters: - - if-match="valid" - """) -@post -@route("/if-match") -op postIfMatch( - @header("If-Match") - @doc("The request should only proceed if an entity matches this string.") - ifMatch?: string, -): NoContentResponse; - -@scenario -@doc(""" - Check when only If-None-Match in header is defined. - """) -@scenarioDoc(""" - Check when only If-None-Match in header is defined. - Expected header parameters: - - if-nonematch="invalid" - """) -@post -@route("/if-none-match") -op postIfNoneMatch( - @header("If-None-Match") - @doc("The request should only proceed if no entity matches this string.") - ifNoneMatch?: string, -): NoContentResponse; - -@scenario -@doc(""" - Check when only If-Modified-Since in header is defined. - """) -@scenarioDoc(""" - Check when only If-Modified-Since in header is defined. - Expected header parameters: - - if-modified-since=Fri, 26 Aug 2022 14:38:00 GMT - """) -@head -@route("/if-modified-since") -op headIfModifiedSince( - @doc(""" - A timestamp indicating the last modified time of the resource known to the - client. The operation will be performed only if the resource on the service has - been modified since the specified time. - """) - @header("If-Modified-Since") - @encode(DateTimeKnownEncoding.rfc7231) - ifModifiedSince?: utcDateTime, -): NoContentResponse; - -@scenario -@doc(""" - Check when only If-Unmodified-Since in header is defined. - """) -@scenarioDoc(""" - Check when only If-Unmodified-Since in header is defined. - Expected header parameters: - - if-unmodified-since=Fri, 26 Aug 2022 14:38:00 GMT - """) -@post -@route("/if-unmodified-since") -op postIfUnmodifiedSince( - @doc(""" - A timestamp indicating the last modified time of the resource known to the - client. The operation will be performed only if the resource on the service has - not been modified since the specified time. - """) - @header("If-Unmodified-Since") - @encode(DateTimeKnownEncoding.rfc7231) - ifUnmodifiedSince?: utcDateTime, -): NoContentResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/mockapi.ts deleted file mode 100644 index ddad3105af4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/conditional-request/mockapi.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.SpecialHeaders_ConditionalRequest_postIfUnmodifiedSince = passOnSuccess({ - uri: "/special-headers/conditional-request/if-unmodified-since", - method: "post", - request: { - headers: { - "if-unmodified-since": "Fri, 26 Aug 2022 14:38:00 GMT", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.SpecialHeaders_ConditionalRequest_headIfModifiedSince = passOnSuccess({ - uri: "/special-headers/conditional-request/if-modified-since", - method: "head", - request: { - headers: { - "if-modified-since": "Fri, 26 Aug 2022 14:38:00 GMT", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.SpecialHeaders_ConditionalRequest_postIfMatch = passOnSuccess({ - uri: "/special-headers/conditional-request/if-match", - method: "post", - request: { - headers: { - "if-match": '"valid"', - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.SpecialHeaders_ConditionalRequest_postIfNoneMatch = passOnSuccess({ - uri: "/special-headers/conditional-request/if-none-match", - method: "post", - request: { - headers: { - "if-none-match": '"invalid"', - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/main.tsp deleted file mode 100644 index b40e5e93478..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/main.tsp +++ /dev/null @@ -1,39 +0,0 @@ -import "@typespec/http"; -import "@typespec/versioning"; -import "@typespec/spector"; - -using Http; -using Spector; -using Versioning; - -@doc("Illustrates OASIS repeatability headers") -@scenarioService("/special-headers/repeatability") -namespace SpecialHeaders.Repeatability; - -model RepeatableResponse { - @doc("The status code.") - @statusCode - statusCode: 204; - - @visibility(Lifecycle.Read) - @header("Repeatability-Result") - @doc("Indicates whether the repeatable request was accepted or rejected.") - repeatabilityResult?: "accepted" | "rejected"; -} - -@scenario -@scenarioDoc(""" - Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. - """) -@doc(""" - Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. - """) -@post -@route("/immediateSuccess") -op immediateSuccess( - @header("Repeatability-Request-ID") - repeatabilityRequestID: string, - - @header("Repeatability-First-Sent") - repeatabilityFirstSent: utcDateTime, -): RepeatableResponse; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/mockapi.ts deleted file mode 100644 index 5e24cc55666..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/special-headers/repeatability/mockapi.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { - MockRequest, - passOnSuccess, - ScenarioMockApi, - validateValueFormat, - ValidationError, -} from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.SpecialHeaders_Repeatability_immediateSuccess = passOnSuccess({ - uri: "/special-headers/repeatability/immediateSuccess", - method: "post", - request: { - headers: { - "Repeatability-First-Sent": "Tue, 15 Nov 2022 12:45:26 GMT", - "Repeatability-Request-ID": "2378d9bc-1726-11ee-be56-0242ac120002", // fake uuid - }, - }, - response: { - status: 204, - headers: { - "repeatability-result": "accepted", - }, - }, - handler: (req: MockRequest) => { - if (!("repeatability-request-id" in req.headers)) { - throw new ValidationError("Repeatability-Request-ID is missing", "A UUID string", undefined); - } - if (!("repeatability-first-sent" in req.headers)) { - throw new ValidationError( - "Repeatability-First-Sent is missing", - "A date-time in headers format", - undefined, - ); - } - validateValueFormat(req.headers["repeatability-request-id"], "uuid"); - validateValueFormat(req.headers["repeatability-first-sent"], "rfc7231"); - return { - status: 204, - headers: { - "repeatability-result": "accepted", - }, - }; - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-words/dec.js b/packages/http-client-java/generator/http-client-generator-test/specs/special-words/dec.js deleted file mode 100644 index b3188c2b223..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/special-words/dec.js +++ /dev/null @@ -1,52 +0,0 @@ -// @ts-check - -import { $route } from "@typespec/http"; -import { $scenario, $scenarioDoc } from "@typespec/spector"; - -/** - * - * @param {*} context - * @param {*} target - * @param {*} name - */ -export function $opNameScenario(context, target, name) { - context.call($scenario, target, name.value); - context.call( - $scenarioDoc, - target, - `Verify that the name "${name.value}" works as an operation name. Call this operation to pass.`, - ); - context.call($route, target, `/${name.value}`); -} - -/** - * - * @param {*} context - * @param {*} target - * @param {*} name - */ -export function $paramNameScenario(context, target, name) { - context.call($scenario, target, name.value); - context.call( - $scenarioDoc, - target, - `Verify that the name "${name.value}" works. Send this parameter to pass with value \`ok\`.`, - ); - context.call($route, target, `/${name.value}`); -} - -/** - * - * @param {*} context - * @param {*} target - * @param {*} name - */ -export function $modelNameScenario(context, target, name) { - context.call($scenario, target, name.value); - context.call( - $scenarioDoc, - target, - `Verify that the name "${name.value}" works. Send\n\`\`\`json\n{"name": "ok"}\n\`\`\` `, - ); - context.call($route, target, `/${name.value}`); -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-words/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/special-words/main.tsp deleted file mode 100644 index 2705d858905..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/special-words/main.tsp +++ /dev/null @@ -1,272 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "./dec.js"; - -using Http; -using Spector; - -/** - * Scenarios to verify that reserved words can be used in service and generators will handle it appropriately. - * - * Current list of special words - * ```txt - * and - * as - * assert - * async - * await - * break - * class - * constructor - * continue - * def - * del - * elif - * else - * except - * exec - * finally - * for - * from - * global - * if - * import - * in - * is - * lambda - * not - * or - * pass - * raise - * return - * try - * while - * with - * yield - * ``` - */ -@scenarioService("/special-words") -namespace SpecialWords; - -/** - * Test reserved words as operation name. - */ -@route("/operations") -interface Operations { - @opNameScenario("and") and(): void; - @opNameScenario("as") as(): void; - @opNameScenario("assert") assert(): void; - @opNameScenario("async") `async`(): void; - @opNameScenario("await") await(): void; - @opNameScenario("break") break(): void; - @opNameScenario("class") class(): void; - @opNameScenario("constructor") constructor(): void; - @opNameScenario("continue") continue(): void; - @opNameScenario("def") def(): void; - @opNameScenario("del") del(): void; - @opNameScenario("elif") elif(): void; - @opNameScenario("else") `else`(): void; - @opNameScenario("except") except(): void; - @opNameScenario("exec") exec(): void; - @opNameScenario("finally") finally(): void; - @opNameScenario("for") for(): void; - @opNameScenario("from") from(): void; - @opNameScenario("global") global(): void; - @opNameScenario("if") `if`(): void; - @opNameScenario("import") `import`(): void; - @opNameScenario("in") in(): void; - @opNameScenario("is") `is`(): void; - @opNameScenario("lambda") lambda(): void; - @opNameScenario("not") not(): void; - @opNameScenario("or") or(): void; - @opNameScenario("pass") pass(): void; - @opNameScenario("raise") raise(): void; - @opNameScenario("return") `return`(): void; - @opNameScenario("try") try(): void; - @opNameScenario("while") while(): void; - @opNameScenario("with") `with`(): void; - @opNameScenario("yield") yield(): void; -} - -/** - * Verify reserved words as parameter name. - */ -@route("/parameters") -interface Parameters { - @paramNameScenario("and") withAnd(@query and: string): void; - @paramNameScenario("as") withAs(@query as: string): void; - @paramNameScenario("assert") withAssert(@query assert: string): void; - @paramNameScenario("async") withAsync(@query async: string): void; - @paramNameScenario("await") withAwait(@query await: string): void; - @paramNameScenario("break") withBreak(@query break: string): void; - @paramNameScenario("class") withClass(@query class: string): void; - @paramNameScenario("constructor") withConstructor(@query constructor: string): void; - @paramNameScenario("continue") withContinue(@query continue: string): void; - @paramNameScenario("def") withDef(@query def: string): void; - @paramNameScenario("del") withDel(@query del: string): void; - @paramNameScenario("elif") withElif(@query elif: string): void; - @paramNameScenario("else") withElse(@query `else`: string): void; - @paramNameScenario("except") withExcept(@query except: string): void; - @paramNameScenario("exec") withExec(@query exec: string): void; - @paramNameScenario("finally") withFinally(@query finally: string): void; - @paramNameScenario("for") withFor(@query for: string): void; - @paramNameScenario("from") withFrom(@query from: string): void; - @paramNameScenario("global") withGlobal(@query global: string): void; - @paramNameScenario("if") withIf(@query `if`: string): void; - @paramNameScenario("import") withImport(@query `import`: string): void; - @paramNameScenario("in") withIn(@query in: string): void; - @paramNameScenario("is") withIs(@query `is`: string): void; - @paramNameScenario("lambda") withLambda(@query lambda: string): void; - @paramNameScenario("not") withNot(@query not: string): void; - @paramNameScenario("or") withOr(@query or: string): void; - @paramNameScenario("pass") withPass(@query pass: string): void; - @paramNameScenario("raise") withRaise(@query raise: string): void; - @paramNameScenario("return") withReturn(@query `return`: string): void; - @paramNameScenario("try") withTry(@query try: string): void; - @paramNameScenario("while") withWhile(@query while: string): void; - @paramNameScenario("with") withWith(@query with: string): void; - @paramNameScenario("yield") withYield(@query yield: string): void; - - // Non keywords but parameters name that could cause conflict with some language standards - @paramNameScenario("cancellationToken") withCancellationToken( - @query cancellationToken: string, - ): void; -} - -/** - * Verify model names - */ -@route("/models") -namespace Models { - model Base { - name: string; - } - model and is Base; - model as is Base; - model assert is Base; - model `async` is Base; - model await is Base; - model break is Base; - model class is Base; - model continue is Base; - model constructor is Base; - model def is Base; - model del is Base; - model elif is Base; - model `else` is Base; - model except is Base; - model exec is Base; - model finally is Base; - model for is Base; - model from is Base; - model global is Base; - model `if` is Base; - model `import` is Base; - model in is Base; - model `is` is Base; - model lambda is Base; - model not is Base; - model or is Base; - model pass is Base; - model raise is Base; - model `return` is Base; - model try is Base; - model while is Base; - model `with` is Base; - model yield is Base; - - @modelNameScenario("and") op withAnd(@body body: and): void; - @modelNameScenario("as") op withAs(@body body: as): void; - @modelNameScenario("assert") op withAssert(@body body: assert): void; - @modelNameScenario("async") op withAsync(@body body: `async`): void; - @modelNameScenario("await") op withAwait(@body body: await): void; - @modelNameScenario("break") op withBreak(@body body: break): void; - @modelNameScenario("class") op withClass(@body body: class): void; - @modelNameScenario("constructor") op withConstructor(@body body: constructor): void; - @modelNameScenario("continue") op withContinue(@body body: continue): void; - @modelNameScenario("def") op withDef(@body body: def): void; - @modelNameScenario("del") op withDel(@body body: del): void; - @modelNameScenario("elif") op withElif(@body body: elif): void; - @modelNameScenario("else") op withElse(@body body: `else`): void; - @modelNameScenario("except") op withExcept(@body body: except): void; - @modelNameScenario("exec") op withExec(@body body: exec): void; - @modelNameScenario("finally") op withFinally(@body body: finally): void; - @modelNameScenario("for") op withFor(@body body: for): void; - @modelNameScenario("from") op withFrom(@body body: from): void; - @modelNameScenario("global") op withGlobal(@body body: global): void; - @modelNameScenario("if") op withIf(@body body: `if`): void; - @modelNameScenario("import") op withImport(@body body: `import`): void; - @modelNameScenario("in") op withIn(@body body: in): void; - @modelNameScenario("is") op withIs(@body body: `is`): void; - @modelNameScenario("lambda") op withLambda(@body body: lambda): void; - @modelNameScenario("not") op withNot(@body body: not): void; - @modelNameScenario("or") op withOr(@body body: or): void; - @modelNameScenario("pass") op withPass(@body body: pass): void; - @modelNameScenario("raise") op withRaise(@body body: raise): void; - @modelNameScenario("return") op withReturn(@body body: `return`): void; - @modelNameScenario("try") op withTry(@body body: try): void; - @modelNameScenario("while") op withWhile(@body body: while): void; - @modelNameScenario("with") op withWith(@body body: `with`): void; - @modelNameScenario("yield") op withYield(@body body: yield): void; -} - -/** - * Verify model names - */ -@route("/model-properties") -namespace ModelProperties { - model SameAsModel { - SameAsModel: string; - } - - @scenario - @scenarioDoc(""" - Verify that a property can be called the same as the model name. This can be an issue in some languages where the class name is the constructor. - - Send - - ```json - {"SameAsModel": "ok"} - ``` - """) - @route("same-as-model") - op sameAsModel(@body body: SameAsModel): void; - - // Python dict method names that could conflict - model DictMethods { - keys: string; - items: string; - values: string; - popitem: string; - clear: string; - update: string; - setdefault: string; - pop: string; - get: string; - copy: string; - } - - @scenario - @scenarioDoc(""" - Verify that model properties can use names that are Python dict methods. These names (keys, items, values, etc.) may conflict with Python's dict class methods. - - Send - - ```json - { - "keys": "ok", - "items": "ok", - "values": "ok", - "popitem": "ok", - "clear": "ok", - "update": "ok", - "setdefault": "ok", - "pop": "ok", - "get": "ok", - "copy": "ok" - } - ``` - """) - @route("dict-methods") - op dictMethods(@body body: DictMethods): void; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/special-words/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/special-words/mockapi.ts deleted file mode 100644 index 4d2883b10f1..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/special-words/mockapi.ts +++ /dev/null @@ -1,407 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.SpecialWords_ModelProperties_sameAsModel = passOnSuccess({ - uri: "/special-words/model-properties/same-as-model", - method: "post", - request: { - body: json({ - SameAsModel: "ok", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.SpecialWords_ModelProperties_dictMethods = passOnSuccess({ - uri: "/special-words/model-properties/dict-methods", - method: "post", - request: { - body: json({ - keys: "ok", - items: "ok", - values: "ok", - popitem: "ok", - clear: "ok", - update: "ok", - setdefault: "ok", - pop: "ok", - get: "ok", - copy: "ok", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -function createModelsTests(uri: string) { - return passOnSuccess({ - uri, - method: "post", - request: { - body: json({ - name: "ok", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }); -} -Scenarios.SpecialWords_Models_and = createModelsTests(`/special-words/models/and`); -Scenarios.SpecialWords_Models_as = createModelsTests(`/special-words/models/as`); -Scenarios.SpecialWords_Models_assert = createModelsTests(`/special-words/models/assert`); -Scenarios.SpecialWords_Models_async = createModelsTests(`/special-words/models/async`); -Scenarios.SpecialWords_Models_await = createModelsTests(`/special-words/models/await`); -Scenarios.SpecialWords_Models_break = createModelsTests(`/special-words/models/break`); -Scenarios.SpecialWords_Models_class = createModelsTests(`/special-words/models/class`); -Scenarios.SpecialWords_Models_constructor = createModelsTests(`/special-words/models/constructor`); -Scenarios.SpecialWords_Models_continue = createModelsTests(`/special-words/models/continue`); -Scenarios.SpecialWords_Models_def = createModelsTests(`/special-words/models/def`); -Scenarios.SpecialWords_Models_del = createModelsTests(`/special-words/models/del`); -Scenarios.SpecialWords_Models_elif = createModelsTests(`/special-words/models/elif`); -Scenarios.SpecialWords_Models_else = createModelsTests(`/special-words/models/else`); -Scenarios.SpecialWords_Models_except = createModelsTests(`/special-words/models/except`); -Scenarios.SpecialWords_Models_exec = createModelsTests(`/special-words/models/exec`); -Scenarios.SpecialWords_Models_finally = createModelsTests(`/special-words/models/finally`); -Scenarios.SpecialWords_Models_for = createModelsTests(`/special-words/models/for`); -Scenarios.SpecialWords_Models_from = createModelsTests(`/special-words/models/from`); -Scenarios.SpecialWords_Models_global = createModelsTests(`/special-words/models/global`); -Scenarios.SpecialWords_Models_if = createModelsTests(`/special-words/models/if`); -Scenarios.SpecialWords_Models_import = createModelsTests(`/special-words/models/import`); -Scenarios.SpecialWords_Models_in = createModelsTests(`/special-words/models/in`); -Scenarios.SpecialWords_Models_is = createModelsTests(`/special-words/models/is`); -Scenarios.SpecialWords_Models_lambda = createModelsTests(`/special-words/models/lambda`); -Scenarios.SpecialWords_Models_not = createModelsTests(`/special-words/models/not`); -Scenarios.SpecialWords_Models_or = createModelsTests(`/special-words/models/or`); -Scenarios.SpecialWords_Models_pass = createModelsTests(`/special-words/models/pass`); -Scenarios.SpecialWords_Models_raise = createModelsTests(`/special-words/models/raise`); -Scenarios.SpecialWords_Models_return = createModelsTests(`/special-words/models/return`); -Scenarios.SpecialWords_Models_try = createModelsTests(`/special-words/models/try`); -Scenarios.SpecialWords_Models_while = createModelsTests(`/special-words/models/while`); -Scenarios.SpecialWords_Models_with = createModelsTests(`/special-words/models/with`); -Scenarios.SpecialWords_Models_yield = createModelsTests(`/special-words/models/yield`); - -function createOperationsTests(uri: string) { - return passOnSuccess({ - uri, - method: "get", - request: {}, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }); -} - -Scenarios.SpecialWords_Operations_and = createOperationsTests(`/special-words/operations/and`); -Scenarios.SpecialWords_Operations_as = createOperationsTests(`/special-words/operations/as`); -Scenarios.SpecialWords_Operations_assert = createOperationsTests( - `/special-words/operations/assert`, -); -Scenarios.SpecialWords_Operations_async = createOperationsTests(`/special-words/operations/async`); -Scenarios.SpecialWords_Operations_await = createOperationsTests(`/special-words/operations/await`); -Scenarios.SpecialWords_Operations_break = createOperationsTests(`/special-words/operations/break`); -Scenarios.SpecialWords_Operations_class = createOperationsTests(`/special-words/operations/class`); -Scenarios.SpecialWords_Operations_constructor = createOperationsTests( - `/special-words/operations/constructor`, -); -Scenarios.SpecialWords_Operations_continue = createOperationsTests( - `/special-words/operations/continue`, -); -Scenarios.SpecialWords_Operations_def = createOperationsTests(`/special-words/operations/def`); -Scenarios.SpecialWords_Operations_del = createOperationsTests(`/special-words/operations/del`); -Scenarios.SpecialWords_Operations_elif = createOperationsTests(`/special-words/operations/elif`); -Scenarios.SpecialWords_Operations_else = createOperationsTests(`/special-words/operations/else`); -Scenarios.SpecialWords_Operations_except = createOperationsTests( - `/special-words/operations/except`, -); -Scenarios.SpecialWords_Operations_exec = createOperationsTests(`/special-words/operations/exec`); -Scenarios.SpecialWords_Operations_finally = createOperationsTests( - `/special-words/operations/finally`, -); -Scenarios.SpecialWords_Operations_for = createOperationsTests(`/special-words/operations/for`); -Scenarios.SpecialWords_Operations_from = createOperationsTests(`/special-words/operations/from`); -Scenarios.SpecialWords_Operations_global = createOperationsTests( - `/special-words/operations/global`, -); -Scenarios.SpecialWords_Operations_if = createOperationsTests(`/special-words/operations/if`); -Scenarios.SpecialWords_Operations_import = createOperationsTests( - `/special-words/operations/import`, -); -Scenarios.SpecialWords_Operations_in = createOperationsTests(`/special-words/operations/in`); -Scenarios.SpecialWords_Operations_is = createOperationsTests(`/special-words/operations/is`); -Scenarios.SpecialWords_Operations_lambda = createOperationsTests( - `/special-words/operations/lambda`, -); -Scenarios.SpecialWords_Operations_not = createOperationsTests(`/special-words/operations/not`); -Scenarios.SpecialWords_Operations_or = createOperationsTests(`/special-words/operations/or`); -Scenarios.SpecialWords_Operations_pass = createOperationsTests(`/special-words/operations/pass`); -Scenarios.SpecialWords_Operations_raise = createOperationsTests(`/special-words/operations/raise`); -Scenarios.SpecialWords_Operations_return = createOperationsTests( - `/special-words/operations/return`, -); -Scenarios.SpecialWords_Operations_try = createOperationsTests(`/special-words/operations/try`); -Scenarios.SpecialWords_Operations_while = createOperationsTests(`/special-words/operations/while`); -Scenarios.SpecialWords_Operations_with = createOperationsTests(`/special-words/operations/with`); -Scenarios.SpecialWords_Operations_yield = createOperationsTests(`/special-words/operations/yield`); - -function createParametersTests(uri: string, data: any, paramName: string) { - return passOnSuccess({ - uri, - method: "get", - request: { - query: data, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }); -} - -Scenarios.SpecialWords_Parameters_and = createParametersTests( - `/special-words/parameters/and`, - { - and: "ok", - }, - "and", -); -Scenarios.SpecialWords_Parameters_as = createParametersTests( - `/special-words/parameters/as`, - { - as: "ok", - }, - "as", -); -Scenarios.SpecialWords_Parameters_assert = createParametersTests( - `/special-words/parameters/assert`, - { - assert: "ok", - }, - "assert", -); -Scenarios.SpecialWords_Parameters_async = createParametersTests( - `/special-words/parameters/async`, - { - async: "ok", - }, - "async", -); -Scenarios.SpecialWords_Parameters_await = createParametersTests( - `/special-words/parameters/await`, - { - await: "ok", - }, - "await", -); -Scenarios.SpecialWords_Parameters_break = createParametersTests( - `/special-words/parameters/break`, - { - break: "ok", - }, - "break", -); -Scenarios.SpecialWords_Parameters_class = createParametersTests( - `/special-words/parameters/class`, - { - class: "ok", - }, - "class", -); -Scenarios.SpecialWords_Parameters_constructor = createParametersTests( - `/special-words/parameters/constructor`, - { - constructor: "ok", - }, - "constructor", -); -Scenarios.SpecialWords_Parameters_continue = createParametersTests( - `/special-words/parameters/continue`, - { - continue: "ok", - }, - "continue", -); -Scenarios.SpecialWords_Parameters_def = createParametersTests( - `/special-words/parameters/def`, - { - def: "ok", - }, - "def", -); -Scenarios.SpecialWords_Parameters_del = createParametersTests( - `/special-words/parameters/del`, - { - del: "ok", - }, - "del", -); -Scenarios.SpecialWords_Parameters_elif = createParametersTests( - `/special-words/parameters/elif`, - { - elif: "ok", - }, - "elif", -); -Scenarios.SpecialWords_Parameters_else = createParametersTests( - `/special-words/parameters/else`, - { - else: "ok", - }, - "else", -); -Scenarios.SpecialWords_Parameters_except = createParametersTests( - `/special-words/parameters/except`, - { - except: "ok", - }, - "except", -); -Scenarios.SpecialWords_Parameters_exec = createParametersTests( - `/special-words/parameters/exec`, - { - exec: "ok", - }, - "exec", -); -Scenarios.SpecialWords_Parameters_finally = createParametersTests( - `/special-words/parameters/finally`, - { - finally: "ok", - }, - "finally", -); - -Scenarios.SpecialWords_Parameters_for = createParametersTests( - `/special-words/parameters/for`, - { - for: "ok", - }, - "for", -); -Scenarios.SpecialWords_Parameters_from = createParametersTests( - `/special-words/parameters/from`, - { - from: "ok", - }, - "from", -); -Scenarios.SpecialWords_Parameters_global = createParametersTests( - `/special-words/parameters/global`, - { - global: "ok", - }, - "global", -); -Scenarios.SpecialWords_Parameters_if = createParametersTests( - `/special-words/parameters/if`, - { - if: "ok", - }, - "if", -); -Scenarios.SpecialWords_Parameters_import = createParametersTests( - `/special-words/parameters/import`, - { - import: "ok", - }, - "import", -); -Scenarios.SpecialWords_Parameters_in = createParametersTests( - `/special-words/parameters/in`, - { - in: "ok", - }, - "in", -); -Scenarios.SpecialWords_Parameters_is = createParametersTests( - `/special-words/parameters/is`, - { - is: "ok", - }, - "is", -); -Scenarios.SpecialWords_Parameters_lambda = createParametersTests( - `/special-words/parameters/lambda`, - { - lambda: "ok", - }, - "lambda", -); -Scenarios.SpecialWords_Parameters_not = createParametersTests( - `/special-words/parameters/not`, - { - not: "ok", - }, - "not", -); -Scenarios.SpecialWords_Parameters_or = createParametersTests( - `/special-words/parameters/or`, - { - or: "ok", - }, - "or", -); -Scenarios.SpecialWords_Parameters_pass = createParametersTests( - `/special-words/parameters/pass`, - { - pass: "ok", - }, - "pass", -); -Scenarios.SpecialWords_Parameters_raise = createParametersTests( - `/special-words/parameters/raise`, - { - raise: "ok", - }, - "raise", -); -Scenarios.SpecialWords_Parameters_return = createParametersTests( - `/special-words/parameters/return`, - { - return: "ok", - }, - "return", -); -Scenarios.SpecialWords_Parameters_try = createParametersTests( - `/special-words/parameters/try`, - { - try: "ok", - }, - "try", -); -Scenarios.SpecialWords_Parameters_while = createParametersTests( - `/special-words/parameters/while`, - { - while: "ok", - }, - "while", -); -Scenarios.SpecialWords_Parameters_with = createParametersTests( - `/special-words/parameters/with`, - { - with: "ok", - }, - "with", -); -Scenarios.SpecialWords_Parameters_yield = createParametersTests( - `/special-words/parameters/yield`, - { - yield: "ok", - }, - "yield", -); -Scenarios.SpecialWords_Parameters_cancellationToken = createParametersTests( - `/special-words/parameters/cancellationToken`, - { - cancellationToken: "ok", - }, - "cancellationToken", -); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/main.tsp deleted file mode 100644 index 8ea66967ce3..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/main.tsp +++ /dev/null @@ -1,33 +0,0 @@ -import "@typespec/http"; -import "@typespec/http/streams"; -import "@typespec/spector"; - -using Http; -using Http.Streams; -using Spector; - -@doc("Test of jsonl streaming.") -@scenarioService("/streaming/jsonl") -namespace Streaming.Jsonl; - -@route("basic") -namespace Basic { - @scenario - @scenarioDoc(""" - Basic jsonl streaming for request. - """) - @route("send") - @post - op send(stream: JsonlStream): NoContentResponse; - - @scenario - @scenarioDoc(""" - Basic jsonl streaming for response. - """) - @route("receive") - op receive(): JsonlStream; - - model Info { - desc: string; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/mockapi.ts deleted file mode 100644 index 5b11022fc7e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/streaming/jsonl/mockapi.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Streaming_Jsonl_Basic_send = passOnSuccess({ - uri: "/streaming/jsonl/basic/send", - method: "post", - request: { - body: { - rawContent: Buffer.from('{"desc": "one"}\n{"desc": "two"}\n{"desc": "three"}'), - contentType: "application/jsonl", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Streaming_Jsonl_Basic_receive = passOnSuccess({ - uri: "/streaming/jsonl/basic/receive", - method: "get", - request: {}, - response: { - status: 200, - body: { - rawContent: Buffer.from('{"desc": "one"}\n{"desc": "two"}\n{"desc": "three"}'), - contentType: "application/jsonl", - }, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/array/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/array/main.tsp deleted file mode 100644 index b91b2fe6847..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/array/main.tsp +++ /dev/null @@ -1,108 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates various types of arrays.") -@scenarioService("/type/array") -namespace Type.Array; - -@doc("Template to have Array operations") -interface ArrayOperations { - @scenario - @scenarioDoc(""" - Expected Array response body: - ```json - ${TDoc} - ``` - """) - @get - get(): TArr; - - @scenario - @scenarioDoc(""" - Expected Array input body: - ```json - ${TDoc} - ``` - """) - @put - put(@body body: TArr): void; -} - -@doc("Array of int32 values") -@route("/int32") -interface Int32Value extends ArrayOperations {} - -@doc("Array of int64 values") -@route("/int64") -interface Int64Value - extends ArrayOperations {} - -@doc("Array of boolean values") -@route("/boolean") -interface BooleanValue extends ArrayOperations {} - -@doc("Array of string values") -@route("/string") -interface StringValue extends ArrayOperations {} - -@doc("Array of float values") -@route("/float32") -interface Float32Value extends ArrayOperations {} - -@doc("Array of datetime values") -@route("/datetime") -interface DatetimeValue extends ArrayOperations {} - -@doc("Array of duration values") -@route("/duration") -interface DurationValue extends ArrayOperations {} - -@doc("Array of unknown values") -@route("/unknown") -interface UnknownValue extends ArrayOperations {} - -@doc("Array inner model") -model InnerModel { - @doc("Required string property") - property: string; - - children?: InnerModel[]; -} - -@doc("Array of model values") -@route("/model") -interface ModelValue - extends ArrayOperations {} - -alias NullableFloat = float32 | null; -@doc("Array of nullable float values") -@route("/nullable-float") -interface NullableFloatValue extends ArrayOperations {} - -alias NullableInt32 = int32 | null; -@doc("Array of nullable int32 values") -@route("/nullable-int32") -interface NullableInt32Value extends ArrayOperations {} - -alias NullableBoolean = boolean | null; -@doc("Array of nullable boolean values") -@route("/nullable-boolean") -interface NullableBooleanValue extends ArrayOperations {} - -alias NullableString = string | null; -@doc("Array of nullable string values") -@route("/nullable-string") -interface NullableStringValue - extends ArrayOperations {} - -alias NullableModel = InnerModel | null; -@doc("Array of nullable model values") -@route("/nullable-model") -interface NullableModelValue - extends ArrayOperations< - NullableModel[], - "[{'property': 'hello'}, null, {'property': 'world'}]" - > {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/array/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/array/mockapi.ts deleted file mode 100644 index 7bab93b261b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/array/mockapi.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createServerTests(uri: string, data: any) { - return { - get: passOnSuccess({ - uri, - method: "get", - request: {}, - response: { - status: 200, - body: json(data), - }, - kind: "MockApiDefinition", - }), - put: passOnSuccess({ - uri, - method: "put", - request: { - body: json(data), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }), - }; -} - -const Type_Array_Int32 = createServerTests(`/type/array/int32`, [1, 2]); -Scenarios.Type_Array_Int32Value_get = Type_Array_Int32.get; -Scenarios.Type_Array_Int32Value_put = Type_Array_Int32.put; - -const Type_Array_Int64 = createServerTests(`/type/array/int64`, [ - Number.MAX_SAFE_INTEGER, - Number.MIN_SAFE_INTEGER, -]); -Scenarios.Type_Array_Int64Value_get = Type_Array_Int64.get; -Scenarios.Type_Array_Int64Value_put = Type_Array_Int64.put; - -const Type_Array_Boolean = createServerTests(`/type/array/boolean`, [true, false]); -Scenarios.Type_Array_BooleanValue_get = Type_Array_Boolean.get; -Scenarios.Type_Array_BooleanValue_put = Type_Array_Boolean.put; - -const Type_Array_String = createServerTests(`/type/array/string`, ["hello", ""]); -Scenarios.Type_Array_StringValue_get = Type_Array_String.get; -Scenarios.Type_Array_StringValue_put = Type_Array_String.put; - -const Type_Array_Float32 = createServerTests(`/type/array/float32`, [43.125]); -Scenarios.Type_Array_Float32Value_get = Type_Array_Float32.get; -Scenarios.Type_Array_Float32Value_put = Type_Array_Float32.put; - -const Type_Array_Datetime = createServerTests(`/type/array/datetime`, ["2022-08-26T18:38:00Z"]); -Scenarios.Type_Array_DatetimeValue_get = Type_Array_Datetime.get; -Scenarios.Type_Array_DatetimeValue_put = Type_Array_Datetime.put; - -const Type_Array_Duration = createServerTests(`/type/array/duration`, ["P123DT22H14M12.011S"]); -Scenarios.Type_Array_DurationValue_get = Type_Array_Duration.get; -Scenarios.Type_Array_DurationValue_put = Type_Array_Duration.put; - -const Type_Array_Unknown = createServerTests(`/type/array/unknown`, [1, "hello", null]); -Scenarios.Type_Array_UnknownValue_get = Type_Array_Unknown.get; -Scenarios.Type_Array_UnknownValue_put = Type_Array_Unknown.put; - -const Type_Array_Model = createServerTests(`/type/array/model`, [ - { property: "hello" }, - { property: "world" }, -]); -Scenarios.Type_Array_ModelValue_get = Type_Array_Model.get; -Scenarios.Type_Array_ModelValue_put = Type_Array_Model.put; - -const Type_Array_Nullable_Float = createServerTests(`/type/array/nullable-float`, [ - 1.25, - null, - 3.0, -]); -Scenarios.Type_Array_NullableFloatValue_get = Type_Array_Nullable_Float.get; -Scenarios.Type_Array_NullableFloatValue_put = Type_Array_Nullable_Float.put; - -const Type_Array_Nullable_Boolean = createServerTests(`/type/array/nullable-boolean`, [ - true, - null, - false, -]); -Scenarios.Type_Array_NullableBooleanValue_get = Type_Array_Nullable_Boolean.get; -Scenarios.Type_Array_NullableBooleanValue_put = Type_Array_Nullable_Boolean.put; - -const Type_Array_Nullable_Int32 = createServerTests(`/type/array/nullable-int32`, [1, null, 3]); -Scenarios.Type_Array_NullableInt32Value_get = Type_Array_Nullable_Int32.get; -Scenarios.Type_Array_NullableInt32Value_put = Type_Array_Nullable_Int32.put; - -const Type_Array_Nullable_String = createServerTests(`/type/array/nullable-string`, [ - "hello", - null, - "world", -]); -Scenarios.Type_Array_NullableStringValue_get = Type_Array_Nullable_String.get; -Scenarios.Type_Array_NullableStringValue_put = Type_Array_Nullable_String.put; - -const Type_Array_Nullable_Model = createServerTests(`/type/array/nullable-model`, [ - { property: "hello" }, - null, - { property: "world" }, -]); -Scenarios.Type_Array_NullableModelValue_get = Type_Array_Nullable_Model.get; -Scenarios.Type_Array_NullableModelValue_put = Type_Array_Nullable_Model.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/main.tsp deleted file mode 100644 index bf8f5586524..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/main.tsp +++ /dev/null @@ -1,101 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates various of dictionaries.") -@scenarioService("/type/dictionary") -namespace Type.Dictionary; - -@doc("Template to have dictionary operations") -interface DictionaryOperations { - @scenario - @scenarioDoc(""" - Expected dictionary response body: - ```json - ${TDoc} - ``` - """) - @get - get(): TDict; - - @scenario - @scenarioDoc(""" - Expected dictionary input body: - ```json - ${TDoc} - ``` - """) - @put - put(@body body: TDict): void; -} - -@doc("Dictionary of int32 values") -@route("/int32") -interface Int32Value extends DictionaryOperations, "{'k1': 1, 'k2': 2}"> {} - -@doc("Dictionary of int64 values") -@route("/int64") -interface Int64Value - extends DictionaryOperations< - Record, - "{'k1': 0x7FFFFFFFFFFFFFFF, 'k2': -0x7FFFFFFFFFFFFFFF}" - > {} - -@doc("Dictionary of boolean values") -@route("/boolean") -interface BooleanValue extends DictionaryOperations, "{'k1': true, 'k2': false}"> {} - -@doc("Dictionary of string values") -@route("/string") -interface StringValue extends DictionaryOperations, "{'k1': 'hello', 'k2': ''}"> {} - -@doc("Dictionary of float values") -@route("/float32") -interface Float32Value extends DictionaryOperations, "{'k1': 43.125}"> {} - -@doc("Dictionary of datetime values") -@route("/datetime") -interface DatetimeValue - extends DictionaryOperations, "{'k1': '2022-08-26T18:38:00Z'}"> {} - -@doc("Dictionary of duration values") -@route("/duration") -interface DurationValue - extends DictionaryOperations, "{'k1': 'P123DT22H14M12.011S'}"> {} - -@doc("Dictionary of unknown values") -@route("/unknown") -interface UnknownValue - extends DictionaryOperations, "{'k1': 1, 'k2': 'hello', 'k3': null}"> {} - -@doc("Dictionary inner model") -model InnerModel { - @doc("Required string property") - property: string; - - children?: Record; -} - -@doc("Dictionary of model values") -@route("/model") -interface ModelValue - extends DictionaryOperations< - Record, - "{'k1': {'property': 'hello'}, 'k2': {'property': 'world'}}" - > {} - -@doc("Dictionary of model values") -@route("/model/recursive") -interface RecursiveModelValue - extends DictionaryOperations< - Record, - "{'k1': {'property': 'hello', children: {}}, 'k2': {'property': 'world', children: {'k2.1': {'property': 'inner world'}}}}" - > {} - -alias NullableFloat = float32 | null; -@doc("Dictionary of nullable float values") -@route("/nullable-float") -interface NullableFloatValue - extends DictionaryOperations, "{'k1': 1.25, 'k2': 0.5, 'k3': null}"> {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/mockapi.ts deleted file mode 100644 index d8a634350a9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/dictionary/mockapi.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createServerTests(uri: string, data: any) { - return { - get: passOnSuccess({ - uri, - method: "get", - request: {}, - response: { - status: 200, - body: json(data), - }, - kind: "MockApiDefinition", - }), - put: passOnSuccess({ - uri, - method: "put", - request: { - body: json(data), - }, - response: { - status: 204, - }, - handler: (req) => { - req.expect.coercedBodyEquals(data); - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }), - }; -} - -const Type_Dictionary_Int32 = createServerTests(`/type/dictionary/int32`, { k1: 1, k2: 2 }); -Scenarios.Type_Dictionary_Int32Value_get = Type_Dictionary_Int32.get; -Scenarios.Type_Dictionary_Int32Value_put = Type_Dictionary_Int32.put; - -const Type_Dictionary_Int64 = createServerTests(`/type/dictionary/int64`, { - k1: Number.MAX_SAFE_INTEGER, - k2: Number.MIN_SAFE_INTEGER, -}); -Scenarios.Type_Dictionary_Int64Value_get = Type_Dictionary_Int64.get; -Scenarios.Type_Dictionary_Int64Value_put = Type_Dictionary_Int64.put; - -const Type_Dictionary_Boolean = createServerTests(`/type/dictionary/boolean`, { - k1: true, - k2: false, -}); -Scenarios.Type_Dictionary_BooleanValue_get = Type_Dictionary_Boolean.get; -Scenarios.Type_Dictionary_BooleanValue_put = Type_Dictionary_Boolean.put; - -const Type_Dictionary_String = createServerTests(`/type/dictionary/string`, { - k1: "hello", - k2: "", -}); -Scenarios.Type_Dictionary_StringValue_get = Type_Dictionary_String.get; -Scenarios.Type_Dictionary_StringValue_put = Type_Dictionary_String.put; - -const Type_Dictionary_Float32 = createServerTests(`/type/dictionary/float32`, { k1: 43.125 }); -Scenarios.Type_Dictionary_Float32Value_get = Type_Dictionary_Float32.get; -Scenarios.Type_Dictionary_Float32Value_put = Type_Dictionary_Float32.put; - -const Type_Dictionary_Datetime = createServerTests(`/type/dictionary/datetime`, { - k1: "2022-08-26T18:38:00Z", -}); -Scenarios.Type_Dictionary_DatetimeValue_get = Type_Dictionary_Datetime.get; -Scenarios.Type_Dictionary_DatetimeValue_put = Type_Dictionary_Datetime.put; - -const Type_Dictionary_Duration = createServerTests(`/type/dictionary/duration`, { - k1: "P123DT22H14M12.011S", -}); -Scenarios.Type_Dictionary_DurationValue_get = Type_Dictionary_Duration.get; -Scenarios.Type_Dictionary_DurationValue_put = Type_Dictionary_Duration.put; - -const Type_Dictionary_Unknown = createServerTests(`/type/dictionary/unknown`, { - k1: 1, - k2: "hello", - k3: null, -}); -Scenarios.Type_Dictionary_UnknownValue_get = Type_Dictionary_Unknown.get; -Scenarios.Type_Dictionary_UnknownValue_put = Type_Dictionary_Unknown.put; - -const Type_Dictionary_Model = createServerTests(`/type/dictionary/model`, { - k1: { property: "hello" }, - k2: { property: "world" }, -}); -Scenarios.Type_Dictionary_ModelValue_get = Type_Dictionary_Model.get; -Scenarios.Type_Dictionary_ModelValue_put = Type_Dictionary_Model.put; - -const Type_Dictionary_Model_Recursive = createServerTests(`/type/dictionary/model/recursive`, { - k1: { property: "hello", children: {} }, - k2: { - property: "world", - children: { "k2.1": { property: "inner world" } }, - }, -}); -Scenarios.Type_Dictionary_RecursiveModelValue_get = Type_Dictionary_Model_Recursive.get; -Scenarios.Type_Dictionary_RecursiveModelValue_put = Type_Dictionary_Model_Recursive.put; - -const Type_Dictionary_Nullable_Float = createServerTests(`/type/dictionary/nullable-float`, { - k1: 1.25, - k2: 0.5, - k3: null, -}); -Scenarios.Type_Dictionary_NullableFloatValue_get = Type_Dictionary_Nullable_Float.get; -Scenarios.Type_Dictionary_NullableFloatValue_put = Type_Dictionary_Nullable_Float.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/main.tsp deleted file mode 100644 index 51c3d6fb971..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/main.tsp +++ /dev/null @@ -1,81 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@scenarioService("/type/enum/extensible") -namespace Type.Enum.Extensible; - -@doc("Days of the week") -union DaysOfWeekExtensibleEnum { - string, - - @doc("Monday.") - Monday: "Monday", - - @doc("Tuesday.") - Tuesday: "Tuesday", - - @doc("Wednesday.") - Wednesday: "Wednesday", - - @doc("Thursday.") - Thursday: "Thursday", - - @doc("Friday.") - Friday: "Friday", - - @doc("Saturday.") - Saturday: "Saturday", - - @doc("Sunday.") - Sunday: "Sunday", -} - -@route("/string") -interface String { - @scenario - @scenarioDoc("Expect to handle a known value. Mock api will return 'Monday'") - @get - @route("/known-value") - getKnownValue(): { - @header - contentType: "application/json"; - - @body body: DaysOfWeekExtensibleEnum; - }; - - @scenario - @scenarioDoc("Expect to handle an unknown value. Mock api will return 'Weekend'") - @get - @route("/unknown-value") - getUnknownValue(): { - @header - contentType: "application/json"; - - @body body: DaysOfWeekExtensibleEnum; - }; - - @scenario - @scenarioDoc("Expect to send a known value. Mock api expect to receive 'Monday'") - @put - @route("/known-value") - putKnownValue( - @header - contentType: "application/json", - - @body body: DaysOfWeekExtensibleEnum, - ): void; - - @scenario - @scenarioDoc("Expect to handle an unknown value. Mock api expect to receive 'Weekend'") - @put - @route("/unknown-value") - putUnknownValue( - @header - contentType: "application/json", - - @body body: DaysOfWeekExtensibleEnum, - ): void; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/mockapi.ts deleted file mode 100644 index 1d7acd47722..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/extensible/mockapi.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createMockServerTests(uri: string, data: any) { - return { - get: passOnSuccess({ - uri, - method: "get", - request: {}, - response: { - status: 200, - body: json(data), - }, - kind: "MockApiDefinition", - }), - put: passOnSuccess({ - uri, - method: "put", - request: { - body: json(data), - headers: { - "Content-Type": "text/plain", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }), - }; -} - -const Type_Enum_Extensible_String_Known_Value = createMockServerTests( - `/type/enum/extensible/string/known-value`, - "Monday", -); -Scenarios.Type_Enum_Extensible_String_getKnownValue = Type_Enum_Extensible_String_Known_Value.get; -Scenarios.Type_Enum_Extensible_String_putKnownValue = Type_Enum_Extensible_String_Known_Value.put; - -const Type_Enum_Extensible_String_UnKnown_Value = createMockServerTests( - `/type/enum/extensible/string/unknown-value`, - "Weekend", -); -Scenarios.Type_Enum_Extensible_String_getUnknownValue = - Type_Enum_Extensible_String_UnKnown_Value.get; -Scenarios.Type_Enum_Extensible_String_putUnknownValue = - Type_Enum_Extensible_String_UnKnown_Value.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/main.tsp deleted file mode 100644 index f5d89f1cab4..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/main.tsp +++ /dev/null @@ -1,72 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@scenarioService("/type/enum/fixed") -namespace Type.Enum.Fixed; - -#suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing" -@doc("Days of the week") -enum DaysOfWeekEnum { - @doc("Monday.") - Monday, - - @doc("Tuesday.") - Tuesday, - - @doc("Wednesday.") - Wednesday, - - @doc("Thursday.") - Thursday, - - @doc("Friday.") - Friday, - - @doc("Saturday.") - Saturday, - - @doc("Sunday.") - Sunday, -} - -@route("/string") -interface String { - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to handle a known value. Mock api will return 'Monday'") - @get - @route("/known-value") - @doc("getKnownValue") - getKnownValue(): { - @header - contentType: "application/json"; - - @body - body: DaysOfWeekEnum; - }; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to send a known value. Mock api expect to receive 'Monday'") - @put - @route("/known-value") - @doc("putKnownValue") - putKnownValue( - @header contentType: "application/json", - @body @doc("_") body: DaysOfWeekEnum, - ): void; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to handle an unknown value. Mock api expect to receive 'Weekend'") - @put - @route("/unknown-value") - @doc("putUnknownValue") - putUnknownValue( - @header contentType: "application/json", - @body @doc("_") body: DaysOfWeekEnum, - ): void; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/mockapi.ts deleted file mode 100644 index adff9b8f59e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/enum/fixed/mockapi.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { json, passOnCode, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Type_Enum_Fixed_String_getKnownValue = passOnSuccess({ - uri: "/type/enum/fixed/string/known-value", - method: "get", - request: {}, - response: { - status: 200, - body: json("Monday"), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Enum_Fixed_String_putKnownValue = passOnSuccess({ - uri: "/type/enum/fixed/string/known-value", - method: "put", - request: { - body: json("Monday"), - headers: { - "Content-Type": "application/json", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Enum_Fixed_String_putUnknownValue = passOnCode(500, { - uri: "/type/enum/fixed/string/unknown-value", - method: "put", - request: { - body: json("Weekend"), - headers: { - "Content-Type": "application/json", - }, - status: 500, - }, - response: { - status: 500, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/main.tsp deleted file mode 100644 index bbfb6194c64..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/main.tsp +++ /dev/null @@ -1,40 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates usage of empty model used in operation's parameters and responses.") -@scenarioService("/type/model/empty") -namespace Type.Model.Empty; - -@doc("Empty model used in operation parameters") -model EmptyInput {} - -@doc("Empty model used in operation return type") -model EmptyOutput {} - -@doc("Empty model used in both parameter and return type") -model EmptyInputOutput {} - -@scenario -@scenarioDoc("Send a PUT request with the following body {}") -@route("/alone") -@put -op putEmpty(@body input: EmptyInput): void; - -@scenario -@scenarioDoc("Send a GET request which returns the following body {}") -@route("/alone") -@get -op getEmpty(): { - @body body: EmptyOutput; -}; - -@scenario -@scenarioDoc("Send a POST request with the following body {} which returns the same.") -@route("/round-trip") -@post -op postRoundTripEmpty(@body body: EmptyInputOutput): { - @body body: EmptyInputOutput; -}; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/mockapi.ts deleted file mode 100644 index c4c11c502ca..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/empty/mockapi.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const body = {}; - -Scenarios.Type_Model_Empty_putEmpty = passOnSuccess({ - uri: "/type/model/empty/alone", - method: "put", - request: { - body: json(body), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Empty_getEmpty = passOnSuccess({ - uri: "/type/model/empty/alone", - method: "get", - request: {}, - response: { - status: 200, - body: json(body), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Model_Empty_postRoundTripEmpty = passOnSuccess({ - uri: "/type/model/empty/round-trip", - method: "post", - request: { - body: json(body), - }, - response: { - status: 200, - body: json(body), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/main.tsp deleted file mode 100644 index e7893d73105..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/main.tsp +++ /dev/null @@ -1,169 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates inheritance with enum discriminator.") -@scenarioService("/type/model/inheritance/enum-discriminator") -namespace Type.Model.Inheritance.EnumDiscriminator; - -@doc("extensible enum type for discriminator") -union DogKind { - string, - - @doc("Species golden") - Golden: "golden", -} - -@doc("Test extensible enum type for discriminator") -@discriminator("kind") -model Dog { - @doc("discriminator property") - kind: DogKind; - - @doc("Weight of the dog") - weight: int32; -} - -@doc("Golden dog model") -model Golden extends Dog { - @doc("discriminator property") - kind: DogKind.Golden; -} - -#suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing fixed enum as discriminator property" -@doc("fixed enum type for discriminator") -enum SnakeKind { - @doc("Species cobra") - Cobra: "cobra", -} - -#suppress "@azure-tools/typespec-azure-core/no-fixed-enum-discriminator" "For testing fixed enum as discriminator property" -@doc("Test fixed enum type for discriminator") -@discriminator("kind") -model Snake { - @doc("discriminator property") - kind: SnakeKind; - - @doc("Length of the snake") - length: int32; -} - -@doc("Cobra model") -model Cobra extends Snake { - @doc("discriminator property") - kind: SnakeKind.Cobra; -} - -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" -@doc("Receive model with extensible enum discriminator type.") -@scenario -@scenarioDoc(""" - Receive model with extensible enum discriminator type. - Expected response body: - ```json - {"kind": "golden", "weight": 10} - ``` - """) -@route("/extensible-enum") -@get -op getExtensibleModel(): Dog; - -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" -@doc("Send model with extensible enum discriminator type.") -@scenario -@scenarioDoc(""" - Send model with extensible enum discriminator type. - Expected request body: - ```json - {"kind": "golden", "weight": 10} - ``` - """) -@route("/extensible-enum") -@put -op putExtensibleModel(@body @doc("Dog to create") input: Dog): NoContentResponse; - -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" -@doc("Get a model omitting the discriminator.") -@scenario -@route("/extensible-enum/missingdiscriminator") -@scenarioDoc(""" - Get a model omitting the discriminator. - Expected response body: - ```json - {"weight": 10} - ``` - """) -@get -op getExtensibleModelMissingDiscriminator(): Dog; - -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" -@doc("Get a model containing discriminator value never defined.") -@scenario -@route("/extensible-enum/wrongdiscriminator") -@scenarioDoc(""" - Get a model containing discriminator value never defined. - Expected response body: - ```json - {"weight": 8, "kind": "wrongKind" } - ``` - """) -@get -op getExtensibleModelWrongDiscriminator(): Dog; - -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" -@doc("Receive model with fixed enum discriminator type.") -@scenario -@scenarioDoc(""" - Receive model with fixed enum discriminator type. - Expected response body: - ```json - {"kind": "cobra", "length": 10} - ``` - """) -@route("/fixed-enum") -@get -op getFixedModel(): Snake; - -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" -@doc("Send model with fixed enum discriminator type.") -@scenario -@scenarioDoc(""" - Send model with fixed enum discriminator type. - Expected request body: - ```json - {"kind": "cobra", "length": 10} - ``` - """) -@route("/fixed-enum") -@put -op putFixedModel(@body @doc("Snake to create") input: Snake): NoContentResponse; - -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" -@doc("Get a model omitting the discriminator.") -@scenario -@route("/fixed-enum/missingdiscriminator") -@scenarioDoc(""" - Get a model omitting the discriminator. - Expected response body: - ```json - {"length": 10} - ``` - """) -@get -op getFixedModelMissingDiscriminator(): Snake; - -#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing enum as discriminator property" -@doc("Get a model containing discriminator value never defined.") -@scenario -@route("/fixed-enum/wrongdiscriminator") -@scenarioDoc(""" - Get a model containing discriminator value never defined. - Expected response body: - ```json - {"length": 8, "kind": "wrongKind" } - ``` - """) -@get -op getFixedModelWrongDiscriminator(): Snake; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/mockapi.ts deleted file mode 100644 index 1d3a405b6cd..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/enum-discriminator/mockapi.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const validExtensibleEnumBody = { - weight: 10, - kind: "golden", -}; -const validFixedEnumBody = { - length: 10, - kind: "cobra", -}; -function createGetServerTests(uri: string, data: any) { - return passOnSuccess({ - uri: uri, - method: "get", - request: {}, - response: { - status: 200, - body: json(data), - }, - kind: "MockApiDefinition", - }); -} - -function createGetPutServerTests(uri: string, data: any) { - return { - get: passOnSuccess({ - uri: uri, - method: "get", - request: {}, - response: { - status: 200, - body: json(data), - }, - kind: "MockApiDefinition", - }), - put: passOnSuccess({ - uri: uri, - method: "put", - request: { - body: json(data), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }), - }; -} - -const Type_Model_Inheritance_Enum_Discriminator_Extensible_Enum = createGetPutServerTests( - "/type/model/inheritance/enum-discriminator/extensible-enum", - validExtensibleEnumBody, -); -Scenarios.Type_Model_Inheritance_EnumDiscriminator_getExtensibleModel = - Type_Model_Inheritance_Enum_Discriminator_Extensible_Enum.get; -Scenarios.Type_Model_Inheritance_EnumDiscriminator_putExtensibleModel = - Type_Model_Inheritance_Enum_Discriminator_Extensible_Enum.put; - -const Type_Model_Inheritance_Enum_Discriminator_Fixed_Enum = createGetPutServerTests( - "/type/model/inheritance/enum-discriminator/fixed-enum", - validFixedEnumBody, -); -Scenarios.Type_Model_Inheritance_EnumDiscriminator_getFixedModel = - Type_Model_Inheritance_Enum_Discriminator_Fixed_Enum.get; -Scenarios.Type_Model_Inheritance_EnumDiscriminator_putFixedModel = - Type_Model_Inheritance_Enum_Discriminator_Fixed_Enum.put; - -Scenarios.Type_Model_Inheritance_EnumDiscriminator_getExtensibleModelMissingDiscriminator = - createGetServerTests( - "/type/model/inheritance/enum-discriminator/extensible-enum/missingdiscriminator", - { weight: 10 }, - ); -Scenarios.Type_Model_Inheritance_EnumDiscriminator_getExtensibleModelWrongDiscriminator = - createGetServerTests( - "/type/model/inheritance/enum-discriminator/extensible-enum/wrongdiscriminator", - { weight: 8, kind: "wrongKind" }, - ); -Scenarios.Type_Model_Inheritance_EnumDiscriminator_getFixedModelMissingDiscriminator = - createGetServerTests( - "/type/model/inheritance/enum-discriminator/fixed-enum/missingdiscriminator", - { length: 10 }, - ); -Scenarios.Type_Model_Inheritance_EnumDiscriminator_getFixedModelWrongDiscriminator = - createGetServerTests("/type/model/inheritance/enum-discriminator/fixed-enum/wrongdiscriminator", { - length: 8, - kind: "wrongKind", - }); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/main.tsp deleted file mode 100644 index fdf750bf536..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/main.tsp +++ /dev/null @@ -1,224 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates multiple level inheritance with multiple discriminators.") -@scenarioService("/type/model/inheritance/nested-discriminator") -namespace Type.Model.Inheritance.NestedDiscriminator; - -@doc("This is base model for polymorphic multiple levels inheritance with a discriminator.") -@discriminator("kind") -model Fish { - age: int32; -} - -@doc("The second level model in polymorphic multiple levels inheritance and it defines a new discriminator.") -@discriminator("sharktype") -model Shark extends Fish { - kind: "shark"; - sharktype: string; -} - -@doc("The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic instances.") -model Salmon extends Fish { - kind: "salmon"; - friends?: Fish[]; - hate?: Record; - partner?: Fish; -} - -@doc("The third level model SawShark in polymorphic multiple levels inheritance.") -model SawShark extends Shark { - sharktype: "saw"; -} - -@doc("The third level model GoblinShark in polymorphic multiple levels inheritance.") -model GoblinShark extends Shark { - sharktype: "goblin"; -} - -@scenario -@route("/model") -@scenarioDoc(""" - Generate and receive polymorphic model in multiple levels inheritance with 2 discriminators. - Expected response body: - ```json - {"age": 1, "kind": "shark", "sharktype": "goblin"} - ``` - """) -@get -op getModel(): Fish; - -@scenario -@route("/model") -@scenarioDoc(""" - Generate and send polymorphic model in multiple levels inheritance with 2 discriminators. - Expected input body: - ```json - {"age": 1, "kind": "shark", "sharktype": "goblin"} - ``` - """) -@put -op putModel(@body input: Fish): NoContentResponse; - -@scenario -@route("/recursivemodel") -@scenarioDoc(""" - Generate and receive polymorphic models has collection and dictionary properties referring to other polymorphic models. - Expected response body: - ```json - { - "age": 1, - "kind": "salmon", - "partner": { - "age": 2, - "kind": "shark", - "sharktype": "saw" - }, - "friends": [ - { - "age": 2, - "kind": "salmon", - "partner": { - "age": 3, - "kind": "salmon" - }, - "hate": { - "key1": { - "age": 4, - "kind": "salmon" - }, - "key2": { - "age": 2, - "kind": "shark", - "sharktype": "goblin" - } - } - }, - { - "age": 3, - "kind": "shark", - "sharktype": "goblin" - } - ], - "hate": { - "key3": { - "age": 3, - "kind": "shark", - "sharktype": "saw" - }, - "key4": { - "age": 2, - "kind": "salmon", - "friends": [ - { - "age": 1, - "kind": "salmon" - }, - { - "age": 4, - "kind": "shark", - "sharktype": "goblin" - } - ] - } - } - } - ``` - """) -@get -op getRecursiveModel(): Fish; - -@scenario -@route("/recursivemodel") -@scenarioDoc(""" - Generate and send polymorphic models has collection and dictionary properties referring to other polymorphic models. - Expected input body: - ```json - { - "age": 1, - "kind": "salmon", - "partner": { - "age": 2, - "kind": "shark", - "sharktype": "saw" - }, - "friends": [ - { - "age": 2, - "kind": "salmon", - "partner": { - "age": 3, - "kind": "salmon" - }, - "hate": { - "key1": { - "age": 4, - "kind": "salmon" - }, - "key2": { - "age": 2, - "kind": "shark", - "sharktype": "goblin" - } - } - }, - { - "age": 3, - "kind": "shark", - "sharktype": "goblin" - } - ], - "hate": { - "key3": { - "age": 3, - "kind": "shark", - "sharktype": "saw" - }, - "key4": { - "age": 2, - "kind": "salmon", - "friends": [ - { - "age": 1, - "kind": "salmon" - }, - { - "age": 4, - "kind": "shark", - "sharktype": "goblin" - } - ] - } - } - } - ``` - """) -@put -op putRecursiveModel(@body input: Fish): NoContentResponse; - -@scenario -@route("/missingdiscriminator") -@scenarioDoc(""" - Get a model omitting the discriminator. - Expected response body: - ```json - {"age": 1} - ``` - """) -@get -op getMissingDiscriminator(): Fish; - -@scenario -@route("/wrongdiscriminator") -@scenarioDoc(""" - Get a model containing discriminator value never defined. - Expected response body: - ```json - {"age": 1, "kind": "wrongKind" } - ``` - """) -@get -op getWrongDiscriminator(): Fish; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/mockapi.ts deleted file mode 100644 index b653c2f1d28..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/nested-discriminator/mockapi.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const validPolymorphicBody = { - age: 1, - kind: "shark", - sharktype: "goblin", -}; -const validRecursiveBody = { - age: 1, - kind: "salmon", - partner: { - age: 2, - kind: "shark", - sharktype: "saw", - }, - friends: [ - { - age: 2, - kind: "salmon", - partner: { - age: 3, - kind: "salmon", - }, - hate: { - key1: { - age: 4, - kind: "salmon", - }, - key2: { - age: 2, - kind: "shark", - sharktype: "goblin", - }, - }, - }, - { - age: 3, - kind: "shark", - sharktype: "goblin", - }, - ], - hate: { - key3: { - age: 3, - kind: "shark", - sharktype: "saw", - }, - key4: { - age: 2, - kind: "salmon", - friends: [ - { - age: 1, - kind: "salmon", - }, - { - age: 4, - kind: "shark", - sharktype: "goblin", - }, - ], - }, - }, -}; -Scenarios.Type_Model_Inheritance_NestedDiscriminator_getModel = passOnSuccess({ - uri: "/type/model/inheritance/nested-discriminator/model", - method: "get", - request: {}, - response: { - status: 200, - body: json(validPolymorphicBody), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Inheritance_NestedDiscriminator_putModel = passOnSuccess({ - uri: "/type/model/inheritance/nested-discriminator/model", - method: "put", - request: { - body: json(validPolymorphicBody), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Model_Inheritance_NestedDiscriminator_getRecursiveModel = passOnSuccess({ - uri: "/type/model/inheritance/nested-discriminator/recursivemodel", - method: "get", - request: {}, - response: { - status: 200, - body: json(validRecursiveBody), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Inheritance_NestedDiscriminator_putRecursiveModel = passOnSuccess({ - uri: "/type/model/inheritance/nested-discriminator/recursivemodel", - method: "put", - request: { - body: json(validRecursiveBody), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Model_Inheritance_NestedDiscriminator_getMissingDiscriminator = passOnSuccess({ - uri: "/type/model/inheritance/nested-discriminator/missingdiscriminator", - method: "get", - request: {}, - response: { - status: 200, - body: json({ age: 1 }), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Inheritance_NestedDiscriminator_getWrongDiscriminator = passOnSuccess({ - uri: "/type/model/inheritance/nested-discriminator/wrongdiscriminator", - method: "get", - request: {}, - response: { - status: 200, - body: json({ age: 1, kind: "wrongKind" }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/main.tsp deleted file mode 100644 index 69c186445be..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/main.tsp +++ /dev/null @@ -1,54 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates not-discriminated inheritance model.") -@scenarioService("/type/model/inheritance/not-discriminated") -namespace Type.Model.Inheritance.NotDiscriminated; - -@doc("This is base model for not-discriminated normal multiple levels inheritance.") -model Pet { - name: string; -} - -@doc("The second level model in the normal multiple levels inheritance.") -model Cat extends Pet { - age: int32; -} - -@doc("The third level model in the normal multiple levels inheritance.") -model Siamese extends Cat { - smart: boolean; -} - -@scenario -@scenarioDoc(""" - Generate and send model. - Expected input body: - ```json - {"name": "abc", "age": 32, "smart": true} - ``` - """) -@route("/valid") -@post -op postValid(@body input: Siamese): NoContentResponse; - -@scenario -@scenarioDoc(""" - Generate and receive model. - Expected response body: - ```json - {"name": "abc", "age": 32, "smart": true} - ``` - """) -@route("/valid") -@get -op getValid(): Siamese; - -@scenario -@scenarioDoc("Generate, send, and receive round-trip bottom model.") -@route("/valid") -@put -op putValid(@body input: Siamese): Siamese; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/mockapi.ts deleted file mode 100644 index c919de7b67e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/not-discriminated/mockapi.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const inheritanceValidBody = { name: "abc", age: 32, smart: true }; - -Scenarios.Type_Model_Inheritance_NotDiscriminated_postValid = passOnSuccess({ - uri: "/type/model/inheritance/not-discriminated/valid", - method: "post", - request: { - body: json(inheritanceValidBody), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Inheritance_NotDiscriminated_getValid = passOnSuccess({ - uri: "/type/model/inheritance/not-discriminated/valid", - method: "get", - request: {}, - response: { - status: 200, - body: json(inheritanceValidBody), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Inheritance_NotDiscriminated_putValid = passOnSuccess({ - uri: "/type/model/inheritance/not-discriminated/valid", - method: "put", - request: { - body: json(inheritanceValidBody), - }, - response: { - status: 200, - body: json(inheritanceValidBody), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/main.tsp deleted file mode 100644 index a5656b94913..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/main.tsp +++ /dev/null @@ -1,71 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates inheritance recursion") -@scenarioService("/type/model/inheritance/recursive") -namespace Type.Model.Inheritance.Recursive; - -@doc("extension") -model Extension extends Element { - level: int8; -} - -@doc("element") -model Element { - extension?: Extension[]; -} - -@scenario -@scenarioDoc(""" - Send a PUT request with the following body: - Expected input body: - ```json - { - "level": 0, - "extension": [ - { - "level": 1, - "extension": [ - { - "level": 2 - } - ] - }, - { - "level": 1 - } - ] - } - ``` - """) -@put -op put(@body input: Extension): void; - -@scenario -@scenarioDoc(""" - Send a GET request which returns the following body: - Expected response body: - ```json - { - "level": 0, - "extension": [ - { - "level": 1, - "extension": [ - { - "level": 2 - } - ] - }, - { - "level": 1 - } - ] - } - ``` - """) -@get -op get(): Extension; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/mockapi.ts deleted file mode 100644 index e8687d4bb4d..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/recursive/mockapi.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const body = { - level: 0, - extension: [ - { - level: 1, - extension: [ - { - level: 2, - }, - ], - }, - { - level: 1, - }, - ], -}; -Scenarios.Type_Model_Inheritance_Recursive_put = passOnSuccess({ - uri: "/type/model/inheritance/recursive", - method: "put", - request: { - body: json(body), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Inheritance_Recursive_get = passOnSuccess({ - uri: "/type/model/inheritance/recursive", - method: "get", - request: {}, - response: { - status: 200, - body: json(body), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/main.tsp deleted file mode 100644 index 0a396d731ad..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/main.tsp +++ /dev/null @@ -1,172 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates inheritance with single discriminator.") -@scenarioService("/type/model/inheritance/single-discriminator") -namespace Type.Model.Inheritance.SingleDiscriminator; - -@doc("This is base model for polymorphic single level inheritance with a discriminator.") -@discriminator("kind") -model Bird { - kind: string; - wingspan: int32; -} - -@doc("The second level model in polymorphic single level inheritance.") -model SeaGull extends Bird { - kind: "seagull"; -} - -@doc("The second level model in polymorphic single level inheritance.") -model Sparrow extends Bird { - kind: "sparrow"; -} - -@doc("The second level model in polymorphic single level inheritance.") -model Goose extends Bird { - kind: "goose"; -} - -@doc("The second level model in polymorphic single levels inheritance which contains references to other polymorphic instances.") -model Eagle extends Bird { - kind: "eagle"; - friends?: Bird[]; - hate?: Record; - partner?: Bird; -} - -@doc("Define a base class in the legacy way. Discriminator property is not explicitly defined in the model.") -@discriminator("kind") -model Dinosaur { - size: int32; -} - -@doc("The second level legacy model in polymorphic single level inheritance.") -model TRex extends Dinosaur { - kind: "t-rex"; -} - -@scenario -@route("/model") -@scenarioDoc(""" - Generate and receive polymorphic model in single level inheritance with 1 discriminator. - Expected response body: - ```json - {"wingspan": 1, "kind": "sparrow"} - ``` - """) -@get -op getModel(): Bird; - -@scenario -@route("/model") -@scenarioDoc(""" - Generate and send polymorphic model in single level inheritance with 1 discriminator. - Expected input body: - ```json - {"wingspan": 1, "kind": "sparrow"} - ``` - """) -@put -op putModel(@body input: Bird): NoContentResponse; - -@scenario -@route("/recursivemodel") -@scenarioDoc(""" - Generate and receive polymorphic models has collection and dictionary properties referring to other polymorphic models. - Expected response body: - ```json - { - "wingspan": 5, - "kind": "eagle", - "partner": { - "wingspan": 2, - "kind": "goose" - }, - "friends": [ - { - "wingspan": 2, - "kind": "seagull" - } - ], - "hate": { - "key3": { - "wingspan": 1, - "kind": "sparrow" - } - } - } - ``` - """) -@get -op getRecursiveModel(): Bird; - -@scenario -@route("/recursivemodel") -@scenarioDoc(""" - Generate and send polymorphic models has collection and dictionary properties referring to other polymorphic models. - Expected input body: - ```json - { - "wingspan": 5, - "kind": "eagle", - "partner": { - "wingspan": 2, - "kind": "goose" - }, - "friends": [ - { - "wingspan": 2, - "kind": "seagull" - } - ], - "hate": { - "key3": { - "wingspan": 1, - "kind": "sparrow" - } - } - } - ``` - """) -@put -op putRecursiveModel(@body input: Bird): NoContentResponse; - -@scenario -@route("/missingdiscriminator") -@scenarioDoc(""" - Get a model omitting the discriminator. - Expected response body: - ```json - {"wingspan": 1} - ``` - """) -@get -op getMissingDiscriminator(): Bird; - -@scenario -@route("/wrongdiscriminator") -@scenarioDoc(""" - Get a model containing discriminator value never defined. - Expected response body: - ```json - {"wingspan": 1, "kind": "wrongKind" } - ``` - """) -@get -op getWrongDiscriminator(): Bird; - -@scenario -@route("/legacy-model") -@scenarioDoc(""" - Generate and receive polymorphic model defined in legacy way. - Expected response body: - ```json - {"size": 20, "kind": "t-rex"} - ``` - """) -@get -op getLegacyModel(): Dinosaur; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/mockapi.ts deleted file mode 100644 index f8adcf9c0f5..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/inheritance/single-discriminator/mockapi.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const validPolymorphicBody = { - wingspan: 1, - kind: "sparrow", -}; -const validRecursiveBody = { - wingspan: 5, - kind: "eagle", - partner: { - wingspan: 2, - kind: "goose", - }, - friends: [ - { - wingspan: 2, - kind: "seagull", - }, - ], - hate: { - key3: { - wingspan: 1, - kind: "sparrow", - }, - }, -}; -Scenarios.Type_Model_Inheritance_SingleDiscriminator_getModel = passOnSuccess({ - uri: "/type/model/inheritance/single-discriminator/model", - method: "get", - request: {}, - response: { - status: 200, - body: json(validPolymorphicBody), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Inheritance_SingleDiscriminator_putModel = passOnSuccess({ - uri: "/type/model/inheritance/single-discriminator/model", - method: "put", - request: { - body: json(validPolymorphicBody), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Model_Inheritance_SingleDiscriminator_getRecursiveModel = passOnSuccess({ - uri: "/type/model/inheritance/single-discriminator/recursivemodel", - method: "get", - request: {}, - response: { - status: 200, - body: json(validRecursiveBody), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Inheritance_SingleDiscriminator_putRecursiveModel = passOnSuccess({ - uri: "/type/model/inheritance/single-discriminator/recursivemodel", - method: "put", - request: { - body: json(validRecursiveBody), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Model_Inheritance_SingleDiscriminator_getMissingDiscriminator = passOnSuccess({ - uri: "/type/model/inheritance/single-discriminator/missingdiscriminator", - method: "get", - request: {}, - response: { - status: 200, - body: json({ wingspan: 1 }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Model_Inheritance_SingleDiscriminator_getWrongDiscriminator = passOnSuccess({ - uri: "/type/model/inheritance/single-discriminator/wrongdiscriminator", - method: "get", - request: {}, - response: { - status: 200, - body: json({ wingspan: 1, kind: "wrongKind" }), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Inheritance_SingleDiscriminator_getLegacyModel = passOnSuccess({ - uri: "/type/model/inheritance/single-discriminator/legacy-model", - method: "get", - request: {}, - response: { - status: 200, - body: json({ size: 20, kind: "t-rex" }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/main.tsp deleted file mode 100644 index 5197007a0f7..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/main.tsp +++ /dev/null @@ -1,49 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -/** - * Those tests are meant to test different behavior of records if they are used as input, output or both. - * This is something that might not matter in your emitter. - * - * This is valuable if you for example only decide to create a public constructor if a model is used as input. - */ -@doc("Illustrates usage of Record in different places(Operation parameters, return type or both).") -@scenarioService("/type/model/usage") -namespace Type.Model.Usage; - -alias RecordBase = { - requiredProp: string; -}; - -@doc("Record used in operation parameters") -model InputRecord { - ...RecordBase; -} - -@doc("Record used in operation return type") -model OutputRecord { - ...RecordBase; -} - -@doc("Record used both as operation parameter and return type") -model InputOutputRecord { - ...RecordBase; -} - -@scenario -@scenarioDoc("Send a POST request with the following body {requiredProp: \"example-value\"}") -@route("/input") -op input(@body input: InputRecord): void; - -@scenario -@scenarioDoc("Send a GET request which return the following body {requiredProp: \"example-value\"}") -@route("/output") -op output(): OutputRecord; - -@scenario -@scenarioDoc("Send a POST request which return the following body {requiredProp: \"example-value\"} and return the same.") -@route("/input-output") -op inputAndOutput(@body body: InputOutputRecord): InputOutputRecord; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/mockapi.ts deleted file mode 100644 index ccce6fbf44a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/usage/mockapi.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const body = { requiredProp: "example-value" }; - -Scenarios.Type_Model_Usage_input = passOnSuccess({ - uri: "/type/model/usage/input", - method: "post", - request: { - body: json({ - requiredProp: "example-value", - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Model_Usage_output = passOnSuccess({ - uri: "/type/model/usage/output", - method: "get", - request: {}, - response: { - status: 200, - body: json(body), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Model_Usage_inputAndOutput = passOnSuccess({ - uri: "/type/model/usage/input-output", - method: "post", - request: { - body: json({ - requiredProp: "example-value", - }), - }, - response: { - status: 200, - body: json(body), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/main.tsp deleted file mode 100644 index 80be39ab019..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/main.tsp +++ /dev/null @@ -1,149 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates models with visibility properties.") -@scenarioService("/type/model/visibility") -namespace Type.Model.Visibility; - -@doc("Output model with visibility properties.") -model VisibilityModel { - @doc("Required string, illustrating a readonly property.") - @visibility(Lifecycle.Read) - readProp: string; - - #suppress "@typespec/http/metadata-ignored" "For test" - @doc("Required int32, illustrating a query property.") - @visibility(Lifecycle.Query) - @query - queryProp: int32; - - @doc("Required string[], illustrating a create property.") - @visibility(Lifecycle.Create) - createProp: string[]; - - @doc("Required int32[], illustrating a update property.") - @visibility(Lifecycle.Update) - updateProp: int32[]; - - @doc("Required bool, illustrating a delete property.") - @visibility(Lifecycle.Delete) - deleteProp: boolean; - - @doc("Property that does not exist in any payload.") - @invisible(Lifecycle) - noneProp: "none"; -} - -/** RoundTrip model with readonly optional properties. */ -model ReadOnlyModel { - /** Optional readonly nullable int list. */ - @visibility(Lifecycle.Read) - optionalNullableIntList?: int32[] | null; - - /** Optional readonly string dictionary. */ - @visibility(Lifecycle.Read) - optionalStringRecord?: Record; -} - -@scenario -@scenarioDoc(""" - Generate and receive output model with readonly properties. - Expected no body with `?queryProp=123`. - - Expected response body: - ```json - { - readProp: "abc", - } - ``` - """) -@get -op getModel(@bodyRoot input: VisibilityModel): { - @body - output: VisibilityModel; -}; - -@scenario -@scenarioDoc(""" - Generate abd send put model with write/create properties. - Expected no body with `?queryProp=123`. - """) -@head -op headModel(@bodyRoot input: VisibilityModel): OkResponse; - -@scenario -@scenarioDoc(""" - Generate abd send put model with write/create/update properties. - Expected input body: - ```json - { - createProp: ["foo", "bar"], - updateProp: [1, 2], - } - ``` - """) -@put -op putModel(@body input: VisibilityModel): void; - -@scenario -@scenarioDoc(""" - Generate abd send put model with write/update properties. - Expected input body: - ```json - { - updateProp: [1, 2], - } - ``` - """) -@patch(#{ implicitOptionality: true }) -op patchModel(@body input: VisibilityModel): void; - -@scenario -@scenarioDoc(""" - Generate abd send put model with write/create properties. - Expected input body: - ```json - { - createProp: ["foo", "bar"], - } - ``` - """) -@post -op postModel(@body input: VisibilityModel): void; - -@scenario -@scenarioDoc(""" - Generate abd send put model with write/create properties. - Expected input body: - ```json - { - deleteProp: true, - } - ``` - """) -@delete -op deleteModel(@body input: VisibilityModel): void; - -@route("/readonlyroundtrip") -@scenario -@scenarioDoc(""" - Generate and receive output model with readonly properties. - - Expected input body: - ```json - {} - ``` - - Expected response body: - ```json - { - optionalNullableIntList: [1, 2, 3], - optionalStringRecord: { k1: "value1", k2: "value2" }, - } - ``` - """) -@put -op putReadOnlyModel(@body input: ReadOnlyModel): ReadOnlyModel; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/mockapi.ts deleted file mode 100644 index de3c492d3e8..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/model/visibility/mockapi.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function genData(keys: string[]): Record { - const ret: Record = {}; - const fullData: Record = { - readProp: "abc", - createProp: ["foo", "bar"], - updateProp: [1, 2], - deleteProp: true, - }; - for (const k of keys) { - if (k in fullData) { - ret[k] = fullData[k]; - } - } - return ret; -} -const expectBody = { - optionalNullableIntList: [1, 2, 3], - optionalStringRecord: { k1: "value1", k2: "value2" }, -}; -Scenarios.Type_Model_Visibility_putReadOnlyModel = passOnSuccess({ - uri: "/type/model/visibility/readonlyroundtrip", - method: "put", - request: {}, - response: { - status: 200, - body: json(expectBody), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Visibility_headModel = passOnSuccess({ - uri: "/type/model/visibility", - method: "head", - request: { - query: { queryProp: 123 }, - }, - response: { - status: 200, - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Visibility_getModel = passOnSuccess({ - uri: "/type/model/visibility", - method: "get", - request: { - query: { queryProp: 123 }, - }, - response: { - status: 200, - body: json(genData(["readProp"])), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Visibility_putModel = passOnSuccess({ - uri: "/type/model/visibility", - method: "put", - request: { - body: json({ - createProp: ["foo", "bar"], - updateProp: [1, 2], - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Visibility_patchModel = passOnSuccess({ - uri: "/type/model/visibility", - method: "patch", - request: { - body: json({ - updateProp: [1, 2], - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Visibility_postModel = passOnSuccess({ - uri: "/type/model/visibility", - method: "post", - request: { - body: json({ - createProp: ["foo", "bar"], - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Model_Visibility_deleteModel = passOnSuccess({ - uri: "/type/model/visibility", - method: "delete", - request: { - body: json({ deleteProp: true }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/main.tsp deleted file mode 100644 index b304f1db348..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/main.tsp +++ /dev/null @@ -1,549 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Tests for additional properties of models") -@scenarioService("/type/property/additionalProperties") -namespace Type.Property.AdditionalProperties; - -@doc("Template to have models operations") -interface ModelOperations { - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc(""" - Expected response body: - ```json - ${TDoc} - ``` - """) - @get - @doc("Get call") - get(): TModel; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - #suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" - @scenario - @scenarioDoc(""" - Expected input body: - ```json - ${TDoc} - ``` - """) - @put - @doc("Put operation") - put(@body @doc("body") body: TModel): void; -} - -// ********************************************** Record ********************************************** -#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" -@doc("The model extends from Record type.") -model ExtendsUnknownAdditionalProperties extends Record { - @doc("The name property") - name: string; -} - -@route("/extendsRecordUnknown") -interface ExtendsUnknown - extends ModelOperations< - ExtendsUnknownAdditionalProperties, - "{'name': 'ExtendsUnknownAdditionalProperties', 'prop1': 32, 'prop2': true, 'prop3': 'abc'}" - > {} - -@doc("The model extends from a type that extends from Record.") -model ExtendsUnknownAdditionalPropertiesDerived extends ExtendsUnknownAdditionalProperties { - @doc("The index property") - index: int32; - - @doc("The age property") - age?: float32; -} - -@route("/extendsRecordUnknownDerived") -interface ExtendsUnknownDerived - extends ModelOperations< - ExtendsUnknownAdditionalPropertiesDerived, - "{'name': 'ExtendsUnknownAdditionalProperties', 'index': 314, 'age': 2.71875, 'prop1': 32, 'prop2': true, 'prop3': 'abc'}" - > {} - -@doc("The model extends from Record with a discriminator.") -@discriminator("kind") -model ExtendsUnknownAdditionalPropertiesDiscriminated extends Record { - @doc("The name property") - name: string; - - @doc("The discriminator") - kind: string; -} - -@doc("The derived discriminated type") -model ExtendsUnknownAdditionalPropertiesDiscriminatedDerived - extends ExtendsUnknownAdditionalPropertiesDiscriminated { - kind: "derived"; - - @doc("The index property") - index: int32; - - @doc("The age property") - age?: float32; -} - -@route("/extendsUnknownDiscriminated") -interface ExtendsUnknownDiscriminated - extends ModelOperations< - ExtendsUnknownAdditionalPropertiesDiscriminated, - "{'kind': 'derived', 'name': 'Derived', 'index': 314, 'age': 2.71875, 'prop1': 32, 'prop2': true, 'prop3': 'abc'}" - > {} - -#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" -@doc("The model is from Record type.") -model IsUnknownAdditionalProperties is Record { - @doc("The name property") - name: string; -} - -@route("/isRecordUnknown") -interface IsUnknown - extends ModelOperations< - IsUnknownAdditionalProperties, - "{'name': 'IsUnknownAdditionalProperties', 'prop1': 32, 'prop2': true, 'prop3': 'abc'}" - > {} - -@doc("The model extends from a type that is Record type") -model IsUnknownAdditionalPropertiesDerived extends IsUnknownAdditionalProperties { - @doc("The index property") - index: int32; - - @doc("The age property") - age?: float32; -} - -@route("/isRecordUnknownDerived") -interface IsUnknownDerived - extends ModelOperations< - IsUnknownAdditionalPropertiesDerived, - "{'name': 'IsUnknownAdditionalProperties', 'index': 314, 'age': 2.71875, 'prop1': 32, 'prop2': true, 'prop3': 'abc'}" - > {} - -@doc("The model is Record with a discriminator.") -@discriminator("kind") -model IsUnknownAdditionalPropertiesDiscriminated is Record { - @doc("The name property") - name: string; - - @doc("The discriminator") - kind: string; -} - -@doc("The derived discriminated type") -model IsUnknownAdditionalPropertiesDiscriminatedDerived - extends IsUnknownAdditionalPropertiesDiscriminated { - kind: "derived"; - - @doc("The index property") - index: int32; - - @doc("The age property") - age?: float32; -} - -@route("/isUnknownDiscriminated") -interface IsUnknownDiscriminated - extends ModelOperations< - IsUnknownAdditionalPropertiesDiscriminated, - "{'kind': 'derived', 'name': 'Derived', 'index': 314, 'age': 2.71875, 'prop1': 32, 'prop2': true, 'prop3': 'abc'}" - > {} - -// ***************** Known properties type is the same with additional properties type ************************** -// ********************************************** Record ********************************************** -#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" -@doc("The model extends from Record type.") -model ExtendsStringAdditionalProperties extends Record { - @doc("The name property") - name: string; -} - -@route("/extendsRecordString") -interface ExtendsString - extends ModelOperations< - ExtendsStringAdditionalProperties, - "{'name': 'ExtendsStringAdditionalProperties', 'prop': 'abc'}" - > {} - -#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" -@doc("The model is from Record type.") -model IsStringAdditionalProperties is Record { - @doc("The name property") - name: string; -} - -@route("/isRecordstring") -interface IsString - extends ModelOperations< - IsStringAdditionalProperties, - "{'name': 'IsStringAdditionalProperties', 'prop': 'abc'}" - > {} - -@doc("The model spread Record with the same known property type") -model SpreadStringRecord { - @doc("The name property") - name: string; - - ...Record; -} - -@route("/spreadRecordString") -interface SpreadString - extends ModelOperations {} - -// ********************************************** Record ********************************************** -#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" -@doc("The model extends from Record type.") -model ExtendsFloatAdditionalProperties extends Record { - @doc("The id property") - id: float32; -} - -@route("/extendsRecordFloat") -interface ExtendsFloat - extends ModelOperations {} - -#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" -@doc("The model is from Record type.") -model IsFloatAdditionalProperties is Record { - @doc("The id property") - id: float32; -} - -@route("/isRecordFloat") -interface IsFloat - extends ModelOperations {} - -@doc("The model spread Record with the same known property type") -model SpreadFloatRecord { - @doc("The id property") - id: float32; - - ...Record; -} - -@route("/spreadRecordFloat") -interface SpreadFloat - extends ModelOperations {} - -// ********************************************** Record ********************************************** -@doc("model for record") -model ModelForRecord { - @doc("The state property") - state: string; -} - -#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" -@doc("The model extends from Record type.") -model ExtendsModelAdditionalProperties extends Record { - knownProp: ModelForRecord; -} - -@route("/extendsRecordModel") -interface ExtendsModel - extends ModelOperations< - ExtendsModelAdditionalProperties, - "{'knownProp': {'state': 'ok'}, 'prop': {'state': 'ok'}}" - > {} - -#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" -@doc("The model is from Record type.") -model IsModelAdditionalProperties is Record { - knownProp: ModelForRecord; -} - -@route("/isRecordModel") -interface IsModel - extends ModelOperations< - IsModelAdditionalProperties, - "{'knownProp': {'state': 'ok'}, 'prop': {'state': 'ok'}}" - > {} - -@doc("The model spread Record with the same known property type") -model SpreadModelRecord { - knownProp: ModelForRecord; - ...Record; -} - -@route("/spreadRecordModel") -interface SpreadModel - extends ModelOperations< - SpreadModelRecord, - "{'knownProp': {'state': 'ok'}, 'prop': {'state': 'ok'}}" - > {} - -// ********************************************** Record ********************************************** -#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" -@doc("The model extends from Record type.") -model ExtendsModelArrayAdditionalProperties extends Record { - knownProp: ModelForRecord[]; -} - -@route("/extendsRecordModelArray") -interface ExtendsModelArray - extends ModelOperations< - ExtendsModelArrayAdditionalProperties, - "{'knownProp': [{'state': 'ok'}, {'state': 'ok'}], 'prop': [{'state': 'ok'}, {'state': 'ok'}]}" - > {} - -#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For testing" -@doc("The model is from Record type.") -model IsModelArrayAdditionalProperties is Record { - knownProp: ModelForRecord[]; -} - -@route("/isRecordModelArray") -interface IsModelArray - extends ModelOperations< - IsModelArrayAdditionalProperties, - "{'knownProp': [{'state': 'ok'}, {'state': 'ok'}], 'prop': [{'state': 'ok'}, {'state': 'ok'}]}" - > {} - -model SpreadModelArrayRecord { - knownProp: ModelForRecord[]; - ...Record; -} - -@route("/spreadRecordModelArray") -interface SpreadModelArray - extends ModelOperations< - SpreadModelArrayRecord, - "{'knownProp': [{'state': 'ok'}, {'state': 'ok'}], 'prop': [{'state': 'ok'}, {'state': 'ok'}]}" - > {} - -// ****************** Known properties type is different from additional properties type ************************** -// ********************************************** Record ********************************************** -@doc("The model spread Record with the different known property type") -model DifferentSpreadStringRecord { - @doc("The name property") - id: float32; - - ...Record; -} - -@route("/spreadDifferentRecordString") -interface SpreadDifferentString - extends ModelOperations {} - -// ********************************************** Record ********************************************** -@doc("The model spread Record with the different known property type") -model DifferentSpreadFloatRecord { - @doc("The id property") - name: string; - - ...Record; -} - -@route("/spreadDifferentRecordFloat") -interface SpreadDifferentFloat - extends ModelOperations {} - -// ********************************************** Record ********************************************** -@doc("The model spread Record with the different known property type") -model DifferentSpreadModelRecord { - knownProp: string; - ...Record; -} - -@route("/spreadDifferentRecordModel") -interface SpreadDifferentModel - extends ModelOperations< - DifferentSpreadModelRecord, - "{'knownProp': 'abc', 'prop': {'state': 'ok'}}" - > {} - -// ********************************************** Record ********************************************** -@doc("The model spread Record with the different known property type") -model DifferentSpreadModelArrayRecord { - knownProp: string; - ...Record; -} - -@route("/spreadDifferentRecordModelArray") -interface SpreadDifferentModelArray - extends ModelOperations< - DifferentSpreadModelArrayRecord, - "{'knownProp': 'abc', 'prop': [{'state': 'ok'}, {'state': 'ok'}]}" - > {} - -// ****************** extends model has spread Record ************************** -@doc("The model extends from a model that spread Record with the different known property type") -model DifferentSpreadStringDerived extends DifferentSpreadStringRecord { - @doc("The index property") - derivedProp: string; -} - -@route("/extendsDifferentSpreadString") -interface ExtendsDifferentSpreadString - extends ModelOperations< - DifferentSpreadStringDerived, - "{'id': 43.125, 'prop': 'abc', 'derivedProp': 'abc'}" - > {} - -// ****************** extends model has spread Record ************************** -@doc("The model extends from a model that spread Record with the different known property type") -model DifferentSpreadFloatDerived extends DifferentSpreadFloatRecord { - @doc("The index property") - derivedProp: float32; -} - -@route("/extendsDifferentSpreadFloat") -interface ExtendsDifferentSpreadFloat - extends ModelOperations< - DifferentSpreadFloatDerived, - "{'name': 'abc', 'prop': 43.125, 'derivedProp': 43.125}" - > {} - -// ****************** extends model has spread Record ************************** - -@doc("The model extends from a model that spread Record with the different known property type") -model DifferentSpreadModelDerived extends DifferentSpreadModelRecord { - @doc("The index property") - derivedProp: ModelForRecord; -} - -@route("/extendsDifferentSpreadModel") -interface ExtendsDifferentSpreadModel - extends ModelOperations< - DifferentSpreadModelDerived, - "{'knownProp': 'abc', 'prop': {'state': 'ok'}, 'derivedProp': {'state': 'ok'}}" - > {} - -// ****************** extends model has spread Record ************************** -@doc("The model extends from a model that spread Record with the different known property type") -model DifferentSpreadModelArrayDerived extends DifferentSpreadModelArrayRecord { - @doc("The index property") - derivedProp: ModelForRecord[]; -} - -@route("/extendsDifferentSpreadModelArray") -interface ExtendsDifferentSpreadModelArray - extends ModelOperations< - DifferentSpreadModelArrayDerived, - "{'knownProp': 'abc', 'prop': [{'state': 'ok'}, {'state': 'ok'}], 'derivedProp': [{'state': 'ok'}, {'state': 'ok'}]}" - > {} - -// ****************** multiple spread of records ************************** -@doc("The model spread Record and Record") -model MultipleSpreadRecord { - @doc("The name property") - flag: boolean; - - ...Record; - ...Record; -} - -@route("/multipleSpreadRecord") -interface MultipleSpread - extends ModelOperations< - MultipleSpreadRecord, - "{'flag': true, 'prop1': 'abc', 'prop2': 43.125}" - > {} - -// ****************** spread record of unions ************************** -@doc("The model spread Record") -model SpreadRecordForUnion { - @doc("The name property") - flag: boolean; - - ...Record; -} - -@route("/spreadRecordUnion") -interface SpreadRecordUnion - extends ModelOperations< - SpreadRecordForUnion, - "{'flag': true, 'prop1': 'abc', 'prop2': 43.125}" - > {} - -// ****************** spread record of discriminated unions ************************** -// @discriminated(#{ envelope: "none" }) -// union WidgetData { -// kind0: WidgetData0, -// kind1: WidgetData1, -// } - -model WidgetData0 { - kind: "kind0"; - fooProp: string; -} - -model WidgetData1 { - kind: "kind1"; - start: utcDateTime; - end?: utcDateTime; -} - -model WidgetData2 { - kind: "kind1"; - start: string; -} - -// @doc("The model spread Record") -// model SpreadRecordForDiscriminatedUnion { -// @doc("The name property") -// name: string; - -// ...Record; -// } - -// @route("/spreadRecordDiscriminatedUnion") -// interface SpreadRecordDiscriminatedUnion -// extends ModelOperations< -// SpreadRecordForDiscriminatedUnion, -// "{'name': 'abc', 'prop1': {'kind': 'kind0', 'fooProp': 'abc'}, 'prop2': {'kind': 'kind1', 'start': '2021-01-01T00:00:00Z', 'end': '2021-01-02T00:00:00Z'}}" -// > {} - -// ****************** spread record of non-discriminated unions but could guess a discriminator ************************** -@doc("The model spread Record") -model SpreadRecordForNonDiscriminatedUnion { - @doc("The name property") - name: string; - - ...Record; -} - -@route("/spreadRecordNonDiscriminatedUnion") -interface SpreadRecordNonDiscriminatedUnion - extends ModelOperations< - SpreadRecordForNonDiscriminatedUnion, - "{'name': 'abc', 'prop1': {'kind': 'kind0', 'fooProp': 'abc'}, 'prop2': {'kind': 'kind1', 'start': '2021-01-01T00:00:00Z', 'end': '2021-01-02T00:00:00Z'}}" - > {} - -// ****************** spread record of non-discriminated unions ************************** -@doc("The model spread Record") -model SpreadRecordForNonDiscriminatedUnion2 { - @doc("The name property") - name: string; - - ...Record; -} - -@route("/spreadRecordNonDiscriminatedUnion2") -interface SpreadRecordNonDiscriminatedUnion2 - extends ModelOperations< - SpreadRecordForNonDiscriminatedUnion2, - "{'name': 'abc', 'prop1': {'kind': 'kind1', 'start': '2021-01-01T00:00:00Z'}, 'prop2': {'kind': 'kind1', 'start': '2021-01-01T00:00:00Z', 'end': '2021-01-02T00:00:00Z'}}" - > {} - -// ****************** spread record of non-discriminated unions ************************** -@doc("The model spread Record") -model SpreadRecordForNonDiscriminatedUnion3 { - @doc("The name property") - name: string; - - ...Record; -} - -@route("/spreadRecordNonDiscriminatedUnion3") -interface SpreadRecordNonDiscriminatedUnion3 - extends ModelOperations< - SpreadRecordForNonDiscriminatedUnion3, - "{'name': 'abc', 'prop1': [{'kind': 'kind1', 'start': '2021-01-01T00:00:00Z'}, {'kind': 'kind1', 'start': '2021-01-01T00:00:00Z'], 'prop2': {'kind': 'kind1', 'start': '2021-01-01T00:00:00Z', 'end': '2021-01-02T00:00:00Z'}}" - > {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/mockapi.ts deleted file mode 100644 index 62d35378115..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/additional-properties/mockapi.ts +++ /dev/null @@ -1,471 +0,0 @@ -import { json, MockRequest, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -const recordFloatBody = { - id: 43.125, - prop: 43.125, -}; -const recordModelBody = { - knownProp: { state: "ok" }, - prop: { state: "ok" }, -}; -const recordModelArrayBody = { - knownProp: [{ state: "ok" }, { state: "ok" }], - prop: [{ state: "ok" }, { state: "ok" }], -}; -const differentRecordStringBody = { - id: 43.125, - prop: "abc", -}; -const differentRecordFloatBody = { - name: "abc", - prop: 43.125, -}; -const differentRecordModelBody = { - knownProp: "abc", - prop: { state: "ok" }, -}; -const differentRecordModelArrayBody = { - knownProp: "abc", - prop: [{ state: "ok" }, { state: "ok" }], -}; -const extendsModelSpreadStringBody = { - id: 43.125, - prop: "abc", - derivedProp: "abc", -}; -const extendsModelSpreadFloatBody = { - name: "abc", - prop: 43.125, - derivedProp: 43.125, -}; -const extendsModelSpreadModelBody = { - knownProp: "abc", - prop: { state: "ok" }, - derivedProp: { state: "ok" }, -}; -const extendsModelSpreadModelArrayBody = { - knownProp: "abc", - prop: [{ state: "ok" }, { state: "ok" }], - derivedProp: [{ state: "ok" }, { state: "ok" }], -}; -const multipleSpreadBody = { - flag: true, - prop1: "abc", - prop2: 43.125, -}; -const recordUnionBody = multipleSpreadBody; -const recordDiscriminatedUnionBody = { - name: "abc", - prop1: { - kind: "kind0", - fooProp: "abc", - }, - prop2: { - kind: "kind1", - start: "2021-01-01T00:00:00Z", - end: "2021-01-02T00:00:00Z", - }, -}; -const recordNonDiscriminatedUnion2Body = { - name: "abc", - prop1: { - kind: "kind1", - start: "2021-01-01T00:00:00Z", - }, - prop2: { - kind: "kind1", - start: "2021-01-01T00:00:00Z", - end: "2021-01-02T00:00:00Z", - }, -}; -const recordNonDiscriminatedUnion3Body = { - name: "abc", - prop1: [ - { - kind: "kind1", - start: "2021-01-01T00:00:00Z", - }, - { - kind: "kind1", - start: "2021-01-01T00:00:00Z", - }, - ], - prop2: { - kind: "kind1", - start: "2021-01-01T00:00:00Z", - end: "2021-01-02T00:00:00Z", - }, -}; -function createServerTests(url: string, value: unknown) { - return { - get: passOnSuccess({ - uri: url, - method: `get`, - request: {}, - response: { - status: 200, - body: json(value), - }, - kind: "MockApiDefinition", - }), - put: passOnSuccess({ - uri: url, - method: `put`, - request: { - body: json(value), - }, - response: { - status: 204, - }, - handler: (req: MockRequest) => { - const expectedBody = JSON.parse(JSON.stringify(value)); - req.expect.coercedBodyEquals(expectedBody); - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }), - }; -} - -const Type_Property_Additional_Properties_Extends_Record_Unknown = createServerTests( - `/type/property/additionalProperties/extendsRecordUnknown`, - { - name: "ExtendsUnknownAdditionalProperties", - prop1: 32, - prop2: true, - prop3: "abc", - }, -); -Scenarios.Type_Property_AdditionalProperties_ExtendsUnknown_get = - Type_Property_Additional_Properties_Extends_Record_Unknown.get; -Scenarios.Type_Property_AdditionalProperties_ExtendsUnknown_put = - Type_Property_Additional_Properties_Extends_Record_Unknown.put; - -const Type_Property_Additional_Properties_Extends_Record_Unknown_Derived = createServerTests( - `/type/property/additionalProperties/extendsRecordUnknownDerived`, - { - name: "ExtendsUnknownAdditionalProperties", - index: 314, - age: 2.71875, - prop1: 32, - prop2: true, - prop3: "abc", - }, -); -Scenarios.Type_Property_AdditionalProperties_ExtendsUnknownDerived_get = - Type_Property_Additional_Properties_Extends_Record_Unknown_Derived.get; -Scenarios.Type_Property_AdditionalProperties_ExtendsUnknownDerived_put = - Type_Property_Additional_Properties_Extends_Record_Unknown_Derived.put; - -const Type_Property_Additional_Properties_Extends_Unknown_Discriminated = createServerTests( - `/type/property/additionalProperties/extendsUnknownDiscriminated`, - { - kind: "derived", - name: "Derived", - index: 314, - age: 2.71875, - prop1: 32, - prop2: true, - prop3: "abc", - }, -); -Scenarios.Type_Property_AdditionalProperties_ExtendsUnknownDiscriminated_get = - Type_Property_Additional_Properties_Extends_Unknown_Discriminated.get; -Scenarios.Type_Property_AdditionalProperties_ExtendsUnknownDiscriminated_put = - Type_Property_Additional_Properties_Extends_Unknown_Discriminated.put; - -const Type_Property_Additional_Properties_Is_Record_Unknown = createServerTests( - `/type/property/additionalProperties/isRecordUnknown`, - { - name: "IsUnknownAdditionalProperties", - prop1: 32, - prop2: true, - prop3: "abc", - }, -); -Scenarios.Type_Property_AdditionalProperties_IsUnknown_get = - Type_Property_Additional_Properties_Is_Record_Unknown.get; -Scenarios.Type_Property_AdditionalProperties_IsUnknown_put = - Type_Property_Additional_Properties_Is_Record_Unknown.put; - -const Type_Property_Additional_Properties_Is_Record_Unknown_Derived = createServerTests( - `/type/property/additionalProperties/isRecordUnknownDerived`, - { - name: "IsUnknownAdditionalProperties", - index: 314, - age: 2.71875, - prop1: 32, - prop2: true, - prop3: "abc", - }, -); -Scenarios.Type_Property_AdditionalProperties_IsUnknownDerived_get = - Type_Property_Additional_Properties_Is_Record_Unknown_Derived.get; -Scenarios.Type_Property_AdditionalProperties_IsUnknownDerived_put = - Type_Property_Additional_Properties_Is_Record_Unknown_Derived.put; - -const Type_Property_Additional_Properties_Is_Unknown_Discriminated = createServerTests( - `/type/property/additionalProperties/isUnknownDiscriminated`, - { - kind: "derived", - name: "Derived", - index: 314, - age: 2.71875, - prop1: 32, - prop2: true, - prop3: "abc", - }, -); -Scenarios.Type_Property_AdditionalProperties_IsUnknownDiscriminated_get = - Type_Property_Additional_Properties_Is_Unknown_Discriminated.get; -Scenarios.Type_Property_AdditionalProperties_IsUnknownDiscriminated_put = - Type_Property_Additional_Properties_Is_Unknown_Discriminated.put; - -const Type_Property_Additional_Properties_Extends_Record_String = createServerTests( - `/type/property/additionalProperties/extendsRecordString`, - { - name: "ExtendsStringAdditionalProperties", - prop: "abc", - }, -); -Scenarios.Type_Property_AdditionalProperties_ExtendsString_get = - Type_Property_Additional_Properties_Extends_Record_String.get; -Scenarios.Type_Property_AdditionalProperties_ExtendsString_put = - Type_Property_Additional_Properties_Extends_Record_String.put; - -const Type_Property_Additional_Properties_Is_Record_String = createServerTests( - `/type/property/additionalProperties/isRecordstring`, - { - name: "IsStringAdditionalProperties", - prop: "abc", - }, -); -Scenarios.Type_Property_AdditionalProperties_IsString_get = - Type_Property_Additional_Properties_Is_Record_String.get; -Scenarios.Type_Property_AdditionalProperties_IsString_put = - Type_Property_Additional_Properties_Is_Record_String.put; - -const Type_Property_Additional_Properties_Extends_Record_Float = createServerTests( - `/type/property/additionalProperties/extendsRecordFloat`, - recordFloatBody, -); -Scenarios.Type_Property_AdditionalProperties_ExtendsFloat_get = - Type_Property_Additional_Properties_Extends_Record_Float.get; -Scenarios.Type_Property_AdditionalProperties_ExtendsFloat_put = - Type_Property_Additional_Properties_Extends_Record_Float.put; - -const Type_Property_Additional_Properties_Is_Record_Float = createServerTests( - `/type/property/additionalProperties/isRecordFloat`, - recordFloatBody, -); -Scenarios.Type_Property_AdditionalProperties_IsFloat_get = - Type_Property_Additional_Properties_Is_Record_Float.get; -Scenarios.Type_Property_AdditionalProperties_IsFloat_put = - Type_Property_Additional_Properties_Is_Record_Float.put; - -const Type_Property_Additional_Properties_Extends_Record_Model = createServerTests( - `/type/property/additionalProperties/extendsRecordModel`, - recordModelBody, -); -Scenarios.Type_Property_AdditionalProperties_ExtendsModel_get = - Type_Property_Additional_Properties_Extends_Record_Model.get; -Scenarios.Type_Property_AdditionalProperties_ExtendsModel_put = - Type_Property_Additional_Properties_Extends_Record_Model.put; - -const Type_Property_Additional_Properties_Is_Record_Model = createServerTests( - `/type/property/additionalProperties/isRecordModel`, - recordModelBody, -); -Scenarios.Type_Property_AdditionalProperties_IsModel_get = - Type_Property_Additional_Properties_Is_Record_Model.get; -Scenarios.Type_Property_AdditionalProperties_IsModel_put = - Type_Property_Additional_Properties_Is_Record_Model.put; - -const Type_Property_Additional_Properties_Extends_Record_Model_Array = createServerTests( - `/type/property/additionalProperties/extendsRecordModelArray`, - recordModelArrayBody, -); -Scenarios.Type_Property_AdditionalProperties_ExtendsModelArray_get = - Type_Property_Additional_Properties_Extends_Record_Model_Array.get; -Scenarios.Type_Property_AdditionalProperties_ExtendsModelArray_put = - Type_Property_Additional_Properties_Extends_Record_Model_Array.put; - -const Type_Property_Additional_Properties_Is_Record_Model_Array = createServerTests( - `/type/property/additionalProperties/isRecordModelArray`, - recordModelArrayBody, -); -Scenarios.Type_Property_AdditionalProperties_IsModelArray_get = - Type_Property_Additional_Properties_Is_Record_Model_Array.get; -Scenarios.Type_Property_AdditionalProperties_IsModelArray_put = - Type_Property_Additional_Properties_Is_Record_Model_Array.put; - -const Type_Property_Additional_Properties_Spread_Record_String = createServerTests( - `/type/property/additionalProperties/spreadRecordString`, - { - name: "SpreadSpringRecord", - prop: "abc", - }, -); -Scenarios.Type_Property_AdditionalProperties_SpreadString_get = - Type_Property_Additional_Properties_Spread_Record_String.get; -Scenarios.Type_Property_AdditionalProperties_SpreadString_put = - Type_Property_Additional_Properties_Spread_Record_String.put; - -const Type_Property_Additional_Properties_Spread_Record_Float = createServerTests( - `/type/property/additionalProperties/spreadRecordFloat`, - recordFloatBody, -); -Scenarios.Type_Property_AdditionalProperties_SpreadFloat_get = - Type_Property_Additional_Properties_Spread_Record_Float.get; -Scenarios.Type_Property_AdditionalProperties_SpreadFloat_put = - Type_Property_Additional_Properties_Spread_Record_Float.put; - -const Type_Property_Additional_Properties_Spread_Record_Model = createServerTests( - `/type/property/additionalProperties/spreadRecordModel`, - recordModelBody, -); -Scenarios.Type_Property_AdditionalProperties_SpreadModel_get = - Type_Property_Additional_Properties_Spread_Record_Model.get; -Scenarios.Type_Property_AdditionalProperties_SpreadModel_put = - Type_Property_Additional_Properties_Spread_Record_Model.put; - -const Type_Property_Additional_Properties_Spread_Record_Model_Array = createServerTests( - `/type/property/additionalProperties/spreadRecordModelArray`, - recordModelArrayBody, -); -Scenarios.Type_Property_AdditionalProperties_SpreadModelArray_get = - Type_Property_Additional_Properties_Spread_Record_Model_Array.get; -Scenarios.Type_Property_AdditionalProperties_SpreadModelArray_put = - Type_Property_Additional_Properties_Spread_Record_Model_Array.put; - -const Type_Property_Additional_Properties_Spread_Different_Record_String = createServerTests( - `/type/property/additionalProperties/spreadDifferentRecordString`, - differentRecordStringBody, -); -Scenarios.Type_Property_AdditionalProperties_SpreadDifferentString_get = - Type_Property_Additional_Properties_Spread_Different_Record_String.get; -Scenarios.Type_Property_AdditionalProperties_SpreadDifferentString_put = - Type_Property_Additional_Properties_Spread_Different_Record_String.put; - -const Type_Property_Additional_Properties_Spread_Different_Record_Float = createServerTests( - `/type/property/additionalProperties/spreadDifferentRecordFloat`, - differentRecordFloatBody, -); -Scenarios.Type_Property_AdditionalProperties_SpreadDifferentFloat_get = - Type_Property_Additional_Properties_Spread_Different_Record_Float.get; -Scenarios.Type_Property_AdditionalProperties_SpreadDifferentFloat_put = - Type_Property_Additional_Properties_Spread_Different_Record_Float.put; - -const Type_Property_Additional_Properties_Spread_Different_Record_Model = createServerTests( - `/type/property/additionalProperties/spreadDifferentRecordModel`, - differentRecordModelBody, -); -Scenarios.Type_Property_AdditionalProperties_SpreadDifferentModel_get = - Type_Property_Additional_Properties_Spread_Different_Record_Model.get; -Scenarios.Type_Property_AdditionalProperties_SpreadDifferentModel_put = - Type_Property_Additional_Properties_Spread_Different_Record_Model.put; - -const Type_Property_Additional_Properties_Spread_Different_Record_Model_Array = createServerTests( - `/type/property/additionalProperties/spreadDifferentRecordModelArray`, - differentRecordModelArrayBody, -); -Scenarios.Type_Property_AdditionalProperties_SpreadDifferentModelArray_get = - Type_Property_Additional_Properties_Spread_Different_Record_Model_Array.get; -Scenarios.Type_Property_AdditionalProperties_SpreadDifferentModelArray_put = - Type_Property_Additional_Properties_Spread_Different_Record_Model_Array.put; - -const Type_Property_Additional_Properties_Extends_Different_Spread_String = createServerTests( - `/type/property/additionalProperties/extendsDifferentSpreadString`, - extendsModelSpreadStringBody, -); -Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadString_get = - Type_Property_Additional_Properties_Extends_Different_Spread_String.get; -Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadString_put = - Type_Property_Additional_Properties_Extends_Different_Spread_String.put; - -const Type_Property_Additional_Properties_Extends_Different_Spread_Float = createServerTests( - `/type/property/additionalProperties/extendsDifferentSpreadFloat`, - extendsModelSpreadFloatBody, -); -Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadFloat_get = - Type_Property_Additional_Properties_Extends_Different_Spread_Float.get; -Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadFloat_put = - Type_Property_Additional_Properties_Extends_Different_Spread_Float.put; - -const Type_Property_Additional_Properties_Extends_Different_Spread_Model = createServerTests( - `/type/property/additionalProperties/extendsDifferentSpreadModel`, - extendsModelSpreadModelBody, -); -Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadModel_get = - Type_Property_Additional_Properties_Extends_Different_Spread_Model.get; -Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadModel_put = - Type_Property_Additional_Properties_Extends_Different_Spread_Model.put; - -const Type_Property_Additional_Properties_Extends_Different_Spread_Model_Array = createServerTests( - `/type/property/additionalProperties/extendsDifferentSpreadModelArray`, - extendsModelSpreadModelArrayBody, -); -Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadModelArray_get = - Type_Property_Additional_Properties_Extends_Different_Spread_Model_Array.get; -Scenarios.Type_Property_AdditionalProperties_ExtendsDifferentSpreadModelArray_put = - Type_Property_Additional_Properties_Extends_Different_Spread_Model_Array.put; - -const Type_Property_Additional_Properties_Multiple_Spread_Record = createServerTests( - `/type/property/additionalProperties/multipleSpreadRecord`, - multipleSpreadBody, -); -Scenarios.Type_Property_AdditionalProperties_MultipleSpread_get = - Type_Property_Additional_Properties_Multiple_Spread_Record.get; -Scenarios.Type_Property_AdditionalProperties_MultipleSpread_put = - Type_Property_Additional_Properties_Multiple_Spread_Record.put; - -const Type_Property_Additional_Properties_Spread_Record_Union = createServerTests( - `/type/property/additionalProperties/spreadRecordUnion`, - recordUnionBody, -); -Scenarios.Type_Property_AdditionalProperties_SpreadRecordUnion_get = - Type_Property_Additional_Properties_Spread_Record_Union.get; -Scenarios.Type_Property_AdditionalProperties_SpreadRecordUnion_put = - Type_Property_Additional_Properties_Spread_Record_Union.put; - -// const Type_Property_Additional_Properties_Spread_Record_Discriminated_Union = createServerTests( -// `/type/property/additionalProperties/spreadRecordDiscriminatedUnion`, -// recordDiscriminatedUnionBody, -// ); -// Scenarios.Type_Property_AdditionalProperties_SpreadRecordDiscriminatedUnion_get = -// Type_Property_Additional_Properties_Spread_Record_Discriminated_Union.get; -// Scenarios.Type_Property_AdditionalProperties_SpreadRecordDiscriminatedUnion_put = -// Type_Property_Additional_Properties_Spread_Record_Discriminated_Union.put; - -const Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union = createServerTests( - `/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion`, - recordDiscriminatedUnionBody, -); -Scenarios.Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion_get = - Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union.get; -Scenarios.Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion_put = - Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union.put; - -const Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union2 = - createServerTests( - `/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2`, - recordNonDiscriminatedUnion2Body, - ); -Scenarios.Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion2_get = - Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union2.get; -Scenarios.Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion2_put = - Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union2.put; - -const Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union3 = - createServerTests( - `/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3`, - recordNonDiscriminatedUnion3Body, - ); -Scenarios.Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion3_get = - Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union3.get; -Scenarios.Type_Property_AdditionalProperties_SpreadRecordNonDiscriminatedUnion3_put = - Type_Property_Additional_Properties_Spread_Record_Non_Discriminated_Union3.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/main.tsp deleted file mode 100644 index aa9c5b0f294..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/main.tsp +++ /dev/null @@ -1,139 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates models with nullable properties.") -@scenarioService("/type/property/nullable") -namespace Type.Property.Nullable; - -@doc("Template type for testing models with nullable property. Pass in the type of the property you are looking for") -model ModelTemplate { - @doc("Required property") - requiredProperty: string; - - @doc("Property") - nullableProperty: TProperty | null; -} - -@doc("Operations associated with getting and putting models with nullable properties.") -interface OperationsTemplate< - TModel, - TDoc extends valueof string, - TDefaultDoc extends valueof string = "null" -> { - @doc("Get models that will return all properties in the model") - @scenario - @scenarioDoc(""" - Expected response body: - ```json - { "requiredProperty": "foo", "nullableProperty": ${TDoc}} - ``` - """) - @route("/non-null") - @get - getNonNull(): TModel; - - @doc("Get models that will return the default object") - @scenario - @scenarioDoc(""" - Expected response body: - ```json - { "requiredProperty": "foo", "nullableProperty": ${TDefaultDoc}} - ``` - """) - @route("/null") - @get - getNull(): TModel; - - @doc("Put a body with all properties present.") - @scenario - @scenarioDoc(""" - Expected request body: - ```json - { "requiredProperty": "foo", "nullableProperty": ${TDoc}} - ``` - """) - @route("/non-null") - @patch - patchNonNull( - @doc("content-type is application/merge-patch+json") - @header("Content-Type") - contentType: "application/merge-patch+json", - - @body body: TModel, - ): void; - - @doc("Put a body with default properties.") - @scenario - @scenarioDoc(""" - Expected request body: - ```json - { "requiredProperty": "foo", "nullableProperty": ${TDefaultDoc}} - ``` - """) - @route("/null") - @patch - patchNull( - @doc("content-type is application/merge-patch+json") - @header("Content-Type") - contentType: "application/merge-patch+json", - - @body body: TModel, - ): void; -} - -// Model with nullable string property -model StringProperty is ModelTemplate; -@route("/string") -interface String extends OperationsTemplate {} - -// Model with nullable bytes property -model BytesProperty is ModelTemplate; -@route("/bytes") -interface Bytes extends OperationsTemplate {} - -// Model with nullable datetime property -@doc("Model with a datetime property") -model DatetimeProperty is ModelTemplate; -@route("/datetime") -interface Datetime extends OperationsTemplate {} - -// Model with nullable duration property -@doc("Model with a duration property") -model DurationProperty is ModelTemplate; -@route("/duration") -interface Duration extends OperationsTemplate {} - -// Model with nullable collection bytes property -@doc("Model with collection bytes properties") -model CollectionsByteProperty is ModelTemplate; -@route("/collections/bytes") -interface CollectionsByte - extends OperationsTemplate< - CollectionsByteProperty, - "[aGVsbG8sIHdvcmxkIQ==, aGVsbG8sIHdvcmxkIQ==]" - > {} - -// Model with nullable collection models property -@doc("Inner model used in collections model property") -model InnerModel { - @doc("Inner model property") - property: string; -} -@doc("Model with collection models properties") -model CollectionsModelProperty is ModelTemplate; -@route("/collections/model") -interface CollectionsModel - extends OperationsTemplate< - CollectionsModelProperty, - "[{'property': 'hello'}, {'property': 'world'}]" - > {} - -// Model with nullable collection string property -@doc("Model with collection string properties") -model CollectionsStringProperty is ModelTemplate; -@route("/collections/string") -interface CollectionsString - extends OperationsTemplate {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/mockapi.ts deleted file mode 100644 index 10a35c7b609..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/nullable/mockapi.ts +++ /dev/null @@ -1,195 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createServerTests(url: string, value: unknown, patchNullableProperty?: any) { - return { - get: passOnSuccess({ - uri: url, - method: `get`, - response: { - status: 200, - body: json(value), - }, - kind: "MockApiDefinition", - }), - patch: passOnSuccess({ - uri: url, - method: `patch`, - request: { - body: json( - { - requiredProperty: "foo", - nullableProperty: patchNullableProperty || null, - }, - "application/merge-patch+json", - ), - }, - response: { - status: 204, - }, - handler: (req) => { - req.expect.coercedBodyEquals({ - requiredProperty: "foo", - nullableProperty: patchNullableProperty || null, - }); - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }), - }; -} - -const Type_Property_Nullable_String_Null = createServerTests( - `/type/property/nullable/string/null`, - { - requiredProperty: "foo", - nullableProperty: null, - }, -); -const Type_Property_Nullable_String_Non_Null = createServerTests( - `/type/property/nullable/string/non-null`, - { - requiredProperty: "foo", - nullableProperty: "hello", - }, - "hello", -); - -Scenarios.Type_Property_Nullable_String_getNonNull = Type_Property_Nullable_String_Non_Null.get; -Scenarios.Type_Property_Nullable_String_getNull = Type_Property_Nullable_String_Null.get; -Scenarios.Type_Property_Nullable_String_patchNonNull = Type_Property_Nullable_String_Non_Null.patch; -Scenarios.Type_Property_Nullable_String_patchNull = Type_Property_Nullable_String_Null.patch; - -const Type_Property_Nullable_Bytes_Null = createServerTests(`/type/property/nullable/bytes/null`, { - requiredProperty: "foo", - nullableProperty: null, -}); -const Type_Property_Nullable_Bytes_Non_Null = createServerTests( - `/type/property/nullable/bytes/non-null`, - { - requiredProperty: "foo", - nullableProperty: "aGVsbG8sIHdvcmxkIQ==", - }, - "aGVsbG8sIHdvcmxkIQ==", -); -Scenarios.Type_Property_Nullable_Bytes_getNonNull = Type_Property_Nullable_Bytes_Non_Null.get; -Scenarios.Type_Property_Nullable_Bytes_getNull = Type_Property_Nullable_Bytes_Null.get; -Scenarios.Type_Property_Nullable_Bytes_patchNonNull = Type_Property_Nullable_Bytes_Non_Null.patch; -Scenarios.Type_Property_Nullable_Bytes_patchNull = Type_Property_Nullable_Bytes_Null.patch; - -const Type_Property_Nullable_DateTime_Null = createServerTests( - `/type/property/nullable/datetime/null`, - { - requiredProperty: "foo", - nullableProperty: null, - }, -); -const Type_Property_Nullable_DateTime_Non_Null = createServerTests( - `/type/property/nullable/datetime/non-null`, - { - requiredProperty: "foo", - nullableProperty: "2022-08-26T18:38:00Z", - }, - "2022-08-26T18:38:00Z", -); -Scenarios.Type_Property_Nullable_Datetime_getNonNull = Type_Property_Nullable_DateTime_Non_Null.get; -Scenarios.Type_Property_Nullable_Datetime_getNull = Type_Property_Nullable_DateTime_Null.get; -Scenarios.Type_Property_Nullable_Datetime_patchNonNull = - Type_Property_Nullable_DateTime_Non_Null.patch; -Scenarios.Type_Property_Nullable_Datetime_patchNull = Type_Property_Nullable_DateTime_Null.patch; - -const Type_Property_Nullable_Duration_Null = createServerTests( - `/type/property/nullable/duration/null`, - { - requiredProperty: "foo", - nullableProperty: null, - }, -); -const Type_Property_Nullable_Duration_Non_Null = createServerTests( - `/type/property/nullable/duration/non-null`, - { - requiredProperty: "foo", - nullableProperty: "P123DT22H14M12.011S", - }, - "P123DT22H14M12.011S", -); -Scenarios.Type_Property_Nullable_Duration_getNonNull = Type_Property_Nullable_Duration_Non_Null.get; -Scenarios.Type_Property_Nullable_Duration_getNull = Type_Property_Nullable_Duration_Null.get; -Scenarios.Type_Property_Nullable_Duration_patchNonNull = - Type_Property_Nullable_Duration_Non_Null.patch; -Scenarios.Type_Property_Nullable_Duration_patchNull = Type_Property_Nullable_Duration_Null.patch; - -const Type_Property_Nullable_Collections_Bytes_Null = createServerTests( - `/type/property/nullable/collections/bytes/null`, - { - requiredProperty: "foo", - nullableProperty: null, - }, -); -const Type_Property_Nullable_Collections_Bytes_Non_Null = createServerTests( - `/type/property/nullable/collections/bytes/non-null`, - { - requiredProperty: "foo", - nullableProperty: ["aGVsbG8sIHdvcmxkIQ==", "aGVsbG8sIHdvcmxkIQ=="], - }, - ["aGVsbG8sIHdvcmxkIQ==", "aGVsbG8sIHdvcmxkIQ=="], -); -Scenarios.Type_Property_Nullable_CollectionsByte_getNonNull = - Type_Property_Nullable_Collections_Bytes_Non_Null.get; -Scenarios.Type_Property_Nullable_CollectionsByte_getNull = - Type_Property_Nullable_Collections_Bytes_Null.get; -Scenarios.Type_Property_Nullable_CollectionsByte_patchNonNull = - Type_Property_Nullable_Collections_Bytes_Non_Null.patch; -Scenarios.Type_Property_Nullable_CollectionsByte_patchNull = - Type_Property_Nullable_Collections_Bytes_Null.patch; - -const Type_Property_Nullable_Collections_Model_Null = createServerTests( - `/type/property/nullable/collections/model/null`, - { - requiredProperty: "foo", - nullableProperty: null, - }, -); -const Type_Property_Nullable_Collections_Model_Non_Null = createServerTests( - `/type/property/nullable/collections/model/non-null`, - { - requiredProperty: "foo", - nullableProperty: [{ property: "hello" }, { property: "world" }], - }, - [{ property: "hello" }, { property: "world" }], -); -Scenarios.Type_Property_Nullable_CollectionsModel_getNonNull = - Type_Property_Nullable_Collections_Model_Non_Null.get; -Scenarios.Type_Property_Nullable_CollectionsModel_getNull = - Type_Property_Nullable_Collections_Model_Null.get; -Scenarios.Type_Property_Nullable_CollectionsModel_patchNonNull = - Type_Property_Nullable_Collections_Model_Non_Null.patch; -Scenarios.Type_Property_Nullable_CollectionsModel_patchNull = - Type_Property_Nullable_Collections_Model_Null.patch; - -const Type_Property_Nullable_Collections_String_Null = createServerTests( - `/type/property/nullable/collections/string/null`, - { - requiredProperty: "foo", - nullableProperty: null, - }, -); -const Type_Property_Nullable_Collections_String_Non_Null = createServerTests( - `/type/property/nullable/collections/string/non-null`, - { - requiredProperty: "foo", - nullableProperty: ["hello", "world"], - }, - ["hello", "world"], -); -Scenarios.Type_Property_Nullable_CollectionsString_getNonNull = - Type_Property_Nullable_Collections_String_Non_Null.get; -Scenarios.Type_Property_Nullable_CollectionsString_getNull = - Type_Property_Nullable_Collections_String_Null.get; -Scenarios.Type_Property_Nullable_CollectionsString_patchNonNull = - Type_Property_Nullable_Collections_String_Non_Null.patch; -Scenarios.Type_Property_Nullable_CollectionsString_patchNull = - Type_Property_Nullable_Collections_String_Null.patch; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/main.tsp deleted file mode 100644 index 7c7cd060005..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/main.tsp +++ /dev/null @@ -1,226 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates models with optional properties.") -@scenarioService("/type/property/optional") -namespace Type.Property.Optional; - -@doc("Template type for testing models with optional property. Pass in the type of the property you are looking for") -model ModelTemplate { - @doc("Property") - property?: TProperty; -} - -@doc("Operations associated with getting and putting models with optional properties.") -interface OperationsTemplate< - TModel, - TDoc extends valueof string, - TDefaultDoc extends valueof string = "{}" -> { - @doc("Get models that will return all properties in the model") - @scenario - @scenarioDoc(""" - Expected response body: - ```json - {"property": ${TDoc}} - ``` - """) - @route("/all") - @get - getAll(): TModel; - - @doc("Get models that will return the default object") - @scenario - @scenarioDoc(""" - Expected response body: - ```json - ${TDefaultDoc} - ``` - """) - @route("/default") - @get - getDefault(): TModel; - - @doc("Put a body with all properties present.") - @scenario - @scenarioDoc(""" - Expected request body: - ```json - {"property": ${TDoc}} - ``` - """) - @route("/all") - @put - putAll(@body body: TModel): void; - - @doc("Put a body with default properties.") - @scenario - @scenarioDoc(""" - Expected request body: - ```json - ${TDefaultDoc} - ``` - """) - @route("/default") - @put - putDefault(@body body: TModel): void; -} - -// Model with optional string property -model StringProperty is ModelTemplate; -@route("/string") -interface String extends OperationsTemplate {} - -// Model with optional bytes property -model BytesProperty is ModelTemplate; -@route("/bytes") -interface Bytes extends OperationsTemplate {} - -// Model with optional datetime property -@doc("Model with a datetime property") -model DatetimeProperty is ModelTemplate; -@route("/datetime") -interface Datetime extends OperationsTemplate {} - -// Model with optional duration property -@doc("Model with a duration property") -model DurationProperty is ModelTemplate; -@route("/duration") -interface Duration extends OperationsTemplate {} - -// Model with optional plainDate property -@doc("Model with a plainDate property") -model PlainDateProperty is ModelTemplate; -@route("/plainDate") -interface PlainDate extends OperationsTemplate {} - -// Model with optional property -@doc("Model with a plainTime property") -model PlainTimeProperty is ModelTemplate; -@route("/plainTime") -interface PlainTime extends OperationsTemplate {} - -// Model with optional collection bytes property -@doc("Model with collection bytes properties") -model CollectionsByteProperty is ModelTemplate; -@route("/collections/bytes") -interface CollectionsByte - extends OperationsTemplate< - CollectionsByteProperty, - "[\"aGVsbG8sIHdvcmxkIQ==\", \"aGVsbG8sIHdvcmxkIQ==\"]" - > {} - -// Model with optional collection models property -@doc("Model with collection models properties") -model CollectionsModelProperty is ModelTemplate; -@route("/collections/model") -interface CollectionsModel - extends OperationsTemplate< - CollectionsModelProperty, - "[{'property': 'hello'}, {'property': 'world'}]" - > {} - -// Model with optional string literal property -@doc("Model with string literal property") -model StringLiteralProperty is ModelTemplate<"hello">; -@route("/string/literal") -interface StringLiteral extends OperationsTemplate {} - -// Model with optional int literal property -@doc("Model with int literal property") -model IntLiteralProperty is ModelTemplate<1>; -@route("/int/literal") -interface IntLiteral extends OperationsTemplate {} - -// Model with optional float literal property -@doc("Model with float literal property") -model FloatLiteralProperty is ModelTemplate<1.25>; -@route("/float/literal") -interface FloatLiteral extends OperationsTemplate {} - -// Model with optional boolean literal property -@doc("Model with boolean literal property") -model BooleanLiteralProperty is ModelTemplate; -@route("/boolean/literal") -interface BooleanLiteral extends OperationsTemplate {} - -// Model with union of string literal property -@doc("Model with union of string literal property") -model UnionStringLiteralProperty is ModelTemplate<"hello" | "world">; -@route("/union/string/literal") -interface UnionStringLiteral extends OperationsTemplate {} - -// Model with union of int literal property -@doc("Model with union of int literal property") -model UnionIntLiteralProperty is ModelTemplate<1 | 2>; -@route("/union/int/literal") -interface UnionIntLiteral extends OperationsTemplate {} - -// Model with union of float literal property -@doc("Model with union of float literal property") -model UnionFloatLiteralProperty is ModelTemplate<1.25 | 2.375>; -@route("/union/float/literal") -interface UnionFloatLiteral extends OperationsTemplate {} - -@doc("Model with required and optional properties") -model RequiredAndOptionalProperty { - @doc("optional string property") - optionalProperty?: string; - - @doc("required int property") - requiredProperty: int32; -} -@doc("Test optional and required properties") -@route("/requiredAndOptional") -interface RequiredAndOptional { - @doc("Get models that will return all properties in the model") - @scenario - @scenarioDoc(""" - Expected response body: - ```json - {"optionalProperty": "hello", "requiredProperty": 42} - ``` - """) - @route("/all") - @get - getAll(): RequiredAndOptionalProperty; - - @doc("Get models that will return only the required properties") - @scenario - @scenarioDoc(""" - Expected response body: - ```json - {"requiredProperty": 42} - ``` - """) - @route("/requiredOnly") - @get - getRequiredOnly(): RequiredAndOptionalProperty; - - @doc("Put a body with all properties present.") - @scenario - @scenarioDoc(""" - Expected request body: - ```json - {"optionalProperty": "hello", "requiredProperty": 42} - ``` - """) - @route("/all") - @put - putAll(@body body: RequiredAndOptionalProperty): void; - - @doc("Put a body with only required properties.") - @scenario - @scenarioDoc(""" - Expected request body: - ```json - {"requiredProperty": 42} - ``` - """) - @route("/requiredOnly") - @put - putRequiredOnly(@body body: RequiredAndOptionalProperty): void; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/mockapi.ts deleted file mode 100644 index c69baf3f1a9..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/optionality/mockapi.ts +++ /dev/null @@ -1,302 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createServerTests(url: string, value: unknown) { - return { - get: passOnSuccess({ - uri: url, - method: `get`, - request: {}, - response: { - status: 200, - body: json(value), - }, - kind: "MockApiDefinition", - }), - put: passOnSuccess({ - uri: url, - method: `put`, - request: { - body: json(value), - }, - response: { - status: 204, - }, - handler: (req) => { - req.expect.coercedBodyEquals(value); - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }), - }; -} - -const Type_Property_Optional_String_Default = createServerTests( - `/type/property/optional/string/default`, - {}, -); -const Type_Property_Optional_String_All = createServerTests(`/type/property/optional/string/all`, { - property: "hello", -}); -Scenarios.Type_Property_Optional_String_getDefault = Type_Property_Optional_String_Default.get; -Scenarios.Type_Property_Optional_String_putDefault = Type_Property_Optional_String_Default.put; -Scenarios.Type_Property_Optional_String_getAll = Type_Property_Optional_String_All.get; -Scenarios.Type_Property_Optional_String_putAll = Type_Property_Optional_String_All.put; - -const Type_Property_Optional_Bytes_Default = createServerTests( - `/type/property/optional/bytes/default`, - {}, -); -const Type_Property_Optional_Bytes_All = createServerTests(`/type/property/optional/bytes/all`, { - property: "aGVsbG8sIHdvcmxkIQ==", -}); -Scenarios.Type_Property_Optional_Bytes_getDefault = Type_Property_Optional_Bytes_Default.get; -Scenarios.Type_Property_Optional_Bytes_putDefault = Type_Property_Optional_Bytes_Default.put; -Scenarios.Type_Property_Optional_Bytes_getAll = Type_Property_Optional_Bytes_All.get; -Scenarios.Type_Property_Optional_Bytes_putAll = Type_Property_Optional_Bytes_All.put; - -const Type_Property_Optional_DateTime_Default = createServerTests( - `/type/property/optional/datetime/default`, - {}, -); -const Type_Property_Optional_DateTime_All = createServerTests( - `/type/property/optional/datetime/all`, - { - property: "2022-08-26T18:38:00Z", - }, -); -Scenarios.Type_Property_Optional_Datetime_getDefault = Type_Property_Optional_DateTime_Default.get; -Scenarios.Type_Property_Optional_Datetime_putDefault = Type_Property_Optional_DateTime_Default.put; -Scenarios.Type_Property_Optional_Datetime_getAll = Type_Property_Optional_DateTime_All.get; -Scenarios.Type_Property_Optional_Datetime_putAll = Type_Property_Optional_DateTime_All.put; - -const Type_Property_Optional_Duration_Default = createServerTests( - `/type/property/optional/duration/default`, - {}, -); -const Type_Property_Optional_Duration_All = createServerTests( - `/type/property/optional/duration/all`, - { - property: "P123DT22H14M12.011S", - }, -); - -Scenarios.Type_Property_Optional_Duration_getDefault = Type_Property_Optional_Duration_Default.get; -Scenarios.Type_Property_Optional_Duration_putDefault = Type_Property_Optional_Duration_Default.put; -Scenarios.Type_Property_Optional_Duration_getAll = Type_Property_Optional_Duration_All.get; -Scenarios.Type_Property_Optional_Duration_putAll = Type_Property_Optional_Duration_All.put; - -const Type_Property_Optional_PlainDate_Default = createServerTests( - `/type/property/optional/plainDate/default`, - {}, -); -const Type_Property_Optional_PlainDate_All = createServerTests( - `/type/property/optional/plainDate/all`, - { - property: "2022-12-12", - }, -); - -Scenarios.Type_Property_Optional_PlainDate_getDefault = - Type_Property_Optional_PlainDate_Default.get; -Scenarios.Type_Property_Optional_PlainDate_putDefault = - Type_Property_Optional_PlainDate_Default.put; -Scenarios.Type_Property_Optional_PlainDate_getAll = Type_Property_Optional_PlainDate_All.get; -Scenarios.Type_Property_Optional_PlainDate_putAll = Type_Property_Optional_PlainDate_All.put; - -const Type_Property_Optional_PlainTime_Default = createServerTests( - `/type/property/optional/plainTime/default`, - {}, -); -const Type_Property_Optional_PlainTime_All = createServerTests( - `/type/property/optional/plainTime/all`, - { - property: "13:06:12", - }, -); -Scenarios.Type_Property_Optional_PlainTime_getDefault = - Type_Property_Optional_PlainTime_Default.get; -Scenarios.Type_Property_Optional_PlainTime_putDefault = - Type_Property_Optional_PlainTime_Default.put; -Scenarios.Type_Property_Optional_PlainTime_getAll = Type_Property_Optional_PlainTime_All.get; -Scenarios.Type_Property_Optional_PlainTime_putAll = Type_Property_Optional_PlainTime_All.put; - -const Type_Property_Optional_Collections_Bytes_Default = createServerTests( - `/type/property/optional/collections/bytes/default`, - {}, -); -const Type_Property_Optional_Collections_Bytes_All = createServerTests( - `/type/property/optional/collections/bytes/all`, - { property: ["aGVsbG8sIHdvcmxkIQ==", "aGVsbG8sIHdvcmxkIQ=="] }, -); - -Scenarios.Type_Property_Optional_CollectionsByte_getDefault = - Type_Property_Optional_Collections_Bytes_Default.get; -Scenarios.Type_Property_Optional_CollectionsByte_putDefault = - Type_Property_Optional_Collections_Bytes_Default.put; -Scenarios.Type_Property_Optional_CollectionsByte_getAll = - Type_Property_Optional_Collections_Bytes_All.get; -Scenarios.Type_Property_Optional_CollectionsByte_putAll = - Type_Property_Optional_Collections_Bytes_All.put; - -const Type_Property_Optional_Collections_Model_Default = createServerTests( - `/type/property/optional/collections/model/default`, - {}, -); -const Type_Property_Optional_Collections_Model_All = createServerTests( - `/type/property/optional/collections/model/all`, - { property: [{ property: "hello" }, { property: "world" }] }, -); -Scenarios.Type_Property_Optional_CollectionsModel_getDefault = - Type_Property_Optional_Collections_Model_Default.get; -Scenarios.Type_Property_Optional_CollectionsModel_putDefault = - Type_Property_Optional_Collections_Model_Default.put; -Scenarios.Type_Property_Optional_CollectionsModel_getAll = - Type_Property_Optional_Collections_Model_All.get; -Scenarios.Type_Property_Optional_CollectionsModel_putAll = - Type_Property_Optional_Collections_Model_All.put; - -const Type_Property_Optional_String_Literal_Default = createServerTests( - `/type/property/optional/string/literal/default`, - {}, -); -const Type_Property_Optional_String_Literal_All = createServerTests( - `/type/property/optional/string/literal/all`, - { - property: "hello", - }, -); -Scenarios.Type_Property_Optional_StringLiteral_getDefault = - Type_Property_Optional_String_Literal_Default.get; -Scenarios.Type_Property_Optional_StringLiteral_putDefault = - Type_Property_Optional_String_Literal_Default.put; -Scenarios.Type_Property_Optional_StringLiteral_getAll = - Type_Property_Optional_String_Literal_All.get; -Scenarios.Type_Property_Optional_StringLiteral_putAll = - Type_Property_Optional_String_Literal_All.put; - -const Type_Property_Optional_Int_Literal_Default = createServerTests( - `/type/property/optional/int/literal/default`, - {}, -); -const Type_Property_Optional_Int_Literal_All = createServerTests( - `/type/property/optional/int/literal/all`, - { - property: 1, - }, -); -Scenarios.Type_Property_Optional_IntLiteral_getDefault = - Type_Property_Optional_Int_Literal_Default.get; -Scenarios.Type_Property_Optional_IntLiteral_putDefault = - Type_Property_Optional_Int_Literal_Default.put; -Scenarios.Type_Property_Optional_IntLiteral_getAll = Type_Property_Optional_Int_Literal_All.get; -Scenarios.Type_Property_Optional_IntLiteral_putAll = Type_Property_Optional_Int_Literal_All.put; - -const Type_Property_Optional_Float_Literal_Default = createServerTests( - `/type/property/optional/float/literal/default`, - {}, -); -const Type_Property_Optional_Float_Literal_All = createServerTests( - `/type/property/optional/float/literal/all`, - { - property: 1.25, - }, -); -Scenarios.Type_Property_Optional_FloatLiteral_getDefault = - Type_Property_Optional_Float_Literal_Default.get; -Scenarios.Type_Property_Optional_FloatLiteral_putDefault = - Type_Property_Optional_Float_Literal_Default.put; -Scenarios.Type_Property_Optional_FloatLiteral_getAll = Type_Property_Optional_Float_Literal_All.get; -Scenarios.Type_Property_Optional_FloatLiteral_putAll = Type_Property_Optional_Float_Literal_All.put; - -const Type_Property_Optional_Boolean_Literal_Default = createServerTests( - `/type/property/optional/boolean/literal/default`, - {}, -); -const Type_Property_Optional_Boolean_Literal_All = createServerTests( - `/type/property/optional/boolean/literal/all`, - { property: true }, -); -Scenarios.Type_Property_Optional_BooleanLiteral_getDefault = - Type_Property_Optional_Boolean_Literal_Default.get; -Scenarios.Type_Property_Optional_BooleanLiteral_putDefault = - Type_Property_Optional_Boolean_Literal_Default.put; -Scenarios.Type_Property_Optional_BooleanLiteral_getAll = - Type_Property_Optional_Boolean_Literal_All.get; -Scenarios.Type_Property_Optional_BooleanLiteral_putAll = - Type_Property_Optional_Boolean_Literal_All.put; - -const Type_Property_Optional_Union_String_Literal_Default = createServerTests( - `/type/property/optional/union/string/literal/default`, - {}, -); -const Type_Property_Optional_Union_String_Literal_All = createServerTests( - `/type/property/optional/union/string/literal/all`, - { property: "world" }, -); -Scenarios.Type_Property_Optional_UnionStringLiteral_getDefault = - Type_Property_Optional_Union_String_Literal_Default.get; -Scenarios.Type_Property_Optional_UnionStringLiteral_putDefault = - Type_Property_Optional_Union_String_Literal_Default.put; -Scenarios.Type_Property_Optional_UnionStringLiteral_getAll = - Type_Property_Optional_Union_String_Literal_All.get; -Scenarios.Type_Property_Optional_UnionStringLiteral_putAll = - Type_Property_Optional_Union_String_Literal_All.put; - -const Type_Property_Optional_Union_Int_Literal_Default = createServerTests( - `/type/property/optional/union/int/literal/default`, - {}, -); -const Type_Property_Optional_Union_Int_Literal_All = createServerTests( - `/type/property/optional/union/int/literal/all`, - { property: 2 }, -); -Scenarios.Type_Property_Optional_UnionIntLiteral_getDefault = - Type_Property_Optional_Union_Int_Literal_Default.get; -Scenarios.Type_Property_Optional_UnionIntLiteral_putDefault = - Type_Property_Optional_Union_Int_Literal_Default.put; -Scenarios.Type_Property_Optional_UnionIntLiteral_getAll = - Type_Property_Optional_Union_Int_Literal_All.get; -Scenarios.Type_Property_Optional_UnionIntLiteral_putAll = - Type_Property_Optional_Union_Int_Literal_All.put; - -const Type_Property_Optional_Union_Float_Literal_Default = createServerTests( - `/type/property/optional/union/float/literal/default`, - {}, -); -const Type_Property_Optional_Union_Float_Literal_All = createServerTests( - `/type/property/optional/union/float/literal/all`, - { property: 2.375 }, -); -Scenarios.Type_Property_Optional_UnionFloatLiteral_getDefault = - Type_Property_Optional_Union_Float_Literal_Default.get; -Scenarios.Type_Property_Optional_UnionFloatLiteral_putDefault = - Type_Property_Optional_Union_Float_Literal_Default.put; -Scenarios.Type_Property_Optional_UnionFloatLiteral_getAll = - Type_Property_Optional_Union_Float_Literal_All.get; -Scenarios.Type_Property_Optional_UnionFloatLiteral_putAll = - Type_Property_Optional_Union_Float_Literal_All.put; - -const Type_Property_Optional_Required_And_Optional_RequiredOnly = createServerTests( - `/type/property/optional/requiredAndOptional/requiredOnly`, - { requiredProperty: 42 }, -); -Scenarios.Type_Property_Optional_RequiredAndOptional_getRequiredOnly = - Type_Property_Optional_Required_And_Optional_RequiredOnly.get; -Scenarios.Type_Property_Optional_RequiredAndOptional_putRequiredOnly = - Type_Property_Optional_Required_And_Optional_RequiredOnly.put; - -const Type_Property_Optional_Required_And_Optional_All = createServerTests( - `/type/property/optional/requiredAndOptional/all`, - { - optionalProperty: "hello", - requiredProperty: 42, - }, -); -Scenarios.Type_Property_Optional_RequiredAndOptional_getAll = - Type_Property_Optional_Required_And_Optional_All.get; -Scenarios.Type_Property_Optional_RequiredAndOptional_putAll = - Type_Property_Optional_Required_And_Optional_All.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/main.tsp deleted file mode 100644 index 3f661a4baac..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/main.tsp +++ /dev/null @@ -1,244 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@doc("Illustrates various property types for models") -@scenarioService("/type/property/value-types") -namespace Type.Property.ValueTypes; - -// TEMPLATES -@doc("Template type for testing models with specific properties. Pass in the type of the property you are looking for") -model ModelTemplate { - @doc("Property") - property: TProperty; -} - -@doc("Template to have models operations") -interface ModelOperations { - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc(""" - Expected response body: - ```json - {"property": ${TDoc}} - ``` - """) - @get - @doc("Get call") - get(): TModel; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc(""" - Expected input body: - ```json - {"property": ${TDoc}} - ``` - """) - @put - @doc("Put operation") - put(@body @doc("body") body: TModel): void; -} - -// Test a model with a boolean property -@doc("Model with a boolean property") -model BooleanProperty is ModelTemplate; -@route("/boolean") -interface Boolean extends ModelOperations {} - -// Test a model with a string property -@doc("Model with a string property") -model StringProperty is ModelTemplate; -@route("/string") -interface String extends ModelOperations {} - -// Test a model with a bytes property -@doc("Model with a bytes property") -model BytesProperty is ModelTemplate; -@route("/bytes") -interface Bytes extends ModelOperations {} - -// Test a model with an int property -@doc("Model with a int property") -model IntProperty is ModelTemplate; -@route("/int") -interface Int extends ModelOperations {} - -// Test a model with a float property -@doc("Model with a float property") -model FloatProperty is ModelTemplate; -@route("/float") -interface Float extends ModelOperations {} - -// Test a model with a decimal property -@doc("Model with a decimal property") -model DecimalProperty is ModelTemplate; -@route("/decimal") -interface Decimal extends ModelOperations {} - -// Test a model with a decimal128 property -@doc("Model with a decimal128 property") -model Decimal128Property is ModelTemplate; -@route("/decimal128") -interface Decimal128 extends ModelOperations {} - -// Test a model with a datetime property -@doc("Model with a datetime property") -model DatetimeProperty is ModelTemplate; -@route("/datetime") -interface Datetime extends ModelOperations {} - -// Test a model with a duration property -@doc("Model with a duration property") -model DurationProperty is ModelTemplate; -@route("/duration") -interface Duration extends ModelOperations {} - -// Test a model with an enum property -@doc("Enum that will be used as a property for model EnumProperty. Extensible.") -union InnerEnum { - string, - - @doc("First value.") - ValueOne: "ValueOne", - - @doc("Second value.") - ValueTwo: "ValueTwo", -} - -@doc("Enum that will be used as a property for model EnumProperty. Non-extensible.") -enum FixedInnerEnum { - @doc("First value.") - ValueOne, - - @doc("Second value.") - ValueTwo, -} - -@doc("Model with enum properties") -model EnumProperty is ModelTemplate; -@route("/enum") -interface Enum extends ModelOperations {} - -@doc("Model with extensible enum properties") -model ExtensibleEnumProperty is ModelTemplate; -@route("/extensible-enum") -interface ExtensibleEnum extends ModelOperations {} - -// Test a model with a model property -@doc("Inner model. Will be a property type for ModelWithModelProperties") -model InnerModel { - @doc("Required string property") - property: string; -} -@doc("Model with model properties") -model ModelProperty is ModelTemplate; -@route("/model") -interface Model extends ModelOperations {} - -// Test a model with a string collection property -@doc("Model with collection string properties") -model CollectionsStringProperty is ModelTemplate; -@route("/collections/string") -interface CollectionsString - extends ModelOperations {} - -// Test a model with an int collection property -@doc("Model with collection int properties") -model CollectionsIntProperty is ModelTemplate; -@route("/collections/int") -interface CollectionsInt extends ModelOperations {} - -// Test a model with a model collection property -@doc("Model with collection model properties") -model CollectionsModelProperty is ModelTemplate; -@route("/collections/model") -interface CollectionsModel - extends ModelOperations< - CollectionsModelProperty, - "[{'property': 'hello'}, {'property': 'world'}]" - > {} - -// Test a model with a string dictionary property -@doc("Model with dictionary string properties") -model DictionaryStringProperty is ModelTemplate>; -@route("/dictionary/string") -interface DictionaryString - extends ModelOperations {} - -// Test a model with a never property -@doc("Model with a property never. (This property should not be included).") -model NeverProperty is ModelTemplate; -@route("/never") -interface Never extends ModelOperations"> {} - -// Test a model with unknown and string -@doc("Model with a property unknown, and the data is a string.") -model UnknownStringProperty is ModelTemplate; -@route("/unknown/string") -interface UnknownString extends ModelOperations {} - -// Test a model with unknown and int -@doc("Model with a property unknown, and the data is a int32.") -model UnknownIntProperty is ModelTemplate; -@route("/unknown/int") -interface UnknownInt extends ModelOperations {} - -// Test a model with unknown and a dictionnary -@doc("Model with a property unknown, and the data is a dictionnary.") -model UnknownDictProperty is ModelTemplate; -@route("/unknown/dict") -interface UnknownDict extends ModelOperations {} - -// Test a model with unknown and an array -@doc("Model with a property unknown, and the data is an array.") -model UnknownArrayProperty is ModelTemplate; -@route("/unknown/array") -interface UnknownArray extends ModelOperations {} - -@doc("Model with a string literal property.") -model StringLiteralProperty is ModelTemplate<"hello">; -@route("/string/literal") -interface StringLiteral extends ModelOperations {} - -@doc("Model with a int literal property.") -model IntLiteralProperty is ModelTemplate<42>; -@route("/int/literal") -interface IntLiteral extends ModelOperations {} - -@doc("Model with a float literal property.") -model FloatLiteralProperty is ModelTemplate<43.125>; -@route("/float/literal") -interface FloatLiteral extends ModelOperations {} - -@doc("Model with a boolean literal property.") -model BooleanLiteralProperty is ModelTemplate; -@route("/boolean/literal") -interface BooleanLiteral extends ModelOperations {} - -@doc("Model with a union of string literal as property.") -model UnionStringLiteralProperty is ModelTemplate<"hello" | "world">; -@route("/union/string/literal") -interface UnionStringLiteral extends ModelOperations {} - -@doc("Model with a union of int literal as property.") -model UnionIntLiteralProperty is ModelTemplate<42 | 43>; -@route("/union/int/literal") -interface UnionIntLiteral extends ModelOperations {} - -@doc("Model with a union of float literal as property.") -model UnionFloatLiteralProperty is ModelTemplate<43.125 | 46.875>; -@route("/union/float/literal") -interface UnionFloatLiteral extends ModelOperations {} - -union ExtendedEnum { - string, - EnumValue2: "value2", -} - -model UnionEnumValueProperty is ModelTemplate; - -@route("/union-enum-value") -interface UnionEnumValue extends ModelOperations {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/mockapi.ts deleted file mode 100644 index 4a635330592..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/property/value-types/mockapi.ts +++ /dev/null @@ -1,306 +0,0 @@ -import { json, MockRequest, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createServerTests(url: string, data: unknown) { - return { - get: passOnSuccess({ - uri: url, - method: `get`, - request: {}, - response: { - status: 200, - body: json(data), - }, - kind: "MockApiDefinition", - }), - put: passOnSuccess({ - uri: url, - method: `put`, - request: { - body: json(data), - }, - response: { - status: 204, - }, - handler: (req) => { - req.expect.coercedBodyEquals(data); - return { - status: 204, - }; - }, - kind: "MockApiDefinition", - }), - }; -} - -const Type_Property_ValueTypes_Boolean = createServerTests(`/type/property/value-types/boolean`, { - property: true, -}); -Scenarios.Type_Property_ValueTypes_Boolean_get = Type_Property_ValueTypes_Boolean.get; -Scenarios.Type_Property_ValueTypes_Boolean_put = Type_Property_ValueTypes_Boolean.put; - -const Type_Property_ValueTypes_String = createServerTests(`/type/property/value-types/string`, { - property: "hello", -}); -Scenarios.Type_Property_ValueTypes_String_get = Type_Property_ValueTypes_String.get; -Scenarios.Type_Property_ValueTypes_String_put = Type_Property_ValueTypes_String.put; - -const Type_Property_ValueTypes_Bytes = createServerTests(`/type/property/value-types/bytes`, { - property: "aGVsbG8sIHdvcmxkIQ==", -}); -Scenarios.Type_Property_ValueTypes_Bytes_get = Type_Property_ValueTypes_Bytes.get; -Scenarios.Type_Property_ValueTypes_Bytes_put = Type_Property_ValueTypes_Bytes.put; - -const Type_Property_ValueTypes_Int = createServerTests(`/type/property/value-types/int`, { - property: 42, -}); -Scenarios.Type_Property_ValueTypes_Int_get = Type_Property_ValueTypes_Int.get; -Scenarios.Type_Property_ValueTypes_Int_put = Type_Property_ValueTypes_Int.put; - -const Type_Property_ValueTypes_Float = createServerTests(`/type/property/value-types/float`, { - property: 43.125, -}); -Scenarios.Type_Property_ValueTypes_Float_get = Type_Property_ValueTypes_Float.get; -Scenarios.Type_Property_ValueTypes_Float_put = Type_Property_ValueTypes_Float.put; - -const Type_Property_ValueTypes_Decimal = createServerTests(`/type/property/value-types/decimal`, { - property: 0.33333, -}); -Scenarios.Type_Property_ValueTypes_Decimal_get = Type_Property_ValueTypes_Decimal.get; -Scenarios.Type_Property_ValueTypes_Decimal_put = Type_Property_ValueTypes_Decimal.put; - -const Type_Property_ValueTypes_Decimal128 = createServerTests( - `/type/property/value-types/decimal128`, - { - property: 0.33333, - }, -); -Scenarios.Type_Property_ValueTypes_Decimal128_get = Type_Property_ValueTypes_Decimal128.get; -Scenarios.Type_Property_ValueTypes_Decimal128_put = Type_Property_ValueTypes_Decimal128.put; - -const Type_Property_ValueTypes_DateTime = createServerTests(`/type/property/value-types/datetime`, { - property: "2022-08-26T18:38:00Z", -}); -Scenarios.Type_Property_ValueTypes_Datetime_get = Type_Property_ValueTypes_DateTime.get; -Scenarios.Type_Property_ValueTypes_Datetime_put = Type_Property_ValueTypes_DateTime.put; - -const Type_Property_ValueTypes_Duration = createServerTests(`/type/property/value-types/duration`, { - property: "P123DT22H14M12.011S", -}); -Scenarios.Type_Property_ValueTypes_Duration_get = Type_Property_ValueTypes_Duration.get; -Scenarios.Type_Property_ValueTypes_Duration_put = Type_Property_ValueTypes_Duration.put; - -const Type_Property_ValueTypes_Enum = createServerTests(`/type/property/value-types/enum`, { - property: "ValueOne", -}); -Scenarios.Type_Property_ValueTypes_Enum_get = Type_Property_ValueTypes_Enum.get; -Scenarios.Type_Property_ValueTypes_Enum_put = Type_Property_ValueTypes_Enum.put; - -const Type_Property_ValueTypes_Extensible_Enum = createServerTests( - `/type/property/value-types/extensible-enum`, - { - property: "UnknownValue", - }, -); -Scenarios.Type_Property_ValueTypes_ExtensibleEnum_get = - Type_Property_ValueTypes_Extensible_Enum.get; -Scenarios.Type_Property_ValueTypes_ExtensibleEnum_put = - Type_Property_ValueTypes_Extensible_Enum.put; - -const Type_Property_ValueTypes_Model = createServerTests(`/type/property/value-types/model`, { - property: { property: "hello" }, -}); -Scenarios.Type_Property_ValueTypes_Model_get = Type_Property_ValueTypes_Model.get; -Scenarios.Type_Property_ValueTypes_Model_put = Type_Property_ValueTypes_Model.put; - -const Type_Property_ValueTypes_Collections_String = createServerTests( - `/type/property/value-types/collections/string`, - { - property: ["hello", "world"], - }, -); -Scenarios.Type_Property_ValueTypes_CollectionsString_get = - Type_Property_ValueTypes_Collections_String.get; -Scenarios.Type_Property_ValueTypes_CollectionsString_put = - Type_Property_ValueTypes_Collections_String.put; - -const Type_Property_ValueTypes_Collections_Int = createServerTests( - `/type/property/value-types/collections/int`, - { - property: [1, 2], - }, -); -Scenarios.Type_Property_ValueTypes_CollectionsInt_get = - Type_Property_ValueTypes_Collections_Int.get; -Scenarios.Type_Property_ValueTypes_CollectionsInt_put = - Type_Property_ValueTypes_Collections_Int.put; - -const Type_Property_ValueTypes_Collections_Model = createServerTests( - `/type/property/value-types/collections/model`, - { - property: [{ property: "hello" }, { property: "world" }], - }, -); -Scenarios.Type_Property_ValueTypes_CollectionsModel_get = - Type_Property_ValueTypes_Collections_Model.get; -Scenarios.Type_Property_ValueTypes_CollectionsModel_put = - Type_Property_ValueTypes_Collections_Model.put; - -const Type_Property_ValueTypes_Dictionary_String = createServerTests( - `/type/property/value-types/dictionary/string`, - { - property: { k1: "hello", k2: "world" }, - }, -); -Scenarios.Type_Property_ValueTypes_DictionaryString_get = - Type_Property_ValueTypes_Dictionary_String.get; -Scenarios.Type_Property_ValueTypes_DictionaryString_put = - Type_Property_ValueTypes_Dictionary_String.put; - -const Type_Property_ValueTypes_Never = createServerTests(`/type/property/value-types/never`, { - property: undefined, -}); -Scenarios.Type_Property_ValueTypes_Never_get = Type_Property_ValueTypes_Never.get; -Scenarios.Type_Property_ValueTypes_Never_put = passOnSuccess({ - uri: `/type/property/value-types/never`, - method: `put`, - request: { - body: json({ - property: undefined, - }), - }, - response: { - status: 204, - }, - handler: (req: MockRequest) => { - const expectedBody = JSON.parse( - JSON.stringify({ - property: undefined, - }), - ); - req.expect.coercedBodyEquals(expectedBody); - return { - status: 204, - }; - }, - kind: "MockApiDefinition", -}); - -const Type_Property_ValueTypes_Unknown_String = createServerTests( - `/type/property/value-types/unknown/string`, - { - property: "hello", - }, -); -Scenarios.Type_Property_ValueTypes_UnknownString_get = Type_Property_ValueTypes_Unknown_String.get; -Scenarios.Type_Property_ValueTypes_UnknownString_put = Type_Property_ValueTypes_Unknown_String.put; - -const Type_Property_ValueTypes_Unknown_Int = createServerTests( - `/type/property/value-types/unknown/int`, - { - property: 42, - }, -); -Scenarios.Type_Property_ValueTypes_UnknownInt_get = Type_Property_ValueTypes_Unknown_Int.get; -Scenarios.Type_Property_ValueTypes_UnknownInt_put = Type_Property_ValueTypes_Unknown_Int.put; - -const Type_Property_ValueTypes_Unknown_Dict = createServerTests( - `/type/property/value-types/unknown/dict`, - { - property: { k1: "hello", k2: 42 }, - }, -); -Scenarios.Type_Property_ValueTypes_UnknownDict_get = Type_Property_ValueTypes_Unknown_Dict.get; -Scenarios.Type_Property_ValueTypes_UnknownDict_put = Type_Property_ValueTypes_Unknown_Dict.put; - -const Type_Property_ValueTypes_Unknown_Array = createServerTests( - `/type/property/value-types/unknown/array`, - { - property: ["hello", "world"], - }, -); -Scenarios.Type_Property_ValueTypes_UnknownArray_get = Type_Property_ValueTypes_Unknown_Array.get; -Scenarios.Type_Property_ValueTypes_UnknownArray_put = Type_Property_ValueTypes_Unknown_Array.put; - -const Type_Property_ValueTypes_String_Literal = createServerTests( - `/type/property/value-types/string/literal`, - { - property: "hello", - }, -); -Scenarios.Type_Property_ValueTypes_StringLiteral_get = Type_Property_ValueTypes_String_Literal.get; -Scenarios.Type_Property_ValueTypes_StringLiteral_put = Type_Property_ValueTypes_String_Literal.put; - -const Type_Property_ValueTypes_Int_Literal = createServerTests( - `/type/property/value-types/int/literal`, - { - property: 42, - }, -); -Scenarios.Type_Property_ValueTypes_IntLiteral_get = Type_Property_ValueTypes_Int_Literal.get; -Scenarios.Type_Property_ValueTypes_IntLiteral_put = Type_Property_ValueTypes_Int_Literal.put; - -const Type_Property_ValueTypes_Float_Literal = createServerTests( - `/type/property/value-types/float/literal`, - { - property: 43.125, - }, -); -Scenarios.Type_Property_ValueTypes_FloatLiteral_get = Type_Property_ValueTypes_Float_Literal.get; -Scenarios.Type_Property_ValueTypes_FloatLiteral_put = Type_Property_ValueTypes_Float_Literal.put; - -const Type_Property_ValueTypes_Boolean_Literal = createServerTests( - `/type/property/value-types/boolean/literal`, - { - property: true, - }, -); -Scenarios.Type_Property_ValueTypes_BooleanLiteral_get = - Type_Property_ValueTypes_Boolean_Literal.get; -Scenarios.Type_Property_ValueTypes_BooleanLiteral_put = - Type_Property_ValueTypes_Boolean_Literal.put; - -const Type_Property_ValueTypes_Union_String_Literal = createServerTests( - `/type/property/value-types/union/string/literal`, - { - property: "world", - }, -); -Scenarios.Type_Property_ValueTypes_UnionStringLiteral_get = - Type_Property_ValueTypes_Union_String_Literal.get; -Scenarios.Type_Property_ValueTypes_UnionStringLiteral_put = - Type_Property_ValueTypes_Union_String_Literal.put; - -const Type_Property_ValueTypes_Union_Int_Literal = createServerTests( - `/type/property/value-types/union/int/literal`, - { - property: 42, - }, -); -Scenarios.Type_Property_ValueTypes_UnionIntLiteral_get = - Type_Property_ValueTypes_Union_Int_Literal.get; -Scenarios.Type_Property_ValueTypes_UnionIntLiteral_put = - Type_Property_ValueTypes_Union_Int_Literal.put; - -const Type_Property_ValueTypes_Union_Float_Literal = createServerTests( - `/type/property/value-types/union/float/literal`, - { - property: 46.875, - }, -); -Scenarios.Type_Property_ValueTypes_UnionFloatLiteral_get = - Type_Property_ValueTypes_Union_Float_Literal.get; -Scenarios.Type_Property_ValueTypes_UnionFloatLiteral_put = - Type_Property_ValueTypes_Union_Float_Literal.put; - -const Type_Property_ValueTypes_Union_Enum_Value = createServerTests( - `/type/property/value-types/union-enum-value`, - { - property: "value2", - }, -); -Scenarios.Type_Property_ValueTypes_UnionEnumValue_get = - Type_Property_ValueTypes_Union_Enum_Value.get; -Scenarios.Type_Property_ValueTypes_UnionEnumValue_put = - Type_Property_ValueTypes_Union_Enum_Value.put; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/main.tsp deleted file mode 100644 index 3eeddd4705e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/main.tsp +++ /dev/null @@ -1,185 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -@scenarioService("/type/scalar") -namespace Type.Scalar; - -@route("/string") -interface String { - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to handle a string value. Mock api will return 'test'") - @get - @doc("get string value") - get(): { - @header - contentType: "application/json"; - - @body - body: string; - }; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to send a string value. Mock api expect to receive 'test'") - @put - @doc("put string value") - put( - @header - contentType: "application/json", - - @body @doc("_") body: string, - ): void; -} - -@route("/boolean") -interface Boolean { - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to handle a boolean value. Mock api will return true ") - @get - @doc("get boolean value") - get(): { - @header - contentType: "application/json"; - - @body - body: boolean; - }; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to send a boolean value. Mock api expect to receive 'true'") - @put - @doc("put boolean value") - put( - @header - contentType: "application/json", - - @body @doc("_") body: boolean, - ): void; -} - -@route("/unknown") -interface Unknown { - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to handle a unknown type value. Mock api will return 'test'") - @get - @doc("get unknown value") - get(): { - @header - contentType: "application/json"; - - @body - body: unknown; - }; - - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "For testing" - @scenario - @scenarioDoc("Expect to send a string value. Mock api expect to receive 'test'") - @put - @doc("put unknown value") - put( - @header - contentType: "application/json", - - @body @doc("_") body: unknown, - ): void; -} - -@doc("Template to have scalar types operations") -interface ScalarTypesOperations { - @scenario - @scenarioDoc(""" - Expected response body: - ```json - ${TDoc} - ``` - """) - @get - @route("/response_body") - responseBody(): { - @header - contentType: "application/json"; - - @body - body: T; - }; - - @scenario - @scenarioDoc(""" - Expected input body: - ```json - ${TDoc} - ``` - """) - @put - @route("/resquest_body") - requestBody( - @header - contentType: "application/json", - - @body body: T, - ): void; - - @scenario - @scenarioDoc(""" - Expected request parameter: - value=${TDoc} - """) - @get - @route("/request_parameter") - requestParameter(@query value: T): void; -} - -@doc("Decimal type") -@route("/decimal") -interface DecimalType extends ScalarTypesOperations {} - -@doc("Decimal128 type") -@route("/decimal128") -interface Decimal128Type extends ScalarTypesOperations {} - -@doc("Template to verify number types") -interface NumberTypesVerifyOperations< - T, - VerifyValues extends valueof string, - ResultValue extends valueof string -> { - @scenario - @scenarioDoc(""" - Get verify values: - ${VerifyValues} - """) - @get - @route("/prepare_verify") - prepareVerify(): T[]; - - @scenario - @scenarioDoc(""" - Expected input body: - ```json - ${ResultValue} - ``` - """) - @post - @route("/verify") - verify( - @header - contentType: "application/json", - - @body body: T, - ): void; -} - -@doc("Decimal type verification") -@route("/decimal") -interface DecimalVerify extends NumberTypesVerifyOperations {} - -@doc("Decimal128 type verification") -@route("/decimal128") -interface Decimal128Verify extends NumberTypesVerifyOperations {} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/mockapi.ts deleted file mode 100644 index ec69226ac07..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/scalar/mockapi.ts +++ /dev/null @@ -1,199 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Type_Scalar_String_get = passOnSuccess({ - uri: "/type/scalar/string", - method: `get`, - request: {}, - response: { - status: 200, - body: json("test"), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Scalar_String_put = passOnSuccess({ - uri: "/type/scalar/string", - method: `put`, - request: { - body: json("test"), - headers: { - "Content-Type": "text/plain", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Scalar_Boolean_get = passOnSuccess({ - uri: "/type/scalar/boolean", - method: `get`, - request: {}, - response: { - status: 200, - body: json(true), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Scalar_Boolean_put = passOnSuccess({ - uri: "/type/scalar/boolean", - method: `put`, - request: { - body: json(true), - headers: { - "Content-Type": "application/json; charset=utf-8", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Scalar_Unknown_get = passOnSuccess({ - uri: "/type/scalar/unknown", - method: `get`, - request: {}, - response: { - status: 200, - body: json("test"), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Scalar_Unknown_put = passOnSuccess({ - uri: "/type/scalar/unknown", - method: `put`, - request: { - body: json("test"), - headers: { - "Content-Type": "text/plain", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Scalar_DecimalType_responseBody = passOnSuccess({ - uri: "/type/scalar/decimal/response_body", - method: `get`, - request: {}, - response: { - status: 200, - body: json(0.33333), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Scalar_Decimal128Type_responseBody = passOnSuccess({ - uri: "/type/scalar/decimal128/response_body", - method: `get`, - request: {}, - response: { - status: 200, - body: json(0.33333), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Scalar_DecimalType_requestBody = passOnSuccess({ - uri: "/type/scalar/decimal/resquest_body", - method: `put`, - request: { - body: json(0.33333), - headers: { - "Content-Type": "application/json; charset=utf-8", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Scalar_Decimal128Type_requestBody = passOnSuccess({ - uri: "/type/scalar/decimal128/resquest_body", - method: `put`, - request: { - body: json(0.33333), - headers: { - "Content-Type": "application/json; charset=utf-8", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Scalar_DecimalType_requestParameter = passOnSuccess({ - uri: "/type/scalar/decimal/request_parameter", - method: `get`, - request: { - query: { value: "0.33333" }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Scalar_Decimal128Type_requestParameter = passOnSuccess({ - uri: "/type/scalar/decimal128/request_parameter", - method: `get`, - request: { - query: { value: "0.33333" }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Scalar_DecimalVerify_prepareVerify = passOnSuccess({ - uri: "/type/scalar/decimal/prepare_verify", - method: `get`, - request: {}, - response: { - status: 200, - body: json([0.1, 0.1, 0.1]), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Scalar_Decimal128Verify_prepareVerify = passOnSuccess({ - uri: "/type/scalar/decimal128/prepare_verify", - method: `get`, - request: {}, - response: { - status: 200, - body: json([0.1, 0.1, 0.1]), - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Scalar_DecimalVerify_verify = passOnSuccess({ - uri: "/type/scalar/decimal/verify", - method: `post`, - request: { - body: json(0.3), - headers: { - "Content-Type": "application/json; charset=utf-8", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); -Scenarios.Type_Scalar_Decimal128Verify_verify = passOnSuccess({ - uri: "/type/scalar/decimal128/verify", - method: `post`, - request: { - body: json(0.3), - headers: { - "Content-Type": "application/json; charset=utf-8", - }, - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/main.tsp deleted file mode 100644 index c6f2dc04931..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/main.tsp +++ /dev/null @@ -1,251 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -/** - * Describe scenarios for discriminated unions. - */ -@scenarioService("/type/union/discriminated") -namespace Type.Union.Discriminated; - -// Models for discriminated unions -model Cat { - name: string; - meow: boolean; -} - -model Dog { - name: string; - bark: boolean; -} - -/** - * Test discriminated union with default envelope serialization. - * The discriminated union should serialize with "kind" as discriminator - * and "value" as envelope property. - */ -@discriminated -union PetWithEnvelope { - cat: Cat, - dog: Dog, -} - -@route("/envelope") -namespace Envelope { - @route("/object") - namespace Object { - @route("/default") - interface Default { - @scenario - @scenarioDoc(""" - Test discriminated union with envelope serialization. - When value of query parameter "kind" is "cat" or no query parameter input, the expected response is: - ```json - { - "kind": "cat", - "value": { - "name": "Whiskers", - "meow": true - } - } - ``` - When it is "dog", expected response is: - ```json - { - "kind": "dog", - "value": { - "name": "Rex", - "bark": false - } - } - ``` - """) - @get - get(@query kind?: string): PetWithEnvelope; - - @scenario - @scenarioDoc(""" - Test discriminated union with envelope serialization. - Send the union as: - ```json - { - "kind": "cat", - "value": { - "name": "Whiskers", - "meow": true - } - } - ``` - """) - @put - put(@body input: PetWithEnvelope): PetWithEnvelope; - } - - @route("/custom-properties") - interface CustomProperties { - @scenario - @scenarioDoc(""" - Test discriminated union with custom property names. - When value of query parameter "petType" is "cat" or no query parameter input, the expected response is: - ```json - { - "petType": "cat", - "petData": { - "name": "Whiskers", - "meow": true - } - } - ``` - When it is "dog", expected response is: - ```json - { - "petType": "dog", - "petData": { - "name": "Rex", - "bark": false - } - } - ``` - """) - @get - get(@query petType?: string): PetWithCustomNames; - - @scenario - @scenarioDoc(""" - Test discriminated union with custom property names. - Send the union as: - ```json - { - "petType": "cat", - "petData": { - "name": "Whiskers", - "meow": true - } - } - ``` - """) - @put - put(@body input: PetWithCustomNames): PetWithCustomNames; - } - } -} - -/** - * Test discriminated union with custom property names. - * The discriminated union should serialize with custom discriminator - * and envelope property names. - */ -@discriminated(#{ discriminatorPropertyName: "petType", envelopePropertyName: "petData" }) -union PetWithCustomNames { - cat: Cat, - dog: Dog, -} - -/** - * Test discriminated union with inline discriminator (no envelope). - * The discriminated union should serialize with discriminator property - * injected directly into the variant object. - */ -@discriminated(#{ envelope: "none" }) -union PetInline { - cat: Cat, - dog: Dog, -} - -/** - * Test discriminated union with inline discriminator and custom discriminator property name. - * The discriminated union should serialize with custom discriminator property - * injected directly into the variant object. - */ -@discriminated(#{ envelope: "none", discriminatorPropertyName: "type" }) -union PetInlineWithCustomDiscriminator { - cat: Cat, - dog: Dog, -} - -@route("/no-envelope") -namespace NoEnvelope { - @route("/default") - interface Default { - @scenario - @scenarioDoc(""" - Test discriminated union with inline discriminator. - When value of query parameter "kind" is "cat" or no query parameter input, the expected response is: - ```json - { - "kind": "cat", - "name": "Whiskers", - "meow": true - } - ``` - When it is "dog", expected response is: - ```json - { - "kind": "dog", - "name": "Rex", - "bark": false - } - ``` - """) - @get - get(@query kind?: string): PetInline; - - @scenario - @scenarioDoc(""" - Test discriminated union with inline discriminator. - Send the union as: - ```json - { - "kind": "cat", - "name": "Whiskers", - "meow": true - } - ``` - """) - @put - put(@body input: PetInline): PetInline; - } - - @route("/custom-discriminator") - interface CustomDiscriminator { - @scenario - @scenarioDoc(""" - Test discriminated union with inline discriminator and custom discriminator property name. - When value of query parameter "type" is "cat" or no query parameter input, the expected response is: - ```json - { - "type": "cat", - "name": "Whiskers", - "meow": true - } - ``` - When it is "dog", expected response is: - ```json - { - "type": "dog", - "name": "Rex", - "bark": false - } - ``` - """) - @get - get(@query type?: string): PetInlineWithCustomDiscriminator; - - @scenario - @scenarioDoc(""" - Test discriminated union with inline discriminator and custom discriminator property name. - Send the union as: - ```json - { - "type": "cat", - "name": "Whiskers", - "meow": true - } - ``` - """) - @put - put(@body input: PetInlineWithCustomDiscriminator): PetInlineWithCustomDiscriminator; - } -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/mockapi.ts deleted file mode 100644 index 5502cf3f279..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/union/discriminated/mockapi.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { json, MockRequest, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -// Test data for discriminated union scenarios -const catData = { - name: "Whiskers", - meow: true, -}; - -const dogData = { - name: "Rex", - bark: false, -}; - -// Envelope discriminated union (default serialization) -const envelopeCatBody = { - kind: "cat", - value: catData, -}; - -const envelopeDogBody = { - kind: "dog", - value: dogData, -}; - -Scenarios.Type_Union_Discriminated_Envelope_Object_Default_get = passOnSuccess({ - uri: "/type/union/discriminated/envelope/object/default", - method: "get", - request: {}, - response: { - status: 200, - body: json(envelopeCatBody), - }, - handler: (req: MockRequest) => { - const kind = req.query.kind as string | undefined; - - // When kind is null or "cat", return response for "cat" - // When kind is "dog", return response for "dog" - if (kind === "dog") { - return { - status: 200, - body: json(envelopeDogBody), - }; - } else { - // Default case: when kind is null, undefined, or "cat" - return { - status: 200, - body: json(envelopeCatBody), - }; - } - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Union_Discriminated_Envelope_Object_Default_put = passOnSuccess({ - uri: "/type/union/discriminated/envelope/object/default", - method: "put", - request: { - body: json(envelopeCatBody), - }, - response: { - status: 200, - body: json(envelopeCatBody), - }, - kind: "MockApiDefinition", -}); - -// Custom names discriminated union -const customNamesCatBody = { - petType: "cat", - petData: catData, -}; - -const customNamesDogBody = { - petType: "dog", - petData: dogData, -}; - -Scenarios.Type_Union_Discriminated_Envelope_Object_CustomProperties_get = passOnSuccess({ - uri: "/type/union/discriminated/envelope/object/custom-properties", - method: "get", - request: {}, - response: { - status: 200, - body: json(customNamesCatBody), - }, - handler: (req: MockRequest) => { - const petType = req.query.petType as string | undefined; - - // When petType is null or "cat", return response for "cat" - // When petType is "dog", return response for "dog" - if (petType === "dog") { - return { - status: 200, - body: json(customNamesDogBody), - }; - } else { - // Default case: when petType is null, undefined, or "cat" - return { - status: 200, - body: json(customNamesCatBody), - }; - } - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Union_Discriminated_Envelope_Object_CustomProperties_put = passOnSuccess({ - uri: "/type/union/discriminated/envelope/object/custom-properties", - method: "put", - request: { - body: json(customNamesCatBody), - }, - response: { - status: 200, - body: json(customNamesCatBody), - }, - kind: "MockApiDefinition", -}); - -// Inline discriminated union (no envelope) -const inlineCatBody = { - kind: "cat", - name: "Whiskers", - meow: true, -}; - -const inlineDogBody = { - kind: "dog", - name: "Rex", - bark: false, -}; - -Scenarios.Type_Union_Discriminated_NoEnvelope_Default_get = passOnSuccess({ - uri: "/type/union/discriminated/no-envelope/default", - method: "get", - request: {}, - response: { - status: 200, - body: json(inlineCatBody), - }, - handler: (req: MockRequest) => { - const kind = req.query.kind as string | undefined; - - // When kind is null or "cat", return response for "cat" - // When kind is "dog", return response for "dog" - if (kind === "dog") { - return { - status: 200, - body: json(inlineDogBody), - }; - } else { - // Default case: when kind is null, undefined, or "cat" - return { - status: 200, - body: json(inlineCatBody), - }; - } - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Union_Discriminated_NoEnvelope_Default_put = passOnSuccess({ - uri: "/type/union/discriminated/no-envelope/default", - method: "put", - request: { - body: json(inlineCatBody), - }, - response: { - status: 200, - body: json(inlineCatBody), - }, - kind: "MockApiDefinition", -}); - -// Inline discriminated union with custom discriminator property name -const inlineCustomCatBody = { - type: "cat", - name: "Whiskers", - meow: true, -}; - -const inlineCustomDogBody = { - type: "dog", - name: "Rex", - bark: false, -}; - -Scenarios.Type_Union_Discriminated_NoEnvelope_CustomDiscriminator_get = passOnSuccess({ - uri: "/type/union/discriminated/no-envelope/custom-discriminator", - method: "get", - request: {}, - response: { - status: 200, - body: json(inlineCustomCatBody), - }, - handler: (req: MockRequest) => { - const type = req.query.type as string | undefined; - - // When type is null or "cat", return response for "cat" - // When type is "dog", return response for "dog" - if (type === "dog") { - return { - status: 200, - body: json(inlineCustomDogBody), - }; - } else { - // Default case: when type is null, undefined, or "cat" - return { - status: 200, - body: json(inlineCustomCatBody), - }; - } - }, - kind: "MockApiDefinition", -}); - -Scenarios.Type_Union_Discriminated_NoEnvelope_CustomDiscriminator_put = passOnSuccess({ - uri: "/type/union/discriminated/no-envelope/custom-discriminator", - method: "put", - request: { - body: json(inlineCustomCatBody), - }, - response: { - status: 200, - body: json(inlineCustomCatBody), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/union/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/type/union/main.tsp deleted file mode 100644 index 7df2d3387a0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/union/main.tsp +++ /dev/null @@ -1,249 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; - -using Http; -using Spector; - -/** - * Describe scenarios for various combinations of unions. - */ -@scenarioService("/type/union") -namespace Type.Union; - -model Cat { - name: string; -} - -model Dog { - bark: string; -} - -enum LR { - left, - right, -} -enum UD { - up, - down, -} - -/** - * Describe union of string "a" | "b" | "c" - */ -@route("/strings-only") -interface StringsOnly extends GetAndSend<"a" | "b" | "c", "\"b\""> {} - -/** - * Describe union of string string | "b" | "c" - */ -@route("/string-extensible") -interface StringExtensible extends GetAndSend {} - -union StringExtensibleNamedUnion { - string, - OptionB: "b", - "c", -} -/** - * Describe union of string string | "b" | "c" but where the union is named and some of the variants are named - */ -@route("/string-extensible-named") -interface StringExtensibleNamed extends GetAndSend {} - -/** - * Describe union of integer 1 | 2 | 3 - */ -@route("/ints-only") -interface IntsOnly extends GetAndSend<1 | 2 | 3, "2"> {} - -/** - * Describe union of floats 1.1 | 2.2 | 3.3 - */ -@route("/floats-only") -interface FloatsOnly extends GetAndSend<1.1 | 2.2 | 3.3, "2.2"> {} - -/** - * Describe union of models - */ -@route("/models-only") -interface ModelsOnly - extends GetAndSend< - Cat | Dog, - """ - { - "name": "test" - } - """ - > {} - -model EnumsOnlyCases { - /** This should be receive/send the left variant */ - lr: LR | UD; - - /** This should be receive/send the up variant */ - ud: UD | UD; -} - -/** - * Describe union of 2 different enums - */ -@route("/enums-only") -interface EnumsOnly - extends GetAndSend< - LR | UD, - """ - { - "lr": "right", - "ud": "up" - } - """, - EnumsOnlyCases - > {} - -model StringAndArrayCases { - /** This should be receive/send the string variant */ - string: string | string[]; - - /** This should be receive/send the array variant */ - array: string | string[]; -} - -/** - * Describe union of a string and an array of strings - */ -@route("/string-and-array") -interface StringAndArray - extends GetAndSend< - string | string[], - """ - { - "string": "test", - "array": ["test1", "test2"] - } - """, - StringAndArrayCases - > {} - -alias MixedLiteralsUnion = "a" | 2 | 3.3 | true; -model MixedLiteralsCases { - /** This should be receive/send the "a" variant */ - stringLiteral: MixedLiteralsUnion; - - /** This should be receive/send the 2 variant */ - intLiteral: MixedLiteralsUnion; - - /** This should be receive/send the 3.3 variant */ - floatLiteral: MixedLiteralsUnion; - - /** This should be receive/send the true variant */ - booleanLiteral: MixedLiteralsUnion; -} - -/** - * Describe union of floats "a" | 2 | 3.3 - */ -@route("/mixed-literals") -interface MixedLiterals - extends GetAndSend< - MixedLiteralsUnion, - """ - { - "stringLiteral": "a", - "intLiteral": 2, - "floatLiteral": 3.3, - "booleanLiteral": true - } - """, - MixedLiteralsCases - > {} - -alias MixedTypesUnion = Cat | "a" | int32 | boolean; -model MixedTypesCases { - /** This should be receive/send the Cat variant */ - `model`: MixedTypesUnion; - - /** This should be receive/send the "a" variant */ - literal: MixedTypesUnion; - - /** This should be receive/send the int variant */ - int: MixedTypesUnion; - - /** This should be receive/send the boolean variant */ - boolean: MixedTypesUnion; - - /** This should be receive/send 4 element with Cat, "a", int, and boolean */ - array: MixedTypesUnion[]; -} - -/** - * Describe union of floats "a" | 2 | 3.3 - */ -@route("/mixed-types") -interface MixedTypes - extends GetAndSend< - MixedTypesUnion, - """ - { - "model": { - "name": "test" - }, - "literal": "a", - "int": 2, - "boolean": true, - "array": [ - { - "name": "test" - }, - "a", - 2, - true - ] - } - """, - MixedTypesCases - > {} - -/** - * Helper interface to describe a test involving getting and sending a specific data - */ -interface GetAndSend { - @scenario - @scenarioDoc( - """ - Verify a union can be processed in a response: - ```tsp - {type} - ``` - - Expected response body: - ```json - { "prop": ${Payload}} - ``` - """, - { - type: Union, - } - ) - get(): { - prop: Cases; - }; - - @scenario - @scenarioDoc( - """ - Verify a union can be processed in a response: - ```tsp - {type} - ``` - - Expected request to send body: - ```json - { "prop": ${Payload}} - ``` - """, - { - type: Union, - } - ) - send(prop: Cases): void; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/type/union/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/type/union/mockapi.ts deleted file mode 100644 index 26c42638c58..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/type/union/mockapi.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -function createGetServerTests(url: string, value: unknown) { - return passOnSuccess({ - uri: url, - method: `get`, - request: {}, - response: { - status: 200, - body: json({ prop: value }), - }, - kind: "MockApiDefinition", - }); -} - -function createPostServerTests(url: string, value: unknown) { - return passOnSuccess({ - uri: url, - method: `post`, - request: { - body: json({ - prop: value, - }), - }, - response: { - status: 204, - }, - kind: "MockApiDefinition", - }); -} - -Scenarios.Type_Union_StringsOnly_get = createGetServerTests(`/type/union/strings-only`, "b"); -Scenarios.Type_Union_StringsOnly_send = createPostServerTests(`/type/union/strings-only`, "b"); - -Scenarios.Type_Union_StringExtensible_get = createGetServerTests( - `/type/union/string-extensible`, - "custom", -); -Scenarios.Type_Union_StringExtensible_send = createPostServerTests( - `/type/union/string-extensible`, - "custom", -); - -Scenarios.Type_Union_StringExtensibleNamed_get = createGetServerTests( - `/type/union/string-extensible-named`, - "custom", -); -Scenarios.Type_Union_StringExtensibleNamed_send = createPostServerTests( - `/type/union/string-extensible-named`, - "custom", -); - -Scenarios.Type_Union_IntsOnly_get = createGetServerTests(`/type/union/ints-only`, 2); -Scenarios.Type_Union_IntsOnly_send = createPostServerTests(`/type/union/ints-only`, 2); - -Scenarios.Type_Union_FloatsOnly_get = createGetServerTests(`/type/union/floats-only`, 2.2); -Scenarios.Type_Union_FloatsOnly_send = createPostServerTests(`/type/union/floats-only`, 2.2); - -Scenarios.Type_Union_ModelsOnly_get = createGetServerTests(`/type/union/models-only`, { - name: "test", -}); -Scenarios.Type_Union_ModelsOnly_send = createPostServerTests(`/type/union/models-only`, { - name: "test", -}); - -Scenarios.Type_Union_EnumsOnly_get = createGetServerTests(`/type/union/enums-only`, { - lr: "right", - ud: "up", -}); -Scenarios.Type_Union_EnumsOnly_send = createPostServerTests(`/type/union/enums-only`, { - lr: "right", - ud: "up", -}); - -Scenarios.Type_Union_StringAndArray_get = createGetServerTests(`/type/union/string-and-array`, { - string: "test", - array: ["test1", "test2"], -}); -Scenarios.Type_Union_StringAndArray_send = createPostServerTests(`/type/union/string-and-array`, { - string: "test", - array: ["test1", "test2"], -}); - -Scenarios.Type_Union_MixedLiterals_get = createGetServerTests(`/type/union/mixed-literals`, { - stringLiteral: "a", - intLiteral: 2, - floatLiteral: 3.3, - booleanLiteral: true, -}); -Scenarios.Type_Union_MixedLiterals_send = createPostServerTests(`/type/union/mixed-literals`, { - stringLiteral: "a", - intLiteral: 2, - floatLiteral: 3.3, - booleanLiteral: true, -}); - -Scenarios.Type_Union_MixedTypes_get = createGetServerTests(`/type/union/mixed-types`, { - model: { - name: "test", - }, - literal: "a", - int: 2, - boolean: true, - array: [ - { - name: "test", - }, - "a", - 2, - true, - ], -}); -Scenarios.Type_Union_MixedTypes_send = createPostServerTests(`/type/union/mixed-types`, { - model: { - name: "test", - }, - literal: "a", - int: 2, - boolean: true, - array: [ - { - name: "test", - }, - "a", - 2, - true, - ], -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/main.tsp deleted file mode 100644 index a81594a47a0..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/main.tsp +++ /dev/null @@ -1,136 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@typespec/versioning"; - -using Http; -using Spector; -using TypeSpec.Versioning; - -/** - * Test for the `@added` decorator. - */ -@service -@versioned(Versions) -@server( - "{endpoint}/versioning/added/api-version:{version}", - "Testserver endpoint", - { - /** - * Need to be set as 'http://localhost:3000' in client. - */ - endpoint: url, - - /** - * Need to be set as 'v1' or 'v2' in client. - */ - version: Versions, - } -) -namespace Versioning.Added; - -/** - * The version of the API. - */ -enum Versions { - /** - * The version v1. - */ - v1: "v1", - - /** - * The version v2. - */ - v2: "v2", -} - -model ModelV1 { - prop: string; - enumProp: EnumV1; - - @added(Versions.v2) - unionProp: UnionV1; -} - -enum EnumV1 { - enumMemberV1, - - @added(Versions.v2) - enumMemberV2, -} - -@added(Versions.v2) -model ModelV2 { - prop: string; - enumProp: EnumV2; - unionProp: UnionV2; -} - -@added(Versions.v2) -enum EnumV2 { - enumMember, -} - -union UnionV1 { - string, - - @added(Versions.v2) - V2Scalar, -} - -@added(Versions.v2) -union UnionV2 { - string, - int32, -} - -@added(Versions.v2) -scalar V2Scalar extends int32; - -@scenario -@scenarioDoc(""" - This operation should be generated with latest version's signature. - - Expected request body: - ```json - { "prop": "foo", "enumProp": "enumMemberV2", "unionProp": 10 } - ``` - - Expected header: - header-v2=bar - - """) -@route("/v1") -@post -op v1(@body body: ModelV1, @added(Versions.v2) @header headerV2: string): ModelV1; - -@scenario -@scenarioDoc(""" - This operation should only be generated with latest version. - - Expected request body: - ```json - { "prop": "foo", "enumProp": "enumMember", "unionProp": "bar" } - ``` - """) -@route("/v2") -@added(Versions.v2) -@post -op v2(@body body: ModelV2): ModelV2; - -@added(Versions.v2) -@scenario -@scenarioDoc(""" - This operation group should only be generated with latest version. - - Expected request body for v2InInterface: - ```json - { "prop": "foo", "enumProp": "enumMember", "unionProp": "bar" } - ``` - - """) -@route("/interface-v2") -interface InterfaceV2 { - @post - @route("/v2") - v2InInterface(@body body: ModelV2): ModelV2; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/mockapi.ts deleted file mode 100644 index 3b6ef53b584..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/added/mockapi.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Versioning_Added_v1 = passOnSuccess({ - uri: `/versioning/added/api-version:v2/v1`, - method: `post`, - request: { - body: json({ - prop: "foo", - enumProp: "enumMemberV2", - unionProp: 10, - }), - headers: { - "header-v2": "bar", - }, - }, - response: { - status: 200, - body: json({ prop: "foo", enumProp: "enumMemberV2", unionProp: 10 }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Versioning_Added_v2 = passOnSuccess({ - uri: `/versioning/added/api-version:v2/v2`, - method: `post`, - request: { - body: json({ - prop: "foo", - enumProp: "enumMember", - unionProp: "bar", - }), - }, - response: { - status: 200, - body: json({ prop: "foo", enumProp: "enumMember", unionProp: "bar" }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Versioning_Added_InterfaceV2 = passOnSuccess({ - uri: `/versioning/added/api-version:v2/interface-v2/v2`, - method: `post`, - request: { - body: json({ - prop: "foo", - enumProp: "enumMember", - unionProp: "bar", - }), - }, - response: { - status: 200, - body: json({ prop: "foo", enumProp: "enumMember", unionProp: "bar" }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/main.tsp deleted file mode 100644 index df1d25c018a..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/main.tsp +++ /dev/null @@ -1,65 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@typespec/versioning"; - -using Http; -using Spector; -using TypeSpec.Versioning; - -/** - * Test for the `@madeOptional` decorator. - */ -@service -@versioned(Versions) -@server( - "{endpoint}/versioning/made-optional/api-version:{version}", - "Testserver endpoint", - { - /** - * Need to be set as 'http://localhost:3000' in client. - */ - endpoint: url, - - /** - * Need to be set as 'v1' or 'v2' in client. - */ - version: Versions, - } -) -namespace Versioning.MadeOptional; - -/** - * The version of the API. - */ -enum Versions { - /** - * The version v1. - */ - v1: "v1", - - /** - * The version v2. - */ - v2: "v2", -} - -model TestModel { - prop: string; - - @madeOptional(Versions.v2) - changedProp?: string; -} - -@scenario -@scenarioDoc(""" - This operation should be generated with latest version's signature. - - Expected request body: - ```json - { "prop": "foo" } - ``` - - """) -@route("/test") -@post -op test(@body body: TestModel, @madeOptional(Versions.v2) @query param?: string): TestModel; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/mockapi.ts deleted file mode 100644 index b28d3b80704..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/madeOptional/mockapi.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Versioning_MadeOptional_test = passOnSuccess({ - uri: `/versioning/made-optional/api-version:v2/test`, - method: `post`, - request: { - body: json({ - prop: "foo", - }), - }, - response: { - status: 200, - body: json({ prop: "foo" }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/main.tsp deleted file mode 100644 index 769230a6c53..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/main.tsp +++ /dev/null @@ -1,188 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@typespec/versioning"; - -using Http; -using Spector; -using TypeSpec.Versioning; - -/** - * Test for the `@removed` decorator. - */ -@service -@versioned(Versions) -@server( - "{endpoint}/versioning/removed/api-version:{version}", - "Testserver endpoint", - { - /** - * Need to be set as 'http://localhost:3000' in client. - */ - endpoint: url, - - /** - * Need to be set as 'v1', 'v2preview' or 'v2' in client. - */ - version: Versions, - } -) -namespace Versioning.Removed; - -/** - * The version of the API. - */ -enum Versions { - /** - * The version v1. - */ - v1: "v1", - - /** - * The V2 Preview version. - */ - v2preview: "v2preview", - - /** - * The version v2. - */ - v2: "v2", -} - -@removed(Versions.v2) -model ModelV1 { - prop: string; - enumProp: EnumV1; - unionProp: UnionV1; -} - -@removed(Versions.v2) -enum EnumV1 { - enumMember, -} - -model ModelV2 { - prop: string; - - @removed(Versions.v2) - removedProp: string; - - enumProp: EnumV2; - - @added(Versions.v1) - unionProp: UnionV2; -} - -model ModelV3 { - id: string; - - @removed(Versions.v2preview) - @added(Versions.v2) - enumProp: EnumV3; -} - -enum EnumV2 { - @removed(Versions.v2) - enumMemberV1, - - enumMemberV2, -} - -enum EnumV3 { - @removed(Versions.v2preview) - @added(Versions.v2) - enumMemberV1, - - enumMemberV2Preview, -} - -@removed(Versions.v2) -union UnionV1 { - string, - int32, -} - -union UnionV2 { - string, - float32, - - @removed(Versions.v2) - V1Scalar, -} - -@removed(Versions.v2) -scalar V1Scalar extends int32; - -/** - * This operation should not be generated with latest version's signature. - */ -#suppress "@typespec/spector/missing-scenario" "by design" -@route("/v1") -@post -@removed(Versions.v2) -op v1(@body body: ModelV1): ModelV1; - -@scenario -@scenarioDoc(""" - This operation should be generated with latest version's signature. - - Expected request body: - ```json - { "prop": "foo", "enumProp": "enumMemberV2", "unionProp": "bar" } - ``` - """) -@route("/v2") -@post -op v2(@body body: ModelV2, @removed(Versions.v2) @query param: string): ModelV2; - -/** - * This operation group should not be generated with latest version. - */ -@route("/interface-v1") -@removed(Versions.v2) -interface InterfaceV1 { - #suppress "@typespec/spector/missing-scenario" "by design" - @post - @route("/v1") - v1InInterface(@body body: ModelV1): ModelV1; -} - -/** This operation will pass different paths and different request bodies based on different versions. */ -@scenario -@scenarioDoc(""" - path: "/versioning/removed/api-version:v1/v3" - Expected request body: - ```json - { "id": "123", "enumProp": "enumMemberV1" } - ``` - - Expected response body: - ```json - { "id": "123", "enumProp": "enumMemberV1" } - ``` - - path: "/versioning/removed/api-version:v2preview/v3" - Expected request body: - ```json - { "id": "123"} - ``` - - Expected response body: - ```json - { "id": "123"} - ``` - - path: "/versioning/removed/api-version:v2/v3" - Expected request body: - ```json - { "id": "123", "enumProp": "enumMemberV1" } - ``` - - Expected response body: - ```json - { "id": "123", "enumProp": "enumMemberV1" } - ``` - - """) -@post -@route("/v3") -op modelV3(@body body: ModelV3): ModelV3; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/mockapi.ts deleted file mode 100644 index 3ad0c9f2677..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/removed/mockapi.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Versioning_Removed_v2 = passOnSuccess({ - uri: `/versioning/removed/api-version:v2/v2`, - method: `post`, - request: { - body: json({ - prop: "foo", - enumProp: "enumMemberV2", - unionProp: "bar", - }), - }, - response: { - status: 200, - body: json({ prop: "foo", enumProp: "enumMemberV2", unionProp: "bar" }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Versioning_Removed_modelV3 = passOnSuccess({ - uri: `/versioning/removed/api-version\\:v1/v3`, - method: "post", - request: { - body: json({ - id: "123", - enumProp: "enumMemberV1", - }), - }, - response: { - status: 200, - body: json({ id: "123", enumProp: "enumMemberV1" }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Versioning_Removed_modelV3_V2 = passOnSuccess({ - uri: `/versioning/removed/api-version\\:v2/v3`, - method: "post", - request: { - body: json({ - id: "123", - enumProp: "enumMemberV1", - }), - }, - response: { - status: 200, - body: json({ id: "123", enumProp: "enumMemberV1" }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Versioning_Removed_modelV3_V2preview = passOnSuccess({ - uri: `/versioning/removed/api-version\\:v2preview/v3`, - method: "post", - request: { - body: json({ - id: "123", - }), - }, - response: { - status: 200, - body: json({ id: "123" }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/main.tsp deleted file mode 100644 index c6e6e81fe21..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/main.tsp +++ /dev/null @@ -1,112 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@typespec/versioning"; - -using Http; -using Spector; -using TypeSpec.Versioning; - -/** - * Test for the `@renamedFrom` decorator. - */ -@service -@versioned(Versions) -@server( - "{endpoint}/versioning/renamed-from/api-version:{version}", - "Testserver endpoint", - { - /** - * Need to be set as 'http://localhost:3000' in client. - */ - endpoint: url, - - /** - * Need to be set as 'v1' or 'v2' in client. - */ - version: Versions, - } -) -namespace Versioning.RenamedFrom; - -/** - * The version of the API. - */ -enum Versions { - /** - * The version v1. - */ - v1: "v1", - - /** - * The version v2. - */ - v2: "v2", -} - -@renamedFrom(Versions.v2, "OldModel") -model NewModel { - @renamedFrom(Versions.v2, "oldProp") - newProp: string; - - enumProp: NewEnum; - unionProp: NewUnion; -} - -@renamedFrom(Versions.v2, "OldEnum") -enum NewEnum { - @renamedFrom(Versions.v2, "oldEnumMember") - newEnumMember, -} - -@renamedFrom(Versions.v2, "OldUnion") -union NewUnion { - string, - - @renamedFrom(Versions.v2, "oldUnionVariant") - newUnionVariant: NewScalar, -} - -@renamedFrom(Versions.v2, "OldScalar") -scalar NewScalar extends int32; - -@scenario -@scenarioDoc(""" - This operation should be generated with latest version's signature. - - Expected request body: - ```json - { "newProp": "foo", "enumProp": "newEnumMember", "unionProp": 10 } - ``` - - Expected query: - newQuery=bar - - """) -@route("/test") -@post -@renamedFrom(Versions.v2, "oldOp") -op newOp( - @body body: NewModel, - - @renamedFrom(Versions.v2, "oldQuery") - @query - newQuery: string, -): NewModel; - -@renamedFrom(Versions.v2, "OldInterface") -@scenario -@scenarioDoc(""" - This operation group should only be generated with latest version's signature. - - Expected request body for test: - ```json - { "prop": "foo", "enumProp": "newEnumMember", "unionProp": 10 } - ``` - - """) -@route("/interface") -interface NewInterface { - @post - @route("/test") - newOpInNewInterface(@body body: NewModel): NewModel; -} diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/mockapi.ts deleted file mode 100644 index c666f859b27..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/renamedFrom/mockapi.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Versioning_RenamedFrom_newOp = passOnSuccess({ - uri: `/versioning/renamed-from/api-version:v2/test`, - method: `post`, - request: { - body: json({ - newProp: "foo", - enumProp: "newEnumMember", - unionProp: 10, - }), - query: { - newQuery: "bar", - }, - }, - response: { - status: 200, - body: json({ newProp: "foo", enumProp: "newEnumMember", unionProp: 10 }), - }, - kind: "MockApiDefinition", -}); - -Scenarios.Versioning_RenamedFrom_NewInterface = passOnSuccess({ - uri: `/versioning/renamed-from/api-version:v2/interface/test`, - method: `post`, - request: { - body: json({ - newProp: "foo", - enumProp: "newEnumMember", - unionProp: 10, - }), - }, - response: { - status: 200, - body: json({ newProp: "foo", enumProp: "newEnumMember", unionProp: 10 }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/main.tsp deleted file mode 100644 index a6fa063011b..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/main.tsp +++ /dev/null @@ -1,72 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@typespec/versioning"; - -using Http; -using Spector; -using TypeSpec.Versioning; - -/** - * Test for the `@returnTypeChangedFrom` decorator. - */ -@service -@versioned(Versions) -@server( - "{endpoint}/versioning/return-type-changed-from/api-version:{version}", - "Testserver endpoint", - { - /** - * Need to be set as 'http://localhost:3000' in client. - */ - endpoint: url, - - /** - * Need to be set as 'v1' or 'v2' in client. - */ - version: Versions, - } -) -namespace Versioning.ReturnTypeChangedFrom; - -/** - * The version of the API. - */ -enum Versions { - /** - * The version v1. - */ - v1: "v1", - - /** - * The version v2. - */ - v2: "v2", -} - -@scenario -@scenarioDoc(""" - This operation should be generated with latest version's signature. - - Expected request body: "test" - Expected response body: "test" - - """) -@route("/test") -@post -@returnTypeChangedFrom( - Versions.v2, - { - @header - contentType: "application/json", - - @body - body: int32, - } -) -op test(@header contentType: "application/json", @body body: string): { - @header - contentType: "application/json"; - - @body - body: string; -}; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/mockapi.ts deleted file mode 100644 index b15729a3c05..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/returnTypeChangedFrom/mockapi.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Versioning_ReturnTypeChangedFrom_test = passOnSuccess({ - uri: `/versioning/return-type-changed-from/api-version:v2/test`, - method: `post`, - request: { - body: json("test"), - headers: { - "Content-Type": "text/plain", - }, - }, - response: { - status: 200, - body: json("test"), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/main.tsp b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/main.tsp deleted file mode 100644 index acc8bd99e50..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/main.tsp +++ /dev/null @@ -1,71 +0,0 @@ -import "@typespec/http"; -import "@typespec/spector"; -import "@typespec/versioning"; - -using Http; -using Spector; -using TypeSpec.Versioning; - -/** - * Test for the `@typeChangedFrom` decorator. - */ -@service -@versioned(Versions) -@server( - "{endpoint}/versioning/type-changed-from/api-version:{version}", - "Testserver endpoint", - { - /** - * Need to be set as 'http://localhost:3000' in client. - */ - endpoint: url, - - /** - * Need to be set as 'v1' or 'v2' in client. - */ - version: Versions, - } -) -namespace Versioning.TypeChangedFrom; - -/** - * The version of the API. - */ -enum Versions { - /** - * The version v1. - */ - v1: "v1", - - /** - * The version v2. - */ - v2: "v2", -} - -model TestModel { - prop: string; - - @typeChangedFrom(Versions.v2, int32) - changedProp: string; -} - -@scenario -@scenarioDoc(""" - This operation should be generated with latest version's signature. - - Expected request body: - ```json - { "prop": "foo", "changedProp": "bar" } - ``` - - Expected query param: - param="baz" - - """) -@route("/test") -@post -op test( - @body body: TestModel, - @typeChangedFrom(Versions.v2, int32) @query param: string, -): TestModel; diff --git a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/mockapi.ts b/packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/mockapi.ts deleted file mode 100644 index 4e7b0142a5e..00000000000 --- a/packages/http-client-java/generator/http-client-generator-test/specs/versioning/typeChangedFrom/mockapi.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api"; - -export const Scenarios: Record = {}; - -Scenarios.Versioning_TypeChangedFrom_test = passOnSuccess({ - uri: `/versioning/type-changed-from/api-version:v2/test`, - method: `post`, - request: { - query: { - param: "baz", - }, - body: json({ - prop: "foo", - changedProp: "bar", - }), - }, - response: { - status: 200, - body: json({ prop: "foo", changedProp: "bar" }), - }, - kind: "MockApiDefinition", -}); diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyAsyncClient.java new file mode 100644 index 00000000000..60d52673c2b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyAsyncClient.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.apikey; + +import authentication.apikey.implementation.ApiKeyClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ApiKeyClient type. + */ +@ServiceClient(builder = ApiKeyClientBuilder.class, isAsync = true) +public final class ApiKeyAsyncClient { + @Generated + private final ApiKeyClientImpl serviceClient; + + /** + * Initializes an instance of ApiKeyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ApiKeyAsyncClient(ApiKeyClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validWithResponse(RequestOptions requestOptions) { + return this.serviceClient.validWithResponseAsync(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> invalidWithResponse(RequestOptions requestOptions) { + return this.serviceClient.invalidWithResponseAsync(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono valid() { + // Generated convenience method for validWithResponse + RequestOptions requestOptions = new RequestOptions(); + return validWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono invalid() { + // Generated convenience method for invalidWithResponse + RequestOptions requestOptions = new RequestOptions(); + return invalidWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClient.java new file mode 100644 index 00000000000..cfb5c1e5e03 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClient.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.apikey; + +import authentication.apikey.implementation.ApiKeyClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ApiKeyClient type. + */ +@ServiceClient(builder = ApiKeyClientBuilder.class) +public final class ApiKeyClient { + @Generated + private final ApiKeyClientImpl serviceClient; + + /** + * Initializes an instance of ApiKeyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ApiKeyClient(ApiKeyClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validWithResponse(RequestOptions requestOptions) { + return this.serviceClient.validWithResponse(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response invalidWithResponse(RequestOptions requestOptions) { + return this.serviceClient.invalidWithResponse(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void valid() { + // Generated convenience method for validWithResponse + RequestOptions requestOptions = new RequestOptions(); + validWithResponse(requestOptions).getValue(); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void invalid() { + // Generated convenience method for invalidWithResponse + RequestOptions requestOptions = new RequestOptions(); + invalidWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClientBuilder.java new file mode 100644 index 00000000000..4e53c7e847f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/ApiKeyClientBuilder.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.apikey; + +import authentication.apikey.implementation.ApiKeyClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.client.traits.KeyCredentialTrait; +import com.azure.core.credential.KeyCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.KeyCredentialPolicy; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ApiKeyClient type. + */ +@ServiceClientBuilder(serviceClients = { ApiKeyClient.class, ApiKeyAsyncClient.class }) +public final class ApiKeyClientBuilder + implements HttpTrait, ConfigurationTrait, + KeyCredentialTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("authentication-apikey.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ApiKeyClientBuilder. + */ + @Generated + public ApiKeyClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ApiKeyClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ApiKeyClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ApiKeyClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ApiKeyClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ApiKeyClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ApiKeyClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ApiKeyClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The KeyCredential used for authentication. + */ + @Generated + private KeyCredential keyCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ApiKeyClientBuilder credential(KeyCredential keyCredential) { + this.keyCredential = keyCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ApiKeyClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ApiKeyClientBuilder. + */ + @Generated + public ApiKeyClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ApiKeyClientImpl with the provided parameters. + * + * @return an instance of ApiKeyClientImpl. + */ + @Generated + private ApiKeyClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ApiKeyClientImpl client + = new ApiKeyClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + if (keyCredential != null) { + policies.add(new KeyCredentialPolicy("x-ms-api-key", keyCredential)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ApiKeyAsyncClient class. + * + * @return an instance of ApiKeyAsyncClient. + */ + @Generated + public ApiKeyAsyncClient buildAsyncClient() { + return new ApiKeyAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ApiKeyClient class. + * + * @return an instance of ApiKeyClient. + */ + @Generated + public ApiKeyClient buildClient() { + return new ApiKeyClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ApiKeyClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java new file mode 100644 index 00000000000..404e09eca33 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.apikey.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ApiKeyClient type. + */ +public final class ApiKeyClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ApiKeyClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of ApiKeyClient client. + * + * @param endpoint Service host. + */ + public ApiKeyClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ApiKeyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ApiKeyClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ApiKeyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ApiKeyClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(ApiKeyClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ApiKeyClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ApiKeyClient") + public interface ApiKeyClientService { + @Get("/authentication/api-key/valid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> valid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/authentication/api-key/valid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response validSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/authentication/api-key/invalid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> invalid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/authentication/api-key/invalid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response invalidSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.valid(this.getEndpoint(), requestOptions, context)); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validWithResponse(RequestOptions requestOptions) { + return service.validSync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> invalidWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.invalid(this.getEndpoint(), requestOptions, context)); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response invalidWithResponse(RequestOptions requestOptions) { + return service.invalidSync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/package-info.java new file mode 100644 index 00000000000..e645e8e6d3d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ApiKey. + * Illustrates clients generated with ApiKey authentication. + * + */ +package authentication.apikey.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/package-info.java new file mode 100644 index 00000000000..b83288c26de --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/apikey/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ApiKey. + * Illustrates clients generated with ApiKey authentication. + * + */ +package authentication.apikey; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomAsyncClient.java new file mode 100644 index 00000000000..dacdf449df5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomAsyncClient.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.http.custom; + +import authentication.http.custom.implementation.CustomClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous CustomClient type. + */ +@ServiceClient(builder = CustomClientBuilder.class, isAsync = true) +public final class CustomAsyncClient { + @Generated + private final CustomClientImpl serviceClient; + + /** + * Initializes an instance of CustomAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CustomAsyncClient(CustomClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validWithResponse(RequestOptions requestOptions) { + return this.serviceClient.validWithResponseAsync(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> invalidWithResponse(RequestOptions requestOptions) { + return this.serviceClient.invalidWithResponseAsync(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono valid() { + // Generated convenience method for validWithResponse + RequestOptions requestOptions = new RequestOptions(); + return validWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono invalid() { + // Generated convenience method for invalidWithResponse + RequestOptions requestOptions = new RequestOptions(); + return invalidWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClient.java new file mode 100644 index 00000000000..608e2ada8b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClient.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.http.custom; + +import authentication.http.custom.implementation.CustomClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous CustomClient type. + */ +@ServiceClient(builder = CustomClientBuilder.class) +public final class CustomClient { + @Generated + private final CustomClientImpl serviceClient; + + /** + * Initializes an instance of CustomClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CustomClient(CustomClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validWithResponse(RequestOptions requestOptions) { + return this.serviceClient.validWithResponse(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response invalidWithResponse(RequestOptions requestOptions) { + return this.serviceClient.invalidWithResponse(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void valid() { + // Generated convenience method for validWithResponse + RequestOptions requestOptions = new RequestOptions(); + validWithResponse(requestOptions).getValue(); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void invalid() { + // Generated convenience method for invalidWithResponse + RequestOptions requestOptions = new RequestOptions(); + invalidWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClientBuilder.java new file mode 100644 index 00000000000..3dce343176f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/CustomClientBuilder.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.http.custom; + +import authentication.http.custom.implementation.CustomClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.client.traits.KeyCredentialTrait; +import com.azure.core.credential.KeyCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.KeyCredentialPolicy; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the CustomClient type. + */ +@ServiceClientBuilder(serviceClients = { CustomClient.class, CustomAsyncClient.class }) +public final class CustomClientBuilder + implements HttpTrait, ConfigurationTrait, + KeyCredentialTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("authentication-http-custom.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the CustomClientBuilder. + */ + @Generated + public CustomClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CustomClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CustomClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CustomClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CustomClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CustomClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CustomClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CustomClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The KeyCredential used for authentication. + */ + @Generated + private KeyCredential keyCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CustomClientBuilder credential(KeyCredential keyCredential) { + this.keyCredential = keyCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CustomClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the CustomClientBuilder. + */ + @Generated + public CustomClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of CustomClientImpl with the provided parameters. + * + * @return an instance of CustomClientImpl. + */ + @Generated + private CustomClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + CustomClientImpl client + = new CustomClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + if (keyCredential != null) { + policies.add(new KeyCredentialPolicy("authorization", keyCredential, "SharedAccessKey")); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of CustomAsyncClient class. + * + * @return an instance of CustomAsyncClient. + */ + @Generated + public CustomAsyncClient buildAsyncClient() { + return new CustomAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of CustomClient class. + * + * @return an instance of CustomClient. + */ + @Generated + public CustomClient buildClient() { + return new CustomClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(CustomClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/CustomClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/CustomClientImpl.java new file mode 100644 index 00000000000..040adf1b5f3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/CustomClientImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.http.custom.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the CustomClient type. + */ +public final class CustomClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final CustomClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of CustomClient client. + * + * @param endpoint Service host. + */ + public CustomClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of CustomClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public CustomClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of CustomClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public CustomClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(CustomClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for CustomClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CustomClient") + public interface CustomClientService { + @Get("/authentication/http/custom/valid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> valid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/authentication/http/custom/valid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response validSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/authentication/http/custom/invalid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> invalid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/authentication/http/custom/invalid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response invalidSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.valid(this.getEndpoint(), requestOptions, context)); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validWithResponse(RequestOptions requestOptions) { + return service.validSync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> invalidWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.invalid(this.getEndpoint(), requestOptions, context)); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response invalidWithResponse(RequestOptions requestOptions) { + return service.invalidSync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/package-info.java new file mode 100644 index 00000000000..2d75758fa57 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Custom. + * Illustrates clients generated with generic HTTP auth. + * + */ +package authentication.http.custom.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/package-info.java new file mode 100644 index 00000000000..449090f6e8d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/http/custom/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Custom. + * Illustrates clients generated with generic HTTP auth. + * + */ +package authentication.http.custom; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2AsyncClient.java new file mode 100644 index 00000000000..c7fa3bf6632 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2AsyncClient.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.oauth2; + +import authentication.oauth2.implementation.OAuth2ClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous OAuth2Client type. + */ +@ServiceClient(builder = OAuth2ClientBuilder.class, isAsync = true) +public final class OAuth2AsyncClient { + @Generated + private final OAuth2ClientImpl serviceClient; + + /** + * Initializes an instance of OAuth2AsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + OAuth2AsyncClient(OAuth2ClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validWithResponse(RequestOptions requestOptions) { + return this.serviceClient.validWithResponseAsync(requestOptions); + } + + /** + * Check whether client is authenticated. Will return an invalid bearer error. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> invalidWithResponse(RequestOptions requestOptions) { + return this.serviceClient.invalidWithResponseAsync(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono valid() { + // Generated convenience method for validWithResponse + RequestOptions requestOptions = new RequestOptions(); + return validWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Check whether client is authenticated. Will return an invalid bearer error. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono invalid() { + // Generated convenience method for invalidWithResponse + RequestOptions requestOptions = new RequestOptions(); + return invalidWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2Client.java new file mode 100644 index 00000000000..f9eb53cddc9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2Client.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.oauth2; + +import authentication.oauth2.implementation.OAuth2ClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous OAuth2Client type. + */ +@ServiceClient(builder = OAuth2ClientBuilder.class) +public final class OAuth2Client { + @Generated + private final OAuth2ClientImpl serviceClient; + + /** + * Initializes an instance of OAuth2Client class. + * + * @param serviceClient the service client implementation. + */ + @Generated + OAuth2Client(OAuth2ClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validWithResponse(RequestOptions requestOptions) { + return this.serviceClient.validWithResponse(requestOptions); + } + + /** + * Check whether client is authenticated. Will return an invalid bearer error. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response invalidWithResponse(RequestOptions requestOptions) { + return this.serviceClient.invalidWithResponse(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void valid() { + // Generated convenience method for validWithResponse + RequestOptions requestOptions = new RequestOptions(); + validWithResponse(requestOptions).getValue(); + } + + /** + * Check whether client is authenticated. Will return an invalid bearer error. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void invalid() { + // Generated convenience method for invalidWithResponse + RequestOptions requestOptions = new RequestOptions(); + invalidWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2ClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2ClientBuilder.java new file mode 100644 index 00000000000..24fb716a6a4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/OAuth2ClientBuilder.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.oauth2; + +import authentication.oauth2.implementation.OAuth2ClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.client.traits.TokenCredentialTrait; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the OAuth2Client type. + */ +@ServiceClientBuilder(serviceClients = { OAuth2Client.class, OAuth2AsyncClient.class }) +public final class OAuth2ClientBuilder + implements HttpTrait, ConfigurationTrait, + TokenCredentialTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final String[] DEFAULT_SCOPES = new String[] { "https://security.microsoft.com/.default" }; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("authentication-oauth2.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the OAuth2ClientBuilder. + */ + @Generated + public OAuth2ClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OAuth2ClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OAuth2ClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OAuth2ClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OAuth2ClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OAuth2ClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OAuth2ClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OAuth2ClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The TokenCredential used for authentication. + */ + @Generated + private TokenCredential tokenCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OAuth2ClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OAuth2ClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the OAuth2ClientBuilder. + */ + @Generated + public OAuth2ClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of OAuth2ClientImpl with the provided parameters. + * + * @return an instance of OAuth2ClientImpl. + */ + @Generated + private OAuth2ClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + OAuth2ClientImpl client + = new OAuth2ClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of OAuth2AsyncClient class. + * + * @return an instance of OAuth2AsyncClient. + */ + @Generated + public OAuth2AsyncClient buildAsyncClient() { + return new OAuth2AsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of OAuth2Client class. + * + * @return an instance of OAuth2Client. + */ + @Generated + public OAuth2Client buildClient() { + return new OAuth2Client(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(OAuth2ClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/OAuth2ClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/OAuth2ClientImpl.java new file mode 100644 index 00000000000..3c182019e1d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/OAuth2ClientImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.oauth2.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the OAuth2Client type. + */ +public final class OAuth2ClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final OAuth2ClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of OAuth2Client client. + * + * @param endpoint Service host. + */ + public OAuth2ClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of OAuth2Client client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public OAuth2ClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of OAuth2Client client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public OAuth2ClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(OAuth2ClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for OAuth2Client to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OAuth2Client") + public interface OAuth2ClientService { + @Get("/authentication/oauth2/valid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> valid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/authentication/oauth2/valid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response validSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/authentication/oauth2/invalid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> invalid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/authentication/oauth2/invalid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response invalidSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.valid(this.getEndpoint(), requestOptions, context)); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validWithResponse(RequestOptions requestOptions) { + return service.validSync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * Check whether client is authenticated. Will return an invalid bearer error. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> invalidWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.invalid(this.getEndpoint(), requestOptions, context)); + } + + /** + * Check whether client is authenticated. Will return an invalid bearer error. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response invalidWithResponse(RequestOptions requestOptions) { + return service.invalidSync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/package-info.java new file mode 100644 index 00000000000..0e2e4513a2f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for OAuth2. + * Illustrates clients generated with OAuth2 authentication. + * + */ +package authentication.oauth2.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/package-info.java new file mode 100644 index 00000000000..d401e7ffaba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/oauth2/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for OAuth2. + * Illustrates clients generated with OAuth2 authentication. + * + */ +package authentication.oauth2; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionAsyncClient.java new file mode 100644 index 00000000000..cbbf2f81c74 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionAsyncClient.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.union; + +import authentication.union.implementation.UnionClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) +public final class UnionAsyncClient { + @Generated + private final UnionClientImpl serviceClient; + + /** + * Initializes an instance of UnionAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionAsyncClient(UnionClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validKeyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.validKeyWithResponseAsync(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validTokenWithResponse(RequestOptions requestOptions) { + return this.serviceClient.validTokenWithResponseAsync(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono validKey() { + // Generated convenience method for validKeyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return validKeyWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono validToken() { + // Generated convenience method for validTokenWithResponse + RequestOptions requestOptions = new RequestOptions(); + return validTokenWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClient.java new file mode 100644 index 00000000000..8bd5ba11689 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClient.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.union; + +import authentication.union.implementation.UnionClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class) +public final class UnionClient { + @Generated + private final UnionClientImpl serviceClient; + + /** + * Initializes an instance of UnionClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionClient(UnionClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validKeyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.validKeyWithResponse(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validTokenWithResponse(RequestOptions requestOptions) { + return this.serviceClient.validTokenWithResponse(requestOptions); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void validKey() { + // Generated convenience method for validKeyWithResponse + RequestOptions requestOptions = new RequestOptions(); + validKeyWithResponse(requestOptions).getValue(); + } + + /** + * Check whether client is authenticated. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void validToken() { + // Generated convenience method for validTokenWithResponse + RequestOptions requestOptions = new RequestOptions(); + validTokenWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClientBuilder.java new file mode 100644 index 00000000000..f7726517bca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/UnionClientBuilder.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.union; + +import authentication.union.implementation.UnionClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.client.traits.KeyCredentialTrait; +import com.azure.core.client.traits.TokenCredentialTrait; +import com.azure.core.credential.KeyCredential; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.KeyCredentialPolicy; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the UnionClient type. + */ +@ServiceClientBuilder(serviceClients = { UnionClient.class, UnionAsyncClient.class }) +public final class UnionClientBuilder implements HttpTrait, ConfigurationTrait, + TokenCredentialTrait, KeyCredentialTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final String[] DEFAULT_SCOPES = new String[] { "https://security.microsoft.com/.default" }; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("authentication-union.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the UnionClientBuilder. + */ + @Generated + public UnionClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The TokenCredential used for authentication. + */ + @Generated + private TokenCredential tokenCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } + + /* + * The KeyCredential used for authentication. + */ + @Generated + private KeyCredential keyCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder credential(KeyCredential keyCredential) { + this.keyCredential = keyCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the UnionClientBuilder. + */ + @Generated + public UnionClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of UnionClientImpl with the provided parameters. + * + * @return an instance of UnionClientImpl. + */ + @Generated + private UnionClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + UnionClientImpl client + = new UnionClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + if (keyCredential != null) { + policies.add(new KeyCredentialPolicy("x-ms-api-key", keyCredential)); + } + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of UnionAsyncClient class. + * + * @return an instance of UnionAsyncClient. + */ + @Generated + public UnionAsyncClient buildAsyncClient() { + return new UnionAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of UnionClient class. + * + * @return an instance of UnionClient. + */ + @Generated + public UnionClient buildClient() { + return new UnionClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(UnionClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/UnionClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/UnionClientImpl.java new file mode 100644 index 00000000000..846b942b491 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/UnionClientImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.union.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the UnionClient type. + */ +public final class UnionClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnionClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of UnionClient client. + * + * @param endpoint Service host. + */ + public UnionClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of UnionClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public UnionClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of UnionClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public UnionClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(UnionClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for UnionClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UnionClient") + public interface UnionClientService { + @Get("/authentication/union/validkey") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> validKey(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/authentication/union/validkey") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response validKeySync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/authentication/union/validtoken") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> validToken(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/authentication/union/validtoken") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response validTokenSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validKeyWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.validKey(this.getEndpoint(), requestOptions, context)); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validKeyWithResponse(RequestOptions requestOptions) { + return service.validKeySync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validTokenWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.validToken(this.getEndpoint(), requestOptions, context)); + } + + /** + * Check whether client is authenticated. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validTokenWithResponse(RequestOptions requestOptions) { + return service.validTokenSync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/package-info.java new file mode 100644 index 00000000000..02dbb0277f9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Union. + * Illustrates clients generated with ApiKey and OAuth2 authentication. + * + */ +package authentication.union.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/package-info.java new file mode 100644 index 00000000000..090b0c5f393 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/authentication/union/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Union. + * Illustrates clients generated with ApiKey and OAuth2 authentication. + * + */ +package authentication.union; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/AccessClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/AccessClientBuilder.java new file mode 100644 index 00000000000..760c951a8d3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/AccessClientBuilder.java @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access; + +import azure.clientgenerator.core.access.implementation.AccessClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the AccessClient type. + */ +@ServiceClientBuilder( + serviceClients = { + PublicOperationClient.class, + InternalOperationClient.class, + SharedModelInOperationClient.class, + RelativeModelInOperationClient.class, + PublicOperationAsyncClient.class, + InternalOperationAsyncClient.class, + SharedModelInOperationAsyncClient.class, + RelativeModelInOperationAsyncClient.class }) +public final class AccessClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-access.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the AccessClientBuilder. + */ + @Generated + public AccessClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AccessClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AccessClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AccessClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AccessClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AccessClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AccessClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AccessClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AccessClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the AccessClientBuilder. + */ + @Generated + public AccessClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of AccessClientImpl with the provided parameters. + * + * @return an instance of AccessClientImpl. + */ + @Generated + private AccessClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + AccessClientImpl client + = new AccessClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of PublicOperationAsyncClient class. + * + * @return an instance of PublicOperationAsyncClient. + */ + @Generated + public PublicOperationAsyncClient buildPublicOperationAsyncClient() { + return new PublicOperationAsyncClient(buildInnerClient().getPublicOperations()); + } + + /** + * Builds an instance of InternalOperationAsyncClient class. + * + * @return an instance of InternalOperationAsyncClient. + */ + @Generated + public InternalOperationAsyncClient buildInternalOperationAsyncClient() { + return new InternalOperationAsyncClient(buildInnerClient().getInternalOperations()); + } + + /** + * Builds an instance of SharedModelInOperationAsyncClient class. + * + * @return an instance of SharedModelInOperationAsyncClient. + */ + @Generated + public SharedModelInOperationAsyncClient buildSharedModelInOperationAsyncClient() { + return new SharedModelInOperationAsyncClient(buildInnerClient().getSharedModelInOperations()); + } + + /** + * Builds an instance of RelativeModelInOperationAsyncClient class. + * + * @return an instance of RelativeModelInOperationAsyncClient. + */ + @Generated + public RelativeModelInOperationAsyncClient buildRelativeModelInOperationAsyncClient() { + return new RelativeModelInOperationAsyncClient(buildInnerClient().getRelativeModelInOperations()); + } + + /** + * Builds an instance of PublicOperationClient class. + * + * @return an instance of PublicOperationClient. + */ + @Generated + public PublicOperationClient buildPublicOperationClient() { + return new PublicOperationClient(buildInnerClient().getPublicOperations()); + } + + /** + * Builds an instance of InternalOperationClient class. + * + * @return an instance of InternalOperationClient. + */ + @Generated + public InternalOperationClient buildInternalOperationClient() { + return new InternalOperationClient(buildInnerClient().getInternalOperations()); + } + + /** + * Builds an instance of SharedModelInOperationClient class. + * + * @return an instance of SharedModelInOperationClient. + */ + @Generated + public SharedModelInOperationClient buildSharedModelInOperationClient() { + return new SharedModelInOperationClient(buildInnerClient().getSharedModelInOperations()); + } + + /** + * Builds an instance of RelativeModelInOperationClient class. + * + * @return an instance of RelativeModelInOperationClient. + */ + @Generated + public RelativeModelInOperationClient buildRelativeModelInOperationClient() { + return new RelativeModelInOperationClient(buildInnerClient().getRelativeModelInOperations()); + } + + private static final ClientLogger LOGGER = new ClientLogger(AccessClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationAsyncClient.java new file mode 100644 index 00000000000..aa84b8c985b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationAsyncClient.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access; + +import azure.clientgenerator.core.access.implementation.InternalOperationsImpl; +import azure.clientgenerator.core.access.internaloperation.implementation.models.InternalDecoratorModelInInternal; +import azure.clientgenerator.core.access.internaloperation.implementation.models.NoDecoratorModelInInternal; +import azure.clientgenerator.core.access.internaloperation.models.PublicDecoratorModelInInternal; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous AccessClient type. + */ +@ServiceClient(builder = AccessClientBuilder.class, isAsync = true) +public final class InternalOperationAsyncClient { + @Generated + private final InternalOperationsImpl serviceClient; + + /** + * Initializes an instance of InternalOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + InternalOperationAsyncClient(InternalOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The noDecoratorInInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in an internal operation, should be generated but not exported along with {@link Response} on + * successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> noDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.noDecoratorInInternalWithResponseAsync(name, requestOptions); + } + + /** + * The internalDecoratorInInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in an internal operation, should be generated but not exported along with {@link Response} on + * successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> internalDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.internalDecoratorInInternalWithResponseAsync(name, requestOptions); + } + + /** + * The publicDecoratorInInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in an internal operation but with public decorator, should be generated and exported along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> publicDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.publicDecoratorInInternalWithResponseAsync(name, requestOptions); + } + + /** + * The noDecoratorInInternal operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in an internal operation, should be generated but not exported on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono noDecoratorInInternal(String name) { + // Generated convenience method for noDecoratorInInternalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return noDecoratorInInternalWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(NoDecoratorModelInInternal.class)); + } + + /** + * The internalDecoratorInInternal operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in an internal operation, should be generated but not exported on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono internalDecoratorInInternal(String name) { + // Generated convenience method for internalDecoratorInInternalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return internalDecoratorInInternalWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(InternalDecoratorModelInInternal.class)); + } + + /** + * The publicDecoratorInInternal operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in an internal operation but with public decorator, should be generated and exported on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono publicDecoratorInInternal(String name) { + // Generated convenience method for publicDecoratorInInternalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return publicDecoratorInInternalWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PublicDecoratorModelInInternal.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationClient.java new file mode 100644 index 00000000000..034879644d8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/InternalOperationClient.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access; + +import azure.clientgenerator.core.access.implementation.InternalOperationsImpl; +import azure.clientgenerator.core.access.internaloperation.implementation.models.InternalDecoratorModelInInternal; +import azure.clientgenerator.core.access.internaloperation.implementation.models.NoDecoratorModelInInternal; +import azure.clientgenerator.core.access.internaloperation.models.PublicDecoratorModelInInternal; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous AccessClient type. + */ +@ServiceClient(builder = AccessClientBuilder.class) +public final class InternalOperationClient { + @Generated + private final InternalOperationsImpl serviceClient; + + /** + * Initializes an instance of InternalOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + InternalOperationClient(InternalOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The noDecoratorInInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in an internal operation, should be generated but not exported along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response noDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.noDecoratorInInternalWithResponse(name, requestOptions); + } + + /** + * The internalDecoratorInInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in an internal operation, should be generated but not exported along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response internalDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.internalDecoratorInInternalWithResponse(name, requestOptions); + } + + /** + * The publicDecoratorInInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in an internal operation but with public decorator, should be generated and exported along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response publicDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.publicDecoratorInInternalWithResponse(name, requestOptions); + } + + /** + * The noDecoratorInInternal operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in an internal operation, should be generated but not exported. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + NoDecoratorModelInInternal noDecoratorInInternal(String name) { + // Generated convenience method for noDecoratorInInternalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return noDecoratorInInternalWithResponse(name, requestOptions).getValue() + .toObject(NoDecoratorModelInInternal.class); + } + + /** + * The internalDecoratorInInternal operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in an internal operation, should be generated but not exported. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + InternalDecoratorModelInInternal internalDecoratorInInternal(String name) { + // Generated convenience method for internalDecoratorInInternalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return internalDecoratorInInternalWithResponse(name, requestOptions).getValue() + .toObject(InternalDecoratorModelInInternal.class); + } + + /** + * The publicDecoratorInInternal operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in an internal operation but with public decorator, should be generated and exported. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + PublicDecoratorModelInInternal publicDecoratorInInternal(String name) { + // Generated convenience method for publicDecoratorInInternalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return publicDecoratorInInternalWithResponse(name, requestOptions).getValue() + .toObject(PublicDecoratorModelInInternal.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationAsyncClient.java new file mode 100644 index 00000000000..3d3eacf5312 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationAsyncClient.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access; + +import azure.clientgenerator.core.access.implementation.PublicOperationsImpl; +import azure.clientgenerator.core.access.publicoperation.models.NoDecoratorModelInPublic; +import azure.clientgenerator.core.access.publicoperation.models.PublicDecoratorModelInPublic; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous AccessClient type. + */ +@ServiceClient(builder = AccessClientBuilder.class, isAsync = true) +public final class PublicOperationAsyncClient { + @Generated + private final PublicOperationsImpl serviceClient; + + /** + * Initializes an instance of PublicOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PublicOperationAsyncClient(PublicOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The noDecoratorInPublic operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in a public operation, should be generated and exported along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> noDecoratorInPublicWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.noDecoratorInPublicWithResponseAsync(name, requestOptions); + } + + /** + * The publicDecoratorInPublic operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in a public operation, should be generated and exported along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> publicDecoratorInPublicWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.publicDecoratorInPublicWithResponseAsync(name, requestOptions); + } + + /** + * The noDecoratorInPublic operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in a public operation, should be generated and exported on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono noDecoratorInPublic(String name) { + // Generated convenience method for noDecoratorInPublicWithResponse + RequestOptions requestOptions = new RequestOptions(); + return noDecoratorInPublicWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(NoDecoratorModelInPublic.class)); + } + + /** + * The publicDecoratorInPublic operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in a public operation, should be generated and exported on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono publicDecoratorInPublic(String name) { + // Generated convenience method for publicDecoratorInPublicWithResponse + RequestOptions requestOptions = new RequestOptions(); + return publicDecoratorInPublicWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PublicDecoratorModelInPublic.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationClient.java new file mode 100644 index 00000000000..66d89e302e8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/PublicOperationClient.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access; + +import azure.clientgenerator.core.access.implementation.PublicOperationsImpl; +import azure.clientgenerator.core.access.publicoperation.models.NoDecoratorModelInPublic; +import azure.clientgenerator.core.access.publicoperation.models.PublicDecoratorModelInPublic; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous AccessClient type. + */ +@ServiceClient(builder = AccessClientBuilder.class) +public final class PublicOperationClient { + @Generated + private final PublicOperationsImpl serviceClient; + + /** + * Initializes an instance of PublicOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PublicOperationClient(PublicOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The noDecoratorInPublic operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in a public operation, should be generated and exported along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response noDecoratorInPublicWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.noDecoratorInPublicWithResponse(name, requestOptions); + } + + /** + * The publicDecoratorInPublic operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in a public operation, should be generated and exported along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response publicDecoratorInPublicWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.publicDecoratorInPublicWithResponse(name, requestOptions); + } + + /** + * The noDecoratorInPublic operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in a public operation, should be generated and exported. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public NoDecoratorModelInPublic noDecoratorInPublic(String name) { + // Generated convenience method for noDecoratorInPublicWithResponse + RequestOptions requestOptions = new RequestOptions(); + return noDecoratorInPublicWithResponse(name, requestOptions).getValue() + .toObject(NoDecoratorModelInPublic.class); + } + + /** + * The publicDecoratorInPublic operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in a public operation, should be generated and exported. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PublicDecoratorModelInPublic publicDecoratorInPublic(String name) { + // Generated convenience method for publicDecoratorInPublicWithResponse + RequestOptions requestOptions = new RequestOptions(); + return publicDecoratorInPublicWithResponse(name, requestOptions).getValue() + .toObject(PublicDecoratorModelInPublic.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationAsyncClient.java new file mode 100644 index 00000000000..a31185d7e0a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationAsyncClient.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access; + +import azure.clientgenerator.core.access.implementation.RelativeModelInOperationsImpl; +import azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.AbstractModel; +import azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.OuterModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous AccessClient type. + */ +@ServiceClient(builder = AccessClientBuilder.class, isAsync = true) +public final class RelativeModelInOperationAsyncClient { + @Generated + private final RelativeModelInOperationsImpl serviceClient; + + /** + * Initializes an instance of RelativeModelInOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RelativeModelInOperationAsyncClient(RelativeModelInOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Expected query parameter: name="Madge" + * Expected response body: + * ```json + * { + * "name": "Madge", + * "inner": + * { + * "name": "Madge" + * } + * } + * ```. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     inner (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in internal operations, should be generated but not exported along with {@link Response} on + * successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> operationWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.operationWithResponseAsync(name, requestOptions); + } + + /** + * Expected query parameter: kind="real" + * Expected response body: + * ```json + * { + * "name": "Madge", + * "kind": "real" + * } + * ```. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param kind The kind parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in internal operations, should be generated but not exported along with {@link Response} on + * successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> discriminatorWithResponse(String kind, RequestOptions requestOptions) { + return this.serviceClient.discriminatorWithResponseAsync(kind, requestOptions); + } + + /** + * Expected query parameter: name="Madge" + * Expected response body: + * ```json + * { + * "name": "Madge", + * "inner": + * { + * "name": "Madge" + * } + * } + * ```. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in internal operations, should be generated but not exported on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono operation(String name) { + // Generated convenience method for operationWithResponse + RequestOptions requestOptions = new RequestOptions(); + return operationWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OuterModel.class)); + } + + /** + * Expected query parameter: kind="real" + * Expected response body: + * ```json + * { + * "name": "Madge", + * "kind": "real" + * } + * ```. + * + * @param kind The kind parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in internal operations, should be generated but not exported on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono discriminator(String kind) { + // Generated convenience method for discriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return discriminatorWithResponse(kind, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AbstractModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationClient.java new file mode 100644 index 00000000000..b584e546456 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationClient.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access; + +import azure.clientgenerator.core.access.implementation.RelativeModelInOperationsImpl; +import azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.AbstractModel; +import azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.OuterModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous AccessClient type. + */ +@ServiceClient(builder = AccessClientBuilder.class) +public final class RelativeModelInOperationClient { + @Generated + private final RelativeModelInOperationsImpl serviceClient; + + /** + * Initializes an instance of RelativeModelInOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RelativeModelInOperationClient(RelativeModelInOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Expected query parameter: name="Madge" + * Expected response body: + * ```json + * { + * "name": "Madge", + * "inner": + * { + * "name": "Madge" + * } + * } + * ```. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     inner (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in internal operations, should be generated but not exported along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response operationWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.operationWithResponse(name, requestOptions); + } + + /** + * Expected query parameter: kind="real" + * Expected response body: + * ```json + * { + * "name": "Madge", + * "kind": "real" + * } + * ```. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param kind The kind parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in internal operations, should be generated but not exported along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response discriminatorWithResponse(String kind, RequestOptions requestOptions) { + return this.serviceClient.discriminatorWithResponse(kind, requestOptions); + } + + /** + * Expected query parameter: name="Madge" + * Expected response body: + * ```json + * { + * "name": "Madge", + * "inner": + * { + * "name": "Madge" + * } + * } + * ```. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in internal operations, should be generated but not exported. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + OuterModel operation(String name) { + // Generated convenience method for operationWithResponse + RequestOptions requestOptions = new RequestOptions(); + return operationWithResponse(name, requestOptions).getValue().toObject(OuterModel.class); + } + + /** + * Expected query parameter: kind="real" + * Expected response body: + * ```json + * { + * "name": "Madge", + * "kind": "real" + * } + * ```. + * + * @param kind The kind parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used in internal operations, should be generated but not exported. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + AbstractModel discriminator(String kind) { + // Generated convenience method for discriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return discriminatorWithResponse(kind, requestOptions).getValue().toObject(AbstractModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationAsyncClient.java new file mode 100644 index 00000000000..f6e574f8e2c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access; + +import azure.clientgenerator.core.access.implementation.SharedModelInOperationsImpl; +import azure.clientgenerator.core.access.sharedmodelinoperation.models.SharedModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous AccessClient type. + */ +@ServiceClient(builder = AccessClientBuilder.class, isAsync = true) +public final class SharedModelInOperationAsyncClient { + @Generated + private final SharedModelInOperationsImpl serviceClient; + + /** + * Initializes an instance of SharedModelInOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SharedModelInOperationAsyncClient(SharedModelInOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The publicMethod operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used by both public and internal operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> publicMethodWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.publicMethodWithResponseAsync(name, requestOptions); + } + + /** + * The internal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used by both public and internal operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> internalWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.internalWithResponseAsync(name, requestOptions); + } + + /** + * The publicMethod operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used by both public and internal operation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono publicMethod(String name) { + // Generated convenience method for publicMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return publicMethodWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SharedModel.class)); + } + + /** + * The internal operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used by both public and internal operation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono internal(String name) { + // Generated convenience method for internalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return internalWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SharedModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationClient.java new file mode 100644 index 00000000000..b46aea36681 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/SharedModelInOperationClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access; + +import azure.clientgenerator.core.access.implementation.SharedModelInOperationsImpl; +import azure.clientgenerator.core.access.sharedmodelinoperation.models.SharedModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous AccessClient type. + */ +@ServiceClient(builder = AccessClientBuilder.class) +public final class SharedModelInOperationClient { + @Generated + private final SharedModelInOperationsImpl serviceClient; + + /** + * Initializes an instance of SharedModelInOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SharedModelInOperationClient(SharedModelInOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The publicMethod operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used by both public and internal operation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response publicMethodWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.publicMethodWithResponse(name, requestOptions); + } + + /** + * The internal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used by both public and internal operation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response internalWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.internalWithResponse(name, requestOptions); + } + + /** + * The publicMethod operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used by both public and internal operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SharedModel publicMethod(String name) { + // Generated convenience method for publicMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return publicMethodWithResponse(name, requestOptions).getValue().toObject(SharedModel.class); + } + + /** + * The internal operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return used by both public and internal operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + SharedModel internal(String name) { + // Generated convenience method for internalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return internalWithResponse(name, requestOptions).getValue().toObject(SharedModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/AccessClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/AccessClientImpl.java new file mode 100644 index 00000000000..c0bf3320c78 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/AccessClientImpl.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 AccessClient type. + */ +public final class AccessClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 PublicOperationsImpl object to access its operations. + */ + private final PublicOperationsImpl publicOperations; + + /** + * Gets the PublicOperationsImpl object to access its operations. + * + * @return the PublicOperationsImpl object. + */ + public PublicOperationsImpl getPublicOperations() { + return this.publicOperations; + } + + /** + * The InternalOperationsImpl object to access its operations. + */ + private final InternalOperationsImpl internalOperations; + + /** + * Gets the InternalOperationsImpl object to access its operations. + * + * @return the InternalOperationsImpl object. + */ + public InternalOperationsImpl getInternalOperations() { + return this.internalOperations; + } + + /** + * The SharedModelInOperationsImpl object to access its operations. + */ + private final SharedModelInOperationsImpl sharedModelInOperations; + + /** + * Gets the SharedModelInOperationsImpl object to access its operations. + * + * @return the SharedModelInOperationsImpl object. + */ + public SharedModelInOperationsImpl getSharedModelInOperations() { + return this.sharedModelInOperations; + } + + /** + * The RelativeModelInOperationsImpl object to access its operations. + */ + private final RelativeModelInOperationsImpl relativeModelInOperations; + + /** + * Gets the RelativeModelInOperationsImpl object to access its operations. + * + * @return the RelativeModelInOperationsImpl object. + */ + public RelativeModelInOperationsImpl getRelativeModelInOperations() { + return this.relativeModelInOperations; + } + + /** + * Initializes an instance of AccessClient client. + * + * @param endpoint Service host. + */ + public AccessClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of AccessClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public AccessClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of AccessClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public AccessClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.publicOperations = new PublicOperationsImpl(this); + this.internalOperations = new InternalOperationsImpl(this); + this.sharedModelInOperations = new SharedModelInOperationsImpl(this); + this.relativeModelInOperations = new RelativeModelInOperationsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/InternalOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/InternalOperationsImpl.java new file mode 100644 index 00000000000..0c196872d31 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/InternalOperationsImpl.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in InternalOperations. + */ +public final class InternalOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final InternalOperationsService service; + + /** + * The service client containing this operation class. + */ + private final AccessClientImpl client; + + /** + * Initializes an instance of InternalOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InternalOperationsImpl(AccessClientImpl client) { + this.service = RestProxy.create(InternalOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AccessClientInternalOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AccessClientInternalOperations") + public interface InternalOperationsService { + @Get("/azure/client-generator-core/access/internalOperation/noDecoratorInInternal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> noDecoratorInInternal(@HostParam("endpoint") String endpoint, + @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/access/internalOperation/noDecoratorInInternal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response noDecoratorInInternalSync(@HostParam("endpoint") String endpoint, + @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/access/internalOperation/internalDecoratorInInternal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> internalDecoratorInInternal(@HostParam("endpoint") String endpoint, + @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/access/internalOperation/internalDecoratorInInternal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response internalDecoratorInInternalSync(@HostParam("endpoint") String endpoint, + @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/access/internalOperation/publicDecoratorInInternal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> publicDecoratorInInternal(@HostParam("endpoint") String endpoint, + @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/access/internalOperation/publicDecoratorInInternal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response publicDecoratorInInternalSync(@HostParam("endpoint") String endpoint, + @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * The noDecoratorInInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in an internal operation, should be generated but not exported along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> noDecoratorInInternalWithResponseAsync(String name, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.noDecoratorInInternal(this.client.getEndpoint(), name, accept, requestOptions, context)); + } + + /** + * The noDecoratorInInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in an internal operation, should be generated but not exported along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response noDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.noDecoratorInInternalSync(this.client.getEndpoint(), name, accept, requestOptions, Context.NONE); + } + + /** + * The internalDecoratorInInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in an internal operation, should be generated but not exported along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> internalDecoratorInInternalWithResponseAsync(String name, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.internalDecoratorInInternal(this.client.getEndpoint(), name, + accept, requestOptions, context)); + } + + /** + * The internalDecoratorInInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in an internal operation, should be generated but not exported along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response internalDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.internalDecoratorInInternalSync(this.client.getEndpoint(), name, accept, requestOptions, + Context.NONE); + } + + /** + * The publicDecoratorInInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in an internal operation but with public decorator, should be generated and exported along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> publicDecoratorInInternalWithResponseAsync(String name, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.publicDecoratorInInternal(this.client.getEndpoint(), name, + accept, requestOptions, context)); + } + + /** + * The publicDecoratorInInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in an internal operation but with public decorator, should be generated and exported along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response publicDecoratorInInternalWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.publicDecoratorInInternalSync(this.client.getEndpoint(), name, accept, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/PublicOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/PublicOperationsImpl.java new file mode 100644 index 00000000000..68af0c4ca68 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/PublicOperationsImpl.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PublicOperations. + */ +public final class PublicOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PublicOperationsService service; + + /** + * The service client containing this operation class. + */ + private final AccessClientImpl client; + + /** + * Initializes an instance of PublicOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PublicOperationsImpl(AccessClientImpl client) { + this.service + = RestProxy.create(PublicOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AccessClientPublicOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AccessClientPublicOperations") + public interface PublicOperationsService { + @Get("/azure/client-generator-core/access/publicOperation/noDecoratorInPublic") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> noDecoratorInPublic(@HostParam("endpoint") String endpoint, + @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/access/publicOperation/noDecoratorInPublic") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response noDecoratorInPublicSync(@HostParam("endpoint") String endpoint, + @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/access/publicOperation/publicDecoratorInPublic") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> publicDecoratorInPublic(@HostParam("endpoint") String endpoint, + @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/access/publicOperation/publicDecoratorInPublic") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response publicDecoratorInPublicSync(@HostParam("endpoint") String endpoint, + @QueryParam("name") String name, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * The noDecoratorInPublic operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in a public operation, should be generated and exported along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> noDecoratorInPublicWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.noDecoratorInPublic(this.client.getEndpoint(), name, accept, requestOptions, context)); + } + + /** + * The noDecoratorInPublic operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in a public operation, should be generated and exported along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response noDecoratorInPublicWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.noDecoratorInPublicSync(this.client.getEndpoint(), name, accept, requestOptions, Context.NONE); + } + + /** + * The publicDecoratorInPublic operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in a public operation, should be generated and exported along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> publicDecoratorInPublicWithResponseAsync(String name, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.publicDecoratorInPublic(this.client.getEndpoint(), name, accept, + requestOptions, context)); + } + + /** + * The publicDecoratorInPublic operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in a public operation, should be generated and exported along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response publicDecoratorInPublicWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.publicDecoratorInPublicSync(this.client.getEndpoint(), name, accept, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/RelativeModelInOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/RelativeModelInOperationsImpl.java new file mode 100644 index 00000000000..eaaa2943a6b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/RelativeModelInOperationsImpl.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RelativeModelInOperations. + */ +public final class RelativeModelInOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RelativeModelInOperationsService service; + + /** + * The service client containing this operation class. + */ + private final AccessClientImpl client; + + /** + * Initializes an instance of RelativeModelInOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RelativeModelInOperationsImpl(AccessClientImpl client) { + this.service = RestProxy.create(RelativeModelInOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AccessClientRelativeModelInOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AccessClientRelativeModelInOperations") + public interface RelativeModelInOperationsService { + @Get("/azure/client-generator-core/access/relativeModelInOperation/operation") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> operation(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/access/relativeModelInOperation/operation") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response operationSync(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/access/relativeModelInOperation/discriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> discriminator(@HostParam("endpoint") String endpoint, + @QueryParam("kind") String kind, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/access/relativeModelInOperation/discriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response discriminatorSync(@HostParam("endpoint") String endpoint, @QueryParam("kind") String kind, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * Expected query parameter: name="Madge" + * Expected response body: + * ```json + * { + * "name": "Madge", + * "inner": + * { + * "name": "Madge" + * } + * } + * ```. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     inner (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in internal operations, should be generated but not exported along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> operationWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.operation(this.client.getEndpoint(), name, accept, requestOptions, context)); + } + + /** + * Expected query parameter: name="Madge" + * Expected response body: + * ```json + * { + * "name": "Madge", + * "inner": + * { + * "name": "Madge" + * } + * } + * ```. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     inner (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in internal operations, should be generated but not exported along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response operationWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.operationSync(this.client.getEndpoint(), name, accept, requestOptions, Context.NONE); + } + + /** + * Expected query parameter: kind="real" + * Expected response body: + * ```json + * { + * "name": "Madge", + * "kind": "real" + * } + * ```. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param kind The kind parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in internal operations, should be generated but not exported along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> discriminatorWithResponseAsync(String kind, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.discriminator(this.client.getEndpoint(), kind, accept, requestOptions, context)); + } + + /** + * Expected query parameter: kind="real" + * Expected response body: + * ```json + * { + * "name": "Madge", + * "kind": "real" + * } + * ```. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param kind The kind parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used in internal operations, should be generated but not exported along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response discriminatorWithResponse(String kind, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.discriminatorSync(this.client.getEndpoint(), kind, accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/SharedModelInOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/SharedModelInOperationsImpl.java new file mode 100644 index 00000000000..c8f4ab258a8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/SharedModelInOperationsImpl.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SharedModelInOperations. + */ +public final class SharedModelInOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SharedModelInOperationsService service; + + /** + * The service client containing this operation class. + */ + private final AccessClientImpl client; + + /** + * Initializes an instance of SharedModelInOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SharedModelInOperationsImpl(AccessClientImpl client) { + this.service = RestProxy.create(SharedModelInOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AccessClientSharedModelInOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AccessClientSharedModelInOperations") + public interface SharedModelInOperationsService { + @Get("/azure/client-generator-core/access/sharedModelInOperation/public") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> publicMethod(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/access/sharedModelInOperation/public") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response publicMethodSync(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/access/sharedModelInOperation/internal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> internal(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/access/sharedModelInOperation/internal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response internalSync(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * The publicMethod operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used by both public and internal operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> publicMethodWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.publicMethod(this.client.getEndpoint(), name, accept, requestOptions, context)); + } + + /** + * The publicMethod operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used by both public and internal operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response publicMethodWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.publicMethodSync(this.client.getEndpoint(), name, accept, requestOptions, Context.NONE); + } + + /** + * The internal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used by both public and internal operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> internalWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.internal(this.client.getEndpoint(), name, accept, requestOptions, context)); + } + + /** + * The internal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return used by both public and internal operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response internalWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.internalSync(this.client.getEndpoint(), name, accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/package-info.java new file mode 100644 index 00000000000..8435d3a9fc1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Access. + * Test for internal decorator. + * + */ +package azure.clientgenerator.core.access.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/InternalDecoratorModelInInternal.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/InternalDecoratorModelInInternal.java new file mode 100644 index 00000000000..342889d164d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/InternalDecoratorModelInInternal.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.internaloperation.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Used in an internal operation, should be generated but not exported. + */ +@Immutable +public final class InternalDecoratorModelInInternal implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of InternalDecoratorModelInInternal class. + * + * @param name the name value to set. + */ + @Generated + private InternalDecoratorModelInInternal(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InternalDecoratorModelInInternal from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InternalDecoratorModelInInternal if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InternalDecoratorModelInInternal. + */ + @Generated + public static InternalDecoratorModelInInternal fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new InternalDecoratorModelInInternal(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/NoDecoratorModelInInternal.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/NoDecoratorModelInInternal.java new file mode 100644 index 00000000000..0e6708a93df --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/NoDecoratorModelInInternal.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.internaloperation.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Used in an internal operation, should be generated but not exported. + */ +@Immutable +public final class NoDecoratorModelInInternal implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of NoDecoratorModelInInternal class. + * + * @param name the name value to set. + */ + @Generated + private NoDecoratorModelInInternal(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NoDecoratorModelInInternal from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NoDecoratorModelInInternal if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NoDecoratorModelInInternal. + */ + @Generated + public static NoDecoratorModelInInternal fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new NoDecoratorModelInInternal(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/package-info.java new file mode 100644 index 00000000000..fa7be66bf74 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Access. + * Test for internal decorator. + * + */ +package azure.clientgenerator.core.access.internaloperation.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/PublicDecoratorModelInInternal.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/PublicDecoratorModelInInternal.java new file mode 100644 index 00000000000..1884f67500d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/PublicDecoratorModelInInternal.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.internaloperation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Used in an internal operation but with public decorator, should be generated and exported. + */ +@Immutable +public final class PublicDecoratorModelInInternal implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of PublicDecoratorModelInInternal class. + * + * @param name the name value to set. + */ + @Generated + private PublicDecoratorModelInInternal(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PublicDecoratorModelInInternal from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PublicDecoratorModelInInternal if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PublicDecoratorModelInInternal. + */ + @Generated + public static PublicDecoratorModelInInternal fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new PublicDecoratorModelInInternal(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/package-info.java new file mode 100644 index 00000000000..830b72bfb4c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/internaloperation/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Access. + * Test for internal decorator. + * + */ +package azure.clientgenerator.core.access.internaloperation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/package-info.java new file mode 100644 index 00000000000..4a7d900431a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Access. + * Test for internal decorator. + * + */ +package azure.clientgenerator.core.access; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/NoDecoratorModelInPublic.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/NoDecoratorModelInPublic.java new file mode 100644 index 00000000000..7a6de979768 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/NoDecoratorModelInPublic.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.publicoperation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Used in a public operation, should be generated and exported. + */ +@Immutable +public final class NoDecoratorModelInPublic implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of NoDecoratorModelInPublic class. + * + * @param name the name value to set. + */ + @Generated + private NoDecoratorModelInPublic(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NoDecoratorModelInPublic from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NoDecoratorModelInPublic if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NoDecoratorModelInPublic. + */ + @Generated + public static NoDecoratorModelInPublic fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new NoDecoratorModelInPublic(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/PublicDecoratorModelInPublic.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/PublicDecoratorModelInPublic.java new file mode 100644 index 00000000000..738d5691fb7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/PublicDecoratorModelInPublic.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.publicoperation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Used in a public operation, should be generated and exported. + */ +@Immutable +public final class PublicDecoratorModelInPublic implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of PublicDecoratorModelInPublic class. + * + * @param name the name value to set. + */ + @Generated + private PublicDecoratorModelInPublic(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PublicDecoratorModelInPublic from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PublicDecoratorModelInPublic if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PublicDecoratorModelInPublic. + */ + @Generated + public static PublicDecoratorModelInPublic fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new PublicDecoratorModelInPublic(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/package-info.java new file mode 100644 index 00000000000..e4f02519486 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/publicoperation/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Access. + * Test for internal decorator. + * + */ +package azure.clientgenerator.core.access.publicoperation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/AbstractModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/AbstractModel.java new file mode 100644 index 00000000000..430239f6ef9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/AbstractModel.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.relativemodelinoperation.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Used in internal operations, should be generated but not exported. + */ +@Immutable +public class AbstractModel implements JsonSerializable { + /* + * Discriminator property for AbstractModel. + */ + @Generated + private String kind = "AbstractModel"; + + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of AbstractModel class. + * + * @param name the name value to set. + */ + @Generated + protected AbstractModel(String name) { + this.name = name; + } + + /** + * Get the kind property: Discriminator property for AbstractModel. + * + * @return the kind value. + */ + @Generated + public String getKind() { + return this.kind; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AbstractModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AbstractModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AbstractModel. + */ + @Generated + public static AbstractModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("real".equals(discriminatorValue)) { + return RealModel.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static AbstractModel fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String kind = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + AbstractModel deserializedAbstractModel = new AbstractModel(name); + deserializedAbstractModel.kind = kind; + + return deserializedAbstractModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/BaseModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/BaseModel.java new file mode 100644 index 00000000000..b881abcfe67 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/BaseModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.relativemodelinoperation.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Used in internal operations, should be generated but not exported. + */ +@Immutable +public class BaseModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of BaseModel class. + * + * @param name the name value to set. + */ + @Generated + protected BaseModel(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BaseModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BaseModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BaseModel. + */ + @Generated + public static BaseModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new BaseModel(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/InnerModel.java new file mode 100644 index 00000000000..23562827c9d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/InnerModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.relativemodelinoperation.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Used in internal operations, should be generated but not exported. + */ +@Immutable +public final class InnerModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of InnerModel class. + * + * @param name the name value to set. + */ + @Generated + private InnerModel(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InnerModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InnerModel. + */ + @Generated + public static InnerModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new InnerModel(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/OuterModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/OuterModel.java new file mode 100644 index 00000000000..c3033a7968c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/OuterModel.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.relativemodelinoperation.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Used in internal operations, should be generated but not exported. + */ +@Immutable +public final class OuterModel extends BaseModel { + /* + * The inner property. + */ + @Generated + private final InnerModel inner; + + /** + * Creates an instance of OuterModel class. + * + * @param name the name value to set. + * @param inner the inner value to set. + */ + @Generated + private OuterModel(String name, InnerModel inner) { + super(name); + this.inner = inner; + } + + /** + * Get the inner property: The inner property. + * + * @return the inner value. + */ + @Generated + public InnerModel getInner() { + return this.inner; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeJsonField("inner", this.inner); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OuterModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OuterModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OuterModel. + */ + @Generated + public static OuterModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + InnerModel inner = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("inner".equals(fieldName)) { + inner = InnerModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new OuterModel(name, inner); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/RealModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/RealModel.java new file mode 100644 index 00000000000..db88e30c940 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/RealModel.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.relativemodelinoperation.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Used in internal operations, should be generated but not exported. + */ +@Immutable +public final class RealModel extends AbstractModel { + /* + * Discriminator property for AbstractModel. + */ + @Generated + private String kind = "real"; + + /** + * Creates an instance of RealModel class. + * + * @param name the name value to set. + */ + @Generated + private RealModel(String name) { + super(name); + } + + /** + * Get the kind property: Discriminator property for AbstractModel. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RealModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RealModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RealModel. + */ + @Generated + public static RealModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String kind = "real"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + RealModel deserializedRealModel = new RealModel(name); + deserializedRealModel.kind = kind; + + return deserializedRealModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/package-info.java new file mode 100644 index 00000000000..69624107369 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Access. + * Test for internal decorator. + * + */ +package azure.clientgenerator.core.access.relativemodelinoperation.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/SharedModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/SharedModel.java new file mode 100644 index 00000000000..f8f1f32ebb3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/SharedModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.sharedmodelinoperation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Used by both public and internal operation. It should be generated and exported. + */ +@Immutable +public final class SharedModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of SharedModel class. + * + * @param name the name value to set. + */ + @Generated + private SharedModel(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SharedModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SharedModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SharedModel. + */ + @Generated + public static SharedModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new SharedModel(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/package-info.java new file mode 100644 index 00000000000..cea72b15ba9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Access. + * Test for internal decorator. + * + */ +package azure.clientgenerator.core.access.sharedmodelinoperation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeAsyncClient.java new file mode 100644 index 00000000000..8d846069a28 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeAsyncClient.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.alternatetype; + +import azure.clientgenerator.core.alternatetype.externaltype.models.ModelWithFeatureProperty; +import azure.clientgenerator.core.alternatetype.implementation.ExternalTypesImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.models.GeoObject; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous AlternateTypeClient type. + */ +@ServiceClient(builder = AlternateTypeClientBuilder.class, isAsync = true) +public final class AlternateTypeAsyncClient { + @Generated + private final ExternalTypesImpl serviceClient; + + /** + * Initializes an instance of AlternateTypeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AlternateTypeAsyncClient(ExternalTypesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     type: String (Required)
+     *     geometry (Required): {
+     *         type: String (Required)
+     *         coordinates (Required): [
+     *             int (Required)
+     *         ]
+     *     }
+     *     properties (Required): {
+     *         String: BinaryData (Required)
+     *     }
+     *     id: BinaryData (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getModelWithResponseAsync(requestOptions); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     type: String (Required)
+     *     geometry (Required): {
+     *         type: String (Required)
+     *         coordinates (Required): [
+     *             int (Required)
+     *         ]
+     *     }
+     *     properties (Required): {
+     *         String: BinaryData (Required)
+     *     }
+     *     id: BinaryData (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putModelWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putModelWithResponseAsync(body, requestOptions); + } + + /** + * The getProperty operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     feature (Required): {
+     *         type: String (Required)
+     *         geometry (Required): {
+     *             type: String (Required)
+     *             coordinates (Required): [
+     *                 int (Required)
+     *             ]
+     *         }
+     *         properties (Required): {
+     *             String: BinaryData (Required)
+     *         }
+     *         id: BinaryData (Optional)
+     *     }
+     *     additionalProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPropertyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getPropertyWithResponseAsync(requestOptions); + } + + /** + * The putProperty operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     feature (Required): {
+     *         type: String (Required)
+     *         geometry (Required): {
+     *             type: String (Required)
+     *             coordinates (Required): [
+     *                 int (Required)
+     *             ]
+     *         }
+     *         properties (Required): {
+     *             String: BinaryData (Required)
+     *         }
+     *         id: BinaryData (Optional)
+     *     }
+     *     additionalProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putPropertyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putPropertyWithResponseAsync(body, requestOptions); + } + + /** + * The getModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getModel() { + // Generated convenience method for getModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GeoObject.class)); + } + + /** + * The putModel operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putModel(GeoObject body) { + // Generated convenience method for putModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putModelWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getProperty operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getProperty() { + // Generated convenience method for getPropertyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getPropertyWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithFeatureProperty.class)); + } + + /** + * The putProperty operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putProperty(ModelWithFeatureProperty body) { + // Generated convenience method for putPropertyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putPropertyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClient.java new file mode 100644 index 00000000000..b5799840f37 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClient.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.alternatetype; + +import azure.clientgenerator.core.alternatetype.externaltype.models.ModelWithFeatureProperty; +import azure.clientgenerator.core.alternatetype.implementation.ExternalTypesImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.models.GeoObject; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous AlternateTypeClient type. + */ +@ServiceClient(builder = AlternateTypeClientBuilder.class) +public final class AlternateTypeClient { + @Generated + private final ExternalTypesImpl serviceClient; + + /** + * Initializes an instance of AlternateTypeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AlternateTypeClient(ExternalTypesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     type: String (Required)
+     *     geometry (Required): {
+     *         type: String (Required)
+     *         coordinates (Required): [
+     *             int (Required)
+     *         ]
+     *     }
+     *     properties (Required): {
+     *         String: BinaryData (Required)
+     *     }
+     *     id: BinaryData (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getModelWithResponse(requestOptions); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     type: String (Required)
+     *     geometry (Required): {
+     *         type: String (Required)
+     *         coordinates (Required): [
+     *             int (Required)
+     *         ]
+     *     }
+     *     properties (Required): {
+     *         String: BinaryData (Required)
+     *     }
+     *     id: BinaryData (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putModelWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putModelWithResponse(body, requestOptions); + } + + /** + * The getProperty operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     feature (Required): {
+     *         type: String (Required)
+     *         geometry (Required): {
+     *             type: String (Required)
+     *             coordinates (Required): [
+     *                 int (Required)
+     *             ]
+     *         }
+     *         properties (Required): {
+     *             String: BinaryData (Required)
+     *         }
+     *         id: BinaryData (Optional)
+     *     }
+     *     additionalProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPropertyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getPropertyWithResponse(requestOptions); + } + + /** + * The putProperty operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     feature (Required): {
+     *         type: String (Required)
+     *         geometry (Required): {
+     *             type: String (Required)
+     *             coordinates (Required): [
+     *                 int (Required)
+     *             ]
+     *         }
+     *         properties (Required): {
+     *             String: BinaryData (Required)
+     *         }
+     *         id: BinaryData (Optional)
+     *     }
+     *     additionalProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putPropertyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putPropertyWithResponse(body, requestOptions); + } + + /** + * The getModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GeoObject getModel() { + // Generated convenience method for getModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getModelWithResponse(requestOptions).getValue().toObject(GeoObject.class); + } + + /** + * The putModel operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putModel(GeoObject body) { + // Generated convenience method for putModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + putModelWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The getProperty operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ModelWithFeatureProperty getProperty() { + // Generated convenience method for getPropertyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getPropertyWithResponse(requestOptions).getValue().toObject(ModelWithFeatureProperty.class); + } + + /** + * The putProperty operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putProperty(ModelWithFeatureProperty body) { + // Generated convenience method for putPropertyWithResponse + RequestOptions requestOptions = new RequestOptions(); + putPropertyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClientBuilder.java new file mode 100644 index 00000000000..9b234acdf20 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.alternatetype; + +import azure.clientgenerator.core.alternatetype.implementation.AlternateTypeClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the AlternateTypeClient type. + */ +@ServiceClientBuilder(serviceClients = { AlternateTypeClient.class, AlternateTypeAsyncClient.class }) +public final class AlternateTypeClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-alternatetype.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the AlternateTypeClientBuilder. + */ + @Generated + public AlternateTypeClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AlternateTypeClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AlternateTypeClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AlternateTypeClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AlternateTypeClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AlternateTypeClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AlternateTypeClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AlternateTypeClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AlternateTypeClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the AlternateTypeClientBuilder. + */ + @Generated + public AlternateTypeClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of AlternateTypeClientImpl with the provided parameters. + * + * @return an instance of AlternateTypeClientImpl. + */ + @Generated + private AlternateTypeClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + AlternateTypeClientImpl client = new AlternateTypeClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of AlternateTypeAsyncClient class. + * + * @return an instance of AlternateTypeAsyncClient. + */ + @Generated + public AlternateTypeAsyncClient buildAsyncClient() { + return new AlternateTypeAsyncClient(buildInnerClient().getExternalTypes()); + } + + /** + * Builds an instance of AlternateTypeClient class. + * + * @return an instance of AlternateTypeClient. + */ + @Generated + public AlternateTypeClient buildClient() { + return new AlternateTypeClient(buildInnerClient().getExternalTypes()); + } + + private static final ClientLogger LOGGER = new ClientLogger(AlternateTypeClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/ModelWithFeatureProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/ModelWithFeatureProperty.java new file mode 100644 index 00000000000..b851de6f226 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/ModelWithFeatureProperty.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.alternatetype.externaltype.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.GeoObject; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ModelWithFeatureProperty model. + */ +@Immutable +public final class ModelWithFeatureProperty implements JsonSerializable { + /* + * The feature property. + */ + @Generated + private final GeoObject feature; + + /* + * The additionalProperty property. + */ + @Generated + private final String additionalProperty; + + /** + * Creates an instance of ModelWithFeatureProperty class. + * + * @param feature the feature value to set. + * @param additionalProperty the additionalProperty value to set. + */ + @Generated + public ModelWithFeatureProperty(GeoObject feature, String additionalProperty) { + this.feature = feature; + this.additionalProperty = additionalProperty; + } + + /** + * Get the feature property: The feature property. + * + * @return the feature value. + */ + @Generated + public GeoObject getFeature() { + return this.feature; + } + + /** + * Get the additionalProperty property: The additionalProperty property. + * + * @return the additionalProperty value. + */ + @Generated + public String getAdditionalProperty() { + return this.additionalProperty; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("feature", this.feature); + jsonWriter.writeStringField("additionalProperty", this.additionalProperty); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ModelWithFeatureProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ModelWithFeatureProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ModelWithFeatureProperty. + */ + @Generated + public static ModelWithFeatureProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GeoObject feature = null; + String additionalProperty = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("feature".equals(fieldName)) { + feature = GeoObject.fromJson(reader); + } else if ("additionalProperty".equals(fieldName)) { + additionalProperty = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ModelWithFeatureProperty(feature, additionalProperty); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/package-info.java new file mode 100644 index 00000000000..5c89505dddd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for AlternateType. + * Test for alternate type decorator. + * + */ +package azure.clientgenerator.core.alternatetype.externaltype.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/AlternateTypeClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/AlternateTypeClientImpl.java new file mode 100644 index 00000000000..d993353e535 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/AlternateTypeClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.alternatetype.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 AlternateTypeClient type. + */ +public final class AlternateTypeClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 ExternalTypesImpl object to access its operations. + */ + private final ExternalTypesImpl externalTypes; + + /** + * Gets the ExternalTypesImpl object to access its operations. + * + * @return the ExternalTypesImpl object. + */ + public ExternalTypesImpl getExternalTypes() { + return this.externalTypes; + } + + /** + * Initializes an instance of AlternateTypeClient client. + * + * @param endpoint Service host. + */ + public AlternateTypeClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of AlternateTypeClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public AlternateTypeClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of AlternateTypeClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public AlternateTypeClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.externalTypes = new ExternalTypesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/ExternalTypesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/ExternalTypesImpl.java new file mode 100644 index 00000000000..6eb894ad40d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/ExternalTypesImpl.java @@ -0,0 +1,438 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.alternatetype.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExternalTypes. + */ +public final class ExternalTypesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExternalTypesService service; + + /** + * The service client containing this operation class. + */ + private final AlternateTypeClientImpl client; + + /** + * Initializes an instance of ExternalTypesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExternalTypesImpl(AlternateTypeClientImpl client) { + this.service + = RestProxy.create(ExternalTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AlternateTypeClientExternalTypes to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AlternateTypeClientExternalTypes") + public interface ExternalTypesService { + @Get("/azure/client-generator-core/alternate-type/external/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/alternate-type/external/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getModelSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/alternate-type/external/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/alternate-type/external/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/alternate-type/external/property") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getProperty(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/alternate-type/external/property") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getPropertySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/alternate-type/external/property") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putProperty(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/alternate-type/external/property") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putPropertySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     type: String (Required)
+     *     geometry (Required): {
+     *         type: String (Required)
+     *         coordinates (Required): [
+     *             int (Required)
+     *         ]
+     *     }
+     *     properties (Required): {
+     *         String: BinaryData (Required)
+     *     }
+     *     id: BinaryData (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getModelWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getModel(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     type: String (Required)
+     *     geometry (Required): {
+     *         type: String (Required)
+     *         coordinates (Required): [
+     *             int (Required)
+     *         ]
+     *     }
+     *     properties (Required): {
+     *         String: BinaryData (Required)
+     *     }
+     *     id: BinaryData (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getModelWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getModelSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     type: String (Required)
+     *     geometry (Required): {
+     *         type: String (Required)
+     *         coordinates (Required): [
+     *             int (Required)
+     *         ]
+     *     }
+     *     properties (Required): {
+     *         String: BinaryData (Required)
+     *     }
+     *     id: BinaryData (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putModelWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putModel(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     type: String (Required)
+     *     geometry (Required): {
+     *         type: String (Required)
+     *         coordinates (Required): [
+     *             int (Required)
+     *         ]
+     *     }
+     *     properties (Required): {
+     *         String: BinaryData (Required)
+     *     }
+     *     id: BinaryData (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putModelWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putModelSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The getProperty operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     feature (Required): {
+     *         type: String (Required)
+     *         geometry (Required): {
+     *             type: String (Required)
+     *             coordinates (Required): [
+     *                 int (Required)
+     *             ]
+     *         }
+     *         properties (Required): {
+     *             String: BinaryData (Required)
+     *         }
+     *         id: BinaryData (Optional)
+     *     }
+     *     additionalProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPropertyWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getProperty(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getProperty operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     feature (Required): {
+     *         type: String (Required)
+     *         geometry (Required): {
+     *             type: String (Required)
+     *             coordinates (Required): [
+     *                 int (Required)
+     *             ]
+     *         }
+     *         properties (Required): {
+     *             String: BinaryData (Required)
+     *         }
+     *         id: BinaryData (Optional)
+     *     }
+     *     additionalProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPropertyWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getPropertySync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The putProperty operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     feature (Required): {
+     *         type: String (Required)
+     *         geometry (Required): {
+     *             type: String (Required)
+     *             coordinates (Required): [
+     *                 int (Required)
+     *             ]
+     *         }
+     *         properties (Required): {
+     *             String: BinaryData (Required)
+     *         }
+     *         id: BinaryData (Optional)
+     *     }
+     *     additionalProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putPropertyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putProperty(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The putProperty operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     feature (Required): {
+     *         type: String (Required)
+     *         geometry (Required): {
+     *             type: String (Required)
+     *             coordinates (Required): [
+     *                 int (Required)
+     *             ]
+     *         }
+     *         properties (Required): {
+     *             String: BinaryData (Required)
+     *         }
+     *         id: BinaryData (Optional)
+     *     }
+     *     additionalProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putPropertyWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putPropertySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/package-info.java new file mode 100644 index 00000000000..da62eb33b3c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for AlternateType. + * Test for alternate type decorator. + * + */ +package azure.clientgenerator.core.alternatetype.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/package-info.java new file mode 100644 index 00000000000..3eb16e12fde --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/alternatetype/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for AlternateType. + * Test for alternate type decorator. + * + */ +package azure.clientgenerator.core.alternatetype; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderAsyncClient.java new file mode 100644 index 00000000000..27374c8c535 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.header; + +import azure.clientgenerator.core.apiversion.header.implementation.HeaderClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous HeaderClient type. + */ +@ServiceClient(builder = HeaderClientBuilder.class, isAsync = true) +public final class HeaderAsyncClient { + @Generated + private final HeaderClientImpl serviceClient; + + /** + * Initializes an instance of HeaderAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + HeaderAsyncClient(HeaderClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Header api version parameter. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> headerApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.headerApiVersionWithResponseAsync(requestOptions); + } + + /** + * Header api version parameter. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono headerApiVersion() { + // Generated convenience method for headerApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return headerApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClient.java new file mode 100644 index 00000000000..075eb89c90a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.header; + +import azure.clientgenerator.core.apiversion.header.implementation.HeaderClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous HeaderClient type. + */ +@ServiceClient(builder = HeaderClientBuilder.class) +public final class HeaderClient { + @Generated + private final HeaderClientImpl serviceClient; + + /** + * Initializes an instance of HeaderClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + HeaderClient(HeaderClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Header api version parameter. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headerApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.headerApiVersionWithResponse(requestOptions); + } + + /** + * Header api version parameter. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void headerApiVersion() { + // Generated convenience method for headerApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + headerApiVersionWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClientBuilder.java new file mode 100644 index 00000000000..0a2426f5383 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClientBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.header; + +import azure.clientgenerator.core.apiversion.header.implementation.HeaderClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the HeaderClient type. + */ +@ServiceClientBuilder(serviceClients = { HeaderClient.class, HeaderAsyncClient.class }) +public final class HeaderClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-apiversion-header.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the HeaderClientBuilder. + */ + @Generated + public HeaderClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private HeaderServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the HeaderClientBuilder. + */ + @Generated + public HeaderClientBuilder serviceVersion(HeaderServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the HeaderClientBuilder. + */ + @Generated + public HeaderClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of HeaderClientImpl with the provided parameters. + * + * @return an instance of HeaderClientImpl. + */ + @Generated + private HeaderClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + HeaderServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : HeaderServiceVersion.getLatest(); + HeaderClientImpl client = new HeaderClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + localEndpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of HeaderAsyncClient class. + * + * @return an instance of HeaderAsyncClient. + */ + @Generated + public HeaderAsyncClient buildAsyncClient() { + return new HeaderAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of HeaderClient class. + * + * @return an instance of HeaderClient. + */ + @Generated + public HeaderClient buildClient() { + return new HeaderClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(HeaderClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderServiceVersion.java new file mode 100644 index 00000000000..f1ca4c3f11a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/HeaderServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.header; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of HeaderClient. + */ +public enum HeaderServiceVersion implements ServiceVersion { + /** + * Enum value 2025-01-01. + */ + V2025_01_01("2025-01-01"); + + private final String version; + + HeaderServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link HeaderServiceVersion}. + */ + public static HeaderServiceVersion getLatest() { + return V2025_01_01; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/HeaderClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/HeaderClientImpl.java new file mode 100644 index 00000000000..7c1aee01d25 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/HeaderClientImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.header.implementation; + +import azure.clientgenerator.core.apiversion.header.HeaderServiceVersion; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the HeaderClient type. + */ +public final class HeaderClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final HeaderClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final HeaderServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public HeaderServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of HeaderClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public HeaderClientImpl(String endpoint, HeaderServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of HeaderClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public HeaderClientImpl(HttpPipeline httpPipeline, String endpoint, HeaderServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of HeaderClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public HeaderClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + HeaderServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(HeaderClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for HeaderClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "HeaderClient") + public interface HeaderClientService { + @Post("/azure/client-generator-core/api-version/header") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> headerApiVersion(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-version") String xMsVersion, RequestOptions requestOptions, Context context); + + @Post("/azure/client-generator-core/api-version/header") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response headerApiVersionSync(@HostParam("endpoint") String endpoint, + @HeaderParam("x-ms-version") String xMsVersion, RequestOptions requestOptions, Context context); + } + + /** + * Header api version parameter. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> headerApiVersionWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.headerApiVersion(this.getEndpoint(), + this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * Header api version parameter. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headerApiVersionWithResponse(RequestOptions requestOptions) { + return service.headerApiVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/package-info.java new file mode 100644 index 00000000000..6be380c7b87 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Header. + * + */ +package azure.clientgenerator.core.apiversion.header.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/package-info.java new file mode 100644 index 00000000000..0f66241f957 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/header/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Header. + * + */ +package azure.clientgenerator.core.apiversion.header; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathAsyncClient.java new file mode 100644 index 00000000000..62e493d3326 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.path; + +import azure.clientgenerator.core.apiversion.path.implementation.PathClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous PathClient type. + */ +@ServiceClient(builder = PathClientBuilder.class, isAsync = true) +public final class PathAsyncClient { + @Generated + private final PathClientImpl serviceClient; + + /** + * Initializes an instance of PathAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathAsyncClient(PathClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Path api version parameter. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> pathApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.pathApiVersionWithResponseAsync(requestOptions); + } + + /** + * Path api version parameter. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono pathApiVersion() { + // Generated convenience method for pathApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return pathApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClient.java new file mode 100644 index 00000000000..df2959f55ba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.path; + +import azure.clientgenerator.core.apiversion.path.implementation.PathClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous PathClient type. + */ +@ServiceClient(builder = PathClientBuilder.class) +public final class PathClient { + @Generated + private final PathClientImpl serviceClient; + + /** + * Initializes an instance of PathClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathClient(PathClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Path api version parameter. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response pathApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.pathApiVersionWithResponse(requestOptions); + } + + /** + * Path api version parameter. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void pathApiVersion() { + // Generated convenience method for pathApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + pathApiVersionWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClientBuilder.java new file mode 100644 index 00000000000..cb433113811 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathClientBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.path; + +import azure.clientgenerator.core.apiversion.path.implementation.PathClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the PathClient type. + */ +@ServiceClientBuilder(serviceClients = { PathClient.class, PathAsyncClient.class }) +public final class PathClientBuilder + implements HttpTrait, ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-apiversion-path.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the PathClientBuilder. + */ + @Generated + public PathClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private PathServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the PathClientBuilder. + */ + @Generated + public PathClientBuilder serviceVersion(PathServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the PathClientBuilder. + */ + @Generated + public PathClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of PathClientImpl with the provided parameters. + * + * @return an instance of PathClientImpl. + */ + @Generated + private PathClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + PathServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : PathServiceVersion.getLatest(); + PathClientImpl client = new PathClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + localEndpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of PathAsyncClient class. + * + * @return an instance of PathAsyncClient. + */ + @Generated + public PathAsyncClient buildAsyncClient() { + return new PathAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of PathClient class. + * + * @return an instance of PathClient. + */ + @Generated + public PathClient buildClient() { + return new PathClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(PathClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathServiceVersion.java new file mode 100644 index 00000000000..aecfc2cd07a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/PathServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.path; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of PathClient. + */ +public enum PathServiceVersion implements ServiceVersion { + /** + * Enum value 2025-01-01. + */ + V2025_01_01("2025-01-01"); + + private final String version; + + PathServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link PathServiceVersion}. + */ + public static PathServiceVersion getLatest() { + return V2025_01_01; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/PathClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/PathClientImpl.java new file mode 100644 index 00000000000..af071c6bb43 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/PathClientImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.path.implementation; + +import azure.clientgenerator.core.apiversion.path.PathServiceVersion; +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the PathClient type. + */ +public final class PathClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final PathServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public PathServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of PathClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public PathClientImpl(String endpoint, PathServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of PathClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public PathClientImpl(HttpPipeline httpPipeline, String endpoint, PathServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of PathClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public PathClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + PathServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(PathClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for PathClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "PathClient") + public interface PathClientService { + @Post("/azure/client-generator-core/api-version/path/{version}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> pathApiVersion(@HostParam("endpoint") String endpoint, + @PathParam("version") String version, RequestOptions requestOptions, Context context); + + @Post("/azure/client-generator-core/api-version/path/{version}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response pathApiVersionSync(@HostParam("endpoint") String endpoint, @PathParam("version") String version, + RequestOptions requestOptions, Context context); + } + + /** + * Path api version parameter. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> pathApiVersionWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.pathApiVersion(this.getEndpoint(), + this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * Path api version parameter. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response pathApiVersionWithResponse(RequestOptions requestOptions) { + return service.pathApiVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/package-info.java new file mode 100644 index 00000000000..208c8607ea9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Path. + * + */ +package azure.clientgenerator.core.apiversion.path.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/package-info.java new file mode 100644 index 00000000000..85af30d1325 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/path/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Path. + * + */ +package azure.clientgenerator.core.apiversion.path; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryAsyncClient.java new file mode 100644 index 00000000000..4d9415c6410 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.query; + +import azure.clientgenerator.core.apiversion.query.implementation.QueryClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous QueryClient type. + */ +@ServiceClient(builder = QueryClientBuilder.class, isAsync = true) +public final class QueryAsyncClient { + @Generated + private final QueryClientImpl serviceClient; + + /** + * Initializes an instance of QueryAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryAsyncClient(QueryClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Query api version parameter. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> queryApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.queryApiVersionWithResponseAsync(requestOptions); + } + + /** + * Query api version parameter. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono queryApiVersion() { + // Generated convenience method for queryApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return queryApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClient.java new file mode 100644 index 00000000000..38ecc492f87 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.query; + +import azure.clientgenerator.core.apiversion.query.implementation.QueryClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous QueryClient type. + */ +@ServiceClient(builder = QueryClientBuilder.class) +public final class QueryClient { + @Generated + private final QueryClientImpl serviceClient; + + /** + * Initializes an instance of QueryClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryClient(QueryClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Query api version parameter. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response queryApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.queryApiVersionWithResponse(requestOptions); + } + + /** + * Query api version parameter. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void queryApiVersion() { + // Generated convenience method for queryApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + queryApiVersionWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClientBuilder.java new file mode 100644 index 00000000000..e5de8523aaf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryClientBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.query; + +import azure.clientgenerator.core.apiversion.query.implementation.QueryClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the QueryClient type. + */ +@ServiceClientBuilder(serviceClients = { QueryClient.class, QueryAsyncClient.class }) +public final class QueryClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-apiversion-query.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the QueryClientBuilder. + */ + @Generated + public QueryClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public QueryClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public QueryClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public QueryClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public QueryClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public QueryClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public QueryClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public QueryClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public QueryClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private QueryServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the QueryClientBuilder. + */ + @Generated + public QueryClientBuilder serviceVersion(QueryServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the QueryClientBuilder. + */ + @Generated + public QueryClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of QueryClientImpl with the provided parameters. + * + * @return an instance of QueryClientImpl. + */ + @Generated + private QueryClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + QueryServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : QueryServiceVersion.getLatest(); + QueryClientImpl client = new QueryClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + localEndpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of QueryAsyncClient class. + * + * @return an instance of QueryAsyncClient. + */ + @Generated + public QueryAsyncClient buildAsyncClient() { + return new QueryAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of QueryClient class. + * + * @return an instance of QueryClient. + */ + @Generated + public QueryClient buildClient() { + return new QueryClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(QueryClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryServiceVersion.java new file mode 100644 index 00000000000..a8d1379b75c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/QueryServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.query; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of QueryClient. + */ +public enum QueryServiceVersion implements ServiceVersion { + /** + * Enum value 2025-01-01. + */ + V2025_01_01("2025-01-01"); + + private final String version; + + QueryServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link QueryServiceVersion}. + */ + public static QueryServiceVersion getLatest() { + return V2025_01_01; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/QueryClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/QueryClientImpl.java new file mode 100644 index 00000000000..f36a3da09c4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/QueryClientImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.query.implementation; + +import azure.clientgenerator.core.apiversion.query.QueryServiceVersion; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the QueryClient type. + */ +public final class QueryClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final QueryClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final QueryServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public QueryServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of QueryClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public QueryClientImpl(String endpoint, QueryServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of QueryClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public QueryClientImpl(HttpPipeline httpPipeline, String endpoint, QueryServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of QueryClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public QueryClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + QueryServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(QueryClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for QueryClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "QueryClient") + public interface QueryClientService { + @Post("/azure/client-generator-core/api-version/query") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> queryApiVersion(@HostParam("endpoint") String endpoint, + @QueryParam("version") String version, RequestOptions requestOptions, Context context); + + @Post("/azure/client-generator-core/api-version/query") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response queryApiVersionSync(@HostParam("endpoint") String endpoint, + @QueryParam("version") String version, RequestOptions requestOptions, Context context); + } + + /** + * Query api version parameter. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> queryApiVersionWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.queryApiVersion(this.getEndpoint(), + this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * Query api version parameter. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response queryApiVersionWithResponse(RequestOptions requestOptions) { + return service.queryApiVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/package-info.java new file mode 100644 index 00000000000..4a074856c8c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Query. + * + */ +package azure.clientgenerator.core.apiversion.query.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/package-info.java new file mode 100644 index 00000000000..61fe05283f8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/apiversion/query/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Query. + * + */ +package azure.clientgenerator.core.apiversion.query; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamAsyncClient.java new file mode 100644 index 00000000000..539b2d5456d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamAsyncClient.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.HeaderParamClientImpl; +import azure.clientgenerator.core.clientinitialization.models.Input; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous HeaderParamClient type. + */ +@ServiceClient(builder = HeaderParamClientBuilder.class, isAsync = true) +public final class HeaderParamAsyncClient { + @Generated + private final HeaderParamClientImpl serviceClient; + + /** + * Initializes an instance of HeaderParamAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + HeaderParamAsyncClient(HeaderParamClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withQuery operation. + * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.withQueryWithResponseAsync(id, requestOptions); + } + + /** + * The withBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withBodyWithResponseAsync(body, requestOptions); + } + + /** + * The withQuery operation. + * + * @param id The id parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withQuery(String id) { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withQueryWithResponse(id, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withBody operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withBody(Input body) { + // Generated convenience method for withBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClient.java new file mode 100644 index 00000000000..4bbcd7e8365 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClient.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.HeaderParamClientImpl; +import azure.clientgenerator.core.clientinitialization.models.Input; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous HeaderParamClient type. + */ +@ServiceClient(builder = HeaderParamClientBuilder.class) +public final class HeaderParamClient { + @Generated + private final HeaderParamClientImpl serviceClient; + + /** + * Initializes an instance of HeaderParamClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + HeaderParamClient(HeaderParamClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withQuery operation. + * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.withQueryWithResponse(id, requestOptions); + } + + /** + * The withBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withBodyWithResponse(body, requestOptions); + } + + /** + * The withQuery operation. + * + * @param id The id parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withQuery(String id) { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + withQueryWithResponse(id, requestOptions).getValue(); + } + + /** + * The withBody operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withBody(Input body) { + // Generated convenience method for withBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + withBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClientBuilder.java new file mode 100644 index 00000000000..31137851e48 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.HeaderParamClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the HeaderParamClient type. + */ +@ServiceClientBuilder(serviceClients = { HeaderParamClient.class, HeaderParamAsyncClient.class }) +public final class HeaderParamClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the HeaderParamClientBuilder. + */ + @Generated + public HeaderParamClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderParamClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderParamClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderParamClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderParamClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderParamClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderParamClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderParamClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HeaderParamClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * + */ + @Generated + private String name; + + /** + * Sets. + * + * @param name the name value. + * @return the HeaderParamClientBuilder. + */ + @Generated + public HeaderParamClientBuilder name(String name) { + this.name = name; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the HeaderParamClientBuilder. + */ + @Generated + public HeaderParamClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of HeaderParamClientImpl with the provided parameters. + * + * @return an instance of HeaderParamClientImpl. + */ + @Generated + private HeaderParamClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + HeaderParamClientImpl client = new HeaderParamClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, this.name); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(name, "'name' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of HeaderParamAsyncClient class. + * + * @return an instance of HeaderParamAsyncClient. + */ + @Generated + public HeaderParamAsyncClient buildAsyncClient() { + return new HeaderParamAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of HeaderParamClient class. + * + * @return an instance of HeaderParamClient. + */ + @Generated + public HeaderParamClient buildClient() { + return new HeaderParamClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(HeaderParamClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsAsyncClient.java new file mode 100644 index 00000000000..04a316639b8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsAsyncClient.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.MixedParamsClientImpl; +import azure.clientgenerator.core.clientinitialization.models.WithBodyRequest; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous MixedParamsClient type. + */ +@ServiceClient(builder = MixedParamsClientBuilder.class, isAsync = true) +public final class MixedParamsAsyncClient { + @Generated + private final MixedParamsClientImpl serviceClient; + + /** + * Initializes an instance of MixedParamsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MixedParamsAsyncClient(MixedParamsClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withQuery operation. + * + * @param region The region parameter. + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryWithResponse(String region, String id, RequestOptions requestOptions) { + return this.serviceClient.withQueryWithResponseAsync(region, id, requestOptions); + } + + /** + * The withBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param region The region parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withBodyWithResponse(String region, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withBodyWithResponseAsync(region, body, requestOptions); + } + + /** + * The withQuery operation. + * + * @param region The region parameter. + * @param id The id parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withQuery(String region, String id) { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withQueryWithResponse(region, id, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withBody operation. + * + * @param region The region parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withBody(String region, WithBodyRequest body) { + // Generated convenience method for withBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withBodyWithResponse(region, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClient.java new file mode 100644 index 00000000000..7ab664776b7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClient.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.MixedParamsClientImpl; +import azure.clientgenerator.core.clientinitialization.models.WithBodyRequest; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous MixedParamsClient type. + */ +@ServiceClient(builder = MixedParamsClientBuilder.class) +public final class MixedParamsClient { + @Generated + private final MixedParamsClientImpl serviceClient; + + /** + * Initializes an instance of MixedParamsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MixedParamsClient(MixedParamsClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withQuery operation. + * + * @param region The region parameter. + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryWithResponse(String region, String id, RequestOptions requestOptions) { + return this.serviceClient.withQueryWithResponse(region, id, requestOptions); + } + + /** + * The withBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param region The region parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withBodyWithResponse(String region, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withBodyWithResponse(region, body, requestOptions); + } + + /** + * The withQuery operation. + * + * @param region The region parameter. + * @param id The id parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withQuery(String region, String id) { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + withQueryWithResponse(region, id, requestOptions).getValue(); + } + + /** + * The withBody operation. + * + * @param region The region parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withBody(String region, WithBodyRequest body) { + // Generated convenience method for withBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + withBodyWithResponse(region, BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClientBuilder.java new file mode 100644 index 00000000000..7ce96535235 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.MixedParamsClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the MixedParamsClient type. + */ +@ServiceClientBuilder(serviceClients = { MixedParamsClient.class, MixedParamsAsyncClient.class }) +public final class MixedParamsClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the MixedParamsClientBuilder. + */ + @Generated + public MixedParamsClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MixedParamsClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MixedParamsClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MixedParamsClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MixedParamsClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MixedParamsClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MixedParamsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MixedParamsClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MixedParamsClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * + */ + @Generated + private String name; + + /** + * Sets. + * + * @param name the name value. + * @return the MixedParamsClientBuilder. + */ + @Generated + public MixedParamsClientBuilder name(String name) { + this.name = name; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the MixedParamsClientBuilder. + */ + @Generated + public MixedParamsClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of MixedParamsClientImpl with the provided parameters. + * + * @return an instance of MixedParamsClientImpl. + */ + @Generated + private MixedParamsClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + MixedParamsClientImpl client = new MixedParamsClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, this.name); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(name, "'name' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of MixedParamsAsyncClient class. + * + * @return an instance of MixedParamsAsyncClient. + */ + @Generated + public MixedParamsAsyncClient buildAsyncClient() { + return new MixedParamsAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of MixedParamsClient class. + * + * @return an instance of MixedParamsClient. + */ + @Generated + public MixedParamsClient buildClient() { + return new MixedParamsClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(MixedParamsClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsAsyncClient.java new file mode 100644 index 00000000000..fffad715e02 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsAsyncClient.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.MultipleParamsClientImpl; +import azure.clientgenerator.core.clientinitialization.models.Input; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous MultipleParamsClient type. + */ +@ServiceClient(builder = MultipleParamsClientBuilder.class, isAsync = true) +public final class MultipleParamsAsyncClient { + @Generated + private final MultipleParamsClientImpl serviceClient; + + /** + * Initializes an instance of MultipleParamsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MultipleParamsAsyncClient(MultipleParamsClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withQuery operation. + * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.withQueryWithResponseAsync(id, requestOptions); + } + + /** + * The withBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withBodyWithResponseAsync(body, requestOptions); + } + + /** + * The withQuery operation. + * + * @param id The id parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withQuery(String id) { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withQueryWithResponse(id, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withBody operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withBody(Input body) { + // Generated convenience method for withBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClient.java new file mode 100644 index 00000000000..99729267707 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClient.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.MultipleParamsClientImpl; +import azure.clientgenerator.core.clientinitialization.models.Input; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous MultipleParamsClient type. + */ +@ServiceClient(builder = MultipleParamsClientBuilder.class) +public final class MultipleParamsClient { + @Generated + private final MultipleParamsClientImpl serviceClient; + + /** + * Initializes an instance of MultipleParamsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MultipleParamsClient(MultipleParamsClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withQuery operation. + * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.withQueryWithResponse(id, requestOptions); + } + + /** + * The withBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withBodyWithResponse(body, requestOptions); + } + + /** + * The withQuery operation. + * + * @param id The id parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withQuery(String id) { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + withQueryWithResponse(id, requestOptions).getValue(); + } + + /** + * The withBody operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withBody(Input body) { + // Generated convenience method for withBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + withBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClientBuilder.java new file mode 100644 index 00000000000..c448d71678b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClientBuilder.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.MultipleParamsClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the MultipleParamsClient type. + */ +@ServiceClientBuilder(serviceClients = { MultipleParamsClient.class, MultipleParamsAsyncClient.class }) +public final class MultipleParamsClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the MultipleParamsClientBuilder. + */ + @Generated + public MultipleParamsClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleParamsClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleParamsClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleParamsClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleParamsClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleParamsClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleParamsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleParamsClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleParamsClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * + */ + @Generated + private String name; + + /** + * Sets. + * + * @param name the name value. + * @return the MultipleParamsClientBuilder. + */ + @Generated + public MultipleParamsClientBuilder name(String name) { + this.name = name; + return this; + } + + /* + * + */ + @Generated + private String region; + + /** + * Sets. + * + * @param region the region value. + * @return the MultipleParamsClientBuilder. + */ + @Generated + public MultipleParamsClientBuilder region(String region) { + this.region = region; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the MultipleParamsClientBuilder. + */ + @Generated + public MultipleParamsClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of MultipleParamsClientImpl with the provided parameters. + * + * @return an instance of MultipleParamsClientImpl. + */ + @Generated + private MultipleParamsClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + MultipleParamsClientImpl client = new MultipleParamsClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, this.name, this.region); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(name, "'name' cannot be null."); + Objects.requireNonNull(region, "'region' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of MultipleParamsAsyncClient class. + * + * @return an instance of MultipleParamsAsyncClient. + */ + @Generated + public MultipleParamsAsyncClient buildAsyncClient() { + return new MultipleParamsAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of MultipleParamsClient class. + * + * @return an instance of MultipleParamsClient. + */ + @Generated + public MultipleParamsClient buildClient() { + return new MultipleParamsClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(MultipleParamsClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasAsyncClient.java new file mode 100644 index 00000000000..d15937a219a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasAsyncClient.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.ParamAliasClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ParamAliasClient type. + */ +@ServiceClient(builder = ParamAliasClientBuilder.class, isAsync = true) +public final class ParamAliasAsyncClient { + @Generated + private final ParamAliasClientImpl serviceClient; + + /** + * Initializes an instance of ParamAliasAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ParamAliasAsyncClient(ParamAliasClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withAliasedName operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAliasedNameWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withAliasedNameWithResponseAsync(requestOptions); + } + + /** + * The withOriginalName operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withOriginalNameWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withOriginalNameWithResponseAsync(requestOptions); + } + + /** + * The withAliasedName operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withAliasedName() { + // Generated convenience method for withAliasedNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withAliasedNameWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withOriginalName operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withOriginalName() { + // Generated convenience method for withOriginalNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withOriginalNameWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClient.java new file mode 100644 index 00000000000..c373ba582a2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClient.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.ParamAliasClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ParamAliasClient type. + */ +@ServiceClient(builder = ParamAliasClientBuilder.class) +public final class ParamAliasClient { + @Generated + private final ParamAliasClientImpl serviceClient; + + /** + * Initializes an instance of ParamAliasClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ParamAliasClient(ParamAliasClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withAliasedName operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAliasedNameWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withAliasedNameWithResponse(requestOptions); + } + + /** + * The withOriginalName operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withOriginalNameWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withOriginalNameWithResponse(requestOptions); + } + + /** + * The withAliasedName operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withAliasedName() { + // Generated convenience method for withAliasedNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + withAliasedNameWithResponse(requestOptions).getValue(); + } + + /** + * The withOriginalName operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withOriginalName() { + // Generated convenience method for withOriginalNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + withOriginalNameWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClientBuilder.java new file mode 100644 index 00000000000..fb31bfe1980 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.ParamAliasClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ParamAliasClient type. + */ +@ServiceClientBuilder(serviceClients = { ParamAliasClient.class, ParamAliasAsyncClient.class }) +public final class ParamAliasClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ParamAliasClientBuilder. + */ + @Generated + public ParamAliasClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParamAliasClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParamAliasClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParamAliasClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParamAliasClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParamAliasClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParamAliasClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParamAliasClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParamAliasClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * + */ + @Generated + private String blobName; + + /** + * Sets. + * + * @param blobName the blobName value. + * @return the ParamAliasClientBuilder. + */ + @Generated + public ParamAliasClientBuilder blobName(String blobName) { + this.blobName = blobName; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ParamAliasClientBuilder. + */ + @Generated + public ParamAliasClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ParamAliasClientImpl with the provided parameters. + * + * @return an instance of ParamAliasClientImpl. + */ + @Generated + private ParamAliasClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ParamAliasClientImpl client = new ParamAliasClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, this.blobName); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(blobName, "'blobName' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ParamAliasAsyncClient class. + * + * @return an instance of ParamAliasAsyncClient. + */ + @Generated + public ParamAliasAsyncClient buildAsyncClient() { + return new ParamAliasAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ParamAliasClient class. + * + * @return an instance of ParamAliasClient. + */ + @Generated + public ParamAliasClient buildClient() { + return new ParamAliasClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ParamAliasClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamAsyncClient.java new file mode 100644 index 00000000000..c62b4f90bf3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamAsyncClient.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.PathParamClientImpl; +import azure.clientgenerator.core.clientinitialization.models.BlobProperties; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous PathParamClient type. + */ +@ServiceClient(builder = PathParamClientBuilder.class, isAsync = true) +public final class PathParamAsyncClient { + @Generated + private final PathParamClientImpl serviceClient; + + /** + * Initializes an instance of PathParamAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParamAsyncClient(PathParamClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withQuery operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withQueryWithResponseAsync(requestOptions); + } + + /** + * The getStandalone operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     size: long (Required)
+     *     contentType: String (Required)
+     *     createdOn: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return properties of a blob along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStandaloneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getStandaloneWithResponseAsync(requestOptions); + } + + /** + * The deleteStandalone operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteStandaloneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.deleteStandaloneWithResponseAsync(requestOptions); + } + + /** + * The withQuery operation. + * + * @param format The format parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withQuery(String format) { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (format != null) { + requestOptions.addQueryParam("format", format, false); + } + return withQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withQuery operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withQuery() { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getStandalone operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a blob on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getStandalone() { + // Generated convenience method for getStandaloneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getStandaloneWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BlobProperties.class)); + } + + /** + * The deleteStandalone operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteStandalone() { + // Generated convenience method for deleteStandaloneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteStandaloneWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClient.java new file mode 100644 index 00000000000..c724e68662b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClient.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.PathParamClientImpl; +import azure.clientgenerator.core.clientinitialization.models.BlobProperties; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous PathParamClient type. + */ +@ServiceClient(builder = PathParamClientBuilder.class) +public final class PathParamClient { + @Generated + private final PathParamClientImpl serviceClient; + + /** + * Initializes an instance of PathParamClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParamClient(PathParamClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withQuery operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withQueryWithResponse(requestOptions); + } + + /** + * The getStandalone operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     size: long (Required)
+     *     contentType: String (Required)
+     *     createdOn: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return properties of a blob along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getStandaloneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getStandaloneWithResponse(requestOptions); + } + + /** + * The deleteStandalone operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteStandaloneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.deleteStandaloneWithResponse(requestOptions); + } + + /** + * The withQuery operation. + * + * @param format The format parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withQuery(String format) { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (format != null) { + requestOptions.addQueryParam("format", format, false); + } + withQueryWithResponse(requestOptions).getValue(); + } + + /** + * The withQuery operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withQuery() { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + withQueryWithResponse(requestOptions).getValue(); + } + + /** + * The getStandalone operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a blob. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BlobProperties getStandalone() { + // Generated convenience method for getStandaloneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getStandaloneWithResponse(requestOptions).getValue().toObject(BlobProperties.class); + } + + /** + * The deleteStandalone operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteStandalone() { + // Generated convenience method for deleteStandaloneWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteStandaloneWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClientBuilder.java new file mode 100644 index 00000000000..59ec31c7f38 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization; + +import azure.clientgenerator.core.clientinitialization.implementation.PathParamClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the PathParamClient type. + */ +@ServiceClientBuilder(serviceClients = { PathParamClient.class, PathParamAsyncClient.class }) +public final class PathParamClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the PathParamClientBuilder. + */ + @Generated + public PathParamClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathParamClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathParamClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathParamClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathParamClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathParamClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathParamClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathParamClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathParamClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * + */ + @Generated + private String blobName; + + /** + * Sets. + * + * @param blobName the blobName value. + * @return the PathParamClientBuilder. + */ + @Generated + public PathParamClientBuilder blobName(String blobName) { + this.blobName = blobName; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the PathParamClientBuilder. + */ + @Generated + public PathParamClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of PathParamClientImpl with the provided parameters. + * + * @return an instance of PathParamClientImpl. + */ + @Generated + private PathParamClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + PathParamClientImpl client = new PathParamClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, this.blobName); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(blobName, "'blobName' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of PathParamAsyncClient class. + * + * @return an instance of PathParamAsyncClient. + */ + @Generated + public PathParamAsyncClient buildAsyncClient() { + return new PathParamAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of PathParamClient class. + * + * @return an instance of PathParamClient. + */ + @Generated + public PathParamClient buildClient() { + return new PathParamClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(PathParamClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ChildClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ChildClientImpl.java new file mode 100644 index 00000000000..d7d09acf4c2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ChildClientImpl.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ChildClient type. + */ +public final class ChildClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ChildClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + */ + private final String blobName; + + /** + * Gets. + * + * @return the blobName value. + */ + public String getBlobName() { + return this.blobName; + } + + /** + * 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; + } + + /** + * Initializes an instance of ChildClient client. + * + * @param endpoint Service host. + * @param blobName + */ + public ChildClientImpl(String endpoint, String blobName) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, blobName); + } + + /** + * Initializes an instance of ChildClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param blobName + */ + public ChildClientImpl(HttpPipeline httpPipeline, String endpoint, String blobName) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, blobName); + } + + /** + * Initializes an instance of ChildClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param blobName + */ + public ChildClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + String blobName) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.blobName = blobName; + this.service = RestProxy.create(ChildClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ChildClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ChildClient") + public interface ChildClientService { + @Get("/azure/client-generator-core/client-initialization/child-client/{blobName}/with-query") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withQuery(@HostParam("endpoint") String endpoint, @PathParam("blobName") String blobName, + RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/client-initialization/child-client/{blobName}/with-query") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withQuerySync(@HostParam("endpoint") String endpoint, @PathParam("blobName") String blobName, + RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/client-initialization/child-client/{blobName}/get-standalone") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getStandalone(@HostParam("endpoint") String endpoint, + @PathParam("blobName") String blobName, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/client-initialization/child-client/{blobName}/get-standalone") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getStandaloneSync(@HostParam("endpoint") String endpoint, + @PathParam("blobName") String blobName, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Delete("/azure/client-generator-core/client-initialization/child-client/{blobName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteStandalone(@HostParam("endpoint") String endpoint, + @PathParam("blobName") String blobName, RequestOptions requestOptions, Context context); + + @Delete("/azure/client-generator-core/client-initialization/child-client/{blobName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteStandaloneSync(@HostParam("endpoint") String endpoint, + @PathParam("blobName") String blobName, RequestOptions requestOptions, Context context); + } + + /** + * The withQuery operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withQuery(this.getEndpoint(), this.getBlobName(), requestOptions, context)); + } + + /** + * The withQuery operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryWithResponse(RequestOptions requestOptions) { + return service.withQuerySync(this.getEndpoint(), this.getBlobName(), requestOptions, Context.NONE); + } + + /** + * The getStandalone operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     size: long (Required)
+     *     contentType: String (Required)
+     *     createdOn: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return properties of a blob along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStandaloneWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getStandalone(this.getEndpoint(), this.getBlobName(), accept, requestOptions, context)); + } + + /** + * The getStandalone operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     size: long (Required)
+     *     contentType: String (Required)
+     *     createdOn: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return properties of a blob along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getStandaloneWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getStandaloneSync(this.getEndpoint(), this.getBlobName(), accept, requestOptions, Context.NONE); + } + + /** + * The deleteStandalone operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteStandaloneWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.deleteStandalone(this.getEndpoint(), this.getBlobName(), requestOptions, context)); + } + + /** + * The deleteStandalone operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteStandaloneWithResponse(RequestOptions requestOptions) { + return service.deleteStandaloneSync(this.getEndpoint(), this.getBlobName(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/HeaderParamClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/HeaderParamClientImpl.java new file mode 100644 index 00000000000..6f6d472bfb7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/HeaderParamClientImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the HeaderParamClient type. + */ +public final class HeaderParamClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final HeaderParamClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + */ + private final String name; + + /** + * Gets. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * 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; + } + + /** + * Initializes an instance of HeaderParamClient client. + * + * @param endpoint Service host. + * @param name + */ + public HeaderParamClientImpl(String endpoint, String name) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name); + } + + /** + * Initializes an instance of HeaderParamClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param name + */ + public HeaderParamClientImpl(HttpPipeline httpPipeline, String endpoint, String name) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name); + } + + /** + * Initializes an instance of HeaderParamClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param name + */ + public HeaderParamClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + String name) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.name = name; + this.service = RestProxy.create(HeaderParamClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for HeaderParamClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "HeaderParamClient") + public interface HeaderParamClientService { + @Get("/azure/client-generator-core/client-initialization/header-param/with-query") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withQuery(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, + @QueryParam("id") String id, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/client-initialization/header-param/with-query") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withQuerySync(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, + @QueryParam("id") String id, RequestOptions requestOptions, Context context); + + @Post("/azure/client-generator-core/client-initialization/header-param/with-body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withBody(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/azure/client-generator-core/client-initialization/header-param/with-body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withBodySync(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The withQuery operation. + * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryWithResponseAsync(String id, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withQuery(this.getEndpoint(), this.getName(), id, requestOptions, context)); + } + + /** + * The withQuery operation. + * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryWithResponse(String id, RequestOptions requestOptions) { + return service.withQuerySync(this.getEndpoint(), this.getName(), id, requestOptions, Context.NONE); + } + + /** + * The withBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withBodyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.withBody(this.getEndpoint(), this.getName(), contentType, body, + requestOptions, context)); + } + + /** + * The withBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withBodySync(this.getEndpoint(), this.getName(), contentType, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MixedParamsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MixedParamsClientImpl.java new file mode 100644 index 00000000000..0c38becf5c3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MixedParamsClientImpl.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the MixedParamsClient type. + */ +public final class MixedParamsClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MixedParamsClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + */ + private final String name; + + /** + * Gets. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * 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; + } + + /** + * Initializes an instance of MixedParamsClient client. + * + * @param endpoint Service host. + * @param name + */ + public MixedParamsClientImpl(String endpoint, String name) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name); + } + + /** + * Initializes an instance of MixedParamsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param name + */ + public MixedParamsClientImpl(HttpPipeline httpPipeline, String endpoint, String name) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name); + } + + /** + * Initializes an instance of MixedParamsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param name + */ + public MixedParamsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + String name) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.name = name; + this.service = RestProxy.create(MixedParamsClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for MixedParamsClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MixedParamsClient") + public interface MixedParamsClientService { + @Get("/azure/client-generator-core/client-initialization/mixed-params/with-query") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withQuery(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, + @QueryParam("region") String region, @QueryParam("id") String id, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/client-initialization/mixed-params/with-query") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withQuerySync(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, + @QueryParam("region") String region, @QueryParam("id") String id, RequestOptions requestOptions, + Context context); + + @Post("/azure/client-generator-core/client-initialization/mixed-params/with-body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withBody(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, + @QueryParam("region") String region, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/azure/client-generator-core/client-initialization/mixed-params/with-body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withBodySync(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, + @QueryParam("region") String region, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The withQuery operation. + * + * @param region The region parameter. + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryWithResponseAsync(String region, String id, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withQuery(this.getEndpoint(), this.getName(), region, id, requestOptions, context)); + } + + /** + * The withQuery operation. + * + * @param region The region parameter. + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryWithResponse(String region, String id, RequestOptions requestOptions) { + return service.withQuerySync(this.getEndpoint(), this.getName(), region, id, requestOptions, Context.NONE); + } + + /** + * The withBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param region The region parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withBodyWithResponseAsync(String region, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.withBody(this.getEndpoint(), this.getName(), region, contentType, + body, requestOptions, context)); + } + + /** + * The withBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param region The region parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withBodyWithResponse(String region, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withBodySync(this.getEndpoint(), this.getName(), region, contentType, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MultipleParamsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MultipleParamsClientImpl.java new file mode 100644 index 00000000000..f3f2e5d8a24 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MultipleParamsClientImpl.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the MultipleParamsClient type. + */ +public final class MultipleParamsClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MultipleParamsClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + */ + private final String name; + + /** + * Gets. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + */ + private final String region; + + /** + * Gets. + * + * @return the region value. + */ + public String getRegion() { + return this.region; + } + + /** + * 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; + } + + /** + * Initializes an instance of MultipleParamsClient client. + * + * @param endpoint Service host. + * @param name + * @param region + */ + public MultipleParamsClientImpl(String endpoint, String name, String region) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name, region); + } + + /** + * Initializes an instance of MultipleParamsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param name + * @param region + */ + public MultipleParamsClientImpl(HttpPipeline httpPipeline, String endpoint, String name, String region) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name, region); + } + + /** + * Initializes an instance of MultipleParamsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param name + * @param region + */ + public MultipleParamsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + String name, String region) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.name = name; + this.region = region; + this.service + = RestProxy.create(MultipleParamsClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for MultipleParamsClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MultipleParamsClient") + public interface MultipleParamsClientService { + @Get("/azure/client-generator-core/client-initialization/multiple-params/with-query") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withQuery(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, + @QueryParam("region") String region, @QueryParam("id") String id, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/client-initialization/multiple-params/with-query") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withQuerySync(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, + @QueryParam("region") String region, @QueryParam("id") String id, RequestOptions requestOptions, + Context context); + + @Post("/azure/client-generator-core/client-initialization/multiple-params/with-body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withBody(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, + @QueryParam("region") String region, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/azure/client-generator-core/client-initialization/multiple-params/with-body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withBodySync(@HostParam("endpoint") String endpoint, @HeaderParam("name") String name, + @QueryParam("region") String region, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The withQuery operation. + * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryWithResponseAsync(String id, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.withQuery(this.getEndpoint(), this.getName(), this.getRegion(), + id, requestOptions, context)); + } + + /** + * The withQuery operation. + * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryWithResponse(String id, RequestOptions requestOptions) { + return service.withQuerySync(this.getEndpoint(), this.getName(), this.getRegion(), id, requestOptions, + Context.NONE); + } + + /** + * The withBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withBodyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.withBody(this.getEndpoint(), this.getName(), this.getRegion(), + contentType, body, requestOptions, context)); + } + + /** + * The withBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withBodySync(this.getEndpoint(), this.getName(), this.getRegion(), contentType, body, + requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParamAliasClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParamAliasClientImpl.java new file mode 100644 index 00000000000..0c1d58cfbce --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParamAliasClientImpl.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ParamAliasClient type. + */ +public final class ParamAliasClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ParamAliasClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + */ + private final String blobName; + + /** + * Gets. + * + * @return the blobName value. + */ + public String getBlobName() { + return this.blobName; + } + + /** + * 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; + } + + /** + * Initializes an instance of ParamAliasClient client. + * + * @param endpoint Service host. + * @param blobName + */ + public ParamAliasClientImpl(String endpoint, String blobName) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, blobName); + } + + /** + * Initializes an instance of ParamAliasClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param blobName + */ + public ParamAliasClientImpl(HttpPipeline httpPipeline, String endpoint, String blobName) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, blobName); + } + + /** + * Initializes an instance of ParamAliasClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param blobName + */ + public ParamAliasClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + String blobName) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.blobName = blobName; + this.service = RestProxy.create(ParamAliasClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ParamAliasClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ParamAliasClient") + public interface ParamAliasClientService { + @Get("/azure/client-generator-core/client-initialization/param-alias/{blob}/with-aliased-name") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withAliasedName(@HostParam("endpoint") String endpoint, @PathParam("blob") String blobName, + RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/client-initialization/param-alias/{blob}/with-aliased-name") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withAliasedNameSync(@HostParam("endpoint") String endpoint, @PathParam("blob") String blobName, + RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/client-initialization/param-alias/{blobName}/with-original-name") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withOriginalName(@HostParam("endpoint") String endpoint, + @PathParam("blobName") String blobName, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/client-initialization/param-alias/{blobName}/with-original-name") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withOriginalNameSync(@HostParam("endpoint") String endpoint, + @PathParam("blobName") String blobName, RequestOptions requestOptions, Context context); + } + + /** + * The withAliasedName operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAliasedNameWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withAliasedName(this.getEndpoint(), this.getBlobName(), requestOptions, context)); + } + + /** + * The withAliasedName operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAliasedNameWithResponse(RequestOptions requestOptions) { + return service.withAliasedNameSync(this.getEndpoint(), this.getBlobName(), requestOptions, Context.NONE); + } + + /** + * The withOriginalName operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withOriginalNameWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withOriginalName(this.getEndpoint(), this.getBlobName(), requestOptions, context)); + } + + /** + * The withOriginalName operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withOriginalNameWithResponse(RequestOptions requestOptions) { + return service.withOriginalNameSync(this.getEndpoint(), this.getBlobName(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParentClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParentClientImpl.java new file mode 100644 index 00000000000..fc97d0a752e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParentClientImpl.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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; +import java.util.Objects; + +/** + * Initializes a new instance of the ParentClient type. + */ +public final class ParentClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of ParentClient client. + * + * @param endpoint Service host. + */ + public ParentClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ParentClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ParentClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ParentClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ParentClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + } + + /** + * Gets an instance of ChildClientImpl class. + * + * @param blobName The blobName parameter. + * @return an instance of ChildClientImpl class. + */ + public ChildClientImpl getChildClient(String blobName) { + Objects.requireNonNull(blobName, "'blobName' cannot be null."); + return new ChildClientImpl(httpPipeline, serializerAdapter, endpoint, blobName); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/PathParamClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/PathParamClientImpl.java new file mode 100644 index 00000000000..7fd730e5700 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/PathParamClientImpl.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the PathParamClient type. + */ +public final class PathParamClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathParamClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + */ + private final String blobName; + + /** + * Gets. + * + * @return the blobName value. + */ + public String getBlobName() { + return this.blobName; + } + + /** + * 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; + } + + /** + * Initializes an instance of PathParamClient client. + * + * @param endpoint Service host. + * @param blobName + */ + public PathParamClientImpl(String endpoint, String blobName) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, blobName); + } + + /** + * Initializes an instance of PathParamClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param blobName + */ + public PathParamClientImpl(HttpPipeline httpPipeline, String endpoint, String blobName) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, blobName); + } + + /** + * Initializes an instance of PathParamClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param blobName + */ + public PathParamClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + String blobName) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.blobName = blobName; + this.service = RestProxy.create(PathParamClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for PathParamClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "PathParamClient") + public interface PathParamClientService { + @Get("/azure/client-generator-core/client-initialization/path/{blobName}/with-query") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withQuery(@HostParam("endpoint") String endpoint, @PathParam("blobName") String blobName, + RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/client-initialization/path/{blobName}/with-query") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withQuerySync(@HostParam("endpoint") String endpoint, @PathParam("blobName") String blobName, + RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/client-initialization/path/{blobName}/get-standalone") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getStandalone(@HostParam("endpoint") String endpoint, + @PathParam("blobName") String blobName, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/client-initialization/path/{blobName}/get-standalone") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getStandaloneSync(@HostParam("endpoint") String endpoint, + @PathParam("blobName") String blobName, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Delete("/azure/client-generator-core/client-initialization/path/{blobName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteStandalone(@HostParam("endpoint") String endpoint, + @PathParam("blobName") String blobName, RequestOptions requestOptions, Context context); + + @Delete("/azure/client-generator-core/client-initialization/path/{blobName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteStandaloneSync(@HostParam("endpoint") String endpoint, + @PathParam("blobName") String blobName, RequestOptions requestOptions, Context context); + } + + /** + * The withQuery operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withQuery(this.getEndpoint(), this.getBlobName(), requestOptions, context)); + } + + /** + * The withQuery operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryWithResponse(RequestOptions requestOptions) { + return service.withQuerySync(this.getEndpoint(), this.getBlobName(), requestOptions, Context.NONE); + } + + /** + * The getStandalone operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     size: long (Required)
+     *     contentType: String (Required)
+     *     createdOn: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return properties of a blob along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStandaloneWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getStandalone(this.getEndpoint(), this.getBlobName(), accept, requestOptions, context)); + } + + /** + * The getStandalone operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     size: long (Required)
+     *     contentType: String (Required)
+     *     createdOn: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return properties of a blob along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getStandaloneWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getStandaloneSync(this.getEndpoint(), this.getBlobName(), accept, requestOptions, Context.NONE); + } + + /** + * The deleteStandalone operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteStandaloneWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.deleteStandalone(this.getEndpoint(), this.getBlobName(), requestOptions, context)); + } + + /** + * The deleteStandalone operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteStandaloneWithResponse(RequestOptions requestOptions) { + return service.deleteStandaloneSync(this.getEndpoint(), this.getBlobName(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/package-info.java new file mode 100644 index 00000000000..b43dea52e01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Service. + * Test for client initialization decorator - moving parameters from method to client level. + * + */ +package azure.clientgenerator.core.clientinitialization.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/BlobProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/BlobProperties.java new file mode 100644 index 00000000000..06b73553c8d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/BlobProperties.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Properties of a blob. + */ +@Immutable +public final class BlobProperties implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The size property. + */ + @Generated + private final long size; + + /* + * The contentType property. + */ + @Generated + private final String contentType; + + /* + * The createdOn property. + */ + @Generated + private final OffsetDateTime createdOn; + + /** + * Creates an instance of BlobProperties class. + * + * @param name the name value to set. + * @param size the size value to set. + * @param contentType the contentType value to set. + * @param createdOn the createdOn value to set. + */ + @Generated + private BlobProperties(String name, long size, String contentType, OffsetDateTime createdOn) { + this.name = name; + this.size = size; + this.contentType = contentType; + this.createdOn = createdOn; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the size property: The size property. + * + * @return the size value. + */ + @Generated + public long getSize() { + return this.size; + } + + /** + * Get the contentType property: The contentType property. + * + * @return the contentType value. + */ + @Generated + public String getContentType() { + return this.contentType; + } + + /** + * Get the createdOn property: The createdOn property. + * + * @return the createdOn value. + */ + @Generated + public OffsetDateTime getCreatedOn() { + return this.createdOn; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeLongField("size", this.size); + jsonWriter.writeStringField("contentType", this.contentType); + jsonWriter.writeStringField("createdOn", + this.createdOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdOn)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BlobProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BlobProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BlobProperties. + */ + @Generated + public static BlobProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + long size = 0L; + String contentType = null; + OffsetDateTime createdOn = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("size".equals(fieldName)) { + size = reader.getLong(); + } else if ("contentType".equals(fieldName)) { + contentType = reader.getString(); + } else if ("createdOn".equals(fieldName)) { + createdOn = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new BlobProperties(name, size, contentType, createdOn); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/Input.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/Input.java new file mode 100644 index 00000000000..3b0429b115c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/Input.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Input model. + */ +@Immutable +public final class Input implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Input class. + * + * @param name the name value to set. + */ + @Generated + public Input(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Input from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Input if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Input. + */ + @Generated + public static Input fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Input(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/WithBodyRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/WithBodyRequest.java new file mode 100644 index 00000000000..f8ff0870726 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/WithBodyRequest.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The WithBodyRequest model. + */ +@Immutable +public final class WithBodyRequest implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of WithBodyRequest class. + * + * @param name the name value to set. + */ + @Generated + public WithBodyRequest(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WithBodyRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WithBodyRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WithBodyRequest. + */ + @Generated + public static WithBodyRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new WithBodyRequest(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/package-info.java new file mode 100644 index 00000000000..c2c747b3cf2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Service. + * Test for client initialization decorator - moving parameters from method to client level. + * + */ +package azure.clientgenerator.core.clientinitialization.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/package-info.java new file mode 100644 index 00000000000..daa49ebd2d7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Service. + * Test for client initialization decorator - moving parameters from method to client level. + * + */ +package azure.clientgenerator.core.clientinitialization; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildAsyncClient.java new file mode 100644 index 00000000000..9c7040e5860 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildAsyncClient.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.parentclient; + +import azure.clientgenerator.core.clientinitialization.implementation.ChildClientImpl; +import azure.clientgenerator.core.clientinitialization.models.BlobProperties; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ChildClient type. + */ +@ServiceClient(builder = ChildClientBuilder.class, isAsync = true) +public final class ChildAsyncClient { + @Generated + private final ChildClientImpl serviceClient; + + /** + * Initializes an instance of ChildAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ChildAsyncClient(ChildClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withQuery operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withQueryWithResponseAsync(requestOptions); + } + + /** + * The getStandalone operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     size: long (Required)
+     *     contentType: String (Required)
+     *     createdOn: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return properties of a blob along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getStandaloneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getStandaloneWithResponseAsync(requestOptions); + } + + /** + * The deleteStandalone operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteStandaloneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.deleteStandaloneWithResponseAsync(requestOptions); + } + + /** + * The withQuery operation. + * + * @param format The format parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withQuery(String format) { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (format != null) { + requestOptions.addQueryParam("format", format, false); + } + return withQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withQuery operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withQuery() { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getStandalone operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a blob on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getStandalone() { + // Generated convenience method for getStandaloneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getStandaloneWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BlobProperties.class)); + } + + /** + * The deleteStandalone operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteStandalone() { + // Generated convenience method for deleteStandaloneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteStandaloneWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClient.java new file mode 100644 index 00000000000..305cf7f8fc1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClient.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.parentclient; + +import azure.clientgenerator.core.clientinitialization.implementation.ChildClientImpl; +import azure.clientgenerator.core.clientinitialization.models.BlobProperties; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous ChildClient type. + */ +@ServiceClient(builder = ChildClientBuilder.class) +public final class ChildClient { + @Generated + private final ChildClientImpl serviceClient; + + /** + * Initializes an instance of ChildClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ChildClient(ChildClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withQuery operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
formatStringNoThe format parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withQueryWithResponse(requestOptions); + } + + /** + * The getStandalone operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     size: long (Required)
+     *     contentType: String (Required)
+     *     createdOn: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return properties of a blob along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getStandaloneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getStandaloneWithResponse(requestOptions); + } + + /** + * The deleteStandalone operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteStandaloneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.deleteStandaloneWithResponse(requestOptions); + } + + /** + * The withQuery operation. + * + * @param format The format parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withQuery(String format) { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (format != null) { + requestOptions.addQueryParam("format", format, false); + } + withQueryWithResponse(requestOptions).getValue(); + } + + /** + * The withQuery operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withQuery() { + // Generated convenience method for withQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + withQueryWithResponse(requestOptions).getValue(); + } + + /** + * The getStandalone operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of a blob. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BlobProperties getStandalone() { + // Generated convenience method for getStandaloneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getStandaloneWithResponse(requestOptions).getValue().toObject(BlobProperties.class); + } + + /** + * The deleteStandalone operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteStandalone() { + // Generated convenience method for deleteStandaloneWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteStandaloneWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClientBuilder.java new file mode 100644 index 00000000000..17c2d148691 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.parentclient; + +import azure.clientgenerator.core.clientinitialization.implementation.ChildClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ChildClient type. + */ +@ServiceClientBuilder(serviceClients = { ChildClient.class, ChildAsyncClient.class }) +public final class ChildClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ChildClientBuilder. + */ + @Generated + public ChildClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ChildClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ChildClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ChildClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ChildClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ChildClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ChildClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ChildClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ChildClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * + */ + @Generated + private String blobName; + + /** + * Sets. + * + * @param blobName the blobName value. + * @return the ChildClientBuilder. + */ + @Generated + public ChildClientBuilder blobName(String blobName) { + this.blobName = blobName; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ChildClientBuilder. + */ + @Generated + public ChildClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ChildClientImpl with the provided parameters. + * + * @return an instance of ChildClientImpl. + */ + @Generated + private ChildClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ChildClientImpl client = new ChildClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + localEndpoint, this.blobName); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(blobName, "'blobName' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ChildAsyncClient class. + * + * @return an instance of ChildAsyncClient. + */ + @Generated + public ChildAsyncClient buildAsyncClient() { + return new ChildAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ChildClient class. + * + * @return an instance of ChildClient. + */ + @Generated + public ChildClient buildClient() { + return new ChildClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ChildClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentAsyncClient.java new file mode 100644 index 00000000000..773affee93b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentAsyncClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.parentclient; + +import azure.clientgenerator.core.clientinitialization.implementation.ParentClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClient; + +/** + * Initializes a new instance of the asynchronous ParentClient type. + */ +@ServiceClient(builder = ParentClientBuilder.class, isAsync = true) +public final class ParentAsyncClient { + @Generated + private final ParentClientImpl serviceClient; + + /** + * Initializes an instance of ParentAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ParentAsyncClient(ParentClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Gets an instance of ChildAsyncClient class. + * + * @param blobName The blobName parameter. + * @return an instance of ChildAsyncClient class. + */ + public ChildAsyncClient getChildAsyncClient(String blobName) { + return new ChildAsyncClient(serviceClient.getChildClient(blobName)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClient.java new file mode 100644 index 00000000000..a0f775904cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.parentclient; + +import azure.clientgenerator.core.clientinitialization.implementation.ParentClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClient; + +/** + * Initializes a new instance of the synchronous ParentClient type. + */ +@ServiceClient(builder = ParentClientBuilder.class) +public final class ParentClient { + @Generated + private final ParentClientImpl serviceClient; + + /** + * Initializes an instance of ParentClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ParentClient(ParentClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Gets an instance of ChildClient class. + * + * @param blobName The blobName parameter. + * @return an instance of ChildClient class. + */ + public ChildClient getChildClient(String blobName) { + return new ChildClient(serviceClient.getChildClient(blobName)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClientBuilder.java new file mode 100644 index 00000000000..cba227f9fba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.parentclient; + +import azure.clientgenerator.core.clientinitialization.implementation.ParentClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ParentClient type. + */ +@ServiceClientBuilder(serviceClients = { ParentClient.class, ParentAsyncClient.class }) +public final class ParentClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-clientinitialization.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ParentClientBuilder. + */ + @Generated + public ParentClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParentClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParentClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParentClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParentClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParentClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParentClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParentClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ParentClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ParentClientBuilder. + */ + @Generated + public ParentClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ParentClientImpl with the provided parameters. + * + * @return an instance of ParentClientImpl. + */ + @Generated + private ParentClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ParentClientImpl client + = new ParentClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ParentAsyncClient class. + * + * @return an instance of ParentAsyncClient. + */ + @Generated + public ParentAsyncClient buildAsyncClient() { + return new ParentAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ParentClient class. + * + * @return an instance of ParentClient. + */ + @Generated + public ParentClient buildClient() { + return new ParentClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ParentClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/package-info.java new file mode 100644 index 00000000000..2eb62c2e3d9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ChildClient. + * Test for client initialization decorator - moving parameters from method to client level. + * + */ +package azure.clientgenerator.core.clientinitialization.parentclient; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsAsyncClient.java new file mode 100644 index 00000000000..704dcc2088a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.ArchiveOperationsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) +public final class ArchiveOperationsAsyncClient { + @Generated + private final ArchiveOperationsImpl serviceClient; + + /** + * Initializes an instance of ArchiveOperationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ArchiveOperationsAsyncClient(ArchiveOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The archiveProduct operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> archiveProductWithResponse(RequestOptions requestOptions) { + return this.serviceClient.archiveProductWithResponseAsync(requestOptions); + } + + /** + * The archiveProduct operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono archiveProduct() { + // Generated convenience method for archiveProductWithResponse + RequestOptions requestOptions = new RequestOptions(); + return archiveProductWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsClient.java new file mode 100644 index 00000000000..8523ce49892 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.ArchiveOperationsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class) +public final class ArchiveOperationsClient { + @Generated + private final ArchiveOperationsImpl serviceClient; + + /** + * Initializes an instance of ArchiveOperationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ArchiveOperationsClient(ArchiveOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The archiveProduct operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response archiveProductWithResponse(RequestOptions requestOptions) { + return this.serviceClient.archiveProductWithResponse(requestOptions); + } + + /** + * The archiveProduct operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void archiveProduct() { + // Generated convenience method for archiveProductWithResponse + RequestOptions requestOptions = new RequestOptions(); + archiveProductWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationAsyncClient.java new file mode 100644 index 00000000000..668979b60f9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.ClientLocationClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) +public final class ClientLocationAsyncClient { + @Generated + private final ClientLocationClientImpl serviceClient; + + /** + * Initializes an instance of ClientLocationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ClientLocationAsyncClient(ClientLocationClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getHealthStatus operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getHealthStatusWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getHealthStatusWithResponseAsync(requestOptions); + } + + /** + * The getHealthStatus operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getHealthStatus() { + // Generated convenience method for getHealthStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getHealthStatusWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClient.java new file mode 100644 index 00000000000..d8fb1cd5337 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.ClientLocationClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class) +public final class ClientLocationClient { + @Generated + private final ClientLocationClientImpl serviceClient; + + /** + * Initializes an instance of ClientLocationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ClientLocationClient(ClientLocationClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getHealthStatus operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getHealthStatusWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getHealthStatusWithResponse(requestOptions); + } + + /** + * The getHealthStatus operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void getHealthStatus() { + // Generated convenience method for getHealthStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + getHealthStatusWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClientBuilder.java new file mode 100644 index 00000000000..0a7ac21a2a3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClientBuilder.java @@ -0,0 +1,445 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.ClientLocationClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ClientLocationClient type. + */ +@ServiceClientBuilder( + serviceClients = { + ClientLocationClient.class, + MoveToExistingSubAdminOperationsClient.class, + MoveToExistingSubUserOperationsClient.class, + MoveToNewSubProductOperationsClient.class, + MoveToRootResourceOperationsClient.class, + MoveMethodParameterToBlobOperationsClient.class, + ArchiveOperationsClient.class, + ClientLocationAsyncClient.class, + MoveToExistingSubAdminOperationsAsyncClient.class, + MoveToExistingSubUserOperationsAsyncClient.class, + MoveToNewSubProductOperationsAsyncClient.class, + MoveToRootResourceOperationsAsyncClient.class, + MoveMethodParameterToBlobOperationsAsyncClient.class, + ArchiveOperationsAsyncClient.class }) +public final class ClientLocationClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-clientlocation.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ClientLocationClientBuilder. + */ + @Generated + public ClientLocationClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientLocationClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientLocationClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientLocationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientLocationClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientLocationClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientLocationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientLocationClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientLocationClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * + */ + @Generated + private String storageAccount; + + /** + * Sets. + * + * @param storageAccount the storageAccount value. + * @return the ClientLocationClientBuilder. + */ + @Generated + public ClientLocationClientBuilder storageAccount(String storageAccount) { + this.storageAccount = storageAccount; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ClientLocationClientBuilder. + */ + @Generated + public ClientLocationClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ClientLocationClientImpl with the provided parameters. + * + * @return an instance of ClientLocationClientImpl. + */ + @Generated + private ClientLocationClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ClientLocationClientImpl client = new ClientLocationClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, this.storageAccount); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(storageAccount, "'storageAccount' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ClientLocationAsyncClient class. + * + * @return an instance of ClientLocationAsyncClient. + */ + @Generated + public ClientLocationAsyncClient buildAsyncClient() { + return new ClientLocationAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of MoveToExistingSubAdminOperationsAsyncClient class. + * + * @return an instance of MoveToExistingSubAdminOperationsAsyncClient. + */ + @Generated + public MoveToExistingSubAdminOperationsAsyncClient buildMoveToExistingSubAdminOperationsAsyncClient() { + return new MoveToExistingSubAdminOperationsAsyncClient( + buildInnerClient().getMoveToExistingSubAdminOperations()); + } + + /** + * Builds an instance of MoveToExistingSubUserOperationsAsyncClient class. + * + * @return an instance of MoveToExistingSubUserOperationsAsyncClient. + */ + @Generated + public MoveToExistingSubUserOperationsAsyncClient buildMoveToExistingSubUserOperationsAsyncClient() { + return new MoveToExistingSubUserOperationsAsyncClient(buildInnerClient().getMoveToExistingSubUserOperations()); + } + + /** + * Builds an instance of MoveToNewSubProductOperationsAsyncClient class. + * + * @return an instance of MoveToNewSubProductOperationsAsyncClient. + */ + @Generated + public MoveToNewSubProductOperationsAsyncClient buildMoveToNewSubProductOperationsAsyncClient() { + return new MoveToNewSubProductOperationsAsyncClient(buildInnerClient().getMoveToNewSubProductOperations()); + } + + /** + * Builds an instance of MoveToRootResourceOperationsAsyncClient class. + * + * @return an instance of MoveToRootResourceOperationsAsyncClient. + */ + @Generated + public MoveToRootResourceOperationsAsyncClient buildMoveToRootResourceOperationsAsyncClient() { + return new MoveToRootResourceOperationsAsyncClient(buildInnerClient().getMoveToRootResourceOperations()); + } + + /** + * Builds an instance of MoveMethodParameterToBlobOperationsAsyncClient class. + * + * @return an instance of MoveMethodParameterToBlobOperationsAsyncClient. + */ + @Generated + public MoveMethodParameterToBlobOperationsAsyncClient buildMoveMethodParameterToBlobOperationsAsyncClient() { + return new MoveMethodParameterToBlobOperationsAsyncClient( + buildInnerClient().getMoveMethodParameterToBlobOperations()); + } + + /** + * Builds an instance of ArchiveOperationsAsyncClient class. + * + * @return an instance of ArchiveOperationsAsyncClient. + */ + @Generated + public ArchiveOperationsAsyncClient buildArchiveOperationsAsyncClient() { + return new ArchiveOperationsAsyncClient(buildInnerClient().getArchiveOperations()); + } + + /** + * Builds an instance of ClientLocationClient class. + * + * @return an instance of ClientLocationClient. + */ + @Generated + public ClientLocationClient buildClient() { + return new ClientLocationClient(buildInnerClient()); + } + + /** + * Builds an instance of MoveToExistingSubAdminOperationsClient class. + * + * @return an instance of MoveToExistingSubAdminOperationsClient. + */ + @Generated + public MoveToExistingSubAdminOperationsClient buildMoveToExistingSubAdminOperationsClient() { + return new MoveToExistingSubAdminOperationsClient(buildInnerClient().getMoveToExistingSubAdminOperations()); + } + + /** + * Builds an instance of MoveToExistingSubUserOperationsClient class. + * + * @return an instance of MoveToExistingSubUserOperationsClient. + */ + @Generated + public MoveToExistingSubUserOperationsClient buildMoveToExistingSubUserOperationsClient() { + return new MoveToExistingSubUserOperationsClient(buildInnerClient().getMoveToExistingSubUserOperations()); + } + + /** + * Builds an instance of MoveToNewSubProductOperationsClient class. + * + * @return an instance of MoveToNewSubProductOperationsClient. + */ + @Generated + public MoveToNewSubProductOperationsClient buildMoveToNewSubProductOperationsClient() { + return new MoveToNewSubProductOperationsClient(buildInnerClient().getMoveToNewSubProductOperations()); + } + + /** + * Builds an instance of MoveToRootResourceOperationsClient class. + * + * @return an instance of MoveToRootResourceOperationsClient. + */ + @Generated + public MoveToRootResourceOperationsClient buildMoveToRootResourceOperationsClient() { + return new MoveToRootResourceOperationsClient(buildInnerClient().getMoveToRootResourceOperations()); + } + + /** + * Builds an instance of MoveMethodParameterToBlobOperationsClient class. + * + * @return an instance of MoveMethodParameterToBlobOperationsClient. + */ + @Generated + public MoveMethodParameterToBlobOperationsClient buildMoveMethodParameterToBlobOperationsClient() { + return new MoveMethodParameterToBlobOperationsClient( + buildInnerClient().getMoveMethodParameterToBlobOperations()); + } + + /** + * Builds an instance of ArchiveOperationsClient class. + * + * @return an instance of ArchiveOperationsClient. + */ + @Generated + public ArchiveOperationsClient buildArchiveOperationsClient() { + return new ArchiveOperationsClient(buildInnerClient().getArchiveOperations()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientLocationClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsAsyncClient.java new file mode 100644 index 00000000000..5e91ff5f4c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsAsyncClient.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.MoveMethodParameterToBlobOperationsImpl; +import azure.clientgenerator.core.clientlocation.movemethodparametertoclient.models.Blob; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) +public final class MoveMethodParameterToBlobOperationsAsyncClient { + @Generated + private final MoveMethodParameterToBlobOperationsImpl serviceClient; + + /** + * Initializes an instance of MoveMethodParameterToBlobOperationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MoveMethodParameterToBlobOperationsAsyncClient(MoveMethodParameterToBlobOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getBlob operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     size: int (Required)
+     *     path: String (Required)
+     * }
+     * }
+     * 
+ * + * @param container The container parameter. + * @param blob The blob parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getBlobWithResponse(String container, String blob, + RequestOptions requestOptions) { + return this.serviceClient.getBlobWithResponseAsync(container, blob, requestOptions); + } + + /** + * The getBlob operation. + * + * @param container The container parameter. + * @param blob The blob parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getBlob(String container, String blob) { + // Generated convenience method for getBlobWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getBlobWithResponse(container, blob, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Blob.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsClient.java new file mode 100644 index 00000000000..4e22ce39cde --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsClient.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.MoveMethodParameterToBlobOperationsImpl; +import azure.clientgenerator.core.clientlocation.movemethodparametertoclient.models.Blob; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class) +public final class MoveMethodParameterToBlobOperationsClient { + @Generated + private final MoveMethodParameterToBlobOperationsImpl serviceClient; + + /** + * Initializes an instance of MoveMethodParameterToBlobOperationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MoveMethodParameterToBlobOperationsClient(MoveMethodParameterToBlobOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getBlob operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     size: int (Required)
+     *     path: String (Required)
+     * }
+     * }
+     * 
+ * + * @param container The container parameter. + * @param blob The blob parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getBlobWithResponse(String container, String blob, RequestOptions requestOptions) { + return this.serviceClient.getBlobWithResponse(container, blob, requestOptions); + } + + /** + * The getBlob operation. + * + * @param container The container parameter. + * @param blob The blob parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Blob getBlob(String container, String blob) { + // Generated convenience method for getBlobWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getBlobWithResponse(container, blob, requestOptions).getValue().toObject(Blob.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsAsyncClient.java new file mode 100644 index 00000000000..0b8f5b68f08 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsAsyncClient.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.MoveToExistingSubAdminOperationsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) +public final class MoveToExistingSubAdminOperationsAsyncClient { + @Generated + private final MoveToExistingSubAdminOperationsImpl serviceClient; + + /** + * Initializes an instance of MoveToExistingSubAdminOperationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MoveToExistingSubAdminOperationsAsyncClient(MoveToExistingSubAdminOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getAdminInfo operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAdminInfoWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAdminInfoWithResponseAsync(requestOptions); + } + + /** + * The deleteUser operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteUserWithResponse(RequestOptions requestOptions) { + return this.serviceClient.deleteUserWithResponseAsync(requestOptions); + } + + /** + * The getAdminInfo operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAdminInfo() { + // Generated convenience method for getAdminInfoWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAdminInfoWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The deleteUser operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteUser() { + // Generated convenience method for deleteUserWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteUserWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsClient.java new file mode 100644 index 00000000000..7341dd9d9c4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsClient.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.MoveToExistingSubAdminOperationsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class) +public final class MoveToExistingSubAdminOperationsClient { + @Generated + private final MoveToExistingSubAdminOperationsImpl serviceClient; + + /** + * Initializes an instance of MoveToExistingSubAdminOperationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MoveToExistingSubAdminOperationsClient(MoveToExistingSubAdminOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getAdminInfo operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAdminInfoWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAdminInfoWithResponse(requestOptions); + } + + /** + * The deleteUser operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteUserWithResponse(RequestOptions requestOptions) { + return this.serviceClient.deleteUserWithResponse(requestOptions); + } + + /** + * The getAdminInfo operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void getAdminInfo() { + // Generated convenience method for getAdminInfoWithResponse + RequestOptions requestOptions = new RequestOptions(); + getAdminInfoWithResponse(requestOptions).getValue(); + } + + /** + * The deleteUser operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteUser() { + // Generated convenience method for deleteUserWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteUserWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsAsyncClient.java new file mode 100644 index 00000000000..05ac9a7aa29 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.MoveToExistingSubUserOperationsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) +public final class MoveToExistingSubUserOperationsAsyncClient { + @Generated + private final MoveToExistingSubUserOperationsImpl serviceClient; + + /** + * Initializes an instance of MoveToExistingSubUserOperationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MoveToExistingSubUserOperationsAsyncClient(MoveToExistingSubUserOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getUser operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getUserWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getUserWithResponseAsync(requestOptions); + } + + /** + * The getUser operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getUser() { + // Generated convenience method for getUserWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getUserWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsClient.java new file mode 100644 index 00000000000..9110b923029 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.MoveToExistingSubUserOperationsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class) +public final class MoveToExistingSubUserOperationsClient { + @Generated + private final MoveToExistingSubUserOperationsImpl serviceClient; + + /** + * Initializes an instance of MoveToExistingSubUserOperationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MoveToExistingSubUserOperationsClient(MoveToExistingSubUserOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getUser operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getUserWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getUserWithResponse(requestOptions); + } + + /** + * The getUser operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void getUser() { + // Generated convenience method for getUserWithResponse + RequestOptions requestOptions = new RequestOptions(); + getUserWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsAsyncClient.java new file mode 100644 index 00000000000..3b107568da7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.MoveToNewSubProductOperationsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) +public final class MoveToNewSubProductOperationsAsyncClient { + @Generated + private final MoveToNewSubProductOperationsImpl serviceClient; + + /** + * Initializes an instance of MoveToNewSubProductOperationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MoveToNewSubProductOperationsAsyncClient(MoveToNewSubProductOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The listProducts operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listProductsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listProductsWithResponseAsync(requestOptions); + } + + /** + * The listProducts operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listProducts() { + // Generated convenience method for listProductsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listProductsWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsClient.java new file mode 100644 index 00000000000..dc42847624b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.MoveToNewSubProductOperationsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class) +public final class MoveToNewSubProductOperationsClient { + @Generated + private final MoveToNewSubProductOperationsImpl serviceClient; + + /** + * Initializes an instance of MoveToNewSubProductOperationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MoveToNewSubProductOperationsClient(MoveToNewSubProductOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The listProducts operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listProductsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listProductsWithResponse(requestOptions); + } + + /** + * The listProducts operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void listProducts() { + // Generated convenience method for listProductsWithResponse + RequestOptions requestOptions = new RequestOptions(); + listProductsWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsAsyncClient.java new file mode 100644 index 00000000000..f650251c67b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.MoveToRootResourceOperationsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class, isAsync = true) +public final class MoveToRootResourceOperationsAsyncClient { + @Generated + private final MoveToRootResourceOperationsImpl serviceClient; + + /** + * Initializes an instance of MoveToRootResourceOperationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MoveToRootResourceOperationsAsyncClient(MoveToRootResourceOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getResource operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getResourceWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getResourceWithResponseAsync(requestOptions); + } + + /** + * The getResource operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getResource() { + // Generated convenience method for getResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getResourceWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsClient.java new file mode 100644 index 00000000000..8f0a554943b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.implementation.MoveToRootResourceOperationsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ClientLocationClient type. + */ +@ServiceClient(builder = ClientLocationClientBuilder.class) +public final class MoveToRootResourceOperationsClient { + @Generated + private final MoveToRootResourceOperationsImpl serviceClient; + + /** + * Initializes an instance of MoveToRootResourceOperationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MoveToRootResourceOperationsClient(MoveToRootResourceOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getResource operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getResourceWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getResourceWithResponse(requestOptions); + } + + /** + * The getResource operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void getResource() { + // Generated convenience method for getResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + getResourceWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ArchiveOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ArchiveOperationsImpl.java new file mode 100644 index 00000000000..1e30253f634 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ArchiveOperationsImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ArchiveOperations. + */ +public final class ArchiveOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ArchiveOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ClientLocationClientImpl client; + + /** + * Initializes an instance of ArchiveOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ArchiveOperationsImpl(ClientLocationClientImpl client) { + this.service + = RestProxy.create(ArchiveOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ClientLocationClientArchiveOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ClientLocationClientArchiveOperations") + public interface ArchiveOperationsService { + @Post("/azure/client-generator-core/client-location/products/archive") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> archiveProduct(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Post("/azure/client-generator-core/client-location/products/archive") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response archiveProductSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The archiveProduct operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> archiveProductWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.archiveProduct(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The archiveProduct operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response archiveProductWithResponse(RequestOptions requestOptions) { + return service.archiveProductSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ClientLocationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ClientLocationClientImpl.java new file mode 100644 index 00000000000..30cbbf6a0a9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/ClientLocationClientImpl.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ClientLocationClient type. + */ +public final class ClientLocationClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ClientLocationClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + */ + private final String storageAccount; + + /** + * Gets. + * + * @return the storageAccount value. + */ + public String getStorageAccount() { + return this.storageAccount; + } + + /** + * 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 MoveToExistingSubAdminOperationsImpl object to access its operations. + */ + private final MoveToExistingSubAdminOperationsImpl moveToExistingSubAdminOperations; + + /** + * Gets the MoveToExistingSubAdminOperationsImpl object to access its operations. + * + * @return the MoveToExistingSubAdminOperationsImpl object. + */ + public MoveToExistingSubAdminOperationsImpl getMoveToExistingSubAdminOperations() { + return this.moveToExistingSubAdminOperations; + } + + /** + * The MoveToExistingSubUserOperationsImpl object to access its operations. + */ + private final MoveToExistingSubUserOperationsImpl moveToExistingSubUserOperations; + + /** + * Gets the MoveToExistingSubUserOperationsImpl object to access its operations. + * + * @return the MoveToExistingSubUserOperationsImpl object. + */ + public MoveToExistingSubUserOperationsImpl getMoveToExistingSubUserOperations() { + return this.moveToExistingSubUserOperations; + } + + /** + * The MoveToNewSubProductOperationsImpl object to access its operations. + */ + private final MoveToNewSubProductOperationsImpl moveToNewSubProductOperations; + + /** + * Gets the MoveToNewSubProductOperationsImpl object to access its operations. + * + * @return the MoveToNewSubProductOperationsImpl object. + */ + public MoveToNewSubProductOperationsImpl getMoveToNewSubProductOperations() { + return this.moveToNewSubProductOperations; + } + + /** + * The MoveToRootResourceOperationsImpl object to access its operations. + */ + private final MoveToRootResourceOperationsImpl moveToRootResourceOperations; + + /** + * Gets the MoveToRootResourceOperationsImpl object to access its operations. + * + * @return the MoveToRootResourceOperationsImpl object. + */ + public MoveToRootResourceOperationsImpl getMoveToRootResourceOperations() { + return this.moveToRootResourceOperations; + } + + /** + * The MoveMethodParameterToBlobOperationsImpl object to access its operations. + */ + private final MoveMethodParameterToBlobOperationsImpl moveMethodParameterToBlobOperations; + + /** + * Gets the MoveMethodParameterToBlobOperationsImpl object to access its operations. + * + * @return the MoveMethodParameterToBlobOperationsImpl object. + */ + public MoveMethodParameterToBlobOperationsImpl getMoveMethodParameterToBlobOperations() { + return this.moveMethodParameterToBlobOperations; + } + + /** + * The ArchiveOperationsImpl object to access its operations. + */ + private final ArchiveOperationsImpl archiveOperations; + + /** + * Gets the ArchiveOperationsImpl object to access its operations. + * + * @return the ArchiveOperationsImpl object. + */ + public ArchiveOperationsImpl getArchiveOperations() { + return this.archiveOperations; + } + + /** + * Initializes an instance of ClientLocationClient client. + * + * @param endpoint Service host. + * @param storageAccount + */ + public ClientLocationClientImpl(String endpoint, String storageAccount) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, storageAccount); + } + + /** + * Initializes an instance of ClientLocationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param storageAccount + */ + public ClientLocationClientImpl(HttpPipeline httpPipeline, String endpoint, String storageAccount) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, storageAccount); + } + + /** + * Initializes an instance of ClientLocationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param storageAccount + */ + public ClientLocationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + String storageAccount) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.storageAccount = storageAccount; + this.moveToExistingSubAdminOperations = new MoveToExistingSubAdminOperationsImpl(this); + this.moveToExistingSubUserOperations = new MoveToExistingSubUserOperationsImpl(this); + this.moveToNewSubProductOperations = new MoveToNewSubProductOperationsImpl(this); + this.moveToRootResourceOperations = new MoveToRootResourceOperationsImpl(this); + this.moveMethodParameterToBlobOperations = new MoveMethodParameterToBlobOperationsImpl(this); + this.archiveOperations = new ArchiveOperationsImpl(this); + this.service + = RestProxy.create(ClientLocationClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ClientLocationClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ClientLocationClient") + public interface ClientLocationClientService { + @Get("/azure/client-generator-core/client-location/health") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getHealthStatus(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/client-location/health") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getHealthStatusSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The getHealthStatus operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getHealthStatusWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.getHealthStatus(this.getEndpoint(), requestOptions, context)); + } + + /** + * The getHealthStatus operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getHealthStatusWithResponse(RequestOptions requestOptions) { + return service.getHealthStatusSync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveMethodParameterToBlobOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveMethodParameterToBlobOperationsImpl.java new file mode 100644 index 00000000000..99a148e1cce --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveMethodParameterToBlobOperationsImpl.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MoveMethodParameterToBlobOperations. + */ +public final class MoveMethodParameterToBlobOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MoveMethodParameterToBlobOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ClientLocationClientImpl client; + + /** + * Initializes an instance of MoveMethodParameterToBlobOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MoveMethodParameterToBlobOperationsImpl(ClientLocationClientImpl client) { + this.service = RestProxy.create(MoveMethodParameterToBlobOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ClientLocationClientMoveMethodParameterToBlobOperations to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ClientLocationClientMoveMethodParameterToBlobOperations") + public interface MoveMethodParameterToBlobOperationsService { + @Get("/azure/client-generator-core/client-location/blob") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getBlob(@HostParam("endpoint") String endpoint, + @QueryParam("storageAccount") String storageAccount, @QueryParam("container") String container, + @QueryParam("blob") String blob, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/client-location/blob") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getBlobSync(@HostParam("endpoint") String endpoint, + @QueryParam("storageAccount") String storageAccount, @QueryParam("container") String container, + @QueryParam("blob") String blob, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * The getBlob operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     size: int (Required)
+     *     path: String (Required)
+     * }
+     * }
+     * 
+ * + * @param container The container parameter. + * @param blob The blob parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getBlobWithResponseAsync(String container, String blob, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getBlob(this.client.getEndpoint(), + this.client.getStorageAccount(), container, blob, accept, requestOptions, context)); + } + + /** + * The getBlob operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     size: int (Required)
+     *     path: String (Required)
+     * }
+     * }
+     * 
+ * + * @param container The container parameter. + * @param blob The blob parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getBlobWithResponse(String container, String blob, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getBlobSync(this.client.getEndpoint(), this.client.getStorageAccount(), container, blob, accept, + requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubAdminOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubAdminOperationsImpl.java new file mode 100644 index 00000000000..c03618651f0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubAdminOperationsImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MoveToExistingSubAdminOperations. + */ +public final class MoveToExistingSubAdminOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MoveToExistingSubAdminOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ClientLocationClientImpl client; + + /** + * Initializes an instance of MoveToExistingSubAdminOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MoveToExistingSubAdminOperationsImpl(ClientLocationClientImpl client) { + this.service = RestProxy.create(MoveToExistingSubAdminOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ClientLocationClientMoveToExistingSubAdminOperations to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ClientLocationClientMoveToExistingSubAdminOperations") + public interface MoveToExistingSubAdminOperationsService { + @Get("/azure/client-generator-core/client-location/admin") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAdminInfo(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/client-location/admin") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAdminInfoSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Delete("/azure/client-generator-core/client-location/user") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteUser(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Delete("/azure/client-generator-core/client-location/user") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteUserSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The getAdminInfo operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAdminInfoWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.getAdminInfo(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The getAdminInfo operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAdminInfoWithResponse(RequestOptions requestOptions) { + return service.getAdminInfoSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The deleteUser operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteUserWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.deleteUser(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The deleteUser operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteUserWithResponse(RequestOptions requestOptions) { + return service.deleteUserSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubUserOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubUserOperationsImpl.java new file mode 100644 index 00000000000..16f04a75d53 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubUserOperationsImpl.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MoveToExistingSubUserOperations. + */ +public final class MoveToExistingSubUserOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MoveToExistingSubUserOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ClientLocationClientImpl client; + + /** + * Initializes an instance of MoveToExistingSubUserOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MoveToExistingSubUserOperationsImpl(ClientLocationClientImpl client) { + this.service = RestProxy.create(MoveToExistingSubUserOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ClientLocationClientMoveToExistingSubUserOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ClientLocationClientMoveToExistingSubUserOperations") + public interface MoveToExistingSubUserOperationsService { + @Get("/azure/client-generator-core/client-location/user") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getUser(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/client-location/user") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getUserSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The getUser operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getUserWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.getUser(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The getUser operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getUserWithResponse(RequestOptions requestOptions) { + return service.getUserSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToNewSubProductOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToNewSubProductOperationsImpl.java new file mode 100644 index 00000000000..a8c443b0f9f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToNewSubProductOperationsImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MoveToNewSubProductOperations. + */ +public final class MoveToNewSubProductOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MoveToNewSubProductOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ClientLocationClientImpl client; + + /** + * Initializes an instance of MoveToNewSubProductOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MoveToNewSubProductOperationsImpl(ClientLocationClientImpl client) { + this.service = RestProxy.create(MoveToNewSubProductOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ClientLocationClientMoveToNewSubProductOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ClientLocationClientMoveToNewSubProductOperations") + public interface MoveToNewSubProductOperationsService { + @Get("/azure/client-generator-core/client-location/products") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listProducts(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/client-location/products") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listProductsSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The listProducts operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listProductsWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.listProducts(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The listProducts operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listProductsWithResponse(RequestOptions requestOptions) { + return service.listProductsSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToRootResourceOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToRootResourceOperationsImpl.java new file mode 100644 index 00000000000..ff5f211a921 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToRootResourceOperationsImpl.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MoveToRootResourceOperations. + */ +public final class MoveToRootResourceOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MoveToRootResourceOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ClientLocationClientImpl client; + + /** + * Initializes an instance of MoveToRootResourceOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MoveToRootResourceOperationsImpl(ClientLocationClientImpl client) { + this.service = RestProxy.create(MoveToRootResourceOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ClientLocationClientMoveToRootResourceOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ClientLocationClientMoveToRootResourceOperations") + public interface MoveToRootResourceOperationsService { + @Get("/azure/client-generator-core/client-location/resource") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getResource(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/azure/client-generator-core/client-location/resource") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getResourceSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The getResource operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getResourceWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.getResource(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The getResource operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getResourceWithResponse(RequestOptions requestOptions) { + return service.getResourceSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/package-info.java new file mode 100644 index 00000000000..5015b7891bc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ClientLocation. + * Test for @clientLocation decorator - moving operations between clients. + * + */ +package azure.clientgenerator.core.clientlocation.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/Blob.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/Blob.java new file mode 100644 index 00000000000..73c2a582eae --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/Blob.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation.movemethodparametertoclient.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Blob model. + */ +@Immutable +public final class Blob implements JsonSerializable { + /* + * The id property. + */ + @Generated + private final String id; + + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The size property. + */ + @Generated + private final int size; + + /* + * The path property. + */ + @Generated + private final String path; + + /** + * Creates an instance of Blob class. + * + * @param id the id value to set. + * @param name the name value to set. + * @param size the size value to set. + * @param path the path value to set. + */ + @Generated + private Blob(String id, String name, int size, String path) { + this.id = id; + this.name = name; + this.size = size; + this.path = path; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the size property: The size property. + * + * @return the size value. + */ + @Generated + public int getSize() { + return this.size; + } + + /** + * Get the path property: The path property. + * + * @return the path value. + */ + @Generated + public String getPath() { + return this.path; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeIntField("size", this.size); + jsonWriter.writeStringField("path", this.path); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Blob from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Blob if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Blob. + */ + @Generated + public static Blob fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + int size = 0; + String path = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("size".equals(fieldName)) { + size = reader.getInt(); + } else if ("path".equals(fieldName)) { + path = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Blob(id, name, size, path); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/package-info.java new file mode 100644 index 00000000000..1dda884bd3e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for ClientLocation. + * Test for @clientLocation decorator - moving operations between clients. + * + */ +package azure.clientgenerator.core.clientlocation.movemethodparametertoclient.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/package-info.java new file mode 100644 index 00000000000..71104e04270 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/clientlocation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ClientLocation. + * Test for @clientLocation decorator - moving operations between clients. + * + */ +package azure.clientgenerator.core.clientlocation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullAsyncClient.java new file mode 100644 index 00000000000..924ed44e4be --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullAsyncClient.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.deserialize.emptystringnull; + +import azure.clientgenerator.core.deserialize.emptystringnull.implementation.DeserializeEmptyStringAsNullClientImpl; +import azure.clientgenerator.core.deserialize.emptystringnull.models.ResponseModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DeserializeEmptyStringAsNullClient type. + */ +@ServiceClient(builder = DeserializeEmptyStringAsNullClientBuilder.class, isAsync = true) +public final class DeserializeEmptyStringAsNullAsyncClient { + @Generated + private final DeserializeEmptyStringAsNullClientImpl serviceClient; + + /** + * Initializes an instance of DeserializeEmptyStringAsNullAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DeserializeEmptyStringAsNullAsyncClient(DeserializeEmptyStringAsNullClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     sampleUrl: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is a Model contains a string-like property of type url along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is a Model contains a string-like property of type url on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ResponseModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClient.java new file mode 100644 index 00000000000..c0756b069a3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.deserialize.emptystringnull; + +import azure.clientgenerator.core.deserialize.emptystringnull.implementation.DeserializeEmptyStringAsNullClientImpl; +import azure.clientgenerator.core.deserialize.emptystringnull.models.ResponseModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous DeserializeEmptyStringAsNullClient type. + */ +@ServiceClient(builder = DeserializeEmptyStringAsNullClientBuilder.class) +public final class DeserializeEmptyStringAsNullClient { + @Generated + private final DeserializeEmptyStringAsNullClientImpl serviceClient; + + /** + * Initializes an instance of DeserializeEmptyStringAsNullClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DeserializeEmptyStringAsNullClient(DeserializeEmptyStringAsNullClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     sampleUrl: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is a Model contains a string-like property of type url along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is a Model contains a string-like property of type url. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseModel get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(ResponseModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClientBuilder.java new file mode 100644 index 00000000000..3f32e73f0c5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClientBuilder.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.deserialize.emptystringnull; + +import azure.clientgenerator.core.deserialize.emptystringnull.implementation.DeserializeEmptyStringAsNullClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the DeserializeEmptyStringAsNullClient type. + */ +@ServiceClientBuilder( + serviceClients = { DeserializeEmptyStringAsNullClient.class, DeserializeEmptyStringAsNullAsyncClient.class }) +public final class DeserializeEmptyStringAsNullClientBuilder implements + HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-deserialize-emptystringnull.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the DeserializeEmptyStringAsNullClientBuilder. + */ + @Generated + public DeserializeEmptyStringAsNullClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeserializeEmptyStringAsNullClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeserializeEmptyStringAsNullClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeserializeEmptyStringAsNullClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeserializeEmptyStringAsNullClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeserializeEmptyStringAsNullClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeserializeEmptyStringAsNullClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeserializeEmptyStringAsNullClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DeserializeEmptyStringAsNullClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the DeserializeEmptyStringAsNullClientBuilder. + */ + @Generated + public DeserializeEmptyStringAsNullClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of DeserializeEmptyStringAsNullClientImpl with the provided parameters. + * + * @return an instance of DeserializeEmptyStringAsNullClientImpl. + */ + @Generated + private DeserializeEmptyStringAsNullClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + DeserializeEmptyStringAsNullClientImpl client = new DeserializeEmptyStringAsNullClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of DeserializeEmptyStringAsNullAsyncClient class. + * + * @return an instance of DeserializeEmptyStringAsNullAsyncClient. + */ + @Generated + public DeserializeEmptyStringAsNullAsyncClient buildAsyncClient() { + return new DeserializeEmptyStringAsNullAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of DeserializeEmptyStringAsNullClient class. + * + * @return an instance of DeserializeEmptyStringAsNullClient. + */ + @Generated + public DeserializeEmptyStringAsNullClient buildClient() { + return new DeserializeEmptyStringAsNullClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(DeserializeEmptyStringAsNullClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/DeserializeEmptyStringAsNullClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/DeserializeEmptyStringAsNullClientImpl.java new file mode 100644 index 00000000000..e7d485fc2df --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/DeserializeEmptyStringAsNullClientImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.deserialize.emptystringnull.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the DeserializeEmptyStringAsNullClient type. + */ +public final class DeserializeEmptyStringAsNullClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DeserializeEmptyStringAsNullClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of DeserializeEmptyStringAsNullClient client. + * + * @param endpoint Service host. + */ + public DeserializeEmptyStringAsNullClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DeserializeEmptyStringAsNullClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public DeserializeEmptyStringAsNullClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DeserializeEmptyStringAsNullClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public DeserializeEmptyStringAsNullClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(DeserializeEmptyStringAsNullClientService.class, this.httpPipeline, + this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for DeserializeEmptyStringAsNullClient to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DeserializeEmptyStringAsNullClient") + public interface DeserializeEmptyStringAsNullClientService { + @Get("/azure/client-generator-core/deserialize-empty-string-as-null/responseModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/deserialize-empty-string-as-null/responseModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     sampleUrl: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is a Model contains a string-like property of type url along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     sampleUrl: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is a Model contains a string-like property of type url along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/package-info.java new file mode 100644 index 00000000000..8fcdc6340ea --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for DeserializeEmptyStringAsNull. + * Test decorator @deserializeEmptyStringAsNull. + * + */ +package azure.clientgenerator.core.deserialize.emptystringnull.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/ResponseModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/ResponseModel.java new file mode 100644 index 00000000000..19416a61421 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/ResponseModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.deserialize.emptystringnull.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is a Model contains a string-like property of type url. + */ +@Immutable +public final class ResponseModel implements JsonSerializable { + /* + * The sampleUrl property. + */ + @Generated + private final String sampleUrl; + + /** + * Creates an instance of ResponseModel class. + * + * @param sampleUrl the sampleUrl value to set. + */ + @Generated + private ResponseModel(String sampleUrl) { + this.sampleUrl = sampleUrl; + } + + /** + * Get the sampleUrl property: The sampleUrl property. + * + * @return the sampleUrl value. + */ + @Generated + public String getSampleUrl() { + return this.sampleUrl; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sampleUrl", this.sampleUrl); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResponseModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResponseModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResponseModel. + */ + @Generated + public static ResponseModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String sampleUrl = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sampleUrl".equals(fieldName)) { + sampleUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ResponseModel(sampleUrl); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/package-info.java new file mode 100644 index 00000000000..381ca26c64a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for DeserializeEmptyStringAsNull. + * Test decorator @deserializeEmptyStringAsNull. + * + */ +package azure.clientgenerator.core.deserialize.emptystringnull.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/package-info.java new file mode 100644 index 00000000000..fc1a2aae117 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for DeserializeEmptyStringAsNull. + * Test decorator @deserializeEmptyStringAsNull. + * + */ +package azure.clientgenerator.core.deserialize.emptystringnull; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyAsyncClient.java new file mode 100644 index 00000000000..e4dd5e633de --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyAsyncClient.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.flattenproperty; + +import azure.clientgenerator.core.flattenproperty.implementation.FlattenPropertyClientImpl; +import azure.clientgenerator.core.flattenproperty.models.FlattenModel; +import azure.clientgenerator.core.flattenproperty.models.NestedFlattenModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous FlattenPropertyClient type. + */ +@ServiceClient(builder = FlattenPropertyClientBuilder.class, isAsync = true) +public final class FlattenPropertyAsyncClient { + @Generated + private final FlattenPropertyClientImpl serviceClient; + + /** + * Initializes an instance of FlattenPropertyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FlattenPropertyAsyncClient(FlattenPropertyClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The putFlattenModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         description: String (Required)
+     *         age: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         description: String (Required)
+     *         age: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is the model with one level of flattening along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putFlattenModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putFlattenModelWithResponseAsync(input, requestOptions); + } + + /** + * The putNestedFlattenModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         summary: String (Required)
+     *         properties (Required): {
+     *             description: String (Required)
+     *             age: int (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         summary: String (Required)
+     *         properties (Required): {
+     *             description: String (Required)
+     *             age: int (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is the model with two levels of flattening along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putNestedFlattenModelWithResponse(BinaryData input, + RequestOptions requestOptions) { + return this.serviceClient.putNestedFlattenModelWithResponseAsync(input, requestOptions); + } + + /** + * The putFlattenModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the model with one level of flattening on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putFlattenModel(FlattenModel input) { + // Generated convenience method for putFlattenModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putFlattenModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FlattenModel.class)); + } + + /** + * The putNestedFlattenModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the model with two levels of flattening on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putNestedFlattenModel(NestedFlattenModel input) { + // Generated convenience method for putNestedFlattenModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putNestedFlattenModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(NestedFlattenModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClient.java new file mode 100644 index 00000000000..6df185bf86f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClient.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.flattenproperty; + +import azure.clientgenerator.core.flattenproperty.implementation.FlattenPropertyClientImpl; +import azure.clientgenerator.core.flattenproperty.models.FlattenModel; +import azure.clientgenerator.core.flattenproperty.models.NestedFlattenModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous FlattenPropertyClient type. + */ +@ServiceClient(builder = FlattenPropertyClientBuilder.class) +public final class FlattenPropertyClient { + @Generated + private final FlattenPropertyClientImpl serviceClient; + + /** + * Initializes an instance of FlattenPropertyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FlattenPropertyClient(FlattenPropertyClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The putFlattenModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         description: String (Required)
+     *         age: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         description: String (Required)
+     *         age: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is the model with one level of flattening along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putFlattenModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putFlattenModelWithResponse(input, requestOptions); + } + + /** + * The putNestedFlattenModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         summary: String (Required)
+     *         properties (Required): {
+     *             description: String (Required)
+     *             age: int (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         summary: String (Required)
+     *         properties (Required): {
+     *             description: String (Required)
+     *             age: int (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is the model with two levels of flattening along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putNestedFlattenModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putNestedFlattenModelWithResponse(input, requestOptions); + } + + /** + * The putFlattenModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the model with one level of flattening. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FlattenModel putFlattenModel(FlattenModel input) { + // Generated convenience method for putFlattenModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putFlattenModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue() + .toObject(FlattenModel.class); + } + + /** + * The putNestedFlattenModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the model with two levels of flattening. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public NestedFlattenModel putNestedFlattenModel(NestedFlattenModel input) { + // Generated convenience method for putNestedFlattenModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putNestedFlattenModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue() + .toObject(NestedFlattenModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClientBuilder.java new file mode 100644 index 00000000000..c5e49b6f3d8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.flattenproperty; + +import azure.clientgenerator.core.flattenproperty.implementation.FlattenPropertyClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the FlattenPropertyClient type. + */ +@ServiceClientBuilder(serviceClients = { FlattenPropertyClient.class, FlattenPropertyAsyncClient.class }) +public final class FlattenPropertyClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-flattenproperty.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the FlattenPropertyClientBuilder. + */ + @Generated + public FlattenPropertyClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenPropertyClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenPropertyClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenPropertyClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenPropertyClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenPropertyClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenPropertyClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenPropertyClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenPropertyClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the FlattenPropertyClientBuilder. + */ + @Generated + public FlattenPropertyClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of FlattenPropertyClientImpl with the provided parameters. + * + * @return an instance of FlattenPropertyClientImpl. + */ + @Generated + private FlattenPropertyClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + FlattenPropertyClientImpl client = new FlattenPropertyClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of FlattenPropertyAsyncClient class. + * + * @return an instance of FlattenPropertyAsyncClient. + */ + @Generated + public FlattenPropertyAsyncClient buildAsyncClient() { + return new FlattenPropertyAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of FlattenPropertyClient class. + * + * @return an instance of FlattenPropertyClient. + */ + @Generated + public FlattenPropertyClient buildClient() { + return new FlattenPropertyClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(FlattenPropertyClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/FlattenPropertyClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/FlattenPropertyClientImpl.java new file mode 100644 index 00000000000..b15d7fb3eb2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/FlattenPropertyClientImpl.java @@ -0,0 +1,368 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.flattenproperty.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the FlattenPropertyClient type. + */ +public final class FlattenPropertyClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FlattenPropertyClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of FlattenPropertyClient client. + * + * @param endpoint Service host. + */ + public FlattenPropertyClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of FlattenPropertyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public FlattenPropertyClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of FlattenPropertyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public FlattenPropertyClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(FlattenPropertyClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for FlattenPropertyClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "FlattenPropertyClient") + public interface FlattenPropertyClientService { + @Put("/azure/client-generator-core/flatten-property/flattenModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putFlattenModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/flatten-property/flattenModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putFlattenModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/flatten-property/nestedFlattenModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putNestedFlattenModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/flatten-property/nestedFlattenModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putNestedFlattenModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + } + + /** + * The putFlattenModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         description: String (Required)
+     *         age: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         description: String (Required)
+     *         age: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is the model with one level of flattening along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putFlattenModelWithResponseAsync(BinaryData input, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.putFlattenModel(this.getEndpoint(), contentType, accept, input, + requestOptions, context)); + } + + /** + * The putFlattenModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         description: String (Required)
+     *         age: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         description: String (Required)
+     *         age: int (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is the model with one level of flattening along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putFlattenModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putFlattenModelSync(this.getEndpoint(), contentType, accept, input, requestOptions, + Context.NONE); + } + + /** + * The putNestedFlattenModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         summary: String (Required)
+     *         properties (Required): {
+     *             description: String (Required)
+     *             age: int (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         summary: String (Required)
+     *         properties (Required): {
+     *             description: String (Required)
+     *             age: int (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is the model with two levels of flattening along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putNestedFlattenModelWithResponseAsync(BinaryData input, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.putNestedFlattenModel(this.getEndpoint(), contentType, accept, + input, requestOptions, context)); + } + + /** + * The putNestedFlattenModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         summary: String (Required)
+     *         properties (Required): {
+     *             description: String (Required)
+     *             age: int (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     properties (Required): {
+     *         summary: String (Required)
+     *         properties (Required): {
+     *             description: String (Required)
+     *             age: int (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is the model with two levels of flattening along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putNestedFlattenModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putNestedFlattenModelSync(this.getEndpoint(), contentType, accept, input, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/package-info.java new file mode 100644 index 00000000000..55c70816957 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for FlattenProperty. + * Illustrates the model flatten cases. + * + */ +package azure.clientgenerator.core.flattenproperty.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildFlattenModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildFlattenModel.java new file mode 100644 index 00000000000..f09ff20f276 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildFlattenModel.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.flattenproperty.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is the child model to be flattened. And it has flattened property as well. + */ +@Immutable +public final class ChildFlattenModel implements JsonSerializable { + /* + * The summary property. + */ + @Generated + private final String summary; + + /* + * The properties property. + */ + @Generated + private final ChildModel properties; + + /** + * Creates an instance of ChildFlattenModel class. + * + * @param summary the summary value to set. + * @param properties the properties value to set. + */ + @Generated + public ChildFlattenModel(String summary, ChildModel properties) { + this.summary = summary; + this.properties = properties; + } + + /** + * Get the summary property: The summary property. + * + * @return the summary value. + */ + @Generated + public String getSummary() { + return this.summary; + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + @Generated + public ChildModel getProperties() { + return this.properties; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("summary", this.summary); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChildFlattenModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChildFlattenModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ChildFlattenModel. + */ + @Generated + public static ChildFlattenModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String summary = null; + ChildModel properties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("summary".equals(fieldName)) { + summary = reader.getString(); + } else if ("properties".equals(fieldName)) { + properties = ChildModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new ChildFlattenModel(summary, properties); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildModel.java new file mode 100644 index 00000000000..2fd844a0cee --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildModel.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.flattenproperty.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is the child model to be flattened. + */ +@Immutable +public final class ChildModel implements JsonSerializable { + /* + * The description property. + */ + @Generated + private final String description; + + /* + * The age property. + */ + @Generated + private final int age; + + /** + * Creates an instance of ChildModel class. + * + * @param description the description value to set. + * @param age the age value to set. + */ + @Generated + public ChildModel(String description, int age) { + this.description = description; + this.age = age; + } + + /** + * Get the description property: The description property. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Get the age property: The age property. + * + * @return the age value. + */ + @Generated + public int getAge() { + return this.age; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeIntField("age", this.age); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChildModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChildModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ChildModel. + */ + @Generated + public static ChildModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String description = null; + int age = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("age".equals(fieldName)) { + age = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new ChildModel(description, age); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/FlattenModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/FlattenModel.java new file mode 100644 index 00000000000..973aacf162a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/FlattenModel.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.flattenproperty.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is the model with one level of flattening. + */ +@Immutable +public final class FlattenModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The properties property. + */ + @Generated + private final ChildModel properties; + + /** + * Creates an instance of FlattenModel class. + * + * @param name the name value to set. + * @param properties the properties value to set. + */ + @Generated + public FlattenModel(String name, ChildModel properties) { + this.name = name; + this.properties = properties; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + @Generated + public ChildModel getProperties() { + return this.properties; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FlattenModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FlattenModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FlattenModel. + */ + @Generated + public static FlattenModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + ChildModel properties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("properties".equals(fieldName)) { + properties = ChildModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new FlattenModel(name, properties); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/NestedFlattenModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/NestedFlattenModel.java new file mode 100644 index 00000000000..976248cc9a7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/NestedFlattenModel.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.flattenproperty.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is the model with two levels of flattening. + */ +@Immutable +public final class NestedFlattenModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The properties property. + */ + @Generated + private final ChildFlattenModel properties; + + /** + * Creates an instance of NestedFlattenModel class. + * + * @param name the name value to set. + * @param properties the properties value to set. + */ + @Generated + public NestedFlattenModel(String name, ChildFlattenModel properties) { + this.name = name; + this.properties = properties; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + @Generated + public ChildFlattenModel getProperties() { + return this.properties; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NestedFlattenModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NestedFlattenModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NestedFlattenModel. + */ + @Generated + public static NestedFlattenModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + ChildFlattenModel properties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("properties".equals(fieldName)) { + properties = ChildFlattenModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new NestedFlattenModel(name, properties); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/package-info.java new file mode 100644 index 00000000000..ae162abe0de --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for FlattenProperty. + * Illustrates the model flatten cases. + * + */ +package azure.clientgenerator.core.flattenproperty.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/package-info.java new file mode 100644 index 00000000000..afccbab87b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/flattenproperty/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for FlattenProperty. + * Illustrates the model flatten cases. + * + */ +package azure.clientgenerator.core.flattenproperty; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsAsyncClient.java new file mode 100644 index 00000000000..3f529464029 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsAsyncClient.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding; + +import azure.clientgenerator.core.hierarchybuilding.implementation.AnimalOperationsImpl; +import azure.clientgenerator.core.hierarchybuilding.models.Animal; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous HierarchyBuildingClient type. + */ +@ServiceClient(builder = HierarchyBuildingClientBuilder.class, isAsync = true) +public final class AnimalOperationsAsyncClient { + @Generated + private final AnimalOperationsImpl serviceClient; + + /** + * Initializes an instance of AnimalOperationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AnimalOperationsAsyncClient(AnimalOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Update a pet as an animal. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param animal The animal parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updatePetAsAnimalWithResponse(BinaryData animal, RequestOptions requestOptions) { + return this.serviceClient.updatePetAsAnimalWithResponseAsync(animal, requestOptions); + } + + /** + * Update a dog as an animal. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param animal The animal parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateDogAsAnimalWithResponse(BinaryData animal, RequestOptions requestOptions) { + return this.serviceClient.updateDogAsAnimalWithResponseAsync(animal, requestOptions); + } + + /** + * Update a pet as an animal. + * + * @param animal The animal parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updatePetAsAnimal(Animal animal) { + // Generated convenience method for updatePetAsAnimalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updatePetAsAnimalWithResponse(BinaryData.fromObject(animal), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Animal.class)); + } + + /** + * Update a dog as an animal. + * + * @param animal The animal parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateDogAsAnimal(Animal animal) { + // Generated convenience method for updateDogAsAnimalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateDogAsAnimalWithResponse(BinaryData.fromObject(animal), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Animal.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsClient.java new file mode 100644 index 00000000000..3d9bf2dadf4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsClient.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding; + +import azure.clientgenerator.core.hierarchybuilding.implementation.AnimalOperationsImpl; +import azure.clientgenerator.core.hierarchybuilding.models.Animal; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous HierarchyBuildingClient type. + */ +@ServiceClient(builder = HierarchyBuildingClientBuilder.class) +public final class AnimalOperationsClient { + @Generated + private final AnimalOperationsImpl serviceClient; + + /** + * Initializes an instance of AnimalOperationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AnimalOperationsClient(AnimalOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Update a pet as an animal. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param animal The animal parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updatePetAsAnimalWithResponse(BinaryData animal, RequestOptions requestOptions) { + return this.serviceClient.updatePetAsAnimalWithResponse(animal, requestOptions); + } + + /** + * Update a dog as an animal. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param animal The animal parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateDogAsAnimalWithResponse(BinaryData animal, RequestOptions requestOptions) { + return this.serviceClient.updateDogAsAnimalWithResponse(animal, requestOptions); + } + + /** + * Update a pet as an animal. + * + * @param animal The animal parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Animal updatePetAsAnimal(Animal animal) { + // Generated convenience method for updatePetAsAnimalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updatePetAsAnimalWithResponse(BinaryData.fromObject(animal), requestOptions).getValue() + .toObject(Animal.class); + } + + /** + * Update a dog as an animal. + * + * @param animal The animal parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Animal updateDogAsAnimal(Animal animal) { + // Generated convenience method for updateDogAsAnimalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateDogAsAnimalWithResponse(BinaryData.fromObject(animal), requestOptions).getValue() + .toObject(Animal.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsAsyncClient.java new file mode 100644 index 00000000000..86a4eb9b9f1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsAsyncClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding; + +import azure.clientgenerator.core.hierarchybuilding.implementation.DogOperationsImpl; +import azure.clientgenerator.core.hierarchybuilding.models.Dog; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous HierarchyBuildingClient type. + */ +@ServiceClient(builder = HierarchyBuildingClientBuilder.class, isAsync = true) +public final class DogOperationsAsyncClient { + @Generated + private final DogOperationsImpl serviceClient; + + /** + * Initializes an instance of DogOperationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DogOperationsAsyncClient(DogOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Update a dog as a dog. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     *     breed: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     *     breed: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateDogAsDogWithResponse(BinaryData dog, RequestOptions requestOptions) { + return this.serviceClient.updateDogAsDogWithResponseAsync(dog, requestOptions); + } + + /** + * Update a dog as a dog. + * + * @param dog The dog parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateDogAsDog(Dog dog) { + // Generated convenience method for updateDogAsDogWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateDogAsDogWithResponse(BinaryData.fromObject(dog), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsClient.java new file mode 100644 index 00000000000..813fe651d7f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsClient.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding; + +import azure.clientgenerator.core.hierarchybuilding.implementation.DogOperationsImpl; +import azure.clientgenerator.core.hierarchybuilding.models.Dog; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous HierarchyBuildingClient type. + */ +@ServiceClient(builder = HierarchyBuildingClientBuilder.class) +public final class DogOperationsClient { + @Generated + private final DogOperationsImpl serviceClient; + + /** + * Initializes an instance of DogOperationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DogOperationsClient(DogOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Update a dog as a dog. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     *     breed: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     *     breed: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateDogAsDogWithResponse(BinaryData dog, RequestOptions requestOptions) { + return this.serviceClient.updateDogAsDogWithResponse(dog, requestOptions); + } + + /** + * Update a dog as a dog. + * + * @param dog The dog parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Dog updateDogAsDog(Dog dog) { + // Generated convenience method for updateDogAsDogWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateDogAsDogWithResponse(BinaryData.fromObject(dog), requestOptions).getValue().toObject(Dog.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/HierarchyBuildingClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/HierarchyBuildingClientBuilder.java new file mode 100644 index 00000000000..f1fecd5e481 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/HierarchyBuildingClientBuilder.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding; + +import azure.clientgenerator.core.hierarchybuilding.implementation.HierarchyBuildingClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the HierarchyBuildingClient type. + */ +@ServiceClientBuilder( + serviceClients = { + AnimalOperationsClient.class, + PetOperationsClient.class, + DogOperationsClient.class, + AnimalOperationsAsyncClient.class, + PetOperationsAsyncClient.class, + DogOperationsAsyncClient.class }) +public final class HierarchyBuildingClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-hierarchybuilding.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the HierarchyBuildingClientBuilder. + */ + @Generated + public HierarchyBuildingClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HierarchyBuildingClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HierarchyBuildingClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HierarchyBuildingClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HierarchyBuildingClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HierarchyBuildingClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HierarchyBuildingClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HierarchyBuildingClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public HierarchyBuildingClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the HierarchyBuildingClientBuilder. + */ + @Generated + public HierarchyBuildingClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of HierarchyBuildingClientImpl with the provided parameters. + * + * @return an instance of HierarchyBuildingClientImpl. + */ + @Generated + private HierarchyBuildingClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + HierarchyBuildingClientImpl client = new HierarchyBuildingClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of AnimalOperationsAsyncClient class. + * + * @return an instance of AnimalOperationsAsyncClient. + */ + @Generated + public AnimalOperationsAsyncClient buildAnimalOperationsAsyncClient() { + return new AnimalOperationsAsyncClient(buildInnerClient().getAnimalOperations()); + } + + /** + * Builds an instance of PetOperationsAsyncClient class. + * + * @return an instance of PetOperationsAsyncClient. + */ + @Generated + public PetOperationsAsyncClient buildPetOperationsAsyncClient() { + return new PetOperationsAsyncClient(buildInnerClient().getPetOperations()); + } + + /** + * Builds an instance of DogOperationsAsyncClient class. + * + * @return an instance of DogOperationsAsyncClient. + */ + @Generated + public DogOperationsAsyncClient buildDogOperationsAsyncClient() { + return new DogOperationsAsyncClient(buildInnerClient().getDogOperations()); + } + + /** + * Builds an instance of AnimalOperationsClient class. + * + * @return an instance of AnimalOperationsClient. + */ + @Generated + public AnimalOperationsClient buildAnimalOperationsClient() { + return new AnimalOperationsClient(buildInnerClient().getAnimalOperations()); + } + + /** + * Builds an instance of PetOperationsClient class. + * + * @return an instance of PetOperationsClient. + */ + @Generated + public PetOperationsClient buildPetOperationsClient() { + return new PetOperationsClient(buildInnerClient().getPetOperations()); + } + + /** + * Builds an instance of DogOperationsClient class. + * + * @return an instance of DogOperationsClient. + */ + @Generated + public DogOperationsClient buildDogOperationsClient() { + return new DogOperationsClient(buildInnerClient().getDogOperations()); + } + + private static final ClientLogger LOGGER = new ClientLogger(HierarchyBuildingClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsAsyncClient.java new file mode 100644 index 00000000000..1600097887a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsAsyncClient.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding; + +import azure.clientgenerator.core.hierarchybuilding.implementation.PetOperationsImpl; +import azure.clientgenerator.core.hierarchybuilding.models.Pet; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous HierarchyBuildingClient type. + */ +@ServiceClient(builder = HierarchyBuildingClientBuilder.class, isAsync = true) +public final class PetOperationsAsyncClient { + @Generated + private final PetOperationsImpl serviceClient; + + /** + * Initializes an instance of PetOperationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PetOperationsAsyncClient(PetOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Update a pet as a pet. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param pet The pet parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updatePetAsPetWithResponse(BinaryData pet, RequestOptions requestOptions) { + return this.serviceClient.updatePetAsPetWithResponseAsync(pet, requestOptions); + } + + /** + * Update a dog as a pet. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param pet The pet parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateDogAsPetWithResponse(BinaryData pet, RequestOptions requestOptions) { + return this.serviceClient.updateDogAsPetWithResponseAsync(pet, requestOptions); + } + + /** + * Update a pet as a pet. + * + * @param pet The pet parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updatePetAsPet(Pet pet) { + // Generated convenience method for updatePetAsPetWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updatePetAsPetWithResponse(BinaryData.fromObject(pet), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Pet.class)); + } + + /** + * Update a dog as a pet. + * + * @param pet The pet parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateDogAsPet(Pet pet) { + // Generated convenience method for updateDogAsPetWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateDogAsPetWithResponse(BinaryData.fromObject(pet), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Pet.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsClient.java new file mode 100644 index 00000000000..dfa76fa5482 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsClient.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding; + +import azure.clientgenerator.core.hierarchybuilding.implementation.PetOperationsImpl; +import azure.clientgenerator.core.hierarchybuilding.models.Pet; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous HierarchyBuildingClient type. + */ +@ServiceClient(builder = HierarchyBuildingClientBuilder.class) +public final class PetOperationsClient { + @Generated + private final PetOperationsImpl serviceClient; + + /** + * Initializes an instance of PetOperationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PetOperationsClient(PetOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Update a pet as a pet. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param pet The pet parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updatePetAsPetWithResponse(BinaryData pet, RequestOptions requestOptions) { + return this.serviceClient.updatePetAsPetWithResponse(pet, requestOptions); + } + + /** + * Update a dog as a pet. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param pet The pet parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateDogAsPetWithResponse(BinaryData pet, RequestOptions requestOptions) { + return this.serviceClient.updateDogAsPetWithResponse(pet, requestOptions); + } + + /** + * Update a pet as a pet. + * + * @param pet The pet parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Pet updatePetAsPet(Pet pet) { + // Generated convenience method for updatePetAsPetWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updatePetAsPetWithResponse(BinaryData.fromObject(pet), requestOptions).getValue().toObject(Pet.class); + } + + /** + * Update a dog as a pet. + * + * @param pet The pet parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Pet updateDogAsPet(Pet pet) { + // Generated convenience method for updateDogAsPetWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateDogAsPetWithResponse(BinaryData.fromObject(pet), requestOptions).getValue().toObject(Pet.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/AnimalOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/AnimalOperationsImpl.java new file mode 100644 index 00000000000..71d67baf7b8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/AnimalOperationsImpl.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AnimalOperations. + */ +public final class AnimalOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final AnimalOperationsService service; + + /** + * The service client containing this operation class. + */ + private final HierarchyBuildingClientImpl client; + + /** + * Initializes an instance of AnimalOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AnimalOperationsImpl(HierarchyBuildingClientImpl client) { + this.service + = RestProxy.create(AnimalOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HierarchyBuildingClientAnimalOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "HierarchyBuildingClientAnimalOperations") + public interface AnimalOperationsService { + @Put("/azure/client-generator-core/hierarchy-building/pet/as-animal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updatePetAsAnimal(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData animal, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/hierarchy-building/pet/as-animal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updatePetAsAnimalSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData animal, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/hierarchy-building/dog/as-animal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateDogAsAnimal(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData animal, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/hierarchy-building/dog/as-animal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateDogAsAnimalSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData animal, RequestOptions requestOptions, Context context); + } + + /** + * Update a pet as an animal. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param animal The animal parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updatePetAsAnimalWithResponseAsync(BinaryData animal, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updatePetAsAnimal(this.client.getEndpoint(), contentType, accept, + animal, requestOptions, context)); + } + + /** + * Update a pet as an animal. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param animal The animal parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updatePetAsAnimalWithResponse(BinaryData animal, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updatePetAsAnimalSync(this.client.getEndpoint(), contentType, accept, animal, requestOptions, + Context.NONE); + } + + /** + * Update a dog as an animal. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param animal The animal parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateDogAsAnimalWithResponseAsync(BinaryData animal, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updateDogAsAnimal(this.client.getEndpoint(), contentType, accept, + animal, requestOptions, context)); + } + + /** + * Update a dog as an animal. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param animal The animal parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateDogAsAnimalWithResponse(BinaryData animal, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateDogAsAnimalSync(this.client.getEndpoint(), contentType, accept, animal, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/DogOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/DogOperationsImpl.java new file mode 100644 index 00000000000..54e4d0acc12 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/DogOperationsImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DogOperations. + */ +public final class DogOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DogOperationsService service; + + /** + * The service client containing this operation class. + */ + private final HierarchyBuildingClientImpl client; + + /** + * Initializes an instance of DogOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DogOperationsImpl(HierarchyBuildingClientImpl client) { + this.service + = RestProxy.create(DogOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HierarchyBuildingClientDogOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "HierarchyBuildingClientDogOperations") + public interface DogOperationsService { + @Put("/azure/client-generator-core/hierarchy-building/dog/as-dog") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateDogAsDog(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/hierarchy-building/dog/as-dog") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateDogAsDogSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); + } + + /** + * Update a dog as a dog. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     *     breed: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     *     breed: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateDogAsDogWithResponseAsync(BinaryData dog, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updateDogAsDog(this.client.getEndpoint(), contentType, accept, + dog, requestOptions, context)); + } + + /** + * Update a dog as a dog. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     *     breed: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     *     breed: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateDogAsDogWithResponse(BinaryData dog, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateDogAsDogSync(this.client.getEndpoint(), contentType, accept, dog, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/HierarchyBuildingClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/HierarchyBuildingClientImpl.java new file mode 100644 index 00000000000..0fdca8bab26 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/HierarchyBuildingClientImpl.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 HierarchyBuildingClient type. + */ +public final class HierarchyBuildingClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 AnimalOperationsImpl object to access its operations. + */ + private final AnimalOperationsImpl animalOperations; + + /** + * Gets the AnimalOperationsImpl object to access its operations. + * + * @return the AnimalOperationsImpl object. + */ + public AnimalOperationsImpl getAnimalOperations() { + return this.animalOperations; + } + + /** + * The PetOperationsImpl object to access its operations. + */ + private final PetOperationsImpl petOperations; + + /** + * Gets the PetOperationsImpl object to access its operations. + * + * @return the PetOperationsImpl object. + */ + public PetOperationsImpl getPetOperations() { + return this.petOperations; + } + + /** + * The DogOperationsImpl object to access its operations. + */ + private final DogOperationsImpl dogOperations; + + /** + * Gets the DogOperationsImpl object to access its operations. + * + * @return the DogOperationsImpl object. + */ + public DogOperationsImpl getDogOperations() { + return this.dogOperations; + } + + /** + * Initializes an instance of HierarchyBuildingClient client. + * + * @param endpoint Service host. + */ + public HierarchyBuildingClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of HierarchyBuildingClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public HierarchyBuildingClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of HierarchyBuildingClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public HierarchyBuildingClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.animalOperations = new AnimalOperationsImpl(this); + this.petOperations = new PetOperationsImpl(this); + this.dogOperations = new DogOperationsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/PetOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/PetOperationsImpl.java new file mode 100644 index 00000000000..4d8d85821cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/PetOperationsImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PetOperations. + */ +public final class PetOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PetOperationsService service; + + /** + * The service client containing this operation class. + */ + private final HierarchyBuildingClientImpl client; + + /** + * Initializes an instance of PetOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PetOperationsImpl(HierarchyBuildingClientImpl client) { + this.service + = RestProxy.create(PetOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HierarchyBuildingClientPetOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "HierarchyBuildingClientPetOperations") + public interface PetOperationsService { + @Put("/azure/client-generator-core/hierarchy-building/pet/as-pet") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updatePetAsPet(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData pet, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/hierarchy-building/pet/as-pet") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updatePetAsPetSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData pet, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/hierarchy-building/dog/as-pet") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateDogAsPet(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData pet, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/hierarchy-building/dog/as-pet") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateDogAsPetSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData pet, RequestOptions requestOptions, Context context); + } + + /** + * Update a pet as a pet. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param pet The pet parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updatePetAsPetWithResponseAsync(BinaryData pet, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updatePetAsPet(this.client.getEndpoint(), contentType, accept, + pet, requestOptions, context)); + } + + /** + * Update a pet as a pet. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param pet The pet parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updatePetAsPetWithResponse(BinaryData pet, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updatePetAsPetSync(this.client.getEndpoint(), contentType, accept, pet, requestOptions, + Context.NONE); + } + + /** + * Update a dog as a pet. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param pet The pet parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateDogAsPetWithResponseAsync(BinaryData pet, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updateDogAsPet(this.client.getEndpoint(), contentType, accept, + pet, requestOptions, context)); + } + + /** + * Update a dog as a pet. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *     trained: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param pet The pet parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateDogAsPetWithResponse(BinaryData pet, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateDogAsPetSync(this.client.getEndpoint(), contentType, accept, pet, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/package-info.java new file mode 100644 index 00000000000..c2f03d0a8c9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for HierarchyBuilding. + * Test for @hierarchyBuilding decorator. + * + */ +package azure.clientgenerator.core.hierarchybuilding.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Animal.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Animal.java new file mode 100644 index 00000000000..ffee228ac27 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Animal.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Animal model. + */ +@Immutable +public class Animal implements JsonSerializable { + /* + * The kind of animal + */ + @Generated + private String kind = "Animal"; + + /* + * Name of the animal + */ + @Generated + private final String name; + + /** + * Creates an instance of Animal class. + * + * @param name the name value to set. + */ + @Generated + public Animal(String name) { + this.name = name; + } + + /** + * Get the kind property: The kind of animal. + * + * @return the kind value. + */ + @Generated + public String getKind() { + return this.kind; + } + + /** + * Get the name property: Name of the animal. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Animal from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Animal if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Animal. + */ + @Generated + public static Animal fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("pet".equals(discriminatorValue)) { + return Pet.fromJsonKnownDiscriminator(readerToUse.reset()); + } else if ("dog".equals(discriminatorValue)) { + return Dog.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Animal fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String kind = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + Animal deserializedAnimal = new Animal(name); + deserializedAnimal.kind = kind; + + return deserializedAnimal; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Dog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Dog.java new file mode 100644 index 00000000000..e4022f5e308 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Dog.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Dog model. + */ +@Immutable +public final class Dog extends Pet { + /* + * The kind property. + */ + @Generated + private String kind = "dog"; + + /* + * The breed of the dog + */ + @Generated + private final String breed; + + /** + * Creates an instance of Dog class. + * + * @param name the name value to set. + * @param trained the trained value to set. + * @param breed the breed value to set. + */ + @Generated + public Dog(String name, boolean trained, String breed) { + super(name, trained); + this.breed = breed; + } + + /** + * Get the kind property: The kind property. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * Get the breed property: The breed of the dog. + * + * @return the breed value. + */ + @Generated + public String getBreed() { + return this.breed; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeBooleanField("trained", isTrained()); + jsonWriter.writeStringField("breed", this.breed); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dog from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dog if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Dog. + */ + @Generated + public static Dog fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + boolean trained = false; + String breed = null; + String kind = "dog"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("trained".equals(fieldName)) { + trained = reader.getBoolean(); + } else if ("breed".equals(fieldName)) { + breed = reader.getString(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + Dog deserializedDog = new Dog(name, trained, breed); + deserializedDog.kind = kind; + + return deserializedDog; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Pet.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Pet.java new file mode 100644 index 00000000000..5b834dd247d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Pet.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Pet model. + */ +@Immutable +public class Pet extends Animal { + /* + * The kind property. + */ + @Generated + private String kind = "pet"; + + /* + * Whether the pet is trained + */ + @Generated + private final boolean trained; + + /** + * Creates an instance of Pet class. + * + * @param name the name value to set. + * @param trained the trained value to set. + */ + @Generated + public Pet(String name, boolean trained) { + super(name); + this.trained = trained; + } + + /** + * Get the kind property: The kind property. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * Get the trained property: Whether the pet is trained. + * + * @return the trained value. + */ + @Generated + public boolean isTrained() { + return this.trained; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeBooleanField("trained", this.trained); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Pet from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Pet if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Pet. + */ + @Generated + public static Pet fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("dog".equals(discriminatorValue)) { + return Dog.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Pet fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + boolean trained = false; + String kind = "pet"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("trained".equals(fieldName)) { + trained = reader.getBoolean(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + Pet deserializedPet = new Pet(name, trained); + deserializedPet.kind = kind; + + return deserializedPet; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/package-info.java new file mode 100644 index 00000000000..631f1b5d26a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for HierarchyBuilding. + * Test for @hierarchyBuilding decorator. + * + */ +package azure.clientgenerator.core.hierarchybuilding.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/package-info.java new file mode 100644 index 00000000000..db4fb851dd6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/hierarchybuilding/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for HierarchyBuilding. + * Test for @hierarchyBuilding decorator. + * + */ +package azure.clientgenerator.core.hierarchybuilding; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java new file mode 100644 index 00000000000..c70d5799f04 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride; + +import azure.clientgenerator.core.methodoverride.implementation.GroupParametersImpl; +import azure.clientgenerator.core.methodoverride.models.GroupParametersOptions; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous OverrideClient type. + */ +@ServiceClient(builder = OverrideClientBuilder.class, isAsync = true) +public final class GroupParametersAsyncClient { + @Generated + private final GroupParametersImpl serviceClient; + + /** + * Initializes an instance of GroupParametersAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + GroupParametersAsyncClient(GroupParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The group operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupWithResponse(String param1, String param2, RequestOptions requestOptions) { + return this.serviceClient.groupWithResponseAsync(param1, param2, requestOptions); + } + + /** + * The group operation. + * + * @param options The options parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono group(GroupParametersOptions options) { + // Generated convenience method for groupWithResponse + RequestOptions requestOptions = new RequestOptions(); + String param1 = options.getParam1(); + String param2 = options.getParam2(); + return groupWithResponse(param1, param2, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java new file mode 100644 index 00000000000..66d1ae1fe96 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride; + +import azure.clientgenerator.core.methodoverride.implementation.GroupParametersImpl; +import azure.clientgenerator.core.methodoverride.models.GroupParametersOptions; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous OverrideClient type. + */ +@ServiceClient(builder = OverrideClientBuilder.class) +public final class GroupParametersClient { + @Generated + private final GroupParametersImpl serviceClient; + + /** + * Initializes an instance of GroupParametersClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + GroupParametersClient(GroupParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The group operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupWithResponse(String param1, String param2, RequestOptions requestOptions) { + return this.serviceClient.groupWithResponse(param1, param2, requestOptions); + } + + /** + * The group operation. + * + * @param options The options parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void group(GroupParametersOptions options) { + // Generated convenience method for groupWithResponse + RequestOptions requestOptions = new RequestOptions(); + String param1 = options.getParam1(); + String param2 = options.getParam2(); + groupWithResponse(param1, param2, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/OverrideClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/OverrideClientBuilder.java new file mode 100644 index 00000000000..4bd811b5ae6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/OverrideClientBuilder.java @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride; + +import azure.clientgenerator.core.methodoverride.implementation.OverrideClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the OverrideClient type. + */ +@ServiceClientBuilder( + serviceClients = { + ReorderParametersClient.class, + GroupParametersClient.class, + RequireOptionalParameterClient.class, + RemoveOptionalParameterClient.class, + ReorderParametersAsyncClient.class, + GroupParametersAsyncClient.class, + RequireOptionalParameterAsyncClient.class, + RemoveOptionalParameterAsyncClient.class }) +public final class OverrideClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-methodoverride.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the OverrideClientBuilder. + */ + @Generated + public OverrideClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverrideClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverrideClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverrideClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverrideClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverrideClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverrideClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverrideClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverrideClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the OverrideClientBuilder. + */ + @Generated + public OverrideClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of OverrideClientImpl with the provided parameters. + * + * @return an instance of OverrideClientImpl. + */ + @Generated + private OverrideClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + OverrideClientImpl client + = new OverrideClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ReorderParametersAsyncClient class. + * + * @return an instance of ReorderParametersAsyncClient. + */ + @Generated + public ReorderParametersAsyncClient buildReorderParametersAsyncClient() { + return new ReorderParametersAsyncClient(buildInnerClient().getReorderParameters()); + } + + /** + * Builds an instance of GroupParametersAsyncClient class. + * + * @return an instance of GroupParametersAsyncClient. + */ + @Generated + public GroupParametersAsyncClient buildGroupParametersAsyncClient() { + return new GroupParametersAsyncClient(buildInnerClient().getGroupParameters()); + } + + /** + * Builds an instance of RequireOptionalParameterAsyncClient class. + * + * @return an instance of RequireOptionalParameterAsyncClient. + */ + @Generated + public RequireOptionalParameterAsyncClient buildRequireOptionalParameterAsyncClient() { + return new RequireOptionalParameterAsyncClient(buildInnerClient().getRequireOptionalParameters()); + } + + /** + * Builds an instance of RemoveOptionalParameterAsyncClient class. + * + * @return an instance of RemoveOptionalParameterAsyncClient. + */ + @Generated + public RemoveOptionalParameterAsyncClient buildRemoveOptionalParameterAsyncClient() { + return new RemoveOptionalParameterAsyncClient(buildInnerClient().getRemoveOptionalParameters()); + } + + /** + * Builds an instance of ReorderParametersClient class. + * + * @return an instance of ReorderParametersClient. + */ + @Generated + public ReorderParametersClient buildReorderParametersClient() { + return new ReorderParametersClient(buildInnerClient().getReorderParameters()); + } + + /** + * Builds an instance of GroupParametersClient class. + * + * @return an instance of GroupParametersClient. + */ + @Generated + public GroupParametersClient buildGroupParametersClient() { + return new GroupParametersClient(buildInnerClient().getGroupParameters()); + } + + /** + * Builds an instance of RequireOptionalParameterClient class. + * + * @return an instance of RequireOptionalParameterClient. + */ + @Generated + public RequireOptionalParameterClient buildRequireOptionalParameterClient() { + return new RequireOptionalParameterClient(buildInnerClient().getRequireOptionalParameters()); + } + + /** + * Builds an instance of RemoveOptionalParameterClient class. + * + * @return an instance of RemoveOptionalParameterClient. + */ + @Generated + public RemoveOptionalParameterClient buildRemoveOptionalParameterClient() { + return new RemoveOptionalParameterClient(buildInnerClient().getRemoveOptionalParameters()); + } + + private static final ClientLogger LOGGER = new ClientLogger(OverrideClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterAsyncClient.java new file mode 100644 index 00000000000..d7aaffbd93e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterAsyncClient.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride; + +import azure.clientgenerator.core.methodoverride.implementation.RemoveOptionalParametersImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous OverrideClient type. + */ +@ServiceClient(builder = OverrideClientBuilder.class, isAsync = true) +public final class RemoveOptionalParameterAsyncClient { + @Generated + private final RemoveOptionalParametersImpl serviceClient; + + /** + * Initializes an instance of RemoveOptionalParameterAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RemoveOptionalParameterAsyncClient(RemoveOptionalParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The removeOptional operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
param2StringNoThe param2 parameter
param3StringNoThe param3 parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
param4StringNoThe param4 parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param param1 The param1 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeOptionalWithResponse(String param1, RequestOptions requestOptions) { + return this.serviceClient.removeOptionalWithResponseAsync(param1, requestOptions); + } + + /** + * The removeOptional operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono removeOptional(String param1, String param2) { + // Generated convenience method for removeOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (param2 != null) { + requestOptions.addQueryParam("param2", param2, false); + } + return removeOptionalWithResponse(param1, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The removeOptional operation. + * + * @param param1 The param1 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono removeOptional(String param1) { + // Generated convenience method for removeOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return removeOptionalWithResponse(param1, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterClient.java new file mode 100644 index 00000000000..55dcc010b67 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterClient.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride; + +import azure.clientgenerator.core.methodoverride.implementation.RemoveOptionalParametersImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous OverrideClient type. + */ +@ServiceClient(builder = OverrideClientBuilder.class) +public final class RemoveOptionalParameterClient { + @Generated + private final RemoveOptionalParametersImpl serviceClient; + + /** + * Initializes an instance of RemoveOptionalParameterClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RemoveOptionalParameterClient(RemoveOptionalParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The removeOptional operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
param2StringNoThe param2 parameter
param3StringNoThe param3 parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
param4StringNoThe param4 parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param param1 The param1 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response removeOptionalWithResponse(String param1, RequestOptions requestOptions) { + return this.serviceClient.removeOptionalWithResponse(param1, requestOptions); + } + + /** + * The removeOptional operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void removeOptional(String param1, String param2) { + // Generated convenience method for removeOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (param2 != null) { + requestOptions.addQueryParam("param2", param2, false); + } + removeOptionalWithResponse(param1, requestOptions).getValue(); + } + + /** + * The removeOptional operation. + * + * @param param1 The param1 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void removeOptional(String param1) { + // Generated convenience method for removeOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + removeOptionalWithResponse(param1, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersAsyncClient.java new file mode 100644 index 00000000000..8480fd46ce6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersAsyncClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride; + +import azure.clientgenerator.core.methodoverride.implementation.ReorderParametersImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous OverrideClient type. + */ +@ServiceClient(builder = OverrideClientBuilder.class, isAsync = true) +public final class ReorderParametersAsyncClient { + @Generated + private final ReorderParametersImpl serviceClient; + + /** + * Initializes an instance of ReorderParametersAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ReorderParametersAsyncClient(ReorderParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The reorder operation. + * + * @param param2 The param2 parameter. + * @param param1 The param1 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> reorderWithResponse(String param2, String param1, RequestOptions requestOptions) { + return this.serviceClient.reorderWithResponseAsync(param2, param1, requestOptions); + } + + /** + * The reorder operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono reorder(String param1, String param2) { + // Generated convenience method for reorderWithResponse + RequestOptions requestOptions = new RequestOptions(); + return reorderWithResponse(param2, param1, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersClient.java new file mode 100644 index 00000000000..6ca922852e5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersClient.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride; + +import azure.clientgenerator.core.methodoverride.implementation.ReorderParametersImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous OverrideClient type. + */ +@ServiceClient(builder = OverrideClientBuilder.class) +public final class ReorderParametersClient { + @Generated + private final ReorderParametersImpl serviceClient; + + /** + * Initializes an instance of ReorderParametersClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ReorderParametersClient(ReorderParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The reorder operation. + * + * @param param2 The param2 parameter. + * @param param1 The param1 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response reorderWithResponse(String param2, String param1, RequestOptions requestOptions) { + return this.serviceClient.reorderWithResponse(param2, param1, requestOptions); + } + + /** + * The reorder operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void reorder(String param1, String param2) { + // Generated convenience method for reorderWithResponse + RequestOptions requestOptions = new RequestOptions(); + reorderWithResponse(param2, param1, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterAsyncClient.java new file mode 100644 index 00000000000..ed6366f3563 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterAsyncClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride; + +import azure.clientgenerator.core.methodoverride.implementation.RequireOptionalParametersImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous OverrideClient type. + */ +@ServiceClient(builder = OverrideClientBuilder.class, isAsync = true) +public final class RequireOptionalParameterAsyncClient { + @Generated + private final RequireOptionalParametersImpl serviceClient; + + /** + * Initializes an instance of RequireOptionalParameterAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RequireOptionalParameterAsyncClient(RequireOptionalParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The requireOptional operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requireOptionalWithResponse(String param1, String param2, + RequestOptions requestOptions) { + return this.serviceClient.requireOptionalWithResponseAsync(param1, param2, requestOptions); + } + + /** + * The requireOptional operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono requireOptional(String param1, String param2) { + // Generated convenience method for requireOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return requireOptionalWithResponse(param1, param2, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterClient.java new file mode 100644 index 00000000000..2731177caa0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterClient.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride; + +import azure.clientgenerator.core.methodoverride.implementation.RequireOptionalParametersImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous OverrideClient type. + */ +@ServiceClient(builder = OverrideClientBuilder.class) +public final class RequireOptionalParameterClient { + @Generated + private final RequireOptionalParametersImpl serviceClient; + + /** + * Initializes an instance of RequireOptionalParameterClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RequireOptionalParameterClient(RequireOptionalParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The requireOptional operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requireOptionalWithResponse(String param1, String param2, RequestOptions requestOptions) { + return this.serviceClient.requireOptionalWithResponse(param1, param2, requestOptions); + } + + /** + * The requireOptional operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void requireOptional(String param1, String param2) { + // Generated convenience method for requireOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + requireOptionalWithResponse(param1, param2, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java new file mode 100644 index 00000000000..f3a671c175e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in GroupParameters. + */ +public final class GroupParametersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final GroupParametersService service; + + /** + * The service client containing this operation class. + */ + private final OverrideClientImpl client; + + /** + * Initializes an instance of GroupParametersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GroupParametersImpl(OverrideClientImpl client) { + this.service + = RestProxy.create(GroupParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OverrideClientGroupParameters to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OverrideClientGroupParameters") + public interface GroupParametersService { + @Get("/azure/client-generator-core/override/group") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> group(@HostParam("endpoint") String endpoint, @QueryParam("param1") String param1, + @QueryParam("param2") String param2, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/override/group") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response groupSync(@HostParam("endpoint") String endpoint, @QueryParam("param1") String param1, + @QueryParam("param2") String param2, RequestOptions requestOptions, Context context); + } + + /** + * The group operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupWithResponseAsync(String param1, String param2, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.group(this.client.getEndpoint(), param1, param2, requestOptions, context)); + } + + /** + * The group operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupWithResponse(String param1, String param2, RequestOptions requestOptions) { + return service.groupSync(this.client.getEndpoint(), param1, param2, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/OverrideClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/OverrideClientImpl.java new file mode 100644 index 00000000000..68bac3d9fc5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/OverrideClientImpl.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 OverrideClient type. + */ +public final class OverrideClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 ReorderParametersImpl object to access its operations. + */ + private final ReorderParametersImpl reorderParameters; + + /** + * Gets the ReorderParametersImpl object to access its operations. + * + * @return the ReorderParametersImpl object. + */ + public ReorderParametersImpl getReorderParameters() { + return this.reorderParameters; + } + + /** + * The GroupParametersImpl object to access its operations. + */ + private final GroupParametersImpl groupParameters; + + /** + * Gets the GroupParametersImpl object to access its operations. + * + * @return the GroupParametersImpl object. + */ + public GroupParametersImpl getGroupParameters() { + return this.groupParameters; + } + + /** + * The RequireOptionalParametersImpl object to access its operations. + */ + private final RequireOptionalParametersImpl requireOptionalParameters; + + /** + * Gets the RequireOptionalParametersImpl object to access its operations. + * + * @return the RequireOptionalParametersImpl object. + */ + public RequireOptionalParametersImpl getRequireOptionalParameters() { + return this.requireOptionalParameters; + } + + /** + * The RemoveOptionalParametersImpl object to access its operations. + */ + private final RemoveOptionalParametersImpl removeOptionalParameters; + + /** + * Gets the RemoveOptionalParametersImpl object to access its operations. + * + * @return the RemoveOptionalParametersImpl object. + */ + public RemoveOptionalParametersImpl getRemoveOptionalParameters() { + return this.removeOptionalParameters; + } + + /** + * Initializes an instance of OverrideClient client. + * + * @param endpoint Service host. + */ + public OverrideClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of OverrideClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public OverrideClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of OverrideClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public OverrideClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.reorderParameters = new ReorderParametersImpl(this); + this.groupParameters = new GroupParametersImpl(this); + this.requireOptionalParameters = new RequireOptionalParametersImpl(this); + this.removeOptionalParameters = new RemoveOptionalParametersImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RemoveOptionalParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RemoveOptionalParametersImpl.java new file mode 100644 index 00000000000..8a70698b293 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RemoveOptionalParametersImpl.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RemoveOptionalParameters. + */ +public final class RemoveOptionalParametersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RemoveOptionalParametersService service; + + /** + * The service client containing this operation class. + */ + private final OverrideClientImpl client; + + /** + * Initializes an instance of RemoveOptionalParametersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RemoveOptionalParametersImpl(OverrideClientImpl client) { + this.service = RestProxy.create(RemoveOptionalParametersService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OverrideClientRemoveOptionalParameters to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OverrideClientRemoveOptionalParameters") + public interface RemoveOptionalParametersService { + @Get("/azure/client-generator-core/override/remove-optional/{param1}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> removeOptional(@HostParam("endpoint") String endpoint, @PathParam("param1") String param1, + RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/override/remove-optional/{param1}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response removeOptionalSync(@HostParam("endpoint") String endpoint, @PathParam("param1") String param1, + RequestOptions requestOptions, Context context); + } + + /** + * The removeOptional operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
param2StringNoThe param2 parameter
param3StringNoThe param3 parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
param4StringNoThe param4 parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param param1 The param1 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> removeOptionalWithResponseAsync(String param1, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.removeOptional(this.client.getEndpoint(), param1, requestOptions, context)); + } + + /** + * The removeOptional operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
param2StringNoThe param2 parameter
param3StringNoThe param3 parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
param4StringNoThe param4 parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param param1 The param1 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response removeOptionalWithResponse(String param1, RequestOptions requestOptions) { + return service.removeOptionalSync(this.client.getEndpoint(), param1, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/ReorderParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/ReorderParametersImpl.java new file mode 100644 index 00000000000..b75f33756c2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/ReorderParametersImpl.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ReorderParameters. + */ +public final class ReorderParametersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ReorderParametersService service; + + /** + * The service client containing this operation class. + */ + private final OverrideClientImpl client; + + /** + * Initializes an instance of ReorderParametersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReorderParametersImpl(OverrideClientImpl client) { + this.service + = RestProxy.create(ReorderParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OverrideClientReorderParameters to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OverrideClientReorderParameters") + public interface ReorderParametersService { + @Get("/azure/client-generator-core/override/reorder/{param2}/{param1}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> reorder(@HostParam("endpoint") String endpoint, @PathParam("param2") String param2, + @PathParam("param1") String param1, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/override/reorder/{param2}/{param1}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response reorderSync(@HostParam("endpoint") String endpoint, @PathParam("param2") String param2, + @PathParam("param1") String param1, RequestOptions requestOptions, Context context); + } + + /** + * The reorder operation. + * + * @param param2 The param2 parameter. + * @param param1 The param1 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> reorderWithResponseAsync(String param2, String param1, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.reorder(this.client.getEndpoint(), param2, param1, requestOptions, context)); + } + + /** + * The reorder operation. + * + * @param param2 The param2 parameter. + * @param param1 The param1 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response reorderWithResponse(String param2, String param1, RequestOptions requestOptions) { + return service.reorderSync(this.client.getEndpoint(), param2, param1, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RequireOptionalParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RequireOptionalParametersImpl.java new file mode 100644 index 00000000000..52f1ce8fc5f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/RequireOptionalParametersImpl.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RequireOptionalParameters. + */ +public final class RequireOptionalParametersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RequireOptionalParametersService service; + + /** + * The service client containing this operation class. + */ + private final OverrideClientImpl client; + + /** + * Initializes an instance of RequireOptionalParametersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RequireOptionalParametersImpl(OverrideClientImpl client) { + this.service = RestProxy.create(RequireOptionalParametersService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OverrideClientRequireOptionalParameters to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OverrideClientRequireOptionalParameters") + public interface RequireOptionalParametersService { + @Get("/azure/client-generator-core/override/require-optional/{param1}/{param2}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> requireOptional(@HostParam("endpoint") String endpoint, @PathParam("param1") String param1, + @PathParam("param2") String param2, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/override/require-optional/{param1}/{param2}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response requireOptionalSync(@HostParam("endpoint") String endpoint, @PathParam("param1") String param1, + @PathParam("param2") String param2, RequestOptions requestOptions, Context context); + } + + /** + * The requireOptional operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requireOptionalWithResponseAsync(String param1, String param2, + RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.requireOptional(this.client.getEndpoint(), param1, param2, requestOptions, context)); + } + + /** + * The requireOptional operation. + * + * @param param1 The param1 parameter. + * @param param2 The param2 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requireOptionalWithResponse(String param1, String param2, RequestOptions requestOptions) { + return service.requireOptionalSync(this.client.getEndpoint(), param1, param2, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/package-info.java new file mode 100644 index 00000000000..1d7dfa6e5d3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for OverrideModel. + * Test scenarios for client override behavior. + * + */ +package azure.clientgenerator.core.methodoverride.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/GroupParametersOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/GroupParametersOptions.java new file mode 100644 index 00000000000..0c6ffb8a071 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/GroupParametersOptions.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; + +/** + * The GroupParametersOptions model. + */ +@Immutable +public final class GroupParametersOptions { + /* + * The param1 property. + */ + @Generated + private final String param1; + + /* + * The param2 property. + */ + @Generated + private final String param2; + + /** + * Creates an instance of GroupParametersOptions class. + * + * @param param1 the param1 value to set. + * @param param2 the param2 value to set. + */ + @Generated + public GroupParametersOptions(String param1, String param2) { + this.param1 = param1; + this.param2 = param2; + } + + /** + * Get the param1 property: The param1 property. + * + * @return the param1 value. + */ + @Generated + public String getParam1() { + return this.param1; + } + + /** + * Get the param2 property: The param2 property. + * + * @return the param2 value. + */ + @Generated + public String getParam2() { + return this.param2; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/package-info.java new file mode 100644 index 00000000000..3f84a575362 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for OverrideModel. + * Test scenarios for client override behavior. + * + */ +package azure.clientgenerator.core.methodoverride.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/package-info.java new file mode 100644 index 00000000000..cf07b420472 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/methodoverride/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for OverrideModel. + * Test scenarios for client override behavior. + * + */ +package azure.clientgenerator.core.methodoverride; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbAsyncClient.java new file mode 100644 index 00000000000..ceaadd6b727 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbAsyncClient.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.nextlinkverb; + +import azure.clientgenerator.core.nextlinkverb.implementation.NextLinkVerbClientImpl; +import azure.clientgenerator.core.nextlinkverb.models.Test; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; + +/** + * Initializes a new instance of the asynchronous NextLinkVerbClient type. + */ +@ServiceClient(builder = NextLinkVerbClientBuilder.class, isAsync = true) +public final class NextLinkVerbAsyncClient { + @Generated + private final NextLinkVerbClientImpl serviceClient; + + /** + * Initializes an instance of NextLinkVerbAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NextLinkVerbAsyncClient(NextLinkVerbClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The listItems operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged response model as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listItems(RequestOptions requestOptions) { + return this.serviceClient.listItemsAsync(requestOptions); + } + + /** + * The listItems operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response model as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listItems() { + // Generated convenience method for listItems + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listItems(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Test.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClient.java new file mode 100644 index 00000000000..e88b934d7a9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.nextlinkverb; + +import azure.clientgenerator.core.nextlinkverb.implementation.NextLinkVerbClientImpl; +import azure.clientgenerator.core.nextlinkverb.models.Test; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous NextLinkVerbClient type. + */ +@ServiceClient(builder = NextLinkVerbClientBuilder.class) +public final class NextLinkVerbClient { + @Generated + private final NextLinkVerbClientImpl serviceClient; + + /** + * Initializes an instance of NextLinkVerbClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NextLinkVerbClient(NextLinkVerbClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The listItems operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged response model as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listItems(RequestOptions requestOptions) { + return this.serviceClient.listItems(requestOptions); + } + + /** + * The listItems operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response model as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listItems() { + // Generated convenience method for listItems + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listItems(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Test.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClientBuilder.java new file mode 100644 index 00000000000..9e1f3614e98 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.nextlinkverb; + +import azure.clientgenerator.core.nextlinkverb.implementation.NextLinkVerbClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the NextLinkVerbClient type. + */ +@ServiceClientBuilder(serviceClients = { NextLinkVerbClient.class, NextLinkVerbAsyncClient.class }) +public final class NextLinkVerbClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-nextlinkverb.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the NextLinkVerbClientBuilder. + */ + @Generated + public NextLinkVerbClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NextLinkVerbClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NextLinkVerbClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NextLinkVerbClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NextLinkVerbClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NextLinkVerbClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NextLinkVerbClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NextLinkVerbClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NextLinkVerbClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the NextLinkVerbClientBuilder. + */ + @Generated + public NextLinkVerbClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of NextLinkVerbClientImpl with the provided parameters. + * + * @return an instance of NextLinkVerbClientImpl. + */ + @Generated + private NextLinkVerbClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + NextLinkVerbClientImpl client + = new NextLinkVerbClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of NextLinkVerbAsyncClient class. + * + * @return an instance of NextLinkVerbAsyncClient. + */ + @Generated + public NextLinkVerbAsyncClient buildAsyncClient() { + return new NextLinkVerbAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of NextLinkVerbClient class. + * + * @return an instance of NextLinkVerbClient. + */ + @Generated + public NextLinkVerbClient buildClient() { + return new NextLinkVerbClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(NextLinkVerbClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/NextLinkVerbClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/NextLinkVerbClientImpl.java new file mode 100644 index 00000000000..86da457c2c6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/NextLinkVerbClientImpl.java @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.nextlinkverb.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +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.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the NextLinkVerbClient type. + */ +public final class NextLinkVerbClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NextLinkVerbClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of NextLinkVerbClient client. + * + * @param endpoint Service host. + */ + public NextLinkVerbClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NextLinkVerbClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public NextLinkVerbClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NextLinkVerbClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public NextLinkVerbClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(NextLinkVerbClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for NextLinkVerbClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NextLinkVerbClient") + public interface NextLinkVerbClientService { + @Post("/azure/client-generator-core/next-link-verb/items") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listItems(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/azure/client-generator-core/next-link-verb/items") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listItemsSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listItemsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Post("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listItemsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * The listItems operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged response model along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listItemsSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listItems(this.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * The listItems operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged response model as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listItemsAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listItemsSinglePageAsync(requestOptions), + nextLink -> listItemsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * The listItems operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged response model along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listItemsSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listItemsSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * The listItems operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged response model as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listItems(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listItemsSinglePage(requestOptions), + nextLink -> listItemsNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged response model along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listItemsNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listItemsNext(nextLink, this.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged response model along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listItemsNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listItemsNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/package-info.java new file mode 100644 index 00000000000..93f6358e5f6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for NextLinkVerb. + * Test for @nextLinkVerb decorator. + * + */ +package azure.clientgenerator.core.nextlinkverb.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/Test.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/Test.java new file mode 100644 index 00000000000..357ccddf984 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/Test.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.nextlinkverb.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Test model. + */ +@Immutable +public final class Test implements JsonSerializable { + /* + * The id of the test. + */ + @Generated + private final String id; + + /** + * Creates an instance of Test class. + * + * @param id the id value to set. + */ + @Generated + private Test(String id) { + this.id = id; + } + + /** + * Get the id property: The id of the test. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Test from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Test if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Test. + */ + @Generated + public static Test fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Test(id); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/package-info.java new file mode 100644 index 00000000000..c889bfde4a1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for NextLinkVerb. + * Test for @nextLinkVerb decorator. + * + */ +package azure.clientgenerator.core.nextlinkverb.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/package-info.java new file mode 100644 index 00000000000..ea516924dcf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/nextlinkverb/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for NextLinkVerb. + * Test for @nextLinkVerb decorator. + * + */ +package azure.clientgenerator.core.nextlinkverb; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageAsyncClient.java new file mode 100644 index 00000000000..38ae7bba90a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageAsyncClient.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.usage; + +import azure.clientgenerator.core.usage.implementation.ModelInOperationsImpl; +import azure.clientgenerator.core.usage.models.InputModel; +import azure.clientgenerator.core.usage.models.OutputModel; +import azure.clientgenerator.core.usage.models.RoundTripModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous UsageClient type. + */ +@ServiceClient(builder = UsageClientBuilder.class, isAsync = true) +public final class UsageAsyncClient { + @Generated + private final ModelInOperationsImpl serviceClient; + + /** + * Initializes an instance of UsageAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UsageAsyncClient(ModelInOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Expected body parameter: + * ```json + * { + * "name": "Madge" + * } + * ```. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> inputToInputOutputWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.inputToInputOutputWithResponseAsync(body, requestOptions); + } + + /** + * Expected response body: + * ```json + * { + * "name": "Madge" + * } + * ```. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return usage additive to roundtrip along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> outputToInputOutputWithResponse(RequestOptions requestOptions) { + return this.serviceClient.outputToInputOutputWithResponseAsync(requestOptions); + } + + /** + * "ResultModel" should be usage=output, as it is read-only and does not exist in request body. + * + * Expected body parameter: + * ```json + * { + * } + * ``` + * + * Expected response body: + * ```json + * { + * "result": { + * "name": "Madge" + * } + * } + * ```. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     result (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     result (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> modelInReadOnlyPropertyWithResponse(BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.modelInReadOnlyPropertyWithResponseAsync(body, requestOptions); + } + + /** + * Serialize the 'OrphanModel' as request body. + * + * Expected body parameter: + * ```json + * { + * "name": "name", + * "desc": "desc" + * } + * ```. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> orphanModelSerializableWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.orphanModelSerializableWithResponseAsync(body, requestOptions); + } + + /** + * Expected body parameter: + * ```json + * { + * "name": "Madge" + * } + * ```. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono inputToInputOutput(InputModel body) { + // Generated convenience method for inputToInputOutputWithResponse + RequestOptions requestOptions = new RequestOptions(); + return inputToInputOutputWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Expected response body: + * ```json + * { + * "name": "Madge" + * } + * ```. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return usage additive to roundtrip on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono outputToInputOutput() { + // Generated convenience method for outputToInputOutputWithResponse + RequestOptions requestOptions = new RequestOptions(); + return outputToInputOutputWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OutputModel.class)); + } + + /** + * "ResultModel" should be usage=output, as it is read-only and does not exist in request body. + * + * Expected body parameter: + * ```json + * { + * } + * ``` + * + * Expected response body: + * ```json + * { + * "result": { + * "name": "Madge" + * } + * } + * ```. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono modelInReadOnlyProperty(RoundTripModel body) { + // Generated convenience method for modelInReadOnlyPropertyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return modelInReadOnlyPropertyWithResponse(BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(RoundTripModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClient.java new file mode 100644 index 00000000000..e42a3e9318a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClient.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.usage; + +import azure.clientgenerator.core.usage.implementation.ModelInOperationsImpl; +import azure.clientgenerator.core.usage.models.InputModel; +import azure.clientgenerator.core.usage.models.OutputModel; +import azure.clientgenerator.core.usage.models.RoundTripModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous UsageClient type. + */ +@ServiceClient(builder = UsageClientBuilder.class) +public final class UsageClient { + @Generated + private final ModelInOperationsImpl serviceClient; + + /** + * Initializes an instance of UsageClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UsageClient(ModelInOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Expected body parameter: + * ```json + * { + * "name": "Madge" + * } + * ```. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response inputToInputOutputWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.inputToInputOutputWithResponse(body, requestOptions); + } + + /** + * Expected response body: + * ```json + * { + * "name": "Madge" + * } + * ```. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return usage additive to roundtrip along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response outputToInputOutputWithResponse(RequestOptions requestOptions) { + return this.serviceClient.outputToInputOutputWithResponse(requestOptions); + } + + /** + * "ResultModel" should be usage=output, as it is read-only and does not exist in request body. + * + * Expected body parameter: + * ```json + * { + * } + * ``` + * + * Expected response body: + * ```json + * { + * "result": { + * "name": "Madge" + * } + * } + * ```. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     result (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     result (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response modelInReadOnlyPropertyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.modelInReadOnlyPropertyWithResponse(body, requestOptions); + } + + /** + * Serialize the 'OrphanModel' as request body. + * + * Expected body parameter: + * ```json + * { + * "name": "name", + * "desc": "desc" + * } + * ```. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response orphanModelSerializableWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.orphanModelSerializableWithResponse(body, requestOptions); + } + + /** + * Expected body parameter: + * ```json + * { + * "name": "Madge" + * } + * ```. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void inputToInputOutput(InputModel body) { + // Generated convenience method for inputToInputOutputWithResponse + RequestOptions requestOptions = new RequestOptions(); + inputToInputOutputWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Expected response body: + * ```json + * { + * "name": "Madge" + * } + * ```. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return usage additive to roundtrip. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OutputModel outputToInputOutput() { + // Generated convenience method for outputToInputOutputWithResponse + RequestOptions requestOptions = new RequestOptions(); + return outputToInputOutputWithResponse(requestOptions).getValue().toObject(OutputModel.class); + } + + /** + * "ResultModel" should be usage=output, as it is read-only and does not exist in request body. + * + * Expected body parameter: + * ```json + * { + * } + * ``` + * + * Expected response body: + * ```json + * { + * "result": { + * "name": "Madge" + * } + * } + * ```. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public RoundTripModel modelInReadOnlyProperty(RoundTripModel body) { + // Generated convenience method for modelInReadOnlyPropertyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return modelInReadOnlyPropertyWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(RoundTripModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClientBuilder.java new file mode 100644 index 00000000000..bf4b3328114 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/UsageClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.usage; + +import azure.clientgenerator.core.usage.implementation.UsageClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the UsageClient type. + */ +@ServiceClientBuilder(serviceClients = { UsageClient.class, UsageAsyncClient.class }) +public final class UsageClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-clientgenerator-core-usage.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the UsageClientBuilder. + */ + @Generated + public UsageClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the UsageClientBuilder. + */ + @Generated + public UsageClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of UsageClientImpl with the provided parameters. + * + * @return an instance of UsageClientImpl. + */ + @Generated + private UsageClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + UsageClientImpl client + = new UsageClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of UsageAsyncClient class. + * + * @return an instance of UsageAsyncClient. + */ + @Generated + public UsageAsyncClient buildAsyncClient() { + return new UsageAsyncClient(buildInnerClient().getModelInOperations()); + } + + /** + * Builds an instance of UsageClient class. + * + * @return an instance of UsageClient. + */ + @Generated + public UsageClient buildClient() { + return new UsageClient(buildInnerClient().getModelInOperations()); + } + + private static final ClientLogger LOGGER = new ClientLogger(UsageClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/ModelInOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/ModelInOperationsImpl.java new file mode 100644 index 00000000000..ce7d4d1671a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/ModelInOperationsImpl.java @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.usage.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ModelInOperations. + */ +public final class ModelInOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ModelInOperationsService service; + + /** + * The service client containing this operation class. + */ + private final UsageClientImpl client; + + /** + * Initializes an instance of ModelInOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ModelInOperationsImpl(UsageClientImpl client) { + this.service + = RestProxy.create(ModelInOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for UsageClientModelInOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UsageClientModelInOperations") + public interface ModelInOperationsService { + @Post("/azure/client-generator-core/usage/inputToInputOutput") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> inputToInputOutput(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/azure/client-generator-core/usage/inputToInputOutput") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response inputToInputOutputSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/usage/outputToInputOutput") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> outputToInputOutput(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/azure/client-generator-core/usage/outputToInputOutput") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response outputToInputOutputSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/usage/modelInReadOnlyProperty") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> modelInReadOnlyProperty(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/usage/modelInReadOnlyProperty") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response modelInReadOnlyPropertySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/usage/orphanModelSerializable") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> orphanModelSerializable(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/azure/client-generator-core/usage/orphanModelSerializable") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response orphanModelSerializableSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Expected body parameter: + * ```json + * { + * "name": "Madge" + * } + * ```. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> inputToInputOutputWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.inputToInputOutput(this.client.getEndpoint(), contentType, body, + requestOptions, context)); + } + + /** + * Expected body parameter: + * ```json + * { + * "name": "Madge" + * } + * ```. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response inputToInputOutputWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.inputToInputOutputSync(this.client.getEndpoint(), contentType, body, requestOptions, + Context.NONE); + } + + /** + * Expected response body: + * ```json + * { + * "name": "Madge" + * } + * ```. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return usage additive to roundtrip along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> outputToInputOutputWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.outputToInputOutput(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Expected response body: + * ```json + * { + * "name": "Madge" + * } + * ```. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return usage additive to roundtrip along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response outputToInputOutputWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.outputToInputOutputSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * "ResultModel" should be usage=output, as it is read-only and does not exist in request body. + * + * Expected body parameter: + * ```json + * { + * } + * ``` + * + * Expected response body: + * ```json + * { + * "result": { + * "name": "Madge" + * } + * } + * ```. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     result (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     result (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> modelInReadOnlyPropertyWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.modelInReadOnlyProperty(this.client.getEndpoint(), contentType, + accept, body, requestOptions, context)); + } + + /** + * "ResultModel" should be usage=output, as it is read-only and does not exist in request body. + * + * Expected body parameter: + * ```json + * { + * } + * ``` + * + * Expected response body: + * ```json + * { + * "result": { + * "name": "Madge" + * } + * } + * ```. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     result (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     result (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response modelInReadOnlyPropertyWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.modelInReadOnlyPropertySync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * Serialize the 'OrphanModel' as request body. + * + * Expected body parameter: + * ```json + * { + * "name": "name", + * "desc": "desc" + * } + * ```. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> orphanModelSerializableWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.orphanModelSerializable(this.client.getEndpoint(), contentType, + body, requestOptions, context)); + } + + /** + * Serialize the 'OrphanModel' as request body. + * + * Expected body parameter: + * ```json + * { + * "name": "name", + * "desc": "desc" + * } + * ```. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response orphanModelSerializableWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.orphanModelSerializableSync(this.client.getEndpoint(), contentType, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/UsageClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/UsageClientImpl.java new file mode 100644 index 00000000000..8122cbb5849 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/UsageClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.usage.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 UsageClient type. + */ +public final class UsageClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 ModelInOperationsImpl object to access its operations. + */ + private final ModelInOperationsImpl modelInOperations; + + /** + * Gets the ModelInOperationsImpl object to access its operations. + * + * @return the ModelInOperationsImpl object. + */ + public ModelInOperationsImpl getModelInOperations() { + return this.modelInOperations; + } + + /** + * Initializes an instance of UsageClient client. + * + * @param endpoint Service host. + */ + public UsageClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of UsageClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public UsageClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of UsageClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public UsageClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.modelInOperations = new ModelInOperationsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/package-info.java new file mode 100644 index 00000000000..c1319d5bd58 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Usage. + * Test for internal decorator. + * + */ +package azure.clientgenerator.core.usage.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/InputModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/InputModel.java new file mode 100644 index 00000000000..de15ec1a55e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/InputModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.usage.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Usage additive to roundtrip. + */ +@Immutable +public final class InputModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of InputModel class. + * + * @param name the name value to set. + */ + @Generated + public InputModel(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InputModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InputModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InputModel. + */ + @Generated + public static InputModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new InputModel(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OrphanModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OrphanModel.java new file mode 100644 index 00000000000..09d7e0471a3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OrphanModel.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.usage.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Not used anywhere, but access is override to public so still need to be generated and exported with serialization. + */ +@Immutable +public final class OrphanModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String modelName; + + /* + * The desc property. + */ + @Generated + private final String description; + + /** + * Creates an instance of OrphanModel class. + * + * @param modelName the modelName value to set. + * @param description the description value to set. + */ + @Generated + public OrphanModel(String modelName, String description) { + this.modelName = modelName; + this.description = description; + } + + /** + * Get the modelName property: The name property. + * + * @return the modelName value. + */ + @Generated + public String getModelName() { + return this.modelName; + } + + /** + * Get the description property: The desc property. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.modelName); + jsonWriter.writeStringField("desc", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OrphanModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OrphanModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OrphanModel. + */ + @Generated + public static OrphanModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String modelName = null; + String description = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + modelName = reader.getString(); + } else if ("desc".equals(fieldName)) { + description = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new OrphanModel(modelName, description); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OutputModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OutputModel.java new file mode 100644 index 00000000000..e92ddd0c447 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/OutputModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.usage.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Usage additive to roundtrip. + */ +@Immutable +public final class OutputModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of OutputModel class. + * + * @param name the name value to set. + */ + @Generated + public OutputModel(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OutputModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OutputModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OutputModel. + */ + @Generated + public static OutputModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new OutputModel(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/ResultModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/ResultModel.java new file mode 100644 index 00000000000..99975529fb1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/ResultModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.usage.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ResultModel model. + */ +@Immutable +public final class ResultModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of ResultModel class. + * + * @param name the name value to set. + */ + @Generated + private ResultModel(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResultModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResultModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResultModel. + */ + @Generated + public static ResultModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ResultModel(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/RoundTripModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/RoundTripModel.java new file mode 100644 index 00000000000..4eb57c74a58 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/RoundTripModel.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.usage.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The RoundTripModel model. + */ +@Immutable +public final class RoundTripModel implements JsonSerializable { + /* + * The result property. + */ + @Generated + private ResultModel result; + + /** + * Creates an instance of RoundTripModel class. + */ + @Generated + public RoundTripModel() { + } + + /** + * Get the result property: The result property. + * + * @return the result value. + */ + @Generated + public ResultModel getResult() { + return this.result; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RoundTripModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RoundTripModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RoundTripModel. + */ + @Generated + public static RoundTripModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RoundTripModel deserializedRoundTripModel = new RoundTripModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("result".equals(fieldName)) { + deserializedRoundTripModel.result = ResultModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRoundTripModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/package-info.java new file mode 100644 index 00000000000..2b53c1a3a7a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Usage. + * Test for internal decorator. + * + */ +package azure.clientgenerator.core.usage.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/package-info.java new file mode 100644 index 00000000000..cb61e04d930 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/clientgenerator/core/usage/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Usage. + * Test for internal decorator. + * + */ +package azure.clientgenerator.core.usage; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicAsyncClient.java new file mode 100644 index 00000000000..7ef6716f929 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicAsyncClient.java @@ -0,0 +1,603 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.basic; + +import azure.core.basic.implementation.BasicClientImpl; +import azure.core.basic.implementation.JsonMergePatchHelper; +import azure.core.basic.models.User; +import azure.core.basic.models.UserList; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous BasicClient type. + */ +@ServiceClient(builder = BasicClientBuilder.class, isAsync = true) +public final class BasicAsyncClient { + @Generated + private final BasicClientImpl serviceClient; + + /** + * Initializes an instance of BasicAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BasicAsyncClient(BasicClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Adds a user or updates a user's fields. + * + * Creates or updates a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponse(int id, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateWithResponseAsync(id, resource, requestOptions); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrReplaceWithResponse(int id, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.createOrReplaceWithResponseAsync(id, resource, requestOptions); + } + + /** + * Gets a user. + * + * Gets a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a user. + * + * Gets a User along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(int id, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(id, requestOptions); + } + + /** + * Lists all users. + * + * Lists all Users. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
orderbyList<String>NoExpressions that specify the order of returned + * results. Call {@link RequestOptions#addQueryParam} to add string to array.
filterStringNoFilter the result list using the given expression.
selectList<String>NoSelect the specified fields to be included in the + * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandList<String>NoExpand the indicated resources into the response. + * Call {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(RequestOptions requestOptions) { + return this.serviceClient.listAsync(requestOptions); + } + + /** + * Deletes a user. + * + * Deletes a User. + * + * @param id The user's id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponse(int id, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(id, requestOptions); + } + + /** + * Exports a user. + * + * Exports a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> exportWithResponse(int id, String format, RequestOptions requestOptions) { + return this.serviceClient.exportWithResponseAsync(id, format, requestOptions); + } + + /** + * Exports all users. + * + * Exports all users. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     users (Required): [
+     *          (Required){
+     *             id: int (Required)
+     *             name: String (Optional, Required on create)
+     *             orders (Optional): [
+     *                  (Optional){
+     *                     id: int (Required)
+     *                     userId: int (Optional, Required on create)
+     *                     detail: String (Optional, Required on create)
+     *                 }
+     *             ]
+     *             etag: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> exportAllUsersWithResponse(String format, RequestOptions requestOptions) { + return this.serviceClient.exportAllUsersWithResponseAsync(format, requestOptions); + } + + /** + * Adds a user or updates a user's fields. + * + * Creates or updates a User. + * + * @param id The user's id. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a user on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdate(int id, User resource) { + // Generated convenience method for createOrUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getUserAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getUserAccessor().prepareModelForJsonMergePatch(resource, false); + return createOrUpdateWithResponse(id, resourceInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(User.class)); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + * + * @param id The user's id. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a user on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrReplace(int id, User resource) { + // Generated convenience method for createOrReplaceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrReplaceWithResponse(id, BinaryData.fromObject(resource), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(User.class)); + } + + /** + * Gets a user. + * + * Gets a User. + * + * @param id The user's id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a user. + * + * Gets a User on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(int id) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(id, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(User.class)); + } + + /** + * Lists all users. + * + * Lists all Users. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param orderBy Expressions that specify the order of returned results. + * @param filter Filter the result list using the given expression. + * @param select Select the specified fields to be included in the response. + * @param expand Expand the indicated resources into the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(Integer top, Integer skip, List orderBy, String filter, List select, + List expand) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + if (orderBy != null) { + for (String paramItemValue : orderBy) { + if (paramItemValue != null) { + requestOptions.addQueryParam("orderby", paramItemValue, false); + } + } + } + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + if (select != null) { + for (String paramItemValue : select) { + if (paramItemValue != null) { + requestOptions.addQueryParam("select", paramItemValue, false); + } + } + } + if (expand != null) { + for (String paramItemValue : expand) { + if (paramItemValue != null) { + requestOptions.addQueryParam("expand", paramItemValue, false); + } + } + } + PagedFlux pagedFluxResponse = list(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(User.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Lists all users. + * + * Lists all Users. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = list(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(User.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Deletes a user. + * + * Deletes a User. + * + * @param id The user's id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono delete(int id) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteWithResponse(id, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Exports a user. + * + * Exports a User. + * + * @param id The user's id. + * @param format The format of the data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a user on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono export(int id, String format) { + // Generated convenience method for exportWithResponse + RequestOptions requestOptions = new RequestOptions(); + return exportWithResponse(id, format, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(User.class)); + } + + /** + * Exports all users. + * + * Exports all users. + * + * @param format The format of the data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono exportAllUsers(String format) { + // Generated convenience method for exportAllUsersWithResponse + RequestOptions requestOptions = new RequestOptions(); + return exportAllUsersWithResponse(format, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UserList.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClient.java new file mode 100644 index 00000000000..32419b9f1e5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClient.java @@ -0,0 +1,566 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.basic; + +import azure.core.basic.implementation.BasicClientImpl; +import azure.core.basic.implementation.JsonMergePatchHelper; +import azure.core.basic.models.User; +import azure.core.basic.models.UserList; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.util.List; + +/** + * Initializes a new instance of the synchronous BasicClient type. + */ +@ServiceClient(builder = BasicClientBuilder.class) +public final class BasicClient { + @Generated + private final BasicClientImpl serviceClient; + + /** + * Initializes an instance of BasicClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BasicClient(BasicClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Adds a user or updates a user's fields. + * + * Creates or updates a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(int id, BinaryData resource, RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateWithResponse(id, resource, requestOptions); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrReplaceWithResponse(int id, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.createOrReplaceWithResponse(id, resource, requestOptions); + } + + /** + * Gets a user. + * + * Gets a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a user. + * + * Gets a User along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(int id, RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(id, requestOptions); + } + + /** + * Lists all users. + * + * Lists all Users. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
orderbyList<String>NoExpressions that specify the order of returned + * results. Call {@link RequestOptions#addQueryParam} to add string to array.
filterStringNoFilter the result list using the given expression.
selectList<String>NoSelect the specified fields to be included in the + * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandList<String>NoExpand the indicated resources into the response. + * Call {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + return this.serviceClient.list(requestOptions); + } + + /** + * Deletes a user. + * + * Deletes a User. + * + * @param id The user's id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(int id, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponse(id, requestOptions); + } + + /** + * Exports a user. + * + * Exports a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportWithResponse(int id, String format, RequestOptions requestOptions) { + return this.serviceClient.exportWithResponse(id, format, requestOptions); + } + + /** + * Exports all users. + * + * Exports all users. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     users (Required): [
+     *          (Required){
+     *             id: int (Required)
+     *             name: String (Optional, Required on create)
+     *             orders (Optional): [
+     *                  (Optional){
+     *                     id: int (Required)
+     *                     userId: int (Optional, Required on create)
+     *                     detail: String (Optional, Required on create)
+     *                 }
+     *             ]
+     *             etag: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportAllUsersWithResponse(String format, RequestOptions requestOptions) { + return this.serviceClient.exportAllUsersWithResponse(format, requestOptions); + } + + /** + * Adds a user or updates a user's fields. + * + * Creates or updates a User. + * + * @param id The user's id. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a user. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public User createOrUpdate(int id, User resource) { + // Generated convenience method for createOrUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getUserAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getUserAccessor().prepareModelForJsonMergePatch(resource, false); + return createOrUpdateWithResponse(id, resourceInBinaryData, requestOptions).getValue().toObject(User.class); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + * + * @param id The user's id. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a user. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public User createOrReplace(int id, User resource) { + // Generated convenience method for createOrReplaceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrReplaceWithResponse(id, BinaryData.fromObject(resource), requestOptions).getValue() + .toObject(User.class); + } + + /** + * Gets a user. + * + * Gets a User. + * + * @param id The user's id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a user. + * + * Gets a User. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public User get(int id) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(id, requestOptions).getValue().toObject(User.class); + } + + /** + * Lists all users. + * + * Lists all Users. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param orderBy Expressions that specify the order of returned results. + * @param filter Filter the result list using the given expression. + * @param select Select the specified fields to be included in the response. + * @param expand Expand the indicated resources into the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Integer top, Integer skip, List orderBy, String filter, List select, + List expand) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + if (orderBy != null) { + for (String paramItemValue : orderBy) { + if (paramItemValue != null) { + requestOptions.addQueryParam("orderby", paramItemValue, false); + } + } + } + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + if (select != null) { + for (String paramItemValue : select) { + if (paramItemValue != null) { + requestOptions.addQueryParam("select", paramItemValue, false); + } + } + } + if (expand != null) { + for (String paramItemValue : expand) { + if (paramItemValue != null) { + requestOptions.addQueryParam("expand", paramItemValue, false); + } + } + } + return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); + } + + /** + * Lists all users. + * + * Lists all Users. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); + } + + /** + * Deletes a user. + * + * Deletes a User. + * + * @param id The user's id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(int id) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteWithResponse(id, requestOptions).getValue(); + } + + /** + * Exports a user. + * + * Exports a User. + * + * @param id The user's id. + * @param format The format of the data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a user. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public User export(int id, String format) { + // Generated convenience method for exportWithResponse + RequestOptions requestOptions = new RequestOptions(); + return exportWithResponse(id, format, requestOptions).getValue().toObject(User.class); + } + + /** + * Exports all users. + * + * Exports all users. + * + * @param format The format of the data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UserList exportAllUsers(String format) { + // Generated convenience method for exportAllUsersWithResponse + RequestOptions requestOptions = new RequestOptions(); + return exportAllUsersWithResponse(format, requestOptions).getValue().toObject(UserList.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClientBuilder.java new file mode 100644 index 00000000000..d9a34f8480e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.basic; + +import azure.core.basic.implementation.BasicClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the BasicClient type. + */ +@ServiceClientBuilder(serviceClients = { BasicClient.class, BasicAsyncClient.class }) +public final class BasicClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-basic.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the BasicClientBuilder. + */ + @Generated + public BasicClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private BasicServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the BasicClientBuilder. + */ + @Generated + public BasicClientBuilder serviceVersion(BasicServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the BasicClientBuilder. + */ + @Generated + public BasicClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of BasicClientImpl with the provided parameters. + * + * @return an instance of BasicClientImpl. + */ + @Generated + private BasicClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + BasicServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : BasicServiceVersion.getLatest(); + BasicClientImpl client = new BasicClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + localEndpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of BasicAsyncClient class. + * + * @return an instance of BasicAsyncClient. + */ + @Generated + public BasicAsyncClient buildAsyncClient() { + return new BasicAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of BasicClient class. + * + * @return an instance of BasicClient. + */ + @Generated + public BasicClient buildClient() { + return new BasicClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(BasicClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicServiceVersion.java new file mode 100644 index 00000000000..6df5e089edc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/BasicServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.basic; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of BasicClient. + */ +public enum BasicServiceVersion implements ServiceVersion { + /** + * Enum value 2022-12-01-preview. + */ + V2022_12_01_PREVIEW("2022-12-01-preview"); + + private final String version; + + BasicServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link BasicServiceVersion}. + */ + public static BasicServiceVersion getLatest() { + return V2022_12_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/BasicClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/BasicClientImpl.java new file mode 100644 index 00000000000..0d851f4d0ce --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/BasicClientImpl.java @@ -0,0 +1,1204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.basic.implementation; + +import azure.core.basic.BasicServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +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.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +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.RequestOptions; +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 com.azure.core.util.UrlBuilder; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the BasicClient type. + */ +public final class BasicClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BasicClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final BasicServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public BasicServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of BasicClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public BasicClientImpl(String endpoint, BasicServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of BasicClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public BasicClientImpl(HttpPipeline httpPipeline, String endpoint, BasicServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of BasicClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public BasicClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + BasicServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(BasicClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for BasicClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "BasicClient") + public interface BasicClientService { + @Patch("/azure/core/basic/users/{id}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Patch("/azure/core/basic/users/{id}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Put("/azure/core/basic/users/{id}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Put("/azure/core/basic/users/{id}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrReplaceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Get("/azure/core/basic/users/{id}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/core/basic/users/{id}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/core/basic/users") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/core/basic/users") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Delete("/azure/core/basic/users/{id}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, RequestOptions requestOptions, + Context context); + + @Delete("/azure/core/basic/users/{id}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("id") int id, RequestOptions requestOptions, Context context); + + @Post("/azure/core/basic/users/{id}:export") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> export(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, @QueryParam("format") String format, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/azure/core/basic/users/{id}:export") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response exportSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, @QueryParam("format") String format, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/azure/core/basic/users:exportallusers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> exportAllUsers(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @QueryParam("format") String format, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/azure/core/basic/users:exportallusers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response exportAllUsersSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @QueryParam("format") String format, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Adds a user or updates a user's fields. + * + * Creates or updates a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateWithResponseAsync(int id, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createOrUpdate(this.getEndpoint(), + this.getServiceVersion().getVersion(), id, contentType, accept, resource, requestOptions, context)); + } + + /** + * Adds a user or updates a user's fields. + * + * Creates or updates a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(int id, BinaryData resource, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, contentType, + accept, resource, requestOptions, Context.NONE); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrReplaceWithResponseAsync(int id, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createOrReplace(this.getEndpoint(), + this.getServiceVersion().getVersion(), id, contentType, accept, resource, requestOptions, context)); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrReplaceWithResponse(int id, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrReplaceSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, contentType, + accept, resource, requestOptions, Context.NONE); + } + + /** + * Gets a user. + * + * Gets a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a user. + * + * Gets a User along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(int id, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.getEndpoint(), this.getServiceVersion().getVersion(), + id, accept, requestOptions, context)); + } + + /** + * Gets a user. + * + * Gets a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a user. + * + * Gets a User along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(int id, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, accept, requestOptions, + Context.NONE); + } + + /** + * Lists all users. + * + * Lists all Users. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
orderbyList<String>NoExpressions that specify the order of returned + * results. Call {@link RequestOptions#addQueryParam} to add string to array.
filterStringNoFilter the result list using the given expression.
selectList<String>NoSelect the specified fields to be included in the + * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandList<String>NoExpand the indicated resources into the response. + * Call {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, + requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Lists all users. + * + * Lists all Users. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
orderbyList<String>NoExpressions that specify the order of returned + * results. Call {@link RequestOptions#addQueryParam} to add string to array.
filterStringNoFilter the result list using the given expression.
selectList<String>NoSelect the specified fields to be included in the + * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandList<String>NoExpand the indicated resources into the response. + * Call {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listSinglePageAsync(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listNextSinglePageAsync(nextLink, requestOptionsLocal); + }); + } + + /** + * Lists all users. + * + * Lists all Users. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
orderbyList<String>NoExpressions that specify the order of returned + * results. Call {@link RequestOptions#addQueryParam} to add string to array.
filterStringNoFilter the result list using the given expression.
selectList<String>NoSelect the specified fields to be included in the + * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandList<String>NoExpand the indicated resources into the response. + * Call {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Lists all users. + * + * Lists all Users. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
orderbyList<String>NoExpressions that specify the order of returned + * results. Call {@link RequestOptions#addQueryParam} to add string to array.
filterStringNoFilter the result list using the given expression.
selectList<String>NoSelect the specified fields to be included in the + * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandList<String>NoExpand the indicated resources into the response. + * Call {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listSinglePage(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listNextSinglePage(nextLink, requestOptionsLocal); + }); + } + + /** + * Deletes a user. + * + * Deletes a User. + * + * @param id The user's id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(int id, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.delete(this.getEndpoint(), this.getServiceVersion().getVersion(), + id, requestOptions, context)); + } + + /** + * Deletes a user. + * + * Deletes a User. + * + * @param id The user's id. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(int id, RequestOptions requestOptions) { + return service.deleteSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, requestOptions, + Context.NONE); + } + + /** + * Exports a user. + * + * Exports a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> exportWithResponseAsync(int id, String format, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.export(this.getEndpoint(), this.getServiceVersion().getVersion(), + id, format, accept, requestOptions, context)); + } + + /** + * Exports a user. + * + * Exports a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportWithResponse(int id, String format, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.exportSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, format, accept, + requestOptions, Context.NONE); + } + + /** + * Exports all users. + * + * Exports all users. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     users (Required): [
+     *          (Required){
+     *             id: int (Required)
+     *             name: String (Optional, Required on create)
+     *             orders (Optional): [
+     *                  (Optional){
+     *                     id: int (Required)
+     *                     userId: int (Optional, Required on create)
+     *                     detail: String (Optional, Required on create)
+     *                 }
+     *             ]
+     *             etag: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> exportAllUsersWithResponseAsync(String format, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.exportAllUsers(this.getEndpoint(), + this.getServiceVersion().getVersion(), format, accept, requestOptions, context)); + } + + /** + * Exports all users. + * + * Exports all users. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     users (Required): [
+     *          (Required){
+     *             id: int (Required)
+     *             name: String (Optional, Required on create)
+     *             orders (Optional): [
+     *                  (Optional){
+     *                     id: int (Required)
+     *                     userId: int (Optional, Required on create)
+     *                     detail: String (Optional, Required on create)
+     *                 }
+     *             ]
+     *             etag: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportAllUsersWithResponse(String format, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.exportAllUsersSync(this.getEndpoint(), this.getServiceVersion().getVersion(), format, accept, + requestOptions, Context.NONE); + } + + /** + * Lists all users. + * + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Lists all users. + * + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional, Required on create)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Optional, Required on create)
+     *             detail: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/JsonMergePatchHelper.java new file mode 100644 index 00000000000..74bed5be156 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/JsonMergePatchHelper.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.basic.implementation; + +import azure.core.basic.models.User; +import azure.core.basic.models.UserOrder; + +/** + * This is the Helper class to enable json merge patch serialization for a model. + */ +public class JsonMergePatchHelper { + private static UserAccessor userAccessor; + + public interface UserAccessor { + User prepareModelForJsonMergePatch(User user, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(User user); + } + + public static void setUserAccessor(UserAccessor accessor) { + userAccessor = accessor; + } + + public static UserAccessor getUserAccessor() { + return userAccessor; + } + + private static UserOrderAccessor userOrderAccessor; + + public interface UserOrderAccessor { + UserOrder prepareModelForJsonMergePatch(UserOrder userOrder, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(UserOrder userOrder); + } + + public static void setUserOrderAccessor(UserOrderAccessor accessor) { + userOrderAccessor = accessor; + } + + public static UserOrderAccessor getUserOrderAccessor() { + return userOrderAccessor; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/package-info.java new file mode 100644 index 00000000000..6a09cf4b857 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Basic. + * Illustrates bodies templated with Azure Core. + * + */ +package azure.core.basic.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/User.java new file mode 100644 index 00000000000..c49b5ff83eb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/User.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.basic.models; + +import azure.core.basic.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Details about a user. + */ +@Fluent +public final class User implements JsonSerializable { + /* + * The user's id. + */ + @Generated + private int id; + + /* + * The user's name. + */ + @Generated + private String name; + + /* + * The user's order list + */ + @Generated + private List orders; + + /* + * The entity tag for this resource. + */ + @Generated + private String etag; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setUserAccessor(new JsonMergePatchHelper.UserAccessor() { + @Override + public User prepareModelForJsonMergePatch(User model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(User model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of User class. + */ + @Generated + public User() { + } + + /** + * Get the id property: The user's id. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * Get the name property: The user's name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The user's name. + *

Required when create the resource.

+ * + * @param name the name value to set. + * @return the User object itself. + */ + @Generated + public User setName(String name) { + this.name = name; + this.updatedProperties.add("name"); + return this; + } + + /** + * Get the orders property: The user's order list. + * + * @return the orders value. + */ + @Generated + public List getOrders() { + return this.orders; + } + + /** + * Set the orders property: The user's order list. + * + * @param orders the orders value to set. + * @return the User object itself. + */ + @Generated + public User setOrders(List orders) { + this.orders = orders; + this.updatedProperties.add("orders"); + return this; + } + + /** + * Get the etag property: The entity tag for this resource. + * + * @return the etag value. + */ + @Generated + public String getEtag() { + return this.etag; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeArrayField("orders", this.orders, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("name")) { + if (this.name == null) { + jsonWriter.writeNullField("name"); + } else { + jsonWriter.writeStringField("name", this.name); + } + } + if (updatedProperties.contains("orders")) { + if (this.orders == null) { + jsonWriter.writeNullField("orders"); + } else { + jsonWriter.writeArrayField("orders", this.orders, (writer, element) -> writer.writeJson(element)); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of User from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the User. + */ + @Generated + public static User fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + User deserializedUser = new User(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedUser.id = reader.getInt(); + } else if ("etag".equals(fieldName)) { + deserializedUser.etag = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedUser.name = reader.getString(); + } else if ("orders".equals(fieldName)) { + List orders = reader.readArray(reader1 -> UserOrder.fromJson(reader1)); + deserializedUser.orders = orders; + } else { + reader.skipChildren(); + } + } + + return deserializedUser; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserList.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserList.java new file mode 100644 index 00000000000..1fdad200694 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserList.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.basic.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The UserList model. + */ +@Immutable +public final class UserList implements JsonSerializable { + /* + * The users property. + */ + @Generated + private final List users; + + /** + * Creates an instance of UserList class. + * + * @param users the users value to set. + */ + @Generated + private UserList(List users) { + this.users = users; + } + + /** + * Get the users property: The users property. + * + * @return the users value. + */ + @Generated + public List getUsers() { + return this.users; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("users", this.users, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserList if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UserList. + */ + @Generated + public static UserList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List users = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("users".equals(fieldName)) { + users = reader.readArray(reader1 -> User.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new UserList(users); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserOrder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserOrder.java new file mode 100644 index 00000000000..aeb217694c6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/UserOrder.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.basic.models; + +import azure.core.basic.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * UserOrder for testing list with expand. + */ +@Fluent +public final class UserOrder implements JsonSerializable { + /* + * The user's id. + */ + @Generated + private int id; + + /* + * The user's id. + */ + @Generated + private int userId; + + /* + * The user's order detail + */ + @Generated + private String detail; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setUserOrderAccessor(new JsonMergePatchHelper.UserOrderAccessor() { + @Override + public UserOrder prepareModelForJsonMergePatch(UserOrder model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(UserOrder model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of UserOrder class. + */ + @Generated + public UserOrder() { + } + + /** + * Get the id property: The user's id. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * Get the userId property: The user's id. + * + * @return the userId value. + */ + @Generated + public int getUserId() { + return this.userId; + } + + /** + * Set the userId property: The user's id. + *

Required when create the resource.

+ * + * @param userId the userId value to set. + * @return the UserOrder object itself. + */ + @Generated + public UserOrder setUserId(int userId) { + this.userId = userId; + this.updatedProperties.add("userId"); + return this; + } + + /** + * Get the detail property: The user's order detail. + * + * @return the detail value. + */ + @Generated + public String getDetail() { + return this.detail; + } + + /** + * Set the detail property: The user's order detail. + *

Required when create the resource.

+ * + * @param detail the detail value to set. + * @return the UserOrder object itself. + */ + @Generated + public UserOrder setDetail(String detail) { + this.detail = detail; + this.updatedProperties.add("detail"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("userId", this.userId); + jsonWriter.writeStringField("detail", this.detail); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("userId")) { + jsonWriter.writeIntField("userId", this.userId); + } + if (updatedProperties.contains("detail")) { + if (this.detail == null) { + jsonWriter.writeNullField("detail"); + } else { + jsonWriter.writeStringField("detail", this.detail); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserOrder from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserOrder if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UserOrder. + */ + @Generated + public static UserOrder fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserOrder deserializedUserOrder = new UserOrder(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedUserOrder.id = reader.getInt(); + } else if ("userId".equals(fieldName)) { + deserializedUserOrder.userId = reader.getInt(); + } else if ("detail".equals(fieldName)) { + deserializedUserOrder.detail = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserOrder; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/package-info.java new file mode 100644 index 00000000000..9aed4461e97 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Basic. + * Illustrates bodies templated with Azure Core. + * + */ +package azure.core.basic.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/package-info.java new file mode 100644 index 00000000000..b7984bdc4df --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/basic/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Basic. + * Illustrates bodies templated with Azure Core. + * + */ +package azure.core.basic; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcAsyncClient.java new file mode 100644 index 00000000000..c44f6cee8e0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcAsyncClient.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.rpc; + +import azure.core.lro.rpc.implementation.RpcClientImpl; +import azure.core.lro.rpc.models.GenerationOptions; +import azure.core.lro.rpc.models.GenerationResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; + +/** + * Initializes a new instance of the asynchronous RpcClient type. + */ +@ServiceClient(builder = RpcClientBuilder.class, isAsync = true) +public final class RpcAsyncClient { + @Generated + private final RpcClientImpl serviceClient; + + /** + * Initializes an instance of RpcAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RpcAsyncClient(RpcClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Generate data. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prompt: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLongRunningRpc(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.beginLongRunningRpcAsync(body, requestOptions); + } + + /** + * Generate data. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLongRunningRpc(GenerationOptions body) { + // Generated convenience method for beginLongRunningRpcWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginLongRunningRpcWithModelAsync(BinaryData.fromObject(body), requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClient.java new file mode 100644 index 00000000000..e96a776a854 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClient.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.rpc; + +import azure.core.lro.rpc.implementation.RpcClientImpl; +import azure.core.lro.rpc.models.GenerationOptions; +import azure.core.lro.rpc.models.GenerationResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.SyncPoller; + +/** + * Initializes a new instance of the synchronous RpcClient type. + */ +@ServiceClient(builder = RpcClientBuilder.class) +public final class RpcClient { + @Generated + private final RpcClientImpl serviceClient; + + /** + * Initializes an instance of RpcClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RpcClient(RpcClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Generate data. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prompt: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLongRunningRpc(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.beginLongRunningRpc(body, requestOptions); + } + + /** + * Generate data. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLongRunningRpc(GenerationOptions body) { + // Generated convenience method for beginLongRunningRpcWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginLongRunningRpcWithModel(BinaryData.fromObject(body), requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClientBuilder.java new file mode 100644 index 00000000000..cb153e10cdf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.rpc; + +import azure.core.lro.rpc.implementation.RpcClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the RpcClient type. + */ +@ServiceClientBuilder(serviceClients = { RpcClient.class, RpcAsyncClient.class }) +public final class RpcClientBuilder + implements HttpTrait, ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-lro-rpc.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the RpcClientBuilder. + */ + @Generated + public RpcClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RpcClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RpcClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RpcClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RpcClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RpcClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RpcClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RpcClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RpcClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private RpcServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the RpcClientBuilder. + */ + @Generated + public RpcClientBuilder serviceVersion(RpcServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the RpcClientBuilder. + */ + @Generated + public RpcClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of RpcClientImpl with the provided parameters. + * + * @return an instance of RpcClientImpl. + */ + @Generated + private RpcClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + RpcServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : RpcServiceVersion.getLatest(); + RpcClientImpl client = new RpcClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + localEndpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of RpcAsyncClient class. + * + * @return an instance of RpcAsyncClient. + */ + @Generated + public RpcAsyncClient buildAsyncClient() { + return new RpcAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of RpcClient class. + * + * @return an instance of RpcClient. + */ + @Generated + public RpcClient buildClient() { + return new RpcClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(RpcClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcServiceVersion.java new file mode 100644 index 00000000000..5f1df22153e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/RpcServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.rpc; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of RpcClient. + */ +public enum RpcServiceVersion implements ServiceVersion { + /** + * Enum value 2022-12-01-preview. + */ + V2022_12_01_PREVIEW("2022-12-01-preview"); + + private final String version; + + RpcServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link RpcServiceVersion}. + */ + public static RpcServiceVersion getLatest() { + return V2022_12_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/OperationLocationPollingStrategy.java new file mode 100644 index 00000000000..5e741b934cd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/OperationLocationPollingStrategy.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.rpc.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.OperationResourcePollingStrategy; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +/** + * Implements an operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public Mono> onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + final Mono> pollResponseMono + = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) + .onErrorResume(exception -> { + LOGGER.info("Failed to parse initial response."); + return Mono.empty(); + }) + .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); + return pollResponseMono.switchIfEmpty( + Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); + } else { + return Mono + .error( + new AzureException(String.format( + "Operation failed or cancelled with status code %d," + + ", '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + } + + /** + * {@inheritDoc} + */ + @Override + public Mono getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + return Mono.error(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + return Mono.error(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + return PollingUtils + .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) + .flatMap(value -> { + if (value.get(propertyName) != null) { + return BinaryData.fromObjectAsync(value.get(propertyName)) + .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); + } else { + return Mono.error(new AzureException("Cannot get final result")); + } + }) + .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/PollingUtils.java new file mode 100644 index 00000000000..0b0557ef059 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/PollingUtils.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.rpc.implementation; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.net.URI; +import java.net.URISyntaxException; +import java.time.DateTimeException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +final class PollingUtils { + + public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE + = new TypeReference>() { + }; + + public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); + + public static final String HTTP_METHOD = "httpMethod"; + public static final String REQUEST_URL = "requestURL"; + public static final String POLL_RESPONSE_BODY = "pollResponseBody"; + + private static final String FORWARD_SLASH = "/"; + + public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { + try { + URI uri = new URI(path); + if (!uri.isAbsolute()) { + if (CoreUtils.isNullOrEmpty(endpoint)) { + throw logger.logExceptionAsError(new IllegalArgumentException( + "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); + } + + if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { + return endpoint + path.substring(1); + } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { + return endpoint + FORWARD_SLASH + path; + } else { + return endpoint + path; + } + } + } catch (URISyntaxException ex) { + throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); + } + return path; + } + + public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + T value; + if (binaryData == null) { + value = null; + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); + } else { + value = binaryData.toObject(typeReference, serializer); + } + return value; + } + + @SuppressWarnings("unchecked") + public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + Mono value; + if (binaryData == null) { + value = Mono.empty(); + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = (Mono) binaryData.toReplayableBinaryDataAsync(); + } else { + value = binaryData.toObjectAsync(typeReference, serializer); + } + return value; + } + + private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); + private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); + + public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { + // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. + Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. + retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then + // attempt to resolve it as an HTTP date (RFC1123). + retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, + headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); + + // Either the retry delay will have been found or it'll be null, null indicates no retry after. + return retryDelay; + } + + private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, + Function delayParser) { + String headerValue = headers.getValue(headerName); + + return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); + } + + private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { + long delaySeconds; + try { + OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); + + delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); + } catch (DateTimeException ex) { + delaySeconds = tryParseLong(value); + } + + return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; + } + + private static long tryParseLong(String value) { + try { + return Long.parseLong(value); + } catch (NumberFormatException ex) { + return -1; + } + } + + private static Duration tryGetDelayMillis(String value) { + long delayMillis = tryParseLong(value); + return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/RpcClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/RpcClientImpl.java new file mode 100644 index 00000000000..fc45b22219b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/RpcClientImpl.java @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.rpc.implementation; + +import azure.core.lro.rpc.RpcServiceVersion; +import azure.core.lro.rpc.models.GenerationResult; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the RpcClient type. + */ +public final class RpcClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RpcClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final RpcServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public RpcServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of RpcClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public RpcClientImpl(String endpoint, RpcServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of RpcClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public RpcClientImpl(HttpPipeline httpPipeline, String endpoint, RpcServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of RpcClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public RpcClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + RpcServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(RpcClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for RpcClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RpcClient") + public interface RpcClientService { + @Post("/azure/core/lro/rpc/generations:submit") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> longRunningRpc(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/azure/core/lro/rpc/generations:submit") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response longRunningRpcSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Generate data. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prompt: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> longRunningRpcWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.longRunningRpc(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context)); + } + + /** + * Generate data. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prompt: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response longRunningRpcWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.longRunningRpcSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, + accept, body, requestOptions, Context.NONE); + } + + /** + * Generate data. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prompt: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLongRunningRpcWithModelAsync(BinaryData body, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.longRunningRpcWithResponseAsync(body, requestOptions), + new azure.core.lro.rpc.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), + TypeReference.createInstance(GenerationResult.class)); + } + + /** + * Generate data. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prompt: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLongRunningRpcWithModel(BinaryData body, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.longRunningRpcWithResponse(body, requestOptions), + new azure.core.lro.rpc.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), + TypeReference.createInstance(GenerationResult.class)); + } + + /** + * Generate data. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prompt: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLongRunningRpcAsync(BinaryData body, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.longRunningRpcWithResponseAsync(body, requestOptions), + new azure.core.lro.rpc.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Generate data. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prompt: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLongRunningRpc(BinaryData body, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.longRunningRpcWithResponse(body, requestOptions), + new azure.core.lro.rpc.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/SyncOperationLocationPollingStrategy.java new file mode 100644 index 00000000000..8d97671b944 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/SyncOperationLocationPollingStrategy.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.rpc.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.io.UncheckedIOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Map; + +// DO NOT modify this helper class + +/** + * Implements a synchronous operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public PollResponse onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + T initialResponseType = null; + try { + initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, + pollResponseType); + } catch (UncheckedIOException e) { + LOGGER.info("Failed to parse initial response."); + } + return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); + } + + throw LOGGER.logExceptionAsError(new AzureException( + String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + + /** + * {@inheritDoc} + */ + public U getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, + PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); + if (pollResult != null && pollResult.get(propertyName) != null) { + return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), + serializer, resultType); + } else { + throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); + } + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/package-info.java new file mode 100644 index 00000000000..e20752fc5b1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Rpc. + * Illustrates bodies templated with Azure Core with long-running RPC operation. + * + */ +package azure.core.lro.rpc.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationOptions.java new file mode 100644 index 00000000000..13d8725cf37 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationOptions.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.rpc.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Options for the generation. + */ +@Immutable +public final class GenerationOptions implements JsonSerializable { + /* + * Prompt. + */ + @Generated + private final String prompt; + + /** + * Creates an instance of GenerationOptions class. + * + * @param prompt the prompt value to set. + */ + @Generated + public GenerationOptions(String prompt) { + this.prompt = prompt; + } + + /** + * Get the prompt property: Prompt. + * + * @return the prompt value. + */ + @Generated + public String getPrompt() { + return this.prompt; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prompt", this.prompt); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GenerationOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GenerationOptions if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GenerationOptions. + */ + @Generated + public static GenerationOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String prompt = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prompt".equals(fieldName)) { + prompt = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new GenerationOptions(prompt); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationResult.java new file mode 100644 index 00000000000..afd8a382b89 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/GenerationResult.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.rpc.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Result of the generation. + */ +@Immutable +public final class GenerationResult implements JsonSerializable { + /* + * The data. + */ + @Generated + private final String data; + + /** + * Creates an instance of GenerationResult class. + * + * @param data the data value to set. + */ + @Generated + private GenerationResult(String data) { + this.data = data; + } + + /** + * Get the data property: The data. + * + * @return the data value. + */ + @Generated + public String getData() { + return this.data; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("data", this.data); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GenerationResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GenerationResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GenerationResult. + */ + @Generated + public static GenerationResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String data = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data".equals(fieldName)) { + data = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new GenerationResult(data); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/package-info.java new file mode 100644 index 00000000000..2ec09e78bc7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Rpc. + * Illustrates bodies templated with Azure Core with long-running RPC operation. + * + */ +package azure.core.lro.rpc.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/package-info.java new file mode 100644 index 00000000000..b5a485d8963 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/rpc/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Rpc. + * Illustrates bodies templated with Azure Core with long-running RPC operation. + * + */ +package azure.core.lro.rpc; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardAsyncClient.java new file mode 100644 index 00000000000..f9b3771566c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardAsyncClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.standard; + +import azure.core.lro.standard.implementation.StandardClientImpl; +import azure.core.lro.standard.models.ExportedUser; +import azure.core.lro.standard.models.User; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; + +/** + * Initializes a new instance of the asynchronous StandardClient type. + */ +@ServiceClient(builder = StandardClientBuilder.class, isAsync = true) +public final class StandardAsyncClient { + @Generated + private final StandardClientImpl serviceClient; + + /** + * Initializes an instance of StandardAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StandardAsyncClient(StandardClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of details about a user. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateOrReplace(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.beginCreateOrReplaceAsync(name, resource, requestOptions); + } + + /** + * Deletes a user. + * + * Deletes a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDelete(String name, RequestOptions requestOptions) { + return this.serviceClient.beginDeleteAsync(name, requestOptions); + } + + /** + * Exports a user. + * + * Exports a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginExport(String name, String format, RequestOptions requestOptions) { + return this.serviceClient.beginExportAsync(name, format, requestOptions); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + * + * @param name The name of user. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of details about a user. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateOrReplace(String name, User resource) { + // Generated convenience method for beginCreateOrReplaceWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginCreateOrReplaceWithModelAsync(name, BinaryData.fromObject(resource), requestOptions); + } + + /** + * Deletes a user. + * + * Deletes a User. + * + * @param name The name of user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDelete(String name) { + // Generated convenience method for beginDeleteWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginDeleteWithModelAsync(name, requestOptions); + } + + /** + * Exports a user. + * + * Exports a User. + * + * @param name The name of user. + * @param format The format of the data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginExport(String name, String format) { + // Generated convenience method for beginExportWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginExportWithModelAsync(name, format, requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClient.java new file mode 100644 index 00000000000..418e6abc9f7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.standard; + +import azure.core.lro.standard.implementation.StandardClientImpl; +import azure.core.lro.standard.models.ExportedUser; +import azure.core.lro.standard.models.User; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.SyncPoller; + +/** + * Initializes a new instance of the synchronous StandardClient type. + */ +@ServiceClient(builder = StandardClientBuilder.class) +public final class StandardClient { + @Generated + private final StandardClientImpl serviceClient; + + /** + * Initializes an instance of StandardClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StandardClient(StandardClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of details about a user. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateOrReplace(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.beginCreateOrReplace(name, resource, requestOptions); + } + + /** + * Deletes a user. + * + * Deletes a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDelete(String name, RequestOptions requestOptions) { + return this.serviceClient.beginDelete(name, requestOptions); + } + + /** + * Exports a user. + * + * Exports a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginExport(String name, String format, RequestOptions requestOptions) { + return this.serviceClient.beginExport(name, format, requestOptions); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + * + * @param name The name of user. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of details about a user. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateOrReplace(String name, User resource) { + // Generated convenience method for beginCreateOrReplaceWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginCreateOrReplaceWithModel(name, BinaryData.fromObject(resource), requestOptions); + } + + /** + * Deletes a user. + * + * Deletes a User. + * + * @param name The name of user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDelete(String name) { + // Generated convenience method for beginDeleteWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginDeleteWithModel(name, requestOptions); + } + + /** + * Exports a user. + * + * Exports a User. + * + * @param name The name of user. + * @param format The format of the data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginExport(String name, String format) { + // Generated convenience method for beginExportWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginExportWithModel(name, format, requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClientBuilder.java new file mode 100644 index 00000000000..713db27e940 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.standard; + +import azure.core.lro.standard.implementation.StandardClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the StandardClient type. + */ +@ServiceClientBuilder(serviceClients = { StandardClient.class, StandardAsyncClient.class }) +public final class StandardClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-lro-standard.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the StandardClientBuilder. + */ + @Generated + public StandardClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StandardClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StandardClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StandardClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StandardClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StandardClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StandardClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StandardClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StandardClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private StandardServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the StandardClientBuilder. + */ + @Generated + public StandardClientBuilder serviceVersion(StandardServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the StandardClientBuilder. + */ + @Generated + public StandardClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of StandardClientImpl with the provided parameters. + * + * @return an instance of StandardClientImpl. + */ + @Generated + private StandardClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + StandardServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : StandardServiceVersion.getLatest(); + StandardClientImpl client = new StandardClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of StandardAsyncClient class. + * + * @return an instance of StandardAsyncClient. + */ + @Generated + public StandardAsyncClient buildAsyncClient() { + return new StandardAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of StandardClient class. + * + * @return an instance of StandardClient. + */ + @Generated + public StandardClient buildClient() { + return new StandardClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(StandardClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardServiceVersion.java new file mode 100644 index 00000000000..e4f9ed20c5d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/StandardServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.standard; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of StandardClient. + */ +public enum StandardServiceVersion implements ServiceVersion { + /** + * Enum value 2022-12-01-preview. + */ + V2022_12_01_PREVIEW("2022-12-01-preview"); + + private final String version; + + StandardServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link StandardServiceVersion}. + */ + public static StandardServiceVersion getLatest() { + return V2022_12_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/OperationLocationPollingStrategy.java new file mode 100644 index 00000000000..f0087961747 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/OperationLocationPollingStrategy.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.standard.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.OperationResourcePollingStrategy; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +/** + * Implements an operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public Mono> onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + final Mono> pollResponseMono + = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) + .onErrorResume(exception -> { + LOGGER.info("Failed to parse initial response."); + return Mono.empty(); + }) + .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); + return pollResponseMono.switchIfEmpty( + Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); + } else { + return Mono + .error( + new AzureException(String.format( + "Operation failed or cancelled with status code %d," + + ", '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + } + + /** + * {@inheritDoc} + */ + @Override + public Mono getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + return Mono.error(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + return Mono.error(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + return PollingUtils + .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) + .flatMap(value -> { + if (value.get(propertyName) != null) { + return BinaryData.fromObjectAsync(value.get(propertyName)) + .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); + } else { + return Mono.error(new AzureException("Cannot get final result")); + } + }) + .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/PollingUtils.java new file mode 100644 index 00000000000..83ec49b76d5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/PollingUtils.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.standard.implementation; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.net.URI; +import java.net.URISyntaxException; +import java.time.DateTimeException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +final class PollingUtils { + + public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE + = new TypeReference>() { + }; + + public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); + + public static final String HTTP_METHOD = "httpMethod"; + public static final String REQUEST_URL = "requestURL"; + public static final String POLL_RESPONSE_BODY = "pollResponseBody"; + + private static final String FORWARD_SLASH = "/"; + + public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { + try { + URI uri = new URI(path); + if (!uri.isAbsolute()) { + if (CoreUtils.isNullOrEmpty(endpoint)) { + throw logger.logExceptionAsError(new IllegalArgumentException( + "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); + } + + if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { + return endpoint + path.substring(1); + } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { + return endpoint + FORWARD_SLASH + path; + } else { + return endpoint + path; + } + } + } catch (URISyntaxException ex) { + throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); + } + return path; + } + + public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + T value; + if (binaryData == null) { + value = null; + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); + } else { + value = binaryData.toObject(typeReference, serializer); + } + return value; + } + + @SuppressWarnings("unchecked") + public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + Mono value; + if (binaryData == null) { + value = Mono.empty(); + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = (Mono) binaryData.toReplayableBinaryDataAsync(); + } else { + value = binaryData.toObjectAsync(typeReference, serializer); + } + return value; + } + + private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); + private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); + + public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { + // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. + Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. + retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then + // attempt to resolve it as an HTTP date (RFC1123). + retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, + headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); + + // Either the retry delay will have been found or it'll be null, null indicates no retry after. + return retryDelay; + } + + private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, + Function delayParser) { + String headerValue = headers.getValue(headerName); + + return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); + } + + private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { + long delaySeconds; + try { + OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); + + delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); + } catch (DateTimeException ex) { + delaySeconds = tryParseLong(value); + } + + return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; + } + + private static long tryParseLong(String value) { + try { + return Long.parseLong(value); + } catch (NumberFormatException ex) { + return -1; + } + } + + private static Duration tryGetDelayMillis(String value) { + long delayMillis = tryParseLong(value); + return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/StandardClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/StandardClientImpl.java new file mode 100644 index 00000000000..6b74c0996ec --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/StandardClientImpl.java @@ -0,0 +1,1107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.standard.implementation; + +import azure.core.lro.standard.StandardServiceVersion; +import azure.core.lro.standard.models.ExportedUser; +import azure.core.lro.standard.models.User; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the StandardClient type. + */ +public final class StandardClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StandardClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final StandardServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public StandardServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of StandardClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public StandardClientImpl(String endpoint, StandardServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of StandardClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public StandardClientImpl(HttpPipeline httpPipeline, String endpoint, StandardServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of StandardClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public StandardClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + StandardServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(StandardClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for StandardClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "StandardClient") + public interface StandardClientService { + @Put("/azure/core/lro/standard/users/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Put("/azure/core/lro/standard/users/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrReplaceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Delete("/azure/core/lro/standard/users/{name}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Delete("/azure/core/lro/standard/users/{name}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/azure/core/lro/standard/users/{name}:export") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> export(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @QueryParam("format") String format, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Post("/azure/core/lro/standard/users/{name}:export") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response exportSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @QueryParam("format") String format, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrReplaceWithResponseAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createOrReplace(this.getEndpoint(), + this.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, context)); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a user along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrReplaceWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrReplaceSync(this.getEndpoint(), this.getServiceVersion().getVersion(), name, contentType, + accept, resource, requestOptions, Context.NONE); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of details about a user. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateOrReplaceWithModelAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.createOrReplaceWithResponseAsync(name, resource, requestOptions), + new azure.core.lro.standard.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion())), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(User.class)); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of details about a user. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateOrReplaceWithModel(String name, BinaryData resource, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.createOrReplaceWithResponse(name, resource, requestOptions), + new azure.core.lro.standard.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion())), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(User.class)); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of details about a user. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateOrReplaceAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.createOrReplaceWithResponseAsync(name, resource, requestOptions), + new azure.core.lro.standard.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Adds a user or replaces a user's fields. + * + * Creates or replaces a User. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     role: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of details about a user. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateOrReplace(String name, BinaryData resource, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.createOrReplaceWithResponse(name, resource, requestOptions), + new azure.core.lro.standard.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Deletes a user. + * + * Deletes a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.delete(this.getEndpoint(), this.getServiceVersion().getVersion(), + name, accept, requestOptions, context)); + } + + /** + * Deletes a user. + * + * Deletes a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.deleteSync(this.getEndpoint(), this.getServiceVersion().getVersion(), name, accept, + requestOptions, Context.NONE); + } + + /** + * Deletes a user. + * + * Deletes a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDeleteWithModelAsync(String name, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), () -> this.deleteWithResponseAsync(name, requestOptions), + new azure.core.lro.standard.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion())), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Void.class)); + } + + /** + * Deletes a user. + * + * Deletes a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDeleteWithModel(String name, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.deleteWithResponse(name, requestOptions), + new azure.core.lro.standard.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion())), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Void.class)); + } + + /** + * Deletes a user. + * + * Deletes a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDeleteAsync(String name, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), () -> this.deleteWithResponseAsync(name, requestOptions), + new azure.core.lro.standard.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(Void.class)); + } + + /** + * Deletes a user. + * + * Deletes a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDelete(String name, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.deleteWithResponse(name, requestOptions), + new azure.core.lro.standard.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(Void.class)); + } + + /** + * Exports a user. + * + * Exports a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportWithResponseAsync(String name, String format, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.export(this.getEndpoint(), this.getServiceVersion().getVersion(), + name, format, accept, requestOptions, context)); + } + + /** + * Exports a user. + * + * Exports a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response exportWithResponse(String name, String format, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.exportSync(this.getEndpoint(), this.getServiceVersion().getVersion(), name, format, accept, + requestOptions, Context.NONE); + } + + /** + * Exports a user. + * + * Exports a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginExportWithModelAsync(String name, String format, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.exportWithResponseAsync(name, format, requestOptions), + new azure.core.lro.standard.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(ExportedUser.class)); + } + + /** + * Exports a user. + * + * Exports a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginExportWithModel(String name, String format, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.exportWithResponse(name, format, requestOptions), + new azure.core.lro.standard.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(ExportedUser.class)); + } + + /** + * Exports a user. + * + * Exports a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginExportAsync(String name, String format, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.exportWithResponseAsync(name, format, requestOptions), + new azure.core.lro.standard.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Exports a user. + * + * Exports a User. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name of user. + * @param format The format of the data. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginExport(String name, String format, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.exportWithResponse(name, format, requestOptions), + new azure.core.lro.standard.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/SyncOperationLocationPollingStrategy.java new file mode 100644 index 00000000000..21e94ae8c51 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/SyncOperationLocationPollingStrategy.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.standard.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.io.UncheckedIOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Map; + +// DO NOT modify this helper class + +/** + * Implements a synchronous operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public PollResponse onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + T initialResponseType = null; + try { + initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, + pollResponseType); + } catch (UncheckedIOException e) { + LOGGER.info("Failed to parse initial response."); + } + return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); + } + + throw LOGGER.logExceptionAsError(new AzureException( + String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + + /** + * {@inheritDoc} + */ + public U getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, + PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); + if (pollResult != null && pollResult.get(propertyName) != null) { + return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), + serializer, resultType); + } else { + throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); + } + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/package-info.java new file mode 100644 index 00000000000..afa5ba5ff6a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Standard. + * Illustrates bodies templated with Azure Core with long-running operation. + * + */ +package azure.core.lro.standard.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/ExportedUser.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/ExportedUser.java new file mode 100644 index 00000000000..9c541f6950b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/ExportedUser.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.standard.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The exported user data. + */ +@Immutable +public final class ExportedUser implements JsonSerializable { + /* + * The name of user. + */ + @Generated + private final String name; + + /* + * The exported URI. + */ + @Generated + private final String resourceUri; + + /** + * Creates an instance of ExportedUser class. + * + * @param name the name value to set. + * @param resourceUri the resourceUri value to set. + */ + @Generated + private ExportedUser(String name, String resourceUri) { + this.name = name; + this.resourceUri = resourceUri; + } + + /** + * Get the name property: The name of user. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the resourceUri property: The exported URI. + * + * @return the resourceUri value. + */ + @Generated + public String getResourceUri() { + return this.resourceUri; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("resourceUri", this.resourceUri); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExportedUser from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExportedUser if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExportedUser. + */ + @Generated + public static ExportedUser fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String resourceUri = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("resourceUri".equals(fieldName)) { + resourceUri = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ExportedUser(name, resourceUri); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/User.java new file mode 100644 index 00000000000..29a6b83c503 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/User.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.standard.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Details about a user. + */ +@Immutable +public final class User implements JsonSerializable { + /* + * The name of user. + */ + @Generated + private String name; + + /* + * The role of user + */ + @Generated + private final String role; + + /** + * Creates an instance of User class. + * + * @param role the role value to set. + */ + @Generated + public User(String role) { + this.role = role; + } + + /** + * Get the name property: The name of user. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the role property: The role of user. + * + * @return the role value. + */ + @Generated + public String getRole() { + return this.role; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("role", this.role); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of User from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the User. + */ + @Generated + public static User fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String role = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("role".equals(fieldName)) { + role = reader.getString(); + } else { + reader.skipChildren(); + } + } + User deserializedUser = new User(role); + deserializedUser.name = name; + + return deserializedUser; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/package-info.java new file mode 100644 index 00000000000..a8c39b76582 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Standard. + * Illustrates bodies templated with Azure Core with long-running operation. + * + */ +package azure.core.lro.standard.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/package-info.java new file mode 100644 index 00000000000..791326fd1fe --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/lro/standard/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Standard. + * Illustrates bodies templated with Azure Core with long-running operation. + * + */ +package azure.core.lro.standard; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelAsyncClient.java new file mode 100644 index 00000000000..75d79a066d2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelAsyncClient.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.model; + +import azure.core.model.implementation.AzureCoreEmbeddingVectorsImpl; +import azure.core.model.models.AzureEmbeddingModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ModelClient type. + */ +@ServiceClient(builder = ModelClientBuilder.class, isAsync = true) +public final class ModelAsyncClient { + @Generated + private final AzureCoreEmbeddingVectorsImpl serviceClient; + + /** + * Initializes an instance of ModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelAsyncClient(AzureCoreEmbeddingVectorsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * get an embedding vector. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an embedding vector along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * put an embedding vector. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * post a model which has an embeddingVector property. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     embedding (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     embedding (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postWithResponseAsync(body, requestOptions); + } + + /** + * get an embedding vector. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an embedding vector on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_INTEGER)); + } + + /** + * put an embedding vector. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * post a model which has an embeddingVector property. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono post(AzureEmbeddingModel body) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AzureEmbeddingModel.class)); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_INTEGER = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClient.java new file mode 100644 index 00000000000..aabdbc0f4fc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClient.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.model; + +import azure.core.model.implementation.AzureCoreEmbeddingVectorsImpl; +import azure.core.model.models.AzureEmbeddingModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; + +/** + * Initializes a new instance of the synchronous ModelClient type. + */ +@ServiceClient(builder = ModelClientBuilder.class) +public final class ModelClient { + @Generated + private final AzureCoreEmbeddingVectorsImpl serviceClient; + + /** + * Initializes an instance of ModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelClient(AzureCoreEmbeddingVectorsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * get an embedding vector. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an embedding vector along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * put an embedding vector. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * post a model which has an embeddingVector property. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     embedding (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     embedding (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postWithResponse(body, requestOptions); + } + + /** + * get an embedding vector. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an embedding vector. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_INTEGER); + } + + /** + * put an embedding vector. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * post a model which has an embeddingVector property. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureEmbeddingModel post(AzureEmbeddingModel body) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(AzureEmbeddingModel.class); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_INTEGER = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClientBuilder.java new file mode 100644 index 00000000000..b5fec48b2f5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.model; + +import azure.core.model.implementation.ModelClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ModelClient type. + */ +@ServiceClientBuilder(serviceClients = { ModelClient.class, ModelAsyncClient.class }) +public final class ModelClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-model.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ModelClientBuilder. + */ + @Generated + public ModelClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private ModelServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the ModelClientBuilder. + */ + @Generated + public ModelClientBuilder serviceVersion(ModelServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ModelClientBuilder. + */ + @Generated + public ModelClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ModelClientImpl with the provided parameters. + * + * @return an instance of ModelClientImpl. + */ + @Generated + private ModelClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ModelServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : ModelServiceVersion.getLatest(); + ModelClientImpl client = new ModelClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + localEndpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ModelAsyncClient class. + * + * @return an instance of ModelAsyncClient. + */ + @Generated + public ModelAsyncClient buildAsyncClient() { + return new ModelAsyncClient(buildInnerClient().getAzureCoreEmbeddingVectors()); + } + + /** + * Builds an instance of ModelClient class. + * + * @return an instance of ModelClient. + */ + @Generated + public ModelClient buildClient() { + return new ModelClient(buildInnerClient().getAzureCoreEmbeddingVectors()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ModelClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelServiceVersion.java new file mode 100644 index 00000000000..108b1cfa12c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/ModelServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.model; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of ModelClient. + */ +public enum ModelServiceVersion implements ServiceVersion { + /** + * Enum value 2022-12-01-preview. + */ + V2022_12_01_PREVIEW("2022-12-01-preview"); + + private final String version; + + ModelServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link ModelServiceVersion}. + */ + public static ModelServiceVersion getLatest() { + return V2022_12_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/AzureCoreEmbeddingVectorsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/AzureCoreEmbeddingVectorsImpl.java new file mode 100644 index 00000000000..a7710adc313 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/AzureCoreEmbeddingVectorsImpl.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.model.implementation; + +import azure.core.model.ModelServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AzureCoreEmbeddingVectors. + */ +public final class AzureCoreEmbeddingVectorsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final AzureCoreEmbeddingVectorsService service; + + /** + * The service client containing this operation class. + */ + private final ModelClientImpl client; + + /** + * Initializes an instance of AzureCoreEmbeddingVectorsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AzureCoreEmbeddingVectorsImpl(ModelClientImpl client) { + this.service = RestProxy.create(AzureCoreEmbeddingVectorsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ModelServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for ModelClientAzureCoreEmbeddingVectors to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ModelClientAzureCoreEmbeddingVectors") + public interface AzureCoreEmbeddingVectorsService { + @Get("/azure/core/model/embeddingVector") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/core/model/embeddingVector") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/azure/core/model/embeddingVector") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/azure/core/model/embeddingVector") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/azure/core/model/embeddingVector") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> post(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/azure/core/model/embeddingVector") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * get an embedding vector. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an embedding vector along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * get an embedding vector. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return an embedding vector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * put an embedding vector. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * put an embedding vector. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * post a model which has an embeddingVector property. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     embedding (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     embedding (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.post(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * post a model which has an embeddingVector property. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     embedding (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     embedding (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.postSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/ModelClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/ModelClientImpl.java new file mode 100644 index 00000000000..eafcea0250b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/ModelClientImpl.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.model.implementation; + +import azure.core.model.ModelServiceVersion; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 ModelClient type. + */ +public final class ModelClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final ModelServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ModelServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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 AzureCoreEmbeddingVectorsImpl object to access its operations. + */ + private final AzureCoreEmbeddingVectorsImpl azureCoreEmbeddingVectors; + + /** + * Gets the AzureCoreEmbeddingVectorsImpl object to access its operations. + * + * @return the AzureCoreEmbeddingVectorsImpl object. + */ + public AzureCoreEmbeddingVectorsImpl getAzureCoreEmbeddingVectors() { + return this.azureCoreEmbeddingVectors; + } + + /** + * Initializes an instance of ModelClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public ModelClientImpl(String endpoint, ModelServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ModelClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public ModelClientImpl(HttpPipeline httpPipeline, String endpoint, ModelServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ModelClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public ModelClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + ModelServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.azureCoreEmbeddingVectors = new AzureCoreEmbeddingVectorsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/package-info.java new file mode 100644 index 00000000000..be97a0cca1c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Model. + * + */ +package azure.core.model.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/AzureEmbeddingModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/AzureEmbeddingModel.java new file mode 100644 index 00000000000..353e9884168 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/AzureEmbeddingModel.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The AzureEmbeddingModel model. + */ +@Immutable +public final class AzureEmbeddingModel implements JsonSerializable { + /* + * The embedding property. + */ + @Generated + private final List embedding; + + /** + * Creates an instance of AzureEmbeddingModel class. + * + * @param embedding the embedding value to set. + */ + @Generated + public AzureEmbeddingModel(List embedding) { + this.embedding = embedding; + } + + /** + * Get the embedding property: The embedding property. + * + * @return the embedding value. + */ + @Generated + public List getEmbedding() { + return this.embedding; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("embedding", this.embedding, (writer, element) -> writer.writeInt(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureEmbeddingModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureEmbeddingModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureEmbeddingModel. + */ + @Generated + public static AzureEmbeddingModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List embedding = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("embedding".equals(fieldName)) { + embedding = reader.readArray(reader1 -> reader1.getInt()); + } else { + reader.skipChildren(); + } + } + return new AzureEmbeddingModel(embedding); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/package-info.java new file mode 100644 index 00000000000..aa165b66da7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Model. + * + */ +package azure.core.model.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/package-info.java new file mode 100644 index 00000000000..87b2a0fb7e5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/model/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Model. + * + */ +package azure.core.model; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageAsyncClient.java new file mode 100644 index 00000000000..ccd87439af6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageAsyncClient.java @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page; + +import azure.core.page.implementation.PageClientImpl; +import azure.core.page.models.ListItemInputBody; +import azure.core.page.models.ListItemInputExtensibleEnum; +import azure.core.page.models.User; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; + +/** + * Initializes a new instance of the asynchronous PageClient type. + */ +@ServiceClient(builder = PageClientBuilder.class, isAsync = true) +public final class PageAsyncClient { + @Generated + private final PageClientImpl serviceClient; + + /** + * Initializes an instance of PageAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PageAsyncClient(PageClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * List with Azure.Core.Page<>. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithPage(RequestOptions requestOptions) { + return this.serviceClient.listWithPageAsync(requestOptions); + } + + /** + * List with extensible enum parameter Azure.Core.Page<>. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
anotherStringNoAnother query parameter. Allowed values: "First", + * "Second".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     inputName: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyInput The body of the input. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithParameters(BinaryData bodyInput, RequestOptions requestOptions) { + return this.serviceClient.listWithParametersAsync(bodyInput, requestOptions); + } + + /** + * List with custom page model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithCustomPageModel(RequestOptions requestOptions) { + return this.serviceClient.listWithCustomPageModelAsync(requestOptions); + } + + /** + * List with parameterized next link that re-injects parameters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
includePendingBooleanNoThe includePending parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param select The select parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux withParameterizedNextLink(String select, RequestOptions requestOptions) { + return this.serviceClient.withParameterizedNextLinkAsync(select, requestOptions); + } + + /** + * List with Azure.Core.Page<>. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithPage() { + // Generated convenience method for listWithPage + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listWithPage(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(User.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List with extensible enum parameter Azure.Core.Page<>. + * + * @param bodyInput The body of the input. + * @param another Another query parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithParameters(ListItemInputBody bodyInput, ListItemInputExtensibleEnum another) { + // Generated convenience method for listWithParameters + RequestOptions requestOptions = new RequestOptions(); + if (another != null) { + requestOptions.addQueryParam("another", another.toString(), false); + } + PagedFlux pagedFluxResponse = listWithParameters(BinaryData.fromObject(bodyInput), requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(User.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List with extensible enum parameter Azure.Core.Page<>. + * + * @param bodyInput The body of the input. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithParameters(ListItemInputBody bodyInput) { + // Generated convenience method for listWithParameters + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listWithParameters(BinaryData.fromObject(bodyInput), requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(User.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List with custom page model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithCustomPageModel() { + // Generated convenience method for listWithCustomPageModel + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listWithCustomPageModel(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(User.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List with parameterized next link that re-injects parameters. + * + * @param select The select parameter. + * @param includePending The includePending parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux withParameterizedNextLink(String select, Boolean includePending) { + // Generated convenience method for withParameterizedNextLink + RequestOptions requestOptions = new RequestOptions(); + if (includePending != null) { + requestOptions.addQueryParam("includePending", String.valueOf(includePending), false); + } + PagedFlux pagedFluxResponse = withParameterizedNextLink(select, requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(User.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List with parameterized next link that re-injects parameters. + * + * @param select The select parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux withParameterizedNextLink(String select) { + // Generated convenience method for withParameterizedNextLink + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = withParameterizedNextLink(select, requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(User.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClient.java new file mode 100644 index 00000000000..d92d2dc4554 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClient.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page; + +import azure.core.page.implementation.PageClientImpl; +import azure.core.page.models.ListItemInputBody; +import azure.core.page.models.ListItemInputExtensibleEnum; +import azure.core.page.models.User; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous PageClient type. + */ +@ServiceClient(builder = PageClientBuilder.class) +public final class PageClient { + @Generated + private final PageClientImpl serviceClient; + + /** + * Initializes an instance of PageClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PageClient(PageClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * List with Azure.Core.Page<>. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithPage(RequestOptions requestOptions) { + return this.serviceClient.listWithPage(requestOptions); + } + + /** + * List with extensible enum parameter Azure.Core.Page<>. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
anotherStringNoAnother query parameter. Allowed values: "First", + * "Second".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     inputName: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyInput The body of the input. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithParameters(BinaryData bodyInput, RequestOptions requestOptions) { + return this.serviceClient.listWithParameters(bodyInput, requestOptions); + } + + /** + * List with custom page model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithCustomPageModel(RequestOptions requestOptions) { + return this.serviceClient.listWithCustomPageModel(requestOptions); + } + + /** + * List with parameterized next link that re-injects parameters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
includePendingBooleanNoThe includePending parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param select The select parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable withParameterizedNextLink(String select, RequestOptions requestOptions) { + return this.serviceClient.withParameterizedNextLink(select, requestOptions); + } + + /** + * List with Azure.Core.Page<>. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithPage() { + // Generated convenience method for listWithPage + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listWithPage(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); + } + + /** + * List with extensible enum parameter Azure.Core.Page<>. + * + * @param bodyInput The body of the input. + * @param another Another query parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithParameters(ListItemInputBody bodyInput, ListItemInputExtensibleEnum another) { + // Generated convenience method for listWithParameters + RequestOptions requestOptions = new RequestOptions(); + if (another != null) { + requestOptions.addQueryParam("another", another.toString(), false); + } + return serviceClient.listWithParameters(BinaryData.fromObject(bodyInput), requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); + } + + /** + * List with extensible enum parameter Azure.Core.Page<>. + * + * @param bodyInput The body of the input. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithParameters(ListItemInputBody bodyInput) { + // Generated convenience method for listWithParameters + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listWithParameters(BinaryData.fromObject(bodyInput), requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); + } + + /** + * List with custom page model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithCustomPageModel() { + // Generated convenience method for listWithCustomPageModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listWithCustomPageModel(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); + } + + /** + * List with parameterized next link that re-injects parameters. + * + * @param select The select parameter. + * @param includePending The includePending parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable withParameterizedNextLink(String select, Boolean includePending) { + // Generated convenience method for withParameterizedNextLink + RequestOptions requestOptions = new RequestOptions(); + if (includePending != null) { + requestOptions.addQueryParam("includePending", String.valueOf(includePending), false); + } + return serviceClient.withParameterizedNextLink(select, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); + } + + /** + * List with parameterized next link that re-injects parameters. + * + * @param select The select parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable withParameterizedNextLink(String select) { + // Generated convenience method for withParameterizedNextLink + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.withParameterizedNextLink(select, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClientBuilder.java new file mode 100644 index 00000000000..78db020bef3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageClientBuilder.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page; + +import azure.core.page.implementation.PageClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the PageClient type. + */ +@ServiceClientBuilder( + serviceClients = { + PageClient.class, + TwoModelsAsPageItemClient.class, + PageAsyncClient.class, + TwoModelsAsPageItemAsyncClient.class }) +public final class PageClientBuilder + implements HttpTrait, ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-page.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the PageClientBuilder. + */ + @Generated + public PageClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private PageServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the PageClientBuilder. + */ + @Generated + public PageClientBuilder serviceVersion(PageServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the PageClientBuilder. + */ + @Generated + public PageClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of PageClientImpl with the provided parameters. + * + * @return an instance of PageClientImpl. + */ + @Generated + private PageClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + PageServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : PageServiceVersion.getLatest(); + PageClientImpl client = new PageClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + localEndpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of PageAsyncClient class. + * + * @return an instance of PageAsyncClient. + */ + @Generated + public PageAsyncClient buildAsyncClient() { + return new PageAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of TwoModelsAsPageItemAsyncClient class. + * + * @return an instance of TwoModelsAsPageItemAsyncClient. + */ + @Generated + public TwoModelsAsPageItemAsyncClient buildTwoModelsAsPageItemAsyncClient() { + return new TwoModelsAsPageItemAsyncClient(buildInnerClient().getTwoModelsAsPageItems()); + } + + /** + * Builds an instance of PageClient class. + * + * @return an instance of PageClient. + */ + @Generated + public PageClient buildClient() { + return new PageClient(buildInnerClient()); + } + + /** + * Builds an instance of TwoModelsAsPageItemClient class. + * + * @return an instance of TwoModelsAsPageItemClient. + */ + @Generated + public TwoModelsAsPageItemClient buildTwoModelsAsPageItemClient() { + return new TwoModelsAsPageItemClient(buildInnerClient().getTwoModelsAsPageItems()); + } + + private static final ClientLogger LOGGER = new ClientLogger(PageClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageServiceVersion.java new file mode 100644 index 00000000000..8f9d6dc1bc6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/PageServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of PageClient. + */ +public enum PageServiceVersion implements ServiceVersion { + /** + * Enum value 2022-12-01-preview. + */ + V2022_12_01_PREVIEW("2022-12-01-preview"); + + private final String version; + + PageServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link PageServiceVersion}. + */ + public static PageServiceVersion getLatest() { + return V2022_12_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemAsyncClient.java new file mode 100644 index 00000000000..944ecd05bbf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemAsyncClient.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page; + +import azure.core.page.implementation.TwoModelsAsPageItemsImpl; +import azure.core.page.models.FirstItem; +import azure.core.page.models.SecondItem; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; + +/** + * Initializes a new instance of the asynchronous PageClient type. + */ +@ServiceClient(builder = PageClientBuilder.class, isAsync = true) +public final class TwoModelsAsPageItemAsyncClient { + @Generated + private final TwoModelsAsPageItemsImpl serviceClient; + + /** + * Initializes an instance of TwoModelsAsPageItemAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TwoModelsAsPageItemAsyncClient(TwoModelsAsPageItemsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * FirstItem. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of FirstItem items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listFirstItem(RequestOptions requestOptions) { + return this.serviceClient.listFirstItemAsync(requestOptions); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * SecondItem. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of SecondItem items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listSecondItem(RequestOptions requestOptions) { + return this.serviceClient.listSecondItemAsync(requestOptions); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * FirstItem. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of FirstItem items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listFirstItem() { + // Generated convenience method for listFirstItem + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listFirstItem(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(FirstItem.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * SecondItem. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of SecondItem items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listSecondItem() { + // Generated convenience method for listSecondItem + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listSecondItem(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(SecondItem.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemClient.java new file mode 100644 index 00000000000..7a73a3f4b40 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/TwoModelsAsPageItemClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page; + +import azure.core.page.implementation.TwoModelsAsPageItemsImpl; +import azure.core.page.models.FirstItem; +import azure.core.page.models.SecondItem; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous PageClient type. + */ +@ServiceClient(builder = PageClientBuilder.class) +public final class TwoModelsAsPageItemClient { + @Generated + private final TwoModelsAsPageItemsImpl serviceClient; + + /** + * Initializes an instance of TwoModelsAsPageItemClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TwoModelsAsPageItemClient(TwoModelsAsPageItemsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * FirstItem. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of FirstItem items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listFirstItem(RequestOptions requestOptions) { + return this.serviceClient.listFirstItem(requestOptions); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * SecondItem. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of SecondItem items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSecondItem(RequestOptions requestOptions) { + return this.serviceClient.listSecondItem(requestOptions); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * FirstItem. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of FirstItem items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listFirstItem() { + // Generated convenience method for listFirstItem + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listFirstItem(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(FirstItem.class)); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * SecondItem. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of SecondItem items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSecondItem() { + // Generated convenience method for listSecondItem + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listSecondItem(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(SecondItem.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/PageClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/PageClientImpl.java new file mode 100644 index 00000000000..c870206103b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/PageClientImpl.java @@ -0,0 +1,1389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page.implementation; + +import azure.core.page.PageServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +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.RequestOptions; +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 com.azure.core.util.UrlBuilder; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the PageClient type. + */ +public final class PageClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PageClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final PageServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public PageServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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 TwoModelsAsPageItemsImpl object to access its operations. + */ + private final TwoModelsAsPageItemsImpl twoModelsAsPageItems; + + /** + * Gets the TwoModelsAsPageItemsImpl object to access its operations. + * + * @return the TwoModelsAsPageItemsImpl object. + */ + public TwoModelsAsPageItemsImpl getTwoModelsAsPageItems() { + return this.twoModelsAsPageItems; + } + + /** + * Initializes an instance of PageClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public PageClientImpl(String endpoint, PageServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of PageClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public PageClientImpl(HttpPipeline httpPipeline, String endpoint, PageServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of PageClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public PageClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + PageServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.twoModelsAsPageItems = new TwoModelsAsPageItemsImpl(this); + this.service = RestProxy.create(PageClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for PageClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "PageClient") + public interface PageClientService { + @Get("/azure/core/page/page") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listWithPage(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/core/page/page") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listWithPageSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/azure/core/page/parameters") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listWithParameters(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData bodyInput, RequestOptions requestOptions, Context context); + + @Post("/azure/core/page/parameters") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listWithParametersSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData bodyInput, RequestOptions requestOptions, Context context); + + @Get("/azure/core/page/custom-page") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listWithCustomPageModel(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/core/page/custom-page") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listWithCustomPageModelSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/core/page/with-parameterized-next-link") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withParameterizedNextLink(@HostParam("endpoint") String endpoint, + @QueryParam("select") String select, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/azure/core/page/with-parameterized-next-link") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withParameterizedNextLinkSync(@HostParam("endpoint") String endpoint, + @QueryParam("select") String select, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listWithPageNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listWithPageNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listWithParametersNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listWithParametersNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listWithCustomPageModelNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listWithCustomPageModelNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withParameterizedNextLinkNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withParameterizedNextLinkNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * List with Azure.Core.Page<>. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithPageSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listWithPage(this.getEndpoint(), this.getServiceVersion().getVersion(), + accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List with Azure.Core.Page<>. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithPageAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listWithPageSinglePageAsync(requestOptions), + nextLink -> listWithPageNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List with Azure.Core.Page<>. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listWithPageSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listWithPageSync(this.getEndpoint(), this.getServiceVersion().getVersion(), + accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List with Azure.Core.Page<>. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithPage(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listWithPageSinglePage(requestOptions), + nextLink -> listWithPageNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * List with extensible enum parameter Azure.Core.Page<>. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
anotherStringNoAnother query parameter. Allowed values: "First", + * "Second".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     inputName: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyInput The body of the input. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithParametersSinglePageAsync(BinaryData bodyInput, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listWithParameters(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, bodyInput, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List with extensible enum parameter Azure.Core.Page<>. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
anotherStringNoAnother query parameter. Allowed values: "First", + * "Second".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     inputName: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyInput The body of the input. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithParametersAsync(BinaryData bodyInput, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listWithParametersSinglePageAsync(bodyInput, requestOptions), + nextLink -> listWithParametersNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List with extensible enum parameter Azure.Core.Page<>. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
anotherStringNoAnother query parameter. Allowed values: "First", + * "Second".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     inputName: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyInput The body of the input. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listWithParametersSinglePage(BinaryData bodyInput, + RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listWithParametersSync(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, bodyInput, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List with extensible enum parameter Azure.Core.Page<>. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
anotherStringNoAnother query parameter. Allowed values: "First", + * "Second".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     inputName: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyInput The body of the input. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithParameters(BinaryData bodyInput, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listWithParametersSinglePage(bodyInput, requestOptions), + nextLink -> listWithParametersNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * List with custom page model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithCustomPageModelSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listWithCustomPageModel(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List with custom page model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithCustomPageModelAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listWithCustomPageModelSinglePageAsync(requestOptions), + nextLink -> listWithCustomPageModelNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List with custom page model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listWithCustomPageModelSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listWithCustomPageModelSync(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List with custom page model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithCustomPageModel(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listWithCustomPageModelSinglePage(requestOptions), + nextLink -> listWithCustomPageModelNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * List with parameterized next link that re-injects parameters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
includePendingBooleanNoThe includePending parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param select The select parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> withParameterizedNextLinkSinglePageAsync(String select, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.withParameterizedNextLink(this.getEndpoint(), select, accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "values"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List with parameterized next link that re-injects parameters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
includePendingBooleanNoThe includePending parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param select The select parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux withParameterizedNextLinkAsync(String select, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + if (requestOptions != null) { + requestOptions.addRequestCallback(httpRequest -> { + UrlBuilder urlBuilder = UrlBuilder.parse(httpRequest.getUrl().toString()); + Map queryParams = urlBuilder.getQuery(); + if (queryParams.containsKey("includePending")) { + requestOptionsForNextPage.addQueryParam("includePending", queryParams.get("includePending")); + } + }); + } + return new PagedFlux<>(() -> withParameterizedNextLinkSinglePageAsync(select, requestOptions), + nextLink -> withParameterizedNextLinkNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List with parameterized next link that re-injects parameters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
includePendingBooleanNoThe includePending parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param select The select parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse withParameterizedNextLinkSinglePage(String select, + RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.withParameterizedNextLinkSync(this.getEndpoint(), select, accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "values"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List with parameterized next link that re-injects parameters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
includePendingBooleanNoThe includePending parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param select The select parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable withParameterizedNextLink(String select, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + if (requestOptions != null) { + requestOptions.addRequestCallback(httpRequest -> { + UrlBuilder urlBuilder = UrlBuilder.parse(httpRequest.getUrl().toString()); + Map queryParams = urlBuilder.getQuery(); + if (queryParams.containsKey("includePending")) { + requestOptionsForNextPage.addQueryParam("includePending", queryParams.get("includePending")); + } + }); + } + return new PagedIterable<>(() -> withParameterizedNextLinkSinglePage(select, requestOptions), + nextLink -> withParameterizedNextLinkNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithPageNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listWithPageNext(nextLink, this.getEndpoint(), 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
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listWithPageNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listWithPageNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); + return 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
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithParametersNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listWithParametersNext(nextLink, this.getEndpoint(), 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
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listWithParametersNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listWithParametersNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); + return 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
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithCustomPageModelNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listWithCustomPageModelNext(nextLink, this.getEndpoint(), accept, + requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listWithCustomPageModelNextSinglePage(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listWithCustomPageModelNextSync(nextLink, this.getEndpoint(), accept, + requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "items"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> withParameterizedNextLinkNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.withParameterizedNextLinkNext(nextLink, this.getEndpoint(), 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
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     *     orders (Optional): [
+     *          (Optional){
+     *             id: int (Required)
+     *             userId: int (Required)
+     *             detail: String (Required)
+     *         }
+     *     ]
+     *     etag: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse withParameterizedNextLinkNextSinglePage(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.withParameterizedNextLinkNextSync(nextLink, this.getEndpoint(), accept, + requestOptions, Context.NONE); + return 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 { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java new file mode 100644 index 00000000000..177aee41257 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java @@ -0,0 +1,534 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page.implementation; + +import azure.core.page.PageServiceVersion; +import com.azure.core.annotation.ExpectedResponses; +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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +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.RequestOptions; +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 TwoModelsAsPageItems. + */ +public final class TwoModelsAsPageItemsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final TwoModelsAsPageItemsService service; + + /** + * The service client containing this operation class. + */ + private final PageClientImpl client; + + /** + * Initializes an instance of TwoModelsAsPageItemsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TwoModelsAsPageItemsImpl(PageClientImpl client) { + this.service = RestProxy.create(TwoModelsAsPageItemsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public PageServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for PageClientTwoModelsAsPageItems to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "PageClientTwoModelsAsPageItems") + public interface TwoModelsAsPageItemsService { + @Get("/azure/core/page/first-item") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listFirstItem(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/core/page/first-item") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listFirstItemSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/core/page/second-item") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listSecondItem(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/core/page/second-item") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSecondItemSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listFirstItemNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listFirstItemNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listSecondItemNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSecondItemNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * FirstItem. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of FirstItem items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listFirstItemSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listFirstItem(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * FirstItem. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of FirstItem items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listFirstItemAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listFirstItemSinglePageAsync(requestOptions), + nextLink -> listFirstItemNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * FirstItem. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of FirstItem items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listFirstItemSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listFirstItemSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * FirstItem. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of FirstItem items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listFirstItem(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listFirstItemSinglePage(requestOptions), + nextLink -> listFirstItemNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * SecondItem. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of SecondItem items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSecondItemSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listSecondItem(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * SecondItem. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of SecondItem items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listSecondItemAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listSecondItemSinglePageAsync(requestOptions), + nextLink -> listSecondItemNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * SecondItem. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of SecondItem items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSecondItemSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listSecondItemSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Two operations with two different page item types should be successfully generated. Should generate model for + * SecondItem. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of SecondItem items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSecondItem(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listSecondItemSinglePage(requestOptions), + nextLink -> listSecondItemNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of FirstItem items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listFirstItemNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listFirstItemNext(nextLink, this.client.getEndpoint(), 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
+     * {
+     *     id: int (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of FirstItem items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listFirstItemNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listFirstItemNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return 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
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of SecondItem items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSecondItemNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listSecondItemNext(nextLink, this.client.getEndpoint(), 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
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of SecondItem items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSecondItemNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listSecondItemNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/package-info.java new file mode 100644 index 00000000000..e8b34fec789 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Page. + * Illustrates bodies templated with Azure Core with paging support. + * + */ +package azure.core.page.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/FirstItem.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/FirstItem.java new file mode 100644 index 00000000000..3a253d4c0ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/FirstItem.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * First item. + */ +@Immutable +public final class FirstItem implements JsonSerializable { + /* + * The id of the item. + */ + @Generated + private int id; + + /** + * Creates an instance of FirstItem class. + */ + @Generated + private FirstItem() { + } + + /** + * Get the id property: The id of the item. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirstItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirstItem if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FirstItem. + */ + @Generated + public static FirstItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirstItem deserializedFirstItem = new FirstItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFirstItem.id = reader.getInt(); + } else { + reader.skipChildren(); + } + } + + return deserializedFirstItem; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputBody.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputBody.java new file mode 100644 index 00000000000..216dca2398e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputBody.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The body of the input. + */ +@Immutable +public final class ListItemInputBody implements JsonSerializable { + /* + * The name of the input. + */ + @Generated + private final String inputName; + + /** + * Creates an instance of ListItemInputBody class. + * + * @param inputName the inputName value to set. + */ + @Generated + public ListItemInputBody(String inputName) { + this.inputName = inputName; + } + + /** + * Get the inputName property: The name of the input. + * + * @return the inputName value. + */ + @Generated + public String getInputName() { + return this.inputName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("inputName", this.inputName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListItemInputBody from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListItemInputBody if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ListItemInputBody. + */ + @Generated + public static ListItemInputBody fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String inputName = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("inputName".equals(fieldName)) { + inputName = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ListItemInputBody(inputName); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputExtensibleEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputExtensibleEnum.java new file mode 100644 index 00000000000..e8ef6821558 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/ListItemInputExtensibleEnum.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page.models; + +/** + * An extensible enum input parameter. + */ +public enum ListItemInputExtensibleEnum { + /** + * The first enum value. + */ + FIRST("First"), + + /** + * The second enum value. + */ + SECOND("Second"); + + /** + * The actual serialized value for a ListItemInputExtensibleEnum instance. + */ + private final String value; + + ListItemInputExtensibleEnum(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ListItemInputExtensibleEnum instance. + * + * @param value the serialized value to parse. + * @return the parsed ListItemInputExtensibleEnum object, or null if unable to parse. + */ + public static ListItemInputExtensibleEnum fromString(String value) { + if (value == null) { + return null; + } + ListItemInputExtensibleEnum[] items = ListItemInputExtensibleEnum.values(); + for (ListItemInputExtensibleEnum item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/SecondItem.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/SecondItem.java new file mode 100644 index 00000000000..78284815a72 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/SecondItem.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Second item. + */ +@Immutable +public final class SecondItem implements JsonSerializable { + /* + * The name of the item. + */ + @Generated + private String name; + + /** + * Creates an instance of SecondItem class. + */ + @Generated + private SecondItem() { + } + + /** + * Get the name property: The name of the item. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecondItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecondItem if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecondItem. + */ + @Generated + public static SecondItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecondItem deserializedSecondItem = new SecondItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSecondItem.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecondItem; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/User.java new file mode 100644 index 00000000000..79073d63522 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/User.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Details about a user. + */ +@Immutable +public final class User implements JsonSerializable { + /* + * The user's id. + */ + @Generated + private int id; + + /* + * The user's name. + */ + @Generated + private final String name; + + /* + * The user's order list + */ + @Generated + private List orders; + + /* + * The entity tag for this resource. + */ + @Generated + private String etag; + + /** + * Creates an instance of User class. + * + * @param name the name value to set. + */ + @Generated + private User(String name) { + this.name = name; + } + + /** + * Get the id property: The user's id. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * Get the name property: The user's name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the orders property: The user's order list. + * + * @return the orders value. + */ + @Generated + public List getOrders() { + return this.orders; + } + + /** + * Get the etag property: The entity tag for this resource. + * + * @return the etag value. + */ + @Generated + public String getEtag() { + return this.etag; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeArrayField("orders", this.orders, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of User from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the User. + */ + @Generated + public static User fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int id = 0; + String name = null; + String etag = null; + List orders = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getInt(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("etag".equals(fieldName)) { + etag = reader.getString(); + } else if ("orders".equals(fieldName)) { + orders = reader.readArray(reader1 -> UserOrder.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + User deserializedUser = new User(name); + deserializedUser.id = id; + deserializedUser.etag = etag; + deserializedUser.orders = orders; + + return deserializedUser; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/UserOrder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/UserOrder.java new file mode 100644 index 00000000000..57223330106 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/UserOrder.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * UserOrder for testing list with expand. + */ +@Immutable +public final class UserOrder implements JsonSerializable { + /* + * The user's id. + */ + @Generated + private int id; + + /* + * The user's id. + */ + @Generated + private final int userId; + + /* + * The user's order detail + */ + @Generated + private final String detail; + + /** + * Creates an instance of UserOrder class. + * + * @param userId the userId value to set. + * @param detail the detail value to set. + */ + @Generated + private UserOrder(int userId, String detail) { + this.userId = userId; + this.detail = detail; + } + + /** + * Get the id property: The user's id. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * Get the userId property: The user's id. + * + * @return the userId value. + */ + @Generated + public int getUserId() { + return this.userId; + } + + /** + * Get the detail property: The user's order detail. + * + * @return the detail value. + */ + @Generated + public String getDetail() { + return this.detail; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("userId", this.userId); + jsonWriter.writeStringField("detail", this.detail); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserOrder from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserOrder if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UserOrder. + */ + @Generated + public static UserOrder fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int id = 0; + int userId = 0; + String detail = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getInt(); + } else if ("userId".equals(fieldName)) { + userId = reader.getInt(); + } else if ("detail".equals(fieldName)) { + detail = reader.getString(); + } else { + reader.skipChildren(); + } + } + UserOrder deserializedUserOrder = new UserOrder(userId, detail); + deserializedUserOrder.id = id; + + return deserializedUserOrder; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/package-info.java new file mode 100644 index 00000000000..586acb3d66a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Page. + * Illustrates bodies templated with Azure Core with paging support. + * + */ +package azure.core.page.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/package-info.java new file mode 100644 index 00000000000..a6c2f64f4c4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/page/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Page. + * Illustrates bodies templated with Azure Core with paging support. + * + */ +package azure.core.page; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarAsyncClient.java new file mode 100644 index 00000000000..7e9252a3a54 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarAsyncClient.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.scalar; + +import azure.core.scalar.implementation.AzureLocationScalarsImpl; +import azure.core.scalar.models.AzureLocationModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) +public final class ScalarAsyncClient { + @Generated + private final AzureLocationScalarsImpl serviceClient; + + /** + * Initializes an instance of ScalarAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ScalarAsyncClient(AzureLocationScalarsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * get azureLocation value. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return azureLocation value along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * put azureLocation value. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * post a model which has azureLocation property. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     location: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     location: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postWithResponseAsync(body, requestOptions); + } + + /** + * azureLocation value header. + * + * @param region _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> headerMethodWithResponse(String region, RequestOptions requestOptions) { + return this.serviceClient.headerMethodWithResponseAsync(region, requestOptions); + } + + /** + * azureLocation value query. + * + * @param region _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> queryWithResponse(String region, RequestOptions requestOptions) { + return this.serviceClient.queryWithResponseAsync(region, requestOptions); + } + + /** + * get azureLocation value. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azureLocation value on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(String.class)); + } + + /** + * put azureLocation value. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(String body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * post a model which has azureLocation property. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono post(AzureLocationModel body) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AzureLocationModel.class)); + } + + /** + * azureLocation value header. + * + * @param region _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono headerMethod(String region) { + // Generated convenience method for headerMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return headerMethodWithResponse(region, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * azureLocation value query. + * + * @param region _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono query(String region) { + // Generated convenience method for queryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return queryWithResponse(region, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClient.java new file mode 100644 index 00000000000..a30e9ff33e2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClient.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.scalar; + +import azure.core.scalar.implementation.AzureLocationScalarsImpl; +import azure.core.scalar.models.AzureLocationModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class) +public final class ScalarClient { + @Generated + private final AzureLocationScalarsImpl serviceClient; + + /** + * Initializes an instance of ScalarClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ScalarClient(AzureLocationScalarsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * get azureLocation value. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return azureLocation value along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * put azureLocation value. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * post a model which has azureLocation property. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     location: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     location: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postWithResponse(body, requestOptions); + } + + /** + * azureLocation value header. + * + * @param region _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headerMethodWithResponse(String region, RequestOptions requestOptions) { + return this.serviceClient.headerMethodWithResponse(region, requestOptions); + } + + /** + * azureLocation value query. + * + * @param region _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response queryWithResponse(String region, RequestOptions requestOptions) { + return this.serviceClient.queryWithResponse(region, requestOptions); + } + + /** + * get azureLocation value. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azureLocation value. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public String get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(String.class); + } + + /** + * put azureLocation value. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(String body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * post a model which has azureLocation property. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureLocationModel post(AzureLocationModel body) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(AzureLocationModel.class); + } + + /** + * azureLocation value header. + * + * @param region _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void headerMethod(String region) { + // Generated convenience method for headerMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + headerMethodWithResponse(region, requestOptions).getValue(); + } + + /** + * azureLocation value query. + * + * @param region _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void query(String region) { + // Generated convenience method for queryWithResponse + RequestOptions requestOptions = new RequestOptions(); + queryWithResponse(region, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClientBuilder.java new file mode 100644 index 00000000000..6402651ad25 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.scalar; + +import azure.core.scalar.implementation.ScalarClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ScalarClient type. + */ +@ServiceClientBuilder(serviceClients = { ScalarClient.class, ScalarAsyncClient.class }) +public final class ScalarClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-scalar.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ScalarClientBuilder. + */ + @Generated + public ScalarClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private ScalarServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the ScalarClientBuilder. + */ + @Generated + public ScalarClientBuilder serviceVersion(ScalarServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ScalarClientBuilder. + */ + @Generated + public ScalarClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ScalarClientImpl with the provided parameters. + * + * @return an instance of ScalarClientImpl. + */ + @Generated + private ScalarClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ScalarServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : ScalarServiceVersion.getLatest(); + ScalarClientImpl client = new ScalarClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + localEndpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ScalarAsyncClient class. + * + * @return an instance of ScalarAsyncClient. + */ + @Generated + public ScalarAsyncClient buildAsyncClient() { + return new ScalarAsyncClient(buildInnerClient().getAzureLocationScalars()); + } + + /** + * Builds an instance of ScalarClient class. + * + * @return an instance of ScalarClient. + */ + @Generated + public ScalarClient buildClient() { + return new ScalarClient(buildInnerClient().getAzureLocationScalars()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ScalarClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarServiceVersion.java new file mode 100644 index 00000000000..040e5d7c8fb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/ScalarServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.scalar; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of ScalarClient. + */ +public enum ScalarServiceVersion implements ServiceVersion { + /** + * Enum value 2022-12-01-preview. + */ + V2022_12_01_PREVIEW("2022-12-01-preview"); + + private final String version; + + ScalarServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link ScalarServiceVersion}. + */ + public static ScalarServiceVersion getLatest() { + return V2022_12_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/AzureLocationScalarsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/AzureLocationScalarsImpl.java new file mode 100644 index 00000000000..e459eaf4eba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/AzureLocationScalarsImpl.java @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.scalar.implementation; + +import azure.core.scalar.ScalarServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AzureLocationScalars. + */ +public final class AzureLocationScalarsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final AzureLocationScalarsService service; + + /** + * The service client containing this operation class. + */ + private final ScalarClientImpl client; + + /** + * Initializes an instance of AzureLocationScalarsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AzureLocationScalarsImpl(ScalarClientImpl client) { + this.service = RestProxy.create(AzureLocationScalarsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ScalarServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for ScalarClientAzureLocationScalars to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ScalarClientAzureLocationScalars") + public interface AzureLocationScalarsService { + @Get("/azure/core/scalar/azureLocation") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/core/scalar/azureLocation") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/azure/core/scalar/azureLocation") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/azure/core/scalar/azureLocation") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/azure/core/scalar/azureLocation") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> post(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/azure/core/scalar/azureLocation") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/azure/core/scalar/azureLocation/header") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> headerMethod(@HostParam("endpoint") String endpoint, @HeaderParam("region") String region, + RequestOptions requestOptions, Context context); + + @Post("/azure/core/scalar/azureLocation/header") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response headerMethodSync(@HostParam("endpoint") String endpoint, @HeaderParam("region") String region, + RequestOptions requestOptions, Context context); + + @Post("/azure/core/scalar/azureLocation/query") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> query(@HostParam("endpoint") String endpoint, @QueryParam("region") String region, + RequestOptions requestOptions, Context context); + + @Post("/azure/core/scalar/azureLocation/query") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response querySync(@HostParam("endpoint") String endpoint, @QueryParam("region") String region, + RequestOptions requestOptions, Context context); + } + + /** + * get azureLocation value. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return azureLocation value along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * get azureLocation value. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return azureLocation value along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * put azureLocation value. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * put azureLocation value. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * post a model which has azureLocation property. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     location: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     location: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.post(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * post a model which has azureLocation property. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     location: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     location: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.postSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * azureLocation value header. + * + * @param region _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> headerMethodWithResponseAsync(String region, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.headerMethod(this.client.getEndpoint(), region, requestOptions, context)); + } + + /** + * azureLocation value header. + * + * @param region _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headerMethodWithResponse(String region, RequestOptions requestOptions) { + return service.headerMethodSync(this.client.getEndpoint(), region, requestOptions, Context.NONE); + } + + /** + * azureLocation value query. + * + * @param region _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> queryWithResponseAsync(String region, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.query(this.client.getEndpoint(), region, requestOptions, context)); + } + + /** + * azureLocation value query. + * + * @param region _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response queryWithResponse(String region, RequestOptions requestOptions) { + return service.querySync(this.client.getEndpoint(), region, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/ScalarClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/ScalarClientImpl.java new file mode 100644 index 00000000000..f02ea66e3c2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/ScalarClientImpl.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.scalar.implementation; + +import azure.core.scalar.ScalarServiceVersion; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 ScalarClient type. + */ +public final class ScalarClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final ScalarServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ScalarServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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 AzureLocationScalarsImpl object to access its operations. + */ + private final AzureLocationScalarsImpl azureLocationScalars; + + /** + * Gets the AzureLocationScalarsImpl object to access its operations. + * + * @return the AzureLocationScalarsImpl object. + */ + public AzureLocationScalarsImpl getAzureLocationScalars() { + return this.azureLocationScalars; + } + + /** + * Initializes an instance of ScalarClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public ScalarClientImpl(String endpoint, ScalarServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ScalarClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public ScalarClientImpl(HttpPipeline httpPipeline, String endpoint, ScalarServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ScalarClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public ScalarClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + ScalarServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.azureLocationScalars = new AzureLocationScalarsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/package-info.java new file mode 100644 index 00000000000..53c0447681d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Scalar. + * + */ +package azure.core.scalar.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/AzureLocationModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/AzureLocationModel.java new file mode 100644 index 00000000000..796aa35bccc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/AzureLocationModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.scalar.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The AzureLocationModel model. + */ +@Immutable +public final class AzureLocationModel implements JsonSerializable { + /* + * The location property. + */ + @Generated + private final String location; + + /** + * Creates an instance of AzureLocationModel class. + * + * @param location the location value to set. + */ + @Generated + public AzureLocationModel(String location) { + this.location = location; + } + + /** + * Get the location property: The location property. + * + * @return the location value. + */ + @Generated + public String getLocation() { + return this.location; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureLocationModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureLocationModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureLocationModel. + */ + @Generated + public static AzureLocationModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String location = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("location".equals(fieldName)) { + location = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new AzureLocationModel(location); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/package-info.java new file mode 100644 index 00000000000..efdd10b7115 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Scalar. + * + */ +package azure.core.scalar.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/package-info.java new file mode 100644 index 00000000000..f48930a0b2e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/scalar/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Scalar. + * + */ +package azure.core.scalar; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsAsyncClient.java new file mode 100644 index 00000000000..6e664b20672 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsAsyncClient.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.traits; + +import azure.core.traits.implementation.TraitsClientImpl; +import azure.core.traits.models.User; +import azure.core.traits.models.UserActionParam; +import azure.core.traits.models.UserActionResponse; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.RequestConditions; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous TraitsClient type. + */ +@ServiceClient(builder = TraitsClientBuilder.class, isAsync = true) +public final class TraitsAsyncClient { + @Generated + private final TraitsClientImpl serviceClient; + + /** + * Initializes an instance of TraitsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TraitsAsyncClient(TraitsClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get a resource, sending and receiving headers. + *

Header Parameters

+ * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the + * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity + * was modified after this time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param foo header in request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a resource, sending and receiving headers along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> smokeTestWithResponse(int id, String foo, RequestOptions requestOptions) { + return this.serviceClient.smokeTestWithResponseAsync(id, foo, requestOptions); + } + + /** + * Test for repeatable requests. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     userActionValue: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     userActionResult: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return user action response along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> repeatableActionWithResponse(int id, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.repeatableActionWithResponseAsync(id, body, requestOptions); + } + + /** + * Get a resource, sending and receiving headers. + * + * @param id The user's id. + * @param foo header in request. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource, sending and receiving headers on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono smokeTest(int id, String foo, RequestConditions requestConditions) { + // Generated convenience method for smokeTestWithResponse + RequestOptions requestOptions = new RequestOptions(); + String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); + String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); + OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); + OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + if (ifUnmodifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifModifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } + return smokeTestWithResponse(id, foo, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(User.class)); + } + + /** + * Get a resource, sending and receiving headers. + * + * @param id The user's id. + * @param foo header in request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource, sending and receiving headers on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono smokeTest(int id, String foo) { + // Generated convenience method for smokeTestWithResponse + RequestOptions requestOptions = new RequestOptions(); + return smokeTestWithResponse(id, foo, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(User.class)); + } + + /** + * Test for repeatable requests. + * + * @param id The user's id. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user action response on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono repeatableAction(int id, UserActionParam body) { + // Generated convenience method for repeatableActionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return repeatableActionWithResponse(id, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UserActionResponse.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClient.java new file mode 100644 index 00000000000..13ca40d7ea1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClient.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.traits; + +import azure.core.traits.implementation.TraitsClientImpl; +import azure.core.traits.models.User; +import azure.core.traits.models.UserActionParam; +import azure.core.traits.models.UserActionResponse; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.RequestConditions; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.DateTimeRfc1123; +import java.time.OffsetDateTime; + +/** + * Initializes a new instance of the synchronous TraitsClient type. + */ +@ServiceClient(builder = TraitsClientBuilder.class) +public final class TraitsClient { + @Generated + private final TraitsClientImpl serviceClient; + + /** + * Initializes an instance of TraitsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TraitsClient(TraitsClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get a resource, sending and receiving headers. + *

Header Parameters

+ * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the + * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity + * was modified after this time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param foo header in request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a resource, sending and receiving headers along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response smokeTestWithResponse(int id, String foo, RequestOptions requestOptions) { + return this.serviceClient.smokeTestWithResponse(id, foo, requestOptions); + } + + /** + * Test for repeatable requests. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     userActionValue: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     userActionResult: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return user action response along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response repeatableActionWithResponse(int id, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.repeatableActionWithResponse(id, body, requestOptions); + } + + /** + * Get a resource, sending and receiving headers. + * + * @param id The user's id. + * @param foo header in request. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource, sending and receiving headers. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public User smokeTest(int id, String foo, RequestConditions requestConditions) { + // Generated convenience method for smokeTestWithResponse + RequestOptions requestOptions = new RequestOptions(); + String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); + String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); + OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); + OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + if (ifUnmodifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifModifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } + return smokeTestWithResponse(id, foo, requestOptions).getValue().toObject(User.class); + } + + /** + * Get a resource, sending and receiving headers. + * + * @param id The user's id. + * @param foo header in request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a resource, sending and receiving headers. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public User smokeTest(int id, String foo) { + // Generated convenience method for smokeTestWithResponse + RequestOptions requestOptions = new RequestOptions(); + return smokeTestWithResponse(id, foo, requestOptions).getValue().toObject(User.class); + } + + /** + * Test for repeatable requests. + * + * @param id The user's id. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user action response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UserActionResponse repeatableAction(int id, UserActionParam body) { + // Generated convenience method for repeatableActionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return repeatableActionWithResponse(id, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(UserActionResponse.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClientBuilder.java new file mode 100644 index 00000000000..42d02b04e7e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.traits; + +import azure.core.traits.implementation.TraitsClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the TraitsClient type. + */ +@ServiceClientBuilder(serviceClients = { TraitsClient.class, TraitsAsyncClient.class }) +public final class TraitsClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-core-traits.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the TraitsClientBuilder. + */ + @Generated + public TraitsClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TraitsClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TraitsClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TraitsClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TraitsClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TraitsClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TraitsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TraitsClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TraitsClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private TraitsServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the TraitsClientBuilder. + */ + @Generated + public TraitsClientBuilder serviceVersion(TraitsServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the TraitsClientBuilder. + */ + @Generated + public TraitsClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of TraitsClientImpl with the provided parameters. + * + * @return an instance of TraitsClientImpl. + */ + @Generated + private TraitsClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + TraitsServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : TraitsServiceVersion.getLatest(); + TraitsClientImpl client = new TraitsClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + localEndpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of TraitsAsyncClient class. + * + * @return an instance of TraitsAsyncClient. + */ + @Generated + public TraitsAsyncClient buildAsyncClient() { + return new TraitsAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of TraitsClient class. + * + * @return an instance of TraitsClient. + */ + @Generated + public TraitsClient buildClient() { + return new TraitsClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(TraitsClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsServiceVersion.java new file mode 100644 index 00000000000..84e5f05f2b8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/TraitsServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.traits; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of TraitsClient. + */ +public enum TraitsServiceVersion implements ServiceVersion { + /** + * Enum value 2022-12-01-preview. + */ + V2022_12_01_PREVIEW("2022-12-01-preview"); + + private final String version; + + TraitsServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link TraitsServiceVersion}. + */ + public static TraitsServiceVersion getLatest() { + return V2022_12_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/TraitsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/TraitsClientImpl.java new file mode 100644 index 00000000000..9c63246859b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/TraitsClientImpl.java @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.traits.implementation; + +import azure.core.traits.TraitsServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the TraitsClient type. + */ +public final class TraitsClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final TraitsClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final TraitsServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public TraitsServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of TraitsClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public TraitsClientImpl(String endpoint, TraitsServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of TraitsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public TraitsClientImpl(HttpPipeline httpPipeline, String endpoint, TraitsServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of TraitsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public TraitsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + TraitsServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(TraitsClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for TraitsClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "TraitsClient") + public interface TraitsClientService { + @Get("/azure/core/traits/user/{id}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> smokeTest(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, @HeaderParam("foo") String foo, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/azure/core/traits/user/{id}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response smokeTestSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, @HeaderParam("foo") String foo, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/azure/core/traits/user/{id}:repeatableAction") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> repeatableAction(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/azure/core/traits/user/{id}:repeatableAction") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response repeatableActionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") int id, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get a resource, sending and receiving headers. + *

Header Parameters

+ * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the + * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity + * was modified after this time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param foo header in request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a resource, sending and receiving headers along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> smokeTestWithResponseAsync(int id, String foo, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.smokeTest(this.getEndpoint(), + this.getServiceVersion().getVersion(), id, foo, accept, requestOptions, context)); + } + + /** + * Get a resource, sending and receiving headers. + *

Header Parameters

+ * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the + * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity + * was modified after this time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param foo header in request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a resource, sending and receiving headers along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response smokeTestWithResponse(int id, String foo, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.smokeTestSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, foo, accept, + requestOptions, Context.NONE); + } + + /** + * Test for repeatable requests. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     userActionValue: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     userActionResult: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return user action response along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> repeatableActionWithResponseAsync(int id, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return FluxUtil.withContext(context -> service.repeatableAction(this.getEndpoint(), + this.getServiceVersion().getVersion(), id, contentType, accept, body, requestOptionsLocal, context)); + } + + /** + * Test for repeatable requests. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     userActionValue: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     userActionResult: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The user's id. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return user action response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response repeatableActionWithResponse(int id, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return service.repeatableActionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, contentType, + accept, body, requestOptionsLocal, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/package-info.java new file mode 100644 index 00000000000..532fee74378 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Traits. + * Illustrates Azure Core operation customizations by traits. + * + */ +package azure.core.traits.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/User.java new file mode 100644 index 00000000000..15ef9101b89 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/User.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.traits.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Sample Model. + */ +@Immutable +public final class User implements JsonSerializable { + /* + * The user's id. + */ + @Generated + private int id; + + /* + * The user's name. + */ + @Generated + private String name; + + /** + * Creates an instance of User class. + */ + @Generated + private User() { + } + + /** + * Get the id property: The user's id. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * Get the name property: The user's name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of User from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the User. + */ + @Generated + public static User fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + User deserializedUser = new User(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedUser.id = reader.getInt(); + } else if ("name".equals(fieldName)) { + deserializedUser.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUser; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionParam.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionParam.java new file mode 100644 index 00000000000..ff13bc84f1f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionParam.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.traits.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * User action param. + */ +@Immutable +public final class UserActionParam implements JsonSerializable { + /* + * User action value. + */ + @Generated + private final String userActionValue; + + /** + * Creates an instance of UserActionParam class. + * + * @param userActionValue the userActionValue value to set. + */ + @Generated + public UserActionParam(String userActionValue) { + this.userActionValue = userActionValue; + } + + /** + * Get the userActionValue property: User action value. + * + * @return the userActionValue value. + */ + @Generated + public String getUserActionValue() { + return this.userActionValue; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("userActionValue", this.userActionValue); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserActionParam from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserActionParam if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UserActionParam. + */ + @Generated + public static UserActionParam fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String userActionValue = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userActionValue".equals(fieldName)) { + userActionValue = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new UserActionParam(userActionValue); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionResponse.java new file mode 100644 index 00000000000..27d8b754962 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/UserActionResponse.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.traits.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * User action response. + */ +@Immutable +public final class UserActionResponse implements JsonSerializable { + /* + * User action result. + */ + @Generated + private final String userActionResult; + + /** + * Creates an instance of UserActionResponse class. + * + * @param userActionResult the userActionResult value to set. + */ + @Generated + private UserActionResponse(String userActionResult) { + this.userActionResult = userActionResult; + } + + /** + * Get the userActionResult property: User action result. + * + * @return the userActionResult value. + */ + @Generated + public String getUserActionResult() { + return this.userActionResult; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("userActionResult", this.userActionResult); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserActionResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserActionResponse if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UserActionResponse. + */ + @Generated + public static UserActionResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String userActionResult = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userActionResult".equals(fieldName)) { + userActionResult = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new UserActionResponse(userActionResult); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/package-info.java new file mode 100644 index 00000000000..0367d6c3e2f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Traits. + * Illustrates Azure Core operation customizations by traits. + * + */ +package azure.core.traits.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/package-info.java new file mode 100644 index 00000000000..9ce44d2806b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/core/traits/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Traits. + * Illustrates Azure Core operation customizations by traits. + * + */ +package azure.core.traits; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationAsyncClient.java new file mode 100644 index 00000000000..f6e7e61ed12 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationAsyncClient.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.encode.duration; + +import azure.encode.duration.implementation.DurationClientImpl; +import azure.encode.duration.models.DurationModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DurationClient type. + */ +@ServiceClient(builder = DurationClientBuilder.class, isAsync = true) +public final class DurationAsyncClient { + @Generated + private final DurationClientImpl serviceClient; + + /** + * Initializes an instance of DurationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DurationAsyncClient(DurationClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test duration with azure specific encoding. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     input: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> durationConstantWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.durationConstantWithResponseAsync(body, requestOptions); + } + + /** + * Test duration with azure specific encoding. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono durationConstant(DurationModel body) { + // Generated convenience method for durationConstantWithResponse + RequestOptions requestOptions = new RequestOptions(); + return durationConstantWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClient.java new file mode 100644 index 00000000000..5fc7765423d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClient.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.encode.duration; + +import azure.encode.duration.implementation.DurationClientImpl; +import azure.encode.duration.models.DurationModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous DurationClient type. + */ +@ServiceClient(builder = DurationClientBuilder.class) +public final class DurationClient { + @Generated + private final DurationClientImpl serviceClient; + + /** + * Initializes an instance of DurationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DurationClient(DurationClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test duration with azure specific encoding. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     input: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response durationConstantWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.durationConstantWithResponse(body, requestOptions); + } + + /** + * Test duration with azure specific encoding. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void durationConstant(DurationModel body) { + // Generated convenience method for durationConstantWithResponse + RequestOptions requestOptions = new RequestOptions(); + durationConstantWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClientBuilder.java new file mode 100644 index 00000000000..ca88f7b842d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/DurationClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.encode.duration; + +import azure.encode.duration.implementation.DurationClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the DurationClient type. + */ +@ServiceClientBuilder(serviceClients = { DurationClient.class, DurationAsyncClient.class }) +public final class DurationClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-encode-duration.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the DurationClientBuilder. + */ + @Generated + public DurationClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the DurationClientBuilder. + */ + @Generated + public DurationClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of DurationClientImpl with the provided parameters. + * + * @return an instance of DurationClientImpl. + */ + @Generated + private DurationClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + DurationClientImpl client + = new DurationClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of DurationAsyncClient class. + * + * @return an instance of DurationAsyncClient. + */ + @Generated + public DurationAsyncClient buildAsyncClient() { + return new DurationAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of DurationClient class. + * + * @return an instance of DurationClient. + */ + @Generated + public DurationClient buildClient() { + return new DurationClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(DurationClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/DurationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/DurationClientImpl.java new file mode 100644 index 00000000000..2f8546dcdd5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/DurationClientImpl.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.encode.duration.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the DurationClient type. + */ +public final class DurationClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DurationClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of DurationClient client. + * + * @param endpoint Service host. + */ + public DurationClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DurationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public DurationClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DurationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public DurationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(DurationClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for DurationClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DurationClient") + public interface DurationClientService { + @Put("/azure/encode/duration/duration-constant") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> durationConstant(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/azure/encode/duration/duration-constant") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response durationConstantSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Test duration with azure specific encoding. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     input: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> durationConstantWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.durationConstant(this.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Test duration with azure specific encoding. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     input: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response durationConstantWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.durationConstantSync(this.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/package-info.java new file mode 100644 index 00000000000..9ecc22677f7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for DurationModel. + * Test for azure related encode decorator. + * + */ +package azure.encode.duration.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/DurationModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/DurationModel.java new file mode 100644 index 00000000000..66e4b6ca5fd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/DurationModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.encode.duration.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The DurationModel model. + */ +@Immutable +public final class DurationModel implements JsonSerializable { + /* + * The input property. + */ + @Generated + private final String input; + + /** + * Creates an instance of DurationModel class. + * + * @param input the input value to set. + */ + @Generated + public DurationModel(String input) { + this.input = input; + } + + /** + * Get the input property: The input property. + * + * @return the input value. + */ + @Generated + public String getInput() { + return this.input; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("input", this.input); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DurationModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DurationModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DurationModel. + */ + @Generated + public static DurationModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String input = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("input".equals(fieldName)) { + input = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new DurationModel(input); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/package-info.java new file mode 100644 index 00000000000..009e218d99b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for DurationModel. + * Test for azure related encode decorator. + * + */ +package azure.encode.duration.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/package-info.java new file mode 100644 index 00000000000..a963ea59122 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/encode/duration/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for DurationModel. + * Test for azure related encode decorator. + * + */ +package azure.encode.duration; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleAsyncClient.java new file mode 100644 index 00000000000..419b8f9be21 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleAsyncClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.example.basic; + +import azure.example.basic.implementation.AzureExampleClientImpl; +import azure.example.basic.models.ActionRequest; +import azure.example.basic.models.ActionResponse; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous AzureExampleClient type. + */ +@ServiceClient(builder = AzureExampleClientBuilder.class, isAsync = true) +public final class AzureExampleAsyncClient { + @Generated + private final AzureExampleClientImpl serviceClient; + + /** + * Initializes an instance of AzureExampleAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AzureExampleAsyncClient(AzureExampleClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The basicAction operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     stringProperty: String (Required)
+     *     modelProperty (Optional): {
+     *         int32Property: Integer (Optional)
+     *         float32Property: Double (Optional)
+     *         enumProperty: String(EnumValue1) (Optional)
+     *     }
+     *     arrayProperty (Optional): [
+     *         String (Optional)
+     *     ]
+     *     recordProperty (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     stringProperty: String (Required)
+     *     modelProperty (Optional): {
+     *         int32Property: Integer (Optional)
+     *         float32Property: Double (Optional)
+     *         enumProperty: String(EnumValue1) (Optional)
+     *     }
+     *     arrayProperty (Optional): [
+     *         String (Optional)
+     *     ]
+     *     recordProperty (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param queryParam The queryParam parameter. + * @param headerParam The headerParam parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> basicActionWithResponse(String queryParam, String headerParam, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.basicActionWithResponseAsync(queryParam, headerParam, body, requestOptions); + } + + /** + * The basicAction operation. + * + * @param queryParam The queryParam parameter. + * @param headerParam The headerParam parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono basicAction(String queryParam, String headerParam, ActionRequest body) { + // Generated convenience method for basicActionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return basicActionWithResponse(queryParam, headerParam, BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ActionResponse.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClient.java new file mode 100644 index 00000000000..639253f07d7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClient.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.example.basic; + +import azure.example.basic.implementation.AzureExampleClientImpl; +import azure.example.basic.models.ActionRequest; +import azure.example.basic.models.ActionResponse; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous AzureExampleClient type. + */ +@ServiceClient(builder = AzureExampleClientBuilder.class) +public final class AzureExampleClient { + @Generated + private final AzureExampleClientImpl serviceClient; + + /** + * Initializes an instance of AzureExampleClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AzureExampleClient(AzureExampleClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The basicAction operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     stringProperty: String (Required)
+     *     modelProperty (Optional): {
+     *         int32Property: Integer (Optional)
+     *         float32Property: Double (Optional)
+     *         enumProperty: String(EnumValue1) (Optional)
+     *     }
+     *     arrayProperty (Optional): [
+     *         String (Optional)
+     *     ]
+     *     recordProperty (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     stringProperty: String (Required)
+     *     modelProperty (Optional): {
+     *         int32Property: Integer (Optional)
+     *         float32Property: Double (Optional)
+     *         enumProperty: String(EnumValue1) (Optional)
+     *     }
+     *     arrayProperty (Optional): [
+     *         String (Optional)
+     *     ]
+     *     recordProperty (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param queryParam The queryParam parameter. + * @param headerParam The headerParam parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response basicActionWithResponse(String queryParam, String headerParam, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.basicActionWithResponse(queryParam, headerParam, body, requestOptions); + } + + /** + * The basicAction operation. + * + * @param queryParam The queryParam parameter. + * @param headerParam The headerParam parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ActionResponse basicAction(String queryParam, String headerParam, ActionRequest body) { + // Generated convenience method for basicActionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return basicActionWithResponse(queryParam, headerParam, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(ActionResponse.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClientBuilder.java new file mode 100644 index 00000000000..c1550d34d32 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/AzureExampleClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.example.basic; + +import azure.example.basic.implementation.AzureExampleClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the AzureExampleClient type. + */ +@ServiceClientBuilder(serviceClients = { AzureExampleClient.class, AzureExampleAsyncClient.class }) +public final class AzureExampleClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-example-basic.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the AzureExampleClientBuilder. + */ + @Generated + public AzureExampleClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AzureExampleClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AzureExampleClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AzureExampleClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AzureExampleClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AzureExampleClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AzureExampleClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AzureExampleClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AzureExampleClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private BasicServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the AzureExampleClientBuilder. + */ + @Generated + public AzureExampleClientBuilder serviceVersion(BasicServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the AzureExampleClientBuilder. + */ + @Generated + public AzureExampleClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of AzureExampleClientImpl with the provided parameters. + * + * @return an instance of AzureExampleClientImpl. + */ + @Generated + private AzureExampleClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + BasicServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : BasicServiceVersion.getLatest(); + AzureExampleClientImpl client = new AzureExampleClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of AzureExampleAsyncClient class. + * + * @return an instance of AzureExampleAsyncClient. + */ + @Generated + public AzureExampleAsyncClient buildAsyncClient() { + return new AzureExampleAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of AzureExampleClient class. + * + * @return an instance of AzureExampleClient. + */ + @Generated + public AzureExampleClient buildClient() { + return new AzureExampleClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureExampleClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/BasicServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/BasicServiceVersion.java new file mode 100644 index 00000000000..8bc4e6ce297 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/BasicServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.example.basic; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of BasicClient. + */ +public enum BasicServiceVersion implements ServiceVersion { + /** + * Enum value 2022-12-01-preview. + */ + V2022_12_01_PREVIEW("2022-12-01-preview"); + + private final String version; + + BasicServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link BasicServiceVersion}. + */ + public static BasicServiceVersion getLatest() { + return V2022_12_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/AzureExampleClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/AzureExampleClientImpl.java new file mode 100644 index 00000000000..3bdad0cdf26 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/AzureExampleClientImpl.java @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.example.basic.implementation; + +import azure.example.basic.BasicServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the AzureExampleClient type. + */ +public final class AzureExampleClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final AzureExampleClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final BasicServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public BasicServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of AzureExampleClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public AzureExampleClientImpl(String endpoint, BasicServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of AzureExampleClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public AzureExampleClientImpl(HttpPipeline httpPipeline, String endpoint, BasicServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of AzureExampleClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public AzureExampleClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + BasicServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service + = RestProxy.create(AzureExampleClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for AzureExampleClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureExampleClient") + public interface AzureExampleClientService { + @Post("/azure/example/basic/basic") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> basicAction(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @QueryParam("query-param") String queryParam, + @HeaderParam("header-param") String headerParam, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/azure/example/basic/basic") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response basicActionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @QueryParam("query-param") String queryParam, + @HeaderParam("header-param") String headerParam, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The basicAction operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     stringProperty: String (Required)
+     *     modelProperty (Optional): {
+     *         int32Property: Integer (Optional)
+     *         float32Property: Double (Optional)
+     *         enumProperty: String(EnumValue1) (Optional)
+     *     }
+     *     arrayProperty (Optional): [
+     *         String (Optional)
+     *     ]
+     *     recordProperty (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     stringProperty: String (Required)
+     *     modelProperty (Optional): {
+     *         int32Property: Integer (Optional)
+     *         float32Property: Double (Optional)
+     *         enumProperty: String(EnumValue1) (Optional)
+     *     }
+     *     arrayProperty (Optional): [
+     *         String (Optional)
+     *     ]
+     *     recordProperty (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param queryParam The queryParam parameter. + * @param headerParam The headerParam parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> basicActionWithResponseAsync(String queryParam, String headerParam, + BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.basicAction(this.getEndpoint(), this.getServiceVersion().getVersion(), + queryParam, headerParam, contentType, accept, body, requestOptions, context)); + } + + /** + * The basicAction operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     stringProperty: String (Required)
+     *     modelProperty (Optional): {
+     *         int32Property: Integer (Optional)
+     *         float32Property: Double (Optional)
+     *         enumProperty: String(EnumValue1) (Optional)
+     *     }
+     *     arrayProperty (Optional): [
+     *         String (Optional)
+     *     ]
+     *     recordProperty (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     stringProperty: String (Required)
+     *     modelProperty (Optional): {
+     *         int32Property: Integer (Optional)
+     *         float32Property: Double (Optional)
+     *         enumProperty: String(EnumValue1) (Optional)
+     *     }
+     *     arrayProperty (Optional): [
+     *         String (Optional)
+     *     ]
+     *     recordProperty (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param queryParam The queryParam parameter. + * @param headerParam The headerParam parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response basicActionWithResponse(String queryParam, String headerParam, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.basicActionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), queryParam, + headerParam, contentType, accept, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/package-info.java new file mode 100644 index 00000000000..57ac429e1ff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Basic. + * Test for loading JSON example and generating sample code. + * + */ +package azure.example.basic.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionRequest.java new file mode 100644 index 00000000000..c39a54ecc96 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionRequest.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.example.basic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The ActionRequest model. + */ +@Fluent +public final class ActionRequest implements JsonSerializable { + /* + * The stringProperty property. + */ + @Generated + private final String stringProperty; + + /* + * The modelProperty property. + */ + @Generated + private Model modelProperty; + + /* + * The arrayProperty property. + */ + @Generated + private List arrayProperty; + + /* + * The recordProperty property. + */ + @Generated + private Map recordProperty; + + /** + * Creates an instance of ActionRequest class. + * + * @param stringProperty the stringProperty value to set. + */ + @Generated + public ActionRequest(String stringProperty) { + this.stringProperty = stringProperty; + } + + /** + * Get the stringProperty property: The stringProperty property. + * + * @return the stringProperty value. + */ + @Generated + public String getStringProperty() { + return this.stringProperty; + } + + /** + * Get the modelProperty property: The modelProperty property. + * + * @return the modelProperty value. + */ + @Generated + public Model getModelProperty() { + return this.modelProperty; + } + + /** + * Set the modelProperty property: The modelProperty property. + * + * @param modelProperty the modelProperty value to set. + * @return the ActionRequest object itself. + */ + @Generated + public ActionRequest setModelProperty(Model modelProperty) { + this.modelProperty = modelProperty; + return this; + } + + /** + * Get the arrayProperty property: The arrayProperty property. + * + * @return the arrayProperty value. + */ + @Generated + public List getArrayProperty() { + return this.arrayProperty; + } + + /** + * Set the arrayProperty property: The arrayProperty property. + * + * @param arrayProperty the arrayProperty value to set. + * @return the ActionRequest object itself. + */ + @Generated + public ActionRequest setArrayProperty(List arrayProperty) { + this.arrayProperty = arrayProperty; + return this; + } + + /** + * Get the recordProperty property: The recordProperty property. + * + * @return the recordProperty value. + */ + @Generated + public Map getRecordProperty() { + return this.recordProperty; + } + + /** + * Set the recordProperty property: The recordProperty property. + * + * @param recordProperty the recordProperty value to set. + * @return the ActionRequest object itself. + */ + @Generated + public ActionRequest setRecordProperty(Map recordProperty) { + this.recordProperty = recordProperty; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("stringProperty", this.stringProperty); + jsonWriter.writeJsonField("modelProperty", this.modelProperty); + jsonWriter.writeArrayField("arrayProperty", this.arrayProperty, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("recordProperty", this.recordProperty, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActionRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActionRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActionRequest. + */ + @Generated + public static ActionRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String stringProperty = null; + Model modelProperty = null; + List arrayProperty = null; + Map recordProperty = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("stringProperty".equals(fieldName)) { + stringProperty = reader.getString(); + } else if ("modelProperty".equals(fieldName)) { + modelProperty = Model.fromJson(reader); + } else if ("arrayProperty".equals(fieldName)) { + arrayProperty = reader.readArray(reader1 -> reader1.getString()); + } else if ("recordProperty".equals(fieldName)) { + recordProperty = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + ActionRequest deserializedActionRequest = new ActionRequest(stringProperty); + deserializedActionRequest.modelProperty = modelProperty; + deserializedActionRequest.arrayProperty = arrayProperty; + deserializedActionRequest.recordProperty = recordProperty; + + return deserializedActionRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionResponse.java new file mode 100644 index 00000000000..7975deabf2a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/ActionResponse.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.example.basic.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The ActionResponse model. + */ +@Immutable +public final class ActionResponse implements JsonSerializable { + /* + * The stringProperty property. + */ + @Generated + private final String stringProperty; + + /* + * The modelProperty property. + */ + @Generated + private Model modelProperty; + + /* + * The arrayProperty property. + */ + @Generated + private List arrayProperty; + + /* + * The recordProperty property. + */ + @Generated + private Map recordProperty; + + /** + * Creates an instance of ActionResponse class. + * + * @param stringProperty the stringProperty value to set. + */ + @Generated + private ActionResponse(String stringProperty) { + this.stringProperty = stringProperty; + } + + /** + * Get the stringProperty property: The stringProperty property. + * + * @return the stringProperty value. + */ + @Generated + public String getStringProperty() { + return this.stringProperty; + } + + /** + * Get the modelProperty property: The modelProperty property. + * + * @return the modelProperty value. + */ + @Generated + public Model getModelProperty() { + return this.modelProperty; + } + + /** + * Get the arrayProperty property: The arrayProperty property. + * + * @return the arrayProperty value. + */ + @Generated + public List getArrayProperty() { + return this.arrayProperty; + } + + /** + * Get the recordProperty property: The recordProperty property. + * + * @return the recordProperty value. + */ + @Generated + public Map getRecordProperty() { + return this.recordProperty; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("stringProperty", this.stringProperty); + jsonWriter.writeJsonField("modelProperty", this.modelProperty); + jsonWriter.writeArrayField("arrayProperty", this.arrayProperty, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("recordProperty", this.recordProperty, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActionResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActionResponse if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActionResponse. + */ + @Generated + public static ActionResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String stringProperty = null; + Model modelProperty = null; + List arrayProperty = null; + Map recordProperty = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("stringProperty".equals(fieldName)) { + stringProperty = reader.getString(); + } else if ("modelProperty".equals(fieldName)) { + modelProperty = Model.fromJson(reader); + } else if ("arrayProperty".equals(fieldName)) { + arrayProperty = reader.readArray(reader1 -> reader1.getString()); + } else if ("recordProperty".equals(fieldName)) { + recordProperty = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + ActionResponse deserializedActionResponse = new ActionResponse(stringProperty); + deserializedActionResponse.modelProperty = modelProperty; + deserializedActionResponse.arrayProperty = arrayProperty; + deserializedActionResponse.recordProperty = recordProperty; + + return deserializedActionResponse; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Enum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Enum.java new file mode 100644 index 00000000000..23213094907 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Enum.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.example.basic.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for Enum. + */ +public final class Enum extends ExpandableStringEnum { + /** + * Static value EnumValue1 for Enum. + */ + @Generated + public static final Enum ENUM_VALUE1 = fromString("EnumValue1"); + + /** + * Creates a new instance of Enum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public Enum() { + } + + /** + * Creates or finds a Enum from its string representation. + * + * @param name a name to look for. + * @return the corresponding Enum. + */ + @Generated + public static Enum fromString(String name) { + return fromString(name, Enum.class); + } + + /** + * Gets known Enum values. + * + * @return known Enum values. + */ + @Generated + public static Collection values() { + return values(Enum.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Model.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Model.java new file mode 100644 index 00000000000..b311b16a5fb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/Model.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.example.basic.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Model model. + */ +@Fluent +public final class Model implements JsonSerializable { + /* + * The int32Property property. + */ + @Generated + private Integer int32Property; + + /* + * The float32Property property. + */ + @Generated + private Double float32Property; + + /* + * The enumProperty property. + */ + @Generated + private Enum enumProperty; + + /** + * Creates an instance of Model class. + */ + @Generated + public Model() { + } + + /** + * Get the int32Property property: The int32Property property. + * + * @return the int32Property value. + */ + @Generated + public Integer getInt32Property() { + return this.int32Property; + } + + /** + * Set the int32Property property: The int32Property property. + * + * @param int32Property the int32Property value to set. + * @return the Model object itself. + */ + @Generated + public Model setInt32Property(Integer int32Property) { + this.int32Property = int32Property; + return this; + } + + /** + * Get the float32Property property: The float32Property property. + * + * @return the float32Property value. + */ + @Generated + public Double getFloat32Property() { + return this.float32Property; + } + + /** + * Set the float32Property property: The float32Property property. + * + * @param float32Property the float32Property value to set. + * @return the Model object itself. + */ + @Generated + public Model setFloat32Property(Double float32Property) { + this.float32Property = float32Property; + return this; + } + + /** + * Get the enumProperty property: The enumProperty property. + * + * @return the enumProperty value. + */ + @Generated + public Enum getEnumProperty() { + return this.enumProperty; + } + + /** + * Set the enumProperty property: The enumProperty property. + * + * @param enumProperty the enumProperty value to set. + * @return the Model object itself. + */ + @Generated + public Model setEnumProperty(Enum enumProperty) { + this.enumProperty = enumProperty; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("int32Property", this.int32Property); + jsonWriter.writeNumberField("float32Property", this.float32Property); + jsonWriter.writeStringField("enumProperty", this.enumProperty == null ? null : this.enumProperty.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Model from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Model if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Model. + */ + @Generated + public static Model fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Model deserializedModel = new Model(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("int32Property".equals(fieldName)) { + deserializedModel.int32Property = reader.getNullable(JsonReader::getInt); + } else if ("float32Property".equals(fieldName)) { + deserializedModel.float32Property = reader.getNullable(JsonReader::getDouble); + } else if ("enumProperty".equals(fieldName)) { + deserializedModel.enumProperty = Enum.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/package-info.java new file mode 100644 index 00000000000..004e67e35b6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Basic. + * Test for loading JSON example and generating sample code. + * + */ +package azure.example.basic.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/package-info.java new file mode 100644 index 00000000000..215f743313d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/example/basic/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Basic. + * Test for loading JSON example and generating sample code. + * + */ +package azure.example.basic; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableAsyncClient.java new file mode 100644 index 00000000000..83a35a33193 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableAsyncClient.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.payload.pageable; + +import azure.payload.pageable.implementation.PageableClientImpl; +import azure.payload.pageable.models.User; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; + +/** + * Initializes a new instance of the asynchronous PageableClient type. + */ +@ServiceClient(builder = PageableClientBuilder.class, isAsync = true) +public final class PageableAsyncClient { + @Generated + private final PageableClientImpl serviceClient; + + /** + * Initializes an instance of PageableAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PageableAsyncClient(PageableClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * List users. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(RequestOptions requestOptions) { + return this.serviceClient.listAsync(requestOptions); + } + + /** + * List users. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = list(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(User.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClient.java new file mode 100644 index 00000000000..68c3882885e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClient.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.payload.pageable; + +import azure.payload.pageable.implementation.PageableClientImpl; +import azure.payload.pageable.models.User; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous PageableClient type. + */ +@ServiceClient(builder = PageableClientBuilder.class) +public final class PageableClient { + @Generated + private final PageableClientImpl serviceClient; + + /** + * Initializes an instance of PageableClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PageableClient(PageableClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * List users. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + return this.serviceClient.list(requestOptions); + } + + /** + * List users. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(User.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClientBuilder.java new file mode 100644 index 00000000000..0b11ef09c92 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/PageableClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.payload.pageable; + +import azure.payload.pageable.implementation.PageableClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the PageableClient type. + */ +@ServiceClientBuilder(serviceClients = { PageableClient.class, PageableAsyncClient.class }) +public final class PageableClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-payload-pageable.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the PageableClientBuilder. + */ + @Generated + public PageableClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageableClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageableClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageableClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageableClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageableClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageableClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageableClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PageableClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the PageableClientBuilder. + */ + @Generated + public PageableClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of PageableClientImpl with the provided parameters. + * + * @return an instance of PageableClientImpl. + */ + @Generated + private PageableClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + PageableClientImpl client + = new PageableClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of PageableAsyncClient class. + * + * @return an instance of PageableAsyncClient. + */ + @Generated + public PageableAsyncClient buildAsyncClient() { + return new PageableAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of PageableClient class. + * + * @return an instance of PageableClient. + */ + @Generated + public PageableClient buildClient() { + return new PageableClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(PageableClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/PageableClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/PageableClientImpl.java new file mode 100644 index 00000000000..70002c4a3ee --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/PageableClientImpl.java @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.payload.pageable.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +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.RequestOptions; +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 com.azure.core.util.UrlBuilder; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the PageableClient type. + */ +public final class PageableClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PageableClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of PageableClient client. + * + * @param endpoint Service host. + */ + public PageableClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of PageableClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public PageableClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of PageableClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public PageableClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(PageableClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for PageableClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "PageableClient") + public interface PageableClientService { + @Get("/azure/payload/pageable") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/payload/pageable") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * List users. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.list(this.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List users. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listSinglePageAsync(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listNextSinglePageAsync(nextLink, requestOptionsLocal); + }); + } + + /** + * List users. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List users. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listSinglePage(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxpagesize", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listNextSinglePage(nextLink, requestOptionsLocal); + }); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.getEndpoint(), 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
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of User items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/package-info.java new file mode 100644 index 00000000000..e03f730af76 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Pageable. + * Test describing pageable. + * + */ +package azure.payload.pageable.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/User.java new file mode 100644 index 00000000000..b21b986ab8a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/User.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.payload.pageable.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * User model. + */ +@Immutable +public final class User implements JsonSerializable { + /* + * User name + */ + @Generated + private final String name; + + /** + * Creates an instance of User class. + * + * @param name the name value to set. + */ + @Generated + private User(String name) { + this.name = name; + } + + /** + * Get the name property: User name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of User from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the User. + */ + @Generated + public static User fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new User(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/package-info.java new file mode 100644 index 00000000000..ea5290238a3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Pageable. + * Test describing pageable. + * + */ +package azure.payload.pageable.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/package-info.java new file mode 100644 index 00000000000..da31e5e394e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/payload/pageable/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Pageable. + * Test describing pageable. + * + */ +package azure.payload.pageable; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/CommonPropertiesManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/CommonPropertiesManager.java new file mode 100644 index 00000000000..cc0e7a13895 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/CommonPropertiesManager.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties; + +import azure.resourcemanager.commonproperties.fluent.CommonPropertiesClient; +import azure.resourcemanager.commonproperties.implementation.CommonPropertiesClientBuilder; +import azure.resourcemanager.commonproperties.implementation.ErrorsImpl; +import azure.resourcemanager.commonproperties.implementation.ManagedIdentitiesImpl; +import azure.resourcemanager.commonproperties.models.Errors; +import azure.resourcemanager.commonproperties.models.ManagedIdentities; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to CommonPropertiesManager. + * Arm Managed Identity Provider management API. + */ +public final class CommonPropertiesManager { + private ManagedIdentities managedIdentities; + + private Errors errors; + + private final CommonPropertiesClient clientObject; + + private CommonPropertiesManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new CommonPropertiesClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of CommonProperties service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the CommonProperties service API instance. + */ + public static CommonPropertiesManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of CommonProperties service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the CommonProperties service API instance. + */ + public static CommonPropertiesManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new CommonPropertiesManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create CommonPropertiesManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new CommonPropertiesManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-commonproperties-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of CommonProperties service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the CommonProperties service API instance. + */ + public CommonPropertiesManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("azure.resourcemanager.commonproperties") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new CommonPropertiesManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of ManagedIdentities. It manages ManagedIdentityTrackedResource. + * + * @return Resource collection API of ManagedIdentities. + */ + public ManagedIdentities managedIdentities() { + if (this.managedIdentities == null) { + this.managedIdentities = new ManagedIdentitiesImpl(clientObject.getManagedIdentities(), this); + } + return managedIdentities; + } + + /** + * Gets the resource collection API of Errors. It manages ConfidentialResource. + * + * @return Resource collection API of Errors. + */ + public Errors errors() { + if (this.errors == null) { + this.errors = new ErrorsImpl(clientObject.getErrors(), this); + } + return errors; + } + + /** + * Gets wrapped service client CommonPropertiesClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client CommonPropertiesClient. + */ + public CommonPropertiesClient serviceClient() { + return this.clientObject; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/CommonPropertiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/CommonPropertiesClient.java new file mode 100644 index 00000000000..89b218eb72d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/CommonPropertiesClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for CommonPropertiesClient class. + */ +public interface CommonPropertiesClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the ManagedIdentitiesClient object to access its operations. + * + * @return the ManagedIdentitiesClient object. + */ + ManagedIdentitiesClient getManagedIdentities(); + + /** + * Gets the ErrorsClient object to access its operations. + * + * @return the ErrorsClient object. + */ + ErrorsClient getErrors(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ErrorsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ErrorsClient.java new file mode 100644 index 00000000000..ac0836451ab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ErrorsClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.fluent; + +import azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * An instance of this class provides access to all the operations defined in ErrorsClient. + */ +public interface ErrorsClient { + /** + * Get a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ConfidentialResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String confidentialResourceName, Context context); + + /** + * Get a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ConfidentialResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfidentialResourceInner getByResourceGroup(String resourceGroupName, String confidentialResourceName); + + /** + * Create a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws azure.resourcemanager.commonproperties.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createForUserDefinedErrorWithResponse(String resourceGroupName, + String confidentialResourceName, ConfidentialResourceInner resource, Context context); + + /** + * Create a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws azure.resourcemanager.commonproperties.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfidentialResourceInner createForUserDefinedError(String resourceGroupName, String confidentialResourceName, + ConfidentialResourceInner resource); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ManagedIdentitiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ManagedIdentitiesClient.java new file mode 100644 index 00000000000..f8e4af583d1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/ManagedIdentitiesClient.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.fluent; + +import azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * An instance of this class provides access to all the operations defined in ManagedIdentitiesClient. + */ +public interface ManagedIdentitiesClient { + /** + * Get a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedIdentityTrackedResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String managedIdentityTrackedResourceName, Context context); + + /** + * Get a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedIdentityTrackedResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedIdentityTrackedResourceInner getByResourceGroup(String resourceGroupName, + String managedIdentityTrackedResourceName); + + /** + * Create a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithSystemAssignedWithResponse(String resourceGroupName, + String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner resource, Context context); + + /** + * Create a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedIdentityTrackedResourceInner createWithSystemAssigned(String resourceGroupName, + String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner resource); + + /** + * Update a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithUserAssignedAndSystemAssignedWithResponse( + String resourceGroupName, String managedIdentityTrackedResourceName, + ManagedIdentityTrackedResourceInner properties, Context context); + + /** + * Update a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedIdentityTrackedResourceInner updateWithUserAssignedAndSystemAssigned(String resourceGroupName, + String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner properties); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ConfidentialResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ConfidentialResourceInner.java new file mode 100644 index 00000000000..20e0d970733 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ConfidentialResourceInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.fluent.models; + +import azure.resourcemanager.commonproperties.models.ConfidentialResourceProperties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class ConfidentialResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private ConfidentialResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ConfidentialResourceInner class. + */ + public ConfidentialResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ConfidentialResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ConfidentialResourceInner object itself. + */ + public ConfidentialResourceInner withProperties(ConfidentialResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ConfidentialResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ConfidentialResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConfidentialResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConfidentialResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConfidentialResourceInner. + */ + public static ConfidentialResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConfidentialResourceInner deserializedConfidentialResourceInner = new ConfidentialResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedConfidentialResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedConfidentialResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedConfidentialResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedConfidentialResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedConfidentialResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedConfidentialResourceInner.properties = ConfidentialResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedConfidentialResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedConfidentialResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ManagedIdentityTrackedResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ManagedIdentityTrackedResourceInner.java new file mode 100644 index 00000000000..f81a34bf4e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/ManagedIdentityTrackedResourceInner.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.fluent.models; + +import azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResourceProperties; +import azure.resourcemanager.commonproperties.models.ManagedServiceIdentity; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class ManagedIdentityTrackedResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private ManagedIdentityTrackedResourceProperties properties; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ManagedIdentityTrackedResourceInner class. + */ + public ManagedIdentityTrackedResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ManagedIdentityTrackedResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ManagedIdentityTrackedResourceInner object itself. + */ + public ManagedIdentityTrackedResourceInner withProperties(ManagedIdentityTrackedResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the ManagedIdentityTrackedResourceInner object itself. + */ + public ManagedIdentityTrackedResourceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ManagedIdentityTrackedResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ManagedIdentityTrackedResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedIdentityTrackedResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedIdentityTrackedResourceInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedIdentityTrackedResourceInner. + */ + public static ManagedIdentityTrackedResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedIdentityTrackedResourceInner deserializedManagedIdentityTrackedResourceInner + = new ManagedIdentityTrackedResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedManagedIdentityTrackedResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedManagedIdentityTrackedResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedManagedIdentityTrackedResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedManagedIdentityTrackedResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedManagedIdentityTrackedResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedManagedIdentityTrackedResourceInner.properties + = ManagedIdentityTrackedResourceProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedManagedIdentityTrackedResourceInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedManagedIdentityTrackedResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedIdentityTrackedResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/package-info.java new file mode 100644 index 00000000000..bebd0a0f96d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for CommonProperties. + * Arm Managed Identity Provider management API. + */ +package azure.resourcemanager.commonproperties.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/package-info.java new file mode 100644 index 00000000000..00ee0fffe7b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for CommonProperties. + * Arm Managed Identity Provider management API. + */ +package azure.resourcemanager.commonproperties.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientBuilder.java new file mode 100644 index 00000000000..b926a4b5b2e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the CommonPropertiesClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { CommonPropertiesClientImpl.class }) +public final class CommonPropertiesClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the CommonPropertiesClientBuilder. + */ + public CommonPropertiesClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the CommonPropertiesClientBuilder. + */ + public CommonPropertiesClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the CommonPropertiesClientBuilder. + */ + public CommonPropertiesClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 CommonPropertiesClientBuilder. + */ + public CommonPropertiesClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the CommonPropertiesClientBuilder. + */ + public CommonPropertiesClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 CommonPropertiesClientBuilder. + */ + public CommonPropertiesClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of CommonPropertiesClientImpl with the provided parameters. + * + * @return an instance of CommonPropertiesClientImpl. + */ + public CommonPropertiesClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + CommonPropertiesClientImpl client = new CommonPropertiesClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientImpl.java new file mode 100644 index 00000000000..0c015e90c3f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientImpl.java @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.implementation; + +import azure.resourcemanager.commonproperties.fluent.CommonPropertiesClient; +import azure.resourcemanager.commonproperties.fluent.ErrorsClient; +import azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the CommonPropertiesClientImpl type. + */ +@ServiceClient(builder = CommonPropertiesClientBuilder.class) +public final class CommonPropertiesClientImpl implements CommonPropertiesClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The ManagedIdentitiesClient object to access its operations. + */ + private final ManagedIdentitiesClient managedIdentities; + + /** + * Gets the ManagedIdentitiesClient object to access its operations. + * + * @return the ManagedIdentitiesClient object. + */ + public ManagedIdentitiesClient getManagedIdentities() { + return this.managedIdentities; + } + + /** + * The ErrorsClient object to access its operations. + */ + private final ErrorsClient errors; + + /** + * Gets the ErrorsClient object to access its operations. + * + * @return the ErrorsClient object. + */ + public ErrorsClient getErrors() { + return this.errors; + } + + /** + * Initializes an instance of CommonPropertiesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + CommonPropertiesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2023-12-01-preview"; + this.managedIdentities = new ManagedIdentitiesClientImpl(this); + this.errors = new ErrorsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CommonPropertiesClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ConfidentialResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ConfidentialResourceImpl.java new file mode 100644 index 00000000000..65abf4a950d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ConfidentialResourceImpl.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.implementation; + +import azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner; +import azure.resourcemanager.commonproperties.models.ConfidentialResource; +import azure.resourcemanager.commonproperties.models.ConfidentialResourceProperties; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Collections; +import java.util.Map; + +public final class ConfidentialResourceImpl implements ConfidentialResource, ConfidentialResource.Definition { + private ConfidentialResourceInner innerObject; + + private final azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager; + + ConfidentialResourceImpl(ConfidentialResourceInner innerObject, + azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ConfidentialResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ConfidentialResourceInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.commonproperties.CommonPropertiesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String confidentialResourceName; + + public ConfidentialResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ConfidentialResource create() { + this.innerObject = serviceManager.serviceClient() + .getErrors() + .createForUserDefinedErrorWithResponse(resourceGroupName, confidentialResourceName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public ConfidentialResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getErrors() + .createForUserDefinedErrorWithResponse(resourceGroupName, confidentialResourceName, this.innerModel(), + context) + .getValue(); + return this; + } + + ConfidentialResourceImpl(String name, + azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager) { + this.innerObject = new ConfidentialResourceInner(); + this.serviceManager = serviceManager; + this.confidentialResourceName = name; + } + + public ConfidentialResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getErrors() + .getByResourceGroupWithResponse(resourceGroupName, confidentialResourceName, Context.NONE) + .getValue(); + return this; + } + + public ConfidentialResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getErrors() + .getByResourceGroupWithResponse(resourceGroupName, confidentialResourceName, context) + .getValue(); + return this; + } + + public ConfidentialResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ConfidentialResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ConfidentialResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ConfidentialResourceImpl withProperties(ConfidentialResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsClientImpl.java new file mode 100644 index 00000000000..d22e1de82c9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsClientImpl.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.implementation; + +import azure.resourcemanager.commonproperties.fluent.ErrorsClient; +import azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner; +import azure.resourcemanager.commonproperties.models.ApiErrorException; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ErrorsClient. + */ +public final class ErrorsClientImpl implements ErrorsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ErrorsService service; + + /** + * The service client containing this operation class. + */ + private final CommonPropertiesClientImpl client; + + /** + * Initializes an instance of ErrorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ErrorsClientImpl(CommonPropertiesClientImpl client) { + this.service = RestProxy.create(ErrorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommonPropertiesClientErrors to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CommonPropertiesClientErrors") + public interface ErrorsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/confidentialResources/{confidentialResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("confidentialResourceName") String confidentialResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/confidentialResources/{confidentialResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("confidentialResourceName") String confidentialResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/confidentialResources/{confidentialResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> createForUserDefinedError(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("confidentialResourceName") String confidentialResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ConfidentialResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/confidentialResources/{confidentialResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Response createForUserDefinedErrorSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("confidentialResourceName") String confidentialResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ConfidentialResourceInner resource, Context context); + } + + /** + * Get a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ConfidentialResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String confidentialResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, confidentialResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ConfidentialResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String confidentialResourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, confidentialResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ConfidentialResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String confidentialResourceName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, confidentialResourceName, accept, context); + } + + /** + * Get a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ConfidentialResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfidentialResourceInner getByResourceGroup(String resourceGroupName, String confidentialResourceName) { + return getByResourceGroupWithResponse(resourceGroupName, confidentialResourceName, Context.NONE).getValue(); + } + + /** + * Create a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createForUserDefinedErrorWithResponseAsync( + String resourceGroupName, String confidentialResourceName, ConfidentialResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createForUserDefinedError(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + confidentialResourceName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createForUserDefinedErrorAsync(String resourceGroupName, + String confidentialResourceName, ConfidentialResourceInner resource) { + return createForUserDefinedErrorWithResponseAsync(resourceGroupName, confidentialResourceName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createForUserDefinedErrorWithResponse(String resourceGroupName, + String confidentialResourceName, ConfidentialResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createForUserDefinedErrorSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, confidentialResourceName, contentType, accept, resource, + context); + } + + /** + * Create a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfidentialResourceInner createForUserDefinedError(String resourceGroupName, + String confidentialResourceName, ConfidentialResourceInner resource) { + return createForUserDefinedErrorWithResponse(resourceGroupName, confidentialResourceName, resource, + Context.NONE).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsImpl.java new file mode 100644 index 00000000000..13fa33d72d8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsImpl.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.implementation; + +import azure.resourcemanager.commonproperties.fluent.ErrorsClient; +import azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner; +import azure.resourcemanager.commonproperties.models.ConfidentialResource; +import azure.resourcemanager.commonproperties.models.Errors; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class ErrorsImpl implements Errors { + private static final ClientLogger LOGGER = new ClientLogger(ErrorsImpl.class); + + private final ErrorsClient innerClient; + + private final azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager; + + public ErrorsImpl(ErrorsClient innerClient, + azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String confidentialResourceName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, confidentialResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ConfidentialResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ConfidentialResource getByResourceGroup(String resourceGroupName, String confidentialResourceName) { + ConfidentialResourceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, confidentialResourceName); + if (inner != null) { + return new ConfidentialResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public ConfidentialResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String confidentialResourceName = ResourceManagerUtils.getValueFromIdByName(id, "confidentialResources"); + if (confidentialResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'confidentialResources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, confidentialResourceName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String confidentialResourceName = ResourceManagerUtils.getValueFromIdByName(id, "confidentialResources"); + if (confidentialResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'confidentialResources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, confidentialResourceName, context); + } + + private ErrorsClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.commonproperties.CommonPropertiesManager manager() { + return this.serviceManager; + } + + public ConfidentialResourceImpl define(String name) { + return new ConfidentialResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesClientImpl.java new file mode 100644 index 00000000000..c4b234e3a20 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesClientImpl.java @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.implementation; + +import azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient; +import azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ManagedIdentitiesClient. + */ +public final class ManagedIdentitiesClientImpl implements ManagedIdentitiesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ManagedIdentitiesService service; + + /** + * The service client containing this operation class. + */ + private final CommonPropertiesClientImpl client; + + /** + * Initializes an instance of ManagedIdentitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedIdentitiesClientImpl(CommonPropertiesClientImpl client) { + this.service + = RestProxy.create(ManagedIdentitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CommonPropertiesClientManagedIdentities to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CommonPropertiesClientManagedIdentities") + public interface ManagedIdentitiesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/{managedIdentityTrackedResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedIdentityTrackedResourceName") String managedIdentityTrackedResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/{managedIdentityTrackedResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedIdentityTrackedResourceName") String managedIdentityTrackedResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/{managedIdentityTrackedResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createWithSystemAssigned( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedIdentityTrackedResourceName") String managedIdentityTrackedResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ManagedIdentityTrackedResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/{managedIdentityTrackedResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createWithSystemAssignedSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedIdentityTrackedResourceName") String managedIdentityTrackedResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ManagedIdentityTrackedResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/{managedIdentityTrackedResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateWithUserAssignedAndSystemAssigned( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedIdentityTrackedResourceName") String managedIdentityTrackedResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ManagedIdentityTrackedResourceInner properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.CommonProperties/managedIdentityTrackedResources/{managedIdentityTrackedResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateWithUserAssignedAndSystemAssignedSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedIdentityTrackedResourceName") String managedIdentityTrackedResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ManagedIdentityTrackedResourceInner properties, Context context); + } + + /** + * Get a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedIdentityTrackedResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getByResourceGroupWithResponseAsync(String resourceGroupName, String managedIdentityTrackedResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, managedIdentityTrackedResourceName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedIdentityTrackedResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String managedIdentityTrackedResourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, managedIdentityTrackedResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedIdentityTrackedResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String managedIdentityTrackedResourceName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, managedIdentityTrackedResourceName, accept, context); + } + + /** + * Get a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedIdentityTrackedResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedIdentityTrackedResourceInner getByResourceGroup(String resourceGroupName, + String managedIdentityTrackedResourceName) { + return getByResourceGroupWithResponse(resourceGroupName, managedIdentityTrackedResourceName, Context.NONE) + .getValue(); + } + + /** + * Create a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithSystemAssignedWithResponseAsync( + String resourceGroupName, String managedIdentityTrackedResourceName, + ManagedIdentityTrackedResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createWithSystemAssigned(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + managedIdentityTrackedResourceName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createWithSystemAssignedAsync(String resourceGroupName, + String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner resource) { + return createWithSystemAssignedWithResponseAsync(resourceGroupName, managedIdentityTrackedResourceName, + resource).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithSystemAssignedWithResponse(String resourceGroupName, + String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createWithSystemAssignedSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, managedIdentityTrackedResourceName, contentType, accept, + resource, context); + } + + /** + * Create a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedIdentityTrackedResourceInner createWithSystemAssigned(String resourceGroupName, + String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner resource) { + return createWithSystemAssignedWithResponse(resourceGroupName, managedIdentityTrackedResourceName, resource, + Context.NONE).getValue(); + } + + /** + * Update a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + updateWithUserAssignedAndSystemAssignedWithResponseAsync(String resourceGroupName, + String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.updateWithUserAssignedAndSystemAssigned(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + managedIdentityTrackedResourceName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateWithUserAssignedAndSystemAssignedAsync( + String resourceGroupName, String managedIdentityTrackedResourceName, + ManagedIdentityTrackedResourceInner properties) { + return updateWithUserAssignedAndSystemAssignedWithResponseAsync(resourceGroupName, + managedIdentityTrackedResourceName, properties).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithUserAssignedAndSystemAssignedWithResponse( + String resourceGroupName, String managedIdentityTrackedResourceName, + ManagedIdentityTrackedResourceInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateWithUserAssignedAndSystemAssignedSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + managedIdentityTrackedResourceName, contentType, accept, properties, context); + } + + /** + * Update a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedIdentityTrackedResourceInner updateWithUserAssignedAndSystemAssigned(String resourceGroupName, + String managedIdentityTrackedResourceName, ManagedIdentityTrackedResourceInner properties) { + return updateWithUserAssignedAndSystemAssignedWithResponse(resourceGroupName, + managedIdentityTrackedResourceName, properties, Context.NONE).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesImpl.java new file mode 100644 index 00000000000..9627240bd36 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesImpl.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.implementation; + +import azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient; +import azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner; +import azure.resourcemanager.commonproperties.models.ManagedIdentities; +import azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResource; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class ManagedIdentitiesImpl implements ManagedIdentities { + private static final ClientLogger LOGGER = new ClientLogger(ManagedIdentitiesImpl.class); + + private final ManagedIdentitiesClient innerClient; + + private final azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager; + + public ManagedIdentitiesImpl(ManagedIdentitiesClient innerClient, + azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String managedIdentityTrackedResourceName, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, managedIdentityTrackedResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ManagedIdentityTrackedResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedIdentityTrackedResource getByResourceGroup(String resourceGroupName, + String managedIdentityTrackedResourceName) { + ManagedIdentityTrackedResourceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, managedIdentityTrackedResourceName); + if (inner != null) { + return new ManagedIdentityTrackedResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedIdentityTrackedResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedIdentityTrackedResourceName + = ResourceManagerUtils.getValueFromIdByName(id, "managedIdentityTrackedResources"); + if (managedIdentityTrackedResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'managedIdentityTrackedResources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, managedIdentityTrackedResourceName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedIdentityTrackedResourceName + = ResourceManagerUtils.getValueFromIdByName(id, "managedIdentityTrackedResources"); + if (managedIdentityTrackedResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'managedIdentityTrackedResources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, managedIdentityTrackedResourceName, context); + } + + private ManagedIdentitiesClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.commonproperties.CommonPropertiesManager manager() { + return this.serviceManager; + } + + public ManagedIdentityTrackedResourceImpl define(String name) { + return new ManagedIdentityTrackedResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentityTrackedResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentityTrackedResourceImpl.java new file mode 100644 index 00000000000..69c5be4415a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentityTrackedResourceImpl.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.implementation; + +import azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner; +import azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResource; +import azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResourceProperties; +import azure.resourcemanager.commonproperties.models.ManagedServiceIdentity; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Collections; +import java.util.Map; + +public final class ManagedIdentityTrackedResourceImpl implements ManagedIdentityTrackedResource, + ManagedIdentityTrackedResource.Definition, ManagedIdentityTrackedResource.Update { + private ManagedIdentityTrackedResourceInner innerObject; + + private final azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedIdentityTrackedResourceProperties properties() { + return this.innerModel().properties(); + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedIdentityTrackedResourceInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.commonproperties.CommonPropertiesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedIdentityTrackedResourceName; + + public ManagedIdentityTrackedResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ManagedIdentityTrackedResource create() { + this.innerObject = serviceManager.serviceClient() + .getManagedIdentities() + .createWithSystemAssignedWithResponse(resourceGroupName, managedIdentityTrackedResourceName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ManagedIdentityTrackedResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getManagedIdentities() + .createWithSystemAssignedWithResponse(resourceGroupName, managedIdentityTrackedResourceName, + this.innerModel(), context) + .getValue(); + return this; + } + + ManagedIdentityTrackedResourceImpl(String name, + azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager) { + this.innerObject = new ManagedIdentityTrackedResourceInner(); + this.serviceManager = serviceManager; + this.managedIdentityTrackedResourceName = name; + } + + public ManagedIdentityTrackedResourceImpl update() { + return this; + } + + public ManagedIdentityTrackedResource apply() { + this.innerObject = serviceManager.serviceClient() + .getManagedIdentities() + .updateWithUserAssignedAndSystemAssignedWithResponse(resourceGroupName, managedIdentityTrackedResourceName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ManagedIdentityTrackedResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getManagedIdentities() + .updateWithUserAssignedAndSystemAssignedWithResponse(resourceGroupName, managedIdentityTrackedResourceName, + this.innerModel(), context) + .getValue(); + return this; + } + + ManagedIdentityTrackedResourceImpl(ManagedIdentityTrackedResourceInner innerObject, + azure.resourcemanager.commonproperties.CommonPropertiesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedIdentityTrackedResourceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "managedIdentityTrackedResources"); + } + + public ManagedIdentityTrackedResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getManagedIdentities() + .getByResourceGroupWithResponse(resourceGroupName, managedIdentityTrackedResourceName, Context.NONE) + .getValue(); + return this; + } + + public ManagedIdentityTrackedResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getManagedIdentities() + .getByResourceGroupWithResponse(resourceGroupName, managedIdentityTrackedResourceName, context) + .getValue(); + return this; + } + + public ManagedIdentityTrackedResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ManagedIdentityTrackedResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ManagedIdentityTrackedResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ManagedIdentityTrackedResourceImpl withProperties(ManagedIdentityTrackedResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public ManagedIdentityTrackedResourceImpl withIdentity(ManagedServiceIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ResourceManagerUtils.java new file mode 100644 index 00000000000..216b5b29cb4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/package-info.java new file mode 100644 index 00000000000..6d71aa70f2c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for CommonProperties. + * Arm Managed Identity Provider management API. + */ +package azure.resourcemanager.commonproperties.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiError.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiError.java new file mode 100644 index 00000000000..89e1cdb7251 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiError.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.AdditionalInfo; +import com.azure.core.management.exception.ManagementError; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * An error response. + */ +@Immutable +public final class ApiError extends ManagementError { + /* + * The Api inner error + */ + private InnerError innererror; + + /* + * Additional info for the error. + */ + private List additionalInfo; + + /* + * Details for the error. + */ + private List details; + + /* + * The target of the error. + */ + private String target; + + /* + * The error message parsed from the body of the http error response. + */ + private String message; + + /* + * The error code parsed from the body of the http error response. + */ + private String code; + + /** + * Creates an instance of ApiError class. + */ + private ApiError() { + } + + /** + * Get the innererror property: The Api inner error. + * + * @return the innererror value. + */ + public InnerError getInnererror() { + return this.innererror; + } + + /** + * Get the additionalInfo property: Additional info for the error. + * + * @return the additionalInfo value. + */ + @Override + public List getAdditionalInfo() { + return this.additionalInfo; + } + + /** + * Get the details property: Details for the error. + * + * @return the details value. + */ + @Override + public List getDetails() { + return this.details; + } + + /** + * Get the target property: The target of the error. + * + * @return the target value. + */ + @Override + public String getTarget() { + return this.target; + } + + /** + * Get the message property: The error message parsed from the body of the http error response. + * + * @return the message value. + */ + @Override + public String getMessage() { + return this.message; + } + + /** + * Get the code property: The error code parsed from the body of the http error response. + * + * @return the code value. + */ + @Override + public String getCode() { + return this.code; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApiError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApiError if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the ApiError. + */ + public static ApiError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JsonReader bufferedReader = reader.bufferObject(); + bufferedReader.nextToken(); + while (bufferedReader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = bufferedReader.getFieldName(); + bufferedReader.nextToken(); + + if ("error".equals(fieldName)) { + return readManagementError(bufferedReader); + } else { + bufferedReader.skipChildren(); + } + } + return readManagementError(bufferedReader.reset()); + }); + } + + private static ApiError readManagementError(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApiError deserializedApiError = new ApiError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedApiError.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedApiError.message = reader.getString(); + } else if ("target".equals(fieldName)) { + deserializedApiError.target = reader.getString(); + } else if ("details".equals(fieldName)) { + List details = reader.readArray(reader1 -> ManagementError.fromJson(reader1)); + deserializedApiError.details = details; + } else if ("additionalInfo".equals(fieldName)) { + List additionalInfo = reader.readArray(reader1 -> AdditionalInfo.fromJson(reader1)); + deserializedApiError.additionalInfo = additionalInfo; + } else if ("innererror".equals(fieldName)) { + deserializedApiError.innererror = InnerError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedApiError; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiErrorException.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiErrorException.java new file mode 100644 index 00000000000..4d5627ba10c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ApiErrorException.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.models; + +import com.azure.core.http.HttpResponse; +import com.azure.core.management.exception.ManagementException; + +/** + * Exception thrown for an invalid response with ApiError information. + */ +public final class ApiErrorException extends ManagementException { + /** + * Initializes a new instance of the ApiErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public ApiErrorException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the ApiErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public ApiErrorException(String message, HttpResponse response, ApiError value) { + super(message, response, value); + } + + /** + * {@inheritDoc} + */ + @Override + public ApiError getValue() { + return (ApiError) super.getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResource.java new file mode 100644 index 00000000000..683e7d8a043 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResource.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.models; + +import azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Map; + +/** + * An immutable client-side representation of ConfidentialResource. + */ +public interface ConfidentialResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ConfidentialResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner object. + * + * @return the inner object. + */ + ConfidentialResourceInner innerModel(); + + /** + * The entirety of the ConfidentialResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The ConfidentialResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ConfidentialResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the ConfidentialResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the ConfidentialResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the ConfidentialResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ConfidentialResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ConfidentialResource create(Context context); + } + + /** + * The stage of the ConfidentialResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the ConfidentialResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ConfidentialResourceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ConfidentialResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ConfidentialResource refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResourceProperties.java new file mode 100644 index 00000000000..01a7a09581f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResourceProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Confidential Resource Properties. + */ +@Fluent +public final class ConfidentialResourceProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private String provisioningState; + + /* + * The username property. + */ + private String username; + + /** + * Creates an instance of ConfidentialResourceProperties class. + */ + public ConfidentialResourceProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the username property: The username property. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The username property. + * + * @param username the username value to set. + * @return the ConfidentialResourceProperties object itself. + */ + public ConfidentialResourceProperties withUsername(String username) { + this.username = username; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("username", this.username); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConfidentialResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConfidentialResourceProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConfidentialResourceProperties. + */ + public static ConfidentialResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConfidentialResourceProperties deserializedConfidentialResourceProperties + = new ConfidentialResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedConfidentialResourceProperties.provisioningState = reader.getString(); + } else if ("username".equals(fieldName)) { + deserializedConfidentialResourceProperties.username = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConfidentialResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/Errors.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/Errors.java new file mode 100644 index 00000000000..bc48e294d80 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/Errors.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Errors. + */ +public interface Errors { + /** + * Get a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ConfidentialResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String confidentialResourceName, Context context); + + /** + * Get a ConfidentialResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param confidentialResourceName The name of the ConfidentialResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ConfidentialResource. + */ + ConfidentialResource getByResourceGroup(String resourceGroupName, String confidentialResourceName); + + /** + * Get a ConfidentialResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ConfidentialResource along with {@link Response}. + */ + ConfidentialResource getById(String id); + + /** + * Get a ConfidentialResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ConfidentialResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ConfidentialResource resource. + * + * @param name resource name. + * @return the first stage of the new ConfidentialResource definition. + */ + ConfidentialResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/InnerError.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/InnerError.java new file mode 100644 index 00000000000..1479be875b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/InnerError.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Inner error details. + */ +@Immutable +public final class InnerError implements JsonSerializable { + /* + * The exception type. + */ + private String exceptiontype; + + /* + * The internal error message or exception dump. + */ + private String errordetail; + + /** + * Creates an instance of InnerError class. + */ + private InnerError() { + } + + /** + * Get the exceptiontype property: The exception type. + * + * @return the exceptiontype value. + */ + public String exceptiontype() { + return this.exceptiontype; + } + + /** + * Get the errordetail property: The internal error message or exception dump. + * + * @return the errordetail value. + */ + public String errordetail() { + return this.errordetail; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("exceptiontype", this.exceptiontype); + jsonWriter.writeStringField("errordetail", this.errordetail); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InnerError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InnerError if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the InnerError. + */ + public static InnerError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InnerError deserializedInnerError = new InnerError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("exceptiontype".equals(fieldName)) { + deserializedInnerError.exceptiontype = reader.getString(); + } else if ("errordetail".equals(fieldName)) { + deserializedInnerError.errordetail = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInnerError; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentities.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentities.java new file mode 100644 index 00000000000..e90e3222dc8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentities.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ManagedIdentities. + */ +public interface ManagedIdentities { + /** + * Get a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedIdentityTrackedResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String managedIdentityTrackedResourceName, Context context); + + /** + * Get a ManagedIdentityTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedIdentityTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedIdentityTrackedResource. + */ + ManagedIdentityTrackedResource getByResourceGroup(String resourceGroupName, + String managedIdentityTrackedResourceName); + + /** + * Get a ManagedIdentityTrackedResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedIdentityTrackedResource along with {@link Response}. + */ + ManagedIdentityTrackedResource getById(String id); + + /** + * Get a ManagedIdentityTrackedResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedIdentityTrackedResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedIdentityTrackedResource resource. + * + * @param name resource name. + * @return the first stage of the new ManagedIdentityTrackedResource definition. + */ + ManagedIdentityTrackedResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResource.java new file mode 100644 index 00000000000..e221b3cadfd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResource.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.models; + +import azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Map; + +/** + * An immutable client-side representation of ManagedIdentityTrackedResource. + */ +public interface ManagedIdentityTrackedResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ManagedIdentityTrackedResourceProperties properties(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner object. + * + * @return the inner object. + */ + ManagedIdentityTrackedResourceInner innerModel(); + + /** + * The entirety of the ManagedIdentityTrackedResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The ManagedIdentityTrackedResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ManagedIdentityTrackedResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the ManagedIdentityTrackedResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the ManagedIdentityTrackedResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the ManagedIdentityTrackedResource definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedIdentityTrackedResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedIdentityTrackedResource create(Context context); + } + + /** + * The stage of the ManagedIdentityTrackedResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the ManagedIdentityTrackedResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ManagedIdentityTrackedResourceProperties properties); + } + + /** + * The stage of the ManagedIdentityTrackedResource definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Begins update for the ManagedIdentityTrackedResource resource. + * + * @return the stage of resource update. + */ + ManagedIdentityTrackedResource.Update update(); + + /** + * The template for ManagedIdentityTrackedResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedIdentityTrackedResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedIdentityTrackedResource apply(Context context); + } + + /** + * The ManagedIdentityTrackedResource update stages. + */ + interface UpdateStages { + /** + * The stage of the ManagedIdentityTrackedResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the ManagedIdentityTrackedResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(ManagedIdentityTrackedResourceProperties properties); + } + + /** + * The stage of the ManagedIdentityTrackedResource update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedIdentityTrackedResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedIdentityTrackedResource refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResourceProperties.java new file mode 100644 index 00000000000..097a31707a4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResourceProperties.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Managed Identity Arm Resource Properties. + */ +@Immutable +public final class ManagedIdentityTrackedResourceProperties + implements JsonSerializable { + /* + * The status of the last operation. + */ + private String provisioningState; + + /** + * Creates an instance of ManagedIdentityTrackedResourceProperties class. + */ + public ManagedIdentityTrackedResourceProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedIdentityTrackedResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedIdentityTrackedResourceProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedIdentityTrackedResourceProperties. + */ + public static ManagedIdentityTrackedResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedIdentityTrackedResourceProperties deserializedManagedIdentityTrackedResourceProperties + = new ManagedIdentityTrackedResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedManagedIdentityTrackedResourceProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedIdentityTrackedResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentity.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentity.java new file mode 100644 index 00000000000..c08d689f65b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentity.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private String principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private String tenantId; + + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId = reader.getString(); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentityType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentityType.java new file mode 100644 index 00000000000..ea458f7db5c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentityType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * No managed identity. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * System assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * User assigned managed identity. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * System and user assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/UserAssignedIdentity.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/UserAssignedIdentity.java new file mode 100644 index 00000000000..543d8842d08 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/UserAssignedIdentity.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.commonproperties.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private String principalId; + + /* + * The client ID of the assigned identity. + */ + private String clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/package-info.java new file mode 100644 index 00000000000..fbe69cf6855 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for CommonProperties. + * Arm Managed Identity Provider management API. + */ +package azure.resourcemanager.commonproperties.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/package-info.java new file mode 100644 index 00000000000..d76a42f2fb4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/commonproperties/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for CommonProperties. + * Arm Managed Identity Provider management API. + */ +package azure.resourcemanager.commonproperties; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/LargeHeaderManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/LargeHeaderManager.java new file mode 100644 index 00000000000..c002ee5710e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/LargeHeaderManager.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.largeheader; + +import azure.resourcemanager.largeheader.fluent.LargeHeaderClient; +import azure.resourcemanager.largeheader.implementation.LargeHeaderClientBuilder; +import azure.resourcemanager.largeheader.implementation.LargeHeadersImpl; +import azure.resourcemanager.largeheader.models.LargeHeaders; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to LargeHeaderManager. + * Arm Resource Provider management API. + */ +public final class LargeHeaderManager { + private LargeHeaders largeHeaders; + + private final LargeHeaderClient clientObject; + + private LargeHeaderManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new LargeHeaderClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of LargeHeader service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the LargeHeader service API instance. + */ + public static LargeHeaderManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of LargeHeader service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the LargeHeader service API instance. + */ + public static LargeHeaderManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new LargeHeaderManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create LargeHeaderManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new LargeHeaderManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-largeheader-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of LargeHeader service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the LargeHeader service API instance. + */ + public LargeHeaderManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("azure.resourcemanager.largeheader") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new LargeHeaderManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of LargeHeaders. + * + * @return Resource collection API of LargeHeaders. + */ + public LargeHeaders largeHeaders() { + if (this.largeHeaders == null) { + this.largeHeaders = new LargeHeadersImpl(clientObject.getLargeHeaders(), this); + } + return largeHeaders; + } + + /** + * Gets wrapped service client LargeHeaderClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client LargeHeaderClient. + */ + public LargeHeaderClient serviceClient() { + return this.clientObject; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeaderClient.java new file mode 100644 index 00000000000..116654e3b13 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeaderClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.largeheader.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for LargeHeaderClient class. + */ +public interface LargeHeaderClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the LargeHeadersClient object to access its operations. + * + * @return the LargeHeadersClient object. + */ + LargeHeadersClient getLargeHeaders(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeadersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeadersClient.java new file mode 100644 index 00000000000..6ef5879917e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeadersClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.largeheader.fluent; + +import azure.resourcemanager.largeheader.fluent.models.CancelResultInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; + +/** + * An instance of this class provides access to all the operations defined in LargeHeadersClient. + */ +public interface LargeHeadersClient { + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CancelResultInner> beginTwo6k(String resourceGroupName, + String largeHeaderName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CancelResultInner> beginTwo6k(String resourceGroupName, + String largeHeaderName, Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + CancelResultInner two6k(String resourceGroupName, String largeHeaderName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + CancelResultInner two6k(String resourceGroupName, String largeHeaderName, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/CancelResultInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/CancelResultInner.java new file mode 100644 index 00000000000..5147a25f71b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/CancelResultInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.largeheader.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CancelResult model. + */ +@Immutable +public final class CancelResultInner implements JsonSerializable { + /* + * The succeeded property. + */ + private boolean succeeded; + + /** + * Creates an instance of CancelResultInner class. + */ + private CancelResultInner() { + } + + /** + * Get the succeeded property: The succeeded property. + * + * @return the succeeded value. + */ + public boolean succeeded() { + return this.succeeded; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("succeeded", this.succeeded); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CancelResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CancelResultInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CancelResultInner. + */ + public static CancelResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CancelResultInner deserializedCancelResultInner = new CancelResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("succeeded".equals(fieldName)) { + deserializedCancelResultInner.succeeded = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + + return deserializedCancelResultInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/package-info.java new file mode 100644 index 00000000000..549698d9152 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for LargeHeader. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.largeheader.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/package-info.java new file mode 100644 index 00000000000..c62c520a473 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for LargeHeader. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.largeheader.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/CancelResultImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/CancelResultImpl.java new file mode 100644 index 00000000000..e7c8f18d428 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/CancelResultImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.largeheader.implementation; + +import azure.resourcemanager.largeheader.fluent.models.CancelResultInner; +import azure.resourcemanager.largeheader.models.CancelResult; + +public final class CancelResultImpl implements CancelResult { + private CancelResultInner innerObject; + + private final azure.resourcemanager.largeheader.LargeHeaderManager serviceManager; + + CancelResultImpl(CancelResultInner innerObject, + azure.resourcemanager.largeheader.LargeHeaderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public boolean succeeded() { + return this.innerModel().succeeded(); + } + + public CancelResultInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.largeheader.LargeHeaderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientBuilder.java new file mode 100644 index 00000000000..e380c03c513 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.largeheader.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the LargeHeaderClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { LargeHeaderClientImpl.class }) +public final class LargeHeaderClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the LargeHeaderClientBuilder. + */ + public LargeHeaderClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the LargeHeaderClientBuilder. + */ + public LargeHeaderClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the LargeHeaderClientBuilder. + */ + public LargeHeaderClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 LargeHeaderClientBuilder. + */ + public LargeHeaderClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the LargeHeaderClientBuilder. + */ + public LargeHeaderClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 LargeHeaderClientBuilder. + */ + public LargeHeaderClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of LargeHeaderClientImpl with the provided parameters. + * + * @return an instance of LargeHeaderClientImpl. + */ + public LargeHeaderClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + LargeHeaderClientImpl client = new LargeHeaderClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientImpl.java new file mode 100644 index 00000000000..420a3767afb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientImpl.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.largeheader.implementation; + +import azure.resourcemanager.largeheader.fluent.LargeHeaderClient; +import azure.resourcemanager.largeheader.fluent.LargeHeadersClient; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the LargeHeaderClientImpl type. + */ +@ServiceClient(builder = LargeHeaderClientBuilder.class) +public final class LargeHeaderClientImpl implements LargeHeaderClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The LargeHeadersClient object to access its operations. + */ + private final LargeHeadersClient largeHeaders; + + /** + * Gets the LargeHeadersClient object to access its operations. + * + * @return the LargeHeadersClient object. + */ + public LargeHeadersClient getLargeHeaders() { + return this.largeHeaders; + } + + /** + * Initializes an instance of LargeHeaderClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + LargeHeaderClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2023-12-01-preview"; + this.largeHeaders = new LargeHeadersClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LargeHeaderClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersClientImpl.java new file mode 100644 index 00000000000..c5df0d843e6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.largeheader.implementation; + +import azure.resourcemanager.largeheader.fluent.LargeHeadersClient; +import azure.resourcemanager.largeheader.fluent.models.CancelResultInner; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in LargeHeadersClient. + */ +public final class LargeHeadersClientImpl implements LargeHeadersClient { + /** + * The proxy service used to perform REST calls. + */ + private final LargeHeadersService service; + + /** + * The service client containing this operation class. + */ + private final LargeHeaderClientImpl client; + + /** + * Initializes an instance of LargeHeadersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LargeHeadersClientImpl(LargeHeaderClientImpl client) { + this.service + = RestProxy.create(LargeHeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for LargeHeaderClientLargeHeaders to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "LargeHeaderClientLargeHeaders") + public interface LargeHeadersService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.LargeHeader/largeHeaders/{largeHeaderName}/two6k") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> two6k(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("largeHeaderName") String largeHeaderName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.LargeHeader/largeHeaders/{largeHeaderName}/two6k") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response two6kSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("largeHeaderName") String largeHeaderName, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> two6kWithResponseAsync(String resourceGroupName, String largeHeaderName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.two6k(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, largeHeaderName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response two6kWithResponse(String resourceGroupName, String largeHeaderName) { + final String accept = "application/json"; + return service.two6kSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, largeHeaderName, accept, Context.NONE); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response two6kWithResponse(String resourceGroupName, String largeHeaderName, Context context) { + final String accept = "application/json"; + return service.two6kSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, largeHeaderName, accept, context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CancelResultInner> beginTwo6kAsync(String resourceGroupName, + String largeHeaderName) { + Mono>> mono = two6kWithResponseAsync(resourceGroupName, largeHeaderName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + CancelResultInner.class, CancelResultInner.class, this.client.getContext()); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CancelResultInner> beginTwo6k(String resourceGroupName, + String largeHeaderName) { + Response response = two6kWithResponse(resourceGroupName, largeHeaderName); + return this.client.getLroResult(response, CancelResultInner.class, + CancelResultInner.class, Context.NONE); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CancelResultInner> beginTwo6k(String resourceGroupName, + String largeHeaderName, Context context) { + Response response = two6kWithResponse(resourceGroupName, largeHeaderName, context); + return this.client.getLroResult(response, CancelResultInner.class, + CancelResultInner.class, context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono two6kAsync(String resourceGroupName, String largeHeaderName) { + return beginTwo6kAsync(resourceGroupName, largeHeaderName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 CancelResultInner two6k(String resourceGroupName, String largeHeaderName) { + return beginTwo6k(resourceGroupName, largeHeaderName).getFinalResult(); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 CancelResultInner two6k(String resourceGroupName, String largeHeaderName, Context context) { + return beginTwo6k(resourceGroupName, largeHeaderName, context).getFinalResult(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersImpl.java new file mode 100644 index 00000000000..1799419dee3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.largeheader.implementation; + +import azure.resourcemanager.largeheader.fluent.LargeHeadersClient; +import azure.resourcemanager.largeheader.fluent.models.CancelResultInner; +import azure.resourcemanager.largeheader.models.CancelResult; +import azure.resourcemanager.largeheader.models.LargeHeaders; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class LargeHeadersImpl implements LargeHeaders { + private static final ClientLogger LOGGER = new ClientLogger(LargeHeadersImpl.class); + + private final LargeHeadersClient innerClient; + + private final azure.resourcemanager.largeheader.LargeHeaderManager serviceManager; + + public LargeHeadersImpl(LargeHeadersClient innerClient, + azure.resourcemanager.largeheader.LargeHeaderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CancelResult two6k(String resourceGroupName, String largeHeaderName) { + CancelResultInner inner = this.serviceClient().two6k(resourceGroupName, largeHeaderName); + if (inner != null) { + return new CancelResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public CancelResult two6k(String resourceGroupName, String largeHeaderName, Context context) { + CancelResultInner inner = this.serviceClient().two6k(resourceGroupName, largeHeaderName, context); + if (inner != null) { + return new CancelResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private LargeHeadersClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.largeheader.LargeHeaderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/ResourceManagerUtils.java new file mode 100644 index 00000000000..7c02e2426ae --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.largeheader.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/package-info.java new file mode 100644 index 00000000000..ccab556daba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for LargeHeader. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.largeheader.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/CancelResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/CancelResult.java new file mode 100644 index 00000000000..21ed342529e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/CancelResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.largeheader.models; + +import azure.resourcemanager.largeheader.fluent.models.CancelResultInner; + +/** + * An immutable client-side representation of CancelResult. + */ +public interface CancelResult { + /** + * Gets the succeeded property: The succeeded property. + * + * @return the succeeded value. + */ + boolean succeeded(); + + /** + * Gets the inner azure.resourcemanager.largeheader.fluent.models.CancelResultInner object. + * + * @return the inner object. + */ + CancelResultInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/LargeHeaders.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/LargeHeaders.java new file mode 100644 index 00000000000..99ac162675d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/LargeHeaders.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.largeheader.models; + +import com.azure.core.util.Context; + +/** + * Resource collection API of LargeHeaders. + */ +public interface LargeHeaders { + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + CancelResult two6k(String resourceGroupName, String largeHeaderName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param largeHeaderName The name of the LargeHeader. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + CancelResult two6k(String resourceGroupName, String largeHeaderName, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/package-info.java new file mode 100644 index 00000000000..781de7fb684 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for LargeHeader. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.largeheader.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/package-info.java new file mode 100644 index 00000000000..9b57448d5d9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/largeheader/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for LargeHeader. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.largeheader; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/MethodSubscriptionIdManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/MethodSubscriptionIdManager.java new file mode 100644 index 00000000000..51203494232 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/MethodSubscriptionIdManager.java @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid; + +import azure.resourcemanager.methodsubscriptionid.fluent.MethodSubscriptionIdClient; +import azure.resourcemanager.methodsubscriptionid.implementation.MethodSubscriptionIdClientBuilder; +import azure.resourcemanager.methodsubscriptionid.implementation.MixedSubscriptionPlacementResourceGroupResourceOperationsImpl; +import azure.resourcemanager.methodsubscriptionid.implementation.MixedSubscriptionPlacementSubscriptionResourceOperationsImpl; +import azure.resourcemanager.methodsubscriptionid.implementation.OperationsImpl; +import azure.resourcemanager.methodsubscriptionid.implementation.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl; +import azure.resourcemanager.methodsubscriptionid.implementation.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl; +import azure.resourcemanager.methodsubscriptionid.models.MixedSubscriptionPlacementResourceGroupResourceOperations; +import azure.resourcemanager.methodsubscriptionid.models.MixedSubscriptionPlacementSubscriptionResourceOperations; +import azure.resourcemanager.methodsubscriptionid.models.Operations; +import azure.resourcemanager.methodsubscriptionid.models.TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations; +import azure.resourcemanager.methodsubscriptionid.models.TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to MethodSubscriptionIdManager. + * Test for ARM method level subscription ID parameter placement. + */ +public final class MethodSubscriptionIdManager { + private TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations; + + private TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations; + + private MixedSubscriptionPlacementSubscriptionResourceOperations mixedSubscriptionPlacementSubscriptionResourceOperations; + + private MixedSubscriptionPlacementResourceGroupResourceOperations mixedSubscriptionPlacementResourceGroupResourceOperations; + + private Operations operations; + + private final MethodSubscriptionIdClient clientObject; + + private MethodSubscriptionIdManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new MethodSubscriptionIdClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of MethodSubscriptionId service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the MethodSubscriptionId service API instance. + */ + public static MethodSubscriptionIdManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of MethodSubscriptionId service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the MethodSubscriptionId service API instance. + */ + public static MethodSubscriptionIdManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new MethodSubscriptionIdManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create MethodSubscriptionIdManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new MethodSubscriptionIdManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-methodsubscriptionid-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of MethodSubscriptionId service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the MethodSubscriptionId service API instance. + */ + public MethodSubscriptionIdManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("azure.resourcemanager.methodsubscriptionid") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new MethodSubscriptionIdManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations. It + * manages SubscriptionResource1. + * + * @return Resource collection API of TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations. + */ + public TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations + twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() { + if (this.twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations == null) { + this.twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations + = new TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl( + clientObject.getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations(), this); + } + return twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations; + } + + /** + * Gets the resource collection API of TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations. It + * manages SubscriptionResource2. + * + * @return Resource collection API of TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations. + */ + public TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations + twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() { + if (this.twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations == null) { + this.twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations + = new TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl( + clientObject.getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations(), this); + } + return twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations; + } + + /** + * Gets the resource collection API of MixedSubscriptionPlacementSubscriptionResourceOperations. It manages + * SubscriptionResource. + * + * @return Resource collection API of MixedSubscriptionPlacementSubscriptionResourceOperations. + */ + public MixedSubscriptionPlacementSubscriptionResourceOperations + mixedSubscriptionPlacementSubscriptionResourceOperations() { + if (this.mixedSubscriptionPlacementSubscriptionResourceOperations == null) { + this.mixedSubscriptionPlacementSubscriptionResourceOperations + = new MixedSubscriptionPlacementSubscriptionResourceOperationsImpl( + clientObject.getMixedSubscriptionPlacementSubscriptionResourceOperations(), this); + } + return mixedSubscriptionPlacementSubscriptionResourceOperations; + } + + /** + * Gets the resource collection API of MixedSubscriptionPlacementResourceGroupResourceOperations. It manages + * ResourceGroupResource. + * + * @return Resource collection API of MixedSubscriptionPlacementResourceGroupResourceOperations. + */ + public MixedSubscriptionPlacementResourceGroupResourceOperations + mixedSubscriptionPlacementResourceGroupResourceOperations() { + if (this.mixedSubscriptionPlacementResourceGroupResourceOperations == null) { + this.mixedSubscriptionPlacementResourceGroupResourceOperations + = new MixedSubscriptionPlacementResourceGroupResourceOperationsImpl( + clientObject.getMixedSubscriptionPlacementResourceGroupResourceOperations(), this); + } + return mixedSubscriptionPlacementResourceGroupResourceOperations; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets wrapped service client MethodSubscriptionIdClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client MethodSubscriptionIdClient. + */ + public MethodSubscriptionIdClient serviceClient() { + return this.clientObject; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MethodSubscriptionIdClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MethodSubscriptionIdClient.java new file mode 100644 index 00000000000..ecec95c25a3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MethodSubscriptionIdClient.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for MethodSubscriptionIdClient class. + */ +public interface MethodSubscriptionIdClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient object to access its + * operations. + * + * @return the TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient object. + */ + TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient + getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations(); + + /** + * Gets the TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient object to access its + * operations. + * + * @return the TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient object. + */ + TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient + getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations(); + + /** + * Gets the MixedSubscriptionPlacementSubscriptionResourceOperationsClient object to access its operations. + * + * @return the MixedSubscriptionPlacementSubscriptionResourceOperationsClient object. + */ + MixedSubscriptionPlacementSubscriptionResourceOperationsClient + getMixedSubscriptionPlacementSubscriptionResourceOperations(); + + /** + * Gets the MixedSubscriptionPlacementResourceGroupResourceOperationsClient object to access its operations. + * + * @return the MixedSubscriptionPlacementResourceGroupResourceOperationsClient object. + */ + MixedSubscriptionPlacementResourceGroupResourceOperationsClient + getMixedSubscriptionPlacementResourceGroupResourceOperations(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementResourceGroupResourceOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementResourceGroupResourceOperationsClient.java new file mode 100644 index 00000000000..1699d64abd9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementResourceGroupResourceOperationsClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.fluent; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * An instance of this class provides access to all the operations defined in + * MixedSubscriptionPlacementResourceGroupResourceOperationsClient. + */ +public interface MixedSubscriptionPlacementResourceGroupResourceOperationsClient { + /** + * Get a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ResourceGroupResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String resourceGroupResourceName, Context context); + + /** + * Get a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ResourceGroupResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceGroupResourceInner getByResourceGroup(String resourceGroupName, String resourceGroupResourceName); + + /** + * Create a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response putWithResponse(String resourceGroupName, String resourceGroupResourceName, + ResourceGroupResourceInner resource, Context context); + + /** + * Create a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceGroupResourceInner put(String resourceGroupName, String resourceGroupResourceName, + ResourceGroupResourceInner resource); + + /** + * Delete a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String resourceGroupResourceName, Context context); + + /** + * Delete a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceGroupResourceName); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementSubscriptionResourceOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementSubscriptionResourceOperationsClient.java new file mode 100644 index 00000000000..da9a757977d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementSubscriptionResourceOperationsClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.fluent; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * An instance of this class provides access to all the operations defined in + * MixedSubscriptionPlacementSubscriptionResourceOperationsClient. + */ +public interface MixedSubscriptionPlacementSubscriptionResourceOperationsClient { + /** + * Get a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String subscriptionId, String subscriptionResourceName, + Context context); + + /** + * Get a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionResourceInner get(String subscriptionId, String subscriptionResourceName); + + /** + * Create a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response putWithResponse(String subscriptionId, String subscriptionResourceName, + SubscriptionResourceInner resource, Context context); + + /** + * Create a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionResourceInner put(String subscriptionId, String subscriptionResourceName, + SubscriptionResourceInner resource); + + /** + * Delete a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String subscriptionId, String subscriptionResourceName, Context context); + + /** + * Delete a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String subscriptionId, String subscriptionResourceName); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/OperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/OperationsClient.java new file mode 100644 index 00000000000..ddb61e4cdad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.fluent; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.java new file mode 100644 index 00000000000..cb9210bba54 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.fluent; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * An instance of this class provides access to all the operations defined in + * TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient. + */ +public interface TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient { + /** + * Get a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource1 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String subscriptionId, String subscriptionResource1Name, + Context context); + + /** + * Get a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource1. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionResource1Inner get(String subscriptionId, String subscriptionResource1Name); + + /** + * Create a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response putWithResponse(String subscriptionId, String subscriptionResource1Name, + SubscriptionResource1Inner resource, Context context); + + /** + * Create a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionResource1Inner put(String subscriptionId, String subscriptionResource1Name, + SubscriptionResource1Inner resource); + + /** + * Delete a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String subscriptionId, String subscriptionResource1Name, Context context); + + /** + * Delete a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String subscriptionId, String subscriptionResource1Name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.java new file mode 100644 index 00000000000..3213076a3f6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.fluent; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * An instance of this class provides access to all the operations defined in + * TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient. + */ +public interface TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient { + /** + * Get a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource2 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String subscriptionId, String subscriptionResource2Name, + Context context); + + /** + * Get a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource2. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionResource2Inner get(String subscriptionId, String subscriptionResource2Name); + + /** + * Create a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response putWithResponse(String subscriptionId, String subscriptionResource2Name, + SubscriptionResource2Inner resource, Context context); + + /** + * Create a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionResource2Inner put(String subscriptionId, String subscriptionResource2Name, + SubscriptionResource2Inner resource); + + /** + * Delete a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String subscriptionId, String subscriptionResource2Name, Context context); + + /** + * Delete a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String subscriptionId, String subscriptionResource2Name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/OperationInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/OperationInner.java new file mode 100644 index 00000000000..484d3592976 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.fluent.models; + +import azure.resourcemanager.methodsubscriptionid.models.ActionType; +import azure.resourcemanager.methodsubscriptionid.models.OperationDisplay; +import azure.resourcemanager.methodsubscriptionid.models.Origin; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/ResourceGroupResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/ResourceGroupResourceInner.java new file mode 100644 index 00000000000..d30dcf45f33 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/ResourceGroupResourceInner.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.fluent.models; + +import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class ResourceGroupResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private ResourceGroupResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ResourceGroupResourceInner class. + */ + public ResourceGroupResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ResourceGroupResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ResourceGroupResourceInner object itself. + */ + public ResourceGroupResourceInner withProperties(ResourceGroupResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ResourceGroupResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ResourceGroupResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceGroupResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceGroupResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceGroupResourceInner. + */ + public static ResourceGroupResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceGroupResourceInner deserializedResourceGroupResourceInner = new ResourceGroupResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedResourceGroupResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedResourceGroupResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedResourceGroupResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedResourceGroupResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedResourceGroupResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedResourceGroupResourceInner.properties + = ResourceGroupResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedResourceGroupResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceGroupResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource1Inner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource1Inner.java new file mode 100644 index 00000000000..d4ff171c1b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource1Inner.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.fluent.models; + +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Concrete proxy resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class SubscriptionResource1Inner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private SubscriptionResource1Properties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SubscriptionResource1Inner class. + */ + public SubscriptionResource1Inner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public SubscriptionResource1Properties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the SubscriptionResource1Inner object itself. + */ + public SubscriptionResource1Inner withProperties(SubscriptionResource1Properties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubscriptionResource1Inner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubscriptionResource1Inner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubscriptionResource1Inner. + */ + public static SubscriptionResource1Inner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubscriptionResource1Inner deserializedSubscriptionResource1Inner = new SubscriptionResource1Inner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSubscriptionResource1Inner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSubscriptionResource1Inner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSubscriptionResource1Inner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSubscriptionResource1Inner.properties + = SubscriptionResource1Properties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSubscriptionResource1Inner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSubscriptionResource1Inner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource2Inner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource2Inner.java new file mode 100644 index 00000000000..8c78b74e127 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource2Inner.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.fluent.models; + +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Concrete proxy resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class SubscriptionResource2Inner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private SubscriptionResource2Properties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SubscriptionResource2Inner class. + */ + public SubscriptionResource2Inner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public SubscriptionResource2Properties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the SubscriptionResource2Inner object itself. + */ + public SubscriptionResource2Inner withProperties(SubscriptionResource2Properties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubscriptionResource2Inner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubscriptionResource2Inner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubscriptionResource2Inner. + */ + public static SubscriptionResource2Inner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubscriptionResource2Inner deserializedSubscriptionResource2Inner = new SubscriptionResource2Inner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSubscriptionResource2Inner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSubscriptionResource2Inner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSubscriptionResource2Inner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSubscriptionResource2Inner.properties + = SubscriptionResource2Properties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSubscriptionResource2Inner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSubscriptionResource2Inner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResourceInner.java new file mode 100644 index 00000000000..5ce20b4ad59 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResourceInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.fluent.models; + +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Concrete proxy resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class SubscriptionResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private SubscriptionResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SubscriptionResourceInner class. + */ + public SubscriptionResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public SubscriptionResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the SubscriptionResourceInner object itself. + */ + public SubscriptionResourceInner withProperties(SubscriptionResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubscriptionResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubscriptionResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubscriptionResourceInner. + */ + public static SubscriptionResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubscriptionResourceInner deserializedSubscriptionResourceInner = new SubscriptionResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSubscriptionResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSubscriptionResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSubscriptionResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSubscriptionResourceInner.properties = SubscriptionResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSubscriptionResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSubscriptionResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/package-info.java new file mode 100644 index 00000000000..da2168ece74 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for MethodSubscriptionId. + * Test for ARM method level subscription ID parameter placement. + */ +package azure.resourcemanager.methodsubscriptionid.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/package-info.java new file mode 100644 index 00000000000..0bbf2be71c7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for MethodSubscriptionId. + * Test for ARM method level subscription ID parameter placement. + */ +package azure.resourcemanager.methodsubscriptionid.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientBuilder.java new file mode 100644 index 00000000000..6e61c5be387 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the MethodSubscriptionIdClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { MethodSubscriptionIdClientImpl.class }) +public final class MethodSubscriptionIdClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the MethodSubscriptionIdClientBuilder. + */ + public MethodSubscriptionIdClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the MethodSubscriptionIdClientBuilder. + */ + public MethodSubscriptionIdClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the MethodSubscriptionIdClientBuilder. + */ + public MethodSubscriptionIdClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 MethodSubscriptionIdClientBuilder. + */ + public MethodSubscriptionIdClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the MethodSubscriptionIdClientBuilder. + */ + public MethodSubscriptionIdClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 MethodSubscriptionIdClientBuilder. + */ + public MethodSubscriptionIdClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MethodSubscriptionIdClientImpl with the provided parameters. + * + * @return an instance of MethodSubscriptionIdClientImpl. + */ + public MethodSubscriptionIdClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + MethodSubscriptionIdClientImpl client = new MethodSubscriptionIdClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientImpl.java new file mode 100644 index 00000000000..f3206ee4a9a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientImpl.java @@ -0,0 +1,382 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.MethodSubscriptionIdClient; +import azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the MethodSubscriptionIdClientImpl type. + */ +@ServiceClient(builder = MethodSubscriptionIdClientBuilder.class) +public final class MethodSubscriptionIdClientImpl implements MethodSubscriptionIdClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient object to access its operations. + */ + private final TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations; + + /** + * Gets the TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient object to access its + * operations. + * + * @return the TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient object. + */ + public TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient + getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() { + return this.twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations; + } + + /** + * The TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient object to access its operations. + */ + private final TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations; + + /** + * Gets the TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient object to access its + * operations. + * + * @return the TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient object. + */ + public TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient + getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() { + return this.twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations; + } + + /** + * The MixedSubscriptionPlacementSubscriptionResourceOperationsClient object to access its operations. + */ + private final MixedSubscriptionPlacementSubscriptionResourceOperationsClient mixedSubscriptionPlacementSubscriptionResourceOperations; + + /** + * Gets the MixedSubscriptionPlacementSubscriptionResourceOperationsClient object to access its operations. + * + * @return the MixedSubscriptionPlacementSubscriptionResourceOperationsClient object. + */ + public MixedSubscriptionPlacementSubscriptionResourceOperationsClient + getMixedSubscriptionPlacementSubscriptionResourceOperations() { + return this.mixedSubscriptionPlacementSubscriptionResourceOperations; + } + + /** + * The MixedSubscriptionPlacementResourceGroupResourceOperationsClient object to access its operations. + */ + private final MixedSubscriptionPlacementResourceGroupResourceOperationsClient mixedSubscriptionPlacementResourceGroupResourceOperations; + + /** + * Gets the MixedSubscriptionPlacementResourceGroupResourceOperationsClient object to access its operations. + * + * @return the MixedSubscriptionPlacementResourceGroupResourceOperationsClient object. + */ + public MixedSubscriptionPlacementResourceGroupResourceOperationsClient + getMixedSubscriptionPlacementResourceGroupResourceOperations() { + return this.mixedSubscriptionPlacementResourceGroupResourceOperations; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * Initializes an instance of MethodSubscriptionIdClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + MethodSubscriptionIdClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2023-12-01-preview"; + this.twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations + = new TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl(this); + this.twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations + = new TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl(this); + this.mixedSubscriptionPlacementSubscriptionResourceOperations + = new MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl(this); + this.mixedSubscriptionPlacementResourceGroupResourceOperations + = new MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl(this); + this.operations = new OperationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MethodSubscriptionIdClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl.java new file mode 100644 index 00000000000..095b76d32c5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl.java @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * MixedSubscriptionPlacementResourceGroupResourceOperationsClient. + */ +public final class MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl + implements MixedSubscriptionPlacementResourceGroupResourceOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final MixedSubscriptionPlacementResourceGroupResourceOperationsService service; + + /** + * The service client containing this operation class. + */ + private final MethodSubscriptionIdClientImpl client; + + /** + * Initializes an instance of MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl(MethodSubscriptionIdClientImpl client) { + this.service = RestProxy.create(MixedSubscriptionPlacementResourceGroupResourceOperationsService.class, + client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for + * MethodSubscriptionIdClientMixedSubscriptionPlacementResourceGroupResourceOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MethodSubscriptionIdClientMixedSubscriptionPlacementResourceGroupResourceOperations") + public interface MixedSubscriptionPlacementResourceGroupResourceOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/{resourceGroupResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceGroupResourceName") String resourceGroupResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/{resourceGroupResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceGroupResourceName") String resourceGroupResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/{resourceGroupResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceGroupResourceName") String resourceGroupResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ResourceGroupResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/{resourceGroupResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response putSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceGroupResourceName") String resourceGroupResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ResourceGroupResourceInner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/{resourceGroupResourceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceGroupResourceName") String resourceGroupResourceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.MethodSubscriptionId/resourceGroupResources/{resourceGroupResourceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceGroupResourceName") String resourceGroupResourceName, Context context); + } + + /** + * Get a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ResourceGroupResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String resourceGroupResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, resourceGroupResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ResourceGroupResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String resourceGroupResourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceGroupResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ResourceGroupResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String resourceGroupResourceName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, resourceGroupResourceName, accept, context); + } + + /** + * Get a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ResourceGroupResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceGroupResourceInner getByResourceGroup(String resourceGroupName, String resourceGroupResourceName) { + return getByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, Context.NONE).getValue(); + } + + /** + * Create a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync(String resourceGroupName, + String resourceGroupResourceName, ResourceGroupResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, resourceGroupResourceName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync(String resourceGroupName, String resourceGroupResourceName, + ResourceGroupResourceInner resource) { + return putWithResponseAsync(resourceGroupName, resourceGroupResourceName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(String resourceGroupName, + String resourceGroupResourceName, ResourceGroupResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, resourceGroupResourceName, contentType, accept, resource, context); + } + + /** + * Create a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceGroupResourceInner put(String resourceGroupName, String resourceGroupResourceName, + ResourceGroupResourceInner resource) { + return putWithResponse(resourceGroupName, resourceGroupResourceName, resource, Context.NONE).getValue(); + } + + /** + * Delete a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String resourceGroupResourceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, resourceGroupResourceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceGroupResourceName) { + return deleteWithResponseAsync(resourceGroupName, resourceGroupResourceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String resourceGroupResourceName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, resourceGroupResourceName, context); + } + + /** + * Delete a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceGroupResourceName) { + deleteWithResponse(resourceGroupName, resourceGroupResourceName, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsImpl.java new file mode 100644 index 00000000000..e4c7ef18e1c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsImpl.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner; +import azure.resourcemanager.methodsubscriptionid.models.MixedSubscriptionPlacementResourceGroupResourceOperations; +import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResource; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class MixedSubscriptionPlacementResourceGroupResourceOperationsImpl + implements MixedSubscriptionPlacementResourceGroupResourceOperations { + private static final ClientLogger LOGGER + = new ClientLogger(MixedSubscriptionPlacementResourceGroupResourceOperationsImpl.class); + + private final MixedSubscriptionPlacementResourceGroupResourceOperationsClient innerClient; + + private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; + + public MixedSubscriptionPlacementResourceGroupResourceOperationsImpl( + MixedSubscriptionPlacementResourceGroupResourceOperationsClient innerClient, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String resourceGroupResourceName, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ResourceGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ResourceGroupResource getByResourceGroup(String resourceGroupName, String resourceGroupResourceName) { + ResourceGroupResourceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, resourceGroupResourceName); + if (inner != null) { + return new ResourceGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, String resourceGroupResourceName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, resourceGroupResourceName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String resourceGroupResourceName) { + this.serviceClient().delete(resourceGroupName, resourceGroupResourceName); + } + + public ResourceGroupResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceGroupResourceName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroupResources"); + if (resourceGroupResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroupResources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceGroupResourceName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroupResources"); + if (resourceGroupResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroupResources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceGroupResourceName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroupResources"); + if (resourceGroupResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroupResources'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceGroupResourceName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroupResources"); + if (resourceGroupResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroupResources'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, context); + } + + private MixedSubscriptionPlacementResourceGroupResourceOperationsClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { + return this.serviceManager; + } + + public ResourceGroupResourceImpl define(String name) { + return new ResourceGroupResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl.java new file mode 100644 index 00000000000..ffae5de029a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * MixedSubscriptionPlacementSubscriptionResourceOperationsClient. + */ +public final class MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl + implements MixedSubscriptionPlacementSubscriptionResourceOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final MixedSubscriptionPlacementSubscriptionResourceOperationsService service; + + /** + * The service client containing this operation class. + */ + private final MethodSubscriptionIdClientImpl client; + + /** + * Initializes an instance of MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl(MethodSubscriptionIdClientImpl client) { + this.service = RestProxy.create(MixedSubscriptionPlacementSubscriptionResourceOperationsService.class, + client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for + * MethodSubscriptionIdClientMixedSubscriptionPlacementSubscriptionResourceOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MethodSubscriptionIdClientMixedSubscriptionPlacementSubscriptionResourceOperations") + public interface MixedSubscriptionPlacementSubscriptionResourceOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/{subscriptionResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResourceName") String subscriptionResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/{subscriptionResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResourceName") String subscriptionResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/{subscriptionResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResourceName") String subscriptionResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SubscriptionResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/{subscriptionResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response putSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResourceName") String subscriptionResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SubscriptionResourceInner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/{subscriptionResourceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResourceName") String subscriptionResourceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResources/{subscriptionResourceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResourceName") String subscriptionResourceName, Context context); + } + + /** + * Get a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String subscriptionId, + String subscriptionResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String subscriptionId, String subscriptionResourceName) { + return getWithResponseAsync(subscriptionId, subscriptionResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String subscriptionId, String subscriptionResourceName, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResourceName, accept, context); + } + + /** + * Get a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionResourceInner get(String subscriptionId, String subscriptionResourceName) { + return getWithResponse(subscriptionId, subscriptionResourceName, Context.NONE).getValue(); + } + + /** + * Create a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync(String subscriptionId, + String subscriptionResourceName, SubscriptionResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResourceName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync(String subscriptionId, String subscriptionResourceName, + SubscriptionResourceInner resource) { + return putWithResponseAsync(subscriptionId, subscriptionResourceName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(String subscriptionId, String subscriptionResourceName, + SubscriptionResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResourceName, contentType, accept, resource, context); + } + + /** + * Create a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionResourceInner put(String subscriptionId, String subscriptionResourceName, + SubscriptionResourceInner resource) { + return putWithResponse(subscriptionId, subscriptionResourceName, resource, Context.NONE).getValue(); + } + + /** + * Delete a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String subscriptionId, String subscriptionResourceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + subscriptionId, subscriptionResourceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String subscriptionId, String subscriptionResourceName) { + return deleteWithResponseAsync(subscriptionId, subscriptionResourceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String subscriptionId, String subscriptionResourceName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResourceName, context); + } + + /** + * Delete a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String subscriptionId, String subscriptionResourceName) { + deleteWithResponse(subscriptionId, subscriptionResourceName, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsImpl.java new file mode 100644 index 00000000000..d16d4186aff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsImpl.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; +import azure.resourcemanager.methodsubscriptionid.models.MixedSubscriptionPlacementSubscriptionResourceOperations; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class MixedSubscriptionPlacementSubscriptionResourceOperationsImpl + implements MixedSubscriptionPlacementSubscriptionResourceOperations { + private static final ClientLogger LOGGER + = new ClientLogger(MixedSubscriptionPlacementSubscriptionResourceOperationsImpl.class); + + private final MixedSubscriptionPlacementSubscriptionResourceOperationsClient innerClient; + + private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; + + public MixedSubscriptionPlacementSubscriptionResourceOperationsImpl( + MixedSubscriptionPlacementSubscriptionResourceOperationsClient innerClient, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String subscriptionId, String subscriptionResourceName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(subscriptionId, subscriptionResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SubscriptionResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SubscriptionResource get(String subscriptionId, String subscriptionResourceName) { + SubscriptionResourceInner inner = this.serviceClient().get(subscriptionId, subscriptionResourceName); + if (inner != null) { + return new SubscriptionResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String subscriptionId, String subscriptionResourceName, + Context context) { + return this.serviceClient().deleteWithResponse(subscriptionId, subscriptionResourceName, context); + } + + public void deleteByResourceGroup(String subscriptionId, String subscriptionResourceName) { + this.serviceClient().delete(subscriptionId, subscriptionResourceName); + } + + public SubscriptionResource getById(String id) { + String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String subscriptionResourceName = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResources"); + if (subscriptionResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResources'.", id))); + } + return this.getWithResponse(subscriptionId, subscriptionResourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String subscriptionResourceName = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResources"); + if (subscriptionResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResources'.", id))); + } + return this.getWithResponse(subscriptionId, subscriptionResourceName, context); + } + + public void deleteById(String id) { + String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String subscriptionResourceName = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResources"); + if (subscriptionResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResources'.", id))); + } + this.deleteByResourceGroupWithResponse(subscriptionId, subscriptionResourceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String subscriptionResourceName = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResources"); + if (subscriptionResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResources'.", id))); + } + return this.deleteByResourceGroupWithResponse(subscriptionId, subscriptionResourceName, context); + } + + private MixedSubscriptionPlacementSubscriptionResourceOperationsClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { + return this.serviceManager; + } + + public SubscriptionResourceImpl define(String name) { + return new SubscriptionResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationImpl.java new file mode 100644 index 00000000000..70044ef003e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; +import azure.resourcemanager.methodsubscriptionid.models.ActionType; +import azure.resourcemanager.methodsubscriptionid.models.Operation; +import azure.resourcemanager.methodsubscriptionid.models.OperationDisplay; +import azure.resourcemanager.methodsubscriptionid.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; + + OperationImpl(OperationInner innerObject, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsClientImpl.java new file mode 100644 index 00000000000..bf16ce45edc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; +import azure.resourcemanager.methodsubscriptionid.implementation.models.OperationListResult; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +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.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final MethodSubscriptionIdClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MethodSubscriptionIdClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MethodSubscriptionIdClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MethodSubscriptionIdClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Azure.ResourceManager.MethodSubscriptionId/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Azure.ResourceManager.MethodSubscriptionId/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsImpl.java new file mode 100644 index 00000000000..c6c55ba2cd1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; +import azure.resourcemanager.methodsubscriptionid.models.Operation; +import azure.resourcemanager.methodsubscriptionid.models.Operations; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceGroupResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceGroupResourceImpl.java new file mode 100644 index 00000000000..6f6407891d1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceGroupResourceImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner; +import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResource; +import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Collections; +import java.util.Map; + +public final class ResourceGroupResourceImpl + implements ResourceGroupResource, ResourceGroupResource.Definition, ResourceGroupResource.Update { + private ResourceGroupResourceInner innerObject; + + private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ResourceGroupResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ResourceGroupResourceInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceGroupResourceName; + + public ResourceGroupResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ResourceGroupResource create() { + this.innerObject = serviceManager.serviceClient() + .getMixedSubscriptionPlacementResourceGroupResourceOperations() + .putWithResponse(resourceGroupName, resourceGroupResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ResourceGroupResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMixedSubscriptionPlacementResourceGroupResourceOperations() + .putWithResponse(resourceGroupName, resourceGroupResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + ResourceGroupResourceImpl(String name, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerObject = new ResourceGroupResourceInner(); + this.serviceManager = serviceManager; + this.resourceGroupResourceName = name; + } + + public ResourceGroupResourceImpl update() { + return this; + } + + public ResourceGroupResource apply() { + this.innerObject = serviceManager.serviceClient() + .getMixedSubscriptionPlacementResourceGroupResourceOperations() + .putWithResponse(resourceGroupName, resourceGroupResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ResourceGroupResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMixedSubscriptionPlacementResourceGroupResourceOperations() + .putWithResponse(resourceGroupName, resourceGroupResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + ResourceGroupResourceImpl(ResourceGroupResourceInner innerObject, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceGroupResourceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroupResources"); + } + + public ResourceGroupResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getMixedSubscriptionPlacementResourceGroupResourceOperations() + .getByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, Context.NONE) + .getValue(); + return this; + } + + public ResourceGroupResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMixedSubscriptionPlacementResourceGroupResourceOperations() + .getByResourceGroupWithResponse(resourceGroupName, resourceGroupResourceName, context) + .getValue(); + return this; + } + + public ResourceGroupResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ResourceGroupResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ResourceGroupResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ResourceGroupResourceImpl withProperties(ResourceGroupResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceManagerUtils.java new file mode 100644 index 00000000000..159e5bc85f4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource1Impl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource1Impl.java new file mode 100644 index 00000000000..79a3f61408f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource1Impl.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; + +public final class SubscriptionResource1Impl + implements SubscriptionResource1, SubscriptionResource1.Definition, SubscriptionResource1.Update { + private SubscriptionResource1Inner innerObject; + + private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SubscriptionResource1Properties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SubscriptionResource1Inner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { + return this.serviceManager; + } + + private String subscriptionId; + + private String subscriptionResource1Name; + + public SubscriptionResource1 create() { + this.innerObject = serviceManager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() + .putWithResponse(subscriptionId, subscriptionResource1Name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SubscriptionResource1 create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() + .putWithResponse(subscriptionId, subscriptionResource1Name, this.innerModel(), context) + .getValue(); + return this; + } + + SubscriptionResource1Impl(String name, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerObject = new SubscriptionResource1Inner(); + this.serviceManager = serviceManager; + this.subscriptionResource1Name = name; + } + + public SubscriptionResource1Impl update() { + return this; + } + + public SubscriptionResource1 apply() { + this.innerObject = serviceManager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() + .putWithResponse(subscriptionId, subscriptionResource1Name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SubscriptionResource1 apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() + .putWithResponse(subscriptionId, subscriptionResource1Name, this.innerModel(), context) + .getValue(); + return this; + } + + SubscriptionResource1Impl(SubscriptionResource1Inner innerObject, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.subscriptionId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptions"); + this.subscriptionResource1Name + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptionResource1s"); + } + + public SubscriptionResource1 refresh() { + this.innerObject = serviceManager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() + .getWithResponse(subscriptionId, subscriptionResource1Name, Context.NONE) + .getValue(); + return this; + } + + public SubscriptionResource1 refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() + .getWithResponse(subscriptionId, subscriptionResource1Name, context) + .getValue(); + return this; + } + + public SubscriptionResource1Impl withProperties(SubscriptionResource1Properties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource2Impl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource2Impl.java new file mode 100644 index 00000000000..b1c2899d766 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource2Impl.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; + +public final class SubscriptionResource2Impl + implements SubscriptionResource2, SubscriptionResource2.Definition, SubscriptionResource2.Update { + private SubscriptionResource2Inner innerObject; + + private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SubscriptionResource2Properties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SubscriptionResource2Inner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { + return this.serviceManager; + } + + private String subscriptionId; + + private String subscriptionResource2Name; + + public SubscriptionResource2 create() { + this.innerObject = serviceManager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() + .putWithResponse(subscriptionId, subscriptionResource2Name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SubscriptionResource2 create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() + .putWithResponse(subscriptionId, subscriptionResource2Name, this.innerModel(), context) + .getValue(); + return this; + } + + SubscriptionResource2Impl(String name, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerObject = new SubscriptionResource2Inner(); + this.serviceManager = serviceManager; + this.subscriptionResource2Name = name; + } + + public SubscriptionResource2Impl update() { + return this; + } + + public SubscriptionResource2 apply() { + this.innerObject = serviceManager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() + .putWithResponse(subscriptionId, subscriptionResource2Name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SubscriptionResource2 apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() + .putWithResponse(subscriptionId, subscriptionResource2Name, this.innerModel(), context) + .getValue(); + return this; + } + + SubscriptionResource2Impl(SubscriptionResource2Inner innerObject, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.subscriptionId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptions"); + this.subscriptionResource2Name + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptionResource2s"); + } + + public SubscriptionResource2 refresh() { + this.innerObject = serviceManager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() + .getWithResponse(subscriptionId, subscriptionResource2Name, Context.NONE) + .getValue(); + return this; + } + + public SubscriptionResource2 refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() + .getWithResponse(subscriptionId, subscriptionResource2Name, context) + .getValue(); + return this; + } + + public SubscriptionResource2Impl withProperties(SubscriptionResource2Properties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResourceImpl.java new file mode 100644 index 00000000000..f5a7fd1b81a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResourceImpl.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; + +public final class SubscriptionResourceImpl + implements SubscriptionResource, SubscriptionResource.Definition, SubscriptionResource.Update { + private SubscriptionResourceInner innerObject; + + private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SubscriptionResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SubscriptionResourceInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { + return this.serviceManager; + } + + private String subscriptionId; + + private String subscriptionResourceName; + + public SubscriptionResource create() { + this.innerObject = serviceManager.serviceClient() + .getMixedSubscriptionPlacementSubscriptionResourceOperations() + .putWithResponse(subscriptionId, subscriptionResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SubscriptionResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMixedSubscriptionPlacementSubscriptionResourceOperations() + .putWithResponse(subscriptionId, subscriptionResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + SubscriptionResourceImpl(String name, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerObject = new SubscriptionResourceInner(); + this.serviceManager = serviceManager; + this.subscriptionResourceName = name; + } + + public SubscriptionResourceImpl update() { + return this; + } + + public SubscriptionResource apply() { + this.innerObject = serviceManager.serviceClient() + .getMixedSubscriptionPlacementSubscriptionResourceOperations() + .putWithResponse(subscriptionId, subscriptionResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SubscriptionResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMixedSubscriptionPlacementSubscriptionResourceOperations() + .putWithResponse(subscriptionId, subscriptionResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + SubscriptionResourceImpl(SubscriptionResourceInner innerObject, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.subscriptionId = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptions"); + this.subscriptionResourceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "subscriptionResources"); + } + + public SubscriptionResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getMixedSubscriptionPlacementSubscriptionResourceOperations() + .getWithResponse(subscriptionId, subscriptionResourceName, Context.NONE) + .getValue(); + return this; + } + + public SubscriptionResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMixedSubscriptionPlacementSubscriptionResourceOperations() + .getWithResponse(subscriptionId, subscriptionResourceName, context) + .getValue(); + return this; + } + + public SubscriptionResourceImpl withProperties(SubscriptionResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl.java new file mode 100644 index 00000000000..87dcdc74982 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient. + */ +public final class TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl + implements TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsService service; + + /** + * The service client containing this operation class. + */ + private final MethodSubscriptionIdClientImpl client; + + /** + * Initializes an instance of TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl( + MethodSubscriptionIdClientImpl client) { + this.service = RestProxy.create(TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsService.class, + client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for + * MethodSubscriptionIdClientTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface( + name = "MethodSubscriptionIdClientTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations") + public interface TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/{subscriptionResource1Name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResource1Name") String subscriptionResource1Name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/{subscriptionResource1Name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResource1Name") String subscriptionResource1Name, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/{subscriptionResource1Name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResource1Name") String subscriptionResource1Name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SubscriptionResource1Inner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/{subscriptionResource1Name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response putSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResource1Name") String subscriptionResource1Name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SubscriptionResource1Inner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/{subscriptionResource1Name}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResource1Name") String subscriptionResource1Name, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource1s/{subscriptionResource1Name}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResource1Name") String subscriptionResource1Name, Context context); + } + + /** + * Get a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource1 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String subscriptionId, + String subscriptionResource1Name) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResource1Name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource1 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String subscriptionId, String subscriptionResource1Name) { + return getWithResponseAsync(subscriptionId, subscriptionResource1Name) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource1 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String subscriptionId, String subscriptionResource1Name, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResource1Name, accept, context); + } + + /** + * Get a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource1. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionResource1Inner get(String subscriptionId, String subscriptionResource1Name) { + return getWithResponse(subscriptionId, subscriptionResource1Name, Context.NONE).getValue(); + } + + /** + * Create a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync(String subscriptionId, + String subscriptionResource1Name, SubscriptionResource1Inner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResource1Name, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync(String subscriptionId, String subscriptionResource1Name, + SubscriptionResource1Inner resource) { + return putWithResponseAsync(subscriptionId, subscriptionResource1Name, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(String subscriptionId, String subscriptionResource1Name, + SubscriptionResource1Inner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResource1Name, contentType, accept, resource, context); + } + + /** + * Create a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionResource1Inner put(String subscriptionId, String subscriptionResource1Name, + SubscriptionResource1Inner resource) { + return putWithResponse(subscriptionId, subscriptionResource1Name, resource, Context.NONE).getValue(); + } + + /** + * Delete a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String subscriptionId, String subscriptionResource1Name) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + subscriptionId, subscriptionResource1Name, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String subscriptionId, String subscriptionResource1Name) { + return deleteWithResponseAsync(subscriptionId, subscriptionResource1Name).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String subscriptionId, String subscriptionResource1Name, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResource1Name, context); + } + + /** + * Delete a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String subscriptionId, String subscriptionResource1Name) { + deleteWithResponse(subscriptionId, subscriptionResource1Name, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl.java new file mode 100644 index 00000000000..86e2607d924 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1; +import azure.resourcemanager.methodsubscriptionid.models.TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl + implements TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations { + private static final ClientLogger LOGGER + = new ClientLogger(TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl.class); + + private final TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient innerClient; + + private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; + + public TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl( + TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient innerClient, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String subscriptionId, String subscriptionResource1Name, + Context context) { + Response inner + = this.serviceClient().getWithResponse(subscriptionId, subscriptionResource1Name, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SubscriptionResource1Impl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SubscriptionResource1 get(String subscriptionId, String subscriptionResource1Name) { + SubscriptionResource1Inner inner = this.serviceClient().get(subscriptionId, subscriptionResource1Name); + if (inner != null) { + return new SubscriptionResource1Impl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String subscriptionId, String subscriptionResource1Name, + Context context) { + return this.serviceClient().deleteWithResponse(subscriptionId, subscriptionResource1Name, context); + } + + public void deleteByResourceGroup(String subscriptionId, String subscriptionResource1Name) { + this.serviceClient().delete(subscriptionId, subscriptionResource1Name); + } + + public SubscriptionResource1 getById(String id) { + String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String subscriptionResource1Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource1s"); + if (subscriptionResource1Name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource1s'.", id))); + } + return this.getWithResponse(subscriptionId, subscriptionResource1Name, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String subscriptionResource1Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource1s"); + if (subscriptionResource1Name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource1s'.", id))); + } + return this.getWithResponse(subscriptionId, subscriptionResource1Name, context); + } + + public void deleteById(String id) { + String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String subscriptionResource1Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource1s"); + if (subscriptionResource1Name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource1s'.", id))); + } + this.deleteByResourceGroupWithResponse(subscriptionId, subscriptionResource1Name, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String subscriptionResource1Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource1s"); + if (subscriptionResource1Name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource1s'.", id))); + } + return this.deleteByResourceGroupWithResponse(subscriptionId, subscriptionResource1Name, context); + } + + private TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { + return this.serviceManager; + } + + public SubscriptionResource1Impl define(String name) { + return new SubscriptionResource1Impl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl.java new file mode 100644 index 00000000000..f492a9a9a90 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient. + */ +public final class TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl + implements TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsService service; + + /** + * The service client containing this operation class. + */ + private final MethodSubscriptionIdClientImpl client; + + /** + * Initializes an instance of TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl( + MethodSubscriptionIdClientImpl client) { + this.service = RestProxy.create(TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsService.class, + client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for + * MethodSubscriptionIdClientTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface( + name = "MethodSubscriptionIdClientTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations") + public interface TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/{subscriptionResource2Name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResource2Name") String subscriptionResource2Name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/{subscriptionResource2Name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResource2Name") String subscriptionResource2Name, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/{subscriptionResource2Name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResource2Name") String subscriptionResource2Name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SubscriptionResource2Inner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/{subscriptionResource2Name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response putSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResource2Name") String subscriptionResource2Name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SubscriptionResource2Inner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/{subscriptionResource2Name}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResource2Name") String subscriptionResource2Name, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.MethodSubscriptionId/subscriptionResource2s/{subscriptionResource2Name}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("subscriptionResource2Name") String subscriptionResource2Name, Context context); + } + + /** + * Get a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource2 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String subscriptionId, + String subscriptionResource2Name) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResource2Name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource2 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String subscriptionId, String subscriptionResource2Name) { + return getWithResponseAsync(subscriptionId, subscriptionResource2Name) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource2 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String subscriptionId, String subscriptionResource2Name, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResource2Name, accept, context); + } + + /** + * Get a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource2. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionResource2Inner get(String subscriptionId, String subscriptionResource2Name) { + return getWithResponse(subscriptionId, subscriptionResource2Name, Context.NONE).getValue(); + } + + /** + * Create a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync(String subscriptionId, + String subscriptionResource2Name, SubscriptionResource2Inner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResource2Name, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync(String subscriptionId, String subscriptionResource2Name, + SubscriptionResource2Inner resource) { + return putWithResponseAsync(subscriptionId, subscriptionResource2Name, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(String subscriptionId, String subscriptionResource2Name, + SubscriptionResource2Inner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResource2Name, contentType, accept, resource, context); + } + + /** + * Create a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionResource2Inner put(String subscriptionId, String subscriptionResource2Name, + SubscriptionResource2Inner resource) { + return putWithResponse(subscriptionId, subscriptionResource2Name, resource, Context.NONE).getValue(); + } + + /** + * Delete a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String subscriptionId, String subscriptionResource2Name) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + subscriptionId, subscriptionResource2Name, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String subscriptionId, String subscriptionResource2Name) { + return deleteWithResponseAsync(subscriptionId, subscriptionResource2Name).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String subscriptionId, String subscriptionResource2Name, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), subscriptionId, + subscriptionResource2Name, context); + } + + /** + * Delete a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String subscriptionId, String subscriptionResource2Name) { + deleteWithResponse(subscriptionId, subscriptionResource2Name, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl.java new file mode 100644 index 00000000000..53407392904 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation; + +import azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient; +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2; +import azure.resourcemanager.methodsubscriptionid.models.TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl + implements TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations { + private static final ClientLogger LOGGER + = new ClientLogger(TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl.class); + + private final TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient innerClient; + + private final azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager; + + public TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl( + TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient innerClient, + azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String subscriptionId, String subscriptionResource2Name, + Context context) { + Response inner + = this.serviceClient().getWithResponse(subscriptionId, subscriptionResource2Name, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SubscriptionResource2Impl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SubscriptionResource2 get(String subscriptionId, String subscriptionResource2Name) { + SubscriptionResource2Inner inner = this.serviceClient().get(subscriptionId, subscriptionResource2Name); + if (inner != null) { + return new SubscriptionResource2Impl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String subscriptionId, String subscriptionResource2Name, + Context context) { + return this.serviceClient().deleteWithResponse(subscriptionId, subscriptionResource2Name, context); + } + + public void deleteByResourceGroup(String subscriptionId, String subscriptionResource2Name) { + this.serviceClient().delete(subscriptionId, subscriptionResource2Name); + } + + public SubscriptionResource2 getById(String id) { + String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String subscriptionResource2Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource2s"); + if (subscriptionResource2Name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource2s'.", id))); + } + return this.getWithResponse(subscriptionId, subscriptionResource2Name, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String subscriptionResource2Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource2s"); + if (subscriptionResource2Name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource2s'.", id))); + } + return this.getWithResponse(subscriptionId, subscriptionResource2Name, context); + } + + public void deleteById(String id) { + String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String subscriptionResource2Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource2s"); + if (subscriptionResource2Name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource2s'.", id))); + } + this.deleteByResourceGroupWithResponse(subscriptionId, subscriptionResource2Name, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String subscriptionId = ResourceManagerUtils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String subscriptionResource2Name = ResourceManagerUtils.getValueFromIdByName(id, "subscriptionResource2s"); + if (subscriptionResource2Name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'subscriptionResource2s'.", id))); + } + return this.deleteByResourceGroupWithResponse(subscriptionId, subscriptionResource2Name, context); + } + + private TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.methodsubscriptionid.MethodSubscriptionIdManager manager() { + return this.serviceManager; + } + + public SubscriptionResource2Impl define(String name) { + return new SubscriptionResource2Impl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/models/OperationListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/models/OperationListResult.java new file mode 100644 index 00000000000..93b37969e00 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.implementation.models; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/package-info.java new file mode 100644 index 00000000000..ea20becfb7a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for MethodSubscriptionId. + * Test for ARM method level subscription ID parameter placement. + */ +package azure.resourcemanager.methodsubscriptionid.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ActionType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ActionType.java new file mode 100644 index 00000000000..dc30ca05366 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementResourceGroupResourceOperations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementResourceGroupResourceOperations.java new file mode 100644 index 00000000000..fe0cec369c1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementResourceGroupResourceOperations.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of MixedSubscriptionPlacementResourceGroupResourceOperations. + */ +public interface MixedSubscriptionPlacementResourceGroupResourceOperations { + /** + * Get a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ResourceGroupResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String resourceGroupResourceName, Context context); + + /** + * Get a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ResourceGroupResource. + */ + ResourceGroupResource getByResourceGroup(String resourceGroupName, String resourceGroupResourceName); + + /** + * Delete a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String resourceGroupResourceName, + Context context); + + /** + * Delete a ResourceGroupResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceGroupResourceName The name of the ResourceGroupResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String resourceGroupResourceName); + + /** + * Get a ResourceGroupResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ResourceGroupResource along with {@link Response}. + */ + ResourceGroupResource getById(String id); + + /** + * Get a ResourceGroupResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ResourceGroupResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a ResourceGroupResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a ResourceGroupResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ResourceGroupResource resource. + * + * @param name resource name. + * @return the first stage of the new ResourceGroupResource definition. + */ + ResourceGroupResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementSubscriptionResourceOperations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementSubscriptionResourceOperations.java new file mode 100644 index 00000000000..a694d5353f1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementSubscriptionResourceOperations.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of MixedSubscriptionPlacementSubscriptionResourceOperations. + */ +public interface MixedSubscriptionPlacementSubscriptionResourceOperations { + /** + * Get a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource along with {@link Response}. + */ + Response getWithResponse(String subscriptionId, String subscriptionResourceName, + Context context); + + /** + * Get a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource. + */ + SubscriptionResource get(String subscriptionId, String subscriptionResourceName); + + /** + * Delete a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String subscriptionId, String subscriptionResourceName, + Context context); + + /** + * Delete a SubscriptionResource. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResourceName The name of the SubscriptionResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String subscriptionId, String subscriptionResourceName); + + /** + * Get a SubscriptionResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource along with {@link Response}. + */ + SubscriptionResource getById(String id); + + /** + * Get a SubscriptionResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a SubscriptionResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a SubscriptionResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SubscriptionResource resource. + * + * @param name resource name. + * @return the first stage of the new SubscriptionResource definition. + */ + SubscriptionResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operation.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operation.java new file mode 100644 index 00000000000..bc652f2e968 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/OperationDisplay.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/OperationDisplay.java new file mode 100644 index 00000000000..c03918c5fda --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for and operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operations.java new file mode 100644 index 00000000000..7f6fe38ee0f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Origin.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Origin.java new file mode 100644 index 00000000000..ed0b1a9a8c4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResource.java new file mode 100644 index 00000000000..21ba8253d7d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResource.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Map; + +/** + * An immutable client-side representation of ResourceGroupResource. + */ +public interface ResourceGroupResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ResourceGroupResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner object. + * + * @return the inner object. + */ + ResourceGroupResourceInner innerModel(); + + /** + * The entirety of the ResourceGroupResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The ResourceGroupResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ResourceGroupResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the ResourceGroupResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the ResourceGroupResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the ResourceGroupResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ResourceGroupResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ResourceGroupResource create(Context context); + } + + /** + * The stage of the ResourceGroupResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the ResourceGroupResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ResourceGroupResourceProperties properties); + } + } + + /** + * Begins update for the ResourceGroupResource resource. + * + * @return the stage of resource update. + */ + ResourceGroupResource.Update update(); + + /** + * The template for ResourceGroupResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ResourceGroupResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ResourceGroupResource apply(Context context); + } + + /** + * The ResourceGroupResource update stages. + */ + interface UpdateStages { + /** + * The stage of the ResourceGroupResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the ResourceGroupResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(ResourceGroupResourceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ResourceGroupResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ResourceGroupResource refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResourceProperties.java new file mode 100644 index 00000000000..02f23db62c5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResourceProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties of resource group resource. + */ +@Fluent +public final class ResourceGroupResourceProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ResourceProvisioningState provisioningState; + + /* + * The resource group-scoped setting. + */ + private String resourceGroupSetting; + + /** + * Creates an instance of ResourceGroupResourceProperties class. + */ + public ResourceGroupResourceProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the resourceGroupSetting property: The resource group-scoped setting. + * + * @return the resourceGroupSetting value. + */ + public String resourceGroupSetting() { + return this.resourceGroupSetting; + } + + /** + * Set the resourceGroupSetting property: The resource group-scoped setting. + * + * @param resourceGroupSetting the resourceGroupSetting value to set. + * @return the ResourceGroupResourceProperties object itself. + */ + public ResourceGroupResourceProperties withResourceGroupSetting(String resourceGroupSetting) { + this.resourceGroupSetting = resourceGroupSetting; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceGroupSetting", this.resourceGroupSetting); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceGroupResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceGroupResourceProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceGroupResourceProperties. + */ + public static ResourceGroupResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceGroupResourceProperties deserializedResourceGroupResourceProperties + = new ResourceGroupResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedResourceGroupResourceProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else if ("resourceGroupSetting".equals(fieldName)) { + deserializedResourceGroupResourceProperties.resourceGroupSetting = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceGroupResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceProvisioningState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceProvisioningState.java new file mode 100644 index 00000000000..1885b2f593f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceProvisioningState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of a resource type. + */ +public final class ResourceProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ResourceProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ResourceProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ResourceProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ResourceProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceProvisioningState() { + } + + /** + * Creates or finds a ResourceProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceProvisioningState. + */ + public static ResourceProvisioningState fromString(String name) { + return fromString(name, ResourceProvisioningState.class); + } + + /** + * Gets known ResourceProvisioningState values. + * + * @return known ResourceProvisioningState values. + */ + public static Collection values() { + return values(ResourceProvisioningState.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource.java new file mode 100644 index 00000000000..7850a9e1e31 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; + +/** + * An immutable client-side representation of SubscriptionResource. + */ +public interface SubscriptionResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + SubscriptionResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner object. + * + * @return the inner object. + */ + SubscriptionResourceInner innerModel(); + + /** + * The entirety of the SubscriptionResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * The SubscriptionResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SubscriptionResource definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the SubscriptionResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + SubscriptionResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SubscriptionResource create(Context context); + } + + /** + * The stage of the SubscriptionResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(SubscriptionResourceProperties properties); + } + } + + /** + * Begins update for the SubscriptionResource resource. + * + * @return the stage of resource update. + */ + SubscriptionResource.Update update(); + + /** + * The template for SubscriptionResource update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SubscriptionResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SubscriptionResource apply(Context context); + } + + /** + * The SubscriptionResource update stages. + */ + interface UpdateStages { + /** + * The stage of the SubscriptionResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(SubscriptionResourceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SubscriptionResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SubscriptionResource refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1.java new file mode 100644 index 00000000000..d3deed1893f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; + +/** + * An immutable client-side representation of SubscriptionResource1. + */ +public interface SubscriptionResource1 { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + SubscriptionResource1Properties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner object. + * + * @return the inner object. + */ + SubscriptionResource1Inner innerModel(); + + /** + * The entirety of the SubscriptionResource1 definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * The SubscriptionResource1 definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SubscriptionResource1 definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the SubscriptionResource1 definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + SubscriptionResource1 create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SubscriptionResource1 create(Context context); + } + + /** + * The stage of the SubscriptionResource1 definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(SubscriptionResource1Properties properties); + } + } + + /** + * Begins update for the SubscriptionResource1 resource. + * + * @return the stage of resource update. + */ + SubscriptionResource1.Update update(); + + /** + * The template for SubscriptionResource1 update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SubscriptionResource1 apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SubscriptionResource1 apply(Context context); + } + + /** + * The SubscriptionResource1 update stages. + */ + interface UpdateStages { + /** + * The stage of the SubscriptionResource1 update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(SubscriptionResource1Properties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SubscriptionResource1 refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SubscriptionResource1 refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1Properties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1Properties.java new file mode 100644 index 00000000000..30fb94fa155 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1Properties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties of subscription resource 1. + */ +@Fluent +public final class SubscriptionResource1Properties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ResourceProvisioningState provisioningState; + + /* + * The description of the resource. + */ + private String description; + + /** + * Creates an instance of SubscriptionResource1Properties class. + */ + public SubscriptionResource1Properties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the description property: The description of the resource. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the resource. + * + * @param description the description value to set. + * @return the SubscriptionResource1Properties object itself. + */ + public SubscriptionResource1Properties withDescription(String description) { + this.description = description; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubscriptionResource1Properties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubscriptionResource1Properties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SubscriptionResource1Properties. + */ + public static SubscriptionResource1Properties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubscriptionResource1Properties deserializedSubscriptionResource1Properties + = new SubscriptionResource1Properties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedSubscriptionResource1Properties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedSubscriptionResource1Properties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSubscriptionResource1Properties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2.java new file mode 100644 index 00000000000..1eceb96e79b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; + +/** + * An immutable client-side representation of SubscriptionResource2. + */ +public interface SubscriptionResource2 { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + SubscriptionResource2Properties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner object. + * + * @return the inner object. + */ + SubscriptionResource2Inner innerModel(); + + /** + * The entirety of the SubscriptionResource2 definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * The SubscriptionResource2 definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SubscriptionResource2 definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the SubscriptionResource2 definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + SubscriptionResource2 create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SubscriptionResource2 create(Context context); + } + + /** + * The stage of the SubscriptionResource2 definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(SubscriptionResource2Properties properties); + } + } + + /** + * Begins update for the SubscriptionResource2 resource. + * + * @return the stage of resource update. + */ + SubscriptionResource2.Update update(); + + /** + * The template for SubscriptionResource2 update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SubscriptionResource2 apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SubscriptionResource2 apply(Context context); + } + + /** + * The SubscriptionResource2 update stages. + */ + interface UpdateStages { + /** + * The stage of the SubscriptionResource2 update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(SubscriptionResource2Properties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SubscriptionResource2 refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SubscriptionResource2 refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2Properties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2Properties.java new file mode 100644 index 00000000000..b5b02bd53df --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2Properties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties of subscription resource 2. + */ +@Fluent +public final class SubscriptionResource2Properties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ResourceProvisioningState provisioningState; + + /* + * The configuration value. + */ + private String configValue; + + /** + * Creates an instance of SubscriptionResource2Properties class. + */ + public SubscriptionResource2Properties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the configValue property: The configuration value. + * + * @return the configValue value. + */ + public String configValue() { + return this.configValue; + } + + /** + * Set the configValue property: The configuration value. + * + * @param configValue the configValue value to set. + * @return the SubscriptionResource2Properties object itself. + */ + public SubscriptionResource2Properties withConfigValue(String configValue) { + this.configValue = configValue; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("configValue", this.configValue); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubscriptionResource2Properties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubscriptionResource2Properties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SubscriptionResource2Properties. + */ + public static SubscriptionResource2Properties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubscriptionResource2Properties deserializedSubscriptionResource2Properties + = new SubscriptionResource2Properties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedSubscriptionResource2Properties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else if ("configValue".equals(fieldName)) { + deserializedSubscriptionResource2Properties.configValue = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSubscriptionResource2Properties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResourceProperties.java new file mode 100644 index 00000000000..74042f35bde --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResourceProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties of subscription resource. + */ +@Fluent +public final class SubscriptionResourceProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ResourceProvisioningState provisioningState; + + /* + * The subscription-scoped setting. + */ + private String subscriptionSetting; + + /** + * Creates an instance of SubscriptionResourceProperties class. + */ + public SubscriptionResourceProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the subscriptionSetting property: The subscription-scoped setting. + * + * @return the subscriptionSetting value. + */ + public String subscriptionSetting() { + return this.subscriptionSetting; + } + + /** + * Set the subscriptionSetting property: The subscription-scoped setting. + * + * @param subscriptionSetting the subscriptionSetting value to set. + * @return the SubscriptionResourceProperties object itself. + */ + public SubscriptionResourceProperties withSubscriptionSetting(String subscriptionSetting) { + this.subscriptionSetting = subscriptionSetting; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("subscriptionSetting", this.subscriptionSetting); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubscriptionResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubscriptionResourceProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SubscriptionResourceProperties. + */ + public static SubscriptionResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubscriptionResourceProperties deserializedSubscriptionResourceProperties + = new SubscriptionResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedSubscriptionResourceProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else if ("subscriptionSetting".equals(fieldName)) { + deserializedSubscriptionResourceProperties.subscriptionSetting = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSubscriptionResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations.java new file mode 100644 index 00000000000..d0076c164b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations. + */ +public interface TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations { + /** + * Get a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource1 along with {@link Response}. + */ + Response getWithResponse(String subscriptionId, String subscriptionResource1Name, + Context context); + + /** + * Get a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource1. + */ + SubscriptionResource1 get(String subscriptionId, String subscriptionResource1Name); + + /** + * Delete a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String subscriptionId, String subscriptionResource1Name, + Context context); + + /** + * Delete a SubscriptionResource1. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource1Name The name of the SubscriptionResource1. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String subscriptionId, String subscriptionResource1Name); + + /** + * Get a SubscriptionResource1. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource1 along with {@link Response}. + */ + SubscriptionResource1 getById(String id); + + /** + * Get a SubscriptionResource1. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource1 along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a SubscriptionResource1. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a SubscriptionResource1. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SubscriptionResource1 resource. + * + * @param name resource name. + * @return the first stage of the new SubscriptionResource1 definition. + */ + SubscriptionResource1.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations.java new file mode 100644 index 00000000000..f9ea1bf9785 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations. + */ +public interface TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations { + /** + * Get a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource2 along with {@link Response}. + */ + Response getWithResponse(String subscriptionId, String subscriptionResource2Name, + Context context); + + /** + * Get a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource2. + */ + SubscriptionResource2 get(String subscriptionId, String subscriptionResource2Name); + + /** + * Delete a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String subscriptionId, String subscriptionResource2Name, + Context context); + + /** + * Delete a SubscriptionResource2. + * + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param subscriptionResource2Name The name of the SubscriptionResource2. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String subscriptionId, String subscriptionResource2Name); + + /** + * Get a SubscriptionResource2. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource2 along with {@link Response}. + */ + SubscriptionResource2 getById(String id); + + /** + * Get a SubscriptionResource2. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SubscriptionResource2 along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a SubscriptionResource2. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a SubscriptionResource2. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SubscriptionResource2 resource. + * + * @param name resource name. + * @return the first stage of the new SubscriptionResource2 definition. + */ + SubscriptionResource2.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/package-info.java new file mode 100644 index 00000000000..c00a72b8e8e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for MethodSubscriptionId. + * Test for ARM method level subscription ID parameter placement. + */ +package azure.resourcemanager.methodsubscriptionid.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/package-info.java new file mode 100644 index 00000000000..a8244d1c741 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/methodsubscriptionid/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for MethodSubscriptionId. + * Test for ARM method level subscription ID parameter placement. + */ +package azure.resourcemanager.methodsubscriptionid; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/CombinedManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/CombinedManager.java new file mode 100644 index 00000000000..ba46e7c64d5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/CombinedManager.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined; + +import azure.resourcemanager.multiservice.combined.fluent.Combined; +import azure.resourcemanager.multiservice.combined.implementation.CombinedBuilder; +import azure.resourcemanager.multiservice.combined.implementation.DisksImpl; +import azure.resourcemanager.multiservice.combined.implementation.VirtualMachinesImpl; +import azure.resourcemanager.multiservice.combined.models.Disks; +import azure.resourcemanager.multiservice.combined.models.VirtualMachines; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to CombinedManager. + * Compute Client. + */ +public final class CombinedManager { + private VirtualMachines virtualMachines; + + private Disks disks; + + private final Combined clientObject; + + private CombinedManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new CombinedBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of combined service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the combined service API instance. + */ + public static CombinedManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of combined service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the combined service API instance. + */ + public static CombinedManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new CombinedManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create CombinedManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new CombinedManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-combined-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of combined service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the combined service API instance. + */ + public CombinedManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("azure.resourcemanager.multiservice.combined") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new CombinedManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of VirtualMachines. It manages VirtualMachine. + * + * @return Resource collection API of VirtualMachines. + */ + public VirtualMachines virtualMachines() { + if (this.virtualMachines == null) { + this.virtualMachines = new VirtualMachinesImpl(clientObject.getVirtualMachines(), this); + } + return virtualMachines; + } + + /** + * Gets the resource collection API of Disks. It manages Disk. + * + * @return Resource collection API of Disks. + */ + public Disks disks() { + if (this.disks == null) { + this.disks = new DisksImpl(clientObject.getDisks(), this); + } + return disks; + } + + /** + * Gets wrapped service client Combined providing direct access to the underlying auto-generated API implementation, + * based on Azure REST API. + * + * @return Wrapped service client Combined. + */ + public Combined serviceClient() { + return this.clientObject; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/Combined.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/Combined.java new file mode 100644 index 00000000000..2cca6a21a4a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/Combined.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for Combined class. + */ +public interface Combined { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the VirtualMachinesClient object to access its operations. + * + * @return the VirtualMachinesClient object. + */ + VirtualMachinesClient getVirtualMachines(); + + /** + * Gets the DisksClient object to access its operations. + * + * @return the DisksClient object. + */ + DisksClient getDisks(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/DisksClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/DisksClient.java new file mode 100644 index 00000000000..0abf504509d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/DisksClient.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.fluent; + +import azure.resourcemanager.multiservice.combined.fluent.models.DiskInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; + +/** + * An instance of this class provides access to all the operations defined in DisksClient. + */ +public interface DisksClient { + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String diskName, Context context); + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskInner getByResourceGroup(String resourceGroupName, String diskName); + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of disk resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskInner> beginCreateOrUpdate(String resourceGroupName, String diskName, + DiskInner resource); + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of disk resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskInner> beginCreateOrUpdate(String resourceGroupName, String diskName, + DiskInner resource, Context context); + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner resource); + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner resource, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/VirtualMachinesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/VirtualMachinesClient.java new file mode 100644 index 00000000000..7f05b08e0bb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/VirtualMachinesClient.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.fluent; + +import azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; + +/** + * An instance of this class provides access to all the operations defined in VirtualMachinesClient. + */ +public interface VirtualMachinesClient { + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String vmName, + Context context); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner getByResourceGroup(String resourceGroupName, String vmName); + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginCreateOrUpdate(String resourceGroupName, + String vmName, VirtualMachineInner resource); + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInner> beginCreateOrUpdate(String resourceGroupName, + String vmName, VirtualMachineInner resource, Context context); + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner createOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner resource); + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInner createOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner resource, + Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/DiskInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/DiskInner.java new file mode 100644 index 00000000000..7a464f689ed --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/DiskInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.fluent.models; + +import azure.resourcemanager.multiservice.combined.models.DiskProperties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Disk resource. + */ +@Fluent +public final class DiskInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private DiskProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DiskInner class. + */ + public DiskInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public DiskProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the DiskInner object itself. + */ + public DiskInner withProperties(DiskProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public DiskInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DiskInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiskInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiskInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiskInner. + */ + public static DiskInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiskInner deserializedDiskInner = new DiskInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDiskInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDiskInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDiskInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDiskInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDiskInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedDiskInner.properties = DiskProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDiskInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDiskInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/VirtualMachineInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/VirtualMachineInner.java new file mode 100644 index 00000000000..ecb75d37263 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/VirtualMachineInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.fluent.models; + +import azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Describes a Virtual Machine. + */ +@Fluent +public final class VirtualMachineInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private VirtualMachineProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of VirtualMachineInner class. + */ + public VirtualMachineInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public VirtualMachineProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the VirtualMachineInner object itself. + */ + public VirtualMachineInner withProperties(VirtualMachineProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public VirtualMachineInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VirtualMachineInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VirtualMachineInner. + */ + public static VirtualMachineInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInner deserializedVirtualMachineInner = new VirtualMachineInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedVirtualMachineInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedVirtualMachineInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedVirtualMachineInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedVirtualMachineInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedVirtualMachineInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedVirtualMachineInner.properties = VirtualMachineProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedVirtualMachineInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/package-info.java new file mode 100644 index 00000000000..a418da6f4ef --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for Compute. + * Compute Client. + */ +package azure.resourcemanager.multiservice.combined.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/package-info.java new file mode 100644 index 00000000000..b51da8a120d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for Compute. + * Compute Client. + */ +package azure.resourcemanager.multiservice.combined.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedBuilder.java new file mode 100644 index 00000000000..77d2d288003 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the CombinedImpl type. + */ +@ServiceClientBuilder(serviceClients = { CombinedImpl.class }) +public final class CombinedBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the CombinedBuilder. + */ + public CombinedBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the CombinedBuilder. + */ + public CombinedBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the CombinedBuilder. + */ + public CombinedBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 CombinedBuilder. + */ + public CombinedBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the CombinedBuilder. + */ + public CombinedBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 CombinedBuilder. + */ + public CombinedBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of CombinedImpl with the provided parameters. + * + * @return an instance of CombinedImpl. + */ + public CombinedImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + CombinedImpl client = new CombinedImpl(localPipeline, localSerializerAdapter, localDefaultPollInterval, + localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedImpl.java new file mode 100644 index 00000000000..3082d51ed39 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedImpl.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.implementation; + +import azure.resourcemanager.multiservice.combined.fluent.Combined; +import azure.resourcemanager.multiservice.combined.fluent.DisksClient; +import azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the CombinedImpl type. + */ +@ServiceClient(builder = CombinedBuilder.class) +public final class CombinedImpl implements Combined { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The VirtualMachinesClient object to access its operations. + */ + private final VirtualMachinesClient virtualMachines; + + /** + * Gets the VirtualMachinesClient object to access its operations. + * + * @return the VirtualMachinesClient object. + */ + public VirtualMachinesClient getVirtualMachines() { + return this.virtualMachines; + } + + /** + * The DisksClient object to access its operations. + */ + private final DisksClient disks; + + /** + * Gets the DisksClient object to access its operations. + * + * @return the DisksClient object. + */ + public DisksClient getDisks() { + return this.disks; + } + + /** + * Initializes an instance of Combined client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + CombinedImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.virtualMachines = new VirtualMachinesClientImpl(this); + this.disks = new DisksClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CombinedImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DiskImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DiskImpl.java new file mode 100644 index 00000000000..a2602710bbb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DiskImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.implementation; + +import azure.resourcemanager.multiservice.combined.fluent.models.DiskInner; +import azure.resourcemanager.multiservice.combined.models.Disk; +import azure.resourcemanager.multiservice.combined.models.DiskProperties; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Collections; +import java.util.Map; + +public final class DiskImpl implements Disk, Disk.Definition, Disk.Update { + private DiskInner innerObject; + + private final azure.resourcemanager.multiservice.combined.CombinedManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public DiskProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DiskInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.multiservice.combined.CombinedManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String diskName; + + public DiskImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Disk create() { + this.innerObject = serviceManager.serviceClient() + .getDisks() + .createOrUpdate(resourceGroupName, diskName, this.innerModel(), Context.NONE); + return this; + } + + public Disk create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDisks() + .createOrUpdate(resourceGroupName, diskName, this.innerModel(), context); + return this; + } + + DiskImpl(String name, azure.resourcemanager.multiservice.combined.CombinedManager serviceManager) { + this.innerObject = new DiskInner(); + this.serviceManager = serviceManager; + this.diskName = name; + } + + public DiskImpl update() { + return this; + } + + public Disk apply() { + this.innerObject = serviceManager.serviceClient() + .getDisks() + .createOrUpdate(resourceGroupName, diskName, this.innerModel(), Context.NONE); + return this; + } + + public Disk apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDisks() + .createOrUpdate(resourceGroupName, diskName, this.innerModel(), context); + return this; + } + + DiskImpl(DiskInner innerObject, azure.resourcemanager.multiservice.combined.CombinedManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.diskName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "disks"); + } + + public Disk refresh() { + this.innerObject = serviceManager.serviceClient() + .getDisks() + .getByResourceGroupWithResponse(resourceGroupName, diskName, Context.NONE) + .getValue(); + return this; + } + + public Disk refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDisks() + .getByResourceGroupWithResponse(resourceGroupName, diskName, context) + .getValue(); + return this; + } + + public DiskImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DiskImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DiskImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public DiskImpl withProperties(DiskProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksClientImpl.java new file mode 100644 index 00000000000..163e986aa13 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksClientImpl.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.implementation; + +import azure.resourcemanager.multiservice.combined.fluent.DisksClient; +import azure.resourcemanager.multiservice.combined.fluent.models.DiskInner; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DisksClient. + */ +public final class DisksClientImpl implements DisksClient { + /** + * The proxy service used to perform REST calls. + */ + private final DisksService service; + + /** + * The service client containing this operation class. + */ + private final CombinedImpl client; + + /** + * Initializes an instance of DisksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DisksClientImpl(CombinedImpl client) { + this.service = RestProxy.create(DisksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CombinedDisks to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CombinedDisks") + public interface DisksService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DiskInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DiskInner resource, Context context); + } + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String diskName) { + final String apiVersion = "2025-01-02"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, diskName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String diskName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, diskName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String diskName, + Context context) { + final String apiVersion = "2025-01-02"; + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, diskName, accept, context); + } + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskInner getByResourceGroup(String resourceGroupName, String diskName) { + return getByResourceGroupWithResponse(resourceGroupName, diskName, Context.NONE).getValue(); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String diskName, + DiskInner resource) { + final String apiVersion = "2025-01-02"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, diskName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String diskName, + DiskInner resource) { + final String apiVersion = "2025-01-02"; + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, diskName, contentType, accept, resource, Context.NONE); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String diskName, + DiskInner resource, Context context) { + final String apiVersion = "2025-01-02"; + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, diskName, contentType, accept, resource, context); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of disk resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskInner> beginCreateOrUpdateAsync(String resourceGroupName, + String diskName, DiskInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, diskName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), DiskInner.class, + DiskInner.class, this.client.getContext()); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of disk resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskInner> beginCreateOrUpdate(String resourceGroupName, String diskName, + DiskInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, diskName, resource); + return this.client.getLroResult(response, DiskInner.class, DiskInner.class, Context.NONE); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of disk resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskInner> beginCreateOrUpdate(String resourceGroupName, String diskName, + DiskInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, diskName, resource, context); + return this.client.getLroResult(response, DiskInner.class, DiskInner.class, context); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String diskName, DiskInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, diskName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner resource) { + return beginCreateOrUpdate(resourceGroupName, diskName, resource).getFinalResult(); + } + + /** + * Creates or updates a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, diskName, resource, context).getFinalResult(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksImpl.java new file mode 100644 index 00000000000..dc239f5146c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.implementation; + +import azure.resourcemanager.multiservice.combined.fluent.DisksClient; +import azure.resourcemanager.multiservice.combined.fluent.models.DiskInner; +import azure.resourcemanager.multiservice.combined.models.Disk; +import azure.resourcemanager.multiservice.combined.models.Disks; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class DisksImpl implements Disks { + private static final ClientLogger LOGGER = new ClientLogger(DisksImpl.class); + + private final DisksClient innerClient; + + private final azure.resourcemanager.multiservice.combined.CombinedManager serviceManager; + + public DisksImpl(DisksClient innerClient, + azure.resourcemanager.multiservice.combined.CombinedManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String diskName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, diskName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DiskImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Disk getByResourceGroup(String resourceGroupName, String diskName) { + DiskInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, diskName); + if (inner != null) { + return new DiskImpl(inner, this.manager()); + } else { + return null; + } + } + + public Disk getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String diskName = ResourceManagerUtils.getValueFromIdByName(id, "disks"); + if (diskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'disks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, diskName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String diskName = ResourceManagerUtils.getValueFromIdByName(id, "disks"); + if (diskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'disks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, diskName, context); + } + + private DisksClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.multiservice.combined.CombinedManager manager() { + return this.serviceManager; + } + + public DiskImpl define(String name) { + return new DiskImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/ResourceManagerUtils.java new file mode 100644 index 00000000000..0c6500fe0ec --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachineImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachineImpl.java new file mode 100644 index 00000000000..c168f6217d2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachineImpl.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.implementation; + +import azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner; +import azure.resourcemanager.multiservice.combined.models.VirtualMachine; +import azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Collections; +import java.util.Map; + +public final class VirtualMachineImpl implements VirtualMachine, VirtualMachine.Definition, VirtualMachine.Update { + private VirtualMachineInner innerObject; + + private final azure.resourcemanager.multiservice.combined.CombinedManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public VirtualMachineProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public VirtualMachineInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.multiservice.combined.CombinedManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String vmName; + + public VirtualMachineImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public VirtualMachine create() { + this.innerObject = serviceManager.serviceClient() + .getVirtualMachines() + .createOrUpdate(resourceGroupName, vmName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualMachine create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getVirtualMachines() + .createOrUpdate(resourceGroupName, vmName, this.innerModel(), context); + return this; + } + + VirtualMachineImpl(String name, azure.resourcemanager.multiservice.combined.CombinedManager serviceManager) { + this.innerObject = new VirtualMachineInner(); + this.serviceManager = serviceManager; + this.vmName = name; + } + + public VirtualMachineImpl update() { + return this; + } + + public VirtualMachine apply() { + this.innerObject = serviceManager.serviceClient() + .getVirtualMachines() + .createOrUpdate(resourceGroupName, vmName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualMachine apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getVirtualMachines() + .createOrUpdate(resourceGroupName, vmName, this.innerModel(), context); + return this; + } + + VirtualMachineImpl(VirtualMachineInner innerObject, + azure.resourcemanager.multiservice.combined.CombinedManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.vmName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "virtualMachines"); + } + + public VirtualMachine refresh() { + this.innerObject = serviceManager.serviceClient() + .getVirtualMachines() + .getByResourceGroupWithResponse(resourceGroupName, vmName, Context.NONE) + .getValue(); + return this; + } + + public VirtualMachine refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getVirtualMachines() + .getByResourceGroupWithResponse(resourceGroupName, vmName, context) + .getValue(); + return this; + } + + public VirtualMachineImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VirtualMachineImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VirtualMachineImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public VirtualMachineImpl withProperties(VirtualMachineProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesClientImpl.java new file mode 100644 index 00000000000..46c32f950ab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesClientImpl.java @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.implementation; + +import azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient; +import azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in VirtualMachinesClient. + */ +public final class VirtualMachinesClientImpl implements VirtualMachinesClient { + /** + * The proxy service used to perform REST calls. + */ + private final VirtualMachinesService service; + + /** + * The service client containing this operation class. + */ + private final CombinedImpl client; + + /** + * Initializes an instance of VirtualMachinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachinesClientImpl(CombinedImpl client) { + this.service + = RestProxy.create(VirtualMachinesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CombinedVirtualMachines to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CombinedVirtualMachines") + public interface VirtualMachinesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vmName") String vmName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vmName") String vmName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vmName") String vmName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") VirtualMachineInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vmName") String vmName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") VirtualMachineInner resource, Context context); + } + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String vmName) { + final String apiVersion = "2025-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, vmName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String vmName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vmName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String vmName, + Context context) { + final String apiVersion = "2025-04-01"; + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, vmName, accept, context); + } + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner getByResourceGroup(String resourceGroupName, String vmName) { + return getByResourceGroupWithResponse(resourceGroupName, vmName, Context.NONE).getValue(); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String vmName, + VirtualMachineInner resource) { + final String apiVersion = "2025-04-01"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), apiVersion, + this.client.getSubscriptionId(), resourceGroupName, vmName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String vmName, + VirtualMachineInner resource) { + final String apiVersion = "2025-04-01"; + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, vmName, contentType, accept, resource, Context.NONE); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String vmName, + VirtualMachineInner resource, Context context) { + final String apiVersion = "2025-04-01"; + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), + resourceGroupName, vmName, contentType, accept, resource, context); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInner> + beginCreateOrUpdateAsync(String resourceGroupName, String vmName, VirtualMachineInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, vmName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + VirtualMachineInner.class, VirtualMachineInner.class, this.client.getContext()); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> + beginCreateOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, vmName, resource); + return this.client.getLroResult(response, VirtualMachineInner.class, + VirtualMachineInner.class, Context.NONE); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInner> + beginCreateOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, vmName, resource, context); + return this.client.getLroResult(response, VirtualMachineInner.class, + VirtualMachineInner.class, context); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String vmName, + VirtualMachineInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, vmName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner createOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner resource) { + return beginCreateOrUpdate(resourceGroupName, vmName, resource).getFinalResult(); + } + + /** + * The operation to create or update a virtual machine. Please note some properties can be set only during virtual + * machine creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInner createOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner resource, + Context context) { + return beginCreateOrUpdate(resourceGroupName, vmName, resource, context).getFinalResult(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesImpl.java new file mode 100644 index 00000000000..05f4cd048c2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.implementation; + +import azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient; +import azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner; +import azure.resourcemanager.multiservice.combined.models.VirtualMachine; +import azure.resourcemanager.multiservice.combined.models.VirtualMachines; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class VirtualMachinesImpl implements VirtualMachines { + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachinesImpl.class); + + private final VirtualMachinesClient innerClient; + + private final azure.resourcemanager.multiservice.combined.CombinedManager serviceManager; + + public VirtualMachinesImpl(VirtualMachinesClient innerClient, + azure.resourcemanager.multiservice.combined.CombinedManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String vmName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, vmName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new VirtualMachineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VirtualMachine getByResourceGroup(String resourceGroupName, String vmName) { + VirtualMachineInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, vmName); + if (inner != null) { + return new VirtualMachineImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachine getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String vmName = ResourceManagerUtils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, vmName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String vmName = ResourceManagerUtils.getValueFromIdByName(id, "virtualMachines"); + if (vmName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualMachines'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, vmName, context); + } + + private VirtualMachinesClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.multiservice.combined.CombinedManager manager() { + return this.serviceManager; + } + + public VirtualMachineImpl define(String name) { + return new VirtualMachineImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/package-info.java new file mode 100644 index 00000000000..09f6feb1b9f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for Compute. + * Compute Client. + */ +package azure.resourcemanager.multiservice.combined.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disk.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disk.java new file mode 100644 index 00000000000..b2ce33a9b71 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disk.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.models; + +import azure.resourcemanager.multiservice.combined.fluent.models.DiskInner; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Map; + +/** + * An immutable client-side representation of Disk. + */ +public interface Disk { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + DiskProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner azure.resourcemanager.multiservice.combined.fluent.models.DiskInner object. + * + * @return the inner object. + */ + DiskInner innerModel(); + + /** + * The entirety of the Disk definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The Disk definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Disk definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Disk definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the Disk definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the Disk definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Disk create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Disk create(Context context); + } + + /** + * The stage of the Disk definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the Disk definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(DiskProperties properties); + } + } + + /** + * Begins update for the Disk resource. + * + * @return the stage of resource update. + */ + Disk.Update update(); + + /** + * The template for Disk update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Disk apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Disk apply(Context context); + } + + /** + * The Disk update stages. + */ + interface UpdateStages { + /** + * The stage of the Disk update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the Disk update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(DiskProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Disk refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Disk refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/DiskProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/DiskProperties.java new file mode 100644 index 00000000000..14fbcecb499 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/DiskProperties.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Disk resource properties. + */ +@Immutable +public final class DiskProperties implements JsonSerializable { + /* + * The provisioningState property. + */ + private ResourceProvisioningState provisioningState; + + /** + * Creates an instance of DiskProperties class. + */ + public DiskProperties() { + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiskProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiskProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DiskProperties. + */ + public static DiskProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiskProperties deserializedDiskProperties = new DiskProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedDiskProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDiskProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disks.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disks.java new file mode 100644 index 00000000000..57b4ce0d912 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/Disks.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Disks. + */ +public interface Disks { + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String diskName, Context context); + + /** + * Gets information about a disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param diskName The name of the Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk. + */ + Disk getByResourceGroup(String resourceGroupName, String diskName); + + /** + * Gets information about a disk. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk along with {@link Response}. + */ + Disk getById(String id); + + /** + * Gets information about a disk. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a disk along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Disk resource. + * + * @param name resource name. + * @return the first stage of the new Disk definition. + */ + Disk.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/ResourceProvisioningState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/ResourceProvisioningState.java new file mode 100644 index 00000000000..22f4daccb3f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/ResourceProvisioningState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of a resource type. + */ +public final class ResourceProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ResourceProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ResourceProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ResourceProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ResourceProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceProvisioningState() { + } + + /** + * Creates or finds a ResourceProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceProvisioningState. + */ + public static ResourceProvisioningState fromString(String name) { + return fromString(name, ResourceProvisioningState.class); + } + + /** + * Gets known ResourceProvisioningState values. + * + * @return known ResourceProvisioningState values. + */ + public static Collection values() { + return values(ResourceProvisioningState.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachine.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachine.java new file mode 100644 index 00000000000..36530565907 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachine.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.models; + +import azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Map; + +/** + * An immutable client-side representation of VirtualMachine. + */ +public interface VirtualMachine { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + VirtualMachineProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner object. + * + * @return the inner object. + */ + VirtualMachineInner innerModel(); + + /** + * The entirety of the VirtualMachine definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The VirtualMachine definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the VirtualMachine definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the VirtualMachine definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the VirtualMachine definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the VirtualMachine definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualMachine create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualMachine create(Context context); + } + + /** + * The stage of the VirtualMachine definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the VirtualMachine definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(VirtualMachineProperties properties); + } + } + + /** + * Begins update for the VirtualMachine resource. + * + * @return the stage of resource update. + */ + VirtualMachine.Update update(); + + /** + * The template for VirtualMachine update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualMachine apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualMachine apply(Context context); + } + + /** + * The VirtualMachine update stages. + */ + interface UpdateStages { + /** + * The stage of the VirtualMachine update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the VirtualMachine update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(VirtualMachineProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualMachine refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualMachine refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachineProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachineProperties.java new file mode 100644 index 00000000000..d911aed030c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachineProperties.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The VirtualMachineProperties model. + */ +@Immutable +public final class VirtualMachineProperties implements JsonSerializable { + /* + * The provisioningState property. + */ + private ResourceProvisioningState provisioningState; + + /** + * Creates an instance of VirtualMachineProperties class. + */ + public VirtualMachineProperties() { + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the VirtualMachineProperties. + */ + public static VirtualMachineProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineProperties deserializedVirtualMachineProperties = new VirtualMachineProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedVirtualMachineProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachines.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachines.java new file mode 100644 index 00000000000..cee367106b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachines.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of VirtualMachines. + */ +public interface VirtualMachines { + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String vmName, Context context); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vmName The name of the VirtualMachine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine. + */ + VirtualMachine getByResourceGroup(String resourceGroupName, String vmName); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response}. + */ + VirtualMachine getById(String id); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Virtual Machine along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new VirtualMachine resource. + * + * @param name resource name. + * @return the first stage of the new VirtualMachine definition. + */ + VirtualMachine.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/package-info.java new file mode 100644 index 00000000000..39b4e2b7bcf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for Compute. + * Compute Client. + */ +package azure.resourcemanager.multiservice.combined.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/package-info.java new file mode 100644 index 00000000000..21bfd176845 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/multiservice/combined/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for Compute. + * Compute Client. + */ +package azure.resourcemanager.multiservice.combined; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/NonResourceManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/NonResourceManager.java new file mode 100644 index 00000000000..8c3b9456bac --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/NonResourceManager.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.nonresource; + +import azure.resourcemanager.nonresource.fluent.NonResourceClient; +import azure.resourcemanager.nonresource.implementation.NonResourceClientBuilder; +import azure.resourcemanager.nonresource.implementation.NonResourceOperationsImpl; +import azure.resourcemanager.nonresource.models.NonResourceOperations; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to NonResourceManager. + * Arm Resource Provider management API. + */ +public final class NonResourceManager { + private NonResourceOperations nonResourceOperations; + + private final NonResourceClient clientObject; + + private NonResourceManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new NonResourceClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of NonResource service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the NonResource service API instance. + */ + public static NonResourceManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of NonResource service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the NonResource service API instance. + */ + public static NonResourceManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new NonResourceManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create NonResourceManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new NonResourceManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-nonresource-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of NonResource service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the NonResource service API instance. + */ + public NonResourceManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("azure.resourcemanager.nonresource") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new NonResourceManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of NonResourceOperations. It manages NonResource. + * + * @return Resource collection API of NonResourceOperations. + */ + public NonResourceOperations nonResourceOperations() { + if (this.nonResourceOperations == null) { + this.nonResourceOperations = new NonResourceOperationsImpl(clientObject.getNonResourceOperations(), this); + } + return nonResourceOperations; + } + + /** + * Gets wrapped service client NonResourceClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client NonResourceClient. + */ + public NonResourceClient serviceClient() { + return this.clientObject; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceClient.java new file mode 100644 index 00000000000..33db00d223d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.nonresource.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for NonResourceClient class. + */ +public interface NonResourceClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the NonResourceOperationsClient object to access its operations. + * + * @return the NonResourceOperationsClient object. + */ + NonResourceOperationsClient getNonResourceOperations(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceOperationsClient.java new file mode 100644 index 00000000000..3a71a624631 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceOperationsClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.nonresource.fluent; + +import azure.resourcemanager.nonresource.fluent.models.NonResourceInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * An instance of this class provides access to all the operations defined in NonResourceOperationsClient. + */ +public interface NonResourceOperationsClient { + /** + * The get operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource` along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String parameter, Context context); + + /** + * The get operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource`. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NonResourceInner get(String location, String parameter); + + /** + * The create operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource` along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String location, String parameter, NonResourceInner body, + Context context); + + /** + * The create operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource`. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NonResourceInner create(String location, String parameter, NonResourceInner body); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/NonResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/NonResourceInner.java new file mode 100644 index 00000000000..8c5de1fb522 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/NonResourceInner.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.nonresource.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends `Resource`. + */ +@Fluent +public final class NonResourceInner implements JsonSerializable { + /* + * An id. + */ + private String id; + + /* + * A name. + */ + private String name; + + /* + * A type. + */ + private String type; + + /** + * Creates an instance of NonResourceInner class. + */ + public NonResourceInner() { + } + + /** + * Get the id property: An id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: An id. + * + * @param id the id value to set. + * @return the NonResourceInner object itself. + */ + public NonResourceInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: A name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A name. + * + * @param name the name value to set. + * @return the NonResourceInner object itself. + */ + public NonResourceInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: A type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: A type. + * + * @param type the type value to set. + * @return the NonResourceInner object itself. + */ + public NonResourceInner withType(String type) { + this.type = type; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NonResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NonResourceInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the NonResourceInner. + */ + public static NonResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NonResourceInner deserializedNonResourceInner = new NonResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNonResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNonResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNonResourceInner.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNonResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/package-info.java new file mode 100644 index 00000000000..1b0f8b6dfc9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for NonResourceManagementClient. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.nonresource.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/package-info.java new file mode 100644 index 00000000000..f2fde364870 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for NonResourceManagementClient. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.nonresource.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientBuilder.java new file mode 100644 index 00000000000..69351f4aa18 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.nonresource.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the NonResourceClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { NonResourceClientImpl.class }) +public final class NonResourceClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the NonResourceClientBuilder. + */ + public NonResourceClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the NonResourceClientBuilder. + */ + public NonResourceClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the NonResourceClientBuilder. + */ + public NonResourceClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 NonResourceClientBuilder. + */ + public NonResourceClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the NonResourceClientBuilder. + */ + public NonResourceClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 NonResourceClientBuilder. + */ + public NonResourceClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of NonResourceClientImpl with the provided parameters. + * + * @return an instance of NonResourceClientImpl. + */ + public NonResourceClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + NonResourceClientImpl client = new NonResourceClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientImpl.java new file mode 100644 index 00000000000..01a8142ee74 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientImpl.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.nonresource.implementation; + +import azure.resourcemanager.nonresource.fluent.NonResourceClient; +import azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the NonResourceClientImpl type. + */ +@ServiceClient(builder = NonResourceClientBuilder.class) +public final class NonResourceClientImpl implements NonResourceClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The NonResourceOperationsClient object to access its operations. + */ + private final NonResourceOperationsClient nonResourceOperations; + + /** + * Gets the NonResourceOperationsClient object to access its operations. + * + * @return the NonResourceOperationsClient object. + */ + public NonResourceOperationsClient getNonResourceOperations() { + return this.nonResourceOperations; + } + + /** + * Initializes an instance of NonResourceClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + NonResourceClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2023-12-01-preview"; + this.nonResourceOperations = new NonResourceOperationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NonResourceClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceImpl.java new file mode 100644 index 00000000000..61e3cb878e0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceImpl.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.nonresource.implementation; + +import azure.resourcemanager.nonresource.fluent.models.NonResourceInner; +import azure.resourcemanager.nonresource.models.NonResource; +import com.azure.core.util.Context; + +public final class NonResourceImpl implements NonResource, NonResource.Definition { + private NonResourceInner innerObject; + + private final azure.resourcemanager.nonresource.NonResourceManager serviceManager; + + NonResourceImpl(NonResourceInner innerObject, azure.resourcemanager.nonresource.NonResourceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public NonResourceInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.nonresource.NonResourceManager manager() { + return this.serviceManager; + } + + private String location; + + private String parameter; + + public NonResourceImpl withExistingLocation(String location) { + this.location = location; + return this; + } + + public NonResource create() { + this.innerObject = serviceManager.serviceClient() + .getNonResourceOperations() + .createWithResponse(location, parameter, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public NonResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNonResourceOperations() + .createWithResponse(location, parameter, this.innerModel(), context) + .getValue(); + return this; + } + + NonResourceImpl(String name, azure.resourcemanager.nonresource.NonResourceManager serviceManager) { + this.innerObject = new NonResourceInner(); + this.serviceManager = serviceManager; + this.parameter = name; + } + + public NonResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getNonResourceOperations() + .getWithResponse(location, parameter, Context.NONE) + .getValue(); + return this; + } + + public NonResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNonResourceOperations() + .getWithResponse(location, parameter, context) + .getValue(); + return this; + } + + public NonResourceImpl withName(String name) { + this.innerModel().withName(name); + return this; + } + + public NonResourceImpl withType(String type) { + this.innerModel().withType(type); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsClientImpl.java new file mode 100644 index 00000000000..3b7cf615f3c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsClientImpl.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.nonresource.implementation; + +import azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient; +import azure.resourcemanager.nonresource.fluent.models.NonResourceInner; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NonResourceOperationsClient. + */ +public final class NonResourceOperationsClientImpl implements NonResourceOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final NonResourceOperationsService service; + + /** + * The service client containing this operation class. + */ + private final NonResourceClientImpl client; + + /** + * Initializes an instance of NonResourceOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NonResourceOperationsClientImpl(NonResourceClientImpl client) { + this.service = RestProxy.create(NonResourceOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NonResourceClientNonResourceOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NonResourceClientNonResourceOperations") + public interface NonResourceOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.NonResource/locations/{location}/otherParameters/{parameter}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("parameter") String parameter, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.NonResource/locations/{location}/otherParameters/{parameter}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("parameter") String parameter, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.NonResource/locations/{location}/otherParameters/{parameter}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("parameter") String parameter, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NonResourceInner body, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.NonResource/locations/{location}/otherParameters/{parameter}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("parameter") String parameter, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NonResourceInner body, Context context); + } + + /** + * The get operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource` along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String parameter) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, parameter, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The get operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource` on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String parameter) { + return getWithResponseAsync(location, parameter).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The get operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource` along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String parameter, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + location, parameter, accept, context); + } + + /** + * The get operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource`. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NonResourceInner get(String location, String parameter) { + return getWithResponse(location, parameter, Context.NONE).getValue(); + } + + /** + * The create operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource` along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String location, String parameter, + NonResourceInner body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, parameter, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The create operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource` on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String location, String parameter, NonResourceInner body) { + return createWithResponseAsync(location, parameter, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The create operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource` along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String location, String parameter, NonResourceInner body, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, parameter, contentType, accept, body, context); + } + + /** + * The create operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource`. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NonResourceInner create(String location, String parameter, NonResourceInner body) { + return createWithResponse(location, parameter, body, Context.NONE).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsImpl.java new file mode 100644 index 00000000000..53db37891f7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsImpl.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.nonresource.implementation; + +import azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient; +import azure.resourcemanager.nonresource.fluent.models.NonResourceInner; +import azure.resourcemanager.nonresource.models.NonResource; +import azure.resourcemanager.nonresource.models.NonResourceOperations; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class NonResourceOperationsImpl implements NonResourceOperations { + private static final ClientLogger LOGGER = new ClientLogger(NonResourceOperationsImpl.class); + + private final NonResourceOperationsClient innerClient; + + private final azure.resourcemanager.nonresource.NonResourceManager serviceManager; + + public NonResourceOperationsImpl(NonResourceOperationsClient innerClient, + azure.resourcemanager.nonresource.NonResourceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String location, String parameter, Context context) { + Response inner = this.serviceClient().getWithResponse(location, parameter, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new NonResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public NonResource get(String location, String parameter) { + NonResourceInner inner = this.serviceClient().get(location, parameter); + if (inner != null) { + return new NonResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public NonResource getById(String id) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String parameter = ResourceManagerUtils.getValueFromIdByName(id, "otherParameters"); + if (parameter == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'otherParameters'.", id))); + } + return this.getWithResponse(location, parameter, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String parameter = ResourceManagerUtils.getValueFromIdByName(id, "otherParameters"); + if (parameter == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'otherParameters'.", id))); + } + return this.getWithResponse(location, parameter, context); + } + + private NonResourceOperationsClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.nonresource.NonResourceManager manager() { + return this.serviceManager; + } + + public NonResourceImpl define(String name) { + return new NonResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/ResourceManagerUtils.java new file mode 100644 index 00000000000..c971258f5ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.nonresource.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/package-info.java new file mode 100644 index 00000000000..b2a8c37b109 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for NonResourceManagementClient. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.nonresource.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResource.java new file mode 100644 index 00000000000..80c59f8c1ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResource.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.nonresource.models; + +import azure.resourcemanager.nonresource.fluent.models.NonResourceInner; +import com.azure.core.util.Context; + +/** + * An immutable client-side representation of NonResource. + */ +public interface NonResource { + /** + * Gets the id property: An id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: A name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: A type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the inner azure.resourcemanager.nonresource.fluent.models.NonResourceInner object. + * + * @return the inner object. + */ + NonResourceInner innerModel(); + + /** + * The entirety of the NonResource definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The NonResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the NonResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the NonResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies location. + * + * @param location The location parameter. + * @return the next definition stage. + */ + WithCreate withExistingLocation(String location); + } + + /** + * The stage of the NonResource definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithName, DefinitionStages.WithType { + /** + * Executes the create request. + * + * @return the created resource. + */ + NonResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NonResource create(Context context); + } + + /** + * The stage of the NonResource definition allowing to specify name. + */ + interface WithName { + /** + * Specifies the name property: A name.. + * + * @param name A name. + * @return the next definition stage. + */ + WithCreate withName(String name); + } + + /** + * The stage of the NonResource definition allowing to specify type. + */ + interface WithType { + /** + * Specifies the type property: A type.. + * + * @param type A type. + * @return the next definition stage. + */ + WithCreate withType(String type); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NonResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NonResource refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResourceOperations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResourceOperations.java new file mode 100644 index 00000000000..6c9381670a2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/NonResourceOperations.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.nonresource.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of NonResourceOperations. + */ +public interface NonResourceOperations { + /** + * The get operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource` along with {@link Response}. + */ + Response getWithResponse(String location, String parameter, Context context); + + /** + * The get operation. + * + * @param location The location parameter. + * @param parameter Another parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource`. + */ + NonResource get(String location, String parameter); + + /** + * The get operation. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource` along with {@link Response}. + */ + NonResource getById(String id); + + /** + * The get operation. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return though this model has `id`, `name`, `type` properties, it is not a resource as it doesn't extends + * `Resource` along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new NonResource resource. + * + * @param name resource name. + * @return the first stage of the new NonResource definition. + */ + NonResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/package-info.java new file mode 100644 index 00000000000..f99d250fa0a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for NonResourceManagementClient. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.nonresource.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/package-info.java new file mode 100644 index 00000000000..e18de96ec78 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/nonresource/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for NonResourceManagementClient. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.nonresource; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/OperationTemplatesManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/OperationTemplatesManager.java new file mode 100644 index 00000000000..731f22dc7e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/OperationTemplatesManager.java @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates; + +import azure.resourcemanager.operationtemplates.fluent.OperationTemplatesClient; +import azure.resourcemanager.operationtemplates.implementation.CheckNameAvailabilitiesImpl; +import azure.resourcemanager.operationtemplates.implementation.LroesImpl; +import azure.resourcemanager.operationtemplates.implementation.OperationTemplatesClientBuilder; +import azure.resourcemanager.operationtemplates.implementation.OperationsImpl; +import azure.resourcemanager.operationtemplates.implementation.OptionalBodiesImpl; +import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilities; +import azure.resourcemanager.operationtemplates.models.Lroes; +import azure.resourcemanager.operationtemplates.models.Operations; +import azure.resourcemanager.operationtemplates.models.OptionalBodies; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to OperationTemplatesManager. + * Arm Resource Provider management API. + */ +public final class OperationTemplatesManager { + private Operations operations; + + private CheckNameAvailabilities checkNameAvailabilities; + + private Lroes lroes; + + private OptionalBodies optionalBodies; + + private final OperationTemplatesClient clientObject; + + private OperationTemplatesManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new OperationTemplatesClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of OperationTemplates service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the OperationTemplates service API instance. + */ + public static OperationTemplatesManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of OperationTemplates service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the OperationTemplates service API instance. + */ + public static OperationTemplatesManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new OperationTemplatesManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create OperationTemplatesManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new OperationTemplatesManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-operationtemplates-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of OperationTemplates service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the OperationTemplates service API instance. + */ + public OperationTemplatesManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("azure.resourcemanager.operationtemplates") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new OperationTemplatesManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of CheckNameAvailabilities. + * + * @return Resource collection API of CheckNameAvailabilities. + */ + public CheckNameAvailabilities checkNameAvailabilities() { + if (this.checkNameAvailabilities == null) { + this.checkNameAvailabilities + = new CheckNameAvailabilitiesImpl(clientObject.getCheckNameAvailabilities(), this); + } + return checkNameAvailabilities; + } + + /** + * Gets the resource collection API of Lroes. It manages Order. + * + * @return Resource collection API of Lroes. + */ + public Lroes lroes() { + if (this.lroes == null) { + this.lroes = new LroesImpl(clientObject.getLroes(), this); + } + return lroes; + } + + /** + * Gets the resource collection API of OptionalBodies. + * + * @return Resource collection API of OptionalBodies. + */ + public OptionalBodies optionalBodies() { + if (this.optionalBodies == null) { + this.optionalBodies = new OptionalBodiesImpl(clientObject.getOptionalBodies(), this); + } + return optionalBodies; + } + + /** + * Gets wrapped service client OperationTemplatesClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client OperationTemplatesClient. + */ + public OperationTemplatesClient serviceClient() { + return this.clientObject; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/CheckNameAvailabilitiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/CheckNameAvailabilitiesClient.java new file mode 100644 index 00000000000..5707564b00e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/CheckNameAvailabilitiesClient.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.fluent; + +import azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner; +import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityRequest; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient. + */ +public interface CheckNameAvailabilitiesClient { + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkGlobalWithResponse(CheckNameAvailabilityRequest body, + Context context); + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseInner checkGlobal(CheckNameAvailabilityRequest body); + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkLocalWithResponse(String location, + CheckNameAvailabilityRequest body, Context context); + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseInner checkLocal(String location, CheckNameAvailabilityRequest body); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/LroesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/LroesClient.java new file mode 100644 index 00000000000..a3b6d814291 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/LroesClient.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.fluent; + +import azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner; +import azure.resourcemanager.operationtemplates.fluent.models.OrderInner; +import azure.resourcemanager.operationtemplates.models.ExportRequest; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; + +/** + * An instance of this class provides access to all the operations defined in LroesClient. + */ +public interface LroesClient { + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OrderInner> beginCreateOrReplace(String resourceGroupName, String orderName, + OrderInner resource); + + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OrderInner> beginCreateOrReplace(String resourceGroupName, String orderName, + OrderInner resource, Context context); + + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OrderInner createOrReplace(String resourceGroupName, String orderName, OrderInner resource); + + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OrderInner createOrReplace(String resourceGroupName, String orderName, OrderInner resource, Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExportResultInner> beginExport(String resourceGroupName, String orderName, + ExportRequest body); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExportResultInner> beginExport(String resourceGroupName, String orderName, + ExportRequest body, Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + ExportResultInner export(String resourceGroupName, String orderName, ExportRequest body); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + ExportResultInner export(String resourceGroupName, String orderName, ExportRequest body, Context context); + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String orderName); + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String orderName, Context context); + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String orderName); + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String orderName, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationTemplatesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationTemplatesClient.java new file mode 100644 index 00000000000..bf0655d3b59 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationTemplatesClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for OperationTemplatesClient class. + */ +public interface OperationTemplatesClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the CheckNameAvailabilitiesClient object to access its operations. + * + * @return the CheckNameAvailabilitiesClient object. + */ + CheckNameAvailabilitiesClient getCheckNameAvailabilities(); + + /** + * Gets the LroesClient object to access its operations. + * + * @return the LroesClient object. + */ + LroesClient getLroes(); + + /** + * Gets the OptionalBodiesClient object to access its operations. + * + * @return the OptionalBodiesClient object. + */ + OptionalBodiesClient getOptionalBodies(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationsClient.java new file mode 100644 index 00000000000..86e9ca7219a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.fluent; + +import azure.resourcemanager.operationtemplates.fluent.models.OperationInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OptionalBodiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OptionalBodiesClient.java new file mode 100644 index 00000000000..872f9fa4597 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/OptionalBodiesClient.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.fluent; + +import azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner; +import azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner; +import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; +import azure.resourcemanager.operationtemplates.models.ActionRequest; +import azure.resourcemanager.operationtemplates.models.ChangeAllowanceRequest; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * An instance of this class provides access to all the operations defined in OptionalBodiesClient. + */ +public interface OptionalBodiesClient { + /** + * Get a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Widget along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String widgetName, Context context); + + /** + * Get a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Widget. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WidgetInner getByResourceGroup(String resourceGroupName, String widgetName); + + /** + * Update a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response patchWithResponse(String resourceGroupName, String widgetName, WidgetInner properties, + Context context); + + /** + * Update a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WidgetInner patch(String resourceGroupName, String widgetName); + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response postWithResponse(String resourceGroupName, String widgetName, ActionRequest body, + Context context); + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + ActionResultInner post(String resourceGroupName, String widgetName); + + /** + * The providerPost operation. + * + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response providerPostWithResponse(ChangeAllowanceRequest body, Context context); + + /** + * The providerPost operation. + * + * @throws com.azure.core.management.exception.ManagementException 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) + ChangeAllowanceResultInner providerPost(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ActionResultInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ActionResultInner.java new file mode 100644 index 00000000000..b998a2cd2d3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ActionResultInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ActionResult model. + */ +@Immutable +public final class ActionResultInner implements JsonSerializable { + /* + * The result of the action. + */ + private String result; + + /** + * Creates an instance of ActionResultInner class. + */ + private ActionResultInner() { + } + + /** + * Get the result property: The result of the action. + * + * @return the result value. + */ + public String result() { + return this.result; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("result", this.result); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActionResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActionResultInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActionResultInner. + */ + public static ActionResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActionResultInner deserializedActionResultInner = new ActionResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("result".equals(fieldName)) { + deserializedActionResultInner.result = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedActionResultInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ChangeAllowanceResultInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ChangeAllowanceResultInner.java new file mode 100644 index 00000000000..e04458ba4c8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ChangeAllowanceResultInner.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ChangeAllowanceResult model. + */ +@Immutable +public final class ChangeAllowanceResultInner implements JsonSerializable { + /* + * The new total allowed widgets. + */ + private int totalAllowed; + + /* + * The status of the change. + */ + private String status; + + /** + * Creates an instance of ChangeAllowanceResultInner class. + */ + private ChangeAllowanceResultInner() { + } + + /** + * Get the totalAllowed property: The new total allowed widgets. + * + * @return the totalAllowed value. + */ + public int totalAllowed() { + return this.totalAllowed; + } + + /** + * Get the status property: The status of the change. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("totalAllowed", this.totalAllowed); + jsonWriter.writeStringField("status", this.status); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChangeAllowanceResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChangeAllowanceResultInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ChangeAllowanceResultInner. + */ + public static ChangeAllowanceResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChangeAllowanceResultInner deserializedChangeAllowanceResultInner = new ChangeAllowanceResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("totalAllowed".equals(fieldName)) { + deserializedChangeAllowanceResultInner.totalAllowed = reader.getInt(); + } else if ("status".equals(fieldName)) { + deserializedChangeAllowanceResultInner.status = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedChangeAllowanceResultInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/CheckNameAvailabilityResponseInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/CheckNameAvailabilityResponseInner.java new file mode 100644 index 00000000000..6cfbc39c51f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.fluent.models; + +import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityReason; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The check availability result. + */ +@Immutable +public final class CheckNameAvailabilityResponseInner implements JsonSerializable { + /* + * Indicates if the resource name is available. + */ + private Boolean nameAvailable; + + /* + * The reason why the given name is not available. + */ + private CheckNameAvailabilityReason reason; + + /* + * Detailed reason why the given name is not available. + */ + private String message; + + /** + * Creates an instance of CheckNameAvailabilityResponseInner class. + */ + private CheckNameAvailabilityResponseInner() { + } + + /** + * Get the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Get the message property: Detailed reason why the given name is not available. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("nameAvailable", this.nameAvailable); + jsonWriter.writeStringField("reason", this.reason == null ? null : this.reason.toString()); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityResponseInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CheckNameAvailabilityResponseInner. + */ + public static CheckNameAvailabilityResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityResponseInner deserializedCheckNameAvailabilityResponseInner + = new CheckNameAvailabilityResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nameAvailable".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.nameAvailable + = reader.getNullable(JsonReader::getBoolean); + } else if ("reason".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.reason + = CheckNameAvailabilityReason.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + deserializedCheckNameAvailabilityResponseInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityResponseInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ExportResultInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ExportResultInner.java new file mode 100644 index 00000000000..e8c747a6b1f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ExportResultInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ExportResult model. + */ +@Immutable +public final class ExportResultInner implements JsonSerializable { + /* + * Content of the exported order. + */ + private String content; + + /** + * Creates an instance of ExportResultInner class. + */ + private ExportResultInner() { + } + + /** + * Get the content property: Content of the exported order. + * + * @return the content value. + */ + public String content() { + return this.content; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("content", this.content); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExportResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExportResultInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExportResultInner. + */ + public static ExportResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExportResultInner deserializedExportResultInner = new ExportResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("content".equals(fieldName)) { + deserializedExportResultInner.content = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExportResultInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OperationInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OperationInner.java new file mode 100644 index 00000000000..257e5c40fb2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.fluent.models; + +import azure.resourcemanager.operationtemplates.models.ActionType; +import azure.resourcemanager.operationtemplates.models.OperationDisplay; +import azure.resourcemanager.operationtemplates.models.Origin; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OrderInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OrderInner.java new file mode 100644 index 00000000000..cc36b6bab96 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OrderInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.fluent.models; + +import azure.resourcemanager.operationtemplates.models.OrderProperties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class OrderInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private OrderProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of OrderInner class. + */ + public OrderInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public OrderProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the OrderInner object itself. + */ + public OrderInner withProperties(OrderProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public OrderInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public OrderInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OrderInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OrderInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OrderInner. + */ + public static OrderInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OrderInner deserializedOrderInner = new OrderInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOrderInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOrderInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedOrderInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedOrderInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedOrderInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedOrderInner.properties = OrderProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedOrderInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOrderInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/WidgetInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/WidgetInner.java new file mode 100644 index 00000000000..476d178236f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/WidgetInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.fluent.models; + +import azure.resourcemanager.operationtemplates.models.WidgetProperties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class WidgetInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private WidgetProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of WidgetInner class. + */ + public WidgetInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public WidgetProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the WidgetInner object itself. + */ + public WidgetInner withProperties(WidgetProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public WidgetInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public WidgetInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WidgetInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WidgetInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WidgetInner. + */ + public static WidgetInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WidgetInner deserializedWidgetInner = new WidgetInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWidgetInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWidgetInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWidgetInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedWidgetInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedWidgetInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedWidgetInner.properties = WidgetProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedWidgetInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWidgetInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/package-info.java new file mode 100644 index 00000000000..15ba9bbc455 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for OperationTemplates. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.operationtemplates.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/package-info.java new file mode 100644 index 00000000000..c750d615107 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for OperationTemplates. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.operationtemplates.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ActionResultImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ActionResultImpl.java new file mode 100644 index 00000000000..10831820005 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ActionResultImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner; +import azure.resourcemanager.operationtemplates.models.ActionResult; + +public final class ActionResultImpl implements ActionResult { + private ActionResultInner innerObject; + + private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; + + ActionResultImpl(ActionResultInner innerObject, + azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String result() { + return this.innerModel().result(); + } + + public ActionResultInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ChangeAllowanceResultImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ChangeAllowanceResultImpl.java new file mode 100644 index 00000000000..5c5ccd0d9b8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ChangeAllowanceResultImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner; +import azure.resourcemanager.operationtemplates.models.ChangeAllowanceResult; + +public final class ChangeAllowanceResultImpl implements ChangeAllowanceResult { + private ChangeAllowanceResultInner innerObject; + + private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; + + ChangeAllowanceResultImpl(ChangeAllowanceResultInner innerObject, + azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public int totalAllowed() { + return this.innerModel().totalAllowed(); + } + + public String status() { + return this.innerModel().status(); + } + + public ChangeAllowanceResultInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesClientImpl.java new file mode 100644 index 00000000000..663a7f0ec9a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesClientImpl.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient; +import azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner; +import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityRequest; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient. + */ +public final class CheckNameAvailabilitiesClientImpl implements CheckNameAvailabilitiesClient { + /** + * The proxy service used to perform REST calls. + */ + private final CheckNameAvailabilitiesService service; + + /** + * The service client containing this operation class. + */ + private final OperationTemplatesClientImpl client; + + /** + * Initializes an instance of CheckNameAvailabilitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CheckNameAvailabilitiesClientImpl(OperationTemplatesClientImpl client) { + this.service = RestProxy.create(CheckNameAvailabilitiesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationTemplatesClientCheckNameAvailabilities to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OperationTemplatesClientCheckNameAvailabilities") + public interface CheckNameAvailabilitiesService { + @Post("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.OperationTemplates/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkGlobal(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckNameAvailabilityRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.OperationTemplates/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response checkGlobalSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckNameAvailabilityRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.OperationTemplates/locations/{location}/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkLocal(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") CheckNameAvailabilityRequest body, + Context context); + + @Post("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.OperationTemplates/locations/{location}/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response checkLocalSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") CheckNameAvailabilityRequest body, + Context context); + } + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + checkGlobalWithResponseAsync(CheckNameAvailabilityRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkGlobal(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkGlobalAsync(CheckNameAvailabilityRequest body) { + return checkGlobalWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkGlobalWithResponse(CheckNameAvailabilityRequest body, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.checkGlobalSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), contentType, accept, body, context); + } + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseInner checkGlobal(CheckNameAvailabilityRequest body) { + return checkGlobalWithResponse(body, Context.NONE).getValue(); + } + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkLocalWithResponseAsync(String location, + CheckNameAvailabilityRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkLocal(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkLocalAsync(String location, + CheckNameAvailabilityRequest body) { + return checkLocalWithResponseAsync(location, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkLocalWithResponse(String location, + CheckNameAvailabilityRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.checkLocalSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, contentType, accept, body, context); + } + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseInner checkLocal(String location, CheckNameAvailabilityRequest body) { + return checkLocalWithResponse(location, body, Context.NONE).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesImpl.java new file mode 100644 index 00000000000..bba72824e04 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesImpl.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient; +import azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner; +import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilities; +import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityRequest; +import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class CheckNameAvailabilitiesImpl implements CheckNameAvailabilities { + private static final ClientLogger LOGGER = new ClientLogger(CheckNameAvailabilitiesImpl.class); + + private final CheckNameAvailabilitiesClient innerClient; + + private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; + + public CheckNameAvailabilitiesImpl(CheckNameAvailabilitiesClient innerClient, + azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response checkGlobalWithResponse(CheckNameAvailabilityRequest body, + Context context) { + Response inner + = this.serviceClient().checkGlobalWithResponse(body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResponse checkGlobal(CheckNameAvailabilityRequest body) { + CheckNameAvailabilityResponseInner inner = this.serviceClient().checkGlobal(body); + if (inner != null) { + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkLocalWithResponse(String location, + CheckNameAvailabilityRequest body, Context context) { + Response inner + = this.serviceClient().checkLocalWithResponse(location, body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResponse checkLocal(String location, CheckNameAvailabilityRequest body) { + CheckNameAvailabilityResponseInner inner = this.serviceClient().checkLocal(location, body); + if (inner != null) { + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private CheckNameAvailabilitiesClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilityResponseImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 00000000000..af6750562f7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilityResponseImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner; +import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityReason; +import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityResponse; + +public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { + private CheckNameAvailabilityResponseInner innerObject; + + private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; + + CheckNameAvailabilityResponseImpl(CheckNameAvailabilityResponseInner innerObject, + azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public CheckNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ExportResultImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ExportResultImpl.java new file mode 100644 index 00000000000..3170b71ca11 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ExportResultImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner; +import azure.resourcemanager.operationtemplates.models.ExportResult; + +public final class ExportResultImpl implements ExportResult { + private ExportResultInner innerObject; + + private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; + + ExportResultImpl(ExportResultInner innerObject, + azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String content() { + return this.innerModel().content(); + } + + public ExportResultInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesClientImpl.java new file mode 100644 index 00000000000..e713f224536 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesClientImpl.java @@ -0,0 +1,618 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.LroesClient; +import azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner; +import azure.resourcemanager.operationtemplates.fluent.models.OrderInner; +import azure.resourcemanager.operationtemplates.models.ExportRequest; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +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.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in LroesClient. + */ +public final class LroesClientImpl implements LroesClient { + /** + * The proxy service used to perform REST calls. + */ + private final LroesService service; + + /** + * The service client containing this operation class. + */ + private final OperationTemplatesClientImpl client; + + /** + * Initializes an instance of LroesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LroesClientImpl(OperationTemplatesClientImpl client) { + this.service = RestProxy.create(LroesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationTemplatesClientLroes to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OperationTemplatesClientLroes") + public interface LroesService { + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/orders/{orderName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("orderName") String orderName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") OrderInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/orders/{orderName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrReplaceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("orderName") String orderName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") OrderInner resource, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/orders/{orderName}/export") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> export(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("orderName") String orderName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ExportRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/orders/{orderName}/export") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response exportSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("orderName") String orderName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ExportRequest body, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/orders/{orderName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("orderName") String orderName, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/orders/{orderName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("orderName") String orderName, + Context context); + } + + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, + String orderName, OrderInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, orderName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrReplaceWithResponse(String resourceGroupName, String orderName, + OrderInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, orderName, contentType, accept, resource, Context.NONE); + } + + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrReplaceWithResponse(String resourceGroupName, String orderName, + OrderInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, orderName, contentType, accept, resource, context); + } + + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OrderInner> beginCreateOrReplaceAsync(String resourceGroupName, + String orderName, OrderInner resource) { + Mono>> mono + = createOrReplaceWithResponseAsync(resourceGroupName, orderName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), OrderInner.class, + OrderInner.class, this.client.getContext()); + } + + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OrderInner> beginCreateOrReplace(String resourceGroupName, + String orderName, OrderInner resource) { + Response response = createOrReplaceWithResponse(resourceGroupName, orderName, resource); + return this.client.getLroResult(response, OrderInner.class, OrderInner.class, + Context.NONE); + } + + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OrderInner> beginCreateOrReplace(String resourceGroupName, + String orderName, OrderInner resource, Context context) { + Response response = createOrReplaceWithResponse(resourceGroupName, orderName, resource, context); + return this.client.getLroResult(response, OrderInner.class, OrderInner.class, context); + } + + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, String orderName, OrderInner resource) { + return beginCreateOrReplaceAsync(resourceGroupName, orderName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OrderInner createOrReplace(String resourceGroupName, String orderName, OrderInner resource) { + return beginCreateOrReplace(resourceGroupName, orderName, resource).getFinalResult(); + } + + /** + * Create a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OrderInner createOrReplace(String resourceGroupName, String orderName, OrderInner resource, + Context context) { + return beginCreateOrReplace(resourceGroupName, orderName, resource, context).getFinalResult(); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportWithResponseAsync(String resourceGroupName, String orderName, + ExportRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.export(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, orderName, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response exportWithResponse(String resourceGroupName, String orderName, ExportRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.exportSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, orderName, contentType, accept, body, Context.NONE); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response exportWithResponse(String resourceGroupName, String orderName, ExportRequest body, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.exportSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, orderName, contentType, accept, body, context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExportResultInner> beginExportAsync(String resourceGroupName, + String orderName, ExportRequest body) { + Mono>> mono = exportWithResponseAsync(resourceGroupName, orderName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ExportResultInner.class, ExportResultInner.class, this.client.getContext()); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExportResultInner> beginExport(String resourceGroupName, + String orderName, ExportRequest body) { + Response response = exportWithResponse(resourceGroupName, orderName, body); + return this.client.getLroResult(response, ExportResultInner.class, + ExportResultInner.class, Context.NONE); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExportResultInner> beginExport(String resourceGroupName, + String orderName, ExportRequest body, Context context) { + Response response = exportWithResponse(resourceGroupName, orderName, body, context); + return this.client.getLroResult(response, ExportResultInner.class, + ExportResultInner.class, context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportAsync(String resourceGroupName, String orderName, ExportRequest body) { + return beginExportAsync(resourceGroupName, orderName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 ExportResultInner export(String resourceGroupName, String orderName, ExportRequest body) { + return beginExport(resourceGroupName, orderName, body).getFinalResult(); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 ExportResultInner export(String resourceGroupName, String orderName, ExportRequest body, Context context) { + return beginExport(resourceGroupName, orderName, body, context).getFinalResult(); + } + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String orderName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, orderName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String orderName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, orderName, Context.NONE); + } + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String orderName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, orderName, context); + } + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String orderName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, orderName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String orderName) { + Response response = deleteWithResponse(resourceGroupName, orderName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String orderName, Context context) { + Response response = deleteWithResponse(resourceGroupName, orderName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String orderName) { + return beginDeleteAsync(resourceGroupName, orderName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String orderName) { + beginDelete(resourceGroupName, orderName).getFinalResult(); + } + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String orderName, Context context) { + beginDelete(resourceGroupName, orderName, context).getFinalResult(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesImpl.java new file mode 100644 index 00000000000..b528a783464 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesImpl.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.LroesClient; +import azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner; +import azure.resourcemanager.operationtemplates.models.ExportRequest; +import azure.resourcemanager.operationtemplates.models.ExportResult; +import azure.resourcemanager.operationtemplates.models.Lroes; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class LroesImpl implements Lroes { + private static final ClientLogger LOGGER = new ClientLogger(LroesImpl.class); + + private final LroesClient innerClient; + + private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; + + public LroesImpl(LroesClient innerClient, + azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ExportResult export(String resourceGroupName, String orderName, ExportRequest body) { + ExportResultInner inner = this.serviceClient().export(resourceGroupName, orderName, body); + if (inner != null) { + return new ExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ExportResult export(String resourceGroupName, String orderName, ExportRequest body, Context context) { + ExportResultInner inner = this.serviceClient().export(resourceGroupName, orderName, body, context); + if (inner != null) { + return new ExportResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String orderName) { + this.serviceClient().delete(resourceGroupName, orderName); + } + + public void delete(String resourceGroupName, String orderName, Context context) { + this.serviceClient().delete(resourceGroupName, orderName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String orderName = ResourceManagerUtils.getValueFromIdByName(id, "orders"); + if (orderName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'orders'.", id))); + } + this.delete(resourceGroupName, orderName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String orderName = ResourceManagerUtils.getValueFromIdByName(id, "orders"); + if (orderName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'orders'.", id))); + } + this.delete(resourceGroupName, orderName, context); + } + + private LroesClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { + return this.serviceManager; + } + + public OrderImpl define(String name) { + return new OrderImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationImpl.java new file mode 100644 index 00000000000..9c65f9a5f59 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.models.OperationInner; +import azure.resourcemanager.operationtemplates.models.ActionType; +import azure.resourcemanager.operationtemplates.models.Operation; +import azure.resourcemanager.operationtemplates.models.OperationDisplay; +import azure.resourcemanager.operationtemplates.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; + + OperationImpl(OperationInner innerObject, + azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientBuilder.java new file mode 100644 index 00000000000..bc9c3f5d43d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the OperationTemplatesClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { OperationTemplatesClientImpl.class }) +public final class OperationTemplatesClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the OperationTemplatesClientBuilder. + */ + public OperationTemplatesClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the OperationTemplatesClientBuilder. + */ + public OperationTemplatesClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the OperationTemplatesClientBuilder. + */ + public OperationTemplatesClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 OperationTemplatesClientBuilder. + */ + public OperationTemplatesClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the OperationTemplatesClientBuilder. + */ + public OperationTemplatesClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 OperationTemplatesClientBuilder. + */ + public OperationTemplatesClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of OperationTemplatesClientImpl with the provided parameters. + * + * @return an instance of OperationTemplatesClientImpl. + */ + public OperationTemplatesClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + OperationTemplatesClientImpl client = new OperationTemplatesClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientImpl.java new file mode 100644 index 00000000000..f6db0b30d4c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientImpl.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient; +import azure.resourcemanager.operationtemplates.fluent.LroesClient; +import azure.resourcemanager.operationtemplates.fluent.OperationTemplatesClient; +import azure.resourcemanager.operationtemplates.fluent.OperationsClient; +import azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the OperationTemplatesClientImpl type. + */ +@ServiceClient(builder = OperationTemplatesClientBuilder.class) +public final class OperationTemplatesClientImpl implements OperationTemplatesClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The CheckNameAvailabilitiesClient object to access its operations. + */ + private final CheckNameAvailabilitiesClient checkNameAvailabilities; + + /** + * Gets the CheckNameAvailabilitiesClient object to access its operations. + * + * @return the CheckNameAvailabilitiesClient object. + */ + public CheckNameAvailabilitiesClient getCheckNameAvailabilities() { + return this.checkNameAvailabilities; + } + + /** + * The LroesClient object to access its operations. + */ + private final LroesClient lroes; + + /** + * Gets the LroesClient object to access its operations. + * + * @return the LroesClient object. + */ + public LroesClient getLroes() { + return this.lroes; + } + + /** + * The OptionalBodiesClient object to access its operations. + */ + private final OptionalBodiesClient optionalBodies; + + /** + * Gets the OptionalBodiesClient object to access its operations. + * + * @return the OptionalBodiesClient object. + */ + public OptionalBodiesClient getOptionalBodies() { + return this.optionalBodies; + } + + /** + * Initializes an instance of OperationTemplatesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + OperationTemplatesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2023-12-01-preview"; + this.operations = new OperationsClientImpl(this); + this.checkNameAvailabilities = new CheckNameAvailabilitiesClientImpl(this); + this.lroes = new LroesClientImpl(this); + this.optionalBodies = new OptionalBodiesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationTemplatesClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsClientImpl.java new file mode 100644 index 00000000000..6a7eceedfab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.OperationsClient; +import azure.resourcemanager.operationtemplates.fluent.models.OperationInner; +import azure.resourcemanager.operationtemplates.implementation.models.OperationListResult; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +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.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final OperationTemplatesClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(OperationTemplatesClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationTemplatesClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OperationTemplatesClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Azure.ResourceManager.OperationTemplates/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Azure.ResourceManager.OperationTemplates/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsImpl.java new file mode 100644 index 00000000000..387ffe7c33e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.OperationsClient; +import azure.resourcemanager.operationtemplates.fluent.models.OperationInner; +import azure.resourcemanager.operationtemplates.models.Operation; +import azure.resourcemanager.operationtemplates.models.Operations; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesClientImpl.java new file mode 100644 index 00000000000..69ac5b5b9cd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesClientImpl.java @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient; +import azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner; +import azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner; +import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; +import azure.resourcemanager.operationtemplates.models.ActionRequest; +import azure.resourcemanager.operationtemplates.models.ChangeAllowanceRequest; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OptionalBodiesClient. + */ +public final class OptionalBodiesClientImpl implements OptionalBodiesClient { + /** + * The proxy service used to perform REST calls. + */ + private final OptionalBodiesService service; + + /** + * The service client containing this operation class. + */ + private final OperationTemplatesClientImpl client; + + /** + * Initializes an instance of OptionalBodiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OptionalBodiesClientImpl(OperationTemplatesClientImpl client) { + this.service + = RestProxy.create(OptionalBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OperationTemplatesClientOptionalBodies to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OperationTemplatesClientOptionalBodies") + public interface OptionalBodiesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/widgets/{widgetName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("widgetName") String widgetName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/widgets/{widgetName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("widgetName") String widgetName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/widgets/{widgetName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> patch(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("widgetName") String widgetName, + @HeaderParam("Accept") String accept, @BodyParam("application/json") WidgetInner properties, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/widgets/{widgetName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response patchSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("widgetName") String widgetName, + @HeaderParam("Accept") String accept, @BodyParam("application/json") WidgetInner properties, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/widgets/{widgetName}/post") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> post(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("widgetName") String widgetName, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ActionRequest body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.OperationTemplates/widgets/{widgetName}/post") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response postSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("widgetName") String widgetName, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ActionRequest body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.OperationTemplates/providerPost") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> providerPost(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ChangeAllowanceRequest body, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.OperationTemplates/providerPost") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response providerPostSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ChangeAllowanceRequest body, + Context context); + } + + /** + * Get a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Widget along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String widgetName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, widgetName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Widget on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String widgetName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, widgetName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Widget along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String widgetName, + Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, widgetName, accept, context); + } + + /** + * Get a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Widget. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WidgetInner getByResourceGroup(String resourceGroupName, String widgetName) { + return getByResourceGroupWithResponse(resourceGroupName, widgetName, Context.NONE).getValue(); + } + + /** + * Update a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> patchWithResponseAsync(String resourceGroupName, String widgetName, + WidgetInner properties) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.patch(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, widgetName, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono patchAsync(String resourceGroupName, String widgetName) { + final WidgetInner properties = null; + return patchWithResponseAsync(resourceGroupName, widgetName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchWithResponse(String resourceGroupName, String widgetName, WidgetInner properties, + Context context) { + final String accept = "application/json"; + return service.patchSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, widgetName, accept, properties, context); + } + + /** + * Update a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WidgetInner patch(String resourceGroupName, String widgetName) { + final WidgetInner properties = null; + return patchWithResponse(resourceGroupName, widgetName, properties, Context.NONE).getValue(); + } + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> postWithResponseAsync(String resourceGroupName, String widgetName, + ActionRequest body) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.post(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, widgetName, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postAsync(String resourceGroupName, String widgetName) { + final ActionRequest body = null; + return postWithResponseAsync(resourceGroupName, widgetName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse(String resourceGroupName, String widgetName, ActionRequest body, + Context context) { + final String accept = "application/json"; + return service.postSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, widgetName, accept, body, context); + } + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 ActionResultInner post(String resourceGroupName, String widgetName) { + final ActionRequest body = null; + return postWithResponse(resourceGroupName, widgetName, body, Context.NONE).getValue(); + } + + /** + * The providerPost operation. + * + * @param body The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> providerPostWithResponseAsync(ChangeAllowanceRequest body) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.providerPost(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The providerPost operation. + * + * @throws ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono providerPostAsync() { + final ChangeAllowanceRequest body = null; + return providerPostWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The providerPost operation. + * + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response providerPostWithResponse(ChangeAllowanceRequest body, Context context) { + final String accept = "application/json"; + return service.providerPostSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, body, context); + } + + /** + * The providerPost operation. + * + * @throws ManagementException 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 ChangeAllowanceResultInner providerPost() { + final ChangeAllowanceRequest body = null; + return providerPostWithResponse(body, Context.NONE).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesImpl.java new file mode 100644 index 00000000000..1395adf37aa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesImpl.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient; +import azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner; +import azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner; +import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; +import azure.resourcemanager.operationtemplates.models.ActionRequest; +import azure.resourcemanager.operationtemplates.models.ActionResult; +import azure.resourcemanager.operationtemplates.models.ChangeAllowanceRequest; +import azure.resourcemanager.operationtemplates.models.ChangeAllowanceResult; +import azure.resourcemanager.operationtemplates.models.OptionalBodies; +import azure.resourcemanager.operationtemplates.models.Widget; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class OptionalBodiesImpl implements OptionalBodies { + private static final ClientLogger LOGGER = new ClientLogger(OptionalBodiesImpl.class); + + private final OptionalBodiesClient innerClient; + + private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; + + public OptionalBodiesImpl(OptionalBodiesClient innerClient, + azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String widgetName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, widgetName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WidgetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Widget getByResourceGroup(String resourceGroupName, String widgetName) { + WidgetInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, widgetName); + if (inner != null) { + return new WidgetImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response patchWithResponse(String resourceGroupName, String widgetName, WidgetInner properties, + Context context) { + Response inner + = this.serviceClient().patchWithResponse(resourceGroupName, widgetName, properties, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WidgetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Widget patch(String resourceGroupName, String widgetName) { + WidgetInner inner = this.serviceClient().patch(resourceGroupName, widgetName); + if (inner != null) { + return new WidgetImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response postWithResponse(String resourceGroupName, String widgetName, ActionRequest body, + Context context) { + Response inner + = this.serviceClient().postWithResponse(resourceGroupName, widgetName, body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ActionResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ActionResult post(String resourceGroupName, String widgetName) { + ActionResultInner inner = this.serviceClient().post(resourceGroupName, widgetName); + if (inner != null) { + return new ActionResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response providerPostWithResponse(ChangeAllowanceRequest body, Context context) { + Response inner = this.serviceClient().providerPostWithResponse(body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ChangeAllowanceResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ChangeAllowanceResult providerPost() { + ChangeAllowanceResultInner inner = this.serviceClient().providerPost(); + if (inner != null) { + return new ChangeAllowanceResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private OptionalBodiesClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OrderImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OrderImpl.java new file mode 100644 index 00000000000..ff8fba0c5a5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/OrderImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.models.OrderInner; +import azure.resourcemanager.operationtemplates.models.ExportRequest; +import azure.resourcemanager.operationtemplates.models.ExportResult; +import azure.resourcemanager.operationtemplates.models.Order; +import azure.resourcemanager.operationtemplates.models.OrderProperties; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Collections; +import java.util.Map; + +public final class OrderImpl implements Order, Order.Definition { + private OrderInner innerObject; + + private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; + + OrderImpl(OrderInner innerObject, + azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public OrderProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public OrderInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String orderName; + + public OrderImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Order create() { + this.innerObject = serviceManager.serviceClient() + .getLroes() + .createOrReplace(resourceGroupName, orderName, this.innerModel(), Context.NONE); + return this; + } + + public Order create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLroes() + .createOrReplace(resourceGroupName, orderName, this.innerModel(), context); + return this; + } + + OrderImpl(String name, azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { + this.innerObject = new OrderInner(); + this.serviceManager = serviceManager; + this.orderName = name; + } + + public ExportResult export(ExportRequest body) { + return serviceManager.lroes().export(resourceGroupName, orderName, body); + } + + public ExportResult export(ExportRequest body, Context context) { + return serviceManager.lroes().export(resourceGroupName, orderName, body, context); + } + + public OrderImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public OrderImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public OrderImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public OrderImpl withProperties(OrderProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ResourceManagerUtils.java new file mode 100644 index 00000000000..3cc05aedfd5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/WidgetImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/WidgetImpl.java new file mode 100644 index 00000000000..96cf7ce8cef --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/WidgetImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation; + +import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; +import azure.resourcemanager.operationtemplates.models.Widget; +import azure.resourcemanager.operationtemplates.models.WidgetProperties; +import com.azure.core.management.SystemData; +import java.util.Collections; +import java.util.Map; + +public final class WidgetImpl implements Widget { + private WidgetInner innerObject; + + private final azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager; + + WidgetImpl(WidgetInner innerObject, + azure.resourcemanager.operationtemplates.OperationTemplatesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public WidgetProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public WidgetInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.operationtemplates.OperationTemplatesManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/models/OperationListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/models/OperationListResult.java new file mode 100644 index 00000000000..89acab6b398 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.implementation.models; + +import azure.resourcemanager.operationtemplates.fluent.models.OperationInner; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/package-info.java new file mode 100644 index 00000000000..fd1cf178054 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for OperationTemplates. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.operationtemplates.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionRequest.java new file mode 100644 index 00000000000..8376965746a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionRequest.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ActionRequest model. + */ +@Fluent +public final class ActionRequest implements JsonSerializable { + /* + * The action type to perform. + */ + private String actionType; + + /* + * Additional action parameters. + */ + private String parameters; + + /** + * Creates an instance of ActionRequest class. + */ + public ActionRequest() { + } + + /** + * Get the actionType property: The action type to perform. + * + * @return the actionType value. + */ + public String actionType() { + return this.actionType; + } + + /** + * Set the actionType property: The action type to perform. + * + * @param actionType the actionType value to set. + * @return the ActionRequest object itself. + */ + public ActionRequest withActionType(String actionType) { + this.actionType = actionType; + return this; + } + + /** + * Get the parameters property: Additional action parameters. + * + * @return the parameters value. + */ + public String parameters() { + return this.parameters; + } + + /** + * Set the parameters property: Additional action parameters. + * + * @param parameters the parameters value to set. + * @return the ActionRequest object itself. + */ + public ActionRequest withParameters(String parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("actionType", this.actionType); + jsonWriter.writeStringField("parameters", this.parameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActionRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActionRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ActionRequest. + */ + public static ActionRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActionRequest deserializedActionRequest = new ActionRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("actionType".equals(fieldName)) { + deserializedActionRequest.actionType = reader.getString(); + } else if ("parameters".equals(fieldName)) { + deserializedActionRequest.parameters = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedActionRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionResult.java new file mode 100644 index 00000000000..8fa33c36ecd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner; + +/** + * An immutable client-side representation of ActionResult. + */ +public interface ActionResult { + /** + * Gets the result property: The result of the action. + * + * @return the result value. + */ + String result(); + + /** + * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner object. + * + * @return the inner object. + */ + ActionResultInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionType.java new file mode 100644 index 00000000000..4f43f52a489 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceRequest.java new file mode 100644 index 00000000000..0b01dfb9d39 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceRequest.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ChangeAllowanceRequest model. + */ +@Fluent +public final class ChangeAllowanceRequest implements JsonSerializable { + /* + * The new total allowed widgets. + */ + private Integer totalAllowed; + + /* + * The reason for the change. + */ + private String reason; + + /** + * Creates an instance of ChangeAllowanceRequest class. + */ + public ChangeAllowanceRequest() { + } + + /** + * Get the totalAllowed property: The new total allowed widgets. + * + * @return the totalAllowed value. + */ + public Integer totalAllowed() { + return this.totalAllowed; + } + + /** + * Set the totalAllowed property: The new total allowed widgets. + * + * @param totalAllowed the totalAllowed value to set. + * @return the ChangeAllowanceRequest object itself. + */ + public ChangeAllowanceRequest withTotalAllowed(Integer totalAllowed) { + this.totalAllowed = totalAllowed; + return this; + } + + /** + * Get the reason property: The reason for the change. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the change. + * + * @param reason the reason value to set. + * @return the ChangeAllowanceRequest object itself. + */ + public ChangeAllowanceRequest withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("totalAllowed", this.totalAllowed); + jsonWriter.writeStringField("reason", this.reason); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChangeAllowanceRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChangeAllowanceRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ChangeAllowanceRequest. + */ + public static ChangeAllowanceRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChangeAllowanceRequest deserializedChangeAllowanceRequest = new ChangeAllowanceRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("totalAllowed".equals(fieldName)) { + deserializedChangeAllowanceRequest.totalAllowed = reader.getNullable(JsonReader::getInt); + } else if ("reason".equals(fieldName)) { + deserializedChangeAllowanceRequest.reason = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedChangeAllowanceRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceResult.java new file mode 100644 index 00000000000..626f08877e5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceResult.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner; + +/** + * An immutable client-side representation of ChangeAllowanceResult. + */ +public interface ChangeAllowanceResult { + /** + * Gets the totalAllowed property: The new total allowed widgets. + * + * @return the totalAllowed value. + */ + int totalAllowed(); + + /** + * Gets the status property: The status of the change. + * + * @return the status value. + */ + String status(); + + /** + * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner object. + * + * @return the inner object. + */ + ChangeAllowanceResultInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilities.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilities.java new file mode 100644 index 00000000000..a4daf298951 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilities.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CheckNameAvailabilities. + */ +public interface CheckNameAvailabilities { + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response}. + */ + Response checkGlobalWithResponse(CheckNameAvailabilityRequest body, Context context); + + /** + * Implements global CheckNameAvailability operations. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + CheckNameAvailabilityResponse checkGlobal(CheckNameAvailabilityRequest body); + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result along with {@link Response}. + */ + Response checkLocalWithResponse(String location, CheckNameAvailabilityRequest body, + Context context); + + /** + * Implements local CheckNameAvailability operations. + * + * @param location The name of the Azure region. + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the check availability result. + */ + CheckNameAvailabilityResponse checkLocal(String location, CheckNameAvailabilityRequest body); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityReason.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityReason.java new file mode 100644 index 00000000000..1e2fc96ba7b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityReason.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Possible reasons for a name not being available. + */ +public final class CheckNameAvailabilityReason extends ExpandableStringEnum { + /** + * Name is invalid. + */ + public static final CheckNameAvailabilityReason INVALID = fromString("Invalid"); + + /** + * Name already exists. + */ + public static final CheckNameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates a new instance of CheckNameAvailabilityReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CheckNameAvailabilityReason() { + } + + /** + * Creates or finds a CheckNameAvailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding CheckNameAvailabilityReason. + */ + public static CheckNameAvailabilityReason fromString(String name) { + return fromString(name, CheckNameAvailabilityReason.class); + } + + /** + * Gets known CheckNameAvailabilityReason values. + * + * @return known CheckNameAvailabilityReason values. + */ + public static Collection values() { + return values(CheckNameAvailabilityReason.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityRequest.java new file mode 100644 index 00000000000..262b02efd9f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The check availability request body. + */ +@Fluent +public final class CheckNameAvailabilityRequest implements JsonSerializable { + /* + * The name of the resource for which availability needs to be checked. + */ + private String name; + + /* + * The resource type. + */ + private String type; + + /** + * Creates an instance of CheckNameAvailabilityRequest class. + */ + public CheckNameAvailabilityRequest() { + } + + /** + * Get the name property: The name of the resource for which availability needs to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource for which availability needs to be checked. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityRequest if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CheckNameAvailabilityRequest. + */ + public static CheckNameAvailabilityRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityRequest deserializedCheckNameAvailabilityRequest = new CheckNameAvailabilityRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCheckNameAvailabilityRequest.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCheckNameAvailabilityRequest.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityResponse.java new file mode 100644 index 00000000000..46c6eb9876f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityResponse.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner; + +/** + * An immutable client-side representation of CheckNameAvailabilityResponse. + */ +public interface CheckNameAvailabilityResponse { + /** + * Gets the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + + /** + * Gets the message property: Detailed reason why the given name is not available. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportRequest.java new file mode 100644 index 00000000000..f4a1e3c8bdb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportRequest.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ExportRequest model. + */ +@Fluent +public final class ExportRequest implements JsonSerializable { + /* + * Format of the exported order. + */ + private String format; + + /** + * Creates an instance of ExportRequest class. + */ + public ExportRequest() { + } + + /** + * Get the format property: Format of the exported order. + * + * @return the format value. + */ + public String format() { + return this.format; + } + + /** + * Set the format property: Format of the exported order. + * + * @param format the format value to set. + * @return the ExportRequest object itself. + */ + public ExportRequest withFormat(String format) { + this.format = format; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("format", this.format); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExportRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExportRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExportRequest. + */ + public static ExportRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExportRequest deserializedExportRequest = new ExportRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("format".equals(fieldName)) { + deserializedExportRequest.format = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExportRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportResult.java new file mode 100644 index 00000000000..7b1b795b874 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/ExportResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner; + +/** + * An immutable client-side representation of ExportResult. + */ +public interface ExportResult { + /** + * Gets the content property: Content of the exported order. + * + * @return the content value. + */ + String content(); + + /** + * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner object. + * + * @return the inner object. + */ + ExportResultInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Lroes.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Lroes.java new file mode 100644 index 00000000000..92398ca748a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Lroes.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.util.Context; + +/** + * Resource collection API of Lroes. + */ +public interface Lroes { + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + ExportResult export(String resourceGroupName, String orderName, ExportRequest body); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + ExportResult export(String resourceGroupName, String orderName, ExportRequest body, Context context); + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String orderName); + + /** + * Delete a Order. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param orderName The name of the Order. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String orderName, Context context); + + /** + * Delete a Order. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Order. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Order resource. + * + * @param name resource name. + * @return the first stage of the new Order definition. + */ + Order.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operation.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operation.java new file mode 100644 index 00000000000..b38f9e5b438 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import azure.resourcemanager.operationtemplates.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OperationDisplay.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OperationDisplay.java new file mode 100644 index 00000000000..608639b71dc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for and operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operations.java new file mode 100644 index 00000000000..64f9736ec02 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OptionalBodies.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OptionalBodies.java new file mode 100644 index 00000000000..b6065cad974 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OptionalBodies.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of OptionalBodies. + */ +public interface OptionalBodies { + /** + * Get a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Widget along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String widgetName, Context context); + + /** + * Get a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Widget. + */ + Widget getByResourceGroup(String resourceGroupName, String widgetName); + + /** + * Update a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + Response patchWithResponse(String resourceGroupName, String widgetName, WidgetInner properties, + Context context); + + /** + * Update a Widget. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + Widget patch(String resourceGroupName, String widgetName); + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response}. + */ + Response postWithResponse(String resourceGroupName, String widgetName, ActionRequest body, + Context context); + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param widgetName The name of the Widget. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + ActionResult post(String resourceGroupName, String widgetName); + + /** + * The providerPost operation. + * + * @param body The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response}. + */ + Response providerPostWithResponse(ChangeAllowanceRequest body, Context context); + + /** + * The providerPost operation. + * + * @throws com.azure.core.management.exception.ManagementException 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. + */ + ChangeAllowanceResult providerPost(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Order.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Order.java new file mode 100644 index 00000000000..9155502b9e3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Order.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import azure.resourcemanager.operationtemplates.fluent.models.OrderInner; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Map; + +/** + * An immutable client-side representation of Order. + */ +public interface Order { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + OrderProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.OrderInner object. + * + * @return the inner object. + */ + OrderInner innerModel(); + + /** + * The entirety of the Order definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The Order definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Order definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Order definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the Order definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the Order definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Order create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Order create(Context context); + } + + /** + * The stage of the Order definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the Order definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(OrderProperties properties); + } + } + + /** + * A long-running resource action. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + ExportResult export(ExportRequest body); + + /** + * A long-running resource action. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + ExportResult export(ExportRequest body, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OrderProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OrderProperties.java new file mode 100644 index 00000000000..87e50bd76e0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/OrderProperties.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The OrderProperties model. + */ +@Fluent +public final class OrderProperties implements JsonSerializable { + /* + * The product ID of the order. + */ + private String productId; + + /* + * Amount of the product. + */ + private int amount; + + /* + * The provisioning state of the product. + */ + private String provisioningState; + + /** + * Creates an instance of OrderProperties class. + */ + public OrderProperties() { + } + + /** + * Get the productId property: The product ID of the order. + * + * @return the productId value. + */ + public String productId() { + return this.productId; + } + + /** + * Set the productId property: The product ID of the order. + * + * @param productId the productId value to set. + * @return the OrderProperties object itself. + */ + public OrderProperties withProductId(String productId) { + this.productId = productId; + return this; + } + + /** + * Get the amount property: Amount of the product. + * + * @return the amount value. + */ + public int amount() { + return this.amount; + } + + /** + * Set the amount property: Amount of the product. + * + * @param amount the amount value to set. + * @return the OrderProperties object itself. + */ + public OrderProperties withAmount(int amount) { + this.amount = amount; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the product. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("productId", this.productId); + jsonWriter.writeIntField("amount", this.amount); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OrderProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OrderProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OrderProperties. + */ + public static OrderProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OrderProperties deserializedOrderProperties = new OrderProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("productId".equals(fieldName)) { + deserializedOrderProperties.productId = reader.getString(); + } else if ("amount".equals(fieldName)) { + deserializedOrderProperties.amount = reader.getInt(); + } else if ("provisioningState".equals(fieldName)) { + deserializedOrderProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOrderProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Origin.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Origin.java new file mode 100644 index 00000000000..71894245ffc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Widget.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Widget.java new file mode 100644 index 00000000000..4cfeb469f02 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/Widget.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; +import com.azure.core.management.SystemData; +import java.util.Map; + +/** + * An immutable client-side representation of Widget. + */ +public interface Widget { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + WidgetProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner azure.resourcemanager.operationtemplates.fluent.models.WidgetInner object. + * + * @return the inner object. + */ + WidgetInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/WidgetProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/WidgetProperties.java new file mode 100644 index 00000000000..c2e500cd71c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/WidgetProperties.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.operationtemplates.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The WidgetProperties model. + */ +@Fluent +public final class WidgetProperties implements JsonSerializable { + /* + * The name of the widget. + */ + private String name; + + /* + * The description of the widget. + */ + private String description; + + /* + * The provisioning state of the widget. + */ + private String provisioningState; + + /** + * Creates an instance of WidgetProperties class. + */ + public WidgetProperties() { + } + + /** + * Get the name property: The name of the widget. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the widget. + * + * @param name the name value to set. + * @return the WidgetProperties object itself. + */ + public WidgetProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: The description of the widget. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the widget. + * + * @param description the description value to set. + * @return the WidgetProperties object itself. + */ + public WidgetProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the widget. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WidgetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WidgetProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the WidgetProperties. + */ + public static WidgetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WidgetProperties deserializedWidgetProperties = new WidgetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedWidgetProperties.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedWidgetProperties.description = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedWidgetProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWidgetProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/package-info.java new file mode 100644 index 00000000000..32a6c3f3337 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for OperationTemplates. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.operationtemplates.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/package-info.java new file mode 100644 index 00000000000..77cea3ac709 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/operationtemplates/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for OperationTemplates. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.operationtemplates; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/ResourcesManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/ResourcesManager.java new file mode 100644 index 00000000000..f7583a35939 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/ResourcesManager.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources; + +import azure.resourcemanager.resources.fluent.ResourcesClient; +import azure.resourcemanager.resources.implementation.ExtensionsResourcesImpl; +import azure.resourcemanager.resources.implementation.LocationResourcesImpl; +import azure.resourcemanager.resources.implementation.NestedsImpl; +import azure.resourcemanager.resources.implementation.ResourcesClientBuilder; +import azure.resourcemanager.resources.implementation.SingletonsImpl; +import azure.resourcemanager.resources.implementation.TopLevelsImpl; +import azure.resourcemanager.resources.models.ExtensionsResources; +import azure.resourcemanager.resources.models.LocationResources; +import azure.resourcemanager.resources.models.Nesteds; +import azure.resourcemanager.resources.models.Singletons; +import azure.resourcemanager.resources.models.TopLevels; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to ResourcesManager. + * Arm Resource Provider management API. + */ +public final class ResourcesManager { + private TopLevels topLevels; + + private Nesteds nesteds; + + private Singletons singletons; + + private ExtensionsResources extensionsResources; + + private LocationResources locationResources; + + private final ResourcesClient clientObject; + + private ResourcesManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ResourcesClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Resources service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Resources service API instance. + */ + public static ResourcesManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Resources service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Resources service API instance. + */ + public static ResourcesManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ResourcesManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ResourcesManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ResourcesManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-resources-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Resources service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Resources service API instance. + */ + public ResourcesManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("azure.resourcemanager.resources") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ResourcesManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of TopLevels. It manages TopLevelTrackedResource. + * + * @return Resource collection API of TopLevels. + */ + public TopLevels topLevels() { + if (this.topLevels == null) { + this.topLevels = new TopLevelsImpl(clientObject.getTopLevels(), this); + } + return topLevels; + } + + /** + * Gets the resource collection API of Nesteds. It manages NestedProxyResource. + * + * @return Resource collection API of Nesteds. + */ + public Nesteds nesteds() { + if (this.nesteds == null) { + this.nesteds = new NestedsImpl(clientObject.getNesteds(), this); + } + return nesteds; + } + + /** + * Gets the resource collection API of Singletons. + * + * @return Resource collection API of Singletons. + */ + public Singletons singletons() { + if (this.singletons == null) { + this.singletons = new SingletonsImpl(clientObject.getSingletons(), this); + } + return singletons; + } + + /** + * Gets the resource collection API of ExtensionsResources. It manages ExtensionsResource. + * + * @return Resource collection API of ExtensionsResources. + */ + public ExtensionsResources extensionsResources() { + if (this.extensionsResources == null) { + this.extensionsResources = new ExtensionsResourcesImpl(clientObject.getExtensionsResources(), this); + } + return extensionsResources; + } + + /** + * Gets the resource collection API of LocationResources. It manages LocationResource. + * + * @return Resource collection API of LocationResources. + */ + public LocationResources locationResources() { + if (this.locationResources == null) { + this.locationResources = new LocationResourcesImpl(clientObject.getLocationResources(), this); + } + return locationResources; + } + + /** + * Gets wrapped service client ResourcesClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client ResourcesClient. + */ + public ResourcesClient serviceClient() { + return this.clientObject; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ExtensionsResourcesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ExtensionsResourcesClient.java new file mode 100644 index 00000000000..eaf7ba259f0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ExtensionsResourcesClient.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.fluent; + +import azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; + +/** + * An instance of this class provides access to all the operations defined in ExtensionsResourcesClient. + */ +public interface ExtensionsResourcesClient { + /** + * Get a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ExtensionsResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String extensionsResourceName, + Context context); + + /** + * Get a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ExtensionsResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtensionsResourceInner get(String resourceUri, String extensionsResourceName); + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete extension resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExtensionsResourceInner> beginCreateOrUpdate(String resourceUri, + String extensionsResourceName, ExtensionsResourceInner resource); + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete extension resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExtensionsResourceInner> beginCreateOrUpdate(String resourceUri, + String extensionsResourceName, ExtensionsResourceInner resource, Context context); + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtensionsResourceInner createOrUpdate(String resourceUri, String extensionsResourceName, + ExtensionsResourceInner resource); + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtensionsResourceInner createOrUpdate(String resourceUri, String extensionsResourceName, + ExtensionsResourceInner resource, Context context); + + /** + * Update a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceUri, String extensionsResourceName, + ExtensionsResourceInner properties, Context context); + + /** + * Update a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtensionsResourceInner update(String resourceUri, String extensionsResourceName, + ExtensionsResourceInner properties); + + /** + * Delete a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceUri, String extensionsResourceName, Context context); + + /** + * Delete a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, String extensionsResourceName); + + /** + * List ExtensionsResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByScope(String resourceUri); + + /** + * List ExtensionsResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByScope(String resourceUri, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/LocationResourcesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/LocationResourcesClient.java new file mode 100644 index 00000000000..ecc05282b4c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/LocationResourcesClient.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.fluent; + +import azure.resourcemanager.resources.fluent.models.LocationResourceInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * An instance of this class provides access to all the operations defined in LocationResourcesClient. + */ +public interface LocationResourcesClient { + /** + * Get a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LocationResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String locationResourceName, Context context); + + /** + * Get a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LocationResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LocationResourceInner get(String location, String locationResourceName); + + /** + * Create a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String location, String locationResourceName, + LocationResourceInner resource, Context context); + + /** + * Create a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LocationResourceInner createOrUpdate(String location, String locationResourceName, LocationResourceInner resource); + + /** + * Update a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String location, String locationResourceName, + LocationResourceInner properties, Context context); + + /** + * Update a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LocationResourceInner update(String location, String locationResourceName, LocationResourceInner properties); + + /** + * Delete a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String location, String locationResourceName, Context context); + + /** + * Delete a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String location, String locationResourceName); + + /** + * List LocationResource resources by SubscriptionLocationResource. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String location); + + /** + * List LocationResource resources by SubscriptionLocationResource. + * + * @param location The name of the Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String location, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/NestedsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/NestedsClient.java new file mode 100644 index 00000000000..b032fefdbfa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/NestedsClient.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.fluent; + +import azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; + +/** + * An instance of this class provides access to all the operations defined in NestedsClient. + */ +public interface NestedsClient { + /** + * Get a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NestedProxyResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, Context context); + + /** + * Get a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NestedProxyResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NestedProxyResourceInner get(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName); + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NestedProxyResourceInner> beginCreateOrReplace( + String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, + NestedProxyResourceInner resource); + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NestedProxyResourceInner> beginCreateOrReplace( + String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, + NestedProxyResourceInner resource, Context context); + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NestedProxyResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, NestedProxyResourceInner resource); + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NestedProxyResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, NestedProxyResourceInner resource, Context context); + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NestedProxyResourceInner> beginUpdate(String resourceGroupName, + String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner properties); + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NestedProxyResourceInner> beginUpdate(String resourceGroupName, + String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner properties, + Context context); + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NestedProxyResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, NestedProxyResourceInner properties); + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NestedProxyResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, NestedProxyResourceInner properties, Context context); + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName); + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, Context context); + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName); + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, + Context context); + + /** + * List NestedProxyResource resources by TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTopLevelTrackedResource(String resourceGroupName, + String topLevelTrackedResourceName); + + /** + * List NestedProxyResource resources by TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTopLevelTrackedResource(String resourceGroupName, + String topLevelTrackedResourceName, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ResourcesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ResourcesClient.java new file mode 100644 index 00000000000..4cdff9c6d1f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/ResourcesClient.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ResourcesClient class. + */ +public interface ResourcesClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the TopLevelsClient object to access its operations. + * + * @return the TopLevelsClient object. + */ + TopLevelsClient getTopLevels(); + + /** + * Gets the NestedsClient object to access its operations. + * + * @return the NestedsClient object. + */ + NestedsClient getNesteds(); + + /** + * Gets the SingletonsClient object to access its operations. + * + * @return the SingletonsClient object. + */ + SingletonsClient getSingletons(); + + /** + * Gets the ExtensionsResourcesClient object to access its operations. + * + * @return the ExtensionsResourcesClient object. + */ + ExtensionsResourcesClient getExtensionsResources(); + + /** + * Gets the LocationResourcesClient object to access its operations. + * + * @return the LocationResourcesClient object. + */ + LocationResourcesClient getLocationResources(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/SingletonsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/SingletonsClient.java new file mode 100644 index 00000000000..fdbabdcc31a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/SingletonsClient.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.fluent; + +import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; + +/** + * An instance of this class provides access to all the operations defined in SingletonsClient. + */ +public interface SingletonsClient { + /** + * Get a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SingletonTrackedResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, Context context); + + /** + * Get a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SingletonTrackedResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SingletonTrackedResourceInner getByResourceGroup(String resourceGroupName); + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SingletonTrackedResourceInner> + beginCreateOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource); + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SingletonTrackedResourceInner> + beginCreateOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource, Context context); + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SingletonTrackedResourceInner createOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource); + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SingletonTrackedResourceInner createOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource, + Context context); + + /** + * Update a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, + SingletonTrackedResourceInner properties, Context context); + + /** + * Update a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SingletonTrackedResourceInner update(String resourceGroupName, SingletonTrackedResourceInner properties); + + /** + * List SingletonTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a SingletonTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List SingletonTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a SingletonTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/TopLevelsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/TopLevelsClient.java new file mode 100644 index 00000000000..1b571f34e6a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/TopLevelsClient.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.fluent; + +import azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner; +import azure.resourcemanager.resources.models.NotificationDetails; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; + +/** + * An instance of this class provides access to all the operations defined in TopLevelsClient. + */ +public interface TopLevelsClient { + /** + * Get a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelTrackedResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelTrackedResourceName, Context context); + + /** + * Get a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelTrackedResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelTrackedResourceInner getByResourceGroup(String resourceGroupName, String topLevelTrackedResourceName); + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TopLevelTrackedResourceInner> beginCreateOrReplace( + String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource); + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TopLevelTrackedResourceInner> beginCreateOrReplace( + String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource, + Context context); + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelTrackedResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, + TopLevelTrackedResourceInner resource); + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelTrackedResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, + TopLevelTrackedResourceInner resource, Context context); + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TopLevelTrackedResourceInner> beginUpdate( + String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner properties); + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TopLevelTrackedResourceInner> beginUpdate( + String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner properties, + Context context); + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelTrackedResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, + TopLevelTrackedResourceInner properties); + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelTrackedResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, + TopLevelTrackedResourceInner properties, Context context); + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName); + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName, + Context context); + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String topLevelTrackedResourceName); + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String topLevelTrackedResourceName, Context context); + + /** + * List TopLevelTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List TopLevelTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List TopLevelTrackedResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List TopLevelTrackedResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * A synchronous resource action that returns no content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response actionSyncWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + NotificationDetails body, Context context); + + /** + * A synchronous resource action that returns no content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void actionSync(String resourceGroupName, String topLevelTrackedResourceName, NotificationDetails body); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/ExtensionsResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/ExtensionsResourceInner.java new file mode 100644 index 00000000000..a1b78b3d32a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/ExtensionsResourceInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.fluent.models; + +import azure.resourcemanager.resources.models.ExtensionsResourceProperties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Concrete extension resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class ExtensionsResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ExtensionsResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ExtensionsResourceInner class. + */ + public ExtensionsResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ExtensionsResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ExtensionsResourceInner object itself. + */ + public ExtensionsResourceInner withProperties(ExtensionsResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtensionsResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtensionsResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExtensionsResourceInner. + */ + public static ExtensionsResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtensionsResourceInner deserializedExtensionsResourceInner = new ExtensionsResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedExtensionsResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedExtensionsResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedExtensionsResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedExtensionsResourceInner.properties = ExtensionsResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedExtensionsResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExtensionsResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/LocationResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/LocationResourceInner.java new file mode 100644 index 00000000000..2070b1e0110 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/LocationResourceInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.fluent.models; + +import azure.resourcemanager.resources.models.LocationResourceProperties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Concrete proxy resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class LocationResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private LocationResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of LocationResourceInner class. + */ + public LocationResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public LocationResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the LocationResourceInner object itself. + */ + public LocationResourceInner withProperties(LocationResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LocationResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LocationResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the LocationResourceInner. + */ + public static LocationResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LocationResourceInner deserializedLocationResourceInner = new LocationResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedLocationResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedLocationResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedLocationResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedLocationResourceInner.properties = LocationResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedLocationResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLocationResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/NestedProxyResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/NestedProxyResourceInner.java new file mode 100644 index 00000000000..934224d377f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/NestedProxyResourceInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.fluent.models; + +import azure.resourcemanager.resources.models.NestedProxyResourceProperties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Nested child of Top Level Tracked Resource. + */ +@Fluent +public final class NestedProxyResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private NestedProxyResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of NestedProxyResourceInner class. + */ + public NestedProxyResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public NestedProxyResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the NestedProxyResourceInner object itself. + */ + public NestedProxyResourceInner withProperties(NestedProxyResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NestedProxyResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NestedProxyResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NestedProxyResourceInner. + */ + public static NestedProxyResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NestedProxyResourceInner deserializedNestedProxyResourceInner = new NestedProxyResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNestedProxyResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNestedProxyResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNestedProxyResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedNestedProxyResourceInner.properties = NestedProxyResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedNestedProxyResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNestedProxyResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/SingletonTrackedResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/SingletonTrackedResourceInner.java new file mode 100644 index 00000000000..61d4243fe3f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/SingletonTrackedResourceInner.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.fluent.models; + +import azure.resourcemanager.resources.models.SingletonTrackedResourceProperties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class SingletonTrackedResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private SingletonTrackedResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SingletonTrackedResourceInner class. + */ + public SingletonTrackedResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public SingletonTrackedResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the SingletonTrackedResourceInner object itself. + */ + public SingletonTrackedResourceInner withProperties(SingletonTrackedResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SingletonTrackedResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SingletonTrackedResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SingletonTrackedResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SingletonTrackedResourceInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SingletonTrackedResourceInner. + */ + public static SingletonTrackedResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SingletonTrackedResourceInner deserializedSingletonTrackedResourceInner + = new SingletonTrackedResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSingletonTrackedResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSingletonTrackedResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSingletonTrackedResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSingletonTrackedResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSingletonTrackedResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSingletonTrackedResourceInner.properties + = SingletonTrackedResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSingletonTrackedResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSingletonTrackedResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/TopLevelTrackedResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/TopLevelTrackedResourceInner.java new file mode 100644 index 00000000000..e97a548b079 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/TopLevelTrackedResourceInner.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.fluent.models; + +import azure.resourcemanager.resources.models.TopLevelTrackedResourceProperties; +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class TopLevelTrackedResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private TopLevelTrackedResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TopLevelTrackedResourceInner class. + */ + public TopLevelTrackedResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public TopLevelTrackedResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the TopLevelTrackedResourceInner object itself. + */ + public TopLevelTrackedResourceInner withProperties(TopLevelTrackedResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public TopLevelTrackedResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TopLevelTrackedResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelTrackedResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelTrackedResourceInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TopLevelTrackedResourceInner. + */ + public static TopLevelTrackedResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelTrackedResourceInner deserializedTopLevelTrackedResourceInner = new TopLevelTrackedResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTopLevelTrackedResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTopLevelTrackedResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTopLevelTrackedResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedTopLevelTrackedResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTopLevelTrackedResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedTopLevelTrackedResourceInner.properties + = TopLevelTrackedResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedTopLevelTrackedResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelTrackedResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/package-info.java new file mode 100644 index 00000000000..05af82bacf9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for Resources. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.resources.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/package-info.java new file mode 100644 index 00000000000..e51e2bd885c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for Resources. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.resources.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourceImpl.java new file mode 100644 index 00000000000..feda0303920 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourceImpl.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner; +import azure.resourcemanager.resources.models.ExtensionsResource; +import azure.resourcemanager.resources.models.ExtensionsResourceProperties; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; + +public final class ExtensionsResourceImpl + implements ExtensionsResource, ExtensionsResource.Definition, ExtensionsResource.Update { + private ExtensionsResourceInner innerObject; + + private final azure.resourcemanager.resources.ResourcesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ExtensionsResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ExtensionsResourceInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.resources.ResourcesManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String extensionsResourceName; + + public ExtensionsResourceImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public ExtensionsResource create() { + this.innerObject = serviceManager.serviceClient() + .getExtensionsResources() + .createOrUpdate(resourceUri, extensionsResourceName, this.innerModel(), Context.NONE); + return this; + } + + public ExtensionsResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getExtensionsResources() + .createOrUpdate(resourceUri, extensionsResourceName, this.innerModel(), context); + return this; + } + + ExtensionsResourceImpl(String name, azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerObject = new ExtensionsResourceInner(); + this.serviceManager = serviceManager; + this.extensionsResourceName = name; + } + + public ExtensionsResourceImpl update() { + return this; + } + + public ExtensionsResource apply() { + this.innerObject = serviceManager.serviceClient() + .getExtensionsResources() + .updateWithResponse(resourceUri, extensionsResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ExtensionsResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getExtensionsResources() + .updateWithResponse(resourceUri, extensionsResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + ExtensionsResourceImpl(ExtensionsResourceInner innerObject, + azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", + "resourceUri"); + this.extensionsResourceName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", + "extensionsResourceName"); + } + + public ExtensionsResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getExtensionsResources() + .getWithResponse(resourceUri, extensionsResourceName, Context.NONE) + .getValue(); + return this; + } + + public ExtensionsResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getExtensionsResources() + .getWithResponse(resourceUri, extensionsResourceName, context) + .getValue(); + return this; + } + + public ExtensionsResourceImpl withProperties(ExtensionsResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesClientImpl.java new file mode 100644 index 00000000000..618b4514b0a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesClientImpl.java @@ -0,0 +1,746 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.ExtensionsResourcesClient; +import azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner; +import azure.resourcemanager.resources.implementation.models.ExtensionsResourceListResult; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtensionsResourcesClient. + */ +public final class ExtensionsResourcesClientImpl implements ExtensionsResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ExtensionsResourcesService service; + + /** + * The service client containing this operation class. + */ + private final ResourcesClientImpl client; + + /** + * Initializes an instance of ExtensionsResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtensionsResourcesClientImpl(ResourcesClientImpl client) { + this.service = RestProxy.create(ExtensionsResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourcesClientExtensionsResources to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ResourcesClientExtensionsResources") + public interface ExtensionsResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("extensionsResourceName") String extensionsResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("extensionsResourceName") String extensionsResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("extensionsResourceName") String extensionsResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ExtensionsResourceInner resource, Context context); + + @Put("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("extensionsResourceName") String extensionsResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ExtensionsResourceInner resource, Context context); + + @Patch("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("extensionsResourceName") String extensionsResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ExtensionsResourceInner properties, Context context); + + @Patch("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("extensionsResourceName") String extensionsResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ExtensionsResourceInner properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("extensionsResourceName") String extensionsResourceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("extensionsResourceName") String extensionsResourceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByScope(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByScopeSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByScopeNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByScopeNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ExtensionsResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, + String extensionsResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + extensionsResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ExtensionsResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String extensionsResourceName) { + return getWithResponseAsync(resourceUri, extensionsResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ExtensionsResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String extensionsResourceName, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + extensionsResourceName, accept, context); + } + + /** + * Get a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ExtensionsResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtensionsResourceInner get(String resourceUri, String extensionsResourceName) { + return getWithResponse(resourceUri, extensionsResourceName, Context.NONE).getValue(); + } + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceUri, + String extensionsResourceName, ExtensionsResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, extensionsResourceName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceUri, String extensionsResourceName, + ExtensionsResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + extensionsResourceName, contentType, accept, resource, Context.NONE); + } + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceUri, String extensionsResourceName, + ExtensionsResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + extensionsResourceName, contentType, accept, resource, context); + } + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete extension resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExtensionsResourceInner> + beginCreateOrUpdateAsync(String resourceUri, String extensionsResourceName, ExtensionsResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceUri, extensionsResourceName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ExtensionsResourceInner.class, ExtensionsResourceInner.class, + this.client.getContext()); + } + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete extension resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExtensionsResourceInner> + beginCreateOrUpdate(String resourceUri, String extensionsResourceName, ExtensionsResourceInner resource) { + Response response = createOrUpdateWithResponse(resourceUri, extensionsResourceName, resource); + return this.client.getLroResult(response, + ExtensionsResourceInner.class, ExtensionsResourceInner.class, Context.NONE); + } + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete extension resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExtensionsResourceInner> beginCreateOrUpdate( + String resourceUri, String extensionsResourceName, ExtensionsResourceInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceUri, extensionsResourceName, resource, context); + return this.client.getLroResult(response, + ExtensionsResourceInner.class, ExtensionsResourceInner.class, context); + } + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, String extensionsResourceName, + ExtensionsResourceInner resource) { + return beginCreateOrUpdateAsync(resourceUri, extensionsResourceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtensionsResourceInner createOrUpdate(String resourceUri, String extensionsResourceName, + ExtensionsResourceInner resource) { + return beginCreateOrUpdate(resourceUri, extensionsResourceName, resource).getFinalResult(); + } + + /** + * Create a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtensionsResourceInner createOrUpdate(String resourceUri, String extensionsResourceName, + ExtensionsResourceInner resource, Context context) { + return beginCreateOrUpdate(resourceUri, extensionsResourceName, resource, context).getFinalResult(); + } + + /** + * Update a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceUri, + String extensionsResourceName, ExtensionsResourceInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + extensionsResourceName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceUri, String extensionsResourceName, + ExtensionsResourceInner properties) { + return updateWithResponseAsync(resourceUri, extensionsResourceName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type + * along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceUri, String extensionsResourceName, + ExtensionsResourceInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + extensionsResourceName, contentType, accept, properties, context); + } + + /** + * Update a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete extension resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtensionsResourceInner update(String resourceUri, String extensionsResourceName, + ExtensionsResourceInner properties) { + return updateWithResponse(resourceUri, extensionsResourceName, properties, Context.NONE).getValue(); + } + + /** + * Delete a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceUri, String extensionsResourceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + extensionsResourceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceUri, String extensionsResourceName) { + return deleteWithResponseAsync(resourceUri, extensionsResourceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceUri, String extensionsResourceName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + extensionsResourceName, context); + } + + /** + * Delete a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String extensionsResourceName) { + deleteWithResponse(resourceUri, extensionsResourceName, Context.NONE); + } + + /** + * List ExtensionsResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ExtensionsResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByScopeSinglePageAsync(String resourceUri) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByScope(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List ExtensionsResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByScopeAsync(String resourceUri) { + return new PagedFlux<>(() -> listByScopeSinglePageAsync(resourceUri), + nextLink -> listByScopeNextSinglePageAsync(nextLink)); + } + + /** + * List ExtensionsResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ExtensionsResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByScopeSinglePage(String resourceUri) { + final String accept = "application/json"; + Response res = service.listByScopeSync(this.client.getEndpoint(), + this.client.getApiVersion(), resourceUri, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ExtensionsResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ExtensionsResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByScopeSinglePage(String resourceUri, Context context) { + final String accept = "application/json"; + Response res = service.listByScopeSync(this.client.getEndpoint(), + this.client.getApiVersion(), resourceUri, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ExtensionsResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByScope(String resourceUri) { + return new PagedIterable<>(() -> listByScopeSinglePage(resourceUri), + nextLink -> listByScopeNextSinglePage(nextLink)); + } + + /** + * List ExtensionsResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByScope(String resourceUri, Context context) { + return new PagedIterable<>(() -> listByScopeSinglePage(resourceUri, context), + nextLink -> listByScopeNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ExtensionsResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByScopeNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByScopeNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ExtensionsResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByScopeNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByScopeNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ExtensionsResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByScopeNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByScopeNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesImpl.java new file mode 100644 index 00000000000..aa268931b34 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesImpl.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.ExtensionsResourcesClient; +import azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner; +import azure.resourcemanager.resources.models.ExtensionsResource; +import azure.resourcemanager.resources.models.ExtensionsResources; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class ExtensionsResourcesImpl implements ExtensionsResources { + private static final ClientLogger LOGGER = new ClientLogger(ExtensionsResourcesImpl.class); + + private final ExtensionsResourcesClient innerClient; + + private final azure.resourcemanager.resources.ResourcesManager serviceManager; + + public ExtensionsResourcesImpl(ExtensionsResourcesClient innerClient, + azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceUri, String extensionsResourceName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceUri, extensionsResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ExtensionsResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ExtensionsResource get(String resourceUri, String extensionsResourceName) { + ExtensionsResourceInner inner = this.serviceClient().get(resourceUri, extensionsResourceName); + if (inner != null) { + return new ExtensionsResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceUri, String extensionsResourceName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceUri, extensionsResourceName, context); + } + + public void deleteByResourceGroup(String resourceUri, String extensionsResourceName) { + this.serviceClient().delete(resourceUri, extensionsResourceName); + } + + public PagedIterable listByScope(String resourceUri) { + PagedIterable inner = this.serviceClient().listByScope(resourceUri); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ExtensionsResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByScope(String resourceUri, Context context) { + PagedIterable inner = this.serviceClient().listByScope(resourceUri, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ExtensionsResourceImpl(inner1, this.manager())); + } + + public ExtensionsResource getById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", + "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String extensionsResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", + "extensionsResourceName"); + if (extensionsResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensionsResources'.", id))); + } + return this.getWithResponse(resourceUri, extensionsResourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", + "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String extensionsResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", + "extensionsResourceName"); + if (extensionsResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensionsResources'.", id))); + } + return this.getWithResponse(resourceUri, extensionsResourceName, context); + } + + public void deleteById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", + "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String extensionsResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", + "extensionsResourceName"); + if (extensionsResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensionsResources'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceUri, extensionsResourceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", + "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String extensionsResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Azure.ResourceManager.Resources/extensionsResources/{extensionsResourceName}", + "extensionsResourceName"); + if (extensionsResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensionsResources'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceUri, extensionsResourceName, context); + } + + private ExtensionsResourcesClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.resources.ResourcesManager manager() { + return this.serviceManager; + } + + public ExtensionsResourceImpl define(String name) { + return new ExtensionsResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourceImpl.java new file mode 100644 index 00000000000..1961ee412f3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourceImpl.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.models.LocationResourceInner; +import azure.resourcemanager.resources.models.LocationResource; +import azure.resourcemanager.resources.models.LocationResourceProperties; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; + +public final class LocationResourceImpl + implements LocationResource, LocationResource.Definition, LocationResource.Update { + private LocationResourceInner innerObject; + + private final azure.resourcemanager.resources.ResourcesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public LocationResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public LocationResourceInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.resources.ResourcesManager manager() { + return this.serviceManager; + } + + private String location; + + private String locationResourceName; + + public LocationResourceImpl withExistingLocation(String location) { + this.location = location; + return this; + } + + public LocationResource create() { + this.innerObject = serviceManager.serviceClient() + .getLocationResources() + .createOrUpdateWithResponse(location, locationResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public LocationResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLocationResources() + .createOrUpdateWithResponse(location, locationResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + LocationResourceImpl(String name, azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerObject = new LocationResourceInner(); + this.serviceManager = serviceManager; + this.locationResourceName = name; + } + + public LocationResourceImpl update() { + return this; + } + + public LocationResource apply() { + this.innerObject = serviceManager.serviceClient() + .getLocationResources() + .updateWithResponse(location, locationResourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public LocationResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLocationResources() + .updateWithResponse(location, locationResourceName, this.innerModel(), context) + .getValue(); + return this; + } + + LocationResourceImpl(LocationResourceInner innerObject, + azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.location = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "locations"); + this.locationResourceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "locationResources"); + } + + public LocationResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getLocationResources() + .getWithResponse(location, locationResourceName, Context.NONE) + .getValue(); + return this; + } + + public LocationResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLocationResources() + .getWithResponse(location, locationResourceName, context) + .getValue(); + return this; + } + + public LocationResourceImpl withProperties(LocationResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesClientImpl.java new file mode 100644 index 00000000000..ea0644391dd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesClientImpl.java @@ -0,0 +1,627 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.LocationResourcesClient; +import azure.resourcemanager.resources.fluent.models.LocationResourceInner; +import azure.resourcemanager.resources.implementation.models.LocationResourceListResult; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in LocationResourcesClient. + */ +public final class LocationResourcesClientImpl implements LocationResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final LocationResourcesService service; + + /** + * The service client containing this operation class. + */ + private final ResourcesClientImpl client; + + /** + * Initializes an instance of LocationResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LocationResourcesClientImpl(ResourcesClientImpl client) { + this.service + = RestProxy.create(LocationResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourcesClientLocationResources to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ResourcesClientLocationResources") + public interface LocationResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") LocationResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") LocationResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") LocationResourceInner properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") LocationResourceInner properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("locationResourceName") String locationResourceName, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources/{locationResourceName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("location") String location, + @PathParam("locationResourceName") String locationResourceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/locations/{location}/locationResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByLocationSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByLocationNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LocationResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String locationResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, locationResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LocationResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String locationResourceName) { + return getWithResponseAsync(location, locationResourceName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LocationResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String locationResourceName, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + location, locationResourceName, accept, context); + } + + /** + * Get a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LocationResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LocationResourceInner get(String location, String locationResourceName) { + return getWithResponse(location, locationResourceName, Context.NONE).getValue(); + } + + /** + * Create a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String location, + String locationResourceName, LocationResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, locationResourceName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String location, String locationResourceName, + LocationResourceInner resource) { + return createOrUpdateWithResponseAsync(location, locationResourceName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String location, String locationResourceName, + LocationResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, locationResourceName, contentType, accept, resource, context); + } + + /** + * Create a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LocationResourceInner createOrUpdate(String location, String locationResourceName, + LocationResourceInner resource) { + return createOrUpdateWithResponse(location, locationResourceName, resource, Context.NONE).getValue(); + } + + /** + * Update a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String location, String locationResourceName, + LocationResourceInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, locationResourceName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String location, String locationResourceName, + LocationResourceInner properties) { + return updateWithResponseAsync(location, locationResourceName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String location, String locationResourceName, + LocationResourceInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, locationResourceName, contentType, accept, properties, context); + } + + /** + * Update a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LocationResourceInner update(String location, String locationResourceName, + LocationResourceInner properties) { + return updateWithResponse(location, locationResourceName, properties, Context.NONE).getValue(); + } + + /** + * Delete a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String location, String locationResourceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, locationResourceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String location, String locationResourceName) { + return deleteWithResponseAsync(location, locationResourceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String location, String locationResourceName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, locationResourceName, context); + } + + /** + * Delete a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String location, String locationResourceName) { + deleteWithResponse(location, locationResourceName, Context.NONE); + } + + /** + * List LocationResource resources by SubscriptionLocationResource. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a LocationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync(String location) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByLocation(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List LocationResource resources by SubscriptionLocationResource. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String location) { + return new PagedFlux<>(() -> listByLocationSinglePageAsync(location), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * List LocationResource resources by SubscriptionLocationResource. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a LocationResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByLocationSinglePage(String location) { + final String accept = "application/json"; + Response res = service.listByLocationSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), location, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List LocationResource resources by SubscriptionLocationResource. + * + * @param location The name of the Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a LocationResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByLocationSinglePage(String location, Context context) { + final String accept = "application/json"; + Response res = service.listByLocationSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), location, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List LocationResource resources by SubscriptionLocationResource. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String location) { + return new PagedIterable<>(() -> listByLocationSinglePage(location), + nextLink -> listByLocationNextSinglePage(nextLink)); + } + + /** + * List LocationResource resources by SubscriptionLocationResource. + * + * @param location The name of the Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String location, Context context) { + return new PagedIterable<>(() -> listByLocationSinglePage(location, context), + nextLink -> listByLocationNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a LocationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByLocationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a LocationResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByLocationNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByLocationNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a LocationResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByLocationNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByLocationNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesImpl.java new file mode 100644 index 00000000000..59faad49ddb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesImpl.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.LocationResourcesClient; +import azure.resourcemanager.resources.fluent.models.LocationResourceInner; +import azure.resourcemanager.resources.models.LocationResource; +import azure.resourcemanager.resources.models.LocationResources; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class LocationResourcesImpl implements LocationResources { + private static final ClientLogger LOGGER = new ClientLogger(LocationResourcesImpl.class); + + private final LocationResourcesClient innerClient; + + private final azure.resourcemanager.resources.ResourcesManager serviceManager; + + public LocationResourcesImpl(LocationResourcesClient innerClient, + azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String location, String locationResourceName, Context context) { + Response inner + = this.serviceClient().getWithResponse(location, locationResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new LocationResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LocationResource get(String location, String locationResourceName) { + LocationResourceInner inner = this.serviceClient().get(location, locationResourceName); + if (inner != null) { + return new LocationResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String location, String locationResourceName, + Context context) { + return this.serviceClient().deleteWithResponse(location, locationResourceName, context); + } + + public void deleteByResourceGroup(String location, String locationResourceName) { + this.serviceClient().delete(location, locationResourceName); + } + + public PagedIterable listByLocation(String location) { + PagedIterable inner = this.serviceClient().listByLocation(location); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LocationResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String location, Context context) { + PagedIterable inner = this.serviceClient().listByLocation(location, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LocationResourceImpl(inner1, this.manager())); + } + + public LocationResource getById(String id) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String locationResourceName = ResourceManagerUtils.getValueFromIdByName(id, "locationResources"); + if (locationResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locationResources'.", id))); + } + return this.getWithResponse(location, locationResourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String locationResourceName = ResourceManagerUtils.getValueFromIdByName(id, "locationResources"); + if (locationResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locationResources'.", id))); + } + return this.getWithResponse(location, locationResourceName, context); + } + + public void deleteById(String id) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String locationResourceName = ResourceManagerUtils.getValueFromIdByName(id, "locationResources"); + if (locationResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locationResources'.", id))); + } + this.deleteByResourceGroupWithResponse(location, locationResourceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String location = ResourceManagerUtils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String locationResourceName = ResourceManagerUtils.getValueFromIdByName(id, "locationResources"); + if (locationResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locationResources'.", id))); + } + return this.deleteByResourceGroupWithResponse(location, locationResourceName, context); + } + + private LocationResourcesClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.resources.ResourcesManager manager() { + return this.serviceManager; + } + + public LocationResourceImpl define(String name) { + return new LocationResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedProxyResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedProxyResourceImpl.java new file mode 100644 index 00000000000..278049c63f2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedProxyResourceImpl.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner; +import azure.resourcemanager.resources.models.NestedProxyResource; +import azure.resourcemanager.resources.models.NestedProxyResourceProperties; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; + +public final class NestedProxyResourceImpl + implements NestedProxyResource, NestedProxyResource.Definition, NestedProxyResource.Update { + private NestedProxyResourceInner innerObject; + + private final azure.resourcemanager.resources.ResourcesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public NestedProxyResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public NestedProxyResourceInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.resources.ResourcesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String topLevelTrackedResourceName; + + private String nextedProxyResourceName; + + public NestedProxyResourceImpl withExistingTopLevelTrackedResource(String resourceGroupName, + String topLevelTrackedResourceName) { + this.resourceGroupName = resourceGroupName; + this.topLevelTrackedResourceName = topLevelTrackedResourceName; + return this; + } + + public NestedProxyResource create() { + this.innerObject = serviceManager.serviceClient() + .getNesteds() + .createOrReplace(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, this.innerModel(), + Context.NONE); + return this; + } + + public NestedProxyResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNesteds() + .createOrReplace(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, this.innerModel(), + context); + return this; + } + + NestedProxyResourceImpl(String name, azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerObject = new NestedProxyResourceInner(); + this.serviceManager = serviceManager; + this.nextedProxyResourceName = name; + } + + public NestedProxyResourceImpl update() { + return this; + } + + public NestedProxyResource apply() { + this.innerObject = serviceManager.serviceClient() + .getNesteds() + .update(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, this.innerModel(), + Context.NONE); + return this; + } + + public NestedProxyResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNesteds() + .update(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, this.innerModel(), + context); + return this; + } + + NestedProxyResourceImpl(NestedProxyResourceInner innerObject, + azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.topLevelTrackedResourceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "topLevelTrackedResources"); + this.nextedProxyResourceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "nestedProxyResources"); + } + + public NestedProxyResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getNesteds() + .getWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, Context.NONE) + .getValue(); + return this; + } + + public NestedProxyResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNesteds() + .getWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context) + .getValue(); + return this; + } + + public NestedProxyResourceImpl withProperties(NestedProxyResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsClientImpl.java new file mode 100644 index 00000000000..46ffda5e677 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsClientImpl.java @@ -0,0 +1,1020 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.NestedsClient; +import azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner; +import azure.resourcemanager.resources.implementation.models.NestedProxyResourceListResult; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NestedsClient. + */ +public final class NestedsClientImpl implements NestedsClient { + /** + * The proxy service used to perform REST calls. + */ + private final NestedsService service; + + /** + * The service client containing this operation class. + */ + private final ResourcesClientImpl client; + + /** + * Initializes an instance of NestedsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NestedsClientImpl(ResourcesClientImpl client) { + this.service = RestProxy.create(NestedsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourcesClientNesteds to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ResourcesClientNesteds") + public interface NestedsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @PathParam("nextedProxyResourceName") String nextedProxyResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @PathParam("nextedProxyResourceName") String nextedProxyResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @PathParam("nextedProxyResourceName") String nextedProxyResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NestedProxyResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrReplaceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @PathParam("nextedProxyResourceName") String nextedProxyResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NestedProxyResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @PathParam("nextedProxyResourceName") String nextedProxyResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NestedProxyResourceInner properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @PathParam("nextedProxyResourceName") String nextedProxyResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NestedProxyResourceInner properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @PathParam("nextedProxyResourceName") String nextedProxyResourceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources/{nextedProxyResourceName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @PathParam("nextedProxyResourceName") String nextedProxyResourceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTopLevelTrackedResource( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/nestedProxyResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByTopLevelTrackedResourceSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTopLevelTrackedResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByTopLevelTrackedResourceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NestedProxyResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String topLevelTrackedResourceName, String nextedProxyResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, + nextedProxyResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NestedProxyResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName) { + return getWithResponseAsync(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NestedProxyResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String topLevelTrackedResourceName, String nextedProxyResourceName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, accept, context); + } + + /** + * Get a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NestedProxyResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NestedProxyResourceInner get(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName) { + return getWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, Context.NONE) + .getValue(); + } + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, + String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, + nextedProxyResourceName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrReplaceWithResponse(String resourceGroupName, + String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, + contentType, accept, resource, Context.NONE); + } + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrReplaceWithResponse(String resourceGroupName, + String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner resource, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, + contentType, accept, resource, context); + } + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NestedProxyResourceInner> beginCreateOrReplaceAsync( + String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, + NestedProxyResourceInner resource) { + Mono>> mono = createOrReplaceWithResponseAsync(resourceGroupName, + topLevelTrackedResourceName, nextedProxyResourceName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NestedProxyResourceInner.class, NestedProxyResourceInner.class, + this.client.getContext()); + } + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NestedProxyResourceInner> beginCreateOrReplace( + String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, + NestedProxyResourceInner resource) { + Response response = createOrReplaceWithResponse(resourceGroupName, topLevelTrackedResourceName, + nextedProxyResourceName, resource); + return this.client.getLroResult(response, + NestedProxyResourceInner.class, NestedProxyResourceInner.class, Context.NONE); + } + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NestedProxyResourceInner> beginCreateOrReplace( + String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, + NestedProxyResourceInner resource, Context context) { + Response response = createOrReplaceWithResponse(resourceGroupName, topLevelTrackedResourceName, + nextedProxyResourceName, resource, context); + return this.client.getLroResult(response, + NestedProxyResourceInner.class, NestedProxyResourceInner.class, context); + } + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, + String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner resource) { + return beginCreateOrReplaceAsync(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, + resource).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NestedProxyResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, NestedProxyResourceInner resource) { + return beginCreateOrReplace(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, resource) + .getFinalResult(); + } + + /** + * Create a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NestedProxyResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, NestedProxyResourceInner resource, Context context) { + return beginCreateOrReplace(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, resource, + context).getFinalResult(); + } + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String topLevelTrackedResourceName, String nextedProxyResourceName, NestedProxyResourceInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, + nextedProxyResourceName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, NestedProxyResourceInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, + contentType, accept, properties, Context.NONE); + } + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, NestedProxyResourceInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, + contentType, accept, properties, context); + } + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NestedProxyResourceInner> beginUpdateAsync( + String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, + NestedProxyResourceInner properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, topLevelTrackedResourceName, + nextedProxyResourceName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NestedProxyResourceInner.class, NestedProxyResourceInner.class, + this.client.getContext()); + } + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NestedProxyResourceInner> beginUpdate( + String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, + NestedProxyResourceInner properties) { + Response response + = updateWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, properties); + return this.client.getLroResult(response, + NestedProxyResourceInner.class, NestedProxyResourceInner.class, Context.NONE); + } + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NestedProxyResourceInner> beginUpdate( + String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, + NestedProxyResourceInner properties, Context context) { + Response response = updateWithResponse(resourceGroupName, topLevelTrackedResourceName, + nextedProxyResourceName, properties, context); + return this.client.getLroResult(response, + NestedProxyResourceInner.class, NestedProxyResourceInner.class, context); + } + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, NestedProxyResourceInner properties) { + return beginUpdateAsync(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, properties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NestedProxyResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, NestedProxyResourceInner properties) { + return beginUpdate(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, properties) + .getFinalResult(); + } + + /** + * Update a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nested child of Top Level Tracked Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NestedProxyResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, NestedProxyResourceInner properties, Context context) { + return beginUpdate(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, properties, context) + .getFinalResult(); + } + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String topLevelTrackedResourceName, String nextedProxyResourceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, + nextedProxyResourceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, + Context.NONE); + } + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, + context); + } + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String topLevelTrackedResourceName, String nextedProxyResourceName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName) { + Response response + = deleteWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName) { + return beginDeleteAsync(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName) { + beginDelete(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName).getFinalResult(); + } + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, + Context context) { + beginDelete(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context).getFinalResult(); + } + + /** + * List NestedProxyResource resources by TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a NestedProxyResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByTopLevelTrackedResourceSinglePageAsync(String resourceGroupName, String topLevelTrackedResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByTopLevelTrackedResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List NestedProxyResource resources by TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTopLevelTrackedResourceAsync(String resourceGroupName, + String topLevelTrackedResourceName) { + return new PagedFlux<>( + () -> listByTopLevelTrackedResourceSinglePageAsync(resourceGroupName, topLevelTrackedResourceName), + nextLink -> listByTopLevelTrackedResourceNextSinglePageAsync(nextLink)); + } + + /** + * List NestedProxyResource resources by TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a NestedProxyResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTopLevelTrackedResourceSinglePage(String resourceGroupName, + String topLevelTrackedResourceName) { + final String accept = "application/json"; + Response res + = service.listByTopLevelTrackedResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List NestedProxyResource resources by TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a NestedProxyResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTopLevelTrackedResourceSinglePage(String resourceGroupName, + String topLevelTrackedResourceName, Context context) { + final String accept = "application/json"; + Response res + = service.listByTopLevelTrackedResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List NestedProxyResource resources by TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTopLevelTrackedResource(String resourceGroupName, + String topLevelTrackedResourceName) { + return new PagedIterable<>( + () -> listByTopLevelTrackedResourceSinglePage(resourceGroupName, topLevelTrackedResourceName), + nextLink -> listByTopLevelTrackedResourceNextSinglePage(nextLink)); + } + + /** + * List NestedProxyResource resources by TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTopLevelTrackedResource(String resourceGroupName, + String topLevelTrackedResourceName, Context context) { + return new PagedIterable<>( + () -> listByTopLevelTrackedResourceSinglePage(resourceGroupName, topLevelTrackedResourceName, context), + nextLink -> listByTopLevelTrackedResourceNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a NestedProxyResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByTopLevelTrackedResourceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listByTopLevelTrackedResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a NestedProxyResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTopLevelTrackedResourceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByTopLevelTrackedResourceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a NestedProxyResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTopLevelTrackedResourceNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByTopLevelTrackedResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsImpl.java new file mode 100644 index 00000000000..dd4d8747aaa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/NestedsImpl.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.NestedsClient; +import azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner; +import azure.resourcemanager.resources.models.NestedProxyResource; +import azure.resourcemanager.resources.models.Nesteds; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class NestedsImpl implements Nesteds { + private static final ClientLogger LOGGER = new ClientLogger(NestedsImpl.class); + + private final NestedsClient innerClient; + + private final azure.resourcemanager.resources.ResourcesManager serviceManager; + + public NestedsImpl(NestedsClient innerClient, azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new NestedProxyResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public NestedProxyResource get(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName) { + NestedProxyResourceInner inner + = this.serviceClient().get(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName); + if (inner != null) { + return new NestedProxyResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName) { + this.serviceClient().delete(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName); + } + + public void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, + Context context) { + this.serviceClient().delete(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context); + } + + public PagedIterable listByTopLevelTrackedResource(String resourceGroupName, + String topLevelTrackedResourceName) { + PagedIterable inner + = this.serviceClient().listByTopLevelTrackedResource(resourceGroupName, topLevelTrackedResourceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NestedProxyResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByTopLevelTrackedResource(String resourceGroupName, + String topLevelTrackedResourceName, Context context) { + PagedIterable inner = this.serviceClient() + .listByTopLevelTrackedResource(resourceGroupName, topLevelTrackedResourceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NestedProxyResourceImpl(inner1, this.manager())); + } + + public NestedProxyResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); + if (topLevelTrackedResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); + } + String nextedProxyResourceName = ResourceManagerUtils.getValueFromIdByName(id, "nestedProxyResources"); + if (nextedProxyResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'nestedProxyResources'.", id))); + } + return this + .getWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); + if (topLevelTrackedResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); + } + String nextedProxyResourceName = ResourceManagerUtils.getValueFromIdByName(id, "nestedProxyResources"); + if (nextedProxyResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'nestedProxyResources'.", id))); + } + return this.getWithResponse(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); + if (topLevelTrackedResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); + } + String nextedProxyResourceName = ResourceManagerUtils.getValueFromIdByName(id, "nestedProxyResources"); + if (nextedProxyResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'nestedProxyResources'.", id))); + } + this.delete(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); + if (topLevelTrackedResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); + } + String nextedProxyResourceName = ResourceManagerUtils.getValueFromIdByName(id, "nestedProxyResources"); + if (nextedProxyResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'nestedProxyResources'.", id))); + } + this.delete(resourceGroupName, topLevelTrackedResourceName, nextedProxyResourceName, context); + } + + private NestedsClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.resources.ResourcesManager manager() { + return this.serviceManager; + } + + public NestedProxyResourceImpl define(String name) { + return new NestedProxyResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourceManagerUtils.java new file mode 100644 index 00000000000..bdbf8295e4c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientBuilder.java new file mode 100644 index 00000000000..c3248686524 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the ResourcesClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ResourcesClientImpl.class }) +public final class ResourcesClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ResourcesClientBuilder. + */ + public ResourcesClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the ResourcesClientBuilder. + */ + public ResourcesClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ResourcesClientBuilder. + */ + public ResourcesClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 ResourcesClientBuilder. + */ + public ResourcesClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ResourcesClientBuilder. + */ + public ResourcesClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 ResourcesClientBuilder. + */ + public ResourcesClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ResourcesClientImpl with the provided parameters. + * + * @return an instance of ResourcesClientImpl. + */ + public ResourcesClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + ResourcesClientImpl client = new ResourcesClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientImpl.java new file mode 100644 index 00000000000..30ccafe16a1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientImpl.java @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.ExtensionsResourcesClient; +import azure.resourcemanager.resources.fluent.LocationResourcesClient; +import azure.resourcemanager.resources.fluent.NestedsClient; +import azure.resourcemanager.resources.fluent.ResourcesClient; +import azure.resourcemanager.resources.fluent.SingletonsClient; +import azure.resourcemanager.resources.fluent.TopLevelsClient; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ResourcesClientImpl type. + */ +@ServiceClient(builder = ResourcesClientBuilder.class) +public final class ResourcesClientImpl implements ResourcesClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The TopLevelsClient object to access its operations. + */ + private final TopLevelsClient topLevels; + + /** + * Gets the TopLevelsClient object to access its operations. + * + * @return the TopLevelsClient object. + */ + public TopLevelsClient getTopLevels() { + return this.topLevels; + } + + /** + * The NestedsClient object to access its operations. + */ + private final NestedsClient nesteds; + + /** + * Gets the NestedsClient object to access its operations. + * + * @return the NestedsClient object. + */ + public NestedsClient getNesteds() { + return this.nesteds; + } + + /** + * The SingletonsClient object to access its operations. + */ + private final SingletonsClient singletons; + + /** + * Gets the SingletonsClient object to access its operations. + * + * @return the SingletonsClient object. + */ + public SingletonsClient getSingletons() { + return this.singletons; + } + + /** + * The ExtensionsResourcesClient object to access its operations. + */ + private final ExtensionsResourcesClient extensionsResources; + + /** + * Gets the ExtensionsResourcesClient object to access its operations. + * + * @return the ExtensionsResourcesClient object. + */ + public ExtensionsResourcesClient getExtensionsResources() { + return this.extensionsResources; + } + + /** + * The LocationResourcesClient object to access its operations. + */ + private final LocationResourcesClient locationResources; + + /** + * Gets the LocationResourcesClient object to access its operations. + * + * @return the LocationResourcesClient object. + */ + public LocationResourcesClient getLocationResources() { + return this.locationResources; + } + + /** + * Initializes an instance of ResourcesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + ResourcesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2023-12-01-preview"; + this.topLevels = new TopLevelsClientImpl(this); + this.nesteds = new NestedsClientImpl(this); + this.singletons = new SingletonsClientImpl(this); + this.extensionsResources = new ExtensionsResourcesClientImpl(this); + this.locationResources = new LocationResourcesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourcesClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonTrackedResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonTrackedResourceImpl.java new file mode 100644 index 00000000000..82b129bcd81 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonTrackedResourceImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; +import azure.resourcemanager.resources.models.SingletonTrackedResource; +import azure.resourcemanager.resources.models.SingletonTrackedResourceProperties; +import com.azure.core.management.SystemData; +import java.util.Collections; +import java.util.Map; + +public final class SingletonTrackedResourceImpl implements SingletonTrackedResource { + private SingletonTrackedResourceInner innerObject; + + private final azure.resourcemanager.resources.ResourcesManager serviceManager; + + SingletonTrackedResourceImpl(SingletonTrackedResourceInner innerObject, + azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SingletonTrackedResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SingletonTrackedResourceInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.resources.ResourcesManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsClientImpl.java new file mode 100644 index 00000000000..78468ceadf0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsClientImpl.java @@ -0,0 +1,642 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.SingletonsClient; +import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; +import azure.resourcemanager.resources.implementation.models.SingletonTrackedResourceListResult; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SingletonsClient. + */ +public final class SingletonsClientImpl implements SingletonsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SingletonsService service; + + /** + * The service client containing this operation class. + */ + private final ResourcesClientImpl client; + + /** + * Initializes an instance of SingletonsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SingletonsClientImpl(ResourcesClientImpl client) { + this.service + = RestProxy.create(SingletonsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourcesClientSingletons to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ResourcesClientSingletons") + public interface SingletonsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SingletonTrackedResourceInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SingletonTrackedResourceInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") SingletonTrackedResourceInner properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") SingletonTrackedResourceInner properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/singletonTrackedResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SingletonTrackedResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getByResourceGroupWithResponseAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SingletonTrackedResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName) { + return getByResourceGroupWithResponseAsync(resourceGroupName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SingletonTrackedResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context); + } + + /** + * Get a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SingletonTrackedResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SingletonTrackedResourceInner getByResourceGroup(String resourceGroupName) { + return getByResourceGroupWithResponse(resourceGroupName, Context.NONE).getValue(); + } + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + SingletonTrackedResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, + SingletonTrackedResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, contentType, accept, resource, Context.NONE); + } + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, + SingletonTrackedResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, contentType, accept, resource, context); + } + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SingletonTrackedResourceInner> + beginCreateOrUpdateAsync(String resourceGroupName, SingletonTrackedResourceInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), SingletonTrackedResourceInner.class, SingletonTrackedResourceInner.class, + this.client.getContext()); + } + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SingletonTrackedResourceInner> + beginCreateOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, resource); + return this.client.getLroResult(response, + SingletonTrackedResourceInner.class, SingletonTrackedResourceInner.class, Context.NONE); + } + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SingletonTrackedResourceInner> + beginCreateOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, resource, context); + return this.client.getLroResult(response, + SingletonTrackedResourceInner.class, SingletonTrackedResourceInner.class, context); + } + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + SingletonTrackedResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SingletonTrackedResourceInner createOrUpdate(String resourceGroupName, + SingletonTrackedResourceInner resource) { + return beginCreateOrUpdate(resourceGroupName, resource).getFinalResult(); + } + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SingletonTrackedResourceInner createOrUpdate(String resourceGroupName, + SingletonTrackedResourceInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, resource, context).getFinalResult(); + } + + /** + * Update a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + SingletonTrackedResourceInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, + SingletonTrackedResourceInner properties) { + return updateWithResponseAsync(resourceGroupName, properties).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, + SingletonTrackedResourceInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, contentType, accept, properties, context); + } + + /** + * Update a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SingletonTrackedResourceInner update(String resourceGroupName, SingletonTrackedResourceInner properties) { + return updateWithResponse(resourceGroupName, properties, Context.NONE).getValue(); + } + + /** + * List SingletonTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a SingletonTrackedResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List SingletonTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a SingletonTrackedResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List SingletonTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a SingletonTrackedResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List SingletonTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a SingletonTrackedResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List SingletonTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a SingletonTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List SingletonTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a SingletonTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a SingletonTrackedResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a SingletonTrackedResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a SingletonTrackedResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsImpl.java new file mode 100644 index 00000000000..17d498c93de --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/SingletonsImpl.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.SingletonsClient; +import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; +import azure.resourcemanager.resources.models.SingletonTrackedResource; +import azure.resourcemanager.resources.models.Singletons; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class SingletonsImpl implements Singletons { + private static final ClientLogger LOGGER = new ClientLogger(SingletonsImpl.class); + + private final SingletonsClient innerClient; + + private final azure.resourcemanager.resources.ResourcesManager serviceManager; + + public SingletonsImpl(SingletonsClient innerClient, + azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SingletonTrackedResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SingletonTrackedResource getByResourceGroup(String resourceGroupName) { + SingletonTrackedResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName); + if (inner != null) { + return new SingletonTrackedResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SingletonTrackedResource createOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource) { + SingletonTrackedResourceInner inner = this.serviceClient().createOrUpdate(resourceGroupName, resource); + if (inner != null) { + return new SingletonTrackedResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public SingletonTrackedResource createOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource, + Context context) { + SingletonTrackedResourceInner inner = this.serviceClient().createOrUpdate(resourceGroupName, resource, context); + if (inner != null) { + return new SingletonTrackedResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse(String resourceGroupName, + SingletonTrackedResourceInner properties, Context context) { + Response inner + = this.serviceClient().updateWithResponse(resourceGroupName, properties, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SingletonTrackedResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SingletonTrackedResource update(String resourceGroupName, SingletonTrackedResourceInner properties) { + SingletonTrackedResourceInner inner = this.serviceClient().update(resourceGroupName, properties); + if (inner != null) { + return new SingletonTrackedResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SingletonTrackedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SingletonTrackedResourceImpl(inner1, this.manager())); + } + + private SingletonsClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.resources.ResourcesManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelTrackedResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelTrackedResourceImpl.java new file mode 100644 index 00000000000..63da63b4d06 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelTrackedResourceImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner; +import azure.resourcemanager.resources.models.NotificationDetails; +import azure.resourcemanager.resources.models.TopLevelTrackedResource; +import azure.resourcemanager.resources.models.TopLevelTrackedResourceProperties; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Collections; +import java.util.Map; + +public final class TopLevelTrackedResourceImpl + implements TopLevelTrackedResource, TopLevelTrackedResource.Definition, TopLevelTrackedResource.Update { + private TopLevelTrackedResourceInner innerObject; + + private final azure.resourcemanager.resources.ResourcesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public TopLevelTrackedResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public TopLevelTrackedResourceInner innerModel() { + return this.innerObject; + } + + private azure.resourcemanager.resources.ResourcesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String topLevelTrackedResourceName; + + public TopLevelTrackedResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public TopLevelTrackedResource create() { + this.innerObject = serviceManager.serviceClient() + .getTopLevels() + .createOrReplace(resourceGroupName, topLevelTrackedResourceName, this.innerModel(), Context.NONE); + return this; + } + + public TopLevelTrackedResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTopLevels() + .createOrReplace(resourceGroupName, topLevelTrackedResourceName, this.innerModel(), context); + return this; + } + + TopLevelTrackedResourceImpl(String name, azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerObject = new TopLevelTrackedResourceInner(); + this.serviceManager = serviceManager; + this.topLevelTrackedResourceName = name; + } + + public TopLevelTrackedResourceImpl update() { + return this; + } + + public TopLevelTrackedResource apply() { + this.innerObject = serviceManager.serviceClient() + .getTopLevels() + .update(resourceGroupName, topLevelTrackedResourceName, this.innerModel(), Context.NONE); + return this; + } + + public TopLevelTrackedResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTopLevels() + .update(resourceGroupName, topLevelTrackedResourceName, this.innerModel(), context); + return this; + } + + TopLevelTrackedResourceImpl(TopLevelTrackedResourceInner innerObject, + azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.topLevelTrackedResourceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "topLevelTrackedResources"); + } + + public TopLevelTrackedResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getTopLevels() + .getByResourceGroupWithResponse(resourceGroupName, topLevelTrackedResourceName, Context.NONE) + .getValue(); + return this; + } + + public TopLevelTrackedResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTopLevels() + .getByResourceGroupWithResponse(resourceGroupName, topLevelTrackedResourceName, context) + .getValue(); + return this; + } + + public Response actionSyncWithResponse(NotificationDetails body, Context context) { + return serviceManager.topLevels() + .actionSyncWithResponse(resourceGroupName, topLevelTrackedResourceName, body, context); + } + + public void actionSync(NotificationDetails body) { + serviceManager.topLevels().actionSync(resourceGroupName, topLevelTrackedResourceName, body); + } + + public TopLevelTrackedResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public TopLevelTrackedResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public TopLevelTrackedResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public TopLevelTrackedResourceImpl withProperties(TopLevelTrackedResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsClientImpl.java new file mode 100644 index 00000000000..80bfc177415 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsClientImpl.java @@ -0,0 +1,1241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.TopLevelsClient; +import azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner; +import azure.resourcemanager.resources.implementation.models.TopLevelTrackedResourceListResult; +import azure.resourcemanager.resources.models.NotificationDetails; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in TopLevelsClient. + */ +public final class TopLevelsClientImpl implements TopLevelsClient { + /** + * The proxy service used to perform REST calls. + */ + private final TopLevelsService service; + + /** + * The service client containing this operation class. + */ + private final ResourcesClientImpl client; + + /** + * Initializes an instance of TopLevelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TopLevelsClientImpl(ResourcesClientImpl client) { + this.service + = RestProxy.create(TopLevelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ResourcesClientTopLevels to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ResourcesClientTopLevels") + public interface TopLevelsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") TopLevelTrackedResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrReplaceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") TopLevelTrackedResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") TopLevelTrackedResourceInner properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") TopLevelTrackedResourceInner properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json;q=0.9" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/actionSync") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> actionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") NotificationDetails body, + Context context); + + @Headers({ "Accept: application/json;q=0.9" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/{topLevelTrackedResourceName}/actionSync") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response actionSyncSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelTrackedResourceName") String topLevelTrackedResourceName, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") NotificationDetails body, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelTrackedResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String topLevelTrackedResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelTrackedResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String topLevelTrackedResourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, topLevelTrackedResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelTrackedResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelTrackedResourceName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, accept, context); + } + + /** + * Get a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelTrackedResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelTrackedResourceInner getByResourceGroup(String resourceGroupName, + String topLevelTrackedResourceName) { + return getByResourceGroupWithResponse(resourceGroupName, topLevelTrackedResourceName, Context.NONE).getValue(); + } + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, + String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrReplaceWithResponse(String resourceGroupName, + String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, accept, + resource, Context.NONE); + } + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrReplaceWithResponse(String resourceGroupName, + String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, accept, + resource, context); + } + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TopLevelTrackedResourceInner> + beginCreateOrReplaceAsync(String resourceGroupName, String topLevelTrackedResourceName, + TopLevelTrackedResourceInner resource) { + Mono>> mono + = createOrReplaceWithResponseAsync(resourceGroupName, topLevelTrackedResourceName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), TopLevelTrackedResourceInner.class, TopLevelTrackedResourceInner.class, + this.client.getContext()); + } + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TopLevelTrackedResourceInner> beginCreateOrReplace( + String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource) { + Response response + = createOrReplaceWithResponse(resourceGroupName, topLevelTrackedResourceName, resource); + return this.client.getLroResult(response, + TopLevelTrackedResourceInner.class, TopLevelTrackedResourceInner.class, Context.NONE); + } + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TopLevelTrackedResourceInner> beginCreateOrReplace( + String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource, + Context context) { + Response response + = createOrReplaceWithResponse(resourceGroupName, topLevelTrackedResourceName, resource, context); + return this.client.getLroResult(response, + TopLevelTrackedResourceInner.class, TopLevelTrackedResourceInner.class, context); + } + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, + String topLevelTrackedResourceName, TopLevelTrackedResourceInner resource) { + return beginCreateOrReplaceAsync(resourceGroupName, topLevelTrackedResourceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelTrackedResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, + TopLevelTrackedResourceInner resource) { + return beginCreateOrReplace(resourceGroupName, topLevelTrackedResourceName, resource).getFinalResult(); + } + + /** + * Create a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelTrackedResourceInner createOrReplace(String resourceGroupName, String topLevelTrackedResourceName, + TopLevelTrackedResourceInner resource, Context context) { + return beginCreateOrReplace(resourceGroupName, topLevelTrackedResourceName, resource, context).getFinalResult(); + } + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String topLevelTrackedResourceName, TopLevelTrackedResourceInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + TopLevelTrackedResourceInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, accept, + properties, Context.NONE); + } + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + TopLevelTrackedResourceInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, accept, + properties, context); + } + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TopLevelTrackedResourceInner> beginUpdateAsync( + String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, topLevelTrackedResourceName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), TopLevelTrackedResourceInner.class, TopLevelTrackedResourceInner.class, + this.client.getContext()); + } + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TopLevelTrackedResourceInner> beginUpdate( + String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner properties) { + Response response = updateWithResponse(resourceGroupName, topLevelTrackedResourceName, properties); + return this.client.getLroResult(response, + TopLevelTrackedResourceInner.class, TopLevelTrackedResourceInner.class, Context.NONE); + } + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TopLevelTrackedResourceInner> beginUpdate( + String resourceGroupName, String topLevelTrackedResourceName, TopLevelTrackedResourceInner properties, + Context context) { + Response response + = updateWithResponse(resourceGroupName, topLevelTrackedResourceName, properties, context); + return this.client.getLroResult(response, + TopLevelTrackedResourceInner.class, TopLevelTrackedResourceInner.class, context); + } + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String topLevelTrackedResourceName, + TopLevelTrackedResourceInner properties) { + return beginUpdateAsync(resourceGroupName, topLevelTrackedResourceName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelTrackedResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, + TopLevelTrackedResourceInner properties) { + return beginUpdate(resourceGroupName, topLevelTrackedResourceName, properties).getFinalResult(); + } + + /** + * Update a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelTrackedResourceInner update(String resourceGroupName, String topLevelTrackedResourceName, + TopLevelTrackedResourceInner properties, Context context) { + return beginUpdate(resourceGroupName, topLevelTrackedResourceName, properties, context).getFinalResult(); + } + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String topLevelTrackedResourceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String topLevelTrackedResourceName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, Context.NONE); + } + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, context); + } + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String topLevelTrackedResourceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, topLevelTrackedResourceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, + String topLevelTrackedResourceName) { + Response response = deleteWithResponse(resourceGroupName, topLevelTrackedResourceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelTrackedResourceName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, topLevelTrackedResourceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String topLevelTrackedResourceName) { + return beginDeleteAsync(resourceGroupName, topLevelTrackedResourceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String topLevelTrackedResourceName) { + beginDelete(resourceGroupName, topLevelTrackedResourceName).getFinalResult(); + } + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String topLevelTrackedResourceName, Context context) { + beginDelete(resourceGroupName, topLevelTrackedResourceName, context).getFinalResult(); + } + + /** + * List TopLevelTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List TopLevelTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List TopLevelTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List TopLevelTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List TopLevelTrackedResource resources by subscription ID. + * + * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List TopLevelTrackedResource resources by subscription ID. + * + * @throws ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List TopLevelTrackedResource resources by subscription ID. + * + * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelTrackedResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelTrackedResource resources by subscription ID. + * + * @throws ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List TopLevelTrackedResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * A synchronous resource action that returns no content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> actionSyncWithResponseAsync(String resourceGroupName, + String topLevelTrackedResourceName, NotificationDetails body) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, body, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A synchronous resource action that returns no content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono actionSyncAsync(String resourceGroupName, String topLevelTrackedResourceName, + NotificationDetails body) { + return actionSyncWithResponseAsync(resourceGroupName, topLevelTrackedResourceName, body) + .flatMap(ignored -> Mono.empty()); + } + + /** + * A synchronous resource action that returns no content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response actionSyncWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + NotificationDetails body, Context context) { + final String contentType = "application/json"; + return service.actionSyncSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelTrackedResourceName, contentType, body, + context); + } + + /** + * A synchronous resource action that returns no content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void actionSync(String resourceGroupName, String topLevelTrackedResourceName, NotificationDetails body) { + actionSyncWithResponse(resourceGroupName, topLevelTrackedResourceName, body, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelTrackedResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsImpl.java new file mode 100644 index 00000000000..ef143a2f101 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/TopLevelsImpl.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation; + +import azure.resourcemanager.resources.fluent.TopLevelsClient; +import azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner; +import azure.resourcemanager.resources.models.NotificationDetails; +import azure.resourcemanager.resources.models.TopLevelTrackedResource; +import azure.resourcemanager.resources.models.TopLevels; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; + +public final class TopLevelsImpl implements TopLevels { + private static final ClientLogger LOGGER = new ClientLogger(TopLevelsImpl.class); + + private final TopLevelsClient innerClient; + + private final azure.resourcemanager.resources.ResourcesManager serviceManager; + + public TopLevelsImpl(TopLevelsClient innerClient, azure.resourcemanager.resources.ResourcesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelTrackedResourceName, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, topLevelTrackedResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new TopLevelTrackedResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TopLevelTrackedResource getByResourceGroup(String resourceGroupName, String topLevelTrackedResourceName) { + TopLevelTrackedResourceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, topLevelTrackedResourceName); + if (inner != null) { + return new TopLevelTrackedResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String topLevelTrackedResourceName) { + this.serviceClient().delete(resourceGroupName, topLevelTrackedResourceName); + } + + public void delete(String resourceGroupName, String topLevelTrackedResourceName, Context context) { + this.serviceClient().delete(resourceGroupName, topLevelTrackedResourceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelTrackedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelTrackedResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelTrackedResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelTrackedResourceImpl(inner1, this.manager())); + } + + public Response actionSyncWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + NotificationDetails body, Context context) { + return this.serviceClient() + .actionSyncWithResponse(resourceGroupName, topLevelTrackedResourceName, body, context); + } + + public void actionSync(String resourceGroupName, String topLevelTrackedResourceName, NotificationDetails body) { + this.serviceClient().actionSync(resourceGroupName, topLevelTrackedResourceName, body); + } + + public TopLevelTrackedResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); + if (topLevelTrackedResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, topLevelTrackedResourceName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); + if (topLevelTrackedResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, topLevelTrackedResourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); + if (topLevelTrackedResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); + } + this.delete(resourceGroupName, topLevelTrackedResourceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelTrackedResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelTrackedResources"); + if (topLevelTrackedResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'topLevelTrackedResources'.", id))); + } + this.delete(resourceGroupName, topLevelTrackedResourceName, context); + } + + private TopLevelsClient serviceClient() { + return this.innerClient; + } + + private azure.resourcemanager.resources.ResourcesManager manager() { + return this.serviceManager; + } + + public TopLevelTrackedResourceImpl define(String name) { + return new TopLevelTrackedResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/ExtensionsResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/ExtensionsResourceListResult.java new file mode 100644 index 00000000000..99bcea9924e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/ExtensionsResourceListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation.models; + +import azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response of a ExtensionsResource list operation. + */ +@Immutable +public final class ExtensionsResourceListResult implements JsonSerializable { + /* + * The ExtensionsResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ExtensionsResourceListResult class. + */ + private ExtensionsResourceListResult() { + } + + /** + * Get the value property: The ExtensionsResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtensionsResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtensionsResourceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExtensionsResourceListResult. + */ + public static ExtensionsResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtensionsResourceListResult deserializedExtensionsResourceListResult = new ExtensionsResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ExtensionsResourceInner.fromJson(reader1)); + deserializedExtensionsResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedExtensionsResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExtensionsResourceListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/LocationResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/LocationResourceListResult.java new file mode 100644 index 00000000000..66a9c0d7c46 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/LocationResourceListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation.models; + +import azure.resourcemanager.resources.fluent.models.LocationResourceInner; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response of a LocationResource list operation. + */ +@Immutable +public final class LocationResourceListResult implements JsonSerializable { + /* + * The LocationResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of LocationResourceListResult class. + */ + private LocationResourceListResult() { + } + + /** + * Get the value property: The LocationResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LocationResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LocationResourceListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the LocationResourceListResult. + */ + public static LocationResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LocationResourceListResult deserializedLocationResourceListResult = new LocationResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> LocationResourceInner.fromJson(reader1)); + deserializedLocationResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedLocationResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLocationResourceListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/NestedProxyResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/NestedProxyResourceListResult.java new file mode 100644 index 00000000000..5b5ad6116fb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/NestedProxyResourceListResult.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation.models; + +import azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response of a NestedProxyResource list operation. + */ +@Immutable +public final class NestedProxyResourceListResult implements JsonSerializable { + /* + * The NestedProxyResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of NestedProxyResourceListResult class. + */ + private NestedProxyResourceListResult() { + } + + /** + * Get the value property: The NestedProxyResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NestedProxyResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NestedProxyResourceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NestedProxyResourceListResult. + */ + public static NestedProxyResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NestedProxyResourceListResult deserializedNestedProxyResourceListResult + = new NestedProxyResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> NestedProxyResourceInner.fromJson(reader1)); + deserializedNestedProxyResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedNestedProxyResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNestedProxyResourceListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/SingletonTrackedResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/SingletonTrackedResourceListResult.java new file mode 100644 index 00000000000..cef78e46164 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/SingletonTrackedResourceListResult.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation.models; + +import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response of a SingletonTrackedResource list operation. + */ +@Immutable +public final class SingletonTrackedResourceListResult implements JsonSerializable { + /* + * The SingletonTrackedResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of SingletonTrackedResourceListResult class. + */ + private SingletonTrackedResourceListResult() { + } + + /** + * Get the value property: The SingletonTrackedResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SingletonTrackedResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SingletonTrackedResourceListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SingletonTrackedResourceListResult. + */ + public static SingletonTrackedResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SingletonTrackedResourceListResult deserializedSingletonTrackedResourceListResult + = new SingletonTrackedResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SingletonTrackedResourceInner.fromJson(reader1)); + deserializedSingletonTrackedResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSingletonTrackedResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSingletonTrackedResourceListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/TopLevelTrackedResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/TopLevelTrackedResourceListResult.java new file mode 100644 index 00000000000..a2c2fd93ed2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/models/TopLevelTrackedResourceListResult.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.implementation.models; + +import azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The response of a TopLevelTrackedResource list operation. + */ +@Immutable +public final class TopLevelTrackedResourceListResult implements JsonSerializable { + /* + * The TopLevelTrackedResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of TopLevelTrackedResourceListResult class. + */ + private TopLevelTrackedResourceListResult() { + } + + /** + * Get the value property: The TopLevelTrackedResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelTrackedResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelTrackedResourceListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TopLevelTrackedResourceListResult. + */ + public static TopLevelTrackedResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelTrackedResourceListResult deserializedTopLevelTrackedResourceListResult + = new TopLevelTrackedResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> TopLevelTrackedResourceInner.fromJson(reader1)); + deserializedTopLevelTrackedResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedTopLevelTrackedResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelTrackedResourceListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/package-info.java new file mode 100644 index 00000000000..3af261c2c86 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for Resources. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.resources.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResource.java new file mode 100644 index 00000000000..a0889b14778 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResource.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; + +/** + * An immutable client-side representation of ExtensionsResource. + */ +public interface ExtensionsResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ExtensionsResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner object. + * + * @return the inner object. + */ + ExtensionsResourceInner innerModel(); + + /** + * The entirety of the ExtensionsResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * The ExtensionsResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ExtensionsResource definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the ExtensionsResource definition allowing to specify parent resource. + */ + interface WithScope { + /** + * Specifies resourceUri. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceUri(String resourceUri); + } + + /** + * The stage of the ExtensionsResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ExtensionsResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ExtensionsResource create(Context context); + } + + /** + * The stage of the ExtensionsResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ExtensionsResourceProperties properties); + } + } + + /** + * Begins update for the ExtensionsResource resource. + * + * @return the stage of resource update. + */ + ExtensionsResource.Update update(); + + /** + * The template for ExtensionsResource update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ExtensionsResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ExtensionsResource apply(Context context); + } + + /** + * The ExtensionsResource update stages. + */ + interface UpdateStages { + /** + * The stage of the ExtensionsResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(ExtensionsResourceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ExtensionsResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ExtensionsResource refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResourceProperties.java new file mode 100644 index 00000000000..aa249496965 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResourceProperties.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * ExtensionsResource properties. + */ +@Fluent +public final class ExtensionsResourceProperties implements JsonSerializable { + /* + * The description of the resource. + */ + private String description; + + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of ExtensionsResourceProperties class. + */ + public ExtensionsResourceProperties() { + } + + /** + * Get the description property: The description of the resource. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the resource. + * + * @param description the description value to set. + * @return the ExtensionsResourceProperties object itself. + */ + public ExtensionsResourceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtensionsResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtensionsResourceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExtensionsResourceProperties. + */ + public static ExtensionsResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtensionsResourceProperties deserializedExtensionsResourceProperties = new ExtensionsResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedExtensionsResourceProperties.description = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedExtensionsResourceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedExtensionsResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResources.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResources.java new file mode 100644 index 00000000000..89169d96802 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ExtensionsResources.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ExtensionsResources. + */ +public interface ExtensionsResources { + /** + * Get a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ExtensionsResource along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String extensionsResourceName, Context context); + + /** + * Get a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ExtensionsResource. + */ + ExtensionsResource get(String resourceUri, String extensionsResourceName); + + /** + * Delete a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceUri, String extensionsResourceName, + Context context); + + /** + * Delete a ExtensionsResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param extensionsResourceName The name of the ExtensionsResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceUri, String extensionsResourceName); + + /** + * List ExtensionsResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByScope(String resourceUri); + + /** + * List ExtensionsResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a ExtensionsResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByScope(String resourceUri, Context context); + + /** + * Get a ExtensionsResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ExtensionsResource along with {@link Response}. + */ + ExtensionsResource getById(String id); + + /** + * Get a ExtensionsResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ExtensionsResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a ExtensionsResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a ExtensionsResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ExtensionsResource resource. + * + * @param name resource name. + * @return the first stage of the new ExtensionsResource definition. + */ + ExtensionsResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResource.java new file mode 100644 index 00000000000..437d9311d12 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResource.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import azure.resourcemanager.resources.fluent.models.LocationResourceInner; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; + +/** + * An immutable client-side representation of LocationResource. + */ +public interface LocationResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + LocationResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner azure.resourcemanager.resources.fluent.models.LocationResourceInner object. + * + * @return the inner object. + */ + LocationResourceInner innerModel(); + + /** + * The entirety of the LocationResource definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The LocationResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the LocationResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the LocationResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies location. + * + * @param location The name of the Azure region. + * @return the next definition stage. + */ + WithCreate withExistingLocation(String location); + } + + /** + * The stage of the LocationResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + LocationResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LocationResource create(Context context); + } + + /** + * The stage of the LocationResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(LocationResourceProperties properties); + } + } + + /** + * Begins update for the LocationResource resource. + * + * @return the stage of resource update. + */ + LocationResource.Update update(); + + /** + * The template for LocationResource update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LocationResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LocationResource apply(Context context); + } + + /** + * The LocationResource update stages. + */ + interface UpdateStages { + /** + * The stage of the LocationResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(LocationResourceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LocationResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LocationResource refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResourceProperties.java new file mode 100644 index 00000000000..3fdaae10b50 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResourceProperties.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Location resource properties. + */ +@Fluent +public final class LocationResourceProperties implements JsonSerializable { + /* + * The description of the resource. + */ + private String description; + + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of LocationResourceProperties class. + */ + public LocationResourceProperties() { + } + + /** + * Get the description property: The description of the resource. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the resource. + * + * @param description the description value to set. + * @return the LocationResourceProperties object itself. + */ + public LocationResourceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LocationResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LocationResourceProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the LocationResourceProperties. + */ + public static LocationResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LocationResourceProperties deserializedLocationResourceProperties = new LocationResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedLocationResourceProperties.description = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedLocationResourceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedLocationResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResources.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResources.java new file mode 100644 index 00000000000..d80a2171f3d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/LocationResources.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of LocationResources. + */ +public interface LocationResources { + /** + * Get a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LocationResource along with {@link Response}. + */ + Response getWithResponse(String location, String locationResourceName, Context context); + + /** + * Get a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LocationResource. + */ + LocationResource get(String location, String locationResourceName); + + /** + * Delete a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String location, String locationResourceName, Context context); + + /** + * Delete a LocationResource. + * + * @param location The name of the Azure region. + * @param locationResourceName The name of the LocationResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String location, String locationResourceName); + + /** + * List LocationResource resources by SubscriptionLocationResource. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String location); + + /** + * List LocationResource resources by SubscriptionLocationResource. + * + * @param location The name of the Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a LocationResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String location, Context context); + + /** + * Get a LocationResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LocationResource along with {@link Response}. + */ + LocationResource getById(String id); + + /** + * Get a LocationResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LocationResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a LocationResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a LocationResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LocationResource resource. + * + * @param name resource name. + * @return the first stage of the new LocationResource definition. + */ + LocationResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResource.java new file mode 100644 index 00000000000..7fd3d7e47ea --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResource.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; + +/** + * An immutable client-side representation of NestedProxyResource. + */ +public interface NestedProxyResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + NestedProxyResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner object. + * + * @return the inner object. + */ + NestedProxyResourceInner innerModel(); + + /** + * The entirety of the NestedProxyResource definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The NestedProxyResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the NestedProxyResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the NestedProxyResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, topLevelTrackedResourceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @return the next definition stage. + */ + WithCreate withExistingTopLevelTrackedResource(String resourceGroupName, + String topLevelTrackedResourceName); + } + + /** + * The stage of the NestedProxyResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + NestedProxyResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NestedProxyResource create(Context context); + } + + /** + * The stage of the NestedProxyResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(NestedProxyResourceProperties properties); + } + } + + /** + * Begins update for the NestedProxyResource resource. + * + * @return the stage of resource update. + */ + NestedProxyResource.Update update(); + + /** + * The template for NestedProxyResource update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + NestedProxyResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + NestedProxyResource apply(Context context); + } + + /** + * The NestedProxyResource update stages. + */ + interface UpdateStages { + /** + * The stage of the NestedProxyResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(NestedProxyResourceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NestedProxyResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NestedProxyResource refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResourceProperties.java new file mode 100644 index 00000000000..573424d24c9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NestedProxyResourceProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Nested Proxy Resource Properties. + */ +@Fluent +public final class NestedProxyResourceProperties implements JsonSerializable { + /* + * Provisioning State of the nested child Resource + */ + private ProvisioningState provisioningState; + + /* + * Nested resource description. + */ + private String description; + + /** + * Creates an instance of NestedProxyResourceProperties class. + */ + public NestedProxyResourceProperties() { + } + + /** + * Get the provisioningState property: Provisioning State of the nested child Resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the description property: Nested resource description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Nested resource description. + * + * @param description the description value to set. + * @return the NestedProxyResourceProperties object itself. + */ + public NestedProxyResourceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NestedProxyResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NestedProxyResourceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the NestedProxyResourceProperties. + */ + public static NestedProxyResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NestedProxyResourceProperties deserializedNestedProxyResourceProperties + = new NestedProxyResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedNestedProxyResourceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedNestedProxyResourceProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNestedProxyResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Nesteds.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Nesteds.java new file mode 100644 index 00000000000..35e29ad0477 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Nesteds.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Nesteds. + */ +public interface Nesteds { + /** + * Get a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NestedProxyResource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName, Context context); + + /** + * Get a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NestedProxyResource. + */ + NestedProxyResource get(String resourceGroupName, String topLevelTrackedResourceName, + String nextedProxyResourceName); + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName); + + /** + * Delete a NestedProxyResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param nextedProxyResourceName Name of the nested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String topLevelTrackedResourceName, String nextedProxyResourceName, + Context context); + + /** + * List NestedProxyResource resources by TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTopLevelTrackedResource(String resourceGroupName, + String topLevelTrackedResourceName); + + /** + * List NestedProxyResource resources by TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a NestedProxyResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTopLevelTrackedResource(String resourceGroupName, + String topLevelTrackedResourceName, Context context); + + /** + * Get a NestedProxyResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NestedProxyResource along with {@link Response}. + */ + NestedProxyResource getById(String id); + + /** + * Get a NestedProxyResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NestedProxyResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a NestedProxyResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a NestedProxyResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new NestedProxyResource resource. + * + * @param name resource name. + * @return the first stage of the new NestedProxyResource definition. + */ + NestedProxyResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NotificationDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NotificationDetails.java new file mode 100644 index 00000000000..8da79ea2cd1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/NotificationDetails.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The details of a user notification. + */ +@Fluent +public final class NotificationDetails implements JsonSerializable { + /* + * The notification message. + */ + private String message; + + /* + * If true, the notification is urgent. + */ + private boolean urgent; + + /** + * Creates an instance of NotificationDetails class. + */ + public NotificationDetails() { + } + + /** + * Get the message property: The notification message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The notification message. + * + * @param message the message value to set. + * @return the NotificationDetails object itself. + */ + public NotificationDetails withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the urgent property: If true, the notification is urgent. + * + * @return the urgent value. + */ + public boolean urgent() { + return this.urgent; + } + + /** + * Set the urgent property: If true, the notification is urgent. + * + * @param urgent the urgent value to set. + * @return the NotificationDetails object itself. + */ + public NotificationDetails withUrgent(boolean urgent) { + this.urgent = urgent; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("message", this.message); + jsonWriter.writeBooleanField("urgent", this.urgent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NotificationDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NotificationDetails if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NotificationDetails. + */ + public static NotificationDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NotificationDetails deserializedNotificationDetails = new NotificationDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("message".equals(fieldName)) { + deserializedNotificationDetails.message = reader.getString(); + } else if ("urgent".equals(fieldName)) { + deserializedNotificationDetails.urgent = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + + return deserializedNotificationDetails; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ProvisioningState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ProvisioningState.java new file mode 100644 index 00000000000..b78fe07d209 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/ProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ProvisioningState. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Provisioning for ProvisioningState. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Accepted for ProvisioningState. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResource.java new file mode 100644 index 00000000000..33ce6468dd2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResource.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; +import com.azure.core.management.SystemData; +import java.util.Map; + +/** + * An immutable client-side representation of SingletonTrackedResource. + */ +public interface SingletonTrackedResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + SingletonTrackedResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner object. + * + * @return the inner object. + */ + SingletonTrackedResourceInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResourceProperties.java new file mode 100644 index 00000000000..ba0a6117dd9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResourceProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Singleton Arm Resource Properties. + */ +@Fluent +public final class SingletonTrackedResourceProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * The description of the resource. + */ + private String description; + + /** + * Creates an instance of SingletonTrackedResourceProperties class. + */ + public SingletonTrackedResourceProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the description property: The description of the resource. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the resource. + * + * @param description the description value to set. + * @return the SingletonTrackedResourceProperties object itself. + */ + public SingletonTrackedResourceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SingletonTrackedResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SingletonTrackedResourceProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SingletonTrackedResourceProperties. + */ + public static SingletonTrackedResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SingletonTrackedResourceProperties deserializedSingletonTrackedResourceProperties + = new SingletonTrackedResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedSingletonTrackedResourceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedSingletonTrackedResourceProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSingletonTrackedResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Singletons.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Singletons.java new file mode 100644 index 00000000000..c7a207ade57 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/Singletons.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Singletons. + */ +public interface Singletons { + /** + * Get a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SingletonTrackedResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, Context context); + + /** + * Get a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SingletonTrackedResource. + */ + SingletonTrackedResource getByResourceGroup(String resourceGroupName); + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + SingletonTrackedResource createOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource); + + /** + * Create a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + SingletonTrackedResource createOrUpdate(String resourceGroupName, SingletonTrackedResourceInner resource, + Context context); + + /** + * Update a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + Response updateWithResponse(String resourceGroupName, + SingletonTrackedResourceInner properties, Context context); + + /** + * Update a SingletonTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + SingletonTrackedResource update(String resourceGroupName, SingletonTrackedResourceInner properties); + + /** + * List SingletonTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a SingletonTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List SingletonTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a SingletonTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResource.java new file mode 100644 index 00000000000..7343eb4d422 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResource.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Map; + +/** + * An immutable client-side representation of TopLevelTrackedResource. + */ +public interface TopLevelTrackedResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + TopLevelTrackedResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner object. + * + * @return the inner object. + */ + TopLevelTrackedResourceInner innerModel(); + + /** + * The entirety of the TopLevelTrackedResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The TopLevelTrackedResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the TopLevelTrackedResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the TopLevelTrackedResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the TopLevelTrackedResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the TopLevelTrackedResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + TopLevelTrackedResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TopLevelTrackedResource create(Context context); + } + + /** + * The stage of the TopLevelTrackedResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the TopLevelTrackedResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(TopLevelTrackedResourceProperties properties); + } + } + + /** + * Begins update for the TopLevelTrackedResource resource. + * + * @return the stage of resource update. + */ + TopLevelTrackedResource.Update update(); + + /** + * The template for TopLevelTrackedResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TopLevelTrackedResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TopLevelTrackedResource apply(Context context); + } + + /** + * The TopLevelTrackedResource update stages. + */ + interface UpdateStages { + /** + * The stage of the TopLevelTrackedResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the TopLevelTrackedResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(TopLevelTrackedResourceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TopLevelTrackedResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TopLevelTrackedResource refresh(Context context); + + /** + * A synchronous resource action that returns no content. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response actionSyncWithResponse(NotificationDetails body, Context context); + + /** + * A synchronous resource action that returns no content. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void actionSync(NotificationDetails body); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResourceProperties.java new file mode 100644 index 00000000000..621b5ab70cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResourceProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Top Level Arm Resource Properties. + */ +@Fluent +public final class TopLevelTrackedResourceProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * The description of the resource. + */ + private String description; + + /** + * Creates an instance of TopLevelTrackedResourceProperties class. + */ + public TopLevelTrackedResourceProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the description property: The description of the resource. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the resource. + * + * @param description the description value to set. + * @return the TopLevelTrackedResourceProperties object itself. + */ + public TopLevelTrackedResourceProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelTrackedResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelTrackedResourceProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TopLevelTrackedResourceProperties. + */ + public static TopLevelTrackedResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelTrackedResourceProperties deserializedTopLevelTrackedResourceProperties + = new TopLevelTrackedResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedTopLevelTrackedResourceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedTopLevelTrackedResourceProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelTrackedResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevels.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevels.java new file mode 100644 index 00000000000..4eb259aa47b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/TopLevels.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.resources.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of TopLevels. + */ +public interface TopLevels { + /** + * Get a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelTrackedResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelTrackedResourceName, Context context); + + /** + * Get a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelTrackedResource. + */ + TopLevelTrackedResource getByResourceGroup(String resourceGroupName, String topLevelTrackedResourceName); + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String topLevelTrackedResourceName); + + /** + * Delete a TopLevelTrackedResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String topLevelTrackedResourceName, Context context); + + /** + * List TopLevelTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List TopLevelTrackedResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List TopLevelTrackedResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List TopLevelTrackedResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelTrackedResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * A synchronous resource action that returns no content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response actionSyncWithResponse(String resourceGroupName, String topLevelTrackedResourceName, + NotificationDetails body, Context context); + + /** + * A synchronous resource action that returns no content. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelTrackedResourceName arm resource name for path. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void actionSync(String resourceGroupName, String topLevelTrackedResourceName, NotificationDetails body); + + /** + * Get a TopLevelTrackedResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelTrackedResource along with {@link Response}. + */ + TopLevelTrackedResource getById(String id); + + /** + * Get a TopLevelTrackedResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelTrackedResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a TopLevelTrackedResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a TopLevelTrackedResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new TopLevelTrackedResource resource. + * + * @param name resource name. + * @return the first stage of the new TopLevelTrackedResource definition. + */ + TopLevelTrackedResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/package-info.java new file mode 100644 index 00000000000..d0dff3ee76b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for Resources. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.resources.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/package-info.java new file mode 100644 index 00000000000..fdf2263b127 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/resourcemanager/resources/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for Resources. + * Arm Resource Provider management API. + */ +package azure.resourcemanager.resources; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdAsyncClient.java new file mode 100644 index 00000000000..b93f19586bc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdAsyncClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.specialheaders.xmsclientrequestid; + +import azure.specialheaders.xmsclientrequestid.implementation.XmsClientRequestIdClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous XmsClientRequestIdClient type. + */ +@ServiceClient(builder = XmsClientRequestIdClientBuilder.class, isAsync = true) +public final class XmsClientRequestIdAsyncClient { + @Generated + private final XmsClientRequestIdClientImpl serviceClient; + + /** + * Initializes an instance of XmsClientRequestIdAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + XmsClientRequestIdAsyncClient(XmsClientRequestIdClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get operation with azure `x-ms-client-request-id` header. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return operation with azure `x-ms-client-request-id` header along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Get operation with azure `x-ms-client-request-id` header. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operation with azure `x-ms-client-request-id` header on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClient.java new file mode 100644 index 00000000000..402124a15bd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.specialheaders.xmsclientrequestid; + +import azure.specialheaders.xmsclientrequestid.implementation.XmsClientRequestIdClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous XmsClientRequestIdClient type. + */ +@ServiceClient(builder = XmsClientRequestIdClientBuilder.class) +public final class XmsClientRequestIdClient { + @Generated + private final XmsClientRequestIdClientImpl serviceClient; + + /** + * Initializes an instance of XmsClientRequestIdClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + XmsClientRequestIdClient(XmsClientRequestIdClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get operation with azure `x-ms-client-request-id` header. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return operation with azure `x-ms-client-request-id` header along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Get operation with azure `x-ms-client-request-id` header. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + getWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClientBuilder.java new file mode 100644 index 00000000000..7119e5ee7af --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.specialheaders.xmsclientrequestid; + +import azure.specialheaders.xmsclientrequestid.implementation.XmsClientRequestIdClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the XmsClientRequestIdClient type. + */ +@ServiceClientBuilder(serviceClients = { XmsClientRequestIdClient.class, XmsClientRequestIdAsyncClient.class }) +public final class XmsClientRequestIdClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-specialheaders-xmsclientrequestid.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the XmsClientRequestIdClientBuilder. + */ + @Generated + public XmsClientRequestIdClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmsClientRequestIdClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmsClientRequestIdClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmsClientRequestIdClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmsClientRequestIdClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmsClientRequestIdClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmsClientRequestIdClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmsClientRequestIdClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmsClientRequestIdClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the XmsClientRequestIdClientBuilder. + */ + @Generated + public XmsClientRequestIdClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of XmsClientRequestIdClientImpl with the provided parameters. + * + * @return an instance of XmsClientRequestIdClientImpl. + */ + @Generated + private XmsClientRequestIdClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + XmsClientRequestIdClientImpl client = new XmsClientRequestIdClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of XmsClientRequestIdAsyncClient class. + * + * @return an instance of XmsClientRequestIdAsyncClient. + */ + @Generated + public XmsClientRequestIdAsyncClient buildAsyncClient() { + return new XmsClientRequestIdAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of XmsClientRequestIdClient class. + * + * @return an instance of XmsClientRequestIdClient. + */ + @Generated + public XmsClientRequestIdClient buildClient() { + return new XmsClientRequestIdClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(XmsClientRequestIdClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/XmsClientRequestIdClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/XmsClientRequestIdClientImpl.java new file mode 100644 index 00000000000..8956b968849 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/XmsClientRequestIdClientImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.specialheaders.xmsclientrequestid.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the XmsClientRequestIdClient type. + */ +public final class XmsClientRequestIdClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final XmsClientRequestIdClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of XmsClientRequestIdClient client. + * + * @param endpoint Service host. + */ + public XmsClientRequestIdClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of XmsClientRequestIdClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public XmsClientRequestIdClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of XmsClientRequestIdClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public XmsClientRequestIdClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(XmsClientRequestIdClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for XmsClientRequestIdClient to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "XmsClientRequestIdClient") + public interface XmsClientRequestIdClientService { + @Get("/azure/special-headers/x-ms-client-request-id/") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/azure/special-headers/x-ms-client-request-id/") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + } + + /** + * Get operation with azure `x-ms-client-request-id` header. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return operation with azure `x-ms-client-request-id` header along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.get(this.getEndpoint(), requestOptions, context)); + } + + /** + * Get operation with azure `x-ms-client-request-id` header. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return operation with azure `x-ms-client-request-id` header along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return service.getSync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/package-info.java new file mode 100644 index 00000000000..68c801983b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for XmsClientRequestId. + * Azure client request id header configurations. + * + */ +package azure.specialheaders.xmsclientrequestid.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/package-info.java new file mode 100644 index 00000000000..c0532e6b9bb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/specialheaders/xmsclientrequestid/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for XmsClientRequestId. + * Azure client request id header configurations. + * + */ +package azure.specialheaders.xmsclientrequestid; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionAsyncClient.java new file mode 100644 index 00000000000..b2e2513b894 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionAsyncClient.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.versioning.previewversion; + +import azure.versioning.previewversion.implementation.JsonMergePatchHelper; +import azure.versioning.previewversion.implementation.PreviewVersionClientImpl; +import azure.versioning.previewversion.models.ListWidgetsResponse; +import azure.versioning.previewversion.models.UpdateWidgetColorRequest; +import azure.versioning.previewversion.models.Widget; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous PreviewVersionClient type. + */ +@ServiceClient(builder = PreviewVersionClientBuilder.class, isAsync = true) +public final class PreviewVersionAsyncClient { + @Generated + private final PreviewVersionClientImpl serviceClient; + + /** + * Initializes an instance of PreviewVersionAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PreviewVersionAsyncClient(PreviewVersionClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get widget by id (available in all versions). + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return widget by id (available in all versions) along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWidgetWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.getWidgetWithResponseAsync(id, requestOptions); + } + + /** + * Update widget color (preview only). + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     color: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param colorUpdate The colorUpdate parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a simple model for testing along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWidgetColorWithResponse(String id, BinaryData colorUpdate, + RequestOptions requestOptions) { + return this.serviceClient.updateWidgetColorWithResponseAsync(id, colorUpdate, requestOptions); + } + + /** + * List widgets with optional color filtering. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
nameStringNoThe name parameter
colorStringNoThe color parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     widgets (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             color: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWidgetsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listWidgetsWithResponseAsync(requestOptions); + } + + /** + * Get widget by id (available in all versions). + * + * @param id The id parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return widget by id (available in all versions) on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getWidget(String id) { + // Generated convenience method for getWidgetWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWidgetWithResponse(id, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Widget.class)); + } + + /** + * Update widget color (preview only). + * + * @param id The id parameter. + * @param colorUpdate The colorUpdate parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a simple model for testing on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateWidgetColor(String id, UpdateWidgetColorRequest colorUpdate) { + // Generated convenience method for updateWidgetColorWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getUpdateWidgetColorRequestAccessor().prepareModelForJsonMergePatch(colorUpdate, true); + BinaryData colorUpdateInBinaryData = BinaryData.fromObject(colorUpdate); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + colorUpdateInBinaryData.getLength(); + JsonMergePatchHelper.getUpdateWidgetColorRequestAccessor().prepareModelForJsonMergePatch(colorUpdate, false); + return updateWidgetColorWithResponse(id, colorUpdateInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Widget.class)); + } + + /** + * List widgets with optional color filtering. + * + * @param name The name parameter. + * @param color The color parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listWidgets(String name, String color) { + // Generated convenience method for listWidgetsWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (name != null) { + requestOptions.addQueryParam("name", name, false); + } + if (color != null) { + requestOptions.addQueryParam("color", color, false); + } + return listWidgetsWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ListWidgetsResponse.class)); + } + + /** + * List widgets with optional color filtering. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono listWidgets() { + // Generated convenience method for listWidgetsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listWidgetsWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ListWidgetsResponse.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClient.java new file mode 100644 index 00000000000..1a9ab6a96f0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClient.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.versioning.previewversion; + +import azure.versioning.previewversion.implementation.JsonMergePatchHelper; +import azure.versioning.previewversion.implementation.PreviewVersionClientImpl; +import azure.versioning.previewversion.models.ListWidgetsResponse; +import azure.versioning.previewversion.models.UpdateWidgetColorRequest; +import azure.versioning.previewversion.models.Widget; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous PreviewVersionClient type. + */ +@ServiceClient(builder = PreviewVersionClientBuilder.class) +public final class PreviewVersionClient { + @Generated + private final PreviewVersionClientImpl serviceClient; + + /** + * Initializes an instance of PreviewVersionClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PreviewVersionClient(PreviewVersionClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get widget by id (available in all versions). + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return widget by id (available in all versions) along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWidgetWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.getWidgetWithResponse(id, requestOptions); + } + + /** + * Update widget color (preview only). + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     color: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param colorUpdate The colorUpdate parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a simple model for testing along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWidgetColorWithResponse(String id, BinaryData colorUpdate, + RequestOptions requestOptions) { + return this.serviceClient.updateWidgetColorWithResponse(id, colorUpdate, requestOptions); + } + + /** + * List widgets with optional color filtering. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
nameStringNoThe name parameter
colorStringNoThe color parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     widgets (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             color: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWidgetsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listWidgetsWithResponse(requestOptions); + } + + /** + * Get widget by id (available in all versions). + * + * @param id The id parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return widget by id (available in all versions). + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Widget getWidget(String id) { + // Generated convenience method for getWidgetWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWidgetWithResponse(id, requestOptions).getValue().toObject(Widget.class); + } + + /** + * Update widget color (preview only). + * + * @param id The id parameter. + * @param colorUpdate The colorUpdate parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a simple model for testing. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Widget updateWidgetColor(String id, UpdateWidgetColorRequest colorUpdate) { + // Generated convenience method for updateWidgetColorWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getUpdateWidgetColorRequestAccessor().prepareModelForJsonMergePatch(colorUpdate, true); + BinaryData colorUpdateInBinaryData = BinaryData.fromObject(colorUpdate); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + colorUpdateInBinaryData.getLength(); + JsonMergePatchHelper.getUpdateWidgetColorRequestAccessor().prepareModelForJsonMergePatch(colorUpdate, false); + return updateWidgetColorWithResponse(id, colorUpdateInBinaryData, requestOptions).getValue() + .toObject(Widget.class); + } + + /** + * List widgets with optional color filtering. + * + * @param name The name parameter. + * @param color The color parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ListWidgetsResponse listWidgets(String name, String color) { + // Generated convenience method for listWidgetsWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (name != null) { + requestOptions.addQueryParam("name", name, false); + } + if (color != null) { + requestOptions.addQueryParam("color", color, false); + } + return listWidgetsWithResponse(requestOptions).getValue().toObject(ListWidgetsResponse.class); + } + + /** + * List widgets with optional color filtering. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ListWidgetsResponse listWidgets() { + // Generated convenience method for listWidgetsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listWidgetsWithResponse(requestOptions).getValue().toObject(ListWidgetsResponse.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClientBuilder.java new file mode 100644 index 00000000000..9d0b8fe4a83 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionClientBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.versioning.previewversion; + +import azure.versioning.previewversion.implementation.PreviewVersionClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the PreviewVersionClient type. + */ +@ServiceClientBuilder(serviceClients = { PreviewVersionClient.class, PreviewVersionAsyncClient.class }) +public final class PreviewVersionClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-versioning-previewversion.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the PreviewVersionClientBuilder. + */ + @Generated + public PreviewVersionClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PreviewVersionClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PreviewVersionClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PreviewVersionClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PreviewVersionClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PreviewVersionClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PreviewVersionClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PreviewVersionClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PreviewVersionClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private PreviewVersionServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the PreviewVersionClientBuilder. + */ + @Generated + public PreviewVersionClientBuilder serviceVersion(PreviewVersionServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the PreviewVersionClientBuilder. + */ + @Generated + public PreviewVersionClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of PreviewVersionClientImpl with the provided parameters. + * + * @return an instance of PreviewVersionClientImpl. + */ + @Generated + private PreviewVersionClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + PreviewVersionServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : PreviewVersionServiceVersion.getLatest(); + PreviewVersionClientImpl client = new PreviewVersionClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of PreviewVersionAsyncClient class. + * + * @return an instance of PreviewVersionAsyncClient. + */ + @Generated + public PreviewVersionAsyncClient buildAsyncClient() { + return new PreviewVersionAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of PreviewVersionClient class. + * + * @return an instance of PreviewVersionClient. + */ + @Generated + public PreviewVersionClient buildClient() { + return new PreviewVersionClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(PreviewVersionClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionServiceVersion.java new file mode 100644 index 00000000000..c10088e0ec8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/PreviewVersionServiceVersion.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.versioning.previewversion; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of PreviewVersionClient. + */ +public enum PreviewVersionServiceVersion implements ServiceVersion { + /** + * Enum value 2024-01-01. + */ + V2024_01_01("2024-01-01"), + + /** + * Enum value 2024-06-01. + */ + V2024_06_01("2024-06-01"), + + /** + * Enum value 2024-12-01-preview. + */ + V2024_12_01_PREVIEW("2024-12-01-preview"); + + private final String version; + + PreviewVersionServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link PreviewVersionServiceVersion}. + */ + public static PreviewVersionServiceVersion getLatest() { + return V2024_12_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/JsonMergePatchHelper.java new file mode 100644 index 00000000000..d3cb05ef899 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/JsonMergePatchHelper.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.versioning.previewversion.implementation; + +import azure.versioning.previewversion.models.UpdateWidgetColorRequest; + +/** + * This is the Helper class to enable json merge patch serialization for a model. + */ +public class JsonMergePatchHelper { + private static UpdateWidgetColorRequestAccessor updateWidgetColorRequestAccessor; + + public interface UpdateWidgetColorRequestAccessor { + UpdateWidgetColorRequest prepareModelForJsonMergePatch(UpdateWidgetColorRequest updateWidgetColorRequest, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(UpdateWidgetColorRequest updateWidgetColorRequest); + } + + public static void setUpdateWidgetColorRequestAccessor(UpdateWidgetColorRequestAccessor accessor) { + updateWidgetColorRequestAccessor = accessor; + } + + public static UpdateWidgetColorRequestAccessor getUpdateWidgetColorRequestAccessor() { + return updateWidgetColorRequestAccessor; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/PreviewVersionClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/PreviewVersionClientImpl.java new file mode 100644 index 00000000000..0091fe4ea1c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/PreviewVersionClientImpl.java @@ -0,0 +1,429 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.versioning.previewversion.implementation; + +import azure.versioning.previewversion.PreviewVersionServiceVersion; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Patch; +import com.azure.core.annotation.PathParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the PreviewVersionClient type. + */ +public final class PreviewVersionClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PreviewVersionClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final PreviewVersionServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public PreviewVersionServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of PreviewVersionClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public PreviewVersionClientImpl(String endpoint, PreviewVersionServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of PreviewVersionClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public PreviewVersionClientImpl(HttpPipeline httpPipeline, String endpoint, + PreviewVersionServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of PreviewVersionClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public PreviewVersionClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + PreviewVersionServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service + = RestProxy.create(PreviewVersionClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for PreviewVersionClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "PreviewVersionClient") + public interface PreviewVersionClientService { + @Get("/azure/versioning/previewVersion/widgets/{id}") + @ExpectedResponses({ 200, 404 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getWidget(@HostParam("endpoint") String endpoint, @PathParam("id") String id, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/versioning/previewVersion/widgets/{id}") + @ExpectedResponses({ 200, 404 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getWidgetSync(@HostParam("endpoint") String endpoint, @PathParam("id") String id, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Patch("/azure/versioning/previewVersion/widgets/{id}/color") + @ExpectedResponses({ 200, 404 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateWidgetColor(@HostParam("endpoint") String endpoint, @PathParam("id") String id, + @HeaderParam("Content-Type") String contentType, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData colorUpdate, + RequestOptions requestOptions, Context context); + + @Patch("/azure/versioning/previewVersion/widgets/{id}/color") + @ExpectedResponses({ 200, 404 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateWidgetColorSync(@HostParam("endpoint") String endpoint, @PathParam("id") String id, + @HeaderParam("Content-Type") String contentType, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData colorUpdate, + RequestOptions requestOptions, Context context); + + @Get("/azure/versioning/previewVersion/widgets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listWidgets(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/azure/versioning/previewVersion/widgets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listWidgetsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * Get widget by id (available in all versions). + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return widget by id (available in all versions) along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWidgetWithResponseAsync(String id, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getWidget(this.getEndpoint(), id, + this.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * Get widget by id (available in all versions). + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return widget by id (available in all versions) along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWidgetWithResponse(String id, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getWidgetSync(this.getEndpoint(), id, this.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); + } + + /** + * Update widget color (preview only). + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     color: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param colorUpdate The colorUpdate parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a simple model for testing along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWidgetColorWithResponseAsync(String id, BinaryData colorUpdate, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updateWidgetColor(this.getEndpoint(), id, contentType, + this.getServiceVersion().getVersion(), accept, colorUpdate, requestOptions, context)); + } + + /** + * Update widget color (preview only). + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     color: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param colorUpdate The colorUpdate parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a simple model for testing along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWidgetColorWithResponse(String id, BinaryData colorUpdate, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.updateWidgetColorSync(this.getEndpoint(), id, contentType, this.getServiceVersion().getVersion(), + accept, colorUpdate, requestOptions, Context.NONE); + } + + /** + * List widgets with optional color filtering. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
nameStringNoThe name parameter
colorStringNoThe color parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     widgets (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             color: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWidgetsWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listWidgets(this.getEndpoint(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * List widgets with optional color filtering. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
nameStringNoThe name parameter
colorStringNoThe color parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     widgets (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             name: String (Required)
+     *             color: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWidgetsWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listWidgetsSync(this.getEndpoint(), this.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/package-info.java new file mode 100644 index 00000000000..3686447413c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for PreviewVersion. + * + */ +package azure.versioning.previewversion.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/ListWidgetsResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/ListWidgetsResponse.java new file mode 100644 index 00000000000..e135064bc76 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/ListWidgetsResponse.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.versioning.previewversion.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The ListWidgetsResponse model. + */ +@Immutable +public final class ListWidgetsResponse implements JsonSerializable { + /* + * The widgets property. + */ + @Generated + private final List widgets; + + /** + * Creates an instance of ListWidgetsResponse class. + * + * @param widgets the widgets value to set. + */ + @Generated + private ListWidgetsResponse(List widgets) { + this.widgets = widgets; + } + + /** + * Get the widgets property: The widgets property. + * + * @return the widgets value. + */ + @Generated + public List getWidgets() { + return this.widgets; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("widgets", this.widgets, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListWidgetsResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListWidgetsResponse if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ListWidgetsResponse. + */ + @Generated + public static ListWidgetsResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List widgets = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("widgets".equals(fieldName)) { + widgets = reader.readArray(reader1 -> Widget.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new ListWidgetsResponse(widgets); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/UpdateWidgetColorRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/UpdateWidgetColorRequest.java new file mode 100644 index 00000000000..f323e3ca9dc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/UpdateWidgetColorRequest.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.versioning.previewversion.models; + +import azure.versioning.previewversion.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Update widget color request. + */ +@Fluent +public final class UpdateWidgetColorRequest implements JsonSerializable { + /* + * New color for the widget. + */ + @Generated + private String color; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper + .setUpdateWidgetColorRequestAccessor(new JsonMergePatchHelper.UpdateWidgetColorRequestAccessor() { + @Override + public UpdateWidgetColorRequest prepareModelForJsonMergePatch(UpdateWidgetColorRequest model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(UpdateWidgetColorRequest model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of UpdateWidgetColorRequest class. + */ + @Generated + public UpdateWidgetColorRequest() { + } + + /** + * Get the color property: New color for the widget. + * + * @return the color value. + */ + @Generated + public String getColor() { + return this.color; + } + + /** + * Set the color property: New color for the widget. + *

Required when create the resource.

+ * + * @param color the color value to set. + * @return the UpdateWidgetColorRequest object itself. + */ + @Generated + public UpdateWidgetColorRequest setColor(String color) { + this.color = color; + this.updatedProperties.add("color"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("color", this.color); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("color")) { + if (this.color == null) { + jsonWriter.writeNullField("color"); + } else { + jsonWriter.writeStringField("color", this.color); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateWidgetColorRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateWidgetColorRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the UpdateWidgetColorRequest. + */ + @Generated + public static UpdateWidgetColorRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateWidgetColorRequest deserializedUpdateWidgetColorRequest = new UpdateWidgetColorRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("color".equals(fieldName)) { + deserializedUpdateWidgetColorRequest.color = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateWidgetColorRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/Widget.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/Widget.java new file mode 100644 index 00000000000..b1e6ab0a8ed --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/Widget.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.versioning.previewversion.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A simple model for testing. + */ +@Immutable +public final class Widget implements JsonSerializable { + /* + * Widget identifier. + */ + @Generated + private final String id; + + /* + * Widget name. + */ + @Generated + private final String name; + + /* + * Widget color, only available in preview version. + */ + @Generated + private String color; + + /** + * Creates an instance of Widget class. + * + * @param id the id value to set. + * @param name the name value to set. + */ + @Generated + private Widget(String id, String name) { + this.id = id; + this.name = name; + } + + /** + * Get the id property: Widget identifier. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: Widget name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the color property: Widget color, only available in preview version. + * + * @return the color value. + */ + @Generated + public String getColor() { + return this.color; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("color", this.color); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Widget from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Widget if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Widget. + */ + @Generated + public static Widget fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + String color = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("color".equals(fieldName)) { + color = reader.getString(); + } else { + reader.skipChildren(); + } + } + Widget deserializedWidget = new Widget(id, name); + deserializedWidget.color = color; + + return deserializedWidget; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/package-info.java new file mode 100644 index 00000000000..fa0e4b7c103 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for PreviewVersion. + * + */ +package azure.versioning.previewversion.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/package-info.java new file mode 100644 index 00000000000..39514290b33 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/azure/versioning/previewversion/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for PreviewVersion. + * + */ +package azure.versioning.previewversion; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstAsyncClient.java new file mode 100644 index 00000000000..6e716aaaf6f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstAsyncClient.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.clientnamespace; + +import client.clientnamespace.first.models.FirstClientResult; +import client.clientnamespace.implementation.ClientNamespaceFirstClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ClientNamespaceFirstClient type. + */ +@ServiceClient(builder = ClientNamespaceFirstClientBuilder.class, isAsync = true) +public final class ClientNamespaceFirstAsyncClient { + @Generated + private final ClientNamespaceFirstClientImpl serviceClient; + + /** + * Initializes an instance of ClientNamespaceFirstAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ClientNamespaceFirstAsyncClient(ClientNamespaceFirstClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getFirst operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFirstWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getFirstWithResponseAsync(requestOptions); + } + + /** + * The getFirst operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getFirst() { + // Generated convenience method for getFirstWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getFirstWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FirstClientResult.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClient.java new file mode 100644 index 00000000000..bc3370372d0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.clientnamespace; + +import client.clientnamespace.first.models.FirstClientResult; +import client.clientnamespace.implementation.ClientNamespaceFirstClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous ClientNamespaceFirstClient type. + */ +@ServiceClient(builder = ClientNamespaceFirstClientBuilder.class) +public final class ClientNamespaceFirstClient { + @Generated + private final ClientNamespaceFirstClientImpl serviceClient; + + /** + * Initializes an instance of ClientNamespaceFirstClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ClientNamespaceFirstClient(ClientNamespaceFirstClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getFirst operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFirstWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getFirstWithResponse(requestOptions); + } + + /** + * The getFirst operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FirstClientResult getFirst() { + // Generated convenience method for getFirstWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getFirstWithResponse(requestOptions).getValue().toObject(FirstClientResult.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClientBuilder.java new file mode 100644 index 00000000000..d5fdca507e5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/ClientNamespaceFirstClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.clientnamespace; + +import client.clientnamespace.implementation.ClientNamespaceFirstClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ClientNamespaceFirstClient type. + */ +@ServiceClientBuilder(serviceClients = { ClientNamespaceFirstClient.class, ClientNamespaceFirstAsyncClient.class }) +public final class ClientNamespaceFirstClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("client-clientnamespace.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ClientNamespaceFirstClientBuilder. + */ + @Generated + public ClientNamespaceFirstClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceFirstClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceFirstClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceFirstClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceFirstClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceFirstClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceFirstClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceFirstClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceFirstClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ClientNamespaceFirstClientBuilder. + */ + @Generated + public ClientNamespaceFirstClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ClientNamespaceFirstClientImpl with the provided parameters. + * + * @return an instance of ClientNamespaceFirstClientImpl. + */ + @Generated + private ClientNamespaceFirstClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ClientNamespaceFirstClientImpl client = new ClientNamespaceFirstClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ClientNamespaceFirstAsyncClient class. + * + * @return an instance of ClientNamespaceFirstAsyncClient. + */ + @Generated + public ClientNamespaceFirstAsyncClient buildAsyncClient() { + return new ClientNamespaceFirstAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ClientNamespaceFirstClient class. + * + * @return an instance of ClientNamespaceFirstClient. + */ + @Generated + public ClientNamespaceFirstClient buildClient() { + return new ClientNamespaceFirstClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientNamespaceFirstClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/FirstClientResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/FirstClientResult.java new file mode 100644 index 00000000000..13834159ebf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/FirstClientResult.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.clientnamespace.first.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The FirstClientResult model. + */ +@Immutable +public final class FirstClientResult implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of FirstClientResult class. + * + * @param name the name value to set. + */ + @Generated + private FirstClientResult(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirstClientResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirstClientResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FirstClientResult. + */ + @Generated + public static FirstClientResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new FirstClientResult(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/package-info.java new file mode 100644 index 00000000000..390a58aee36 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/first/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for ClientNamespace. + * Illustrates the clientNamespace cases. + * + */ +package client.clientnamespace.first.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceFirstClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceFirstClientImpl.java new file mode 100644 index 00000000000..176ea456391 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceFirstClientImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.clientnamespace.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ClientNamespaceFirstClient type. + */ +public final class ClientNamespaceFirstClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ClientNamespaceFirstClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of ClientNamespaceFirstClient client. + * + * @param endpoint Service host. + */ + public ClientNamespaceFirstClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ClientNamespaceFirstClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ClientNamespaceFirstClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ClientNamespaceFirstClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ClientNamespaceFirstClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(ClientNamespaceFirstClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ClientNamespaceFirstClient to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ClientNamespaceFirstClient") + public interface ClientNamespaceFirstClientService { + @Get("/client/client-namespace/first") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getFirst(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/client/client-namespace/first") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getFirstSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The getFirst operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFirstWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getFirst(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getFirst operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFirstWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getFirstSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceSecondClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceSecondClientImpl.java new file mode 100644 index 00000000000..043c1567d37 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/ClientNamespaceSecondClientImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.clientnamespace.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ClientNamespaceSecondClient type. + */ +public final class ClientNamespaceSecondClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ClientNamespaceSecondClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of ClientNamespaceSecondClient client. + * + * @param endpoint Service host. + */ + public ClientNamespaceSecondClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ClientNamespaceSecondClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ClientNamespaceSecondClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ClientNamespaceSecondClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ClientNamespaceSecondClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(ClientNamespaceSecondClientService.class, this.httpPipeline, + this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ClientNamespaceSecondClient to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ClientNamespaceSecondClient") + public interface ClientNamespaceSecondClientService { + @Get("/client/client-namespace/second") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getSecond(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/client/client-namespace/second") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSecondSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The getSecond operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     type: String(second) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSecondWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getSecond(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getSecond operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     type: String(second) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSecondWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSecondSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/package-info.java new file mode 100644 index 00000000000..cd067e55cee --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ClientNamespace. + * Illustrates the clientNamespace cases. + * + */ +package client.clientnamespace.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/package-info.java new file mode 100644 index 00000000000..32ea24a8ff2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ClientNamespace. + * Illustrates the clientNamespace cases. + * + */ +package client.clientnamespace; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondAsyncClient.java new file mode 100644 index 00000000000..8416dc8451e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondAsyncClient.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.clientnamespace.second; + +import client.clientnamespace.implementation.ClientNamespaceSecondClientImpl; +import client.clientnamespace.second.models.SecondClientResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ClientNamespaceSecondClient type. + */ +@ServiceClient(builder = ClientNamespaceSecondClientBuilder.class, isAsync = true) +public final class ClientNamespaceSecondAsyncClient { + @Generated + private final ClientNamespaceSecondClientImpl serviceClient; + + /** + * Initializes an instance of ClientNamespaceSecondAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ClientNamespaceSecondAsyncClient(ClientNamespaceSecondClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getSecond operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     type: String(second) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSecondWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getSecondWithResponseAsync(requestOptions); + } + + /** + * The getSecond operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getSecond() { + // Generated convenience method for getSecondWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getSecondWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SecondClientResult.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClient.java new file mode 100644 index 00000000000..afa387956fc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.clientnamespace.second; + +import client.clientnamespace.implementation.ClientNamespaceSecondClientImpl; +import client.clientnamespace.second.models.SecondClientResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous ClientNamespaceSecondClient type. + */ +@ServiceClient(builder = ClientNamespaceSecondClientBuilder.class) +public final class ClientNamespaceSecondClient { + @Generated + private final ClientNamespaceSecondClientImpl serviceClient; + + /** + * Initializes an instance of ClientNamespaceSecondClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ClientNamespaceSecondClient(ClientNamespaceSecondClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getSecond operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     type: String(second) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSecondWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getSecondWithResponse(requestOptions); + } + + /** + * The getSecond operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SecondClientResult getSecond() { + // Generated convenience method for getSecondWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getSecondWithResponse(requestOptions).getValue().toObject(SecondClientResult.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClientBuilder.java new file mode 100644 index 00000000000..f0898adc960 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/ClientNamespaceSecondClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.clientnamespace.second; + +import client.clientnamespace.implementation.ClientNamespaceSecondClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ClientNamespaceSecondClient type. + */ +@ServiceClientBuilder(serviceClients = { ClientNamespaceSecondClient.class, ClientNamespaceSecondAsyncClient.class }) +public final class ClientNamespaceSecondClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("client-clientnamespace.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ClientNamespaceSecondClientBuilder. + */ + @Generated + public ClientNamespaceSecondClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceSecondClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceSecondClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceSecondClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceSecondClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceSecondClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceSecondClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceSecondClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientNamespaceSecondClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ClientNamespaceSecondClientBuilder. + */ + @Generated + public ClientNamespaceSecondClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ClientNamespaceSecondClientImpl with the provided parameters. + * + * @return an instance of ClientNamespaceSecondClientImpl. + */ + @Generated + private ClientNamespaceSecondClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ClientNamespaceSecondClientImpl client = new ClientNamespaceSecondClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ClientNamespaceSecondAsyncClient class. + * + * @return an instance of ClientNamespaceSecondAsyncClient. + */ + @Generated + public ClientNamespaceSecondAsyncClient buildAsyncClient() { + return new ClientNamespaceSecondAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ClientNamespaceSecondClient class. + * + * @return an instance of ClientNamespaceSecondClient. + */ + @Generated + public ClientNamespaceSecondClient buildClient() { + return new ClientNamespaceSecondClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientNamespaceSecondClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/SecondClientResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/SecondClientResult.java new file mode 100644 index 00000000000..5e0324070d5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/SecondClientResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.clientnamespace.second.models; + +import client.clientnamespace.second.sub.models.SecondClientEnumType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SecondClientResult model. + */ +@Immutable +public final class SecondClientResult implements JsonSerializable { + /* + * The type property. + */ + @Generated + private final SecondClientEnumType type; + + /** + * Creates an instance of SecondClientResult class. + * + * @param type the type value to set. + */ + @Generated + private SecondClientResult(SecondClientEnumType type) { + this.type = type; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + @Generated + public SecondClientEnumType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecondClientResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecondClientResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecondClientResult. + */ + @Generated + public static SecondClientResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecondClientEnumType type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + type = SecondClientEnumType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new SecondClientResult(type); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/package-info.java new file mode 100644 index 00000000000..4c5d7b940ab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for ClientNamespace. + * Illustrates the clientNamespace cases. + * + */ +package client.clientnamespace.second.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/package-info.java new file mode 100644 index 00000000000..cd4f158ff59 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ClientNamespaceSecondClient. + * Illustrates the clientNamespace cases. + * + */ +package client.clientnamespace.second; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/SecondClientEnumType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/SecondClientEnumType.java new file mode 100644 index 00000000000..ba7b1afaf57 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/SecondClientEnumType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.clientnamespace.second.sub.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for SecondClientEnumType. + */ +public final class SecondClientEnumType extends ExpandableStringEnum { + /** + * Static value second for SecondClientEnumType. + */ + @Generated + public static final SecondClientEnumType SECOND = fromString("second"); + + /** + * Creates a new instance of SecondClientEnumType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SecondClientEnumType() { + } + + /** + * Creates or finds a SecondClientEnumType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecondClientEnumType. + */ + @Generated + public static SecondClientEnumType fromString(String name) { + return fromString(name, SecondClientEnumType.class); + } + + /** + * Gets known SecondClientEnumType values. + * + * @return known SecondClientEnumType values. + */ + @Generated + public static Collection values() { + return values(SecondClientEnumType.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/package-info.java new file mode 100644 index 00000000000..9082e6ae77b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/clientnamespace/second/sub/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for ClientNamespace. + * Illustrates the clientNamespace cases. + * + */ +package client.clientnamespace.second.sub.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelAsyncClient.java new file mode 100644 index 00000000000..60a41d100a2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelAsyncClient.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming; + +import client.naming.implementation.ModelClientsImpl; +import client.naming.model.models.ClientModel; +import client.naming.model.models.JavaModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous NamingClient type. + */ +@ServiceClient(builder = NamingClientBuilder.class, isAsync = true) +public final class ModelAsyncClient { + @Generated + private final ModelClientsImpl serviceClient; + + /** + * Initializes an instance of ModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelAsyncClient(ModelClientsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The client operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> clientWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.clientWithResponseAsync(body, requestOptions); + } + + /** + * The language operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> languageWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.languageWithResponseAsync(body, requestOptions); + } + + /** + * The client operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono client(ClientModel body) { + // Generated convenience method for clientWithResponse + RequestOptions requestOptions = new RequestOptions(); + return clientWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The language operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono language(JavaModel body) { + // Generated convenience method for languageWithResponse + RequestOptions requestOptions = new RequestOptions(); + return languageWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelClient.java new file mode 100644 index 00000000000..3f4b9cf9b76 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/ModelClient.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming; + +import client.naming.implementation.ModelClientsImpl; +import client.naming.model.models.ClientModel; +import client.naming.model.models.JavaModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous NamingClient type. + */ +@ServiceClient(builder = NamingClientBuilder.class) +public final class ModelClient { + @Generated + private final ModelClientsImpl serviceClient; + + /** + * Initializes an instance of ModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelClient(ModelClientsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The client operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response clientWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.clientWithResponse(body, requestOptions); + } + + /** + * The language operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response languageWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.languageWithResponse(body, requestOptions); + } + + /** + * The client operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void client(ClientModel body) { + // Generated convenience method for clientWithResponse + RequestOptions requestOptions = new RequestOptions(); + clientWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The language operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void language(JavaModel body) { + // Generated convenience method for languageWithResponse + RequestOptions requestOptions = new RequestOptions(); + languageWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingAsyncClient.java new file mode 100644 index 00000000000..29bdc3d4247 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingAsyncClient.java @@ -0,0 +1,323 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming; + +import client.naming.implementation.NamingClientImpl; +import client.naming.property.models.ClientNameAndJsonEncodedNameModel; +import client.naming.property.models.ClientNameModel; +import client.naming.property.models.LanguageClientNameModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous NamingClient type. + */ +@ServiceClient(builder = NamingClientBuilder.class, isAsync = true) +public final class NamingAsyncClient { + @Generated + private final NamingClientImpl serviceClient; + + /** + * Initializes an instance of NamingAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NamingAsyncClient(NamingClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The clientName operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> clientNameWithResponse(RequestOptions requestOptions) { + return this.serviceClient.clientNameWithResponseAsync(requestOptions); + } + + /** + * The parameter operation. + * + * @param clientName The clientName parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> parameterWithResponse(String clientName, RequestOptions requestOptions) { + return this.serviceClient.parameterWithResponseAsync(clientName, requestOptions); + } + + /** + * The client operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> clientWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.clientWithResponseAsync(body, requestOptions); + } + + /** + * The language operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> languageWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.languageWithResponseAsync(body, requestOptions); + } + + /** + * The compatibleWithEncodedName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     wireName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> compatibleWithEncodedNameWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.compatibleWithEncodedNameWithResponseAsync(body, requestOptions); + } + + /** + * The request operation. + * + * @param clientName The clientName parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requestWithResponse(String clientName, RequestOptions requestOptions) { + return this.serviceClient.requestWithResponseAsync(clientName, requestOptions); + } + + /** + * The response operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> responseWithResponse(RequestOptions requestOptions) { + return this.serviceClient.responseWithResponseAsync(requestOptions); + } + + /** + * The clientName operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono clientName() { + // Generated convenience method for clientNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + return clientNameWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The parameter operation. + * + * @param clientName The clientName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono parameter(String clientName) { + // Generated convenience method for parameterWithResponse + RequestOptions requestOptions = new RequestOptions(); + return parameterWithResponse(clientName, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The client operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono client(ClientNameModel body) { + // Generated convenience method for clientWithResponse + RequestOptions requestOptions = new RequestOptions(); + return clientWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The language operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono language(LanguageClientNameModel body) { + // Generated convenience method for languageWithResponse + RequestOptions requestOptions = new RequestOptions(); + return languageWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The compatibleWithEncodedName operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono compatibleWithEncodedName(ClientNameAndJsonEncodedNameModel body) { + // Generated convenience method for compatibleWithEncodedNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + return compatibleWithEncodedNameWithResponse(BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono); + } + + /** + * The request operation. + * + * @param clientName The clientName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono request(String clientName) { + // Generated convenience method for requestWithResponse + RequestOptions requestOptions = new RequestOptions(); + return requestWithResponse(clientName, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The response operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono response() { + // Generated convenience method for responseWithResponse + RequestOptions requestOptions = new RequestOptions(); + return responseWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClient.java new file mode 100644 index 00000000000..cbf0519ab3e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClient.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming; + +import client.naming.implementation.NamingClientImpl; +import client.naming.property.models.ClientNameAndJsonEncodedNameModel; +import client.naming.property.models.ClientNameModel; +import client.naming.property.models.LanguageClientNameModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous NamingClient type. + */ +@ServiceClient(builder = NamingClientBuilder.class) +public final class NamingClient { + @Generated + private final NamingClientImpl serviceClient; + + /** + * Initializes an instance of NamingClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NamingClient(NamingClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The clientName operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response clientNameWithResponse(RequestOptions requestOptions) { + return this.serviceClient.clientNameWithResponse(requestOptions); + } + + /** + * The parameter operation. + * + * @param clientName The clientName parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response parameterWithResponse(String clientName, RequestOptions requestOptions) { + return this.serviceClient.parameterWithResponse(clientName, requestOptions); + } + + /** + * The client operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response clientWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.clientWithResponse(body, requestOptions); + } + + /** + * The language operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response languageWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.languageWithResponse(body, requestOptions); + } + + /** + * The compatibleWithEncodedName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     wireName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response compatibleWithEncodedNameWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.compatibleWithEncodedNameWithResponse(body, requestOptions); + } + + /** + * The request operation. + * + * @param clientName The clientName parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requestWithResponse(String clientName, RequestOptions requestOptions) { + return this.serviceClient.requestWithResponse(clientName, requestOptions); + } + + /** + * The response operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response responseWithResponse(RequestOptions requestOptions) { + return this.serviceClient.responseWithResponse(requestOptions); + } + + /** + * The clientName operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void clientName() { + // Generated convenience method for clientNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + clientNameWithResponse(requestOptions).getValue(); + } + + /** + * The parameter operation. + * + * @param clientName The clientName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void parameter(String clientName) { + // Generated convenience method for parameterWithResponse + RequestOptions requestOptions = new RequestOptions(); + parameterWithResponse(clientName, requestOptions).getValue(); + } + + /** + * The client operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void client(ClientNameModel body) { + // Generated convenience method for clientWithResponse + RequestOptions requestOptions = new RequestOptions(); + clientWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The language operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void language(LanguageClientNameModel body) { + // Generated convenience method for languageWithResponse + RequestOptions requestOptions = new RequestOptions(); + languageWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The compatibleWithEncodedName operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void compatibleWithEncodedName(ClientNameAndJsonEncodedNameModel body) { + // Generated convenience method for compatibleWithEncodedNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + compatibleWithEncodedNameWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The request operation. + * + * @param clientName The clientName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void request(String clientName) { + // Generated convenience method for requestWithResponse + RequestOptions requestOptions = new RequestOptions(); + requestWithResponse(clientName, requestOptions).getValue(); + } + + /** + * The response operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void response() { + // Generated convenience method for responseWithResponse + RequestOptions requestOptions = new RequestOptions(); + responseWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClientBuilder.java new file mode 100644 index 00000000000..e03f6a58db2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/NamingClientBuilder.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming; + +import client.naming.implementation.NamingClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the NamingClient type. + */ +@ServiceClientBuilder( + serviceClients = { + NamingClient.class, + ModelClient.class, + UnionEnumClient.class, + NamingAsyncClient.class, + ModelAsyncClient.class, + UnionEnumAsyncClient.class }) +public final class NamingClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("client-naming.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the NamingClientBuilder. + */ + @Generated + public NamingClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the NamingClientBuilder. + */ + @Generated + public NamingClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of NamingClientImpl with the provided parameters. + * + * @return an instance of NamingClientImpl. + */ + @Generated + private NamingClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + NamingClientImpl client + = new NamingClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of NamingAsyncClient class. + * + * @return an instance of NamingAsyncClient. + */ + @Generated + public NamingAsyncClient buildAsyncClient() { + return new NamingAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ModelAsyncClient class. + * + * @return an instance of ModelAsyncClient. + */ + @Generated + public ModelAsyncClient buildModelAsyncClient() { + return new ModelAsyncClient(buildInnerClient().getModelClients()); + } + + /** + * Builds an instance of UnionEnumAsyncClient class. + * + * @return an instance of UnionEnumAsyncClient. + */ + @Generated + public UnionEnumAsyncClient buildUnionEnumAsyncClient() { + return new UnionEnumAsyncClient(buildInnerClient().getUnionEnums()); + } + + /** + * Builds an instance of NamingClient class. + * + * @return an instance of NamingClient. + */ + @Generated + public NamingClient buildClient() { + return new NamingClient(buildInnerClient()); + } + + /** + * Builds an instance of ModelClient class. + * + * @return an instance of ModelClient. + */ + @Generated + public ModelClient buildModelClient() { + return new ModelClient(buildInnerClient().getModelClients()); + } + + /** + * Builds an instance of UnionEnumClient class. + * + * @return an instance of UnionEnumClient. + */ + @Generated + public UnionEnumClient buildUnionEnumClient() { + return new UnionEnumClient(buildInnerClient().getUnionEnums()); + } + + private static final ClientLogger LOGGER = new ClientLogger(NamingClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumAsyncClient.java new file mode 100644 index 00000000000..2358fd7b6cc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumAsyncClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming; + +import client.naming.implementation.UnionEnumsImpl; +import client.naming.unionenum.models.ClientExtensibleEnum; +import client.naming.unionenum.models.ExtensibleEnum; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous NamingClient type. + */ +@ServiceClient(builder = NamingClientBuilder.class, isAsync = true) +public final class UnionEnumAsyncClient { + @Generated + private final UnionEnumsImpl serviceClient; + + /** + * Initializes an instance of UnionEnumAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionEnumAsyncClient(UnionEnumsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The unionEnumName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(value1)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unionEnumNameWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.unionEnumNameWithResponseAsync(body, requestOptions); + } + + /** + * The unionEnumMemberName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(value1/value2)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unionEnumMemberNameWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.unionEnumMemberNameWithResponseAsync(body, requestOptions); + } + + /** + * The unionEnumName operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono unionEnumName(ClientExtensibleEnum body) { + // Generated convenience method for unionEnumNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + return unionEnumNameWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) + .flatMap(FluxUtil::toMono); + } + + /** + * The unionEnumMemberName operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono unionEnumMemberName(ExtensibleEnum body) { + // Generated convenience method for unionEnumMemberNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + return unionEnumMemberNameWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), + requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumClient.java new file mode 100644 index 00000000000..03e85a8cf15 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/UnionEnumClient.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming; + +import client.naming.implementation.UnionEnumsImpl; +import client.naming.unionenum.models.ClientExtensibleEnum; +import client.naming.unionenum.models.ExtensibleEnum; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous NamingClient type. + */ +@ServiceClient(builder = NamingClientBuilder.class) +public final class UnionEnumClient { + @Generated + private final UnionEnumsImpl serviceClient; + + /** + * Initializes an instance of UnionEnumClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionEnumClient(UnionEnumsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The unionEnumName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(value1)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unionEnumNameWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.unionEnumNameWithResponse(body, requestOptions); + } + + /** + * The unionEnumMemberName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(value1/value2)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unionEnumMemberNameWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.unionEnumMemberNameWithResponse(body, requestOptions); + } + + /** + * The unionEnumName operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void unionEnumName(ClientExtensibleEnum body) { + // Generated convenience method for unionEnumNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + unionEnumNameWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) + .getValue(); + } + + /** + * The unionEnumMemberName operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void unionEnumMemberName(ExtensibleEnum body) { + // Generated convenience method for unionEnumMemberNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + unionEnumMemberNameWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) + .getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/EnumConflictClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/EnumConflictClientBuilder.java new file mode 100644 index 00000000000..c38546f3d39 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/EnumConflictClientBuilder.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict; + +import client.naming.enumconflict.implementation.EnumConflictClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the EnumConflictClient type. + */ +@ServiceClientBuilder( + serviceClients = { + FirstOperationsClient.class, + SecondOperationsClient.class, + FirstOperationsAsyncClient.class, + SecondOperationsAsyncClient.class }) +public final class EnumConflictClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("client-naming-enumconflict.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the EnumConflictClientBuilder. + */ + @Generated + public EnumConflictClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumConflictClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumConflictClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumConflictClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumConflictClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumConflictClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumConflictClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumConflictClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumConflictClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the EnumConflictClientBuilder. + */ + @Generated + public EnumConflictClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of EnumConflictClientImpl with the provided parameters. + * + * @return an instance of EnumConflictClientImpl. + */ + @Generated + private EnumConflictClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + EnumConflictClientImpl client + = new EnumConflictClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of FirstOperationsAsyncClient class. + * + * @return an instance of FirstOperationsAsyncClient. + */ + @Generated + public FirstOperationsAsyncClient buildFirstOperationsAsyncClient() { + return new FirstOperationsAsyncClient(buildInnerClient().getFirstOperations()); + } + + /** + * Builds an instance of SecondOperationsAsyncClient class. + * + * @return an instance of SecondOperationsAsyncClient. + */ + @Generated + public SecondOperationsAsyncClient buildSecondOperationsAsyncClient() { + return new SecondOperationsAsyncClient(buildInnerClient().getSecondOperations()); + } + + /** + * Builds an instance of FirstOperationsClient class. + * + * @return an instance of FirstOperationsClient. + */ + @Generated + public FirstOperationsClient buildFirstOperationsClient() { + return new FirstOperationsClient(buildInnerClient().getFirstOperations()); + } + + /** + * Builds an instance of SecondOperationsClient class. + * + * @return an instance of SecondOperationsClient. + */ + @Generated + public SecondOperationsClient buildSecondOperationsClient() { + return new SecondOperationsClient(buildInnerClient().getSecondOperations()); + } + + private static final ClientLogger LOGGER = new ClientLogger(EnumConflictClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsAsyncClient.java new file mode 100644 index 00000000000..ccb9355039f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsAsyncClient.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict; + +import client.naming.enumconflict.firstnamespace.models.FirstModel; +import client.naming.enumconflict.implementation.FirstOperationsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous EnumConflictClient type. + */ +@ServiceClient(builder = EnumConflictClientBuilder.class, isAsync = true) +public final class FirstOperationsAsyncClient { + @Generated + private final FirstOperationsImpl serviceClient; + + /** + * Initializes an instance of FirstOperationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FirstOperationsAsyncClient(FirstOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Operation using first namespace Status enum. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(active/inactive) (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(active/inactive) (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> firstWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.firstWithResponseAsync(body, requestOptions); + } + + /** + * Operation using first namespace Status enum. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono first(FirstModel body) { + // Generated convenience method for firstWithResponse + RequestOptions requestOptions = new RequestOptions(); + return firstWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FirstModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsClient.java new file mode 100644 index 00000000000..a698dc1ed77 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/FirstOperationsClient.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict; + +import client.naming.enumconflict.firstnamespace.models.FirstModel; +import client.naming.enumconflict.implementation.FirstOperationsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous EnumConflictClient type. + */ +@ServiceClient(builder = EnumConflictClientBuilder.class) +public final class FirstOperationsClient { + @Generated + private final FirstOperationsImpl serviceClient; + + /** + * Initializes an instance of FirstOperationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FirstOperationsClient(FirstOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Operation using first namespace Status enum. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(active/inactive) (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(active/inactive) (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response firstWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.firstWithResponse(body, requestOptions); + } + + /** + * Operation using first namespace Status enum. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FirstModel first(FirstModel body) { + // Generated convenience method for firstWithResponse + RequestOptions requestOptions = new RequestOptions(); + return firstWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(FirstModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsAsyncClient.java new file mode 100644 index 00000000000..6fc39a90bf3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsAsyncClient.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict; + +import client.naming.enumconflict.implementation.SecondOperationsImpl; +import client.naming.enumconflict.secondnamespace.models.SecondModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous EnumConflictClient type. + */ +@ServiceClient(builder = EnumConflictClientBuilder.class, isAsync = true) +public final class SecondOperationsAsyncClient { + @Generated + private final SecondOperationsImpl serviceClient; + + /** + * Initializes an instance of SecondOperationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SecondOperationsAsyncClient(SecondOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Operation using second namespace Status enum. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(running/stopped) (Required)
+     *     description: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(running/stopped) (Required)
+     *     description: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> secondWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.secondWithResponseAsync(body, requestOptions); + } + + /** + * Operation using second namespace Status enum. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono second(SecondModel body) { + // Generated convenience method for secondWithResponse + RequestOptions requestOptions = new RequestOptions(); + return secondWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SecondModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsClient.java new file mode 100644 index 00000000000..0b716104ab0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/SecondOperationsClient.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict; + +import client.naming.enumconflict.implementation.SecondOperationsImpl; +import client.naming.enumconflict.secondnamespace.models.SecondModel; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous EnumConflictClient type. + */ +@ServiceClient(builder = EnumConflictClientBuilder.class) +public final class SecondOperationsClient { + @Generated + private final SecondOperationsImpl serviceClient; + + /** + * Initializes an instance of SecondOperationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SecondOperationsClient(SecondOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Operation using second namespace Status enum. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(running/stopped) (Required)
+     *     description: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(running/stopped) (Required)
+     *     description: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response secondWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.secondWithResponse(body, requestOptions); + } + + /** + * Operation using second namespace Status enum. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SecondModel second(SecondModel body) { + // Generated convenience method for secondWithResponse + RequestOptions requestOptions = new RequestOptions(); + return secondWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(SecondModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/FirstModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/FirstModel.java new file mode 100644 index 00000000000..82c2179189c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/FirstModel.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict.firstnamespace.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The FirstModel model. + */ +@Immutable +public final class FirstModel implements JsonSerializable { + /* + * Status from first namespace + */ + @Generated + private final Status status; + + /* + * Name of the item + */ + @Generated + private final String name; + + /** + * Creates an instance of FirstModel class. + * + * @param status the status value to set. + * @param name the name value to set. + */ + @Generated + public FirstModel(Status status, String name) { + this.status = status; + this.name = name; + } + + /** + * Get the status property: Status from first namespace. + * + * @return the status value. + */ + @Generated + public Status getStatus() { + return this.status; + } + + /** + * Get the name property: Name of the item. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirstModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirstModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FirstModel. + */ + @Generated + public static FirstModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Status status = null; + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + status = Status.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new FirstModel(status, name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/Status.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/Status.java new file mode 100644 index 00000000000..ea02703277c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/Status.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict.firstnamespace.models; + +/** + * Status enum in first namespace. + */ +public enum Status { + /** + * Active status. + */ + ACTIVE("active"), + + /** + * Inactive status. + */ + INACTIVE("inactive"); + + /** + * The actual serialized value for a Status instance. + */ + private final String value; + + Status(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Status instance. + * + * @param value the serialized value to parse. + * @return the parsed Status object, or null if unable to parse. + */ + public static Status fromString(String value) { + if (value == null) { + return null; + } + Status[] items = Status.values(); + for (Status item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/package-info.java new file mode 100644 index 00000000000..0e29e362189 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/firstnamespace/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for EnumConflict. + * Test for enum with same name in different namespace. + * + */ +package client.naming.enumconflict.firstnamespace.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/EnumConflictClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/EnumConflictClientImpl.java new file mode 100644 index 00000000000..6158a0d0222 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/EnumConflictClientImpl.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 EnumConflictClient type. + */ +public final class EnumConflictClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 FirstOperationsImpl object to access its operations. + */ + private final FirstOperationsImpl firstOperations; + + /** + * Gets the FirstOperationsImpl object to access its operations. + * + * @return the FirstOperationsImpl object. + */ + public FirstOperationsImpl getFirstOperations() { + return this.firstOperations; + } + + /** + * The SecondOperationsImpl object to access its operations. + */ + private final SecondOperationsImpl secondOperations; + + /** + * Gets the SecondOperationsImpl object to access its operations. + * + * @return the SecondOperationsImpl object. + */ + public SecondOperationsImpl getSecondOperations() { + return this.secondOperations; + } + + /** + * Initializes an instance of EnumConflictClient client. + * + * @param endpoint Service host. + */ + public EnumConflictClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of EnumConflictClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public EnumConflictClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of EnumConflictClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public EnumConflictClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.firstOperations = new FirstOperationsImpl(this); + this.secondOperations = new SecondOperationsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/FirstOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/FirstOperationsImpl.java new file mode 100644 index 00000000000..cfe052925ce --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/FirstOperationsImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FirstOperations. + */ +public final class FirstOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FirstOperationsService service; + + /** + * The service client containing this operation class. + */ + private final EnumConflictClientImpl client; + + /** + * Initializes an instance of FirstOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FirstOperationsImpl(EnumConflictClientImpl client) { + this.service + = RestProxy.create(FirstOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for EnumConflictClientFirstOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "EnumConflictClientFirstOperations") + public interface FirstOperationsService { + @Post("/client/naming/enum-conflict/first") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> first(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/client/naming/enum-conflict/first") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response firstSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Operation using first namespace Status enum. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(active/inactive) (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(active/inactive) (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> firstWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.first(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * Operation using first namespace Status enum. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(active/inactive) (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(active/inactive) (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response firstWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.firstSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/SecondOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/SecondOperationsImpl.java new file mode 100644 index 00000000000..a476c4346db --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/SecondOperationsImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SecondOperations. + */ +public final class SecondOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SecondOperationsService service; + + /** + * The service client containing this operation class. + */ + private final EnumConflictClientImpl client; + + /** + * Initializes an instance of SecondOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecondOperationsImpl(EnumConflictClientImpl client) { + this.service + = RestProxy.create(SecondOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for EnumConflictClientSecondOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "EnumConflictClientSecondOperations") + public interface SecondOperationsService { + @Post("/client/naming/enum-conflict/second") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> second(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/client/naming/enum-conflict/second") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response secondSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Operation using second namespace Status enum. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(running/stopped) (Required)
+     *     description: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(running/stopped) (Required)
+     *     description: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> secondWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.second(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * Operation using second namespace Status enum. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(running/stopped) (Required)
+     *     description: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     status: String(running/stopped) (Required)
+     *     description: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response secondWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.secondSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/package-info.java new file mode 100644 index 00000000000..2d20601fc1e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for EnumConflict. + * Test for enum with same name in different namespace. + * + */ +package client.naming.enumconflict.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/package-info.java new file mode 100644 index 00000000000..db349530152 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for EnumConflict. + * Test for enum with same name in different namespace. + * + */ +package client.naming.enumconflict; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondModel.java new file mode 100644 index 00000000000..b4c3f670f85 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondModel.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict.secondnamespace.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SecondModel model. + */ +@Immutable +public final class SecondModel implements JsonSerializable { + /* + * Status from second namespace + */ + @Generated + private final SecondStatus status; + + /* + * Description of the item + */ + @Generated + private final String description; + + /** + * Creates an instance of SecondModel class. + * + * @param status the status value to set. + * @param description the description value to set. + */ + @Generated + public SecondModel(SecondStatus status, String description) { + this.status = status; + this.description = description; + } + + /** + * Get the status property: Status from second namespace. + * + * @return the status value. + */ + @Generated + public SecondStatus getStatus() { + return this.status; + } + + /** + * Get the description property: Description of the item. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecondModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecondModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecondModel. + */ + @Generated + public static SecondModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecondStatus status = null; + String description = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + status = SecondStatus.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new SecondModel(status, description); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondStatus.java new file mode 100644 index 00000000000..5482b3ae7f1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/SecondStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict.secondnamespace.models; + +/** + * Status enum in second namespace. + */ +public enum SecondStatus { + /** + * Running status. + */ + RUNNING("running"), + + /** + * Stopped status. + */ + STOPPED("stopped"); + + /** + * The actual serialized value for a SecondStatus instance. + */ + private final String value; + + SecondStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecondStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed SecondStatus object, or null if unable to parse. + */ + public static SecondStatus fromString(String value) { + if (value == null) { + return null; + } + SecondStatus[] items = SecondStatus.values(); + for (SecondStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/package-info.java new file mode 100644 index 00000000000..5d69741fbf6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/enumconflict/secondnamespace/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for EnumConflict. + * Test for enum with same name in different namespace. + * + */ +package client.naming.enumconflict.secondnamespace.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/ModelClientsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/ModelClientsImpl.java new file mode 100644 index 00000000000..1cb2f4e947f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/ModelClientsImpl.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ModelClients. + */ +public final class ModelClientsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ModelClientsService service; + + /** + * The service client containing this operation class. + */ + private final NamingClientImpl client; + + /** + * Initializes an instance of ModelClientsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ModelClientsImpl(NamingClientImpl client) { + this.service + = RestProxy.create(ModelClientsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NamingClientModelClients to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NamingClientModelClients") + public interface ModelClientsService { + @Post("/client/naming/model/client") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> client(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/client/naming/model/client") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response clientSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/client/naming/model/language") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> language(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/client/naming/model/language") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response languageSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The client operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> clientWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.client(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The client operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response clientWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.clientSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The language operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> languageWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.language(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The language operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response languageWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.languageSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/NamingClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/NamingClientImpl.java new file mode 100644 index 00000000000..e1555932b3d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/NamingClientImpl.java @@ -0,0 +1,577 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the NamingClient type. + */ +public final class NamingClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NamingClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 ModelClientsImpl object to access its operations. + */ + private final ModelClientsImpl modelClients; + + /** + * Gets the ModelClientsImpl object to access its operations. + * + * @return the ModelClientsImpl object. + */ + public ModelClientsImpl getModelClients() { + return this.modelClients; + } + + /** + * The UnionEnumsImpl object to access its operations. + */ + private final UnionEnumsImpl unionEnums; + + /** + * Gets the UnionEnumsImpl object to access its operations. + * + * @return the UnionEnumsImpl object. + */ + public UnionEnumsImpl getUnionEnums() { + return this.unionEnums; + } + + /** + * Initializes an instance of NamingClient client. + * + * @param endpoint Service host. + */ + public NamingClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NamingClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public NamingClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NamingClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public NamingClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.modelClients = new ModelClientsImpl(this); + this.unionEnums = new UnionEnumsImpl(this); + this.service = RestProxy.create(NamingClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for NamingClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NamingClient") + public interface NamingClientService { + @Post("/client/naming/operation") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> clientName(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Post("/client/naming/operation") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response clientNameSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Post("/client/naming/parameter") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> parameter(@HostParam("endpoint") String endpoint, + @QueryParam("defaultName") String clientName, RequestOptions requestOptions, Context context); + + @Post("/client/naming/parameter") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response parameterSync(@HostParam("endpoint") String endpoint, + @QueryParam("defaultName") String clientName, RequestOptions requestOptions, Context context); + + @Post("/client/naming/property/client") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> client(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/client/naming/property/client") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response clientSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/client/naming/property/language") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> language(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/client/naming/property/language") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response languageSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/client/naming/property/compatible-with-encoded-name") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> compatibleWithEncodedName(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/client/naming/property/compatible-with-encoded-name") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response compatibleWithEncodedNameSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/client/naming/header") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> request(@HostParam("endpoint") String endpoint, + @HeaderParam("default-name") String clientName, RequestOptions requestOptions, Context context); + + @Post("/client/naming/header") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response requestSync(@HostParam("endpoint") String endpoint, + @HeaderParam("default-name") String clientName, RequestOptions requestOptions, Context context); + + @Get("/client/naming/header") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> response(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/client/naming/header") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response responseSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The clientName operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> clientNameWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.clientName(this.getEndpoint(), requestOptions, context)); + } + + /** + * The clientName operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response clientNameWithResponse(RequestOptions requestOptions) { + return service.clientNameSync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The parameter operation. + * + * @param clientName The clientName parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> parameterWithResponseAsync(String clientName, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.parameter(this.getEndpoint(), clientName, requestOptions, context)); + } + + /** + * The parameter operation. + * + * @param clientName The clientName parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response parameterWithResponse(String clientName, RequestOptions requestOptions) { + return service.parameterSync(this.getEndpoint(), clientName, requestOptions, Context.NONE); + } + + /** + * The client operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> clientWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.client(this.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The client operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response clientWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.clientSync(this.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The language operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> languageWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.language(this.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The language operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     defaultName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response languageWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.languageSync(this.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The compatibleWithEncodedName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     wireName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> compatibleWithEncodedNameWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.compatibleWithEncodedName(this.getEndpoint(), contentType, body, + requestOptions, context)); + } + + /** + * The compatibleWithEncodedName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     wireName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response compatibleWithEncodedNameWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.compatibleWithEncodedNameSync(this.getEndpoint(), contentType, body, requestOptions, + Context.NONE); + } + + /** + * The request operation. + * + * @param clientName The clientName parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requestWithResponseAsync(String clientName, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.request(this.getEndpoint(), clientName, requestOptions, context)); + } + + /** + * The request operation. + * + * @param clientName The clientName parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requestWithResponse(String clientName, RequestOptions requestOptions) { + return service.requestSync(this.getEndpoint(), clientName, requestOptions, Context.NONE); + } + + /** + * The response operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> responseWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.response(this.getEndpoint(), requestOptions, context)); + } + + /** + * The response operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response responseWithResponse(RequestOptions requestOptions) { + return service.responseSync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/UnionEnumsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/UnionEnumsImpl.java new file mode 100644 index 00000000000..ff1a14540e2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/UnionEnumsImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnionEnums. + */ +public final class UnionEnumsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnionEnumsService service; + + /** + * The service client containing this operation class. + */ + private final NamingClientImpl client; + + /** + * Initializes an instance of UnionEnumsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnionEnumsImpl(NamingClientImpl client) { + this.service + = RestProxy.create(UnionEnumsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NamingClientUnionEnums to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NamingClientUnionEnums") + public interface UnionEnumsService { + @Post("/client/naming/union-enum/union-enum-name") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> unionEnumName(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/client/naming/union-enum/union-enum-name") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response unionEnumNameSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/client/naming/union-enum/union-enum-member-name") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> unionEnumMemberName(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/client/naming/union-enum/union-enum-member-name") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response unionEnumMemberNameSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The unionEnumName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(value1)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unionEnumNameWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.unionEnumName(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The unionEnumName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(value1)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unionEnumNameWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.unionEnumNameSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The unionEnumMemberName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(value1/value2)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unionEnumMemberNameWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.unionEnumMemberName(this.client.getEndpoint(), contentType, body, + requestOptions, context)); + } + + /** + * The unionEnumMemberName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(value1/value2)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unionEnumMemberNameWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.unionEnumMemberNameSync(this.client.getEndpoint(), contentType, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/package-info.java new file mode 100644 index 00000000000..1649f4ca942 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Naming. + * Describe changing names of types in a client with `@clientName`. + * + */ +package client.naming.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/ClientModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/ClientModel.java new file mode 100644 index 00000000000..7431caa7fa4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/ClientModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ClientModel model. + */ +@Immutable +public final class ClientModel implements JsonSerializable { + /* + * Pass in true + */ + @Generated + private final boolean defaultName; + + /** + * Creates an instance of ClientModel class. + * + * @param defaultName the defaultName value to set. + */ + @Generated + public ClientModel(boolean defaultName) { + this.defaultName = defaultName; + } + + /** + * Get the defaultName property: Pass in true. + * + * @return the defaultName value. + */ + @Generated + public boolean isDefaultName() { + return this.defaultName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("defaultName", this.defaultName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ClientModel. + */ + @Generated + public static ClientModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean defaultName = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("defaultName".equals(fieldName)) { + defaultName = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new ClientModel(defaultName); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/JavaModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/JavaModel.java new file mode 100644 index 00000000000..971d3ee18dd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/JavaModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The JavaModel model. + */ +@Immutable +public final class JavaModel implements JsonSerializable { + /* + * Pass in true + */ + @Generated + private final boolean defaultName; + + /** + * Creates an instance of JavaModel class. + * + * @param defaultName the defaultName value to set. + */ + @Generated + public JavaModel(boolean defaultName) { + this.defaultName = defaultName; + } + + /** + * Get the defaultName property: Pass in true. + * + * @return the defaultName value. + */ + @Generated + public boolean isDefaultName() { + return this.defaultName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("defaultName", this.defaultName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JavaModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JavaModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JavaModel. + */ + @Generated + public static JavaModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean defaultName = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("defaultName".equals(fieldName)) { + defaultName = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new JavaModel(defaultName); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/package-info.java new file mode 100644 index 00000000000..03534784dfe --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/model/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Naming. + * Describe changing names of types in a client with `@clientName`. + * + */ +package client.naming.model.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/package-info.java new file mode 100644 index 00000000000..10dadebbad5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Naming. + * Describe changing names of types in a client with `@clientName`. + * + */ +package client.naming; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameAndJsonEncodedNameModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameAndJsonEncodedNameModel.java new file mode 100644 index 00000000000..97269505cef --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameAndJsonEncodedNameModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ClientNameAndJsonEncodedNameModel model. + */ +@Immutable +public final class ClientNameAndJsonEncodedNameModel implements JsonSerializable { + /* + * Pass in true + */ + @Generated + private final boolean clientName; + + /** + * Creates an instance of ClientNameAndJsonEncodedNameModel class. + * + * @param clientName the clientName value to set. + */ + @Generated + public ClientNameAndJsonEncodedNameModel(boolean clientName) { + this.clientName = clientName; + } + + /** + * Get the clientName property: Pass in true. + * + * @return the clientName value. + */ + @Generated + public boolean isClientName() { + return this.clientName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("wireName", this.clientName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientNameAndJsonEncodedNameModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientNameAndJsonEncodedNameModel if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ClientNameAndJsonEncodedNameModel. + */ + @Generated + public static ClientNameAndJsonEncodedNameModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean clientName = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("wireName".equals(fieldName)) { + clientName = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new ClientNameAndJsonEncodedNameModel(clientName); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameModel.java new file mode 100644 index 00000000000..141d72e9d3e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/ClientNameModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ClientNameModel model. + */ +@Immutable +public final class ClientNameModel implements JsonSerializable { + /* + * Pass in true + */ + @Generated + private final boolean clientName; + + /** + * Creates an instance of ClientNameModel class. + * + * @param clientName the clientName value to set. + */ + @Generated + public ClientNameModel(boolean clientName) { + this.clientName = clientName; + } + + /** + * Get the clientName property: Pass in true. + * + * @return the clientName value. + */ + @Generated + public boolean isClientName() { + return this.clientName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("defaultName", this.clientName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClientNameModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClientNameModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ClientNameModel. + */ + @Generated + public static ClientNameModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean clientName = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("defaultName".equals(fieldName)) { + clientName = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new ClientNameModel(clientName); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/LanguageClientNameModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/LanguageClientNameModel.java new file mode 100644 index 00000000000..741edaafea8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/LanguageClientNameModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The LanguageClientNameModel model. + */ +@Immutable +public final class LanguageClientNameModel implements JsonSerializable { + /* + * Pass in true + */ + @Generated + private final boolean javaName; + + /** + * Creates an instance of LanguageClientNameModel class. + * + * @param javaName the javaName value to set. + */ + @Generated + public LanguageClientNameModel(boolean javaName) { + this.javaName = javaName; + } + + /** + * Get the javaName property: Pass in true. + * + * @return the javaName value. + */ + @Generated + public boolean isJavaName() { + return this.javaName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("defaultName", this.javaName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LanguageClientNameModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LanguageClientNameModel if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the LanguageClientNameModel. + */ + @Generated + public static LanguageClientNameModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean javaName = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("defaultName".equals(fieldName)) { + javaName = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new LanguageClientNameModel(javaName); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/package-info.java new file mode 100644 index 00000000000..46e5eab569f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/property/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Naming. + * Describe changing names of types in a client with `@clientName`. + * + */ +package client.naming.property.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ClientExtensibleEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ClientExtensibleEnum.java new file mode 100644 index 00000000000..b1d54c85a8c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ClientExtensibleEnum.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.unionenum.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ClientExtensibleEnum. + */ +public final class ClientExtensibleEnum extends ExpandableStringEnum { + /** + * Static value value1 for ClientExtensibleEnum. + */ + @Generated + public static final ClientExtensibleEnum ENUM_VALUE1 = fromString("value1"); + + /** + * Creates a new instance of ClientExtensibleEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ClientExtensibleEnum() { + } + + /** + * Creates or finds a ClientExtensibleEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding ClientExtensibleEnum. + */ + @Generated + public static ClientExtensibleEnum fromString(String name) { + return fromString(name, ClientExtensibleEnum.class); + } + + /** + * Gets known ClientExtensibleEnum values. + * + * @return known ClientExtensibleEnum values. + */ + @Generated + public static Collection values() { + return values(ClientExtensibleEnum.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ExtensibleEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ExtensibleEnum.java new file mode 100644 index 00000000000..e73fab6c92d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/ExtensibleEnum.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.unionenum.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ExtensibleEnum. + */ +public final class ExtensibleEnum extends ExpandableStringEnum { + /** + * Static value value1 for ExtensibleEnum. + */ + @Generated + public static final ExtensibleEnum CLIENT_ENUM_VALUE1 = fromString("value1"); + + /** + * Static value value2 for ExtensibleEnum. + */ + @Generated + public static final ExtensibleEnum CLIENT_ENUM_VALUE2 = fromString("value2"); + + /** + * Creates a new instance of ExtensibleEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ExtensibleEnum() { + } + + /** + * Creates or finds a ExtensibleEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExtensibleEnum. + */ + @Generated + public static ExtensibleEnum fromString(String name) { + return fromString(name, ExtensibleEnum.class); + } + + /** + * Gets known ExtensibleEnum values. + * + * @return known ExtensibleEnum values. + */ + @Generated + public static Collection values() { + return values(ExtensibleEnum.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/package-info.java new file mode 100644 index 00000000000..9b23ebed4b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/naming/unionenum/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Naming. + * Describe changing names of types in a client with `@clientName`. + * + */ +package client.naming.unionenum.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadAsyncClient.java new file mode 100644 index 00000000000..6a924ff84c7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadAsyncClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.overload; + +import client.overload.implementation.OverloadClientImpl; +import client.overload.models.Resource; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous OverloadClient type. + */ +@ServiceClient(builder = OverloadClientBuilder.class, isAsync = true) +public final class OverloadAsyncClient { + @Generated + private final OverloadClientImpl serviceClient; + + /** + * Initializes an instance of OverloadAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + OverloadAsyncClient(OverloadClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The list operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         scope: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listWithResponseAsync(requestOptions); + } + + /** + * The listByScope operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         scope: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param scope The scope parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listByScopeWithResponse(String scope, RequestOptions requestOptions) { + return this.serviceClient.listByScopeWithResponseAsync(scope, requestOptions); + } + + /** + * The list operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> list() { + // Generated convenience method for listWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_RESOURCE)); + } + + /** + * The listByScope operation. + * + * @param scope The scope parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listByScope(String scope) { + // Generated convenience method for listByScopeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listByScopeWithResponse(scope, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_RESOURCE)); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_RESOURCE + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClient.java new file mode 100644 index 00000000000..58592ca3f24 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClient.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.overload; + +import client.overload.implementation.OverloadClientImpl; +import client.overload.models.Resource; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; + +/** + * Initializes a new instance of the synchronous OverloadClient type. + */ +@ServiceClient(builder = OverloadClientBuilder.class) +public final class OverloadClient { + @Generated + private final OverloadClientImpl serviceClient; + + /** + * Initializes an instance of OverloadClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + OverloadClient(OverloadClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The list operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         scope: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listWithResponse(requestOptions); + } + + /** + * The listByScope operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         scope: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param scope The scope parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByScopeWithResponse(String scope, RequestOptions requestOptions) { + return this.serviceClient.listByScopeWithResponse(scope, requestOptions); + } + + /** + * The list operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List list() { + // Generated convenience method for listWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_RESOURCE); + } + + /** + * The listByScope operation. + * + * @param scope The scope parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List listByScope(String scope) { + // Generated convenience method for listByScopeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listByScopeWithResponse(scope, requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_RESOURCE); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_RESOURCE + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClientBuilder.java new file mode 100644 index 00000000000..5c5efeb816e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/OverloadClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.overload; + +import client.overload.implementation.OverloadClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the OverloadClient type. + */ +@ServiceClientBuilder(serviceClients = { OverloadClient.class, OverloadAsyncClient.class }) +public final class OverloadClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("client-overload.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the OverloadClientBuilder. + */ + @Generated + public OverloadClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverloadClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverloadClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverloadClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverloadClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverloadClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverloadClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverloadClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OverloadClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the OverloadClientBuilder. + */ + @Generated + public OverloadClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of OverloadClientImpl with the provided parameters. + * + * @return an instance of OverloadClientImpl. + */ + @Generated + private OverloadClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + OverloadClientImpl client + = new OverloadClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of OverloadAsyncClient class. + * + * @return an instance of OverloadAsyncClient. + */ + @Generated + public OverloadAsyncClient buildAsyncClient() { + return new OverloadAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of OverloadClient class. + * + * @return an instance of OverloadClient. + */ + @Generated + public OverloadClient buildClient() { + return new OverloadClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(OverloadClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/OverloadClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/OverloadClientImpl.java new file mode 100644 index 00000000000..b3a3f7b1058 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/OverloadClientImpl.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.overload.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the OverloadClient type. + */ +public final class OverloadClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final OverloadClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of OverloadClient client. + * + * @param endpoint Service host. + */ + public OverloadClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of OverloadClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public OverloadClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of OverloadClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public OverloadClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(OverloadClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for OverloadClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OverloadClient") + public interface OverloadClientService { + @Get("/client/overload/resources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/client/overload/resources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/client/overload/resources/{scope}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listByScope(@HostParam("endpoint") String endpoint, @PathParam("scope") String scope, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/client/overload/resources/{scope}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listByScopeSync(@HostParam("endpoint") String endpoint, @PathParam("scope") String scope, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * The list operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         scope: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.list(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The list operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         scope: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The listByScope operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         scope: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param scope The scope parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listByScopeWithResponseAsync(String scope, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByScope(this.getEndpoint(), scope, accept, requestOptions, context)); + } + + /** + * The listByScope operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         scope: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param scope The scope parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByScopeWithResponse(String scope, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listByScopeSync(this.getEndpoint(), scope, accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/package-info.java new file mode 100644 index 00000000000..c8cae93e0f6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Overload. + * Test for overload operation in .NET. + * + */ +package client.overload.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/Resource.java new file mode 100644 index 00000000000..74bc59aa4f8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/Resource.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.overload.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Resource model. + */ +@Immutable +public final class Resource implements JsonSerializable { + /* + * The id property. + */ + @Generated + private final String id; + + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The scope property. + */ + @Generated + private final String scope; + + /** + * Creates an instance of Resource class. + * + * @param id the id value to set. + * @param name the name value to set. + * @param scope the scope value to set. + */ + @Generated + private Resource(String id, String name, String scope) { + this.id = id; + this.name = name; + this.scope = scope; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the scope property: The scope property. + * + * @return the scope value. + */ + @Generated + public String getScope() { + return this.scope; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("scope", this.scope); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Resource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Resource. + */ + @Generated + public static Resource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + String scope = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("scope".equals(fieldName)) { + scope = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Resource(id, name, scope); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/package-info.java new file mode 100644 index 00000000000..87d5f3c65fd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Overload. + * Test for overload operation in .NET. + * + */ +package client.overload.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/package-info.java new file mode 100644 index 00000000000..e35b221ead0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/overload/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Overload. + * Test for overload operation in .NET. + * + */ +package client.overload; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5AsyncClient.java new file mode 100644 index 00000000000..4de78d62108 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5AsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.anotherclientoperationgroup.subnamespace; + +import client.structure.clientoperationgroup.implementation.Group5sImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous SecondClient type. + */ +@ServiceClient(builder = SecondClientBuilder.class, isAsync = true) +public final class Group5AsyncClient { + @Generated + private final Group5sImpl serviceClient; + + /** + * Initializes an instance of Group5AsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Group5AsyncClient(Group5sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The six operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sixWithResponse(RequestOptions requestOptions) { + return this.serviceClient.sixWithResponseAsync(requestOptions); + } + + /** + * The six operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono six() { + // Generated convenience method for sixWithResponse + RequestOptions requestOptions = new RequestOptions(); + return sixWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5Client.java new file mode 100644 index 00000000000..73eb49cae6f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5Client.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.anotherclientoperationgroup.subnamespace; + +import client.structure.clientoperationgroup.implementation.Group5sImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous SecondClient type. + */ +@ServiceClient(builder = SecondClientBuilder.class) +public final class Group5Client { + @Generated + private final Group5sImpl serviceClient; + + /** + * Initializes an instance of Group5Client class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Group5Client(Group5sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The six operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sixWithResponse(RequestOptions requestOptions) { + return this.serviceClient.sixWithResponse(requestOptions); + } + + /** + * The six operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void six() { + // Generated convenience method for sixWithResponse + RequestOptions requestOptions = new RequestOptions(); + sixWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondAsyncClient.java new file mode 100644 index 00000000000..1ce2e3b9112 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.anotherclientoperationgroup.subnamespace; + +import client.structure.clientoperationgroup.implementation.SecondClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous SecondClient type. + */ +@ServiceClient(builder = SecondClientBuilder.class, isAsync = true) +public final class SecondAsyncClient { + @Generated + private final SecondClientImpl serviceClient; + + /** + * Initializes an instance of SecondAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SecondAsyncClient(SecondClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The five operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fiveWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fiveWithResponseAsync(requestOptions); + } + + /** + * The five operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono five() { + // Generated convenience method for fiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fiveWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClient.java new file mode 100644 index 00000000000..1eb84f8693c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.anotherclientoperationgroup.subnamespace; + +import client.structure.clientoperationgroup.implementation.SecondClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous SecondClient type. + */ +@ServiceClient(builder = SecondClientBuilder.class) +public final class SecondClient { + @Generated + private final SecondClientImpl serviceClient; + + /** + * Initializes an instance of SecondClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SecondClient(SecondClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The five operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fiveWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fiveWithResponse(requestOptions); + } + + /** + * The five operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void five() { + // Generated convenience method for fiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + fiveWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClientBuilder.java new file mode 100644 index 00000000000..6cf381f5ba9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClientBuilder.java @@ -0,0 +1,329 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.anotherclientoperationgroup.subnamespace; + +import client.structure.clientoperationgroup.implementation.SecondClientImpl; +import client.structure.service.models.ClientType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the SecondClient type. + */ +@ServiceClientBuilder( + serviceClients = { SecondClient.class, Group5Client.class, SecondAsyncClient.class, Group5AsyncClient.class }) +public final class SecondClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("client-structure-clientoperationgroup.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the SecondClientBuilder. + */ + @Generated + public SecondClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SecondClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SecondClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SecondClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SecondClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SecondClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SecondClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SecondClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SecondClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + @Generated + private ClientType client; + + /** + * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @param client the client value. + * @return the SecondClientBuilder. + */ + @Generated + public SecondClientBuilder client(ClientType client) { + this.client = client; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the SecondClientBuilder. + */ + @Generated + public SecondClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of SecondClientImpl with the provided parameters. + * + * @return an instance of SecondClientImpl. + */ + @Generated + private SecondClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + SecondClientImpl client = new SecondClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + this.endpoint, this.client); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + Objects.requireNonNull(client, "'client' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of SecondAsyncClient class. + * + * @return an instance of SecondAsyncClient. + */ + @Generated + public SecondAsyncClient buildAsyncClient() { + return new SecondAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of Group5AsyncClient class. + * + * @return an instance of Group5AsyncClient. + */ + @Generated + public Group5AsyncClient buildGroup5AsyncClient() { + return new Group5AsyncClient(buildInnerClient().getGroup5s()); + } + + /** + * Builds an instance of SecondClient class. + * + * @return an instance of SecondClient. + */ + @Generated + public SecondClient buildClient() { + return new SecondClient(buildInnerClient()); + } + + /** + * Builds an instance of Group5Client class. + * + * @return an instance of Group5Client. + */ + @Generated + public Group5Client buildGroup5Client() { + return new Group5Client(buildInnerClient().getGroup5s()); + } + + private static final ClientLogger LOGGER = new ClientLogger(SecondClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/package-info.java new file mode 100644 index 00000000000..4a649af0460 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/anotherclientoperationgroup/subnamespace/package-info.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for SecondClient. + * Test that we can use @client and @operationGroup decorators to customize client side code structure, such + * as: + * 1. have everything as default. + * 2. to rename client or operation group + * 3. one client can have more than one operations groups + * 4. split one interface into two clients + * 5. have two clients with operations come from different interfaces + * 6. have two clients with a hierarchy relation. + * + */ +package client.structure.anotherclientoperationgroup.subnamespace; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstAsyncClient.java new file mode 100644 index 00000000000..d979682d0f3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup; + +import client.structure.clientoperationgroup.implementation.FirstClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous FirstClient type. + */ +@ServiceClient(builder = FirstClientBuilder.class, isAsync = true) +public final class FirstAsyncClient { + @Generated + private final FirstClientImpl serviceClient; + + /** + * Initializes an instance of FirstAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FirstAsyncClient(FirstClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The one operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> oneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.oneWithResponseAsync(requestOptions); + } + + /** + * The one operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono one() { + // Generated convenience method for oneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return oneWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClient.java new file mode 100644 index 00000000000..f65ade66215 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup; + +import client.structure.clientoperationgroup.implementation.FirstClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous FirstClient type. + */ +@ServiceClient(builder = FirstClientBuilder.class) +public final class FirstClient { + @Generated + private final FirstClientImpl serviceClient; + + /** + * Initializes an instance of FirstClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FirstClient(FirstClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The one operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response oneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.oneWithResponse(requestOptions); + } + + /** + * The one operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void one() { + // Generated convenience method for oneWithResponse + RequestOptions requestOptions = new RequestOptions(); + oneWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClientBuilder.java new file mode 100644 index 00000000000..5e5d5dfd0c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/FirstClientBuilder.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup; + +import client.structure.clientoperationgroup.implementation.FirstClientImpl; +import client.structure.service.models.ClientType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the FirstClient type. + */ +@ServiceClientBuilder( + serviceClients = { + FirstClient.class, + Group3Client.class, + Group4Client.class, + FirstAsyncClient.class, + Group3AsyncClient.class, + Group4AsyncClient.class }) +public final class FirstClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("client-structure-clientoperationgroup.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the FirstClientBuilder. + */ + @Generated + public FirstClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FirstClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FirstClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FirstClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FirstClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FirstClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FirstClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FirstClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FirstClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + @Generated + private ClientType client; + + /** + * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @param client the client value. + * @return the FirstClientBuilder. + */ + @Generated + public FirstClientBuilder client(ClientType client) { + this.client = client; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the FirstClientBuilder. + */ + @Generated + public FirstClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of FirstClientImpl with the provided parameters. + * + * @return an instance of FirstClientImpl. + */ + @Generated + private FirstClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + FirstClientImpl client = new FirstClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + this.endpoint, this.client); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + Objects.requireNonNull(client, "'client' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of FirstAsyncClient class. + * + * @return an instance of FirstAsyncClient. + */ + @Generated + public FirstAsyncClient buildAsyncClient() { + return new FirstAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of Group3AsyncClient class. + * + * @return an instance of Group3AsyncClient. + */ + @Generated + public Group3AsyncClient buildGroup3AsyncClient() { + return new Group3AsyncClient(buildInnerClient().getGroup3s()); + } + + /** + * Builds an instance of Group4AsyncClient class. + * + * @return an instance of Group4AsyncClient. + */ + @Generated + public Group4AsyncClient buildGroup4AsyncClient() { + return new Group4AsyncClient(buildInnerClient().getGroup4s()); + } + + /** + * Builds an instance of FirstClient class. + * + * @return an instance of FirstClient. + */ + @Generated + public FirstClient buildClient() { + return new FirstClient(buildInnerClient()); + } + + /** + * Builds an instance of Group3Client class. + * + * @return an instance of Group3Client. + */ + @Generated + public Group3Client buildGroup3Client() { + return new Group3Client(buildInnerClient().getGroup3s()); + } + + /** + * Builds an instance of Group4Client class. + * + * @return an instance of Group4Client. + */ + @Generated + public Group4Client buildGroup4Client() { + return new Group4Client(buildInnerClient().getGroup4s()); + } + + private static final ClientLogger LOGGER = new ClientLogger(FirstClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3AsyncClient.java new file mode 100644 index 00000000000..d9aa9c27af9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3AsyncClient.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup; + +import client.structure.clientoperationgroup.implementation.Group3sImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous FirstClient type. + */ +@ServiceClient(builder = FirstClientBuilder.class, isAsync = true) +public final class Group3AsyncClient { + @Generated + private final Group3sImpl serviceClient; + + /** + * Initializes an instance of Group3AsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Group3AsyncClient(Group3sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The two operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> twoWithResponse(RequestOptions requestOptions) { + return this.serviceClient.twoWithResponseAsync(requestOptions); + } + + /** + * The three operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> threeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.threeWithResponseAsync(requestOptions); + } + + /** + * The two operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono two() { + // Generated convenience method for twoWithResponse + RequestOptions requestOptions = new RequestOptions(); + return twoWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The three operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono three() { + // Generated convenience method for threeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return threeWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3Client.java new file mode 100644 index 00000000000..289cada0739 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group3Client.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup; + +import client.structure.clientoperationgroup.implementation.Group3sImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous FirstClient type. + */ +@ServiceClient(builder = FirstClientBuilder.class) +public final class Group3Client { + @Generated + private final Group3sImpl serviceClient; + + /** + * Initializes an instance of Group3Client class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Group3Client(Group3sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The two operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response twoWithResponse(RequestOptions requestOptions) { + return this.serviceClient.twoWithResponse(requestOptions); + } + + /** + * The three operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response threeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.threeWithResponse(requestOptions); + } + + /** + * The two operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void two() { + // Generated convenience method for twoWithResponse + RequestOptions requestOptions = new RequestOptions(); + twoWithResponse(requestOptions).getValue(); + } + + /** + * The three operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void three() { + // Generated convenience method for threeWithResponse + RequestOptions requestOptions = new RequestOptions(); + threeWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4AsyncClient.java new file mode 100644 index 00000000000..520428cfec0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4AsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup; + +import client.structure.clientoperationgroup.implementation.Group4sImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous FirstClient type. + */ +@ServiceClient(builder = FirstClientBuilder.class, isAsync = true) +public final class Group4AsyncClient { + @Generated + private final Group4sImpl serviceClient; + + /** + * Initializes an instance of Group4AsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Group4AsyncClient(Group4sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The four operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fourWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fourWithResponseAsync(requestOptions); + } + + /** + * The four operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono four() { + // Generated convenience method for fourWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fourWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4Client.java new file mode 100644 index 00000000000..a328066729d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/Group4Client.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup; + +import client.structure.clientoperationgroup.implementation.Group4sImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous FirstClient type. + */ +@ServiceClient(builder = FirstClientBuilder.class) +public final class Group4Client { + @Generated + private final Group4sImpl serviceClient; + + /** + * Initializes an instance of Group4Client class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Group4Client(Group4sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The four operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fourWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fourWithResponse(requestOptions); + } + + /** + * The four operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void four() { + // Generated convenience method for fourWithResponse + RequestOptions requestOptions = new RequestOptions(); + fourWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/FirstClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/FirstClientImpl.java new file mode 100644 index 00000000000..0663fc01880 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/FirstClientImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the FirstClient type. + */ +public final class FirstClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FirstClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + private final ClientType client; + + /** + * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @return the client value. + */ + public ClientType getClient() { + return this.client; + } + + /** + * 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 Group3sImpl object to access its operations. + */ + private final Group3sImpl group3s; + + /** + * Gets the Group3sImpl object to access its operations. + * + * @return the Group3sImpl object. + */ + public Group3sImpl getGroup3s() { + return this.group3s; + } + + /** + * The Group4sImpl object to access its operations. + */ + private final Group4sImpl group4s; + + /** + * Gets the Group4sImpl object to access its operations. + * + * @return the Group4sImpl object. + */ + public Group4sImpl getGroup4s() { + return this.group4s; + } + + /** + * Initializes an instance of FirstClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public FirstClientImpl(String endpoint, ClientType client) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of FirstClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public FirstClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of FirstClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public FirstClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + ClientType client) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.client = client; + this.group3s = new Group3sImpl(this); + this.group4s = new Group4sImpl(this); + this.service = RestProxy.create(FirstClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for FirstClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "FirstClient") + public interface FirstClientService { + @Post("/one") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> one(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/one") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response oneSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The one operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> oneWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.one(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The one operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response oneWithResponse(RequestOptions requestOptions) { + return service.oneSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group3sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group3sImpl.java new file mode 100644 index 00000000000..cc861000362 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group3sImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Group3s. + */ +public final class Group3sImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Group3sService service; + + /** + * The service client containing this operation class. + */ + private final FirstClientImpl client; + + /** + * Initializes an instance of Group3sImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Group3sImpl(FirstClientImpl client) { + this.service = RestProxy.create(Group3sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FirstClientGroup3s to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "FirstClientGroup3s") + public interface Group3sService { + @Post("/two") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> two(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/two") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response twoSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/three") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> three(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/three") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response threeSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The two operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> twoWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.two(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The two operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response twoWithResponse(RequestOptions requestOptions) { + return service.twoSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } + + /** + * The three operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> threeWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.three(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The three operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response threeWithResponse(RequestOptions requestOptions) { + return service.threeSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group4sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group4sImpl.java new file mode 100644 index 00000000000..445b41ae3e6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group4sImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Group4s. + */ +public final class Group4sImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Group4sService service; + + /** + * The service client containing this operation class. + */ + private final FirstClientImpl client; + + /** + * Initializes an instance of Group4sImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Group4sImpl(FirstClientImpl client) { + this.service = RestProxy.create(Group4sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FirstClientGroup4s to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "FirstClientGroup4s") + public interface Group4sService { + @Post("/four") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> four(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/four") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fourSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The four operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fourWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.four(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The four operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fourWithResponse(RequestOptions requestOptions) { + return service.fourSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group5sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group5sImpl.java new file mode 100644 index 00000000000..9fd28a5de33 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/Group5sImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Group5s. + */ +public final class Group5sImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Group5sService service; + + /** + * The service client containing this operation class. + */ + private final SecondClientImpl client; + + /** + * Initializes an instance of Group5sImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Group5sImpl(SecondClientImpl client) { + this.service = RestProxy.create(Group5sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SecondClientGroup5s to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "SecondClientGroup5s") + public interface Group5sService { + @Post("/six") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> six(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/six") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sixSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The six operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sixWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.six(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The six operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sixWithResponse(RequestOptions requestOptions) { + return service.sixSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/SecondClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/SecondClientImpl.java new file mode 100644 index 00000000000..a7a49fb4084 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/SecondClientImpl.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the SecondClient type. + */ +public final class SecondClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SecondClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + private final ClientType client; + + /** + * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @return the client value. + */ + public ClientType getClient() { + return this.client; + } + + /** + * 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 Group5sImpl object to access its operations. + */ + private final Group5sImpl group5s; + + /** + * Gets the Group5sImpl object to access its operations. + * + * @return the Group5sImpl object. + */ + public Group5sImpl getGroup5s() { + return this.group5s; + } + + /** + * Initializes an instance of SecondClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public SecondClientImpl(String endpoint, ClientType client) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of SecondClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public SecondClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of SecondClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public SecondClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + ClientType client) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.client = client; + this.group5s = new Group5sImpl(this); + this.service = RestProxy.create(SecondClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for SecondClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "SecondClient") + public interface SecondClientService { + @Post("/five") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> five(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/five") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fiveSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The five operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fiveWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.five(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The five operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fiveWithResponse(RequestOptions requestOptions) { + return service.fiveSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/package-info.java new file mode 100644 index 00000000000..a806f1928b8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/implementation/package-info.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Service. + * Test that we can use @client and @operationGroup decorators to customize client side code structure, such + * as: + * 1. have everything as default. + * 2. to rename client or operation group + * 3. one client can have more than one operations groups + * 4. split one interface into two clients + * 5. have two clients with operations come from different interfaces + * 6. have two clients with a hierarchy relation. + * + */ +package client.structure.clientoperationgroup.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/package-info.java new file mode 100644 index 00000000000..2b619ea0cb2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/clientoperationgroup/package-info.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Service. + * Test that we can use @client and @operationGroup decorators to customize client side code structure, such + * as: + * 1. have everything as default. + * 2. to rename client or operation group + * 3. one client can have more than one operations groups + * 4. split one interface into two clients + * 5. have two clients with operations come from different interfaces + * 6. have two clients with a hierarchy relation. + * + */ +package client.structure.clientoperationgroup; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAAsyncClient.java new file mode 100644 index 00000000000..8bfb2f86bc6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAAsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.multiclient; + +import client.structure.multiclient.implementation.ClientAClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ClientAClient type. + */ +@ServiceClient(builder = ClientAClientBuilder.class, isAsync = true) +public final class ClientAAsyncClient { + @Generated + private final ClientAClientImpl serviceClient; + + /** + * Initializes an instance of ClientAAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ClientAAsyncClient(ClientAClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The renamedOne operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedOneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedOneWithResponseAsync(requestOptions); + } + + /** + * The renamedThree operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedThreeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedThreeWithResponseAsync(requestOptions); + } + + /** + * The renamedFive operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedFiveWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedFiveWithResponseAsync(requestOptions); + } + + /** + * The renamedOne operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renamedOne() { + // Generated convenience method for renamedOneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return renamedOneWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The renamedThree operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renamedThree() { + // Generated convenience method for renamedThreeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return renamedThreeWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The renamedFive operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renamedFive() { + // Generated convenience method for renamedFiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return renamedFiveWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClient.java new file mode 100644 index 00000000000..eea8925a0c3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.multiclient; + +import client.structure.multiclient.implementation.ClientAClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ClientAClient type. + */ +@ServiceClient(builder = ClientAClientBuilder.class) +public final class ClientAClient { + @Generated + private final ClientAClientImpl serviceClient; + + /** + * Initializes an instance of ClientAClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ClientAClient(ClientAClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The renamedOne operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedOneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedOneWithResponse(requestOptions); + } + + /** + * The renamedThree operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedThreeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedThreeWithResponse(requestOptions); + } + + /** + * The renamedFive operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedFiveWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedFiveWithResponse(requestOptions); + } + + /** + * The renamedOne operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void renamedOne() { + // Generated convenience method for renamedOneWithResponse + RequestOptions requestOptions = new RequestOptions(); + renamedOneWithResponse(requestOptions).getValue(); + } + + /** + * The renamedThree operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void renamedThree() { + // Generated convenience method for renamedThreeWithResponse + RequestOptions requestOptions = new RequestOptions(); + renamedThreeWithResponse(requestOptions).getValue(); + } + + /** + * The renamedFive operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void renamedFive() { + // Generated convenience method for renamedFiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + renamedFiveWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClientBuilder.java new file mode 100644 index 00000000000..26b39606e76 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientAClientBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.multiclient; + +import client.structure.multiclient.implementation.ClientAClientImpl; +import client.structure.service.models.ClientType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ClientAClient type. + */ +@ServiceClientBuilder(serviceClients = { ClientAClient.class, ClientAAsyncClient.class }) +public final class ClientAClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("client-structure-multiclient.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ClientAClientBuilder. + */ + @Generated + public ClientAClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientAClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientAClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientAClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientAClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientAClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientAClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientAClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientAClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + @Generated + private ClientType client; + + /** + * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @param client the client value. + * @return the ClientAClientBuilder. + */ + @Generated + public ClientAClientBuilder client(ClientType client) { + this.client = client; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ClientAClientBuilder. + */ + @Generated + public ClientAClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ClientAClientImpl with the provided parameters. + * + * @return an instance of ClientAClientImpl. + */ + @Generated + private ClientAClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ClientAClientImpl client = new ClientAClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + this.endpoint, this.client); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + Objects.requireNonNull(client, "'client' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ClientAAsyncClient class. + * + * @return an instance of ClientAAsyncClient. + */ + @Generated + public ClientAAsyncClient buildAsyncClient() { + return new ClientAAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ClientAClient class. + * + * @return an instance of ClientAClient. + */ + @Generated + public ClientAClient buildClient() { + return new ClientAClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientAClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBAsyncClient.java new file mode 100644 index 00000000000..9457d59396c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBAsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.multiclient; + +import client.structure.multiclient.implementation.ClientBClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ClientBClient type. + */ +@ServiceClient(builder = ClientBClientBuilder.class, isAsync = true) +public final class ClientBAsyncClient { + @Generated + private final ClientBClientImpl serviceClient; + + /** + * Initializes an instance of ClientBAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ClientBAsyncClient(ClientBClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The renamedTwo operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedTwoWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedTwoWithResponseAsync(requestOptions); + } + + /** + * The renamedFour operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedFourWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedFourWithResponseAsync(requestOptions); + } + + /** + * The renamedSix operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedSixWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedSixWithResponseAsync(requestOptions); + } + + /** + * The renamedTwo operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renamedTwo() { + // Generated convenience method for renamedTwoWithResponse + RequestOptions requestOptions = new RequestOptions(); + return renamedTwoWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The renamedFour operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renamedFour() { + // Generated convenience method for renamedFourWithResponse + RequestOptions requestOptions = new RequestOptions(); + return renamedFourWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The renamedSix operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renamedSix() { + // Generated convenience method for renamedSixWithResponse + RequestOptions requestOptions = new RequestOptions(); + return renamedSixWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClient.java new file mode 100644 index 00000000000..28bf6a65572 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.multiclient; + +import client.structure.multiclient.implementation.ClientBClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ClientBClient type. + */ +@ServiceClient(builder = ClientBClientBuilder.class) +public final class ClientBClient { + @Generated + private final ClientBClientImpl serviceClient; + + /** + * Initializes an instance of ClientBClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ClientBClient(ClientBClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The renamedTwo operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedTwoWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedTwoWithResponse(requestOptions); + } + + /** + * The renamedFour operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedFourWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedFourWithResponse(requestOptions); + } + + /** + * The renamedSix operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedSixWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedSixWithResponse(requestOptions); + } + + /** + * The renamedTwo operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void renamedTwo() { + // Generated convenience method for renamedTwoWithResponse + RequestOptions requestOptions = new RequestOptions(); + renamedTwoWithResponse(requestOptions).getValue(); + } + + /** + * The renamedFour operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void renamedFour() { + // Generated convenience method for renamedFourWithResponse + RequestOptions requestOptions = new RequestOptions(); + renamedFourWithResponse(requestOptions).getValue(); + } + + /** + * The renamedSix operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void renamedSix() { + // Generated convenience method for renamedSixWithResponse + RequestOptions requestOptions = new RequestOptions(); + renamedSixWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClientBuilder.java new file mode 100644 index 00000000000..1ad3b9b4efa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/ClientBClientBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.multiclient; + +import client.structure.multiclient.implementation.ClientBClientImpl; +import client.structure.service.models.ClientType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ClientBClient type. + */ +@ServiceClientBuilder(serviceClients = { ClientBClient.class, ClientBAsyncClient.class }) +public final class ClientBClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("client-structure-multiclient.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ClientBClientBuilder. + */ + @Generated + public ClientBClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientBClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientBClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientBClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientBClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientBClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientBClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientBClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientBClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + @Generated + private ClientType client; + + /** + * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @param client the client value. + * @return the ClientBClientBuilder. + */ + @Generated + public ClientBClientBuilder client(ClientType client) { + this.client = client; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ClientBClientBuilder. + */ + @Generated + public ClientBClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ClientBClientImpl with the provided parameters. + * + * @return an instance of ClientBClientImpl. + */ + @Generated + private ClientBClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ClientBClientImpl client = new ClientBClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + this.endpoint, this.client); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + Objects.requireNonNull(client, "'client' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ClientBAsyncClient class. + * + * @return an instance of ClientBAsyncClient. + */ + @Generated + public ClientBAsyncClient buildAsyncClient() { + return new ClientBAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ClientBClient class. + * + * @return an instance of ClientBClient. + */ + @Generated + public ClientBClient buildClient() { + return new ClientBClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientBClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientAClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientAClientImpl.java new file mode 100644 index 00000000000..6e9f2779ba1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientAClientImpl.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.multiclient.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ClientAClient type. + */ +public final class ClientAClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ClientAClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + private final ClientType client; + + /** + * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @return the client value. + */ + public ClientType getClient() { + return this.client; + } + + /** + * 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; + } + + /** + * Initializes an instance of ClientAClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public ClientAClientImpl(String endpoint, ClientType client) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of ClientAClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public ClientAClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of ClientAClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public ClientAClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + ClientType client) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.client = client; + this.service = RestProxy.create(ClientAClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ClientAClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "ClientAClient") + public interface ClientAClientService { + @Post("/one") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> renamedOne(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/one") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response renamedOneSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/three") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> renamedThree(@HostParam("endpoint") String endpoint, + @HostParam("client") ClientType client, RequestOptions requestOptions, Context context); + + @Post("/three") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response renamedThreeSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/five") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> renamedFive(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/five") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response renamedFiveSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The renamedOne operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedOneWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.renamedOne(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The renamedOne operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedOneWithResponse(RequestOptions requestOptions) { + return service.renamedOneSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } + + /** + * The renamedThree operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedThreeWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.renamedThree(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The renamedThree operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedThreeWithResponse(RequestOptions requestOptions) { + return service.renamedThreeSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } + + /** + * The renamedFive operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedFiveWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.renamedFive(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The renamedFive operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedFiveWithResponse(RequestOptions requestOptions) { + return service.renamedFiveSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientBClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientBClientImpl.java new file mode 100644 index 00000000000..079b8aa421f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/ClientBClientImpl.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.multiclient.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ClientBClient type. + */ +public final class ClientBClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ClientBClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + private final ClientType client; + + /** + * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @return the client value. + */ + public ClientType getClient() { + return this.client; + } + + /** + * 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; + } + + /** + * Initializes an instance of ClientBClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public ClientBClientImpl(String endpoint, ClientType client) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of ClientBClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public ClientBClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of ClientBClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public ClientBClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + ClientType client) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.client = client; + this.service = RestProxy.create(ClientBClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ClientBClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "ClientBClient") + public interface ClientBClientService { + @Post("/two") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> renamedTwo(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/two") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response renamedTwoSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/four") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> renamedFour(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/four") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response renamedFourSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/six") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> renamedSix(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/six") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response renamedSixSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The renamedTwo operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedTwoWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.renamedTwo(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The renamedTwo operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedTwoWithResponse(RequestOptions requestOptions) { + return service.renamedTwoSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } + + /** + * The renamedFour operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedFourWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.renamedFour(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The renamedFour operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedFourWithResponse(RequestOptions requestOptions) { + return service.renamedFourSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } + + /** + * The renamedSix operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedSixWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.renamedSix(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The renamedSix operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedSixWithResponse(RequestOptions requestOptions) { + return service.renamedSixSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/package-info.java new file mode 100644 index 00000000000..4bd35e24192 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/implementation/package-info.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Service. + * Test that we can use @client and @operationGroup decorators to customize client side code structure, such + * as: + * 1. have everything as default. + * 2. to rename client or operation group + * 3. one client can have more than one operations groups + * 4. split one interface into two clients + * 5. have two clients with operations come from different interfaces + * 6. have two clients with a hierarchy relation. + * + */ +package client.structure.multiclient.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/package-info.java new file mode 100644 index 00000000000..9e0bc9b2ccd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/multiclient/package-info.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Service. + * Test that we can use @client and @operationGroup decorators to customize client side code structure, such + * as: + * 1. have everything as default. + * 2. to rename client or operation group + * 3. one client can have more than one operations groups + * 4. split one interface into two clients + * 5. have two clients with operations come from different interfaces + * 6. have two clients with a hierarchy relation. + * + */ +package client.structure.multiclient; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupAsyncClient.java new file mode 100644 index 00000000000..9e654d6d4be --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupAsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.renamedoperation; + +import client.structure.renamedoperation.implementation.GroupsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous RenamedOperationClient type. + */ +@ServiceClient(builder = RenamedOperationClientBuilder.class, isAsync = true) +public final class GroupAsyncClient { + @Generated + private final GroupsImpl serviceClient; + + /** + * Initializes an instance of GroupAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + GroupAsyncClient(GroupsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The renamedTwo operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedTwoWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedTwoWithResponseAsync(requestOptions); + } + + /** + * The renamedFour operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedFourWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedFourWithResponseAsync(requestOptions); + } + + /** + * The renamedSix operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedSixWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedSixWithResponseAsync(requestOptions); + } + + /** + * The renamedTwo operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renamedTwo() { + // Generated convenience method for renamedTwoWithResponse + RequestOptions requestOptions = new RequestOptions(); + return renamedTwoWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The renamedFour operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renamedFour() { + // Generated convenience method for renamedFourWithResponse + RequestOptions requestOptions = new RequestOptions(); + return renamedFourWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The renamedSix operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renamedSix() { + // Generated convenience method for renamedSixWithResponse + RequestOptions requestOptions = new RequestOptions(); + return renamedSixWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupClient.java new file mode 100644 index 00000000000..377c0322cbd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/GroupClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.renamedoperation; + +import client.structure.renamedoperation.implementation.GroupsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous RenamedOperationClient type. + */ +@ServiceClient(builder = RenamedOperationClientBuilder.class) +public final class GroupClient { + @Generated + private final GroupsImpl serviceClient; + + /** + * Initializes an instance of GroupClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + GroupClient(GroupsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The renamedTwo operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedTwoWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedTwoWithResponse(requestOptions); + } + + /** + * The renamedFour operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedFourWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedFourWithResponse(requestOptions); + } + + /** + * The renamedSix operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedSixWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedSixWithResponse(requestOptions); + } + + /** + * The renamedTwo operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void renamedTwo() { + // Generated convenience method for renamedTwoWithResponse + RequestOptions requestOptions = new RequestOptions(); + renamedTwoWithResponse(requestOptions).getValue(); + } + + /** + * The renamedFour operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void renamedFour() { + // Generated convenience method for renamedFourWithResponse + RequestOptions requestOptions = new RequestOptions(); + renamedFourWithResponse(requestOptions).getValue(); + } + + /** + * The renamedSix operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void renamedSix() { + // Generated convenience method for renamedSixWithResponse + RequestOptions requestOptions = new RequestOptions(); + renamedSixWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationAsyncClient.java new file mode 100644 index 00000000000..5140c8ca6d9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationAsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.renamedoperation; + +import client.structure.renamedoperation.implementation.RenamedOperationClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous RenamedOperationClient type. + */ +@ServiceClient(builder = RenamedOperationClientBuilder.class, isAsync = true) +public final class RenamedOperationAsyncClient { + @Generated + private final RenamedOperationClientImpl serviceClient; + + /** + * Initializes an instance of RenamedOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RenamedOperationAsyncClient(RenamedOperationClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The renamedOne operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedOneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedOneWithResponseAsync(requestOptions); + } + + /** + * The renamedThree operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedThreeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedThreeWithResponseAsync(requestOptions); + } + + /** + * The renamedFive operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedFiveWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedFiveWithResponseAsync(requestOptions); + } + + /** + * The renamedOne operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renamedOne() { + // Generated convenience method for renamedOneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return renamedOneWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The renamedThree operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renamedThree() { + // Generated convenience method for renamedThreeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return renamedThreeWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The renamedFive operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renamedFive() { + // Generated convenience method for renamedFiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return renamedFiveWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClient.java new file mode 100644 index 00000000000..362e8f650c1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.renamedoperation; + +import client.structure.renamedoperation.implementation.RenamedOperationClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous RenamedOperationClient type. + */ +@ServiceClient(builder = RenamedOperationClientBuilder.class) +public final class RenamedOperationClient { + @Generated + private final RenamedOperationClientImpl serviceClient; + + /** + * Initializes an instance of RenamedOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RenamedOperationClient(RenamedOperationClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The renamedOne operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedOneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedOneWithResponse(requestOptions); + } + + /** + * The renamedThree operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedThreeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedThreeWithResponse(requestOptions); + } + + /** + * The renamedFive operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedFiveWithResponse(RequestOptions requestOptions) { + return this.serviceClient.renamedFiveWithResponse(requestOptions); + } + + /** + * The renamedOne operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void renamedOne() { + // Generated convenience method for renamedOneWithResponse + RequestOptions requestOptions = new RequestOptions(); + renamedOneWithResponse(requestOptions).getValue(); + } + + /** + * The renamedThree operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void renamedThree() { + // Generated convenience method for renamedThreeWithResponse + RequestOptions requestOptions = new RequestOptions(); + renamedThreeWithResponse(requestOptions).getValue(); + } + + /** + * The renamedFive operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void renamedFive() { + // Generated convenience method for renamedFiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + renamedFiveWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClientBuilder.java new file mode 100644 index 00000000000..4784fa30b10 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/RenamedOperationClientBuilder.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.renamedoperation; + +import client.structure.renamedoperation.implementation.RenamedOperationClientImpl; +import client.structure.service.models.ClientType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the RenamedOperationClient type. + */ +@ServiceClientBuilder( + serviceClients = { + RenamedOperationClient.class, + GroupClient.class, + RenamedOperationAsyncClient.class, + GroupAsyncClient.class }) +public final class RenamedOperationClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("client-structure-renamedoperation.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the RenamedOperationClientBuilder. + */ + @Generated + public RenamedOperationClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedOperationClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedOperationClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedOperationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedOperationClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedOperationClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedOperationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedOperationClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedOperationClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + @Generated + private ClientType client; + + /** + * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @param client the client value. + * @return the RenamedOperationClientBuilder. + */ + @Generated + public RenamedOperationClientBuilder client(ClientType client) { + this.client = client; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the RenamedOperationClientBuilder. + */ + @Generated + public RenamedOperationClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of RenamedOperationClientImpl with the provided parameters. + * + * @return an instance of RenamedOperationClientImpl. + */ + @Generated + private RenamedOperationClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + RenamedOperationClientImpl client = new RenamedOperationClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, this.client); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + Objects.requireNonNull(client, "'client' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of RenamedOperationAsyncClient class. + * + * @return an instance of RenamedOperationAsyncClient. + */ + @Generated + public RenamedOperationAsyncClient buildAsyncClient() { + return new RenamedOperationAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of GroupAsyncClient class. + * + * @return an instance of GroupAsyncClient. + */ + @Generated + public GroupAsyncClient buildGroupAsyncClient() { + return new GroupAsyncClient(buildInnerClient().getGroups()); + } + + /** + * Builds an instance of RenamedOperationClient class. + * + * @return an instance of RenamedOperationClient. + */ + @Generated + public RenamedOperationClient buildClient() { + return new RenamedOperationClient(buildInnerClient()); + } + + /** + * Builds an instance of GroupClient class. + * + * @return an instance of GroupClient. + */ + @Generated + public GroupClient buildGroupClient() { + return new GroupClient(buildInnerClient().getGroups()); + } + + private static final ClientLogger LOGGER = new ClientLogger(RenamedOperationClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/GroupsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/GroupsImpl.java new file mode 100644 index 00000000000..1c87ec04577 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/GroupsImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.renamedoperation.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Groups. + */ +public final class GroupsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final GroupsService service; + + /** + * The service client containing this operation class. + */ + private final RenamedOperationClientImpl client; + + /** + * Initializes an instance of GroupsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GroupsImpl(RenamedOperationClientImpl client) { + this.service = RestProxy.create(GroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RenamedOperationClientGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "RenamedOperationClientGroups") + public interface GroupsService { + @Post("/two") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> renamedTwo(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/two") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response renamedTwoSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/four") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> renamedFour(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/four") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response renamedFourSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/six") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> renamedSix(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/six") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response renamedSixSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The renamedTwo operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedTwoWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.renamedTwo(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The renamedTwo operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedTwoWithResponse(RequestOptions requestOptions) { + return service.renamedTwoSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } + + /** + * The renamedFour operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedFourWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.renamedFour(this.client.getEndpoint(), this.client.getClient(), + requestOptions, context)); + } + + /** + * The renamedFour operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedFourWithResponse(RequestOptions requestOptions) { + return service.renamedFourSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, + Context.NONE); + } + + /** + * The renamedSix operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedSixWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.renamedSix(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The renamedSix operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedSixWithResponse(RequestOptions requestOptions) { + return service.renamedSixSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/RenamedOperationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/RenamedOperationClientImpl.java new file mode 100644 index 00000000000..a704bf8a461 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/RenamedOperationClientImpl.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.renamedoperation.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the RenamedOperationClient type. + */ +public final class RenamedOperationClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RenamedOperationClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + private final ClientType client; + + /** + * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @return the client value. + */ + public ClientType getClient() { + return this.client; + } + + /** + * 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 GroupsImpl object to access its operations. + */ + private final GroupsImpl groups; + + /** + * Gets the GroupsImpl object to access its operations. + * + * @return the GroupsImpl object. + */ + public GroupsImpl getGroups() { + return this.groups; + } + + /** + * Initializes an instance of RenamedOperationClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public RenamedOperationClientImpl(String endpoint, ClientType client) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of RenamedOperationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public RenamedOperationClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of RenamedOperationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public RenamedOperationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + ClientType client) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.client = client; + this.groups = new GroupsImpl(this); + this.service + = RestProxy.create(RenamedOperationClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for RenamedOperationClient to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "RenamedOperationClient") + public interface RenamedOperationClientService { + @Post("/one") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> renamedOne(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/one") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response renamedOneSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/three") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> renamedThree(@HostParam("endpoint") String endpoint, + @HostParam("client") ClientType client, RequestOptions requestOptions, Context context); + + @Post("/three") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response renamedThreeSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/five") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> renamedFive(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/five") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response renamedFiveSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The renamedOne operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedOneWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.renamedOne(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The renamedOne operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedOneWithResponse(RequestOptions requestOptions) { + return service.renamedOneSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } + + /** + * The renamedThree operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedThreeWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.renamedThree(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The renamedThree operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedThreeWithResponse(RequestOptions requestOptions) { + return service.renamedThreeSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } + + /** + * The renamedFive operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> renamedFiveWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.renamedFive(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The renamedFive operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renamedFiveWithResponse(RequestOptions requestOptions) { + return service.renamedFiveSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/package-info.java new file mode 100644 index 00000000000..ef4c542a7da --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/implementation/package-info.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Service. + * Test that we can use @client and @operationGroup decorators to customize client side code structure, such + * as: + * 1. have everything as default. + * 2. to rename client or operation group + * 3. one client can have more than one operations groups + * 4. split one interface into two clients + * 5. have two clients with operations come from different interfaces + * 6. have two clients with a hierarchy relation. + * + */ +package client.structure.renamedoperation.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/package-info.java new file mode 100644 index 00000000000..d08052aad20 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/renamedoperation/package-info.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Service. + * Test that we can use @client and @operationGroup decorators to customize client side code structure, such + * as: + * 1. have everything as default. + * 2. to rename client or operation group + * 3. one client can have more than one operations groups + * 4. split one interface into two clients + * 5. have two clients with operations come from different interfaces + * 6. have two clients with a hierarchy relation. + * + */ +package client.structure.renamedoperation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarAsyncClient.java new file mode 100644 index 00000000000..b941fc9ef48 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarAsyncClient.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.BarsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ServiceClientClient type. + */ +@ServiceClient(builder = ServiceClientClientBuilder.class, isAsync = true) +public final class BarAsyncClient { + @Generated + private final BarsImpl serviceClient; + + /** + * Initializes an instance of BarAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BarAsyncClient(BarsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The five operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fiveWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fiveWithResponseAsync(requestOptions); + } + + /** + * The six operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sixWithResponse(RequestOptions requestOptions) { + return this.serviceClient.sixWithResponseAsync(requestOptions); + } + + /** + * The five operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono five() { + // Generated convenience method for fiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fiveWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The six operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono six() { + // Generated convenience method for sixWithResponse + RequestOptions requestOptions = new RequestOptions(); + return sixWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarClient.java new file mode 100644 index 00000000000..a58d0d88474 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BarClient.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.BarsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ServiceClientClient type. + */ +@ServiceClient(builder = ServiceClientClientBuilder.class) +public final class BarClient { + @Generated + private final BarsImpl serviceClient; + + /** + * Initializes an instance of BarClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BarClient(BarsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The five operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fiveWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fiveWithResponse(requestOptions); + } + + /** + * The six operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sixWithResponse(RequestOptions requestOptions) { + return this.serviceClient.sixWithResponse(requestOptions); + } + + /** + * The five operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void five() { + // Generated convenience method for fiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + fiveWithResponse(requestOptions).getValue(); + } + + /** + * The six operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void six() { + // Generated convenience method for sixWithResponse + RequestOptions requestOptions = new RequestOptions(); + sixWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooAsyncClient.java new file mode 100644 index 00000000000..58f69d03334 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.BazFoosImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ServiceClientClient type. + */ +@ServiceClient(builder = ServiceClientClientBuilder.class, isAsync = true) +public final class BazFooAsyncClient { + @Generated + private final BazFoosImpl serviceClient; + + /** + * Initializes an instance of BazFooAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BazFooAsyncClient(BazFoosImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The seven operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sevenWithResponse(RequestOptions requestOptions) { + return this.serviceClient.sevenWithResponseAsync(requestOptions); + } + + /** + * The seven operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono seven() { + // Generated convenience method for sevenWithResponse + RequestOptions requestOptions = new RequestOptions(); + return sevenWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooClient.java new file mode 100644 index 00000000000..954ee21329d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/BazFooClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.BazFoosImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ServiceClientClient type. + */ +@ServiceClient(builder = ServiceClientClientBuilder.class) +public final class BazFooClient { + @Generated + private final BazFoosImpl serviceClient; + + /** + * Initializes an instance of BazFooClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BazFooClient(BazFoosImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The seven operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sevenWithResponse(RequestOptions requestOptions) { + return this.serviceClient.sevenWithResponse(requestOptions); + } + + /** + * The seven operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void seven() { + // Generated convenience method for sevenWithResponse + RequestOptions requestOptions = new RequestOptions(); + sevenWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooAsyncClient.java new file mode 100644 index 00000000000..ccfe125ff70 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooAsyncClient.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.FoosImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ServiceClientClient type. + */ +@ServiceClient(builder = ServiceClientClientBuilder.class, isAsync = true) +public final class FooAsyncClient { + @Generated + private final FoosImpl serviceClient; + + /** + * Initializes an instance of FooAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FooAsyncClient(FoosImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The three operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> threeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.threeWithResponseAsync(requestOptions); + } + + /** + * The four operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fourWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fourWithResponseAsync(requestOptions); + } + + /** + * The three operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono three() { + // Generated convenience method for threeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return threeWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The four operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono four() { + // Generated convenience method for fourWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fourWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooClient.java new file mode 100644 index 00000000000..266804d497e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/FooClient.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.FoosImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ServiceClientClient type. + */ +@ServiceClient(builder = ServiceClientClientBuilder.class) +public final class FooClient { + @Generated + private final FoosImpl serviceClient; + + /** + * Initializes an instance of FooClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FooClient(FoosImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The three operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response threeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.threeWithResponse(requestOptions); + } + + /** + * The four operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fourWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fourWithResponse(requestOptions); + } + + /** + * The three operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void three() { + // Generated convenience method for threeWithResponse + RequestOptions requestOptions = new RequestOptions(); + threeWithResponse(requestOptions).getValue(); + } + + /** + * The four operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void four() { + // Generated convenience method for fourWithResponse + RequestOptions requestOptions = new RequestOptions(); + fourWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxAsyncClient.java new file mode 100644 index 00000000000..fdf3efce9f8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.QuxesImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ServiceClientClient type. + */ +@ServiceClient(builder = ServiceClientClientBuilder.class, isAsync = true) +public final class QuxAsyncClient { + @Generated + private final QuxesImpl serviceClient; + + /** + * Initializes an instance of QuxAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QuxAsyncClient(QuxesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The eight operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> eightWithResponse(RequestOptions requestOptions) { + return this.serviceClient.eightWithResponseAsync(requestOptions); + } + + /** + * The eight operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono eight() { + // Generated convenience method for eightWithResponse + RequestOptions requestOptions = new RequestOptions(); + return eightWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarAsyncClient.java new file mode 100644 index 00000000000..b135871ca7e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.QuxBarsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ServiceClientClient type. + */ +@ServiceClient(builder = ServiceClientClientBuilder.class, isAsync = true) +public final class QuxBarAsyncClient { + @Generated + private final QuxBarsImpl serviceClient; + + /** + * Initializes an instance of QuxBarAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QuxBarAsyncClient(QuxBarsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The nine operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> nineWithResponse(RequestOptions requestOptions) { + return this.serviceClient.nineWithResponseAsync(requestOptions); + } + + /** + * The nine operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono nine() { + // Generated convenience method for nineWithResponse + RequestOptions requestOptions = new RequestOptions(); + return nineWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarClient.java new file mode 100644 index 00000000000..7936f0be210 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxBarClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.QuxBarsImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ServiceClientClient type. + */ +@ServiceClient(builder = ServiceClientClientBuilder.class) +public final class QuxBarClient { + @Generated + private final QuxBarsImpl serviceClient; + + /** + * Initializes an instance of QuxBarClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QuxBarClient(QuxBarsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The nine operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response nineWithResponse(RequestOptions requestOptions) { + return this.serviceClient.nineWithResponse(requestOptions); + } + + /** + * The nine operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void nine() { + // Generated convenience method for nineWithResponse + RequestOptions requestOptions = new RequestOptions(); + nineWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxClient.java new file mode 100644 index 00000000000..c329fabaef9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/QuxClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.QuxesImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ServiceClientClient type. + */ +@ServiceClient(builder = ServiceClientClientBuilder.class) +public final class QuxClient { + @Generated + private final QuxesImpl serviceClient; + + /** + * Initializes an instance of QuxClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QuxClient(QuxesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The eight operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response eightWithResponse(RequestOptions requestOptions) { + return this.serviceClient.eightWithResponse(requestOptions); + } + + /** + * The eight operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void eight() { + // Generated convenience method for eightWithResponse + RequestOptions requestOptions = new RequestOptions(); + eightWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientAsyncClient.java new file mode 100644 index 00000000000..cc2ff1f0b3c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientAsyncClient.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.ServiceClientClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ServiceClientClient type. + */ +@ServiceClient(builder = ServiceClientClientBuilder.class, isAsync = true) +public final class ServiceClientAsyncClient { + @Generated + private final ServiceClientClientImpl serviceClient; + + /** + * Initializes an instance of ServiceClientAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ServiceClientAsyncClient(ServiceClientClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The one operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> oneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.oneWithResponseAsync(requestOptions); + } + + /** + * The two operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> twoWithResponse(RequestOptions requestOptions) { + return this.serviceClient.twoWithResponseAsync(requestOptions); + } + + /** + * The one operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono one() { + // Generated convenience method for oneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return oneWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The two operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono two() { + // Generated convenience method for twoWithResponse + RequestOptions requestOptions = new RequestOptions(); + return twoWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClient.java new file mode 100644 index 00000000000..1e6ff84d0c1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClient.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.ServiceClientClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous ServiceClientClient type. + */ +@ServiceClient(builder = ServiceClientClientBuilder.class) +public final class ServiceClientClient { + @Generated + private final ServiceClientClientImpl serviceClient; + + /** + * Initializes an instance of ServiceClientClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ServiceClientClient(ServiceClientClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The one operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response oneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.oneWithResponse(requestOptions); + } + + /** + * The two operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response twoWithResponse(RequestOptions requestOptions) { + return this.serviceClient.twoWithResponse(requestOptions); + } + + /** + * The one operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void one() { + // Generated convenience method for oneWithResponse + RequestOptions requestOptions = new RequestOptions(); + oneWithResponse(requestOptions).getValue(); + } + + /** + * The two operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void two() { + // Generated convenience method for twoWithResponse + RequestOptions requestOptions = new RequestOptions(); + twoWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClientBuilder.java new file mode 100644 index 00000000000..9443d4bee18 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/ServiceClientClientBuilder.java @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service; + +import client.structure.service.implementation.ServiceClientClientImpl; +import client.structure.service.models.ClientType; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ServiceClientClient type. + */ +@ServiceClientBuilder( + serviceClients = { + ServiceClientClient.class, + BazFooClient.class, + QuxClient.class, + QuxBarClient.class, + FooClient.class, + BarClient.class, + ServiceClientAsyncClient.class, + BazFooAsyncClient.class, + QuxAsyncClient.class, + QuxBarAsyncClient.class, + FooAsyncClient.class, + BarAsyncClient.class }) +public final class ServiceClientClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("client-structure-service.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ServiceClientClientBuilder. + */ + @Generated + public ServiceClientClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ServiceClientClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ServiceClientClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ServiceClientClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ServiceClientClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ServiceClientClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ServiceClientClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ServiceClientClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ServiceClientClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + @Generated + private ClientType client; + + /** + * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @param client the client value. + * @return the ServiceClientClientBuilder. + */ + @Generated + public ServiceClientClientBuilder client(ClientType client) { + this.client = client; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ServiceClientClientBuilder. + */ + @Generated + public ServiceClientClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ServiceClientClientImpl with the provided parameters. + * + * @return an instance of ServiceClientClientImpl. + */ + @Generated + private ServiceClientClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ServiceClientClientImpl client = new ServiceClientClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, this.client); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + Objects.requireNonNull(client, "'client' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ServiceClientAsyncClient class. + * + * @return an instance of ServiceClientAsyncClient. + */ + @Generated + public ServiceClientAsyncClient buildAsyncClient() { + return new ServiceClientAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of BazFooAsyncClient class. + * + * @return an instance of BazFooAsyncClient. + */ + @Generated + public BazFooAsyncClient buildBazFooAsyncClient() { + return new BazFooAsyncClient(buildInnerClient().getBazFoos()); + } + + /** + * Builds an instance of QuxAsyncClient class. + * + * @return an instance of QuxAsyncClient. + */ + @Generated + public QuxAsyncClient buildQuxAsyncClient() { + return new QuxAsyncClient(buildInnerClient().getQuxes()); + } + + /** + * Builds an instance of QuxBarAsyncClient class. + * + * @return an instance of QuxBarAsyncClient. + */ + @Generated + public QuxBarAsyncClient buildQuxBarAsyncClient() { + return new QuxBarAsyncClient(buildInnerClient().getQuxBars()); + } + + /** + * Builds an instance of FooAsyncClient class. + * + * @return an instance of FooAsyncClient. + */ + @Generated + public FooAsyncClient buildFooAsyncClient() { + return new FooAsyncClient(buildInnerClient().getFoos()); + } + + /** + * Builds an instance of BarAsyncClient class. + * + * @return an instance of BarAsyncClient. + */ + @Generated + public BarAsyncClient buildBarAsyncClient() { + return new BarAsyncClient(buildInnerClient().getBars()); + } + + /** + * Builds an instance of ServiceClientClient class. + * + * @return an instance of ServiceClientClient. + */ + @Generated + public ServiceClientClient buildClient() { + return new ServiceClientClient(buildInnerClient()); + } + + /** + * Builds an instance of BazFooClient class. + * + * @return an instance of BazFooClient. + */ + @Generated + public BazFooClient buildBazFooClient() { + return new BazFooClient(buildInnerClient().getBazFoos()); + } + + /** + * Builds an instance of QuxClient class. + * + * @return an instance of QuxClient. + */ + @Generated + public QuxClient buildQuxClient() { + return new QuxClient(buildInnerClient().getQuxes()); + } + + /** + * Builds an instance of QuxBarClient class. + * + * @return an instance of QuxBarClient. + */ + @Generated + public QuxBarClient buildQuxBarClient() { + return new QuxBarClient(buildInnerClient().getQuxBars()); + } + + /** + * Builds an instance of FooClient class. + * + * @return an instance of FooClient. + */ + @Generated + public FooClient buildFooClient() { + return new FooClient(buildInnerClient().getFoos()); + } + + /** + * Builds an instance of BarClient class. + * + * @return an instance of BarClient. + */ + @Generated + public BarClient buildBarClient() { + return new BarClient(buildInnerClient().getBars()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ServiceClientClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BarsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BarsImpl.java new file mode 100644 index 00000000000..79134ef47fa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BarsImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Bars. + */ +public final class BarsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BarsService service; + + /** + * The service client containing this operation class. + */ + private final ServiceClientClientImpl client; + + /** + * Initializes an instance of BarsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BarsImpl(ServiceClientClientImpl client) { + this.service = RestProxy.create(BarsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceClientClientBars to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "ServiceClientClientBars") + public interface BarsService { + @Post("/five") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> five(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/five") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fiveSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/six") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> six(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/six") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sixSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The five operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fiveWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.five(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The five operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fiveWithResponse(RequestOptions requestOptions) { + return service.fiveSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } + + /** + * The six operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sixWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.six(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The six operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sixWithResponse(RequestOptions requestOptions) { + return service.sixSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BazFoosImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BazFoosImpl.java new file mode 100644 index 00000000000..977659af7f0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/BazFoosImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BazFoos. + */ +public final class BazFoosImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BazFoosService service; + + /** + * The service client containing this operation class. + */ + private final ServiceClientClientImpl client; + + /** + * Initializes an instance of BazFoosImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BazFoosImpl(ServiceClientClientImpl client) { + this.service = RestProxy.create(BazFoosService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceClientClientBazFoos to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "ServiceClientClientBazFoos") + public interface BazFoosService { + @Post("/seven") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> seven(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/seven") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sevenSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The seven operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sevenWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.seven(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The seven operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sevenWithResponse(RequestOptions requestOptions) { + return service.sevenSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/FoosImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/FoosImpl.java new file mode 100644 index 00000000000..504252d2074 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/FoosImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Foos. + */ +public final class FoosImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FoosService service; + + /** + * The service client containing this operation class. + */ + private final ServiceClientClientImpl client; + + /** + * Initializes an instance of FoosImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FoosImpl(ServiceClientClientImpl client) { + this.service = RestProxy.create(FoosService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceClientClientFoos to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "ServiceClientClientFoos") + public interface FoosService { + @Post("/three") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> three(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/three") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response threeSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/four") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> four(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/four") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fourSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The three operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> threeWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.three(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The three operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response threeWithResponse(RequestOptions requestOptions) { + return service.threeSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } + + /** + * The four operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fourWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.four(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The four operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fourWithResponse(RequestOptions requestOptions) { + return service.fourSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxBarsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxBarsImpl.java new file mode 100644 index 00000000000..635ded3f086 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxBarsImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in QuxBars. + */ +public final class QuxBarsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final QuxBarsService service; + + /** + * The service client containing this operation class. + */ + private final ServiceClientClientImpl client; + + /** + * Initializes an instance of QuxBarsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QuxBarsImpl(ServiceClientClientImpl client) { + this.service = RestProxy.create(QuxBarsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceClientClientQuxBars to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "ServiceClientClientQuxBars") + public interface QuxBarsService { + @Post("/nine") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> nine(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/nine") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response nineSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The nine operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> nineWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.nine(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The nine operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response nineWithResponse(RequestOptions requestOptions) { + return service.nineSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxesImpl.java new file mode 100644 index 00000000000..dbbad11c751 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/QuxesImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Quxes. + */ +public final class QuxesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final QuxesService service; + + /** + * The service client containing this operation class. + */ + private final ServiceClientClientImpl client; + + /** + * Initializes an instance of QuxesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QuxesImpl(ServiceClientClientImpl client) { + this.service = RestProxy.create(QuxesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ServiceClientClientQuxes to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "ServiceClientClientQuxes") + public interface QuxesService { + @Post("/eight") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> eight(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/eight") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response eightSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The eight operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> eightWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.eight(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The eight operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response eightWithResponse(RequestOptions requestOptions) { + return service.eightSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/ServiceClientClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/ServiceClientClientImpl.java new file mode 100644 index 00000000000..9084229a968 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/ServiceClientClientImpl.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ServiceClientClient type. + */ +public final class ServiceClientClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ServiceClientClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + private final ClientType client; + + /** + * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @return the client value. + */ + public ClientType getClient() { + return this.client; + } + + /** + * 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 BazFoosImpl object to access its operations. + */ + private final BazFoosImpl bazFoos; + + /** + * Gets the BazFoosImpl object to access its operations. + * + * @return the BazFoosImpl object. + */ + public BazFoosImpl getBazFoos() { + return this.bazFoos; + } + + /** + * The QuxesImpl object to access its operations. + */ + private final QuxesImpl quxes; + + /** + * Gets the QuxesImpl object to access its operations. + * + * @return the QuxesImpl object. + */ + public QuxesImpl getQuxes() { + return this.quxes; + } + + /** + * The QuxBarsImpl object to access its operations. + */ + private final QuxBarsImpl quxBars; + + /** + * Gets the QuxBarsImpl object to access its operations. + * + * @return the QuxBarsImpl object. + */ + public QuxBarsImpl getQuxBars() { + return this.quxBars; + } + + /** + * The FoosImpl object to access its operations. + */ + private final FoosImpl foos; + + /** + * Gets the FoosImpl object to access its operations. + * + * @return the FoosImpl object. + */ + public FoosImpl getFoos() { + return this.foos; + } + + /** + * The BarsImpl object to access its operations. + */ + private final BarsImpl bars; + + /** + * Gets the BarsImpl object to access its operations. + * + * @return the BarsImpl object. + */ + public BarsImpl getBars() { + return this.bars; + } + + /** + * Initializes an instance of ServiceClientClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public ServiceClientClientImpl(String endpoint, ClientType client) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of ServiceClientClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public ServiceClientClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of ServiceClientClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public ServiceClientClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + ClientType client) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.client = client; + this.bazFoos = new BazFoosImpl(this); + this.quxes = new QuxesImpl(this); + this.quxBars = new QuxBarsImpl(this); + this.foos = new FoosImpl(this); + this.bars = new BarsImpl(this); + this.service + = RestProxy.create(ServiceClientClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ServiceClientClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "ServiceClientClient") + public interface ServiceClientClientService { + @Post("/one") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> one(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/one") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response oneSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/two") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> two(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/two") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response twoSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The one operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> oneWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.one(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The one operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response oneWithResponse(RequestOptions requestOptions) { + return service.oneSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } + + /** + * The two operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> twoWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.two(this.getEndpoint(), this.getClient(), requestOptions, context)); + } + + /** + * The two operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response twoWithResponse(RequestOptions requestOptions) { + return service.twoSync(this.getEndpoint(), this.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/package-info.java new file mode 100644 index 00000000000..c7595374ac3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/implementation/package-info.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Service. + * Test that we can use @client and @operationGroup decorators to customize client side code structure, such + * as: + * 1. have everything as default. + * 2. to rename client or operation group + * 3. one client can have more than one operations groups + * 4. split one interface into two clients + * 5. have two clients with operations come from different interfaces + * 6. have two clients with a hierarchy relation. + * + */ +package client.structure.service.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/ClientType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/ClientType.java new file mode 100644 index 00000000000..81bc9c8ad88 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/ClientType.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service.models; + +/** + * Defines values for ClientType. + */ +public enum ClientType { + /** + * Enum value default. + */ + DEFAULT("default"), + + /** + * Enum value multi-client. + */ + MULTI_CLIENT("multi-client"), + + /** + * Enum value renamed-operation. + */ + RENAMED_OPERATION("renamed-operation"), + + /** + * Enum value two-operation-group. + */ + TWO_OPERATION_GROUP("two-operation-group"), + + /** + * Enum value client-operation-group. + */ + CLIENT_OPERATION_GROUP("client-operation-group"); + + /** + * The actual serialized value for a ClientType instance. + */ + private final String value; + + ClientType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ClientType instance. + * + * @param value the serialized value to parse. + * @return the parsed ClientType object, or null if unable to parse. + */ + public static ClientType fromString(String value) { + if (value == null) { + return null; + } + ClientType[] items = ClientType.values(); + for (ClientType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/package-info.java new file mode 100644 index 00000000000..39f210ff84a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/models/package-info.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Service. + * Test that we can use @client and @operationGroup decorators to customize client side code structure, such + * as: + * 1. have everything as default. + * 2. to rename client or operation group + * 3. one client can have more than one operations groups + * 4. split one interface into two clients + * 5. have two clients with operations come from different interfaces + * 6. have two clients with a hierarchy relation. + * + */ +package client.structure.service.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/package-info.java new file mode 100644 index 00000000000..8f70f1bf5d8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/service/package-info.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Service. + * Test that we can use @client and @operationGroup decorators to customize client side code structure, such + * as: + * 1. have everything as default. + * 2. to rename client or operation group + * 3. one client can have more than one operations groups + * 4. split one interface into two clients + * 5. have two clients with operations come from different interfaces + * 6. have two clients with a hierarchy relation. + * + */ +package client.structure.service; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1AsyncClient.java new file mode 100644 index 00000000000..9f112a22b4b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1AsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.twooperationgroup; + +import client.structure.twooperationgroup.implementation.Group1sImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous TwoOperationGroupClient type. + */ +@ServiceClient(builder = TwoOperationGroupClientBuilder.class, isAsync = true) +public final class Group1AsyncClient { + @Generated + private final Group1sImpl serviceClient; + + /** + * Initializes an instance of Group1AsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Group1AsyncClient(Group1sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The one operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> oneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.oneWithResponseAsync(requestOptions); + } + + /** + * The three operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> threeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.threeWithResponseAsync(requestOptions); + } + + /** + * The four operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fourWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fourWithResponseAsync(requestOptions); + } + + /** + * The one operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono one() { + // Generated convenience method for oneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return oneWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The three operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono three() { + // Generated convenience method for threeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return threeWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The four operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono four() { + // Generated convenience method for fourWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fourWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1Client.java new file mode 100644 index 00000000000..e0fa961bf6f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group1Client.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.twooperationgroup; + +import client.structure.twooperationgroup.implementation.Group1sImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous TwoOperationGroupClient type. + */ +@ServiceClient(builder = TwoOperationGroupClientBuilder.class) +public final class Group1Client { + @Generated + private final Group1sImpl serviceClient; + + /** + * Initializes an instance of Group1Client class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Group1Client(Group1sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The one operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response oneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.oneWithResponse(requestOptions); + } + + /** + * The three operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response threeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.threeWithResponse(requestOptions); + } + + /** + * The four operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fourWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fourWithResponse(requestOptions); + } + + /** + * The one operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void one() { + // Generated convenience method for oneWithResponse + RequestOptions requestOptions = new RequestOptions(); + oneWithResponse(requestOptions).getValue(); + } + + /** + * The three operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void three() { + // Generated convenience method for threeWithResponse + RequestOptions requestOptions = new RequestOptions(); + threeWithResponse(requestOptions).getValue(); + } + + /** + * The four operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void four() { + // Generated convenience method for fourWithResponse + RequestOptions requestOptions = new RequestOptions(); + fourWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2AsyncClient.java new file mode 100644 index 00000000000..7e85b1c96c9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2AsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.twooperationgroup; + +import client.structure.twooperationgroup.implementation.Group2sImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous TwoOperationGroupClient type. + */ +@ServiceClient(builder = TwoOperationGroupClientBuilder.class, isAsync = true) +public final class Group2AsyncClient { + @Generated + private final Group2sImpl serviceClient; + + /** + * Initializes an instance of Group2AsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Group2AsyncClient(Group2sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The two operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> twoWithResponse(RequestOptions requestOptions) { + return this.serviceClient.twoWithResponseAsync(requestOptions); + } + + /** + * The five operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fiveWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fiveWithResponseAsync(requestOptions); + } + + /** + * The six operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sixWithResponse(RequestOptions requestOptions) { + return this.serviceClient.sixWithResponseAsync(requestOptions); + } + + /** + * The two operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono two() { + // Generated convenience method for twoWithResponse + RequestOptions requestOptions = new RequestOptions(); + return twoWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The five operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono five() { + // Generated convenience method for fiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fiveWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The six operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono six() { + // Generated convenience method for sixWithResponse + RequestOptions requestOptions = new RequestOptions(); + return sixWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2Client.java new file mode 100644 index 00000000000..fada175ec71 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/Group2Client.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.twooperationgroup; + +import client.structure.twooperationgroup.implementation.Group2sImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; + +/** + * Initializes a new instance of the synchronous TwoOperationGroupClient type. + */ +@ServiceClient(builder = TwoOperationGroupClientBuilder.class) +public final class Group2Client { + @Generated + private final Group2sImpl serviceClient; + + /** + * Initializes an instance of Group2Client class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Group2Client(Group2sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The two operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response twoWithResponse(RequestOptions requestOptions) { + return this.serviceClient.twoWithResponse(requestOptions); + } + + /** + * The five operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fiveWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fiveWithResponse(requestOptions); + } + + /** + * The six operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sixWithResponse(RequestOptions requestOptions) { + return this.serviceClient.sixWithResponse(requestOptions); + } + + /** + * The two operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void two() { + // Generated convenience method for twoWithResponse + RequestOptions requestOptions = new RequestOptions(); + twoWithResponse(requestOptions).getValue(); + } + + /** + * The five operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void five() { + // Generated convenience method for fiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + fiveWithResponse(requestOptions).getValue(); + } + + /** + * The six operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void six() { + // Generated convenience method for sixWithResponse + RequestOptions requestOptions = new RequestOptions(); + sixWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/TwoOperationGroupClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/TwoOperationGroupClientBuilder.java new file mode 100644 index 00000000000..26468e7b9da --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/TwoOperationGroupClientBuilder.java @@ -0,0 +1,329 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.twooperationgroup; + +import client.structure.service.models.ClientType; +import client.structure.twooperationgroup.implementation.TwoOperationGroupClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the TwoOperationGroupClient type. + */ +@ServiceClientBuilder( + serviceClients = { Group1Client.class, Group2Client.class, Group1AsyncClient.class, Group2AsyncClient.class }) +public final class TwoOperationGroupClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("client-structure-twooperationgroup.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the TwoOperationGroupClientBuilder. + */ + @Generated + public TwoOperationGroupClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TwoOperationGroupClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TwoOperationGroupClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TwoOperationGroupClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TwoOperationGroupClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TwoOperationGroupClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TwoOperationGroupClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TwoOperationGroupClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TwoOperationGroupClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + @Generated + private ClientType client; + + /** + * Sets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @param client the client value. + * @return the TwoOperationGroupClientBuilder. + */ + @Generated + public TwoOperationGroupClientBuilder client(ClientType client) { + this.client = client; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the TwoOperationGroupClientBuilder. + */ + @Generated + public TwoOperationGroupClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of TwoOperationGroupClientImpl with the provided parameters. + * + * @return an instance of TwoOperationGroupClientImpl. + */ + @Generated + private TwoOperationGroupClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + TwoOperationGroupClientImpl client = new TwoOperationGroupClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, this.client); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + Objects.requireNonNull(client, "'client' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of Group1AsyncClient class. + * + * @return an instance of Group1AsyncClient. + */ + @Generated + public Group1AsyncClient buildGroup1AsyncClient() { + return new Group1AsyncClient(buildInnerClient().getGroup1s()); + } + + /** + * Builds an instance of Group2AsyncClient class. + * + * @return an instance of Group2AsyncClient. + */ + @Generated + public Group2AsyncClient buildGroup2AsyncClient() { + return new Group2AsyncClient(buildInnerClient().getGroup2s()); + } + + /** + * Builds an instance of Group1Client class. + * + * @return an instance of Group1Client. + */ + @Generated + public Group1Client buildGroup1Client() { + return new Group1Client(buildInnerClient().getGroup1s()); + } + + /** + * Builds an instance of Group2Client class. + * + * @return an instance of Group2Client. + */ + @Generated + public Group2Client buildGroup2Client() { + return new Group2Client(buildInnerClient().getGroup2s()); + } + + private static final ClientLogger LOGGER = new ClientLogger(TwoOperationGroupClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group1sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group1sImpl.java new file mode 100644 index 00000000000..7c9ae5b79ae --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group1sImpl.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.twooperationgroup.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Group1s. + */ +public final class Group1sImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Group1sService service; + + /** + * The service client containing this operation class. + */ + private final TwoOperationGroupClientImpl client; + + /** + * Initializes an instance of Group1sImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Group1sImpl(TwoOperationGroupClientImpl client) { + this.service = RestProxy.create(Group1sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for TwoOperationGroupClientGroup1s to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "TwoOperationGroupClientGroup1s") + public interface Group1sService { + @Post("/one") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> one(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/one") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response oneSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/three") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> three(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/three") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response threeSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/four") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> four(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/four") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fourSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The one operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> oneWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.one(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The one operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response oneWithResponse(RequestOptions requestOptions) { + return service.oneSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } + + /** + * The three operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> threeWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.three(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The three operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response threeWithResponse(RequestOptions requestOptions) { + return service.threeSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } + + /** + * The four operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fourWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.four(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The four operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fourWithResponse(RequestOptions requestOptions) { + return service.fourSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group2sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group2sImpl.java new file mode 100644 index 00000000000..210b49378d4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/Group2sImpl.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.twooperationgroup.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Group2s. + */ +public final class Group2sImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Group2sService service; + + /** + * The service client containing this operation class. + */ + private final TwoOperationGroupClientImpl client; + + /** + * Initializes an instance of Group2sImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Group2sImpl(TwoOperationGroupClientImpl client) { + this.service = RestProxy.create(Group2sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for TwoOperationGroupClientGroup2s to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}/client/structure/{client}") + @ServiceInterface(name = "TwoOperationGroupClientGroup2s") + public interface Group2sService { + @Post("/two") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> two(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/two") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response twoSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/five") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> five(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/five") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fiveSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/six") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> six(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + + @Post("/six") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sixSync(@HostParam("endpoint") String endpoint, @HostParam("client") ClientType client, + RequestOptions requestOptions, Context context); + } + + /** + * The two operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> twoWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.two(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The two operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response twoWithResponse(RequestOptions requestOptions) { + return service.twoSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } + + /** + * The five operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fiveWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.five(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The five operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fiveWithResponse(RequestOptions requestOptions) { + return service.fiveSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } + + /** + * The six operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sixWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.six(this.client.getEndpoint(), this.client.getClient(), requestOptions, context)); + } + + /** + * The six operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sixWithResponse(RequestOptions requestOptions) { + return service.sixSync(this.client.getEndpoint(), this.client.getClient(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/TwoOperationGroupClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/TwoOperationGroupClientImpl.java new file mode 100644 index 00000000000..3fd9b54985c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/TwoOperationGroupClientImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.twooperationgroup.implementation; + +import client.structure.service.models.ClientType; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 TwoOperationGroupClient type. + */ +public final class TwoOperationGroupClientImpl { + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + private final ClientType client; + + /** + * Gets Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + * + * @return the client value. + */ + public ClientType getClient() { + return this.client; + } + + /** + * 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 Group1sImpl object to access its operations. + */ + private final Group1sImpl group1s; + + /** + * Gets the Group1sImpl object to access its operations. + * + * @return the Group1sImpl object. + */ + public Group1sImpl getGroup1s() { + return this.group1s; + } + + /** + * The Group2sImpl object to access its operations. + */ + private final Group2sImpl group2s; + + /** + * Gets the Group2sImpl object to access its operations. + * + * @return the Group2sImpl object. + */ + public Group2sImpl getGroup2s() { + return this.group2s; + } + + /** + * Initializes an instance of TwoOperationGroupClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public TwoOperationGroupClientImpl(String endpoint, ClientType client) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of TwoOperationGroupClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public TwoOperationGroupClientImpl(HttpPipeline httpPipeline, String endpoint, ClientType client) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, client); + } + + /** + * Initializes an instance of TwoOperationGroupClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param client Need to be set as 'default', 'multi-client', 'renamed-operation', 'two-operation-group' in client. + */ + public TwoOperationGroupClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + ClientType client) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.client = client; + this.group1s = new Group1sImpl(this); + this.group2s = new Group2sImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/package-info.java new file mode 100644 index 00000000000..799b292b9dd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/implementation/package-info.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Service. + * Test that we can use @client and @operationGroup decorators to customize client side code structure, such + * as: + * 1. have everything as default. + * 2. to rename client or operation group + * 3. one client can have more than one operations groups + * 4. split one interface into two clients + * 5. have two clients with operations come from different interfaces + * 6. have two clients with a hierarchy relation. + * + */ +package client.structure.twooperationgroup.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/package-info.java new file mode 100644 index 00000000000..e3d68ebcf75 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/client/structure/twooperationgroup/package-info.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Service. + * Test that we can use @client and @operationGroup decorators to customize client side code structure, such + * as: + * 1. have everything as default. + * 2. to rename client or operation group + * 3. one client can have more than one operations groups + * 4. split one interface into two clients + * 5. have two clients with operations come from different interfaces + * 6. have two clients with a hierarchy relation. + * + */ +package client.structure.twooperationgroup; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/DocumentationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/DocumentationClientBuilder.java new file mode 100644 index 00000000000..66fcf8f2936 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/DocumentationClientBuilder.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package documentation; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import documentation.implementation.DocumentationClientImpl; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the DocumentationClient type. + */ +@ServiceClientBuilder( + serviceClients = { + ListsClient.class, + TextFormattingClient.class, + ListsAsyncClient.class, + TextFormattingAsyncClient.class }) +public final class DocumentationClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("documentation.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the DocumentationClientBuilder. + */ + @Generated + public DocumentationClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DocumentationClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DocumentationClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DocumentationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DocumentationClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DocumentationClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DocumentationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DocumentationClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DocumentationClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the DocumentationClientBuilder. + */ + @Generated + public DocumentationClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of DocumentationClientImpl with the provided parameters. + * + * @return an instance of DocumentationClientImpl. + */ + @Generated + private DocumentationClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + DocumentationClientImpl client = new DocumentationClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ListsAsyncClient class. + * + * @return an instance of ListsAsyncClient. + */ + @Generated + public ListsAsyncClient buildListsAsyncClient() { + return new ListsAsyncClient(buildInnerClient().getLists()); + } + + /** + * Builds an instance of TextFormattingAsyncClient class. + * + * @return an instance of TextFormattingAsyncClient. + */ + @Generated + public TextFormattingAsyncClient buildTextFormattingAsyncClient() { + return new TextFormattingAsyncClient(buildInnerClient().getTextFormattings()); + } + + /** + * Builds an instance of ListsClient class. + * + * @return an instance of ListsClient. + */ + @Generated + public ListsClient buildListsClient() { + return new ListsClient(buildInnerClient().getLists()); + } + + /** + * Builds an instance of TextFormattingClient class. + * + * @return an instance of TextFormattingClient. + */ + @Generated + public TextFormattingClient buildTextFormattingClient() { + return new TextFormattingClient(buildInnerClient().getTextFormattings()); + } + + private static final ClientLogger LOGGER = new ClientLogger(DocumentationClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsAsyncClient.java new file mode 100644 index 00000000000..9be33080835 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsAsyncClient.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package documentation; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import documentation.implementation.ListsImpl; +import documentation.lists.implementation.models.BulletPointsModelRequest; +import documentation.lists.models.BulletPointsModel; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DocumentationClient type. + */ +@ServiceClient(builder = DocumentationClientBuilder.class, isAsync = true) +public final class ListsAsyncClient { + @Generated + private final ListsImpl serviceClient; + + /** + * Initializes an instance of ListsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ListsAsyncClient(ListsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * This tests: + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet + * points within documentation comments. It should properly indent the wrapped lines. + * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting + * is preserved when the text wraps onto multiple lines in the generated documentation. + * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the + * wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic + * formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how + * the bold formatting is maintained across wrapped lines. + * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that + * italic formatting is correctly applied even when the text spans multiple lines. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> bulletPointsOpWithResponse(RequestOptions requestOptions) { + return this.serviceClient.bulletPointsOpWithResponseAsync(requestOptions); + } + + /** + * The bulletPointsModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     input (Required): {
+     *         prop: String(Simple/Bold/Italic) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param bulletPointsModelRequest The bulletPointsModelRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> bulletPointsModelWithResponse(BinaryData bulletPointsModelRequest, + RequestOptions requestOptions) { + return this.serviceClient.bulletPointsModelWithResponseAsync(bulletPointsModelRequest, requestOptions); + } + + /** + * Steps to follow: + * 1. First step with **important** note + * 2. Second step with *emphasis* + * 3. Third step combining **bold** and *italic* + * 4. **Final step**: Review all steps for *accuracy*. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> numberedWithResponse(RequestOptions requestOptions) { + return this.serviceClient.numberedWithResponseAsync(requestOptions); + } + + /** + * This tests: + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet + * points within documentation comments. It should properly indent the wrapped lines. + * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting + * is preserved when the text wraps onto multiple lines in the generated documentation. + * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the + * wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic + * formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how + * the bold formatting is maintained across wrapped lines. + * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that + * italic formatting is correctly applied even when the text spans multiple lines. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono bulletPointsOp() { + // Generated convenience method for bulletPointsOpWithResponse + RequestOptions requestOptions = new RequestOptions(); + return bulletPointsOpWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The bulletPointsModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono bulletPointsModel(BulletPointsModel input) { + // Generated convenience method for bulletPointsModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + BulletPointsModelRequest bulletPointsModelRequestObj = new BulletPointsModelRequest(input); + BinaryData bulletPointsModelRequest = BinaryData.fromObject(bulletPointsModelRequestObj); + return bulletPointsModelWithResponse(bulletPointsModelRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Steps to follow: + * 1. First step with **important** note + * 2. Second step with *emphasis* + * 3. Third step combining **bold** and *italic* + * 4. **Final step**: Review all steps for *accuracy*. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono numbered() { + // Generated convenience method for numberedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return numberedWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsClient.java new file mode 100644 index 00000000000..8d609982a08 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/ListsClient.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package documentation; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import documentation.implementation.ListsImpl; +import documentation.lists.implementation.models.BulletPointsModelRequest; +import documentation.lists.models.BulletPointsModel; + +/** + * Initializes a new instance of the synchronous DocumentationClient type. + */ +@ServiceClient(builder = DocumentationClientBuilder.class) +public final class ListsClient { + @Generated + private final ListsImpl serviceClient; + + /** + * Initializes an instance of ListsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ListsClient(ListsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * This tests: + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet + * points within documentation comments. It should properly indent the wrapped lines. + * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting + * is preserved when the text wraps onto multiple lines in the generated documentation. + * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the + * wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic + * formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how + * the bold formatting is maintained across wrapped lines. + * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that + * italic formatting is correctly applied even when the text spans multiple lines. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response bulletPointsOpWithResponse(RequestOptions requestOptions) { + return this.serviceClient.bulletPointsOpWithResponse(requestOptions); + } + + /** + * The bulletPointsModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     input (Required): {
+     *         prop: String(Simple/Bold/Italic) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param bulletPointsModelRequest The bulletPointsModelRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response bulletPointsModelWithResponse(BinaryData bulletPointsModelRequest, + RequestOptions requestOptions) { + return this.serviceClient.bulletPointsModelWithResponse(bulletPointsModelRequest, requestOptions); + } + + /** + * Steps to follow: + * 1. First step with **important** note + * 2. Second step with *emphasis* + * 3. Third step combining **bold** and *italic* + * 4. **Final step**: Review all steps for *accuracy*. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response numberedWithResponse(RequestOptions requestOptions) { + return this.serviceClient.numberedWithResponse(requestOptions); + } + + /** + * This tests: + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet + * points within documentation comments. It should properly indent the wrapped lines. + * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting + * is preserved when the text wraps onto multiple lines in the generated documentation. + * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the + * wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic + * formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how + * the bold formatting is maintained across wrapped lines. + * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that + * italic formatting is correctly applied even when the text spans multiple lines. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void bulletPointsOp() { + // Generated convenience method for bulletPointsOpWithResponse + RequestOptions requestOptions = new RequestOptions(); + bulletPointsOpWithResponse(requestOptions).getValue(); + } + + /** + * The bulletPointsModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void bulletPointsModel(BulletPointsModel input) { + // Generated convenience method for bulletPointsModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + BulletPointsModelRequest bulletPointsModelRequestObj = new BulletPointsModelRequest(input); + BinaryData bulletPointsModelRequest = BinaryData.fromObject(bulletPointsModelRequestObj); + bulletPointsModelWithResponse(bulletPointsModelRequest, requestOptions).getValue(); + } + + /** + * Steps to follow: + * 1. First step with **important** note + * 2. Second step with *emphasis* + * 3. Third step combining **bold** and *italic* + * 4. **Final step**: Review all steps for *accuracy*. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void numbered() { + // Generated convenience method for numberedWithResponse + RequestOptions requestOptions = new RequestOptions(); + numberedWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingAsyncClient.java new file mode 100644 index 00000000000..333f94325bd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingAsyncClient.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package documentation; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import documentation.implementation.TextFormattingsImpl; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DocumentationClient type. + */ +@ServiceClient(builder = DocumentationClientBuilder.class, isAsync = true) +public final class TextFormattingAsyncClient { + @Generated + private final TextFormattingsImpl serviceClient; + + /** + * Initializes an instance of TextFormattingAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TextFormattingAsyncClient(TextFormattingsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * This is **bold text** in the middle of a sentence. + * This is a sentence with **multiple bold** sections and **another bold** section. + * **This entire sentence is bold.**. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> boldTextWithResponse(RequestOptions requestOptions) { + return this.serviceClient.boldTextWithResponseAsync(requestOptions); + } + + /** + * This is *italic text* in the middle of a sentence. + * This is a sentence with *multiple italic* sections and *another italic* section. + * *This entire sentence is italic.*. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> italicTextWithResponse(RequestOptions requestOptions) { + return this.serviceClient.italicTextWithResponseAsync(requestOptions); + } + + /** + * This sentence has **bold**, *italic*, and ***bold italic*** text. + * You can also combine them like **bold with *italic inside* bold**. + * Or *italic with **bold inside** italic*. + * This is a sentence with **bold**, *italic*, and ***bold italic*** text. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> combinedFormattingWithResponse(RequestOptions requestOptions) { + return this.serviceClient.combinedFormattingWithResponseAsync(requestOptions); + } + + /** + * This is **bold text** in the middle of a sentence. + * This is a sentence with **multiple bold** sections and **another bold** section. + * **This entire sentence is bold.**. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono boldText() { + // Generated convenience method for boldTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + return boldTextWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * This is *italic text* in the middle of a sentence. + * This is a sentence with *multiple italic* sections and *another italic* section. + * *This entire sentence is italic.*. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono italicText() { + // Generated convenience method for italicTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + return italicTextWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * This sentence has **bold**, *italic*, and ***bold italic*** text. + * You can also combine them like **bold with *italic inside* bold**. + * Or *italic with **bold inside** italic*. + * This is a sentence with **bold**, *italic*, and ***bold italic*** text. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono combinedFormatting() { + // Generated convenience method for combinedFormattingWithResponse + RequestOptions requestOptions = new RequestOptions(); + return combinedFormattingWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingClient.java new file mode 100644 index 00000000000..da0f8a3fbf6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/TextFormattingClient.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package documentation; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import documentation.implementation.TextFormattingsImpl; + +/** + * Initializes a new instance of the synchronous DocumentationClient type. + */ +@ServiceClient(builder = DocumentationClientBuilder.class) +public final class TextFormattingClient { + @Generated + private final TextFormattingsImpl serviceClient; + + /** + * Initializes an instance of TextFormattingClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TextFormattingClient(TextFormattingsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * This is **bold text** in the middle of a sentence. + * This is a sentence with **multiple bold** sections and **another bold** section. + * **This entire sentence is bold.**. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response boldTextWithResponse(RequestOptions requestOptions) { + return this.serviceClient.boldTextWithResponse(requestOptions); + } + + /** + * This is *italic text* in the middle of a sentence. + * This is a sentence with *multiple italic* sections and *another italic* section. + * *This entire sentence is italic.*. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response italicTextWithResponse(RequestOptions requestOptions) { + return this.serviceClient.italicTextWithResponse(requestOptions); + } + + /** + * This sentence has **bold**, *italic*, and ***bold italic*** text. + * You can also combine them like **bold with *italic inside* bold**. + * Or *italic with **bold inside** italic*. + * This is a sentence with **bold**, *italic*, and ***bold italic*** text. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response combinedFormattingWithResponse(RequestOptions requestOptions) { + return this.serviceClient.combinedFormattingWithResponse(requestOptions); + } + + /** + * This is **bold text** in the middle of a sentence. + * This is a sentence with **multiple bold** sections and **another bold** section. + * **This entire sentence is bold.**. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void boldText() { + // Generated convenience method for boldTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + boldTextWithResponse(requestOptions).getValue(); + } + + /** + * This is *italic text* in the middle of a sentence. + * This is a sentence with *multiple italic* sections and *another italic* section. + * *This entire sentence is italic.*. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void italicText() { + // Generated convenience method for italicTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + italicTextWithResponse(requestOptions).getValue(); + } + + /** + * This sentence has **bold**, *italic*, and ***bold italic*** text. + * You can also combine them like **bold with *italic inside* bold**. + * Or *italic with **bold inside** italic*. + * This is a sentence with **bold**, *italic*, and ***bold italic*** text. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void combinedFormatting() { + // Generated convenience method for combinedFormattingWithResponse + RequestOptions requestOptions = new RequestOptions(); + combinedFormattingWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/DocumentationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/DocumentationClientImpl.java new file mode 100644 index 00000000000..e856209854a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/DocumentationClientImpl.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package documentation.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 DocumentationClient type. + */ +public final class DocumentationClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 ListsImpl object to access its operations. + */ + private final ListsImpl lists; + + /** + * Gets the ListsImpl object to access its operations. + * + * @return the ListsImpl object. + */ + public ListsImpl getLists() { + return this.lists; + } + + /** + * The TextFormattingsImpl object to access its operations. + */ + private final TextFormattingsImpl textFormattings; + + /** + * Gets the TextFormattingsImpl object to access its operations. + * + * @return the TextFormattingsImpl object. + */ + public TextFormattingsImpl getTextFormattings() { + return this.textFormattings; + } + + /** + * Initializes an instance of DocumentationClient client. + * + * @param endpoint Service host. + */ + public DocumentationClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DocumentationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public DocumentationClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DocumentationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public DocumentationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.lists = new ListsImpl(this); + this.textFormattings = new TextFormattingsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/ListsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/ListsImpl.java new file mode 100644 index 00000000000..300720a0e38 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/ListsImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package documentation.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Lists. + */ +public final class ListsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ListsService service; + + /** + * The service client containing this operation class. + */ + private final DocumentationClientImpl client; + + /** + * Initializes an instance of ListsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ListsImpl(DocumentationClientImpl client) { + this.service = RestProxy.create(ListsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DocumentationClientLists to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DocumentationClientLists") + public interface ListsService { + @Get("/documentation/lists/bullet-points/op") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> bulletPointsOp(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/documentation/lists/bullet-points/op") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response bulletPointsOpSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Post("/documentation/lists/bullet-points/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> bulletPointsModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData bulletPointsModelRequest, RequestOptions requestOptions, + Context context); + + @Post("/documentation/lists/bullet-points/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response bulletPointsModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData bulletPointsModelRequest, RequestOptions requestOptions, + Context context); + + @Get("/documentation/lists/numbered") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> numbered(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/documentation/lists/numbered") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response numberedSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * This tests: + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet + * points within documentation comments. It should properly indent the wrapped lines. + * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting + * is preserved when the text wraps onto multiple lines in the generated documentation. + * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the + * wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic + * formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how + * the bold formatting is maintained across wrapped lines. + * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that + * italic formatting is correctly applied even when the text spans multiple lines. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> bulletPointsOpWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.bulletPointsOp(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * This tests: + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet + * points within documentation comments. It should properly indent the wrapped lines. + * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting + * is preserved when the text wraps onto multiple lines in the generated documentation. + * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the + * wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic + * formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how + * the bold formatting is maintained across wrapped lines. + * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that + * italic formatting is correctly applied even when the text spans multiple lines. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response bulletPointsOpWithResponse(RequestOptions requestOptions) { + return service.bulletPointsOpSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The bulletPointsModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     input (Required): {
+     *         prop: String(Simple/Bold/Italic) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param bulletPointsModelRequest The bulletPointsModelRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> bulletPointsModelWithResponseAsync(BinaryData bulletPointsModelRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.bulletPointsModel(this.client.getEndpoint(), contentType, + bulletPointsModelRequest, requestOptions, context)); + } + + /** + * The bulletPointsModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     input (Required): {
+     *         prop: String(Simple/Bold/Italic) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param bulletPointsModelRequest The bulletPointsModelRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response bulletPointsModelWithResponse(BinaryData bulletPointsModelRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.bulletPointsModelSync(this.client.getEndpoint(), contentType, bulletPointsModelRequest, + requestOptions, Context.NONE); + } + + /** + * Steps to follow: + * 1. First step with **important** note + * 2. Second step with *emphasis* + * 3. Third step combining **bold** and *italic* + * 4. **Final step**: Review all steps for *accuracy*. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> numberedWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.numbered(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * Steps to follow: + * 1. First step with **important** note + * 2. Second step with *emphasis* + * 3. Third step combining **bold** and *italic* + * 4. **Final step**: Review all steps for *accuracy*. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response numberedWithResponse(RequestOptions requestOptions) { + return service.numberedSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/TextFormattingsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/TextFormattingsImpl.java new file mode 100644 index 00000000000..714c5ca8436 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/TextFormattingsImpl.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package documentation.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in TextFormattings. + */ +public final class TextFormattingsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final TextFormattingsService service; + + /** + * The service client containing this operation class. + */ + private final DocumentationClientImpl client; + + /** + * Initializes an instance of TextFormattingsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TextFormattingsImpl(DocumentationClientImpl client) { + this.service + = RestProxy.create(TextFormattingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DocumentationClientTextFormattings to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DocumentationClientTextFormattings") + public interface TextFormattingsService { + @Get("/documentation/text-formatting/bold") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> boldText(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/documentation/text-formatting/bold") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response boldTextSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/documentation/text-formatting/italic") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> italicText(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/documentation/text-formatting/italic") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response italicTextSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/documentation/text-formatting/combined") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> combinedFormatting(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/documentation/text-formatting/combined") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response combinedFormattingSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * This is **bold text** in the middle of a sentence. + * This is a sentence with **multiple bold** sections and **another bold** section. + * **This entire sentence is bold.**. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> boldTextWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.boldText(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * This is **bold text** in the middle of a sentence. + * This is a sentence with **multiple bold** sections and **another bold** section. + * **This entire sentence is bold.**. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response boldTextWithResponse(RequestOptions requestOptions) { + return service.boldTextSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * This is *italic text* in the middle of a sentence. + * This is a sentence with *multiple italic* sections and *another italic* section. + * *This entire sentence is italic.*. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> italicTextWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.italicText(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * This is *italic text* in the middle of a sentence. + * This is a sentence with *multiple italic* sections and *another italic* section. + * *This entire sentence is italic.*. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response italicTextWithResponse(RequestOptions requestOptions) { + return service.italicTextSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * This sentence has **bold**, *italic*, and ***bold italic*** text. + * You can also combine them like **bold with *italic inside* bold**. + * Or *italic with **bold inside** italic*. + * This is a sentence with **bold**, *italic*, and ***bold italic*** text. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> combinedFormattingWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.combinedFormatting(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * This sentence has **bold**, *italic*, and ***bold italic*** text. + * You can also combine them like **bold with *italic inside* bold**. + * Or *italic with **bold inside** italic*. + * This is a sentence with **bold**, *italic*, and ***bold italic*** text. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response combinedFormattingWithResponse(RequestOptions requestOptions) { + return service.combinedFormattingSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/package-info.java new file mode 100644 index 00000000000..cf5c015aeea --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Documentation. + * Illustrates documentation generation and formatting features. + * + */ +package documentation.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/BulletPointsModelRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/BulletPointsModelRequest.java new file mode 100644 index 00000000000..33c31b8319a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/BulletPointsModelRequest.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package documentation.lists.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import documentation.lists.models.BulletPointsModel; +import java.io.IOException; + +/** + * The BulletPointsModelRequest model. + */ +@Immutable +public final class BulletPointsModelRequest implements JsonSerializable { + /* + * The input property. + */ + @Generated + private final BulletPointsModel input; + + /** + * Creates an instance of BulletPointsModelRequest class. + * + * @param input the input value to set. + */ + @Generated + public BulletPointsModelRequest(BulletPointsModel input) { + this.input = input; + } + + /** + * Get the input property: The input property. + * + * @return the input value. + */ + @Generated + public BulletPointsModel getInput() { + return this.input; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("input", this.input); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BulletPointsModelRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BulletPointsModelRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BulletPointsModelRequest. + */ + @Generated + public static BulletPointsModelRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BulletPointsModel input = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("input".equals(fieldName)) { + input = BulletPointsModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new BulletPointsModelRequest(input); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/package-info.java new file mode 100644 index 00000000000..14161731cbc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/implementation/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Documentation. + * Illustrates documentation generation and formatting features. + * + */ +package documentation.lists.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsEnum.java new file mode 100644 index 00000000000..cc5f71d6248 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsEnum.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package documentation.lists.models; + +/** + * This tests really long bullet points in enum documentation to see how wrapping and formatting are handled. This + * should wrap around correctly and maintain proper indentation for each line. + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet + * points within documentation comments. It should properly indent the wrapped lines. + * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is + * preserved when the text wraps onto multiple lines in the generated documentation. + * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the + * wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic + * formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how the + * bold formatting is maintained across wrapped lines. + * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that + * italic formatting is correctly applied even when the text spans multiple lines. + */ +public enum BulletPointsEnum { + /** + * Simple bullet point. This line is intentionally long to test text wrapping in bullet points within enum + * documentation comments. It should properly indent the wrapped lines. + * - One: one. This line is intentionally long to test text wrapping in bullet points within enum documentation + * comments. It should properly indent the wrapped lines. + * - Two: two. This line is intentionally long to test text wrapping in bullet points within enum documentation + * comments. It should properly indent the wrapped lines. + */ + SIMPLE("Simple"), + + /** + * Bullet point with **bold text**. This line is intentionally long to test text wrapping in bullet points within + * enum documentation comments. It should properly indent the wrapped lines. + * - **One**: one. This line is intentionally long to test text wrapping in bullet points within enum documentation + * comments. It should properly indent the wrapped lines. + * - **Two**: two. This line is intentionally long to test text wrapping in bullet points within enum documentation + * comments. It should properly indent the wrapped lines. + */ + BOLD("Bold"), + + /** + * Bullet point with *italic text*. This line is intentionally long to test text wrapping in bullet points within + * enum documentation comments. It should properly indent the wrapped lines. + * - *One*: one. This line is intentionally long to test text wrapping in bullet points within enum documentation + * comments. It should properly indent the wrapped lines. + * - *Two*: two. This line is intentionally long to test text wrapping in bullet points within enum documentation + * comments. It should properly indent the wrapped lines. + */ + ITALIC("Italic"); + + /** + * The actual serialized value for a BulletPointsEnum instance. + */ + private final String value; + + BulletPointsEnum(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a BulletPointsEnum instance. + * + * @param value the serialized value to parse. + * @return the parsed BulletPointsEnum object, or null if unable to parse. + */ + public static BulletPointsEnum fromString(String value) { + if (value == null) { + return null; + } + BulletPointsEnum[] items = BulletPointsEnum.values(); + for (BulletPointsEnum item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsModel.java new file mode 100644 index 00000000000..7d67f328555 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/BulletPointsModel.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package documentation.lists.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This tests: + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet + * points within documentation comments. It should properly indent the wrapped lines. + * - Another bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is + * preserved when the text wraps onto multiple lines in the generated documentation. + * - Third bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the + * wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic + * formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point**: A bullet point that is entirely bolded. This point is also made lengthy to observe how the + * bold formatting is maintained across wrapped lines. + * - *Italic bullet point*: A bullet point that is entirely italicized. This final point is extended to verify that + * italic formatting is correctly applied even when the text spans multiple lines. + */ +@Immutable +public final class BulletPointsModel implements JsonSerializable { + /* + * This property uses an enum with bullet point documentation. The enum documentation includes various formatting + * styles to test rendering. The styles are: + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet + * points within documentation comments. It should properly indent the wrapped lines. + * - Bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is + * preserved when the text wraps onto multiple + * - Bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the + * wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic + * formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point** + * - *Italic bullet point* + */ + @Generated + private final BulletPointsEnum prop; + + /** + * Creates an instance of BulletPointsModel class. + * + * @param prop the prop value to set. + */ + @Generated + public BulletPointsModel(BulletPointsEnum prop) { + this.prop = prop; + } + + /** + * Get the prop property: This property uses an enum with bullet point documentation. The enum documentation + * includes various formatting styles to test rendering. The styles are: + * - Simple bullet point. This bullet point is going to be very long to test how text wrapping is handled in bullet + * points within documentation comments. It should properly indent the wrapped lines. + * - Bullet point with **bold text**. This bullet point is also intentionally long to see how the formatting is + * preserved when the text wraps onto multiple + * - Bullet point with *italic text*. Similar to the previous points, this one is extended to ensure that the + * wrapping and formatting are correctly applied in the output. + * - Complex bullet point with **bold** and *italic* combined. This bullet point combines both bold and italic + * formatting and is long enough to test the wrapping behavior in such cases. + * - **Bold bullet point** + * - *Italic bullet point*. + * + * @return the prop value. + */ + @Generated + public BulletPointsEnum getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BulletPointsModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BulletPointsModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BulletPointsModel. + */ + @Generated + public static BulletPointsModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BulletPointsEnum prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = BulletPointsEnum.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new BulletPointsModel(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/package-info.java new file mode 100644 index 00000000000..18b20f6214a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/lists/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Documentation. + * Illustrates documentation generation and formatting features. + * + */ +package documentation.lists.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/package-info.java new file mode 100644 index 00000000000..c1de9ece111 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/documentation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Documentation. + * Illustrates documentation generation and formatting features. + * + */ +package documentation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayAsyncClient.java new file mode 100644 index 00000000000..c1f61049463 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayAsyncClient.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import encode.array.implementation.PropertiesImpl; +import encode.array.models.CommaDelimitedArrayProperty; +import encode.array.models.NewlineDelimitedArrayProperty; +import encode.array.models.PipeDelimitedArrayProperty; +import encode.array.models.SpaceDelimitedArrayProperty; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class ArrayAsyncClient { + @Generated + private final PropertiesImpl serviceClient; + + /** + * Initializes an instance of ArrayAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ArrayAsyncClient(PropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The commaDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> commaDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.commaDelimitedWithResponseAsync(body, requestOptions); + } + + /** + * The spaceDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spaceDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.spaceDelimitedWithResponseAsync(body, requestOptions); + } + + /** + * The pipeDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> pipeDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.pipeDelimitedWithResponseAsync(body, requestOptions); + } + + /** + * The newlineDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> newlineDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.newlineDelimitedWithResponseAsync(body, requestOptions); + } + + /** + * The commaDelimited operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono commaDelimited(CommaDelimitedArrayProperty body) { + // Generated convenience method for commaDelimitedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return commaDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CommaDelimitedArrayProperty.class)); + } + + /** + * The spaceDelimited operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono spaceDelimited(SpaceDelimitedArrayProperty body) { + // Generated convenience method for spaceDelimitedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return spaceDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SpaceDelimitedArrayProperty.class)); + } + + /** + * The pipeDelimited operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono pipeDelimited(PipeDelimitedArrayProperty body) { + // Generated convenience method for pipeDelimitedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return pipeDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PipeDelimitedArrayProperty.class)); + } + + /** + * The newlineDelimited operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono newlineDelimited(NewlineDelimitedArrayProperty body) { + // Generated convenience method for newlineDelimitedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return newlineDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(NewlineDelimitedArrayProperty.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClient.java new file mode 100644 index 00000000000..eba503c660f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClient.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import encode.array.implementation.PropertiesImpl; +import encode.array.models.CommaDelimitedArrayProperty; +import encode.array.models.NewlineDelimitedArrayProperty; +import encode.array.models.PipeDelimitedArrayProperty; +import encode.array.models.SpaceDelimitedArrayProperty; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class ArrayClient { + @Generated + private final PropertiesImpl serviceClient; + + /** + * Initializes an instance of ArrayClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ArrayClient(PropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The commaDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response commaDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.commaDelimitedWithResponse(body, requestOptions); + } + + /** + * The spaceDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spaceDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.spaceDelimitedWithResponse(body, requestOptions); + } + + /** + * The pipeDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response pipeDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.pipeDelimitedWithResponse(body, requestOptions); + } + + /** + * The newlineDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response newlineDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.newlineDelimitedWithResponse(body, requestOptions); + } + + /** + * The commaDelimited operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CommaDelimitedArrayProperty commaDelimited(CommaDelimitedArrayProperty body) { + // Generated convenience method for commaDelimitedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return commaDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(CommaDelimitedArrayProperty.class); + } + + /** + * The spaceDelimited operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SpaceDelimitedArrayProperty spaceDelimited(SpaceDelimitedArrayProperty body) { + // Generated convenience method for spaceDelimitedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return spaceDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(SpaceDelimitedArrayProperty.class); + } + + /** + * The pipeDelimited operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PipeDelimitedArrayProperty pipeDelimited(PipeDelimitedArrayProperty body) { + // Generated convenience method for pipeDelimitedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return pipeDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(PipeDelimitedArrayProperty.class); + } + + /** + * The newlineDelimited operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public NewlineDelimitedArrayProperty newlineDelimited(NewlineDelimitedArrayProperty body) { + // Generated convenience method for newlineDelimitedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return newlineDelimitedWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(NewlineDelimitedArrayProperty.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClientBuilder.java new file mode 100644 index 00000000000..e2ea5c59755 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/ArrayClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import encode.array.implementation.ArrayClientImpl; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the ArrayClient type. + */ +@ServiceClientBuilder(serviceClients = { ArrayClient.class, ArrayAsyncClient.class }) +public final class ArrayClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("encode-array.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ArrayClientBuilder. + */ + @Generated + public ArrayClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ArrayClientBuilder. + */ + @Generated + public ArrayClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ArrayClientImpl with the provided parameters. + * + * @return an instance of ArrayClientImpl. + */ + @Generated + private ArrayClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ArrayClientImpl client + = new ArrayClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ArrayAsyncClient class. + * + * @return an instance of ArrayAsyncClient. + */ + @Generated + public ArrayAsyncClient buildAsyncClient() { + return new ArrayAsyncClient(buildInnerClient().getProperties()); + } + + /** + * Builds an instance of ArrayClient class. + * + * @return an instance of ArrayClient. + */ + @Generated + public ArrayClient buildClient() { + return new ArrayClient(buildInnerClient().getProperties()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ArrayClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/ArrayClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/ArrayClientImpl.java new file mode 100644 index 00000000000..14b21d0341a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/ArrayClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.array.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 ArrayClient type. + */ +public final class ArrayClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 PropertiesImpl object to access its operations. + */ + private final PropertiesImpl properties; + + /** + * Gets the PropertiesImpl object to access its operations. + * + * @return the PropertiesImpl object. + */ + public PropertiesImpl getProperties() { + return this.properties; + } + + /** + * Initializes an instance of ArrayClient client. + * + * @param endpoint Service host. + */ + public ArrayClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ArrayClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ArrayClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ArrayClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ArrayClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.properties = new PropertiesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/PropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/PropertiesImpl.java new file mode 100644 index 00000000000..ee142d68512 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/PropertiesImpl.java @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Properties. + */ +public final class PropertiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PropertiesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of PropertiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PropertiesImpl(ArrayClientImpl client) { + this.service + = RestProxy.create(PropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientProperties to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientProperties") + public interface PropertiesService { + @Post("/encode/array/property/comma-delimited") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> commaDelimited(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/array/property/comma-delimited") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response commaDelimitedSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/array/property/space-delimited") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> spaceDelimited(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/array/property/space-delimited") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response spaceDelimitedSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/array/property/pipe-delimited") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> pipeDelimited(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/array/property/pipe-delimited") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response pipeDelimitedSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/array/property/newline-delimited") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> newlineDelimited(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/array/property/newline-delimited") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response newlineDelimitedSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The commaDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> commaDelimitedWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.commaDelimited(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The commaDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response commaDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.commaDelimitedSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The spaceDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spaceDelimitedWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.spaceDelimited(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The spaceDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spaceDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.spaceDelimitedSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The pipeDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> pipeDelimitedWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.pipeDelimited(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The pipeDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response pipeDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.pipeDelimitedSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The newlineDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> newlineDelimitedWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.newlineDelimited(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The newlineDelimited operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response newlineDelimitedWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.newlineDelimitedSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/package-info.java new file mode 100644 index 00000000000..57c9ca5eac9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Array. + * Test for encode decorator on array. + * + */ +package encode.array.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/CommaDelimitedArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/CommaDelimitedArrayProperty.java new file mode 100644 index 00000000000..25747bc7fe0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/CommaDelimitedArrayProperty.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.array.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * The CommaDelimitedArrayProperty model. + */ +@Immutable +public final class CommaDelimitedArrayProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final List value; + + /** + * Creates an instance of CommaDelimitedArrayProperty class. + * + * @param value the value value to set. + */ + @Generated + public CommaDelimitedArrayProperty(List value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (this.value != null) { + jsonWriter.writeStringField("value", + this.value.stream().map(element -> element == null ? "" : element).collect(Collectors.joining(","))); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommaDelimitedArrayProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommaDelimitedArrayProperty if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CommaDelimitedArrayProperty. + */ + @Generated + public static CommaDelimitedArrayProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + String valueEncodedAsString = reader.getString(); + value = valueEncodedAsString == null + ? null + : valueEncodedAsString.isEmpty() + ? new LinkedList<>() + : new LinkedList<>(Arrays.asList(valueEncodedAsString.split(",", -1))); + } else { + reader.skipChildren(); + } + } + return new CommaDelimitedArrayProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/NewlineDelimitedArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/NewlineDelimitedArrayProperty.java new file mode 100644 index 00000000000..03acae4ccd1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/NewlineDelimitedArrayProperty.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.array.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * The NewlineDelimitedArrayProperty model. + */ +@Immutable +public final class NewlineDelimitedArrayProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final List value; + + /** + * Creates an instance of NewlineDelimitedArrayProperty class. + * + * @param value the value value to set. + */ + @Generated + public NewlineDelimitedArrayProperty(List value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (this.value != null) { + jsonWriter.writeStringField("value", + this.value.stream().map(element -> element == null ? "" : element).collect(Collectors.joining("\n"))); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NewlineDelimitedArrayProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NewlineDelimitedArrayProperty if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NewlineDelimitedArrayProperty. + */ + @Generated + public static NewlineDelimitedArrayProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + String valueEncodedAsString = reader.getString(); + value = valueEncodedAsString == null + ? null + : valueEncodedAsString.isEmpty() + ? new LinkedList<>() + : new LinkedList<>(Arrays.asList(valueEncodedAsString.split("\n", -1))); + } else { + reader.skipChildren(); + } + } + return new NewlineDelimitedArrayProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/PipeDelimitedArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/PipeDelimitedArrayProperty.java new file mode 100644 index 00000000000..37a143a7016 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/PipeDelimitedArrayProperty.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.array.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * The PipeDelimitedArrayProperty model. + */ +@Immutable +public final class PipeDelimitedArrayProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final List value; + + /** + * Creates an instance of PipeDelimitedArrayProperty class. + * + * @param value the value value to set. + */ + @Generated + public PipeDelimitedArrayProperty(List value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (this.value != null) { + jsonWriter.writeStringField("value", + this.value.stream().map(element -> element == null ? "" : element).collect(Collectors.joining("|"))); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PipeDelimitedArrayProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PipeDelimitedArrayProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PipeDelimitedArrayProperty. + */ + @Generated + public static PipeDelimitedArrayProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + String valueEncodedAsString = reader.getString(); + value = valueEncodedAsString == null + ? null + : valueEncodedAsString.isEmpty() + ? new LinkedList<>() + : new LinkedList<>(Arrays.asList(valueEncodedAsString.split("\\|", -1))); + } else { + reader.skipChildren(); + } + } + return new PipeDelimitedArrayProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/SpaceDelimitedArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/SpaceDelimitedArrayProperty.java new file mode 100644 index 00000000000..1c270faa5b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/SpaceDelimitedArrayProperty.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.array.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * The SpaceDelimitedArrayProperty model. + */ +@Immutable +public final class SpaceDelimitedArrayProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final List value; + + /** + * Creates an instance of SpaceDelimitedArrayProperty class. + * + * @param value the value value to set. + */ + @Generated + public SpaceDelimitedArrayProperty(List value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (this.value != null) { + jsonWriter.writeStringField("value", + this.value.stream().map(element -> element == null ? "" : element).collect(Collectors.joining(" "))); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpaceDelimitedArrayProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpaceDelimitedArrayProperty if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpaceDelimitedArrayProperty. + */ + @Generated + public static SpaceDelimitedArrayProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + String valueEncodedAsString = reader.getString(); + value = valueEncodedAsString == null + ? null + : valueEncodedAsString.isEmpty() + ? new LinkedList<>() + : new LinkedList<>(Arrays.asList(valueEncodedAsString.split(" ", -1))); + } else { + reader.skipChildren(); + } + } + return new SpaceDelimitedArrayProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/package-info.java new file mode 100644 index 00000000000..7db692b7214 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Array. + * Test for encode decorator on array. + * + */ +package encode.array.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/package-info.java new file mode 100644 index 00000000000..0167f7cae0c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/array/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Array. + * Test for encode decorator on array. + * + */ +package encode.array; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/BytesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/BytesClientBuilder.java new file mode 100644 index 00000000000..ffe0132bbb6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/BytesClientBuilder.java @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import encode.bytes.implementation.BytesClientImpl; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the BytesClient type. + */ +@ServiceClientBuilder( + serviceClients = { + QueryClient.class, + PropertyClient.class, + HeaderClient.class, + RequestBodyClient.class, + ResponseBodyClient.class, + QueryAsyncClient.class, + PropertyAsyncClient.class, + HeaderAsyncClient.class, + RequestBodyAsyncClient.class, + ResponseBodyAsyncClient.class }) +public final class BytesClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("encode-bytes.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the BytesClientBuilder. + */ + @Generated + public BytesClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BytesClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BytesClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BytesClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BytesClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BytesClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BytesClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BytesClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BytesClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the BytesClientBuilder. + */ + @Generated + public BytesClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of BytesClientImpl with the provided parameters. + * + * @return an instance of BytesClientImpl. + */ + @Generated + private BytesClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + BytesClientImpl client + = new BytesClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of QueryAsyncClient class. + * + * @return an instance of QueryAsyncClient. + */ + @Generated + public QueryAsyncClient buildQueryAsyncClient() { + return new QueryAsyncClient(buildInnerClient().getQueries()); + } + + /** + * Builds an instance of PropertyAsyncClient class. + * + * @return an instance of PropertyAsyncClient. + */ + @Generated + public PropertyAsyncClient buildPropertyAsyncClient() { + return new PropertyAsyncClient(buildInnerClient().getProperties()); + } + + /** + * Builds an instance of HeaderAsyncClient class. + * + * @return an instance of HeaderAsyncClient. + */ + @Generated + public HeaderAsyncClient buildHeaderAsyncClient() { + return new HeaderAsyncClient(buildInnerClient().getHeaders()); + } + + /** + * Builds an instance of RequestBodyAsyncClient class. + * + * @return an instance of RequestBodyAsyncClient. + */ + @Generated + public RequestBodyAsyncClient buildRequestBodyAsyncClient() { + return new RequestBodyAsyncClient(buildInnerClient().getRequestBodies()); + } + + /** + * Builds an instance of ResponseBodyAsyncClient class. + * + * @return an instance of ResponseBodyAsyncClient. + */ + @Generated + public ResponseBodyAsyncClient buildResponseBodyAsyncClient() { + return new ResponseBodyAsyncClient(buildInnerClient().getResponseBodies()); + } + + /** + * Builds an instance of QueryClient class. + * + * @return an instance of QueryClient. + */ + @Generated + public QueryClient buildQueryClient() { + return new QueryClient(buildInnerClient().getQueries()); + } + + /** + * Builds an instance of PropertyClient class. + * + * @return an instance of PropertyClient. + */ + @Generated + public PropertyClient buildPropertyClient() { + return new PropertyClient(buildInnerClient().getProperties()); + } + + /** + * Builds an instance of HeaderClient class. + * + * @return an instance of HeaderClient. + */ + @Generated + public HeaderClient buildHeaderClient() { + return new HeaderClient(buildInnerClient().getHeaders()); + } + + /** + * Builds an instance of RequestBodyClient class. + * + * @return an instance of RequestBodyClient. + */ + @Generated + public RequestBodyClient buildRequestBodyClient() { + return new RequestBodyClient(buildInnerClient().getRequestBodies()); + } + + /** + * Builds an instance of ResponseBodyClient class. + * + * @return an instance of ResponseBodyClient. + */ + @Generated + public ResponseBodyClient buildResponseBodyClient() { + return new ResponseBodyClient(buildInnerClient().getResponseBodies()); + } + + private static final ClientLogger LOGGER = new ClientLogger(BytesClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderAsyncClient.java new file mode 100644 index 00000000000..e6db694f911 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderAsyncClient.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import encode.bytes.implementation.HeadersImpl; +import java.util.List; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous BytesClient type. + */ +@ServiceClient(builder = BytesClientBuilder.class, isAsync = true) +public final class HeaderAsyncClient { + @Generated + private final HeadersImpl serviceClient; + + /** + * Initializes an instance of HeaderAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + HeaderAsyncClient(HeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponse(byte[] value, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponseAsync(value, requestOptions); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64WithResponse(byte[] value, RequestOptions requestOptions) { + return this.serviceClient.base64WithResponseAsync(value, requestOptions); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlWithResponse(byte[] value, RequestOptions requestOptions) { + return this.serviceClient.base64urlWithResponseAsync(value, requestOptions); + } + + /** + * The base64urlArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlArrayWithResponse(List value, RequestOptions requestOptions) { + return this.serviceClient.base64urlArrayWithResponseAsync(value, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono defaultMethod(byte[] value) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64(byte[] value) { + // Generated convenience method for base64WithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64WithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64url(byte[] value) { + // Generated convenience method for base64urlWithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64urlWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The base64urlArray operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64urlArray(List value) { + // Generated convenience method for base64urlArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64urlArrayWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderClient.java new file mode 100644 index 00000000000..505615bb621 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/HeaderClient.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import encode.bytes.implementation.HeadersImpl; +import java.util.List; + +/** + * Initializes a new instance of the synchronous BytesClient type. + */ +@ServiceClient(builder = BytesClientBuilder.class) +public final class HeaderClient { + @Generated + private final HeadersImpl serviceClient; + + /** + * Initializes an instance of HeaderClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + HeaderClient(HeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(byte[] value, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponse(value, requestOptions); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64WithResponse(byte[] value, RequestOptions requestOptions) { + return this.serviceClient.base64WithResponse(value, requestOptions); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlWithResponse(byte[] value, RequestOptions requestOptions) { + return this.serviceClient.base64urlWithResponse(value, requestOptions); + } + + /** + * The base64urlArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlArrayWithResponse(List value, RequestOptions requestOptions) { + return this.serviceClient.base64urlArrayWithResponse(value, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void defaultMethod(byte[] value) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + defaultMethodWithResponse(value, requestOptions).getValue(); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void base64(byte[] value) { + // Generated convenience method for base64WithResponse + RequestOptions requestOptions = new RequestOptions(); + base64WithResponse(value, requestOptions).getValue(); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void base64url(byte[] value) { + // Generated convenience method for base64urlWithResponse + RequestOptions requestOptions = new RequestOptions(); + base64urlWithResponse(value, requestOptions).getValue(); + } + + /** + * The base64urlArray operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void base64urlArray(List value) { + // Generated convenience method for base64urlArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + base64urlArrayWithResponse(value, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyAsyncClient.java new file mode 100644 index 00000000000..272680978f0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyAsyncClient.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import encode.bytes.implementation.PropertiesImpl; +import encode.bytes.models.Base64BytesProperty; +import encode.bytes.models.Base64urlArrayBytesProperty; +import encode.bytes.models.Base64urlBytesProperty; +import encode.bytes.models.DefaultBytesProperty; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous BytesClient type. + */ +@ServiceClient(builder = BytesClientBuilder.class, isAsync = true) +public final class PropertyAsyncClient { + @Generated + private final PropertiesImpl serviceClient; + + /** + * Initializes an instance of PropertyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PropertyAsyncClient(PropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponseAsync(body, requestOptions); + } + + /** + * The base64 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.base64WithResponseAsync(body, requestOptions); + } + + /** + * The base64url operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.base64urlWithResponseAsync(body, requestOptions); + } + + /** + * The base64urlArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         Base64Url (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         Base64Url (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.base64urlArrayWithResponseAsync(body, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono defaultMethod(DefaultBytesProperty body) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DefaultBytesProperty.class)); + } + + /** + * The base64 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64(Base64BytesProperty body) { + // Generated convenience method for base64WithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Base64BytesProperty.class)); + } + + /** + * The base64url operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64url(Base64urlBytesProperty body) { + // Generated convenience method for base64urlWithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64urlWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Base64urlBytesProperty.class)); + } + + /** + * The base64urlArray operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64urlArray(Base64urlArrayBytesProperty body) { + // Generated convenience method for base64urlArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64urlArrayWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Base64urlArrayBytesProperty.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyClient.java new file mode 100644 index 00000000000..4176a3a50c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/PropertyClient.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import encode.bytes.implementation.PropertiesImpl; +import encode.bytes.models.Base64BytesProperty; +import encode.bytes.models.Base64urlArrayBytesProperty; +import encode.bytes.models.Base64urlBytesProperty; +import encode.bytes.models.DefaultBytesProperty; + +/** + * Initializes a new instance of the synchronous BytesClient type. + */ +@ServiceClient(builder = BytesClientBuilder.class) +public final class PropertyClient { + @Generated + private final PropertiesImpl serviceClient; + + /** + * Initializes an instance of PropertyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PropertyClient(PropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponse(body, requestOptions); + } + + /** + * The base64 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.base64WithResponse(body, requestOptions); + } + + /** + * The base64url operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.base64urlWithResponse(body, requestOptions); + } + + /** + * The base64urlArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         Base64Url (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         Base64Url (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.base64urlArrayWithResponse(body, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DefaultBytesProperty defaultMethod(DefaultBytesProperty body) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(DefaultBytesProperty.class); + } + + /** + * The base64 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Base64BytesProperty base64(Base64BytesProperty body) { + // Generated convenience method for base64WithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64WithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Base64BytesProperty.class); + } + + /** + * The base64url operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Base64urlBytesProperty base64url(Base64urlBytesProperty body) { + // Generated convenience method for base64urlWithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64urlWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Base64urlBytesProperty.class); + } + + /** + * The base64urlArray operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Base64urlArrayBytesProperty base64urlArray(Base64urlArrayBytesProperty body) { + // Generated convenience method for base64urlArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64urlArrayWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Base64urlArrayBytesProperty.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryAsyncClient.java new file mode 100644 index 00000000000..ecaa3e32c70 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryAsyncClient.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import encode.bytes.implementation.QueriesImpl; +import java.util.List; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous BytesClient type. + */ +@ServiceClient(builder = BytesClientBuilder.class, isAsync = true) +public final class QueryAsyncClient { + @Generated + private final QueriesImpl serviceClient; + + /** + * Initializes an instance of QueryAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryAsyncClient(QueriesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponse(byte[] value, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponseAsync(value, requestOptions); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64WithResponse(byte[] value, RequestOptions requestOptions) { + return this.serviceClient.base64WithResponseAsync(value, requestOptions); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlWithResponse(byte[] value, RequestOptions requestOptions) { + return this.serviceClient.base64urlWithResponseAsync(value, requestOptions); + } + + /** + * The base64urlArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlArrayWithResponse(List value, RequestOptions requestOptions) { + return this.serviceClient.base64urlArrayWithResponseAsync(value, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono defaultMethod(byte[] value) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64(byte[] value) { + // Generated convenience method for base64WithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64WithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64url(byte[] value) { + // Generated convenience method for base64urlWithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64urlWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The base64urlArray operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64urlArray(List value) { + // Generated convenience method for base64urlArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64urlArrayWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryClient.java new file mode 100644 index 00000000000..6c1a43f04a3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/QueryClient.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import encode.bytes.implementation.QueriesImpl; +import java.util.List; + +/** + * Initializes a new instance of the synchronous BytesClient type. + */ +@ServiceClient(builder = BytesClientBuilder.class) +public final class QueryClient { + @Generated + private final QueriesImpl serviceClient; + + /** + * Initializes an instance of QueryClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryClient(QueriesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(byte[] value, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponse(value, requestOptions); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64WithResponse(byte[] value, RequestOptions requestOptions) { + return this.serviceClient.base64WithResponse(value, requestOptions); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlWithResponse(byte[] value, RequestOptions requestOptions) { + return this.serviceClient.base64urlWithResponse(value, requestOptions); + } + + /** + * The base64urlArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlArrayWithResponse(List value, RequestOptions requestOptions) { + return this.serviceClient.base64urlArrayWithResponse(value, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void defaultMethod(byte[] value) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + defaultMethodWithResponse(value, requestOptions).getValue(); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void base64(byte[] value) { + // Generated convenience method for base64WithResponse + RequestOptions requestOptions = new RequestOptions(); + base64WithResponse(value, requestOptions).getValue(); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void base64url(byte[] value) { + // Generated convenience method for base64urlWithResponse + RequestOptions requestOptions = new RequestOptions(); + base64urlWithResponse(value, requestOptions).getValue(); + } + + /** + * The base64urlArray operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void base64urlArray(List value) { + // Generated convenience method for base64urlArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + base64urlArrayWithResponse(value, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyAsyncClient.java new file mode 100644 index 00000000000..1647799a2ae --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyAsyncClient.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Base64Url; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import encode.bytes.implementation.RequestBodiesImpl; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous BytesClient type. + */ +@ServiceClient(builder = BytesClientBuilder.class, isAsync = true) +public final class RequestBodyAsyncClient { + @Generated + private final RequestBodiesImpl serviceClient; + + /** + * Initializes an instance of RequestBodyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RequestBodyAsyncClient(RequestBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponseAsync(value, requestOptions); + } + + /** + * The octetStream operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> octetStreamWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.octetStreamWithResponseAsync(value, requestOptions); + } + + /** + * The customContentType operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> customContentTypeWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.customContentTypeWithResponseAsync(value, requestOptions); + } + + /** + * The base64 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * byte[]
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64WithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.base64WithResponseAsync(value, requestOptions); + } + + /** + * The base64url operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * Base64Url
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.base64urlWithResponseAsync(value, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono defaultMethod(BinaryData value) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The octetStream operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono octetStream(BinaryData value) { + // Generated convenience method for octetStreamWithResponse + RequestOptions requestOptions = new RequestOptions(); + return octetStreamWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The customContentType operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono customContentType(BinaryData value) { + // Generated convenience method for customContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return customContentTypeWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64(byte[] value) { + // Generated convenience method for base64WithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64WithResponse(BinaryData.fromObject(value), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64url(byte[] value) { + // Generated convenience method for base64urlWithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64urlWithResponse(BinaryData.fromObject(Base64Url.encode(value)), requestOptions) + .flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyClient.java new file mode 100644 index 00000000000..799260ac22c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/RequestBodyClient.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Base64Url; +import com.azure.core.util.BinaryData; +import encode.bytes.implementation.RequestBodiesImpl; + +/** + * Initializes a new instance of the synchronous BytesClient type. + */ +@ServiceClient(builder = BytesClientBuilder.class) +public final class RequestBodyClient { + @Generated + private final RequestBodiesImpl serviceClient; + + /** + * Initializes an instance of RequestBodyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RequestBodyClient(RequestBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponse(value, requestOptions); + } + + /** + * The octetStream operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response octetStreamWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.octetStreamWithResponse(value, requestOptions); + } + + /** + * The customContentType operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response customContentTypeWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.customContentTypeWithResponse(value, requestOptions); + } + + /** + * The base64 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * byte[]
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64WithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.base64WithResponse(value, requestOptions); + } + + /** + * The base64url operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * Base64Url
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.base64urlWithResponse(value, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void defaultMethod(BinaryData value) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + defaultMethodWithResponse(value, requestOptions).getValue(); + } + + /** + * The octetStream operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void octetStream(BinaryData value) { + // Generated convenience method for octetStreamWithResponse + RequestOptions requestOptions = new RequestOptions(); + octetStreamWithResponse(value, requestOptions).getValue(); + } + + /** + * The customContentType operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void customContentType(BinaryData value) { + // Generated convenience method for customContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + customContentTypeWithResponse(value, requestOptions).getValue(); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void base64(byte[] value) { + // Generated convenience method for base64WithResponse + RequestOptions requestOptions = new RequestOptions(); + base64WithResponse(BinaryData.fromObject(value), requestOptions).getValue(); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void base64url(byte[] value) { + // Generated convenience method for base64urlWithResponse + RequestOptions requestOptions = new RequestOptions(); + base64urlWithResponse(BinaryData.fromObject(Base64Url.encode(value)), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyAsyncClient.java new file mode 100644 index 00000000000..74791b9b6aa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyAsyncClient.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Base64Url; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import encode.bytes.implementation.ResponseBodiesImpl; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous BytesClient type. + */ +@ServiceClient(builder = BytesClientBuilder.class, isAsync = true) +public final class ResponseBodyAsyncClient { + @Generated + private final ResponseBodiesImpl serviceClient; + + /** + * Initializes an instance of ResponseBodyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ResponseBodyAsyncClient(ResponseBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponseAsync(requestOptions); + } + + /** + * The octetStream operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> octetStreamWithResponse(RequestOptions requestOptions) { + return this.serviceClient.octetStreamWithResponseAsync(requestOptions); + } + + /** + * The customContentType operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> customContentTypeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.customContentTypeWithResponseAsync(requestOptions); + } + + /** + * The base64 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * byte[]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return represent a byte array along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64WithResponse(RequestOptions requestOptions) { + return this.serviceClient.base64WithResponseAsync(requestOptions); + } + + /** + * The base64url operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * Base64Url
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlWithResponse(RequestOptions requestOptions) { + return this.serviceClient.base64urlWithResponseAsync(requestOptions); + } + + /** + * The defaultMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono defaultMethod() { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The octetStream operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono octetStream() { + // Generated convenience method for octetStreamWithResponse + RequestOptions requestOptions = new RequestOptions(); + return octetStreamWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The customContentType operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono customContentType() { + // Generated convenience method for customContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return customContentTypeWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The base64 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represent a byte array on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64() { + // Generated convenience method for base64WithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64WithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(byte[].class)); + } + + /** + * The base64url operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono base64url() { + // Generated convenience method for base64urlWithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64urlWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Base64Url.class).decodedBytes()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyClient.java new file mode 100644 index 00000000000..b0b14afe310 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/ResponseBodyClient.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Base64Url; +import com.azure.core.util.BinaryData; +import encode.bytes.implementation.ResponseBodiesImpl; + +/** + * Initializes a new instance of the synchronous BytesClient type. + */ +@ServiceClient(builder = BytesClientBuilder.class) +public final class ResponseBodyClient { + @Generated + private final ResponseBodiesImpl serviceClient; + + /** + * Initializes an instance of ResponseBodyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ResponseBodyClient(ResponseBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponse(requestOptions); + } + + /** + * The octetStream operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response octetStreamWithResponse(RequestOptions requestOptions) { + return this.serviceClient.octetStreamWithResponse(requestOptions); + } + + /** + * The customContentType operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response customContentTypeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.customContentTypeWithResponse(requestOptions); + } + + /** + * The base64 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * byte[]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return represent a byte array along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64WithResponse(RequestOptions requestOptions) { + return this.serviceClient.base64WithResponse(requestOptions); + } + + /** + * The base64url operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * Base64Url
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlWithResponse(RequestOptions requestOptions) { + return this.serviceClient.base64urlWithResponse(requestOptions); + } + + /** + * The defaultMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData defaultMethod() { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(requestOptions).getValue(); + } + + /** + * The octetStream operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData octetStream() { + // Generated convenience method for octetStreamWithResponse + RequestOptions requestOptions = new RequestOptions(); + return octetStreamWithResponse(requestOptions).getValue(); + } + + /** + * The customContentType operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData customContentType() { + // Generated convenience method for customContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return customContentTypeWithResponse(requestOptions).getValue(); + } + + /** + * The base64 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represent a byte array. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public byte[] base64() { + // Generated convenience method for base64WithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64WithResponse(requestOptions).getValue().toObject(byte[].class); + } + + /** + * The base64url operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public byte[] base64url() { + // Generated convenience method for base64urlWithResponse + RequestOptions requestOptions = new RequestOptions(); + return base64urlWithResponse(requestOptions).getValue().toObject(Base64Url.class).decodedBytes(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/BytesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/BytesClientImpl.java new file mode 100644 index 00000000000..1323b86b63c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/BytesClientImpl.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 BytesClient type. + */ +public final class BytesClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 QueriesImpl object to access its operations. + */ + private final QueriesImpl queries; + + /** + * Gets the QueriesImpl object to access its operations. + * + * @return the QueriesImpl object. + */ + public QueriesImpl getQueries() { + return this.queries; + } + + /** + * The PropertiesImpl object to access its operations. + */ + private final PropertiesImpl properties; + + /** + * Gets the PropertiesImpl object to access its operations. + * + * @return the PropertiesImpl object. + */ + public PropertiesImpl getProperties() { + return this.properties; + } + + /** + * The HeadersImpl object to access its operations. + */ + private final HeadersImpl headers; + + /** + * Gets the HeadersImpl object to access its operations. + * + * @return the HeadersImpl object. + */ + public HeadersImpl getHeaders() { + return this.headers; + } + + /** + * The RequestBodiesImpl object to access its operations. + */ + private final RequestBodiesImpl requestBodies; + + /** + * Gets the RequestBodiesImpl object to access its operations. + * + * @return the RequestBodiesImpl object. + */ + public RequestBodiesImpl getRequestBodies() { + return this.requestBodies; + } + + /** + * The ResponseBodiesImpl object to access its operations. + */ + private final ResponseBodiesImpl responseBodies; + + /** + * Gets the ResponseBodiesImpl object to access its operations. + * + * @return the ResponseBodiesImpl object. + */ + public ResponseBodiesImpl getResponseBodies() { + return this.responseBodies; + } + + /** + * Initializes an instance of BytesClient client. + * + * @param endpoint Service host. + */ + public BytesClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of BytesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public BytesClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of BytesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public BytesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.queries = new QueriesImpl(this); + this.properties = new PropertiesImpl(this); + this.headers = new HeadersImpl(this); + this.requestBodies = new RequestBodiesImpl(this); + this.responseBodies = new ResponseBodiesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/HeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/HeadersImpl.java new file mode 100644 index 00000000000..0edbfd7c626 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/HeadersImpl.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Base64Url; +import com.azure.core.util.Base64Util; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.CollectionFormat; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.List; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Headers. + */ +public final class HeadersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final HeadersService service; + + /** + * The service client containing this operation class. + */ + private final BytesClientImpl client; + + /** + * Initializes an instance of HeadersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HeadersImpl(BytesClientImpl client) { + this.service = RestProxy.create(HeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BytesClientHeaders to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "BytesClientHeaders") + public interface HeadersService { + @Get("/encode/bytes/header/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> defaultMethod(@HostParam("endpoint") String endpoint, @HeaderParam("value") String value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/header/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defaultMethodSync(@HostParam("endpoint") String endpoint, @HeaderParam("value") String value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/header/base64") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64(@HostParam("endpoint") String endpoint, @HeaderParam("value") String value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/header/base64") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64Sync(@HostParam("endpoint") String endpoint, @HeaderParam("value") String value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/header/base64url") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64url(@HostParam("endpoint") String endpoint, @HeaderParam("value") Base64Url value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/header/base64url") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64urlSync(@HostParam("endpoint") String endpoint, @HeaderParam("value") Base64Url value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/header/base64url-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64urlArray(@HostParam("endpoint") String endpoint, @HeaderParam("value") String value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/header/base64url-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64urlArraySync(@HostParam("endpoint") String endpoint, @HeaderParam("value") String value, + RequestOptions requestOptions, Context context); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponseAsync(byte[] value, RequestOptions requestOptions) { + String valueConverted = Base64Util.encodeToString(value); + return FluxUtil.withContext( + context -> service.defaultMethod(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(byte[] value, RequestOptions requestOptions) { + String valueConverted = Base64Util.encodeToString(value); + return service.defaultMethodSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64WithResponseAsync(byte[] value, RequestOptions requestOptions) { + String valueConverted = Base64Util.encodeToString(value); + return FluxUtil + .withContext(context -> service.base64(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64WithResponse(byte[] value, RequestOptions requestOptions) { + String valueConverted = Base64Util.encodeToString(value); + return service.base64Sync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlWithResponseAsync(byte[] value, RequestOptions requestOptions) { + Base64Url valueConverted = Base64Url.encode(value); + return FluxUtil.withContext( + context -> service.base64url(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlWithResponse(byte[] value, RequestOptions requestOptions) { + Base64Url valueConverted = Base64Url.encode(value); + return service.base64urlSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } + + /** + * The base64urlArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlArrayWithResponseAsync(List value, RequestOptions requestOptions) { + String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() + .serializeIterable( + value.stream().map(paramItemValue -> Base64Url.encode(paramItemValue)).collect(Collectors.toList()), + CollectionFormat.CSV); + return FluxUtil.withContext( + context -> service.base64urlArray(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The base64urlArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlArrayWithResponse(List value, RequestOptions requestOptions) { + String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() + .serializeIterable( + value.stream().map(paramItemValue -> Base64Url.encode(paramItemValue)).collect(Collectors.toList()), + CollectionFormat.CSV); + return service.base64urlArraySync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/PropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/PropertiesImpl.java new file mode 100644 index 00000000000..45542ab254a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/PropertiesImpl.java @@ -0,0 +1,452 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Properties. + */ +public final class PropertiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PropertiesService service; + + /** + * The service client containing this operation class. + */ + private final BytesClientImpl client; + + /** + * Initializes an instance of PropertiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PropertiesImpl(BytesClientImpl client) { + this.service + = RestProxy.create(PropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BytesClientProperties to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "BytesClientProperties") + public interface PropertiesService { + @Post("/encode/bytes/property/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> defaultMethod(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/property/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defaultMethodSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/property/base64") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/property/base64") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64Sync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/property/base64url") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64url(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/property/base64url") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64urlSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/property/base64url-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64urlArray(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/property/base64url-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64urlArraySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.defaultMethod(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.defaultMethodSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The base64 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64WithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.base64(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * The base64 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64WithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.base64Sync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * The base64url operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.base64url(this.client.getEndpoint(), contentType, accept, body, + requestOptions, context)); + } + + /** + * The base64url operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.base64urlSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The base64urlArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         Base64Url (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         Base64Url (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlArrayWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.base64urlArray(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The base64urlArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         Base64Url (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         Base64Url (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.base64urlArraySync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/QueriesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/QueriesImpl.java new file mode 100644 index 00000000000..c46a1c48c74 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/QueriesImpl.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Base64Url; +import com.azure.core.util.Base64Util; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.CollectionFormat; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.List; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Queries. + */ +public final class QueriesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final QueriesService service; + + /** + * The service client containing this operation class. + */ + private final BytesClientImpl client; + + /** + * Initializes an instance of QueriesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueriesImpl(BytesClientImpl client) { + this.service = RestProxy.create(QueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BytesClientQueries to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "BytesClientQueries") + public interface QueriesService { + @Get("/encode/bytes/query/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> defaultMethod(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/query/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defaultMethodSync(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/query/base64") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/query/base64") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64Sync(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/query/base64url") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64url(@HostParam("endpoint") String endpoint, @QueryParam("value") Base64Url value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/query/base64url") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64urlSync(@HostParam("endpoint") String endpoint, @QueryParam("value") Base64Url value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/query/base64url-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64urlArray(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/query/base64url-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64urlArraySync(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, + RequestOptions requestOptions, Context context); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponseAsync(byte[] value, RequestOptions requestOptions) { + String valueConverted = Base64Util.encodeToString(value); + return FluxUtil.withContext( + context -> service.defaultMethod(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(byte[] value, RequestOptions requestOptions) { + String valueConverted = Base64Util.encodeToString(value); + return service.defaultMethodSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64WithResponseAsync(byte[] value, RequestOptions requestOptions) { + String valueConverted = Base64Util.encodeToString(value); + return FluxUtil + .withContext(context -> service.base64(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The base64 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64WithResponse(byte[] value, RequestOptions requestOptions) { + String valueConverted = Base64Util.encodeToString(value); + return service.base64Sync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlWithResponseAsync(byte[] value, RequestOptions requestOptions) { + Base64Url valueConverted = Base64Url.encode(value); + return FluxUtil.withContext( + context -> service.base64url(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The base64url operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlWithResponse(byte[] value, RequestOptions requestOptions) { + Base64Url valueConverted = Base64Url.encode(value); + return service.base64urlSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } + + /** + * The base64urlArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlArrayWithResponseAsync(List value, RequestOptions requestOptions) { + String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() + .serializeIterable( + value.stream().map(paramItemValue -> Base64Url.encode(paramItemValue)).collect(Collectors.toList()), + CollectionFormat.CSV); + return FluxUtil.withContext( + context -> service.base64urlArray(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The base64urlArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlArrayWithResponse(List value, RequestOptions requestOptions) { + String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() + .serializeIterable( + value.stream().map(paramItemValue -> Base64Url.encode(paramItemValue)).collect(Collectors.toList()), + CollectionFormat.CSV); + return service.base64urlArraySync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/RequestBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/RequestBodiesImpl.java new file mode 100644 index 00000000000..8451775b3fd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/RequestBodiesImpl.java @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RequestBodies. + */ +public final class RequestBodiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RequestBodiesService service; + + /** + * The service client containing this operation class. + */ + private final BytesClientImpl client; + + /** + * Initializes an instance of RequestBodiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RequestBodiesImpl(BytesClientImpl client) { + this.service + = RestProxy.create(RequestBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BytesClientRequestBodies to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "BytesClientRequestBodies") + public interface RequestBodiesService { + @Post("/encode/bytes/body/request/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> defaultMethod(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/octet-stream") BinaryData value, + RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/body/request/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defaultMethodSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/octet-stream") BinaryData value, + RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/body/request/octet-stream") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> octetStream(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/octet-stream") BinaryData value, + RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/body/request/octet-stream") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response octetStreamSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/octet-stream") BinaryData value, + RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/body/request/custom-content-type") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> customContentType(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("image/png") BinaryData value, + RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/body/request/custom-content-type") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response customContentTypeSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("image/png") BinaryData value, + RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/body/request/base64") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData value, + RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/body/request/base64") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64Sync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData value, + RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/body/request/base64url") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64url(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData value, + RequestOptions requestOptions, Context context); + + @Post("/encode/bytes/body/request/base64url") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64urlSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData value, + RequestOptions requestOptions, Context context); + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponseAsync(BinaryData value, RequestOptions requestOptions) { + final String contentType = "application/octet-stream"; + return FluxUtil.withContext( + context -> service.defaultMethod(this.client.getEndpoint(), contentType, value, requestOptions, context)); + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(BinaryData value, RequestOptions requestOptions) { + final String contentType = "application/octet-stream"; + return service.defaultMethodSync(this.client.getEndpoint(), contentType, value, requestOptions, Context.NONE); + } + + /** + * The octetStream operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> octetStreamWithResponseAsync(BinaryData value, RequestOptions requestOptions) { + final String contentType = "application/octet-stream"; + return FluxUtil.withContext( + context -> service.octetStream(this.client.getEndpoint(), contentType, value, requestOptions, context)); + } + + /** + * The octetStream operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response octetStreamWithResponse(BinaryData value, RequestOptions requestOptions) { + final String contentType = "application/octet-stream"; + return service.octetStreamSync(this.client.getEndpoint(), contentType, value, requestOptions, Context.NONE); + } + + /** + * The customContentType operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> customContentTypeWithResponseAsync(BinaryData value, RequestOptions requestOptions) { + final String contentType = "image/png"; + return FluxUtil.withContext(context -> service.customContentType(this.client.getEndpoint(), contentType, value, + requestOptions, context)); + } + + /** + * The customContentType operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response customContentTypeWithResponse(BinaryData value, RequestOptions requestOptions) { + final String contentType = "image/png"; + return service.customContentTypeSync(this.client.getEndpoint(), contentType, value, requestOptions, + Context.NONE); + } + + /** + * The base64 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * byte[]
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64WithResponseAsync(BinaryData value, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.base64(this.client.getEndpoint(), contentType, value, requestOptions, context)); + } + + /** + * The base64 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * byte[]
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64WithResponse(BinaryData value, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.base64Sync(this.client.getEndpoint(), contentType, value, requestOptions, Context.NONE); + } + + /** + * The base64url operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * Base64Url
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlWithResponseAsync(BinaryData value, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.base64url(this.client.getEndpoint(), contentType, value, requestOptions, context)); + } + + /** + * The base64url operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * Base64Url
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlWithResponse(BinaryData value, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.base64urlSync(this.client.getEndpoint(), contentType, value, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/ResponseBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/ResponseBodiesImpl.java new file mode 100644 index 00000000000..7b68e91b2b7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/ResponseBodiesImpl.java @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ResponseBodies. + */ +public final class ResponseBodiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ResponseBodiesService service; + + /** + * The service client containing this operation class. + */ + private final BytesClientImpl client; + + /** + * Initializes an instance of ResponseBodiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResponseBodiesImpl(BytesClientImpl client) { + this.service + = RestProxy.create(ResponseBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BytesClientResponseBodies to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "BytesClientResponseBodies") + public interface ResponseBodiesService { + @Get("/encode/bytes/body/response/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> defaultMethod(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/body/response/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defaultMethodSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/body/response/octet-stream") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> octetStream(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/body/response/octet-stream") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response octetStreamSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/body/response/custom-content-type") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> customContentType(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/body/response/custom-content-type") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response customContentTypeSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/body/response/base64") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/body/response/base64") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64Sync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/body/response/base64url") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> base64url(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/encode/bytes/body/response/base64url") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response base64urlSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The defaultMethod operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/octet-stream"; + return FluxUtil + .withContext(context -> service.defaultMethod(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The defaultMethod operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(RequestOptions requestOptions) { + final String accept = "application/octet-stream"; + return service.defaultMethodSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The octetStream operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> octetStreamWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/octet-stream"; + return FluxUtil + .withContext(context -> service.octetStream(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The octetStream operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response octetStreamWithResponse(RequestOptions requestOptions) { + final String accept = "application/octet-stream"; + return service.octetStreamSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The customContentType operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> customContentTypeWithResponseAsync(RequestOptions requestOptions) { + final String accept = "image/png"; + return FluxUtil.withContext( + context -> service.customContentType(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The customContentType operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response customContentTypeWithResponse(RequestOptions requestOptions) { + final String accept = "image/png"; + return service.customContentTypeSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The base64 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * byte[]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return represent a byte array along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64WithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.base64(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The base64 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * byte[]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return represent a byte array along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64WithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.base64Sync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The base64url operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * Base64Url
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> base64urlWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.base64url(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The base64url operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * Base64Url
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response base64urlWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.base64urlSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/package-info.java new file mode 100644 index 00000000000..ab4eb2c6c40 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Bytes. + * Test for encode decorator on bytes. + * + */ +package encode.bytes.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64BytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64BytesProperty.java new file mode 100644 index 00000000000..e22e32a9446 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64BytesProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Base64BytesProperty model. + */ +@Immutable +public final class Base64BytesProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final byte[] value; + + /** + * Creates an instance of Base64BytesProperty class. + * + * @param value the value value to set. + */ + @Generated + public Base64BytesProperty(byte[] value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public byte[] getValue() { + return CoreUtils.clone(this.value); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBinaryField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Base64BytesProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Base64BytesProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Base64BytesProperty. + */ + @Generated + public static Base64BytesProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + byte[] value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.getBinary(); + } else { + reader.skipChildren(); + } + } + return new Base64BytesProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlArrayBytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlArrayBytesProperty.java new file mode 100644 index 00000000000..142c5daaba4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlArrayBytesProperty.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.Base64Url; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Objects; + +/** + * The Base64urlArrayBytesProperty model. + */ +@Immutable +public final class Base64urlArrayBytesProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final List value; + + /** + * Creates an instance of Base64urlArrayBytesProperty class. + * + * @param value the value value to set. + */ + @Generated + public Base64urlArrayBytesProperty(List value) { + if (value == null) { + this.value = null; + } else { + this.value = value.stream().map(el -> Base64Url.encode(el)).collect(java.util.stream.Collectors.toList()); + } + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public List getValue() { + if (this.value == null) { + return null; + } + return this.value.stream().map(el -> el.decodedBytes()).collect(java.util.stream.Collectors.toList()); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, + (writer, element) -> writer.writeString(Objects.toString(element, null))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Base64urlArrayBytesProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Base64urlArrayBytesProperty if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Base64urlArrayBytesProperty. + */ + @Generated + public static Base64urlArrayBytesProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.readArray(reader1 -> { + Base64Url reader1ValueHolder + = reader1.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); + if (reader1ValueHolder != null) { + return reader1ValueHolder.decodedBytes(); + } else { + return null; + } + }); + } else { + reader.skipChildren(); + } + } + return new Base64urlArrayBytesProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlBytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlBytesProperty.java new file mode 100644 index 00000000000..eadc57dbe41 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/Base64urlBytesProperty.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.Base64Url; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; + +/** + * The Base64urlBytesProperty model. + */ +@Immutable +public final class Base64urlBytesProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final Base64Url value; + + /** + * Creates an instance of Base64urlBytesProperty class. + * + * @param value the value value to set. + */ + @Generated + public Base64urlBytesProperty(byte[] value) { + if (value == null) { + this.value = null; + } else { + this.value = Base64Url.encode(value); + } + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public byte[] getValue() { + if (this.value == null) { + return null; + } + return this.value.decodedBytes(); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", Objects.toString(this.value, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Base64urlBytesProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Base64urlBytesProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Base64urlBytesProperty. + */ + @Generated + public static Base64urlBytesProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + byte[] value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + Base64Url valueHolder + = reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); + if (valueHolder != null) { + value = valueHolder.decodedBytes(); + } + } else { + reader.skipChildren(); + } + } + return new Base64urlBytesProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/DefaultBytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/DefaultBytesProperty.java new file mode 100644 index 00000000000..2bdbc1e8953 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/DefaultBytesProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The DefaultBytesProperty model. + */ +@Immutable +public final class DefaultBytesProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final byte[] value; + + /** + * Creates an instance of DefaultBytesProperty class. + * + * @param value the value value to set. + */ + @Generated + public DefaultBytesProperty(byte[] value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public byte[] getValue() { + return CoreUtils.clone(this.value); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBinaryField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefaultBytesProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefaultBytesProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DefaultBytesProperty. + */ + @Generated + public static DefaultBytesProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + byte[] value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.getBinary(); + } else { + reader.skipChildren(); + } + } + return new DefaultBytesProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/package-info.java new file mode 100644 index 00000000000..f51e8aa1f5d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Bytes. + * Test for encode decorator on bytes. + * + */ +package encode.bytes.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/package-info.java new file mode 100644 index 00000000000..20845fc1cd3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/bytes/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Bytes. + * Test for encode decorator on bytes. + * + */ +package encode.bytes; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/DatetimeClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/DatetimeClientBuilder.java new file mode 100644 index 00000000000..214b4c7edc5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/DatetimeClientBuilder.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import encode.datetime.implementation.DatetimeClientImpl; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the DatetimeClient type. + */ +@ServiceClientBuilder( + serviceClients = { + QueryClient.class, + PropertyClient.class, + HeaderClient.class, + ResponseHeaderClient.class, + QueryAsyncClient.class, + PropertyAsyncClient.class, + HeaderAsyncClient.class, + ResponseHeaderAsyncClient.class }) +public final class DatetimeClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("encode-datetime.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the DatetimeClientBuilder. + */ + @Generated + public DatetimeClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DatetimeClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DatetimeClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DatetimeClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DatetimeClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DatetimeClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DatetimeClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DatetimeClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DatetimeClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the DatetimeClientBuilder. + */ + @Generated + public DatetimeClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of DatetimeClientImpl with the provided parameters. + * + * @return an instance of DatetimeClientImpl. + */ + @Generated + private DatetimeClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + DatetimeClientImpl client + = new DatetimeClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of QueryAsyncClient class. + * + * @return an instance of QueryAsyncClient. + */ + @Generated + public QueryAsyncClient buildQueryAsyncClient() { + return new QueryAsyncClient(buildInnerClient().getQueries()); + } + + /** + * Builds an instance of PropertyAsyncClient class. + * + * @return an instance of PropertyAsyncClient. + */ + @Generated + public PropertyAsyncClient buildPropertyAsyncClient() { + return new PropertyAsyncClient(buildInnerClient().getProperties()); + } + + /** + * Builds an instance of HeaderAsyncClient class. + * + * @return an instance of HeaderAsyncClient. + */ + @Generated + public HeaderAsyncClient buildHeaderAsyncClient() { + return new HeaderAsyncClient(buildInnerClient().getHeaders()); + } + + /** + * Builds an instance of ResponseHeaderAsyncClient class. + * + * @return an instance of ResponseHeaderAsyncClient. + */ + @Generated + public ResponseHeaderAsyncClient buildResponseHeaderAsyncClient() { + return new ResponseHeaderAsyncClient(buildInnerClient().getResponseHeaders()); + } + + /** + * Builds an instance of QueryClient class. + * + * @return an instance of QueryClient. + */ + @Generated + public QueryClient buildQueryClient() { + return new QueryClient(buildInnerClient().getQueries()); + } + + /** + * Builds an instance of PropertyClient class. + * + * @return an instance of PropertyClient. + */ + @Generated + public PropertyClient buildPropertyClient() { + return new PropertyClient(buildInnerClient().getProperties()); + } + + /** + * Builds an instance of HeaderClient class. + * + * @return an instance of HeaderClient. + */ + @Generated + public HeaderClient buildHeaderClient() { + return new HeaderClient(buildInnerClient().getHeaders()); + } + + /** + * Builds an instance of ResponseHeaderClient class. + * + * @return an instance of ResponseHeaderClient. + */ + @Generated + public ResponseHeaderClient buildResponseHeaderClient() { + return new ResponseHeaderClient(buildInnerClient().getResponseHeaders()); + } + + private static final ClientLogger LOGGER = new ClientLogger(DatetimeClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderAsyncClient.java new file mode 100644 index 00000000000..679b7507bd7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderAsyncClient.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import encode.datetime.implementation.HeadersImpl; +import java.time.OffsetDateTime; +import java.util.List; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DatetimeClient type. + */ +@ServiceClient(builder = DatetimeClientBuilder.class, isAsync = true) +public final class HeaderAsyncClient { + @Generated + private final HeadersImpl serviceClient; + + /** + * Initializes an instance of HeaderAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + HeaderAsyncClient(HeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponseAsync(value, requestOptions); + } + + /** + * The rfc3339 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc3339WithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.rfc3339WithResponseAsync(value, requestOptions); + } + + /** + * The rfc7231 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc7231WithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.rfc7231WithResponseAsync(value, requestOptions); + } + + /** + * The unixTimestamp operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampWithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.unixTimestampWithResponseAsync(value, requestOptions); + } + + /** + * The unixTimestampArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampArrayWithResponse(List value, + RequestOptions requestOptions) { + return this.serviceClient.unixTimestampArrayWithResponseAsync(value, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono defaultMethod(OffsetDateTime value) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The rfc3339 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono rfc3339(OffsetDateTime value) { + // Generated convenience method for rfc3339WithResponse + RequestOptions requestOptions = new RequestOptions(); + return rfc3339WithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The rfc7231 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono rfc7231(OffsetDateTime value) { + // Generated convenience method for rfc7231WithResponse + RequestOptions requestOptions = new RequestOptions(); + return rfc7231WithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The unixTimestamp operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono unixTimestamp(OffsetDateTime value) { + // Generated convenience method for unixTimestampWithResponse + RequestOptions requestOptions = new RequestOptions(); + return unixTimestampWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The unixTimestampArray operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono unixTimestampArray(List value) { + // Generated convenience method for unixTimestampArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return unixTimestampArrayWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderClient.java new file mode 100644 index 00000000000..acab1729a13 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/HeaderClient.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import encode.datetime.implementation.HeadersImpl; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Initializes a new instance of the synchronous DatetimeClient type. + */ +@ServiceClient(builder = DatetimeClientBuilder.class) +public final class HeaderClient { + @Generated + private final HeadersImpl serviceClient; + + /** + * Initializes an instance of HeaderClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + HeaderClient(HeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponse(value, requestOptions); + } + + /** + * The rfc3339 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc3339WithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.rfc3339WithResponse(value, requestOptions); + } + + /** + * The rfc7231 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc7231WithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.rfc7231WithResponse(value, requestOptions); + } + + /** + * The unixTimestamp operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampWithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.unixTimestampWithResponse(value, requestOptions); + } + + /** + * The unixTimestampArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampArrayWithResponse(List value, RequestOptions requestOptions) { + return this.serviceClient.unixTimestampArrayWithResponse(value, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void defaultMethod(OffsetDateTime value) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + defaultMethodWithResponse(value, requestOptions).getValue(); + } + + /** + * The rfc3339 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void rfc3339(OffsetDateTime value) { + // Generated convenience method for rfc3339WithResponse + RequestOptions requestOptions = new RequestOptions(); + rfc3339WithResponse(value, requestOptions).getValue(); + } + + /** + * The rfc7231 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void rfc7231(OffsetDateTime value) { + // Generated convenience method for rfc7231WithResponse + RequestOptions requestOptions = new RequestOptions(); + rfc7231WithResponse(value, requestOptions).getValue(); + } + + /** + * The unixTimestamp operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void unixTimestamp(OffsetDateTime value) { + // Generated convenience method for unixTimestampWithResponse + RequestOptions requestOptions = new RequestOptions(); + unixTimestampWithResponse(value, requestOptions).getValue(); + } + + /** + * The unixTimestampArray operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void unixTimestampArray(List value) { + // Generated convenience method for unixTimestampArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + unixTimestampArrayWithResponse(value, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyAsyncClient.java new file mode 100644 index 00000000000..3e79966a22e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyAsyncClient.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import encode.datetime.implementation.PropertiesImpl; +import encode.datetime.models.DefaultDatetimeProperty; +import encode.datetime.models.Rfc3339DatetimeProperty; +import encode.datetime.models.Rfc7231DatetimeProperty; +import encode.datetime.models.UnixTimestampArrayDatetimeProperty; +import encode.datetime.models.UnixTimestampDatetimeProperty; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DatetimeClient type. + */ +@ServiceClient(builder = DatetimeClientBuilder.class, isAsync = true) +public final class PropertyAsyncClient { + @Generated + private final PropertiesImpl serviceClient; + + /** + * Initializes an instance of PropertyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PropertyAsyncClient(PropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponseAsync(body, requestOptions); + } + + /** + * The rfc3339 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc3339WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.rfc3339WithResponseAsync(body, requestOptions); + } + + /** + * The rfc7231 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc7231WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.rfc7231WithResponseAsync(body, requestOptions); + } + + /** + * The unixTimestamp operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.unixTimestampWithResponseAsync(body, requestOptions); + } + + /** + * The unixTimestampArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         long (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         long (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.unixTimestampArrayWithResponseAsync(body, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono defaultMethod(DefaultDatetimeProperty body) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DefaultDatetimeProperty.class)); + } + + /** + * The rfc3339 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono rfc3339(Rfc3339DatetimeProperty body) { + // Generated convenience method for rfc3339WithResponse + RequestOptions requestOptions = new RequestOptions(); + return rfc3339WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Rfc3339DatetimeProperty.class)); + } + + /** + * The rfc7231 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono rfc7231(Rfc7231DatetimeProperty body) { + // Generated convenience method for rfc7231WithResponse + RequestOptions requestOptions = new RequestOptions(); + return rfc7231WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Rfc7231DatetimeProperty.class)); + } + + /** + * The unixTimestamp operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono unixTimestamp(UnixTimestampDatetimeProperty body) { + // Generated convenience method for unixTimestampWithResponse + RequestOptions requestOptions = new RequestOptions(); + return unixTimestampWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnixTimestampDatetimeProperty.class)); + } + + /** + * The unixTimestampArray operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono unixTimestampArray(UnixTimestampArrayDatetimeProperty body) { + // Generated convenience method for unixTimestampArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return unixTimestampArrayWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnixTimestampArrayDatetimeProperty.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyClient.java new file mode 100644 index 00000000000..5ee85172f0a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/PropertyClient.java @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import encode.datetime.implementation.PropertiesImpl; +import encode.datetime.models.DefaultDatetimeProperty; +import encode.datetime.models.Rfc3339DatetimeProperty; +import encode.datetime.models.Rfc7231DatetimeProperty; +import encode.datetime.models.UnixTimestampArrayDatetimeProperty; +import encode.datetime.models.UnixTimestampDatetimeProperty; + +/** + * Initializes a new instance of the synchronous DatetimeClient type. + */ +@ServiceClient(builder = DatetimeClientBuilder.class) +public final class PropertyClient { + @Generated + private final PropertiesImpl serviceClient; + + /** + * Initializes an instance of PropertyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PropertyClient(PropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponse(body, requestOptions); + } + + /** + * The rfc3339 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc3339WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.rfc3339WithResponse(body, requestOptions); + } + + /** + * The rfc7231 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc7231WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.rfc7231WithResponse(body, requestOptions); + } + + /** + * The unixTimestamp operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.unixTimestampWithResponse(body, requestOptions); + } + + /** + * The unixTimestampArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         long (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         long (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.unixTimestampArrayWithResponse(body, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DefaultDatetimeProperty defaultMethod(DefaultDatetimeProperty body) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(DefaultDatetimeProperty.class); + } + + /** + * The rfc3339 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Rfc3339DatetimeProperty rfc3339(Rfc3339DatetimeProperty body) { + // Generated convenience method for rfc3339WithResponse + RequestOptions requestOptions = new RequestOptions(); + return rfc3339WithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Rfc3339DatetimeProperty.class); + } + + /** + * The rfc7231 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Rfc7231DatetimeProperty rfc7231(Rfc7231DatetimeProperty body) { + // Generated convenience method for rfc7231WithResponse + RequestOptions requestOptions = new RequestOptions(); + return rfc7231WithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Rfc7231DatetimeProperty.class); + } + + /** + * The unixTimestamp operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnixTimestampDatetimeProperty unixTimestamp(UnixTimestampDatetimeProperty body) { + // Generated convenience method for unixTimestampWithResponse + RequestOptions requestOptions = new RequestOptions(); + return unixTimestampWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(UnixTimestampDatetimeProperty.class); + } + + /** + * The unixTimestampArray operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnixTimestampArrayDatetimeProperty unixTimestampArray(UnixTimestampArrayDatetimeProperty body) { + // Generated convenience method for unixTimestampArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return unixTimestampArrayWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(UnixTimestampArrayDatetimeProperty.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryAsyncClient.java new file mode 100644 index 00000000000..e695a6ca334 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryAsyncClient.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import encode.datetime.implementation.QueriesImpl; +import java.time.OffsetDateTime; +import java.util.List; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DatetimeClient type. + */ +@ServiceClient(builder = DatetimeClientBuilder.class, isAsync = true) +public final class QueryAsyncClient { + @Generated + private final QueriesImpl serviceClient; + + /** + * Initializes an instance of QueryAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryAsyncClient(QueriesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponseAsync(value, requestOptions); + } + + /** + * The rfc3339 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc3339WithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.rfc3339WithResponseAsync(value, requestOptions); + } + + /** + * The rfc7231 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc7231WithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.rfc7231WithResponseAsync(value, requestOptions); + } + + /** + * The unixTimestamp operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampWithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.unixTimestampWithResponseAsync(value, requestOptions); + } + + /** + * The unixTimestampArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampArrayWithResponse(List value, + RequestOptions requestOptions) { + return this.serviceClient.unixTimestampArrayWithResponseAsync(value, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono defaultMethod(OffsetDateTime value) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The rfc3339 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono rfc3339(OffsetDateTime value) { + // Generated convenience method for rfc3339WithResponse + RequestOptions requestOptions = new RequestOptions(); + return rfc3339WithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The rfc7231 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono rfc7231(OffsetDateTime value) { + // Generated convenience method for rfc7231WithResponse + RequestOptions requestOptions = new RequestOptions(); + return rfc7231WithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The unixTimestamp operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono unixTimestamp(OffsetDateTime value) { + // Generated convenience method for unixTimestampWithResponse + RequestOptions requestOptions = new RequestOptions(); + return unixTimestampWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The unixTimestampArray operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono unixTimestampArray(List value) { + // Generated convenience method for unixTimestampArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return unixTimestampArrayWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryClient.java new file mode 100644 index 00000000000..eababe28a4a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/QueryClient.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import encode.datetime.implementation.QueriesImpl; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Initializes a new instance of the synchronous DatetimeClient type. + */ +@ServiceClient(builder = DatetimeClientBuilder.class) +public final class QueryClient { + @Generated + private final QueriesImpl serviceClient; + + /** + * Initializes an instance of QueryClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryClient(QueriesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponse(value, requestOptions); + } + + /** + * The rfc3339 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc3339WithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.rfc3339WithResponse(value, requestOptions); + } + + /** + * The rfc7231 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc7231WithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.rfc7231WithResponse(value, requestOptions); + } + + /** + * The unixTimestamp operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampWithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return this.serviceClient.unixTimestampWithResponse(value, requestOptions); + } + + /** + * The unixTimestampArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampArrayWithResponse(List value, RequestOptions requestOptions) { + return this.serviceClient.unixTimestampArrayWithResponse(value, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void defaultMethod(OffsetDateTime value) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + defaultMethodWithResponse(value, requestOptions).getValue(); + } + + /** + * The rfc3339 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void rfc3339(OffsetDateTime value) { + // Generated convenience method for rfc3339WithResponse + RequestOptions requestOptions = new RequestOptions(); + rfc3339WithResponse(value, requestOptions).getValue(); + } + + /** + * The rfc7231 operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void rfc7231(OffsetDateTime value) { + // Generated convenience method for rfc7231WithResponse + RequestOptions requestOptions = new RequestOptions(); + rfc7231WithResponse(value, requestOptions).getValue(); + } + + /** + * The unixTimestamp operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void unixTimestamp(OffsetDateTime value) { + // Generated convenience method for unixTimestampWithResponse + RequestOptions requestOptions = new RequestOptions(); + unixTimestampWithResponse(value, requestOptions).getValue(); + } + + /** + * The unixTimestampArray operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void unixTimestampArray(List value) { + // Generated convenience method for unixTimestampArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + unixTimestampArrayWithResponse(value, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderAsyncClient.java new file mode 100644 index 00000000000..dd2355693bb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderAsyncClient.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import encode.datetime.implementation.ResponseHeadersImpl; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DatetimeClient type. + */ +@ServiceClient(builder = DatetimeClientBuilder.class, isAsync = true) +public final class ResponseHeaderAsyncClient { + @Generated + private final ResponseHeadersImpl serviceClient; + + /** + * Initializes an instance of ResponseHeaderAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ResponseHeaderAsyncClient(ResponseHeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponseAsync(requestOptions); + } + + /** + * The rfc3339 operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc3339WithResponse(RequestOptions requestOptions) { + return this.serviceClient.rfc3339WithResponseAsync(requestOptions); + } + + /** + * The rfc7231 operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc7231WithResponse(RequestOptions requestOptions) { + return this.serviceClient.rfc7231WithResponseAsync(requestOptions); + } + + /** + * The unixTimestamp operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampWithResponse(RequestOptions requestOptions) { + return this.serviceClient.unixTimestampWithResponseAsync(requestOptions); + } + + /** + * The defaultMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono defaultMethod() { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The rfc3339 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono rfc3339() { + // Generated convenience method for rfc3339WithResponse + RequestOptions requestOptions = new RequestOptions(); + return rfc3339WithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The rfc7231 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono rfc7231() { + // Generated convenience method for rfc7231WithResponse + RequestOptions requestOptions = new RequestOptions(); + return rfc7231WithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The unixTimestamp operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono unixTimestamp() { + // Generated convenience method for unixTimestampWithResponse + RequestOptions requestOptions = new RequestOptions(); + return unixTimestampWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderClient.java new file mode 100644 index 00000000000..94dbd27ce13 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/ResponseHeaderClient.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import encode.datetime.implementation.ResponseHeadersImpl; + +/** + * Initializes a new instance of the synchronous DatetimeClient type. + */ +@ServiceClient(builder = DatetimeClientBuilder.class) +public final class ResponseHeaderClient { + @Generated + private final ResponseHeadersImpl serviceClient; + + /** + * Initializes an instance of ResponseHeaderClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ResponseHeaderClient(ResponseHeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponse(requestOptions); + } + + /** + * The rfc3339 operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc3339WithResponse(RequestOptions requestOptions) { + return this.serviceClient.rfc3339WithResponse(requestOptions); + } + + /** + * The rfc7231 operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc7231WithResponse(RequestOptions requestOptions) { + return this.serviceClient.rfc7231WithResponse(requestOptions); + } + + /** + * The unixTimestamp operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampWithResponse(RequestOptions requestOptions) { + return this.serviceClient.unixTimestampWithResponse(requestOptions); + } + + /** + * The defaultMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void defaultMethod() { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + defaultMethodWithResponse(requestOptions).getValue(); + } + + /** + * The rfc3339 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void rfc3339() { + // Generated convenience method for rfc3339WithResponse + RequestOptions requestOptions = new RequestOptions(); + rfc3339WithResponse(requestOptions).getValue(); + } + + /** + * The rfc7231 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void rfc7231() { + // Generated convenience method for rfc7231WithResponse + RequestOptions requestOptions = new RequestOptions(); + rfc7231WithResponse(requestOptions).getValue(); + } + + /** + * The unixTimestamp operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void unixTimestamp() { + // Generated convenience method for unixTimestampWithResponse + RequestOptions requestOptions = new RequestOptions(); + unixTimestampWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/DatetimeClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/DatetimeClientImpl.java new file mode 100644 index 00000000000..5d8eb89de0c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/DatetimeClientImpl.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 DatetimeClient type. + */ +public final class DatetimeClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 QueriesImpl object to access its operations. + */ + private final QueriesImpl queries; + + /** + * Gets the QueriesImpl object to access its operations. + * + * @return the QueriesImpl object. + */ + public QueriesImpl getQueries() { + return this.queries; + } + + /** + * The PropertiesImpl object to access its operations. + */ + private final PropertiesImpl properties; + + /** + * Gets the PropertiesImpl object to access its operations. + * + * @return the PropertiesImpl object. + */ + public PropertiesImpl getProperties() { + return this.properties; + } + + /** + * The HeadersImpl object to access its operations. + */ + private final HeadersImpl headers; + + /** + * Gets the HeadersImpl object to access its operations. + * + * @return the HeadersImpl object. + */ + public HeadersImpl getHeaders() { + return this.headers; + } + + /** + * The ResponseHeadersImpl object to access its operations. + */ + private final ResponseHeadersImpl responseHeaders; + + /** + * Gets the ResponseHeadersImpl object to access its operations. + * + * @return the ResponseHeadersImpl object. + */ + public ResponseHeadersImpl getResponseHeaders() { + return this.responseHeaders; + } + + /** + * Initializes an instance of DatetimeClient client. + * + * @param endpoint Service host. + */ + public DatetimeClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DatetimeClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public DatetimeClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DatetimeClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public DatetimeClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.queries = new QueriesImpl(this); + this.properties = new PropertiesImpl(this); + this.headers = new HeadersImpl(this); + this.responseHeaders = new ResponseHeadersImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/HeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/HeadersImpl.java new file mode 100644 index 00000000000..de0e8adab6b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/HeadersImpl.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.CollectionFormat; +import com.azure.core.util.serializer.JacksonAdapter; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Headers. + */ +public final class HeadersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final HeadersService service; + + /** + * The service client containing this operation class. + */ + private final DatetimeClientImpl client; + + /** + * Initializes an instance of HeadersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HeadersImpl(DatetimeClientImpl client) { + this.service = RestProxy.create(HeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DatetimeClientHeaders to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DatetimeClientHeaders") + public interface HeadersService { + @Get("/encode/datetime/header/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> defaultMethod(@HostParam("endpoint") String endpoint, + @HeaderParam("value") DateTimeRfc1123 value, RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/header/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defaultMethodSync(@HostParam("endpoint") String endpoint, + @HeaderParam("value") DateTimeRfc1123 value, RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/header/rfc3339") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> rfc3339(@HostParam("endpoint") String endpoint, @HeaderParam("value") OffsetDateTime value, + RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/header/rfc3339") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response rfc3339Sync(@HostParam("endpoint") String endpoint, @HeaderParam("value") OffsetDateTime value, + RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/header/rfc7231") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> rfc7231(@HostParam("endpoint") String endpoint, + @HeaderParam("value") DateTimeRfc1123 value, RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/header/rfc7231") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response rfc7231Sync(@HostParam("endpoint") String endpoint, @HeaderParam("value") DateTimeRfc1123 value, + RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/header/unix-timestamp") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> unixTimestamp(@HostParam("endpoint") String endpoint, @HeaderParam("value") long value, + RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/header/unix-timestamp") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response unixTimestampSync(@HostParam("endpoint") String endpoint, @HeaderParam("value") long value, + RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/header/unix-timestamp-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> unixTimestampArray(@HostParam("endpoint") String endpoint, + @HeaderParam("value") String value, RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/header/unix-timestamp-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response unixTimestampArraySync(@HostParam("endpoint") String endpoint, + @HeaderParam("value") String value, RequestOptions requestOptions, Context context); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { + DateTimeRfc1123 valueConverted = new DateTimeRfc1123(value); + return FluxUtil.withContext( + context -> service.defaultMethod(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(OffsetDateTime value, RequestOptions requestOptions) { + DateTimeRfc1123 valueConverted = new DateTimeRfc1123(value); + return service.defaultMethodSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } + + /** + * The rfc3339 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc3339WithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.rfc3339(this.client.getEndpoint(), value, requestOptions, context)); + } + + /** + * The rfc3339 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc3339WithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return service.rfc3339Sync(this.client.getEndpoint(), value, requestOptions, Context.NONE); + } + + /** + * The rfc7231 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc7231WithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { + DateTimeRfc1123 valueConverted = new DateTimeRfc1123(value); + return FluxUtil.withContext( + context -> service.rfc7231(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The rfc7231 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc7231WithResponse(OffsetDateTime value, RequestOptions requestOptions) { + DateTimeRfc1123 valueConverted = new DateTimeRfc1123(value); + return service.rfc7231Sync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } + + /** + * The unixTimestamp operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampWithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { + long valueConverted = value.toEpochSecond(); + return FluxUtil.withContext( + context -> service.unixTimestamp(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The unixTimestamp operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampWithResponse(OffsetDateTime value, RequestOptions requestOptions) { + long valueConverted = value.toEpochSecond(); + return service.unixTimestampSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } + + /** + * The unixTimestampArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampArrayWithResponseAsync(List value, + RequestOptions requestOptions) { + String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() + .serializeIterable( + value.stream().map(paramItemValue -> paramItemValue.toEpochSecond()).collect(Collectors.toList()), + CollectionFormat.CSV); + return FluxUtil.withContext( + context -> service.unixTimestampArray(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The unixTimestampArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampArrayWithResponse(List value, RequestOptions requestOptions) { + String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() + .serializeIterable( + value.stream().map(paramItemValue -> paramItemValue.toEpochSecond()).collect(Collectors.toList()), + CollectionFormat.CSV); + return service.unixTimestampArraySync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/PropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/PropertiesImpl.java new file mode 100644 index 00000000000..63537cbe29d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/PropertiesImpl.java @@ -0,0 +1,548 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Properties. + */ +public final class PropertiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PropertiesService service; + + /** + * The service client containing this operation class. + */ + private final DatetimeClientImpl client; + + /** + * Initializes an instance of PropertiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PropertiesImpl(DatetimeClientImpl client) { + this.service + = RestProxy.create(PropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DatetimeClientProperties to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DatetimeClientProperties") + public interface PropertiesService { + @Post("/encode/datetime/property/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> defaultMethod(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/datetime/property/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defaultMethodSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/datetime/property/rfc3339") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> rfc3339(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/datetime/property/rfc3339") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response rfc3339Sync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/datetime/property/rfc7231") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> rfc7231(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/datetime/property/rfc7231") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response rfc7231Sync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/datetime/property/unix-timestamp") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> unixTimestamp(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/datetime/property/unix-timestamp") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response unixTimestampSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/datetime/property/unix-timestamp-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> unixTimestampArray(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/datetime/property/unix-timestamp-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response unixTimestampArraySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.defaultMethod(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.defaultMethodSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The rfc3339 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc3339WithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.rfc3339(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * The rfc3339 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc3339WithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.rfc3339Sync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * The rfc7231 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc7231WithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.rfc7231(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * The rfc7231 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc7231WithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.rfc7231Sync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * The unixTimestamp operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.unixTimestamp(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The unixTimestamp operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.unixTimestampSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The unixTimestampArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         long (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         long (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampArrayWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.unixTimestampArray(this.client.getEndpoint(), contentType, + accept, body, requestOptions, context)); + } + + /** + * The unixTimestampArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         long (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         long (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.unixTimestampArraySync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/QueriesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/QueriesImpl.java new file mode 100644 index 00000000000..e1ddd511969 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/QueriesImpl.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.CollectionFormat; +import com.azure.core.util.serializer.JacksonAdapter; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Queries. + */ +public final class QueriesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final QueriesService service; + + /** + * The service client containing this operation class. + */ + private final DatetimeClientImpl client; + + /** + * Initializes an instance of QueriesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueriesImpl(DatetimeClientImpl client) { + this.service = RestProxy.create(QueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DatetimeClientQueries to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DatetimeClientQueries") + public interface QueriesService { + @Get("/encode/datetime/query/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> defaultMethod(@HostParam("endpoint") String endpoint, + @QueryParam("value") OffsetDateTime value, RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/query/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defaultMethodSync(@HostParam("endpoint") String endpoint, + @QueryParam("value") OffsetDateTime value, RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/query/rfc3339") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> rfc3339(@HostParam("endpoint") String endpoint, @QueryParam("value") OffsetDateTime value, + RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/query/rfc3339") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response rfc3339Sync(@HostParam("endpoint") String endpoint, @QueryParam("value") OffsetDateTime value, + RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/query/rfc7231") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> rfc7231(@HostParam("endpoint") String endpoint, @QueryParam("value") DateTimeRfc1123 value, + RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/query/rfc7231") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response rfc7231Sync(@HostParam("endpoint") String endpoint, @QueryParam("value") DateTimeRfc1123 value, + RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/query/unix-timestamp") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> unixTimestamp(@HostParam("endpoint") String endpoint, @QueryParam("value") long value, + RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/query/unix-timestamp") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response unixTimestampSync(@HostParam("endpoint") String endpoint, @QueryParam("value") long value, + RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/query/unix-timestamp-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> unixTimestampArray(@HostParam("endpoint") String endpoint, + @QueryParam("value") String value, RequestOptions requestOptions, Context context); + + @Get("/encode/datetime/query/unix-timestamp-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response unixTimestampArraySync(@HostParam("endpoint") String endpoint, @QueryParam("value") String value, + RequestOptions requestOptions, Context context); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.defaultMethod(this.client.getEndpoint(), value, requestOptions, context)); + } + + /** + * The defaultMethod operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return service.defaultMethodSync(this.client.getEndpoint(), value, requestOptions, Context.NONE); + } + + /** + * The rfc3339 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc3339WithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.rfc3339(this.client.getEndpoint(), value, requestOptions, context)); + } + + /** + * The rfc3339 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc3339WithResponse(OffsetDateTime value, RequestOptions requestOptions) { + return service.rfc3339Sync(this.client.getEndpoint(), value, requestOptions, Context.NONE); + } + + /** + * The rfc7231 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc7231WithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { + DateTimeRfc1123 valueConverted = new DateTimeRfc1123(value); + return FluxUtil.withContext( + context -> service.rfc7231(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The rfc7231 operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc7231WithResponse(OffsetDateTime value, RequestOptions requestOptions) { + DateTimeRfc1123 valueConverted = new DateTimeRfc1123(value); + return service.rfc7231Sync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } + + /** + * The unixTimestamp operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampWithResponseAsync(OffsetDateTime value, RequestOptions requestOptions) { + long valueConverted = value.toEpochSecond(); + return FluxUtil.withContext( + context -> service.unixTimestamp(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The unixTimestamp operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampWithResponse(OffsetDateTime value, RequestOptions requestOptions) { + long valueConverted = value.toEpochSecond(); + return service.unixTimestampSync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } + + /** + * The unixTimestampArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampArrayWithResponseAsync(List value, + RequestOptions requestOptions) { + String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() + .serializeIterable( + value.stream().map(paramItemValue -> paramItemValue.toEpochSecond()).collect(Collectors.toList()), + CollectionFormat.CSV); + return FluxUtil.withContext( + context -> service.unixTimestampArray(this.client.getEndpoint(), valueConverted, requestOptions, context)); + } + + /** + * The unixTimestampArray operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampArrayWithResponse(List value, RequestOptions requestOptions) { + String valueConverted = JacksonAdapter.createDefaultSerializerAdapter() + .serializeIterable( + value.stream().map(paramItemValue -> paramItemValue.toEpochSecond()).collect(Collectors.toList()), + CollectionFormat.CSV); + return service.unixTimestampArraySync(this.client.getEndpoint(), valueConverted, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/ResponseHeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/ResponseHeadersImpl.java new file mode 100644 index 00000000000..900cbca4eb5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/ResponseHeadersImpl.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ResponseHeaders. + */ +public final class ResponseHeadersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ResponseHeadersService service; + + /** + * The service client containing this operation class. + */ + private final DatetimeClientImpl client; + + /** + * Initializes an instance of ResponseHeadersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResponseHeadersImpl(DatetimeClientImpl client) { + this.service + = RestProxy.create(ResponseHeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DatetimeClientResponseHeaders to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DatetimeClientResponseHeaders") + public interface ResponseHeadersService { + @Get("/encode/datetime/responseheader/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> defaultMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/encode/datetime/responseheader/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defaultMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/encode/datetime/responseheader/rfc3339") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> rfc3339(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/encode/datetime/responseheader/rfc3339") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response rfc3339Sync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/encode/datetime/responseheader/rfc7231") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> rfc7231(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/encode/datetime/responseheader/rfc7231") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response rfc7231Sync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/encode/datetime/responseheader/unix-timestamp") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> unixTimestamp(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/encode/datetime/responseheader/unix-timestamp") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response unixTimestampSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The defaultMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.defaultMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The defaultMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(RequestOptions requestOptions) { + return service.defaultMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The rfc3339 operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc3339WithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.rfc3339(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The rfc3339 operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc3339WithResponse(RequestOptions requestOptions) { + return service.rfc3339Sync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The rfc7231 operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> rfc7231WithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.rfc7231(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The rfc7231 operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response rfc7231WithResponse(RequestOptions requestOptions) { + return service.rfc7231Sync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The unixTimestamp operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unixTimestampWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.unixTimestamp(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The unixTimestamp operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unixTimestampWithResponse(RequestOptions requestOptions) { + return service.unixTimestampSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/package-info.java new file mode 100644 index 00000000000..721350d895f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for DatetimeModel. + * Test for encode decorator on datetime. + * + */ +package encode.datetime.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/DefaultDatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/DefaultDatetimeProperty.java new file mode 100644 index 00000000000..2985f443acc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/DefaultDatetimeProperty.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The DefaultDatetimeProperty model. + */ +@Immutable +public final class DefaultDatetimeProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final OffsetDateTime value; + + /** + * Creates an instance of DefaultDatetimeProperty class. + * + * @param value the value value to set. + */ + @Generated + public DefaultDatetimeProperty(OffsetDateTime value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public OffsetDateTime getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", + this.value == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.value)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefaultDatetimeProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefaultDatetimeProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DefaultDatetimeProperty. + */ + @Generated + public static DefaultDatetimeProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffsetDateTime value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new DefaultDatetimeProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc3339DatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc3339DatetimeProperty.java new file mode 100644 index 00000000000..abad518e36c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc3339DatetimeProperty.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The Rfc3339DatetimeProperty model. + */ +@Immutable +public final class Rfc3339DatetimeProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final OffsetDateTime value; + + /** + * Creates an instance of Rfc3339DatetimeProperty class. + * + * @param value the value value to set. + */ + @Generated + public Rfc3339DatetimeProperty(OffsetDateTime value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public OffsetDateTime getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", + this.value == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.value)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Rfc3339DatetimeProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Rfc3339DatetimeProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Rfc3339DatetimeProperty. + */ + @Generated + public static Rfc3339DatetimeProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffsetDateTime value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new Rfc3339DatetimeProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc7231DatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc7231DatetimeProperty.java new file mode 100644 index 00000000000..2068cb42930 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/Rfc7231DatetimeProperty.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Objects; + +/** + * The Rfc7231DatetimeProperty model. + */ +@Immutable +public final class Rfc7231DatetimeProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final DateTimeRfc1123 value; + + /** + * Creates an instance of Rfc7231DatetimeProperty class. + * + * @param value the value value to set. + */ + @Generated + public Rfc7231DatetimeProperty(OffsetDateTime value) { + if (value == null) { + this.value = null; + } else { + this.value = new DateTimeRfc1123(value); + } + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public OffsetDateTime getValue() { + if (this.value == null) { + return null; + } + return this.value.getDateTime(); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", Objects.toString(this.value, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Rfc7231DatetimeProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Rfc7231DatetimeProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Rfc7231DatetimeProperty. + */ + @Generated + public static Rfc7231DatetimeProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffsetDateTime value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + DateTimeRfc1123 valueHolder + = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); + if (valueHolder != null) { + value = valueHolder.getDateTime(); + } + } else { + reader.skipChildren(); + } + } + return new Rfc7231DatetimeProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampArrayDatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampArrayDatetimeProperty.java new file mode 100644 index 00000000000..1e5b108155e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampArrayDatetimeProperty.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.List; + +/** + * The UnixTimestampArrayDatetimeProperty model. + */ +@Immutable +public final class UnixTimestampArrayDatetimeProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final List value; + + /** + * Creates an instance of UnixTimestampArrayDatetimeProperty class. + * + * @param value the value value to set. + */ + @Generated + public UnixTimestampArrayDatetimeProperty(List value) { + if (value == null) { + this.value = null; + } else { + this.value = value.stream().map(el -> el.toEpochSecond()).collect(java.util.stream.Collectors.toList()); + } + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public List getValue() { + if (this.value == null) { + return null; + } + return this.value.stream() + .map(el -> OffsetDateTime.ofInstant(Instant.ofEpochSecond(el), ZoneOffset.UTC)) + .collect(java.util.stream.Collectors.toList()); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeLong(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnixTimestampArrayDatetimeProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnixTimestampArrayDatetimeProperty if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UnixTimestampArrayDatetimeProperty. + */ + @Generated + public static UnixTimestampArrayDatetimeProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.readArray( + reader1 -> OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader1.getLong()), ZoneOffset.UTC)); + } else { + reader.skipChildren(); + } + } + return new UnixTimestampArrayDatetimeProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampDatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampDatetimeProperty.java new file mode 100644 index 00000000000..40c63f11ff7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/UnixTimestampDatetimeProperty.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * The UnixTimestampDatetimeProperty model. + */ +@Immutable +public final class UnixTimestampDatetimeProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final long value; + + /** + * Creates an instance of UnixTimestampDatetimeProperty class. + * + * @param value the value value to set. + */ + @Generated + public UnixTimestampDatetimeProperty(OffsetDateTime value) { + if (value == null) { + this.value = 0L; + } else { + this.value = value.toEpochSecond(); + } + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public OffsetDateTime getValue() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.value), ZoneOffset.UTC); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnixTimestampDatetimeProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnixTimestampDatetimeProperty if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UnixTimestampDatetimeProperty. + */ + @Generated + public static UnixTimestampDatetimeProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffsetDateTime value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = OffsetDateTime.ofInstant(Instant.ofEpochSecond(reader.getLong()), ZoneOffset.UTC); + } else { + reader.skipChildren(); + } + } + return new UnixTimestampDatetimeProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/package-info.java new file mode 100644 index 00000000000..0174989392e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for DatetimeModel. + * Test for encode decorator on datetime. + * + */ +package encode.datetime.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/package-info.java new file mode 100644 index 00000000000..e580dd8644e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/datetime/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for DatetimeModel. + * Test for encode decorator on datetime. + * + */ +package encode.datetime; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/DurationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/DurationClientBuilder.java new file mode 100644 index 00000000000..13a7e3b79bc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/DurationClientBuilder.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import encode.duration.implementation.DurationClientImpl; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the DurationClient type. + */ +@ServiceClientBuilder( + serviceClients = { + QueryClient.class, + PropertyClient.class, + HeaderClient.class, + QueryAsyncClient.class, + PropertyAsyncClient.class, + HeaderAsyncClient.class }) +public final class DurationClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("encode-duration.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the DurationClientBuilder. + */ + @Generated + public DurationClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DurationClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the DurationClientBuilder. + */ + @Generated + public DurationClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of DurationClientImpl with the provided parameters. + * + * @return an instance of DurationClientImpl. + */ + @Generated + private DurationClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + DurationClientImpl client + = new DurationClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of QueryAsyncClient class. + * + * @return an instance of QueryAsyncClient. + */ + @Generated + public QueryAsyncClient buildQueryAsyncClient() { + return new QueryAsyncClient(buildInnerClient().getQueries()); + } + + /** + * Builds an instance of PropertyAsyncClient class. + * + * @return an instance of PropertyAsyncClient. + */ + @Generated + public PropertyAsyncClient buildPropertyAsyncClient() { + return new PropertyAsyncClient(buildInnerClient().getProperties()); + } + + /** + * Builds an instance of HeaderAsyncClient class. + * + * @return an instance of HeaderAsyncClient. + */ + @Generated + public HeaderAsyncClient buildHeaderAsyncClient() { + return new HeaderAsyncClient(buildInnerClient().getHeaders()); + } + + /** + * Builds an instance of QueryClient class. + * + * @return an instance of QueryClient. + */ + @Generated + public QueryClient buildQueryClient() { + return new QueryClient(buildInnerClient().getQueries()); + } + + /** + * Builds an instance of PropertyClient class. + * + * @return an instance of PropertyClient. + */ + @Generated + public PropertyClient buildPropertyClient() { + return new PropertyClient(buildInnerClient().getProperties()); + } + + /** + * Builds an instance of HeaderClient class. + * + * @return an instance of HeaderClient. + */ + @Generated + public HeaderClient buildHeaderClient() { + return new HeaderClient(buildInnerClient().getHeaders()); + } + + private static final ClientLogger LOGGER = new ClientLogger(DurationClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderAsyncClient.java new file mode 100644 index 00000000000..6d626edacb1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderAsyncClient.java @@ -0,0 +1,560 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import encode.duration.implementation.HeadersImpl; +import java.time.Duration; +import java.util.List; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DurationClient type. + */ +@ServiceClient(builder = DurationClientBuilder.class, isAsync = true) +public final class HeaderAsyncClient { + @Generated + private final HeadersImpl serviceClient; + + /** + * Initializes an instance of HeaderAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + HeaderAsyncClient(HeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponseAsync(duration, requestOptions); + } + + /** + * The iso8601 operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> iso8601WithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.iso8601WithResponseAsync(duration, requestOptions); + } + + /** + * The iso8601Array operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> iso8601ArrayWithResponse(List duration, RequestOptions requestOptions) { + return this.serviceClient.iso8601ArrayWithResponseAsync(duration, requestOptions); + } + + /** + * The int32Seconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsWithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsWithResponseAsync(duration, requestOptions); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsLargerUnitWithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsLargerUnitWithResponseAsync(duration, requestOptions); + } + + /** + * The floatSeconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsWithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsWithResponseAsync(duration, requestOptions); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsLargerUnitWithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsLargerUnitWithResponseAsync(duration, requestOptions); + } + + /** + * The float64Seconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> float64SecondsWithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.float64SecondsWithResponseAsync(duration, requestOptions); + } + + /** + * The int32Milliseconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsWithResponse(int duration, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsWithResponseAsync(duration, requestOptions); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsLargerUnitWithResponse(int duration, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsLargerUnitWithResponseAsync(duration, requestOptions); + } + + /** + * The floatMilliseconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsWithResponse(double duration, RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsWithResponseAsync(duration, requestOptions); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsLargerUnitWithResponse(double duration, + RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsLargerUnitWithResponseAsync(duration, requestOptions); + } + + /** + * The float64Milliseconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> float64MillisecondsWithResponse(double duration, RequestOptions requestOptions) { + return this.serviceClient.float64MillisecondsWithResponseAsync(duration, requestOptions); + } + + /** + * The int32MillisecondsArray operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsArrayWithResponse(List duration, + RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsArrayWithResponseAsync(duration, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono defaultMethod(Duration duration) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The iso8601 operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono iso8601(Duration duration) { + // Generated convenience method for iso8601WithResponse + RequestOptions requestOptions = new RequestOptions(); + return iso8601WithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The iso8601Array operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono iso8601Array(List duration) { + // Generated convenience method for iso8601ArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return iso8601ArrayWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The int32Seconds operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32Seconds(Duration duration) { + // Generated convenience method for int32SecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32SecondsWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32SecondsLargerUnit(Duration duration) { + // Generated convenience method for int32SecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32SecondsLargerUnitWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The floatSeconds operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono floatSeconds(Duration duration) { + // Generated convenience method for floatSecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatSecondsWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono floatSecondsLargerUnit(Duration duration) { + // Generated convenience method for floatSecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatSecondsLargerUnitWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The float64Seconds operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono float64Seconds(Duration duration) { + // Generated convenience method for float64SecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return float64SecondsWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The int32Milliseconds operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32Milliseconds(int duration) { + // Generated convenience method for int32MillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32MillisecondsWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32MillisecondsLargerUnit(int duration) { + // Generated convenience method for int32MillisecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32MillisecondsLargerUnitWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The floatMilliseconds operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono floatMilliseconds(double duration) { + // Generated convenience method for floatMillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatMillisecondsWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono floatMillisecondsLargerUnit(double duration) { + // Generated convenience method for floatMillisecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatMillisecondsLargerUnitWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The float64Milliseconds operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono float64Milliseconds(double duration) { + // Generated convenience method for float64MillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return float64MillisecondsWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The int32MillisecondsArray operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32MillisecondsArray(List duration) { + // Generated convenience method for int32MillisecondsArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32MillisecondsArrayWithResponse(duration, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderClient.java new file mode 100644 index 00000000000..710d085edcb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/HeaderClient.java @@ -0,0 +1,542 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import encode.duration.implementation.HeadersImpl; +import java.time.Duration; +import java.util.List; + +/** + * Initializes a new instance of the synchronous DurationClient type. + */ +@ServiceClient(builder = DurationClientBuilder.class) +public final class HeaderClient { + @Generated + private final HeadersImpl serviceClient; + + /** + * Initializes an instance of HeaderClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + HeaderClient(HeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponse(duration, requestOptions); + } + + /** + * The iso8601 operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response iso8601WithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.iso8601WithResponse(duration, requestOptions); + } + + /** + * The iso8601Array operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response iso8601ArrayWithResponse(List duration, RequestOptions requestOptions) { + return this.serviceClient.iso8601ArrayWithResponse(duration, requestOptions); + } + + /** + * The int32Seconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsWithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsWithResponse(duration, requestOptions); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsLargerUnitWithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsLargerUnitWithResponse(duration, requestOptions); + } + + /** + * The floatSeconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsWithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsWithResponse(duration, requestOptions); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsLargerUnitWithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsLargerUnitWithResponse(duration, requestOptions); + } + + /** + * The float64Seconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response float64SecondsWithResponse(Duration duration, RequestOptions requestOptions) { + return this.serviceClient.float64SecondsWithResponse(duration, requestOptions); + } + + /** + * The int32Milliseconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsWithResponse(int duration, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsWithResponse(duration, requestOptions); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsLargerUnitWithResponse(int duration, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsLargerUnitWithResponse(duration, requestOptions); + } + + /** + * The floatMilliseconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsWithResponse(double duration, RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsWithResponse(duration, requestOptions); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsLargerUnitWithResponse(double duration, RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsLargerUnitWithResponse(duration, requestOptions); + } + + /** + * The float64Milliseconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response float64MillisecondsWithResponse(double duration, RequestOptions requestOptions) { + return this.serviceClient.float64MillisecondsWithResponse(duration, requestOptions); + } + + /** + * The int32MillisecondsArray operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsArrayWithResponse(List duration, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsArrayWithResponse(duration, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void defaultMethod(Duration duration) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + defaultMethodWithResponse(duration, requestOptions).getValue(); + } + + /** + * The iso8601 operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void iso8601(Duration duration) { + // Generated convenience method for iso8601WithResponse + RequestOptions requestOptions = new RequestOptions(); + iso8601WithResponse(duration, requestOptions).getValue(); + } + + /** + * The iso8601Array operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void iso8601Array(List duration) { + // Generated convenience method for iso8601ArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + iso8601ArrayWithResponse(duration, requestOptions).getValue(); + } + + /** + * The int32Seconds operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void int32Seconds(Duration duration) { + // Generated convenience method for int32SecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + int32SecondsWithResponse(duration, requestOptions).getValue(); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void int32SecondsLargerUnit(Duration duration) { + // Generated convenience method for int32SecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + int32SecondsLargerUnitWithResponse(duration, requestOptions).getValue(); + } + + /** + * The floatSeconds operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void floatSeconds(Duration duration) { + // Generated convenience method for floatSecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + floatSecondsWithResponse(duration, requestOptions).getValue(); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void floatSecondsLargerUnit(Duration duration) { + // Generated convenience method for floatSecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + floatSecondsLargerUnitWithResponse(duration, requestOptions).getValue(); + } + + /** + * The float64Seconds operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void float64Seconds(Duration duration) { + // Generated convenience method for float64SecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + float64SecondsWithResponse(duration, requestOptions).getValue(); + } + + /** + * The int32Milliseconds operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void int32Milliseconds(int duration) { + // Generated convenience method for int32MillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + int32MillisecondsWithResponse(duration, requestOptions).getValue(); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void int32MillisecondsLargerUnit(int duration) { + // Generated convenience method for int32MillisecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + int32MillisecondsLargerUnitWithResponse(duration, requestOptions).getValue(); + } + + /** + * The floatMilliseconds operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void floatMilliseconds(double duration) { + // Generated convenience method for floatMillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + floatMillisecondsWithResponse(duration, requestOptions).getValue(); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void floatMillisecondsLargerUnit(double duration) { + // Generated convenience method for floatMillisecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + floatMillisecondsLargerUnitWithResponse(duration, requestOptions).getValue(); + } + + /** + * The float64Milliseconds operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void float64Milliseconds(double duration) { + // Generated convenience method for float64MillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + float64MillisecondsWithResponse(duration, requestOptions).getValue(); + } + + /** + * The int32MillisecondsArray operation. + * + * @param duration The duration parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void int32MillisecondsArray(List duration) { + // Generated convenience method for int32MillisecondsArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + int32MillisecondsArrayWithResponse(duration, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyAsyncClient.java new file mode 100644 index 00000000000..ddebcb7d99d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyAsyncClient.java @@ -0,0 +1,871 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import encode.duration.implementation.PropertiesImpl; +import encode.duration.property.models.DefaultDurationProperty; +import encode.duration.property.models.Float64MillisecondsDurationProperty; +import encode.duration.property.models.Float64SecondsDurationProperty; +import encode.duration.property.models.FloatMillisecondsDurationArrayProperty; +import encode.duration.property.models.FloatMillisecondsDurationProperty; +import encode.duration.property.models.FloatMillisecondsLargerUnitDurationProperty; +import encode.duration.property.models.FloatSecondsDurationArrayProperty; +import encode.duration.property.models.FloatSecondsDurationProperty; +import encode.duration.property.models.FloatSecondsLargerUnitDurationProperty; +import encode.duration.property.models.ISO8601DurationProperty; +import encode.duration.property.models.Int32MillisecondsDurationProperty; +import encode.duration.property.models.Int32MillisecondsLargerUnitDurationProperty; +import encode.duration.property.models.Int32SecondsDurationProperty; +import encode.duration.property.models.Int32SecondsLargerUnitDurationProperty; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DurationClient type. + */ +@ServiceClient(builder = DurationClientBuilder.class, isAsync = true) +public final class PropertyAsyncClient { + @Generated + private final PropertiesImpl serviceClient; + + /** + * Initializes an instance of PropertyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PropertyAsyncClient(PropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponseAsync(body, requestOptions); + } + + /** + * The iso8601 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> iso8601WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.iso8601WithResponseAsync(body, requestOptions); + } + + /** + * The int32Seconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsWithResponseAsync(body, requestOptions); + } + + /** + * The floatSeconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsWithResponseAsync(body, requestOptions); + } + + /** + * The float64Seconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> float64SecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.float64SecondsWithResponseAsync(body, requestOptions); + } + + /** + * The int32Milliseconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsWithResponseAsync(body, requestOptions); + } + + /** + * The floatMilliseconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsWithResponseAsync(body, requestOptions); + } + + /** + * The float64Milliseconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> float64MillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.float64MillisecondsWithResponseAsync(body, requestOptions); + } + + /** + * The floatSecondsArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsArrayWithResponseAsync(body, requestOptions); + } + + /** + * The floatMillisecondsArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsArrayWithResponse(BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsArrayWithResponseAsync(body, requestOptions); + } + + /** + * The int32SecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsLargerUnitWithResponse(BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.int32SecondsLargerUnitWithResponseAsync(body, requestOptions); + } + + /** + * The floatSecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsLargerUnitWithResponse(BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.floatSecondsLargerUnitWithResponseAsync(body, requestOptions); + } + + /** + * The int32MillisecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsLargerUnitWithResponse(BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsLargerUnitWithResponseAsync(body, requestOptions); + } + + /** + * The floatMillisecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsLargerUnitWithResponse(BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsLargerUnitWithResponseAsync(body, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono defaultMethod(DefaultDurationProperty body) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DefaultDurationProperty.class)); + } + + /** + * The iso8601 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono iso8601(ISO8601DurationProperty body) { + // Generated convenience method for iso8601WithResponse + RequestOptions requestOptions = new RequestOptions(); + return iso8601WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ISO8601DurationProperty.class)); + } + + /** + * The int32Seconds operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32Seconds(Int32SecondsDurationProperty body) { + // Generated convenience method for int32SecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32SecondsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Int32SecondsDurationProperty.class)); + } + + /** + * The floatSeconds operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono floatSeconds(FloatSecondsDurationProperty body) { + // Generated convenience method for floatSecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatSecondsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FloatSecondsDurationProperty.class)); + } + + /** + * The float64Seconds operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono float64Seconds(Float64SecondsDurationProperty body) { + // Generated convenience method for float64SecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return float64SecondsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Float64SecondsDurationProperty.class)); + } + + /** + * The int32Milliseconds operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32Milliseconds(Int32MillisecondsDurationProperty body) { + // Generated convenience method for int32MillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32MillisecondsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Int32MillisecondsDurationProperty.class)); + } + + /** + * The floatMilliseconds operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono floatMilliseconds(FloatMillisecondsDurationProperty body) { + // Generated convenience method for floatMillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatMillisecondsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FloatMillisecondsDurationProperty.class)); + } + + /** + * The float64Milliseconds operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono float64Milliseconds(Float64MillisecondsDurationProperty body) { + // Generated convenience method for float64MillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return float64MillisecondsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Float64MillisecondsDurationProperty.class)); + } + + /** + * The floatSecondsArray operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono floatSecondsArray(FloatSecondsDurationArrayProperty body) { + // Generated convenience method for floatSecondsArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatSecondsArrayWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FloatSecondsDurationArrayProperty.class)); + } + + /** + * The floatMillisecondsArray operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono + floatMillisecondsArray(FloatMillisecondsDurationArrayProperty body) { + // Generated convenience method for floatMillisecondsArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatMillisecondsArrayWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FloatMillisecondsDurationArrayProperty.class)); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono + int32SecondsLargerUnit(Int32SecondsLargerUnitDurationProperty body) { + // Generated convenience method for int32SecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32SecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Int32SecondsLargerUnitDurationProperty.class)); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono + floatSecondsLargerUnit(FloatSecondsLargerUnitDurationProperty body) { + // Generated convenience method for floatSecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatSecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FloatSecondsLargerUnitDurationProperty.class)); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono + int32MillisecondsLargerUnit(Int32MillisecondsLargerUnitDurationProperty body) { + // Generated convenience method for int32MillisecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32MillisecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Int32MillisecondsLargerUnitDurationProperty.class)); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono + floatMillisecondsLargerUnit(FloatMillisecondsLargerUnitDurationProperty body) { + // Generated convenience method for floatMillisecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatMillisecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FloatMillisecondsLargerUnitDurationProperty.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyClient.java new file mode 100644 index 00000000000..c175283374f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/PropertyClient.java @@ -0,0 +1,861 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import encode.duration.implementation.PropertiesImpl; +import encode.duration.property.models.DefaultDurationProperty; +import encode.duration.property.models.Float64MillisecondsDurationProperty; +import encode.duration.property.models.Float64SecondsDurationProperty; +import encode.duration.property.models.FloatMillisecondsDurationArrayProperty; +import encode.duration.property.models.FloatMillisecondsDurationProperty; +import encode.duration.property.models.FloatMillisecondsLargerUnitDurationProperty; +import encode.duration.property.models.FloatSecondsDurationArrayProperty; +import encode.duration.property.models.FloatSecondsDurationProperty; +import encode.duration.property.models.FloatSecondsLargerUnitDurationProperty; +import encode.duration.property.models.ISO8601DurationProperty; +import encode.duration.property.models.Int32MillisecondsDurationProperty; +import encode.duration.property.models.Int32MillisecondsLargerUnitDurationProperty; +import encode.duration.property.models.Int32SecondsDurationProperty; +import encode.duration.property.models.Int32SecondsLargerUnitDurationProperty; + +/** + * Initializes a new instance of the synchronous DurationClient type. + */ +@ServiceClient(builder = DurationClientBuilder.class) +public final class PropertyClient { + @Generated + private final PropertiesImpl serviceClient; + + /** + * Initializes an instance of PropertyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PropertyClient(PropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponse(body, requestOptions); + } + + /** + * The iso8601 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response iso8601WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.iso8601WithResponse(body, requestOptions); + } + + /** + * The int32Seconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsWithResponse(body, requestOptions); + } + + /** + * The floatSeconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsWithResponse(body, requestOptions); + } + + /** + * The float64Seconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response float64SecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.float64SecondsWithResponse(body, requestOptions); + } + + /** + * The int32Milliseconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsWithResponse(body, requestOptions); + } + + /** + * The floatMilliseconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsWithResponse(body, requestOptions); + } + + /** + * The float64Milliseconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response float64MillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.float64MillisecondsWithResponse(body, requestOptions); + } + + /** + * The floatSecondsArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsArrayWithResponse(body, requestOptions); + } + + /** + * The floatMillisecondsArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsArrayWithResponse(body, requestOptions); + } + + /** + * The int32SecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsLargerUnitWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsLargerUnitWithResponse(body, requestOptions); + } + + /** + * The floatSecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsLargerUnitWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsLargerUnitWithResponse(body, requestOptions); + } + + /** + * The int32MillisecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsLargerUnitWithResponse(BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsLargerUnitWithResponse(body, requestOptions); + } + + /** + * The floatMillisecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsLargerUnitWithResponse(BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsLargerUnitWithResponse(body, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DefaultDurationProperty defaultMethod(DefaultDurationProperty body) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(DefaultDurationProperty.class); + } + + /** + * The iso8601 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ISO8601DurationProperty iso8601(ISO8601DurationProperty body) { + // Generated convenience method for iso8601WithResponse + RequestOptions requestOptions = new RequestOptions(); + return iso8601WithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(ISO8601DurationProperty.class); + } + + /** + * The int32Seconds operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Int32SecondsDurationProperty int32Seconds(Int32SecondsDurationProperty body) { + // Generated convenience method for int32SecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32SecondsWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Int32SecondsDurationProperty.class); + } + + /** + * The floatSeconds operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FloatSecondsDurationProperty floatSeconds(FloatSecondsDurationProperty body) { + // Generated convenience method for floatSecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatSecondsWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(FloatSecondsDurationProperty.class); + } + + /** + * The float64Seconds operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Float64SecondsDurationProperty float64Seconds(Float64SecondsDurationProperty body) { + // Generated convenience method for float64SecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return float64SecondsWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Float64SecondsDurationProperty.class); + } + + /** + * The int32Milliseconds operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Int32MillisecondsDurationProperty int32Milliseconds(Int32MillisecondsDurationProperty body) { + // Generated convenience method for int32MillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32MillisecondsWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Int32MillisecondsDurationProperty.class); + } + + /** + * The floatMilliseconds operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FloatMillisecondsDurationProperty floatMilliseconds(FloatMillisecondsDurationProperty body) { + // Generated convenience method for floatMillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatMillisecondsWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(FloatMillisecondsDurationProperty.class); + } + + /** + * The float64Milliseconds operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Float64MillisecondsDurationProperty float64Milliseconds(Float64MillisecondsDurationProperty body) { + // Generated convenience method for float64MillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return float64MillisecondsWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Float64MillisecondsDurationProperty.class); + } + + /** + * The floatSecondsArray operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FloatSecondsDurationArrayProperty floatSecondsArray(FloatSecondsDurationArrayProperty body) { + // Generated convenience method for floatSecondsArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatSecondsArrayWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(FloatSecondsDurationArrayProperty.class); + } + + /** + * The floatMillisecondsArray operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FloatMillisecondsDurationArrayProperty floatMillisecondsArray(FloatMillisecondsDurationArrayProperty body) { + // Generated convenience method for floatMillisecondsArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatMillisecondsArrayWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(FloatMillisecondsDurationArrayProperty.class); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Int32SecondsLargerUnitDurationProperty int32SecondsLargerUnit(Int32SecondsLargerUnitDurationProperty body) { + // Generated convenience method for int32SecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32SecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Int32SecondsLargerUnitDurationProperty.class); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FloatSecondsLargerUnitDurationProperty floatSecondsLargerUnit(FloatSecondsLargerUnitDurationProperty body) { + // Generated convenience method for floatSecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatSecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(FloatSecondsLargerUnitDurationProperty.class); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Int32MillisecondsLargerUnitDurationProperty + int32MillisecondsLargerUnit(Int32MillisecondsLargerUnitDurationProperty body) { + // Generated convenience method for int32MillisecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32MillisecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Int32MillisecondsLargerUnitDurationProperty.class); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FloatMillisecondsLargerUnitDurationProperty + floatMillisecondsLargerUnit(FloatMillisecondsLargerUnitDurationProperty body) { + // Generated convenience method for floatMillisecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatMillisecondsLargerUnitWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(FloatMillisecondsLargerUnitDurationProperty.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryAsyncClient.java new file mode 100644 index 00000000000..c376be68fe2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryAsyncClient.java @@ -0,0 +1,558 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import encode.duration.implementation.QueriesImpl; +import java.time.Duration; +import java.util.List; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous DurationClient type. + */ +@ServiceClient(builder = DurationClientBuilder.class, isAsync = true) +public final class QueryAsyncClient { + @Generated + private final QueriesImpl serviceClient; + + /** + * Initializes an instance of QueryAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryAsyncClient(QueriesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponseAsync(input, requestOptions); + } + + /** + * The iso8601 operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> iso8601WithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.iso8601WithResponseAsync(input, requestOptions); + } + + /** + * The int32Seconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsWithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsWithResponseAsync(input, requestOptions); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsLargerUnitWithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsLargerUnitWithResponseAsync(input, requestOptions); + } + + /** + * The floatSeconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsWithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsWithResponseAsync(input, requestOptions); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsLargerUnitWithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsLargerUnitWithResponseAsync(input, requestOptions); + } + + /** + * The float64Seconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> float64SecondsWithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.float64SecondsWithResponseAsync(input, requestOptions); + } + + /** + * The int32Milliseconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsWithResponse(int input, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsWithResponseAsync(input, requestOptions); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsLargerUnitWithResponse(int input, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsLargerUnitWithResponseAsync(input, requestOptions); + } + + /** + * The floatMilliseconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsWithResponse(double input, RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsWithResponseAsync(input, requestOptions); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsLargerUnitWithResponse(double input, RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsLargerUnitWithResponseAsync(input, requestOptions); + } + + /** + * The float64Milliseconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> float64MillisecondsWithResponse(double input, RequestOptions requestOptions) { + return this.serviceClient.float64MillisecondsWithResponseAsync(input, requestOptions); + } + + /** + * The int32SecondsArray operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsArrayWithResponse(List input, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsArrayWithResponseAsync(input, requestOptions); + } + + /** + * The int32MillisecondsArray operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsArrayWithResponse(List input, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsArrayWithResponseAsync(input, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono defaultMethod(Duration input) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defaultMethodWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The iso8601 operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono iso8601(Duration input) { + // Generated convenience method for iso8601WithResponse + RequestOptions requestOptions = new RequestOptions(); + return iso8601WithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The int32Seconds operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32Seconds(Duration input) { + // Generated convenience method for int32SecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32SecondsWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32SecondsLargerUnit(Duration input) { + // Generated convenience method for int32SecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32SecondsLargerUnitWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The floatSeconds operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono floatSeconds(Duration input) { + // Generated convenience method for floatSecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatSecondsWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono floatSecondsLargerUnit(Duration input) { + // Generated convenience method for floatSecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatSecondsLargerUnitWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The float64Seconds operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono float64Seconds(Duration input) { + // Generated convenience method for float64SecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return float64SecondsWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The int32Milliseconds operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32Milliseconds(int input) { + // Generated convenience method for int32MillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32MillisecondsWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32MillisecondsLargerUnit(int input) { + // Generated convenience method for int32MillisecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32MillisecondsLargerUnitWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The floatMilliseconds operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono floatMilliseconds(double input) { + // Generated convenience method for floatMillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatMillisecondsWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono floatMillisecondsLargerUnit(double input) { + // Generated convenience method for floatMillisecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatMillisecondsLargerUnitWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The float64Milliseconds operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono float64Milliseconds(double input) { + // Generated convenience method for float64MillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return float64MillisecondsWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The int32SecondsArray operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32SecondsArray(List input) { + // Generated convenience method for int32SecondsArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32SecondsArrayWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The int32MillisecondsArray operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono int32MillisecondsArray(List input) { + // Generated convenience method for int32MillisecondsArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return int32MillisecondsArrayWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryClient.java new file mode 100644 index 00000000000..1c68bee8ba5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/QueryClient.java @@ -0,0 +1,542 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import encode.duration.implementation.QueriesImpl; +import java.time.Duration; +import java.util.List; + +/** + * Initializes a new instance of the synchronous DurationClient type. + */ +@ServiceClient(builder = DurationClientBuilder.class) +public final class QueryClient { + @Generated + private final QueriesImpl serviceClient; + + /** + * Initializes an instance of QueryClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryClient(QueriesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The defaultMethod operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.defaultMethodWithResponse(input, requestOptions); + } + + /** + * The iso8601 operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response iso8601WithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.iso8601WithResponse(input, requestOptions); + } + + /** + * The int32Seconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsWithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsWithResponse(input, requestOptions); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsLargerUnitWithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsLargerUnitWithResponse(input, requestOptions); + } + + /** + * The floatSeconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsWithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsWithResponse(input, requestOptions); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsLargerUnitWithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.floatSecondsLargerUnitWithResponse(input, requestOptions); + } + + /** + * The float64Seconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response float64SecondsWithResponse(Duration input, RequestOptions requestOptions) { + return this.serviceClient.float64SecondsWithResponse(input, requestOptions); + } + + /** + * The int32Milliseconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsWithResponse(int input, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsWithResponse(input, requestOptions); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsLargerUnitWithResponse(int input, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsLargerUnitWithResponse(input, requestOptions); + } + + /** + * The floatMilliseconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsWithResponse(double input, RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsWithResponse(input, requestOptions); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsLargerUnitWithResponse(double input, RequestOptions requestOptions) { + return this.serviceClient.floatMillisecondsLargerUnitWithResponse(input, requestOptions); + } + + /** + * The float64Milliseconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response float64MillisecondsWithResponse(double input, RequestOptions requestOptions) { + return this.serviceClient.float64MillisecondsWithResponse(input, requestOptions); + } + + /** + * The int32SecondsArray operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsArrayWithResponse(List input, RequestOptions requestOptions) { + return this.serviceClient.int32SecondsArrayWithResponse(input, requestOptions); + } + + /** + * The int32MillisecondsArray operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsArrayWithResponse(List input, RequestOptions requestOptions) { + return this.serviceClient.int32MillisecondsArrayWithResponse(input, requestOptions); + } + + /** + * The defaultMethod operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void defaultMethod(Duration input) { + // Generated convenience method for defaultMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + defaultMethodWithResponse(input, requestOptions).getValue(); + } + + /** + * The iso8601 operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void iso8601(Duration input) { + // Generated convenience method for iso8601WithResponse + RequestOptions requestOptions = new RequestOptions(); + iso8601WithResponse(input, requestOptions).getValue(); + } + + /** + * The int32Seconds operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void int32Seconds(Duration input) { + // Generated convenience method for int32SecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + int32SecondsWithResponse(input, requestOptions).getValue(); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void int32SecondsLargerUnit(Duration input) { + // Generated convenience method for int32SecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + int32SecondsLargerUnitWithResponse(input, requestOptions).getValue(); + } + + /** + * The floatSeconds operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void floatSeconds(Duration input) { + // Generated convenience method for floatSecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + floatSecondsWithResponse(input, requestOptions).getValue(); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void floatSecondsLargerUnit(Duration input) { + // Generated convenience method for floatSecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + floatSecondsLargerUnitWithResponse(input, requestOptions).getValue(); + } + + /** + * The float64Seconds operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void float64Seconds(Duration input) { + // Generated convenience method for float64SecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + float64SecondsWithResponse(input, requestOptions).getValue(); + } + + /** + * The int32Milliseconds operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void int32Milliseconds(int input) { + // Generated convenience method for int32MillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + int32MillisecondsWithResponse(input, requestOptions).getValue(); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void int32MillisecondsLargerUnit(int input) { + // Generated convenience method for int32MillisecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + int32MillisecondsLargerUnitWithResponse(input, requestOptions).getValue(); + } + + /** + * The floatMilliseconds operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void floatMilliseconds(double input) { + // Generated convenience method for floatMillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + floatMillisecondsWithResponse(input, requestOptions).getValue(); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void floatMillisecondsLargerUnit(double input) { + // Generated convenience method for floatMillisecondsLargerUnitWithResponse + RequestOptions requestOptions = new RequestOptions(); + floatMillisecondsLargerUnitWithResponse(input, requestOptions).getValue(); + } + + /** + * The float64Milliseconds operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void float64Milliseconds(double input) { + // Generated convenience method for float64MillisecondsWithResponse + RequestOptions requestOptions = new RequestOptions(); + float64MillisecondsWithResponse(input, requestOptions).getValue(); + } + + /** + * The int32SecondsArray operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void int32SecondsArray(List input) { + // Generated convenience method for int32SecondsArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + int32SecondsArrayWithResponse(input, requestOptions).getValue(); + } + + /** + * The int32MillisecondsArray operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void int32MillisecondsArray(List input) { + // Generated convenience method for int32MillisecondsArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + int32MillisecondsArrayWithResponse(input, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/DurationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/DurationClientImpl.java new file mode 100644 index 00000000000..64829d228e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/DurationClientImpl.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 DurationClient type. + */ +public final class DurationClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 QueriesImpl object to access its operations. + */ + private final QueriesImpl queries; + + /** + * Gets the QueriesImpl object to access its operations. + * + * @return the QueriesImpl object. + */ + public QueriesImpl getQueries() { + return this.queries; + } + + /** + * The PropertiesImpl object to access its operations. + */ + private final PropertiesImpl properties; + + /** + * Gets the PropertiesImpl object to access its operations. + * + * @return the PropertiesImpl object. + */ + public PropertiesImpl getProperties() { + return this.properties; + } + + /** + * The HeadersImpl object to access its operations. + */ + private final HeadersImpl headers; + + /** + * Gets the HeadersImpl object to access its operations. + * + * @return the HeadersImpl object. + */ + public HeadersImpl getHeaders() { + return this.headers; + } + + /** + * Initializes an instance of DurationClient client. + * + * @param endpoint Service host. + */ + public DurationClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DurationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public DurationClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DurationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public DurationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.queries = new QueriesImpl(this); + this.properties = new PropertiesImpl(this); + this.headers = new HeadersImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/HeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/HeadersImpl.java new file mode 100644 index 00000000000..78fc0f39e98 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/HeadersImpl.java @@ -0,0 +1,804 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.CollectionFormat; +import com.azure.core.util.serializer.JacksonAdapter; +import java.time.Duration; +import java.util.List; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Headers. + */ +public final class HeadersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final HeadersService service; + + /** + * The service client containing this operation class. + */ + private final DurationClientImpl client; + + /** + * Initializes an instance of HeadersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HeadersImpl(DurationClientImpl client) { + this.service = RestProxy.create(HeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DurationClientHeaders to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DurationClientHeaders") + public interface HeadersService { + @Get("/encode/duration/header/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> defaultMethod(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") Duration duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defaultMethodSync(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") Duration duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/iso8601") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> iso8601(@HostParam("endpoint") String endpoint, @HeaderParam("duration") Duration duration, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/iso8601") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response iso8601Sync(@HostParam("endpoint") String endpoint, @HeaderParam("duration") Duration duration, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/iso8601-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> iso8601Array(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") String duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/iso8601-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response iso8601ArraySync(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") String duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/int32-seconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32Seconds(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") long duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/int32-seconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32SecondsSync(@HostParam("endpoint") String endpoint, @HeaderParam("duration") long duration, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/int32-seconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32SecondsLargerUnit(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") long duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/int32-seconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32SecondsLargerUnitSync(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") long duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/float-seconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatSeconds(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/float-seconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatSecondsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/float-seconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatSecondsLargerUnit(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/float-seconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatSecondsLargerUnitSync(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/float64-seconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> float64Seconds(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/float64-seconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response float64SecondsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/int32-milliseconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32Milliseconds(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") int duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/int32-milliseconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32MillisecondsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") int duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/int32-milliseconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32MillisecondsLargerUnit(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") int duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/int32-milliseconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32MillisecondsLargerUnitSync(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") int duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/float-milliseconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatMilliseconds(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/float-milliseconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatMillisecondsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/float-milliseconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatMillisecondsLargerUnit(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/float-milliseconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatMillisecondsLargerUnitSync(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/float64-milliseconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> float64Milliseconds(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/float64-milliseconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response float64MillisecondsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") double duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/int32-milliseconds-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32MillisecondsArray(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") String duration, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/header/int32-milliseconds-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32MillisecondsArraySync(@HostParam("endpoint") String endpoint, + @HeaderParam("duration") String duration, RequestOptions requestOptions, Context context); + } + + /** + * The defaultMethod operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponseAsync(Duration duration, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.defaultMethod(this.client.getEndpoint(), duration, requestOptions, context)); + } + + /** + * The defaultMethod operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(Duration duration, RequestOptions requestOptions) { + return service.defaultMethodSync(this.client.getEndpoint(), duration, requestOptions, Context.NONE); + } + + /** + * The iso8601 operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> iso8601WithResponseAsync(Duration duration, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.iso8601(this.client.getEndpoint(), duration, requestOptions, context)); + } + + /** + * The iso8601 operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response iso8601WithResponse(Duration duration, RequestOptions requestOptions) { + return service.iso8601Sync(this.client.getEndpoint(), duration, requestOptions, Context.NONE); + } + + /** + * The iso8601Array operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> iso8601ArrayWithResponseAsync(List duration, RequestOptions requestOptions) { + String durationConverted + = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(duration, CollectionFormat.CSV); + return FluxUtil.withContext( + context -> service.iso8601Array(this.client.getEndpoint(), durationConverted, requestOptions, context)); + } + + /** + * The iso8601Array operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response iso8601ArrayWithResponse(List duration, RequestOptions requestOptions) { + String durationConverted + = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(duration, CollectionFormat.CSV); + return service.iso8601ArraySync(this.client.getEndpoint(), durationConverted, requestOptions, Context.NONE); + } + + /** + * The int32Seconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsWithResponseAsync(Duration duration, RequestOptions requestOptions) { + long durationConverted = duration.getSeconds(); + return FluxUtil.withContext( + context -> service.int32Seconds(this.client.getEndpoint(), durationConverted, requestOptions, context)); + } + + /** + * The int32Seconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsWithResponse(Duration duration, RequestOptions requestOptions) { + long durationConverted = duration.getSeconds(); + return service.int32SecondsSync(this.client.getEndpoint(), durationConverted, requestOptions, Context.NONE); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsLargerUnitWithResponseAsync(Duration duration, + RequestOptions requestOptions) { + long durationConverted = duration.getSeconds(); + return FluxUtil.withContext(context -> service.int32SecondsLargerUnit(this.client.getEndpoint(), + durationConverted, requestOptions, context)); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsLargerUnitWithResponse(Duration duration, RequestOptions requestOptions) { + long durationConverted = duration.getSeconds(); + return service.int32SecondsLargerUnitSync(this.client.getEndpoint(), durationConverted, requestOptions, + Context.NONE); + } + + /** + * The floatSeconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsWithResponseAsync(Duration duration, RequestOptions requestOptions) { + double durationConverted = (double) duration.toNanos() / 1000_000_000L; + return FluxUtil.withContext( + context -> service.floatSeconds(this.client.getEndpoint(), durationConverted, requestOptions, context)); + } + + /** + * The floatSeconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsWithResponse(Duration duration, RequestOptions requestOptions) { + double durationConverted = (double) duration.toNanos() / 1000_000_000L; + return service.floatSecondsSync(this.client.getEndpoint(), durationConverted, requestOptions, Context.NONE); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsLargerUnitWithResponseAsync(Duration duration, + RequestOptions requestOptions) { + double durationConverted = (double) duration.toNanos() / 1000_000_000L; + return FluxUtil.withContext(context -> service.floatSecondsLargerUnit(this.client.getEndpoint(), + durationConverted, requestOptions, context)); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsLargerUnitWithResponse(Duration duration, RequestOptions requestOptions) { + double durationConverted = (double) duration.toNanos() / 1000_000_000L; + return service.floatSecondsLargerUnitSync(this.client.getEndpoint(), durationConverted, requestOptions, + Context.NONE); + } + + /** + * The float64Seconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> float64SecondsWithResponseAsync(Duration duration, RequestOptions requestOptions) { + double durationConverted = (double) duration.toNanos() / 1000_000_000L; + return FluxUtil.withContext( + context -> service.float64Seconds(this.client.getEndpoint(), durationConverted, requestOptions, context)); + } + + /** + * The float64Seconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response float64SecondsWithResponse(Duration duration, RequestOptions requestOptions) { + double durationConverted = (double) duration.toNanos() / 1000_000_000L; + return service.float64SecondsSync(this.client.getEndpoint(), durationConverted, requestOptions, Context.NONE); + } + + /** + * The int32Milliseconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsWithResponseAsync(int duration, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.int32Milliseconds(this.client.getEndpoint(), duration, requestOptions, context)); + } + + /** + * The int32Milliseconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsWithResponse(int duration, RequestOptions requestOptions) { + return service.int32MillisecondsSync(this.client.getEndpoint(), duration, requestOptions, Context.NONE); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsLargerUnitWithResponseAsync(int duration, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.int32MillisecondsLargerUnit(this.client.getEndpoint(), duration, + requestOptions, context)); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsLargerUnitWithResponse(int duration, RequestOptions requestOptions) { + return service.int32MillisecondsLargerUnitSync(this.client.getEndpoint(), duration, requestOptions, + Context.NONE); + } + + /** + * The floatMilliseconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsWithResponseAsync(double duration, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.floatMilliseconds(this.client.getEndpoint(), duration, requestOptions, context)); + } + + /** + * The floatMilliseconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsWithResponse(double duration, RequestOptions requestOptions) { + return service.floatMillisecondsSync(this.client.getEndpoint(), duration, requestOptions, Context.NONE); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsLargerUnitWithResponseAsync(double duration, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.floatMillisecondsLargerUnit(this.client.getEndpoint(), duration, + requestOptions, context)); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsLargerUnitWithResponse(double duration, RequestOptions requestOptions) { + return service.floatMillisecondsLargerUnitSync(this.client.getEndpoint(), duration, requestOptions, + Context.NONE); + } + + /** + * The float64Milliseconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> float64MillisecondsWithResponseAsync(double duration, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.float64Milliseconds(this.client.getEndpoint(), duration, requestOptions, context)); + } + + /** + * The float64Milliseconds operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response float64MillisecondsWithResponse(double duration, RequestOptions requestOptions) { + return service.float64MillisecondsSync(this.client.getEndpoint(), duration, requestOptions, Context.NONE); + } + + /** + * The int32MillisecondsArray operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsArrayWithResponseAsync(List duration, + RequestOptions requestOptions) { + String durationConverted + = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(duration, CollectionFormat.CSV); + return FluxUtil.withContext(context -> service.int32MillisecondsArray(this.client.getEndpoint(), + durationConverted, requestOptions, context)); + } + + /** + * The int32MillisecondsArray operation. + * + * @param duration The duration parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsArrayWithResponse(List duration, RequestOptions requestOptions) { + String durationConverted + = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(duration, CollectionFormat.CSV); + return service.int32MillisecondsArraySync(this.client.getEndpoint(), durationConverted, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/PropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/PropertiesImpl.java new file mode 100644 index 00000000000..b727b536a71 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/PropertiesImpl.java @@ -0,0 +1,1431 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Properties. + */ +public final class PropertiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PropertiesService service; + + /** + * The service client containing this operation class. + */ + private final DurationClientImpl client; + + /** + * Initializes an instance of PropertiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PropertiesImpl(DurationClientImpl client) { + this.service + = RestProxy.create(PropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DurationClientProperties to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DurationClientProperties") + public interface PropertiesService { + @Post("/encode/duration/property/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> defaultMethod(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defaultMethodSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/iso8601") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> iso8601(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/iso8601") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response iso8601Sync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/int32-seconds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32Seconds(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/int32-seconds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32SecondsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float-seconds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatSeconds(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float-seconds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatSecondsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float64-seconds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> float64Seconds(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float64-seconds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response float64SecondsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/int32-milliseconds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32Milliseconds(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/int32-milliseconds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32MillisecondsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float-milliseconds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatMilliseconds(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float-milliseconds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatMillisecondsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float64-milliseconds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> float64Milliseconds(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float64-milliseconds") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response float64MillisecondsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float-seconds-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatSecondsArray(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float-seconds-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatSecondsArraySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float-milliseconds-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatMillisecondsArray(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float-milliseconds-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatMillisecondsArraySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/int32-seconds-larger-unit") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32SecondsLargerUnit(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/int32-seconds-larger-unit") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32SecondsLargerUnitSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float-seconds-larger-unit") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatSecondsLargerUnit(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float-seconds-larger-unit") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatSecondsLargerUnitSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/int32-milliseconds-larger-unit") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32MillisecondsLargerUnit(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/int32-milliseconds-larger-unit") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32MillisecondsLargerUnitSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float-milliseconds-larger-unit") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatMillisecondsLargerUnit(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/encode/duration/property/float-milliseconds-larger-unit") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatMillisecondsLargerUnitSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.defaultMethod(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The defaultMethod operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.defaultMethodSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The iso8601 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> iso8601WithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.iso8601(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * The iso8601 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response iso8601WithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.iso8601Sync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * The int32Seconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.int32Seconds(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The int32Seconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.int32SecondsSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The floatSeconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.floatSeconds(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The floatSeconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.floatSecondsSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The float64Seconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> float64SecondsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.float64Seconds(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The float64Seconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response float64SecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.float64SecondsSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The int32Milliseconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.int32Milliseconds(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The int32Milliseconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.int32MillisecondsSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The floatMilliseconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.floatMilliseconds(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The floatMilliseconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.floatMillisecondsSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The float64Milliseconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> float64MillisecondsWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.float64Milliseconds(this.client.getEndpoint(), contentType, + accept, body, requestOptions, context)); + } + + /** + * The float64Milliseconds operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response float64MillisecondsWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.float64MillisecondsSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The floatSecondsArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsArrayWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.floatSecondsArray(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The floatSecondsArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.floatSecondsArraySync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The floatMillisecondsArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsArrayWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.floatMillisecondsArray(this.client.getEndpoint(), contentType, + accept, body, requestOptions, context)); + } + + /** + * The floatMillisecondsArray operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *         double (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.floatMillisecondsArraySync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The int32SecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsLargerUnitWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.int32SecondsLargerUnit(this.client.getEndpoint(), contentType, + accept, body, requestOptions, context)); + } + + /** + * The int32SecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsLargerUnitWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.int32SecondsLargerUnitSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The floatSecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsLargerUnitWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.floatSecondsLargerUnit(this.client.getEndpoint(), contentType, + accept, body, requestOptions, context)); + } + + /** + * The floatSecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsLargerUnitWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.floatSecondsLargerUnitSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The int32MillisecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsLargerUnitWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.int32MillisecondsLargerUnit(this.client.getEndpoint(), + contentType, accept, body, requestOptions, context)); + } + + /** + * The int32MillisecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsLargerUnitWithResponse(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.int32MillisecondsLargerUnitSync(this.client.getEndpoint(), contentType, accept, body, + requestOptions, Context.NONE); + } + + /** + * The floatMillisecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsLargerUnitWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.floatMillisecondsLargerUnit(this.client.getEndpoint(), + contentType, accept, body, requestOptions, context)); + } + + /** + * The floatMillisecondsLargerUnit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsLargerUnitWithResponse(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.floatMillisecondsLargerUnitSync(this.client.getEndpoint(), contentType, accept, body, + requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/QueriesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/QueriesImpl.java new file mode 100644 index 00000000000..3a46e23b7ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/QueriesImpl.java @@ -0,0 +1,805 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.CollectionFormat; +import com.azure.core.util.serializer.JacksonAdapter; +import java.time.Duration; +import java.util.List; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Queries. + */ +public final class QueriesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final QueriesService service; + + /** + * The service client containing this operation class. + */ + private final DurationClientImpl client; + + /** + * Initializes an instance of QueriesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueriesImpl(DurationClientImpl client) { + this.service = RestProxy.create(QueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DurationClientQueries to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DurationClientQueries") + public interface QueriesService { + @Get("/encode/duration/query/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> defaultMethod(@HostParam("endpoint") String endpoint, @QueryParam("input") Duration input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defaultMethodSync(@HostParam("endpoint") String endpoint, @QueryParam("input") Duration input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/iso8601") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> iso8601(@HostParam("endpoint") String endpoint, @QueryParam("input") Duration input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/iso8601") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response iso8601Sync(@HostParam("endpoint") String endpoint, @QueryParam("input") Duration input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/int32-seconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32Seconds(@HostParam("endpoint") String endpoint, @QueryParam("input") long input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/int32-seconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32SecondsSync(@HostParam("endpoint") String endpoint, @QueryParam("input") long input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/int32-seconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32SecondsLargerUnit(@HostParam("endpoint") String endpoint, + @QueryParam("input") long input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/int32-seconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32SecondsLargerUnitSync(@HostParam("endpoint") String endpoint, + @QueryParam("input") long input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/float-seconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatSeconds(@HostParam("endpoint") String endpoint, @QueryParam("input") double input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/float-seconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatSecondsSync(@HostParam("endpoint") String endpoint, @QueryParam("input") double input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/float-seconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatSecondsLargerUnit(@HostParam("endpoint") String endpoint, + @QueryParam("input") double input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/float-seconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatSecondsLargerUnitSync(@HostParam("endpoint") String endpoint, + @QueryParam("input") double input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/float64-seconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> float64Seconds(@HostParam("endpoint") String endpoint, @QueryParam("input") double input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/float64-seconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response float64SecondsSync(@HostParam("endpoint") String endpoint, @QueryParam("input") double input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/int32-milliseconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32Milliseconds(@HostParam("endpoint") String endpoint, @QueryParam("input") int input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/int32-milliseconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32MillisecondsSync(@HostParam("endpoint") String endpoint, @QueryParam("input") int input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/int32-milliseconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32MillisecondsLargerUnit(@HostParam("endpoint") String endpoint, + @QueryParam("input") int input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/int32-milliseconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32MillisecondsLargerUnitSync(@HostParam("endpoint") String endpoint, + @QueryParam("input") int input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/float-milliseconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatMilliseconds(@HostParam("endpoint") String endpoint, + @QueryParam("input") double input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/float-milliseconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatMillisecondsSync(@HostParam("endpoint") String endpoint, @QueryParam("input") double input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/float-milliseconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatMillisecondsLargerUnit(@HostParam("endpoint") String endpoint, + @QueryParam("input") double input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/float-milliseconds-larger-unit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatMillisecondsLargerUnitSync(@HostParam("endpoint") String endpoint, + @QueryParam("input") double input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/float64-milliseconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> float64Milliseconds(@HostParam("endpoint") String endpoint, + @QueryParam("input") double input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/float64-milliseconds") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response float64MillisecondsSync(@HostParam("endpoint") String endpoint, + @QueryParam("input") double input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/int32-seconds-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32SecondsArray(@HostParam("endpoint") String endpoint, + @QueryParam("input") String input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/int32-seconds-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32SecondsArraySync(@HostParam("endpoint") String endpoint, @QueryParam("input") String input, + RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/int32-milliseconds-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> int32MillisecondsArray(@HostParam("endpoint") String endpoint, + @QueryParam("input") String input, RequestOptions requestOptions, Context context); + + @Get("/encode/duration/query/int32-milliseconds-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response int32MillisecondsArraySync(@HostParam("endpoint") String endpoint, + @QueryParam("input") String input, RequestOptions requestOptions, Context context); + } + + /** + * The defaultMethod operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defaultMethodWithResponseAsync(Duration input, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.defaultMethod(this.client.getEndpoint(), input, requestOptions, context)); + } + + /** + * The defaultMethod operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defaultMethodWithResponse(Duration input, RequestOptions requestOptions) { + return service.defaultMethodSync(this.client.getEndpoint(), input, requestOptions, Context.NONE); + } + + /** + * The iso8601 operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> iso8601WithResponseAsync(Duration input, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.iso8601(this.client.getEndpoint(), input, requestOptions, context)); + } + + /** + * The iso8601 operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response iso8601WithResponse(Duration input, RequestOptions requestOptions) { + return service.iso8601Sync(this.client.getEndpoint(), input, requestOptions, Context.NONE); + } + + /** + * The int32Seconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsWithResponseAsync(Duration input, RequestOptions requestOptions) { + long inputConverted = input.getSeconds(); + return FluxUtil.withContext( + context -> service.int32Seconds(this.client.getEndpoint(), inputConverted, requestOptions, context)); + } + + /** + * The int32Seconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsWithResponse(Duration input, RequestOptions requestOptions) { + long inputConverted = input.getSeconds(); + return service.int32SecondsSync(this.client.getEndpoint(), inputConverted, requestOptions, Context.NONE); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsLargerUnitWithResponseAsync(Duration input, RequestOptions requestOptions) { + long inputConverted = input.getSeconds(); + return FluxUtil.withContext(context -> service.int32SecondsLargerUnit(this.client.getEndpoint(), inputConverted, + requestOptions, context)); + } + + /** + * The int32SecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsLargerUnitWithResponse(Duration input, RequestOptions requestOptions) { + long inputConverted = input.getSeconds(); + return service.int32SecondsLargerUnitSync(this.client.getEndpoint(), inputConverted, requestOptions, + Context.NONE); + } + + /** + * The floatSeconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsWithResponseAsync(Duration input, RequestOptions requestOptions) { + double inputConverted = (double) input.toNanos() / 1000_000_000L; + return FluxUtil.withContext( + context -> service.floatSeconds(this.client.getEndpoint(), inputConverted, requestOptions, context)); + } + + /** + * The floatSeconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsWithResponse(Duration input, RequestOptions requestOptions) { + double inputConverted = (double) input.toNanos() / 1000_000_000L; + return service.floatSecondsSync(this.client.getEndpoint(), inputConverted, requestOptions, Context.NONE); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatSecondsLargerUnitWithResponseAsync(Duration input, RequestOptions requestOptions) { + double inputConverted = (double) input.toNanos() / 1000_000_000L; + return FluxUtil.withContext(context -> service.floatSecondsLargerUnit(this.client.getEndpoint(), inputConverted, + requestOptions, context)); + } + + /** + * The floatSecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatSecondsLargerUnitWithResponse(Duration input, RequestOptions requestOptions) { + double inputConverted = (double) input.toNanos() / 1000_000_000L; + return service.floatSecondsLargerUnitSync(this.client.getEndpoint(), inputConverted, requestOptions, + Context.NONE); + } + + /** + * The float64Seconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> float64SecondsWithResponseAsync(Duration input, RequestOptions requestOptions) { + double inputConverted = (double) input.toNanos() / 1000_000_000L; + return FluxUtil.withContext( + context -> service.float64Seconds(this.client.getEndpoint(), inputConverted, requestOptions, context)); + } + + /** + * The float64Seconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response float64SecondsWithResponse(Duration input, RequestOptions requestOptions) { + double inputConverted = (double) input.toNanos() / 1000_000_000L; + return service.float64SecondsSync(this.client.getEndpoint(), inputConverted, requestOptions, Context.NONE); + } + + /** + * The int32Milliseconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsWithResponseAsync(int input, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.int32Milliseconds(this.client.getEndpoint(), input, requestOptions, context)); + } + + /** + * The int32Milliseconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsWithResponse(int input, RequestOptions requestOptions) { + return service.int32MillisecondsSync(this.client.getEndpoint(), input, requestOptions, Context.NONE); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsLargerUnitWithResponseAsync(int input, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.int32MillisecondsLargerUnit(this.client.getEndpoint(), input, requestOptions, context)); + } + + /** + * The int32MillisecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsLargerUnitWithResponse(int input, RequestOptions requestOptions) { + return service.int32MillisecondsLargerUnitSync(this.client.getEndpoint(), input, requestOptions, Context.NONE); + } + + /** + * The floatMilliseconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsWithResponseAsync(double input, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.floatMilliseconds(this.client.getEndpoint(), input, requestOptions, context)); + } + + /** + * The floatMilliseconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsWithResponse(double input, RequestOptions requestOptions) { + return service.floatMillisecondsSync(this.client.getEndpoint(), input, requestOptions, Context.NONE); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMillisecondsLargerUnitWithResponseAsync(double input, + RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.floatMillisecondsLargerUnit(this.client.getEndpoint(), input, requestOptions, context)); + } + + /** + * The floatMillisecondsLargerUnit operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMillisecondsLargerUnitWithResponse(double input, RequestOptions requestOptions) { + return service.floatMillisecondsLargerUnitSync(this.client.getEndpoint(), input, requestOptions, Context.NONE); + } + + /** + * The float64Milliseconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> float64MillisecondsWithResponseAsync(double input, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.float64Milliseconds(this.client.getEndpoint(), input, requestOptions, context)); + } + + /** + * The float64Milliseconds operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response float64MillisecondsWithResponse(double input, RequestOptions requestOptions) { + return service.float64MillisecondsSync(this.client.getEndpoint(), input, requestOptions, Context.NONE); + } + + /** + * The int32SecondsArray operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32SecondsArrayWithResponseAsync(List input, + RequestOptions requestOptions) { + String inputConverted = JacksonAdapter.createDefaultSerializerAdapter() + .serializeIterable( + input.stream().map(paramItemValue -> paramItemValue.getSeconds()).collect(Collectors.toList()), + CollectionFormat.CSV); + return FluxUtil.withContext( + context -> service.int32SecondsArray(this.client.getEndpoint(), inputConverted, requestOptions, context)); + } + + /** + * The int32SecondsArray operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32SecondsArrayWithResponse(List input, RequestOptions requestOptions) { + String inputConverted = JacksonAdapter.createDefaultSerializerAdapter() + .serializeIterable( + input.stream().map(paramItemValue -> paramItemValue.getSeconds()).collect(Collectors.toList()), + CollectionFormat.CSV); + return service.int32SecondsArraySync(this.client.getEndpoint(), inputConverted, requestOptions, Context.NONE); + } + + /** + * The int32MillisecondsArray operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> int32MillisecondsArrayWithResponseAsync(List input, + RequestOptions requestOptions) { + String inputConverted + = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(input, CollectionFormat.CSV); + return FluxUtil.withContext(context -> service.int32MillisecondsArray(this.client.getEndpoint(), inputConverted, + requestOptions, context)); + } + + /** + * The int32MillisecondsArray operation. + * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response int32MillisecondsArrayWithResponse(List input, RequestOptions requestOptions) { + String inputConverted + = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(input, CollectionFormat.CSV); + return service.int32MillisecondsArraySync(this.client.getEndpoint(), inputConverted, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/package-info.java new file mode 100644 index 00000000000..e3346ba84e6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for DurationModel. + * Test for encode decorator on duration. + * + */ +package encode.duration.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/package-info.java new file mode 100644 index 00000000000..6049cecc4ab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for DurationModel. + * Test for encode decorator on duration. + * + */ +package encode.duration; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/DefaultDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/DefaultDurationProperty.java new file mode 100644 index 00000000000..14556802f5c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/DefaultDurationProperty.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; + +/** + * The DefaultDurationProperty model. + */ +@Immutable +public final class DefaultDurationProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final Duration value; + + /** + * Creates an instance of DefaultDurationProperty class. + * + * @param value the value value to set. + */ + @Generated + public DefaultDurationProperty(Duration value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public Duration getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", CoreUtils.durationToStringWithDays(this.value)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DefaultDurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DefaultDurationProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DefaultDurationProperty. + */ + @Generated + public static DefaultDurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Duration value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new DefaultDurationProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64MillisecondsDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64MillisecondsDurationProperty.java new file mode 100644 index 00000000000..5a6aa75879e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64MillisecondsDurationProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Float64MillisecondsDurationProperty model. + */ +@Immutable +public final class Float64MillisecondsDurationProperty + implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final double value; + + /** + * Creates an instance of Float64MillisecondsDurationProperty class. + * + * @param value the value value to set. + */ + @Generated + public Float64MillisecondsDurationProperty(double value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public double getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Float64MillisecondsDurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Float64MillisecondsDurationProperty if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Float64MillisecondsDurationProperty. + */ + @Generated + public static Float64MillisecondsDurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + double value = 0.0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.getDouble(); + } else { + reader.skipChildren(); + } + } + return new Float64MillisecondsDurationProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64SecondsDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64SecondsDurationProperty.java new file mode 100644 index 00000000000..2d54a349a25 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Float64SecondsDurationProperty.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; + +/** + * The Float64SecondsDurationProperty model. + */ +@Immutable +public final class Float64SecondsDurationProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final double value; + + /** + * Creates an instance of Float64SecondsDurationProperty class. + * + * @param value the value value to set. + */ + @Generated + public Float64SecondsDurationProperty(Duration value) { + if (value == null) { + this.value = 0.0; + } else { + this.value = (double) value.toNanos() / 1000_000_000L; + } + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public Duration getValue() { + return Duration.ofNanos((long) (this.value * 1000_000_000L)); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Float64SecondsDurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Float64SecondsDurationProperty if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Float64SecondsDurationProperty. + */ + @Generated + public static Float64SecondsDurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Duration value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = Duration.ofNanos((long) (reader.getDouble() * 1000_000_000L)); + } else { + reader.skipChildren(); + } + } + return new Float64SecondsDurationProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationArrayProperty.java new file mode 100644 index 00000000000..aa77fd209a0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationArrayProperty.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The FloatMillisecondsDurationArrayProperty model. + */ +@Immutable +public final class FloatMillisecondsDurationArrayProperty + implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final List value; + + /** + * Creates an instance of FloatMillisecondsDurationArrayProperty class. + * + * @param value the value value to set. + */ + @Generated + public FloatMillisecondsDurationArrayProperty(List value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeDouble(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FloatMillisecondsDurationArrayProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FloatMillisecondsDurationArrayProperty if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FloatMillisecondsDurationArrayProperty. + */ + @Generated + public static FloatMillisecondsDurationArrayProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.readArray(reader1 -> reader1.getDouble()); + } else { + reader.skipChildren(); + } + } + return new FloatMillisecondsDurationArrayProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationProperty.java new file mode 100644 index 00000000000..d40fbf62e9d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsDurationProperty.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The FloatMillisecondsDurationProperty model. + */ +@Immutable +public final class FloatMillisecondsDurationProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final double value; + + /** + * Creates an instance of FloatMillisecondsDurationProperty class. + * + * @param value the value value to set. + */ + @Generated + public FloatMillisecondsDurationProperty(double value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public double getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FloatMillisecondsDurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FloatMillisecondsDurationProperty if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FloatMillisecondsDurationProperty. + */ + @Generated + public static FloatMillisecondsDurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + double value = 0.0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.getDouble(); + } else { + reader.skipChildren(); + } + } + return new FloatMillisecondsDurationProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsLargerUnitDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsLargerUnitDurationProperty.java new file mode 100644 index 00000000000..e98cf4026c6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatMillisecondsLargerUnitDurationProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The FloatMillisecondsLargerUnitDurationProperty model. + */ +@Immutable +public final class FloatMillisecondsLargerUnitDurationProperty + implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final double value; + + /** + * Creates an instance of FloatMillisecondsLargerUnitDurationProperty class. + * + * @param value the value value to set. + */ + @Generated + public FloatMillisecondsLargerUnitDurationProperty(double value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public double getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FloatMillisecondsLargerUnitDurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FloatMillisecondsLargerUnitDurationProperty if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FloatMillisecondsLargerUnitDurationProperty. + */ + @Generated + public static FloatMillisecondsLargerUnitDurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + double value = 0.0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.getDouble(); + } else { + reader.skipChildren(); + } + } + return new FloatMillisecondsLargerUnitDurationProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationArrayProperty.java new file mode 100644 index 00000000000..1f70094dfa3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationArrayProperty.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; +import java.util.List; + +/** + * The FloatSecondsDurationArrayProperty model. + */ +@Immutable +public final class FloatSecondsDurationArrayProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final List value; + + /** + * Creates an instance of FloatSecondsDurationArrayProperty class. + * + * @param value the value value to set. + */ + @Generated + public FloatSecondsDurationArrayProperty(List value) { + if (value == null) { + this.value = null; + } else { + this.value = value.stream() + .map(el -> (double) el.toNanos() / 1000_000_000L) + .collect(java.util.stream.Collectors.toList()); + } + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public List getValue() { + if (this.value == null) { + return null; + } + return this.value.stream() + .map(el -> Duration.ofNanos((long) (el * 1000_000_000L))) + .collect(java.util.stream.Collectors.toList()); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeDouble(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FloatSecondsDurationArrayProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FloatSecondsDurationArrayProperty if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FloatSecondsDurationArrayProperty. + */ + @Generated + public static FloatSecondsDurationArrayProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.readArray(reader1 -> Duration.ofNanos((long) (reader1.getDouble() * 1000_000_000L))); + } else { + reader.skipChildren(); + } + } + return new FloatSecondsDurationArrayProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationProperty.java new file mode 100644 index 00000000000..126a0b10fba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsDurationProperty.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; + +/** + * The FloatSecondsDurationProperty model. + */ +@Immutable +public final class FloatSecondsDurationProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final double value; + + /** + * Creates an instance of FloatSecondsDurationProperty class. + * + * @param value the value value to set. + */ + @Generated + public FloatSecondsDurationProperty(Duration value) { + if (value == null) { + this.value = 0.0; + } else { + this.value = (double) value.toNanos() / 1000_000_000L; + } + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public Duration getValue() { + return Duration.ofNanos((long) (this.value * 1000_000_000L)); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FloatSecondsDurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FloatSecondsDurationProperty if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FloatSecondsDurationProperty. + */ + @Generated + public static FloatSecondsDurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Duration value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = Duration.ofNanos((long) (reader.getDouble() * 1000_000_000L)); + } else { + reader.skipChildren(); + } + } + return new FloatSecondsDurationProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsLargerUnitDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsLargerUnitDurationProperty.java new file mode 100644 index 00000000000..b8fa54d2e28 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/FloatSecondsLargerUnitDurationProperty.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; + +/** + * The FloatSecondsLargerUnitDurationProperty model. + */ +@Immutable +public final class FloatSecondsLargerUnitDurationProperty + implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final double value; + + /** + * Creates an instance of FloatSecondsLargerUnitDurationProperty class. + * + * @param value the value value to set. + */ + @Generated + public FloatSecondsLargerUnitDurationProperty(Duration value) { + if (value == null) { + this.value = 0.0; + } else { + this.value = (double) value.toNanos() / 1000_000_000L; + } + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public Duration getValue() { + return Duration.ofNanos((long) (this.value * 1000_000_000L)); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FloatSecondsLargerUnitDurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FloatSecondsLargerUnitDurationProperty if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FloatSecondsLargerUnitDurationProperty. + */ + @Generated + public static FloatSecondsLargerUnitDurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Duration value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = Duration.ofNanos((long) (reader.getDouble() * 1000_000_000L)); + } else { + reader.skipChildren(); + } + } + return new FloatSecondsLargerUnitDurationProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/ISO8601DurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/ISO8601DurationProperty.java new file mode 100644 index 00000000000..bcb67d4fc24 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/ISO8601DurationProperty.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; + +/** + * The ISO8601DurationProperty model. + */ +@Immutable +public final class ISO8601DurationProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final Duration value; + + /** + * Creates an instance of ISO8601DurationProperty class. + * + * @param value the value value to set. + */ + @Generated + public ISO8601DurationProperty(Duration value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public Duration getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", CoreUtils.durationToStringWithDays(this.value)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ISO8601DurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ISO8601DurationProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ISO8601DurationProperty. + */ + @Generated + public static ISO8601DurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Duration value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new ISO8601DurationProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsDurationProperty.java new file mode 100644 index 00000000000..d8130c569a7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsDurationProperty.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Int32MillisecondsDurationProperty model. + */ +@Immutable +public final class Int32MillisecondsDurationProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final int value; + + /** + * Creates an instance of Int32MillisecondsDurationProperty class. + * + * @param value the value value to set. + */ + @Generated + public Int32MillisecondsDurationProperty(int value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public int getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Int32MillisecondsDurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Int32MillisecondsDurationProperty if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Int32MillisecondsDurationProperty. + */ + @Generated + public static Int32MillisecondsDurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int value = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new Int32MillisecondsDurationProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsLargerUnitDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsLargerUnitDurationProperty.java new file mode 100644 index 00000000000..9be4f62447d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32MillisecondsLargerUnitDurationProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Int32MillisecondsLargerUnitDurationProperty model. + */ +@Immutable +public final class Int32MillisecondsLargerUnitDurationProperty + implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final int value; + + /** + * Creates an instance of Int32MillisecondsLargerUnitDurationProperty class. + * + * @param value the value value to set. + */ + @Generated + public Int32MillisecondsLargerUnitDurationProperty(int value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public int getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Int32MillisecondsLargerUnitDurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Int32MillisecondsLargerUnitDurationProperty if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Int32MillisecondsLargerUnitDurationProperty. + */ + @Generated + public static Int32MillisecondsLargerUnitDurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int value = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new Int32MillisecondsLargerUnitDurationProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsDurationProperty.java new file mode 100644 index 00000000000..bf634dd3220 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsDurationProperty.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; + +/** + * The Int32SecondsDurationProperty model. + */ +@Immutable +public final class Int32SecondsDurationProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final long value; + + /** + * Creates an instance of Int32SecondsDurationProperty class. + * + * @param value the value value to set. + */ + @Generated + public Int32SecondsDurationProperty(Duration value) { + if (value == null) { + this.value = 0L; + } else { + this.value = value.getSeconds(); + } + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public Duration getValue() { + return Duration.ofSeconds(this.value); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Int32SecondsDurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Int32SecondsDurationProperty if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Int32SecondsDurationProperty. + */ + @Generated + public static Int32SecondsDurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Duration value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = Duration.ofSeconds(reader.getLong()); + } else { + reader.skipChildren(); + } + } + return new Int32SecondsDurationProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsLargerUnitDurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsLargerUnitDurationProperty.java new file mode 100644 index 00000000000..7a1d845ed26 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/Int32SecondsLargerUnitDurationProperty.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; + +/** + * The Int32SecondsLargerUnitDurationProperty model. + */ +@Immutable +public final class Int32SecondsLargerUnitDurationProperty + implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final long value; + + /** + * Creates an instance of Int32SecondsLargerUnitDurationProperty class. + * + * @param value the value value to set. + */ + @Generated + public Int32SecondsLargerUnitDurationProperty(Duration value) { + if (value == null) { + this.value = 0L; + } else { + this.value = value.getSeconds(); + } + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public Duration getValue() { + return Duration.ofSeconds(this.value); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Int32SecondsLargerUnitDurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Int32SecondsLargerUnitDurationProperty if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Int32SecondsLargerUnitDurationProperty. + */ + @Generated + public static Int32SecondsLargerUnitDurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Duration value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = Duration.ofSeconds(reader.getLong()); + } else { + reader.skipChildren(); + } + } + return new Int32SecondsLargerUnitDurationProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/package-info.java new file mode 100644 index 00000000000..217fa3faafc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/duration/property/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for DurationModel. + * Test for encode decorator on duration. + * + */ +package encode.duration.property.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericAsyncClient.java new file mode 100644 index 00000000000..58806522fc6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericAsyncClient.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.numeric; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import encode.numeric.implementation.PropertiesImpl; +import encode.numeric.property.models.SafeintAsStringProperty; +import encode.numeric.property.models.Uint32AsStringProperty; +import encode.numeric.property.models.Uint8AsStringProperty; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous NumericClient type. + */ +@ServiceClient(builder = NumericClientBuilder.class, isAsync = true) +public final class NumericAsyncClient { + @Generated + private final PropertiesImpl serviceClient; + + /** + * Initializes an instance of NumericAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NumericAsyncClient(PropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The safeintAsString operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> safeintAsStringWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.safeintAsStringWithResponseAsync(value, requestOptions); + } + + /** + * The uint32AsStringOptional operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Integer (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Integer (Optional)
+     * }
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uint32AsStringOptionalWithResponse(BinaryData value, + RequestOptions requestOptions) { + return this.serviceClient.uint32AsStringOptionalWithResponseAsync(value, requestOptions); + } + + /** + * The uint8AsString operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uint8AsStringWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.uint8AsStringWithResponseAsync(value, requestOptions); + } + + /** + * The safeintAsString operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono safeintAsString(SafeintAsStringProperty value) { + // Generated convenience method for safeintAsStringWithResponse + RequestOptions requestOptions = new RequestOptions(); + return safeintAsStringWithResponse(BinaryData.fromObject(value), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SafeintAsStringProperty.class)); + } + + /** + * The uint32AsStringOptional operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono uint32AsStringOptional(Uint32AsStringProperty value) { + // Generated convenience method for uint32AsStringOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return uint32AsStringOptionalWithResponse(BinaryData.fromObject(value), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Uint32AsStringProperty.class)); + } + + /** + * The uint8AsString operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono uint8AsString(Uint8AsStringProperty value) { + // Generated convenience method for uint8AsStringWithResponse + RequestOptions requestOptions = new RequestOptions(); + return uint8AsStringWithResponse(BinaryData.fromObject(value), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Uint8AsStringProperty.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClient.java new file mode 100644 index 00000000000..d638911302b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClient.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.numeric; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import encode.numeric.implementation.PropertiesImpl; +import encode.numeric.property.models.SafeintAsStringProperty; +import encode.numeric.property.models.Uint32AsStringProperty; +import encode.numeric.property.models.Uint8AsStringProperty; + +/** + * Initializes a new instance of the synchronous NumericClient type. + */ +@ServiceClient(builder = NumericClientBuilder.class) +public final class NumericClient { + @Generated + private final PropertiesImpl serviceClient; + + /** + * Initializes an instance of NumericClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NumericClient(PropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The safeintAsString operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response safeintAsStringWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.safeintAsStringWithResponse(value, requestOptions); + } + + /** + * The uint32AsStringOptional operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Integer (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Integer (Optional)
+     * }
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uint32AsStringOptionalWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.uint32AsStringOptionalWithResponse(value, requestOptions); + } + + /** + * The uint8AsString operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uint8AsStringWithResponse(BinaryData value, RequestOptions requestOptions) { + return this.serviceClient.uint8AsStringWithResponse(value, requestOptions); + } + + /** + * The safeintAsString operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SafeintAsStringProperty safeintAsString(SafeintAsStringProperty value) { + // Generated convenience method for safeintAsStringWithResponse + RequestOptions requestOptions = new RequestOptions(); + return safeintAsStringWithResponse(BinaryData.fromObject(value), requestOptions).getValue() + .toObject(SafeintAsStringProperty.class); + } + + /** + * The uint32AsStringOptional operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Uint32AsStringProperty uint32AsStringOptional(Uint32AsStringProperty value) { + // Generated convenience method for uint32AsStringOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return uint32AsStringOptionalWithResponse(BinaryData.fromObject(value), requestOptions).getValue() + .toObject(Uint32AsStringProperty.class); + } + + /** + * The uint8AsString operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Uint8AsStringProperty uint8AsString(Uint8AsStringProperty value) { + // Generated convenience method for uint8AsStringWithResponse + RequestOptions requestOptions = new RequestOptions(); + return uint8AsStringWithResponse(BinaryData.fromObject(value), requestOptions).getValue() + .toObject(Uint8AsStringProperty.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClientBuilder.java new file mode 100644 index 00000000000..61fb71387b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/NumericClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.numeric; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import encode.numeric.implementation.NumericClientImpl; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the NumericClient type. + */ +@ServiceClientBuilder(serviceClients = { NumericClient.class, NumericAsyncClient.class }) +public final class NumericClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("encode-numeric.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the NumericClientBuilder. + */ + @Generated + public NumericClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NumericClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NumericClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NumericClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NumericClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NumericClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NumericClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NumericClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NumericClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the NumericClientBuilder. + */ + @Generated + public NumericClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of NumericClientImpl with the provided parameters. + * + * @return an instance of NumericClientImpl. + */ + @Generated + private NumericClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + NumericClientImpl client + = new NumericClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of NumericAsyncClient class. + * + * @return an instance of NumericAsyncClient. + */ + @Generated + public NumericAsyncClient buildAsyncClient() { + return new NumericAsyncClient(buildInnerClient().getProperties()); + } + + /** + * Builds an instance of NumericClient class. + * + * @return an instance of NumericClient. + */ + @Generated + public NumericClient buildClient() { + return new NumericClient(buildInnerClient().getProperties()); + } + + private static final ClientLogger LOGGER = new ClientLogger(NumericClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/NumericClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/NumericClientImpl.java new file mode 100644 index 00000000000..9b015846858 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/NumericClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.numeric.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 NumericClient type. + */ +public final class NumericClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 PropertiesImpl object to access its operations. + */ + private final PropertiesImpl properties; + + /** + * Gets the PropertiesImpl object to access its operations. + * + * @return the PropertiesImpl object. + */ + public PropertiesImpl getProperties() { + return this.properties; + } + + /** + * Initializes an instance of NumericClient client. + * + * @param endpoint Service host. + */ + public NumericClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NumericClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public NumericClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NumericClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public NumericClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.properties = new PropertiesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/PropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/PropertiesImpl.java new file mode 100644 index 00000000000..1a9deca67f3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/PropertiesImpl.java @@ -0,0 +1,351 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.numeric.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Properties. + */ +public final class PropertiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PropertiesService service; + + /** + * The service client containing this operation class. + */ + private final NumericClientImpl client; + + /** + * Initializes an instance of PropertiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PropertiesImpl(NumericClientImpl client) { + this.service + = RestProxy.create(PropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NumericClientProperties to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NumericClientProperties") + public interface PropertiesService { + @Post("/encode/numeric/property/safeint") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> safeintAsString(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData value, RequestOptions requestOptions, Context context); + + @Post("/encode/numeric/property/safeint") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response safeintAsStringSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData value, RequestOptions requestOptions, Context context); + + @Post("/encode/numeric/property/uint32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> uint32AsStringOptional(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData value, RequestOptions requestOptions, Context context); + + @Post("/encode/numeric/property/uint32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response uint32AsStringOptionalSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData value, RequestOptions requestOptions, Context context); + + @Post("/encode/numeric/property/uint8") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> uint8AsString(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData value, RequestOptions requestOptions, Context context); + + @Post("/encode/numeric/property/uint8") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response uint8AsStringSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData value, RequestOptions requestOptions, Context context); + } + + /** + * The safeintAsString operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> safeintAsStringWithResponseAsync(BinaryData value, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.safeintAsString(this.client.getEndpoint(), contentType, accept, + value, requestOptions, context)); + } + + /** + * The safeintAsString operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: long (Required)
+     * }
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response safeintAsStringWithResponse(BinaryData value, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.safeintAsStringSync(this.client.getEndpoint(), contentType, accept, value, requestOptions, + Context.NONE); + } + + /** + * The uint32AsStringOptional operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Integer (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Integer (Optional)
+     * }
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uint32AsStringOptionalWithResponseAsync(BinaryData value, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.uint32AsStringOptional(this.client.getEndpoint(), contentType, + accept, value, requestOptions, context)); + } + + /** + * The uint32AsStringOptional operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Integer (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Integer (Optional)
+     * }
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uint32AsStringOptionalWithResponse(BinaryData value, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.uint32AsStringOptionalSync(this.client.getEndpoint(), contentType, accept, value, requestOptions, + Context.NONE); + } + + /** + * The uint8AsString operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uint8AsStringWithResponseAsync(BinaryData value, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.uint8AsString(this.client.getEndpoint(), contentType, accept, + value, requestOptions, context)); + } + + /** + * The uint8AsString operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: int (Required)
+     * }
+     * }
+     * 
+ * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uint8AsStringWithResponse(BinaryData value, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.uint8AsStringSync(this.client.getEndpoint(), contentType, accept, value, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/package-info.java new file mode 100644 index 00000000000..f0b10d1e8dd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Numeric. + * Test for encode decorator on integer. + * + */ +package encode.numeric.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/package-info.java new file mode 100644 index 00000000000..664e3918b31 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Numeric. + * Test for encode decorator on integer. + * + */ +package encode.numeric; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/SafeintAsStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/SafeintAsStringProperty.java new file mode 100644 index 00000000000..6d4fb40a3cd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/SafeintAsStringProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.numeric.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; + +/** + * The SafeintAsStringProperty model. + */ +@Immutable +public final class SafeintAsStringProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final long value; + + /** + * Creates an instance of SafeintAsStringProperty class. + * + * @param value the value value to set. + */ + @Generated + public SafeintAsStringProperty(long value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public long getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", Objects.toString(this.value, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SafeintAsStringProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SafeintAsStringProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SafeintAsStringProperty. + */ + @Generated + public static SafeintAsStringProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + long value = Long.parseLong("0"); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.getNullable(nonNullReader -> Long.parseLong(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new SafeintAsStringProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint32AsStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint32AsStringProperty.java new file mode 100644 index 00000000000..43358522f7f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint32AsStringProperty.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.numeric.property.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; + +/** + * The Uint32AsStringProperty model. + */ +@Fluent +public final class Uint32AsStringProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private Integer value; + + /** + * Creates an instance of Uint32AsStringProperty class. + */ + @Generated + public Uint32AsStringProperty() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public Integer getValue() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the Uint32AsStringProperty object itself. + */ + @Generated + public Uint32AsStringProperty setValue(Integer value) { + this.value = value; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", Objects.toString(this.value, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Uint32AsStringProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Uint32AsStringProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the Uint32AsStringProperty. + */ + @Generated + public static Uint32AsStringProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Uint32AsStringProperty deserializedUint32AsStringProperty = new Uint32AsStringProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedUint32AsStringProperty.value + = reader.getNullable(nonNullReader -> Integer.parseInt(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUint32AsStringProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint8AsStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint8AsStringProperty.java new file mode 100644 index 00000000000..b5c75a3c428 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/Uint8AsStringProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.numeric.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; + +/** + * The Uint8AsStringProperty model. + */ +@Immutable +public final class Uint8AsStringProperty implements JsonSerializable { + /* + * The value property. + */ + @Generated + private final int value; + + /** + * Creates an instance of Uint8AsStringProperty class. + * + * @param value the value value to set. + */ + @Generated + public Uint8AsStringProperty(int value) { + this.value = value; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public int getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", Objects.toString(this.value, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Uint8AsStringProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Uint8AsStringProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Uint8AsStringProperty. + */ + @Generated + public static Uint8AsStringProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int value = Integer.parseInt("0"); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.getNullable(nonNullReader -> Integer.parseInt(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new Uint8AsStringProperty(value); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/package-info.java new file mode 100644 index 00000000000..0a95848ffdd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/encode/numeric/property/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Numeric. + * Test for encode decorator on integer. + * + */ +package encode.numeric.property.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/BasicClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/BasicClientBuilder.java new file mode 100644 index 00000000000..b0b6265e7d7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/BasicClientBuilder.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.basic; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import parameters.basic.implementation.BasicClientImpl; + +/** + * A builder for creating a new instance of the BasicClient type. + */ +@ServiceClientBuilder( + serviceClients = { + ExplicitBodyClient.class, + ImplicitBodyClient.class, + ExplicitBodyAsyncClient.class, + ImplicitBodyAsyncClient.class }) +public final class BasicClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("parameters-basic.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the BasicClientBuilder. + */ + @Generated + public BasicClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BasicClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the BasicClientBuilder. + */ + @Generated + public BasicClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of BasicClientImpl with the provided parameters. + * + * @return an instance of BasicClientImpl. + */ + @Generated + private BasicClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + BasicClientImpl client + = new BasicClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ExplicitBodyAsyncClient class. + * + * @return an instance of ExplicitBodyAsyncClient. + */ + @Generated + public ExplicitBodyAsyncClient buildExplicitBodyAsyncClient() { + return new ExplicitBodyAsyncClient(buildInnerClient().getExplicitBodies()); + } + + /** + * Builds an instance of ImplicitBodyAsyncClient class. + * + * @return an instance of ImplicitBodyAsyncClient. + */ + @Generated + public ImplicitBodyAsyncClient buildImplicitBodyAsyncClient() { + return new ImplicitBodyAsyncClient(buildInnerClient().getImplicitBodies()); + } + + /** + * Builds an instance of ExplicitBodyClient class. + * + * @return an instance of ExplicitBodyClient. + */ + @Generated + public ExplicitBodyClient buildExplicitBodyClient() { + return new ExplicitBodyClient(buildInnerClient().getExplicitBodies()); + } + + /** + * Builds an instance of ImplicitBodyClient class. + * + * @return an instance of ImplicitBodyClient. + */ + @Generated + public ImplicitBodyClient buildImplicitBodyClient() { + return new ImplicitBodyClient(buildInnerClient().getImplicitBodies()); + } + + private static final ClientLogger LOGGER = new ClientLogger(BasicClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyAsyncClient.java new file mode 100644 index 00000000000..f8239999a49 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyAsyncClient.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.basic; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import parameters.basic.explicitbody.models.User; +import parameters.basic.implementation.ExplicitBodiesImpl; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous BasicClient type. + */ +@ServiceClient(builder = BasicClientBuilder.class, isAsync = true) +public final class ExplicitBodyAsyncClient { + @Generated + private final ExplicitBodiesImpl serviceClient; + + /** + * Initializes an instance of ExplicitBodyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExplicitBodyAsyncClient(ExplicitBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The simple operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> simpleWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.simpleWithResponseAsync(body, requestOptions); + } + + /** + * The simple operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono simple(User body) { + // Generated convenience method for simpleWithResponse + RequestOptions requestOptions = new RequestOptions(); + return simpleWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyClient.java new file mode 100644 index 00000000000..df6d4c01acd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ExplicitBodyClient.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.basic; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import parameters.basic.explicitbody.models.User; +import parameters.basic.implementation.ExplicitBodiesImpl; + +/** + * Initializes a new instance of the synchronous BasicClient type. + */ +@ServiceClient(builder = BasicClientBuilder.class) +public final class ExplicitBodyClient { + @Generated + private final ExplicitBodiesImpl serviceClient; + + /** + * Initializes an instance of ExplicitBodyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExplicitBodyClient(ExplicitBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The simple operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response simpleWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.simpleWithResponse(body, requestOptions); + } + + /** + * The simple operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void simple(User body) { + // Generated convenience method for simpleWithResponse + RequestOptions requestOptions = new RequestOptions(); + simpleWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyAsyncClient.java new file mode 100644 index 00000000000..7f4027747cd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyAsyncClient.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.basic; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import parameters.basic.implementation.ImplicitBodiesImpl; +import parameters.basic.implicitbody.implementation.models.SimpleRequest; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous BasicClient type. + */ +@ServiceClient(builder = BasicClientBuilder.class, isAsync = true) +public final class ImplicitBodyAsyncClient { + @Generated + private final ImplicitBodiesImpl serviceClient; + + /** + * Initializes an instance of ImplicitBodyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ImplicitBodyAsyncClient(ImplicitBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The simple operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param simpleRequest The simpleRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> simpleWithResponse(BinaryData simpleRequest, RequestOptions requestOptions) { + return this.serviceClient.simpleWithResponseAsync(simpleRequest, requestOptions); + } + + /** + * The simple operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono simple(String name) { + // Generated convenience method for simpleWithResponse + RequestOptions requestOptions = new RequestOptions(); + SimpleRequest simpleRequestObj = new SimpleRequest(name); + BinaryData simpleRequest = BinaryData.fromObject(simpleRequestObj); + return simpleWithResponse(simpleRequest, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyClient.java new file mode 100644 index 00000000000..708f82e2677 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/ImplicitBodyClient.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.basic; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import parameters.basic.implementation.ImplicitBodiesImpl; +import parameters.basic.implicitbody.implementation.models.SimpleRequest; + +/** + * Initializes a new instance of the synchronous BasicClient type. + */ +@ServiceClient(builder = BasicClientBuilder.class) +public final class ImplicitBodyClient { + @Generated + private final ImplicitBodiesImpl serviceClient; + + /** + * Initializes an instance of ImplicitBodyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ImplicitBodyClient(ImplicitBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The simple operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param simpleRequest The simpleRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response simpleWithResponse(BinaryData simpleRequest, RequestOptions requestOptions) { + return this.serviceClient.simpleWithResponse(simpleRequest, requestOptions); + } + + /** + * The simple operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void simple(String name) { + // Generated convenience method for simpleWithResponse + RequestOptions requestOptions = new RequestOptions(); + SimpleRequest simpleRequestObj = new SimpleRequest(name); + BinaryData simpleRequest = BinaryData.fromObject(simpleRequestObj); + simpleWithResponse(simpleRequest, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/User.java new file mode 100644 index 00000000000..0f755168c08 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/User.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.basic.explicitbody.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is a simple model. + */ +@Immutable +public final class User implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of User class. + * + * @param name the name value to set. + */ + @Generated + public User(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of User from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the User. + */ + @Generated + public static User fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new User(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/package-info.java new file mode 100644 index 00000000000..c8e323e193d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/explicitbody/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Basic. + * Test for basic parameters cases. + * + */ +package parameters.basic.explicitbody.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/BasicClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/BasicClientImpl.java new file mode 100644 index 00000000000..3132582eceb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/BasicClientImpl.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.basic.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 BasicClient type. + */ +public final class BasicClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 ExplicitBodiesImpl object to access its operations. + */ + private final ExplicitBodiesImpl explicitBodies; + + /** + * Gets the ExplicitBodiesImpl object to access its operations. + * + * @return the ExplicitBodiesImpl object. + */ + public ExplicitBodiesImpl getExplicitBodies() { + return this.explicitBodies; + } + + /** + * The ImplicitBodiesImpl object to access its operations. + */ + private final ImplicitBodiesImpl implicitBodies; + + /** + * Gets the ImplicitBodiesImpl object to access its operations. + * + * @return the ImplicitBodiesImpl object. + */ + public ImplicitBodiesImpl getImplicitBodies() { + return this.implicitBodies; + } + + /** + * Initializes an instance of BasicClient client. + * + * @param endpoint Service host. + */ + public BasicClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of BasicClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public BasicClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of BasicClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public BasicClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.explicitBodies = new ExplicitBodiesImpl(this); + this.implicitBodies = new ImplicitBodiesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ExplicitBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ExplicitBodiesImpl.java new file mode 100644 index 00000000000..666397dfd25 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ExplicitBodiesImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.basic.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExplicitBodies. + */ +public final class ExplicitBodiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExplicitBodiesService service; + + /** + * The service client containing this operation class. + */ + private final BasicClientImpl client; + + /** + * Initializes an instance of ExplicitBodiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExplicitBodiesImpl(BasicClientImpl client) { + this.service + = RestProxy.create(ExplicitBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BasicClientExplicitBodies to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "BasicClientExplicitBodies") + public interface ExplicitBodiesService { + @Put("/parameters/basic/explicit-body/simple") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> simple(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/parameters/basic/explicit-body/simple") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response simpleSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The simple operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> simpleWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.simple(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The simple operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response simpleWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.simpleSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ImplicitBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ImplicitBodiesImpl.java new file mode 100644 index 00000000000..d430931c609 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/ImplicitBodiesImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.basic.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ImplicitBodies. + */ +public final class ImplicitBodiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ImplicitBodiesService service; + + /** + * The service client containing this operation class. + */ + private final BasicClientImpl client; + + /** + * Initializes an instance of ImplicitBodiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ImplicitBodiesImpl(BasicClientImpl client) { + this.service + = RestProxy.create(ImplicitBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BasicClientImplicitBodies to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "BasicClientImplicitBodies") + public interface ImplicitBodiesService { + @Put("/parameters/basic/implicit-body/simple") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> simple(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData simpleRequest, + RequestOptions requestOptions, Context context); + + @Put("/parameters/basic/implicit-body/simple") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response simpleSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData simpleRequest, + RequestOptions requestOptions, Context context); + } + + /** + * The simple operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param simpleRequest The simpleRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> simpleWithResponseAsync(BinaryData simpleRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.simple(this.client.getEndpoint(), contentType, simpleRequest, requestOptions, context)); + } + + /** + * The simple operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param simpleRequest The simpleRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response simpleWithResponse(BinaryData simpleRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.simpleSync(this.client.getEndpoint(), contentType, simpleRequest, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/package-info.java new file mode 100644 index 00000000000..5c8e5833b57 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Basic. + * Test for basic parameters cases. + * + */ +package parameters.basic.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/SimpleRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/SimpleRequest.java new file mode 100644 index 00000000000..26eee898576 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/SimpleRequest.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.basic.implicitbody.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SimpleRequest model. + */ +@Immutable +public final class SimpleRequest implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of SimpleRequest class. + * + * @param name the name value to set. + */ + @Generated + public SimpleRequest(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SimpleRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SimpleRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SimpleRequest. + */ + @Generated + public static SimpleRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new SimpleRequest(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/package-info.java new file mode 100644 index 00000000000..401952b9be3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/implicitbody/implementation/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Basic. + * Test for basic parameters cases. + * + */ +package parameters.basic.implicitbody.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/package-info.java new file mode 100644 index 00000000000..085d9c7406a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/basic/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Basic. + * Test for basic parameters cases. + * + */ +package parameters.basic; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityAsyncClient.java new file mode 100644 index 00000000000..be91fc8ce6d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityAsyncClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.bodyoptionality; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import parameters.bodyoptionality.implementation.BodyOptionalityClientImpl; +import parameters.bodyoptionality.models.BodyModel; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous BodyOptionalityClient type. + */ +@ServiceClient(builder = BodyOptionalityClientBuilder.class, isAsync = true) +public final class BodyOptionalityAsyncClient { + @Generated + private final BodyOptionalityClientImpl serviceClient; + + /** + * Initializes an instance of BodyOptionalityAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BodyOptionalityAsyncClient(BodyOptionalityClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The requiredExplicit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requiredExplicitWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.requiredExplicitWithResponseAsync(body, requestOptions); + } + + /** + * The requiredImplicit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyModel The bodyModel parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requiredImplicitWithResponse(BinaryData bodyModel, RequestOptions requestOptions) { + return this.serviceClient.requiredImplicitWithResponseAsync(bodyModel, requestOptions); + } + + /** + * The requiredExplicit operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono requiredExplicit(BodyModel body) { + // Generated convenience method for requiredExplicitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return requiredExplicitWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The requiredImplicit operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono requiredImplicit(String name) { + // Generated convenience method for requiredImplicitWithResponse + RequestOptions requestOptions = new RequestOptions(); + BodyModel bodyModelObj = new BodyModel(name); + BinaryData bodyModel = BinaryData.fromObject(bodyModelObj); + return requiredImplicitWithResponse(bodyModel, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClient.java new file mode 100644 index 00000000000..139e335bff1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.bodyoptionality; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import parameters.bodyoptionality.implementation.BodyOptionalityClientImpl; +import parameters.bodyoptionality.models.BodyModel; + +/** + * Initializes a new instance of the synchronous BodyOptionalityClient type. + */ +@ServiceClient(builder = BodyOptionalityClientBuilder.class) +public final class BodyOptionalityClient { + @Generated + private final BodyOptionalityClientImpl serviceClient; + + /** + * Initializes an instance of BodyOptionalityClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BodyOptionalityClient(BodyOptionalityClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The requiredExplicit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requiredExplicitWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.requiredExplicitWithResponse(body, requestOptions); + } + + /** + * The requiredImplicit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyModel The bodyModel parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requiredImplicitWithResponse(BinaryData bodyModel, RequestOptions requestOptions) { + return this.serviceClient.requiredImplicitWithResponse(bodyModel, requestOptions); + } + + /** + * The requiredExplicit operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void requiredExplicit(BodyModel body) { + // Generated convenience method for requiredExplicitWithResponse + RequestOptions requestOptions = new RequestOptions(); + requiredExplicitWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The requiredImplicit operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void requiredImplicit(String name) { + // Generated convenience method for requiredImplicitWithResponse + RequestOptions requestOptions = new RequestOptions(); + BodyModel bodyModelObj = new BodyModel(name); + BinaryData bodyModel = BinaryData.fromObject(bodyModelObj); + requiredImplicitWithResponse(bodyModel, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClientBuilder.java new file mode 100644 index 00000000000..0dec95c2bc3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/BodyOptionalityClientBuilder.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.bodyoptionality; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import parameters.bodyoptionality.implementation.BodyOptionalityClientImpl; + +/** + * A builder for creating a new instance of the BodyOptionalityClient type. + */ +@ServiceClientBuilder( + serviceClients = { + BodyOptionalityClient.class, + OptionalExplicitClient.class, + BodyOptionalityAsyncClient.class, + OptionalExplicitAsyncClient.class }) +public final class BodyOptionalityClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("parameters-bodyoptionality.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the BodyOptionalityClientBuilder. + */ + @Generated + public BodyOptionalityClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BodyOptionalityClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BodyOptionalityClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BodyOptionalityClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BodyOptionalityClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BodyOptionalityClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BodyOptionalityClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BodyOptionalityClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BodyOptionalityClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the BodyOptionalityClientBuilder. + */ + @Generated + public BodyOptionalityClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of BodyOptionalityClientImpl with the provided parameters. + * + * @return an instance of BodyOptionalityClientImpl. + */ + @Generated + private BodyOptionalityClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + BodyOptionalityClientImpl client = new BodyOptionalityClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of BodyOptionalityAsyncClient class. + * + * @return an instance of BodyOptionalityAsyncClient. + */ + @Generated + public BodyOptionalityAsyncClient buildAsyncClient() { + return new BodyOptionalityAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of OptionalExplicitAsyncClient class. + * + * @return an instance of OptionalExplicitAsyncClient. + */ + @Generated + public OptionalExplicitAsyncClient buildOptionalExplicitAsyncClient() { + return new OptionalExplicitAsyncClient(buildInnerClient().getOptionalExplicits()); + } + + /** + * Builds an instance of BodyOptionalityClient class. + * + * @return an instance of BodyOptionalityClient. + */ + @Generated + public BodyOptionalityClient buildClient() { + return new BodyOptionalityClient(buildInnerClient()); + } + + /** + * Builds an instance of OptionalExplicitClient class. + * + * @return an instance of OptionalExplicitClient. + */ + @Generated + public OptionalExplicitClient buildOptionalExplicitClient() { + return new OptionalExplicitClient(buildInnerClient().getOptionalExplicits()); + } + + private static final ClientLogger LOGGER = new ClientLogger(BodyOptionalityClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitAsyncClient.java new file mode 100644 index 00000000000..8bf61894c95 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitAsyncClient.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.bodyoptionality; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import parameters.bodyoptionality.implementation.OptionalExplicitsImpl; +import parameters.bodyoptionality.models.BodyModel; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous BodyOptionalityClient type. + */ +@ServiceClient(builder = BodyOptionalityClientBuilder.class, isAsync = true) +public final class OptionalExplicitAsyncClient { + @Generated + private final OptionalExplicitsImpl serviceClient; + + /** + * Initializes an instance of OptionalExplicitAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + OptionalExplicitAsyncClient(OptionalExplicitsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The set operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setWithResponse(RequestOptions requestOptions) { + return this.serviceClient.setWithResponseAsync(requestOptions); + } + + /** + * The omit operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> omitWithResponse(RequestOptions requestOptions) { + return this.serviceClient.omitWithResponseAsync(requestOptions); + } + + /** + * The set operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono set(BodyModel body) { + // Generated convenience method for setWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (body != null) { + requestOptions.setBody(BinaryData.fromObject(body)); + } + return setWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The set operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono set() { + // Generated convenience method for setWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The omit operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono omit(BodyModel body) { + // Generated convenience method for omitWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (body != null) { + requestOptions.setBody(BinaryData.fromObject(body)); + } + return omitWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The omit operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono omit() { + // Generated convenience method for omitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return omitWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitClient.java new file mode 100644 index 00000000000..b6d71686573 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/OptionalExplicitClient.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.bodyoptionality; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import parameters.bodyoptionality.implementation.OptionalExplicitsImpl; +import parameters.bodyoptionality.models.BodyModel; + +/** + * Initializes a new instance of the synchronous BodyOptionalityClient type. + */ +@ServiceClient(builder = BodyOptionalityClientBuilder.class) +public final class OptionalExplicitClient { + @Generated + private final OptionalExplicitsImpl serviceClient; + + /** + * Initializes an instance of OptionalExplicitClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + OptionalExplicitClient(OptionalExplicitsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The set operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setWithResponse(RequestOptions requestOptions) { + return this.serviceClient.setWithResponse(requestOptions); + } + + /** + * The omit operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response omitWithResponse(RequestOptions requestOptions) { + return this.serviceClient.omitWithResponse(requestOptions); + } + + /** + * The set operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void set(BodyModel body) { + // Generated convenience method for setWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (body != null) { + requestOptions.setBody(BinaryData.fromObject(body)); + } + setWithResponse(requestOptions).getValue(); + } + + /** + * The set operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void set() { + // Generated convenience method for setWithResponse + RequestOptions requestOptions = new RequestOptions(); + setWithResponse(requestOptions).getValue(); + } + + /** + * The omit operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void omit(BodyModel body) { + // Generated convenience method for omitWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (body != null) { + requestOptions.setBody(BinaryData.fromObject(body)); + } + omitWithResponse(requestOptions).getValue(); + } + + /** + * The omit operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void omit() { + // Generated convenience method for omitWithResponse + RequestOptions requestOptions = new RequestOptions(); + omitWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java new file mode 100644 index 00000000000..0056f1e1593 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.bodyoptionality.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the BodyOptionalityClient type. + */ +public final class BodyOptionalityClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BodyOptionalityClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 OptionalExplicitsImpl object to access its operations. + */ + private final OptionalExplicitsImpl optionalExplicits; + + /** + * Gets the OptionalExplicitsImpl object to access its operations. + * + * @return the OptionalExplicitsImpl object. + */ + public OptionalExplicitsImpl getOptionalExplicits() { + return this.optionalExplicits; + } + + /** + * Initializes an instance of BodyOptionalityClient client. + * + * @param endpoint Service host. + */ + public BodyOptionalityClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of BodyOptionalityClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public BodyOptionalityClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of BodyOptionalityClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public BodyOptionalityClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.optionalExplicits = new OptionalExplicitsImpl(this); + this.service + = RestProxy.create(BodyOptionalityClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for BodyOptionalityClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "BodyOptionalityClient") + public interface BodyOptionalityClientService { + @Post("/parameters/body-optionality/required-explicit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> requiredExplicit(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/parameters/body-optionality/required-explicit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response requiredExplicitSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/parameters/body-optionality/required-implicit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> requiredImplicit(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData bodyModel, + RequestOptions requestOptions, Context context); + + @Post("/parameters/body-optionality/required-implicit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response requiredImplicitSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData bodyModel, + RequestOptions requestOptions, Context context); + } + + /** + * The requiredExplicit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requiredExplicitWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.requiredExplicit(this.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The requiredExplicit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requiredExplicitWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.requiredExplicitSync(this.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The requiredImplicit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyModel The bodyModel parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requiredImplicitWithResponseAsync(BinaryData bodyModel, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.requiredImplicit(this.getEndpoint(), contentType, bodyModel, requestOptions, context)); + } + + /** + * The requiredImplicit operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyModel The bodyModel parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requiredImplicitWithResponse(BinaryData bodyModel, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.requiredImplicitSync(this.getEndpoint(), contentType, bodyModel, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/OptionalExplicitsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/OptionalExplicitsImpl.java new file mode 100644 index 00000000000..4dc7b914048 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/OptionalExplicitsImpl.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.bodyoptionality.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OptionalExplicits. + */ +public final class OptionalExplicitsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final OptionalExplicitsService service; + + /** + * The service client containing this operation class. + */ + private final BodyOptionalityClientImpl client; + + /** + * Initializes an instance of OptionalExplicitsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OptionalExplicitsImpl(BodyOptionalityClientImpl client) { + this.service + = RestProxy.create(OptionalExplicitsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BodyOptionalityClientOptionalExplicits to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "BodyOptionalityClientOptionalExplicits") + public interface OptionalExplicitsService { + @Post("/parameters/body-optionality/optional-explicit/set") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> set(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Post("/parameters/body-optionality/optional-explicit/set") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Post("/parameters/body-optionality/optional-explicit/omit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> omit(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Post("/parameters/body-optionality/optional-explicit/omit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response omitSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + } + + /** + * The set operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setWithResponseAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); + } + }); + return FluxUtil.withContext(context -> service.set(this.client.getEndpoint(), requestOptionsLocal, context)); + } + + /** + * The set operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setWithResponse(RequestOptions requestOptions) { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); + } + }); + return service.setSync(this.client.getEndpoint(), requestOptionsLocal, Context.NONE); + } + + /** + * The omit operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> omitWithResponseAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); + } + }); + return FluxUtil.withContext(context -> service.omit(this.client.getEndpoint(), requestOptionsLocal, context)); + } + + /** + * The omit operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response omitWithResponse(RequestOptions requestOptions) { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); + } + }); + return service.omitSync(this.client.getEndpoint(), requestOptionsLocal, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/package-info.java new file mode 100644 index 00000000000..a5254dbefb8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for BodyOptionality. + * Test describing optionality of the request body. + * + */ +package parameters.bodyoptionality.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/BodyModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/BodyModel.java new file mode 100644 index 00000000000..cfc53f4ecaa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/BodyModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.bodyoptionality.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The BodyModel model. + */ +@Immutable +public final class BodyModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of BodyModel class. + * + * @param name the name value to set. + */ + @Generated + public BodyModel(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BodyModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BodyModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BodyModel. + */ + @Generated + public static BodyModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new BodyModel(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/package-info.java new file mode 100644 index 00000000000..fa8e9c44b08 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for BodyOptionality. + * Test describing optionality of the request body. + * + */ +package parameters.bodyoptionality.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/package-info.java new file mode 100644 index 00000000000..3bc50e2d87b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/bodyoptionality/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for BodyOptionality. + * Test describing optionality of the request body. + * + */ +package parameters.bodyoptionality; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/CollectionFormatClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/CollectionFormatClientBuilder.java new file mode 100644 index 00000000000..80b3fe0da27 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/CollectionFormatClientBuilder.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.collectionformat; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import parameters.collectionformat.implementation.CollectionFormatClientImpl; + +/** + * A builder for creating a new instance of the CollectionFormatClient type. + */ +@ServiceClientBuilder( + serviceClients = { QueryClient.class, HeaderClient.class, QueryAsyncClient.class, HeaderAsyncClient.class }) +public final class CollectionFormatClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("parameters-collectionformat.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the CollectionFormatClientBuilder. + */ + @Generated + public CollectionFormatClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CollectionFormatClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CollectionFormatClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CollectionFormatClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CollectionFormatClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CollectionFormatClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CollectionFormatClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CollectionFormatClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CollectionFormatClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the CollectionFormatClientBuilder. + */ + @Generated + public CollectionFormatClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of CollectionFormatClientImpl with the provided parameters. + * + * @return an instance of CollectionFormatClientImpl. + */ + @Generated + private CollectionFormatClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + CollectionFormatClientImpl client = new CollectionFormatClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of QueryAsyncClient class. + * + * @return an instance of QueryAsyncClient. + */ + @Generated + public QueryAsyncClient buildQueryAsyncClient() { + return new QueryAsyncClient(buildInnerClient().getQueries()); + } + + /** + * Builds an instance of HeaderAsyncClient class. + * + * @return an instance of HeaderAsyncClient. + */ + @Generated + public HeaderAsyncClient buildHeaderAsyncClient() { + return new HeaderAsyncClient(buildInnerClient().getHeaders()); + } + + /** + * Builds an instance of QueryClient class. + * + * @return an instance of QueryClient. + */ + @Generated + public QueryClient buildQueryClient() { + return new QueryClient(buildInnerClient().getQueries()); + } + + /** + * Builds an instance of HeaderClient class. + * + * @return an instance of HeaderClient. + */ + @Generated + public HeaderClient buildHeaderClient() { + return new HeaderClient(buildInnerClient().getHeaders()); + } + + private static final ClientLogger LOGGER = new ClientLogger(CollectionFormatClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderAsyncClient.java new file mode 100644 index 00000000000..2447f2dc199 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderAsyncClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.collectionformat; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import parameters.collectionformat.implementation.HeadersImpl; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous CollectionFormatClient type. + */ +@ServiceClient(builder = CollectionFormatClientBuilder.class, isAsync = true) +public final class HeaderAsyncClient { + @Generated + private final HeadersImpl serviceClient; + + /** + * Initializes an instance of HeaderAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + HeaderAsyncClient(HeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The csv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> csvWithResponse(List colors, RequestOptions requestOptions) { + return this.serviceClient.csvWithResponseAsync(colors, requestOptions); + } + + /** + * The csv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono csv(List colors) { + // Generated convenience method for csvWithResponse + RequestOptions requestOptions = new RequestOptions(); + return csvWithResponse(colors, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderClient.java new file mode 100644 index 00000000000..2507a34950c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/HeaderClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.collectionformat; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import parameters.collectionformat.implementation.HeadersImpl; + +/** + * Initializes a new instance of the synchronous CollectionFormatClient type. + */ +@ServiceClient(builder = CollectionFormatClientBuilder.class) +public final class HeaderClient { + @Generated + private final HeadersImpl serviceClient; + + /** + * Initializes an instance of HeaderClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + HeaderClient(HeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The csv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response csvWithResponse(List colors, RequestOptions requestOptions) { + return this.serviceClient.csvWithResponse(colors, requestOptions); + } + + /** + * The csv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void csv(List colors) { + // Generated convenience method for csvWithResponse + RequestOptions requestOptions = new RequestOptions(); + csvWithResponse(colors, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryAsyncClient.java new file mode 100644 index 00000000000..4eb4259fac8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryAsyncClient.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.collectionformat; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import parameters.collectionformat.implementation.QueriesImpl; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous CollectionFormatClient type. + */ +@ServiceClient(builder = CollectionFormatClientBuilder.class, isAsync = true) +public final class QueryAsyncClient { + @Generated + private final QueriesImpl serviceClient; + + /** + * Initializes an instance of QueryAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryAsyncClient(QueriesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The multi operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> multiWithResponse(List colors, RequestOptions requestOptions) { + return this.serviceClient.multiWithResponseAsync(colors, requestOptions); + } + + /** + * The ssv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> ssvWithResponse(List colors, RequestOptions requestOptions) { + return this.serviceClient.ssvWithResponseAsync(colors, requestOptions); + } + + /** + * The pipes operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> pipesWithResponse(List colors, RequestOptions requestOptions) { + return this.serviceClient.pipesWithResponseAsync(colors, requestOptions); + } + + /** + * The csv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> csvWithResponse(List colors, RequestOptions requestOptions) { + return this.serviceClient.csvWithResponseAsync(colors, requestOptions); + } + + /** + * The multi operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono multi(List colors) { + // Generated convenience method for multiWithResponse + RequestOptions requestOptions = new RequestOptions(); + return multiWithResponse(colors, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The ssv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono ssv(List colors) { + // Generated convenience method for ssvWithResponse + RequestOptions requestOptions = new RequestOptions(); + return ssvWithResponse(colors, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The pipes operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono pipes(List colors) { + // Generated convenience method for pipesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return pipesWithResponse(colors, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The csv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono csv(List colors) { + // Generated convenience method for csvWithResponse + RequestOptions requestOptions = new RequestOptions(); + return csvWithResponse(colors, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryClient.java new file mode 100644 index 00000000000..925a32165c5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/QueryClient.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.collectionformat; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import parameters.collectionformat.implementation.QueriesImpl; + +/** + * Initializes a new instance of the synchronous CollectionFormatClient type. + */ +@ServiceClient(builder = CollectionFormatClientBuilder.class) +public final class QueryClient { + @Generated + private final QueriesImpl serviceClient; + + /** + * Initializes an instance of QueryClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryClient(QueriesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The multi operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response multiWithResponse(List colors, RequestOptions requestOptions) { + return this.serviceClient.multiWithResponse(colors, requestOptions); + } + + /** + * The ssv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response ssvWithResponse(List colors, RequestOptions requestOptions) { + return this.serviceClient.ssvWithResponse(colors, requestOptions); + } + + /** + * The pipes operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response pipesWithResponse(List colors, RequestOptions requestOptions) { + return this.serviceClient.pipesWithResponse(colors, requestOptions); + } + + /** + * The csv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response csvWithResponse(List colors, RequestOptions requestOptions) { + return this.serviceClient.csvWithResponse(colors, requestOptions); + } + + /** + * The multi operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void multi(List colors) { + // Generated convenience method for multiWithResponse + RequestOptions requestOptions = new RequestOptions(); + multiWithResponse(colors, requestOptions).getValue(); + } + + /** + * The ssv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void ssv(List colors) { + // Generated convenience method for ssvWithResponse + RequestOptions requestOptions = new RequestOptions(); + ssvWithResponse(colors, requestOptions).getValue(); + } + + /** + * The pipes operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void pipes(List colors) { + // Generated convenience method for pipesWithResponse + RequestOptions requestOptions = new RequestOptions(); + pipesWithResponse(colors, requestOptions).getValue(); + } + + /** + * The csv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void csv(List colors) { + // Generated convenience method for csvWithResponse + RequestOptions requestOptions = new RequestOptions(); + csvWithResponse(colors, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java new file mode 100644 index 00000000000..42dc0bc723f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.collectionformat.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 CollectionFormatClient type. + */ +public final class CollectionFormatClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 QueriesImpl object to access its operations. + */ + private final QueriesImpl queries; + + /** + * Gets the QueriesImpl object to access its operations. + * + * @return the QueriesImpl object. + */ + public QueriesImpl getQueries() { + return this.queries; + } + + /** + * The HeadersImpl object to access its operations. + */ + private final HeadersImpl headers; + + /** + * Gets the HeadersImpl object to access its operations. + * + * @return the HeadersImpl object. + */ + public HeadersImpl getHeaders() { + return this.headers; + } + + /** + * Initializes an instance of CollectionFormatClient client. + * + * @param endpoint Service host. + */ + public CollectionFormatClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of CollectionFormatClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public CollectionFormatClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of CollectionFormatClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public CollectionFormatClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.queries = new QueriesImpl(this); + this.headers = new HeadersImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/HeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/HeadersImpl.java new file mode 100644 index 00000000000..551bfe38fa7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/HeadersImpl.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.collectionformat.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Headers. + */ +public final class HeadersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final HeadersService service; + + /** + * The service client containing this operation class. + */ + private final CollectionFormatClientImpl client; + + /** + * Initializes an instance of HeadersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HeadersImpl(CollectionFormatClientImpl client) { + this.service = RestProxy.create(HeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CollectionFormatClientHeaders to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CollectionFormatClientHeaders") + public interface HeadersService { + @Get("/parameters/collection-format/header/csv") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> csv(@HostParam("endpoint") String endpoint, @HeaderParam("colors") String colors, + RequestOptions requestOptions, Context context); + + @Get("/parameters/collection-format/header/csv") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response csvSync(@HostParam("endpoint") String endpoint, @HeaderParam("colors") String colors, + RequestOptions requestOptions, Context context); + } + + /** + * The csv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> csvWithResponseAsync(List colors, RequestOptions requestOptions) { + String colorsConverted = colors.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .withContext(context -> service.csv(this.client.getEndpoint(), colorsConverted, requestOptions, context)); + } + + /** + * The csv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response csvWithResponse(List colors, RequestOptions requestOptions) { + String colorsConverted = colors.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.csvSync(this.client.getEndpoint(), colorsConverted, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/QueriesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/QueriesImpl.java new file mode 100644 index 00000000000..3d0b78de9b3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/QueriesImpl.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.collectionformat.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Queries. + */ +public final class QueriesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final QueriesService service; + + /** + * The service client containing this operation class. + */ + private final CollectionFormatClientImpl client; + + /** + * Initializes an instance of QueriesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueriesImpl(CollectionFormatClientImpl client) { + this.service = RestProxy.create(QueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CollectionFormatClientQueries to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CollectionFormatClientQueries") + public interface QueriesService { + @Get("/parameters/collection-format/query/multi") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> multi(@HostParam("endpoint") String endpoint, + @QueryParam(value = "colors", multipleQueryParams = true) List colors, + RequestOptions requestOptions, Context context); + + @Get("/parameters/collection-format/query/multi") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response multiSync(@HostParam("endpoint") String endpoint, + @QueryParam(value = "colors", multipleQueryParams = true) List colors, + RequestOptions requestOptions, Context context); + + @Get("/parameters/collection-format/query/ssv") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> ssv(@HostParam("endpoint") String endpoint, @QueryParam("colors") String colors, + RequestOptions requestOptions, Context context); + + @Get("/parameters/collection-format/query/ssv") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response ssvSync(@HostParam("endpoint") String endpoint, @QueryParam("colors") String colors, + RequestOptions requestOptions, Context context); + + @Get("/parameters/collection-format/query/pipes") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> pipes(@HostParam("endpoint") String endpoint, @QueryParam("colors") String colors, + RequestOptions requestOptions, Context context); + + @Get("/parameters/collection-format/query/pipes") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response pipesSync(@HostParam("endpoint") String endpoint, @QueryParam("colors") String colors, + RequestOptions requestOptions, Context context); + + @Get("/parameters/collection-format/query/csv") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> csv(@HostParam("endpoint") String endpoint, @QueryParam("colors") String colors, + RequestOptions requestOptions, Context context); + + @Get("/parameters/collection-format/query/csv") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response csvSync(@HostParam("endpoint") String endpoint, @QueryParam("colors") String colors, + RequestOptions requestOptions, Context context); + } + + /** + * The multi operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> multiWithResponseAsync(List colors, RequestOptions requestOptions) { + List colorsConverted + = colors.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return FluxUtil + .withContext(context -> service.multi(this.client.getEndpoint(), colorsConverted, requestOptions, context)); + } + + /** + * The multi operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response multiWithResponse(List colors, RequestOptions requestOptions) { + List colorsConverted + = colors.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return service.multiSync(this.client.getEndpoint(), colorsConverted, requestOptions, Context.NONE); + } + + /** + * The ssv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> ssvWithResponseAsync(List colors, RequestOptions requestOptions) { + String colorsConverted = colors.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(" ")); + return FluxUtil + .withContext(context -> service.ssv(this.client.getEndpoint(), colorsConverted, requestOptions, context)); + } + + /** + * The ssv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response ssvWithResponse(List colors, RequestOptions requestOptions) { + String colorsConverted = colors.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(" ")); + return service.ssvSync(this.client.getEndpoint(), colorsConverted, requestOptions, Context.NONE); + } + + /** + * The pipes operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> pipesWithResponseAsync(List colors, RequestOptions requestOptions) { + String colorsConverted = colors.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining("|")); + return FluxUtil + .withContext(context -> service.pipes(this.client.getEndpoint(), colorsConverted, requestOptions, context)); + } + + /** + * The pipes operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response pipesWithResponse(List colors, RequestOptions requestOptions) { + String colorsConverted = colors.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining("|")); + return service.pipesSync(this.client.getEndpoint(), colorsConverted, requestOptions, Context.NONE); + } + + /** + * The csv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> csvWithResponseAsync(List colors, RequestOptions requestOptions) { + String colorsConverted = colors.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .withContext(context -> service.csv(this.client.getEndpoint(), colorsConverted, requestOptions, context)); + } + + /** + * The csv operation. + * + * @param colors Possible values for colors are [blue,red,green]. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response csvWithResponse(List colors, RequestOptions requestOptions) { + String colorsConverted = colors.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.csvSync(this.client.getEndpoint(), colorsConverted, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/package-info.java new file mode 100644 index 00000000000..b3a377ad6cb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for CollectionFormat. + * Test for collectionFormat. + * + */ +package parameters.collectionformat.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/package-info.java new file mode 100644 index 00000000000..eab6990f5d3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/collectionformat/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for CollectionFormat. + * Test for collectionFormat. + * + */ +package parameters.collectionformat; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathAsyncClient.java new file mode 100644 index 00000000000..d29c64e0b8d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathAsyncClient.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.path; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import parameters.path.implementation.PathClientImpl; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous PathClient type. + */ +@ServiceClient(builder = PathClientBuilder.class, isAsync = true) +public final class PathAsyncClient { + @Generated + private final PathClientImpl serviceClient; + + /** + * Initializes an instance of PathAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathAsyncClient(PathClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The normal operation. + * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> normalWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.normalWithResponseAsync(name, requestOptions); + } + + /** + * The optional operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> optionalWithResponse(RequestOptions requestOptions) { + return this.serviceClient.optionalWithResponseAsync(requestOptions); + } + + /** + * The normal operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono normal(String name) { + // Generated convenience method for normalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return normalWithResponse(name, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The optional operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono optional(String name) { + // Generated convenience method for optionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return optionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The optional operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono optional() { + // Generated convenience method for optionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return optionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClient.java new file mode 100644 index 00000000000..8784b742833 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClient.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.path; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import parameters.path.implementation.PathClientImpl; + +/** + * Initializes a new instance of the synchronous PathClient type. + */ +@ServiceClient(builder = PathClientBuilder.class) +public final class PathClient { + @Generated + private final PathClientImpl serviceClient; + + /** + * Initializes an instance of PathClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathClient(PathClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The normal operation. + * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response normalWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.normalWithResponse(name, requestOptions); + } + + /** + * The optional operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response optionalWithResponse(RequestOptions requestOptions) { + return this.serviceClient.optionalWithResponse(requestOptions); + } + + /** + * The normal operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void normal(String name) { + // Generated convenience method for normalWithResponse + RequestOptions requestOptions = new RequestOptions(); + normalWithResponse(name, requestOptions).getValue(); + } + + /** + * The optional operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void optional(String name) { + // Generated convenience method for optionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + optionalWithResponse(requestOptions).getValue(); + } + + /** + * The optional operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void optional() { + // Generated convenience method for optionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + optionalWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClientBuilder.java new file mode 100644 index 00000000000..1cebf5077d7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/PathClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.path; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import parameters.path.implementation.PathClientImpl; + +/** + * A builder for creating a new instance of the PathClient type. + */ +@ServiceClientBuilder(serviceClients = { PathClient.class, PathAsyncClient.class }) +public final class PathClientBuilder + implements HttpTrait, ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("parameters-path.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the PathClientBuilder. + */ + @Generated + public PathClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PathClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the PathClientBuilder. + */ + @Generated + public PathClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of PathClientImpl with the provided parameters. + * + * @return an instance of PathClientImpl. + */ + @Generated + private PathClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + PathClientImpl client + = new PathClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of PathAsyncClient class. + * + * @return an instance of PathAsyncClient. + */ + @Generated + public PathAsyncClient buildAsyncClient() { + return new PathAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of PathClient class. + * + * @return an instance of PathClient. + */ + @Generated + public PathClient buildClient() { + return new PathClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(PathClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/PathClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/PathClientImpl.java new file mode 100644 index 00000000000..afc7377b430 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/PathClientImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.path.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the PathClient type. + */ +public final class PathClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of PathClient client. + * + * @param endpoint Service host. + */ + public PathClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of PathClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public PathClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of PathClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public PathClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(PathClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for PathClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "PathClient") + public interface PathClientService { + @Get("/parameters/path/normal/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> normal(@HostParam("endpoint") String endpoint, @PathParam("name") String name, + RequestOptions requestOptions, Context context); + + @Get("/parameters/path/normal/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response normalSync(@HostParam("endpoint") String endpoint, @PathParam("name") String name, + RequestOptions requestOptions, Context context); + + @Get("/parameters/path/optional{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> optional(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/parameters/path/optional{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response optionalSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The normal operation. + * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> normalWithResponseAsync(String name, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.normal(this.getEndpoint(), name, requestOptions, context)); + } + + /** + * The normal operation. + * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response normalWithResponse(String name, RequestOptions requestOptions) { + return service.normalSync(this.getEndpoint(), name, requestOptions, Context.NONE); + } + + /** + * The optional operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> optionalWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.optional(this.getEndpoint(), requestOptions, context)); + } + + /** + * The optional operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response optionalWithResponse(RequestOptions requestOptions) { + return service.optionalSync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/package-info.java new file mode 100644 index 00000000000..1888a5d5cae --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Path. + * Test for path parameters cases. + * + */ +package parameters.path.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/package-info.java new file mode 100644 index 00000000000..a52de46e2d4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/path/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Path. + * Test for path parameters cases. + * + */ +package parameters.path; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasAsyncClient.java new file mode 100644 index 00000000000..974e5d7b741 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasAsyncClient.java @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import java.util.List; +import parameters.spread.alias.implementation.models.SpreadAsRequestBodyRequest; +import parameters.spread.implementation.AliasImpl; +import parameters.spread.implementation.models.SpreadAsRequestParameterRequest; +import parameters.spread.implementation.models.SpreadParameterWithInnerAliasRequest; +import parameters.spread.implementation.models.SpreadParameterWithInnerModelRequest; +import parameters.spread.implementation.models.SpreadWithMultipleParametersRequest; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous SpreadClient type. + */ +@ServiceClient(builder = SpreadClientBuilder.class, isAsync = true) +public final class AliasAsyncClient { + @Generated + private final AliasImpl serviceClient; + + /** + * Initializes an instance of AliasAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AliasAsyncClient(AliasImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The spreadAsRequestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param spreadAsRequestBodyRequest The spreadAsRequestBodyRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadAsRequestBodyWithResponse(BinaryData spreadAsRequestBodyRequest, + RequestOptions requestOptions) { + return this.serviceClient.spreadAsRequestBodyWithResponseAsync(spreadAsRequestBodyRequest, requestOptions); + } + + /** + * The spreadParameterWithInnerModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadParameterWithInnerModelRequest The spreadParameterWithInnerModelRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadParameterWithInnerModelWithResponse(String id, String xMsTestHeader, + BinaryData spreadParameterWithInnerModelRequest, RequestOptions requestOptions) { + return this.serviceClient.spreadParameterWithInnerModelWithResponseAsync(id, xMsTestHeader, + spreadParameterWithInnerModelRequest, requestOptions); + } + + /** + * The spreadAsRequestParameter operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadAsRequestParameterRequest The spreadAsRequestParameterRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadAsRequestParameterWithResponse(String id, String xMsTestHeader, + BinaryData spreadAsRequestParameterRequest, RequestOptions requestOptions) { + return this.serviceClient.spreadAsRequestParameterWithResponseAsync(id, xMsTestHeader, + spreadAsRequestParameterRequest, requestOptions); + } + + /** + * The spreadWithMultipleParameters operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredString: String (Required)
+     *     optionalInt: Integer (Optional)
+     *     requiredIntList (Required): [
+     *         int (Required)
+     *     ]
+     *     optionalStringList (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadWithMultipleParametersRequest The spreadWithMultipleParametersRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadWithMultipleParametersWithResponse(String id, String xMsTestHeader, + BinaryData spreadWithMultipleParametersRequest, RequestOptions requestOptions) { + return this.serviceClient.spreadWithMultipleParametersWithResponseAsync(id, xMsTestHeader, + spreadWithMultipleParametersRequest, requestOptions); + } + + /** + * spread an alias with contains another alias property as body. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadParameterWithInnerAliasRequest The spreadParameterWithInnerAliasRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadParameterWithInnerAliasWithResponse(String id, String xMsTestHeader, + BinaryData spreadParameterWithInnerAliasRequest, RequestOptions requestOptions) { + return this.serviceClient.spreadParameterWithInnerAliasWithResponseAsync(id, xMsTestHeader, + spreadParameterWithInnerAliasRequest, requestOptions); + } + + /** + * The spreadAsRequestBody operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono spreadAsRequestBody(String name) { + // Generated convenience method for spreadAsRequestBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadAsRequestBodyRequest spreadAsRequestBodyRequestObj = new SpreadAsRequestBodyRequest(name); + BinaryData spreadAsRequestBodyRequest = BinaryData.fromObject(spreadAsRequestBodyRequestObj); + return spreadAsRequestBodyWithResponse(spreadAsRequestBodyRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The spreadParameterWithInnerModel operation. + * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono spreadParameterWithInnerModel(String id, String xMsTestHeader, String name) { + // Generated convenience method for spreadParameterWithInnerModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadParameterWithInnerModelRequest spreadParameterWithInnerModelRequestObj + = new SpreadParameterWithInnerModelRequest(name); + BinaryData spreadParameterWithInnerModelRequest + = BinaryData.fromObject(spreadParameterWithInnerModelRequestObj); + return spreadParameterWithInnerModelWithResponse(id, xMsTestHeader, spreadParameterWithInnerModelRequest, + requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The spreadAsRequestParameter operation. + * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono spreadAsRequestParameter(String id, String xMsTestHeader, String name) { + // Generated convenience method for spreadAsRequestParameterWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadAsRequestParameterRequest spreadAsRequestParameterRequestObj = new SpreadAsRequestParameterRequest(name); + BinaryData spreadAsRequestParameterRequest = BinaryData.fromObject(spreadAsRequestParameterRequestObj); + return spreadAsRequestParameterWithResponse(id, xMsTestHeader, spreadAsRequestParameterRequest, requestOptions) + .flatMap(FluxUtil::toMono); + } + + /** + * The spreadWithMultipleParameters operation. + * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param requiredString required string. + * @param requiredIntList required int. + * @param optionalInt optional int. + * @param optionalStringList optional string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono spreadWithMultipleParameters(String id, String xMsTestHeader, String requiredString, + List requiredIntList, Integer optionalInt, List optionalStringList) { + // Generated convenience method for spreadWithMultipleParametersWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadWithMultipleParametersRequest spreadWithMultipleParametersRequestObj + = new SpreadWithMultipleParametersRequest(requiredString, requiredIntList).setOptionalInt(optionalInt) + .setOptionalStringList(optionalStringList); + BinaryData spreadWithMultipleParametersRequest = BinaryData.fromObject(spreadWithMultipleParametersRequestObj); + return spreadWithMultipleParametersWithResponse(id, xMsTestHeader, spreadWithMultipleParametersRequest, + requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The spreadWithMultipleParameters operation. + * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param requiredString required string. + * @param requiredIntList required int. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono spreadWithMultipleParameters(String id, String xMsTestHeader, String requiredString, + List requiredIntList) { + // Generated convenience method for spreadWithMultipleParametersWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadWithMultipleParametersRequest spreadWithMultipleParametersRequestObj + = new SpreadWithMultipleParametersRequest(requiredString, requiredIntList); + BinaryData spreadWithMultipleParametersRequest = BinaryData.fromObject(spreadWithMultipleParametersRequestObj); + return spreadWithMultipleParametersWithResponse(id, xMsTestHeader, spreadWithMultipleParametersRequest, + requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * spread an alias with contains another alias property as body. + * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param name name of the Thing. + * @param age age of the Thing. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono spreadParameterWithInnerAlias(String id, String xMsTestHeader, String name, int age) { + // Generated convenience method for spreadParameterWithInnerAliasWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadParameterWithInnerAliasRequest spreadParameterWithInnerAliasRequestObj + = new SpreadParameterWithInnerAliasRequest(name, age); + BinaryData spreadParameterWithInnerAliasRequest + = BinaryData.fromObject(spreadParameterWithInnerAliasRequestObj); + return spreadParameterWithInnerAliasWithResponse(id, xMsTestHeader, spreadParameterWithInnerAliasRequest, + requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasClient.java new file mode 100644 index 00000000000..a8faa210759 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/AliasClient.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.util.List; +import parameters.spread.alias.implementation.models.SpreadAsRequestBodyRequest; +import parameters.spread.implementation.AliasImpl; +import parameters.spread.implementation.models.SpreadAsRequestParameterRequest; +import parameters.spread.implementation.models.SpreadParameterWithInnerAliasRequest; +import parameters.spread.implementation.models.SpreadParameterWithInnerModelRequest; +import parameters.spread.implementation.models.SpreadWithMultipleParametersRequest; + +/** + * Initializes a new instance of the synchronous SpreadClient type. + */ +@ServiceClient(builder = SpreadClientBuilder.class) +public final class AliasClient { + @Generated + private final AliasImpl serviceClient; + + /** + * Initializes an instance of AliasClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AliasClient(AliasImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The spreadAsRequestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param spreadAsRequestBodyRequest The spreadAsRequestBodyRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadAsRequestBodyWithResponse(BinaryData spreadAsRequestBodyRequest, + RequestOptions requestOptions) { + return this.serviceClient.spreadAsRequestBodyWithResponse(spreadAsRequestBodyRequest, requestOptions); + } + + /** + * The spreadParameterWithInnerModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadParameterWithInnerModelRequest The spreadParameterWithInnerModelRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadParameterWithInnerModelWithResponse(String id, String xMsTestHeader, + BinaryData spreadParameterWithInnerModelRequest, RequestOptions requestOptions) { + return this.serviceClient.spreadParameterWithInnerModelWithResponse(id, xMsTestHeader, + spreadParameterWithInnerModelRequest, requestOptions); + } + + /** + * The spreadAsRequestParameter operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadAsRequestParameterRequest The spreadAsRequestParameterRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadAsRequestParameterWithResponse(String id, String xMsTestHeader, + BinaryData spreadAsRequestParameterRequest, RequestOptions requestOptions) { + return this.serviceClient.spreadAsRequestParameterWithResponse(id, xMsTestHeader, + spreadAsRequestParameterRequest, requestOptions); + } + + /** + * The spreadWithMultipleParameters operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredString: String (Required)
+     *     optionalInt: Integer (Optional)
+     *     requiredIntList (Required): [
+     *         int (Required)
+     *     ]
+     *     optionalStringList (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadWithMultipleParametersRequest The spreadWithMultipleParametersRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadWithMultipleParametersWithResponse(String id, String xMsTestHeader, + BinaryData spreadWithMultipleParametersRequest, RequestOptions requestOptions) { + return this.serviceClient.spreadWithMultipleParametersWithResponse(id, xMsTestHeader, + spreadWithMultipleParametersRequest, requestOptions); + } + + /** + * spread an alias with contains another alias property as body. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadParameterWithInnerAliasRequest The spreadParameterWithInnerAliasRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadParameterWithInnerAliasWithResponse(String id, String xMsTestHeader, + BinaryData spreadParameterWithInnerAliasRequest, RequestOptions requestOptions) { + return this.serviceClient.spreadParameterWithInnerAliasWithResponse(id, xMsTestHeader, + spreadParameterWithInnerAliasRequest, requestOptions); + } + + /** + * The spreadAsRequestBody operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void spreadAsRequestBody(String name) { + // Generated convenience method for spreadAsRequestBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadAsRequestBodyRequest spreadAsRequestBodyRequestObj = new SpreadAsRequestBodyRequest(name); + BinaryData spreadAsRequestBodyRequest = BinaryData.fromObject(spreadAsRequestBodyRequestObj); + spreadAsRequestBodyWithResponse(spreadAsRequestBodyRequest, requestOptions).getValue(); + } + + /** + * The spreadParameterWithInnerModel operation. + * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void spreadParameterWithInnerModel(String id, String xMsTestHeader, String name) { + // Generated convenience method for spreadParameterWithInnerModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadParameterWithInnerModelRequest spreadParameterWithInnerModelRequestObj + = new SpreadParameterWithInnerModelRequest(name); + BinaryData spreadParameterWithInnerModelRequest + = BinaryData.fromObject(spreadParameterWithInnerModelRequestObj); + spreadParameterWithInnerModelWithResponse(id, xMsTestHeader, spreadParameterWithInnerModelRequest, + requestOptions).getValue(); + } + + /** + * The spreadAsRequestParameter operation. + * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void spreadAsRequestParameter(String id, String xMsTestHeader, String name) { + // Generated convenience method for spreadAsRequestParameterWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadAsRequestParameterRequest spreadAsRequestParameterRequestObj = new SpreadAsRequestParameterRequest(name); + BinaryData spreadAsRequestParameterRequest = BinaryData.fromObject(spreadAsRequestParameterRequestObj); + spreadAsRequestParameterWithResponse(id, xMsTestHeader, spreadAsRequestParameterRequest, requestOptions) + .getValue(); + } + + /** + * The spreadWithMultipleParameters operation. + * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param requiredString required string. + * @param requiredIntList required int. + * @param optionalInt optional int. + * @param optionalStringList optional string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void spreadWithMultipleParameters(String id, String xMsTestHeader, String requiredString, + List requiredIntList, Integer optionalInt, List optionalStringList) { + // Generated convenience method for spreadWithMultipleParametersWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadWithMultipleParametersRequest spreadWithMultipleParametersRequestObj + = new SpreadWithMultipleParametersRequest(requiredString, requiredIntList).setOptionalInt(optionalInt) + .setOptionalStringList(optionalStringList); + BinaryData spreadWithMultipleParametersRequest = BinaryData.fromObject(spreadWithMultipleParametersRequestObj); + spreadWithMultipleParametersWithResponse(id, xMsTestHeader, spreadWithMultipleParametersRequest, requestOptions) + .getValue(); + } + + /** + * The spreadWithMultipleParameters operation. + * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param requiredString required string. + * @param requiredIntList required int. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void spreadWithMultipleParameters(String id, String xMsTestHeader, String requiredString, + List requiredIntList) { + // Generated convenience method for spreadWithMultipleParametersWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadWithMultipleParametersRequest spreadWithMultipleParametersRequestObj + = new SpreadWithMultipleParametersRequest(requiredString, requiredIntList); + BinaryData spreadWithMultipleParametersRequest = BinaryData.fromObject(spreadWithMultipleParametersRequestObj); + spreadWithMultipleParametersWithResponse(id, xMsTestHeader, spreadWithMultipleParametersRequest, requestOptions) + .getValue(); + } + + /** + * spread an alias with contains another alias property as body. + * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param name name of the Thing. + * @param age age of the Thing. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void spreadParameterWithInnerAlias(String id, String xMsTestHeader, String name, int age) { + // Generated convenience method for spreadParameterWithInnerAliasWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadParameterWithInnerAliasRequest spreadParameterWithInnerAliasRequestObj + = new SpreadParameterWithInnerAliasRequest(name, age); + BinaryData spreadParameterWithInnerAliasRequest + = BinaryData.fromObject(spreadParameterWithInnerAliasRequestObj); + spreadParameterWithInnerAliasWithResponse(id, xMsTestHeader, spreadParameterWithInnerAliasRequest, + requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelAsyncClient.java new file mode 100644 index 00000000000..0bb9d5521a8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelAsyncClient.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import parameters.spread.implementation.ModelsImpl; +import parameters.spread.implementation.models.SpreadCompositeRequestMixRequest; +import parameters.spread.model.models.BodyParameter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous SpreadClient type. + */ +@ServiceClient(builder = SpreadClientBuilder.class, isAsync = true) +public final class ModelAsyncClient { + @Generated + private final ModelsImpl serviceClient; + + /** + * Initializes an instance of ModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelAsyncClient(ModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The spreadAsRequestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyParameter The bodyParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadAsRequestBodyWithResponse(BinaryData bodyParameter, + RequestOptions requestOptions) { + return this.serviceClient.spreadAsRequestBodyWithResponseAsync(bodyParameter, requestOptions); + } + + /** + * The spreadCompositeRequestOnlyWithBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadCompositeRequestOnlyWithBodyWithResponse(BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.spreadCompositeRequestOnlyWithBodyWithResponseAsync(body, requestOptions); + } + + /** + * The spreadCompositeRequestWithoutBody operation. + * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadCompositeRequestWithoutBodyWithResponse(String name, String testHeader, + RequestOptions requestOptions) { + return this.serviceClient.spreadCompositeRequestWithoutBodyWithResponseAsync(name, testHeader, requestOptions); + } + + /** + * The spreadCompositeRequest operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadCompositeRequestWithResponse(String name, String testHeader, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.spreadCompositeRequestWithResponseAsync(name, testHeader, body, requestOptions); + } + + /** + * The spreadCompositeRequestMix operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param spreadCompositeRequestMixRequest The spreadCompositeRequestMixRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadCompositeRequestMixWithResponse(String name, String testHeader, + BinaryData spreadCompositeRequestMixRequest, RequestOptions requestOptions) { + return this.serviceClient.spreadCompositeRequestMixWithResponseAsync(name, testHeader, + spreadCompositeRequestMixRequest, requestOptions); + } + + /** + * The spreadAsRequestBody operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono spreadAsRequestBody(String name) { + // Generated convenience method for spreadAsRequestBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + BodyParameter bodyParameterObj = new BodyParameter(name); + BinaryData bodyParameter = BinaryData.fromObject(bodyParameterObj); + return spreadAsRequestBodyWithResponse(bodyParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The spreadCompositeRequestOnlyWithBody operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono spreadCompositeRequestOnlyWithBody(BodyParameter body) { + // Generated convenience method for spreadCompositeRequestOnlyWithBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return spreadCompositeRequestOnlyWithBodyWithResponse(BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono); + } + + /** + * The spreadCompositeRequestWithoutBody operation. + * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono spreadCompositeRequestWithoutBody(String name, String testHeader) { + // Generated convenience method for spreadCompositeRequestWithoutBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return spreadCompositeRequestWithoutBodyWithResponse(name, testHeader, requestOptions) + .flatMap(FluxUtil::toMono); + } + + /** + * The spreadCompositeRequest operation. + * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono spreadCompositeRequest(String name, String testHeader, BodyParameter body) { + // Generated convenience method for spreadCompositeRequestWithResponse + RequestOptions requestOptions = new RequestOptions(); + return spreadCompositeRequestWithResponse(name, testHeader, BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono); + } + + /** + * The spreadCompositeRequestMix operation. + * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono spreadCompositeRequestMix(String name, String testHeader, String prop) { + // Generated convenience method for spreadCompositeRequestMixWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadCompositeRequestMixRequest spreadCompositeRequestMixRequestObj + = new SpreadCompositeRequestMixRequest(prop); + BinaryData spreadCompositeRequestMixRequest = BinaryData.fromObject(spreadCompositeRequestMixRequestObj); + return spreadCompositeRequestMixWithResponse(name, testHeader, spreadCompositeRequestMixRequest, requestOptions) + .flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelClient.java new file mode 100644 index 00000000000..3870ce5b144 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/ModelClient.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import parameters.spread.implementation.ModelsImpl; +import parameters.spread.implementation.models.SpreadCompositeRequestMixRequest; +import parameters.spread.model.models.BodyParameter; + +/** + * Initializes a new instance of the synchronous SpreadClient type. + */ +@ServiceClient(builder = SpreadClientBuilder.class) +public final class ModelClient { + @Generated + private final ModelsImpl serviceClient; + + /** + * Initializes an instance of ModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelClient(ModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The spreadAsRequestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyParameter The bodyParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadAsRequestBodyWithResponse(BinaryData bodyParameter, RequestOptions requestOptions) { + return this.serviceClient.spreadAsRequestBodyWithResponse(bodyParameter, requestOptions); + } + + /** + * The spreadCompositeRequestOnlyWithBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadCompositeRequestOnlyWithBodyWithResponse(BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.spreadCompositeRequestOnlyWithBodyWithResponse(body, requestOptions); + } + + /** + * The spreadCompositeRequestWithoutBody operation. + * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadCompositeRequestWithoutBodyWithResponse(String name, String testHeader, + RequestOptions requestOptions) { + return this.serviceClient.spreadCompositeRequestWithoutBodyWithResponse(name, testHeader, requestOptions); + } + + /** + * The spreadCompositeRequest operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadCompositeRequestWithResponse(String name, String testHeader, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.spreadCompositeRequestWithResponse(name, testHeader, body, requestOptions); + } + + /** + * The spreadCompositeRequestMix operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param spreadCompositeRequestMixRequest The spreadCompositeRequestMixRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadCompositeRequestMixWithResponse(String name, String testHeader, + BinaryData spreadCompositeRequestMixRequest, RequestOptions requestOptions) { + return this.serviceClient.spreadCompositeRequestMixWithResponse(name, testHeader, + spreadCompositeRequestMixRequest, requestOptions); + } + + /** + * The spreadAsRequestBody operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void spreadAsRequestBody(String name) { + // Generated convenience method for spreadAsRequestBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + BodyParameter bodyParameterObj = new BodyParameter(name); + BinaryData bodyParameter = BinaryData.fromObject(bodyParameterObj); + spreadAsRequestBodyWithResponse(bodyParameter, requestOptions).getValue(); + } + + /** + * The spreadCompositeRequestOnlyWithBody operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void spreadCompositeRequestOnlyWithBody(BodyParameter body) { + // Generated convenience method for spreadCompositeRequestOnlyWithBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + spreadCompositeRequestOnlyWithBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The spreadCompositeRequestWithoutBody operation. + * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void spreadCompositeRequestWithoutBody(String name, String testHeader) { + // Generated convenience method for spreadCompositeRequestWithoutBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + spreadCompositeRequestWithoutBodyWithResponse(name, testHeader, requestOptions).getValue(); + } + + /** + * The spreadCompositeRequest operation. + * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void spreadCompositeRequest(String name, String testHeader, BodyParameter body) { + // Generated convenience method for spreadCompositeRequestWithResponse + RequestOptions requestOptions = new RequestOptions(); + spreadCompositeRequestWithResponse(name, testHeader, BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The spreadCompositeRequestMix operation. + * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void spreadCompositeRequestMix(String name, String testHeader, String prop) { + // Generated convenience method for spreadCompositeRequestMixWithResponse + RequestOptions requestOptions = new RequestOptions(); + SpreadCompositeRequestMixRequest spreadCompositeRequestMixRequestObj + = new SpreadCompositeRequestMixRequest(prop); + BinaryData spreadCompositeRequestMixRequest = BinaryData.fromObject(spreadCompositeRequestMixRequestObj); + spreadCompositeRequestMixWithResponse(name, testHeader, spreadCompositeRequestMixRequest, requestOptions) + .getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/SpreadClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/SpreadClientBuilder.java new file mode 100644 index 00000000000..de3ecd9c5d5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/SpreadClientBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import parameters.spread.implementation.SpreadClientImpl; + +/** + * A builder for creating a new instance of the SpreadClient type. + */ +@ServiceClientBuilder( + serviceClients = { ModelClient.class, AliasClient.class, ModelAsyncClient.class, AliasAsyncClient.class }) +public final class SpreadClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("parameters-spread.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the SpreadClientBuilder. + */ + @Generated + public SpreadClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpreadClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpreadClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpreadClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpreadClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpreadClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpreadClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpreadClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpreadClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the SpreadClientBuilder. + */ + @Generated + public SpreadClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of SpreadClientImpl with the provided parameters. + * + * @return an instance of SpreadClientImpl. + */ + @Generated + private SpreadClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + SpreadClientImpl client + = new SpreadClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ModelAsyncClient class. + * + * @return an instance of ModelAsyncClient. + */ + @Generated + public ModelAsyncClient buildModelAsyncClient() { + return new ModelAsyncClient(buildInnerClient().getModels()); + } + + /** + * Builds an instance of AliasAsyncClient class. + * + * @return an instance of AliasAsyncClient. + */ + @Generated + public AliasAsyncClient buildAliasAsyncClient() { + return new AliasAsyncClient(buildInnerClient().getAlias()); + } + + /** + * Builds an instance of ModelClient class. + * + * @return an instance of ModelClient. + */ + @Generated + public ModelClient buildModelClient() { + return new ModelClient(buildInnerClient().getModels()); + } + + /** + * Builds an instance of AliasClient class. + * + * @return an instance of AliasClient. + */ + @Generated + public AliasClient buildAliasClient() { + return new AliasClient(buildInnerClient().getAlias()); + } + + private static final ClientLogger LOGGER = new ClientLogger(SpreadClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/SpreadAsRequestBodyRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/SpreadAsRequestBodyRequest.java new file mode 100644 index 00000000000..ae982101e3e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/SpreadAsRequestBodyRequest.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread.alias.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SpreadAsRequestBodyRequest model. + */ +@Immutable +public final class SpreadAsRequestBodyRequest implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of SpreadAsRequestBodyRequest class. + * + * @param name the name value to set. + */ + @Generated + public SpreadAsRequestBodyRequest(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadAsRequestBodyRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadAsRequestBodyRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadAsRequestBodyRequest. + */ + @Generated + public static SpreadAsRequestBodyRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new SpreadAsRequestBodyRequest(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/package-info.java new file mode 100644 index 00000000000..970bd234545 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/alias/implementation/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Spread. + * Test for the spread operator. + * + */ +package parameters.spread.alias.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/AliasImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/AliasImpl.java new file mode 100644 index 00000000000..3e3a5c432a5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/AliasImpl.java @@ -0,0 +1,491 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Alias. + */ +public final class AliasImpl { + /** + * The proxy service used to perform REST calls. + */ + private final AliasService service; + + /** + * The service client containing this operation class. + */ + private final SpreadClientImpl client; + + /** + * Initializes an instance of AliasImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AliasImpl(SpreadClientImpl client) { + this.service = RestProxy.create(AliasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SpreadClientAlias to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SpreadClientAlias") + public interface AliasService { + @Put("/parameters/spread/alias/request-body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> spreadAsRequestBody(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData spreadAsRequestBodyRequest, RequestOptions requestOptions, + Context context); + + @Put("/parameters/spread/alias/request-body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response spreadAsRequestBodySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData spreadAsRequestBodyRequest, RequestOptions requestOptions, + Context context); + + @Post("/parameters/spread/alias/inner-model-parameter/{id}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> spreadParameterWithInnerModel(@HostParam("endpoint") String endpoint, + @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData spreadParameterWithInnerModelRequest, + RequestOptions requestOptions, Context context); + + @Post("/parameters/spread/alias/inner-model-parameter/{id}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response spreadParameterWithInnerModelSync(@HostParam("endpoint") String endpoint, + @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData spreadParameterWithInnerModelRequest, + RequestOptions requestOptions, Context context); + + @Put("/parameters/spread/alias/request-parameter/{id}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> spreadAsRequestParameter(@HostParam("endpoint") String endpoint, + @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData spreadAsRequestParameterRequest, RequestOptions requestOptions, + Context context); + + @Put("/parameters/spread/alias/request-parameter/{id}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response spreadAsRequestParameterSync(@HostParam("endpoint") String endpoint, @PathParam("id") String id, + @HeaderParam("x-ms-test-header") String xMsTestHeader, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData spreadAsRequestParameterRequest, RequestOptions requestOptions, + Context context); + + @Put("/parameters/spread/alias/multiple-parameters/{id}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> spreadWithMultipleParameters(@HostParam("endpoint") String endpoint, + @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData spreadWithMultipleParametersRequest, + RequestOptions requestOptions, Context context); + + @Put("/parameters/spread/alias/multiple-parameters/{id}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response spreadWithMultipleParametersSync(@HostParam("endpoint") String endpoint, + @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData spreadWithMultipleParametersRequest, + RequestOptions requestOptions, Context context); + + @Post("/parameters/spread/alias/inner-alias-parameter/{id}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> spreadParameterWithInnerAlias(@HostParam("endpoint") String endpoint, + @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData spreadParameterWithInnerAliasRequest, + RequestOptions requestOptions, Context context); + + @Post("/parameters/spread/alias/inner-alias-parameter/{id}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response spreadParameterWithInnerAliasSync(@HostParam("endpoint") String endpoint, + @PathParam("id") String id, @HeaderParam("x-ms-test-header") String xMsTestHeader, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData spreadParameterWithInnerAliasRequest, + RequestOptions requestOptions, Context context); + } + + /** + * The spreadAsRequestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param spreadAsRequestBodyRequest The spreadAsRequestBodyRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadAsRequestBodyWithResponseAsync(BinaryData spreadAsRequestBodyRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.spreadAsRequestBody(this.client.getEndpoint(), contentType, + spreadAsRequestBodyRequest, requestOptions, context)); + } + + /** + * The spreadAsRequestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param spreadAsRequestBodyRequest The spreadAsRequestBodyRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadAsRequestBodyWithResponse(BinaryData spreadAsRequestBodyRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.spreadAsRequestBodySync(this.client.getEndpoint(), contentType, spreadAsRequestBodyRequest, + requestOptions, Context.NONE); + } + + /** + * The spreadParameterWithInnerModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadParameterWithInnerModelRequest The spreadParameterWithInnerModelRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadParameterWithInnerModelWithResponseAsync(String id, String xMsTestHeader, + BinaryData spreadParameterWithInnerModelRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.spreadParameterWithInnerModel(this.client.getEndpoint(), id, + xMsTestHeader, contentType, spreadParameterWithInnerModelRequest, requestOptions, context)); + } + + /** + * The spreadParameterWithInnerModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadParameterWithInnerModelRequest The spreadParameterWithInnerModelRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadParameterWithInnerModelWithResponse(String id, String xMsTestHeader, + BinaryData spreadParameterWithInnerModelRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.spreadParameterWithInnerModelSync(this.client.getEndpoint(), id, xMsTestHeader, contentType, + spreadParameterWithInnerModelRequest, requestOptions, Context.NONE); + } + + /** + * The spreadAsRequestParameter operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadAsRequestParameterRequest The spreadAsRequestParameterRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadAsRequestParameterWithResponseAsync(String id, String xMsTestHeader, + BinaryData spreadAsRequestParameterRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.spreadAsRequestParameter(this.client.getEndpoint(), id, + xMsTestHeader, contentType, spreadAsRequestParameterRequest, requestOptions, context)); + } + + /** + * The spreadAsRequestParameter operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadAsRequestParameterRequest The spreadAsRequestParameterRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadAsRequestParameterWithResponse(String id, String xMsTestHeader, + BinaryData spreadAsRequestParameterRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.spreadAsRequestParameterSync(this.client.getEndpoint(), id, xMsTestHeader, contentType, + spreadAsRequestParameterRequest, requestOptions, Context.NONE); + } + + /** + * The spreadWithMultipleParameters operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredString: String (Required)
+     *     optionalInt: Integer (Optional)
+     *     requiredIntList (Required): [
+     *         int (Required)
+     *     ]
+     *     optionalStringList (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadWithMultipleParametersRequest The spreadWithMultipleParametersRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadWithMultipleParametersWithResponseAsync(String id, String xMsTestHeader, + BinaryData spreadWithMultipleParametersRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.spreadWithMultipleParameters(this.client.getEndpoint(), id, + xMsTestHeader, contentType, spreadWithMultipleParametersRequest, requestOptions, context)); + } + + /** + * The spreadWithMultipleParameters operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredString: String (Required)
+     *     optionalInt: Integer (Optional)
+     *     requiredIntList (Required): [
+     *         int (Required)
+     *     ]
+     *     optionalStringList (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadWithMultipleParametersRequest The spreadWithMultipleParametersRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadWithMultipleParametersWithResponse(String id, String xMsTestHeader, + BinaryData spreadWithMultipleParametersRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.spreadWithMultipleParametersSync(this.client.getEndpoint(), id, xMsTestHeader, contentType, + spreadWithMultipleParametersRequest, requestOptions, Context.NONE); + } + + /** + * spread an alias with contains another alias property as body. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadParameterWithInnerAliasRequest The spreadParameterWithInnerAliasRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadParameterWithInnerAliasWithResponseAsync(String id, String xMsTestHeader, + BinaryData spreadParameterWithInnerAliasRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.spreadParameterWithInnerAlias(this.client.getEndpoint(), id, + xMsTestHeader, contentType, spreadParameterWithInnerAliasRequest, requestOptions, context)); + } + + /** + * spread an alias with contains another alias property as body. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param xMsTestHeader The xMsTestHeader parameter. + * @param spreadParameterWithInnerAliasRequest The spreadParameterWithInnerAliasRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadParameterWithInnerAliasWithResponse(String id, String xMsTestHeader, + BinaryData spreadParameterWithInnerAliasRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.spreadParameterWithInnerAliasSync(this.client.getEndpoint(), id, xMsTestHeader, contentType, + spreadParameterWithInnerAliasRequest, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/ModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/ModelsImpl.java new file mode 100644 index 00000000000..1f35a3fb6a2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/ModelsImpl.java @@ -0,0 +1,436 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Models. + */ +public final class ModelsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ModelsService service; + + /** + * The service client containing this operation class. + */ + private final SpreadClientImpl client; + + /** + * Initializes an instance of ModelsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ModelsImpl(SpreadClientImpl client) { + this.service = RestProxy.create(ModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SpreadClientModels to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SpreadClientModels") + public interface ModelsService { + @Put("/parameters/spread/model/request-body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> spreadAsRequestBody(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData bodyParameter, + RequestOptions requestOptions, Context context); + + @Put("/parameters/spread/model/request-body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response spreadAsRequestBodySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData bodyParameter, + RequestOptions requestOptions, Context context); + + @Put("/parameters/spread/model/composite-request-only-with-body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> spreadCompositeRequestOnlyWithBody(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/parameters/spread/model/composite-request-only-with-body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response spreadCompositeRequestOnlyWithBodySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/parameters/spread/model/composite-request-without-body/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> spreadCompositeRequestWithoutBody(@HostParam("endpoint") String endpoint, + @PathParam("name") String name, @HeaderParam("test-header") String testHeader, + RequestOptions requestOptions, Context context); + + @Put("/parameters/spread/model/composite-request-without-body/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response spreadCompositeRequestWithoutBodySync(@HostParam("endpoint") String endpoint, + @PathParam("name") String name, @HeaderParam("test-header") String testHeader, + RequestOptions requestOptions, Context context); + + @Put("/parameters/spread/model/composite-request/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> spreadCompositeRequest(@HostParam("endpoint") String endpoint, + @PathParam("name") String name, @HeaderParam("test-header") String testHeader, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/parameters/spread/model/composite-request/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response spreadCompositeRequestSync(@HostParam("endpoint") String endpoint, + @PathParam("name") String name, @HeaderParam("test-header") String testHeader, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/parameters/spread/model/composite-request-mix/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> spreadCompositeRequestMix(@HostParam("endpoint") String endpoint, + @PathParam("name") String name, @HeaderParam("test-header") String testHeader, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData spreadCompositeRequestMixRequest, RequestOptions requestOptions, + Context context); + + @Put("/parameters/spread/model/composite-request-mix/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response spreadCompositeRequestMixSync(@HostParam("endpoint") String endpoint, + @PathParam("name") String name, @HeaderParam("test-header") String testHeader, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData spreadCompositeRequestMixRequest, RequestOptions requestOptions, + Context context); + } + + /** + * The spreadAsRequestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyParameter The bodyParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadAsRequestBodyWithResponseAsync(BinaryData bodyParameter, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.spreadAsRequestBody(this.client.getEndpoint(), contentType, + bodyParameter, requestOptions, context)); + } + + /** + * The spreadAsRequestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param bodyParameter The bodyParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadAsRequestBodyWithResponse(BinaryData bodyParameter, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.spreadAsRequestBodySync(this.client.getEndpoint(), contentType, bodyParameter, requestOptions, + Context.NONE); + } + + /** + * The spreadCompositeRequestOnlyWithBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadCompositeRequestOnlyWithBodyWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.spreadCompositeRequestOnlyWithBody(this.client.getEndpoint(), + contentType, body, requestOptions, context)); + } + + /** + * The spreadCompositeRequestOnlyWithBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadCompositeRequestOnlyWithBodyWithResponse(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.spreadCompositeRequestOnlyWithBodySync(this.client.getEndpoint(), contentType, body, + requestOptions, Context.NONE); + } + + /** + * The spreadCompositeRequestWithoutBody operation. + * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadCompositeRequestWithoutBodyWithResponseAsync(String name, String testHeader, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.spreadCompositeRequestWithoutBody(this.client.getEndpoint(), + name, testHeader, requestOptions, context)); + } + + /** + * The spreadCompositeRequestWithoutBody operation. + * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadCompositeRequestWithoutBodyWithResponse(String name, String testHeader, + RequestOptions requestOptions) { + return service.spreadCompositeRequestWithoutBodySync(this.client.getEndpoint(), name, testHeader, + requestOptions, Context.NONE); + } + + /** + * The spreadCompositeRequest operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadCompositeRequestWithResponseAsync(String name, String testHeader, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.spreadCompositeRequest(this.client.getEndpoint(), name, + testHeader, contentType, body, requestOptions, context)); + } + + /** + * The spreadCompositeRequest operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadCompositeRequestWithResponse(String name, String testHeader, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.spreadCompositeRequestSync(this.client.getEndpoint(), name, testHeader, contentType, body, + requestOptions, Context.NONE); + } + + /** + * The spreadCompositeRequestMix operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param spreadCompositeRequestMixRequest The spreadCompositeRequestMixRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> spreadCompositeRequestMixWithResponseAsync(String name, String testHeader, + BinaryData spreadCompositeRequestMixRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.spreadCompositeRequestMix(this.client.getEndpoint(), name, + testHeader, contentType, spreadCompositeRequestMixRequest, requestOptions, context)); + } + + /** + * The spreadCompositeRequestMix operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param testHeader The testHeader parameter. + * @param spreadCompositeRequestMixRequest The spreadCompositeRequestMixRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response spreadCompositeRequestMixWithResponse(String name, String testHeader, + BinaryData spreadCompositeRequestMixRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.spreadCompositeRequestMixSync(this.client.getEndpoint(), name, testHeader, contentType, + spreadCompositeRequestMixRequest, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/SpreadClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/SpreadClientImpl.java new file mode 100644 index 00000000000..9488e151f85 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/SpreadClientImpl.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 SpreadClient type. + */ +public final class SpreadClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 ModelsImpl object to access its operations. + */ + private final ModelsImpl models; + + /** + * Gets the ModelsImpl object to access its operations. + * + * @return the ModelsImpl object. + */ + public ModelsImpl getModels() { + return this.models; + } + + /** + * The AliasImpl object to access its operations. + */ + private final AliasImpl alias; + + /** + * Gets the AliasImpl object to access its operations. + * + * @return the AliasImpl object. + */ + public AliasImpl getAlias() { + return this.alias; + } + + /** + * Initializes an instance of SpreadClient client. + * + * @param endpoint Service host. + */ + public SpreadClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SpreadClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public SpreadClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SpreadClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public SpreadClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.models = new ModelsImpl(this); + this.alias = new AliasImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadAsRequestParameterRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadAsRequestParameterRequest.java new file mode 100644 index 00000000000..5b4f356e1ed --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadAsRequestParameterRequest.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SpreadAsRequestParameterRequest model. + */ +@Immutable +public final class SpreadAsRequestParameterRequest implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of SpreadAsRequestParameterRequest class. + * + * @param name the name value to set. + */ + @Generated + public SpreadAsRequestParameterRequest(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadAsRequestParameterRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadAsRequestParameterRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadAsRequestParameterRequest. + */ + @Generated + public static SpreadAsRequestParameterRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new SpreadAsRequestParameterRequest(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadCompositeRequestMixRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadCompositeRequestMixRequest.java new file mode 100644 index 00000000000..a9338d497fb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadCompositeRequestMixRequest.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SpreadCompositeRequestMixRequest model. + */ +@Immutable +public final class SpreadCompositeRequestMixRequest implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final String prop; + + /** + * Creates an instance of SpreadCompositeRequestMixRequest class. + * + * @param prop the prop value to set. + */ + @Generated + public SpreadCompositeRequestMixRequest(String prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public String getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadCompositeRequestMixRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadCompositeRequestMixRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadCompositeRequestMixRequest. + */ + @Generated + public static SpreadCompositeRequestMixRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new SpreadCompositeRequestMixRequest(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerAliasRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerAliasRequest.java new file mode 100644 index 00000000000..d3c60fd0733 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerAliasRequest.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SpreadParameterWithInnerAliasRequest model. + */ +@Immutable +public final class SpreadParameterWithInnerAliasRequest + implements JsonSerializable { + /* + * name of the Thing + */ + @Generated + private final String name; + + /* + * age of the Thing + */ + @Generated + private final int age; + + /** + * Creates an instance of SpreadParameterWithInnerAliasRequest class. + * + * @param name the name value to set. + * @param age the age value to set. + */ + @Generated + public SpreadParameterWithInnerAliasRequest(String name, int age) { + this.name = name; + this.age = age; + } + + /** + * Get the name property: name of the Thing. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the age property: age of the Thing. + * + * @return the age value. + */ + @Generated + public int getAge() { + return this.age; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeIntField("age", this.age); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadParameterWithInnerAliasRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadParameterWithInnerAliasRequest if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadParameterWithInnerAliasRequest. + */ + @Generated + public static SpreadParameterWithInnerAliasRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + int age = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("age".equals(fieldName)) { + age = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new SpreadParameterWithInnerAliasRequest(name, age); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerModelRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerModelRequest.java new file mode 100644 index 00000000000..2642974a83d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerModelRequest.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SpreadParameterWithInnerModelRequest model. + */ +@Immutable +public final class SpreadParameterWithInnerModelRequest + implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of SpreadParameterWithInnerModelRequest class. + * + * @param name the name value to set. + */ + @Generated + public SpreadParameterWithInnerModelRequest(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadParameterWithInnerModelRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadParameterWithInnerModelRequest if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadParameterWithInnerModelRequest. + */ + @Generated + public static SpreadParameterWithInnerModelRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new SpreadParameterWithInnerModelRequest(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadWithMultipleParametersRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadWithMultipleParametersRequest.java new file mode 100644 index 00000000000..41e5bc82a43 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/SpreadWithMultipleParametersRequest.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The SpreadWithMultipleParametersRequest model. + */ +@Fluent +public final class SpreadWithMultipleParametersRequest + implements JsonSerializable { + /* + * required string + */ + @Generated + private final String requiredString; + + /* + * optional int + */ + @Generated + private Integer optionalInt; + + /* + * required int + */ + @Generated + private final List requiredIntList; + + /* + * optional string + */ + @Generated + private List optionalStringList; + + /** + * Creates an instance of SpreadWithMultipleParametersRequest class. + * + * @param requiredString the requiredString value to set. + * @param requiredIntList the requiredIntList value to set. + */ + @Generated + public SpreadWithMultipleParametersRequest(String requiredString, List requiredIntList) { + this.requiredString = requiredString; + this.requiredIntList = requiredIntList; + } + + /** + * Get the requiredString property: required string. + * + * @return the requiredString value. + */ + @Generated + public String getRequiredString() { + return this.requiredString; + } + + /** + * Get the optionalInt property: optional int. + * + * @return the optionalInt value. + */ + @Generated + public Integer getOptionalInt() { + return this.optionalInt; + } + + /** + * Set the optionalInt property: optional int. + * + * @param optionalInt the optionalInt value to set. + * @return the SpreadWithMultipleParametersRequest object itself. + */ + @Generated + public SpreadWithMultipleParametersRequest setOptionalInt(Integer optionalInt) { + this.optionalInt = optionalInt; + return this; + } + + /** + * Get the requiredIntList property: required int. + * + * @return the requiredIntList value. + */ + @Generated + public List getRequiredIntList() { + return this.requiredIntList; + } + + /** + * Get the optionalStringList property: optional string. + * + * @return the optionalStringList value. + */ + @Generated + public List getOptionalStringList() { + return this.optionalStringList; + } + + /** + * Set the optionalStringList property: optional string. + * + * @param optionalStringList the optionalStringList value to set. + * @return the SpreadWithMultipleParametersRequest object itself. + */ + @Generated + public SpreadWithMultipleParametersRequest setOptionalStringList(List optionalStringList) { + this.optionalStringList = optionalStringList; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requiredString", this.requiredString); + jsonWriter.writeArrayField("requiredIntList", this.requiredIntList, + (writer, element) -> writer.writeInt(element)); + jsonWriter.writeNumberField("optionalInt", this.optionalInt); + jsonWriter.writeArrayField("optionalStringList", this.optionalStringList, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadWithMultipleParametersRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadWithMultipleParametersRequest if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadWithMultipleParametersRequest. + */ + @Generated + public static SpreadWithMultipleParametersRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String requiredString = null; + List requiredIntList = null; + Integer optionalInt = null; + List optionalStringList = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requiredString".equals(fieldName)) { + requiredString = reader.getString(); + } else if ("requiredIntList".equals(fieldName)) { + requiredIntList = reader.readArray(reader1 -> reader1.getInt()); + } else if ("optionalInt".equals(fieldName)) { + optionalInt = reader.getNullable(JsonReader::getInt); + } else if ("optionalStringList".equals(fieldName)) { + optionalStringList = reader.readArray(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + SpreadWithMultipleParametersRequest deserializedSpreadWithMultipleParametersRequest + = new SpreadWithMultipleParametersRequest(requiredString, requiredIntList); + deserializedSpreadWithMultipleParametersRequest.optionalInt = optionalInt; + deserializedSpreadWithMultipleParametersRequest.optionalStringList = optionalStringList; + + return deserializedSpreadWithMultipleParametersRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/package-info.java new file mode 100644 index 00000000000..8a6836639f7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Spread. + * Test for the spread operator. + * + */ +package parameters.spread.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/package-info.java new file mode 100644 index 00000000000..8806ae9835e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Spread. + * Test for the spread operator. + * + */ +package parameters.spread.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/BodyParameter.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/BodyParameter.java new file mode 100644 index 00000000000..fc712390229 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/BodyParameter.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is a simple model. + */ +@Immutable +public final class BodyParameter implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of BodyParameter class. + * + * @param name the name value to set. + */ + @Generated + public BodyParameter(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BodyParameter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BodyParameter if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BodyParameter. + */ + @Generated + public static BodyParameter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new BodyParameter(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/package-info.java new file mode 100644 index 00000000000..9abd14e2243 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/model/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Spread. + * Test for the spread operator. + * + */ +package parameters.spread.model.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/package-info.java new file mode 100644 index 00000000000..929f47272f2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/parameters/spread/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Spread. + * Test for the spread operator. + * + */ +package parameters.spread; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/ContentNegotiationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/ContentNegotiationClientBuilder.java new file mode 100644 index 00000000000..aa4b8e9ed47 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/ContentNegotiationClientBuilder.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.contentnegotiation; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import payload.contentnegotiation.implementation.ContentNegotiationClientImpl; + +/** + * A builder for creating a new instance of the ContentNegotiationClient type. + */ +@ServiceClientBuilder( + serviceClients = { + SameBodyClient.class, + DifferentBodyClient.class, + SameBodyAsyncClient.class, + DifferentBodyAsyncClient.class }) +public final class ContentNegotiationClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("payload-contentnegotiation.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ContentNegotiationClientBuilder. + */ + @Generated + public ContentNegotiationClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ContentNegotiationClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ContentNegotiationClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ContentNegotiationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ContentNegotiationClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ContentNegotiationClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ContentNegotiationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ContentNegotiationClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ContentNegotiationClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ContentNegotiationClientBuilder. + */ + @Generated + public ContentNegotiationClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ContentNegotiationClientImpl with the provided parameters. + * + * @return an instance of ContentNegotiationClientImpl. + */ + @Generated + private ContentNegotiationClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ContentNegotiationClientImpl client = new ContentNegotiationClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of SameBodyAsyncClient class. + * + * @return an instance of SameBodyAsyncClient. + */ + @Generated + public SameBodyAsyncClient buildSameBodyAsyncClient() { + return new SameBodyAsyncClient(buildInnerClient().getSameBodies()); + } + + /** + * Builds an instance of DifferentBodyAsyncClient class. + * + * @return an instance of DifferentBodyAsyncClient. + */ + @Generated + public DifferentBodyAsyncClient buildDifferentBodyAsyncClient() { + return new DifferentBodyAsyncClient(buildInnerClient().getDifferentBodies()); + } + + /** + * Builds an instance of SameBodyClient class. + * + * @return an instance of SameBodyClient. + */ + @Generated + public SameBodyClient buildSameBodyClient() { + return new SameBodyClient(buildInnerClient().getSameBodies()); + } + + /** + * Builds an instance of DifferentBodyClient class. + * + * @return an instance of DifferentBodyClient. + */ + @Generated + public DifferentBodyClient buildDifferentBodyClient() { + return new DifferentBodyClient(buildInnerClient().getDifferentBodies()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ContentNegotiationClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyAsyncClient.java new file mode 100644 index 00000000000..8353e6ec89e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyAsyncClient.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.contentnegotiation; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import payload.contentnegotiation.differentbody.models.PngImageAsJson; +import payload.contentnegotiation.implementation.DifferentBodiesImpl; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ContentNegotiationClient type. + */ +@ServiceClient(builder = ContentNegotiationClientBuilder.class, isAsync = true) +public final class DifferentBodyAsyncClient { + @Generated + private final DifferentBodiesImpl serviceClient; + + /** + * Initializes an instance of DifferentBodyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DifferentBodyAsyncClient(DifferentBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getAvatarAsPng operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAvatarAsPngWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAvatarAsPngWithResponseAsync(requestOptions); + } + + /** + * The getAvatarAsJson operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     content: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAvatarAsJsonWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAvatarAsJsonWithResponseAsync(requestOptions); + } + + /** + * The getAvatarAsPng operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAvatarAsPng() { + // Generated convenience method for getAvatarAsPngWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAvatarAsPngWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getAvatarAsJson operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAvatarAsJson() { + // Generated convenience method for getAvatarAsJsonWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAvatarAsJsonWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PngImageAsJson.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyClient.java new file mode 100644 index 00000000000..4e72b809bfb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/DifferentBodyClient.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.contentnegotiation; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import payload.contentnegotiation.differentbody.models.PngImageAsJson; +import payload.contentnegotiation.implementation.DifferentBodiesImpl; + +/** + * Initializes a new instance of the synchronous ContentNegotiationClient type. + */ +@ServiceClient(builder = ContentNegotiationClientBuilder.class) +public final class DifferentBodyClient { + @Generated + private final DifferentBodiesImpl serviceClient; + + /** + * Initializes an instance of DifferentBodyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DifferentBodyClient(DifferentBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getAvatarAsPng operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAvatarAsPngWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAvatarAsPngWithResponse(requestOptions); + } + + /** + * The getAvatarAsJson operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     content: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAvatarAsJsonWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAvatarAsJsonWithResponse(requestOptions); + } + + /** + * The getAvatarAsPng operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData getAvatarAsPng() { + // Generated convenience method for getAvatarAsPngWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAvatarAsPngWithResponse(requestOptions).getValue(); + } + + /** + * The getAvatarAsJson operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PngImageAsJson getAvatarAsJson() { + // Generated convenience method for getAvatarAsJsonWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAvatarAsJsonWithResponse(requestOptions).getValue().toObject(PngImageAsJson.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyAsyncClient.java new file mode 100644 index 00000000000..5bea329b843 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyAsyncClient.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.contentnegotiation; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import payload.contentnegotiation.implementation.SameBodiesImpl; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous ContentNegotiationClient type. + */ +@ServiceClient(builder = ContentNegotiationClientBuilder.class, isAsync = true) +public final class SameBodyAsyncClient { + @Generated + private final SameBodiesImpl serviceClient; + + /** + * Initializes an instance of SameBodyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SameBodyAsyncClient(SameBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getAvatarAsPng operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAvatarAsPngWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAvatarAsPngWithResponseAsync(requestOptions); + } + + /** + * The getAvatarAsJpeg operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAvatarAsJpegWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAvatarAsJpegWithResponseAsync(requestOptions); + } + + /** + * The getAvatarAsPng operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAvatarAsPng() { + // Generated convenience method for getAvatarAsPngWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAvatarAsPngWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getAvatarAsJpeg operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAvatarAsJpeg() { + // Generated convenience method for getAvatarAsJpegWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAvatarAsJpegWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyClient.java new file mode 100644 index 00000000000..bbb4817ab0d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/SameBodyClient.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.contentnegotiation; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import payload.contentnegotiation.implementation.SameBodiesImpl; + +/** + * Initializes a new instance of the synchronous ContentNegotiationClient type. + */ +@ServiceClient(builder = ContentNegotiationClientBuilder.class) +public final class SameBodyClient { + @Generated + private final SameBodiesImpl serviceClient; + + /** + * Initializes an instance of SameBodyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SameBodyClient(SameBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getAvatarAsPng operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAvatarAsPngWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAvatarAsPngWithResponse(requestOptions); + } + + /** + * The getAvatarAsJpeg operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAvatarAsJpegWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAvatarAsJpegWithResponse(requestOptions); + } + + /** + * The getAvatarAsPng operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData getAvatarAsPng() { + // Generated convenience method for getAvatarAsPngWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAvatarAsPngWithResponse(requestOptions).getValue(); + } + + /** + * The getAvatarAsJpeg operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData getAvatarAsJpeg() { + // Generated convenience method for getAvatarAsJpegWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAvatarAsJpegWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/PngImageAsJson.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/PngImageAsJson.java new file mode 100644 index 00000000000..f1bad165634 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/PngImageAsJson.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.contentnegotiation.differentbody.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The PngImageAsJson model. + */ +@Immutable +public final class PngImageAsJson implements JsonSerializable { + /* + * The content property. + */ + @Generated + private final byte[] content; + + /** + * Creates an instance of PngImageAsJson class. + * + * @param content the content value to set. + */ + @Generated + private PngImageAsJson(byte[] content) { + this.content = content; + } + + /** + * Get the content property: The content property. + * + * @return the content value. + */ + @Generated + public byte[] getContent() { + return CoreUtils.clone(this.content); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBinaryField("content", this.content); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PngImageAsJson from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PngImageAsJson if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PngImageAsJson. + */ + @Generated + public static PngImageAsJson fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + byte[] content = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("content".equals(fieldName)) { + content = reader.getBinary(); + } else { + reader.skipChildren(); + } + } + return new PngImageAsJson(content); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/package-info.java new file mode 100644 index 00000000000..a571412c8f4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/differentbody/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for ContentNegotiation. + * Test describing optionality of the request body. + * + */ +package payload.contentnegotiation.differentbody.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java new file mode 100644 index 00000000000..71f59aaaa4a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.contentnegotiation.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 ContentNegotiationClient type. + */ +public final class ContentNegotiationClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 SameBodiesImpl object to access its operations. + */ + private final SameBodiesImpl sameBodies; + + /** + * Gets the SameBodiesImpl object to access its operations. + * + * @return the SameBodiesImpl object. + */ + public SameBodiesImpl getSameBodies() { + return this.sameBodies; + } + + /** + * The DifferentBodiesImpl object to access its operations. + */ + private final DifferentBodiesImpl differentBodies; + + /** + * Gets the DifferentBodiesImpl object to access its operations. + * + * @return the DifferentBodiesImpl object. + */ + public DifferentBodiesImpl getDifferentBodies() { + return this.differentBodies; + } + + /** + * Initializes an instance of ContentNegotiationClient client. + * + * @param endpoint Service host. + */ + public ContentNegotiationClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ContentNegotiationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ContentNegotiationClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ContentNegotiationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ContentNegotiationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.sameBodies = new SameBodiesImpl(this); + this.differentBodies = new DifferentBodiesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/DifferentBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/DifferentBodiesImpl.java new file mode 100644 index 00000000000..4928bf2b6d8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/DifferentBodiesImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.contentnegotiation.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DifferentBodies. + */ +public final class DifferentBodiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DifferentBodiesService service; + + /** + * The service client containing this operation class. + */ + private final ContentNegotiationClientImpl client; + + /** + * Initializes an instance of DifferentBodiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DifferentBodiesImpl(ContentNegotiationClientImpl client) { + this.service + = RestProxy.create(DifferentBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ContentNegotiationClientDifferentBodies to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ContentNegotiationClientDifferentBodies") + public interface DifferentBodiesService { + @Get("/content-negotiation/different-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAvatarAsPng(@HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/content-negotiation/different-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAvatarAsPngSync(@HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/content-negotiation/different-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAvatarAsJson(@HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/content-negotiation/different-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAvatarAsJsonSync(@HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * The getAvatarAsPng operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAvatarAsPngWithResponseAsync(RequestOptions requestOptions) { + final String accept = "image/png"; + return FluxUtil + .withContext(context -> service.getAvatarAsPng(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getAvatarAsPng operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAvatarAsPngWithResponse(RequestOptions requestOptions) { + final String accept = "image/png"; + return service.getAvatarAsPngSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getAvatarAsJson operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     content: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAvatarAsJsonWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getAvatarAsJson(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getAvatarAsJson operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     content: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAvatarAsJsonWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAvatarAsJsonSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/SameBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/SameBodiesImpl.java new file mode 100644 index 00000000000..44bdf30e76c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/SameBodiesImpl.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.contentnegotiation.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SameBodies. + */ +public final class SameBodiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SameBodiesService service; + + /** + * The service client containing this operation class. + */ + private final ContentNegotiationClientImpl client; + + /** + * Initializes an instance of SameBodiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SameBodiesImpl(ContentNegotiationClientImpl client) { + this.service + = RestProxy.create(SameBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ContentNegotiationClientSameBodies to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ContentNegotiationClientSameBodies") + public interface SameBodiesService { + @Get("/content-negotiation/same-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAvatarAsPng(@HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/content-negotiation/same-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAvatarAsPngSync(@HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/content-negotiation/same-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAvatarAsJpeg(@HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/content-negotiation/same-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAvatarAsJpegSync(@HostParam("endpoint") String endpoint, + @HeaderParam("accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * The getAvatarAsPng operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAvatarAsPngWithResponseAsync(RequestOptions requestOptions) { + final String accept = "image/png"; + return FluxUtil + .withContext(context -> service.getAvatarAsPng(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getAvatarAsPng operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAvatarAsPngWithResponse(RequestOptions requestOptions) { + final String accept = "image/png"; + return service.getAvatarAsPngSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getAvatarAsJpeg operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAvatarAsJpegWithResponseAsync(RequestOptions requestOptions) { + final String accept = "image/jpeg"; + return FluxUtil.withContext( + context -> service.getAvatarAsJpeg(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getAvatarAsJpeg operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAvatarAsJpegWithResponse(RequestOptions requestOptions) { + final String accept = "image/jpeg"; + return service.getAvatarAsJpegSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/package-info.java new file mode 100644 index 00000000000..ce96af483de --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ContentNegotiation. + * Test describing optionality of the request body. + * + */ +package payload.contentnegotiation.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/package-info.java new file mode 100644 index 00000000000..363404f10e2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/contentnegotiation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ContentNegotiation. + * Test describing optionality of the request body. + * + */ +package payload.contentnegotiation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchAsyncClient.java new file mode 100644 index 00000000000..d7542a08fb8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchAsyncClient.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.jsonmergepatch; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import payload.jsonmergepatch.implementation.JsonMergePatchClientImpl; +import payload.jsonmergepatch.implementation.JsonMergePatchHelper; +import payload.jsonmergepatch.models.Resource; +import payload.jsonmergepatch.models.ResourcePatch; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous JsonMergePatchClient type. + */ +@ServiceClient(builder = JsonMergePatchClientBuilder.class, isAsync = true) +public final class JsonMergePatchAsyncClient { + @Generated + private final JsonMergePatchClientImpl serviceClient; + + /** + * Initializes an instance of JsonMergePatchAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + JsonMergePatchAsyncClient(JsonMergePatchClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test content-type: application/merge-patch+json with required body. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a resource along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createResourceWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createResourceWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: application/merge-patch+json with required body. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a resource along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateResourceWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateResourceWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: application/merge-patch+json with optional body. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/merge-patch+json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a resource along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateOptionalResourceWithResponse(RequestOptions requestOptions) { + return this.serviceClient.updateOptionalResourceWithResponseAsync(requestOptions); + } + + /** + * Test content-type: application/merge-patch+json with required body. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a resource on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createResource(Resource body) { + // Generated convenience method for createResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createResourceWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * Test content-type: application/merge-patch+json with required body. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a resource on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateResource(ResourcePatch body) { + // Generated convenience method for updateResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, false); + return updateResourceWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * Test content-type: application/merge-patch+json with optional body. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a resource on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateOptionalResource(ResourcePatch body) { + // Generated convenience method for updateOptionalResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (body != null) { + JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, false); + requestOptions.setBody(bodyInBinaryData); + } + return updateOptionalResourceWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * Test content-type: application/merge-patch+json with optional body. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a resource on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateOptionalResource() { + // Generated convenience method for updateOptionalResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateOptionalResourceWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClient.java new file mode 100644 index 00000000000..7db0b977781 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClient.java @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.jsonmergepatch; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import payload.jsonmergepatch.implementation.JsonMergePatchClientImpl; +import payload.jsonmergepatch.implementation.JsonMergePatchHelper; +import payload.jsonmergepatch.models.Resource; +import payload.jsonmergepatch.models.ResourcePatch; + +/** + * Initializes a new instance of the synchronous JsonMergePatchClient type. + */ +@ServiceClient(builder = JsonMergePatchClientBuilder.class) +public final class JsonMergePatchClient { + @Generated + private final JsonMergePatchClientImpl serviceClient; + + /** + * Initializes an instance of JsonMergePatchClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + JsonMergePatchClient(JsonMergePatchClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test content-type: application/merge-patch+json with required body. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a resource along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createResourceWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.createResourceWithResponse(body, requestOptions); + } + + /** + * Test content-type: application/merge-patch+json with required body. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a resource along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateResourceWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateResourceWithResponse(body, requestOptions); + } + + /** + * Test content-type: application/merge-patch+json with optional body. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/merge-patch+json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a resource along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateOptionalResourceWithResponse(RequestOptions requestOptions) { + return this.serviceClient.updateOptionalResourceWithResponse(requestOptions); + } + + /** + * Test content-type: application/merge-patch+json with required body. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a resource. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource createResource(Resource body) { + // Generated convenience method for createResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createResourceWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Resource.class); + } + + /** + * Test content-type: application/merge-patch+json with required body. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a resource. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource updateResource(ResourcePatch body) { + // Generated convenience method for updateResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, false); + return updateResourceWithResponse(bodyInBinaryData, requestOptions).getValue().toObject(Resource.class); + } + + /** + * Test content-type: application/merge-patch+json with optional body. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a resource. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource updateOptionalResource(ResourcePatch body) { + // Generated convenience method for updateOptionalResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (body != null) { + JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, false); + requestOptions.setBody(bodyInBinaryData); + } + return updateOptionalResourceWithResponse(requestOptions).getValue().toObject(Resource.class); + } + + /** + * Test content-type: application/merge-patch+json with optional body. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a resource. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource updateOptionalResource() { + // Generated convenience method for updateOptionalResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateOptionalResourceWithResponse(requestOptions).getValue().toObject(Resource.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClientBuilder.java new file mode 100644 index 00000000000..149bcac626e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.jsonmergepatch; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import payload.jsonmergepatch.implementation.JsonMergePatchClientImpl; + +/** + * A builder for creating a new instance of the JsonMergePatchClient type. + */ +@ServiceClientBuilder(serviceClients = { JsonMergePatchClient.class, JsonMergePatchAsyncClient.class }) +public final class JsonMergePatchClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("payload-jsonmergepatch.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the JsonMergePatchClientBuilder. + */ + @Generated + public JsonMergePatchClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonMergePatchClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonMergePatchClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonMergePatchClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonMergePatchClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonMergePatchClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonMergePatchClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonMergePatchClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonMergePatchClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the JsonMergePatchClientBuilder. + */ + @Generated + public JsonMergePatchClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of JsonMergePatchClientImpl with the provided parameters. + * + * @return an instance of JsonMergePatchClientImpl. + */ + @Generated + private JsonMergePatchClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + JsonMergePatchClientImpl client = new JsonMergePatchClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of JsonMergePatchAsyncClient class. + * + * @return an instance of JsonMergePatchAsyncClient. + */ + @Generated + public JsonMergePatchAsyncClient buildAsyncClient() { + return new JsonMergePatchAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of JsonMergePatchClient class. + * + * @return an instance of JsonMergePatchClient. + */ + @Generated + public JsonMergePatchClient buildClient() { + return new JsonMergePatchClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(JsonMergePatchClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java new file mode 100644 index 00000000000..78afebd7113 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java @@ -0,0 +1,625 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.jsonmergepatch.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the JsonMergePatchClient type. + */ +public final class JsonMergePatchClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final JsonMergePatchClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of JsonMergePatchClient client. + * + * @param endpoint Service host. + */ + public JsonMergePatchClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of JsonMergePatchClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public JsonMergePatchClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of JsonMergePatchClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public JsonMergePatchClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(JsonMergePatchClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for JsonMergePatchClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "JsonMergePatchClient") + public interface JsonMergePatchClientService { + @Put("/json-merge-patch/create/resource") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createResource(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/json-merge-patch/create/resource") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createResourceSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Patch("/json-merge-patch/update/resource") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateResource(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); + + @Patch("/json-merge-patch/update/resource") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateResourceSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions, Context context); + + @Patch("/json-merge-patch/update/resource/optional") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateOptionalResource(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Patch("/json-merge-patch/update/resource/optional") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateOptionalResourceSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * Test content-type: application/merge-patch+json with required body. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createResourceWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.createResource(this.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * Test content-type: application/merge-patch+json with required body. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createResourceWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createResourceSync(this.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * Test content-type: application/merge-patch+json with required body. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateResourceWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.updateResource(this.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * Test content-type: application/merge-patch+json with required body. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateResourceWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.updateResourceSync(this.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * Test content-type: application/merge-patch+json with optional body. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/merge-patch+json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateOptionalResourceWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/merge-patch+json"); + } + }); + return FluxUtil.withContext( + context -> service.updateOptionalResource(this.getEndpoint(), accept, requestOptionsLocal, context)); + } + + /** + * Test content-type: application/merge-patch+json with optional body. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/merge-patch+json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional): {
+     *         String (Required): {
+     *             name: String (Optional)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     intValue: Integer (Optional)
+     *     floatValue: Double (Optional)
+     *     innerModel (Optional): (recursive schema, see innerModel above)
+     *     intArray (Optional): [
+     *         int (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return details about a resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateOptionalResourceWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/merge-patch+json"); + } + }); + return service.updateOptionalResourceSync(this.getEndpoint(), accept, requestOptionsLocal, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchHelper.java new file mode 100644 index 00000000000..e9ca845bf98 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchHelper.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.jsonmergepatch.implementation; + +import payload.jsonmergepatch.models.InnerModel; +import payload.jsonmergepatch.models.ResourcePatch; + +/** + * This is the Helper class to enable json merge patch serialization for a model. + */ +public class JsonMergePatchHelper { + private static InnerModelAccessor innerModelAccessor; + + public interface InnerModelAccessor { + InnerModel prepareModelForJsonMergePatch(InnerModel innerModel, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(InnerModel innerModel); + } + + public static void setInnerModelAccessor(InnerModelAccessor accessor) { + innerModelAccessor = accessor; + } + + public static InnerModelAccessor getInnerModelAccessor() { + return innerModelAccessor; + } + + private static ResourcePatchAccessor resourcePatchAccessor; + + public interface ResourcePatchAccessor { + ResourcePatch prepareModelForJsonMergePatch(ResourcePatch resourcePatch, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(ResourcePatch resourcePatch); + } + + public static void setResourcePatchAccessor(ResourcePatchAccessor accessor) { + resourcePatchAccessor = accessor; + } + + public static ResourcePatchAccessor getResourcePatchAccessor() { + return resourcePatchAccessor; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/package-info.java new file mode 100644 index 00000000000..1e763224f5d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for JsonMergePatch. + * Test for merge-patch+json content-type. + * + */ +package payload.jsonmergepatch.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/InnerModel.java new file mode 100644 index 00000000000..b09eee2b354 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/InnerModel.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.jsonmergepatch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import payload.jsonmergepatch.implementation.JsonMergePatchHelper; + +/** + * It is the model used by Resource model. + */ +@Fluent +public final class InnerModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private String name; + + /* + * The description property. + */ + @Generated + private String description; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setInnerModelAccessor(new JsonMergePatchHelper.InnerModelAccessor() { + @Override + public InnerModel prepareModelForJsonMergePatch(InnerModel model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(InnerModel model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of InnerModel class. + */ + @Generated + public InnerModel() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the InnerModel object itself. + */ + @Generated + public InnerModel setName(String name) { + this.name = name; + this.updatedProperties.add("name"); + return this; + } + + /** + * Get the description property: The description property. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description property. + * + * @param description the description value to set. + * @return the InnerModel object itself. + */ + @Generated + public InnerModel setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("name")) { + if (this.name == null) { + jsonWriter.writeNullField("name"); + } else { + jsonWriter.writeStringField("name", this.name); + } + } + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InnerModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the InnerModel. + */ + @Generated + public static InnerModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InnerModel deserializedInnerModel = new InnerModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedInnerModel.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedInnerModel.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInnerModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/Resource.java new file mode 100644 index 00000000000..1f7f1b7c967 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/Resource.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.jsonmergepatch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Details about a resource. + */ +@Fluent +public final class Resource implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The description property. + */ + @Generated + private String description; + + /* + * The map property. + */ + @Generated + private Map map; + + /* + * The array property. + */ + @Generated + private List array; + + /* + * The intValue property. + */ + @Generated + private Integer intValue; + + /* + * The floatValue property. + */ + @Generated + private Double floatValue; + + /* + * The innerModel property. + */ + @Generated + private InnerModel innerModel; + + /* + * The intArray property. + */ + @Generated + private List intArray; + + /** + * Creates an instance of Resource class. + * + * @param name the name value to set. + */ + @Generated + public Resource(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the description property: The description property. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description property. + * + * @param description the description value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the map property: The map property. + * + * @return the map value. + */ + @Generated + public Map getMap() { + return this.map; + } + + /** + * Set the map property: The map property. + * + * @param map the map value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setMap(Map map) { + this.map = map; + return this; + } + + /** + * Get the array property: The array property. + * + * @return the array value. + */ + @Generated + public List getArray() { + return this.array; + } + + /** + * Set the array property: The array property. + * + * @param array the array value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setArray(List array) { + this.array = array; + return this; + } + + /** + * Get the intValue property: The intValue property. + * + * @return the intValue value. + */ + @Generated + public Integer getIntValue() { + return this.intValue; + } + + /** + * Set the intValue property: The intValue property. + * + * @param intValue the intValue value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setIntValue(Integer intValue) { + this.intValue = intValue; + return this; + } + + /** + * Get the floatValue property: The floatValue property. + * + * @return the floatValue value. + */ + @Generated + public Double getFloatValue() { + return this.floatValue; + } + + /** + * Set the floatValue property: The floatValue property. + * + * @param floatValue the floatValue value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setFloatValue(Double floatValue) { + this.floatValue = floatValue; + return this; + } + + /** + * Get the innerModel property: The innerModel property. + * + * @return the innerModel value. + */ + @Generated + public InnerModel getInnerModel() { + return this.innerModel; + } + + /** + * Set the innerModel property: The innerModel property. + * + * @param innerModel the innerModel value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setInnerModel(InnerModel innerModel) { + this.innerModel = innerModel; + return this; + } + + /** + * Get the intArray property: The intArray property. + * + * @return the intArray value. + */ + @Generated + public List getIntArray() { + return this.intArray; + } + + /** + * Set the intArray property: The intArray property. + * + * @param intArray the intArray value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setIntArray(List intArray) { + this.intArray = intArray; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeMapField("map", this.map, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("intValue", this.intValue); + jsonWriter.writeNumberField("floatValue", this.floatValue); + jsonWriter.writeJsonField("innerModel", this.innerModel); + jsonWriter.writeArrayField("intArray", this.intArray, (writer, element) -> writer.writeInt(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Resource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Resource. + */ + @Generated + public static Resource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String description = null; + Map map = null; + List array = null; + Integer intValue = null; + Double floatValue = null; + InnerModel innerModel = null; + List intArray = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("map".equals(fieldName)) { + map = reader.readMap(reader1 -> InnerModel.fromJson(reader1)); + } else if ("array".equals(fieldName)) { + array = reader.readArray(reader1 -> InnerModel.fromJson(reader1)); + } else if ("intValue".equals(fieldName)) { + intValue = reader.getNullable(JsonReader::getInt); + } else if ("floatValue".equals(fieldName)) { + floatValue = reader.getNullable(JsonReader::getDouble); + } else if ("innerModel".equals(fieldName)) { + innerModel = InnerModel.fromJson(reader); + } else if ("intArray".equals(fieldName)) { + intArray = reader.readArray(reader1 -> reader1.getInt()); + } else { + reader.skipChildren(); + } + } + Resource deserializedResource = new Resource(name); + deserializedResource.description = description; + deserializedResource.map = map; + deserializedResource.array = array; + deserializedResource.intValue = intValue; + deserializedResource.floatValue = floatValue; + deserializedResource.innerModel = innerModel; + deserializedResource.intArray = intArray; + + return deserializedResource; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/ResourcePatch.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/ResourcePatch.java new file mode 100644 index 00000000000..6a39adbcb9b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/ResourcePatch.java @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.jsonmergepatch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import payload.jsonmergepatch.implementation.JsonMergePatchHelper; + +/** + * Details about a resource for patch operation. + */ +@Fluent +public final class ResourcePatch implements JsonSerializable { + /* + * The description property. + */ + @Generated + private String description; + + /* + * The map property. + */ + @Generated + private Map map; + + /* + * The array property. + */ + @Generated + private List array; + + /* + * The intValue property. + */ + @Generated + private Integer intValue; + + /* + * The floatValue property. + */ + @Generated + private Double floatValue; + + /* + * The innerModel property. + */ + @Generated + private InnerModel innerModel; + + /* + * The intArray property. + */ + @Generated + private List intArray; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setResourcePatchAccessor(new JsonMergePatchHelper.ResourcePatchAccessor() { + @Override + public ResourcePatch prepareModelForJsonMergePatch(ResourcePatch model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(ResourcePatch model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of ResourcePatch class. + */ + @Generated + public ResourcePatch() { + } + + /** + * Get the description property: The description property. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description property. + * + * @param description the description value to set. + * @return the ResourcePatch object itself. + */ + @Generated + public ResourcePatch setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * Get the map property: The map property. + * + * @return the map value. + */ + @Generated + public Map getMap() { + return this.map; + } + + /** + * Set the map property: The map property. + * + * @param map the map value to set. + * @return the ResourcePatch object itself. + */ + @Generated + public ResourcePatch setMap(Map map) { + this.map = map; + this.updatedProperties.add("map"); + return this; + } + + /** + * Get the array property: The array property. + * + * @return the array value. + */ + @Generated + public List getArray() { + return this.array; + } + + /** + * Set the array property: The array property. + * + * @param array the array value to set. + * @return the ResourcePatch object itself. + */ + @Generated + public ResourcePatch setArray(List array) { + this.array = array; + this.updatedProperties.add("array"); + return this; + } + + /** + * Get the intValue property: The intValue property. + * + * @return the intValue value. + */ + @Generated + public Integer getIntValue() { + return this.intValue; + } + + /** + * Set the intValue property: The intValue property. + * + * @param intValue the intValue value to set. + * @return the ResourcePatch object itself. + */ + @Generated + public ResourcePatch setIntValue(Integer intValue) { + this.intValue = intValue; + this.updatedProperties.add("intValue"); + return this; + } + + /** + * Get the floatValue property: The floatValue property. + * + * @return the floatValue value. + */ + @Generated + public Double getFloatValue() { + return this.floatValue; + } + + /** + * Set the floatValue property: The floatValue property. + * + * @param floatValue the floatValue value to set. + * @return the ResourcePatch object itself. + */ + @Generated + public ResourcePatch setFloatValue(Double floatValue) { + this.floatValue = floatValue; + this.updatedProperties.add("floatValue"); + return this; + } + + /** + * Get the innerModel property: The innerModel property. + * + * @return the innerModel value. + */ + @Generated + public InnerModel getInnerModel() { + return this.innerModel; + } + + /** + * Set the innerModel property: The innerModel property. + * + * @param innerModel the innerModel value to set. + * @return the ResourcePatch object itself. + */ + @Generated + public ResourcePatch setInnerModel(InnerModel innerModel) { + this.innerModel = innerModel; + this.updatedProperties.add("innerModel"); + return this; + } + + /** + * Get the intArray property: The intArray property. + * + * @return the intArray value. + */ + @Generated + public List getIntArray() { + return this.intArray; + } + + /** + * Set the intArray property: The intArray property. + * + * @param intArray the intArray value to set. + * @return the ResourcePatch object itself. + */ + @Generated + public ResourcePatch setIntArray(List intArray) { + this.intArray = intArray; + this.updatedProperties.add("intArray"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeMapField("map", this.map, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("intValue", this.intValue); + jsonWriter.writeNumberField("floatValue", this.floatValue); + jsonWriter.writeJsonField("innerModel", this.innerModel); + jsonWriter.writeArrayField("intArray", this.intArray, (writer, element) -> writer.writeInt(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + if (updatedProperties.contains("map")) { + if (this.map == null) { + jsonWriter.writeNullField("map"); + } else { + jsonWriter.writeMapField("map", this.map, (writer, element) -> { + if (element != null) { + JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(element, true); + writer.writeJson(element); + JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(element, false); + } else { + writer.writeNull(); + } + }); + } + } + if (updatedProperties.contains("array")) { + if (this.array == null) { + jsonWriter.writeNullField("array"); + } else { + jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element)); + } + } + if (updatedProperties.contains("intValue")) { + if (this.intValue == null) { + jsonWriter.writeNullField("intValue"); + } else { + jsonWriter.writeNumberField("intValue", this.intValue); + } + } + if (updatedProperties.contains("floatValue")) { + if (this.floatValue == null) { + jsonWriter.writeNullField("floatValue"); + } else { + jsonWriter.writeNumberField("floatValue", this.floatValue); + } + } + if (updatedProperties.contains("innerModel")) { + if (this.innerModel == null) { + jsonWriter.writeNullField("innerModel"); + } else { + JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(this.innerModel, true); + jsonWriter.writeJsonField("innerModel", this.innerModel); + JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(this.innerModel, false); + } + } + if (updatedProperties.contains("intArray")) { + if (this.intArray == null) { + jsonWriter.writeNullField("intArray"); + } else { + jsonWriter.writeArrayField("intArray", this.intArray, (writer, element) -> writer.writeInt(element)); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourcePatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourcePatch if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourcePatch. + */ + @Generated + public static ResourcePatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourcePatch deserializedResourcePatch = new ResourcePatch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedResourcePatch.description = reader.getString(); + } else if ("map".equals(fieldName)) { + Map map = reader.readMap(reader1 -> InnerModel.fromJson(reader1)); + deserializedResourcePatch.map = map; + } else if ("array".equals(fieldName)) { + List array = reader.readArray(reader1 -> InnerModel.fromJson(reader1)); + deserializedResourcePatch.array = array; + } else if ("intValue".equals(fieldName)) { + deserializedResourcePatch.intValue = reader.getNullable(JsonReader::getInt); + } else if ("floatValue".equals(fieldName)) { + deserializedResourcePatch.floatValue = reader.getNullable(JsonReader::getDouble); + } else if ("innerModel".equals(fieldName)) { + deserializedResourcePatch.innerModel = InnerModel.fromJson(reader); + } else if ("intArray".equals(fieldName)) { + List intArray = reader.readArray(reader1 -> reader1.getInt()); + deserializedResourcePatch.intArray = intArray; + } else { + reader.skipChildren(); + } + } + + return deserializedResourcePatch; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/package-info.java new file mode 100644 index 00000000000..ca0638171f9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for JsonMergePatch. + * Test for merge-patch+json content-type. + * + */ +package payload.jsonmergepatch.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/package-info.java new file mode 100644 index 00000000000..6e3df942262 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/jsonmergepatch/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for JsonMergePatch. + * Test for merge-patch+json content-type. + * + */ +package payload.jsonmergepatch; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeAsyncClient.java new file mode 100644 index 00000000000..0f46513bbb1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeAsyncClient.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.mediatype; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import payload.mediatype.implementation.StringBodiesImpl; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous MediaTypeClient type. + */ +@ServiceClient(builder = MediaTypeClientBuilder.class, isAsync = true) +public final class MediaTypeAsyncClient { + @Generated + private final StringBodiesImpl serviceClient; + + /** + * Initializes an instance of MediaTypeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MediaTypeAsyncClient(StringBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The sendAsText operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param text The text parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendAsTextWithResponse(BinaryData text, RequestOptions requestOptions) { + return this.serviceClient.sendAsTextWithResponseAsync(text, requestOptions); + } + + /** + * The getAsText operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAsTextWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAsTextWithResponseAsync(requestOptions); + } + + /** + * The sendAsJson operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param text The text parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendAsJsonWithResponse(BinaryData text, RequestOptions requestOptions) { + return this.serviceClient.sendAsJsonWithResponseAsync(text, requestOptions); + } + + /** + * The getAsJson operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAsJsonWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAsJsonWithResponseAsync(requestOptions); + } + + /** + * The sendAsText operation. + * + * @param text The text parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono sendAsText(String text) { + // Generated convenience method for sendAsTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + return sendAsTextWithResponse(BinaryData.fromString(text), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getAsText operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sequence of textual characters on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsText() { + // Generated convenience method for getAsTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAsTextWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toString()); + } + + /** + * The sendAsJson operation. + * + * @param text The text parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono sendAsJson(String text) { + // Generated convenience method for sendAsJsonWithResponse + RequestOptions requestOptions = new RequestOptions(); + return sendAsJsonWithResponse(BinaryData.fromObject(text), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getAsJson operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sequence of textual characters on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsJson() { + // Generated convenience method for getAsJsonWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAsJsonWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(String.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClient.java new file mode 100644 index 00000000000..c436537812f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClient.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.mediatype; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import payload.mediatype.implementation.StringBodiesImpl; + +/** + * Initializes a new instance of the synchronous MediaTypeClient type. + */ +@ServiceClient(builder = MediaTypeClientBuilder.class) +public final class MediaTypeClient { + @Generated + private final StringBodiesImpl serviceClient; + + /** + * Initializes an instance of MediaTypeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MediaTypeClient(StringBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The sendAsText operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param text The text parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendAsTextWithResponse(BinaryData text, RequestOptions requestOptions) { + return this.serviceClient.sendAsTextWithResponse(text, requestOptions); + } + + /** + * The getAsText operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAsTextWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAsTextWithResponse(requestOptions); + } + + /** + * The sendAsJson operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param text The text parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendAsJsonWithResponse(BinaryData text, RequestOptions requestOptions) { + return this.serviceClient.sendAsJsonWithResponse(text, requestOptions); + } + + /** + * The getAsJson operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAsJsonWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAsJsonWithResponse(requestOptions); + } + + /** + * The sendAsText operation. + * + * @param text The text parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void sendAsText(String text) { + // Generated convenience method for sendAsTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + sendAsTextWithResponse(BinaryData.fromString(text), requestOptions).getValue(); + } + + /** + * The getAsText operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sequence of textual characters. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public String getAsText() { + // Generated convenience method for getAsTextWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAsTextWithResponse(requestOptions).getValue().toString(); + } + + /** + * The sendAsJson operation. + * + * @param text The text parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void sendAsJson(String text) { + // Generated convenience method for sendAsJsonWithResponse + RequestOptions requestOptions = new RequestOptions(); + sendAsJsonWithResponse(BinaryData.fromObject(text), requestOptions).getValue(); + } + + /** + * The getAsJson operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sequence of textual characters. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public String getAsJson() { + // Generated convenience method for getAsJsonWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAsJsonWithResponse(requestOptions).getValue().toObject(String.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClientBuilder.java new file mode 100644 index 00000000000..51931beb8c7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/MediaTypeClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.mediatype; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import payload.mediatype.implementation.MediaTypeClientImpl; + +/** + * A builder for creating a new instance of the MediaTypeClient type. + */ +@ServiceClientBuilder(serviceClients = { MediaTypeClient.class, MediaTypeAsyncClient.class }) +public final class MediaTypeClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("payload-mediatype.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the MediaTypeClientBuilder. + */ + @Generated + public MediaTypeClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MediaTypeClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MediaTypeClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MediaTypeClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MediaTypeClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MediaTypeClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MediaTypeClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MediaTypeClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MediaTypeClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the MediaTypeClientBuilder. + */ + @Generated + public MediaTypeClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of MediaTypeClientImpl with the provided parameters. + * + * @return an instance of MediaTypeClientImpl. + */ + @Generated + private MediaTypeClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + MediaTypeClientImpl client + = new MediaTypeClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of MediaTypeAsyncClient class. + * + * @return an instance of MediaTypeAsyncClient. + */ + @Generated + public MediaTypeAsyncClient buildAsyncClient() { + return new MediaTypeAsyncClient(buildInnerClient().getStringBodies()); + } + + /** + * Builds an instance of MediaTypeClient class. + * + * @return an instance of MediaTypeClient. + */ + @Generated + public MediaTypeClient buildClient() { + return new MediaTypeClient(buildInnerClient().getStringBodies()); + } + + private static final ClientLogger LOGGER = new ClientLogger(MediaTypeClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java new file mode 100644 index 00000000000..7747e38a777 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.mediatype.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 MediaTypeClient type. + */ +public final class MediaTypeClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 StringBodiesImpl object to access its operations. + */ + private final StringBodiesImpl stringBodies; + + /** + * Gets the StringBodiesImpl object to access its operations. + * + * @return the StringBodiesImpl object. + */ + public StringBodiesImpl getStringBodies() { + return this.stringBodies; + } + + /** + * Initializes an instance of MediaTypeClient client. + * + * @param endpoint Service host. + */ + public MediaTypeClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of MediaTypeClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public MediaTypeClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of MediaTypeClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public MediaTypeClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.stringBodies = new StringBodiesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/StringBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/StringBodiesImpl.java new file mode 100644 index 00000000000..e7a784ff33c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/StringBodiesImpl.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.mediatype.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringBodies. + */ +public final class StringBodiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringBodiesService service; + + /** + * The service client containing this operation class. + */ + private final MediaTypeClientImpl client; + + /** + * Initializes an instance of StringBodiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringBodiesImpl(MediaTypeClientImpl client) { + this.service + = RestProxy.create(StringBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MediaTypeClientStringBodies to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MediaTypeClientStringBodies") + public interface StringBodiesService { + @Post("/payload/media-type/string-body/sendAsText") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> sendAsText(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("text/plain") BinaryData text, + RequestOptions requestOptions, Context context); + + @Post("/payload/media-type/string-body/sendAsText") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendAsTextSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("text/plain") BinaryData text, + RequestOptions requestOptions, Context context); + + @Get("/payload/media-type/string-body/getAsText") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAsText(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/payload/media-type/string-body/getAsText") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAsTextSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/payload/media-type/string-body/sendAsJson") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> sendAsJson(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData text, + RequestOptions requestOptions, Context context); + + @Post("/payload/media-type/string-body/sendAsJson") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendAsJsonSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData text, + RequestOptions requestOptions, Context context); + + @Get("/payload/media-type/string-body/getAsJson") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAsJson(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/payload/media-type/string-body/getAsJson") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAsJsonSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The sendAsText operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param text The text parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendAsTextWithResponseAsync(BinaryData text, RequestOptions requestOptions) { + final String contentType = "text/plain"; + return FluxUtil.withContext( + context -> service.sendAsText(this.client.getEndpoint(), contentType, text, requestOptions, context)); + } + + /** + * The sendAsText operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param text The text parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendAsTextWithResponse(BinaryData text, RequestOptions requestOptions) { + final String contentType = "text/plain"; + return service.sendAsTextSync(this.client.getEndpoint(), contentType, text, requestOptions, Context.NONE); + } + + /** + * The getAsText operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAsTextWithResponseAsync(RequestOptions requestOptions) { + final String accept = "text/plain"; + return FluxUtil + .withContext(context -> service.getAsText(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getAsText operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAsTextWithResponse(RequestOptions requestOptions) { + final String accept = "text/plain"; + return service.getAsTextSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The sendAsJson operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param text The text parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendAsJsonWithResponseAsync(BinaryData text, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.sendAsJson(this.client.getEndpoint(), contentType, text, requestOptions, context)); + } + + /** + * The sendAsJson operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param text The text parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendAsJsonWithResponse(BinaryData text, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendAsJsonSync(this.client.getEndpoint(), contentType, text, requestOptions, Context.NONE); + } + + /** + * The getAsJson operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAsJsonWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAsJson(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getAsJson operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAsJsonWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAsJsonSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/package-info.java new file mode 100644 index 00000000000..ad53c1a390c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for MediaType. + * Test the payload with different media types and different types of the payload itself. + * + */ +package payload.mediatype.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/package-info.java new file mode 100644 index 00000000000..ffe9542e3d9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/mediatype/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for MediaType. + * Test the payload with different media types and different types of the payload itself. + * + */ +package payload.mediatype; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataAsyncClient.java new file mode 100644 index 00000000000..56cbe49d0f5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataAsyncClient.java @@ -0,0 +1,369 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import java.util.stream.Collectors; +import payload.multipart.formdata.models.AnonymousModelRequest; +import payload.multipart.implementation.FormDatasImpl; +import payload.multipart.implementation.MultipartFormDataHelper; +import payload.multipart.models.BinaryArrayPartsRequest; +import payload.multipart.models.ComplexPartsRequest; +import payload.multipart.models.JsonPartRequest; +import payload.multipart.models.MultiBinaryPartsRequest; +import payload.multipart.models.MultiPartRequest; +import payload.multipart.models.PicturesFileDetails; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous MultiPartClient type. + */ +@ServiceClient(builder = MultiPartClientBuilder.class, isAsync = true) +public final class FormDataAsyncClient { + @Generated + private final FormDatasImpl serviceClient; + + /** + * Initializes an instance of FormDataAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FormDataAsyncClient(FormDatasImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> basicWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'basic' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.basicWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for mixed scenarios. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> fileArrayAndBasicWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'fileArrayAndBasic' is of content-type 'multipart/form-data'. Protocol API is not usable and hence + // not generated. + return this.serviceClient.fileArrayAndBasicWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for scenario contains json part and binary part. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> jsonPartWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'jsonPart' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.jsonPartWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for scenario contains multi binary parts. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> binaryArrayPartsWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'binaryArrayParts' is of content-type 'multipart/form-data'. Protocol API is not usable and hence + // not generated. + return this.serviceClient.binaryArrayPartsWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for scenario contains multi binary parts. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> multiBinaryPartsWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'multiBinaryParts' is of content-type 'multipart/form-data'. Protocol API is not usable and hence + // not generated. + return this.serviceClient.multiBinaryPartsWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> checkFileNameAndContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'checkFileNameAndContentType' is of content-type 'multipart/form-data'. Protocol API is not usable + // and hence not generated. + return this.serviceClient.checkFileNameAndContentTypeWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> anonymousModelWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'anonymousModel' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.anonymousModelWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono basic(MultiPartRequest body) { + // Generated convenience method for basicWithResponse + RequestOptions requestOptions = new RequestOptions(); + return basicWithResponse(new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test content-type: multipart/form-data for mixed scenarios. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fileArrayAndBasic(ComplexPartsRequest body) { + // Generated convenience method for fileArrayAndBasicWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fileArrayAndBasicWithResponse( + new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) + .serializeJsonField("address", body.getAddress()) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .serializeFileFields("pictures", + body.getPictures().stream().map(PicturesFileDetails::getContent).collect(Collectors.toList()), + body.getPictures().stream().map(PicturesFileDetails::getContentType).collect(Collectors.toList()), + body.getPictures().stream().map(PicturesFileDetails::getFilename).collect(Collectors.toList())) + .end() + .getRequestBody(), + requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test content-type: multipart/form-data for scenario contains json part and binary part. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono jsonPart(JsonPartRequest body) { + // Generated convenience method for jsonPartWithResponse + RequestOptions requestOptions = new RequestOptions(); + return jsonPartWithResponse( + new MultipartFormDataHelper(requestOptions).serializeJsonField("address", body.getAddress()) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), + requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test content-type: multipart/form-data for scenario contains multi binary parts. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono binaryArrayParts(BinaryArrayPartsRequest body) { + // Generated convenience method for binaryArrayPartsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return binaryArrayPartsWithResponse( + new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) + .serializeFileFields("pictures", + body.getPictures().stream().map(PicturesFileDetails::getContent).collect(Collectors.toList()), + body.getPictures().stream().map(PicturesFileDetails::getContentType).collect(Collectors.toList()), + body.getPictures().stream().map(PicturesFileDetails::getFilename).collect(Collectors.toList())) + .end() + .getRequestBody(), + requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test content-type: multipart/form-data for scenario contains multi binary parts. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono multiBinaryParts(MultiBinaryPartsRequest body) { + // Generated convenience method for multiBinaryPartsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return multiBinaryPartsWithResponse(new MultipartFormDataHelper(requestOptions) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .serializeFileField("picture", body.getPicture() == null ? null : body.getPicture().getContent(), + body.getPicture() == null ? null : body.getPicture().getContentType(), + body.getPicture() == null ? null : body.getPicture().getFilename()) + .end() + .getRequestBody(), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono checkFileNameAndContentType(MultiPartRequest body) { + // Generated convenience method for checkFileNameAndContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return checkFileNameAndContentTypeWithResponse( + new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), + requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono anonymousModel(AnonymousModelRequest body) { + // Generated convenience method for anonymousModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return anonymousModelWithResponse( + new MultipartFormDataHelper(requestOptions) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), + requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataClient.java new file mode 100644 index 00000000000..6b077edb170 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataClient.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.util.stream.Collectors; +import payload.multipart.formdata.models.AnonymousModelRequest; +import payload.multipart.implementation.FormDatasImpl; +import payload.multipart.implementation.MultipartFormDataHelper; +import payload.multipart.models.BinaryArrayPartsRequest; +import payload.multipart.models.ComplexPartsRequest; +import payload.multipart.models.JsonPartRequest; +import payload.multipart.models.MultiBinaryPartsRequest; +import payload.multipart.models.MultiPartRequest; +import payload.multipart.models.PicturesFileDetails; + +/** + * Initializes a new instance of the synchronous MultiPartClient type. + */ +@ServiceClient(builder = MultiPartClientBuilder.class) +public final class FormDataClient { + @Generated + private final FormDatasImpl serviceClient; + + /** + * Initializes an instance of FormDataClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FormDataClient(FormDatasImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response basicWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'basic' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.basicWithResponse(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for mixed scenarios. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response fileArrayAndBasicWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'fileArrayAndBasic' is of content-type 'multipart/form-data'. Protocol API is not usable and hence + // not generated. + return this.serviceClient.fileArrayAndBasicWithResponse(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for scenario contains json part and binary part. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response jsonPartWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'jsonPart' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.jsonPartWithResponse(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for scenario contains multi binary parts. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response binaryArrayPartsWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'binaryArrayParts' is of content-type 'multipart/form-data'. Protocol API is not usable and hence + // not generated. + return this.serviceClient.binaryArrayPartsWithResponse(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for scenario contains multi binary parts. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response multiBinaryPartsWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'multiBinaryParts' is of content-type 'multipart/form-data'. Protocol API is not usable and hence + // not generated. + return this.serviceClient.multiBinaryPartsWithResponse(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkFileNameAndContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'checkFileNameAndContentType' is of content-type 'multipart/form-data'. Protocol API is not usable + // and hence not generated. + return this.serviceClient.checkFileNameAndContentTypeWithResponse(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response anonymousModelWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'anonymousModel' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.anonymousModelWithResponse(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void basic(MultiPartRequest body) { + // Generated convenience method for basicWithResponse + RequestOptions requestOptions = new RequestOptions(); + basicWithResponse(new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), requestOptions).getValue(); + } + + /** + * Test content-type: multipart/form-data for mixed scenarios. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fileArrayAndBasic(ComplexPartsRequest body) { + // Generated convenience method for fileArrayAndBasicWithResponse + RequestOptions requestOptions = new RequestOptions(); + fileArrayAndBasicWithResponse(new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) + .serializeJsonField("address", body.getAddress()) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .serializeFileFields("pictures", + body.getPictures().stream().map(PicturesFileDetails::getContent).collect(Collectors.toList()), + body.getPictures().stream().map(PicturesFileDetails::getContentType).collect(Collectors.toList()), + body.getPictures().stream().map(PicturesFileDetails::getFilename).collect(Collectors.toList())) + .end() + .getRequestBody(), requestOptions).getValue(); + } + + /** + * Test content-type: multipart/form-data for scenario contains json part and binary part. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void jsonPart(JsonPartRequest body) { + // Generated convenience method for jsonPartWithResponse + RequestOptions requestOptions = new RequestOptions(); + jsonPartWithResponse( + new MultipartFormDataHelper(requestOptions).serializeJsonField("address", body.getAddress()) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), + requestOptions).getValue(); + } + + /** + * Test content-type: multipart/form-data for scenario contains multi binary parts. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void binaryArrayParts(BinaryArrayPartsRequest body) { + // Generated convenience method for binaryArrayPartsWithResponse + RequestOptions requestOptions = new RequestOptions(); + binaryArrayPartsWithResponse(new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) + .serializeFileFields("pictures", + body.getPictures().stream().map(PicturesFileDetails::getContent).collect(Collectors.toList()), + body.getPictures().stream().map(PicturesFileDetails::getContentType).collect(Collectors.toList()), + body.getPictures().stream().map(PicturesFileDetails::getFilename).collect(Collectors.toList())) + .end() + .getRequestBody(), requestOptions).getValue(); + } + + /** + * Test content-type: multipart/form-data for scenario contains multi binary parts. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void multiBinaryParts(MultiBinaryPartsRequest body) { + // Generated convenience method for multiBinaryPartsWithResponse + RequestOptions requestOptions = new RequestOptions(); + multiBinaryPartsWithResponse(new MultipartFormDataHelper(requestOptions) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .serializeFileField("picture", body.getPicture() == null ? null : body.getPicture().getContent(), + body.getPicture() == null ? null : body.getPicture().getContentType(), + body.getPicture() == null ? null : body.getPicture().getFilename()) + .end() + .getRequestBody(), requestOptions).getValue(); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void checkFileNameAndContentType(MultiPartRequest body) { + // Generated convenience method for checkFileNameAndContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + checkFileNameAndContentTypeWithResponse( + new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), + requestOptions).getValue(); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void anonymousModel(AnonymousModelRequest body) { + // Generated convenience method for anonymousModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + anonymousModelWithResponse( + new MultipartFormDataHelper(requestOptions) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), + requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsAsyncClient.java new file mode 100644 index 00000000000..ac78bac81ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsAsyncClient.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import java.util.stream.Collectors; +import payload.multipart.implementation.FormDataHttpPartsImpl; +import payload.multipart.implementation.MultipartFormDataHelper; +import payload.multipart.models.ComplexHttpPartsModelRequest; +import payload.multipart.models.FileRequiredMetaData; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous MultiPartClient type. + */ +@ServiceClient(builder = MultiPartClientBuilder.class, isAsync = true) +public final class FormDataHttpPartsAsyncClient { + @Generated + private final FormDataHttpPartsImpl serviceClient; + + /** + * Initializes an instance of FormDataHttpPartsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FormDataHttpPartsAsyncClient(FormDataHttpPartsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test content-type: multipart/form-data for mixed scenarios. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> jsonArrayAndFileArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'jsonArrayAndFileArray' is of content-type 'multipart/form-data'. Protocol API is not usable and + // hence not generated. + return this.serviceClient.jsonArrayAndFileArrayWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for mixed scenarios. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono jsonArrayAndFileArray(ComplexHttpPartsModelRequest body) { + // Generated convenience method for jsonArrayAndFileArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return jsonArrayAndFileArrayWithResponse( + new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) + .serializeJsonField("address", body.getAddress()) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .serializeJsonField("previousAddresses", body.getPreviousAddresses()) + .serializeFileFields("pictures", + body.getPictures().stream().map(FileRequiredMetaData::getContent).collect(Collectors.toList()), + body.getPictures().stream().map(FileRequiredMetaData::getContentType).collect(Collectors.toList()), + body.getPictures().stream().map(FileRequiredMetaData::getFilename).collect(Collectors.toList())) + .end() + .getRequestBody(), + requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsClient.java new file mode 100644 index 00000000000..2a1059fe70e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsClient.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.util.stream.Collectors; +import payload.multipart.implementation.FormDataHttpPartsImpl; +import payload.multipart.implementation.MultipartFormDataHelper; +import payload.multipart.models.ComplexHttpPartsModelRequest; +import payload.multipart.models.FileRequiredMetaData; + +/** + * Initializes a new instance of the synchronous MultiPartClient type. + */ +@ServiceClient(builder = MultiPartClientBuilder.class) +public final class FormDataHttpPartsClient { + @Generated + private final FormDataHttpPartsImpl serviceClient; + + /** + * Initializes an instance of FormDataHttpPartsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FormDataHttpPartsClient(FormDataHttpPartsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test content-type: multipart/form-data for mixed scenarios. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response jsonArrayAndFileArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'jsonArrayAndFileArray' is of content-type 'multipart/form-data'. Protocol API is not usable and + // hence not generated. + return this.serviceClient.jsonArrayAndFileArrayWithResponse(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for mixed scenarios. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void jsonArrayAndFileArray(ComplexHttpPartsModelRequest body) { + // Generated convenience method for jsonArrayAndFileArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + jsonArrayAndFileArrayWithResponse( + new MultipartFormDataHelper(requestOptions).serializeTextField("id", body.getId()) + .serializeJsonField("address", body.getAddress()) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .serializeJsonField("previousAddresses", body.getPreviousAddresses()) + .serializeFileFields("pictures", + body.getPictures().stream().map(FileRequiredMetaData::getContent).collect(Collectors.toList()), + body.getPictures().stream().map(FileRequiredMetaData::getContentType).collect(Collectors.toList()), + body.getPictures().stream().map(FileRequiredMetaData::getFilename).collect(Collectors.toList())) + .end() + .getRequestBody(), + requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeAsyncClient.java new file mode 100644 index 00000000000..6a7ae8ceec0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeAsyncClient.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import payload.multipart.implementation.FormDataHttpPartsContentTypesImpl; +import payload.multipart.implementation.MultipartFormDataHelper; +import payload.multipart.models.FileWithHttpPartOptionalContentTypeRequest; +import payload.multipart.models.FileWithHttpPartRequiredContentTypeRequest; +import payload.multipart.models.FileWithHttpPartSpecificContentTypeRequest; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous MultiPartClient type. + */ +@ServiceClient(builder = MultiPartClientBuilder.class, isAsync = true) +public final class FormDataHttpPartsContentTypeAsyncClient { + @Generated + private final FormDataHttpPartsContentTypesImpl serviceClient; + + /** + * Initializes an instance of FormDataHttpPartsContentTypeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FormDataHttpPartsContentTypeAsyncClient(FormDataHttpPartsContentTypesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> imageJpegContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'imageJpegContentType' is of content-type 'multipart/form-data'. Protocol API is not usable and + // hence not generated. + return this.serviceClient.imageJpegContentTypeWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> requiredContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'requiredContentType' is of content-type 'multipart/form-data'. Protocol API is not usable and + // hence not generated. + return this.serviceClient.requiredContentTypeWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for optional content type. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> optionalContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'optionalContentType' is of content-type 'multipart/form-data'. Protocol API is not usable and + // hence not generated. + return this.serviceClient.optionalContentTypeWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono imageJpegContentType(FileWithHttpPartSpecificContentTypeRequest body) { + // Generated convenience method for imageJpegContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return imageJpegContentTypeWithResponse( + new MultipartFormDataHelper(requestOptions) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), + requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono requiredContentType(FileWithHttpPartRequiredContentTypeRequest body) { + // Generated convenience method for requiredContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return requiredContentTypeWithResponse( + new MultipartFormDataHelper(requestOptions) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), + requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test content-type: multipart/form-data for optional content type. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono optionalContentType(FileWithHttpPartOptionalContentTypeRequest body) { + // Generated convenience method for optionalContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return optionalContentTypeWithResponse( + new MultipartFormDataHelper(requestOptions) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), + requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeClient.java new file mode 100644 index 00000000000..ba6a6786b93 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsContentTypeClient.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import payload.multipart.implementation.FormDataHttpPartsContentTypesImpl; +import payload.multipart.implementation.MultipartFormDataHelper; +import payload.multipart.models.FileWithHttpPartOptionalContentTypeRequest; +import payload.multipart.models.FileWithHttpPartRequiredContentTypeRequest; +import payload.multipart.models.FileWithHttpPartSpecificContentTypeRequest; + +/** + * Initializes a new instance of the synchronous MultiPartClient type. + */ +@ServiceClient(builder = MultiPartClientBuilder.class) +public final class FormDataHttpPartsContentTypeClient { + @Generated + private final FormDataHttpPartsContentTypesImpl serviceClient; + + /** + * Initializes an instance of FormDataHttpPartsContentTypeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FormDataHttpPartsContentTypeClient(FormDataHttpPartsContentTypesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response imageJpegContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'imageJpegContentType' is of content-type 'multipart/form-data'. Protocol API is not usable and + // hence not generated. + return this.serviceClient.imageJpegContentTypeWithResponse(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response requiredContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'requiredContentType' is of content-type 'multipart/form-data'. Protocol API is not usable and + // hence not generated. + return this.serviceClient.requiredContentTypeWithResponse(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for optional content type. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response optionalContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'optionalContentType' is of content-type 'multipart/form-data'. Protocol API is not usable and + // hence not generated. + return this.serviceClient.optionalContentTypeWithResponse(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void imageJpegContentType(FileWithHttpPartSpecificContentTypeRequest body) { + // Generated convenience method for imageJpegContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + imageJpegContentTypeWithResponse( + new MultipartFormDataHelper(requestOptions) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), + requestOptions).getValue(); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void requiredContentType(FileWithHttpPartRequiredContentTypeRequest body) { + // Generated convenience method for requiredContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + requiredContentTypeWithResponse( + new MultipartFormDataHelper(requestOptions) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), + requestOptions).getValue(); + } + + /** + * Test content-type: multipart/form-data for optional content type. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void optionalContentType(FileWithHttpPartOptionalContentTypeRequest body) { + // Generated convenience method for optionalContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + optionalContentTypeWithResponse( + new MultipartFormDataHelper(requestOptions) + .serializeFileField("profileImage", body.getProfileImage().getContent(), + body.getProfileImage().getContentType(), body.getProfileImage().getFilename()) + .end() + .getRequestBody(), + requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringAsyncClient.java new file mode 100644 index 00000000000..3bde6e4119f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringAsyncClient.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import payload.multipart.formdata.httpparts.nonstring.models.FloatRequest; +import payload.multipart.implementation.FormDataHttpPartsNonStringsImpl; +import payload.multipart.implementation.MultipartFormDataHelper; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous MultiPartClient type. + */ +@ServiceClient(builder = MultiPartClientBuilder.class, isAsync = true) +public final class FormDataHttpPartsNonStringAsyncClient { + @Generated + private final FormDataHttpPartsNonStringsImpl serviceClient; + + /** + * Initializes an instance of FormDataHttpPartsNonStringAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FormDataHttpPartsNonStringAsyncClient(FormDataHttpPartsNonStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test content-type: multipart/form-data for non string. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> floatMethodWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'float' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.floatMethodWithResponseAsync(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for non string. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono floatMethod(FloatRequest body) { + // Generated convenience method for floatMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return floatMethodWithResponse(new MultipartFormDataHelper(requestOptions) + .serializeTextField("temperature", String.valueOf(body.getTemperature())) + .end() + .getRequestBody(), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringClient.java new file mode 100644 index 00000000000..a31ef62543a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/FormDataHttpPartsNonStringClient.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import payload.multipart.formdata.httpparts.nonstring.models.FloatRequest; +import payload.multipart.implementation.FormDataHttpPartsNonStringsImpl; +import payload.multipart.implementation.MultipartFormDataHelper; + +/** + * Initializes a new instance of the synchronous MultiPartClient type. + */ +@ServiceClient(builder = MultiPartClientBuilder.class) +public final class FormDataHttpPartsNonStringClient { + @Generated + private final FormDataHttpPartsNonStringsImpl serviceClient; + + /** + * Initializes an instance of FormDataHttpPartsNonStringClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FormDataHttpPartsNonStringClient(FormDataHttpPartsNonStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test content-type: multipart/form-data for non string. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response floatMethodWithResponse(BinaryData body, RequestOptions requestOptions) { + // Operation 'float' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.floatMethodWithResponse(body, requestOptions); + } + + /** + * Test content-type: multipart/form-data for non string. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void floatMethod(FloatRequest body) { + // Generated convenience method for floatMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + floatMethodWithResponse(new MultipartFormDataHelper(requestOptions) + .serializeTextField("temperature", String.valueOf(body.getTemperature())) + .end() + .getRequestBody(), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/MultiPartClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/MultiPartClientBuilder.java new file mode 100644 index 00000000000..73a94809558 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/MultiPartClientBuilder.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import payload.multipart.implementation.MultiPartClientImpl; + +/** + * A builder for creating a new instance of the MultiPartClient type. + */ +@ServiceClientBuilder( + serviceClients = { + FormDataClient.class, + FormDataHttpPartsClient.class, + FormDataHttpPartsContentTypeClient.class, + FormDataHttpPartsNonStringClient.class, + FormDataAsyncClient.class, + FormDataHttpPartsAsyncClient.class, + FormDataHttpPartsContentTypeAsyncClient.class, + FormDataHttpPartsNonStringAsyncClient.class }) +public final class MultiPartClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("payload-multipart.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the MultiPartClientBuilder. + */ + @Generated + public MultiPartClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiPartClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiPartClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiPartClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiPartClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiPartClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiPartClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiPartClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiPartClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the MultiPartClientBuilder. + */ + @Generated + public MultiPartClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of MultiPartClientImpl with the provided parameters. + * + * @return an instance of MultiPartClientImpl. + */ + @Generated + private MultiPartClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + MultiPartClientImpl client + = new MultiPartClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of FormDataAsyncClient class. + * + * @return an instance of FormDataAsyncClient. + */ + @Generated + public FormDataAsyncClient buildFormDataAsyncClient() { + return new FormDataAsyncClient(buildInnerClient().getFormDatas()); + } + + /** + * Builds an instance of FormDataHttpPartsAsyncClient class. + * + * @return an instance of FormDataHttpPartsAsyncClient. + */ + @Generated + public FormDataHttpPartsAsyncClient buildFormDataHttpPartsAsyncClient() { + return new FormDataHttpPartsAsyncClient(buildInnerClient().getFormDataHttpParts()); + } + + /** + * Builds an instance of FormDataHttpPartsContentTypeAsyncClient class. + * + * @return an instance of FormDataHttpPartsContentTypeAsyncClient. + */ + @Generated + public FormDataHttpPartsContentTypeAsyncClient buildFormDataHttpPartsContentTypeAsyncClient() { + return new FormDataHttpPartsContentTypeAsyncClient(buildInnerClient().getFormDataHttpPartsContentTypes()); + } + + /** + * Builds an instance of FormDataHttpPartsNonStringAsyncClient class. + * + * @return an instance of FormDataHttpPartsNonStringAsyncClient. + */ + @Generated + public FormDataHttpPartsNonStringAsyncClient buildFormDataHttpPartsNonStringAsyncClient() { + return new FormDataHttpPartsNonStringAsyncClient(buildInnerClient().getFormDataHttpPartsNonStrings()); + } + + /** + * Builds an instance of FormDataClient class. + * + * @return an instance of FormDataClient. + */ + @Generated + public FormDataClient buildFormDataClient() { + return new FormDataClient(buildInnerClient().getFormDatas()); + } + + /** + * Builds an instance of FormDataHttpPartsClient class. + * + * @return an instance of FormDataHttpPartsClient. + */ + @Generated + public FormDataHttpPartsClient buildFormDataHttpPartsClient() { + return new FormDataHttpPartsClient(buildInnerClient().getFormDataHttpParts()); + } + + /** + * Builds an instance of FormDataHttpPartsContentTypeClient class. + * + * @return an instance of FormDataHttpPartsContentTypeClient. + */ + @Generated + public FormDataHttpPartsContentTypeClient buildFormDataHttpPartsContentTypeClient() { + return new FormDataHttpPartsContentTypeClient(buildInnerClient().getFormDataHttpPartsContentTypes()); + } + + /** + * Builds an instance of FormDataHttpPartsNonStringClient class. + * + * @return an instance of FormDataHttpPartsNonStringClient. + */ + @Generated + public FormDataHttpPartsNonStringClient buildFormDataHttpPartsNonStringClient() { + return new FormDataHttpPartsNonStringClient(buildInnerClient().getFormDataHttpPartsNonStrings()); + } + + private static final ClientLogger LOGGER = new ClientLogger(MultiPartClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/FloatRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/FloatRequest.java new file mode 100644 index 00000000000..16eb7e29c3e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/FloatRequest.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.formdata.httpparts.nonstring.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; + +/** + * The FloatRequest model. + */ +@Immutable +public final class FloatRequest { + /* + * The temperature property. + */ + @Generated + private final double temperature; + + /** + * Creates an instance of FloatRequest class. + * + * @param temperature the temperature value to set. + */ + @Generated + public FloatRequest(double temperature) { + this.temperature = temperature; + } + + /** + * Get the temperature property: The temperature property. + * + * @return the temperature value. + */ + @Generated + public double getTemperature() { + return this.temperature; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/package-info.java new file mode 100644 index 00000000000..3e30b7cc133 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/httpparts/nonstring/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for MultiPart. + * Test for multipart. + * + */ +package payload.multipart.formdata.httpparts.nonstring.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/AnonymousModelRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/AnonymousModelRequest.java new file mode 100644 index 00000000000..ca7d485b92f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/AnonymousModelRequest.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.formdata.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import payload.multipart.models.ProfileImageFileDetails; + +/** + * The AnonymousModelRequest model. + */ +@Immutable +public final class AnonymousModelRequest { + /* + * The profileImage property. + */ + @Generated + private final ProfileImageFileDetails profileImage; + + /** + * Creates an instance of AnonymousModelRequest class. + * + * @param profileImage the profileImage value to set. + */ + @Generated + public AnonymousModelRequest(ProfileImageFileDetails profileImage) { + this.profileImage = profileImage; + } + + /** + * Get the profileImage property: The profileImage property. + * + * @return the profileImage value. + */ + @Generated + public ProfileImageFileDetails getProfileImage() { + return this.profileImage; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/package-info.java new file mode 100644 index 00000000000..eb621067a32 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/formdata/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for MultiPart. + * Test for multipart. + * + */ +package payload.multipart.formdata.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsContentTypesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsContentTypesImpl.java new file mode 100644 index 00000000000..8d65e0d251d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsContentTypesImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FormDataHttpPartsContentTypes. + */ +public final class FormDataHttpPartsContentTypesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FormDataHttpPartsContentTypesService service; + + /** + * The service client containing this operation class. + */ + private final MultiPartClientImpl client; + + /** + * Initializes an instance of FormDataHttpPartsContentTypesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FormDataHttpPartsContentTypesImpl(MultiPartClientImpl client) { + this.service = RestProxy.create(FormDataHttpPartsContentTypesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MultiPartClientFormDataHttpPartsContentTypes to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MultiPartClientFormDataHttpPartsContentTypes") + public interface FormDataHttpPartsContentTypesService { + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/check-filename-and-specific-content-type-with-httppart") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> imageJpegContentType(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/check-filename-and-specific-content-type-with-httppart") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response imageJpegContentTypeSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/check-filename-and-required-content-type-with-httppart") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> requiredContentType(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/check-filename-and-required-content-type-with-httppart") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response requiredContentTypeSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/file-with-http-part-optional-content-type") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> optionalContentType(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/file-with-http-part-optional-content-type") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response optionalContentTypeSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> imageJpegContentTypeWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext(context -> service.imageJpegContentType(this.client.getEndpoint(), contentType, + body, requestOptions, context)); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response imageJpegContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.imageJpegContentTypeSync(this.client.getEndpoint(), contentType, body, requestOptions, + Context.NONE); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requiredContentTypeWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext(context -> service.requiredContentType(this.client.getEndpoint(), contentType, body, + requestOptions, context)); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requiredContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.requiredContentTypeSync(this.client.getEndpoint(), contentType, body, requestOptions, + Context.NONE); + } + + /** + * Test content-type: multipart/form-data for optional content type. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> optionalContentTypeWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext(context -> service.optionalContentType(this.client.getEndpoint(), contentType, body, + requestOptions, context)); + } + + /** + * Test content-type: multipart/form-data for optional content type. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response optionalContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.optionalContentTypeSync(this.client.getEndpoint(), contentType, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsImpl.java new file mode 100644 index 00000000000..c5195f9becf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsImpl.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FormDataHttpParts. + */ +public final class FormDataHttpPartsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FormDataHttpPartsService service; + + /** + * The service client containing this operation class. + */ + private final MultiPartClientImpl client; + + /** + * Initializes an instance of FormDataHttpPartsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FormDataHttpPartsImpl(MultiPartClientImpl client) { + this.service + = RestProxy.create(FormDataHttpPartsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MultiPartClientFormDataHttpParts to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MultiPartClientFormDataHttpParts") + public interface FormDataHttpPartsService { + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/complex-parts-with-httppart") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> jsonArrayAndFileArray(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/complex-parts-with-httppart") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response jsonArrayAndFileArraySync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Test content-type: multipart/form-data for mixed scenarios. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> jsonArrayAndFileArrayWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext(context -> service.jsonArrayAndFileArray(this.client.getEndpoint(), contentType, + body, requestOptions, context)); + } + + /** + * Test content-type: multipart/form-data for mixed scenarios. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response jsonArrayAndFileArrayWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.jsonArrayAndFileArraySync(this.client.getEndpoint(), contentType, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsNonStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsNonStringsImpl.java new file mode 100644 index 00000000000..15e7c5460a2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDataHttpPartsNonStringsImpl.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FormDataHttpPartsNonStrings. + */ +public final class FormDataHttpPartsNonStringsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FormDataHttpPartsNonStringsService service; + + /** + * The service client containing this operation class. + */ + private final MultiPartClientImpl client; + + /** + * Initializes an instance of FormDataHttpPartsNonStringsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FormDataHttpPartsNonStringsImpl(MultiPartClientImpl client) { + this.service = RestProxy.create(FormDataHttpPartsNonStringsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MultiPartClientFormDataHttpPartsNonStrings to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MultiPartClientFormDataHttpPartsNonStrings") + public interface FormDataHttpPartsNonStringsService { + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/non-string-float") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> floatMethod(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/non-string-float") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response floatMethodSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Test content-type: multipart/form-data for non string. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> floatMethodWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext( + context -> service.floatMethod(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Test content-type: multipart/form-data for non string. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response floatMethodWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.floatMethodSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDatasImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDatasImpl.java new file mode 100644 index 00000000000..fdef78501b3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/FormDatasImpl.java @@ -0,0 +1,463 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FormDatas. + */ +public final class FormDatasImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FormDatasService service; + + /** + * The service client containing this operation class. + */ + private final MultiPartClientImpl client; + + /** + * Initializes an instance of FormDatasImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FormDatasImpl(MultiPartClientImpl client) { + this.service + = RestProxy.create(FormDatasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MultiPartClientFormDatas to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MultiPartClientFormDatas") + public interface FormDatasService { + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/mixed-parts") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> basic(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/mixed-parts") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response basicSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/complex-parts") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> fileArrayAndBasic(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/complex-parts") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fileArrayAndBasicSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/json-part") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> jsonPart(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/json-part") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response jsonPartSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/binary-array-parts") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> binaryArrayParts(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/binary-array-parts") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response binaryArrayPartsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/multi-binary-parts") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> multiBinaryParts(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/multi-binary-parts") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response multiBinaryPartsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/check-filename-and-content-type") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> checkFileNameAndContentType(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/check-filename-and-content-type") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response checkFileNameAndContentTypeSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/anonymous-model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> anonymousModel(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/multipart/form-data/anonymous-model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response anonymousModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> basicWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext( + context -> service.basic(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response basicWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.basicSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Test content-type: multipart/form-data for mixed scenarios. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fileArrayAndBasicWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext(context -> service.fileArrayAndBasic(this.client.getEndpoint(), contentType, body, + requestOptions, context)); + } + + /** + * Test content-type: multipart/form-data for mixed scenarios. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fileArrayAndBasicWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.fileArrayAndBasicSync(this.client.getEndpoint(), contentType, body, requestOptions, + Context.NONE); + } + + /** + * Test content-type: multipart/form-data for scenario contains json part and binary part. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> jsonPartWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext( + context -> service.jsonPart(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Test content-type: multipart/form-data for scenario contains json part and binary part. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response jsonPartWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.jsonPartSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Test content-type: multipart/form-data for scenario contains multi binary parts. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> binaryArrayPartsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext( + context -> service.binaryArrayParts(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Test content-type: multipart/form-data for scenario contains multi binary parts. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response binaryArrayPartsWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.binaryArrayPartsSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Test content-type: multipart/form-data for scenario contains multi binary parts. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> multiBinaryPartsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext( + context -> service.multiBinaryParts(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Test content-type: multipart/form-data for scenario contains multi binary parts. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response multiBinaryPartsWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.multiBinaryPartsSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> checkFileNameAndContentTypeWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext(context -> service.checkFileNameAndContentType(this.client.getEndpoint(), + contentType, body, requestOptions, context)); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkFileNameAndContentTypeWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.checkFileNameAndContentTypeSync(this.client.getEndpoint(), contentType, body, requestOptions, + Context.NONE); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> anonymousModelWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext( + context -> service.anonymousModel(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Test content-type: multipart/form-data. + * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response anonymousModelWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.anonymousModelSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultiPartClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultiPartClientImpl.java new file mode 100644 index 00000000000..084691d24cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultiPartClientImpl.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 MultiPartClient type. + */ +public final class MultiPartClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 FormDatasImpl object to access its operations. + */ + private final FormDatasImpl formDatas; + + /** + * Gets the FormDatasImpl object to access its operations. + * + * @return the FormDatasImpl object. + */ + public FormDatasImpl getFormDatas() { + return this.formDatas; + } + + /** + * The FormDataHttpPartsImpl object to access its operations. + */ + private final FormDataHttpPartsImpl formDataHttpParts; + + /** + * Gets the FormDataHttpPartsImpl object to access its operations. + * + * @return the FormDataHttpPartsImpl object. + */ + public FormDataHttpPartsImpl getFormDataHttpParts() { + return this.formDataHttpParts; + } + + /** + * The FormDataHttpPartsContentTypesImpl object to access its operations. + */ + private final FormDataHttpPartsContentTypesImpl formDataHttpPartsContentTypes; + + /** + * Gets the FormDataHttpPartsContentTypesImpl object to access its operations. + * + * @return the FormDataHttpPartsContentTypesImpl object. + */ + public FormDataHttpPartsContentTypesImpl getFormDataHttpPartsContentTypes() { + return this.formDataHttpPartsContentTypes; + } + + /** + * The FormDataHttpPartsNonStringsImpl object to access its operations. + */ + private final FormDataHttpPartsNonStringsImpl formDataHttpPartsNonStrings; + + /** + * Gets the FormDataHttpPartsNonStringsImpl object to access its operations. + * + * @return the FormDataHttpPartsNonStringsImpl object. + */ + public FormDataHttpPartsNonStringsImpl getFormDataHttpPartsNonStrings() { + return this.formDataHttpPartsNonStrings; + } + + /** + * Initializes an instance of MultiPartClient client. + * + * @param endpoint Service host. + */ + public MultiPartClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of MultiPartClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public MultiPartClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of MultiPartClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public MultiPartClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.formDatas = new FormDatasImpl(this); + this.formDataHttpParts = new FormDataHttpPartsImpl(this); + this.formDataHttpPartsContentTypes = new FormDataHttpPartsContentTypesImpl(this); + this.formDataHttpPartsNonStrings = new FormDataHttpPartsNonStringsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultipartFormDataHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultipartFormDataHelper.java new file mode 100644 index 00000000000..2abfdfa9b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/MultipartFormDataHelper.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.implementation; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.SequenceInputStream; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.UUID; + +// DO NOT modify this helper class + +public final class MultipartFormDataHelper { + /** + * Line separator for the multipart HTTP request. + */ + private static final String CRLF = "\r\n"; + + private static final String APPLICATION_OCTET_STREAM = "application/octet-stream"; + + /** + * Value to be used as part of the divider for the multipart requests. + */ + private final String boundary; + + /** + * The actual part separator in the request. This is obtained by prepending "--" to the "boundary". + */ + private final String partSeparator; + + /** + * The marker for the ending of a multipart request. This is obtained by post-pending "--" to the "partSeparator". + */ + private final String endMarker; + + /** + * Charset used for encoding the multipart HTTP request. + */ + private final Charset encoderCharset = StandardCharsets.UTF_8; + + private InputStream requestDataStream = new ByteArrayInputStream(new byte[0]); + private long requestLength = 0; + + private RequestOptions requestOptions; + private BinaryData requestBody; + + /** + * Default constructor used in the code. The boundary is a random value. + * + * @param requestOptions the RequestOptions to update + */ + public MultipartFormDataHelper(RequestOptions requestOptions) { + this(requestOptions, UUID.randomUUID().toString().substring(0, 16)); + } + + private MultipartFormDataHelper(RequestOptions requestOptions, String boundary) { + this.requestOptions = requestOptions; + this.boundary = boundary; + this.partSeparator = "--" + boundary; + this.endMarker = this.partSeparator + "--"; + } + + /** + * Gets the multipart HTTP request body. + * + * @return the BinaryData of the multipart HTTP request body + */ + public BinaryData getRequestBody() { + return requestBody; + } + + // text/plain + /** + * Formats a text/plain field for a multipart HTTP request. + * + * @param fieldName the field name + * @param value the value of the text/plain field + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper serializeTextField(String fieldName, String value) { + if (value != null) { + String serialized = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + + "\"" + CRLF + CRLF + value + CRLF; + byte[] data = serialized.getBytes(encoderCharset); + appendBytes(data); + } + return this; + } + + // application/json + /** + * Formats a application/json field for a multipart HTTP request. + * + * @param fieldName the field name + * @param jsonObject the object of the application/json field + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper serializeJsonField(String fieldName, Object jsonObject) { + if (jsonObject != null) { + String serialized + = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + "\"" + CRLF + + "Content-Type: application/json" + CRLF + CRLF + BinaryData.fromObject(jsonObject) + CRLF; + byte[] data = serialized.getBytes(encoderCharset); + appendBytes(data); + } + return this; + } + + /** + * Formats a file field for a multipart HTTP request. + * + * @param fieldName the field name + * @param file the BinaryData of the file + * @param contentType the content-type of the file + * @param filename the filename + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper serializeFileField(String fieldName, BinaryData file, String contentType, + String filename) { + if (file != null) { + if (CoreUtils.isNullOrEmpty(contentType)) { + contentType = APPLICATION_OCTET_STREAM; + } + writeFileField(fieldName, file, contentType, filename); + } + return this; + } + + /** + * Formats a file field (potentially multiple files) for a multipart HTTP request. + * + * @param fieldName the field name + * @param files the List of BinaryData of the files + * @param contentTypes the List of content-type of the files + * @param filenames the List of filenames + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper serializeFileFields(String fieldName, List files, + List contentTypes, List filenames) { + if (files != null) { + for (int i = 0; i < files.size(); ++i) { + BinaryData file = files.get(i); + String contentType = contentTypes.get(i); + if (CoreUtils.isNullOrEmpty(contentType)) { + contentType = APPLICATION_OCTET_STREAM; + } + String filename = filenames.get(i); + writeFileField(fieldName, file, contentType, filename); + } + } + return this; + } + + /** + * Ends the serialization of the multipart HTTP request. + * + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper end() { + byte[] data = endMarker.getBytes(encoderCharset); + appendBytes(data); + + requestBody = BinaryData.fromStream(requestDataStream, requestLength); + + requestOptions.setHeader(HttpHeaderName.CONTENT_TYPE, "multipart/form-data; boundary=" + this.boundary) + .setHeader(HttpHeaderName.CONTENT_LENGTH, String.valueOf(requestLength)); + + return this; + } + + private void writeFileField(String fieldName, BinaryData file, String contentType, String filename) { + String contentDispositionFilename = ""; + if (!CoreUtils.isNullOrEmpty(filename)) { + contentDispositionFilename = "; filename=\"" + escapeName(filename) + "\""; + } + + // Multipart preamble + String fileFieldPreamble + = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + "\"" + + contentDispositionFilename + CRLF + "Content-Type: " + contentType + CRLF + CRLF; + byte[] data = fileFieldPreamble.getBytes(encoderCharset); + appendBytes(data); + + // Writing the file into the request as a byte stream + requestLength += file.getLength(); + requestDataStream = new SequenceInputStream(requestDataStream, file.toStream()); + + // CRLF + data = CRLF.getBytes(encoderCharset); + appendBytes(data); + } + + private void appendBytes(byte[] bytes) { + requestLength += bytes.length; + requestDataStream = new SequenceInputStream(requestDataStream, new ByteArrayInputStream(bytes)); + } + + private static String escapeName(String name) { + return name.replace("\n", "%0A").replace("\r", "%0D").replace("\"", "%22"); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/package-info.java new file mode 100644 index 00000000000..517ca8ab146 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for MultiPart. + * Test for multipart. + * + */ +package payload.multipart.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/Address.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/Address.java new file mode 100644 index 00000000000..94d3789f103 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/Address.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Address model. + */ +@Immutable +public final class Address implements JsonSerializable
{ + /* + * The city property. + */ + @Generated + private final String city; + + /** + * Creates an instance of Address class. + * + * @param city the city value to set. + */ + @Generated + public Address(String city) { + this.city = city; + } + + /** + * Get the city property: The city property. + * + * @return the city value. + */ + @Generated + public String getCity() { + return this.city; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("city", this.city); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Address from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Address if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Address. + */ + @Generated + public static Address fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String city = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("city".equals(fieldName)) { + city = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Address(city); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/BinaryArrayPartsRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/BinaryArrayPartsRequest.java new file mode 100644 index 00000000000..6e2236bf2b8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/BinaryArrayPartsRequest.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import java.util.List; + +/** + * The BinaryArrayPartsRequest model. + */ +@Immutable +public final class BinaryArrayPartsRequest { + /* + * The id property. + */ + @Generated + private final String id; + + /* + * The pictures property. + */ + @Generated + private final List pictures; + + /** + * Creates an instance of BinaryArrayPartsRequest class. + * + * @param id the id value to set. + * @param pictures the pictures value to set. + */ + @Generated + public BinaryArrayPartsRequest(String id, List pictures) { + this.id = id; + this.pictures = pictures; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the pictures property: The pictures property. + * + * @return the pictures value. + */ + @Generated + public List getPictures() { + return this.pictures; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexHttpPartsModelRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexHttpPartsModelRequest.java new file mode 100644 index 00000000000..526fe1ed946 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexHttpPartsModelRequest.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import java.util.List; + +/** + * The ComplexHttpPartsModelRequest model. + */ +@Immutable +public final class ComplexHttpPartsModelRequest { + /* + * The id property. + */ + @Generated + private final String id; + + /* + * The address property. + */ + @Generated + private final Address address; + + /* + * The profileImage property. + */ + @Generated + private final FileRequiredMetaData profileImage; + + /* + * The previousAddresses property. + */ + @Generated + private final List
previousAddresses; + + /* + * The pictures property. + */ + @Generated + private final List pictures; + + /** + * Creates an instance of ComplexHttpPartsModelRequest class. + * + * @param id the id value to set. + * @param address the address value to set. + * @param profileImage the profileImage value to set. + * @param previousAddresses the previousAddresses value to set. + * @param pictures the pictures value to set. + */ + @Generated + public ComplexHttpPartsModelRequest(String id, Address address, FileRequiredMetaData profileImage, + List
previousAddresses, List pictures) { + this.id = id; + this.address = address; + this.profileImage = profileImage; + this.previousAddresses = previousAddresses; + this.pictures = pictures; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the address property: The address property. + * + * @return the address value. + */ + @Generated + public Address getAddress() { + return this.address; + } + + /** + * Get the profileImage property: The profileImage property. + * + * @return the profileImage value. + */ + @Generated + public FileRequiredMetaData getProfileImage() { + return this.profileImage; + } + + /** + * Get the previousAddresses property: The previousAddresses property. + * + * @return the previousAddresses value. + */ + @Generated + public List
getPreviousAddresses() { + return this.previousAddresses; + } + + /** + * Get the pictures property: The pictures property. + * + * @return the pictures value. + */ + @Generated + public List getPictures() { + return this.pictures; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexPartsRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexPartsRequest.java new file mode 100644 index 00000000000..ec5ad76b21d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ComplexPartsRequest.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import java.util.List; + +/** + * The ComplexPartsRequest model. + */ +@Immutable +public final class ComplexPartsRequest { + /* + * The id property. + */ + @Generated + private final String id; + + /* + * The address property. + */ + @Generated + private final Address address; + + /* + * The profileImage property. + */ + @Generated + private final ProfileImageFileDetails profileImage; + + /* + * The pictures property. + */ + @Generated + private final List pictures; + + /** + * Creates an instance of ComplexPartsRequest class. + * + * @param id the id value to set. + * @param address the address value to set. + * @param profileImage the profileImage value to set. + * @param pictures the pictures value to set. + */ + @Generated + public ComplexPartsRequest(String id, Address address, ProfileImageFileDetails profileImage, + List pictures) { + this.id = id; + this.address = address; + this.profileImage = profileImage; + this.pictures = pictures; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the address property: The address property. + * + * @return the address value. + */ + @Generated + public Address getAddress() { + return this.address; + } + + /** + * Get the profileImage property: The profileImage property. + * + * @return the profileImage value. + */ + @Generated + public ProfileImageFileDetails getProfileImage() { + return this.profileImage; + } + + /** + * Get the pictures property: The pictures property. + * + * @return the pictures value. + */ + @Generated + public List getPictures() { + return this.pictures; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileOptionalContentType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileOptionalContentType.java new file mode 100644 index 00000000000..5a234481a17 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileOptionalContentType.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; + +/** + * The file details for the "profileImage" field. + */ +@Fluent +public final class FileOptionalContentType { + /* + * The content of the file. + */ + @Generated + private final BinaryData content; + + /* + * The filename of the file. + */ + @Generated + private final String filename; + + /* + * The content-type of the file. + */ + @Generated + private String contentType = "application/octet-stream"; + + /** + * Creates an instance of FileOptionalContentType class. + * + * @param content the content value to set. + * @param filename the filename value to set. + */ + @Generated + public FileOptionalContentType(BinaryData content, String filename) { + this.content = content; + this.filename = filename; + } + + /** + * Get the content property: The content of the file. + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the filename property: The filename of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Get the contentType property: The content-type of the file. + * + * @return the contentType value. + */ + @Generated + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The content-type of the file. + * + * @param contentType the contentType value to set. + * @return the FileOptionalContentType object itself. + */ + @Generated + public FileOptionalContentType setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileRequiredMetaData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileRequiredMetaData.java new file mode 100644 index 00000000000..32d06b9a0f6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileRequiredMetaData.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; + +/** + * The file details for the "profileImage" field. + */ +@Immutable +public final class FileRequiredMetaData { + /* + * The content of the file. + */ + @Generated + private final BinaryData content; + + /* + * The filename of the file. + */ + @Generated + private final String filename; + + /* + * The content-type of the file. + */ + @Generated + private final String contentType; + + /** + * Creates an instance of FileRequiredMetaData class. + * + * @param content the content value to set. + * @param filename the filename value to set. + * @param contentType the contentType value to set. + */ + @Generated + public FileRequiredMetaData(BinaryData content, String filename, String contentType) { + this.content = content; + this.filename = filename; + this.contentType = contentType; + } + + /** + * Get the content property: The content of the file. + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the filename property: The filename of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Get the contentType property: The content-type of the file. + * + * @return the contentType value. + */ + @Generated + public String getContentType() { + return this.contentType; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileSpecificContentType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileSpecificContentType.java new file mode 100644 index 00000000000..27a57da187b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileSpecificContentType.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; + +/** + * The file details for the "profileImage" field. + */ +@Immutable +public final class FileSpecificContentType { + /* + * The content of the file. + */ + @Generated + private final BinaryData content; + + /* + * The filename of the file. + */ + @Generated + private final String filename; + + /* + * The content-type of the file. + */ + @Generated + private final String contentType = "image/jpg"; + + /** + * Creates an instance of FileSpecificContentType class. + * + * @param content the content value to set. + * @param filename the filename value to set. + */ + @Generated + public FileSpecificContentType(BinaryData content, String filename) { + this.content = content; + this.filename = filename; + } + + /** + * Get the content property: The content of the file. + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the filename property: The filename of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Get the contentType property: The content-type of the file. + * + * @return the contentType value. + */ + @Generated + public String getContentType() { + return this.contentType; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartOptionalContentTypeRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartOptionalContentTypeRequest.java new file mode 100644 index 00000000000..98bd9bedb2f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartOptionalContentTypeRequest.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; + +/** + * The FileWithHttpPartOptionalContentTypeRequest model. + */ +@Immutable +public final class FileWithHttpPartOptionalContentTypeRequest { + /* + * The profileImage property. + */ + @Generated + private final FileOptionalContentType profileImage; + + /** + * Creates an instance of FileWithHttpPartOptionalContentTypeRequest class. + * + * @param profileImage the profileImage value to set. + */ + @Generated + public FileWithHttpPartOptionalContentTypeRequest(FileOptionalContentType profileImage) { + this.profileImage = profileImage; + } + + /** + * Get the profileImage property: The profileImage property. + * + * @return the profileImage value. + */ + @Generated + public FileOptionalContentType getProfileImage() { + return this.profileImage; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartRequiredContentTypeRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartRequiredContentTypeRequest.java new file mode 100644 index 00000000000..0606530e757 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartRequiredContentTypeRequest.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; + +/** + * The FileWithHttpPartRequiredContentTypeRequest model. + */ +@Immutable +public final class FileWithHttpPartRequiredContentTypeRequest { + /* + * The profileImage property. + */ + @Generated + private final FileRequiredMetaData profileImage; + + /** + * Creates an instance of FileWithHttpPartRequiredContentTypeRequest class. + * + * @param profileImage the profileImage value to set. + */ + @Generated + public FileWithHttpPartRequiredContentTypeRequest(FileRequiredMetaData profileImage) { + this.profileImage = profileImage; + } + + /** + * Get the profileImage property: The profileImage property. + * + * @return the profileImage value. + */ + @Generated + public FileRequiredMetaData getProfileImage() { + return this.profileImage; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartSpecificContentTypeRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartSpecificContentTypeRequest.java new file mode 100644 index 00000000000..12f1fe506f2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/FileWithHttpPartSpecificContentTypeRequest.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; + +/** + * The FileWithHttpPartSpecificContentTypeRequest model. + */ +@Immutable +public final class FileWithHttpPartSpecificContentTypeRequest { + /* + * The profileImage property. + */ + @Generated + private final FileSpecificContentType profileImage; + + /** + * Creates an instance of FileWithHttpPartSpecificContentTypeRequest class. + * + * @param profileImage the profileImage value to set. + */ + @Generated + public FileWithHttpPartSpecificContentTypeRequest(FileSpecificContentType profileImage) { + this.profileImage = profileImage; + } + + /** + * Get the profileImage property: The profileImage property. + * + * @return the profileImage value. + */ + @Generated + public FileSpecificContentType getProfileImage() { + return this.profileImage; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/JsonPartRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/JsonPartRequest.java new file mode 100644 index 00000000000..636bcfa3c2a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/JsonPartRequest.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; + +/** + * The JsonPartRequest model. + */ +@Immutable +public final class JsonPartRequest { + /* + * The address property. + */ + @Generated + private final Address address; + + /* + * The profileImage property. + */ + @Generated + private final ProfileImageFileDetails profileImage; + + /** + * Creates an instance of JsonPartRequest class. + * + * @param address the address value to set. + * @param profileImage the profileImage value to set. + */ + @Generated + public JsonPartRequest(Address address, ProfileImageFileDetails profileImage) { + this.address = address; + this.profileImage = profileImage; + } + + /** + * Get the address property: The address property. + * + * @return the address value. + */ + @Generated + public Address getAddress() { + return this.address; + } + + /** + * Get the profileImage property: The profileImage property. + * + * @return the profileImage value. + */ + @Generated + public ProfileImageFileDetails getProfileImage() { + return this.profileImage; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiBinaryPartsRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiBinaryPartsRequest.java new file mode 100644 index 00000000000..ad93462bb89 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiBinaryPartsRequest.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; + +/** + * The MultiBinaryPartsRequest model. + */ +@Fluent +public final class MultiBinaryPartsRequest { + /* + * The profileImage property. + */ + @Generated + private final ProfileImageFileDetails profileImage; + + /* + * The picture property. + */ + @Generated + private PictureFileDetails picture; + + /** + * Creates an instance of MultiBinaryPartsRequest class. + * + * @param profileImage the profileImage value to set. + */ + @Generated + public MultiBinaryPartsRequest(ProfileImageFileDetails profileImage) { + this.profileImage = profileImage; + } + + /** + * Get the profileImage property: The profileImage property. + * + * @return the profileImage value. + */ + @Generated + public ProfileImageFileDetails getProfileImage() { + return this.profileImage; + } + + /** + * Get the picture property: The picture property. + * + * @return the picture value. + */ + @Generated + public PictureFileDetails getPicture() { + return this.picture; + } + + /** + * Set the picture property: The picture property. + * + * @param picture the picture value to set. + * @return the MultiBinaryPartsRequest object itself. + */ + @Generated + public MultiBinaryPartsRequest setPicture(PictureFileDetails picture) { + this.picture = picture; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiPartRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiPartRequest.java new file mode 100644 index 00000000000..13513f1c540 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/MultiPartRequest.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; + +/** + * The MultiPartRequest model. + */ +@Immutable +public final class MultiPartRequest { + /* + * The id property. + */ + @Generated + private final String id; + + /* + * The profileImage property. + */ + @Generated + private final ProfileImageFileDetails profileImage; + + /** + * Creates an instance of MultiPartRequest class. + * + * @param id the id value to set. + * @param profileImage the profileImage value to set. + */ + @Generated + public MultiPartRequest(String id, ProfileImageFileDetails profileImage) { + this.id = id; + this.profileImage = profileImage; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the profileImage property: The profileImage property. + * + * @return the profileImage value. + */ + @Generated + public ProfileImageFileDetails getProfileImage() { + return this.profileImage; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PictureFileDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PictureFileDetails.java new file mode 100644 index 00000000000..3ad2b8d4855 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PictureFileDetails.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; + +/** + * The file details for the "picture" field. + */ +@Fluent +public final class PictureFileDetails { + /* + * The content of the file. + */ + @Generated + private final BinaryData content; + + /* + * The filename of the file. + */ + @Generated + private String filename; + + /* + * The content-type of the file. + */ + @Generated + private String contentType = "application/octet-stream"; + + /** + * Creates an instance of PictureFileDetails class. + * + * @param content the content value to set. + */ + @Generated + public PictureFileDetails(BinaryData content) { + this.content = content; + } + + /** + * Get the content property: The content of the file. + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the filename property: The filename of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Set the filename property: The filename of the file. + * + * @param filename the filename value to set. + * @return the PictureFileDetails object itself. + */ + @Generated + public PictureFileDetails setFilename(String filename) { + this.filename = filename; + return this; + } + + /** + * Get the contentType property: The content-type of the file. + * + * @return the contentType value. + */ + @Generated + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The content-type of the file. + * + * @param contentType the contentType value to set. + * @return the PictureFileDetails object itself. + */ + @Generated + public PictureFileDetails setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PicturesFileDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PicturesFileDetails.java new file mode 100644 index 00000000000..039f01f7bf4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/PicturesFileDetails.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; + +/** + * The file details for the "pictures" field. + */ +@Fluent +public final class PicturesFileDetails { + /* + * The content of the file. + */ + @Generated + private final BinaryData content; + + /* + * The filename of the file. + */ + @Generated + private String filename; + + /* + * The content-type of the file. + */ + @Generated + private String contentType = "application/octet-stream"; + + /** + * Creates an instance of PicturesFileDetails class. + * + * @param content the content value to set. + */ + @Generated + public PicturesFileDetails(BinaryData content) { + this.content = content; + } + + /** + * Get the content property: The content of the file. + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the filename property: The filename of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Set the filename property: The filename of the file. + * + * @param filename the filename value to set. + * @return the PicturesFileDetails object itself. + */ + @Generated + public PicturesFileDetails setFilename(String filename) { + this.filename = filename; + return this; + } + + /** + * Get the contentType property: The content-type of the file. + * + * @return the contentType value. + */ + @Generated + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The content-type of the file. + * + * @param contentType the contentType value to set. + * @return the PicturesFileDetails object itself. + */ + @Generated + public PicturesFileDetails setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ProfileImageFileDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ProfileImageFileDetails.java new file mode 100644 index 00000000000..d36215a1566 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/ProfileImageFileDetails.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; + +/** + * The file details for the "profileImage" field. + */ +@Fluent +public final class ProfileImageFileDetails { + /* + * The content of the file. + */ + @Generated + private final BinaryData content; + + /* + * The filename of the file. + */ + @Generated + private String filename; + + /* + * The content-type of the file. + */ + @Generated + private String contentType = "application/octet-stream"; + + /** + * Creates an instance of ProfileImageFileDetails class. + * + * @param content the content value to set. + */ + @Generated + public ProfileImageFileDetails(BinaryData content) { + this.content = content; + } + + /** + * Get the content property: The content of the file. + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the filename property: The filename of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Set the filename property: The filename of the file. + * + * @param filename the filename value to set. + * @return the ProfileImageFileDetails object itself. + */ + @Generated + public ProfileImageFileDetails setFilename(String filename) { + this.filename = filename; + return this; + } + + /** + * Get the contentType property: The content-type of the file. + * + * @return the contentType value. + */ + @Generated + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The content-type of the file. + * + * @param contentType the contentType value to set. + * @return the ProfileImageFileDetails object itself. + */ + @Generated + public ProfileImageFileDetails setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/package-info.java new file mode 100644 index 00000000000..2d4efd70032 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for MultiPart. + * Test for multipart. + * + */ +package payload.multipart.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/package-info.java new file mode 100644 index 00000000000..96a48cfc53c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/multipart/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for MultiPart. + * Test for multipart. + * + */ +package payload.multipart; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenAsyncClient.java new file mode 100644 index 00000000000..c2890ccd4ca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenAsyncClient.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package resiliency.servicedriven; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.Arrays; +import reactor.core.publisher.Mono; +import resiliency.servicedriven.implementation.ResiliencyServiceDrivenClientImpl; + +/** + * Initializes a new instance of the asynchronous ResiliencyServiceDrivenClient type. + */ +@ServiceClient(builder = ResiliencyServiceDrivenClientBuilder.class, isAsync = true) +public final class ResiliencyServiceDrivenAsyncClient { + @Generated + private final ResiliencyServiceDrivenClientImpl serviceClient; + + /** + * Initializes an instance of ResiliencyServiceDrivenAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ResiliencyServiceDrivenAsyncClient(ResiliencyServiceDrivenClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Added operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addOperationWithResponse(RequestOptions requestOptions) { + return this.serviceClient.addOperationWithResponseAsync(requestOptions); + } + + /** + * Test that grew up from accepting no parameters to an optional input parameter. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromNoneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fromNoneWithResponseAsync(requestOptions); + } + + /** + * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional + * parameter. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param parameter I am a required parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromOneRequiredWithResponse(String parameter, RequestOptions requestOptions) { + return this.serviceClient.fromOneRequiredWithResponseAsync(parameter, requestOptions); + } + + /** + * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional + * parameters. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
new-parameterStringNoI'm a new input optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromOneOptionalWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fromOneOptionalWithResponseAsync(requestOptions); + } + + /** + * Added operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono addOperation() { + // Generated convenience method for addOperationWithResponse + RequestOptions requestOptions = new RequestOptions(); + return addOperationWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test that grew up from accepting no parameters to an optional input parameter. + * + * @param newParameter I'm a new input optional parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fromNone(String newParameter) { + // Generated convenience method for fromNoneWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (!Arrays.asList("v2").contains(serviceClient.getServiceVersion().getVersion())) { + return Mono + .error(new IllegalArgumentException("Parameter newParameter is only available in api-version v2.")); + } + if (newParameter != null) { + requestOptions.addQueryParam("new-parameter", newParameter, false); + } + return fromNoneWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test that grew up from accepting no parameters to an optional input parameter. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fromNone() { + // Generated convenience method for fromNoneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fromNoneWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional + * parameter. + * + * @param parameter I am a required parameter. + * @param newParameter I'm a new input optional parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fromOneRequired(String parameter, String newParameter) { + // Generated convenience method for fromOneRequiredWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (!Arrays.asList("v2").contains(serviceClient.getServiceVersion().getVersion())) { + return Mono + .error(new IllegalArgumentException("Parameter newParameter is only available in api-version v2.")); + } + if (newParameter != null) { + requestOptions.addQueryParam("new-parameter", newParameter, false); + } + return fromOneRequiredWithResponse(parameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional + * parameter. + * + * @param parameter I am a required parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fromOneRequired(String parameter) { + // Generated convenience method for fromOneRequiredWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fromOneRequiredWithResponse(parameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional + * parameters. + * + * @param parameter I am an optional parameter. + * @param newParameter I'm a new input optional parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fromOneOptional(String parameter, String newParameter) { + // Generated convenience method for fromOneOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (!Arrays.asList("v2").contains(serviceClient.getServiceVersion().getVersion())) { + return Mono + .error(new IllegalArgumentException("Parameter newParameter is only available in api-version v2.")); + } + if (parameter != null) { + requestOptions.addQueryParam("parameter", parameter, false); + } + if (newParameter != null) { + requestOptions.addQueryParam("new-parameter", newParameter, false); + } + return fromOneOptionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional + * parameters. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fromOneOptional() { + // Generated convenience method for fromOneOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fromOneOptionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional + * parameters. + * + * @param parameter I am an optional parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fromOneOptional(String parameter) { + // Generated convenience method for fromOneOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (parameter != null) { + requestOptions.addQueryParam("parameter", parameter, false); + } + return fromOneOptionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClient.java new file mode 100644 index 00000000000..44c7799e4be --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClient.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package resiliency.servicedriven; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.logging.ClientLogger; +import java.util.Arrays; +import resiliency.servicedriven.implementation.ResiliencyServiceDrivenClientImpl; + +/** + * Initializes a new instance of the synchronous ResiliencyServiceDrivenClient type. + */ +@ServiceClient(builder = ResiliencyServiceDrivenClientBuilder.class) +public final class ResiliencyServiceDrivenClient { + @Generated + private final ResiliencyServiceDrivenClientImpl serviceClient; + + /** + * Initializes an instance of ResiliencyServiceDrivenClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Added operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addOperationWithResponse(RequestOptions requestOptions) { + return this.serviceClient.addOperationWithResponse(requestOptions); + } + + /** + * Test that grew up from accepting no parameters to an optional input parameter. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromNoneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fromNoneWithResponse(requestOptions); + } + + /** + * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional + * parameter. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param parameter I am a required parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromOneRequiredWithResponse(String parameter, RequestOptions requestOptions) { + return this.serviceClient.fromOneRequiredWithResponse(parameter, requestOptions); + } + + /** + * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional + * parameters. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
new-parameterStringNoI'm a new input optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromOneOptionalWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fromOneOptionalWithResponse(requestOptions); + } + + /** + * Added operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void addOperation() { + // Generated convenience method for addOperationWithResponse + RequestOptions requestOptions = new RequestOptions(); + addOperationWithResponse(requestOptions).getValue(); + } + + /** + * Test that grew up from accepting no parameters to an optional input parameter. + * + * @param newParameter I'm a new input optional parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fromNone(String newParameter) { + // Generated convenience method for fromNoneWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (!Arrays.asList("v2").contains(serviceClient.getServiceVersion().getVersion())) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter newParameter is only available in api-version v2.")); + } + if (newParameter != null) { + requestOptions.addQueryParam("new-parameter", newParameter, false); + } + fromNoneWithResponse(requestOptions).getValue(); + } + + /** + * Test that grew up from accepting no parameters to an optional input parameter. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fromNone() { + // Generated convenience method for fromNoneWithResponse + RequestOptions requestOptions = new RequestOptions(); + fromNoneWithResponse(requestOptions).getValue(); + } + + /** + * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional + * parameter. + * + * @param parameter I am a required parameter. + * @param newParameter I'm a new input optional parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fromOneRequired(String parameter, String newParameter) { + // Generated convenience method for fromOneRequiredWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (!Arrays.asList("v2").contains(serviceClient.getServiceVersion().getVersion())) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter newParameter is only available in api-version v2.")); + } + if (newParameter != null) { + requestOptions.addQueryParam("new-parameter", newParameter, false); + } + fromOneRequiredWithResponse(parameter, requestOptions).getValue(); + } + + /** + * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional + * parameter. + * + * @param parameter I am a required parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fromOneRequired(String parameter) { + // Generated convenience method for fromOneRequiredWithResponse + RequestOptions requestOptions = new RequestOptions(); + fromOneRequiredWithResponse(parameter, requestOptions).getValue(); + } + + /** + * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional + * parameters. + * + * @param parameter I am an optional parameter. + * @param newParameter I'm a new input optional parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fromOneOptional(String parameter, String newParameter) { + // Generated convenience method for fromOneOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (!Arrays.asList("v2").contains(serviceClient.getServiceVersion().getVersion())) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter newParameter is only available in api-version v2.")); + } + if (parameter != null) { + requestOptions.addQueryParam("parameter", parameter, false); + } + if (newParameter != null) { + requestOptions.addQueryParam("new-parameter", newParameter, false); + } + fromOneOptionalWithResponse(requestOptions).getValue(); + } + + /** + * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional + * parameters. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fromOneOptional() { + // Generated convenience method for fromOneOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + fromOneOptionalWithResponse(requestOptions).getValue(); + } + + /** + * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional + * parameters. + * + * @param parameter I am an optional parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fromOneOptional(String parameter) { + // Generated convenience method for fromOneOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (parameter != null) { + requestOptions.addQueryParam("parameter", parameter, false); + } + fromOneOptionalWithResponse(requestOptions).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(ResiliencyServiceDrivenClient.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClientBuilder.java new file mode 100644 index 00000000000..eeabb5665d0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClientBuilder.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package resiliency.servicedriven; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import resiliency.servicedriven.implementation.ResiliencyServiceDrivenClientImpl; + +/** + * A builder for creating a new instance of the ResiliencyServiceDrivenClient type. + */ +@ServiceClientBuilder( + serviceClients = { ResiliencyServiceDrivenClient.class, ResiliencyServiceDrivenAsyncClient.class }) +public final class ResiliencyServiceDrivenClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("resiliency-servicedriven.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ResiliencyServiceDrivenClientBuilder. + */ + @Generated + public ResiliencyServiceDrivenClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the + * deployment when the service had only one api version. 'v2' is for the deployment when the service had + * api-versions 'v1' and 'v2'. + */ + @Generated + private String serviceDeploymentVersion; + + /** + * Sets Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the + * deployment when the service had only one api version. 'v2' is for the deployment when the service had + * api-versions 'v1' and 'v2'. + * + * @param serviceDeploymentVersion the serviceDeploymentVersion value. + * @return the ResiliencyServiceDrivenClientBuilder. + */ + @Generated + public ResiliencyServiceDrivenClientBuilder serviceDeploymentVersion(String serviceDeploymentVersion) { + this.serviceDeploymentVersion = serviceDeploymentVersion; + return this; + } + + /* + * Service version + */ + @Generated + private ServiceDrivenServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the ResiliencyServiceDrivenClientBuilder. + */ + @Generated + public ResiliencyServiceDrivenClientBuilder serviceVersion(ServiceDrivenServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ResiliencyServiceDrivenClientBuilder. + */ + @Generated + public ResiliencyServiceDrivenClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ResiliencyServiceDrivenClientImpl with the provided parameters. + * + * @return an instance of ResiliencyServiceDrivenClientImpl. + */ + @Generated + private ResiliencyServiceDrivenClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ServiceDrivenServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : ServiceDrivenServiceVersion.getLatest(); + ResiliencyServiceDrivenClientImpl client + = new ResiliencyServiceDrivenClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + this.endpoint, this.serviceDeploymentVersion, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + Objects.requireNonNull(serviceDeploymentVersion, "'serviceDeploymentVersion' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ResiliencyServiceDrivenAsyncClient class. + * + * @return an instance of ResiliencyServiceDrivenAsyncClient. + */ + @Generated + public ResiliencyServiceDrivenAsyncClient buildAsyncClient() { + return new ResiliencyServiceDrivenAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ResiliencyServiceDrivenClient class. + * + * @return an instance of ResiliencyServiceDrivenClient. + */ + @Generated + public ResiliencyServiceDrivenClient buildClient() { + return new ResiliencyServiceDrivenClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ResiliencyServiceDrivenClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ServiceDrivenServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ServiceDrivenServiceVersion.java new file mode 100644 index 00000000000..737c82ce06a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/ServiceDrivenServiceVersion.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package resiliency.servicedriven; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of ServiceDrivenClient. + */ +public enum ServiceDrivenServiceVersion implements ServiceVersion { + /** + * Enum value v1. + */ + V1("v1"), + + /** + * Enum value v2. + */ + V2("v2"); + + private final String version; + + ServiceDrivenServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link ServiceDrivenServiceVersion}. + */ + public static ServiceDrivenServiceVersion getLatest() { + return V2; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/ResiliencyServiceDrivenClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/ResiliencyServiceDrivenClientImpl.java new file mode 100644 index 00000000000..54a4a34dda8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/ResiliencyServiceDrivenClientImpl.java @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package resiliency.servicedriven.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; +import resiliency.servicedriven.ServiceDrivenServiceVersion; + +/** + * Initializes a new instance of the ResiliencyServiceDrivenClient type. + */ +public final class ResiliencyServiceDrivenClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ResiliencyServiceDrivenClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the + * deployment when the service had only one api version. 'v2' is for the deployment when the service had + * api-versions 'v1' and 'v2'. + */ + private final String serviceDeploymentVersion; + + /** + * Gets Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the + * deployment when the service had only one api version. 'v2' is for the deployment when the service had + * api-versions 'v1' and 'v2'. + * + * @return the serviceDeploymentVersion value. + */ + public String getServiceDeploymentVersion() { + return this.serviceDeploymentVersion; + } + + /** + * Service version. + */ + private final ServiceDrivenServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ServiceDrivenServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of ResiliencyServiceDrivenClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceDeploymentVersion Pass in either 'v1' or 'v2'. This represents a version of the service deployment + * in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when + * the service had api-versions 'v1' and 'v2'. + * @param serviceVersion Service version. + */ + public ResiliencyServiceDrivenClientImpl(String endpoint, String serviceDeploymentVersion, + ServiceDrivenServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceDeploymentVersion, serviceVersion); + } + + /** + * Initializes an instance of ResiliencyServiceDrivenClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceDeploymentVersion Pass in either 'v1' or 'v2'. This represents a version of the service deployment + * in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when + * the service had api-versions 'v1' and 'v2'. + * @param serviceVersion Service version. + */ + public ResiliencyServiceDrivenClientImpl(HttpPipeline httpPipeline, String endpoint, + String serviceDeploymentVersion, ServiceDrivenServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceDeploymentVersion, + serviceVersion); + } + + /** + * Initializes an instance of ResiliencyServiceDrivenClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceDeploymentVersion Pass in either 'v1' or 'v2'. This represents a version of the service deployment + * in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when + * the service had api-versions 'v1' and 'v2'. + * @param serviceVersion Service version. + */ + public ResiliencyServiceDrivenClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint, String serviceDeploymentVersion, ServiceDrivenServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceDeploymentVersion = serviceDeploymentVersion; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(ResiliencyServiceDrivenClientService.class, this.httpPipeline, + this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ResiliencyServiceDrivenClient to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}/resiliency/service-driven/client:v2/service:{serviceDeploymentVersion}/api-version:{apiVersion}") + @ServiceInterface(name = "ResiliencyServiceDrivenClient") + public interface ResiliencyServiceDrivenClientService { + @Delete("/add-operation") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addOperation(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Delete("/add-operation") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response addOperationSync(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Head("/add-optional-param/from-none") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> fromNone(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Head("/add-optional-param/from-none") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fromNoneSync(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Get("/add-optional-param/from-one-required") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> fromOneRequired(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, @QueryParam("parameter") String parameter, + RequestOptions requestOptions, Context context); + + @Get("/add-optional-param/from-one-required") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fromOneRequiredSync(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, @QueryParam("parameter") String parameter, + RequestOptions requestOptions, Context context); + + @Get("/add-optional-param/from-one-optional") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> fromOneOptional(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Get("/add-optional-param/from-one-optional") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fromOneOptionalSync(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + } + + /** + * Added operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addOperationWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.addOperation(this.getEndpoint(), + this.getServiceDeploymentVersion(), this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * Added operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addOperationWithResponse(RequestOptions requestOptions) { + return service.addOperationSync(this.getEndpoint(), this.getServiceDeploymentVersion(), + this.getServiceVersion().getVersion(), requestOptions, Context.NONE); + } + + /** + * Test that grew up from accepting no parameters to an optional input parameter. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromNoneWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.fromNone(this.getEndpoint(), this.getServiceDeploymentVersion(), + this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * Test that grew up from accepting no parameters to an optional input parameter. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromNoneWithResponse(RequestOptions requestOptions) { + return service.fromNoneSync(this.getEndpoint(), this.getServiceDeploymentVersion(), + this.getServiceVersion().getVersion(), requestOptions, Context.NONE); + } + + /** + * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional + * parameter. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param parameter I am a required parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromOneRequiredWithResponseAsync(String parameter, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.fromOneRequired(this.getEndpoint(), this.getServiceDeploymentVersion(), + this.getServiceVersion().getVersion(), parameter, requestOptions, context)); + } + + /** + * Operation that grew up from accepting one required parameter to accepting a required parameter and an optional + * parameter. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
new-parameterStringNoI'm a new input optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param parameter I am a required parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromOneRequiredWithResponse(String parameter, RequestOptions requestOptions) { + return service.fromOneRequiredSync(this.getEndpoint(), this.getServiceDeploymentVersion(), + this.getServiceVersion().getVersion(), parameter, requestOptions, Context.NONE); + } + + /** + * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional + * parameters. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
new-parameterStringNoI'm a new input optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromOneOptionalWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.fromOneOptional(this.getEndpoint(), + this.getServiceDeploymentVersion(), this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * Tests that we can grow up an operation from accepting one optional parameter to accepting two optional + * parameters. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
new-parameterStringNoI'm a new input optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromOneOptionalWithResponse(RequestOptions requestOptions) { + return service.fromOneOptionalSync(this.getEndpoint(), this.getServiceDeploymentVersion(), + this.getServiceVersion().getVersion(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/package-info.java new file mode 100644 index 00000000000..5f83b7325a6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/implementation/package-info.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ServiceDriven. + * Test that we can grow up a service spec and service deployment into a multi-versioned service with full client + * support. + * + * There are three concepts that should be clarified: + * 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp + * and 'v2' is a client generated from main.tsp. + * 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment + * of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions + * 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the + * service supports api versions 'v1' and 'v2'. + * + * We test the following configurations from this service spec: + * - A client generated from the second service spec can call the second deployment of a service with api version v1 + * - A client generated from the second service spec can call the second deployment of a service with api version v2. + * + */ +package resiliency.servicedriven.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/package-info.java new file mode 100644 index 00000000000..7eb9f03cbc1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/package-info.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ServiceDriven. + * Test that we can grow up a service spec and service deployment into a multi-versioned service with full client + * support. + * + * There are three concepts that should be clarified: + * 1. Client spec version: refers to the spec that the client is generated from. 'v1' is a client generated from old.tsp + * and 'v2' is a client generated from main.tsp. + * 2. Service deployment version: refers to a deployment version of the service. 'v1' represents the initial deployment + * of the service with a single api version. 'v2' represents the new deployment of a service with multiple api versions + * 3. Api version: The initial deployment of the service only supports api version 'v1'. The new deployment of the + * service supports api versions 'v1' and 'v2'. + * + * We test the following configurations from this service spec: + * - A client generated from the second service spec can call the second deployment of a service with api version v1 + * - A client generated from the second service spec can call the second deployment of a service with api version v2. + * + */ +package resiliency.servicedriven; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenAsyncClient.java new file mode 100644 index 00000000000..a6dc12520e1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenAsyncClient.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package resiliency.servicedriven.v1; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import resiliency.servicedriven.v1.implementation.ResiliencyServiceDrivenClientImpl; + +/** + * Initializes a new instance of the asynchronous ResiliencyServiceDrivenClient type. + */ +@ServiceClient(builder = ResiliencyServiceDrivenClientBuilder.class, isAsync = true) +public final class ResiliencyServiceDrivenAsyncClient { + @Generated + private final ResiliencyServiceDrivenClientImpl serviceClient; + + /** + * Initializes an instance of ResiliencyServiceDrivenAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ResiliencyServiceDrivenAsyncClient(ResiliencyServiceDrivenClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as + * well. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromNoneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fromNoneWithResponseAsync(requestOptions); + } + + /** + * Test that currently accepts one required parameter, will be updated in next spec to accept a new optional + * parameter as well. + * + * @param parameter I am a required parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromOneRequiredWithResponse(String parameter, RequestOptions requestOptions) { + return this.serviceClient.fromOneRequiredWithResponseAsync(parameter, requestOptions); + } + + /** + * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional + * parameter as well. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromOneOptionalWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fromOneOptionalWithResponseAsync(requestOptions); + } + + /** + * Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as + * well. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fromNone() { + // Generated convenience method for fromNoneWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fromNoneWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test that currently accepts one required parameter, will be updated in next spec to accept a new optional + * parameter as well. + * + * @param parameter I am a required parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fromOneRequired(String parameter) { + // Generated convenience method for fromOneRequiredWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fromOneRequiredWithResponse(parameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional + * parameter as well. + * + * @param parameter I am an optional parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fromOneOptional(String parameter) { + // Generated convenience method for fromOneOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (parameter != null) { + requestOptions.addQueryParam("parameter", parameter, false); + } + return fromOneOptionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional + * parameter as well. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fromOneOptional() { + // Generated convenience method for fromOneOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fromOneOptionalWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClient.java new file mode 100644 index 00000000000..c810728417e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClient.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package resiliency.servicedriven.v1; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import resiliency.servicedriven.v1.implementation.ResiliencyServiceDrivenClientImpl; + +/** + * Initializes a new instance of the synchronous ResiliencyServiceDrivenClient type. + */ +@ServiceClient(builder = ResiliencyServiceDrivenClientBuilder.class) +public final class ResiliencyServiceDrivenClient { + @Generated + private final ResiliencyServiceDrivenClientImpl serviceClient; + + /** + * Initializes an instance of ResiliencyServiceDrivenClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ResiliencyServiceDrivenClient(ResiliencyServiceDrivenClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as + * well. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromNoneWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fromNoneWithResponse(requestOptions); + } + + /** + * Test that currently accepts one required parameter, will be updated in next spec to accept a new optional + * parameter as well. + * + * @param parameter I am a required parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromOneRequiredWithResponse(String parameter, RequestOptions requestOptions) { + return this.serviceClient.fromOneRequiredWithResponse(parameter, requestOptions); + } + + /** + * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional + * parameter as well. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromOneOptionalWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fromOneOptionalWithResponse(requestOptions); + } + + /** + * Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as + * well. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fromNone() { + // Generated convenience method for fromNoneWithResponse + RequestOptions requestOptions = new RequestOptions(); + fromNoneWithResponse(requestOptions).getValue(); + } + + /** + * Test that currently accepts one required parameter, will be updated in next spec to accept a new optional + * parameter as well. + * + * @param parameter I am a required parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fromOneRequired(String parameter) { + // Generated convenience method for fromOneRequiredWithResponse + RequestOptions requestOptions = new RequestOptions(); + fromOneRequiredWithResponse(parameter, requestOptions).getValue(); + } + + /** + * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional + * parameter as well. + * + * @param parameter I am an optional parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fromOneOptional(String parameter) { + // Generated convenience method for fromOneOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (parameter != null) { + requestOptions.addQueryParam("parameter", parameter, false); + } + fromOneOptionalWithResponse(requestOptions).getValue(); + } + + /** + * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional + * parameter as well. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fromOneOptional() { + // Generated convenience method for fromOneOptionalWithResponse + RequestOptions requestOptions = new RequestOptions(); + fromOneOptionalWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClientBuilder.java new file mode 100644 index 00000000000..90c7b5cf246 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClientBuilder.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package resiliency.servicedriven.v1; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import resiliency.servicedriven.v1.implementation.ResiliencyServiceDrivenClientImpl; + +/** + * A builder for creating a new instance of the ResiliencyServiceDrivenClient type. + */ +@ServiceClientBuilder( + serviceClients = { ResiliencyServiceDrivenClient.class, ResiliencyServiceDrivenAsyncClient.class }) +public final class ResiliencyServiceDrivenClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("resiliency-servicedriven-v1.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ResiliencyServiceDrivenClientBuilder. + */ + @Generated + public ResiliencyServiceDrivenClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResiliencyServiceDrivenClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the + * deployment when the service had only one api version. 'v2' is for the deployment when the service had + * api-versions 'v1' and 'v2'. + */ + @Generated + private String serviceDeploymentVersion; + + /** + * Sets Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the + * deployment when the service had only one api version. 'v2' is for the deployment when the service had + * api-versions 'v1' and 'v2'. + * + * @param serviceDeploymentVersion the serviceDeploymentVersion value. + * @return the ResiliencyServiceDrivenClientBuilder. + */ + @Generated + public ResiliencyServiceDrivenClientBuilder serviceDeploymentVersion(String serviceDeploymentVersion) { + this.serviceDeploymentVersion = serviceDeploymentVersion; + return this; + } + + /* + * Service version + */ + @Generated + private ServiceDrivenServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the ResiliencyServiceDrivenClientBuilder. + */ + @Generated + public ResiliencyServiceDrivenClientBuilder serviceVersion(ServiceDrivenServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ResiliencyServiceDrivenClientBuilder. + */ + @Generated + public ResiliencyServiceDrivenClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ResiliencyServiceDrivenClientImpl with the provided parameters. + * + * @return an instance of ResiliencyServiceDrivenClientImpl. + */ + @Generated + private ResiliencyServiceDrivenClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ServiceDrivenServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : ServiceDrivenServiceVersion.getLatest(); + ResiliencyServiceDrivenClientImpl client + = new ResiliencyServiceDrivenClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + this.endpoint, this.serviceDeploymentVersion, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + Objects.requireNonNull(serviceDeploymentVersion, "'serviceDeploymentVersion' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ResiliencyServiceDrivenAsyncClient class. + * + * @return an instance of ResiliencyServiceDrivenAsyncClient. + */ + @Generated + public ResiliencyServiceDrivenAsyncClient buildAsyncClient() { + return new ResiliencyServiceDrivenAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ResiliencyServiceDrivenClient class. + * + * @return an instance of ResiliencyServiceDrivenClient. + */ + @Generated + public ResiliencyServiceDrivenClient buildClient() { + return new ResiliencyServiceDrivenClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ResiliencyServiceDrivenClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ServiceDrivenServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ServiceDrivenServiceVersion.java new file mode 100644 index 00000000000..b154f887b77 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/ServiceDrivenServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package resiliency.servicedriven.v1; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of ServiceDrivenClient. + */ +public enum ServiceDrivenServiceVersion implements ServiceVersion { + /** + * Enum value v1. + */ + V1("v1"); + + private final String version; + + ServiceDrivenServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link ServiceDrivenServiceVersion}. + */ + public static ServiceDrivenServiceVersion getLatest() { + return V1; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/ResiliencyServiceDrivenClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/ResiliencyServiceDrivenClientImpl.java new file mode 100644 index 00000000000..738bcdc4c8d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/ResiliencyServiceDrivenClientImpl.java @@ -0,0 +1,359 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package resiliency.servicedriven.v1.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; +import resiliency.servicedriven.v1.ServiceDrivenServiceVersion; + +/** + * Initializes a new instance of the ResiliencyServiceDrivenClient type. + */ +public final class ResiliencyServiceDrivenClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ResiliencyServiceDrivenClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the + * deployment when the service had only one api version. 'v2' is for the deployment when the service had + * api-versions 'v1' and 'v2'. + */ + private final String serviceDeploymentVersion; + + /** + * Gets Pass in either 'v1' or 'v2'. This represents a version of the service deployment in history. 'v1' is for the + * deployment when the service had only one api version. 'v2' is for the deployment when the service had + * api-versions 'v1' and 'v2'. + * + * @return the serviceDeploymentVersion value. + */ + public String getServiceDeploymentVersion() { + return this.serviceDeploymentVersion; + } + + /** + * Service version. + */ + private final ServiceDrivenServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ServiceDrivenServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of ResiliencyServiceDrivenClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceDeploymentVersion Pass in either 'v1' or 'v2'. This represents a version of the service deployment + * in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when + * the service had api-versions 'v1' and 'v2'. + * @param serviceVersion Service version. + */ + public ResiliencyServiceDrivenClientImpl(String endpoint, String serviceDeploymentVersion, + ServiceDrivenServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceDeploymentVersion, serviceVersion); + } + + /** + * Initializes an instance of ResiliencyServiceDrivenClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceDeploymentVersion Pass in either 'v1' or 'v2'. This represents a version of the service deployment + * in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when + * the service had api-versions 'v1' and 'v2'. + * @param serviceVersion Service version. + */ + public ResiliencyServiceDrivenClientImpl(HttpPipeline httpPipeline, String endpoint, + String serviceDeploymentVersion, ServiceDrivenServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceDeploymentVersion, + serviceVersion); + } + + /** + * Initializes an instance of ResiliencyServiceDrivenClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceDeploymentVersion Pass in either 'v1' or 'v2'. This represents a version of the service deployment + * in history. 'v1' is for the deployment when the service had only one api version. 'v2' is for the deployment when + * the service had api-versions 'v1' and 'v2'. + * @param serviceVersion Service version. + */ + public ResiliencyServiceDrivenClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint, String serviceDeploymentVersion, ServiceDrivenServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceDeploymentVersion = serviceDeploymentVersion; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(ResiliencyServiceDrivenClientService.class, this.httpPipeline, + this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ResiliencyServiceDrivenClient to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}/resiliency/service-driven/client:v1/service:{serviceDeploymentVersion}/api-version:{apiVersion}") + @ServiceInterface(name = "ResiliencyServiceDrivenClient") + public interface ResiliencyServiceDrivenClientService { + @Head("/add-optional-param/from-none") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> fromNone(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Head("/add-optional-param/from-none") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fromNoneSync(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Get("/add-optional-param/from-one-required") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> fromOneRequired(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, @QueryParam("parameter") String parameter, + RequestOptions requestOptions, Context context); + + @Get("/add-optional-param/from-one-required") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fromOneRequiredSync(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, @QueryParam("parameter") String parameter, + RequestOptions requestOptions, Context context); + + @Get("/add-optional-param/from-one-optional") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> fromOneOptional(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Get("/add-optional-param/from-one-optional") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fromOneOptionalSync(@HostParam("endpoint") String endpoint, + @HostParam("serviceDeploymentVersion") String serviceDeploymentVersion, + @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + } + + /** + * Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as + * well. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromNoneWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.fromNone(this.getEndpoint(), this.getServiceDeploymentVersion(), + this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * Test that currently accepts no parameters, will be updated in next spec to accept a new optional parameter as + * well. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromNoneWithResponse(RequestOptions requestOptions) { + return service.fromNoneSync(this.getEndpoint(), this.getServiceDeploymentVersion(), + this.getServiceVersion().getVersion(), requestOptions, Context.NONE); + } + + /** + * Test that currently accepts one required parameter, will be updated in next spec to accept a new optional + * parameter as well. + * + * @param parameter I am a required parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromOneRequiredWithResponseAsync(String parameter, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.fromOneRequired(this.getEndpoint(), this.getServiceDeploymentVersion(), + this.getServiceVersion().getVersion(), parameter, requestOptions, context)); + } + + /** + * Test that currently accepts one required parameter, will be updated in next spec to accept a new optional + * parameter as well. + * + * @param parameter I am a required parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromOneRequiredWithResponse(String parameter, RequestOptions requestOptions) { + return service.fromOneRequiredSync(this.getEndpoint(), this.getServiceDeploymentVersion(), + this.getServiceVersion().getVersion(), parameter, requestOptions, Context.NONE); + } + + /** + * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional + * parameter as well. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromOneOptionalWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.fromOneOptional(this.getEndpoint(), + this.getServiceDeploymentVersion(), this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * Test that currently accepts one optional parameter, will be updated in next spec to accept a new optional + * parameter as well. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
parameterStringNoI am an optional parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromOneOptionalWithResponse(RequestOptions requestOptions) { + return service.fromOneOptionalSync(this.getEndpoint(), this.getServiceDeploymentVersion(), + this.getServiceVersion().getVersion(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/package-info.java new file mode 100644 index 00000000000..7311849a931 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/implementation/package-info.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ServiceDriven. + * Test that we can grow up a service spec and service deployment into a multi-versioned service with full client + * support. + * + */ +package resiliency.servicedriven.v1.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/package-info.java new file mode 100644 index 00000000000..54930ad990f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/resiliency/servicedriven/v1/package-info.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ServiceDriven. + * Test that we can grow up a service spec and service deployment into a multi-versioned service with full client + * support. + * + */ +package resiliency.servicedriven.v1; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeAsyncClient.java new file mode 100644 index 00000000000..7d23753604f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeAsyncClient.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package response.statuscoderange; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import response.statuscoderange.implementation.StatusCodeRangeClientImpl; + +/** + * Initializes a new instance of the asynchronous StatusCodeRangeClient type. + */ +@ServiceClient(builder = StatusCodeRangeClientBuilder.class, isAsync = true) +public final class StatusCodeRangeAsyncClient { + @Generated + private final StatusCodeRangeClientImpl serviceClient; + + /** + * Initializes an instance of StatusCodeRangeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StatusCodeRangeAsyncClient(StatusCodeRangeClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The errorResponseStatusCodeInRange operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> errorResponseStatusCodeInRangeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.errorResponseStatusCodeInRangeWithResponseAsync(requestOptions); + } + + /** + * The errorResponseStatusCode404 operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> errorResponseStatusCode404WithResponse(RequestOptions requestOptions) { + return this.serviceClient.errorResponseStatusCode404WithResponseAsync(requestOptions); + } + + /** + * The errorResponseStatusCodeInRange operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono errorResponseStatusCodeInRange() { + // Generated convenience method for errorResponseStatusCodeInRangeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return errorResponseStatusCodeInRangeWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The errorResponseStatusCode404 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono errorResponseStatusCode404() { + // Generated convenience method for errorResponseStatusCode404WithResponse + RequestOptions requestOptions = new RequestOptions(); + return errorResponseStatusCode404WithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClient.java new file mode 100644 index 00000000000..138d7b1e1dc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClient.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package response.statuscoderange; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import response.statuscoderange.implementation.StatusCodeRangeClientImpl; + +/** + * Initializes a new instance of the synchronous StatusCodeRangeClient type. + */ +@ServiceClient(builder = StatusCodeRangeClientBuilder.class) +public final class StatusCodeRangeClient { + @Generated + private final StatusCodeRangeClientImpl serviceClient; + + /** + * Initializes an instance of StatusCodeRangeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StatusCodeRangeClient(StatusCodeRangeClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The errorResponseStatusCodeInRange operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response errorResponseStatusCodeInRangeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.errorResponseStatusCodeInRangeWithResponse(requestOptions); + } + + /** + * The errorResponseStatusCode404 operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response errorResponseStatusCode404WithResponse(RequestOptions requestOptions) { + return this.serviceClient.errorResponseStatusCode404WithResponse(requestOptions); + } + + /** + * The errorResponseStatusCodeInRange operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void errorResponseStatusCodeInRange() { + // Generated convenience method for errorResponseStatusCodeInRangeWithResponse + RequestOptions requestOptions = new RequestOptions(); + errorResponseStatusCodeInRangeWithResponse(requestOptions).getValue(); + } + + /** + * The errorResponseStatusCode404 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void errorResponseStatusCode404() { + // Generated convenience method for errorResponseStatusCode404WithResponse + RequestOptions requestOptions = new RequestOptions(); + errorResponseStatusCode404WithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClientBuilder.java new file mode 100644 index 00000000000..ff02f0e698b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/StatusCodeRangeClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package response.statuscoderange; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import response.statuscoderange.implementation.StatusCodeRangeClientImpl; + +/** + * A builder for creating a new instance of the StatusCodeRangeClient type. + */ +@ServiceClientBuilder(serviceClients = { StatusCodeRangeClient.class, StatusCodeRangeAsyncClient.class }) +public final class StatusCodeRangeClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("response-statuscoderange.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the StatusCodeRangeClientBuilder. + */ + @Generated + public StatusCodeRangeClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StatusCodeRangeClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StatusCodeRangeClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StatusCodeRangeClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StatusCodeRangeClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StatusCodeRangeClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StatusCodeRangeClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StatusCodeRangeClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public StatusCodeRangeClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the StatusCodeRangeClientBuilder. + */ + @Generated + public StatusCodeRangeClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of StatusCodeRangeClientImpl with the provided parameters. + * + * @return an instance of StatusCodeRangeClientImpl. + */ + @Generated + private StatusCodeRangeClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + StatusCodeRangeClientImpl client = new StatusCodeRangeClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of StatusCodeRangeAsyncClient class. + * + * @return an instance of StatusCodeRangeAsyncClient. + */ + @Generated + public StatusCodeRangeAsyncClient buildAsyncClient() { + return new StatusCodeRangeAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of StatusCodeRangeClient class. + * + * @return an instance of StatusCodeRangeClient. + */ + @Generated + public StatusCodeRangeClient buildClient() { + return new StatusCodeRangeClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(StatusCodeRangeClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/StatusCodeRangeClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/StatusCodeRangeClientImpl.java new file mode 100644 index 00000000000..ce8cf3030fa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/StatusCodeRangeClientImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package response.statuscoderange.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the StatusCodeRangeClient type. + */ +public final class StatusCodeRangeClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StatusCodeRangeClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of StatusCodeRangeClient client. + * + * @param endpoint Service host. + */ + public StatusCodeRangeClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of StatusCodeRangeClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public StatusCodeRangeClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of StatusCodeRangeClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public StatusCodeRangeClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(StatusCodeRangeClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for StatusCodeRangeClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "StatusCodeRangeClient") + public interface StatusCodeRangeClientService { + @Get("/response/status-code-range/error-response-status-code-in-range") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> errorResponseStatusCodeInRange(@HostParam("endpoint") String endpoint, + RequestOptions requestOptions, Context context); + + @Get("/response/status-code-range/error-response-status-code-in-range") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response errorResponseStatusCodeInRangeSync(@HostParam("endpoint") String endpoint, + RequestOptions requestOptions, Context context); + + @Get("/response/status-code-range/error-response-status-code-404") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> errorResponseStatusCode404(@HostParam("endpoint") String endpoint, + RequestOptions requestOptions, Context context); + + @Get("/response/status-code-range/error-response-status-code-404") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response errorResponseStatusCode404Sync(@HostParam("endpoint") String endpoint, + RequestOptions requestOptions, Context context); + } + + /** + * The errorResponseStatusCodeInRange operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> errorResponseStatusCodeInRangeWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.errorResponseStatusCodeInRange(this.getEndpoint(), requestOptions, context)); + } + + /** + * The errorResponseStatusCodeInRange operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response errorResponseStatusCodeInRangeWithResponse(RequestOptions requestOptions) { + return service.errorResponseStatusCodeInRangeSync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The errorResponseStatusCode404 operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> errorResponseStatusCode404WithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.errorResponseStatusCode404(this.getEndpoint(), requestOptions, context)); + } + + /** + * The errorResponseStatusCode404 operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response errorResponseStatusCode404WithResponse(RequestOptions requestOptions) { + return service.errorResponseStatusCode404Sync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/package-info.java new file mode 100644 index 00000000000..55549a1fa0b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for StatusCodeRange. + * Test for range of status code. + * + */ +package response.statuscoderange.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/package-info.java new file mode 100644 index 00000000000..671243840d0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/response/statuscoderange/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for StatusCodeRange. + * Test for range of status code. + * + */ +package response.statuscoderange; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceAsyncClient.java new file mode 100644 index 00000000000..2d87c4f597b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import routes.implementation.InInterfacesImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class InInterfaceAsyncClient { + @Generated + private final InInterfacesImpl serviceClient; + + /** + * Initializes an instance of InInterfaceAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + InInterfaceAsyncClient(InInterfacesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The fixed operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fixedWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fixedWithResponseAsync(requestOptions); + } + + /** + * The fixed operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fixed() { + // Generated convenience method for fixedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fixedWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceClient.java new file mode 100644 index 00000000000..bde2701511b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/InInterfaceClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import routes.implementation.InInterfacesImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class InInterfaceClient { + @Generated + private final InInterfacesImpl serviceClient; + + /** + * Initializes an instance of InInterfaceClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + InInterfaceClient(InInterfacesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The fixed operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fixedWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fixedWithResponse(requestOptions); + } + + /** + * The fixed operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fixed() { + // Generated convenience method for fixedWithResponse + RequestOptions requestOptions = new RequestOptions(); + fixedWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersAsyncClient.java new file mode 100644 index 00000000000..08f362adf26 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersAsyncClient.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import routes.implementation.PathParametersImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class PathParametersAsyncClient { + @Generated + private final PathParametersImpl serviceClient; + + /** + * Initializes an instance of PathParametersAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersAsyncClient(PathParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The templateOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> templateOnlyWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.templateOnlyWithResponseAsync(param, requestOptions); + } + + /** + * The explicit operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> explicitWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.explicitWithResponseAsync(param, requestOptions); + } + + /** + * The annotationOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> annotationOnlyWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.annotationOnlyWithResponseAsync(param, requestOptions); + } + + /** + * The templateOnly operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono templateOnly(String param) { + // Generated convenience method for templateOnlyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return templateOnlyWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The explicit operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono explicit(String param) { + // Generated convenience method for explicitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return explicitWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The annotationOnly operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono annotationOnly(String param) { + // Generated convenience method for annotationOnlyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return annotationOnlyWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersClient.java new file mode 100644 index 00000000000..2c0a9d307d9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersClient.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import routes.implementation.PathParametersImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class PathParametersClient { + @Generated + private final PathParametersImpl serviceClient; + + /** + * Initializes an instance of PathParametersClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersClient(PathParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The templateOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response templateOnlyWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.templateOnlyWithResponse(param, requestOptions); + } + + /** + * The explicit operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response explicitWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.explicitWithResponse(param, requestOptions); + } + + /** + * The annotationOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response annotationOnlyWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.annotationOnlyWithResponse(param, requestOptions); + } + + /** + * The templateOnly operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void templateOnly(String param) { + // Generated convenience method for templateOnlyWithResponse + RequestOptions requestOptions = new RequestOptions(); + templateOnlyWithResponse(param, requestOptions).getValue(); + } + + /** + * The explicit operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void explicit(String param) { + // Generated convenience method for explicitWithResponse + RequestOptions requestOptions = new RequestOptions(); + explicitWithResponse(param, requestOptions).getValue(); + } + + /** + * The annotationOnly operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void annotationOnly(String param) { + // Generated convenience method for annotationOnlyWithResponse + RequestOptions requestOptions = new RequestOptions(); + annotationOnlyWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeAsyncClient.java new file mode 100644 index 00000000000..677c05b697f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeAsyncClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import reactor.core.publisher.Mono; +import routes.implementation.PathParametersLabelExpansionExplodesImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class PathParametersLabelExpansionExplodeAsyncClient { + @Generated + private final PathParametersLabelExpansionExplodesImpl serviceClient; + + /** + * Initializes an instance of PathParametersLabelExpansionExplodeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersLabelExpansionExplodeAsyncClient(PathParametersLabelExpansionExplodesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponseAsync(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponseAsync(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeClient.java new file mode 100644 index 00000000000..2086edeb4ee --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionExplodeClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import java.util.Map; +import routes.implementation.PathParametersLabelExpansionExplodesImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class PathParametersLabelExpansionExplodeClient { + @Generated + private final PathParametersLabelExpansionExplodesImpl serviceClient; + + /** + * Initializes an instance of PathParametersLabelExpansionExplodeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersLabelExpansionExplodeClient(PathParametersLabelExpansionExplodesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponse(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponse(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponse(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + primitiveWithResponse(param, requestOptions).getValue(); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + arrayWithResponse(param, requestOptions).getValue(); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + recordWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardAsyncClient.java new file mode 100644 index 00000000000..9f32721b34b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardAsyncClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import reactor.core.publisher.Mono; +import routes.implementation.PathParametersLabelExpansionStandardsImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class PathParametersLabelExpansionStandardAsyncClient { + @Generated + private final PathParametersLabelExpansionStandardsImpl serviceClient; + + /** + * Initializes an instance of PathParametersLabelExpansionStandardAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersLabelExpansionStandardAsyncClient(PathParametersLabelExpansionStandardsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponseAsync(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponseAsync(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardClient.java new file mode 100644 index 00000000000..30731fb1bb1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersLabelExpansionStandardClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import java.util.Map; +import routes.implementation.PathParametersLabelExpansionStandardsImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class PathParametersLabelExpansionStandardClient { + @Generated + private final PathParametersLabelExpansionStandardsImpl serviceClient; + + /** + * Initializes an instance of PathParametersLabelExpansionStandardClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersLabelExpansionStandardClient(PathParametersLabelExpansionStandardsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponse(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponse(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponse(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + primitiveWithResponse(param, requestOptions).getValue(); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + arrayWithResponse(param, requestOptions).getValue(); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + recordWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeAsyncClient.java new file mode 100644 index 00000000000..4ffa11efc10 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeAsyncClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import reactor.core.publisher.Mono; +import routes.implementation.PathParametersMatrixExpansionExplodesImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class PathParametersMatrixExpansionExplodeAsyncClient { + @Generated + private final PathParametersMatrixExpansionExplodesImpl serviceClient; + + /** + * Initializes an instance of PathParametersMatrixExpansionExplodeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersMatrixExpansionExplodeAsyncClient(PathParametersMatrixExpansionExplodesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponseAsync(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponseAsync(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeClient.java new file mode 100644 index 00000000000..8c6f498f62e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionExplodeClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import java.util.Map; +import routes.implementation.PathParametersMatrixExpansionExplodesImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class PathParametersMatrixExpansionExplodeClient { + @Generated + private final PathParametersMatrixExpansionExplodesImpl serviceClient; + + /** + * Initializes an instance of PathParametersMatrixExpansionExplodeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersMatrixExpansionExplodeClient(PathParametersMatrixExpansionExplodesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponse(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponse(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponse(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + primitiveWithResponse(param, requestOptions).getValue(); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + arrayWithResponse(param, requestOptions).getValue(); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + recordWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardAsyncClient.java new file mode 100644 index 00000000000..22ac90ff860 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardAsyncClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import reactor.core.publisher.Mono; +import routes.implementation.PathParametersMatrixExpansionStandardsImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class PathParametersMatrixExpansionStandardAsyncClient { + @Generated + private final PathParametersMatrixExpansionStandardsImpl serviceClient; + + /** + * Initializes an instance of PathParametersMatrixExpansionStandardAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersMatrixExpansionStandardAsyncClient(PathParametersMatrixExpansionStandardsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponseAsync(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponseAsync(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardClient.java new file mode 100644 index 00000000000..8d4480b32ec --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersMatrixExpansionStandardClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import java.util.Map; +import routes.implementation.PathParametersMatrixExpansionStandardsImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class PathParametersMatrixExpansionStandardClient { + @Generated + private final PathParametersMatrixExpansionStandardsImpl serviceClient; + + /** + * Initializes an instance of PathParametersMatrixExpansionStandardClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersMatrixExpansionStandardClient(PathParametersMatrixExpansionStandardsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponse(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponse(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponse(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + primitiveWithResponse(param, requestOptions).getValue(); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + arrayWithResponse(param, requestOptions).getValue(); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + recordWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeAsyncClient.java new file mode 100644 index 00000000000..3ce17131340 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeAsyncClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import reactor.core.publisher.Mono; +import routes.implementation.PathParametersPathExpansionExplodesImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class PathParametersPathExpansionExplodeAsyncClient { + @Generated + private final PathParametersPathExpansionExplodesImpl serviceClient; + + /** + * Initializes an instance of PathParametersPathExpansionExplodeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersPathExpansionExplodeAsyncClient(PathParametersPathExpansionExplodesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponseAsync(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponseAsync(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeClient.java new file mode 100644 index 00000000000..d1c98ee0caf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionExplodeClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import java.util.Map; +import routes.implementation.PathParametersPathExpansionExplodesImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class PathParametersPathExpansionExplodeClient { + @Generated + private final PathParametersPathExpansionExplodesImpl serviceClient; + + /** + * Initializes an instance of PathParametersPathExpansionExplodeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersPathExpansionExplodeClient(PathParametersPathExpansionExplodesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponse(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponse(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponse(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + primitiveWithResponse(param, requestOptions).getValue(); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + arrayWithResponse(param, requestOptions).getValue(); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + recordWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardAsyncClient.java new file mode 100644 index 00000000000..df4adba481b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardAsyncClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import reactor.core.publisher.Mono; +import routes.implementation.PathParametersPathExpansionStandardsImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class PathParametersPathExpansionStandardAsyncClient { + @Generated + private final PathParametersPathExpansionStandardsImpl serviceClient; + + /** + * Initializes an instance of PathParametersPathExpansionStandardAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersPathExpansionStandardAsyncClient(PathParametersPathExpansionStandardsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponseAsync(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponseAsync(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardClient.java new file mode 100644 index 00000000000..01cf42726ab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersPathExpansionStandardClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import java.util.Map; +import routes.implementation.PathParametersPathExpansionStandardsImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class PathParametersPathExpansionStandardClient { + @Generated + private final PathParametersPathExpansionStandardsImpl serviceClient; + + /** + * Initializes an instance of PathParametersPathExpansionStandardClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersPathExpansionStandardClient(PathParametersPathExpansionStandardsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponse(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponse(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponse(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + primitiveWithResponse(param, requestOptions).getValue(); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + arrayWithResponse(param, requestOptions).getValue(); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + recordWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionAsyncClient.java new file mode 100644 index 00000000000..1648d254406 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionAsyncClient.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import routes.implementation.PathParametersReservedExpansionsImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class PathParametersReservedExpansionAsyncClient { + @Generated + private final PathParametersReservedExpansionsImpl serviceClient; + + /** + * Initializes an instance of PathParametersReservedExpansionAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersReservedExpansionAsyncClient(PathParametersReservedExpansionsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The template operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> templateWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.templateWithResponseAsync(param, requestOptions); + } + + /** + * The annotation operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> annotationWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.annotationWithResponseAsync(param, requestOptions); + } + + /** + * The template operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono template(String param) { + // Generated convenience method for templateWithResponse + RequestOptions requestOptions = new RequestOptions(); + return templateWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The annotation operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono annotation(String param) { + // Generated convenience method for annotationWithResponse + RequestOptions requestOptions = new RequestOptions(); + return annotationWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionClient.java new file mode 100644 index 00000000000..db3f7e09ac9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersReservedExpansionClient.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import routes.implementation.PathParametersReservedExpansionsImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class PathParametersReservedExpansionClient { + @Generated + private final PathParametersReservedExpansionsImpl serviceClient; + + /** + * Initializes an instance of PathParametersReservedExpansionClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersReservedExpansionClient(PathParametersReservedExpansionsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The template operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response templateWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.templateWithResponse(param, requestOptions); + } + + /** + * The annotation operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response annotationWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.annotationWithResponse(param, requestOptions); + } + + /** + * The template operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void template(String param) { + // Generated convenience method for templateWithResponse + RequestOptions requestOptions = new RequestOptions(); + templateWithResponse(param, requestOptions).getValue(); + } + + /** + * The annotation operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void annotation(String param) { + // Generated convenience method for annotationWithResponse + RequestOptions requestOptions = new RequestOptions(); + annotationWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeAsyncClient.java new file mode 100644 index 00000000000..397536e5152 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeAsyncClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import reactor.core.publisher.Mono; +import routes.implementation.PathParametersSimpleExpansionExplodesImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class PathParametersSimpleExpansionExplodeAsyncClient { + @Generated + private final PathParametersSimpleExpansionExplodesImpl serviceClient; + + /** + * Initializes an instance of PathParametersSimpleExpansionExplodeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersSimpleExpansionExplodeAsyncClient(PathParametersSimpleExpansionExplodesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponseAsync(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponseAsync(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeClient.java new file mode 100644 index 00000000000..78f36c391c3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionExplodeClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import java.util.Map; +import routes.implementation.PathParametersSimpleExpansionExplodesImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class PathParametersSimpleExpansionExplodeClient { + @Generated + private final PathParametersSimpleExpansionExplodesImpl serviceClient; + + /** + * Initializes an instance of PathParametersSimpleExpansionExplodeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersSimpleExpansionExplodeClient(PathParametersSimpleExpansionExplodesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponse(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponse(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponse(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + primitiveWithResponse(param, requestOptions).getValue(); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + arrayWithResponse(param, requestOptions).getValue(); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + recordWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardAsyncClient.java new file mode 100644 index 00000000000..24efff8daba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardAsyncClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import reactor.core.publisher.Mono; +import routes.implementation.PathParametersSimpleExpansionStandardsImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class PathParametersSimpleExpansionStandardAsyncClient { + @Generated + private final PathParametersSimpleExpansionStandardsImpl serviceClient; + + /** + * Initializes an instance of PathParametersSimpleExpansionStandardAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersSimpleExpansionStandardAsyncClient(PathParametersSimpleExpansionStandardsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponseAsync(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponseAsync(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardClient.java new file mode 100644 index 00000000000..2e36ba00608 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/PathParametersSimpleExpansionStandardClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import java.util.Map; +import routes.implementation.PathParametersSimpleExpansionStandardsImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class PathParametersSimpleExpansionStandardClient { + @Generated + private final PathParametersSimpleExpansionStandardsImpl serviceClient; + + /** + * Initializes an instance of PathParametersSimpleExpansionStandardClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PathParametersSimpleExpansionStandardClient(PathParametersSimpleExpansionStandardsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponse(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponse(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponse(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + primitiveWithResponse(param, requestOptions).getValue(); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + arrayWithResponse(param, requestOptions).getValue(); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + recordWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersAsyncClient.java new file mode 100644 index 00000000000..6f7cafcabb4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersAsyncClient.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import routes.implementation.QueryParametersImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class QueryParametersAsyncClient { + @Generated + private final QueryParametersImpl serviceClient; + + /** + * Initializes an instance of QueryParametersAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryParametersAsyncClient(QueryParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The templateOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> templateOnlyWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.templateOnlyWithResponseAsync(param, requestOptions); + } + + /** + * The explicit operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> explicitWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.explicitWithResponseAsync(param, requestOptions); + } + + /** + * The annotationOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> annotationOnlyWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.annotationOnlyWithResponseAsync(param, requestOptions); + } + + /** + * The templateOnly operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono templateOnly(String param) { + // Generated convenience method for templateOnlyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return templateOnlyWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The explicit operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono explicit(String param) { + // Generated convenience method for explicitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return explicitWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The annotationOnly operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono annotationOnly(String param) { + // Generated convenience method for annotationOnlyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return annotationOnlyWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersClient.java new file mode 100644 index 00000000000..b192d97cc68 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersClient.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import routes.implementation.QueryParametersImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class QueryParametersClient { + @Generated + private final QueryParametersImpl serviceClient; + + /** + * Initializes an instance of QueryParametersClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryParametersClient(QueryParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The templateOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response templateOnlyWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.templateOnlyWithResponse(param, requestOptions); + } + + /** + * The explicit operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response explicitWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.explicitWithResponse(param, requestOptions); + } + + /** + * The annotationOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response annotationOnlyWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.annotationOnlyWithResponse(param, requestOptions); + } + + /** + * The templateOnly operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void templateOnly(String param) { + // Generated convenience method for templateOnlyWithResponse + RequestOptions requestOptions = new RequestOptions(); + templateOnlyWithResponse(param, requestOptions).getValue(); + } + + /** + * The explicit operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void explicit(String param) { + // Generated convenience method for explicitWithResponse + RequestOptions requestOptions = new RequestOptions(); + explicitWithResponse(param, requestOptions).getValue(); + } + + /** + * The annotationOnly operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void annotationOnly(String param) { + // Generated convenience method for annotationOnlyWithResponse + RequestOptions requestOptions = new RequestOptions(); + annotationOnlyWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeAsyncClient.java new file mode 100644 index 00000000000..4593254b21e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeAsyncClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import reactor.core.publisher.Mono; +import routes.implementation.QueryParametersQueryContinuationExplodesImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class QueryParametersQueryContinuationExplodeAsyncClient { + @Generated + private final QueryParametersQueryContinuationExplodesImpl serviceClient; + + /** + * Initializes an instance of QueryParametersQueryContinuationExplodeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryParametersQueryContinuationExplodeAsyncClient(QueryParametersQueryContinuationExplodesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponseAsync(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponseAsync(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeClient.java new file mode 100644 index 00000000000..0a562af346f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationExplodeClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import java.util.Map; +import routes.implementation.QueryParametersQueryContinuationExplodesImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class QueryParametersQueryContinuationExplodeClient { + @Generated + private final QueryParametersQueryContinuationExplodesImpl serviceClient; + + /** + * Initializes an instance of QueryParametersQueryContinuationExplodeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryParametersQueryContinuationExplodeClient(QueryParametersQueryContinuationExplodesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponse(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponse(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponse(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + primitiveWithResponse(param, requestOptions).getValue(); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + arrayWithResponse(param, requestOptions).getValue(); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + recordWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardAsyncClient.java new file mode 100644 index 00000000000..618f09e8895 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardAsyncClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import reactor.core.publisher.Mono; +import routes.implementation.QueryParametersQueryContinuationStandardsImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class QueryParametersQueryContinuationStandardAsyncClient { + @Generated + private final QueryParametersQueryContinuationStandardsImpl serviceClient; + + /** + * Initializes an instance of QueryParametersQueryContinuationStandardAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryParametersQueryContinuationStandardAsyncClient(QueryParametersQueryContinuationStandardsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponseAsync(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponseAsync(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardClient.java new file mode 100644 index 00000000000..dc5351b0ad4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryContinuationStandardClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import java.util.Map; +import routes.implementation.QueryParametersQueryContinuationStandardsImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class QueryParametersQueryContinuationStandardClient { + @Generated + private final QueryParametersQueryContinuationStandardsImpl serviceClient; + + /** + * Initializes an instance of QueryParametersQueryContinuationStandardClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryParametersQueryContinuationStandardClient(QueryParametersQueryContinuationStandardsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponse(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponse(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponse(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + primitiveWithResponse(param, requestOptions).getValue(); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + arrayWithResponse(param, requestOptions).getValue(); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + recordWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeAsyncClient.java new file mode 100644 index 00000000000..ce1c3db069d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeAsyncClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import reactor.core.publisher.Mono; +import routes.implementation.QueryParametersQueryExpansionExplodesImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class QueryParametersQueryExpansionExplodeAsyncClient { + @Generated + private final QueryParametersQueryExpansionExplodesImpl serviceClient; + + /** + * Initializes an instance of QueryParametersQueryExpansionExplodeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryParametersQueryExpansionExplodeAsyncClient(QueryParametersQueryExpansionExplodesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponseAsync(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponseAsync(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeClient.java new file mode 100644 index 00000000000..267bcb6b548 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionExplodeClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import java.util.Map; +import routes.implementation.QueryParametersQueryExpansionExplodesImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class QueryParametersQueryExpansionExplodeClient { + @Generated + private final QueryParametersQueryExpansionExplodesImpl serviceClient; + + /** + * Initializes an instance of QueryParametersQueryExpansionExplodeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryParametersQueryExpansionExplodeClient(QueryParametersQueryExpansionExplodesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponse(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponse(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponse(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + primitiveWithResponse(param, requestOptions).getValue(); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + arrayWithResponse(param, requestOptions).getValue(); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + recordWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardAsyncClient.java new file mode 100644 index 00000000000..443f762d223 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardAsyncClient.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import reactor.core.publisher.Mono; +import routes.implementation.QueryParametersQueryExpansionStandardsImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class QueryParametersQueryExpansionStandardAsyncClient { + @Generated + private final QueryParametersQueryExpansionStandardsImpl serviceClient; + + /** + * Initializes an instance of QueryParametersQueryExpansionStandardAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryParametersQueryExpansionStandardAsyncClient(QueryParametersQueryExpansionStandardsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponseAsync(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponseAsync(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponseAsync(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return primitiveWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return arrayWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + return recordWithResponse(param, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardClient.java new file mode 100644 index 00000000000..91bfd0cc27b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/QueryParametersQueryExpansionStandardClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import java.util.List; +import java.util.Map; +import routes.implementation.QueryParametersQueryExpansionStandardsImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class QueryParametersQueryExpansionStandardClient { + @Generated + private final QueryParametersQueryExpansionStandardsImpl serviceClient; + + /** + * Initializes an instance of QueryParametersQueryExpansionStandardClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + QueryParametersQueryExpansionStandardClient(QueryParametersQueryExpansionStandardsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return this.serviceClient.primitiveWithResponse(param, requestOptions); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + return this.serviceClient.arrayWithResponse(param, requestOptions); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return this.serviceClient.recordWithResponse(param, requestOptions); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void primitive(String param) { + // Generated convenience method for primitiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + primitiveWithResponse(param, requestOptions).getValue(); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void array(List param) { + // Generated convenience method for arrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + arrayWithResponse(param, requestOptions).getValue(); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void record(Map param) { + // Generated convenience method for recordWithResponse + RequestOptions requestOptions = new RequestOptions(); + recordWithResponse(param, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesAsyncClient.java new file mode 100644 index 00000000000..7e9e7d1572a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import routes.implementation.RoutesClientImpl; + +/** + * Initializes a new instance of the asynchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class, isAsync = true) +public final class RoutesAsyncClient { + @Generated + private final RoutesClientImpl serviceClient; + + /** + * Initializes an instance of RoutesAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RoutesAsyncClient(RoutesClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The fixed operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fixedWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fixedWithResponseAsync(requestOptions); + } + + /** + * The fixed operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono fixed() { + // Generated convenience method for fixedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fixedWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClient.java new file mode 100644 index 00000000000..c5854322942 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import routes.implementation.RoutesClientImpl; + +/** + * Initializes a new instance of the synchronous RoutesClient type. + */ +@ServiceClient(builder = RoutesClientBuilder.class) +public final class RoutesClient { + @Generated + private final RoutesClientImpl serviceClient; + + /** + * Initializes an instance of RoutesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RoutesClient(RoutesClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The fixed operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fixedWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fixedWithResponse(requestOptions); + } + + /** + * The fixed operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void fixed() { + // Generated convenience method for fixedWithResponse + RequestOptions requestOptions = new RequestOptions(); + fixedWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClientBuilder.java new file mode 100644 index 00000000000..be76263fef0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/RoutesClientBuilder.java @@ -0,0 +1,668 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import routes.implementation.RoutesClientImpl; + +/** + * A builder for creating a new instance of the RoutesClient type. + */ +@ServiceClientBuilder( + serviceClients = { + RoutesClient.class, + PathParametersClient.class, + PathParametersReservedExpansionClient.class, + PathParametersSimpleExpansionStandardClient.class, + PathParametersSimpleExpansionExplodeClient.class, + PathParametersPathExpansionStandardClient.class, + PathParametersPathExpansionExplodeClient.class, + PathParametersLabelExpansionStandardClient.class, + PathParametersLabelExpansionExplodeClient.class, + PathParametersMatrixExpansionStandardClient.class, + PathParametersMatrixExpansionExplodeClient.class, + QueryParametersClient.class, + QueryParametersQueryExpansionStandardClient.class, + QueryParametersQueryExpansionExplodeClient.class, + QueryParametersQueryContinuationStandardClient.class, + QueryParametersQueryContinuationExplodeClient.class, + InInterfaceClient.class, + RoutesAsyncClient.class, + PathParametersAsyncClient.class, + PathParametersReservedExpansionAsyncClient.class, + PathParametersSimpleExpansionStandardAsyncClient.class, + PathParametersSimpleExpansionExplodeAsyncClient.class, + PathParametersPathExpansionStandardAsyncClient.class, + PathParametersPathExpansionExplodeAsyncClient.class, + PathParametersLabelExpansionStandardAsyncClient.class, + PathParametersLabelExpansionExplodeAsyncClient.class, + PathParametersMatrixExpansionStandardAsyncClient.class, + PathParametersMatrixExpansionExplodeAsyncClient.class, + QueryParametersAsyncClient.class, + QueryParametersQueryExpansionStandardAsyncClient.class, + QueryParametersQueryExpansionExplodeAsyncClient.class, + QueryParametersQueryContinuationStandardAsyncClient.class, + QueryParametersQueryContinuationExplodeAsyncClient.class, + InInterfaceAsyncClient.class }) +public final class RoutesClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("routes.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the RoutesClientBuilder. + */ + @Generated + public RoutesClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RoutesClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RoutesClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RoutesClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RoutesClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RoutesClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RoutesClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RoutesClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RoutesClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the RoutesClientBuilder. + */ + @Generated + public RoutesClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of RoutesClientImpl with the provided parameters. + * + * @return an instance of RoutesClientImpl. + */ + @Generated + private RoutesClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + RoutesClientImpl client + = new RoutesClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of RoutesAsyncClient class. + * + * @return an instance of RoutesAsyncClient. + */ + @Generated + public RoutesAsyncClient buildAsyncClient() { + return new RoutesAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of PathParametersAsyncClient class. + * + * @return an instance of PathParametersAsyncClient. + */ + @Generated + public PathParametersAsyncClient buildPathParametersAsyncClient() { + return new PathParametersAsyncClient(buildInnerClient().getPathParameters()); + } + + /** + * Builds an instance of PathParametersReservedExpansionAsyncClient class. + * + * @return an instance of PathParametersReservedExpansionAsyncClient. + */ + @Generated + public PathParametersReservedExpansionAsyncClient buildPathParametersReservedExpansionAsyncClient() { + return new PathParametersReservedExpansionAsyncClient(buildInnerClient().getPathParametersReservedExpansions()); + } + + /** + * Builds an instance of PathParametersSimpleExpansionStandardAsyncClient class. + * + * @return an instance of PathParametersSimpleExpansionStandardAsyncClient. + */ + @Generated + public PathParametersSimpleExpansionStandardAsyncClient buildPathParametersSimpleExpansionStandardAsyncClient() { + return new PathParametersSimpleExpansionStandardAsyncClient( + buildInnerClient().getPathParametersSimpleExpansionStandards()); + } + + /** + * Builds an instance of PathParametersSimpleExpansionExplodeAsyncClient class. + * + * @return an instance of PathParametersSimpleExpansionExplodeAsyncClient. + */ + @Generated + public PathParametersSimpleExpansionExplodeAsyncClient buildPathParametersSimpleExpansionExplodeAsyncClient() { + return new PathParametersSimpleExpansionExplodeAsyncClient( + buildInnerClient().getPathParametersSimpleExpansionExplodes()); + } + + /** + * Builds an instance of PathParametersPathExpansionStandardAsyncClient class. + * + * @return an instance of PathParametersPathExpansionStandardAsyncClient. + */ + @Generated + public PathParametersPathExpansionStandardAsyncClient buildPathParametersPathExpansionStandardAsyncClient() { + return new PathParametersPathExpansionStandardAsyncClient( + buildInnerClient().getPathParametersPathExpansionStandards()); + } + + /** + * Builds an instance of PathParametersPathExpansionExplodeAsyncClient class. + * + * @return an instance of PathParametersPathExpansionExplodeAsyncClient. + */ + @Generated + public PathParametersPathExpansionExplodeAsyncClient buildPathParametersPathExpansionExplodeAsyncClient() { + return new PathParametersPathExpansionExplodeAsyncClient( + buildInnerClient().getPathParametersPathExpansionExplodes()); + } + + /** + * Builds an instance of PathParametersLabelExpansionStandardAsyncClient class. + * + * @return an instance of PathParametersLabelExpansionStandardAsyncClient. + */ + @Generated + public PathParametersLabelExpansionStandardAsyncClient buildPathParametersLabelExpansionStandardAsyncClient() { + return new PathParametersLabelExpansionStandardAsyncClient( + buildInnerClient().getPathParametersLabelExpansionStandards()); + } + + /** + * Builds an instance of PathParametersLabelExpansionExplodeAsyncClient class. + * + * @return an instance of PathParametersLabelExpansionExplodeAsyncClient. + */ + @Generated + public PathParametersLabelExpansionExplodeAsyncClient buildPathParametersLabelExpansionExplodeAsyncClient() { + return new PathParametersLabelExpansionExplodeAsyncClient( + buildInnerClient().getPathParametersLabelExpansionExplodes()); + } + + /** + * Builds an instance of PathParametersMatrixExpansionStandardAsyncClient class. + * + * @return an instance of PathParametersMatrixExpansionStandardAsyncClient. + */ + @Generated + public PathParametersMatrixExpansionStandardAsyncClient buildPathParametersMatrixExpansionStandardAsyncClient() { + return new PathParametersMatrixExpansionStandardAsyncClient( + buildInnerClient().getPathParametersMatrixExpansionStandards()); + } + + /** + * Builds an instance of PathParametersMatrixExpansionExplodeAsyncClient class. + * + * @return an instance of PathParametersMatrixExpansionExplodeAsyncClient. + */ + @Generated + public PathParametersMatrixExpansionExplodeAsyncClient buildPathParametersMatrixExpansionExplodeAsyncClient() { + return new PathParametersMatrixExpansionExplodeAsyncClient( + buildInnerClient().getPathParametersMatrixExpansionExplodes()); + } + + /** + * Builds an instance of QueryParametersAsyncClient class. + * + * @return an instance of QueryParametersAsyncClient. + */ + @Generated + public QueryParametersAsyncClient buildQueryParametersAsyncClient() { + return new QueryParametersAsyncClient(buildInnerClient().getQueryParameters()); + } + + /** + * Builds an instance of QueryParametersQueryExpansionStandardAsyncClient class. + * + * @return an instance of QueryParametersQueryExpansionStandardAsyncClient. + */ + @Generated + public QueryParametersQueryExpansionStandardAsyncClient buildQueryParametersQueryExpansionStandardAsyncClient() { + return new QueryParametersQueryExpansionStandardAsyncClient( + buildInnerClient().getQueryParametersQueryExpansionStandards()); + } + + /** + * Builds an instance of QueryParametersQueryExpansionExplodeAsyncClient class. + * + * @return an instance of QueryParametersQueryExpansionExplodeAsyncClient. + */ + @Generated + public QueryParametersQueryExpansionExplodeAsyncClient buildQueryParametersQueryExpansionExplodeAsyncClient() { + return new QueryParametersQueryExpansionExplodeAsyncClient( + buildInnerClient().getQueryParametersQueryExpansionExplodes()); + } + + /** + * Builds an instance of QueryParametersQueryContinuationStandardAsyncClient class. + * + * @return an instance of QueryParametersQueryContinuationStandardAsyncClient. + */ + @Generated + public QueryParametersQueryContinuationStandardAsyncClient + buildQueryParametersQueryContinuationStandardAsyncClient() { + return new QueryParametersQueryContinuationStandardAsyncClient( + buildInnerClient().getQueryParametersQueryContinuationStandards()); + } + + /** + * Builds an instance of QueryParametersQueryContinuationExplodeAsyncClient class. + * + * @return an instance of QueryParametersQueryContinuationExplodeAsyncClient. + */ + @Generated + public QueryParametersQueryContinuationExplodeAsyncClient + buildQueryParametersQueryContinuationExplodeAsyncClient() { + return new QueryParametersQueryContinuationExplodeAsyncClient( + buildInnerClient().getQueryParametersQueryContinuationExplodes()); + } + + /** + * Builds an instance of InInterfaceAsyncClient class. + * + * @return an instance of InInterfaceAsyncClient. + */ + @Generated + public InInterfaceAsyncClient buildInInterfaceAsyncClient() { + return new InInterfaceAsyncClient(buildInnerClient().getInInterfaces()); + } + + /** + * Builds an instance of RoutesClient class. + * + * @return an instance of RoutesClient. + */ + @Generated + public RoutesClient buildClient() { + return new RoutesClient(buildInnerClient()); + } + + /** + * Builds an instance of PathParametersClient class. + * + * @return an instance of PathParametersClient. + */ + @Generated + public PathParametersClient buildPathParametersClient() { + return new PathParametersClient(buildInnerClient().getPathParameters()); + } + + /** + * Builds an instance of PathParametersReservedExpansionClient class. + * + * @return an instance of PathParametersReservedExpansionClient. + */ + @Generated + public PathParametersReservedExpansionClient buildPathParametersReservedExpansionClient() { + return new PathParametersReservedExpansionClient(buildInnerClient().getPathParametersReservedExpansions()); + } + + /** + * Builds an instance of PathParametersSimpleExpansionStandardClient class. + * + * @return an instance of PathParametersSimpleExpansionStandardClient. + */ + @Generated + public PathParametersSimpleExpansionStandardClient buildPathParametersSimpleExpansionStandardClient() { + return new PathParametersSimpleExpansionStandardClient( + buildInnerClient().getPathParametersSimpleExpansionStandards()); + } + + /** + * Builds an instance of PathParametersSimpleExpansionExplodeClient class. + * + * @return an instance of PathParametersSimpleExpansionExplodeClient. + */ + @Generated + public PathParametersSimpleExpansionExplodeClient buildPathParametersSimpleExpansionExplodeClient() { + return new PathParametersSimpleExpansionExplodeClient( + buildInnerClient().getPathParametersSimpleExpansionExplodes()); + } + + /** + * Builds an instance of PathParametersPathExpansionStandardClient class. + * + * @return an instance of PathParametersPathExpansionStandardClient. + */ + @Generated + public PathParametersPathExpansionStandardClient buildPathParametersPathExpansionStandardClient() { + return new PathParametersPathExpansionStandardClient( + buildInnerClient().getPathParametersPathExpansionStandards()); + } + + /** + * Builds an instance of PathParametersPathExpansionExplodeClient class. + * + * @return an instance of PathParametersPathExpansionExplodeClient. + */ + @Generated + public PathParametersPathExpansionExplodeClient buildPathParametersPathExpansionExplodeClient() { + return new PathParametersPathExpansionExplodeClient( + buildInnerClient().getPathParametersPathExpansionExplodes()); + } + + /** + * Builds an instance of PathParametersLabelExpansionStandardClient class. + * + * @return an instance of PathParametersLabelExpansionStandardClient. + */ + @Generated + public PathParametersLabelExpansionStandardClient buildPathParametersLabelExpansionStandardClient() { + return new PathParametersLabelExpansionStandardClient( + buildInnerClient().getPathParametersLabelExpansionStandards()); + } + + /** + * Builds an instance of PathParametersLabelExpansionExplodeClient class. + * + * @return an instance of PathParametersLabelExpansionExplodeClient. + */ + @Generated + public PathParametersLabelExpansionExplodeClient buildPathParametersLabelExpansionExplodeClient() { + return new PathParametersLabelExpansionExplodeClient( + buildInnerClient().getPathParametersLabelExpansionExplodes()); + } + + /** + * Builds an instance of PathParametersMatrixExpansionStandardClient class. + * + * @return an instance of PathParametersMatrixExpansionStandardClient. + */ + @Generated + public PathParametersMatrixExpansionStandardClient buildPathParametersMatrixExpansionStandardClient() { + return new PathParametersMatrixExpansionStandardClient( + buildInnerClient().getPathParametersMatrixExpansionStandards()); + } + + /** + * Builds an instance of PathParametersMatrixExpansionExplodeClient class. + * + * @return an instance of PathParametersMatrixExpansionExplodeClient. + */ + @Generated + public PathParametersMatrixExpansionExplodeClient buildPathParametersMatrixExpansionExplodeClient() { + return new PathParametersMatrixExpansionExplodeClient( + buildInnerClient().getPathParametersMatrixExpansionExplodes()); + } + + /** + * Builds an instance of QueryParametersClient class. + * + * @return an instance of QueryParametersClient. + */ + @Generated + public QueryParametersClient buildQueryParametersClient() { + return new QueryParametersClient(buildInnerClient().getQueryParameters()); + } + + /** + * Builds an instance of QueryParametersQueryExpansionStandardClient class. + * + * @return an instance of QueryParametersQueryExpansionStandardClient. + */ + @Generated + public QueryParametersQueryExpansionStandardClient buildQueryParametersQueryExpansionStandardClient() { + return new QueryParametersQueryExpansionStandardClient( + buildInnerClient().getQueryParametersQueryExpansionStandards()); + } + + /** + * Builds an instance of QueryParametersQueryExpansionExplodeClient class. + * + * @return an instance of QueryParametersQueryExpansionExplodeClient. + */ + @Generated + public QueryParametersQueryExpansionExplodeClient buildQueryParametersQueryExpansionExplodeClient() { + return new QueryParametersQueryExpansionExplodeClient( + buildInnerClient().getQueryParametersQueryExpansionExplodes()); + } + + /** + * Builds an instance of QueryParametersQueryContinuationStandardClient class. + * + * @return an instance of QueryParametersQueryContinuationStandardClient. + */ + @Generated + public QueryParametersQueryContinuationStandardClient buildQueryParametersQueryContinuationStandardClient() { + return new QueryParametersQueryContinuationStandardClient( + buildInnerClient().getQueryParametersQueryContinuationStandards()); + } + + /** + * Builds an instance of QueryParametersQueryContinuationExplodeClient class. + * + * @return an instance of QueryParametersQueryContinuationExplodeClient. + */ + @Generated + public QueryParametersQueryContinuationExplodeClient buildQueryParametersQueryContinuationExplodeClient() { + return new QueryParametersQueryContinuationExplodeClient( + buildInnerClient().getQueryParametersQueryContinuationExplodes()); + } + + /** + * Builds an instance of InInterfaceClient class. + * + * @return an instance of InInterfaceClient. + */ + @Generated + public InInterfaceClient buildInInterfaceClient() { + return new InInterfaceClient(buildInnerClient().getInInterfaces()); + } + + private static final ClientLogger LOGGER = new ClientLogger(RoutesClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/InInterfacesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/InInterfacesImpl.java new file mode 100644 index 00000000000..e8f098ff6e3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/InInterfacesImpl.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in InInterfaces. + */ +public final class InInterfacesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final InInterfacesService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of InInterfacesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InInterfacesImpl(RoutesClientImpl client) { + this.service + = RestProxy.create(InInterfacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientInInterfaces to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientInInterfaces") + public interface InInterfacesService { + @Get("/routes/in-interface/fixed") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> fixed(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/routes/in-interface/fixed") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fixedSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The fixed operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fixedWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.fixed(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The fixed operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fixedWithResponse(RequestOptions requestOptions) { + return service.fixedSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersImpl.java new file mode 100644 index 00000000000..72b05a7a165 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersImpl.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PathParameters. + */ +public final class PathParametersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathParametersService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of PathParametersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PathParametersImpl(RoutesClientImpl client) { + this.service + = RestProxy.create(PathParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientPathParameters to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientPathParameters") + public interface PathParametersService { + @Get("/routes/path/template-only/{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> templateOnly(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/template-only/{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response templateOnlySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/explicit/{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> explicit(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/explicit/{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response explicitSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/annotation-only/{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> annotationOnly(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/annotation-only/{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response annotationOnlySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + } + + /** + * The templateOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> templateOnlyWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.templateOnly(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The templateOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response templateOnlyWithResponse(String param, RequestOptions requestOptions) { + return service.templateOnlySync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The explicit operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> explicitWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.explicit(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The explicit operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response explicitWithResponse(String param, RequestOptions requestOptions) { + return service.explicitSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The annotationOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> annotationOnlyWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.annotationOnly(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The annotationOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response annotationOnlyWithResponse(String param, RequestOptions requestOptions) { + return service.annotationOnlySync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionExplodesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionExplodesImpl.java new file mode 100644 index 00000000000..1036b592bcb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionExplodesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PathParametersLabelExpansionExplodes. + */ +public final class PathParametersLabelExpansionExplodesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathParametersLabelExpansionExplodesService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of PathParametersLabelExpansionExplodesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PathParametersLabelExpansionExplodesImpl(RoutesClientImpl client) { + this.service = RestProxy.create(PathParametersLabelExpansionExplodesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientPathParametersLabelExpansionExplodes to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientPathParametersLabelExpansionExplodes") + public interface PathParametersLabelExpansionExplodesService { + @Get("/routes/path/label/explode/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/label/explode/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/label/explode/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/label/explode/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/label/explode/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> record(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + + @Get("/routes/path/label/explode/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recordSync(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionStandardsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionStandardsImpl.java new file mode 100644 index 00000000000..67c8867ac3e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersLabelExpansionStandardsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PathParametersLabelExpansionStandards. + */ +public final class PathParametersLabelExpansionStandardsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathParametersLabelExpansionStandardsService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of PathParametersLabelExpansionStandardsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PathParametersLabelExpansionStandardsImpl(RoutesClientImpl client) { + this.service = RestProxy.create(PathParametersLabelExpansionStandardsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientPathParametersLabelExpansionStandards to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientPathParametersLabelExpansionStandards") + public interface PathParametersLabelExpansionStandardsService { + @Get("/routes/path/label/standard/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/label/standard/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/label/standard/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/label/standard/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/label/standard/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> record(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + + @Get("/routes/path/label/standard/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recordSync(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionExplodesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionExplodesImpl.java new file mode 100644 index 00000000000..015db58141d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionExplodesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PathParametersMatrixExpansionExplodes. + */ +public final class PathParametersMatrixExpansionExplodesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathParametersMatrixExpansionExplodesService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of PathParametersMatrixExpansionExplodesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PathParametersMatrixExpansionExplodesImpl(RoutesClientImpl client) { + this.service = RestProxy.create(PathParametersMatrixExpansionExplodesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientPathParametersMatrixExpansionExplodes to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientPathParametersMatrixExpansionExplodes") + public interface PathParametersMatrixExpansionExplodesService { + @Get("/routes/path/matrix/explode/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/matrix/explode/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/matrix/explode/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/matrix/explode/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/matrix/explode/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> record(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + + @Get("/routes/path/matrix/explode/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recordSync(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionStandardsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionStandardsImpl.java new file mode 100644 index 00000000000..18eca57d6dc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersMatrixExpansionStandardsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PathParametersMatrixExpansionStandards. + */ +public final class PathParametersMatrixExpansionStandardsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathParametersMatrixExpansionStandardsService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of PathParametersMatrixExpansionStandardsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PathParametersMatrixExpansionStandardsImpl(RoutesClientImpl client) { + this.service = RestProxy.create(PathParametersMatrixExpansionStandardsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientPathParametersMatrixExpansionStandards to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientPathParametersMatrixExpansionStandards") + public interface PathParametersMatrixExpansionStandardsService { + @Get("/routes/path/matrix/standard/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/matrix/standard/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/matrix/standard/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/matrix/standard/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/matrix/standard/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> record(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + + @Get("/routes/path/matrix/standard/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recordSync(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionExplodesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionExplodesImpl.java new file mode 100644 index 00000000000..c5ed020e107 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionExplodesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PathParametersPathExpansionExplodes. + */ +public final class PathParametersPathExpansionExplodesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathParametersPathExpansionExplodesService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of PathParametersPathExpansionExplodesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PathParametersPathExpansionExplodesImpl(RoutesClientImpl client) { + this.service = RestProxy.create(PathParametersPathExpansionExplodesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientPathParametersPathExpansionExplodes to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientPathParametersPathExpansionExplodes") + public interface PathParametersPathExpansionExplodesService { + @Get("/routes/path/path/explode/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/path/explode/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/path/explode/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/path/explode/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/path/explode/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> record(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + + @Get("/routes/path/path/explode/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recordSync(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionStandardsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionStandardsImpl.java new file mode 100644 index 00000000000..c37c22b31c6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersPathExpansionStandardsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PathParametersPathExpansionStandards. + */ +public final class PathParametersPathExpansionStandardsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathParametersPathExpansionStandardsService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of PathParametersPathExpansionStandardsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PathParametersPathExpansionStandardsImpl(RoutesClientImpl client) { + this.service = RestProxy.create(PathParametersPathExpansionStandardsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientPathParametersPathExpansionStandards to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientPathParametersPathExpansionStandards") + public interface PathParametersPathExpansionStandardsService { + @Get("/routes/path/path/standard/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/path/standard/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/path/standard/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/path/standard/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/path/standard/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> record(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + + @Get("/routes/path/path/standard/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recordSync(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersReservedExpansionsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersReservedExpansionsImpl.java new file mode 100644 index 00000000000..a91cc6470e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersReservedExpansionsImpl.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PathParametersReservedExpansions. + */ +public final class PathParametersReservedExpansionsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathParametersReservedExpansionsService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of PathParametersReservedExpansionsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PathParametersReservedExpansionsImpl(RoutesClientImpl client) { + this.service = RestProxy.create(PathParametersReservedExpansionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientPathParametersReservedExpansions to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientPathParametersReservedExpansions") + public interface PathParametersReservedExpansionsService { + @Get("/routes/path/reserved-expansion/template/{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> template(@HostParam("endpoint") String endpoint, + @PathParam(value = "param", encoded = true) String param, RequestOptions requestOptions, Context context); + + @Get("/routes/path/reserved-expansion/template/{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response templateSync(@HostParam("endpoint") String endpoint, + @PathParam(value = "param", encoded = true) String param, RequestOptions requestOptions, Context context); + + @Get("/routes/path/reserved-expansion/annotation/{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> annotation(@HostParam("endpoint") String endpoint, + @PathParam(value = "param", encoded = true) String param, RequestOptions requestOptions, Context context); + + @Get("/routes/path/reserved-expansion/annotation/{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response annotationSync(@HostParam("endpoint") String endpoint, + @PathParam(value = "param", encoded = true) String param, RequestOptions requestOptions, Context context); + } + + /** + * The template operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> templateWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.template(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The template operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response templateWithResponse(String param, RequestOptions requestOptions) { + return service.templateSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The annotation operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> annotationWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.annotation(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The annotation operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response annotationWithResponse(String param, RequestOptions requestOptions) { + return service.annotationSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionExplodesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionExplodesImpl.java new file mode 100644 index 00000000000..c9546c0c362 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionExplodesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PathParametersSimpleExpansionExplodes. + */ +public final class PathParametersSimpleExpansionExplodesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathParametersSimpleExpansionExplodesService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of PathParametersSimpleExpansionExplodesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PathParametersSimpleExpansionExplodesImpl(RoutesClientImpl client) { + this.service = RestProxy.create(PathParametersSimpleExpansionExplodesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientPathParametersSimpleExpansionExplodes to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientPathParametersSimpleExpansionExplodes") + public interface PathParametersSimpleExpansionExplodesService { + @Get("/routes/path/simple/explode/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/simple/explode/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/simple/explode/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/simple/explode/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/simple/explode/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> record(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + + @Get("/routes/path/simple/explode/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recordSync(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionStandardsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionStandardsImpl.java new file mode 100644 index 00000000000..b4e5df97a42 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/PathParametersSimpleExpansionStandardsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PathParametersSimpleExpansionStandards. + */ +public final class PathParametersSimpleExpansionStandardsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PathParametersSimpleExpansionStandardsService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of PathParametersSimpleExpansionStandardsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PathParametersSimpleExpansionStandardsImpl(RoutesClientImpl client) { + this.service = RestProxy.create(PathParametersSimpleExpansionStandardsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientPathParametersSimpleExpansionStandards to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientPathParametersSimpleExpansionStandards") + public interface PathParametersSimpleExpansionStandardsService { + @Get("/routes/path/simple/standard/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> primitive(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/simple/standard/primitive{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response primitiveSync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/simple/standard/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> array(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/simple/standard/array{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response arraySync(@HostParam("endpoint") String endpoint, @PathParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/path/simple/standard/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> record(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + + @Get("/routes/path/simple/standard/record{param}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recordSync(@HostParam("endpoint") String endpoint, + @PathParam("param") Map param, RequestOptions requestOptions, Context context); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersImpl.java new file mode 100644 index 00000000000..d48dd0e3453 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersImpl.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in QueryParameters. + */ +public final class QueryParametersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final QueryParametersService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of QueryParametersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueryParametersImpl(RoutesClientImpl client) { + this.service + = RestProxy.create(QueryParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientQueryParameters to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientQueryParameters") + public interface QueryParametersService { + @Get("/routes/query/template-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> templateOnly(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/template-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response templateOnlySync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/explicit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> explicit(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/explicit") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response explicitSync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/annotation-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> annotationOnly(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/annotation-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response annotationOnlySync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + } + + /** + * The templateOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> templateOnlyWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.templateOnly(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The templateOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response templateOnlyWithResponse(String param, RequestOptions requestOptions) { + return service.templateOnlySync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The explicit operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> explicitWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.explicit(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The explicit operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response explicitWithResponse(String param, RequestOptions requestOptions) { + return service.explicitSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The annotationOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> annotationOnlyWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.annotationOnly(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The annotationOnly operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response annotationOnlyWithResponse(String param, RequestOptions requestOptions) { + return service.annotationOnlySync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationExplodesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationExplodesImpl.java new file mode 100644 index 00000000000..98f0caf7d29 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationExplodesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in QueryParametersQueryContinuationExplodes. + */ +public final class QueryParametersQueryContinuationExplodesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final QueryParametersQueryContinuationExplodesService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of QueryParametersQueryContinuationExplodesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueryParametersQueryContinuationExplodesImpl(RoutesClientImpl client) { + this.service = RestProxy.create(QueryParametersQueryContinuationExplodesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientQueryParametersQueryContinuationExplodes to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientQueryParametersQueryContinuationExplodes") + public interface QueryParametersQueryContinuationExplodesService { + @Get("/routes/query/query-continuation/explode/primitive?fixed=true") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> primitive(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-continuation/explode/primitive?fixed=true") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response primitiveSync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-continuation/explode/array?fixed=true") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> array(@HostParam("endpoint") String endpoint, + @QueryParam(value = "param", multipleQueryParams = true) List param, RequestOptions requestOptions, + Context context); + + @Get("/routes/query/query-continuation/explode/array?fixed=true") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response arraySync(@HostParam("endpoint") String endpoint, + @QueryParam(value = "param", multipleQueryParams = true) List param, RequestOptions requestOptions, + Context context); + + @Get("/routes/query/query-continuation/explode/record?fixed=true") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> record(@HostParam("endpoint") String endpoint, + @QueryParam("param") Map param, RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-continuation/explode/record?fixed=true") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recordSync(@HostParam("endpoint") String endpoint, + @QueryParam("param") Map param, RequestOptions requestOptions, Context context); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { + List paramConverted + = param.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return FluxUtil + .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + List paramConverted + = param.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationStandardsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationStandardsImpl.java new file mode 100644 index 00000000000..ef0fe9d529b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryContinuationStandardsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in QueryParametersQueryContinuationStandards. + */ +public final class QueryParametersQueryContinuationStandardsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final QueryParametersQueryContinuationStandardsService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of QueryParametersQueryContinuationStandardsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueryParametersQueryContinuationStandardsImpl(RoutesClientImpl client) { + this.service = RestProxy.create(QueryParametersQueryContinuationStandardsService.class, + client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientQueryParametersQueryContinuationStandards to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientQueryParametersQueryContinuationStandards") + public interface QueryParametersQueryContinuationStandardsService { + @Get("/routes/query/query-continuation/standard/primitive?fixed=true") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> primitive(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-continuation/standard/primitive?fixed=true") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response primitiveSync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-continuation/standard/array?fixed=true") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> array(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-continuation/standard/array?fixed=true") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response arraySync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-continuation/standard/record?fixed=true") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> record(@HostParam("endpoint") String endpoint, + @QueryParam("param") Map param, RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-continuation/standard/record?fixed=true") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recordSync(@HostParam("endpoint") String endpoint, + @QueryParam("param") Map param, RequestOptions requestOptions, Context context); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionExplodesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionExplodesImpl.java new file mode 100644 index 00000000000..3bc6b8391ed --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionExplodesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in QueryParametersQueryExpansionExplodes. + */ +public final class QueryParametersQueryExpansionExplodesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final QueryParametersQueryExpansionExplodesService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of QueryParametersQueryExpansionExplodesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueryParametersQueryExpansionExplodesImpl(RoutesClientImpl client) { + this.service = RestProxy.create(QueryParametersQueryExpansionExplodesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientQueryParametersQueryExpansionExplodes to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientQueryParametersQueryExpansionExplodes") + public interface QueryParametersQueryExpansionExplodesService { + @Get("/routes/query/query-expansion/explode/primitive") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> primitive(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-expansion/explode/primitive") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response primitiveSync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-expansion/explode/array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> array(@HostParam("endpoint") String endpoint, + @QueryParam(value = "param", multipleQueryParams = true) List param, RequestOptions requestOptions, + Context context); + + @Get("/routes/query/query-expansion/explode/array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response arraySync(@HostParam("endpoint") String endpoint, + @QueryParam(value = "param", multipleQueryParams = true) List param, RequestOptions requestOptions, + Context context); + + @Get("/routes/query/query-expansion/explode/record") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> record(@HostParam("endpoint") String endpoint, + @QueryParam("param") Map param, RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-expansion/explode/record") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recordSync(@HostParam("endpoint") String endpoint, + @QueryParam("param") Map param, RequestOptions requestOptions, Context context); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { + List paramConverted + = param.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return FluxUtil + .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + List paramConverted + = param.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionStandardsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionStandardsImpl.java new file mode 100644 index 00000000000..bdc3a7a8a54 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/QueryParametersQueryExpansionStandardsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in QueryParametersQueryExpansionStandards. + */ +public final class QueryParametersQueryExpansionStandardsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final QueryParametersQueryExpansionStandardsService service; + + /** + * The service client containing this operation class. + */ + private final RoutesClientImpl client; + + /** + * Initializes an instance of QueryParametersQueryExpansionStandardsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueryParametersQueryExpansionStandardsImpl(RoutesClientImpl client) { + this.service = RestProxy.create(QueryParametersQueryExpansionStandardsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RoutesClientQueryParametersQueryExpansionStandards to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClientQueryParametersQueryExpansionStandards") + public interface QueryParametersQueryExpansionStandardsService { + @Get("/routes/query/query-expansion/standard/primitive") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> primitive(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-expansion/standard/primitive") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response primitiveSync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-expansion/standard/array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> array(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-expansion/standard/array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response arraySync(@HostParam("endpoint") String endpoint, @QueryParam("param") String param, + RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-expansion/standard/record") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> record(@HostParam("endpoint") String endpoint, + @QueryParam("param") Map param, RequestOptions requestOptions, Context context); + + @Get("/routes/query/query-expansion/standard/record") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recordSync(@HostParam("endpoint") String endpoint, + @QueryParam("param") Map param, RequestOptions requestOptions, Context context); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> primitiveWithResponseAsync(String param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.primitive(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The primitive operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response primitiveWithResponse(String param, RequestOptions requestOptions) { + return service.primitiveSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> arrayWithResponseAsync(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil + .withContext(context -> service.array(this.client.getEndpoint(), paramConverted, requestOptions, context)); + } + + /** + * The array operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response arrayWithResponse(List param, RequestOptions requestOptions) { + String paramConverted = param.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.arraySync(this.client.getEndpoint(), paramConverted, requestOptions, Context.NONE); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recordWithResponseAsync(Map param, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.record(this.client.getEndpoint(), param, requestOptions, context)); + } + + /** + * The record operation. + * + * @param param The param parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recordWithResponse(Map param, RequestOptions requestOptions) { + return service.recordSync(this.client.getEndpoint(), param, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/RoutesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/RoutesClientImpl.java new file mode 100644 index 00000000000..52fba65798a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/RoutesClientImpl.java @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the RoutesClient type. + */ +public final class RoutesClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RoutesClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 PathParametersImpl object to access its operations. + */ + private final PathParametersImpl pathParameters; + + /** + * Gets the PathParametersImpl object to access its operations. + * + * @return the PathParametersImpl object. + */ + public PathParametersImpl getPathParameters() { + return this.pathParameters; + } + + /** + * The PathParametersReservedExpansionsImpl object to access its operations. + */ + private final PathParametersReservedExpansionsImpl pathParametersReservedExpansions; + + /** + * Gets the PathParametersReservedExpansionsImpl object to access its operations. + * + * @return the PathParametersReservedExpansionsImpl object. + */ + public PathParametersReservedExpansionsImpl getPathParametersReservedExpansions() { + return this.pathParametersReservedExpansions; + } + + /** + * The PathParametersSimpleExpansionStandardsImpl object to access its operations. + */ + private final PathParametersSimpleExpansionStandardsImpl pathParametersSimpleExpansionStandards; + + /** + * Gets the PathParametersSimpleExpansionStandardsImpl object to access its operations. + * + * @return the PathParametersSimpleExpansionStandardsImpl object. + */ + public PathParametersSimpleExpansionStandardsImpl getPathParametersSimpleExpansionStandards() { + return this.pathParametersSimpleExpansionStandards; + } + + /** + * The PathParametersSimpleExpansionExplodesImpl object to access its operations. + */ + private final PathParametersSimpleExpansionExplodesImpl pathParametersSimpleExpansionExplodes; + + /** + * Gets the PathParametersSimpleExpansionExplodesImpl object to access its operations. + * + * @return the PathParametersSimpleExpansionExplodesImpl object. + */ + public PathParametersSimpleExpansionExplodesImpl getPathParametersSimpleExpansionExplodes() { + return this.pathParametersSimpleExpansionExplodes; + } + + /** + * The PathParametersPathExpansionStandardsImpl object to access its operations. + */ + private final PathParametersPathExpansionStandardsImpl pathParametersPathExpansionStandards; + + /** + * Gets the PathParametersPathExpansionStandardsImpl object to access its operations. + * + * @return the PathParametersPathExpansionStandardsImpl object. + */ + public PathParametersPathExpansionStandardsImpl getPathParametersPathExpansionStandards() { + return this.pathParametersPathExpansionStandards; + } + + /** + * The PathParametersPathExpansionExplodesImpl object to access its operations. + */ + private final PathParametersPathExpansionExplodesImpl pathParametersPathExpansionExplodes; + + /** + * Gets the PathParametersPathExpansionExplodesImpl object to access its operations. + * + * @return the PathParametersPathExpansionExplodesImpl object. + */ + public PathParametersPathExpansionExplodesImpl getPathParametersPathExpansionExplodes() { + return this.pathParametersPathExpansionExplodes; + } + + /** + * The PathParametersLabelExpansionStandardsImpl object to access its operations. + */ + private final PathParametersLabelExpansionStandardsImpl pathParametersLabelExpansionStandards; + + /** + * Gets the PathParametersLabelExpansionStandardsImpl object to access its operations. + * + * @return the PathParametersLabelExpansionStandardsImpl object. + */ + public PathParametersLabelExpansionStandardsImpl getPathParametersLabelExpansionStandards() { + return this.pathParametersLabelExpansionStandards; + } + + /** + * The PathParametersLabelExpansionExplodesImpl object to access its operations. + */ + private final PathParametersLabelExpansionExplodesImpl pathParametersLabelExpansionExplodes; + + /** + * Gets the PathParametersLabelExpansionExplodesImpl object to access its operations. + * + * @return the PathParametersLabelExpansionExplodesImpl object. + */ + public PathParametersLabelExpansionExplodesImpl getPathParametersLabelExpansionExplodes() { + return this.pathParametersLabelExpansionExplodes; + } + + /** + * The PathParametersMatrixExpansionStandardsImpl object to access its operations. + */ + private final PathParametersMatrixExpansionStandardsImpl pathParametersMatrixExpansionStandards; + + /** + * Gets the PathParametersMatrixExpansionStandardsImpl object to access its operations. + * + * @return the PathParametersMatrixExpansionStandardsImpl object. + */ + public PathParametersMatrixExpansionStandardsImpl getPathParametersMatrixExpansionStandards() { + return this.pathParametersMatrixExpansionStandards; + } + + /** + * The PathParametersMatrixExpansionExplodesImpl object to access its operations. + */ + private final PathParametersMatrixExpansionExplodesImpl pathParametersMatrixExpansionExplodes; + + /** + * Gets the PathParametersMatrixExpansionExplodesImpl object to access its operations. + * + * @return the PathParametersMatrixExpansionExplodesImpl object. + */ + public PathParametersMatrixExpansionExplodesImpl getPathParametersMatrixExpansionExplodes() { + return this.pathParametersMatrixExpansionExplodes; + } + + /** + * The QueryParametersImpl object to access its operations. + */ + private final QueryParametersImpl queryParameters; + + /** + * Gets the QueryParametersImpl object to access its operations. + * + * @return the QueryParametersImpl object. + */ + public QueryParametersImpl getQueryParameters() { + return this.queryParameters; + } + + /** + * The QueryParametersQueryExpansionStandardsImpl object to access its operations. + */ + private final QueryParametersQueryExpansionStandardsImpl queryParametersQueryExpansionStandards; + + /** + * Gets the QueryParametersQueryExpansionStandardsImpl object to access its operations. + * + * @return the QueryParametersQueryExpansionStandardsImpl object. + */ + public QueryParametersQueryExpansionStandardsImpl getQueryParametersQueryExpansionStandards() { + return this.queryParametersQueryExpansionStandards; + } + + /** + * The QueryParametersQueryExpansionExplodesImpl object to access its operations. + */ + private final QueryParametersQueryExpansionExplodesImpl queryParametersQueryExpansionExplodes; + + /** + * Gets the QueryParametersQueryExpansionExplodesImpl object to access its operations. + * + * @return the QueryParametersQueryExpansionExplodesImpl object. + */ + public QueryParametersQueryExpansionExplodesImpl getQueryParametersQueryExpansionExplodes() { + return this.queryParametersQueryExpansionExplodes; + } + + /** + * The QueryParametersQueryContinuationStandardsImpl object to access its operations. + */ + private final QueryParametersQueryContinuationStandardsImpl queryParametersQueryContinuationStandards; + + /** + * Gets the QueryParametersQueryContinuationStandardsImpl object to access its operations. + * + * @return the QueryParametersQueryContinuationStandardsImpl object. + */ + public QueryParametersQueryContinuationStandardsImpl getQueryParametersQueryContinuationStandards() { + return this.queryParametersQueryContinuationStandards; + } + + /** + * The QueryParametersQueryContinuationExplodesImpl object to access its operations. + */ + private final QueryParametersQueryContinuationExplodesImpl queryParametersQueryContinuationExplodes; + + /** + * Gets the QueryParametersQueryContinuationExplodesImpl object to access its operations. + * + * @return the QueryParametersQueryContinuationExplodesImpl object. + */ + public QueryParametersQueryContinuationExplodesImpl getQueryParametersQueryContinuationExplodes() { + return this.queryParametersQueryContinuationExplodes; + } + + /** + * The InInterfacesImpl object to access its operations. + */ + private final InInterfacesImpl inInterfaces; + + /** + * Gets the InInterfacesImpl object to access its operations. + * + * @return the InInterfacesImpl object. + */ + public InInterfacesImpl getInInterfaces() { + return this.inInterfaces; + } + + /** + * Initializes an instance of RoutesClient client. + * + * @param endpoint Service host. + */ + public RoutesClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of RoutesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public RoutesClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of RoutesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public RoutesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.pathParameters = new PathParametersImpl(this); + this.pathParametersReservedExpansions = new PathParametersReservedExpansionsImpl(this); + this.pathParametersSimpleExpansionStandards = new PathParametersSimpleExpansionStandardsImpl(this); + this.pathParametersSimpleExpansionExplodes = new PathParametersSimpleExpansionExplodesImpl(this); + this.pathParametersPathExpansionStandards = new PathParametersPathExpansionStandardsImpl(this); + this.pathParametersPathExpansionExplodes = new PathParametersPathExpansionExplodesImpl(this); + this.pathParametersLabelExpansionStandards = new PathParametersLabelExpansionStandardsImpl(this); + this.pathParametersLabelExpansionExplodes = new PathParametersLabelExpansionExplodesImpl(this); + this.pathParametersMatrixExpansionStandards = new PathParametersMatrixExpansionStandardsImpl(this); + this.pathParametersMatrixExpansionExplodes = new PathParametersMatrixExpansionExplodesImpl(this); + this.queryParameters = new QueryParametersImpl(this); + this.queryParametersQueryExpansionStandards = new QueryParametersQueryExpansionStandardsImpl(this); + this.queryParametersQueryExpansionExplodes = new QueryParametersQueryExpansionExplodesImpl(this); + this.queryParametersQueryContinuationStandards = new QueryParametersQueryContinuationStandardsImpl(this); + this.queryParametersQueryContinuationExplodes = new QueryParametersQueryContinuationExplodesImpl(this); + this.inInterfaces = new InInterfacesImpl(this); + this.service = RestProxy.create(RoutesClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for RoutesClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RoutesClient") + public interface RoutesClientService { + @Get("/routes/fixed") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> fixed(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/routes/fixed") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fixedSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The fixed operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fixedWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.fixed(this.getEndpoint(), requestOptions, context)); + } + + /** + * The fixed operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fixedWithResponse(RequestOptions requestOptions) { + return service.fixedSync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/package-info.java new file mode 100644 index 00000000000..ddda07afd44 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Routes. + * Define scenario in building the http route/uri. + * + */ +package routes.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/package-info.java new file mode 100644 index 00000000000..1db2c80b7d9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/routes/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Routes. + * Define scenario in building the http route/uri. + * + */ +package routes; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonAsyncClient.java new file mode 100644 index 00000000000..f1e39fce7d4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package serialization.encodedname.json; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import serialization.encodedname.json.implementation.PropertiesImpl; +import serialization.encodedname.json.property.models.JsonEncodedNameModel; + +/** + * Initializes a new instance of the asynchronous JsonClient type. + */ +@ServiceClient(builder = JsonClientBuilder.class, isAsync = true) +public final class JsonAsyncClient { + @Generated + private final PropertiesImpl serviceClient; + + /** + * Initializes an instance of JsonAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + JsonAsyncClient(PropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     wireName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     wireName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The send operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(JsonEncodedNameModel body) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + return sendWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(JsonEncodedNameModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClient.java new file mode 100644 index 00000000000..f3fe2bc3621 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package serialization.encodedname.json; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import serialization.encodedname.json.implementation.PropertiesImpl; +import serialization.encodedname.json.property.models.JsonEncodedNameModel; + +/** + * Initializes a new instance of the synchronous JsonClient type. + */ +@ServiceClient(builder = JsonClientBuilder.class) +public final class JsonClient { + @Generated + private final PropertiesImpl serviceClient; + + /** + * Initializes an instance of JsonClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + JsonClient(PropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     wireName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(body, requestOptions); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     wireName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The send operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(JsonEncodedNameModel body) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + sendWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public JsonEncodedNameModel get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(JsonEncodedNameModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClientBuilder.java new file mode 100644 index 00000000000..2c03280dba7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/JsonClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package serialization.encodedname.json; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import serialization.encodedname.json.implementation.JsonClientImpl; + +/** + * A builder for creating a new instance of the JsonClient type. + */ +@ServiceClientBuilder(serviceClients = { JsonClient.class, JsonAsyncClient.class }) +public final class JsonClientBuilder + implements HttpTrait, ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("serialization-encodedname-json.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the JsonClientBuilder. + */ + @Generated + public JsonClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the JsonClientBuilder. + */ + @Generated + public JsonClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of JsonClientImpl with the provided parameters. + * + * @return an instance of JsonClientImpl. + */ + @Generated + private JsonClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + JsonClientImpl client + = new JsonClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of JsonAsyncClient class. + * + * @return an instance of JsonAsyncClient. + */ + @Generated + public JsonAsyncClient buildAsyncClient() { + return new JsonAsyncClient(buildInnerClient().getProperties()); + } + + /** + * Builds an instance of JsonClient class. + * + * @return an instance of JsonClient. + */ + @Generated + public JsonClient buildClient() { + return new JsonClient(buildInnerClient().getProperties()); + } + + private static final ClientLogger LOGGER = new ClientLogger(JsonClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java new file mode 100644 index 00000000000..b3e0fc8d6c9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package serialization.encodedname.json.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 JsonClient type. + */ +public final class JsonClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 PropertiesImpl object to access its operations. + */ + private final PropertiesImpl properties; + + /** + * Gets the PropertiesImpl object to access its operations. + * + * @return the PropertiesImpl object. + */ + public PropertiesImpl getProperties() { + return this.properties; + } + + /** + * Initializes an instance of JsonClient client. + * + * @param endpoint Service host. + */ + public JsonClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of JsonClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public JsonClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of JsonClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public JsonClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.properties = new PropertiesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/PropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/PropertiesImpl.java new file mode 100644 index 00000000000..07565d3e69f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/PropertiesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package serialization.encodedname.json.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Properties. + */ +public final class PropertiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PropertiesService service; + + /** + * The service client containing this operation class. + */ + private final JsonClientImpl client; + + /** + * Initializes an instance of PropertiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PropertiesImpl(JsonClientImpl client) { + this.service + = RestProxy.create(PropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for JsonClientProperties to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "JsonClientProperties") + public interface PropertiesService { + @Post("/serialization/encoded-name/json/property") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/serialization/encoded-name/json/property") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Get("/serialization/encoded-name/json/property") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/serialization/encoded-name/json/property") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     wireName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.send(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     wireName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     wireName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     wireName: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/package-info.java new file mode 100644 index 00000000000..c7c4a88a11f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Json. + * Encoded names. + * + */ +package serialization.encodedname.json.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/package-info.java new file mode 100644 index 00000000000..9b838780dcb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Json. + * Encoded names. + * + */ +package serialization.encodedname.json; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/JsonEncodedNameModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/JsonEncodedNameModel.java new file mode 100644 index 00000000000..f5a1fa46583 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/JsonEncodedNameModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package serialization.encodedname.json.property.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The JsonEncodedNameModel model. + */ +@Immutable +public final class JsonEncodedNameModel implements JsonSerializable { + /* + * Pass in true + */ + @Generated + private final boolean defaultName; + + /** + * Creates an instance of JsonEncodedNameModel class. + * + * @param defaultName the defaultName value to set. + */ + @Generated + public JsonEncodedNameModel(boolean defaultName) { + this.defaultName = defaultName; + } + + /** + * Get the defaultName property: Pass in true. + * + * @return the defaultName value. + */ + @Generated + public boolean isDefaultName() { + return this.defaultName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("wireName", this.defaultName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JsonEncodedNameModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JsonEncodedNameModel if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JsonEncodedNameModel. + */ + @Generated + public static JsonEncodedNameModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean defaultName = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("wireName".equals(fieldName)) { + defaultName = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new JsonEncodedNameModel(defaultName); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/package-info.java new file mode 100644 index 00000000000..634192c3dc4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/serialization/encodedname/json/property/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Json. + * Encoded names. + * + */ +package serialization.encodedname.json.property.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedAsyncClient.java new file mode 100644 index 00000000000..9eac38a24b0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.endpoint.notdefined; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import server.endpoint.notdefined.implementation.NotDefinedClientImpl; + +/** + * Initializes a new instance of the asynchronous NotDefinedClient type. + */ +@ServiceClient(builder = NotDefinedClientBuilder.class, isAsync = true) +public final class NotDefinedAsyncClient { + @Generated + private final NotDefinedClientImpl serviceClient; + + /** + * Initializes an instance of NotDefinedAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NotDefinedAsyncClient(NotDefinedClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The valid operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validWithResponse(RequestOptions requestOptions) { + return this.serviceClient.validWithResponseAsync(requestOptions); + } + + /** + * The valid operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono valid() { + // Generated convenience method for validWithResponse + RequestOptions requestOptions = new RequestOptions(); + return validWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClient.java new file mode 100644 index 00000000000..ee3d262e7c6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.endpoint.notdefined; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import server.endpoint.notdefined.implementation.NotDefinedClientImpl; + +/** + * Initializes a new instance of the synchronous NotDefinedClient type. + */ +@ServiceClient(builder = NotDefinedClientBuilder.class) +public final class NotDefinedClient { + @Generated + private final NotDefinedClientImpl serviceClient; + + /** + * Initializes an instance of NotDefinedClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NotDefinedClient(NotDefinedClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The valid operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validWithResponse(RequestOptions requestOptions) { + return this.serviceClient.validWithResponse(requestOptions); + } + + /** + * The valid operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void valid() { + // Generated convenience method for validWithResponse + RequestOptions requestOptions = new RequestOptions(); + validWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClientBuilder.java new file mode 100644 index 00000000000..56a7a3b0e8d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/NotDefinedClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.endpoint.notdefined; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import server.endpoint.notdefined.implementation.NotDefinedClientImpl; + +/** + * A builder for creating a new instance of the NotDefinedClient type. + */ +@ServiceClientBuilder(serviceClients = { NotDefinedClient.class, NotDefinedAsyncClient.class }) +public final class NotDefinedClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("server-endpoint-notdefined.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the NotDefinedClientBuilder. + */ + @Generated + public NotDefinedClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDefinedClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDefinedClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDefinedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDefinedClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDefinedClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDefinedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDefinedClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDefinedClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the NotDefinedClientBuilder. + */ + @Generated + public NotDefinedClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of NotDefinedClientImpl with the provided parameters. + * + * @return an instance of NotDefinedClientImpl. + */ + @Generated + private NotDefinedClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + NotDefinedClientImpl client + = new NotDefinedClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of NotDefinedAsyncClient class. + * + * @return an instance of NotDefinedAsyncClient. + */ + @Generated + public NotDefinedAsyncClient buildAsyncClient() { + return new NotDefinedAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of NotDefinedClient class. + * + * @return an instance of NotDefinedClient. + */ + @Generated + public NotDefinedClient buildClient() { + return new NotDefinedClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(NotDefinedClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java new file mode 100644 index 00000000000..4ea639a0ff9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.endpoint.notdefined.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the NotDefinedClient type. + */ +public final class NotDefinedClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NotDefinedClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of NotDefinedClient client. + * + * @param endpoint Service host. + */ + public NotDefinedClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NotDefinedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public NotDefinedClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NotDefinedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public NotDefinedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(NotDefinedClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for NotDefinedClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NotDefinedClient") + public interface NotDefinedClientService { + @Head("/server/endpoint/not-defined/valid") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> valid(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Head("/server/endpoint/not-defined/valid") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response validSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The valid operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> validWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.valid(this.getEndpoint(), requestOptions, context)); + } + + /** + * The valid operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validWithResponse(RequestOptions requestOptions) { + return service.validSync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/package-info.java new file mode 100644 index 00000000000..e6716d53105 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for NotDefined. + * Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let user pass in. + * + */ +package server.endpoint.notdefined.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/package-info.java new file mode 100644 index 00000000000..ee8c05fee2b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/endpoint/notdefined/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for NotDefined. + * Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let user pass in. + * + */ +package server.endpoint.notdefined; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleAsyncClient.java new file mode 100644 index 00000000000..e8d82b12b25 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleAsyncClient.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.path.multiple; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import server.path.multiple.implementation.MultipleClientImpl; + +/** + * Initializes a new instance of the asynchronous MultipleClient type. + */ +@ServiceClient(builder = MultipleClientBuilder.class, isAsync = true) +public final class MultipleAsyncClient { + @Generated + private final MultipleClientImpl serviceClient; + + /** + * Initializes an instance of MultipleAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MultipleAsyncClient(MultipleClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The noOperationParams operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> noOperationParamsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.noOperationParamsWithResponseAsync(requestOptions); + } + + /** + * The withOperationPathParam operation. + * + * @param keyword The keyword parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withOperationPathParamWithResponse(String keyword, RequestOptions requestOptions) { + return this.serviceClient.withOperationPathParamWithResponseAsync(keyword, requestOptions); + } + + /** + * The noOperationParams operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono noOperationParams() { + // Generated convenience method for noOperationParamsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return noOperationParamsWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withOperationPathParam operation. + * + * @param keyword The keyword parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withOperationPathParam(String keyword) { + // Generated convenience method for withOperationPathParamWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withOperationPathParamWithResponse(keyword, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClient.java new file mode 100644 index 00000000000..07089f5be19 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClient.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.path.multiple; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import server.path.multiple.implementation.MultipleClientImpl; + +/** + * Initializes a new instance of the synchronous MultipleClient type. + */ +@ServiceClient(builder = MultipleClientBuilder.class) +public final class MultipleClient { + @Generated + private final MultipleClientImpl serviceClient; + + /** + * Initializes an instance of MultipleClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MultipleClient(MultipleClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The noOperationParams operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response noOperationParamsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.noOperationParamsWithResponse(requestOptions); + } + + /** + * The withOperationPathParam operation. + * + * @param keyword The keyword parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withOperationPathParamWithResponse(String keyword, RequestOptions requestOptions) { + return this.serviceClient.withOperationPathParamWithResponse(keyword, requestOptions); + } + + /** + * The noOperationParams operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void noOperationParams() { + // Generated convenience method for noOperationParamsWithResponse + RequestOptions requestOptions = new RequestOptions(); + noOperationParamsWithResponse(requestOptions).getValue(); + } + + /** + * The withOperationPathParam operation. + * + * @param keyword The keyword parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withOperationPathParam(String keyword) { + // Generated convenience method for withOperationPathParamWithResponse + RequestOptions requestOptions = new RequestOptions(); + withOperationPathParamWithResponse(keyword, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClientBuilder.java new file mode 100644 index 00000000000..e53f5a1b173 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.path.multiple; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import server.path.multiple.implementation.MultipleClientImpl; + +/** + * A builder for creating a new instance of the MultipleClient type. + */ +@ServiceClientBuilder(serviceClients = { MultipleClient.class, MultipleAsyncClient.class }) +public final class MultipleClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("server-path-multiple.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the MultipleClientBuilder. + */ + @Generated + public MultipleClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipleClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private MultipleServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the MultipleClientBuilder. + */ + @Generated + public MultipleClientBuilder serviceVersion(MultipleServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the MultipleClientBuilder. + */ + @Generated + public MultipleClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of MultipleClientImpl with the provided parameters. + * + * @return an instance of MultipleClientImpl. + */ + @Generated + private MultipleClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + MultipleServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : MultipleServiceVersion.getLatest(); + MultipleClientImpl client = new MultipleClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of MultipleAsyncClient class. + * + * @return an instance of MultipleAsyncClient. + */ + @Generated + public MultipleAsyncClient buildAsyncClient() { + return new MultipleAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of MultipleClient class. + * + * @return an instance of MultipleClient. + */ + @Generated + public MultipleClient buildClient() { + return new MultipleClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(MultipleClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleServiceVersion.java new file mode 100644 index 00000000000..f4fb1653e56 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/MultipleServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.path.multiple; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of MultipleClient. + */ +public enum MultipleServiceVersion implements ServiceVersion { + /** + * Enum value v1.0. + */ + V1_0("v1.0"); + + private final String version; + + MultipleServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link MultipleServiceVersion}. + */ + public static MultipleServiceVersion getLatest() { + return V1_0; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/MultipleClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/MultipleClientImpl.java new file mode 100644 index 00000000000..bc8357ca33a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/MultipleClientImpl.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.path.multiple.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; +import server.path.multiple.MultipleServiceVersion; + +/** + * Initializes a new instance of the MultipleClient type. + */ +public final class MultipleClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MultipleClientService service; + + /** + * Pass in http://localhost:3000 for endpoint. + */ + private final String endpoint; + + /** + * Gets Pass in http://localhost:3000 for endpoint. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final MultipleServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public MultipleServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of MultipleClient client. + * + * @param endpoint Pass in http://localhost:3000 for endpoint. + * @param serviceVersion Service version. + */ + public MultipleClientImpl(String endpoint, MultipleServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of MultipleClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Pass in http://localhost:3000 for endpoint. + * @param serviceVersion Service version. + */ + public MultipleClientImpl(HttpPipeline httpPipeline, String endpoint, MultipleServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of MultipleClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Pass in http://localhost:3000 for endpoint. + * @param serviceVersion Service version. + */ + public MultipleClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + MultipleServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(MultipleClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for MultipleClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}/server/path/multiple/{apiVersion}") + @ServiceInterface(name = "MultipleClient") + public interface MultipleClientService { + @Get("/") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> noOperationParams(@HostParam("endpoint") String endpoint, + @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Get("/") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response noOperationParamsSync(@HostParam("endpoint") String endpoint, + @HostParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Get("/{keyword}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withOperationPathParam(@HostParam("endpoint") String endpoint, + @HostParam("apiVersion") String apiVersion, @PathParam("keyword") String keyword, + RequestOptions requestOptions, Context context); + + @Get("/{keyword}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withOperationPathParamSync(@HostParam("endpoint") String endpoint, + @HostParam("apiVersion") String apiVersion, @PathParam("keyword") String keyword, + RequestOptions requestOptions, Context context); + } + + /** + * The noOperationParams operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> noOperationParamsWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.noOperationParams(this.getEndpoint(), + this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * The noOperationParams operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response noOperationParamsWithResponse(RequestOptions requestOptions) { + return service.noOperationParamsSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, + Context.NONE); + } + + /** + * The withOperationPathParam operation. + * + * @param keyword The keyword parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withOperationPathParamWithResponseAsync(String keyword, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.withOperationPathParam(this.getEndpoint(), + this.getServiceVersion().getVersion(), keyword, requestOptions, context)); + } + + /** + * The withOperationPathParam operation. + * + * @param keyword The keyword parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withOperationPathParamWithResponse(String keyword, RequestOptions requestOptions) { + return service.withOperationPathParamSync(this.getEndpoint(), this.getServiceVersion().getVersion(), keyword, + requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/package-info.java new file mode 100644 index 00000000000..51c1318d974 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Multiple. + * + */ +package server.path.multiple.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/package-info.java new file mode 100644 index 00000000000..4a95ed39ce5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/multiple/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Multiple. + * + */ +package server.path.multiple; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleAsyncClient.java new file mode 100644 index 00000000000..899719ae884 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.path.single; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import server.path.single.implementation.SingleClientImpl; + +/** + * Initializes a new instance of the asynchronous SingleClient type. + */ +@ServiceClient(builder = SingleClientBuilder.class, isAsync = true) +public final class SingleAsyncClient { + @Generated + private final SingleClientImpl serviceClient; + + /** + * Initializes an instance of SingleAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SingleAsyncClient(SingleClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The myOp operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> myOpWithResponse(RequestOptions requestOptions) { + return this.serviceClient.myOpWithResponseAsync(requestOptions); + } + + /** + * The myOp operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono myOp() { + // Generated convenience method for myOpWithResponse + RequestOptions requestOptions = new RequestOptions(); + return myOpWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClient.java new file mode 100644 index 00000000000..1e6bce8e601 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.path.single; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import server.path.single.implementation.SingleClientImpl; + +/** + * Initializes a new instance of the synchronous SingleClient type. + */ +@ServiceClient(builder = SingleClientBuilder.class) +public final class SingleClient { + @Generated + private final SingleClientImpl serviceClient; + + /** + * Initializes an instance of SingleClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SingleClient(SingleClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The myOp operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response myOpWithResponse(RequestOptions requestOptions) { + return this.serviceClient.myOpWithResponse(requestOptions); + } + + /** + * The myOp operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void myOp() { + // Generated convenience method for myOpWithResponse + RequestOptions requestOptions = new RequestOptions(); + myOpWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClientBuilder.java new file mode 100644 index 00000000000..61b3dd90ddc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/SingleClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.path.single; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import server.path.single.implementation.SingleClientImpl; + +/** + * A builder for creating a new instance of the SingleClient type. + */ +@ServiceClientBuilder(serviceClients = { SingleClient.class, SingleAsyncClient.class }) +public final class SingleClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("server-path-single.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the SingleClientBuilder. + */ + @Generated + public SingleClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the SingleClientBuilder. + */ + @Generated + public SingleClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of SingleClientImpl with the provided parameters. + * + * @return an instance of SingleClientImpl. + */ + @Generated + private SingleClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + SingleClientImpl client + = new SingleClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of SingleAsyncClient class. + * + * @return an instance of SingleAsyncClient. + */ + @Generated + public SingleAsyncClient buildAsyncClient() { + return new SingleAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of SingleClient class. + * + * @return an instance of SingleClient. + */ + @Generated + public SingleClient buildClient() { + return new SingleClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(SingleClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/SingleClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/SingleClientImpl.java new file mode 100644 index 00000000000..26346f9e7d6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/SingleClientImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.path.single.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the SingleClient type. + */ +public final class SingleClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SingleClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of SingleClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + */ + public SingleClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SingleClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + */ + public SingleClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SingleClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + */ + public SingleClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(SingleClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for SingleClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SingleClient") + public interface SingleClientService { + @Head("/server/path/single/myOp") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> myOp(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Head("/server/path/single/myOp") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response myOpSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + } + + /** + * The myOp operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> myOpWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.myOp(this.getEndpoint(), requestOptions, context)); + } + + /** + * The myOp operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response myOpWithResponse(RequestOptions requestOptions) { + return service.myOpSync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/package-info.java new file mode 100644 index 00000000000..554b05fc178 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Single. + * Illustrates server with a single path parameter @server. + * + */ +package server.path.single.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/package-info.java new file mode 100644 index 00000000000..b29badf29c4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/path/single/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Single. + * Illustrates server with a single path parameter @server. + * + */ +package server.path.single; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedAsyncClient.java new file mode 100644 index 00000000000..3f6c214b8fc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedAsyncClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.versions.notversioned; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import server.versions.notversioned.implementation.NotVersionedClientImpl; + +/** + * Initializes a new instance of the asynchronous NotVersionedClient type. + */ +@ServiceClient(builder = NotVersionedClientBuilder.class, isAsync = true) +public final class NotVersionedAsyncClient { + @Generated + private final NotVersionedClientImpl serviceClient; + + /** + * Initializes an instance of NotVersionedAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NotVersionedAsyncClient(NotVersionedClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withoutApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withoutApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withoutApiVersionWithResponseAsync(requestOptions); + } + + /** + * The withQueryApiVersion operation. + * + * @param apiVersion The apiVersion parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryApiVersionWithResponse(String apiVersion, RequestOptions requestOptions) { + return this.serviceClient.withQueryApiVersionWithResponseAsync(apiVersion, requestOptions); + } + + /** + * The withPathApiVersion operation. + * + * @param apiVersion The apiVersion parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withPathApiVersionWithResponse(String apiVersion, RequestOptions requestOptions) { + return this.serviceClient.withPathApiVersionWithResponseAsync(apiVersion, requestOptions); + } + + /** + * The withoutApiVersion operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withoutApiVersion() { + // Generated convenience method for withoutApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withoutApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withQueryApiVersion operation. + * + * @param apiVersion The apiVersion parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withQueryApiVersion(String apiVersion) { + // Generated convenience method for withQueryApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withQueryApiVersionWithResponse(apiVersion, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withPathApiVersion operation. + * + * @param apiVersion The apiVersion parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withPathApiVersion(String apiVersion) { + // Generated convenience method for withPathApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withPathApiVersionWithResponse(apiVersion, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClient.java new file mode 100644 index 00000000000..271337ca77c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClient.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.versions.notversioned; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import server.versions.notversioned.implementation.NotVersionedClientImpl; + +/** + * Initializes a new instance of the synchronous NotVersionedClient type. + */ +@ServiceClient(builder = NotVersionedClientBuilder.class) +public final class NotVersionedClient { + @Generated + private final NotVersionedClientImpl serviceClient; + + /** + * Initializes an instance of NotVersionedClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NotVersionedClient(NotVersionedClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withoutApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withoutApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withoutApiVersionWithResponse(requestOptions); + } + + /** + * The withQueryApiVersion operation. + * + * @param apiVersion The apiVersion parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryApiVersionWithResponse(String apiVersion, RequestOptions requestOptions) { + return this.serviceClient.withQueryApiVersionWithResponse(apiVersion, requestOptions); + } + + /** + * The withPathApiVersion operation. + * + * @param apiVersion The apiVersion parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withPathApiVersionWithResponse(String apiVersion, RequestOptions requestOptions) { + return this.serviceClient.withPathApiVersionWithResponse(apiVersion, requestOptions); + } + + /** + * The withoutApiVersion operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withoutApiVersion() { + // Generated convenience method for withoutApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + withoutApiVersionWithResponse(requestOptions).getValue(); + } + + /** + * The withQueryApiVersion operation. + * + * @param apiVersion The apiVersion parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withQueryApiVersion(String apiVersion) { + // Generated convenience method for withQueryApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + withQueryApiVersionWithResponse(apiVersion, requestOptions).getValue(); + } + + /** + * The withPathApiVersion operation. + * + * @param apiVersion The apiVersion parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withPathApiVersion(String apiVersion) { + // Generated convenience method for withPathApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + withPathApiVersionWithResponse(apiVersion, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClientBuilder.java new file mode 100644 index 00000000000..814ee07bd59 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/NotVersionedClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.versions.notversioned; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import server.versions.notversioned.implementation.NotVersionedClientImpl; + +/** + * A builder for creating a new instance of the NotVersionedClient type. + */ +@ServiceClientBuilder(serviceClients = { NotVersionedClient.class, NotVersionedAsyncClient.class }) +public final class NotVersionedClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("server-versions-notversioned.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the NotVersionedClientBuilder. + */ + @Generated + public NotVersionedClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotVersionedClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotVersionedClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotVersionedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotVersionedClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotVersionedClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotVersionedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotVersionedClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotVersionedClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the NotVersionedClientBuilder. + */ + @Generated + public NotVersionedClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of NotVersionedClientImpl with the provided parameters. + * + * @return an instance of NotVersionedClientImpl. + */ + @Generated + private NotVersionedClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + NotVersionedClientImpl client + = new NotVersionedClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of NotVersionedAsyncClient class. + * + * @return an instance of NotVersionedAsyncClient. + */ + @Generated + public NotVersionedAsyncClient buildAsyncClient() { + return new NotVersionedAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of NotVersionedClient class. + * + * @return an instance of NotVersionedClient. + */ + @Generated + public NotVersionedClient buildClient() { + return new NotVersionedClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(NotVersionedClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java new file mode 100644 index 00000000000..46282333378 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.versions.notversioned.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the NotVersionedClient type. + */ +public final class NotVersionedClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NotVersionedClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of NotVersionedClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + */ + public NotVersionedClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NotVersionedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + */ + public NotVersionedClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NotVersionedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + */ + public NotVersionedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(NotVersionedClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for NotVersionedClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NotVersionedClient") + public interface NotVersionedClientService { + @Head("/server/versions/not-versioned/without-api-version") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withoutApiVersion(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Head("/server/versions/not-versioned/without-api-version") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withoutApiVersionSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Head("/server/versions/not-versioned/with-query-api-version") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withQueryApiVersion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + + @Head("/server/versions/not-versioned/with-query-api-version") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withQueryApiVersionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + + @Head("/server/versions/not-versioned/with-path-api-version/{apiVersion}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withPathApiVersion(@HostParam("endpoint") String endpoint, + @PathParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Head("/server/versions/not-versioned/with-path-api-version/{apiVersion}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withPathApiVersionSync(@HostParam("endpoint") String endpoint, + @PathParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + } + + /** + * The withoutApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withoutApiVersionWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.withoutApiVersion(this.getEndpoint(), requestOptions, context)); + } + + /** + * The withoutApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withoutApiVersionWithResponse(RequestOptions requestOptions) { + return service.withoutApiVersionSync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The withQueryApiVersion operation. + * + * @param apiVersion The apiVersion parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryApiVersionWithResponseAsync(String apiVersion, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withQueryApiVersion(this.getEndpoint(), apiVersion, requestOptions, context)); + } + + /** + * The withQueryApiVersion operation. + * + * @param apiVersion The apiVersion parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryApiVersionWithResponse(String apiVersion, RequestOptions requestOptions) { + return service.withQueryApiVersionSync(this.getEndpoint(), apiVersion, requestOptions, Context.NONE); + } + + /** + * The withPathApiVersion operation. + * + * @param apiVersion The apiVersion parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withPathApiVersionWithResponseAsync(String apiVersion, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withPathApiVersion(this.getEndpoint(), apiVersion, requestOptions, context)); + } + + /** + * The withPathApiVersion operation. + * + * @param apiVersion The apiVersion parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withPathApiVersionWithResponse(String apiVersion, RequestOptions requestOptions) { + return service.withPathApiVersionSync(this.getEndpoint(), apiVersion, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/package-info.java new file mode 100644 index 00000000000..c7fbcc652d8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for NotVersioned. + * Illustrates not-versioned server. + * + */ +package server.versions.notversioned.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/package-info.java new file mode 100644 index 00000000000..b744d37b22a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/notversioned/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for NotVersioned. + * Illustrates not-versioned server. + * + */ +package server.versions.notversioned; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedAsyncClient.java new file mode 100644 index 00000000000..2cba337eb43 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedAsyncClient.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.versions.versioned; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import server.versions.versioned.implementation.VersionedClientImpl; + +/** + * Initializes a new instance of the asynchronous VersionedClient type. + */ +@ServiceClient(builder = VersionedClientBuilder.class, isAsync = true) +public final class VersionedAsyncClient { + @Generated + private final VersionedClientImpl serviceClient; + + /** + * Initializes an instance of VersionedAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + VersionedAsyncClient(VersionedClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withoutApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withoutApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withoutApiVersionWithResponseAsync(requestOptions); + } + + /** + * The withQueryApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withQueryApiVersionWithResponseAsync(requestOptions); + } + + /** + * The withPathApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withPathApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withPathApiVersionWithResponseAsync(requestOptions); + } + + /** + * The withQueryOldApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryOldApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withQueryOldApiVersionWithResponseAsync(requestOptions); + } + + /** + * The withoutApiVersion operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withoutApiVersion() { + // Generated convenience method for withoutApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withoutApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withQueryApiVersion operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withQueryApiVersion() { + // Generated convenience method for withQueryApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withQueryApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withPathApiVersion operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withPathApiVersion() { + // Generated convenience method for withPathApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withPathApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withQueryOldApiVersion operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withQueryOldApiVersion() { + // Generated convenience method for withQueryOldApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withQueryOldApiVersionWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClient.java new file mode 100644 index 00000000000..819053006ce --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClient.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.versions.versioned; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import server.versions.versioned.implementation.VersionedClientImpl; + +/** + * Initializes a new instance of the synchronous VersionedClient type. + */ +@ServiceClient(builder = VersionedClientBuilder.class) +public final class VersionedClient { + @Generated + private final VersionedClientImpl serviceClient; + + /** + * Initializes an instance of VersionedClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + VersionedClient(VersionedClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withoutApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withoutApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withoutApiVersionWithResponse(requestOptions); + } + + /** + * The withQueryApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withQueryApiVersionWithResponse(requestOptions); + } + + /** + * The withPathApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withPathApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withPathApiVersionWithResponse(requestOptions); + } + + /** + * The withQueryOldApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryOldApiVersionWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withQueryOldApiVersionWithResponse(requestOptions); + } + + /** + * The withoutApiVersion operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withoutApiVersion() { + // Generated convenience method for withoutApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + withoutApiVersionWithResponse(requestOptions).getValue(); + } + + /** + * The withQueryApiVersion operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withQueryApiVersion() { + // Generated convenience method for withQueryApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + withQueryApiVersionWithResponse(requestOptions).getValue(); + } + + /** + * The withPathApiVersion operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withPathApiVersion() { + // Generated convenience method for withPathApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + withPathApiVersionWithResponse(requestOptions).getValue(); + } + + /** + * The withQueryOldApiVersion operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withQueryOldApiVersion() { + // Generated convenience method for withQueryOldApiVersionWithResponse + RequestOptions requestOptions = new RequestOptions(); + withQueryOldApiVersionWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClientBuilder.java new file mode 100644 index 00000000000..baea8044ff1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedClientBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.versions.versioned; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import server.versions.versioned.implementation.VersionedClientImpl; + +/** + * A builder for creating a new instance of the VersionedClient type. + */ +@ServiceClientBuilder(serviceClients = { VersionedClient.class, VersionedAsyncClient.class }) +public final class VersionedClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("server-versions-versioned.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the VersionedClientBuilder. + */ + @Generated + public VersionedClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersionedClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersionedClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersionedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersionedClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersionedClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersionedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersionedClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersionedClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private VersionedServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the VersionedClientBuilder. + */ + @Generated + public VersionedClientBuilder serviceVersion(VersionedServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the VersionedClientBuilder. + */ + @Generated + public VersionedClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of VersionedClientImpl with the provided parameters. + * + * @return an instance of VersionedClientImpl. + */ + @Generated + private VersionedClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + VersionedServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : VersionedServiceVersion.getLatest(); + VersionedClientImpl client = new VersionedClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of VersionedAsyncClient class. + * + * @return an instance of VersionedAsyncClient. + */ + @Generated + public VersionedAsyncClient buildAsyncClient() { + return new VersionedAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of VersionedClient class. + * + * @return an instance of VersionedClient. + */ + @Generated + public VersionedClient buildClient() { + return new VersionedClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(VersionedClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedServiceVersion.java new file mode 100644 index 00000000000..2399f722bea --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/VersionedServiceVersion.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.versions.versioned; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of VersionedClient. + */ +public enum VersionedServiceVersion implements ServiceVersion { + /** + * Enum value 2021-01-01-preview. + */ + V2021_01_01_PREVIEW("2021-01-01-preview"), + + /** + * Enum value 2022-12-01-preview. + */ + V2022_12_01_PREVIEW("2022-12-01-preview"); + + private final String version; + + VersionedServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link VersionedServiceVersion}. + */ + public static VersionedServiceVersion getLatest() { + return V2022_12_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java new file mode 100644 index 00000000000..b9d95687bb5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.versions.versioned.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; +import server.versions.versioned.VersionedServiceVersion; + +/** + * Initializes a new instance of the VersionedClient type. + */ +public final class VersionedClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final VersionedClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final VersionedServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public VersionedServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of VersionedClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public VersionedClientImpl(String endpoint, VersionedServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of VersionedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public VersionedClientImpl(HttpPipeline httpPipeline, String endpoint, VersionedServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of VersionedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public VersionedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + VersionedServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(VersionedClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for VersionedClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VersionedClient") + public interface VersionedClientService { + @Head("/server/versions/versioned/without-api-version") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withoutApiVersion(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Head("/server/versions/versioned/without-api-version") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withoutApiVersionSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Head("/server/versions/versioned/with-query-api-version") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withQueryApiVersion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + + @Head("/server/versions/versioned/with-query-api-version") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withQueryApiVersionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + + @Head("/server/versions/versioned/with-path-api-version/{apiVersion}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withPathApiVersion(@HostParam("endpoint") String endpoint, + @PathParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Head("/server/versions/versioned/with-path-api-version/{apiVersion}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withPathApiVersionSync(@HostParam("endpoint") String endpoint, + @PathParam("apiVersion") String apiVersion, RequestOptions requestOptions, Context context); + + @Head("/server/versions/versioned/with-query-old-api-version") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withQueryOldApiVersion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + + @Head("/server/versions/versioned/with-query-old-api-version") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withQueryOldApiVersionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + } + + /** + * The withoutApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withoutApiVersionWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.withoutApiVersion(this.getEndpoint(), requestOptions, context)); + } + + /** + * The withoutApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withoutApiVersionWithResponse(RequestOptions requestOptions) { + return service.withoutApiVersionSync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The withQueryApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryApiVersionWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.withQueryApiVersion(this.getEndpoint(), + this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * The withQueryApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryApiVersionWithResponse(RequestOptions requestOptions) { + return service.withQueryApiVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), + requestOptions, Context.NONE); + } + + /** + * The withPathApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withPathApiVersionWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.withPathApiVersion(this.getEndpoint(), + this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * The withPathApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withPathApiVersionWithResponse(RequestOptions requestOptions) { + return service.withPathApiVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, + Context.NONE); + } + + /** + * The withQueryOldApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withQueryOldApiVersionWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.withQueryOldApiVersion(this.getEndpoint(), + this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * The withQueryOldApiVersion operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withQueryOldApiVersionWithResponse(RequestOptions requestOptions) { + return service.withQueryOldApiVersionSync(this.getEndpoint(), this.getServiceVersion().getVersion(), + requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/package-info.java new file mode 100644 index 00000000000..2e7ef69662c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Versioned. + * Illustrates versioned server. + * + */ +package server.versions.versioned.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/package-info.java new file mode 100644 index 00000000000..ce684d1fa6f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/server/versions/versioned/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Versioned. + * Illustrates versioned server. + * + */ +package server.versions.versioned; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarAsyncClient.java new file mode 100644 index 00000000000..9211574695c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package service.multiservice.combined; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import service.multiservice.combined.implementation.BarsImpl; + +/** + * Initializes a new instance of the asynchronous Combined type. + */ +@ServiceClient(builder = CombinedBuilder.class, isAsync = true) +public final class BarAsyncClient { + @Generated + private final BarsImpl serviceClient; + + /** + * Initializes an instance of BarAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BarAsyncClient(BarsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The test operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> testWithResponse(RequestOptions requestOptions) { + return this.serviceClient.testWithResponseAsync(requestOptions); + } + + /** + * The test operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono test() { + // Generated convenience method for testWithResponse + RequestOptions requestOptions = new RequestOptions(); + return testWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarClient.java new file mode 100644 index 00000000000..03b812e715a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/BarClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package service.multiservice.combined; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import service.multiservice.combined.implementation.BarsImpl; + +/** + * Initializes a new instance of the synchronous Combined type. + */ +@ServiceClient(builder = CombinedBuilder.class) +public final class BarClient { + @Generated + private final BarsImpl serviceClient; + + /** + * Initializes an instance of BarClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BarClient(BarsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The test operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testWithResponse(RequestOptions requestOptions) { + return this.serviceClient.testWithResponse(requestOptions); + } + + /** + * The test operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void test() { + // Generated convenience method for testWithResponse + RequestOptions requestOptions = new RequestOptions(); + testWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/CombinedBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/CombinedBuilder.java new file mode 100644 index 00000000000..b89f4e03a22 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/CombinedBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package service.multiservice.combined; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import service.multiservice.combined.implementation.CombinedImpl; + +/** + * A builder for creating a new instance of the Combined type. + */ +@ServiceClientBuilder(serviceClients = { FooClient.class, BarClient.class, FooAsyncClient.class, BarAsyncClient.class }) +public final class CombinedBuilder + implements HttpTrait, ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("service-multiservice-combined.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the CombinedBuilder. + */ + @Generated + public CombinedBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CombinedBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CombinedBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CombinedBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CombinedBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CombinedBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CombinedBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CombinedBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public CombinedBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the CombinedBuilder. + */ + @Generated + public CombinedBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of CombinedImpl with the provided parameters. + * + * @return an instance of CombinedImpl. + */ + @Generated + private CombinedImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + CombinedImpl client + = new CombinedImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of FooAsyncClient class. + * + * @return an instance of FooAsyncClient. + */ + @Generated + public FooAsyncClient buildFooAsyncClient() { + return new FooAsyncClient(buildInnerClient().getFoos()); + } + + /** + * Builds an instance of BarAsyncClient class. + * + * @return an instance of BarAsyncClient. + */ + @Generated + public BarAsyncClient buildBarAsyncClient() { + return new BarAsyncClient(buildInnerClient().getBars()); + } + + /** + * Builds an instance of FooClient class. + * + * @return an instance of FooClient. + */ + @Generated + public FooClient buildFooClient() { + return new FooClient(buildInnerClient().getFoos()); + } + + /** + * Builds an instance of BarClient class. + * + * @return an instance of BarClient. + */ + @Generated + public BarClient buildBarClient() { + return new BarClient(buildInnerClient().getBars()); + } + + private static final ClientLogger LOGGER = new ClientLogger(CombinedBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooAsyncClient.java new file mode 100644 index 00000000000..34f3161e6a2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooAsyncClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package service.multiservice.combined; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import service.multiservice.combined.implementation.FoosImpl; + +/** + * Initializes a new instance of the asynchronous Combined type. + */ +@ServiceClient(builder = CombinedBuilder.class, isAsync = true) +public final class FooAsyncClient { + @Generated + private final FoosImpl serviceClient; + + /** + * Initializes an instance of FooAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FooAsyncClient(FoosImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The test operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> testWithResponse(RequestOptions requestOptions) { + return this.serviceClient.testWithResponseAsync(requestOptions); + } + + /** + * The test operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono test() { + // Generated convenience method for testWithResponse + RequestOptions requestOptions = new RequestOptions(); + return testWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooClient.java new file mode 100644 index 00000000000..98a2d8c872e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/FooClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package service.multiservice.combined; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import service.multiservice.combined.implementation.FoosImpl; + +/** + * Initializes a new instance of the synchronous Combined type. + */ +@ServiceClient(builder = CombinedBuilder.class) +public final class FooClient { + @Generated + private final FoosImpl serviceClient; + + /** + * Initializes an instance of FooClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FooClient(FoosImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The test operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testWithResponse(RequestOptions requestOptions) { + return this.serviceClient.testWithResponse(requestOptions); + } + + /** + * The test operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void test() { + // Generated convenience method for testWithResponse + RequestOptions requestOptions = new RequestOptions(); + testWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/BarsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/BarsImpl.java new file mode 100644 index 00000000000..c481c896037 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/BarsImpl.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package service.multiservice.combined.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Bars. + */ +public final class BarsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BarsService service; + + /** + * The service client containing this operation class. + */ + private final CombinedImpl client; + + /** + * Initializes an instance of BarsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BarsImpl(CombinedImpl client) { + this.service = RestProxy.create(BarsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CombinedBars to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CombinedBars") + public interface BarsService { + @Get("/service/multi-service/service-b/bar/test") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> test(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, Context context); + + @Get("/service/multi-service/service-b/bar/test") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response testSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, Context context); + } + + /** + * The test operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> testWithResponseAsync(RequestOptions requestOptions) { + final String apiVersion = "bv2"; + return FluxUtil + .withContext(context -> service.test(this.client.getEndpoint(), apiVersion, requestOptions, context)); + } + + /** + * The test operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testWithResponse(RequestOptions requestOptions) { + final String apiVersion = "bv2"; + return service.testSync(this.client.getEndpoint(), apiVersion, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/CombinedImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/CombinedImpl.java new file mode 100644 index 00000000000..d524e6a1b39 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/CombinedImpl.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package service.multiservice.combined.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 Combined type. + */ +public final class CombinedImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 FoosImpl object to access its operations. + */ + private final FoosImpl foos; + + /** + * Gets the FoosImpl object to access its operations. + * + * @return the FoosImpl object. + */ + public FoosImpl getFoos() { + return this.foos; + } + + /** + * The BarsImpl object to access its operations. + */ + private final BarsImpl bars; + + /** + * Gets the BarsImpl object to access its operations. + * + * @return the BarsImpl object. + */ + public BarsImpl getBars() { + return this.bars; + } + + /** + * Initializes an instance of Combined client. + * + * @param endpoint Service host. + */ + public CombinedImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of Combined client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public CombinedImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of Combined client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public CombinedImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.foos = new FoosImpl(this); + this.bars = new BarsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/FoosImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/FoosImpl.java new file mode 100644 index 00000000000..fe467381554 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/FoosImpl.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package service.multiservice.combined.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Foos. + */ +public final class FoosImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FoosService service; + + /** + * The service client containing this operation class. + */ + private final CombinedImpl client; + + /** + * Initializes an instance of FoosImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FoosImpl(CombinedImpl client) { + this.service = RestProxy.create(FoosService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CombinedFoos to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "CombinedFoos") + public interface FoosService { + @Get("/service/multi-service/service-a/foo/test") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> test(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, Context context); + + @Get("/service/multi-service/service-a/foo/test") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response testSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + RequestOptions requestOptions, Context context); + } + + /** + * The test operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> testWithResponseAsync(RequestOptions requestOptions) { + final String apiVersion = "av2"; + return FluxUtil + .withContext(context -> service.test(this.client.getEndpoint(), apiVersion, requestOptions, context)); + } + + /** + * The test operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testWithResponse(RequestOptions requestOptions) { + final String apiVersion = "av2"; + return service.testSync(this.client.getEndpoint(), apiVersion, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/package-info.java new file mode 100644 index 00000000000..abf0c574d64 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ServiceA. + * + */ +package service.multiservice.combined.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/package-info.java new file mode 100644 index 00000000000..79ea8b07e7f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/service/multiservice/combined/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ServiceA. + * + */ +package service.multiservice.combined; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestAsyncClient.java new file mode 100644 index 00000000000..fbd8ba89398 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestAsyncClient.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialheaders.conditionalrequest; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; +import specialheaders.conditionalrequest.implementation.ConditionalRequestClientImpl; + +/** + * Initializes a new instance of the asynchronous ConditionalRequestClient type. + */ +@ServiceClient(builder = ConditionalRequestClientBuilder.class, isAsync = true) +public final class ConditionalRequestAsyncClient { + @Generated + private final ConditionalRequestClientImpl serviceClient; + + /** + * Initializes an instance of ConditionalRequestAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ConditionalRequestAsyncClient(ConditionalRequestClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Check when only If-Match in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postIfMatchWithResponse(RequestOptions requestOptions) { + return this.serviceClient.postIfMatchWithResponseAsync(requestOptions); + } + + /** + * Check when only If-None-Match in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postIfNoneMatchWithResponse(RequestOptions requestOptions) { + return this.serviceClient.postIfNoneMatchWithResponseAsync(requestOptions); + } + + /** + * Check when only If-Modified-Since in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoA timestamp indicating the last modified time + * of the resource known to the + * client. The operation will be performed only if the resource on the service has + * been modified since the specified time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> headIfModifiedSinceWithResponse(RequestOptions requestOptions) { + return this.serviceClient.headIfModifiedSinceWithResponseAsync(requestOptions); + } + + /** + * Check when only If-Unmodified-Since in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-Unmodified-SinceOffsetDateTimeNoA timestamp indicating the last modified + * time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * not been modified since the specified time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postIfUnmodifiedSinceWithResponse(RequestOptions requestOptions) { + return this.serviceClient.postIfUnmodifiedSinceWithResponseAsync(requestOptions); + } + + /** + * Check when only If-Match in header is defined. + * + * @param ifMatch The request should only proceed if an entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono postIfMatch(String ifMatch) { + // Generated convenience method for postIfMatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + return postIfMatchWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Check when only If-Match in header is defined. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono postIfMatch() { + // Generated convenience method for postIfMatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postIfMatchWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Check when only If-None-Match in header is defined. + * + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono postIfNoneMatch(String ifNoneMatch) { + // Generated convenience method for postIfNoneMatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + return postIfNoneMatchWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Check when only If-None-Match in header is defined. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono postIfNoneMatch() { + // Generated convenience method for postIfNoneMatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postIfNoneMatchWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Check when only If-Modified-Since in header is defined. + * + * @param ifModifiedSince A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * been modified since the specified time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono headIfModifiedSince(OffsetDateTime ifModifiedSince) { + // Generated convenience method for headIfModifiedSinceWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifModifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } + return headIfModifiedSinceWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Check when only If-Modified-Since in header is defined. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono headIfModifiedSince() { + // Generated convenience method for headIfModifiedSinceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return headIfModifiedSinceWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Check when only If-Unmodified-Since in header is defined. + * + * @param ifUnmodifiedSince A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * not been modified since the specified time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono postIfUnmodifiedSince(OffsetDateTime ifUnmodifiedSince) { + // Generated convenience method for postIfUnmodifiedSinceWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifUnmodifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + return postIfUnmodifiedSinceWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Check when only If-Unmodified-Since in header is defined. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono postIfUnmodifiedSince() { + // Generated convenience method for postIfUnmodifiedSinceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postIfUnmodifiedSinceWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClient.java new file mode 100644 index 00000000000..19f63e6bf91 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClient.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialheaders.conditionalrequest; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.DateTimeRfc1123; +import java.time.OffsetDateTime; +import specialheaders.conditionalrequest.implementation.ConditionalRequestClientImpl; + +/** + * Initializes a new instance of the synchronous ConditionalRequestClient type. + */ +@ServiceClient(builder = ConditionalRequestClientBuilder.class) +public final class ConditionalRequestClient { + @Generated + private final ConditionalRequestClientImpl serviceClient; + + /** + * Initializes an instance of ConditionalRequestClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ConditionalRequestClient(ConditionalRequestClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Check when only If-Match in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postIfMatchWithResponse(RequestOptions requestOptions) { + return this.serviceClient.postIfMatchWithResponse(requestOptions); + } + + /** + * Check when only If-None-Match in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postIfNoneMatchWithResponse(RequestOptions requestOptions) { + return this.serviceClient.postIfNoneMatchWithResponse(requestOptions); + } + + /** + * Check when only If-Modified-Since in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoA timestamp indicating the last modified time + * of the resource known to the + * client. The operation will be performed only if the resource on the service has + * been modified since the specified time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headIfModifiedSinceWithResponse(RequestOptions requestOptions) { + return this.serviceClient.headIfModifiedSinceWithResponse(requestOptions); + } + + /** + * Check when only If-Unmodified-Since in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-Unmodified-SinceOffsetDateTimeNoA timestamp indicating the last modified + * time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * not been modified since the specified time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postIfUnmodifiedSinceWithResponse(RequestOptions requestOptions) { + return this.serviceClient.postIfUnmodifiedSinceWithResponse(requestOptions); + } + + /** + * Check when only If-Match in header is defined. + * + * @param ifMatch The request should only proceed if an entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void postIfMatch(String ifMatch) { + // Generated convenience method for postIfMatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + postIfMatchWithResponse(requestOptions).getValue(); + } + + /** + * Check when only If-Match in header is defined. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void postIfMatch() { + // Generated convenience method for postIfMatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + postIfMatchWithResponse(requestOptions).getValue(); + } + + /** + * Check when only If-None-Match in header is defined. + * + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void postIfNoneMatch(String ifNoneMatch) { + // Generated convenience method for postIfNoneMatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + postIfNoneMatchWithResponse(requestOptions).getValue(); + } + + /** + * Check when only If-None-Match in header is defined. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void postIfNoneMatch() { + // Generated convenience method for postIfNoneMatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + postIfNoneMatchWithResponse(requestOptions).getValue(); + } + + /** + * Check when only If-Modified-Since in header is defined. + * + * @param ifModifiedSince A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * been modified since the specified time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void headIfModifiedSince(OffsetDateTime ifModifiedSince) { + // Generated convenience method for headIfModifiedSinceWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifModifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } + headIfModifiedSinceWithResponse(requestOptions).getValue(); + } + + /** + * Check when only If-Modified-Since in header is defined. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void headIfModifiedSince() { + // Generated convenience method for headIfModifiedSinceWithResponse + RequestOptions requestOptions = new RequestOptions(); + headIfModifiedSinceWithResponse(requestOptions).getValue(); + } + + /** + * Check when only If-Unmodified-Since in header is defined. + * + * @param ifUnmodifiedSince A timestamp indicating the last modified time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * not been modified since the specified time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void postIfUnmodifiedSince(OffsetDateTime ifUnmodifiedSince) { + // Generated convenience method for postIfUnmodifiedSinceWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (ifUnmodifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + postIfUnmodifiedSinceWithResponse(requestOptions).getValue(); + } + + /** + * Check when only If-Unmodified-Since in header is defined. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void postIfUnmodifiedSince() { + // Generated convenience method for postIfUnmodifiedSinceWithResponse + RequestOptions requestOptions = new RequestOptions(); + postIfUnmodifiedSinceWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClientBuilder.java new file mode 100644 index 00000000000..83002268e51 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/ConditionalRequestClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialheaders.conditionalrequest; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import specialheaders.conditionalrequest.implementation.ConditionalRequestClientImpl; + +/** + * A builder for creating a new instance of the ConditionalRequestClient type. + */ +@ServiceClientBuilder(serviceClients = { ConditionalRequestClient.class, ConditionalRequestAsyncClient.class }) +public final class ConditionalRequestClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("specialheaders-conditionalrequest.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ConditionalRequestClientBuilder. + */ + @Generated + public ConditionalRequestClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ConditionalRequestClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ConditionalRequestClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ConditionalRequestClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ConditionalRequestClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ConditionalRequestClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ConditionalRequestClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ConditionalRequestClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ConditionalRequestClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ConditionalRequestClientBuilder. + */ + @Generated + public ConditionalRequestClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ConditionalRequestClientImpl with the provided parameters. + * + * @return an instance of ConditionalRequestClientImpl. + */ + @Generated + private ConditionalRequestClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ConditionalRequestClientImpl client = new ConditionalRequestClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ConditionalRequestAsyncClient class. + * + * @return an instance of ConditionalRequestAsyncClient. + */ + @Generated + public ConditionalRequestAsyncClient buildAsyncClient() { + return new ConditionalRequestAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ConditionalRequestClient class. + * + * @return an instance of ConditionalRequestClient. + */ + @Generated + public ConditionalRequestClient buildClient() { + return new ConditionalRequestClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ConditionalRequestClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/ConditionalRequestClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/ConditionalRequestClientImpl.java new file mode 100644 index 00000000000..45ac00fbab5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/ConditionalRequestClientImpl.java @@ -0,0 +1,393 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialheaders.conditionalrequest.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ConditionalRequestClient type. + */ +public final class ConditionalRequestClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ConditionalRequestClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of ConditionalRequestClient client. + * + * @param endpoint Service host. + */ + public ConditionalRequestClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ConditionalRequestClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ConditionalRequestClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ConditionalRequestClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ConditionalRequestClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(ConditionalRequestClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ConditionalRequestClient to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ConditionalRequestClient") + public interface ConditionalRequestClientService { + @Post("/special-headers/conditional-request/if-match") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> postIfMatch(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Post("/special-headers/conditional-request/if-match") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postIfMatchSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Post("/special-headers/conditional-request/if-none-match") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> postIfNoneMatch(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Post("/special-headers/conditional-request/if-none-match") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postIfNoneMatchSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Head("/special-headers/conditional-request/if-modified-since") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> headIfModifiedSince(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Head("/special-headers/conditional-request/if-modified-since") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response headIfModifiedSinceSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Post("/special-headers/conditional-request/if-unmodified-since") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> postIfUnmodifiedSince(@HostParam("endpoint") String endpoint, + RequestOptions requestOptions, Context context); + + @Post("/special-headers/conditional-request/if-unmodified-since") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postIfUnmodifiedSinceSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * Check when only If-Match in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postIfMatchWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.postIfMatch(this.getEndpoint(), requestOptions, context)); + } + + /** + * Check when only If-Match in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postIfMatchWithResponse(RequestOptions requestOptions) { + return service.postIfMatchSync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * Check when only If-None-Match in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postIfNoneMatchWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.postIfNoneMatch(this.getEndpoint(), requestOptions, context)); + } + + /** + * Check when only If-None-Match in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postIfNoneMatchWithResponse(RequestOptions requestOptions) { + return service.postIfNoneMatchSync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * Check when only If-Modified-Since in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoA timestamp indicating the last modified time + * of the resource known to the + * client. The operation will be performed only if the resource on the service has + * been modified since the specified time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> headIfModifiedSinceWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.headIfModifiedSince(this.getEndpoint(), requestOptions, context)); + } + + /** + * Check when only If-Modified-Since in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoA timestamp indicating the last modified time + * of the resource known to the + * client. The operation will be performed only if the resource on the service has + * been modified since the specified time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headIfModifiedSinceWithResponse(RequestOptions requestOptions) { + return service.headIfModifiedSinceSync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * Check when only If-Unmodified-Since in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-Unmodified-SinceOffsetDateTimeNoA timestamp indicating the last modified + * time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * not been modified since the specified time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postIfUnmodifiedSinceWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.postIfUnmodifiedSince(this.getEndpoint(), requestOptions, context)); + } + + /** + * Check when only If-Unmodified-Since in header is defined. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-Unmodified-SinceOffsetDateTimeNoA timestamp indicating the last modified + * time of the resource known to the + * client. The operation will be performed only if the resource on the service has + * not been modified since the specified time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postIfUnmodifiedSinceWithResponse(RequestOptions requestOptions) { + return service.postIfUnmodifiedSinceSync(this.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/package-info.java new file mode 100644 index 00000000000..7110fedce66 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ConditionalRequest. + * Illustrates conditional request headers. + * + */ +package specialheaders.conditionalrequest.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/package-info.java new file mode 100644 index 00000000000..a265790cb9a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/conditionalrequest/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ConditionalRequest. + * Illustrates conditional request headers. + * + */ +package specialheaders.conditionalrequest; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityAsyncClient.java new file mode 100644 index 00000000000..dfb531b787b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityAsyncClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialheaders.repeatability; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import specialheaders.repeatability.implementation.RepeatabilityClientImpl; + +/** + * Initializes a new instance of the asynchronous RepeatabilityClient type. + */ +@ServiceClient(builder = RepeatabilityClientBuilder.class, isAsync = true) +public final class RepeatabilityAsyncClient { + @Generated + private final RepeatabilityClientImpl serviceClient; + + /** + * Initializes an instance of RepeatabilityAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RepeatabilityAsyncClient(RepeatabilityClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> immediateSuccessWithResponse(RequestOptions requestOptions) { + return this.serviceClient.immediateSuccessWithResponseAsync(requestOptions); + } + + /** + * Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono immediateSuccess() { + // Generated convenience method for immediateSuccessWithResponse + RequestOptions requestOptions = new RequestOptions(); + return immediateSuccessWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClient.java new file mode 100644 index 00000000000..4840de1b303 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialheaders.repeatability; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import specialheaders.repeatability.implementation.RepeatabilityClientImpl; + +/** + * Initializes a new instance of the synchronous RepeatabilityClient type. + */ +@ServiceClient(builder = RepeatabilityClientBuilder.class) +public final class RepeatabilityClient { + @Generated + private final RepeatabilityClientImpl serviceClient; + + /** + * Initializes an instance of RepeatabilityClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RepeatabilityClient(RepeatabilityClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response immediateSuccessWithResponse(RequestOptions requestOptions) { + return this.serviceClient.immediateSuccessWithResponse(requestOptions); + } + + /** + * Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void immediateSuccess() { + // Generated convenience method for immediateSuccessWithResponse + RequestOptions requestOptions = new RequestOptions(); + immediateSuccessWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClientBuilder.java new file mode 100644 index 00000000000..90ddb1a5ff9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/RepeatabilityClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialheaders.repeatability; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import specialheaders.repeatability.implementation.RepeatabilityClientImpl; + +/** + * A builder for creating a new instance of the RepeatabilityClient type. + */ +@ServiceClientBuilder(serviceClients = { RepeatabilityClient.class, RepeatabilityAsyncClient.class }) +public final class RepeatabilityClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("specialheaders-repeatability.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the RepeatabilityClientBuilder. + */ + @Generated + public RepeatabilityClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RepeatabilityClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RepeatabilityClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RepeatabilityClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RepeatabilityClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RepeatabilityClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RepeatabilityClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RepeatabilityClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RepeatabilityClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the RepeatabilityClientBuilder. + */ + @Generated + public RepeatabilityClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of RepeatabilityClientImpl with the provided parameters. + * + * @return an instance of RepeatabilityClientImpl. + */ + @Generated + private RepeatabilityClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + RepeatabilityClientImpl client = new RepeatabilityClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of RepeatabilityAsyncClient class. + * + * @return an instance of RepeatabilityAsyncClient. + */ + @Generated + public RepeatabilityAsyncClient buildAsyncClient() { + return new RepeatabilityAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of RepeatabilityClient class. + * + * @return an instance of RepeatabilityClient. + */ + @Generated + public RepeatabilityClient buildClient() { + return new RepeatabilityClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(RepeatabilityClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/RepeatabilityClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/RepeatabilityClientImpl.java new file mode 100644 index 00000000000..085186d6e79 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/RepeatabilityClientImpl.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialheaders.repeatability.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the RepeatabilityClient type. + */ +public final class RepeatabilityClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RepeatabilityClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of RepeatabilityClient client. + * + * @param endpoint Service host. + */ + public RepeatabilityClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of RepeatabilityClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public RepeatabilityClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of RepeatabilityClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public RepeatabilityClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(RepeatabilityClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for RepeatabilityClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RepeatabilityClient") + public interface RepeatabilityClientService { + @Post("/special-headers/repeatability/immediateSuccess") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> immediateSuccess(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Post("/special-headers/repeatability/immediateSuccess") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response immediateSuccessSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> immediateSuccessWithResponseAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return FluxUtil + .withContext(context -> service.immediateSuccess(this.getEndpoint(), requestOptionsLocal, context)); + } + + /** + * Check we recognize Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response immediateSuccessWithResponse(RequestOptions requestOptions) { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return service.immediateSuccessSync(this.getEndpoint(), requestOptionsLocal, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/package-info.java new file mode 100644 index 00000000000..950e6a3770d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Repeatability. + * Illustrates OASIS repeatability headers. + * + */ +package specialheaders.repeatability.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/package-info.java new file mode 100644 index 00000000000..b42a6426c9a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialheaders/repeatability/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Repeatability. + * Illustrates OASIS repeatability headers. + * + */ +package specialheaders.repeatability; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesAsyncClient.java new file mode 100644 index 00000000000..e8922e855b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesAsyncClient.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import specialwords.implementation.ModelPropertiesImpl; +import specialwords.modelproperties.models.DictMethods; +import specialwords.modelproperties.models.SameAsModel; + +/** + * Initializes a new instance of the asynchronous SpecialWordsClient type. + */ +@ServiceClient(builder = SpecialWordsClientBuilder.class, isAsync = true) +public final class ModelPropertiesAsyncClient { + @Generated + private final ModelPropertiesImpl serviceClient; + + /** + * Initializes an instance of ModelPropertiesAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelPropertiesAsyncClient(ModelPropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The sameAsModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     SameAsModel: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sameAsModelWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.sameAsModelWithResponseAsync(body, requestOptions); + } + + /** + * The dictMethods operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     keys: String (Required)
+     *     items: String (Required)
+     *     values: String (Required)
+     *     popitem: String (Required)
+     *     clear: String (Required)
+     *     update: String (Required)
+     *     setdefault: String (Required)
+     *     pop: String (Required)
+     *     get: String (Required)
+     *     copy: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> dictMethodsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.dictMethodsWithResponseAsync(body, requestOptions); + } + + /** + * The sameAsModel operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono sameAsModel(SameAsModel body) { + // Generated convenience method for sameAsModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return sameAsModelWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The dictMethods operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono dictMethods(DictMethods body) { + // Generated convenience method for dictMethodsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return dictMethodsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesClient.java new file mode 100644 index 00000000000..1374bc9f693 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelPropertiesClient.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import specialwords.implementation.ModelPropertiesImpl; +import specialwords.modelproperties.models.DictMethods; +import specialwords.modelproperties.models.SameAsModel; + +/** + * Initializes a new instance of the synchronous SpecialWordsClient type. + */ +@ServiceClient(builder = SpecialWordsClientBuilder.class) +public final class ModelPropertiesClient { + @Generated + private final ModelPropertiesImpl serviceClient; + + /** + * Initializes an instance of ModelPropertiesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelPropertiesClient(ModelPropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The sameAsModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     SameAsModel: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sameAsModelWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.sameAsModelWithResponse(body, requestOptions); + } + + /** + * The dictMethods operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     keys: String (Required)
+     *     items: String (Required)
+     *     values: String (Required)
+     *     popitem: String (Required)
+     *     clear: String (Required)
+     *     update: String (Required)
+     *     setdefault: String (Required)
+     *     pop: String (Required)
+     *     get: String (Required)
+     *     copy: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response dictMethodsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.dictMethodsWithResponse(body, requestOptions); + } + + /** + * The sameAsModel operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void sameAsModel(SameAsModel body) { + // Generated convenience method for sameAsModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + sameAsModelWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The dictMethods operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void dictMethods(DictMethods body) { + // Generated convenience method for dictMethodsWithResponse + RequestOptions requestOptions = new RequestOptions(); + dictMethodsWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsAsyncClient.java new file mode 100644 index 00000000000..e36add4ca6f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsAsyncClient.java @@ -0,0 +1,1590 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import specialwords.implementation.ModelsImpl; +import specialwords.models.models.And; +import specialwords.models.models.As; +import specialwords.models.models.Assert; +import specialwords.models.models.Async; +import specialwords.models.models.Await; +import specialwords.models.models.Break; +import specialwords.models.models.ClassModel; +import specialwords.models.models.Constructor; +import specialwords.models.models.Continue; +import specialwords.models.models.Def; +import specialwords.models.models.Del; +import specialwords.models.models.Elif; +import specialwords.models.models.Else; +import specialwords.models.models.Except; +import specialwords.models.models.Exec; +import specialwords.models.models.Finally; +import specialwords.models.models.For; +import specialwords.models.models.From; +import specialwords.models.models.Global; +import specialwords.models.models.If; +import specialwords.models.models.Import; +import specialwords.models.models.In; +import specialwords.models.models.Is; +import specialwords.models.models.Lambda; +import specialwords.models.models.Not; +import specialwords.models.models.Or; +import specialwords.models.models.Pass; +import specialwords.models.models.Raise; +import specialwords.models.models.Return; +import specialwords.models.models.Try; +import specialwords.models.models.While; +import specialwords.models.models.With; +import specialwords.models.models.Yield; + +/** + * Initializes a new instance of the asynchronous SpecialWordsClient type. + */ +@ServiceClient(builder = SpecialWordsClientBuilder.class, isAsync = true) +public final class ModelsAsyncClient { + @Generated + private final ModelsImpl serviceClient; + + /** + * Initializes an instance of ModelsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelsAsyncClient(ModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withAnd operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAndWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withAndWithResponseAsync(body, requestOptions); + } + + /** + * The withAs operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withAsWithResponseAsync(body, requestOptions); + } + + /** + * The withAssert operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAssertWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withAssertWithResponseAsync(body, requestOptions); + } + + /** + * The withAsync operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAsyncWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withAsyncWithResponseAsync(body, requestOptions); + } + + /** + * The withAwait operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAwaitWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withAwaitWithResponseAsync(body, requestOptions); + } + + /** + * The withBreak operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withBreakWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withBreakWithResponseAsync(body, requestOptions); + } + + /** + * The withClass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withClassWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withClassWithResponseAsync(body, requestOptions); + } + + /** + * The withConstructor operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withConstructorWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withConstructorWithResponseAsync(body, requestOptions); + } + + /** + * The withContinue operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withContinueWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withContinueWithResponseAsync(body, requestOptions); + } + + /** + * The withDef operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withDefWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withDefWithResponseAsync(body, requestOptions); + } + + /** + * The withDel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withDelWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withDelWithResponseAsync(body, requestOptions); + } + + /** + * The withElif operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withElifWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withElifWithResponseAsync(body, requestOptions); + } + + /** + * The withElse operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withElseWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withElseWithResponseAsync(body, requestOptions); + } + + /** + * The withExcept operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withExceptWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withExceptWithResponseAsync(body, requestOptions); + } + + /** + * The withExec operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withExecWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withExecWithResponseAsync(body, requestOptions); + } + + /** + * The withFinally operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withFinallyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withFinallyWithResponseAsync(body, requestOptions); + } + + /** + * The withFor operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withForWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withForWithResponseAsync(body, requestOptions); + } + + /** + * The withFrom operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withFromWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withFromWithResponseAsync(body, requestOptions); + } + + /** + * The withGlobal operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withGlobalWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withGlobalWithResponseAsync(body, requestOptions); + } + + /** + * The withIf operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withIfWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withIfWithResponseAsync(body, requestOptions); + } + + /** + * The withImport operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withImportWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withImportWithResponseAsync(body, requestOptions); + } + + /** + * The withIn operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withInWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withInWithResponseAsync(body, requestOptions); + } + + /** + * The withIs operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withIsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withIsWithResponseAsync(body, requestOptions); + } + + /** + * The withLambda operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withLambdaWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withLambdaWithResponseAsync(body, requestOptions); + } + + /** + * The withNot operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withNotWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withNotWithResponseAsync(body, requestOptions); + } + + /** + * The withOr operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withOrWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withOrWithResponseAsync(body, requestOptions); + } + + /** + * The withPass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withPassWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withPassWithResponseAsync(body, requestOptions); + } + + /** + * The withRaise operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withRaiseWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withRaiseWithResponseAsync(body, requestOptions); + } + + /** + * The withReturn operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withReturnWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withReturnWithResponseAsync(body, requestOptions); + } + + /** + * The withTry operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withTryWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withTryWithResponseAsync(body, requestOptions); + } + + /** + * The withWhile operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withWhileWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withWhileWithResponseAsync(body, requestOptions); + } + + /** + * The withWith operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withWithWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withWithWithResponseAsync(body, requestOptions); + } + + /** + * The withYield operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withYieldWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withYieldWithResponseAsync(body, requestOptions); + } + + /** + * The withAnd operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withAnd(And body) { + // Generated convenience method for withAndWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withAndWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withAs operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withAs(As body) { + // Generated convenience method for withAsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withAsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withAssert operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withAssert(Assert body) { + // Generated convenience method for withAssertWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withAssertWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withAsync operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withAsync(Async body) { + // Generated convenience method for withAsyncWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withAsyncWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withAwait operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withAwait(Await body) { + // Generated convenience method for withAwaitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withAwaitWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withBreak operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withBreak(Break body) { + // Generated convenience method for withBreakWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withBreakWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withClass operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withClass(ClassModel body) { + // Generated convenience method for withClassWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withClassWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withConstructor operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withConstructor(Constructor body) { + // Generated convenience method for withConstructorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withConstructorWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withContinue operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withContinue(Continue body) { + // Generated convenience method for withContinueWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withContinueWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withDef operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withDef(Def body) { + // Generated convenience method for withDefWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withDefWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withDel operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withDel(Del body) { + // Generated convenience method for withDelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withDelWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withElif operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withElif(Elif body) { + // Generated convenience method for withElifWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withElifWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withElse operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withElse(Else body) { + // Generated convenience method for withElseWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withElseWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withExcept operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withExcept(Except body) { + // Generated convenience method for withExceptWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withExceptWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withExec operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withExec(Exec body) { + // Generated convenience method for withExecWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withExecWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withFinally operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withFinally(Finally body) { + // Generated convenience method for withFinallyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withFinallyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withFor operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withFor(For body) { + // Generated convenience method for withForWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withForWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withFrom operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withFrom(From body) { + // Generated convenience method for withFromWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withFromWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withGlobal operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withGlobal(Global body) { + // Generated convenience method for withGlobalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withGlobalWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withIf operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withIf(If body) { + // Generated convenience method for withIfWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withIfWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withImport operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withImport(Import body) { + // Generated convenience method for withImportWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withImportWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withIn operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withIn(In body) { + // Generated convenience method for withInWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withInWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withIs operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withIs(Is body) { + // Generated convenience method for withIsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withIsWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withLambda operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withLambda(Lambda body) { + // Generated convenience method for withLambdaWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withLambdaWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withNot operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withNot(Not body) { + // Generated convenience method for withNotWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withNotWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withOr operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withOr(Or body) { + // Generated convenience method for withOrWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withOrWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withPass operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withPass(Pass body) { + // Generated convenience method for withPassWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withPassWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withRaise operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withRaise(Raise body) { + // Generated convenience method for withRaiseWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withRaiseWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withReturn operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withReturn(Return body) { + // Generated convenience method for withReturnWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withReturnWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withTry operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withTry(Try body) { + // Generated convenience method for withTryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withTryWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withWhile operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withWhile(While body) { + // Generated convenience method for withWhileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withWhileWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withWith operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withWith(With body) { + // Generated convenience method for withWithWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withWithWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withYield operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withYield(Yield body) { + // Generated convenience method for withYieldWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withYieldWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsClient.java new file mode 100644 index 00000000000..d38e17b174e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ModelsClient.java @@ -0,0 +1,1555 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import specialwords.implementation.ModelsImpl; +import specialwords.models.models.And; +import specialwords.models.models.As; +import specialwords.models.models.Assert; +import specialwords.models.models.Async; +import specialwords.models.models.Await; +import specialwords.models.models.Break; +import specialwords.models.models.ClassModel; +import specialwords.models.models.Constructor; +import specialwords.models.models.Continue; +import specialwords.models.models.Def; +import specialwords.models.models.Del; +import specialwords.models.models.Elif; +import specialwords.models.models.Else; +import specialwords.models.models.Except; +import specialwords.models.models.Exec; +import specialwords.models.models.Finally; +import specialwords.models.models.For; +import specialwords.models.models.From; +import specialwords.models.models.Global; +import specialwords.models.models.If; +import specialwords.models.models.Import; +import specialwords.models.models.In; +import specialwords.models.models.Is; +import specialwords.models.models.Lambda; +import specialwords.models.models.Not; +import specialwords.models.models.Or; +import specialwords.models.models.Pass; +import specialwords.models.models.Raise; +import specialwords.models.models.Return; +import specialwords.models.models.Try; +import specialwords.models.models.While; +import specialwords.models.models.With; +import specialwords.models.models.Yield; + +/** + * Initializes a new instance of the synchronous SpecialWordsClient type. + */ +@ServiceClient(builder = SpecialWordsClientBuilder.class) +public final class ModelsClient { + @Generated + private final ModelsImpl serviceClient; + + /** + * Initializes an instance of ModelsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelsClient(ModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withAnd operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAndWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withAndWithResponse(body, requestOptions); + } + + /** + * The withAs operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withAsWithResponse(body, requestOptions); + } + + /** + * The withAssert operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAssertWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withAssertWithResponse(body, requestOptions); + } + + /** + * The withAsync operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAsyncWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withAsyncWithResponse(body, requestOptions); + } + + /** + * The withAwait operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAwaitWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withAwaitWithResponse(body, requestOptions); + } + + /** + * The withBreak operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withBreakWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withBreakWithResponse(body, requestOptions); + } + + /** + * The withClass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withClassWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withClassWithResponse(body, requestOptions); + } + + /** + * The withConstructor operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withConstructorWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withConstructorWithResponse(body, requestOptions); + } + + /** + * The withContinue operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withContinueWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withContinueWithResponse(body, requestOptions); + } + + /** + * The withDef operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withDefWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withDefWithResponse(body, requestOptions); + } + + /** + * The withDel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withDelWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withDelWithResponse(body, requestOptions); + } + + /** + * The withElif operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withElifWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withElifWithResponse(body, requestOptions); + } + + /** + * The withElse operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withElseWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withElseWithResponse(body, requestOptions); + } + + /** + * The withExcept operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withExceptWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withExceptWithResponse(body, requestOptions); + } + + /** + * The withExec operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withExecWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withExecWithResponse(body, requestOptions); + } + + /** + * The withFinally operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withFinallyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withFinallyWithResponse(body, requestOptions); + } + + /** + * The withFor operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withForWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withForWithResponse(body, requestOptions); + } + + /** + * The withFrom operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withFromWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withFromWithResponse(body, requestOptions); + } + + /** + * The withGlobal operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withGlobalWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withGlobalWithResponse(body, requestOptions); + } + + /** + * The withIf operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withIfWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withIfWithResponse(body, requestOptions); + } + + /** + * The withImport operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withImportWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withImportWithResponse(body, requestOptions); + } + + /** + * The withIn operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withInWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withInWithResponse(body, requestOptions); + } + + /** + * The withIs operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withIsWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withIsWithResponse(body, requestOptions); + } + + /** + * The withLambda operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withLambdaWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withLambdaWithResponse(body, requestOptions); + } + + /** + * The withNot operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withNotWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withNotWithResponse(body, requestOptions); + } + + /** + * The withOr operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withOrWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withOrWithResponse(body, requestOptions); + } + + /** + * The withPass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withPassWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withPassWithResponse(body, requestOptions); + } + + /** + * The withRaise operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withRaiseWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withRaiseWithResponse(body, requestOptions); + } + + /** + * The withReturn operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withReturnWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withReturnWithResponse(body, requestOptions); + } + + /** + * The withTry operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withTryWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withTryWithResponse(body, requestOptions); + } + + /** + * The withWhile operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withWhileWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withWhileWithResponse(body, requestOptions); + } + + /** + * The withWith operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withWithWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withWithWithResponse(body, requestOptions); + } + + /** + * The withYield operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withYieldWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.withYieldWithResponse(body, requestOptions); + } + + /** + * The withAnd operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withAnd(And body) { + // Generated convenience method for withAndWithResponse + RequestOptions requestOptions = new RequestOptions(); + withAndWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withAs operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withAs(As body) { + // Generated convenience method for withAsWithResponse + RequestOptions requestOptions = new RequestOptions(); + withAsWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withAssert operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withAssert(Assert body) { + // Generated convenience method for withAssertWithResponse + RequestOptions requestOptions = new RequestOptions(); + withAssertWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withAsync operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withAsync(Async body) { + // Generated convenience method for withAsyncWithResponse + RequestOptions requestOptions = new RequestOptions(); + withAsyncWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withAwait operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withAwait(Await body) { + // Generated convenience method for withAwaitWithResponse + RequestOptions requestOptions = new RequestOptions(); + withAwaitWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withBreak operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withBreak(Break body) { + // Generated convenience method for withBreakWithResponse + RequestOptions requestOptions = new RequestOptions(); + withBreakWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withClass operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withClass(ClassModel body) { + // Generated convenience method for withClassWithResponse + RequestOptions requestOptions = new RequestOptions(); + withClassWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withConstructor operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withConstructor(Constructor body) { + // Generated convenience method for withConstructorWithResponse + RequestOptions requestOptions = new RequestOptions(); + withConstructorWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withContinue operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withContinue(Continue body) { + // Generated convenience method for withContinueWithResponse + RequestOptions requestOptions = new RequestOptions(); + withContinueWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withDef operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withDef(Def body) { + // Generated convenience method for withDefWithResponse + RequestOptions requestOptions = new RequestOptions(); + withDefWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withDel operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withDel(Del body) { + // Generated convenience method for withDelWithResponse + RequestOptions requestOptions = new RequestOptions(); + withDelWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withElif operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withElif(Elif body) { + // Generated convenience method for withElifWithResponse + RequestOptions requestOptions = new RequestOptions(); + withElifWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withElse operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withElse(Else body) { + // Generated convenience method for withElseWithResponse + RequestOptions requestOptions = new RequestOptions(); + withElseWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withExcept operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withExcept(Except body) { + // Generated convenience method for withExceptWithResponse + RequestOptions requestOptions = new RequestOptions(); + withExceptWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withExec operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withExec(Exec body) { + // Generated convenience method for withExecWithResponse + RequestOptions requestOptions = new RequestOptions(); + withExecWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withFinally operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withFinally(Finally body) { + // Generated convenience method for withFinallyWithResponse + RequestOptions requestOptions = new RequestOptions(); + withFinallyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withFor operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withFor(For body) { + // Generated convenience method for withForWithResponse + RequestOptions requestOptions = new RequestOptions(); + withForWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withFrom operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withFrom(From body) { + // Generated convenience method for withFromWithResponse + RequestOptions requestOptions = new RequestOptions(); + withFromWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withGlobal operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withGlobal(Global body) { + // Generated convenience method for withGlobalWithResponse + RequestOptions requestOptions = new RequestOptions(); + withGlobalWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withIf operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withIf(If body) { + // Generated convenience method for withIfWithResponse + RequestOptions requestOptions = new RequestOptions(); + withIfWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withImport operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withImport(Import body) { + // Generated convenience method for withImportWithResponse + RequestOptions requestOptions = new RequestOptions(); + withImportWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withIn operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withIn(In body) { + // Generated convenience method for withInWithResponse + RequestOptions requestOptions = new RequestOptions(); + withInWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withIs operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withIs(Is body) { + // Generated convenience method for withIsWithResponse + RequestOptions requestOptions = new RequestOptions(); + withIsWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withLambda operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withLambda(Lambda body) { + // Generated convenience method for withLambdaWithResponse + RequestOptions requestOptions = new RequestOptions(); + withLambdaWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withNot operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withNot(Not body) { + // Generated convenience method for withNotWithResponse + RequestOptions requestOptions = new RequestOptions(); + withNotWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withOr operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withOr(Or body) { + // Generated convenience method for withOrWithResponse + RequestOptions requestOptions = new RequestOptions(); + withOrWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withPass operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withPass(Pass body) { + // Generated convenience method for withPassWithResponse + RequestOptions requestOptions = new RequestOptions(); + withPassWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withRaise operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withRaise(Raise body) { + // Generated convenience method for withRaiseWithResponse + RequestOptions requestOptions = new RequestOptions(); + withRaiseWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withReturn operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withReturn(Return body) { + // Generated convenience method for withReturnWithResponse + RequestOptions requestOptions = new RequestOptions(); + withReturnWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withTry operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withTry(Try body) { + // Generated convenience method for withTryWithResponse + RequestOptions requestOptions = new RequestOptions(); + withTryWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withWhile operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withWhile(While body) { + // Generated convenience method for withWhileWithResponse + RequestOptions requestOptions = new RequestOptions(); + withWhileWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withWith operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withWith(With body) { + // Generated convenience method for withWithWithResponse + RequestOptions requestOptions = new RequestOptions(); + withWithWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The withYield operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withYield(Yield body) { + // Generated convenience method for withYieldWithResponse + RequestOptions requestOptions = new RequestOptions(); + withYieldWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsAsyncClient.java new file mode 100644 index 00000000000..9d05a1c885a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsAsyncClient.java @@ -0,0 +1,1160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import specialwords.implementation.OperationsImpl; + +/** + * Initializes a new instance of the asynchronous SpecialWordsClient type. + */ +@ServiceClient(builder = SpecialWordsClientBuilder.class, isAsync = true) +public final class OperationsAsyncClient { + @Generated + private final OperationsImpl serviceClient; + + /** + * Initializes an instance of OperationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + OperationsAsyncClient(OperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The and operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> andWithResponse(RequestOptions requestOptions) { + return this.serviceClient.andWithResponseAsync(requestOptions); + } + + /** + * The as operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> asWithResponse(RequestOptions requestOptions) { + return this.serviceClient.asWithResponseAsync(requestOptions); + } + + /** + * The assertMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> assertMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.assertMethodWithResponseAsync(requestOptions); + } + + /** + * The async operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> asyncWithResponse(RequestOptions requestOptions) { + return this.serviceClient.asyncWithResponseAsync(requestOptions); + } + + /** + * The await operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> awaitWithResponse(RequestOptions requestOptions) { + return this.serviceClient.awaitWithResponseAsync(requestOptions); + } + + /** + * The breakMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> breakMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.breakMethodWithResponseAsync(requestOptions); + } + + /** + * The classMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> classMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.classMethodWithResponseAsync(requestOptions); + } + + /** + * The constructor operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> constructorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.constructorWithResponseAsync(requestOptions); + } + + /** + * The continueMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> continueMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.continueMethodWithResponseAsync(requestOptions); + } + + /** + * The def operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defWithResponse(RequestOptions requestOptions) { + return this.serviceClient.defWithResponseAsync(requestOptions); + } + + /** + * The del operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> delWithResponse(RequestOptions requestOptions) { + return this.serviceClient.delWithResponseAsync(requestOptions); + } + + /** + * The elif operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> elifWithResponse(RequestOptions requestOptions) { + return this.serviceClient.elifWithResponseAsync(requestOptions); + } + + /** + * The elseMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> elseMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.elseMethodWithResponseAsync(requestOptions); + } + + /** + * The except operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> exceptWithResponse(RequestOptions requestOptions) { + return this.serviceClient.exceptWithResponseAsync(requestOptions); + } + + /** + * The exec operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> execWithResponse(RequestOptions requestOptions) { + return this.serviceClient.execWithResponseAsync(requestOptions); + } + + /** + * The finallyMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> finallyMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.finallyMethodWithResponseAsync(requestOptions); + } + + /** + * The forMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> forMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.forMethodWithResponseAsync(requestOptions); + } + + /** + * The from operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fromWithResponseAsync(requestOptions); + } + + /** + * The global operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> globalWithResponse(RequestOptions requestOptions) { + return this.serviceClient.globalWithResponseAsync(requestOptions); + } + + /** + * The ifMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> ifMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.ifMethodWithResponseAsync(requestOptions); + } + + /** + * The importMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> importMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.importMethodWithResponseAsync(requestOptions); + } + + /** + * The in operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> inWithResponse(RequestOptions requestOptions) { + return this.serviceClient.inWithResponseAsync(requestOptions); + } + + /** + * The is operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> isWithResponse(RequestOptions requestOptions) { + return this.serviceClient.isWithResponseAsync(requestOptions); + } + + /** + * The lambda operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> lambdaWithResponse(RequestOptions requestOptions) { + return this.serviceClient.lambdaWithResponseAsync(requestOptions); + } + + /** + * The not operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> notWithResponse(RequestOptions requestOptions) { + return this.serviceClient.notWithResponseAsync(requestOptions); + } + + /** + * The or operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> orWithResponse(RequestOptions requestOptions) { + return this.serviceClient.orWithResponseAsync(requestOptions); + } + + /** + * The pass operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> passWithResponse(RequestOptions requestOptions) { + return this.serviceClient.passWithResponseAsync(requestOptions); + } + + /** + * The raise operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> raiseWithResponse(RequestOptions requestOptions) { + return this.serviceClient.raiseWithResponseAsync(requestOptions); + } + + /** + * The returnMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> returnMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.returnMethodWithResponseAsync(requestOptions); + } + + /** + * The tryMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> tryMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.tryMethodWithResponseAsync(requestOptions); + } + + /** + * The whileMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> whileMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.whileMethodWithResponseAsync(requestOptions); + } + + /** + * The with operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withWithResponseAsync(requestOptions); + } + + /** + * The yield operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> yieldWithResponse(RequestOptions requestOptions) { + return this.serviceClient.yieldWithResponseAsync(requestOptions); + } + + /** + * The and operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono and() { + // Generated convenience method for andWithResponse + RequestOptions requestOptions = new RequestOptions(); + return andWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The as operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono as() { + // Generated convenience method for asWithResponse + RequestOptions requestOptions = new RequestOptions(); + return asWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The assertMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono assertMethod() { + // Generated convenience method for assertMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return assertMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The async operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono async() { + // Generated convenience method for asyncWithResponse + RequestOptions requestOptions = new RequestOptions(); + return asyncWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The await operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono await() { + // Generated convenience method for awaitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return awaitWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The breakMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono breakMethod() { + // Generated convenience method for breakMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return breakMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The classMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono classMethod() { + // Generated convenience method for classMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return classMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The constructor operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono constructor() { + // Generated convenience method for constructorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return constructorWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The continueMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono continueMethod() { + // Generated convenience method for continueMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return continueMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The def operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono def() { + // Generated convenience method for defWithResponse + RequestOptions requestOptions = new RequestOptions(); + return defWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The del operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono del() { + // Generated convenience method for delWithResponse + RequestOptions requestOptions = new RequestOptions(); + return delWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The elif operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono elif() { + // Generated convenience method for elifWithResponse + RequestOptions requestOptions = new RequestOptions(); + return elifWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The elseMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono elseMethod() { + // Generated convenience method for elseMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return elseMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The except operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono except() { + // Generated convenience method for exceptWithResponse + RequestOptions requestOptions = new RequestOptions(); + return exceptWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The exec operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono exec() { + // Generated convenience method for execWithResponse + RequestOptions requestOptions = new RequestOptions(); + return execWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The finallyMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono finallyMethod() { + // Generated convenience method for finallyMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return finallyMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The forMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono forMethod() { + // Generated convenience method for forMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return forMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The from operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono from() { + // Generated convenience method for fromWithResponse + RequestOptions requestOptions = new RequestOptions(); + return fromWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The global operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono global() { + // Generated convenience method for globalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return globalWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The ifMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono ifMethod() { + // Generated convenience method for ifMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return ifMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The importMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono importMethod() { + // Generated convenience method for importMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return importMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The in operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono in() { + // Generated convenience method for inWithResponse + RequestOptions requestOptions = new RequestOptions(); + return inWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The is operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono is() { + // Generated convenience method for isWithResponse + RequestOptions requestOptions = new RequestOptions(); + return isWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The lambda operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono lambda() { + // Generated convenience method for lambdaWithResponse + RequestOptions requestOptions = new RequestOptions(); + return lambdaWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The not operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono not() { + // Generated convenience method for notWithResponse + RequestOptions requestOptions = new RequestOptions(); + return notWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The or operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono or() { + // Generated convenience method for orWithResponse + RequestOptions requestOptions = new RequestOptions(); + return orWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The pass operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono pass() { + // Generated convenience method for passWithResponse + RequestOptions requestOptions = new RequestOptions(); + return passWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The raise operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono raise() { + // Generated convenience method for raiseWithResponse + RequestOptions requestOptions = new RequestOptions(); + return raiseWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The returnMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono returnMethod() { + // Generated convenience method for returnMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return returnMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The tryMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono tryMethod() { + // Generated convenience method for tryMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return tryMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The whileMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono whileMethod() { + // Generated convenience method for whileMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + return whileMethodWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The with operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono with() { + // Generated convenience method for withWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The yield operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono yield() { + // Generated convenience method for yieldWithResponse + RequestOptions requestOptions = new RequestOptions(); + return yieldWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsClient.java new file mode 100644 index 00000000000..d34a5fd6991 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/OperationsClient.java @@ -0,0 +1,1125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import specialwords.implementation.OperationsImpl; + +/** + * Initializes a new instance of the synchronous SpecialWordsClient type. + */ +@ServiceClient(builder = SpecialWordsClientBuilder.class) +public final class OperationsClient { + @Generated + private final OperationsImpl serviceClient; + + /** + * Initializes an instance of OperationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + OperationsClient(OperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The and operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response andWithResponse(RequestOptions requestOptions) { + return this.serviceClient.andWithResponse(requestOptions); + } + + /** + * The as operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response asWithResponse(RequestOptions requestOptions) { + return this.serviceClient.asWithResponse(requestOptions); + } + + /** + * The assertMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response assertMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.assertMethodWithResponse(requestOptions); + } + + /** + * The async operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response asyncWithResponse(RequestOptions requestOptions) { + return this.serviceClient.asyncWithResponse(requestOptions); + } + + /** + * The await operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response awaitWithResponse(RequestOptions requestOptions) { + return this.serviceClient.awaitWithResponse(requestOptions); + } + + /** + * The breakMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response breakMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.breakMethodWithResponse(requestOptions); + } + + /** + * The classMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response classMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.classMethodWithResponse(requestOptions); + } + + /** + * The constructor operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response constructorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.constructorWithResponse(requestOptions); + } + + /** + * The continueMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response continueMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.continueMethodWithResponse(requestOptions); + } + + /** + * The def operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defWithResponse(RequestOptions requestOptions) { + return this.serviceClient.defWithResponse(requestOptions); + } + + /** + * The del operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response delWithResponse(RequestOptions requestOptions) { + return this.serviceClient.delWithResponse(requestOptions); + } + + /** + * The elif operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response elifWithResponse(RequestOptions requestOptions) { + return this.serviceClient.elifWithResponse(requestOptions); + } + + /** + * The elseMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response elseMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.elseMethodWithResponse(requestOptions); + } + + /** + * The except operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exceptWithResponse(RequestOptions requestOptions) { + return this.serviceClient.exceptWithResponse(requestOptions); + } + + /** + * The exec operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response execWithResponse(RequestOptions requestOptions) { + return this.serviceClient.execWithResponse(requestOptions); + } + + /** + * The finallyMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response finallyMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.finallyMethodWithResponse(requestOptions); + } + + /** + * The forMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response forMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.forMethodWithResponse(requestOptions); + } + + /** + * The from operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromWithResponse(RequestOptions requestOptions) { + return this.serviceClient.fromWithResponse(requestOptions); + } + + /** + * The global operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response globalWithResponse(RequestOptions requestOptions) { + return this.serviceClient.globalWithResponse(requestOptions); + } + + /** + * The ifMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response ifMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.ifMethodWithResponse(requestOptions); + } + + /** + * The importMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response importMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.importMethodWithResponse(requestOptions); + } + + /** + * The in operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response inWithResponse(RequestOptions requestOptions) { + return this.serviceClient.inWithResponse(requestOptions); + } + + /** + * The is operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response isWithResponse(RequestOptions requestOptions) { + return this.serviceClient.isWithResponse(requestOptions); + } + + /** + * The lambda operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response lambdaWithResponse(RequestOptions requestOptions) { + return this.serviceClient.lambdaWithResponse(requestOptions); + } + + /** + * The not operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response notWithResponse(RequestOptions requestOptions) { + return this.serviceClient.notWithResponse(requestOptions); + } + + /** + * The or operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response orWithResponse(RequestOptions requestOptions) { + return this.serviceClient.orWithResponse(requestOptions); + } + + /** + * The pass operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response passWithResponse(RequestOptions requestOptions) { + return this.serviceClient.passWithResponse(requestOptions); + } + + /** + * The raise operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response raiseWithResponse(RequestOptions requestOptions) { + return this.serviceClient.raiseWithResponse(requestOptions); + } + + /** + * The returnMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response returnMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.returnMethodWithResponse(requestOptions); + } + + /** + * The tryMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response tryMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.tryMethodWithResponse(requestOptions); + } + + /** + * The whileMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response whileMethodWithResponse(RequestOptions requestOptions) { + return this.serviceClient.whileMethodWithResponse(requestOptions); + } + + /** + * The with operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withWithResponse(RequestOptions requestOptions) { + return this.serviceClient.withWithResponse(requestOptions); + } + + /** + * The yield operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response yieldWithResponse(RequestOptions requestOptions) { + return this.serviceClient.yieldWithResponse(requestOptions); + } + + /** + * The and operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void and() { + // Generated convenience method for andWithResponse + RequestOptions requestOptions = new RequestOptions(); + andWithResponse(requestOptions).getValue(); + } + + /** + * The as operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void as() { + // Generated convenience method for asWithResponse + RequestOptions requestOptions = new RequestOptions(); + asWithResponse(requestOptions).getValue(); + } + + /** + * The assertMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void assertMethod() { + // Generated convenience method for assertMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + assertMethodWithResponse(requestOptions).getValue(); + } + + /** + * The async operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void async() { + // Generated convenience method for asyncWithResponse + RequestOptions requestOptions = new RequestOptions(); + asyncWithResponse(requestOptions).getValue(); + } + + /** + * The await operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void await() { + // Generated convenience method for awaitWithResponse + RequestOptions requestOptions = new RequestOptions(); + awaitWithResponse(requestOptions).getValue(); + } + + /** + * The breakMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void breakMethod() { + // Generated convenience method for breakMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + breakMethodWithResponse(requestOptions).getValue(); + } + + /** + * The classMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void classMethod() { + // Generated convenience method for classMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + classMethodWithResponse(requestOptions).getValue(); + } + + /** + * The constructor operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void constructor() { + // Generated convenience method for constructorWithResponse + RequestOptions requestOptions = new RequestOptions(); + constructorWithResponse(requestOptions).getValue(); + } + + /** + * The continueMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void continueMethod() { + // Generated convenience method for continueMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + continueMethodWithResponse(requestOptions).getValue(); + } + + /** + * The def operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void def() { + // Generated convenience method for defWithResponse + RequestOptions requestOptions = new RequestOptions(); + defWithResponse(requestOptions).getValue(); + } + + /** + * The del operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void del() { + // Generated convenience method for delWithResponse + RequestOptions requestOptions = new RequestOptions(); + delWithResponse(requestOptions).getValue(); + } + + /** + * The elif operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void elif() { + // Generated convenience method for elifWithResponse + RequestOptions requestOptions = new RequestOptions(); + elifWithResponse(requestOptions).getValue(); + } + + /** + * The elseMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void elseMethod() { + // Generated convenience method for elseMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + elseMethodWithResponse(requestOptions).getValue(); + } + + /** + * The except operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void except() { + // Generated convenience method for exceptWithResponse + RequestOptions requestOptions = new RequestOptions(); + exceptWithResponse(requestOptions).getValue(); + } + + /** + * The exec operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void exec() { + // Generated convenience method for execWithResponse + RequestOptions requestOptions = new RequestOptions(); + execWithResponse(requestOptions).getValue(); + } + + /** + * The finallyMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void finallyMethod() { + // Generated convenience method for finallyMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + finallyMethodWithResponse(requestOptions).getValue(); + } + + /** + * The forMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void forMethod() { + // Generated convenience method for forMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + forMethodWithResponse(requestOptions).getValue(); + } + + /** + * The from operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void from() { + // Generated convenience method for fromWithResponse + RequestOptions requestOptions = new RequestOptions(); + fromWithResponse(requestOptions).getValue(); + } + + /** + * The global operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void global() { + // Generated convenience method for globalWithResponse + RequestOptions requestOptions = new RequestOptions(); + globalWithResponse(requestOptions).getValue(); + } + + /** + * The ifMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void ifMethod() { + // Generated convenience method for ifMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + ifMethodWithResponse(requestOptions).getValue(); + } + + /** + * The importMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void importMethod() { + // Generated convenience method for importMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + importMethodWithResponse(requestOptions).getValue(); + } + + /** + * The in operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void in() { + // Generated convenience method for inWithResponse + RequestOptions requestOptions = new RequestOptions(); + inWithResponse(requestOptions).getValue(); + } + + /** + * The is operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void is() { + // Generated convenience method for isWithResponse + RequestOptions requestOptions = new RequestOptions(); + isWithResponse(requestOptions).getValue(); + } + + /** + * The lambda operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void lambda() { + // Generated convenience method for lambdaWithResponse + RequestOptions requestOptions = new RequestOptions(); + lambdaWithResponse(requestOptions).getValue(); + } + + /** + * The not operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void not() { + // Generated convenience method for notWithResponse + RequestOptions requestOptions = new RequestOptions(); + notWithResponse(requestOptions).getValue(); + } + + /** + * The or operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void or() { + // Generated convenience method for orWithResponse + RequestOptions requestOptions = new RequestOptions(); + orWithResponse(requestOptions).getValue(); + } + + /** + * The pass operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void pass() { + // Generated convenience method for passWithResponse + RequestOptions requestOptions = new RequestOptions(); + passWithResponse(requestOptions).getValue(); + } + + /** + * The raise operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void raise() { + // Generated convenience method for raiseWithResponse + RequestOptions requestOptions = new RequestOptions(); + raiseWithResponse(requestOptions).getValue(); + } + + /** + * The returnMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void returnMethod() { + // Generated convenience method for returnMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + returnMethodWithResponse(requestOptions).getValue(); + } + + /** + * The tryMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void tryMethod() { + // Generated convenience method for tryMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + tryMethodWithResponse(requestOptions).getValue(); + } + + /** + * The whileMethod operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void whileMethod() { + // Generated convenience method for whileMethodWithResponse + RequestOptions requestOptions = new RequestOptions(); + whileMethodWithResponse(requestOptions).getValue(); + } + + /** + * The with operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void with() { + // Generated convenience method for withWithResponse + RequestOptions requestOptions = new RequestOptions(); + withWithResponse(requestOptions).getValue(); + } + + /** + * The yield operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void yield() { + // Generated convenience method for yieldWithResponse + RequestOptions requestOptions = new RequestOptions(); + yieldWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersAsyncClient.java new file mode 100644 index 00000000000..9d263bdea57 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersAsyncClient.java @@ -0,0 +1,1297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import specialwords.implementation.ParametersImpl; + +/** + * Initializes a new instance of the asynchronous SpecialWordsClient type. + */ +@ServiceClient(builder = SpecialWordsClientBuilder.class, isAsync = true) +public final class ParametersAsyncClient { + @Generated + private final ParametersImpl serviceClient; + + /** + * Initializes an instance of ParametersAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ParametersAsyncClient(ParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withAnd operation. + * + * @param and The and parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAndWithResponse(String and, RequestOptions requestOptions) { + return this.serviceClient.withAndWithResponseAsync(and, requestOptions); + } + + /** + * The withAs operation. + * + * @param as The as parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAsWithResponse(String as, RequestOptions requestOptions) { + return this.serviceClient.withAsWithResponseAsync(as, requestOptions); + } + + /** + * The withAssert operation. + * + * @param assertParameter The assertParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAssertWithResponse(String assertParameter, RequestOptions requestOptions) { + return this.serviceClient.withAssertWithResponseAsync(assertParameter, requestOptions); + } + + /** + * The withAsync operation. + * + * @param async The async parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAsyncWithResponse(String async, RequestOptions requestOptions) { + return this.serviceClient.withAsyncWithResponseAsync(async, requestOptions); + } + + /** + * The withAwait operation. + * + * @param await The await parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAwaitWithResponse(String await, RequestOptions requestOptions) { + return this.serviceClient.withAwaitWithResponseAsync(await, requestOptions); + } + + /** + * The withBreak operation. + * + * @param breakParameter The breakParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withBreakWithResponse(String breakParameter, RequestOptions requestOptions) { + return this.serviceClient.withBreakWithResponseAsync(breakParameter, requestOptions); + } + + /** + * The withClass operation. + * + * @param classParameter The classParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withClassWithResponse(String classParameter, RequestOptions requestOptions) { + return this.serviceClient.withClassWithResponseAsync(classParameter, requestOptions); + } + + /** + * The withConstructor operation. + * + * @param constructor The constructor parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withConstructorWithResponse(String constructor, RequestOptions requestOptions) { + return this.serviceClient.withConstructorWithResponseAsync(constructor, requestOptions); + } + + /** + * The withContinue operation. + * + * @param continueParameter The continueParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withContinueWithResponse(String continueParameter, RequestOptions requestOptions) { + return this.serviceClient.withContinueWithResponseAsync(continueParameter, requestOptions); + } + + /** + * The withDef operation. + * + * @param def The def parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withDefWithResponse(String def, RequestOptions requestOptions) { + return this.serviceClient.withDefWithResponseAsync(def, requestOptions); + } + + /** + * The withDel operation. + * + * @param del The del parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withDelWithResponse(String del, RequestOptions requestOptions) { + return this.serviceClient.withDelWithResponseAsync(del, requestOptions); + } + + /** + * The withElif operation. + * + * @param elif The elif parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withElifWithResponse(String elif, RequestOptions requestOptions) { + return this.serviceClient.withElifWithResponseAsync(elif, requestOptions); + } + + /** + * The withElse operation. + * + * @param elseParameter The elseParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withElseWithResponse(String elseParameter, RequestOptions requestOptions) { + return this.serviceClient.withElseWithResponseAsync(elseParameter, requestOptions); + } + + /** + * The withExcept operation. + * + * @param except The except parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withExceptWithResponse(String except, RequestOptions requestOptions) { + return this.serviceClient.withExceptWithResponseAsync(except, requestOptions); + } + + /** + * The withExec operation. + * + * @param exec The exec parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withExecWithResponse(String exec, RequestOptions requestOptions) { + return this.serviceClient.withExecWithResponseAsync(exec, requestOptions); + } + + /** + * The withFinally operation. + * + * @param finallyParameter The finallyParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withFinallyWithResponse(String finallyParameter, RequestOptions requestOptions) { + return this.serviceClient.withFinallyWithResponseAsync(finallyParameter, requestOptions); + } + + /** + * The withFor operation. + * + * @param forParameter The forParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withForWithResponse(String forParameter, RequestOptions requestOptions) { + return this.serviceClient.withForWithResponseAsync(forParameter, requestOptions); + } + + /** + * The withFrom operation. + * + * @param from The from parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withFromWithResponse(String from, RequestOptions requestOptions) { + return this.serviceClient.withFromWithResponseAsync(from, requestOptions); + } + + /** + * The withGlobal operation. + * + * @param global The global parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withGlobalWithResponse(String global, RequestOptions requestOptions) { + return this.serviceClient.withGlobalWithResponseAsync(global, requestOptions); + } + + /** + * The withIf operation. + * + * @param ifParameter The ifParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withIfWithResponse(String ifParameter, RequestOptions requestOptions) { + return this.serviceClient.withIfWithResponseAsync(ifParameter, requestOptions); + } + + /** + * The withImport operation. + * + * @param importParameter The importParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withImportWithResponse(String importParameter, RequestOptions requestOptions) { + return this.serviceClient.withImportWithResponseAsync(importParameter, requestOptions); + } + + /** + * The withIn operation. + * + * @param in The in parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withInWithResponse(String in, RequestOptions requestOptions) { + return this.serviceClient.withInWithResponseAsync(in, requestOptions); + } + + /** + * The withIs operation. + * + * @param is The is parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withIsWithResponse(String is, RequestOptions requestOptions) { + return this.serviceClient.withIsWithResponseAsync(is, requestOptions); + } + + /** + * The withLambda operation. + * + * @param lambda The lambda parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withLambdaWithResponse(String lambda, RequestOptions requestOptions) { + return this.serviceClient.withLambdaWithResponseAsync(lambda, requestOptions); + } + + /** + * The withNot operation. + * + * @param not The not parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withNotWithResponse(String not, RequestOptions requestOptions) { + return this.serviceClient.withNotWithResponseAsync(not, requestOptions); + } + + /** + * The withOr operation. + * + * @param or The or parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withOrWithResponse(String or, RequestOptions requestOptions) { + return this.serviceClient.withOrWithResponseAsync(or, requestOptions); + } + + /** + * The withPass operation. + * + * @param pass The pass parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withPassWithResponse(String pass, RequestOptions requestOptions) { + return this.serviceClient.withPassWithResponseAsync(pass, requestOptions); + } + + /** + * The withRaise operation. + * + * @param raise The raise parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withRaiseWithResponse(String raise, RequestOptions requestOptions) { + return this.serviceClient.withRaiseWithResponseAsync(raise, requestOptions); + } + + /** + * The withReturn operation. + * + * @param returnParameter The returnParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withReturnWithResponse(String returnParameter, RequestOptions requestOptions) { + return this.serviceClient.withReturnWithResponseAsync(returnParameter, requestOptions); + } + + /** + * The withTry operation. + * + * @param tryParameter The tryParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withTryWithResponse(String tryParameter, RequestOptions requestOptions) { + return this.serviceClient.withTryWithResponseAsync(tryParameter, requestOptions); + } + + /** + * The withWhile operation. + * + * @param whileParameter The whileParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withWhileWithResponse(String whileParameter, RequestOptions requestOptions) { + return this.serviceClient.withWhileWithResponseAsync(whileParameter, requestOptions); + } + + /** + * The withWith operation. + * + * @param with The with parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withWithWithResponse(String with, RequestOptions requestOptions) { + return this.serviceClient.withWithWithResponseAsync(with, requestOptions); + } + + /** + * The withYield operation. + * + * @param yield The yield parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withYieldWithResponse(String yield, RequestOptions requestOptions) { + return this.serviceClient.withYieldWithResponseAsync(yield, requestOptions); + } + + /** + * The withCancellationToken operation. + * + * @param cancellationToken The cancellationToken parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withCancellationTokenWithResponse(String cancellationToken, + RequestOptions requestOptions) { + return this.serviceClient.withCancellationTokenWithResponseAsync(cancellationToken, requestOptions); + } + + /** + * The withAnd operation. + * + * @param and The and parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withAnd(String and) { + // Generated convenience method for withAndWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withAndWithResponse(and, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withAs operation. + * + * @param as The as parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withAs(String as) { + // Generated convenience method for withAsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withAsWithResponse(as, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withAssert operation. + * + * @param assertParameter The assertParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withAssert(String assertParameter) { + // Generated convenience method for withAssertWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withAssertWithResponse(assertParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withAsync operation. + * + * @param async The async parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withAsync(String async) { + // Generated convenience method for withAsyncWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withAsyncWithResponse(async, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withAwait operation. + * + * @param await The await parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withAwait(String await) { + // Generated convenience method for withAwaitWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withAwaitWithResponse(await, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withBreak operation. + * + * @param breakParameter The breakParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withBreak(String breakParameter) { + // Generated convenience method for withBreakWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withBreakWithResponse(breakParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withClass operation. + * + * @param classParameter The classParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withClass(String classParameter) { + // Generated convenience method for withClassWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withClassWithResponse(classParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withConstructor operation. + * + * @param constructor The constructor parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withConstructor(String constructor) { + // Generated convenience method for withConstructorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withConstructorWithResponse(constructor, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withContinue operation. + * + * @param continueParameter The continueParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withContinue(String continueParameter) { + // Generated convenience method for withContinueWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withContinueWithResponse(continueParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withDef operation. + * + * @param def The def parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withDef(String def) { + // Generated convenience method for withDefWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withDefWithResponse(def, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withDel operation. + * + * @param del The del parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withDel(String del) { + // Generated convenience method for withDelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withDelWithResponse(del, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withElif operation. + * + * @param elif The elif parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withElif(String elif) { + // Generated convenience method for withElifWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withElifWithResponse(elif, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withElse operation. + * + * @param elseParameter The elseParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withElse(String elseParameter) { + // Generated convenience method for withElseWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withElseWithResponse(elseParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withExcept operation. + * + * @param except The except parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withExcept(String except) { + // Generated convenience method for withExceptWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withExceptWithResponse(except, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withExec operation. + * + * @param exec The exec parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withExec(String exec) { + // Generated convenience method for withExecWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withExecWithResponse(exec, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withFinally operation. + * + * @param finallyParameter The finallyParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withFinally(String finallyParameter) { + // Generated convenience method for withFinallyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withFinallyWithResponse(finallyParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withFor operation. + * + * @param forParameter The forParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withFor(String forParameter) { + // Generated convenience method for withForWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withForWithResponse(forParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withFrom operation. + * + * @param from The from parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withFrom(String from) { + // Generated convenience method for withFromWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withFromWithResponse(from, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withGlobal operation. + * + * @param global The global parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withGlobal(String global) { + // Generated convenience method for withGlobalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withGlobalWithResponse(global, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withIf operation. + * + * @param ifParameter The ifParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withIf(String ifParameter) { + // Generated convenience method for withIfWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withIfWithResponse(ifParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withImport operation. + * + * @param importParameter The importParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withImport(String importParameter) { + // Generated convenience method for withImportWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withImportWithResponse(importParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withIn operation. + * + * @param in The in parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withIn(String in) { + // Generated convenience method for withInWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withInWithResponse(in, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withIs operation. + * + * @param is The is parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withIs(String is) { + // Generated convenience method for withIsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withIsWithResponse(is, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withLambda operation. + * + * @param lambda The lambda parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withLambda(String lambda) { + // Generated convenience method for withLambdaWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withLambdaWithResponse(lambda, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withNot operation. + * + * @param not The not parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withNot(String not) { + // Generated convenience method for withNotWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withNotWithResponse(not, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withOr operation. + * + * @param or The or parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withOr(String or) { + // Generated convenience method for withOrWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withOrWithResponse(or, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withPass operation. + * + * @param pass The pass parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withPass(String pass) { + // Generated convenience method for withPassWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withPassWithResponse(pass, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withRaise operation. + * + * @param raise The raise parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withRaise(String raise) { + // Generated convenience method for withRaiseWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withRaiseWithResponse(raise, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withReturn operation. + * + * @param returnParameter The returnParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withReturn(String returnParameter) { + // Generated convenience method for withReturnWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withReturnWithResponse(returnParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withTry operation. + * + * @param tryParameter The tryParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withTry(String tryParameter) { + // Generated convenience method for withTryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withTryWithResponse(tryParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withWhile operation. + * + * @param whileParameter The whileParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withWhile(String whileParameter) { + // Generated convenience method for withWhileWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withWhileWithResponse(whileParameter, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withWith operation. + * + * @param with The with parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withWith(String with) { + // Generated convenience method for withWithWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withWithWithResponse(with, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withYield operation. + * + * @param yield The yield parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withYield(String yield) { + // Generated convenience method for withYieldWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withYieldWithResponse(yield, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The withCancellationToken operation. + * + * @param cancellationToken The cancellationToken parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono withCancellationToken(String cancellationToken) { + // Generated convenience method for withCancellationTokenWithResponse + RequestOptions requestOptions = new RequestOptions(); + return withCancellationTokenWithResponse(cancellationToken, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersClient.java new file mode 100644 index 00000000000..12066239656 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/ParametersClient.java @@ -0,0 +1,1260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import specialwords.implementation.ParametersImpl; + +/** + * Initializes a new instance of the synchronous SpecialWordsClient type. + */ +@ServiceClient(builder = SpecialWordsClientBuilder.class) +public final class ParametersClient { + @Generated + private final ParametersImpl serviceClient; + + /** + * Initializes an instance of ParametersClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ParametersClient(ParametersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The withAnd operation. + * + * @param and The and parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAndWithResponse(String and, RequestOptions requestOptions) { + return this.serviceClient.withAndWithResponse(and, requestOptions); + } + + /** + * The withAs operation. + * + * @param as The as parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAsWithResponse(String as, RequestOptions requestOptions) { + return this.serviceClient.withAsWithResponse(as, requestOptions); + } + + /** + * The withAssert operation. + * + * @param assertParameter The assertParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAssertWithResponse(String assertParameter, RequestOptions requestOptions) { + return this.serviceClient.withAssertWithResponse(assertParameter, requestOptions); + } + + /** + * The withAsync operation. + * + * @param async The async parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAsyncWithResponse(String async, RequestOptions requestOptions) { + return this.serviceClient.withAsyncWithResponse(async, requestOptions); + } + + /** + * The withAwait operation. + * + * @param await The await parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAwaitWithResponse(String await, RequestOptions requestOptions) { + return this.serviceClient.withAwaitWithResponse(await, requestOptions); + } + + /** + * The withBreak operation. + * + * @param breakParameter The breakParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withBreakWithResponse(String breakParameter, RequestOptions requestOptions) { + return this.serviceClient.withBreakWithResponse(breakParameter, requestOptions); + } + + /** + * The withClass operation. + * + * @param classParameter The classParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withClassWithResponse(String classParameter, RequestOptions requestOptions) { + return this.serviceClient.withClassWithResponse(classParameter, requestOptions); + } + + /** + * The withConstructor operation. + * + * @param constructor The constructor parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withConstructorWithResponse(String constructor, RequestOptions requestOptions) { + return this.serviceClient.withConstructorWithResponse(constructor, requestOptions); + } + + /** + * The withContinue operation. + * + * @param continueParameter The continueParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withContinueWithResponse(String continueParameter, RequestOptions requestOptions) { + return this.serviceClient.withContinueWithResponse(continueParameter, requestOptions); + } + + /** + * The withDef operation. + * + * @param def The def parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withDefWithResponse(String def, RequestOptions requestOptions) { + return this.serviceClient.withDefWithResponse(def, requestOptions); + } + + /** + * The withDel operation. + * + * @param del The del parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withDelWithResponse(String del, RequestOptions requestOptions) { + return this.serviceClient.withDelWithResponse(del, requestOptions); + } + + /** + * The withElif operation. + * + * @param elif The elif parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withElifWithResponse(String elif, RequestOptions requestOptions) { + return this.serviceClient.withElifWithResponse(elif, requestOptions); + } + + /** + * The withElse operation. + * + * @param elseParameter The elseParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withElseWithResponse(String elseParameter, RequestOptions requestOptions) { + return this.serviceClient.withElseWithResponse(elseParameter, requestOptions); + } + + /** + * The withExcept operation. + * + * @param except The except parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withExceptWithResponse(String except, RequestOptions requestOptions) { + return this.serviceClient.withExceptWithResponse(except, requestOptions); + } + + /** + * The withExec operation. + * + * @param exec The exec parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withExecWithResponse(String exec, RequestOptions requestOptions) { + return this.serviceClient.withExecWithResponse(exec, requestOptions); + } + + /** + * The withFinally operation. + * + * @param finallyParameter The finallyParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withFinallyWithResponse(String finallyParameter, RequestOptions requestOptions) { + return this.serviceClient.withFinallyWithResponse(finallyParameter, requestOptions); + } + + /** + * The withFor operation. + * + * @param forParameter The forParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withForWithResponse(String forParameter, RequestOptions requestOptions) { + return this.serviceClient.withForWithResponse(forParameter, requestOptions); + } + + /** + * The withFrom operation. + * + * @param from The from parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withFromWithResponse(String from, RequestOptions requestOptions) { + return this.serviceClient.withFromWithResponse(from, requestOptions); + } + + /** + * The withGlobal operation. + * + * @param global The global parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withGlobalWithResponse(String global, RequestOptions requestOptions) { + return this.serviceClient.withGlobalWithResponse(global, requestOptions); + } + + /** + * The withIf operation. + * + * @param ifParameter The ifParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withIfWithResponse(String ifParameter, RequestOptions requestOptions) { + return this.serviceClient.withIfWithResponse(ifParameter, requestOptions); + } + + /** + * The withImport operation. + * + * @param importParameter The importParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withImportWithResponse(String importParameter, RequestOptions requestOptions) { + return this.serviceClient.withImportWithResponse(importParameter, requestOptions); + } + + /** + * The withIn operation. + * + * @param in The in parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withInWithResponse(String in, RequestOptions requestOptions) { + return this.serviceClient.withInWithResponse(in, requestOptions); + } + + /** + * The withIs operation. + * + * @param is The is parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withIsWithResponse(String is, RequestOptions requestOptions) { + return this.serviceClient.withIsWithResponse(is, requestOptions); + } + + /** + * The withLambda operation. + * + * @param lambda The lambda parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withLambdaWithResponse(String lambda, RequestOptions requestOptions) { + return this.serviceClient.withLambdaWithResponse(lambda, requestOptions); + } + + /** + * The withNot operation. + * + * @param not The not parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withNotWithResponse(String not, RequestOptions requestOptions) { + return this.serviceClient.withNotWithResponse(not, requestOptions); + } + + /** + * The withOr operation. + * + * @param or The or parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withOrWithResponse(String or, RequestOptions requestOptions) { + return this.serviceClient.withOrWithResponse(or, requestOptions); + } + + /** + * The withPass operation. + * + * @param pass The pass parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withPassWithResponse(String pass, RequestOptions requestOptions) { + return this.serviceClient.withPassWithResponse(pass, requestOptions); + } + + /** + * The withRaise operation. + * + * @param raise The raise parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withRaiseWithResponse(String raise, RequestOptions requestOptions) { + return this.serviceClient.withRaiseWithResponse(raise, requestOptions); + } + + /** + * The withReturn operation. + * + * @param returnParameter The returnParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withReturnWithResponse(String returnParameter, RequestOptions requestOptions) { + return this.serviceClient.withReturnWithResponse(returnParameter, requestOptions); + } + + /** + * The withTry operation. + * + * @param tryParameter The tryParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withTryWithResponse(String tryParameter, RequestOptions requestOptions) { + return this.serviceClient.withTryWithResponse(tryParameter, requestOptions); + } + + /** + * The withWhile operation. + * + * @param whileParameter The whileParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withWhileWithResponse(String whileParameter, RequestOptions requestOptions) { + return this.serviceClient.withWhileWithResponse(whileParameter, requestOptions); + } + + /** + * The withWith operation. + * + * @param with The with parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withWithWithResponse(String with, RequestOptions requestOptions) { + return this.serviceClient.withWithWithResponse(with, requestOptions); + } + + /** + * The withYield operation. + * + * @param yield The yield parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withYieldWithResponse(String yield, RequestOptions requestOptions) { + return this.serviceClient.withYieldWithResponse(yield, requestOptions); + } + + /** + * The withCancellationToken operation. + * + * @param cancellationToken The cancellationToken parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withCancellationTokenWithResponse(String cancellationToken, RequestOptions requestOptions) { + return this.serviceClient.withCancellationTokenWithResponse(cancellationToken, requestOptions); + } + + /** + * The withAnd operation. + * + * @param and The and parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withAnd(String and) { + // Generated convenience method for withAndWithResponse + RequestOptions requestOptions = new RequestOptions(); + withAndWithResponse(and, requestOptions).getValue(); + } + + /** + * The withAs operation. + * + * @param as The as parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withAs(String as) { + // Generated convenience method for withAsWithResponse + RequestOptions requestOptions = new RequestOptions(); + withAsWithResponse(as, requestOptions).getValue(); + } + + /** + * The withAssert operation. + * + * @param assertParameter The assertParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withAssert(String assertParameter) { + // Generated convenience method for withAssertWithResponse + RequestOptions requestOptions = new RequestOptions(); + withAssertWithResponse(assertParameter, requestOptions).getValue(); + } + + /** + * The withAsync operation. + * + * @param async The async parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withAsync(String async) { + // Generated convenience method for withAsyncWithResponse + RequestOptions requestOptions = new RequestOptions(); + withAsyncWithResponse(async, requestOptions).getValue(); + } + + /** + * The withAwait operation. + * + * @param await The await parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withAwait(String await) { + // Generated convenience method for withAwaitWithResponse + RequestOptions requestOptions = new RequestOptions(); + withAwaitWithResponse(await, requestOptions).getValue(); + } + + /** + * The withBreak operation. + * + * @param breakParameter The breakParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withBreak(String breakParameter) { + // Generated convenience method for withBreakWithResponse + RequestOptions requestOptions = new RequestOptions(); + withBreakWithResponse(breakParameter, requestOptions).getValue(); + } + + /** + * The withClass operation. + * + * @param classParameter The classParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withClass(String classParameter) { + // Generated convenience method for withClassWithResponse + RequestOptions requestOptions = new RequestOptions(); + withClassWithResponse(classParameter, requestOptions).getValue(); + } + + /** + * The withConstructor operation. + * + * @param constructor The constructor parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withConstructor(String constructor) { + // Generated convenience method for withConstructorWithResponse + RequestOptions requestOptions = new RequestOptions(); + withConstructorWithResponse(constructor, requestOptions).getValue(); + } + + /** + * The withContinue operation. + * + * @param continueParameter The continueParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withContinue(String continueParameter) { + // Generated convenience method for withContinueWithResponse + RequestOptions requestOptions = new RequestOptions(); + withContinueWithResponse(continueParameter, requestOptions).getValue(); + } + + /** + * The withDef operation. + * + * @param def The def parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withDef(String def) { + // Generated convenience method for withDefWithResponse + RequestOptions requestOptions = new RequestOptions(); + withDefWithResponse(def, requestOptions).getValue(); + } + + /** + * The withDel operation. + * + * @param del The del parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withDel(String del) { + // Generated convenience method for withDelWithResponse + RequestOptions requestOptions = new RequestOptions(); + withDelWithResponse(del, requestOptions).getValue(); + } + + /** + * The withElif operation. + * + * @param elif The elif parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withElif(String elif) { + // Generated convenience method for withElifWithResponse + RequestOptions requestOptions = new RequestOptions(); + withElifWithResponse(elif, requestOptions).getValue(); + } + + /** + * The withElse operation. + * + * @param elseParameter The elseParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withElse(String elseParameter) { + // Generated convenience method for withElseWithResponse + RequestOptions requestOptions = new RequestOptions(); + withElseWithResponse(elseParameter, requestOptions).getValue(); + } + + /** + * The withExcept operation. + * + * @param except The except parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withExcept(String except) { + // Generated convenience method for withExceptWithResponse + RequestOptions requestOptions = new RequestOptions(); + withExceptWithResponse(except, requestOptions).getValue(); + } + + /** + * The withExec operation. + * + * @param exec The exec parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withExec(String exec) { + // Generated convenience method for withExecWithResponse + RequestOptions requestOptions = new RequestOptions(); + withExecWithResponse(exec, requestOptions).getValue(); + } + + /** + * The withFinally operation. + * + * @param finallyParameter The finallyParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withFinally(String finallyParameter) { + // Generated convenience method for withFinallyWithResponse + RequestOptions requestOptions = new RequestOptions(); + withFinallyWithResponse(finallyParameter, requestOptions).getValue(); + } + + /** + * The withFor operation. + * + * @param forParameter The forParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withFor(String forParameter) { + // Generated convenience method for withForWithResponse + RequestOptions requestOptions = new RequestOptions(); + withForWithResponse(forParameter, requestOptions).getValue(); + } + + /** + * The withFrom operation. + * + * @param from The from parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withFrom(String from) { + // Generated convenience method for withFromWithResponse + RequestOptions requestOptions = new RequestOptions(); + withFromWithResponse(from, requestOptions).getValue(); + } + + /** + * The withGlobal operation. + * + * @param global The global parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withGlobal(String global) { + // Generated convenience method for withGlobalWithResponse + RequestOptions requestOptions = new RequestOptions(); + withGlobalWithResponse(global, requestOptions).getValue(); + } + + /** + * The withIf operation. + * + * @param ifParameter The ifParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withIf(String ifParameter) { + // Generated convenience method for withIfWithResponse + RequestOptions requestOptions = new RequestOptions(); + withIfWithResponse(ifParameter, requestOptions).getValue(); + } + + /** + * The withImport operation. + * + * @param importParameter The importParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withImport(String importParameter) { + // Generated convenience method for withImportWithResponse + RequestOptions requestOptions = new RequestOptions(); + withImportWithResponse(importParameter, requestOptions).getValue(); + } + + /** + * The withIn operation. + * + * @param in The in parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withIn(String in) { + // Generated convenience method for withInWithResponse + RequestOptions requestOptions = new RequestOptions(); + withInWithResponse(in, requestOptions).getValue(); + } + + /** + * The withIs operation. + * + * @param is The is parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withIs(String is) { + // Generated convenience method for withIsWithResponse + RequestOptions requestOptions = new RequestOptions(); + withIsWithResponse(is, requestOptions).getValue(); + } + + /** + * The withLambda operation. + * + * @param lambda The lambda parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withLambda(String lambda) { + // Generated convenience method for withLambdaWithResponse + RequestOptions requestOptions = new RequestOptions(); + withLambdaWithResponse(lambda, requestOptions).getValue(); + } + + /** + * The withNot operation. + * + * @param not The not parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withNot(String not) { + // Generated convenience method for withNotWithResponse + RequestOptions requestOptions = new RequestOptions(); + withNotWithResponse(not, requestOptions).getValue(); + } + + /** + * The withOr operation. + * + * @param or The or parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withOr(String or) { + // Generated convenience method for withOrWithResponse + RequestOptions requestOptions = new RequestOptions(); + withOrWithResponse(or, requestOptions).getValue(); + } + + /** + * The withPass operation. + * + * @param pass The pass parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withPass(String pass) { + // Generated convenience method for withPassWithResponse + RequestOptions requestOptions = new RequestOptions(); + withPassWithResponse(pass, requestOptions).getValue(); + } + + /** + * The withRaise operation. + * + * @param raise The raise parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withRaise(String raise) { + // Generated convenience method for withRaiseWithResponse + RequestOptions requestOptions = new RequestOptions(); + withRaiseWithResponse(raise, requestOptions).getValue(); + } + + /** + * The withReturn operation. + * + * @param returnParameter The returnParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withReturn(String returnParameter) { + // Generated convenience method for withReturnWithResponse + RequestOptions requestOptions = new RequestOptions(); + withReturnWithResponse(returnParameter, requestOptions).getValue(); + } + + /** + * The withTry operation. + * + * @param tryParameter The tryParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withTry(String tryParameter) { + // Generated convenience method for withTryWithResponse + RequestOptions requestOptions = new RequestOptions(); + withTryWithResponse(tryParameter, requestOptions).getValue(); + } + + /** + * The withWhile operation. + * + * @param whileParameter The whileParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withWhile(String whileParameter) { + // Generated convenience method for withWhileWithResponse + RequestOptions requestOptions = new RequestOptions(); + withWhileWithResponse(whileParameter, requestOptions).getValue(); + } + + /** + * The withWith operation. + * + * @param with The with parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withWith(String with) { + // Generated convenience method for withWithWithResponse + RequestOptions requestOptions = new RequestOptions(); + withWithWithResponse(with, requestOptions).getValue(); + } + + /** + * The withYield operation. + * + * @param yield The yield parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withYield(String yield) { + // Generated convenience method for withYieldWithResponse + RequestOptions requestOptions = new RequestOptions(); + withYieldWithResponse(yield, requestOptions).getValue(); + } + + /** + * The withCancellationToken operation. + * + * @param cancellationToken The cancellationToken parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void withCancellationToken(String cancellationToken) { + // Generated convenience method for withCancellationTokenWithResponse + RequestOptions requestOptions = new RequestOptions(); + withCancellationTokenWithResponse(cancellationToken, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/SpecialWordsClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/SpecialWordsClientBuilder.java new file mode 100644 index 00000000000..ea87d109d89 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/SpecialWordsClientBuilder.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import specialwords.implementation.SpecialWordsClientImpl; + +/** + * A builder for creating a new instance of the SpecialWordsClient type. + */ +@ServiceClientBuilder( + serviceClients = { + ModelsClient.class, + ModelPropertiesClient.class, + OperationsClient.class, + ParametersClient.class, + ModelsAsyncClient.class, + ModelPropertiesAsyncClient.class, + OperationsAsyncClient.class, + ParametersAsyncClient.class }) +public final class SpecialWordsClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("specialwords.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the SpecialWordsClientBuilder. + */ + @Generated + public SpecialWordsClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialWordsClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialWordsClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialWordsClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialWordsClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialWordsClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialWordsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialWordsClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialWordsClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the SpecialWordsClientBuilder. + */ + @Generated + public SpecialWordsClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of SpecialWordsClientImpl with the provided parameters. + * + * @return an instance of SpecialWordsClientImpl. + */ + @Generated + private SpecialWordsClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + SpecialWordsClientImpl client + = new SpecialWordsClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ModelsAsyncClient class. + * + * @return an instance of ModelsAsyncClient. + */ + @Generated + public ModelsAsyncClient buildModelsAsyncClient() { + return new ModelsAsyncClient(buildInnerClient().getModels()); + } + + /** + * Builds an instance of ModelPropertiesAsyncClient class. + * + * @return an instance of ModelPropertiesAsyncClient. + */ + @Generated + public ModelPropertiesAsyncClient buildModelPropertiesAsyncClient() { + return new ModelPropertiesAsyncClient(buildInnerClient().getModelProperties()); + } + + /** + * Builds an instance of OperationsAsyncClient class. + * + * @return an instance of OperationsAsyncClient. + */ + @Generated + public OperationsAsyncClient buildOperationsAsyncClient() { + return new OperationsAsyncClient(buildInnerClient().getOperations()); + } + + /** + * Builds an instance of ParametersAsyncClient class. + * + * @return an instance of ParametersAsyncClient. + */ + @Generated + public ParametersAsyncClient buildParametersAsyncClient() { + return new ParametersAsyncClient(buildInnerClient().getParameters()); + } + + /** + * Builds an instance of ModelsClient class. + * + * @return an instance of ModelsClient. + */ + @Generated + public ModelsClient buildModelsClient() { + return new ModelsClient(buildInnerClient().getModels()); + } + + /** + * Builds an instance of ModelPropertiesClient class. + * + * @return an instance of ModelPropertiesClient. + */ + @Generated + public ModelPropertiesClient buildModelPropertiesClient() { + return new ModelPropertiesClient(buildInnerClient().getModelProperties()); + } + + /** + * Builds an instance of OperationsClient class. + * + * @return an instance of OperationsClient. + */ + @Generated + public OperationsClient buildOperationsClient() { + return new OperationsClient(buildInnerClient().getOperations()); + } + + /** + * Builds an instance of ParametersClient class. + * + * @return an instance of ParametersClient. + */ + @Generated + public ParametersClient buildParametersClient() { + return new ParametersClient(buildInnerClient().getParameters()); + } + + private static final ClientLogger LOGGER = new ClientLogger(SpecialWordsClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelPropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelPropertiesImpl.java new file mode 100644 index 00000000000..f8d2e28261c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelPropertiesImpl.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ModelProperties. + */ +public final class ModelPropertiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ModelPropertiesService service; + + /** + * The service client containing this operation class. + */ + private final SpecialWordsClientImpl client; + + /** + * Initializes an instance of ModelPropertiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ModelPropertiesImpl(SpecialWordsClientImpl client) { + this.service + = RestProxy.create(ModelPropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SpecialWordsClientModelProperties to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SpecialWordsClientModelProperties") + public interface ModelPropertiesService { + @Post("/special-words/model-properties/same-as-model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> sameAsModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/model-properties/same-as-model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sameAsModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/model-properties/dict-methods") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> dictMethods(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/model-properties/dict-methods") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response dictMethodsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The sameAsModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     SameAsModel: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sameAsModelWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.sameAsModel(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The sameAsModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     SameAsModel: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sameAsModelWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sameAsModelSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The dictMethods operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     keys: String (Required)
+     *     items: String (Required)
+     *     values: String (Required)
+     *     popitem: String (Required)
+     *     clear: String (Required)
+     *     update: String (Required)
+     *     setdefault: String (Required)
+     *     pop: String (Required)
+     *     get: String (Required)
+     *     copy: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> dictMethodsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.dictMethods(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The dictMethods operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     keys: String (Required)
+     *     items: String (Required)
+     *     values: String (Required)
+     *     popitem: String (Required)
+     *     clear: String (Required)
+     *     update: String (Required)
+     *     setdefault: String (Required)
+     *     pop: String (Required)
+     *     get: String (Required)
+     *     copy: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response dictMethodsWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.dictMethodsSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelsImpl.java new file mode 100644 index 00000000000..2061d477dbf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ModelsImpl.java @@ -0,0 +1,2469 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Models. + */ +public final class ModelsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ModelsService service; + + /** + * The service client containing this operation class. + */ + private final SpecialWordsClientImpl client; + + /** + * Initializes an instance of ModelsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ModelsImpl(SpecialWordsClientImpl client) { + this.service = RestProxy.create(ModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SpecialWordsClientModels to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SpecialWordsClientModels") + public interface ModelsService { + @Post("/special-words/models/and") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withAnd(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/and") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withAndSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/as") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withAs(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/as") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withAsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/assert") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withAssert(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/assert") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withAssertSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/async") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withAsync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/async") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withAsyncSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/await") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withAwait(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/await") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withAwaitSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/break") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withBreak(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/break") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withBreakSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/class") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withClass(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/class") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withClassSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/constructor") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withConstructor(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/constructor") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withConstructorSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/continue") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withContinue(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/continue") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withContinueSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/def") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withDef(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/def") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withDefSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/del") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withDel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/del") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withDelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/elif") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withElif(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/elif") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withElifSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/else") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withElse(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/else") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withElseSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/except") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withExcept(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/except") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withExceptSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/exec") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withExec(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/exec") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withExecSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/finally") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withFinally(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/finally") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withFinallySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/for") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withFor(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/for") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withForSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/from") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withFrom(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/from") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withFromSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/global") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withGlobal(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/global") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withGlobalSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/if") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withIf(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/if") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withIfSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/import") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withImport(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/import") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withImportSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/in") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withIn(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/in") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withInSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/is") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withIs(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/is") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withIsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/lambda") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withLambda(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/lambda") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withLambdaSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/not") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withNot(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/not") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withNotSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/or") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withOr(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/or") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withOrSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/pass") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withPass(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/pass") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withPassSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/raise") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withRaise(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/raise") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withRaiseSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/return") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withReturn(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/return") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withReturnSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/try") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withTry(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/try") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withTrySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/while") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withWhile(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/while") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withWhileSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/with") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withWith(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/with") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withWithSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/yield") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withYield(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/special-words/models/yield") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withYieldSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The withAnd operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAndWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withAnd(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withAnd operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAndWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withAndSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withAs operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withAs(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withAs operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAsWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withAsSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withAssert operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAssertWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withAssert(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withAssert operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAssertWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withAssertSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withAsync operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAsyncWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withAsync(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withAsync operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAsyncWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withAsyncSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withAwait operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAwaitWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withAwait(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withAwait operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAwaitWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withAwaitSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withBreak operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withBreakWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withBreak(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withBreak operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withBreakWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withBreakSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withClass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withClassWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withClass(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withClass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withClassWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withClassSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withConstructor operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withConstructorWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withConstructor(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withConstructor operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withConstructorWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withConstructorSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withContinue operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withContinueWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withContinue(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withContinue operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withContinueWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withContinueSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withDef operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withDefWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withDef(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withDef operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withDefWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withDefSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withDel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withDelWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withDel(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withDel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withDelWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withDelSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withElif operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withElifWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withElif(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withElif operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withElifWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withElifSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withElse operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withElseWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withElse(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withElse operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withElseWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withElseSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withExcept operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withExceptWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withExcept(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withExcept operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withExceptWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withExceptSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withExec operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withExecWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withExec(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withExec operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withExecWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withExecSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withFinally operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withFinallyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withFinally(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withFinally operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withFinallyWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withFinallySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withFor operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withForWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withFor(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withFor operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withForWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withForSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withFrom operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withFromWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withFrom(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withFrom operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withFromWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withFromSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withGlobal operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withGlobalWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withGlobal(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withGlobal operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withGlobalWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withGlobalSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withIf operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withIfWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withIf(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withIf operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withIfWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withIfSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withImport operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withImportWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withImport(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withImport operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withImportWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withImportSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withIn operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withInWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withIn(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withIn operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withInWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withInSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withIs operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withIsWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withIs(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withIs operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withIsWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withIsSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withLambda operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withLambdaWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withLambda(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withLambda operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withLambdaWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withLambdaSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withNot operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withNotWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withNot(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withNot operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withNotWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withNotSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withOr operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withOrWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withOr(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withOr operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withOrWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withOrSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withPass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withPassWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withPass(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withPass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withPassWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withPassSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withRaise operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withRaiseWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withRaise(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withRaise operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withRaiseWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withRaiseSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withReturn operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withReturnWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withReturn(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withReturn operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withReturnWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withReturnSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withTry operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withTryWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withTry(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withTry operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withTryWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withTrySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withWhile operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withWhileWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withWhile(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withWhile operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withWhileWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withWhileSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withWith operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withWithWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withWith(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withWith operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withWithWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withWithSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The withYield operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withYieldWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.withYield(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The withYield operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withYieldWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.withYieldSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/OperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/OperationsImpl.java new file mode 100644 index 00000000000..4464f1967ef --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/OperationsImpl.java @@ -0,0 +1,1630 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Operations. + */ +public final class OperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final SpecialWordsClientImpl client; + + /** + * Initializes an instance of OperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsImpl(SpecialWordsClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SpecialWordsClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SpecialWordsClientOperations") + public interface OperationsService { + @Get("/special-words/operations/and") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> and(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/and") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response andSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/as") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> as(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/as") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response asSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/assert") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> assertMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/assert") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response assertMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/async") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> async(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/async") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response asyncSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/await") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> await(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/await") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response awaitSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/break") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> breakMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/break") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response breakMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/class") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> classMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/class") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response classMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/constructor") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> constructor(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/constructor") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response constructorSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/continue") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> continueMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/continue") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response continueMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/def") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> def(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/def") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response defSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/del") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> del(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/del") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response delSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/elif") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> elif(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/elif") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response elifSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/else") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> elseMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/else") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response elseMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/except") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> except(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/except") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response exceptSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/exec") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> exec(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/exec") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response execSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/finally") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> finallyMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/finally") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response finallyMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/for") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> forMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/for") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response forMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/from") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> from(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/from") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response fromSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/global") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> global(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/global") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response globalSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/if") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> ifMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/if") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response ifMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/import") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> importMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/import") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response importMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/in") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> in(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/in") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response inSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/is") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> is(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/is") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response isSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/lambda") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> lambda(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/lambda") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response lambdaSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/not") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> not(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/not") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response notSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/or") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> or(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/or") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response orSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/pass") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> pass(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/pass") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response passSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/raise") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> raise(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/raise") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response raiseSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/return") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> returnMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/return") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response returnMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/try") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> tryMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/try") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response tryMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/while") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> whileMethod(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/while") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response whileMethodSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/with") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> with(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/with") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Get("/special-words/operations/yield") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> yield(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/special-words/operations/yield") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response yieldSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + } + + /** + * The and operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> andWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.and(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The and operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response andWithResponse(RequestOptions requestOptions) { + return service.andSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The as operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> asWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.as(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The as operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response asWithResponse(RequestOptions requestOptions) { + return service.asSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The assertMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> assertMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.assertMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The assertMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response assertMethodWithResponse(RequestOptions requestOptions) { + return service.assertMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The async operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> asyncWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.async(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The async operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response asyncWithResponse(RequestOptions requestOptions) { + return service.asyncSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The await operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> awaitWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.await(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The await operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response awaitWithResponse(RequestOptions requestOptions) { + return service.awaitSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The breakMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> breakMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.breakMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The breakMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response breakMethodWithResponse(RequestOptions requestOptions) { + return service.breakMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The classMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> classMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.classMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The classMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response classMethodWithResponse(RequestOptions requestOptions) { + return service.classMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The constructor operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> constructorWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.constructor(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The constructor operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response constructorWithResponse(RequestOptions requestOptions) { + return service.constructorSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The continueMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> continueMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.continueMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The continueMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response continueMethodWithResponse(RequestOptions requestOptions) { + return service.continueMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The def operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> defWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.def(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The def operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response defWithResponse(RequestOptions requestOptions) { + return service.defSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The del operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> delWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.del(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The del operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response delWithResponse(RequestOptions requestOptions) { + return service.delSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The elif operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> elifWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.elif(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The elif operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response elifWithResponse(RequestOptions requestOptions) { + return service.elifSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The elseMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> elseMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.elseMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The elseMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response elseMethodWithResponse(RequestOptions requestOptions) { + return service.elseMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The except operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> exceptWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.except(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The except operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exceptWithResponse(RequestOptions requestOptions) { + return service.exceptSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The exec operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> execWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.exec(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The exec operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response execWithResponse(RequestOptions requestOptions) { + return service.execSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The finallyMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> finallyMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.finallyMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The finallyMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response finallyMethodWithResponse(RequestOptions requestOptions) { + return service.finallyMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The forMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> forMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.forMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The forMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response forMethodWithResponse(RequestOptions requestOptions) { + return service.forMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The from operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> fromWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.from(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The from operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fromWithResponse(RequestOptions requestOptions) { + return service.fromSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The global operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> globalWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.global(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The global operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response globalWithResponse(RequestOptions requestOptions) { + return service.globalSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The ifMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> ifMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.ifMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The ifMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response ifMethodWithResponse(RequestOptions requestOptions) { + return service.ifMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The importMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> importMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.importMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The importMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response importMethodWithResponse(RequestOptions requestOptions) { + return service.importMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The in operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> inWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.in(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The in operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response inWithResponse(RequestOptions requestOptions) { + return service.inSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The is operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> isWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.is(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The is operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response isWithResponse(RequestOptions requestOptions) { + return service.isSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The lambda operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> lambdaWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.lambda(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The lambda operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response lambdaWithResponse(RequestOptions requestOptions) { + return service.lambdaSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The not operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> notWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.not(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The not operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response notWithResponse(RequestOptions requestOptions) { + return service.notSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The or operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> orWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.or(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The or operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response orWithResponse(RequestOptions requestOptions) { + return service.orSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The pass operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> passWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.pass(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The pass operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response passWithResponse(RequestOptions requestOptions) { + return service.passSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The raise operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> raiseWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.raise(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The raise operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response raiseWithResponse(RequestOptions requestOptions) { + return service.raiseSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The returnMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> returnMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.returnMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The returnMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response returnMethodWithResponse(RequestOptions requestOptions) { + return service.returnMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The tryMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> tryMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.tryMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The tryMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response tryMethodWithResponse(RequestOptions requestOptions) { + return service.tryMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The whileMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> whileMethodWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.whileMethod(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The whileMethod operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response whileMethodWithResponse(RequestOptions requestOptions) { + return service.whileMethodSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The with operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.with(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The with operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withWithResponse(RequestOptions requestOptions) { + return service.withSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The yield operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> yieldWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.yield(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The yield operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response yieldWithResponse(RequestOptions requestOptions) { + return service.yieldSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ParametersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ParametersImpl.java new file mode 100644 index 00000000000..c4ed6e67ddc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/ParametersImpl.java @@ -0,0 +1,1791 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Parameters. + */ +public final class ParametersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ParametersService service; + + /** + * The service client containing this operation class. + */ + private final SpecialWordsClientImpl client; + + /** + * Initializes an instance of ParametersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ParametersImpl(SpecialWordsClientImpl client) { + this.service + = RestProxy.create(ParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SpecialWordsClientParameters to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SpecialWordsClientParameters") + public interface ParametersService { + @Get("/special-words/parameters/and") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withAnd(@HostParam("endpoint") String endpoint, @QueryParam("and") String and, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/and") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withAndSync(@HostParam("endpoint") String endpoint, @QueryParam("and") String and, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/as") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withAs(@HostParam("endpoint") String endpoint, @QueryParam("as") String as, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/as") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withAsSync(@HostParam("endpoint") String endpoint, @QueryParam("as") String as, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/assert") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withAssert(@HostParam("endpoint") String endpoint, + @QueryParam("assert") String assertParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/assert") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withAssertSync(@HostParam("endpoint") String endpoint, + @QueryParam("assert") String assertParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/async") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withAsync(@HostParam("endpoint") String endpoint, @QueryParam("async") String async, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/async") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withAsyncSync(@HostParam("endpoint") String endpoint, @QueryParam("async") String async, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/await") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withAwait(@HostParam("endpoint") String endpoint, @QueryParam("await") String await, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/await") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withAwaitSync(@HostParam("endpoint") String endpoint, @QueryParam("await") String await, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/break") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withBreak(@HostParam("endpoint") String endpoint, + @QueryParam("break") String breakParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/break") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withBreakSync(@HostParam("endpoint") String endpoint, @QueryParam("break") String breakParameter, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/class") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withClass(@HostParam("endpoint") String endpoint, + @QueryParam("class") String classParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/class") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withClassSync(@HostParam("endpoint") String endpoint, @QueryParam("class") String classParameter, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/constructor") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withConstructor(@HostParam("endpoint") String endpoint, + @QueryParam("constructor") String constructor, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/constructor") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withConstructorSync(@HostParam("endpoint") String endpoint, + @QueryParam("constructor") String constructor, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/continue") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withContinue(@HostParam("endpoint") String endpoint, + @QueryParam("continue") String continueParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/continue") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withContinueSync(@HostParam("endpoint") String endpoint, + @QueryParam("continue") String continueParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/def") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withDef(@HostParam("endpoint") String endpoint, @QueryParam("def") String def, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/def") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withDefSync(@HostParam("endpoint") String endpoint, @QueryParam("def") String def, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/del") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withDel(@HostParam("endpoint") String endpoint, @QueryParam("del") String del, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/del") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withDelSync(@HostParam("endpoint") String endpoint, @QueryParam("del") String del, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/elif") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withElif(@HostParam("endpoint") String endpoint, @QueryParam("elif") String elif, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/elif") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withElifSync(@HostParam("endpoint") String endpoint, @QueryParam("elif") String elif, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/else") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withElse(@HostParam("endpoint") String endpoint, @QueryParam("else") String elseParameter, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/else") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withElseSync(@HostParam("endpoint") String endpoint, @QueryParam("else") String elseParameter, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/except") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withExcept(@HostParam("endpoint") String endpoint, @QueryParam("except") String except, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/except") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withExceptSync(@HostParam("endpoint") String endpoint, @QueryParam("except") String except, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/exec") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withExec(@HostParam("endpoint") String endpoint, @QueryParam("exec") String exec, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/exec") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withExecSync(@HostParam("endpoint") String endpoint, @QueryParam("exec") String exec, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/finally") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withFinally(@HostParam("endpoint") String endpoint, + @QueryParam("finally") String finallyParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/finally") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withFinallySync(@HostParam("endpoint") String endpoint, + @QueryParam("finally") String finallyParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/for") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withFor(@HostParam("endpoint") String endpoint, @QueryParam("for") String forParameter, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/for") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withForSync(@HostParam("endpoint") String endpoint, @QueryParam("for") String forParameter, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/from") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withFrom(@HostParam("endpoint") String endpoint, @QueryParam("from") String from, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/from") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withFromSync(@HostParam("endpoint") String endpoint, @QueryParam("from") String from, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/global") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withGlobal(@HostParam("endpoint") String endpoint, @QueryParam("global") String global, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/global") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withGlobalSync(@HostParam("endpoint") String endpoint, @QueryParam("global") String global, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/if") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withIf(@HostParam("endpoint") String endpoint, @QueryParam("if") String ifParameter, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/if") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withIfSync(@HostParam("endpoint") String endpoint, @QueryParam("if") String ifParameter, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/import") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withImport(@HostParam("endpoint") String endpoint, + @QueryParam("import") String importParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/import") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withImportSync(@HostParam("endpoint") String endpoint, + @QueryParam("import") String importParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/in") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withIn(@HostParam("endpoint") String endpoint, @QueryParam("in") String in, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/in") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withInSync(@HostParam("endpoint") String endpoint, @QueryParam("in") String in, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/is") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withIs(@HostParam("endpoint") String endpoint, @QueryParam("is") String is, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/is") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withIsSync(@HostParam("endpoint") String endpoint, @QueryParam("is") String is, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/lambda") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withLambda(@HostParam("endpoint") String endpoint, @QueryParam("lambda") String lambda, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/lambda") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withLambdaSync(@HostParam("endpoint") String endpoint, @QueryParam("lambda") String lambda, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/not") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withNot(@HostParam("endpoint") String endpoint, @QueryParam("not") String not, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/not") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withNotSync(@HostParam("endpoint") String endpoint, @QueryParam("not") String not, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/or") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withOr(@HostParam("endpoint") String endpoint, @QueryParam("or") String or, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/or") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withOrSync(@HostParam("endpoint") String endpoint, @QueryParam("or") String or, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/pass") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withPass(@HostParam("endpoint") String endpoint, @QueryParam("pass") String pass, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/pass") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withPassSync(@HostParam("endpoint") String endpoint, @QueryParam("pass") String pass, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/raise") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withRaise(@HostParam("endpoint") String endpoint, @QueryParam("raise") String raise, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/raise") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withRaiseSync(@HostParam("endpoint") String endpoint, @QueryParam("raise") String raise, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/return") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withReturn(@HostParam("endpoint") String endpoint, + @QueryParam("return") String returnParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/return") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withReturnSync(@HostParam("endpoint") String endpoint, + @QueryParam("return") String returnParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/try") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withTry(@HostParam("endpoint") String endpoint, @QueryParam("try") String tryParameter, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/try") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withTrySync(@HostParam("endpoint") String endpoint, @QueryParam("try") String tryParameter, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/while") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withWhile(@HostParam("endpoint") String endpoint, + @QueryParam("while") String whileParameter, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/while") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withWhileSync(@HostParam("endpoint") String endpoint, @QueryParam("while") String whileParameter, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/with") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withWith(@HostParam("endpoint") String endpoint, @QueryParam("with") String with, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/with") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withWithSync(@HostParam("endpoint") String endpoint, @QueryParam("with") String with, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/yield") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withYield(@HostParam("endpoint") String endpoint, @QueryParam("yield") String yield, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/yield") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withYieldSync(@HostParam("endpoint") String endpoint, @QueryParam("yield") String yield, + RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/cancellationToken") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> withCancellationToken(@HostParam("endpoint") String endpoint, + @QueryParam("cancellationToken") String cancellationToken, RequestOptions requestOptions, Context context); + + @Get("/special-words/parameters/cancellationToken") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response withCancellationTokenSync(@HostParam("endpoint") String endpoint, + @QueryParam("cancellationToken") String cancellationToken, RequestOptions requestOptions, Context context); + } + + /** + * The withAnd operation. + * + * @param and The and parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAndWithResponseAsync(String and, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withAnd(this.client.getEndpoint(), and, requestOptions, context)); + } + + /** + * The withAnd operation. + * + * @param and The and parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAndWithResponse(String and, RequestOptions requestOptions) { + return service.withAndSync(this.client.getEndpoint(), and, requestOptions, Context.NONE); + } + + /** + * The withAs operation. + * + * @param as The as parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAsWithResponseAsync(String as, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.withAs(this.client.getEndpoint(), as, requestOptions, context)); + } + + /** + * The withAs operation. + * + * @param as The as parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAsWithResponse(String as, RequestOptions requestOptions) { + return service.withAsSync(this.client.getEndpoint(), as, requestOptions, Context.NONE); + } + + /** + * The withAssert operation. + * + * @param assertParameter The assertParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAssertWithResponseAsync(String assertParameter, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withAssert(this.client.getEndpoint(), assertParameter, requestOptions, context)); + } + + /** + * The withAssert operation. + * + * @param assertParameter The assertParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAssertWithResponse(String assertParameter, RequestOptions requestOptions) { + return service.withAssertSync(this.client.getEndpoint(), assertParameter, requestOptions, Context.NONE); + } + + /** + * The withAsync operation. + * + * @param async The async parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAsyncWithResponseAsync(String async, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withAsync(this.client.getEndpoint(), async, requestOptions, context)); + } + + /** + * The withAsync operation. + * + * @param async The async parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAsyncWithResponse(String async, RequestOptions requestOptions) { + return service.withAsyncSync(this.client.getEndpoint(), async, requestOptions, Context.NONE); + } + + /** + * The withAwait operation. + * + * @param await The await parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withAwaitWithResponseAsync(String await, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withAwait(this.client.getEndpoint(), await, requestOptions, context)); + } + + /** + * The withAwait operation. + * + * @param await The await parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withAwaitWithResponse(String await, RequestOptions requestOptions) { + return service.withAwaitSync(this.client.getEndpoint(), await, requestOptions, Context.NONE); + } + + /** + * The withBreak operation. + * + * @param breakParameter The breakParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withBreakWithResponseAsync(String breakParameter, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withBreak(this.client.getEndpoint(), breakParameter, requestOptions, context)); + } + + /** + * The withBreak operation. + * + * @param breakParameter The breakParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withBreakWithResponse(String breakParameter, RequestOptions requestOptions) { + return service.withBreakSync(this.client.getEndpoint(), breakParameter, requestOptions, Context.NONE); + } + + /** + * The withClass operation. + * + * @param classParameter The classParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withClassWithResponseAsync(String classParameter, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withClass(this.client.getEndpoint(), classParameter, requestOptions, context)); + } + + /** + * The withClass operation. + * + * @param classParameter The classParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withClassWithResponse(String classParameter, RequestOptions requestOptions) { + return service.withClassSync(this.client.getEndpoint(), classParameter, requestOptions, Context.NONE); + } + + /** + * The withConstructor operation. + * + * @param constructor The constructor parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withConstructorWithResponseAsync(String constructor, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withConstructor(this.client.getEndpoint(), constructor, requestOptions, context)); + } + + /** + * The withConstructor operation. + * + * @param constructor The constructor parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withConstructorWithResponse(String constructor, RequestOptions requestOptions) { + return service.withConstructorSync(this.client.getEndpoint(), constructor, requestOptions, Context.NONE); + } + + /** + * The withContinue operation. + * + * @param continueParameter The continueParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withContinueWithResponseAsync(String continueParameter, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withContinue(this.client.getEndpoint(), continueParameter, requestOptions, context)); + } + + /** + * The withContinue operation. + * + * @param continueParameter The continueParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withContinueWithResponse(String continueParameter, RequestOptions requestOptions) { + return service.withContinueSync(this.client.getEndpoint(), continueParameter, requestOptions, Context.NONE); + } + + /** + * The withDef operation. + * + * @param def The def parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withDefWithResponseAsync(String def, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withDef(this.client.getEndpoint(), def, requestOptions, context)); + } + + /** + * The withDef operation. + * + * @param def The def parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withDefWithResponse(String def, RequestOptions requestOptions) { + return service.withDefSync(this.client.getEndpoint(), def, requestOptions, Context.NONE); + } + + /** + * The withDel operation. + * + * @param del The del parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withDelWithResponseAsync(String del, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withDel(this.client.getEndpoint(), del, requestOptions, context)); + } + + /** + * The withDel operation. + * + * @param del The del parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withDelWithResponse(String del, RequestOptions requestOptions) { + return service.withDelSync(this.client.getEndpoint(), del, requestOptions, Context.NONE); + } + + /** + * The withElif operation. + * + * @param elif The elif parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withElifWithResponseAsync(String elif, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withElif(this.client.getEndpoint(), elif, requestOptions, context)); + } + + /** + * The withElif operation. + * + * @param elif The elif parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withElifWithResponse(String elif, RequestOptions requestOptions) { + return service.withElifSync(this.client.getEndpoint(), elif, requestOptions, Context.NONE); + } + + /** + * The withElse operation. + * + * @param elseParameter The elseParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withElseWithResponseAsync(String elseParameter, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withElse(this.client.getEndpoint(), elseParameter, requestOptions, context)); + } + + /** + * The withElse operation. + * + * @param elseParameter The elseParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withElseWithResponse(String elseParameter, RequestOptions requestOptions) { + return service.withElseSync(this.client.getEndpoint(), elseParameter, requestOptions, Context.NONE); + } + + /** + * The withExcept operation. + * + * @param except The except parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withExceptWithResponseAsync(String except, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withExcept(this.client.getEndpoint(), except, requestOptions, context)); + } + + /** + * The withExcept operation. + * + * @param except The except parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withExceptWithResponse(String except, RequestOptions requestOptions) { + return service.withExceptSync(this.client.getEndpoint(), except, requestOptions, Context.NONE); + } + + /** + * The withExec operation. + * + * @param exec The exec parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withExecWithResponseAsync(String exec, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withExec(this.client.getEndpoint(), exec, requestOptions, context)); + } + + /** + * The withExec operation. + * + * @param exec The exec parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withExecWithResponse(String exec, RequestOptions requestOptions) { + return service.withExecSync(this.client.getEndpoint(), exec, requestOptions, Context.NONE); + } + + /** + * The withFinally operation. + * + * @param finallyParameter The finallyParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withFinallyWithResponseAsync(String finallyParameter, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withFinally(this.client.getEndpoint(), finallyParameter, requestOptions, context)); + } + + /** + * The withFinally operation. + * + * @param finallyParameter The finallyParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withFinallyWithResponse(String finallyParameter, RequestOptions requestOptions) { + return service.withFinallySync(this.client.getEndpoint(), finallyParameter, requestOptions, Context.NONE); + } + + /** + * The withFor operation. + * + * @param forParameter The forParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withForWithResponseAsync(String forParameter, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withFor(this.client.getEndpoint(), forParameter, requestOptions, context)); + } + + /** + * The withFor operation. + * + * @param forParameter The forParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withForWithResponse(String forParameter, RequestOptions requestOptions) { + return service.withForSync(this.client.getEndpoint(), forParameter, requestOptions, Context.NONE); + } + + /** + * The withFrom operation. + * + * @param from The from parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withFromWithResponseAsync(String from, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withFrom(this.client.getEndpoint(), from, requestOptions, context)); + } + + /** + * The withFrom operation. + * + * @param from The from parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withFromWithResponse(String from, RequestOptions requestOptions) { + return service.withFromSync(this.client.getEndpoint(), from, requestOptions, Context.NONE); + } + + /** + * The withGlobal operation. + * + * @param global The global parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withGlobalWithResponseAsync(String global, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withGlobal(this.client.getEndpoint(), global, requestOptions, context)); + } + + /** + * The withGlobal operation. + * + * @param global The global parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withGlobalWithResponse(String global, RequestOptions requestOptions) { + return service.withGlobalSync(this.client.getEndpoint(), global, requestOptions, Context.NONE); + } + + /** + * The withIf operation. + * + * @param ifParameter The ifParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withIfWithResponseAsync(String ifParameter, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withIf(this.client.getEndpoint(), ifParameter, requestOptions, context)); + } + + /** + * The withIf operation. + * + * @param ifParameter The ifParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withIfWithResponse(String ifParameter, RequestOptions requestOptions) { + return service.withIfSync(this.client.getEndpoint(), ifParameter, requestOptions, Context.NONE); + } + + /** + * The withImport operation. + * + * @param importParameter The importParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withImportWithResponseAsync(String importParameter, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withImport(this.client.getEndpoint(), importParameter, requestOptions, context)); + } + + /** + * The withImport operation. + * + * @param importParameter The importParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withImportWithResponse(String importParameter, RequestOptions requestOptions) { + return service.withImportSync(this.client.getEndpoint(), importParameter, requestOptions, Context.NONE); + } + + /** + * The withIn operation. + * + * @param in The in parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withInWithResponseAsync(String in, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.withIn(this.client.getEndpoint(), in, requestOptions, context)); + } + + /** + * The withIn operation. + * + * @param in The in parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withInWithResponse(String in, RequestOptions requestOptions) { + return service.withInSync(this.client.getEndpoint(), in, requestOptions, Context.NONE); + } + + /** + * The withIs operation. + * + * @param is The is parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withIsWithResponseAsync(String is, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.withIs(this.client.getEndpoint(), is, requestOptions, context)); + } + + /** + * The withIs operation. + * + * @param is The is parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withIsWithResponse(String is, RequestOptions requestOptions) { + return service.withIsSync(this.client.getEndpoint(), is, requestOptions, Context.NONE); + } + + /** + * The withLambda operation. + * + * @param lambda The lambda parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withLambdaWithResponseAsync(String lambda, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withLambda(this.client.getEndpoint(), lambda, requestOptions, context)); + } + + /** + * The withLambda operation. + * + * @param lambda The lambda parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withLambdaWithResponse(String lambda, RequestOptions requestOptions) { + return service.withLambdaSync(this.client.getEndpoint(), lambda, requestOptions, Context.NONE); + } + + /** + * The withNot operation. + * + * @param not The not parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withNotWithResponseAsync(String not, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withNot(this.client.getEndpoint(), not, requestOptions, context)); + } + + /** + * The withNot operation. + * + * @param not The not parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withNotWithResponse(String not, RequestOptions requestOptions) { + return service.withNotSync(this.client.getEndpoint(), not, requestOptions, Context.NONE); + } + + /** + * The withOr operation. + * + * @param or The or parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withOrWithResponseAsync(String or, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.withOr(this.client.getEndpoint(), or, requestOptions, context)); + } + + /** + * The withOr operation. + * + * @param or The or parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withOrWithResponse(String or, RequestOptions requestOptions) { + return service.withOrSync(this.client.getEndpoint(), or, requestOptions, Context.NONE); + } + + /** + * The withPass operation. + * + * @param pass The pass parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withPassWithResponseAsync(String pass, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withPass(this.client.getEndpoint(), pass, requestOptions, context)); + } + + /** + * The withPass operation. + * + * @param pass The pass parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withPassWithResponse(String pass, RequestOptions requestOptions) { + return service.withPassSync(this.client.getEndpoint(), pass, requestOptions, Context.NONE); + } + + /** + * The withRaise operation. + * + * @param raise The raise parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withRaiseWithResponseAsync(String raise, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withRaise(this.client.getEndpoint(), raise, requestOptions, context)); + } + + /** + * The withRaise operation. + * + * @param raise The raise parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withRaiseWithResponse(String raise, RequestOptions requestOptions) { + return service.withRaiseSync(this.client.getEndpoint(), raise, requestOptions, Context.NONE); + } + + /** + * The withReturn operation. + * + * @param returnParameter The returnParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withReturnWithResponseAsync(String returnParameter, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withReturn(this.client.getEndpoint(), returnParameter, requestOptions, context)); + } + + /** + * The withReturn operation. + * + * @param returnParameter The returnParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withReturnWithResponse(String returnParameter, RequestOptions requestOptions) { + return service.withReturnSync(this.client.getEndpoint(), returnParameter, requestOptions, Context.NONE); + } + + /** + * The withTry operation. + * + * @param tryParameter The tryParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withTryWithResponseAsync(String tryParameter, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withTry(this.client.getEndpoint(), tryParameter, requestOptions, context)); + } + + /** + * The withTry operation. + * + * @param tryParameter The tryParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withTryWithResponse(String tryParameter, RequestOptions requestOptions) { + return service.withTrySync(this.client.getEndpoint(), tryParameter, requestOptions, Context.NONE); + } + + /** + * The withWhile operation. + * + * @param whileParameter The whileParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withWhileWithResponseAsync(String whileParameter, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.withWhile(this.client.getEndpoint(), whileParameter, requestOptions, context)); + } + + /** + * The withWhile operation. + * + * @param whileParameter The whileParameter parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withWhileWithResponse(String whileParameter, RequestOptions requestOptions) { + return service.withWhileSync(this.client.getEndpoint(), whileParameter, requestOptions, Context.NONE); + } + + /** + * The withWith operation. + * + * @param with The with parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withWithWithResponseAsync(String with, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withWith(this.client.getEndpoint(), with, requestOptions, context)); + } + + /** + * The withWith operation. + * + * @param with The with parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withWithWithResponse(String with, RequestOptions requestOptions) { + return service.withWithSync(this.client.getEndpoint(), with, requestOptions, Context.NONE); + } + + /** + * The withYield operation. + * + * @param yield The yield parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withYieldWithResponseAsync(String yield, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.withYield(this.client.getEndpoint(), yield, requestOptions, context)); + } + + /** + * The withYield operation. + * + * @param yield The yield parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withYieldWithResponse(String yield, RequestOptions requestOptions) { + return service.withYieldSync(this.client.getEndpoint(), yield, requestOptions, Context.NONE); + } + + /** + * The withCancellationToken operation. + * + * @param cancellationToken The cancellationToken parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> withCancellationTokenWithResponseAsync(String cancellationToken, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.withCancellationToken(this.client.getEndpoint(), + cancellationToken, requestOptions, context)); + } + + /** + * The withCancellationToken operation. + * + * @param cancellationToken The cancellationToken parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response withCancellationTokenWithResponse(String cancellationToken, RequestOptions requestOptions) { + return service.withCancellationTokenSync(this.client.getEndpoint(), cancellationToken, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/SpecialWordsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/SpecialWordsClientImpl.java new file mode 100644 index 00000000000..0228a3a8eff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/SpecialWordsClientImpl.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 SpecialWordsClient type. + */ +public final class SpecialWordsClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 ModelsImpl object to access its operations. + */ + private final ModelsImpl models; + + /** + * Gets the ModelsImpl object to access its operations. + * + * @return the ModelsImpl object. + */ + public ModelsImpl getModels() { + return this.models; + } + + /** + * The ModelPropertiesImpl object to access its operations. + */ + private final ModelPropertiesImpl modelProperties; + + /** + * Gets the ModelPropertiesImpl object to access its operations. + * + * @return the ModelPropertiesImpl object. + */ + public ModelPropertiesImpl getModelProperties() { + return this.modelProperties; + } + + /** + * The OperationsImpl object to access its operations. + */ + private final OperationsImpl operations; + + /** + * Gets the OperationsImpl object to access its operations. + * + * @return the OperationsImpl object. + */ + public OperationsImpl getOperations() { + return this.operations; + } + + /** + * The ParametersImpl object to access its operations. + */ + private final ParametersImpl parameters; + + /** + * Gets the ParametersImpl object to access its operations. + * + * @return the ParametersImpl object. + */ + public ParametersImpl getParameters() { + return this.parameters; + } + + /** + * Initializes an instance of SpecialWordsClient client. + * + * @param endpoint Service host. + */ + public SpecialWordsClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SpecialWordsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public SpecialWordsClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SpecialWordsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public SpecialWordsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.models = new ModelsImpl(this); + this.modelProperties = new ModelPropertiesImpl(this); + this.operations = new OperationsImpl(this); + this.parameters = new ParametersImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/package-info.java new file mode 100644 index 00000000000..408c8a8e2e9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/implementation/package-info.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for SpecialWords. + * Scenarios to verify that reserved words can be used in service and generators will handle it appropriately. + * + * Current list of special words + * ```txt + * and + * as + * assert + * async + * await + * break + * class + * constructor + * continue + * def + * del + * elif + * else + * except + * exec + * finally + * for + * from + * global + * if + * import + * in + * is + * lambda + * not + * or + * pass + * raise + * return + * try + * while + * with + * yield + * ```. + * + */ +package specialwords.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/DictMethods.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/DictMethods.java new file mode 100644 index 00000000000..fd5b55c5f65 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/DictMethods.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.modelproperties.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The DictMethods model. + */ +@Immutable +public final class DictMethods implements JsonSerializable { + /* + * The keys property. + */ + @Generated + private final String keys; + + /* + * The items property. + */ + @Generated + private final String items; + + /* + * The values property. + */ + @Generated + private final String values; + + /* + * The popitem property. + */ + @Generated + private final String popitem; + + /* + * The clear property. + */ + @Generated + private final String clear; + + /* + * The update property. + */ + @Generated + private final String update; + + /* + * The setdefault property. + */ + @Generated + private final String setdefault; + + /* + * The pop property. + */ + @Generated + private final String pop; + + /* + * The get property. + */ + @Generated + private final String get; + + /* + * The copy property. + */ + @Generated + private final String copy; + + /** + * Creates an instance of DictMethods class. + * + * @param keys the keys value to set. + * @param items the items value to set. + * @param values the values value to set. + * @param popitem the popitem value to set. + * @param clear the clear value to set. + * @param update the update value to set. + * @param setdefault the setdefault value to set. + * @param pop the pop value to set. + * @param get the get value to set. + * @param copy the copy value to set. + */ + @Generated + public DictMethods(String keys, String items, String values, String popitem, String clear, String update, + String setdefault, String pop, String get, String copy) { + this.keys = keys; + this.items = items; + this.values = values; + this.popitem = popitem; + this.clear = clear; + this.update = update; + this.setdefault = setdefault; + this.pop = pop; + this.get = get; + this.copy = copy; + } + + /** + * Get the keys property: The keys property. + * + * @return the keys value. + */ + @Generated + public String getKeys() { + return this.keys; + } + + /** + * Get the items property: The items property. + * + * @return the items value. + */ + @Generated + public String getItems() { + return this.items; + } + + /** + * Get the values property: The values property. + * + * @return the values value. + */ + @Generated + public String getValues() { + return this.values; + } + + /** + * Get the popitem property: The popitem property. + * + * @return the popitem value. + */ + @Generated + public String getPopitem() { + return this.popitem; + } + + /** + * Get the clear property: The clear property. + * + * @return the clear value. + */ + @Generated + public String getClear() { + return this.clear; + } + + /** + * Get the update property: The update property. + * + * @return the update value. + */ + @Generated + public String getUpdate() { + return this.update; + } + + /** + * Get the setdefault property: The setdefault property. + * + * @return the setdefault value. + */ + @Generated + public String getSetdefault() { + return this.setdefault; + } + + /** + * Get the pop property: The pop property. + * + * @return the pop value. + */ + @Generated + public String getPop() { + return this.pop; + } + + /** + * Get the get property: The get property. + * + * @return the get value. + */ + @Generated + public String getGet() { + return this.get; + } + + /** + * Get the copy property: The copy property. + * + * @return the copy value. + */ + @Generated + public String getCopy() { + return this.copy; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keys", this.keys); + jsonWriter.writeStringField("items", this.items); + jsonWriter.writeStringField("values", this.values); + jsonWriter.writeStringField("popitem", this.popitem); + jsonWriter.writeStringField("clear", this.clear); + jsonWriter.writeStringField("update", this.update); + jsonWriter.writeStringField("setdefault", this.setdefault); + jsonWriter.writeStringField("pop", this.pop); + jsonWriter.writeStringField("get", this.get); + jsonWriter.writeStringField("copy", this.copy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DictMethods from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DictMethods if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DictMethods. + */ + @Generated + public static DictMethods fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String keys = null; + String items = null; + String values = null; + String popitem = null; + String clear = null; + String update = null; + String setdefault = null; + String pop = null; + String get = null; + String copy = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keys".equals(fieldName)) { + keys = reader.getString(); + } else if ("items".equals(fieldName)) { + items = reader.getString(); + } else if ("values".equals(fieldName)) { + values = reader.getString(); + } else if ("popitem".equals(fieldName)) { + popitem = reader.getString(); + } else if ("clear".equals(fieldName)) { + clear = reader.getString(); + } else if ("update".equals(fieldName)) { + update = reader.getString(); + } else if ("setdefault".equals(fieldName)) { + setdefault = reader.getString(); + } else if ("pop".equals(fieldName)) { + pop = reader.getString(); + } else if ("get".equals(fieldName)) { + get = reader.getString(); + } else if ("copy".equals(fieldName)) { + copy = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new DictMethods(keys, items, values, popitem, clear, update, setdefault, pop, get, copy); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/SameAsModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/SameAsModel.java new file mode 100644 index 00000000000..9710a57a0b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/SameAsModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.modelproperties.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SameAsModel model. + */ +@Immutable +public final class SameAsModel implements JsonSerializable { + /* + * The SameAsModel property. + */ + @Generated + private final String sameAsModel; + + /** + * Creates an instance of SameAsModel class. + * + * @param sameAsModel the sameAsModel value to set. + */ + @Generated + public SameAsModel(String sameAsModel) { + this.sameAsModel = sameAsModel; + } + + /** + * Get the sameAsModel property: The SameAsModel property. + * + * @return the sameAsModel value. + */ + @Generated + public String getSameAsModel() { + return this.sameAsModel; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("SameAsModel", this.sameAsModel); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SameAsModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SameAsModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SameAsModel. + */ + @Generated + public static SameAsModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String sameAsModel = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("SameAsModel".equals(fieldName)) { + sameAsModel = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new SameAsModel(sameAsModel); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/package-info.java new file mode 100644 index 00000000000..1a4933291ab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/modelproperties/models/package-info.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for SpecialWords. + * Scenarios to verify that reserved words can be used in service and generators will handle it appropriately. + * + * Current list of special words + * ```txt + * and + * as + * assert + * async + * await + * break + * class + * constructor + * continue + * def + * del + * elif + * else + * except + * exec + * finally + * for + * from + * global + * if + * import + * in + * is + * lambda + * not + * or + * pass + * raise + * return + * try + * while + * with + * yield + * ```. + * + */ +package specialwords.modelproperties.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/And.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/And.java new file mode 100644 index 00000000000..e6a16870bb6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/And.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The And model. + */ +@Immutable +public final class And implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of And class. + * + * @param name the name value to set. + */ + @Generated + public And(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of And from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of And if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the And. + */ + @Generated + public static And fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new And(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/As.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/As.java new file mode 100644 index 00000000000..14b4cd32d3e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/As.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The As model. + */ +@Immutable +public final class As implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of As class. + * + * @param name the name value to set. + */ + @Generated + public As(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of As from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of As if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON + * null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the As. + */ + @Generated + public static As fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new As(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Assert.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Assert.java new file mode 100644 index 00000000000..1e06ffca1cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Assert.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Assert model. + */ +@Immutable +public final class Assert implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Assert class. + * + * @param name the name value to set. + */ + @Generated + public Assert(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Assert from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Assert if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Assert. + */ + @Generated + public static Assert fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Assert(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Async.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Async.java new file mode 100644 index 00000000000..f580b301b49 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Async.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Async model. + */ +@Immutable +public final class Async implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Async class. + * + * @param name the name value to set. + */ + @Generated + public Async(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Async from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Async if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Async. + */ + @Generated + public static Async fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Async(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Await.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Await.java new file mode 100644 index 00000000000..e7522d710bc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Await.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Await model. + */ +@Immutable +public final class Await implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Await class. + * + * @param name the name value to set. + */ + @Generated + public Await(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Await from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Await if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Await. + */ + @Generated + public static Await fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Await(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Break.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Break.java new file mode 100644 index 00000000000..e5e17e354b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Break.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Break model. + */ +@Immutable +public final class Break implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Break class. + * + * @param name the name value to set. + */ + @Generated + public Break(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Break from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Break if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Break. + */ + @Generated + public static Break fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Break(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/ClassModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/ClassModel.java new file mode 100644 index 00000000000..f93dafb3aca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/ClassModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ClassModel model. + */ +@Immutable +public final class ClassModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of ClassModel class. + * + * @param name the name value to set. + */ + @Generated + public ClassModel(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ClassModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ClassModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ClassModel. + */ + @Generated + public static ClassModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ClassModel(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Constructor.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Constructor.java new file mode 100644 index 00000000000..cd0ba701821 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Constructor.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Constructor model. + */ +@Immutable +public final class Constructor implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Constructor class. + * + * @param name the name value to set. + */ + @Generated + public Constructor(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Constructor from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Constructor if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Constructor. + */ + @Generated + public static Constructor fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Constructor(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Continue.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Continue.java new file mode 100644 index 00000000000..56a8e1f2c59 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Continue.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Continue model. + */ +@Immutable +public final class Continue implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Continue class. + * + * @param name the name value to set. + */ + @Generated + public Continue(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Continue from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Continue if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Continue. + */ + @Generated + public static Continue fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Continue(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Def.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Def.java new file mode 100644 index 00000000000..1509ac08642 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Def.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Def model. + */ +@Immutable +public final class Def implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Def class. + * + * @param name the name value to set. + */ + @Generated + public Def(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Def from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Def if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Def. + */ + @Generated + public static Def fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Def(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Del.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Del.java new file mode 100644 index 00000000000..538764c687d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Del.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Del model. + */ +@Immutable +public final class Del implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Del class. + * + * @param name the name value to set. + */ + @Generated + public Del(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Del from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Del if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Del. + */ + @Generated + public static Del fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Del(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Elif.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Elif.java new file mode 100644 index 00000000000..1e99697c42f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Elif.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Elif model. + */ +@Immutable +public final class Elif implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Elif class. + * + * @param name the name value to set. + */ + @Generated + public Elif(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Elif from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Elif if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Elif. + */ + @Generated + public static Elif fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Elif(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Else.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Else.java new file mode 100644 index 00000000000..58dad508c86 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Else.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Else model. + */ +@Immutable +public final class Else implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Else class. + * + * @param name the name value to set. + */ + @Generated + public Else(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Else from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Else if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Else. + */ + @Generated + public static Else fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Else(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Except.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Except.java new file mode 100644 index 00000000000..49e2f32c6d4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Except.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Except model. + */ +@Immutable +public final class Except implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Except class. + * + * @param name the name value to set. + */ + @Generated + public Except(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Except from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Except if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Except. + */ + @Generated + public static Except fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Except(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Exec.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Exec.java new file mode 100644 index 00000000000..44a3c3f64f5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Exec.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Exec model. + */ +@Immutable +public final class Exec implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Exec class. + * + * @param name the name value to set. + */ + @Generated + public Exec(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Exec from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Exec if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Exec. + */ + @Generated + public static Exec fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Exec(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Finally.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Finally.java new file mode 100644 index 00000000000..0e339f6cfcd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Finally.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Finally model. + */ +@Immutable +public final class Finally implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Finally class. + * + * @param name the name value to set. + */ + @Generated + public Finally(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Finally from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Finally if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Finally. + */ + @Generated + public static Finally fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Finally(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/For.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/For.java new file mode 100644 index 00000000000..896953f3a67 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/For.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The For model. + */ +@Immutable +public final class For implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of For class. + * + * @param name the name value to set. + */ + @Generated + public For(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of For from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of For if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the For. + */ + @Generated + public static For fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new For(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/From.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/From.java new file mode 100644 index 00000000000..7bc6a331aac --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/From.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The From model. + */ +@Immutable +public final class From implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of From class. + * + * @param name the name value to set. + */ + @Generated + public From(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of From from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of From if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the From. + */ + @Generated + public static From fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new From(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Global.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Global.java new file mode 100644 index 00000000000..d6bbcc0d202 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Global.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Global model. + */ +@Immutable +public final class Global implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Global class. + * + * @param name the name value to set. + */ + @Generated + public Global(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Global from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Global if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Global. + */ + @Generated + public static Global fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Global(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/If.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/If.java new file mode 100644 index 00000000000..10f4ba85358 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/If.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The If model. + */ +@Immutable +public final class If implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of If class. + * + * @param name the name value to set. + */ + @Generated + public If(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of If from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of If if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON + * null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the If. + */ + @Generated + public static If fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new If(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Import.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Import.java new file mode 100644 index 00000000000..cfd4b3403b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Import.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Import model. + */ +@Immutable +public final class Import implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Import class. + * + * @param name the name value to set. + */ + @Generated + public Import(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Import from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Import if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Import. + */ + @Generated + public static Import fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Import(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/In.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/In.java new file mode 100644 index 00000000000..f066ee95c57 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/In.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The In model. + */ +@Immutable +public final class In implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of In class. + * + * @param name the name value to set. + */ + @Generated + public In(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of In from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of In if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON + * null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the In. + */ + @Generated + public static In fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new In(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Is.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Is.java new file mode 100644 index 00000000000..1d8f13e25a1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Is.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Is model. + */ +@Immutable +public final class Is implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Is class. + * + * @param name the name value to set. + */ + @Generated + public Is(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Is from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Is if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON + * null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Is. + */ + @Generated + public static Is fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Is(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Lambda.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Lambda.java new file mode 100644 index 00000000000..add869f415b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Lambda.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Lambda model. + */ +@Immutable +public final class Lambda implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Lambda class. + * + * @param name the name value to set. + */ + @Generated + public Lambda(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Lambda from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Lambda if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Lambda. + */ + @Generated + public static Lambda fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Lambda(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Not.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Not.java new file mode 100644 index 00000000000..2dc767ce224 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Not.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Not model. + */ +@Immutable +public final class Not implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Not class. + * + * @param name the name value to set. + */ + @Generated + public Not(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Not from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Not if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Not. + */ + @Generated + public static Not fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Not(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Or.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Or.java new file mode 100644 index 00000000000..efbdd54f250 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Or.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Or model. + */ +@Immutable +public final class Or implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Or class. + * + * @param name the name value to set. + */ + @Generated + public Or(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Or from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Or if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON + * null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Or. + */ + @Generated + public static Or fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Or(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Pass.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Pass.java new file mode 100644 index 00000000000..080818c13b1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Pass.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Pass model. + */ +@Immutable +public final class Pass implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Pass class. + * + * @param name the name value to set. + */ + @Generated + public Pass(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Pass from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Pass if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Pass. + */ + @Generated + public static Pass fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Pass(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Raise.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Raise.java new file mode 100644 index 00000000000..7193057a518 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Raise.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Raise model. + */ +@Immutable +public final class Raise implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Raise class. + * + * @param name the name value to set. + */ + @Generated + public Raise(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Raise from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Raise if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Raise. + */ + @Generated + public static Raise fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Raise(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Return.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Return.java new file mode 100644 index 00000000000..a3407d7fdff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Return.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Return model. + */ +@Immutable +public final class Return implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Return class. + * + * @param name the name value to set. + */ + @Generated + public Return(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Return from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Return if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Return. + */ + @Generated + public static Return fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Return(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Try.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Try.java new file mode 100644 index 00000000000..eccc81c329d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Try.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Try model. + */ +@Immutable +public final class Try implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Try class. + * + * @param name the name value to set. + */ + @Generated + public Try(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Try from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Try if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Try. + */ + @Generated + public static Try fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Try(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/While.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/While.java new file mode 100644 index 00000000000..9123f900817 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/While.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The While model. + */ +@Immutable +public final class While implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of While class. + * + * @param name the name value to set. + */ + @Generated + public While(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of While from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of While if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the While. + */ + @Generated + public static While fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new While(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/With.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/With.java new file mode 100644 index 00000000000..c529df30405 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/With.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The With model. + */ +@Immutable +public final class With implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of With class. + * + * @param name the name value to set. + */ + @Generated + public With(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of With from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of With if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the With. + */ + @Generated + public static With fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new With(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Yield.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Yield.java new file mode 100644 index 00000000000..dd31e16b12f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/Yield.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.models.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Yield model. + */ +@Immutable +public final class Yield implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Yield class. + * + * @param name the name value to set. + */ + @Generated + public Yield(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Yield from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Yield if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Yield. + */ + @Generated + public static Yield fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Yield(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/package-info.java new file mode 100644 index 00000000000..57300012b01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/models/models/package-info.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for SpecialWords. + * Scenarios to verify that reserved words can be used in service and generators will handle it appropriately. + * + * Current list of special words + * ```txt + * and + * as + * assert + * async + * await + * break + * class + * constructor + * continue + * def + * del + * elif + * else + * except + * exec + * finally + * for + * from + * global + * if + * import + * in + * is + * lambda + * not + * or + * pass + * raise + * return + * try + * while + * with + * yield + * ```. + * + */ +package specialwords.models.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/package-info.java new file mode 100644 index 00000000000..f0c32070d09 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/specialwords/package-info.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for SpecialWords. + * Scenarios to verify that reserved words can be used in service and generators will handle it appropriately. + * + * Current list of special words + * ```txt + * and + * as + * assert + * async + * await + * break + * class + * constructor + * continue + * def + * del + * elif + * else + * except + * exec + * finally + * for + * from + * global + * if + * import + * in + * is + * lambda + * not + * or + * pass + * raise + * return + * try + * while + * with + * yield + * ```. + * + */ +package specialwords; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlAsyncClient.java new file mode 100644 index 00000000000..53049ae37d3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlAsyncClient.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package streaming.jsonl; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import streaming.jsonl.implementation.BasicsImpl; + +/** + * Initializes a new instance of the asynchronous JsonlClient type. + */ +@ServiceClient(builder = JsonlClientBuilder.class, isAsync = true) +public final class JsonlAsyncClient { + @Generated + private final BasicsImpl serviceClient; + + /** + * Initializes an instance of JsonlAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + JsonlAsyncClient(BasicsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(body, requestOptions); + } + + /** + * The receive operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> receiveWithResponse(RequestOptions requestOptions) { + return this.serviceClient.receiveWithResponseAsync(requestOptions); + } + + /** + * The send operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(BinaryData body) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + return sendWithResponse(body, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The receive operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono receive() { + // Generated convenience method for receiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return receiveWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClient.java new file mode 100644 index 00000000000..4b5a4666fcb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClient.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package streaming.jsonl; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import streaming.jsonl.implementation.BasicsImpl; + +/** + * Initializes a new instance of the synchronous JsonlClient type. + */ +@ServiceClient(builder = JsonlClientBuilder.class) +public final class JsonlClient { + @Generated + private final BasicsImpl serviceClient; + + /** + * Initializes an instance of JsonlClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + JsonlClient(BasicsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(body, requestOptions); + } + + /** + * The receive operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response receiveWithResponse(RequestOptions requestOptions) { + return this.serviceClient.receiveWithResponse(requestOptions); + } + + /** + * The send operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(BinaryData body) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + sendWithResponse(body, requestOptions).getValue(); + } + + /** + * The receive operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData receive() { + // Generated convenience method for receiveWithResponse + RequestOptions requestOptions = new RequestOptions(); + return receiveWithResponse(requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClientBuilder.java new file mode 100644 index 00000000000..6e088df63ff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/JsonlClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package streaming.jsonl; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import streaming.jsonl.implementation.JsonlClientImpl; + +/** + * A builder for creating a new instance of the JsonlClient type. + */ +@ServiceClientBuilder(serviceClients = { JsonlClient.class, JsonlAsyncClient.class }) +public final class JsonlClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("streaming-jsonl.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the JsonlClientBuilder. + */ + @Generated + public JsonlClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonlClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonlClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonlClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonlClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonlClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonlClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonlClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public JsonlClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the JsonlClientBuilder. + */ + @Generated + public JsonlClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of JsonlClientImpl with the provided parameters. + * + * @return an instance of JsonlClientImpl. + */ + @Generated + private JsonlClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + JsonlClientImpl client + = new JsonlClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of JsonlAsyncClient class. + * + * @return an instance of JsonlAsyncClient. + */ + @Generated + public JsonlAsyncClient buildAsyncClient() { + return new JsonlAsyncClient(buildInnerClient().getBasics()); + } + + /** + * Builds an instance of JsonlClient class. + * + * @return an instance of JsonlClient. + */ + @Generated + public JsonlClient buildClient() { + return new JsonlClient(buildInnerClient().getBasics()); + } + + private static final ClientLogger LOGGER = new ClientLogger(JsonlClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/BasicsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/BasicsImpl.java new file mode 100644 index 00000000000..633eb69a5e1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/BasicsImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package streaming.jsonl.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Basics. + */ +public final class BasicsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BasicsService service; + + /** + * The service client containing this operation class. + */ + private final JsonlClientImpl client; + + /** + * Initializes an instance of BasicsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BasicsImpl(JsonlClientImpl client) { + this.service = RestProxy.create(BasicsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for JsonlClientBasics to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "JsonlClientBasics") + public interface BasicsService { + @Post("/streaming/jsonl/basic/send") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/jsonl") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/streaming/jsonl/basic/send") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, + @BodyParam("application/jsonl") BinaryData body, RequestOptions requestOptions, Context context); + + @Get("/streaming/jsonl/basic/receive") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> receive(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/streaming/jsonl/basic/receive") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response receiveSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/jsonl"; + return FluxUtil.withContext( + context -> service.send(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/jsonl"; + return service.sendSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The receive operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> receiveWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/jsonl"; + return FluxUtil + .withContext(context -> service.receive(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The receive operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response receiveWithResponse(RequestOptions requestOptions) { + final String accept = "application/jsonl"; + return service.receiveSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/JsonlClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/JsonlClientImpl.java new file mode 100644 index 00000000000..3830f1b5707 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/JsonlClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package streaming.jsonl.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 JsonlClient type. + */ +public final class JsonlClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 BasicsImpl object to access its operations. + */ + private final BasicsImpl basics; + + /** + * Gets the BasicsImpl object to access its operations. + * + * @return the BasicsImpl object. + */ + public BasicsImpl getBasics() { + return this.basics; + } + + /** + * Initializes an instance of JsonlClient client. + * + * @param endpoint Service host. + */ + public JsonlClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of JsonlClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public JsonlClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of JsonlClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public JsonlClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.basics = new BasicsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/package-info.java new file mode 100644 index 00000000000..fdc79595592 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Jsonl. + * Test of jsonl streaming. + * + */ +package streaming.jsonl.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/package-info.java new file mode 100644 index 00000000000..3ed6455bbf5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/streaming/jsonl/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Jsonl. + * Test of jsonl streaming. + * + */ +package streaming.jsonl; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/ArmCustomizationManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/ArmCustomizationManager.java new file mode 100644 index 00000000000..52bf9fa4c6a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/ArmCustomizationManager.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armcustomization; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import tsptest.armcustomization.fluent.ArmCustomizationClient; +import tsptest.armcustomization.implementation.ArmCustomizationClientBuilder; +import tsptest.armcustomization.implementation.VaultsImpl; +import tsptest.armcustomization.models.Vaults; + +/** + * Entry point to ArmCustomizationManager. + * Arm Resource Provider management API. + */ +public final class ArmCustomizationManager { + private Vaults vaults; + + private final ArmCustomizationClient clientObject; + + private ArmCustomizationManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ArmCustomizationClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ArmCustomization service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ArmCustomization service API instance. + */ + public static ArmCustomizationManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of ArmCustomization service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ArmCustomization service API instance. + */ + public static ArmCustomizationManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ArmCustomizationManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ArmCustomizationManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ArmCustomizationManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-armcustomization-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of ArmCustomization service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ArmCustomization service API instance. + */ + public ArmCustomizationManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("tsptest.armcustomization") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ArmCustomizationManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Vaults. + * + * @return Resource collection API of Vaults. + */ + public Vaults vaults() { + if (this.vaults == null) { + this.vaults = new VaultsImpl(clientObject.getVaults(), this); + } + return vaults; + } + + /** + * Gets wrapped service client ArmCustomizationClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client ArmCustomizationClient. + */ + public ArmCustomizationClient serviceClient() { + return this.clientObject; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/ArmCustomizationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/ArmCustomizationClient.java new file mode 100644 index 00000000000..61586d01636 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/ArmCustomizationClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armcustomization.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ArmCustomizationClient class. + */ +public interface ArmCustomizationClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the VaultsClient object to access its operations. + * + * @return the VaultsClient object. + */ + VaultsClient getVaults(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/VaultsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/VaultsClient.java new file mode 100644 index 00000000000..5de29857fab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/VaultsClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armcustomization.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import tsptest.armcustomization.fluent.models.VaultInner; + +/** + * An instance of this class provides access to all the operations defined in VaultsClient. + */ +public interface VaultsClient { + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the Vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Azure key vault along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, Context context); + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the Vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Azure key vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VaultInner getByResourceGroup(String resourceGroupName, String vaultName); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/VaultInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/VaultInner.java new file mode 100644 index 00000000000..80c96f0b38d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/VaultInner.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package tsptest.armcustomization.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; +import tsptest.armcustomization.models.VaultProperties; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Immutable +public final class VaultInner extends Resource { + + /* + * The RP-specific properties for this resource. + */ + private VaultProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The geo-location where the resource lives + */ + private String location; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of VaultInner class. + */ + private VaultInner() { + } + + /** + * Get the properties property: The RP-specific properties for this resource. + * + * @return the properties value. + */ + public VaultProperties properties() { + return this.properties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VaultInner. + */ + public static VaultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultInner deserializedVaultInner = new VaultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("id".equals(fieldName)) { + deserializedVaultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedVaultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedVaultInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedVaultInner.properties = VaultProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedVaultInner.tags = tags; + } else if ("location".equals(fieldName)) { + deserializedVaultInner.location = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedVaultInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return deserializedVaultInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/package-info.java new file mode 100644 index 00000000000..e1a0ba70b6f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for ArmCustomization. + * Arm Resource Provider management API. + */ +package tsptest.armcustomization.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/package-info.java new file mode 100644 index 00000000000..8f005f15551 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for ArmCustomization. + * Arm Resource Provider management API. + */ +package tsptest.armcustomization.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientBuilder.java new file mode 100644 index 00000000000..ba4a09a5d53 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armcustomization.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the ArmCustomizationClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ArmCustomizationClientImpl.class }) +public final class ArmCustomizationClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ArmCustomizationClientBuilder. + */ + public ArmCustomizationClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the ArmCustomizationClientBuilder. + */ + public ArmCustomizationClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ArmCustomizationClientBuilder. + */ + public ArmCustomizationClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 ArmCustomizationClientBuilder. + */ + public ArmCustomizationClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ArmCustomizationClientBuilder. + */ + public ArmCustomizationClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 ArmCustomizationClientBuilder. + */ + public ArmCustomizationClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ArmCustomizationClientImpl with the provided parameters. + * + * @return an instance of ArmCustomizationClientImpl. + */ + public ArmCustomizationClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + ArmCustomizationClientImpl client = new ArmCustomizationClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientImpl.java new file mode 100644 index 00000000000..bb97758a5fd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientImpl.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armcustomization.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armcustomization.fluent.ArmCustomizationClient; +import tsptest.armcustomization.fluent.VaultsClient; + +/** + * Initializes a new instance of the ArmCustomizationClientImpl type. + */ +@ServiceClient(builder = ArmCustomizationClientBuilder.class) +public final class ArmCustomizationClientImpl implements ArmCustomizationClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The VaultsClient object to access its operations. + */ + private final VaultsClient vaults; + + /** + * Gets the VaultsClient object to access its operations. + * + * @return the VaultsClient object. + */ + public VaultsClient getVaults() { + return this.vaults; + } + + /** + * Initializes an instance of ArmCustomizationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + ArmCustomizationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2023-12-01-preview"; + this.vaults = new VaultsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ArmCustomizationClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ResourceManagerUtils.java new file mode 100644 index 00000000000..27e3a303f34 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armcustomization.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultImpl.java new file mode 100644 index 00000000000..18ed66f5db9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armcustomization.implementation; + +import com.azure.core.management.SystemData; +import java.util.Collections; +import java.util.Map; +import tsptest.armcustomization.fluent.models.VaultInner; +import tsptest.armcustomization.models.Vault; +import tsptest.armcustomization.models.VaultProperties; + +public final class VaultImpl implements Vault { + private VaultInner innerObject; + + private final tsptest.armcustomization.ArmCustomizationManager serviceManager; + + VaultImpl(VaultInner innerObject, tsptest.armcustomization.ArmCustomizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public VaultProperties properties() { + return this.innerModel().properties(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String location() { + return this.innerModel().location(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public VaultInner innerModel() { + return this.innerObject; + } + + private tsptest.armcustomization.ArmCustomizationManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsClientImpl.java new file mode 100644 index 00000000000..37f500ade56 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsClientImpl.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armcustomization.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.armcustomization.fluent.VaultsClient; +import tsptest.armcustomization.fluent.models.VaultInner; + +/** + * An instance of this class provides access to all the operations defined in VaultsClient. + */ +public final class VaultsClientImpl implements VaultsClient { + /** + * The proxy service used to perform REST calls. + */ + private final VaultsService service; + + /** + * The service client containing this operation class. + */ + private final ArmCustomizationClientImpl client; + + /** + * Initializes an instance of VaultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VaultsClientImpl(ArmCustomizationClientImpl client) { + this.service = RestProxy.create(VaultsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmCustomizationClientVaults to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmCustomizationClientVaults") + public interface VaultsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmCustomization/vaults/{vaultName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmCustomization/vaults/{vaultName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("vaultName") String vaultName, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the Vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Azure key vault along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String vaultName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the Vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Azure key vault on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String vaultName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, vaultName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the Vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Azure key vault along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, + Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, vaultName, accept, context); + } + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the Vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Azure key vault. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VaultInner getByResourceGroup(String resourceGroupName, String vaultName) { + return getByResourceGroupWithResponse(resourceGroupName, vaultName, Context.NONE).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsImpl.java new file mode 100644 index 00000000000..7f656c6cabc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/VaultsImpl.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armcustomization.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armcustomization.fluent.VaultsClient; +import tsptest.armcustomization.fluent.models.VaultInner; +import tsptest.armcustomization.models.Vault; +import tsptest.armcustomization.models.Vaults; + +public final class VaultsImpl implements Vaults { + private static final ClientLogger LOGGER = new ClientLogger(VaultsImpl.class); + + private final VaultsClient innerClient; + + private final tsptest.armcustomization.ArmCustomizationManager serviceManager; + + public VaultsImpl(VaultsClient innerClient, tsptest.armcustomization.ArmCustomizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, vaultName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new VaultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Vault getByResourceGroup(String resourceGroupName, String vaultName) { + VaultInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, vaultName); + if (inner != null) { + return new VaultImpl(inner, this.manager()); + } else { + return null; + } + } + + private VaultsClient serviceClient() { + return this.innerClient; + } + + private tsptest.armcustomization.ArmCustomizationManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/package-info.java new file mode 100644 index 00000000000..5b21792c461 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for ArmCustomization. + * Arm Resource Provider management API. + */ +package tsptest.armcustomization.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vault.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vault.java new file mode 100644 index 00000000000..239eaeeae1f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vault.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armcustomization.models; + +import com.azure.core.management.SystemData; +import java.util.Map; +import tsptest.armcustomization.fluent.models.VaultInner; + +/** + * An immutable client-side representation of Vault. + */ +public interface Vault { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The RP-specific properties for this resource. + * + * @return the properties value. + */ + VaultProperties properties(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner tsptest.armcustomization.fluent.models.VaultInner object. + * + * @return the inner object. + */ + VaultInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/VaultProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/VaultProperties.java new file mode 100644 index 00000000000..d6989dc5adb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/VaultProperties.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armcustomization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties of the vault. + */ +@Immutable +public final class VaultProperties implements JsonSerializable { + /* + * Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic + * except private endpoint traffic and that that originates from trusted services will be blocked. This will + * override the set firewall rules, meaning that even if the firewall rules are present we will not honor the rules. + */ + private String publicNetworkAccess; + + /** + * Creates an instance of VaultProperties class. + */ + private VaultProperties() { + } + + /** + * Get the publicNetworkAccess property: Property to specify whether the vault will accept traffic from public + * internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted + * services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are + * present we will not honor the rules. + * + * @return the publicNetworkAccess value. + */ + public String publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("publicNetworkAccess", this.publicNetworkAccess); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VaultProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VaultProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the VaultProperties. + */ + public static VaultProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VaultProperties deserializedVaultProperties = new VaultProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("publicNetworkAccess".equals(fieldName)) { + deserializedVaultProperties.publicNetworkAccess = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVaultProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vaults.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vaults.java new file mode 100644 index 00000000000..f4bd41695d1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/Vaults.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armcustomization.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Vaults. + */ +public interface Vaults { + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the Vault. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Azure key vault along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String vaultName, Context context); + + /** + * Gets the specified Azure key vault. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param vaultName The name of the Vault. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified Azure key vault. + */ + Vault getByResourceGroup(String resourceGroupName, String vaultName); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/package-info.java new file mode 100644 index 00000000000..3cc45547178 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for ArmCustomization. + * Arm Resource Provider management API. + */ +package tsptest.armcustomization.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/package-info.java new file mode 100644 index 00000000000..cd3311db413 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armcustomization/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for ArmCustomization. + * Arm Resource Provider management API. + */ +package tsptest.armcustomization; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/ArmLegacyManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/ArmLegacyManager.java new file mode 100644 index 00000000000..234c70b7d11 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/ArmLegacyManager.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import tsptest.armlegacy.fluent.ArmLegacyClient; +import tsptest.armlegacy.implementation.ArmLegacyClientBuilder; +import tsptest.armlegacy.implementation.SkusImpl; +import tsptest.armlegacy.models.Skus; + +/** + * Entry point to ArmLegacyManager. + * Arm Resource Provider management API. + */ +public final class ArmLegacyManager { + private Skus skus; + + private final ArmLegacyClient clientObject; + + private ArmLegacyManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ArmLegacyClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ArmLegacy service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ArmLegacy service API instance. + */ + public static ArmLegacyManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of ArmLegacy service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ArmLegacy service API instance. + */ + public static ArmLegacyManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ArmLegacyManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ArmLegacyManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ArmLegacyManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-armlegacy-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of ArmLegacy service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ArmLegacy service API instance. + */ + public ArmLegacyManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("tsptest.armlegacy") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ArmLegacyManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Skus. It manages SkuResource. + * + * @return Resource collection API of Skus. + */ + public Skus skus() { + if (this.skus == null) { + this.skus = new SkusImpl(clientObject.getSkus(), this); + } + return skus; + } + + /** + * Gets wrapped service client ArmLegacyClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client ArmLegacyClient. + */ + public ArmLegacyClient serviceClient() { + return this.clientObject; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/ArmLegacyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/ArmLegacyClient.java new file mode 100644 index 00000000000..f33b4a5b345 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/ArmLegacyClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ArmLegacyClient class. + */ +public interface ArmLegacyClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the SkusClient object to access its operations. + * + * @return the SkusClient object. + */ + SkusClient getSkus(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/SkusClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/SkusClient.java new file mode 100644 index 00000000000..26a5b4a17ed --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/SkusClient.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import tsptest.armlegacy.fluent.models.SkuResourceInner; + +/** + * An instance of this class provides access to all the operations defined in SkusClient. + */ +public interface SkusClient { + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getNestedWithResponse(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, Context context); + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SkuResourceInner getNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, + String sku); + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createNestedWithResponse(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, SkuResourceInner resource, Context context); + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SkuResourceInner createNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, + String sku, SkuResourceInner resource); + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteNestedWithResponse(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, Context context); + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, String sku); + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getRootWithResponse(String providerNamespace, String resourceType, String sku, + Context context); + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SkuResourceInner getRoot(String providerNamespace, String resourceType, String sku); + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createRootWithResponse(String providerNamespace, String resourceType, String sku, + SkuResourceInner resource, Context context); + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SkuResourceInner createRoot(String providerNamespace, String resourceType, String sku, SkuResourceInner resource); + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteRootWithResponse(String providerNamespace, String resourceType, String sku, Context context); + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteRoot(String providerNamespace, String resourceType, String sku); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/SkuResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/SkuResourceInner.java new file mode 100644 index 00000000000..21e966d91e5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/SkuResourceInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armlegacy.models.ResourceTypeSku; + +/** + * Concrete proxy resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class SkuResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ResourceTypeSku properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SkuResourceInner class. + */ + public SkuResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ResourceTypeSku properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the SkuResourceInner object itself. + */ + public SkuResourceInner withProperties(ResourceTypeSku properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuResourceInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SkuResourceInner. + */ + public static SkuResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuResourceInner deserializedSkuResourceInner = new SkuResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSkuResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSkuResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSkuResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSkuResourceInner.properties = ResourceTypeSku.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSkuResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/package-info.java new file mode 100644 index 00000000000..943d736868c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for ArmLegacy. + * Arm Resource Provider management API. + */ +package tsptest.armlegacy.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/package-info.java new file mode 100644 index 00000000000..f1f346a9dd2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for ArmLegacy. + * Arm Resource Provider management API. + */ +package tsptest.armlegacy.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientBuilder.java new file mode 100644 index 00000000000..cdf55e70138 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the ArmLegacyClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ArmLegacyClientImpl.class }) +public final class ArmLegacyClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ArmLegacyClientBuilder. + */ + public ArmLegacyClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the ArmLegacyClientBuilder. + */ + public ArmLegacyClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ArmLegacyClientBuilder. + */ + public ArmLegacyClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 ArmLegacyClientBuilder. + */ + public ArmLegacyClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ArmLegacyClientBuilder. + */ + public ArmLegacyClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 ArmLegacyClientBuilder. + */ + public ArmLegacyClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ArmLegacyClientImpl with the provided parameters. + * + * @return an instance of ArmLegacyClientImpl. + */ + public ArmLegacyClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + ArmLegacyClientImpl client = new ArmLegacyClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientImpl.java new file mode 100644 index 00000000000..032d64f27d7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientImpl.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armlegacy.fluent.ArmLegacyClient; +import tsptest.armlegacy.fluent.SkusClient; + +/** + * Initializes a new instance of the ArmLegacyClientImpl type. + */ +@ServiceClient(builder = ArmLegacyClientBuilder.class) +public final class ArmLegacyClientImpl implements ArmLegacyClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The SkusClient object to access its operations. + */ + private final SkusClient skus; + + /** + * Gets the SkusClient object to access its operations. + * + * @return the SkusClient object. + */ + public SkusClient getSkus() { + return this.skus; + } + + /** + * Initializes an instance of ArmLegacyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + ArmLegacyClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2024-12-01"; + this.skus = new SkusClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ArmLegacyClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ResourceManagerUtils.java new file mode 100644 index 00000000000..96b4a0a5a0b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkuResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkuResourceImpl.java new file mode 100644 index 00000000000..c0d6172ee36 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkuResourceImpl.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import tsptest.armlegacy.fluent.models.SkuResourceInner; +import tsptest.armlegacy.models.ResourceTypeSku; +import tsptest.armlegacy.models.SkuResource; + +public final class SkuResourceImpl implements SkuResource, SkuResource.Definition { + private SkuResourceInner innerObject; + + private final tsptest.armlegacy.ArmLegacyManager serviceManager; + + SkuResourceImpl(SkuResourceInner innerObject, tsptest.armlegacy.ArmLegacyManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ResourceTypeSku properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SkuResourceInner innerModel() { + return this.innerObject; + } + + private tsptest.armlegacy.ArmLegacyManager manager() { + return this.serviceManager; + } + + private String providerNamespace; + + private String resourceType; + + private String sku; + + public SkuResourceImpl withExistingResourcetypeRegistration(String providerNamespace, String resourceType) { + this.providerNamespace = providerNamespace; + this.resourceType = resourceType; + return this; + } + + public SkuResource create() { + this.innerObject = serviceManager.serviceClient() + .getSkus() + .createRootWithResponse(providerNamespace, resourceType, sku, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SkuResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSkus() + .createRootWithResponse(providerNamespace, resourceType, sku, this.innerModel(), context) + .getValue(); + return this; + } + + SkuResourceImpl(String name, tsptest.armlegacy.ArmLegacyManager serviceManager) { + this.innerObject = new SkuResourceInner(); + this.serviceManager = serviceManager; + this.sku = name; + } + + public SkuResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getSkus() + .getRootWithResponse(providerNamespace, resourceType, sku, Context.NONE) + .getValue(); + return this; + } + + public SkuResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSkus() + .getRootWithResponse(providerNamespace, resourceType, sku, context) + .getValue(); + return this; + } + + public SkuResourceImpl withProperties(ResourceTypeSku properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusClientImpl.java new file mode 100644 index 00000000000..094bde38477 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusClientImpl.java @@ -0,0 +1,662 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.armlegacy.fluent.SkusClient; +import tsptest.armlegacy.fluent.models.SkuResourceInner; + +/** + * An instance of this class provides access to all the operations defined in SkusClient. + */ +public final class SkusClientImpl implements SkusClient { + /** + * The proxy service used to perform REST calls. + */ + private final SkusService service; + + /** + * The service client containing this operation class. + */ + private final ArmLegacyClientImpl client; + + /** + * Initializes an instance of SkusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SkusClientImpl(ArmLegacyClientImpl client) { + this.service = RestProxy.create(SkusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmLegacyClientSkus to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmLegacyClientSkus") + public interface SkusService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getNested(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, + @PathParam("nestedResourceTypeFirst") String nestedResourceTypeFirst, @PathParam("sku") String sku, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getNestedSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, + @PathParam("nestedResourceTypeFirst") String nestedResourceTypeFirst, @PathParam("sku") String sku, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createNested(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, + @PathParam("nestedResourceTypeFirst") String nestedResourceTypeFirst, @PathParam("sku") String sku, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SkuResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createNestedSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, + @PathParam("nestedResourceTypeFirst") String nestedResourceTypeFirst, @PathParam("sku") String sku, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SkuResourceInner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteNested(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, + @PathParam("nestedResourceTypeFirst") String nestedResourceTypeFirst, @PathParam("sku") String sku, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/resourcetypeRegistrations/{nestedResourceTypeFirst}/skus/{sku}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteNestedSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, + @PathParam("nestedResourceTypeFirst") String nestedResourceTypeFirst, @PathParam("sku") String sku, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getRoot(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, + @PathParam("sku") String sku, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getRootSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, + @PathParam("sku") String sku, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createRoot(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, + @PathParam("sku") String sku, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SkuResourceInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createRootSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, + @PathParam("sku") String sku, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SkuResourceInner resource, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteRoot(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, + @PathParam("sku") String sku, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ThisWillBeReplaced/providerRegistrations/{providerNamespace}/resourcetypeRegistrations/{resourceType}/skus/{sku}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteRootSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerNamespace") String providerNamespace, @PathParam("resourceType") String resourceType, + @PathParam("sku") String sku, Context context); + } + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getNestedWithResponseAsync(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNested(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), providerNamespace, resourceType, nestedResourceTypeFirst, sku, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getNestedAsync(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku) { + return getNestedWithResponseAsync(providerNamespace, resourceType, nestedResourceTypeFirst, sku) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNestedWithResponse(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, Context context) { + final String accept = "application/json"; + return service.getNestedSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), providerNamespace, resourceType, nestedResourceTypeFirst, sku, accept, + context); + } + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SkuResourceInner getNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, + String sku) { + return getNestedWithResponse(providerNamespace, resourceType, nestedResourceTypeFirst, sku, Context.NONE) + .getValue(); + } + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createNestedWithResponseAsync(String providerNamespace, + String resourceType, String nestedResourceTypeFirst, String sku, SkuResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createNested(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), providerNamespace, resourceType, nestedResourceTypeFirst, sku, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createNestedAsync(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, SkuResourceInner resource) { + return createNestedWithResponseAsync(providerNamespace, resourceType, nestedResourceTypeFirst, sku, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createNestedWithResponse(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, SkuResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createNestedSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), providerNamespace, resourceType, nestedResourceTypeFirst, sku, contentType, + accept, resource, context); + } + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SkuResourceInner createNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, + String sku, SkuResourceInner resource) { + return createNestedWithResponse(providerNamespace, resourceType, nestedResourceTypeFirst, sku, resource, + Context.NONE).getValue(); + } + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteNestedWithResponseAsync(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku) { + return FluxUtil + .withContext(context -> service.deleteNested(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), providerNamespace, resourceType, nestedResourceTypeFirst, sku, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteNestedAsync(String providerNamespace, String resourceType, String nestedResourceTypeFirst, + String sku) { + return deleteNestedWithResponseAsync(providerNamespace, resourceType, nestedResourceTypeFirst, sku) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteNestedWithResponse(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, Context context) { + return service.deleteNestedSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), providerNamespace, resourceType, nestedResourceTypeFirst, sku, context); + } + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, + String sku) { + deleteNestedWithResponse(providerNamespace, resourceType, nestedResourceTypeFirst, sku, Context.NONE); + } + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getRootWithResponseAsync(String providerNamespace, String resourceType, + String sku) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getRoot(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), providerNamespace, resourceType, sku, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getRootAsync(String providerNamespace, String resourceType, String sku) { + return getRootWithResponseAsync(providerNamespace, resourceType, sku) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRootWithResponse(String providerNamespace, String resourceType, String sku, + Context context) { + final String accept = "application/json"; + return service.getRootSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), providerNamespace, resourceType, sku, accept, context); + } + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SkuResourceInner getRoot(String providerNamespace, String resourceType, String sku) { + return getRootWithResponse(providerNamespace, resourceType, sku, Context.NONE).getValue(); + } + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createRootWithResponseAsync(String providerNamespace, String resourceType, + String sku, SkuResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createRoot(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), providerNamespace, resourceType, sku, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createRootAsync(String providerNamespace, String resourceType, String sku, + SkuResourceInner resource) { + return createRootWithResponseAsync(providerNamespace, resourceType, sku, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createRootWithResponse(String providerNamespace, String resourceType, String sku, + SkuResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createRootSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), providerNamespace, resourceType, sku, contentType, accept, resource, + context); + } + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SkuResourceInner createRoot(String providerNamespace, String resourceType, String sku, + SkuResourceInner resource) { + return createRootWithResponse(providerNamespace, resourceType, sku, resource, Context.NONE).getValue(); + } + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteRootWithResponseAsync(String providerNamespace, String resourceType, + String sku) { + return FluxUtil + .withContext(context -> service.deleteRoot(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), providerNamespace, resourceType, sku, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteRootAsync(String providerNamespace, String resourceType, String sku) { + return deleteRootWithResponseAsync(providerNamespace, resourceType, sku).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteRootWithResponse(String providerNamespace, String resourceType, String sku, + Context context) { + return service.deleteRootSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), providerNamespace, resourceType, sku, context); + } + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteRoot(String providerNamespace, String resourceType, String sku) { + deleteRootWithResponse(providerNamespace, resourceType, sku, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusImpl.java new file mode 100644 index 00000000000..99a246c7aef --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/SkusImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armlegacy.fluent.SkusClient; +import tsptest.armlegacy.fluent.models.SkuResourceInner; +import tsptest.armlegacy.models.SkuResource; +import tsptest.armlegacy.models.Skus; + +public final class SkusImpl implements Skus { + private static final ClientLogger LOGGER = new ClientLogger(SkusImpl.class); + + private final SkusClient innerClient; + + private final tsptest.armlegacy.ArmLegacyManager serviceManager; + + public SkusImpl(SkusClient innerClient, tsptest.armlegacy.ArmLegacyManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getNestedWithResponse(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, Context context) { + Response inner = this.serviceClient() + .getNestedWithResponse(providerNamespace, resourceType, nestedResourceTypeFirst, sku, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SkuResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SkuResource getNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, + String sku) { + SkuResourceInner inner + = this.serviceClient().getNested(providerNamespace, resourceType, nestedResourceTypeFirst, sku); + if (inner != null) { + return new SkuResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createNestedWithResponse(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, SkuResourceInner resource, Context context) { + Response inner = this.serviceClient() + .createNestedWithResponse(providerNamespace, resourceType, nestedResourceTypeFirst, sku, resource, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SkuResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SkuResource createNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, + String sku, SkuResourceInner resource) { + SkuResourceInner inner = this.serviceClient() + .createNested(providerNamespace, resourceType, nestedResourceTypeFirst, sku, resource); + if (inner != null) { + return new SkuResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteNestedWithResponse(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, Context context) { + return this.serviceClient() + .deleteNestedWithResponse(providerNamespace, resourceType, nestedResourceTypeFirst, sku, context); + } + + public void deleteNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, + String sku) { + this.serviceClient().deleteNested(providerNamespace, resourceType, nestedResourceTypeFirst, sku); + } + + public Response getRootWithResponse(String providerNamespace, String resourceType, String sku, + Context context) { + Response inner + = this.serviceClient().getRootWithResponse(providerNamespace, resourceType, sku, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SkuResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SkuResource getRoot(String providerNamespace, String resourceType, String sku) { + SkuResourceInner inner = this.serviceClient().getRoot(providerNamespace, resourceType, sku); + if (inner != null) { + return new SkuResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteRootWithResponse(String providerNamespace, String resourceType, String sku, + Context context) { + return this.serviceClient().deleteRootWithResponse(providerNamespace, resourceType, sku, context); + } + + public void deleteRoot(String providerNamespace, String resourceType, String sku) { + this.serviceClient().deleteRoot(providerNamespace, resourceType, sku); + } + + public SkuResource getRootById(String id) { + String providerNamespace = ResourceManagerUtils.getValueFromIdByName(id, "providerRegistrations"); + if (providerNamespace == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'providerRegistrations'.", id))); + } + String resourceType = ResourceManagerUtils.getValueFromIdByName(id, "resourcetypeRegistrations"); + if (resourceType == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcetypeRegistrations'.", id))); + } + String sku = ResourceManagerUtils.getValueFromIdByName(id, "skus"); + if (sku == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'skus'.", id))); + } + return this.getRootWithResponse(providerNamespace, resourceType, sku, Context.NONE).getValue(); + } + + public Response getRootByIdWithResponse(String id, Context context) { + String providerNamespace = ResourceManagerUtils.getValueFromIdByName(id, "providerRegistrations"); + if (providerNamespace == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'providerRegistrations'.", id))); + } + String resourceType = ResourceManagerUtils.getValueFromIdByName(id, "resourcetypeRegistrations"); + if (resourceType == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcetypeRegistrations'.", id))); + } + String sku = ResourceManagerUtils.getValueFromIdByName(id, "skus"); + if (sku == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'skus'.", id))); + } + return this.getRootWithResponse(providerNamespace, resourceType, sku, context); + } + + public void deleteRootById(String id) { + String providerNamespace = ResourceManagerUtils.getValueFromIdByName(id, "providerRegistrations"); + if (providerNamespace == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'providerRegistrations'.", id))); + } + String resourceType = ResourceManagerUtils.getValueFromIdByName(id, "resourcetypeRegistrations"); + if (resourceType == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcetypeRegistrations'.", id))); + } + String sku = ResourceManagerUtils.getValueFromIdByName(id, "skus"); + if (sku == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'skus'.", id))); + } + this.deleteRootWithResponse(providerNamespace, resourceType, sku, Context.NONE); + } + + public Response deleteRootByIdWithResponse(String id, Context context) { + String providerNamespace = ResourceManagerUtils.getValueFromIdByName(id, "providerRegistrations"); + if (providerNamespace == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'providerRegistrations'.", id))); + } + String resourceType = ResourceManagerUtils.getValueFromIdByName(id, "resourcetypeRegistrations"); + if (resourceType == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcetypeRegistrations'.", id))); + } + String sku = ResourceManagerUtils.getValueFromIdByName(id, "skus"); + if (sku == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'skus'.", id))); + } + return this.deleteRootWithResponse(providerNamespace, resourceType, sku, context); + } + + private SkusClient serviceClient() { + return this.innerClient; + } + + private tsptest.armlegacy.ArmLegacyManager manager() { + return this.serviceManager; + } + + public SkuResourceImpl define(String name) { + return new SkuResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/package-info.java new file mode 100644 index 00000000000..7c77130eb60 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for ArmLegacy. + * Arm Resource Provider management API. + */ +package tsptest.armlegacy.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ProvisioningState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ProvisioningState.java new file mode 100644 index 00000000000..4c5281afdab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ProvisioningState. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Provisioning for ProvisioningState. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Accepted for ProvisioningState. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ResourceTypeSku.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ResourceTypeSku.java new file mode 100644 index 00000000000..470a039632b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/ResourceTypeSku.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ResourceTypeSku model. + */ +@Immutable +public final class ResourceTypeSku implements JsonSerializable { + /* + * The provisioningState property. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of ResourceTypeSku class. + */ + public ResourceTypeSku() { + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceTypeSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceTypeSku if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceTypeSku. + */ + public static ResourceTypeSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceTypeSku deserializedResourceTypeSku = new ResourceTypeSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedResourceTypeSku.provisioningState = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceTypeSku; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/SkuResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/SkuResource.java new file mode 100644 index 00000000000..7136d52dbf4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/SkuResource.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import tsptest.armlegacy.fluent.models.SkuResourceInner; + +/** + * An immutable client-side representation of SkuResource. + */ +public interface SkuResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ResourceTypeSku properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner tsptest.armlegacy.fluent.models.SkuResourceInner object. + * + * @return the inner object. + */ + SkuResourceInner innerModel(); + + /** + * The entirety of the SkuResource definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The SkuResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SkuResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the SkuResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies providerNamespace, resourceType. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @return the next definition stage. + */ + WithCreate withExistingResourcetypeRegistration(String providerNamespace, String resourceType); + } + + /** + * The stage of the SkuResource definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + SkuResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SkuResource create(Context context); + } + + /** + * The stage of the SkuResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ResourceTypeSku properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SkuResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SkuResource refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/Skus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/Skus.java new file mode 100644 index 00000000000..ea55ce0b7c8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/Skus.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armlegacy.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import tsptest.armlegacy.fluent.models.SkuResourceInner; + +/** + * Resource collection API of Skus. + */ +public interface Skus { + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource along with {@link Response}. + */ + Response getNestedWithResponse(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, Context context); + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource. + */ + SkuResource getNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, String sku); + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + Response createNestedWithResponse(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, SkuResourceInner resource, Context context); + + /** + * Create a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + SkuResource createNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, String sku, + SkuResourceInner resource); + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteNestedWithResponse(String providerNamespace, String resourceType, + String nestedResourceTypeFirst, String sku, Context context); + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param nestedResourceTypeFirst The first child resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteNested(String providerNamespace, String resourceType, String nestedResourceTypeFirst, String sku); + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource along with {@link Response}. + */ + Response getRootWithResponse(String providerNamespace, String resourceType, String sku, + Context context); + + /** + * Get a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource. + */ + SkuResource getRoot(String providerNamespace, String resourceType, String sku); + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteRootWithResponse(String providerNamespace, String resourceType, String sku, Context context); + + /** + * Delete a SkuResource. + * + * @param providerNamespace The name of the resource provider hosted within ProviderHub. + * @param resourceType The resource type. + * @param sku The SKU. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteRoot(String providerNamespace, String resourceType, String sku); + + /** + * Get a SkuResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource along with {@link Response}. + */ + SkuResource getRootById(String id); + + /** + * Get a SkuResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SkuResource along with {@link Response}. + */ + Response getRootByIdWithResponse(String id, Context context); + + /** + * Delete a SkuResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteRootById(String id); + + /** + * Delete a SkuResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteRootByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SkuResource resource. + * + * @param name resource name. + * @return the first stage of the new SkuResource definition. + */ + SkuResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/package-info.java new file mode 100644 index 00000000000..c58defcfc99 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for ArmLegacy. + * Arm Resource Provider management API. + */ +package tsptest.armlegacy.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/package-info.java new file mode 100644 index 00000000000..c5f766eb6db --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armlegacy/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for ArmLegacy. + * Arm Resource Provider management API. + */ +package tsptest.armlegacy; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java new file mode 100644 index 00000000000..5b9c041ecef --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import tsptest.armresourceprovider.fluent.ArmClient; +import tsptest.armresourceprovider.implementation.ArmClientBuilder; +import tsptest.armresourceprovider.implementation.ChildExtensionResourceInterfacesImpl; +import tsptest.armresourceprovider.implementation.ChildResourcesInterfacesImpl; +import tsptest.armresourceprovider.implementation.CustomTemplateResourceInterfacesImpl; +import tsptest.armresourceprovider.implementation.ImmutableResourceModelsImpl; +import tsptest.armresourceprovider.implementation.LroNoBodiesImpl; +import tsptest.armresourceprovider.implementation.ManagedMaintenanceWindowStatusOperationsImpl; +import tsptest.armresourceprovider.implementation.ModelInterfaceSameNamesImpl; +import tsptest.armresourceprovider.implementation.OperationsImpl; +import tsptest.armresourceprovider.implementation.TopLevelArmResourceInterfacesImpl; +import tsptest.armresourceprovider.models.ChildExtensionResourceInterfaces; +import tsptest.armresourceprovider.models.ChildResourcesInterfaces; +import tsptest.armresourceprovider.models.CustomTemplateResourceInterfaces; +import tsptest.armresourceprovider.models.ImmutableResourceModels; +import tsptest.armresourceprovider.models.LroNoBodies; +import tsptest.armresourceprovider.models.ManagedMaintenanceWindowStatusOperations; +import tsptest.armresourceprovider.models.ModelInterfaceSameNames; +import tsptest.armresourceprovider.models.Operations; +import tsptest.armresourceprovider.models.TopLevelArmResourceInterfaces; + +/** + * Entry point to ArmResourceProviderManager. + * Arm Resource Provider management API. + */ +public final class ArmResourceProviderManager { + private ChildResourcesInterfaces childResourcesInterfaces; + + private TopLevelArmResourceInterfaces topLevelArmResourceInterfaces; + + private CustomTemplateResourceInterfaces customTemplateResourceInterfaces; + + private Operations operations; + + private ChildExtensionResourceInterfaces childExtensionResourceInterfaces; + + private ManagedMaintenanceWindowStatusOperations managedMaintenanceWindowStatusOperations; + + private ModelInterfaceSameNames modelInterfaceSameNames; + + private ImmutableResourceModels immutableResourceModels; + + private LroNoBodies lroNoBodies; + + private final ArmClient clientObject; + + private ArmResourceProviderManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ArmClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Arm Resource Provider service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Arm Resource Provider service API instance. + */ + public static ArmResourceProviderManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Arm Resource Provider service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Arm Resource Provider service API instance. + */ + public static ArmResourceProviderManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ArmResourceProviderManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ArmResourceProviderManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ArmResourceProviderManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-armresourceprovider-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Arm Resource Provider service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Arm Resource Provider service API instance. + */ + public ArmResourceProviderManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("tsptest.armresourceprovider") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ArmResourceProviderManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of ChildResourcesInterfaces. It manages ChildResource. + * + * @return Resource collection API of ChildResourcesInterfaces. + */ + public ChildResourcesInterfaces childResourcesInterfaces() { + if (this.childResourcesInterfaces == null) { + this.childResourcesInterfaces + = new ChildResourcesInterfacesImpl(clientObject.getChildResourcesInterfaces(), this); + } + return childResourcesInterfaces; + } + + /** + * Gets the resource collection API of TopLevelArmResourceInterfaces. It manages TopLevelArmResource. + * + * @return Resource collection API of TopLevelArmResourceInterfaces. + */ + public TopLevelArmResourceInterfaces topLevelArmResourceInterfaces() { + if (this.topLevelArmResourceInterfaces == null) { + this.topLevelArmResourceInterfaces + = new TopLevelArmResourceInterfacesImpl(clientObject.getTopLevelArmResourceInterfaces(), this); + } + return topLevelArmResourceInterfaces; + } + + /** + * Gets the resource collection API of CustomTemplateResourceInterfaces. It manages CustomTemplateResource. + * + * @return Resource collection API of CustomTemplateResourceInterfaces. + */ + public CustomTemplateResourceInterfaces customTemplateResourceInterfaces() { + if (this.customTemplateResourceInterfaces == null) { + this.customTemplateResourceInterfaces + = new CustomTemplateResourceInterfacesImpl(clientObject.getCustomTemplateResourceInterfaces(), this); + } + return customTemplateResourceInterfaces; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of ChildExtensionResourceInterfaces. It manages ChildExtensionResource. + * + * @return Resource collection API of ChildExtensionResourceInterfaces. + */ + public ChildExtensionResourceInterfaces childExtensionResourceInterfaces() { + if (this.childExtensionResourceInterfaces == null) { + this.childExtensionResourceInterfaces + = new ChildExtensionResourceInterfacesImpl(clientObject.getChildExtensionResourceInterfaces(), this); + } + return childExtensionResourceInterfaces; + } + + /** + * Gets the resource collection API of ManagedMaintenanceWindowStatusOperations. + * + * @return Resource collection API of ManagedMaintenanceWindowStatusOperations. + */ + public ManagedMaintenanceWindowStatusOperations managedMaintenanceWindowStatusOperations() { + if (this.managedMaintenanceWindowStatusOperations == null) { + this.managedMaintenanceWindowStatusOperations = new ManagedMaintenanceWindowStatusOperationsImpl( + clientObject.getManagedMaintenanceWindowStatusOperations(), this); + } + return managedMaintenanceWindowStatusOperations; + } + + /** + * Gets the resource collection API of ModelInterfaceSameNames. + * + * @return Resource collection API of ModelInterfaceSameNames. + */ + public ModelInterfaceSameNames modelInterfaceSameNames() { + if (this.modelInterfaceSameNames == null) { + this.modelInterfaceSameNames + = new ModelInterfaceSameNamesImpl(clientObject.getModelInterfaceSameNames(), this); + } + return modelInterfaceSameNames; + } + + /** + * Gets the resource collection API of ImmutableResourceModels. + * + * @return Resource collection API of ImmutableResourceModels. + */ + public ImmutableResourceModels immutableResourceModels() { + if (this.immutableResourceModels == null) { + this.immutableResourceModels + = new ImmutableResourceModelsImpl(clientObject.getImmutableResourceModels(), this); + } + return immutableResourceModels; + } + + /** + * Gets the resource collection API of LroNoBodies. + * + * @return Resource collection API of LroNoBodies. + */ + public LroNoBodies lroNoBodies() { + if (this.lroNoBodies == null) { + this.lroNoBodies = new LroNoBodiesImpl(clientObject.getLroNoBodies(), this); + } + return lroNoBodies; + } + + /** + * Gets wrapped service client ArmClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client ArmClient. + */ + public ArmClient serviceClient() { + return this.clientObject; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java new file mode 100644 index 00000000000..8853b2c1975 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ArmClient class. + */ +public interface ArmClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the ChildResourcesInterfacesClient object to access its operations. + * + * @return the ChildResourcesInterfacesClient object. + */ + ChildResourcesInterfacesClient getChildResourcesInterfaces(); + + /** + * Gets the TopLevelArmResourceInterfacesClient object to access its operations. + * + * @return the TopLevelArmResourceInterfacesClient object. + */ + TopLevelArmResourceInterfacesClient getTopLevelArmResourceInterfaces(); + + /** + * Gets the CustomTemplateResourceInterfacesClient object to access its operations. + * + * @return the CustomTemplateResourceInterfacesClient object. + */ + CustomTemplateResourceInterfacesClient getCustomTemplateResourceInterfaces(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ChildExtensionResourceInterfacesClient object to access its operations. + * + * @return the ChildExtensionResourceInterfacesClient object. + */ + ChildExtensionResourceInterfacesClient getChildExtensionResourceInterfaces(); + + /** + * Gets the ManagedMaintenanceWindowStatusOperationsClient object to access its operations. + * + * @return the ManagedMaintenanceWindowStatusOperationsClient object. + */ + ManagedMaintenanceWindowStatusOperationsClient getManagedMaintenanceWindowStatusOperations(); + + /** + * Gets the ModelInterfaceSameNamesClient object to access its operations. + * + * @return the ModelInterfaceSameNamesClient object. + */ + ModelInterfaceSameNamesClient getModelInterfaceSameNames(); + + /** + * Gets the ImmutableResourceModelsClient object to access its operations. + * + * @return the ImmutableResourceModelsClient object. + */ + ImmutableResourceModelsClient getImmutableResourceModels(); + + /** + * Gets the LroNoBodiesClient object to access its operations. + * + * @return the LroNoBodiesClient object. + */ + LroNoBodiesClient getLroNoBodies(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildExtensionResourceInterfacesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildExtensionResourceInterfacesClient.java new file mode 100644 index 00000000000..56b02c142b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildExtensionResourceInterfacesClient.java @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner; +import tsptest.armresourceprovider.models.ChildExtensionResourceUpdate; + +/** + * An instance of this class provides access to all the operations defined in ChildExtensionResourceInterfacesClient. + */ +public interface ChildExtensionResourceInterfacesClient { + /** + * Get a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildExtensionResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getWithResponseAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName); + + /** + * Get a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildExtensionResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName); + + /** + * Get a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildExtensionResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, Context context); + + /** + * Get a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildExtensionResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChildExtensionResourceInner get(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName); + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceInner resource); + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of extensionResource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ChildExtensionResourceInner> beginCreateOrUpdateAsync( + String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, + ChildExtensionResourceInner resource); + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of extensionResource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ChildExtensionResourceInner> beginCreateOrUpdate( + String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, + ChildExtensionResourceInner resource); + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of extensionResource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ChildExtensionResourceInner> beginCreateOrUpdate( + String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, + ChildExtensionResourceInner resource, Context context); + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceInner resource); + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChildExtensionResourceInner createOrUpdate(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceInner resource); + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChildExtensionResourceInner createOrUpdate(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceInner resource, Context context); + + /** + * Update a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> updateWithResponseAsync(String resourceUri, + String topLevelArmResourceName, String childExtensionResourceName, ChildExtensionResourceUpdate properties); + + /** + * Update a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono updateAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceUpdate properties); + + /** + * Update a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceUpdate properties, Context context); + + /** + * Update a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChildExtensionResourceInner update(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceUpdate properties); + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName); + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName); + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName); + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, Context context); + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName); + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName); + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, Context context); + + /** + * List ChildExtensionResource resources by TopLevelArmResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByTopLevelArmResourceAsync(String resourceUri, + String topLevelArmResourceName); + + /** + * List ChildExtensionResource resources by TopLevelArmResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTopLevelArmResource(String resourceUri, + String topLevelArmResourceName); + + /** + * List ChildExtensionResource resources by TopLevelArmResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTopLevelArmResource(String resourceUri, + String topLevelArmResourceName, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildResourcesInterfacesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildResourcesInterfacesClient.java new file mode 100644 index 00000000000..f5733578b8d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ChildResourcesInterfacesClient.java @@ -0,0 +1,515 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.models.ChildResourceInner; +import tsptest.armresourceprovider.models.ChildResourceUpdate; + +/** + * An instance of this class provides access to all the operations defined in ChildResourcesInterfacesClient. + */ +public interface ChildResourcesInterfacesClient { + /** + * Get a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getWithResponseAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName); + + /** + * Get a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName); + + /** + * Get a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, Context context); + + /** + * Get a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChildResourceInner get(String resourceGroupName, String topLevelArmResourceName, String childResourceName); + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName, String childResourceName, ChildResourceInner resource); + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of subresource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ChildResourceInner> beginCreateOrUpdateAsync(String resourceGroupName, + String topLevelArmResourceName, String childResourceName, ChildResourceInner resource); + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of subresource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ChildResourceInner> beginCreateOrUpdate(String resourceGroupName, + String topLevelArmResourceName, String childResourceName, ChildResourceInner resource); + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of subresource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ChildResourceInner> beginCreateOrUpdate(String resourceGroupName, + String topLevelArmResourceName, String childResourceName, ChildResourceInner resource, Context context); + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceInner resource); + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChildResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceInner resource); + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChildResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceInner resource, Context context); + + /** + * Update a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> updateWithResponseAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceUpdate properties); + + /** + * Update a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono updateAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceUpdate properties); + + /** + * Update a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceUpdate properties, Context context); + + /** + * Update a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChildResourceInner update(String resourceGroupName, String topLevelArmResourceName, String childResourceName, + ChildResourceUpdate properties); + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName); + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName); + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName, + String childResourceName); + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, Context context); + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceGroupName, String topLevelArmResourceName, String childResourceName); + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName); + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName, Context context); + + /** + * List ChildResource resources by TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByTopLevelArmResourceAsync(String resourceGroupName, + String topLevelArmResourceName); + + /** + * List ChildResource resources by TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTopLevelArmResource(String resourceGroupName, + String topLevelArmResourceName); + + /** + * List ChildResource resources by TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTopLevelArmResource(String resourceGroupName, + String topLevelArmResourceName, Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> actionWithoutBodyWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName, String childResourceName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginActionWithoutBodyAsync(String resourceGroupName, + String topLevelArmResourceName, String childResourceName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginActionWithoutBody(String resourceGroupName, String topLevelArmResourceName, + String childResourceName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginActionWithoutBody(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono actionWithoutBodyAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName, + Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/CustomTemplateResourceInterfacesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/CustomTemplateResourceInterfacesClient.java new file mode 100644 index 00000000000..4bfceb90f87 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/CustomTemplateResourceInterfacesClient.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner; +import tsptest.armresourceprovider.models.CustomTemplateResourcePatch; + +/** + * An instance of this class provides access to all the operations defined in CustomTemplateResourceInterfacesClient. + */ +public interface CustomTemplateResourceInterfacesClient { + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String customTemplateResourceName, CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch); + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, CustomTemplateResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource, + String ifMatch, String ifNoneMatch); + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, CustomTemplateResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource); + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CustomTemplateResourceInner> beginCreateOrUpdate( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource); + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CustomTemplateResourceInner> beginCreateOrUpdate( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource, + String ifMatch, String ifNoneMatch, Context context); + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(String resourceGroupName, String customTemplateResourceName, + CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch); + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(String resourceGroupName, String customTemplateResourceName, + CustomTemplateResourceInner resource); + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomTemplateResourceInner createOrUpdate(String resourceGroupName, String customTemplateResourceName, + CustomTemplateResourceInner resource); + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomTemplateResourceInner createOrUpdate(String resourceGroupName, String customTemplateResourceName, + CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch, Context context); + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> updateLongRunningWithResponseAsync(String resourceGroupName, + String customTemplateResourceName, CustomTemplateResourcePatch properties); + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, CustomTemplateResourceInner> beginUpdateLongRunningAsync( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourcePatch properties); + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CustomTemplateResourceInner> beginUpdateLongRunning( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourcePatch properties); + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CustomTemplateResourceInner> beginUpdateLongRunning( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourcePatch properties, + Context context); + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono updateLongRunningAsync(String resourceGroupName, + String customTemplateResourceName, CustomTemplateResourcePatch properties); + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomTemplateResourceInner updateLongRunning(String resourceGroupName, String customTemplateResourceName, + CustomTemplateResourcePatch properties); + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomTemplateResourceInner updateLongRunning(String resourceGroupName, String customTemplateResourceName, + CustomTemplateResourcePatch properties, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ImmutableResourceModelsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ImmutableResourceModelsClient.java new file mode 100644 index 00000000000..8d1df5eb8a3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ImmutableResourceModelsClient.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.models.NginxConfigurationRequest; +import tsptest.armresourceprovider.models.NginxConfigurationResponse; + +/** + * An instance of this class provides access to all the operations defined in ImmutableResourceModelsClient. + */ +public interface ImmutableResourceModelsClient { + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties); + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, NginxConfigurationResponse> beginCreateOrUpdateAsync( + String resourceGroupName, String configurationName, NginxConfigurationRequest properties); + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, NginxConfigurationResponse> + beginCreateOrUpdateAsync(String resourceGroupName, String configurationName); + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NginxConfigurationResponse> + beginCreateOrUpdate(String resourceGroupName, String configurationName); + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NginxConfigurationResponse> beginCreateOrUpdate( + String resourceGroupName, String configurationName, NginxConfigurationRequest properties, Context context); + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties); + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(String resourceGroupName, String configurationName); + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName); + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/LroNoBodiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/LroNoBodiesClient.java new file mode 100644 index 00000000000..2bdefd6ca4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/LroNoBodiesClient.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.models.ActionFinalResult; +import tsptest.armresourceprovider.models.ResourceLroNoBody; + +/** + * An instance of this class provides access to all the operations defined in LroNoBodiesClient. + */ +public interface LroNoBodiesClient { + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String resourceLroNoBodyName, ResourceLroNoBody resource); + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ResourceLroNoBody> beginCreateOrUpdateAsync(String resourceGroupName, + String resourceLroNoBodyName, ResourceLroNoBody resource); + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ResourceLroNoBody> beginCreateOrUpdate(String resourceGroupName, + String resourceLroNoBodyName, ResourceLroNoBody resource); + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ResourceLroNoBody> beginCreateOrUpdate(String resourceGroupName, + String resourceLroNoBodyName, ResourceLroNoBody resource, Context context); + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(String resourceGroupName, String resourceLroNoBodyName, + ResourceLroNoBody resource); + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, + ResourceLroNoBody resource); + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, ResourceLroNoBody resource, + Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> actionWithResponseAsync(String resourceGroupName, String resourceLroNoBodyName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ActionFinalResult> beginActionAsync(String resourceGroupName, + String resourceLroNoBodyName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ActionFinalResult> beginAction(String resourceGroupName, + String resourceLroNoBodyName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ActionFinalResult> beginAction(String resourceGroupName, + String resourceLroNoBodyName, Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono actionAsync(String resourceGroupName, String resourceLroNoBodyName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ManagedMaintenanceWindowStatusOperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ManagedMaintenanceWindowStatusOperationsClient.java new file mode 100644 index 00000000000..4be93e21052 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ManagedMaintenanceWindowStatusOperationsClient.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedMaintenanceWindowStatusOperationsClient. + */ +public interface ManagedMaintenanceWindowStatusOperationsClient { + /** + * Get a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedMaintenanceWindowStatusContent along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String managedMaintenanceWindowStatusContentName); + + /** + * Get a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedMaintenanceWindowStatusContent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getByResourceGroupAsync(String resourceGroupName, + String managedMaintenanceWindowStatusContentName); + + /** + * Get a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedMaintenanceWindowStatusContent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, Context context); + + /** + * Get a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedMaintenanceWindowStatusContent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedMaintenanceWindowStatusInner getByResourceGroup(String resourceGroupName, + String managedMaintenanceWindowStatusContentName); + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch); + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch); + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String managedMaintenanceWindowStatusContentName); + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, + String managedMaintenanceWindowStatusContentName); + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch, Context context); + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceGroupName, String managedMaintenanceWindowStatusContentName, String ifMatch, + String ifNoneMatch); + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceGroupName, String managedMaintenanceWindowStatusContentName); + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedMaintenanceWindowStatusContentName); + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedMaintenanceWindowStatusContentName, String ifMatch, + String ifNoneMatch, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ModelInterfaceSameNamesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ModelInterfaceSameNamesClient.java new file mode 100644 index 00000000000..d78cf6da4c4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/ModelInterfaceSameNamesClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner; + +/** + * An instance of this class provides access to all the operations defined in ModelInterfaceSameNamesClient. + */ +public interface ModelInterfaceSameNamesClient { + /** + * Get a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ModelInterfaceDifferentName along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String modelInterfaceDifferentNameName); + + /** + * Get a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ModelInterfaceDifferentName on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getByResourceGroupAsync(String resourceGroupName, + String modelInterfaceDifferentNameName); + + /** + * Get a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ModelInterfaceDifferentName along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String modelInterfaceDifferentNameName, Context context); + + /** + * Get a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ModelInterfaceDifferentName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ModelInterfaceSameNameInner getByResourceGroup(String resourceGroupName, String modelInterfaceDifferentNameName); + + /** + * Delete a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> deleteWithResponseAsync(String resourceGroupName, String modelInterfaceDifferentNameName, + String ifMatch, String ifNoneMatch); + + /** + * Delete a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceGroupName, String modelInterfaceDifferentNameName); + + /** + * Delete a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String modelInterfaceDifferentNameName, String ifMatch, + String ifNoneMatch, Context context); + + /** + * Delete a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String modelInterfaceDifferentNameName); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/OperationsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/OperationsClient.java new file mode 100644 index 00000000000..64ce716c537 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/OperationsClient.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import tsptest.armresourceprovider.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listAsync(); + + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/TopLevelArmResourceInterfacesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/TopLevelArmResourceInterfacesClient.java new file mode 100644 index 00000000000..7e3f679951a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/TopLevelArmResourceInterfacesClient.java @@ -0,0 +1,514 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.models.ResultInner; +import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner; +import tsptest.armresourceprovider.models.TopLevelArmResourceUpdate; + +/** + * An instance of this class provides access to all the operations defined in TopLevelArmResourceInterfacesClient. + */ +public interface TopLevelArmResourceInterfacesClient { + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName); + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getByResourceGroupAsync(String resourceGroupName, String topLevelArmResourceName); + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelArmResourceName, Context context); + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelArmResourceInner getByResourceGroup(String resourceGroupName, String topLevelArmResourceName); + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName, TopLevelArmResourceInner resource); + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, TopLevelArmResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceInner resource); + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( + String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceInner resource); + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( + String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceInner resource, Context context); + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceInner resource); + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceInner resource); + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceInner resource, Context context); + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> updateWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName, TopLevelArmResourceUpdate properties); + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono updateAsync(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceUpdate properties); + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceUpdate properties, Context context); + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelArmResourceInner update(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceUpdate properties); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync(String resourceGroupName, String topLevelArmResourceName); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String topLevelArmResourceName); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName, + Context context); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceGroupName, String topLevelArmResourceName); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String topLevelArmResourceName); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String topLevelArmResourceName, Context context); + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByResourceGroupAsync(String resourceGroupName); + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listAsync(); + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> actionWithResponseAsync(String resourceGroupName, String topLevelArmResourceName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ResultInner> beginActionAsync(String resourceGroupName, + String topLevelArmResourceName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ResultInner> beginAction(String resourceGroupName, + String topLevelArmResourceName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ResultInner> beginAction(String resourceGroupName, + String topLevelArmResourceName, Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono actionAsync(String resourceGroupName, String topLevelArmResourceName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + ResultInner action(String resourceGroupName, String topLevelArmResourceName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + ResultInner action(String resourceGroupName, String topLevelArmResourceName, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildExtensionResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildExtensionResourceInner.java new file mode 100644 index 00000000000..838020dca53 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildExtensionResourceInner.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armresourceprovider.models.ChildExtensionResourceProperties; + +/** + * ExtensionResource of Top Level Arm Resource. + */ +@Fluent +public final class ChildExtensionResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ChildExtensionResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ChildExtensionResourceInner class. + */ + public ChildExtensionResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ChildExtensionResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ChildExtensionResourceInner object itself. + */ + public ChildExtensionResourceInner withProperties(ChildExtensionResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChildExtensionResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChildExtensionResourceInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ChildExtensionResourceInner. + */ + public static ChildExtensionResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChildExtensionResourceInner deserializedChildExtensionResourceInner = new ChildExtensionResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedChildExtensionResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedChildExtensionResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedChildExtensionResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedChildExtensionResourceInner.properties + = ChildExtensionResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedChildExtensionResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedChildExtensionResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceInner.java new file mode 100644 index 00000000000..c9e04bcb71f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceInner.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; +import tsptest.armresourceprovider.models.ProvisioningState; + +/** + * Subresource of Top Level Arm Resource. + */ +@Fluent +public final class ChildResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private ChildResourceProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ChildResourceInner class. + */ + public ChildResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private ChildResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ChildResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ChildResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: Provisioning State of Top Level Arm Resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChildResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChildResourceInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ChildResourceInner. + */ + public static ChildResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChildResourceInner deserializedChildResourceInner = new ChildResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedChildResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedChildResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedChildResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedChildResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedChildResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedChildResourceInner.innerProperties = ChildResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedChildResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedChildResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceProperties.java new file mode 100644 index 00000000000..196e5f35cca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceProperties.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armresourceprovider.models.ProvisioningState; + +/** + * Child Resource Properties. + */ +@Immutable +public final class ChildResourceProperties implements JsonSerializable { + /* + * Provisioning State of Top Level Arm Resource + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of ChildResourceProperties class. + */ + public ChildResourceProperties() { + } + + /** + * Get the provisioningState property: Provisioning State of Top Level Arm Resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChildResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChildResourceProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ChildResourceProperties. + */ + public static ChildResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChildResourceProperties deserializedChildResourceProperties = new ChildResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedChildResourceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedChildResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceInner.java new file mode 100644 index 00000000000..8d31fb9bbf6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceInner.java @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; +import tsptest.armresourceprovider.models.AnonymousEmptyModel; +import tsptest.armresourceprovider.models.Dog; +import tsptest.armresourceprovider.models.EmptyModel; +import tsptest.armresourceprovider.models.ManagedServiceIdentity; +import tsptest.armresourceprovider.models.PriorityModel; +import tsptest.armresourceprovider.models.ProvisioningState; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class CustomTemplateResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private CustomTemplateResourceProperties innerProperties; + + /* + * Managed identity. + */ + private ManagedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CustomTemplateResourceInner class. + */ + public CustomTemplateResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private CustomTemplateResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the identity property: Managed identity. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity. + * + * @param identity the identity value to set. + * @return the CustomTemplateResourceInner object itself. + */ + public CustomTemplateResourceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public CustomTemplateResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CustomTemplateResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the dog property: The dog property. + * + * @return the dog value. + */ + public Dog dog() { + return this.innerProperties() == null ? null : this.innerProperties().dog(); + } + + /** + * Set the dog property: The dog property. + * + * @param dog the dog value to set. + * @return the CustomTemplateResourceInner object itself. + */ + public CustomTemplateResourceInner withDog(Dog dog) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomTemplateResourceProperties(); + } + this.innerProperties().withDog(dog); + return this; + } + + /** + * Get the namedEmptyModel property: The namedEmptyModel property. + * + * @return the namedEmptyModel value. + */ + public EmptyModel namedEmptyModel() { + return this.innerProperties() == null ? null : this.innerProperties().namedEmptyModel(); + } + + /** + * Set the namedEmptyModel property: The namedEmptyModel property. + * + * @param namedEmptyModel the namedEmptyModel value to set. + * @return the CustomTemplateResourceInner object itself. + */ + public CustomTemplateResourceInner withNamedEmptyModel(EmptyModel namedEmptyModel) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomTemplateResourceProperties(); + } + this.innerProperties().withNamedEmptyModel(namedEmptyModel); + return this; + } + + /** + * Get the anonymousEmptyModel property: The anonymousEmptyModel property. + * + * @return the anonymousEmptyModel value. + */ + public AnonymousEmptyModel anonymousEmptyModel() { + return this.innerProperties() == null ? null : this.innerProperties().anonymousEmptyModel(); + } + + /** + * Set the anonymousEmptyModel property: The anonymousEmptyModel property. + * + * @param anonymousEmptyModel the anonymousEmptyModel value to set. + * @return the CustomTemplateResourceInner object itself. + */ + public CustomTemplateResourceInner withAnonymousEmptyModel(AnonymousEmptyModel anonymousEmptyModel) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomTemplateResourceProperties(); + } + this.innerProperties().withAnonymousEmptyModel(anonymousEmptyModel); + return this; + } + + /** + * Get the priority property: The priority property. + * + * @return the priority value. + */ + public PriorityModel priority() { + return this.innerProperties() == null ? null : this.innerProperties().priority(); + } + + /** + * Set the priority property: The priority property. + * + * @param priority the priority value to set. + * @return the CustomTemplateResourceInner object itself. + */ + public CustomTemplateResourceInner withPriority(PriorityModel priority) { + if (this.innerProperties() == null) { + this.innerProperties = new CustomTemplateResourceProperties(); + } + this.innerProperties().withPriority(priority); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomTemplateResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomTemplateResourceInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomTemplateResourceInner. + */ + public static CustomTemplateResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomTemplateResourceInner deserializedCustomTemplateResourceInner = new CustomTemplateResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCustomTemplateResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCustomTemplateResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCustomTemplateResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCustomTemplateResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCustomTemplateResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCustomTemplateResourceInner.innerProperties + = CustomTemplateResourceProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedCustomTemplateResourceInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCustomTemplateResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomTemplateResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceProperties.java new file mode 100644 index 00000000000..a774b37f088 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceProperties.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armresourceprovider.models.AnonymousEmptyModel; +import tsptest.armresourceprovider.models.Dog; +import tsptest.armresourceprovider.models.EmptyModel; +import tsptest.armresourceprovider.models.PriorityModel; +import tsptest.armresourceprovider.models.ProvisioningState; + +/** + * Top Level Arm Resource Properties. + */ +@Fluent +public final class CustomTemplateResourceProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * The dog property. + */ + private Dog dog; + + /* + * The namedEmptyModel property. + */ + private EmptyModel namedEmptyModel; + + /* + * The anonymousEmptyModel property. + */ + private AnonymousEmptyModel anonymousEmptyModel; + + /* + * The priority property. + */ + private PriorityModel priority; + + /** + * Creates an instance of CustomTemplateResourceProperties class. + */ + public CustomTemplateResourceProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the dog property: The dog property. + * + * @return the dog value. + */ + public Dog dog() { + return this.dog; + } + + /** + * Set the dog property: The dog property. + * + * @param dog the dog value to set. + * @return the CustomTemplateResourceProperties object itself. + */ + public CustomTemplateResourceProperties withDog(Dog dog) { + this.dog = dog; + return this; + } + + /** + * Get the namedEmptyModel property: The namedEmptyModel property. + * + * @return the namedEmptyModel value. + */ + public EmptyModel namedEmptyModel() { + return this.namedEmptyModel; + } + + /** + * Set the namedEmptyModel property: The namedEmptyModel property. + * + * @param namedEmptyModel the namedEmptyModel value to set. + * @return the CustomTemplateResourceProperties object itself. + */ + public CustomTemplateResourceProperties withNamedEmptyModel(EmptyModel namedEmptyModel) { + this.namedEmptyModel = namedEmptyModel; + return this; + } + + /** + * Get the anonymousEmptyModel property: The anonymousEmptyModel property. + * + * @return the anonymousEmptyModel value. + */ + public AnonymousEmptyModel anonymousEmptyModel() { + return this.anonymousEmptyModel; + } + + /** + * Set the anonymousEmptyModel property: The anonymousEmptyModel property. + * + * @param anonymousEmptyModel the anonymousEmptyModel value to set. + * @return the CustomTemplateResourceProperties object itself. + */ + public CustomTemplateResourceProperties withAnonymousEmptyModel(AnonymousEmptyModel anonymousEmptyModel) { + this.anonymousEmptyModel = anonymousEmptyModel; + return this; + } + + /** + * Get the priority property: The priority property. + * + * @return the priority value. + */ + public PriorityModel priority() { + return this.priority; + } + + /** + * Set the priority property: The priority property. + * + * @param priority the priority value to set. + * @return the CustomTemplateResourceProperties object itself. + */ + public CustomTemplateResourceProperties withPriority(PriorityModel priority) { + this.priority = priority; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("dog", this.dog); + jsonWriter.writeJsonField("namedEmptyModel", this.namedEmptyModel); + jsonWriter.writeJsonField("anonymousEmptyModel", this.anonymousEmptyModel); + jsonWriter.writeNumberField("priority", this.priority == null ? null : this.priority.getValue()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomTemplateResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomTemplateResourceProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CustomTemplateResourceProperties. + */ + public static CustomTemplateResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomTemplateResourceProperties deserializedCustomTemplateResourceProperties + = new CustomTemplateResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dog".equals(fieldName)) { + deserializedCustomTemplateResourceProperties.dog = Dog.fromJson(reader); + } else if ("namedEmptyModel".equals(fieldName)) { + deserializedCustomTemplateResourceProperties.namedEmptyModel = EmptyModel.fromJson(reader); + } else if ("anonymousEmptyModel".equals(fieldName)) { + deserializedCustomTemplateResourceProperties.anonymousEmptyModel + = AnonymousEmptyModel.fromJson(reader); + } else if ("priority".equals(fieldName)) { + deserializedCustomTemplateResourceProperties.priority = PriorityModel.fromValue(reader.getInt()); + } else if ("provisioningState".equals(fieldName)) { + deserializedCustomTemplateResourceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomTemplateResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusContentProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusContentProperties.java new file mode 100644 index 00000000000..74e16902df0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusContentProperties.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ManagedMaintenanceWindowStatusContentProperties model. + */ +@Immutable +public final class ManagedMaintenanceWindowStatusContentProperties + implements JsonSerializable { + /* + * The status of the last operation. + */ + private String provisioningState; + + /** + * Creates an instance of ManagedMaintenanceWindowStatusContentProperties class. + */ + private ManagedMaintenanceWindowStatusContentProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedMaintenanceWindowStatusContentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedMaintenanceWindowStatusContentProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedMaintenanceWindowStatusContentProperties. + */ + public static ManagedMaintenanceWindowStatusContentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedMaintenanceWindowStatusContentProperties deserializedManagedMaintenanceWindowStatusContentProperties + = new ManagedMaintenanceWindowStatusContentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedManagedMaintenanceWindowStatusContentProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedMaintenanceWindowStatusContentProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusInner.java new file mode 100644 index 00000000000..91f1832d80a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusInner.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Resource for testing conflict name with operation group. + */ +@Immutable +public final class ManagedMaintenanceWindowStatusInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private ManagedMaintenanceWindowStatusContentProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ManagedMaintenanceWindowStatusInner class. + */ + private ManagedMaintenanceWindowStatusInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private ManagedMaintenanceWindowStatusContentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedMaintenanceWindowStatusInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedMaintenanceWindowStatusInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedMaintenanceWindowStatusInner. + */ + public static ManagedMaintenanceWindowStatusInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedMaintenanceWindowStatusInner deserializedManagedMaintenanceWindowStatusInner + = new ManagedMaintenanceWindowStatusInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedManagedMaintenanceWindowStatusInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedManagedMaintenanceWindowStatusInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedManagedMaintenanceWindowStatusInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedManagedMaintenanceWindowStatusInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedManagedMaintenanceWindowStatusInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedManagedMaintenanceWindowStatusInner.innerProperties + = ManagedMaintenanceWindowStatusContentProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedManagedMaintenanceWindowStatusInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedMaintenanceWindowStatusInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceDifferentNameProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceDifferentNameProperties.java new file mode 100644 index 00000000000..159f1d171a6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceDifferentNameProperties.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ModelInterfaceDifferentNameProperties model. + */ +@Immutable +public final class ModelInterfaceDifferentNameProperties + implements JsonSerializable { + /* + * The status of the last operation. + */ + private String provisioningState; + + /** + * Creates an instance of ModelInterfaceDifferentNameProperties class. + */ + private ModelInterfaceDifferentNameProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ModelInterfaceDifferentNameProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ModelInterfaceDifferentNameProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ModelInterfaceDifferentNameProperties. + */ + public static ModelInterfaceDifferentNameProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ModelInterfaceDifferentNameProperties deserializedModelInterfaceDifferentNameProperties + = new ModelInterfaceDifferentNameProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedModelInterfaceDifferentNameProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedModelInterfaceDifferentNameProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceSameNameInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceSameNameInner.java new file mode 100644 index 00000000000..6b7f6f6ed2d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceSameNameInner.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Immutable +public final class ModelInterfaceSameNameInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private ModelInterfaceDifferentNameProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ModelInterfaceSameNameInner class. + */ + private ModelInterfaceSameNameInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private ModelInterfaceDifferentNameProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ModelInterfaceSameNameInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ModelInterfaceSameNameInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ModelInterfaceSameNameInner. + */ + public static ModelInterfaceSameNameInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ModelInterfaceSameNameInner deserializedModelInterfaceSameNameInner = new ModelInterfaceSameNameInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedModelInterfaceSameNameInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedModelInterfaceSameNameInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedModelInterfaceSameNameInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedModelInterfaceSameNameInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedModelInterfaceSameNameInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedModelInterfaceSameNameInner.innerProperties + = ModelInterfaceDifferentNameProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedModelInterfaceSameNameInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedModelInterfaceSameNameInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/OperationInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/OperationInner.java new file mode 100644 index 00000000000..3696e23e091 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armresourceprovider.models.ActionType; +import tsptest.armresourceprovider.models.OperationDisplay; +import tsptest.armresourceprovider.models.Origin; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResourceLroNoBodyProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResourceLroNoBodyProperties.java new file mode 100644 index 00000000000..64581bbe199 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResourceLroNoBodyProperties.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armresourceprovider.models.ProvisioningState; + +/** + * The ResourceLroNoBodyProperties model. + */ +@Immutable +public final class ResourceLroNoBodyProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of ResourceLroNoBodyProperties class. + */ + public ResourceLroNoBodyProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceLroNoBodyProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceLroNoBodyProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceLroNoBodyProperties. + */ + public static ResourceLroNoBodyProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceLroNoBodyProperties deserializedResourceLroNoBodyProperties = new ResourceLroNoBodyProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedResourceLroNoBodyProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceLroNoBodyProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResultInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResultInner.java new file mode 100644 index 00000000000..40e6632c4b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/ResultInner.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Result model. + */ +@Immutable +public final class ResultInner implements JsonSerializable { + /* + * The reason property. + */ + private String reason; + + /** + * Creates an instance of ResultInner class. + */ + private ResultInner() { + } + + /** + * Get the reason property: The reason property. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("reason", this.reason); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResultInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ResultInner. + */ + public static ResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResultInner deserializedResultInner = new ResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("reason".equals(fieldName)) { + deserializedResultInner.reason = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResultInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceInner.java new file mode 100644 index 00000000000..db80385dcab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceInner.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import tsptest.armresourceprovider.models.ProvisioningState; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class TopLevelArmResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private TopLevelArmResourceProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TopLevelArmResourceInner class. + */ + public TopLevelArmResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private TopLevelArmResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public TopLevelArmResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TopLevelArmResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the configurationEndpoints property: Configuration Endpoints. + * + * @return the configurationEndpoints value. + */ + public List configurationEndpoints() { + return this.innerProperties() == null ? null : this.innerProperties().configurationEndpoints(); + } + + /** + * Get the userName property: The userName property. + * + * @return the userName value. + */ + public String userName() { + return this.innerProperties() == null ? null : this.innerProperties().userName(); + } + + /** + * Set the userName property: The userName property. + * + * @param userName the userName value to set. + * @return the TopLevelArmResourceInner object itself. + */ + public TopLevelArmResourceInner withUserName(String userName) { + if (this.innerProperties() == null) { + this.innerProperties = new TopLevelArmResourceProperties(); + } + this.innerProperties().withUserName(userName); + return this; + } + + /** + * Get the userNames property: The userNames property. + * + * @return the userNames value. + */ + public String userNames() { + return this.innerProperties() == null ? null : this.innerProperties().userNames(); + } + + /** + * Set the userNames property: The userNames property. + * + * @param userNames the userNames value to set. + * @return the TopLevelArmResourceInner object itself. + */ + public TopLevelArmResourceInner withUserNames(String userNames) { + if (this.innerProperties() == null) { + this.innerProperties = new TopLevelArmResourceProperties(); + } + this.innerProperties().withUserNames(userNames); + return this; + } + + /** + * Get the accuserName property: The accuserName property. + * + * @return the accuserName value. + */ + public String accuserName() { + return this.innerProperties() == null ? null : this.innerProperties().accuserName(); + } + + /** + * Set the accuserName property: The accuserName property. + * + * @param accuserName the accuserName value to set. + * @return the TopLevelArmResourceInner object itself. + */ + public TopLevelArmResourceInner withAccuserName(String accuserName) { + if (this.innerProperties() == null) { + this.innerProperties = new TopLevelArmResourceProperties(); + } + this.innerProperties().withAccuserName(accuserName); + return this; + } + + /** + * Get the startTimeStamp property: The startTimeStamp property. + * + * @return the startTimeStamp value. + */ + public OffsetDateTime startTimeStamp() { + return this.innerProperties() == null ? null : this.innerProperties().startTimeStamp(); + } + + /** + * Set the startTimeStamp property: The startTimeStamp property. + * + * @param startTimeStamp the startTimeStamp value to set. + * @return the TopLevelArmResourceInner object itself. + */ + public TopLevelArmResourceInner withStartTimeStamp(OffsetDateTime startTimeStamp) { + if (this.innerProperties() == null) { + this.innerProperties = new TopLevelArmResourceProperties(); + } + this.innerProperties().withStartTimeStamp(startTimeStamp); + return this; + } + + /** + * Get the size property: The size property. + * + * @return the size value. + */ + public Float size() { + return this.innerProperties() == null ? null : this.innerProperties().size(); + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelArmResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelArmResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TopLevelArmResourceInner. + */ + public static TopLevelArmResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelArmResourceInner deserializedTopLevelArmResourceInner = new TopLevelArmResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTopLevelArmResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTopLevelArmResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTopLevelArmResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedTopLevelArmResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTopLevelArmResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedTopLevelArmResourceInner.innerProperties + = TopLevelArmResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedTopLevelArmResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelArmResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceProperties.java new file mode 100644 index 00000000000..c569fd3ff52 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceProperties.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import tsptest.armresourceprovider.models.ProvisioningState; + +/** + * Top Level Arm Resource Properties. + */ +@Fluent +public final class TopLevelArmResourceProperties implements JsonSerializable { + /* + * Configuration Endpoints. + */ + private List configurationEndpoints; + + /* + * The userName property. + */ + private String userName; + + /* + * The userNames property. + */ + private String userNames; + + /* + * The accuserName property. + */ + private String accuserName; + + /* + * The startTimeStamp property. + */ + private OffsetDateTime startTimeStamp; + + /* + * The size property. + */ + private Float size; + + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of TopLevelArmResourceProperties class. + */ + public TopLevelArmResourceProperties() { + } + + /** + * Get the configurationEndpoints property: Configuration Endpoints. + * + * @return the configurationEndpoints value. + */ + public List configurationEndpoints() { + return this.configurationEndpoints; + } + + /** + * Get the userName property: The userName property. + * + * @return the userName value. + */ + public String userName() { + return this.userName; + } + + /** + * Set the userName property: The userName property. + * + * @param userName the userName value to set. + * @return the TopLevelArmResourceProperties object itself. + */ + public TopLevelArmResourceProperties withUserName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get the userNames property: The userNames property. + * + * @return the userNames value. + */ + public String userNames() { + return this.userNames; + } + + /** + * Set the userNames property: The userNames property. + * + * @param userNames the userNames value to set. + * @return the TopLevelArmResourceProperties object itself. + */ + public TopLevelArmResourceProperties withUserNames(String userNames) { + this.userNames = userNames; + return this; + } + + /** + * Get the accuserName property: The accuserName property. + * + * @return the accuserName value. + */ + public String accuserName() { + return this.accuserName; + } + + /** + * Set the accuserName property: The accuserName property. + * + * @param accuserName the accuserName value to set. + * @return the TopLevelArmResourceProperties object itself. + */ + public TopLevelArmResourceProperties withAccuserName(String accuserName) { + this.accuserName = accuserName; + return this; + } + + /** + * Get the startTimeStamp property: The startTimeStamp property. + * + * @return the startTimeStamp value. + */ + public OffsetDateTime startTimeStamp() { + return this.startTimeStamp; + } + + /** + * Set the startTimeStamp property: The startTimeStamp property. + * + * @param startTimeStamp the startTimeStamp value to set. + * @return the TopLevelArmResourceProperties object itself. + */ + public TopLevelArmResourceProperties withStartTimeStamp(OffsetDateTime startTimeStamp) { + this.startTimeStamp = startTimeStamp; + return this; + } + + /** + * Get the size property: The size property. + * + * @return the size value. + */ + public Float size() { + return this.size; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("userName", this.userName); + jsonWriter.writeStringField("userNames", this.userNames); + jsonWriter.writeStringField("accuserName", this.accuserName); + jsonWriter.writeStringField("startTimeStamp", + this.startTimeStamp == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTimeStamp)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelArmResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelArmResourceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TopLevelArmResourceProperties. + */ + public static TopLevelArmResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelArmResourceProperties deserializedTopLevelArmResourceProperties + = new TopLevelArmResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userName".equals(fieldName)) { + deserializedTopLevelArmResourceProperties.userName = reader.getString(); + } else if ("userNames".equals(fieldName)) { + deserializedTopLevelArmResourceProperties.userNames = reader.getString(); + } else if ("accuserName".equals(fieldName)) { + deserializedTopLevelArmResourceProperties.accuserName = reader.getString(); + } else if ("startTimeStamp".equals(fieldName)) { + deserializedTopLevelArmResourceProperties.startTimeStamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("configurationEndpoints".equals(fieldName)) { + List configurationEndpoints = reader.readArray(reader1 -> reader1.getString()); + deserializedTopLevelArmResourceProperties.configurationEndpoints = configurationEndpoints; + } else if ("size".equals(fieldName)) { + deserializedTopLevelArmResourceProperties.size = reader.getNullable(JsonReader::getFloat); + } else if ("provisioningState".equals(fieldName)) { + deserializedTopLevelArmResourceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelArmResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceUpdateProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceUpdateProperties.java new file mode 100644 index 00000000000..bb5b15e6d52 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceUpdateProperties.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The updatable properties of the TopLevelArmResource. + */ +@Fluent +public final class TopLevelArmResourceUpdateProperties + implements JsonSerializable { + /* + * The userName property. + */ + private String userName; + + /* + * The userNames property. + */ + private String userNames; + + /* + * The accuserName property. + */ + private String accuserName; + + /** + * Creates an instance of TopLevelArmResourceUpdateProperties class. + */ + public TopLevelArmResourceUpdateProperties() { + } + + /** + * Get the userName property: The userName property. + * + * @return the userName value. + */ + public String userName() { + return this.userName; + } + + /** + * Set the userName property: The userName property. + * + * @param userName the userName value to set. + * @return the TopLevelArmResourceUpdateProperties object itself. + */ + public TopLevelArmResourceUpdateProperties withUserName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get the userNames property: The userNames property. + * + * @return the userNames value. + */ + public String userNames() { + return this.userNames; + } + + /** + * Set the userNames property: The userNames property. + * + * @param userNames the userNames value to set. + * @return the TopLevelArmResourceUpdateProperties object itself. + */ + public TopLevelArmResourceUpdateProperties withUserNames(String userNames) { + this.userNames = userNames; + return this; + } + + /** + * Get the accuserName property: The accuserName property. + * + * @return the accuserName value. + */ + public String accuserName() { + return this.accuserName; + } + + /** + * Set the accuserName property: The accuserName property. + * + * @param accuserName the accuserName value to set. + * @return the TopLevelArmResourceUpdateProperties object itself. + */ + public TopLevelArmResourceUpdateProperties withAccuserName(String accuserName) { + this.accuserName = accuserName; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("userName", this.userName); + jsonWriter.writeStringField("userNames", this.userNames); + jsonWriter.writeStringField("accuserName", this.accuserName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelArmResourceUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelArmResourceUpdateProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TopLevelArmResourceUpdateProperties. + */ + public static TopLevelArmResourceUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelArmResourceUpdateProperties deserializedTopLevelArmResourceUpdateProperties + = new TopLevelArmResourceUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userName".equals(fieldName)) { + deserializedTopLevelArmResourceUpdateProperties.userName = reader.getString(); + } else if ("userNames".equals(fieldName)) { + deserializedTopLevelArmResourceUpdateProperties.userNames = reader.getString(); + } else if ("accuserName".equals(fieldName)) { + deserializedTopLevelArmResourceUpdateProperties.accuserName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelArmResourceUpdateProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/package-info.java new file mode 100644 index 00000000000..4372b5cb021 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for ArmResourceProvider. + * Arm Resource Provider management API. + */ +package tsptest.armresourceprovider.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/package-info.java new file mode 100644 index 00000000000..d08dbd0d90f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for ArmResourceProvider. + * Arm Resource Provider management API. + */ +package tsptest.armresourceprovider.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientBuilder.java new file mode 100644 index 00000000000..f0838533b6a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the ArmClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ArmClientImpl.class }) +public final class ArmClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ArmClientBuilder. + */ + public ArmClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the ArmClientBuilder. + */ + public ArmClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ArmClientBuilder. + */ + public ArmClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 ArmClientBuilder. + */ + public ArmClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ArmClientBuilder. + */ + public ArmClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 ArmClientBuilder. + */ + public ArmClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ArmClientImpl with the provided parameters. + * + * @return an instance of ArmClientImpl. + */ + public ArmClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + ArmClientImpl client = new ArmClientImpl(localPipeline, localSerializerAdapter, localDefaultPollInterval, + localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java new file mode 100644 index 00000000000..9f6b0870f52 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java @@ -0,0 +1,436 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.ArmClient; +import tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient; +import tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient; +import tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient; +import tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient; +import tsptest.armresourceprovider.fluent.LroNoBodiesClient; +import tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient; +import tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient; +import tsptest.armresourceprovider.fluent.OperationsClient; +import tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient; + +/** + * Initializes a new instance of the ArmClientImpl type. + */ +@ServiceClient(builder = ArmClientBuilder.class) +public final class ArmClientImpl implements ArmClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The ChildResourcesInterfacesClient object to access its operations. + */ + private final ChildResourcesInterfacesClient childResourcesInterfaces; + + /** + * Gets the ChildResourcesInterfacesClient object to access its operations. + * + * @return the ChildResourcesInterfacesClient object. + */ + public ChildResourcesInterfacesClient getChildResourcesInterfaces() { + return this.childResourcesInterfaces; + } + + /** + * The TopLevelArmResourceInterfacesClient object to access its operations. + */ + private final TopLevelArmResourceInterfacesClient topLevelArmResourceInterfaces; + + /** + * Gets the TopLevelArmResourceInterfacesClient object to access its operations. + * + * @return the TopLevelArmResourceInterfacesClient object. + */ + public TopLevelArmResourceInterfacesClient getTopLevelArmResourceInterfaces() { + return this.topLevelArmResourceInterfaces; + } + + /** + * The CustomTemplateResourceInterfacesClient object to access its operations. + */ + private final CustomTemplateResourceInterfacesClient customTemplateResourceInterfaces; + + /** + * Gets the CustomTemplateResourceInterfacesClient object to access its operations. + * + * @return the CustomTemplateResourceInterfacesClient object. + */ + public CustomTemplateResourceInterfacesClient getCustomTemplateResourceInterfaces() { + return this.customTemplateResourceInterfaces; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The ChildExtensionResourceInterfacesClient object to access its operations. + */ + private final ChildExtensionResourceInterfacesClient childExtensionResourceInterfaces; + + /** + * Gets the ChildExtensionResourceInterfacesClient object to access its operations. + * + * @return the ChildExtensionResourceInterfacesClient object. + */ + public ChildExtensionResourceInterfacesClient getChildExtensionResourceInterfaces() { + return this.childExtensionResourceInterfaces; + } + + /** + * The ManagedMaintenanceWindowStatusOperationsClient object to access its operations. + */ + private final ManagedMaintenanceWindowStatusOperationsClient managedMaintenanceWindowStatusOperations; + + /** + * Gets the ManagedMaintenanceWindowStatusOperationsClient object to access its operations. + * + * @return the ManagedMaintenanceWindowStatusOperationsClient object. + */ + public ManagedMaintenanceWindowStatusOperationsClient getManagedMaintenanceWindowStatusOperations() { + return this.managedMaintenanceWindowStatusOperations; + } + + /** + * The ModelInterfaceSameNamesClient object to access its operations. + */ + private final ModelInterfaceSameNamesClient modelInterfaceSameNames; + + /** + * Gets the ModelInterfaceSameNamesClient object to access its operations. + * + * @return the ModelInterfaceSameNamesClient object. + */ + public ModelInterfaceSameNamesClient getModelInterfaceSameNames() { + return this.modelInterfaceSameNames; + } + + /** + * The ImmutableResourceModelsClient object to access its operations. + */ + private final ImmutableResourceModelsClient immutableResourceModels; + + /** + * Gets the ImmutableResourceModelsClient object to access its operations. + * + * @return the ImmutableResourceModelsClient object. + */ + public ImmutableResourceModelsClient getImmutableResourceModels() { + return this.immutableResourceModels; + } + + /** + * The LroNoBodiesClient object to access its operations. + */ + private final LroNoBodiesClient lroNoBodies; + + /** + * Gets the LroNoBodiesClient object to access its operations. + * + * @return the LroNoBodiesClient object. + */ + public LroNoBodiesClient getLroNoBodies() { + return this.lroNoBodies; + } + + /** + * Initializes an instance of ArmClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + ArmClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2023-11-01"; + this.childResourcesInterfaces = new ChildResourcesInterfacesClientImpl(this); + this.topLevelArmResourceInterfaces = new TopLevelArmResourceInterfacesClientImpl(this); + this.customTemplateResourceInterfaces = new CustomTemplateResourceInterfacesClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.childExtensionResourceInterfaces = new ChildExtensionResourceInterfacesClientImpl(this); + this.managedMaintenanceWindowStatusOperations = new ManagedMaintenanceWindowStatusOperationsClientImpl(this); + this.modelInterfaceSameNames = new ModelInterfaceSameNamesClientImpl(this); + this.immutableResourceModels = new ImmutableResourceModelsClientImpl(this); + this.lroNoBodies = new LroNoBodiesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ArmClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceImpl.java new file mode 100644 index 00000000000..29c95794440 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceImpl.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner; +import tsptest.armresourceprovider.models.ChildExtensionResource; +import tsptest.armresourceprovider.models.ChildExtensionResourceProperties; +import tsptest.armresourceprovider.models.ChildExtensionResourceUpdate; + +public final class ChildExtensionResourceImpl + implements ChildExtensionResource, ChildExtensionResource.Definition, ChildExtensionResource.Update { + private ChildExtensionResourceInner innerObject; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ChildExtensionResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ChildExtensionResourceInner innerModel() { + return this.innerObject; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String topLevelArmResourceName; + + private String childExtensionResourceName; + + private ChildExtensionResourceUpdate updateProperties; + + public ChildExtensionResourceImpl withExistingTopLevelArmResource(String resourceUri, + String topLevelArmResourceName) { + this.resourceUri = resourceUri; + this.topLevelArmResourceName = topLevelArmResourceName; + return this; + } + + public ChildExtensionResource create() { + this.innerObject = serviceManager.serviceClient() + .getChildExtensionResourceInterfaces() + .createOrUpdate(resourceUri, topLevelArmResourceName, childExtensionResourceName, this.innerModel(), + Context.NONE); + return this; + } + + public ChildExtensionResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getChildExtensionResourceInterfaces() + .createOrUpdate(resourceUri, topLevelArmResourceName, childExtensionResourceName, this.innerModel(), + context); + return this; + } + + ChildExtensionResourceImpl(String name, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = new ChildExtensionResourceInner(); + this.serviceManager = serviceManager; + this.childExtensionResourceName = name; + } + + public ChildExtensionResourceImpl update() { + this.updateProperties = new ChildExtensionResourceUpdate(); + return this; + } + + public ChildExtensionResource apply() { + this.innerObject = serviceManager.serviceClient() + .getChildExtensionResourceInterfaces() + .updateWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, updateProperties, + Context.NONE) + .getValue(); + return this; + } + + public ChildExtensionResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getChildExtensionResourceInterfaces() + .updateWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, updateProperties, + context) + .getValue(); + return this; + } + + ChildExtensionResourceImpl(ChildExtensionResourceInner innerObject, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "resourceUri"); + this.topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "topLevelArmResourceName"); + this.childExtensionResourceName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "childExtensionResourceName"); + } + + public ChildExtensionResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getChildExtensionResourceInterfaces() + .getWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, Context.NONE) + .getValue(); + return this; + } + + public ChildExtensionResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getChildExtensionResourceInterfaces() + .getWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, context) + .getValue(); + return this; + } + + public ChildExtensionResourceImpl withProperties(ChildExtensionResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java new file mode 100644 index 00000000000..62dc0feffe9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java @@ -0,0 +1,899 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient; +import tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner; +import tsptest.armresourceprovider.implementation.models.ChildExtensionResourceListResult; +import tsptest.armresourceprovider.models.ChildExtensionResourceUpdate; + +/** + * An instance of this class provides access to all the operations defined in ChildExtensionResourceInterfacesClient. + */ +public final class ChildExtensionResourceInterfacesClientImpl implements ChildExtensionResourceInterfacesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ChildExtensionResourceInterfacesService service; + + /** + * The service client containing this operation class. + */ + private final ArmClientImpl client; + + /** + * Initializes an instance of ChildExtensionResourceInterfacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ChildExtensionResourceInterfacesClientImpl(ArmClientImpl client) { + this.service = RestProxy.create(ChildExtensionResourceInterfacesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmClientChildExtensionResourceInterfaces to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmClientChildExtensionResourceInterfaces") + public interface ChildExtensionResourceInterfacesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childExtensionResourceName") String childExtensionResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childExtensionResourceName") String childExtensionResourceName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childExtensionResourceName") String childExtensionResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ChildExtensionResourceInner resource, Context context); + + @Put("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childExtensionResourceName") String childExtensionResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ChildExtensionResourceInner resource, Context context); + + @Patch("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childExtensionResourceName") String childExtensionResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ChildExtensionResourceUpdate properties, Context context); + + @Patch("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childExtensionResourceName") String childExtensionResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ChildExtensionResourceUpdate properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childExtensionResourceName") String childExtensionResourceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childExtensionResourceName") String childExtensionResourceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTopLevelArmResource( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByTopLevelArmResourceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTopLevelArmResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByTopLevelArmResourceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildExtensionResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String resourceUri, + String topLevelArmResourceName, String childExtensionResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + topLevelArmResourceName, childExtensionResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildExtensionResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName) { + return getWithResponseAsync(resourceUri, topLevelArmResourceName, childExtensionResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildExtensionResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + topLevelArmResourceName, childExtensionResourceName, accept, context); + } + + /** + * Get a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildExtensionResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChildExtensionResourceInner get(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName) { + return getWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, Context.NONE) + .getValue(); + } + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync(String resourceUri, + String topLevelArmResourceName, String childExtensionResourceName, ChildExtensionResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + topLevelArmResourceName, childExtensionResourceName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + topLevelArmResourceName, childExtensionResourceName, contentType, accept, resource, Context.NONE); + } + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + topLevelArmResourceName, childExtensionResourceName, contentType, accept, resource, context); + } + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of extensionResource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, ChildExtensionResourceInner> beginCreateOrUpdateAsync( + String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, + ChildExtensionResourceInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceUri, topLevelArmResourceName, + childExtensionResourceName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ChildExtensionResourceInner.class, ChildExtensionResourceInner.class, + this.client.getContext()); + } + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of extensionResource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ChildExtensionResourceInner> beginCreateOrUpdate( + String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, + ChildExtensionResourceInner resource) { + Response response + = createOrUpdateWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, resource); + return this.client.getLroResult(response, + ChildExtensionResourceInner.class, ChildExtensionResourceInner.class, Context.NONE); + } + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of extensionResource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ChildExtensionResourceInner> beginCreateOrUpdate( + String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, + ChildExtensionResourceInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceUri, topLevelArmResourceName, + childExtensionResourceName, resource, context); + return this.client.getLroResult(response, + ChildExtensionResourceInner.class, ChildExtensionResourceInner.class, context); + } + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceInner resource) { + return beginCreateOrUpdateAsync(resourceUri, topLevelArmResourceName, childExtensionResourceName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChildExtensionResourceInner createOrUpdate(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceInner resource) { + return beginCreateOrUpdate(resourceUri, topLevelArmResourceName, childExtensionResourceName, resource) + .getFinalResult(); + } + + /** + * Create a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChildExtensionResourceInner createOrUpdate(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceInner resource, Context context) { + return beginCreateOrUpdate(resourceUri, topLevelArmResourceName, childExtensionResourceName, resource, context) + .getFinalResult(); + } + + /** + * Update a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync(String resourceUri, + String topLevelArmResourceName, String childExtensionResourceName, ChildExtensionResourceUpdate properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + topLevelArmResourceName, childExtensionResourceName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceUpdate properties) { + return updateWithResponseAsync(resourceUri, topLevelArmResourceName, childExtensionResourceName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceUpdate properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + topLevelArmResourceName, childExtensionResourceName, contentType, accept, properties, context); + } + + /** + * Update a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extensionResource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChildExtensionResourceInner update(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, ChildExtensionResourceUpdate properties) { + return updateWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, properties, + Context.NONE).getValue(); + } + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> deleteWithResponseAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + topLevelArmResourceName, childExtensionResourceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + topLevelArmResourceName, childExtensionResourceName, Context.NONE); + } + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + topLevelArmResourceName, childExtensionResourceName, context); + } + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, Void> beginDeleteAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName) { + Mono>> mono + = deleteWithResponseAsync(resourceUri, topLevelArmResourceName, childExtensionResourceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName) { + Response response + = deleteWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, Context context) { + Response response + = deleteWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName) { + return beginDeleteAsync(resourceUri, topLevelArmResourceName, childExtensionResourceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName) { + beginDelete(resourceUri, topLevelArmResourceName, childExtensionResourceName).getFinalResult(); + } + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, + Context context) { + beginDelete(resourceUri, topLevelArmResourceName, childExtensionResourceName, context).getFinalResult(); + } + + /** + * List ChildExtensionResource resources by TopLevelArmResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ChildExtensionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByTopLevelArmResourceSinglePageAsync(String resourceUri, String topLevelArmResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByTopLevelArmResource(this.client.getEndpoint(), + this.client.getApiVersion(), resourceUri, topLevelArmResourceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List ChildExtensionResource resources by TopLevelArmResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByTopLevelArmResourceAsync(String resourceUri, + String topLevelArmResourceName) { + return new PagedFlux<>(() -> listByTopLevelArmResourceSinglePageAsync(resourceUri, topLevelArmResourceName), + nextLink -> listByTopLevelArmResourceNextSinglePageAsync(nextLink)); + } + + /** + * List ChildExtensionResource resources by TopLevelArmResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ChildExtensionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTopLevelArmResourceSinglePage(String resourceUri, + String topLevelArmResourceName) { + final String accept = "application/json"; + Response res + = service.listByTopLevelArmResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + topLevelArmResourceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ChildExtensionResource resources by TopLevelArmResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ChildExtensionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTopLevelArmResourceSinglePage(String resourceUri, + String topLevelArmResourceName, Context context) { + final String accept = "application/json"; + Response res + = service.listByTopLevelArmResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + topLevelArmResourceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ChildExtensionResource resources by TopLevelArmResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTopLevelArmResource(String resourceUri, + String topLevelArmResourceName) { + return new PagedIterable<>(() -> listByTopLevelArmResourceSinglePage(resourceUri, topLevelArmResourceName), + nextLink -> listByTopLevelArmResourceNextSinglePage(nextLink)); + } + + /** + * List ChildExtensionResource resources by TopLevelArmResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTopLevelArmResource(String resourceUri, + String topLevelArmResourceName, Context context) { + return new PagedIterable<>( + () -> listByTopLevelArmResourceSinglePage(resourceUri, topLevelArmResourceName, context), + nextLink -> listByTopLevelArmResourceNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ChildExtensionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByTopLevelArmResourceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByTopLevelArmResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ChildExtensionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTopLevelArmResourceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByTopLevelArmResourceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a ChildExtensionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTopLevelArmResourceNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByTopLevelArmResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesImpl.java new file mode 100644 index 00000000000..51e14bb9a49 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient; +import tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner; +import tsptest.armresourceprovider.models.ChildExtensionResource; +import tsptest.armresourceprovider.models.ChildExtensionResourceInterfaces; + +public final class ChildExtensionResourceInterfacesImpl implements ChildExtensionResourceInterfaces { + private static final ClientLogger LOGGER = new ClientLogger(ChildExtensionResourceInterfacesImpl.class); + + private final ChildExtensionResourceInterfacesClient innerClient; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public ChildExtensionResourceInterfacesImpl(ChildExtensionResourceInterfacesClient innerClient, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ChildExtensionResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ChildExtensionResource get(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName) { + ChildExtensionResourceInner inner + = this.serviceClient().get(resourceUri, topLevelArmResourceName, childExtensionResourceName); + if (inner != null) { + return new ChildExtensionResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName) { + this.serviceClient().delete(resourceUri, topLevelArmResourceName, childExtensionResourceName); + } + + public void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, + Context context) { + this.serviceClient().delete(resourceUri, topLevelArmResourceName, childExtensionResourceName, context); + } + + public PagedIterable listByTopLevelArmResource(String resourceUri, + String topLevelArmResourceName) { + PagedIterable inner + = this.serviceClient().listByTopLevelArmResource(resourceUri, topLevelArmResourceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ChildExtensionResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByTopLevelArmResource(String resourceUri, + String topLevelArmResourceName, Context context) { + PagedIterable inner + = this.serviceClient().listByTopLevelArmResource(resourceUri, topLevelArmResourceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ChildExtensionResourceImpl(inner1, this.manager())); + } + + public ChildExtensionResource getById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "topLevelArmResourceName"); + if (topLevelArmResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + String childExtensionResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "childExtensionResourceName"); + if (childExtensionResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'childExtensionResources'.", id))); + } + return this.getWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "topLevelArmResourceName"); + if (topLevelArmResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + String childExtensionResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "childExtensionResourceName"); + if (childExtensionResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'childExtensionResources'.", id))); + } + return this.getWithResponse(resourceUri, topLevelArmResourceName, childExtensionResourceName, context); + } + + public void deleteById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "topLevelArmResourceName"); + if (topLevelArmResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + String childExtensionResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "childExtensionResourceName"); + if (childExtensionResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'childExtensionResources'.", id))); + } + this.delete(resourceUri, topLevelArmResourceName, childExtensionResourceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "topLevelArmResourceName"); + if (topLevelArmResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + String childExtensionResourceName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childExtensionResources/{childExtensionResourceName}", + "childExtensionResourceName"); + if (childExtensionResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'childExtensionResources'.", id))); + } + this.delete(resourceUri, topLevelArmResourceName, childExtensionResourceName, context); + } + + private ChildExtensionResourceInterfacesClient serviceClient() { + return this.innerClient; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } + + public ChildExtensionResourceImpl define(String name) { + return new ChildExtensionResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java new file mode 100644 index 00000000000..495b29a7b42 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Collections; +import java.util.Map; +import tsptest.armresourceprovider.fluent.models.ChildResourceInner; +import tsptest.armresourceprovider.models.ChildResource; +import tsptest.armresourceprovider.models.ChildResourceUpdate; +import tsptest.armresourceprovider.models.ProvisioningState; + +public final class ChildResourceImpl implements ChildResource, ChildResource.Definition, ChildResource.Update { + private ChildResourceInner innerObject; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ChildResourceInner innerModel() { + return this.innerObject; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String topLevelArmResourceName; + + private String childResourceName; + + private ChildResourceUpdate updateProperties; + + public ChildResourceImpl withExistingTopLevelArmResource(String resourceGroupName, String topLevelArmResourceName) { + this.resourceGroupName = resourceGroupName; + this.topLevelArmResourceName = topLevelArmResourceName; + return this; + } + + public ChildResource create() { + this.innerObject = serviceManager.serviceClient() + .getChildResourcesInterfaces() + .createOrUpdate(resourceGroupName, topLevelArmResourceName, childResourceName, this.innerModel(), + Context.NONE); + return this; + } + + public ChildResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getChildResourcesInterfaces() + .createOrUpdate(resourceGroupName, topLevelArmResourceName, childResourceName, this.innerModel(), context); + return this; + } + + ChildResourceImpl(String name, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = new ChildResourceInner(); + this.serviceManager = serviceManager; + this.childResourceName = name; + } + + public ChildResourceImpl update() { + this.updateProperties = new ChildResourceUpdate(); + return this; + } + + public ChildResource apply() { + this.innerObject = serviceManager.serviceClient() + .getChildResourcesInterfaces() + .updateWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, updateProperties, + Context.NONE) + .getValue(); + return this; + } + + public ChildResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getChildResourcesInterfaces() + .updateWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, updateProperties, + context) + .getValue(); + return this; + } + + ChildResourceImpl(ChildResourceInner innerObject, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.topLevelArmResourceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "topLevelArmResources"); + this.childResourceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "childResources"); + } + + public ChildResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getChildResourcesInterfaces() + .getWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, Context.NONE) + .getValue(); + return this; + } + + public ChildResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getChildResourcesInterfaces() + .getWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, context) + .getValue(); + return this; + } + + public void actionWithoutBody() { + serviceManager.childResourcesInterfaces() + .actionWithoutBody(resourceGroupName, topLevelArmResourceName, childResourceName); + } + + public void actionWithoutBody(Context context) { + serviceManager.childResourcesInterfaces() + .actionWithoutBody(resourceGroupName, topLevelArmResourceName, childResourceName, context); + } + + public ChildResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ChildResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ChildResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java new file mode 100644 index 00000000000..89e5d362ce6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java @@ -0,0 +1,1088 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient; +import tsptest.armresourceprovider.fluent.models.ChildResourceInner; +import tsptest.armresourceprovider.implementation.models.ChildResourceListResult; +import tsptest.armresourceprovider.models.ChildResourceUpdate; + +/** + * An instance of this class provides access to all the operations defined in ChildResourcesInterfacesClient. + */ +public final class ChildResourcesInterfacesClientImpl implements ChildResourcesInterfacesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ChildResourcesInterfacesService service; + + /** + * The service client containing this operation class. + */ + private final ArmClientImpl client; + + /** + * Initializes an instance of ChildResourcesInterfacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ChildResourcesInterfacesClientImpl(ArmClientImpl client) { + this.service = RestProxy.create(ChildResourcesInterfacesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmClientChildResourcesInterfaces to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmClientChildResourcesInterfaces") + public interface ChildResourcesInterfacesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childResourceName") String childResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childResourceName") String childResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childResourceName") String childResourceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ChildResourceInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childResourceName") String childResourceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ChildResourceInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childResourceName") String childResourceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ChildResourceUpdate properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childResourceName") String childResourceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ChildResourceUpdate properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childResourceName") String childResourceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childResourceName") String childResourceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTopLevelArmResource(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByTopLevelArmResourceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}/actionWithoutBody") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> actionWithoutBody(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childResourceName") String childResourceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/childResources/{childResourceName}/actionWithoutBody") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response actionWithoutBodySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @PathParam("childResourceName") String childResourceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTopLevelArmResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByTopLevelArmResourceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName, String childResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName) { + return getWithResponseAsync(resourceGroupName, topLevelArmResourceName, childResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, topLevelArmResourceName, childResourceName, accept, context); + } + + /** + * Get a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChildResourceInner get(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { + return getWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, Context.NONE).getValue(); + } + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName, String childResourceName, ChildResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, contentType, + accept, resource, Context.NONE); + } + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, contentType, + accept, resource, context); + } + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of subresource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, ChildResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String topLevelArmResourceName, String childResourceName, + ChildResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, topLevelArmResourceName, childResourceName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ChildResourceInner.class, ChildResourceInner.class, this.client.getContext()); + } + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of subresource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ChildResourceInner> beginCreateOrUpdate(String resourceGroupName, + String topLevelArmResourceName, String childResourceName, ChildResourceInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, resource); + return this.client.getLroResult(response, ChildResourceInner.class, + ChildResourceInner.class, Context.NONE); + } + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of subresource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ChildResourceInner> beginCreateOrUpdate(String resourceGroupName, + String topLevelArmResourceName, String childResourceName, ChildResourceInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourceName, + childResourceName, resource, context); + return this.client.getLroResult(response, ChildResourceInner.class, + ChildResourceInner.class, context); + } + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, topLevelArmResourceName, childResourceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChildResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceInner resource) { + return beginCreateOrUpdate(resourceGroupName, topLevelArmResourceName, childResourceName, resource) + .getFinalResult(); + } + + /** + * Create a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChildResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, topLevelArmResourceName, childResourceName, resource, context) + .getFinalResult(); + } + + /** + * Update a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName, String childResourceName, ChildResourceUpdate properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, + contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceUpdate properties) { + return updateWithResponseAsync(resourceGroupName, topLevelArmResourceName, childResourceName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, ChildResourceUpdate properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, contentType, + accept, properties, context); + } + + /** + * Update a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return subresource of Top Level Arm Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChildResourceInner update(String resourceGroupName, String topLevelArmResourceName, String childResourceName, + ChildResourceUpdate properties) { + return updateWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, properties, + Context.NONE).getValue(); + } + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> deleteWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName, String childResourceName) { + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String topLevelArmResourceName, + String childResourceName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, + Context.NONE); + } + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, context); + } + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, topLevelArmResourceName, childResourceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName, + String childResourceName) { + Response response + = deleteWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { + return beginDeleteAsync(resourceGroupName, topLevelArmResourceName, childResourceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { + beginDelete(resourceGroupName, topLevelArmResourceName, childResourceName).getFinalResult(); + } + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName, + Context context) { + beginDelete(resourceGroupName, topLevelArmResourceName, childResourceName, context).getFinalResult(); + } + + /** + * List ChildResource resources by TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTopLevelArmResourceSinglePageAsync(String resourceGroupName, + String topLevelArmResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByTopLevelArmResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List ChildResource resources by TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByTopLevelArmResourceAsync(String resourceGroupName, + String topLevelArmResourceName) { + return new PagedFlux<>( + () -> listByTopLevelArmResourceSinglePageAsync(resourceGroupName, topLevelArmResourceName), + nextLink -> listByTopLevelArmResourceNextSinglePageAsync(nextLink)); + } + + /** + * List ChildResource resources by TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTopLevelArmResourceSinglePage(String resourceGroupName, + String topLevelArmResourceName) { + final String accept = "application/json"; + Response res + = service.listByTopLevelArmResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ChildResource resources by TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTopLevelArmResourceSinglePage(String resourceGroupName, + String topLevelArmResourceName, Context context) { + final String accept = "application/json"; + Response res + = service.listByTopLevelArmResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ChildResource resources by TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTopLevelArmResource(String resourceGroupName, + String topLevelArmResourceName) { + return new PagedIterable<>( + () -> listByTopLevelArmResourceSinglePage(resourceGroupName, topLevelArmResourceName), + nextLink -> listByTopLevelArmResourceNextSinglePage(nextLink)); + } + + /** + * List ChildResource resources by TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTopLevelArmResource(String resourceGroupName, + String topLevelArmResourceName, Context context) { + return new PagedIterable<>( + () -> listByTopLevelArmResourceSinglePage(resourceGroupName, topLevelArmResourceName, context), + nextLink -> listByTopLevelArmResourceNextSinglePage(nextLink, context)); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> actionWithoutBodyWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName, String childResourceName) { + return FluxUtil + .withContext(context -> service.actionWithoutBody(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response actionWithoutBodyWithResponse(String resourceGroupName, String topLevelArmResourceName, + String childResourceName) { + return service.actionWithoutBodySync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, + Context.NONE); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response actionWithoutBodyWithResponse(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, Context context) { + return service.actionWithoutBodySync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, childResourceName, context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, Void> beginActionWithoutBodyAsync(String resourceGroupName, + String topLevelArmResourceName, String childResourceName) { + Mono>> mono + = actionWithoutBodyWithResponseAsync(resourceGroupName, topLevelArmResourceName, childResourceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginActionWithoutBody(String resourceGroupName, + String topLevelArmResourceName, String childResourceName) { + Response response + = actionWithoutBodyWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginActionWithoutBody(String resourceGroupName, + String topLevelArmResourceName, String childResourceName, Context context) { + Response response + = actionWithoutBodyWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono actionWithoutBodyAsync(String resourceGroupName, String topLevelArmResourceName, + String childResourceName) { + return beginActionWithoutBodyAsync(resourceGroupName, topLevelArmResourceName, childResourceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { + beginActionWithoutBody(resourceGroupName, topLevelArmResourceName, childResourceName).getFinalResult(); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName, + Context context) { + beginActionWithoutBody(resourceGroupName, topLevelArmResourceName, childResourceName, context).getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTopLevelArmResourceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByTopLevelArmResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTopLevelArmResourceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByTopLevelArmResourceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTopLevelArmResourceNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByTopLevelArmResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesImpl.java new file mode 100644 index 00000000000..23014261973 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient; +import tsptest.armresourceprovider.fluent.models.ChildResourceInner; +import tsptest.armresourceprovider.models.ChildResource; +import tsptest.armresourceprovider.models.ChildResourcesInterfaces; + +public final class ChildResourcesInterfacesImpl implements ChildResourcesInterfaces { + private static final ClientLogger LOGGER = new ClientLogger(ChildResourcesInterfacesImpl.class); + + private final ChildResourcesInterfacesClient innerClient; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public ChildResourcesInterfacesImpl(ChildResourcesInterfacesClient innerClient, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ChildResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ChildResource get(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { + ChildResourceInner inner + = this.serviceClient().get(resourceGroupName, topLevelArmResourceName, childResourceName); + if (inner != null) { + return new ChildResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { + this.serviceClient().delete(resourceGroupName, topLevelArmResourceName, childResourceName); + } + + public void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName, + Context context) { + this.serviceClient().delete(resourceGroupName, topLevelArmResourceName, childResourceName, context); + } + + public PagedIterable listByTopLevelArmResource(String resourceGroupName, + String topLevelArmResourceName) { + PagedIterable inner + = this.serviceClient().listByTopLevelArmResource(resourceGroupName, topLevelArmResourceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ChildResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByTopLevelArmResource(String resourceGroupName, + String topLevelArmResourceName, Context context) { + PagedIterable inner + = this.serviceClient().listByTopLevelArmResource(resourceGroupName, topLevelArmResourceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ChildResourceImpl(inner1, this.manager())); + } + + public void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName) { + this.serviceClient().actionWithoutBody(resourceGroupName, topLevelArmResourceName, childResourceName); + } + + public void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName, + Context context) { + this.serviceClient().actionWithoutBody(resourceGroupName, topLevelArmResourceName, childResourceName, context); + } + + public ChildResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + String childResourceName = ResourceManagerUtils.getValueFromIdByName(id, "childResources"); + if (childResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'childResources'.", id))); + } + return this.getWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + String childResourceName = ResourceManagerUtils.getValueFromIdByName(id, "childResources"); + if (childResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'childResources'.", id))); + } + return this.getWithResponse(resourceGroupName, topLevelArmResourceName, childResourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + String childResourceName = ResourceManagerUtils.getValueFromIdByName(id, "childResources"); + if (childResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'childResources'.", id))); + } + this.delete(resourceGroupName, topLevelArmResourceName, childResourceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + String childResourceName = ResourceManagerUtils.getValueFromIdByName(id, "childResources"); + if (childResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'childResources'.", id))); + } + this.delete(resourceGroupName, topLevelArmResourceName, childResourceName, context); + } + + private ChildResourcesInterfacesClient serviceClient() { + return this.innerClient; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } + + public ChildResourceImpl define(String name) { + return new ChildResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java new file mode 100644 index 00000000000..9c64a9ca0c5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Collections; +import java.util.Map; +import tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner; +import tsptest.armresourceprovider.models.AnonymousEmptyModel; +import tsptest.armresourceprovider.models.CustomTemplateResource; +import tsptest.armresourceprovider.models.CustomTemplateResourcePatch; +import tsptest.armresourceprovider.models.Dog; +import tsptest.armresourceprovider.models.EmptyModel; +import tsptest.armresourceprovider.models.ManagedServiceIdentity; +import tsptest.armresourceprovider.models.PriorityModel; +import tsptest.armresourceprovider.models.ProvisioningState; + +public final class CustomTemplateResourceImpl + implements CustomTemplateResource, CustomTemplateResource.Definition, CustomTemplateResource.Update { + private CustomTemplateResourceInner innerObject; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Dog dog() { + return this.innerModel().dog(); + } + + public EmptyModel namedEmptyModel() { + return this.innerModel().namedEmptyModel(); + } + + public AnonymousEmptyModel anonymousEmptyModel() { + return this.innerModel().anonymousEmptyModel(); + } + + public PriorityModel priority() { + return this.innerModel().priority(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public CustomTemplateResourceInner innerModel() { + return this.innerObject; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String customTemplateResourceName; + + private String createIfMatch; + + private String createIfNoneMatch; + + private CustomTemplateResourcePatch updateProperties; + + public CustomTemplateResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CustomTemplateResource create() { + this.innerObject = serviceManager.serviceClient() + .getCustomTemplateResourceInterfaces() + .createOrUpdate(resourceGroupName, customTemplateResourceName, this.innerModel(), createIfMatch, + createIfNoneMatch, Context.NONE); + return this; + } + + public CustomTemplateResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCustomTemplateResourceInterfaces() + .createOrUpdate(resourceGroupName, customTemplateResourceName, this.innerModel(), createIfMatch, + createIfNoneMatch, context); + return this; + } + + CustomTemplateResourceImpl(String name, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = new CustomTemplateResourceInner(); + this.serviceManager = serviceManager; + this.customTemplateResourceName = name; + this.createIfMatch = null; + this.createIfNoneMatch = null; + } + + public CustomTemplateResourceImpl update() { + this.updateProperties = new CustomTemplateResourcePatch(); + return this; + } + + public CustomTemplateResource apply() { + this.innerObject = serviceManager.serviceClient() + .getCustomTemplateResourceInterfaces() + .updateLongRunning(resourceGroupName, customTemplateResourceName, updateProperties, Context.NONE); + return this; + } + + public CustomTemplateResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCustomTemplateResourceInterfaces() + .updateLongRunning(resourceGroupName, customTemplateResourceName, updateProperties, context); + return this; + } + + CustomTemplateResourceImpl(CustomTemplateResourceInner innerObject, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.customTemplateResourceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "customTemplateResources"); + } + + public CustomTemplateResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CustomTemplateResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CustomTemplateResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public CustomTemplateResourceImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + public CustomTemplateResourceImpl withDog(Dog dog) { + this.innerModel().withDog(dog); + return this; + } + + public CustomTemplateResourceImpl withNamedEmptyModel(EmptyModel namedEmptyModel) { + this.innerModel().withNamedEmptyModel(namedEmptyModel); + return this; + } + + public CustomTemplateResourceImpl withAnonymousEmptyModel(AnonymousEmptyModel anonymousEmptyModel) { + this.innerModel().withAnonymousEmptyModel(anonymousEmptyModel); + return this; + } + + public CustomTemplateResourceImpl withPriority(PriorityModel priority) { + this.innerModel().withPriority(priority); + return this; + } + + public CustomTemplateResourceImpl withIfMatch(String ifMatch) { + this.createIfMatch = ifMatch; + return this; + } + + public CustomTemplateResourceImpl withIfNoneMatch(String ifNoneMatch) { + this.createIfNoneMatch = ifNoneMatch; + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesClientImpl.java new file mode 100644 index 00000000000..6289e93898d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesClientImpl.java @@ -0,0 +1,581 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient; +import tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner; +import tsptest.armresourceprovider.models.CustomTemplateResourcePatch; + +/** + * An instance of this class provides access to all the operations defined in CustomTemplateResourceInterfacesClient. + */ +public final class CustomTemplateResourceInterfacesClientImpl implements CustomTemplateResourceInterfacesClient { + /** + * The proxy service used to perform REST calls. + */ + private final CustomTemplateResourceInterfacesService service; + + /** + * The service client containing this operation class. + */ + private final ArmClientImpl client; + + /** + * Initializes an instance of CustomTemplateResourceInterfacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CustomTemplateResourceInterfacesClientImpl(ArmClientImpl client) { + this.service = RestProxy.create(CustomTemplateResourceInterfacesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmClientCustomTemplateResourceInterfaces to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmClientCustomTemplateResourceInterfaces") + public interface CustomTemplateResourceInterfacesService { + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/customTemplateResources/{customTemplateResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, + @PathParam("customTemplateResourceName") String customTemplateResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CustomTemplateResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/customTemplateResources/{customTemplateResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, + @PathParam("customTemplateResourceName") String customTemplateResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CustomTemplateResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/customTemplateResources/{customTemplateResourceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateLongRunning(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customTemplateResourceName") String customTemplateResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CustomTemplateResourcePatch properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/customTemplateResources/{customTemplateResourceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateLongRunningSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("customTemplateResourceName") String customTemplateResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CustomTemplateResourcePatch properties, Context context); + } + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String customTemplateResourceName, CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, ifMatch, ifNoneMatch, customTemplateResourceName, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String customTemplateResourceName, + CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, ifMatch, ifNoneMatch, customTemplateResourceName, + contentType, accept, resource, Context.NONE); + } + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String customTemplateResourceName, + CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, ifMatch, ifNoneMatch, customTemplateResourceName, + contentType, accept, resource, context); + } + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, CustomTemplateResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource, + String ifMatch, String ifNoneMatch) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + customTemplateResourceName, resource, ifMatch, ifNoneMatch); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, + this.client.getContext()); + } + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, CustomTemplateResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource) { + final String ifMatch = null; + final String ifNoneMatch = null; + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + customTemplateResourceName, resource, ifMatch, ifNoneMatch); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, + this.client.getContext()); + } + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CustomTemplateResourceInner> beginCreateOrUpdate( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource, + String ifMatch, String ifNoneMatch) { + Response response + = createOrUpdateWithResponse(resourceGroupName, customTemplateResourceName, resource, ifMatch, ifNoneMatch); + return this.client.getLroResult(response, + CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, Context.NONE); + } + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CustomTemplateResourceInner> beginCreateOrUpdate( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource) { + final String ifMatch = null; + final String ifNoneMatch = null; + Response response + = createOrUpdateWithResponse(resourceGroupName, customTemplateResourceName, resource, ifMatch, ifNoneMatch); + return this.client.getLroResult(response, + CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, Context.NONE); + } + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CustomTemplateResourceInner> beginCreateOrUpdate( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourceInner resource, + String ifMatch, String ifNoneMatch, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, customTemplateResourceName, + resource, ifMatch, ifNoneMatch, context); + return this.client.getLroResult(response, + CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, context); + } + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String resourceGroupName, + String customTemplateResourceName, CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch) { + return beginCreateOrUpdateAsync(resourceGroupName, customTemplateResourceName, resource, ifMatch, ifNoneMatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String resourceGroupName, + String customTemplateResourceName, CustomTemplateResourceInner resource) { + final String ifMatch = null; + final String ifNoneMatch = null; + return beginCreateOrUpdateAsync(resourceGroupName, customTemplateResourceName, resource, ifMatch, ifNoneMatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomTemplateResourceInner createOrUpdate(String resourceGroupName, String customTemplateResourceName, + CustomTemplateResourceInner resource) { + final String ifMatch = null; + final String ifNoneMatch = null; + return beginCreateOrUpdate(resourceGroupName, customTemplateResourceName, resource, ifMatch, ifNoneMatch) + .getFinalResult(); + } + + /** + * Create a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomTemplateResourceInner createOrUpdate(String resourceGroupName, String customTemplateResourceName, + CustomTemplateResourceInner resource, String ifMatch, String ifNoneMatch, Context context) { + return beginCreateOrUpdate(resourceGroupName, customTemplateResourceName, resource, ifMatch, ifNoneMatch, + context).getFinalResult(); + } + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> updateLongRunningWithResponseAsync(String resourceGroupName, + String customTemplateResourceName, CustomTemplateResourcePatch properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.updateLongRunning(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, customTemplateResourceName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateLongRunningWithResponse(String resourceGroupName, + String customTemplateResourceName, CustomTemplateResourcePatch properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateLongRunningSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, customTemplateResourceName, contentType, accept, + properties, Context.NONE); + } + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateLongRunningWithResponse(String resourceGroupName, + String customTemplateResourceName, CustomTemplateResourcePatch properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateLongRunningSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, customTemplateResourceName, contentType, accept, + properties, context); + } + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, CustomTemplateResourceInner> beginUpdateLongRunningAsync( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourcePatch properties) { + Mono>> mono + = updateLongRunningWithResponseAsync(resourceGroupName, customTemplateResourceName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, + this.client.getContext()); + } + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CustomTemplateResourceInner> beginUpdateLongRunning( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourcePatch properties) { + Response response + = updateLongRunningWithResponse(resourceGroupName, customTemplateResourceName, properties); + return this.client.getLroResult(response, + CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, Context.NONE); + } + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CustomTemplateResourceInner> beginUpdateLongRunning( + String resourceGroupName, String customTemplateResourceName, CustomTemplateResourcePatch properties, + Context context) { + Response response + = updateLongRunningWithResponse(resourceGroupName, customTemplateResourceName, properties, context); + return this.client.getLroResult(response, + CustomTemplateResourceInner.class, CustomTemplateResourceInner.class, context); + } + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateLongRunningAsync(String resourceGroupName, + String customTemplateResourceName, CustomTemplateResourcePatch properties) { + return beginUpdateLongRunningAsync(resourceGroupName, customTemplateResourceName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomTemplateResourceInner updateLongRunning(String resourceGroupName, String customTemplateResourceName, + CustomTemplateResourcePatch properties) { + return beginUpdateLongRunning(resourceGroupName, customTemplateResourceName, properties).getFinalResult(); + } + + /** + * Update a CustomTemplateResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param customTemplateResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomTemplateResourceInner updateLongRunning(String resourceGroupName, String customTemplateResourceName, + CustomTemplateResourcePatch properties, Context context) { + return beginUpdateLongRunning(resourceGroupName, customTemplateResourceName, properties, context) + .getFinalResult(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesImpl.java new file mode 100644 index 00000000000..16f37436aa4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesImpl.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.util.logging.ClientLogger; +import tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient; +import tsptest.armresourceprovider.models.CustomTemplateResourceInterfaces; + +public final class CustomTemplateResourceInterfacesImpl implements CustomTemplateResourceInterfaces { + private static final ClientLogger LOGGER = new ClientLogger(CustomTemplateResourceInterfacesImpl.class); + + private final CustomTemplateResourceInterfacesClient innerClient; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public CustomTemplateResourceInterfacesImpl(CustomTemplateResourceInterfacesClient innerClient, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + private CustomTemplateResourceInterfacesClient serviceClient() { + return this.innerClient; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } + + public CustomTemplateResourceImpl define(String name) { + return new CustomTemplateResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsClientImpl.java new file mode 100644 index 00000000000..9adadb0f70e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsClientImpl.java @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient; +import tsptest.armresourceprovider.models.NginxConfigurationRequest; +import tsptest.armresourceprovider.models.NginxConfigurationResponse; + +/** + * An instance of this class provides access to all the operations defined in ImmutableResourceModelsClient. + */ +public final class ImmutableResourceModelsClientImpl implements ImmutableResourceModelsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ImmutableResourceModelsService service; + + /** + * The service client containing this operation class. + */ + private final ArmClientImpl client; + + /** + * Initializes an instance of ImmutableResourceModelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ImmutableResourceModelsClientImpl(ArmClientImpl client) { + this.service = RestProxy.create(ImmutableResourceModelsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmClientImmutableResourceModels to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmClientImmutableResourceModels") + public interface ImmutableResourceModelsService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/configurations/{configurationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("configurationName") String configurationName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NginxConfigurationRequest properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/configurations/{configurationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("configurationName") String configurationName, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NginxConfigurationRequest properties, Context context); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String configurationName, NginxConfigurationRequest properties) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, configurationName, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties) { + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, configurationName, accept, properties, Context.NONE); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties, Context context) { + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, configurationName, accept, properties, context); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, NginxConfigurationResponse> beginCreateOrUpdateAsync( + String resourceGroupName, String configurationName, NginxConfigurationRequest properties) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, configurationName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NginxConfigurationResponse.class, NginxConfigurationResponse.class, + this.client.getContext()); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, NginxConfigurationResponse> + beginCreateOrUpdateAsync(String resourceGroupName, String configurationName) { + final NginxConfigurationRequest properties = null; + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, configurationName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NginxConfigurationResponse.class, NginxConfigurationResponse.class, + this.client.getContext()); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NginxConfigurationResponse> + beginCreateOrUpdate(String resourceGroupName, String configurationName, NginxConfigurationRequest properties) { + Response response = createOrUpdateWithResponse(resourceGroupName, configurationName, properties); + return this.client.getLroResult(response, + NginxConfigurationResponse.class, NginxConfigurationResponse.class, Context.NONE); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NginxConfigurationResponse> + beginCreateOrUpdate(String resourceGroupName, String configurationName) { + final NginxConfigurationRequest properties = null; + Response response = createOrUpdateWithResponse(resourceGroupName, configurationName, properties); + return this.client.getLroResult(response, + NginxConfigurationResponse.class, NginxConfigurationResponse.class, Context.NONE); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete proxy resource types can be created by aliasing this type + * using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NginxConfigurationResponse> beginCreateOrUpdate( + String resourceGroupName, String configurationName, NginxConfigurationRequest properties, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, configurationName, properties, context); + return this.client.getLroResult(response, + NginxConfigurationResponse.class, NginxConfigurationResponse.class, context); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties) { + return beginCreateOrUpdateAsync(resourceGroupName, configurationName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String resourceGroupName, String configurationName) { + final NginxConfigurationRequest properties = null; + return beginCreateOrUpdateAsync(resourceGroupName, configurationName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName) { + final NginxConfigurationRequest properties = null; + return beginCreateOrUpdate(resourceGroupName, configurationName, properties).getFinalResult(); + } + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties, Context context) { + return beginCreateOrUpdate(resourceGroupName, configurationName, properties, context).getFinalResult(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsImpl.java new file mode 100644 index 00000000000..d5bcd4b973c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient; +import tsptest.armresourceprovider.models.ImmutableResourceModels; +import tsptest.armresourceprovider.models.NginxConfigurationRequest; +import tsptest.armresourceprovider.models.NginxConfigurationResponse; + +public final class ImmutableResourceModelsImpl implements ImmutableResourceModels { + private static final ClientLogger LOGGER = new ClientLogger(ImmutableResourceModelsImpl.class); + + private final ImmutableResourceModelsClient innerClient; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public ImmutableResourceModelsImpl(ImmutableResourceModelsClient innerClient, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName) { + return this.serviceClient().createOrUpdate(resourceGroupName, configurationName); + } + + public NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties, Context context) { + return this.serviceClient().createOrUpdate(resourceGroupName, configurationName, properties, context); + } + + private ImmutableResourceModelsClient serviceClient() { + return this.innerClient; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesClientImpl.java new file mode 100644 index 00000000000..4c9b682e39d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesClientImpl.java @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +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.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.LroNoBodiesClient; +import tsptest.armresourceprovider.models.ActionFinalResult; +import tsptest.armresourceprovider.models.ResourceLroNoBody; + +/** + * An instance of this class provides access to all the operations defined in LroNoBodiesClient. + */ +public final class LroNoBodiesClientImpl implements LroNoBodiesClient { + /** + * The proxy service used to perform REST calls. + */ + private final LroNoBodiesService service; + + /** + * The service client containing this operation class. + */ + private final ArmClientImpl client; + + /** + * Initializes an instance of LroNoBodiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LroNoBodiesClientImpl(ArmClientImpl client) { + this.service + = RestProxy.create(LroNoBodiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmClientLroNoBodies to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmClientLroNoBodies") + public interface LroNoBodiesService { + @Headers({ "Accept: application/json;q=0.9" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/resourceLroNoBody/{resourceLroNoBodyName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceLroNoBodyName") String resourceLroNoBodyName, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") ResourceLroNoBody resource, + Context context); + + @Headers({ "Accept: application/json;q=0.9" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/resourceLroNoBody/{resourceLroNoBodyName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceLroNoBodyName") String resourceLroNoBodyName, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") ResourceLroNoBody resource, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/resourceLroNoBody/{resourceLroNoBodyName}/action") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> action(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceLroNoBodyName") String resourceLroNoBodyName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/resourceLroNoBody/{resourceLroNoBodyName}/action") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response actionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceLroNoBodyName") String resourceLroNoBodyName, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String resourceLroNoBodyName, ResourceLroNoBody resource) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, resourceLroNoBodyName, contentType, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String resourceLroNoBodyName, + ResourceLroNoBody resource) { + final String contentType = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, resourceLroNoBodyName, contentType, resource, + Context.NONE); + } + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String resourceLroNoBodyName, + ResourceLroNoBody resource, Context context) { + final String contentType = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, resourceLroNoBodyName, contentType, resource, context); + } + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, ResourceLroNoBody> + beginCreateOrUpdateAsync(String resourceGroupName, String resourceLroNoBodyName, ResourceLroNoBody resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, resourceLroNoBodyName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ResourceLroNoBody.class, ResourceLroNoBody.class, this.client.getContext()); + } + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ResourceLroNoBody> beginCreateOrUpdate(String resourceGroupName, + String resourceLroNoBodyName, ResourceLroNoBody resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, resourceLroNoBodyName, resource); + return this.client.getLroResult(response, ResourceLroNoBody.class, + ResourceLroNoBody.class, Context.NONE); + } + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ResourceLroNoBody> beginCreateOrUpdate(String resourceGroupName, + String resourceLroNoBodyName, ResourceLroNoBody resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, resourceLroNoBodyName, resource, context); + return this.client.getLroResult(response, ResourceLroNoBody.class, + ResourceLroNoBody.class, context); + } + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String resourceGroupName, String resourceLroNoBodyName, + ResourceLroNoBody resource) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceLroNoBodyName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, + ResourceLroNoBody resource) { + return beginCreateOrUpdate(resourceGroupName, resourceLroNoBodyName, resource).getFinalResult(); + } + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, + ResourceLroNoBody resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, resourceLroNoBodyName, resource, context).getFinalResult(); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> actionWithResponseAsync(String resourceGroupName, + String resourceLroNoBodyName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.action(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, resourceLroNoBodyName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response actionWithResponse(String resourceGroupName, String resourceLroNoBodyName) { + final String accept = "application/json"; + return service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, resourceLroNoBodyName, accept, Context.NONE); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response actionWithResponse(String resourceGroupName, String resourceLroNoBodyName, + Context context) { + final String accept = "application/json"; + return service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, resourceLroNoBodyName, accept, context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, ActionFinalResult> beginActionAsync(String resourceGroupName, + String resourceLroNoBodyName) { + Mono>> mono = actionWithResponseAsync(resourceGroupName, resourceLroNoBodyName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ActionFinalResult.class, ActionFinalResult.class, this.client.getContext()); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ActionFinalResult> beginAction(String resourceGroupName, + String resourceLroNoBodyName) { + Response response = actionWithResponse(resourceGroupName, resourceLroNoBodyName); + return this.client.getLroResult(response, ActionFinalResult.class, + ActionFinalResult.class, Context.NONE); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ActionFinalResult> beginAction(String resourceGroupName, + String resourceLroNoBodyName, Context context) { + Response response = actionWithResponse(resourceGroupName, resourceLroNoBodyName, context); + return this.client.getLroResult(response, ActionFinalResult.class, + ActionFinalResult.class, context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono actionAsync(String resourceGroupName, String resourceLroNoBodyName) { + return beginActionAsync(resourceGroupName, resourceLroNoBodyName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName) { + return beginAction(resourceGroupName, resourceLroNoBodyName).getFinalResult(); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName, Context context) { + return beginAction(resourceGroupName, resourceLroNoBodyName, context).getFinalResult(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesImpl.java new file mode 100644 index 00000000000..7a5929e9328 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armresourceprovider.fluent.LroNoBodiesClient; +import tsptest.armresourceprovider.models.ActionFinalResult; +import tsptest.armresourceprovider.models.LroNoBodies; +import tsptest.armresourceprovider.models.ResourceLroNoBody; + +public final class LroNoBodiesImpl implements LroNoBodies { + private static final ClientLogger LOGGER = new ClientLogger(LroNoBodiesImpl.class); + + private final LroNoBodiesClient innerClient; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public LroNoBodiesImpl(LroNoBodiesClient innerClient, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, + ResourceLroNoBody resource) { + return this.serviceClient().createOrUpdate(resourceGroupName, resourceLroNoBodyName, resource); + } + + public ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, + ResourceLroNoBody resource, Context context) { + return this.serviceClient().createOrUpdate(resourceGroupName, resourceLroNoBodyName, resource, context); + } + + public ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName) { + return this.serviceClient().action(resourceGroupName, resourceLroNoBodyName); + } + + public ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName, Context context) { + return this.serviceClient().action(resourceGroupName, resourceLroNoBodyName, context); + } + + private LroNoBodiesClient serviceClient() { + return this.innerClient; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusImpl.java new file mode 100644 index 00000000000..3fd5116872d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.management.SystemData; +import java.util.Collections; +import java.util.Map; +import tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner; +import tsptest.armresourceprovider.models.ManagedMaintenanceWindowStatus; + +public final class ManagedMaintenanceWindowStatusImpl implements ManagedMaintenanceWindowStatus { + private ManagedMaintenanceWindowStatusInner innerObject; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + ManagedMaintenanceWindowStatusImpl(ManagedMaintenanceWindowStatusInner innerObject, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public ManagedMaintenanceWindowStatusInner innerModel() { + return this.innerObject; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsClientImpl.java new file mode 100644 index 00000000000..59ca4c8cd7d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsClientImpl.java @@ -0,0 +1,426 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient; +import tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedMaintenanceWindowStatusOperationsClient. + */ +public final class ManagedMaintenanceWindowStatusOperationsClientImpl + implements ManagedMaintenanceWindowStatusOperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ManagedMaintenanceWindowStatusOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ArmClientImpl client; + + /** + * Initializes an instance of ManagedMaintenanceWindowStatusOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedMaintenanceWindowStatusOperationsClientImpl(ArmClientImpl client) { + this.service = RestProxy.create(ManagedMaintenanceWindowStatusOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmClientManagedMaintenanceWindowStatusOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmClientManagedMaintenanceWindowStatusOperations") + public interface ManagedMaintenanceWindowStatusOperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/managedMaintenanceWindowStatusContents/{managedMaintenanceWindowStatusContentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedMaintenanceWindowStatusContentName") String managedMaintenanceWindowStatusContentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/managedMaintenanceWindowStatusContents/{managedMaintenanceWindowStatusContentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedMaintenanceWindowStatusContentName") String managedMaintenanceWindowStatusContentName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/managedMaintenanceWindowStatusContents/{managedMaintenanceWindowStatusContentName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedMaintenanceWindowStatusContentName") String managedMaintenanceWindowStatusContentName, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/managedMaintenanceWindowStatusContents/{managedMaintenanceWindowStatusContentName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedMaintenanceWindowStatusContentName") String managedMaintenanceWindowStatusContentName, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + } + + /** + * Get a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedMaintenanceWindowStatusContent along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String managedMaintenanceWindowStatusContentName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, managedMaintenanceWindowStatusContentName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedMaintenanceWindowStatusContent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getByResourceGroupAsync(String resourceGroupName, + String managedMaintenanceWindowStatusContentName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, managedMaintenanceWindowStatusContentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedMaintenanceWindowStatusContent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, managedMaintenanceWindowStatusContentName, accept, + context); + } + + /** + * Get a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedMaintenanceWindowStatusContent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedMaintenanceWindowStatusInner getByResourceGroup(String resourceGroupName, + String managedMaintenanceWindowStatusContentName) { + return getByResourceGroupWithResponse(resourceGroupName, managedMaintenanceWindowStatusContentName, + Context.NONE).getValue(); + } + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> deleteWithResponseAsync(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, + ifNoneMatch, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, + ifNoneMatch, Context.NONE); + } + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, + ifNoneMatch, context); + } + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, + managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String managedMaintenanceWindowStatusContentName) { + final String ifMatch = null; + final String ifNoneMatch = null; + Mono>> mono = deleteWithResponseAsync(resourceGroupName, + managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch) { + Response response + = deleteWithResponse(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, + String managedMaintenanceWindowStatusContentName) { + final String ifMatch = null; + final String ifNoneMatch = null; + Response response + = deleteWithResponse(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, String ifMatch, String ifNoneMatch, Context context) { + Response response = deleteWithResponse(resourceGroupName, managedMaintenanceWindowStatusContentName, + ifMatch, ifNoneMatch, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String managedMaintenanceWindowStatusContentName, + String ifMatch, String ifNoneMatch) { + return beginDeleteAsync(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String managedMaintenanceWindowStatusContentName) { + final String ifMatch = null; + final String ifNoneMatch = null; + return beginDeleteAsync(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedMaintenanceWindowStatusContentName) { + final String ifMatch = null; + final String ifNoneMatch = null; + beginDelete(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch) + .getFinalResult(); + } + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedMaintenanceWindowStatusContentName, String ifMatch, + String ifNoneMatch, Context context) { + beginDelete(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch, context) + .getFinalResult(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsImpl.java new file mode 100644 index 00000000000..cb64f8316cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsImpl.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient; +import tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner; +import tsptest.armresourceprovider.models.ManagedMaintenanceWindowStatus; +import tsptest.armresourceprovider.models.ManagedMaintenanceWindowStatusOperations; + +public final class ManagedMaintenanceWindowStatusOperationsImpl implements ManagedMaintenanceWindowStatusOperations { + private static final ClientLogger LOGGER = new ClientLogger(ManagedMaintenanceWindowStatusOperationsImpl.class); + + private final ManagedMaintenanceWindowStatusOperationsClient innerClient; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public ManagedMaintenanceWindowStatusOperationsImpl(ManagedMaintenanceWindowStatusOperationsClient innerClient, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, managedMaintenanceWindowStatusContentName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ManagedMaintenanceWindowStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedMaintenanceWindowStatus getByResourceGroup(String resourceGroupName, + String managedMaintenanceWindowStatusContentName) { + ManagedMaintenanceWindowStatusInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, managedMaintenanceWindowStatusContentName); + if (inner != null) { + return new ManagedMaintenanceWindowStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String managedMaintenanceWindowStatusContentName) { + this.serviceClient().delete(resourceGroupName, managedMaintenanceWindowStatusContentName); + } + + public void delete(String resourceGroupName, String managedMaintenanceWindowStatusContentName, String ifMatch, + String ifNoneMatch, Context context) { + this.serviceClient() + .delete(resourceGroupName, managedMaintenanceWindowStatusContentName, ifMatch, ifNoneMatch, context); + } + + private ManagedMaintenanceWindowStatusOperationsClient serviceClient() { + return this.innerClient; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNameImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNameImpl.java new file mode 100644 index 00000000000..61c4f54cade --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNameImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.management.SystemData; +import java.util.Collections; +import java.util.Map; +import tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner; +import tsptest.armresourceprovider.models.ModelInterfaceSameName; + +public final class ModelInterfaceSameNameImpl implements ModelInterfaceSameName { + private ModelInterfaceSameNameInner innerObject; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + ModelInterfaceSameNameImpl(ModelInterfaceSameNameInner innerObject, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public ModelInterfaceSameNameInner innerModel() { + return this.innerObject; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesClientImpl.java new file mode 100644 index 00000000000..46c239aac4a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesClientImpl.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient; +import tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner; + +/** + * An instance of this class provides access to all the operations defined in ModelInterfaceSameNamesClient. + */ +public final class ModelInterfaceSameNamesClientImpl implements ModelInterfaceSameNamesClient { + /** + * The proxy service used to perform REST calls. + */ + private final ModelInterfaceSameNamesService service; + + /** + * The service client containing this operation class. + */ + private final ArmClientImpl client; + + /** + * Initializes an instance of ModelInterfaceSameNamesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ModelInterfaceSameNamesClientImpl(ArmClientImpl client) { + this.service = RestProxy.create(ModelInterfaceSameNamesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmClientModelInterfaceSameNames to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmClientModelInterfaceSameNames") + public interface ModelInterfaceSameNamesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/modelInterfaceDifferentNames/{modelInterfaceDifferentNameName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("modelInterfaceDifferentNameName") String modelInterfaceDifferentNameName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/modelInterfaceDifferentNames/{modelInterfaceDifferentNameName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("modelInterfaceDifferentNameName") String modelInterfaceDifferentNameName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/modelInterfaceDifferentNames/{modelInterfaceDifferentNameName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("modelInterfaceDifferentNameName") String modelInterfaceDifferentNameName, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/modelInterfaceDifferentNames/{modelInterfaceDifferentNameName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("modelInterfaceDifferentNameName") String modelInterfaceDifferentNameName, + @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + } + + /** + * Get a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ModelInterfaceDifferentName along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String modelInterfaceDifferentNameName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, modelInterfaceDifferentNameName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ModelInterfaceDifferentName on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getByResourceGroupAsync(String resourceGroupName, + String modelInterfaceDifferentNameName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, modelInterfaceDifferentNameName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ModelInterfaceDifferentName along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String modelInterfaceDifferentNameName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, modelInterfaceDifferentNameName, accept, context); + } + + /** + * Get a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ModelInterfaceDifferentName. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ModelInterfaceSameNameInner getByResourceGroup(String resourceGroupName, + String modelInterfaceDifferentNameName) { + return getByResourceGroupWithResponse(resourceGroupName, modelInterfaceDifferentNameName, Context.NONE) + .getValue(); + } + + /** + * Delete a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String resourceGroupName, + String modelInterfaceDifferentNameName, String ifMatch, String ifNoneMatch) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, modelInterfaceDifferentNameName, ifMatch, + ifNoneMatch, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String modelInterfaceDifferentNameName) { + final String ifMatch = null; + final String ifNoneMatch = null; + return deleteWithResponseAsync(resourceGroupName, modelInterfaceDifferentNameName, ifMatch, ifNoneMatch) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String modelInterfaceDifferentNameName, + String ifMatch, String ifNoneMatch, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, modelInterfaceDifferentNameName, ifMatch, ifNoneMatch, + context); + } + + /** + * Delete a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String modelInterfaceDifferentNameName) { + final String ifMatch = null; + final String ifNoneMatch = null; + deleteWithResponse(resourceGroupName, modelInterfaceDifferentNameName, ifMatch, ifNoneMatch, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesImpl.java new file mode 100644 index 00000000000..3cbcc629c0d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesImpl.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient; +import tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner; +import tsptest.armresourceprovider.models.ModelInterfaceSameName; +import tsptest.armresourceprovider.models.ModelInterfaceSameNames; + +public final class ModelInterfaceSameNamesImpl implements ModelInterfaceSameNames { + private static final ClientLogger LOGGER = new ClientLogger(ModelInterfaceSameNamesImpl.class); + + private final ModelInterfaceSameNamesClient innerClient; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public ModelInterfaceSameNamesImpl(ModelInterfaceSameNamesClient innerClient, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String modelInterfaceDifferentNameName, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, modelInterfaceDifferentNameName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ModelInterfaceSameNameImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ModelInterfaceSameName getByResourceGroup(String resourceGroupName, String modelInterfaceDifferentNameName) { + ModelInterfaceSameNameInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, modelInterfaceDifferentNameName); + if (inner != null) { + return new ModelInterfaceSameNameImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceGroupName, + String modelInterfaceDifferentNameName, String ifMatch, String ifNoneMatch, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, modelInterfaceDifferentNameName, ifMatch, ifNoneMatch, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String modelInterfaceDifferentNameName) { + this.serviceClient().delete(resourceGroupName, modelInterfaceDifferentNameName); + } + + private ModelInterfaceSameNamesClient serviceClient() { + return this.innerClient; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationImpl.java new file mode 100644 index 00000000000..705357dbc45 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import tsptest.armresourceprovider.fluent.models.OperationInner; +import tsptest.armresourceprovider.models.ActionType; +import tsptest.armresourceprovider.models.Operation; +import tsptest.armresourceprovider.models.OperationDisplay; +import tsptest.armresourceprovider.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + OperationImpl(OperationInner innerObject, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsClientImpl.java new file mode 100644 index 00000000000..5c8b56bb33d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +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.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.OperationsClient; +import tsptest.armresourceprovider.fluent.models.OperationInner; +import tsptest.armresourceprovider.implementation.models.OperationListResult; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final ArmClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ArmClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmClientOperations to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/TspTest.ArmResourceProvider/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/TspTest.ArmResourceProvider/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsImpl.java new file mode 100644 index 00000000000..f75ef034913 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armresourceprovider.fluent.OperationsClient; +import tsptest.armresourceprovider.fluent.models.OperationInner; +import tsptest.armresourceprovider.models.Operation; +import tsptest.armresourceprovider.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResourceManagerUtils.java new file mode 100644 index 00000000000..890033c5fbe --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResultImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResultImpl.java new file mode 100644 index 00000000000..084bf6ca944 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/ResultImpl.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import tsptest.armresourceprovider.fluent.models.ResultInner; +import tsptest.armresourceprovider.models.Result; + +public final class ResultImpl implements Result { + private ResultInner innerObject; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + ResultImpl(ResultInner innerObject, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String reason() { + return this.innerModel().reason(); + } + + public ResultInner innerModel() { + return this.innerObject; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java new file mode 100644 index 00000000000..deeec677d4c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner; +import tsptest.armresourceprovider.models.ProvisioningState; +import tsptest.armresourceprovider.models.Result; +import tsptest.armresourceprovider.models.TopLevelArmResource; +import tsptest.armresourceprovider.models.TopLevelArmResourceUpdate; + +public final class TopLevelArmResourceImpl + implements TopLevelArmResource, TopLevelArmResource.Definition, TopLevelArmResource.Update { + private TopLevelArmResourceInner innerObject; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public List configurationEndpoints() { + List inner = this.innerModel().configurationEndpoints(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String userName() { + return this.innerModel().userName(); + } + + public String userNames() { + return this.innerModel().userNames(); + } + + public String accuserName() { + return this.innerModel().accuserName(); + } + + public OffsetDateTime startTimeStamp() { + return this.innerModel().startTimeStamp(); + } + + public Float size() { + return this.innerModel().size(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public TopLevelArmResourceInner innerModel() { + return this.innerObject; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String topLevelArmResourceName; + + private TopLevelArmResourceUpdate updateProperties; + + public TopLevelArmResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public TopLevelArmResource create() { + this.innerObject = serviceManager.serviceClient() + .getTopLevelArmResourceInterfaces() + .createOrUpdate(resourceGroupName, topLevelArmResourceName, this.innerModel(), Context.NONE); + return this; + } + + public TopLevelArmResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTopLevelArmResourceInterfaces() + .createOrUpdate(resourceGroupName, topLevelArmResourceName, this.innerModel(), context); + return this; + } + + TopLevelArmResourceImpl(String name, tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = new TopLevelArmResourceInner(); + this.serviceManager = serviceManager; + this.topLevelArmResourceName = name; + } + + public TopLevelArmResourceImpl update() { + this.updateProperties = new TopLevelArmResourceUpdate(); + return this; + } + + public TopLevelArmResource apply() { + this.innerObject = serviceManager.serviceClient() + .getTopLevelArmResourceInterfaces() + .updateWithResponse(resourceGroupName, topLevelArmResourceName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public TopLevelArmResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTopLevelArmResourceInterfaces() + .updateWithResponse(resourceGroupName, topLevelArmResourceName, updateProperties, context) + .getValue(); + return this; + } + + TopLevelArmResourceImpl(TopLevelArmResourceInner innerObject, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.topLevelArmResourceName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "topLevelArmResources"); + } + + public TopLevelArmResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getTopLevelArmResourceInterfaces() + .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourceName, Context.NONE) + .getValue(); + return this; + } + + public TopLevelArmResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTopLevelArmResourceInterfaces() + .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourceName, context) + .getValue(); + return this; + } + + public Result action() { + return serviceManager.topLevelArmResourceInterfaces().action(resourceGroupName, topLevelArmResourceName); + } + + public Result action(Context context) { + return serviceManager.topLevelArmResourceInterfaces() + .action(resourceGroupName, topLevelArmResourceName, context); + } + + public TopLevelArmResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public TopLevelArmResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public TopLevelArmResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public TopLevelArmResourceImpl withUserName(String userName) { + if (isInCreateMode()) { + this.innerModel().withUserName(userName); + return this; + } else { + this.updateProperties.withUserName(userName); + return this; + } + } + + public TopLevelArmResourceImpl withUserNames(String userNames) { + if (isInCreateMode()) { + this.innerModel().withUserNames(userNames); + return this; + } else { + this.updateProperties.withUserNames(userNames); + return this; + } + } + + public TopLevelArmResourceImpl withAccuserName(String accuserName) { + if (isInCreateMode()) { + this.innerModel().withAccuserName(accuserName); + return this; + } else { + this.updateProperties.withAccuserName(accuserName); + return this; + } + } + + public TopLevelArmResourceImpl withStartTimeStamp(OffsetDateTime startTimeStamp) { + this.innerModel().withStartTimeStamp(startTimeStamp); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java new file mode 100644 index 00000000000..8b0b0a75bd5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java @@ -0,0 +1,1207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient; +import tsptest.armresourceprovider.fluent.models.ResultInner; +import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner; +import tsptest.armresourceprovider.implementation.models.ResourceListResult; +import tsptest.armresourceprovider.models.TopLevelArmResourceUpdate; + +/** + * An instance of this class provides access to all the operations defined in TopLevelArmResourceInterfacesClient. + */ +public final class TopLevelArmResourceInterfacesClientImpl implements TopLevelArmResourceInterfacesClient { + /** + * The proxy service used to perform REST calls. + */ + private final TopLevelArmResourceInterfacesService service; + + /** + * The service client containing this operation class. + */ + private final ArmClientImpl client; + + /** + * Initializes an instance of TopLevelArmResourceInterfacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TopLevelArmResourceInterfacesClientImpl(ArmClientImpl client) { + this.service = RestProxy.create(TopLevelArmResourceInterfacesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmClientTopLevelArmResourceInterfaces to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmClientTopLevelArmResourceInterfaces") + public interface TopLevelArmResourceInterfacesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") TopLevelArmResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") TopLevelArmResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") TopLevelArmResourceUpdate properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") TopLevelArmResourceUpdate properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/TspTest.ArmResourceProvider/topLevelArmResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/TspTest.ArmResourceProvider/topLevelArmResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/action") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> action(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmResourceProvider/topLevelArmResources/{topLevelArmResourceName}/action") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response actionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getByResourceGroupAsync(String resourceGroupName, + String topLevelArmResourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, topLevelArmResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelArmResourceName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, context); + } + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelArmResourceInner getByResourceGroup(String resourceGroupName, String topLevelArmResourceName) { + return getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourceName, Context.NONE).getValue(); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName, TopLevelArmResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, resource, + Context.NONE); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, resource, + context); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, TopLevelArmResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, topLevelArmResourceName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, + this.client.getContext()); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( + String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourceName, resource); + return this.client.getLroResult(response, + TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, Context.NONE); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( + String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourceName, resource, context); + return this.client.getLroResult(response, + TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, context); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateAsync(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, topLevelArmResourceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceInner resource) { + return beginCreateOrUpdate(resourceGroupName, topLevelArmResourceName, resource).getFinalResult(); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, topLevelArmResourceName, resource, context).getFinalResult(); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName, TopLevelArmResourceUpdate properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateAsync(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceUpdate properties) { + return updateWithResponseAsync(resourceGroupName, topLevelArmResourceName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, + String topLevelArmResourceName, TopLevelArmResourceUpdate properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, + properties, context); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelArmResourceInner update(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceUpdate properties) { + return updateWithResponse(resourceGroupName, topLevelArmResourceName, properties, Context.NONE).getValue(); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> deleteWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String topLevelArmResourceName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, Context.NONE); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String topLevelArmResourceName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, context); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String topLevelArmResourceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, topLevelArmResourceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName) { + Response response = deleteWithResponse(resourceGroupName, topLevelArmResourceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String topLevelArmResourceName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, topLevelArmResourceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteAsync(String resourceGroupName, String topLevelArmResourceName) { + return beginDeleteAsync(resourceGroupName, topLevelArmResourceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String topLevelArmResourceName) { + beginDelete(resourceGroupName, topLevelArmResourceName).getFinalResult(); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String topLevelArmResourceName, Context context) { + beginDelete(resourceGroupName, topLevelArmResourceName, context).getFinalResult(); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono>> actionWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.action(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response actionWithResponse(String resourceGroupName, String topLevelArmResourceName) { + final String accept = "application/json"; + return service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, Context.NONE); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response actionWithResponse(String resourceGroupName, String topLevelArmResourceName, + Context context) { + final String accept = "application/json"; + return service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, accept, context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux, ResultInner> beginActionAsync(String resourceGroupName, + String topLevelArmResourceName) { + Mono>> mono = actionWithResponseAsync(resourceGroupName, topLevelArmResourceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ResultInner.class, ResultInner.class, this.client.getContext()); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ResultInner> beginAction(String resourceGroupName, + String topLevelArmResourceName) { + Response response = actionWithResponse(resourceGroupName, topLevelArmResourceName); + return this.client.getLroResult(response, ResultInner.class, ResultInner.class, + Context.NONE); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ResultInner> beginAction(String resourceGroupName, + String topLevelArmResourceName, Context context) { + Response response = actionWithResponse(resourceGroupName, topLevelArmResourceName, context); + return this.client.getLroResult(response, ResultInner.class, ResultInner.class, + context); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono actionAsync(String resourceGroupName, String topLevelArmResourceName) { + return beginActionAsync(resourceGroupName, topLevelArmResourceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 ResultInner action(String resourceGroupName, String topLevelArmResourceName) { + return beginAction(resourceGroupName, topLevelArmResourceName).getFinalResult(); + } + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 ResultInner action(String resourceGroupName, String topLevelArmResourceName, Context context) { + return beginAction(resourceGroupName, topLevelArmResourceName, context).getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesImpl.java new file mode 100644 index 00000000000..c99dec91786 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesImpl.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient; +import tsptest.armresourceprovider.fluent.models.ResultInner; +import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner; +import tsptest.armresourceprovider.models.Result; +import tsptest.armresourceprovider.models.TopLevelArmResource; +import tsptest.armresourceprovider.models.TopLevelArmResourceInterfaces; + +public final class TopLevelArmResourceInterfacesImpl implements TopLevelArmResourceInterfaces { + private static final ClientLogger LOGGER = new ClientLogger(TopLevelArmResourceInterfacesImpl.class); + + private final TopLevelArmResourceInterfacesClient innerClient; + + private final tsptest.armresourceprovider.ArmResourceProviderManager serviceManager; + + public TopLevelArmResourceInterfacesImpl(TopLevelArmResourceInterfacesClient innerClient, + tsptest.armresourceprovider.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelArmResourceName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new TopLevelArmResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TopLevelArmResource getByResourceGroup(String resourceGroupName, String topLevelArmResourceName) { + TopLevelArmResourceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, topLevelArmResourceName); + if (inner != null) { + return new TopLevelArmResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String topLevelArmResourceName) { + this.serviceClient().delete(resourceGroupName, topLevelArmResourceName); + } + + public void delete(String resourceGroupName, String topLevelArmResourceName, Context context) { + this.serviceClient().delete(resourceGroupName, topLevelArmResourceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); + } + + public Result action(String resourceGroupName, String topLevelArmResourceName) { + ResultInner inner = this.serviceClient().action(resourceGroupName, topLevelArmResourceName); + if (inner != null) { + return new ResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Result action(String resourceGroupName, String topLevelArmResourceName, Context context) { + ResultInner inner = this.serviceClient().action(resourceGroupName, topLevelArmResourceName, context); + if (inner != null) { + return new ResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public TopLevelArmResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + this.delete(resourceGroupName, topLevelArmResourceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourceName = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + this.delete(resourceGroupName, topLevelArmResourceName, context); + } + + private TopLevelArmResourceInterfacesClient serviceClient() { + return this.innerClient; + } + + private tsptest.armresourceprovider.ArmResourceProviderManager manager() { + return this.serviceManager; + } + + public TopLevelArmResourceImpl define(String name) { + return new TopLevelArmResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildExtensionResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildExtensionResourceListResult.java new file mode 100644 index 00000000000..0f40c434af0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildExtensionResourceListResult.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner; + +/** + * The response of a ChildExtensionResource list operation. + */ +@Immutable +public final class ChildExtensionResourceListResult implements JsonSerializable { + /* + * The ChildExtensionResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ChildExtensionResourceListResult class. + */ + private ChildExtensionResourceListResult() { + } + + /** + * Get the value property: The ChildExtensionResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChildExtensionResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChildExtensionResourceListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ChildExtensionResourceListResult. + */ + public static ChildExtensionResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChildExtensionResourceListResult deserializedChildExtensionResourceListResult + = new ChildExtensionResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ChildExtensionResourceInner.fromJson(reader1)); + deserializedChildExtensionResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedChildExtensionResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedChildExtensionResourceListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildResourceListResult.java new file mode 100644 index 00000000000..3eb5aff1c89 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ChildResourceListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import tsptest.armresourceprovider.fluent.models.ChildResourceInner; + +/** + * Paged collection of ChildResource items. + */ +@Immutable +public final class ChildResourceListResult implements JsonSerializable { + /* + * The ChildResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ChildResourceListResult class. + */ + private ChildResourceListResult() { + } + + /** + * Get the value property: The ChildResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChildResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChildResourceListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ChildResourceListResult. + */ + public static ChildResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChildResourceListResult deserializedChildResourceListResult = new ChildResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ChildResourceInner.fromJson(reader1)); + deserializedChildResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedChildResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedChildResourceListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/OperationListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/OperationListResult.java new file mode 100644 index 00000000000..84afbfc9caa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import tsptest.armresourceprovider.fluent.models.OperationInner; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ResourceListResult.java new file mode 100644 index 00000000000..542c500c575 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/models/ResourceListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner; + +/** + * The response of a TopLevelArmResource list operation. + */ +@Immutable +public final class ResourceListResult implements JsonSerializable { + /* + * The TopLevelArmResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ResourceListResult class. + */ + private ResourceListResult() { + } + + /** + * Get the value property: The TopLevelArmResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceListResult. + */ + public static ResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceListResult deserializedResourceListResult = new ResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> TopLevelArmResourceInner.fromJson(reader1)); + deserializedResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/package-info.java new file mode 100644 index 00000000000..20861efd68a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for ArmResourceProvider. + * Arm Resource Provider management API. + */ +package tsptest.armresourceprovider.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionFinalResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionFinalResult.java new file mode 100644 index 00000000000..270046ccb13 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionFinalResult.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ActionFinalResult model. + */ +@Immutable +public final class ActionFinalResult implements JsonSerializable { + /* + * The result property. + */ + private String result; + + /** + * Creates an instance of ActionFinalResult class. + */ + private ActionFinalResult() { + } + + /** + * Get the result property: The result property. + * + * @return the result value. + */ + public String result() { + return this.result; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("result", this.result); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ActionFinalResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ActionFinalResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ActionFinalResult. + */ + public static ActionFinalResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ActionFinalResult deserializedActionFinalResult = new ActionFinalResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("result".equals(fieldName)) { + deserializedActionFinalResult.result = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedActionFinalResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionType.java new file mode 100644 index 00000000000..70c3869422e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/AnonymousEmptyModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/AnonymousEmptyModel.java new file mode 100644 index 00000000000..cc38ccbb83e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/AnonymousEmptyModel.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The AnonymousEmptyModel model. + */ +@Immutable +public final class AnonymousEmptyModel implements JsonSerializable { + /** + * Creates an instance of AnonymousEmptyModel class. + */ + public AnonymousEmptyModel() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AnonymousEmptyModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AnonymousEmptyModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AnonymousEmptyModel. + */ + public static AnonymousEmptyModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AnonymousEmptyModel deserializedAnonymousEmptyModel = new AnonymousEmptyModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedAnonymousEmptyModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResource.java new file mode 100644 index 00000000000..43f0d651a18 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResource.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner; + +/** + * An immutable client-side representation of ChildExtensionResource. + */ +public interface ChildExtensionResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ChildExtensionResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner object. + * + * @return the inner object. + */ + ChildExtensionResourceInner innerModel(); + + /** + * The entirety of the ChildExtensionResource definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The ChildExtensionResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ChildExtensionResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the ChildExtensionResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceUri, topLevelArmResourceName. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @return the next definition stage. + */ + WithCreate withExistingTopLevelArmResource(String resourceUri, String topLevelArmResourceName); + } + + /** + * The stage of the ChildExtensionResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ChildExtensionResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ChildExtensionResource create(Context context); + } + + /** + * The stage of the ChildExtensionResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ChildExtensionResourceProperties properties); + } + } + + /** + * Begins update for the ChildExtensionResource resource. + * + * @return the stage of resource update. + */ + ChildExtensionResource.Update update(); + + /** + * The template for ChildExtensionResource update. + */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ChildExtensionResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ChildExtensionResource apply(Context context); + } + + /** + * The ChildExtensionResource update stages. + */ + interface UpdateStages { + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ChildExtensionResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ChildExtensionResource refresh(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceInterfaces.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceInterfaces.java new file mode 100644 index 00000000000..92af6f00663 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceInterfaces.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ChildExtensionResourceInterfaces. + */ +public interface ChildExtensionResourceInterfaces { + /** + * Get a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildExtensionResource along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String topLevelArmResourceName, + String childExtensionResourceName, Context context); + + /** + * Get a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildExtensionResource. + */ + ChildExtensionResource get(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName); + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName); + + /** + * Delete a ChildExtensionResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param childExtensionResourceName ChildExtensionResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceUri, String topLevelArmResourceName, String childExtensionResourceName, Context context); + + /** + * List ChildExtensionResource resources by TopLevelArmResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTopLevelArmResource(String resourceUri, String topLevelArmResourceName); + + /** + * List ChildExtensionResource resources by TopLevelArmResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a ChildExtensionResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTopLevelArmResource(String resourceUri, String topLevelArmResourceName, + Context context); + + /** + * Get a ChildExtensionResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildExtensionResource along with {@link Response}. + */ + ChildExtensionResource getById(String id); + + /** + * Get a ChildExtensionResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildExtensionResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a ChildExtensionResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a ChildExtensionResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ChildExtensionResource resource. + * + * @param name resource name. + * @return the first stage of the new ChildExtensionResource definition. + */ + ChildExtensionResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceProperties.java new file mode 100644 index 00000000000..43790631d91 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceProperties.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Child ExtensionResource properties. + */ +@Immutable +public final class ChildExtensionResourceProperties implements JsonSerializable { + /* + * Provisioning State of the Resource + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of ChildExtensionResourceProperties class. + */ + public ChildExtensionResourceProperties() { + } + + /** + * Get the provisioningState property: Provisioning State of the Resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChildExtensionResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChildExtensionResourceProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ChildExtensionResourceProperties. + */ + public static ChildExtensionResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChildExtensionResourceProperties deserializedChildExtensionResourceProperties + = new ChildExtensionResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedChildExtensionResourceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedChildExtensionResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceUpdate.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceUpdate.java new file mode 100644 index 00000000000..543118d97c5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceUpdate.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The type used for update operations of the ChildExtensionResource. + */ +@Immutable +public final class ChildExtensionResourceUpdate implements JsonSerializable { + /** + * Creates an instance of ChildExtensionResourceUpdate class. + */ + public ChildExtensionResourceUpdate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChildExtensionResourceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChildExtensionResourceUpdate if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ChildExtensionResourceUpdate. + */ + public static ChildExtensionResourceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChildExtensionResourceUpdate deserializedChildExtensionResourceUpdate = new ChildExtensionResourceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedChildExtensionResourceUpdate; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResource.java new file mode 100644 index 00000000000..5269e4cfd32 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResource.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Map; +import tsptest.armresourceprovider.fluent.models.ChildResourceInner; + +/** + * An immutable client-side representation of ChildResource. + */ +public interface ChildResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: Provisioning State of Top Level Arm Resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner tsptest.armresourceprovider.fluent.models.ChildResourceInner object. + * + * @return the inner object. + */ + ChildResourceInner innerModel(); + + /** + * The entirety of the ChildResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The ChildResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ChildResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the ChildResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the ChildResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, topLevelArmResourceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @return the next definition stage. + */ + WithCreate withExistingTopLevelArmResource(String resourceGroupName, String topLevelArmResourceName); + } + + /** + * The stage of the ChildResource definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + ChildResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ChildResource create(Context context); + } + + /** + * The stage of the ChildResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + + /** + * Begins update for the ChildResource resource. + * + * @return the stage of resource update. + */ + ChildResource.Update update(); + + /** + * The template for ChildResource update. + */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ChildResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ChildResource apply(Context context); + } + + /** + * The ChildResource update stages. + */ + interface UpdateStages { + /** + * The stage of the ChildResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ChildResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ChildResource refresh(Context context); + + /** + * A long-running resource action. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void actionWithoutBody(); + + /** + * A long-running resource action. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void actionWithoutBody(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourceUpdate.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourceUpdate.java new file mode 100644 index 00000000000..bf38b0ae48a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourceUpdate.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for update operations of the ChildResource. + */ +@Fluent +public final class ChildResourceUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of ChildResourceUpdate class. + */ + public ChildResourceUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ChildResourceUpdate object itself. + */ + public ChildResourceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChildResourceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChildResourceUpdate if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ChildResourceUpdate. + */ + public static ChildResourceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChildResourceUpdate deserializedChildResourceUpdate = new ChildResourceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedChildResourceUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedChildResourceUpdate; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourcesInterfaces.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourcesInterfaces.java new file mode 100644 index 00000000000..94c1bca4435 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ChildResourcesInterfaces.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ChildResourcesInterfaces. + */ +public interface ChildResourcesInterfaces { + /** + * Get a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildResource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String topLevelArmResourceName, + String childResourceName, Context context); + + /** + * Get a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildResource. + */ + ChildResource get(String resourceGroupName, String topLevelArmResourceName, String childResourceName); + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName); + + /** + * Delete a ChildResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String topLevelArmResourceName, String childResourceName, Context context); + + /** + * List ChildResource resources by TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTopLevelArmResource(String resourceGroupName, String topLevelArmResourceName); + + /** + * List ChildResource resources by TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ChildResource items as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTopLevelArmResource(String resourceGroupName, String topLevelArmResourceName, + Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param childResourceName ChildResources. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void actionWithoutBody(String resourceGroupName, String topLevelArmResourceName, String childResourceName, + Context context); + + /** + * Get a ChildResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildResource along with {@link Response}. + */ + ChildResource getById(String id); + + /** + * Get a ChildResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChildResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a ChildResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a ChildResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ChildResource resource. + * + * @param name resource name. + * @return the first stage of the new ChildResource definition. + */ + ChildResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResource.java new file mode 100644 index 00000000000..968d96b2bf4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResource.java @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Map; +import tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner; + +/** + * An immutable client-side representation of CustomTemplateResource. + */ +public interface CustomTemplateResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Managed identity. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the dog property: The dog property. + * + * @return the dog value. + */ + Dog dog(); + + /** + * Gets the namedEmptyModel property: The namedEmptyModel property. + * + * @return the namedEmptyModel value. + */ + EmptyModel namedEmptyModel(); + + /** + * Gets the anonymousEmptyModel property: The anonymousEmptyModel property. + * + * @return the anonymousEmptyModel value. + */ + AnonymousEmptyModel anonymousEmptyModel(); + + /** + * Gets the priority property: The priority property. + * + * @return the priority value. + */ + PriorityModel priority(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner object. + * + * @return the inner object. + */ + CustomTemplateResourceInner innerModel(); + + /** + * The entirety of the CustomTemplateResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The CustomTemplateResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CustomTemplateResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the CustomTemplateResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the CustomTemplateResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the CustomTemplateResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithDog, + DefinitionStages.WithNamedEmptyModel, DefinitionStages.WithAnonymousEmptyModel, + DefinitionStages.WithPriority, DefinitionStages.WithIfMatch, DefinitionStages.WithIfNoneMatch { + /** + * Executes the create request. + * + * @return the created resource. + */ + CustomTemplateResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CustomTemplateResource create(Context context); + } + + /** + * The stage of the CustomTemplateResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the CustomTemplateResource definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: Managed identity.. + * + * @param identity Managed identity. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + + /** + * The stage of the CustomTemplateResource definition allowing to specify dog. + */ + interface WithDog { + /** + * Specifies the dog property: The dog property.. + * + * @param dog The dog property. + * @return the next definition stage. + */ + WithCreate withDog(Dog dog); + } + + /** + * The stage of the CustomTemplateResource definition allowing to specify namedEmptyModel. + */ + interface WithNamedEmptyModel { + /** + * Specifies the namedEmptyModel property: The namedEmptyModel property.. + * + * @param namedEmptyModel The namedEmptyModel property. + * @return the next definition stage. + */ + WithCreate withNamedEmptyModel(EmptyModel namedEmptyModel); + } + + /** + * The stage of the CustomTemplateResource definition allowing to specify anonymousEmptyModel. + */ + interface WithAnonymousEmptyModel { + /** + * Specifies the anonymousEmptyModel property: The anonymousEmptyModel property.. + * + * @param anonymousEmptyModel The anonymousEmptyModel property. + * @return the next definition stage. + */ + WithCreate withAnonymousEmptyModel(AnonymousEmptyModel anonymousEmptyModel); + } + + /** + * The stage of the CustomTemplateResource definition allowing to specify priority. + */ + interface WithPriority { + /** + * Specifies the priority property: The priority property.. + * + * @param priority The priority property. + * @return the next definition stage. + */ + WithCreate withPriority(PriorityModel priority); + } + + /** + * The stage of the CustomTemplateResource definition allowing to specify ifMatch. + */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: The request should only proceed if an entity matches this string.. + * + * @param ifMatch The request should only proceed if an entity matches this string. + * @return the next definition stage. + */ + WithCreate withIfMatch(String ifMatch); + } + + /** + * The stage of the CustomTemplateResource definition allowing to specify ifNoneMatch. + */ + interface WithIfNoneMatch { + /** + * Specifies the ifNoneMatch property: The request should only proceed if no entity matches this string.. + * + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @return the next definition stage. + */ + WithCreate withIfNoneMatch(String ifNoneMatch); + } + } + + /** + * Begins update for the CustomTemplateResource resource. + * + * @return the stage of resource update. + */ + CustomTemplateResource.Update update(); + + /** + * The template for CustomTemplateResource update. + */ + interface Update extends UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CustomTemplateResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CustomTemplateResource apply(Context context); + } + + /** + * The CustomTemplateResource update stages. + */ + interface UpdateStages { + /** + * The stage of the CustomTemplateResource update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: Managed identity.. + * + * @param identity Managed identity. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourceInterfaces.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourceInterfaces.java new file mode 100644 index 00000000000..9862d6d4804 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourceInterfaces.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +/** + * Resource collection API of CustomTemplateResourceInterfaces. + */ +public interface CustomTemplateResourceInterfaces { + /** + * Begins definition for a new CustomTemplateResource resource. + * + * @param name resource name. + * @return the first stage of the new CustomTemplateResource definition. + */ + CustomTemplateResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourcePatch.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourcePatch.java new file mode 100644 index 00000000000..16287387f2d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourcePatch.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CustomTemplateResourcePatch model. + */ +@Fluent +public final class CustomTemplateResourcePatch implements JsonSerializable { + /* + * Managed identity. + */ + private ManagedServiceIdentity identity; + + /** + * Creates an instance of CustomTemplateResourcePatch class. + */ + public CustomTemplateResourcePatch() { + } + + /** + * Get the identity property: Managed identity. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed identity. + * + * @param identity the identity value to set. + * @return the CustomTemplateResourcePatch object itself. + */ + public CustomTemplateResourcePatch withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomTemplateResourcePatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomTemplateResourcePatch if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomTemplateResourcePatch. + */ + public static CustomTemplateResourcePatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomTemplateResourcePatch deserializedCustomTemplateResourcePatch = new CustomTemplateResourcePatch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identity".equals(fieldName)) { + deserializedCustomTemplateResourcePatch.identity = ManagedServiceIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomTemplateResourcePatch; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Dog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Dog.java new file mode 100644 index 00000000000..feed3d9d7a1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Dog.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Test extensible enum type for discriminator. + */ +@Fluent +public class Dog implements JsonSerializable { + /* + * discriminator property + */ + private DogKind kind = DogKind.fromString("Dog"); + + /* + * Weight of the dog + */ + private int weight; + + /** + * Creates an instance of Dog class. + */ + public Dog() { + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + public DogKind kind() { + return this.kind; + } + + /** + * Get the weight property: Weight of the dog. + * + * @return the weight value. + */ + public int weight() { + return this.weight; + } + + /** + * Set the weight property: Weight of the dog. + * + * @param weight the weight value to set. + * @return the Dog object itself. + */ + public Dog withWeight(int weight) { + this.weight = weight; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("weight", this.weight); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dog from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dog if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Dog. + */ + public static Dog fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("golden_dog".equals(discriminatorValue)) { + return Golden.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static Dog fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Dog deserializedDog = new Dog(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("weight".equals(fieldName)) { + deserializedDog.weight = reader.getInt(); + } else if ("kind".equals(fieldName)) { + deserializedDog.kind = DogKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDog; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/DogKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/DogKind.java new file mode 100644 index 00000000000..c762c08474f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/DogKind.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * extensible enum type for discriminator. + */ +public final class DogKind extends ExpandableStringEnum { + /** + * Species golden. + */ + public static final DogKind GOLDEN = fromString("golden_dog"); + + /** + * Creates a new instance of DogKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DogKind() { + } + + /** + * Creates or finds a DogKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding DogKind. + */ + public static DogKind fromString(String name) { + return fromString(name, DogKind.class); + } + + /** + * Gets known DogKind values. + * + * @return known DogKind values. + */ + public static Collection values() { + return values(DogKind.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/EmptyModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/EmptyModel.java new file mode 100644 index 00000000000..afdf6e995d5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/EmptyModel.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Empty model. + */ +@Immutable +public final class EmptyModel implements JsonSerializable { + /** + * Creates an instance of EmptyModel class. + */ + public EmptyModel() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EmptyModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EmptyModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the EmptyModel. + */ + public static EmptyModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EmptyModel deserializedEmptyModel = new EmptyModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedEmptyModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Golden.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Golden.java new file mode 100644 index 00000000000..c2bc92e4787 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Golden.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Golden dog model. + */ +@Fluent +public final class Golden extends Dog { + /* + * discriminator property + */ + private DogKind kind = DogKind.GOLDEN; + + /** + * Creates an instance of Golden class. + */ + public Golden() { + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + @Override + public DogKind kind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Override + public Golden withWeight(int weight) { + super.withWeight(weight); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("weight", weight()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Golden from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Golden if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Golden. + */ + public static Golden fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Golden deserializedGolden = new Golden(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("weight".equals(fieldName)) { + deserializedGolden.withWeight(reader.getInt()); + } else if ("kind".equals(fieldName)) { + deserializedGolden.kind = DogKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGolden; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ImmutableResourceModels.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ImmutableResourceModels.java new file mode 100644 index 00000000000..522f79c6f9b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ImmutableResourceModels.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.util.Context; + +/** + * Resource collection API of ImmutableResourceModels. + */ +public interface ImmutableResourceModels { + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName); + + /** + * The createOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param configurationName The name of the NginxConfigurationResponse. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete proxy resource types can be created by aliasing this type using a specific property type. + */ + NginxConfigurationResponse createOrUpdate(String resourceGroupName, String configurationName, + NginxConfigurationRequest properties, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/LroNoBodies.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/LroNoBodies.java new file mode 100644 index 00000000000..68f73d0a5e5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/LroNoBodies.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.util.Context; + +/** + * Resource collection API of LroNoBodies. + */ +public interface LroNoBodies { + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, + ResourceLroNoBody resource); + + /** + * Create a ResourceLroNoBody. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + ResourceLroNoBody createOrUpdate(String resourceGroupName, String resourceLroNoBodyName, ResourceLroNoBody resource, + Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceLroNoBodyName The name of the ResourceLroNoBody. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + ActionFinalResult action(String resourceGroupName, String resourceLroNoBodyName, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatus.java new file mode 100644 index 00000000000..0c69e0e2840 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatus.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.management.SystemData; +import java.util.Map; +import tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner; + +/** + * An immutable client-side representation of ManagedMaintenanceWindowStatus. + */ +public interface ManagedMaintenanceWindowStatus { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner object. + * + * @return the inner object. + */ + ManagedMaintenanceWindowStatusInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatusOperations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatusOperations.java new file mode 100644 index 00000000000..17a7a798126 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatusOperations.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ManagedMaintenanceWindowStatusOperations. + */ +public interface ManagedMaintenanceWindowStatusOperations { + /** + * Get a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedMaintenanceWindowStatusContent along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String managedMaintenanceWindowStatusContentName, Context context); + + /** + * Get a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ManagedMaintenanceWindowStatusContent. + */ + ManagedMaintenanceWindowStatus getByResourceGroup(String resourceGroupName, + String managedMaintenanceWindowStatusContentName); + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String managedMaintenanceWindowStatusContentName); + + /** + * Delete a ManagedMaintenanceWindowStatusContent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param managedMaintenanceWindowStatusContentName The name of the ManagedMaintenanceWindowStatusContent. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedMaintenanceWindowStatusContentName, String ifMatch, + String ifNoneMatch, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentity.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentity.java new file mode 100644 index 00000000000..2796db12170 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentity.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; +import java.util.UUID; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private UUID tenantId; + + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentityType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentityType.java new file mode 100644 index 00000000000..3bccba4b269 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentityType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * No managed identity. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * System assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * User assigned managed identity. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * System and user assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameName.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameName.java new file mode 100644 index 00000000000..d6ba3bc2ad8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameName.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.management.SystemData; +import java.util.Map; +import tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner; + +/** + * An immutable client-side representation of ModelInterfaceSameName. + */ +public interface ModelInterfaceSameName { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner object. + * + * @return the inner object. + */ + ModelInterfaceSameNameInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameNames.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameNames.java new file mode 100644 index 00000000000..692a86e831b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameNames.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ModelInterfaceSameNames. + */ +public interface ModelInterfaceSameNames { + /** + * Get a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ModelInterfaceDifferentName along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String modelInterfaceDifferentNameName, Context context); + + /** + * Get a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ModelInterfaceDifferentName. + */ + ModelInterfaceSameName getByResourceGroup(String resourceGroupName, String modelInterfaceDifferentNameName); + + /** + * Delete a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @param ifMatch The request should only proceed if an entity matches this string. + * @param ifNoneMatch The request should only proceed if no entity matches this string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String modelInterfaceDifferentNameName, + String ifMatch, String ifNoneMatch, Context context); + + /** + * Delete a ModelInterfaceDifferentName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param modelInterfaceDifferentNameName The name of the ModelInterfaceDifferentName. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String modelInterfaceDifferentNameName); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationRequest.java new file mode 100644 index 00000000000..2bc71f3119b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationRequest.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The NginxConfigurationRequest model. + */ +@Fluent +public final class NginxConfigurationRequest implements JsonSerializable { + /* + * The rootFile property. + */ + private String rootFile; + + /** + * Creates an instance of NginxConfigurationRequest class. + */ + public NginxConfigurationRequest() { + } + + /** + * Get the rootFile property: The rootFile property. + * + * @return the rootFile value. + */ + public String rootFile() { + return this.rootFile; + } + + /** + * Set the rootFile property: The rootFile property. + * + * @param rootFile the rootFile value to set. + * @return the NginxConfigurationRequest object itself. + */ + public NginxConfigurationRequest withRootFile(String rootFile) { + this.rootFile = rootFile; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("rootFile", this.rootFile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NginxConfigurationRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NginxConfigurationRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the NginxConfigurationRequest. + */ + public static NginxConfigurationRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NginxConfigurationRequest deserializedNginxConfigurationRequest = new NginxConfigurationRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("rootFile".equals(fieldName)) { + deserializedNginxConfigurationRequest.rootFile = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNginxConfigurationRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponse.java new file mode 100644 index 00000000000..21bf7b5e06e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponse.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Concrete proxy resource types can be created by aliasing this type using a specific property type. + */ +@Immutable +public final class NginxConfigurationResponse extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private NginxConfigurationResponseProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of NginxConfigurationResponse class. + */ + private NginxConfigurationResponse() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public NginxConfigurationResponseProperties properties() { + return this.properties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NginxConfigurationResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NginxConfigurationResponse if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NginxConfigurationResponse. + */ + public static NginxConfigurationResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NginxConfigurationResponse deserializedNginxConfigurationResponse = new NginxConfigurationResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNginxConfigurationResponse.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNginxConfigurationResponse.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNginxConfigurationResponse.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedNginxConfigurationResponse.properties + = NginxConfigurationResponseProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedNginxConfigurationResponse.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNginxConfigurationResponse; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponseProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponseProperties.java new file mode 100644 index 00000000000..101611e091c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponseProperties.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The NginxConfigurationResponseProperties model. + */ +@Immutable +public final class NginxConfigurationResponseProperties + implements JsonSerializable { + /* + * The provisioningState property. + */ + private ProvisioningState provisioningState; + + /* + * The rootFile property. + */ + private String rootFile; + + /** + * Creates an instance of NginxConfigurationResponseProperties class. + */ + private NginxConfigurationResponseProperties() { + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the rootFile property: The rootFile property. + * + * @return the rootFile value. + */ + public String rootFile() { + return this.rootFile; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("rootFile", this.rootFile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NginxConfigurationResponseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NginxConfigurationResponseProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the NginxConfigurationResponseProperties. + */ + public static NginxConfigurationResponseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NginxConfigurationResponseProperties deserializedNginxConfigurationResponseProperties + = new NginxConfigurationResponseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedNginxConfigurationResponseProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("rootFile".equals(fieldName)) { + deserializedNginxConfigurationResponseProperties.rootFile = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNginxConfigurationResponseProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operation.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operation.java new file mode 100644 index 00000000000..8b7465e16d2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import tsptest.armresourceprovider.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner tsptest.armresourceprovider.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/OperationDisplay.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/OperationDisplay.java new file mode 100644 index 00000000000..a03ca741bb4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for and operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operations.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operations.java new file mode 100644 index 00000000000..1630283c128 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Origin.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Origin.java new file mode 100644 index 00000000000..34df022a55d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/PriorityModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/PriorityModel.java new file mode 100644 index 00000000000..dc8d7eb9b70 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/PriorityModel.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.util.ExpandableEnum; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Defines values for PriorityModel. + */ +public final class PriorityModel implements ExpandableEnum, JsonSerializable { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = PriorityModel::new; + + /** + * Static value 0 for PriorityModel. + */ + public static final PriorityModel HIGH = fromValue(0); + + /** + * Static value 1 for PriorityModel. + */ + public static final PriorityModel LOW = fromValue(1); + + private final Integer value; + + private PriorityModel(Integer value) { + this.value = value; + } + + /** + * Creates or finds a PriorityModel. + * + * @param value a value to look for. + * @return the corresponding PriorityModel. + * @throws IllegalArgumentException if value is null. + */ + public static PriorityModel fromValue(Integer value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known PriorityModel values. + * + * @return Known PriorityModel values. + */ + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the PriorityModel instance. + * + * @return the value of the PriorityModel instance. + */ + @Override + public Integer getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + return jsonWriter.writeInt(getValue()); + } + + /** + * Reads an instance of PriorityModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PriorityModel if the JsonReader was pointing to an instance of it, or null if the + * JsonReader was pointing to JSON null. + * @throws IOException If an error occurs while reading the PriorityModel. + * @throws IllegalStateException If unexpected JSON token is found. + */ + public static PriorityModel fromJson(JsonReader jsonReader) throws IOException { + JsonToken nextToken = jsonReader.nextToken(); + if (nextToken == JsonToken.NULL) { + return null; + } + if (nextToken != JsonToken.NUMBER) { + throw new IllegalStateException( + String.format("Unexpected JSON token for %s deserialization: %s", JsonToken.NUMBER, nextToken)); + } + return PriorityModel.fromValue(jsonReader.getInt()); + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ProvisioningState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ProvisioningState.java new file mode 100644 index 00000000000..94c14396f7f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ProvisioningState. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Provisioning for ProvisioningState. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Accepted for ProvisioningState. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ResourceLroNoBody.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ResourceLroNoBody.java new file mode 100644 index 00000000000..cd252b1d5d7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/ResourceLroNoBody.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; +import tsptest.armresourceprovider.fluent.models.ResourceLroNoBodyProperties; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class ResourceLroNoBody extends Resource { + /* + * The resource-specific properties for this resource. + */ + private ResourceLroNoBodyProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ResourceLroNoBody class. + */ + public ResourceLroNoBody() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private ResourceLroNoBodyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ResourceLroNoBody withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ResourceLroNoBody withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceLroNoBody from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceLroNoBody if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceLroNoBody. + */ + public static ResourceLroNoBody fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceLroNoBody deserializedResourceLroNoBody = new ResourceLroNoBody(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedResourceLroNoBody.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedResourceLroNoBody.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedResourceLroNoBody.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedResourceLroNoBody.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedResourceLroNoBody.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedResourceLroNoBody.innerProperties = ResourceLroNoBodyProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedResourceLroNoBody.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceLroNoBody; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Result.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Result.java new file mode 100644 index 00000000000..5ab817bff5a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/Result.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import tsptest.armresourceprovider.fluent.models.ResultInner; + +/** + * An immutable client-side representation of Result. + */ +public interface Result { + /** + * Gets the reason property: The reason property. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the inner tsptest.armresourceprovider.fluent.models.ResultInner object. + * + * @return the inner object. + */ + ResultInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResource.java new file mode 100644 index 00000000000..39641c683a1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResource.java @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner; + +/** + * An immutable client-side representation of TopLevelArmResource. + */ +public interface TopLevelArmResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the configurationEndpoints property: Configuration Endpoints. + * + * @return the configurationEndpoints value. + */ + List configurationEndpoints(); + + /** + * Gets the userName property: The userName property. + * + * @return the userName value. + */ + String userName(); + + /** + * Gets the userNames property: The userNames property. + * + * @return the userNames value. + */ + String userNames(); + + /** + * Gets the accuserName property: The accuserName property. + * + * @return the accuserName value. + */ + String accuserName(); + + /** + * Gets the startTimeStamp property: The startTimeStamp property. + * + * @return the startTimeStamp value. + */ + OffsetDateTime startTimeStamp(); + + /** + * Gets the size property: The size property. + * + * @return the size value. + */ + Float size(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner object. + * + * @return the inner object. + */ + TopLevelArmResourceInner innerModel(); + + /** + * The entirety of the TopLevelArmResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The TopLevelArmResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the TopLevelArmResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the TopLevelArmResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithUserName, + DefinitionStages.WithUserNames, DefinitionStages.WithAccuserName, DefinitionStages.WithStartTimeStamp { + /** + * Executes the create request. + * + * @return the created resource. + */ + TopLevelArmResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TopLevelArmResource create(Context context); + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify userName. + */ + interface WithUserName { + /** + * Specifies the userName property: The userName property.. + * + * @param userName The userName property. + * @return the next definition stage. + */ + WithCreate withUserName(String userName); + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify userNames. + */ + interface WithUserNames { + /** + * Specifies the userNames property: The userNames property.. + * + * @param userNames The userNames property. + * @return the next definition stage. + */ + WithCreate withUserNames(String userNames); + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify accuserName. + */ + interface WithAccuserName { + /** + * Specifies the accuserName property: The accuserName property.. + * + * @param accuserName The accuserName property. + * @return the next definition stage. + */ + WithCreate withAccuserName(String accuserName); + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify startTimeStamp. + */ + interface WithStartTimeStamp { + /** + * Specifies the startTimeStamp property: The startTimeStamp property.. + * + * @param startTimeStamp The startTimeStamp property. + * @return the next definition stage. + */ + WithCreate withStartTimeStamp(OffsetDateTime startTimeStamp); + } + } + + /** + * Begins update for the TopLevelArmResource resource. + * + * @return the stage of resource update. + */ + TopLevelArmResource.Update update(); + + /** + * The template for TopLevelArmResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithUserName, UpdateStages.WithUserNames, + UpdateStages.WithAccuserName { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TopLevelArmResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TopLevelArmResource apply(Context context); + } + + /** + * The TopLevelArmResource update stages. + */ + interface UpdateStages { + /** + * The stage of the TopLevelArmResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the TopLevelArmResource update allowing to specify userName. + */ + interface WithUserName { + /** + * Specifies the userName property: The userName property.. + * + * @param userName The userName property. + * @return the next definition stage. + */ + Update withUserName(String userName); + } + + /** + * The stage of the TopLevelArmResource update allowing to specify userNames. + */ + interface WithUserNames { + /** + * Specifies the userNames property: The userNames property.. + * + * @param userNames The userNames property. + * @return the next definition stage. + */ + Update withUserNames(String userNames); + } + + /** + * The stage of the TopLevelArmResource update allowing to specify accuserName. + */ + interface WithAccuserName { + /** + * Specifies the accuserName property: The accuserName property.. + * + * @param accuserName The accuserName property. + * @return the next definition stage. + */ + Update withAccuserName(String accuserName); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TopLevelArmResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TopLevelArmResource refresh(Context context); + + /** + * A long-running resource action. + * + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Result action(); + + /** + * A long-running resource action. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Result action(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceInterfaces.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceInterfaces.java new file mode 100644 index 00000000000..33ae3638206 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceInterfaces.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of TopLevelArmResourceInterfaces. + */ +public interface TopLevelArmResourceInterfaces { + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelArmResourceName, Context context); + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource. + */ + TopLevelArmResource getByResourceGroup(String resourceGroupName, String topLevelArmResourceName); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String topLevelArmResourceName); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String topLevelArmResourceName, Context context); + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Result action(String resourceGroupName, String topLevelArmResourceName); + + /** + * A long-running resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Result action(String resourceGroupName, String topLevelArmResourceName, Context context); + + /** + * Get a TopLevelArmResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + TopLevelArmResource getById(String id); + + /** + * Get a TopLevelArmResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a TopLevelArmResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a TopLevelArmResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new TopLevelArmResource resource. + * + * @param name resource name. + * @return the first stage of the new TopLevelArmResource definition. + */ + TopLevelArmResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceUpdate.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceUpdate.java new file mode 100644 index 00000000000..cdd06db311f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceUpdate.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; +import tsptest.armresourceprovider.fluent.models.TopLevelArmResourceUpdateProperties; + +/** + * The type used for update operations of the TopLevelArmResource. + */ +@Fluent +public final class TopLevelArmResourceUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * The resource-specific properties for this resource. + */ + private TopLevelArmResourceUpdateProperties innerProperties; + + /** + * Creates an instance of TopLevelArmResourceUpdate class. + */ + public TopLevelArmResourceUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TopLevelArmResourceUpdate object itself. + */ + public TopLevelArmResourceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private TopLevelArmResourceUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the userName property: The userName property. + * + * @return the userName value. + */ + public String userName() { + return this.innerProperties() == null ? null : this.innerProperties().userName(); + } + + /** + * Set the userName property: The userName property. + * + * @param userName the userName value to set. + * @return the TopLevelArmResourceUpdate object itself. + */ + public TopLevelArmResourceUpdate withUserName(String userName) { + if (this.innerProperties() == null) { + this.innerProperties = new TopLevelArmResourceUpdateProperties(); + } + this.innerProperties().withUserName(userName); + return this; + } + + /** + * Get the userNames property: The userNames property. + * + * @return the userNames value. + */ + public String userNames() { + return this.innerProperties() == null ? null : this.innerProperties().userNames(); + } + + /** + * Set the userNames property: The userNames property. + * + * @param userNames the userNames value to set. + * @return the TopLevelArmResourceUpdate object itself. + */ + public TopLevelArmResourceUpdate withUserNames(String userNames) { + if (this.innerProperties() == null) { + this.innerProperties = new TopLevelArmResourceUpdateProperties(); + } + this.innerProperties().withUserNames(userNames); + return this; + } + + /** + * Get the accuserName property: The accuserName property. + * + * @return the accuserName value. + */ + public String accuserName() { + return this.innerProperties() == null ? null : this.innerProperties().accuserName(); + } + + /** + * Set the accuserName property: The accuserName property. + * + * @param accuserName the accuserName value to set. + * @return the TopLevelArmResourceUpdate object itself. + */ + public TopLevelArmResourceUpdate withAccuserName(String accuserName) { + if (this.innerProperties() == null) { + this.innerProperties = new TopLevelArmResourceUpdateProperties(); + } + this.innerProperties().withAccuserName(accuserName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelArmResourceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelArmResourceUpdate if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TopLevelArmResourceUpdate. + */ + public static TopLevelArmResourceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelArmResourceUpdate deserializedTopLevelArmResourceUpdate = new TopLevelArmResourceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTopLevelArmResourceUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedTopLevelArmResourceUpdate.innerProperties + = TopLevelArmResourceUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelArmResourceUpdate; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/UserAssignedIdentity.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/UserAssignedIdentity.java new file mode 100644 index 00000000000..b15213ff01d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/UserAssignedIdentity.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armresourceprovider.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.UUID; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + private UUID clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/package-info.java new file mode 100644 index 00000000000..e65297f8ab5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for ArmResourceProvider. + * Arm Resource Provider management API. + */ +package tsptest.armresourceprovider.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/package-info.java new file mode 100644 index 00000000000..3e003e5a626 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armresourceprovider/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for ArmResourceProvider. + * Arm Resource Provider management API. + */ +package tsptest.armresourceprovider; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/ArmResourceProviderManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/ArmResourceProviderManager.java new file mode 100644 index 00000000000..713f0e11761 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/ArmResourceProviderManager.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import tsptest.armstreamstyleserialization.fluent.ArmResourceProviderManagementClient; +import tsptest.armstreamstyleserialization.implementation.ArmResourceProviderManagementClientBuilder; +import tsptest.armstreamstyleserialization.implementation.FishesImpl; +import tsptest.armstreamstyleserialization.implementation.FunctionsImpl; +import tsptest.armstreamstyleserialization.implementation.ItemsImpl; +import tsptest.armstreamstyleserialization.implementation.PrioritiesImpl; +import tsptest.armstreamstyleserialization.implementation.TopLevelArmResourcesImpl; +import tsptest.armstreamstyleserialization.models.Fishes; +import tsptest.armstreamstyleserialization.models.Functions; +import tsptest.armstreamstyleserialization.models.Items; +import tsptest.armstreamstyleserialization.models.Priorities; +import tsptest.armstreamstyleserialization.models.TopLevelArmResources; + +/** + * Entry point to ArmResourceProviderManager. + * Arm Resource Provider management API. + */ +public final class ArmResourceProviderManager { + private Fishes fishes; + + private TopLevelArmResources topLevelArmResources; + + private Functions functions; + + private Priorities priorities; + + private Items items; + + private final ArmResourceProviderManagementClient clientObject; + + private ArmResourceProviderManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ArmResourceProviderManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Arm Resource Provider service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Arm Resource Provider service API instance. + */ + public static ArmResourceProviderManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Arm Resource Provider service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Arm Resource Provider service API instance. + */ + public static ArmResourceProviderManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ArmResourceProviderManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ArmResourceProviderManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ArmResourceProviderManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-armstreamstyleserialization-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Arm Resource Provider service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Arm Resource Provider service API instance. + */ + public ArmResourceProviderManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("tsptest.armstreamstyleserialization") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ArmResourceProviderManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Fishes. + * + * @return Resource collection API of Fishes. + */ + public Fishes fishes() { + if (this.fishes == null) { + this.fishes = new FishesImpl(clientObject.getFishes(), this); + } + return fishes; + } + + /** + * Gets the resource collection API of TopLevelArmResources. + * + * @return Resource collection API of TopLevelArmResources. + */ + public TopLevelArmResources topLevelArmResources() { + if (this.topLevelArmResources == null) { + this.topLevelArmResources = new TopLevelArmResourcesImpl(clientObject.getTopLevelArmResources(), this); + } + return topLevelArmResources; + } + + /** + * Gets the resource collection API of Functions. + * + * @return Resource collection API of Functions. + */ + public Functions functions() { + if (this.functions == null) { + this.functions = new FunctionsImpl(clientObject.getFunctions(), this); + } + return functions; + } + + /** + * Gets the resource collection API of Priorities. + * + * @return Resource collection API of Priorities. + */ + public Priorities priorities() { + if (this.priorities == null) { + this.priorities = new PrioritiesImpl(clientObject.getPriorities(), this); + } + return priorities; + } + + /** + * Gets the resource collection API of Items. + * + * @return Resource collection API of Items. + */ + public Items items() { + if (this.items == null) { + this.items = new ItemsImpl(clientObject.getItems(), this); + } + return items; + } + + /** + * Gets wrapped service client ArmResourceProviderManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client ArmResourceProviderManagementClient. + */ + public ArmResourceProviderManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ArmResourceProviderManagementClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ArmResourceProviderManagementClient.java new file mode 100644 index 00000000000..00f8f96bbdd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ArmResourceProviderManagementClient.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ArmResourceProviderManagementClient class. + */ +public interface ArmResourceProviderManagementClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the FishesClient object to access its operations. + * + * @return the FishesClient object. + */ + FishesClient getFishes(); + + /** + * Gets the TopLevelArmResourcesClient object to access its operations. + * + * @return the TopLevelArmResourcesClient object. + */ + TopLevelArmResourcesClient getTopLevelArmResources(); + + /** + * Gets the FunctionsClient object to access its operations. + * + * @return the FunctionsClient object. + */ + FunctionsClient getFunctions(); + + /** + * Gets the PrioritiesClient object to access its operations. + * + * @return the PrioritiesClient object. + */ + PrioritiesClient getPriorities(); + + /** + * Gets the ItemsClient object to access its operations. + * + * @return the ItemsClient object. + */ + ItemsClient getItems(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FishesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FishesClient.java new file mode 100644 index 00000000000..0124cb6d51c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FishesClient.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import tsptest.armstreamstyleserialization.fluent.models.FishInner; +import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner; + +/** + * An instance of this class provides access to all the operations defined in FishesClient. + */ +public interface FishesClient { + /** + * The getModel operation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws tsptest.armstreamstyleserialization.models.ErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getModelWithResponse(Context context); + + /** + * The getModel operation. + * + * @throws tsptest.armstreamstyleserialization.models.ErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FishInner getModel(); + + /** + * The putModel operation. + * + * @param fish The fish parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws tsptest.armstreamstyleserialization.models.ErrorMinException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response putModelWithResponse(FishInner fish, Context context); + + /** + * The putModel operation. + * + * @param fish The fish parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws tsptest.armstreamstyleserialization.models.ErrorMinException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FishInner putModel(FishInner fish); + + /** + * The getOutputOnlyModel operation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic OutputOnlyModel along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getOutputOnlyModelWithResponse(Context context); + + /** + * The getOutputOnlyModel operation. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic OutputOnlyModel. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OutputOnlyModelInner getOutputOnlyModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FunctionsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FunctionsClient.java new file mode 100644 index 00000000000..247b12c2150 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/FunctionsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.util.Context; +import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; +import tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionResponse; + +/** + * An instance of this class provides access to all the operations defined in FunctionsClient. + */ +public interface FunctionsClient { + /** + * The createFunction operation. + * + * @param function The function parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + FunctionsCreateFunctionResponse createFunctionWithResponse(FunctionInner function, Context context); + + /** + * The createFunction operation. + * + * @param function The function parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + FunctionInner createFunction(FunctionInner function); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ItemsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ItemsClient.java new file mode 100644 index 00000000000..b12428994a8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/ItemsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import tsptest.armstreamstyleserialization.models.Result; + +/** + * An instance of this class provides access to all the operations defined in ItemsClient. + */ +public interface ItemsClient { + /** + * The list operation. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * The list operation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/PrioritiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/PrioritiesClient.java new file mode 100644 index 00000000000..e5802ead91f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/PrioritiesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import tsptest.armstreamstyleserialization.models.Priority; + +/** + * An instance of this class provides access to all the operations defined in PrioritiesClient. + */ +public interface PrioritiesClient { + /** + * The setPriority operation. + * + * @param priority The priority parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response setPriorityWithResponse(Priority priority, Context context); + + /** + * The setPriority operation. + * + * @param priority The priority parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + Priority setPriority(Priority priority); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/TopLevelArmResourcesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/TopLevelArmResourcesClient.java new file mode 100644 index 00000000000..9036fa0ea7d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/TopLevelArmResourcesClient.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner; +import tsptest.armstreamstyleserialization.models.TopLevelArmResourceTagsUpdate; + +/** + * An instance of this class provides access to all the operations defined in TopLevelArmResourcesClient. + */ +public interface TopLevelArmResourcesClient { + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TopLevelArmResourceInner> beginUpdate(String resourceGroupName, + String topLevelArmResourceName, TopLevelArmResourceTagsUpdate properties); + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TopLevelArmResourceInner> beginUpdate(String resourceGroupName, + String topLevelArmResourceName, TopLevelArmResourceTagsUpdate properties, Context context); + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelArmResourceInner update(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceTagsUpdate properties); + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelArmResourceInner update(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceTagsUpdate properties, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/AnotherFishProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/AnotherFishProperties.java new file mode 100644 index 00000000000..0917db30a11 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/AnotherFishProperties.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The AnotherFishProperties model. + */ +@Fluent +public final class AnotherFishProperties implements JsonSerializable { + /* + * The eyeProperties property. + */ + private EyeProperties innerEyeProperties = new EyeProperties(); + + /** + * Creates an instance of AnotherFishProperties class. + */ + public AnotherFishProperties() { + } + + /** + * Get the innerEyeProperties property: The eyeProperties property. + * + * @return the innerEyeProperties value. + */ + private EyeProperties innerEyeProperties() { + return this.innerEyeProperties; + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double length() { + return this.innerEyeProperties() == null ? 0.0 : this.innerEyeProperties().length(); + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the AnotherFishProperties object itself. + */ + public AnotherFishProperties withLength(double length) { + if (this.innerEyeProperties() == null) { + this.innerEyeProperties = new EyeProperties(); + } + this.innerEyeProperties().withLength(length); + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String patten() { + return this.innerEyeProperties() == null ? null : this.innerEyeProperties().patten(); + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredString() { + return this.innerEyeProperties() == null ? null : this.innerEyeProperties().requiredString(); + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the AnotherFishProperties object itself. + */ + public AnotherFishProperties withRequiredString(String requiredString) { + if (this.innerEyeProperties() == null) { + this.innerEyeProperties = new EyeProperties(); + } + this.innerEyeProperties().withRequiredString(requiredString); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerEyeProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerEyeProperties in model AnotherFishProperties")); + } else { + innerEyeProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AnotherFishProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("eyeProperties", this.innerEyeProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AnotherFishProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AnotherFishProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AnotherFishProperties. + */ + public static AnotherFishProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AnotherFishProperties deserializedAnotherFishProperties = new AnotherFishProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("eyeProperties".equals(fieldName)) { + deserializedAnotherFishProperties.innerEyeProperties = EyeProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAnotherFishProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/EyeProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/EyeProperties.java new file mode 100644 index 00000000000..c52bca4111a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/EyeProperties.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The EyeProperties model. + */ +@Fluent +public final class EyeProperties implements JsonSerializable { + /* + * The length property. + */ + private double length; + + /* + * The patten property. + */ + private String patten; + + /* + * The requiredString property. + */ + private String requiredString; + + /** + * Creates an instance of EyeProperties class. + */ + public EyeProperties() { + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double length() { + return this.length; + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the EyeProperties object itself. + */ + public EyeProperties withLength(double length) { + this.length = length; + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String patten() { + return this.patten; + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredString() { + return this.requiredString; + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the EyeProperties object itself. + */ + public EyeProperties withRequiredString(String requiredString) { + this.requiredString = requiredString; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (requiredString() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property requiredString in model EyeProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EyeProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("length", this.length); + jsonWriter.writeStringField("requiredString", this.requiredString); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EyeProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EyeProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EyeProperties. + */ + public static EyeProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EyeProperties deserializedEyeProperties = new EyeProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("length".equals(fieldName)) { + deserializedEyeProperties.length = reader.getDouble(); + } else if ("patten".equals(fieldName)) { + deserializedEyeProperties.patten = reader.getString(); + } else if ("requiredString".equals(fieldName)) { + deserializedEyeProperties.requiredString = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEyeProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishInner.java new file mode 100644 index 00000000000..a72dfffd86f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishInner.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armstreamstyleserialization.models.Shark; + +/** + * This is base model for polymorphic multiple levels inheritance with a discriminator. + */ +@Fluent +public class FishInner implements JsonSerializable { + /* + * Discriminator property for Fish. + */ + private String kind = "Fish"; + + /* + * The age property. + */ + private int age; + + /* + * The dna property. + */ + private String dna; + + /* + * The properties property. + */ + private FishProperties innerProperties = new FishProperties(); + + /* + * The anotherProperties property. + */ + private AnotherFishProperties innerAnotherProperties = new AnotherFishProperties(); + + /** + * Creates an instance of FishInner class. + */ + public FishInner() { + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the age property: The age property. + * + * @return the age value. + */ + public int age() { + return this.age; + } + + /** + * Set the age property: The age property. + * + * @param age the age value to set. + * @return the FishInner object itself. + */ + public FishInner withAge(int age) { + this.age = age; + return this; + } + + /** + * Get the dna property: The dna property. + * + * @return the dna value. + */ + public String dna() { + return this.dna; + } + + /** + * Set the dna property: The dna property. + * + * @param dna the dna value to set. + * @return the FishInner object itself. + */ + FishInner withDna(String dna) { + this.dna = dna; + return this; + } + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private FishProperties innerProperties() { + return this.innerProperties; + } + + /** + * Set the innerProperties property: The properties property. + * + * @param innerProperties the innerProperties value to set. + * @return the FishInner object itself. + */ + FishInner withInnerProperties(FishProperties innerProperties) { + this.innerProperties = innerProperties; + return this; + } + + /** + * Get the innerAnotherProperties property: The anotherProperties property. + * + * @return the innerAnotherProperties value. + */ + private AnotherFishProperties innerAnotherProperties() { + return this.innerAnotherProperties; + } + + /** + * Set the innerAnotherProperties property: The anotherProperties property. + * + * @param innerAnotherProperties the innerAnotherProperties value to set. + * @return the FishInner object itself. + */ + FishInner withInnerAnotherProperties(AnotherFishProperties innerAnotherProperties) { + this.innerAnotherProperties = innerAnotherProperties; + return this; + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double length() { + return this.innerProperties() == null ? 0.0 : this.innerProperties().length(); + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the FishInner object itself. + */ + public FishInner withLength(double length) { + if (this.innerProperties() == null) { + this.innerProperties = new FishProperties(); + } + this.innerProperties().withLength(length); + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String patten() { + return this.innerProperties() == null ? null : this.innerProperties().patten(); + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredString() { + return this.innerProperties() == null ? null : this.innerProperties().requiredString(); + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the FishInner object itself. + */ + public FishInner withRequiredString(String requiredString) { + if (this.innerProperties() == null) { + this.innerProperties = new FishProperties(); + } + this.innerProperties().withRequiredString(requiredString); + return this; + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double lengthAnotherPropertiesLength() { + return this.innerAnotherProperties() == null ? 0.0 : this.innerAnotherProperties().length(); + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the FishInner object itself. + */ + public FishInner withLengthAnotherPropertiesLength(double length) { + if (this.innerAnotherProperties() == null) { + this.innerAnotherProperties = new AnotherFishProperties(); + } + this.innerAnotherProperties().withLength(length); + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String pattenAnotherPropertiesPatten() { + return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().patten(); + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredStringAnotherPropertiesRequiredString() { + return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().requiredString(); + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the FishInner object itself. + */ + public FishInner withRequiredStringAnotherPropertiesRequiredString(String requiredString) { + if (this.innerAnotherProperties() == null) { + this.innerAnotherProperties = new AnotherFishProperties(); + } + this.innerAnotherProperties().withRequiredString(requiredString); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model FishInner")); + } else { + innerProperties().validate(); + } + if (innerAnotherProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerAnotherProperties in model FishInner")); + } else { + innerAnotherProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FishInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("age", this.age); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeJsonField("anotherProperties", this.innerAnotherProperties); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FishInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FishInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FishInner. + */ + public static FishInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("shark".equals(discriminatorValue)) { + return Shark.fromJson(readerToUse.reset()); + } else if ("salmon".equals(discriminatorValue)) { + return SalmonInner.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static FishInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FishInner deserializedFishInner = new FishInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + deserializedFishInner.age = reader.getInt(); + } else if ("dna".equals(fieldName)) { + deserializedFishInner.dna = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedFishInner.innerProperties = FishProperties.fromJson(reader); + } else if ("anotherProperties".equals(fieldName)) { + deserializedFishInner.innerAnotherProperties = AnotherFishProperties.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedFishInner.kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFishInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishProperties.java new file mode 100644 index 00000000000..88e1e104372 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishProperties.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The FishProperties model. + */ +@Fluent +public final class FishProperties implements JsonSerializable { + /* + * The tailProperties property. + */ + private TailProperties innerTailProperties = new TailProperties(); + + /** + * Creates an instance of FishProperties class. + */ + public FishProperties() { + } + + /** + * Get the innerTailProperties property: The tailProperties property. + * + * @return the innerTailProperties value. + */ + private TailProperties innerTailProperties() { + return this.innerTailProperties; + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double length() { + return this.innerTailProperties() == null ? 0.0 : this.innerTailProperties().length(); + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the FishProperties object itself. + */ + public FishProperties withLength(double length) { + if (this.innerTailProperties() == null) { + this.innerTailProperties = new TailProperties(); + } + this.innerTailProperties().withLength(length); + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String patten() { + return this.innerTailProperties() == null ? null : this.innerTailProperties().patten(); + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredString() { + return this.innerTailProperties() == null ? null : this.innerTailProperties().requiredString(); + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the FishProperties object itself. + */ + public FishProperties withRequiredString(String requiredString) { + if (this.innerTailProperties() == null) { + this.innerTailProperties = new TailProperties(); + } + this.innerTailProperties().withRequiredString(requiredString); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerTailProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerTailProperties in model FishProperties")); + } else { + innerTailProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FishProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("tailProperties", this.innerTailProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FishProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FishProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FishProperties. + */ + public static FishProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FishProperties deserializedFishProperties = new FishProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tailProperties".equals(fieldName)) { + deserializedFishProperties.innerTailProperties = TailProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFishProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionConfiguration.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionConfiguration.java new file mode 100644 index 00000000000..68ab939e210 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionConfiguration.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The FunctionConfiguration model. + */ +@Fluent +public final class FunctionConfiguration implements JsonSerializable { + /* + * The input property. + */ + private String input; + + /* + * The output property. + */ + private String output; + + /** + * Creates an instance of FunctionConfiguration class. + */ + public FunctionConfiguration() { + } + + /** + * Get the input property: The input property. + * + * @return the input value. + */ + public String input() { + return this.input; + } + + /** + * Set the input property: The input property. + * + * @param input the input value to set. + * @return the FunctionConfiguration object itself. + */ + public FunctionConfiguration withInput(String input) { + this.input = input; + return this; + } + + /** + * Get the output property: The output property. + * + * @return the output value. + */ + public String output() { + return this.output; + } + + /** + * Set the output property: The output property. + * + * @param output the output value to set. + * @return the FunctionConfiguration object itself. + */ + public FunctionConfiguration withOutput(String output) { + this.output = output; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (input() != null) { + jsonWriter.writeStringField("input", this.input); + } else { + jsonWriter.writeNullField("input"); + } + jsonWriter.writeStringField("output", this.output); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FunctionConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FunctionConfiguration if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the FunctionConfiguration. + */ + public static FunctionConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FunctionConfiguration deserializedFunctionConfiguration = new FunctionConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("input".equals(fieldName)) { + deserializedFunctionConfiguration.input = reader.getString(); + } else if ("output".equals(fieldName)) { + deserializedFunctionConfiguration.output = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFunctionConfiguration; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionInner.java new file mode 100644 index 00000000000..5823f9ad8c4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armstreamstyleserialization.models.FunctionProperties; + +/** + * The Function model. + */ +@Fluent +public final class FunctionInner implements JsonSerializable { + /* + * The properties property. + */ + private FunctionProperties properties; + + /** + * Creates an instance of FunctionInner class. + */ + public FunctionInner() { + } + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public FunctionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @param properties the properties value to set. + * @return the FunctionInner object itself. + */ + public FunctionInner withProperties(FunctionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property properties in model FunctionInner")); + } else { + properties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FunctionInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FunctionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FunctionInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FunctionInner. + */ + public static FunctionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FunctionInner deserializedFunctionInner = new FunctionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedFunctionInner.properties = FunctionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFunctionInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelInner.java new file mode 100644 index 00000000000..f940cd0ea91 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelInner.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armstreamstyleserialization.models.Golden; +import tsptest.armstreamstyleserialization.models.OutputOnlyModelChild; + +/** + * This is base model for polymorphic OutputOnlyModel. + */ +@Immutable +public class OutputOnlyModelInner implements JsonSerializable { + /* + * Discriminator property for OutputOnlyModel. + */ + private String kind = "OutputOnlyModel"; + + /* + * The name property. + */ + private String name; + + /* + * The id property. + */ + private String id; + + /* + * The properties property. + */ + private OutputOnlyModelProperties innerProperties; + + /** + * Creates an instance of OutputOnlyModelInner class. + */ + protected OutputOnlyModelInner() { + } + + /** + * Get the kind property: Discriminator property for OutputOnlyModel. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the OutputOnlyModelInner object itself. + */ + OutputOnlyModelInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The id property. + * + * @param id the id value to set. + * @return the OutputOnlyModelInner object itself. + */ + OutputOnlyModelInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private OutputOnlyModelProperties innerProperties() { + return this.innerProperties; + } + + /** + * Set the innerProperties property: The properties property. + * + * @param innerProperties the innerProperties value to set. + * @return the OutputOnlyModelInner object itself. + */ + OutputOnlyModelInner withInnerProperties(OutputOnlyModelProperties innerProperties) { + this.innerProperties = innerProperties; + return this; + } + + /** + * Get the title property: The title property. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Get the dog property: The dog property. + * + * @return the dog value. + */ + public Golden dog() { + return this.innerProperties() == null ? null : this.innerProperties().dog(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model OutputOnlyModelInner")); + } + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model OutputOnlyModelInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OutputOnlyModelInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OutputOnlyModelInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OutputOnlyModelInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OutputOnlyModelInner. + */ + public static OutputOnlyModelInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("child".equals(discriminatorValue)) { + return OutputOnlyModelChild.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static OutputOnlyModelInner fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OutputOnlyModelInner deserializedOutputOnlyModelInner = new OutputOnlyModelInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOutputOnlyModelInner.name = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedOutputOnlyModelInner.id = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedOutputOnlyModelInner.innerProperties = OutputOnlyModelProperties.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedOutputOnlyModelInner.kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOutputOnlyModelInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelProperties.java new file mode 100644 index 00000000000..5e5ad9f0338 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelProperties.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armstreamstyleserialization.models.Golden; + +/** + * The OutputOnlyModelProperties model. + */ +@Immutable +public final class OutputOnlyModelProperties implements JsonSerializable { + /* + * The title property. + */ + private String title; + + /* + * The dog property. + */ + private Golden dog; + + /** + * Creates an instance of OutputOnlyModelProperties class. + */ + private OutputOnlyModelProperties() { + } + + /** + * Get the title property: The title property. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Get the dog property: The dog property. + * + * @return the dog value. + */ + public Golden dog() { + return this.dog; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (title() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property title in model OutputOnlyModelProperties")); + } + if (dog() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property dog in model OutputOnlyModelProperties")); + } else { + dog().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OutputOnlyModelProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeJsonField("dog", this.dog); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OutputOnlyModelProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OutputOnlyModelProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OutputOnlyModelProperties. + */ + public static OutputOnlyModelProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OutputOnlyModelProperties deserializedOutputOnlyModelProperties = new OutputOnlyModelProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedOutputOnlyModelProperties.title = reader.getString(); + } else if ("dog".equals(fieldName)) { + deserializedOutputOnlyModelProperties.dog = Golden.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOutputOnlyModelProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/ResultData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/ResultData.java new file mode 100644 index 00000000000..5af92891851 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/ResultData.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ResultData model. + */ +@Immutable +public final class ResultData implements JsonSerializable { + /* + * The prop1 property. + */ + private String prop1; + + /* + * The prop2 property. + */ + private String prop2; + + /** + * Creates an instance of ResultData class. + */ + private ResultData() { + } + + /** + * Get the prop1 property: The prop1 property. + * + * @return the prop1 value. + */ + public String prop1() { + return this.prop1; + } + + /** + * Get the prop2 property: The prop2 property. + * + * @return the prop2 value. + */ + public String prop2() { + return this.prop2; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (prop1() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property prop1 in model ResultData")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResultData.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop1", this.prop1); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResultData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResultData if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResultData. + */ + public static ResultData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResultData deserializedResultData = new ResultData(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop1".equals(fieldName)) { + deserializedResultData.prop1 = reader.getString(); + } else if ("prop2".equals(fieldName)) { + deserializedResultData.prop2 = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResultData; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/SalmonInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/SalmonInner.java new file mode 100644 index 00000000000..5126f1a744f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/SalmonInner.java @@ -0,0 +1,375 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic + * instances. + */ +@Fluent +public final class SalmonInner extends FishInner { + /* + * Discriminator property for Fish. + */ + private String kind = "salmon"; + + /* + * The friends property. + */ + private List friends; + + /* + * The hate property. + */ + private Map hate; + + /* + * The partner property. + */ + private FishInner partner; + + /* + * The anotherProperties property. + */ + private AnotherFishProperties innerAnotherProperties = new AnotherFishProperties(); + + /* + * The properties property. + */ + private FishProperties innerProperties = new FishProperties(); + + /* + * The dna property. + */ + private String dna; + + /** + * Creates an instance of SalmonInner class. + */ + public SalmonInner() { + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Override + public String kind() { + return this.kind; + } + + /** + * Get the friends property: The friends property. + * + * @return the friends value. + */ + public List friends() { + return this.friends; + } + + /** + * Set the friends property: The friends property. + * + * @param friends the friends value to set. + * @return the SalmonInner object itself. + */ + public SalmonInner withFriends(List friends) { + this.friends = friends; + return this; + } + + /** + * Get the hate property: The hate property. + * + * @return the hate value. + */ + public Map hate() { + return this.hate; + } + + /** + * Set the hate property: The hate property. + * + * @param hate the hate value to set. + * @return the SalmonInner object itself. + */ + public SalmonInner withHate(Map hate) { + this.hate = hate; + return this; + } + + /** + * Get the partner property: The partner property. + * + * @return the partner value. + */ + public FishInner partner() { + return this.partner; + } + + /** + * Set the partner property: The partner property. + * + * @param partner the partner value to set. + * @return the SalmonInner object itself. + */ + public SalmonInner withPartner(FishInner partner) { + this.partner = partner; + return this; + } + + /** + * Get the innerAnotherProperties property: The anotherProperties property. + * + * @return the innerAnotherProperties value. + */ + private AnotherFishProperties innerAnotherProperties() { + return this.innerAnotherProperties; + } + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private FishProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the dna property: The dna property. + * + * @return the dna value. + */ + @Override + public String dna() { + return this.dna; + } + + /** + * {@inheritDoc} + */ + @Override + public SalmonInner withAge(int age) { + super.withAge(age); + return this; + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double length() { + return this.innerProperties() == null ? 0.0 : this.innerProperties().length(); + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the SalmonInner object itself. + */ + public SalmonInner withLength(double length) { + if (this.innerProperties() == null) { + this.innerProperties = new FishProperties(); + } + this.innerProperties().withLength(length); + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String patten() { + return this.innerProperties() == null ? null : this.innerProperties().patten(); + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredString() { + return this.innerProperties() == null ? null : this.innerProperties().requiredString(); + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the SalmonInner object itself. + */ + public SalmonInner withRequiredString(String requiredString) { + if (this.innerProperties() == null) { + this.innerProperties = new FishProperties(); + } + this.innerProperties().withRequiredString(requiredString); + return this; + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double lengthAnotherPropertiesLength() { + return this.innerAnotherProperties() == null ? 0.0 : this.innerAnotherProperties().length(); + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the SalmonInner object itself. + */ + public SalmonInner withLengthAnotherPropertiesLength(double length) { + if (this.innerAnotherProperties() == null) { + this.innerAnotherProperties = new AnotherFishProperties(); + } + this.innerAnotherProperties().withLength(length); + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String pattenAnotherPropertiesPatten() { + return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().patten(); + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredStringAnotherPropertiesRequiredString() { + return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().requiredString(); + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the SalmonInner object itself. + */ + public SalmonInner withRequiredStringAnotherPropertiesRequiredString(String requiredString) { + if (this.innerAnotherProperties() == null) { + this.innerAnotherProperties = new AnotherFishProperties(); + } + this.innerAnotherProperties().withRequiredString(requiredString); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (friends() != null) { + friends().forEach(e -> e.validate()); + } + if (hate() != null) { + hate().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + if (partner() != null) { + partner().validate(); + } + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model SalmonInner")); + } else { + innerProperties().validate(); + } + if (innerAnotherProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerAnotherProperties in model SalmonInner")); + } else { + innerAnotherProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SalmonInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("age", age()); + jsonWriter.writeJsonField("properties", innerProperties()); + jsonWriter.writeJsonField("anotherProperties", innerAnotherProperties()); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeArrayField("friends", this.friends, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("hate", this.hate, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("partner", this.partner); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SalmonInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SalmonInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SalmonInner. + */ + public static SalmonInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SalmonInner deserializedSalmonInner = new SalmonInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + deserializedSalmonInner.withAge(reader.getInt()); + } else if ("dna".equals(fieldName)) { + deserializedSalmonInner.dna = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSalmonInner.innerProperties = FishProperties.fromJson(reader); + } else if ("anotherProperties".equals(fieldName)) { + deserializedSalmonInner.innerAnotherProperties = AnotherFishProperties.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedSalmonInner.kind = reader.getString(); + } else if ("friends".equals(fieldName)) { + List friends = reader.readArray(reader1 -> FishInner.fromJson(reader1)); + deserializedSalmonInner.friends = friends; + } else if ("hate".equals(fieldName)) { + Map hate = reader.readMap(reader1 -> FishInner.fromJson(reader1)); + deserializedSalmonInner.hate = hate; + } else if ("partner".equals(fieldName)) { + deserializedSalmonInner.partner = FishInner.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSalmonInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TailProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TailProperties.java new file mode 100644 index 00000000000..c1354910d4a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TailProperties.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The TailProperties model. + */ +@Fluent +public final class TailProperties implements JsonSerializable { + /* + * The length property. + */ + private double length; + + /* + * The patten property. + */ + private String patten; + + /* + * The requiredString property. + */ + private String requiredString; + + /** + * Creates an instance of TailProperties class. + */ + public TailProperties() { + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double length() { + return this.length; + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the TailProperties object itself. + */ + public TailProperties withLength(double length) { + this.length = length; + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String patten() { + return this.patten; + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredString() { + return this.requiredString; + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the TailProperties object itself. + */ + public TailProperties withRequiredString(String requiredString) { + this.requiredString = requiredString; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (requiredString() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property requiredString in model TailProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TailProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("length", this.length); + jsonWriter.writeStringField("requiredString", this.requiredString); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TailProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TailProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TailProperties. + */ + public static TailProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TailProperties deserializedTailProperties = new TailProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("length".equals(fieldName)) { + deserializedTailProperties.length = reader.getDouble(); + } else if ("patten".equals(fieldName)) { + deserializedTailProperties.patten = reader.getString(); + } else if ("requiredString".equals(fieldName)) { + deserializedTailProperties.requiredString = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTailProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TopLevelArmResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TopLevelArmResourceInner.java new file mode 100644 index 00000000000..98f5922bd72 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/TopLevelArmResourceInner.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; +import tsptest.armstreamstyleserialization.models.TopLevelArmResourceProperties; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Immutable +public final class TopLevelArmResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private TopLevelArmResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TopLevelArmResourceInner class. + */ + private TopLevelArmResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public TopLevelArmResourceProperties properties() { + return this.properties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelArmResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelArmResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TopLevelArmResourceInner. + */ + public static TopLevelArmResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelArmResourceInner deserializedTopLevelArmResourceInner = new TopLevelArmResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTopLevelArmResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTopLevelArmResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTopLevelArmResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedTopLevelArmResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTopLevelArmResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedTopLevelArmResourceInner.properties = TopLevelArmResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedTopLevelArmResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelArmResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/package-info.java new file mode 100644 index 00000000000..fa1a97ef95a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for ArmResourceProvider. + * Arm Resource Provider management API. + */ +package tsptest.armstreamstyleserialization.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/package-info.java new file mode 100644 index 00000000000..6683350fdd5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for ArmResourceProvider. + * Arm Resource Provider management API. + */ +package tsptest.armstreamstyleserialization.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientBuilder.java new file mode 100644 index 00000000000..be08069cda1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the ArmResourceProviderManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ArmResourceProviderManagementClientImpl.class }) +public final class ArmResourceProviderManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ArmResourceProviderManagementClientBuilder. + */ + public ArmResourceProviderManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the ArmResourceProviderManagementClientBuilder. + */ + public ArmResourceProviderManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ArmResourceProviderManagementClientBuilder. + */ + public ArmResourceProviderManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 ArmResourceProviderManagementClientBuilder. + */ + public ArmResourceProviderManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ArmResourceProviderManagementClientBuilder. + */ + public ArmResourceProviderManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 ArmResourceProviderManagementClientBuilder. + */ + public ArmResourceProviderManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ArmResourceProviderManagementClientImpl with the provided parameters. + * + * @return an instance of ArmResourceProviderManagementClientImpl. + */ + public ArmResourceProviderManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + ArmResourceProviderManagementClientImpl client = new ArmResourceProviderManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientImpl.java new file mode 100644 index 00000000000..9dd35d711f9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientImpl.java @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armstreamstyleserialization.fluent.ArmResourceProviderManagementClient; +import tsptest.armstreamstyleserialization.fluent.FishesClient; +import tsptest.armstreamstyleserialization.fluent.FunctionsClient; +import tsptest.armstreamstyleserialization.fluent.ItemsClient; +import tsptest.armstreamstyleserialization.fluent.PrioritiesClient; +import tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient; + +/** + * Initializes a new instance of the ArmResourceProviderManagementClientImpl type. + */ +@ServiceClient(builder = ArmResourceProviderManagementClientBuilder.class) +public final class ArmResourceProviderManagementClientImpl implements ArmResourceProviderManagementClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The FishesClient object to access its operations. + */ + private final FishesClient fishes; + + /** + * Gets the FishesClient object to access its operations. + * + * @return the FishesClient object. + */ + public FishesClient getFishes() { + return this.fishes; + } + + /** + * The TopLevelArmResourcesClient object to access its operations. + */ + private final TopLevelArmResourcesClient topLevelArmResources; + + /** + * Gets the TopLevelArmResourcesClient object to access its operations. + * + * @return the TopLevelArmResourcesClient object. + */ + public TopLevelArmResourcesClient getTopLevelArmResources() { + return this.topLevelArmResources; + } + + /** + * The FunctionsClient object to access its operations. + */ + private final FunctionsClient functions; + + /** + * Gets the FunctionsClient object to access its operations. + * + * @return the FunctionsClient object. + */ + public FunctionsClient getFunctions() { + return this.functions; + } + + /** + * The PrioritiesClient object to access its operations. + */ + private final PrioritiesClient priorities; + + /** + * Gets the PrioritiesClient object to access its operations. + * + * @return the PrioritiesClient object. + */ + public PrioritiesClient getPriorities() { + return this.priorities; + } + + /** + * The ItemsClient object to access its operations. + */ + private final ItemsClient items; + + /** + * Gets the ItemsClient object to access its operations. + * + * @return the ItemsClient object. + */ + public ItemsClient getItems() { + return this.items; + } + + /** + * Initializes an instance of ArmResourceProviderManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + ArmResourceProviderManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2023-12-01-preview"; + this.fishes = new FishesClientImpl(this); + this.topLevelArmResources = new TopLevelArmResourcesClientImpl(this); + this.functions = new FunctionsClientImpl(this); + this.priorities = new PrioritiesClientImpl(this); + this.items = new ItemsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ArmResourceProviderManagementClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishImpl.java new file mode 100644 index 00000000000..156681884c5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import tsptest.armstreamstyleserialization.fluent.models.FishInner; +import tsptest.armstreamstyleserialization.models.Fish; + +public final class FishImpl implements Fish { + private FishInner innerObject; + + private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; + + FishImpl(FishInner innerObject, tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String kind() { + return this.innerModel().kind(); + } + + public int age() { + return this.innerModel().age(); + } + + public String dna() { + return this.innerModel().dna(); + } + + public double length() { + return this.innerModel().length(); + } + + public String patten() { + return this.innerModel().patten(); + } + + public String requiredString() { + return this.innerModel().requiredString(); + } + + public double lengthAnotherPropertiesLength() { + return this.innerModel().lengthAnotherPropertiesLength(); + } + + public String pattenAnotherPropertiesPatten() { + return this.innerModel().pattenAnotherPropertiesPatten(); + } + + public String requiredStringAnotherPropertiesRequiredString() { + return this.innerModel().requiredStringAnotherPropertiesRequiredString(); + } + + public FishInner innerModel() { + return this.innerObject; + } + + private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesClientImpl.java new file mode 100644 index 00000000000..ab3fe579502 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesClientImpl.java @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import reactor.core.publisher.Mono; +import tsptest.armstreamstyleserialization.fluent.FishesClient; +import tsptest.armstreamstyleserialization.fluent.models.FishInner; +import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner; +import tsptest.armstreamstyleserialization.models.ErrorException; +import tsptest.armstreamstyleserialization.models.ErrorMinException; + +/** + * An instance of this class provides access to all the operations defined in FishesClient. + */ +public final class FishesClientImpl implements FishesClient { + /** + * The proxy service used to perform REST calls. + */ + private final FishesService service; + + /** + * The service client containing this operation class. + */ + private final ArmResourceProviderManagementClientImpl client; + + /** + * Initializes an instance of FishesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FishesClientImpl(ArmResourceProviderManagementClientImpl client) { + this.service = RestProxy.create(FishesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmResourceProviderManagementClientFishes to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmResourceProviderManagementClientFishes") + public interface FishesService { + @Headers({ "Content-Type: application/json" }) + @Get("/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorException.class) + Mono> getModel(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorException.class) + Response getModelSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + Context context); + + @Put("/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorMinException.class) + Mono> putModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FishInner fish, Context context); + + @Put("/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ErrorMinException.class) + Response putModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FishInner fish, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/model/output") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getOutputOnlyModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/model/output") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getOutputOnlyModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * The getModel operation. + * + * @throws ErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getModelWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getModel(this.client.getEndpoint(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The getModel operation. + * + * @throws ErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getModelAsync() { + return getModelWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The getModel operation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getModelWithResponse(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getModelSync(this.client.getEndpoint(), accept, context); + } + + /** + * The getModel operation. + * + * @throws ErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FishInner getModel() { + return getModelWithResponse(Context.NONE).getValue(); + } + + /** + * The putModel operation. + * + * @param fish The fish parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorMinException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putModelWithResponseAsync(FishInner fish) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (fish == null) { + return Mono.error(new IllegalArgumentException("Parameter fish is required and cannot be null.")); + } else { + fish.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.putModel(this.client.getEndpoint(), contentType, accept, fish, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The putModel operation. + * + * @param fish The fish parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorMinException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putModelAsync(FishInner fish) { + return putModelWithResponseAsync(fish).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The putModel operation. + * + * @param fish The fish parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorMinException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putModelWithResponse(FishInner fish, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (fish == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter fish is required and cannot be null.")); + } else { + fish.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putModelSync(this.client.getEndpoint(), contentType, accept, fish, context); + } + + /** + * The putModel operation. + * + * @param fish The fish parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorMinException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FishInner putModel(FishInner fish) { + return putModelWithResponse(fish, Context.NONE).getValue(); + } + + /** + * The getOutputOnlyModel operation. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic OutputOnlyModel along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOutputOnlyModelWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getOutputOnlyModel(this.client.getEndpoint(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The getOutputOnlyModel operation. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic OutputOnlyModel on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getOutputOnlyModelAsync() { + return getOutputOnlyModelWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The getOutputOnlyModel operation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic OutputOnlyModel along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOutputOnlyModelWithResponse(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getOutputOnlyModelSync(this.client.getEndpoint(), accept, context); + } + + /** + * The getOutputOnlyModel operation. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic OutputOnlyModel. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OutputOnlyModelInner getOutputOnlyModel() { + return getOutputOnlyModelWithResponse(Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(FishesClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesImpl.java new file mode 100644 index 00000000000..99a767143f0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesImpl.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armstreamstyleserialization.fluent.FishesClient; +import tsptest.armstreamstyleserialization.fluent.models.FishInner; +import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner; +import tsptest.armstreamstyleserialization.models.Fish; +import tsptest.armstreamstyleserialization.models.Fishes; +import tsptest.armstreamstyleserialization.models.OutputOnlyModel; + +public final class FishesImpl implements Fishes { + private static final ClientLogger LOGGER = new ClientLogger(FishesImpl.class); + + private final FishesClient innerClient; + + private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; + + public FishesImpl(FishesClient innerClient, + tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getModelWithResponse(Context context) { + Response inner = this.serviceClient().getModelWithResponse(context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FishImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Fish getModel() { + FishInner inner = this.serviceClient().getModel(); + if (inner != null) { + return new FishImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response putModelWithResponse(FishInner fish, Context context) { + Response inner = this.serviceClient().putModelWithResponse(fish, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FishImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Fish putModel(FishInner fish) { + FishInner inner = this.serviceClient().putModel(fish); + if (inner != null) { + return new FishImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getOutputOnlyModelWithResponse(Context context) { + Response inner = this.serviceClient().getOutputOnlyModelWithResponse(context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new OutputOnlyModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OutputOnlyModel getOutputOnlyModel() { + OutputOnlyModelInner inner = this.serviceClient().getOutputOnlyModel(); + if (inner != null) { + return new OutputOnlyModelImpl(inner, this.manager()); + } else { + return null; + } + } + + private FishesClient serviceClient() { + return this.innerClient; + } + + private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionImpl.java new file mode 100644 index 00000000000..d6aa7a40ffd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; +import tsptest.armstreamstyleserialization.models.Function; +import tsptest.armstreamstyleserialization.models.FunctionProperties; + +public final class FunctionImpl implements Function { + private FunctionInner innerObject; + + private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; + + FunctionImpl(FunctionInner innerObject, + tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public FunctionProperties properties() { + return this.innerModel().properties(); + } + + public FunctionInner innerModel() { + return this.innerObject; + } + + private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsClientImpl.java new file mode 100644 index 00000000000..538e58461d1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsClientImpl.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import reactor.core.publisher.Mono; +import tsptest.armstreamstyleserialization.fluent.FunctionsClient; +import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; +import tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionResponse; + +/** + * An instance of this class provides access to all the operations defined in FunctionsClient. + */ +public final class FunctionsClientImpl implements FunctionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final FunctionsService service; + + /** + * The service client containing this operation class. + */ + private final ArmResourceProviderManagementClientImpl client; + + /** + * Initializes an instance of FunctionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FunctionsClientImpl(ArmResourceProviderManagementClientImpl client) { + this.service + = RestProxy.create(FunctionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmResourceProviderManagementClientFunctions to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmResourceProviderManagementClientFunctions") + public interface FunctionsService { + @Put("/function") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono createFunction(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FunctionInner function, Context context); + + @Put("/function") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + FunctionsCreateFunctionResponse createFunctionSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") FunctionInner function, Context context); + } + + /** + * The createFunction operation. + * + * @param function The function parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createFunctionWithResponseAsync(FunctionInner function) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (function == null) { + return Mono.error(new IllegalArgumentException("Parameter function is required and cannot be null.")); + } else { + function.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.createFunction(this.client.getEndpoint(), contentType, accept, function, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The createFunction operation. + * + * @param function The function parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createFunctionAsync(FunctionInner function) { + return createFunctionWithResponseAsync(function).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The createFunction operation. + * + * @param function The function parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 FunctionsCreateFunctionResponse createFunctionWithResponse(FunctionInner function, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (function == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter function is required and cannot be null.")); + } else { + function.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createFunctionSync(this.client.getEndpoint(), contentType, accept, function, context); + } + + /** + * The createFunction operation. + * + * @param function The function parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 FunctionInner createFunction(FunctionInner function) { + return createFunctionWithResponse(function, Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(FunctionsClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsImpl.java new file mode 100644 index 00000000000..603fcde2ec4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armstreamstyleserialization.fluent.FunctionsClient; +import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; +import tsptest.armstreamstyleserialization.models.Function; +import tsptest.armstreamstyleserialization.models.Functions; +import tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionResponse; + +public final class FunctionsImpl implements Functions { + private static final ClientLogger LOGGER = new ClientLogger(FunctionsImpl.class); + + private final FunctionsClient innerClient; + + private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; + + public FunctionsImpl(FunctionsClient innerClient, + tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response createFunctionWithResponse(FunctionInner function, Context context) { + FunctionsCreateFunctionResponse inner = this.serviceClient().createFunctionWithResponse(function, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new FunctionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Function createFunction(FunctionInner function) { + FunctionInner inner = this.serviceClient().createFunction(function); + if (inner != null) { + return new FunctionImpl(inner, this.manager()); + } else { + return null; + } + } + + private FunctionsClient serviceClient() { + return this.innerClient; + } + + private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsClientImpl.java new file mode 100644 index 00000000000..70d6dc0ac48 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsClientImpl.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armstreamstyleserialization.fluent.ItemsClient; +import tsptest.armstreamstyleserialization.implementation.models.ListResult; +import tsptest.armstreamstyleserialization.models.Result; + +/** + * An instance of this class provides access to all the operations defined in ItemsClient. + */ +public final class ItemsClientImpl implements ItemsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ItemsService service; + + /** + * The service client containing this operation class. + */ + private final ArmResourceProviderManagementClientImpl client; + + /** + * Initializes an instance of ItemsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ItemsClientImpl(ArmResourceProviderManagementClientImpl client) { + this.service = RestProxy.create(ItemsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmResourceProviderManagementClientItems to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmResourceProviderManagementClientItems") + public interface ItemsService { + @Headers({ "Content-Type: application/json" }) + @Get("/items") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> list(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/items") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * The list operation. + * + * @throws ManagementException 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 body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> { + Mono>> mono = service.list(this.client.getEndpoint(), accept, context).cache(); + return Mono.zip(mono, + this.client + .getLroResult(mono, this.client.getHttpPipeline(), ListResult.class, + ListResult.class, this.client.getContext()) + .last() + .flatMap(this.client::getLroFinalResultOrError)); + }) + .>map( + res -> new PagedResponseBase<>(res.getT1().getRequest(), res.getT1().getStatusCode(), + res.getT1().getHeaders(), res.getT2().items(), res.getT2().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The list operation. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The list operation. + * + * @throws ManagementException 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 body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), accept, Context.NONE); + ListResult lroPageableResult + = this.client.getLroResult(res, ListResult.class, ListResult.class, Context.NONE) + .getFinalResult(); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + lroPageableResult.items(), lroPageableResult.nextLink(), null); + } + + /** + * The list operation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), accept, context); + ListResult lroPageableResult + = this.client.getLroResult(res, ListResult.class, ListResult.class, context) + .getFinalResult(); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + lroPageableResult.items(), lroPageableResult.nextLink(), null); + } + + /** + * The list operation. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * The list operation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().items(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().items(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().items(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(ItemsClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsImpl.java new file mode 100644 index 00000000000..37ad1648542 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armstreamstyleserialization.fluent.ItemsClient; +import tsptest.armstreamstyleserialization.models.Items; +import tsptest.armstreamstyleserialization.models.Result; + +public final class ItemsImpl implements Items { + private static final ClientLogger LOGGER = new ClientLogger(ItemsImpl.class); + + private final ItemsClient innerClient; + + private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; + + public ItemsImpl(ItemsClient innerClient, + tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + return this.serviceClient().list(); + } + + public PagedIterable list(Context context) { + return this.serviceClient().list(context); + } + + private ItemsClient serviceClient() { + return this.innerClient; + } + + private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/OutputOnlyModelImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/OutputOnlyModelImpl.java new file mode 100644 index 00000000000..7c34374c38f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/OutputOnlyModelImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner; +import tsptest.armstreamstyleserialization.models.Golden; +import tsptest.armstreamstyleserialization.models.OutputOnlyModel; + +public final class OutputOnlyModelImpl implements OutputOnlyModel { + private OutputOnlyModelInner innerObject; + + private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; + + OutputOnlyModelImpl(OutputOnlyModelInner innerObject, + tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String kind() { + return this.innerModel().kind(); + } + + public String name() { + return this.innerModel().name(); + } + + public String id() { + return this.innerModel().id(); + } + + public String title() { + return this.innerModel().title(); + } + + public Golden dog() { + return this.innerModel().dog(); + } + + public OutputOnlyModelInner innerModel() { + return this.innerObject; + } + + private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesClientImpl.java new file mode 100644 index 00000000000..45564684237 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesClientImpl.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import reactor.core.publisher.Mono; +import tsptest.armstreamstyleserialization.fluent.PrioritiesClient; +import tsptest.armstreamstyleserialization.models.Priority; + +/** + * An instance of this class provides access to all the operations defined in PrioritiesClient. + */ +public final class PrioritiesClientImpl implements PrioritiesClient { + /** + * The proxy service used to perform REST calls. + */ + private final PrioritiesService service; + + /** + * The service client containing this operation class. + */ + private final ArmResourceProviderManagementClientImpl client; + + /** + * Initializes an instance of PrioritiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrioritiesClientImpl(ArmResourceProviderManagementClientImpl client) { + this.service + = RestProxy.create(PrioritiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmResourceProviderManagementClientPriorities to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmResourceProviderManagementClientPriorities") + public interface PrioritiesService { + @Headers({ "Content-Type: application/json" }) + @Post("/priority") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> setPriority(@HostParam("endpoint") String endpoint, + @QueryParam("priority") Priority priority, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/priority") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response setPrioritySync(@HostParam("endpoint") String endpoint, + @QueryParam("priority") Priority priority, @HeaderParam("Accept") String accept, Context context); + } + + /** + * The setPriority operation. + * + * @param priority The priority parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> setPriorityWithResponseAsync(Priority priority) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (priority == null) { + return Mono.error(new IllegalArgumentException("Parameter priority is required and cannot be null.")); + } + final String accept = "text/plain"; + return FluxUtil + .withContext(context -> service.setPriority(this.client.getEndpoint(), priority, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The setPriority operation. + * + * @param priority The priority parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono setPriorityAsync(Priority priority) { + return setPriorityWithResponseAsync(priority).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The setPriority operation. + * + * @param priority The priority parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setPriorityWithResponse(Priority priority, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (priority == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter priority is required and cannot be null.")); + } + final String accept = "text/plain"; + return service.setPrioritySync(this.client.getEndpoint(), priority, accept, context); + } + + /** + * The setPriority operation. + * + * @param priority The priority parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Priority setPriority(Priority priority) { + return setPriorityWithResponse(priority, Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(PrioritiesClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesImpl.java new file mode 100644 index 00000000000..b035724262b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armstreamstyleserialization.fluent.PrioritiesClient; +import tsptest.armstreamstyleserialization.models.Priorities; +import tsptest.armstreamstyleserialization.models.Priority; + +public final class PrioritiesImpl implements Priorities { + private static final ClientLogger LOGGER = new ClientLogger(PrioritiesImpl.class); + + private final PrioritiesClient innerClient; + + private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; + + public PrioritiesImpl(PrioritiesClient innerClient, + tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response setPriorityWithResponse(Priority priority, Context context) { + return this.serviceClient().setPriorityWithResponse(priority, context); + } + + public Priority setPriority(Priority priority) { + return this.serviceClient().setPriority(priority); + } + + private PrioritiesClient serviceClient() { + return this.innerClient; + } + + private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ResourceManagerUtils.java new file mode 100644 index 00000000000..07de5519407 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/SalmonImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/SalmonImpl.java new file mode 100644 index 00000000000..4bb0968d5dc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/SalmonImpl.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import tsptest.armstreamstyleserialization.fluent.models.FishInner; +import tsptest.armstreamstyleserialization.fluent.models.SalmonInner; +import tsptest.armstreamstyleserialization.models.Fish; +import tsptest.armstreamstyleserialization.models.Salmon; + +public final class SalmonImpl implements Salmon { + private SalmonInner innerObject; + + private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; + + SalmonImpl(SalmonInner innerObject, tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public int age() { + return this.innerModel().age(); + } + + public String dna() { + return this.innerModel().dna(); + } + + public double length() { + return this.innerModel().length(); + } + + public String patten() { + return this.innerModel().patten(); + } + + public String requiredString() { + return this.innerModel().requiredString(); + } + + public double lengthAnotherPropertiesLength() { + return this.innerModel().lengthAnotherPropertiesLength(); + } + + public String pattenAnotherPropertiesPatten() { + return this.innerModel().pattenAnotherPropertiesPatten(); + } + + public String requiredStringAnotherPropertiesRequiredString() { + return this.innerModel().requiredStringAnotherPropertiesRequiredString(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public List friends() { + List inner = this.innerModel().friends(); + if (inner != null) { + return Collections.unmodifiableList( + inner.stream().map(inner1 -> new FishImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Map hate() { + Map inner = this.innerModel().hate(); + if (inner != null) { + return Collections.unmodifiableMap(inner.entrySet() + .stream() + .collect( + Collectors.toMap(Map.Entry::getKey, inner1 -> new FishImpl(inner1.getValue(), this.manager())))); + } else { + return Collections.emptyMap(); + } + } + + public Fish partner() { + FishInner inner = this.innerModel().partner(); + if (inner != null) { + return new FishImpl(inner, this.manager()); + } else { + return null; + } + } + + public SalmonInner innerModel() { + return this.innerObject; + } + + private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourceImpl.java new file mode 100644 index 00000000000..0ed8d7103ce --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourceImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.management.SystemData; +import java.util.Collections; +import java.util.Map; +import tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner; +import tsptest.armstreamstyleserialization.models.TopLevelArmResource; +import tsptest.armstreamstyleserialization.models.TopLevelArmResourceProperties; + +public final class TopLevelArmResourceImpl implements TopLevelArmResource { + private TopLevelArmResourceInner innerObject; + + private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; + + TopLevelArmResourceImpl(TopLevelArmResourceInner innerObject, + tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public TopLevelArmResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public TopLevelArmResourceInner innerModel() { + return this.innerObject; + } + + private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesClientImpl.java new file mode 100644 index 00000000000..9d74a3f663d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesClientImpl.java @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient; +import tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner; +import tsptest.armstreamstyleserialization.models.TopLevelArmResourceTagsUpdate; + +/** + * An instance of this class provides access to all the operations defined in TopLevelArmResourcesClient. + */ +public final class TopLevelArmResourcesClientImpl implements TopLevelArmResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final TopLevelArmResourcesService service; + + /** + * The service client containing this operation class. + */ + private final ArmResourceProviderManagementClientImpl client; + + /** + * Initializes an instance of TopLevelArmResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TopLevelArmResourcesClientImpl(ArmResourceProviderManagementClientImpl client) { + this.service = RestProxy.create(TopLevelArmResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmResourceProviderManagementClientTopLevelArmResources to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmResourceProviderManagementClientTopLevelArmResources") + public interface TopLevelArmResourcesService { + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmStreamStyleSerialization/topLevelArmResources/{topLevelArmResourceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") TopLevelArmResourceTagsUpdate properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmStreamStyleSerialization/topLevelArmResources/{topLevelArmResourceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourceName") String topLevelArmResourceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") TopLevelArmResourceTagsUpdate properties, Context context); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String topLevelArmResourceName, TopLevelArmResourceTagsUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (topLevelArmResourceName == null) { + return Mono.error( + new IllegalArgumentException("Parameter topLevelArmResourceName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceTagsUpdate properties) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (topLevelArmResourceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter topLevelArmResourceName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, + properties, Context.NONE); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceTagsUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (topLevelArmResourceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter topLevelArmResourceName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourceName, contentType, accept, + properties, context); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TopLevelArmResourceInner> beginUpdateAsync( + String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceTagsUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, topLevelArmResourceName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, + this.client.getContext()); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TopLevelArmResourceInner> beginUpdate( + String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceTagsUpdate properties) { + Response response = updateWithResponse(resourceGroupName, topLevelArmResourceName, properties); + return this.client.getLroResult(response, + TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, Context.NONE); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TopLevelArmResourceInner> beginUpdate( + String resourceGroupName, String topLevelArmResourceName, TopLevelArmResourceTagsUpdate properties, + Context context) { + Response response + = updateWithResponse(resourceGroupName, topLevelArmResourceName, properties, context); + return this.client.getLroResult(response, + TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, context); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceTagsUpdate properties) { + return beginUpdateAsync(resourceGroupName, topLevelArmResourceName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelArmResourceInner update(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceTagsUpdate properties) { + return beginUpdate(resourceGroupName, topLevelArmResourceName, properties).getFinalResult(); + } + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelArmResourceInner update(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceTagsUpdate properties, Context context) { + return beginUpdate(resourceGroupName, topLevelArmResourceName, properties, context).getFinalResult(); + } + + private static final ClientLogger LOGGER = new ClientLogger(TopLevelArmResourcesClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesImpl.java new file mode 100644 index 00000000000..941f67da273 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient; +import tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner; +import tsptest.armstreamstyleserialization.models.TopLevelArmResource; +import tsptest.armstreamstyleserialization.models.TopLevelArmResourceTagsUpdate; +import tsptest.armstreamstyleserialization.models.TopLevelArmResources; + +public final class TopLevelArmResourcesImpl implements TopLevelArmResources { + private static final ClientLogger LOGGER = new ClientLogger(TopLevelArmResourcesImpl.class); + + private final TopLevelArmResourcesClient innerClient; + + private final tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager; + + public TopLevelArmResourcesImpl(TopLevelArmResourcesClient innerClient, + tsptest.armstreamstyleserialization.ArmResourceProviderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public TopLevelArmResource update(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceTagsUpdate properties) { + TopLevelArmResourceInner inner + = this.serviceClient().update(resourceGroupName, topLevelArmResourceName, properties); + if (inner != null) { + return new TopLevelArmResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public TopLevelArmResource update(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceTagsUpdate properties, Context context) { + TopLevelArmResourceInner inner + = this.serviceClient().update(resourceGroupName, topLevelArmResourceName, properties, context); + if (inner != null) { + return new TopLevelArmResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + private TopLevelArmResourcesClient serviceClient() { + return this.innerClient; + } + + private tsptest.armstreamstyleserialization.ArmResourceProviderManager manager() { + return this.serviceManager; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/models/ListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/models/ListResult.java new file mode 100644 index 00000000000..af772cd80e7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/models/ListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import tsptest.armstreamstyleserialization.models.Result; + +/** + * The ListResult model. + */ +@Immutable +public final class ListResult implements JsonSerializable { + /* + * The items property. + */ + private List items; + + /* + * The nextLink property. + */ + private String nextLink; + + /** + * Creates an instance of ListResult class. + */ + private ListResult() { + } + + /** + * Get the items property: The items property. + * + * @return the items value. + */ + public List items() { + return this.items; + } + + /** + * Get the nextLink property: The nextLink property. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (items() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property items in model ListResult")); + } else { + items().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("items", this.items, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListResult if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ListResult. + */ + public static ListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListResult deserializedListResult = new ListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("items".equals(fieldName)) { + List items = reader.readArray(reader1 -> Result.fromJson(reader1)); + deserializedListResult.items = items; + } else if ("nextLink".equals(fieldName)) { + deserializedListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/package-info.java new file mode 100644 index 00000000000..e0d8dfba624 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for ArmResourceProvider. + * Arm Resource Provider management API. + */ +package tsptest.armstreamstyleserialization.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/AggregateFunctionProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/AggregateFunctionProperties.java new file mode 100644 index 00000000000..e986d139ce6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/AggregateFunctionProperties.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armstreamstyleserialization.fluent.models.FunctionConfiguration; + +/** + * The AggregateFunctionProperties model. + */ +@Fluent +public final class AggregateFunctionProperties extends FunctionProperties { + /* + * Discriminator property for FunctionProperties. + */ + private String kind = "aggregate"; + + /** + * Creates an instance of AggregateFunctionProperties class. + */ + public AggregateFunctionProperties() { + } + + /** + * Get the kind property: Discriminator property for FunctionProperties. + * + * @return the kind value. + */ + @Override + public String kind() { + return this.kind; + } + + /** + * Get the input property: The input property. + * + * @return the input value. + */ + public String input() { + return this.innerProperties() == null ? null : this.innerProperties().input(); + } + + /** + * Set the input property: The input property. + * + * @param input the input value to set. + * @return the AggregateFunctionProperties object itself. + */ + public AggregateFunctionProperties withInput(String input) { + if (this.innerProperties() == null) { + this.withInnerProperties(new FunctionConfiguration()); + } + this.innerProperties().withInput(input); + return this; + } + + /** + * Get the output property: The output property. + * + * @return the output value. + */ + public String output() { + return this.innerProperties() == null ? null : this.innerProperties().output(); + } + + /** + * Set the output property: The output property. + * + * @param output the output value to set. + * @return the AggregateFunctionProperties object itself. + */ + public AggregateFunctionProperties withOutput(String output) { + if (this.innerProperties() == null) { + this.withInnerProperties(new FunctionConfiguration()); + } + this.innerProperties().withOutput(output); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model AggregateFunctionProperties")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AggregateFunctionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", innerProperties()); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AggregateFunctionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AggregateFunctionProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AggregateFunctionProperties. + */ + public static AggregateFunctionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AggregateFunctionProperties deserializedAggregateFunctionProperties = new AggregateFunctionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedAggregateFunctionProperties.withInnerProperties(FunctionConfiguration.fromJson(reader)); + } else if ("kind".equals(fieldName)) { + deserializedAggregateFunctionProperties.kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAggregateFunctionProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Builtin.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Builtin.java new file mode 100644 index 00000000000..6ed4912ec3f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Builtin.java @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.Duration; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * The Builtin model. + */ +@Immutable +public final class Builtin implements JsonSerializable { + /* + * The boolean property. + */ + private boolean booleanProperty; + + /* + * The string property. + */ + private String string; + + /* + * The bytes property. + */ + private byte[] bytes; + + /* + * The int property. + */ + private int intProperty; + + /* + * The safeint property. + */ + private long safeint; + + /* + * The decimal property. + */ + private BigDecimal decimal; + + /* + * The long property. + */ + private long longProperty; + + /* + * The float property. + */ + private double floatProperty; + + /* + * The double property. + */ + private double doubleProperty; + + /* + * The duration property. + */ + private Duration duration; + + /* + * The date property. + */ + private LocalDate date; + + /* + * The dateTime property. + */ + private OffsetDateTime dateTime; + + /* + * The stringList property. + */ + private List stringList; + + /* + * The bytesDict property. + */ + private Map bytesDict; + + /* + * The url property. + */ + private String url; + + /* + * The nullableFloatDict property. + */ + private Map nullableFloatDict; + + /* + * The encoded property. + */ + private Encoded encoded; + + /* + * The uuid property. + */ + private String uuid; + + /** + * Creates an instance of Builtin class. + */ + private Builtin() { + } + + /** + * Get the booleanProperty property: The boolean property. + * + * @return the booleanProperty value. + */ + public boolean booleanProperty() { + return this.booleanProperty; + } + + /** + * Get the string property: The string property. + * + * @return the string value. + */ + public String string() { + return this.string; + } + + /** + * Get the bytes property: The bytes property. + * + * @return the bytes value. + */ + public byte[] bytes() { + return CoreUtils.clone(this.bytes); + } + + /** + * Get the intProperty property: The int property. + * + * @return the intProperty value. + */ + public int intProperty() { + return this.intProperty; + } + + /** + * Get the safeint property: The safeint property. + * + * @return the safeint value. + */ + public long safeint() { + return this.safeint; + } + + /** + * Get the decimal property: The decimal property. + * + * @return the decimal value. + */ + public BigDecimal decimal() { + return this.decimal; + } + + /** + * Get the longProperty property: The long property. + * + * @return the longProperty value. + */ + public long longProperty() { + return this.longProperty; + } + + /** + * Get the floatProperty property: The float property. + * + * @return the floatProperty value. + */ + public double floatProperty() { + return this.floatProperty; + } + + /** + * Get the doubleProperty property: The double property. + * + * @return the doubleProperty value. + */ + public double doubleProperty() { + return this.doubleProperty; + } + + /** + * Get the duration property: The duration property. + * + * @return the duration value. + */ + public Duration duration() { + return this.duration; + } + + /** + * Get the date property: The date property. + * + * @return the date value. + */ + public LocalDate date() { + return this.date; + } + + /** + * Get the dateTime property: The dateTime property. + * + * @return the dateTime value. + */ + public OffsetDateTime dateTime() { + return this.dateTime; + } + + /** + * Get the stringList property: The stringList property. + * + * @return the stringList value. + */ + public List stringList() { + return this.stringList; + } + + /** + * Get the bytesDict property: The bytesDict property. + * + * @return the bytesDict value. + */ + public Map bytesDict() { + return this.bytesDict; + } + + /** + * Get the url property: The url property. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Get the nullableFloatDict property: The nullableFloatDict property. + * + * @return the nullableFloatDict value. + */ + public Map nullableFloatDict() { + return this.nullableFloatDict; + } + + /** + * Get the encoded property: The encoded property. + * + * @return the encoded value. + */ + public Encoded encoded() { + return this.encoded; + } + + /** + * Get the uuid property: The uuid property. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (string() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property string in model Builtin")); + } + if (bytes() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property bytes in model Builtin")); + } + if (decimal() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property decimal in model Builtin")); + } + if (duration() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property duration in model Builtin")); + } + if (date() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property date in model Builtin")); + } + if (dateTime() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property dateTime in model Builtin")); + } + if (stringList() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property stringList in model Builtin")); + } + if (bytesDict() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property bytesDict in model Builtin")); + } + if (url() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property url in model Builtin")); + } + if (nullableFloatDict() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property nullableFloatDict in model Builtin")); + } + if (encoded() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property encoded in model Builtin")); + } else { + encoded().validate(); + } + if (uuid() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property uuid in model Builtin")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Builtin.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("boolean", this.booleanProperty); + jsonWriter.writeStringField("string", this.string); + jsonWriter.writeBinaryField("bytes", this.bytes); + jsonWriter.writeIntField("int", this.intProperty); + jsonWriter.writeLongField("safeint", this.safeint); + jsonWriter.writeNumberField("decimal", this.decimal); + jsonWriter.writeLongField("long", this.longProperty); + jsonWriter.writeDoubleField("float", this.floatProperty); + jsonWriter.writeDoubleField("double", this.doubleProperty); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeStringField("date", Objects.toString(this.date, null)); + jsonWriter.writeStringField("dateTime", + this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); + jsonWriter.writeArrayField("stringList", this.stringList, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("bytesDict", this.bytesDict, (writer, element) -> writer.writeBinary(element)); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeMapField("nullableFloatDict", this.nullableFloatDict, + (writer, element) -> writer.writeNumber(element)); + jsonWriter.writeJsonField("encoded", this.encoded); + jsonWriter.writeStringField("uuid", this.uuid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Builtin from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Builtin if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Builtin. + */ + public static Builtin fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Builtin deserializedBuiltin = new Builtin(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("boolean".equals(fieldName)) { + deserializedBuiltin.booleanProperty = reader.getBoolean(); + } else if ("string".equals(fieldName)) { + deserializedBuiltin.string = reader.getString(); + } else if ("bytes".equals(fieldName)) { + deserializedBuiltin.bytes = reader.getBinary(); + } else if ("int".equals(fieldName)) { + deserializedBuiltin.intProperty = reader.getInt(); + } else if ("safeint".equals(fieldName)) { + deserializedBuiltin.safeint = reader.getLong(); + } else if ("decimal".equals(fieldName)) { + deserializedBuiltin.decimal + = reader.getNullable(nonNullReader -> new BigDecimal(nonNullReader.getString())); + } else if ("long".equals(fieldName)) { + deserializedBuiltin.longProperty = reader.getLong(); + } else if ("float".equals(fieldName)) { + deserializedBuiltin.floatProperty = reader.getDouble(); + } else if ("double".equals(fieldName)) { + deserializedBuiltin.doubleProperty = reader.getDouble(); + } else if ("duration".equals(fieldName)) { + deserializedBuiltin.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("date".equals(fieldName)) { + deserializedBuiltin.date + = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); + } else if ("dateTime".equals(fieldName)) { + deserializedBuiltin.dateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("stringList".equals(fieldName)) { + List stringList = reader.readArray(reader1 -> reader1.getString()); + deserializedBuiltin.stringList = stringList; + } else if ("bytesDict".equals(fieldName)) { + Map bytesDict = reader.readMap(reader1 -> reader1.getBinary()); + deserializedBuiltin.bytesDict = bytesDict; + } else if ("url".equals(fieldName)) { + deserializedBuiltin.url = reader.getString(); + } else if ("nullableFloatDict".equals(fieldName)) { + Map nullableFloatDict + = reader.readMap(reader1 -> reader1.getNullable(JsonReader::getDouble)); + deserializedBuiltin.nullableFloatDict = nullableFloatDict; + } else if ("encoded".equals(fieldName)) { + deserializedBuiltin.encoded = Encoded.fromJson(reader); + } else if ("uuid".equals(fieldName)) { + deserializedBuiltin.uuid = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBuiltin; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Dog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Dog.java new file mode 100644 index 00000000000..819912d4a99 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Dog.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Test extensible enum type for discriminator. + */ +@Immutable +public class Dog implements JsonSerializable { + /* + * discriminator property + */ + private DogKind kind = DogKind.fromString("Dog"); + + /* + * Weight of the dog + */ + private int weight; + + /* + * dna of the dog + */ + private String dna; + + /** + * Creates an instance of Dog class. + */ + protected Dog() { + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + public DogKind kind() { + return this.kind; + } + + /** + * Get the weight property: Weight of the dog. + * + * @return the weight value. + */ + public int weight() { + return this.weight; + } + + /** + * Set the weight property: Weight of the dog. + * + * @param weight the weight value to set. + * @return the Dog object itself. + */ + Dog withWeight(int weight) { + this.weight = weight; + return this; + } + + /** + * Get the dna property: dna of the dog. + * + * @return the dna value. + */ + public String dna() { + return this.dna; + } + + /** + * Set the dna property: dna of the dog. + * + * @param dna the dna value to set. + * @return the Dog object itself. + */ + Dog withDna(String dna) { + this.dna = dna; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("weight", this.weight); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dog from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dog if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Dog. + */ + public static Dog fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("golden".equals(discriminatorValue)) { + return Golden.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static Dog fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Dog deserializedDog = new Dog(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("weight".equals(fieldName)) { + deserializedDog.weight = reader.getInt(); + } else if ("dna".equals(fieldName)) { + deserializedDog.dna = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedDog.kind = DogKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDog; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/DogKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/DogKind.java new file mode 100644 index 00000000000..92d015749b6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/DogKind.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * extensible enum type for discriminator. + */ +public final class DogKind extends ExpandableStringEnum { + /** + * Species golden. + */ + public static final DogKind GOLDEN = fromString("golden"); + + /** + * Creates a new instance of DogKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DogKind() { + } + + /** + * Creates or finds a DogKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding DogKind. + */ + public static DogKind fromString(String name) { + return fromString(name, DogKind.class); + } + + /** + * Gets known DogKind values. + * + * @return known DogKind values. + */ + public static Collection values() { + return values(DogKind.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Encoded.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Encoded.java new file mode 100644 index 00000000000..9588c592228 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Encoded.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.Base64Url; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.Objects; + +/** + * The Encoded model. + */ +@Immutable +public final class Encoded implements JsonSerializable { + private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; + + /* + * The timeInSeconds property. + */ + private Long timeInSeconds; + + /* + * The timeInSecondsPrimitive property. + */ + private long timeInSecondsPrimitive; + + /* + * The timeInSecondsFraction property. + */ + private Double timeInSecondsFraction; + + /* + * The timeInSecondsFractionPrimitive property. + */ + private double timeInSecondsFractionPrimitive; + + /* + * The dateTime property. + */ + private OffsetDateTime dateTime; + + /* + * The dateTimeRfc7231 property. + */ + private DateTimeRfc1123 dateTimeRfc7231; + + /* + * The unixTimestamp property. + */ + private Long unixTimestamp; + + /* + * The unixTimestampPrimitive property. + */ + private long unixTimestampPrimitive; + + /* + * The base64 property. + */ + private byte[] base64; + + /* + * The base64url property. + */ + private Base64Url base64url; + + /* + * The unknownDurationFormat property. + */ + private String unknownDurationFormat; + + /* + * The unknownDateTimeFormat property. + */ + private String unknownDateTimeFormat; + + /* + * The unknownBytes property. + */ + private String unknownBytes; + + /** + * Creates an instance of Encoded class. + */ + private Encoded() { + } + + /** + * Get the timeInSeconds property: The timeInSeconds property. + * + * @return the timeInSeconds value. + */ + public Duration timeInSeconds() { + if (this.timeInSeconds == null) { + return null; + } + return Duration.ofSeconds(this.timeInSeconds); + } + + /** + * Get the timeInSecondsPrimitive property: The timeInSecondsPrimitive property. + * + * @return the timeInSecondsPrimitive value. + */ + public Duration timeInSecondsPrimitive() { + return Duration.ofSeconds(this.timeInSecondsPrimitive); + } + + /** + * Get the timeInSecondsFraction property: The timeInSecondsFraction property. + * + * @return the timeInSecondsFraction value. + */ + public Duration timeInSecondsFraction() { + if (this.timeInSecondsFraction == null) { + return null; + } + return Duration.ofNanos((long) (this.timeInSecondsFraction * 1000_000_000L)); + } + + /** + * Get the timeInSecondsFractionPrimitive property: The timeInSecondsFractionPrimitive property. + * + * @return the timeInSecondsFractionPrimitive value. + */ + public Duration timeInSecondsFractionPrimitive() { + return Duration.ofNanos((long) (this.timeInSecondsFractionPrimitive * 1000_000_000L)); + } + + /** + * Get the dateTime property: The dateTime property. + * + * @return the dateTime value. + */ + public OffsetDateTime dateTime() { + return this.dateTime; + } + + /** + * Get the dateTimeRfc7231 property: The dateTimeRfc7231 property. + * + * @return the dateTimeRfc7231 value. + */ + public OffsetDateTime dateTimeRfc7231() { + if (this.dateTimeRfc7231 == null) { + return null; + } + return this.dateTimeRfc7231.getDateTime(); + } + + /** + * Get the unixTimestamp property: The unixTimestamp property. + * + * @return the unixTimestamp value. + */ + public OffsetDateTime unixTimestamp() { + if (this.unixTimestamp == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.unixTimestamp), ZoneOffset.UTC); + } + + /** + * Get the unixTimestampPrimitive property: The unixTimestampPrimitive property. + * + * @return the unixTimestampPrimitive value. + */ + public OffsetDateTime unixTimestampPrimitive() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.unixTimestampPrimitive), ZoneOffset.UTC); + } + + /** + * Get the base64 property: The base64 property. + * + * @return the base64 value. + */ + public byte[] base64() { + return CoreUtils.clone(this.base64); + } + + /** + * Get the base64url property: The base64url property. + * + * @return the base64url value. + */ + public byte[] base64url() { + if (this.base64url == null) { + return EMPTY_BYTE_ARRAY; + } + return this.base64url.decodedBytes(); + } + + /** + * Get the unknownDurationFormat property: The unknownDurationFormat property. + * + * @return the unknownDurationFormat value. + */ + public String unknownDurationFormat() { + return this.unknownDurationFormat; + } + + /** + * Get the unknownDateTimeFormat property: The unknownDateTimeFormat property. + * + * @return the unknownDateTimeFormat value. + */ + public String unknownDateTimeFormat() { + return this.unknownDateTimeFormat; + } + + /** + * Get the unknownBytes property: The unknownBytes property. + * + * @return the unknownBytes value. + */ + public String unknownBytes() { + return this.unknownBytes; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (timeInSecondsPrimitive() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property timeInSecondsPrimitive in model Encoded")); + } + if (timeInSecondsFractionPrimitive() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property timeInSecondsFractionPrimitive in model Encoded")); + } + if (unixTimestampPrimitive() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property unixTimestampPrimitive in model Encoded")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Encoded.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("timeInSecondsPrimitive", this.timeInSecondsPrimitive); + jsonWriter.writeDoubleField("timeInSecondsFractionPrimitive", this.timeInSecondsFractionPrimitive); + jsonWriter.writeLongField("unixTimestampPrimitive", this.unixTimestampPrimitive); + jsonWriter.writeNumberField("timeInSeconds", this.timeInSeconds); + jsonWriter.writeNumberField("timeInSecondsFraction", this.timeInSecondsFraction); + jsonWriter.writeStringField("dateTime", + this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); + jsonWriter.writeStringField("dateTimeRfc7231", Objects.toString(this.dateTimeRfc7231, null)); + jsonWriter.writeNumberField("unixTimestamp", this.unixTimestamp); + jsonWriter.writeBinaryField("base64", this.base64); + jsonWriter.writeStringField("base64url", Objects.toString(this.base64url, null)); + jsonWriter.writeStringField("unknownDurationFormat", this.unknownDurationFormat); + jsonWriter.writeStringField("unknownDateTimeFormat", this.unknownDateTimeFormat); + jsonWriter.writeStringField("unknownBytes", this.unknownBytes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Encoded from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Encoded if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Encoded. + */ + public static Encoded fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Encoded deserializedEncoded = new Encoded(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timeInSecondsPrimitive".equals(fieldName)) { + deserializedEncoded.timeInSecondsPrimitive = reader.getLong(); + } else if ("timeInSecondsFractionPrimitive".equals(fieldName)) { + deserializedEncoded.timeInSecondsFractionPrimitive = reader.getDouble(); + } else if ("unixTimestampPrimitive".equals(fieldName)) { + deserializedEncoded.unixTimestampPrimitive = reader.getLong(); + } else if ("timeInSeconds".equals(fieldName)) { + deserializedEncoded.timeInSeconds = reader.getNullable(JsonReader::getLong); + } else if ("timeInSecondsFraction".equals(fieldName)) { + deserializedEncoded.timeInSecondsFraction = reader.getNullable(JsonReader::getDouble); + } else if ("dateTime".equals(fieldName)) { + deserializedEncoded.dateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("dateTimeRfc7231".equals(fieldName)) { + deserializedEncoded.dateTimeRfc7231 + = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); + } else if ("unixTimestamp".equals(fieldName)) { + deserializedEncoded.unixTimestamp = reader.getNullable(JsonReader::getLong); + } else if ("base64".equals(fieldName)) { + deserializedEncoded.base64 = reader.getBinary(); + } else if ("base64url".equals(fieldName)) { + deserializedEncoded.base64url + = reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); + } else if ("unknownDurationFormat".equals(fieldName)) { + deserializedEncoded.unknownDurationFormat = reader.getString(); + } else if ("unknownDateTimeFormat".equals(fieldName)) { + deserializedEncoded.unknownDateTimeFormat = reader.getString(); + } else if ("unknownBytes".equals(fieldName)) { + deserializedEncoded.unknownBytes = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEncoded; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Error.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Error.java new file mode 100644 index 00000000000..693b29dbd74 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Error.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.AdditionalInfo; +import com.azure.core.management.exception.ManagementError; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The Error model. + */ +@Immutable +public final class Error extends ManagementError { + /* + * The details property. + */ + private List details; + + /* + * The additionalProperty property. + */ + private String additionalProperty; + + /* + * Additional info for the error. + */ + private List additionalInfo; + + /* + * The target of the error. + */ + private String target; + + /* + * The error message parsed from the body of the http error response. + */ + private String message; + + /* + * The error code parsed from the body of the http error response. + */ + private String code; + + /** + * Creates an instance of Error class. + */ + private Error() { + } + + /** + * Get the details property: The details property. + * + * @return the details value. + */ + @Override + public List getDetails() { + return this.details; + } + + /** + * Get the additionalProperty property: The additionalProperty property. + * + * @return the additionalProperty value. + */ + public String getAdditionalProperty() { + return this.additionalProperty; + } + + /** + * Get the additionalInfo property: Additional info for the error. + * + * @return the additionalInfo value. + */ + @Override + public List getAdditionalInfo() { + return this.additionalInfo; + } + + /** + * Get the target property: The target of the error. + * + * @return the target value. + */ + @Override + public String getTarget() { + return this.target; + } + + /** + * Get the message property: The error message parsed from the body of the http error response. + * + * @return the message value. + */ + @Override + public String getMessage() { + return this.message; + } + + /** + * Get the code property: The error code parsed from the body of the http error response. + * + * @return the code value. + */ + @Override + public String getCode() { + return this.code; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (getDetails() != null) { + getDetails().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Error from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Error if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Error. + */ + public static Error fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JsonReader bufferedReader = reader.bufferObject(); + bufferedReader.nextToken(); + while (bufferedReader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = bufferedReader.getFieldName(); + bufferedReader.nextToken(); + + if ("error".equals(fieldName)) { + return readManagementError(bufferedReader); + } else { + bufferedReader.skipChildren(); + } + } + return readManagementError(bufferedReader.reset()); + }); + } + + private static Error readManagementError(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Error deserializedError = new Error(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedError.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedError.message = reader.getString(); + } else if ("target".equals(fieldName)) { + deserializedError.target = reader.getString(); + } else if ("additionalInfo".equals(fieldName)) { + List additionalInfo = reader.readArray(reader1 -> AdditionalInfo.fromJson(reader1)); + deserializedError.additionalInfo = additionalInfo; + } else if ("additionalProperty".equals(fieldName)) { + deserializedError.additionalProperty = reader.getString(); + } else if ("details".equals(fieldName)) { + List details = reader.readArray(reader1 -> Error.fromJson(reader1)); + deserializedError.details = details; + } else { + reader.skipChildren(); + } + } + + return deserializedError; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorException.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorException.java new file mode 100644 index 00000000000..e07c1f64bbb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorException.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.http.HttpResponse; +import com.azure.core.management.exception.ManagementException; + +/** + * Exception thrown for an invalid response with Error information. + */ +public final class ErrorException extends ManagementException { + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public ErrorException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public ErrorException(String message, HttpResponse response, Error value) { + super(message, response, value); + } + + /** + * {@inheritDoc} + */ + @Override + public Error getValue() { + return (Error) super.getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMin.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMin.java new file mode 100644 index 00000000000..13dec084a22 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMin.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.AdditionalInfo; +import com.azure.core.management.exception.ManagementError; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The ErrorMin model. + */ +@Immutable +public final class ErrorMin extends ManagementError { + /* + * The additionalProperty property. + */ + private String additionalProperty; + + /* + * Additional info for the error. + */ + private List additionalInfo; + + /* + * Details for the error. + */ + private List details; + + /* + * The target of the error. + */ + private String target; + + /* + * The error message parsed from the body of the http error response. + */ + private String message; + + /* + * The error code parsed from the body of the http error response. + */ + private String code; + + /** + * Creates an instance of ErrorMin class. + */ + private ErrorMin() { + } + + /** + * Get the additionalProperty property: The additionalProperty property. + * + * @return the additionalProperty value. + */ + public String getAdditionalProperty() { + return this.additionalProperty; + } + + /** + * Get the additionalInfo property: Additional info for the error. + * + * @return the additionalInfo value. + */ + @Override + public List getAdditionalInfo() { + return this.additionalInfo; + } + + /** + * Get the details property: Details for the error. + * + * @return the details value. + */ + @Override + public List getDetails() { + return this.details; + } + + /** + * Get the target property: The target of the error. + * + * @return the target value. + */ + @Override + public String getTarget() { + return this.target; + } + + /** + * Get the message property: The error message parsed from the body of the http error response. + * + * @return the message value. + */ + @Override + public String getMessage() { + return this.message; + } + + /** + * Get the code property: The error code parsed from the body of the http error response. + * + * @return the code value. + */ + @Override + public String getCode() { + return this.code; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ErrorMin from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ErrorMin if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ErrorMin. + */ + public static ErrorMin fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JsonReader bufferedReader = reader.bufferObject(); + bufferedReader.nextToken(); + while (bufferedReader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = bufferedReader.getFieldName(); + bufferedReader.nextToken(); + + if ("error".equals(fieldName)) { + return readManagementError(bufferedReader); + } else { + bufferedReader.skipChildren(); + } + } + return readManagementError(bufferedReader.reset()); + }); + } + + private static ErrorMin readManagementError(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ErrorMin deserializedErrorMin = new ErrorMin(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedErrorMin.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedErrorMin.message = reader.getString(); + } else if ("target".equals(fieldName)) { + deserializedErrorMin.target = reader.getString(); + } else if ("details".equals(fieldName)) { + List details = reader.readArray(reader1 -> ManagementError.fromJson(reader1)); + deserializedErrorMin.details = details; + } else if ("additionalInfo".equals(fieldName)) { + List additionalInfo = reader.readArray(reader1 -> AdditionalInfo.fromJson(reader1)); + deserializedErrorMin.additionalInfo = additionalInfo; + } else if ("additionalProperty".equals(fieldName)) { + deserializedErrorMin.additionalProperty = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedErrorMin; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMinException.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMinException.java new file mode 100644 index 00000000000..dc7fb38acd1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/ErrorMinException.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.http.HttpResponse; +import com.azure.core.management.exception.ManagementException; + +/** + * Exception thrown for an invalid response with ErrorMin information. + */ +public final class ErrorMinException extends ManagementException { + /** + * Initializes a new instance of the ErrorMinException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public ErrorMinException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorMinException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public ErrorMinException(String message, HttpResponse response, ErrorMin value) { + super(message, response, value); + } + + /** + * {@inheritDoc} + */ + @Override + public ErrorMin getValue() { + return (ErrorMin) super.getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fish.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fish.java new file mode 100644 index 00000000000..70ae407fc92 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fish.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import tsptest.armstreamstyleserialization.fluent.models.FishInner; + +/** + * An immutable client-side representation of Fish. + */ +public interface Fish { + /** + * Gets the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the age property: The age property. + * + * @return the age value. + */ + int age(); + + /** + * Gets the dna property: The dna property. + * + * @return the dna value. + */ + String dna(); + + /** + * Gets the length property: The length property. + * + * @return the length value. + */ + double length(); + + /** + * Gets the patten property: The patten property. + * + * @return the patten value. + */ + String patten(); + + /** + * Gets the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + String requiredString(); + + /** + * Gets the lengthAnotherPropertiesLength property: The length property. + * + * @return the lengthAnotherPropertiesLength value. + */ + double lengthAnotherPropertiesLength(); + + /** + * Gets the pattenAnotherPropertiesPatten property: The patten property. + * + * @return the pattenAnotherPropertiesPatten value. + */ + String pattenAnotherPropertiesPatten(); + + /** + * Gets the requiredStringAnotherPropertiesRequiredString property: The requiredString property. + * + * @return the requiredStringAnotherPropertiesRequiredString value. + */ + String requiredStringAnotherPropertiesRequiredString(); + + /** + * Gets the inner tsptest.armstreamstyleserialization.fluent.models.FishInner object. + * + * @return the inner object. + */ + FishInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fishes.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fishes.java new file mode 100644 index 00000000000..a08020c3b28 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Fishes.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import tsptest.armstreamstyleserialization.fluent.models.FishInner; + +/** + * Resource collection API of Fishes. + */ +public interface Fishes { + /** + * The getModel operation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws tsptest.armstreamstyleserialization.models.ErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + Response getModelWithResponse(Context context); + + /** + * The getModel operation. + * + * @throws tsptest.armstreamstyleserialization.models.ErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + Fish getModel(); + + /** + * The putModel operation. + * + * @param fish The fish parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws tsptest.armstreamstyleserialization.models.ErrorMinException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + Response putModelWithResponse(FishInner fish, Context context); + + /** + * The putModel operation. + * + * @param fish The fish parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws tsptest.armstreamstyleserialization.models.ErrorMinException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + Fish putModel(FishInner fish); + + /** + * The getOutputOnlyModel operation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic OutputOnlyModel along with {@link Response}. + */ + Response getOutputOnlyModelWithResponse(Context context); + + /** + * The getOutputOnlyModel operation. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic OutputOnlyModel. + */ + OutputOnlyModel getOutputOnlyModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Function.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Function.java new file mode 100644 index 00000000000..5c4c3e3902a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Function.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; + +/** + * An immutable client-side representation of Function. + */ +public interface Function { + /** + * Gets the properties property: The properties property. + * + * @return the properties value. + */ + FunctionProperties properties(); + + /** + * Gets the inner tsptest.armstreamstyleserialization.fluent.models.FunctionInner object. + * + * @return the inner object. + */ + FunctionInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionProperties.java new file mode 100644 index 00000000000..13df2e20bb0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionProperties.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armstreamstyleserialization.fluent.models.FunctionConfiguration; + +/** + * The FunctionProperties model. + */ +@Fluent +public class FunctionProperties implements JsonSerializable { + /* + * Discriminator property for FunctionProperties. + */ + private String kind = "FunctionProperties"; + + /* + * The properties property. + */ + private FunctionConfiguration innerProperties = new FunctionConfiguration(); + + /** + * Creates an instance of FunctionProperties class. + */ + public FunctionProperties() { + } + + /** + * Get the kind property: Discriminator property for FunctionProperties. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + FunctionConfiguration innerProperties() { + return this.innerProperties; + } + + /** + * Set the innerProperties property: The properties property. + * + * @param innerProperties the innerProperties value to set. + * @return the FunctionProperties object itself. + */ + FunctionProperties withInnerProperties(FunctionConfiguration innerProperties) { + this.innerProperties = innerProperties; + return this; + } + + /** + * Get the input property: The input property. + * + * @return the input value. + */ + public String input() { + return this.innerProperties() == null ? null : this.innerProperties().input(); + } + + /** + * Set the input property: The input property. + * + * @param input the input value to set. + * @return the FunctionProperties object itself. + */ + public FunctionProperties withInput(String input) { + if (this.innerProperties() == null) { + this.withInnerProperties(new FunctionConfiguration()); + } + this.innerProperties().withInput(input); + return this; + } + + /** + * Get the output property: The output property. + * + * @return the output value. + */ + public String output() { + return this.innerProperties() == null ? null : this.innerProperties().output(); + } + + /** + * Set the output property: The output property. + * + * @param output the output value to set. + * @return the FunctionProperties object itself. + */ + public FunctionProperties withOutput(String output) { + if (this.innerProperties() == null) { + this.withInnerProperties(new FunctionConfiguration()); + } + this.innerProperties().withOutput(output); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model FunctionProperties")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FunctionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FunctionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FunctionProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FunctionProperties. + */ + public static FunctionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("aggregate".equals(discriminatorValue)) { + return AggregateFunctionProperties.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static FunctionProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FunctionProperties deserializedFunctionProperties = new FunctionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedFunctionProperties.innerProperties = FunctionConfiguration.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedFunctionProperties.kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFunctionProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Functions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Functions.java new file mode 100644 index 00000000000..d9779dc3d10 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Functions.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; + +/** + * Resource collection API of Functions. + */ +public interface Functions { + /** + * The createFunction operation. + * + * @param function The function parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Response createFunctionWithResponse(FunctionInner function, Context context); + + /** + * The createFunction operation. + * + * @param function The function parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Function createFunction(FunctionInner function); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionHeaders.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionHeaders.java new file mode 100644 index 00000000000..597ee72d69b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionHeaders.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; + +/** + * The FunctionsCreateFunctionHeaders model. + */ +@Immutable +public final class FunctionsCreateFunctionHeaders { + /* + * The ETag property. + */ + private final String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of FunctionsCreateFunctionHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public FunctionsCreateFunctionHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The ETag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionResponse.java new file mode 100644 index 00000000000..0d593fb3ef5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionResponse.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; + +/** + * Contains all response data for the createFunction operation. + */ +public final class FunctionsCreateFunctionResponse extends ResponseBase { + /** + * Creates an instance of FunctionsCreateFunctionResponse. + * + * @param request the request which resulted in this FunctionsCreateFunctionResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public FunctionsCreateFunctionResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + FunctionInner value, FunctionsCreateFunctionHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public FunctionInner getValue() { + return super.getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/GoblinShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/GoblinShark.java new file mode 100644 index 00000000000..e1645e48e6d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/GoblinShark.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armstreamstyleserialization.fluent.models.AnotherFishProperties; +import tsptest.armstreamstyleserialization.fluent.models.FishProperties; + +/** + * The third level model GoblinShark in polymorphic multiple levels inheritance. + */ +@Fluent +public final class GoblinShark extends Shark { + /* + * Discriminator property for Fish. + */ + private String kind = "shark"; + + /* + * The sharktype property. + */ + private String sharktype = "goblin"; + + /* + * The anotherProperties property. + */ + private AnotherFishProperties innerAnotherProperties = new AnotherFishProperties(); + + /* + * The properties property. + */ + private FishProperties innerProperties = new FishProperties(); + + /* + * The dna property. + */ + private String dna; + + /** + * Creates an instance of GoblinShark class. + */ + public GoblinShark() { + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Override + public String kind() { + return this.kind; + } + + /** + * Get the sharktype property: The sharktype property. + * + * @return the sharktype value. + */ + @Override + public String sharktype() { + return this.sharktype; + } + + /** + * Get the innerAnotherProperties property: The anotherProperties property. + * + * @return the innerAnotherProperties value. + */ + private AnotherFishProperties innerAnotherProperties() { + return this.innerAnotherProperties; + } + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private FishProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the dna property: The dna property. + * + * @return the dna value. + */ + @Override + public String dna() { + return this.dna; + } + + /** + * {@inheritDoc} + */ + @Override + public GoblinShark withAge(int age) { + super.withAge(age); + return this; + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double length() { + return this.innerProperties() == null ? 0.0 : this.innerProperties().length(); + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the GoblinShark object itself. + */ + public GoblinShark withLength(double length) { + if (this.innerProperties() == null) { + this.innerProperties = new FishProperties(); + } + this.innerProperties().withLength(length); + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String patten() { + return this.innerProperties() == null ? null : this.innerProperties().patten(); + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredString() { + return this.innerProperties() == null ? null : this.innerProperties().requiredString(); + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the GoblinShark object itself. + */ + public GoblinShark withRequiredString(String requiredString) { + if (this.innerProperties() == null) { + this.innerProperties = new FishProperties(); + } + this.innerProperties().withRequiredString(requiredString); + return this; + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double lengthAnotherPropertiesLength() { + return this.innerAnotherProperties() == null ? 0.0 : this.innerAnotherProperties().length(); + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the GoblinShark object itself. + */ + public GoblinShark withLengthAnotherPropertiesLength(double length) { + if (this.innerAnotherProperties() == null) { + this.innerAnotherProperties = new AnotherFishProperties(); + } + this.innerAnotherProperties().withLength(length); + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String pattenAnotherPropertiesPatten() { + return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().patten(); + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredStringAnotherPropertiesRequiredString() { + return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().requiredString(); + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the GoblinShark object itself. + */ + public GoblinShark withRequiredStringAnotherPropertiesRequiredString(String requiredString) { + if (this.innerAnotherProperties() == null) { + this.innerAnotherProperties = new AnotherFishProperties(); + } + this.innerAnotherProperties().withRequiredString(requiredString); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model GoblinShark")); + } else { + innerProperties().validate(); + } + if (innerAnotherProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerAnotherProperties in model GoblinShark")); + } else { + innerAnotherProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GoblinShark.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeIntField("age", age()); + jsonWriter.writeJsonField("properties", innerProperties()); + jsonWriter.writeJsonField("anotherProperties", innerAnotherProperties()); + jsonWriter.writeStringField("sharktype", this.sharktype); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GoblinShark from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GoblinShark if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GoblinShark. + */ + public static GoblinShark fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GoblinShark deserializedGoblinShark = new GoblinShark(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + deserializedGoblinShark.withAge(reader.getInt()); + } else if ("dna".equals(fieldName)) { + deserializedGoblinShark.dna = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedGoblinShark.innerProperties = FishProperties.fromJson(reader); + } else if ("anotherProperties".equals(fieldName)) { + deserializedGoblinShark.innerAnotherProperties = AnotherFishProperties.fromJson(reader); + } else if ("sharktype".equals(fieldName)) { + deserializedGoblinShark.sharktype = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGoblinShark; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Golden.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Golden.java new file mode 100644 index 00000000000..09e38f38c3a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Golden.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Golden dog model. + */ +@Immutable +public final class Golden extends Dog { + /* + * discriminator property + */ + private DogKind kind = DogKind.GOLDEN; + + /** + * Creates an instance of Golden class. + */ + private Golden() { + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + @Override + public DogKind kind() { + return this.kind; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("weight", weight()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Golden from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Golden if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Golden. + */ + public static Golden fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Golden deserializedGolden = new Golden(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("weight".equals(fieldName)) { + deserializedGolden.withWeight(reader.getInt()); + } else if ("dna".equals(fieldName)) { + deserializedGolden.withDna(reader.getString()); + } else if ("kind".equals(fieldName)) { + deserializedGolden.kind = DogKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGolden; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Items.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Items.java new file mode 100644 index 00000000000..819aef6f3a4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Items.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Items. + */ +public interface Items { + /** + * The list operation. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * The list operation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModel.java new file mode 100644 index 00000000000..2e3ef65afde --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModel.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner; + +/** + * An immutable client-side representation of OutputOnlyModel. + */ +public interface OutputOnlyModel { + /** + * Gets the kind property: Discriminator property for OutputOnlyModel. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the name property: The name property. + * + * @return the name value. + */ + String name(); + + /** + * Gets the id property: The id property. + * + * @return the id value. + */ + String id(); + + /** + * Gets the title property: The title property. + * + * @return the title value. + */ + String title(); + + /** + * Gets the dog property: The dog property. + * + * @return the dog value. + */ + Golden dog(); + + /** + * Gets the inner tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner object. + * + * @return the inner object. + */ + OutputOnlyModelInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModelChild.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModelChild.java new file mode 100644 index 00000000000..a212bdc7628 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModelChild.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner; +import tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelProperties; + +/** + * The OutputOnlyModelChild model. + */ +@Immutable +public final class OutputOnlyModelChild extends OutputOnlyModelInner { + /* + * Discriminator property for OutputOnlyModel. + */ + private String kind = "child"; + + /* + * The childName property. + */ + private String childName; + + /* + * The properties property. + */ + private OutputOnlyModelProperties innerProperties; + + /* + * The id property. + */ + private String id; + + /* + * The name property. + */ + private String name; + + /** + * Creates an instance of OutputOnlyModelChild class. + */ + private OutputOnlyModelChild() { + } + + /** + * Get the kind property: Discriminator property for OutputOnlyModel. + * + * @return the kind value. + */ + @Override + public String kind() { + return this.kind; + } + + /** + * Get the childName property: The childName property. + * + * @return the childName value. + */ + public String childName() { + return this.childName; + } + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private OutputOnlyModelProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the title property: The title property. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Get the dog property: The dog property. + * + * @return the dog value. + */ + public Golden dog() { + return this.innerProperties() == null ? null : this.innerProperties().dog(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (childName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property childName in model OutputOnlyModelChild")); + } + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model OutputOnlyModelChild")); + } + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model OutputOnlyModelChild")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OutputOnlyModelChild.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeJsonField("properties", innerProperties()); + jsonWriter.writeStringField("childName", this.childName); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OutputOnlyModelChild from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OutputOnlyModelChild if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OutputOnlyModelChild. + */ + public static OutputOnlyModelChild fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OutputOnlyModelChild deserializedOutputOnlyModelChild = new OutputOnlyModelChild(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOutputOnlyModelChild.name = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedOutputOnlyModelChild.id = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedOutputOnlyModelChild.innerProperties = OutputOnlyModelProperties.fromJson(reader); + } else if ("childName".equals(fieldName)) { + deserializedOutputOnlyModelChild.childName = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedOutputOnlyModelChild.kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOutputOnlyModelChild; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priorities.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priorities.java new file mode 100644 index 00000000000..3c871f2f8e0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priorities.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Priorities. + */ +public interface Priorities { + /** + * The setPriority operation. + * + * @param priority The priority parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 body along with {@link Response}. + */ + Response setPriorityWithResponse(Priority priority, Context context); + + /** + * The setPriority operation. + * + * @param priority The priority parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Priority setPriority(Priority priority); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priority.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priority.java new file mode 100644 index 00000000000..108963231d1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Priority.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.util.ExpandableEnum; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Defines values for Priority. + */ +public final class Priority implements ExpandableEnum, JsonSerializable { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = Priority::new; + + /** + * high priority. + */ + public static final Priority HIGH = fromValue(0); + + /** + * low priority. + */ + public static final Priority LOW = fromValue(1); + + private final Integer value; + + private Priority(Integer value) { + this.value = value; + } + + /** + * Creates or finds a Priority. + * + * @param value a value to look for. + * @return the corresponding Priority. + * @throws IllegalArgumentException if value is null. + */ + public static Priority fromValue(Integer value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known Priority values. + * + * @return Known Priority values. + */ + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the Priority instance. + * + * @return the value of the Priority instance. + */ + @Override + public Integer getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + return jsonWriter.writeInt(getValue()); + } + + /** + * Reads an instance of Priority from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Priority if the JsonReader was pointing to an instance of it, or null if the JsonReader + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the Priority. + * @throws IllegalStateException If unexpected JSON token is found. + */ + public static Priority fromJson(JsonReader jsonReader) throws IOException { + JsonToken nextToken = jsonReader.nextToken(); + if (nextToken == JsonToken.NULL) { + return null; + } + if (nextToken != JsonToken.NUMBER) { + throw new IllegalStateException( + String.format("Unexpected JSON token for %s deserialization: %s", JsonToken.NUMBER, nextToken)); + } + return Priority.fromValue(jsonReader.getInt()); + } + + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Result.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Result.java new file mode 100644 index 00000000000..2b17d99ebc6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Result.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armstreamstyleserialization.fluent.models.ResultData; + +/** + * The Result model. + */ +@Immutable +public final class Result implements JsonSerializable { + /* + * The name property. + */ + private String name; + + /* + * The data property. + */ + private ResultData innerData; + + /** + * Creates an instance of Result class. + */ + private Result() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the innerData property: The data property. + * + * @return the innerData value. + */ + private ResultData innerData() { + return this.innerData; + } + + /** + * Get the prop1 property: The prop1 property. + * + * @return the prop1 value. + */ + public String prop1() { + return this.innerData() == null ? null : this.innerData().prop1(); + } + + /** + * Get the prop2 property: The prop2 property. + * + * @return the prop2 value. + */ + public String prop2() { + return this.innerData() == null ? null : this.innerData().prop2(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Result")); + } + if (innerData() != null) { + innerData().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Result.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Result from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Result if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Result. + */ + public static Result fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Result deserializedResult = new Result(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedResult.name = reader.getString(); + } else if ("data".equals(fieldName)) { + deserializedResult.innerData = ResultData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Salmon.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Salmon.java new file mode 100644 index 00000000000..474c400776a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Salmon.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import java.util.List; +import java.util.Map; +import tsptest.armstreamstyleserialization.fluent.models.SalmonInner; + +/** + * An immutable client-side representation of Salmon. + */ +public interface Salmon { + /** + * Gets the age property: The age property. + * + * @return the age value. + */ + int age(); + + /** + * Gets the dna property: The dna property. + * + * @return the dna value. + */ + String dna(); + + /** + * Gets the length property: The length property. + * + * @return the length value. + */ + double length(); + + /** + * Gets the patten property: The patten property. + * + * @return the patten value. + */ + String patten(); + + /** + * Gets the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + String requiredString(); + + /** + * Gets the lengthAnotherPropertiesLength property: The length property. + * + * @return the lengthAnotherPropertiesLength value. + */ + double lengthAnotherPropertiesLength(); + + /** + * Gets the pattenAnotherPropertiesPatten property: The patten property. + * + * @return the pattenAnotherPropertiesPatten value. + */ + String pattenAnotherPropertiesPatten(); + + /** + * Gets the requiredStringAnotherPropertiesRequiredString property: The requiredString property. + * + * @return the requiredStringAnotherPropertiesRequiredString value. + */ + String requiredStringAnotherPropertiesRequiredString(); + + /** + * Gets the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the friends property: The friends property. + * + * @return the friends value. + */ + List friends(); + + /** + * Gets the hate property: The hate property. + * + * @return the hate value. + */ + Map hate(); + + /** + * Gets the partner property: The partner property. + * + * @return the partner value. + */ + Fish partner(); + + /** + * Gets the inner tsptest.armstreamstyleserialization.fluent.models.SalmonInner object. + * + * @return the inner object. + */ + SalmonInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java new file mode 100644 index 00000000000..49590e9c112 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armstreamstyleserialization.fluent.models.AnotherFishProperties; +import tsptest.armstreamstyleserialization.fluent.models.FishProperties; + +/** + * The third level model SawShark in polymorphic multiple levels inheritance. + */ +@Fluent +public final class SawShark extends Shark { + /* + * Discriminator property for Fish. + */ + private String kind = "shark"; + + /* + * The sharktype property. + */ + private String sharktype = "saw"; + + /* + * The dna property. + */ + private String dna; + + /* + * The age property. + */ + private int age; + + /* + * The anotherProperties property. + */ + private AnotherFishProperties innerAnotherProperties = new AnotherFishProperties(); + + /* + * The properties property. + */ + private FishProperties innerProperties = new FishProperties(); + + /** + * Creates an instance of SawShark class. + */ + public SawShark() { + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Override + public String kind() { + return this.kind; + } + + /** + * Get the sharktype property: The sharktype property. + * + * @return the sharktype value. + */ + @Override + public String sharktype() { + return this.sharktype; + } + + /** + * Get the dna property: The dna property. + * + * @return the dna value. + */ + public String dna() { + return this.dna; + } + + /** + * Set the dna property: The dna property. + * + * @param dna the dna value to set. + * @return the SawShark object itself. + */ + public SawShark withDna(String dna) { + this.dna = dna; + return this; + } + + /** + * Get the age property: The age property. + * + * @return the age value. + */ + public int age() { + return this.age; + } + + /** + * Set the age property: The age property. + * + * @param age the age value to set. + * @return the SawShark object itself. + */ + public SawShark withAge(int age) { + this.age = age; + return this; + } + + /** + * Get the innerAnotherProperties property: The anotherProperties property. + * + * @return the innerAnotherProperties value. + */ + private AnotherFishProperties innerAnotherProperties() { + return this.innerAnotherProperties; + } + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private FishProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double length() { + return this.innerProperties() == null ? 0.0 : this.innerProperties().length(); + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the SawShark object itself. + */ + public SawShark withLength(double length) { + if (this.innerProperties() == null) { + this.innerProperties = new FishProperties(); + } + this.innerProperties().withLength(length); + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String patten() { + return this.innerProperties() == null ? null : this.innerProperties().patten(); + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredString() { + return this.innerProperties() == null ? null : this.innerProperties().requiredString(); + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the SawShark object itself. + */ + public SawShark withRequiredString(String requiredString) { + if (this.innerProperties() == null) { + this.innerProperties = new FishProperties(); + } + this.innerProperties().withRequiredString(requiredString); + return this; + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double lengthAnotherPropertiesLength() { + return this.innerAnotherProperties() == null ? 0.0 : this.innerAnotherProperties().length(); + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the SawShark object itself. + */ + public SawShark withLengthAnotherPropertiesLength(double length) { + if (this.innerAnotherProperties() == null) { + this.innerAnotherProperties = new AnotherFishProperties(); + } + this.innerAnotherProperties().withLength(length); + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String pattenAnotherPropertiesPatten() { + return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().patten(); + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredStringAnotherPropertiesRequiredString() { + return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().requiredString(); + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the SawShark object itself. + */ + public SawShark withRequiredStringAnotherPropertiesRequiredString(String requiredString) { + if (this.innerAnotherProperties() == null) { + this.innerAnotherProperties = new AnotherFishProperties(); + } + this.innerAnotherProperties().withRequiredString(requiredString); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (dna() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property dna in model SawShark")); + } + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model SawShark")); + } else { + innerProperties().validate(); + } + if (innerAnotherProperties() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property innerAnotherProperties in model SawShark")); + } else { + innerAnotherProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SawShark.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeJsonField("properties", innerProperties()); + jsonWriter.writeJsonField("anotherProperties", innerAnotherProperties()); + jsonWriter.writeStringField("dna", this.dna); + jsonWriter.writeIntField("age", this.age); + jsonWriter.writeStringField("sharktype", this.sharktype); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SawShark from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SawShark if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SawShark. + */ + public static SawShark fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SawShark deserializedSawShark = new SawShark(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedSawShark.innerProperties = FishProperties.fromJson(reader); + } else if ("anotherProperties".equals(fieldName)) { + deserializedSawShark.innerAnotherProperties = AnotherFishProperties.fromJson(reader); + } else if ("dna".equals(fieldName)) { + deserializedSawShark.dna = reader.getString(); + } else if ("age".equals(fieldName)) { + deserializedSawShark.age = reader.getInt(); + } else if ("sharktype".equals(fieldName)) { + deserializedSawShark.sharktype = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSawShark; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Shark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Shark.java new file mode 100644 index 00000000000..556d445d45b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/Shark.java @@ -0,0 +1,317 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.armstreamstyleserialization.fluent.models.AnotherFishProperties; +import tsptest.armstreamstyleserialization.fluent.models.FishInner; +import tsptest.armstreamstyleserialization.fluent.models.FishProperties; + +/** + * The second level model in polymorphic multiple levels inheritance and it defines a new discriminator. + */ +@Fluent +public class Shark extends FishInner { + /* + * Discriminator property for Fish. + */ + private String kind = "shark"; + + /* + * The sharktype property. + */ + private String sharktype = "shark"; + + /* + * The anotherProperties property. + */ + private AnotherFishProperties innerAnotherProperties = new AnotherFishProperties(); + + /* + * The properties property. + */ + private FishProperties innerProperties = new FishProperties(); + + /* + * The dna property. + */ + private String dna; + + /** + * Creates an instance of Shark class. + */ + public Shark() { + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Override + public String kind() { + return this.kind; + } + + /** + * Get the sharktype property: The sharktype property. + * + * @return the sharktype value. + */ + public String sharktype() { + return this.sharktype; + } + + /** + * Get the innerAnotherProperties property: The anotherProperties property. + * + * @return the innerAnotherProperties value. + */ + private AnotherFishProperties innerAnotherProperties() { + return this.innerAnotherProperties; + } + + /** + * Get the innerProperties property: The properties property. + * + * @return the innerProperties value. + */ + private FishProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the dna property: The dna property. + * + * @return the dna value. + */ + @Override + public String dna() { + return this.dna; + } + + /** + * {@inheritDoc} + */ + @Override + public Shark withAge(int age) { + super.withAge(age); + return this; + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double length() { + return this.innerProperties() == null ? 0.0 : this.innerProperties().length(); + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the Shark object itself. + */ + public Shark withLength(double length) { + if (this.innerProperties() == null) { + this.innerProperties = new FishProperties(); + } + this.innerProperties().withLength(length); + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String patten() { + return this.innerProperties() == null ? null : this.innerProperties().patten(); + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredString() { + return this.innerProperties() == null ? null : this.innerProperties().requiredString(); + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the Shark object itself. + */ + public Shark withRequiredString(String requiredString) { + if (this.innerProperties() == null) { + this.innerProperties = new FishProperties(); + } + this.innerProperties().withRequiredString(requiredString); + return this; + } + + /** + * Get the length property: The length property. + * + * @return the length value. + */ + public double lengthAnotherPropertiesLength() { + return this.innerAnotherProperties() == null ? 0.0 : this.innerAnotherProperties().length(); + } + + /** + * Set the length property: The length property. + * + * @param length the length value to set. + * @return the Shark object itself. + */ + public Shark withLengthAnotherPropertiesLength(double length) { + if (this.innerAnotherProperties() == null) { + this.innerAnotherProperties = new AnotherFishProperties(); + } + this.innerAnotherProperties().withLength(length); + return this; + } + + /** + * Get the patten property: The patten property. + * + * @return the patten value. + */ + public String pattenAnotherPropertiesPatten() { + return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().patten(); + } + + /** + * Get the requiredString property: The requiredString property. + * + * @return the requiredString value. + */ + public String requiredStringAnotherPropertiesRequiredString() { + return this.innerAnotherProperties() == null ? null : this.innerAnotherProperties().requiredString(); + } + + /** + * Set the requiredString property: The requiredString property. + * + * @param requiredString the requiredString value to set. + * @return the Shark object itself. + */ + public Shark withRequiredStringAnotherPropertiesRequiredString(String requiredString) { + if (this.innerAnotherProperties() == null) { + this.innerAnotherProperties = new AnotherFishProperties(); + } + this.innerAnotherProperties().withRequiredString(requiredString); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (innerProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerProperties in model Shark")); + } else { + innerProperties().validate(); + } + if (innerAnotherProperties() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property innerAnotherProperties in model Shark")); + } else { + innerAnotherProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Shark.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeIntField("age", age()); + jsonWriter.writeJsonField("properties", innerProperties()); + jsonWriter.writeJsonField("anotherProperties", innerAnotherProperties()); + jsonWriter.writeStringField("sharktype", this.sharktype); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Shark from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Shark if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Shark. + */ + public static Shark fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("sharktype".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("saw".equals(discriminatorValue)) { + return SawShark.fromJson(readerToUse.reset()); + } else if ("goblin".equals(discriminatorValue)) { + return GoblinShark.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static Shark fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Shark deserializedShark = new Shark(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + deserializedShark.withAge(reader.getInt()); + } else if ("dna".equals(fieldName)) { + deserializedShark.dna = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedShark.innerProperties = FishProperties.fromJson(reader); + } else if ("anotherProperties".equals(fieldName)) { + deserializedShark.innerAnotherProperties = AnotherFishProperties.fromJson(reader); + } else if ("sharktype".equals(fieldName)) { + deserializedShark.sharktype = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedShark; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResource.java new file mode 100644 index 00000000000..b6434425091 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResource.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.management.SystemData; +import java.util.Map; +import tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner; + +/** + * An immutable client-side representation of TopLevelArmResource. + */ +public interface TopLevelArmResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + TopLevelArmResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner object. + * + * @return the inner object. + */ + TopLevelArmResourceInner innerModel(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceProperties.java new file mode 100644 index 00000000000..28cb04d6533 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceProperties.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Top Level Arm Resource Properties. + */ +@Immutable +public final class TopLevelArmResourceProperties implements JsonSerializable { + /* + * The description property. + */ + private String description; + + /* + * The builtin property. + */ + private Builtin builtin; + + /** + * Creates an instance of TopLevelArmResourceProperties class. + */ + private TopLevelArmResourceProperties() { + } + + /** + * Get the description property: The description property. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the builtin property: The builtin property. + * + * @return the builtin value. + */ + public Builtin builtin() { + return this.builtin; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (builtin() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property builtin in model TopLevelArmResourceProperties")); + } else { + builtin().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TopLevelArmResourceProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("builtin", this.builtin); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelArmResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelArmResourceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TopLevelArmResourceProperties. + */ + public static TopLevelArmResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelArmResourceProperties deserializedTopLevelArmResourceProperties + = new TopLevelArmResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("builtin".equals(fieldName)) { + deserializedTopLevelArmResourceProperties.builtin = Builtin.fromJson(reader); + } else if ("description".equals(fieldName)) { + deserializedTopLevelArmResourceProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelArmResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceTagsUpdate.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceTagsUpdate.java new file mode 100644 index 00000000000..2ba7f735d77 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceTagsUpdate.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for updating tags in TopLevelArmResource resources. + */ +@Fluent +public final class TopLevelArmResourceTagsUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of TopLevelArmResourceTagsUpdate class. + */ + public TopLevelArmResourceTagsUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TopLevelArmResourceTagsUpdate object itself. + */ + public TopLevelArmResourceTagsUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelArmResourceTagsUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelArmResourceTagsUpdate if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TopLevelArmResourceTagsUpdate. + */ + public static TopLevelArmResourceTagsUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelArmResourceTagsUpdate deserializedTopLevelArmResourceTagsUpdate + = new TopLevelArmResourceTagsUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTopLevelArmResourceTagsUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelArmResourceTagsUpdate; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResources.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResources.java new file mode 100644 index 00000000000..3c8cbdaac8a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResources.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armstreamstyleserialization.models; + +import com.azure.core.util.Context; + +/** + * Resource collection API of TopLevelArmResources. + */ +public interface TopLevelArmResources { + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + TopLevelArmResource update(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceTagsUpdate properties); + + /** + * Update a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourceName arm resource name for path. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + TopLevelArmResource update(String resourceGroupName, String topLevelArmResourceName, + TopLevelArmResourceTagsUpdate properties, Context context); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/package-info.java new file mode 100644 index 00000000000..b5ae20d11ff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for ArmResourceProvider. + * Arm Resource Provider management API. + */ +package tsptest.armstreamstyleserialization.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/package-info.java new file mode 100644 index 00000000000..4fb92cd84de --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for ArmResourceProvider. + * Arm Resource Provider management API. + */ +package tsptest.armstreamstyleserialization; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/ArmVersionedManager.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/ArmVersionedManager.java new file mode 100644 index 00000000000..316d4b6e8e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/ArmVersionedManager.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; +import tsptest.armversioned.fluent.ArmVersionedClient; +import tsptest.armversioned.implementation.ArmVersionedClientBuilder; +import tsptest.armversioned.implementation.TopLevelArmResourcesImpl; +import tsptest.armversioned.models.TopLevelArmResources; + +/** + * Entry point to ArmVersionedManager. + * Arm Resource Provider management API. + */ +public final class ArmVersionedManager { + private TopLevelArmResources topLevelArmResources; + + private final ArmVersionedClient clientObject; + + private ArmVersionedManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ArmVersionedClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ArmVersioned service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ArmVersioned service API instance. + */ + public static ArmVersionedManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of ArmVersioned service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ArmVersioned service API instance. + */ + public static ArmVersionedManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ArmVersionedManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ArmVersionedManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ArmVersionedManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-armversioned-generated.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of ArmVersioned service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ArmVersioned service API instance. + */ + public ArmVersionedManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("tsptest.armversioned") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ArmVersionedManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of TopLevelArmResources. It manages TopLevelArmResource. + * + * @return Resource collection API of TopLevelArmResources. + */ + public TopLevelArmResources topLevelArmResources() { + if (this.topLevelArmResources == null) { + this.topLevelArmResources = new TopLevelArmResourcesImpl(clientObject.getTopLevelArmResources(), this); + } + return topLevelArmResources; + } + + /** + * Gets wrapped service client ArmVersionedClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client ArmVersionedClient. + */ + public ArmVersionedClient serviceClient() { + return this.clientObject; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/ArmVersionedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/ArmVersionedClient.java new file mode 100644 index 00000000000..0c52b974851 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/ArmVersionedClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ArmVersionedClient class. + */ +public interface ArmVersionedClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the TopLevelArmResourcesClient object to access its operations. + * + * @return the TopLevelArmResourcesClient object. + */ + TopLevelArmResourcesClient getTopLevelArmResources(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/TopLevelArmResourcesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/TopLevelArmResourcesClient.java new file mode 100644 index 00000000000..47f358f13b6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/TopLevelArmResourcesClient.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; + +/** + * An instance of this class provides access to all the operations defined in TopLevelArmResourcesClient. + */ +public interface TopLevelArmResourcesClient { + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( + String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource); + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( + String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, + String parameter, String newParameter, Context context); + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( + String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, + String parameter, Context context); + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourcePropertiesName, + TopLevelArmResourceInner resource); + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourcePropertiesName, + TopLevelArmResourceInner resource, String parameter, String newParameter, Context context); + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourcePropertiesName, + TopLevelArmResourceInner resource, String parameter, Context context); + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String parameter, String newParameter, Context context); + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String parameter, Context context); + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String parameter, + String newParameter, Context context); + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String parameter, + Context context); + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelArmResourcePropertiesName, String parameter, String newParameter, Context context); + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelArmResourcePropertiesName, String parameter, Context context); + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TopLevelArmResourceInner getByResourceGroup(String resourceGroupName, String topLevelArmResourcePropertiesName); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, String newParameter, Context context); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, Context context); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String topLevelArmResourcePropertiesName); + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, String newParameter, Context context); + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, Context context); + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void action(String resourceGroupName, String topLevelArmResourcePropertiesName); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/TopLevelArmResourceInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/TopLevelArmResourceInner.java new file mode 100644 index 00000000000..54adc39e6a9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/TopLevelArmResourceInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; +import tsptest.armversioned.models.TopLevelArmResourceProperties; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class TopLevelArmResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private TopLevelArmResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TopLevelArmResourceInner class. + */ + public TopLevelArmResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public TopLevelArmResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the TopLevelArmResourceInner object itself. + */ + public TopLevelArmResourceInner withProperties(TopLevelArmResourceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public TopLevelArmResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TopLevelArmResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelArmResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelArmResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TopLevelArmResourceInner. + */ + public static TopLevelArmResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelArmResourceInner deserializedTopLevelArmResourceInner = new TopLevelArmResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTopLevelArmResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTopLevelArmResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTopLevelArmResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedTopLevelArmResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTopLevelArmResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedTopLevelArmResourceInner.properties = TopLevelArmResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedTopLevelArmResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelArmResourceInner; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/package-info.java new file mode 100644 index 00000000000..efa70b16308 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for ArmVersioned. + * Arm Resource Provider management API. + */ +package tsptest.armversioned.fluent.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/package-info.java new file mode 100644 index 00000000000..304185e7846 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for ArmVersioned. + * Arm Resource Provider management API. + */ +package tsptest.armversioned.fluent; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientBuilder.java new file mode 100644 index 00000000000..6498c099e69 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the ArmVersionedClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ArmVersionedClientImpl.class }) +public final class ArmVersionedClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ArmVersionedClientBuilder. + */ + public ArmVersionedClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the ArmVersionedClientBuilder. + */ + public ArmVersionedClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ArmVersionedClientBuilder. + */ + public ArmVersionedClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 ArmVersionedClientBuilder. + */ + public ArmVersionedClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ArmVersionedClientBuilder. + */ + public ArmVersionedClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 ArmVersionedClientBuilder. + */ + public ArmVersionedClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ArmVersionedClientImpl with the provided parameters. + * + * @return an instance of ArmVersionedClientImpl. + */ + public ArmVersionedClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + ArmVersionedClientImpl client = new ArmVersionedClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientImpl.java new file mode 100644 index 00000000000..60ee7879dcf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ArmVersionedClientImpl.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armversioned.fluent.ArmVersionedClient; +import tsptest.armversioned.fluent.TopLevelArmResourcesClient; + +/** + * Initializes a new instance of the ArmVersionedClientImpl type. + */ +@ServiceClient(builder = ArmVersionedClientBuilder.class) +public final class ArmVersionedClientImpl implements ArmVersionedClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The TopLevelArmResourcesClient object to access its operations. + */ + private final TopLevelArmResourcesClient topLevelArmResources; + + /** + * Gets the TopLevelArmResourcesClient object to access its operations. + * + * @return the TopLevelArmResourcesClient object. + */ + public TopLevelArmResourcesClient getTopLevelArmResources() { + return this.topLevelArmResources; + } + + /** + * Initializes an instance of ArmVersionedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + ArmVersionedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2024-12-01"; + this.topLevelArmResources = new TopLevelArmResourcesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ArmVersionedClientImpl.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ResourceManagerUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ResourceManagerUtils.java new file mode 100644 index 00000000000..f52d86253ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.implementation; + +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourceImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourceImpl.java new file mode 100644 index 00000000000..56789e16392 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourceImpl.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Collections; +import java.util.Map; +import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; +import tsptest.armversioned.models.TopLevelArmResource; +import tsptest.armversioned.models.TopLevelArmResourceProperties; + +public final class TopLevelArmResourceImpl + implements TopLevelArmResource, TopLevelArmResource.Definition, TopLevelArmResource.Update { + private TopLevelArmResourceInner innerObject; + + private final tsptest.armversioned.ArmVersionedManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public TopLevelArmResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public TopLevelArmResourceInner innerModel() { + return this.innerObject; + } + + private tsptest.armversioned.ArmVersionedManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String topLevelArmResourcePropertiesName; + + private String createParameter; + + private String createNewParameter; + + private String updateParameter; + + private String updateNewParameter; + + public TopLevelArmResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public TopLevelArmResource create() { + this.innerObject = serviceManager.serviceClient() + .getTopLevelArmResources() + .createOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, this.innerModel(), createParameter, + createNewParameter, Context.NONE); + return this; + } + + public TopLevelArmResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTopLevelArmResources() + .createOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, this.innerModel(), createParameter, + createNewParameter, context); + return this; + } + + TopLevelArmResourceImpl(String name, tsptest.armversioned.ArmVersionedManager serviceManager) { + this.innerObject = new TopLevelArmResourceInner(); + this.serviceManager = serviceManager; + this.topLevelArmResourcePropertiesName = name; + this.createParameter = null; + this.createNewParameter = null; + } + + public TopLevelArmResourceImpl update() { + this.updateParameter = null; + this.updateNewParameter = null; + return this; + } + + public TopLevelArmResource apply() { + this.innerObject = serviceManager.serviceClient() + .getTopLevelArmResources() + .createOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, this.innerModel(), updateParameter, + updateNewParameter, Context.NONE); + return this; + } + + public TopLevelArmResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTopLevelArmResources() + .createOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, this.innerModel(), updateParameter, + updateNewParameter, context); + return this; + } + + TopLevelArmResourceImpl(TopLevelArmResourceInner innerObject, + tsptest.armversioned.ArmVersionedManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.topLevelArmResourcePropertiesName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "topLevelArmResources"); + } + + public TopLevelArmResource refresh() { + String localParameter = null; + String localNewParameter = null; + this.innerObject = serviceManager.serviceClient() + .getTopLevelArmResources() + .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, localParameter, + localNewParameter, Context.NONE) + .getValue(); + return this; + } + + public TopLevelArmResource refresh(Context context) { + String localParameter = null; + String localNewParameter = null; + this.innerObject = serviceManager.serviceClient() + .getTopLevelArmResources() + .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, localParameter, + localNewParameter, context) + .getValue(); + return this; + } + + public Response actionWithResponse(String parameter, String newParameter, Context context) { + return serviceManager.topLevelArmResources() + .actionWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter, context); + } + + public Response actionWithResponse(String parameter, Context context) { + return serviceManager.topLevelArmResources() + .actionWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, context); + } + + public void action() { + serviceManager.topLevelArmResources().action(resourceGroupName, topLevelArmResourcePropertiesName); + } + + public TopLevelArmResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public TopLevelArmResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public TopLevelArmResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public TopLevelArmResourceImpl withProperties(TopLevelArmResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public TopLevelArmResourceImpl withParameter(String parameter) { + if (isInCreateMode()) { + this.createParameter = parameter; + return this; + } else { + this.updateParameter = parameter; + return this; + } + } + + public TopLevelArmResourceImpl withNewParameter(String newParameter) { + if (isInCreateMode()) { + this.createNewParameter = newParameter; + return this; + } else { + this.updateNewParameter = newParameter; + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesClientImpl.java new file mode 100644 index 00000000000..28cc7a6e6e8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesClientImpl.java @@ -0,0 +1,1346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +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.Put; +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.annotation.UnexpectedResponseExceptionType; +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.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.armversioned.fluent.TopLevelArmResourcesClient; +import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; +import tsptest.armversioned.implementation.models.TopLevelArmResourceListResult; + +/** + * An instance of this class provides access to all the operations defined in TopLevelArmResourcesClient. + */ +public final class TopLevelArmResourcesClientImpl implements TopLevelArmResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final TopLevelArmResourcesService service; + + /** + * The service client containing this operation class. + */ + private final ArmVersionedClientImpl client; + + /** + * Initializes an instance of TopLevelArmResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TopLevelArmResourcesClientImpl(ArmVersionedClientImpl client) { + this.service = RestProxy.create(TopLevelArmResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArmVersionedClientTopLevelArmResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArmVersionedClientTopLevelArmResources") + public interface TopLevelArmResourcesService { + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, + @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") TopLevelArmResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, + @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") TopLevelArmResourceInner resource, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/TspTest.ArmVersioned/topLevelArmResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/TspTest.ArmVersioned/topLevelArmResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("parameter") String parameter, + @QueryParam("newParameter") String newParameter, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("parameter") String parameter, + @QueryParam("newParameter") String newParameter, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, + @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, + @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, + @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, + @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}/action") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> action(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, + @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/TspTest.ArmVersioned/topLevelArmResources/{topLevelArmResourcePropertiesName}/action") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response actionSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("topLevelArmResourcePropertiesName") String topLevelArmResourcePropertiesName, + @QueryParam("parameter") String parameter, @QueryParam("newParameter") String newParameter, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, String parameter, + String newParameter) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, + String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, String parameter, + String newParameter) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, contentType, accept, resource, Context.NONE); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, + String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, String parameter, + String newParameter, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, contentType, accept, resource, context); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, + String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, String parameter, + Context context) { + final String newParameter = null; + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, contentType, accept, resource, context); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TopLevelArmResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, + String parameter, String newParameter) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + topLevelArmResourcePropertiesName, resource, parameter, newParameter); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, + this.client.getContext()); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TopLevelArmResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource) { + final String parameter = null; + final String newParameter = null; + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, + topLevelArmResourcePropertiesName, resource, parameter, newParameter); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, + this.client.getContext()); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( + String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, + String parameter, String newParameter) { + Response response = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, + resource, parameter, newParameter); + return this.client.getLroResult(response, + TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, Context.NONE); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( + String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource) { + final String parameter = null; + final String newParameter = null; + Response response = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, + resource, parameter, newParameter); + return this.client.getLroResult(response, + TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, Context.NONE); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( + String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, + String parameter, String newParameter, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, + resource, parameter, newParameter, context); + return this.client.getLroResult(response, + TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, context); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TopLevelArmResourceInner> beginCreateOrUpdate( + String resourceGroupName, String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, + String parameter, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, + resource, parameter, context); + return this.client.getLroResult(response, + TopLevelArmResourceInner.class, TopLevelArmResourceInner.class, context); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource, String parameter, + String newParameter) { + return beginCreateOrUpdateAsync(resourceGroupName, topLevelArmResourcePropertiesName, resource, parameter, + newParameter).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String topLevelArmResourcePropertiesName, TopLevelArmResourceInner resource) { + final String parameter = null; + final String newParameter = null; + return beginCreateOrUpdateAsync(resourceGroupName, topLevelArmResourcePropertiesName, resource, parameter, + newParameter).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourcePropertiesName, + TopLevelArmResourceInner resource) { + final String parameter = null; + final String newParameter = null; + return beginCreateOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, resource, parameter, + newParameter).getFinalResult(); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourcePropertiesName, + TopLevelArmResourceInner resource, String parameter, String newParameter, Context context) { + return beginCreateOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, resource, parameter, + newParameter, context).getFinalResult(); + } + + /** + * Create a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param resource Resource create parameters. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelArmResourceInner createOrUpdate(String resourceGroupName, String topLevelArmResourcePropertiesName, + TopLevelArmResourceInner resource, String parameter, Context context) { + return beginCreateOrUpdate(resourceGroupName, topLevelArmResourcePropertiesName, resource, parameter, context) + .getFinalResult(); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String parameter, String newParameter) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), parameter, newParameter, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String parameter, String newParameter) { + return new PagedFlux<>(() -> listSinglePageAsync(parameter, newParameter), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String parameter = null; + final String newParameter = null; + return new PagedFlux<>(() -> listSinglePageAsync(parameter, newParameter), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String parameter, String newParameter) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + parameter, newParameter, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String parameter, String newParameter, + Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), parameter, newParameter, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String parameter, Context context) { + final String newParameter = null; + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), parameter, newParameter, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String parameter = null; + final String newParameter = null; + return new PagedIterable<>(() -> listSinglePage(parameter, newParameter), + nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String parameter, String newParameter, Context context) { + return new PagedIterable<>(() -> listSinglePage(parameter, newParameter, context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String parameter, Context context) { + return new PagedIterable<>(() -> listSinglePage(parameter, context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + String parameter, String newParameter) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, parameter, newParameter, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String parameter, + String newParameter) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, parameter, newParameter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String parameter = null; + final String newParameter = null; + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, parameter, newParameter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + String parameter, String newParameter) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, parameter, newParameter, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + String parameter, String newParameter, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, parameter, newParameter, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + String parameter, Context context) { + final String newParameter = null; + final String accept = "application/json"; + Response res + = service.listByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, parameter, newParameter, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String parameter = null; + final String newParameter = null; + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, parameter, newParameter), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, String parameter, + String newParameter, Context context) { + return new PagedIterable<>( + () -> listByResourceGroupSinglePage(resourceGroupName, parameter, newParameter, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, String parameter, + Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, parameter, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String topLevelArmResourcePropertiesName, String parameter, String newParameter) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String topLevelArmResourcePropertiesName) { + final String parameter = null; + final String newParameter = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelArmResourcePropertiesName, String parameter, String newParameter, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, accept, context); + } + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelArmResourcePropertiesName, String parameter, Context context) { + final String newParameter = null; + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, accept, context); + } + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TopLevelArmResourceInner getByResourceGroup(String resourceGroupName, + String topLevelArmResourcePropertiesName) { + final String parameter = null; + final String newParameter = null; + return getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, Context.NONE).getValue(); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, + String topLevelArmResourcePropertiesName, String parameter, String newParameter) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String topLevelArmResourcePropertiesName) { + final String parameter = null; + final String newParameter = null; + return deleteWithResponseAsync(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, String newParameter, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, context); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, Context context) { + final String newParameter = null; + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, context); + } + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String topLevelArmResourcePropertiesName) { + final String parameter = null; + final String newParameter = null; + deleteWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter, Context.NONE); + } + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> actionWithResponseAsync(String resourceGroupName, + String topLevelArmResourcePropertiesName, String parameter, String newParameter) { + return FluxUtil + .withContext(context -> service.action(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono actionAsync(String resourceGroupName, String topLevelArmResourcePropertiesName) { + final String parameter = null; + final String newParameter = null; + return actionWithResponseAsync(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter) + .flatMap(ignored -> Mono.empty()); + } + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, String newParameter, Context context) { + return service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, context); + } + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, Context context) { + final String newParameter = null; + return service.actionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, context); + } + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void action(String resourceGroupName, String topLevelArmResourcePropertiesName) { + final String parameter = null; + final String newParameter = null; + actionWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a TopLevelArmResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesImpl.java new file mode 100644 index 00000000000..a0b31f30dba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesImpl.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import tsptest.armversioned.fluent.TopLevelArmResourcesClient; +import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; +import tsptest.armversioned.models.TopLevelArmResource; +import tsptest.armversioned.models.TopLevelArmResources; + +public final class TopLevelArmResourcesImpl implements TopLevelArmResources { + private static final ClientLogger LOGGER = new ClientLogger(TopLevelArmResourcesImpl.class); + + private final TopLevelArmResourcesClient innerClient; + + private final tsptest.armversioned.ArmVersionedManager serviceManager; + + public TopLevelArmResourcesImpl(TopLevelArmResourcesClient innerClient, + tsptest.armversioned.ArmVersionedManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String parameter, String newParameter, Context context) { + PagedIterable inner = this.serviceClient().list(parameter, newParameter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String parameter, Context context) { + PagedIterable inner = this.serviceClient().list(parameter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String parameter, + String newParameter, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, parameter, newParameter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String parameter, + Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, parameter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TopLevelArmResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelArmResourcePropertiesName, String parameter, String newParameter, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new TopLevelArmResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelArmResourcePropertiesName, String parameter, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new TopLevelArmResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TopLevelArmResource getByResourceGroup(String resourceGroupName, String topLevelArmResourcePropertiesName) { + TopLevelArmResourceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, topLevelArmResourcePropertiesName); + if (inner != null) { + return new TopLevelArmResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, String newParameter, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter, context); + } + + public Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, context); + } + + public void delete(String resourceGroupName, String topLevelArmResourcePropertiesName) { + this.serviceClient().delete(resourceGroupName, topLevelArmResourcePropertiesName); + } + + public Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, String newParameter, Context context) { + return this.serviceClient() + .actionWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter, context); + } + + public Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, Context context) { + return this.serviceClient() + .actionWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, context); + } + + public void action(String resourceGroupName, String topLevelArmResourcePropertiesName) { + this.serviceClient().action(resourceGroupName, topLevelArmResourcePropertiesName); + } + + public TopLevelArmResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourcePropertiesName + = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourcePropertiesName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + String localParameter = null; + String localNewParameter = null; + return this + .getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, localParameter, + localNewParameter, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, String parameter, String newParameter, + Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourcePropertiesName + = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourcePropertiesName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, + newParameter, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourcePropertiesName + = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourcePropertiesName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + String localParameter = null; + String localNewParameter = null; + this.deleteWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, localParameter, localNewParameter, + Context.NONE); + } + + public Response deleteByIdWithResponse(String id, String parameter, String newParameter, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourcePropertiesName + = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourcePropertiesName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + return this.deleteWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, newParameter, + context); + } + + public Response deleteByIdWithResponse(String id, String parameter, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String topLevelArmResourcePropertiesName + = ResourceManagerUtils.getValueFromIdByName(id, "topLevelArmResources"); + if (topLevelArmResourcePropertiesName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'topLevelArmResources'.", id))); + } + return this.deleteWithResponse(resourceGroupName, topLevelArmResourcePropertiesName, parameter, context); + } + + private TopLevelArmResourcesClient serviceClient() { + return this.innerClient; + } + + private tsptest.armversioned.ArmVersionedManager manager() { + return this.serviceManager; + } + + public TopLevelArmResourceImpl define(String name) { + return new TopLevelArmResourceImpl(name, this.manager()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/models/TopLevelArmResourceListResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/models/TopLevelArmResourceListResult.java new file mode 100644 index 00000000000..89c6c334369 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/models/TopLevelArmResourceListResult.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; + +/** + * The response of a TopLevelArmResource list operation. + */ +@Immutable +public final class TopLevelArmResourceListResult implements JsonSerializable { + /* + * The TopLevelArmResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of TopLevelArmResourceListResult class. + */ + private TopLevelArmResourceListResult() { + } + + /** + * Get the value property: The TopLevelArmResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelArmResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelArmResourceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TopLevelArmResourceListResult. + */ + public static TopLevelArmResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelArmResourceListResult deserializedTopLevelArmResourceListResult + = new TopLevelArmResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> TopLevelArmResourceInner.fromJson(reader1)); + deserializedTopLevelArmResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedTopLevelArmResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelArmResourceListResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/package-info.java new file mode 100644 index 00000000000..414dcf31448 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for ArmVersioned. + * Arm Resource Provider management API. + */ +package tsptest.armversioned.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/ResourceProvisioningState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/ResourceProvisioningState.java new file mode 100644 index 00000000000..2ebeed742f0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/ResourceProvisioningState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of a resource type. + */ +public final class ResourceProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ResourceProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ResourceProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ResourceProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ResourceProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceProvisioningState() { + } + + /** + * Creates or finds a ResourceProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceProvisioningState. + */ + public static ResourceProvisioningState fromString(String name) { + return fromString(name, ResourceProvisioningState.class); + } + + /** + * Gets known ResourceProvisioningState values. + * + * @return known ResourceProvisioningState values. + */ + public static Collection values() { + return values(ResourceProvisioningState.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResource.java new file mode 100644 index 00000000000..5de933bb660 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResource.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import java.util.Map; +import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; + +/** + * An immutable client-side representation of TopLevelArmResource. + */ +public interface TopLevelArmResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + TopLevelArmResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner tsptest.armversioned.fluent.models.TopLevelArmResourceInner object. + * + * @return the inner object. + */ + TopLevelArmResourceInner innerModel(); + + /** + * The entirety of the TopLevelArmResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The TopLevelArmResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the TopLevelArmResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the TopLevelArmResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties, + DefinitionStages.WithParameter, DefinitionStages.WithNewParameter { + /** + * Executes the create request. + * + * @return the created resource. + */ + TopLevelArmResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TopLevelArmResource create(Context context); + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(TopLevelArmResourceProperties properties); + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify parameter. + */ + interface WithParameter { + /** + * Specifies the parameter property: The parameter parameter. + * + * @param parameter The parameter parameter. + * @return the next definition stage. + */ + WithCreate withParameter(String parameter); + } + + /** + * The stage of the TopLevelArmResource definition allowing to specify newParameter. + */ + interface WithNewParameter { + /** + * Specifies the newParameter property: The newParameter parameter. + * + * @param newParameter The newParameter parameter. + * @return the next definition stage. + */ + WithCreate withNewParameter(String newParameter); + } + } + + /** + * Begins update for the TopLevelArmResource resource. + * + * @return the stage of resource update. + */ + TopLevelArmResource.Update update(); + + /** + * The template for TopLevelArmResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties, UpdateStages.WithParameter, + UpdateStages.WithNewParameter { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TopLevelArmResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TopLevelArmResource apply(Context context); + } + + /** + * The TopLevelArmResource update stages. + */ + interface UpdateStages { + /** + * The stage of the TopLevelArmResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the TopLevelArmResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(TopLevelArmResourceProperties properties); + } + + /** + * The stage of the TopLevelArmResource update allowing to specify parameter. + */ + interface WithParameter { + /** + * Specifies the parameter property: The parameter parameter. + * + * @param parameter The parameter parameter. + * @return the next definition stage. + */ + Update withParameter(String parameter); + } + + /** + * The stage of the TopLevelArmResource update allowing to specify newParameter. + */ + interface WithNewParameter { + /** + * Specifies the newParameter property: The newParameter parameter. + * + * @param newParameter The newParameter parameter. + * @return the next definition stage. + */ + Update withNewParameter(String newParameter); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TopLevelArmResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TopLevelArmResource refresh(Context context); + + /** + * A synchronous resource action. + * + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response actionWithResponse(String parameter, String newParameter, Context context); + + /** + * A synchronous resource action. + * + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response actionWithResponse(String parameter, Context context); + + /** + * A synchronous resource action. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void action(); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResourceProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResourceProperties.java new file mode 100644 index 00000000000..4cf68776cea --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResourceProperties.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Top Level Arm Resource Properties. + */ +@Immutable +public final class TopLevelArmResourceProperties implements JsonSerializable { + /* + * The provisioningState property. + */ + private ResourceProvisioningState provisioningState; + + /** + * Creates an instance of TopLevelArmResourceProperties class. + */ + public TopLevelArmResourceProperties() { + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TopLevelArmResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TopLevelArmResourceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TopLevelArmResourceProperties. + */ + public static TopLevelArmResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TopLevelArmResourceProperties deserializedTopLevelArmResourceProperties + = new TopLevelArmResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedTopLevelArmResourceProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTopLevelArmResourceProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResources.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResources.java new file mode 100644 index 00000000000..ebc8b5ca2b2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/TopLevelArmResources.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of TopLevelArmResources. + */ +public interface TopLevelArmResources { + /** + * List TopLevelArmResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String parameter, String newParameter, Context context); + + /** + * List TopLevelArmResource resources by subscription ID. + * + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String parameter, Context context); + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String parameter, + String newParameter, Context context); + + /** + * List TopLevelArmResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a TopLevelArmResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String parameter, Context context); + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelArmResourcePropertiesName, String parameter, String newParameter, Context context); + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String topLevelArmResourcePropertiesName, String parameter, Context context); + + /** + * Get a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource. + */ + TopLevelArmResource getByResourceGroup(String resourceGroupName, String topLevelArmResourcePropertiesName); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, String newParameter, Context context); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, Context context); + + /** + * Delete a TopLevelArmResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String topLevelArmResourcePropertiesName); + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, String newParameter, Context context); + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response actionWithResponse(String resourceGroupName, String topLevelArmResourcePropertiesName, + String parameter, Context context); + + /** + * A synchronous resource action. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param topLevelArmResourcePropertiesName The name of the TopLevelArmResourceProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void action(String resourceGroupName, String topLevelArmResourcePropertiesName); + + /** + * Get a TopLevelArmResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + TopLevelArmResource getById(String id); + + /** + * Get a TopLevelArmResource. + * + * @param id the resource ID. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TopLevelArmResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, String parameter, String newParameter, + Context context); + + /** + * Delete a TopLevelArmResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a TopLevelArmResource. + * + * @param id the resource ID. + * @param parameter The parameter parameter. + * @param newParameter The newParameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, String parameter, String newParameter, Context context); + + /** + * Delete a TopLevelArmResource. + * + * @param id the resource ID. + * @param parameter The parameter parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, String parameter, Context context); + + /** + * Begins definition for a new TopLevelArmResource resource. + * + * @param name resource name. + * @return the first stage of the new TopLevelArmResource definition. + */ + TopLevelArmResource.DefinitionStages.Blank define(String name); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/package-info.java new file mode 100644 index 00000000000..aca33de66ee --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for ArmVersioned. + * Arm Resource Provider management API. + */ +package tsptest.armversioned.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/package-info.java new file mode 100644 index 00000000000..b306aaf7b89 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armversioned/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for ArmVersioned. + * Arm Resource Provider management API. + */ +package tsptest.armversioned; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinAsyncClient.java new file mode 100644 index 00000000000..d5741af7c39 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinAsyncClient.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.builtin; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; +import tsptest.builtin.implementation.BuiltinOpsImpl; +import tsptest.builtin.models.Builtin; + +/** + * Initializes a new instance of the asynchronous BuiltinClient type. + */ +@ServiceClient(builder = BuiltinClientBuilder.class, isAsync = true) +public final class BuiltinAsyncClient { + @Generated + private final BuiltinOpsImpl serviceClient; + + /** + * Initializes an instance of BuiltinAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BuiltinAsyncClient(BuiltinOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The read operation. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
query-optStringNoThe queryParamOptional parameter
query-opt-encodedStringNoThe queryParamOptionalEncoded parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
x-ms-dateOffsetDateTimeNoThe dateTime parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: boolean (Required)
+     *     string: String (Required)
+     *     bytes: byte[] (Required)
+     *     int: int (Required)
+     *     safeint: long (Required)
+     *     decimal: BigDecimal (Required)
+     *     long: long (Required)
+     *     float: double (Required)
+     *     double: double (Required)
+     *     duration: Duration (Required)
+     *     date: LocalDate (Required)
+     *     dateTime: OffsetDateTime (Required)
+     *     stringList (Required): [
+     *         String (Required)
+     *     ]
+     *     bytesDict (Required): {
+     *         String: byte[] (Required)
+     *     }
+     *     url: String (Required)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     *     encoded (Required): {
+     *         timeInSeconds: Long (Optional)
+     *         timeInSecondsFraction: Double (Optional)
+     *         dateTime: OffsetDateTime (Optional)
+     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
+     *         unixTimestamp: Long (Optional)
+     *         base64: byte[] (Optional)
+     *         base64url: Base64Url (Optional)
+     *         unknownDurationFormat: String (Optional)
+     *         unknownDateTimeFormat: String (Optional)
+     *         unknownBytes: String (Optional)
+     *         commaDeliminatedArray (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     uuid: String (Required)
+     * }
+     * }
+     * 
+ * + * @param queryParam The queryParam parameter. + * @param queryParamEncoded The queryParamEncoded parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> readWithResponse(String queryParam, String queryParamEncoded, + RequestOptions requestOptions) { + return this.serviceClient.readWithResponseAsync(queryParam, queryParamEncoded, requestOptions); + } + + /** + * The write operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: boolean (Required)
+     *     string: String (Required)
+     *     bytes: byte[] (Required)
+     *     int: int (Required)
+     *     safeint: long (Required)
+     *     decimal: BigDecimal (Required)
+     *     long: long (Required)
+     *     float: double (Required)
+     *     double: double (Required)
+     *     duration: Duration (Required)
+     *     date: LocalDate (Required)
+     *     dateTime: OffsetDateTime (Required)
+     *     stringList (Required): [
+     *         String (Required)
+     *     ]
+     *     bytesDict (Required): {
+     *         String: byte[] (Required)
+     *     }
+     *     url: String (Required)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     *     encoded (Required): {
+     *         timeInSeconds: Long (Optional)
+     *         timeInSecondsFraction: Double (Optional)
+     *         dateTime: OffsetDateTime (Optional)
+     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
+     *         unixTimestamp: Long (Optional)
+     *         base64: byte[] (Optional)
+     *         base64url: Base64Url (Optional)
+     *         unknownDurationFormat: String (Optional)
+     *         unknownDateTimeFormat: String (Optional)
+     *         unknownBytes: String (Optional)
+     *         commaDeliminatedArray (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     uuid: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> writeWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.writeWithResponseAsync(body, requestOptions); + } + + /** + * The read operation. + * + * @param queryParam The queryParam parameter. + * @param queryParamEncoded The queryParamEncoded parameter. + * @param dateTime The dateTime parameter. + * @param filter The filter parameter. + * @param queryParamOptional The queryParamOptional parameter. + * @param queryParamOptionalEncoded The queryParamOptionalEncoded parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono read(String queryParam, String queryParamEncoded, OffsetDateTime dateTime, String filter, + String queryParamOptional, String queryParamOptionalEncoded) { + // Generated convenience method for readWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (dateTime != null) { + requestOptions.setHeader(HttpHeaderName.X_MS_DATE, String.valueOf(new DateTimeRfc1123(dateTime))); + } + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + if (queryParamOptional != null) { + requestOptions.addQueryParam("query-opt", queryParamOptional, false); + } + if (queryParamOptionalEncoded != null) { + requestOptions.addQueryParam("query-opt-encoded", queryParamOptionalEncoded, true); + } + return readWithResponse(queryParam, queryParamEncoded, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Builtin.class)); + } + + /** + * The read operation. + * + * @param queryParam The queryParam parameter. + * @param queryParamEncoded The queryParamEncoded parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono read(String queryParam, String queryParamEncoded) { + // Generated convenience method for readWithResponse + RequestOptions requestOptions = new RequestOptions(); + return readWithResponse(queryParam, queryParamEncoded, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Builtin.class)); + } + + /** + * The write operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono write(Builtin body) { + // Generated convenience method for writeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return writeWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClient.java new file mode 100644 index 00000000000..bd2fb3d0c98 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClient.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.builtin; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.DateTimeRfc1123; +import java.time.OffsetDateTime; +import tsptest.builtin.implementation.BuiltinOpsImpl; +import tsptest.builtin.models.Builtin; + +/** + * Initializes a new instance of the synchronous BuiltinClient type. + */ +@ServiceClient(builder = BuiltinClientBuilder.class) +public final class BuiltinClient { + @Generated + private final BuiltinOpsImpl serviceClient; + + /** + * Initializes an instance of BuiltinClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BuiltinClient(BuiltinOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The read operation. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
query-optStringNoThe queryParamOptional parameter
query-opt-encodedStringNoThe queryParamOptionalEncoded parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
x-ms-dateOffsetDateTimeNoThe dateTime parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: boolean (Required)
+     *     string: String (Required)
+     *     bytes: byte[] (Required)
+     *     int: int (Required)
+     *     safeint: long (Required)
+     *     decimal: BigDecimal (Required)
+     *     long: long (Required)
+     *     float: double (Required)
+     *     double: double (Required)
+     *     duration: Duration (Required)
+     *     date: LocalDate (Required)
+     *     dateTime: OffsetDateTime (Required)
+     *     stringList (Required): [
+     *         String (Required)
+     *     ]
+     *     bytesDict (Required): {
+     *         String: byte[] (Required)
+     *     }
+     *     url: String (Required)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     *     encoded (Required): {
+     *         timeInSeconds: Long (Optional)
+     *         timeInSecondsFraction: Double (Optional)
+     *         dateTime: OffsetDateTime (Optional)
+     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
+     *         unixTimestamp: Long (Optional)
+     *         base64: byte[] (Optional)
+     *         base64url: Base64Url (Optional)
+     *         unknownDurationFormat: String (Optional)
+     *         unknownDateTimeFormat: String (Optional)
+     *         unknownBytes: String (Optional)
+     *         commaDeliminatedArray (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     uuid: String (Required)
+     * }
+     * }
+     * 
+ * + * @param queryParam The queryParam parameter. + * @param queryParamEncoded The queryParamEncoded parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response readWithResponse(String queryParam, String queryParamEncoded, + RequestOptions requestOptions) { + return this.serviceClient.readWithResponse(queryParam, queryParamEncoded, requestOptions); + } + + /** + * The write operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: boolean (Required)
+     *     string: String (Required)
+     *     bytes: byte[] (Required)
+     *     int: int (Required)
+     *     safeint: long (Required)
+     *     decimal: BigDecimal (Required)
+     *     long: long (Required)
+     *     float: double (Required)
+     *     double: double (Required)
+     *     duration: Duration (Required)
+     *     date: LocalDate (Required)
+     *     dateTime: OffsetDateTime (Required)
+     *     stringList (Required): [
+     *         String (Required)
+     *     ]
+     *     bytesDict (Required): {
+     *         String: byte[] (Required)
+     *     }
+     *     url: String (Required)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     *     encoded (Required): {
+     *         timeInSeconds: Long (Optional)
+     *         timeInSecondsFraction: Double (Optional)
+     *         dateTime: OffsetDateTime (Optional)
+     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
+     *         unixTimestamp: Long (Optional)
+     *         base64: byte[] (Optional)
+     *         base64url: Base64Url (Optional)
+     *         unknownDurationFormat: String (Optional)
+     *         unknownDateTimeFormat: String (Optional)
+     *         unknownBytes: String (Optional)
+     *         commaDeliminatedArray (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     uuid: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response writeWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.writeWithResponse(body, requestOptions); + } + + /** + * The read operation. + * + * @param queryParam The queryParam parameter. + * @param queryParamEncoded The queryParamEncoded parameter. + * @param dateTime The dateTime parameter. + * @param filter The filter parameter. + * @param queryParamOptional The queryParamOptional parameter. + * @param queryParamOptionalEncoded The queryParamOptionalEncoded parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Builtin read(String queryParam, String queryParamEncoded, OffsetDateTime dateTime, String filter, + String queryParamOptional, String queryParamOptionalEncoded) { + // Generated convenience method for readWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (dateTime != null) { + requestOptions.setHeader(HttpHeaderName.X_MS_DATE, String.valueOf(new DateTimeRfc1123(dateTime))); + } + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + if (queryParamOptional != null) { + requestOptions.addQueryParam("query-opt", queryParamOptional, false); + } + if (queryParamOptionalEncoded != null) { + requestOptions.addQueryParam("query-opt-encoded", queryParamOptionalEncoded, true); + } + return readWithResponse(queryParam, queryParamEncoded, requestOptions).getValue().toObject(Builtin.class); + } + + /** + * The read operation. + * + * @param queryParam The queryParam parameter. + * @param queryParamEncoded The queryParamEncoded parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Builtin read(String queryParam, String queryParamEncoded) { + // Generated convenience method for readWithResponse + RequestOptions requestOptions = new RequestOptions(); + return readWithResponse(queryParam, queryParamEncoded, requestOptions).getValue().toObject(Builtin.class); + } + + /** + * The write operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void write(Builtin body) { + // Generated convenience method for writeWithResponse + RequestOptions requestOptions = new RequestOptions(); + writeWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClientBuilder.java new file mode 100644 index 00000000000..972d64dc1d2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/BuiltinClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.builtin; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.builtin.implementation.BuiltinClientImpl; + +/** + * A builder for creating a new instance of the BuiltinClient type. + */ +@ServiceClientBuilder(serviceClients = { BuiltinClient.class, BuiltinAsyncClient.class }) +public final class BuiltinClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-builtin.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the BuiltinClientBuilder. + */ + @Generated + public BuiltinClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BuiltinClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BuiltinClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BuiltinClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BuiltinClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BuiltinClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BuiltinClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BuiltinClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BuiltinClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the BuiltinClientBuilder. + */ + @Generated + public BuiltinClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of BuiltinClientImpl with the provided parameters. + * + * @return an instance of BuiltinClientImpl. + */ + @Generated + private BuiltinClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + BuiltinClientImpl client + = new BuiltinClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of BuiltinAsyncClient class. + * + * @return an instance of BuiltinAsyncClient. + */ + @Generated + public BuiltinAsyncClient buildAsyncClient() { + return new BuiltinAsyncClient(buildInnerClient().getBuiltinOps()); + } + + /** + * Builds an instance of BuiltinClient class. + * + * @return an instance of BuiltinClient. + */ + @Generated + public BuiltinClient buildClient() { + return new BuiltinClient(buildInnerClient().getBuiltinOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(BuiltinClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinClientImpl.java new file mode 100644 index 00000000000..6623c46236b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.builtin.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 BuiltinClient type. + */ +public final class BuiltinClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 BuiltinOpsImpl object to access its operations. + */ + private final BuiltinOpsImpl builtinOps; + + /** + * Gets the BuiltinOpsImpl object to access its operations. + * + * @return the BuiltinOpsImpl object. + */ + public BuiltinOpsImpl getBuiltinOps() { + return this.builtinOps; + } + + /** + * Initializes an instance of BuiltinClient client. + * + * @param endpoint Service host. + */ + public BuiltinClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of BuiltinClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public BuiltinClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of BuiltinClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public BuiltinClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.builtinOps = new BuiltinOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinOpsImpl.java new file mode 100644 index 00000000000..009b00691a7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/BuiltinOpsImpl.java @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.builtin.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BuiltinOps. + */ +public final class BuiltinOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BuiltinOpsService service; + + /** + * The service client containing this operation class. + */ + private final BuiltinClientImpl client; + + /** + * Initializes an instance of BuiltinOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BuiltinOpsImpl(BuiltinClientImpl client) { + this.service + = RestProxy.create(BuiltinOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BuiltinClientBuiltinOps to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "BuiltinClientBuiltinOps") + public interface BuiltinOpsService { + @Get("/builtin") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> read(@HostParam("endpoint") String endpoint, @QueryParam("query") String queryParam, + @QueryParam(value = "query-encoded", encoded = true) String queryParamEncoded, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/builtin") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response readSync(@HostParam("endpoint") String endpoint, @QueryParam("query") String queryParam, + @QueryParam(value = "query-encoded", encoded = true) String queryParamEncoded, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/builtin") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> write(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/builtin") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response writeSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The read operation. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
query-optStringNoThe queryParamOptional parameter
query-opt-encodedStringNoThe queryParamOptionalEncoded parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
x-ms-dateOffsetDateTimeNoThe dateTime parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: boolean (Required)
+     *     string: String (Required)
+     *     bytes: byte[] (Required)
+     *     int: int (Required)
+     *     safeint: long (Required)
+     *     decimal: BigDecimal (Required)
+     *     long: long (Required)
+     *     float: double (Required)
+     *     double: double (Required)
+     *     duration: Duration (Required)
+     *     date: LocalDate (Required)
+     *     dateTime: OffsetDateTime (Required)
+     *     stringList (Required): [
+     *         String (Required)
+     *     ]
+     *     bytesDict (Required): {
+     *         String: byte[] (Required)
+     *     }
+     *     url: String (Required)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     *     encoded (Required): {
+     *         timeInSeconds: Long (Optional)
+     *         timeInSecondsFraction: Double (Optional)
+     *         dateTime: OffsetDateTime (Optional)
+     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
+     *         unixTimestamp: Long (Optional)
+     *         base64: byte[] (Optional)
+     *         base64url: Base64Url (Optional)
+     *         unknownDurationFormat: String (Optional)
+     *         unknownDateTimeFormat: String (Optional)
+     *         unknownBytes: String (Optional)
+     *         commaDeliminatedArray (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     uuid: String (Required)
+     * }
+     * }
+     * 
+ * + * @param queryParam The queryParam parameter. + * @param queryParamEncoded The queryParamEncoded parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> readWithResponseAsync(String queryParam, String queryParamEncoded, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.read(this.client.getEndpoint(), queryParam, queryParamEncoded, + accept, requestOptions, context)); + } + + /** + * The read operation. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
query-optStringNoThe queryParamOptional parameter
query-opt-encodedStringNoThe queryParamOptionalEncoded parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
x-ms-dateOffsetDateTimeNoThe dateTime parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: boolean (Required)
+     *     string: String (Required)
+     *     bytes: byte[] (Required)
+     *     int: int (Required)
+     *     safeint: long (Required)
+     *     decimal: BigDecimal (Required)
+     *     long: long (Required)
+     *     float: double (Required)
+     *     double: double (Required)
+     *     duration: Duration (Required)
+     *     date: LocalDate (Required)
+     *     dateTime: OffsetDateTime (Required)
+     *     stringList (Required): [
+     *         String (Required)
+     *     ]
+     *     bytesDict (Required): {
+     *         String: byte[] (Required)
+     *     }
+     *     url: String (Required)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     *     encoded (Required): {
+     *         timeInSeconds: Long (Optional)
+     *         timeInSecondsFraction: Double (Optional)
+     *         dateTime: OffsetDateTime (Optional)
+     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
+     *         unixTimestamp: Long (Optional)
+     *         base64: byte[] (Optional)
+     *         base64url: Base64Url (Optional)
+     *         unknownDurationFormat: String (Optional)
+     *         unknownDateTimeFormat: String (Optional)
+     *         unknownBytes: String (Optional)
+     *         commaDeliminatedArray (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     uuid: String (Required)
+     * }
+     * }
+     * 
+ * + * @param queryParam The queryParam parameter. + * @param queryParamEncoded The queryParamEncoded parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response readWithResponse(String queryParam, String queryParamEncoded, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.readSync(this.client.getEndpoint(), queryParam, queryParamEncoded, accept, requestOptions, + Context.NONE); + } + + /** + * The write operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: boolean (Required)
+     *     string: String (Required)
+     *     bytes: byte[] (Required)
+     *     int: int (Required)
+     *     safeint: long (Required)
+     *     decimal: BigDecimal (Required)
+     *     long: long (Required)
+     *     float: double (Required)
+     *     double: double (Required)
+     *     duration: Duration (Required)
+     *     date: LocalDate (Required)
+     *     dateTime: OffsetDateTime (Required)
+     *     stringList (Required): [
+     *         String (Required)
+     *     ]
+     *     bytesDict (Required): {
+     *         String: byte[] (Required)
+     *     }
+     *     url: String (Required)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     *     encoded (Required): {
+     *         timeInSeconds: Long (Optional)
+     *         timeInSecondsFraction: Double (Optional)
+     *         dateTime: OffsetDateTime (Optional)
+     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
+     *         unixTimestamp: Long (Optional)
+     *         base64: byte[] (Optional)
+     *         base64url: Base64Url (Optional)
+     *         unknownDurationFormat: String (Optional)
+     *         unknownDateTimeFormat: String (Optional)
+     *         unknownBytes: String (Optional)
+     *         commaDeliminatedArray (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     uuid: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> writeWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.write(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The write operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: boolean (Required)
+     *     string: String (Required)
+     *     bytes: byte[] (Required)
+     *     int: int (Required)
+     *     safeint: long (Required)
+     *     decimal: BigDecimal (Required)
+     *     long: long (Required)
+     *     float: double (Required)
+     *     double: double (Required)
+     *     duration: Duration (Required)
+     *     date: LocalDate (Required)
+     *     dateTime: OffsetDateTime (Required)
+     *     stringList (Required): [
+     *         String (Required)
+     *     ]
+     *     bytesDict (Required): {
+     *         String: byte[] (Required)
+     *     }
+     *     url: String (Required)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     *     encoded (Required): {
+     *         timeInSeconds: Long (Optional)
+     *         timeInSecondsFraction: Double (Optional)
+     *         dateTime: OffsetDateTime (Optional)
+     *         dateTimeRfc7231: DateTimeRfc1123 (Optional)
+     *         unixTimestamp: Long (Optional)
+     *         base64: byte[] (Optional)
+     *         base64url: Base64Url (Optional)
+     *         unknownDurationFormat: String (Optional)
+     *         unknownDateTimeFormat: String (Optional)
+     *         unknownBytes: String (Optional)
+     *         commaDeliminatedArray (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     uuid: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response writeWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.writeSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/package-info.java new file mode 100644 index 00000000000..6d83286025d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Builtin. + * + */ +package tsptest.builtin.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Builtin.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Builtin.java new file mode 100644 index 00000000000..00041d3f8be --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Builtin.java @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.builtin.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.Duration; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * The Builtin model. + */ +@Immutable +public final class Builtin implements JsonSerializable { + /* + * The boolean property. + */ + @Generated + private final boolean booleanProperty; + + /* + * The string property. + */ + @Generated + private final String string; + + /* + * The bytes property. + */ + @Generated + private final byte[] bytes; + + /* + * The int property. + */ + @Generated + private final int intProperty; + + /* + * The safeint property. + */ + @Generated + private final long safeint; + + /* + * The decimal property. + */ + @Generated + private final BigDecimal decimal; + + /* + * The long property. + */ + @Generated + private final long longProperty; + + /* + * The float property. + */ + @Generated + private final double floatProperty; + + /* + * The double property. + */ + @Generated + private final double doubleProperty; + + /* + * The duration property. + */ + @Generated + private final Duration duration; + + /* + * The date property. + */ + @Generated + private final LocalDate date; + + /* + * The dateTime property. + */ + @Generated + private final OffsetDateTime dateTime; + + /* + * The stringList property. + */ + @Generated + private final List stringList; + + /* + * The bytesDict property. + */ + @Generated + private final Map bytesDict; + + /* + * The url property. + */ + @Generated + private final String url; + + /* + * The nullableFloatDict property. + */ + @Generated + private final Map nullableFloatDict; + + /* + * The encoded property. + */ + @Generated + private final Encoded encoded; + + /* + * The uuid property. + */ + @Generated + private final String uuid; + + /** + * Creates an instance of Builtin class. + * + * @param booleanProperty the booleanProperty value to set. + * @param string the string value to set. + * @param bytes the bytes value to set. + * @param intProperty the intProperty value to set. + * @param safeint the safeint value to set. + * @param decimal the decimal value to set. + * @param longProperty the longProperty value to set. + * @param floatProperty the floatProperty value to set. + * @param doubleProperty the doubleProperty value to set. + * @param duration the duration value to set. + * @param date the date value to set. + * @param dateTime the dateTime value to set. + * @param stringList the stringList value to set. + * @param bytesDict the bytesDict value to set. + * @param url the url value to set. + * @param nullableFloatDict the nullableFloatDict value to set. + * @param encoded the encoded value to set. + * @param uuid the uuid value to set. + */ + @Generated + public Builtin(boolean booleanProperty, String string, byte[] bytes, int intProperty, long safeint, + BigDecimal decimal, long longProperty, double floatProperty, double doubleProperty, Duration duration, + LocalDate date, OffsetDateTime dateTime, List stringList, Map bytesDict, String url, + Map nullableFloatDict, Encoded encoded, String uuid) { + this.booleanProperty = booleanProperty; + this.string = string; + this.bytes = bytes; + this.intProperty = intProperty; + this.safeint = safeint; + this.decimal = decimal; + this.longProperty = longProperty; + this.floatProperty = floatProperty; + this.doubleProperty = doubleProperty; + this.duration = duration; + this.date = date; + this.dateTime = dateTime; + this.stringList = stringList; + this.bytesDict = bytesDict; + this.url = url; + this.nullableFloatDict = nullableFloatDict; + this.encoded = encoded; + this.uuid = uuid; + } + + /** + * Get the booleanProperty property: The boolean property. + * + * @return the booleanProperty value. + */ + @Generated + public boolean isBooleanProperty() { + return this.booleanProperty; + } + + /** + * Get the string property: The string property. + * + * @return the string value. + */ + @Generated + public String getString() { + return this.string; + } + + /** + * Get the bytes property: The bytes property. + * + * @return the bytes value. + */ + @Generated + public byte[] getBytes() { + return CoreUtils.clone(this.bytes); + } + + /** + * Get the intProperty property: The int property. + * + * @return the intProperty value. + */ + @Generated + public int getIntProperty() { + return this.intProperty; + } + + /** + * Get the safeint property: The safeint property. + * + * @return the safeint value. + */ + @Generated + public long getSafeint() { + return this.safeint; + } + + /** + * Get the decimal property: The decimal property. + * + * @return the decimal value. + */ + @Generated + public BigDecimal getDecimal() { + return this.decimal; + } + + /** + * Get the longProperty property: The long property. + * + * @return the longProperty value. + */ + @Generated + public long getLongProperty() { + return this.longProperty; + } + + /** + * Get the floatProperty property: The float property. + * + * @return the floatProperty value. + */ + @Generated + public double getFloatProperty() { + return this.floatProperty; + } + + /** + * Get the doubleProperty property: The double property. + * + * @return the doubleProperty value. + */ + @Generated + public double getDoubleProperty() { + return this.doubleProperty; + } + + /** + * Get the duration property: The duration property. + * + * @return the duration value. + */ + @Generated + public Duration getDuration() { + return this.duration; + } + + /** + * Get the date property: The date property. + * + * @return the date value. + */ + @Generated + public LocalDate getDate() { + return this.date; + } + + /** + * Get the dateTime property: The dateTime property. + * + * @return the dateTime value. + */ + @Generated + public OffsetDateTime getDateTime() { + return this.dateTime; + } + + /** + * Get the stringList property: The stringList property. + * + * @return the stringList value. + */ + @Generated + public List getStringList() { + return this.stringList; + } + + /** + * Get the bytesDict property: The bytesDict property. + * + * @return the bytesDict value. + */ + @Generated + public Map getBytesDict() { + return this.bytesDict; + } + + /** + * Get the url property: The url property. + * + * @return the url value. + */ + @Generated + public String getUrl() { + return this.url; + } + + /** + * Get the nullableFloatDict property: The nullableFloatDict property. + * + * @return the nullableFloatDict value. + */ + @Generated + public Map getNullableFloatDict() { + return this.nullableFloatDict; + } + + /** + * Get the encoded property: The encoded property. + * + * @return the encoded value. + */ + @Generated + public Encoded getEncoded() { + return this.encoded; + } + + /** + * Get the uuid property: The uuid property. + * + * @return the uuid value. + */ + @Generated + public String getUuid() { + return this.uuid; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("boolean", this.booleanProperty); + jsonWriter.writeStringField("string", this.string); + jsonWriter.writeBinaryField("bytes", this.bytes); + jsonWriter.writeIntField("int", this.intProperty); + jsonWriter.writeLongField("safeint", this.safeint); + jsonWriter.writeNumberField("decimal", this.decimal); + jsonWriter.writeLongField("long", this.longProperty); + jsonWriter.writeDoubleField("float", this.floatProperty); + jsonWriter.writeDoubleField("double", this.doubleProperty); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeStringField("date", Objects.toString(this.date, null)); + jsonWriter.writeStringField("dateTime", + this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); + jsonWriter.writeArrayField("stringList", this.stringList, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("bytesDict", this.bytesDict, (writer, element) -> writer.writeBinary(element)); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeMapField("nullableFloatDict", this.nullableFloatDict, + (writer, element) -> writer.writeNumber(element)); + jsonWriter.writeJsonField("encoded", this.encoded); + jsonWriter.writeStringField("uuid", this.uuid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Builtin from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Builtin if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Builtin. + */ + @Generated + public static Builtin fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean booleanProperty = false; + String string = null; + byte[] bytes = null; + int intProperty = 0; + long safeint = 0L; + BigDecimal decimal = null; + long longProperty = 0L; + double floatProperty = 0.0; + double doubleProperty = 0.0; + Duration duration = null; + LocalDate date = null; + OffsetDateTime dateTime = null; + List stringList = null; + Map bytesDict = null; + String url = null; + Map nullableFloatDict = null; + Encoded encoded = null; + String uuid = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("boolean".equals(fieldName)) { + booleanProperty = reader.getBoolean(); + } else if ("string".equals(fieldName)) { + string = reader.getString(); + } else if ("bytes".equals(fieldName)) { + bytes = reader.getBinary(); + } else if ("int".equals(fieldName)) { + intProperty = reader.getInt(); + } else if ("safeint".equals(fieldName)) { + safeint = reader.getLong(); + } else if ("decimal".equals(fieldName)) { + decimal = reader.getNullable(nonNullReader -> new BigDecimal(nonNullReader.getString())); + } else if ("long".equals(fieldName)) { + longProperty = reader.getLong(); + } else if ("float".equals(fieldName)) { + floatProperty = reader.getDouble(); + } else if ("double".equals(fieldName)) { + doubleProperty = reader.getDouble(); + } else if ("duration".equals(fieldName)) { + duration = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("date".equals(fieldName)) { + date = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); + } else if ("dateTime".equals(fieldName)) { + dateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("stringList".equals(fieldName)) { + stringList = reader.readArray(reader1 -> reader1.getString()); + } else if ("bytesDict".equals(fieldName)) { + bytesDict = reader.readMap(reader1 -> reader1.getBinary()); + } else if ("url".equals(fieldName)) { + url = reader.getString(); + } else if ("nullableFloatDict".equals(fieldName)) { + nullableFloatDict = reader.readMap(reader1 -> reader1.getNullable(JsonReader::getDouble)); + } else if ("encoded".equals(fieldName)) { + encoded = Encoded.fromJson(reader); + } else if ("uuid".equals(fieldName)) { + uuid = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Builtin(booleanProperty, string, bytes, intProperty, safeint, decimal, longProperty, + floatProperty, doubleProperty, duration, date, dateTime, stringList, bytesDict, url, nullableFloatDict, + encoded, uuid); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Encoded.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Encoded.java new file mode 100644 index 00000000000..47297757eac --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/Encoded.java @@ -0,0 +1,465 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.builtin.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.Base64Url; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * The Encoded model. + */ +@Fluent +public final class Encoded implements JsonSerializable { + /* + * The timeInSeconds property. + */ + @Generated + private Long timeInSeconds; + + /* + * The timeInSecondsFraction property. + */ + @Generated + private Double timeInSecondsFraction; + + /* + * The dateTime property. + */ + @Generated + private OffsetDateTime dateTime; + + /* + * The dateTimeRfc7231 property. + */ + @Generated + private DateTimeRfc1123 dateTimeRfc7231; + + /* + * The unixTimestamp property. + */ + @Generated + private Long unixTimestamp; + + /* + * The base64 property. + */ + @Generated + private byte[] base64; + + /* + * The base64url property. + */ + @Generated + private Base64Url base64url; + + /* + * The unknownDurationFormat property. + */ + @Generated + private String unknownDurationFormat; + + /* + * The unknownDateTimeFormat property. + */ + @Generated + private String unknownDateTimeFormat; + + /* + * The unknownBytes property. + */ + @Generated + private String unknownBytes; + + /* + * The commaDeliminatedArray property. + */ + @Generated + private List commaDeliminatedArray; + + /** + * Creates an instance of Encoded class. + */ + @Generated + public Encoded() { + } + + /** + * Get the timeInSeconds property: The timeInSeconds property. + * + * @return the timeInSeconds value. + */ + @Generated + public Duration getTimeInSeconds() { + if (this.timeInSeconds == null) { + return null; + } + return Duration.ofSeconds(this.timeInSeconds); + } + + /** + * Set the timeInSeconds property: The timeInSeconds property. + * + * @param timeInSeconds the timeInSeconds value to set. + * @return the Encoded object itself. + */ + @Generated + public Encoded setTimeInSeconds(Duration timeInSeconds) { + if (timeInSeconds == null) { + this.timeInSeconds = null; + } else { + this.timeInSeconds = timeInSeconds.getSeconds(); + } + return this; + } + + /** + * Get the timeInSecondsFraction property: The timeInSecondsFraction property. + * + * @return the timeInSecondsFraction value. + */ + @Generated + public Duration getTimeInSecondsFraction() { + if (this.timeInSecondsFraction == null) { + return null; + } + return Duration.ofNanos((long) (this.timeInSecondsFraction * 1000_000_000L)); + } + + /** + * Set the timeInSecondsFraction property: The timeInSecondsFraction property. + * + * @param timeInSecondsFraction the timeInSecondsFraction value to set. + * @return the Encoded object itself. + */ + @Generated + public Encoded setTimeInSecondsFraction(Duration timeInSecondsFraction) { + if (timeInSecondsFraction == null) { + this.timeInSecondsFraction = null; + } else { + this.timeInSecondsFraction = (double) timeInSecondsFraction.toNanos() / 1000_000_000L; + } + return this; + } + + /** + * Get the dateTime property: The dateTime property. + * + * @return the dateTime value. + */ + @Generated + public OffsetDateTime getDateTime() { + return this.dateTime; + } + + /** + * Set the dateTime property: The dateTime property. + * + * @param dateTime the dateTime value to set. + * @return the Encoded object itself. + */ + @Generated + public Encoded setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get the dateTimeRfc7231 property: The dateTimeRfc7231 property. + * + * @return the dateTimeRfc7231 value. + */ + @Generated + public OffsetDateTime getDateTimeRfc7231() { + if (this.dateTimeRfc7231 == null) { + return null; + } + return this.dateTimeRfc7231.getDateTime(); + } + + /** + * Set the dateTimeRfc7231 property: The dateTimeRfc7231 property. + * + * @param dateTimeRfc7231 the dateTimeRfc7231 value to set. + * @return the Encoded object itself. + */ + @Generated + public Encoded setDateTimeRfc7231(OffsetDateTime dateTimeRfc7231) { + if (dateTimeRfc7231 == null) { + this.dateTimeRfc7231 = null; + } else { + this.dateTimeRfc7231 = new DateTimeRfc1123(dateTimeRfc7231); + } + return this; + } + + /** + * Get the unixTimestamp property: The unixTimestamp property. + * + * @return the unixTimestamp value. + */ + @Generated + public OffsetDateTime getUnixTimestamp() { + if (this.unixTimestamp == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.unixTimestamp), ZoneOffset.UTC); + } + + /** + * Set the unixTimestamp property: The unixTimestamp property. + * + * @param unixTimestamp the unixTimestamp value to set. + * @return the Encoded object itself. + */ + @Generated + public Encoded setUnixTimestamp(OffsetDateTime unixTimestamp) { + if (unixTimestamp == null) { + this.unixTimestamp = null; + } else { + this.unixTimestamp = unixTimestamp.toEpochSecond(); + } + return this; + } + + /** + * Get the base64 property: The base64 property. + * + * @return the base64 value. + */ + @Generated + public byte[] getBase64() { + return CoreUtils.clone(this.base64); + } + + /** + * Set the base64 property: The base64 property. + * + * @param base64 the base64 value to set. + * @return the Encoded object itself. + */ + @Generated + public Encoded setBase64(byte[] base64) { + this.base64 = CoreUtils.clone(base64); + return this; + } + + /** + * Get the base64url property: The base64url property. + * + * @return the base64url value. + */ + @Generated + public byte[] getBase64url() { + if (this.base64url == null) { + return null; + } + return this.base64url.decodedBytes(); + } + + /** + * Set the base64url property: The base64url property. + * + * @param base64url the base64url value to set. + * @return the Encoded object itself. + */ + @Generated + public Encoded setBase64url(byte[] base64url) { + if (base64url == null) { + this.base64url = null; + } else { + this.base64url = Base64Url.encode(CoreUtils.clone(base64url)); + } + return this; + } + + /** + * Get the unknownDurationFormat property: The unknownDurationFormat property. + * + * @return the unknownDurationFormat value. + */ + @Generated + public String getUnknownDurationFormat() { + return this.unknownDurationFormat; + } + + /** + * Set the unknownDurationFormat property: The unknownDurationFormat property. + * + * @param unknownDurationFormat the unknownDurationFormat value to set. + * @return the Encoded object itself. + */ + @Generated + public Encoded setUnknownDurationFormat(String unknownDurationFormat) { + this.unknownDurationFormat = unknownDurationFormat; + return this; + } + + /** + * Get the unknownDateTimeFormat property: The unknownDateTimeFormat property. + * + * @return the unknownDateTimeFormat value. + */ + @Generated + public String getUnknownDateTimeFormat() { + return this.unknownDateTimeFormat; + } + + /** + * Set the unknownDateTimeFormat property: The unknownDateTimeFormat property. + * + * @param unknownDateTimeFormat the unknownDateTimeFormat value to set. + * @return the Encoded object itself. + */ + @Generated + public Encoded setUnknownDateTimeFormat(String unknownDateTimeFormat) { + this.unknownDateTimeFormat = unknownDateTimeFormat; + return this; + } + + /** + * Get the unknownBytes property: The unknownBytes property. + * + * @return the unknownBytes value. + */ + @Generated + public String getUnknownBytes() { + return this.unknownBytes; + } + + /** + * Set the unknownBytes property: The unknownBytes property. + * + * @param unknownBytes the unknownBytes value to set. + * @return the Encoded object itself. + */ + @Generated + public Encoded setUnknownBytes(String unknownBytes) { + this.unknownBytes = unknownBytes; + return this; + } + + /** + * Get the commaDeliminatedArray property: The commaDeliminatedArray property. + * + * @return the commaDeliminatedArray value. + */ + @Generated + public List getCommaDeliminatedArray() { + return this.commaDeliminatedArray; + } + + /** + * Set the commaDeliminatedArray property: The commaDeliminatedArray property. + * + * @param commaDeliminatedArray the commaDeliminatedArray value to set. + * @return the Encoded object itself. + */ + @Generated + public Encoded setCommaDeliminatedArray(List commaDeliminatedArray) { + this.commaDeliminatedArray = commaDeliminatedArray; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("timeInSeconds", this.timeInSeconds); + jsonWriter.writeNumberField("timeInSecondsFraction", this.timeInSecondsFraction); + jsonWriter.writeStringField("dateTime", + this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); + jsonWriter.writeStringField("dateTimeRfc7231", Objects.toString(this.dateTimeRfc7231, null)); + jsonWriter.writeNumberField("unixTimestamp", this.unixTimestamp); + jsonWriter.writeBinaryField("base64", this.base64); + jsonWriter.writeStringField("base64url", Objects.toString(this.base64url, null)); + jsonWriter.writeStringField("unknownDurationFormat", this.unknownDurationFormat); + jsonWriter.writeStringField("unknownDateTimeFormat", this.unknownDateTimeFormat); + jsonWriter.writeStringField("unknownBytes", this.unknownBytes); + if (this.commaDeliminatedArray != null) { + jsonWriter.writeStringField("commaDeliminatedArray", + this.commaDeliminatedArray.stream() + .map(element -> element == null ? "" : element) + .collect(Collectors.joining(","))); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Encoded from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Encoded if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Encoded. + */ + @Generated + public static Encoded fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Encoded deserializedEncoded = new Encoded(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timeInSeconds".equals(fieldName)) { + deserializedEncoded.timeInSeconds = reader.getNullable(JsonReader::getLong); + } else if ("timeInSecondsFraction".equals(fieldName)) { + deserializedEncoded.timeInSecondsFraction = reader.getNullable(JsonReader::getDouble); + } else if ("dateTime".equals(fieldName)) { + deserializedEncoded.dateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("dateTimeRfc7231".equals(fieldName)) { + deserializedEncoded.dateTimeRfc7231 + = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); + } else if ("unixTimestamp".equals(fieldName)) { + deserializedEncoded.unixTimestamp = reader.getNullable(JsonReader::getLong); + } else if ("base64".equals(fieldName)) { + deserializedEncoded.base64 = reader.getBinary(); + } else if ("base64url".equals(fieldName)) { + deserializedEncoded.base64url + = reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); + } else if ("unknownDurationFormat".equals(fieldName)) { + deserializedEncoded.unknownDurationFormat = reader.getString(); + } else if ("unknownDateTimeFormat".equals(fieldName)) { + deserializedEncoded.unknownDateTimeFormat = reader.getString(); + } else if ("unknownBytes".equals(fieldName)) { + deserializedEncoded.unknownBytes = reader.getString(); + } else if ("commaDeliminatedArray".equals(fieldName)) { + String commaDeliminatedArrayEncodedAsString = reader.getString(); + List commaDeliminatedArray = commaDeliminatedArrayEncodedAsString == null + ? null + : commaDeliminatedArrayEncodedAsString.isEmpty() + ? new LinkedList<>() + : new LinkedList<>(Arrays.asList(commaDeliminatedArrayEncodedAsString.split(",", -1))); + deserializedEncoded.commaDeliminatedArray = commaDeliminatedArray; + } else { + reader.skipChildren(); + } + } + + return deserializedEncoded; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/package-info.java new file mode 100644 index 00000000000..a343a91ee8a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Builtin. + * + */ +package tsptest.builtin.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/package-info.java new file mode 100644 index 00000000000..c22b26e030b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/builtin/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Builtin. + * + */ +package tsptest.builtin; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationAsyncClient.java new file mode 100644 index 00000000000..1a69c6c7479 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationAsyncClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.clientinitialization; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClient; +import tsptest.clientinitialization.implementation.ClientInitializationClientImpl; + +/** + * Initializes a new instance of the asynchronous ClientInitializationClient type. + */ +@ServiceClient(builder = ClientInitializationClientBuilder.class, isAsync = true) +public final class ClientInitializationAsyncClient { + @Generated + private final ClientInitializationClientImpl serviceClient; + + /** + * Initializes an instance of ClientInitializationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ClientInitializationAsyncClient(ClientInitializationClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Gets an instance of SubAsyncClient class. + * + * @param name The name parameter. + * @return an instance of SubAsyncClient class. + */ + public SubAsyncClient getSubAsyncClient(String name) { + return new SubAsyncClient(serviceClient.getSubClient(name)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClient.java new file mode 100644 index 00000000000..ea7cbc2f1b6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.clientinitialization; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClient; +import tsptest.clientinitialization.implementation.ClientInitializationClientImpl; + +/** + * Initializes a new instance of the synchronous ClientInitializationClient type. + */ +@ServiceClient(builder = ClientInitializationClientBuilder.class) +public final class ClientInitializationClient { + @Generated + private final ClientInitializationClientImpl serviceClient; + + /** + * Initializes an instance of ClientInitializationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ClientInitializationClient(ClientInitializationClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Gets an instance of SubClient class. + * + * @param name The name parameter. + * @return an instance of SubClient class. + */ + public SubClient getSubClient(String name) { + return new SubClient(serviceClient.getSubClient(name)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClientBuilder.java new file mode 100644 index 00000000000..94ead6fa1d3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/ClientInitializationClientBuilder.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.clientinitialization; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.clientinitialization.implementation.ClientInitializationClientImpl; + +/** + * A builder for creating a new instance of the ClientInitializationClient type. + */ +@ServiceClientBuilder( + serviceClients = { + ClientInitializationClient.class, + ClientInitializationAsyncClient.class, + SubClient.class, + SubAsyncClient.class }) +public final class ClientInitializationClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("tsptest-clientinitialization.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ClientInitializationClientBuilder. + */ + @Generated + public ClientInitializationClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientInitializationClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientInitializationClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientInitializationClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientInitializationClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientInitializationClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientInitializationClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientInitializationClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ClientInitializationClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ClientInitializationClientBuilder. + */ + @Generated + public ClientInitializationClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ClientInitializationClientImpl with the provided parameters. + * + * @return an instance of ClientInitializationClientImpl. + */ + @Generated + private ClientInitializationClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ClientInitializationClientImpl client = new ClientInitializationClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ClientInitializationAsyncClient class. + * + * @return an instance of ClientInitializationAsyncClient. + */ + @Generated + public ClientInitializationAsyncClient buildAsyncClient() { + return new ClientInitializationAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ClientInitializationClient class. + * + * @return an instance of ClientInitializationClient. + */ + @Generated + public ClientInitializationClient buildClient() { + return new ClientInitializationClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ClientInitializationClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubAsyncClient.java new file mode 100644 index 00000000000..c45a8623d20 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubAsyncClient.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.clientinitialization; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.clientinitialization.implementation.SubClientImpl; + +/** + * Initializes a new instance of the asynchronous SubClient type. + */ +@ServiceClient(builder = ClientInitializationClientBuilder.class, isAsync = true) +public final class SubAsyncClient { + @Generated + private final SubClientImpl serviceClient; + + /** + * Initializes an instance of SubAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SubAsyncClient(SubClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The action operation. + * + * @param type The type parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> actionWithResponse(String type, RequestOptions requestOptions) { + return this.serviceClient.actionWithResponseAsync(type, requestOptions); + } + + /** + * The action operation. + * + * @param type The type parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono action(String type) { + // Generated convenience method for actionWithResponse + RequestOptions requestOptions = new RequestOptions(); + return actionWithResponse(type, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubClient.java new file mode 100644 index 00000000000..999520fafd2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/SubClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.clientinitialization; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import tsptest.clientinitialization.implementation.SubClientImpl; + +/** + * Initializes a new instance of the synchronous SubClient type. + */ +@ServiceClient(builder = ClientInitializationClientBuilder.class) +public final class SubClient { + @Generated + private final SubClientImpl serviceClient; + + /** + * Initializes an instance of SubClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SubClient(SubClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The action operation. + * + * @param type The type parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response actionWithResponse(String type, RequestOptions requestOptions) { + return this.serviceClient.actionWithResponse(type, requestOptions); + } + + /** + * The action operation. + * + * @param type The type parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void action(String type) { + // Generated convenience method for actionWithResponse + RequestOptions requestOptions = new RequestOptions(); + actionWithResponse(type, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/ClientInitializationClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/ClientInitializationClientImpl.java new file mode 100644 index 00000000000..4fcf2e7b03e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/ClientInitializationClientImpl.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.clientinitialization.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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; +import java.util.Objects; + +/** + * Initializes a new instance of the ClientInitializationClient type. + */ +public final class ClientInitializationClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of ClientInitializationClient client. + * + * @param endpoint Service host. + */ + public ClientInitializationClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ClientInitializationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ClientInitializationClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ClientInitializationClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ClientInitializationClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + } + + /** + * Gets an instance of SubClientImpl class. + * + * @param name The name parameter. + * @return an instance of SubClientImpl class. + */ + public SubClientImpl getSubClient(String name) { + Objects.requireNonNull(name, "'name' cannot be null."); + return new SubClientImpl(httpPipeline, serializerAdapter, endpoint, name); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/SubClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/SubClientImpl.java new file mode 100644 index 00000000000..a7dc22f2f8d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/SubClientImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.clientinitialization.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the SubClient type. + */ +public final class SubClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SubClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + */ + private final String name; + + /** + * Gets. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * 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; + } + + /** + * Initializes an instance of SubClient client. + * + * @param endpoint Service host. + * @param name + */ + public SubClientImpl(String endpoint, String name) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name); + } + + /** + * Initializes an instance of SubClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param name + */ + public SubClientImpl(HttpPipeline httpPipeline, String endpoint, String name) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, name); + } + + /** + * Initializes an instance of SubClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param name + */ + public SubClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, String name) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.name = name; + this.service = RestProxy.create(SubClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for SubClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SubClient") + public interface SubClientService { + @Post("/client/initialization/basic/sub-client/{name}:action") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> action(@HostParam("endpoint") String endpoint, @PathParam("name") String name, + @QueryParam("type") String type, RequestOptions requestOptions, Context context); + + @Post("/client/initialization/basic/sub-client/{name}:action") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response actionSync(@HostParam("endpoint") String endpoint, @PathParam("name") String name, + @QueryParam("type") String type, RequestOptions requestOptions, Context context); + } + + /** + * The action operation. + * + * @param type The type parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> actionWithResponseAsync(String type, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.action(this.getEndpoint(), this.getName(), type, requestOptions, context)); + } + + /** + * The action operation. + * + * @param type The type parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response actionWithResponse(String type, RequestOptions requestOptions) { + return service.actionSync(this.getEndpoint(), this.getName(), type, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/package-info.java new file mode 100644 index 00000000000..2703870d89a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ClientInitialization. + * Describe client with `@clientInitialization`. + * + */ +package tsptest.clientinitialization.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/package-info.java new file mode 100644 index 00000000000..125a21a8abc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/clientinitialization/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ClientInitialization. + * Describe client with `@clientInitialization`. + * + */ +package tsptest.clientinitialization; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesAsyncClient.java new file mode 100644 index 00000000000..e73463da429 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesAsyncClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.discriminatoredgecases; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.discriminatoredgecases.implementation.DiscriminatorEdgeCasesClientImpl; +import tsptest.discriminatoredgecases.models.ChildWithAnotherDiscriminator; +import tsptest.discriminatoredgecases.models.ChildWithRequiredPropertyAsDiscriminator; + +/** + * Initializes a new instance of the asynchronous DiscriminatorEdgeCasesClient type. + */ +@ServiceClient(builder = DiscriminatorEdgeCasesClientBuilder.class, isAsync = true) +public final class DiscriminatorEdgeCasesAsyncClient { + @Generated + private final DiscriminatorEdgeCasesClientImpl serviceClient; + + /** + * Initializes an instance of DiscriminatorEdgeCasesAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DiscriminatorEdgeCasesAsyncClient(DiscriminatorEdgeCasesClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getChildRequiredDiscrim operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discriminator: String (Required)
+     *     aProperty: String (Required)
+     *     anotherProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getChildRequiredDiscrimWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getChildRequiredDiscrimWithResponseAsync(requestOptions); + } + + /** + * The getChildNewDiscrim operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discriminator: String (Required)
+     *     aProperty: String (Required)
+     *     differentDiscriminator: String (Required)
+     *     yetAnotherProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getChildNewDiscrimWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getChildNewDiscrimWithResponseAsync(requestOptions); + } + + /** + * The getChildRequiredDiscrim operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getChildRequiredDiscrim() { + // Generated convenience method for getChildRequiredDiscrimWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getChildRequiredDiscrimWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ChildWithRequiredPropertyAsDiscriminator.class)); + } + + /** + * The getChildNewDiscrim operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getChildNewDiscrim() { + // Generated convenience method for getChildNewDiscrimWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getChildNewDiscrimWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ChildWithAnotherDiscriminator.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClient.java new file mode 100644 index 00000000000..1ffb3e582e3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.discriminatoredgecases; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.discriminatoredgecases.implementation.DiscriminatorEdgeCasesClientImpl; +import tsptest.discriminatoredgecases.models.ChildWithAnotherDiscriminator; +import tsptest.discriminatoredgecases.models.ChildWithRequiredPropertyAsDiscriminator; + +/** + * Initializes a new instance of the synchronous DiscriminatorEdgeCasesClient type. + */ +@ServiceClient(builder = DiscriminatorEdgeCasesClientBuilder.class) +public final class DiscriminatorEdgeCasesClient { + @Generated + private final DiscriminatorEdgeCasesClientImpl serviceClient; + + /** + * Initializes an instance of DiscriminatorEdgeCasesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DiscriminatorEdgeCasesClient(DiscriminatorEdgeCasesClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getChildRequiredDiscrim operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discriminator: String (Required)
+     *     aProperty: String (Required)
+     *     anotherProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getChildRequiredDiscrimWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getChildRequiredDiscrimWithResponse(requestOptions); + } + + /** + * The getChildNewDiscrim operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discriminator: String (Required)
+     *     aProperty: String (Required)
+     *     differentDiscriminator: String (Required)
+     *     yetAnotherProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getChildNewDiscrimWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getChildNewDiscrimWithResponse(requestOptions); + } + + /** + * The getChildRequiredDiscrim operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ChildWithRequiredPropertyAsDiscriminator getChildRequiredDiscrim() { + // Generated convenience method for getChildRequiredDiscrimWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getChildRequiredDiscrimWithResponse(requestOptions).getValue() + .toObject(ChildWithRequiredPropertyAsDiscriminator.class); + } + + /** + * The getChildNewDiscrim operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ChildWithAnotherDiscriminator getChildNewDiscrim() { + // Generated convenience method for getChildNewDiscrimWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getChildNewDiscrimWithResponse(requestOptions).getValue().toObject(ChildWithAnotherDiscriminator.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClientBuilder.java new file mode 100644 index 00000000000..17fc6f82b57 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.discriminatoredgecases; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.discriminatoredgecases.implementation.DiscriminatorEdgeCasesClientImpl; + +/** + * A builder for creating a new instance of the DiscriminatorEdgeCasesClient type. + */ +@ServiceClientBuilder(serviceClients = { DiscriminatorEdgeCasesClient.class, DiscriminatorEdgeCasesAsyncClient.class }) +public final class DiscriminatorEdgeCasesClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("tsptest-discriminatoredgecases.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the DiscriminatorEdgeCasesClientBuilder. + */ + @Generated + public DiscriminatorEdgeCasesClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatorEdgeCasesClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatorEdgeCasesClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatorEdgeCasesClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatorEdgeCasesClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatorEdgeCasesClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatorEdgeCasesClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatorEdgeCasesClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatorEdgeCasesClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the DiscriminatorEdgeCasesClientBuilder. + */ + @Generated + public DiscriminatorEdgeCasesClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of DiscriminatorEdgeCasesClientImpl with the provided parameters. + * + * @return an instance of DiscriminatorEdgeCasesClientImpl. + */ + @Generated + private DiscriminatorEdgeCasesClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + DiscriminatorEdgeCasesClientImpl client = new DiscriminatorEdgeCasesClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of DiscriminatorEdgeCasesAsyncClient class. + * + * @return an instance of DiscriminatorEdgeCasesAsyncClient. + */ + @Generated + public DiscriminatorEdgeCasesAsyncClient buildAsyncClient() { + return new DiscriminatorEdgeCasesAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of DiscriminatorEdgeCasesClient class. + * + * @return an instance of DiscriminatorEdgeCasesClient. + */ + @Generated + public DiscriminatorEdgeCasesClient buildClient() { + return new DiscriminatorEdgeCasesClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscriminatorEdgeCasesClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/DiscriminatorEdgeCasesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/DiscriminatorEdgeCasesClientImpl.java new file mode 100644 index 00000000000..9ac447b8517 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/DiscriminatorEdgeCasesClientImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.discriminatoredgecases.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the DiscriminatorEdgeCasesClient type. + */ +public final class DiscriminatorEdgeCasesClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DiscriminatorEdgeCasesClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of DiscriminatorEdgeCasesClient client. + * + * @param endpoint Service host. + */ + public DiscriminatorEdgeCasesClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DiscriminatorEdgeCasesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public DiscriminatorEdgeCasesClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DiscriminatorEdgeCasesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public DiscriminatorEdgeCasesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(DiscriminatorEdgeCasesClientService.class, this.httpPipeline, + this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for DiscriminatorEdgeCasesClient to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscriminatorEdgeCasesClient") + public interface DiscriminatorEdgeCasesClientService { + @Get("/model/childrequireddiscrim") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getChildRequiredDiscrim(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/model/childrequireddiscrim") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getChildRequiredDiscrimSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/model/childnewdiscrim") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getChildNewDiscrim(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/model/childnewdiscrim") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getChildNewDiscrimSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * The getChildRequiredDiscrim operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discriminator: String (Required)
+     *     aProperty: String (Required)
+     *     anotherProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getChildRequiredDiscrimWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getChildRequiredDiscrim(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getChildRequiredDiscrim operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discriminator: String (Required)
+     *     aProperty: String (Required)
+     *     anotherProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getChildRequiredDiscrimWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getChildRequiredDiscrimSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getChildNewDiscrim operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discriminator: String (Required)
+     *     aProperty: String (Required)
+     *     differentDiscriminator: String (Required)
+     *     yetAnotherProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getChildNewDiscrimWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getChildNewDiscrim(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getChildNewDiscrim operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discriminator: String (Required)
+     *     aProperty: String (Required)
+     *     differentDiscriminator: String (Required)
+     *     yetAnotherProperty: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getChildNewDiscrimWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getChildNewDiscrimSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/package-info.java new file mode 100644 index 00000000000..edd1791b5df --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for DiscriminatorEdgeCases. + * + */ +package tsptest.discriminatoredgecases.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithAnotherDiscriminator.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithAnotherDiscriminator.java new file mode 100644 index 00000000000..e766b34f42a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithAnotherDiscriminator.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.discriminatoredgecases.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ChildWithAnotherDiscriminator model. + */ +@Immutable +public class ChildWithAnotherDiscriminator extends ParentWithRequiredProperty { + /* + * Discriminator property for ChildWithAnotherDiscriminator. + */ + @Generated + private String differentDiscriminator = "ChildWithAnotherDiscriminator"; + + /* + * The yetAnotherProperty property. + */ + @Generated + private final String yetAnotherProperty; + + /** + * Creates an instance of ChildWithAnotherDiscriminator class. + * + * @param discriminator the discriminator value to set. + * @param aProperty the aProperty value to set. + * @param yetAnotherProperty the yetAnotherProperty value to set. + */ + @Generated + protected ChildWithAnotherDiscriminator(String discriminator, String aProperty, String yetAnotherProperty) { + super(discriminator, aProperty); + this.yetAnotherProperty = yetAnotherProperty; + } + + /** + * Get the differentDiscriminator property: Discriminator property for ChildWithAnotherDiscriminator. + * + * @return the differentDiscriminator value. + */ + @Generated + public String getDifferentDiscriminator() { + return this.differentDiscriminator; + } + + /** + * Get the yetAnotherProperty property: The yetAnotherProperty property. + * + * @return the yetAnotherProperty value. + */ + @Generated + public String getYetAnotherProperty() { + return this.yetAnotherProperty; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("discriminator", getDiscriminator()); + jsonWriter.writeStringField("aProperty", getAProperty()); + jsonWriter.writeStringField("yetAnotherProperty", this.yetAnotherProperty); + jsonWriter.writeStringField("differentDiscriminator", this.differentDiscriminator); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChildWithAnotherDiscriminator from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChildWithAnotherDiscriminator if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ChildWithAnotherDiscriminator. + */ + @Generated + public static ChildWithAnotherDiscriminator fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("differentDiscriminator".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("anotherValue".equals(discriminatorValue)) { + return GrandChildWithAnotherDiscriminator.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static ChildWithAnotherDiscriminator fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminator = null; + String aProperty = null; + String yetAnotherProperty = null; + String differentDiscriminator = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("discriminator".equals(fieldName)) { + discriminator = reader.getString(); + } else if ("aProperty".equals(fieldName)) { + aProperty = reader.getString(); + } else if ("yetAnotherProperty".equals(fieldName)) { + yetAnotherProperty = reader.getString(); + } else if ("differentDiscriminator".equals(fieldName)) { + differentDiscriminator = reader.getString(); + } else { + reader.skipChildren(); + } + } + ChildWithAnotherDiscriminator deserializedChildWithAnotherDiscriminator + = new ChildWithAnotherDiscriminator(discriminator, aProperty, yetAnotherProperty); + deserializedChildWithAnotherDiscriminator.differentDiscriminator = differentDiscriminator; + + return deserializedChildWithAnotherDiscriminator; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithRequiredPropertyAsDiscriminator.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithRequiredPropertyAsDiscriminator.java new file mode 100644 index 00000000000..e0b4fb1f882 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ChildWithRequiredPropertyAsDiscriminator.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.discriminatoredgecases.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ChildWithRequiredPropertyAsDiscriminator model. + */ +@Immutable +public class ChildWithRequiredPropertyAsDiscriminator extends ParentWithRequiredProperty { + /* + * Discriminator property for ChildWithRequiredPropertyAsDiscriminator. + */ + @Generated + private String discriminator = "ChildWithRequiredPropertyAsDiscriminator"; + + /* + * The anotherProperty property. + */ + @Generated + private final String anotherProperty; + + /** + * Creates an instance of ChildWithRequiredPropertyAsDiscriminator class. + * + * @param discriminator the discriminator value to set. + * @param aProperty the aProperty value to set. + * @param anotherProperty the anotherProperty value to set. + */ + @Generated + protected ChildWithRequiredPropertyAsDiscriminator(String discriminator, String aProperty, String anotherProperty) { + super(discriminator, aProperty); + this.anotherProperty = anotherProperty; + } + + /** + * Get the discriminator property: Discriminator property for ChildWithRequiredPropertyAsDiscriminator. + * + * @return the discriminator value. + */ + @Generated + @Override + public String getDiscriminator() { + return this.discriminator; + } + + /** + * Get the anotherProperty property: The anotherProperty property. + * + * @return the anotherProperty value. + */ + @Generated + public String getAnotherProperty() { + return this.anotherProperty; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("aProperty", getAProperty()); + jsonWriter.writeStringField("anotherProperty", this.anotherProperty); + jsonWriter.writeStringField("discriminator", this.discriminator); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChildWithRequiredPropertyAsDiscriminator from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChildWithRequiredPropertyAsDiscriminator if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ChildWithRequiredPropertyAsDiscriminator. + */ + @Generated + public static ChildWithRequiredPropertyAsDiscriminator fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("discriminator".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("aValue".equals(discriminatorValue)) { + return GrandChildWithRequiredProperty.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static ChildWithRequiredPropertyAsDiscriminator fromJsonKnownDiscriminator(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + String aProperty = null; + String anotherProperty = null; + String discriminator = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("aProperty".equals(fieldName)) { + aProperty = reader.getString(); + } else if ("anotherProperty".equals(fieldName)) { + anotherProperty = reader.getString(); + } else if ("discriminator".equals(fieldName)) { + discriminator = reader.getString(); + } else { + reader.skipChildren(); + } + } + ChildWithRequiredPropertyAsDiscriminator deserializedChildWithRequiredPropertyAsDiscriminator + = new ChildWithRequiredPropertyAsDiscriminator(discriminator, aProperty, anotherProperty); + deserializedChildWithRequiredPropertyAsDiscriminator.discriminator = discriminator; + + return deserializedChildWithRequiredPropertyAsDiscriminator; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithAnotherDiscriminator.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithAnotherDiscriminator.java new file mode 100644 index 00000000000..6c9858dae0f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithAnotherDiscriminator.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.discriminatoredgecases.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GrandChildWithAnotherDiscriminator model. + */ +@Immutable +public final class GrandChildWithAnotherDiscriminator extends ChildWithAnotherDiscriminator { + /* + * Discriminator property for ChildWithAnotherDiscriminator. + */ + @Generated + private String differentDiscriminator = "anotherValue"; + + /** + * Creates an instance of GrandChildWithAnotherDiscriminator class. + * + * @param discriminator the discriminator value to set. + * @param aProperty the aProperty value to set. + * @param yetAnotherProperty the yetAnotherProperty value to set. + */ + @Generated + private GrandChildWithAnotherDiscriminator(String discriminator, String aProperty, String yetAnotherProperty) { + super(discriminator, aProperty, yetAnotherProperty); + } + + /** + * Get the differentDiscriminator property: Discriminator property for ChildWithAnotherDiscriminator. + * + * @return the differentDiscriminator value. + */ + @Generated + @Override + public String getDifferentDiscriminator() { + return this.differentDiscriminator; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("discriminator", getDiscriminator()); + jsonWriter.writeStringField("aProperty", getAProperty()); + jsonWriter.writeStringField("yetAnotherProperty", getYetAnotherProperty()); + jsonWriter.writeStringField("differentDiscriminator", this.differentDiscriminator); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GrandChildWithAnotherDiscriminator from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GrandChildWithAnotherDiscriminator if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GrandChildWithAnotherDiscriminator. + */ + @Generated + public static GrandChildWithAnotherDiscriminator fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminator = null; + String aProperty = null; + String yetAnotherProperty = null; + String differentDiscriminator = "anotherValue"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("discriminator".equals(fieldName)) { + discriminator = reader.getString(); + } else if ("aProperty".equals(fieldName)) { + aProperty = reader.getString(); + } else if ("yetAnotherProperty".equals(fieldName)) { + yetAnotherProperty = reader.getString(); + } else if ("differentDiscriminator".equals(fieldName)) { + differentDiscriminator = reader.getString(); + } else { + reader.skipChildren(); + } + } + GrandChildWithAnotherDiscriminator deserializedGrandChildWithAnotherDiscriminator + = new GrandChildWithAnotherDiscriminator(discriminator, aProperty, yetAnotherProperty); + deserializedGrandChildWithAnotherDiscriminator.differentDiscriminator = differentDiscriminator; + + return deserializedGrandChildWithAnotherDiscriminator; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithRequiredProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithRequiredProperty.java new file mode 100644 index 00000000000..9e475e8b9e7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithRequiredProperty.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.discriminatoredgecases.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GrandChildWithRequiredProperty model. + */ +@Immutable +public final class GrandChildWithRequiredProperty extends ChildWithRequiredPropertyAsDiscriminator { + /* + * Discriminator property for ChildWithRequiredPropertyAsDiscriminator. + */ + @Generated + private String discriminator = "aValue"; + + /** + * Creates an instance of GrandChildWithRequiredProperty class. + * + * @param discriminator the discriminator value to set. + * @param aProperty the aProperty value to set. + * @param anotherProperty the anotherProperty value to set. + */ + @Generated + private GrandChildWithRequiredProperty(String discriminator, String aProperty, String anotherProperty) { + super(discriminator, aProperty, anotherProperty); + } + + /** + * Get the discriminator property: Discriminator property for ChildWithRequiredPropertyAsDiscriminator. + * + * @return the discriminator value. + */ + @Generated + @Override + public String getDiscriminator() { + return this.discriminator; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("aProperty", getAProperty()); + jsonWriter.writeStringField("anotherProperty", getAnotherProperty()); + jsonWriter.writeStringField("discriminator", this.discriminator); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GrandChildWithRequiredProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GrandChildWithRequiredProperty if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GrandChildWithRequiredProperty. + */ + @Generated + public static GrandChildWithRequiredProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String aProperty = null; + String anotherProperty = null; + String discriminator = "aValue"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("aProperty".equals(fieldName)) { + aProperty = reader.getString(); + } else if ("anotherProperty".equals(fieldName)) { + anotherProperty = reader.getString(); + } else if ("discriminator".equals(fieldName)) { + discriminator = reader.getString(); + } else { + reader.skipChildren(); + } + } + GrandChildWithRequiredProperty deserializedGrandChildWithRequiredProperty + = new GrandChildWithRequiredProperty(discriminator, aProperty, anotherProperty); + deserializedGrandChildWithRequiredProperty.discriminator = discriminator; + + return deserializedGrandChildWithRequiredProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ParentWithRequiredProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ParentWithRequiredProperty.java new file mode 100644 index 00000000000..3bd0424d492 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/ParentWithRequiredProperty.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.discriminatoredgecases.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ParentWithRequiredProperty model. + */ +@Immutable +public class ParentWithRequiredProperty implements JsonSerializable { + /* + * The discriminator property. + */ + @Generated + private final String discriminator; + + /* + * The aProperty property. + */ + @Generated + private final String aProperty; + + /** + * Creates an instance of ParentWithRequiredProperty class. + * + * @param discriminator the discriminator value to set. + * @param aProperty the aProperty value to set. + */ + @Generated + protected ParentWithRequiredProperty(String discriminator, String aProperty) { + this.discriminator = discriminator; + this.aProperty = aProperty; + } + + /** + * Get the discriminator property: The discriminator property. + * + * @return the discriminator value. + */ + @Generated + public String getDiscriminator() { + return this.discriminator; + } + + /** + * Get the aProperty property: The aProperty property. + * + * @return the aProperty value. + */ + @Generated + public String getAProperty() { + return this.aProperty; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("discriminator", this.discriminator); + jsonWriter.writeStringField("aProperty", this.aProperty); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ParentWithRequiredProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ParentWithRequiredProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ParentWithRequiredProperty. + */ + @Generated + public static ParentWithRequiredProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminator = null; + String aProperty = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("discriminator".equals(fieldName)) { + discriminator = reader.getString(); + } else if ("aProperty".equals(fieldName)) { + aProperty = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ParentWithRequiredProperty(discriminator, aProperty); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/package-info.java new file mode 100644 index 00000000000..2d367fb9ef5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for DiscriminatorEdgeCases. + * + */ +package tsptest.discriminatoredgecases.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/package-info.java new file mode 100644 index 00000000000..79db0c56286 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/discriminatoredgecases/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for DiscriminatorEdgeCases. + * + */ +package tsptest.discriminatoredgecases; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorAsyncClient.java new file mode 100644 index 00000000000..9cef4295ee5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorAsyncClient.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumnesteddiscriminator; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.enumnesteddiscriminator.implementation.EnumNestedDiscriminatorClientImpl; +import tsptest.enumnesteddiscriminator.models.Fish; + +/** + * Initializes a new instance of the asynchronous EnumNestedDiscriminatorClient type. + */ +@ServiceClient(builder = EnumNestedDiscriminatorClientBuilder.class, isAsync = true) +public final class EnumNestedDiscriminatorAsyncClient { + @Generated + private final EnumNestedDiscriminatorClientImpl serviceClient; + + /** + * Initializes an instance of EnumNestedDiscriminatorAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnumNestedDiscriminatorAsyncClient(EnumNestedDiscriminatorClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getModelWithResponseAsync(requestOptions); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putModelWithResponseAsync(input, requestOptions); + } + + /** + * The getRecursiveModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRecursiveModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getRecursiveModelWithResponseAsync(requestOptions); + } + + /** + * The putRecursiveModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putRecursiveModelWithResponseAsync(input, requestOptions); + } + + /** + * The getMissingDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getMissingDiscriminatorWithResponseAsync(requestOptions); + } + + /** + * The getWrongDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWrongDiscriminatorWithResponseAsync(requestOptions); + } + + /** + * The getModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getModel() { + // Generated convenience method for getModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); + } + + /** + * The putModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putModel(Fish input) { + // Generated convenience method for putModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getRecursiveModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getRecursiveModel() { + // Generated convenience method for getRecursiveModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRecursiveModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); + } + + /** + * The putRecursiveModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putRecursiveModel(Fish input) { + // Generated convenience method for putRecursiveModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putRecursiveModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getMissingDiscriminator operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getMissingDiscriminator() { + // Generated convenience method for getMissingDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getMissingDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); + } + + /** + * The getWrongDiscriminator operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getWrongDiscriminator() { + // Generated convenience method for getWrongDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWrongDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClient.java new file mode 100644 index 00000000000..d301486fc39 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClient.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumnesteddiscriminator; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.enumnesteddiscriminator.implementation.EnumNestedDiscriminatorClientImpl; +import tsptest.enumnesteddiscriminator.models.Fish; + +/** + * Initializes a new instance of the synchronous EnumNestedDiscriminatorClient type. + */ +@ServiceClient(builder = EnumNestedDiscriminatorClientBuilder.class) +public final class EnumNestedDiscriminatorClient { + @Generated + private final EnumNestedDiscriminatorClientImpl serviceClient; + + /** + * Initializes an instance of EnumNestedDiscriminatorClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnumNestedDiscriminatorClient(EnumNestedDiscriminatorClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getModelWithResponse(requestOptions); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putModelWithResponse(input, requestOptions); + } + + /** + * The getRecursiveModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRecursiveModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getRecursiveModelWithResponse(requestOptions); + } + + /** + * The putRecursiveModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putRecursiveModelWithResponse(input, requestOptions); + } + + /** + * The getMissingDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getMissingDiscriminatorWithResponse(requestOptions); + } + + /** + * The getWrongDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWrongDiscriminatorWithResponse(requestOptions); + } + + /** + * The getModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Fish getModel() { + // Generated convenience method for getModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getModelWithResponse(requestOptions).getValue().toObject(Fish.class); + } + + /** + * The putModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putModel(Fish input) { + // Generated convenience method for putModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + putModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The getRecursiveModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Fish getRecursiveModel() { + // Generated convenience method for getRecursiveModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRecursiveModelWithResponse(requestOptions).getValue().toObject(Fish.class); + } + + /** + * The putRecursiveModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putRecursiveModel(Fish input) { + // Generated convenience method for putRecursiveModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + putRecursiveModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The getMissingDiscriminator operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Fish getMissingDiscriminator() { + // Generated convenience method for getMissingDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getMissingDiscriminatorWithResponse(requestOptions).getValue().toObject(Fish.class); + } + + /** + * The getWrongDiscriminator operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Fish getWrongDiscriminator() { + // Generated convenience method for getWrongDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWrongDiscriminatorWithResponse(requestOptions).getValue().toObject(Fish.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClientBuilder.java new file mode 100644 index 00000000000..853402b4618 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClientBuilder.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumnesteddiscriminator; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.enumnesteddiscriminator.implementation.EnumNestedDiscriminatorClientImpl; + +/** + * A builder for creating a new instance of the EnumNestedDiscriminatorClient type. + */ +@ServiceClientBuilder( + serviceClients = { EnumNestedDiscriminatorClient.class, EnumNestedDiscriminatorAsyncClient.class }) +public final class EnumNestedDiscriminatorClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("tsptest-enumnesteddiscriminator.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the EnumNestedDiscriminatorClientBuilder. + */ + @Generated + public EnumNestedDiscriminatorClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumNestedDiscriminatorClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumNestedDiscriminatorClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumNestedDiscriminatorClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumNestedDiscriminatorClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumNestedDiscriminatorClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumNestedDiscriminatorClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumNestedDiscriminatorClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumNestedDiscriminatorClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the EnumNestedDiscriminatorClientBuilder. + */ + @Generated + public EnumNestedDiscriminatorClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of EnumNestedDiscriminatorClientImpl with the provided parameters. + * + * @return an instance of EnumNestedDiscriminatorClientImpl. + */ + @Generated + private EnumNestedDiscriminatorClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + EnumNestedDiscriminatorClientImpl client = new EnumNestedDiscriminatorClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of EnumNestedDiscriminatorAsyncClient class. + * + * @return an instance of EnumNestedDiscriminatorAsyncClient. + */ + @Generated + public EnumNestedDiscriminatorAsyncClient buildAsyncClient() { + return new EnumNestedDiscriminatorAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of EnumNestedDiscriminatorClient class. + * + * @return an instance of EnumNestedDiscriminatorClient. + */ + @Generated + public EnumNestedDiscriminatorClient buildClient() { + return new EnumNestedDiscriminatorClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(EnumNestedDiscriminatorClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/EnumNestedDiscriminatorClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/EnumNestedDiscriminatorClientImpl.java new file mode 100644 index 00000000000..5fe19752988 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/EnumNestedDiscriminatorClientImpl.java @@ -0,0 +1,571 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumnesteddiscriminator.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the EnumNestedDiscriminatorClient type. + */ +public final class EnumNestedDiscriminatorClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EnumNestedDiscriminatorClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of EnumNestedDiscriminatorClient client. + * + * @param endpoint Service host. + */ + public EnumNestedDiscriminatorClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of EnumNestedDiscriminatorClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public EnumNestedDiscriminatorClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of EnumNestedDiscriminatorClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public EnumNestedDiscriminatorClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(EnumNestedDiscriminatorClientService.class, this.httpPipeline, + this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for EnumNestedDiscriminatorClient to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "EnumNestedDiscriminatorClient") + public interface EnumNestedDiscriminatorClientService { + @Get("/type/model/inheritance/enum-nested-discriminator/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-nested-discriminator/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getModelSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/enum-nested-discriminator/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/enum-nested-discriminator/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-nested-discriminator/recursivemodel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getRecursiveModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-nested-discriminator/recursivemodel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getRecursiveModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/enum-nested-discriminator/recursivemodel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putRecursiveModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/enum-nested-discriminator/recursivemodel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putRecursiveModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-nested-discriminator/missingdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getMissingDiscriminator(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-nested-discriminator/missingdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getMissingDiscriminatorSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-nested-discriminator/wrongdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getWrongDiscriminator(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-nested-discriminator/wrongdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getWrongDiscriminatorSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getModelWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getModel(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getModelWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.putModel(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The getRecursiveModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRecursiveModelWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getRecursiveModel(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getRecursiveModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRecursiveModelWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getRecursiveModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The putRecursiveModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putRecursiveModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putRecursiveModel(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The putRecursiveModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putRecursiveModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The getMissingDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMissingDiscriminatorWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getMissingDiscriminator(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getMissingDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getMissingDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getWrongDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWrongDiscriminatorWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getWrongDiscriminator(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getWrongDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(shark/salmon) (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getWrongDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/package-info.java new file mode 100644 index 00000000000..c074e305537 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for EnumNestedDiscriminator. + * Illustrates multiple level inheritance with multiple enum discriminators. + * + */ +package tsptest.enumnesteddiscriminator.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Fish.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Fish.java new file mode 100644 index 00000000000..d96a304171f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Fish.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumnesteddiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is base model for polymorphic multiple levels inheritance with a discriminator. + */ +@Immutable +public class Fish implements JsonSerializable { + /* + * discriminator property + */ + @Generated + private FishKind kind = FishKind.fromString("Fish"); + + /* + * The age property. + */ + @Generated + private final int age; + + /** + * Creates an instance of Fish class. + * + * @param age the age value to set. + */ + @Generated + public Fish(int age) { + this.age = age; + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + @Generated + public FishKind getKind() { + return this.kind; + } + + /** + * Get the age property: The age property. + * + * @return the age value. + */ + @Generated + public int getAge() { + return this.age; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("age", this.age); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Fish from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Fish if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Fish. + */ + @Generated + public static Fish fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("shark".equals(discriminatorValue)) { + return Shark.fromJson(readerToUse.reset()); + } else if ("salmon".equals(discriminatorValue)) { + return Salmon.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Fish fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int age = 0; + FishKind kind = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + age = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = FishKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + Fish deserializedFish = new Fish(age); + deserializedFish.kind = kind; + + return deserializedFish; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/FishKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/FishKind.java new file mode 100644 index 00000000000..77ee46df394 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/FishKind.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumnesteddiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * extensible enum type for discriminator. + */ +public final class FishKind extends ExpandableStringEnum { + /** + * The kind of fish is shark. + */ + @Generated + public static final FishKind SHARK = fromString("shark"); + + /** + * The kind of fish is salmon. + */ + @Generated + public static final FishKind SALMON = fromString("salmon"); + + /** + * Creates a new instance of FishKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public FishKind() { + } + + /** + * Creates or finds a FishKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding FishKind. + */ + @Generated + public static FishKind fromString(String name) { + return fromString(name, FishKind.class); + } + + /** + * Gets known FishKind values. + * + * @return known FishKind values. + */ + @Generated + public static Collection values() { + return values(FishKind.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/GoblinShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/GoblinShark.java new file mode 100644 index 00000000000..323da63dc43 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/GoblinShark.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumnesteddiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The third level model GoblinShark in polymorphic multiple levels inheritance. + */ +@Immutable +public final class GoblinShark extends Shark { + /* + * discriminator property + */ + @Generated + private FishKind kind = FishKind.SHARK; + + /* + * The sharktype property. + */ + @Generated + private SharkKind sharktype = SharkKind.GOBLIN; + + /** + * Creates an instance of GoblinShark class. + * + * @param age the age value to set. + */ + @Generated + public GoblinShark(int age) { + super(age); + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + @Generated + @Override + public FishKind getKind() { + return this.kind; + } + + /** + * Get the sharktype property: The sharktype property. + * + * @return the sharktype value. + */ + @Generated + @Override + public SharkKind getSharktype() { + return this.sharktype; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeIntField("age", getAge()); + jsonWriter.writeStringField("sharktype", this.sharktype == null ? null : this.sharktype.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GoblinShark from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GoblinShark if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GoblinShark. + */ + @Generated + public static GoblinShark fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int age = 0; + SharkKind sharktype = SharkKind.GOBLIN; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + age = reader.getInt(); + } else if ("sharktype".equals(fieldName)) { + sharktype = SharkKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + GoblinShark deserializedGoblinShark = new GoblinShark(age); + deserializedGoblinShark.sharktype = sharktype; + + return deserializedGoblinShark; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Salmon.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Salmon.java new file mode 100644 index 00000000000..5cc277929bf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Salmon.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumnesteddiscriminator.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic + * instances. + */ +@Fluent +public final class Salmon extends Fish { + /* + * discriminator property + */ + @Generated + private FishKind kind = FishKind.SALMON; + + /* + * The friends property. + */ + @Generated + private List friends; + + /* + * The hate property. + */ + @Generated + private Map hate; + + /* + * The partner property. + */ + @Generated + private Fish partner; + + /** + * Creates an instance of Salmon class. + * + * @param age the age value to set. + */ + @Generated + public Salmon(int age) { + super(age); + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + @Generated + @Override + public FishKind getKind() { + return this.kind; + } + + /** + * Get the friends property: The friends property. + * + * @return the friends value. + */ + @Generated + public List getFriends() { + return this.friends; + } + + /** + * Set the friends property: The friends property. + * + * @param friends the friends value to set. + * @return the Salmon object itself. + */ + @Generated + public Salmon setFriends(List friends) { + this.friends = friends; + return this; + } + + /** + * Get the hate property: The hate property. + * + * @return the hate value. + */ + @Generated + public Map getHate() { + return this.hate; + } + + /** + * Set the hate property: The hate property. + * + * @param hate the hate value to set. + * @return the Salmon object itself. + */ + @Generated + public Salmon setHate(Map hate) { + this.hate = hate; + return this; + } + + /** + * Get the partner property: The partner property. + * + * @return the partner value. + */ + @Generated + public Fish getPartner() { + return this.partner; + } + + /** + * Set the partner property: The partner property. + * + * @param partner the partner value to set. + * @return the Salmon object itself. + */ + @Generated + public Salmon setPartner(Fish partner) { + this.partner = partner; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("age", getAge()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeArrayField("friends", this.friends, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("hate", this.hate, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("partner", this.partner); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Salmon from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Salmon if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Salmon. + */ + @Generated + public static Salmon fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int age = 0; + FishKind kind = FishKind.SALMON; + List friends = null; + Map hate = null; + Fish partner = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + age = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = FishKind.fromString(reader.getString()); + } else if ("friends".equals(fieldName)) { + friends = reader.readArray(reader1 -> Fish.fromJson(reader1)); + } else if ("hate".equals(fieldName)) { + hate = reader.readMap(reader1 -> Fish.fromJson(reader1)); + } else if ("partner".equals(fieldName)) { + partner = Fish.fromJson(reader); + } else { + reader.skipChildren(); + } + } + Salmon deserializedSalmon = new Salmon(age); + deserializedSalmon.kind = kind; + deserializedSalmon.friends = friends; + deserializedSalmon.hate = hate; + deserializedSalmon.partner = partner; + + return deserializedSalmon; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SawShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SawShark.java new file mode 100644 index 00000000000..f8225d9fc6e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SawShark.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumnesteddiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The third level model SawShark in polymorphic multiple levels inheritance. + */ +@Immutable +public final class SawShark extends Shark { + /* + * discriminator property + */ + @Generated + private FishKind kind = FishKind.SHARK; + + /* + * The sharktype property. + */ + @Generated + private SharkKind sharktype = SharkKind.SAW; + + /** + * Creates an instance of SawShark class. + * + * @param age the age value to set. + */ + @Generated + public SawShark(int age) { + super(age); + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + @Generated + @Override + public FishKind getKind() { + return this.kind; + } + + /** + * Get the sharktype property: The sharktype property. + * + * @return the sharktype value. + */ + @Generated + @Override + public SharkKind getSharktype() { + return this.sharktype; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeIntField("age", getAge()); + jsonWriter.writeStringField("sharktype", this.sharktype == null ? null : this.sharktype.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SawShark from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SawShark if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SawShark. + */ + @Generated + public static SawShark fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int age = 0; + SharkKind sharktype = SharkKind.SAW; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + age = reader.getInt(); + } else if ("sharktype".equals(fieldName)) { + sharktype = SharkKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + SawShark deserializedSawShark = new SawShark(age); + deserializedSawShark.sharktype = sharktype; + + return deserializedSawShark; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Shark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Shark.java new file mode 100644 index 00000000000..f149c82c31b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/Shark.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumnesteddiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The second level model in polymorphic multiple levels inheritance and it defines a new discriminator. + */ +@Immutable +public class Shark extends Fish { + /* + * discriminator property + */ + @Generated + private FishKind kind = FishKind.SHARK; + + /* + * The sharktype property. + */ + @Generated + private SharkKind sharktype = SharkKind.fromString("shark"); + + /** + * Creates an instance of Shark class. + * + * @param age the age value to set. + */ + @Generated + public Shark(int age) { + super(age); + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + @Generated + @Override + public FishKind getKind() { + return this.kind; + } + + /** + * Get the sharktype property: The sharktype property. + * + * @return the sharktype value. + */ + @Generated + public SharkKind getSharktype() { + return this.sharktype; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeIntField("age", getAge()); + jsonWriter.writeStringField("sharktype", this.sharktype == null ? null : this.sharktype.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Shark from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Shark if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Shark. + */ + @Generated + public static Shark fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("sharktype".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("saw".equals(discriminatorValue)) { + return SawShark.fromJson(readerToUse.reset()); + } else if ("goblin".equals(discriminatorValue)) { + return GoblinShark.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Shark fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int age = 0; + SharkKind sharktype = SharkKind.fromString("shark"); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + age = reader.getInt(); + } else if ("sharktype".equals(fieldName)) { + sharktype = SharkKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + Shark deserializedShark = new Shark(age); + deserializedShark.sharktype = sharktype; + + return deserializedShark; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SharkKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SharkKind.java new file mode 100644 index 00000000000..0e7e49f3874 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/SharkKind.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumnesteddiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * extensible enum type for discriminator. + */ +public final class SharkKind extends ExpandableStringEnum { + /** + * The kind of shark is saw. + */ + @Generated + public static final SharkKind SAW = fromString("saw"); + + /** + * The kind of shark is goblin. + */ + @Generated + public static final SharkKind GOBLIN = fromString("goblin"); + + /** + * Creates a new instance of SharkKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public SharkKind() { + } + + /** + * Creates or finds a SharkKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding SharkKind. + */ + @Generated + public static SharkKind fromString(String name) { + return fromString(name, SharkKind.class); + } + + /** + * Gets known SharkKind values. + * + * @return known SharkKind values. + */ + @Generated + public static Collection values() { + return values(SharkKind.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/package-info.java new file mode 100644 index 00000000000..ab205d6c3e8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for EnumNestedDiscriminator. + * Illustrates multiple level inheritance with multiple enum discriminators. + * + */ +package tsptest.enumnesteddiscriminator.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/package-info.java new file mode 100644 index 00000000000..1390ac00a39 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumnesteddiscriminator/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for EnumNestedDiscriminator. + * Illustrates multiple level inheritance with multiple enum discriminators. + * + */ +package tsptest.enumnesteddiscriminator; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceAsyncClient.java new file mode 100644 index 00000000000..5eb297d5fdc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceAsyncClient.java @@ -0,0 +1,1045 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.CollectionFormat; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; +import tsptest.enumservice.implementation.EnumServiceClientImpl; +import tsptest.enumservice.models.Color; +import tsptest.enumservice.models.ColorModel; +import tsptest.enumservice.models.Operation; +import tsptest.enumservice.models.OperationStateValues; +import tsptest.enumservice.models.Priority; + +/** + * Initializes a new instance of the asynchronous EnumServiceClient type. + */ +@ServiceClient(builder = EnumServiceClientBuilder.class, isAsync = true) +public final class EnumServiceAsyncClient { + @Generated + private final EnumServiceClientImpl serviceClient; + + /** + * Initializes an instance of EnumServiceAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnumServiceAsyncClient(EnumServiceClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getColor operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Red/Blue/Green)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getColorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getColorWithResponseAsync(requestOptions); + } + + /** + * The getColorModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Red/Blue/Green)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getColorModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getColorModelWithResponseAsync(requestOptions); + } + + /** + * The setColorModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param color The color parameter. Allowed values: "Red", "Blue", "Green". + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setColorModelWithResponse(String color, RequestOptions requestOptions) { + return this.serviceClient.setColorModelWithResponseAsync(color, requestOptions); + } + + /** + * The setPriority operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param priority The priority parameter. Allowed values: 100, 0. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setPriorityWithResponse(String priority, RequestOptions requestOptions) { + return this.serviceClient.setPriorityWithResponseAsync(priority, requestOptions); + } + + /** + * The getRunningOperation operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRunningOperationWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getRunningOperationWithResponseAsync(requestOptions); + } + + /** + * The getOperation operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param state The state parameter. Allowed values: "Running", "Completed", "Failed". + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationWithResponse(String state, RequestOptions requestOptions) { + return this.serviceClient.getOperationWithResponseAsync(state, requestOptions); + } + + /** + * The setStringEnumArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. In the form of + * "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param colorArray The colorArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setStringEnumArrayWithResponse(List colorArray, + RequestOptions requestOptions) { + return this.serviceClient.setStringEnumArrayWithResponseAsync(colorArray, requestOptions); + } + + /** + * The setIntEnumArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. In the + * form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param priorityArray The priorityArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setIntEnumArrayWithResponse(List priorityArray, RequestOptions requestOptions) { + return this.serviceClient.setIntEnumArrayWithResponseAsync(priorityArray, requestOptions); + } + + /** + * The setStringArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. In the form of + * "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param stringArray The stringArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setStringArrayWithResponse(List stringArray, RequestOptions requestOptions) { + return this.serviceClient.setStringArrayWithResponseAsync(stringArray, requestOptions); + } + + /** + * The setIntArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. In the form of "," + * separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param intArray The intArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setIntArrayWithResponse(List intArray, RequestOptions requestOptions) { + return this.serviceClient.setIntArrayWithResponseAsync(intArray, requestOptions); + } + + /** + * The setStringEnumMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param colorArray The colorArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setStringEnumMultiWithResponse(List colorArray, RequestOptions requestOptions) { + return this.serviceClient.setStringEnumMultiWithResponseAsync(colorArray, requestOptions); + } + + /** + * The setIntEnumMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param priorityArray The priorityArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setIntEnumMultiWithResponse(List priorityArray, RequestOptions requestOptions) { + return this.serviceClient.setIntEnumMultiWithResponseAsync(priorityArray, requestOptions); + } + + /** + * The setStringMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param stringArray The stringArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setStringMultiWithResponse(List stringArray, RequestOptions requestOptions) { + return this.serviceClient.setStringMultiWithResponseAsync(stringArray, requestOptions); + } + + /** + * The setIntMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param intArray The intArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setIntMultiWithResponse(List intArray, RequestOptions requestOptions) { + return this.serviceClient.setIntMultiWithResponseAsync(intArray, requestOptions); + } + + /** + * The setStringEnumArrayHeader operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
color-array-optList<String>NoThe colorArrayOpt parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param colorArray The colorArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setStringEnumArrayHeaderWithResponse(List colorArray, + RequestOptions requestOptions) { + return this.serviceClient.setStringEnumArrayHeaderWithResponseAsync(colorArray, requestOptions); + } + + /** + * The getColor operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getColor() { + // Generated convenience method for getColorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getColorWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> Color.fromString(protocolMethodData.toObject(String.class))); + } + + /** + * The getColorModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getColorModel() { + // Generated convenience method for getColorModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getColorModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> ColorModel.fromString(protocolMethodData.toObject(String.class))); + } + + /** + * The setColorModel operation. + * + * @param color The color parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setColorModel(ColorModel color) { + // Generated convenience method for setColorModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setColorModelWithResponse(color.toString(), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Operation.class)); + } + + /** + * The setPriority operation. + * + * @param priority The priority parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setPriority(Priority priority) { + // Generated convenience method for setPriorityWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setPriorityWithResponse(String.valueOf(priority.toInt()), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Operation.class)); + } + + /** + * The getRunningOperation operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getRunningOperation() { + // Generated convenience method for getRunningOperationWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRunningOperationWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Operation.class)); + } + + /** + * The getOperation operation. + * + * @param state The state parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getOperation(OperationStateValues state) { + // Generated convenience method for getOperationWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getOperationWithResponse(state.toString(), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Operation.class)); + } + + /** + * The setStringEnumArray operation. + * + * @param colorArray The colorArray parameter. + * @param colorArrayOpt The colorArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sequence of textual characters on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setStringEnumArray(List colorArray, List colorArrayOpt) { + // Generated convenience method for setStringEnumArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (colorArrayOpt != null) { + requestOptions.addQueryParam("colorArrayOpt", + colorArrayOpt.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")), + false); + } + return setStringEnumArrayWithResponse(colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toString()); + } + + /** + * The setStringEnumArray operation. + * + * @param colorArray The colorArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sequence of textual characters on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setStringEnumArray(List colorArray) { + // Generated convenience method for setStringEnumArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setStringEnumArrayWithResponse(colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toString()); + } + + /** + * The setIntEnumArray operation. + * + * @param priorityArray The priorityArray parameter. + * @param priorityArrayOpt The priorityArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setIntEnumArray(List priorityArray, List priorityArrayOpt) { + // Generated convenience method for setIntEnumArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (priorityArrayOpt != null) { + requestOptions.addQueryParam("priorityArrayOpt", + priorityArrayOpt.stream() + .map(paramItemValue -> Objects.toString(paramItemValue == null ? null : paramItemValue.toInt(), "")) + .collect(Collectors.joining(",")), + false); + } + return setIntEnumArrayWithResponse(priorityArray.stream() + .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) + .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setIntEnumArray operation. + * + * @param priorityArray The priorityArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setIntEnumArray(List priorityArray) { + // Generated convenience method for setIntEnumArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setIntEnumArrayWithResponse(priorityArray.stream() + .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) + .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setStringArray operation. + * + * @param stringArray The stringArray parameter. + * @param stringArrayOpt The stringArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setStringArray(List stringArray, List stringArrayOpt) { + // Generated convenience method for setStringArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (stringArrayOpt != null) { + requestOptions.addQueryParam("stringArrayOpt", + stringArrayOpt.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")), + false); + } + return setStringArrayWithResponse(stringArray, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setStringArray operation. + * + * @param stringArray The stringArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setStringArray(List stringArray) { + // Generated convenience method for setStringArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setStringArrayWithResponse(stringArray, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setIntArray operation. + * + * @param intArray The intArray parameter. + * @param intArrayOpt The intArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setIntArray(List intArray, List intArrayOpt) { + // Generated convenience method for setIntArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (intArrayOpt != null) { + requestOptions.addQueryParam("intArrayOpt", + JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(intArrayOpt, CollectionFormat.CSV), + false); + } + return setIntArrayWithResponse(intArray, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setIntArray operation. + * + * @param intArray The intArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setIntArray(List intArray) { + // Generated convenience method for setIntArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setIntArrayWithResponse(intArray, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setStringEnumMulti operation. + * + * @param colorArray The colorArray parameter. + * @param colorArrayOpt The colorArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setStringEnumMulti(List colorArray, List colorArrayOpt) { + // Generated convenience method for setStringEnumMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (colorArrayOpt != null) { + for (ColorModel paramItemValue : colorArrayOpt) { + if (paramItemValue != null) { + requestOptions.addQueryParam("colorArrayOpt", paramItemValue.toString(), false); + } + } + } + return setStringEnumMultiWithResponse(colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setStringEnumMulti operation. + * + * @param colorArray The colorArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setStringEnumMulti(List colorArray) { + // Generated convenience method for setStringEnumMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setStringEnumMultiWithResponse(colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setIntEnumMulti operation. + * + * @param priorityArray The priorityArray parameter. + * @param priorityArrayOpt The priorityArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setIntEnumMulti(List priorityArray, List priorityArrayOpt) { + // Generated convenience method for setIntEnumMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (priorityArrayOpt != null) { + for (Priority paramItemValue : priorityArrayOpt) { + if (paramItemValue != null) { + requestOptions.addQueryParam("priorityArrayOpt", String.valueOf(paramItemValue.toInt()), false); + } + } + } + return setIntEnumMultiWithResponse(priorityArray.stream() + .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) + .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setIntEnumMulti operation. + * + * @param priorityArray The priorityArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setIntEnumMulti(List priorityArray) { + // Generated convenience method for setIntEnumMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setIntEnumMultiWithResponse(priorityArray.stream() + .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) + .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setStringMulti operation. + * + * @param stringArray The stringArray parameter. + * @param stringArrayOpt The stringArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setStringMulti(List stringArray, List stringArrayOpt) { + // Generated convenience method for setStringMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (stringArrayOpt != null) { + for (String paramItemValue : stringArrayOpt) { + if (paramItemValue != null) { + requestOptions.addQueryParam("stringArrayOpt", paramItemValue, false); + } + } + } + return setStringMultiWithResponse(stringArray, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setStringMulti operation. + * + * @param stringArray The stringArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setStringMulti(List stringArray) { + // Generated convenience method for setStringMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setStringMultiWithResponse(stringArray, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setIntMulti operation. + * + * @param intArray The intArray parameter. + * @param intArrayOpt The intArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setIntMulti(List intArray, List intArrayOpt) { + // Generated convenience method for setIntMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (intArrayOpt != null) { + for (int paramItemValue : intArrayOpt) { + requestOptions.addQueryParam("intArrayOpt", String.valueOf(paramItemValue), false); + } + } + return setIntMultiWithResponse(intArray, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setIntMulti operation. + * + * @param intArray The intArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setIntMulti(List intArray) { + // Generated convenience method for setIntMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setIntMultiWithResponse(intArray, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setStringEnumArrayHeader operation. + * + * @param colorArray The colorArray parameter. + * @param colorArrayOpt The colorArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setStringEnumArrayHeader(List colorArray, List colorArrayOpt) { + // Generated convenience method for setStringEnumArrayHeaderWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (colorArrayOpt != null) { + requestOptions.setHeader(HttpHeaderName.fromString("color-array-opt"), + colorArrayOpt.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(","))); + } + return setStringEnumArrayHeaderWithResponse(colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The setStringEnumArrayHeader operation. + * + * @param colorArray The colorArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setStringEnumArrayHeader(List colorArray) { + // Generated convenience method for setStringEnumArrayHeaderWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setStringEnumArrayHeaderWithResponse(colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.toList()), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClient.java new file mode 100644 index 00000000000..802a27c8802 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClient.java @@ -0,0 +1,1018 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.CollectionFormat; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import tsptest.enumservice.implementation.EnumServiceClientImpl; +import tsptest.enumservice.models.Color; +import tsptest.enumservice.models.ColorModel; +import tsptest.enumservice.models.Operation; +import tsptest.enumservice.models.OperationStateValues; +import tsptest.enumservice.models.Priority; + +/** + * Initializes a new instance of the synchronous EnumServiceClient type. + */ +@ServiceClient(builder = EnumServiceClientBuilder.class) +public final class EnumServiceClient { + @Generated + private final EnumServiceClientImpl serviceClient; + + /** + * Initializes an instance of EnumServiceClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnumServiceClient(EnumServiceClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getColor operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Red/Blue/Green)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getColorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getColorWithResponse(requestOptions); + } + + /** + * The getColorModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Red/Blue/Green)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getColorModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getColorModelWithResponse(requestOptions); + } + + /** + * The setColorModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param color The color parameter. Allowed values: "Red", "Blue", "Green". + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setColorModelWithResponse(String color, RequestOptions requestOptions) { + return this.serviceClient.setColorModelWithResponse(color, requestOptions); + } + + /** + * The setPriority operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param priority The priority parameter. Allowed values: 100, 0. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setPriorityWithResponse(String priority, RequestOptions requestOptions) { + return this.serviceClient.setPriorityWithResponse(priority, requestOptions); + } + + /** + * The getRunningOperation operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRunningOperationWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getRunningOperationWithResponse(requestOptions); + } + + /** + * The getOperation operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param state The state parameter. Allowed values: "Running", "Completed", "Failed". + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationWithResponse(String state, RequestOptions requestOptions) { + return this.serviceClient.getOperationWithResponse(state, requestOptions); + } + + /** + * The setStringEnumArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. In the form of + * "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param colorArray The colorArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setStringEnumArrayWithResponse(List colorArray, RequestOptions requestOptions) { + return this.serviceClient.setStringEnumArrayWithResponse(colorArray, requestOptions); + } + + /** + * The setIntEnumArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. In the + * form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param priorityArray The priorityArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setIntEnumArrayWithResponse(List priorityArray, RequestOptions requestOptions) { + return this.serviceClient.setIntEnumArrayWithResponse(priorityArray, requestOptions); + } + + /** + * The setStringArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. In the form of + * "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param stringArray The stringArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setStringArrayWithResponse(List stringArray, RequestOptions requestOptions) { + return this.serviceClient.setStringArrayWithResponse(stringArray, requestOptions); + } + + /** + * The setIntArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. In the form of "," + * separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param intArray The intArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setIntArrayWithResponse(List intArray, RequestOptions requestOptions) { + return this.serviceClient.setIntArrayWithResponse(intArray, requestOptions); + } + + /** + * The setStringEnumMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param colorArray The colorArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setStringEnumMultiWithResponse(List colorArray, RequestOptions requestOptions) { + return this.serviceClient.setStringEnumMultiWithResponse(colorArray, requestOptions); + } + + /** + * The setIntEnumMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param priorityArray The priorityArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setIntEnumMultiWithResponse(List priorityArray, RequestOptions requestOptions) { + return this.serviceClient.setIntEnumMultiWithResponse(priorityArray, requestOptions); + } + + /** + * The setStringMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param stringArray The stringArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setStringMultiWithResponse(List stringArray, RequestOptions requestOptions) { + return this.serviceClient.setStringMultiWithResponse(stringArray, requestOptions); + } + + /** + * The setIntMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param intArray The intArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setIntMultiWithResponse(List intArray, RequestOptions requestOptions) { + return this.serviceClient.setIntMultiWithResponse(intArray, requestOptions); + } + + /** + * The setStringEnumArrayHeader operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
color-array-optList<String>NoThe colorArrayOpt parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param colorArray The colorArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setStringEnumArrayHeaderWithResponse(List colorArray, RequestOptions requestOptions) { + return this.serviceClient.setStringEnumArrayHeaderWithResponse(colorArray, requestOptions); + } + + /** + * The getColor operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Color getColor() { + // Generated convenience method for getColorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return Color.fromString(getColorWithResponse(requestOptions).getValue().toObject(String.class)); + } + + /** + * The getColorModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ColorModel getColorModel() { + // Generated convenience method for getColorModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return ColorModel.fromString(getColorModelWithResponse(requestOptions).getValue().toObject(String.class)); + } + + /** + * The setColorModel operation. + * + * @param color The color parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Operation setColorModel(ColorModel color) { + // Generated convenience method for setColorModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setColorModelWithResponse(color.toString(), requestOptions).getValue().toObject(Operation.class); + } + + /** + * The setPriority operation. + * + * @param priority The priority parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Operation setPriority(Priority priority) { + // Generated convenience method for setPriorityWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setPriorityWithResponse(String.valueOf(priority.toInt()), requestOptions).getValue() + .toObject(Operation.class); + } + + /** + * The getRunningOperation operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Operation getRunningOperation() { + // Generated convenience method for getRunningOperationWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRunningOperationWithResponse(requestOptions).getValue().toObject(Operation.class); + } + + /** + * The getOperation operation. + * + * @param state The state parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Operation getOperation(OperationStateValues state) { + // Generated convenience method for getOperationWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getOperationWithResponse(state.toString(), requestOptions).getValue().toObject(Operation.class); + } + + /** + * The setStringEnumArray operation. + * + * @param colorArray The colorArray parameter. + * @param colorArrayOpt The colorArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sequence of textual characters. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public String setStringEnumArray(List colorArray, List colorArrayOpt) { + // Generated convenience method for setStringEnumArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (colorArrayOpt != null) { + requestOptions.addQueryParam("colorArrayOpt", + colorArrayOpt.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")), + false); + } + return setStringEnumArrayWithResponse(colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.toList()), requestOptions).getValue().toString(); + } + + /** + * The setStringEnumArray operation. + * + * @param colorArray The colorArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sequence of textual characters. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public String setStringEnumArray(List colorArray) { + // Generated convenience method for setStringEnumArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return setStringEnumArrayWithResponse(colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.toList()), requestOptions).getValue().toString(); + } + + /** + * The setIntEnumArray operation. + * + * @param priorityArray The priorityArray parameter. + * @param priorityArrayOpt The priorityArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setIntEnumArray(List priorityArray, List priorityArrayOpt) { + // Generated convenience method for setIntEnumArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (priorityArrayOpt != null) { + requestOptions.addQueryParam("priorityArrayOpt", + priorityArrayOpt.stream() + .map(paramItemValue -> Objects.toString(paramItemValue == null ? null : paramItemValue.toInt(), "")) + .collect(Collectors.joining(",")), + false); + } + setIntEnumArrayWithResponse(priorityArray.stream() + .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) + .collect(Collectors.toList()), requestOptions).getValue(); + } + + /** + * The setIntEnumArray operation. + * + * @param priorityArray The priorityArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setIntEnumArray(List priorityArray) { + // Generated convenience method for setIntEnumArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + setIntEnumArrayWithResponse(priorityArray.stream() + .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) + .collect(Collectors.toList()), requestOptions).getValue(); + } + + /** + * The setStringArray operation. + * + * @param stringArray The stringArray parameter. + * @param stringArrayOpt The stringArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setStringArray(List stringArray, List stringArrayOpt) { + // Generated convenience method for setStringArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (stringArrayOpt != null) { + requestOptions.addQueryParam("stringArrayOpt", + stringArrayOpt.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")), + false); + } + setStringArrayWithResponse(stringArray, requestOptions).getValue(); + } + + /** + * The setStringArray operation. + * + * @param stringArray The stringArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setStringArray(List stringArray) { + // Generated convenience method for setStringArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + setStringArrayWithResponse(stringArray, requestOptions).getValue(); + } + + /** + * The setIntArray operation. + * + * @param intArray The intArray parameter. + * @param intArrayOpt The intArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setIntArray(List intArray, List intArrayOpt) { + // Generated convenience method for setIntArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (intArrayOpt != null) { + requestOptions.addQueryParam("intArrayOpt", + JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(intArrayOpt, CollectionFormat.CSV), + false); + } + setIntArrayWithResponse(intArray, requestOptions).getValue(); + } + + /** + * The setIntArray operation. + * + * @param intArray The intArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setIntArray(List intArray) { + // Generated convenience method for setIntArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + setIntArrayWithResponse(intArray, requestOptions).getValue(); + } + + /** + * The setStringEnumMulti operation. + * + * @param colorArray The colorArray parameter. + * @param colorArrayOpt The colorArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setStringEnumMulti(List colorArray, List colorArrayOpt) { + // Generated convenience method for setStringEnumMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (colorArrayOpt != null) { + for (ColorModel paramItemValue : colorArrayOpt) { + if (paramItemValue != null) { + requestOptions.addQueryParam("colorArrayOpt", paramItemValue.toString(), false); + } + } + } + setStringEnumMultiWithResponse(colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.toList()), requestOptions).getValue(); + } + + /** + * The setStringEnumMulti operation. + * + * @param colorArray The colorArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setStringEnumMulti(List colorArray) { + // Generated convenience method for setStringEnumMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + setStringEnumMultiWithResponse(colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.toList()), requestOptions).getValue(); + } + + /** + * The setIntEnumMulti operation. + * + * @param priorityArray The priorityArray parameter. + * @param priorityArrayOpt The priorityArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setIntEnumMulti(List priorityArray, List priorityArrayOpt) { + // Generated convenience method for setIntEnumMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (priorityArrayOpt != null) { + for (Priority paramItemValue : priorityArrayOpt) { + if (paramItemValue != null) { + requestOptions.addQueryParam("priorityArrayOpt", String.valueOf(paramItemValue.toInt()), false); + } + } + } + setIntEnumMultiWithResponse(priorityArray.stream() + .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) + .collect(Collectors.toList()), requestOptions).getValue(); + } + + /** + * The setIntEnumMulti operation. + * + * @param priorityArray The priorityArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setIntEnumMulti(List priorityArray) { + // Generated convenience method for setIntEnumMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + setIntEnumMultiWithResponse(priorityArray.stream() + .map(paramItemValue -> paramItemValue == null ? "" : String.valueOf(paramItemValue.toInt())) + .collect(Collectors.toList()), requestOptions).getValue(); + } + + /** + * The setStringMulti operation. + * + * @param stringArray The stringArray parameter. + * @param stringArrayOpt The stringArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setStringMulti(List stringArray, List stringArrayOpt) { + // Generated convenience method for setStringMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (stringArrayOpt != null) { + for (String paramItemValue : stringArrayOpt) { + if (paramItemValue != null) { + requestOptions.addQueryParam("stringArrayOpt", paramItemValue, false); + } + } + } + setStringMultiWithResponse(stringArray, requestOptions).getValue(); + } + + /** + * The setStringMulti operation. + * + * @param stringArray The stringArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setStringMulti(List stringArray) { + // Generated convenience method for setStringMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + setStringMultiWithResponse(stringArray, requestOptions).getValue(); + } + + /** + * The setIntMulti operation. + * + * @param intArray The intArray parameter. + * @param intArrayOpt The intArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setIntMulti(List intArray, List intArrayOpt) { + // Generated convenience method for setIntMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (intArrayOpt != null) { + for (int paramItemValue : intArrayOpt) { + requestOptions.addQueryParam("intArrayOpt", String.valueOf(paramItemValue), false); + } + } + setIntMultiWithResponse(intArray, requestOptions).getValue(); + } + + /** + * The setIntMulti operation. + * + * @param intArray The intArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setIntMulti(List intArray) { + // Generated convenience method for setIntMultiWithResponse + RequestOptions requestOptions = new RequestOptions(); + setIntMultiWithResponse(intArray, requestOptions).getValue(); + } + + /** + * The setStringEnumArrayHeader operation. + * + * @param colorArray The colorArray parameter. + * @param colorArrayOpt The colorArrayOpt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setStringEnumArrayHeader(List colorArray, List colorArrayOpt) { + // Generated convenience method for setStringEnumArrayHeaderWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (colorArrayOpt != null) { + requestOptions.setHeader(HttpHeaderName.fromString("color-array-opt"), + colorArrayOpt.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(","))); + } + setStringEnumArrayHeaderWithResponse(colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.toList()), requestOptions).getValue(); + } + + /** + * The setStringEnumArrayHeader operation. + * + * @param colorArray The colorArray parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void setStringEnumArrayHeader(List colorArray) { + // Generated convenience method for setStringEnumArrayHeaderWithResponse + RequestOptions requestOptions = new RequestOptions(); + setStringEnumArrayHeaderWithResponse(colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.toList()), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClientBuilder.java new file mode 100644 index 00000000000..8fbd1e16dc5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/EnumServiceClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.enumservice.implementation.EnumServiceClientImpl; + +/** + * A builder for creating a new instance of the EnumServiceClient type. + */ +@ServiceClientBuilder(serviceClients = { EnumServiceClient.class, EnumServiceAsyncClient.class }) +public final class EnumServiceClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-enumservice.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the EnumServiceClientBuilder. + */ + @Generated + public EnumServiceClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumServiceClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumServiceClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumServiceClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumServiceClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumServiceClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumServiceClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumServiceClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumServiceClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the EnumServiceClientBuilder. + */ + @Generated + public EnumServiceClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of EnumServiceClientImpl with the provided parameters. + * + * @return an instance of EnumServiceClientImpl. + */ + @Generated + private EnumServiceClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + EnumServiceClientImpl client + = new EnumServiceClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of EnumServiceAsyncClient class. + * + * @return an instance of EnumServiceAsyncClient. + */ + @Generated + public EnumServiceAsyncClient buildAsyncClient() { + return new EnumServiceAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of EnumServiceClient class. + * + * @return an instance of EnumServiceClient. + */ + @Generated + public EnumServiceClient buildClient() { + return new EnumServiceClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(EnumServiceClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/EnumServiceClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/EnumServiceClientImpl.java new file mode 100644 index 00000000000..fce35a37c7a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/EnumServiceClientImpl.java @@ -0,0 +1,1320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.CollectionFormat; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the EnumServiceClient type. + */ +public final class EnumServiceClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EnumServiceClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of EnumServiceClient client. + * + * @param endpoint Service host. + */ + public EnumServiceClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of EnumServiceClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public EnumServiceClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of EnumServiceClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public EnumServiceClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(EnumServiceClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for EnumServiceClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "EnumServiceClient") + public interface EnumServiceClientService { + @Get("/enum/color") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getColor(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/enum/color") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getColorSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/enum/colormodel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getColorModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/enum/colormodel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getColorModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/enum/operation/colormodel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setColorModel(@HostParam("endpoint") String endpoint, + @QueryParam("color") String color, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Post("/enum/operation/colormodel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setColorModelSync(@HostParam("endpoint") String endpoint, + @QueryParam("color") String color, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Post("/enum/operation/priority") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setPriority(@HostParam("endpoint") String endpoint, + @QueryParam("priority") String priority, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/enum/operation/priority") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setPrioritySync(@HostParam("endpoint") String endpoint, + @QueryParam("priority") String priority, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/enum/operation/state/running") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getRunningOperation(@HostParam("endpoint") String endpoint, + @QueryParam("state") String state, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/enum/operation/state/running") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getRunningOperationSync(@HostParam("endpoint") String endpoint, + @QueryParam("state") String state, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/enum/operation/state") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getOperation(@HostParam("endpoint") String endpoint, + @QueryParam("state") String state, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("/enum/operation/state") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getOperationSync(@HostParam("endpoint") String endpoint, @QueryParam("state") String state, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/enum/operation/stringenumarray") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setStringEnumArray(@HostParam("endpoint") String endpoint, + @QueryParam("colorArray") String colorArray, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/enum/operation/stringenumarray") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setStringEnumArraySync(@HostParam("endpoint") String endpoint, + @QueryParam("colorArray") String colorArray, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/enum/operation/intenumarray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setIntEnumArray(@HostParam("endpoint") String endpoint, + @QueryParam("priorityArray") String priorityArray, RequestOptions requestOptions, Context context); + + @Post("/enum/operation/intenumarray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setIntEnumArraySync(@HostParam("endpoint") String endpoint, + @QueryParam("priorityArray") String priorityArray, RequestOptions requestOptions, Context context); + + @Post("/enum/operation/stringarray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setStringArray(@HostParam("endpoint") String endpoint, + @QueryParam("stringArray") String stringArray, RequestOptions requestOptions, Context context); + + @Post("/enum/operation/stringarray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setStringArraySync(@HostParam("endpoint") String endpoint, + @QueryParam("stringArray") String stringArray, RequestOptions requestOptions, Context context); + + @Post("/enum/operation/intarray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setIntArray(@HostParam("endpoint") String endpoint, + @QueryParam("intArray") String intArray, RequestOptions requestOptions, Context context); + + @Post("/enum/operation/intarray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setIntArraySync(@HostParam("endpoint") String endpoint, @QueryParam("intArray") String intArray, + RequestOptions requestOptions, Context context); + + @Post("/enum/operation/stringenummulti") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setStringEnumMulti(@HostParam("endpoint") String endpoint, + @QueryParam(value = "colorArray", multipleQueryParams = true) List colorArray, + RequestOptions requestOptions, Context context); + + @Post("/enum/operation/stringenummulti") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setStringEnumMultiSync(@HostParam("endpoint") String endpoint, + @QueryParam(value = "colorArray", multipleQueryParams = true) List colorArray, + RequestOptions requestOptions, Context context); + + @Post("/enum/operation/intenummulti") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setIntEnumMulti(@HostParam("endpoint") String endpoint, + @QueryParam(value = "priorityArray", multipleQueryParams = true) List priorityArray, + RequestOptions requestOptions, Context context); + + @Post("/enum/operation/intenummulti") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setIntEnumMultiSync(@HostParam("endpoint") String endpoint, + @QueryParam(value = "priorityArray", multipleQueryParams = true) List priorityArray, + RequestOptions requestOptions, Context context); + + @Post("/enum/operation/stringmulti") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setStringMulti(@HostParam("endpoint") String endpoint, + @QueryParam(value = "stringArray", multipleQueryParams = true) List stringArray, + RequestOptions requestOptions, Context context); + + @Post("/enum/operation/stringmulti") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setStringMultiSync(@HostParam("endpoint") String endpoint, + @QueryParam(value = "stringArray", multipleQueryParams = true) List stringArray, + RequestOptions requestOptions, Context context); + + @Post("/enum/operation/intmulti") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setIntMulti(@HostParam("endpoint") String endpoint, + @QueryParam(value = "intArray", multipleQueryParams = true) List intArray, + RequestOptions requestOptions, Context context); + + @Post("/enum/operation/intmulti") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setIntMultiSync(@HostParam("endpoint") String endpoint, + @QueryParam(value = "intArray", multipleQueryParams = true) List intArray, + RequestOptions requestOptions, Context context); + + @Post("/enum/operation/stringenumarrayheader") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setStringEnumArrayHeader(@HostParam("endpoint") String endpoint, + @HeaderParam("color-array") String colorArray, RequestOptions requestOptions, Context context); + + @Post("/enum/operation/stringenumarrayheader") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setStringEnumArrayHeaderSync(@HostParam("endpoint") String endpoint, + @HeaderParam("color-array") String colorArray, RequestOptions requestOptions, Context context); + } + + /** + * The getColor operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Red/Blue/Green)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getColorWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getColor(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getColor operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Red/Blue/Green)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getColorWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getColorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getColorModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Red/Blue/Green)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getColorModelWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getColorModel(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getColorModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Red/Blue/Green)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getColorModelWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getColorModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The setColorModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param color The color parameter. Allowed values: "Red", "Blue", "Green". + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setColorModelWithResponseAsync(String color, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.setColorModel(this.getEndpoint(), color, accept, requestOptions, context)); + } + + /** + * The setColorModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param color The color parameter. Allowed values: "Red", "Blue", "Green". + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setColorModelWithResponse(String color, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.setColorModelSync(this.getEndpoint(), color, accept, requestOptions, Context.NONE); + } + + /** + * The setPriority operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param priority The priority parameter. Allowed values: 100, 0. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setPriorityWithResponseAsync(String priority, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.setPriority(this.getEndpoint(), priority, accept, requestOptions, context)); + } + + /** + * The setPriority operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param priority The priority parameter. Allowed values: 100, 0. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setPriorityWithResponse(String priority, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.setPrioritySync(this.getEndpoint(), priority, accept, requestOptions, Context.NONE); + } + + /** + * The getRunningOperation operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRunningOperationWithResponseAsync(RequestOptions requestOptions) { + final String state = "Running"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getRunningOperation(this.getEndpoint(), state, accept, requestOptions, context)); + } + + /** + * The getRunningOperation operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRunningOperationWithResponse(RequestOptions requestOptions) { + final String state = "Running"; + final String accept = "application/json"; + return service.getRunningOperationSync(this.getEndpoint(), state, accept, requestOptions, Context.NONE); + } + + /** + * The getOperation operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param state The state parameter. Allowed values: "Running", "Completed", "Failed". + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationWithResponseAsync(String state, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getOperation(this.getEndpoint(), state, accept, requestOptions, context)); + } + + /** + * The getOperation operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String(Read/Write) (Required)
+     *     best: boolean (Required)
+     *     age: int (Required)
+     *     priority: String(100/0) (Required)
+     *     color: String(Red/Blue/Green) (Required)
+     *     unit: String(1/0.001/1000) (Required)
+     *     priorityValue: String(100/0) (Required)
+     *     colorValue: String(Red/Blue/Green) (Required)
+     *     colorModelValue: String(Red/Blue/Green) (Required)
+     *     unitValue: String(1/0.001/1000) (Optional)
+     *     olympicRecord: String(9.58/19.3) (Optional)
+     *     olympicRecordValue: String(9.58/19.3) (Optional)
+     * }
+     * }
+     * 
+ * + * @param state The state parameter. Allowed values: "Running", "Completed", "Failed". + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationWithResponse(String state, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getOperationSync(this.getEndpoint(), state, accept, requestOptions, Context.NONE); + } + + /** + * The setStringEnumArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. In the form of + * "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param colorArray The colorArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setStringEnumArrayWithResponseAsync(List colorArray, + RequestOptions requestOptions) { + final String accept = "text/plain"; + String colorArrayConverted = colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil.withContext(context -> service.setStringEnumArray(this.getEndpoint(), colorArrayConverted, + accept, requestOptions, context)); + } + + /** + * The setStringEnumArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. In the form of + * "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param colorArray The colorArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setStringEnumArrayWithResponse(List colorArray, RequestOptions requestOptions) { + final String accept = "text/plain"; + String colorArrayConverted = colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.setStringEnumArraySync(this.getEndpoint(), colorArrayConverted, accept, requestOptions, + Context.NONE); + } + + /** + * The setIntEnumArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. In the + * form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param priorityArray The priorityArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setIntEnumArrayWithResponseAsync(List priorityArray, + RequestOptions requestOptions) { + String priorityArrayConverted = priorityArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil.withContext( + context -> service.setIntEnumArray(this.getEndpoint(), priorityArrayConverted, requestOptions, context)); + } + + /** + * The setIntEnumArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. In the + * form of "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param priorityArray The priorityArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setIntEnumArrayWithResponse(List priorityArray, RequestOptions requestOptions) { + String priorityArrayConverted = priorityArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.setIntEnumArraySync(this.getEndpoint(), priorityArrayConverted, requestOptions, Context.NONE); + } + + /** + * The setStringArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. In the form of + * "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param stringArray The stringArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setStringArrayWithResponseAsync(List stringArray, + RequestOptions requestOptions) { + String stringArrayConverted = stringArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil.withContext( + context -> service.setStringArray(this.getEndpoint(), stringArrayConverted, requestOptions, context)); + } + + /** + * The setStringArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. In the form of + * "," separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param stringArray The stringArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setStringArrayWithResponse(List stringArray, RequestOptions requestOptions) { + String stringArrayConverted = stringArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.setStringArraySync(this.getEndpoint(), stringArrayConverted, requestOptions, Context.NONE); + } + + /** + * The setIntArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. In the form of "," + * separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param intArray The intArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setIntArrayWithResponseAsync(List intArray, RequestOptions requestOptions) { + String intArrayConverted + = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(intArray, CollectionFormat.CSV); + return FluxUtil.withContext( + context -> service.setIntArray(this.getEndpoint(), intArrayConverted, requestOptions, context)); + } + + /** + * The setIntArray operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. In the form of "," + * separated string.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param intArray The intArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setIntArrayWithResponse(List intArray, RequestOptions requestOptions) { + String intArrayConverted + = JacksonAdapter.createDefaultSerializerAdapter().serializeIterable(intArray, CollectionFormat.CSV); + return service.setIntArraySync(this.getEndpoint(), intArrayConverted, requestOptions, Context.NONE); + } + + /** + * The setStringEnumMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param colorArray The colorArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setStringEnumMultiWithResponseAsync(List colorArray, + RequestOptions requestOptions) { + List colorArrayConverted + = colorArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return FluxUtil.withContext( + context -> service.setStringEnumMulti(this.getEndpoint(), colorArrayConverted, requestOptions, context)); + } + + /** + * The setStringEnumMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
colorArrayOptList<String>NoThe colorArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param colorArray The colorArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setStringEnumMultiWithResponse(List colorArray, RequestOptions requestOptions) { + List colorArrayConverted + = colorArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return service.setStringEnumMultiSync(this.getEndpoint(), colorArrayConverted, requestOptions, Context.NONE); + } + + /** + * The setIntEnumMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param priorityArray The priorityArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setIntEnumMultiWithResponseAsync(List priorityArray, + RequestOptions requestOptions) { + List priorityArrayConverted + = priorityArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return FluxUtil.withContext( + context -> service.setIntEnumMulti(this.getEndpoint(), priorityArrayConverted, requestOptions, context)); + } + + /** + * The setIntEnumMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
priorityArrayOptList<String>NoThe priorityArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param priorityArray The priorityArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setIntEnumMultiWithResponse(List priorityArray, RequestOptions requestOptions) { + List priorityArrayConverted + = priorityArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return service.setIntEnumMultiSync(this.getEndpoint(), priorityArrayConverted, requestOptions, Context.NONE); + } + + /** + * The setStringMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param stringArray The stringArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setStringMultiWithResponseAsync(List stringArray, + RequestOptions requestOptions) { + List stringArrayConverted + = stringArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return FluxUtil.withContext( + context -> service.setStringMulti(this.getEndpoint(), stringArrayConverted, requestOptions, context)); + } + + /** + * The setStringMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
stringArrayOptList<String>NoThe stringArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param stringArray The stringArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setStringMultiWithResponse(List stringArray, RequestOptions requestOptions) { + List stringArrayConverted + = stringArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return service.setStringMultiSync(this.getEndpoint(), stringArrayConverted, requestOptions, Context.NONE); + } + + /** + * The setIntMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param intArray The intArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setIntMultiWithResponseAsync(List intArray, RequestOptions requestOptions) { + List intArrayConverted + = intArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return FluxUtil.withContext( + context -> service.setIntMulti(this.getEndpoint(), intArrayConverted, requestOptions, context)); + } + + /** + * The setIntMulti operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
intArrayOptList<Integer>NoThe intArrayOpt parameter. Call + * {@link RequestOptions#addQueryParam} to add string to array.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param intArray The intArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setIntMultiWithResponse(List intArray, RequestOptions requestOptions) { + List intArrayConverted + = intArray.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return service.setIntMultiSync(this.getEndpoint(), intArrayConverted, requestOptions, Context.NONE); + } + + /** + * The setStringEnumArrayHeader operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
color-array-optList<String>NoThe colorArrayOpt parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param colorArray The colorArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> setStringEnumArrayHeaderWithResponseAsync(List colorArray, + RequestOptions requestOptions) { + String colorArrayConverted = colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return FluxUtil.withContext(context -> service.setStringEnumArrayHeader(this.getEndpoint(), colorArrayConverted, + requestOptions, context)); + } + + /** + * The setStringEnumArrayHeader operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
color-array-optList<String>NoThe colorArrayOpt parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + * + * @param colorArray The colorArray parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setStringEnumArrayHeaderWithResponse(List colorArray, RequestOptions requestOptions) { + String colorArrayConverted = colorArray.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); + return service.setStringEnumArrayHeaderSync(this.getEndpoint(), colorArrayConverted, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/package-info.java new file mode 100644 index 00000000000..8d9a6e28ed1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for EnumService. + * + */ +package tsptest.enumservice.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Color.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Color.java new file mode 100644 index 00000000000..469177340e7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Color.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice.models; + +/** + * Defines values for Color. + */ +public enum Color { + /** + * Enum value Red. + */ + RED("Red"), + + /** + * Enum value Blue. + */ + BLUE("Blue"), + + /** + * Enum value Green. + */ + GREEN("Green"); + + /** + * The actual serialized value for a Color instance. + */ + private final String value; + + Color(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Color instance. + * + * @param value the serialized value to parse. + * @return the parsed Color object, or null if unable to parse. + */ + public static Color fromString(String value) { + if (value == null) { + return null; + } + Color[] items = Color.values(); + for (Color item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/ColorModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/ColorModel.java new file mode 100644 index 00000000000..d7059837782 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/ColorModel.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ColorModel. + */ +public final class ColorModel extends ExpandableStringEnum { + /** + * Static value Red for ColorModel. + */ + @Generated + public static final ColorModel RED = fromString("Red"); + + /** + * Static value Blue for ColorModel. + */ + @Generated + public static final ColorModel BLUE = fromString("Blue"); + + /** + * Static value Green for ColorModel. + */ + @Generated + public static final ColorModel GREEN = fromString("Green"); + + /** + * Creates a new instance of ColorModel value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ColorModel() { + } + + /** + * Creates or finds a ColorModel from its string representation. + * + * @param name a name to look for. + * @return the corresponding ColorModel. + */ + @Generated + public static ColorModel fromString(String name) { + return fromString(name, ColorModel.class); + } + + /** + * Gets known ColorModel values. + * + * @return known ColorModel values. + */ + @Generated + public static Collection values() { + return values(ColorModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OlympicRecordModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OlympicRecordModel.java new file mode 100644 index 00000000000..a2e5bcc4c82 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OlympicRecordModel.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableEnum; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Defines values for OlympicRecordModel. + */ +public final class OlympicRecordModel implements ExpandableEnum, JsonSerializable { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = OlympicRecordModel::new; + + /** + * Static value 9.58 for OlympicRecordModel. + */ + @Generated + public static final OlympicRecordModel OLYMPIC_100_METERS = fromValue(9.58); + + /** + * Static value 19.3 for OlympicRecordModel. + */ + @Generated + public static final OlympicRecordModel OLYMPIC_200_METERS = fromValue(19.3); + + private final Double value; + + private OlympicRecordModel(Double value) { + this.value = value; + } + + /** + * Creates or finds a OlympicRecordModel. + * + * @param value a value to look for. + * @return the corresponding OlympicRecordModel. + * @throws IllegalArgumentException if value is null. + */ + @Generated + public static OlympicRecordModel fromValue(Double value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known OlympicRecordModel values. + * + * @return Known OlympicRecordModel values. + */ + @Generated + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the OlympicRecordModel instance. + * + * @return the value of the OlympicRecordModel instance. + */ + @Generated + @Override + public Double getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + return jsonWriter.writeDouble(getValue()); + } + + /** + * Reads an instance of OlympicRecordModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OlympicRecordModel if the JsonReader was pointing to an instance of it, or null if the + * JsonReader was pointing to JSON null. + * @throws IOException If an error occurs while reading the OlympicRecordModel. + * @throws IllegalStateException If unexpected JSON token is found. + */ + @Generated + public static OlympicRecordModel fromJson(JsonReader jsonReader) throws IOException { + JsonToken nextToken = jsonReader.nextToken(); + if (nextToken == JsonToken.NULL) { + return null; + } + if (nextToken != JsonToken.NUMBER) { + throw new IllegalStateException( + String.format("Unexpected JSON token for %s deserialization: %s", JsonToken.NUMBER, nextToken)); + } + return OlympicRecordModel.fromValue(jsonReader.getDouble()); + } + + @Generated + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Generated + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Generated + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Operation.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Operation.java new file mode 100644 index 00000000000..81d93ce9967 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Operation.java @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Operation model. + */ +@Fluent +public final class Operation implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final OperationName name; + + /* + * The best property. + */ + @Generated + private final boolean best = true; + + /* + * The age property. + */ + @Generated + private final int age = 50; + + /* + * The priority property. + */ + @Generated + private final Priority priority; + + /* + * The color property. + */ + @Generated + private final ColorModel color; + + /* + * The unit property. + */ + @Generated + private final Unit unit; + + /* + * The priorityValue property. + */ + @Generated + private final Priority priorityValue = Priority.LOW; + + /* + * The colorValue property. + */ + @Generated + private final Color colorValue = Color.GREEN; + + /* + * The colorModelValue property. + */ + @Generated + private final ColorModel colorModelValue = ColorModel.BLUE; + + /* + * The unitValue property. + */ + @Generated + private Unit unitValue; + + /* + * The olympicRecord property. + */ + @Generated + private OlympicRecordModel olympicRecord; + + /* + * The olympicRecordValue property. + */ + @Generated + private OlympicRecordModel olympicRecordValue; + + /** + * Creates an instance of Operation class. + * + * @param name the name value to set. + * @param priority the priority value to set. + * @param color the color value to set. + * @param unit the unit value to set. + */ + @Generated + public Operation(OperationName name, Priority priority, ColorModel color, Unit unit) { + this.name = name; + this.priority = priority; + this.color = color; + this.unit = unit; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public OperationName getName() { + return this.name; + } + + /** + * Get the best property: The best property. + * + * @return the best value. + */ + @Generated + public boolean isBest() { + return this.best; + } + + /** + * Get the age property: The age property. + * + * @return the age value. + */ + @Generated + public int getAge() { + return this.age; + } + + /** + * Get the priority property: The priority property. + * + * @return the priority value. + */ + @Generated + public Priority getPriority() { + return this.priority; + } + + /** + * Get the color property: The color property. + * + * @return the color value. + */ + @Generated + public ColorModel getColor() { + return this.color; + } + + /** + * Get the unit property: The unit property. + * + * @return the unit value. + */ + @Generated + public Unit getUnit() { + return this.unit; + } + + /** + * Get the priorityValue property: The priorityValue property. + * + * @return the priorityValue value. + */ + @Generated + public Priority getPriorityValue() { + return this.priorityValue; + } + + /** + * Get the colorValue property: The colorValue property. + * + * @return the colorValue value. + */ + @Generated + public Color getColorValue() { + return this.colorValue; + } + + /** + * Get the colorModelValue property: The colorModelValue property. + * + * @return the colorModelValue value. + */ + @Generated + public ColorModel getColorModelValue() { + return this.colorModelValue; + } + + /** + * Get the unitValue property: The unitValue property. + * + * @return the unitValue value. + */ + @Generated + public Unit getUnitValue() { + return this.unitValue; + } + + /** + * Set the unitValue property: The unitValue property. + * + * @param unitValue the unitValue value to set. + * @return the Operation object itself. + */ + @Generated + public Operation setUnitValue(Unit unitValue) { + this.unitValue = unitValue; + return this; + } + + /** + * Get the olympicRecord property: The olympicRecord property. + * + * @return the olympicRecord value. + */ + @Generated + public OlympicRecordModel getOlympicRecord() { + return this.olympicRecord; + } + + /** + * Set the olympicRecord property: The olympicRecord property. + * + * @param olympicRecord the olympicRecord value to set. + * @return the Operation object itself. + */ + @Generated + public Operation setOlympicRecord(OlympicRecordModel olympicRecord) { + this.olympicRecord = olympicRecord; + return this; + } + + /** + * Get the olympicRecordValue property: The olympicRecordValue property. + * + * @return the olympicRecordValue value. + */ + @Generated + public OlympicRecordModel getOlympicRecordValue() { + return this.olympicRecordValue; + } + + /** + * Set the olympicRecordValue property: The olympicRecordValue property. + * + * @param olympicRecordValue the olympicRecordValue value to set. + * @return the Operation object itself. + */ + @Generated + public Operation setOlympicRecordValue(OlympicRecordModel olympicRecordValue) { + this.olympicRecordValue = olympicRecordValue; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name == null ? null : this.name.toString()); + jsonWriter.writeBooleanField("best", this.best); + jsonWriter.writeIntField("age", this.age); + jsonWriter.writeNumberField("priority", this.priority == null ? null : this.priority.toInt()); + jsonWriter.writeStringField("color", this.color == null ? null : this.color.toString()); + jsonWriter.writeNumberField("unit", this.unit == null ? null : this.unit.toDouble()); + jsonWriter.writeNumberField("priorityValue", this.priorityValue == null ? null : this.priorityValue.toInt()); + jsonWriter.writeStringField("colorValue", this.colorValue == null ? null : this.colorValue.toString()); + jsonWriter.writeStringField("colorModelValue", + this.colorModelValue == null ? null : this.colorModelValue.toString()); + jsonWriter.writeNumberField("unitValue", this.unitValue == null ? null : this.unitValue.toDouble()); + jsonWriter.writeNumberField("olympicRecord", this.olympicRecord == null ? null : this.olympicRecord.getValue()); + jsonWriter.writeNumberField("olympicRecordValue", + this.olympicRecordValue == null ? null : this.olympicRecordValue.getValue()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Operation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Operation if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Operation. + */ + @Generated + public static Operation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationName name = null; + Priority priority = null; + ColorModel color = null; + Unit unit = null; + Unit unitValue = null; + OlympicRecordModel olympicRecord = null; + OlympicRecordModel olympicRecordValue = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = OperationName.fromString(reader.getString()); + } else if ("priority".equals(fieldName)) { + priority = Priority.fromInt(reader.getInt()); + } else if ("color".equals(fieldName)) { + color = ColorModel.fromString(reader.getString()); + } else if ("unit".equals(fieldName)) { + unit = Unit.fromDouble(reader.getDouble()); + } else if ("unitValue".equals(fieldName)) { + unitValue = Unit.fromDouble(reader.getDouble()); + } else if ("olympicRecord".equals(fieldName)) { + olympicRecord = OlympicRecordModel.fromValue(reader.getDouble()); + } else if ("olympicRecordValue".equals(fieldName)) { + olympicRecordValue = OlympicRecordModel.fromValue(reader.getDouble()); + } else { + reader.skipChildren(); + } + } + Operation deserializedOperation = new Operation(name, priority, color, unit); + deserializedOperation.unitValue = unitValue; + deserializedOperation.olympicRecord = olympicRecord; + deserializedOperation.olympicRecordValue = olympicRecordValue; + + return deserializedOperation; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationName.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationName.java new file mode 100644 index 00000000000..94d11e8361a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationName.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice.models; + +/** + * Defines values for OperationName. + */ +public enum OperationName { + /** + * Enum value Read. + */ + READ("Read"), + + /** + * Enum value Write. + */ + WRITE("Write"); + + /** + * The actual serialized value for a OperationName instance. + */ + private final String value; + + OperationName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OperationName instance. + * + * @param value the serialized value to parse. + * @return the parsed OperationName object, or null if unable to parse. + */ + public static OperationName fromString(String value) { + if (value == null) { + return null; + } + OperationName[] items = OperationName.values(); + for (OperationName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationStateValues.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationStateValues.java new file mode 100644 index 00000000000..25acfe415af --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/OperationStateValues.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice.models; + +/** + * Defines values for OperationStateValues. + */ +public enum OperationStateValues { + /** + * Enum value Running. + */ + RUNNING("Running"), + + /** + * Enum value Completed. + */ + COMPLETED("Completed"), + + /** + * Enum value Failed. + */ + FAILED("Failed"); + + /** + * The actual serialized value for a OperationStateValues instance. + */ + private final String value; + + OperationStateValues(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a OperationStateValues instance. + * + * @param value the serialized value to parse. + * @return the parsed OperationStateValues object, or null if unable to parse. + */ + public static OperationStateValues fromString(String value) { + if (value == null) { + return null; + } + OperationStateValues[] items = OperationStateValues.values(); + for (OperationStateValues item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Priority.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Priority.java new file mode 100644 index 00000000000..d34ed66596d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Priority.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice.models; + +/** + * Defines values for Priority. + */ +public enum Priority { + /** + * Enum value 100. + */ + HIGH(100), + + /** + * Enum value 0. + */ + LOW(0); + + /** + * The actual serialized value for a Priority instance. + */ + private final int value; + + Priority(int value) { + this.value = value; + } + + /** + * Parses a serialized value to a Priority instance. + * + * @param value the serialized value to parse. + * @return the parsed Priority object, or null if unable to parse. + */ + public static Priority fromInt(int value) { + Priority[] items = Priority.values(); + for (Priority item : items) { + if (item.toInt() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to int value. + * + * @return the int value. + */ + public int toInt() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/PriorityModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/PriorityModel.java new file mode 100644 index 00000000000..fba63f9146f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/PriorityModel.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableEnum; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +/** + * Defines values for PriorityModel. + */ +public final class PriorityModel implements ExpandableEnum, JsonSerializable { + private static final Map VALUES = new ConcurrentHashMap<>(); + + private static final Function NEW_INSTANCE = PriorityModel::new; + + /** + * Static value 100 for PriorityModel. + */ + @Generated + public static final PriorityModel HIGH = fromValue(100); + + /** + * Static value 0 for PriorityModel. + */ + @Generated + public static final PriorityModel LOW = fromValue(0); + + private final Integer value; + + private PriorityModel(Integer value) { + this.value = value; + } + + /** + * Creates or finds a PriorityModel. + * + * @param value a value to look for. + * @return the corresponding PriorityModel. + * @throws IllegalArgumentException if value is null. + */ + @Generated + public static PriorityModel fromValue(Integer value) { + if (value == null) { + throw new IllegalArgumentException("'value' cannot be null."); + } + return VALUES.computeIfAbsent(value, NEW_INSTANCE); + } + + /** + * Gets known PriorityModel values. + * + * @return Known PriorityModel values. + */ + @Generated + public static Collection values() { + return new ArrayList<>(VALUES.values()); + } + + /** + * Gets the value of the PriorityModel instance. + * + * @return the value of the PriorityModel instance. + */ + @Generated + @Override + public Integer getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + return jsonWriter.writeInt(getValue()); + } + + /** + * Reads an instance of PriorityModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PriorityModel if the JsonReader was pointing to an instance of it, or null if the + * JsonReader was pointing to JSON null. + * @throws IOException If an error occurs while reading the PriorityModel. + * @throws IllegalStateException If unexpected JSON token is found. + */ + @Generated + public static PriorityModel fromJson(JsonReader jsonReader) throws IOException { + JsonToken nextToken = jsonReader.nextToken(); + if (nextToken == JsonToken.NULL) { + return null; + } + if (nextToken != JsonToken.NUMBER) { + throw new IllegalStateException( + String.format("Unexpected JSON token for %s deserialization: %s", JsonToken.NUMBER, nextToken)); + } + return PriorityModel.fromValue(jsonReader.getInt()); + } + + @Generated + @Override + public String toString() { + return Objects.toString(this.value); + } + + @Generated + @Override + public boolean equals(Object obj) { + return this == obj; + } + + @Generated + @Override + public int hashCode() { + return Objects.hashCode(this.value); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Unit.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Unit.java new file mode 100644 index 00000000000..6a02fefd92e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/Unit.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice.models; + +/** + * Defines values for Unit. + */ +public enum Unit { + /** + * Enum value 1. + */ + GRAMS(1.0), + + /** + * Enum value 0.001. + */ + KILO_GRAMS(0.001), + + /** + * Enum value 1000. + */ + MILLIGRAM(1000.0); + + /** + * The actual serialized value for a Unit instance. + */ + private final double value; + + Unit(double value) { + this.value = value; + } + + /** + * Parses a serialized value to a Unit instance. + * + * @param value the serialized value to parse. + * @return the parsed Unit object, or null if unable to parse. + */ + public static Unit fromDouble(double value) { + Unit[] items = Unit.values(); + for (Unit item : items) { + if (Double.doubleToLongBits(item.toDouble()) == Double.doubleToLongBits(value)) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to double value. + * + * @return the double value. + */ + public double toDouble() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/package-info.java new file mode 100644 index 00000000000..abee2e49aa0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for EnumService. + * + */ +package tsptest.enumservice.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/package-info.java new file mode 100644 index 00000000000..12532e2c065 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/enumservice/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for EnumService. + * + */ +package tsptest.enumservice; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelAsyncClient.java new file mode 100644 index 00000000000..5626e971b47 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelAsyncClient.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel; + +import com.azure.core.annotation.Generated; +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.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.errormodel.implementation.ErrorOpsImpl; +import tsptest.errormodel.models.BadResponseErrorException; +import tsptest.errormodel.models.BatchErrorException; +import tsptest.errormodel.models.Diagnostic; + +/** + * Initializes a new instance of the asynchronous ErrorModelClient type. + */ +@ServiceClient(builder = ErrorModelClientBuilder.class, isAsync = true) +public final class ErrorModelAsyncClient { + @Generated + private final ErrorOpsImpl serviceClient; + + /** + * Initializes an instance of ErrorModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ErrorModelAsyncClient(ErrorOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The read operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     subError (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): (recursive schema, see innererror above)
+     *         subCode: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws BatchErrorException thrown if the request is rejected by server. + * @throws BadResponseErrorException thrown if the request is rejected by server on status code 400. + * @throws HttpResponseException thrown if the request is rejected by server on status code 404. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> readWithResponse(RequestOptions requestOptions) { + return this.serviceClient.readWithResponseAsync(requestOptions); + } + + /** + * The read operation. + * + * @throws BatchErrorException thrown if the request is rejected by server. + * @throws BadResponseErrorException thrown if the request is rejected by server on status code 400. + * @throws HttpResponseException thrown if the request is rejected by server on status code 404. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono read() { + // Generated convenience method for readWithResponse + RequestOptions requestOptions = new RequestOptions(); + return readWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Diagnostic.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClient.java new file mode 100644 index 00000000000..7e18ba75330 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClient.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel; + +import com.azure.core.annotation.Generated; +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.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.errormodel.implementation.ErrorOpsImpl; +import tsptest.errormodel.models.BadResponseErrorException; +import tsptest.errormodel.models.BatchErrorException; +import tsptest.errormodel.models.Diagnostic; + +/** + * Initializes a new instance of the synchronous ErrorModelClient type. + */ +@ServiceClient(builder = ErrorModelClientBuilder.class) +public final class ErrorModelClient { + @Generated + private final ErrorOpsImpl serviceClient; + + /** + * Initializes an instance of ErrorModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ErrorModelClient(ErrorOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The read operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     subError (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): (recursive schema, see innererror above)
+     *         subCode: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws BatchErrorException thrown if the request is rejected by server. + * @throws BadResponseErrorException thrown if the request is rejected by server on status code 400. + * @throws HttpResponseException thrown if the request is rejected by server on status code 404. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response readWithResponse(RequestOptions requestOptions) { + return this.serviceClient.readWithResponse(requestOptions); + } + + /** + * The read operation. + * + * @throws BatchErrorException thrown if the request is rejected by server. + * @throws BadResponseErrorException thrown if the request is rejected by server on status code 400. + * @throws HttpResponseException thrown if the request is rejected by server on status code 404. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Diagnostic read() { + // Generated convenience method for readWithResponse + RequestOptions requestOptions = new RequestOptions(); + return readWithResponse(requestOptions).getValue().toObject(Diagnostic.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClientBuilder.java new file mode 100644 index 00000000000..2949dfde432 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/ErrorModelClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.errormodel.implementation.ErrorModelClientImpl; + +/** + * A builder for creating a new instance of the ErrorModelClient type. + */ +@ServiceClientBuilder(serviceClients = { ErrorModelClient.class, ErrorModelAsyncClient.class }) +public final class ErrorModelClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-errormodel.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ErrorModelClientBuilder. + */ + @Generated + public ErrorModelClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ErrorModelClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ErrorModelClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ErrorModelClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ErrorModelClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ErrorModelClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ErrorModelClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ErrorModelClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ErrorModelClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ErrorModelClientBuilder. + */ + @Generated + public ErrorModelClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ErrorModelClientImpl with the provided parameters. + * + * @return an instance of ErrorModelClientImpl. + */ + @Generated + private ErrorModelClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ErrorModelClientImpl client + = new ErrorModelClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ErrorModelAsyncClient class. + * + * @return an instance of ErrorModelAsyncClient. + */ + @Generated + public ErrorModelAsyncClient buildAsyncClient() { + return new ErrorModelAsyncClient(buildInnerClient().getErrorOps()); + } + + /** + * Builds an instance of ErrorModelClient class. + * + * @return an instance of ErrorModelClient. + */ + @Generated + public ErrorModelClient buildClient() { + return new ErrorModelClient(buildInnerClient().getErrorOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ErrorModelClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorModelClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorModelClientImpl.java new file mode 100644 index 00000000000..453381c24f3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorModelClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 ErrorModelClient type. + */ +public final class ErrorModelClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 ErrorOpsImpl object to access its operations. + */ + private final ErrorOpsImpl errorOps; + + /** + * Gets the ErrorOpsImpl object to access its operations. + * + * @return the ErrorOpsImpl object. + */ + public ErrorOpsImpl getErrorOps() { + return this.errorOps; + } + + /** + * Initializes an instance of ErrorModelClient client. + * + * @param endpoint Service host. + */ + public ErrorModelClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ErrorModelClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ErrorModelClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ErrorModelClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ErrorModelClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.errorOps = new ErrorOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorOpsImpl.java new file mode 100644 index 00000000000..3f1ae69cf89 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/ErrorOpsImpl.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; +import tsptest.errormodel.models.BadResponseErrorException; +import tsptest.errormodel.models.BatchErrorException; + +/** + * An instance of this class provides access to all the operations defined in ErrorOps. + */ +public final class ErrorOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ErrorOpsService service; + + /** + * The service client containing this operation class. + */ + private final ErrorModelClientImpl client; + + /** + * Initializes an instance of ErrorOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ErrorOpsImpl(ErrorModelClientImpl client) { + this.service = RestProxy.create(ErrorOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ErrorModelClientErrorOps to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ErrorModelClientErrorOps") + public interface ErrorOpsService { + @Get("/error") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = BadResponseErrorException.class, code = { 400 }) + @UnexpectedResponseExceptionType(value = HttpResponseException.class, code = { 404 }) + @UnexpectedResponseExceptionType(BatchErrorException.class) + Mono> read(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/error") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = BadResponseErrorException.class, code = { 400 }) + @UnexpectedResponseExceptionType(value = HttpResponseException.class, code = { 404 }) + @UnexpectedResponseExceptionType(BatchErrorException.class) + Response readSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The read operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     subError (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): (recursive schema, see innererror above)
+     *         subCode: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws BatchErrorException thrown if the request is rejected by server. + * @throws BadResponseErrorException thrown if the request is rejected by server on status code 400. + * @throws HttpResponseException thrown if the request is rejected by server on status code 404. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> readWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.read(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The read operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     error (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     subError (Required): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): (recursive schema, see innererror above)
+     *         subCode: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws BatchErrorException thrown if the request is rejected by server. + * @throws BadResponseErrorException thrown if the request is rejected by server on status code 400. + * @throws HttpResponseException thrown if the request is rejected by server on status code 404. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response readWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.readSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/package-info.java new file mode 100644 index 00000000000..ef31b90e413 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ErrorModel. + * + */ +package tsptest.errormodel.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseError.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseError.java new file mode 100644 index 00000000000..35592987895 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseError.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The BadResponseError model. + */ +@Immutable +public final class BadResponseError implements JsonSerializable { + /* + * The code property. + */ + @Generated + private final String code; + + /* + * The data property. + */ + @Generated + private final Details data; + + /** + * Creates an instance of BadResponseError class. + * + * @param code the code value to set. + * @param data the data value to set. + */ + @Generated + private BadResponseError(String code, Details data) { + this.code = code; + this.data = data; + } + + /** + * Get the code property: The code property. + * + * @return the code value. + */ + @Generated + public String getCode() { + return this.code; + } + + /** + * Get the data property: The data property. + * + * @return the data value. + */ + @Generated + public Details getData() { + return this.data; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeJsonField("data", this.data); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BadResponseError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BadResponseError if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BadResponseError. + */ + @Generated + public static BadResponseError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String code = null; + Details data = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + code = reader.getString(); + } else if ("data".equals(fieldName)) { + data = Details.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new BadResponseError(code, data); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseErrorException.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseErrorException.java new file mode 100644 index 00000000000..0c0eac278b7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BadResponseErrorException.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel.models; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpResponse; + +/** + * Exception thrown for an invalid response with BadResponseError information. + */ +public final class BadResponseErrorException extends HttpResponseException { + /** + * Initializes a new instance of the BadResponseErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public BadResponseErrorException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the BadResponseErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public BadResponseErrorException(String message, HttpResponse response, BadResponseError value) { + super(message, response, value); + } + + /** + * {@inheritDoc} + */ + @Override + public BadResponseError getValue() { + return (BadResponseError) super.getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchError.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchError.java new file mode 100644 index 00000000000..97a4bfe636a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchError.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The BatchError model. + */ +@Immutable +public final class BatchError implements JsonSerializable { + /* + * The code property. + */ + @Generated + private String code; + + /* + * The message property. + */ + @Generated + private BatchErrorMessage message; + + /** + * Creates an instance of BatchError class. + */ + @Generated + private BatchError() { + } + + /** + * Get the code property: The code property. + * + * @return the code value. + */ + @Generated + public String getCode() { + return this.code; + } + + /** + * Get the message property: The message property. + * + * @return the message value. + */ + @Generated + public BatchErrorMessage getMessage() { + return this.message; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeJsonField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BatchError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BatchError if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the BatchError. + */ + @Generated + public static BatchError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BatchError deserializedBatchError = new BatchError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedBatchError.code = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedBatchError.message = BatchErrorMessage.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBatchError; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorException.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorException.java new file mode 100644 index 00000000000..e741056a209 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorException.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel.models; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpResponse; + +/** + * Exception thrown for an invalid response with BatchError information. + */ +public final class BatchErrorException extends HttpResponseException { + /** + * Initializes a new instance of the BatchErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public BatchErrorException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the BatchErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public BatchErrorException(String message, HttpResponse response, BatchError value) { + super(message, response, value); + } + + /** + * {@inheritDoc} + */ + @Override + public BatchError getValue() { + return (BatchError) super.getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorMessage.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorMessage.java new file mode 100644 index 00000000000..4b1ad0a2b63 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/BatchErrorMessage.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The BatchErrorMessage model. + */ +@Immutable +public final class BatchErrorMessage implements JsonSerializable { + /* + * The lang property. + */ + @Generated + private String lang; + + /* + * The value property. + */ + @Generated + private String value; + + /** + * Creates an instance of BatchErrorMessage class. + */ + @Generated + private BatchErrorMessage() { + } + + /** + * Get the lang property: The lang property. + * + * @return the lang value. + */ + @Generated + public String getLang() { + return this.lang; + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + @Generated + public String getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("lang", this.lang); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BatchErrorMessage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BatchErrorMessage if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BatchErrorMessage. + */ + @Generated + public static BatchErrorMessage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BatchErrorMessage deserializedBatchErrorMessage = new BatchErrorMessage(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lang".equals(fieldName)) { + deserializedBatchErrorMessage.lang = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedBatchErrorMessage.value = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBatchErrorMessage; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Details.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Details.java new file mode 100644 index 00000000000..bcfadb54d60 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Details.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Details model. + */ +@Immutable +public final class Details implements JsonSerializable
{ + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Details class. + * + * @param name the name value to set. + */ + @Generated + private Details(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Details from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Details if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Details. + */ + @Generated + public static Details fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Details(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Diagnostic.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Diagnostic.java new file mode 100644 index 00000000000..730a9a88e65 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/Diagnostic.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Diagnostic model. + */ +@Immutable +public final class Diagnostic implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The error property. + */ + @Generated + private final ResponseError error; + + /* + * The subError property. + */ + @Generated + private final SubError subError; + + /** + * Creates an instance of Diagnostic class. + * + * @param name the name value to set. + * @param error the error value to set. + * @param subError the subError value to set. + */ + @Generated + private Diagnostic(String name, ResponseError error, SubError subError) { + this.name = name; + this.error = error; + this.subError = subError; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the error property: The error property. + * + * @return the error value. + */ + @Generated + public ResponseError getError() { + return this.error; + } + + /** + * Get the subError property: The subError property. + * + * @return the subError value. + */ + @Generated + public SubError getSubError() { + return this.subError; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("error", this.error); + jsonWriter.writeJsonField("subError", this.subError); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Diagnostic from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Diagnostic if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Diagnostic. + */ + @Generated + public static Diagnostic fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + ResponseError error = null; + SubError subError = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("error".equals(fieldName)) { + error = ResponseError.fromJson(reader); + } else if ("subError".equals(fieldName)) { + subError = SubError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new Diagnostic(name, error, subError); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/InnerError.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/InnerError.java new file mode 100644 index 00000000000..6d1985042b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/InnerError.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An object containing more specific information about the error. As per Azure REST API guidelines - + * https://aka.ms/AzureRestApiGuidelines#handling-errors. + */ +@Immutable +public final class InnerError implements JsonSerializable { + /* + * One of a server-defined set of error codes. + */ + @Generated + private String code; + + /* + * Inner error. + */ + @Generated + private InnerError innerError; + + /** + * Creates an instance of InnerError class. + */ + @Generated + private InnerError() { + } + + /** + * Get the code property: One of a server-defined set of error codes. + * + * @return the code value. + */ + @Generated + public String getCode() { + return this.code; + } + + /** + * Get the innerError property: Inner error. + * + * @return the innerError value. + */ + @Generated + public InnerError getInnerError() { + return this.innerError; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeJsonField("innererror", this.innerError); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InnerError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InnerError if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the InnerError. + */ + @Generated + public static InnerError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InnerError deserializedInnerError = new InnerError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedInnerError.code = reader.getString(); + } else if ("innererror".equals(fieldName)) { + deserializedInnerError.innerError = InnerError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedInnerError; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/SubError.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/SubError.java new file mode 100644 index 00000000000..675414dbb39 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/SubError.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The SubError model. + */ +@Immutable +public final class SubError implements JsonSerializable { + /* + * One of a server-defined set of error codes. + */ + @Generated + private final String code; + + /* + * A human-readable representation of the error. + */ + @Generated + private final String message; + + /* + * The target of the error. + */ + @Generated + private String target; + + /* + * An array of details about specific errors that led to this reported error. + */ + @Generated + private List details; + + /* + * An object containing more specific information than the current object about the error. + */ + @Generated + private InnerError innerError; + + /* + * The subCode property. + */ + @Generated + private final String subCode; + + /** + * Creates an instance of SubError class. + * + * @param code the code value to set. + * @param message the message value to set. + * @param subCode the subCode value to set. + */ + @Generated + private SubError(String code, String message, String subCode) { + this.code = code; + this.message = message; + this.subCode = subCode; + } + + /** + * Get the code property: One of a server-defined set of error codes. + * + * @return the code value. + */ + @Generated + public String getCode() { + return this.code; + } + + /** + * Get the message property: A human-readable representation of the error. + * + * @return the message value. + */ + @Generated + public String getMessage() { + return this.message; + } + + /** + * Get the target property: The target of the error. + * + * @return the target value. + */ + @Generated + public String getTarget() { + return this.target; + } + + /** + * Get the details property: An array of details about specific errors that led to this reported error. + * + * @return the details value. + */ + @Generated + public List getDetails() { + return this.details; + } + + /** + * Get the innerError property: An object containing more specific information than the current object about the + * error. + * + * @return the innerError value. + */ + @Generated + public InnerError getInnerError() { + return this.innerError; + } + + /** + * Get the subCode property: The subCode property. + * + * @return the subCode value. + */ + @Generated + public String getSubCode() { + return this.subCode; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeStringField("message", this.message); + jsonWriter.writeStringField("subCode", this.subCode); + jsonWriter.writeStringField("target", this.target); + jsonWriter.writeArrayField("details", this.details, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("innererror", this.innerError); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubError if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubError. + */ + @Generated + public static SubError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String code = null; + String message = null; + String subCode = null; + String target = null; + List details = null; + InnerError innerError = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + code = reader.getString(); + } else if ("message".equals(fieldName)) { + message = reader.getString(); + } else if ("subCode".equals(fieldName)) { + subCode = reader.getString(); + } else if ("target".equals(fieldName)) { + target = reader.getString(); + } else if ("details".equals(fieldName)) { + details = reader.readArray(reader1 -> ResponseError.fromJson(reader1)); + } else if ("innererror".equals(fieldName)) { + innerError = InnerError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + SubError deserializedSubError = new SubError(code, message, subCode); + deserializedSubError.target = target; + deserializedSubError.details = details; + deserializedSubError.innerError = innerError; + + return deserializedSubError; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/package-info.java new file mode 100644 index 00000000000..69295087d21 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for ErrorModel. + * + */ +package tsptest.errormodel.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/package-info.java new file mode 100644 index 00000000000..135e92a62ca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/errormodel/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ErrorModel. + * + */ +package tsptest.errormodel; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenAsyncClient.java new file mode 100644 index 00000000000..783df036517 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenAsyncClient.java @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.flatten.implementation.FlattenClientImpl; +import tsptest.flatten.implementation.JsonMergePatchHelper; +import tsptest.flatten.implementation.models.SendLongRequest; +import tsptest.flatten.implementation.models.SendOptionalBodyRequest; +import tsptest.flatten.implementation.models.SendProjectedNameRequest; +import tsptest.flatten.implementation.models.SendRequest; +import tsptest.flatten.models.SendLongOptions; +import tsptest.flatten.models.TodoItem; +import tsptest.flatten.models.UpdatePatchRequest; +import tsptest.flatten.models.User; + +/** + * Initializes a new instance of the asynchronous FlattenClient type. + */ +@ServiceClient(builder = FlattenClientBuilder.class, isAsync = true) +public final class FlattenAsyncClient { + @Generated + private final FlattenClientImpl serviceClient; + + /** + * Initializes an instance of FlattenAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FlattenAsyncClient(FlattenClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The send operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maxPageSize parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     endpoint: String (Required)
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: String (Required)
+     *     constant: String (Required)
+     *     requiredInt: int (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendRequest The sendRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(String id, BinaryData sendRequest, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(id, sendRequest, requestOptions); + } + + /** + * The sendProjectedName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_id: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendProjectedNameRequest The sendProjectedNameRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendProjectedNameWithResponse(String id, BinaryData sendProjectedNameRequest, + RequestOptions requestOptions) { + return this.serviceClient.sendProjectedNameWithResponseAsync(id, sendProjectedNameRequest, requestOptions); + } + + /** + * The sendLong operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: String (Required)
+     *     dataInt: int (Required)
+     *     dataIntOptional: Integer (Optional)
+     *     dataLong: Long (Optional)
+     *     requiredUser (Required): (recursive schema, see requiredUser above)
+     *     data_float: Double (Optional)
+     *     long: Long (Optional)
+     *     title: String (Required)
+     *     description: String (Optional)
+     *     status: String(NotStarted/InProgress/Completed) (Required)
+     *     _dummy: String (Optional)
+     *     constant: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param sendLongRequest The sendLongRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendLongWithResponse(String name, BinaryData sendLongRequest, + RequestOptions requestOptions) { + return this.serviceClient.sendLongWithResponseAsync(name, sendLongRequest, requestOptions); + } + + /** + * The update operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     patch (Optional, Required on create): {
+     *         title: String (Optional)
+     *         description: String (Optional)
+     *         status: String(NotStarted/InProgress/Completed) (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: long (Required)
+     *     title: String (Required)
+     *     description: String (Optional)
+     *     status: String(NotStarted/InProgress/Completed) (Required)
+     *     createdAt: OffsetDateTime (Required)
+     *     updatedAt: OffsetDateTime (Required)
+     *     completedAt: OffsetDateTime (Optional)
+     *     _dummy: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param updateRequest The updateRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponse(long id, BinaryData updateRequest, + RequestOptions requestOptions) { + return this.serviceClient.updateWithResponseAsync(id, updateRequest, requestOptions); + } + + /** + * The sendOptionalBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param sendOptionalBodyRequest The sendOptionalBodyRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendOptionalBodyWithResponse(BinaryData sendOptionalBodyRequest, + RequestOptions requestOptions) { + return this.serviceClient.sendOptionalBodyWithResponseAsync(sendOptionalBodyRequest, requestOptions); + } + + /** + * The send operation. + * + * @param id The id parameter. + * @param endpoint The endpoint parameter. + * @param input The input parameter. + * @param requiredInt The requiredInt parameter. + * @param maxPageSize The maxPageSize parameter. + * @param user The user parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(String id, String endpoint, String input, int requiredInt, Integer maxPageSize, User user) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest sendRequestObj = new SendRequest(endpoint, input, requiredInt).setUser(user); + BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); + if (maxPageSize != null) { + requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false); + } + return sendWithResponse(id, sendRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The send operation. + * + * @param id The id parameter. + * @param endpoint The endpoint parameter. + * @param input The input parameter. + * @param requiredInt The requiredInt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(String id, String endpoint, String input, int requiredInt) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest sendRequestObj = new SendRequest(endpoint, input, requiredInt); + BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); + return sendWithResponse(id, sendRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The sendProjectedName operation. + * + * @param id The id parameter. + * @param fileIdentifier The fileIdentifier parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono sendProjectedName(String id, String fileIdentifier) { + // Generated convenience method for sendProjectedNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendProjectedNameRequest sendProjectedNameRequestObj = new SendProjectedNameRequest(fileIdentifier); + BinaryData sendProjectedNameRequest = BinaryData.fromObject(sendProjectedNameRequestObj); + return sendProjectedNameWithResponse(id, sendProjectedNameRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The sendLong operation. + * + * @param options Options for sendLong API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono sendLong(SendLongOptions options) { + // Generated convenience method for sendLongWithResponse + RequestOptions requestOptions = new RequestOptions(); + String name = options.getName(); + String filter = options.getFilter(); + SendLongRequest sendLongRequestObj = new SendLongRequest(options.getInput(), options.getDataInt(), + options.getRequiredUser(), options.getTitle(), options.getStatus()).setUser(options.getUser()) + .setDataIntOptional(options.getDataIntOptional()) + .setDataLong(options.getDataLong()) + .setDataFloat(options.getDataFloat()) + .setLongProperty(options.getLongParameter()) + .setDescription(options.getDescription()) + .setDummy(options.getDummy()); + BinaryData sendLongRequest = BinaryData.fromObject(sendLongRequestObj); + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + return sendLongWithResponse(name, sendLongRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The update operation. + * + * @param id The id parameter. + * @param updateRequest The updateRequest parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono update(long id, UpdatePatchRequest updateRequest) { + // Generated convenience method for updateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getUpdatePatchRequestAccessor().prepareModelForJsonMergePatch(updateRequest, true); + BinaryData updateRequestInBinaryData = BinaryData.fromObject(updateRequest); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + updateRequestInBinaryData.getLength(); + JsonMergePatchHelper.getUpdatePatchRequestAccessor().prepareModelForJsonMergePatch(updateRequest, false); + return updateWithResponse(id, updateRequestInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TodoItem.class)); + } + + /** + * The sendOptionalBody operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono sendOptionalBody(String name) { + // Generated convenience method for sendOptionalBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendOptionalBodyRequest sendOptionalBodyRequestObj = new SendOptionalBodyRequest().setName(name); + BinaryData sendOptionalBodyRequest = BinaryData.fromObject(sendOptionalBodyRequestObj); + return sendOptionalBodyWithResponse(sendOptionalBodyRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The sendOptionalBody operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono sendOptionalBody() { + // Generated convenience method for sendOptionalBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendOptionalBodyRequest sendOptionalBodyRequestObj = new SendOptionalBodyRequest(); + BinaryData sendOptionalBodyRequest = BinaryData.fromObject(sendOptionalBodyRequestObj); + return sendOptionalBodyWithResponse(sendOptionalBodyRequest, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClient.java new file mode 100644 index 00000000000..43889d1c8df --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClient.java @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.flatten.implementation.FlattenClientImpl; +import tsptest.flatten.implementation.JsonMergePatchHelper; +import tsptest.flatten.implementation.models.SendLongRequest; +import tsptest.flatten.implementation.models.SendOptionalBodyRequest; +import tsptest.flatten.implementation.models.SendProjectedNameRequest; +import tsptest.flatten.implementation.models.SendRequest; +import tsptest.flatten.models.SendLongOptions; +import tsptest.flatten.models.TodoItem; +import tsptest.flatten.models.UpdatePatchRequest; +import tsptest.flatten.models.User; + +/** + * Initializes a new instance of the synchronous FlattenClient type. + */ +@ServiceClient(builder = FlattenClientBuilder.class) +public final class FlattenClient { + @Generated + private final FlattenClientImpl serviceClient; + + /** + * Initializes an instance of FlattenClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FlattenClient(FlattenClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The send operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maxPageSize parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     endpoint: String (Required)
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: String (Required)
+     *     constant: String (Required)
+     *     requiredInt: int (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendRequest The sendRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(String id, BinaryData sendRequest, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(id, sendRequest, requestOptions); + } + + /** + * The sendProjectedName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_id: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendProjectedNameRequest The sendProjectedNameRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendProjectedNameWithResponse(String id, BinaryData sendProjectedNameRequest, + RequestOptions requestOptions) { + return this.serviceClient.sendProjectedNameWithResponse(id, sendProjectedNameRequest, requestOptions); + } + + /** + * The sendLong operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: String (Required)
+     *     dataInt: int (Required)
+     *     dataIntOptional: Integer (Optional)
+     *     dataLong: Long (Optional)
+     *     requiredUser (Required): (recursive schema, see requiredUser above)
+     *     data_float: Double (Optional)
+     *     long: Long (Optional)
+     *     title: String (Required)
+     *     description: String (Optional)
+     *     status: String(NotStarted/InProgress/Completed) (Required)
+     *     _dummy: String (Optional)
+     *     constant: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param sendLongRequest The sendLongRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendLongWithResponse(String name, BinaryData sendLongRequest, RequestOptions requestOptions) { + return this.serviceClient.sendLongWithResponse(name, sendLongRequest, requestOptions); + } + + /** + * The update operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     patch (Optional, Required on create): {
+     *         title: String (Optional)
+     *         description: String (Optional)
+     *         status: String(NotStarted/InProgress/Completed) (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: long (Required)
+     *     title: String (Required)
+     *     description: String (Optional)
+     *     status: String(NotStarted/InProgress/Completed) (Required)
+     *     createdAt: OffsetDateTime (Required)
+     *     updatedAt: OffsetDateTime (Required)
+     *     completedAt: OffsetDateTime (Optional)
+     *     _dummy: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param updateRequest The updateRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(long id, BinaryData updateRequest, RequestOptions requestOptions) { + return this.serviceClient.updateWithResponse(id, updateRequest, requestOptions); + } + + /** + * The sendOptionalBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param sendOptionalBodyRequest The sendOptionalBodyRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendOptionalBodyWithResponse(BinaryData sendOptionalBodyRequest, + RequestOptions requestOptions) { + return this.serviceClient.sendOptionalBodyWithResponse(sendOptionalBodyRequest, requestOptions); + } + + /** + * The send operation. + * + * @param id The id parameter. + * @param endpoint The endpoint parameter. + * @param input The input parameter. + * @param requiredInt The requiredInt parameter. + * @param maxPageSize The maxPageSize parameter. + * @param user The user parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(String id, String endpoint, String input, int requiredInt, Integer maxPageSize, User user) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest sendRequestObj = new SendRequest(endpoint, input, requiredInt).setUser(user); + BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); + if (maxPageSize != null) { + requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false); + } + sendWithResponse(id, sendRequest, requestOptions).getValue(); + } + + /** + * The send operation. + * + * @param id The id parameter. + * @param endpoint The endpoint parameter. + * @param input The input parameter. + * @param requiredInt The requiredInt parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(String id, String endpoint, String input, int requiredInt) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest sendRequestObj = new SendRequest(endpoint, input, requiredInt); + BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); + sendWithResponse(id, sendRequest, requestOptions).getValue(); + } + + /** + * The sendProjectedName operation. + * + * @param id The id parameter. + * @param fileIdentifier The fileIdentifier parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void sendProjectedName(String id, String fileIdentifier) { + // Generated convenience method for sendProjectedNameWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendProjectedNameRequest sendProjectedNameRequestObj = new SendProjectedNameRequest(fileIdentifier); + BinaryData sendProjectedNameRequest = BinaryData.fromObject(sendProjectedNameRequestObj); + sendProjectedNameWithResponse(id, sendProjectedNameRequest, requestOptions).getValue(); + } + + /** + * The sendLong operation. + * + * @param options Options for sendLong API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void sendLong(SendLongOptions options) { + // Generated convenience method for sendLongWithResponse + RequestOptions requestOptions = new RequestOptions(); + String name = options.getName(); + String filter = options.getFilter(); + SendLongRequest sendLongRequestObj = new SendLongRequest(options.getInput(), options.getDataInt(), + options.getRequiredUser(), options.getTitle(), options.getStatus()).setUser(options.getUser()) + .setDataIntOptional(options.getDataIntOptional()) + .setDataLong(options.getDataLong()) + .setDataFloat(options.getDataFloat()) + .setLongProperty(options.getLongParameter()) + .setDescription(options.getDescription()) + .setDummy(options.getDummy()); + BinaryData sendLongRequest = BinaryData.fromObject(sendLongRequestObj); + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + sendLongWithResponse(name, sendLongRequest, requestOptions).getValue(); + } + + /** + * The update operation. + * + * @param id The id parameter. + * @param updateRequest The updateRequest parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TodoItem update(long id, UpdatePatchRequest updateRequest) { + // Generated convenience method for updateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getUpdatePatchRequestAccessor().prepareModelForJsonMergePatch(updateRequest, true); + BinaryData updateRequestInBinaryData = BinaryData.fromObject(updateRequest); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + updateRequestInBinaryData.getLength(); + JsonMergePatchHelper.getUpdatePatchRequestAccessor().prepareModelForJsonMergePatch(updateRequest, false); + return updateWithResponse(id, updateRequestInBinaryData, requestOptions).getValue().toObject(TodoItem.class); + } + + /** + * The sendOptionalBody operation. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void sendOptionalBody(String name) { + // Generated convenience method for sendOptionalBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendOptionalBodyRequest sendOptionalBodyRequestObj = new SendOptionalBodyRequest().setName(name); + BinaryData sendOptionalBodyRequest = BinaryData.fromObject(sendOptionalBodyRequestObj); + sendOptionalBodyWithResponse(sendOptionalBodyRequest, requestOptions).getValue(); + } + + /** + * The sendOptionalBody operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void sendOptionalBody() { + // Generated convenience method for sendOptionalBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendOptionalBodyRequest sendOptionalBodyRequestObj = new SendOptionalBodyRequest(); + BinaryData sendOptionalBodyRequest = BinaryData.fromObject(sendOptionalBodyRequestObj); + sendOptionalBodyWithResponse(sendOptionalBodyRequest, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClientBuilder.java new file mode 100644 index 00000000000..063565bcb6b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.flatten.implementation.FlattenClientImpl; + +/** + * A builder for creating a new instance of the FlattenClient type. + */ +@ServiceClientBuilder(serviceClients = { FlattenClient.class, FlattenAsyncClient.class }) +public final class FlattenClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-flatten.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the FlattenClientBuilder. + */ + @Generated + public FlattenClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FlattenClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private FlattenServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the FlattenClientBuilder. + */ + @Generated + public FlattenClientBuilder serviceVersion(FlattenServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the FlattenClientBuilder. + */ + @Generated + public FlattenClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of FlattenClientImpl with the provided parameters. + * + * @return an instance of FlattenClientImpl. + */ + @Generated + private FlattenClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + FlattenServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : FlattenServiceVersion.getLatest(); + FlattenClientImpl client = new FlattenClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of FlattenAsyncClient class. + * + * @return an instance of FlattenAsyncClient. + */ + @Generated + public FlattenAsyncClient buildAsyncClient() { + return new FlattenAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of FlattenClient class. + * + * @return an instance of FlattenClient. + */ + @Generated + public FlattenClient buildClient() { + return new FlattenClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(FlattenClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenServiceVersion.java new file mode 100644 index 00000000000..3628282697a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/FlattenServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of FlattenClient. + */ +public enum FlattenServiceVersion implements ServiceVersion { + /** + * Enum value 2022-06-01-preview. + */ + V2022_06_01_PREVIEW("2022-06-01-preview"); + + private final String version; + + FlattenServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link FlattenServiceVersion}. + */ + public static FlattenServiceVersion getLatest() { + return V2022_06_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/FlattenClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/FlattenClientImpl.java new file mode 100644 index 00000000000..c4fa3266149 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/FlattenClientImpl.java @@ -0,0 +1,655 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; +import tsptest.flatten.FlattenServiceVersion; + +/** + * Initializes a new instance of the FlattenClient type. + */ +public final class FlattenClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FlattenClientService service; + + /** + */ + private final String endpoint; + + /** + * Gets. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final FlattenServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public FlattenServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of FlattenClient client. + * + * @param endpoint + * @param serviceVersion Service version. + */ + public FlattenClientImpl(String endpoint, FlattenServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of FlattenClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint + * @param serviceVersion Service version. + */ + public FlattenClientImpl(HttpPipeline httpPipeline, String endpoint, FlattenServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of FlattenClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint + * @param serviceVersion Service version. + */ + public FlattenClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + FlattenServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(FlattenClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for FlattenClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}/openai") + @ServiceInterface(name = "FlattenClient") + public interface FlattenClientService { + @Post("/flatten/send") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, + @QueryParam("constantQueryParam") String constantQueryParam, @QueryParam("api-version") String apiVersion, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest, + RequestOptions requestOptions, Context context); + + @Post("/flatten/send") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, + @QueryParam("constantQueryParam") String constantQueryParam, @QueryParam("api-version") String apiVersion, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest, + RequestOptions requestOptions, Context context); + + @Post("/flatten/send-projected-name") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> sendProjectedName(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendProjectedNameRequest, RequestOptions requestOptions, + Context context); + + @Post("/flatten/send-projected-name") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendProjectedNameSync(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendProjectedNameRequest, RequestOptions requestOptions, + Context context); + + @Post("/flatten/send-long") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> sendLong(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendLongRequest, RequestOptions requestOptions, Context context); + + @Post("/flatten/send-long") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendLongSync(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendLongRequest, RequestOptions requestOptions, Context context); + + @Patch("/flatten/patch/{id}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @PathParam("id") long id, + @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData updateRequest, + RequestOptions requestOptions, Context context); + + @Patch("/flatten/patch/{id}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @PathParam("id") long id, + @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData updateRequest, + RequestOptions requestOptions, Context context); + + @Post("/flatten/optional-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> sendOptionalBody(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendOptionalBodyRequest, RequestOptions requestOptions, + Context context); + + @Post("/flatten/optional-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendOptionalBodySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendOptionalBodyRequest, RequestOptions requestOptions, + Context context); + } + + /** + * The send operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maxPageSize parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     endpoint: String (Required)
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: String (Required)
+     *     constant: String (Required)
+     *     requiredInt: int (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendRequest The sendRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(String id, BinaryData sendRequest, + RequestOptions requestOptions) { + final String constantQueryParam = "constant"; + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.send(this.getEndpoint(), id, constantQueryParam, + this.getServiceVersion().getVersion(), contentType, sendRequest, requestOptions, context)); + } + + /** + * The send operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxpagesizeIntegerNoThe maxPageSize parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     endpoint: String (Required)
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: String (Required)
+     *     constant: String (Required)
+     *     requiredInt: int (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendRequest The sendRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(String id, BinaryData sendRequest, RequestOptions requestOptions) { + final String constantQueryParam = "constant"; + final String contentType = "application/json"; + return service.sendSync(this.getEndpoint(), id, constantQueryParam, this.getServiceVersion().getVersion(), + contentType, sendRequest, requestOptions, Context.NONE); + } + + /** + * The sendProjectedName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_id: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendProjectedNameRequest The sendProjectedNameRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendProjectedNameWithResponseAsync(String id, BinaryData sendProjectedNameRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.sendProjectedName(this.getEndpoint(), id, contentType, + sendProjectedNameRequest, requestOptions, context)); + } + + /** + * The sendProjectedName operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     file_id: String (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendProjectedNameRequest The sendProjectedNameRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendProjectedNameWithResponse(String id, BinaryData sendProjectedNameRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendProjectedNameSync(this.getEndpoint(), id, contentType, sendProjectedNameRequest, + requestOptions, Context.NONE); + } + + /** + * The sendLong operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: String (Required)
+     *     dataInt: int (Required)
+     *     dataIntOptional: Integer (Optional)
+     *     dataLong: Long (Optional)
+     *     requiredUser (Required): (recursive schema, see requiredUser above)
+     *     data_float: Double (Optional)
+     *     long: Long (Optional)
+     *     title: String (Required)
+     *     description: String (Optional)
+     *     status: String(NotStarted/InProgress/Completed) (Required)
+     *     _dummy: String (Optional)
+     *     constant: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param sendLongRequest The sendLongRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendLongWithResponseAsync(String name, BinaryData sendLongRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.sendLong(this.getEndpoint(), name, + this.getServiceVersion().getVersion(), contentType, sendLongRequest, requestOptions, context)); + } + + /** + * The sendLong operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: String (Required)
+     *     dataInt: int (Required)
+     *     dataIntOptional: Integer (Optional)
+     *     dataLong: Long (Optional)
+     *     requiredUser (Required): (recursive schema, see requiredUser above)
+     *     data_float: Double (Optional)
+     *     long: Long (Optional)
+     *     title: String (Required)
+     *     description: String (Optional)
+     *     status: String(NotStarted/InProgress/Completed) (Required)
+     *     _dummy: String (Optional)
+     *     constant: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param sendLongRequest The sendLongRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendLongWithResponse(String name, BinaryData sendLongRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendLongSync(this.getEndpoint(), name, this.getServiceVersion().getVersion(), contentType, + sendLongRequest, requestOptions, Context.NONE); + } + + /** + * The update operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     patch (Optional, Required on create): {
+     *         title: String (Optional)
+     *         description: String (Optional)
+     *         status: String(NotStarted/InProgress/Completed) (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: long (Required)
+     *     title: String (Required)
+     *     description: String (Optional)
+     *     status: String(NotStarted/InProgress/Completed) (Required)
+     *     createdAt: OffsetDateTime (Required)
+     *     updatedAt: OffsetDateTime (Required)
+     *     completedAt: OffsetDateTime (Optional)
+     *     _dummy: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param updateRequest The updateRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync(long id, BinaryData updateRequest, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.update(this.getEndpoint(), contentType, id, accept, + updateRequest, requestOptions, context)); + } + + /** + * The update operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     patch (Optional, Required on create): {
+     *         title: String (Optional)
+     *         description: String (Optional)
+     *         status: String(NotStarted/InProgress/Completed) (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: long (Required)
+     *     title: String (Required)
+     *     description: String (Optional)
+     *     status: String(NotStarted/InProgress/Completed) (Required)
+     *     createdAt: OffsetDateTime (Required)
+     *     updatedAt: OffsetDateTime (Required)
+     *     completedAt: OffsetDateTime (Optional)
+     *     _dummy: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param updateRequest The updateRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(long id, BinaryData updateRequest, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.updateSync(this.getEndpoint(), contentType, id, accept, updateRequest, requestOptions, + Context.NONE); + } + + /** + * The sendOptionalBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param sendOptionalBodyRequest The sendOptionalBodyRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendOptionalBodyWithResponseAsync(BinaryData sendOptionalBodyRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.sendOptionalBody(this.getEndpoint(), contentType, + sendOptionalBodyRequest, requestOptions, context)); + } + + /** + * The sendOptionalBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param sendOptionalBodyRequest The sendOptionalBodyRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendOptionalBodyWithResponse(BinaryData sendOptionalBodyRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendOptionalBodySync(this.getEndpoint(), contentType, sendOptionalBodyRequest, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/JsonMergePatchHelper.java new file mode 100644 index 00000000000..ae339275cdd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/JsonMergePatchHelper.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.implementation; + +import tsptest.flatten.models.TodoItemPatch; +import tsptest.flatten.models.UpdatePatchRequest; + +/** + * This is the Helper class to enable json merge patch serialization for a model. + */ +public class JsonMergePatchHelper { + private static UpdatePatchRequestAccessor updatePatchRequestAccessor; + + public interface UpdatePatchRequestAccessor { + UpdatePatchRequest prepareModelForJsonMergePatch(UpdatePatchRequest updatePatchRequest, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(UpdatePatchRequest updatePatchRequest); + } + + public static void setUpdatePatchRequestAccessor(UpdatePatchRequestAccessor accessor) { + updatePatchRequestAccessor = accessor; + } + + public static UpdatePatchRequestAccessor getUpdatePatchRequestAccessor() { + return updatePatchRequestAccessor; + } + + private static TodoItemPatchAccessor todoItemPatchAccessor; + + public interface TodoItemPatchAccessor { + TodoItemPatch prepareModelForJsonMergePatch(TodoItemPatch todoItemPatch, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TodoItemPatch todoItemPatch); + } + + public static void setTodoItemPatchAccessor(TodoItemPatchAccessor accessor) { + todoItemPatchAccessor = accessor; + } + + public static TodoItemPatchAccessor getTodoItemPatchAccessor() { + return todoItemPatchAccessor; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendLongRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendLongRequest.java new file mode 100644 index 00000000000..2a33ffd1032 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendLongRequest.java @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.flatten.models.SendLongRequestStatus; +import tsptest.flatten.models.User; + +/** + * The SendLongRequest model. + */ +@Fluent +public final class SendLongRequest implements JsonSerializable { + /* + * The user property. + */ + @Generated + private User user; + + /* + * The input property. + */ + @Generated + private final String input; + + /* + * The dataInt property. + */ + @Generated + private final int dataInt; + + /* + * The dataIntOptional property. + */ + @Generated + private Integer dataIntOptional; + + /* + * The dataLong property. + */ + @Generated + private Long dataLong; + + /* + * The requiredUser property. + */ + @Generated + private final User requiredUser; + + /* + * The data_float property. + */ + @Generated + private Double dataFloat; + + /* + * The long property. + */ + @Generated + private Long longProperty; + + /* + * The item's title + */ + @Generated + private final String title; + + /* + * A longer description of the todo item in markdown format + */ + @Generated + private String description; + + /* + * The status of the todo item + */ + @Generated + private final SendLongRequestStatus status; + + /* + * The _dummy property. + */ + @Generated + private String dummy; + + /* + * The constant property. + */ + @Generated + private final String constant = "constant"; + + /** + * Creates an instance of SendLongRequest class. + * + * @param input the input value to set. + * @param dataInt the dataInt value to set. + * @param requiredUser the requiredUser value to set. + * @param title the title value to set. + * @param status the status value to set. + */ + @Generated + public SendLongRequest(String input, int dataInt, User requiredUser, String title, SendLongRequestStatus status) { + this.input = input; + this.dataInt = dataInt; + this.requiredUser = requiredUser; + this.title = title; + this.status = status; + } + + /** + * Get the user property: The user property. + * + * @return the user value. + */ + @Generated + public User getUser() { + return this.user; + } + + /** + * Set the user property: The user property. + * + * @param user the user value to set. + * @return the SendLongRequest object itself. + */ + @Generated + public SendLongRequest setUser(User user) { + this.user = user; + return this; + } + + /** + * Get the input property: The input property. + * + * @return the input value. + */ + @Generated + public String getInput() { + return this.input; + } + + /** + * Get the dataInt property: The dataInt property. + * + * @return the dataInt value. + */ + @Generated + public int getDataInt() { + return this.dataInt; + } + + /** + * Get the dataIntOptional property: The dataIntOptional property. + * + * @return the dataIntOptional value. + */ + @Generated + public Integer getDataIntOptional() { + return this.dataIntOptional; + } + + /** + * Set the dataIntOptional property: The dataIntOptional property. + * + * @param dataIntOptional the dataIntOptional value to set. + * @return the SendLongRequest object itself. + */ + @Generated + public SendLongRequest setDataIntOptional(Integer dataIntOptional) { + this.dataIntOptional = dataIntOptional; + return this; + } + + /** + * Get the dataLong property: The dataLong property. + * + * @return the dataLong value. + */ + @Generated + public Long getDataLong() { + return this.dataLong; + } + + /** + * Set the dataLong property: The dataLong property. + * + * @param dataLong the dataLong value to set. + * @return the SendLongRequest object itself. + */ + @Generated + public SendLongRequest setDataLong(Long dataLong) { + this.dataLong = dataLong; + return this; + } + + /** + * Get the requiredUser property: The requiredUser property. + * + * @return the requiredUser value. + */ + @Generated + public User getRequiredUser() { + return this.requiredUser; + } + + /** + * Get the dataFloat property: The data_float property. + * + * @return the dataFloat value. + */ + @Generated + public Double getDataFloat() { + return this.dataFloat; + } + + /** + * Set the dataFloat property: The data_float property. + * + * @param dataFloat the dataFloat value to set. + * @return the SendLongRequest object itself. + */ + @Generated + public SendLongRequest setDataFloat(Double dataFloat) { + this.dataFloat = dataFloat; + return this; + } + + /** + * Get the longProperty property: The long property. + * + * @return the longProperty value. + */ + @Generated + public Long getLongProperty() { + return this.longProperty; + } + + /** + * Set the longProperty property: The long property. + * + * @param longProperty the longProperty value to set. + * @return the SendLongRequest object itself. + */ + @Generated + public SendLongRequest setLongProperty(Long longProperty) { + this.longProperty = longProperty; + return this; + } + + /** + * Get the title property: The item's title. + * + * @return the title value. + */ + @Generated + public String getTitle() { + return this.title; + } + + /** + * Get the description property: A longer description of the todo item in markdown format. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: A longer description of the todo item in markdown format. + * + * @param description the description value to set. + * @return the SendLongRequest object itself. + */ + @Generated + public SendLongRequest setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the status property: The status of the todo item. + * + * @return the status value. + */ + @Generated + public SendLongRequestStatus getStatus() { + return this.status; + } + + /** + * Get the dummy property: The _dummy property. + * + * @return the dummy value. + */ + @Generated + public String getDummy() { + return this.dummy; + } + + /** + * Set the dummy property: The _dummy property. + * + * @param dummy the dummy value to set. + * @return the SendLongRequest object itself. + */ + @Generated + public SendLongRequest setDummy(String dummy) { + this.dummy = dummy; + return this; + } + + /** + * Get the constant property: The constant property. + * + * @return the constant value. + */ + @Generated + public String getConstant() { + return this.constant; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("input", this.input); + jsonWriter.writeIntField("dataInt", this.dataInt); + jsonWriter.writeJsonField("requiredUser", this.requiredUser); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("constant", this.constant); + jsonWriter.writeJsonField("user", this.user); + jsonWriter.writeNumberField("dataIntOptional", this.dataIntOptional); + jsonWriter.writeNumberField("dataLong", this.dataLong); + jsonWriter.writeNumberField("data_float", this.dataFloat); + jsonWriter.writeNumberField("long", this.longProperty); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("_dummy", this.dummy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendLongRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendLongRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendLongRequest. + */ + @Generated + public static SendLongRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String input = null; + int dataInt = 0; + User requiredUser = null; + String title = null; + SendLongRequestStatus status = null; + User user = null; + Integer dataIntOptional = null; + Long dataLong = null; + Double dataFloat = null; + Long longProperty = null; + String description = null; + String dummy = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("input".equals(fieldName)) { + input = reader.getString(); + } else if ("dataInt".equals(fieldName)) { + dataInt = reader.getInt(); + } else if ("requiredUser".equals(fieldName)) { + requiredUser = User.fromJson(reader); + } else if ("title".equals(fieldName)) { + title = reader.getString(); + } else if ("status".equals(fieldName)) { + status = SendLongRequestStatus.fromString(reader.getString()); + } else if ("user".equals(fieldName)) { + user = User.fromJson(reader); + } else if ("dataIntOptional".equals(fieldName)) { + dataIntOptional = reader.getNullable(JsonReader::getInt); + } else if ("dataLong".equals(fieldName)) { + dataLong = reader.getNullable(JsonReader::getLong); + } else if ("data_float".equals(fieldName)) { + dataFloat = reader.getNullable(JsonReader::getDouble); + } else if ("long".equals(fieldName)) { + longProperty = reader.getNullable(JsonReader::getLong); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("_dummy".equals(fieldName)) { + dummy = reader.getString(); + } else { + reader.skipChildren(); + } + } + SendLongRequest deserializedSendLongRequest + = new SendLongRequest(input, dataInt, requiredUser, title, status); + deserializedSendLongRequest.user = user; + deserializedSendLongRequest.dataIntOptional = dataIntOptional; + deserializedSendLongRequest.dataLong = dataLong; + deserializedSendLongRequest.dataFloat = dataFloat; + deserializedSendLongRequest.longProperty = longProperty; + deserializedSendLongRequest.description = description; + deserializedSendLongRequest.dummy = dummy; + + return deserializedSendLongRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendOptionalBodyRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendOptionalBodyRequest.java new file mode 100644 index 00000000000..f2b7a774997 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendOptionalBodyRequest.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SendOptionalBodyRequest model. + */ +@Fluent +public final class SendOptionalBodyRequest implements JsonSerializable { + /* + * The name property. + */ + @Generated + private String name; + + /** + * Creates an instance of SendOptionalBodyRequest class. + */ + @Generated + public SendOptionalBodyRequest() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the SendOptionalBodyRequest object itself. + */ + @Generated + public SendOptionalBodyRequest setName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendOptionalBodyRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendOptionalBodyRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SendOptionalBodyRequest. + */ + @Generated + public static SendOptionalBodyRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SendOptionalBodyRequest deserializedSendOptionalBodyRequest = new SendOptionalBodyRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSendOptionalBodyRequest.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSendOptionalBodyRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendProjectedNameRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendProjectedNameRequest.java new file mode 100644 index 00000000000..a32d0cb57bf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendProjectedNameRequest.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SendProjectedNameRequest model. + */ +@Immutable +public final class SendProjectedNameRequest implements JsonSerializable { + /* + * The file_id property. + */ + @Generated + private final String fileIdentifier; + + /** + * Creates an instance of SendProjectedNameRequest class. + * + * @param fileIdentifier the fileIdentifier value to set. + */ + @Generated + public SendProjectedNameRequest(String fileIdentifier) { + this.fileIdentifier = fileIdentifier; + } + + /** + * Get the fileIdentifier property: The file_id property. + * + * @return the fileIdentifier value. + */ + @Generated + public String getFileIdentifier() { + return this.fileIdentifier; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("file_id", this.fileIdentifier); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendProjectedNameRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendProjectedNameRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendProjectedNameRequest. + */ + @Generated + public static SendProjectedNameRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String fileIdentifier = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("file_id".equals(fieldName)) { + fileIdentifier = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new SendProjectedNameRequest(fileIdentifier); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendRequest.java new file mode 100644 index 00000000000..9570fca187f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/SendRequest.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.flatten.models.User; + +/** + * The SendRequest model. + */ +@Fluent +public final class SendRequest implements JsonSerializable { + /* + * The endpoint property. + */ + @Generated + private final String endpoint; + + /* + * The user property. + */ + @Generated + private User user; + + /* + * The input property. + */ + @Generated + private final String input; + + /* + * The constant property. + */ + @Generated + private final String constant = "constant"; + + /* + * The requiredInt property. + */ + @Generated + private final int requiredInt; + + /** + * Creates an instance of SendRequest class. + * + * @param endpoint the endpoint value to set. + * @param input the input value to set. + * @param requiredInt the requiredInt value to set. + */ + @Generated + public SendRequest(String endpoint, String input, int requiredInt) { + this.endpoint = endpoint; + this.input = input; + this.requiredInt = requiredInt; + } + + /** + * Get the endpoint property: The endpoint property. + * + * @return the endpoint value. + */ + @Generated + public String getEndpoint() { + return this.endpoint; + } + + /** + * Get the user property: The user property. + * + * @return the user value. + */ + @Generated + public User getUser() { + return this.user; + } + + /** + * Set the user property: The user property. + * + * @param user the user value to set. + * @return the SendRequest object itself. + */ + @Generated + public SendRequest setUser(User user) { + this.user = user; + return this; + } + + /** + * Get the input property: The input property. + * + * @return the input value. + */ + @Generated + public String getInput() { + return this.input; + } + + /** + * Get the constant property: The constant property. + * + * @return the constant value. + */ + @Generated + public String getConstant() { + return this.constant; + } + + /** + * Get the requiredInt property: The requiredInt property. + * + * @return the requiredInt value. + */ + @Generated + public int getRequiredInt() { + return this.requiredInt; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("endpoint", this.endpoint); + jsonWriter.writeStringField("input", this.input); + jsonWriter.writeStringField("constant", this.constant); + jsonWriter.writeIntField("requiredInt", this.requiredInt); + jsonWriter.writeJsonField("user", this.user); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendRequest. + */ + @Generated + public static SendRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String endpoint = null; + String input = null; + int requiredInt = 0; + User user = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("endpoint".equals(fieldName)) { + endpoint = reader.getString(); + } else if ("input".equals(fieldName)) { + input = reader.getString(); + } else if ("requiredInt".equals(fieldName)) { + requiredInt = reader.getInt(); + } else if ("user".equals(fieldName)) { + user = User.fromJson(reader); + } else { + reader.skipChildren(); + } + } + SendRequest deserializedSendRequest = new SendRequest(endpoint, input, requiredInt); + deserializedSendRequest.user = user; + + return deserializedSendRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/package-info.java new file mode 100644 index 00000000000..62f7e611d3b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Flatten. + * + */ +package tsptest.flatten.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/package-info.java new file mode 100644 index 00000000000..183df0b9444 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Flatten. + * + */ +package tsptest.flatten.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongOptions.java new file mode 100644 index 00000000000..dad0844b382 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongOptions.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; + +/** + * Options for sendLong API. + */ +@Fluent +public final class SendLongOptions { + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The filter property. + */ + @Generated + private String filter; + + /* + * The user property. + */ + @Generated + private User user; + + /* + * The input property. + */ + @Generated + private final String input; + + /* + * The dataInt property. + */ + @Generated + private final int dataInt; + + /* + * The dataIntOptional property. + */ + @Generated + private Integer dataIntOptional; + + /* + * The dataLong property. + */ + @Generated + private Long dataLong; + + /* + * The requiredUser property. + */ + @Generated + private final User requiredUser; + + /* + * The data_float property. + */ + @Generated + private Double dataFloat; + + /* + * The long property. + */ + @Generated + private Long longParameter; + + /* + * The item's title + */ + @Generated + private final String title; + + /* + * A longer description of the todo item in markdown format + */ + @Generated + private String description; + + /* + * The status of the todo item + */ + @Generated + private final SendLongRequestStatus status; + + /* + * The _dummy property. + */ + @Generated + private String dummy; + + /** + * Creates an instance of SendLongOptions class. + * + * @param name the name value to set. + * @param input the input value to set. + * @param dataInt the dataInt value to set. + * @param requiredUser the requiredUser value to set. + * @param title the title value to set. + * @param status the status value to set. + */ + @Generated + public SendLongOptions(String name, String input, int dataInt, User requiredUser, String title, + SendLongRequestStatus status) { + this.name = name; + this.input = input; + this.dataInt = dataInt; + this.requiredUser = requiredUser; + this.title = title; + this.status = status; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the filter property: The filter property. + * + * @return the filter value. + */ + @Generated + public String getFilter() { + return this.filter; + } + + /** + * Set the filter property: The filter property. + * + * @param filter the filter value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the user property: The user property. + * + * @return the user value. + */ + @Generated + public User getUser() { + return this.user; + } + + /** + * Set the user property: The user property. + * + * @param user the user value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setUser(User user) { + this.user = user; + return this; + } + + /** + * Get the input property: The input property. + * + * @return the input value. + */ + @Generated + public String getInput() { + return this.input; + } + + /** + * Get the dataInt property: The dataInt property. + * + * @return the dataInt value. + */ + @Generated + public int getDataInt() { + return this.dataInt; + } + + /** + * Get the dataIntOptional property: The dataIntOptional property. + * + * @return the dataIntOptional value. + */ + @Generated + public Integer getDataIntOptional() { + return this.dataIntOptional; + } + + /** + * Set the dataIntOptional property: The dataIntOptional property. + * + * @param dataIntOptional the dataIntOptional value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setDataIntOptional(Integer dataIntOptional) { + this.dataIntOptional = dataIntOptional; + return this; + } + + /** + * Get the dataLong property: The dataLong property. + * + * @return the dataLong value. + */ + @Generated + public Long getDataLong() { + return this.dataLong; + } + + /** + * Set the dataLong property: The dataLong property. + * + * @param dataLong the dataLong value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setDataLong(Long dataLong) { + this.dataLong = dataLong; + return this; + } + + /** + * Get the requiredUser property: The requiredUser property. + * + * @return the requiredUser value. + */ + @Generated + public User getRequiredUser() { + return this.requiredUser; + } + + /** + * Get the dataFloat property: The data_float property. + * + * @return the dataFloat value. + */ + @Generated + public Double getDataFloat() { + return this.dataFloat; + } + + /** + * Set the dataFloat property: The data_float property. + * + * @param dataFloat the dataFloat value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setDataFloat(Double dataFloat) { + this.dataFloat = dataFloat; + return this; + } + + /** + * Get the longParameter property: The long property. + * + * @return the longParameter value. + */ + @Generated + public Long getLongParameter() { + return this.longParameter; + } + + /** + * Set the longParameter property: The long property. + * + * @param longParameter the longParameter value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setLongParameter(Long longParameter) { + this.longParameter = longParameter; + return this; + } + + /** + * Get the title property: The item's title. + * + * @return the title value. + */ + @Generated + public String getTitle() { + return this.title; + } + + /** + * Get the description property: A longer description of the todo item in markdown format. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: A longer description of the todo item in markdown format. + * + * @param description the description value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the status property: The status of the todo item. + * + * @return the status value. + */ + @Generated + public SendLongRequestStatus getStatus() { + return this.status; + } + + /** + * Get the dummy property: The _dummy property. + * + * @return the dummy value. + */ + @Generated + public String getDummy() { + return this.dummy; + } + + /** + * Set the dummy property: The _dummy property. + * + * @param dummy the dummy value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setDummy(String dummy) { + this.dummy = dummy; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongRequestStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongRequestStatus.java new file mode 100644 index 00000000000..722804ac761 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/SendLongRequestStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.models; + +/** + * Defines values for SendLongRequestStatus. + */ +public enum SendLongRequestStatus { + /** + * Enum value NotStarted. + */ + NOT_STARTED("NotStarted"), + + /** + * Enum value InProgress. + */ + IN_PROGRESS("InProgress"), + + /** + * Enum value Completed. + */ + COMPLETED("Completed"); + + /** + * The actual serialized value for a SendLongRequestStatus instance. + */ + private final String value; + + SendLongRequestStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SendLongRequestStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed SendLongRequestStatus object, or null if unable to parse. + */ + public static SendLongRequestStatus fromString(String value) { + if (value == null) { + return null; + } + SendLongRequestStatus[] items = SendLongRequestStatus.values(); + for (SendLongRequestStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItem.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItem.java new file mode 100644 index 00000000000..7f1764ae777 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItem.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The TodoItem model. + */ +@Immutable +public final class TodoItem implements JsonSerializable { + /* + * The item's unique id + */ + @Generated + private long id; + + /* + * The item's title + */ + @Generated + private final String title; + + /* + * A longer description of the todo item in markdown format + */ + @Generated + private String description; + + /* + * The status of the todo item + */ + @Generated + private final SendLongRequestStatus status; + + /* + * When the todo item was created. + */ + @Generated + private OffsetDateTime createdAt; + + /* + * When the todo item was last updated + */ + @Generated + private OffsetDateTime updatedAt; + + /* + * When the todo item was makred as completed + */ + @Generated + private OffsetDateTime completedAt; + + /* + * The _dummy property. + */ + @Generated + private String dummy; + + /** + * Creates an instance of TodoItem class. + * + * @param title the title value to set. + * @param status the status value to set. + */ + @Generated + private TodoItem(String title, SendLongRequestStatus status) { + this.title = title; + this.status = status; + } + + /** + * Get the id property: The item's unique id. + * + * @return the id value. + */ + @Generated + public long getId() { + return this.id; + } + + /** + * Get the title property: The item's title. + * + * @return the title value. + */ + @Generated + public String getTitle() { + return this.title; + } + + /** + * Get the description property: A longer description of the todo item in markdown format. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Get the status property: The status of the todo item. + * + * @return the status value. + */ + @Generated + public SendLongRequestStatus getStatus() { + return this.status; + } + + /** + * Get the createdAt property: When the todo item was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Get the updatedAt property: When the todo item was last updated. + * + * @return the updatedAt value. + */ + @Generated + public OffsetDateTime getUpdatedAt() { + return this.updatedAt; + } + + /** + * Get the completedAt property: When the todo item was makred as completed. + * + * @return the completedAt value. + */ + @Generated + public OffsetDateTime getCompletedAt() { + return this.completedAt; + } + + /** + * Get the dummy property: The _dummy property. + * + * @return the dummy value. + */ + @Generated + public String getDummy() { + return this.dummy; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("_dummy", this.dummy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TodoItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TodoItem if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TodoItem. + */ + @Generated + public static TodoItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + long id = 0L; + String title = null; + SendLongRequestStatus status = null; + OffsetDateTime createdAt = null; + OffsetDateTime updatedAt = null; + String description = null; + OffsetDateTime completedAt = null; + String dummy = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getLong(); + } else if ("title".equals(fieldName)) { + title = reader.getString(); + } else if ("status".equals(fieldName)) { + status = SendLongRequestStatus.fromString(reader.getString()); + } else if ("createdAt".equals(fieldName)) { + createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("updatedAt".equals(fieldName)) { + updatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else if ("completedAt".equals(fieldName)) { + completedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("_dummy".equals(fieldName)) { + dummy = reader.getString(); + } else { + reader.skipChildren(); + } + } + TodoItem deserializedTodoItem = new TodoItem(title, status); + deserializedTodoItem.id = id; + deserializedTodoItem.createdAt = createdAt; + deserializedTodoItem.updatedAt = updatedAt; + deserializedTodoItem.description = description; + deserializedTodoItem.completedAt = completedAt; + deserializedTodoItem.dummy = dummy; + + return deserializedTodoItem; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatch.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatch.java new file mode 100644 index 00000000000..7c30ab7a70a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatch.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import tsptest.flatten.implementation.JsonMergePatchHelper; + +/** + * The TodoItemPatch model. + */ +@Fluent +public final class TodoItemPatch implements JsonSerializable { + /* + * The item's title + */ + @Generated + private String title; + + /* + * A longer description of the todo item in markdown format + */ + @Generated + private String description; + + /* + * The status of the todo item + */ + @Generated + private TodoItemPatchStatus status; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTodoItemPatchAccessor(new JsonMergePatchHelper.TodoItemPatchAccessor() { + @Override + public TodoItemPatch prepareModelForJsonMergePatch(TodoItemPatch model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TodoItemPatch model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TodoItemPatch class. + */ + @Generated + public TodoItemPatch() { + } + + /** + * Get the title property: The item's title. + * + * @return the title value. + */ + @Generated + public String getTitle() { + return this.title; + } + + /** + * Set the title property: The item's title. + * + * @param title the title value to set. + * @return the TodoItemPatch object itself. + */ + @Generated + public TodoItemPatch setTitle(String title) { + this.title = title; + this.updatedProperties.add("title"); + return this; + } + + /** + * Get the description property: A longer description of the todo item in markdown format. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: A longer description of the todo item in markdown format. + * + * @param description the description value to set. + * @return the TodoItemPatch object itself. + */ + @Generated + public TodoItemPatch setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * Get the status property: The status of the todo item. + * + * @return the status value. + */ + @Generated + public TodoItemPatchStatus getStatus() { + return this.status; + } + + /** + * Set the status property: The status of the todo item. + * + * @param status the status value to set. + * @return the TodoItemPatch object itself. + */ + @Generated + public TodoItemPatch setStatus(TodoItemPatchStatus status) { + this.status = status; + this.updatedProperties.add("status"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("title")) { + if (this.title == null) { + jsonWriter.writeNullField("title"); + } else { + jsonWriter.writeStringField("title", this.title); + } + } + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + if (updatedProperties.contains("status")) { + if (this.status == null) { + jsonWriter.writeNullField("status"); + } else { + jsonWriter.writeStringField("status", this.status.toString()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TodoItemPatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TodoItemPatch if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TodoItemPatch. + */ + @Generated + public static TodoItemPatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TodoItemPatch deserializedTodoItemPatch = new TodoItemPatch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedTodoItemPatch.title = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedTodoItemPatch.description = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedTodoItemPatch.status = TodoItemPatchStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTodoItemPatch; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatchStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatchStatus.java new file mode 100644 index 00000000000..c260baaf730 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/TodoItemPatchStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.models; + +/** + * Defines values for TodoItemPatchStatus. + */ +public enum TodoItemPatchStatus { + /** + * Enum value NotStarted. + */ + NOT_STARTED("NotStarted"), + + /** + * Enum value InProgress. + */ + IN_PROGRESS("InProgress"), + + /** + * Enum value Completed. + */ + COMPLETED("Completed"); + + /** + * The actual serialized value for a TodoItemPatchStatus instance. + */ + private final String value; + + TodoItemPatchStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TodoItemPatchStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed TodoItemPatchStatus object, or null if unable to parse. + */ + public static TodoItemPatchStatus fromString(String value) { + if (value == null) { + return null; + } + TodoItemPatchStatus[] items = TodoItemPatchStatus.values(); + for (TodoItemPatchStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/UpdatePatchRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/UpdatePatchRequest.java new file mode 100644 index 00000000000..3561305649d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/UpdatePatchRequest.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import tsptest.flatten.implementation.JsonMergePatchHelper; + +/** + * The UpdatePatchRequest model. + */ +@Fluent +public final class UpdatePatchRequest implements JsonSerializable { + /* + * The patch property. + */ + @Generated + private TodoItemPatch patch; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setUpdatePatchRequestAccessor(new JsonMergePatchHelper.UpdatePatchRequestAccessor() { + @Override + public UpdatePatchRequest prepareModelForJsonMergePatch(UpdatePatchRequest model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(UpdatePatchRequest model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of UpdatePatchRequest class. + */ + @Generated + public UpdatePatchRequest() { + } + + /** + * Get the patch property: The patch property. + * + * @return the patch value. + */ + @Generated + public TodoItemPatch getPatch() { + return this.patch; + } + + /** + * Set the patch property: The patch property. + *

Required when create the resource.

+ * + * @param patch the patch value to set. + * @return the UpdatePatchRequest object itself. + */ + @Generated + public UpdatePatchRequest setPatch(TodoItemPatch patch) { + this.patch = patch; + this.updatedProperties.add("patch"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("patch", this.patch); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("patch")) { + if (this.patch == null) { + jsonWriter.writeNullField("patch"); + } else { + JsonMergePatchHelper.getTodoItemPatchAccessor().prepareModelForJsonMergePatch(this.patch, true); + jsonWriter.writeJsonField("patch", this.patch); + JsonMergePatchHelper.getTodoItemPatchAccessor().prepareModelForJsonMergePatch(this.patch, false); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdatePatchRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdatePatchRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the UpdatePatchRequest. + */ + @Generated + public static UpdatePatchRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdatePatchRequest deserializedUpdatePatchRequest = new UpdatePatchRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("patch".equals(fieldName)) { + deserializedUpdatePatchRequest.patch = TodoItemPatch.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedUpdatePatchRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/User.java new file mode 100644 index 00000000000..03a1a63dcc0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/User.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The User model. + */ +@Immutable +public final class User implements JsonSerializable { + /* + * The user property. + */ + @Generated + private final String user; + + /** + * Creates an instance of User class. + * + * @param user the user value to set. + */ + @Generated + public User(String user) { + this.user = user; + } + + /** + * Get the user property: The user property. + * + * @return the user value. + */ + @Generated + public String getUser() { + return this.user; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("user", this.user); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of User from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the User. + */ + @Generated + public static User fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String user = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("user".equals(fieldName)) { + user = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new User(user); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/package-info.java new file mode 100644 index 00000000000..eb74590fb4b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Flatten. + * + */ +package tsptest.flatten.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/package-info.java new file mode 100644 index 00000000000..b550b566524 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/flatten/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Flatten. + * + */ +package tsptest.flatten; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalAsyncClient.java new file mode 100644 index 00000000000..741e46e36a7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalAsyncClient.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.internal.implementation.InternalOpsImpl; +import tsptest.internal.models.ApiRequest; +import tsptest.internal.models.ApiResponse; +import tsptest.internal.models.ResponseInternal; + +/** + * Initializes a new instance of the asynchronous InternalClient type. + */ +@ServiceClient(builder = InternalClientBuilder.class, isAsync = true) +public final class InternalAsyncClient { + @Generated + private final InternalOpsImpl serviceClient; + + /** + * Initializes an instance of InternalAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + InternalAsyncClient(InternalOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The postInternal operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postInternalWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postInternalWithResponseAsync(body, requestOptions); + } + + /** + * The getInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> getInternalWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getInternalWithResponseAsync(requestOptions); + } + + /** + * The postProtocalInternal operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> postProtocalInternalWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postProtocalInternalWithResponseAsync(body, requestOptions); + } + + /** + * The postInternal operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono postInternal(ApiRequest body) { + // Generated convenience method for postInternalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postInternalWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ResponseInternal.class)); + } + + /** + * The getInternal operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getInternal() { + // Generated convenience method for getInternalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getInternalWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ApiResponse.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClient.java new file mode 100644 index 00000000000..229e175da20 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClient.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.internal.implementation.InternalOpsImpl; +import tsptest.internal.models.ApiRequest; +import tsptest.internal.models.ApiResponse; +import tsptest.internal.models.ResponseInternal; + +/** + * Initializes a new instance of the synchronous InternalClient type. + */ +@ServiceClient(builder = InternalClientBuilder.class) +public final class InternalClient { + @Generated + private final InternalOpsImpl serviceClient; + + /** + * Initializes an instance of InternalClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + InternalClient(InternalOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The postInternal operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postInternalWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postInternalWithResponse(body, requestOptions); + } + + /** + * The getInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response getInternalWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getInternalWithResponse(requestOptions); + } + + /** + * The postProtocalInternal operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response postProtocalInternalWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postProtocalInternalWithResponse(body, requestOptions); + } + + /** + * The postInternal operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseInternal postInternal(ApiRequest body) { + // Generated convenience method for postInternalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postInternalWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(ResponseInternal.class); + } + + /** + * The getInternal operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + ApiResponse getInternal() { + // Generated convenience method for getInternalWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getInternalWithResponse(requestOptions).getValue().toObject(ApiResponse.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClientBuilder.java new file mode 100644 index 00000000000..dfa5a8b1051 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/InternalClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.internal.implementation.InternalClientImpl; + +/** + * A builder for creating a new instance of the InternalClient type. + */ +@ServiceClientBuilder(serviceClients = { InternalClient.class, InternalAsyncClient.class }) +public final class InternalClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-internal.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the InternalClientBuilder. + */ + @Generated + public InternalClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public InternalClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public InternalClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public InternalClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public InternalClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public InternalClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public InternalClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public InternalClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public InternalClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the InternalClientBuilder. + */ + @Generated + public InternalClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of InternalClientImpl with the provided parameters. + * + * @return an instance of InternalClientImpl. + */ + @Generated + private InternalClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + InternalClientImpl client + = new InternalClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of InternalAsyncClient class. + * + * @return an instance of InternalAsyncClient. + */ + @Generated + public InternalAsyncClient buildAsyncClient() { + return new InternalAsyncClient(buildInnerClient().getInternalOps()); + } + + /** + * Builds an instance of InternalClient class. + * + * @return an instance of InternalClient. + */ + @Generated + public InternalClient buildClient() { + return new InternalClient(buildInnerClient().getInternalOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(InternalClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalClientImpl.java new file mode 100644 index 00000000000..93e82ee04c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 InternalClient type. + */ +public final class InternalClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 InternalOpsImpl object to access its operations. + */ + private final InternalOpsImpl internalOps; + + /** + * Gets the InternalOpsImpl object to access its operations. + * + * @return the InternalOpsImpl object. + */ + public InternalOpsImpl getInternalOps() { + return this.internalOps; + } + + /** + * Initializes an instance of InternalClient client. + * + * @param endpoint Service host. + */ + public InternalClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of InternalClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public InternalClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of InternalClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public InternalClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.internalOps = new InternalOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalOpsImpl.java new file mode 100644 index 00000000000..03198d62bf8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/InternalOpsImpl.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in InternalOps. + */ +public final class InternalOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final InternalOpsService service; + + /** + * The service client containing this operation class. + */ + private final InternalClientImpl client; + + /** + * Initializes an instance of InternalOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InternalOpsImpl(InternalClientImpl client) { + this.service + = RestProxy.create(InternalOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for InternalClientInternalOps to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "InternalClientInternalOps") + public interface InternalOpsService { + @Post("/internal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> postInternal(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/internal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postInternalSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Get("/internal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getInternal(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/internal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getInternalSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/internal/protocal-internal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> postProtocalInternal(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/internal/protocal-internal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postProtocalInternalSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The postInternal operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postInternalWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.postInternal(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The postInternal operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         name: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postInternalWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.postInternalSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The getInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getInternalWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getInternal(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getInternal operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getInternalWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getInternalSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The postProtocalInternal operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postProtocalInternalWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.postProtocalInternal(this.client.getEndpoint(), contentType, + body, requestOptions, context)); + } + + /** + * The postProtocalInternal operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postProtocalInternalWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.postProtocalInternalSync(this.client.getEndpoint(), contentType, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/Color.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/Color.java new file mode 100644 index 00000000000..11a1bdaafcb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/Color.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.implementation.models; + +/** + * Defines values for Color. + */ +public enum Color { + /** + * Enum value Red. + */ + RED("Red"), + + /** + * Enum value Blue. + */ + BLUE("Blue"), + + /** + * Enum value Green. + */ + GREEN("Green"); + + /** + * The actual serialized value for a Color instance. + */ + private final String value; + + Color(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Color instance. + * + * @param value the serialized value to parse. + * @return the parsed Color object, or null if unable to parse. + */ + public static Color fromString(String value) { + if (value == null) { + return null; + } + Color[] items = Color.values(); + for (Color item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/ColorModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/ColorModel.java new file mode 100644 index 00000000000..c2c4775e9bc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/ColorModel.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ColorModel. + */ +public final class ColorModel extends ExpandableStringEnum { + /** + * Static value Red for ColorModel. + */ + @Generated + public static final ColorModel RED = fromString("Red"); + + /** + * Static value Blue for ColorModel. + */ + @Generated + public static final ColorModel BLUE = fromString("Blue"); + + /** + * Static value Green for ColorModel. + */ + @Generated + public static final ColorModel GREEN = fromString("Green"); + + /** + * Creates a new instance of ColorModel value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ColorModel() { + } + + /** + * Creates or finds a ColorModel from its string representation. + * + * @param name a name to look for. + * @return the corresponding ColorModel. + */ + @Generated + public static ColorModel fromString(String name) { + return fromString(name, ColorModel.class); + } + + /** + * Gets known ColorModel values. + * + * @return known ColorModel values. + */ + @Generated + public static Collection values() { + return values(ColorModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/package-info.java new file mode 100644 index 00000000000..207cacf666a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Internal. + * + */ +package tsptest.internal.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/package-info.java new file mode 100644 index 00000000000..1425143c5c8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Internal. + * + */ +package tsptest.internal.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiRequest.java new file mode 100644 index 00000000000..b326e0d7dbd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiRequest.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ApiRequest model. + */ +@Immutable +public final class ApiRequest implements JsonSerializable { + /* + * The property property. + */ + @Generated + private final RequestInner property; + + /** + * Creates an instance of ApiRequest class. + * + * @param property the property value to set. + */ + @Generated + public ApiRequest(RequestInner property) { + this.property = property; + } + + /** + * Get the property property: The property property. + * + * @return the property value. + */ + @Generated + public RequestInner getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApiRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApiRequest if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApiRequest. + */ + @Generated + public static ApiRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RequestInner property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = RequestInner.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new ApiRequest(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiResponse.java new file mode 100644 index 00000000000..79328cadf44 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ApiResponse.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ApiResponse model. + */ +@Immutable +public final class ApiResponse implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of ApiResponse class. + * + * @param name the name value to set. + */ + @Generated + private ApiResponse(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApiResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApiResponse if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApiResponse. + */ + @Generated + public static ApiResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ApiResponse(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/RequestInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/RequestInner.java new file mode 100644 index 00000000000..46ab385e2c7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/RequestInner.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The RequestInner model. + */ +@Immutable +public final class RequestInner implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of RequestInner class. + * + * @param name the name value to set. + */ + @Generated + public RequestInner(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequestInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequestInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RequestInner. + */ + @Generated + public static RequestInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new RequestInner(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternal.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternal.java new file mode 100644 index 00000000000..9fe25735f6f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternal.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ResponseInternal model. + */ +@Immutable +public final class ResponseInternal implements JsonSerializable { + /* + * The property property. + */ + @Generated + private final ResponseInternalInner property; + + /** + * Creates an instance of ResponseInternal class. + * + * @param property the property value to set. + */ + @Generated + private ResponseInternal(ResponseInternalInner property) { + this.property = property; + } + + /** + * Get the property property: The property property. + * + * @return the property value. + */ + @Generated + public ResponseInternalInner getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResponseInternal from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResponseInternal if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResponseInternal. + */ + @Generated + public static ResponseInternal fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResponseInternalInner property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = ResponseInternalInner.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new ResponseInternal(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternalInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternalInner.java new file mode 100644 index 00000000000..70b13fa6a22 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/ResponseInternalInner.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ResponseInternalInner model. + */ +@Immutable +public final class ResponseInternalInner implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of ResponseInternalInner class. + * + * @param name the name value to set. + */ + @Generated + private ResponseInternalInner(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResponseInternalInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResponseInternalInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResponseInternalInner. + */ + @Generated + public static ResponseInternalInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ResponseInternalInner(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneData.java new file mode 100644 index 00000000000..7b8157a139c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneData.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The StandAloneData model. + */ +@Immutable +public final class StandAloneData implements JsonSerializable { + /* + * The property property. + */ + @Generated + private final StandAloneDataInner property; + + /** + * Creates an instance of StandAloneData class. + * + * @param property the property value to set. + */ + @Generated + private StandAloneData(StandAloneDataInner property) { + this.property = property; + } + + /** + * Get the property property: The property property. + * + * @return the property value. + */ + @Generated + public StandAloneDataInner getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StandAloneData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StandAloneData if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StandAloneData. + */ + @Generated + public static StandAloneData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StandAloneDataInner property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = StandAloneDataInner.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new StandAloneData(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneDataInner.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneDataInner.java new file mode 100644 index 00000000000..963e9bc660b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/StandAloneDataInner.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The StandAloneDataInner model. + */ +@Immutable +public final class StandAloneDataInner implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of StandAloneDataInner class. + * + * @param name the name value to set. + */ + @Generated + public StandAloneDataInner(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StandAloneDataInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StandAloneDataInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StandAloneDataInner. + */ + @Generated + public static StandAloneDataInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new StandAloneDataInner(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/UnusedEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/UnusedEnum.java new file mode 100644 index 00000000000..4c570593e38 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/UnusedEnum.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for UnusedEnum. + */ +public final class UnusedEnum extends ExpandableStringEnum { + /** + * Static value Weekday for UnusedEnum. + */ + @Generated + public static final UnusedEnum WEEKDAY = fromString("Weekday"); + + /** + * Static value Weekend for UnusedEnum. + */ + @Generated + public static final UnusedEnum WEEKEND = fromString("Weekend"); + + /** + * Creates a new instance of UnusedEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public UnusedEnum() { + } + + /** + * Creates or finds a UnusedEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding UnusedEnum. + */ + @Generated + public static UnusedEnum fromString(String name) { + return fromString(name, UnusedEnum.class); + } + + /** + * Gets known UnusedEnum values. + * + * @return known UnusedEnum values. + */ + @Generated + public static Collection values() { + return values(UnusedEnum.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/package-info.java new file mode 100644 index 00000000000..7dc72139b17 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Internal. + * + */ +package tsptest.internal.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/package-info.java new file mode 100644 index 00000000000..96b804dfd10 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/internal/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Internal. + * + */ +package tsptest.internal; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceAsyncClient.java new file mode 100644 index 00000000000..eb1a0778eaa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceAsyncClient.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.literalservice; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.literalservice.implementation.LiteralOpsImpl; +import tsptest.literalservice.models.Model; +import tsptest.literalservice.models.PutRequestOptionalLiteralParam; + +/** + * Initializes a new instance of the asynchronous LiteralServiceClient type. + */ +@ServiceClient(builder = LiteralServiceClientBuilder.class, isAsync = true) +public final class LiteralServiceAsyncClient { + @Generated + private final LiteralOpsImpl serviceClient; + + /** + * Initializes an instance of LiteralServiceAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + LiteralServiceAsyncClient(LiteralOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The put operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
optionalLiteralParamStringNoThe optionalLiteralParam parameter. Allowed + * values: "optionalLiteralParam".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     literal: String (Required)
+     *     optionalLiteral: String(optionalLiteral) (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     literal: String (Required)
+     *     optionalLiteral: String(optionalLiteral) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @param optionalLiteralParam The optionalLiteralParam parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Model body, PutRequestOptionalLiteralParam optionalLiteralParam) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (optionalLiteralParam != null) { + requestOptions.addQueryParam("optionalLiteralParam", optionalLiteralParam.toString(), false); + } + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Model.class)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Model body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Model.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClient.java new file mode 100644 index 00000000000..75ff2aacc58 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClient.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.literalservice; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.literalservice.implementation.LiteralOpsImpl; +import tsptest.literalservice.models.Model; +import tsptest.literalservice.models.PutRequestOptionalLiteralParam; + +/** + * Initializes a new instance of the synchronous LiteralServiceClient type. + */ +@ServiceClient(builder = LiteralServiceClientBuilder.class) +public final class LiteralServiceClient { + @Generated + private final LiteralOpsImpl serviceClient; + + /** + * Initializes an instance of LiteralServiceClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + LiteralServiceClient(LiteralOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The put operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
optionalLiteralParamStringNoThe optionalLiteralParam parameter. Allowed + * values: "optionalLiteralParam".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     literal: String (Required)
+     *     optionalLiteral: String(optionalLiteral) (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     literal: String (Required)
+     *     optionalLiteral: String(optionalLiteral) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @param optionalLiteralParam The optionalLiteralParam parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Model put(Model body, PutRequestOptionalLiteralParam optionalLiteralParam) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (optionalLiteralParam != null) { + requestOptions.addQueryParam("optionalLiteralParam", optionalLiteralParam.toString(), false); + } + return putWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(Model.class); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Model put(Model body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(Model.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClientBuilder.java new file mode 100644 index 00000000000..e3ff46af1ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/LiteralServiceClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.literalservice; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.literalservice.implementation.LiteralServiceClientImpl; + +/** + * A builder for creating a new instance of the LiteralServiceClient type. + */ +@ServiceClientBuilder(serviceClients = { LiteralServiceClient.class, LiteralServiceAsyncClient.class }) +public final class LiteralServiceClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-literalservice.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the LiteralServiceClientBuilder. + */ + @Generated + public LiteralServiceClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LiteralServiceClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LiteralServiceClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LiteralServiceClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LiteralServiceClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LiteralServiceClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LiteralServiceClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LiteralServiceClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LiteralServiceClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the LiteralServiceClientBuilder. + */ + @Generated + public LiteralServiceClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of LiteralServiceClientImpl with the provided parameters. + * + * @return an instance of LiteralServiceClientImpl. + */ + @Generated + private LiteralServiceClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + LiteralServiceClientImpl client = new LiteralServiceClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of LiteralServiceAsyncClient class. + * + * @return an instance of LiteralServiceAsyncClient. + */ + @Generated + public LiteralServiceAsyncClient buildAsyncClient() { + return new LiteralServiceAsyncClient(buildInnerClient().getLiteralOps()); + } + + /** + * Builds an instance of LiteralServiceClient class. + * + * @return an instance of LiteralServiceClient. + */ + @Generated + public LiteralServiceClient buildClient() { + return new LiteralServiceClient(buildInnerClient().getLiteralOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(LiteralServiceClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralOpsImpl.java new file mode 100644 index 00000000000..b6bcb81fce3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralOpsImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.literalservice.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in LiteralOps. + */ +public final class LiteralOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final LiteralOpsService service; + + /** + * The service client containing this operation class. + */ + private final LiteralServiceClientImpl client; + + /** + * Initializes an instance of LiteralOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LiteralOpsImpl(LiteralServiceClientImpl client) { + this.service + = RestProxy.create(LiteralOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for LiteralServiceClientLiteralOps to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "LiteralServiceClientLiteralOps") + public interface LiteralOpsService { + @Put("/literal/put") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @QueryParam("literalParam") String literalParam, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/literal/put") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, + @QueryParam("literalParam") String literalParam, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The put operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
optionalLiteralParamStringNoThe optionalLiteralParam parameter. Allowed + * values: "optionalLiteralParam".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     literal: String (Required)
+     *     optionalLiteral: String(optionalLiteral) (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     literal: String (Required)
+     *     optionalLiteral: String(optionalLiteral) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String literalParam = "literalParam"; + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.put(this.client.getEndpoint(), literalParam, contentType, accept, + body, requestOptions, context)); + } + + /** + * The put operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
optionalLiteralParamStringNoThe optionalLiteralParam parameter. Allowed + * values: "optionalLiteralParam".
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     literal: String (Required)
+     *     optionalLiteral: String(optionalLiteral) (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     literal: String (Required)
+     *     optionalLiteral: String(optionalLiteral) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String literalParam = "literalParam"; + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putSync(this.client.getEndpoint(), literalParam, contentType, accept, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralServiceClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralServiceClientImpl.java new file mode 100644 index 00000000000..6ff79e5eded --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/LiteralServiceClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.literalservice.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 LiteralServiceClient type. + */ +public final class LiteralServiceClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 LiteralOpsImpl object to access its operations. + */ + private final LiteralOpsImpl literalOps; + + /** + * Gets the LiteralOpsImpl object to access its operations. + * + * @return the LiteralOpsImpl object. + */ + public LiteralOpsImpl getLiteralOps() { + return this.literalOps; + } + + /** + * Initializes an instance of LiteralServiceClient client. + * + * @param endpoint Service host. + */ + public LiteralServiceClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of LiteralServiceClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public LiteralServiceClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of LiteralServiceClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public LiteralServiceClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.literalOps = new LiteralOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/package-info.java new file mode 100644 index 00000000000..476313ade5e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for LiteralService. + * + */ +package tsptest.literalservice.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/Model.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/Model.java new file mode 100644 index 00000000000..d43ed2de5c3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/Model.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.literalservice.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Model model. + */ +@Fluent +public final class Model implements JsonSerializable { + /* + * The literal property. + */ + @Generated + private final String literal = "literal"; + + /* + * The optionalLiteral property. + */ + @Generated + private ModelOptionalLiteral optionalLiteral; + + /** + * Creates an instance of Model class. + */ + @Generated + public Model() { + } + + /** + * Get the literal property: The literal property. + * + * @return the literal value. + */ + @Generated + public String getLiteral() { + return this.literal; + } + + /** + * Get the optionalLiteral property: The optionalLiteral property. + * + * @return the optionalLiteral value. + */ + @Generated + public ModelOptionalLiteral getOptionalLiteral() { + return this.optionalLiteral; + } + + /** + * Set the optionalLiteral property: The optionalLiteral property. + * + * @param optionalLiteral the optionalLiteral value to set. + * @return the Model object itself. + */ + @Generated + public Model setOptionalLiteral(ModelOptionalLiteral optionalLiteral) { + this.optionalLiteral = optionalLiteral; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("literal", this.literal); + jsonWriter.writeStringField("optionalLiteral", + this.optionalLiteral == null ? null : this.optionalLiteral.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Model from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Model if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Model. + */ + @Generated + public static Model fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Model deserializedModel = new Model(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("optionalLiteral".equals(fieldName)) { + deserializedModel.optionalLiteral = ModelOptionalLiteral.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/ModelOptionalLiteral.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/ModelOptionalLiteral.java new file mode 100644 index 00000000000..eef2eb09faa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/ModelOptionalLiteral.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.literalservice.models; + +/** + * Defines values for ModelOptionalLiteral. + */ +public enum ModelOptionalLiteral { + /** + * Enum value optionalLiteral. + */ + OPTIONAL_LITERAL("optionalLiteral"); + + /** + * The actual serialized value for a ModelOptionalLiteral instance. + */ + private final String value; + + ModelOptionalLiteral(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ModelOptionalLiteral instance. + * + * @param value the serialized value to parse. + * @return the parsed ModelOptionalLiteral object, or null if unable to parse. + */ + public static ModelOptionalLiteral fromString(String value) { + if (value == null) { + return null; + } + ModelOptionalLiteral[] items = ModelOptionalLiteral.values(); + for (ModelOptionalLiteral item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/PutRequestOptionalLiteralParam.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/PutRequestOptionalLiteralParam.java new file mode 100644 index 00000000000..cb7a97ebb06 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/PutRequestOptionalLiteralParam.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.literalservice.models; + +/** + * Defines values for PutRequestOptionalLiteralParam. + */ +public enum PutRequestOptionalLiteralParam { + /** + * Enum value optionalLiteralParam. + */ + OPTIONAL_LITERAL_PARAM("optionalLiteralParam"); + + /** + * The actual serialized value for a PutRequestOptionalLiteralParam instance. + */ + private final String value; + + PutRequestOptionalLiteralParam(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PutRequestOptionalLiteralParam instance. + * + * @param value the serialized value to parse. + * @return the parsed PutRequestOptionalLiteralParam object, or null if unable to parse. + */ + public static PutRequestOptionalLiteralParam fromString(String value) { + if (value == null) { + return null; + } + PutRequestOptionalLiteralParam[] items = PutRequestOptionalLiteralParam.values(); + for (PutRequestOptionalLiteralParam item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/package-info.java new file mode 100644 index 00000000000..da89123155d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for LiteralService. + * + */ +package tsptest.literalservice.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/package-info.java new file mode 100644 index 00000000000..585a4c7d317 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/literalservice/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for LiteralService. + * + */ +package tsptest.literalservice; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningAsyncClient.java new file mode 100644 index 00000000000..83b4583935e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningAsyncClient.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import reactor.core.publisher.Mono; +import tsptest.longrunning.implementation.LongRunningClientImpl; +import tsptest.longrunning.models.JobData; +import tsptest.longrunning.models.JobResult; +import tsptest.longrunning.models.JobResultResult; +import tsptest.longrunning.models.PollResponse; + +/** + * Initializes a new instance of the asynchronous LongRunningClient type. + */ +@ServiceClient(builder = LongRunningClientBuilder.class, isAsync = true) +public final class LongRunningAsyncClient { + @Generated + private final LongRunningClientImpl serviceClient; + + /** + * Initializes an instance of LongRunningAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + LongRunningAsyncClient(LongRunningClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The longRunning operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLongRunning(RequestOptions requestOptions) { + return this.serviceClient.beginLongRunningAsync(requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     expirationDateTime: OffsetDateTime (Optional)
+     *     lastUpdateDateTime: OffsetDateTime (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getJobWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.getJobWithResponseAsync(id, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     configuration: String (Optional)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     expirationDateTime: OffsetDateTime (Optional)
+     *     lastUpdateDateTime: OffsetDateTime (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateJob(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.beginCreateJobAsync(body, requestOptions); + } + + /** + * The longRunning operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLongRunning() { + // Generated convenience method for beginLongRunningWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginLongRunningWithModelAsync(requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param id The id parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getJob(String id) { + // Generated convenience method for getJobWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getJobWithResponse(id, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(JobResult.class)); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateJob(JobData body) { + // Generated convenience method for beginCreateJobWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginCreateJobWithModelAsync(BinaryData.fromObject(body), requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClient.java new file mode 100644 index 00000000000..f7c32401a8c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClient.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.SyncPoller; +import tsptest.longrunning.implementation.LongRunningClientImpl; +import tsptest.longrunning.models.JobData; +import tsptest.longrunning.models.JobResult; +import tsptest.longrunning.models.JobResultResult; +import tsptest.longrunning.models.PollResponse; + +/** + * Initializes a new instance of the synchronous LongRunningClient type. + */ +@ServiceClient(builder = LongRunningClientBuilder.class) +public final class LongRunningClient { + @Generated + private final LongRunningClientImpl serviceClient; + + /** + * Initializes an instance of LongRunningClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + LongRunningClient(LongRunningClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The longRunning operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLongRunning(RequestOptions requestOptions) { + return this.serviceClient.beginLongRunning(requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     expirationDateTime: OffsetDateTime (Optional)
+     *     lastUpdateDateTime: OffsetDateTime (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getJobWithResponse(String id, RequestOptions requestOptions) { + return this.serviceClient.getJobWithResponse(id, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     configuration: String (Optional)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     expirationDateTime: OffsetDateTime (Optional)
+     *     lastUpdateDateTime: OffsetDateTime (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateJob(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.beginCreateJob(body, requestOptions); + } + + /** + * The longRunning operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLongRunning() { + // Generated convenience method for beginLongRunningWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginLongRunningWithModel(requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param id The id parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public JobResult getJob(String id) { + // Generated convenience method for getJobWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getJobWithResponse(id, requestOptions).getValue().toObject(JobResult.class); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateJob(JobData body) { + // Generated convenience method for beginCreateJobWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginCreateJobWithModel(BinaryData.fromObject(body), requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClientBuilder.java new file mode 100644 index 00000000000..48832179766 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.longrunning.implementation.LongRunningClientImpl; + +/** + * A builder for creating a new instance of the LongRunningClient type. + */ +@ServiceClientBuilder(serviceClients = { LongRunningClient.class, LongRunningAsyncClient.class }) +public final class LongRunningClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-longrunning.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the LongRunningClientBuilder. + */ + @Generated + public LongRunningClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LongRunningClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LongRunningClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LongRunningClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LongRunningClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LongRunningClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LongRunningClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LongRunningClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public LongRunningClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private LongRunningServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the LongRunningClientBuilder. + */ + @Generated + public LongRunningClientBuilder serviceVersion(LongRunningServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the LongRunningClientBuilder. + */ + @Generated + public LongRunningClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of LongRunningClientImpl with the provided parameters. + * + * @return an instance of LongRunningClientImpl. + */ + @Generated + private LongRunningClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + LongRunningServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : LongRunningServiceVersion.getLatest(); + LongRunningClientImpl client = new LongRunningClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of LongRunningAsyncClient class. + * + * @return an instance of LongRunningAsyncClient. + */ + @Generated + public LongRunningAsyncClient buildAsyncClient() { + return new LongRunningAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of LongRunningClient class. + * + * @return an instance of LongRunningClient. + */ + @Generated + public LongRunningClient buildClient() { + return new LongRunningClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(LongRunningClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningServiceVersion.java new file mode 100644 index 00000000000..e72016bd01b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/LongRunningServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of LongRunningClient. + */ +public enum LongRunningServiceVersion implements ServiceVersion { + /** + * Enum value 2022-06-01-preview. + */ + V2022_06_01_PREVIEW("2022-06-01-preview"); + + private final String version; + + LongRunningServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link LongRunningServiceVersion}. + */ + public static LongRunningServiceVersion getLatest() { + return V2022_06_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/LongRunningClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/LongRunningClientImpl.java new file mode 100644 index 00000000000..735f725ed6a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/LongRunningClientImpl.java @@ -0,0 +1,880 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.DefaultPollingStrategy; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncDefaultPollingStrategy; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; +import tsptest.longrunning.LongRunningServiceVersion; +import tsptest.longrunning.models.JobResult; +import tsptest.longrunning.models.JobResultResult; +import tsptest.longrunning.models.PollResponse; + +/** + * Initializes a new instance of the LongRunningClient type. + */ +public final class LongRunningClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final LongRunningClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final LongRunningServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public LongRunningServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of LongRunningClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public LongRunningClientImpl(String endpoint, LongRunningServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of LongRunningClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public LongRunningClientImpl(HttpPipeline httpPipeline, String endpoint, LongRunningServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of LongRunningClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public LongRunningClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + LongRunningServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(LongRunningClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for LongRunningClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "LongRunningClient") + public interface LongRunningClientService { + @Post("/long-running/post") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> longRunning(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Post("/long-running/post") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response longRunningSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/long-running/jobs/{id}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getJob(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/long-running/jobs/{id}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getJobSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("id") String id, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/long-running/jobs") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createJob(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/long-running/jobs") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createJobSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The longRunning operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> longRunningWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.longRunning(this.getEndpoint(), requestOptions, context)); + } + + /** + * The longRunning operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response longRunningWithResponse(RequestOptions requestOptions) { + return service.longRunningSync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The longRunning operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLongRunningWithModelAsync(RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), () -> this.longRunningWithResponseAsync(requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE)), + TypeReference.createInstance(PollResponse.class), TypeReference.createInstance(Void.class)); + } + + /** + * The longRunning operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLongRunningWithModel(RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.longRunningWithResponse(requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE)), + TypeReference.createInstance(PollResponse.class), TypeReference.createInstance(Void.class)); + } + + /** + * The longRunning operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLongRunningAsync(RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), () -> this.longRunningWithResponseAsync(requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE)), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * The longRunning operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLongRunning(RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.longRunningWithResponse(requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE)), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * A remote procedure call (RPC) operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     expirationDateTime: OffsetDateTime (Optional)
+     *     lastUpdateDateTime: OffsetDateTime (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getJobWithResponseAsync(String id, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getJob(this.getEndpoint(), this.getServiceVersion().getVersion(), + id, accept, requestOptions, context)); + } + + /** + * A remote procedure call (RPC) operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     expirationDateTime: OffsetDateTime (Optional)
+     *     lastUpdateDateTime: OffsetDateTime (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getJobWithResponse(String id, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getJobSync(this.getEndpoint(), this.getServiceVersion().getVersion(), id, accept, requestOptions, + Context.NONE); + } + + /** + * A remote procedure call (RPC) operation. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     configuration: String (Optional)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     expirationDateTime: OffsetDateTime (Optional)
+     *     lastUpdateDateTime: OffsetDateTime (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createJobWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return FluxUtil.withContext(context -> service.createJob(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, accept, body, requestOptionsLocal, context)); + } + + /** + * A remote procedure call (RPC) operation. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     configuration: String (Optional)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     expirationDateTime: OffsetDateTime (Optional)
+     *     lastUpdateDateTime: OffsetDateTime (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createJobWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return service.createJobSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, + body, requestOptionsLocal, Context.NONE); + } + + /** + * A remote procedure call (RPC) operation. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     configuration: String (Optional)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     expirationDateTime: OffsetDateTime (Optional)
+     *     lastUpdateDateTime: OffsetDateTime (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateJobWithModelAsync(BinaryData body, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), () -> this.createJobWithResponseAsync(body, requestOptions), + new tsptest.longrunning.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(JobResult.class), TypeReference.createInstance(JobResultResult.class)); + } + + /** + * A remote procedure call (RPC) operation. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     configuration: String (Optional)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     expirationDateTime: OffsetDateTime (Optional)
+     *     lastUpdateDateTime: OffsetDateTime (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateJobWithModel(BinaryData body, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.createJobWithResponse(body, requestOptions), + new tsptest.longrunning.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(JobResult.class), TypeReference.createInstance(JobResultResult.class)); + } + + /** + * A remote procedure call (RPC) operation. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     configuration: String (Optional)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     expirationDateTime: OffsetDateTime (Optional)
+     *     lastUpdateDateTime: OffsetDateTime (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateJobAsync(BinaryData body, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), () -> this.createJobWithResponseAsync(body, requestOptions), + new tsptest.longrunning.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * A remote procedure call (RPC) operation. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     configuration: String (Optional)
+     *     nullableFloatDict (Required): {
+     *         String: Double (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(notStarted/running/Succeeded/Failed/canceled) (Required)
+     *     createdDateTime: OffsetDateTime (Optional)
+     *     expirationDateTime: OffsetDateTime (Optional)
+     *     lastUpdateDateTime: OffsetDateTime (Optional)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateJob(BinaryData body, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.createJobWithResponse(body, requestOptions), + new tsptest.longrunning.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/OperationLocationPollingStrategy.java new file mode 100644 index 00000000000..235d597dd72 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/OperationLocationPollingStrategy.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.OperationResourcePollingStrategy; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +/** + * Implements an operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public Mono> onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + final Mono> pollResponseMono + = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) + .onErrorResume(exception -> { + LOGGER.info("Failed to parse initial response."); + return Mono.empty(); + }) + .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); + return pollResponseMono.switchIfEmpty( + Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); + } else { + return Mono + .error( + new AzureException(String.format( + "Operation failed or cancelled with status code %d," + + ", '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + } + + /** + * {@inheritDoc} + */ + @Override + public Mono getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + return Mono.error(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + return Mono.error(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + return PollingUtils + .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) + .flatMap(value -> { + if (value.get(propertyName) != null) { + return BinaryData.fromObjectAsync(value.get(propertyName)) + .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); + } else { + return Mono.error(new AzureException("Cannot get final result")); + } + }) + .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/PollingUtils.java new file mode 100644 index 00000000000..3f3bcb9438c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/PollingUtils.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.implementation; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.net.URI; +import java.net.URISyntaxException; +import java.time.DateTimeException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +final class PollingUtils { + + public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE + = new TypeReference>() { + }; + + public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); + + public static final String HTTP_METHOD = "httpMethod"; + public static final String REQUEST_URL = "requestURL"; + public static final String POLL_RESPONSE_BODY = "pollResponseBody"; + + private static final String FORWARD_SLASH = "/"; + + public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { + try { + URI uri = new URI(path); + if (!uri.isAbsolute()) { + if (CoreUtils.isNullOrEmpty(endpoint)) { + throw logger.logExceptionAsError(new IllegalArgumentException( + "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); + } + + if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { + return endpoint + path.substring(1); + } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { + return endpoint + FORWARD_SLASH + path; + } else { + return endpoint + path; + } + } + } catch (URISyntaxException ex) { + throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); + } + return path; + } + + public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + T value; + if (binaryData == null) { + value = null; + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); + } else { + value = binaryData.toObject(typeReference, serializer); + } + return value; + } + + @SuppressWarnings("unchecked") + public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + Mono value; + if (binaryData == null) { + value = Mono.empty(); + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = (Mono) binaryData.toReplayableBinaryDataAsync(); + } else { + value = binaryData.toObjectAsync(typeReference, serializer); + } + return value; + } + + private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); + private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); + + public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { + // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. + Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. + retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then + // attempt to resolve it as an HTTP date (RFC1123). + retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, + headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); + + // Either the retry delay will have been found or it'll be null, null indicates no retry after. + return retryDelay; + } + + private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, + Function delayParser) { + String headerValue = headers.getValue(headerName); + + return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); + } + + private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { + long delaySeconds; + try { + OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); + + delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); + } catch (DateTimeException ex) { + delaySeconds = tryParseLong(value); + } + + return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; + } + + private static long tryParseLong(String value) { + try { + return Long.parseLong(value); + } catch (NumberFormatException ex) { + return -1; + } + } + + private static Duration tryGetDelayMillis(String value) { + long delayMillis = tryParseLong(value); + return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/SyncOperationLocationPollingStrategy.java new file mode 100644 index 00000000000..d3bd8e98176 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/SyncOperationLocationPollingStrategy.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.io.UncheckedIOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Map; + +// DO NOT modify this helper class + +/** + * Implements a synchronous operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public PollResponse onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + T initialResponseType = null; + try { + initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, + pollResponseType); + } catch (UncheckedIOException e) { + LOGGER.info("Failed to parse initial response."); + } + return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); + } + + throw LOGGER.logExceptionAsError(new AzureException( + String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + + /** + * {@inheritDoc} + */ + public U getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, + PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); + if (pollResult != null && pollResult.get(propertyName) != null) { + return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), + serializer, resultType); + } else { + throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); + } + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/package-info.java new file mode 100644 index 00000000000..ed38e6d5925 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for LongRunning. + * + */ +package tsptest.longrunning.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobData.java new file mode 100644 index 00000000000..162c3f3ffa1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobData.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The JobData model. + */ +@Fluent +public final class JobData implements JsonSerializable { + /* + * The configuration property. + */ + @Generated + private String configuration; + + /* + * The nullableFloatDict property. + */ + @Generated + private final Map nullableFloatDict; + + /** + * Creates an instance of JobData class. + * + * @param nullableFloatDict the nullableFloatDict value to set. + */ + @Generated + public JobData(Map nullableFloatDict) { + this.nullableFloatDict = nullableFloatDict; + } + + /** + * Get the configuration property: The configuration property. + * + * @return the configuration value. + */ + @Generated + public String getConfiguration() { + return this.configuration; + } + + /** + * Set the configuration property: The configuration property. + * + * @param configuration the configuration value to set. + * @return the JobData object itself. + */ + @Generated + public JobData setConfiguration(String configuration) { + this.configuration = configuration; + return this; + } + + /** + * Get the nullableFloatDict property: The nullableFloatDict property. + * + * @return the nullableFloatDict value. + */ + @Generated + public Map getNullableFloatDict() { + return this.nullableFloatDict; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("nullableFloatDict", this.nullableFloatDict, + (writer, element) -> writer.writeNumber(element)); + jsonWriter.writeStringField("configuration", this.configuration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobData if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JobData. + */ + @Generated + public static JobData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Map nullableFloatDict = null; + String configuration = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nullableFloatDict".equals(fieldName)) { + nullableFloatDict = reader.readMap(reader1 -> reader1.getNullable(JsonReader::getDouble)); + } else if ("configuration".equals(fieldName)) { + configuration = reader.getString(); + } else { + reader.skipChildren(); + } + } + JobData deserializedJobData = new JobData(nullableFloatDict); + deserializedJobData.configuration = configuration; + + return deserializedJobData; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResult.java new file mode 100644 index 00000000000..47f55c61f89 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResult.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The JobResult model. + */ +@Immutable +public final class JobResult implements JsonSerializable { + /* + * The id property. + */ + @Generated + private String id; + + /* + * The status property. + */ + @Generated + private JobStatus status; + + /* + * The createdDateTime property. + */ + @Generated + private OffsetDateTime createdDateTime; + + /* + * The expirationDateTime property. + */ + @Generated + private OffsetDateTime expirationDateTime; + + /* + * The lastUpdateDateTime property. + */ + @Generated + private OffsetDateTime lastUpdateDateTime; + + /* + * The error property. + */ + @Generated + private ResponseError error; + + /* + * The result property. + */ + @Generated + private JobResultResult result; + + /** + * Creates an instance of JobResult class. + */ + @Generated + private JobResult() { + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the status property: The status property. + * + * @return the status value. + */ + @Generated + public JobStatus getStatus() { + return this.status; + } + + /** + * Get the createdDateTime property: The createdDateTime property. + * + * @return the createdDateTime value. + */ + @Generated + public OffsetDateTime getCreatedDateTime() { + return this.createdDateTime; + } + + /** + * Get the expirationDateTime property: The expirationDateTime property. + * + * @return the expirationDateTime value. + */ + @Generated + public OffsetDateTime getExpirationDateTime() { + return this.expirationDateTime; + } + + /** + * Get the lastUpdateDateTime property: The lastUpdateDateTime property. + * + * @return the lastUpdateDateTime value. + */ + @Generated + public OffsetDateTime getLastUpdateDateTime() { + return this.lastUpdateDateTime; + } + + /** + * Get the error property: The error property. + * + * @return the error value. + */ + @Generated + public ResponseError getError() { + return this.error; + } + + /** + * Get the result property: The result property. + * + * @return the result value. + */ + @Generated + public JobResultResult getResult() { + return this.result; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("error", this.error); + jsonWriter.writeJsonField("result", this.result); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobResult if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JobResult. + */ + @Generated + public static JobResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + JobResult deserializedJobResult = new JobResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedJobResult.id = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedJobResult.status = JobStatus.fromString(reader.getString()); + } else if ("createdDateTime".equals(fieldName)) { + deserializedJobResult.createdDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("expirationDateTime".equals(fieldName)) { + deserializedJobResult.expirationDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastUpdateDateTime".equals(fieldName)) { + deserializedJobResult.lastUpdateDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("error".equals(fieldName)) { + deserializedJobResult.error = ResponseError.fromJson(reader); + } else if ("result".equals(fieldName)) { + deserializedJobResult.result = JobResultResult.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedJobResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResultResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResultResult.java new file mode 100644 index 00000000000..7d78e39f6f5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobResultResult.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The JobResultResult model. + */ +@Immutable +public final class JobResultResult implements JsonSerializable { + /* + * The data property. + */ + @Generated + private final String data; + + /** + * Creates an instance of JobResultResult class. + * + * @param data the data value to set. + */ + @Generated + private JobResultResult(String data) { + this.data = data; + } + + /** + * Get the data property: The data property. + * + * @return the data value. + */ + @Generated + public String getData() { + return this.data; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("data", this.data); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of JobResultResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of JobResultResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the JobResultResult. + */ + @Generated + public static JobResultResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String data = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data".equals(fieldName)) { + data = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new JobResultResult(data); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobStatus.java new file mode 100644 index 00000000000..94c93571c52 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/JobStatus.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for JobStatus. + */ +public final class JobStatus extends ExpandableStringEnum { + /** + * Static value notStarted for JobStatus. + */ + @Generated + public static final JobStatus NOT_STARTED = fromString("notStarted"); + + /** + * Static value running for JobStatus. + */ + @Generated + public static final JobStatus RUNNING = fromString("running"); + + /** + * Static value Succeeded for JobStatus. + */ + @Generated + public static final JobStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for JobStatus. + */ + @Generated + public static final JobStatus FAILED = fromString("Failed"); + + /** + * Static value canceled for JobStatus. + */ + @Generated + public static final JobStatus CANCELED = fromString("canceled"); + + /** + * Creates a new instance of JobStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public JobStatus() { + } + + /** + * Creates or finds a JobStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding JobStatus. + */ + @Generated + public static JobStatus fromString(String name) { + return fromString(name, JobStatus.class); + } + + /** + * Gets known JobStatus values. + * + * @return known JobStatus values. + */ + @Generated + public static Collection values() { + return values(JobStatus.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/OperationState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/OperationState.java new file mode 100644 index 00000000000..441a3282a85 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/OperationState.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum describing allowed operation states. + */ +public final class OperationState extends ExpandableStringEnum { + /** + * The operation has not started. + */ + @Generated + public static final OperationState NOT_STARTED = fromString("NotStarted"); + + /** + * The operation is in progress. + */ + @Generated + public static final OperationState RUNNING = fromString("Running"); + + /** + * The operation has completed successfully. + */ + @Generated + public static final OperationState SUCCEEDED = fromString("Succeeded"); + + /** + * The operation has failed. + */ + @Generated + public static final OperationState FAILED = fromString("Failed"); + + /** + * The operation has been canceled by the user. + */ + @Generated + public static final OperationState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of OperationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public OperationState() { + } + + /** + * Creates or finds a OperationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationState. + */ + @Generated + public static OperationState fromString(String name) { + return fromString(name, OperationState.class); + } + + /** + * Gets known OperationState values. + * + * @return known OperationState values. + */ + @Generated + public static Collection values() { + return values(OperationState.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/PollResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/PollResponse.java new file mode 100644 index 00000000000..c8e9bd9f5f9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/PollResponse.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The PollResponse model. + */ +@Immutable +public final class PollResponse implements JsonSerializable { + /* + * The operationId property. + */ + @Generated + private final String operationId; + + /* + * The status property. + */ + @Generated + private final OperationState status; + + /** + * Creates an instance of PollResponse class. + * + * @param operationId the operationId value to set. + * @param status the status value to set. + */ + @Generated + private PollResponse(String operationId, OperationState status) { + this.operationId = operationId; + this.status = status; + } + + /** + * Get the operationId property: The operationId property. + * + * @return the operationId value. + */ + @Generated + public String getOperationId() { + return this.operationId; + } + + /** + * Get the status property: The status property. + * + * @return the status value. + */ + @Generated + public OperationState getStatus() { + return this.status; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operationId", this.operationId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PollResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PollResponse if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PollResponse. + */ + @Generated + public static PollResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String operationId = null; + OperationState status = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + operationId = reader.getString(); + } else if ("status".equals(fieldName)) { + status = OperationState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new PollResponse(operationId, status); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/package-info.java new file mode 100644 index 00000000000..900f23037a0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for LongRunning. + * + */ +package tsptest.longrunning.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/package-info.java new file mode 100644 index 00000000000..009f0efc041 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/longrunning/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for LongRunning. + * + */ +package tsptest.longrunning; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java new file mode 100644 index 00000000000..ad44bbc0867 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java @@ -0,0 +1,585 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.RequestConditions; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; +import tsptest.methodoverride.implementation.MethodOverrideClientImpl; +import tsptest.methodoverride.implementation.models.GroupAllRequest; +import tsptest.methodoverride.implementation.models.GroupNoneRequest; +import tsptest.methodoverride.implementation.models.GroupPartETagRequest; +import tsptest.methodoverride.implementation.models.GroupPartRequest; +import tsptest.methodoverride.models.GroupAllOptions; +import tsptest.methodoverride.models.GroupExcludeBodyModel; +import tsptest.methodoverride.models.GroupPartETagOptions; +import tsptest.methodoverride.models.GroupPartOptions; +import tsptest.methodoverride.models.GroupQueryOptions; + +/** + * Initializes a new instance of the asynchronous MethodOverrideClient type. + */ +@ServiceClient(builder = MethodOverrideClientBuilder.class, isAsync = true) +public final class MethodOverrideAsyncClient { + @Generated + private final MethodOverrideClientImpl serviceClient; + + /** + * Initializes an instance of MethodOverrideAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MethodOverrideAsyncClient(MethodOverrideClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupQueryWithResponse(RequestOptions requestOptions) { + return this.serviceClient.groupQueryWithResponseAsync(requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupAllRequest The groupAllRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupAllWithResponse(BinaryData groupAllRequest, RequestOptions requestOptions) { + return this.serviceClient.groupAllWithResponseAsync(groupAllRequest, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupPartRequest The groupPartRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupPartWithResponse(BinaryData groupPartRequest, RequestOptions requestOptions) { + return this.serviceClient.groupPartWithResponseAsync(groupPartRequest, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoThe ifModifiedSince parameter
If-Unmodified-SinceOffsetDateTimeNoThe ifUnmodifiedSince parameter
If-MatchStringNoThe ifMatch parameter
If-None-MatchStringNoThe ifNoneMatch parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupPartETagRequest The groupPartETagRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupPartETagWithResponse(BinaryData groupPartETagRequest, + RequestOptions requestOptions) { + return this.serviceClient.groupPartETagWithResponseAsync(groupPartETagRequest, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupExcludeBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.groupExcludeBodyWithResponseAsync(body, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     *     prop3: String (Optional)
+     *     prop4: String (Optional)
+     *     prop5: String (Optional)
+     *     prop6: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupNoneRequest The groupNoneRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupNoneWithResponse(BinaryData groupNoneRequest, RequestOptions requestOptions) { + return this.serviceClient.groupNoneWithResponseAsync(groupNoneRequest, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param options The options parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupQuery(GroupQueryOptions options) { + // Generated convenience method for groupQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + String foo = options == null ? null : options.getFoo(); + String bar = options == null ? null : options.getBar(); + if (foo != null) { + requestOptions.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptions.addQueryParam("bar", bar, false); + } + return groupQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A remote procedure call (RPC) operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupQuery() { + // Generated convenience method for groupQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return groupQueryWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param options The options parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupAll(GroupAllOptions options) { + // Generated convenience method for groupAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + String foo = options.getFoo(); + String bar = options.getBar(); + GroupAllRequest groupAllRequestObj = new GroupAllRequest(options.getProp1()).setProp2(options.getProp2()); + BinaryData groupAllRequest = BinaryData.fromObject(groupAllRequestObj); + if (foo != null) { + requestOptions.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptions.addQueryParam("bar", bar, false); + } + return groupAllWithResponse(groupAllRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param prop1 The prop1 parameter. + * @param foo The foo parameter. + * @param options The options parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupPart(String prop1, String foo, GroupPartOptions options) { + // Generated convenience method for groupPartWithResponse + RequestOptions requestOptions = new RequestOptions(); + GroupPartRequest groupPartRequestObj = new GroupPartRequest(prop1).setProp2(options.getProp2()); + BinaryData groupPartRequest = BinaryData.fromObject(groupPartRequestObj); + String bar = options == null ? null : options.getBar(); + if (foo != null) { + requestOptions.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptions.addQueryParam("bar", bar, false); + } + return groupPartWithResponse(groupPartRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param prop1 The prop1 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupPart(String prop1) { + // Generated convenience method for groupPartWithResponse + RequestOptions requestOptions = new RequestOptions(); + GroupPartRequest groupPartRequestObj = new GroupPartRequest(prop1); + BinaryData groupPartRequest = BinaryData.fromObject(groupPartRequestObj); + return groupPartWithResponse(groupPartRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param prop1 The prop1 parameter. + * @param foo The foo parameter. + * @param options The options parameter. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupPartETag(String prop1, String foo, GroupPartETagOptions options, + RequestConditions requestConditions) { + // Generated convenience method for groupPartETagWithResponse + RequestOptions requestOptions = new RequestOptions(); + GroupPartETagRequest groupPartETagRequestObj = new GroupPartETagRequest(prop1).setProp2(options.getProp2()); + BinaryData groupPartETagRequest = BinaryData.fromObject(groupPartETagRequestObj); + String bar = options == null ? null : options.getBar(); + OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); + OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); + String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); + String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); + if (foo != null) { + requestOptions.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptions.addQueryParam("bar", bar, false); + } + if (ifModifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } + if (ifUnmodifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + return groupPartETagWithResponse(groupPartETagRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param prop1 The prop1 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupPartETag(String prop1) { + // Generated convenience method for groupPartETagWithResponse + RequestOptions requestOptions = new RequestOptions(); + GroupPartETagRequest groupPartETagRequestObj = new GroupPartETagRequest(prop1); + BinaryData groupPartETagRequest = BinaryData.fromObject(groupPartETagRequestObj); + return groupPartETagWithResponse(groupPartETagRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param body The body parameter. + * @param options The options parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupExcludeBody(GroupExcludeBodyModel body, GroupQueryOptions options) { + // Generated convenience method for groupExcludeBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + String foo = options == null ? null : options.getFoo(); + String bar = options == null ? null : options.getBar(); + if (foo != null) { + requestOptions.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptions.addQueryParam("bar", bar, false); + } + return groupExcludeBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupExcludeBody(GroupExcludeBodyModel body) { + // Generated convenience method for groupExcludeBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return groupExcludeBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param prop1 The prop1 parameter. + * @param foo The foo parameter. + * @param bar The bar parameter. + * @param prop2 The prop2 parameter. + * @param prop3 The prop3 parameter. + * @param prop4 The prop4 parameter. + * @param prop5 The prop5 parameter. + * @param prop6 The prop6 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupNone(String prop1, String foo, String bar, String prop2, String prop3, String prop4, + String prop5, String prop6) { + // Generated convenience method for groupNoneWithResponse + RequestOptions requestOptions = new RequestOptions(); + GroupNoneRequest groupNoneRequestObj = new GroupNoneRequest(prop1).setProp2(prop2) + .setProp3(prop3) + .setProp4(prop4) + .setProp5(prop5) + .setProp6(prop6); + BinaryData groupNoneRequest = BinaryData.fromObject(groupNoneRequestObj); + if (foo != null) { + requestOptions.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptions.setHeader(HttpHeaderName.fromString("bar"), bar); + } + return groupNoneWithResponse(groupNoneRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param prop1 The prop1 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono groupNone(String prop1) { + // Generated convenience method for groupNoneWithResponse + RequestOptions requestOptions = new RequestOptions(); + GroupNoneRequest groupNoneRequestObj = new GroupNoneRequest(prop1); + BinaryData groupNoneRequest = BinaryData.fromObject(groupNoneRequestObj); + return groupNoneWithResponse(groupNoneRequest, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClient.java new file mode 100644 index 00000000000..c7f2ca77e3b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClient.java @@ -0,0 +1,571 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.RequestConditions; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.DateTimeRfc1123; +import java.time.OffsetDateTime; +import tsptest.methodoverride.implementation.MethodOverrideClientImpl; +import tsptest.methodoverride.implementation.models.GroupAllRequest; +import tsptest.methodoverride.implementation.models.GroupNoneRequest; +import tsptest.methodoverride.implementation.models.GroupPartETagRequest; +import tsptest.methodoverride.implementation.models.GroupPartRequest; +import tsptest.methodoverride.models.GroupAllOptions; +import tsptest.methodoverride.models.GroupExcludeBodyModel; +import tsptest.methodoverride.models.GroupPartETagOptions; +import tsptest.methodoverride.models.GroupPartOptions; +import tsptest.methodoverride.models.GroupQueryOptions; + +/** + * Initializes a new instance of the synchronous MethodOverrideClient type. + */ +@ServiceClient(builder = MethodOverrideClientBuilder.class) +public final class MethodOverrideClient { + @Generated + private final MethodOverrideClientImpl serviceClient; + + /** + * Initializes an instance of MethodOverrideClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MethodOverrideClient(MethodOverrideClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupQueryWithResponse(RequestOptions requestOptions) { + return this.serviceClient.groupQueryWithResponse(requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupAllRequest The groupAllRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupAllWithResponse(BinaryData groupAllRequest, RequestOptions requestOptions) { + return this.serviceClient.groupAllWithResponse(groupAllRequest, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupPartRequest The groupPartRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupPartWithResponse(BinaryData groupPartRequest, RequestOptions requestOptions) { + return this.serviceClient.groupPartWithResponse(groupPartRequest, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoThe ifModifiedSince parameter
If-Unmodified-SinceOffsetDateTimeNoThe ifUnmodifiedSince parameter
If-MatchStringNoThe ifMatch parameter
If-None-MatchStringNoThe ifNoneMatch parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupPartETagRequest The groupPartETagRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupPartETagWithResponse(BinaryData groupPartETagRequest, RequestOptions requestOptions) { + return this.serviceClient.groupPartETagWithResponse(groupPartETagRequest, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupExcludeBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.groupExcludeBodyWithResponse(body, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     *     prop3: String (Optional)
+     *     prop4: String (Optional)
+     *     prop5: String (Optional)
+     *     prop6: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupNoneRequest The groupNoneRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupNoneWithResponse(BinaryData groupNoneRequest, RequestOptions requestOptions) { + return this.serviceClient.groupNoneWithResponse(groupNoneRequest, requestOptions); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param options The options parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupQuery(GroupQueryOptions options) { + // Generated convenience method for groupQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + String foo = options == null ? null : options.getFoo(); + String bar = options == null ? null : options.getBar(); + if (foo != null) { + requestOptions.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptions.addQueryParam("bar", bar, false); + } + groupQueryWithResponse(requestOptions).getValue(); + } + + /** + * A remote procedure call (RPC) operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupQuery() { + // Generated convenience method for groupQueryWithResponse + RequestOptions requestOptions = new RequestOptions(); + groupQueryWithResponse(requestOptions).getValue(); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param options The options parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupAll(GroupAllOptions options) { + // Generated convenience method for groupAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + String foo = options.getFoo(); + String bar = options.getBar(); + GroupAllRequest groupAllRequestObj = new GroupAllRequest(options.getProp1()).setProp2(options.getProp2()); + BinaryData groupAllRequest = BinaryData.fromObject(groupAllRequestObj); + if (foo != null) { + requestOptions.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptions.addQueryParam("bar", bar, false); + } + groupAllWithResponse(groupAllRequest, requestOptions).getValue(); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param prop1 The prop1 parameter. + * @param foo The foo parameter. + * @param options The options parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupPart(String prop1, String foo, GroupPartOptions options) { + // Generated convenience method for groupPartWithResponse + RequestOptions requestOptions = new RequestOptions(); + GroupPartRequest groupPartRequestObj = new GroupPartRequest(prop1).setProp2(options.getProp2()); + BinaryData groupPartRequest = BinaryData.fromObject(groupPartRequestObj); + String bar = options == null ? null : options.getBar(); + if (foo != null) { + requestOptions.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptions.addQueryParam("bar", bar, false); + } + groupPartWithResponse(groupPartRequest, requestOptions).getValue(); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param prop1 The prop1 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupPart(String prop1) { + // Generated convenience method for groupPartWithResponse + RequestOptions requestOptions = new RequestOptions(); + GroupPartRequest groupPartRequestObj = new GroupPartRequest(prop1); + BinaryData groupPartRequest = BinaryData.fromObject(groupPartRequestObj); + groupPartWithResponse(groupPartRequest, requestOptions).getValue(); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param prop1 The prop1 parameter. + * @param foo The foo parameter. + * @param options The options parameter. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupPartETag(String prop1, String foo, GroupPartETagOptions options, + RequestConditions requestConditions) { + // Generated convenience method for groupPartETagWithResponse + RequestOptions requestOptions = new RequestOptions(); + GroupPartETagRequest groupPartETagRequestObj = new GroupPartETagRequest(prop1).setProp2(options.getProp2()); + BinaryData groupPartETagRequest = BinaryData.fromObject(groupPartETagRequestObj); + String bar = options == null ? null : options.getBar(); + OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); + OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); + String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); + String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); + if (foo != null) { + requestOptions.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptions.addQueryParam("bar", bar, false); + } + if (ifModifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } + if (ifUnmodifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + groupPartETagWithResponse(groupPartETagRequest, requestOptions).getValue(); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param prop1 The prop1 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupPartETag(String prop1) { + // Generated convenience method for groupPartETagWithResponse + RequestOptions requestOptions = new RequestOptions(); + GroupPartETagRequest groupPartETagRequestObj = new GroupPartETagRequest(prop1); + BinaryData groupPartETagRequest = BinaryData.fromObject(groupPartETagRequestObj); + groupPartETagWithResponse(groupPartETagRequest, requestOptions).getValue(); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param body The body parameter. + * @param options The options parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupExcludeBody(GroupExcludeBodyModel body, GroupQueryOptions options) { + // Generated convenience method for groupExcludeBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + String foo = options == null ? null : options.getFoo(); + String bar = options == null ? null : options.getBar(); + if (foo != null) { + requestOptions.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptions.addQueryParam("bar", bar, false); + } + groupExcludeBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupExcludeBody(GroupExcludeBodyModel body) { + // Generated convenience method for groupExcludeBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + groupExcludeBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param prop1 The prop1 parameter. + * @param foo The foo parameter. + * @param bar The bar parameter. + * @param prop2 The prop2 parameter. + * @param prop3 The prop3 parameter. + * @param prop4 The prop4 parameter. + * @param prop5 The prop5 parameter. + * @param prop6 The prop6 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupNone(String prop1, String foo, String bar, String prop2, String prop3, String prop4, String prop5, + String prop6) { + // Generated convenience method for groupNoneWithResponse + RequestOptions requestOptions = new RequestOptions(); + GroupNoneRequest groupNoneRequestObj = new GroupNoneRequest(prop1).setProp2(prop2) + .setProp3(prop3) + .setProp4(prop4) + .setProp5(prop5) + .setProp6(prop6); + BinaryData groupNoneRequest = BinaryData.fromObject(groupNoneRequestObj); + if (foo != null) { + requestOptions.addQueryParam("foo", foo, false); + } + if (bar != null) { + requestOptions.setHeader(HttpHeaderName.fromString("bar"), bar); + } + groupNoneWithResponse(groupNoneRequest, requestOptions).getValue(); + } + + /** + * A remote procedure call (RPC) operation. + * + * @param prop1 The prop1 parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void groupNone(String prop1) { + // Generated convenience method for groupNoneWithResponse + RequestOptions requestOptions = new RequestOptions(); + GroupNoneRequest groupNoneRequestObj = new GroupNoneRequest(prop1); + BinaryData groupNoneRequest = BinaryData.fromObject(groupNoneRequestObj); + groupNoneWithResponse(groupNoneRequest, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClientBuilder.java new file mode 100644 index 00000000000..ebefa1868cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.methodoverride.implementation.MethodOverrideClientImpl; + +/** + * A builder for creating a new instance of the MethodOverrideClient type. + */ +@ServiceClientBuilder(serviceClients = { MethodOverrideClient.class, MethodOverrideAsyncClient.class }) +public final class MethodOverrideClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-methodoverride.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the MethodOverrideClientBuilder. + */ + @Generated + public MethodOverrideClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MethodOverrideClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MethodOverrideClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MethodOverrideClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MethodOverrideClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MethodOverrideClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MethodOverrideClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MethodOverrideClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MethodOverrideClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private MethodOverrideServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the MethodOverrideClientBuilder. + */ + @Generated + public MethodOverrideClientBuilder serviceVersion(MethodOverrideServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the MethodOverrideClientBuilder. + */ + @Generated + public MethodOverrideClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of MethodOverrideClientImpl with the provided parameters. + * + * @return an instance of MethodOverrideClientImpl. + */ + @Generated + private MethodOverrideClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + MethodOverrideServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : MethodOverrideServiceVersion.getLatest(); + MethodOverrideClientImpl client = new MethodOverrideClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of MethodOverrideAsyncClient class. + * + * @return an instance of MethodOverrideAsyncClient. + */ + @Generated + public MethodOverrideAsyncClient buildAsyncClient() { + return new MethodOverrideAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of MethodOverrideClient class. + * + * @return an instance of MethodOverrideClient. + */ + @Generated + public MethodOverrideClient buildClient() { + return new MethodOverrideClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(MethodOverrideClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideServiceVersion.java new file mode 100644 index 00000000000..f79ba516434 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/MethodOverrideServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of MethodOverrideClient. + */ +public enum MethodOverrideServiceVersion implements ServiceVersion { + /** + * Enum value 2022-12-01-preview. + */ + V2022_12_01_PREVIEW("2022-12-01-preview"); + + private final String version; + + MethodOverrideServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link MethodOverrideServiceVersion}. + */ + public static MethodOverrideServiceVersion getLatest() { + return V2022_12_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java new file mode 100644 index 00000000000..88a822d3760 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java @@ -0,0 +1,720 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; +import tsptest.methodoverride.MethodOverrideServiceVersion; + +/** + * Initializes a new instance of the MethodOverrideClient type. + */ +public final class MethodOverrideClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MethodOverrideClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final MethodOverrideServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public MethodOverrideServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of MethodOverrideClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public MethodOverrideClientImpl(String endpoint, MethodOverrideServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of MethodOverrideClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public MethodOverrideClientImpl(HttpPipeline httpPipeline, String endpoint, + MethodOverrideServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of MethodOverrideClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public MethodOverrideClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + MethodOverrideServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service + = RestProxy.create(MethodOverrideClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for MethodOverrideClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MethodOverrideClient") + public interface MethodOverrideClientService { + @Get("/group-query") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> groupQuery(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + + @Get("/group-query") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response groupQuerySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + + @Post("/group-all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> groupAll(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData groupAllRequest, RequestOptions requestOptions, Context context); + + @Post("/group-all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response groupAllSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData groupAllRequest, RequestOptions requestOptions, Context context); + + @Post("/group-part") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> groupPart(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData groupPartRequest, RequestOptions requestOptions, Context context); + + @Post("/group-part") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response groupPartSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData groupPartRequest, RequestOptions requestOptions, Context context); + + @Post("/group-part-etag") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> groupPartETag(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData groupPartETagRequest, RequestOptions requestOptions, + Context context); + + @Post("/group-part-etag") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response groupPartETagSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData groupPartETagRequest, RequestOptions requestOptions, + Context context); + + @Post("/group-exclude-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> groupExcludeBody(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/group-exclude-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response groupExcludeBodySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/group-none") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> groupNone(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData groupNoneRequest, RequestOptions requestOptions, Context context); + + @Post("/group-none") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response groupNoneSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData groupNoneRequest, RequestOptions requestOptions, Context context); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupQueryWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.groupQuery(this.getEndpoint(), + this.getServiceVersion().getVersion(), requestOptions, context)); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupQueryWithResponse(RequestOptions requestOptions) { + return service.groupQuerySync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, + Context.NONE); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupAllRequest The groupAllRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupAllWithResponseAsync(BinaryData groupAllRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.groupAll(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, groupAllRequest, requestOptions, context)); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupAllRequest The groupAllRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupAllWithResponse(BinaryData groupAllRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.groupAllSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, + groupAllRequest, requestOptions, Context.NONE); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupPartRequest The groupPartRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupPartWithResponseAsync(BinaryData groupPartRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.groupPart(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, groupPartRequest, requestOptions, context)); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupPartRequest The groupPartRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupPartWithResponse(BinaryData groupPartRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.groupPartSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, + groupPartRequest, requestOptions, Context.NONE); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoThe ifModifiedSince parameter
If-Unmodified-SinceOffsetDateTimeNoThe ifUnmodifiedSince parameter
If-MatchStringNoThe ifMatch parameter
If-None-MatchStringNoThe ifNoneMatch parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupPartETagRequest The groupPartETagRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupPartETagWithResponseAsync(BinaryData groupPartETagRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.groupPartETag(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, groupPartETagRequest, requestOptions, context)); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-Modified-SinceOffsetDateTimeNoThe ifModifiedSince parameter
If-Unmodified-SinceOffsetDateTimeNoThe ifUnmodifiedSince parameter
If-MatchStringNoThe ifMatch parameter
If-None-MatchStringNoThe ifNoneMatch parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupPartETagRequest The groupPartETagRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupPartETagWithResponse(BinaryData groupPartETagRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.groupPartETagSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, + groupPartETagRequest, requestOptions, Context.NONE); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupExcludeBodyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.groupExcludeBody(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, body, requestOptions, context)); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupExcludeBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.groupExcludeBodySync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, + body, requestOptions, Context.NONE); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     *     prop3: String (Optional)
+     *     prop4: String (Optional)
+     *     prop5: String (Optional)
+     *     prop6: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupNoneRequest The groupNoneRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> groupNoneWithResponseAsync(BinaryData groupNoneRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.groupNone(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, groupNoneRequest, requestOptions, context)); + } + + /** + * A remote procedure call (RPC) operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
fooStringNoThe foo parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
barStringNoThe bar parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop1: String (Required)
+     *     prop2: String (Optional)
+     *     prop3: String (Optional)
+     *     prop4: String (Optional)
+     *     prop5: String (Optional)
+     *     prop6: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param groupNoneRequest The groupNoneRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response groupNoneWithResponse(BinaryData groupNoneRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.groupNoneSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, + groupNoneRequest, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupAllRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupAllRequest.java new file mode 100644 index 00000000000..4bd93423407 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupAllRequest.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GroupAllRequest model. + */ +@Fluent +public final class GroupAllRequest implements JsonSerializable { + /* + * The prop1 property. + */ + @Generated + private final String prop1; + + /* + * The prop2 property. + */ + @Generated + private String prop2; + + /** + * Creates an instance of GroupAllRequest class. + * + * @param prop1 the prop1 value to set. + */ + @Generated + public GroupAllRequest(String prop1) { + this.prop1 = prop1; + } + + /** + * Get the prop1 property: The prop1 property. + * + * @return the prop1 value. + */ + @Generated + public String getProp1() { + return this.prop1; + } + + /** + * Get the prop2 property: The prop2 property. + * + * @return the prop2 value. + */ + @Generated + public String getProp2() { + return this.prop2; + } + + /** + * Set the prop2 property: The prop2 property. + * + * @param prop2 the prop2 value to set. + * @return the GroupAllRequest object itself. + */ + @Generated + public GroupAllRequest setProp2(String prop2) { + this.prop2 = prop2; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop1", this.prop1); + jsonWriter.writeStringField("prop2", this.prop2); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GroupAllRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GroupAllRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GroupAllRequest. + */ + @Generated + public static GroupAllRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String prop1 = null; + String prop2 = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop1".equals(fieldName)) { + prop1 = reader.getString(); + } else if ("prop2".equals(fieldName)) { + prop2 = reader.getString(); + } else { + reader.skipChildren(); + } + } + GroupAllRequest deserializedGroupAllRequest = new GroupAllRequest(prop1); + deserializedGroupAllRequest.prop2 = prop2; + + return deserializedGroupAllRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupNoneRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupNoneRequest.java new file mode 100644 index 00000000000..51b1187240c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupNoneRequest.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GroupNoneRequest model. + */ +@Fluent +public final class GroupNoneRequest implements JsonSerializable { + /* + * The prop1 property. + */ + @Generated + private final String prop1; + + /* + * The prop2 property. + */ + @Generated + private String prop2; + + /* + * The prop3 property. + */ + @Generated + private String prop3; + + /* + * The prop4 property. + */ + @Generated + private String prop4; + + /* + * The prop5 property. + */ + @Generated + private String prop5; + + /* + * The prop6 property. + */ + @Generated + private String prop6; + + /** + * Creates an instance of GroupNoneRequest class. + * + * @param prop1 the prop1 value to set. + */ + @Generated + public GroupNoneRequest(String prop1) { + this.prop1 = prop1; + } + + /** + * Get the prop1 property: The prop1 property. + * + * @return the prop1 value. + */ + @Generated + public String getProp1() { + return this.prop1; + } + + /** + * Get the prop2 property: The prop2 property. + * + * @return the prop2 value. + */ + @Generated + public String getProp2() { + return this.prop2; + } + + /** + * Set the prop2 property: The prop2 property. + * + * @param prop2 the prop2 value to set. + * @return the GroupNoneRequest object itself. + */ + @Generated + public GroupNoneRequest setProp2(String prop2) { + this.prop2 = prop2; + return this; + } + + /** + * Get the prop3 property: The prop3 property. + * + * @return the prop3 value. + */ + @Generated + public String getProp3() { + return this.prop3; + } + + /** + * Set the prop3 property: The prop3 property. + * + * @param prop3 the prop3 value to set. + * @return the GroupNoneRequest object itself. + */ + @Generated + public GroupNoneRequest setProp3(String prop3) { + this.prop3 = prop3; + return this; + } + + /** + * Get the prop4 property: The prop4 property. + * + * @return the prop4 value. + */ + @Generated + public String getProp4() { + return this.prop4; + } + + /** + * Set the prop4 property: The prop4 property. + * + * @param prop4 the prop4 value to set. + * @return the GroupNoneRequest object itself. + */ + @Generated + public GroupNoneRequest setProp4(String prop4) { + this.prop4 = prop4; + return this; + } + + /** + * Get the prop5 property: The prop5 property. + * + * @return the prop5 value. + */ + @Generated + public String getProp5() { + return this.prop5; + } + + /** + * Set the prop5 property: The prop5 property. + * + * @param prop5 the prop5 value to set. + * @return the GroupNoneRequest object itself. + */ + @Generated + public GroupNoneRequest setProp5(String prop5) { + this.prop5 = prop5; + return this; + } + + /** + * Get the prop6 property: The prop6 property. + * + * @return the prop6 value. + */ + @Generated + public String getProp6() { + return this.prop6; + } + + /** + * Set the prop6 property: The prop6 property. + * + * @param prop6 the prop6 value to set. + * @return the GroupNoneRequest object itself. + */ + @Generated + public GroupNoneRequest setProp6(String prop6) { + this.prop6 = prop6; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop1", this.prop1); + jsonWriter.writeStringField("prop2", this.prop2); + jsonWriter.writeStringField("prop3", this.prop3); + jsonWriter.writeStringField("prop4", this.prop4); + jsonWriter.writeStringField("prop5", this.prop5); + jsonWriter.writeStringField("prop6", this.prop6); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GroupNoneRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GroupNoneRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GroupNoneRequest. + */ + @Generated + public static GroupNoneRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String prop1 = null; + String prop2 = null; + String prop3 = null; + String prop4 = null; + String prop5 = null; + String prop6 = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop1".equals(fieldName)) { + prop1 = reader.getString(); + } else if ("prop2".equals(fieldName)) { + prop2 = reader.getString(); + } else if ("prop3".equals(fieldName)) { + prop3 = reader.getString(); + } else if ("prop4".equals(fieldName)) { + prop4 = reader.getString(); + } else if ("prop5".equals(fieldName)) { + prop5 = reader.getString(); + } else if ("prop6".equals(fieldName)) { + prop6 = reader.getString(); + } else { + reader.skipChildren(); + } + } + GroupNoneRequest deserializedGroupNoneRequest = new GroupNoneRequest(prop1); + deserializedGroupNoneRequest.prop2 = prop2; + deserializedGroupNoneRequest.prop3 = prop3; + deserializedGroupNoneRequest.prop4 = prop4; + deserializedGroupNoneRequest.prop5 = prop5; + deserializedGroupNoneRequest.prop6 = prop6; + + return deserializedGroupNoneRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartETagRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartETagRequest.java new file mode 100644 index 00000000000..7a30dc3833b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartETagRequest.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GroupPartETagRequest model. + */ +@Fluent +public final class GroupPartETagRequest implements JsonSerializable { + /* + * The prop1 property. + */ + @Generated + private final String prop1; + + /* + * The prop2 property. + */ + @Generated + private String prop2; + + /** + * Creates an instance of GroupPartETagRequest class. + * + * @param prop1 the prop1 value to set. + */ + @Generated + public GroupPartETagRequest(String prop1) { + this.prop1 = prop1; + } + + /** + * Get the prop1 property: The prop1 property. + * + * @return the prop1 value. + */ + @Generated + public String getProp1() { + return this.prop1; + } + + /** + * Get the prop2 property: The prop2 property. + * + * @return the prop2 value. + */ + @Generated + public String getProp2() { + return this.prop2; + } + + /** + * Set the prop2 property: The prop2 property. + * + * @param prop2 the prop2 value to set. + * @return the GroupPartETagRequest object itself. + */ + @Generated + public GroupPartETagRequest setProp2(String prop2) { + this.prop2 = prop2; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop1", this.prop1); + jsonWriter.writeStringField("prop2", this.prop2); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GroupPartETagRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GroupPartETagRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GroupPartETagRequest. + */ + @Generated + public static GroupPartETagRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String prop1 = null; + String prop2 = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop1".equals(fieldName)) { + prop1 = reader.getString(); + } else if ("prop2".equals(fieldName)) { + prop2 = reader.getString(); + } else { + reader.skipChildren(); + } + } + GroupPartETagRequest deserializedGroupPartETagRequest = new GroupPartETagRequest(prop1); + deserializedGroupPartETagRequest.prop2 = prop2; + + return deserializedGroupPartETagRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartRequest.java new file mode 100644 index 00000000000..dabfce61f50 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/GroupPartRequest.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GroupPartRequest model. + */ +@Fluent +public final class GroupPartRequest implements JsonSerializable { + /* + * The prop1 property. + */ + @Generated + private final String prop1; + + /* + * The prop2 property. + */ + @Generated + private String prop2; + + /** + * Creates an instance of GroupPartRequest class. + * + * @param prop1 the prop1 value to set. + */ + @Generated + public GroupPartRequest(String prop1) { + this.prop1 = prop1; + } + + /** + * Get the prop1 property: The prop1 property. + * + * @return the prop1 value. + */ + @Generated + public String getProp1() { + return this.prop1; + } + + /** + * Get the prop2 property: The prop2 property. + * + * @return the prop2 value. + */ + @Generated + public String getProp2() { + return this.prop2; + } + + /** + * Set the prop2 property: The prop2 property. + * + * @param prop2 the prop2 value to set. + * @return the GroupPartRequest object itself. + */ + @Generated + public GroupPartRequest setProp2(String prop2) { + this.prop2 = prop2; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop1", this.prop1); + jsonWriter.writeStringField("prop2", this.prop2); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GroupPartRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GroupPartRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GroupPartRequest. + */ + @Generated + public static GroupPartRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String prop1 = null; + String prop2 = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop1".equals(fieldName)) { + prop1 = reader.getString(); + } else if ("prop2".equals(fieldName)) { + prop2 = reader.getString(); + } else { + reader.skipChildren(); + } + } + GroupPartRequest deserializedGroupPartRequest = new GroupPartRequest(prop1); + deserializedGroupPartRequest.prop2 = prop2; + + return deserializedGroupPartRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/package-info.java new file mode 100644 index 00000000000..c430d4c1f4e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for MethodOverride. + * + */ +package tsptest.methodoverride.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/package-info.java new file mode 100644 index 00000000000..7df234c1921 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for MethodOverride. + * + */ +package tsptest.methodoverride.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupAllOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupAllOptions.java new file mode 100644 index 00000000000..d48b8268125 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupAllOptions.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; + +/** + * The GroupAllOptions model. + */ +@Fluent +public final class GroupAllOptions { + /* + * The foo property. + */ + @Generated + private String foo; + + /* + * The bar property. + */ + @Generated + private String bar; + + /* + * The prop1 property. + */ + @Generated + private final String prop1; + + /* + * The prop2 property. + */ + @Generated + private String prop2; + + /** + * Creates an instance of GroupAllOptions class. + * + * @param prop1 the prop1 value to set. + */ + @Generated + public GroupAllOptions(String prop1) { + this.prop1 = prop1; + } + + /** + * Get the foo property: The foo property. + * + * @return the foo value. + */ + @Generated + public String getFoo() { + return this.foo; + } + + /** + * Set the foo property: The foo property. + * + * @param foo the foo value to set. + * @return the GroupAllOptions object itself. + */ + @Generated + public GroupAllOptions setFoo(String foo) { + this.foo = foo; + return this; + } + + /** + * Get the bar property: The bar property. + * + * @return the bar value. + */ + @Generated + public String getBar() { + return this.bar; + } + + /** + * Set the bar property: The bar property. + * + * @param bar the bar value to set. + * @return the GroupAllOptions object itself. + */ + @Generated + public GroupAllOptions setBar(String bar) { + this.bar = bar; + return this; + } + + /** + * Get the prop1 property: The prop1 property. + * + * @return the prop1 value. + */ + @Generated + public String getProp1() { + return this.prop1; + } + + /** + * Get the prop2 property: The prop2 property. + * + * @return the prop2 value. + */ + @Generated + public String getProp2() { + return this.prop2; + } + + /** + * Set the prop2 property: The prop2 property. + * + * @param prop2 the prop2 value to set. + * @return the GroupAllOptions object itself. + */ + @Generated + public GroupAllOptions setProp2(String prop2) { + this.prop2 = prop2; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupExcludeBodyModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupExcludeBodyModel.java new file mode 100644 index 00000000000..a8990016efd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupExcludeBodyModel.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GroupExcludeBodyModel model. + */ +@Fluent +public final class GroupExcludeBodyModel implements JsonSerializable { + /* + * The prop1 property. + */ + @Generated + private final String prop1; + + /* + * The prop2 property. + */ + @Generated + private String prop2; + + /** + * Creates an instance of GroupExcludeBodyModel class. + * + * @param prop1 the prop1 value to set. + */ + @Generated + public GroupExcludeBodyModel(String prop1) { + this.prop1 = prop1; + } + + /** + * Get the prop1 property: The prop1 property. + * + * @return the prop1 value. + */ + @Generated + public String getProp1() { + return this.prop1; + } + + /** + * Get the prop2 property: The prop2 property. + * + * @return the prop2 value. + */ + @Generated + public String getProp2() { + return this.prop2; + } + + /** + * Set the prop2 property: The prop2 property. + * + * @param prop2 the prop2 value to set. + * @return the GroupExcludeBodyModel object itself. + */ + @Generated + public GroupExcludeBodyModel setProp2(String prop2) { + this.prop2 = prop2; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop1", this.prop1); + jsonWriter.writeStringField("prop2", this.prop2); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GroupExcludeBodyModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GroupExcludeBodyModel if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GroupExcludeBodyModel. + */ + @Generated + public static GroupExcludeBodyModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String prop1 = null; + String prop2 = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop1".equals(fieldName)) { + prop1 = reader.getString(); + } else if ("prop2".equals(fieldName)) { + prop2 = reader.getString(); + } else { + reader.skipChildren(); + } + } + GroupExcludeBodyModel deserializedGroupExcludeBodyModel = new GroupExcludeBodyModel(prop1); + deserializedGroupExcludeBodyModel.prop2 = prop2; + + return deserializedGroupExcludeBodyModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartETagOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartETagOptions.java new file mode 100644 index 00000000000..3a532805754 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartETagOptions.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; + +/** + * The GroupPartETagOptions model. + */ +@Fluent +public final class GroupPartETagOptions { + /* + * The bar property. + */ + @Generated + private String bar; + + /* + * The prop2 property. + */ + @Generated + private String prop2; + + /** + * Creates an instance of GroupPartETagOptions class. + */ + @Generated + public GroupPartETagOptions() { + } + + /** + * Get the bar property: The bar property. + * + * @return the bar value. + */ + @Generated + public String getBar() { + return this.bar; + } + + /** + * Set the bar property: The bar property. + * + * @param bar the bar value to set. + * @return the GroupPartETagOptions object itself. + */ + @Generated + public GroupPartETagOptions setBar(String bar) { + this.bar = bar; + return this; + } + + /** + * Get the prop2 property: The prop2 property. + * + * @return the prop2 value. + */ + @Generated + public String getProp2() { + return this.prop2; + } + + /** + * Set the prop2 property: The prop2 property. + * + * @param prop2 the prop2 value to set. + * @return the GroupPartETagOptions object itself. + */ + @Generated + public GroupPartETagOptions setProp2(String prop2) { + this.prop2 = prop2; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartOptions.java new file mode 100644 index 00000000000..6d6c37b67b2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupPartOptions.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; + +/** + * The GroupPartOptions model. + */ +@Fluent +public final class GroupPartOptions { + /* + * The bar property. + */ + @Generated + private String bar; + + /* + * The prop2 property. + */ + @Generated + private String prop2; + + /** + * Creates an instance of GroupPartOptions class. + */ + @Generated + public GroupPartOptions() { + } + + /** + * Get the bar property: The bar property. + * + * @return the bar value. + */ + @Generated + public String getBar() { + return this.bar; + } + + /** + * Set the bar property: The bar property. + * + * @param bar the bar value to set. + * @return the GroupPartOptions object itself. + */ + @Generated + public GroupPartOptions setBar(String bar) { + this.bar = bar; + return this; + } + + /** + * Get the prop2 property: The prop2 property. + * + * @return the prop2 value. + */ + @Generated + public String getProp2() { + return this.prop2; + } + + /** + * Set the prop2 property: The prop2 property. + * + * @param prop2 the prop2 value to set. + * @return the GroupPartOptions object itself. + */ + @Generated + public GroupPartOptions setProp2(String prop2) { + this.prop2 = prop2; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java new file mode 100644 index 00000000000..394f1fb5147 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; + +/** + * The GroupQueryOptions model. + */ +@Fluent +public final class GroupQueryOptions { + /* + * The foo property. + */ + @Generated + private String foo; + + /* + * The bar property. + */ + @Generated + private String bar; + + /** + * Creates an instance of GroupQueryOptions class. + */ + @Generated + public GroupQueryOptions() { + } + + /** + * Get the foo property: The foo property. + * + * @return the foo value. + */ + @Generated + public String getFoo() { + return this.foo; + } + + /** + * Set the foo property: The foo property. + * + * @param foo the foo value to set. + * @return the GroupQueryOptions object itself. + */ + @Generated + public GroupQueryOptions setFoo(String foo) { + this.foo = foo; + return this; + } + + /** + * Get the bar property: The bar property. + * + * @return the bar value. + */ + @Generated + public String getBar() { + return this.bar; + } + + /** + * Set the bar property: The bar property. + * + * @param bar the bar value to set. + * @return the GroupQueryOptions object itself. + */ + @Generated + public GroupQueryOptions setBar(String bar) { + this.bar = bar; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/package-info.java new file mode 100644 index 00000000000..5309f062074 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for MethodOverride. + * + */ +package tsptest.methodoverride.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/package-info.java new file mode 100644 index 00000000000..a9dc80b7621 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/methodoverride/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for MethodOverride. + * + */ +package tsptest.methodoverride; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelAsyncClient.java new file mode 100644 index 00000000000..574b1c35a0f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelAsyncClient.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.model.implementation.ModelOpsImpl; +import tsptest.model.models.NestedModel; +import tsptest.model.models.Resource1; +import tsptest.model.models.Resource2; +import tsptest.model.models.Resource3; + +/** + * Initializes a new instance of the asynchronous ModelClient type. + */ +@ServiceClient(builder = ModelClientBuilder.class, isAsync = true) +public final class ModelAsyncClient { + @Generated + private final ModelOpsImpl serviceClient; + + /** + * Initializes an instance of ModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelAsyncClient(ModelOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The put1 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     outputData (Required): {
+     *         data: String (Required)
+     *     }
+     *     outputData2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     outputData (Required): {
+     *         data: String (Required)
+     *     }
+     *     outputData2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> put1WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.put1WithResponseAsync(body, requestOptions); + } + + /** + * The put2 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> put2WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.put2WithResponseAsync(body, requestOptions); + } + + /** + * The get3 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     outputData3 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get3WithResponse(RequestOptions requestOptions) { + return this.serviceClient.get3WithResponseAsync(requestOptions); + } + + /** + * The putNested operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     nested1 (Required): {
+     *         nested2 (Required): {
+     *             data: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     nested1 (Required): {
+     *         nested2 (Required): {
+     *             data: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putNestedWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putNestedWithResponseAsync(body, requestOptions); + } + + /** + * The put1 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put1(Resource1 body) { + // Generated convenience method for put1WithResponse + RequestOptions requestOptions = new RequestOptions(); + return put1WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource1.class)); + } + + /** + * The put2 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put2(Resource2 body) { + // Generated convenience method for put2WithResponse + RequestOptions requestOptions = new RequestOptions(); + return put2WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource2.class)); + } + + /** + * The get3 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get3() { + // Generated convenience method for get3WithResponse + RequestOptions requestOptions = new RequestOptions(); + return get3WithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource3.class)); + } + + /** + * The putNested operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putNested(NestedModel body) { + // Generated convenience method for putNestedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putNestedWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(NestedModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClient.java new file mode 100644 index 00000000000..4185f37bdb5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClient.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.model.implementation.ModelOpsImpl; +import tsptest.model.models.NestedModel; +import tsptest.model.models.Resource1; +import tsptest.model.models.Resource2; +import tsptest.model.models.Resource3; + +/** + * Initializes a new instance of the synchronous ModelClient type. + */ +@ServiceClient(builder = ModelClientBuilder.class) +public final class ModelClient { + @Generated + private final ModelOpsImpl serviceClient; + + /** + * Initializes an instance of ModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelClient(ModelOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The put1 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     outputData (Required): {
+     *         data: String (Required)
+     *     }
+     *     outputData2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     outputData (Required): {
+     *         data: String (Required)
+     *     }
+     *     outputData2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response put1WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.put1WithResponse(body, requestOptions); + } + + /** + * The put2 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response put2WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.put2WithResponse(body, requestOptions); + } + + /** + * The get3 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     outputData3 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response get3WithResponse(RequestOptions requestOptions) { + return this.serviceClient.get3WithResponse(requestOptions); + } + + /** + * The putNested operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     nested1 (Required): {
+     *         nested2 (Required): {
+     *             data: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     nested1 (Required): {
+     *         nested2 (Required): {
+     *             data: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putNestedWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putNestedWithResponse(body, requestOptions); + } + + /** + * The put1 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource1 put1(Resource1 body) { + // Generated convenience method for put1WithResponse + RequestOptions requestOptions = new RequestOptions(); + return put1WithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(Resource1.class); + } + + /** + * The put2 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource2 put2(Resource2 body) { + // Generated convenience method for put2WithResponse + RequestOptions requestOptions = new RequestOptions(); + return put2WithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(Resource2.class); + } + + /** + * The get3 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource3 get3() { + // Generated convenience method for get3WithResponse + RequestOptions requestOptions = new RequestOptions(); + return get3WithResponse(requestOptions).getValue().toObject(Resource3.class); + } + + /** + * The putNested operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public NestedModel putNested(NestedModel body) { + // Generated convenience method for putNestedWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putNestedWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(NestedModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClientBuilder.java new file mode 100644 index 00000000000..d7d59d387be --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/ModelClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.model.implementation.ModelClientImpl; + +/** + * A builder for creating a new instance of the ModelClient type. + */ +@ServiceClientBuilder(serviceClients = { ModelClient.class, ModelAsyncClient.class }) +public final class ModelClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-model.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ModelClientBuilder. + */ + @Generated + public ModelClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ModelClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ModelClientBuilder. + */ + @Generated + public ModelClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ModelClientImpl with the provided parameters. + * + * @return an instance of ModelClientImpl. + */ + @Generated + private ModelClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ModelClientImpl client + = new ModelClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ModelAsyncClient class. + * + * @return an instance of ModelAsyncClient. + */ + @Generated + public ModelAsyncClient buildAsyncClient() { + return new ModelAsyncClient(buildInnerClient().getModelOps()); + } + + /** + * Builds an instance of ModelClient class. + * + * @return an instance of ModelClient. + */ + @Generated + public ModelClient buildClient() { + return new ModelClient(buildInnerClient().getModelOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ModelClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelClientImpl.java new file mode 100644 index 00000000000..14f806b1839 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 ModelClient type. + */ +public final class ModelClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 ModelOpsImpl object to access its operations. + */ + private final ModelOpsImpl modelOps; + + /** + * Gets the ModelOpsImpl object to access its operations. + * + * @return the ModelOpsImpl object. + */ + public ModelOpsImpl getModelOps() { + return this.modelOps; + } + + /** + * Initializes an instance of ModelClient client. + * + * @param endpoint Service host. + */ + public ModelClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ModelClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ModelClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ModelClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ModelClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.modelOps = new ModelOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelOpsImpl.java new file mode 100644 index 00000000000..31441b34c72 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/ModelOpsImpl.java @@ -0,0 +1,474 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ModelOps. + */ +public final class ModelOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ModelOpsService service; + + /** + * The service client containing this operation class. + */ + private final ModelClientImpl client; + + /** + * Initializes an instance of ModelOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ModelOpsImpl(ModelClientImpl client) { + this.service = RestProxy.create(ModelOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ModelClientModelOps to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ModelClientModelOps") + public interface ModelOpsService { + @Put("/model/resource1") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put1(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/model/resource1") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response put1Sync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/model/resource2") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put2(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/model/resource2") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response put2Sync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Get("/model/resource3") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get3(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/model/resource3") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response get3Sync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/model/nested") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putNested(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Get("/model/nested") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putNestedSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The put1 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     outputData (Required): {
+     *         data: String (Required)
+     *     }
+     *     outputData2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     outputData (Required): {
+     *         data: String (Required)
+     *     }
+     *     outputData2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> put1WithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.put1(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * The put1 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     outputData (Required): {
+     *         data: String (Required)
+     *     }
+     *     outputData2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     outputData (Required): {
+     *         data: String (Required)
+     *     }
+     *     outputData2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response put1WithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.put1Sync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * The put2 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> put2WithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.put2(this.client.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * The put2 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data2 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response put2WithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.put2Sync(this.client.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * The get3 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     outputData3 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get3WithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get3(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get3 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     outputData3 (Required): {
+     *         data: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response get3WithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.get3Sync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The putNested operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     nested1 (Required): {
+     *         nested2 (Required): {
+     *             data: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     nested1 (Required): {
+     *         nested2 (Required): {
+     *             data: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putNestedWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.putNested(this.client.getEndpoint(), contentType, accept, body, + requestOptions, context)); + } + + /** + * The putNested operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     nested1 (Required): {
+     *         nested2 (Required): {
+     *             data: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     nested1 (Required): {
+     *         nested2 (Required): {
+     *             data: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putNestedWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putNestedSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/package-info.java new file mode 100644 index 00000000000..e250c3dcd63 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Model. + * + */ +package tsptest.model.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/InputOutputData2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/InputOutputData2.java new file mode 100644 index 00000000000..c691ca87f6a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/InputOutputData2.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The InputOutputData2 model. + */ +@Immutable +public final class InputOutputData2 implements JsonSerializable { + /* + * The data property. + */ + @Generated + private final String data; + + /** + * Creates an instance of InputOutputData2 class. + * + * @param data the data value to set. + */ + @Generated + public InputOutputData2(String data) { + this.data = data; + } + + /** + * Get the data property: The data property. + * + * @return the data value. + */ + @Generated + public String getData() { + return this.data; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("data", this.data); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InputOutputData2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InputOutputData2 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InputOutputData2. + */ + @Generated + public static InputOutputData2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String data = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data".equals(fieldName)) { + data = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new InputOutputData2(data); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel.java new file mode 100644 index 00000000000..aaa073333ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The NestedModel model. + */ +@Immutable +public final class NestedModel implements JsonSerializable { + /* + * The nested1 property. + */ + @Generated + private final NestedModel1 nested1; + + /** + * Creates an instance of NestedModel class. + * + * @param nested1 the nested1 value to set. + */ + @Generated + public NestedModel(NestedModel1 nested1) { + this.nested1 = nested1; + } + + /** + * Get the nested1 property: The nested1 property. + * + * @return the nested1 value. + */ + @Generated + public NestedModel1 getNested1() { + return this.nested1; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("nested1", this.nested1); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NestedModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NestedModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NestedModel. + */ + @Generated + public static NestedModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NestedModel1 nested1 = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nested1".equals(fieldName)) { + nested1 = NestedModel1.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new NestedModel(nested1); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel1.java new file mode 100644 index 00000000000..ac657ba3016 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel1.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The NestedModel1 model. + */ +@Immutable +public final class NestedModel1 implements JsonSerializable { + /* + * The nested2 property. + */ + @Generated + private final NestedModel2 nested2; + + /** + * Creates an instance of NestedModel1 class. + * + * @param nested2 the nested2 value to set. + */ + @Generated + public NestedModel1(NestedModel2 nested2) { + this.nested2 = nested2; + } + + /** + * Get the nested2 property: The nested2 property. + * + * @return the nested2 value. + */ + @Generated + public NestedModel2 getNested2() { + return this.nested2; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("nested2", this.nested2); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NestedModel1 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NestedModel1 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NestedModel1. + */ + @Generated + public static NestedModel1 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NestedModel2 nested2 = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nested2".equals(fieldName)) { + nested2 = NestedModel2.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new NestedModel1(nested2); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel2.java new file mode 100644 index 00000000000..82dd348804c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/NestedModel2.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The NestedModel2 model. + */ +@Immutable +public final class NestedModel2 implements JsonSerializable { + /* + * The data property. + */ + @Generated + private final String data; + + /** + * Creates an instance of NestedModel2 class. + * + * @param data the data value to set. + */ + @Generated + public NestedModel2(String data) { + this.data = data; + } + + /** + * Get the data property: The data property. + * + * @return the data value. + */ + @Generated + public String getData() { + return this.data; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("data", this.data); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NestedModel2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NestedModel2 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NestedModel2. + */ + @Generated + public static NestedModel2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String data = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data".equals(fieldName)) { + data = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new NestedModel2(data); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData.java new file mode 100644 index 00000000000..9d01d6184cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The OutputData model. + */ +@Immutable +public final class OutputData implements JsonSerializable { + /* + * The data property. + */ + @Generated + private final String data; + + /** + * Creates an instance of OutputData class. + * + * @param data the data value to set. + */ + @Generated + private OutputData(String data) { + this.data = data; + } + + /** + * Get the data property: The data property. + * + * @return the data value. + */ + @Generated + public String getData() { + return this.data; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("data", this.data); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OutputData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OutputData if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OutputData. + */ + @Generated + public static OutputData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String data = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data".equals(fieldName)) { + data = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new OutputData(data); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData3.java new file mode 100644 index 00000000000..ad4c6ae8522 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/OutputData3.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The OutputData3 model. + */ +@Immutable +public final class OutputData3 implements JsonSerializable { + /* + * The data property. + */ + @Generated + private final String data; + + /** + * Creates an instance of OutputData3 class. + * + * @param data the data value to set. + */ + @Generated + private OutputData3(String data) { + this.data = data; + } + + /** + * Get the data property: The data property. + * + * @return the data value. + */ + @Generated + public String getData() { + return this.data; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("data", this.data); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OutputData3 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OutputData3 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OutputData3. + */ + @Generated + public static OutputData3 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String data = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data".equals(fieldName)) { + data = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new OutputData3(data); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource1.java new file mode 100644 index 00000000000..1bbf9694d84 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource1.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Resource1 model. + */ +@Immutable +public final class Resource1 implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The outputData property. + */ + @Generated + private OutputData outputData; + + /* + * The outputData2 property. + */ + @Generated + private InputOutputData2 outputData2; + + /** + * Creates an instance of Resource1 class. + * + * @param name the name value to set. + */ + @Generated + public Resource1(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the outputData property: The outputData property. + * + * @return the outputData value. + */ + @Generated + public OutputData getOutputData() { + return this.outputData; + } + + /** + * Get the outputData2 property: The outputData2 property. + * + * @return the outputData2 value. + */ + @Generated + public InputOutputData2 getOutputData2() { + return this.outputData2; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Resource1 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Resource1 if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Resource1. + */ + @Generated + public static Resource1 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + OutputData outputData = null; + InputOutputData2 outputData2 = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("outputData".equals(fieldName)) { + outputData = OutputData.fromJson(reader); + } else if ("outputData2".equals(fieldName)) { + outputData2 = InputOutputData2.fromJson(reader); + } else { + reader.skipChildren(); + } + } + Resource1 deserializedResource1 = new Resource1(name); + deserializedResource1.outputData = outputData; + deserializedResource1.outputData2 = outputData2; + + return deserializedResource1; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource2.java new file mode 100644 index 00000000000..bc2dcaaa9a0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource2.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Resource2 model. + */ +@Immutable +public final class Resource2 implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The data2 property. + */ + @Generated + private final InputOutputData2 data2; + + /** + * Creates an instance of Resource2 class. + * + * @param name the name value to set. + * @param data2 the data2 value to set. + */ + @Generated + public Resource2(String name, InputOutputData2 data2) { + this.name = name; + this.data2 = data2; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the data2 property: The data2 property. + * + * @return the data2 value. + */ + @Generated + public InputOutputData2 getData2() { + return this.data2; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("data2", this.data2); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Resource2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Resource2 if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Resource2. + */ + @Generated + public static Resource2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + InputOutputData2 data2 = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("data2".equals(fieldName)) { + data2 = InputOutputData2.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new Resource2(name, data2); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource3.java new file mode 100644 index 00000000000..23b179f9036 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/Resource3.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Resource3 model. + */ +@Immutable +public final class Resource3 implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The outputData3 property. + */ + @Generated + private final OutputData3 outputData3; + + /** + * Creates an instance of Resource3 class. + * + * @param name the name value to set. + * @param outputData3 the outputData3 value to set. + */ + @Generated + private Resource3(String name, OutputData3 outputData3) { + this.name = name; + this.outputData3 = outputData3; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the outputData3 property: The outputData3 property. + * + * @return the outputData3 value. + */ + @Generated + public OutputData3 getOutputData3() { + return this.outputData3; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("outputData3", this.outputData3); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Resource3 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Resource3 if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Resource3. + */ + @Generated + public static Resource3 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + OutputData3 outputData3 = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("outputData3".equals(fieldName)) { + outputData3 = OutputData3.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new Resource3(name, outputData3); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/package-info.java new file mode 100644 index 00000000000..09e49bd0333 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Model. + * + */ +package tsptest.model.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/package-info.java new file mode 100644 index 00000000000..e394ea46e00 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/model/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Model. + * + */ +package tsptest.model; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesAsyncClient.java new file mode 100644 index 00000000000..5cd3c7365d5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesAsyncClient.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import reactor.core.publisher.Mono; +import tsptest.multicontenttypes.implementation.MultiContentTypesClientImpl; + +/** + * Initializes a new instance of the asynchronous MultiContentTypesClient type. + */ +@ServiceClient(builder = MultiContentTypesClientBuilder.class, isAsync = true) +public final class MultiContentTypesAsyncClient { + @Generated + private final MultiContentTypesClientImpl serviceClient; + + /** + * Initializes an instance of MultiContentTypesAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MultiContentTypesAsyncClient(MultiContentTypesClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * multiple data types map to multiple content types. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "text/plain", "application/json", + * "application/octet-stream", "image/jpeg", "image/png". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadWithOverloadWithResponse(String contentType, BinaryData data, + RequestOptions requestOptions) { + // Operation 'uploadWithOverload' can be invoked with multiple content-type. It is difficult to form a correct + // method signature for convenience API, and hence the convenience API is not generated. + return this.serviceClient.uploadWithOverloadWithResponseAsync(contentType, data, requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClient.java new file mode 100644 index 00000000000..9648124a0cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.multicontenttypes.implementation.MultiContentTypesClientImpl; + +/** + * Initializes a new instance of the synchronous MultiContentTypesClient type. + */ +@ServiceClient(builder = MultiContentTypesClientBuilder.class) +public final class MultiContentTypesClient { + @Generated + private final MultiContentTypesClientImpl serviceClient; + + /** + * Initializes an instance of MultiContentTypesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MultiContentTypesClient(MultiContentTypesClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * multiple data types map to multiple content types. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "text/plain", "application/json", + * "application/octet-stream", "image/jpeg", "image/png". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadWithOverloadWithResponse(String contentType, BinaryData data, + RequestOptions requestOptions) { + // Operation 'uploadWithOverload' can be invoked with multiple content-type. It is difficult to form a correct + // method signature for convenience API, and hence the convenience API is not generated. + return this.serviceClient.uploadWithOverloadWithResponse(contentType, data, requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClientBuilder.java new file mode 100644 index 00000000000..19af583afa0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultiContentTypesClientBuilder.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.multicontenttypes.implementation.MultiContentTypesClientImpl; + +/** + * A builder for creating a new instance of the MultiContentTypesClient type. + */ +@ServiceClientBuilder( + serviceClients = { + MultiContentTypesClient.class, + SingleContentTypeClient.class, + MultipleContentTypesOnRequestClient.class, + MultiContentTypesAsyncClient.class, + SingleContentTypeAsyncClient.class, + MultipleContentTypesOnRequestAsyncClient.class }) +public final class MultiContentTypesClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("tsptest-multicontenttypes.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the MultiContentTypesClientBuilder. + */ + @Generated + public MultiContentTypesClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiContentTypesClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiContentTypesClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiContentTypesClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiContentTypesClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiContentTypesClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiContentTypesClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiContentTypesClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultiContentTypesClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the MultiContentTypesClientBuilder. + */ + @Generated + public MultiContentTypesClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of MultiContentTypesClientImpl with the provided parameters. + * + * @return an instance of MultiContentTypesClientImpl. + */ + @Generated + private MultiContentTypesClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + MultiContentTypesClientImpl client = new MultiContentTypesClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of MultiContentTypesAsyncClient class. + * + * @return an instance of MultiContentTypesAsyncClient. + */ + @Generated + public MultiContentTypesAsyncClient buildAsyncClient() { + return new MultiContentTypesAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of SingleContentTypeAsyncClient class. + * + * @return an instance of SingleContentTypeAsyncClient. + */ + @Generated + public SingleContentTypeAsyncClient buildSingleContentTypeAsyncClient() { + return new SingleContentTypeAsyncClient(buildInnerClient().getSingleContentTypes()); + } + + /** + * Builds an instance of MultipleContentTypesOnRequestAsyncClient class. + * + * @return an instance of MultipleContentTypesOnRequestAsyncClient. + */ + @Generated + public MultipleContentTypesOnRequestAsyncClient buildMultipleContentTypesOnRequestAsyncClient() { + return new MultipleContentTypesOnRequestAsyncClient(buildInnerClient().getMultipleContentTypesOnRequests()); + } + + /** + * Builds an instance of MultiContentTypesClient class. + * + * @return an instance of MultiContentTypesClient. + */ + @Generated + public MultiContentTypesClient buildClient() { + return new MultiContentTypesClient(buildInnerClient()); + } + + /** + * Builds an instance of SingleContentTypeClient class. + * + * @return an instance of SingleContentTypeClient. + */ + @Generated + public SingleContentTypeClient buildSingleContentTypeClient() { + return new SingleContentTypeClient(buildInnerClient().getSingleContentTypes()); + } + + /** + * Builds an instance of MultipleContentTypesOnRequestClient class. + * + * @return an instance of MultipleContentTypesOnRequestClient. + */ + @Generated + public MultipleContentTypesOnRequestClient buildMultipleContentTypesOnRequestClient() { + return new MultipleContentTypesOnRequestClient(buildInnerClient().getMultipleContentTypesOnRequests()); + } + + private static final ClientLogger LOGGER = new ClientLogger(MultiContentTypesClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestAsyncClient.java new file mode 100644 index 00000000000..61c77a150ab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestAsyncClient.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.multicontenttypes.implementation.MultipleContentTypesOnRequestsImpl; +import tsptest.multicontenttypes.models.Resource; + +/** + * Initializes a new instance of the asynchronous MultiContentTypesClient type. + */ +@ServiceClient(builder = MultiContentTypesClientBuilder.class, isAsync = true) +public final class MultipleContentTypesOnRequestAsyncClient { + @Generated + private final MultipleContentTypesOnRequestsImpl serviceClient; + + /** + * Initializes an instance of MultipleContentTypesOnRequestAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MultipleContentTypesOnRequestAsyncClient(MultipleContentTypesOnRequestsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * one data type maps to multiple content types. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", + * "image/png", "application/json-patch+json". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadBytesWithSingleBodyTypeForMultiContentTypesWithResponse(String contentType, + BinaryData data, RequestOptions requestOptions) { + // Operation 'uploadBytesWithSingleBodyTypeForMultiContentTypes' can be invoked with multiple content-type. It + // is difficult to form a correct method signature for convenience API, and hence the convenience API is not + // generated. + return this.serviceClient.uploadBytesWithSingleBodyTypeForMultiContentTypesWithResponseAsync(contentType, data, + requestOptions); + } + + /** + * multiple data types map to multiple content types using shared route. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", + * "image/png". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType, + BinaryData data, RequestOptions requestOptions) { + // Operation 'uploadBytesWithMultiBodyTypesForMultiContentTypes' can be invoked with multiple content-type. It + // is difficult to form a correct method signature for convenience API, and hence the convenience API is not + // generated. + return this.serviceClient.uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponseAsync(contentType, data, + requestOptions); + } + + /** + * multiple data types map to multiple content types using shared route. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse(BinaryData data, + RequestOptions requestOptions) { + return this.serviceClient.uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponseAsync(data, + requestOptions); + } + + /** + * multiple data types map to multiple content types using shared route. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "application/json", "application/octet-stream", + * "image/jpeg", "image/png". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType, + BinaryData data, RequestOptions requestOptions) { + // Operation 'uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypes' can be invoked with multiple + // content-type. It is difficult to form a correct method signature for convenience API, and hence the + // convenience API is not generated. + return this.serviceClient.uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesWithResponseAsync(contentType, + data, requestOptions); + } + + /** + * multiple data types map to multiple content types using shared route. + * + * @param data The data parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono uploadJsonWithMultiBodyTypesForMultiContentTypes(Resource data) { + // Generated convenience method for uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse(BinaryData.fromObject(data), requestOptions) + .flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestClient.java new file mode 100644 index 00000000000..4756ef09f19 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestClient.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.multicontenttypes.implementation.MultipleContentTypesOnRequestsImpl; +import tsptest.multicontenttypes.models.Resource; + +/** + * Initializes a new instance of the synchronous MultiContentTypesClient type. + */ +@ServiceClient(builder = MultiContentTypesClientBuilder.class) +public final class MultipleContentTypesOnRequestClient { + @Generated + private final MultipleContentTypesOnRequestsImpl serviceClient; + + /** + * Initializes an instance of MultipleContentTypesOnRequestClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MultipleContentTypesOnRequestClient(MultipleContentTypesOnRequestsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * one data type maps to multiple content types. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", + * "image/png", "application/json-patch+json". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadBytesWithSingleBodyTypeForMultiContentTypesWithResponse(String contentType, + BinaryData data, RequestOptions requestOptions) { + // Operation 'uploadBytesWithSingleBodyTypeForMultiContentTypes' can be invoked with multiple content-type. It + // is difficult to form a correct method signature for convenience API, and hence the convenience API is not + // generated. + return this.serviceClient.uploadBytesWithSingleBodyTypeForMultiContentTypesWithResponse(contentType, data, + requestOptions); + } + + /** + * multiple data types map to multiple content types using shared route. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", + * "image/png". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType, + BinaryData data, RequestOptions requestOptions) { + // Operation 'uploadBytesWithMultiBodyTypesForMultiContentTypes' can be invoked with multiple content-type. It + // is difficult to form a correct method signature for convenience API, and hence the convenience API is not + // generated. + return this.serviceClient.uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponse(contentType, data, + requestOptions); + } + + /** + * multiple data types map to multiple content types using shared route. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse(BinaryData data, + RequestOptions requestOptions) { + return this.serviceClient.uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse(data, requestOptions); + } + + /** + * multiple data types map to multiple content types using shared route. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "application/json", "application/octet-stream", + * "image/jpeg", "image/png". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType, + BinaryData data, RequestOptions requestOptions) { + // Operation 'uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypes' can be invoked with multiple + // content-type. It is difficult to form a correct method signature for convenience API, and hence the + // convenience API is not generated. + return this.serviceClient.uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesWithResponse(contentType, data, + requestOptions); + } + + /** + * multiple data types map to multiple content types using shared route. + * + * @param data The data parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void uploadJsonWithMultiBodyTypesForMultiContentTypes(Resource data) { + // Generated convenience method for uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse + RequestOptions requestOptions = new RequestOptions(); + uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse(BinaryData.fromObject(data), requestOptions) + .getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeAsyncClient.java new file mode 100644 index 00000000000..adbde39c36e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeAsyncClient.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.multicontenttypes.implementation.SingleContentTypesImpl; + +/** + * Initializes a new instance of the asynchronous MultiContentTypesClient type. + */ +@ServiceClient(builder = MultiContentTypesClientBuilder.class, isAsync = true) +public final class SingleContentTypeAsyncClient { + @Generated + private final SingleContentTypesImpl serviceClient; + + /** + * Initializes an instance of SingleContentTypeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SingleContentTypeAsyncClient(SingleContentTypesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * response is binary. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> downloadImageForSingleContentTypeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.downloadImageForSingleContentTypeWithResponseAsync(requestOptions); + } + + /** + * request is binary. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadImageForSingleContentTypeWithResponse(BinaryData data, + RequestOptions requestOptions) { + return this.serviceClient.uploadImageForSingleContentTypeWithResponseAsync(data, requestOptions); + } + + /** + * response is binary. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono downloadImageForSingleContentType() { + // Generated convenience method for downloadImageForSingleContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return downloadImageForSingleContentTypeWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * request is binary. + * + * @param data The data parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono uploadImageForSingleContentType(BinaryData data) { + // Generated convenience method for uploadImageForSingleContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return uploadImageForSingleContentTypeWithResponse(data, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeClient.java new file mode 100644 index 00000000000..a31f6b5dbf3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/SingleContentTypeClient.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.multicontenttypes.implementation.SingleContentTypesImpl; + +/** + * Initializes a new instance of the synchronous MultiContentTypesClient type. + */ +@ServiceClient(builder = MultiContentTypesClientBuilder.class) +public final class SingleContentTypeClient { + @Generated + private final SingleContentTypesImpl serviceClient; + + /** + * Initializes an instance of SingleContentTypeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SingleContentTypeClient(SingleContentTypesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * response is binary. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response downloadImageForSingleContentTypeWithResponse(RequestOptions requestOptions) { + return this.serviceClient.downloadImageForSingleContentTypeWithResponse(requestOptions); + } + + /** + * request is binary. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadImageForSingleContentTypeWithResponse(BinaryData data, RequestOptions requestOptions) { + return this.serviceClient.uploadImageForSingleContentTypeWithResponse(data, requestOptions); + } + + /** + * response is binary. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData downloadImageForSingleContentType() { + // Generated convenience method for downloadImageForSingleContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + return downloadImageForSingleContentTypeWithResponse(requestOptions).getValue(); + } + + /** + * request is binary. + * + * @param data The data parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void uploadImageForSingleContentType(BinaryData data) { + // Generated convenience method for uploadImageForSingleContentTypeWithResponse + RequestOptions requestOptions = new RequestOptions(); + uploadImageForSingleContentTypeWithResponse(data, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultiContentTypesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultiContentTypesClientImpl.java new file mode 100644 index 00000000000..b673c499564 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultiContentTypesClientImpl.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the MultiContentTypesClient type. + */ +public final class MultiContentTypesClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MultiContentTypesClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 SingleContentTypesImpl object to access its operations. + */ + private final SingleContentTypesImpl singleContentTypes; + + /** + * Gets the SingleContentTypesImpl object to access its operations. + * + * @return the SingleContentTypesImpl object. + */ + public SingleContentTypesImpl getSingleContentTypes() { + return this.singleContentTypes; + } + + /** + * The MultipleContentTypesOnRequestsImpl object to access its operations. + */ + private final MultipleContentTypesOnRequestsImpl multipleContentTypesOnRequests; + + /** + * Gets the MultipleContentTypesOnRequestsImpl object to access its operations. + * + * @return the MultipleContentTypesOnRequestsImpl object. + */ + public MultipleContentTypesOnRequestsImpl getMultipleContentTypesOnRequests() { + return this.multipleContentTypesOnRequests; + } + + /** + * Initializes an instance of MultiContentTypesClient client. + * + * @param endpoint Service host. + */ + public MultiContentTypesClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of MultiContentTypesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public MultiContentTypesClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of MultiContentTypesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public MultiContentTypesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.singleContentTypes = new SingleContentTypesImpl(this); + this.multipleContentTypesOnRequests = new MultipleContentTypesOnRequestsImpl(this); + this.service + = RestProxy.create(MultiContentTypesClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for MultiContentTypesClient to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MultiContentTypesClient") + public interface MultiContentTypesClientService { + @Post("/upload/overload/multi-body-types") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> uploadWithOverload(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, + RequestOptions requestOptions, Context context); + + @Post("/upload/overload/multi-body-types") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response uploadWithOverloadSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, + RequestOptions requestOptions, Context context); + } + + /** + * multiple data types map to multiple content types. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "text/plain", "application/json", + * "application/octet-stream", "image/jpeg", "image/png". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadWithOverloadWithResponseAsync(String contentType, BinaryData data, + RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.uploadWithOverload(this.getEndpoint(), contentType, data, requestOptions, context)); + } + + /** + * multiple data types map to multiple content types. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "text/plain", "application/json", + * "application/octet-stream", "image/jpeg", "image/png". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadWithOverloadWithResponse(String contentType, BinaryData data, + RequestOptions requestOptions) { + return service.uploadWithOverloadSync(this.getEndpoint(), contentType, data, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java new file mode 100644 index 00000000000..eee0c3448f0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MultipleContentTypesOnRequests. + */ +public final class MultipleContentTypesOnRequestsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MultipleContentTypesOnRequestsService service; + + /** + * The service client containing this operation class. + */ + private final MultiContentTypesClientImpl client; + + /** + * Initializes an instance of MultipleContentTypesOnRequestsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MultipleContentTypesOnRequestsImpl(MultiContentTypesClientImpl client) { + this.service = RestProxy.create(MultipleContentTypesOnRequestsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MultiContentTypesClientMultipleContentTypesOnRequests to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MultiContentTypesClientMultipleContentTypesOnRequests") + public interface MultipleContentTypesOnRequestsService { + @Post("/multiple/sharedroute/request/upload/single-body-type") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> uploadBytesWithSingleBodyTypeForMultiContentTypes(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, + RequestOptions requestOptions, Context context); + + @Post("/multiple/sharedroute/request/upload/single-body-type") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response uploadBytesWithSingleBodyTypeForMultiContentTypesSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, + RequestOptions requestOptions, Context context); + + @Post("/multiple/sharedroute/request/upload/multi-body-types") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> uploadBytesWithMultiBodyTypesForMultiContentTypes(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, + RequestOptions requestOptions, Context context); + + @Post("/multiple/sharedroute/request/upload/multi-body-types") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response uploadBytesWithMultiBodyTypesForMultiContentTypesSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, + RequestOptions requestOptions, Context context); + + @Post("/multiple/sharedroute/request/upload/multi-body-types") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> uploadJsonWithMultiBodyTypesForMultiContentTypes(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, + RequestOptions requestOptions, Context context); + + @Post("/multiple/sharedroute/request/upload/multi-body-types") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response uploadJsonWithMultiBodyTypesForMultiContentTypesSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData data, + RequestOptions requestOptions, Context context); + + @Post("/multiple/sharedroute/request/upload/multi-body-types") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypes( + @HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, + @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); + + @Post("/multiple/sharedroute/request/upload/multi-body-types") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesSync( + @HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, + @BodyParam("application/json") BinaryData data, RequestOptions requestOptions, Context context); + } + + /** + * one data type maps to multiple content types. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", + * "image/png", "application/json-patch+json". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadBytesWithSingleBodyTypeForMultiContentTypesWithResponseAsync(String contentType, + BinaryData data, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.uploadBytesWithSingleBodyTypeForMultiContentTypes(this.client.getEndpoint(), + contentType, data, requestOptions, context)); + } + + /** + * one data type maps to multiple content types. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", + * "image/png", "application/json-patch+json". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadBytesWithSingleBodyTypeForMultiContentTypesWithResponse(String contentType, + BinaryData data, RequestOptions requestOptions) { + return service.uploadBytesWithSingleBodyTypeForMultiContentTypesSync(this.client.getEndpoint(), contentType, + data, requestOptions, Context.NONE); + } + + /** + * multiple data types map to multiple content types using shared route. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", + * "image/png". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponseAsync(String contentType, + BinaryData data, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.uploadBytesWithMultiBodyTypesForMultiContentTypes(this.client.getEndpoint(), + contentType, data, requestOptions, context)); + } + + /** + * multiple data types map to multiple content types using shared route. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "application/octet-stream", "image/jpeg", + * "image/png". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType, + BinaryData data, RequestOptions requestOptions) { + return service.uploadBytesWithMultiBodyTypesForMultiContentTypesSync(this.client.getEndpoint(), contentType, + data, requestOptions, Context.NONE); + } + + /** + * multiple data types map to multiple content types using shared route. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponseAsync(BinaryData data, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.uploadJsonWithMultiBodyTypesForMultiContentTypes(this.client.getEndpoint(), + contentType, data, requestOptions, context)); + } + + /** + * multiple data types map to multiple content types using shared route. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse(BinaryData data, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.uploadJsonWithMultiBodyTypesForMultiContentTypesSync(this.client.getEndpoint(), contentType, + data, requestOptions, Context.NONE); + } + + /** + * multiple data types map to multiple content types using shared route. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "application/json", "application/octet-stream", + * "image/jpeg", "image/png". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesWithResponseAsync( + String contentType, BinaryData data, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypes( + this.client.getEndpoint(), contentType, data, requestOptions, context)); + } + + /** + * multiple data types map to multiple content types using shared route. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param contentType The contentType parameter. Allowed values: "application/json", "application/octet-stream", + * "image/jpeg", "image/png". + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType, + BinaryData data, RequestOptions requestOptions) { + return service.uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypesSync(this.client.getEndpoint(), + contentType, data, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/SingleContentTypesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/SingleContentTypesImpl.java new file mode 100644 index 00000000000..a5ff02e2145 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/SingleContentTypesImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SingleContentTypes. + */ +public final class SingleContentTypesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SingleContentTypesService service; + + /** + * The service client containing this operation class. + */ + private final MultiContentTypesClientImpl client; + + /** + * Initializes an instance of SingleContentTypesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SingleContentTypesImpl(MultiContentTypesClientImpl client) { + this.service = RestProxy.create(SingleContentTypesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MultiContentTypesClientSingleContentTypes to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MultiContentTypesClientSingleContentTypes") + public interface SingleContentTypesService { + @Get("/single/request/download/image") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> downloadImageForSingleContentType(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/single/request/download/image") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response downloadImageForSingleContentTypeSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/single/request/upload/image") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> uploadImageForSingleContentType(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("image/png") BinaryData data, + RequestOptions requestOptions, Context context); + + @Post("/single/request/upload/image") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response uploadImageForSingleContentTypeSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("image/png") BinaryData data, + RequestOptions requestOptions, Context context); + } + + /** + * response is binary. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> + downloadImageForSingleContentTypeWithResponseAsync(RequestOptions requestOptions) { + final String accept = "image/png"; + return FluxUtil.withContext(context -> service.downloadImageForSingleContentType(this.client.getEndpoint(), + accept, requestOptions, context)); + } + + /** + * response is binary. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response downloadImageForSingleContentTypeWithResponse(RequestOptions requestOptions) { + final String accept = "image/png"; + return service.downloadImageForSingleContentTypeSync(this.client.getEndpoint(), accept, requestOptions, + Context.NONE); + } + + /** + * request is binary. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadImageForSingleContentTypeWithResponseAsync(BinaryData data, + RequestOptions requestOptions) { + final String contentType = "image/png"; + return FluxUtil.withContext(context -> service.uploadImageForSingleContentType(this.client.getEndpoint(), + contentType, data, requestOptions, context)); + } + + /** + * request is binary. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadImageForSingleContentTypeWithResponse(BinaryData data, RequestOptions requestOptions) { + final String contentType = "image/png"; + return service.uploadImageForSingleContentTypeSync(this.client.getEndpoint(), contentType, data, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/package-info.java new file mode 100644 index 00000000000..6734c6f872b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for MultiContentTypes. + * + */ +package tsptest.multicontenttypes.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/Resource.java new file mode 100644 index 00000000000..3f041405616 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/Resource.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Resource model. + */ +@Immutable +public final class Resource implements JsonSerializable { + /* + * The id property. + */ + @Generated + private String id; + + /* + * The name property. + */ + @Generated + private String name; + + /** + * Creates an instance of Resource class. + */ + @Generated + public Resource() { + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Resource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Resource. + */ + @Generated + public static Resource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Resource deserializedResource = new Resource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedResource.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResource; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/package-info.java new file mode 100644 index 00000000000..f5276e194b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for MultiContentTypes. + * + */ +package tsptest.multicontenttypes.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/package-info.java new file mode 100644 index 00000000000..f4ba7682f63 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multicontenttypes/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for MultiContentTypes. + * + */ +package tsptest.multicontenttypes; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartAsyncClient.java new file mode 100644 index 00000000000..f8d8b2ba647 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartAsyncClient.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; +import tsptest.multipart.implementation.MultipartClientImpl; +import tsptest.multipart.implementation.MultipartFormDataHelper; +import tsptest.multipart.models.FileDataFileDetails; +import tsptest.multipart.models.FormData; +import tsptest.multipart.models.UploadHttpPartRequest; + +/** + * Initializes a new instance of the asynchronous MultipartClient type. + */ +@ServiceClient(builder = MultipartClientBuilder.class, isAsync = true) +public final class MultipartAsyncClient { + @Generated + private final MultipartClientImpl serviceClient; + + /** + * Initializes an instance of MultipartAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MultipartAsyncClient(MultipartClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The upload operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param name The name parameter. + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> uploadWithResponse(String name, BinaryData data, RequestOptions requestOptions) { + // Operation 'upload' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.uploadWithResponseAsync(name, data, requestOptions); + } + + /** + * The uploadHttpPart operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param name The name parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> uploadHttpPartWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + // Operation 'uploadHttpPart' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.uploadHttpPartWithResponseAsync(name, body, requestOptions); + } + + /** + * The upload operation. + * + * @param name The name parameter. + * @param data The data parameter. + * @param compress The compress parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono upload(String name, FormData data, Boolean compress) { + // Generated convenience method for uploadWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (compress != null) { + requestOptions.addQueryParam("compress", String.valueOf(compress), false); + } + return uploadWithResponse(name, new MultipartFormDataHelper(requestOptions) + .serializeTextField("name", data.getName()) + .serializeTextField("resolution", String.valueOf(data.getResolution())) + .serializeTextField("type", Objects.toString(data.getType())) + .serializeJsonField("size", data.getSize()) + .serializeFileField("image", data.getImage().getContent(), data.getImage().getContentType(), + data.getImage().getFilename()) + .serializeFileFields("fileData", + data.getFileData() == null + ? null + : data.getFileData().stream().map(FileDataFileDetails::getContent).collect(Collectors.toList()), + data.getFileData() == null + ? null + : data.getFileData().stream().map(FileDataFileDetails::getContentType).collect(Collectors.toList()), + data.getFileData() == null + ? null + : data.getFileData().stream().map(FileDataFileDetails::getFilename).collect(Collectors.toList())) + .end() + .getRequestBody(), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The upload operation. + * + * @param name The name parameter. + * @param data The data parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono upload(String name, FormData data) { + // Generated convenience method for uploadWithResponse + RequestOptions requestOptions = new RequestOptions(); + return uploadWithResponse(name, new MultipartFormDataHelper(requestOptions) + .serializeTextField("name", data.getName()) + .serializeTextField("resolution", String.valueOf(data.getResolution())) + .serializeTextField("type", Objects.toString(data.getType())) + .serializeJsonField("size", data.getSize()) + .serializeFileField("image", data.getImage().getContent(), data.getImage().getContentType(), + data.getImage().getFilename()) + .serializeFileFields("fileData", + data.getFileData() == null + ? null + : data.getFileData().stream().map(FileDataFileDetails::getContent).collect(Collectors.toList()), + data.getFileData() == null + ? null + : data.getFileData().stream().map(FileDataFileDetails::getContentType).collect(Collectors.toList()), + data.getFileData() == null + ? null + : data.getFileData().stream().map(FileDataFileDetails::getFilename).collect(Collectors.toList())) + .end() + .getRequestBody(), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The uploadHttpPart operation. + * + * @param name The name parameter. + * @param body The body parameter. + * @param compress The compress parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono uploadHttpPart(String name, UploadHttpPartRequest body, Boolean compress) { + // Generated convenience method for uploadHttpPartWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (compress != null) { + requestOptions.addQueryParam("compress", String.valueOf(compress), false); + } + return uploadHttpPartWithResponse(name, + new MultipartFormDataHelper(requestOptions) + .serializeFileField("fileData1", body.getFileData1().getContent(), body.getFileData1().getContentType(), + body.getFileData1().getFilename()) + .serializeFileField("file_data2", body.getFileData2().getContent(), + body.getFileData2().getContentType(), body.getFileData2().getFilename()) + .serializeJsonField("size", body.getSize()) + .end() + .getRequestBody(), + requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The uploadHttpPart operation. + * + * @param name The name parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono uploadHttpPart(String name, UploadHttpPartRequest body) { + // Generated convenience method for uploadHttpPartWithResponse + RequestOptions requestOptions = new RequestOptions(); + return uploadHttpPartWithResponse(name, + new MultipartFormDataHelper(requestOptions) + .serializeFileField("fileData1", body.getFileData1().getContent(), body.getFileData1().getContentType(), + body.getFileData1().getFilename()) + .serializeFileField("file_data2", body.getFileData2().getContent(), + body.getFileData2().getContentType(), body.getFileData2().getFilename()) + .serializeJsonField("size", body.getSize()) + .end() + .getRequestBody(), + requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClient.java new file mode 100644 index 00000000000..e40db34a66c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.util.Objects; +import java.util.stream.Collectors; +import tsptest.multipart.implementation.MultipartClientImpl; +import tsptest.multipart.implementation.MultipartFormDataHelper; +import tsptest.multipart.models.FileDataFileDetails; +import tsptest.multipart.models.FormData; +import tsptest.multipart.models.UploadHttpPartRequest; + +/** + * Initializes a new instance of the synchronous MultipartClient type. + */ +@ServiceClient(builder = MultipartClientBuilder.class) +public final class MultipartClient { + @Generated + private final MultipartClientImpl serviceClient; + + /** + * Initializes an instance of MultipartClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MultipartClient(MultipartClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The upload operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param name The name parameter. + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response uploadWithResponse(String name, BinaryData data, RequestOptions requestOptions) { + // Operation 'upload' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.uploadWithResponse(name, data, requestOptions); + } + + /** + * The uploadHttpPart operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param name The name parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response uploadHttpPartWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + // Operation 'uploadHttpPart' is of content-type 'multipart/form-data'. Protocol API is not usable and hence not + // generated. + return this.serviceClient.uploadHttpPartWithResponse(name, body, requestOptions); + } + + /** + * The upload operation. + * + * @param name The name parameter. + * @param data The data parameter. + * @param compress The compress parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void upload(String name, FormData data, Boolean compress) { + // Generated convenience method for uploadWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (compress != null) { + requestOptions.addQueryParam("compress", String.valueOf(compress), false); + } + uploadWithResponse(name, new MultipartFormDataHelper(requestOptions).serializeTextField("name", data.getName()) + .serializeTextField("resolution", String.valueOf(data.getResolution())) + .serializeTextField("type", Objects.toString(data.getType())) + .serializeJsonField("size", data.getSize()) + .serializeFileField("image", data.getImage().getContent(), data.getImage().getContentType(), + data.getImage().getFilename()) + .serializeFileFields("fileData", + data.getFileData() == null + ? null + : data.getFileData().stream().map(FileDataFileDetails::getContent).collect(Collectors.toList()), + data.getFileData() == null + ? null + : data.getFileData().stream().map(FileDataFileDetails::getContentType).collect(Collectors.toList()), + data.getFileData() == null + ? null + : data.getFileData().stream().map(FileDataFileDetails::getFilename).collect(Collectors.toList())) + .end() + .getRequestBody(), requestOptions).getValue(); + } + + /** + * The upload operation. + * + * @param name The name parameter. + * @param data The data parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void upload(String name, FormData data) { + // Generated convenience method for uploadWithResponse + RequestOptions requestOptions = new RequestOptions(); + uploadWithResponse(name, new MultipartFormDataHelper(requestOptions).serializeTextField("name", data.getName()) + .serializeTextField("resolution", String.valueOf(data.getResolution())) + .serializeTextField("type", Objects.toString(data.getType())) + .serializeJsonField("size", data.getSize()) + .serializeFileField("image", data.getImage().getContent(), data.getImage().getContentType(), + data.getImage().getFilename()) + .serializeFileFields("fileData", + data.getFileData() == null + ? null + : data.getFileData().stream().map(FileDataFileDetails::getContent).collect(Collectors.toList()), + data.getFileData() == null + ? null + : data.getFileData().stream().map(FileDataFileDetails::getContentType).collect(Collectors.toList()), + data.getFileData() == null + ? null + : data.getFileData().stream().map(FileDataFileDetails::getFilename).collect(Collectors.toList())) + .end() + .getRequestBody(), requestOptions).getValue(); + } + + /** + * The uploadHttpPart operation. + * + * @param name The name parameter. + * @param body The body parameter. + * @param compress The compress parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void uploadHttpPart(String name, UploadHttpPartRequest body, Boolean compress) { + // Generated convenience method for uploadHttpPartWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (compress != null) { + requestOptions.addQueryParam("compress", String.valueOf(compress), false); + } + uploadHttpPartWithResponse(name, + new MultipartFormDataHelper(requestOptions) + .serializeFileField("fileData1", body.getFileData1().getContent(), body.getFileData1().getContentType(), + body.getFileData1().getFilename()) + .serializeFileField("file_data2", body.getFileData2().getContent(), + body.getFileData2().getContentType(), body.getFileData2().getFilename()) + .serializeJsonField("size", body.getSize()) + .end() + .getRequestBody(), + requestOptions).getValue(); + } + + /** + * The uploadHttpPart operation. + * + * @param name The name parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void uploadHttpPart(String name, UploadHttpPartRequest body) { + // Generated convenience method for uploadHttpPartWithResponse + RequestOptions requestOptions = new RequestOptions(); + uploadHttpPartWithResponse(name, + new MultipartFormDataHelper(requestOptions) + .serializeFileField("fileData1", body.getFileData1().getContent(), body.getFileData1().getContentType(), + body.getFileData1().getFilename()) + .serializeFileField("file_data2", body.getFileData2().getContent(), + body.getFileData2().getContentType(), body.getFileData2().getFilename()) + .serializeJsonField("size", body.getSize()) + .end() + .getRequestBody(), + requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClientBuilder.java new file mode 100644 index 00000000000..97c48ebc795 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/MultipartClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.multipart.implementation.MultipartClientImpl; + +/** + * A builder for creating a new instance of the MultipartClient type. + */ +@ServiceClientBuilder(serviceClients = { MultipartClient.class, MultipartAsyncClient.class }) +public final class MultipartClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-multipart.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the MultipartClientBuilder. + */ + @Generated + public MultipartClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipartClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipartClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipartClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipartClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipartClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipartClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipartClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MultipartClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the MultipartClientBuilder. + */ + @Generated + public MultipartClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of MultipartClientImpl with the provided parameters. + * + * @return an instance of MultipartClientImpl. + */ + @Generated + private MultipartClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + MultipartClientImpl client + = new MultipartClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of MultipartAsyncClient class. + * + * @return an instance of MultipartAsyncClient. + */ + @Generated + public MultipartAsyncClient buildAsyncClient() { + return new MultipartAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of MultipartClient class. + * + * @return an instance of MultipartClient. + */ + @Generated + public MultipartClient buildClient() { + return new MultipartClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(MultipartClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartClientImpl.java new file mode 100644 index 00000000000..ab3d2218895 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartClientImpl.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the MultipartClient type. + */ +public final class MultipartClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MultipartClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of MultipartClient client. + * + * @param endpoint Service host. + */ + public MultipartClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of MultipartClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public MultipartClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of MultipartClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public MultipartClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(MultipartClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for MultipartClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MultipartClient") + public interface MultipartClientService { + // @Multipart not supported by RestProxy + @Post("/upload/images/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> upload(@HostParam("endpoint") String endpoint, @PathParam("name") String name, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData data, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/upload/images/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response uploadSync(@HostParam("endpoint") String endpoint, @PathParam("name") String name, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData data, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/uploadHttpPart/images/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> uploadHttpPart(@HostParam("endpoint") String endpoint, @PathParam("name") String name, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + + // @Multipart not supported by RestProxy + @Post("/uploadHttpPart/images/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response uploadHttpPartSync(@HostParam("endpoint") String endpoint, @PathParam("name") String name, + @HeaderParam("content-type") String contentType, @BodyParam("multipart/form-data") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The upload operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param name The name parameter. + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadWithResponseAsync(String name, BinaryData data, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext( + context -> service.upload(this.getEndpoint(), name, contentType, data, requestOptions, context)); + } + + /** + * The upload operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param name The name parameter. + * @param data The data parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadWithResponse(String name, BinaryData data, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.uploadSync(this.getEndpoint(), name, contentType, data, requestOptions, Context.NONE); + } + + /** + * The uploadHttpPart operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param name The name parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> uploadHttpPartWithResponseAsync(String name, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return FluxUtil.withContext( + context -> service.uploadHttpPart(this.getEndpoint(), name, contentType, body, requestOptions, context)); + } + + /** + * The uploadHttpPart operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
compressBooleanNoThe compress parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param name The name parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response uploadHttpPartWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; + return service.uploadHttpPartSync(this.getEndpoint(), name, contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartFormDataHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartFormDataHelper.java new file mode 100644 index 00000000000..c6bd09ee567 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/MultipartFormDataHelper.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart.implementation; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.SequenceInputStream; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.UUID; + +// DO NOT modify this helper class + +public final class MultipartFormDataHelper { + /** + * Line separator for the multipart HTTP request. + */ + private static final String CRLF = "\r\n"; + + private static final String APPLICATION_OCTET_STREAM = "application/octet-stream"; + + /** + * Value to be used as part of the divider for the multipart requests. + */ + private final String boundary; + + /** + * The actual part separator in the request. This is obtained by prepending "--" to the "boundary". + */ + private final String partSeparator; + + /** + * The marker for the ending of a multipart request. This is obtained by post-pending "--" to the "partSeparator". + */ + private final String endMarker; + + /** + * Charset used for encoding the multipart HTTP request. + */ + private final Charset encoderCharset = StandardCharsets.UTF_8; + + private InputStream requestDataStream = new ByteArrayInputStream(new byte[0]); + private long requestLength = 0; + + private RequestOptions requestOptions; + private BinaryData requestBody; + + /** + * Default constructor used in the code. The boundary is a random value. + * + * @param requestOptions the RequestOptions to update + */ + public MultipartFormDataHelper(RequestOptions requestOptions) { + this(requestOptions, UUID.randomUUID().toString().substring(0, 16)); + } + + private MultipartFormDataHelper(RequestOptions requestOptions, String boundary) { + this.requestOptions = requestOptions; + this.boundary = boundary; + this.partSeparator = "--" + boundary; + this.endMarker = this.partSeparator + "--"; + } + + /** + * Gets the multipart HTTP request body. + * + * @return the BinaryData of the multipart HTTP request body + */ + public BinaryData getRequestBody() { + return requestBody; + } + + // text/plain + /** + * Formats a text/plain field for a multipart HTTP request. + * + * @param fieldName the field name + * @param value the value of the text/plain field + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper serializeTextField(String fieldName, String value) { + if (value != null) { + String serialized = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + + "\"" + CRLF + CRLF + value + CRLF; + byte[] data = serialized.getBytes(encoderCharset); + appendBytes(data); + } + return this; + } + + // application/json + /** + * Formats a application/json field for a multipart HTTP request. + * + * @param fieldName the field name + * @param jsonObject the object of the application/json field + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper serializeJsonField(String fieldName, Object jsonObject) { + if (jsonObject != null) { + String serialized + = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + "\"" + CRLF + + "Content-Type: application/json" + CRLF + CRLF + BinaryData.fromObject(jsonObject) + CRLF; + byte[] data = serialized.getBytes(encoderCharset); + appendBytes(data); + } + return this; + } + + /** + * Formats a file field for a multipart HTTP request. + * + * @param fieldName the field name + * @param file the BinaryData of the file + * @param contentType the content-type of the file + * @param filename the filename + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper serializeFileField(String fieldName, BinaryData file, String contentType, + String filename) { + if (file != null) { + if (CoreUtils.isNullOrEmpty(contentType)) { + contentType = APPLICATION_OCTET_STREAM; + } + writeFileField(fieldName, file, contentType, filename); + } + return this; + } + + /** + * Formats a file field (potentially multiple files) for a multipart HTTP request. + * + * @param fieldName the field name + * @param files the List of BinaryData of the files + * @param contentTypes the List of content-type of the files + * @param filenames the List of filenames + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper serializeFileFields(String fieldName, List files, + List contentTypes, List filenames) { + if (files != null) { + for (int i = 0; i < files.size(); ++i) { + BinaryData file = files.get(i); + String contentType = contentTypes.get(i); + if (CoreUtils.isNullOrEmpty(contentType)) { + contentType = APPLICATION_OCTET_STREAM; + } + String filename = filenames.get(i); + writeFileField(fieldName, file, contentType, filename); + } + } + return this; + } + + /** + * Ends the serialization of the multipart HTTP request. + * + * @return the MultipartFormDataHelper instance + */ + public MultipartFormDataHelper end() { + byte[] data = endMarker.getBytes(encoderCharset); + appendBytes(data); + + requestBody = BinaryData.fromStream(requestDataStream, requestLength); + + requestOptions.setHeader(HttpHeaderName.CONTENT_TYPE, "multipart/form-data; boundary=" + this.boundary) + .setHeader(HttpHeaderName.CONTENT_LENGTH, String.valueOf(requestLength)); + + return this; + } + + private void writeFileField(String fieldName, BinaryData file, String contentType, String filename) { + String contentDispositionFilename = ""; + if (!CoreUtils.isNullOrEmpty(filename)) { + contentDispositionFilename = "; filename=\"" + escapeName(filename) + "\""; + } + + // Multipart preamble + String fileFieldPreamble + = partSeparator + CRLF + "Content-Disposition: form-data; name=\"" + escapeName(fieldName) + "\"" + + contentDispositionFilename + CRLF + "Content-Type: " + contentType + CRLF + CRLF; + byte[] data = fileFieldPreamble.getBytes(encoderCharset); + appendBytes(data); + + // Writing the file into the request as a byte stream + requestLength += file.getLength(); + requestDataStream = new SequenceInputStream(requestDataStream, file.toStream()); + + // CRLF + data = CRLF.getBytes(encoderCharset); + appendBytes(data); + } + + private void appendBytes(byte[] bytes) { + requestLength += bytes.length; + requestDataStream = new SequenceInputStream(requestDataStream, new ByteArrayInputStream(bytes)); + } + + private static String escapeName(String name) { + return name.replace("\n", "%0A").replace("\r", "%0D").replace("\"", "%22"); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/package-info.java new file mode 100644 index 00000000000..4ecfe2e7d5b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Multipart. + * + */ +package tsptest.multipart.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDataFileDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDataFileDetails.java new file mode 100644 index 00000000000..462efb7cb3f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDataFileDetails.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; + +/** + * The file details for the "fileData" field. + */ +@Fluent +public final class FileDataFileDetails { + /* + * The content of the file. + */ + @Generated + private final BinaryData content; + + /* + * The filename of the file. + */ + @Generated + private String filename; + + /* + * The content-type of the file. + */ + @Generated + private String contentType = "application/octet-stream"; + + /** + * Creates an instance of FileDataFileDetails class. + * + * @param content the content value to set. + */ + @Generated + public FileDataFileDetails(BinaryData content) { + this.content = content; + } + + /** + * Get the content property: The content of the file. + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the filename property: The filename of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Set the filename property: The filename of the file. + * + * @param filename the filename value to set. + * @return the FileDataFileDetails object itself. + */ + @Generated + public FileDataFileDetails setFilename(String filename) { + this.filename = filename; + return this; + } + + /** + * Get the contentType property: The content-type of the file. + * + * @return the contentType value. + */ + @Generated + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The content-type of the file. + * + * @param contentType the contentType value to set. + * @return the FileDataFileDetails object itself. + */ + @Generated + public FileDataFileDetails setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDetails.java new file mode 100644 index 00000000000..63e0e2933b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FileDetails.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; + +/** + * A file in an HTTP request, response, or multipart payload. + * + * A file in an HTTP request, response, or multipart payload. + * + * Files have a special meaning that the HTTP library understands. When the body of an HTTP request, response, + * or multipart payload is _effectively_ an instance of `TypeSpec.Http.File` or any type that extends it, the + * operation is treated as a file upload or download. + * + * When using file bodies, the fields of the file model are defined to come from particular locations by default: + * + * - `contentType`: The `Content-Type` header of the request, response, or multipart payload (CANNOT be overridden or + * changed). + * - `contents`: The body of the request, response, or multipart payload (CANNOT be overridden or changed). + * - `filename`: The `filename` parameter value of the `Content-Disposition` header of the response or multipart payload + * (MAY be overridden or changed). + * + * A File may be used as a normal structured JSON object in a request or response, if the request specifies an explicit + * `Content-Type` header. In this case, the entire File model is serialized as if it were any other model. In a JSON + * payload, + * it will have a structure like: + * + * ``` + * { + * "contentType": <string?>, + * "filename": <string?>, + * "contents": <string, base64> + * } + * ``` + * + * The `contentType` _within_ the file defines what media types the data inside the file can be, but if the + * specification + * defines a `Content-Type` for the payload as HTTP metadata, that `Content-Type` metadata defines _how the file is + * serialized_. See the examples below for more information. + * + * NOTE: The `filename` and `contentType` fields are optional. Furthermore, the default location of `filename` + * (`Content-Disposition: <disposition>; filename=<filename>`) is only valid in HTTP responses and multipart + * payloads. If + * you wish to send the `filename` in a request, you must use HTTP metadata decorators to describe the location of the + * `filename` field. You can combine the metadata decorators with `@visibility` to control when the `filename` + * location + * is overridden, as shown in the examples below. + */ +@Fluent +public final class FileDetails { + /* + * The content of the file. + */ + @Generated + private final BinaryData content; + + /* + * The filename of the file. + */ + @Generated + private String filename; + + /* + * The content-type of the file. + */ + @Generated + private String contentType = "application/octet-stream"; + + /** + * Creates an instance of FileDetails class. + * + * @param content the content value to set. + */ + @Generated + public FileDetails(BinaryData content) { + this.content = content; + } + + /** + * Get the content property: The content of the file. + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the filename property: The filename of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Set the filename property: The filename of the file. + * + * @param filename the filename value to set. + * @return the FileDetails object itself. + */ + @Generated + public FileDetails setFilename(String filename) { + this.filename = filename; + return this; + } + + /** + * Get the contentType property: The content-type of the file. + * + * @return the contentType value. + */ + @Generated + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The content-type of the file. + * + * @param contentType the contentType value to set. + * @return the FileDetails object itself. + */ + @Generated + public FileDetails setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FormData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FormData.java new file mode 100644 index 00000000000..fe8ecd9f858 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/FormData.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import java.util.List; + +/** + * The FormData model. + */ +@Fluent +public final class FormData { + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The resolution property. + */ + @Generated + private final int resolution; + + /* + * The type property. + */ + @Generated + private final ImageType type; + + /* + * The size property. + */ + @Generated + private final Size size; + + /* + * The image property. + */ + @Generated + private final ImageFileDetails image; + + /* + * The fileData property. + */ + @Generated + private List fileData; + + /** + * Creates an instance of FormData class. + * + * @param name the name value to set. + * @param resolution the resolution value to set. + * @param type the type value to set. + * @param size the size value to set. + * @param image the image value to set. + */ + @Generated + public FormData(String name, int resolution, ImageType type, Size size, ImageFileDetails image) { + this.name = name; + this.resolution = resolution; + this.type = type; + this.size = size; + this.image = image; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the resolution property: The resolution property. + * + * @return the resolution value. + */ + @Generated + public int getResolution() { + return this.resolution; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + @Generated + public ImageType getType() { + return this.type; + } + + /** + * Get the size property: The size property. + * + * @return the size value. + */ + @Generated + public Size getSize() { + return this.size; + } + + /** + * Get the image property: The image property. + * + * @return the image value. + */ + @Generated + public ImageFileDetails getImage() { + return this.image; + } + + /** + * Get the fileData property: The fileData property. + * + * @return the fileData value. + */ + @Generated + public List getFileData() { + return this.fileData; + } + + /** + * Set the fileData property: The fileData property. + * + * @param fileData the fileData value to set. + * @return the FormData object itself. + */ + @Generated + public FormData setFileData(List fileData) { + this.fileData = fileData; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageFileDetails.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageFileDetails.java new file mode 100644 index 00000000000..367f4db02fb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageFileDetails.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; + +/** + * The file details for the "image" field. + */ +@Fluent +public final class ImageFileDetails { + /* + * The content of the file. + */ + @Generated + private final BinaryData content; + + /* + * The filename of the file. + */ + @Generated + private String filename; + + /* + * The content-type of the file. + */ + @Generated + private String contentType = "application/octet-stream"; + + /** + * Creates an instance of ImageFileDetails class. + * + * @param content the content value to set. + */ + @Generated + public ImageFileDetails(BinaryData content) { + this.content = content; + } + + /** + * Get the content property: The content of the file. + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the filename property: The filename of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Set the filename property: The filename of the file. + * + * @param filename the filename value to set. + * @return the ImageFileDetails object itself. + */ + @Generated + public ImageFileDetails setFilename(String filename) { + this.filename = filename; + return this; + } + + /** + * Get the contentType property: The content-type of the file. + * + * @return the contentType value. + */ + @Generated + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The content-type of the file. + * + * @param contentType the contentType value to set. + * @return the ImageFileDetails object itself. + */ + @Generated + public ImageFileDetails setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageType.java new file mode 100644 index 00000000000..a511648eeb1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/ImageType.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ImageType. + */ +public final class ImageType extends ExpandableStringEnum { + /** + * Static value JPEG for ImageType. + */ + @Generated + public static final ImageType JPEG = fromString("JPEG"); + + /** + * Static value PNG for ImageType. + */ + @Generated + public static final ImageType PNG = fromString("PNG"); + + /** + * Creates a new instance of ImageType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ImageType() { + } + + /** + * Creates or finds a ImageType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ImageType. + */ + @Generated + public static ImageType fromString(String name) { + return fromString(name, ImageType.class); + } + + /** + * Gets known ImageType values. + * + * @return known ImageType values. + */ + @Generated + public static Collection values() { + return values(ImageType.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/InheritFileData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/InheritFileData.java new file mode 100644 index 00000000000..e64e6189b2e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/InheritFileData.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; + +/** + * Image file of content-type "image/jpeg". + */ +@Immutable +public final class InheritFileData { + /* + * The content of the file. + */ + @Generated + private final BinaryData content; + + /* + * The filename of the file. + */ + @Generated + private final String filename; + + /* + * The content-type of the file. + */ + @Generated + private final String contentType = "image/jpeg"; + + /** + * Creates an instance of InheritFileData class. + * + * @param content the content value to set. + * @param filename the filename value to set. + */ + @Generated + public InheritFileData(BinaryData content, String filename) { + this.content = content; + this.filename = filename; + } + + /** + * Get the content property: The content of the file. + * + * @return the content value. + */ + @Generated + public BinaryData getContent() { + return this.content; + } + + /** + * Get the filename property: The filename of the file. + * + * @return the filename value. + */ + @Generated + public String getFilename() { + return this.filename; + } + + /** + * Get the contentType property: The content-type of the file. + * + * @return the contentType value. + */ + @Generated + public String getContentType() { + return this.contentType; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/Size.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/Size.java new file mode 100644 index 00000000000..4cd60179371 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/Size.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Size model. + */ +@Immutable +public final class Size implements JsonSerializable { + /* + * The width property. + */ + @Generated + private final int width; + + /* + * The height property. + */ + @Generated + private final int height; + + /** + * Creates an instance of Size class. + * + * @param width the width value to set. + * @param height the height value to set. + */ + @Generated + public Size(int width, int height) { + this.width = width; + this.height = height; + } + + /** + * Get the width property: The width property. + * + * @return the width value. + */ + @Generated + public int getWidth() { + return this.width; + } + + /** + * Get the height property: The height property. + * + * @return the height value. + */ + @Generated + public int getHeight() { + return this.height; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("width", this.width); + jsonWriter.writeIntField("height", this.height); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Size from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Size if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Size. + */ + @Generated + public static Size fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int width = 0; + int height = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("width".equals(fieldName)) { + width = reader.getInt(); + } else if ("height".equals(fieldName)) { + height = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new Size(width, height); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/UploadHttpPartRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/UploadHttpPartRequest.java new file mode 100644 index 00000000000..69f7bcdee36 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/UploadHttpPartRequest.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; + +/** + * The UploadHttpPartRequest model. + */ +@Immutable +public final class UploadHttpPartRequest { + /* + * The fileData1 property. + */ + @Generated + private final InheritFileData fileData1; + + /* + * The file_data2 property. + */ + @Generated + private final FileDetails fileData2; + + /* + * The size property. + */ + @Generated + private final Size size; + + /** + * Creates an instance of UploadHttpPartRequest class. + * + * @param fileData1 the fileData1 value to set. + * @param fileData2 the fileData2 value to set. + * @param size the size value to set. + */ + @Generated + public UploadHttpPartRequest(InheritFileData fileData1, FileDetails fileData2, Size size) { + this.fileData1 = fileData1; + this.fileData2 = fileData2; + this.size = size; + } + + /** + * Get the fileData1 property: The fileData1 property. + * + * @return the fileData1 value. + */ + @Generated + public InheritFileData getFileData1() { + return this.fileData1; + } + + /** + * Get the fileData2 property: The file_data2 property. + * + * @return the fileData2 value. + */ + @Generated + public FileDetails getFileData2() { + return this.fileData2; + } + + /** + * Get the size property: The size property. + * + * @return the size value. + */ + @Generated + public Size getSize() { + return this.size; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/package-info.java new file mode 100644 index 00000000000..b0ec5b4d132 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Multipart. + * + */ +package tsptest.multipart.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/package-info.java new file mode 100644 index 00000000000..3256bb30ce9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/multipart/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Multipart. + * + */ +package tsptest.multipart; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceAsyncClient.java new file mode 100644 index 00000000000..0cb9b4e6969 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceAsyncClient.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namespaceclient; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.namespaceclient.implementation.NamespaceClientImpl; +import tsptest.namespacemodel.models.Model; + +/** + * Initializes a new instance of the asynchronous NamespaceClient type. + */ +@ServiceClient(builder = NamespaceClientBuilder.class, isAsync = true) +public final class NamespaceAsyncClient { + @Generated + private final NamespaceClientImpl serviceClient; + + /** + * Initializes an instance of NamespaceAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NamespaceAsyncClient(NamespaceClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Model.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClient.java new file mode 100644 index 00000000000..1bd2a5e86b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namespaceclient; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.namespaceclient.implementation.NamespaceClientImpl; +import tsptest.namespacemodel.models.Model; + +/** + * Initializes a new instance of the synchronous NamespaceClient type. + */ +@ServiceClient(builder = NamespaceClientBuilder.class) +public final class NamespaceClient { + @Generated + private final NamespaceClientImpl serviceClient; + + /** + * Initializes an instance of NamespaceClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NamespaceClient(NamespaceClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Model get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(Model.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClientBuilder.java new file mode 100644 index 00000000000..344e7a51192 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/NamespaceClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namespaceclient; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.namespaceclient.implementation.NamespaceClientImpl; + +/** + * A builder for creating a new instance of the NamespaceClient type. + */ +@ServiceClientBuilder(serviceClients = { NamespaceClient.class, NamespaceAsyncClient.class }) +public final class NamespaceClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-namespaceclient.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the NamespaceClientBuilder. + */ + @Generated + public NamespaceClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamespaceClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamespaceClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamespaceClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamespaceClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamespaceClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamespaceClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamespaceClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamespaceClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the NamespaceClientBuilder. + */ + @Generated + public NamespaceClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of NamespaceClientImpl with the provided parameters. + * + * @return an instance of NamespaceClientImpl. + */ + @Generated + private NamespaceClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + NamespaceClientImpl client + = new NamespaceClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of NamespaceAsyncClient class. + * + * @return an instance of NamespaceAsyncClient. + */ + @Generated + public NamespaceAsyncClient buildAsyncClient() { + return new NamespaceAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of NamespaceClient class. + * + * @return an instance of NamespaceClient. + */ + @Generated + public NamespaceClient buildClient() { + return new NamespaceClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(NamespaceClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/NamespaceClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/NamespaceClientImpl.java new file mode 100644 index 00000000000..c58ec9223bb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/NamespaceClientImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namespaceclient.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the NamespaceClient type. + */ +public final class NamespaceClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NamespaceClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of NamespaceClient client. + * + * @param endpoint Service host. + */ + public NamespaceClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NamespaceClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public NamespaceClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NamespaceClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public NamespaceClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(NamespaceClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for NamespaceClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NamespaceClient") + public interface NamespaceClientService { + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/package-info.java new file mode 100644 index 00000000000..0e540fa17cd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for NamespaceClient. + * + */ +package tsptest.namespaceclient.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/package-info.java new file mode 100644 index 00000000000..dcddec09867 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespaceclient/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for NamespaceClient. + * + */ +package tsptest.namespaceclient; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/Model.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/Model.java new file mode 100644 index 00000000000..617827e76fe --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/Model.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namespacemodel.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Model model. + */ +@Immutable +public final class Model implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Model class. + * + * @param name the name value to set. + */ + @Generated + private Model(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Model from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Model if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Model. + */ + @Generated + public static Model fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Model(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/package-info.java new file mode 100644 index 00000000000..4b2e5d07af6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namespacemodel/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for NamespaceClient. + * + */ +package tsptest.namespacemodel.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingAsyncClient.java new file mode 100644 index 00000000000..6344b136f0f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingAsyncClient.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.naming.implementation.NamingOpsImpl; +import tsptest.naming.models.DataRequest; +import tsptest.naming.models.DataResponse; +import tsptest.naming.models.GetAnonymousResponse; + +/** + * Initializes a new instance of the asynchronous NamingClient type. + */ +@ServiceClient(builder = NamingClientBuilder.class, isAsync = true) +public final class NamingAsyncClient { + @Generated + private final NamingOpsImpl serviceClient; + + /** + * Initializes an instance of NamingAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NamingAsyncClient(NamingOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * summary of POST op + * + * description of POST op. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter + * + * description of etag header parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     parameters (Optional): {
+     *         type: String(Type1/Type2) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         data (Required): {
+     *             @data.kind: String (Required)
+     *         }
+     *     }
+     *     type: String(Blob/File) (Required)
+     *     status: String(Running/Completed/Failed) (Required)
+     *     domainUsername: String (Required)
+     *     anonymous (Required): {
+     *         last_error (Required): {
+     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return summary of Response along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postWithResponseAsync(name, body, requestOptions); + } + + /** + * The getAnonymous operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAnonymousWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAnonymousWithResponseAsync(requestOptions); + } + + /** + * summary of POST op + * + * description of POST op. + * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @param etag summary of etag header parameter + * + * description of etag header parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summary of Response on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono post(String name, DataRequest body, String etag) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (etag != null) { + requestOptions.setHeader(HttpHeaderName.ETAG, etag); + } + return postWithResponse(name, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DataResponse.class)); + } + + /** + * summary of POST op + * + * description of POST op. + * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summary of Response on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono post(String name, DataRequest body) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postWithResponse(name, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DataResponse.class)); + } + + /** + * The getAnonymous operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAnonymous() { + // Generated convenience method for getAnonymousWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAnonymousWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetAnonymousResponse.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClient.java new file mode 100644 index 00000000000..cb8985e33f8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClient.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package tsptest.naming; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.naming.implementation.NamingOpsImpl; +import tsptest.naming.models.DataRequest; +import tsptest.naming.models.DataResponse; +import tsptest.naming.models.GetAnonymousResponse; + +/** + * Initializes a new instance of the synchronous NamingClient type. + */ +@ServiceClient(builder = NamingClientBuilder.class) +public final class NamingClient { + + @Generated + private final NamingOpsImpl serviceClient; + + /** + * Initializes an instance of NamingClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NamingClient(NamingOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Protocol method for POST operation. + * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return summary of Response along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postWithResponse(name, body, requestOptions); + } + + /** + * The getAnonymous operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAnonymousWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAnonymousWithResponse(requestOptions); + } + + /** + * summary of POST op + * + * description of POST op. + * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @param etag summary of etag header parameter + * + * description of etag header parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summary of Response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DataResponse post(String name, DataRequest body, String etag) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (etag != null) { + requestOptions.setHeader(HttpHeaderName.ETAG, etag); + } + return postWithResponse(name, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(DataResponse.class); + } + + /** + * summary of POST op + * + * description of POST op. + * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summary of Response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DataResponse post(String name, DataRequest body) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postWithResponse(name, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(DataResponse.class); + } + + /** + * The getAnonymous operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetAnonymousResponse getAnonymous() { + // Generated convenience method for getAnonymousWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAnonymousWithResponse(requestOptions).getValue().toObject(GetAnonymousResponse.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClientBuilder.java new file mode 100644 index 00000000000..75f61f79a6f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/NamingClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.naming.implementation.NamingClientImpl; + +/** + * A builder for creating a new instance of the NamingClient type. + */ +@ServiceClientBuilder(serviceClients = { NamingClient.class, NamingAsyncClient.class }) +public final class NamingClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-naming.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the NamingClientBuilder. + */ + @Generated + public NamingClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the NamingClientBuilder. + */ + @Generated + public NamingClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of NamingClientImpl with the provided parameters. + * + * @return an instance of NamingClientImpl. + */ + @Generated + private NamingClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + NamingClientImpl client + = new NamingClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of NamingAsyncClient class. + * + * @return an instance of NamingAsyncClient. + */ + @Generated + public NamingAsyncClient buildAsyncClient() { + return new NamingAsyncClient(buildInnerClient().getNamingOps()); + } + + /** + * Builds an instance of NamingClient class. + * + * @return an instance of NamingClient. + */ + @Generated + public NamingClient buildClient() { + return new NamingClient(buildInnerClient().getNamingOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(NamingClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingClientImpl.java new file mode 100644 index 00000000000..3a8586c017f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 NamingClient type. + */ +public final class NamingClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 NamingOpsImpl object to access its operations. + */ + private final NamingOpsImpl namingOps; + + /** + * Gets the NamingOpsImpl object to access its operations. + * + * @return the NamingOpsImpl object. + */ + public NamingOpsImpl getNamingOps() { + return this.namingOps; + } + + /** + * Initializes an instance of NamingClient client. + * + * @param endpoint Service host. + */ + public NamingClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NamingClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public NamingClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NamingClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public NamingClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.namingOps = new NamingOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingOpsImpl.java new file mode 100644 index 00000000000..ac85523dc45 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/NamingOpsImpl.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NamingOps. + */ +public final class NamingOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NamingOpsService service; + + /** + * The service client containing this operation class. + */ + private final NamingClientImpl client; + + /** + * Initializes an instance of NamingOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NamingOpsImpl(NamingClientImpl client) { + this.service + = RestProxy.create(NamingOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NamingClientNamingOps to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NamingClientNamingOps") + public interface NamingOpsService { + @Post("/naming") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> post(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/naming") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postSync(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Get("/naming") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAnonymous(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/naming") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAnonymousSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * summary of POST op + * + * description of POST op. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter + * + * description of etag header parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     parameters (Optional): {
+     *         type: String(Type1/Type2) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         data (Required): {
+     *             @data.kind: String (Required)
+     *         }
+     *     }
+     *     type: String(Blob/File) (Required)
+     *     status: String(Running/Completed/Failed) (Required)
+     *     domainUsername: String (Required)
+     *     anonymous (Required): {
+     *         last_error (Required): {
+     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return summary of Response along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postWithResponseAsync(String name, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.post(this.client.getEndpoint(), name, contentType, accept, body, + requestOptions, context)); + } + + /** + * summary of POST op + * + * description of POST op. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter + * + * description of etag header parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     parameters (Optional): {
+     *         type: String(Type1/Type2) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         data (Required): {
+     *             @data.kind: String (Required)
+     *         }
+     *     }
+     *     type: String(Blob/File) (Required)
+     *     status: String(Running/Completed/Failed) (Required)
+     *     domainUsername: String (Required)
+     *     anonymous (Required): {
+     *         last_error (Required): {
+     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return summary of Response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.postSync(this.client.getEndpoint(), name, contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The getAnonymous operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAnonymousWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAnonymous(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getAnonymous operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAnonymousWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAnonymousSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/package-info.java new file mode 100644 index 00000000000..a47fa92ef10 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Naming. + * description of Naming. + * + */ +package tsptest.naming.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BinaryData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BinaryData.java new file mode 100644 index 00000000000..a51ef586908 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BinaryData.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * summary of Data + * + * description of Data. + */ +@Immutable +public final class BinaryData implements JsonSerializable { + /* + * summary of data property + * + * description of data property + */ + @Generated + private final Data data; + + /** + * Creates an instance of BinaryData class. + * + * @param data the data value to set. + */ + @Generated + private BinaryData(Data data) { + this.data = data; + } + + /** + * Get the data property: summary of data property + * + * description of data property. + * + * @return the data value. + */ + @Generated + public Data getData() { + return this.data; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("data", this.data); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BinaryData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BinaryData if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BinaryData. + */ + @Generated + public static BinaryData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Data data = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data".equals(fieldName)) { + data = Data.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new BinaryData(data); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BytesData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BytesData.java new file mode 100644 index 00000000000..d66718c150e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/BytesData.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The BytesData model. + */ +@Immutable +public final class BytesData extends Data { + /* + * The @data.kind property. + */ + @Generated + private String type = "bytes"; + + /* + * Data as {@code byte[]} + */ + @Generated + private final byte[] dataAsBytes; + + /** + * Creates an instance of BytesData class. + * + * @param dataAsBytes the dataAsBytes value to set. + */ + @Generated + private BytesData(byte[] dataAsBytes) { + this.dataAsBytes = dataAsBytes; + } + + /** + * Get the type property: The @data.kind property. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the dataAsBytes property: Data as {@code byte[]}. + * + * @return the dataAsBytes value. + */ + @Generated + public byte[] getDataAsBytes() { + return CoreUtils.clone(this.dataAsBytes); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBinaryField("data_bytes", this.dataAsBytes); + jsonWriter.writeStringField("@data.kind", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BytesData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BytesData if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BytesData. + */ + @Generated + public static BytesData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + byte[] dataAsBytes = null; + String type = "bytes"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data_bytes".equals(fieldName)) { + dataAsBytes = reader.getBinary(); + } else if ("@data.kind".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + BytesData deserializedBytesData = new BytesData(dataAsBytes); + deserializedBytesData.type = type; + + return deserializedBytesData; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/Data.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/Data.java new file mode 100644 index 00000000000..f142281b1a0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/Data.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Dummy doc to make the javadoc break at the 'at' symbol. The type of the Data depends on + * @data.kind.letusmakeitlongsoitwouldbreakbeforethis field. + */ +@Immutable +public class Data implements JsonSerializable { + /* + * The @data.kind property. + */ + @Generated + private String type = "Data"; + + /** + * Creates an instance of Data class. + */ + @Generated + protected Data() { + } + + /** + * Get the type property: The @data.kind property. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@data.kind", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Data from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Data if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Data. + */ + @Generated + public static Data fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("@data.kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("bytes".equals(discriminatorValue)) { + return BytesData.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Data fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Data deserializedData = new Data(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@data.kind".equals(fieldName)) { + deserializedData.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedData; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataRequest.java new file mode 100644 index 00000000000..40ba19e0287 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataRequest.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * summary of Request + * + * description of Request. + */ +@Fluent +public final class DataRequest implements JsonSerializable { + /* + * The parameters property. + */ + @Generated + private RequestParameters parameters; + + /** + * Creates an instance of DataRequest class. + */ + @Generated + public DataRequest() { + } + + /** + * Get the parameters property: The parameters property. + * + * @return the parameters value. + */ + @Generated + public RequestParameters getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: The parameters property. + * + * @param parameters the parameters value to set. + * @return the DataRequest object itself. + */ + @Generated + public DataRequest setParameters(RequestParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("parameters", this.parameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DataRequest. + */ + @Generated + public static DataRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataRequest deserializedDataRequest = new DataRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("parameters".equals(fieldName)) { + deserializedDataRequest.parameters = RequestParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDataRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataResponse.java new file mode 100644 index 00000000000..7c4dc52c42c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataResponse.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * summary of Response + * + * description of Response. Include tab ' ' in doc. + */ +@Immutable +public final class DataResponse implements JsonSerializable { + /* + * summary of name property + * + * description of name property + */ + @Generated + private final String name; + + /* + * summary of data property + * + * description of data property + */ + @Generated + private final BinaryData data; + + /* + * summary of type property + * + * description of type property + */ + @Generated + private final TypesModel dataType; + + /* + * summary of status property + * + * description of status property + */ + @Generated + private final DataStatus status; + + /* + * The domain{@code \}username data + */ + @Generated + private final String domainUsername; + + /* + * The anonymous property. + */ + @Generated + private final RunObject anonymous; + + /** + * Creates an instance of DataResponse class. + * + * @param name the name value to set. + * @param data the data value to set. + * @param dataType the dataType value to set. + * @param status the status value to set. + * @param domainUsername the domainUsername value to set. + * @param anonymous the anonymous value to set. + */ + @Generated + private DataResponse(String name, BinaryData data, TypesModel dataType, DataStatus status, String domainUsername, + RunObject anonymous) { + this.name = name; + this.data = data; + this.dataType = dataType; + this.status = status; + this.domainUsername = domainUsername; + this.anonymous = anonymous; + } + + /** + * Get the name property: summary of name property + * + * description of name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the data property: summary of data property + * + * description of data property. + * + * @return the data value. + */ + @Generated + public BinaryData getData() { + return this.data; + } + + /** + * Get the dataType property: summary of type property + * + * description of type property. + * + * @return the dataType value. + */ + @Generated + public TypesModel getDataType() { + return this.dataType; + } + + /** + * Get the status property: summary of status property + * + * description of status property. + * + * @return the status value. + */ + @Generated + public DataStatus getStatus() { + return this.status; + } + + /** + * Get the domainUsername property: The domain{@code \}username data. + * + * @return the domainUsername value. + */ + @Generated + public String getDomainUsername() { + return this.domainUsername; + } + + /** + * Get the anonymous property: The anonymous property. + * + * @return the anonymous value. + */ + @Generated + public RunObject getAnonymous() { + return this.anonymous; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("data", this.data); + jsonWriter.writeStringField("type", this.dataType == null ? null : this.dataType.toString()); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("domainUsername", this.domainUsername); + jsonWriter.writeJsonField("anonymous", this.anonymous); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataResponse if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DataResponse. + */ + @Generated + public static DataResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + BinaryData data = null; + TypesModel dataType = null; + DataStatus status = null; + String domainUsername = null; + RunObject anonymous = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("data".equals(fieldName)) { + data = BinaryData.fromJson(reader); + } else if ("type".equals(fieldName)) { + dataType = TypesModel.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + status = DataStatus.fromString(reader.getString()); + } else if ("domainUsername".equals(fieldName)) { + domainUsername = reader.getString(); + } else if ("anonymous".equals(fieldName)) { + anonymous = RunObject.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new DataResponse(name, data, dataType, status, domainUsername, anonymous); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataStatus.java new file mode 100644 index 00000000000..26e3339fee8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/DataStatus.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * summary of Statuses + * + * description of Statuses. + */ +public final class DataStatus extends ExpandableStringEnum { + /** + * Static value Running for DataStatus. + */ + @Generated + public static final DataStatus LRO_RUNNING = fromString("Running"); + + /** + * Static value Completed for DataStatus. + */ + @Generated + public static final DataStatus COMPLETED = fromString("Completed"); + + /** + * Static value Failed for DataStatus. + */ + @Generated + public static final DataStatus FAILED = fromString("Failed"); + + /** + * Creates a new instance of DataStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DataStatus() { + } + + /** + * Creates or finds a DataStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataStatus. + */ + @Generated + public static DataStatus fromString(String name) { + return fromString(name, DataStatus.class); + } + + /** + * Gets known DataStatus values. + * + * @return known DataStatus values. + */ + @Generated + public static Collection values() { + return values(DataStatus.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/GetAnonymousResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/GetAnonymousResponse.java new file mode 100644 index 00000000000..9b492a30ea8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/GetAnonymousResponse.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetAnonymousResponse model. + */ +@Immutable +public final class GetAnonymousResponse implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of GetAnonymousResponse class. + * + * @param name the name value to set. + */ + @Generated + private GetAnonymousResponse(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetAnonymousResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetAnonymousResponse if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetAnonymousResponse. + */ + @Generated + public static GetAnonymousResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new GetAnonymousResponse(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParameters.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParameters.java new file mode 100644 index 00000000000..8f9a29b384b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParameters.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The RequestParameters model. + */ +@Immutable +public final class RequestParameters implements JsonSerializable { + /* + * The type property. + */ + @Generated + private final RequestParametersType type; + + /** + * Creates an instance of RequestParameters class. + * + * @param type the type value to set. + */ + @Generated + public RequestParameters(RequestParametersType type) { + this.type = type; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + @Generated + public RequestParametersType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequestParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequestParameters if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RequestParameters. + */ + @Generated + public static RequestParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RequestParametersType type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + type = RequestParametersType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new RequestParameters(type); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParametersType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParametersType.java new file mode 100644 index 00000000000..69c776a2237 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RequestParametersType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +/** + * Defines values for RequestParametersType. + */ +public enum RequestParametersType { + /** + * Enum value Type1. + */ + TYPE1("Type1"), + + /** + * Enum value Type2. + */ + TYPE2("Type2"); + + /** + * The actual serialized value for a RequestParametersType instance. + */ + private final String value; + + RequestParametersType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RequestParametersType instance. + * + * @param value the serialized value to parse. + * @return the parsed RequestParametersType object, or null if unable to parse. + */ + public static RequestParametersType fromString(String value) { + if (value == null) { + return null; + } + RequestParametersType[] items = RequestParametersType.values(); + for (RequestParametersType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObject.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObject.java new file mode 100644 index 00000000000..ce5b54a9c58 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObject.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The RunObject model. + */ +@Immutable +public final class RunObject implements JsonSerializable { + /* + * The last_error property. + */ + @Generated + private final RunObjectLastErrorRenamed lastError; + + /** + * Creates an instance of RunObject class. + * + * @param lastError the lastError value to set. + */ + @Generated + private RunObject(RunObjectLastErrorRenamed lastError) { + this.lastError = lastError; + } + + /** + * Get the lastError property: The last_error property. + * + * @return the lastError value. + */ + @Generated + public RunObjectLastErrorRenamed getLastError() { + return this.lastError; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("last_error", this.lastError); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunObject if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunObject. + */ + @Generated + public static RunObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunObjectLastErrorRenamed lastError = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("last_error".equals(fieldName)) { + lastError = RunObjectLastErrorRenamed.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new RunObject(lastError); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorCodeRenamed.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorCodeRenamed.java new file mode 100644 index 00000000000..6c7ce986472 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorCodeRenamed.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +/** + * Defines values for RunObjectLastErrorCodeRenamed. + */ +public enum RunObjectLastErrorCodeRenamed { + /** + * Enum value server_error. + */ + SERVER_ERROR("server_error"), + + /** + * Enum value rate_limit_exceeded. + */ + RATE_LIMIT_EXCEEDED("rate_limit_exceeded"), + + /** + * Enum value invalid_prompt. + */ + INVALID_PROMPT("invalid_prompt"); + + /** + * The actual serialized value for a RunObjectLastErrorCodeRenamed instance. + */ + private final String value; + + RunObjectLastErrorCodeRenamed(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RunObjectLastErrorCodeRenamed instance. + * + * @param value the serialized value to parse. + * @return the parsed RunObjectLastErrorCodeRenamed object, or null if unable to parse. + */ + public static RunObjectLastErrorCodeRenamed fromString(String value) { + if (value == null) { + return null; + } + RunObjectLastErrorCodeRenamed[] items = RunObjectLastErrorCodeRenamed.values(); + for (RunObjectLastErrorCodeRenamed item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorRenamed.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorRenamed.java new file mode 100644 index 00000000000..de9c7901de0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/RunObjectLastErrorRenamed.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The RunObjectLastErrorRenamed model. + */ +@Immutable +public final class RunObjectLastErrorRenamed implements JsonSerializable { + /* + * The code property. + */ + @Generated + private final RunObjectLastErrorCodeRenamed code; + + /** + * Creates an instance of RunObjectLastErrorRenamed class. + * + * @param code the code value to set. + */ + @Generated + private RunObjectLastErrorRenamed(RunObjectLastErrorCodeRenamed code) { + this.code = code; + } + + /** + * Get the code property: The code property. + * + * @return the code value. + */ + @Generated + public RunObjectLastErrorCodeRenamed getCode() { + return this.code; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code == null ? null : this.code.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunObjectLastErrorRenamed from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunObjectLastErrorRenamed if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunObjectLastErrorRenamed. + */ + @Generated + public static RunObjectLastErrorRenamed fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunObjectLastErrorCodeRenamed code = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + code = RunObjectLastErrorCodeRenamed.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new RunObjectLastErrorRenamed(code); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/TypesModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/TypesModel.java new file mode 100644 index 00000000000..54c4193c83c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/TypesModel.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.models; + +/** + * summary of Types + * + * description of Types. + */ +public enum TypesModel { + /** + * Enum value Blob. + */ + BLOB("Blob"), + + /** + * Enum value File. + */ + FILE("File"); + + /** + * The actual serialized value for a TypesModel instance. + */ + private final String value; + + TypesModel(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TypesModel instance. + * + * @param value the serialized value to parse. + * @return the parsed TypesModel object, or null if unable to parse. + */ + public static TypesModel fromString(String value) { + if (value == null) { + return null; + } + TypesModel[] items = TypesModel.values(); + for (TypesModel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/package-info.java new file mode 100644 index 00000000000..c09b80a7c46 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Naming. + * description of Naming. + * + */ +package tsptest.naming.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/package-info.java new file mode 100644 index 00000000000..8a729b4e962 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/naming/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Naming. + * description of Naming. + * + */ +package tsptest.naming; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserAsyncClient.java new file mode 100644 index 00000000000..dd21304c508 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserAsyncClient.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.namingjavaparser.implementation.NamingOpsImpl; +import tsptest.namingjavaparser.models.DataRequest; +import tsptest.namingjavaparser.models.DataResponse; +import tsptest.namingjavaparser.models.GetAnonymousResponse; + +/** + * Initializes a new instance of the asynchronous NamingJavaParserClient type. + */ +@ServiceClient(builder = NamingJavaParserClientBuilder.class, isAsync = true) +public final class NamingJavaParserAsyncClient { + @Generated + private final NamingOpsImpl serviceClient; + + /** + * Initializes an instance of NamingJavaParserAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NamingJavaParserAsyncClient(NamingOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * summary of POST op + * + * description of POST op. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter + * + * description of etag header parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     parameters (Optional): {
+     *         type: String(Type1/Type2) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         data (Required): {
+     *             @data.kind: String (Required)
+     *         }
+     *     }
+     *     type: String(Blob/File) (Required)
+     *     status: String(Running/Completed/Failed) (Required)
+     *     anonymous (Required): {
+     *         last_error (Required): {
+     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return summary of Response along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postWithResponseAsync(name, body, requestOptions); + } + + /** + * The getAnonymous operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAnonymousWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAnonymousWithResponseAsync(requestOptions); + } + + /** + * summary of POST op + * + * description of POST op. + * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @param etag summary of etag header parameter + * + * description of etag header parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summary of Response on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono post(String name, DataRequest body, String etag) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (etag != null) { + requestOptions.setHeader(HttpHeaderName.ETAG, etag); + } + return postWithResponse(name, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DataResponse.class)); + } + + /** + * summary of POST op + * + * description of POST op. + * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summary of Response on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono post(String name, DataRequest body) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postWithResponse(name, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DataResponse.class)); + } + + /** + * The getAnonymous operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAnonymous() { + // Generated convenience method for getAnonymousWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAnonymousWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetAnonymousResponse.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClient.java new file mode 100644 index 00000000000..a132fc27fb5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClient.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. +package tsptest.namingjavaparser; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.namingjavaparser.implementation.NamingOpsImpl; +import tsptest.namingjavaparser.models.DataRequest; +import tsptest.namingjavaparser.models.DataResponse; +import tsptest.namingjavaparser.models.GetAnonymousResponse; + +/** + * Initializes a new instance of the synchronous NamingJavaParserClient type. + */ +@ServiceClient(builder = NamingJavaParserClientBuilder.class) +public final class NamingJavaParserClient { + + @Generated + private final NamingOpsImpl serviceClient; + + /** + * Initializes an instance of NamingJavaParserClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NamingJavaParserClient(NamingOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * summary of POST op + * + * description of POST op. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter + * + * description of etag header parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     parameters (Optional): {
+     *         type: String(Type1/Type2) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         data (Required): {
+     *             @data.kind: String (Required)
+     *         }
+     *     }
+     *     type: String(Blob/File) (Required)
+     *     status: String(Running/Completed/Failed) (Required)
+     *     anonymous (Required): {
+     *         last_error (Required): {
+     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return summary of Response along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postWithResponse(name, body, requestOptions); + } + + /** + * The getAnonymous operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAnonymousWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAnonymousWithResponse(requestOptions); + } + + /** + * summary of POST op + * + * description of POST op. + * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @param etag summary of etag header parameter + * + * description of etag header parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summary of Response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DataResponse post(String name, DataRequest body, String etag) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (etag != null) { + requestOptions.setHeader(HttpHeaderName.ETAG, etag); + } + return postWithResponse(name, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(DataResponse.class); + } + + /** + * summary of POST op + * + * description of POST op. + * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return summary of Response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DataResponse post(String name, DataRequest body) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postWithResponse(name, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(DataResponse.class); + } + + /** + * The getAnonymous operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetAnonymousResponse getAnonymous() { + // Generated convenience method for getAnonymousWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAnonymousWithResponse(requestOptions).getValue().toObject(GetAnonymousResponse.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClientBuilder.java new file mode 100644 index 00000000000..9a555ac2b0e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/NamingJavaParserClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.namingjavaparser.implementation.NamingJavaParserClientImpl; + +/** + * A builder for creating a new instance of the NamingJavaParserClient type. + */ +@ServiceClientBuilder(serviceClients = { NamingJavaParserClient.class, NamingJavaParserAsyncClient.class }) +public final class NamingJavaParserClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("tsptest-namingjavaparser.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the NamingJavaParserClientBuilder. + */ + @Generated + public NamingJavaParserClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingJavaParserClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingJavaParserClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingJavaParserClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingJavaParserClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingJavaParserClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingJavaParserClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingJavaParserClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NamingJavaParserClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the NamingJavaParserClientBuilder. + */ + @Generated + public NamingJavaParserClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of NamingJavaParserClientImpl with the provided parameters. + * + * @return an instance of NamingJavaParserClientImpl. + */ + @Generated + private NamingJavaParserClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + NamingJavaParserClientImpl client = new NamingJavaParserClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of NamingJavaParserAsyncClient class. + * + * @return an instance of NamingJavaParserAsyncClient. + */ + @Generated + public NamingJavaParserAsyncClient buildAsyncClient() { + return new NamingJavaParserAsyncClient(buildInnerClient().getNamingOps()); + } + + /** + * Builds an instance of NamingJavaParserClient class. + * + * @return an instance of NamingJavaParserClient. + */ + @Generated + public NamingJavaParserClient buildClient() { + return new NamingJavaParserClient(buildInnerClient().getNamingOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(NamingJavaParserClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingJavaParserClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingJavaParserClientImpl.java new file mode 100644 index 00000000000..c159ed60d4b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingJavaParserClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 NamingJavaParserClient type. + */ +public final class NamingJavaParserClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 NamingOpsImpl object to access its operations. + */ + private final NamingOpsImpl namingOps; + + /** + * Gets the NamingOpsImpl object to access its operations. + * + * @return the NamingOpsImpl object. + */ + public NamingOpsImpl getNamingOps() { + return this.namingOps; + } + + /** + * Initializes an instance of NamingJavaParserClient client. + * + * @param endpoint Service host. + */ + public NamingJavaParserClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NamingJavaParserClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public NamingJavaParserClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NamingJavaParserClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public NamingJavaParserClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.namingOps = new NamingOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingOpsImpl.java new file mode 100644 index 00000000000..0f333bd6bfa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/NamingOpsImpl.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NamingOps. + */ +public final class NamingOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NamingOpsService service; + + /** + * The service client containing this operation class. + */ + private final NamingJavaParserClientImpl client; + + /** + * Initializes an instance of NamingOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NamingOpsImpl(NamingJavaParserClientImpl client) { + this.service + = RestProxy.create(NamingOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NamingJavaParserClientNamingOps to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NamingJavaParserClientNamingOps") + public interface NamingOpsService { + @Post("/naming") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> post(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/naming") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postSync(@HostParam("endpoint") String endpoint, @QueryParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Get("/naming") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAnonymous(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/naming") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAnonymousSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * summary of POST op + * + * description of POST op. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter + * + * description of etag header parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     parameters (Optional): {
+     *         type: String(Type1/Type2) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         data (Required): {
+     *             @data.kind: String (Required)
+     *         }
+     *     }
+     *     type: String(Blob/File) (Required)
+     *     status: String(Running/Completed/Failed) (Required)
+     *     anonymous (Required): {
+     *         last_error (Required): {
+     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return summary of Response along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postWithResponseAsync(String name, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.post(this.client.getEndpoint(), name, contentType, accept, body, + requestOptions, context)); + } + + /** + * summary of POST op + * + * description of POST op. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
etagStringNosummary of etag header parameter + * + * description of etag header parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     parameters (Optional): {
+     *         type: String(Type1/Type2) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     data (Required): {
+     *         data (Required): {
+     *             @data.kind: String (Required)
+     *         }
+     *     }
+     *     type: String(Blob/File) (Required)
+     *     status: String(Running/Completed/Failed) (Required)
+     *     anonymous (Required): {
+     *         last_error (Required): {
+     *             code: String(server_error/rate_limit_exceeded/invalid_prompt) (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name summary of name query parameter + * + * description of name query parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return summary of Response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse(String name, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.postSync(this.client.getEndpoint(), name, contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The getAnonymous operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAnonymousWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAnonymous(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getAnonymous operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAnonymousWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAnonymousSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/package-info.java new file mode 100644 index 00000000000..e91928ac172 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for NamingJavaParser. + * description of Naming JavaParser. + * + */ +package tsptest.namingjavaparser.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BinaryData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BinaryData.java new file mode 100644 index 00000000000..25ae34fe843 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BinaryData.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * summary of Data + * + * description of Data. + */ +@Immutable +public final class BinaryData implements JsonSerializable { + /* + * summary of data property + * + * description of data property + */ + @Generated + private final Data data; + + /** + * Creates an instance of BinaryData class. + * + * @param data the data value to set. + */ + @Generated + private BinaryData(Data data) { + this.data = data; + } + + /** + * Get the data property: summary of data property + * + * description of data property. + * + * @return the data value. + */ + @Generated + public Data getData() { + return this.data; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("data", this.data); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BinaryData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BinaryData if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BinaryData. + */ + @Generated + public static BinaryData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Data data = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data".equals(fieldName)) { + data = Data.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new BinaryData(data); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BytesData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BytesData.java new file mode 100644 index 00000000000..b9bae240922 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/BytesData.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The BytesData model. + */ +@Immutable +public final class BytesData extends Data { + /* + * The @data.kind property. + */ + @Generated + private String type = "bytes"; + + /* + * Data as {@code byte[]} + */ + @Generated + private final byte[] dataAsBytes; + + /** + * Creates an instance of BytesData class. + * + * @param dataAsBytes the dataAsBytes value to set. + */ + @Generated + private BytesData(byte[] dataAsBytes) { + this.dataAsBytes = dataAsBytes; + } + + /** + * Get the type property: The @data.kind property. + * + * @return the type value. + */ + @Generated + @Override + public String getType() { + return this.type; + } + + /** + * Get the dataAsBytes property: Data as {@code byte[]}. + * + * @return the dataAsBytes value. + */ + @Generated + public byte[] getDataAsBytes() { + return CoreUtils.clone(this.dataAsBytes); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBinaryField("data_bytes", this.dataAsBytes); + jsonWriter.writeStringField("@data.kind", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BytesData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BytesData if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BytesData. + */ + @Generated + public static BytesData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + byte[] dataAsBytes = null; + String type = "bytes"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data_bytes".equals(fieldName)) { + dataAsBytes = reader.getBinary(); + } else if ("@data.kind".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + BytesData deserializedBytesData = new BytesData(dataAsBytes); + deserializedBytesData.type = type; + + return deserializedBytesData; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/Data.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/Data.java new file mode 100644 index 00000000000..48caff332d5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/Data.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Dummy doc to make the javadoc break at the 'at' symbol. The type of the Data depends on + * @data.kind.letusmakeitlongsoitwouldbreakbeforethis field. + */ +@Immutable +public class Data implements JsonSerializable { + /* + * The @data.kind property. + */ + @Generated + private String type = "Data"; + + /** + * Creates an instance of Data class. + */ + @Generated + protected Data() { + } + + /** + * Get the type property: The @data.kind property. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("@data.kind", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Data from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Data if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Data. + */ + @Generated + public static Data fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("@data.kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("bytes".equals(discriminatorValue)) { + return BytesData.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Data fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Data deserializedData = new Data(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("@data.kind".equals(fieldName)) { + deserializedData.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedData; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataRequest.java new file mode 100644 index 00000000000..09b384ab05d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataRequest.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * summary of Request + * + * description of Request. + */ +@Fluent +public final class DataRequest implements JsonSerializable { + /* + * The parameters property. + */ + @Generated + private RequestParameters parameters; + + /** + * Creates an instance of DataRequest class. + */ + @Generated + public DataRequest() { + } + + /** + * Get the parameters property: The parameters property. + * + * @return the parameters value. + */ + @Generated + public RequestParameters getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: The parameters property. + * + * @param parameters the parameters value to set. + * @return the DataRequest object itself. + */ + @Generated + public DataRequest setParameters(RequestParameters parameters) { + this.parameters = parameters; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("parameters", this.parameters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DataRequest. + */ + @Generated + public static DataRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataRequest deserializedDataRequest = new DataRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("parameters".equals(fieldName)) { + deserializedDataRequest.parameters = RequestParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDataRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataResponse.java new file mode 100644 index 00000000000..62bb2ac0c28 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataResponse.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * summary of Response + * + * description of Response. Include tab ' ' in doc. + */ +@Immutable +public final class DataResponse implements JsonSerializable { + /* + * summary of name property + * + * description of name property + */ + @Generated + private final String name; + + /* + * summary of data property + * + * description of data property + */ + @Generated + private final BinaryData data; + + /* + * summary of type property + * + * description of type property + */ + @Generated + private final TypesModel dataType; + + /* + * summary of status property + * + * description of status property + */ + @Generated + private final DataStatus status; + + /* + * The anonymous property. + */ + @Generated + private final RunObject anonymous; + + /** + * Creates an instance of DataResponse class. + * + * @param name the name value to set. + * @param data the data value to set. + * @param dataType the dataType value to set. + * @param status the status value to set. + * @param anonymous the anonymous value to set. + */ + @Generated + private DataResponse(String name, BinaryData data, TypesModel dataType, DataStatus status, RunObject anonymous) { + this.name = name; + this.data = data; + this.dataType = dataType; + this.status = status; + this.anonymous = anonymous; + } + + /** + * Get the name property: summary of name property + * + * description of name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the data property: summary of data property + * + * description of data property. + * + * @return the data value. + */ + @Generated + public BinaryData getData() { + return this.data; + } + + /** + * Get the dataType property: summary of type property + * + * description of type property. + * + * @return the dataType value. + */ + @Generated + public TypesModel getDataType() { + return this.dataType; + } + + /** + * Get the status property: summary of status property + * + * description of status property. + * + * @return the status value. + */ + @Generated + public DataStatus getStatus() { + return this.status; + } + + /** + * Get the anonymous property: The anonymous property. + * + * @return the anonymous value. + */ + @Generated + public RunObject getAnonymous() { + return this.anonymous; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("data", this.data); + jsonWriter.writeStringField("type", this.dataType == null ? null : this.dataType.toString()); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("anonymous", this.anonymous); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataResponse if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DataResponse. + */ + @Generated + public static DataResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + BinaryData data = null; + TypesModel dataType = null; + DataStatus status = null; + RunObject anonymous = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("data".equals(fieldName)) { + data = BinaryData.fromJson(reader); + } else if ("type".equals(fieldName)) { + dataType = TypesModel.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + status = DataStatus.fromString(reader.getString()); + } else if ("anonymous".equals(fieldName)) { + anonymous = RunObject.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new DataResponse(name, data, dataType, status, anonymous); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataStatus.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataStatus.java new file mode 100644 index 00000000000..298965620ec --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/DataStatus.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * summary of Statuses + * + * description of Statuses. + */ +public final class DataStatus extends ExpandableStringEnum { + /** + * Static value Running for DataStatus. + */ + @Generated + public static final DataStatus LRO_RUNNING = fromString("Running"); + + /** + * Static value Completed for DataStatus. + */ + @Generated + public static final DataStatus COMPLETED = fromString("Completed"); + + /** + * Static value Failed for DataStatus. + */ + @Generated + public static final DataStatus FAILED = fromString("Failed"); + + /** + * Creates a new instance of DataStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DataStatus() { + } + + /** + * Creates or finds a DataStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataStatus. + */ + @Generated + public static DataStatus fromString(String name) { + return fromString(name, DataStatus.class); + } + + /** + * Gets known DataStatus values. + * + * @return known DataStatus values. + */ + @Generated + public static Collection values() { + return values(DataStatus.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/GetAnonymousResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/GetAnonymousResponse.java new file mode 100644 index 00000000000..b30416d7a36 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/GetAnonymousResponse.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetAnonymousResponse model. + */ +@Immutable +public final class GetAnonymousResponse implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of GetAnonymousResponse class. + * + * @param name the name value to set. + */ + @Generated + private GetAnonymousResponse(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetAnonymousResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetAnonymousResponse if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetAnonymousResponse. + */ + @Generated + public static GetAnonymousResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new GetAnonymousResponse(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParameters.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParameters.java new file mode 100644 index 00000000000..efbeadac620 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParameters.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The RequestParameters model. + */ +@Immutable +public final class RequestParameters implements JsonSerializable { + /* + * The type property. + */ + @Generated + private final RequestParametersType type; + + /** + * Creates an instance of RequestParameters class. + * + * @param type the type value to set. + */ + @Generated + public RequestParameters(RequestParametersType type) { + this.type = type; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + @Generated + public RequestParametersType getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequestParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequestParameters if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RequestParameters. + */ + @Generated + public static RequestParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RequestParametersType type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + type = RequestParametersType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new RequestParameters(type); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParametersType.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParametersType.java new file mode 100644 index 00000000000..9874d82d88d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RequestParametersType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +/** + * Defines values for RequestParametersType. + */ +public enum RequestParametersType { + /** + * Enum value Type1. + */ + TYPE1("Type1"), + + /** + * Enum value Type2. + */ + TYPE2("Type2"); + + /** + * The actual serialized value for a RequestParametersType instance. + */ + private final String value; + + RequestParametersType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RequestParametersType instance. + * + * @param value the serialized value to parse. + * @return the parsed RequestParametersType object, or null if unable to parse. + */ + public static RequestParametersType fromString(String value) { + if (value == null) { + return null; + } + RequestParametersType[] items = RequestParametersType.values(); + for (RequestParametersType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObject.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObject.java new file mode 100644 index 00000000000..684c706c96c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObject.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The RunObject model. + */ +@Immutable +public final class RunObject implements JsonSerializable { + /* + * The last_error property. + */ + @Generated + private final RunObjectLastError1 lastError; + + /** + * Creates an instance of RunObject class. + * + * @param lastError the lastError value to set. + */ + @Generated + private RunObject(RunObjectLastError1 lastError) { + this.lastError = lastError; + } + + /** + * Get the lastError property: The last_error property. + * + * @return the lastError value. + */ + @Generated + public RunObjectLastError1 getLastError() { + return this.lastError; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("last_error", this.lastError); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunObject if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunObject. + */ + @Generated + public static RunObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunObjectLastError1 lastError = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("last_error".equals(fieldName)) { + lastError = RunObjectLastError1.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new RunObject(lastError); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastError1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastError1.java new file mode 100644 index 00000000000..06de8bd7eb2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastError1.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The RunObjectLastError1 model. + */ +@Immutable +public final class RunObjectLastError1 implements JsonSerializable { + /* + * The code property. + */ + @Generated + private final RunObjectLastErrorCode code; + + /** + * Creates an instance of RunObjectLastError1 class. + * + * @param code the code value to set. + */ + @Generated + private RunObjectLastError1(RunObjectLastErrorCode code) { + this.code = code; + } + + /** + * Get the code property: The code property. + * + * @return the code value. + */ + @Generated + public RunObjectLastErrorCode getCode() { + return this.code; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code == null ? null : this.code.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunObjectLastError1 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunObjectLastError1 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunObjectLastError1. + */ + @Generated + public static RunObjectLastError1 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunObjectLastErrorCode code = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + code = RunObjectLastErrorCode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new RunObjectLastError1(code); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastErrorCode.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastErrorCode.java new file mode 100644 index 00000000000..6aa0ead6ebf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/RunObjectLastErrorCode.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +/** + * Defines values for RunObjectLastErrorCode. + */ +public enum RunObjectLastErrorCode { + /** + * Enum value server_error. + */ + SERVER_ERROR("server_error"), + + /** + * Enum value rate_limit_exceeded. + */ + RATE_LIMIT_EXCEEDED("rate_limit_exceeded"), + + /** + * Enum value invalid_prompt. + */ + INVALID_PROMPT("invalid_prompt"); + + /** + * The actual serialized value for a RunObjectLastErrorCode instance. + */ + private final String value; + + RunObjectLastErrorCode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RunObjectLastErrorCode instance. + * + * @param value the serialized value to parse. + * @return the parsed RunObjectLastErrorCode object, or null if unable to parse. + */ + public static RunObjectLastErrorCode fromString(String value) { + if (value == null) { + return null; + } + RunObjectLastErrorCode[] items = RunObjectLastErrorCode.values(); + for (RunObjectLastErrorCode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/TypesModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/TypesModel.java new file mode 100644 index 00000000000..5177a618296 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/TypesModel.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.models; + +/** + * summary of Types + * + * description of Types. + */ +public enum TypesModel { + /** + * Enum value Blob. + */ + BLOB("Blob"), + + /** + * Enum value File. + */ + FILE("File"); + + /** + * The actual serialized value for a TypesModel instance. + */ + private final String value; + + TypesModel(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TypesModel instance. + * + * @param value the serialized value to parse. + * @return the parsed TypesModel object, or null if unable to parse. + */ + public static TypesModel fromString(String value) { + if (value == null) { + return null; + } + TypesModel[] items = TypesModel.values(); + for (TypesModel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/package-info.java new file mode 100644 index 00000000000..54d07be7724 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for NamingJavaParser. + * description of Naming JavaParser. + * + */ +package tsptest.namingjavaparser.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/package-info.java new file mode 100644 index 00000000000..a9b955b3184 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/namingjavaparser/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for NamingJavaParser. + * description of Naming JavaParser. + * + */ +package tsptest.namingjavaparser; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalAsyncClient.java new file mode 100644 index 00000000000..c5b9d71904a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalAsyncClient.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.optional.implementation.OptionalOpsImpl; +import tsptest.optional.models.AllPropertiesOptional; +import tsptest.optional.models.Optional; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class OptionalAsyncClient { + @Generated + private final OptionalOpsImpl serviceClient; + + /** + * Initializes an instance of OptionalAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + OptionalAsyncClient(OptionalOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The put operation. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
booleanNullableBooleanNoThe booleanNullable parameter
stringStringNoThe string parameter
stringNullableStringNoThe stringNullable parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
request-header-optionalStringNoThe requestHeaderOptional parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: Boolean (Optional)
+     *     booleanNullable: Boolean (Optional)
+     *     booleanRequired: boolean (Required)
+     *     booleanRequiredNullable: Boolean (Required)
+     *     string: String (Optional)
+     *     stringNullable: String (Optional)
+     *     stringRequired: String (Required)
+     *     stringRequiredNullable: String (Required)
+     *     bytes: byte[] (Optional)
+     *     int: Integer (Optional)
+     *     long: Long (Optional)
+     *     float: Double (Optional)
+     *     double: Double (Optional)
+     *     duration: Duration (Optional)
+     *     dateTime: OffsetDateTime (Optional)
+     *     stringList (Optional): [
+     *         String (Optional)
+     *     ]
+     *     bytesDict (Optional): {
+     *         String: byte[] (Required)
+     *     }
+     *     epochDateTimeRequiredNullable: Long (Required)
+     *     epochDateTimeNullable: Long (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: Boolean (Optional)
+     *     booleanNullable: Boolean (Optional)
+     *     booleanRequired: Boolean (Optional)
+     *     booleanRequiredNullable: Boolean (Optional)
+     *     string: String (Optional)
+     *     stringNullable: String (Optional)
+     *     stringRequired: String (Optional)
+     *     stringRequiredNullable: String (Optional)
+     *     bytes: byte[] (Optional)
+     *     int: Integer (Optional)
+     *     long: Long (Optional)
+     *     float: Double (Optional)
+     *     double: Double (Optional)
+     *     duration: Duration (Optional)
+     *     dateTime: OffsetDateTime (Optional)
+     *     stringList (Optional): [
+     *         String (Optional)
+     *     ]
+     *     bytesDict (Optional): {
+     *         String: byte[] (Required)
+     *     }
+     *     epochDateTimeRequiredNullable: Long (Optional)
+     *     epochDateTimeNullable: Long (Optional)
+     *     immutable (Optional): {
+     *         stringReadWriteRequired: String (Required)
+     *         stringReadOnlyOptional: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestHeaderRequired The requestHeaderRequired parameter. + * @param booleanRequired The booleanRequired parameter. + * @param booleanRequiredNullable The booleanRequiredNullable parameter. + * @param stringRequired The stringRequired parameter. + * @param stringRequiredNullable The stringRequiredNullable parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(String requestHeaderRequired, boolean booleanRequired, + Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable, + RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(requestHeaderRequired, booleanRequired, booleanRequiredNullable, + stringRequired, stringRequiredNullable, requestOptions); + } + + /** + * The put operation. + * + * @param requestHeaderRequired The requestHeaderRequired parameter. + * @param booleanRequired The booleanRequired parameter. + * @param booleanRequiredNullable The booleanRequiredNullable parameter. + * @param stringRequired The stringRequired parameter. + * @param stringRequiredNullable The stringRequiredNullable parameter. + * @param requestHeaderOptional The requestHeaderOptional parameter. + * @param booleanNullable The booleanNullable parameter. + * @param string The string parameter. + * @param stringNullable The stringNullable parameter. + * @param optional The optional parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(String requestHeaderRequired, boolean booleanRequired, + Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable, + String requestHeaderOptional, Boolean booleanNullable, String string, String stringNullable, + Optional optional) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (requestHeaderOptional != null) { + requestOptions.setHeader(HttpHeaderName.fromString("request-header-optional"), requestHeaderOptional); + } + if (booleanNullable != null) { + requestOptions.addQueryParam("booleanNullable", String.valueOf(booleanNullable), false); + } + if (string != null) { + requestOptions.addQueryParam("string", string, false); + } + if (stringNullable != null) { + requestOptions.addQueryParam("stringNullable", stringNullable, false); + } + if (optional != null) { + requestOptions.setBody(BinaryData.fromObject(optional)); + } + return putWithResponse(requestHeaderRequired, booleanRequired, booleanRequiredNullable, stringRequired, + stringRequiredNullable, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AllPropertiesOptional.class)); + } + + /** + * The put operation. + * + * @param requestHeaderRequired The requestHeaderRequired parameter. + * @param booleanRequired The booleanRequired parameter. + * @param booleanRequiredNullable The booleanRequiredNullable parameter. + * @param stringRequired The stringRequired parameter. + * @param stringRequiredNullable The stringRequiredNullable parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(String requestHeaderRequired, boolean booleanRequired, + Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(requestHeaderRequired, booleanRequired, booleanRequiredNullable, stringRequired, + stringRequiredNullable, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(AllPropertiesOptional.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClient.java new file mode 100644 index 00000000000..9b0669c9684 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClient.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.optional.implementation.OptionalOpsImpl; +import tsptest.optional.models.AllPropertiesOptional; +import tsptest.optional.models.Optional; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class OptionalClient { + @Generated + private final OptionalOpsImpl serviceClient; + + /** + * Initializes an instance of OptionalClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + OptionalClient(OptionalOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The put operation. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
booleanNullableBooleanNoThe booleanNullable parameter
stringStringNoThe string parameter
stringNullableStringNoThe stringNullable parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
request-header-optionalStringNoThe requestHeaderOptional parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: Boolean (Optional)
+     *     booleanNullable: Boolean (Optional)
+     *     booleanRequired: boolean (Required)
+     *     booleanRequiredNullable: Boolean (Required)
+     *     string: String (Optional)
+     *     stringNullable: String (Optional)
+     *     stringRequired: String (Required)
+     *     stringRequiredNullable: String (Required)
+     *     bytes: byte[] (Optional)
+     *     int: Integer (Optional)
+     *     long: Long (Optional)
+     *     float: Double (Optional)
+     *     double: Double (Optional)
+     *     duration: Duration (Optional)
+     *     dateTime: OffsetDateTime (Optional)
+     *     stringList (Optional): [
+     *         String (Optional)
+     *     ]
+     *     bytesDict (Optional): {
+     *         String: byte[] (Required)
+     *     }
+     *     epochDateTimeRequiredNullable: Long (Required)
+     *     epochDateTimeNullable: Long (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: Boolean (Optional)
+     *     booleanNullable: Boolean (Optional)
+     *     booleanRequired: Boolean (Optional)
+     *     booleanRequiredNullable: Boolean (Optional)
+     *     string: String (Optional)
+     *     stringNullable: String (Optional)
+     *     stringRequired: String (Optional)
+     *     stringRequiredNullable: String (Optional)
+     *     bytes: byte[] (Optional)
+     *     int: Integer (Optional)
+     *     long: Long (Optional)
+     *     float: Double (Optional)
+     *     double: Double (Optional)
+     *     duration: Duration (Optional)
+     *     dateTime: OffsetDateTime (Optional)
+     *     stringList (Optional): [
+     *         String (Optional)
+     *     ]
+     *     bytesDict (Optional): {
+     *         String: byte[] (Required)
+     *     }
+     *     epochDateTimeRequiredNullable: Long (Optional)
+     *     epochDateTimeNullable: Long (Optional)
+     *     immutable (Optional): {
+     *         stringReadWriteRequired: String (Required)
+     *         stringReadOnlyOptional: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestHeaderRequired The requestHeaderRequired parameter. + * @param booleanRequired The booleanRequired parameter. + * @param booleanRequiredNullable The booleanRequiredNullable parameter. + * @param stringRequired The stringRequired parameter. + * @param stringRequiredNullable The stringRequiredNullable parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(String requestHeaderRequired, boolean booleanRequired, + Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable, + RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(requestHeaderRequired, booleanRequired, booleanRequiredNullable, + stringRequired, stringRequiredNullable, requestOptions); + } + + /** + * The put operation. + * + * @param requestHeaderRequired The requestHeaderRequired parameter. + * @param booleanRequired The booleanRequired parameter. + * @param booleanRequiredNullable The booleanRequiredNullable parameter. + * @param stringRequired The stringRequired parameter. + * @param stringRequiredNullable The stringRequiredNullable parameter. + * @param requestHeaderOptional The requestHeaderOptional parameter. + * @param booleanNullable The booleanNullable parameter. + * @param string The string parameter. + * @param stringNullable The stringNullable parameter. + * @param optional The optional parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AllPropertiesOptional put(String requestHeaderRequired, boolean booleanRequired, + Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable, + String requestHeaderOptional, Boolean booleanNullable, String string, String stringNullable, + Optional optional) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (requestHeaderOptional != null) { + requestOptions.setHeader(HttpHeaderName.fromString("request-header-optional"), requestHeaderOptional); + } + if (booleanNullable != null) { + requestOptions.addQueryParam("booleanNullable", String.valueOf(booleanNullable), false); + } + if (string != null) { + requestOptions.addQueryParam("string", string, false); + } + if (stringNullable != null) { + requestOptions.addQueryParam("stringNullable", stringNullable, false); + } + if (optional != null) { + requestOptions.setBody(BinaryData.fromObject(optional)); + } + return putWithResponse(requestHeaderRequired, booleanRequired, booleanRequiredNullable, stringRequired, + stringRequiredNullable, requestOptions).getValue().toObject(AllPropertiesOptional.class); + } + + /** + * The put operation. + * + * @param requestHeaderRequired The requestHeaderRequired parameter. + * @param booleanRequired The booleanRequired parameter. + * @param booleanRequiredNullable The booleanRequiredNullable parameter. + * @param stringRequired The stringRequired parameter. + * @param stringRequiredNullable The stringRequiredNullable parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public AllPropertiesOptional put(String requestHeaderRequired, boolean booleanRequired, + Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(requestHeaderRequired, booleanRequired, booleanRequiredNullable, stringRequired, + stringRequiredNullable, requestOptions).getValue().toObject(AllPropertiesOptional.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClientBuilder.java new file mode 100644 index 00000000000..30b2d520b3c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/OptionalClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.optional.implementation.OptionalClientImpl; + +/** + * A builder for creating a new instance of the OptionalClient type. + */ +@ServiceClientBuilder(serviceClients = { OptionalClient.class, OptionalAsyncClient.class }) +public final class OptionalClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-optional.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the OptionalClientBuilder. + */ + @Generated + public OptionalClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the OptionalClientBuilder. + */ + @Generated + public OptionalClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of OptionalClientImpl with the provided parameters. + * + * @return an instance of OptionalClientImpl. + */ + @Generated + private OptionalClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + OptionalClientImpl client + = new OptionalClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of OptionalAsyncClient class. + * + * @return an instance of OptionalAsyncClient. + */ + @Generated + public OptionalAsyncClient buildAsyncClient() { + return new OptionalAsyncClient(buildInnerClient().getOptionalOps()); + } + + /** + * Builds an instance of OptionalClient class. + * + * @return an instance of OptionalClient. + */ + @Generated + public OptionalClient buildClient() { + return new OptionalClient(buildInnerClient().getOptionalOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(OptionalClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalClientImpl.java new file mode 100644 index 00000000000..ef211e5df6d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.optional.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 OptionalClient type. + */ +public final class OptionalClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 OptionalOpsImpl object to access its operations. + */ + private final OptionalOpsImpl optionalOps; + + /** + * Gets the OptionalOpsImpl object to access its operations. + * + * @return the OptionalOpsImpl object. + */ + public OptionalOpsImpl getOptionalOps() { + return this.optionalOps; + } + + /** + * Initializes an instance of OptionalClient client. + * + * @param endpoint Service host. + */ + public OptionalClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of OptionalClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public OptionalClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of OptionalClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public OptionalClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.optionalOps = new OptionalOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalOpsImpl.java new file mode 100644 index 00000000000..58db75c0831 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/OptionalOpsImpl.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.optional.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OptionalOps. + */ +public final class OptionalOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final OptionalOpsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of OptionalOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OptionalOpsImpl(OptionalClientImpl client) { + this.service + = RestProxy.create(OptionalOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientOptionalOps to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientOptionalOps") + public interface OptionalOpsService { + @Put("/optional/put") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("request-header-required") String requestHeaderRequired, + @QueryParam("booleanRequired") boolean booleanRequired, + @QueryParam("booleanRequiredNullable") Boolean booleanRequiredNullable, + @QueryParam("stringRequired") String stringRequired, + @QueryParam("stringRequiredNullable") String stringRequiredNullable, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/optional/put") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, + @HeaderParam("request-header-required") String requestHeaderRequired, + @QueryParam("booleanRequired") boolean booleanRequired, + @QueryParam("booleanRequiredNullable") Boolean booleanRequiredNullable, + @QueryParam("stringRequired") String stringRequired, + @QueryParam("stringRequiredNullable") String stringRequiredNullable, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The put operation. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
booleanNullableBooleanNoThe booleanNullable parameter
stringStringNoThe string parameter
stringNullableStringNoThe stringNullable parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
request-header-optionalStringNoThe requestHeaderOptional parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: Boolean (Optional)
+     *     booleanNullable: Boolean (Optional)
+     *     booleanRequired: boolean (Required)
+     *     booleanRequiredNullable: Boolean (Required)
+     *     string: String (Optional)
+     *     stringNullable: String (Optional)
+     *     stringRequired: String (Required)
+     *     stringRequiredNullable: String (Required)
+     *     bytes: byte[] (Optional)
+     *     int: Integer (Optional)
+     *     long: Long (Optional)
+     *     float: Double (Optional)
+     *     double: Double (Optional)
+     *     duration: Duration (Optional)
+     *     dateTime: OffsetDateTime (Optional)
+     *     stringList (Optional): [
+     *         String (Optional)
+     *     ]
+     *     bytesDict (Optional): {
+     *         String: byte[] (Required)
+     *     }
+     *     epochDateTimeRequiredNullable: Long (Required)
+     *     epochDateTimeNullable: Long (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: Boolean (Optional)
+     *     booleanNullable: Boolean (Optional)
+     *     booleanRequired: Boolean (Optional)
+     *     booleanRequiredNullable: Boolean (Optional)
+     *     string: String (Optional)
+     *     stringNullable: String (Optional)
+     *     stringRequired: String (Optional)
+     *     stringRequiredNullable: String (Optional)
+     *     bytes: byte[] (Optional)
+     *     int: Integer (Optional)
+     *     long: Long (Optional)
+     *     float: Double (Optional)
+     *     double: Double (Optional)
+     *     duration: Duration (Optional)
+     *     dateTime: OffsetDateTime (Optional)
+     *     stringList (Optional): [
+     *         String (Optional)
+     *     ]
+     *     bytesDict (Optional): {
+     *         String: byte[] (Required)
+     *     }
+     *     epochDateTimeRequiredNullable: Long (Optional)
+     *     epochDateTimeNullable: Long (Optional)
+     *     immutable (Optional): {
+     *         stringReadWriteRequired: String (Required)
+     *         stringReadOnlyOptional: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestHeaderRequired The requestHeaderRequired parameter. + * @param booleanRequired The booleanRequired parameter. + * @param booleanRequiredNullable The booleanRequiredNullable parameter. + * @param stringRequired The stringRequired parameter. + * @param stringRequiredNullable The stringRequiredNullable parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(String requestHeaderRequired, boolean booleanRequired, + Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable, + RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); + } + }); + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), requestHeaderRequired, booleanRequired, + booleanRequiredNullable, stringRequired, stringRequiredNullable, accept, requestOptionsLocal, context)); + } + + /** + * The put operation. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
booleanNullableBooleanNoThe booleanNullable parameter
stringStringNoThe string parameter
stringNullableStringNoThe stringNullable parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
request-header-optionalStringNoThe requestHeaderOptional parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: Boolean (Optional)
+     *     booleanNullable: Boolean (Optional)
+     *     booleanRequired: boolean (Required)
+     *     booleanRequiredNullable: Boolean (Required)
+     *     string: String (Optional)
+     *     stringNullable: String (Optional)
+     *     stringRequired: String (Required)
+     *     stringRequiredNullable: String (Required)
+     *     bytes: byte[] (Optional)
+     *     int: Integer (Optional)
+     *     long: Long (Optional)
+     *     float: Double (Optional)
+     *     double: Double (Optional)
+     *     duration: Duration (Optional)
+     *     dateTime: OffsetDateTime (Optional)
+     *     stringList (Optional): [
+     *         String (Optional)
+     *     ]
+     *     bytesDict (Optional): {
+     *         String: byte[] (Required)
+     *     }
+     *     epochDateTimeRequiredNullable: Long (Required)
+     *     epochDateTimeNullable: Long (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     boolean: Boolean (Optional)
+     *     booleanNullable: Boolean (Optional)
+     *     booleanRequired: Boolean (Optional)
+     *     booleanRequiredNullable: Boolean (Optional)
+     *     string: String (Optional)
+     *     stringNullable: String (Optional)
+     *     stringRequired: String (Optional)
+     *     stringRequiredNullable: String (Optional)
+     *     bytes: byte[] (Optional)
+     *     int: Integer (Optional)
+     *     long: Long (Optional)
+     *     float: Double (Optional)
+     *     double: Double (Optional)
+     *     duration: Duration (Optional)
+     *     dateTime: OffsetDateTime (Optional)
+     *     stringList (Optional): [
+     *         String (Optional)
+     *     ]
+     *     bytesDict (Optional): {
+     *         String: byte[] (Required)
+     *     }
+     *     epochDateTimeRequiredNullable: Long (Optional)
+     *     epochDateTimeNullable: Long (Optional)
+     *     immutable (Optional): {
+     *         stringReadWriteRequired: String (Required)
+     *         stringReadOnlyOptional: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestHeaderRequired The requestHeaderRequired parameter. + * @param booleanRequired The booleanRequired parameter. + * @param booleanRequiredNullable The booleanRequiredNullable parameter. + * @param stringRequired The stringRequired parameter. + * @param stringRequiredNullable The stringRequiredNullable parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(String requestHeaderRequired, boolean booleanRequired, + Boolean booleanRequiredNullable, String stringRequired, String stringRequiredNullable, + RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); + } + }); + return service.putSync(this.client.getEndpoint(), requestHeaderRequired, booleanRequired, + booleanRequiredNullable, stringRequired, stringRequiredNullable, accept, requestOptionsLocal, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/package-info.java new file mode 100644 index 00000000000..8e1b7228f07 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Optional. + * + */ +package tsptest.optional.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/AllPropertiesOptional.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/AllPropertiesOptional.java new file mode 100644 index 00000000000..edec72876a6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/AllPropertiesOptional.java @@ -0,0 +1,462 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.optional.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * The AllPropertiesOptional model. + */ +@Immutable +public final class AllPropertiesOptional implements JsonSerializable { + /* + * The boolean property. + */ + @Generated + private Boolean booleanProperty; + + /* + * The booleanNullable property. + */ + @Generated + private Boolean booleanNullable; + + /* + * The booleanRequired property. + */ + @Generated + private Boolean booleanRequired; + + /* + * The booleanRequiredNullable property. + */ + @Generated + private Boolean booleanRequiredNullable; + + /* + * The string property. + */ + @Generated + private String string; + + /* + * The stringNullable property. + */ + @Generated + private String stringNullable; + + /* + * The stringRequired property. + */ + @Generated + private String stringRequired; + + /* + * The stringRequiredNullable property. + */ + @Generated + private String stringRequiredNullable; + + /* + * The bytes property. + */ + @Generated + private byte[] bytes; + + /* + * The int property. + */ + @Generated + private Integer intProperty; + + /* + * The long property. + */ + @Generated + private Long longProperty; + + /* + * The float property. + */ + @Generated + private Double floatProperty; + + /* + * The double property. + */ + @Generated + private Double doubleProperty; + + /* + * The duration property. + */ + @Generated + private Duration duration; + + /* + * The dateTime property. + */ + @Generated + private OffsetDateTime dateTime; + + /* + * The stringList property. + */ + @Generated + private List stringList; + + /* + * The bytesDict property. + */ + @Generated + private Map bytesDict; + + /* + * The epochDateTimeRequiredNullable property. + */ + @Generated + private Long epochDateTimeRequiredNullable; + + /* + * The epochDateTimeNullable property. + */ + @Generated + private Long epochDateTimeNullable; + + /* + * The immutable property. + */ + @Generated + private ImmutableModel immutable; + + /** + * Creates an instance of AllPropertiesOptional class. + */ + @Generated + private AllPropertiesOptional() { + } + + /** + * Get the booleanProperty property: The boolean property. + * + * @return the booleanProperty value. + */ + @Generated + public Boolean isBooleanProperty() { + return this.booleanProperty; + } + + /** + * Get the booleanNullable property: The booleanNullable property. + * + * @return the booleanNullable value. + */ + @Generated + public Boolean isBooleanNullable() { + return this.booleanNullable; + } + + /** + * Get the booleanRequired property: The booleanRequired property. + * + * @return the booleanRequired value. + */ + @Generated + public Boolean isBooleanRequired() { + return this.booleanRequired; + } + + /** + * Get the booleanRequiredNullable property: The booleanRequiredNullable property. + * + * @return the booleanRequiredNullable value. + */ + @Generated + public Boolean isBooleanRequiredNullable() { + return this.booleanRequiredNullable; + } + + /** + * Get the string property: The string property. + * + * @return the string value. + */ + @Generated + public String getString() { + return this.string; + } + + /** + * Get the stringNullable property: The stringNullable property. + * + * @return the stringNullable value. + */ + @Generated + public String getStringNullable() { + return this.stringNullable; + } + + /** + * Get the stringRequired property: The stringRequired property. + * + * @return the stringRequired value. + */ + @Generated + public String getStringRequired() { + return this.stringRequired; + } + + /** + * Get the stringRequiredNullable property: The stringRequiredNullable property. + * + * @return the stringRequiredNullable value. + */ + @Generated + public String getStringRequiredNullable() { + return this.stringRequiredNullable; + } + + /** + * Get the bytes property: The bytes property. + * + * @return the bytes value. + */ + @Generated + public byte[] getBytes() { + return CoreUtils.clone(this.bytes); + } + + /** + * Get the intProperty property: The int property. + * + * @return the intProperty value. + */ + @Generated + public Integer getIntProperty() { + return this.intProperty; + } + + /** + * Get the longProperty property: The long property. + * + * @return the longProperty value. + */ + @Generated + public Long getLongProperty() { + return this.longProperty; + } + + /** + * Get the floatProperty property: The float property. + * + * @return the floatProperty value. + */ + @Generated + public Double getFloatProperty() { + return this.floatProperty; + } + + /** + * Get the doubleProperty property: The double property. + * + * @return the doubleProperty value. + */ + @Generated + public Double getDoubleProperty() { + return this.doubleProperty; + } + + /** + * Get the duration property: The duration property. + * + * @return the duration value. + */ + @Generated + public Duration getDuration() { + return this.duration; + } + + /** + * Get the dateTime property: The dateTime property. + * + * @return the dateTime value. + */ + @Generated + public OffsetDateTime getDateTime() { + return this.dateTime; + } + + /** + * Get the stringList property: The stringList property. + * + * @return the stringList value. + */ + @Generated + public List getStringList() { + return this.stringList; + } + + /** + * Get the bytesDict property: The bytesDict property. + * + * @return the bytesDict value. + */ + @Generated + public Map getBytesDict() { + return this.bytesDict; + } + + /** + * Get the epochDateTimeRequiredNullable property: The epochDateTimeRequiredNullable property. + * + * @return the epochDateTimeRequiredNullable value. + */ + @Generated + public OffsetDateTime getEpochDateTimeRequiredNullable() { + if (this.epochDateTimeRequiredNullable == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.epochDateTimeRequiredNullable), ZoneOffset.UTC); + } + + /** + * Get the epochDateTimeNullable property: The epochDateTimeNullable property. + * + * @return the epochDateTimeNullable value. + */ + @Generated + public OffsetDateTime getEpochDateTimeNullable() { + if (this.epochDateTimeNullable == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.epochDateTimeNullable), ZoneOffset.UTC); + } + + /** + * Get the immutable property: The immutable property. + * + * @return the immutable value. + */ + @Generated + public ImmutableModel getImmutable() { + return this.immutable; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("boolean", this.booleanProperty); + jsonWriter.writeBooleanField("booleanNullable", this.booleanNullable); + jsonWriter.writeBooleanField("booleanRequired", this.booleanRequired); + jsonWriter.writeBooleanField("booleanRequiredNullable", this.booleanRequiredNullable); + jsonWriter.writeStringField("string", this.string); + jsonWriter.writeStringField("stringNullable", this.stringNullable); + jsonWriter.writeStringField("stringRequired", this.stringRequired); + jsonWriter.writeStringField("stringRequiredNullable", this.stringRequiredNullable); + jsonWriter.writeBinaryField("bytes", this.bytes); + jsonWriter.writeNumberField("int", this.intProperty); + jsonWriter.writeNumberField("long", this.longProperty); + jsonWriter.writeNumberField("float", this.floatProperty); + jsonWriter.writeNumberField("double", this.doubleProperty); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeStringField("dateTime", + this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); + jsonWriter.writeArrayField("stringList", this.stringList, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("bytesDict", this.bytesDict, (writer, element) -> writer.writeBinary(element)); + jsonWriter.writeNumberField("epochDateTimeRequiredNullable", this.epochDateTimeRequiredNullable); + jsonWriter.writeNumberField("epochDateTimeNullable", this.epochDateTimeNullable); + jsonWriter.writeJsonField("immutable", this.immutable); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AllPropertiesOptional from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AllPropertiesOptional if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the AllPropertiesOptional. + */ + @Generated + public static AllPropertiesOptional fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AllPropertiesOptional deserializedAllPropertiesOptional = new AllPropertiesOptional(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("boolean".equals(fieldName)) { + deserializedAllPropertiesOptional.booleanProperty = reader.getNullable(JsonReader::getBoolean); + } else if ("booleanNullable".equals(fieldName)) { + deserializedAllPropertiesOptional.booleanNullable = reader.getNullable(JsonReader::getBoolean); + } else if ("booleanRequired".equals(fieldName)) { + deserializedAllPropertiesOptional.booleanRequired = reader.getNullable(JsonReader::getBoolean); + } else if ("booleanRequiredNullable".equals(fieldName)) { + deserializedAllPropertiesOptional.booleanRequiredNullable + = reader.getNullable(JsonReader::getBoolean); + } else if ("string".equals(fieldName)) { + deserializedAllPropertiesOptional.string = reader.getString(); + } else if ("stringNullable".equals(fieldName)) { + deserializedAllPropertiesOptional.stringNullable = reader.getString(); + } else if ("stringRequired".equals(fieldName)) { + deserializedAllPropertiesOptional.stringRequired = reader.getString(); + } else if ("stringRequiredNullable".equals(fieldName)) { + deserializedAllPropertiesOptional.stringRequiredNullable = reader.getString(); + } else if ("bytes".equals(fieldName)) { + deserializedAllPropertiesOptional.bytes = reader.getBinary(); + } else if ("int".equals(fieldName)) { + deserializedAllPropertiesOptional.intProperty = reader.getNullable(JsonReader::getInt); + } else if ("long".equals(fieldName)) { + deserializedAllPropertiesOptional.longProperty = reader.getNullable(JsonReader::getLong); + } else if ("float".equals(fieldName)) { + deserializedAllPropertiesOptional.floatProperty = reader.getNullable(JsonReader::getDouble); + } else if ("double".equals(fieldName)) { + deserializedAllPropertiesOptional.doubleProperty = reader.getNullable(JsonReader::getDouble); + } else if ("duration".equals(fieldName)) { + deserializedAllPropertiesOptional.duration + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("dateTime".equals(fieldName)) { + deserializedAllPropertiesOptional.dateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("stringList".equals(fieldName)) { + List stringList = reader.readArray(reader1 -> reader1.getString()); + deserializedAllPropertiesOptional.stringList = stringList; + } else if ("bytesDict".equals(fieldName)) { + Map bytesDict = reader.readMap(reader1 -> reader1.getBinary()); + deserializedAllPropertiesOptional.bytesDict = bytesDict; + } else if ("epochDateTimeRequiredNullable".equals(fieldName)) { + deserializedAllPropertiesOptional.epochDateTimeRequiredNullable + = reader.getNullable(JsonReader::getLong); + } else if ("epochDateTimeNullable".equals(fieldName)) { + deserializedAllPropertiesOptional.epochDateTimeNullable = reader.getNullable(JsonReader::getLong); + } else if ("immutable".equals(fieldName)) { + deserializedAllPropertiesOptional.immutable = ImmutableModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAllPropertiesOptional; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/ImmutableModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/ImmutableModel.java new file mode 100644 index 00000000000..d64c891e073 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/ImmutableModel.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.optional.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ImmutableModel model. + */ +@Immutable +public final class ImmutableModel implements JsonSerializable { + /* + * The stringReadWriteRequired property. + */ + @Generated + private final String stringReadWriteRequired; + + /* + * The stringReadOnlyOptional property. + */ + @Generated + private String stringReadOnlyOptional; + + /** + * Creates an instance of ImmutableModel class. + * + * @param stringReadWriteRequired the stringReadWriteRequired value to set. + */ + @Generated + private ImmutableModel(String stringReadWriteRequired) { + this.stringReadWriteRequired = stringReadWriteRequired; + } + + /** + * Get the stringReadWriteRequired property: The stringReadWriteRequired property. + * + * @return the stringReadWriteRequired value. + */ + @Generated + public String getStringReadWriteRequired() { + return this.stringReadWriteRequired; + } + + /** + * Get the stringReadOnlyOptional property: The stringReadOnlyOptional property. + * + * @return the stringReadOnlyOptional value. + */ + @Generated + public String getStringReadOnlyOptional() { + return this.stringReadOnlyOptional; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("stringReadWriteRequired", this.stringReadWriteRequired); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImmutableModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImmutableModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ImmutableModel. + */ + @Generated + public static ImmutableModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String stringReadWriteRequired = null; + String stringReadOnlyOptional = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("stringReadWriteRequired".equals(fieldName)) { + stringReadWriteRequired = reader.getString(); + } else if ("stringReadOnlyOptional".equals(fieldName)) { + stringReadOnlyOptional = reader.getString(); + } else { + reader.skipChildren(); + } + } + ImmutableModel deserializedImmutableModel = new ImmutableModel(stringReadWriteRequired); + deserializedImmutableModel.stringReadOnlyOptional = stringReadOnlyOptional; + + return deserializedImmutableModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/Optional.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/Optional.java new file mode 100644 index 00000000000..095191c78cd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/Optional.java @@ -0,0 +1,665 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; + +/** + * The Optional model. + */ +@Fluent +public final class Optional implements JsonSerializable { + /* + * The boolean property. + */ + @Generated + private Boolean booleanProperty; + + /* + * The booleanNullable property. + */ + @Generated + private Boolean booleanNullable; + + /* + * The booleanRequired property. + */ + @Generated + private final boolean booleanRequired; + + /* + * The booleanRequiredNullable property. + */ + @Generated + private final Boolean booleanRequiredNullable; + + /* + * The string property. + */ + @Generated + private String string; + + /* + * The stringNullable property. + */ + @Generated + private String stringNullable; + + /* + * The stringRequired property. + */ + @Generated + private final String stringRequired; + + /* + * The stringRequiredNullable property. + */ + @Generated + private final String stringRequiredNullable; + + /* + * The bytes property. + */ + @Generated + private byte[] bytes; + + /* + * The int property. + */ + @Generated + private Integer intProperty; + + /* + * The long property. + */ + @Generated + private Long longProperty; + + /* + * The float property. + */ + @Generated + private Double floatProperty; + + /* + * The double property. + */ + @Generated + private Double doubleProperty; + + /* + * The duration property. + */ + @Generated + private Duration duration; + + /* + * The dateTime property. + */ + @Generated + private OffsetDateTime dateTime; + + /* + * The stringList property. + */ + @Generated + private List stringList; + + /* + * The bytesDict property. + */ + @Generated + private Map bytesDict; + + /* + * The epochDateTimeRequiredNullable property. + */ + @Generated + private final Long epochDateTimeRequiredNullable; + + /* + * The epochDateTimeNullable property. + */ + @Generated + private Long epochDateTimeNullable; + + /** + * Creates an instance of Optional class. + * + * @param booleanRequired the booleanRequired value to set. + * @param booleanRequiredNullable the booleanRequiredNullable value to set. + * @param stringRequired the stringRequired value to set. + * @param stringRequiredNullable the stringRequiredNullable value to set. + * @param epochDateTimeRequiredNullable the epochDateTimeRequiredNullable value to set. + */ + @Generated + public Optional(boolean booleanRequired, Boolean booleanRequiredNullable, String stringRequired, + String stringRequiredNullable, OffsetDateTime epochDateTimeRequiredNullable) { + this.booleanRequired = booleanRequired; + this.booleanRequiredNullable = booleanRequiredNullable; + this.stringRequired = stringRequired; + this.stringRequiredNullable = stringRequiredNullable; + if (epochDateTimeRequiredNullable == null) { + this.epochDateTimeRequiredNullable = null; + } else { + this.epochDateTimeRequiredNullable = epochDateTimeRequiredNullable.toEpochSecond(); + } + } + + /** + * Get the booleanProperty property: The boolean property. + * + * @return the booleanProperty value. + */ + @Generated + public Boolean isBooleanProperty() { + return this.booleanProperty; + } + + /** + * Set the booleanProperty property: The boolean property. + * + * @param booleanProperty the booleanProperty value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setBooleanProperty(Boolean booleanProperty) { + this.booleanProperty = booleanProperty; + return this; + } + + /** + * Get the booleanNullable property: The booleanNullable property. + * + * @return the booleanNullable value. + */ + @Generated + public Boolean isBooleanNullable() { + return this.booleanNullable; + } + + /** + * Set the booleanNullable property: The booleanNullable property. + * + * @param booleanNullable the booleanNullable value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setBooleanNullable(Boolean booleanNullable) { + this.booleanNullable = booleanNullable; + return this; + } + + /** + * Get the booleanRequired property: The booleanRequired property. + * + * @return the booleanRequired value. + */ + @Generated + public boolean isBooleanRequired() { + return this.booleanRequired; + } + + /** + * Get the booleanRequiredNullable property: The booleanRequiredNullable property. + * + * @return the booleanRequiredNullable value. + */ + @Generated + public Boolean isBooleanRequiredNullable() { + return this.booleanRequiredNullable; + } + + /** + * Get the string property: The string property. + * + * @return the string value. + */ + @Generated + public String getString() { + return this.string; + } + + /** + * Set the string property: The string property. + * + * @param string the string value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setString(String string) { + this.string = string; + return this; + } + + /** + * Get the stringNullable property: The stringNullable property. + * + * @return the stringNullable value. + */ + @Generated + public String getStringNullable() { + return this.stringNullable; + } + + /** + * Set the stringNullable property: The stringNullable property. + * + * @param stringNullable the stringNullable value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setStringNullable(String stringNullable) { + this.stringNullable = stringNullable; + return this; + } + + /** + * Get the stringRequired property: The stringRequired property. + * + * @return the stringRequired value. + */ + @Generated + public String getStringRequired() { + return this.stringRequired; + } + + /** + * Get the stringRequiredNullable property: The stringRequiredNullable property. + * + * @return the stringRequiredNullable value. + */ + @Generated + public String getStringRequiredNullable() { + return this.stringRequiredNullable; + } + + /** + * Get the bytes property: The bytes property. + * + * @return the bytes value. + */ + @Generated + public byte[] getBytes() { + return CoreUtils.clone(this.bytes); + } + + /** + * Set the bytes property: The bytes property. + * + * @param bytes the bytes value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setBytes(byte[] bytes) { + this.bytes = CoreUtils.clone(bytes); + return this; + } + + /** + * Get the intProperty property: The int property. + * + * @return the intProperty value. + */ + @Generated + public Integer getIntProperty() { + return this.intProperty; + } + + /** + * Set the intProperty property: The int property. + * + * @param intProperty the intProperty value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setIntProperty(Integer intProperty) { + this.intProperty = intProperty; + return this; + } + + /** + * Get the longProperty property: The long property. + * + * @return the longProperty value. + */ + @Generated + public Long getLongProperty() { + return this.longProperty; + } + + /** + * Set the longProperty property: The long property. + * + * @param longProperty the longProperty value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setLongProperty(Long longProperty) { + this.longProperty = longProperty; + return this; + } + + /** + * Get the floatProperty property: The float property. + * + * @return the floatProperty value. + */ + @Generated + public Double getFloatProperty() { + return this.floatProperty; + } + + /** + * Set the floatProperty property: The float property. + * + * @param floatProperty the floatProperty value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setFloatProperty(Double floatProperty) { + this.floatProperty = floatProperty; + return this; + } + + /** + * Get the doubleProperty property: The double property. + * + * @return the doubleProperty value. + */ + @Generated + public Double getDoubleProperty() { + return this.doubleProperty; + } + + /** + * Set the doubleProperty property: The double property. + * + * @param doubleProperty the doubleProperty value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setDoubleProperty(Double doubleProperty) { + this.doubleProperty = doubleProperty; + return this; + } + + /** + * Get the duration property: The duration property. + * + * @return the duration value. + */ + @Generated + public Duration getDuration() { + return this.duration; + } + + /** + * Set the duration property: The duration property. + * + * @param duration the duration value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setDuration(Duration duration) { + this.duration = duration; + return this; + } + + /** + * Get the dateTime property: The dateTime property. + * + * @return the dateTime value. + */ + @Generated + public OffsetDateTime getDateTime() { + return this.dateTime; + } + + /** + * Set the dateTime property: The dateTime property. + * + * @param dateTime the dateTime value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get the stringList property: The stringList property. + * + * @return the stringList value. + */ + @Generated + public List getStringList() { + return this.stringList; + } + + /** + * Set the stringList property: The stringList property. + * + * @param stringList the stringList value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setStringList(List stringList) { + this.stringList = stringList; + return this; + } + + /** + * Get the bytesDict property: The bytesDict property. + * + * @return the bytesDict value. + */ + @Generated + public Map getBytesDict() { + return this.bytesDict; + } + + /** + * Set the bytesDict property: The bytesDict property. + * + * @param bytesDict the bytesDict value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setBytesDict(Map bytesDict) { + this.bytesDict = bytesDict; + return this; + } + + /** + * Get the epochDateTimeRequiredNullable property: The epochDateTimeRequiredNullable property. + * + * @return the epochDateTimeRequiredNullable value. + */ + @Generated + public OffsetDateTime getEpochDateTimeRequiredNullable() { + if (this.epochDateTimeRequiredNullable == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.epochDateTimeRequiredNullable), ZoneOffset.UTC); + } + + /** + * Get the epochDateTimeNullable property: The epochDateTimeNullable property. + * + * @return the epochDateTimeNullable value. + */ + @Generated + public OffsetDateTime getEpochDateTimeNullable() { + if (this.epochDateTimeNullable == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.epochDateTimeNullable), ZoneOffset.UTC); + } + + /** + * Set the epochDateTimeNullable property: The epochDateTimeNullable property. + * + * @param epochDateTimeNullable the epochDateTimeNullable value to set. + * @return the Optional object itself. + */ + @Generated + public Optional setEpochDateTimeNullable(OffsetDateTime epochDateTimeNullable) { + if (epochDateTimeNullable == null) { + this.epochDateTimeNullable = null; + } else { + this.epochDateTimeNullable = epochDateTimeNullable.toEpochSecond(); + } + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("booleanRequired", this.booleanRequired); + jsonWriter.writeBooleanField("booleanRequiredNullable", this.booleanRequiredNullable); + jsonWriter.writeStringField("stringRequired", this.stringRequired); + jsonWriter.writeStringField("stringRequiredNullable", this.stringRequiredNullable); + jsonWriter.writeNumberField("epochDateTimeRequiredNullable", this.epochDateTimeRequiredNullable); + jsonWriter.writeBooleanField("boolean", this.booleanProperty); + jsonWriter.writeBooleanField("booleanNullable", this.booleanNullable); + jsonWriter.writeStringField("string", this.string); + jsonWriter.writeStringField("stringNullable", this.stringNullable); + jsonWriter.writeBinaryField("bytes", this.bytes); + jsonWriter.writeNumberField("int", this.intProperty); + jsonWriter.writeNumberField("long", this.longProperty); + jsonWriter.writeNumberField("float", this.floatProperty); + jsonWriter.writeNumberField("double", this.doubleProperty); + jsonWriter.writeStringField("duration", CoreUtils.durationToStringWithDays(this.duration)); + jsonWriter.writeStringField("dateTime", + this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); + jsonWriter.writeArrayField("stringList", this.stringList, (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("bytesDict", this.bytesDict, (writer, element) -> writer.writeBinary(element)); + jsonWriter.writeNumberField("epochDateTimeNullable", this.epochDateTimeNullable); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Optional from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Optional if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Optional. + */ + @Generated + public static Optional fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean booleanRequired = false; + Boolean booleanRequiredNullable = null; + String stringRequired = null; + String stringRequiredNullable = null; + OffsetDateTime epochDateTimeRequiredNullable = null; + Boolean booleanProperty = null; + Boolean booleanNullable = null; + String string = null; + String stringNullable = null; + byte[] bytes = null; + Integer intProperty = null; + Long longProperty = null; + Double floatProperty = null; + Double doubleProperty = null; + Duration duration = null; + OffsetDateTime dateTime = null; + List stringList = null; + Map bytesDict = null; + Long epochDateTimeNullable = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("booleanRequired".equals(fieldName)) { + booleanRequired = reader.getBoolean(); + } else if ("booleanRequiredNullable".equals(fieldName)) { + booleanRequiredNullable = reader.getNullable(JsonReader::getBoolean); + } else if ("stringRequired".equals(fieldName)) { + stringRequired = reader.getString(); + } else if ("stringRequiredNullable".equals(fieldName)) { + stringRequiredNullable = reader.getString(); + } else if ("epochDateTimeRequiredNullable".equals(fieldName)) { + Long epochDateTimeRequiredNullableHolder = reader.getNullable(JsonReader::getLong); + if (epochDateTimeRequiredNullableHolder != null) { + epochDateTimeRequiredNullable = OffsetDateTime + .ofInstant(Instant.ofEpochSecond(epochDateTimeRequiredNullableHolder), ZoneOffset.UTC); + } + } else if ("boolean".equals(fieldName)) { + booleanProperty = reader.getNullable(JsonReader::getBoolean); + } else if ("booleanNullable".equals(fieldName)) { + booleanNullable = reader.getNullable(JsonReader::getBoolean); + } else if ("string".equals(fieldName)) { + string = reader.getString(); + } else if ("stringNullable".equals(fieldName)) { + stringNullable = reader.getString(); + } else if ("bytes".equals(fieldName)) { + bytes = reader.getBinary(); + } else if ("int".equals(fieldName)) { + intProperty = reader.getNullable(JsonReader::getInt); + } else if ("long".equals(fieldName)) { + longProperty = reader.getNullable(JsonReader::getLong); + } else if ("float".equals(fieldName)) { + floatProperty = reader.getNullable(JsonReader::getDouble); + } else if ("double".equals(fieldName)) { + doubleProperty = reader.getNullable(JsonReader::getDouble); + } else if ("duration".equals(fieldName)) { + duration = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else if ("dateTime".equals(fieldName)) { + dateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("stringList".equals(fieldName)) { + stringList = reader.readArray(reader1 -> reader1.getString()); + } else if ("bytesDict".equals(fieldName)) { + bytesDict = reader.readMap(reader1 -> reader1.getBinary()); + } else if ("epochDateTimeNullable".equals(fieldName)) { + epochDateTimeNullable = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + Optional deserializedOptional = new Optional(booleanRequired, booleanRequiredNullable, stringRequired, + stringRequiredNullable, epochDateTimeRequiredNullable); + deserializedOptional.booleanProperty = booleanProperty; + deserializedOptional.booleanNullable = booleanNullable; + deserializedOptional.string = string; + deserializedOptional.stringNullable = stringNullable; + deserializedOptional.bytes = bytes; + deserializedOptional.intProperty = intProperty; + deserializedOptional.longProperty = longProperty; + deserializedOptional.floatProperty = floatProperty; + deserializedOptional.doubleProperty = doubleProperty; + deserializedOptional.duration = duration; + deserializedOptional.dateTime = dateTime; + deserializedOptional.stringList = stringList; + deserializedOptional.bytesDict = bytesDict; + deserializedOptional.epochDateTimeNullable = epochDateTimeNullable; + + return deserializedOptional; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/package-info.java new file mode 100644 index 00000000000..1ce4c75584c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Optional. + * + */ +package tsptest.optional.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/package-info.java new file mode 100644 index 00000000000..08619765273 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/optional/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Optional. + * + */ +package tsptest.optional; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/partialupdate/models/PartialUpdateModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/partialupdate/models/PartialUpdateModel.java index e2161012b34..650a7e3f027 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/partialupdate/models/PartialUpdateModel.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/partialupdate/models/PartialUpdateModel.java @@ -96,9 +96,7 @@ public byte[] getBytes() { /** * Get the aggregate property: The aggregation function to be applied on the client metric. Allowed functions - * <ul> - * <li>‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’,</li> - * </ul> + * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, * ‘count’ - for requests. * diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchAsyncClient.java new file mode 100644 index 00000000000..6588150ae49 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchAsyncClient.java @@ -0,0 +1,455 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.patch.implementation.JsonMergePatchHelper; +import tsptest.patch.implementation.PatchesImpl; +import tsptest.patch.models.Fish; +import tsptest.patch.models.Resource; +import tsptest.patch.models.Salmon; + +/** + * Initializes a new instance of the asynchronous PatchClient type. + */ +@ServiceClient(builder = PatchClientBuilder.class, isAsync = true) +public final class PatchAsyncClient { + @Generated + private final PatchesImpl serviceClient; + + /** + * Initializes an instance of PatchAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PatchAsyncClient(PatchesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The createOrUpdateResource operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param resource The resource parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateResourceWithResponse(BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateResourceWithResponseAsync(resource, requestOptions); + } + + /** + * The createOrUpdateOptionalResource operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/merge-patch+json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateOptionalResourceWithResponse(RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateOptionalResourceWithResponseAsync(requestOptions); + } + + /** + * The createOrUpdateFish operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param fish The fish parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateFishWithResponse(BinaryData fish, RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateFishWithResponseAsync(fish, requestOptions); + } + + /** + * The createOrUpdateSalmon operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     *     friends (Optional): [
+     *          (Optional){
+     *             kind: String (Required)
+     *             id: String (Required)
+     *             name: String (Required)
+     *             age: int (Optional, Required on create)
+     *             color: String (Optional)
+     *         }
+     *     ]
+     *     hate (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     *     partner (Optional): (recursive schema, see partner above)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     *     friends (Optional): [
+     *          (Optional){
+     *             kind: String (Required)
+     *             id: String (Required)
+     *             name: String (Required)
+     *             age: int (Optional, Required on create)
+     *             color: String (Optional)
+     *         }
+     *     ]
+     *     hate (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     *     partner (Optional): (recursive schema, see partner above)
+     * }
+     * }
+     * 
+ * + * @param fish The fish parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the second level model in polymorphic multiple levels inheritance which contains references to other + * polymorphic instances along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateSalmonWithResponse(BinaryData fish, RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateSalmonWithResponseAsync(fish, requestOptions); + } + + /** + * The createOrUpdateResource operation. + * + * @param resource The resource parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateResource(Resource resource) { + // Generated convenience method for createOrUpdateResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + return createOrUpdateResourceWithResponse(resourceInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * The createOrUpdateOptionalResource operation. + * + * @param resource The resource parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateOptionalResource(Resource resource) { + // Generated convenience method for createOrUpdateOptionalResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (resource != null) { + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + requestOptions.setBody(resourceInBinaryData); + } + return createOrUpdateOptionalResourceWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * The createOrUpdateOptionalResource operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateOptionalResource() { + // Generated convenience method for createOrUpdateOptionalResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrUpdateOptionalResourceWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * The createOrUpdateFish operation. + * + * @param fish The fish parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateFish(Fish fish) { + // Generated convenience method for createOrUpdateFishWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, true); + BinaryData fishInBinaryData = BinaryData.fromObject(fish); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + fishInBinaryData.getLength(); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, false); + return createOrUpdateFishWithResponse(fishInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); + } + + /** + * The createOrUpdateSalmon operation. + * + * @param fish The fish parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the second level model in polymorphic multiple levels inheritance which contains references to other + * polymorphic instances on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrUpdateSalmon(Salmon fish) { + // Generated convenience method for createOrUpdateSalmonWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, true); + BinaryData fishInBinaryData = BinaryData.fromObject(fish); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + fishInBinaryData.getLength(); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, false); + return createOrUpdateSalmonWithResponse(fishInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Salmon.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClient.java new file mode 100644 index 00000000000..4ea8bd7f036 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClient.java @@ -0,0 +1,447 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.patch.implementation.JsonMergePatchHelper; +import tsptest.patch.implementation.PatchesImpl; +import tsptest.patch.models.Fish; +import tsptest.patch.models.Resource; +import tsptest.patch.models.Salmon; + +/** + * Initializes a new instance of the synchronous PatchClient type. + */ +@ServiceClient(builder = PatchClientBuilder.class) +public final class PatchClient { + @Generated + private final PatchesImpl serviceClient; + + /** + * Initializes an instance of PatchClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PatchClient(PatchesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The createOrUpdateResource operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param resource The resource parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateResourceWithResponse(BinaryData resource, RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateResourceWithResponse(resource, requestOptions); + } + + /** + * The createOrUpdateOptionalResource operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/merge-patch+json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateOptionalResourceWithResponse(RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateOptionalResourceWithResponse(requestOptions); + } + + /** + * The createOrUpdateFish operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param fish The fish parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateFishWithResponse(BinaryData fish, RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateFishWithResponse(fish, requestOptions); + } + + /** + * The createOrUpdateSalmon operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     *     friends (Optional): [
+     *          (Optional){
+     *             kind: String (Required)
+     *             id: String (Required)
+     *             name: String (Required)
+     *             age: int (Optional, Required on create)
+     *             color: String (Optional)
+     *         }
+     *     ]
+     *     hate (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     *     partner (Optional): (recursive schema, see partner above)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     *     friends (Optional): [
+     *          (Optional){
+     *             kind: String (Required)
+     *             id: String (Required)
+     *             name: String (Required)
+     *             age: int (Optional, Required on create)
+     *             color: String (Optional)
+     *         }
+     *     ]
+     *     hate (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     *     partner (Optional): (recursive schema, see partner above)
+     * }
+     * }
+     * 
+ * + * @param fish The fish parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the second level model in polymorphic multiple levels inheritance which contains references to other + * polymorphic instances along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateSalmonWithResponse(BinaryData fish, RequestOptions requestOptions) { + return this.serviceClient.createOrUpdateSalmonWithResponse(fish, requestOptions); + } + + /** + * The createOrUpdateResource operation. + * + * @param resource The resource parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource createOrUpdateResource(Resource resource) { + // Generated convenience method for createOrUpdateResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + return createOrUpdateResourceWithResponse(resourceInBinaryData, requestOptions).getValue() + .toObject(Resource.class); + } + + /** + * The createOrUpdateOptionalResource operation. + * + * @param resource The resource parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource createOrUpdateOptionalResource(Resource resource) { + // Generated convenience method for createOrUpdateOptionalResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (resource != null) { + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + requestOptions.setBody(resourceInBinaryData); + } + return createOrUpdateOptionalResourceWithResponse(requestOptions).getValue().toObject(Resource.class); + } + + /** + * The createOrUpdateOptionalResource operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource createOrUpdateOptionalResource() { + // Generated convenience method for createOrUpdateOptionalResourceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrUpdateOptionalResourceWithResponse(requestOptions).getValue().toObject(Resource.class); + } + + /** + * The createOrUpdateFish operation. + * + * @param fish The fish parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Fish createOrUpdateFish(Fish fish) { + // Generated convenience method for createOrUpdateFishWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, true); + BinaryData fishInBinaryData = BinaryData.fromObject(fish); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + fishInBinaryData.getLength(); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, false); + return createOrUpdateFishWithResponse(fishInBinaryData, requestOptions).getValue().toObject(Fish.class); + } + + /** + * The createOrUpdateSalmon operation. + * + * @param fish The fish parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the second level model in polymorphic multiple levels inheritance which contains references to other + * polymorphic instances. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Salmon createOrUpdateSalmon(Salmon fish) { + // Generated convenience method for createOrUpdateSalmonWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, true); + BinaryData fishInBinaryData = BinaryData.fromObject(fish); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + fishInBinaryData.getLength(); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, false); + return createOrUpdateSalmonWithResponse(fishInBinaryData, requestOptions).getValue().toObject(Salmon.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClientBuilder.java new file mode 100644 index 00000000000..54550fc9ae8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/PatchClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.patch.implementation.PatchClientImpl; + +/** + * A builder for creating a new instance of the PatchClient type. + */ +@ServiceClientBuilder(serviceClients = { PatchClient.class, PatchAsyncClient.class }) +public final class PatchClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-patch.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the PatchClientBuilder. + */ + @Generated + public PatchClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PatchClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PatchClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PatchClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PatchClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PatchClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PatchClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PatchClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public PatchClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the PatchClientBuilder. + */ + @Generated + public PatchClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of PatchClientImpl with the provided parameters. + * + * @return an instance of PatchClientImpl. + */ + @Generated + private PatchClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + PatchClientImpl client + = new PatchClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of PatchAsyncClient class. + * + * @return an instance of PatchAsyncClient. + */ + @Generated + public PatchAsyncClient buildAsyncClient() { + return new PatchAsyncClient(buildInnerClient().getPatches()); + } + + /** + * Builds an instance of PatchClient class. + * + * @return an instance of PatchClient. + */ + @Generated + public PatchClient buildClient() { + return new PatchClient(buildInnerClient().getPatches()); + } + + private static final ClientLogger LOGGER = new ClientLogger(PatchClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/JsonMergePatchHelper.java new file mode 100644 index 00000000000..c32f17e441b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/JsonMergePatchHelper.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch.implementation; + +import tsptest.patch.models.Fish; +import tsptest.patch.models.InnerModel; +import tsptest.patch.models.Resource; +import tsptest.patch.models.Shark; + +/** + * This is the Helper class to enable json merge patch serialization for a model. + */ +public class JsonMergePatchHelper { + private static ResourceAccessor resourceAccessor; + + public interface ResourceAccessor { + Resource prepareModelForJsonMergePatch(Resource resource, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(Resource resource); + } + + public static void setResourceAccessor(ResourceAccessor accessor) { + resourceAccessor = accessor; + } + + public static ResourceAccessor getResourceAccessor() { + return resourceAccessor; + } + + private static InnerModelAccessor innerModelAccessor; + + public interface InnerModelAccessor { + InnerModel prepareModelForJsonMergePatch(InnerModel innerModel, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(InnerModel innerModel); + } + + public static void setInnerModelAccessor(InnerModelAccessor accessor) { + innerModelAccessor = accessor; + } + + public static InnerModelAccessor getInnerModelAccessor() { + return innerModelAccessor; + } + + private static FishAccessor fishAccessor; + + public interface FishAccessor { + Fish prepareModelForJsonMergePatch(Fish fish, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(Fish fish); + + void setId(Fish fish, String id); + + void setName(Fish fish, String name); + + void setAge(Fish fish, int age); + + void setColor(Fish fish, String color); + } + + public static void setFishAccessor(FishAccessor accessor) { + fishAccessor = accessor; + } + + public static FishAccessor getFishAccessor() { + return fishAccessor; + } + + private static SharkAccessor sharkAccessor; + + public interface SharkAccessor { + void setWeight(Shark shark, Integer weight); + } + + public static void setSharkAccessor(SharkAccessor accessor) { + sharkAccessor = accessor; + } + + public static SharkAccessor getSharkAccessor() { + return sharkAccessor; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchClientImpl.java new file mode 100644 index 00000000000..0c066527638 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 PatchClient type. + */ +public final class PatchClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 PatchesImpl object to access its operations. + */ + private final PatchesImpl patches; + + /** + * Gets the PatchesImpl object to access its operations. + * + * @return the PatchesImpl object. + */ + public PatchesImpl getPatches() { + return this.patches; + } + + /** + * Initializes an instance of PatchClient client. + * + * @param endpoint Service host. + */ + public PatchClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of PatchClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public PatchClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of PatchClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public PatchClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.patches = new PatchesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchesImpl.java new file mode 100644 index 00000000000..71c6372db7c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/PatchesImpl.java @@ -0,0 +1,736 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Patches. + */ +public final class PatchesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PatchesService service; + + /** + * The service client containing this operation class. + */ + private final PatchClientImpl client; + + /** + * Initializes an instance of PatchesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PatchesImpl(PatchClientImpl client) { + this.service = RestProxy.create(PatchesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PatchClientPatches to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "PatchClientPatches") + public interface PatchesService { + @Patch("/patch/resource") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrUpdateResource(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Patch("/patch/resource") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrUpdateResourceSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Patch("/patch/resource/optional") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrUpdateOptionalResource(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Patch("/patch/resource/optional") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrUpdateOptionalResourceSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Patch("/patch/fish") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrUpdateFish(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData fish, RequestOptions requestOptions, Context context); + + @Patch("/patch/fish") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrUpdateFishSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData fish, RequestOptions requestOptions, Context context); + + @Patch("/patch/fish/salmon") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrUpdateSalmon(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData fish, RequestOptions requestOptions, Context context); + + @Patch("/patch/fish/salmon") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrUpdateSalmonSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData fish, RequestOptions requestOptions, Context context); + } + + /** + * The createOrUpdateResource operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param resource The resource parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateResourceWithResponseAsync(BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createOrUpdateResource(this.client.getEndpoint(), contentType, + accept, resource, requestOptions, context)); + } + + /** + * The createOrUpdateResource operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param resource The resource parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateResourceWithResponse(BinaryData resource, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.createOrUpdateResourceSync(this.client.getEndpoint(), contentType, accept, resource, + requestOptions, Context.NONE); + } + + /** + * The createOrUpdateOptionalResource operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/merge-patch+json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateOptionalResourceWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/merge-patch+json"); + } + }); + return FluxUtil.withContext(context -> service.createOrUpdateOptionalResource(this.client.getEndpoint(), accept, + requestOptionsLocal, context)); + } + + /** + * The createOrUpdateOptionalResource operation. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/merge-patch+json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     map (Optional, Required on create): {
+     *         String (Required): {
+     *             name: String (Optional, Required on create)
+     *             description: String (Optional)
+     *         }
+     *     }
+     *     longValue: Long (Optional)
+     *     intValue: Integer (Optional)
+     *     enumValue: String(a/b/c) (Optional)
+     *     wireNameForInnerModelProperty (Optional): (recursive schema, see wireNameForInnerModelProperty above)
+     *     array (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     fish (Optional): {
+     *         kind: String (Required)
+     *         id: String (Required)
+     *         name: String (Required)
+     *         age: int (Optional, Required on create)
+     *         color: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateOptionalResourceWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/merge-patch+json"); + } + }); + return service.createOrUpdateOptionalResourceSync(this.client.getEndpoint(), accept, requestOptionsLocal, + Context.NONE); + } + + /** + * The createOrUpdateFish operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param fish The fish parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateFishWithResponseAsync(BinaryData fish, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createOrUpdateFish(this.client.getEndpoint(), contentType, + accept, fish, requestOptions, context)); + } + + /** + * The createOrUpdateFish operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param fish The fish parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateFishWithResponse(BinaryData fish, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.createOrUpdateFishSync(this.client.getEndpoint(), contentType, accept, fish, requestOptions, + Context.NONE); + } + + /** + * The createOrUpdateSalmon operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     *     friends (Optional): [
+     *          (Optional){
+     *             kind: String (Required)
+     *             id: String (Required)
+     *             name: String (Required)
+     *             age: int (Optional, Required on create)
+     *             color: String (Optional)
+     *         }
+     *     ]
+     *     hate (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     *     partner (Optional): (recursive schema, see partner above)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     *     friends (Optional): [
+     *          (Optional){
+     *             kind: String (Required)
+     *             id: String (Required)
+     *             name: String (Required)
+     *             age: int (Optional, Required on create)
+     *             color: String (Optional)
+     *         }
+     *     ]
+     *     hate (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     *     partner (Optional): (recursive schema, see partner above)
+     * }
+     * }
+     * 
+ * + * @param fish The fish parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the second level model in polymorphic multiple levels inheritance which contains references to other + * polymorphic instances along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrUpdateSalmonWithResponseAsync(BinaryData fish, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createOrUpdateSalmon(this.client.getEndpoint(), contentType, + accept, fish, requestOptions, context)); + } + + /** + * The createOrUpdateSalmon operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     *     friends (Optional): [
+     *          (Optional){
+     *             kind: String (Required)
+     *             id: String (Required)
+     *             name: String (Required)
+     *             age: int (Optional, Required on create)
+     *             color: String (Optional)
+     *         }
+     *     ]
+     *     hate (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     *     partner (Optional): (recursive schema, see partner above)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     id: String (Required)
+     *     name: String (Required)
+     *     age: int (Optional, Required on create)
+     *     color: String (Optional)
+     *     friends (Optional): [
+     *          (Optional){
+     *             kind: String (Required)
+     *             id: String (Required)
+     *             name: String (Required)
+     *             age: int (Optional, Required on create)
+     *             color: String (Optional)
+     *         }
+     *     ]
+     *     hate (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     *     partner (Optional): (recursive schema, see partner above)
+     * }
+     * }
+     * 
+ * + * @param fish The fish parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the second level model in polymorphic multiple levels inheritance which contains references to other + * polymorphic instances along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateSalmonWithResponse(BinaryData fish, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.createOrUpdateSalmonSync(this.client.getEndpoint(), contentType, accept, fish, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/package-info.java new file mode 100644 index 00000000000..b9dda11360f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for PatchModel. + * + */ +package tsptest.patch.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Fish.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Fish.java new file mode 100644 index 00000000000..4854928ff25 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Fish.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import tsptest.patch.implementation.JsonMergePatchHelper; + +/** + * This is base model for polymorphic multiple levels inheritance with a discriminator. + */ +@Fluent +public class Fish implements JsonSerializable { + /* + * Discriminator property for Fish. + */ + @Generated + private String kind = "Fish"; + + /* + * The id property. + */ + @Generated + private String id; + + /* + * The name property. + */ + @Generated + private String name; + + /* + * The age property. + */ + @Generated + private int age; + + /* + * The color property. + */ + @Generated + private String color; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setFishAccessor(new JsonMergePatchHelper.FishAccessor() { + @Override + public Fish prepareModelForJsonMergePatch(Fish model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(Fish model) { + return model.jsonMergePatch; + } + + @Override + public void setId(Fish model, String id) { + model.id = id; + } + + @Override + public void setName(Fish model, String name) { + model.name = name; + } + + @Override + public void setAge(Fish model, int age) { + model.age = age; + } + + @Override + public void setColor(Fish model, String color) { + model.color = color; + } + }); + } + + /** + * Creates an instance of Fish class. + */ + @Generated + public Fish() { + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Generated + public String getKind() { + return this.kind; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the age property: The age property. + * + * @return the age value. + */ + @Generated + public int getAge() { + return this.age; + } + + /** + * Set the age property: The age property. + *

Required when create the resource.

+ * + * @param age the age value to set. + * @return the Fish object itself. + */ + @Generated + public Fish setAge(int age) { + this.age = age; + this.updatedProperties.add("age"); + return this; + } + + /** + * Get the color property: The color property. + * + * @return the color value. + */ + @Generated + public String getColor() { + return this.color; + } + + /** + * Set the color property: The color property. + * + * @param color the color value to set. + * @return the Fish object itself. + */ + @Generated + public Fish setColor(String color) { + this.color = color; + this.updatedProperties.add("color"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeIntField("age", this.age); + jsonWriter.writeStringField("color", this.color); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + if (updatedProperties.contains("age")) { + jsonWriter.writeIntField("age", this.age); + } + if (updatedProperties.contains("color")) { + if (this.color == null) { + jsonWriter.writeNullField("color"); + } else { + jsonWriter.writeStringField("color", this.color); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Fish from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Fish if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Fish. + */ + @Generated + public static Fish fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("shark".equals(discriminatorValue)) { + return Shark.fromJson(readerToUse.reset()); + } else if ("salmon".equals(discriminatorValue)) { + return Salmon.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Fish fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Fish deserializedFish = new Fish(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFish.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFish.name = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedFish.kind = reader.getString(); + } else if ("age".equals(fieldName)) { + deserializedFish.age = reader.getInt(); + } else if ("color".equals(fieldName)) { + deserializedFish.color = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFish; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/InnerModel.java new file mode 100644 index 00000000000..1447000b55c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/InnerModel.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import tsptest.patch.implementation.JsonMergePatchHelper; + +/** + * The InnerModel model. + */ +@Fluent +public final class InnerModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private String name; + + /* + * The description property. + */ + @Generated + private String description; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setInnerModelAccessor(new JsonMergePatchHelper.InnerModelAccessor() { + @Override + public InnerModel prepareModelForJsonMergePatch(InnerModel model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(InnerModel model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of InnerModel class. + */ + @Generated + public InnerModel() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name property. + *

Required when create the resource.

+ * + * @param name the name value to set. + * @return the InnerModel object itself. + */ + @Generated + public InnerModel setName(String name) { + this.name = name; + this.updatedProperties.add("name"); + return this; + } + + /** + * Get the description property: The description property. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description property. + * + * @param description the description value to set. + * @return the InnerModel object itself. + */ + @Generated + public InnerModel setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("name")) { + if (this.name == null) { + jsonWriter.writeNullField("name"); + } else { + jsonWriter.writeStringField("name", this.name); + } + } + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InnerModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the InnerModel. + */ + @Generated + public static InnerModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InnerModel deserializedInnerModel = new InnerModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedInnerModel.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedInnerModel.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInnerModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Resource.java new file mode 100644 index 00000000000..4a3cd667819 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Resource.java @@ -0,0 +1,471 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import tsptest.patch.implementation.JsonMergePatchHelper; + +/** + * The Resource model. + */ +@Fluent +public final class Resource implements JsonSerializable { + /* + * The id property. + */ + @Generated + private String id; + + /* + * The name property. + */ + @Generated + private String name; + + /* + * The description property. + */ + @Generated + private String description; + + /* + * The map property. + */ + @Generated + private Map map; + + /* + * The longValue property. + */ + @Generated + private Long longValue; + + /* + * The intValue property. + */ + @Generated + private Integer intValue; + + /* + * The enumValue property. + */ + @Generated + private ResourceEnumValue enumValue; + + /* + * The wireNameForInnerModelProperty property. + */ + @Generated + private InnerModel innerModelProperty; + + /* + * The array property. + */ + @Generated + private List array; + + /* + * The fish property. + */ + @Generated + private Fish fish; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setResourceAccessor(new JsonMergePatchHelper.ResourceAccessor() { + @Override + public Resource prepareModelForJsonMergePatch(Resource model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(Resource model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of Resource class. + */ + @Generated + public Resource() { + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the description property: The description property. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description property. + * + * @param description the description value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * Get the map property: The map property. + * + * @return the map value. + */ + @Generated + public Map getMap() { + return this.map; + } + + /** + * Set the map property: The map property. + *

Required when create the resource.

+ * + * @param map the map value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setMap(Map map) { + this.map = map; + this.updatedProperties.add("map"); + return this; + } + + /** + * Get the longValue property: The longValue property. + * + * @return the longValue value. + */ + @Generated + public Long getLongValue() { + return this.longValue; + } + + /** + * Set the longValue property: The longValue property. + * + * @param longValue the longValue value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setLongValue(Long longValue) { + this.longValue = longValue; + this.updatedProperties.add("longValue"); + return this; + } + + /** + * Get the intValue property: The intValue property. + * + * @return the intValue value. + */ + @Generated + public Integer getIntValue() { + return this.intValue; + } + + /** + * Set the intValue property: The intValue property. + * + * @param intValue the intValue value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setIntValue(Integer intValue) { + this.intValue = intValue; + this.updatedProperties.add("intValue"); + return this; + } + + /** + * Get the enumValue property: The enumValue property. + * + * @return the enumValue value. + */ + @Generated + public ResourceEnumValue getEnumValue() { + return this.enumValue; + } + + /** + * Set the enumValue property: The enumValue property. + * + * @param enumValue the enumValue value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setEnumValue(ResourceEnumValue enumValue) { + this.enumValue = enumValue; + this.updatedProperties.add("enumValue"); + return this; + } + + /** + * Get the innerModelProperty property: The wireNameForInnerModelProperty property. + * + * @return the innerModelProperty value. + */ + @Generated + public InnerModel getInnerModelProperty() { + return this.innerModelProperty; + } + + /** + * Set the innerModelProperty property: The wireNameForInnerModelProperty property. + * + * @param innerModelProperty the innerModelProperty value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setInnerModelProperty(InnerModel innerModelProperty) { + this.innerModelProperty = innerModelProperty; + this.updatedProperties.add("innerModelProperty"); + return this; + } + + /** + * Get the array property: The array property. + * + * @return the array value. + */ + @Generated + public List getArray() { + return this.array; + } + + /** + * Set the array property: The array property. + * + * @param array the array value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setArray(List array) { + this.array = array; + this.updatedProperties.add("array"); + return this; + } + + /** + * Get the fish property: The fish property. + * + * @return the fish value. + */ + @Generated + public Fish getFish() { + return this.fish; + } + + /** + * Set the fish property: The fish property. + * + * @param fish the fish value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setFish(Fish fish) { + this.fish = fish; + this.updatedProperties.add("fish"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeMapField("map", this.map, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("longValue", this.longValue); + jsonWriter.writeNumberField("intValue", this.intValue); + jsonWriter.writeStringField("enumValue", this.enumValue == null ? null : this.enumValue.toString()); + jsonWriter.writeJsonField("wireNameForInnerModelProperty", this.innerModelProperty); + jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("fish", this.fish); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + if (updatedProperties.contains("map")) { + if (this.map == null) { + jsonWriter.writeNullField("map"); + } else { + jsonWriter.writeMapField("map", this.map, (writer, element) -> { + if (element != null) { + JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(element, true); + writer.writeJson(element); + JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(element, false); + } else { + writer.writeNull(); + } + }); + } + } + if (updatedProperties.contains("longValue")) { + if (this.longValue == null) { + jsonWriter.writeNullField("longValue"); + } else { + jsonWriter.writeNumberField("longValue", this.longValue); + } + } + if (updatedProperties.contains("intValue")) { + if (this.intValue == null) { + jsonWriter.writeNullField("intValue"); + } else { + jsonWriter.writeNumberField("intValue", this.intValue); + } + } + if (updatedProperties.contains("enumValue")) { + if (this.enumValue == null) { + jsonWriter.writeNullField("enumValue"); + } else { + jsonWriter.writeStringField("enumValue", this.enumValue.toString()); + } + } + if (updatedProperties.contains("innerModelProperty")) { + if (this.innerModelProperty == null) { + jsonWriter.writeNullField("wireNameForInnerModelProperty"); + } else { + JsonMergePatchHelper.getInnerModelAccessor() + .prepareModelForJsonMergePatch(this.innerModelProperty, true); + jsonWriter.writeJsonField("wireNameForInnerModelProperty", this.innerModelProperty); + JsonMergePatchHelper.getInnerModelAccessor() + .prepareModelForJsonMergePatch(this.innerModelProperty, false); + } + } + if (updatedProperties.contains("array")) { + if (this.array == null) { + jsonWriter.writeNullField("array"); + } else { + jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element)); + } + } + if (updatedProperties.contains("fish")) { + if (this.fish == null) { + jsonWriter.writeNullField("fish"); + } else { + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(this.fish, true); + jsonWriter.writeJsonField("fish", this.fish); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(this.fish, false); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Resource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Resource. + */ + @Generated + public static Resource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Resource deserializedResource = new Resource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedResource.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedResource.description = reader.getString(); + } else if ("map".equals(fieldName)) { + Map map = reader.readMap(reader1 -> InnerModel.fromJson(reader1)); + deserializedResource.map = map; + } else if ("longValue".equals(fieldName)) { + deserializedResource.longValue = reader.getNullable(JsonReader::getLong); + } else if ("intValue".equals(fieldName)) { + deserializedResource.intValue = reader.getNullable(JsonReader::getInt); + } else if ("enumValue".equals(fieldName)) { + deserializedResource.enumValue = ResourceEnumValue.fromString(reader.getString()); + } else if ("wireNameForInnerModelProperty".equals(fieldName)) { + deserializedResource.innerModelProperty = InnerModel.fromJson(reader); + } else if ("array".equals(fieldName)) { + List array = reader.readArray(reader1 -> InnerModel.fromJson(reader1)); + deserializedResource.array = array; + } else if ("fish".equals(fieldName)) { + deserializedResource.fish = Fish.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedResource; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/ResourceEnumValue.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/ResourceEnumValue.java new file mode 100644 index 00000000000..dae45c32ea2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/ResourceEnumValue.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch.models; + +/** + * Defines values for ResourceEnumValue. + */ +public enum ResourceEnumValue { + /** + * Enum value a. + */ + A("a"), + + /** + * Enum value b. + */ + B("b"), + + /** + * Enum value c. + */ + C("c"); + + /** + * The actual serialized value for a ResourceEnumValue instance. + */ + private final String value; + + ResourceEnumValue(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceEnumValue instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceEnumValue object, or null if unable to parse. + */ + public static ResourceEnumValue fromString(String value) { + if (value == null) { + return null; + } + ResourceEnumValue[] items = ResourceEnumValue.values(); + for (ResourceEnumValue item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Salmon.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Salmon.java new file mode 100644 index 00000000000..c28954c2bc7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Salmon.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import tsptest.patch.implementation.JsonMergePatchHelper; + +/** + * The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic + * instances. + */ +@Fluent +public final class Salmon extends Fish { + /* + * Discriminator property for Fish. + */ + @Generated + private String kind = "salmon"; + + /* + * The friends property. + */ + @Generated + private List friends; + + /* + * The hate property. + */ + @Generated + private Map hate; + + /* + * The partner property. + */ + @Generated + private Fish partner; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + /** + * Creates an instance of Salmon class. + */ + @Generated + public Salmon() { + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * Get the friends property: The friends property. + * + * @return the friends value. + */ + @Generated + public List getFriends() { + return this.friends; + } + + /** + * Set the friends property: The friends property. + * + * @param friends the friends value to set. + * @return the Salmon object itself. + */ + @Generated + public Salmon setFriends(List friends) { + this.friends = friends; + this.updatedProperties.add("friends"); + return this; + } + + /** + * Get the hate property: The hate property. + * + * @return the hate value. + */ + @Generated + public Map getHate() { + return this.hate; + } + + /** + * Set the hate property: The hate property. + * + * @param hate the hate value to set. + * @return the Salmon object itself. + */ + @Generated + public Salmon setHate(Map hate) { + this.hate = hate; + this.updatedProperties.add("hate"); + return this; + } + + /** + * Get the partner property: The partner property. + * + * @return the partner value. + */ + @Generated + public Fish getPartner() { + return this.partner; + } + + /** + * Set the partner property: The partner property. + * + * @param partner the partner value to set. + * @return the Salmon object itself. + */ + @Generated + public Salmon setPartner(Fish partner) { + this.partner = partner; + this.updatedProperties.add("partner"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public Salmon setAge(int age) { + super.setAge(age); + this.updatedProperties.add("age"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public Salmon setColor(String color) { + super.setColor(color); + this.updatedProperties.add("color"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (JsonMergePatchHelper.getFishAccessor().isJsonMergePatch(this)) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("age", getAge()); + jsonWriter.writeStringField("color", getColor()); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeArrayField("friends", this.friends, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("hate", this.hate, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("partner", this.partner); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("age")) { + jsonWriter.writeIntField("age", getAge()); + } + if (updatedProperties.contains("color")) { + if (getColor() == null) { + jsonWriter.writeNullField("color"); + } else { + jsonWriter.writeStringField("color", getColor()); + } + } + jsonWriter.writeStringField("kind", this.kind); + if (updatedProperties.contains("friends")) { + if (this.friends == null) { + jsonWriter.writeNullField("friends"); + } else { + jsonWriter.writeArrayField("friends", this.friends, (writer, element) -> writer.writeJson(element)); + } + } + if (updatedProperties.contains("hate")) { + if (this.hate == null) { + jsonWriter.writeNullField("hate"); + } else { + jsonWriter.writeMapField("hate", this.hate, (writer, element) -> { + if (element != null) { + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(element, true); + writer.writeJson(element); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(element, false); + } else { + writer.writeNull(); + } + }); + } + } + if (updatedProperties.contains("partner")) { + if (this.partner == null) { + jsonWriter.writeNullField("partner"); + } else { + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(this.partner, true); + jsonWriter.writeJsonField("partner", this.partner); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(this.partner, false); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Salmon from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Salmon if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Salmon. + */ + @Generated + public static Salmon fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Salmon deserializedSalmon = new Salmon(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + JsonMergePatchHelper.getFishAccessor().setId(deserializedSalmon, reader.getString()); + } else if ("name".equals(fieldName)) { + JsonMergePatchHelper.getFishAccessor().setName(deserializedSalmon, reader.getString()); + } else if ("age".equals(fieldName)) { + JsonMergePatchHelper.getFishAccessor().setAge(deserializedSalmon, reader.getInt()); + } else if ("color".equals(fieldName)) { + JsonMergePatchHelper.getFishAccessor().setColor(deserializedSalmon, reader.getString()); + } else if ("kind".equals(fieldName)) { + deserializedSalmon.kind = reader.getString(); + } else if ("friends".equals(fieldName)) { + List friends = reader.readArray(reader1 -> Fish.fromJson(reader1)); + deserializedSalmon.friends = friends; + } else if ("hate".equals(fieldName)) { + Map hate = reader.readMap(reader1 -> Fish.fromJson(reader1)); + deserializedSalmon.hate = hate; + } else if ("partner".equals(fieldName)) { + deserializedSalmon.partner = Fish.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSalmon; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/SawShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/SawShark.java new file mode 100644 index 00000000000..55a2e636f98 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/SawShark.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import tsptest.patch.implementation.JsonMergePatchHelper; + +/** + * The third level model SawShark in polymorphic multiple levels inheritance. + */ +@Fluent +public final class SawShark extends Shark { + /* + * Discriminator property for Fish. + */ + @Generated + private String kind = "shark"; + + /* + * The sharktype property. + */ + @Generated + private String sharktype = "saw"; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + /** + * Creates an instance of SawShark class. + */ + @Generated + public SawShark() { + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * Get the sharktype property: The sharktype property. + * + * @return the sharktype value. + */ + @Generated + @Override + public String getSharktype() { + return this.sharktype; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SawShark setWeight(Integer weight) { + super.setWeight(weight); + this.updatedProperties.add("weight"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SawShark setAge(int age) { + super.setAge(age); + this.updatedProperties.add("age"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SawShark setColor(String color) { + super.setColor(color); + this.updatedProperties.add("color"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (JsonMergePatchHelper.getFishAccessor().isJsonMergePatch(this)) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeIntField("age", getAge()); + jsonWriter.writeStringField("color", getColor()); + jsonWriter.writeNumberField("weight", getWeight()); + jsonWriter.writeStringField("sharktype", this.sharktype); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + if (updatedProperties.contains("age")) { + jsonWriter.writeIntField("age", getAge()); + } + if (updatedProperties.contains("color")) { + if (getColor() == null) { + jsonWriter.writeNullField("color"); + } else { + jsonWriter.writeStringField("color", getColor()); + } + } + if (updatedProperties.contains("weight")) { + if (getWeight() == null) { + jsonWriter.writeNullField("weight"); + } else { + jsonWriter.writeNumberField("weight", getWeight()); + } + } + jsonWriter.writeStringField("sharktype", this.sharktype); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SawShark from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SawShark if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SawShark. + */ + @Generated + public static SawShark fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SawShark deserializedSawShark = new SawShark(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + JsonMergePatchHelper.getFishAccessor().setId(deserializedSawShark, reader.getString()); + } else if ("name".equals(fieldName)) { + JsonMergePatchHelper.getFishAccessor().setName(deserializedSawShark, reader.getString()); + } else if ("age".equals(fieldName)) { + JsonMergePatchHelper.getFishAccessor().setAge(deserializedSawShark, reader.getInt()); + } else if ("color".equals(fieldName)) { + JsonMergePatchHelper.getFishAccessor().setColor(deserializedSawShark, reader.getString()); + } else if ("weight".equals(fieldName)) { + JsonMergePatchHelper.getSharkAccessor() + .setWeight(deserializedSawShark, reader.getNullable(JsonReader::getInt)); + } else if ("sharktype".equals(fieldName)) { + deserializedSawShark.sharktype = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSawShark; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Shark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Shark.java new file mode 100644 index 00000000000..65ce4de7ffc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/Shark.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import tsptest.patch.implementation.JsonMergePatchHelper; + +/** + * The second level model in polymorphic multiple levels inheritance and it defines a new discriminator. + */ +@Fluent +public class Shark extends Fish { + /* + * Discriminator property for Fish. + */ + @Generated + private String kind = "shark"; + + /* + * The sharktype property. + */ + @Generated + private String sharktype = "shark"; + + /* + * The weight property. + */ + @Generated + private Integer weight; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + static { + JsonMergePatchHelper.setSharkAccessor(new JsonMergePatchHelper.SharkAccessor() { + @Override + public void setWeight(Shark model, Integer weight) { + model.weight = weight; + } + }); + } + + /** + * Creates an instance of Shark class. + */ + @Generated + public Shark() { + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * Get the sharktype property: The sharktype property. + * + * @return the sharktype value. + */ + @Generated + public String getSharktype() { + return this.sharktype; + } + + /** + * Get the weight property: The weight property. + * + * @return the weight value. + */ + @Generated + public Integer getWeight() { + return this.weight; + } + + /** + * Set the weight property: The weight property. + * + * @param weight the weight value to set. + * @return the Shark object itself. + */ + @Generated + public Shark setWeight(Integer weight) { + this.weight = weight; + this.updatedProperties.add("weight"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public Shark setAge(int age) { + super.setAge(age); + this.updatedProperties.add("age"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public Shark setColor(String color) { + super.setColor(color); + this.updatedProperties.add("color"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (JsonMergePatchHelper.getFishAccessor().isJsonMergePatch(this)) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeIntField("age", getAge()); + jsonWriter.writeStringField("color", getColor()); + jsonWriter.writeStringField("sharktype", this.sharktype); + jsonWriter.writeNumberField("weight", this.weight); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + if (updatedProperties.contains("age")) { + jsonWriter.writeIntField("age", getAge()); + } + if (updatedProperties.contains("color")) { + if (getColor() == null) { + jsonWriter.writeNullField("color"); + } else { + jsonWriter.writeStringField("color", getColor()); + } + } + jsonWriter.writeStringField("sharktype", this.sharktype); + if (updatedProperties.contains("weight")) { + if (this.weight == null) { + jsonWriter.writeNullField("weight"); + } else { + jsonWriter.writeNumberField("weight", this.weight); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Shark from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Shark if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Shark. + */ + @Generated + public static Shark fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("sharktype".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("saw".equals(discriminatorValue)) { + return SawShark.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Shark fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Shark deserializedShark = new Shark(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + JsonMergePatchHelper.getFishAccessor().setId(deserializedShark, reader.getString()); + } else if ("name".equals(fieldName)) { + JsonMergePatchHelper.getFishAccessor().setName(deserializedShark, reader.getString()); + } else if ("age".equals(fieldName)) { + JsonMergePatchHelper.getFishAccessor().setAge(deserializedShark, reader.getInt()); + } else if ("color".equals(fieldName)) { + JsonMergePatchHelper.getFishAccessor().setColor(deserializedShark, reader.getString()); + } else if ("sharktype".equals(fieldName)) { + deserializedShark.sharktype = reader.getString(); + } else if ("weight".equals(fieldName)) { + deserializedShark.weight = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedShark; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/package-info.java new file mode 100644 index 00000000000..f45a78d9d8e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for PatchModel. + * + */ +package tsptest.patch.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/package-info.java new file mode 100644 index 00000000000..f5fe0c1bacd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/patch/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for PatchModel. + * + */ +package tsptest.patch; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientAsyncClient.java new file mode 100644 index 00000000000..15b4bdceb08 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientAsyncClient.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.protocolandconvenient.implementation.ProtocolAndConvenienceOpsImpl; +import tsptest.protocolandconvenient.models.ResourceA; +import tsptest.protocolandconvenient.models.ResourceB; +import tsptest.protocolandconvenient.models.ResourceE; +import tsptest.protocolandconvenient.models.ResourceF; +import tsptest.protocolandconvenient.models.ResourceI; +import tsptest.protocolandconvenient.models.ResourceJ; + +/** + * Initializes a new instance of the asynchronous ProtocolAndConvenientClient type. + */ +@ServiceClient(builder = ProtocolAndConvenientClientBuilder.class, isAsync = true) +public final class ProtocolAndConvenientAsyncClient { + @Generated + private final ProtocolAndConvenienceOpsImpl serviceClient; + + /** + * Initializes an instance of ProtocolAndConvenientAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ProtocolAndConvenientAsyncClient(ProtocolAndConvenienceOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * When set protocol false and convenient true, then the protocol method should be package private. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> onlyConvenientWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.onlyConvenientWithResponseAsync(body, requestOptions); + } + + /** + * When set protocol true and convenient false, only the protocol method should be generated, ResourceC and + * ResourceD should not be generated. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> onlyProtocolWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.onlyProtocolWithResponseAsync(body, requestOptions); + } + + /** + * Setting protocol true and convenient true, both convenient and protocol methods will be generated. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> bothConvenientAndProtocolWithResponse(BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.bothConvenientAndProtocolWithResponseAsync(body, requestOptions); + } + + /** + * When set protocol false and convenient false. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Mono> errorSettingWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.errorSettingWithResponseAsync(body, requestOptions); + } + + /** + * Long running operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux beginCreateOrReplace(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.beginCreateOrReplaceAsync(name, resource, requestOptions); + } + + /** + * Paging operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsLongNoThe maxPageSize parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of ResourceJ items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux list(RequestOptions requestOptions) { + return this.serviceClient.listAsync(requestOptions); + } + + /** + * When set protocol false and convenient true, then the protocol method should be package private. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono onlyConvenient(ResourceA body) { + // Generated convenience method for onlyConvenientWithResponse + RequestOptions requestOptions = new RequestOptions(); + return onlyConvenientWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ResourceB.class)); + } + + /** + * Setting protocol true and convenient true, both convenient and protocol methods will be generated. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono bothConvenientAndProtocol(ResourceE body) { + // Generated convenience method for bothConvenientAndProtocolWithResponse + RequestOptions requestOptions = new RequestOptions(); + return bothConvenientAndProtocolWithResponse(BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ResourceF.class)); + } + + /** + * Long running operation. + * + * @param name The name parameter. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateOrReplace(String name, ResourceI resource) { + // Generated convenience method for beginCreateOrReplaceWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginCreateOrReplaceWithModelAsync(name, BinaryData.fromObject(resource), requestOptions); + } + + /** + * Paging operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ResourceJ items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = list(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(ResourceJ.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClient.java new file mode 100644 index 00000000000..08361806c82 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClient.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.SyncPoller; +import tsptest.protocolandconvenient.implementation.ProtocolAndConvenienceOpsImpl; +import tsptest.protocolandconvenient.models.ResourceA; +import tsptest.protocolandconvenient.models.ResourceB; +import tsptest.protocolandconvenient.models.ResourceE; +import tsptest.protocolandconvenient.models.ResourceF; +import tsptest.protocolandconvenient.models.ResourceI; +import tsptest.protocolandconvenient.models.ResourceJ; + +/** + * Initializes a new instance of the synchronous ProtocolAndConvenientClient type. + */ +@ServiceClient(builder = ProtocolAndConvenientClientBuilder.class) +public final class ProtocolAndConvenientClient { + @Generated + private final ProtocolAndConvenienceOpsImpl serviceClient; + + /** + * Initializes an instance of ProtocolAndConvenientClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ProtocolAndConvenientClient(ProtocolAndConvenienceOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * When set protocol false and convenient true, then the protocol method should be package private. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response onlyConvenientWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.onlyConvenientWithResponse(body, requestOptions); + } + + /** + * When set protocol true and convenient false, only the protocol method should be generated, ResourceC and + * ResourceD should not be generated. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response onlyProtocolWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.onlyProtocolWithResponse(body, requestOptions); + } + + /** + * Setting protocol true and convenient true, both convenient and protocol methods will be generated. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response bothConvenientAndProtocolWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.bothConvenientAndProtocolWithResponse(body, requestOptions); + } + + /** + * When set protocol false and convenient false. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + Response errorSettingWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.errorSettingWithResponse(body, requestOptions); + } + + /** + * Long running operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller beginCreateOrReplace(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.beginCreateOrReplace(name, resource, requestOptions); + } + + /** + * Paging operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsLongNoThe maxPageSize parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of ResourceJ items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(RequestOptions requestOptions) { + return this.serviceClient.list(requestOptions); + } + + /** + * When set protocol false and convenient true, then the protocol method should be package private. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceB onlyConvenient(ResourceA body) { + // Generated convenience method for onlyConvenientWithResponse + RequestOptions requestOptions = new RequestOptions(); + return onlyConvenientWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(ResourceB.class); + } + + /** + * Setting protocol true and convenient true, both convenient and protocol methods will be generated. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceF bothConvenientAndProtocol(ResourceE body) { + // Generated convenience method for bothConvenientAndProtocolWithResponse + RequestOptions requestOptions = new RequestOptions(); + return bothConvenientAndProtocolWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(ResourceF.class); + } + + /** + * Long running operation. + * + * @param name The name parameter. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateOrReplace(String name, ResourceI resource) { + // Generated convenience method for beginCreateOrReplaceWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginCreateOrReplaceWithModel(name, BinaryData.fromObject(resource), requestOptions); + } + + /** + * Paging operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of ResourceJ items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(ResourceJ.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClientBuilder.java new file mode 100644 index 00000000000..3356e2e8607 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClientBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.protocolandconvenient.implementation.ProtocolAndConvenientClientImpl; + +/** + * A builder for creating a new instance of the ProtocolAndConvenientClient type. + */ +@ServiceClientBuilder(serviceClients = { ProtocolAndConvenientClient.class, ProtocolAndConvenientAsyncClient.class }) +public final class ProtocolAndConvenientClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("tsptest-protocolandconvenient.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ProtocolAndConvenientClientBuilder. + */ + @Generated + public ProtocolAndConvenientClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProtocolAndConvenientClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProtocolAndConvenientClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProtocolAndConvenientClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProtocolAndConvenientClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProtocolAndConvenientClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProtocolAndConvenientClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProtocolAndConvenientClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ProtocolAndConvenientClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private ProtocolAndConvenientServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the ProtocolAndConvenientClientBuilder. + */ + @Generated + public ProtocolAndConvenientClientBuilder serviceVersion(ProtocolAndConvenientServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ProtocolAndConvenientClientBuilder. + */ + @Generated + public ProtocolAndConvenientClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ProtocolAndConvenientClientImpl with the provided parameters. + * + * @return an instance of ProtocolAndConvenientClientImpl. + */ + @Generated + private ProtocolAndConvenientClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ProtocolAndConvenientServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : ProtocolAndConvenientServiceVersion.getLatest(); + ProtocolAndConvenientClientImpl client = new ProtocolAndConvenientClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ProtocolAndConvenientAsyncClient class. + * + * @return an instance of ProtocolAndConvenientAsyncClient. + */ + @Generated + public ProtocolAndConvenientAsyncClient buildAsyncClient() { + return new ProtocolAndConvenientAsyncClient(buildInnerClient().getProtocolAndConvenienceOps()); + } + + /** + * Builds an instance of ProtocolAndConvenientClient class. + * + * @return an instance of ProtocolAndConvenientClient. + */ + @Generated + public ProtocolAndConvenientClient buildClient() { + return new ProtocolAndConvenientClient(buildInnerClient().getProtocolAndConvenienceOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ProtocolAndConvenientClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientServiceVersion.java new file mode 100644 index 00000000000..97276c5335a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of ProtocolAndConvenientClient. + */ +public enum ProtocolAndConvenientServiceVersion implements ServiceVersion { + /** + * Enum value 2022-06-01-preview. + */ + V2022_06_01_PREVIEW("2022-06-01-preview"); + + private final String version; + + ProtocolAndConvenientServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link ProtocolAndConvenientServiceVersion}. + */ + public static ProtocolAndConvenientServiceVersion getLatest() { + return V2022_06_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/OperationLocationPollingStrategy.java new file mode 100644 index 00000000000..a2d34e7146a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/OperationLocationPollingStrategy.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.OperationResourcePollingStrategy; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +/** + * Implements an operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public Mono> onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + final Mono> pollResponseMono + = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) + .onErrorResume(exception -> { + LOGGER.info("Failed to parse initial response."); + return Mono.empty(); + }) + .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); + return pollResponseMono.switchIfEmpty( + Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); + } else { + return Mono + .error( + new AzureException(String.format( + "Operation failed or cancelled with status code %d," + + ", '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + } + + /** + * {@inheritDoc} + */ + @Override + public Mono getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + return Mono.error(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + return Mono.error(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + return PollingUtils + .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) + .flatMap(value -> { + if (value.get(propertyName) != null) { + return BinaryData.fromObjectAsync(value.get(propertyName)) + .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); + } else { + return Mono.error(new AzureException("Cannot get final result")); + } + }) + .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/PollingUtils.java new file mode 100644 index 00000000000..83f9c883f39 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/PollingUtils.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient.implementation; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.net.URI; +import java.net.URISyntaxException; +import java.time.DateTimeException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +final class PollingUtils { + + public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE + = new TypeReference>() { + }; + + public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); + + public static final String HTTP_METHOD = "httpMethod"; + public static final String REQUEST_URL = "requestURL"; + public static final String POLL_RESPONSE_BODY = "pollResponseBody"; + + private static final String FORWARD_SLASH = "/"; + + public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { + try { + URI uri = new URI(path); + if (!uri.isAbsolute()) { + if (CoreUtils.isNullOrEmpty(endpoint)) { + throw logger.logExceptionAsError(new IllegalArgumentException( + "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); + } + + if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { + return endpoint + path.substring(1); + } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { + return endpoint + FORWARD_SLASH + path; + } else { + return endpoint + path; + } + } + } catch (URISyntaxException ex) { + throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); + } + return path; + } + + public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + T value; + if (binaryData == null) { + value = null; + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); + } else { + value = binaryData.toObject(typeReference, serializer); + } + return value; + } + + @SuppressWarnings("unchecked") + public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + Mono value; + if (binaryData == null) { + value = Mono.empty(); + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = (Mono) binaryData.toReplayableBinaryDataAsync(); + } else { + value = binaryData.toObjectAsync(typeReference, serializer); + } + return value; + } + + private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); + private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); + + public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { + // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. + Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. + retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then + // attempt to resolve it as an HTTP date (RFC1123). + retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, + headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); + + // Either the retry delay will have been found or it'll be null, null indicates no retry after. + return retryDelay; + } + + private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, + Function delayParser) { + String headerValue = headers.getValue(headerName); + + return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); + } + + private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { + long delaySeconds; + try { + OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); + + delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); + } catch (DateTimeException ex) { + delaySeconds = tryParseLong(value); + } + + return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; + } + + private static long tryParseLong(String value) { + try { + return Long.parseLong(value); + } catch (NumberFormatException ex) { + return -1; + } + } + + private static Duration tryGetDelayMillis(String value) { + long delayMillis = tryParseLong(value); + return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java new file mode 100644 index 00000000000..419ba51f13c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java @@ -0,0 +1,1117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +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.RequestOptions; +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 com.azure.core.util.UrlBuilder; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; +import tsptest.protocolandconvenient.ProtocolAndConvenientServiceVersion; +import tsptest.protocolandconvenient.models.ResourceI; + +/** + * An instance of this class provides access to all the operations defined in ProtocolAndConvenienceOps. + */ +public final class ProtocolAndConvenienceOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ProtocolAndConvenienceOpsService service; + + /** + * The service client containing this operation class. + */ + private final ProtocolAndConvenientClientImpl client; + + /** + * Initializes an instance of ProtocolAndConvenienceOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProtocolAndConvenienceOpsImpl(ProtocolAndConvenientClientImpl client) { + this.service = RestProxy.create(ProtocolAndConvenienceOpsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ProtocolAndConvenientServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for ProtocolAndConvenientClientProtocolAndConvenienceOps to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ProtocolAndConvenientClientProtocolAndConvenienceOps") + public interface ProtocolAndConvenienceOpsService { + @Post("/protocolandconvenient/onlyConvenient") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> onlyConvenient(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/protocolandconvenient/onlyConvenient") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response onlyConvenientSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/protocolandconvenient/onlyProtocol") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> onlyProtocol(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/protocolandconvenient/onlyProtocol") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response onlyProtocolSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/protocolandconvenient/bothConvenientAndProtocol") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> bothConvenientAndProtocol(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/protocolandconvenient/bothConvenientAndProtocol") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response bothConvenientAndProtocolSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/protocolandconvenient/errorSetting") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> errorSetting(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/protocolandconvenient/errorSetting") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response errorSettingSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/protocolandconvenient/resources/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Put("/protocolandconvenient/resources/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrReplaceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Get("/protocolandconvenient/resources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/protocolandconvenient/resources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * When set protocol false and convenient true, then the protocol method should be package private. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> onlyConvenientWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.onlyConvenient(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * When set protocol false and convenient true, then the protocol method should be package private. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response onlyConvenientWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.onlyConvenientSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * When set protocol true and convenient false, only the protocol method should be generated, ResourceC and + * ResourceD should not be generated. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> onlyProtocolWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.onlyProtocol(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * When set protocol true and convenient false, only the protocol method should be generated, ResourceC and + * ResourceD should not be generated. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response onlyProtocolWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.onlyProtocolSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * Setting protocol true and convenient true, both convenient and protocol methods will be generated. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> bothConvenientAndProtocolWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.bothConvenientAndProtocol(this.client.getEndpoint(), contentType, + accept, body, requestOptions, context)); + } + + /** + * Setting protocol true and convenient true, both convenient and protocol methods will be generated. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response bothConvenientAndProtocolWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.bothConvenientAndProtocolSync(this.client.getEndpoint(), contentType, accept, body, + requestOptions, Context.NONE); + } + + /** + * When set protocol false and convenient false. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> errorSettingWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.errorSetting(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * When set protocol false and convenient false. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response errorSettingWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.errorSettingSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * Long running operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrReplaceWithResponseAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.createOrReplace(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + name, contentType, accept, resource, requestOptions, context)); + } + + /** + * Long running operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrReplaceWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + name, contentType, accept, resource, requestOptions, Context.NONE); + } + + /** + * Long running operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateOrReplaceWithModelAsync(String name, + BinaryData resource, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.createOrReplaceWithResponseAsync(name, resource, requestOptions), + new tsptest.protocolandconvenient.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(ResourceI.class)); + } + + /** + * Long running operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateOrReplaceWithModel(String name, BinaryData resource, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.createOrReplaceWithResponse(name, resource, requestOptions), + new tsptest.protocolandconvenient.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(ResourceI.class)); + } + + /** + * Long running operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateOrReplaceAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.createOrReplaceWithResponseAsync(name, resource, requestOptions), + new tsptest.protocolandconvenient.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Long running operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateOrReplace(String name, BinaryData resource, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.createOrReplaceWithResponse(name, resource, requestOptions), + new tsptest.protocolandconvenient.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Paging operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsLongNoThe maxPageSize parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of ResourceJ items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Paging operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsLongNoThe maxPageSize parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of ResourceJ items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxresults", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listSinglePageAsync(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxresults", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listNextSinglePageAsync(nextLink, requestOptionsLocal); + }); + } + + /** + * Paging operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsLongNoThe maxPageSize parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of ResourceJ items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Paging operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsLongNoThe maxPageSize parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of ResourceJ items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>((pageSize) -> { + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxresults", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listSinglePage(requestOptionsLocal); + }, (nextLink, pageSize) -> { + RequestOptions requestOptionsLocal = new RequestOptions(); + requestOptionsLocal.setContext(requestOptionsForNextPage.getContext()); + if (pageSize != null) { + requestOptionsLocal.addRequestCallback(requestLocal -> { + UrlBuilder urlBuilder = UrlBuilder.parse(requestLocal.getUrl()); + urlBuilder.setQueryParameter("maxresults", String.valueOf(pageSize)); + requestLocal.setUrl(urlBuilder.toString()); + }); + } + return listNextSinglePage(nextLink, requestOptionsLocal); + }); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of ResourceJ items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), 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
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of ResourceJ items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenientClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenientClientImpl.java new file mode 100644 index 00000000000..b650e49b670 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenientClientImpl.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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; +import tsptest.protocolandconvenient.ProtocolAndConvenientServiceVersion; + +/** + * Initializes a new instance of the ProtocolAndConvenientClient type. + */ +public final class ProtocolAndConvenientClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final ProtocolAndConvenientServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ProtocolAndConvenientServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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 ProtocolAndConvenienceOpsImpl object to access its operations. + */ + private final ProtocolAndConvenienceOpsImpl protocolAndConvenienceOps; + + /** + * Gets the ProtocolAndConvenienceOpsImpl object to access its operations. + * + * @return the ProtocolAndConvenienceOpsImpl object. + */ + public ProtocolAndConvenienceOpsImpl getProtocolAndConvenienceOps() { + return this.protocolAndConvenienceOps; + } + + /** + * Initializes an instance of ProtocolAndConvenientClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public ProtocolAndConvenientClientImpl(String endpoint, ProtocolAndConvenientServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ProtocolAndConvenientClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public ProtocolAndConvenientClientImpl(HttpPipeline httpPipeline, String endpoint, + ProtocolAndConvenientServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ProtocolAndConvenientClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public ProtocolAndConvenientClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint, ProtocolAndConvenientServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.protocolAndConvenienceOps = new ProtocolAndConvenienceOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/SyncOperationLocationPollingStrategy.java new file mode 100644 index 00000000000..9dbb6ad2b0d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/SyncOperationLocationPollingStrategy.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.io.UncheckedIOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Map; + +// DO NOT modify this helper class + +/** + * Implements a synchronous operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public PollResponse onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + T initialResponseType = null; + try { + initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, + pollResponseType); + } catch (UncheckedIOException e) { + LOGGER.info("Failed to parse initial response."); + } + return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); + } + + throw LOGGER.logExceptionAsError(new AzureException( + String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + + /** + * {@inheritDoc} + */ + public U getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, + PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); + if (pollResult != null && pollResult.get(propertyName) != null) { + return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), + serializer, resultType); + } else { + throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); + } + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/package-info.java new file mode 100644 index 00000000000..92e8412d77d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ProtocolAndConvenient. + * + */ +package tsptest.protocolandconvenient.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceA.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceA.java new file mode 100644 index 00000000000..b35a34303be --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceA.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ResourceA model. + */ +@Immutable +public final class ResourceA implements JsonSerializable { + /* + * The id property. + */ + @Generated + private String id; + + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of ResourceA class. + * + * @param name the name value to set. + */ + @Generated + public ResourceA(String name) { + this.name = name; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceA from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceA if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceA. + */ + @Generated + public static ResourceA fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + ResourceA deserializedResourceA = new ResourceA(name); + deserializedResourceA.id = id; + + return deserializedResourceA; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceB.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceB.java new file mode 100644 index 00000000000..4de9e349683 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceB.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ResourceB model. + */ +@Immutable +public final class ResourceB implements JsonSerializable { + /* + * The id property. + */ + @Generated + private String id; + + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of ResourceB class. + * + * @param name the name value to set. + */ + @Generated + private ResourceB(String name) { + this.name = name; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceB from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceB if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceB. + */ + @Generated + public static ResourceB fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + ResourceB deserializedResourceB = new ResourceB(name); + deserializedResourceB.id = id; + + return deserializedResourceB; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceE.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceE.java new file mode 100644 index 00000000000..32957b6ec19 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceE.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ResourceE model. + */ +@Immutable +public final class ResourceE implements JsonSerializable { + /* + * The id property. + */ + @Generated + private String id; + + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of ResourceE class. + * + * @param name the name value to set. + */ + @Generated + public ResourceE(String name) { + this.name = name; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceE from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceE if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceE. + */ + @Generated + public static ResourceE fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + ResourceE deserializedResourceE = new ResourceE(name); + deserializedResourceE.id = id; + + return deserializedResourceE; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceF.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceF.java new file mode 100644 index 00000000000..c8028dfc258 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceF.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ResourceF model. + */ +@Immutable +public final class ResourceF implements JsonSerializable { + /* + * The id property. + */ + @Generated + private String id; + + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of ResourceF class. + * + * @param name the name value to set. + */ + @Generated + private ResourceF(String name) { + this.name = name; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceF from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceF if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceF. + */ + @Generated + public static ResourceF fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + ResourceF deserializedResourceF = new ResourceF(name); + deserializedResourceF.id = id; + + return deserializedResourceF; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceI.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceI.java new file mode 100644 index 00000000000..5d608a057d0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceI.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ResourceI model. + */ +@Immutable +public final class ResourceI implements JsonSerializable { + /* + * The id property. + */ + @Generated + private String id; + + /* + * The name property. + */ + @Generated + private String name; + + /* + * The type property. + */ + @Generated + private final String type; + + /** + * Creates an instance of ResourceI class. + * + * @param type the type value to set. + */ + @Generated + public ResourceI(String type) { + this.type = type; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceI from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceI if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceI. + */ + @Generated + public static ResourceI fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + String type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + ResourceI deserializedResourceI = new ResourceI(type); + deserializedResourceI.id = id; + deserializedResourceI.name = name; + + return deserializedResourceI; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceJ.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceJ.java new file mode 100644 index 00000000000..c540561bdc9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/ResourceJ.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ResourceJ model. + */ +@Immutable +public final class ResourceJ implements JsonSerializable { + /* + * The id property. + */ + @Generated + private String id; + + /* + * The name property. + */ + @Generated + private String name; + + /* + * The type property. + */ + @Generated + private final String type; + + /** + * Creates an instance of ResourceJ class. + * + * @param type the type value to set. + */ + @Generated + private ResourceJ(String type) { + this.type = type; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceJ from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceJ if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceJ. + */ + @Generated + public static ResourceJ fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + String type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + ResourceJ deserializedResourceJ = new ResourceJ(type); + deserializedResourceJ.id = id; + deserializedResourceJ.name = name; + + return deserializedResourceJ; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/package-info.java new file mode 100644 index 00000000000..28fc5c5b37d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for ProtocolAndConvenient. + * + */ +package tsptest.protocolandconvenient.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/package-info.java new file mode 100644 index 00000000000..6ed14197b41 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/protocolandconvenient/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ProtocolAndConvenient. + * + */ +package tsptest.protocolandconvenient; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseAsyncClient.java new file mode 100644 index 00000000000..bb5f84c9ca6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseAsyncClient.java @@ -0,0 +1,952 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.response.implementation.ResponseClientImpl; +import tsptest.response.models.OperationDetails1; +import tsptest.response.models.OperationDetails2; +import tsptest.response.models.Resource; + +/** + * Initializes a new instance of the asynchronous ResponseClient type. + */ +@ServiceClient(builder = ResponseClientBuilder.class, isAsync = true) +public final class ResponseAsyncClient { + @Generated + private final ResponseClientImpl serviceClient; + + /** + * Initializes an instance of ResponseAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ResponseAsyncClient(ResponseClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getBinary operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getBinaryWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getBinaryWithResponseAsync(requestOptions); + } + + /** + * The getArray operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         description: String (Optional)
+     *         type: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getArrayWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getArrayWithResponseAsync(requestOptions); + } + + /** + * The getAnotherArray operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         description: String (Optional)
+     *         type: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAnotherArrayWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAnotherArrayWithResponseAsync(requestOptions); + } + + /** + * The createWithHeaders operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithHeadersWithResponse(RequestOptions requestOptions) { + return this.serviceClient.createWithHeadersWithResponseAsync(requestOptions); + } + + /** + * The deleteWithHeaders operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithHeadersWithResponse(RequestOptions requestOptions) { + return this.serviceClient.deleteWithHeadersWithResponseAsync(requestOptions); + } + + /** + * The most basic operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> existsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.existsWithResponseAsync(requestOptions); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLroInvalidPollResponse(BinaryData request, + RequestOptions requestOptions) { + return this.serviceClient.beginLroInvalidPollResponseAsync(request, requestOptions); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLroInvalidResult(BinaryData request, RequestOptions requestOptions) { + return this.serviceClient.beginLroInvalidResultAsync(request, requestOptions); + } + + /** + * The listStrings operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listStrings(RequestOptions requestOptions) { + return this.serviceClient.listStringsAsync(requestOptions); + } + + /** + * The listIntegers operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listIntegers(RequestOptions requestOptions) { + return this.serviceClient.listIntegersAsync(requestOptions); + } + + /** + * The getJsonUtf8Response operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getJsonUtf8ResponseWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getJsonUtf8ResponseWithResponseAsync(requestOptions); + } + + /** + * The getPlusJsonResponse operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPlusJsonResponseWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getPlusJsonResponseWithResponseAsync(requestOptions); + } + + /** + * The getUnionResponse operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param accept The accept parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getUnionResponseWithResponse(String accept, RequestOptions requestOptions) { + return this.serviceClient.getUnionResponseWithResponseAsync(accept, requestOptions); + } + + /** + * The getTextBoolean operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return boolean with `true` and `false` values along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextBooleanWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextBooleanWithResponseAsync(requestOptions); + } + + /** + * The getTextByte operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 8-bit integer along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextByteWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextByteWithResponseAsync(requestOptions); + } + + /** + * The getTextInt32 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 32-bit integer along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextInt32WithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextInt32WithResponseAsync(requestOptions); + } + + /** + * The getTextInt64 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * long
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 64-bit integer along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextInt64WithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextInt64WithResponseAsync(requestOptions); + } + + /** + * The getTextFloat32 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * double
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 32 bit floating point number along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextFloat32WithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextFloat32WithResponseAsync(requestOptions); + } + + /** + * The getTextFloat64 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * double
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 64 bit floating point number along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextFloat64WithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextFloat64WithResponseAsync(requestOptions); + } + + /** + * The getTextChar operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 16-bit integer along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextCharWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextCharWithResponseAsync(requestOptions); + } + + /** + * The getBinary operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getBinary() { + // Generated convenience method for getBinaryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getBinaryWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getArray operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getArray() { + // Generated convenience method for getArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getArrayWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_RESOURCE)); + } + + /** + * The getAnotherArray operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAnotherArray() { + // Generated convenience method for getAnotherArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAnotherArrayWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_RESOURCE)); + } + + /** + * The createWithHeaders operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createWithHeaders() { + // Generated convenience method for createWithHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createWithHeadersWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * The deleteWithHeaders operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteWithHeaders() { + // Generated convenience method for deleteWithHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteWithHeadersWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The most basic operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono exists() { + // Generated convenience method for existsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return existsWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The most basic operation. + * + * @param request The request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLroInvalidPollResponse(Resource request) { + // Generated convenience method for beginLroInvalidPollResponseWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginLroInvalidPollResponseWithModelAsync(BinaryData.fromObject(request), requestOptions); + } + + /** + * The most basic operation. + * + * @param request The request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLroInvalidResult(Resource request) { + // Generated convenience method for beginLroInvalidResultWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginLroInvalidResultWithModelAsync(BinaryData.fromObject(request), requestOptions); + } + + /** + * The listStrings operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listStrings() { + // Generated convenience method for listStrings + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listStrings(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(String.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * The listIntegers operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listIntegers() { + // Generated convenience method for listIntegers + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listIntegers(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Integer.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * The getJsonUtf8Response operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getJsonUtf8Response() { + // Generated convenience method for getJsonUtf8ResponseWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getJsonUtf8ResponseWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * The getPlusJsonResponse operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getPlusJsonResponse() { + // Generated convenience method for getPlusJsonResponseWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getPlusJsonResponseWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * The getUnionResponse operation. + * + * @param accept The accept parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getUnionResponse(String accept) { + // Generated convenience method for getUnionResponseWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getUnionResponseWithResponse(accept, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getTextBoolean operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return boolean with `true` and `false` values on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTextBoolean() { + // Generated convenience method for getTextBooleanWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTextBooleanWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> Boolean.parseBoolean(protocolMethodData.toString())); + } + + /** + * The getTextByte operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 8-bit integer on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTextByte() { + // Generated convenience method for getTextByteWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTextByteWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> Integer.parseInt(protocolMethodData.toString())); + } + + /** + * The getTextInt32 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 32-bit integer on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTextInt32() { + // Generated convenience method for getTextInt32WithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTextInt32WithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> Integer.parseInt(protocolMethodData.toString())); + } + + /** + * The getTextInt64 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 64-bit integer on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTextInt64() { + // Generated convenience method for getTextInt64WithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTextInt64WithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> Long.parseLong(protocolMethodData.toString())); + } + + /** + * The getTextFloat32 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 32 bit floating point number on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTextFloat32() { + // Generated convenience method for getTextFloat32WithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTextFloat32WithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> Double.parseDouble(protocolMethodData.toString())); + } + + /** + * The getTextFloat64 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 64 bit floating point number on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTextFloat64() { + // Generated convenience method for getTextFloat64WithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTextFloat64WithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> Double.parseDouble(protocolMethodData.toString())); + } + + /** + * The getTextChar operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 16-bit integer on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getTextChar() { + // Generated convenience method for getTextCharWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getTextCharWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> Integer.parseInt(protocolMethodData.toString())); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_RESOURCE + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClient.java new file mode 100644 index 00000000000..d6cfa44063c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClient.java @@ -0,0 +1,909 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import tsptest.response.implementation.ResponseClientImpl; +import tsptest.response.models.OperationDetails1; +import tsptest.response.models.OperationDetails2; +import tsptest.response.models.Resource; + +/** + * Initializes a new instance of the synchronous ResponseClient type. + */ +@ServiceClient(builder = ResponseClientBuilder.class) +public final class ResponseClient { + @Generated + private final ResponseClientImpl serviceClient; + + /** + * Initializes an instance of ResponseClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ResponseClient(ResponseClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getBinary operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getBinaryWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getBinaryWithResponse(requestOptions); + } + + /** + * The getArray operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         description: String (Optional)
+     *         type: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getArrayWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getArrayWithResponse(requestOptions); + } + + /** + * The getAnotherArray operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         description: String (Optional)
+     *         type: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAnotherArrayWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAnotherArrayWithResponse(requestOptions); + } + + /** + * The createWithHeaders operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithHeadersWithResponse(RequestOptions requestOptions) { + return this.serviceClient.createWithHeadersWithResponse(requestOptions); + } + + /** + * The deleteWithHeaders operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithHeadersWithResponse(RequestOptions requestOptions) { + return this.serviceClient.deleteWithHeadersWithResponse(requestOptions); + } + + /** + * The most basic operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return whether resource exists along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response existsWithResponse(RequestOptions requestOptions) { + return this.serviceClient.existsWithResponse(requestOptions); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLroInvalidPollResponse(BinaryData request, + RequestOptions requestOptions) { + return this.serviceClient.beginLroInvalidPollResponse(request, requestOptions); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLroInvalidResult(BinaryData request, RequestOptions requestOptions) { + return this.serviceClient.beginLroInvalidResult(request, requestOptions); + } + + /** + * The listStrings operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listStrings(RequestOptions requestOptions) { + return this.serviceClient.listStrings(requestOptions); + } + + /** + * The listIntegers operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listIntegers(RequestOptions requestOptions) { + return this.serviceClient.listIntegers(requestOptions); + } + + /** + * The getJsonUtf8Response operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getJsonUtf8ResponseWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getJsonUtf8ResponseWithResponse(requestOptions); + } + + /** + * The getPlusJsonResponse operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPlusJsonResponseWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getPlusJsonResponseWithResponse(requestOptions); + } + + /** + * The getUnionResponse operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param accept The accept parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getUnionResponseWithResponse(String accept, RequestOptions requestOptions) { + return this.serviceClient.getUnionResponseWithResponse(accept, requestOptions); + } + + /** + * The getTextBoolean operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return boolean with `true` and `false` values along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextBooleanWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextBooleanWithResponse(requestOptions); + } + + /** + * The getTextByte operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 8-bit integer along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextByteWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextByteWithResponse(requestOptions); + } + + /** + * The getTextInt32 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 32-bit integer along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextInt32WithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextInt32WithResponse(requestOptions); + } + + /** + * The getTextInt64 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * long
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 64-bit integer along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextInt64WithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextInt64WithResponse(requestOptions); + } + + /** + * The getTextFloat32 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * double
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 32 bit floating point number along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextFloat32WithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextFloat32WithResponse(requestOptions); + } + + /** + * The getTextFloat64 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * double
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 64 bit floating point number along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextFloat64WithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextFloat64WithResponse(requestOptions); + } + + /** + * The getTextChar operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 16-bit integer along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextCharWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getTextCharWithResponse(requestOptions); + } + + /** + * The getBinary operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData getBinary() { + // Generated convenience method for getBinaryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getBinaryWithResponse(requestOptions).getValue(); + } + + /** + * The getArray operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List getArray() { + // Generated convenience method for getArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getArrayWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_RESOURCE); + } + + /** + * The getAnotherArray operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List getAnotherArray() { + // Generated convenience method for getAnotherArrayWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAnotherArrayWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_RESOURCE); + } + + /** + * The createWithHeaders operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource createWithHeaders() { + // Generated convenience method for createWithHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createWithHeadersWithResponse(requestOptions).getValue().toObject(Resource.class); + } + + /** + * The deleteWithHeaders operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteWithHeaders() { + // Generated convenience method for deleteWithHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteWithHeadersWithResponse(requestOptions).getValue(); + } + + /** + * The most basic operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return whether resource exists. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean exists() { + // Generated convenience method for existsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return existsWithResponse(requestOptions).getValue(); + } + + /** + * The most basic operation. + * + * @param request The request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLroInvalidPollResponse(Resource request) { + // Generated convenience method for beginLroInvalidPollResponseWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginLroInvalidPollResponseWithModel(BinaryData.fromObject(request), requestOptions); + } + + /** + * The most basic operation. + * + * @param request The request parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLroInvalidResult(Resource request) { + // Generated convenience method for beginLroInvalidResultWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginLroInvalidResultWithModel(BinaryData.fromObject(request), requestOptions); + } + + /** + * The listStrings operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listStrings() { + // Generated convenience method for listStrings + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listStrings(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(String.class)); + } + + /** + * The listIntegers operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listIntegers() { + // Generated convenience method for listIntegers + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listIntegers(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(Integer.class)); + } + + /** + * The getJsonUtf8Response operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource getJsonUtf8Response() { + // Generated convenience method for getJsonUtf8ResponseWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getJsonUtf8ResponseWithResponse(requestOptions).getValue().toObject(Resource.class); + } + + /** + * The getPlusJsonResponse operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource getPlusJsonResponse() { + // Generated convenience method for getPlusJsonResponseWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getPlusJsonResponseWithResponse(requestOptions).getValue().toObject(Resource.class); + } + + /** + * The getUnionResponse operation. + * + * @param accept The accept parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData getUnionResponse(String accept) { + // Generated convenience method for getUnionResponseWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getUnionResponseWithResponse(accept, requestOptions).getValue(); + } + + /** + * The getTextBoolean operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return boolean with `true` and `false` values. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean getTextBoolean() { + // Generated convenience method for getTextBooleanWithResponse + RequestOptions requestOptions = new RequestOptions(); + return Boolean.parseBoolean(getTextBooleanWithResponse(requestOptions).getValue().toString()); + } + + /** + * The getTextByte operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 8-bit integer. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public int getTextByte() { + // Generated convenience method for getTextByteWithResponse + RequestOptions requestOptions = new RequestOptions(); + return Integer.parseInt(getTextByteWithResponse(requestOptions).getValue().toString()); + } + + /** + * The getTextInt32 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 32-bit integer. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public int getTextInt32() { + // Generated convenience method for getTextInt32WithResponse + RequestOptions requestOptions = new RequestOptions(); + return Integer.parseInt(getTextInt32WithResponse(requestOptions).getValue().toString()); + } + + /** + * The getTextInt64 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 64-bit integer. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public long getTextInt64() { + // Generated convenience method for getTextInt64WithResponse + RequestOptions requestOptions = new RequestOptions(); + return Long.parseLong(getTextInt64WithResponse(requestOptions).getValue().toString()); + } + + /** + * The getTextFloat32 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 32 bit floating point number. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public double getTextFloat32() { + // Generated convenience method for getTextFloat32WithResponse + RequestOptions requestOptions = new RequestOptions(); + return Double.parseDouble(getTextFloat32WithResponse(requestOptions).getValue().toString()); + } + + /** + * The getTextFloat64 operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 64 bit floating point number. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public double getTextFloat64() { + // Generated convenience method for getTextFloat64WithResponse + RequestOptions requestOptions = new RequestOptions(); + return Double.parseDouble(getTextFloat64WithResponse(requestOptions).getValue().toString()); + } + + /** + * The getTextChar operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 16-bit integer. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public int getTextChar() { + // Generated convenience method for getTextCharWithResponse + RequestOptions requestOptions = new RequestOptions(); + return Integer.parseInt(getTextCharWithResponse(requestOptions).getValue().toString()); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_RESOURCE + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClientBuilder.java new file mode 100644 index 00000000000..6ebaaea1928 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.response.implementation.ResponseClientImpl; + +/** + * A builder for creating a new instance of the ResponseClient type. + */ +@ServiceClientBuilder(serviceClients = { ResponseClient.class, ResponseAsyncClient.class }) +public final class ResponseClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-response.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ResponseClientBuilder. + */ + @Generated + public ResponseClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResponseClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResponseClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResponseClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResponseClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResponseClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResponseClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResponseClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ResponseClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private ResponseServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the ResponseClientBuilder. + */ + @Generated + public ResponseClientBuilder serviceVersion(ResponseServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ResponseClientBuilder. + */ + @Generated + public ResponseClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ResponseClientImpl with the provided parameters. + * + * @return an instance of ResponseClientImpl. + */ + @Generated + private ResponseClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ResponseServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : ResponseServiceVersion.getLatest(); + ResponseClientImpl client = new ResponseClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ResponseAsyncClient class. + * + * @return an instance of ResponseAsyncClient. + */ + @Generated + public ResponseAsyncClient buildAsyncClient() { + return new ResponseAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ResponseClient class. + * + * @return an instance of ResponseClient. + */ + @Generated + public ResponseClient buildClient() { + return new ResponseClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ResponseClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseServiceVersion.java new file mode 100644 index 00000000000..1744632d76d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/ResponseServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of ResponseClient. + */ +public enum ResponseServiceVersion implements ServiceVersion { + /** + * Enum value 2022-06-01-preview. + */ + V2022_06_01_PREVIEW("2022-06-01-preview"); + + private final String version; + + ResponseServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link ResponseServiceVersion}. + */ + public static ResponseServiceVersion getLatest() { + return V2022_06_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/OperationLocationPollingStrategy.java new file mode 100644 index 00000000000..2945cf50ac5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/OperationLocationPollingStrategy.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.OperationResourcePollingStrategy; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +/** + * Implements an operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public Mono> onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + final Mono> pollResponseMono + = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) + .onErrorResume(exception -> { + LOGGER.info("Failed to parse initial response."); + return Mono.empty(); + }) + .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); + return pollResponseMono.switchIfEmpty( + Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); + } else { + return Mono + .error( + new AzureException(String.format( + "Operation failed or cancelled with status code %d," + + ", '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + } + + /** + * {@inheritDoc} + */ + @Override + public Mono getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + return Mono.error(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + return Mono.error(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + return PollingUtils + .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) + .flatMap(value -> { + if (value.get(propertyName) != null) { + return BinaryData.fromObjectAsync(value.get(propertyName)) + .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); + } else { + return Mono.error(new AzureException("Cannot get final result")); + } + }) + .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/PollingUtils.java new file mode 100644 index 00000000000..6b07104c70e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/PollingUtils.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.implementation; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.net.URI; +import java.net.URISyntaxException; +import java.time.DateTimeException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +final class PollingUtils { + + public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE + = new TypeReference>() { + }; + + public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); + + public static final String HTTP_METHOD = "httpMethod"; + public static final String REQUEST_URL = "requestURL"; + public static final String POLL_RESPONSE_BODY = "pollResponseBody"; + + private static final String FORWARD_SLASH = "/"; + + public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { + try { + URI uri = new URI(path); + if (!uri.isAbsolute()) { + if (CoreUtils.isNullOrEmpty(endpoint)) { + throw logger.logExceptionAsError(new IllegalArgumentException( + "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); + } + + if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { + return endpoint + path.substring(1); + } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { + return endpoint + FORWARD_SLASH + path; + } else { + return endpoint + path; + } + } + } catch (URISyntaxException ex) { + throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); + } + return path; + } + + public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + T value; + if (binaryData == null) { + value = null; + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); + } else { + value = binaryData.toObject(typeReference, serializer); + } + return value; + } + + @SuppressWarnings("unchecked") + public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + Mono value; + if (binaryData == null) { + value = Mono.empty(); + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = (Mono) binaryData.toReplayableBinaryDataAsync(); + } else { + value = binaryData.toObjectAsync(typeReference, serializer); + } + return value; + } + + private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); + private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); + + public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { + // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. + Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. + retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then + // attempt to resolve it as an HTTP date (RFC1123). + retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, + headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); + + // Either the retry delay will have been found or it'll be null, null indicates no retry after. + return retryDelay; + } + + private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, + Function delayParser) { + String headerValue = headers.getValue(headerName); + + return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); + } + + private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { + long delaySeconds; + try { + OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); + + delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); + } catch (DateTimeException ex) { + delaySeconds = tryParseLong(value); + } + + return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; + } + + private static long tryParseLong(String value) { + try { + return Long.parseLong(value); + } catch (NumberFormatException ex) { + return -1; + } + } + + private static Duration tryGetDelayMillis(String value) { + long delayMillis = tryParseLong(value); + return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/ResponseClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/ResponseClientImpl.java new file mode 100644 index 00000000000..6b93dafe6cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/ResponseClientImpl.java @@ -0,0 +1,2042 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +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.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +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.RequestOptions; +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 com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; +import tsptest.response.ResponseServiceVersion; +import tsptest.response.models.OperationDetails1; +import tsptest.response.models.OperationDetails2; +import tsptest.response.models.Resource; + +/** + * Initializes a new instance of the ResponseClient type. + */ +public final class ResponseClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ResponseClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final ResponseServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ResponseServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of ResponseClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public ResponseClientImpl(String endpoint, ResponseServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ResponseClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public ResponseClientImpl(HttpPipeline httpPipeline, String endpoint, ResponseServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ResponseClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public ResponseClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + ResponseServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(ResponseClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ResponseClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ResponseClient") + public interface ResponseClientService { + @Get("/response/get-binary") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getBinary(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/get-binary") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getBinarySync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/response/get-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getArray(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/get-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getArraySync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/response/get-another-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAnotherArray(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/get-another-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAnotherArraySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/response/create-with-headers") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createWithHeaders(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/response/create-with-headers") + @ExpectedResponses({ 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createWithHeadersSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Delete("/response/delete-with-headers") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteWithHeaders(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Delete("/response/delete-with-headers") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteWithHeadersSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Head("/response/exists") + @ExpectedResponses({ 200, 404 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> exists(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + + @Head("/response/exists") + @ExpectedResponses({ 200, 404 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response existsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, RequestOptions requestOptions, Context context); + + @Post("/response/lro-invalid-poll-response") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> lroInvalidPollResponse(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context); + + @Post("/response/lro-invalid-poll-response") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response lroInvalidPollResponseSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context); + + @Post("/response/lro-invalid-result") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> lroInvalidResult(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context); + + @Post("/response/lro-invalid-result") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response lroInvalidResultSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData request, RequestOptions requestOptions, Context context); + + @Get("/response/paged-string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listStrings(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/paged-string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listStringsSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/paged-int32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listIntegers(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/paged-int32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listIntegersSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/json-utf8-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getJsonUtf8Response(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/json-utf8-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getJsonUtf8ResponseSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/plus-json-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getPlusJsonResponse(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/plus-json-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getPlusJsonResponseSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/union-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getUnionResponse(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/union-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getUnionResponseSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-boolean-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTextBoolean(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-boolean-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getTextBooleanSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-byte-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTextByte(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-byte-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getTextByteSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-int32-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTextInt32(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-int32-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getTextInt32Sync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-int64-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTextInt64(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-int64-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getTextInt64Sync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-float32-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTextFloat32(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-float32-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getTextFloat32Sync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-float64-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTextFloat64(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-float64-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getTextFloat64Sync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-char-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getTextChar(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/response/text-char-response") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getTextCharSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listStringsNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listStringsNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * The getBinary operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getBinaryWithResponseAsync(RequestOptions requestOptions) { + final String accept = "image/png"; + return FluxUtil.withContext(context -> service.getBinary(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getBinary operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getBinaryWithResponse(RequestOptions requestOptions) { + final String accept = "image/png"; + return service.getBinarySync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getArray operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         description: String (Optional)
+     *         type: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getArrayWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getArray(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getArray operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         description: String (Optional)
+     *         type: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getArrayWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getArraySync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getAnotherArray operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         description: String (Optional)
+     *         type: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAnotherArrayWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAnotherArray(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getAnotherArray operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         id: String (Required)
+     *         name: String (Required)
+     *         description: String (Optional)
+     *         type: String (Required)
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAnotherArrayWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAnotherArraySync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The createWithHeaders operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithHeadersWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createWithHeaders(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The createWithHeaders operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithHeadersWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.createWithHeadersSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The deleteWithHeaders operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithHeadersWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.deleteWithHeaders(this.getEndpoint(), requestOptions, context)); + } + + /** + * The deleteWithHeaders operation. + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithHeadersWithResponse(RequestOptions requestOptions) { + return service.deleteWithHeadersSync(this.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * The most basic operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return whether resource exists along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> existsWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.exists(this.getEndpoint(), this.getServiceVersion().getVersion(), + requestOptions, context)); + } + + /** + * The most basic operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return whether resource exists along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response existsWithResponse(RequestOptions requestOptions) { + return service.existsSync(this.getEndpoint(), this.getServiceVersion().getVersion(), requestOptions, + Context.NONE); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> lroInvalidPollResponseWithResponseAsync(BinaryData request, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.lroInvalidPollResponse(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, request, requestOptions, context)); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response lroInvalidPollResponseWithResponse(BinaryData request, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.lroInvalidPollResponseSync(this.getEndpoint(), this.getServiceVersion().getVersion(), + contentType, request, requestOptions, Context.NONE); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLroInvalidPollResponseWithModelAsync(BinaryData request, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.lroInvalidPollResponseWithResponseAsync(request, requestOptions), + new tsptest.response.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(OperationDetails1.class), TypeReference.createInstance(Resource.class)); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLroInvalidPollResponseWithModel(BinaryData request, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.lroInvalidPollResponseWithResponse(request, requestOptions), + new tsptest.response.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(OperationDetails1.class), TypeReference.createInstance(Resource.class)); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLroInvalidPollResponseAsync(BinaryData request, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.lroInvalidPollResponseWithResponseAsync(request, requestOptions), + new tsptest.response.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLroInvalidPollResponse(BinaryData request, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.lroInvalidPollResponseWithResponse(request, requestOptions), + new tsptest.response.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> lroInvalidResultWithResponseAsync(BinaryData request, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.lroInvalidResult(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, request, requestOptions, context)); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response lroInvalidResultWithResponse(BinaryData request, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.lroInvalidResultSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, + request, requestOptions, Context.NONE); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLroInvalidResultWithModelAsync(BinaryData request, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.lroInvalidResultWithResponseAsync(request, requestOptions), + new tsptest.response.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "lro_result"), + TypeReference.createInstance(OperationDetails2.class), TypeReference.createInstance(Resource.class)); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLroInvalidResultWithModel(BinaryData request, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.lroInvalidResultWithResponse(request, requestOptions), + new tsptest.response.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "lro_result"), + TypeReference.createInstance(OperationDetails2.class), TypeReference.createInstance(Resource.class)); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginLroInvalidResultAsync(BinaryData request, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.lroInvalidResultWithResponseAsync(request, requestOptions), + new tsptest.response.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "lro_result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * The most basic operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param request The request parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginLroInvalidResult(BinaryData request, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.lroInvalidResultWithResponse(request, requestOptions), + new tsptest.response.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion()), + "lro_result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * The listStrings operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listStringsSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listStrings(this.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "items_value"), getNextLink(res.getValue(), "next_link"), null)); + } + + /** + * The listStrings operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listStringsAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listStringsSinglePageAsync(requestOptions), + nextLink -> listStringsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * The listStrings operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listStringsSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listStringsSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "items_value"), getNextLink(res.getValue(), "next_link"), null); + } + + /** + * The listStrings operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listStrings(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listStringsSinglePage(requestOptions), + nextLink -> listStringsNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * The listIntegers operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listIntegersSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listIntegers(this.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), null, null)); + } + + /** + * The listIntegers operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listIntegersAsync(RequestOptions requestOptions) { + return new PagedFlux<>(() -> listIntegersSinglePageAsync(requestOptions)); + } + + /** + * The listIntegers operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listIntegersSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listIntegersSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), null, null); + } + + /** + * The listIntegers operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listIntegers(RequestOptions requestOptions) { + return new PagedIterable<>(() -> listIntegersSinglePage(requestOptions)); + } + + /** + * The getJsonUtf8Response operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getJsonUtf8ResponseWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json;charset=utf-8"; + return FluxUtil + .withContext(context -> service.getJsonUtf8Response(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getJsonUtf8Response operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getJsonUtf8ResponseWithResponse(RequestOptions requestOptions) { + final String accept = "application/json;charset=utf-8"; + return service.getJsonUtf8ResponseSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getPlusJsonResponse operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPlusJsonResponseWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/vnd.microsoft.appconfig.kv+json"; + return FluxUtil + .withContext(context -> service.getPlusJsonResponse(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getPlusJsonResponse operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPlusJsonResponseWithResponse(RequestOptions requestOptions) { + final String accept = "application/vnd.microsoft.appconfig.kv+json"; + return service.getPlusJsonResponseSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getUnionResponse operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param accept The accept parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getUnionResponseWithResponseAsync(String accept, RequestOptions requestOptions) { + return FluxUtil + .withContext(context -> service.getUnionResponse(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getUnionResponse operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param accept The accept parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getUnionResponseWithResponse(String accept, RequestOptions requestOptions) { + return service.getUnionResponseSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getTextBoolean operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return boolean with `true` and `false` values along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextBooleanWithResponseAsync(RequestOptions requestOptions) { + final String accept = "text/plain"; + return FluxUtil + .withContext(context -> service.getTextBoolean(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getTextBoolean operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return boolean with `true` and `false` values along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextBooleanWithResponse(RequestOptions requestOptions) { + final String accept = "text/plain"; + return service.getTextBooleanSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getTextByte operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 8-bit integer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextByteWithResponseAsync(RequestOptions requestOptions) { + final String accept = "text/plain"; + return FluxUtil + .withContext(context -> service.getTextByte(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getTextByte operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 8-bit integer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextByteWithResponse(RequestOptions requestOptions) { + final String accept = "text/plain"; + return service.getTextByteSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getTextInt32 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 32-bit integer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextInt32WithResponseAsync(RequestOptions requestOptions) { + final String accept = "text/plain"; + return FluxUtil + .withContext(context -> service.getTextInt32(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getTextInt32 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 32-bit integer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextInt32WithResponse(RequestOptions requestOptions) { + final String accept = "text/plain"; + return service.getTextInt32Sync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getTextInt64 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * long
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 64-bit integer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextInt64WithResponseAsync(RequestOptions requestOptions) { + final String accept = "text/plain"; + return FluxUtil + .withContext(context -> service.getTextInt64(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getTextInt64 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * long
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 64-bit integer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextInt64WithResponse(RequestOptions requestOptions) { + final String accept = "text/plain"; + return service.getTextInt64Sync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getTextFloat32 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * double
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 32 bit floating point number along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextFloat32WithResponseAsync(RequestOptions requestOptions) { + final String accept = "text/plain"; + return FluxUtil + .withContext(context -> service.getTextFloat32(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getTextFloat32 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * double
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 32 bit floating point number along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextFloat32WithResponse(RequestOptions requestOptions) { + final String accept = "text/plain"; + return service.getTextFloat32Sync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getTextFloat64 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * double
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 64 bit floating point number along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextFloat64WithResponseAsync(RequestOptions requestOptions) { + final String accept = "text/plain"; + return FluxUtil + .withContext(context -> service.getTextFloat64(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getTextFloat64 operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * double
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 64 bit floating point number along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextFloat64WithResponse(RequestOptions requestOptions) { + final String accept = "text/plain"; + return service.getTextFloat64Sync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getTextChar operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 16-bit integer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getTextCharWithResponseAsync(RequestOptions requestOptions) { + final String accept = "text/plain"; + return FluxUtil + .withContext(context -> service.getTextChar(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getTextChar operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * int
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 16-bit integer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTextCharWithResponse(RequestOptions requestOptions) { + final String accept = "text/plain"; + return service.getTextCharSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listStringsNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listStringsNext(nextLink, this.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "items_value"), getNextLink(res.getValue(), "next_link"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listStringsNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listStringsNextSync(nextLink, this.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "items_value"), getNextLink(res.getValue(), "next_link"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/SyncOperationLocationPollingStrategy.java new file mode 100644 index 00000000000..68ea8b4c5c3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/SyncOperationLocationPollingStrategy.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.io.UncheckedIOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Map; + +// DO NOT modify this helper class + +/** + * Implements a synchronous operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public PollResponse onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + T initialResponseType = null; + try { + initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, + pollResponseType); + } catch (UncheckedIOException e) { + LOGGER.info("Failed to parse initial response."); + } + return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); + } + + throw LOGGER.logExceptionAsError(new AzureException( + String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + + /** + * {@inheritDoc} + */ + public U getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, + PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); + if (pollResult != null && pollResult.get(propertyName) != null) { + return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), + serializer, resultType); + } else { + throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); + } + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/package-info.java new file mode 100644 index 00000000000..db3f252ed91 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Response. + * + */ +package tsptest.response.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails1.java new file mode 100644 index 00000000000..a914094f85f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails1.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The OperationDetails1 model. + */ +@Immutable +public final class OperationDetails1 implements JsonSerializable { + /* + * Operation ID + */ + @Generated + private final String operationId; + + /* + * The status property. + */ + @Generated + private final OperationState status; + + /* + * The error property. + */ + @Generated + private ResponseError error; + + /* + * The result property. + */ + @Generated + private Resource result; + + /** + * Creates an instance of OperationDetails1 class. + * + * @param operationId the operationId value to set. + * @param status the status value to set. + */ + @Generated + private OperationDetails1(String operationId, OperationState status) { + this.operationId = operationId; + this.status = status; + } + + /** + * Get the operationId property: Operation ID. + * + * @return the operationId value. + */ + @Generated + public String getOperationId() { + return this.operationId; + } + + /** + * Get the status property: The status property. + * + * @return the status value. + */ + @Generated + public OperationState getStatus() { + return this.status; + } + + /** + * Get the error property: The error property. + * + * @return the error value. + */ + @Generated + public ResponseError getError() { + return this.error; + } + + /** + * Get the result property: The result property. + * + * @return the result value. + */ + @Generated + public Resource getResult() { + return this.result; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operationId", this.operationId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("error", this.error); + jsonWriter.writeJsonField("result", this.result); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDetails1 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDetails1 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationDetails1. + */ + @Generated + public static OperationDetails1 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String operationId = null; + OperationState status = null; + ResponseError error = null; + Resource result = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + operationId = reader.getString(); + } else if ("status".equals(fieldName)) { + status = OperationState.fromString(reader.getString()); + } else if ("error".equals(fieldName)) { + error = ResponseError.fromJson(reader); + } else if ("result".equals(fieldName)) { + result = Resource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + OperationDetails1 deserializedOperationDetails1 = new OperationDetails1(operationId, status); + deserializedOperationDetails1.error = error; + deserializedOperationDetails1.result = result; + + return deserializedOperationDetails1; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails2.java new file mode 100644 index 00000000000..c5707130ba9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationDetails2.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The OperationDetails2 model. + */ +@Immutable +public final class OperationDetails2 implements JsonSerializable { + /* + * Operation ID + */ + @Generated + private final String id; + + /* + * The status property. + */ + @Generated + private final OperationState status; + + /* + * The error property. + */ + @Generated + private ResponseError error; + + /* + * The lro_result property. + */ + @Generated + private Resource longRunningResult; + + /** + * Creates an instance of OperationDetails2 class. + * + * @param id the id value to set. + * @param status the status value to set. + */ + @Generated + private OperationDetails2(String id, OperationState status) { + this.id = id; + this.status = status; + } + + /** + * Get the id property: Operation ID. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the status property: The status property. + * + * @return the status value. + */ + @Generated + public OperationState getStatus() { + return this.status; + } + + /** + * Get the error property: The error property. + * + * @return the error value. + */ + @Generated + public ResponseError getError() { + return this.error; + } + + /** + * Get the longRunningResult property: The lro_result property. + * + * @return the longRunningResult value. + */ + @Generated + public Resource getLongRunningResult() { + return this.longRunningResult; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("error", this.error); + jsonWriter.writeJsonField("lro_result", this.longRunningResult); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDetails2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDetails2 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationDetails2. + */ + @Generated + public static OperationDetails2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + OperationState status = null; + ResponseError error = null; + Resource longRunningResult = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("status".equals(fieldName)) { + status = OperationState.fromString(reader.getString()); + } else if ("error".equals(fieldName)) { + error = ResponseError.fromJson(reader); + } else if ("lro_result".equals(fieldName)) { + longRunningResult = Resource.fromJson(reader); + } else { + reader.skipChildren(); + } + } + OperationDetails2 deserializedOperationDetails2 = new OperationDetails2(id, status); + deserializedOperationDetails2.error = error; + deserializedOperationDetails2.longRunningResult = longRunningResult; + + return deserializedOperationDetails2; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationState.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationState.java new file mode 100644 index 00000000000..cd2df7f2cfa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/OperationState.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum describing allowed operation states. + */ +public final class OperationState extends ExpandableStringEnum { + /** + * The operation has not started. + */ + @Generated + public static final OperationState NOT_STARTED = fromString("NotStarted"); + + /** + * The operation is in progress. + */ + @Generated + public static final OperationState RUNNING = fromString("Running"); + + /** + * The operation has completed successfully. + */ + @Generated + public static final OperationState SUCCEEDED = fromString("Succeeded"); + + /** + * The operation has failed. + */ + @Generated + public static final OperationState FAILED = fromString("Failed"); + + /** + * The operation has been canceled by the user. + */ + @Generated + public static final OperationState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of OperationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public OperationState() { + } + + /** + * Creates or finds a OperationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationState. + */ + @Generated + public static OperationState fromString(String name) { + return fromString(name, OperationState.class); + } + + /** + * Gets known OperationState values. + * + * @return known OperationState values. + */ + @Generated + public static Collection values() { + return values(OperationState.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/Resource.java new file mode 100644 index 00000000000..491f6379f64 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/Resource.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Resource model. + */ +@Fluent +public final class Resource implements JsonSerializable { + /* + * The id property. + */ + @Generated + private String id; + + /* + * The name property. + */ + @Generated + private String name; + + /* + * The description property. + */ + @Generated + private String description; + + /* + * The type property. + */ + @Generated + private final String type; + + /** + * Creates an instance of Resource class. + * + * @param type the type value to set. + */ + @Generated + public Resource(String type) { + this.type = type; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the description property: The description property. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description property. + * + * @param description the description value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Resource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Resource. + */ + @Generated + public static Resource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + String type = null; + String description = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else if ("description".equals(fieldName)) { + description = reader.getString(); + } else { + reader.skipChildren(); + } + } + Resource deserializedResource = new Resource(type); + deserializedResource.id = id; + deserializedResource.name = name; + deserializedResource.description = description; + + return deserializedResource; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/package-info.java new file mode 100644 index 00000000000..72aca7010fb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Response. + * + */ +package tsptest.response.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/package-info.java new file mode 100644 index 00000000000..b7cf31c9fc9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/response/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Response. + * + */ +package tsptest.response; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsAsyncClient.java new file mode 100644 index 00000000000..e79f25dca45 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsAsyncClient.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialchars; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.specialchars.implementation.BuiltinOpsImpl; +import tsptest.specialchars.implementation.models.ReadRequest; +import tsptest.specialchars.models.Resource; + +/** + * Initializes a new instance of the asynchronous SpecialCharsClient type. + */ +@ServiceClient(builder = SpecialCharsClientBuilder.class, isAsync = true) +public final class SpecialCharsAsyncClient { + @Generated + private final BuiltinOpsImpl serviceClient; + + /** + * Initializes an instance of SpecialCharsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpecialCharsAsyncClient(BuiltinOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The read operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     aggregate: String (Optional)
+     *     condition: String (Optional)
+     *     requestName: String (Optional)
+     *     value: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param readRequest The readRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> readWithResponse(BinaryData readRequest, RequestOptions requestOptions) { + return this.serviceClient.readWithResponseAsync(readRequest, requestOptions); + } + + /** + * The read operation. + * + * @param id The id parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono read(String id) { + // Generated convenience method for readWithResponse + RequestOptions requestOptions = new RequestOptions(); + ReadRequest readRequestObj = new ReadRequest(id); + BinaryData readRequest = BinaryData.fromObject(readRequestObj); + return readWithResponse(readRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClient.java new file mode 100644 index 00000000000..d2aa4383b92 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClient.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialchars; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.specialchars.implementation.BuiltinOpsImpl; +import tsptest.specialchars.implementation.models.ReadRequest; +import tsptest.specialchars.models.Resource; + +/** + * Initializes a new instance of the synchronous SpecialCharsClient type. + */ +@ServiceClient(builder = SpecialCharsClientBuilder.class) +public final class SpecialCharsClient { + @Generated + private final BuiltinOpsImpl serviceClient; + + /** + * Initializes an instance of SpecialCharsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpecialCharsClient(BuiltinOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The read operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     aggregate: String (Optional)
+     *     condition: String (Optional)
+     *     requestName: String (Optional)
+     *     value: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param readRequest The readRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response readWithResponse(BinaryData readRequest, RequestOptions requestOptions) { + return this.serviceClient.readWithResponse(readRequest, requestOptions); + } + + /** + * The read operation. + * + * @param id The id parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource read(String id) { + // Generated convenience method for readWithResponse + RequestOptions requestOptions = new RequestOptions(); + ReadRequest readRequestObj = new ReadRequest(id); + BinaryData readRequest = BinaryData.fromObject(readRequestObj); + return readWithResponse(readRequest, requestOptions).getValue().toObject(Resource.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClientBuilder.java new file mode 100644 index 00000000000..47f6dcf6fb6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/SpecialCharsClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialchars; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.specialchars.implementation.SpecialCharsClientImpl; + +/** + * A builder for creating a new instance of the SpecialCharsClient type. + */ +@ServiceClientBuilder(serviceClients = { SpecialCharsClient.class, SpecialCharsAsyncClient.class }) +public final class SpecialCharsClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-specialchars.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the SpecialCharsClientBuilder. + */ + @Generated + public SpecialCharsClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialCharsClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialCharsClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialCharsClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialCharsClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialCharsClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialCharsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialCharsClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialCharsClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the SpecialCharsClientBuilder. + */ + @Generated + public SpecialCharsClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of SpecialCharsClientImpl with the provided parameters. + * + * @return an instance of SpecialCharsClientImpl. + */ + @Generated + private SpecialCharsClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + SpecialCharsClientImpl client + = new SpecialCharsClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of SpecialCharsAsyncClient class. + * + * @return an instance of SpecialCharsAsyncClient. + */ + @Generated + public SpecialCharsAsyncClient buildAsyncClient() { + return new SpecialCharsAsyncClient(buildInnerClient().getBuiltinOps()); + } + + /** + * Builds an instance of SpecialCharsClient class. + * + * @return an instance of SpecialCharsClient. + */ + @Generated + public SpecialCharsClient buildClient() { + return new SpecialCharsClient(buildInnerClient().getBuiltinOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(SpecialCharsClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/BuiltinOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/BuiltinOpsImpl.java new file mode 100644 index 00000000000..47b41b90c7b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/BuiltinOpsImpl.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialchars.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BuiltinOps. + */ +public final class BuiltinOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BuiltinOpsService service; + + /** + * The service client containing this operation class. + */ + private final SpecialCharsClientImpl client; + + /** + * Initializes an instance of BuiltinOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BuiltinOpsImpl(SpecialCharsClientImpl client) { + this.service + = RestProxy.create(BuiltinOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SpecialCharsClientBuiltinOps to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SpecialCharsClientBuiltinOps") + public interface BuiltinOpsService { + @Post("/specialchars") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> read(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData readRequest, RequestOptions requestOptions, Context context); + + @Post("/specialchars") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response readSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData readRequest, RequestOptions requestOptions, Context context); + } + + /** + * The read operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     aggregate: String (Optional)
+     *     condition: String (Optional)
+     *     requestName: String (Optional)
+     *     value: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param readRequest The readRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> readWithResponseAsync(BinaryData readRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.read(this.client.getEndpoint(), contentType, accept, readRequest, + requestOptions, context)); + } + + /** + * The read operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     aggregate: String (Optional)
+     *     condition: String (Optional)
+     *     requestName: String (Optional)
+     *     value: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param readRequest The readRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response readWithResponse(BinaryData readRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.readSync(this.client.getEndpoint(), contentType, accept, readRequest, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/SpecialCharsClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/SpecialCharsClientImpl.java new file mode 100644 index 00000000000..7a24855e804 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/SpecialCharsClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialchars.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 SpecialCharsClient type. + */ +public final class SpecialCharsClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 BuiltinOpsImpl object to access its operations. + */ + private final BuiltinOpsImpl builtinOps; + + /** + * Gets the BuiltinOpsImpl object to access its operations. + * + * @return the BuiltinOpsImpl object. + */ + public BuiltinOpsImpl getBuiltinOps() { + return this.builtinOps; + } + + /** + * Initializes an instance of SpecialCharsClient client. + * + * @param endpoint Service host. + */ + public SpecialCharsClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SpecialCharsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public SpecialCharsClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SpecialCharsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public SpecialCharsClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.builtinOps = new BuiltinOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/ReadRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/ReadRequest.java new file mode 100644 index 00000000000..73b3d51ab47 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/ReadRequest.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialchars.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ReadRequest model. + */ +@Immutable +public final class ReadRequest implements JsonSerializable { + /* + * The id property. + */ + @Generated + private final String id; + + /** + * Creates an instance of ReadRequest class. + * + * @param id the id value to set. + */ + @Generated + public ReadRequest(String id) { + this.id = id; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ReadRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ReadRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ReadRequest. + */ + @Generated + public static ReadRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ReadRequest(id); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/package-info.java new file mode 100644 index 00000000000..3e12aa15a44 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for SpecialChars. + * + */ +package tsptest.specialchars.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/package-info.java new file mode 100644 index 00000000000..f15c44ed1c1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for SpecialChars. + * + */ +package tsptest.specialchars.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/Resource.java new file mode 100644 index 00000000000..cf656e77475 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/Resource.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialchars.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Resource model. + */ +@Immutable +public final class Resource implements JsonSerializable { + /* + * id + */ + @Generated + private final String id; + + /* + * The aggregation function to be applied on the client metric. Allowed functions + * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, + * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, + * ‘count’ - for requests + */ + @Generated + private String aggregate; + + /* + * The comparison operator. Supported types ‘>’, ‘<’ + */ + @Generated + private String condition; + + /* + * Request name for which the Pass fail criteria has to be applied + */ + @Generated + private String requestName; + + /* + * The value to compare with the client metric. Allowed values - ‘error : [0.0 , + * 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. + */ + @Generated + private Double value; + + /** + * Creates an instance of Resource class. + * + * @param id the id value to set. + */ + @Generated + private Resource(String id) { + this.id = id; + } + + /** + * Get the id property: id. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the aggregate property: The aggregation function to be applied on the client metric. Allowed functions + * - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, + * ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, + * ‘count’ - for requests. + * + * @return the aggregate value. + */ + @Generated + public String getAggregate() { + return this.aggregate; + } + + /** + * Get the condition property: The comparison operator. Supported types ‘>’, ‘<’. + * + * @return the condition value. + */ + @Generated + public String getCondition() { + return this.condition; + } + + /** + * Get the requestName property: Request name for which the Pass fail criteria has to be applied. + * + * @return the requestName value. + */ + @Generated + public String getRequestName() { + return this.requestName; + } + + /** + * Get the value property: The value to compare with the client metric. Allowed values - ‘error : [0.0 , + * 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. + * + * @return the value value. + */ + @Generated + public Double getValue() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("aggregate", this.aggregate); + jsonWriter.writeStringField("condition", this.condition); + jsonWriter.writeStringField("requestName", this.requestName); + jsonWriter.writeNumberField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Resource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Resource. + */ + @Generated + public static Resource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String aggregate = null; + String condition = null; + String requestName = null; + Double value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("aggregate".equals(fieldName)) { + aggregate = reader.getString(); + } else if ("condition".equals(fieldName)) { + condition = reader.getString(); + } else if ("requestName".equals(fieldName)) { + requestName = reader.getString(); + } else if ("value".equals(fieldName)) { + value = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + Resource deserializedResource = new Resource(id); + deserializedResource.aggregate = aggregate; + deserializedResource.condition = condition; + deserializedResource.requestName = requestName; + deserializedResource.value = value; + + return deserializedResource; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/package-info.java new file mode 100644 index 00000000000..6c520940f53 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for SpecialChars. + * + */ +package tsptest.specialchars.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/package-info.java new file mode 100644 index 00000000000..92732d72a4d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialchars/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for SpecialChars. + * + */ +package tsptest.specialchars; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java new file mode 100644 index 00000000000..53664e65642 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.MatchConditions; +import com.azure.core.http.RequestConditions; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import java.time.OffsetDateTime; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import tsptest.specialheaders.implementation.EtagHeadersImpl; +import tsptest.specialheaders.implementation.JsonMergePatchHelper; +import tsptest.specialheaders.models.Resource; + +/** + * Initializes a new instance of the asynchronous SpecialHeadersClient type. + */ +@ServiceClient(builder = SpecialHeadersClientBuilder.class, isAsync = true) +public final class EtagHeadersAsyncClient { + @Generated + private final EtagHeadersImpl serviceClient; + + /** + * Initializes an instance of EtagHeadersAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EtagHeadersAsyncClient(EtagHeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Create or replace operation template. + *

Header Parameters

+ * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the + * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity + * was modified after this time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithRequestHeadersWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.putWithRequestHeadersWithResponseAsync(name, resource, requestOptions); + } + + /** + * Create or update operation template. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchWithMatchHeadersWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.patchWithMatchHeadersWithResponseAsync(name, resource, requestOptions); + } + + /** + * Resource list operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithEtag(RequestOptions requestOptions) { + return this.serviceClient.listWithEtagAsync(requestOptions); + } + + /** + * Create or replace operation template. + * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putWithRequestHeaders(String name, Resource resource, RequestConditions requestConditions) { + // Generated convenience method for putWithRequestHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); + String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); + OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); + OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + if (ifUnmodifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifModifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } + return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * Create or replace operation template. + * + * @param name The name parameter. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putWithRequestHeaders(String name, Resource resource) { + // Generated convenience method for putWithRequestHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * Create or update operation template. + * + * @param name The name parameter. + * @param resource The resource instance. + * @param matchConditions Specifies HTTP options for conditional requests. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchWithMatchHeaders(String name, Resource resource, MatchConditions matchConditions) { + // Generated convenience method for patchWithMatchHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + String ifMatch = matchConditions == null ? null : matchConditions.getIfMatch(); + String ifNoneMatch = matchConditions == null ? null : matchConditions.getIfNoneMatch(); + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * Create or update operation template. + * + * @param name The name parameter. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchWithMatchHeaders(String name, Resource resource) { + // Generated convenience method for patchWithMatchHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * Resource list operation template. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Resource items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithEtag() { + // Generated convenience method for listWithEtag + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = listWithEtag(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersClient.java new file mode 100644 index 00000000000..0516e1fd481 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersClient.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.MatchConditions; +import com.azure.core.http.RequestConditions; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.DateTimeRfc1123; +import java.time.OffsetDateTime; +import tsptest.specialheaders.implementation.EtagHeadersImpl; +import tsptest.specialheaders.implementation.JsonMergePatchHelper; +import tsptest.specialheaders.models.Resource; + +/** + * Initializes a new instance of the synchronous SpecialHeadersClient type. + */ +@ServiceClient(builder = SpecialHeadersClientBuilder.class) +public final class EtagHeadersClient { + @Generated + private final EtagHeadersImpl serviceClient; + + /** + * Initializes an instance of EtagHeadersClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EtagHeadersClient(EtagHeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Create or replace operation template. + *

Header Parameters

+ * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the + * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity + * was modified after this time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithRequestHeadersWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.putWithRequestHeadersWithResponse(name, resource, requestOptions); + } + + /** + * Create or update operation template. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchWithMatchHeadersWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.patchWithMatchHeadersWithResponse(name, resource, requestOptions); + } + + /** + * Resource list operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithEtag(RequestOptions requestOptions) { + return this.serviceClient.listWithEtag(requestOptions); + } + + /** + * Create or replace operation template. + * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource putWithRequestHeaders(String name, Resource resource, RequestConditions requestConditions) { + // Generated convenience method for putWithRequestHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); + String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); + OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); + OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + if (ifUnmodifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifModifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } + return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestOptions).getValue() + .toObject(Resource.class); + } + + /** + * Create or replace operation template. + * + * @param name The name parameter. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource putWithRequestHeaders(String name, Resource resource) { + // Generated convenience method for putWithRequestHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithRequestHeadersWithResponse(name, BinaryData.fromObject(resource), requestOptions).getValue() + .toObject(Resource.class); + } + + /** + * Create or update operation template. + * + * @param name The name parameter. + * @param resource The resource instance. + * @param matchConditions Specifies HTTP options for conditional requests. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource patchWithMatchHeaders(String name, Resource resource, MatchConditions matchConditions) { + // Generated convenience method for patchWithMatchHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + String ifMatch = matchConditions == null ? null : matchConditions.getIfMatch(); + String ifNoneMatch = matchConditions == null ? null : matchConditions.getIfNoneMatch(); + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, requestOptions).getValue() + .toObject(Resource.class); + } + + /** + * Create or update operation template. + * + * @param name The name parameter. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource patchWithMatchHeaders(String name, Resource resource) { + // Generated convenience method for patchWithMatchHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + return patchWithMatchHeadersWithResponse(name, resourceInBinaryData, requestOptions).getValue() + .toObject(Resource.class); + } + + /** + * Resource list operation template. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Resource items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithEtag() { + // Generated convenience method for listWithEtag + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.listWithEtag(requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(Resource.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java new file mode 100644 index 00000000000..642aeefc0ba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.RequestConditions; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; +import tsptest.specialheaders.implementation.EtagHeadersOptionalBodiesImpl; +import tsptest.specialheaders.models.Resource; + +/** + * Initializes a new instance of the asynchronous SpecialHeadersClient type. + */ +@ServiceClient(builder = SpecialHeadersClientBuilder.class, isAsync = true) +public final class EtagHeadersOptionalBodyAsyncClient { + @Generated + private final EtagHeadersOptionalBodiesImpl serviceClient; + + /** + * Initializes an instance of EtagHeadersOptionalBodyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EtagHeadersOptionalBodyAsyncClient(EtagHeadersOptionalBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * etag headers among other optional query/header/body parameters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the + * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity + * was modified after this time.
timestampOffsetDateTimeNoThe timestamp parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param format The format parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithOptionalBodyWithResponse(String format, RequestOptions requestOptions) { + return this.serviceClient.putWithOptionalBodyWithResponseAsync(format, requestOptions); + } + + /** + * etag headers among other optional query/header/body parameters. + * + * @param format The format parameter. + * @param filter The filter parameter. + * @param timestamp The timestamp parameter. + * @param body The body parameter. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putWithOptionalBody(String format, String filter, OffsetDateTime timestamp, Resource body, + RequestConditions requestConditions) { + // Generated convenience method for putWithOptionalBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); + String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); + OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); + OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + if (timestamp != null) { + requestOptions.setHeader(HttpHeaderName.fromString("timestamp"), String.valueOf(timestamp.toEpochSecond())); + } + if (body != null) { + requestOptions.setBody(BinaryData.fromObject(body)); + } + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + if (ifUnmodifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifModifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } + return putWithOptionalBodyWithResponse(format, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * etag headers among other optional query/header/body parameters. + * + * @param format The format parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putWithOptionalBody(String format) { + // Generated convenience method for putWithOptionalBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithOptionalBodyWithResponse(format, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java new file mode 100644 index 00000000000..5b481b428f2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.RequestConditions; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.DateTimeRfc1123; +import java.time.OffsetDateTime; +import tsptest.specialheaders.implementation.EtagHeadersOptionalBodiesImpl; +import tsptest.specialheaders.models.Resource; + +/** + * Initializes a new instance of the synchronous SpecialHeadersClient type. + */ +@ServiceClient(builder = SpecialHeadersClientBuilder.class) +public final class EtagHeadersOptionalBodyClient { + @Generated + private final EtagHeadersOptionalBodiesImpl serviceClient; + + /** + * Initializes an instance of EtagHeadersOptionalBodyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EtagHeadersOptionalBodyClient(EtagHeadersOptionalBodiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * etag headers among other optional query/header/body parameters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the + * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity + * was modified after this time.
timestampOffsetDateTimeNoThe timestamp parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param format The format parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithOptionalBodyWithResponse(String format, RequestOptions requestOptions) { + return this.serviceClient.putWithOptionalBodyWithResponse(format, requestOptions); + } + + /** + * etag headers among other optional query/header/body parameters. + * + * @param format The format parameter. + * @param filter The filter parameter. + * @param timestamp The timestamp parameter. + * @param body The body parameter. + * @param requestConditions Specifies HTTP options for conditional requests based on modification time. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource putWithOptionalBody(String format, String filter, OffsetDateTime timestamp, Resource body, + RequestConditions requestConditions) { + // Generated convenience method for putWithOptionalBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + String ifMatch = requestConditions == null ? null : requestConditions.getIfMatch(); + String ifNoneMatch = requestConditions == null ? null : requestConditions.getIfNoneMatch(); + OffsetDateTime ifUnmodifiedSince = requestConditions == null ? null : requestConditions.getIfUnmodifiedSince(); + OffsetDateTime ifModifiedSince = requestConditions == null ? null : requestConditions.getIfModifiedSince(); + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + if (timestamp != null) { + requestOptions.setHeader(HttpHeaderName.fromString("timestamp"), String.valueOf(timestamp.toEpochSecond())); + } + if (body != null) { + requestOptions.setBody(BinaryData.fromObject(body)); + } + if (ifMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_MATCH, ifMatch); + } + if (ifNoneMatch != null) { + requestOptions.setHeader(HttpHeaderName.IF_NONE_MATCH, ifNoneMatch); + } + if (ifUnmodifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_UNMODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifUnmodifiedSince))); + } + if (ifModifiedSince != null) { + requestOptions.setHeader(HttpHeaderName.IF_MODIFIED_SINCE, + String.valueOf(new DateTimeRfc1123(ifModifiedSince))); + } + return putWithOptionalBodyWithResponse(format, requestOptions).getValue().toObject(Resource.class); + } + + /** + * etag headers among other optional query/header/body parameters. + * + * @param format The format parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource putWithOptionalBody(String format) { + // Generated convenience method for putWithOptionalBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithOptionalBodyWithResponse(format, requestOptions).getValue().toObject(Resource.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersAsyncClient.java new file mode 100644 index 00000000000..3d5ea05399c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersAsyncClient.java @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import reactor.core.publisher.Mono; +import tsptest.specialheaders.implementation.JsonMergePatchHelper; +import tsptest.specialheaders.implementation.RepeatabilityHeadersImpl; +import tsptest.specialheaders.models.Resource; + +/** + * Initializes a new instance of the asynchronous SpecialHeadersClient type. + */ +@ServiceClient(builder = SpecialHeadersClientBuilder.class, isAsync = true) +public final class RepeatabilityHeadersAsyncClient { + @Generated + private final RepeatabilityHeadersImpl serviceClient; + + /** + * Initializes an instance of RepeatabilityHeadersAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RepeatabilityHeadersAsyncClient(RepeatabilityHeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Resource read operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(name, requestOptions); + } + + /** + * Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(String name, BinaryData resource, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(name, resource, requestOptions); + } + + /** + * Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.postWithResponseAsync(name, requestOptions); + } + + /** + * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateLro(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.beginCreateLroAsync(name, resource, requestOptions); + } + + /** + * Resource read operation template. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String name) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent. + * + * @param name The name parameter. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(String name, Resource resource) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(name, BinaryData.fromObject(resource), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono post(String name) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postWithResponse(name, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)); + } + + /** + * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. + * + * @param name The name parameter. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateLro(String name, Resource resource) { + // Generated convenience method for beginCreateLroWithModel + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + return serviceClient.beginCreateLroWithModelAsync(name, resourceInBinaryData, requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersClient.java new file mode 100644 index 00000000000..a048aae27d6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/RepeatabilityHeadersClient.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.SyncPoller; +import tsptest.specialheaders.implementation.JsonMergePatchHelper; +import tsptest.specialheaders.implementation.RepeatabilityHeadersImpl; +import tsptest.specialheaders.models.Resource; + +/** + * Initializes a new instance of the synchronous SpecialHeadersClient type. + */ +@ServiceClient(builder = SpecialHeadersClientBuilder.class) +public final class RepeatabilityHeadersClient { + @Generated + private final RepeatabilityHeadersImpl serviceClient; + + /** + * Initializes an instance of RepeatabilityHeadersClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RepeatabilityHeadersClient(RepeatabilityHeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Resource read operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(name, requestOptions); + } + + /** + * Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(String name, BinaryData resource, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(name, resource, requestOptions); + } + + /** + * Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse(String name, RequestOptions requestOptions) { + return this.serviceClient.postWithResponse(name, requestOptions); + } + + /** + * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateLro(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.beginCreateLro(name, resource, requestOptions); + } + + /** + * Resource read operation template. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource get(String name) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(name, requestOptions).getValue().toObject(Resource.class); + } + + /** + * Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent. + * + * @param name The name parameter. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource put(String name, Resource resource) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(name, BinaryData.fromObject(resource), requestOptions).getValue() + .toObject(Resource.class); + } + + /** + * Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Resource post(String name) { + // Generated convenience method for postWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postWithResponse(name, requestOptions).getValue().toObject(Resource.class); + } + + /** + * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. + * + * @param name The name parameter. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateLro(String name, Resource resource) { + // Generated convenience method for beginCreateLroWithModel + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + return serviceClient.beginCreateLroWithModel(name, resourceInBinaryData, requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersAsyncClient.java new file mode 100644 index 00000000000..651aa833745 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersAsyncClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.specialheaders.implementation.SkipSpecialHeadersImpl; + +/** + * Initializes a new instance of the asynchronous SpecialHeadersClient type. + */ +@ServiceClient(builder = SpecialHeadersClientBuilder.class, isAsync = true) +public final class SkipSpecialHeadersAsyncClient { + @Generated + private final SkipSpecialHeadersImpl serviceClient; + + /** + * Initializes an instance of SkipSpecialHeadersAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SkipSpecialHeadersAsyncClient(SkipSpecialHeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * skip special headers. + * + * @param name The name parameter. + * @param foo The foo parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithSpecialHeadersWithResponse(String name, String foo, + RequestOptions requestOptions) { + return this.serviceClient.deleteWithSpecialHeadersWithResponseAsync(name, foo, requestOptions); + } + + /** + * skip special headers. + * + * @param name The name parameter. + * @param foo The foo parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteWithSpecialHeaders(String name, String foo) { + // Generated convenience method for deleteWithSpecialHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteWithSpecialHeadersWithResponse(name, foo, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersClient.java new file mode 100644 index 00000000000..abc06cb3c5a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SkipSpecialHeadersClient.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import tsptest.specialheaders.implementation.SkipSpecialHeadersImpl; + +/** + * Initializes a new instance of the synchronous SpecialHeadersClient type. + */ +@ServiceClient(builder = SpecialHeadersClientBuilder.class) +public final class SkipSpecialHeadersClient { + @Generated + private final SkipSpecialHeadersImpl serviceClient; + + /** + * Initializes an instance of SkipSpecialHeadersClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SkipSpecialHeadersClient(SkipSpecialHeadersImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * skip special headers. + * + * @param name The name parameter. + * @param foo The foo parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithSpecialHeadersWithResponse(String name, String foo, RequestOptions requestOptions) { + return this.serviceClient.deleteWithSpecialHeadersWithResponse(name, foo, requestOptions); + } + + /** + * skip special headers. + * + * @param name The name parameter. + * @param foo The foo parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteWithSpecialHeaders(String name, String foo) { + // Generated convenience method for deleteWithSpecialHeadersWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteWithSpecialHeadersWithResponse(name, foo, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersClientBuilder.java new file mode 100644 index 00000000000..2ff09e435ba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersClientBuilder.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.specialheaders.implementation.SpecialHeadersClientImpl; + +/** + * A builder for creating a new instance of the SpecialHeadersClient type. + */ +@ServiceClientBuilder( + serviceClients = { + RepeatabilityHeadersClient.class, + EtagHeadersClient.class, + EtagHeadersOptionalBodyClient.class, + SkipSpecialHeadersClient.class, + RepeatabilityHeadersAsyncClient.class, + EtagHeadersAsyncClient.class, + EtagHeadersOptionalBodyAsyncClient.class, + SkipSpecialHeadersAsyncClient.class }) +public final class SpecialHeadersClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-specialheaders.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the SpecialHeadersClientBuilder. + */ + @Generated + public SpecialHeadersClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialHeadersClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialHeadersClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialHeadersClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialHeadersClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialHeadersClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialHeadersClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialHeadersClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SpecialHeadersClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private SpecialHeadersServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the SpecialHeadersClientBuilder. + */ + @Generated + public SpecialHeadersClientBuilder serviceVersion(SpecialHeadersServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the SpecialHeadersClientBuilder. + */ + @Generated + public SpecialHeadersClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of SpecialHeadersClientImpl with the provided parameters. + * + * @return an instance of SpecialHeadersClientImpl. + */ + @Generated + private SpecialHeadersClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + SpecialHeadersServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : SpecialHeadersServiceVersion.getLatest(); + SpecialHeadersClientImpl client = new SpecialHeadersClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy("client-request-id")); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of RepeatabilityHeadersAsyncClient class. + * + * @return an instance of RepeatabilityHeadersAsyncClient. + */ + @Generated + public RepeatabilityHeadersAsyncClient buildRepeatabilityHeadersAsyncClient() { + return new RepeatabilityHeadersAsyncClient(buildInnerClient().getRepeatabilityHeaders()); + } + + /** + * Builds an instance of EtagHeadersAsyncClient class. + * + * @return an instance of EtagHeadersAsyncClient. + */ + @Generated + public EtagHeadersAsyncClient buildEtagHeadersAsyncClient() { + return new EtagHeadersAsyncClient(buildInnerClient().getEtagHeaders()); + } + + /** + * Builds an instance of EtagHeadersOptionalBodyAsyncClient class. + * + * @return an instance of EtagHeadersOptionalBodyAsyncClient. + */ + @Generated + public EtagHeadersOptionalBodyAsyncClient buildEtagHeadersOptionalBodyAsyncClient() { + return new EtagHeadersOptionalBodyAsyncClient(buildInnerClient().getEtagHeadersOptionalBodies()); + } + + /** + * Builds an instance of SkipSpecialHeadersAsyncClient class. + * + * @return an instance of SkipSpecialHeadersAsyncClient. + */ + @Generated + public SkipSpecialHeadersAsyncClient buildSkipSpecialHeadersAsyncClient() { + return new SkipSpecialHeadersAsyncClient(buildInnerClient().getSkipSpecialHeaders()); + } + + /** + * Builds an instance of RepeatabilityHeadersClient class. + * + * @return an instance of RepeatabilityHeadersClient. + */ + @Generated + public RepeatabilityHeadersClient buildRepeatabilityHeadersClient() { + return new RepeatabilityHeadersClient(buildInnerClient().getRepeatabilityHeaders()); + } + + /** + * Builds an instance of EtagHeadersClient class. + * + * @return an instance of EtagHeadersClient. + */ + @Generated + public EtagHeadersClient buildEtagHeadersClient() { + return new EtagHeadersClient(buildInnerClient().getEtagHeaders()); + } + + /** + * Builds an instance of EtagHeadersOptionalBodyClient class. + * + * @return an instance of EtagHeadersOptionalBodyClient. + */ + @Generated + public EtagHeadersOptionalBodyClient buildEtagHeadersOptionalBodyClient() { + return new EtagHeadersOptionalBodyClient(buildInnerClient().getEtagHeadersOptionalBodies()); + } + + /** + * Builds an instance of SkipSpecialHeadersClient class. + * + * @return an instance of SkipSpecialHeadersClient. + */ + @Generated + public SkipSpecialHeadersClient buildSkipSpecialHeadersClient() { + return new SkipSpecialHeadersClient(buildInnerClient().getSkipSpecialHeaders()); + } + + private static final ClientLogger LOGGER = new ClientLogger(SpecialHeadersClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersServiceVersion.java new file mode 100644 index 00000000000..d17a9bfd3a2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/SpecialHeadersServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of SpecialHeadersClient. + */ +public enum SpecialHeadersServiceVersion implements ServiceVersion { + /** + * Enum value 2022-06-01-preview. + */ + V2022_06_01_PREVIEW("2022-06-01-preview"); + + private final String version; + + SpecialHeadersServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link SpecialHeadersServiceVersion}. + */ + public static SpecialHeadersServiceVersion getLatest() { + return V2022_06_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java new file mode 100644 index 00000000000..813a1223c10 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java @@ -0,0 +1,615 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +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.RequestOptions; +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; +import tsptest.specialheaders.SpecialHeadersServiceVersion; + +/** + * An instance of this class provides access to all the operations defined in EtagHeaders. + */ +public final class EtagHeadersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EtagHeadersService service; + + /** + * The service client containing this operation class. + */ + private final SpecialHeadersClientImpl client; + + /** + * Initializes an instance of EtagHeadersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EtagHeadersImpl(SpecialHeadersClientImpl client) { + this.service + = RestProxy.create(EtagHeadersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public SpecialHeadersServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for SpecialHeadersClientEtagHeaders to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SpecialHeadersClientEtagHeaders") + public interface EtagHeadersService { + @Put("/etag-headers/resources/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putWithRequestHeaders(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Put("/etag-headers/resources/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putWithRequestHeadersSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Patch("/etag-headers/resources/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchWithMatchHeaders(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Patch("/etag-headers/resources/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchWithMatchHeadersSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Get("/etag-headers/resources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listWithEtag(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/etag-headers/resources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listWithEtagSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listWithEtagNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listWithEtagNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Create or replace operation template. + *

Header Parameters

+ * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the + * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity + * was modified after this time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithRequestHeadersWithResponseAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.putWithRequestHeaders(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, + context)); + } + + /** + * Create or replace operation template. + *

Header Parameters

+ * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the + * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity + * was modified after this time.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithRequestHeadersWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putWithRequestHeadersSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, + Context.NONE); + } + + /** + * Create or update operation template. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchWithMatchHeadersWithResponseAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.patchWithMatchHeaders(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, + context)); + } + + /** + * Create or update operation template. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchWithMatchHeadersWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.patchWithMatchHeadersSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, + Context.NONE); + } + + /** + * Resource list operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithEtagSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listWithEtag(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Resource list operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listWithEtagAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listWithEtagSinglePageAsync(requestOptions), + nextLink -> listWithEtagNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Resource list operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listWithEtagSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listWithEtagSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Resource list operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listWithEtag(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listWithEtagSinglePage(requestOptions), + nextLink -> listWithEtagNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithEtagNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listWithEtagNext(nextLink, this.client.getEndpoint(), 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
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listWithEtagNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listWithEtagNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java new file mode 100644 index 00000000000..479f4d90c6b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; +import tsptest.specialheaders.SpecialHeadersServiceVersion; + +/** + * An instance of this class provides access to all the operations defined in EtagHeadersOptionalBodies. + */ +public final class EtagHeadersOptionalBodiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EtagHeadersOptionalBodiesService service; + + /** + * The service client containing this operation class. + */ + private final SpecialHeadersClientImpl client; + + /** + * Initializes an instance of EtagHeadersOptionalBodiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EtagHeadersOptionalBodiesImpl(SpecialHeadersClientImpl client) { + this.service = RestProxy.create(EtagHeadersOptionalBodiesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public SpecialHeadersServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for SpecialHeadersClientEtagHeadersOptionalBodies to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SpecialHeadersClientEtagHeadersOptionalBodies") + public interface EtagHeadersOptionalBodiesService { + @Put("/etag-headers-optional-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putWithOptionalBody(@HostParam("endpoint") String endpoint, + @QueryParam("format") String format, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Put("/etag-headers-optional-body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putWithOptionalBodySync(@HostParam("endpoint") String endpoint, + @QueryParam("format") String format, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * etag headers among other optional query/header/body parameters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the + * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity + * was modified after this time.
timestampOffsetDateTimeNoThe timestamp parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param format The format parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithOptionalBodyWithResponseAsync(String format, + RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); + } + }); + return FluxUtil.withContext(context -> service.putWithOptionalBody(this.client.getEndpoint(), format, accept, + requestOptionsLocal, context)); + } + + /** + * etag headers among other optional query/header/body parameters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Header Parameters

+ * + * + * + * + * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
If-MatchStringNoThe request should only proceed if an entity matches this + * string.
If-None-MatchStringNoThe request should only proceed if no entity matches this + * string.
If-Unmodified-SinceOffsetDateTimeNoThe request should only proceed if the + * entity was not modified after this time.
If-Modified-SinceOffsetDateTimeNoThe request should only proceed if the entity + * was modified after this time.
timestampOffsetDateTimeNoThe timestamp parameter
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param format The format parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithOptionalBodyWithResponse(String format, RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); + } + }); + return service.putWithOptionalBodySync(this.client.getEndpoint(), format, accept, requestOptionsLocal, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/JsonMergePatchHelper.java new file mode 100644 index 00000000000..554bd061af4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/JsonMergePatchHelper.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.implementation; + +import tsptest.specialheaders.models.Resource; + +/** + * This is the Helper class to enable json merge patch serialization for a model. + */ +public class JsonMergePatchHelper { + private static ResourceAccessor resourceAccessor; + + public interface ResourceAccessor { + Resource prepareModelForJsonMergePatch(Resource resource, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(Resource resource); + } + + public static void setResourceAccessor(ResourceAccessor accessor) { + resourceAccessor = accessor; + } + + public static ResourceAccessor getResourceAccessor() { + return resourceAccessor; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/OperationLocationPollingStrategy.java new file mode 100644 index 00000000000..83d1a833156 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/OperationLocationPollingStrategy.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.OperationResourcePollingStrategy; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +/** + * Implements an operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public Mono> onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + final Mono> pollResponseMono + = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) + .onErrorResume(exception -> { + LOGGER.info("Failed to parse initial response."); + return Mono.empty(); + }) + .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); + return pollResponseMono.switchIfEmpty( + Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); + } else { + return Mono + .error( + new AzureException(String.format( + "Operation failed or cancelled with status code %d," + + ", '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + } + + /** + * {@inheritDoc} + */ + @Override + public Mono getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + return Mono.error(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + return Mono.error(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + return PollingUtils + .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) + .flatMap(value -> { + if (value.get(propertyName) != null) { + return BinaryData.fromObjectAsync(value.get(propertyName)) + .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); + } else { + return Mono.error(new AzureException("Cannot get final result")); + } + }) + .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/PollingUtils.java new file mode 100644 index 00000000000..d9fbcb3ab95 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/PollingUtils.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.implementation; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.net.URI; +import java.net.URISyntaxException; +import java.time.DateTimeException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +final class PollingUtils { + + public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE + = new TypeReference>() { + }; + + public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); + + public static final String HTTP_METHOD = "httpMethod"; + public static final String REQUEST_URL = "requestURL"; + public static final String POLL_RESPONSE_BODY = "pollResponseBody"; + + private static final String FORWARD_SLASH = "/"; + + public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { + try { + URI uri = new URI(path); + if (!uri.isAbsolute()) { + if (CoreUtils.isNullOrEmpty(endpoint)) { + throw logger.logExceptionAsError(new IllegalArgumentException( + "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); + } + + if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { + return endpoint + path.substring(1); + } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { + return endpoint + FORWARD_SLASH + path; + } else { + return endpoint + path; + } + } + } catch (URISyntaxException ex) { + throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); + } + return path; + } + + public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + T value; + if (binaryData == null) { + value = null; + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); + } else { + value = binaryData.toObject(typeReference, serializer); + } + return value; + } + + @SuppressWarnings("unchecked") + public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + Mono value; + if (binaryData == null) { + value = Mono.empty(); + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = (Mono) binaryData.toReplayableBinaryDataAsync(); + } else { + value = binaryData.toObjectAsync(typeReference, serializer); + } + return value; + } + + private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); + private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); + + public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { + // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. + Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. + retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then + // attempt to resolve it as an HTTP date (RFC1123). + retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, + headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); + + // Either the retry delay will have been found or it'll be null, null indicates no retry after. + return retryDelay; + } + + private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, + Function delayParser) { + String headerValue = headers.getValue(headerName); + + return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); + } + + private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { + long delaySeconds; + try { + OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); + + delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); + } catch (DateTimeException ex) { + delaySeconds = tryParseLong(value); + } + + return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; + } + + private static long tryParseLong(String value) { + try { + return Long.parseLong(value); + } catch (NumberFormatException ex) { + return -1; + } + } + + private static Duration tryGetDelayMillis(String value) { + long delayMillis = tryParseLong(value); + return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/RepeatabilityHeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/RepeatabilityHeadersImpl.java new file mode 100644 index 00000000000..26bfa81465b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/RepeatabilityHeadersImpl.java @@ -0,0 +1,864 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +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.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; +import tsptest.specialheaders.SpecialHeadersServiceVersion; +import tsptest.specialheaders.models.Resource; + +/** + * An instance of this class provides access to all the operations defined in RepeatabilityHeaders. + */ +public final class RepeatabilityHeadersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RepeatabilityHeadersService service; + + /** + * The service client containing this operation class. + */ + private final SpecialHeadersClientImpl client; + + /** + * Initializes an instance of RepeatabilityHeadersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RepeatabilityHeadersImpl(SpecialHeadersClientImpl client) { + this.service = RestProxy.create(RepeatabilityHeadersService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public SpecialHeadersServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for SpecialHeadersClientRepeatabilityHeaders to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SpecialHeadersClientRepeatabilityHeaders") + public interface RepeatabilityHeadersService { + @Get("/repeatability-headers/resources/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/repeatability-headers/resources/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/repeatability-headers/resources/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Put("/repeatability-headers/resources/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Post("/repeatability-headers/resources/{name}:post") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> post(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/repeatability-headers/resources/{name}:post") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Patch("/repeatability-headers/resources/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createLro(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Patch("/repeatability-headers/resources/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createLroSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + } + + /** + * Resource read operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context)); + } + + /** + * Resource read operation template. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, + requestOptions, Context.NONE); + } + + /** + * Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + name, contentType, accept, resource, requestOptionsLocal, context)); + } + + /** + * Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(String name, BinaryData resource, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return service.putSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, + contentType, accept, resource, requestOptionsLocal, Context.NONE); + } + + /** + * Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return FluxUtil.withContext(context -> service.post(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, accept, requestOptionsLocal, context)); + } + + /** + * Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return service.postSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, + requestOptionsLocal, Context.NONE); + } + + /** + * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createLroWithResponseAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return FluxUtil.withContext( + context -> service.createLro(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, + contentType, accept, resource, requestOptionsLocal, context)); + } + + /** + * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createLroWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return service.createLroSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, + contentType, accept, resource, requestOptionsLocal, Context.NONE); + } + + /** + * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateLroWithModelAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.createLroWithResponseAsync(name, resource, requestOptions), + new tsptest.specialheaders.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Resource.class)); + } + + /** + * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateLroWithModel(String name, BinaryData resource, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.createLroWithResponse(name, resource, requestOptions), + new tsptest.specialheaders.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Resource.class)); + } + + /** + * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateLroAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.createLroWithResponseAsync(name, resource, requestOptions), + new tsptest.specialheaders.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     description: String (Optional)
+     *     type: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateLro(String name, BinaryData resource, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.createLroWithResponse(name, resource, requestOptions), + new tsptest.specialheaders.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SkipSpecialHeadersImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SkipSpecialHeadersImpl.java new file mode 100644 index 00000000000..eeb8e738323 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SkipSpecialHeadersImpl.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.specialheaders.SpecialHeadersServiceVersion; + +/** + * An instance of this class provides access to all the operations defined in SkipSpecialHeaders. + */ +public final class SkipSpecialHeadersImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SkipSpecialHeadersService service; + + /** + * The service client containing this operation class. + */ + private final SpecialHeadersClientImpl client; + + /** + * Initializes an instance of SkipSpecialHeadersImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SkipSpecialHeadersImpl(SpecialHeadersClientImpl client) { + this.service = RestProxy.create(SkipSpecialHeadersService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public SpecialHeadersServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for SpecialHeadersClientSkipSpecialHeaders to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SpecialHeadersClientSkipSpecialHeaders") + public interface SkipSpecialHeadersService { + @Delete("/skip-special-headers/resources/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteWithSpecialHeaders(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("foo") String foo, RequestOptions requestOptions, Context context); + + @Delete("/skip-special-headers/resources/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteWithSpecialHeadersSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("foo") String foo, RequestOptions requestOptions, Context context); + } + + /** + * skip special headers. + * + * @param name The name parameter. + * @param foo The foo parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithSpecialHeadersWithResponseAsync(String name, String foo, + RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.deleteWithSpecialHeaders(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, foo, requestOptions, context)); + } + + /** + * skip special headers. + * + * @param name The name parameter. + * @param foo The foo parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithSpecialHeadersWithResponse(String name, String foo, RequestOptions requestOptions) { + return service.deleteWithSpecialHeadersSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, foo, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SpecialHeadersClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SpecialHeadersClientImpl.java new file mode 100644 index 00000000000..751531b9dab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SpecialHeadersClientImpl.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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; +import tsptest.specialheaders.SpecialHeadersServiceVersion; + +/** + * Initializes a new instance of the SpecialHeadersClient type. + */ +public final class SpecialHeadersClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final SpecialHeadersServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public SpecialHeadersServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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 RepeatabilityHeadersImpl object to access its operations. + */ + private final RepeatabilityHeadersImpl repeatabilityHeaders; + + /** + * Gets the RepeatabilityHeadersImpl object to access its operations. + * + * @return the RepeatabilityHeadersImpl object. + */ + public RepeatabilityHeadersImpl getRepeatabilityHeaders() { + return this.repeatabilityHeaders; + } + + /** + * The EtagHeadersImpl object to access its operations. + */ + private final EtagHeadersImpl etagHeaders; + + /** + * Gets the EtagHeadersImpl object to access its operations. + * + * @return the EtagHeadersImpl object. + */ + public EtagHeadersImpl getEtagHeaders() { + return this.etagHeaders; + } + + /** + * The EtagHeadersOptionalBodiesImpl object to access its operations. + */ + private final EtagHeadersOptionalBodiesImpl etagHeadersOptionalBodies; + + /** + * Gets the EtagHeadersOptionalBodiesImpl object to access its operations. + * + * @return the EtagHeadersOptionalBodiesImpl object. + */ + public EtagHeadersOptionalBodiesImpl getEtagHeadersOptionalBodies() { + return this.etagHeadersOptionalBodies; + } + + /** + * The SkipSpecialHeadersImpl object to access its operations. + */ + private final SkipSpecialHeadersImpl skipSpecialHeaders; + + /** + * Gets the SkipSpecialHeadersImpl object to access its operations. + * + * @return the SkipSpecialHeadersImpl object. + */ + public SkipSpecialHeadersImpl getSkipSpecialHeaders() { + return this.skipSpecialHeaders; + } + + /** + * Initializes an instance of SpecialHeadersClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public SpecialHeadersClientImpl(String endpoint, SpecialHeadersServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of SpecialHeadersClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public SpecialHeadersClientImpl(HttpPipeline httpPipeline, String endpoint, + SpecialHeadersServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of SpecialHeadersClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public SpecialHeadersClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + SpecialHeadersServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.repeatabilityHeaders = new RepeatabilityHeadersImpl(this); + this.etagHeaders = new EtagHeadersImpl(this); + this.etagHeadersOptionalBodies = new EtagHeadersOptionalBodiesImpl(this); + this.skipSpecialHeaders = new SkipSpecialHeadersImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SyncOperationLocationPollingStrategy.java new file mode 100644 index 00000000000..0dafd8fee5f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/SyncOperationLocationPollingStrategy.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.io.UncheckedIOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Map; + +// DO NOT modify this helper class + +/** + * Implements a synchronous operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public PollResponse onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + T initialResponseType = null; + try { + initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, + pollResponseType); + } catch (UncheckedIOException e) { + LOGGER.info("Failed to parse initial response."); + } + return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); + } + + throw LOGGER.logExceptionAsError(new AzureException( + String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + + /** + * {@inheritDoc} + */ + public U getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, + PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); + if (pollResult != null && pollResult.get(propertyName) != null) { + return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), + serializer, resultType); + } else { + throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); + } + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/package-info.java new file mode 100644 index 00000000000..72aeaded497 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for SpecialHeaders. + * + */ +package tsptest.specialheaders.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/Resource.java new file mode 100644 index 00000000000..933c4aae0eb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/Resource.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import tsptest.specialheaders.implementation.JsonMergePatchHelper; + +/** + * The Resource model. + */ +@Fluent +public final class Resource implements JsonSerializable { + /* + * The id property. + */ + @Generated + private String id; + + /* + * The name property. + */ + @Generated + private String name; + + /* + * The description property. + */ + @Generated + private String description; + + /* + * The type property. + */ + @Generated + private String type; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setResourceAccessor(new JsonMergePatchHelper.ResourceAccessor() { + @Override + public Resource prepareModelForJsonMergePatch(Resource model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(Resource model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of Resource class. + */ + @Generated + public Resource() { + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the description property: The description property. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description property. + * + * @param description the description value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * Set the type property: The type property. + *

Required when create the resource.

+ * + * @param type the type value to set. + * @return the Resource object itself. + */ + @Generated + public Resource setType(String type) { + this.type = type; + this.updatedProperties.add("type"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + if (updatedProperties.contains("type")) { + if (this.type == null) { + jsonWriter.writeNullField("type"); + } else { + jsonWriter.writeStringField("type", this.type); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Resource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Resource. + */ + @Generated + public static Resource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Resource deserializedResource = new Resource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedResource.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedResource.name = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedResource.description = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedResource.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResource; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/package-info.java new file mode 100644 index 00000000000..d0a3aa1e28f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for SpecialHeaders. + * + */ +package tsptest.specialheaders.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/package-info.java new file mode 100644 index 00000000000..f8e885b218a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/specialheaders/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for SpecialHeaders. + * + */ +package tsptest.specialheaders; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassAsyncClient.java new file mode 100644 index 00000000000..b1dde9b3e0b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassAsyncClient.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.subclass.implementation.SubclassImpl; +import tsptest.subclass.models.Body; + +/** + * Initializes a new instance of the asynchronous SubclassClient type. + */ +@ServiceClient(builder = SubclassClientBuilder.class, isAsync = true) +public final class SubclassAsyncClient { + @Generated + private final SubclassImpl serviceClient; + + /** + * Initializes an instance of SubclassAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SubclassAsyncClient(SubclassImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The propertyInSubclass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> propertyInSubclassWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.propertyInSubclassWithResponseAsync(body, requestOptions); + } + + /** + * The propertyInSubclass operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono propertyInSubclass(Body body) { + // Generated convenience method for propertyInSubclassWithResponse + RequestOptions requestOptions = new RequestOptions(); + return propertyInSubclassWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Body.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClient.java new file mode 100644 index 00000000000..775c7673366 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClient.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.subclass.implementation.SubclassImpl; +import tsptest.subclass.models.Body; + +/** + * Initializes a new instance of the synchronous SubclassClient type. + */ +@ServiceClient(builder = SubclassClientBuilder.class) +public final class SubclassClient { + @Generated + private final SubclassImpl serviceClient; + + /** + * Initializes an instance of SubclassClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SubclassClient(SubclassImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The propertyInSubclass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response propertyInSubclassWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.propertyInSubclassWithResponse(body, requestOptions); + } + + /** + * The propertyInSubclass operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Body propertyInSubclass(Body body) { + // Generated convenience method for propertyInSubclassWithResponse + RequestOptions requestOptions = new RequestOptions(); + return propertyInSubclassWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(Body.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClientBuilder.java new file mode 100644 index 00000000000..13b233af8fc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/SubclassClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.subclass.implementation.SubclassClientImpl; + +/** + * A builder for creating a new instance of the SubclassClient type. + */ +@ServiceClientBuilder(serviceClients = { SubclassClient.class, SubclassAsyncClient.class }) +public final class SubclassClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-subclass.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the SubclassClientBuilder. + */ + @Generated + public SubclassClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SubclassClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the SubclassClientBuilder. + */ + @Generated + public SubclassClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of SubclassClientImpl with the provided parameters. + * + * @return an instance of SubclassClientImpl. + */ + @Generated + private SubclassClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + SubclassClientImpl client + = new SubclassClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of SubclassAsyncClient class. + * + * @return an instance of SubclassAsyncClient. + */ + @Generated + public SubclassAsyncClient buildAsyncClient() { + return new SubclassAsyncClient(buildInnerClient().getSubclass()); + } + + /** + * Builds an instance of SubclassClient class. + * + * @return an instance of SubclassClient. + */ + @Generated + public SubclassClient buildClient() { + return new SubclassClient(buildInnerClient().getSubclass()); + } + + private static final ClientLogger LOGGER = new ClientLogger(SubclassClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassClientImpl.java new file mode 100644 index 00000000000..5566742f36e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 SubclassClient type. + */ +public final class SubclassClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 SubclassImpl object to access its operations. + */ + private final SubclassImpl subclass; + + /** + * Gets the SubclassImpl object to access its operations. + * + * @return the SubclassImpl object. + */ + public SubclassImpl getSubclass() { + return this.subclass; + } + + /** + * Initializes an instance of SubclassClient client. + * + * @param endpoint Service host. + */ + public SubclassClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SubclassClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public SubclassClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SubclassClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public SubclassClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.subclass = new SubclassImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassImpl.java new file mode 100644 index 00000000000..92a552910a3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/SubclassImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Subclass. + */ +public final class SubclassImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SubclassService service; + + /** + * The service client containing this operation class. + */ + private final SubclassClientImpl client; + + /** + * Initializes an instance of SubclassImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SubclassImpl(SubclassClientImpl client) { + this.service = RestProxy.create(SubclassService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SubclassClientSubclass to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SubclassClientSubclass") + public interface SubclassService { + @Post("/subclass/property-in-subclass") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> propertyInSubclass(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/subclass/property-in-subclass") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response propertyInSubclassSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The propertyInSubclass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> propertyInSubclassWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.propertyInSubclass(this.client.getEndpoint(), contentType, + accept, body, requestOptions, context)); + } + + /** + * The propertyInSubclass operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     duplicateRequiredProperty (Optional): {
+     *         property: String (Required)
+     *         duplicateRequiredProperty: String (Required)
+     *     }
+     *     propertyChangedToRequired (Optional): {
+     *         propertyChangedToRequired: String (Required)
+     *     }
+     *     propertyChangedToConstant (Optional): {
+     *         propertyChangedToConstant: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response propertyInSubclassWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.propertyInSubclassSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/package-info.java new file mode 100644 index 00000000000..4cc0977cd8d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Subclass. + * + */ +package tsptest.subclass.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/Body.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/Body.java new file mode 100644 index 00000000000..432ee35a8b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/Body.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Body model. + */ +@Fluent +public final class Body implements JsonSerializable { + /* + * The duplicateRequiredProperty property. + */ + @Generated + private DuplicateRequiredProperty duplicateRequiredProperty; + + /* + * The propertyChangedToRequired property. + */ + @Generated + private PropertyChangedToRequired propertyChangedToRequired; + + /* + * The propertyChangedToConstant property. + */ + @Generated + private PropertyChangedToConstant propertyChangedToConstant; + + /** + * Creates an instance of Body class. + */ + @Generated + public Body() { + } + + /** + * Get the duplicateRequiredProperty property: The duplicateRequiredProperty property. + * + * @return the duplicateRequiredProperty value. + */ + @Generated + public DuplicateRequiredProperty getDuplicateRequiredProperty() { + return this.duplicateRequiredProperty; + } + + /** + * Set the duplicateRequiredProperty property: The duplicateRequiredProperty property. + * + * @param duplicateRequiredProperty the duplicateRequiredProperty value to set. + * @return the Body object itself. + */ + @Generated + public Body setDuplicateRequiredProperty(DuplicateRequiredProperty duplicateRequiredProperty) { + this.duplicateRequiredProperty = duplicateRequiredProperty; + return this; + } + + /** + * Get the propertyChangedToRequired property: The propertyChangedToRequired property. + * + * @return the propertyChangedToRequired value. + */ + @Generated + public PropertyChangedToRequired getPropertyChangedToRequired() { + return this.propertyChangedToRequired; + } + + /** + * Set the propertyChangedToRequired property: The propertyChangedToRequired property. + * + * @param propertyChangedToRequired the propertyChangedToRequired value to set. + * @return the Body object itself. + */ + @Generated + public Body setPropertyChangedToRequired(PropertyChangedToRequired propertyChangedToRequired) { + this.propertyChangedToRequired = propertyChangedToRequired; + return this; + } + + /** + * Get the propertyChangedToConstant property: The propertyChangedToConstant property. + * + * @return the propertyChangedToConstant value. + */ + @Generated + public PropertyChangedToConstant getPropertyChangedToConstant() { + return this.propertyChangedToConstant; + } + + /** + * Set the propertyChangedToConstant property: The propertyChangedToConstant property. + * + * @param propertyChangedToConstant the propertyChangedToConstant value to set. + * @return the Body object itself. + */ + @Generated + public Body setPropertyChangedToConstant(PropertyChangedToConstant propertyChangedToConstant) { + this.propertyChangedToConstant = propertyChangedToConstant; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("duplicateRequiredProperty", this.duplicateRequiredProperty); + jsonWriter.writeJsonField("propertyChangedToRequired", this.propertyChangedToRequired); + jsonWriter.writeJsonField("propertyChangedToConstant", this.propertyChangedToConstant); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Body from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Body if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Body. + */ + @Generated + public static Body fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Body deserializedBody = new Body(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("duplicateRequiredProperty".equals(fieldName)) { + deserializedBody.duplicateRequiredProperty = DuplicateRequiredProperty.fromJson(reader); + } else if ("propertyChangedToRequired".equals(fieldName)) { + deserializedBody.propertyChangedToRequired = PropertyChangedToRequired.fromJson(reader); + } else if ("propertyChangedToConstant".equals(fieldName)) { + deserializedBody.propertyChangedToConstant = PropertyChangedToConstant.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBody; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredProperty.java new file mode 100644 index 00000000000..04441739536 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredProperty.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The DuplicateRequiredProperty model. + */ +@Immutable +public final class DuplicateRequiredProperty extends DuplicateRequiredPropertyParent { + /* + * The duplicateRequiredProperty property. + */ + @Generated + private final String newRequiredProperty; + + /** + * Creates an instance of DuplicateRequiredProperty class. + * + * @param requiredProperty the requiredProperty value to set. + * @param newRequiredProperty the newRequiredProperty value to set. + */ + @Generated + public DuplicateRequiredProperty(String requiredProperty, String newRequiredProperty) { + super(requiredProperty, newRequiredProperty); + this.newRequiredProperty = newRequiredProperty; + } + + /** + * Get the newRequiredProperty property: The duplicateRequiredProperty property. + * + * @return the newRequiredProperty value. + */ + @Generated + public String getNewRequiredProperty() { + return this.newRequiredProperty; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", getRequiredProperty()); + jsonWriter.writeStringField("duplicateRequiredProperty", this.newRequiredProperty); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DuplicateRequiredProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DuplicateRequiredProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DuplicateRequiredProperty. + */ + @Generated + public static DuplicateRequiredProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String requiredProperty = null; + String newRequiredProperty = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + requiredProperty = reader.getString(); + } else if ("duplicateRequiredProperty".equals(fieldName)) { + newRequiredProperty = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new DuplicateRequiredProperty(requiredProperty, newRequiredProperty); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredPropertyParent.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredPropertyParent.java new file mode 100644 index 00000000000..14989bc2da6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/DuplicateRequiredPropertyParent.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The DuplicateRequiredPropertyParent model. + */ +@Immutable +public class DuplicateRequiredPropertyParent implements JsonSerializable { + /* + * The property property. + */ + @Generated + private final String requiredProperty; + + /* + * The duplicateRequiredProperty property. + */ + @Generated + private final String duplicateRequiredProperty; + + /** + * Creates an instance of DuplicateRequiredPropertyParent class. + * + * @param requiredProperty the requiredProperty value to set. + * @param duplicateRequiredProperty the duplicateRequiredProperty value to set. + */ + @Generated + public DuplicateRequiredPropertyParent(String requiredProperty, String duplicateRequiredProperty) { + this.requiredProperty = requiredProperty; + this.duplicateRequiredProperty = duplicateRequiredProperty; + } + + /** + * Get the requiredProperty property: The property property. + * + * @return the requiredProperty value. + */ + @Generated + public String getRequiredProperty() { + return this.requiredProperty; + } + + /** + * Get the duplicateRequiredProperty property: The duplicateRequiredProperty property. + * + * @return the duplicateRequiredProperty value. + */ + @Generated + public String getDuplicateRequiredProperty() { + return this.duplicateRequiredProperty; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.requiredProperty); + jsonWriter.writeStringField("duplicateRequiredProperty", this.duplicateRequiredProperty); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DuplicateRequiredPropertyParent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DuplicateRequiredPropertyParent if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DuplicateRequiredPropertyParent. + */ + @Generated + public static DuplicateRequiredPropertyParent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String requiredProperty = null; + String duplicateRequiredProperty = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + requiredProperty = reader.getString(); + } else if ("duplicateRequiredProperty".equals(fieldName)) { + duplicateRequiredProperty = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new DuplicateRequiredPropertyParent(requiredProperty, duplicateRequiredProperty); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstant.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstant.java new file mode 100644 index 00000000000..4112d8e0e6b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstant.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The PropertyChangedToConstant model. + */ +@Immutable +public final class PropertyChangedToConstant extends PropertyChangedToConstantParent { + /* + * The propertyChangedToConstant property. + */ + @Generated + private final String propertyChangedToConstant = "constantValue"; + + /** + * Creates an instance of PropertyChangedToConstant class. + */ + @Generated + public PropertyChangedToConstant() { + super("constantValue"); + } + + /** + * Get the propertyChangedToConstant property: The propertyChangedToConstant property. + * + * @return the propertyChangedToConstant value. + */ + @Generated + public String getPropertyChangedToConstant() { + return this.propertyChangedToConstant; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("propertyChangedToConstant", this.propertyChangedToConstant); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PropertyChangedToConstant from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PropertyChangedToConstant if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PropertyChangedToConstant. + */ + @Generated + public static PropertyChangedToConstant fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PropertyChangedToConstant deserializedPropertyChangedToConstant = new PropertyChangedToConstant(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedPropertyChangedToConstant; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstantParent.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstantParent.java new file mode 100644 index 00000000000..42ec9ff3a1c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToConstantParent.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The PropertyChangedToConstantParent model. + */ +@Immutable +public class PropertyChangedToConstantParent implements JsonSerializable { + /* + * The propertyChangedToConstant property. + */ + @Generated + private final String propertyChangedToConstant; + + /** + * Creates an instance of PropertyChangedToConstantParent class. + * + * @param propertyChangedToConstant the propertyChangedToConstant value to set. + */ + @Generated + public PropertyChangedToConstantParent(String propertyChangedToConstant) { + this.propertyChangedToConstant = propertyChangedToConstant; + } + + /** + * Get the propertyChangedToConstant property: The propertyChangedToConstant property. + * + * @return the propertyChangedToConstant value. + */ + @Generated + public String getPropertyChangedToConstant() { + return this.propertyChangedToConstant; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("propertyChangedToConstant", this.propertyChangedToConstant); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PropertyChangedToConstantParent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PropertyChangedToConstantParent if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PropertyChangedToConstantParent. + */ + @Generated + public static PropertyChangedToConstantParent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String propertyChangedToConstant = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("propertyChangedToConstant".equals(fieldName)) { + propertyChangedToConstant = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new PropertyChangedToConstantParent(propertyChangedToConstant); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequired.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequired.java new file mode 100644 index 00000000000..b71da97a6a5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequired.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The PropertyChangedToRequired model. + */ +@Fluent +public final class PropertyChangedToRequired extends PropertyChangedToRequiredParent { + /* + * The propertyChangedToRequired property. + */ + @Generated + private final String propertyChangedToRequired; + + /** + * Creates an instance of PropertyChangedToRequired class. + * + * @param propertyChangedToRequired the propertyChangedToRequired value to set. + */ + @Generated + public PropertyChangedToRequired(String propertyChangedToRequired) { + this.propertyChangedToRequired = propertyChangedToRequired; + } + + /** + * Get the propertyChangedToRequired property: The propertyChangedToRequired property. + * + * @return the propertyChangedToRequired value. + */ + @Generated + public String getPropertyChangedToRequired() { + return this.propertyChangedToRequired; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("propertyChangedToRequired", this.propertyChangedToRequired); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PropertyChangedToRequired from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PropertyChangedToRequired if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PropertyChangedToRequired. + */ + @Generated + public static PropertyChangedToRequired fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String propertyChangedToRequired = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("propertyChangedToRequired".equals(fieldName)) { + propertyChangedToRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new PropertyChangedToRequired(propertyChangedToRequired); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequiredParent.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequiredParent.java new file mode 100644 index 00000000000..2ab1511ea6a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/PropertyChangedToRequiredParent.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The PropertyChangedToRequiredParent model. + */ +@Fluent +public class PropertyChangedToRequiredParent implements JsonSerializable { + /* + * The propertyChangedToRequired property. + */ + @Generated + private String propertyChangedToRequired; + + /** + * Creates an instance of PropertyChangedToRequiredParent class. + */ + @Generated + public PropertyChangedToRequiredParent() { + } + + /** + * Get the propertyChangedToRequired property: The propertyChangedToRequired property. + * + * @return the propertyChangedToRequired value. + */ + @Generated + public String getPropertyChangedToRequired() { + return this.propertyChangedToRequired; + } + + /** + * Set the propertyChangedToRequired property: The propertyChangedToRequired property. + * + * @param propertyChangedToRequired the propertyChangedToRequired value to set. + * @return the PropertyChangedToRequiredParent object itself. + */ + @Generated + public PropertyChangedToRequiredParent setPropertyChangedToRequired(String propertyChangedToRequired) { + this.propertyChangedToRequired = propertyChangedToRequired; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("propertyChangedToRequired", this.propertyChangedToRequired); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PropertyChangedToRequiredParent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PropertyChangedToRequiredParent if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PropertyChangedToRequiredParent. + */ + @Generated + public static PropertyChangedToRequiredParent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PropertyChangedToRequiredParent deserializedPropertyChangedToRequiredParent + = new PropertyChangedToRequiredParent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("propertyChangedToRequired".equals(fieldName)) { + deserializedPropertyChangedToRequiredParent.propertyChangedToRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPropertyChangedToRequiredParent; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/package-info.java new file mode 100644 index 00000000000..a14fc553344 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Subclass. + * + */ +package tsptest.subclass.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/package-info.java new file mode 100644 index 00000000000..925d7ab7f03 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/subclass/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Subclass. + * + */ +package tsptest.subclass; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionAsyncClient.java new file mode 100644 index 00000000000..456d8a5bed5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionAsyncClient.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import reactor.core.publisher.Mono; +import tsptest.union.implementation.UnionFlattenOpsImpl; +import tsptest.union.implementation.models.SendLongRequest; +import tsptest.union.implementation.models.SendRequest; +import tsptest.union.models.Result; +import tsptest.union.models.SendLongOptions; +import tsptest.union.models.User; + +/** + * Initializes a new instance of the asynchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) +public final class UnionAsyncClient { + @Generated + private final UnionFlattenOpsImpl serviceClient; + + /** + * Initializes an instance of UnionAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionAsyncClient(UnionFlattenOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendRequest The sendRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(String id, BinaryData sendRequest, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(id, sendRequest, requestOptions); + } + + /** + * The sendLong operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: String (Required)
+     *     dataInt: int (Required)
+     *     dataUnion: BinaryData (Optional)
+     *     dataLong: Long (Optional)
+     *     data_float: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendLongRequest The sendLongRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendLongWithResponse(String id, BinaryData sendLongRequest, + RequestOptions requestOptions) { + return this.serviceClient.sendLongWithResponseAsync(id, sendLongRequest, requestOptions); + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
dataBinaryDataNoThe data parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * A long-running remote procedure call (RPC) operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         result (Optional): (recursive schema, see result above)
+     *         data: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginGenerate(RequestOptions requestOptions) { + return this.serviceClient.beginGenerateAsync(requestOptions); + } + + /** + * The send operation. + * + * @param id The id parameter. + * @param input The input parameter. + * @param user The user parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(String id, BinaryData input, User user) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest sendRequestObj = new SendRequest(input).setUser(user); + BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); + return sendWithResponse(id, sendRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The send operation. + * + * @param id The id parameter. + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(String id, BinaryData input) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest sendRequestObj = new SendRequest(input); + BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); + return sendWithResponse(id, sendRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The sendLong operation. + * + * @param options Options for sendLong API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono sendLong(SendLongOptions options) { + // Generated convenience method for sendLongWithResponse + RequestOptions requestOptions = new RequestOptions(); + String id = options.getId(); + String filter = options.getFilter(); + SendLongRequest sendLongRequestObj + = new SendLongRequest(options.getInput(), options.getDataInt()).setUser(options.getUser()) + .setDataUnion(options.getDataUnion()) + .setDataLong(options.getDataLong()) + .setDataFloat(options.getDataFloat()); + BinaryData sendLongRequest = BinaryData.fromObject(sendLongRequestObj); + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + return sendLongWithResponse(id, sendLongRequest, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The get operation. + * + * @param data The data parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(BinaryData data) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (data != null) { + requestOptions.addQueryParam("data", String.valueOf(data), false); + } + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * A long-running remote procedure call (RPC) operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginGenerate() { + // Generated convenience method for beginGenerateWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginGenerateWithModelAsync(requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClient.java new file mode 100644 index 00000000000..9b0be2464f1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClient.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.SyncPoller; +import tsptest.union.implementation.UnionFlattenOpsImpl; +import tsptest.union.implementation.models.SendLongRequest; +import tsptest.union.implementation.models.SendRequest; +import tsptest.union.models.Result; +import tsptest.union.models.SendLongOptions; +import tsptest.union.models.User; + +/** + * Initializes a new instance of the synchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class) +public final class UnionClient { + @Generated + private final UnionFlattenOpsImpl serviceClient; + + /** + * Initializes an instance of UnionClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionClient(UnionFlattenOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendRequest The sendRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(String id, BinaryData sendRequest, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(id, sendRequest, requestOptions); + } + + /** + * The sendLong operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: String (Required)
+     *     dataInt: int (Required)
+     *     dataUnion: BinaryData (Optional)
+     *     dataLong: Long (Optional)
+     *     data_float: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendLongRequest The sendLongRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendLongWithResponse(String id, BinaryData sendLongRequest, RequestOptions requestOptions) { + return this.serviceClient.sendLongWithResponse(id, sendLongRequest, requestOptions); + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
dataBinaryDataNoThe data parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * A long-running remote procedure call (RPC) operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         result (Optional): (recursive schema, see result above)
+     *         data: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginGenerate(RequestOptions requestOptions) { + return this.serviceClient.beginGenerate(requestOptions); + } + + /** + * The send operation. + * + * @param id The id parameter. + * @param input The input parameter. + * @param user The user parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(String id, BinaryData input, User user) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest sendRequestObj = new SendRequest(input).setUser(user); + BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); + sendWithResponse(id, sendRequest, requestOptions).getValue(); + } + + /** + * The send operation. + * + * @param id The id parameter. + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(String id, BinaryData input) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest sendRequestObj = new SendRequest(input); + BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); + sendWithResponse(id, sendRequest, requestOptions).getValue(); + } + + /** + * The sendLong operation. + * + * @param options Options for sendLong API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void sendLong(SendLongOptions options) { + // Generated convenience method for sendLongWithResponse + RequestOptions requestOptions = new RequestOptions(); + String id = options.getId(); + String filter = options.getFilter(); + SendLongRequest sendLongRequestObj + = new SendLongRequest(options.getInput(), options.getDataInt()).setUser(options.getUser()) + .setDataUnion(options.getDataUnion()) + .setDataLong(options.getDataLong()) + .setDataFloat(options.getDataFloat()); + BinaryData sendLongRequest = BinaryData.fromObject(sendLongRequestObj); + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + sendLongWithResponse(id, sendLongRequest, requestOptions).getValue(); + } + + /** + * The get operation. + * + * @param data The data parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void get(BinaryData data) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (data != null) { + requestOptions.addQueryParam("data", String.valueOf(data), false); + } + getWithResponse(requestOptions).getValue(); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + getWithResponse(requestOptions).getValue(); + } + + /** + * A long-running remote procedure call (RPC) operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginGenerate() { + // Generated convenience method for beginGenerateWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginGenerateWithModel(requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClientBuilder.java new file mode 100644 index 00000000000..43739b12928 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.union.implementation.UnionClientImpl; + +/** + * A builder for creating a new instance of the UnionClient type. + */ +@ServiceClientBuilder(serviceClients = { UnionClient.class, UnionAsyncClient.class }) +public final class UnionClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-union.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the UnionClientBuilder. + */ + @Generated + public UnionClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private UnionServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the UnionClientBuilder. + */ + @Generated + public UnionClientBuilder serviceVersion(UnionServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the UnionClientBuilder. + */ + @Generated + public UnionClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of UnionClientImpl with the provided parameters. + * + * @return an instance of UnionClientImpl. + */ + @Generated + private UnionClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + UnionServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : UnionServiceVersion.getLatest(); + UnionClientImpl client = new UnionClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of UnionAsyncClient class. + * + * @return an instance of UnionAsyncClient. + */ + @Generated + public UnionAsyncClient buildAsyncClient() { + return new UnionAsyncClient(buildInnerClient().getUnionFlattenOps()); + } + + /** + * Builds an instance of UnionClient class. + * + * @return an instance of UnionClient. + */ + @Generated + public UnionClient buildClient() { + return new UnionClient(buildInnerClient().getUnionFlattenOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(UnionClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionServiceVersion.java new file mode 100644 index 00000000000..66111bf216a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/UnionServiceVersion.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of UnionClient. + */ +public enum UnionServiceVersion implements ServiceVersion { + /** + * Enum value 2022-03-01-preview. + */ + V2022_03_01_PREVIEW("2022-03-01-preview"), + + /** + * Enum value 2022-06-01-preview. + */ + V2022_06_01_PREVIEW("2022-06-01-preview"); + + private final String version; + + UnionServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link UnionServiceVersion}. + */ + public static UnionServiceVersion getLatest() { + return V2022_06_01_PREVIEW; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/OperationLocationPollingStrategy.java new file mode 100644 index 00000000000..c67ac3e30fa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/OperationLocationPollingStrategy.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.OperationResourcePollingStrategy; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +/** + * Implements an operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public Mono> onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + final Mono> pollResponseMono + = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) + .onErrorResume(exception -> { + LOGGER.info("Failed to parse initial response."); + return Mono.empty(); + }) + .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); + return pollResponseMono.switchIfEmpty( + Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); + } else { + return Mono + .error( + new AzureException(String.format( + "Operation failed or cancelled with status code %d," + + ", '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + } + + /** + * {@inheritDoc} + */ + @Override + public Mono getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + return Mono.error(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + return Mono.error(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + return PollingUtils + .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) + .flatMap(value -> { + if (value.get(propertyName) != null) { + return BinaryData.fromObjectAsync(value.get(propertyName)) + .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); + } else { + return Mono.error(new AzureException("Cannot get final result")); + } + }) + .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/PollingUtils.java new file mode 100644 index 00000000000..259efb2eb00 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/PollingUtils.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.implementation; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.net.URI; +import java.net.URISyntaxException; +import java.time.DateTimeException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +final class PollingUtils { + + public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE + = new TypeReference>() { + }; + + public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); + + public static final String HTTP_METHOD = "httpMethod"; + public static final String REQUEST_URL = "requestURL"; + public static final String POLL_RESPONSE_BODY = "pollResponseBody"; + + private static final String FORWARD_SLASH = "/"; + + public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { + try { + URI uri = new URI(path); + if (!uri.isAbsolute()) { + if (CoreUtils.isNullOrEmpty(endpoint)) { + throw logger.logExceptionAsError(new IllegalArgumentException( + "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); + } + + if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { + return endpoint + path.substring(1); + } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { + return endpoint + FORWARD_SLASH + path; + } else { + return endpoint + path; + } + } + } catch (URISyntaxException ex) { + throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); + } + return path; + } + + public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + T value; + if (binaryData == null) { + value = null; + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); + } else { + value = binaryData.toObject(typeReference, serializer); + } + return value; + } + + @SuppressWarnings("unchecked") + public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + Mono value; + if (binaryData == null) { + value = Mono.empty(); + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = (Mono) binaryData.toReplayableBinaryDataAsync(); + } else { + value = binaryData.toObjectAsync(typeReference, serializer); + } + return value; + } + + private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); + private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); + + public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { + // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. + Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. + retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then + // attempt to resolve it as an HTTP date (RFC1123). + retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, + headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); + + // Either the retry delay will have been found or it'll be null, null indicates no retry after. + return retryDelay; + } + + private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, + Function delayParser) { + String headerValue = headers.getValue(headerName); + + return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); + } + + private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { + long delaySeconds; + try { + OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); + + delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); + } catch (DateTimeException ex) { + delaySeconds = tryParseLong(value); + } + + return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; + } + + private static long tryParseLong(String value) { + try { + return Long.parseLong(value); + } catch (NumberFormatException ex) { + return -1; + } + } + + private static Duration tryGetDelayMillis(String value) { + long delayMillis = tryParseLong(value); + return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/SyncOperationLocationPollingStrategy.java new file mode 100644 index 00000000000..5471cb58e7d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/SyncOperationLocationPollingStrategy.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.io.UncheckedIOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Map; + +// DO NOT modify this helper class + +/** + * Implements a synchronous operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public PollResponse onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + T initialResponseType = null; + try { + initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, + pollResponseType); + } catch (UncheckedIOException e) { + LOGGER.info("Failed to parse initial response."); + } + return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); + } + + throw LOGGER.logExceptionAsError(new AzureException( + String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + + /** + * {@inheritDoc} + */ + public U getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, + PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); + if (pollResult != null && pollResult.get(propertyName) != null) { + return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), + serializer, resultType); + } else { + throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); + } + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionClientImpl.java new file mode 100644 index 00000000000..df601c7f31c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionClientImpl.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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; +import tsptest.union.UnionServiceVersion; + +/** + * Initializes a new instance of the UnionClient type. + */ +public final class UnionClientImpl { + /** + */ + private final String endpoint; + + /** + * Gets. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final UnionServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public UnionServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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 UnionFlattenOpsImpl object to access its operations. + */ + private final UnionFlattenOpsImpl unionFlattenOps; + + /** + * Gets the UnionFlattenOpsImpl object to access its operations. + * + * @return the UnionFlattenOpsImpl object. + */ + public UnionFlattenOpsImpl getUnionFlattenOps() { + return this.unionFlattenOps; + } + + /** + * Initializes an instance of UnionClient client. + * + * @param endpoint + * @param serviceVersion Service version. + */ + public UnionClientImpl(String endpoint, UnionServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of UnionClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint + * @param serviceVersion Service version. + */ + public UnionClientImpl(HttpPipeline httpPipeline, String endpoint, UnionServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of UnionClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint + * @param serviceVersion Service version. + */ + public UnionClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + UnionServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.unionFlattenOps = new UnionFlattenOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionFlattenOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionFlattenOpsImpl.java new file mode 100644 index 00000000000..852855dd53d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/UnionFlattenOpsImpl.java @@ -0,0 +1,642 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import reactor.core.publisher.Mono; +import tsptest.union.UnionServiceVersion; +import tsptest.union.models.Result; + +/** + * An instance of this class provides access to all the operations defined in UnionFlattenOps. + */ +public final class UnionFlattenOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnionFlattenOpsService service; + + /** + * The service client containing this operation class. + */ + private final UnionClientImpl client; + + /** + * Initializes an instance of UnionFlattenOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnionFlattenOpsImpl(UnionClientImpl client) { + this.service + = RestProxy.create(UnionFlattenOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public UnionServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for UnionClientUnionFlattenOps to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}/openai") + @ServiceInterface(name = "UnionClientUnionFlattenOps") + public interface UnionFlattenOpsService { + @Post("/union/send") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendRequest, RequestOptions requestOptions, Context context); + + @Post("/union/send") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendRequest, RequestOptions requestOptions, Context context); + + @Post("/union/send-long") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> sendLong(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendLongRequest, RequestOptions requestOptions, Context context); + + @Post("/union/send-long") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendLongSync(@HostParam("endpoint") String endpoint, @QueryParam("id") String id, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendLongRequest, RequestOptions requestOptions, Context context); + + @Get("/union/param") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, + Context context); + + @Get("/union/param") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, RequestOptions requestOptions, Context context); + + @Post("/union/generate") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> generate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/union/generate") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response generateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendRequest The sendRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(String id, BinaryData sendRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.send(this.client.getEndpoint(), id, + this.client.getServiceVersion().getVersion(), contentType, sendRequest, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendRequest The sendRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(String id, BinaryData sendRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendSync(this.client.getEndpoint(), id, this.client.getServiceVersion().getVersion(), + contentType, sendRequest, requestOptions, Context.NONE); + } + + /** + * The sendLong operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: String (Required)
+     *     dataInt: int (Required)
+     *     dataUnion: BinaryData (Optional)
+     *     dataLong: Long (Optional)
+     *     data_float: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendLongRequest The sendLongRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendLongWithResponseAsync(String id, BinaryData sendLongRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext(context -> service.sendLong(this.client.getEndpoint(), id, + this.client.getServiceVersion().getVersion(), contentType, sendLongRequest, requestOptions, context)); + } + + /** + * The sendLong operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoThe filter parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     user (Optional): {
+     *         user: String (Required)
+     *     }
+     *     input: String (Required)
+     *     dataInt: int (Required)
+     *     dataUnion: BinaryData (Optional)
+     *     dataLong: Long (Optional)
+     *     data_float: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param id The id parameter. + * @param sendLongRequest The sendLongRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendLongWithResponse(String id, BinaryData sendLongRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendLongSync(this.client.getEndpoint(), id, this.client.getServiceVersion().getVersion(), + contentType, sendLongRequest, requestOptions, Context.NONE); + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
dataBinaryDataNoThe data parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), requestOptions, context)); + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
dataBinaryDataNoThe data parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return service.getSync(this.client.getEndpoint(), requestOptions, Context.NONE); + } + + /** + * A long-running remote procedure call (RPC) operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         result (Optional): (recursive schema, see result above)
+     *         data: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.generate(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * A long-running remote procedure call (RPC) operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         result (Optional): (recursive schema, see result above)
+     *         data: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response generateWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.generateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); + } + + /** + * A long-running remote procedure call (RPC) operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         result (Optional): (recursive schema, see result above)
+     *         data: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginGenerateWithModelAsync(RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), () -> this.generateWithResponseAsync(requestOptions), + new tsptest.union.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}/openai".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Result.class)); + } + + /** + * A long-running remote procedure call (RPC) operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         result (Optional): (recursive schema, see result above)
+     *         data: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginGenerateWithModel(RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.generateWithResponse(requestOptions), + new tsptest.union.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}/openai".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Result.class)); + } + + /** + * A long-running remote procedure call (RPC) operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         result (Optional): (recursive schema, see result above)
+     *         data: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginGenerateAsync(RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), () -> this.generateWithResponseAsync(requestOptions), + new tsptest.union.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}/openai".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * A long-running remote procedure call (RPC) operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         result (Optional): (recursive schema, see result above)
+     *         data: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginGenerate(RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.generateWithResponse(requestOptions), + new tsptest.union.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}/openai".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendLongRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendLongRequest.java new file mode 100644 index 00000000000..435539a9d2b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendLongRequest.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.union.models.User; + +/** + * The SendLongRequest model. + */ +@Fluent +public final class SendLongRequest implements JsonSerializable { + /* + * The user property. + */ + @Generated + private User user; + + /* + * The input property. + */ + @Generated + private final String input; + + /* + * The dataInt property. + */ + @Generated + private final int dataInt; + + /* + * The dataUnion property. + */ + @Generated + private BinaryData dataUnion; + + /* + * The dataLong property. + */ + @Generated + private Long dataLong; + + /* + * The data_float property. + */ + @Generated + private Double dataFloat; + + /** + * Creates an instance of SendLongRequest class. + * + * @param input the input value to set. + * @param dataInt the dataInt value to set. + */ + @Generated + public SendLongRequest(String input, int dataInt) { + this.input = input; + this.dataInt = dataInt; + } + + /** + * Get the user property: The user property. + * + * @return the user value. + */ + @Generated + public User getUser() { + return this.user; + } + + /** + * Set the user property: The user property. + * + * @param user the user value to set. + * @return the SendLongRequest object itself. + */ + @Generated + public SendLongRequest setUser(User user) { + this.user = user; + return this; + } + + /** + * Get the input property: The input property. + * + * @return the input value. + */ + @Generated + public String getInput() { + return this.input; + } + + /** + * Get the dataInt property: The dataInt property. + * + * @return the dataInt value. + */ + @Generated + public int getDataInt() { + return this.dataInt; + } + + /** + * Get the dataUnion property: The dataUnion property. + * + * @return the dataUnion value. + */ + @Generated + public BinaryData getDataUnion() { + return this.dataUnion; + } + + /** + * Set the dataUnion property: The dataUnion property. + * + * @param dataUnion the dataUnion value to set. + * @return the SendLongRequest object itself. + */ + @Generated + public SendLongRequest setDataUnion(BinaryData dataUnion) { + this.dataUnion = dataUnion; + return this; + } + + /** + * Get the dataLong property: The dataLong property. + * + * @return the dataLong value. + */ + @Generated + public Long getDataLong() { + return this.dataLong; + } + + /** + * Set the dataLong property: The dataLong property. + * + * @param dataLong the dataLong value to set. + * @return the SendLongRequest object itself. + */ + @Generated + public SendLongRequest setDataLong(Long dataLong) { + this.dataLong = dataLong; + return this; + } + + /** + * Get the dataFloat property: The data_float property. + * + * @return the dataFloat value. + */ + @Generated + public Double getDataFloat() { + return this.dataFloat; + } + + /** + * Set the dataFloat property: The data_float property. + * + * @param dataFloat the dataFloat value to set. + * @return the SendLongRequest object itself. + */ + @Generated + public SendLongRequest setDataFloat(Double dataFloat) { + this.dataFloat = dataFloat; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("input", this.input); + jsonWriter.writeIntField("dataInt", this.dataInt); + jsonWriter.writeJsonField("user", this.user); + if (this.dataUnion != null) { + jsonWriter.writeFieldName("dataUnion"); + this.dataUnion.writeTo(jsonWriter); + } + jsonWriter.writeNumberField("dataLong", this.dataLong); + jsonWriter.writeNumberField("data_float", this.dataFloat); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendLongRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendLongRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendLongRequest. + */ + @Generated + public static SendLongRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String input = null; + int dataInt = 0; + User user = null; + BinaryData dataUnion = null; + Long dataLong = null; + Double dataFloat = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("input".equals(fieldName)) { + input = reader.getString(); + } else if ("dataInt".equals(fieldName)) { + dataInt = reader.getInt(); + } else if ("user".equals(fieldName)) { + user = User.fromJson(reader); + } else if ("dataUnion".equals(fieldName)) { + dataUnion = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("dataLong".equals(fieldName)) { + dataLong = reader.getNullable(JsonReader::getLong); + } else if ("data_float".equals(fieldName)) { + dataFloat = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + SendLongRequest deserializedSendLongRequest = new SendLongRequest(input, dataInt); + deserializedSendLongRequest.user = user; + deserializedSendLongRequest.dataUnion = dataUnion; + deserializedSendLongRequest.dataLong = dataLong; + deserializedSendLongRequest.dataFloat = dataFloat; + + return deserializedSendLongRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendRequest.java new file mode 100644 index 00000000000..741701ccbc8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SendRequest.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.union.models.User; + +/** + * The SendRequest model. + */ +@Fluent +public final class SendRequest implements JsonSerializable { + /* + * The user property. + */ + @Generated + private User user; + + /* + * The input property. + */ + @Generated + private final BinaryData input; + + /** + * Creates an instance of SendRequest class. + * + * @param input the input value to set. + */ + @Generated + public SendRequest(BinaryData input) { + this.input = input; + } + + /** + * Get the user property: The user property. + * + * @return the user value. + */ + @Generated + public User getUser() { + return this.user; + } + + /** + * Set the user property: The user property. + * + * @param user the user value to set. + * @return the SendRequest object itself. + */ + @Generated + public SendRequest setUser(User user) { + this.user = user; + return this; + } + + /** + * Get the input property: The input property. + * + * @return the input value. + */ + @Generated + public BinaryData getInput() { + return this.input; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeFieldName("input"); + this.input.writeTo(jsonWriter); + jsonWriter.writeJsonField("user", this.user); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendRequest. + */ + @Generated + public static SendRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryData input = null; + User user = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("input".equals(fieldName)) { + input = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("user".equals(fieldName)) { + user = User.fromJson(reader); + } else { + reader.skipChildren(); + } + } + SendRequest deserializedSendRequest = new SendRequest(input); + deserializedSendRequest.user = user; + + return deserializedSendRequest; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SubResult.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SubResult.java new file mode 100644 index 00000000000..f35e482f57a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/SubResult.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import tsptest.union.models.Result; + +/** + * The SubResult model. + */ +@Fluent +public final class SubResult extends Result { + /* + * The text property. + */ + @Generated + private String text; + + /* + * The arrayData property. + */ + @Generated + private BinaryData arrayData; + + /** + * Creates an instance of SubResult class. + * + * @param name the name value to set. + * @param data the data value to set. + */ + @Generated + public SubResult(String name, BinaryData data) { + super(name, data); + } + + /** + * Get the text property: The text property. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Set the text property: The text property. + * + * @param text the text value to set. + * @return the SubResult object itself. + */ + @Generated + public SubResult setText(String text) { + this.text = text; + return this; + } + + /** + * Get the arrayData property: The arrayData property. + * + * @return the arrayData value. + */ + @Generated + public BinaryData getArrayData() { + return this.arrayData; + } + + /** + * Set the arrayData property: The arrayData property. + * + * @param arrayData the arrayData value to set. + * @return the SubResult object itself. + */ + @Generated + public SubResult setArrayData(BinaryData arrayData) { + this.arrayData = arrayData; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public SubResult setResult(Result result) { + super.setResult(result); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeFieldName("data"); + getData().writeTo(jsonWriter); + jsonWriter.writeJsonField("result", getResult()); + jsonWriter.writeStringField("text", this.text); + if (this.arrayData != null) { + jsonWriter.writeFieldName("arrayData"); + this.arrayData.writeTo(jsonWriter); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubResult if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubResult. + */ + @Generated + public static SubResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + BinaryData data = null; + Result result = null; + String text = null; + BinaryData arrayData = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("data".equals(fieldName)) { + data = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("result".equals(fieldName)) { + result = Result.fromJson(reader); + } else if ("text".equals(fieldName)) { + text = reader.getString(); + } else if ("arrayData".equals(fieldName)) { + arrayData = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + SubResult deserializedSubResult = new SubResult(name, data); + deserializedSubResult.setResult(result); + deserializedSubResult.text = text; + deserializedSubResult.arrayData = arrayData; + + return deserializedSubResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/package-info.java new file mode 100644 index 00000000000..f7a1b79ffae --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Union. + * + */ +package tsptest.union.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/package-info.java new file mode 100644 index 00000000000..9499b67a3e6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Union. + * + */ +package tsptest.union.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/ArrayData.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/ArrayData.java new file mode 100644 index 00000000000..4b9e4d33ff9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/ArrayData.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The ArrayData model. + */ +@Immutable +public final class ArrayData implements JsonSerializable { + /* + * The data property. + */ + @Generated + private final List data; + + /** + * Creates an instance of ArrayData class. + * + * @param data the data value to set. + */ + @Generated + public ArrayData(List data) { + this.data = data; + } + + /** + * Get the data property: The data property. + * + * @return the data value. + */ + @Generated + public List getData() { + return this.data; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("data", this.data, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ArrayData from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ArrayData if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ArrayData. + */ + @Generated + public static ArrayData fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List data = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("data".equals(fieldName)) { + data = reader.readArray(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + return new ArrayData(data); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/Result.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/Result.java new file mode 100644 index 00000000000..61f1a0c25b0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/Result.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Result model. + */ +@Fluent +public class Result implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The result property. + */ + @Generated + private Result result; + + /* + * The data property. + */ + @Generated + private final BinaryData data; + + /** + * Creates an instance of Result class. + * + * @param name the name value to set. + * @param data the data value to set. + */ + @Generated + public Result(String name, BinaryData data) { + this.name = name; + this.data = data; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the result property: The result property. + * + * @return the result value. + */ + @Generated + public Result getResult() { + return this.result; + } + + /** + * Set the result property: The result property. + * + * @param result the result value to set. + * @return the Result object itself. + */ + @Generated + public Result setResult(Result result) { + this.result = result; + return this; + } + + /** + * Get the data property: The data property. + * + * @return the data value. + */ + @Generated + public BinaryData getData() { + return this.data; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeFieldName("data"); + this.data.writeTo(jsonWriter); + jsonWriter.writeJsonField("result", this.result); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Result from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Result if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Result. + */ + @Generated + public static Result fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + BinaryData data = null; + Result result = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("data".equals(fieldName)) { + data = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("result".equals(fieldName)) { + result = Result.fromJson(reader); + } else { + reader.skipChildren(); + } + } + Result deserializedResult = new Result(name, data); + deserializedResult.result = result; + + return deserializedResult; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/SendLongOptions.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/SendLongOptions.java new file mode 100644 index 00000000000..77cb485371e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/SendLongOptions.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; + +/** + * Options for sendLong API. + */ +@Fluent +public final class SendLongOptions { + /* + * The id property. + */ + @Generated + private final String id; + + /* + * The filter property. + */ + @Generated + private String filter; + + /* + * The user property. + */ + @Generated + private User user; + + /* + * The input property. + */ + @Generated + private final String input; + + /* + * The dataInt property. + */ + @Generated + private final int dataInt; + + /* + * The dataUnion property. + */ + @Generated + private BinaryData dataUnion; + + /* + * The dataLong property. + */ + @Generated + private Long dataLong; + + /* + * The data_float property. + */ + @Generated + private Double dataFloat; + + /** + * Creates an instance of SendLongOptions class. + * + * @param id the id value to set. + * @param input the input value to set. + * @param dataInt the dataInt value to set. + */ + @Generated + public SendLongOptions(String id, String input, int dataInt) { + this.id = id; + this.input = input; + this.dataInt = dataInt; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the filter property: The filter property. + * + * @return the filter value. + */ + @Generated + public String getFilter() { + return this.filter; + } + + /** + * Set the filter property: The filter property. + * + * @param filter the filter value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the user property: The user property. + * + * @return the user value. + */ + @Generated + public User getUser() { + return this.user; + } + + /** + * Set the user property: The user property. + * + * @param user the user value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setUser(User user) { + this.user = user; + return this; + } + + /** + * Get the input property: The input property. + * + * @return the input value. + */ + @Generated + public String getInput() { + return this.input; + } + + /** + * Get the dataInt property: The dataInt property. + * + * @return the dataInt value. + */ + @Generated + public int getDataInt() { + return this.dataInt; + } + + /** + * Get the dataUnion property: The dataUnion property. + * + * @return the dataUnion value. + */ + @Generated + public BinaryData getDataUnion() { + return this.dataUnion; + } + + /** + * Set the dataUnion property: The dataUnion property. + * + * @param dataUnion the dataUnion value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setDataUnion(BinaryData dataUnion) { + this.dataUnion = dataUnion; + return this; + } + + /** + * Get the dataLong property: The dataLong property. + * + * @return the dataLong value. + */ + @Generated + public Long getDataLong() { + return this.dataLong; + } + + /** + * Set the dataLong property: The dataLong property. + * + * @param dataLong the dataLong value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setDataLong(Long dataLong) { + this.dataLong = dataLong; + return this; + } + + /** + * Get the dataFloat property: The data_float property. + * + * @return the dataFloat value. + */ + @Generated + public Double getDataFloat() { + return this.dataFloat; + } + + /** + * Set the dataFloat property: The data_float property. + * + * @param dataFloat the dataFloat value to set. + * @return the SendLongOptions object itself. + */ + @Generated + public SendLongOptions setDataFloat(Double dataFloat) { + this.dataFloat = dataFloat; + return this; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/User.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/User.java new file mode 100644 index 00000000000..8ac404ec5d2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/User.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The User model. + */ +@Immutable +public final class User implements JsonSerializable { + /* + * The user property. + */ + @Generated + private final String user; + + /** + * Creates an instance of User class. + * + * @param user the user value to set. + */ + @Generated + public User(String user) { + this.user = user; + } + + /** + * Get the user property: The user property. + * + * @return the user value. + */ + @Generated + public String getUser() { + return this.user; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("user", this.user); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of User from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of User if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the User. + */ + @Generated + public static User fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String user = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("user".equals(fieldName)) { + user = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new User(user); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/package-info.java new file mode 100644 index 00000000000..7fcc2e6f48e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Union. + * + */ +package tsptest.union.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/package-info.java new file mode 100644 index 00000000000..61f38293617 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/union/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Union. + * + */ +package tsptest.union; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningAsyncClient.java new file mode 100644 index 00000000000..eb81728b5fa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningAsyncClient.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import java.util.List; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import tsptest.versioning.implementation.VersioningOpsImpl; +import tsptest.versioning.models.ExportedResource; +import tsptest.versioning.models.Resource; + +/** + * Initializes a new instance of the asynchronous VersioningClient type. + */ +@ServiceClient(builder = VersioningClientBuilder.class, isAsync = true) +public final class VersioningAsyncClient { + @Generated + private final VersioningOpsImpl serviceClient; + + /** + * Initializes an instance of VersioningAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + VersioningAsyncClient(VersioningOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Long-running resource action operation template. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         id: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginExport(String name, RequestOptions requestOptions) { + return this.serviceClient.beginExportAsync(name, requestOptions); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
selectList<String>NoSelect the specified fields to be included in the + * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandStringNoThe expand parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(RequestOptions requestOptions) { + return this.serviceClient.listAsync(requestOptions); + } + + /** + * Long-running resource create or replace operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateLongRunning(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.beginCreateLongRunningAsync(name, resource, requestOptions); + } + + /** + * Long-running resource action operation template. + * + * @param name The name parameter. + * @param projectFileVersion The projectFileVersion parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginExport(String name, String projectFileVersion) { + // Generated convenience method for beginExportWithModel + RequestOptions requestOptions = new RequestOptions(); + if (projectFileVersion != null) { + requestOptions.addQueryParam("projectFileVersion", projectFileVersion, false); + } + return serviceClient.beginExportWithModelAsync(name, requestOptions); + } + + /** + * Long-running resource action operation template. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginExport(String name) { + // Generated convenience method for beginExportWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginExportWithModelAsync(name, requestOptions); + } + + /** + * Resource list operation template. + * + * @param select Select the specified fields to be included in the response. + * @param expand The expand parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Resource items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(List select, String expand) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (select != null) { + for (String paramItemValue : select) { + if (paramItemValue != null) { + requestOptions.addQueryParam("select", paramItemValue, false); + } + } + } + if (expand != null) { + requestOptions.addQueryParam("expand", expand, false); + } + PagedFlux pagedFluxResponse = list(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Resource list operation template. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Resource items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = list(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Resource.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Long-running resource create or replace operation template. + * + * @param name The name parameter. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateLongRunning(String name, Resource resource) { + // Generated convenience method for beginCreateLongRunningWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginCreateLongRunningWithModelAsync(name, BinaryData.fromObject(resource), + requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClient.java new file mode 100644 index 00000000000..3b630bf2fd8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClient.java @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.SyncPoller; +import java.util.List; +import tsptest.versioning.implementation.VersioningOpsImpl; +import tsptest.versioning.models.ExportedResource; +import tsptest.versioning.models.Resource; + +/** + * Initializes a new instance of the synchronous VersioningClient type. + */ +@ServiceClient(builder = VersioningClientBuilder.class) +public final class VersioningClient { + @Generated + private final VersioningOpsImpl serviceClient; + + /** + * Initializes an instance of VersioningClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + VersioningClient(VersioningOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Long-running resource action operation template. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         id: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginExport(String name, RequestOptions requestOptions) { + return this.serviceClient.beginExport(name, requestOptions); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
selectList<String>NoSelect the specified fields to be included in the + * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandStringNoThe expand parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + return this.serviceClient.list(requestOptions); + } + + /** + * Long-running resource create or replace operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateLongRunning(String name, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.beginCreateLongRunning(name, resource, requestOptions); + } + + /** + * Long-running resource action operation template. + * + * @param name The name parameter. + * @param projectFileVersion The projectFileVersion parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginExport(String name, String projectFileVersion) { + // Generated convenience method for beginExportWithModel + RequestOptions requestOptions = new RequestOptions(); + if (projectFileVersion != null) { + requestOptions.addQueryParam("projectFileVersion", projectFileVersion, false); + } + return serviceClient.beginExportWithModel(name, requestOptions); + } + + /** + * Long-running resource action operation template. + * + * @param name The name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginExport(String name) { + // Generated convenience method for beginExportWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginExportWithModel(name, requestOptions); + } + + /** + * Resource list operation template. + * + * @param select Select the specified fields to be included in the response. + * @param expand The expand parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Resource items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(List select, String expand) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (select != null) { + for (String paramItemValue : select) { + if (paramItemValue != null) { + requestOptions.addQueryParam("select", paramItemValue, false); + } + } + } + if (expand != null) { + requestOptions.addQueryParam("expand", expand, false); + } + return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Resource.class)); + } + + /** + * Resource list operation template. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Resource items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(Resource.class)); + } + + /** + * Long-running resource create or replace operation template. + * + * @param name The name parameter. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateLongRunning(String name, Resource resource) { + // Generated convenience method for beginCreateLongRunningWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginCreateLongRunningWithModel(name, BinaryData.fromObject(resource), requestOptions); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClientBuilder.java new file mode 100644 index 00000000000..65314f62664 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.versioning.implementation.VersioningClientImpl; + +/** + * A builder for creating a new instance of the VersioningClient type. + */ +@ServiceClientBuilder(serviceClients = { VersioningClient.class, VersioningAsyncClient.class }) +public final class VersioningClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-versioning.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the VersioningClientBuilder. + */ + @Generated + public VersioningClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersioningClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersioningClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersioningClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersioningClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersioningClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersioningClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersioningClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VersioningClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private VersioningServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the VersioningClientBuilder. + */ + @Generated + public VersioningClientBuilder serviceVersion(VersioningServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the VersioningClientBuilder. + */ + @Generated + public VersioningClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of VersioningClientImpl with the provided parameters. + * + * @return an instance of VersioningClientImpl. + */ + @Generated + private VersioningClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + VersioningServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : VersioningServiceVersion.getLatest(); + VersioningClientImpl client = new VersioningClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of VersioningAsyncClient class. + * + * @return an instance of VersioningAsyncClient. + */ + @Generated + public VersioningAsyncClient buildAsyncClient() { + return new VersioningAsyncClient(buildInnerClient().getVersioningOps()); + } + + /** + * Builds an instance of VersioningClient class. + * + * @return an instance of VersioningClient. + */ + @Generated + public VersioningClient buildClient() { + return new VersioningClient(buildInnerClient().getVersioningOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(VersioningClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningServiceVersion.java new file mode 100644 index 00000000000..860989fd31c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/VersioningServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of VersioningClient. + */ +public enum VersioningServiceVersion implements ServiceVersion { + /** + * Enum value 2022-09-01. + */ + V2022_09_01("2022-09-01"); + + private final String version; + + VersioningServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link VersioningServiceVersion}. + */ + public static VersioningServiceVersion getLatest() { + return V2022_09_01; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/OperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/OperationLocationPollingStrategy.java new file mode 100644 index 00000000000..9b987cbc1de --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/OperationLocationPollingStrategy.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.OperationResourcePollingStrategy; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +/** + * Implements an operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public Mono> onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + final Mono> pollResponseMono + = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) + .onErrorResume(exception -> { + LOGGER.info("Failed to parse initial response."); + return Mono.empty(); + }) + .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); + return pollResponseMono.switchIfEmpty( + Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); + } else { + return Mono + .error( + new AzureException(String.format( + "Operation failed or cancelled with status code %d," + + ", '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + } + + /** + * {@inheritDoc} + */ + @Override + public Mono getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + return Mono.error(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + return Mono.error(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + return PollingUtils + .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) + .flatMap(value -> { + if (value.get(propertyName) != null) { + return BinaryData.fromObjectAsync(value.get(propertyName)) + .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); + } else { + return Mono.error(new AzureException("Cannot get final result")); + } + }) + .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/PollingUtils.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/PollingUtils.java new file mode 100644 index 00000000000..da02ed5c49f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/PollingUtils.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning.implementation; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.net.URI; +import java.net.URISyntaxException; +import java.time.DateTimeException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +final class PollingUtils { + + public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE + = new TypeReference>() { + }; + + public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); + + public static final String HTTP_METHOD = "httpMethod"; + public static final String REQUEST_URL = "requestURL"; + public static final String POLL_RESPONSE_BODY = "pollResponseBody"; + + private static final String FORWARD_SLASH = "/"; + + public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { + try { + URI uri = new URI(path); + if (!uri.isAbsolute()) { + if (CoreUtils.isNullOrEmpty(endpoint)) { + throw logger.logExceptionAsError(new IllegalArgumentException( + "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); + } + + if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { + return endpoint + path.substring(1); + } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { + return endpoint + FORWARD_SLASH + path; + } else { + return endpoint + path; + } + } + } catch (URISyntaxException ex) { + throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); + } + return path; + } + + public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + T value; + if (binaryData == null) { + value = null; + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); + } else { + value = binaryData.toObject(typeReference, serializer); + } + return value; + } + + @SuppressWarnings("unchecked") + public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + Mono value; + if (binaryData == null) { + value = Mono.empty(); + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = (Mono) binaryData.toReplayableBinaryDataAsync(); + } else { + value = binaryData.toObjectAsync(typeReference, serializer); + } + return value; + } + + private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); + private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); + + public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { + // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. + Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. + retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then + // attempt to resolve it as an HTTP date (RFC1123). + retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, + headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); + + // Either the retry delay will have been found or it'll be null, null indicates no retry after. + return retryDelay; + } + + private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, + Function delayParser) { + String headerValue = headers.getValue(headerName); + + return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); + } + + private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { + long delaySeconds; + try { + OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); + + delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); + } catch (DateTimeException ex) { + delaySeconds = tryParseLong(value); + } + + return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; + } + + private static long tryParseLong(String value) { + try { + return Long.parseLong(value); + } catch (NumberFormatException ex) { + return -1; + } + } + + private static Duration tryGetDelayMillis(String value) { + long delayMillis = tryParseLong(value); + return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/SyncOperationLocationPollingStrategy.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/SyncOperationLocationPollingStrategy.java new file mode 100644 index 00000000000..ea54348a6fc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/SyncOperationLocationPollingStrategy.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.io.UncheckedIOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Map; + +// DO NOT modify this helper class + +/** + * Implements a synchronous operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public PollResponse onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + T initialResponseType = null; + try { + initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, + pollResponseType); + } catch (UncheckedIOException e) { + LOGGER.info("Failed to parse initial response."); + } + return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); + } + + throw LOGGER.logExceptionAsError(new AzureException( + String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + + /** + * {@inheritDoc} + */ + public U getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, + PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); + if (pollResult != null && pollResult.get(propertyName) != null) { + return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), + serializer, resultType); + } else { + throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); + } + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningClientImpl.java new file mode 100644 index 00000000000..da38ea6fc40 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningClientImpl.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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; +import tsptest.versioning.VersioningServiceVersion; + +/** + * Initializes a new instance of the VersioningClient type. + */ +public final class VersioningClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final VersioningServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public VersioningServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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 VersioningOpsImpl object to access its operations. + */ + private final VersioningOpsImpl versioningOps; + + /** + * Gets the VersioningOpsImpl object to access its operations. + * + * @return the VersioningOpsImpl object. + */ + public VersioningOpsImpl getVersioningOps() { + return this.versioningOps; + } + + /** + * Initializes an instance of VersioningClient client. + * + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public VersioningClientImpl(String endpoint, VersioningServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of VersioningClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public VersioningClientImpl(HttpPipeline httpPipeline, String endpoint, VersioningServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of VersioningClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + * @param serviceVersion Service version. + */ + public VersioningClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + VersioningServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.versioningOps = new VersioningOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningOpsImpl.java new file mode 100644 index 00000000000..b58cb5ea82b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/VersioningOpsImpl.java @@ -0,0 +1,1041 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +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.RequestOptions; +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 com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; +import tsptest.versioning.VersioningServiceVersion; +import tsptest.versioning.models.ExportedResource; +import tsptest.versioning.models.Resource; + +/** + * An instance of this class provides access to all the operations defined in VersioningOps. + */ +public final class VersioningOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final VersioningOpsService service; + + /** + * The service client containing this operation class. + */ + private final VersioningClientImpl client; + + /** + * Initializes an instance of VersioningOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VersioningOpsImpl(VersioningClientImpl client) { + this.service + = RestProxy.create(VersioningOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public VersioningServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for VersioningClientVersioningOps to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VersioningClientVersioningOps") + public interface VersioningOpsService { + @Post("/versioning/resources/{name}:export") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> export(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/versioning/resources/{name}:export") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response exportSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/versioning/resources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/versioning/resources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/versioning/resources/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createLongRunning(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Put("/versioning/resources/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createLongRunningSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData resource, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Long-running resource action operation template. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         id: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportWithResponseAsync(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.export(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, accept, requestOptions, context)); + } + + /** + * Long-running resource action operation template. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         id: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response exportWithResponse(String name, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.exportSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), name, accept, + requestOptions, Context.NONE); + } + + /** + * Long-running resource action operation template. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         id: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginExportWithModelAsync(String name, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), () -> this.exportWithResponseAsync(name, requestOptions), + new tsptest.versioning.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), + TypeReference.createInstance(ExportedResource.class)); + } + + /** + * Long-running resource action operation template. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         id: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginExportWithModel(String name, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.exportWithResponse(name, requestOptions), + new tsptest.versioning.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), + TypeReference.createInstance(ExportedResource.class)); + } + + /** + * Long-running resource action operation template. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         id: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginExportAsync(String name, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), () -> this.exportWithResponseAsync(name, requestOptions), + new tsptest.versioning.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Long-running resource action operation template. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
projectFileVersionStringNoThe projectFileVersion parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         code: String (Required)
+     *         message: String (Required)
+     *         target: String (Optional)
+     *         details (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *         innererror (Optional): {
+     *             code: String (Optional)
+     *             innererror (Optional): (recursive schema, see innererror above)
+     *         }
+     *     }
+     *     result (Optional): {
+     *         id: String (Required)
+     *         resourceUri: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginExport(String name, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), () -> this.exportWithResponse(name, requestOptions), + new tsptest.versioning.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
selectList<String>NoSelect the specified fields to be included in the + * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandStringNoThe expand parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
selectList<String>NoSelect the specified fields to be included in the + * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandStringNoThe expand parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listSinglePageAsync(requestOptions), + nextLink -> listNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
selectList<String>NoSelect the specified fields to be included in the + * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandStringNoThe expand parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * Resource list operation template. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
selectList<String>NoSelect the specified fields to be included in the + * response. Call {@link RequestOptions#addQueryParam} to add string to array.
expandStringNoThe expand parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listSinglePage(requestOptions), + nextLink -> listNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Long-running resource create or replace operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createLongRunningWithResponseAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.createLongRunning(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), name, contentType, accept, resource, requestOptions, + context)); + } + + /** + * Long-running resource create or replace operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createLongRunningWithResponse(String name, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createLongRunningSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + name, contentType, accept, resource, requestOptions, Context.NONE); + } + + /** + * Long-running resource create or replace operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateLongRunningWithModelAsync(String name, + BinaryData resource, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.createLongRunningWithResponseAsync(name, resource, requestOptions), + new tsptest.versioning.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Resource.class)); + } + + /** + * Long-running resource create or replace operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateLongRunningWithModel(String name, BinaryData resource, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.createLongRunningWithResponse(name, resource, requestOptions), + new tsptest.versioning.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Resource.class)); + } + + /** + * Long-running resource create or replace operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateLongRunningAsync(String name, BinaryData resource, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.createLongRunningWithResponseAsync(name, resource, requestOptions), + new tsptest.versioning.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Long-running resource create or replace operation template. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param name The name parameter. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateLongRunning(String name, BinaryData resource, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.createLongRunningWithResponse(name, resource, requestOptions), + new tsptest.versioning.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), 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
+     * {
+     *     id: String (Required)
+     *     name: String (Required)
+     *     type: String (Required)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Resource items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/package-info.java new file mode 100644 index 00000000000..f4cd4e3fc6b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Versioning. + * + */ +package tsptest.versioning.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/ExportedResource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/ExportedResource.java new file mode 100644 index 00000000000..2c784d92eb9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/ExportedResource.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ExportedResource model. + */ +@Immutable +public final class ExportedResource implements JsonSerializable { + /* + * The id property. + */ + @Generated + private final String id; + + /* + * The resourceUri property. + */ + @Generated + private final String resourceUri; + + /** + * Creates an instance of ExportedResource class. + * + * @param id the id value to set. + * @param resourceUri the resourceUri value to set. + */ + @Generated + private ExportedResource(String id, String resourceUri) { + this.id = id; + this.resourceUri = resourceUri; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the resourceUri property: The resourceUri property. + * + * @return the resourceUri value. + */ + @Generated + public String getResourceUri() { + return this.resourceUri; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("resourceUri", this.resourceUri); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExportedResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExportedResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExportedResource. + */ + @Generated + public static ExportedResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String resourceUri = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("resourceUri".equals(fieldName)) { + resourceUri = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ExportedResource(id, resourceUri); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/Resource.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/Resource.java new file mode 100644 index 00000000000..ffc5f78f0d1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/Resource.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Resource model. + */ +@Immutable +public final class Resource implements JsonSerializable { + /* + * The id property. + */ + @Generated + private String id; + + /* + * The name property. + */ + @Generated + private String name; + + /* + * The type property. + */ + @Generated + private final String type; + + /** + * Creates an instance of Resource class. + * + * @param type the type value to set. + */ + @Generated + public Resource(String type) { + this.type = type; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + @Generated + public String getType() { + return this.type; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Resource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Resource. + */ + @Generated + public static Resource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String name = null; + String type = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("type".equals(fieldName)) { + type = reader.getString(); + } else { + reader.skipChildren(); + } + } + Resource deserializedResource = new Resource(type); + deserializedResource.id = id; + deserializedResource.name = name; + + return deserializedResource; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/package-info.java new file mode 100644 index 00000000000..3bdb891c4e8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Versioning. + * + */ +package tsptest.versioning.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/package-info.java new file mode 100644 index 00000000000..a55af2e2824 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/versioning/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Versioning. + * + */ +package tsptest.versioning; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityAsyncClient.java new file mode 100644 index 00000000000..807f5320a48 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityAsyncClient.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.visibility.implementation.VisibilityClientImpl; +import tsptest.visibility.models.Dog; +import tsptest.visibility.models.ReadDog; +import tsptest.visibility.models.RoundTripModel; +import tsptest.visibility.models.WriteDog; + +/** + * Initializes a new instance of the asynchronous VisibilityClient type. + */ +@ServiceClient(builder = VisibilityClientBuilder.class, isAsync = true) +public final class VisibilityAsyncClient { + @Generated + private final VisibilityClientImpl serviceClient; + + /** + * Initializes an instance of VisibilityAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + VisibilityAsyncClient(VisibilityClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The create operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponse(BinaryData dog, RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(dog, requestOptions); + } + + /** + * The query operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> queryWithResponse(BinaryData dog, RequestOptions requestOptions) { + return this.serviceClient.queryWithResponseAsync(dog, requestOptions); + } + + /** + * The roundtrip operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     secretName: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     secretName: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> roundtripWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.roundtripWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); + } + + /** + * The create operation. + * + * @param dog The dog parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono create(WriteDog dog) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createWithResponse(BinaryData.fromObject(dog), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); + } + + /** + * The query operation. + * + * @param dog The dog parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono query(WriteDog dog) { + // Generated convenience method for queryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return queryWithResponse(BinaryData.fromObject(dog), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ReadDog.class)); + } + + /** + * The roundtrip operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono roundtrip(RoundTripModel body) { + // Generated convenience method for roundtripWithResponse + RequestOptions requestOptions = new RequestOptions(); + return roundtripWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(RoundTripModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClient.java new file mode 100644 index 00000000000..a79ed9bd963 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClient.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.visibility.implementation.VisibilityClientImpl; +import tsptest.visibility.models.Dog; +import tsptest.visibility.models.ReadDog; +import tsptest.visibility.models.RoundTripModel; +import tsptest.visibility.models.WriteDog; + +/** + * Initializes a new instance of the synchronous VisibilityClient type. + */ +@ServiceClient(builder = VisibilityClientBuilder.class) +public final class VisibilityClient { + @Generated + private final VisibilityClientImpl serviceClient; + + /** + * Initializes an instance of VisibilityClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + VisibilityClient(VisibilityClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The create operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(BinaryData dog, RequestOptions requestOptions) { + return this.serviceClient.createWithResponse(dog, requestOptions); + } + + /** + * The query operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response queryWithResponse(BinaryData dog, RequestOptions requestOptions) { + return this.serviceClient.queryWithResponse(dog, requestOptions); + } + + /** + * The roundtrip operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     secretName: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     secretName: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response roundtripWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.roundtripWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Dog get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(Dog.class); + } + + /** + * The create operation. + * + * @param dog The dog parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Dog create(WriteDog dog) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createWithResponse(BinaryData.fromObject(dog), requestOptions).getValue().toObject(Dog.class); + } + + /** + * The query operation. + * + * @param dog The dog parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ReadDog query(WriteDog dog) { + // Generated convenience method for queryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return queryWithResponse(BinaryData.fromObject(dog), requestOptions).getValue().toObject(ReadDog.class); + } + + /** + * The roundtrip operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public RoundTripModel roundtrip(RoundTripModel body) { + // Generated convenience method for roundtripWithResponse + RequestOptions requestOptions = new RequestOptions(); + return roundtripWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(RoundTripModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClientBuilder.java new file mode 100644 index 00000000000..d1edc5a5fca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityClientBuilder.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.visibility.implementation.VisibilityClientImpl; + +/** + * A builder for creating a new instance of the VisibilityClient type. + */ +@ServiceClientBuilder( + serviceClients = { + VisibilityClient.class, + VisibilityReadClient.class, + VisibilityWriteClient.class, + VisibilityAsyncClient.class, + VisibilityReadAsyncClient.class, + VisibilityWriteAsyncClient.class }) +public final class VisibilityClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-visibility.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the VisibilityClientBuilder. + */ + @Generated + public VisibilityClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the VisibilityClientBuilder. + */ + @Generated + public VisibilityClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of VisibilityClientImpl with the provided parameters. + * + * @return an instance of VisibilityClientImpl. + */ + @Generated + private VisibilityClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + VisibilityClientImpl client + = new VisibilityClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of VisibilityAsyncClient class. + * + * @return an instance of VisibilityAsyncClient. + */ + @Generated + public VisibilityAsyncClient buildAsyncClient() { + return new VisibilityAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of VisibilityReadAsyncClient class. + * + * @return an instance of VisibilityReadAsyncClient. + */ + @Generated + public VisibilityReadAsyncClient buildVisibilityReadAsyncClient() { + return new VisibilityReadAsyncClient(buildInnerClient().getVisibilityReads()); + } + + /** + * Builds an instance of VisibilityWriteAsyncClient class. + * + * @return an instance of VisibilityWriteAsyncClient. + */ + @Generated + public VisibilityWriteAsyncClient buildVisibilityWriteAsyncClient() { + return new VisibilityWriteAsyncClient(buildInnerClient().getVisibilityWrites()); + } + + /** + * Builds an instance of VisibilityClient class. + * + * @return an instance of VisibilityClient. + */ + @Generated + public VisibilityClient buildClient() { + return new VisibilityClient(buildInnerClient()); + } + + /** + * Builds an instance of VisibilityReadClient class. + * + * @return an instance of VisibilityReadClient. + */ + @Generated + public VisibilityReadClient buildVisibilityReadClient() { + return new VisibilityReadClient(buildInnerClient().getVisibilityReads()); + } + + /** + * Builds an instance of VisibilityWriteClient class. + * + * @return an instance of VisibilityWriteClient. + */ + @Generated + public VisibilityWriteClient buildVisibilityWriteClient() { + return new VisibilityWriteClient(buildInnerClient().getVisibilityWrites()); + } + + private static final ClientLogger LOGGER = new ClientLogger(VisibilityClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadAsyncClient.java new file mode 100644 index 00000000000..90609bbb6bf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadAsyncClient.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.visibility.implementation.VisibilityReadsImpl; +import tsptest.visibility.models.Dog; + +/** + * Initializes a new instance of the asynchronous VisibilityClient type. + */ +@ServiceClient(builder = VisibilityClientBuilder.class, isAsync = true) +public final class VisibilityReadAsyncClient { + @Generated + private final VisibilityReadsImpl serviceClient; + + /** + * Initializes an instance of VisibilityReadAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + VisibilityReadAsyncClient(VisibilityReadsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadClient.java new file mode 100644 index 00000000000..d6726922eed --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityReadClient.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.visibility.implementation.VisibilityReadsImpl; +import tsptest.visibility.models.Dog; + +/** + * Initializes a new instance of the synchronous VisibilityClient type. + */ +@ServiceClient(builder = VisibilityClientBuilder.class) +public final class VisibilityReadClient { + @Generated + private final VisibilityReadsImpl serviceClient; + + /** + * Initializes an instance of VisibilityReadClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + VisibilityReadClient(VisibilityReadsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Dog get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(Dog.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteAsyncClient.java new file mode 100644 index 00000000000..7ec5d34a39a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteAsyncClient.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.visibility.implementation.VisibilityWritesImpl; +import tsptest.visibility.models.Dog; +import tsptest.visibility.models.WriteDog; + +/** + * Initializes a new instance of the asynchronous VisibilityClient type. + */ +@ServiceClient(builder = VisibilityClientBuilder.class, isAsync = true) +public final class VisibilityWriteAsyncClient { + @Generated + private final VisibilityWritesImpl serviceClient; + + /** + * Initializes an instance of VisibilityWriteAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + VisibilityWriteAsyncClient(VisibilityWritesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The create operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponse(BinaryData dog, RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(dog, requestOptions); + } + + /** + * The create operation. + * + * @param dog The dog parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono create(WriteDog dog) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createWithResponse(BinaryData.fromObject(dog), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteClient.java new file mode 100644 index 00000000000..395be8d0786 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/VisibilityWriteClient.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.visibility.implementation.VisibilityWritesImpl; +import tsptest.visibility.models.Dog; +import tsptest.visibility.models.WriteDog; + +/** + * Initializes a new instance of the synchronous VisibilityClient type. + */ +@ServiceClient(builder = VisibilityClientBuilder.class) +public final class VisibilityWriteClient { + @Generated + private final VisibilityWritesImpl serviceClient; + + /** + * Initializes an instance of VisibilityWriteClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + VisibilityWriteClient(VisibilityWritesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The create operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(BinaryData dog, RequestOptions requestOptions) { + return this.serviceClient.createWithResponse(dog, requestOptions); + } + + /** + * The create operation. + * + * @param dog The dog parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Dog create(WriteDog dog) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createWithResponse(BinaryData.fromObject(dog), requestOptions).getValue().toObject(Dog.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityClientImpl.java new file mode 100644 index 00000000000..02c3456cc5b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityClientImpl.java @@ -0,0 +1,530 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the VisibilityClient type. + */ +public final class VisibilityClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final VisibilityClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 VisibilityReadsImpl object to access its operations. + */ + private final VisibilityReadsImpl visibilityReads; + + /** + * Gets the VisibilityReadsImpl object to access its operations. + * + * @return the VisibilityReadsImpl object. + */ + public VisibilityReadsImpl getVisibilityReads() { + return this.visibilityReads; + } + + /** + * The VisibilityWritesImpl object to access its operations. + */ + private final VisibilityWritesImpl visibilityWrites; + + /** + * Gets the VisibilityWritesImpl object to access its operations. + * + * @return the VisibilityWritesImpl object. + */ + public VisibilityWritesImpl getVisibilityWrites() { + return this.visibilityWrites; + } + + /** + * Initializes an instance of VisibilityClient client. + * + * @param endpoint Service host. + */ + public VisibilityClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of VisibilityClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public VisibilityClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of VisibilityClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public VisibilityClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.visibilityReads = new VisibilityReadsImpl(this); + this.visibilityWrites = new VisibilityWritesImpl(this); + this.service = RestProxy.create(VisibilityClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for VisibilityClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VisibilityClient") + public interface VisibilityClientService { + @Get("/visibility/read") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/visibility/read") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/visibility/write") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); + + @Put("/visibility/write") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); + + @Post("/visibility/query") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> query(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); + + @Post("/visibility/query") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response querySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); + + @Put("/visibility/roundtrip") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> roundtrip(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/visibility/roundtrip") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response roundtripSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The create operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(BinaryData dog, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.create(this.getEndpoint(), contentType, accept, dog, requestOptions, context)); + } + + /** + * The create operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(BinaryData dog, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.getEndpoint(), contentType, accept, dog, requestOptions, Context.NONE); + } + + /** + * The query operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> queryWithResponseAsync(BinaryData dog, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.query(this.getEndpoint(), contentType, accept, dog, requestOptions, context)); + } + + /** + * The query operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response queryWithResponse(BinaryData dog, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.querySync(this.getEndpoint(), contentType, accept, dog, requestOptions, Context.NONE); + } + + /** + * The roundtrip operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     secretName: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     secretName: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> roundtripWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.roundtrip(this.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * The roundtrip operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     secretName: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     secretName: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response roundtripWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.roundtripSync(this.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityReadsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityReadsImpl.java new file mode 100644 index 00000000000..a4aaaf6cff8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityReadsImpl.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in VisibilityReads. + */ +public final class VisibilityReadsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final VisibilityReadsService service; + + /** + * The service client containing this operation class. + */ + private final VisibilityClientImpl client; + + /** + * Initializes an instance of VisibilityReadsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VisibilityReadsImpl(VisibilityClientImpl client) { + this.service + = RestProxy.create(VisibilityReadsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for VisibilityClientVisibilityReads to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VisibilityClientVisibilityReads") + public interface VisibilityReadsService { + @Get("/read") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/read") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityWritesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityWritesImpl.java new file mode 100644 index 00000000000..97a84afde80 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/VisibilityWritesImpl.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in VisibilityWrites. + */ +public final class VisibilityWritesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final VisibilityWritesService service; + + /** + * The service client containing this operation class. + */ + private final VisibilityClientImpl client; + + /** + * Initializes an instance of VisibilityWritesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VisibilityWritesImpl(VisibilityClientImpl client) { + this.service + = RestProxy.create(VisibilityWritesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for VisibilityClientVisibilityWrites to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VisibilityClientVisibilityWrites") + public interface VisibilityWritesService { + @Put("/write") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); + + @Put("/write") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData dog, RequestOptions requestOptions, Context context); + } + + /** + * The create operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(BinaryData dog, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.create(this.client.getEndpoint(), contentType, accept, dog, requestOptions, context)); + } + + /** + * The create operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: int (Required)
+     *     secretName: String (Required)
+     *     name: String (Required)
+     * }
+     * }
+     * 
+ * + * @param dog The dog parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(BinaryData dog, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), contentType, accept, dog, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/package-info.java new file mode 100644 index 00000000000..898d7d80b54 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Visibility. + * + */ +package tsptest.visibility.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/Dog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/Dog.java new file mode 100644 index 00000000000..ded904c74cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/Dog.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Dog model. + */ +@Immutable +public final class Dog implements JsonSerializable { + /* + * The id property. + */ + @Generated + private int id; + + /* + * The secretName property. + */ + @Generated + private final String secretName; + + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Dog class. + * + * @param secretName the secretName value to set. + * @param name the name value to set. + */ + @Generated + private Dog(String secretName, String name) { + this.secretName = secretName; + this.name = name; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * Get the secretName property: The secretName property. + * + * @return the secretName value. + */ + @Generated + public String getSecretName() { + return this.secretName; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("secretName", this.secretName); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dog from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dog if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Dog. + */ + @Generated + public static Dog fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int id = 0; + String secretName = null; + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getInt(); + } else if ("secretName".equals(fieldName)) { + secretName = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + Dog deserializedDog = new Dog(secretName, name); + deserializedDog.id = id; + + return deserializedDog; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/ReadDog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/ReadDog.java new file mode 100644 index 00000000000..8247b5bb9a9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/ReadDog.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ReadDog model. + */ +@Immutable +public final class ReadDog implements JsonSerializable { + /* + * The id property. + */ + @Generated + private final int id; + + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of ReadDog class. + * + * @param id the id value to set. + * @param name the name value to set. + */ + @Generated + private ReadDog(int id, String name) { + this.id = id; + this.name = name; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("id", this.id); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ReadDog from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ReadDog if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ReadDog. + */ + @Generated + public static ReadDog fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int id = 0; + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getInt(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ReadDog(id, name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/RoundTripModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/RoundTripModel.java new file mode 100644 index 00000000000..9f58ba1e352 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/RoundTripModel.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The RoundTripModel model. + */ +@Immutable +public final class RoundTripModel implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /* + * The secretName property. + */ + @Generated + private final String secretName; + + /** + * Creates an instance of RoundTripModel class. + * + * @param name the name value to set. + * @param secretName the secretName value to set. + */ + @Generated + public RoundTripModel(String name, String secretName) { + this.name = name; + this.secretName = secretName; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the secretName property: The secretName property. + * + * @return the secretName value. + */ + @Generated + public String getSecretName() { + return this.secretName; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("secretName", this.secretName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RoundTripModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RoundTripModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RoundTripModel. + */ + @Generated + public static RoundTripModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String secretName = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("secretName".equals(fieldName)) { + secretName = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new RoundTripModel(name, secretName); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/WriteDog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/WriteDog.java new file mode 100644 index 00000000000..f25f1921d7b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/WriteDog.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The WriteDog model. + */ +@Immutable +public final class WriteDog implements JsonSerializable { + /* + * The secretName property. + */ + @Generated + private final String secretName; + + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of WriteDog class. + * + * @param secretName the secretName value to set. + * @param name the name value to set. + */ + @Generated + public WriteDog(String secretName, String name) { + this.secretName = secretName; + this.name = name; + } + + /** + * Get the secretName property: The secretName property. + * + * @return the secretName value. + */ + @Generated + public String getSecretName() { + return this.secretName; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("secretName", this.secretName); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WriteDog from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WriteDog if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WriteDog. + */ + @Generated + public static WriteDog fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String secretName = null; + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("secretName".equals(fieldName)) { + secretName = reader.getString(); + } else if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new WriteDog(secretName, name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/package-info.java new file mode 100644 index 00000000000..6c2fad59180 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Visibility. + * + */ +package tsptest.visibility.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/package-info.java new file mode 100644 index 00000000000..c7c1083359f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/visibility/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Visibility. + * + */ +package tsptest.visibility; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeAsyncClient.java new file mode 100644 index 00000000000..666d435fc72 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeAsyncClient.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.wiretype; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.wiretype.implementation.WireTypeOpsImpl; +import tsptest.wiretype.models.SubClass; +import tsptest.wiretype.models.SubClassBothMismatch; +import tsptest.wiretype.models.SubClassMismatch; + +/** + * Initializes a new instance of the asynchronous WireTypeClient type. + */ +@ServiceClient(builder = WireTypeClientBuilder.class, isAsync = true) +public final class WireTypeAsyncClient { + @Generated + private final WireTypeOpsImpl serviceClient; + + /** + * Initializes an instance of WireTypeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + WireTypeAsyncClient(WireTypeOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The superClassMismatch operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     dateTime: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     dateTime: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> superClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.superClassMismatchWithResponseAsync(body, requestOptions); + } + + /** + * The subClassMismatch operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTime: OffsetDateTime (Required)
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTime: OffsetDateTime (Required)
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> subClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.subClassMismatchWithResponseAsync(body, requestOptions); + } + + /** + * The bothClassMismatch operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     base64url: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     base64url: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> bothClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.bothClassMismatchWithResponseAsync(body, requestOptions); + } + + /** + * The superClassMismatch operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono superClassMismatch(SubClass body) { + // Generated convenience method for superClassMismatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + return superClassMismatchWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SubClass.class)); + } + + /** + * The subClassMismatch operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono subClassMismatch(SubClassMismatch body) { + // Generated convenience method for subClassMismatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + return subClassMismatchWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SubClassMismatch.class)); + } + + /** + * The bothClassMismatch operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono bothClassMismatch(SubClassBothMismatch body) { + // Generated convenience method for bothClassMismatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + return bothClassMismatchWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SubClassBothMismatch.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClient.java new file mode 100644 index 00000000000..35b647d8d0a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClient.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.wiretype; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.wiretype.implementation.WireTypeOpsImpl; +import tsptest.wiretype.models.SubClass; +import tsptest.wiretype.models.SubClassBothMismatch; +import tsptest.wiretype.models.SubClassMismatch; + +/** + * Initializes a new instance of the synchronous WireTypeClient type. + */ +@ServiceClient(builder = WireTypeClientBuilder.class) +public final class WireTypeClient { + @Generated + private final WireTypeOpsImpl serviceClient; + + /** + * Initializes an instance of WireTypeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + WireTypeClient(WireTypeOpsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The superClassMismatch operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     dateTime: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     dateTime: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response superClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.superClassMismatchWithResponse(body, requestOptions); + } + + /** + * The subClassMismatch operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTime: OffsetDateTime (Required)
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTime: OffsetDateTime (Required)
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response subClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.subClassMismatchWithResponse(body, requestOptions); + } + + /** + * The bothClassMismatch operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     base64url: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     base64url: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response bothClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.bothClassMismatchWithResponse(body, requestOptions); + } + + /** + * The superClassMismatch operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SubClass superClassMismatch(SubClass body) { + // Generated convenience method for superClassMismatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + return superClassMismatchWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(SubClass.class); + } + + /** + * The subClassMismatch operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SubClassMismatch subClassMismatch(SubClassMismatch body) { + // Generated convenience method for subClassMismatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + return subClassMismatchWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(SubClassMismatch.class); + } + + /** + * The bothClassMismatch operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SubClassBothMismatch bothClassMismatch(SubClassBothMismatch body) { + // Generated convenience method for bothClassMismatchWithResponse + RequestOptions requestOptions = new RequestOptions(); + return bothClassMismatchWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(SubClassBothMismatch.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClientBuilder.java new file mode 100644 index 00000000000..2d6f06bdacf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/WireTypeClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.wiretype; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.wiretype.implementation.WireTypeClientImpl; + +/** + * A builder for creating a new instance of the WireTypeClient type. + */ +@ServiceClientBuilder(serviceClients = { WireTypeClient.class, WireTypeAsyncClient.class }) +public final class WireTypeClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-wiretype.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the WireTypeClientBuilder. + */ + @Generated + public WireTypeClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WireTypeClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WireTypeClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WireTypeClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WireTypeClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WireTypeClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WireTypeClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WireTypeClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WireTypeClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the WireTypeClientBuilder. + */ + @Generated + public WireTypeClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of WireTypeClientImpl with the provided parameters. + * + * @return an instance of WireTypeClientImpl. + */ + @Generated + private WireTypeClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + WireTypeClientImpl client + = new WireTypeClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of WireTypeAsyncClient class. + * + * @return an instance of WireTypeAsyncClient. + */ + @Generated + public WireTypeAsyncClient buildAsyncClient() { + return new WireTypeAsyncClient(buildInnerClient().getWireTypeOps()); + } + + /** + * Builds an instance of WireTypeClient class. + * + * @return an instance of WireTypeClient. + */ + @Generated + public WireTypeClient buildClient() { + return new WireTypeClient(buildInnerClient().getWireTypeOps()); + } + + private static final ClientLogger LOGGER = new ClientLogger(WireTypeClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeClientImpl.java new file mode 100644 index 00000000000..b64d26f0c14 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.wiretype.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 WireTypeClient type. + */ +public final class WireTypeClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 WireTypeOpsImpl object to access its operations. + */ + private final WireTypeOpsImpl wireTypeOps; + + /** + * Gets the WireTypeOpsImpl object to access its operations. + * + * @return the WireTypeOpsImpl object. + */ + public WireTypeOpsImpl getWireTypeOps() { + return this.wireTypeOps; + } + + /** + * Initializes an instance of WireTypeClient client. + * + * @param endpoint Service host. + */ + public WireTypeClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of WireTypeClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public WireTypeClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of WireTypeClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public WireTypeClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.wireTypeOps = new WireTypeOpsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeOpsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeOpsImpl.java new file mode 100644 index 00000000000..5ed40acce71 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/WireTypeOpsImpl.java @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.wiretype.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in WireTypeOps. + */ +public final class WireTypeOpsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final WireTypeOpsService service; + + /** + * The service client containing this operation class. + */ + private final WireTypeClientImpl client; + + /** + * Initializes an instance of WireTypeOpsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WireTypeOpsImpl(WireTypeClientImpl client) { + this.service + = RestProxy.create(WireTypeOpsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for WireTypeClientWireTypeOps to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "WireTypeClientWireTypeOps") + public interface WireTypeOpsService { + @Put("/wireType/superClassMismatch") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> superClassMismatch(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/wireType/superClassMismatch") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response superClassMismatchSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/wireType/subClassMismatch") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> subClassMismatch(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/wireType/subClassMismatch") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response subClassMismatchSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/wireType/bothClassMismatch") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> bothClassMismatch(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Put("/wireType/bothClassMismatch") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response bothClassMismatchSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The superClassMismatch operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     dateTime: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     dateTime: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> superClassMismatchWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.superClassMismatch(this.client.getEndpoint(), contentType, + accept, body, requestOptions, context)); + } + + /** + * The superClassMismatch operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     dateTime: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     dateTime: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response superClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.superClassMismatchSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The subClassMismatch operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTime: OffsetDateTime (Required)
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTime: OffsetDateTime (Required)
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> subClassMismatchWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.subClassMismatch(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The subClassMismatch operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTime: OffsetDateTime (Required)
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTime: OffsetDateTime (Required)
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response subClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.subClassMismatchSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } + + /** + * The bothClassMismatch operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     base64url: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     base64url: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> bothClassMismatchWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.bothClassMismatch(this.client.getEndpoint(), contentType, accept, + body, requestOptions, context)); + } + + /** + * The bothClassMismatch operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     base64url: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     dateTimeRfc7231: DateTimeRfc1123 (Required)
+     *     base64url: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response bothClassMismatchWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.bothClassMismatchSync(this.client.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/package-info.java new file mode 100644 index 00000000000..e8522fb09bc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for WireType. + * Test for mismatch of wire type and client type on class constructors. + * + */ +package tsptest.wiretype.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClass.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClass.java new file mode 100644 index 00000000000..1a6b9950751 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClass.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.wiretype.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Objects; + +/** + * The SubClass model. + */ +@Immutable +public final class SubClass extends SuperClassMismatch { + /* + * The dateTime property. + */ + @Generated + private final OffsetDateTime dateTime; + + /** + * Creates an instance of SubClass class. + * + * @param dateTimeRfc7231 the dateTimeRfc7231 value to set. + * @param dateTime the dateTime value to set. + */ + @Generated + public SubClass(OffsetDateTime dateTimeRfc7231, OffsetDateTime dateTime) { + super(dateTimeRfc7231); + this.dateTime = dateTime; + } + + /** + * Get the dateTime property: The dateTime property. + * + * @return the dateTime value. + */ + @Generated + public OffsetDateTime getDateTime() { + return this.dateTime; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (getDateTimeRfc7231() != null) { + jsonWriter.writeStringField("dateTimeRfc7231", + Objects.toString(new DateTimeRfc1123(getDateTimeRfc7231()), null)); + } + jsonWriter.writeStringField("dateTime", + this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubClass from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubClass if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubClass. + */ + @Generated + public static SubClass fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffsetDateTime dateTimeRfc7231 = null; + OffsetDateTime dateTime = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dateTimeRfc7231".equals(fieldName)) { + DateTimeRfc1123 dateTimeRfc7231Holder + = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); + if (dateTimeRfc7231Holder != null) { + dateTimeRfc7231 = dateTimeRfc7231Holder.getDateTime(); + } + } else if ("dateTime".equals(fieldName)) { + dateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new SubClass(dateTimeRfc7231, dateTime); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassBothMismatch.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassBothMismatch.java new file mode 100644 index 00000000000..24ab87dce2b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassBothMismatch.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.wiretype.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.Base64Url; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Objects; + +/** + * The SubClassBothMismatch model. + */ +@Immutable +public final class SubClassBothMismatch extends SuperClassMismatch { + /* + * The base64url property. + */ + @Generated + private final Base64Url base64url; + + /** + * Creates an instance of SubClassBothMismatch class. + * + * @param dateTimeRfc7231 the dateTimeRfc7231 value to set. + * @param base64url the base64url value to set. + */ + @Generated + public SubClassBothMismatch(OffsetDateTime dateTimeRfc7231, byte[] base64url) { + super(dateTimeRfc7231); + if (base64url == null) { + this.base64url = null; + } else { + this.base64url = Base64Url.encode(base64url); + } + } + + /** + * Get the base64url property: The base64url property. + * + * @return the base64url value. + */ + @Generated + public byte[] getBase64url() { + if (this.base64url == null) { + return null; + } + return this.base64url.decodedBytes(); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (getDateTimeRfc7231() != null) { + jsonWriter.writeStringField("dateTimeRfc7231", + Objects.toString(new DateTimeRfc1123(getDateTimeRfc7231()), null)); + } + jsonWriter.writeStringField("base64url", Objects.toString(this.base64url, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubClassBothMismatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubClassBothMismatch if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubClassBothMismatch. + */ + @Generated + public static SubClassBothMismatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffsetDateTime dateTimeRfc7231 = null; + byte[] base64url = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dateTimeRfc7231".equals(fieldName)) { + DateTimeRfc1123 dateTimeRfc7231Holder + = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); + if (dateTimeRfc7231Holder != null) { + dateTimeRfc7231 = dateTimeRfc7231Holder.getDateTime(); + } + } else if ("base64url".equals(fieldName)) { + Base64Url base64urlHolder + = reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); + if (base64urlHolder != null) { + base64url = base64urlHolder.decodedBytes(); + } + } else { + reader.skipChildren(); + } + } + return new SubClassBothMismatch(dateTimeRfc7231, base64url); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassMismatch.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassMismatch.java new file mode 100644 index 00000000000..f2150e44a93 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SubClassMismatch.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.wiretype.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Objects; + +/** + * The SubClassMismatch model. + */ +@Immutable +public final class SubClassMismatch extends SuperClass { + /* + * The dateTimeRfc7231 property. + */ + @Generated + private final DateTimeRfc1123 dateTimeRfc7231; + + /** + * Creates an instance of SubClassMismatch class. + * + * @param dateTime the dateTime value to set. + * @param dateTimeRfc7231 the dateTimeRfc7231 value to set. + */ + @Generated + public SubClassMismatch(OffsetDateTime dateTime, OffsetDateTime dateTimeRfc7231) { + super(dateTime); + if (dateTimeRfc7231 == null) { + this.dateTimeRfc7231 = null; + } else { + this.dateTimeRfc7231 = new DateTimeRfc1123(dateTimeRfc7231); + } + } + + /** + * Get the dateTimeRfc7231 property: The dateTimeRfc7231 property. + * + * @return the dateTimeRfc7231 value. + */ + @Generated + public OffsetDateTime getDateTimeRfc7231() { + if (this.dateTimeRfc7231 == null) { + return null; + } + return this.dateTimeRfc7231.getDateTime(); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dateTime", + getDateTime() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getDateTime())); + jsonWriter.writeStringField("dateTimeRfc7231", Objects.toString(this.dateTimeRfc7231, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubClassMismatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubClassMismatch if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubClassMismatch. + */ + @Generated + public static SubClassMismatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffsetDateTime dateTime = null; + OffsetDateTime dateTimeRfc7231 = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dateTime".equals(fieldName)) { + dateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("dateTimeRfc7231".equals(fieldName)) { + DateTimeRfc1123 dateTimeRfc7231Holder + = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); + if (dateTimeRfc7231Holder != null) { + dateTimeRfc7231 = dateTimeRfc7231Holder.getDateTime(); + } + } else { + reader.skipChildren(); + } + } + return new SubClassMismatch(dateTime, dateTimeRfc7231); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClass.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClass.java new file mode 100644 index 00000000000..ff699da09be --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClass.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.wiretype.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The SuperClass model. + */ +@Immutable +public class SuperClass implements JsonSerializable { + /* + * The dateTime property. + */ + @Generated + private final OffsetDateTime dateTime; + + /** + * Creates an instance of SuperClass class. + * + * @param dateTime the dateTime value to set. + */ + @Generated + public SuperClass(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + /** + * Get the dateTime property: The dateTime property. + * + * @return the dateTime value. + */ + @Generated + public OffsetDateTime getDateTime() { + return this.dateTime; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dateTime", + this.dateTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.dateTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SuperClass from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SuperClass if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SuperClass. + */ + @Generated + public static SuperClass fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffsetDateTime dateTime = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dateTime".equals(fieldName)) { + dateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new SuperClass(dateTime); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClassMismatch.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClassMismatch.java new file mode 100644 index 00000000000..7a87e91cd3a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/SuperClassMismatch.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.wiretype.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Objects; + +/** + * The SuperClassMismatch model. + */ +@Immutable +public class SuperClassMismatch implements JsonSerializable { + /* + * The dateTimeRfc7231 property. + */ + @Generated + private final DateTimeRfc1123 dateTimeRfc7231; + + /** + * Creates an instance of SuperClassMismatch class. + * + * @param dateTimeRfc7231 the dateTimeRfc7231 value to set. + */ + @Generated + public SuperClassMismatch(OffsetDateTime dateTimeRfc7231) { + if (dateTimeRfc7231 == null) { + this.dateTimeRfc7231 = null; + } else { + this.dateTimeRfc7231 = new DateTimeRfc1123(dateTimeRfc7231); + } + } + + /** + * Get the dateTimeRfc7231 property: The dateTimeRfc7231 property. + * + * @return the dateTimeRfc7231 value. + */ + @Generated + public OffsetDateTime getDateTimeRfc7231() { + if (this.dateTimeRfc7231 == null) { + return null; + } + return this.dateTimeRfc7231.getDateTime(); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("dateTimeRfc7231", Objects.toString(this.dateTimeRfc7231, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SuperClassMismatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SuperClassMismatch if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SuperClassMismatch. + */ + @Generated + public static SuperClassMismatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffsetDateTime dateTimeRfc7231 = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dateTimeRfc7231".equals(fieldName)) { + DateTimeRfc1123 dateTimeRfc7231Holder + = reader.getNullable(nonNullReader -> new DateTimeRfc1123(nonNullReader.getString())); + if (dateTimeRfc7231Holder != null) { + dateTimeRfc7231 = dateTimeRfc7231Holder.getDateTime(); + } + } else { + reader.skipChildren(); + } + } + return new SuperClassMismatch(dateTimeRfc7231); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/package-info.java new file mode 100644 index 00000000000..5f78f933966 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for WireType. + * Test for mismatch of wire type and client type on class constructors. + * + */ +package tsptest.wiretype.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/package-info.java new file mode 100644 index 00000000000..57796558c83 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/wiretype/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for WireType. + * Test for mismatch of wire type and client type on class constructors. + * + */ +package tsptest.wiretype; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ArrayClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ArrayClientBuilder.java new file mode 100644 index 00000000000..3a6fe7df9d3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ArrayClientBuilder.java @@ -0,0 +1,576 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.array.implementation.ArrayClientImpl; + +/** + * A builder for creating a new instance of the ArrayClient type. + */ +@ServiceClientBuilder( + serviceClients = { + Int32ValueClient.class, + Int64ValueClient.class, + BooleanValueClient.class, + StringValueClient.class, + Float32ValueClient.class, + DatetimeValueClient.class, + DurationValueClient.class, + UnknownValueClient.class, + ModelValueClient.class, + NullableFloatValueClient.class, + NullableInt32ValueClient.class, + NullableBooleanValueClient.class, + NullableStringValueClient.class, + NullableModelValueClient.class, + Int32ValueAsyncClient.class, + Int64ValueAsyncClient.class, + BooleanValueAsyncClient.class, + StringValueAsyncClient.class, + Float32ValueAsyncClient.class, + DatetimeValueAsyncClient.class, + DurationValueAsyncClient.class, + UnknownValueAsyncClient.class, + ModelValueAsyncClient.class, + NullableFloatValueAsyncClient.class, + NullableInt32ValueAsyncClient.class, + NullableBooleanValueAsyncClient.class, + NullableStringValueAsyncClient.class, + NullableModelValueAsyncClient.class }) +public final class ArrayClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("type-array.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ArrayClientBuilder. + */ + @Generated + public ArrayClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ArrayClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ArrayClientBuilder. + */ + @Generated + public ArrayClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ArrayClientImpl with the provided parameters. + * + * @return an instance of ArrayClientImpl. + */ + @Generated + private ArrayClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ArrayClientImpl client + = new ArrayClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of Int32ValueAsyncClient class. + * + * @return an instance of Int32ValueAsyncClient. + */ + @Generated + public Int32ValueAsyncClient buildInt32ValueAsyncClient() { + return new Int32ValueAsyncClient(buildInnerClient().getInt32Values()); + } + + /** + * Builds an instance of Int64ValueAsyncClient class. + * + * @return an instance of Int64ValueAsyncClient. + */ + @Generated + public Int64ValueAsyncClient buildInt64ValueAsyncClient() { + return new Int64ValueAsyncClient(buildInnerClient().getInt64Values()); + } + + /** + * Builds an instance of BooleanValueAsyncClient class. + * + * @return an instance of BooleanValueAsyncClient. + */ + @Generated + public BooleanValueAsyncClient buildBooleanValueAsyncClient() { + return new BooleanValueAsyncClient(buildInnerClient().getBooleanValues()); + } + + /** + * Builds an instance of StringValueAsyncClient class. + * + * @return an instance of StringValueAsyncClient. + */ + @Generated + public StringValueAsyncClient buildStringValueAsyncClient() { + return new StringValueAsyncClient(buildInnerClient().getStringValues()); + } + + /** + * Builds an instance of Float32ValueAsyncClient class. + * + * @return an instance of Float32ValueAsyncClient. + */ + @Generated + public Float32ValueAsyncClient buildFloat32ValueAsyncClient() { + return new Float32ValueAsyncClient(buildInnerClient().getFloat32Values()); + } + + /** + * Builds an instance of DatetimeValueAsyncClient class. + * + * @return an instance of DatetimeValueAsyncClient. + */ + @Generated + public DatetimeValueAsyncClient buildDatetimeValueAsyncClient() { + return new DatetimeValueAsyncClient(buildInnerClient().getDatetimeValues()); + } + + /** + * Builds an instance of DurationValueAsyncClient class. + * + * @return an instance of DurationValueAsyncClient. + */ + @Generated + public DurationValueAsyncClient buildDurationValueAsyncClient() { + return new DurationValueAsyncClient(buildInnerClient().getDurationValues()); + } + + /** + * Builds an instance of UnknownValueAsyncClient class. + * + * @return an instance of UnknownValueAsyncClient. + */ + @Generated + public UnknownValueAsyncClient buildUnknownValueAsyncClient() { + return new UnknownValueAsyncClient(buildInnerClient().getUnknownValues()); + } + + /** + * Builds an instance of ModelValueAsyncClient class. + * + * @return an instance of ModelValueAsyncClient. + */ + @Generated + public ModelValueAsyncClient buildModelValueAsyncClient() { + return new ModelValueAsyncClient(buildInnerClient().getModelValues()); + } + + /** + * Builds an instance of NullableFloatValueAsyncClient class. + * + * @return an instance of NullableFloatValueAsyncClient. + */ + @Generated + public NullableFloatValueAsyncClient buildNullableFloatValueAsyncClient() { + return new NullableFloatValueAsyncClient(buildInnerClient().getNullableFloatValues()); + } + + /** + * Builds an instance of NullableInt32ValueAsyncClient class. + * + * @return an instance of NullableInt32ValueAsyncClient. + */ + @Generated + public NullableInt32ValueAsyncClient buildNullableInt32ValueAsyncClient() { + return new NullableInt32ValueAsyncClient(buildInnerClient().getNullableInt32Values()); + } + + /** + * Builds an instance of NullableBooleanValueAsyncClient class. + * + * @return an instance of NullableBooleanValueAsyncClient. + */ + @Generated + public NullableBooleanValueAsyncClient buildNullableBooleanValueAsyncClient() { + return new NullableBooleanValueAsyncClient(buildInnerClient().getNullableBooleanValues()); + } + + /** + * Builds an instance of NullableStringValueAsyncClient class. + * + * @return an instance of NullableStringValueAsyncClient. + */ + @Generated + public NullableStringValueAsyncClient buildNullableStringValueAsyncClient() { + return new NullableStringValueAsyncClient(buildInnerClient().getNullableStringValues()); + } + + /** + * Builds an instance of NullableModelValueAsyncClient class. + * + * @return an instance of NullableModelValueAsyncClient. + */ + @Generated + public NullableModelValueAsyncClient buildNullableModelValueAsyncClient() { + return new NullableModelValueAsyncClient(buildInnerClient().getNullableModelValues()); + } + + /** + * Builds an instance of Int32ValueClient class. + * + * @return an instance of Int32ValueClient. + */ + @Generated + public Int32ValueClient buildInt32ValueClient() { + return new Int32ValueClient(buildInnerClient().getInt32Values()); + } + + /** + * Builds an instance of Int64ValueClient class. + * + * @return an instance of Int64ValueClient. + */ + @Generated + public Int64ValueClient buildInt64ValueClient() { + return new Int64ValueClient(buildInnerClient().getInt64Values()); + } + + /** + * Builds an instance of BooleanValueClient class. + * + * @return an instance of BooleanValueClient. + */ + @Generated + public BooleanValueClient buildBooleanValueClient() { + return new BooleanValueClient(buildInnerClient().getBooleanValues()); + } + + /** + * Builds an instance of StringValueClient class. + * + * @return an instance of StringValueClient. + */ + @Generated + public StringValueClient buildStringValueClient() { + return new StringValueClient(buildInnerClient().getStringValues()); + } + + /** + * Builds an instance of Float32ValueClient class. + * + * @return an instance of Float32ValueClient. + */ + @Generated + public Float32ValueClient buildFloat32ValueClient() { + return new Float32ValueClient(buildInnerClient().getFloat32Values()); + } + + /** + * Builds an instance of DatetimeValueClient class. + * + * @return an instance of DatetimeValueClient. + */ + @Generated + public DatetimeValueClient buildDatetimeValueClient() { + return new DatetimeValueClient(buildInnerClient().getDatetimeValues()); + } + + /** + * Builds an instance of DurationValueClient class. + * + * @return an instance of DurationValueClient. + */ + @Generated + public DurationValueClient buildDurationValueClient() { + return new DurationValueClient(buildInnerClient().getDurationValues()); + } + + /** + * Builds an instance of UnknownValueClient class. + * + * @return an instance of UnknownValueClient. + */ + @Generated + public UnknownValueClient buildUnknownValueClient() { + return new UnknownValueClient(buildInnerClient().getUnknownValues()); + } + + /** + * Builds an instance of ModelValueClient class. + * + * @return an instance of ModelValueClient. + */ + @Generated + public ModelValueClient buildModelValueClient() { + return new ModelValueClient(buildInnerClient().getModelValues()); + } + + /** + * Builds an instance of NullableFloatValueClient class. + * + * @return an instance of NullableFloatValueClient. + */ + @Generated + public NullableFloatValueClient buildNullableFloatValueClient() { + return new NullableFloatValueClient(buildInnerClient().getNullableFloatValues()); + } + + /** + * Builds an instance of NullableInt32ValueClient class. + * + * @return an instance of NullableInt32ValueClient. + */ + @Generated + public NullableInt32ValueClient buildNullableInt32ValueClient() { + return new NullableInt32ValueClient(buildInnerClient().getNullableInt32Values()); + } + + /** + * Builds an instance of NullableBooleanValueClient class. + * + * @return an instance of NullableBooleanValueClient. + */ + @Generated + public NullableBooleanValueClient buildNullableBooleanValueClient() { + return new NullableBooleanValueClient(buildInnerClient().getNullableBooleanValues()); + } + + /** + * Builds an instance of NullableStringValueClient class. + * + * @return an instance of NullableStringValueClient. + */ + @Generated + public NullableStringValueClient buildNullableStringValueClient() { + return new NullableStringValueClient(buildInnerClient().getNullableStringValues()); + } + + /** + * Builds an instance of NullableModelValueClient class. + * + * @return an instance of NullableModelValueClient. + */ + @Generated + public NullableModelValueClient buildNullableModelValueClient() { + return new NullableModelValueClient(buildInnerClient().getNullableModelValues()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ArrayClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueAsyncClient.java new file mode 100644 index 00000000000..9bbf1671c6b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueAsyncClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.BooleanValuesImpl; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class BooleanValueAsyncClient { + @Generated + private final BooleanValuesImpl serviceClient; + + /** + * Initializes an instance of BooleanValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BooleanValueAsyncClient(BooleanValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_BOOLEAN)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_BOOLEAN = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueClient.java new file mode 100644 index 00000000000..e3d731f5b6c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/BooleanValueClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import type.array.implementation.BooleanValuesImpl; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class BooleanValueClient { + @Generated + private final BooleanValuesImpl serviceClient; + + /** + * Initializes an instance of BooleanValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BooleanValueClient(BooleanValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_BOOLEAN); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_BOOLEAN = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueAsyncClient.java new file mode 100644 index 00000000000..cb1702e76de --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueAsyncClient.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.time.OffsetDateTime; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.DatetimeValuesImpl; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class DatetimeValueAsyncClient { + @Generated + private final DatetimeValuesImpl serviceClient; + + /** + * Initializes an instance of DatetimeValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DatetimeValueAsyncClient(DatetimeValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     OffsetDateTime (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     OffsetDateTime (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_OFFSET_DATE_TIME)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_OFFSET_DATE_TIME + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueClient.java new file mode 100644 index 00000000000..44734afc6b7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DatetimeValueClient.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.time.OffsetDateTime; +import java.util.List; +import type.array.implementation.DatetimeValuesImpl; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class DatetimeValueClient { + @Generated + private final DatetimeValuesImpl serviceClient; + + /** + * Initializes an instance of DatetimeValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DatetimeValueClient(DatetimeValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     OffsetDateTime (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     OffsetDateTime (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_OFFSET_DATE_TIME); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_OFFSET_DATE_TIME + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueAsyncClient.java new file mode 100644 index 00000000000..8d6f9523d03 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueAsyncClient.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.DurationValuesImpl; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class DurationValueAsyncClient { + @Generated + private final DurationValuesImpl serviceClient; + + /** + * Initializes an instance of DurationValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DurationValueAsyncClient(DurationValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     Duration (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     Duration (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_DURATION)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_DURATION + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueClient.java new file mode 100644 index 00000000000..b3ba03b23bc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/DurationValueClient.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.util.List; +import type.array.implementation.DurationValuesImpl; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class DurationValueClient { + @Generated + private final DurationValuesImpl serviceClient; + + /** + * Initializes an instance of DurationValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DurationValueClient(DurationValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     Duration (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     Duration (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_DURATION); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_DURATION + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueAsyncClient.java new file mode 100644 index 00000000000..a1386b1c24e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueAsyncClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.Float32ValuesImpl; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class Float32ValueAsyncClient { + @Generated + private final Float32ValuesImpl serviceClient; + + /** + * Initializes an instance of Float32ValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Float32ValueAsyncClient(Float32ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_DOUBLE)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_DOUBLE = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueClient.java new file mode 100644 index 00000000000..608520729dc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Float32ValueClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import type.array.implementation.Float32ValuesImpl; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class Float32ValueClient { + @Generated + private final Float32ValuesImpl serviceClient; + + /** + * Initializes an instance of Float32ValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Float32ValueClient(Float32ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_DOUBLE); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_DOUBLE = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueAsyncClient.java new file mode 100644 index 00000000000..0a837dad9ef --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueAsyncClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.Int32ValuesImpl; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class Int32ValueAsyncClient { + @Generated + private final Int32ValuesImpl serviceClient; + + /** + * Initializes an instance of Int32ValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Int32ValueAsyncClient(Int32ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_INTEGER)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_INTEGER = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueClient.java new file mode 100644 index 00000000000..305700f8374 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int32ValueClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import type.array.implementation.Int32ValuesImpl; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class Int32ValueClient { + @Generated + private final Int32ValuesImpl serviceClient; + + /** + * Initializes an instance of Int32ValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Int32ValueClient(Int32ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_INTEGER); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_INTEGER = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueAsyncClient.java new file mode 100644 index 00000000000..34d07aa6663 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueAsyncClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.Int64ValuesImpl; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class Int64ValueAsyncClient { + @Generated + private final Int64ValuesImpl serviceClient; + + /** + * Initializes an instance of Int64ValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Int64ValueAsyncClient(Int64ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     long (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     long (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_LONG)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_LONG = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueClient.java new file mode 100644 index 00000000000..cfb8b0a58a7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/Int64ValueClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import type.array.implementation.Int64ValuesImpl; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class Int64ValueClient { + @Generated + private final Int64ValuesImpl serviceClient; + + /** + * Initializes an instance of Int64ValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Int64ValueClient(Int64ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     long (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     long (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_LONG); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_LONG = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueAsyncClient.java new file mode 100644 index 00000000000..bc5ade7e421 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueAsyncClient.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.ModelValuesImpl; +import type.array.models.InnerModel; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class ModelValueAsyncClient { + @Generated + private final ModelValuesImpl serviceClient; + + /** + * Initializes an instance of ModelValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelValueAsyncClient(ModelValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_INNER_MODEL)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_INNER_MODEL + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueClient.java new file mode 100644 index 00000000000..be1be233064 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/ModelValueClient.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import type.array.implementation.ModelValuesImpl; +import type.array.models.InnerModel; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class ModelValueClient { + @Generated + private final ModelValuesImpl serviceClient; + + /** + * Initializes an instance of ModelValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelValueClient(ModelValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_INNER_MODEL); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_INNER_MODEL + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueAsyncClient.java new file mode 100644 index 00000000000..888d98930fa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueAsyncClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.NullableBooleanValuesImpl; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class NullableBooleanValueAsyncClient { + @Generated + private final NullableBooleanValuesImpl serviceClient; + + /** + * Initializes an instance of NullableBooleanValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NullableBooleanValueAsyncClient(NullableBooleanValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_BOOLEAN)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_BOOLEAN = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueClient.java new file mode 100644 index 00000000000..5e483140a5c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableBooleanValueClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import type.array.implementation.NullableBooleanValuesImpl; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class NullableBooleanValueClient { + @Generated + private final NullableBooleanValuesImpl serviceClient; + + /** + * Initializes an instance of NullableBooleanValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NullableBooleanValueClient(NullableBooleanValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_BOOLEAN); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_BOOLEAN = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueAsyncClient.java new file mode 100644 index 00000000000..18038c63a41 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueAsyncClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.NullableFloatValuesImpl; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class NullableFloatValueAsyncClient { + @Generated + private final NullableFloatValuesImpl serviceClient; + + /** + * Initializes an instance of NullableFloatValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NullableFloatValueAsyncClient(NullableFloatValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_DOUBLE)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_DOUBLE = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueClient.java new file mode 100644 index 00000000000..0b51260004d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableFloatValueClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import type.array.implementation.NullableFloatValuesImpl; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class NullableFloatValueClient { + @Generated + private final NullableFloatValuesImpl serviceClient; + + /** + * Initializes an instance of NullableFloatValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NullableFloatValueClient(NullableFloatValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_DOUBLE); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_DOUBLE = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueAsyncClient.java new file mode 100644 index 00000000000..fe69a1dcdc2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueAsyncClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.NullableInt32ValuesImpl; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class NullableInt32ValueAsyncClient { + @Generated + private final NullableInt32ValuesImpl serviceClient; + + /** + * Initializes an instance of NullableInt32ValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NullableInt32ValueAsyncClient(NullableInt32ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_INTEGER)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_INTEGER = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueClient.java new file mode 100644 index 00000000000..6e035666975 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableInt32ValueClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import type.array.implementation.NullableInt32ValuesImpl; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class NullableInt32ValueClient { + @Generated + private final NullableInt32ValuesImpl serviceClient; + + /** + * Initializes an instance of NullableInt32ValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NullableInt32ValueClient(NullableInt32ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_INTEGER); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_INTEGER = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueAsyncClient.java new file mode 100644 index 00000000000..c927f36fddc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueAsyncClient.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.NullableModelValuesImpl; +import type.array.models.InnerModel; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class NullableModelValueAsyncClient { + @Generated + private final NullableModelValuesImpl serviceClient; + + /** + * Initializes an instance of NullableModelValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NullableModelValueAsyncClient(NullableModelValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_INNER_MODEL)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_INNER_MODEL + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueClient.java new file mode 100644 index 00000000000..f591e6052b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableModelValueClient.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import type.array.implementation.NullableModelValuesImpl; +import type.array.models.InnerModel; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class NullableModelValueClient { + @Generated + private final NullableModelValuesImpl serviceClient; + + /** + * Initializes an instance of NullableModelValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NullableModelValueClient(NullableModelValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_INNER_MODEL); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_INNER_MODEL + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueAsyncClient.java new file mode 100644 index 00000000000..c7db9b11b31 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueAsyncClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.NullableStringValuesImpl; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class NullableStringValueAsyncClient { + @Generated + private final NullableStringValuesImpl serviceClient; + + /** + * Initializes an instance of NullableStringValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NullableStringValueAsyncClient(NullableStringValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_STRING)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_STRING = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueClient.java new file mode 100644 index 00000000000..aadd9cb42c6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/NullableStringValueClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import type.array.implementation.NullableStringValuesImpl; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class NullableStringValueClient { + @Generated + private final NullableStringValuesImpl serviceClient; + + /** + * Initializes an instance of NullableStringValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NullableStringValueClient(NullableStringValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_STRING); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_STRING = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueAsyncClient.java new file mode 100644 index 00000000000..def28fad6ed --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueAsyncClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.StringValuesImpl; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class StringValueAsyncClient { + @Generated + private final StringValuesImpl serviceClient; + + /** + * Initializes an instance of StringValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringValueAsyncClient(StringValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_STRING)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_STRING = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueClient.java new file mode 100644 index 00000000000..1e84dd09242 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/StringValueClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import type.array.implementation.StringValuesImpl; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class StringValueClient { + @Generated + private final StringValuesImpl serviceClient; + + /** + * Initializes an instance of StringValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringValueClient(StringValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_STRING); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_STRING = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueAsyncClient.java new file mode 100644 index 00000000000..61d56f34f48 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueAsyncClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import reactor.core.publisher.Mono; +import type.array.implementation.UnknownValuesImpl; + +/** + * Initializes a new instance of the asynchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class, isAsync = true) +public final class UnknownValueAsyncClient { + @Generated + private final UnknownValuesImpl serviceClient; + + /** + * Initializes an instance of UnknownValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownValueAsyncClient(UnknownValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     Object (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     Object (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_OBJECT)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_OBJECT = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueClient.java new file mode 100644 index 00000000000..d6195f34cfc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/UnknownValueClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.List; +import type.array.implementation.UnknownValuesImpl; + +/** + * Initializes a new instance of the synchronous ArrayClient type. + */ +@ServiceClient(builder = ArrayClientBuilder.class) +public final class UnknownValueClient { + @Generated + private final UnknownValuesImpl serviceClient; + + /** + * Initializes an instance of UnknownValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownValueClient(UnknownValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     Object (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     Object (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_OBJECT); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(List body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_OBJECT = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ArrayClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ArrayClientImpl.java new file mode 100644 index 00000000000..893f261aa01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ArrayClientImpl.java @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 ArrayClient type. + */ +public final class ArrayClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 Int32ValuesImpl object to access its operations. + */ + private final Int32ValuesImpl int32Values; + + /** + * Gets the Int32ValuesImpl object to access its operations. + * + * @return the Int32ValuesImpl object. + */ + public Int32ValuesImpl getInt32Values() { + return this.int32Values; + } + + /** + * The Int64ValuesImpl object to access its operations. + */ + private final Int64ValuesImpl int64Values; + + /** + * Gets the Int64ValuesImpl object to access its operations. + * + * @return the Int64ValuesImpl object. + */ + public Int64ValuesImpl getInt64Values() { + return this.int64Values; + } + + /** + * The BooleanValuesImpl object to access its operations. + */ + private final BooleanValuesImpl booleanValues; + + /** + * Gets the BooleanValuesImpl object to access its operations. + * + * @return the BooleanValuesImpl object. + */ + public BooleanValuesImpl getBooleanValues() { + return this.booleanValues; + } + + /** + * The StringValuesImpl object to access its operations. + */ + private final StringValuesImpl stringValues; + + /** + * Gets the StringValuesImpl object to access its operations. + * + * @return the StringValuesImpl object. + */ + public StringValuesImpl getStringValues() { + return this.stringValues; + } + + /** + * The Float32ValuesImpl object to access its operations. + */ + private final Float32ValuesImpl float32Values; + + /** + * Gets the Float32ValuesImpl object to access its operations. + * + * @return the Float32ValuesImpl object. + */ + public Float32ValuesImpl getFloat32Values() { + return this.float32Values; + } + + /** + * The DatetimeValuesImpl object to access its operations. + */ + private final DatetimeValuesImpl datetimeValues; + + /** + * Gets the DatetimeValuesImpl object to access its operations. + * + * @return the DatetimeValuesImpl object. + */ + public DatetimeValuesImpl getDatetimeValues() { + return this.datetimeValues; + } + + /** + * The DurationValuesImpl object to access its operations. + */ + private final DurationValuesImpl durationValues; + + /** + * Gets the DurationValuesImpl object to access its operations. + * + * @return the DurationValuesImpl object. + */ + public DurationValuesImpl getDurationValues() { + return this.durationValues; + } + + /** + * The UnknownValuesImpl object to access its operations. + */ + private final UnknownValuesImpl unknownValues; + + /** + * Gets the UnknownValuesImpl object to access its operations. + * + * @return the UnknownValuesImpl object. + */ + public UnknownValuesImpl getUnknownValues() { + return this.unknownValues; + } + + /** + * The ModelValuesImpl object to access its operations. + */ + private final ModelValuesImpl modelValues; + + /** + * Gets the ModelValuesImpl object to access its operations. + * + * @return the ModelValuesImpl object. + */ + public ModelValuesImpl getModelValues() { + return this.modelValues; + } + + /** + * The NullableFloatValuesImpl object to access its operations. + */ + private final NullableFloatValuesImpl nullableFloatValues; + + /** + * Gets the NullableFloatValuesImpl object to access its operations. + * + * @return the NullableFloatValuesImpl object. + */ + public NullableFloatValuesImpl getNullableFloatValues() { + return this.nullableFloatValues; + } + + /** + * The NullableInt32ValuesImpl object to access its operations. + */ + private final NullableInt32ValuesImpl nullableInt32Values; + + /** + * Gets the NullableInt32ValuesImpl object to access its operations. + * + * @return the NullableInt32ValuesImpl object. + */ + public NullableInt32ValuesImpl getNullableInt32Values() { + return this.nullableInt32Values; + } + + /** + * The NullableBooleanValuesImpl object to access its operations. + */ + private final NullableBooleanValuesImpl nullableBooleanValues; + + /** + * Gets the NullableBooleanValuesImpl object to access its operations. + * + * @return the NullableBooleanValuesImpl object. + */ + public NullableBooleanValuesImpl getNullableBooleanValues() { + return this.nullableBooleanValues; + } + + /** + * The NullableStringValuesImpl object to access its operations. + */ + private final NullableStringValuesImpl nullableStringValues; + + /** + * Gets the NullableStringValuesImpl object to access its operations. + * + * @return the NullableStringValuesImpl object. + */ + public NullableStringValuesImpl getNullableStringValues() { + return this.nullableStringValues; + } + + /** + * The NullableModelValuesImpl object to access its operations. + */ + private final NullableModelValuesImpl nullableModelValues; + + /** + * Gets the NullableModelValuesImpl object to access its operations. + * + * @return the NullableModelValuesImpl object. + */ + public NullableModelValuesImpl getNullableModelValues() { + return this.nullableModelValues; + } + + /** + * Initializes an instance of ArrayClient client. + * + * @param endpoint Service host. + */ + public ArrayClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ArrayClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ArrayClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ArrayClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ArrayClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.int32Values = new Int32ValuesImpl(this); + this.int64Values = new Int64ValuesImpl(this); + this.booleanValues = new BooleanValuesImpl(this); + this.stringValues = new StringValuesImpl(this); + this.float32Values = new Float32ValuesImpl(this); + this.datetimeValues = new DatetimeValuesImpl(this); + this.durationValues = new DurationValuesImpl(this); + this.unknownValues = new UnknownValuesImpl(this); + this.modelValues = new ModelValuesImpl(this); + this.nullableFloatValues = new NullableFloatValuesImpl(this); + this.nullableInt32Values = new NullableInt32ValuesImpl(this); + this.nullableBooleanValues = new NullableBooleanValuesImpl(this); + this.nullableStringValues = new NullableStringValuesImpl(this); + this.nullableModelValues = new NullableModelValuesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/BooleanValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/BooleanValuesImpl.java new file mode 100644 index 00000000000..aa3c3d9443b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/BooleanValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BooleanValues. + */ +public final class BooleanValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BooleanValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of BooleanValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BooleanValuesImpl(ArrayClientImpl client) { + this.service + = RestProxy.create(BooleanValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientBooleanValues to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientBooleanValues") + public interface BooleanValuesService { + @Get("/type/array/boolean") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/boolean") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/boolean") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/boolean") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DatetimeValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DatetimeValuesImpl.java new file mode 100644 index 00000000000..cdd53816822 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DatetimeValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DatetimeValues. + */ +public final class DatetimeValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DatetimeValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of DatetimeValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatetimeValuesImpl(ArrayClientImpl client) { + this.service + = RestProxy.create(DatetimeValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientDatetimeValues to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientDatetimeValues") + public interface DatetimeValuesService { + @Get("/type/array/datetime") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/datetime") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/datetime") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/datetime") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     OffsetDateTime (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     OffsetDateTime (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     OffsetDateTime (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     OffsetDateTime (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DurationValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DurationValuesImpl.java new file mode 100644 index 00000000000..2786d40626e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/DurationValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DurationValues. + */ +public final class DurationValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DurationValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of DurationValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DurationValuesImpl(ArrayClientImpl client) { + this.service + = RestProxy.create(DurationValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientDurationValues to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientDurationValues") + public interface DurationValuesService { + @Get("/type/array/duration") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/duration") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/duration") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/duration") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     Duration (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     Duration (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     Duration (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     Duration (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Float32ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Float32ValuesImpl.java new file mode 100644 index 00000000000..4f8a5eb5fcc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Float32ValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Float32Values. + */ +public final class Float32ValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Float32ValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of Float32ValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Float32ValuesImpl(ArrayClientImpl client) { + this.service + = RestProxy.create(Float32ValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientFloat32Values to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientFloat32Values") + public interface Float32ValuesService { + @Get("/type/array/float32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/float32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/float32") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/float32") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int32ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int32ValuesImpl.java new file mode 100644 index 00000000000..f62ba702281 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int32ValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Int32Values. + */ +public final class Int32ValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Int32ValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of Int32ValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Int32ValuesImpl(ArrayClientImpl client) { + this.service + = RestProxy.create(Int32ValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientInt32Values to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientInt32Values") + public interface Int32ValuesService { + @Get("/type/array/int32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/int32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/int32") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/int32") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int64ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int64ValuesImpl.java new file mode 100644 index 00000000000..e2f1ba3ff11 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/Int64ValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Int64Values. + */ +public final class Int64ValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Int64ValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of Int64ValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Int64ValuesImpl(ArrayClientImpl client) { + this.service + = RestProxy.create(Int64ValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientInt64Values to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientInt64Values") + public interface Int64ValuesService { + @Get("/type/array/int64") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/int64") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/int64") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/int64") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     long (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     long (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     long (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     long (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ModelValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ModelValuesImpl.java new file mode 100644 index 00000000000..6b4e459536a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/ModelValuesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ModelValues. + */ +public final class ModelValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ModelValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of ModelValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ModelValuesImpl(ArrayClientImpl client) { + this.service + = RestProxy.create(ModelValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientModelValues to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientModelValues") + public interface ModelValuesService { + @Get("/type/array/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableBooleanValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableBooleanValuesImpl.java new file mode 100644 index 00000000000..29e8ceb5277 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableBooleanValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NullableBooleanValues. + */ +public final class NullableBooleanValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NullableBooleanValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of NullableBooleanValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NullableBooleanValuesImpl(ArrayClientImpl client) { + this.service = RestProxy.create(NullableBooleanValuesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientNullableBooleanValues to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientNullableBooleanValues") + public interface NullableBooleanValuesService { + @Get("/type/array/nullable-boolean") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/nullable-boolean") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/nullable-boolean") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/nullable-boolean") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     boolean (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableFloatValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableFloatValuesImpl.java new file mode 100644 index 00000000000..476dc3facd1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableFloatValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NullableFloatValues. + */ +public final class NullableFloatValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NullableFloatValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of NullableFloatValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NullableFloatValuesImpl(ArrayClientImpl client) { + this.service = RestProxy.create(NullableFloatValuesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientNullableFloatValues to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientNullableFloatValues") + public interface NullableFloatValuesService { + @Get("/type/array/nullable-float") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/nullable-float") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/nullable-float") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/nullable-float") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     double (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableInt32ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableInt32ValuesImpl.java new file mode 100644 index 00000000000..754ef970df4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableInt32ValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NullableInt32Values. + */ +public final class NullableInt32ValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NullableInt32ValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of NullableInt32ValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NullableInt32ValuesImpl(ArrayClientImpl client) { + this.service = RestProxy.create(NullableInt32ValuesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientNullableInt32Values to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientNullableInt32Values") + public interface NullableInt32ValuesService { + @Get("/type/array/nullable-int32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/nullable-int32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/nullable-int32") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/nullable-int32") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     int (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableModelValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableModelValuesImpl.java new file mode 100644 index 00000000000..aab7f8fb8c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableModelValuesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NullableModelValues. + */ +public final class NullableModelValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NullableModelValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of NullableModelValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NullableModelValuesImpl(ArrayClientImpl client) { + this.service = RestProxy.create(NullableModelValuesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientNullableModelValues to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientNullableModelValues") + public interface NullableModelValuesService { + @Get("/type/array/nullable-model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/nullable-model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/nullable-model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/nullable-model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *      (Required){
+     *         property: String (Required)
+     *         children (Optional): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableStringValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableStringValuesImpl.java new file mode 100644 index 00000000000..7f27e414ac4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/NullableStringValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NullableStringValues. + */ +public final class NullableStringValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NullableStringValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of NullableStringValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NullableStringValuesImpl(ArrayClientImpl client) { + this.service = RestProxy.create(NullableStringValuesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientNullableStringValues to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientNullableStringValues") + public interface NullableStringValuesService { + @Get("/type/array/nullable-string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/nullable-string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/nullable-string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/nullable-string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/StringValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/StringValuesImpl.java new file mode 100644 index 00000000000..9694d285f4a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/StringValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringValues. + */ +public final class StringValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of StringValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringValuesImpl(ArrayClientImpl client) { + this.service + = RestProxy.create(StringValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientStringValues to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientStringValues") + public interface StringValuesService { + @Get("/type/array/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     String (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/UnknownValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/UnknownValuesImpl.java new file mode 100644 index 00000000000..dc82f2d5adc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/UnknownValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnknownValues. + */ +public final class UnknownValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnknownValuesService service; + + /** + * The service client containing this operation class. + */ + private final ArrayClientImpl client; + + /** + * Initializes an instance of UnknownValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnknownValuesImpl(ArrayClientImpl client) { + this.service + = RestProxy.create(UnknownValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArrayClientUnknownValues to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArrayClientUnknownValues") + public interface UnknownValuesService { + @Get("/type/array/unknown") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/array/unknown") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/array/unknown") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/array/unknown") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     Object (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     Object (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     Object (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * [
+     *     Object (Required)
+     * ]
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/package-info.java new file mode 100644 index 00000000000..88ecb03506b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Array. + * Illustrates various types of arrays. + * + */ +package type.array.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/InnerModel.java new file mode 100644 index 00000000000..decd8bac966 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/InnerModel.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Array inner model. + */ +@Fluent +public final class InnerModel implements JsonSerializable { + /* + * Required string property + */ + @Generated + private final String property; + + /* + * The children property. + */ + @Generated + private List children; + + /** + * Creates an instance of InnerModel class. + * + * @param property the property value to set. + */ + @Generated + public InnerModel(String property) { + this.property = property; + } + + /** + * Get the property property: Required string property. + * + * @return the property value. + */ + @Generated + public String getProperty() { + return this.property; + } + + /** + * Get the children property: The children property. + * + * @return the children value. + */ + @Generated + public List getChildren() { + return this.children; + } + + /** + * Set the children property: The children property. + * + * @param children the children value to set. + * @return the InnerModel object itself. + */ + @Generated + public InnerModel setChildren(List children) { + this.children = children; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property); + jsonWriter.writeArrayField("children", this.children, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InnerModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InnerModel. + */ + @Generated + public static InnerModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String property = null; + List children = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getString(); + } else if ("children".equals(fieldName)) { + children = reader.readArray(reader1 -> InnerModel.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + InnerModel deserializedInnerModel = new InnerModel(property); + deserializedInnerModel.children = children; + + return deserializedInnerModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/package-info.java new file mode 100644 index 00000000000..8b60200d2e7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Array. + * Illustrates various types of arrays. + * + */ +package type.array.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/package-info.java new file mode 100644 index 00000000000..42102cc88fa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/array/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Array. + * Illustrates various types of arrays. + * + */ +package type.array; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueAsyncClient.java new file mode 100644 index 00000000000..79e8b86247e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import reactor.core.publisher.Mono; +import type.dictionary.implementation.BooleanValuesImpl; + +/** + * Initializes a new instance of the asynchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) +public final class BooleanValueAsyncClient { + @Generated + private final BooleanValuesImpl serviceClient; + + /** + * Initializes an instance of BooleanValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BooleanValueAsyncClient(BooleanValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_BOOLEAN)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_BOOLEAN + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueClient.java new file mode 100644 index 00000000000..0076abfae86 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/BooleanValueClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import type.dictionary.implementation.BooleanValuesImpl; + +/** + * Initializes a new instance of the synchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class) +public final class BooleanValueClient { + @Generated + private final BooleanValuesImpl serviceClient; + + /** + * Initializes an instance of BooleanValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BooleanValueClient(BooleanValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Map get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_BOOLEAN); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_BOOLEAN + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueAsyncClient.java new file mode 100644 index 00000000000..ecb428b457a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueAsyncClient.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.time.OffsetDateTime; +import java.util.Map; +import reactor.core.publisher.Mono; +import type.dictionary.implementation.DatetimeValuesImpl; + +/** + * Initializes a new instance of the asynchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) +public final class DatetimeValueAsyncClient { + @Generated + private final DatetimeValuesImpl serviceClient; + + /** + * Initializes an instance of DatetimeValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DatetimeValueAsyncClient(DatetimeValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_OFFSET_DATE_TIME)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_OFFSET_DATE_TIME + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueClient.java new file mode 100644 index 00000000000..77cb986ba8c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DatetimeValueClient.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.time.OffsetDateTime; +import java.util.Map; +import type.dictionary.implementation.DatetimeValuesImpl; + +/** + * Initializes a new instance of the synchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class) +public final class DatetimeValueClient { + @Generated + private final DatetimeValuesImpl serviceClient; + + /** + * Initializes an instance of DatetimeValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DatetimeValueClient(DatetimeValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Map get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_OFFSET_DATE_TIME); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_OFFSET_DATE_TIME + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DictionaryClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DictionaryClientBuilder.java new file mode 100644 index 00000000000..937444a209a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DictionaryClientBuilder.java @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.dictionary.implementation.DictionaryClientImpl; + +/** + * A builder for creating a new instance of the DictionaryClient type. + */ +@ServiceClientBuilder( + serviceClients = { + Int32ValueClient.class, + Int64ValueClient.class, + BooleanValueClient.class, + StringValueClient.class, + Float32ValueClient.class, + DatetimeValueClient.class, + DurationValueClient.class, + UnknownValueClient.class, + ModelValueClient.class, + RecursiveModelValueClient.class, + NullableFloatValueClient.class, + Int32ValueAsyncClient.class, + Int64ValueAsyncClient.class, + BooleanValueAsyncClient.class, + StringValueAsyncClient.class, + Float32ValueAsyncClient.class, + DatetimeValueAsyncClient.class, + DurationValueAsyncClient.class, + UnknownValueAsyncClient.class, + ModelValueAsyncClient.class, + RecursiveModelValueAsyncClient.class, + NullableFloatValueAsyncClient.class }) +public final class DictionaryClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("type-dictionary.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the DictionaryClientBuilder. + */ + @Generated + public DictionaryClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DictionaryClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DictionaryClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DictionaryClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DictionaryClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DictionaryClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DictionaryClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DictionaryClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DictionaryClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the DictionaryClientBuilder. + */ + @Generated + public DictionaryClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of DictionaryClientImpl with the provided parameters. + * + * @return an instance of DictionaryClientImpl. + */ + @Generated + private DictionaryClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + DictionaryClientImpl client + = new DictionaryClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of Int32ValueAsyncClient class. + * + * @return an instance of Int32ValueAsyncClient. + */ + @Generated + public Int32ValueAsyncClient buildInt32ValueAsyncClient() { + return new Int32ValueAsyncClient(buildInnerClient().getInt32Values()); + } + + /** + * Builds an instance of Int64ValueAsyncClient class. + * + * @return an instance of Int64ValueAsyncClient. + */ + @Generated + public Int64ValueAsyncClient buildInt64ValueAsyncClient() { + return new Int64ValueAsyncClient(buildInnerClient().getInt64Values()); + } + + /** + * Builds an instance of BooleanValueAsyncClient class. + * + * @return an instance of BooleanValueAsyncClient. + */ + @Generated + public BooleanValueAsyncClient buildBooleanValueAsyncClient() { + return new BooleanValueAsyncClient(buildInnerClient().getBooleanValues()); + } + + /** + * Builds an instance of StringValueAsyncClient class. + * + * @return an instance of StringValueAsyncClient. + */ + @Generated + public StringValueAsyncClient buildStringValueAsyncClient() { + return new StringValueAsyncClient(buildInnerClient().getStringValues()); + } + + /** + * Builds an instance of Float32ValueAsyncClient class. + * + * @return an instance of Float32ValueAsyncClient. + */ + @Generated + public Float32ValueAsyncClient buildFloat32ValueAsyncClient() { + return new Float32ValueAsyncClient(buildInnerClient().getFloat32Values()); + } + + /** + * Builds an instance of DatetimeValueAsyncClient class. + * + * @return an instance of DatetimeValueAsyncClient. + */ + @Generated + public DatetimeValueAsyncClient buildDatetimeValueAsyncClient() { + return new DatetimeValueAsyncClient(buildInnerClient().getDatetimeValues()); + } + + /** + * Builds an instance of DurationValueAsyncClient class. + * + * @return an instance of DurationValueAsyncClient. + */ + @Generated + public DurationValueAsyncClient buildDurationValueAsyncClient() { + return new DurationValueAsyncClient(buildInnerClient().getDurationValues()); + } + + /** + * Builds an instance of UnknownValueAsyncClient class. + * + * @return an instance of UnknownValueAsyncClient. + */ + @Generated + public UnknownValueAsyncClient buildUnknownValueAsyncClient() { + return new UnknownValueAsyncClient(buildInnerClient().getUnknownValues()); + } + + /** + * Builds an instance of ModelValueAsyncClient class. + * + * @return an instance of ModelValueAsyncClient. + */ + @Generated + public ModelValueAsyncClient buildModelValueAsyncClient() { + return new ModelValueAsyncClient(buildInnerClient().getModelValues()); + } + + /** + * Builds an instance of RecursiveModelValueAsyncClient class. + * + * @return an instance of RecursiveModelValueAsyncClient. + */ + @Generated + public RecursiveModelValueAsyncClient buildRecursiveModelValueAsyncClient() { + return new RecursiveModelValueAsyncClient(buildInnerClient().getRecursiveModelValues()); + } + + /** + * Builds an instance of NullableFloatValueAsyncClient class. + * + * @return an instance of NullableFloatValueAsyncClient. + */ + @Generated + public NullableFloatValueAsyncClient buildNullableFloatValueAsyncClient() { + return new NullableFloatValueAsyncClient(buildInnerClient().getNullableFloatValues()); + } + + /** + * Builds an instance of Int32ValueClient class. + * + * @return an instance of Int32ValueClient. + */ + @Generated + public Int32ValueClient buildInt32ValueClient() { + return new Int32ValueClient(buildInnerClient().getInt32Values()); + } + + /** + * Builds an instance of Int64ValueClient class. + * + * @return an instance of Int64ValueClient. + */ + @Generated + public Int64ValueClient buildInt64ValueClient() { + return new Int64ValueClient(buildInnerClient().getInt64Values()); + } + + /** + * Builds an instance of BooleanValueClient class. + * + * @return an instance of BooleanValueClient. + */ + @Generated + public BooleanValueClient buildBooleanValueClient() { + return new BooleanValueClient(buildInnerClient().getBooleanValues()); + } + + /** + * Builds an instance of StringValueClient class. + * + * @return an instance of StringValueClient. + */ + @Generated + public StringValueClient buildStringValueClient() { + return new StringValueClient(buildInnerClient().getStringValues()); + } + + /** + * Builds an instance of Float32ValueClient class. + * + * @return an instance of Float32ValueClient. + */ + @Generated + public Float32ValueClient buildFloat32ValueClient() { + return new Float32ValueClient(buildInnerClient().getFloat32Values()); + } + + /** + * Builds an instance of DatetimeValueClient class. + * + * @return an instance of DatetimeValueClient. + */ + @Generated + public DatetimeValueClient buildDatetimeValueClient() { + return new DatetimeValueClient(buildInnerClient().getDatetimeValues()); + } + + /** + * Builds an instance of DurationValueClient class. + * + * @return an instance of DurationValueClient. + */ + @Generated + public DurationValueClient buildDurationValueClient() { + return new DurationValueClient(buildInnerClient().getDurationValues()); + } + + /** + * Builds an instance of UnknownValueClient class. + * + * @return an instance of UnknownValueClient. + */ + @Generated + public UnknownValueClient buildUnknownValueClient() { + return new UnknownValueClient(buildInnerClient().getUnknownValues()); + } + + /** + * Builds an instance of ModelValueClient class. + * + * @return an instance of ModelValueClient. + */ + @Generated + public ModelValueClient buildModelValueClient() { + return new ModelValueClient(buildInnerClient().getModelValues()); + } + + /** + * Builds an instance of RecursiveModelValueClient class. + * + * @return an instance of RecursiveModelValueClient. + */ + @Generated + public RecursiveModelValueClient buildRecursiveModelValueClient() { + return new RecursiveModelValueClient(buildInnerClient().getRecursiveModelValues()); + } + + /** + * Builds an instance of NullableFloatValueClient class. + * + * @return an instance of NullableFloatValueClient. + */ + @Generated + public NullableFloatValueClient buildNullableFloatValueClient() { + return new NullableFloatValueClient(buildInnerClient().getNullableFloatValues()); + } + + private static final ClientLogger LOGGER = new ClientLogger(DictionaryClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueAsyncClient.java new file mode 100644 index 00000000000..a8d09e2c9b0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueAsyncClient.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Mono; +import type.dictionary.implementation.DurationValuesImpl; + +/** + * Initializes a new instance of the asynchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) +public final class DurationValueAsyncClient { + @Generated + private final DurationValuesImpl serviceClient; + + /** + * Initializes an instance of DurationValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DurationValueAsyncClient(DurationValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_DURATION)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_DURATION + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueClient.java new file mode 100644 index 00000000000..bd1f5390b11 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/DurationValueClient.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.util.Map; +import type.dictionary.implementation.DurationValuesImpl; + +/** + * Initializes a new instance of the synchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class) +public final class DurationValueClient { + @Generated + private final DurationValuesImpl serviceClient; + + /** + * Initializes an instance of DurationValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DurationValueClient(DurationValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Map get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_DURATION); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_DURATION + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueAsyncClient.java new file mode 100644 index 00000000000..cc7d7846de9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import reactor.core.publisher.Mono; +import type.dictionary.implementation.Float32ValuesImpl; + +/** + * Initializes a new instance of the asynchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) +public final class Float32ValueAsyncClient { + @Generated + private final Float32ValuesImpl serviceClient; + + /** + * Initializes an instance of Float32ValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Float32ValueAsyncClient(Float32ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_DOUBLE)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_DOUBLE + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueClient.java new file mode 100644 index 00000000000..d817962bb16 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Float32ValueClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import type.dictionary.implementation.Float32ValuesImpl; + +/** + * Initializes a new instance of the synchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class) +public final class Float32ValueClient { + @Generated + private final Float32ValuesImpl serviceClient; + + /** + * Initializes an instance of Float32ValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Float32ValueClient(Float32ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Map get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_DOUBLE); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_DOUBLE + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueAsyncClient.java new file mode 100644 index 00000000000..4d43ff75e68 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import reactor.core.publisher.Mono; +import type.dictionary.implementation.Int32ValuesImpl; + +/** + * Initializes a new instance of the asynchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) +public final class Int32ValueAsyncClient { + @Generated + private final Int32ValuesImpl serviceClient; + + /** + * Initializes an instance of Int32ValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Int32ValueAsyncClient(Int32ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_INTEGER)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_INTEGER + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueClient.java new file mode 100644 index 00000000000..0cd6daa110a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int32ValueClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import type.dictionary.implementation.Int32ValuesImpl; + +/** + * Initializes a new instance of the synchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class) +public final class Int32ValueClient { + @Generated + private final Int32ValuesImpl serviceClient; + + /** + * Initializes an instance of Int32ValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Int32ValueClient(Int32ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Map get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_INTEGER); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_INTEGER + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueAsyncClient.java new file mode 100644 index 00000000000..25587345b30 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import reactor.core.publisher.Mono; +import type.dictionary.implementation.Int64ValuesImpl; + +/** + * Initializes a new instance of the asynchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) +public final class Int64ValueAsyncClient { + @Generated + private final Int64ValuesImpl serviceClient; + + /** + * Initializes an instance of Int64ValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Int64ValueAsyncClient(Int64ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: long (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_LONG)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_LONG + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueClient.java new file mode 100644 index 00000000000..32ce36c0f72 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/Int64ValueClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import type.dictionary.implementation.Int64ValuesImpl; + +/** + * Initializes a new instance of the synchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class) +public final class Int64ValueClient { + @Generated + private final Int64ValuesImpl serviceClient; + + /** + * Initializes an instance of Int64ValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Int64ValueClient(Int64ValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: long (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Map get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_LONG); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_LONG + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueAsyncClient.java new file mode 100644 index 00000000000..65d4328f7f5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueAsyncClient.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import reactor.core.publisher.Mono; +import type.dictionary.implementation.ModelValuesImpl; +import type.dictionary.models.InnerModel; + +/** + * Initializes a new instance of the asynchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) +public final class ModelValueAsyncClient { + @Generated + private final ModelValuesImpl serviceClient; + + /** + * Initializes an instance of ModelValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelValueAsyncClient(ModelValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_INNER_MODEL)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_INNER_MODEL + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueClient.java new file mode 100644 index 00000000000..e7878acb97a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/ModelValueClient.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import type.dictionary.implementation.ModelValuesImpl; +import type.dictionary.models.InnerModel; + +/** + * Initializes a new instance of the synchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class) +public final class ModelValueClient { + @Generated + private final ModelValuesImpl serviceClient; + + /** + * Initializes an instance of ModelValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelValueClient(ModelValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Map get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_INNER_MODEL); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_INNER_MODEL + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueAsyncClient.java new file mode 100644 index 00000000000..c788f835e19 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import reactor.core.publisher.Mono; +import type.dictionary.implementation.NullableFloatValuesImpl; + +/** + * Initializes a new instance of the asynchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) +public final class NullableFloatValueAsyncClient { + @Generated + private final NullableFloatValuesImpl serviceClient; + + /** + * Initializes an instance of NullableFloatValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NullableFloatValueAsyncClient(NullableFloatValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_DOUBLE)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_DOUBLE + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueClient.java new file mode 100644 index 00000000000..0a1367bbd03 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/NullableFloatValueClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import type.dictionary.implementation.NullableFloatValuesImpl; + +/** + * Initializes a new instance of the synchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class) +public final class NullableFloatValueClient { + @Generated + private final NullableFloatValuesImpl serviceClient; + + /** + * Initializes an instance of NullableFloatValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NullableFloatValueClient(NullableFloatValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Map get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_DOUBLE); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_DOUBLE + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueAsyncClient.java new file mode 100644 index 00000000000..23469aaea18 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueAsyncClient.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import reactor.core.publisher.Mono; +import type.dictionary.implementation.RecursiveModelValuesImpl; +import type.dictionary.models.InnerModel; + +/** + * Initializes a new instance of the asynchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) +public final class RecursiveModelValueAsyncClient { + @Generated + private final RecursiveModelValuesImpl serviceClient; + + /** + * Initializes an instance of RecursiveModelValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RecursiveModelValueAsyncClient(RecursiveModelValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_INNER_MODEL)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_INNER_MODEL + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueClient.java new file mode 100644 index 00000000000..98c6341f213 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/RecursiveModelValueClient.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import type.dictionary.implementation.RecursiveModelValuesImpl; +import type.dictionary.models.InnerModel; + +/** + * Initializes a new instance of the synchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class) +public final class RecursiveModelValueClient { + @Generated + private final RecursiveModelValuesImpl serviceClient; + + /** + * Initializes an instance of RecursiveModelValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RecursiveModelValueClient(RecursiveModelValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Map get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_INNER_MODEL); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_INNER_MODEL + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueAsyncClient.java new file mode 100644 index 00000000000..e462708f0fb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import reactor.core.publisher.Mono; +import type.dictionary.implementation.StringValuesImpl; + +/** + * Initializes a new instance of the asynchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) +public final class StringValueAsyncClient { + @Generated + private final StringValuesImpl serviceClient; + + /** + * Initializes an instance of StringValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringValueAsyncClient(StringValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_STRING)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_STRING + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueClient.java new file mode 100644 index 00000000000..b8ffe7c9f1f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/StringValueClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import type.dictionary.implementation.StringValuesImpl; + +/** + * Initializes a new instance of the synchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class) +public final class StringValueClient { + @Generated + private final StringValuesImpl serviceClient; + + /** + * Initializes an instance of StringValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringValueClient(StringValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Map get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_STRING); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_STRING + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueAsyncClient.java new file mode 100644 index 00000000000..e60710933ed --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import reactor.core.publisher.Mono; +import type.dictionary.implementation.UnknownValuesImpl; + +/** + * Initializes a new instance of the asynchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class, isAsync = true) +public final class UnknownValueAsyncClient { + @Generated + private final UnknownValuesImpl serviceClient; + + /** + * Initializes an instance of UnknownValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownValueAsyncClient(UnknownValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Object (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Object (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_MAP_STRING_OBJECT)); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_OBJECT + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueClient.java new file mode 100644 index 00000000000..858d8ad9938 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/UnknownValueClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.Map; +import type.dictionary.implementation.UnknownValuesImpl; + +/** + * Initializes a new instance of the synchronous DictionaryClient type. + */ +@ServiceClient(builder = DictionaryClientBuilder.class) +public final class UnknownValueClient { + @Generated + private final UnknownValuesImpl serviceClient; + + /** + * Initializes an instance of UnknownValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownValueClient(UnknownValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Object (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Object (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Map get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_MAP_STRING_OBJECT); + } + + /** + * The put operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Map body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_MAP_STRING_OBJECT + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/BooleanValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/BooleanValuesImpl.java new file mode 100644 index 00000000000..c0105012c92 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/BooleanValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BooleanValues. + */ +public final class BooleanValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BooleanValuesService service; + + /** + * The service client containing this operation class. + */ + private final DictionaryClientImpl client; + + /** + * Initializes an instance of BooleanValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BooleanValuesImpl(DictionaryClientImpl client) { + this.service + = RestProxy.create(BooleanValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DictionaryClientBooleanValues to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DictionaryClientBooleanValues") + public interface BooleanValuesService { + @Get("/type/dictionary/boolean") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/dictionary/boolean") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/boolean") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/boolean") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DatetimeValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DatetimeValuesImpl.java new file mode 100644 index 00000000000..955d34195ca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DatetimeValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DatetimeValues. + */ +public final class DatetimeValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DatetimeValuesService service; + + /** + * The service client containing this operation class. + */ + private final DictionaryClientImpl client; + + /** + * Initializes an instance of DatetimeValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatetimeValuesImpl(DictionaryClientImpl client) { + this.service + = RestProxy.create(DatetimeValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DictionaryClientDatetimeValues to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DictionaryClientDatetimeValues") + public interface DatetimeValuesService { + @Get("/type/dictionary/datetime") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/dictionary/datetime") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/datetime") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/datetime") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DictionaryClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DictionaryClientImpl.java new file mode 100644 index 00000000000..2fb37030f47 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DictionaryClientImpl.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 DictionaryClient type. + */ +public final class DictionaryClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 Int32ValuesImpl object to access its operations. + */ + private final Int32ValuesImpl int32Values; + + /** + * Gets the Int32ValuesImpl object to access its operations. + * + * @return the Int32ValuesImpl object. + */ + public Int32ValuesImpl getInt32Values() { + return this.int32Values; + } + + /** + * The Int64ValuesImpl object to access its operations. + */ + private final Int64ValuesImpl int64Values; + + /** + * Gets the Int64ValuesImpl object to access its operations. + * + * @return the Int64ValuesImpl object. + */ + public Int64ValuesImpl getInt64Values() { + return this.int64Values; + } + + /** + * The BooleanValuesImpl object to access its operations. + */ + private final BooleanValuesImpl booleanValues; + + /** + * Gets the BooleanValuesImpl object to access its operations. + * + * @return the BooleanValuesImpl object. + */ + public BooleanValuesImpl getBooleanValues() { + return this.booleanValues; + } + + /** + * The StringValuesImpl object to access its operations. + */ + private final StringValuesImpl stringValues; + + /** + * Gets the StringValuesImpl object to access its operations. + * + * @return the StringValuesImpl object. + */ + public StringValuesImpl getStringValues() { + return this.stringValues; + } + + /** + * The Float32ValuesImpl object to access its operations. + */ + private final Float32ValuesImpl float32Values; + + /** + * Gets the Float32ValuesImpl object to access its operations. + * + * @return the Float32ValuesImpl object. + */ + public Float32ValuesImpl getFloat32Values() { + return this.float32Values; + } + + /** + * The DatetimeValuesImpl object to access its operations. + */ + private final DatetimeValuesImpl datetimeValues; + + /** + * Gets the DatetimeValuesImpl object to access its operations. + * + * @return the DatetimeValuesImpl object. + */ + public DatetimeValuesImpl getDatetimeValues() { + return this.datetimeValues; + } + + /** + * The DurationValuesImpl object to access its operations. + */ + private final DurationValuesImpl durationValues; + + /** + * Gets the DurationValuesImpl object to access its operations. + * + * @return the DurationValuesImpl object. + */ + public DurationValuesImpl getDurationValues() { + return this.durationValues; + } + + /** + * The UnknownValuesImpl object to access its operations. + */ + private final UnknownValuesImpl unknownValues; + + /** + * Gets the UnknownValuesImpl object to access its operations. + * + * @return the UnknownValuesImpl object. + */ + public UnknownValuesImpl getUnknownValues() { + return this.unknownValues; + } + + /** + * The ModelValuesImpl object to access its operations. + */ + private final ModelValuesImpl modelValues; + + /** + * Gets the ModelValuesImpl object to access its operations. + * + * @return the ModelValuesImpl object. + */ + public ModelValuesImpl getModelValues() { + return this.modelValues; + } + + /** + * The RecursiveModelValuesImpl object to access its operations. + */ + private final RecursiveModelValuesImpl recursiveModelValues; + + /** + * Gets the RecursiveModelValuesImpl object to access its operations. + * + * @return the RecursiveModelValuesImpl object. + */ + public RecursiveModelValuesImpl getRecursiveModelValues() { + return this.recursiveModelValues; + } + + /** + * The NullableFloatValuesImpl object to access its operations. + */ + private final NullableFloatValuesImpl nullableFloatValues; + + /** + * Gets the NullableFloatValuesImpl object to access its operations. + * + * @return the NullableFloatValuesImpl object. + */ + public NullableFloatValuesImpl getNullableFloatValues() { + return this.nullableFloatValues; + } + + /** + * Initializes an instance of DictionaryClient client. + * + * @param endpoint Service host. + */ + public DictionaryClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DictionaryClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public DictionaryClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DictionaryClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public DictionaryClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.int32Values = new Int32ValuesImpl(this); + this.int64Values = new Int64ValuesImpl(this); + this.booleanValues = new BooleanValuesImpl(this); + this.stringValues = new StringValuesImpl(this); + this.float32Values = new Float32ValuesImpl(this); + this.datetimeValues = new DatetimeValuesImpl(this); + this.durationValues = new DurationValuesImpl(this); + this.unknownValues = new UnknownValuesImpl(this); + this.modelValues = new ModelValuesImpl(this); + this.recursiveModelValues = new RecursiveModelValuesImpl(this); + this.nullableFloatValues = new NullableFloatValuesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DurationValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DurationValuesImpl.java new file mode 100644 index 00000000000..a5da3d93d7e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/DurationValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DurationValues. + */ +public final class DurationValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DurationValuesService service; + + /** + * The service client containing this operation class. + */ + private final DictionaryClientImpl client; + + /** + * Initializes an instance of DurationValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DurationValuesImpl(DictionaryClientImpl client) { + this.service + = RestProxy.create(DurationValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DictionaryClientDurationValues to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DictionaryClientDurationValues") + public interface DurationValuesService { + @Get("/type/dictionary/duration") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/dictionary/duration") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/duration") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/duration") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Float32ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Float32ValuesImpl.java new file mode 100644 index 00000000000..c2eb99529cc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Float32ValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Float32Values. + */ +public final class Float32ValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Float32ValuesService service; + + /** + * The service client containing this operation class. + */ + private final DictionaryClientImpl client; + + /** + * Initializes an instance of Float32ValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Float32ValuesImpl(DictionaryClientImpl client) { + this.service + = RestProxy.create(Float32ValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DictionaryClientFloat32Values to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DictionaryClientFloat32Values") + public interface Float32ValuesService { + @Get("/type/dictionary/float32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/dictionary/float32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/float32") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/float32") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int32ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int32ValuesImpl.java new file mode 100644 index 00000000000..79ed16d7319 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int32ValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Int32Values. + */ +public final class Int32ValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Int32ValuesService service; + + /** + * The service client containing this operation class. + */ + private final DictionaryClientImpl client; + + /** + * Initializes an instance of Int32ValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Int32ValuesImpl(DictionaryClientImpl client) { + this.service + = RestProxy.create(Int32ValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DictionaryClientInt32Values to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DictionaryClientInt32Values") + public interface Int32ValuesService { + @Get("/type/dictionary/int32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/dictionary/int32") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/int32") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/int32") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int64ValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int64ValuesImpl.java new file mode 100644 index 00000000000..bc068e5d4e0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/Int64ValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Int64Values. + */ +public final class Int64ValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Int64ValuesService service; + + /** + * The service client containing this operation class. + */ + private final DictionaryClientImpl client; + + /** + * Initializes an instance of Int64ValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Int64ValuesImpl(DictionaryClientImpl client) { + this.service + = RestProxy.create(Int64ValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DictionaryClientInt64Values to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DictionaryClientInt64Values") + public interface Int64ValuesService { + @Get("/type/dictionary/int64") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/dictionary/int64") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/int64") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/int64") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: long (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: long (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: long (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/ModelValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/ModelValuesImpl.java new file mode 100644 index 00000000000..7938add53e1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/ModelValuesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ModelValues. + */ +public final class ModelValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ModelValuesService service; + + /** + * The service client containing this operation class. + */ + private final DictionaryClientImpl client; + + /** + * Initializes an instance of ModelValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ModelValuesImpl(DictionaryClientImpl client) { + this.service + = RestProxy.create(ModelValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DictionaryClientModelValues to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DictionaryClientModelValues") + public interface ModelValuesService { + @Get("/type/dictionary/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/dictionary/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/NullableFloatValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/NullableFloatValuesImpl.java new file mode 100644 index 00000000000..cf4d90b2eb8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/NullableFloatValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NullableFloatValues. + */ +public final class NullableFloatValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NullableFloatValuesService service; + + /** + * The service client containing this operation class. + */ + private final DictionaryClientImpl client; + + /** + * Initializes an instance of NullableFloatValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NullableFloatValuesImpl(DictionaryClientImpl client) { + this.service = RestProxy.create(NullableFloatValuesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DictionaryClientNullableFloatValues to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DictionaryClientNullableFloatValues") + public interface NullableFloatValuesService { + @Get("/type/dictionary/nullable-float") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/dictionary/nullable-float") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/nullable-float") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/nullable-float") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/RecursiveModelValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/RecursiveModelValuesImpl.java new file mode 100644 index 00000000000..c139317a6fa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/RecursiveModelValuesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RecursiveModelValues. + */ +public final class RecursiveModelValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RecursiveModelValuesService service; + + /** + * The service client containing this operation class. + */ + private final DictionaryClientImpl client; + + /** + * Initializes an instance of RecursiveModelValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecursiveModelValuesImpl(DictionaryClientImpl client) { + this.service = RestProxy.create(RecursiveModelValuesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DictionaryClientRecursiveModelValues to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DictionaryClientRecursiveModelValues") + public interface RecursiveModelValuesService { + @Get("/type/dictionary/model/recursive") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/dictionary/model/recursive") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/model/recursive") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/model/recursive") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String (Required): {
+     *         property: String (Required)
+     *         children (Optional): {
+     *             String (Required): (recursive schema, see String above)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/StringValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/StringValuesImpl.java new file mode 100644 index 00000000000..e8ba4fc5e33 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/StringValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringValues. + */ +public final class StringValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringValuesService service; + + /** + * The service client containing this operation class. + */ + private final DictionaryClientImpl client; + + /** + * Initializes an instance of StringValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringValuesImpl(DictionaryClientImpl client) { + this.service + = RestProxy.create(StringValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DictionaryClientStringValues to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DictionaryClientStringValues") + public interface StringValuesService { + @Get("/type/dictionary/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/dictionary/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/UnknownValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/UnknownValuesImpl.java new file mode 100644 index 00000000000..23699055a5c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/UnknownValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnknownValues. + */ +public final class UnknownValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnknownValuesService service; + + /** + * The service client containing this operation class. + */ + private final DictionaryClientImpl client; + + /** + * Initializes an instance of UnknownValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnknownValuesImpl(DictionaryClientImpl client) { + this.service + = RestProxy.create(UnknownValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DictionaryClientUnknownValues to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DictionaryClientUnknownValues") + public interface UnknownValuesService { + @Get("/type/dictionary/unknown") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/dictionary/unknown") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/unknown") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/dictionary/unknown") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Object (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Object (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Object (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     String: Object (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/package-info.java new file mode 100644 index 00000000000..dcc02d01e90 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Dictionary. + * Illustrates various of dictionaries. + * + */ +package type.dictionary.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/InnerModel.java new file mode 100644 index 00000000000..25afa3ef39e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/InnerModel.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Dictionary inner model. + */ +@Fluent +public final class InnerModel implements JsonSerializable { + /* + * Required string property + */ + @Generated + private final String property; + + /* + * The children property. + */ + @Generated + private Map children; + + /** + * Creates an instance of InnerModel class. + * + * @param property the property value to set. + */ + @Generated + public InnerModel(String property) { + this.property = property; + } + + /** + * Get the property property: Required string property. + * + * @return the property value. + */ + @Generated + public String getProperty() { + return this.property; + } + + /** + * Get the children property: The children property. + * + * @return the children value. + */ + @Generated + public Map getChildren() { + return this.children; + } + + /** + * Set the children property: The children property. + * + * @param children the children value to set. + * @return the InnerModel object itself. + */ + @Generated + public InnerModel setChildren(Map children) { + this.children = children; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property); + jsonWriter.writeMapField("children", this.children, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InnerModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InnerModel. + */ + @Generated + public static InnerModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String property = null; + Map children = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getString(); + } else if ("children".equals(fieldName)) { + children = reader.readMap(reader1 -> InnerModel.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + InnerModel deserializedInnerModel = new InnerModel(property); + deserializedInnerModel.children = children; + + return deserializedInnerModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/package-info.java new file mode 100644 index 00000000000..babab74083c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Dictionary. + * Illustrates various of dictionaries. + * + */ +package type.dictionary.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/package-info.java new file mode 100644 index 00000000000..b9622d655da --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/dictionary/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Dictionary. + * Illustrates various of dictionaries. + * + */ +package type.dictionary; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleAsyncClient.java new file mode 100644 index 00000000000..789457d82b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleAsyncClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.extensible; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.enums.extensible.implementation.StringOperationsImpl; +import type.enums.extensible.models.DaysOfWeekExtensibleEnum; + +/** + * Initializes a new instance of the asynchronous ExtensibleClient type. + */ +@ServiceClient(builder = ExtensibleClientBuilder.class, isAsync = true) +public final class ExtensibleAsyncClient { + @Generated + private final StringOperationsImpl serviceClient; + + /** + * Initializes an instance of ExtensibleAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtensibleAsyncClient(StringOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getKnownValue operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return days of the week along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getKnownValueWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getKnownValueWithResponseAsync(requestOptions); + } + + /** + * The getUnknownValue operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return days of the week along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getUnknownValueWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getUnknownValueWithResponseAsync(requestOptions); + } + + /** + * The putKnownValue operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putKnownValueWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putKnownValueWithResponseAsync(body, requestOptions); + } + + /** + * The putUnknownValue operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putUnknownValueWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putUnknownValueWithResponseAsync(body, requestOptions); + } + + /** + * The getKnownValue operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return days of the week on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getKnownValue() { + // Generated convenience method for getKnownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getKnownValueWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> DaysOfWeekExtensibleEnum.fromString(protocolMethodData.toObject(String.class))); + } + + /** + * The getUnknownValue operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return days of the week on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getUnknownValue() { + // Generated convenience method for getUnknownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getUnknownValueWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> DaysOfWeekExtensibleEnum.fromString(protocolMethodData.toObject(String.class))); + } + + /** + * The putKnownValue operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putKnownValue(DaysOfWeekExtensibleEnum body) { + // Generated convenience method for putKnownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putKnownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) + .flatMap(FluxUtil::toMono); + } + + /** + * The putUnknownValue operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putUnknownValue(DaysOfWeekExtensibleEnum body) { + // Generated convenience method for putUnknownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putUnknownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) + .flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClient.java new file mode 100644 index 00000000000..c8e8c9a9023 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClient.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.extensible; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.enums.extensible.implementation.StringOperationsImpl; +import type.enums.extensible.models.DaysOfWeekExtensibleEnum; + +/** + * Initializes a new instance of the synchronous ExtensibleClient type. + */ +@ServiceClient(builder = ExtensibleClientBuilder.class) +public final class ExtensibleClient { + @Generated + private final StringOperationsImpl serviceClient; + + /** + * Initializes an instance of ExtensibleClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtensibleClient(StringOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getKnownValue operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return days of the week along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getKnownValueWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getKnownValueWithResponse(requestOptions); + } + + /** + * The getUnknownValue operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return days of the week along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getUnknownValueWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getUnknownValueWithResponse(requestOptions); + } + + /** + * The putKnownValue operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putKnownValueWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putKnownValueWithResponse(body, requestOptions); + } + + /** + * The putUnknownValue operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putUnknownValueWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putUnknownValueWithResponse(body, requestOptions); + } + + /** + * The getKnownValue operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return days of the week. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DaysOfWeekExtensibleEnum getKnownValue() { + // Generated convenience method for getKnownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + return DaysOfWeekExtensibleEnum + .fromString(getKnownValueWithResponse(requestOptions).getValue().toObject(String.class)); + } + + /** + * The getUnknownValue operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return days of the week. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DaysOfWeekExtensibleEnum getUnknownValue() { + // Generated convenience method for getUnknownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + return DaysOfWeekExtensibleEnum + .fromString(getUnknownValueWithResponse(requestOptions).getValue().toObject(String.class)); + } + + /** + * The putKnownValue operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putKnownValue(DaysOfWeekExtensibleEnum body) { + // Generated convenience method for putKnownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + putKnownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) + .getValue(); + } + + /** + * The putUnknownValue operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putUnknownValue(DaysOfWeekExtensibleEnum body) { + // Generated convenience method for putUnknownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + putUnknownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) + .getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClientBuilder.java new file mode 100644 index 00000000000..035733b899b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/ExtensibleClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.extensible; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.enums.extensible.implementation.ExtensibleClientImpl; + +/** + * A builder for creating a new instance of the ExtensibleClient type. + */ +@ServiceClientBuilder(serviceClients = { ExtensibleClient.class, ExtensibleAsyncClient.class }) +public final class ExtensibleClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("type-enums-extensible.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ExtensibleClientBuilder. + */ + @Generated + public ExtensibleClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ExtensibleClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ExtensibleClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ExtensibleClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ExtensibleClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ExtensibleClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ExtensibleClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ExtensibleClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ExtensibleClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ExtensibleClientBuilder. + */ + @Generated + public ExtensibleClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ExtensibleClientImpl with the provided parameters. + * + * @return an instance of ExtensibleClientImpl. + */ + @Generated + private ExtensibleClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ExtensibleClientImpl client + = new ExtensibleClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ExtensibleAsyncClient class. + * + * @return an instance of ExtensibleAsyncClient. + */ + @Generated + public ExtensibleAsyncClient buildAsyncClient() { + return new ExtensibleAsyncClient(buildInnerClient().getStringOperations()); + } + + /** + * Builds an instance of ExtensibleClient class. + * + * @return an instance of ExtensibleClient. + */ + @Generated + public ExtensibleClient buildClient() { + return new ExtensibleClient(buildInnerClient().getStringOperations()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ExtensibleClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java new file mode 100644 index 00000000000..4431101f0dd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.extensible.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 ExtensibleClient type. + */ +public final class ExtensibleClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 StringOperationsImpl object to access its operations. + */ + private final StringOperationsImpl stringOperations; + + /** + * Gets the StringOperationsImpl object to access its operations. + * + * @return the StringOperationsImpl object. + */ + public StringOperationsImpl getStringOperations() { + return this.stringOperations; + } + + /** + * Initializes an instance of ExtensibleClient client. + * + * @param endpoint Service host. + */ + public ExtensibleClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ExtensibleClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ExtensibleClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ExtensibleClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ExtensibleClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.stringOperations = new StringOperationsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/StringOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/StringOperationsImpl.java new file mode 100644 index 00000000000..661e7efc1d3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/StringOperationsImpl.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.extensible.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringOperations. + */ +public final class StringOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ExtensibleClientImpl client; + + /** + * Initializes an instance of StringOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringOperationsImpl(ExtensibleClientImpl client) { + this.service + = RestProxy.create(StringOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ExtensibleClientStringOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ExtensibleClientStringOperations") + public interface StringOperationsService { + @Get("/type/enum/extensible/string/known-value") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getKnownValue(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/enum/extensible/string/known-value") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getKnownValueSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/enum/extensible/string/unknown-value") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getUnknownValue(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/enum/extensible/string/unknown-value") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getUnknownValueSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/enum/extensible/string/known-value") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putKnownValue(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/enum/extensible/string/known-value") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putKnownValueSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/enum/extensible/string/unknown-value") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putUnknownValue(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/enum/extensible/string/unknown-value") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putUnknownValueSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The getKnownValue operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return days of the week along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getKnownValueWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getKnownValue(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getKnownValue operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return days of the week along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getKnownValueWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getKnownValueSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getUnknownValue operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return days of the week along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getUnknownValueWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getUnknownValue(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getUnknownValue operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return days of the week along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getUnknownValueWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getUnknownValueSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The putKnownValue operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putKnownValueWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putKnownValue(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The putKnownValue operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putKnownValueWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putKnownValueSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The putUnknownValue operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putUnknownValueWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putUnknownValue(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The putUnknownValue operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putUnknownValueWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putUnknownValueSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/package-info.java new file mode 100644 index 00000000000..76941d9def1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Extensible. + * + */ +package type.enums.extensible.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/DaysOfWeekExtensibleEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/DaysOfWeekExtensibleEnum.java new file mode 100644 index 00000000000..bc9e1443b5b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/DaysOfWeekExtensibleEnum.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.extensible.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Days of the week. + */ +public final class DaysOfWeekExtensibleEnum extends ExpandableStringEnum { + /** + * Monday. + */ + @Generated + public static final DaysOfWeekExtensibleEnum MONDAY = fromString("Monday"); + + /** + * Tuesday. + */ + @Generated + public static final DaysOfWeekExtensibleEnum TUESDAY = fromString("Tuesday"); + + /** + * Wednesday. + */ + @Generated + public static final DaysOfWeekExtensibleEnum WEDNESDAY = fromString("Wednesday"); + + /** + * Thursday. + */ + @Generated + public static final DaysOfWeekExtensibleEnum THURSDAY = fromString("Thursday"); + + /** + * Friday. + */ + @Generated + public static final DaysOfWeekExtensibleEnum FRIDAY = fromString("Friday"); + + /** + * Saturday. + */ + @Generated + public static final DaysOfWeekExtensibleEnum SATURDAY = fromString("Saturday"); + + /** + * Sunday. + */ + @Generated + public static final DaysOfWeekExtensibleEnum SUNDAY = fromString("Sunday"); + + /** + * Creates a new instance of DaysOfWeekExtensibleEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DaysOfWeekExtensibleEnum() { + } + + /** + * Creates or finds a DaysOfWeekExtensibleEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding DaysOfWeekExtensibleEnum. + */ + @Generated + public static DaysOfWeekExtensibleEnum fromString(String name) { + return fromString(name, DaysOfWeekExtensibleEnum.class); + } + + /** + * Gets known DaysOfWeekExtensibleEnum values. + * + * @return known DaysOfWeekExtensibleEnum values. + */ + @Generated + public static Collection values() { + return values(DaysOfWeekExtensibleEnum.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/package-info.java new file mode 100644 index 00000000000..e22b559ddab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Extensible. + * + */ +package type.enums.extensible.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/package-info.java new file mode 100644 index 00000000000..6dd0aa31113 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/extensible/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Extensible. + * + */ +package type.enums.extensible; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedAsyncClient.java new file mode 100644 index 00000000000..028f968ed8e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedAsyncClient.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.fixed; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.enums.fixed.implementation.StringOperationsImpl; +import type.enums.fixed.models.DaysOfWeekEnum; + +/** + * Initializes a new instance of the asynchronous FixedClient type. + */ +@ServiceClient(builder = FixedClientBuilder.class, isAsync = true) +public final class FixedAsyncClient { + @Generated + private final StringOperationsImpl serviceClient; + + /** + * Initializes an instance of FixedAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FixedAsyncClient(StringOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * getKnownValue. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return days of the week along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getKnownValueWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getKnownValueWithResponseAsync(requestOptions); + } + + /** + * putKnownValue. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putKnownValueWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putKnownValueWithResponseAsync(body, requestOptions); + } + + /** + * putUnknownValue. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putUnknownValueWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putUnknownValueWithResponseAsync(body, requestOptions); + } + + /** + * getKnownValue. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return days of the week on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getKnownValue() { + // Generated convenience method for getKnownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getKnownValueWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> DaysOfWeekEnum.fromString(protocolMethodData.toObject(String.class))); + } + + /** + * putKnownValue. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putKnownValue(DaysOfWeekEnum body) { + // Generated convenience method for putKnownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putKnownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) + .flatMap(FluxUtil::toMono); + } + + /** + * putUnknownValue. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putUnknownValue(DaysOfWeekEnum body) { + // Generated convenience method for putUnknownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putUnknownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) + .flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClient.java new file mode 100644 index 00000000000..ad9edda7295 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClient.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.fixed; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.enums.fixed.implementation.StringOperationsImpl; +import type.enums.fixed.models.DaysOfWeekEnum; + +/** + * Initializes a new instance of the synchronous FixedClient type. + */ +@ServiceClient(builder = FixedClientBuilder.class) +public final class FixedClient { + @Generated + private final StringOperationsImpl serviceClient; + + /** + * Initializes an instance of FixedClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FixedClient(StringOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * getKnownValue. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return days of the week along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getKnownValueWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getKnownValueWithResponse(requestOptions); + } + + /** + * putKnownValue. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putKnownValueWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putKnownValueWithResponse(body, requestOptions); + } + + /** + * putUnknownValue. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putUnknownValueWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putUnknownValueWithResponse(body, requestOptions); + } + + /** + * getKnownValue. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return days of the week. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DaysOfWeekEnum getKnownValue() { + // Generated convenience method for getKnownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + return DaysOfWeekEnum.fromString(getKnownValueWithResponse(requestOptions).getValue().toObject(String.class)); + } + + /** + * putKnownValue. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putKnownValue(DaysOfWeekEnum body) { + // Generated convenience method for putKnownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + putKnownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) + .getValue(); + } + + /** + * putUnknownValue. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putUnknownValue(DaysOfWeekEnum body) { + // Generated convenience method for putUnknownValueWithResponse + RequestOptions requestOptions = new RequestOptions(); + putUnknownValueWithResponse(BinaryData.fromObject(body == null ? null : body.toString()), requestOptions) + .getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClientBuilder.java new file mode 100644 index 00000000000..cdc6e468e61 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/FixedClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.fixed; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.enums.fixed.implementation.FixedClientImpl; + +/** + * A builder for creating a new instance of the FixedClient type. + */ +@ServiceClientBuilder(serviceClients = { FixedClient.class, FixedAsyncClient.class }) +public final class FixedClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("type-enums-fixed.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the FixedClientBuilder. + */ + @Generated + public FixedClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FixedClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FixedClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FixedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FixedClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FixedClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FixedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FixedClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public FixedClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the FixedClientBuilder. + */ + @Generated + public FixedClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of FixedClientImpl with the provided parameters. + * + * @return an instance of FixedClientImpl. + */ + @Generated + private FixedClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + FixedClientImpl client + = new FixedClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of FixedAsyncClient class. + * + * @return an instance of FixedAsyncClient. + */ + @Generated + public FixedAsyncClient buildAsyncClient() { + return new FixedAsyncClient(buildInnerClient().getStringOperations()); + } + + /** + * Builds an instance of FixedClient class. + * + * @return an instance of FixedClient. + */ + @Generated + public FixedClient buildClient() { + return new FixedClient(buildInnerClient().getStringOperations()); + } + + private static final ClientLogger LOGGER = new ClientLogger(FixedClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/FixedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/FixedClientImpl.java new file mode 100644 index 00000000000..d2f3f07d2b6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/FixedClientImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.fixed.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 FixedClient type. + */ +public final class FixedClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 StringOperationsImpl object to access its operations. + */ + private final StringOperationsImpl stringOperations; + + /** + * Gets the StringOperationsImpl object to access its operations. + * + * @return the StringOperationsImpl object. + */ + public StringOperationsImpl getStringOperations() { + return this.stringOperations; + } + + /** + * Initializes an instance of FixedClient client. + * + * @param endpoint Service host. + */ + public FixedClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of FixedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public FixedClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of FixedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public FixedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.stringOperations = new StringOperationsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/StringOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/StringOperationsImpl.java new file mode 100644 index 00000000000..e1e4c02b3dc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/StringOperationsImpl.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.fixed.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringOperations. + */ +public final class StringOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringOperationsService service; + + /** + * The service client containing this operation class. + */ + private final FixedClientImpl client; + + /** + * Initializes an instance of StringOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringOperationsImpl(FixedClientImpl client) { + this.service + = RestProxy.create(StringOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FixedClientStringOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "FixedClientStringOperations") + public interface StringOperationsService { + @Get("/type/enum/fixed/string/known-value") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getKnownValue(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/enum/fixed/string/known-value") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getKnownValueSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/enum/fixed/string/known-value") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putKnownValue(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/enum/fixed/string/known-value") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putKnownValueSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/enum/fixed/string/unknown-value") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putUnknownValue(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/enum/fixed/string/unknown-value") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putUnknownValueSync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * getKnownValue. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return days of the week along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getKnownValueWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getKnownValue(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * getKnownValue. + *

Response Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return days of the week along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getKnownValueWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getKnownValueSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * putKnownValue. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putKnownValueWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putKnownValue(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * putKnownValue. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putKnownValueWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putKnownValueSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * putUnknownValue. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putUnknownValueWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putUnknownValue(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * putUnknownValue. + *

Request Body Schema

+ * + *
+     * {@code
+     * String(Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putUnknownValueWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putUnknownValueSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/package-info.java new file mode 100644 index 00000000000..04bc7d39540 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Fixed. + * + */ +package type.enums.fixed.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/DaysOfWeekEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/DaysOfWeekEnum.java new file mode 100644 index 00000000000..70c01e482eb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/DaysOfWeekEnum.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.fixed.models; + +/** + * Days of the week. + */ +public enum DaysOfWeekEnum { + /** + * Monday. + */ + MONDAY("Monday"), + + /** + * Tuesday. + */ + TUESDAY("Tuesday"), + + /** + * Wednesday. + */ + WEDNESDAY("Wednesday"), + + /** + * Thursday. + */ + THURSDAY("Thursday"), + + /** + * Friday. + */ + FRIDAY("Friday"), + + /** + * Saturday. + */ + SATURDAY("Saturday"), + + /** + * Sunday. + */ + SUNDAY("Sunday"); + + /** + * The actual serialized value for a DaysOfWeekEnum instance. + */ + private final String value; + + DaysOfWeekEnum(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DaysOfWeekEnum instance. + * + * @param value the serialized value to parse. + * @return the parsed DaysOfWeekEnum object, or null if unable to parse. + */ + public static DaysOfWeekEnum fromString(String value) { + if (value == null) { + return null; + } + DaysOfWeekEnum[] items = DaysOfWeekEnum.values(); + for (DaysOfWeekEnum item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/package-info.java new file mode 100644 index 00000000000..8247a177399 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Fixed. + * + */ +package type.enums.fixed.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/package-info.java new file mode 100644 index 00000000000..67f11341ce6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/enums/fixed/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Fixed. + * + */ +package type.enums.fixed; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyAsyncClient.java new file mode 100644 index 00000000000..99e85e3c409 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyAsyncClient.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.empty; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.model.empty.implementation.EmptyClientImpl; +import type.model.empty.models.EmptyInput; +import type.model.empty.models.EmptyInputOutput; +import type.model.empty.models.EmptyOutput; + +/** + * Initializes a new instance of the asynchronous EmptyClient type. + */ +@ServiceClient(builder = EmptyClientBuilder.class, isAsync = true) +public final class EmptyAsyncClient { + @Generated + private final EmptyClientImpl serviceClient; + + /** + * Initializes an instance of EmptyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EmptyAsyncClient(EmptyClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The putEmpty operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putEmptyWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putEmptyWithResponseAsync(input, requestOptions); + } + + /** + * The getEmpty operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return empty model used in operation return type along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getEmptyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getEmptyWithResponseAsync(requestOptions); + } + + /** + * The postRoundTripEmpty operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return empty model used in both parameter and return type along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postRoundTripEmptyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postRoundTripEmptyWithResponseAsync(body, requestOptions); + } + + /** + * The putEmpty operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putEmpty(EmptyInput input) { + // Generated convenience method for putEmptyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putEmptyWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getEmpty operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return empty model used in operation return type on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getEmpty() { + // Generated convenience method for getEmptyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getEmptyWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(EmptyOutput.class)); + } + + /** + * The postRoundTripEmpty operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return empty model used in both parameter and return type on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono postRoundTripEmpty(EmptyInputOutput body) { + // Generated convenience method for postRoundTripEmptyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postRoundTripEmptyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(EmptyInputOutput.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClient.java new file mode 100644 index 00000000000..86c278e83a9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClient.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.empty; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.model.empty.implementation.EmptyClientImpl; +import type.model.empty.models.EmptyInput; +import type.model.empty.models.EmptyInputOutput; +import type.model.empty.models.EmptyOutput; + +/** + * Initializes a new instance of the synchronous EmptyClient type. + */ +@ServiceClient(builder = EmptyClientBuilder.class) +public final class EmptyClient { + @Generated + private final EmptyClientImpl serviceClient; + + /** + * Initializes an instance of EmptyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EmptyClient(EmptyClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The putEmpty operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putEmptyWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putEmptyWithResponse(input, requestOptions); + } + + /** + * The getEmpty operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return empty model used in operation return type along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getEmptyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getEmptyWithResponse(requestOptions); + } + + /** + * The postRoundTripEmpty operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return empty model used in both parameter and return type along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postRoundTripEmptyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.postRoundTripEmptyWithResponse(body, requestOptions); + } + + /** + * The putEmpty operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putEmpty(EmptyInput input) { + // Generated convenience method for putEmptyWithResponse + RequestOptions requestOptions = new RequestOptions(); + putEmptyWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The getEmpty operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return empty model used in operation return type. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EmptyOutput getEmpty() { + // Generated convenience method for getEmptyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getEmptyWithResponse(requestOptions).getValue().toObject(EmptyOutput.class); + } + + /** + * The postRoundTripEmpty operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return empty model used in both parameter and return type. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EmptyInputOutput postRoundTripEmpty(EmptyInputOutput body) { + // Generated convenience method for postRoundTripEmptyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postRoundTripEmptyWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(EmptyInputOutput.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClientBuilder.java new file mode 100644 index 00000000000..c70d5dcd270 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/EmptyClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.empty; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.model.empty.implementation.EmptyClientImpl; + +/** + * A builder for creating a new instance of the EmptyClient type. + */ +@ServiceClientBuilder(serviceClients = { EmptyClient.class, EmptyAsyncClient.class }) +public final class EmptyClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("type-model-empty.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the EmptyClientBuilder. + */ + @Generated + public EmptyClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EmptyClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EmptyClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EmptyClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EmptyClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EmptyClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EmptyClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EmptyClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EmptyClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the EmptyClientBuilder. + */ + @Generated + public EmptyClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of EmptyClientImpl with the provided parameters. + * + * @return an instance of EmptyClientImpl. + */ + @Generated + private EmptyClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + EmptyClientImpl client + = new EmptyClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of EmptyAsyncClient class. + * + * @return an instance of EmptyAsyncClient. + */ + @Generated + public EmptyAsyncClient buildAsyncClient() { + return new EmptyAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of EmptyClient class. + * + * @return an instance of EmptyClient. + */ + @Generated + public EmptyClient buildClient() { + return new EmptyClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(EmptyClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/EmptyClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/EmptyClientImpl.java new file mode 100644 index 00000000000..217ef782142 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/EmptyClientImpl.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.empty.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the EmptyClient type. + */ +public final class EmptyClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EmptyClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of EmptyClient client. + * + * @param endpoint Service host. + */ + public EmptyClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of EmptyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public EmptyClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of EmptyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public EmptyClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(EmptyClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for EmptyClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "EmptyClient") + public interface EmptyClientService { + @Put("/type/model/empty/alone") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putEmpty(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/empty/alone") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putEmptySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Get("/type/model/empty/alone") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getEmpty(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/empty/alone") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getEmptySync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/type/model/empty/round-trip") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> postRoundTripEmpty(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/type/model/empty/round-trip") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postRoundTripEmptySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The putEmpty operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putEmptyWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.putEmpty(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The putEmpty operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putEmptyWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putEmptySync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The getEmpty operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return empty model used in operation return type along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getEmptyWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getEmpty(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getEmpty operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return empty model used in operation return type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getEmptyWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getEmptySync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The postRoundTripEmpty operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return empty model used in both parameter and return type along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postRoundTripEmptyWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.postRoundTripEmpty(this.getEndpoint(), contentType, accept, body, + requestOptions, context)); + } + + /** + * The postRoundTripEmpty operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return empty model used in both parameter and return type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postRoundTripEmptyWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.postRoundTripEmptySync(this.getEndpoint(), contentType, accept, body, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/package-info.java new file mode 100644 index 00000000000..dda43e99b85 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Empty. + * Illustrates usage of empty model used in operation's parameters and responses. + * + */ +package type.model.empty.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInput.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInput.java new file mode 100644 index 00000000000..f69b2961f22 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInput.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.empty.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Empty model used in operation parameters. + */ +@Immutable +public final class EmptyInput implements JsonSerializable { + /** + * Creates an instance of EmptyInput class. + */ + @Generated + public EmptyInput() { + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EmptyInput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EmptyInput if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the EmptyInput. + */ + @Generated + public static EmptyInput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EmptyInput deserializedEmptyInput = new EmptyInput(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedEmptyInput; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInputOutput.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInputOutput.java new file mode 100644 index 00000000000..312f73ffca3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyInputOutput.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.empty.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Empty model used in both parameter and return type. + */ +@Immutable +public final class EmptyInputOutput implements JsonSerializable { + /** + * Creates an instance of EmptyInputOutput class. + */ + @Generated + public EmptyInputOutput() { + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EmptyInputOutput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EmptyInputOutput if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EmptyInputOutput. + */ + @Generated + public static EmptyInputOutput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EmptyInputOutput deserializedEmptyInputOutput = new EmptyInputOutput(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedEmptyInputOutput; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyOutput.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyOutput.java new file mode 100644 index 00000000000..a4e01e1f70b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/EmptyOutput.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.empty.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Empty model used in operation return type. + */ +@Immutable +public final class EmptyOutput implements JsonSerializable { + /** + * Creates an instance of EmptyOutput class. + */ + @Generated + private EmptyOutput() { + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EmptyOutput from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EmptyOutput if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EmptyOutput. + */ + @Generated + public static EmptyOutput fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EmptyOutput deserializedEmptyOutput = new EmptyOutput(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedEmptyOutput; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/package-info.java new file mode 100644 index 00000000000..b7e1da3133a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Empty. + * Illustrates usage of empty model used in operation's parameters and responses. + * + */ +package type.model.empty.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/package-info.java new file mode 100644 index 00000000000..b6fadba48b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/empty/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Empty. + * Illustrates usage of empty model used in operation's parameters and responses. + * + */ +package type.model.empty; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorAsyncClient.java new file mode 100644 index 00000000000..8fb568f9f5c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorAsyncClient.java @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.enumdiscriminator; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.model.inheritance.enumdiscriminator.implementation.EnumDiscriminatorClientImpl; +import type.model.inheritance.enumdiscriminator.models.Dog; +import type.model.inheritance.enumdiscriminator.models.Snake; + +/** + * Initializes a new instance of the asynchronous EnumDiscriminatorClient type. + */ +@ServiceClient(builder = EnumDiscriminatorClientBuilder.class, isAsync = true) +public final class EnumDiscriminatorAsyncClient { + @Generated + private final EnumDiscriminatorClientImpl serviceClient; + + /** + * Initializes an instance of EnumDiscriminatorAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnumDiscriminatorAsyncClient(EnumDiscriminatorClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Receive model with extensible enum discriminator type. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test extensible enum type for discriminator along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getExtensibleModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getExtensibleModelWithResponseAsync(requestOptions); + } + + /** + * Send model with extensible enum discriminator type. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input Dog to create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putExtensibleModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putExtensibleModelWithResponseAsync(input, requestOptions); + } + + /** + * Get a model omitting the discriminator. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model omitting the discriminator along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> + getExtensibleModelMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getExtensibleModelMissingDiscriminatorWithResponseAsync(requestOptions); + } + + /** + * Get a model containing discriminator value never defined. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model containing discriminator value never defined along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getExtensibleModelWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getExtensibleModelWrongDiscriminatorWithResponseAsync(requestOptions); + } + + /** + * Receive model with fixed enum discriminator type. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test fixed enum type for discriminator along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFixedModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getFixedModelWithResponseAsync(requestOptions); + } + + /** + * Send model with fixed enum discriminator type. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input Snake to create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putFixedModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putFixedModelWithResponseAsync(input, requestOptions); + } + + /** + * Get a model omitting the discriminator. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model omitting the discriminator along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFixedModelMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getFixedModelMissingDiscriminatorWithResponseAsync(requestOptions); + } + + /** + * Get a model containing discriminator value never defined. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model containing discriminator value never defined along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFixedModelWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getFixedModelWrongDiscriminatorWithResponseAsync(requestOptions); + } + + /** + * Receive model with extensible enum discriminator type. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test extensible enum type for discriminator on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getExtensibleModel() { + // Generated convenience method for getExtensibleModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getExtensibleModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); + } + + /** + * Send model with extensible enum discriminator type. + * + * @param input Dog to create. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putExtensibleModel(Dog input) { + // Generated convenience method for putExtensibleModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putExtensibleModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Get a model omitting the discriminator. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a model omitting the discriminator on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getExtensibleModelMissingDiscriminator() { + // Generated convenience method for getExtensibleModelMissingDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getExtensibleModelMissingDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); + } + + /** + * Get a model containing discriminator value never defined. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a model containing discriminator value never defined on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getExtensibleModelWrongDiscriminator() { + // Generated convenience method for getExtensibleModelWrongDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getExtensibleModelWrongDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Dog.class)); + } + + /** + * Receive model with fixed enum discriminator type. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test fixed enum type for discriminator on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getFixedModel() { + // Generated convenience method for getFixedModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getFixedModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Snake.class)); + } + + /** + * Send model with fixed enum discriminator type. + * + * @param input Snake to create. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putFixedModel(Snake input) { + // Generated convenience method for putFixedModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putFixedModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Get a model omitting the discriminator. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a model omitting the discriminator on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getFixedModelMissingDiscriminator() { + // Generated convenience method for getFixedModelMissingDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getFixedModelMissingDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Snake.class)); + } + + /** + * Get a model containing discriminator value never defined. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a model containing discriminator value never defined on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getFixedModelWrongDiscriminator() { + // Generated convenience method for getFixedModelWrongDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getFixedModelWrongDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Snake.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClient.java new file mode 100644 index 00000000000..d22a71956e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClient.java @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.enumdiscriminator; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.model.inheritance.enumdiscriminator.implementation.EnumDiscriminatorClientImpl; +import type.model.inheritance.enumdiscriminator.models.Dog; +import type.model.inheritance.enumdiscriminator.models.Snake; + +/** + * Initializes a new instance of the synchronous EnumDiscriminatorClient type. + */ +@ServiceClient(builder = EnumDiscriminatorClientBuilder.class) +public final class EnumDiscriminatorClient { + @Generated + private final EnumDiscriminatorClientImpl serviceClient; + + /** + * Initializes an instance of EnumDiscriminatorClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnumDiscriminatorClient(EnumDiscriminatorClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Receive model with extensible enum discriminator type. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test extensible enum type for discriminator along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getExtensibleModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getExtensibleModelWithResponse(requestOptions); + } + + /** + * Send model with extensible enum discriminator type. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input Dog to create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putExtensibleModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putExtensibleModelWithResponse(input, requestOptions); + } + + /** + * Get a model omitting the discriminator. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model omitting the discriminator along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getExtensibleModelMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getExtensibleModelMissingDiscriminatorWithResponse(requestOptions); + } + + /** + * Get a model containing discriminator value never defined. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model containing discriminator value never defined along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getExtensibleModelWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getExtensibleModelWrongDiscriminatorWithResponse(requestOptions); + } + + /** + * Receive model with fixed enum discriminator type. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test fixed enum type for discriminator along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFixedModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getFixedModelWithResponse(requestOptions); + } + + /** + * Send model with fixed enum discriminator type. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input Snake to create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putFixedModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putFixedModelWithResponse(input, requestOptions); + } + + /** + * Get a model omitting the discriminator. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model omitting the discriminator along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFixedModelMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getFixedModelMissingDiscriminatorWithResponse(requestOptions); + } + + /** + * Get a model containing discriminator value never defined. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model containing discriminator value never defined along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFixedModelWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getFixedModelWrongDiscriminatorWithResponse(requestOptions); + } + + /** + * Receive model with extensible enum discriminator type. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test extensible enum type for discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Dog getExtensibleModel() { + // Generated convenience method for getExtensibleModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getExtensibleModelWithResponse(requestOptions).getValue().toObject(Dog.class); + } + + /** + * Send model with extensible enum discriminator type. + * + * @param input Dog to create. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putExtensibleModel(Dog input) { + // Generated convenience method for putExtensibleModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + putExtensibleModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * Get a model omitting the discriminator. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a model omitting the discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Dog getExtensibleModelMissingDiscriminator() { + // Generated convenience method for getExtensibleModelMissingDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getExtensibleModelMissingDiscriminatorWithResponse(requestOptions).getValue().toObject(Dog.class); + } + + /** + * Get a model containing discriminator value never defined. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a model containing discriminator value never defined. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Dog getExtensibleModelWrongDiscriminator() { + // Generated convenience method for getExtensibleModelWrongDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getExtensibleModelWrongDiscriminatorWithResponse(requestOptions).getValue().toObject(Dog.class); + } + + /** + * Receive model with fixed enum discriminator type. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test fixed enum type for discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Snake getFixedModel() { + // Generated convenience method for getFixedModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getFixedModelWithResponse(requestOptions).getValue().toObject(Snake.class); + } + + /** + * Send model with fixed enum discriminator type. + * + * @param input Snake to create. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putFixedModel(Snake input) { + // Generated convenience method for putFixedModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + putFixedModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * Get a model omitting the discriminator. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a model omitting the discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Snake getFixedModelMissingDiscriminator() { + // Generated convenience method for getFixedModelMissingDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getFixedModelMissingDiscriminatorWithResponse(requestOptions).getValue().toObject(Snake.class); + } + + /** + * Get a model containing discriminator value never defined. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a model containing discriminator value never defined. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Snake getFixedModelWrongDiscriminator() { + // Generated convenience method for getFixedModelWrongDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getFixedModelWrongDiscriminatorWithResponse(requestOptions).getValue().toObject(Snake.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClientBuilder.java new file mode 100644 index 00000000000..dd739440e03 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.enumdiscriminator; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.model.inheritance.enumdiscriminator.implementation.EnumDiscriminatorClientImpl; + +/** + * A builder for creating a new instance of the EnumDiscriminatorClient type. + */ +@ServiceClientBuilder(serviceClients = { EnumDiscriminatorClient.class, EnumDiscriminatorAsyncClient.class }) +public final class EnumDiscriminatorClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("type-model-inheritance-enumdiscriminator.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the EnumDiscriminatorClientBuilder. + */ + @Generated + public EnumDiscriminatorClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumDiscriminatorClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumDiscriminatorClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumDiscriminatorClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumDiscriminatorClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumDiscriminatorClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumDiscriminatorClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumDiscriminatorClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public EnumDiscriminatorClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the EnumDiscriminatorClientBuilder. + */ + @Generated + public EnumDiscriminatorClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of EnumDiscriminatorClientImpl with the provided parameters. + * + * @return an instance of EnumDiscriminatorClientImpl. + */ + @Generated + private EnumDiscriminatorClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + EnumDiscriminatorClientImpl client = new EnumDiscriminatorClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of EnumDiscriminatorAsyncClient class. + * + * @return an instance of EnumDiscriminatorAsyncClient. + */ + @Generated + public EnumDiscriminatorAsyncClient buildAsyncClient() { + return new EnumDiscriminatorAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of EnumDiscriminatorClient class. + * + * @return an instance of EnumDiscriminatorClient. + */ + @Generated + public EnumDiscriminatorClient buildClient() { + return new EnumDiscriminatorClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(EnumDiscriminatorClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java new file mode 100644 index 00000000000..5026de86868 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java @@ -0,0 +1,715 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.enumdiscriminator.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the EnumDiscriminatorClient type. + */ +public final class EnumDiscriminatorClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EnumDiscriminatorClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of EnumDiscriminatorClient client. + * + * @param endpoint Service host. + */ + public EnumDiscriminatorClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of EnumDiscriminatorClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public EnumDiscriminatorClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of EnumDiscriminatorClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public EnumDiscriminatorClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(EnumDiscriminatorClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for EnumDiscriminatorClient to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "EnumDiscriminatorClient") + public interface EnumDiscriminatorClientService { + @Get("/type/model/inheritance/enum-discriminator/extensible-enum") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getExtensibleModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-discriminator/extensible-enum") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getExtensibleModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/enum-discriminator/extensible-enum") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putExtensibleModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/enum-discriminator/extensible-enum") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putExtensibleModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-discriminator/extensible-enum/missingdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getExtensibleModelMissingDiscriminator(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-discriminator/extensible-enum/missingdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getExtensibleModelMissingDiscriminatorSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-discriminator/extensible-enum/wrongdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getExtensibleModelWrongDiscriminator(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-discriminator/extensible-enum/wrongdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getExtensibleModelWrongDiscriminatorSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-discriminator/fixed-enum") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getFixedModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-discriminator/fixed-enum") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getFixedModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/enum-discriminator/fixed-enum") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putFixedModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/enum-discriminator/fixed-enum") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putFixedModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-discriminator/fixed-enum/missingdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getFixedModelMissingDiscriminator(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-discriminator/fixed-enum/missingdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getFixedModelMissingDiscriminatorSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-discriminator/fixed-enum/wrongdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getFixedModelWrongDiscriminator(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/enum-discriminator/fixed-enum/wrongdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getFixedModelWrongDiscriminatorSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * Receive model with extensible enum discriminator type. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test extensible enum type for discriminator along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getExtensibleModelWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getExtensibleModel(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Receive model with extensible enum discriminator type. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test extensible enum type for discriminator along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getExtensibleModelWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getExtensibleModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Send model with extensible enum discriminator type. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input Dog to create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putExtensibleModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putExtensibleModel(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * Send model with extensible enum discriminator type. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input Dog to create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putExtensibleModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putExtensibleModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * Get a model omitting the discriminator. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model omitting the discriminator along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> + getExtensibleModelMissingDiscriminatorWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getExtensibleModelMissingDiscriminator(this.getEndpoint(), + accept, requestOptions, context)); + } + + /** + * Get a model omitting the discriminator. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model omitting the discriminator along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getExtensibleModelMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getExtensibleModelMissingDiscriminatorSync(this.getEndpoint(), accept, requestOptions, + Context.NONE); + } + + /** + * Get a model containing discriminator value never defined. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model containing discriminator value never defined along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> + getExtensibleModelWrongDiscriminatorWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getExtensibleModelWrongDiscriminator(this.getEndpoint(), accept, + requestOptions, context)); + } + + /** + * Get a model containing discriminator value never defined. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(golden) (Required)
+     *     weight: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model containing discriminator value never defined along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getExtensibleModelWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getExtensibleModelWrongDiscriminatorSync(this.getEndpoint(), accept, requestOptions, + Context.NONE); + } + + /** + * Receive model with fixed enum discriminator type. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test fixed enum type for discriminator along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFixedModelWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getFixedModel(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Receive model with fixed enum discriminator type. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test fixed enum type for discriminator along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFixedModelWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getFixedModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Send model with fixed enum discriminator type. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input Snake to create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putFixedModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putFixedModel(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * Send model with fixed enum discriminator type. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input Snake to create. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putFixedModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putFixedModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * Get a model omitting the discriminator. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model omitting the discriminator along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> + getFixedModelMissingDiscriminatorWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getFixedModelMissingDiscriminator(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get a model omitting the discriminator. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model omitting the discriminator along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFixedModelMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getFixedModelMissingDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get a model containing discriminator value never defined. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model containing discriminator value never defined along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getFixedModelWrongDiscriminatorWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getFixedModelWrongDiscriminator(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get a model containing discriminator value never defined. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String(cobra) (Required)
+     *     length: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a model containing discriminator value never defined along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getFixedModelWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getFixedModelWrongDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/package-info.java new file mode 100644 index 00000000000..7c498adcc80 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for EnumDiscriminator. + * Illustrates inheritance with enum discriminator. + * + */ +package type.model.inheritance.enumdiscriminator.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Cobra.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Cobra.java new file mode 100644 index 00000000000..197808ae5dc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Cobra.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.enumdiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Cobra model. + */ +@Immutable +public final class Cobra extends Snake { + /* + * discriminator property + */ + @Generated + private SnakeKind kind = SnakeKind.COBRA; + + /** + * Creates an instance of Cobra class. + * + * @param length the length value to set. + */ + @Generated + public Cobra(int length) { + super(length); + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + @Generated + @Override + public SnakeKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("length", getLength()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Cobra from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Cobra if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Cobra. + */ + @Generated + public static Cobra fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int length = 0; + SnakeKind kind = SnakeKind.COBRA; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("length".equals(fieldName)) { + length = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = SnakeKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + Cobra deserializedCobra = new Cobra(length); + deserializedCobra.kind = kind; + + return deserializedCobra; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Dog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Dog.java new file mode 100644 index 00000000000..29c283b93a9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Dog.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.enumdiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Test extensible enum type for discriminator. + */ +@Immutable +public class Dog implements JsonSerializable { + /* + * discriminator property + */ + @Generated + private DogKind kind = DogKind.fromString("Dog"); + + /* + * Weight of the dog + */ + @Generated + private final int weight; + + /** + * Creates an instance of Dog class. + * + * @param weight the weight value to set. + */ + @Generated + public Dog(int weight) { + this.weight = weight; + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + @Generated + public DogKind getKind() { + return this.kind; + } + + /** + * Get the weight property: Weight of the dog. + * + * @return the weight value. + */ + @Generated + public int getWeight() { + return this.weight; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("weight", this.weight); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dog from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dog if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Dog. + */ + @Generated + public static Dog fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("golden".equals(discriminatorValue)) { + return Golden.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Dog fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int weight = 0; + DogKind kind = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("weight".equals(fieldName)) { + weight = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = DogKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + Dog deserializedDog = new Dog(weight); + deserializedDog.kind = kind; + + return deserializedDog; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/DogKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/DogKind.java new file mode 100644 index 00000000000..ea58d06ad70 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/DogKind.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.enumdiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * extensible enum type for discriminator. + */ +public final class DogKind extends ExpandableStringEnum { + /** + * Species golden. + */ + @Generated + public static final DogKind GOLDEN = fromString("golden"); + + /** + * Creates a new instance of DogKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DogKind() { + } + + /** + * Creates or finds a DogKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding DogKind. + */ + @Generated + public static DogKind fromString(String name) { + return fromString(name, DogKind.class); + } + + /** + * Gets known DogKind values. + * + * @return known DogKind values. + */ + @Generated + public static Collection values() { + return values(DogKind.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Golden.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Golden.java new file mode 100644 index 00000000000..733b5ba7fd1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Golden.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.enumdiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Golden dog model. + */ +@Immutable +public final class Golden extends Dog { + /* + * discriminator property + */ + @Generated + private DogKind kind = DogKind.GOLDEN; + + /** + * Creates an instance of Golden class. + * + * @param weight the weight value to set. + */ + @Generated + public Golden(int weight) { + super(weight); + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + @Generated + @Override + public DogKind getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("weight", getWeight()); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Golden from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Golden if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Golden. + */ + @Generated + public static Golden fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int weight = 0; + DogKind kind = DogKind.GOLDEN; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("weight".equals(fieldName)) { + weight = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = DogKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + Golden deserializedGolden = new Golden(weight); + deserializedGolden.kind = kind; + + return deserializedGolden; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Snake.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Snake.java new file mode 100644 index 00000000000..c3fd6b2184e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/Snake.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.enumdiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Test fixed enum type for discriminator. + */ +@Immutable +public class Snake implements JsonSerializable { + /* + * discriminator property + */ + @Generated + private SnakeKind kind; + + /* + * Length of the snake + */ + @Generated + private final int length; + + /** + * Creates an instance of Snake class. + * + * @param length the length value to set. + */ + @Generated + public Snake(int length) { + this.length = length; + } + + /** + * Get the kind property: discriminator property. + * + * @return the kind value. + */ + @Generated + public SnakeKind getKind() { + return this.kind; + } + + /** + * Get the length property: Length of the snake. + * + * @return the length value. + */ + @Generated + public int getLength() { + return this.length; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("length", this.length); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Snake from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Snake if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Snake. + */ + @Generated + public static Snake fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("cobra".equals(discriminatorValue)) { + return Cobra.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Snake fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int length = 0; + SnakeKind kind = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("length".equals(fieldName)) { + length = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = SnakeKind.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + Snake deserializedSnake = new Snake(length); + deserializedSnake.kind = kind; + + return deserializedSnake; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/SnakeKind.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/SnakeKind.java new file mode 100644 index 00000000000..701a1a9a0db --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/SnakeKind.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.enumdiscriminator.models; + +/** + * fixed enum type for discriminator. + */ +public enum SnakeKind { + /** + * Species cobra. + */ + COBRA("cobra"); + + /** + * The actual serialized value for a SnakeKind instance. + */ + private final String value; + + SnakeKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SnakeKind instance. + * + * @param value the serialized value to parse. + * @return the parsed SnakeKind object, or null if unable to parse. + */ + public static SnakeKind fromString(String value) { + if (value == null) { + return null; + } + SnakeKind[] items = SnakeKind.values(); + for (SnakeKind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/package-info.java new file mode 100644 index 00000000000..8535700a042 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for EnumDiscriminator. + * Illustrates inheritance with enum discriminator. + * + */ +package type.model.inheritance.enumdiscriminator.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/package-info.java new file mode 100644 index 00000000000..95e67087487 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/enumdiscriminator/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for EnumDiscriminator. + * Illustrates inheritance with enum discriminator. + * + */ +package type.model.inheritance.enumdiscriminator; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorAsyncClient.java new file mode 100644 index 00000000000..baf5603147e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorAsyncClient.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.nesteddiscriminator; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.model.inheritance.nesteddiscriminator.implementation.NestedDiscriminatorClientImpl; +import type.model.inheritance.nesteddiscriminator.models.Fish; + +/** + * Initializes a new instance of the asynchronous NestedDiscriminatorClient type. + */ +@ServiceClient(builder = NestedDiscriminatorClientBuilder.class, isAsync = true) +public final class NestedDiscriminatorAsyncClient { + @Generated + private final NestedDiscriminatorClientImpl serviceClient; + + /** + * Initializes an instance of NestedDiscriminatorAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NestedDiscriminatorAsyncClient(NestedDiscriminatorClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getModelWithResponseAsync(requestOptions); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putModelWithResponseAsync(input, requestOptions); + } + + /** + * The getRecursiveModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRecursiveModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getRecursiveModelWithResponseAsync(requestOptions); + } + + /** + * The putRecursiveModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putRecursiveModelWithResponseAsync(input, requestOptions); + } + + /** + * The getMissingDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getMissingDiscriminatorWithResponseAsync(requestOptions); + } + + /** + * The getWrongDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWrongDiscriminatorWithResponseAsync(requestOptions); + } + + /** + * The getModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getModel() { + // Generated convenience method for getModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); + } + + /** + * The putModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putModel(Fish input) { + // Generated convenience method for putModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getRecursiveModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getRecursiveModel() { + // Generated convenience method for getRecursiveModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRecursiveModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); + } + + /** + * The putRecursiveModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putRecursiveModel(Fish input) { + // Generated convenience method for putRecursiveModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putRecursiveModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getMissingDiscriminator operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getMissingDiscriminator() { + // Generated convenience method for getMissingDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getMissingDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); + } + + /** + * The getWrongDiscriminator operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getWrongDiscriminator() { + // Generated convenience method for getWrongDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWrongDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Fish.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClient.java new file mode 100644 index 00000000000..ac552183ab1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClient.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.nesteddiscriminator; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.model.inheritance.nesteddiscriminator.implementation.NestedDiscriminatorClientImpl; +import type.model.inheritance.nesteddiscriminator.models.Fish; + +/** + * Initializes a new instance of the synchronous NestedDiscriminatorClient type. + */ +@ServiceClient(builder = NestedDiscriminatorClientBuilder.class) +public final class NestedDiscriminatorClient { + @Generated + private final NestedDiscriminatorClientImpl serviceClient; + + /** + * Initializes an instance of NestedDiscriminatorClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NestedDiscriminatorClient(NestedDiscriminatorClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getModelWithResponse(requestOptions); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putModelWithResponse(input, requestOptions); + } + + /** + * The getRecursiveModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRecursiveModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getRecursiveModelWithResponse(requestOptions); + } + + /** + * The putRecursiveModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putRecursiveModelWithResponse(input, requestOptions); + } + + /** + * The getMissingDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getMissingDiscriminatorWithResponse(requestOptions); + } + + /** + * The getWrongDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWrongDiscriminatorWithResponse(requestOptions); + } + + /** + * The getModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Fish getModel() { + // Generated convenience method for getModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getModelWithResponse(requestOptions).getValue().toObject(Fish.class); + } + + /** + * The putModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putModel(Fish input) { + // Generated convenience method for putModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + putModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The getRecursiveModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Fish getRecursiveModel() { + // Generated convenience method for getRecursiveModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRecursiveModelWithResponse(requestOptions).getValue().toObject(Fish.class); + } + + /** + * The putRecursiveModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putRecursiveModel(Fish input) { + // Generated convenience method for putRecursiveModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + putRecursiveModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The getMissingDiscriminator operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Fish getMissingDiscriminator() { + // Generated convenience method for getMissingDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getMissingDiscriminatorWithResponse(requestOptions).getValue().toObject(Fish.class); + } + + /** + * The getWrongDiscriminator operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Fish getWrongDiscriminator() { + // Generated convenience method for getWrongDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWrongDiscriminatorWithResponse(requestOptions).getValue().toObject(Fish.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClientBuilder.java new file mode 100644 index 00000000000..96fc0b17d39 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.nesteddiscriminator; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.model.inheritance.nesteddiscriminator.implementation.NestedDiscriminatorClientImpl; + +/** + * A builder for creating a new instance of the NestedDiscriminatorClient type. + */ +@ServiceClientBuilder(serviceClients = { NestedDiscriminatorClient.class, NestedDiscriminatorAsyncClient.class }) +public final class NestedDiscriminatorClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("type-model-inheritance-nesteddiscriminator.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the NestedDiscriminatorClientBuilder. + */ + @Generated + public NestedDiscriminatorClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NestedDiscriminatorClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NestedDiscriminatorClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NestedDiscriminatorClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NestedDiscriminatorClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NestedDiscriminatorClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NestedDiscriminatorClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NestedDiscriminatorClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NestedDiscriminatorClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the NestedDiscriminatorClientBuilder. + */ + @Generated + public NestedDiscriminatorClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of NestedDiscriminatorClientImpl with the provided parameters. + * + * @return an instance of NestedDiscriminatorClientImpl. + */ + @Generated + private NestedDiscriminatorClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + NestedDiscriminatorClientImpl client = new NestedDiscriminatorClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of NestedDiscriminatorAsyncClient class. + * + * @return an instance of NestedDiscriminatorAsyncClient. + */ + @Generated + public NestedDiscriminatorAsyncClient buildAsyncClient() { + return new NestedDiscriminatorAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of NestedDiscriminatorClient class. + * + * @return an instance of NestedDiscriminatorClient. + */ + @Generated + public NestedDiscriminatorClient buildClient() { + return new NestedDiscriminatorClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(NestedDiscriminatorClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java new file mode 100644 index 00000000000..df2f0e65d03 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java @@ -0,0 +1,571 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.nesteddiscriminator.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the NestedDiscriminatorClient type. + */ +public final class NestedDiscriminatorClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NestedDiscriminatorClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of NestedDiscriminatorClient client. + * + * @param endpoint Service host. + */ + public NestedDiscriminatorClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NestedDiscriminatorClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public NestedDiscriminatorClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NestedDiscriminatorClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public NestedDiscriminatorClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(NestedDiscriminatorClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for NestedDiscriminatorClient to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NestedDiscriminatorClient") + public interface NestedDiscriminatorClientService { + @Get("/type/model/inheritance/nested-discriminator/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/nested-discriminator/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getModelSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/nested-discriminator/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/nested-discriminator/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/nested-discriminator/recursivemodel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getRecursiveModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/nested-discriminator/recursivemodel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getRecursiveModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/nested-discriminator/recursivemodel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putRecursiveModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/nested-discriminator/recursivemodel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putRecursiveModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/nested-discriminator/missingdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getMissingDiscriminator(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/nested-discriminator/missingdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getMissingDiscriminatorSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/nested-discriminator/wrongdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getWrongDiscriminator(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/nested-discriminator/wrongdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getWrongDiscriminatorSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getModelWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getModel(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getModelWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.putModel(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The getRecursiveModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRecursiveModelWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getRecursiveModel(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getRecursiveModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRecursiveModelWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getRecursiveModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The putRecursiveModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putRecursiveModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putRecursiveModel(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The putRecursiveModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putRecursiveModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The getMissingDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMissingDiscriminatorWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getMissingDiscriminator(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getMissingDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getMissingDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getWrongDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWrongDiscriminatorWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getWrongDiscriminator(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getWrongDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     age: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic multiple levels inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getWrongDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/package-info.java new file mode 100644 index 00000000000..deb968c8752 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for NestedDiscriminator. + * Illustrates multiple level inheritance with multiple discriminators. + * + */ +package type.model.inheritance.nesteddiscriminator.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Fish.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Fish.java new file mode 100644 index 00000000000..c30dd9f908c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Fish.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.nesteddiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is base model for polymorphic multiple levels inheritance with a discriminator. + */ +@Immutable +public class Fish implements JsonSerializable { + /* + * Discriminator property for Fish. + */ + @Generated + private String kind = "Fish"; + + /* + * The age property. + */ + @Generated + private final int age; + + /** + * Creates an instance of Fish class. + * + * @param age the age value to set. + */ + @Generated + public Fish(int age) { + this.age = age; + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Generated + public String getKind() { + return this.kind; + } + + /** + * Get the age property: The age property. + * + * @return the age value. + */ + @Generated + public int getAge() { + return this.age; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("age", this.age); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Fish from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Fish if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Fish. + */ + @Generated + public static Fish fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("shark".equals(discriminatorValue)) { + return Shark.fromJson(readerToUse.reset()); + } else if ("salmon".equals(discriminatorValue)) { + return Salmon.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Fish fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int age = 0; + String kind = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + age = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + Fish deserializedFish = new Fish(age); + deserializedFish.kind = kind; + + return deserializedFish; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java new file mode 100644 index 00000000000..c852ed3cb50 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.nesteddiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The third level model GoblinShark in polymorphic multiple levels inheritance. + */ +@Immutable +public final class GoblinShark extends Shark { + /* + * Discriminator property for Fish. + */ + @Generated + private String kind = "shark"; + + /* + * The sharktype property. + */ + @Generated + private String sharktype = "goblin"; + + /** + * Creates an instance of GoblinShark class. + * + * @param age the age value to set. + */ + @Generated + public GoblinShark(int age) { + super(age); + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * Get the sharktype property: The sharktype property. + * + * @return the sharktype value. + */ + @Generated + @Override + public String getSharktype() { + return this.sharktype; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeIntField("age", getAge()); + jsonWriter.writeStringField("sharktype", this.sharktype); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GoblinShark from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GoblinShark if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GoblinShark. + */ + @Generated + public static GoblinShark fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int age = 0; + String sharktype = "goblin"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + age = reader.getInt(); + } else if ("sharktype".equals(fieldName)) { + sharktype = reader.getString(); + } else { + reader.skipChildren(); + } + } + GoblinShark deserializedGoblinShark = new GoblinShark(age); + deserializedGoblinShark.sharktype = sharktype; + + return deserializedGoblinShark; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Salmon.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Salmon.java new file mode 100644 index 00000000000..1b624cf2a94 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Salmon.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.nesteddiscriminator.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic + * instances. + */ +@Fluent +public final class Salmon extends Fish { + /* + * Discriminator property for Fish. + */ + @Generated + private String kind = "salmon"; + + /* + * The friends property. + */ + @Generated + private List friends; + + /* + * The hate property. + */ + @Generated + private Map hate; + + /* + * The partner property. + */ + @Generated + private Fish partner; + + /** + * Creates an instance of Salmon class. + * + * @param age the age value to set. + */ + @Generated + public Salmon(int age) { + super(age); + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * Get the friends property: The friends property. + * + * @return the friends value. + */ + @Generated + public List getFriends() { + return this.friends; + } + + /** + * Set the friends property: The friends property. + * + * @param friends the friends value to set. + * @return the Salmon object itself. + */ + @Generated + public Salmon setFriends(List friends) { + this.friends = friends; + return this; + } + + /** + * Get the hate property: The hate property. + * + * @return the hate value. + */ + @Generated + public Map getHate() { + return this.hate; + } + + /** + * Set the hate property: The hate property. + * + * @param hate the hate value to set. + * @return the Salmon object itself. + */ + @Generated + public Salmon setHate(Map hate) { + this.hate = hate; + return this; + } + + /** + * Get the partner property: The partner property. + * + * @return the partner value. + */ + @Generated + public Fish getPartner() { + return this.partner; + } + + /** + * Set the partner property: The partner property. + * + * @param partner the partner value to set. + * @return the Salmon object itself. + */ + @Generated + public Salmon setPartner(Fish partner) { + this.partner = partner; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("age", getAge()); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeArrayField("friends", this.friends, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("hate", this.hate, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("partner", this.partner); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Salmon from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Salmon if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Salmon. + */ + @Generated + public static Salmon fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int age = 0; + String kind = "salmon"; + List friends = null; + Map hate = null; + Fish partner = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + age = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else if ("friends".equals(fieldName)) { + friends = reader.readArray(reader1 -> Fish.fromJson(reader1)); + } else if ("hate".equals(fieldName)) { + hate = reader.readMap(reader1 -> Fish.fromJson(reader1)); + } else if ("partner".equals(fieldName)) { + partner = Fish.fromJson(reader); + } else { + reader.skipChildren(); + } + } + Salmon deserializedSalmon = new Salmon(age); + deserializedSalmon.kind = kind; + deserializedSalmon.friends = friends; + deserializedSalmon.hate = hate; + deserializedSalmon.partner = partner; + + return deserializedSalmon; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/SawShark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/SawShark.java new file mode 100644 index 00000000000..a1f4a21c76d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/SawShark.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.nesteddiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The third level model SawShark in polymorphic multiple levels inheritance. + */ +@Immutable +public final class SawShark extends Shark { + /* + * Discriminator property for Fish. + */ + @Generated + private String kind = "shark"; + + /* + * The sharktype property. + */ + @Generated + private String sharktype = "saw"; + + /** + * Creates an instance of SawShark class. + * + * @param age the age value to set. + */ + @Generated + public SawShark(int age) { + super(age); + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * Get the sharktype property: The sharktype property. + * + * @return the sharktype value. + */ + @Generated + @Override + public String getSharktype() { + return this.sharktype; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeIntField("age", getAge()); + jsonWriter.writeStringField("sharktype", this.sharktype); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SawShark from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SawShark if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SawShark. + */ + @Generated + public static SawShark fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int age = 0; + String sharktype = "saw"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + age = reader.getInt(); + } else if ("sharktype".equals(fieldName)) { + sharktype = reader.getString(); + } else { + reader.skipChildren(); + } + } + SawShark deserializedSawShark = new SawShark(age); + deserializedSawShark.sharktype = sharktype; + + return deserializedSawShark; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Shark.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Shark.java new file mode 100644 index 00000000000..3b9f02f8e18 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/Shark.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.nesteddiscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The second level model in polymorphic multiple levels inheritance and it defines a new discriminator. + */ +@Immutable +public class Shark extends Fish { + /* + * Discriminator property for Fish. + */ + @Generated + private String kind = "shark"; + + /* + * The sharktype property. + */ + @Generated + private String sharktype = "shark"; + + /** + * Creates an instance of Shark class. + * + * @param age the age value to set. + */ + @Generated + public Shark(int age) { + super(age); + } + + /** + * Get the kind property: Discriminator property for Fish. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * Get the sharktype property: The sharktype property. + * + * @return the sharktype value. + */ + @Generated + public String getSharktype() { + return this.sharktype; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeIntField("age", getAge()); + jsonWriter.writeStringField("sharktype", this.sharktype); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Shark from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Shark if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Shark. + */ + @Generated + public static Shark fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("sharktype".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("saw".equals(discriminatorValue)) { + return SawShark.fromJson(readerToUse.reset()); + } else if ("goblin".equals(discriminatorValue)) { + return GoblinShark.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Shark fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int age = 0; + String sharktype = "shark"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("age".equals(fieldName)) { + age = reader.getInt(); + } else if ("sharktype".equals(fieldName)) { + sharktype = reader.getString(); + } else { + reader.skipChildren(); + } + } + Shark deserializedShark = new Shark(age); + deserializedShark.sharktype = sharktype; + + return deserializedShark; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/package-info.java new file mode 100644 index 00000000000..cd42efe5425 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for NestedDiscriminator. + * Illustrates multiple level inheritance with multiple discriminators. + * + */ +package type.model.inheritance.nesteddiscriminator.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/package-info.java new file mode 100644 index 00000000000..0f75dd1a6e2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/nesteddiscriminator/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for NestedDiscriminator. + * Illustrates multiple level inheritance with multiple discriminators. + * + */ +package type.model.inheritance.nesteddiscriminator; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedAsyncClient.java new file mode 100644 index 00000000000..93fdecacc05 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedAsyncClient.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.notdiscriminated; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.model.inheritance.notdiscriminated.implementation.NotDiscriminatedClientImpl; +import type.model.inheritance.notdiscriminated.models.Siamese; + +/** + * Initializes a new instance of the asynchronous NotDiscriminatedClient type. + */ +@ServiceClient(builder = NotDiscriminatedClientBuilder.class, isAsync = true) +public final class NotDiscriminatedAsyncClient { + @Generated + private final NotDiscriminatedClientImpl serviceClient; + + /** + * Initializes an instance of NotDiscriminatedAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NotDiscriminatedAsyncClient(NotDiscriminatedClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The postValid operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postValidWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.postValidWithResponseAsync(input, requestOptions); + } + + /** + * The getValid operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the third level model in the normal multiple levels inheritance along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getValidWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getValidWithResponseAsync(requestOptions); + } + + /** + * The putValid operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the third level model in the normal multiple levels inheritance along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putValidWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putValidWithResponseAsync(input, requestOptions); + } + + /** + * The postValid operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono postValid(Siamese input) { + // Generated convenience method for postValidWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postValidWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getValid operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the third level model in the normal multiple levels inheritance on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getValid() { + // Generated convenience method for getValidWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getValidWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Siamese.class)); + } + + /** + * The putValid operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the third level model in the normal multiple levels inheritance on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putValid(Siamese input) { + // Generated convenience method for putValidWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putValidWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Siamese.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClient.java new file mode 100644 index 00000000000..c80e072a3ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClient.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.notdiscriminated; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.model.inheritance.notdiscriminated.implementation.NotDiscriminatedClientImpl; +import type.model.inheritance.notdiscriminated.models.Siamese; + +/** + * Initializes a new instance of the synchronous NotDiscriminatedClient type. + */ +@ServiceClient(builder = NotDiscriminatedClientBuilder.class) +public final class NotDiscriminatedClient { + @Generated + private final NotDiscriminatedClientImpl serviceClient; + + /** + * Initializes an instance of NotDiscriminatedClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NotDiscriminatedClient(NotDiscriminatedClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The postValid operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postValidWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.postValidWithResponse(input, requestOptions); + } + + /** + * The getValid operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the third level model in the normal multiple levels inheritance along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getValidWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getValidWithResponse(requestOptions); + } + + /** + * The putValid operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the third level model in the normal multiple levels inheritance along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putValidWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putValidWithResponse(input, requestOptions); + } + + /** + * The postValid operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void postValid(Siamese input) { + // Generated convenience method for postValidWithResponse + RequestOptions requestOptions = new RequestOptions(); + postValidWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The getValid operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the third level model in the normal multiple levels inheritance. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Siamese getValid() { + // Generated convenience method for getValidWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getValidWithResponse(requestOptions).getValue().toObject(Siamese.class); + } + + /** + * The putValid operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the third level model in the normal multiple levels inheritance. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Siamese putValid(Siamese input) { + // Generated convenience method for putValidWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putValidWithResponse(BinaryData.fromObject(input), requestOptions).getValue().toObject(Siamese.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClientBuilder.java new file mode 100644 index 00000000000..443bf41497c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.notdiscriminated; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.model.inheritance.notdiscriminated.implementation.NotDiscriminatedClientImpl; + +/** + * A builder for creating a new instance of the NotDiscriminatedClient type. + */ +@ServiceClientBuilder(serviceClients = { NotDiscriminatedClient.class, NotDiscriminatedAsyncClient.class }) +public final class NotDiscriminatedClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("type-model-inheritance-notdiscriminated.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the NotDiscriminatedClientBuilder. + */ + @Generated + public NotDiscriminatedClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDiscriminatedClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDiscriminatedClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDiscriminatedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDiscriminatedClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDiscriminatedClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDiscriminatedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDiscriminatedClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NotDiscriminatedClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the NotDiscriminatedClientBuilder. + */ + @Generated + public NotDiscriminatedClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of NotDiscriminatedClientImpl with the provided parameters. + * + * @return an instance of NotDiscriminatedClientImpl. + */ + @Generated + private NotDiscriminatedClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + NotDiscriminatedClientImpl client = new NotDiscriminatedClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of NotDiscriminatedAsyncClient class. + * + * @return an instance of NotDiscriminatedAsyncClient. + */ + @Generated + public NotDiscriminatedAsyncClient buildAsyncClient() { + return new NotDiscriminatedAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of NotDiscriminatedClient class. + * + * @return an instance of NotDiscriminatedClient. + */ + @Generated + public NotDiscriminatedClient buildClient() { + return new NotDiscriminatedClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(NotDiscriminatedClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java new file mode 100644 index 00000000000..59f0edb04be --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.notdiscriminated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the NotDiscriminatedClient type. + */ +public final class NotDiscriminatedClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NotDiscriminatedClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of NotDiscriminatedClient client. + * + * @param endpoint Service host. + */ + public NotDiscriminatedClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NotDiscriminatedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public NotDiscriminatedClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NotDiscriminatedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public NotDiscriminatedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(NotDiscriminatedClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for NotDiscriminatedClient to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NotDiscriminatedClient") + public interface NotDiscriminatedClientService { + @Post("/type/model/inheritance/not-discriminated/valid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> postValid(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Post("/type/model/inheritance/not-discriminated/valid") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postValidSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/not-discriminated/valid") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getValid(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/not-discriminated/valid") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getValidSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/not-discriminated/valid") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putValid(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/not-discriminated/valid") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putValidSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + } + + /** + * The postValid operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postValidWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.postValid(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The postValid operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postValidWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.postValidSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The getValid operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the third level model in the normal multiple levels inheritance along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getValidWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getValid(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getValid operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the third level model in the normal multiple levels inheritance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getValidWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getValidSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The putValid operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the third level model in the normal multiple levels inheritance along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putValidWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.putValid(this.getEndpoint(), contentType, accept, input, requestOptions, context)); + } + + /** + * The putValid operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     age: int (Required)
+     *     smart: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the third level model in the normal multiple levels inheritance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putValidWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putValidSync(this.getEndpoint(), contentType, accept, input, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/package-info.java new file mode 100644 index 00000000000..e3fe76089dd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for NotDiscriminated. + * Illustrates not-discriminated inheritance model. + * + */ +package type.model.inheritance.notdiscriminated.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Cat.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Cat.java new file mode 100644 index 00000000000..a207a1c1b1d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Cat.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.notdiscriminated.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The second level model in the normal multiple levels inheritance. + */ +@Immutable +public class Cat extends Pet { + /* + * The age property. + */ + @Generated + private final int age; + + /** + * Creates an instance of Cat class. + * + * @param name the name value to set. + * @param age the age value to set. + */ + @Generated + public Cat(String name, int age) { + super(name); + this.age = age; + } + + /** + * Get the age property: The age property. + * + * @return the age value. + */ + @Generated + public int getAge() { + return this.age; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeIntField("age", this.age); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Cat from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Cat if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Cat. + */ + @Generated + public static Cat fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + int age = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("age".equals(fieldName)) { + age = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new Cat(name, age); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Pet.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Pet.java new file mode 100644 index 00000000000..13bf3728a87 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Pet.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.notdiscriminated.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is base model for not-discriminated normal multiple levels inheritance. + */ +@Immutable +public class Pet implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Pet class. + * + * @param name the name value to set. + */ + @Generated + public Pet(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Pet from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Pet if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Pet. + */ + @Generated + public static Pet fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Pet(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Siamese.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Siamese.java new file mode 100644 index 00000000000..c410cf6c54d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/Siamese.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.notdiscriminated.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The third level model in the normal multiple levels inheritance. + */ +@Immutable +public final class Siamese extends Cat { + /* + * The smart property. + */ + @Generated + private final boolean smart; + + /** + * Creates an instance of Siamese class. + * + * @param name the name value to set. + * @param age the age value to set. + * @param smart the smart value to set. + */ + @Generated + public Siamese(String name, int age, boolean smart) { + super(name, age); + this.smart = smart; + } + + /** + * Get the smart property: The smart property. + * + * @return the smart value. + */ + @Generated + public boolean isSmart() { + return this.smart; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeIntField("age", getAge()); + jsonWriter.writeBooleanField("smart", this.smart); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Siamese from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Siamese if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Siamese. + */ + @Generated + public static Siamese fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + int age = 0; + boolean smart = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("age".equals(fieldName)) { + age = reader.getInt(); + } else if ("smart".equals(fieldName)) { + smart = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new Siamese(name, age, smart); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/package-info.java new file mode 100644 index 00000000000..9d3cf218184 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for NotDiscriminated. + * Illustrates not-discriminated inheritance model. + * + */ +package type.model.inheritance.notdiscriminated.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/package-info.java new file mode 100644 index 00000000000..9a5e3f78c4a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/notdiscriminated/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for NotDiscriminated. + * Illustrates not-discriminated inheritance model. + * + */ +package type.model.inheritance.notdiscriminated; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveAsyncClient.java new file mode 100644 index 00000000000..68a4f37d05a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.recursive; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.model.inheritance.recursive.implementation.RecursiveClientImpl; +import type.model.inheritance.recursive.models.Extension; + +/** + * Initializes a new instance of the asynchronous RecursiveClient type. + */ +@ServiceClient(builder = RecursiveClientBuilder.class, isAsync = true) +public final class RecursiveAsyncClient { + @Generated + private final RecursiveClientImpl serviceClient; + + /** + * Initializes an instance of RecursiveAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RecursiveAsyncClient(RecursiveClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     extension (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     level: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(input, requestOptions); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     extension (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     level: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return extension along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Extension input) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extension on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Extension.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClient.java new file mode 100644 index 00000000000..23991ba91bd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.recursive; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.model.inheritance.recursive.implementation.RecursiveClientImpl; +import type.model.inheritance.recursive.models.Extension; + +/** + * Initializes a new instance of the synchronous RecursiveClient type. + */ +@ServiceClient(builder = RecursiveClientBuilder.class) +public final class RecursiveClient { + @Generated + private final RecursiveClientImpl serviceClient; + + /** + * Initializes an instance of RecursiveClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RecursiveClient(RecursiveClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     extension (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     level: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(input, requestOptions); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     extension (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     level: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return extension along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Extension input) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return extension. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Extension get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(Extension.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClientBuilder.java new file mode 100644 index 00000000000..4a09e62c0c3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/RecursiveClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.recursive; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.model.inheritance.recursive.implementation.RecursiveClientImpl; + +/** + * A builder for creating a new instance of the RecursiveClient type. + */ +@ServiceClientBuilder(serviceClients = { RecursiveClient.class, RecursiveAsyncClient.class }) +public final class RecursiveClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("type-model-inheritance-recursive.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the RecursiveClientBuilder. + */ + @Generated + public RecursiveClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RecursiveClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RecursiveClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RecursiveClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RecursiveClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RecursiveClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RecursiveClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RecursiveClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RecursiveClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the RecursiveClientBuilder. + */ + @Generated + public RecursiveClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of RecursiveClientImpl with the provided parameters. + * + * @return an instance of RecursiveClientImpl. + */ + @Generated + private RecursiveClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + RecursiveClientImpl client + = new RecursiveClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of RecursiveAsyncClient class. + * + * @return an instance of RecursiveAsyncClient. + */ + @Generated + public RecursiveAsyncClient buildAsyncClient() { + return new RecursiveAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of RecursiveClient class. + * + * @return an instance of RecursiveClient. + */ + @Generated + public RecursiveClient buildClient() { + return new RecursiveClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(RecursiveClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java new file mode 100644 index 00000000000..67b24ed388c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.recursive.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the RecursiveClient type. + */ +public final class RecursiveClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RecursiveClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of RecursiveClient client. + * + * @param endpoint Service host. + */ + public RecursiveClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of RecursiveClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public RecursiveClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of RecursiveClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public RecursiveClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(RecursiveClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for RecursiveClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RecursiveClient") + public interface RecursiveClientService { + @Put("/type/model/inheritance/recursive") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/recursive") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/recursive") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/recursive") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     extension (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     level: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     extension (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     level: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     extension (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     level: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     extension (Optional): [
+     *         (recursive schema, see above)
+     *     ]
+     *     level: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/package-info.java new file mode 100644 index 00000000000..40aaceb99df --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Recursive. + * Illustrates inheritance recursion. + * + */ +package type.model.inheritance.recursive.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Element.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Element.java new file mode 100644 index 00000000000..fc46eb75c75 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Element.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.recursive.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * element. + */ +@Fluent +public class Element implements JsonSerializable { + /* + * The extension property. + */ + @Generated + private List extension; + + /** + * Creates an instance of Element class. + */ + @Generated + public Element() { + } + + /** + * Get the extension property: The extension property. + * + * @return the extension value. + */ + @Generated + public List getExtension() { + return this.extension; + } + + /** + * Set the extension property: The extension property. + * + * @param extension the extension value to set. + * @return the Element object itself. + */ + @Generated + public Element setExtension(List extension) { + this.extension = extension; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("extension", this.extension, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Element from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Element if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Element. + */ + @Generated + public static Element fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Element deserializedElement = new Element(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("extension".equals(fieldName)) { + List extension = reader.readArray(reader1 -> Extension.fromJson(reader1)); + deserializedElement.extension = extension; + } else { + reader.skipChildren(); + } + } + + return deserializedElement; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Extension.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Extension.java new file mode 100644 index 00000000000..29b1361e769 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/Extension.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.recursive.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * extension. + */ +@Fluent +public final class Extension extends Element { + /* + * The level property. + */ + @Generated + private final int level; + + /** + * Creates an instance of Extension class. + * + * @param level the level value to set. + */ + @Generated + public Extension(int level) { + this.level = level; + } + + /** + * Get the level property: The level property. + * + * @return the level value. + */ + @Generated + public int getLevel() { + return this.level; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public Extension setExtension(List extension) { + super.setExtension(extension); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("extension", getExtension(), (writer, element) -> writer.writeJson(element)); + jsonWriter.writeIntField("level", this.level); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Extension from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Extension if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Extension. + */ + @Generated + public static Extension fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List extension = null; + int level = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("extension".equals(fieldName)) { + extension = reader.readArray(reader1 -> Extension.fromJson(reader1)); + } else if ("level".equals(fieldName)) { + level = reader.getInt(); + } else { + reader.skipChildren(); + } + } + Extension deserializedExtension = new Extension(level); + deserializedExtension.setExtension(extension); + + return deserializedExtension; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/package-info.java new file mode 100644 index 00000000000..7c2ee44abc3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Recursive. + * Illustrates inheritance recursion. + * + */ +package type.model.inheritance.recursive.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/package-info.java new file mode 100644 index 00000000000..6b91169f366 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/recursive/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Recursive. + * Illustrates inheritance recursion. + * + */ +package type.model.inheritance.recursive; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorAsyncClient.java new file mode 100644 index 00000000000..770d0e65de8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorAsyncClient.java @@ -0,0 +1,369 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.singlediscriminator; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.model.inheritance.singlediscriminator.implementation.SingleDiscriminatorClientImpl; +import type.model.inheritance.singlediscriminator.models.Bird; +import type.model.inheritance.singlediscriminator.models.Dinosaur; + +/** + * Initializes a new instance of the asynchronous SingleDiscriminatorClient type. + */ +@ServiceClient(builder = SingleDiscriminatorClientBuilder.class, isAsync = true) +public final class SingleDiscriminatorAsyncClient { + @Generated + private final SingleDiscriminatorClientImpl serviceClient; + + /** + * Initializes an instance of SingleDiscriminatorAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SingleDiscriminatorAsyncClient(SingleDiscriminatorClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getModelWithResponseAsync(requestOptions); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putModelWithResponseAsync(input, requestOptions); + } + + /** + * The getRecursiveModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRecursiveModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getRecursiveModelWithResponseAsync(requestOptions); + } + + /** + * The putRecursiveModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putRecursiveModelWithResponseAsync(input, requestOptions); + } + + /** + * The getMissingDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getMissingDiscriminatorWithResponseAsync(requestOptions); + } + + /** + * The getWrongDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWrongDiscriminatorWithResponseAsync(requestOptions); + } + + /** + * The getLegacyModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     size: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return define a base class in the legacy way along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getLegacyModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getLegacyModelWithResponseAsync(requestOptions); + } + + /** + * The getModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic single level inheritance with a discriminator on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getModel() { + // Generated convenience method for getModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Bird.class)); + } + + /** + * The putModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putModel(Bird input) { + // Generated convenience method for putModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getRecursiveModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic single level inheritance with a discriminator on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getRecursiveModel() { + // Generated convenience method for getRecursiveModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRecursiveModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Bird.class)); + } + + /** + * The putRecursiveModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putRecursiveModel(Bird input) { + // Generated convenience method for putRecursiveModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putRecursiveModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The getMissingDiscriminator operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic single level inheritance with a discriminator on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getMissingDiscriminator() { + // Generated convenience method for getMissingDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getMissingDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Bird.class)); + } + + /** + * The getWrongDiscriminator operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic single level inheritance with a discriminator on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getWrongDiscriminator() { + // Generated convenience method for getWrongDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWrongDiscriminatorWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Bird.class)); + } + + /** + * The getLegacyModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define a base class in the legacy way on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getLegacyModel() { + // Generated convenience method for getLegacyModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getLegacyModelWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Dinosaur.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClient.java new file mode 100644 index 00000000000..004c639ff53 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClient.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.singlediscriminator; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.model.inheritance.singlediscriminator.implementation.SingleDiscriminatorClientImpl; +import type.model.inheritance.singlediscriminator.models.Bird; +import type.model.inheritance.singlediscriminator.models.Dinosaur; + +/** + * Initializes a new instance of the synchronous SingleDiscriminatorClient type. + */ +@ServiceClient(builder = SingleDiscriminatorClientBuilder.class) +public final class SingleDiscriminatorClient { + @Generated + private final SingleDiscriminatorClientImpl serviceClient; + + /** + * Initializes an instance of SingleDiscriminatorClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SingleDiscriminatorClient(SingleDiscriminatorClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getModelWithResponse(requestOptions); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putModelWithResponse(input, requestOptions); + } + + /** + * The getRecursiveModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRecursiveModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getRecursiveModelWithResponse(requestOptions); + } + + /** + * The putRecursiveModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putRecursiveModelWithResponse(input, requestOptions); + } + + /** + * The getMissingDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getMissingDiscriminatorWithResponse(requestOptions); + } + + /** + * The getWrongDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWrongDiscriminatorWithResponse(requestOptions); + } + + /** + * The getLegacyModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     size: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return define a base class in the legacy way along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getLegacyModelWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getLegacyModelWithResponse(requestOptions); + } + + /** + * The getModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic single level inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Bird getModel() { + // Generated convenience method for getModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getModelWithResponse(requestOptions).getValue().toObject(Bird.class); + } + + /** + * The putModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putModel(Bird input) { + // Generated convenience method for putModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + putModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The getRecursiveModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic single level inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Bird getRecursiveModel() { + // Generated convenience method for getRecursiveModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRecursiveModelWithResponse(requestOptions).getValue().toObject(Bird.class); + } + + /** + * The putRecursiveModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putRecursiveModel(Bird input) { + // Generated convenience method for putRecursiveModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + putRecursiveModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The getMissingDiscriminator operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic single level inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Bird getMissingDiscriminator() { + // Generated convenience method for getMissingDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getMissingDiscriminatorWithResponse(requestOptions).getValue().toObject(Bird.class); + } + + /** + * The getWrongDiscriminator operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is base model for polymorphic single level inheritance with a discriminator. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Bird getWrongDiscriminator() { + // Generated convenience method for getWrongDiscriminatorWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWrongDiscriminatorWithResponse(requestOptions).getValue().toObject(Bird.class); + } + + /** + * The getLegacyModel operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return define a base class in the legacy way. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Dinosaur getLegacyModel() { + // Generated convenience method for getLegacyModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getLegacyModelWithResponse(requestOptions).getValue().toObject(Dinosaur.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClientBuilder.java new file mode 100644 index 00000000000..a9cd6bbba06 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClientBuilder.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.singlediscriminator; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.model.inheritance.singlediscriminator.implementation.SingleDiscriminatorClientImpl; + +/** + * A builder for creating a new instance of the SingleDiscriminatorClient type. + */ +@ServiceClientBuilder(serviceClients = { SingleDiscriminatorClient.class, SingleDiscriminatorAsyncClient.class }) +public final class SingleDiscriminatorClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("type-model-inheritance-singlediscriminator.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the SingleDiscriminatorClientBuilder. + */ + @Generated + public SingleDiscriminatorClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleDiscriminatorClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleDiscriminatorClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleDiscriminatorClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleDiscriminatorClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleDiscriminatorClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleDiscriminatorClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleDiscriminatorClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public SingleDiscriminatorClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the SingleDiscriminatorClientBuilder. + */ + @Generated + public SingleDiscriminatorClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of SingleDiscriminatorClientImpl with the provided parameters. + * + * @return an instance of SingleDiscriminatorClientImpl. + */ + @Generated + private SingleDiscriminatorClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + SingleDiscriminatorClientImpl client = new SingleDiscriminatorClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of SingleDiscriminatorAsyncClient class. + * + * @return an instance of SingleDiscriminatorAsyncClient. + */ + @Generated + public SingleDiscriminatorAsyncClient buildAsyncClient() { + return new SingleDiscriminatorAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of SingleDiscriminatorClient class. + * + * @return an instance of SingleDiscriminatorClient. + */ + @Generated + public SingleDiscriminatorClient buildClient() { + return new SingleDiscriminatorClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(SingleDiscriminatorClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java new file mode 100644 index 00000000000..59e696cf8e9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java @@ -0,0 +1,643 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.singlediscriminator.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the SingleDiscriminatorClient type. + */ +public final class SingleDiscriminatorClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SingleDiscriminatorClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of SingleDiscriminatorClient client. + * + * @param endpoint Service host. + */ + public SingleDiscriminatorClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SingleDiscriminatorClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public SingleDiscriminatorClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of SingleDiscriminatorClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public SingleDiscriminatorClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(SingleDiscriminatorClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for SingleDiscriminatorClient to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "SingleDiscriminatorClient") + public interface SingleDiscriminatorClientService { + @Get("/type/model/inheritance/single-discriminator/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/single-discriminator/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getModelSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/single-discriminator/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/single-discriminator/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/single-discriminator/recursivemodel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getRecursiveModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/single-discriminator/recursivemodel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getRecursiveModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/single-discriminator/recursivemodel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putRecursiveModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/inheritance/single-discriminator/recursivemodel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putRecursiveModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/single-discriminator/missingdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getMissingDiscriminator(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/single-discriminator/missingdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getMissingDiscriminatorSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/single-discriminator/wrongdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getWrongDiscriminator(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/single-discriminator/wrongdiscriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getWrongDiscriminatorSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/single-discriminator/legacy-model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getLegacyModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/model/inheritance/single-discriminator/legacy-model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getLegacyModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getModelWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getModel(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getModelWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.putModel(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The getRecursiveModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRecursiveModelWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getRecursiveModel(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getRecursiveModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRecursiveModelWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getRecursiveModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The putRecursiveModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putRecursiveModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putRecursiveModel(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The putRecursiveModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putRecursiveModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putRecursiveModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The getMissingDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getMissingDiscriminatorWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getMissingDiscriminator(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getMissingDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMissingDiscriminatorWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getMissingDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getWrongDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWrongDiscriminatorWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getWrongDiscriminator(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getWrongDiscriminator operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     wingspan: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return this is base model for polymorphic single level inheritance with a discriminator along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWrongDiscriminatorWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getWrongDiscriminatorSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The getLegacyModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     size: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return define a base class in the legacy way along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getLegacyModelWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getLegacyModel(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getLegacyModel operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     size: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return define a base class in the legacy way along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getLegacyModelWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getLegacyModelSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/package-info.java new file mode 100644 index 00000000000..0ab1d6d0508 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for SingleDiscriminator. + * Illustrates inheritance with single discriminator. + * + */ +package type.model.inheritance.singlediscriminator.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Bird.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Bird.java new file mode 100644 index 00000000000..d4dc3d0f90b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Bird.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.singlediscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is base model for polymorphic single level inheritance with a discriminator. + */ +@Immutable +public class Bird implements JsonSerializable { + /* + * The kind property. + */ + @Generated + private String kind = "Bird"; + + /* + * The wingspan property. + */ + @Generated + private final int wingspan; + + /** + * Creates an instance of Bird class. + * + * @param wingspan the wingspan value to set. + */ + @Generated + public Bird(int wingspan) { + this.wingspan = wingspan; + } + + /** + * Get the kind property: The kind property. + * + * @return the kind value. + */ + @Generated + public String getKind() { + return this.kind; + } + + /** + * Get the wingspan property: The wingspan property. + * + * @return the wingspan value. + */ + @Generated + public int getWingspan() { + return this.wingspan; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("wingspan", this.wingspan); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Bird from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Bird if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Bird. + */ + @Generated + public static Bird fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("seagull".equals(discriminatorValue)) { + return SeaGull.fromJson(readerToUse.reset()); + } else if ("sparrow".equals(discriminatorValue)) { + return Sparrow.fromJson(readerToUse.reset()); + } else if ("goose".equals(discriminatorValue)) { + return Goose.fromJson(readerToUse.reset()); + } else if ("eagle".equals(discriminatorValue)) { + return Eagle.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Bird fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int wingspan = 0; + String kind = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("wingspan".equals(fieldName)) { + wingspan = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + Bird deserializedBird = new Bird(wingspan); + deserializedBird.kind = kind; + + return deserializedBird; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Dinosaur.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Dinosaur.java new file mode 100644 index 00000000000..e1d01a8c1da --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Dinosaur.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.singlediscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Define a base class in the legacy way. Discriminator property is not explicitly defined in the model. + */ +@Immutable +public class Dinosaur implements JsonSerializable { + /* + * Discriminator property for Dinosaur. + */ + @Generated + private String kind = "Dinosaur"; + + /* + * The size property. + */ + @Generated + private final int size; + + /** + * Creates an instance of Dinosaur class. + * + * @param size the size value to set. + */ + @Generated + protected Dinosaur(int size) { + this.size = size; + } + + /** + * Get the kind property: Discriminator property for Dinosaur. + * + * @return the kind value. + */ + @Generated + public String getKind() { + return this.kind; + } + + /** + * Get the size property: The size property. + * + * @return the size value. + */ + @Generated + public int getSize() { + return this.size; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("size", this.size); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dinosaur from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dinosaur if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Dinosaur. + */ + @Generated + public static Dinosaur fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("t-rex".equals(discriminatorValue)) { + return TRex.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static Dinosaur fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int size = 0; + String kind = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("size".equals(fieldName)) { + size = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + Dinosaur deserializedDinosaur = new Dinosaur(size); + deserializedDinosaur.kind = kind; + + return deserializedDinosaur; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Eagle.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Eagle.java new file mode 100644 index 00000000000..110c42ee2b1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Eagle.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.singlediscriminator.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The second level model in polymorphic single levels inheritance which contains references to other polymorphic + * instances. + */ +@Fluent +public final class Eagle extends Bird { + /* + * The kind property. + */ + @Generated + private String kind = "eagle"; + + /* + * The friends property. + */ + @Generated + private List friends; + + /* + * The hate property. + */ + @Generated + private Map hate; + + /* + * The partner property. + */ + @Generated + private Bird partner; + + /** + * Creates an instance of Eagle class. + * + * @param wingspan the wingspan value to set. + */ + @Generated + public Eagle(int wingspan) { + super(wingspan); + } + + /** + * Get the kind property: The kind property. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * Get the friends property: The friends property. + * + * @return the friends value. + */ + @Generated + public List getFriends() { + return this.friends; + } + + /** + * Set the friends property: The friends property. + * + * @param friends the friends value to set. + * @return the Eagle object itself. + */ + @Generated + public Eagle setFriends(List friends) { + this.friends = friends; + return this; + } + + /** + * Get the hate property: The hate property. + * + * @return the hate value. + */ + @Generated + public Map getHate() { + return this.hate; + } + + /** + * Set the hate property: The hate property. + * + * @param hate the hate value to set. + * @return the Eagle object itself. + */ + @Generated + public Eagle setHate(Map hate) { + this.hate = hate; + return this; + } + + /** + * Get the partner property: The partner property. + * + * @return the partner value. + */ + @Generated + public Bird getPartner() { + return this.partner; + } + + /** + * Set the partner property: The partner property. + * + * @param partner the partner value to set. + * @return the Eagle object itself. + */ + @Generated + public Eagle setPartner(Bird partner) { + this.partner = partner; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("wingspan", getWingspan()); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeArrayField("friends", this.friends, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeMapField("hate", this.hate, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("partner", this.partner); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Eagle from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Eagle if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Eagle. + */ + @Generated + public static Eagle fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int wingspan = 0; + String kind = "eagle"; + List friends = null; + Map hate = null; + Bird partner = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("wingspan".equals(fieldName)) { + wingspan = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else if ("friends".equals(fieldName)) { + friends = reader.readArray(reader1 -> Bird.fromJson(reader1)); + } else if ("hate".equals(fieldName)) { + hate = reader.readMap(reader1 -> Bird.fromJson(reader1)); + } else if ("partner".equals(fieldName)) { + partner = Bird.fromJson(reader); + } else { + reader.skipChildren(); + } + } + Eagle deserializedEagle = new Eagle(wingspan); + deserializedEagle.kind = kind; + deserializedEagle.friends = friends; + deserializedEagle.hate = hate; + deserializedEagle.partner = partner; + + return deserializedEagle; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Goose.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Goose.java new file mode 100644 index 00000000000..a4e875b89d7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Goose.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.singlediscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The second level model in polymorphic single level inheritance. + */ +@Immutable +public final class Goose extends Bird { + /* + * The kind property. + */ + @Generated + private String kind = "goose"; + + /** + * Creates an instance of Goose class. + * + * @param wingspan the wingspan value to set. + */ + @Generated + public Goose(int wingspan) { + super(wingspan); + } + + /** + * Get the kind property: The kind property. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("wingspan", getWingspan()); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Goose from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Goose if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Goose. + */ + @Generated + public static Goose fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int wingspan = 0; + String kind = "goose"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("wingspan".equals(fieldName)) { + wingspan = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + Goose deserializedGoose = new Goose(wingspan); + deserializedGoose.kind = kind; + + return deserializedGoose; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/SeaGull.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/SeaGull.java new file mode 100644 index 00000000000..f0877a6e2ef --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/SeaGull.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.singlediscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The second level model in polymorphic single level inheritance. + */ +@Immutable +public final class SeaGull extends Bird { + /* + * The kind property. + */ + @Generated + private String kind = "seagull"; + + /** + * Creates an instance of SeaGull class. + * + * @param wingspan the wingspan value to set. + */ + @Generated + public SeaGull(int wingspan) { + super(wingspan); + } + + /** + * Get the kind property: The kind property. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("wingspan", getWingspan()); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SeaGull from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SeaGull if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SeaGull. + */ + @Generated + public static SeaGull fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int wingspan = 0; + String kind = "seagull"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("wingspan".equals(fieldName)) { + wingspan = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + SeaGull deserializedSeaGull = new SeaGull(wingspan); + deserializedSeaGull.kind = kind; + + return deserializedSeaGull; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Sparrow.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Sparrow.java new file mode 100644 index 00000000000..b72d72c773c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/Sparrow.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.singlediscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The second level model in polymorphic single level inheritance. + */ +@Immutable +public final class Sparrow extends Bird { + /* + * The kind property. + */ + @Generated + private String kind = "sparrow"; + + /** + * Creates an instance of Sparrow class. + * + * @param wingspan the wingspan value to set. + */ + @Generated + public Sparrow(int wingspan) { + super(wingspan); + } + + /** + * Get the kind property: The kind property. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("wingspan", getWingspan()); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Sparrow from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Sparrow if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Sparrow. + */ + @Generated + public static Sparrow fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int wingspan = 0; + String kind = "sparrow"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("wingspan".equals(fieldName)) { + wingspan = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + Sparrow deserializedSparrow = new Sparrow(wingspan); + deserializedSparrow.kind = kind; + + return deserializedSparrow; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/TRex.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/TRex.java new file mode 100644 index 00000000000..075b6d1e3fd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/TRex.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.singlediscriminator.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The second level legacy model in polymorphic single level inheritance. + */ +@Immutable +public final class TRex extends Dinosaur { + /* + * Discriminator property for Dinosaur. + */ + @Generated + private String kind = "t-rex"; + + /** + * Creates an instance of TRex class. + * + * @param size the size value to set. + */ + @Generated + private TRex(int size) { + super(size); + } + + /** + * Get the kind property: Discriminator property for Dinosaur. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("size", getSize()); + jsonWriter.writeStringField("kind", this.kind); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TRex from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TRex if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TRex. + */ + @Generated + public static TRex fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int size = 0; + String kind = "t-rex"; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("size".equals(fieldName)) { + size = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + reader.skipChildren(); + } + } + TRex deserializedTRex = new TRex(size); + deserializedTRex.kind = kind; + + return deserializedTRex; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/package-info.java new file mode 100644 index 00000000000..e874635d950 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for SingleDiscriminator. + * Illustrates inheritance with single discriminator. + * + */ +package type.model.inheritance.singlediscriminator.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/package-info.java new file mode 100644 index 00000000000..927e9328502 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/inheritance/singlediscriminator/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for SingleDiscriminator. + * Illustrates inheritance with single discriminator. + * + */ +package type.model.inheritance.singlediscriminator; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageAsyncClient.java new file mode 100644 index 00000000000..dd91dadd2c9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageAsyncClient.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.usage; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.model.usage.implementation.UsageClientImpl; +import type.model.usage.models.InputOutputRecord; +import type.model.usage.models.InputRecord; +import type.model.usage.models.OutputRecord; + +/** + * Initializes a new instance of the asynchronous UsageClient type. + */ +@ServiceClient(builder = UsageClientBuilder.class, isAsync = true) +public final class UsageAsyncClient { + @Generated + private final UsageClientImpl serviceClient; + + /** + * Initializes an instance of UsageAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UsageAsyncClient(UsageClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The input operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> inputWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.inputWithResponseAsync(input, requestOptions); + } + + /** + * The output operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return record used in operation return type along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> outputWithResponse(RequestOptions requestOptions) { + return this.serviceClient.outputWithResponseAsync(requestOptions); + } + + /** + * The inputAndOutput operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return record used both as operation parameter and return type along with {@link Response} on successful + * completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> inputAndOutputWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.inputAndOutputWithResponseAsync(body, requestOptions); + } + + /** + * The input operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono input(InputRecord input) { + // Generated convenience method for inputWithResponse + RequestOptions requestOptions = new RequestOptions(); + return inputWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The output operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return record used in operation return type on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono output() { + // Generated convenience method for outputWithResponse + RequestOptions requestOptions = new RequestOptions(); + return outputWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OutputRecord.class)); + } + + /** + * The inputAndOutput operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return record used both as operation parameter and return type on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono inputAndOutput(InputOutputRecord body) { + // Generated convenience method for inputAndOutputWithResponse + RequestOptions requestOptions = new RequestOptions(); + return inputAndOutputWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(InputOutputRecord.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClient.java new file mode 100644 index 00000000000..16abc9a3be4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClient.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.usage; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.model.usage.implementation.UsageClientImpl; +import type.model.usage.models.InputOutputRecord; +import type.model.usage.models.InputRecord; +import type.model.usage.models.OutputRecord; + +/** + * Initializes a new instance of the synchronous UsageClient type. + */ +@ServiceClient(builder = UsageClientBuilder.class) +public final class UsageClient { + @Generated + private final UsageClientImpl serviceClient; + + /** + * Initializes an instance of UsageClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UsageClient(UsageClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The input operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response inputWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.inputWithResponse(input, requestOptions); + } + + /** + * The output operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return record used in operation return type along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response outputWithResponse(RequestOptions requestOptions) { + return this.serviceClient.outputWithResponse(requestOptions); + } + + /** + * The inputAndOutput operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return record used both as operation parameter and return type along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response inputAndOutputWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.inputAndOutputWithResponse(body, requestOptions); + } + + /** + * The input operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void input(InputRecord input) { + // Generated convenience method for inputWithResponse + RequestOptions requestOptions = new RequestOptions(); + inputWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The output operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return record used in operation return type. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OutputRecord output() { + // Generated convenience method for outputWithResponse + RequestOptions requestOptions = new RequestOptions(); + return outputWithResponse(requestOptions).getValue().toObject(OutputRecord.class); + } + + /** + * The inputAndOutput operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return record used both as operation parameter and return type. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public InputOutputRecord inputAndOutput(InputOutputRecord body) { + // Generated convenience method for inputAndOutputWithResponse + RequestOptions requestOptions = new RequestOptions(); + return inputAndOutputWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(InputOutputRecord.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClientBuilder.java new file mode 100644 index 00000000000..2ebffa68ae8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/UsageClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.usage; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.model.usage.implementation.UsageClientImpl; + +/** + * A builder for creating a new instance of the UsageClient type. + */ +@ServiceClientBuilder(serviceClients = { UsageClient.class, UsageAsyncClient.class }) +public final class UsageClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("type-model-usage.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the UsageClientBuilder. + */ + @Generated + public UsageClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UsageClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the UsageClientBuilder. + */ + @Generated + public UsageClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of UsageClientImpl with the provided parameters. + * + * @return an instance of UsageClientImpl. + */ + @Generated + private UsageClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + UsageClientImpl client + = new UsageClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of UsageAsyncClient class. + * + * @return an instance of UsageAsyncClient. + */ + @Generated + public UsageAsyncClient buildAsyncClient() { + return new UsageAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of UsageClient class. + * + * @return an instance of UsageClient. + */ + @Generated + public UsageClient buildClient() { + return new UsageClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(UsageClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/UsageClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/UsageClientImpl.java new file mode 100644 index 00000000000..c2439718c1e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/UsageClientImpl.java @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.usage.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the UsageClient type. + */ +public final class UsageClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UsageClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of UsageClient client. + * + * @param endpoint Service host. + */ + public UsageClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of UsageClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public UsageClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of UsageClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public UsageClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(UsageClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for UsageClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UsageClient") + public interface UsageClientService { + @Post("/type/model/usage/input") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> input(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Post("/type/model/usage/input") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response inputSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Get("/type/model/usage/output") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> output(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/model/usage/output") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response outputSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/type/model/usage/input-output") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> inputAndOutput(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/type/model/usage/input-output") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response inputAndOutputSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The input operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> inputWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.input(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The input operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response inputWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.inputSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The output operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return record used in operation return type along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> outputWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.output(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The output operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return record used in operation return type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response outputWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.outputSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The inputAndOutput operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return record used both as operation parameter and return type along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> inputAndOutputWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.inputAndOutput(this.getEndpoint(), contentType, accept, body, requestOptions, context)); + } + + /** + * The inputAndOutput operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return record used both as operation parameter and return type along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response inputAndOutputWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.inputAndOutputSync(this.getEndpoint(), contentType, accept, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/package-info.java new file mode 100644 index 00000000000..1ea39ce710b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Usage. + * Illustrates usage of Record in different places(Operation parameters, return type or both). + * + */ +package type.model.usage.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputOutputRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputOutputRecord.java new file mode 100644 index 00000000000..d7e2a862153 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputOutputRecord.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.usage.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Record used both as operation parameter and return type. + */ +@Immutable +public final class InputOutputRecord implements JsonSerializable { + /* + * The requiredProp property. + */ + @Generated + private final String requiredProp; + + /** + * Creates an instance of InputOutputRecord class. + * + * @param requiredProp the requiredProp value to set. + */ + @Generated + public InputOutputRecord(String requiredProp) { + this.requiredProp = requiredProp; + } + + /** + * Get the requiredProp property: The requiredProp property. + * + * @return the requiredProp value. + */ + @Generated + public String getRequiredProp() { + return this.requiredProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requiredProp", this.requiredProp); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InputOutputRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InputOutputRecord if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InputOutputRecord. + */ + @Generated + public static InputOutputRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String requiredProp = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requiredProp".equals(fieldName)) { + requiredProp = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new InputOutputRecord(requiredProp); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputRecord.java new file mode 100644 index 00000000000..31fe5844fd0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/InputRecord.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.usage.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Record used in operation parameters. + */ +@Immutable +public final class InputRecord implements JsonSerializable { + /* + * The requiredProp property. + */ + @Generated + private final String requiredProp; + + /** + * Creates an instance of InputRecord class. + * + * @param requiredProp the requiredProp value to set. + */ + @Generated + public InputRecord(String requiredProp) { + this.requiredProp = requiredProp; + } + + /** + * Get the requiredProp property: The requiredProp property. + * + * @return the requiredProp value. + */ + @Generated + public String getRequiredProp() { + return this.requiredProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requiredProp", this.requiredProp); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InputRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InputRecord if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InputRecord. + */ + @Generated + public static InputRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String requiredProp = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requiredProp".equals(fieldName)) { + requiredProp = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new InputRecord(requiredProp); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/OutputRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/OutputRecord.java new file mode 100644 index 00000000000..97bfd4dc4ca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/OutputRecord.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.usage.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Record used in operation return type. + */ +@Immutable +public final class OutputRecord implements JsonSerializable { + /* + * The requiredProp property. + */ + @Generated + private final String requiredProp; + + /** + * Creates an instance of OutputRecord class. + * + * @param requiredProp the requiredProp value to set. + */ + @Generated + private OutputRecord(String requiredProp) { + this.requiredProp = requiredProp; + } + + /** + * Get the requiredProp property: The requiredProp property. + * + * @return the requiredProp value. + */ + @Generated + public String getRequiredProp() { + return this.requiredProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requiredProp", this.requiredProp); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OutputRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OutputRecord if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OutputRecord. + */ + @Generated + public static OutputRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String requiredProp = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requiredProp".equals(fieldName)) { + requiredProp = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new OutputRecord(requiredProp); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/package-info.java new file mode 100644 index 00000000000..109ddb5d1ff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Usage. + * Illustrates usage of Record in different places(Operation parameters, return type or both). + * + */ +package type.model.usage.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/package-info.java new file mode 100644 index 00000000000..2f3a163789e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/usage/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Usage. + * Illustrates usage of Record in different places(Operation parameters, return type or both). + * + */ +package type.model.usage; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityAsyncClient.java new file mode 100644 index 00000000000..be2e7a77e3f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityAsyncClient.java @@ -0,0 +1,451 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.visibility; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.model.visibility.implementation.VisibilityClientImpl; +import type.model.visibility.models.ReadOnlyModel; +import type.model.visibility.models.VisibilityModel; + +/** + * Initializes a new instance of the asynchronous VisibilityClient type. + */ +@ServiceClient(builder = VisibilityClientBuilder.class, isAsync = true) +public final class VisibilityAsyncClient { + @Generated + private final VisibilityClientImpl serviceClient; + + /** + * Initializes an instance of VisibilityAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + VisibilityAsyncClient(VisibilityClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param queryProp Required int32, illustrating a query property. + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return output model with visibility properties along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getModelWithResponse(int queryProp, BinaryData input, + RequestOptions requestOptions) { + return this.serviceClient.getModelWithResponseAsync(queryProp, input, requestOptions); + } + + /** + * The headModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param queryProp Required int32, illustrating a query property. + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> headModelWithResponse(int queryProp, BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.headModelWithResponseAsync(queryProp, input, requestOptions); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putModelWithResponseAsync(input, requestOptions); + } + + /** + * The patchModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.patchModelWithResponseAsync(input, requestOptions); + } + + /** + * The postModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.postModelWithResponseAsync(input, requestOptions); + } + + /** + * The deleteModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.deleteModelWithResponseAsync(input, requestOptions); + } + + /** + * The putReadOnlyModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalNullableIntList (Optional): [
+     *         int (Optional)
+     *     ]
+     *     optionalStringRecord (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalNullableIntList (Optional): [
+     *         int (Optional)
+     *     ]
+     *     optionalStringRecord (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return roundTrip model with readonly optional properties along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putReadOnlyModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putReadOnlyModelWithResponseAsync(input, requestOptions); + } + + /** + * The getModel operation. + * + * @param queryProp Required int32, illustrating a query property. + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output model with visibility properties on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getModel(int queryProp, VisibilityModel input) { + // Generated convenience method for getModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getModelWithResponse(queryProp, BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(VisibilityModel.class)); + } + + /** + * The headModel operation. + * + * @param queryProp Required int32, illustrating a query property. + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono headModel(int queryProp, VisibilityModel input) { + // Generated convenience method for headModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return headModelWithResponse(queryProp, BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The putModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putModel(VisibilityModel input) { + // Generated convenience method for putModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The patchModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchModel(VisibilityModel input) { + // Generated convenience method for patchModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return patchModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The postModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono postModel(VisibilityModel input) { + // Generated convenience method for postModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return postModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The deleteModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteModel(VisibilityModel input) { + // Generated convenience method for deleteModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The putReadOnlyModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return roundTrip model with readonly optional properties on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putReadOnlyModel(ReadOnlyModel input) { + // Generated convenience method for putReadOnlyModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putReadOnlyModelWithResponse(BinaryData.fromObject(input), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ReadOnlyModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClient.java new file mode 100644 index 00000000000..b2790fb3990 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClient.java @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.visibility; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.model.visibility.implementation.VisibilityClientImpl; +import type.model.visibility.models.ReadOnlyModel; +import type.model.visibility.models.VisibilityModel; + +/** + * Initializes a new instance of the synchronous VisibilityClient type. + */ +@ServiceClient(builder = VisibilityClientBuilder.class) +public final class VisibilityClient { + @Generated + private final VisibilityClientImpl serviceClient; + + /** + * Initializes an instance of VisibilityClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + VisibilityClient(VisibilityClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param queryProp Required int32, illustrating a query property. + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return output model with visibility properties along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getModelWithResponse(int queryProp, BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.getModelWithResponse(queryProp, input, requestOptions); + } + + /** + * The headModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param queryProp Required int32, illustrating a query property. + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headModelWithResponse(int queryProp, BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.headModelWithResponse(queryProp, input, requestOptions); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putModelWithResponse(input, requestOptions); + } + + /** + * The patchModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.patchModelWithResponse(input, requestOptions); + } + + /** + * The postModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.postModelWithResponse(input, requestOptions); + } + + /** + * The deleteModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.deleteModelWithResponse(input, requestOptions); + } + + /** + * The putReadOnlyModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalNullableIntList (Optional): [
+     *         int (Optional)
+     *     ]
+     *     optionalStringRecord (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalNullableIntList (Optional): [
+     *         int (Optional)
+     *     ]
+     *     optionalStringRecord (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return roundTrip model with readonly optional properties along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putReadOnlyModelWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putReadOnlyModelWithResponse(input, requestOptions); + } + + /** + * The getModel operation. + * + * @param queryProp Required int32, illustrating a query property. + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return output model with visibility properties. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public VisibilityModel getModel(int queryProp, VisibilityModel input) { + // Generated convenience method for getModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getModelWithResponse(queryProp, BinaryData.fromObject(input), requestOptions).getValue() + .toObject(VisibilityModel.class); + } + + /** + * The headModel operation. + * + * @param queryProp Required int32, illustrating a query property. + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void headModel(int queryProp, VisibilityModel input) { + // Generated convenience method for headModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + headModelWithResponse(queryProp, BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The putModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putModel(VisibilityModel input) { + // Generated convenience method for putModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + putModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The patchModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchModel(VisibilityModel input) { + // Generated convenience method for patchModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + patchModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The postModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void postModel(VisibilityModel input) { + // Generated convenience method for postModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + postModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The deleteModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteModel(VisibilityModel input) { + // Generated convenience method for deleteModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue(); + } + + /** + * The putReadOnlyModel operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return roundTrip model with readonly optional properties. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ReadOnlyModel putReadOnlyModel(ReadOnlyModel input) { + // Generated convenience method for putReadOnlyModelWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putReadOnlyModelWithResponse(BinaryData.fromObject(input), requestOptions).getValue() + .toObject(ReadOnlyModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClientBuilder.java new file mode 100644 index 00000000000..dd673f3832f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/VisibilityClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.visibility; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.model.visibility.implementation.VisibilityClientImpl; + +/** + * A builder for creating a new instance of the VisibilityClient type. + */ +@ServiceClientBuilder(serviceClients = { VisibilityClient.class, VisibilityAsyncClient.class }) +public final class VisibilityClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("type-model-visibility.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the VisibilityClientBuilder. + */ + @Generated + public VisibilityClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public VisibilityClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the VisibilityClientBuilder. + */ + @Generated + public VisibilityClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of VisibilityClientImpl with the provided parameters. + * + * @return an instance of VisibilityClientImpl. + */ + @Generated + private VisibilityClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + VisibilityClientImpl client + = new VisibilityClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of VisibilityAsyncClient class. + * + * @return an instance of VisibilityAsyncClient. + */ + @Generated + public VisibilityAsyncClient buildAsyncClient() { + return new VisibilityAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of VisibilityClient class. + * + * @return an instance of VisibilityClient. + */ + @Generated + public VisibilityClient buildClient() { + return new VisibilityClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(VisibilityClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java new file mode 100644 index 00000000000..b5443c7d726 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java @@ -0,0 +1,819 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.visibility.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.Head; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the VisibilityClient type. + */ +public final class VisibilityClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final VisibilityClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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; + } + + /** + * Initializes an instance of VisibilityClient client. + * + * @param endpoint Service host. + */ + public VisibilityClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of VisibilityClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public VisibilityClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of VisibilityClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public VisibilityClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service = RestProxy.create(VisibilityClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for VisibilityClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VisibilityClient") + public interface VisibilityClientService { + @Get("/type/model/visibility") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getModel(@HostParam("endpoint") String endpoint, + @QueryParam("queryProp") int queryProp, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Get("/type/model/visibility") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getModelSync(@HostParam("endpoint") String endpoint, + @QueryParam("queryProp") int queryProp, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Head("/type/model/visibility") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> headModel(@HostParam("endpoint") String endpoint, @QueryParam("queryProp") int queryProp, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Head("/type/model/visibility") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response headModelSync(@HostParam("endpoint") String endpoint, @QueryParam("queryProp") int queryProp, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/visibility") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/visibility") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Patch("/type/model/visibility") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Patch("/type/model/visibility") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Post("/type/model/visibility") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> postModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Post("/type/model/visibility") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response postModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Delete("/type/model/visibility") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Delete("/type/model/visibility") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData input, + RequestOptions requestOptions, Context context); + + @Put("/type/model/visibility/readonlyroundtrip") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putReadOnlyModel(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + + @Put("/type/model/visibility/readonlyroundtrip") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putReadOnlyModelSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + } + + /** + * The getModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param queryProp Required int32, illustrating a query property. + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return output model with visibility properties along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getModelWithResponseAsync(int queryProp, BinaryData input, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getModel(this.getEndpoint(), queryProp, contentType, accept, + input, requestOptions, context)); + } + + /** + * The getModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param queryProp Required int32, illustrating a query property. + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return output model with visibility properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getModelWithResponse(int queryProp, BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.getModelSync(this.getEndpoint(), queryProp, contentType, accept, input, requestOptions, + Context.NONE); + } + + /** + * The headModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param queryProp Required int32, illustrating a query property. + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> headModelWithResponseAsync(int queryProp, BinaryData input, + RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.headModel(this.getEndpoint(), queryProp, contentType, input, requestOptions, context)); + } + + /** + * The headModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param queryProp Required int32, illustrating a query property. + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response headModelWithResponse(int queryProp, BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.headModelSync(this.getEndpoint(), queryProp, contentType, input, requestOptions, Context.NONE); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.putModel(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The putModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The patchModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.patchModel(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The patchModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.patchModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The postModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> postModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.postModel(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The postModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.postModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The deleteModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteModelWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.deleteModel(this.getEndpoint(), contentType, input, requestOptions, context)); + } + + /** + * The deleteModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     readProp: String (Required)
+     *     createProp (Required): [
+     *         String (Required)
+     *     ]
+     *     updateProp (Required): [
+     *         int (Required)
+     *     ]
+     *     deleteProp: Boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.deleteModelSync(this.getEndpoint(), contentType, input, requestOptions, Context.NONE); + } + + /** + * The putReadOnlyModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalNullableIntList (Optional): [
+     *         int (Optional)
+     *     ]
+     *     optionalStringRecord (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalNullableIntList (Optional): [
+     *         int (Optional)
+     *     ]
+     *     optionalStringRecord (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return roundTrip model with readonly optional properties along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putReadOnlyModelWithResponseAsync(BinaryData input, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.putReadOnlyModel(this.getEndpoint(), contentType, accept, input, + requestOptions, context)); + } + + /** + * The putReadOnlyModel operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalNullableIntList (Optional): [
+     *         int (Optional)
+     *     ]
+     *     optionalStringRecord (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalNullableIntList (Optional): [
+     *         int (Optional)
+     *     ]
+     *     optionalStringRecord (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return roundTrip model with readonly optional properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putReadOnlyModelWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putReadOnlyModelSync(this.getEndpoint(), contentType, accept, input, requestOptions, + Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/package-info.java new file mode 100644 index 00000000000..c23c028cb0a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Visibility. + * Illustrates models with visibility properties. + * + */ +package type.model.visibility.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/ReadOnlyModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/ReadOnlyModel.java new file mode 100644 index 00000000000..846bb2e7d4e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/ReadOnlyModel.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.visibility.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * RoundTrip model with readonly optional properties. + */ +@Immutable +public final class ReadOnlyModel implements JsonSerializable { + /* + * Optional readonly nullable int list. + */ + @Generated + private List optionalNullableIntList; + + /* + * Optional readonly string dictionary. + */ + @Generated + private Map optionalStringRecord; + + /** + * Creates an instance of ReadOnlyModel class. + */ + @Generated + public ReadOnlyModel() { + } + + /** + * Get the optionalNullableIntList property: Optional readonly nullable int list. + * + * @return the optionalNullableIntList value. + */ + @Generated + public List getOptionalNullableIntList() { + return this.optionalNullableIntList; + } + + /** + * Get the optionalStringRecord property: Optional readonly string dictionary. + * + * @return the optionalStringRecord value. + */ + @Generated + public Map getOptionalStringRecord() { + return this.optionalStringRecord; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ReadOnlyModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ReadOnlyModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ReadOnlyModel. + */ + @Generated + public static ReadOnlyModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ReadOnlyModel deserializedReadOnlyModel = new ReadOnlyModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("optionalNullableIntList".equals(fieldName)) { + List optionalNullableIntList = reader.readArray(reader1 -> reader1.getInt()); + deserializedReadOnlyModel.optionalNullableIntList = optionalNullableIntList; + } else if ("optionalStringRecord".equals(fieldName)) { + Map optionalStringRecord = reader.readMap(reader1 -> reader1.getString()); + deserializedReadOnlyModel.optionalStringRecord = optionalStringRecord; + } else { + reader.skipChildren(); + } + } + + return deserializedReadOnlyModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/VisibilityModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/VisibilityModel.java new file mode 100644 index 00000000000..9fa6354f1f0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/VisibilityModel.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.visibility.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Output model with visibility properties. + */ +@Immutable +public final class VisibilityModel implements JsonSerializable { + /* + * Required string, illustrating a readonly property. + */ + @Generated + private String readProp; + + /* + * Required string[], illustrating a create property. + */ + @Generated + private final List createProp; + + /* + * Required int32[], illustrating a update property. + */ + @Generated + private final List updateProp; + + /* + * Required bool, illustrating a delete property. + */ + @Generated + private final Boolean deleteProp; + + /** + * Creates an instance of VisibilityModel class. + * + * @param createProp the createProp value to set. + * @param updateProp the updateProp value to set. + * @param deleteProp the deleteProp value to set. + */ + @Generated + public VisibilityModel(List createProp, List updateProp, Boolean deleteProp) { + this.createProp = createProp; + this.updateProp = updateProp; + this.deleteProp = deleteProp; + } + + /** + * Get the readProp property: Required string, illustrating a readonly property. + * + * @return the readProp value. + */ + @Generated + public String getReadProp() { + return this.readProp; + } + + /** + * Get the createProp property: Required string[], illustrating a create property. + * + * @return the createProp value. + */ + @Generated + public List getCreateProp() { + return this.createProp; + } + + /** + * Get the updateProp property: Required int32[], illustrating a update property. + * + * @return the updateProp value. + */ + @Generated + public List getUpdateProp() { + return this.updateProp; + } + + /** + * Get the deleteProp property: Required bool, illustrating a delete property. + * + * @return the deleteProp value. + */ + @Generated + public Boolean isDeleteProp() { + return this.deleteProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("createProp", this.createProp, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("updateProp", this.updateProp, (writer, element) -> writer.writeInt(element)); + jsonWriter.writeBooleanField("deleteProp", this.deleteProp); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VisibilityModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VisibilityModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VisibilityModel. + */ + @Generated + public static VisibilityModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String readProp = null; + List createProp = null; + List updateProp = null; + Boolean deleteProp = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("readProp".equals(fieldName)) { + readProp = reader.getString(); + } else if ("createProp".equals(fieldName)) { + createProp = reader.readArray(reader1 -> reader1.getString()); + } else if ("updateProp".equals(fieldName)) { + updateProp = reader.readArray(reader1 -> reader1.getInt()); + } else if ("deleteProp".equals(fieldName)) { + deleteProp = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + VisibilityModel deserializedVisibilityModel = new VisibilityModel(createProp, updateProp, deleteProp); + deserializedVisibilityModel.readProp = readProp; + + return deserializedVisibilityModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/package-info.java new file mode 100644 index 00000000000..36ebbab4db8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Visibility. + * Illustrates models with visibility properties. + * + */ +package type.model.visibility.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/package-info.java new file mode 100644 index 00000000000..91ba00875be --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/model/visibility/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Visibility. + * Illustrates models with visibility properties. + * + */ +package type.model.visibility; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/AdditionalPropertiesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/AdditionalPropertiesClientBuilder.java new file mode 100644 index 00000000000..487137c1b79 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/AdditionalPropertiesClientBuilder.java @@ -0,0 +1,957 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.property.additionalproperties.implementation.AdditionalPropertiesClientImpl; + +/** + * A builder for creating a new instance of the AdditionalPropertiesClient type. + */ +@ServiceClientBuilder( + serviceClients = { + ExtendsUnknownClient.class, + ExtendsUnknownDerivedClient.class, + ExtendsUnknownDiscriminatedClient.class, + IsUnknownClient.class, + IsUnknownDerivedClient.class, + IsUnknownDiscriminatedClient.class, + ExtendsStringClient.class, + IsStringClient.class, + SpreadStringClient.class, + ExtendsFloatClient.class, + IsFloatClient.class, + SpreadFloatClient.class, + ExtendsModelClient.class, + IsModelClient.class, + SpreadModelClient.class, + ExtendsModelArrayClient.class, + IsModelArrayClient.class, + SpreadModelArrayClient.class, + SpreadDifferentStringClient.class, + SpreadDifferentFloatClient.class, + SpreadDifferentModelClient.class, + SpreadDifferentModelArrayClient.class, + ExtendsDifferentSpreadStringClient.class, + ExtendsDifferentSpreadFloatClient.class, + ExtendsDifferentSpreadModelClient.class, + ExtendsDifferentSpreadModelArrayClient.class, + MultipleSpreadClient.class, + SpreadRecordUnionClient.class, + SpreadRecordNonDiscriminatedUnionClient.class, + SpreadRecordNonDiscriminatedUnion2Client.class, + SpreadRecordNonDiscriminatedUnion3Client.class, + ExtendsUnknownAsyncClient.class, + ExtendsUnknownDerivedAsyncClient.class, + ExtendsUnknownDiscriminatedAsyncClient.class, + IsUnknownAsyncClient.class, + IsUnknownDerivedAsyncClient.class, + IsUnknownDiscriminatedAsyncClient.class, + ExtendsStringAsyncClient.class, + IsStringAsyncClient.class, + SpreadStringAsyncClient.class, + ExtendsFloatAsyncClient.class, + IsFloatAsyncClient.class, + SpreadFloatAsyncClient.class, + ExtendsModelAsyncClient.class, + IsModelAsyncClient.class, + SpreadModelAsyncClient.class, + ExtendsModelArrayAsyncClient.class, + IsModelArrayAsyncClient.class, + SpreadModelArrayAsyncClient.class, + SpreadDifferentStringAsyncClient.class, + SpreadDifferentFloatAsyncClient.class, + SpreadDifferentModelAsyncClient.class, + SpreadDifferentModelArrayAsyncClient.class, + ExtendsDifferentSpreadStringAsyncClient.class, + ExtendsDifferentSpreadFloatAsyncClient.class, + ExtendsDifferentSpreadModelAsyncClient.class, + ExtendsDifferentSpreadModelArrayAsyncClient.class, + MultipleSpreadAsyncClient.class, + SpreadRecordUnionAsyncClient.class, + SpreadRecordNonDiscriminatedUnionAsyncClient.class, + SpreadRecordNonDiscriminatedUnion2AsyncClient.class, + SpreadRecordNonDiscriminatedUnion3AsyncClient.class }) +public final class AdditionalPropertiesClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("type-property-additionalproperties.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the AdditionalPropertiesClientBuilder. + */ + @Generated + public AdditionalPropertiesClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AdditionalPropertiesClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AdditionalPropertiesClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AdditionalPropertiesClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AdditionalPropertiesClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AdditionalPropertiesClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AdditionalPropertiesClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AdditionalPropertiesClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AdditionalPropertiesClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the AdditionalPropertiesClientBuilder. + */ + @Generated + public AdditionalPropertiesClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of AdditionalPropertiesClientImpl with the provided parameters. + * + * @return an instance of AdditionalPropertiesClientImpl. + */ + @Generated + private AdditionalPropertiesClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + AdditionalPropertiesClientImpl client = new AdditionalPropertiesClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ExtendsUnknownAsyncClient class. + * + * @return an instance of ExtendsUnknownAsyncClient. + */ + @Generated + public ExtendsUnknownAsyncClient buildExtendsUnknownAsyncClient() { + return new ExtendsUnknownAsyncClient(buildInnerClient().getExtendsUnknowns()); + } + + /** + * Builds an instance of ExtendsUnknownDerivedAsyncClient class. + * + * @return an instance of ExtendsUnknownDerivedAsyncClient. + */ + @Generated + public ExtendsUnknownDerivedAsyncClient buildExtendsUnknownDerivedAsyncClient() { + return new ExtendsUnknownDerivedAsyncClient(buildInnerClient().getExtendsUnknownDeriveds()); + } + + /** + * Builds an instance of ExtendsUnknownDiscriminatedAsyncClient class. + * + * @return an instance of ExtendsUnknownDiscriminatedAsyncClient. + */ + @Generated + public ExtendsUnknownDiscriminatedAsyncClient buildExtendsUnknownDiscriminatedAsyncClient() { + return new ExtendsUnknownDiscriminatedAsyncClient(buildInnerClient().getExtendsUnknownDiscriminateds()); + } + + /** + * Builds an instance of IsUnknownAsyncClient class. + * + * @return an instance of IsUnknownAsyncClient. + */ + @Generated + public IsUnknownAsyncClient buildIsUnknownAsyncClient() { + return new IsUnknownAsyncClient(buildInnerClient().getIsUnknowns()); + } + + /** + * Builds an instance of IsUnknownDerivedAsyncClient class. + * + * @return an instance of IsUnknownDerivedAsyncClient. + */ + @Generated + public IsUnknownDerivedAsyncClient buildIsUnknownDerivedAsyncClient() { + return new IsUnknownDerivedAsyncClient(buildInnerClient().getIsUnknownDeriveds()); + } + + /** + * Builds an instance of IsUnknownDiscriminatedAsyncClient class. + * + * @return an instance of IsUnknownDiscriminatedAsyncClient. + */ + @Generated + public IsUnknownDiscriminatedAsyncClient buildIsUnknownDiscriminatedAsyncClient() { + return new IsUnknownDiscriminatedAsyncClient(buildInnerClient().getIsUnknownDiscriminateds()); + } + + /** + * Builds an instance of ExtendsStringAsyncClient class. + * + * @return an instance of ExtendsStringAsyncClient. + */ + @Generated + public ExtendsStringAsyncClient buildExtendsStringAsyncClient() { + return new ExtendsStringAsyncClient(buildInnerClient().getExtendsStrings()); + } + + /** + * Builds an instance of IsStringAsyncClient class. + * + * @return an instance of IsStringAsyncClient. + */ + @Generated + public IsStringAsyncClient buildIsStringAsyncClient() { + return new IsStringAsyncClient(buildInnerClient().getIsStrings()); + } + + /** + * Builds an instance of SpreadStringAsyncClient class. + * + * @return an instance of SpreadStringAsyncClient. + */ + @Generated + public SpreadStringAsyncClient buildSpreadStringAsyncClient() { + return new SpreadStringAsyncClient(buildInnerClient().getSpreadStrings()); + } + + /** + * Builds an instance of ExtendsFloatAsyncClient class. + * + * @return an instance of ExtendsFloatAsyncClient. + */ + @Generated + public ExtendsFloatAsyncClient buildExtendsFloatAsyncClient() { + return new ExtendsFloatAsyncClient(buildInnerClient().getExtendsFloats()); + } + + /** + * Builds an instance of IsFloatAsyncClient class. + * + * @return an instance of IsFloatAsyncClient. + */ + @Generated + public IsFloatAsyncClient buildIsFloatAsyncClient() { + return new IsFloatAsyncClient(buildInnerClient().getIsFloats()); + } + + /** + * Builds an instance of SpreadFloatAsyncClient class. + * + * @return an instance of SpreadFloatAsyncClient. + */ + @Generated + public SpreadFloatAsyncClient buildSpreadFloatAsyncClient() { + return new SpreadFloatAsyncClient(buildInnerClient().getSpreadFloats()); + } + + /** + * Builds an instance of ExtendsModelAsyncClient class. + * + * @return an instance of ExtendsModelAsyncClient. + */ + @Generated + public ExtendsModelAsyncClient buildExtendsModelAsyncClient() { + return new ExtendsModelAsyncClient(buildInnerClient().getExtendsModels()); + } + + /** + * Builds an instance of IsModelAsyncClient class. + * + * @return an instance of IsModelAsyncClient. + */ + @Generated + public IsModelAsyncClient buildIsModelAsyncClient() { + return new IsModelAsyncClient(buildInnerClient().getIsModels()); + } + + /** + * Builds an instance of SpreadModelAsyncClient class. + * + * @return an instance of SpreadModelAsyncClient. + */ + @Generated + public SpreadModelAsyncClient buildSpreadModelAsyncClient() { + return new SpreadModelAsyncClient(buildInnerClient().getSpreadModels()); + } + + /** + * Builds an instance of ExtendsModelArrayAsyncClient class. + * + * @return an instance of ExtendsModelArrayAsyncClient. + */ + @Generated + public ExtendsModelArrayAsyncClient buildExtendsModelArrayAsyncClient() { + return new ExtendsModelArrayAsyncClient(buildInnerClient().getExtendsModelArrays()); + } + + /** + * Builds an instance of IsModelArrayAsyncClient class. + * + * @return an instance of IsModelArrayAsyncClient. + */ + @Generated + public IsModelArrayAsyncClient buildIsModelArrayAsyncClient() { + return new IsModelArrayAsyncClient(buildInnerClient().getIsModelArrays()); + } + + /** + * Builds an instance of SpreadModelArrayAsyncClient class. + * + * @return an instance of SpreadModelArrayAsyncClient. + */ + @Generated + public SpreadModelArrayAsyncClient buildSpreadModelArrayAsyncClient() { + return new SpreadModelArrayAsyncClient(buildInnerClient().getSpreadModelArrays()); + } + + /** + * Builds an instance of SpreadDifferentStringAsyncClient class. + * + * @return an instance of SpreadDifferentStringAsyncClient. + */ + @Generated + public SpreadDifferentStringAsyncClient buildSpreadDifferentStringAsyncClient() { + return new SpreadDifferentStringAsyncClient(buildInnerClient().getSpreadDifferentStrings()); + } + + /** + * Builds an instance of SpreadDifferentFloatAsyncClient class. + * + * @return an instance of SpreadDifferentFloatAsyncClient. + */ + @Generated + public SpreadDifferentFloatAsyncClient buildSpreadDifferentFloatAsyncClient() { + return new SpreadDifferentFloatAsyncClient(buildInnerClient().getSpreadDifferentFloats()); + } + + /** + * Builds an instance of SpreadDifferentModelAsyncClient class. + * + * @return an instance of SpreadDifferentModelAsyncClient. + */ + @Generated + public SpreadDifferentModelAsyncClient buildSpreadDifferentModelAsyncClient() { + return new SpreadDifferentModelAsyncClient(buildInnerClient().getSpreadDifferentModels()); + } + + /** + * Builds an instance of SpreadDifferentModelArrayAsyncClient class. + * + * @return an instance of SpreadDifferentModelArrayAsyncClient. + */ + @Generated + public SpreadDifferentModelArrayAsyncClient buildSpreadDifferentModelArrayAsyncClient() { + return new SpreadDifferentModelArrayAsyncClient(buildInnerClient().getSpreadDifferentModelArrays()); + } + + /** + * Builds an instance of ExtendsDifferentSpreadStringAsyncClient class. + * + * @return an instance of ExtendsDifferentSpreadStringAsyncClient. + */ + @Generated + public ExtendsDifferentSpreadStringAsyncClient buildExtendsDifferentSpreadStringAsyncClient() { + return new ExtendsDifferentSpreadStringAsyncClient(buildInnerClient().getExtendsDifferentSpreadStrings()); + } + + /** + * Builds an instance of ExtendsDifferentSpreadFloatAsyncClient class. + * + * @return an instance of ExtendsDifferentSpreadFloatAsyncClient. + */ + @Generated + public ExtendsDifferentSpreadFloatAsyncClient buildExtendsDifferentSpreadFloatAsyncClient() { + return new ExtendsDifferentSpreadFloatAsyncClient(buildInnerClient().getExtendsDifferentSpreadFloats()); + } + + /** + * Builds an instance of ExtendsDifferentSpreadModelAsyncClient class. + * + * @return an instance of ExtendsDifferentSpreadModelAsyncClient. + */ + @Generated + public ExtendsDifferentSpreadModelAsyncClient buildExtendsDifferentSpreadModelAsyncClient() { + return new ExtendsDifferentSpreadModelAsyncClient(buildInnerClient().getExtendsDifferentSpreadModels()); + } + + /** + * Builds an instance of ExtendsDifferentSpreadModelArrayAsyncClient class. + * + * @return an instance of ExtendsDifferentSpreadModelArrayAsyncClient. + */ + @Generated + public ExtendsDifferentSpreadModelArrayAsyncClient buildExtendsDifferentSpreadModelArrayAsyncClient() { + return new ExtendsDifferentSpreadModelArrayAsyncClient( + buildInnerClient().getExtendsDifferentSpreadModelArrays()); + } + + /** + * Builds an instance of MultipleSpreadAsyncClient class. + * + * @return an instance of MultipleSpreadAsyncClient. + */ + @Generated + public MultipleSpreadAsyncClient buildMultipleSpreadAsyncClient() { + return new MultipleSpreadAsyncClient(buildInnerClient().getMultipleSpreads()); + } + + /** + * Builds an instance of SpreadRecordUnionAsyncClient class. + * + * @return an instance of SpreadRecordUnionAsyncClient. + */ + @Generated + public SpreadRecordUnionAsyncClient buildSpreadRecordUnionAsyncClient() { + return new SpreadRecordUnionAsyncClient(buildInnerClient().getSpreadRecordUnions()); + } + + /** + * Builds an instance of SpreadRecordNonDiscriminatedUnionAsyncClient class. + * + * @return an instance of SpreadRecordNonDiscriminatedUnionAsyncClient. + */ + @Generated + public SpreadRecordNonDiscriminatedUnionAsyncClient buildSpreadRecordNonDiscriminatedUnionAsyncClient() { + return new SpreadRecordNonDiscriminatedUnionAsyncClient( + buildInnerClient().getSpreadRecordNonDiscriminatedUnions()); + } + + /** + * Builds an instance of SpreadRecordNonDiscriminatedUnion2AsyncClient class. + * + * @return an instance of SpreadRecordNonDiscriminatedUnion2AsyncClient. + */ + @Generated + public SpreadRecordNonDiscriminatedUnion2AsyncClient buildSpreadRecordNonDiscriminatedUnion2AsyncClient() { + return new SpreadRecordNonDiscriminatedUnion2AsyncClient( + buildInnerClient().getSpreadRecordNonDiscriminatedUnion2s()); + } + + /** + * Builds an instance of SpreadRecordNonDiscriminatedUnion3AsyncClient class. + * + * @return an instance of SpreadRecordNonDiscriminatedUnion3AsyncClient. + */ + @Generated + public SpreadRecordNonDiscriminatedUnion3AsyncClient buildSpreadRecordNonDiscriminatedUnion3AsyncClient() { + return new SpreadRecordNonDiscriminatedUnion3AsyncClient( + buildInnerClient().getSpreadRecordNonDiscriminatedUnion3s()); + } + + /** + * Builds an instance of ExtendsUnknownClient class. + * + * @return an instance of ExtendsUnknownClient. + */ + @Generated + public ExtendsUnknownClient buildExtendsUnknownClient() { + return new ExtendsUnknownClient(buildInnerClient().getExtendsUnknowns()); + } + + /** + * Builds an instance of ExtendsUnknownDerivedClient class. + * + * @return an instance of ExtendsUnknownDerivedClient. + */ + @Generated + public ExtendsUnknownDerivedClient buildExtendsUnknownDerivedClient() { + return new ExtendsUnknownDerivedClient(buildInnerClient().getExtendsUnknownDeriveds()); + } + + /** + * Builds an instance of ExtendsUnknownDiscriminatedClient class. + * + * @return an instance of ExtendsUnknownDiscriminatedClient. + */ + @Generated + public ExtendsUnknownDiscriminatedClient buildExtendsUnknownDiscriminatedClient() { + return new ExtendsUnknownDiscriminatedClient(buildInnerClient().getExtendsUnknownDiscriminateds()); + } + + /** + * Builds an instance of IsUnknownClient class. + * + * @return an instance of IsUnknownClient. + */ + @Generated + public IsUnknownClient buildIsUnknownClient() { + return new IsUnknownClient(buildInnerClient().getIsUnknowns()); + } + + /** + * Builds an instance of IsUnknownDerivedClient class. + * + * @return an instance of IsUnknownDerivedClient. + */ + @Generated + public IsUnknownDerivedClient buildIsUnknownDerivedClient() { + return new IsUnknownDerivedClient(buildInnerClient().getIsUnknownDeriveds()); + } + + /** + * Builds an instance of IsUnknownDiscriminatedClient class. + * + * @return an instance of IsUnknownDiscriminatedClient. + */ + @Generated + public IsUnknownDiscriminatedClient buildIsUnknownDiscriminatedClient() { + return new IsUnknownDiscriminatedClient(buildInnerClient().getIsUnknownDiscriminateds()); + } + + /** + * Builds an instance of ExtendsStringClient class. + * + * @return an instance of ExtendsStringClient. + */ + @Generated + public ExtendsStringClient buildExtendsStringClient() { + return new ExtendsStringClient(buildInnerClient().getExtendsStrings()); + } + + /** + * Builds an instance of IsStringClient class. + * + * @return an instance of IsStringClient. + */ + @Generated + public IsStringClient buildIsStringClient() { + return new IsStringClient(buildInnerClient().getIsStrings()); + } + + /** + * Builds an instance of SpreadStringClient class. + * + * @return an instance of SpreadStringClient. + */ + @Generated + public SpreadStringClient buildSpreadStringClient() { + return new SpreadStringClient(buildInnerClient().getSpreadStrings()); + } + + /** + * Builds an instance of ExtendsFloatClient class. + * + * @return an instance of ExtendsFloatClient. + */ + @Generated + public ExtendsFloatClient buildExtendsFloatClient() { + return new ExtendsFloatClient(buildInnerClient().getExtendsFloats()); + } + + /** + * Builds an instance of IsFloatClient class. + * + * @return an instance of IsFloatClient. + */ + @Generated + public IsFloatClient buildIsFloatClient() { + return new IsFloatClient(buildInnerClient().getIsFloats()); + } + + /** + * Builds an instance of SpreadFloatClient class. + * + * @return an instance of SpreadFloatClient. + */ + @Generated + public SpreadFloatClient buildSpreadFloatClient() { + return new SpreadFloatClient(buildInnerClient().getSpreadFloats()); + } + + /** + * Builds an instance of ExtendsModelClient class. + * + * @return an instance of ExtendsModelClient. + */ + @Generated + public ExtendsModelClient buildExtendsModelClient() { + return new ExtendsModelClient(buildInnerClient().getExtendsModels()); + } + + /** + * Builds an instance of IsModelClient class. + * + * @return an instance of IsModelClient. + */ + @Generated + public IsModelClient buildIsModelClient() { + return new IsModelClient(buildInnerClient().getIsModels()); + } + + /** + * Builds an instance of SpreadModelClient class. + * + * @return an instance of SpreadModelClient. + */ + @Generated + public SpreadModelClient buildSpreadModelClient() { + return new SpreadModelClient(buildInnerClient().getSpreadModels()); + } + + /** + * Builds an instance of ExtendsModelArrayClient class. + * + * @return an instance of ExtendsModelArrayClient. + */ + @Generated + public ExtendsModelArrayClient buildExtendsModelArrayClient() { + return new ExtendsModelArrayClient(buildInnerClient().getExtendsModelArrays()); + } + + /** + * Builds an instance of IsModelArrayClient class. + * + * @return an instance of IsModelArrayClient. + */ + @Generated + public IsModelArrayClient buildIsModelArrayClient() { + return new IsModelArrayClient(buildInnerClient().getIsModelArrays()); + } + + /** + * Builds an instance of SpreadModelArrayClient class. + * + * @return an instance of SpreadModelArrayClient. + */ + @Generated + public SpreadModelArrayClient buildSpreadModelArrayClient() { + return new SpreadModelArrayClient(buildInnerClient().getSpreadModelArrays()); + } + + /** + * Builds an instance of SpreadDifferentStringClient class. + * + * @return an instance of SpreadDifferentStringClient. + */ + @Generated + public SpreadDifferentStringClient buildSpreadDifferentStringClient() { + return new SpreadDifferentStringClient(buildInnerClient().getSpreadDifferentStrings()); + } + + /** + * Builds an instance of SpreadDifferentFloatClient class. + * + * @return an instance of SpreadDifferentFloatClient. + */ + @Generated + public SpreadDifferentFloatClient buildSpreadDifferentFloatClient() { + return new SpreadDifferentFloatClient(buildInnerClient().getSpreadDifferentFloats()); + } + + /** + * Builds an instance of SpreadDifferentModelClient class. + * + * @return an instance of SpreadDifferentModelClient. + */ + @Generated + public SpreadDifferentModelClient buildSpreadDifferentModelClient() { + return new SpreadDifferentModelClient(buildInnerClient().getSpreadDifferentModels()); + } + + /** + * Builds an instance of SpreadDifferentModelArrayClient class. + * + * @return an instance of SpreadDifferentModelArrayClient. + */ + @Generated + public SpreadDifferentModelArrayClient buildSpreadDifferentModelArrayClient() { + return new SpreadDifferentModelArrayClient(buildInnerClient().getSpreadDifferentModelArrays()); + } + + /** + * Builds an instance of ExtendsDifferentSpreadStringClient class. + * + * @return an instance of ExtendsDifferentSpreadStringClient. + */ + @Generated + public ExtendsDifferentSpreadStringClient buildExtendsDifferentSpreadStringClient() { + return new ExtendsDifferentSpreadStringClient(buildInnerClient().getExtendsDifferentSpreadStrings()); + } + + /** + * Builds an instance of ExtendsDifferentSpreadFloatClient class. + * + * @return an instance of ExtendsDifferentSpreadFloatClient. + */ + @Generated + public ExtendsDifferentSpreadFloatClient buildExtendsDifferentSpreadFloatClient() { + return new ExtendsDifferentSpreadFloatClient(buildInnerClient().getExtendsDifferentSpreadFloats()); + } + + /** + * Builds an instance of ExtendsDifferentSpreadModelClient class. + * + * @return an instance of ExtendsDifferentSpreadModelClient. + */ + @Generated + public ExtendsDifferentSpreadModelClient buildExtendsDifferentSpreadModelClient() { + return new ExtendsDifferentSpreadModelClient(buildInnerClient().getExtendsDifferentSpreadModels()); + } + + /** + * Builds an instance of ExtendsDifferentSpreadModelArrayClient class. + * + * @return an instance of ExtendsDifferentSpreadModelArrayClient. + */ + @Generated + public ExtendsDifferentSpreadModelArrayClient buildExtendsDifferentSpreadModelArrayClient() { + return new ExtendsDifferentSpreadModelArrayClient(buildInnerClient().getExtendsDifferentSpreadModelArrays()); + } + + /** + * Builds an instance of MultipleSpreadClient class. + * + * @return an instance of MultipleSpreadClient. + */ + @Generated + public MultipleSpreadClient buildMultipleSpreadClient() { + return new MultipleSpreadClient(buildInnerClient().getMultipleSpreads()); + } + + /** + * Builds an instance of SpreadRecordUnionClient class. + * + * @return an instance of SpreadRecordUnionClient. + */ + @Generated + public SpreadRecordUnionClient buildSpreadRecordUnionClient() { + return new SpreadRecordUnionClient(buildInnerClient().getSpreadRecordUnions()); + } + + /** + * Builds an instance of SpreadRecordNonDiscriminatedUnionClient class. + * + * @return an instance of SpreadRecordNonDiscriminatedUnionClient. + */ + @Generated + public SpreadRecordNonDiscriminatedUnionClient buildSpreadRecordNonDiscriminatedUnionClient() { + return new SpreadRecordNonDiscriminatedUnionClient(buildInnerClient().getSpreadRecordNonDiscriminatedUnions()); + } + + /** + * Builds an instance of SpreadRecordNonDiscriminatedUnion2Client class. + * + * @return an instance of SpreadRecordNonDiscriminatedUnion2Client. + */ + @Generated + public SpreadRecordNonDiscriminatedUnion2Client buildSpreadRecordNonDiscriminatedUnion2Client() { + return new SpreadRecordNonDiscriminatedUnion2Client( + buildInnerClient().getSpreadRecordNonDiscriminatedUnion2s()); + } + + /** + * Builds an instance of SpreadRecordNonDiscriminatedUnion3Client class. + * + * @return an instance of SpreadRecordNonDiscriminatedUnion3Client. + */ + @Generated + public SpreadRecordNonDiscriminatedUnion3Client buildSpreadRecordNonDiscriminatedUnion3Client() { + return new SpreadRecordNonDiscriminatedUnion3Client( + buildInnerClient().getSpreadRecordNonDiscriminatedUnion3s()); + } + + private static final ClientLogger LOGGER = new ClientLogger(AdditionalPropertiesClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatAsyncClient.java new file mode 100644 index 00000000000..13053e41d2b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatAsyncClient.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.ExtendsDifferentSpreadFloatsImpl; +import type.property.additionalproperties.models.DifferentSpreadFloatDerived; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class ExtendsDifferentSpreadFloatAsyncClient { + @Generated + private final ExtendsDifferentSpreadFloatsImpl serviceClient; + + /** + * Initializes an instance of ExtendsDifferentSpreadFloatAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsDifferentSpreadFloatAsyncClient(ExtendsDifferentSpreadFloatsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     *     derivedProp: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     *     derivedProp: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadFloatDerived.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(DifferentSpreadFloatDerived body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatClient.java new file mode 100644 index 00000000000..73b7055ef81 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.ExtendsDifferentSpreadFloatsImpl; +import type.property.additionalproperties.models.DifferentSpreadFloatDerived; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class ExtendsDifferentSpreadFloatClient { + @Generated + private final ExtendsDifferentSpreadFloatsImpl serviceClient; + + /** + * Initializes an instance of ExtendsDifferentSpreadFloatClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsDifferentSpreadFloatClient(ExtendsDifferentSpreadFloatsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     *     derivedProp: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     *     derivedProp: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DifferentSpreadFloatDerived get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadFloatDerived.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(DifferentSpreadFloatDerived body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayAsyncClient.java new file mode 100644 index 00000000000..9b4d3e47239 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayAsyncClient.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.ExtendsDifferentSpreadModelArraysImpl; +import type.property.additionalproperties.models.DifferentSpreadModelArrayDerived; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class ExtendsDifferentSpreadModelArrayAsyncClient { + @Generated + private final ExtendsDifferentSpreadModelArraysImpl serviceClient; + + /** + * Initializes an instance of ExtendsDifferentSpreadModelArrayAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsDifferentSpreadModelArrayAsyncClient(ExtendsDifferentSpreadModelArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     *     derivedProp (Required): [
+     *         (recursive schema, see above)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     *     derivedProp (Required): [
+     *         (recursive schema, see above)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadModelArrayDerived.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(DifferentSpreadModelArrayDerived body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayClient.java new file mode 100644 index 00000000000..a41988bc647 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.ExtendsDifferentSpreadModelArraysImpl; +import type.property.additionalproperties.models.DifferentSpreadModelArrayDerived; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class ExtendsDifferentSpreadModelArrayClient { + @Generated + private final ExtendsDifferentSpreadModelArraysImpl serviceClient; + + /** + * Initializes an instance of ExtendsDifferentSpreadModelArrayClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsDifferentSpreadModelArrayClient(ExtendsDifferentSpreadModelArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     *     derivedProp (Required): [
+     *         (recursive schema, see above)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     *     derivedProp (Required): [
+     *         (recursive schema, see above)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DifferentSpreadModelArrayDerived get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadModelArrayDerived.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(DifferentSpreadModelArrayDerived body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelAsyncClient.java new file mode 100644 index 00000000000..9be82a4bfbd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelAsyncClient.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.ExtendsDifferentSpreadModelsImpl; +import type.property.additionalproperties.models.DifferentSpreadModelDerived; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class ExtendsDifferentSpreadModelAsyncClient { + @Generated + private final ExtendsDifferentSpreadModelsImpl serviceClient; + + /** + * Initializes an instance of ExtendsDifferentSpreadModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsDifferentSpreadModelAsyncClient(ExtendsDifferentSpreadModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     *     derivedProp (Required): (recursive schema, see derivedProp above)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     *     derivedProp (Required): (recursive schema, see derivedProp above)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadModelDerived.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(DifferentSpreadModelDerived body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelClient.java new file mode 100644 index 00000000000..1965b07213b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelClient.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.ExtendsDifferentSpreadModelsImpl; +import type.property.additionalproperties.models.DifferentSpreadModelDerived; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class ExtendsDifferentSpreadModelClient { + @Generated + private final ExtendsDifferentSpreadModelsImpl serviceClient; + + /** + * Initializes an instance of ExtendsDifferentSpreadModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsDifferentSpreadModelClient(ExtendsDifferentSpreadModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     *     derivedProp (Required): (recursive schema, see derivedProp above)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     *     derivedProp (Required): (recursive schema, see derivedProp above)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DifferentSpreadModelDerived get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadModelDerived.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(DifferentSpreadModelDerived body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringAsyncClient.java new file mode 100644 index 00000000000..18f05dfa34c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringAsyncClient.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.ExtendsDifferentSpreadStringsImpl; +import type.property.additionalproperties.models.DifferentSpreadStringDerived; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class ExtendsDifferentSpreadStringAsyncClient { + @Generated + private final ExtendsDifferentSpreadStringsImpl serviceClient; + + /** + * Initializes an instance of ExtendsDifferentSpreadStringAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsDifferentSpreadStringAsyncClient(ExtendsDifferentSpreadStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     *     derivedProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     *     derivedProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadStringDerived.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(DifferentSpreadStringDerived body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringClient.java new file mode 100644 index 00000000000..b714975614b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.ExtendsDifferentSpreadStringsImpl; +import type.property.additionalproperties.models.DifferentSpreadStringDerived; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class ExtendsDifferentSpreadStringClient { + @Generated + private final ExtendsDifferentSpreadStringsImpl serviceClient; + + /** + * Initializes an instance of ExtendsDifferentSpreadStringClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsDifferentSpreadStringClient(ExtendsDifferentSpreadStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     *     derivedProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     *     derivedProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DifferentSpreadStringDerived get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadStringDerived.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(DifferentSpreadStringDerived body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatAsyncClient.java new file mode 100644 index 00000000000..026d0dc39fd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.ExtendsFloatsImpl; +import type.property.additionalproperties.models.ExtendsFloatAdditionalProperties; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class ExtendsFloatAsyncClient { + @Generated + private final ExtendsFloatsImpl serviceClient; + + /** + * Initializes an instance of ExtendsFloatAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsFloatAsyncClient(ExtendsFloatsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ExtendsFloatAdditionalProperties.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(ExtendsFloatAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatClient.java new file mode 100644 index 00000000000..4ba052bdf7c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsFloatClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.ExtendsFloatsImpl; +import type.property.additionalproperties.models.ExtendsFloatAdditionalProperties; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class ExtendsFloatClient { + @Generated + private final ExtendsFloatsImpl serviceClient; + + /** + * Initializes an instance of ExtendsFloatClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsFloatClient(ExtendsFloatsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendsFloatAdditionalProperties get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(ExtendsFloatAdditionalProperties.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(ExtendsFloatAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayAsyncClient.java new file mode 100644 index 00000000000..3196804de3a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayAsyncClient.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.ExtendsModelArraysImpl; +import type.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class ExtendsModelArrayAsyncClient { + @Generated + private final ExtendsModelArraysImpl serviceClient; + + /** + * Initializes an instance of ExtendsModelArrayAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsModelArrayAsyncClient(ExtendsModelArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ExtendsModelArrayAdditionalProperties.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(ExtendsModelArrayAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayClient.java new file mode 100644 index 00000000000..77f0c39bfd4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelArrayClient.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.ExtendsModelArraysImpl; +import type.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class ExtendsModelArrayClient { + @Generated + private final ExtendsModelArraysImpl serviceClient; + + /** + * Initializes an instance of ExtendsModelArrayClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsModelArrayClient(ExtendsModelArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendsModelArrayAdditionalProperties get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(ExtendsModelArrayAdditionalProperties.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(ExtendsModelArrayAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelAsyncClient.java new file mode 100644 index 00000000000..92b48fb641d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelAsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.ExtendsModelsImpl; +import type.property.additionalproperties.models.ExtendsModelAdditionalProperties; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class ExtendsModelAsyncClient { + @Generated + private final ExtendsModelsImpl serviceClient; + + /** + * Initializes an instance of ExtendsModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsModelAsyncClient(ExtendsModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ExtendsModelAdditionalProperties.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(ExtendsModelAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelClient.java new file mode 100644 index 00000000000..90f58c58ed3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsModelClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.ExtendsModelsImpl; +import type.property.additionalproperties.models.ExtendsModelAdditionalProperties; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class ExtendsModelClient { + @Generated + private final ExtendsModelsImpl serviceClient; + + /** + * Initializes an instance of ExtendsModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsModelClient(ExtendsModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendsModelAdditionalProperties get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(ExtendsModelAdditionalProperties.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(ExtendsModelAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringAsyncClient.java new file mode 100644 index 00000000000..3d1813be333 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.ExtendsStringsImpl; +import type.property.additionalproperties.models.ExtendsStringAdditionalProperties; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class ExtendsStringAsyncClient { + @Generated + private final ExtendsStringsImpl serviceClient; + + /** + * Initializes an instance of ExtendsStringAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsStringAsyncClient(ExtendsStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ExtendsStringAdditionalProperties.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(ExtendsStringAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringClient.java new file mode 100644 index 00000000000..cc4c841de6f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsStringClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.ExtendsStringsImpl; +import type.property.additionalproperties.models.ExtendsStringAdditionalProperties; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class ExtendsStringClient { + @Generated + private final ExtendsStringsImpl serviceClient; + + /** + * Initializes an instance of ExtendsStringClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsStringClient(ExtendsStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendsStringAdditionalProperties get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(ExtendsStringAdditionalProperties.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(ExtendsStringAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownAsyncClient.java new file mode 100644 index 00000000000..a83a34c2c73 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.ExtendsUnknownsImpl; +import type.property.additionalproperties.models.ExtendsUnknownAdditionalProperties; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class ExtendsUnknownAsyncClient { + @Generated + private final ExtendsUnknownsImpl serviceClient; + + /** + * Initializes an instance of ExtendsUnknownAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsUnknownAsyncClient(ExtendsUnknownsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ExtendsUnknownAdditionalProperties.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(ExtendsUnknownAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownClient.java new file mode 100644 index 00000000000..35cf068c973 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.ExtendsUnknownsImpl; +import type.property.additionalproperties.models.ExtendsUnknownAdditionalProperties; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class ExtendsUnknownClient { + @Generated + private final ExtendsUnknownsImpl serviceClient; + + /** + * Initializes an instance of ExtendsUnknownClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsUnknownClient(ExtendsUnknownsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendsUnknownAdditionalProperties get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(ExtendsUnknownAdditionalProperties.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(ExtendsUnknownAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedAsyncClient.java new file mode 100644 index 00000000000..83873741213 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedAsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.ExtendsUnknownDerivedsImpl; +import type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDerived; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class ExtendsUnknownDerivedAsyncClient { + @Generated + private final ExtendsUnknownDerivedsImpl serviceClient; + + /** + * Initializes an instance of ExtendsUnknownDerivedAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsUnknownDerivedAsyncClient(ExtendsUnknownDerivedsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ExtendsUnknownAdditionalPropertiesDerived.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(ExtendsUnknownAdditionalPropertiesDerived body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedClient.java new file mode 100644 index 00000000000..ff314b91165 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.ExtendsUnknownDerivedsImpl; +import type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDerived; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class ExtendsUnknownDerivedClient { + @Generated + private final ExtendsUnknownDerivedsImpl serviceClient; + + /** + * Initializes an instance of ExtendsUnknownDerivedClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsUnknownDerivedClient(ExtendsUnknownDerivedsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendsUnknownAdditionalPropertiesDerived get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(ExtendsUnknownAdditionalPropertiesDerived.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(ExtendsUnknownAdditionalPropertiesDerived body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedAsyncClient.java new file mode 100644 index 00000000000..78defd46b24 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedAsyncClient.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.ExtendsUnknownDiscriminatedsImpl; +import type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminated; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class ExtendsUnknownDiscriminatedAsyncClient { + @Generated + private final ExtendsUnknownDiscriminatedsImpl serviceClient; + + /** + * Initializes an instance of ExtendsUnknownDiscriminatedAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsUnknownDiscriminatedAsyncClient(ExtendsUnknownDiscriminatedsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData + .toObject(ExtendsUnknownAdditionalPropertiesDiscriminated.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(ExtendsUnknownAdditionalPropertiesDiscriminated body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedClient.java new file mode 100644 index 00000000000..321ddff0590 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.ExtendsUnknownDiscriminatedsImpl; +import type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminated; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class ExtendsUnknownDiscriminatedClient { + @Generated + private final ExtendsUnknownDiscriminatedsImpl serviceClient; + + /** + * Initializes an instance of ExtendsUnknownDiscriminatedClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtendsUnknownDiscriminatedClient(ExtendsUnknownDiscriminatedsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendsUnknownAdditionalPropertiesDiscriminated get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue() + .toObject(ExtendsUnknownAdditionalPropertiesDiscriminated.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(ExtendsUnknownAdditionalPropertiesDiscriminated body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatAsyncClient.java new file mode 100644 index 00000000000..bbfd446289d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.IsFloatsImpl; +import type.property.additionalproperties.models.IsFloatAdditionalProperties; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class IsFloatAsyncClient { + @Generated + private final IsFloatsImpl serviceClient; + + /** + * Initializes an instance of IsFloatAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsFloatAsyncClient(IsFloatsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(IsFloatAdditionalProperties.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(IsFloatAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatClient.java new file mode 100644 index 00000000000..15496ad1301 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsFloatClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.IsFloatsImpl; +import type.property.additionalproperties.models.IsFloatAdditionalProperties; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class IsFloatClient { + @Generated + private final IsFloatsImpl serviceClient; + + /** + * Initializes an instance of IsFloatClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsFloatClient(IsFloatsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public IsFloatAdditionalProperties get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(IsFloatAdditionalProperties.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(IsFloatAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayAsyncClient.java new file mode 100644 index 00000000000..4936465e71b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayAsyncClient.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.IsModelArraysImpl; +import type.property.additionalproperties.models.IsModelArrayAdditionalProperties; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class IsModelArrayAsyncClient { + @Generated + private final IsModelArraysImpl serviceClient; + + /** + * Initializes an instance of IsModelArrayAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsModelArrayAsyncClient(IsModelArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(IsModelArrayAdditionalProperties.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(IsModelArrayAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayClient.java new file mode 100644 index 00000000000..9eb66c02163 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelArrayClient.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.IsModelArraysImpl; +import type.property.additionalproperties.models.IsModelArrayAdditionalProperties; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class IsModelArrayClient { + @Generated + private final IsModelArraysImpl serviceClient; + + /** + * Initializes an instance of IsModelArrayClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsModelArrayClient(IsModelArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public IsModelArrayAdditionalProperties get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(IsModelArrayAdditionalProperties.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(IsModelArrayAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelAsyncClient.java new file mode 100644 index 00000000000..7dd55a95f2a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelAsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.IsModelsImpl; +import type.property.additionalproperties.models.IsModelAdditionalProperties; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class IsModelAsyncClient { + @Generated + private final IsModelsImpl serviceClient; + + /** + * Initializes an instance of IsModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsModelAsyncClient(IsModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(IsModelAdditionalProperties.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(IsModelAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelClient.java new file mode 100644 index 00000000000..0f2bcd58956 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsModelClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.IsModelsImpl; +import type.property.additionalproperties.models.IsModelAdditionalProperties; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class IsModelClient { + @Generated + private final IsModelsImpl serviceClient; + + /** + * Initializes an instance of IsModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsModelClient(IsModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public IsModelAdditionalProperties get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(IsModelAdditionalProperties.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(IsModelAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringAsyncClient.java new file mode 100644 index 00000000000..62382f7f0fb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.IsStringsImpl; +import type.property.additionalproperties.models.IsStringAdditionalProperties; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class IsStringAsyncClient { + @Generated + private final IsStringsImpl serviceClient; + + /** + * Initializes an instance of IsStringAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsStringAsyncClient(IsStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(IsStringAdditionalProperties.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(IsStringAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringClient.java new file mode 100644 index 00000000000..fcc567c50b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsStringClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.IsStringsImpl; +import type.property.additionalproperties.models.IsStringAdditionalProperties; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class IsStringClient { + @Generated + private final IsStringsImpl serviceClient; + + /** + * Initializes an instance of IsStringClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsStringClient(IsStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public IsStringAdditionalProperties get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(IsStringAdditionalProperties.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(IsStringAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownAsyncClient.java new file mode 100644 index 00000000000..46796a43ff9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.IsUnknownsImpl; +import type.property.additionalproperties.models.IsUnknownAdditionalProperties; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class IsUnknownAsyncClient { + @Generated + private final IsUnknownsImpl serviceClient; + + /** + * Initializes an instance of IsUnknownAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsUnknownAsyncClient(IsUnknownsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(IsUnknownAdditionalProperties.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(IsUnknownAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownClient.java new file mode 100644 index 00000000000..c495ef407b0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.IsUnknownsImpl; +import type.property.additionalproperties.models.IsUnknownAdditionalProperties; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class IsUnknownClient { + @Generated + private final IsUnknownsImpl serviceClient; + + /** + * Initializes an instance of IsUnknownClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsUnknownClient(IsUnknownsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public IsUnknownAdditionalProperties get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(IsUnknownAdditionalProperties.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(IsUnknownAdditionalProperties body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedAsyncClient.java new file mode 100644 index 00000000000..7ab6f04400b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedAsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.IsUnknownDerivedsImpl; +import type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDerived; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class IsUnknownDerivedAsyncClient { + @Generated + private final IsUnknownDerivedsImpl serviceClient; + + /** + * Initializes an instance of IsUnknownDerivedAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsUnknownDerivedAsyncClient(IsUnknownDerivedsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(IsUnknownAdditionalPropertiesDerived.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(IsUnknownAdditionalPropertiesDerived body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedClient.java new file mode 100644 index 00000000000..5be516f05fa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDerivedClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.IsUnknownDerivedsImpl; +import type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDerived; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class IsUnknownDerivedClient { + @Generated + private final IsUnknownDerivedsImpl serviceClient; + + /** + * Initializes an instance of IsUnknownDerivedClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsUnknownDerivedClient(IsUnknownDerivedsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public IsUnknownAdditionalPropertiesDerived get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(IsUnknownAdditionalPropertiesDerived.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(IsUnknownAdditionalPropertiesDerived body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedAsyncClient.java new file mode 100644 index 00000000000..fc983f168fb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedAsyncClient.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.IsUnknownDiscriminatedsImpl; +import type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminated; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class IsUnknownDiscriminatedAsyncClient { + @Generated + private final IsUnknownDiscriminatedsImpl serviceClient; + + /** + * Initializes an instance of IsUnknownDiscriminatedAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsUnknownDiscriminatedAsyncClient(IsUnknownDiscriminatedsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(IsUnknownAdditionalPropertiesDiscriminated.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(IsUnknownAdditionalPropertiesDiscriminated body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedClient.java new file mode 100644 index 00000000000..62e6beaf161 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.IsUnknownDiscriminatedsImpl; +import type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminated; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class IsUnknownDiscriminatedClient { + @Generated + private final IsUnknownDiscriminatedsImpl serviceClient; + + /** + * Initializes an instance of IsUnknownDiscriminatedClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IsUnknownDiscriminatedClient(IsUnknownDiscriminatedsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public IsUnknownAdditionalPropertiesDiscriminated get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(IsUnknownAdditionalPropertiesDiscriminated.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(IsUnknownAdditionalPropertiesDiscriminated body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadAsyncClient.java new file mode 100644 index 00000000000..8493e5adf43 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.MultipleSpreadsImpl; +import type.property.additionalproperties.models.MultipleSpreadRecord; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class MultipleSpreadAsyncClient { + @Generated + private final MultipleSpreadsImpl serviceClient; + + /** + * Initializes an instance of MultipleSpreadAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MultipleSpreadAsyncClient(MultipleSpreadsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(MultipleSpreadRecord.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(MultipleSpreadRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadClient.java new file mode 100644 index 00000000000..e4ebaaeee5b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/MultipleSpreadClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.MultipleSpreadsImpl; +import type.property.additionalproperties.models.MultipleSpreadRecord; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class MultipleSpreadClient { + @Generated + private final MultipleSpreadsImpl serviceClient; + + /** + * Initializes an instance of MultipleSpreadClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MultipleSpreadClient(MultipleSpreadsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public MultipleSpreadRecord get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(MultipleSpreadRecord.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(MultipleSpreadRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatAsyncClient.java new file mode 100644 index 00000000000..a1f19a0bdac --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.SpreadDifferentFloatsImpl; +import type.property.additionalproperties.models.DifferentSpreadFloatRecord; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class SpreadDifferentFloatAsyncClient { + @Generated + private final SpreadDifferentFloatsImpl serviceClient; + + /** + * Initializes an instance of SpreadDifferentFloatAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadDifferentFloatAsyncClient(SpreadDifferentFloatsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadFloatRecord.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(DifferentSpreadFloatRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatClient.java new file mode 100644 index 00000000000..1575f057cdf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentFloatClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.SpreadDifferentFloatsImpl; +import type.property.additionalproperties.models.DifferentSpreadFloatRecord; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class SpreadDifferentFloatClient { + @Generated + private final SpreadDifferentFloatsImpl serviceClient; + + /** + * Initializes an instance of SpreadDifferentFloatClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadDifferentFloatClient(SpreadDifferentFloatsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DifferentSpreadFloatRecord get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadFloatRecord.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(DifferentSpreadFloatRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayAsyncClient.java new file mode 100644 index 00000000000..a5f7683a6c3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayAsyncClient.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.SpreadDifferentModelArraysImpl; +import type.property.additionalproperties.models.DifferentSpreadModelArrayRecord; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class SpreadDifferentModelArrayAsyncClient { + @Generated + private final SpreadDifferentModelArraysImpl serviceClient; + + /** + * Initializes an instance of SpreadDifferentModelArrayAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadDifferentModelArrayAsyncClient(SpreadDifferentModelArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadModelArrayRecord.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(DifferentSpreadModelArrayRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayClient.java new file mode 100644 index 00000000000..1f728a83a87 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.SpreadDifferentModelArraysImpl; +import type.property.additionalproperties.models.DifferentSpreadModelArrayRecord; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class SpreadDifferentModelArrayClient { + @Generated + private final SpreadDifferentModelArraysImpl serviceClient; + + /** + * Initializes an instance of SpreadDifferentModelArrayClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadDifferentModelArrayClient(SpreadDifferentModelArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DifferentSpreadModelArrayRecord get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadModelArrayRecord.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(DifferentSpreadModelArrayRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelAsyncClient.java new file mode 100644 index 00000000000..a581dea6ebc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelAsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.SpreadDifferentModelsImpl; +import type.property.additionalproperties.models.DifferentSpreadModelRecord; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class SpreadDifferentModelAsyncClient { + @Generated + private final SpreadDifferentModelsImpl serviceClient; + + /** + * Initializes an instance of SpreadDifferentModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadDifferentModelAsyncClient(SpreadDifferentModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadModelRecord.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(DifferentSpreadModelRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelClient.java new file mode 100644 index 00000000000..884c9c47c14 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentModelClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.SpreadDifferentModelsImpl; +import type.property.additionalproperties.models.DifferentSpreadModelRecord; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class SpreadDifferentModelClient { + @Generated + private final SpreadDifferentModelsImpl serviceClient; + + /** + * Initializes an instance of SpreadDifferentModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadDifferentModelClient(SpreadDifferentModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DifferentSpreadModelRecord get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadModelRecord.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(DifferentSpreadModelRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringAsyncClient.java new file mode 100644 index 00000000000..f77f71b350b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.SpreadDifferentStringsImpl; +import type.property.additionalproperties.models.DifferentSpreadStringRecord; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class SpreadDifferentStringAsyncClient { + @Generated + private final SpreadDifferentStringsImpl serviceClient; + + /** + * Initializes an instance of SpreadDifferentStringAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadDifferentStringAsyncClient(SpreadDifferentStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DifferentSpreadStringRecord.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(DifferentSpreadStringRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringClient.java new file mode 100644 index 00000000000..c0e9155b535 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadDifferentStringClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.SpreadDifferentStringsImpl; +import type.property.additionalproperties.models.DifferentSpreadStringRecord; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class SpreadDifferentStringClient { + @Generated + private final SpreadDifferentStringsImpl serviceClient; + + /** + * Initializes an instance of SpreadDifferentStringClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadDifferentStringClient(SpreadDifferentStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DifferentSpreadStringRecord get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(DifferentSpreadStringRecord.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(DifferentSpreadStringRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatAsyncClient.java new file mode 100644 index 00000000000..b8cc70c03f8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.SpreadFloatsImpl; +import type.property.additionalproperties.models.SpreadFloatRecord; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class SpreadFloatAsyncClient { + @Generated + private final SpreadFloatsImpl serviceClient; + + /** + * Initializes an instance of SpreadFloatAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadFloatAsyncClient(SpreadFloatsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SpreadFloatRecord.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(SpreadFloatRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatClient.java new file mode 100644 index 00000000000..4a3b45ba4e0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadFloatClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.SpreadFloatsImpl; +import type.property.additionalproperties.models.SpreadFloatRecord; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class SpreadFloatClient { + @Generated + private final SpreadFloatsImpl serviceClient; + + /** + * Initializes an instance of SpreadFloatClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadFloatClient(SpreadFloatsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SpreadFloatRecord get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(SpreadFloatRecord.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(SpreadFloatRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayAsyncClient.java new file mode 100644 index 00000000000..0e8a7bd9a5f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayAsyncClient.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.SpreadModelArraysImpl; +import type.property.additionalproperties.models.SpreadModelArrayRecord; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class SpreadModelArrayAsyncClient { + @Generated + private final SpreadModelArraysImpl serviceClient; + + /** + * Initializes an instance of SpreadModelArrayAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadModelArrayAsyncClient(SpreadModelArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SpreadModelArrayRecord.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(SpreadModelArrayRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayClient.java new file mode 100644 index 00000000000..3b17690d0bb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelArrayClient.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.SpreadModelArraysImpl; +import type.property.additionalproperties.models.SpreadModelArrayRecord; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class SpreadModelArrayClient { + @Generated + private final SpreadModelArraysImpl serviceClient; + + /** + * Initializes an instance of SpreadModelArrayClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadModelArrayClient(SpreadModelArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SpreadModelArrayRecord get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(SpreadModelArrayRecord.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(SpreadModelArrayRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelAsyncClient.java new file mode 100644 index 00000000000..c529744ee9d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelAsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.SpreadModelsImpl; +import type.property.additionalproperties.models.SpreadModelRecord; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class SpreadModelAsyncClient { + @Generated + private final SpreadModelsImpl serviceClient; + + /** + * Initializes an instance of SpreadModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadModelAsyncClient(SpreadModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SpreadModelRecord.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(SpreadModelRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelClient.java new file mode 100644 index 00000000000..015ca294a19 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadModelClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.SpreadModelsImpl; +import type.property.additionalproperties.models.SpreadModelRecord; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class SpreadModelClient { + @Generated + private final SpreadModelsImpl serviceClient; + + /** + * Initializes an instance of SpreadModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadModelClient(SpreadModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SpreadModelRecord get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(SpreadModelRecord.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(SpreadModelRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2AsyncClient.java new file mode 100644 index 00000000000..b478e1c6a0f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2AsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.SpreadRecordNonDiscriminatedUnion2sImpl; +import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion2; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class SpreadRecordNonDiscriminatedUnion2AsyncClient { + @Generated + private final SpreadRecordNonDiscriminatedUnion2sImpl serviceClient; + + /** + * Initializes an instance of SpreadRecordNonDiscriminatedUnion2AsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadRecordNonDiscriminatedUnion2AsyncClient(SpreadRecordNonDiscriminatedUnion2sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SpreadRecordForNonDiscriminatedUnion2.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(SpreadRecordForNonDiscriminatedUnion2 body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2Client.java new file mode 100644 index 00000000000..7be6f856bc9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2Client.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.SpreadRecordNonDiscriminatedUnion2sImpl; +import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion2; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class SpreadRecordNonDiscriminatedUnion2Client { + @Generated + private final SpreadRecordNonDiscriminatedUnion2sImpl serviceClient; + + /** + * Initializes an instance of SpreadRecordNonDiscriminatedUnion2Client class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadRecordNonDiscriminatedUnion2Client(SpreadRecordNonDiscriminatedUnion2sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SpreadRecordForNonDiscriminatedUnion2 get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(SpreadRecordForNonDiscriminatedUnion2.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(SpreadRecordForNonDiscriminatedUnion2 body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3AsyncClient.java new file mode 100644 index 00000000000..555caaa910b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3AsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.SpreadRecordNonDiscriminatedUnion3sImpl; +import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion3; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class SpreadRecordNonDiscriminatedUnion3AsyncClient { + @Generated + private final SpreadRecordNonDiscriminatedUnion3sImpl serviceClient; + + /** + * Initializes an instance of SpreadRecordNonDiscriminatedUnion3AsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadRecordNonDiscriminatedUnion3AsyncClient(SpreadRecordNonDiscriminatedUnion3sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SpreadRecordForNonDiscriminatedUnion3.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(SpreadRecordForNonDiscriminatedUnion3 body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3Client.java new file mode 100644 index 00000000000..ca1dc2ada9b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3Client.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.SpreadRecordNonDiscriminatedUnion3sImpl; +import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion3; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class SpreadRecordNonDiscriminatedUnion3Client { + @Generated + private final SpreadRecordNonDiscriminatedUnion3sImpl serviceClient; + + /** + * Initializes an instance of SpreadRecordNonDiscriminatedUnion3Client class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadRecordNonDiscriminatedUnion3Client(SpreadRecordNonDiscriminatedUnion3sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SpreadRecordForNonDiscriminatedUnion3 get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(SpreadRecordForNonDiscriminatedUnion3.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(SpreadRecordForNonDiscriminatedUnion3 body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionAsyncClient.java new file mode 100644 index 00000000000..a041cdf3173 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.SpreadRecordNonDiscriminatedUnionsImpl; +import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class SpreadRecordNonDiscriminatedUnionAsyncClient { + @Generated + private final SpreadRecordNonDiscriminatedUnionsImpl serviceClient; + + /** + * Initializes an instance of SpreadRecordNonDiscriminatedUnionAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadRecordNonDiscriminatedUnionAsyncClient(SpreadRecordNonDiscriminatedUnionsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SpreadRecordForNonDiscriminatedUnion.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(SpreadRecordForNonDiscriminatedUnion body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionClient.java new file mode 100644 index 00000000000..a283725fc7d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.SpreadRecordNonDiscriminatedUnionsImpl; +import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class SpreadRecordNonDiscriminatedUnionClient { + @Generated + private final SpreadRecordNonDiscriminatedUnionsImpl serviceClient; + + /** + * Initializes an instance of SpreadRecordNonDiscriminatedUnionClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadRecordNonDiscriminatedUnionClient(SpreadRecordNonDiscriminatedUnionsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SpreadRecordForNonDiscriminatedUnion get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(SpreadRecordForNonDiscriminatedUnion.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(SpreadRecordForNonDiscriminatedUnion body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionAsyncClient.java new file mode 100644 index 00000000000..8b4780502e3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.SpreadRecordUnionsImpl; +import type.property.additionalproperties.models.SpreadRecordForUnion; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class SpreadRecordUnionAsyncClient { + @Generated + private final SpreadRecordUnionsImpl serviceClient; + + /** + * Initializes an instance of SpreadRecordUnionAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadRecordUnionAsyncClient(SpreadRecordUnionsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SpreadRecordForUnion.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(SpreadRecordForUnion body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionClient.java new file mode 100644 index 00000000000..afa33897247 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadRecordUnionClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.SpreadRecordUnionsImpl; +import type.property.additionalproperties.models.SpreadRecordForUnion; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class SpreadRecordUnionClient { + @Generated + private final SpreadRecordUnionsImpl serviceClient; + + /** + * Initializes an instance of SpreadRecordUnionClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadRecordUnionClient(SpreadRecordUnionsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SpreadRecordForUnion get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(SpreadRecordForUnion.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(SpreadRecordForUnion body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringAsyncClient.java new file mode 100644 index 00000000000..e19da973725 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringAsyncClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.additionalproperties.implementation.SpreadStringsImpl; +import type.property.additionalproperties.models.SpreadStringRecord; + +/** + * Initializes a new instance of the asynchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class, isAsync = true) +public final class SpreadStringAsyncClient { + @Generated + private final SpreadStringsImpl serviceClient; + + /** + * Initializes an instance of SpreadStringAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadStringAsyncClient(SpreadStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(SpreadStringRecord.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(SpreadStringRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringClient.java new file mode 100644 index 00000000000..533db341f90 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/SpreadStringClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.additionalproperties.implementation.SpreadStringsImpl; +import type.property.additionalproperties.models.SpreadStringRecord; + +/** + * Initializes a new instance of the synchronous AdditionalPropertiesClient type. + */ +@ServiceClient(builder = AdditionalPropertiesClientBuilder.class) +public final class SpreadStringClient { + @Generated + private final SpreadStringsImpl serviceClient; + + /** + * Initializes an instance of SpreadStringClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + SpreadStringClient(SpreadStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public SpreadStringRecord get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(SpreadStringRecord.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(SpreadStringRecord body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java new file mode 100644 index 00000000000..21a6a3dfe1c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java @@ -0,0 +1,558 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 AdditionalPropertiesClient type. + */ +public final class AdditionalPropertiesClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 ExtendsUnknownsImpl object to access its operations. + */ + private final ExtendsUnknownsImpl extendsUnknowns; + + /** + * Gets the ExtendsUnknownsImpl object to access its operations. + * + * @return the ExtendsUnknownsImpl object. + */ + public ExtendsUnknownsImpl getExtendsUnknowns() { + return this.extendsUnknowns; + } + + /** + * The ExtendsUnknownDerivedsImpl object to access its operations. + */ + private final ExtendsUnknownDerivedsImpl extendsUnknownDeriveds; + + /** + * Gets the ExtendsUnknownDerivedsImpl object to access its operations. + * + * @return the ExtendsUnknownDerivedsImpl object. + */ + public ExtendsUnknownDerivedsImpl getExtendsUnknownDeriveds() { + return this.extendsUnknownDeriveds; + } + + /** + * The ExtendsUnknownDiscriminatedsImpl object to access its operations. + */ + private final ExtendsUnknownDiscriminatedsImpl extendsUnknownDiscriminateds; + + /** + * Gets the ExtendsUnknownDiscriminatedsImpl object to access its operations. + * + * @return the ExtendsUnknownDiscriminatedsImpl object. + */ + public ExtendsUnknownDiscriminatedsImpl getExtendsUnknownDiscriminateds() { + return this.extendsUnknownDiscriminateds; + } + + /** + * The IsUnknownsImpl object to access its operations. + */ + private final IsUnknownsImpl isUnknowns; + + /** + * Gets the IsUnknownsImpl object to access its operations. + * + * @return the IsUnknownsImpl object. + */ + public IsUnknownsImpl getIsUnknowns() { + return this.isUnknowns; + } + + /** + * The IsUnknownDerivedsImpl object to access its operations. + */ + private final IsUnknownDerivedsImpl isUnknownDeriveds; + + /** + * Gets the IsUnknownDerivedsImpl object to access its operations. + * + * @return the IsUnknownDerivedsImpl object. + */ + public IsUnknownDerivedsImpl getIsUnknownDeriveds() { + return this.isUnknownDeriveds; + } + + /** + * The IsUnknownDiscriminatedsImpl object to access its operations. + */ + private final IsUnknownDiscriminatedsImpl isUnknownDiscriminateds; + + /** + * Gets the IsUnknownDiscriminatedsImpl object to access its operations. + * + * @return the IsUnknownDiscriminatedsImpl object. + */ + public IsUnknownDiscriminatedsImpl getIsUnknownDiscriminateds() { + return this.isUnknownDiscriminateds; + } + + /** + * The ExtendsStringsImpl object to access its operations. + */ + private final ExtendsStringsImpl extendsStrings; + + /** + * Gets the ExtendsStringsImpl object to access its operations. + * + * @return the ExtendsStringsImpl object. + */ + public ExtendsStringsImpl getExtendsStrings() { + return this.extendsStrings; + } + + /** + * The IsStringsImpl object to access its operations. + */ + private final IsStringsImpl isStrings; + + /** + * Gets the IsStringsImpl object to access its operations. + * + * @return the IsStringsImpl object. + */ + public IsStringsImpl getIsStrings() { + return this.isStrings; + } + + /** + * The SpreadStringsImpl object to access its operations. + */ + private final SpreadStringsImpl spreadStrings; + + /** + * Gets the SpreadStringsImpl object to access its operations. + * + * @return the SpreadStringsImpl object. + */ + public SpreadStringsImpl getSpreadStrings() { + return this.spreadStrings; + } + + /** + * The ExtendsFloatsImpl object to access its operations. + */ + private final ExtendsFloatsImpl extendsFloats; + + /** + * Gets the ExtendsFloatsImpl object to access its operations. + * + * @return the ExtendsFloatsImpl object. + */ + public ExtendsFloatsImpl getExtendsFloats() { + return this.extendsFloats; + } + + /** + * The IsFloatsImpl object to access its operations. + */ + private final IsFloatsImpl isFloats; + + /** + * Gets the IsFloatsImpl object to access its operations. + * + * @return the IsFloatsImpl object. + */ + public IsFloatsImpl getIsFloats() { + return this.isFloats; + } + + /** + * The SpreadFloatsImpl object to access its operations. + */ + private final SpreadFloatsImpl spreadFloats; + + /** + * Gets the SpreadFloatsImpl object to access its operations. + * + * @return the SpreadFloatsImpl object. + */ + public SpreadFloatsImpl getSpreadFloats() { + return this.spreadFloats; + } + + /** + * The ExtendsModelsImpl object to access its operations. + */ + private final ExtendsModelsImpl extendsModels; + + /** + * Gets the ExtendsModelsImpl object to access its operations. + * + * @return the ExtendsModelsImpl object. + */ + public ExtendsModelsImpl getExtendsModels() { + return this.extendsModels; + } + + /** + * The IsModelsImpl object to access its operations. + */ + private final IsModelsImpl isModels; + + /** + * Gets the IsModelsImpl object to access its operations. + * + * @return the IsModelsImpl object. + */ + public IsModelsImpl getIsModels() { + return this.isModels; + } + + /** + * The SpreadModelsImpl object to access its operations. + */ + private final SpreadModelsImpl spreadModels; + + /** + * Gets the SpreadModelsImpl object to access its operations. + * + * @return the SpreadModelsImpl object. + */ + public SpreadModelsImpl getSpreadModels() { + return this.spreadModels; + } + + /** + * The ExtendsModelArraysImpl object to access its operations. + */ + private final ExtendsModelArraysImpl extendsModelArrays; + + /** + * Gets the ExtendsModelArraysImpl object to access its operations. + * + * @return the ExtendsModelArraysImpl object. + */ + public ExtendsModelArraysImpl getExtendsModelArrays() { + return this.extendsModelArrays; + } + + /** + * The IsModelArraysImpl object to access its operations. + */ + private final IsModelArraysImpl isModelArrays; + + /** + * Gets the IsModelArraysImpl object to access its operations. + * + * @return the IsModelArraysImpl object. + */ + public IsModelArraysImpl getIsModelArrays() { + return this.isModelArrays; + } + + /** + * The SpreadModelArraysImpl object to access its operations. + */ + private final SpreadModelArraysImpl spreadModelArrays; + + /** + * Gets the SpreadModelArraysImpl object to access its operations. + * + * @return the SpreadModelArraysImpl object. + */ + public SpreadModelArraysImpl getSpreadModelArrays() { + return this.spreadModelArrays; + } + + /** + * The SpreadDifferentStringsImpl object to access its operations. + */ + private final SpreadDifferentStringsImpl spreadDifferentStrings; + + /** + * Gets the SpreadDifferentStringsImpl object to access its operations. + * + * @return the SpreadDifferentStringsImpl object. + */ + public SpreadDifferentStringsImpl getSpreadDifferentStrings() { + return this.spreadDifferentStrings; + } + + /** + * The SpreadDifferentFloatsImpl object to access its operations. + */ + private final SpreadDifferentFloatsImpl spreadDifferentFloats; + + /** + * Gets the SpreadDifferentFloatsImpl object to access its operations. + * + * @return the SpreadDifferentFloatsImpl object. + */ + public SpreadDifferentFloatsImpl getSpreadDifferentFloats() { + return this.spreadDifferentFloats; + } + + /** + * The SpreadDifferentModelsImpl object to access its operations. + */ + private final SpreadDifferentModelsImpl spreadDifferentModels; + + /** + * Gets the SpreadDifferentModelsImpl object to access its operations. + * + * @return the SpreadDifferentModelsImpl object. + */ + public SpreadDifferentModelsImpl getSpreadDifferentModels() { + return this.spreadDifferentModels; + } + + /** + * The SpreadDifferentModelArraysImpl object to access its operations. + */ + private final SpreadDifferentModelArraysImpl spreadDifferentModelArrays; + + /** + * Gets the SpreadDifferentModelArraysImpl object to access its operations. + * + * @return the SpreadDifferentModelArraysImpl object. + */ + public SpreadDifferentModelArraysImpl getSpreadDifferentModelArrays() { + return this.spreadDifferentModelArrays; + } + + /** + * The ExtendsDifferentSpreadStringsImpl object to access its operations. + */ + private final ExtendsDifferentSpreadStringsImpl extendsDifferentSpreadStrings; + + /** + * Gets the ExtendsDifferentSpreadStringsImpl object to access its operations. + * + * @return the ExtendsDifferentSpreadStringsImpl object. + */ + public ExtendsDifferentSpreadStringsImpl getExtendsDifferentSpreadStrings() { + return this.extendsDifferentSpreadStrings; + } + + /** + * The ExtendsDifferentSpreadFloatsImpl object to access its operations. + */ + private final ExtendsDifferentSpreadFloatsImpl extendsDifferentSpreadFloats; + + /** + * Gets the ExtendsDifferentSpreadFloatsImpl object to access its operations. + * + * @return the ExtendsDifferentSpreadFloatsImpl object. + */ + public ExtendsDifferentSpreadFloatsImpl getExtendsDifferentSpreadFloats() { + return this.extendsDifferentSpreadFloats; + } + + /** + * The ExtendsDifferentSpreadModelsImpl object to access its operations. + */ + private final ExtendsDifferentSpreadModelsImpl extendsDifferentSpreadModels; + + /** + * Gets the ExtendsDifferentSpreadModelsImpl object to access its operations. + * + * @return the ExtendsDifferentSpreadModelsImpl object. + */ + public ExtendsDifferentSpreadModelsImpl getExtendsDifferentSpreadModels() { + return this.extendsDifferentSpreadModels; + } + + /** + * The ExtendsDifferentSpreadModelArraysImpl object to access its operations. + */ + private final ExtendsDifferentSpreadModelArraysImpl extendsDifferentSpreadModelArrays; + + /** + * Gets the ExtendsDifferentSpreadModelArraysImpl object to access its operations. + * + * @return the ExtendsDifferentSpreadModelArraysImpl object. + */ + public ExtendsDifferentSpreadModelArraysImpl getExtendsDifferentSpreadModelArrays() { + return this.extendsDifferentSpreadModelArrays; + } + + /** + * The MultipleSpreadsImpl object to access its operations. + */ + private final MultipleSpreadsImpl multipleSpreads; + + /** + * Gets the MultipleSpreadsImpl object to access its operations. + * + * @return the MultipleSpreadsImpl object. + */ + public MultipleSpreadsImpl getMultipleSpreads() { + return this.multipleSpreads; + } + + /** + * The SpreadRecordUnionsImpl object to access its operations. + */ + private final SpreadRecordUnionsImpl spreadRecordUnions; + + /** + * Gets the SpreadRecordUnionsImpl object to access its operations. + * + * @return the SpreadRecordUnionsImpl object. + */ + public SpreadRecordUnionsImpl getSpreadRecordUnions() { + return this.spreadRecordUnions; + } + + /** + * The SpreadRecordNonDiscriminatedUnionsImpl object to access its operations. + */ + private final SpreadRecordNonDiscriminatedUnionsImpl spreadRecordNonDiscriminatedUnions; + + /** + * Gets the SpreadRecordNonDiscriminatedUnionsImpl object to access its operations. + * + * @return the SpreadRecordNonDiscriminatedUnionsImpl object. + */ + public SpreadRecordNonDiscriminatedUnionsImpl getSpreadRecordNonDiscriminatedUnions() { + return this.spreadRecordNonDiscriminatedUnions; + } + + /** + * The SpreadRecordNonDiscriminatedUnion2sImpl object to access its operations. + */ + private final SpreadRecordNonDiscriminatedUnion2sImpl spreadRecordNonDiscriminatedUnion2s; + + /** + * Gets the SpreadRecordNonDiscriminatedUnion2sImpl object to access its operations. + * + * @return the SpreadRecordNonDiscriminatedUnion2sImpl object. + */ + public SpreadRecordNonDiscriminatedUnion2sImpl getSpreadRecordNonDiscriminatedUnion2s() { + return this.spreadRecordNonDiscriminatedUnion2s; + } + + /** + * The SpreadRecordNonDiscriminatedUnion3sImpl object to access its operations. + */ + private final SpreadRecordNonDiscriminatedUnion3sImpl spreadRecordNonDiscriminatedUnion3s; + + /** + * Gets the SpreadRecordNonDiscriminatedUnion3sImpl object to access its operations. + * + * @return the SpreadRecordNonDiscriminatedUnion3sImpl object. + */ + public SpreadRecordNonDiscriminatedUnion3sImpl getSpreadRecordNonDiscriminatedUnion3s() { + return this.spreadRecordNonDiscriminatedUnion3s; + } + + /** + * Initializes an instance of AdditionalPropertiesClient client. + * + * @param endpoint Service host. + */ + public AdditionalPropertiesClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of AdditionalPropertiesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public AdditionalPropertiesClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of AdditionalPropertiesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public AdditionalPropertiesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.extendsUnknowns = new ExtendsUnknownsImpl(this); + this.extendsUnknownDeriveds = new ExtendsUnknownDerivedsImpl(this); + this.extendsUnknownDiscriminateds = new ExtendsUnknownDiscriminatedsImpl(this); + this.isUnknowns = new IsUnknownsImpl(this); + this.isUnknownDeriveds = new IsUnknownDerivedsImpl(this); + this.isUnknownDiscriminateds = new IsUnknownDiscriminatedsImpl(this); + this.extendsStrings = new ExtendsStringsImpl(this); + this.isStrings = new IsStringsImpl(this); + this.spreadStrings = new SpreadStringsImpl(this); + this.extendsFloats = new ExtendsFloatsImpl(this); + this.isFloats = new IsFloatsImpl(this); + this.spreadFloats = new SpreadFloatsImpl(this); + this.extendsModels = new ExtendsModelsImpl(this); + this.isModels = new IsModelsImpl(this); + this.spreadModels = new SpreadModelsImpl(this); + this.extendsModelArrays = new ExtendsModelArraysImpl(this); + this.isModelArrays = new IsModelArraysImpl(this); + this.spreadModelArrays = new SpreadModelArraysImpl(this); + this.spreadDifferentStrings = new SpreadDifferentStringsImpl(this); + this.spreadDifferentFloats = new SpreadDifferentFloatsImpl(this); + this.spreadDifferentModels = new SpreadDifferentModelsImpl(this); + this.spreadDifferentModelArrays = new SpreadDifferentModelArraysImpl(this); + this.extendsDifferentSpreadStrings = new ExtendsDifferentSpreadStringsImpl(this); + this.extendsDifferentSpreadFloats = new ExtendsDifferentSpreadFloatsImpl(this); + this.extendsDifferentSpreadModels = new ExtendsDifferentSpreadModelsImpl(this); + this.extendsDifferentSpreadModelArrays = new ExtendsDifferentSpreadModelArraysImpl(this); + this.multipleSpreads = new MultipleSpreadsImpl(this); + this.spreadRecordUnions = new SpreadRecordUnionsImpl(this); + this.spreadRecordNonDiscriminatedUnions = new SpreadRecordNonDiscriminatedUnionsImpl(this); + this.spreadRecordNonDiscriminatedUnion2s = new SpreadRecordNonDiscriminatedUnion2sImpl(this); + this.spreadRecordNonDiscriminatedUnion3s = new SpreadRecordNonDiscriminatedUnion3sImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadFloatsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadFloatsImpl.java new file mode 100644 index 00000000000..1024ee8e1c4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadFloatsImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendsDifferentSpreadFloats. + */ +public final class ExtendsDifferentSpreadFloatsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExtendsDifferentSpreadFloatsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of ExtendsDifferentSpreadFloatsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendsDifferentSpreadFloatsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(ExtendsDifferentSpreadFloatsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientExtendsDifferentSpreadFloats to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientExtendsDifferentSpreadFloats") + public interface ExtendsDifferentSpreadFloatsService { + @Get("/type/property/additionalProperties/extendsDifferentSpreadFloat") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/extendsDifferentSpreadFloat") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsDifferentSpreadFloat") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsDifferentSpreadFloat") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     *     derivedProp: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     *     derivedProp: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     *     derivedProp: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     *     derivedProp: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelArraysImpl.java new file mode 100644 index 00000000000..0114848d3c2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelArraysImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendsDifferentSpreadModelArrays. + */ +public final class ExtendsDifferentSpreadModelArraysImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExtendsDifferentSpreadModelArraysService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of ExtendsDifferentSpreadModelArraysImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendsDifferentSpreadModelArraysImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(ExtendsDifferentSpreadModelArraysService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientExtendsDifferentSpreadModelArrays to be + * used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientExtendsDifferentSpreadModelArrays") + public interface ExtendsDifferentSpreadModelArraysService { + @Get("/type/property/additionalProperties/extendsDifferentSpreadModelArray") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/extendsDifferentSpreadModelArray") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsDifferentSpreadModelArray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsDifferentSpreadModelArray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     *     derivedProp (Required): [
+     *         (recursive schema, see above)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     *     derivedProp (Required): [
+     *         (recursive schema, see above)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     *     derivedProp (Required): [
+     *         (recursive schema, see above)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     *     derivedProp (Required): [
+     *         (recursive schema, see above)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelsImpl.java new file mode 100644 index 00000000000..4789cfa39c6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelsImpl.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendsDifferentSpreadModels. + */ +public final class ExtendsDifferentSpreadModelsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExtendsDifferentSpreadModelsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of ExtendsDifferentSpreadModelsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendsDifferentSpreadModelsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(ExtendsDifferentSpreadModelsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientExtendsDifferentSpreadModels to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientExtendsDifferentSpreadModels") + public interface ExtendsDifferentSpreadModelsService { + @Get("/type/property/additionalProperties/extendsDifferentSpreadModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/extendsDifferentSpreadModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsDifferentSpreadModel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsDifferentSpreadModel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     *     derivedProp (Required): (recursive schema, see derivedProp above)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     *     derivedProp (Required): (recursive schema, see derivedProp above)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     *     derivedProp (Required): (recursive schema, see derivedProp above)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     *     derivedProp (Required): (recursive schema, see derivedProp above)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadStringsImpl.java new file mode 100644 index 00000000000..0ec1959ce55 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadStringsImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendsDifferentSpreadStrings. + */ +public final class ExtendsDifferentSpreadStringsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExtendsDifferentSpreadStringsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of ExtendsDifferentSpreadStringsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendsDifferentSpreadStringsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(ExtendsDifferentSpreadStringsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientExtendsDifferentSpreadStrings to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientExtendsDifferentSpreadStrings") + public interface ExtendsDifferentSpreadStringsService { + @Get("/type/property/additionalProperties/extendsDifferentSpreadString") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/extendsDifferentSpreadString") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsDifferentSpreadString") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsDifferentSpreadString") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     *     derivedProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     *     derivedProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     *     derivedProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     *     derivedProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsFloatsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsFloatsImpl.java new file mode 100644 index 00000000000..c5a7983168f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsFloatsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendsFloats. + */ +public final class ExtendsFloatsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExtendsFloatsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of ExtendsFloatsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendsFloatsImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(ExtendsFloatsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientExtendsFloats to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientExtendsFloats") + public interface ExtendsFloatsService { + @Get("/type/property/additionalProperties/extendsRecordFloat") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/extendsRecordFloat") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsRecordFloat") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsRecordFloat") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelArraysImpl.java new file mode 100644 index 00000000000..411548a28a7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelArraysImpl.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendsModelArrays. + */ +public final class ExtendsModelArraysImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExtendsModelArraysService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of ExtendsModelArraysImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendsModelArraysImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(ExtendsModelArraysService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientExtendsModelArrays to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientExtendsModelArrays") + public interface ExtendsModelArraysService { + @Get("/type/property/additionalProperties/extendsRecordModelArray") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/extendsRecordModelArray") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsRecordModelArray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsRecordModelArray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelsImpl.java new file mode 100644 index 00000000000..e1ee4666c67 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsModelsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendsModels. + */ +public final class ExtendsModelsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExtendsModelsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of ExtendsModelsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendsModelsImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(ExtendsModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientExtendsModels to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientExtendsModels") + public interface ExtendsModelsService { + @Get("/type/property/additionalProperties/extendsRecordModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/extendsRecordModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsRecordModel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsRecordModel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsStringsImpl.java new file mode 100644 index 00000000000..fd660642c33 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsStringsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendsStrings. + */ +public final class ExtendsStringsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExtendsStringsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of ExtendsStringsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendsStringsImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(ExtendsStringsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientExtendsStrings to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientExtendsStrings") + public interface ExtendsStringsService { + @Get("/type/property/additionalProperties/extendsRecordString") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/extendsRecordString") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsRecordString") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsRecordString") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDerivedsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDerivedsImpl.java new file mode 100644 index 00000000000..d4216469d0d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDerivedsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendsUnknownDeriveds. + */ +public final class ExtendsUnknownDerivedsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExtendsUnknownDerivedsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of ExtendsUnknownDerivedsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendsUnknownDerivedsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(ExtendsUnknownDerivedsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientExtendsUnknownDeriveds to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientExtendsUnknownDeriveds") + public interface ExtendsUnknownDerivedsService { + @Get("/type/property/additionalProperties/extendsRecordUnknownDerived") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/extendsRecordUnknownDerived") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsRecordUnknownDerived") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsRecordUnknownDerived") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDiscriminatedsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDiscriminatedsImpl.java new file mode 100644 index 00000000000..e3aa5ddeb70 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDiscriminatedsImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendsUnknownDiscriminateds. + */ +public final class ExtendsUnknownDiscriminatedsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExtendsUnknownDiscriminatedsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of ExtendsUnknownDiscriminatedsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendsUnknownDiscriminatedsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(ExtendsUnknownDiscriminatedsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientExtendsUnknownDiscriminateds to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientExtendsUnknownDiscriminateds") + public interface ExtendsUnknownDiscriminatedsService { + @Get("/type/property/additionalProperties/extendsUnknownDiscriminated") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/extendsUnknownDiscriminated") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsUnknownDiscriminated") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsUnknownDiscriminated") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownsImpl.java new file mode 100644 index 00000000000..9ee415d04e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendsUnknowns. + */ +public final class ExtendsUnknownsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExtendsUnknownsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of ExtendsUnknownsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendsUnknownsImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(ExtendsUnknownsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientExtendsUnknowns to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientExtendsUnknowns") + public interface ExtendsUnknownsService { + @Get("/type/property/additionalProperties/extendsRecordUnknown") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/extendsRecordUnknown") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsRecordUnknown") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/extendsRecordUnknown") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsFloatsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsFloatsImpl.java new file mode 100644 index 00000000000..0871bc5dfa0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsFloatsImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in IsFloats. + */ +public final class IsFloatsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final IsFloatsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of IsFloatsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IsFloatsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(IsFloatsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientIsFloats to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientIsFloats") + public interface IsFloatsService { + @Get("/type/property/additionalProperties/isRecordFloat") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/isRecordFloat") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isRecordFloat") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isRecordFloat") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelArraysImpl.java new file mode 100644 index 00000000000..66061612f1f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelArraysImpl.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in IsModelArrays. + */ +public final class IsModelArraysImpl { + /** + * The proxy service used to perform REST calls. + */ + private final IsModelArraysService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of IsModelArraysImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IsModelArraysImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(IsModelArraysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientIsModelArrays to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientIsModelArrays") + public interface IsModelArraysService { + @Get("/type/property/additionalProperties/isRecordModelArray") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/isRecordModelArray") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isRecordModelArray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isRecordModelArray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelsImpl.java new file mode 100644 index 00000000000..28fa32a18b8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsModelsImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in IsModels. + */ +public final class IsModelsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final IsModelsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of IsModelsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IsModelsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(IsModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientIsModels to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientIsModels") + public interface IsModelsService { + @Get("/type/property/additionalProperties/isRecordModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/isRecordModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isRecordModel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isRecordModel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsStringsImpl.java new file mode 100644 index 00000000000..94a84b25b90 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsStringsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in IsStrings. + */ +public final class IsStringsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final IsStringsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of IsStringsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IsStringsImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(IsStringsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientIsStrings to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientIsStrings") + public interface IsStringsService { + @Get("/type/property/additionalProperties/isRecordstring") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/isRecordstring") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isRecordstring") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isRecordstring") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDerivedsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDerivedsImpl.java new file mode 100644 index 00000000000..718d5c55c9e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDerivedsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in IsUnknownDeriveds. + */ +public final class IsUnknownDerivedsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final IsUnknownDerivedsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of IsUnknownDerivedsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IsUnknownDerivedsImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(IsUnknownDerivedsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientIsUnknownDeriveds to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientIsUnknownDeriveds") + public interface IsUnknownDerivedsService { + @Get("/type/property/additionalProperties/isRecordUnknownDerived") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/isRecordUnknownDerived") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isRecordUnknownDerived") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isRecordUnknownDerived") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     index: int (Required)
+     *     age: Double (Optional)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDiscriminatedsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDiscriminatedsImpl.java new file mode 100644 index 00000000000..2d6fcdd3ab4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownDiscriminatedsImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in IsUnknownDiscriminateds. + */ +public final class IsUnknownDiscriminatedsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final IsUnknownDiscriminatedsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of IsUnknownDiscriminatedsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IsUnknownDiscriminatedsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(IsUnknownDiscriminatedsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientIsUnknownDiscriminateds to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientIsUnknownDiscriminateds") + public interface IsUnknownDiscriminatedsService { + @Get("/type/property/additionalProperties/isUnknownDiscriminated") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/isUnknownDiscriminated") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isUnknownDiscriminated") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isUnknownDiscriminated") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     kind: String (Required)
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownsImpl.java new file mode 100644 index 00000000000..777b6f85b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/IsUnknownsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in IsUnknowns. + */ +public final class IsUnknownsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final IsUnknownsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of IsUnknownsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IsUnknownsImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(IsUnknownsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientIsUnknowns to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientIsUnknowns") + public interface IsUnknownsService { + @Get("/type/property/additionalProperties/isRecordUnknown") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/isRecordUnknown") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isRecordUnknown") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/isRecordUnknown") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/MultipleSpreadsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/MultipleSpreadsImpl.java new file mode 100644 index 00000000000..2b3b38386ab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/MultipleSpreadsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MultipleSpreads. + */ +public final class MultipleSpreadsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MultipleSpreadsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of MultipleSpreadsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MultipleSpreadsImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(MultipleSpreadsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientMultipleSpreads to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientMultipleSpreads") + public interface MultipleSpreadsService { + @Get("/type/property/additionalProperties/multipleSpreadRecord") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/multipleSpreadRecord") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/multipleSpreadRecord") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/multipleSpreadRecord") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentFloatsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentFloatsImpl.java new file mode 100644 index 00000000000..6e9577eb7a4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentFloatsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SpreadDifferentFloats. + */ +public final class SpreadDifferentFloatsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SpreadDifferentFloatsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of SpreadDifferentFloatsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpreadDifferentFloatsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(SpreadDifferentFloatsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientSpreadDifferentFloats to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientSpreadDifferentFloats") + public interface SpreadDifferentFloatsService { + @Get("/type/property/additionalProperties/spreadDifferentRecordFloat") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/spreadDifferentRecordFloat") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadDifferentRecordFloat") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadDifferentRecordFloat") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelArraysImpl.java new file mode 100644 index 00000000000..3c7e9f60d7b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelArraysImpl.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SpreadDifferentModelArrays. + */ +public final class SpreadDifferentModelArraysImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SpreadDifferentModelArraysService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of SpreadDifferentModelArraysImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpreadDifferentModelArraysImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(SpreadDifferentModelArraysService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientSpreadDifferentModelArrays to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientSpreadDifferentModelArrays") + public interface SpreadDifferentModelArraysService { + @Get("/type/property/additionalProperties/spreadDifferentRecordModelArray") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/spreadDifferentRecordModelArray") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadDifferentRecordModelArray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadDifferentRecordModelArray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): [
+     *              (Required){
+     *                 state: String (Required)
+     *             }
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelsImpl.java new file mode 100644 index 00000000000..ceb56449722 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SpreadDifferentModels. + */ +public final class SpreadDifferentModelsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SpreadDifferentModelsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of SpreadDifferentModelsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpreadDifferentModelsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(SpreadDifferentModelsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientSpreadDifferentModels to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientSpreadDifferentModels") + public interface SpreadDifferentModelsService { + @Get("/type/property/additionalProperties/spreadDifferentRecordModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/spreadDifferentRecordModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadDifferentRecordModel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadDifferentRecordModel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp: String (Required)
+     *      (Optional): {
+     *         String (Required): {
+     *             state: String (Required)
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentStringsImpl.java new file mode 100644 index 00000000000..b7251b0ec51 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadDifferentStringsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SpreadDifferentStrings. + */ +public final class SpreadDifferentStringsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SpreadDifferentStringsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of SpreadDifferentStringsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpreadDifferentStringsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(SpreadDifferentStringsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientSpreadDifferentStrings to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientSpreadDifferentStrings") + public interface SpreadDifferentStringsService { + @Get("/type/property/additionalProperties/spreadDifferentRecordString") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/spreadDifferentRecordString") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadDifferentRecordString") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadDifferentRecordString") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadFloatsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadFloatsImpl.java new file mode 100644 index 00000000000..c52678eddef --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadFloatsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SpreadFloats. + */ +public final class SpreadFloatsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SpreadFloatsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of SpreadFloatsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpreadFloatsImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(SpreadFloatsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientSpreadFloats to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientSpreadFloats") + public interface SpreadFloatsService { + @Get("/type/property/additionalProperties/spreadRecordFloat") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/spreadRecordFloat") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordFloat") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordFloat") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: double (Required)
+     *      (Optional): {
+     *         String: double (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelArraysImpl.java new file mode 100644 index 00000000000..db75da471d2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelArraysImpl.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SpreadModelArrays. + */ +public final class SpreadModelArraysImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SpreadModelArraysService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of SpreadModelArraysImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpreadModelArraysImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(SpreadModelArraysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientSpreadModelArrays to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientSpreadModelArrays") + public interface SpreadModelArraysService { + @Get("/type/property/additionalProperties/spreadRecordModelArray") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/spreadRecordModelArray") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordModelArray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordModelArray") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): [
+     *          (Required){
+     *             state: String (Required)
+     *         }
+     *     ]
+     *      (Optional): {
+     *         String (Required): [
+     *             (recursive schema, see above)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelsImpl.java new file mode 100644 index 00000000000..fa05c3377ff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadModelsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SpreadModels. + */ +public final class SpreadModelsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SpreadModelsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of SpreadModelsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpreadModelsImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(SpreadModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientSpreadModels to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientSpreadModels") + public interface SpreadModelsService { + @Get("/type/property/additionalProperties/spreadRecordModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/spreadRecordModel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordModel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordModel") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     knownProp (Required): {
+     *         state: String (Required)
+     *     }
+     *      (Optional): {
+     *         String (Required): (recursive schema, see String above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion2sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion2sImpl.java new file mode 100644 index 00000000000..fa590c42d18 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion2sImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SpreadRecordNonDiscriminatedUnion2s. + */ +public final class SpreadRecordNonDiscriminatedUnion2sImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SpreadRecordNonDiscriminatedUnion2sService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of SpreadRecordNonDiscriminatedUnion2sImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpreadRecordNonDiscriminatedUnion2sImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(SpreadRecordNonDiscriminatedUnion2sService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientSpreadRecordNonDiscriminatedUnion2s to be + * used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientSpreadRecordNonDiscriminatedUnion2s") + public interface SpreadRecordNonDiscriminatedUnion2sService { + @Get("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion2") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion3sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion3sImpl.java new file mode 100644 index 00000000000..362739a651c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion3sImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SpreadRecordNonDiscriminatedUnion3s. + */ +public final class SpreadRecordNonDiscriminatedUnion3sImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SpreadRecordNonDiscriminatedUnion3sService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of SpreadRecordNonDiscriminatedUnion3sImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpreadRecordNonDiscriminatedUnion3sImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(SpreadRecordNonDiscriminatedUnion3sService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientSpreadRecordNonDiscriminatedUnion3s to be + * used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientSpreadRecordNonDiscriminatedUnion3s") + public interface SpreadRecordNonDiscriminatedUnion3sService { + @Get("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion3") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnionsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnionsImpl.java new file mode 100644 index 00000000000..9676bf8054f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnionsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SpreadRecordNonDiscriminatedUnions. + */ +public final class SpreadRecordNonDiscriminatedUnionsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SpreadRecordNonDiscriminatedUnionsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of SpreadRecordNonDiscriminatedUnionsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpreadRecordNonDiscriminatedUnionsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(SpreadRecordNonDiscriminatedUnionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientSpreadRecordNonDiscriminatedUnions to be + * used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientSpreadRecordNonDiscriminatedUnions") + public interface SpreadRecordNonDiscriminatedUnionsService { + @Get("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordNonDiscriminatedUnion") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordUnionsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordUnionsImpl.java new file mode 100644 index 00000000000..fd7e9fe7bae --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadRecordUnionsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SpreadRecordUnions. + */ +public final class SpreadRecordUnionsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SpreadRecordUnionsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of SpreadRecordUnionsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpreadRecordUnionsImpl(AdditionalPropertiesClientImpl client) { + this.service = RestProxy.create(SpreadRecordUnionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientSpreadRecordUnions to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientSpreadRecordUnions") + public interface SpreadRecordUnionsService { + @Get("/type/property/additionalProperties/spreadRecordUnion") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/spreadRecordUnion") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordUnion") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordUnion") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     flag: boolean (Required)
+     *      (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadStringsImpl.java new file mode 100644 index 00000000000..93fe526ff58 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/SpreadStringsImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SpreadStrings. + */ +public final class SpreadStringsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final SpreadStringsService service; + + /** + * The service client containing this operation class. + */ + private final AdditionalPropertiesClientImpl client; + + /** + * Initializes an instance of SpreadStringsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SpreadStringsImpl(AdditionalPropertiesClientImpl client) { + this.service + = RestProxy.create(SpreadStringsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdditionalPropertiesClientSpreadStrings to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdditionalPropertiesClientSpreadStrings") + public interface SpreadStringsService { + @Get("/type/property/additionalProperties/spreadRecordString") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/additionalProperties/spreadRecordString") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordString") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/additionalProperties/spreadRecordString") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *      (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/package-info.java new file mode 100644 index 00000000000..f3d085db11e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for AdditionalProperties. + * Tests for additional properties of models. + * + */ +package type.property.additionalproperties.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatDerived.java new file mode 100644 index 00000000000..db688404ebe --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatDerived.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model extends from a model that spread Record<float32> with the different known property type. + */ +@Immutable +public final class DifferentSpreadFloatDerived extends DifferentSpreadFloatRecord { + /* + * The index property + */ + @Generated + private final double derivedProp; + + /** + * Creates an instance of DifferentSpreadFloatDerived class. + * + * @param name the name value to set. + * @param derivedProp the derivedProp value to set. + */ + @Generated + public DifferentSpreadFloatDerived(String name, double derivedProp) { + super(name); + this.derivedProp = derivedProp; + } + + /** + * Get the derivedProp property: The index property. + * + * @return the derivedProp value. + */ + @Generated + public double getDerivedProp() { + return this.derivedProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeDoubleField("derivedProp", this.derivedProp); + if (getAdditionalProperties() != null) { + for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DifferentSpreadFloatDerived from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DifferentSpreadFloatDerived if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DifferentSpreadFloatDerived. + */ + @Generated + public static DifferentSpreadFloatDerived fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + double derivedProp = 0.0; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("derivedProp".equals(fieldName)) { + derivedProp = reader.getDouble(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.getDouble()); + } + } + DifferentSpreadFloatDerived deserializedDifferentSpreadFloatDerived + = new DifferentSpreadFloatDerived(name, derivedProp); + deserializedDifferentSpreadFloatDerived.setAdditionalProperties(additionalProperties); + + return deserializedDifferentSpreadFloatDerived; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatRecord.java new file mode 100644 index 00000000000..402d6976998 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatRecord.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model spread Record<float32> with the different known property type. + */ +@Fluent +public class DifferentSpreadFloatRecord implements JsonSerializable { + /* + * The id property + */ + @Generated + private final String name; + + /* + * The model spread Record with the different known property type + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of DifferentSpreadFloatRecord class. + * + * @param name the name value to set. + */ + @Generated + public DifferentSpreadFloatRecord(String name) { + this.name = name; + } + + /** + * Get the name property: The id property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the additionalProperties property: The model spread Record<float32> with the different known property + * type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model spread Record<float32> with the different known property + * type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the DifferentSpreadFloatRecord object itself. + */ + @Generated + public DifferentSpreadFloatRecord setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DifferentSpreadFloatRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DifferentSpreadFloatRecord if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DifferentSpreadFloatRecord. + */ + @Generated + public static DifferentSpreadFloatRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.getDouble()); + } + } + DifferentSpreadFloatRecord deserializedDifferentSpreadFloatRecord = new DifferentSpreadFloatRecord(name); + deserializedDifferentSpreadFloatRecord.additionalProperties = additionalProperties; + + return deserializedDifferentSpreadFloatRecord; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayDerived.java new file mode 100644 index 00000000000..b386a8a5bfe --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayDerived.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * The model extends from a model that spread Record<ModelForRecord[]> with the different known property type. + */ +@Immutable +public final class DifferentSpreadModelArrayDerived extends DifferentSpreadModelArrayRecord { + /* + * The index property + */ + @Generated + private final List derivedProp; + + /** + * Creates an instance of DifferentSpreadModelArrayDerived class. + * + * @param knownProp the knownProp value to set. + * @param derivedProp the derivedProp value to set. + */ + @Generated + public DifferentSpreadModelArrayDerived(String knownProp, List derivedProp) { + super(knownProp); + this.derivedProp = derivedProp; + } + + /** + * Get the derivedProp property: The index property. + * + * @return the derivedProp value. + */ + @Generated + public List getDerivedProp() { + return this.derivedProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("knownProp", getKnownProp()); + jsonWriter.writeArrayField("derivedProp", this.derivedProp, (writer, element) -> writer.writeJson(element)); + if (getAdditionalProperties() != null) { + for (Map.Entry> additionalProperty : getAdditionalProperties().entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DifferentSpreadModelArrayDerived from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DifferentSpreadModelArrayDerived if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DifferentSpreadModelArrayDerived. + */ + @Generated + public static DifferentSpreadModelArrayDerived fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String knownProp = null; + List derivedProp = null; + Map> additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knownProp".equals(fieldName)) { + knownProp = reader.getString(); + } else if ("derivedProp".equals(fieldName)) { + derivedProp = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + List additionalPropertiesArrayItem + = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); + additionalProperties.put(fieldName, additionalPropertiesArrayItem); + } + } + DifferentSpreadModelArrayDerived deserializedDifferentSpreadModelArrayDerived + = new DifferentSpreadModelArrayDerived(knownProp, derivedProp); + deserializedDifferentSpreadModelArrayDerived.setAdditionalProperties(additionalProperties); + + return deserializedDifferentSpreadModelArrayDerived; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayRecord.java new file mode 100644 index 00000000000..22e5c5dad02 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayRecord.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * The model spread Record<ModelForRecord[]> with the different known property type. + */ +@Fluent +public class DifferentSpreadModelArrayRecord implements JsonSerializable { + /* + * The knownProp property. + */ + @Generated + private final String knownProp; + + /* + * The model spread Record with the different known property type + */ + @Generated + private Map> additionalProperties; + + /** + * Creates an instance of DifferentSpreadModelArrayRecord class. + * + * @param knownProp the knownProp value to set. + */ + @Generated + public DifferentSpreadModelArrayRecord(String knownProp) { + this.knownProp = knownProp; + } + + /** + * Get the knownProp property: The knownProp property. + * + * @return the knownProp value. + */ + @Generated + public String getKnownProp() { + return this.knownProp; + } + + /** + * Get the additionalProperties property: The model spread Record<ModelForRecord[]> with the different known + * property type. + * + * @return the additionalProperties value. + */ + @Generated + public Map> getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model spread Record<ModelForRecord[]> with the different known + * property type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the DifferentSpreadModelArrayRecord object itself. + */ + @Generated + public DifferentSpreadModelArrayRecord + setAdditionalProperties(Map> additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("knownProp", this.knownProp); + if (additionalProperties != null) { + for (Map.Entry> additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DifferentSpreadModelArrayRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DifferentSpreadModelArrayRecord if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DifferentSpreadModelArrayRecord. + */ + @Generated + public static DifferentSpreadModelArrayRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String knownProp = null; + Map> additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knownProp".equals(fieldName)) { + knownProp = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + List additionalPropertiesArrayItem + = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); + additionalProperties.put(fieldName, additionalPropertiesArrayItem); + } + } + DifferentSpreadModelArrayRecord deserializedDifferentSpreadModelArrayRecord + = new DifferentSpreadModelArrayRecord(knownProp); + deserializedDifferentSpreadModelArrayRecord.additionalProperties = additionalProperties; + + return deserializedDifferentSpreadModelArrayRecord; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelDerived.java new file mode 100644 index 00000000000..cd02e25f57a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelDerived.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model extends from a model that spread Record<ModelForRecord> with the different known property type. + */ +@Immutable +public final class DifferentSpreadModelDerived extends DifferentSpreadModelRecord { + /* + * The index property + */ + @Generated + private final ModelForRecord derivedProp; + + /** + * Creates an instance of DifferentSpreadModelDerived class. + * + * @param knownProp the knownProp value to set. + * @param derivedProp the derivedProp value to set. + */ + @Generated + public DifferentSpreadModelDerived(String knownProp, ModelForRecord derivedProp) { + super(knownProp); + this.derivedProp = derivedProp; + } + + /** + * Get the derivedProp property: The index property. + * + * @return the derivedProp value. + */ + @Generated + public ModelForRecord getDerivedProp() { + return this.derivedProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("knownProp", getKnownProp()); + jsonWriter.writeJsonField("derivedProp", this.derivedProp); + if (getAdditionalProperties() != null) { + for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DifferentSpreadModelDerived from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DifferentSpreadModelDerived if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DifferentSpreadModelDerived. + */ + @Generated + public static DifferentSpreadModelDerived fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String knownProp = null; + ModelForRecord derivedProp = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knownProp".equals(fieldName)) { + knownProp = reader.getString(); + } else if ("derivedProp".equals(fieldName)) { + derivedProp = ModelForRecord.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, ModelForRecord.fromJson(reader)); + } + } + DifferentSpreadModelDerived deserializedDifferentSpreadModelDerived + = new DifferentSpreadModelDerived(knownProp, derivedProp); + deserializedDifferentSpreadModelDerived.setAdditionalProperties(additionalProperties); + + return deserializedDifferentSpreadModelDerived; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelRecord.java new file mode 100644 index 00000000000..3eb6eaef208 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadModelRecord.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model spread Record<ModelForRecord> with the different known property type. + */ +@Fluent +public class DifferentSpreadModelRecord implements JsonSerializable { + /* + * The knownProp property. + */ + @Generated + private final String knownProp; + + /* + * The model spread Record with the different known property type + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of DifferentSpreadModelRecord class. + * + * @param knownProp the knownProp value to set. + */ + @Generated + public DifferentSpreadModelRecord(String knownProp) { + this.knownProp = knownProp; + } + + /** + * Get the knownProp property: The knownProp property. + * + * @return the knownProp value. + */ + @Generated + public String getKnownProp() { + return this.knownProp; + } + + /** + * Get the additionalProperties property: The model spread Record<ModelForRecord> with the different known + * property type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model spread Record<ModelForRecord> with the different known + * property type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the DifferentSpreadModelRecord object itself. + */ + @Generated + public DifferentSpreadModelRecord setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("knownProp", this.knownProp); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DifferentSpreadModelRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DifferentSpreadModelRecord if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DifferentSpreadModelRecord. + */ + @Generated + public static DifferentSpreadModelRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String knownProp = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knownProp".equals(fieldName)) { + knownProp = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, ModelForRecord.fromJson(reader)); + } + } + DifferentSpreadModelRecord deserializedDifferentSpreadModelRecord + = new DifferentSpreadModelRecord(knownProp); + deserializedDifferentSpreadModelRecord.additionalProperties = additionalProperties; + + return deserializedDifferentSpreadModelRecord; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringDerived.java new file mode 100644 index 00000000000..da8290c4857 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringDerived.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model extends from a model that spread Record<string> with the different known property type. + */ +@Immutable +public final class DifferentSpreadStringDerived extends DifferentSpreadStringRecord { + /* + * The index property + */ + @Generated + private final String derivedProp; + + /** + * Creates an instance of DifferentSpreadStringDerived class. + * + * @param id the id value to set. + * @param derivedProp the derivedProp value to set. + */ + @Generated + public DifferentSpreadStringDerived(double id, String derivedProp) { + super(id); + this.derivedProp = derivedProp; + } + + /** + * Get the derivedProp property: The index property. + * + * @return the derivedProp value. + */ + @Generated + public String getDerivedProp() { + return this.derivedProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("id", getId()); + jsonWriter.writeStringField("derivedProp", this.derivedProp); + if (getAdditionalProperties() != null) { + for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DifferentSpreadStringDerived from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DifferentSpreadStringDerived if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DifferentSpreadStringDerived. + */ + @Generated + public static DifferentSpreadStringDerived fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + double id = 0.0; + String derivedProp = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getDouble(); + } else if ("derivedProp".equals(fieldName)) { + derivedProp = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.getString()); + } + } + DifferentSpreadStringDerived deserializedDifferentSpreadStringDerived + = new DifferentSpreadStringDerived(id, derivedProp); + deserializedDifferentSpreadStringDerived.setAdditionalProperties(additionalProperties); + + return deserializedDifferentSpreadStringDerived; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringRecord.java new file mode 100644 index 00000000000..b65a6e91f4a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/DifferentSpreadStringRecord.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model spread Record<string> with the different known property type. + */ +@Fluent +public class DifferentSpreadStringRecord implements JsonSerializable { + /* + * The name property + */ + @Generated + private final double id; + + /* + * The model spread Record with the different known property type + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of DifferentSpreadStringRecord class. + * + * @param id the id value to set. + */ + @Generated + public DifferentSpreadStringRecord(double id) { + this.id = id; + } + + /** + * Get the id property: The name property. + * + * @return the id value. + */ + @Generated + public double getId() { + return this.id; + } + + /** + * Get the additionalProperties property: The model spread Record<string> with the different known property + * type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model spread Record<string> with the different known property + * type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the DifferentSpreadStringRecord object itself. + */ + @Generated + public DifferentSpreadStringRecord setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("id", this.id); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DifferentSpreadStringRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DifferentSpreadStringRecord if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DifferentSpreadStringRecord. + */ + @Generated + public static DifferentSpreadStringRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + double id = 0.0; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getDouble(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.getString()); + } + } + DifferentSpreadStringRecord deserializedDifferentSpreadStringRecord = new DifferentSpreadStringRecord(id); + deserializedDifferentSpreadStringRecord.additionalProperties = additionalProperties; + + return deserializedDifferentSpreadStringRecord; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsFloatAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsFloatAdditionalProperties.java new file mode 100644 index 00000000000..22d0a632e99 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsFloatAdditionalProperties.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model extends from Record<float32> type. + */ +@Fluent +public final class ExtendsFloatAdditionalProperties implements JsonSerializable { + /* + * The id property + */ + @Generated + private final double id; + + /* + * The model extends from Record type. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of ExtendsFloatAdditionalProperties class. + * + * @param id the id value to set. + */ + @Generated + public ExtendsFloatAdditionalProperties(double id) { + this.id = id; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public double getId() { + return this.id; + } + + /** + * Get the additionalProperties property: The model extends from Record<float32> type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model extends from Record<float32> type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ExtendsFloatAdditionalProperties object itself. + */ + @Generated + public ExtendsFloatAdditionalProperties setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("id", this.id); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendsFloatAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendsFloatAdditionalProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExtendsFloatAdditionalProperties. + */ + @Generated + public static ExtendsFloatAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + double id = 0.0; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getDouble(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.getDouble()); + } + } + ExtendsFloatAdditionalProperties deserializedExtendsFloatAdditionalProperties + = new ExtendsFloatAdditionalProperties(id); + deserializedExtendsFloatAdditionalProperties.additionalProperties = additionalProperties; + + return deserializedExtendsFloatAdditionalProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelAdditionalProperties.java new file mode 100644 index 00000000000..a6469c0b509 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelAdditionalProperties.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model extends from Record<ModelForRecord> type. + */ +@Fluent +public final class ExtendsModelAdditionalProperties implements JsonSerializable { + /* + * The knownProp property. + */ + @Generated + private final ModelForRecord knownProp; + + /* + * The model extends from Record type. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of ExtendsModelAdditionalProperties class. + * + * @param knownProp the knownProp value to set. + */ + @Generated + public ExtendsModelAdditionalProperties(ModelForRecord knownProp) { + this.knownProp = knownProp; + } + + /** + * Get the knownProp property: The knownProp property. + * + * @return the knownProp value. + */ + @Generated + public ModelForRecord getKnownProp() { + return this.knownProp; + } + + /** + * Get the additionalProperties property: The model extends from Record<ModelForRecord> type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model extends from Record<ModelForRecord> type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ExtendsModelAdditionalProperties object itself. + */ + @Generated + public ExtendsModelAdditionalProperties setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("knownProp", this.knownProp); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendsModelAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendsModelAdditionalProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExtendsModelAdditionalProperties. + */ + @Generated + public static ExtendsModelAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ModelForRecord knownProp = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knownProp".equals(fieldName)) { + knownProp = ModelForRecord.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, ModelForRecord.fromJson(reader)); + } + } + ExtendsModelAdditionalProperties deserializedExtendsModelAdditionalProperties + = new ExtendsModelAdditionalProperties(knownProp); + deserializedExtendsModelAdditionalProperties.additionalProperties = additionalProperties; + + return deserializedExtendsModelAdditionalProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelArrayAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelArrayAdditionalProperties.java new file mode 100644 index 00000000000..ca7bde7ee08 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsModelArrayAdditionalProperties.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * The model extends from Record<ModelForRecord[]> type. + */ +@Fluent +public final class ExtendsModelArrayAdditionalProperties + implements JsonSerializable { + /* + * The knownProp property. + */ + @Generated + private final List knownProp; + + /* + * The model extends from Record type. + */ + @Generated + private Map> additionalProperties; + + /** + * Creates an instance of ExtendsModelArrayAdditionalProperties class. + * + * @param knownProp the knownProp value to set. + */ + @Generated + public ExtendsModelArrayAdditionalProperties(List knownProp) { + this.knownProp = knownProp; + } + + /** + * Get the knownProp property: The knownProp property. + * + * @return the knownProp value. + */ + @Generated + public List getKnownProp() { + return this.knownProp; + } + + /** + * Get the additionalProperties property: The model extends from Record<ModelForRecord[]> type. + * + * @return the additionalProperties value. + */ + @Generated + public Map> getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model extends from Record<ModelForRecord[]> type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ExtendsModelArrayAdditionalProperties object itself. + */ + @Generated + public ExtendsModelArrayAdditionalProperties + setAdditionalProperties(Map> additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("knownProp", this.knownProp, (writer, element) -> writer.writeJson(element)); + if (additionalProperties != null) { + for (Map.Entry> additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendsModelArrayAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendsModelArrayAdditionalProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExtendsModelArrayAdditionalProperties. + */ + @Generated + public static ExtendsModelArrayAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List knownProp = null; + Map> additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knownProp".equals(fieldName)) { + knownProp = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + List additionalPropertiesArrayItem + = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); + additionalProperties.put(fieldName, additionalPropertiesArrayItem); + } + } + ExtendsModelArrayAdditionalProperties deserializedExtendsModelArrayAdditionalProperties + = new ExtendsModelArrayAdditionalProperties(knownProp); + deserializedExtendsModelArrayAdditionalProperties.additionalProperties = additionalProperties; + + return deserializedExtendsModelArrayAdditionalProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsStringAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsStringAdditionalProperties.java new file mode 100644 index 00000000000..53cc8cf60a4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsStringAdditionalProperties.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model extends from Record<string> type. + */ +@Fluent +public final class ExtendsStringAdditionalProperties implements JsonSerializable { + /* + * The name property + */ + @Generated + private final String name; + + /* + * The model extends from Record type. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of ExtendsStringAdditionalProperties class. + * + * @param name the name value to set. + */ + @Generated + public ExtendsStringAdditionalProperties(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the additionalProperties property: The model extends from Record<string> type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model extends from Record<string> type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ExtendsStringAdditionalProperties object itself. + */ + @Generated + public ExtendsStringAdditionalProperties setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendsStringAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendsStringAdditionalProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExtendsStringAdditionalProperties. + */ + @Generated + public static ExtendsStringAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.getString()); + } + } + ExtendsStringAdditionalProperties deserializedExtendsStringAdditionalProperties + = new ExtendsStringAdditionalProperties(name); + deserializedExtendsStringAdditionalProperties.additionalProperties = additionalProperties; + + return deserializedExtendsStringAdditionalProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalProperties.java new file mode 100644 index 00000000000..6a17af35366 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalProperties.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model extends from Record<unknown> type. + */ +@Fluent +public class ExtendsUnknownAdditionalProperties implements JsonSerializable { + /* + * The name property + */ + @Generated + private final String name; + + /* + * The model extends from Record type. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of ExtendsUnknownAdditionalProperties class. + * + * @param name the name value to set. + */ + @Generated + public ExtendsUnknownAdditionalProperties(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the additionalProperties property: The model extends from Record<unknown> type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model extends from Record<unknown> type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ExtendsUnknownAdditionalProperties object itself. + */ + @Generated + public ExtendsUnknownAdditionalProperties setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendsUnknownAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendsUnknownAdditionalProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExtendsUnknownAdditionalProperties. + */ + @Generated + public static ExtendsUnknownAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + ExtendsUnknownAdditionalProperties deserializedExtendsUnknownAdditionalProperties + = new ExtendsUnknownAdditionalProperties(name); + deserializedExtendsUnknownAdditionalProperties.additionalProperties = additionalProperties; + + return deserializedExtendsUnknownAdditionalProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDerived.java new file mode 100644 index 00000000000..27263c25586 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDerived.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model extends from a type that extends from Record<unknown>. + */ +@Fluent +public final class ExtendsUnknownAdditionalPropertiesDerived extends ExtendsUnknownAdditionalProperties { + /* + * The index property + */ + @Generated + private final int index; + + /* + * The age property + */ + @Generated + private Double age; + + /** + * Creates an instance of ExtendsUnknownAdditionalPropertiesDerived class. + * + * @param name the name value to set. + * @param index the index value to set. + */ + @Generated + public ExtendsUnknownAdditionalPropertiesDerived(String name, int index) { + super(name); + this.index = index; + } + + /** + * Get the index property: The index property. + * + * @return the index value. + */ + @Generated + public int getIndex() { + return this.index; + } + + /** + * Get the age property: The age property. + * + * @return the age value. + */ + @Generated + public Double getAge() { + return this.age; + } + + /** + * Set the age property: The age property. + * + * @param age the age value to set. + * @return the ExtendsUnknownAdditionalPropertiesDerived object itself. + */ + @Generated + public ExtendsUnknownAdditionalPropertiesDerived setAge(Double age) { + this.age = age; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeIntField("index", this.index); + jsonWriter.writeNumberField("age", this.age); + if (getAdditionalProperties() != null) { + for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendsUnknownAdditionalPropertiesDerived from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendsUnknownAdditionalPropertiesDerived if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExtendsUnknownAdditionalPropertiesDerived. + */ + @Generated + public static ExtendsUnknownAdditionalPropertiesDerived fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + int index = 0; + Double age = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("age".equals(fieldName)) { + age = reader.getNullable(JsonReader::getDouble); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + ExtendsUnknownAdditionalPropertiesDerived deserializedExtendsUnknownAdditionalPropertiesDerived + = new ExtendsUnknownAdditionalPropertiesDerived(name, index); + deserializedExtendsUnknownAdditionalPropertiesDerived.age = age; + deserializedExtendsUnknownAdditionalPropertiesDerived.setAdditionalProperties(additionalProperties); + + return deserializedExtendsUnknownAdditionalPropertiesDerived; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminated.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminated.java new file mode 100644 index 00000000000..3f41acbeb3a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminated.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model extends from Record<unknown> with a discriminator. + */ +@Fluent +public class ExtendsUnknownAdditionalPropertiesDiscriminated + implements JsonSerializable { + /* + * The discriminator + */ + @Generated + private String kind = "ExtendsUnknownAdditionalPropertiesDiscriminated"; + + /* + * The name property + */ + @Generated + private final String name; + + /* + * The model extends from Record with a discriminator. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of ExtendsUnknownAdditionalPropertiesDiscriminated class. + * + * @param name the name value to set. + */ + @Generated + public ExtendsUnknownAdditionalPropertiesDiscriminated(String name) { + this.name = name; + } + + /** + * Get the kind property: The discriminator. + * + * @return the kind value. + */ + @Generated + public String getKind() { + return this.kind; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the additionalProperties property: The model extends from Record<unknown> with a discriminator. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model extends from Record<unknown> with a discriminator. + * + * @param additionalProperties the additionalProperties value to set. + * @return the ExtendsUnknownAdditionalPropertiesDiscriminated object itself. + */ + @Generated + public ExtendsUnknownAdditionalPropertiesDiscriminated + setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("kind", this.kind); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendsUnknownAdditionalPropertiesDiscriminated from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendsUnknownAdditionalPropertiesDiscriminated if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExtendsUnknownAdditionalPropertiesDiscriminated. + */ + @Generated + public static ExtendsUnknownAdditionalPropertiesDiscriminated fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("derived".equals(discriminatorValue)) { + return ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static ExtendsUnknownAdditionalPropertiesDiscriminated fromJsonKnownDiscriminator(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String kind = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + ExtendsUnknownAdditionalPropertiesDiscriminated deserializedExtendsUnknownAdditionalPropertiesDiscriminated + = new ExtendsUnknownAdditionalPropertiesDiscriminated(name); + deserializedExtendsUnknownAdditionalPropertiesDiscriminated.kind = kind; + deserializedExtendsUnknownAdditionalPropertiesDiscriminated.additionalProperties = additionalProperties; + + return deserializedExtendsUnknownAdditionalPropertiesDiscriminated; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.java new file mode 100644 index 00000000000..01c54d6f9be --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The derived discriminated type. + */ +@Fluent +public final class ExtendsUnknownAdditionalPropertiesDiscriminatedDerived + extends ExtendsUnknownAdditionalPropertiesDiscriminated { + /* + * The discriminator + */ + @Generated + private String kind = "derived"; + + /* + * The index property + */ + @Generated + private final int index; + + /* + * The age property + */ + @Generated + private Double age; + + /** + * Creates an instance of ExtendsUnknownAdditionalPropertiesDiscriminatedDerived class. + * + * @param name the name value to set. + * @param index the index value to set. + */ + @Generated + public ExtendsUnknownAdditionalPropertiesDiscriminatedDerived(String name, int index) { + super(name); + this.index = index; + } + + /** + * Get the kind property: The discriminator. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * Get the index property: The index property. + * + * @return the index value. + */ + @Generated + public int getIndex() { + return this.index; + } + + /** + * Get the age property: The age property. + * + * @return the age value. + */ + @Generated + public Double getAge() { + return this.age; + } + + /** + * Set the age property: The age property. + * + * @param age the age value to set. + * @return the ExtendsUnknownAdditionalPropertiesDiscriminatedDerived object itself. + */ + @Generated + public ExtendsUnknownAdditionalPropertiesDiscriminatedDerived setAge(Double age) { + this.age = age; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeIntField("index", this.index); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeNumberField("age", this.age); + if (getAdditionalProperties() != null) { + for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendsUnknownAdditionalPropertiesDiscriminatedDerived from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendsUnknownAdditionalPropertiesDiscriminatedDerived if the JsonReader was pointing to + * an instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExtendsUnknownAdditionalPropertiesDiscriminatedDerived. + */ + @Generated + public static ExtendsUnknownAdditionalPropertiesDiscriminatedDerived fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + int index = 0; + String kind = "derived"; + Double age = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else if ("age".equals(fieldName)) { + age = reader.getNullable(JsonReader::getDouble); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + ExtendsUnknownAdditionalPropertiesDiscriminatedDerived deserializedExtendsUnknownAdditionalPropertiesDiscriminatedDerived + = new ExtendsUnknownAdditionalPropertiesDiscriminatedDerived(name, index); + deserializedExtendsUnknownAdditionalPropertiesDiscriminatedDerived.kind = kind; + deserializedExtendsUnknownAdditionalPropertiesDiscriminatedDerived.age = age; + deserializedExtendsUnknownAdditionalPropertiesDiscriminatedDerived + .setAdditionalProperties(additionalProperties); + + return deserializedExtendsUnknownAdditionalPropertiesDiscriminatedDerived; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsFloatAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsFloatAdditionalProperties.java new file mode 100644 index 00000000000..7a9a8a27740 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsFloatAdditionalProperties.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model is from Record<float32> type. + */ +@Fluent +public final class IsFloatAdditionalProperties implements JsonSerializable { + /* + * The id property + */ + @Generated + private final double id; + + /* + * The model is from Record type. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of IsFloatAdditionalProperties class. + * + * @param id the id value to set. + */ + @Generated + public IsFloatAdditionalProperties(double id) { + this.id = id; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public double getId() { + return this.id; + } + + /** + * Get the additionalProperties property: The model is from Record<float32> type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model is from Record<float32> type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the IsFloatAdditionalProperties object itself. + */ + @Generated + public IsFloatAdditionalProperties setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("id", this.id); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IsFloatAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IsFloatAdditionalProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IsFloatAdditionalProperties. + */ + @Generated + public static IsFloatAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + double id = 0.0; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getDouble(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.getDouble()); + } + } + IsFloatAdditionalProperties deserializedIsFloatAdditionalProperties = new IsFloatAdditionalProperties(id); + deserializedIsFloatAdditionalProperties.additionalProperties = additionalProperties; + + return deserializedIsFloatAdditionalProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelAdditionalProperties.java new file mode 100644 index 00000000000..208b2cc4785 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelAdditionalProperties.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model is from Record<ModelForRecord> type. + */ +@Fluent +public final class IsModelAdditionalProperties implements JsonSerializable { + /* + * The knownProp property. + */ + @Generated + private final ModelForRecord knownProp; + + /* + * The model is from Record type. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of IsModelAdditionalProperties class. + * + * @param knownProp the knownProp value to set. + */ + @Generated + public IsModelAdditionalProperties(ModelForRecord knownProp) { + this.knownProp = knownProp; + } + + /** + * Get the knownProp property: The knownProp property. + * + * @return the knownProp value. + */ + @Generated + public ModelForRecord getKnownProp() { + return this.knownProp; + } + + /** + * Get the additionalProperties property: The model is from Record<ModelForRecord> type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model is from Record<ModelForRecord> type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the IsModelAdditionalProperties object itself. + */ + @Generated + public IsModelAdditionalProperties setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("knownProp", this.knownProp); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IsModelAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IsModelAdditionalProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IsModelAdditionalProperties. + */ + @Generated + public static IsModelAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ModelForRecord knownProp = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knownProp".equals(fieldName)) { + knownProp = ModelForRecord.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, ModelForRecord.fromJson(reader)); + } + } + IsModelAdditionalProperties deserializedIsModelAdditionalProperties + = new IsModelAdditionalProperties(knownProp); + deserializedIsModelAdditionalProperties.additionalProperties = additionalProperties; + + return deserializedIsModelAdditionalProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelArrayAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelArrayAdditionalProperties.java new file mode 100644 index 00000000000..f70e1b4d64e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsModelArrayAdditionalProperties.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * The model is from Record<ModelForRecord[]> type. + */ +@Fluent +public final class IsModelArrayAdditionalProperties implements JsonSerializable { + /* + * The knownProp property. + */ + @Generated + private final List knownProp; + + /* + * The model is from Record type. + */ + @Generated + private Map> additionalProperties; + + /** + * Creates an instance of IsModelArrayAdditionalProperties class. + * + * @param knownProp the knownProp value to set. + */ + @Generated + public IsModelArrayAdditionalProperties(List knownProp) { + this.knownProp = knownProp; + } + + /** + * Get the knownProp property: The knownProp property. + * + * @return the knownProp value. + */ + @Generated + public List getKnownProp() { + return this.knownProp; + } + + /** + * Get the additionalProperties property: The model is from Record<ModelForRecord[]> type. + * + * @return the additionalProperties value. + */ + @Generated + public Map> getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model is from Record<ModelForRecord[]> type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the IsModelArrayAdditionalProperties object itself. + */ + @Generated + public IsModelArrayAdditionalProperties + setAdditionalProperties(Map> additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("knownProp", this.knownProp, (writer, element) -> writer.writeJson(element)); + if (additionalProperties != null) { + for (Map.Entry> additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IsModelArrayAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IsModelArrayAdditionalProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IsModelArrayAdditionalProperties. + */ + @Generated + public static IsModelArrayAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List knownProp = null; + Map> additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knownProp".equals(fieldName)) { + knownProp = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + List additionalPropertiesArrayItem + = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); + additionalProperties.put(fieldName, additionalPropertiesArrayItem); + } + } + IsModelArrayAdditionalProperties deserializedIsModelArrayAdditionalProperties + = new IsModelArrayAdditionalProperties(knownProp); + deserializedIsModelArrayAdditionalProperties.additionalProperties = additionalProperties; + + return deserializedIsModelArrayAdditionalProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsStringAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsStringAdditionalProperties.java new file mode 100644 index 00000000000..b747a2bef03 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsStringAdditionalProperties.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model is from Record<string> type. + */ +@Fluent +public final class IsStringAdditionalProperties implements JsonSerializable { + /* + * The name property + */ + @Generated + private final String name; + + /* + * The model is from Record type. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of IsStringAdditionalProperties class. + * + * @param name the name value to set. + */ + @Generated + public IsStringAdditionalProperties(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the additionalProperties property: The model is from Record<string> type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model is from Record<string> type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the IsStringAdditionalProperties object itself. + */ + @Generated + public IsStringAdditionalProperties setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IsStringAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IsStringAdditionalProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IsStringAdditionalProperties. + */ + @Generated + public static IsStringAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.getString()); + } + } + IsStringAdditionalProperties deserializedIsStringAdditionalProperties + = new IsStringAdditionalProperties(name); + deserializedIsStringAdditionalProperties.additionalProperties = additionalProperties; + + return deserializedIsStringAdditionalProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalProperties.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalProperties.java new file mode 100644 index 00000000000..285a2250055 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalProperties.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model is from Record<unknown> type. + */ +@Fluent +public class IsUnknownAdditionalProperties implements JsonSerializable { + /* + * The name property + */ + @Generated + private final String name; + + /* + * The model is from Record type. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of IsUnknownAdditionalProperties class. + * + * @param name the name value to set. + */ + @Generated + public IsUnknownAdditionalProperties(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the additionalProperties property: The model is from Record<unknown> type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model is from Record<unknown> type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the IsUnknownAdditionalProperties object itself. + */ + @Generated + public IsUnknownAdditionalProperties setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IsUnknownAdditionalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IsUnknownAdditionalProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IsUnknownAdditionalProperties. + */ + @Generated + public static IsUnknownAdditionalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + IsUnknownAdditionalProperties deserializedIsUnknownAdditionalProperties + = new IsUnknownAdditionalProperties(name); + deserializedIsUnknownAdditionalProperties.additionalProperties = additionalProperties; + + return deserializedIsUnknownAdditionalProperties; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDerived.java new file mode 100644 index 00000000000..d099bd713a6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDerived.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model extends from a type that is Record<unknown> type. + */ +@Fluent +public final class IsUnknownAdditionalPropertiesDerived extends IsUnknownAdditionalProperties { + /* + * The index property + */ + @Generated + private final int index; + + /* + * The age property + */ + @Generated + private Double age; + + /** + * Creates an instance of IsUnknownAdditionalPropertiesDerived class. + * + * @param name the name value to set. + * @param index the index value to set. + */ + @Generated + public IsUnknownAdditionalPropertiesDerived(String name, int index) { + super(name); + this.index = index; + } + + /** + * Get the index property: The index property. + * + * @return the index value. + */ + @Generated + public int getIndex() { + return this.index; + } + + /** + * Get the age property: The age property. + * + * @return the age value. + */ + @Generated + public Double getAge() { + return this.age; + } + + /** + * Set the age property: The age property. + * + * @param age the age value to set. + * @return the IsUnknownAdditionalPropertiesDerived object itself. + */ + @Generated + public IsUnknownAdditionalPropertiesDerived setAge(Double age) { + this.age = age; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeIntField("index", this.index); + jsonWriter.writeNumberField("age", this.age); + if (getAdditionalProperties() != null) { + for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IsUnknownAdditionalPropertiesDerived from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IsUnknownAdditionalPropertiesDerived if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IsUnknownAdditionalPropertiesDerived. + */ + @Generated + public static IsUnknownAdditionalPropertiesDerived fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + int index = 0; + Double age = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("age".equals(fieldName)) { + age = reader.getNullable(JsonReader::getDouble); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + IsUnknownAdditionalPropertiesDerived deserializedIsUnknownAdditionalPropertiesDerived + = new IsUnknownAdditionalPropertiesDerived(name, index); + deserializedIsUnknownAdditionalPropertiesDerived.age = age; + deserializedIsUnknownAdditionalPropertiesDerived.setAdditionalProperties(additionalProperties); + + return deserializedIsUnknownAdditionalPropertiesDerived; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminated.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminated.java new file mode 100644 index 00000000000..b54c0569473 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminated.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model is Record<unknown> with a discriminator. + */ +@Fluent +public class IsUnknownAdditionalPropertiesDiscriminated + implements JsonSerializable { + /* + * The discriminator + */ + @Generated + private String kind = "IsUnknownAdditionalPropertiesDiscriminated"; + + /* + * The name property + */ + @Generated + private final String name; + + /* + * The model is Record with a discriminator. + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of IsUnknownAdditionalPropertiesDiscriminated class. + * + * @param name the name value to set. + */ + @Generated + public IsUnknownAdditionalPropertiesDiscriminated(String name) { + this.name = name; + } + + /** + * Get the kind property: The discriminator. + * + * @return the kind value. + */ + @Generated + public String getKind() { + return this.kind; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the additionalProperties property: The model is Record<unknown> with a discriminator. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model is Record<unknown> with a discriminator. + * + * @param additionalProperties the additionalProperties value to set. + * @return the IsUnknownAdditionalPropertiesDiscriminated object itself. + */ + @Generated + public IsUnknownAdditionalPropertiesDiscriminated + setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("kind", this.kind); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IsUnknownAdditionalPropertiesDiscriminated from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IsUnknownAdditionalPropertiesDiscriminated if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IsUnknownAdditionalPropertiesDiscriminated. + */ + @Generated + public static IsUnknownAdditionalPropertiesDiscriminated fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("derived".equals(discriminatorValue)) { + return IsUnknownAdditionalPropertiesDiscriminatedDerived.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static IsUnknownAdditionalPropertiesDiscriminated fromJsonKnownDiscriminator(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String kind = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + IsUnknownAdditionalPropertiesDiscriminated deserializedIsUnknownAdditionalPropertiesDiscriminated + = new IsUnknownAdditionalPropertiesDiscriminated(name); + deserializedIsUnknownAdditionalPropertiesDiscriminated.kind = kind; + deserializedIsUnknownAdditionalPropertiesDiscriminated.additionalProperties = additionalProperties; + + return deserializedIsUnknownAdditionalPropertiesDiscriminated; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminatedDerived.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminatedDerived.java new file mode 100644 index 00000000000..02d2821f705 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminatedDerived.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The derived discriminated type. + */ +@Fluent +public final class IsUnknownAdditionalPropertiesDiscriminatedDerived + extends IsUnknownAdditionalPropertiesDiscriminated { + /* + * The discriminator + */ + @Generated + private String kind = "derived"; + + /* + * The index property + */ + @Generated + private final int index; + + /* + * The age property + */ + @Generated + private Double age; + + /** + * Creates an instance of IsUnknownAdditionalPropertiesDiscriminatedDerived class. + * + * @param name the name value to set. + * @param index the index value to set. + */ + @Generated + public IsUnknownAdditionalPropertiesDiscriminatedDerived(String name, int index) { + super(name); + this.index = index; + } + + /** + * Get the kind property: The discriminator. + * + * @return the kind value. + */ + @Generated + @Override + public String getKind() { + return this.kind; + } + + /** + * Get the index property: The index property. + * + * @return the index value. + */ + @Generated + public int getIndex() { + return this.index; + } + + /** + * Get the age property: The age property. + * + * @return the age value. + */ + @Generated + public Double getAge() { + return this.age; + } + + /** + * Set the age property: The age property. + * + * @param age the age value to set. + * @return the IsUnknownAdditionalPropertiesDiscriminatedDerived object itself. + */ + @Generated + public IsUnknownAdditionalPropertiesDiscriminatedDerived setAge(Double age) { + this.age = age; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", getName()); + jsonWriter.writeIntField("index", this.index); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeNumberField("age", this.age); + if (getAdditionalProperties() != null) { + for (Map.Entry additionalProperty : getAdditionalProperties().entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IsUnknownAdditionalPropertiesDiscriminatedDerived from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IsUnknownAdditionalPropertiesDiscriminatedDerived if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IsUnknownAdditionalPropertiesDiscriminatedDerived. + */ + @Generated + public static IsUnknownAdditionalPropertiesDiscriminatedDerived fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + int index = 0; + String kind = "derived"; + Double age = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("index".equals(fieldName)) { + index = reader.getInt(); + } else if ("kind".equals(fieldName)) { + kind = reader.getString(); + } else if ("age".equals(fieldName)) { + age = reader.getNullable(JsonReader::getDouble); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + IsUnknownAdditionalPropertiesDiscriminatedDerived deserializedIsUnknownAdditionalPropertiesDiscriminatedDerived + = new IsUnknownAdditionalPropertiesDiscriminatedDerived(name, index); + deserializedIsUnknownAdditionalPropertiesDiscriminatedDerived.kind = kind; + deserializedIsUnknownAdditionalPropertiesDiscriminatedDerived.age = age; + deserializedIsUnknownAdditionalPropertiesDiscriminatedDerived.setAdditionalProperties(additionalProperties); + + return deserializedIsUnknownAdditionalPropertiesDiscriminatedDerived; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ModelForRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ModelForRecord.java new file mode 100644 index 00000000000..d500ade1110 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/ModelForRecord.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * model for record. + */ +@Immutable +public final class ModelForRecord implements JsonSerializable { + /* + * The state property + */ + @Generated + private final String state; + + /** + * Creates an instance of ModelForRecord class. + * + * @param state the state value to set. + */ + @Generated + public ModelForRecord(String state) { + this.state = state; + } + + /** + * Get the state property: The state property. + * + * @return the state value. + */ + @Generated + public String getState() { + return this.state; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ModelForRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ModelForRecord if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ModelForRecord. + */ + @Generated + public static ModelForRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String state = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + state = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new ModelForRecord(state); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/MultipleSpreadRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/MultipleSpreadRecord.java new file mode 100644 index 00000000000..1346a332c2c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/MultipleSpreadRecord.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model spread Record<string> and Record<float32>. + */ +@Fluent +public final class MultipleSpreadRecord implements JsonSerializable { + /* + * The name property + */ + @Generated + private final boolean flag; + + /* + * The model spread Record and Record + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of MultipleSpreadRecord class. + * + * @param flag the flag value to set. + */ + @Generated + public MultipleSpreadRecord(boolean flag) { + this.flag = flag; + } + + /** + * Get the flag property: The name property. + * + * @return the flag value. + */ + @Generated + public boolean isFlag() { + return this.flag; + } + + /** + * Get the additionalProperties property: The model spread Record<string> and Record<float32>. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model spread Record<string> and Record<float32>. + * + * @param additionalProperties the additionalProperties value to set. + * @return the MultipleSpreadRecord object itself. + */ + @Generated + public MultipleSpreadRecord setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("flag", this.flag); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MultipleSpreadRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MultipleSpreadRecord if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MultipleSpreadRecord. + */ + @Generated + public static MultipleSpreadRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean flag = false; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("flag".equals(fieldName)) { + flag = reader.getBoolean(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + MultipleSpreadRecord deserializedMultipleSpreadRecord = new MultipleSpreadRecord(flag); + deserializedMultipleSpreadRecord.additionalProperties = additionalProperties; + + return deserializedMultipleSpreadRecord; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadFloatRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadFloatRecord.java new file mode 100644 index 00000000000..07f10c20961 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadFloatRecord.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model spread Record<float32> with the same known property type. + */ +@Fluent +public final class SpreadFloatRecord implements JsonSerializable { + /* + * The id property + */ + @Generated + private final double id; + + /* + * The model spread Record with the same known property type + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of SpreadFloatRecord class. + * + * @param id the id value to set. + */ + @Generated + public SpreadFloatRecord(double id) { + this.id = id; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public double getId() { + return this.id; + } + + /** + * Get the additionalProperties property: The model spread Record<float32> with the same known property type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model spread Record<float32> with the same known property type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the SpreadFloatRecord object itself. + */ + @Generated + public SpreadFloatRecord setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("id", this.id); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadFloatRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadFloatRecord if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadFloatRecord. + */ + @Generated + public static SpreadFloatRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + double id = 0.0; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getDouble(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.getDouble()); + } + } + SpreadFloatRecord deserializedSpreadFloatRecord = new SpreadFloatRecord(id); + deserializedSpreadFloatRecord.additionalProperties = additionalProperties; + + return deserializedSpreadFloatRecord; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelArrayRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelArrayRecord.java new file mode 100644 index 00000000000..eb9a43c9285 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelArrayRecord.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * The SpreadModelArrayRecord model. + */ +@Fluent +public final class SpreadModelArrayRecord implements JsonSerializable { + /* + * The knownProp property. + */ + @Generated + private final List knownProp; + + /* + * Additional properties + */ + @Generated + private Map> additionalProperties; + + /** + * Creates an instance of SpreadModelArrayRecord class. + * + * @param knownProp the knownProp value to set. + */ + @Generated + public SpreadModelArrayRecord(List knownProp) { + this.knownProp = knownProp; + } + + /** + * Get the knownProp property: The knownProp property. + * + * @return the knownProp value. + */ + @Generated + public List getKnownProp() { + return this.knownProp; + } + + /** + * Get the additionalProperties property: Additional properties. + * + * @return the additionalProperties value. + */ + @Generated + public Map> getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: Additional properties. + * + * @param additionalProperties the additionalProperties value to set. + * @return the SpreadModelArrayRecord object itself. + */ + @Generated + public SpreadModelArrayRecord setAdditionalProperties(Map> additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("knownProp", this.knownProp, (writer, element) -> writer.writeJson(element)); + if (additionalProperties != null) { + for (Map.Entry> additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadModelArrayRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadModelArrayRecord if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadModelArrayRecord. + */ + @Generated + public static SpreadModelArrayRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List knownProp = null; + Map> additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knownProp".equals(fieldName)) { + knownProp = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + List additionalPropertiesArrayItem + = reader.readArray(reader1 -> ModelForRecord.fromJson(reader1)); + additionalProperties.put(fieldName, additionalPropertiesArrayItem); + } + } + SpreadModelArrayRecord deserializedSpreadModelArrayRecord = new SpreadModelArrayRecord(knownProp); + deserializedSpreadModelArrayRecord.additionalProperties = additionalProperties; + + return deserializedSpreadModelArrayRecord; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelRecord.java new file mode 100644 index 00000000000..edeef666ca4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadModelRecord.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model spread Record<ModelForRecord> with the same known property type. + */ +@Fluent +public final class SpreadModelRecord implements JsonSerializable { + /* + * The knownProp property. + */ + @Generated + private final ModelForRecord knownProp; + + /* + * The model spread Record with the same known property type + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of SpreadModelRecord class. + * + * @param knownProp the knownProp value to set. + */ + @Generated + public SpreadModelRecord(ModelForRecord knownProp) { + this.knownProp = knownProp; + } + + /** + * Get the knownProp property: The knownProp property. + * + * @return the knownProp value. + */ + @Generated + public ModelForRecord getKnownProp() { + return this.knownProp; + } + + /** + * Get the additionalProperties property: The model spread Record<ModelForRecord> with the same known property + * type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model spread Record<ModelForRecord> with the same known property + * type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the SpreadModelRecord object itself. + */ + @Generated + public SpreadModelRecord setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("knownProp", this.knownProp); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadModelRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadModelRecord if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadModelRecord. + */ + @Generated + public static SpreadModelRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ModelForRecord knownProp = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("knownProp".equals(fieldName)) { + knownProp = ModelForRecord.fromJson(reader); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, ModelForRecord.fromJson(reader)); + } + } + SpreadModelRecord deserializedSpreadModelRecord = new SpreadModelRecord(knownProp); + deserializedSpreadModelRecord.additionalProperties = additionalProperties; + + return deserializedSpreadModelRecord; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion.java new file mode 100644 index 00000000000..c5439806d6f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model spread Record<WidgetData0 | WidgetData1>. + */ +@Fluent +public final class SpreadRecordForNonDiscriminatedUnion + implements JsonSerializable { + /* + * The name property + */ + @Generated + private final String name; + + /* + * The model spread Record + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of SpreadRecordForNonDiscriminatedUnion class. + * + * @param name the name value to set. + */ + @Generated + public SpreadRecordForNonDiscriminatedUnion(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the additionalProperties property: The model spread Record<WidgetData0 | WidgetData1>. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model spread Record<WidgetData0 | WidgetData1>. + * + * @param additionalProperties the additionalProperties value to set. + * @return the SpreadRecordForNonDiscriminatedUnion object itself. + */ + @Generated + public SpreadRecordForNonDiscriminatedUnion setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadRecordForNonDiscriminatedUnion from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadRecordForNonDiscriminatedUnion if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadRecordForNonDiscriminatedUnion. + */ + @Generated + public static SpreadRecordForNonDiscriminatedUnion fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + SpreadRecordForNonDiscriminatedUnion deserializedSpreadRecordForNonDiscriminatedUnion + = new SpreadRecordForNonDiscriminatedUnion(name); + deserializedSpreadRecordForNonDiscriminatedUnion.additionalProperties = additionalProperties; + + return deserializedSpreadRecordForNonDiscriminatedUnion; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion2.java new file mode 100644 index 00000000000..b9514e5682d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion2.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model spread Record<WidgetData2 | WidgetData1>. + */ +@Fluent +public final class SpreadRecordForNonDiscriminatedUnion2 + implements JsonSerializable { + /* + * The name property + */ + @Generated + private final String name; + + /* + * The model spread Record + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of SpreadRecordForNonDiscriminatedUnion2 class. + * + * @param name the name value to set. + */ + @Generated + public SpreadRecordForNonDiscriminatedUnion2(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the additionalProperties property: The model spread Record<WidgetData2 | WidgetData1>. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model spread Record<WidgetData2 | WidgetData1>. + * + * @param additionalProperties the additionalProperties value to set. + * @return the SpreadRecordForNonDiscriminatedUnion2 object itself. + */ + @Generated + public SpreadRecordForNonDiscriminatedUnion2 setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadRecordForNonDiscriminatedUnion2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadRecordForNonDiscriminatedUnion2 if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadRecordForNonDiscriminatedUnion2. + */ + @Generated + public static SpreadRecordForNonDiscriminatedUnion2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + SpreadRecordForNonDiscriminatedUnion2 deserializedSpreadRecordForNonDiscriminatedUnion2 + = new SpreadRecordForNonDiscriminatedUnion2(name); + deserializedSpreadRecordForNonDiscriminatedUnion2.additionalProperties = additionalProperties; + + return deserializedSpreadRecordForNonDiscriminatedUnion2; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion3.java new file mode 100644 index 00000000000..2e67d697252 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion3.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model spread Record<WidgetData2[] | WidgetData1>. + */ +@Fluent +public final class SpreadRecordForNonDiscriminatedUnion3 + implements JsonSerializable { + /* + * The name property + */ + @Generated + private final String name; + + /* + * The model spread Record + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of SpreadRecordForNonDiscriminatedUnion3 class. + * + * @param name the name value to set. + */ + @Generated + public SpreadRecordForNonDiscriminatedUnion3(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the additionalProperties property: The model spread Record<WidgetData2[] | WidgetData1>. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model spread Record<WidgetData2[] | WidgetData1>. + * + * @param additionalProperties the additionalProperties value to set. + * @return the SpreadRecordForNonDiscriminatedUnion3 object itself. + */ + @Generated + public SpreadRecordForNonDiscriminatedUnion3 setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadRecordForNonDiscriminatedUnion3 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadRecordForNonDiscriminatedUnion3 if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadRecordForNonDiscriminatedUnion3. + */ + @Generated + public static SpreadRecordForNonDiscriminatedUnion3 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + SpreadRecordForNonDiscriminatedUnion3 deserializedSpreadRecordForNonDiscriminatedUnion3 + = new SpreadRecordForNonDiscriminatedUnion3(name); + deserializedSpreadRecordForNonDiscriminatedUnion3.additionalProperties = additionalProperties; + + return deserializedSpreadRecordForNonDiscriminatedUnion3; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForUnion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForUnion.java new file mode 100644 index 00000000000..cc153342dc4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadRecordForUnion.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model spread Record<string | float32>. + */ +@Fluent +public final class SpreadRecordForUnion implements JsonSerializable { + /* + * The name property + */ + @Generated + private final boolean flag; + + /* + * The model spread Record + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of SpreadRecordForUnion class. + * + * @param flag the flag value to set. + */ + @Generated + public SpreadRecordForUnion(boolean flag) { + this.flag = flag; + } + + /** + * Get the flag property: The name property. + * + * @return the flag value. + */ + @Generated + public boolean isFlag() { + return this.flag; + } + + /** + * Get the additionalProperties property: The model spread Record<string | float32>. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model spread Record<string | float32>. + * + * @param additionalProperties the additionalProperties value to set. + * @return the SpreadRecordForUnion object itself. + */ + @Generated + public SpreadRecordForUnion setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("flag", this.flag); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeFieldName(additionalProperty.getKey()); + if (additionalProperty.getValue() == null) { + jsonWriter.writeNull(); + } else { + additionalProperty.getValue().writeTo(jsonWriter); + } + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadRecordForUnion from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadRecordForUnion if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadRecordForUnion. + */ + @Generated + public static SpreadRecordForUnion fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean flag = false; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("flag".equals(fieldName)) { + flag = reader.getBoolean(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, + reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } + } + SpreadRecordForUnion deserializedSpreadRecordForUnion = new SpreadRecordForUnion(flag); + deserializedSpreadRecordForUnion.additionalProperties = additionalProperties; + + return deserializedSpreadRecordForUnion; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadStringRecord.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadStringRecord.java new file mode 100644 index 00000000000..c2b6fa9ab51 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/SpreadStringRecord.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * The model spread Record<string> with the same known property type. + */ +@Fluent +public final class SpreadStringRecord implements JsonSerializable { + /* + * The name property + */ + @Generated + private final String name; + + /* + * The model spread Record with the same known property type + */ + @Generated + private Map additionalProperties; + + /** + * Creates an instance of SpreadStringRecord class. + * + * @param name the name value to set. + */ + @Generated + public SpreadStringRecord(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the additionalProperties property: The model spread Record<string> with the same known property type. + * + * @return the additionalProperties value. + */ + @Generated + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The model spread Record<string> with the same known property type. + * + * @param additionalProperties the additionalProperties value to set. + * @return the SpreadStringRecord object itself. + */ + @Generated + public SpreadStringRecord setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + if (additionalProperties != null) { + for (Map.Entry additionalProperty : additionalProperties.entrySet()) { + jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SpreadStringRecord from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SpreadStringRecord if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SpreadStringRecord. + */ + @Generated + public static SpreadStringRecord fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + Map additionalProperties = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + if (additionalProperties == null) { + additionalProperties = new LinkedHashMap<>(); + } + + additionalProperties.put(fieldName, reader.getString()); + } + } + SpreadStringRecord deserializedSpreadStringRecord = new SpreadStringRecord(name); + deserializedSpreadStringRecord.additionalProperties = additionalProperties; + + return deserializedSpreadStringRecord; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData0.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData0.java new file mode 100644 index 00000000000..d2db366fa2c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData0.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The WidgetData0 model. + */ +@Immutable +public final class WidgetData0 implements JsonSerializable { + /* + * The kind property. + */ + @Generated + private final String kind = "kind0"; + + /* + * The fooProp property. + */ + @Generated + private final String fooProp; + + /** + * Creates an instance of WidgetData0 class. + * + * @param fooProp the fooProp value to set. + */ + @Generated + public WidgetData0(String fooProp) { + this.fooProp = fooProp; + } + + /** + * Get the kind property: The kind property. + * + * @return the kind value. + */ + @Generated + public String getKind() { + return this.kind; + } + + /** + * Get the fooProp property: The fooProp property. + * + * @return the fooProp value. + */ + @Generated + public String getFooProp() { + return this.fooProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeStringField("fooProp", this.fooProp); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WidgetData0 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WidgetData0 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WidgetData0. + */ + @Generated + public static WidgetData0 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String fooProp = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("fooProp".equals(fieldName)) { + fooProp = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new WidgetData0(fooProp); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData1.java new file mode 100644 index 00000000000..10c5a5d2987 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData1.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The WidgetData1 model. + */ +@Fluent +public final class WidgetData1 implements JsonSerializable { + /* + * The kind property. + */ + @Generated + private final String kind = "kind1"; + + /* + * The start property. + */ + @Generated + private final OffsetDateTime start; + + /* + * The end property. + */ + @Generated + private OffsetDateTime end; + + /** + * Creates an instance of WidgetData1 class. + * + * @param start the start value to set. + */ + @Generated + public WidgetData1(OffsetDateTime start) { + this.start = start; + } + + /** + * Get the kind property: The kind property. + * + * @return the kind value. + */ + @Generated + public String getKind() { + return this.kind; + } + + /** + * Get the start property: The start property. + * + * @return the start value. + */ + @Generated + public OffsetDateTime getStart() { + return this.start; + } + + /** + * Get the end property: The end property. + * + * @return the end value. + */ + @Generated + public OffsetDateTime getEnd() { + return this.end; + } + + /** + * Set the end property: The end property. + * + * @param end the end value to set. + * @return the WidgetData1 object itself. + */ + @Generated + public WidgetData1 setEnd(OffsetDateTime end) { + this.end = end; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeStringField("start", + this.start == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.start)); + jsonWriter.writeStringField("end", + this.end == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.end)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WidgetData1 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WidgetData1 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WidgetData1. + */ + @Generated + public static WidgetData1 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffsetDateTime start = null; + OffsetDateTime end = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("start".equals(fieldName)) { + start = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("end".equals(fieldName)) { + end = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + WidgetData1 deserializedWidgetData1 = new WidgetData1(start); + deserializedWidgetData1.end = end; + + return deserializedWidgetData1; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData2.java new file mode 100644 index 00000000000..a102dd2134d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/WidgetData2.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The WidgetData2 model. + */ +@Immutable +public final class WidgetData2 implements JsonSerializable { + /* + * The kind property. + */ + @Generated + private final String kind = "kind1"; + + /* + * The start property. + */ + @Generated + private final String start; + + /** + * Creates an instance of WidgetData2 class. + * + * @param start the start value to set. + */ + @Generated + public WidgetData2(String start) { + this.start = start; + } + + /** + * Get the kind property: The kind property. + * + * @return the kind value. + */ + @Generated + public String getKind() { + return this.kind; + } + + /** + * Get the start property: The start property. + * + * @return the start value. + */ + @Generated + public String getStart() { + return this.start; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind); + jsonWriter.writeStringField("start", this.start); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WidgetData2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WidgetData2 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WidgetData2. + */ + @Generated + public static WidgetData2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String start = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("start".equals(fieldName)) { + start = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new WidgetData2(start); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/package-info.java new file mode 100644 index 00000000000..f4204521cda --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for AdditionalProperties. + * Tests for additional properties of models. + * + */ +package type.property.additionalproperties.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/package-info.java new file mode 100644 index 00000000000..8f44f96583d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/additionalproperties/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for AdditionalProperties. + * Tests for additional properties of models. + * + */ +package type.property.additionalproperties; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesAsyncClient.java new file mode 100644 index 00000000000..043ec1b639a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesAsyncClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.nullable.implementation.BytesImpl; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.models.BytesProperty; + +/** + * Initializes a new instance of the asynchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) +public final class BytesAsyncClient { + @Generated + private final BytesImpl serviceClient; + + /** + * Initializes an instance of BytesAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BytesAsyncClient(BytesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BytesProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BytesProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNonNull(BytesProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNull(BytesProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesClient.java new file mode 100644 index 00000000000..540f8ac0356 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/BytesClient.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.nullable.implementation.BytesImpl; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.models.BytesProperty; + +/** + * Initializes a new instance of the synchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class) +public final class BytesClient { + @Generated + private final BytesImpl serviceClient; + + /** + * Initializes an instance of BytesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BytesClient(BytesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BytesProperty getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).getValue().toObject(BytesProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BytesProperty getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).getValue().toObject(BytesProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNonNull(BytesProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNull(BytesProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getBytesPropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteAsyncClient.java new file mode 100644 index 00000000000..9f6393f35c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteAsyncClient.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.nullable.implementation.CollectionsBytesImpl; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.models.CollectionsByteProperty; + +/** + * Initializes a new instance of the asynchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) +public final class CollectionsByteAsyncClient { + @Generated + private final CollectionsBytesImpl serviceClient; + + /** + * Initializes an instance of CollectionsByteAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsByteAsyncClient(CollectionsBytesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsByteProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsByteProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNonNull(CollectionsByteProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNull(CollectionsByteProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteClient.java new file mode 100644 index 00000000000..392d1df30e0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsByteClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.nullable.implementation.CollectionsBytesImpl; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.models.CollectionsByteProperty; + +/** + * Initializes a new instance of the synchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class) +public final class CollectionsByteClient { + @Generated + private final CollectionsBytesImpl serviceClient; + + /** + * Initializes an instance of CollectionsByteClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsByteClient(CollectionsBytesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsByteProperty getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).getValue().toObject(CollectionsByteProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsByteProperty getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).getValue().toObject(CollectionsByteProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNonNull(CollectionsByteProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNull(CollectionsByteProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getCollectionsBytePropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelAsyncClient.java new file mode 100644 index 00000000000..0e6bceae132 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelAsyncClient.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.nullable.implementation.CollectionsModelsImpl; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.models.CollectionsModelProperty; + +/** + * Initializes a new instance of the asynchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) +public final class CollectionsModelAsyncClient { + @Generated + private final CollectionsModelsImpl serviceClient; + + /** + * Initializes an instance of CollectionsModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsModelAsyncClient(CollectionsModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsModelProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsModelProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNonNull(CollectionsModelProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNull(CollectionsModelProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelClient.java new file mode 100644 index 00000000000..808a736e11d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsModelClient.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.nullable.implementation.CollectionsModelsImpl; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.models.CollectionsModelProperty; + +/** + * Initializes a new instance of the synchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class) +public final class CollectionsModelClient { + @Generated + private final CollectionsModelsImpl serviceClient; + + /** + * Initializes an instance of CollectionsModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsModelClient(CollectionsModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsModelProperty getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).getValue().toObject(CollectionsModelProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsModelProperty getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).getValue().toObject(CollectionsModelProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNonNull(CollectionsModelProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNull(CollectionsModelProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getCollectionsModelPropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringAsyncClient.java new file mode 100644 index 00000000000..af95bdb4a90 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringAsyncClient.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.nullable.implementation.CollectionsStringsImpl; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.models.CollectionsStringProperty; + +/** + * Initializes a new instance of the asynchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) +public final class CollectionsStringAsyncClient { + @Generated + private final CollectionsStringsImpl serviceClient; + + /** + * Initializes an instance of CollectionsStringAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsStringAsyncClient(CollectionsStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsStringProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsStringProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNonNull(CollectionsStringProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNull(CollectionsStringProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringClient.java new file mode 100644 index 00000000000..daab00ae71e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/CollectionsStringClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.nullable.implementation.CollectionsStringsImpl; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.models.CollectionsStringProperty; + +/** + * Initializes a new instance of the synchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class) +public final class CollectionsStringClient { + @Generated + private final CollectionsStringsImpl serviceClient; + + /** + * Initializes an instance of CollectionsStringClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsStringClient(CollectionsStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsStringProperty getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).getValue().toObject(CollectionsStringProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsStringProperty getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).getValue().toObject(CollectionsStringProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNonNull(CollectionsStringProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNull(CollectionsStringProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getCollectionsStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationAsyncClient.java new file mode 100644 index 00000000000..26df3988dc1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationAsyncClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.nullable.implementation.DatetimeOperationsImpl; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.models.DatetimeProperty; + +/** + * Initializes a new instance of the asynchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) +public final class DatetimeOperationAsyncClient { + @Generated + private final DatetimeOperationsImpl serviceClient; + + /** + * Initializes an instance of DatetimeOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DatetimeOperationAsyncClient(DatetimeOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DatetimeProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DatetimeProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNonNull(DatetimeProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNull(DatetimeProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationClient.java new file mode 100644 index 00000000000..f064e5a6503 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DatetimeOperationClient.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.nullable.implementation.DatetimeOperationsImpl; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.models.DatetimeProperty; + +/** + * Initializes a new instance of the synchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class) +public final class DatetimeOperationClient { + @Generated + private final DatetimeOperationsImpl serviceClient; + + /** + * Initializes an instance of DatetimeOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DatetimeOperationClient(DatetimeOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DatetimeProperty getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).getValue().toObject(DatetimeProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DatetimeProperty getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).getValue().toObject(DatetimeProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNonNull(DatetimeProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNull(DatetimeProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getDatetimePropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationAsyncClient.java new file mode 100644 index 00000000000..19f327eb226 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationAsyncClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.nullable.implementation.DurationOperationsImpl; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.models.DurationProperty; + +/** + * Initializes a new instance of the asynchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) +public final class DurationOperationAsyncClient { + @Generated + private final DurationOperationsImpl serviceClient; + + /** + * Initializes an instance of DurationOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DurationOperationAsyncClient(DurationOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DurationProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DurationProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNonNull(DurationProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNull(DurationProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationClient.java new file mode 100644 index 00000000000..088771de0c5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/DurationOperationClient.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.nullable.implementation.DurationOperationsImpl; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.models.DurationProperty; + +/** + * Initializes a new instance of the synchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class) +public final class DurationOperationClient { + @Generated + private final DurationOperationsImpl serviceClient; + + /** + * Initializes an instance of DurationOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DurationOperationClient(DurationOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DurationProperty getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).getValue().toObject(DurationProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DurationProperty getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).getValue().toObject(DurationProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNonNull(DurationProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNull(DurationProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getDurationPropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/NullableClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/NullableClientBuilder.java new file mode 100644 index 00000000000..e67c78726f9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/NullableClientBuilder.java @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.property.nullable.implementation.NullableClientImpl; + +/** + * A builder for creating a new instance of the NullableClient type. + */ +@ServiceClientBuilder( + serviceClients = { + StringOperationClient.class, + BytesClient.class, + DatetimeOperationClient.class, + DurationOperationClient.class, + CollectionsByteClient.class, + CollectionsModelClient.class, + CollectionsStringClient.class, + StringOperationAsyncClient.class, + BytesAsyncClient.class, + DatetimeOperationAsyncClient.class, + DurationOperationAsyncClient.class, + CollectionsByteAsyncClient.class, + CollectionsModelAsyncClient.class, + CollectionsStringAsyncClient.class }) +public final class NullableClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("type-property-nullable.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the NullableClientBuilder. + */ + @Generated + public NullableClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NullableClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NullableClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NullableClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NullableClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NullableClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NullableClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NullableClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public NullableClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the NullableClientBuilder. + */ + @Generated + public NullableClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of NullableClientImpl with the provided parameters. + * + * @return an instance of NullableClientImpl. + */ + @Generated + private NullableClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + NullableClientImpl client + = new NullableClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of StringOperationAsyncClient class. + * + * @return an instance of StringOperationAsyncClient. + */ + @Generated + public StringOperationAsyncClient buildStringOperationAsyncClient() { + return new StringOperationAsyncClient(buildInnerClient().getStringOperations()); + } + + /** + * Builds an instance of BytesAsyncClient class. + * + * @return an instance of BytesAsyncClient. + */ + @Generated + public BytesAsyncClient buildBytesAsyncClient() { + return new BytesAsyncClient(buildInnerClient().getBytes()); + } + + /** + * Builds an instance of DatetimeOperationAsyncClient class. + * + * @return an instance of DatetimeOperationAsyncClient. + */ + @Generated + public DatetimeOperationAsyncClient buildDatetimeOperationAsyncClient() { + return new DatetimeOperationAsyncClient(buildInnerClient().getDatetimeOperations()); + } + + /** + * Builds an instance of DurationOperationAsyncClient class. + * + * @return an instance of DurationOperationAsyncClient. + */ + @Generated + public DurationOperationAsyncClient buildDurationOperationAsyncClient() { + return new DurationOperationAsyncClient(buildInnerClient().getDurationOperations()); + } + + /** + * Builds an instance of CollectionsByteAsyncClient class. + * + * @return an instance of CollectionsByteAsyncClient. + */ + @Generated + public CollectionsByteAsyncClient buildCollectionsByteAsyncClient() { + return new CollectionsByteAsyncClient(buildInnerClient().getCollectionsBytes()); + } + + /** + * Builds an instance of CollectionsModelAsyncClient class. + * + * @return an instance of CollectionsModelAsyncClient. + */ + @Generated + public CollectionsModelAsyncClient buildCollectionsModelAsyncClient() { + return new CollectionsModelAsyncClient(buildInnerClient().getCollectionsModels()); + } + + /** + * Builds an instance of CollectionsStringAsyncClient class. + * + * @return an instance of CollectionsStringAsyncClient. + */ + @Generated + public CollectionsStringAsyncClient buildCollectionsStringAsyncClient() { + return new CollectionsStringAsyncClient(buildInnerClient().getCollectionsStrings()); + } + + /** + * Builds an instance of StringOperationClient class. + * + * @return an instance of StringOperationClient. + */ + @Generated + public StringOperationClient buildStringOperationClient() { + return new StringOperationClient(buildInnerClient().getStringOperations()); + } + + /** + * Builds an instance of BytesClient class. + * + * @return an instance of BytesClient. + */ + @Generated + public BytesClient buildBytesClient() { + return new BytesClient(buildInnerClient().getBytes()); + } + + /** + * Builds an instance of DatetimeOperationClient class. + * + * @return an instance of DatetimeOperationClient. + */ + @Generated + public DatetimeOperationClient buildDatetimeOperationClient() { + return new DatetimeOperationClient(buildInnerClient().getDatetimeOperations()); + } + + /** + * Builds an instance of DurationOperationClient class. + * + * @return an instance of DurationOperationClient. + */ + @Generated + public DurationOperationClient buildDurationOperationClient() { + return new DurationOperationClient(buildInnerClient().getDurationOperations()); + } + + /** + * Builds an instance of CollectionsByteClient class. + * + * @return an instance of CollectionsByteClient. + */ + @Generated + public CollectionsByteClient buildCollectionsByteClient() { + return new CollectionsByteClient(buildInnerClient().getCollectionsBytes()); + } + + /** + * Builds an instance of CollectionsModelClient class. + * + * @return an instance of CollectionsModelClient. + */ + @Generated + public CollectionsModelClient buildCollectionsModelClient() { + return new CollectionsModelClient(buildInnerClient().getCollectionsModels()); + } + + /** + * Builds an instance of CollectionsStringClient class. + * + * @return an instance of CollectionsStringClient. + */ + @Generated + public CollectionsStringClient buildCollectionsStringClient() { + return new CollectionsStringClient(buildInnerClient().getCollectionsStrings()); + } + + private static final ClientLogger LOGGER = new ClientLogger(NullableClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationAsyncClient.java new file mode 100644 index 00000000000..e9c45612e0f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationAsyncClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.implementation.StringOperationsImpl; +import type.property.nullable.models.StringProperty; + +/** + * Initializes a new instance of the asynchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class, isAsync = true) +public final class StringOperationAsyncClient { + @Generated + private final StringOperationsImpl serviceClient; + + /** + * Initializes an instance of StringOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringOperationAsyncClient(StringOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(StringProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(StringProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNonNull(StringProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNonNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono patchNull(StringProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); + return patchNullWithResponse(bodyInBinaryData, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationClient.java new file mode 100644 index 00000000000..8b688c77cc9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/StringOperationClient.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.nullable.implementation.JsonMergePatchHelper; +import type.property.nullable.implementation.StringOperationsImpl; +import type.property.nullable.models.StringProperty; + +/** + * Initializes a new instance of the synchronous NullableClient type. + */ +@ServiceClient(builder = NullableClientBuilder.class) +public final class StringOperationClient { + @Generated + private final StringOperationsImpl serviceClient; + + /** + * Initializes an instance of StringOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringOperationClient(StringOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNonNullWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getNullWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNonNullWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.patchNullWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public StringProperty getNonNull() { + // Generated convenience method for getNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNonNullWithResponse(requestOptions).getValue().toObject(StringProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public StringProperty getNull() { + // Generated convenience method for getNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getNullWithResponse(requestOptions).getValue().toObject(StringProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNonNull(StringProperty body) { + // Generated convenience method for patchNonNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNonNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void patchNull(StringProperty body) { + // Generated convenience method for patchNullWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, true); + BinaryData bodyInBinaryData = BinaryData.fromObject(body); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + bodyInBinaryData.getLength(); + JsonMergePatchHelper.getStringPropertyAccessor().prepareModelForJsonMergePatch(body, false); + patchNullWithResponse(bodyInBinaryData, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/BytesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/BytesImpl.java new file mode 100644 index 00000000000..dbf83f2c3e8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/BytesImpl.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Patch; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Bytes. + */ +public final class BytesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BytesService service; + + /** + * The service client containing this operation class. + */ + private final NullableClientImpl client; + + /** + * Initializes an instance of BytesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BytesImpl(NullableClientImpl client) { + this.service = RestProxy.create(BytesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NullableClientBytes to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NullableClientBytes") + public interface BytesService { + @Get("/type/property/nullable/bytes/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/bytes/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/bytes/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/bytes/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/bytes/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/bytes/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/bytes/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/bytes/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: byte[] (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsBytesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsBytesImpl.java new file mode 100644 index 00000000000..37e8866f321 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsBytesImpl.java @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Patch; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CollectionsBytes. + */ +public final class CollectionsBytesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final CollectionsBytesService service; + + /** + * The service client containing this operation class. + */ + private final NullableClientImpl client; + + /** + * Initializes an instance of CollectionsBytesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionsBytesImpl(NullableClientImpl client) { + this.service + = RestProxy.create(CollectionsBytesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NullableClientCollectionsBytes to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NullableClientCollectionsBytes") + public interface CollectionsBytesService { + @Get("/type/property/nullable/collections/bytes/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/collections/bytes/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/collections/bytes/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/collections/bytes/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/collections/bytes/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/collections/bytes/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/collections/bytes/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/collections/bytes/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         byte[] (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsModelsImpl.java new file mode 100644 index 00000000000..bcd126f3816 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsModelsImpl.java @@ -0,0 +1,388 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Patch; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CollectionsModels. + */ +public final class CollectionsModelsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final CollectionsModelsService service; + + /** + * The service client containing this operation class. + */ + private final NullableClientImpl client; + + /** + * Initializes an instance of CollectionsModelsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionsModelsImpl(NullableClientImpl client) { + this.service + = RestProxy.create(CollectionsModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NullableClientCollectionsModels to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NullableClientCollectionsModels") + public interface CollectionsModelsService { + @Get("/type/property/nullable/collections/model/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/collections/model/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/collections/model/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/collections/model/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/collections/model/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/collections/model/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/collections/model/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/collections/model/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *          (Optional, Required on create){
+     *             property: String (Optional, Required on create)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsStringsImpl.java new file mode 100644 index 00000000000..be0345333cb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/CollectionsStringsImpl.java @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Patch; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CollectionsStrings. + */ +public final class CollectionsStringsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final CollectionsStringsService service; + + /** + * The service client containing this operation class. + */ + private final NullableClientImpl client; + + /** + * Initializes an instance of CollectionsStringsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionsStringsImpl(NullableClientImpl client) { + this.service = RestProxy.create(CollectionsStringsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NullableClientCollectionsStrings to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NullableClientCollectionsStrings") + public interface CollectionsStringsService { + @Get("/type/property/nullable/collections/string/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/collections/string/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/collections/string/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/collections/string/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/collections/string/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/collections/string/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/collections/string/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/collections/string/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty (Optional, Required on create): [
+     *         String (Optional, Required on create)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DatetimeOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DatetimeOperationsImpl.java new file mode 100644 index 00000000000..e678bf2a7ce --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DatetimeOperationsImpl.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Patch; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DatetimeOperations. + */ +public final class DatetimeOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DatetimeOperationsService service; + + /** + * The service client containing this operation class. + */ + private final NullableClientImpl client; + + /** + * Initializes an instance of DatetimeOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatetimeOperationsImpl(NullableClientImpl client) { + this.service = RestProxy.create(DatetimeOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NullableClientDatetimeOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NullableClientDatetimeOperations") + public interface DatetimeOperationsService { + @Get("/type/property/nullable/datetime/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/datetime/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/datetime/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/datetime/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/datetime/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/datetime/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/datetime/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/datetime/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: OffsetDateTime (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DurationOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DurationOperationsImpl.java new file mode 100644 index 00000000000..7333f65647c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/DurationOperationsImpl.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Patch; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DurationOperations. + */ +public final class DurationOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DurationOperationsService service; + + /** + * The service client containing this operation class. + */ + private final NullableClientImpl client; + + /** + * Initializes an instance of DurationOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DurationOperationsImpl(NullableClientImpl client) { + this.service = RestProxy.create(DurationOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NullableClientDurationOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NullableClientDurationOperations") + public interface DurationOperationsService { + @Get("/type/property/nullable/duration/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/duration/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/duration/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/duration/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/duration/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/duration/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/duration/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/duration/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: Duration (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/JsonMergePatchHelper.java new file mode 100644 index 00000000000..0d66dcff9d5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/JsonMergePatchHelper.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.implementation; + +import type.property.nullable.models.BytesProperty; +import type.property.nullable.models.CollectionsByteProperty; +import type.property.nullable.models.CollectionsModelProperty; +import type.property.nullable.models.CollectionsStringProperty; +import type.property.nullable.models.DatetimeProperty; +import type.property.nullable.models.DurationProperty; +import type.property.nullable.models.InnerModel; +import type.property.nullable.models.StringProperty; + +/** + * This is the Helper class to enable json merge patch serialization for a model. + */ +public class JsonMergePatchHelper { + private static StringPropertyAccessor stringPropertyAccessor; + + public interface StringPropertyAccessor { + StringProperty prepareModelForJsonMergePatch(StringProperty stringProperty, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(StringProperty stringProperty); + } + + public static void setStringPropertyAccessor(StringPropertyAccessor accessor) { + stringPropertyAccessor = accessor; + } + + public static StringPropertyAccessor getStringPropertyAccessor() { + return stringPropertyAccessor; + } + + private static BytesPropertyAccessor bytesPropertyAccessor; + + public interface BytesPropertyAccessor { + BytesProperty prepareModelForJsonMergePatch(BytesProperty bytesProperty, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(BytesProperty bytesProperty); + } + + public static void setBytesPropertyAccessor(BytesPropertyAccessor accessor) { + bytesPropertyAccessor = accessor; + } + + public static BytesPropertyAccessor getBytesPropertyAccessor() { + return bytesPropertyAccessor; + } + + private static DatetimePropertyAccessor datetimePropertyAccessor; + + public interface DatetimePropertyAccessor { + DatetimeProperty prepareModelForJsonMergePatch(DatetimeProperty datetimeProperty, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(DatetimeProperty datetimeProperty); + } + + public static void setDatetimePropertyAccessor(DatetimePropertyAccessor accessor) { + datetimePropertyAccessor = accessor; + } + + public static DatetimePropertyAccessor getDatetimePropertyAccessor() { + return datetimePropertyAccessor; + } + + private static DurationPropertyAccessor durationPropertyAccessor; + + public interface DurationPropertyAccessor { + DurationProperty prepareModelForJsonMergePatch(DurationProperty durationProperty, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(DurationProperty durationProperty); + } + + public static void setDurationPropertyAccessor(DurationPropertyAccessor accessor) { + durationPropertyAccessor = accessor; + } + + public static DurationPropertyAccessor getDurationPropertyAccessor() { + return durationPropertyAccessor; + } + + private static CollectionsBytePropertyAccessor collectionsBytePropertyAccessor; + + public interface CollectionsBytePropertyAccessor { + CollectionsByteProperty prepareModelForJsonMergePatch(CollectionsByteProperty collectionsByteProperty, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(CollectionsByteProperty collectionsByteProperty); + } + + public static void setCollectionsBytePropertyAccessor(CollectionsBytePropertyAccessor accessor) { + collectionsBytePropertyAccessor = accessor; + } + + public static CollectionsBytePropertyAccessor getCollectionsBytePropertyAccessor() { + return collectionsBytePropertyAccessor; + } + + private static CollectionsModelPropertyAccessor collectionsModelPropertyAccessor; + + public interface CollectionsModelPropertyAccessor { + CollectionsModelProperty prepareModelForJsonMergePatch(CollectionsModelProperty collectionsModelProperty, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(CollectionsModelProperty collectionsModelProperty); + } + + public static void setCollectionsModelPropertyAccessor(CollectionsModelPropertyAccessor accessor) { + collectionsModelPropertyAccessor = accessor; + } + + public static CollectionsModelPropertyAccessor getCollectionsModelPropertyAccessor() { + return collectionsModelPropertyAccessor; + } + + private static InnerModelAccessor innerModelAccessor; + + public interface InnerModelAccessor { + InnerModel prepareModelForJsonMergePatch(InnerModel innerModel, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(InnerModel innerModel); + } + + public static void setInnerModelAccessor(InnerModelAccessor accessor) { + innerModelAccessor = accessor; + } + + public static InnerModelAccessor getInnerModelAccessor() { + return innerModelAccessor; + } + + private static CollectionsStringPropertyAccessor collectionsStringPropertyAccessor; + + public interface CollectionsStringPropertyAccessor { + CollectionsStringProperty prepareModelForJsonMergePatch(CollectionsStringProperty collectionsStringProperty, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(CollectionsStringProperty collectionsStringProperty); + } + + public static void setCollectionsStringPropertyAccessor(CollectionsStringPropertyAccessor accessor) { + collectionsStringPropertyAccessor = accessor; + } + + public static CollectionsStringPropertyAccessor getCollectionsStringPropertyAccessor() { + return collectionsStringPropertyAccessor; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/NullableClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/NullableClientImpl.java new file mode 100644 index 00000000000..770d2eae0ae --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/NullableClientImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 NullableClient type. + */ +public final class NullableClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 StringOperationsImpl object to access its operations. + */ + private final StringOperationsImpl stringOperations; + + /** + * Gets the StringOperationsImpl object to access its operations. + * + * @return the StringOperationsImpl object. + */ + public StringOperationsImpl getStringOperations() { + return this.stringOperations; + } + + /** + * The BytesImpl object to access its operations. + */ + private final BytesImpl bytes; + + /** + * Gets the BytesImpl object to access its operations. + * + * @return the BytesImpl object. + */ + public BytesImpl getBytes() { + return this.bytes; + } + + /** + * The DatetimeOperationsImpl object to access its operations. + */ + private final DatetimeOperationsImpl datetimeOperations; + + /** + * Gets the DatetimeOperationsImpl object to access its operations. + * + * @return the DatetimeOperationsImpl object. + */ + public DatetimeOperationsImpl getDatetimeOperations() { + return this.datetimeOperations; + } + + /** + * The DurationOperationsImpl object to access its operations. + */ + private final DurationOperationsImpl durationOperations; + + /** + * Gets the DurationOperationsImpl object to access its operations. + * + * @return the DurationOperationsImpl object. + */ + public DurationOperationsImpl getDurationOperations() { + return this.durationOperations; + } + + /** + * The CollectionsBytesImpl object to access its operations. + */ + private final CollectionsBytesImpl collectionsBytes; + + /** + * Gets the CollectionsBytesImpl object to access its operations. + * + * @return the CollectionsBytesImpl object. + */ + public CollectionsBytesImpl getCollectionsBytes() { + return this.collectionsBytes; + } + + /** + * The CollectionsModelsImpl object to access its operations. + */ + private final CollectionsModelsImpl collectionsModels; + + /** + * Gets the CollectionsModelsImpl object to access its operations. + * + * @return the CollectionsModelsImpl object. + */ + public CollectionsModelsImpl getCollectionsModels() { + return this.collectionsModels; + } + + /** + * The CollectionsStringsImpl object to access its operations. + */ + private final CollectionsStringsImpl collectionsStrings; + + /** + * Gets the CollectionsStringsImpl object to access its operations. + * + * @return the CollectionsStringsImpl object. + */ + public CollectionsStringsImpl getCollectionsStrings() { + return this.collectionsStrings; + } + + /** + * Initializes an instance of NullableClient client. + * + * @param endpoint Service host. + */ + public NullableClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NullableClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public NullableClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of NullableClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public NullableClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.stringOperations = new StringOperationsImpl(this); + this.bytes = new BytesImpl(this); + this.datetimeOperations = new DatetimeOperationsImpl(this); + this.durationOperations = new DurationOperationsImpl(this); + this.collectionsBytes = new CollectionsBytesImpl(this); + this.collectionsModels = new CollectionsModelsImpl(this); + this.collectionsStrings = new CollectionsStringsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/StringOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/StringOperationsImpl.java new file mode 100644 index 00000000000..fa572e99032 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/StringOperationsImpl.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Patch; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringOperations. + */ +public final class StringOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringOperationsService service; + + /** + * The service client containing this operation class. + */ + private final NullableClientImpl client; + + /** + * Initializes an instance of StringOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringOperationsImpl(NullableClientImpl client) { + this.service + = RestProxy.create(StringOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NullableClientStringOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "NullableClientStringOperations") + public interface StringOperationsService { + @Get("/type/property/nullable/string/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/string/non-null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/string/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getNull(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/nullable/string/null") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getNullSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/string/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNonNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/string/non-null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNonNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/string/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> patchNull(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/type/property/nullable/string/null") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response patchNullSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/merge-patch+json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNonNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNonNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNonNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNonNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getNullWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getNull(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getNullWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getNullSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNonNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNonNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNonNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNonNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> patchNullWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return FluxUtil.withContext( + context -> service.patchNull(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     requiredProperty: String (Optional, Required on create)
+     *     nullableProperty: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchNullWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + return service.patchNullSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/package-info.java new file mode 100644 index 00000000000..94ff0328a3c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Nullable. + * Illustrates models with nullable properties. + * + */ +package type.property.nullable.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/BytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/BytesProperty.java new file mode 100644 index 00000000000..a76b6c52ea4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/BytesProperty.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import type.property.nullable.implementation.JsonMergePatchHelper; + +/** + * Template type for testing models with nullable property. Pass in the type of the property you are looking for. + */ +@Fluent +public final class BytesProperty implements JsonSerializable { + /* + * Required property + */ + @Generated + private String requiredProperty; + + /* + * Property + */ + @Generated + private byte[] nullableProperty; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setBytesPropertyAccessor(new JsonMergePatchHelper.BytesPropertyAccessor() { + @Override + public BytesProperty prepareModelForJsonMergePatch(BytesProperty model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(BytesProperty model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of BytesProperty class. + */ + @Generated + public BytesProperty() { + } + + /** + * Get the requiredProperty property: Required property. + * + * @return the requiredProperty value. + */ + @Generated + public String getRequiredProperty() { + return this.requiredProperty; + } + + /** + * Set the requiredProperty property: Required property. + *

Required when create the resource.

+ * + * @param requiredProperty the requiredProperty value to set. + * @return the BytesProperty object itself. + */ + @Generated + public BytesProperty setRequiredProperty(String requiredProperty) { + this.requiredProperty = requiredProperty; + this.updatedProperties.add("requiredProperty"); + return this; + } + + /** + * Get the nullableProperty property: Property. + * + * @return the nullableProperty value. + */ + @Generated + public byte[] getNullableProperty() { + return CoreUtils.clone(this.nullableProperty); + } + + /** + * Set the nullableProperty property: Property. + *

Required when create the resource.

+ * + * @param nullableProperty the nullableProperty value to set. + * @return the BytesProperty object itself. + */ + @Generated + public BytesProperty setNullableProperty(byte[] nullableProperty) { + this.nullableProperty = CoreUtils.clone(nullableProperty); + this.updatedProperties.add("nullableProperty"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + jsonWriter.writeBinaryField("nullableProperty", this.nullableProperty); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("requiredProperty")) { + if (this.requiredProperty == null) { + jsonWriter.writeNullField("requiredProperty"); + } else { + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + } + } + if (updatedProperties.contains("nullableProperty")) { + if (this.nullableProperty == null) { + jsonWriter.writeNullField("nullableProperty"); + } else { + jsonWriter.writeBinaryField("nullableProperty", this.nullableProperty); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BytesProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BytesProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BytesProperty. + */ + @Generated + public static BytesProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BytesProperty deserializedBytesProperty = new BytesProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requiredProperty".equals(fieldName)) { + deserializedBytesProperty.requiredProperty = reader.getString(); + } else if ("nullableProperty".equals(fieldName)) { + deserializedBytesProperty.nullableProperty = reader.getBinary(); + } else { + reader.skipChildren(); + } + } + + return deserializedBytesProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsByteProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsByteProperty.java new file mode 100644 index 00000000000..7d408cf9cae --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsByteProperty.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import type.property.nullable.implementation.JsonMergePatchHelper; + +/** + * Model with collection bytes properties. + */ +@Fluent +public final class CollectionsByteProperty implements JsonSerializable { + /* + * Required property + */ + @Generated + private String requiredProperty; + + /* + * Property + */ + @Generated + private List nullableProperty; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper + .setCollectionsBytePropertyAccessor(new JsonMergePatchHelper.CollectionsBytePropertyAccessor() { + @Override + public CollectionsByteProperty prepareModelForJsonMergePatch(CollectionsByteProperty model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(CollectionsByteProperty model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of CollectionsByteProperty class. + */ + @Generated + public CollectionsByteProperty() { + } + + /** + * Get the requiredProperty property: Required property. + * + * @return the requiredProperty value. + */ + @Generated + public String getRequiredProperty() { + return this.requiredProperty; + } + + /** + * Set the requiredProperty property: Required property. + *

Required when create the resource.

+ * + * @param requiredProperty the requiredProperty value to set. + * @return the CollectionsByteProperty object itself. + */ + @Generated + public CollectionsByteProperty setRequiredProperty(String requiredProperty) { + this.requiredProperty = requiredProperty; + this.updatedProperties.add("requiredProperty"); + return this; + } + + /** + * Get the nullableProperty property: Property. + * + * @return the nullableProperty value. + */ + @Generated + public List getNullableProperty() { + return this.nullableProperty; + } + + /** + * Set the nullableProperty property: Property. + *

Required when create the resource.

+ * + * @param nullableProperty the nullableProperty value to set. + * @return the CollectionsByteProperty object itself. + */ + @Generated + public CollectionsByteProperty setNullableProperty(List nullableProperty) { + this.nullableProperty = nullableProperty; + this.updatedProperties.add("nullableProperty"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + jsonWriter.writeArrayField("nullableProperty", this.nullableProperty, + (writer, element) -> writer.writeBinary(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("requiredProperty")) { + if (this.requiredProperty == null) { + jsonWriter.writeNullField("requiredProperty"); + } else { + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + } + } + if (updatedProperties.contains("nullableProperty")) { + if (this.nullableProperty == null) { + jsonWriter.writeNullField("nullableProperty"); + } else { + jsonWriter.writeArrayField("nullableProperty", this.nullableProperty, + (writer, element) -> writer.writeBinary(element)); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CollectionsByteProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CollectionsByteProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the CollectionsByteProperty. + */ + @Generated + public static CollectionsByteProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CollectionsByteProperty deserializedCollectionsByteProperty = new CollectionsByteProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requiredProperty".equals(fieldName)) { + deserializedCollectionsByteProperty.requiredProperty = reader.getString(); + } else if ("nullableProperty".equals(fieldName)) { + List nullableProperty = reader.readArray(reader1 -> reader1.getBinary()); + deserializedCollectionsByteProperty.nullableProperty = nullableProperty; + } else { + reader.skipChildren(); + } + } + + return deserializedCollectionsByteProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsModelProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsModelProperty.java new file mode 100644 index 00000000000..20efcfe9818 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsModelProperty.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import type.property.nullable.implementation.JsonMergePatchHelper; + +/** + * Model with collection models properties. + */ +@Fluent +public final class CollectionsModelProperty implements JsonSerializable { + /* + * Required property + */ + @Generated + private String requiredProperty; + + /* + * Property + */ + @Generated + private List nullableProperty; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper + .setCollectionsModelPropertyAccessor(new JsonMergePatchHelper.CollectionsModelPropertyAccessor() { + @Override + public CollectionsModelProperty prepareModelForJsonMergePatch(CollectionsModelProperty model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(CollectionsModelProperty model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of CollectionsModelProperty class. + */ + @Generated + public CollectionsModelProperty() { + } + + /** + * Get the requiredProperty property: Required property. + * + * @return the requiredProperty value. + */ + @Generated + public String getRequiredProperty() { + return this.requiredProperty; + } + + /** + * Set the requiredProperty property: Required property. + *

Required when create the resource.

+ * + * @param requiredProperty the requiredProperty value to set. + * @return the CollectionsModelProperty object itself. + */ + @Generated + public CollectionsModelProperty setRequiredProperty(String requiredProperty) { + this.requiredProperty = requiredProperty; + this.updatedProperties.add("requiredProperty"); + return this; + } + + /** + * Get the nullableProperty property: Property. + * + * @return the nullableProperty value. + */ + @Generated + public List getNullableProperty() { + return this.nullableProperty; + } + + /** + * Set the nullableProperty property: Property. + *

Required when create the resource.

+ * + * @param nullableProperty the nullableProperty value to set. + * @return the CollectionsModelProperty object itself. + */ + @Generated + public CollectionsModelProperty setNullableProperty(List nullableProperty) { + this.nullableProperty = nullableProperty; + this.updatedProperties.add("nullableProperty"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + jsonWriter.writeArrayField("nullableProperty", this.nullableProperty, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("requiredProperty")) { + if (this.requiredProperty == null) { + jsonWriter.writeNullField("requiredProperty"); + } else { + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + } + } + if (updatedProperties.contains("nullableProperty")) { + if (this.nullableProperty == null) { + jsonWriter.writeNullField("nullableProperty"); + } else { + jsonWriter.writeArrayField("nullableProperty", this.nullableProperty, + (writer, element) -> writer.writeJson(element)); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CollectionsModelProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CollectionsModelProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CollectionsModelProperty. + */ + @Generated + public static CollectionsModelProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CollectionsModelProperty deserializedCollectionsModelProperty = new CollectionsModelProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requiredProperty".equals(fieldName)) { + deserializedCollectionsModelProperty.requiredProperty = reader.getString(); + } else if ("nullableProperty".equals(fieldName)) { + List nullableProperty = reader.readArray(reader1 -> InnerModel.fromJson(reader1)); + deserializedCollectionsModelProperty.nullableProperty = nullableProperty; + } else { + reader.skipChildren(); + } + } + + return deserializedCollectionsModelProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsStringProperty.java new file mode 100644 index 00000000000..97bbfd35a11 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/CollectionsStringProperty.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import type.property.nullable.implementation.JsonMergePatchHelper; + +/** + * Model with collection string properties. + */ +@Fluent +public final class CollectionsStringProperty implements JsonSerializable { + /* + * Required property + */ + @Generated + private String requiredProperty; + + /* + * Property + */ + @Generated + private List nullableProperty; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper + .setCollectionsStringPropertyAccessor(new JsonMergePatchHelper.CollectionsStringPropertyAccessor() { + @Override + public CollectionsStringProperty prepareModelForJsonMergePatch(CollectionsStringProperty model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(CollectionsStringProperty model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of CollectionsStringProperty class. + */ + @Generated + public CollectionsStringProperty() { + } + + /** + * Get the requiredProperty property: Required property. + * + * @return the requiredProperty value. + */ + @Generated + public String getRequiredProperty() { + return this.requiredProperty; + } + + /** + * Set the requiredProperty property: Required property. + *

Required when create the resource.

+ * + * @param requiredProperty the requiredProperty value to set. + * @return the CollectionsStringProperty object itself. + */ + @Generated + public CollectionsStringProperty setRequiredProperty(String requiredProperty) { + this.requiredProperty = requiredProperty; + this.updatedProperties.add("requiredProperty"); + return this; + } + + /** + * Get the nullableProperty property: Property. + * + * @return the nullableProperty value. + */ + @Generated + public List getNullableProperty() { + return this.nullableProperty; + } + + /** + * Set the nullableProperty property: Property. + *

Required when create the resource.

+ * + * @param nullableProperty the nullableProperty value to set. + * @return the CollectionsStringProperty object itself. + */ + @Generated + public CollectionsStringProperty setNullableProperty(List nullableProperty) { + this.nullableProperty = nullableProperty; + this.updatedProperties.add("nullableProperty"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + jsonWriter.writeArrayField("nullableProperty", this.nullableProperty, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("requiredProperty")) { + if (this.requiredProperty == null) { + jsonWriter.writeNullField("requiredProperty"); + } else { + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + } + } + if (updatedProperties.contains("nullableProperty")) { + if (this.nullableProperty == null) { + jsonWriter.writeNullField("nullableProperty"); + } else { + jsonWriter.writeArrayField("nullableProperty", this.nullableProperty, + (writer, element) -> writer.writeString(element)); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CollectionsStringProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CollectionsStringProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CollectionsStringProperty. + */ + @Generated + public static CollectionsStringProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CollectionsStringProperty deserializedCollectionsStringProperty = new CollectionsStringProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requiredProperty".equals(fieldName)) { + deserializedCollectionsStringProperty.requiredProperty = reader.getString(); + } else if ("nullableProperty".equals(fieldName)) { + List nullableProperty = reader.readArray(reader1 -> reader1.getString()); + deserializedCollectionsStringProperty.nullableProperty = nullableProperty; + } else { + reader.skipChildren(); + } + } + + return deserializedCollectionsStringProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DatetimeProperty.java new file mode 100644 index 00000000000..0dd1566310b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DatetimeProperty.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.HashSet; +import java.util.Set; +import type.property.nullable.implementation.JsonMergePatchHelper; + +/** + * Model with a datetime property. + */ +@Fluent +public final class DatetimeProperty implements JsonSerializable { + /* + * Required property + */ + @Generated + private String requiredProperty; + + /* + * Property + */ + @Generated + private OffsetDateTime nullableProperty; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setDatetimePropertyAccessor(new JsonMergePatchHelper.DatetimePropertyAccessor() { + @Override + public DatetimeProperty prepareModelForJsonMergePatch(DatetimeProperty model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(DatetimeProperty model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of DatetimeProperty class. + */ + @Generated + public DatetimeProperty() { + } + + /** + * Get the requiredProperty property: Required property. + * + * @return the requiredProperty value. + */ + @Generated + public String getRequiredProperty() { + return this.requiredProperty; + } + + /** + * Set the requiredProperty property: Required property. + *

Required when create the resource.

+ * + * @param requiredProperty the requiredProperty value to set. + * @return the DatetimeProperty object itself. + */ + @Generated + public DatetimeProperty setRequiredProperty(String requiredProperty) { + this.requiredProperty = requiredProperty; + this.updatedProperties.add("requiredProperty"); + return this; + } + + /** + * Get the nullableProperty property: Property. + * + * @return the nullableProperty value. + */ + @Generated + public OffsetDateTime getNullableProperty() { + return this.nullableProperty; + } + + /** + * Set the nullableProperty property: Property. + *

Required when create the resource.

+ * + * @param nullableProperty the nullableProperty value to set. + * @return the DatetimeProperty object itself. + */ + @Generated + public DatetimeProperty setNullableProperty(OffsetDateTime nullableProperty) { + this.nullableProperty = nullableProperty; + this.updatedProperties.add("nullableProperty"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + jsonWriter.writeStringField("nullableProperty", + this.nullableProperty == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.nullableProperty)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("requiredProperty")) { + if (this.requiredProperty == null) { + jsonWriter.writeNullField("requiredProperty"); + } else { + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + } + } + if (updatedProperties.contains("nullableProperty")) { + if (this.nullableProperty == null) { + jsonWriter.writeNullField("nullableProperty"); + } else { + jsonWriter.writeStringField("nullableProperty", + this.nullableProperty == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.nullableProperty)); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatetimeProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatetimeProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DatetimeProperty. + */ + @Generated + public static DatetimeProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatetimeProperty deserializedDatetimeProperty = new DatetimeProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requiredProperty".equals(fieldName)) { + deserializedDatetimeProperty.requiredProperty = reader.getString(); + } else if ("nullableProperty".equals(fieldName)) { + deserializedDatetimeProperty.nullableProperty = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDatetimeProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DurationProperty.java new file mode 100644 index 00000000000..9d47c25fa9e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/DurationProperty.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; +import java.util.HashSet; +import java.util.Set; +import type.property.nullable.implementation.JsonMergePatchHelper; + +/** + * Model with a duration property. + */ +@Fluent +public final class DurationProperty implements JsonSerializable { + /* + * Required property + */ + @Generated + private String requiredProperty; + + /* + * Property + */ + @Generated + private Duration nullableProperty; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setDurationPropertyAccessor(new JsonMergePatchHelper.DurationPropertyAccessor() { + @Override + public DurationProperty prepareModelForJsonMergePatch(DurationProperty model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(DurationProperty model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of DurationProperty class. + */ + @Generated + public DurationProperty() { + } + + /** + * Get the requiredProperty property: Required property. + * + * @return the requiredProperty value. + */ + @Generated + public String getRequiredProperty() { + return this.requiredProperty; + } + + /** + * Set the requiredProperty property: Required property. + *

Required when create the resource.

+ * + * @param requiredProperty the requiredProperty value to set. + * @return the DurationProperty object itself. + */ + @Generated + public DurationProperty setRequiredProperty(String requiredProperty) { + this.requiredProperty = requiredProperty; + this.updatedProperties.add("requiredProperty"); + return this; + } + + /** + * Get the nullableProperty property: Property. + * + * @return the nullableProperty value. + */ + @Generated + public Duration getNullableProperty() { + return this.nullableProperty; + } + + /** + * Set the nullableProperty property: Property. + *

Required when create the resource.

+ * + * @param nullableProperty the nullableProperty value to set. + * @return the DurationProperty object itself. + */ + @Generated + public DurationProperty setNullableProperty(Duration nullableProperty) { + this.nullableProperty = nullableProperty; + this.updatedProperties.add("nullableProperty"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + jsonWriter.writeStringField("nullableProperty", CoreUtils.durationToStringWithDays(this.nullableProperty)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("requiredProperty")) { + if (this.requiredProperty == null) { + jsonWriter.writeNullField("requiredProperty"); + } else { + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + } + } + if (updatedProperties.contains("nullableProperty")) { + if (this.nullableProperty == null) { + jsonWriter.writeNullField("nullableProperty"); + } else { + jsonWriter.writeStringField("nullableProperty", + CoreUtils.durationToStringWithDays(this.nullableProperty)); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DurationProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DurationProperty. + */ + @Generated + public static DurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DurationProperty deserializedDurationProperty = new DurationProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requiredProperty".equals(fieldName)) { + deserializedDurationProperty.requiredProperty = reader.getString(); + } else if ("nullableProperty".equals(fieldName)) { + deserializedDurationProperty.nullableProperty + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDurationProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/InnerModel.java new file mode 100644 index 00000000000..d89e9a72513 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/InnerModel.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import type.property.nullable.implementation.JsonMergePatchHelper; + +/** + * Inner model used in collections model property. + */ +@Fluent +public final class InnerModel implements JsonSerializable { + /* + * Inner model property + */ + @Generated + private String property; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setInnerModelAccessor(new JsonMergePatchHelper.InnerModelAccessor() { + @Override + public InnerModel prepareModelForJsonMergePatch(InnerModel model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(InnerModel model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of InnerModel class. + */ + @Generated + public InnerModel() { + } + + /** + * Get the property property: Inner model property. + * + * @return the property value. + */ + @Generated + public String getProperty() { + return this.property; + } + + /** + * Set the property property: Inner model property. + *

Required when create the resource.

+ * + * @param property the property value to set. + * @return the InnerModel object itself. + */ + @Generated + public InnerModel setProperty(String property) { + this.property = property; + this.updatedProperties.add("property"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("property")) { + if (this.property == null) { + jsonWriter.writeNullField("property"); + } else { + jsonWriter.writeStringField("property", this.property); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InnerModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the InnerModel. + */ + @Generated + public static InnerModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InnerModel deserializedInnerModel = new InnerModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedInnerModel.property = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInnerModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/StringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/StringProperty.java new file mode 100644 index 00000000000..b7ca52c3ab9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/StringProperty.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; +import type.property.nullable.implementation.JsonMergePatchHelper; + +/** + * Template type for testing models with nullable property. Pass in the type of the property you are looking for. + */ +@Fluent +public final class StringProperty implements JsonSerializable { + /* + * Required property + */ + @Generated + private String requiredProperty; + + /* + * Property + */ + @Generated + private String nullableProperty; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setStringPropertyAccessor(new JsonMergePatchHelper.StringPropertyAccessor() { + @Override + public StringProperty prepareModelForJsonMergePatch(StringProperty model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(StringProperty model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of StringProperty class. + */ + @Generated + public StringProperty() { + } + + /** + * Get the requiredProperty property: Required property. + * + * @return the requiredProperty value. + */ + @Generated + public String getRequiredProperty() { + return this.requiredProperty; + } + + /** + * Set the requiredProperty property: Required property. + *

Required when create the resource.

+ * + * @param requiredProperty the requiredProperty value to set. + * @return the StringProperty object itself. + */ + @Generated + public StringProperty setRequiredProperty(String requiredProperty) { + this.requiredProperty = requiredProperty; + this.updatedProperties.add("requiredProperty"); + return this; + } + + /** + * Get the nullableProperty property: Property. + * + * @return the nullableProperty value. + */ + @Generated + public String getNullableProperty() { + return this.nullableProperty; + } + + /** + * Set the nullableProperty property: Property. + *

Required when create the resource.

+ * + * @param nullableProperty the nullableProperty value to set. + * @return the StringProperty object itself. + */ + @Generated + public StringProperty setNullableProperty(String nullableProperty) { + this.nullableProperty = nullableProperty; + this.updatedProperties.add("nullableProperty"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + jsonWriter.writeStringField("nullableProperty", this.nullableProperty); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("requiredProperty")) { + if (this.requiredProperty == null) { + jsonWriter.writeNullField("requiredProperty"); + } else { + jsonWriter.writeStringField("requiredProperty", this.requiredProperty); + } + } + if (updatedProperties.contains("nullableProperty")) { + if (this.nullableProperty == null) { + jsonWriter.writeNullField("nullableProperty"); + } else { + jsonWriter.writeStringField("nullableProperty", this.nullableProperty); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StringProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StringProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the StringProperty. + */ + @Generated + public static StringProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StringProperty deserializedStringProperty = new StringProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requiredProperty".equals(fieldName)) { + deserializedStringProperty.requiredProperty = reader.getString(); + } else if ("nullableProperty".equals(fieldName)) { + deserializedStringProperty.nullableProperty = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStringProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/package-info.java new file mode 100644 index 00000000000..0f27592438e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Nullable. + * Illustrates models with nullable properties. + * + */ +package type.property.nullable.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/package-info.java new file mode 100644 index 00000000000..7b84d6531fb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/nullable/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Nullable. + * Illustrates models with nullable properties. + * + */ +package type.property.nullable; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralAsyncClient.java new file mode 100644 index 00000000000..1e8d3825404 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.BooleanLiteralsImpl; +import type.property.optional.models.BooleanLiteralProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class BooleanLiteralAsyncClient { + @Generated + private final BooleanLiteralsImpl serviceClient; + + /** + * Initializes an instance of BooleanLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BooleanLiteralAsyncClient(BooleanLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BooleanLiteralProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BooleanLiteralProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(BooleanLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(BooleanLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralClient.java new file mode 100644 index 00000000000..70ec7fc3d8a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BooleanLiteralClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.BooleanLiteralsImpl; +import type.property.optional.models.BooleanLiteralProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class BooleanLiteralClient { + @Generated + private final BooleanLiteralsImpl serviceClient; + + /** + * Initializes an instance of BooleanLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BooleanLiteralClient(BooleanLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BooleanLiteralProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(BooleanLiteralProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BooleanLiteralProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(BooleanLiteralProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(BooleanLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(BooleanLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesAsyncClient.java new file mode 100644 index 00000000000..2a2381e8793 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.BytesImpl; +import type.property.optional.models.BytesProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class BytesAsyncClient { + @Generated + private final BytesImpl serviceClient; + + /** + * Initializes an instance of BytesAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BytesAsyncClient(BytesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BytesProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BytesProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(BytesProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(BytesProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesClient.java new file mode 100644 index 00000000000..24300b1b4fe --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/BytesClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.BytesImpl; +import type.property.optional.models.BytesProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class BytesClient { + @Generated + private final BytesImpl serviceClient; + + /** + * Initializes an instance of BytesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BytesClient(BytesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BytesProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(BytesProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BytesProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(BytesProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(BytesProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(BytesProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteAsyncClient.java new file mode 100644 index 00000000000..16f3060cd9e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteAsyncClient.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.CollectionsBytesImpl; +import type.property.optional.models.CollectionsByteProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class CollectionsByteAsyncClient { + @Generated + private final CollectionsBytesImpl serviceClient; + + /** + * Initializes an instance of CollectionsByteAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsByteAsyncClient(CollectionsBytesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsByteProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsByteProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(CollectionsByteProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(CollectionsByteProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteClient.java new file mode 100644 index 00000000000..87d5c1aee64 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsByteClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.CollectionsBytesImpl; +import type.property.optional.models.CollectionsByteProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class CollectionsByteClient { + @Generated + private final CollectionsBytesImpl serviceClient; + + /** + * Initializes an instance of CollectionsByteClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsByteClient(CollectionsBytesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsByteProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(CollectionsByteProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsByteProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(CollectionsByteProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(CollectionsByteProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(CollectionsByteProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelAsyncClient.java new file mode 100644 index 00000000000..5e187936905 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelAsyncClient.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.CollectionsModelsImpl; +import type.property.optional.models.CollectionsModelProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class CollectionsModelAsyncClient { + @Generated + private final CollectionsModelsImpl serviceClient; + + /** + * Initializes an instance of CollectionsModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsModelAsyncClient(CollectionsModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsModelProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsModelProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(CollectionsModelProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(CollectionsModelProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelClient.java new file mode 100644 index 00000000000..d08ca801914 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/CollectionsModelClient.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.CollectionsModelsImpl; +import type.property.optional.models.CollectionsModelProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class CollectionsModelClient { + @Generated + private final CollectionsModelsImpl serviceClient; + + /** + * Initializes an instance of CollectionsModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsModelClient(CollectionsModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsModelProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(CollectionsModelProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsModelProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(CollectionsModelProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(CollectionsModelProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(CollectionsModelProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationAsyncClient.java new file mode 100644 index 00000000000..c72d2239d91 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.DatetimeOperationsImpl; +import type.property.optional.models.DatetimeProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class DatetimeOperationAsyncClient { + @Generated + private final DatetimeOperationsImpl serviceClient; + + /** + * Initializes an instance of DatetimeOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DatetimeOperationAsyncClient(DatetimeOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DatetimeProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DatetimeProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(DatetimeProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(DatetimeProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationClient.java new file mode 100644 index 00000000000..2b544e8e99f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DatetimeOperationClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.DatetimeOperationsImpl; +import type.property.optional.models.DatetimeProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class DatetimeOperationClient { + @Generated + private final DatetimeOperationsImpl serviceClient; + + /** + * Initializes an instance of DatetimeOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DatetimeOperationClient(DatetimeOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DatetimeProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(DatetimeProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DatetimeProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(DatetimeProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(DatetimeProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(DatetimeProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationAsyncClient.java new file mode 100644 index 00000000000..55d013f8c25 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.DurationOperationsImpl; +import type.property.optional.models.DurationProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class DurationOperationAsyncClient { + @Generated + private final DurationOperationsImpl serviceClient; + + /** + * Initializes an instance of DurationOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DurationOperationAsyncClient(DurationOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DurationProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DurationProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(DurationProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(DurationProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationClient.java new file mode 100644 index 00000000000..5ee4babd7cd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/DurationOperationClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.DurationOperationsImpl; +import type.property.optional.models.DurationProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class DurationOperationClient { + @Generated + private final DurationOperationsImpl serviceClient; + + /** + * Initializes an instance of DurationOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DurationOperationClient(DurationOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DurationProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(DurationProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DurationProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(DurationProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(DurationProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(DurationProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralAsyncClient.java new file mode 100644 index 00000000000..c0b8e52347d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.FloatLiteralsImpl; +import type.property.optional.models.FloatLiteralProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class FloatLiteralAsyncClient { + @Generated + private final FloatLiteralsImpl serviceClient; + + /** + * Initializes an instance of FloatLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FloatLiteralAsyncClient(FloatLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FloatLiteralProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FloatLiteralProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(FloatLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(FloatLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralClient.java new file mode 100644 index 00000000000..1d02d55a114 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/FloatLiteralClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.FloatLiteralsImpl; +import type.property.optional.models.FloatLiteralProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class FloatLiteralClient { + @Generated + private final FloatLiteralsImpl serviceClient; + + /** + * Initializes an instance of FloatLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FloatLiteralClient(FloatLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FloatLiteralProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(FloatLiteralProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FloatLiteralProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(FloatLiteralProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(FloatLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(FloatLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralAsyncClient.java new file mode 100644 index 00000000000..45801eba251 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.IntLiteralsImpl; +import type.property.optional.models.IntLiteralProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class IntLiteralAsyncClient { + @Generated + private final IntLiteralsImpl serviceClient; + + /** + * Initializes an instance of IntLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IntLiteralAsyncClient(IntLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(IntLiteralProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(IntLiteralProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(IntLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(IntLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralClient.java new file mode 100644 index 00000000000..e66e3279165 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/IntLiteralClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.IntLiteralsImpl; +import type.property.optional.models.IntLiteralProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class IntLiteralClient { + @Generated + private final IntLiteralsImpl serviceClient; + + /** + * Initializes an instance of IntLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IntLiteralClient(IntLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public IntLiteralProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(IntLiteralProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public IntLiteralProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(IntLiteralProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(IntLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(IntLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/OptionalClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/OptionalClientBuilder.java new file mode 100644 index 00000000000..1f162b626b6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/OptionalClientBuilder.java @@ -0,0 +1,620 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.property.optional.implementation.OptionalClientImpl; + +/** + * A builder for creating a new instance of the OptionalClient type. + */ +@ServiceClientBuilder( + serviceClients = { + StringOperationClient.class, + BytesClient.class, + DatetimeOperationClient.class, + DurationOperationClient.class, + PlainDateClient.class, + PlainTimeClient.class, + CollectionsByteClient.class, + CollectionsModelClient.class, + StringLiteralClient.class, + IntLiteralClient.class, + FloatLiteralClient.class, + BooleanLiteralClient.class, + UnionStringLiteralClient.class, + UnionIntLiteralClient.class, + UnionFloatLiteralClient.class, + RequiredAndOptionalClient.class, + StringOperationAsyncClient.class, + BytesAsyncClient.class, + DatetimeOperationAsyncClient.class, + DurationOperationAsyncClient.class, + PlainDateAsyncClient.class, + PlainTimeAsyncClient.class, + CollectionsByteAsyncClient.class, + CollectionsModelAsyncClient.class, + StringLiteralAsyncClient.class, + IntLiteralAsyncClient.class, + FloatLiteralAsyncClient.class, + BooleanLiteralAsyncClient.class, + UnionStringLiteralAsyncClient.class, + UnionIntLiteralAsyncClient.class, + UnionFloatLiteralAsyncClient.class, + RequiredAndOptionalAsyncClient.class }) +public final class OptionalClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("type-property-optional.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the OptionalClientBuilder. + */ + @Generated + public OptionalClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public OptionalClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the OptionalClientBuilder. + */ + @Generated + public OptionalClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of OptionalClientImpl with the provided parameters. + * + * @return an instance of OptionalClientImpl. + */ + @Generated + private OptionalClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + OptionalClientImpl client + = new OptionalClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of StringOperationAsyncClient class. + * + * @return an instance of StringOperationAsyncClient. + */ + @Generated + public StringOperationAsyncClient buildStringOperationAsyncClient() { + return new StringOperationAsyncClient(buildInnerClient().getStringOperations()); + } + + /** + * Builds an instance of BytesAsyncClient class. + * + * @return an instance of BytesAsyncClient. + */ + @Generated + public BytesAsyncClient buildBytesAsyncClient() { + return new BytesAsyncClient(buildInnerClient().getBytes()); + } + + /** + * Builds an instance of DatetimeOperationAsyncClient class. + * + * @return an instance of DatetimeOperationAsyncClient. + */ + @Generated + public DatetimeOperationAsyncClient buildDatetimeOperationAsyncClient() { + return new DatetimeOperationAsyncClient(buildInnerClient().getDatetimeOperations()); + } + + /** + * Builds an instance of DurationOperationAsyncClient class. + * + * @return an instance of DurationOperationAsyncClient. + */ + @Generated + public DurationOperationAsyncClient buildDurationOperationAsyncClient() { + return new DurationOperationAsyncClient(buildInnerClient().getDurationOperations()); + } + + /** + * Builds an instance of PlainDateAsyncClient class. + * + * @return an instance of PlainDateAsyncClient. + */ + @Generated + public PlainDateAsyncClient buildPlainDateAsyncClient() { + return new PlainDateAsyncClient(buildInnerClient().getPlainDates()); + } + + /** + * Builds an instance of PlainTimeAsyncClient class. + * + * @return an instance of PlainTimeAsyncClient. + */ + @Generated + public PlainTimeAsyncClient buildPlainTimeAsyncClient() { + return new PlainTimeAsyncClient(buildInnerClient().getPlainTimes()); + } + + /** + * Builds an instance of CollectionsByteAsyncClient class. + * + * @return an instance of CollectionsByteAsyncClient. + */ + @Generated + public CollectionsByteAsyncClient buildCollectionsByteAsyncClient() { + return new CollectionsByteAsyncClient(buildInnerClient().getCollectionsBytes()); + } + + /** + * Builds an instance of CollectionsModelAsyncClient class. + * + * @return an instance of CollectionsModelAsyncClient. + */ + @Generated + public CollectionsModelAsyncClient buildCollectionsModelAsyncClient() { + return new CollectionsModelAsyncClient(buildInnerClient().getCollectionsModels()); + } + + /** + * Builds an instance of StringLiteralAsyncClient class. + * + * @return an instance of StringLiteralAsyncClient. + */ + @Generated + public StringLiteralAsyncClient buildStringLiteralAsyncClient() { + return new StringLiteralAsyncClient(buildInnerClient().getStringLiterals()); + } + + /** + * Builds an instance of IntLiteralAsyncClient class. + * + * @return an instance of IntLiteralAsyncClient. + */ + @Generated + public IntLiteralAsyncClient buildIntLiteralAsyncClient() { + return new IntLiteralAsyncClient(buildInnerClient().getIntLiterals()); + } + + /** + * Builds an instance of FloatLiteralAsyncClient class. + * + * @return an instance of FloatLiteralAsyncClient. + */ + @Generated + public FloatLiteralAsyncClient buildFloatLiteralAsyncClient() { + return new FloatLiteralAsyncClient(buildInnerClient().getFloatLiterals()); + } + + /** + * Builds an instance of BooleanLiteralAsyncClient class. + * + * @return an instance of BooleanLiteralAsyncClient. + */ + @Generated + public BooleanLiteralAsyncClient buildBooleanLiteralAsyncClient() { + return new BooleanLiteralAsyncClient(buildInnerClient().getBooleanLiterals()); + } + + /** + * Builds an instance of UnionStringLiteralAsyncClient class. + * + * @return an instance of UnionStringLiteralAsyncClient. + */ + @Generated + public UnionStringLiteralAsyncClient buildUnionStringLiteralAsyncClient() { + return new UnionStringLiteralAsyncClient(buildInnerClient().getUnionStringLiterals()); + } + + /** + * Builds an instance of UnionIntLiteralAsyncClient class. + * + * @return an instance of UnionIntLiteralAsyncClient. + */ + @Generated + public UnionIntLiteralAsyncClient buildUnionIntLiteralAsyncClient() { + return new UnionIntLiteralAsyncClient(buildInnerClient().getUnionIntLiterals()); + } + + /** + * Builds an instance of UnionFloatLiteralAsyncClient class. + * + * @return an instance of UnionFloatLiteralAsyncClient. + */ + @Generated + public UnionFloatLiteralAsyncClient buildUnionFloatLiteralAsyncClient() { + return new UnionFloatLiteralAsyncClient(buildInnerClient().getUnionFloatLiterals()); + } + + /** + * Builds an instance of RequiredAndOptionalAsyncClient class. + * + * @return an instance of RequiredAndOptionalAsyncClient. + */ + @Generated + public RequiredAndOptionalAsyncClient buildRequiredAndOptionalAsyncClient() { + return new RequiredAndOptionalAsyncClient(buildInnerClient().getRequiredAndOptionals()); + } + + /** + * Builds an instance of StringOperationClient class. + * + * @return an instance of StringOperationClient. + */ + @Generated + public StringOperationClient buildStringOperationClient() { + return new StringOperationClient(buildInnerClient().getStringOperations()); + } + + /** + * Builds an instance of BytesClient class. + * + * @return an instance of BytesClient. + */ + @Generated + public BytesClient buildBytesClient() { + return new BytesClient(buildInnerClient().getBytes()); + } + + /** + * Builds an instance of DatetimeOperationClient class. + * + * @return an instance of DatetimeOperationClient. + */ + @Generated + public DatetimeOperationClient buildDatetimeOperationClient() { + return new DatetimeOperationClient(buildInnerClient().getDatetimeOperations()); + } + + /** + * Builds an instance of DurationOperationClient class. + * + * @return an instance of DurationOperationClient. + */ + @Generated + public DurationOperationClient buildDurationOperationClient() { + return new DurationOperationClient(buildInnerClient().getDurationOperations()); + } + + /** + * Builds an instance of PlainDateClient class. + * + * @return an instance of PlainDateClient. + */ + @Generated + public PlainDateClient buildPlainDateClient() { + return new PlainDateClient(buildInnerClient().getPlainDates()); + } + + /** + * Builds an instance of PlainTimeClient class. + * + * @return an instance of PlainTimeClient. + */ + @Generated + public PlainTimeClient buildPlainTimeClient() { + return new PlainTimeClient(buildInnerClient().getPlainTimes()); + } + + /** + * Builds an instance of CollectionsByteClient class. + * + * @return an instance of CollectionsByteClient. + */ + @Generated + public CollectionsByteClient buildCollectionsByteClient() { + return new CollectionsByteClient(buildInnerClient().getCollectionsBytes()); + } + + /** + * Builds an instance of CollectionsModelClient class. + * + * @return an instance of CollectionsModelClient. + */ + @Generated + public CollectionsModelClient buildCollectionsModelClient() { + return new CollectionsModelClient(buildInnerClient().getCollectionsModels()); + } + + /** + * Builds an instance of StringLiteralClient class. + * + * @return an instance of StringLiteralClient. + */ + @Generated + public StringLiteralClient buildStringLiteralClient() { + return new StringLiteralClient(buildInnerClient().getStringLiterals()); + } + + /** + * Builds an instance of IntLiteralClient class. + * + * @return an instance of IntLiteralClient. + */ + @Generated + public IntLiteralClient buildIntLiteralClient() { + return new IntLiteralClient(buildInnerClient().getIntLiterals()); + } + + /** + * Builds an instance of FloatLiteralClient class. + * + * @return an instance of FloatLiteralClient. + */ + @Generated + public FloatLiteralClient buildFloatLiteralClient() { + return new FloatLiteralClient(buildInnerClient().getFloatLiterals()); + } + + /** + * Builds an instance of BooleanLiteralClient class. + * + * @return an instance of BooleanLiteralClient. + */ + @Generated + public BooleanLiteralClient buildBooleanLiteralClient() { + return new BooleanLiteralClient(buildInnerClient().getBooleanLiterals()); + } + + /** + * Builds an instance of UnionStringLiteralClient class. + * + * @return an instance of UnionStringLiteralClient. + */ + @Generated + public UnionStringLiteralClient buildUnionStringLiteralClient() { + return new UnionStringLiteralClient(buildInnerClient().getUnionStringLiterals()); + } + + /** + * Builds an instance of UnionIntLiteralClient class. + * + * @return an instance of UnionIntLiteralClient. + */ + @Generated + public UnionIntLiteralClient buildUnionIntLiteralClient() { + return new UnionIntLiteralClient(buildInnerClient().getUnionIntLiterals()); + } + + /** + * Builds an instance of UnionFloatLiteralClient class. + * + * @return an instance of UnionFloatLiteralClient. + */ + @Generated + public UnionFloatLiteralClient buildUnionFloatLiteralClient() { + return new UnionFloatLiteralClient(buildInnerClient().getUnionFloatLiterals()); + } + + /** + * Builds an instance of RequiredAndOptionalClient class. + * + * @return an instance of RequiredAndOptionalClient. + */ + @Generated + public RequiredAndOptionalClient buildRequiredAndOptionalClient() { + return new RequiredAndOptionalClient(buildInnerClient().getRequiredAndOptionals()); + } + + private static final ClientLogger LOGGER = new ClientLogger(OptionalClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateAsyncClient.java new file mode 100644 index 00000000000..629dc5073cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.PlainDatesImpl; +import type.property.optional.models.PlainDateProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class PlainDateAsyncClient { + @Generated + private final PlainDatesImpl serviceClient; + + /** + * Initializes an instance of PlainDateAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PlainDateAsyncClient(PlainDatesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PlainDateProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PlainDateProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(PlainDateProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(PlainDateProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateClient.java new file mode 100644 index 00000000000..21c61dd509b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainDateClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.PlainDatesImpl; +import type.property.optional.models.PlainDateProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class PlainDateClient { + @Generated + private final PlainDatesImpl serviceClient; + + /** + * Initializes an instance of PlainDateClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PlainDateClient(PlainDatesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PlainDateProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(PlainDateProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PlainDateProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(PlainDateProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(PlainDateProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(PlainDateProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeAsyncClient.java new file mode 100644 index 00000000000..b60d7519821 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.PlainTimesImpl; +import type.property.optional.models.PlainTimeProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class PlainTimeAsyncClient { + @Generated + private final PlainTimesImpl serviceClient; + + /** + * Initializes an instance of PlainTimeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PlainTimeAsyncClient(PlainTimesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PlainTimeProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PlainTimeProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(PlainTimeProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(PlainTimeProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeClient.java new file mode 100644 index 00000000000..e4bad0562c7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/PlainTimeClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.PlainTimesImpl; +import type.property.optional.models.PlainTimeProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class PlainTimeClient { + @Generated + private final PlainTimesImpl serviceClient; + + /** + * Initializes an instance of PlainTimeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + PlainTimeClient(PlainTimesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PlainTimeProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(PlainTimeProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PlainTimeProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(PlainTimeProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(PlainTimeProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(PlainTimeProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalAsyncClient.java new file mode 100644 index 00000000000..d8588abb66e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalAsyncClient.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.RequiredAndOptionalsImpl; +import type.property.optional.models.RequiredAndOptionalProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class RequiredAndOptionalAsyncClient { + @Generated + private final RequiredAndOptionalsImpl serviceClient; + + /** + * Initializes an instance of RequiredAndOptionalAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RequiredAndOptionalAsyncClient(RequiredAndOptionalsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return only the required properties. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return only the required properties along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRequiredOnlyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getRequiredOnlyWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with only required properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putRequiredOnlyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putRequiredOnlyWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(RequiredAndOptionalProperty.class)); + } + + /** + * Get models that will return only the required properties. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return only the required properties on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getRequiredOnly() { + // Generated convenience method for getRequiredOnlyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRequiredOnlyWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(RequiredAndOptionalProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(RequiredAndOptionalProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with only required properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putRequiredOnly(RequiredAndOptionalProperty body) { + // Generated convenience method for putRequiredOnlyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putRequiredOnlyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalClient.java new file mode 100644 index 00000000000..7bc786f1278 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/RequiredAndOptionalClient.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.RequiredAndOptionalsImpl; +import type.property.optional.models.RequiredAndOptionalProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class RequiredAndOptionalClient { + @Generated + private final RequiredAndOptionalsImpl serviceClient; + + /** + * Initializes an instance of RequiredAndOptionalClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RequiredAndOptionalClient(RequiredAndOptionalsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return only the required properties. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return only the required properties along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRequiredOnlyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getRequiredOnlyWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with only required properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putRequiredOnlyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putRequiredOnlyWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public RequiredAndOptionalProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(RequiredAndOptionalProperty.class); + } + + /** + * Get models that will return only the required properties. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return only the required properties. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public RequiredAndOptionalProperty getRequiredOnly() { + // Generated convenience method for getRequiredOnlyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRequiredOnlyWithResponse(requestOptions).getValue().toObject(RequiredAndOptionalProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(RequiredAndOptionalProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with only required properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putRequiredOnly(RequiredAndOptionalProperty body) { + // Generated convenience method for putRequiredOnlyWithResponse + RequestOptions requestOptions = new RequestOptions(); + putRequiredOnlyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralAsyncClient.java new file mode 100644 index 00000000000..760503f7185 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.StringLiteralsImpl; +import type.property.optional.models.StringLiteralProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class StringLiteralAsyncClient { + @Generated + private final StringLiteralsImpl serviceClient; + + /** + * Initializes an instance of StringLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringLiteralAsyncClient(StringLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(StringLiteralProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(StringLiteralProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(StringLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(StringLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralClient.java new file mode 100644 index 00000000000..8b1d61dbdd7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringLiteralClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.StringLiteralsImpl; +import type.property.optional.models.StringLiteralProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class StringLiteralClient { + @Generated + private final StringLiteralsImpl serviceClient; + + /** + * Initializes an instance of StringLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringLiteralClient(StringLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public StringLiteralProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(StringLiteralProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public StringLiteralProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(StringLiteralProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(StringLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(StringLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationAsyncClient.java new file mode 100644 index 00000000000..2c585627e91 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.StringOperationsImpl; +import type.property.optional.models.StringProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class StringOperationAsyncClient { + @Generated + private final StringOperationsImpl serviceClient; + + /** + * Initializes an instance of StringOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringOperationAsyncClient(StringOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(StringProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(StringProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(StringProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(StringProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationClient.java new file mode 100644 index 00000000000..fe5ba11b2a7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/StringOperationClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.StringOperationsImpl; +import type.property.optional.models.StringProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class StringOperationClient { + @Generated + private final StringOperationsImpl serviceClient; + + /** + * Initializes an instance of StringOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringOperationClient(StringOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public StringProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(StringProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public StringProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(StringProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(StringProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(StringProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralAsyncClient.java new file mode 100644 index 00000000000..e5f5d21cdab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.UnionFloatLiteralsImpl; +import type.property.optional.models.UnionFloatLiteralProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class UnionFloatLiteralAsyncClient { + @Generated + private final UnionFloatLiteralsImpl serviceClient; + + /** + * Initializes an instance of UnionFloatLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionFloatLiteralAsyncClient(UnionFloatLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnionFloatLiteralProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnionFloatLiteralProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(UnionFloatLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(UnionFloatLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralClient.java new file mode 100644 index 00000000000..cf6f37ad30b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionFloatLiteralClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.UnionFloatLiteralsImpl; +import type.property.optional.models.UnionFloatLiteralProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class UnionFloatLiteralClient { + @Generated + private final UnionFloatLiteralsImpl serviceClient; + + /** + * Initializes an instance of UnionFloatLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionFloatLiteralClient(UnionFloatLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnionFloatLiteralProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(UnionFloatLiteralProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnionFloatLiteralProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(UnionFloatLiteralProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(UnionFloatLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(UnionFloatLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralAsyncClient.java new file mode 100644 index 00000000000..e454bcd3bd3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.UnionIntLiteralsImpl; +import type.property.optional.models.UnionIntLiteralProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class UnionIntLiteralAsyncClient { + @Generated + private final UnionIntLiteralsImpl serviceClient; + + /** + * Initializes an instance of UnionIntLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionIntLiteralAsyncClient(UnionIntLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnionIntLiteralProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnionIntLiteralProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(UnionIntLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(UnionIntLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralClient.java new file mode 100644 index 00000000000..b1766d8854a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionIntLiteralClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.UnionIntLiteralsImpl; +import type.property.optional.models.UnionIntLiteralProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class UnionIntLiteralClient { + @Generated + private final UnionIntLiteralsImpl serviceClient; + + /** + * Initializes an instance of UnionIntLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionIntLiteralClient(UnionIntLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnionIntLiteralProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(UnionIntLiteralProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnionIntLiteralProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(UnionIntLiteralProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(UnionIntLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(UnionIntLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralAsyncClient.java new file mode 100644 index 00000000000..b503358b1d9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralAsyncClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.optional.implementation.UnionStringLiteralsImpl; +import type.property.optional.models.UnionStringLiteralProperty; + +/** + * Initializes a new instance of the asynchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class, isAsync = true) +public final class UnionStringLiteralAsyncClient { + @Generated + private final UnionStringLiteralsImpl serviceClient; + + /** + * Initializes an instance of UnionStringLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionStringLiteralAsyncClient(UnionStringLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponseAsync(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponseAsync(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponseAsync(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponseAsync(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnionStringLiteralProperty.class)); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnionStringLiteralProperty.class)); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putAll(UnionStringLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putAllWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono putDefault(UnionStringLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralClient.java new file mode 100644 index 00000000000..3d9be4a21a2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/UnionStringLiteralClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.optional.implementation.UnionStringLiteralsImpl; +import type.property.optional.models.UnionStringLiteralProperty; + +/** + * Initializes a new instance of the synchronous OptionalClient type. + */ +@ServiceClient(builder = OptionalClientBuilder.class) +public final class UnionStringLiteralClient { + @Generated + private final UnionStringLiteralsImpl serviceClient; + + /** + * Initializes an instance of UnionStringLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionStringLiteralClient(UnionStringLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getAllWithResponse(requestOptions); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getDefaultWithResponse(requestOptions); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putAllWithResponse(body, requestOptions); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putDefaultWithResponse(body, requestOptions); + } + + /** + * Get models that will return all properties in the model. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return all properties in the model. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnionStringLiteralProperty getAll() { + // Generated convenience method for getAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getAllWithResponse(requestOptions).getValue().toObject(UnionStringLiteralProperty.class); + } + + /** + * Get models that will return the default object. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return models that will return the default object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnionStringLiteralProperty getDefault() { + // Generated convenience method for getDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDefaultWithResponse(requestOptions).getValue().toObject(UnionStringLiteralProperty.class); + } + + /** + * Put a body with all properties present. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putAll(UnionStringLiteralProperty body) { + // Generated convenience method for putAllWithResponse + RequestOptions requestOptions = new RequestOptions(); + putAllWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * Put a body with default properties. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void putDefault(UnionStringLiteralProperty body) { + // Generated convenience method for putDefaultWithResponse + RequestOptions requestOptions = new RequestOptions(); + putDefaultWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BooleanLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BooleanLiteralsImpl.java new file mode 100644 index 00000000000..143fdda9060 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BooleanLiteralsImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BooleanLiterals. + */ +public final class BooleanLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BooleanLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of BooleanLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BooleanLiteralsImpl(OptionalClientImpl client) { + this.service + = RestProxy.create(BooleanLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientBooleanLiterals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientBooleanLiterals") + public interface BooleanLiteralsService { + @Get("/type/property/optional/boolean/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/boolean/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/boolean/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/boolean/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/boolean/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/boolean/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/boolean/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/boolean/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(true) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BytesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BytesImpl.java new file mode 100644 index 00000000000..3251214372d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/BytesImpl.java @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Bytes. + */ +public final class BytesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BytesService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of BytesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BytesImpl(OptionalClientImpl client) { + this.service = RestProxy.create(BytesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientBytes to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientBytes") + public interface BytesService { + @Get("/type/property/optional/bytes/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/bytes/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/bytes/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/bytes/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/bytes/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/bytes/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/bytes/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/bytes/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsBytesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsBytesImpl.java new file mode 100644 index 00000000000..a74b413e7f5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsBytesImpl.java @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CollectionsBytes. + */ +public final class CollectionsBytesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final CollectionsBytesService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of CollectionsBytesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionsBytesImpl(OptionalClientImpl client) { + this.service + = RestProxy.create(CollectionsBytesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientCollectionsBytes to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientCollectionsBytes") + public interface CollectionsBytesService { + @Get("/type/property/optional/collections/bytes/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/collections/bytes/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/collections/bytes/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/collections/bytes/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/collections/bytes/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/collections/bytes/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/collections/bytes/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/collections/bytes/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *         byte[] (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsModelsImpl.java new file mode 100644 index 00000000000..72e45db4dd9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/CollectionsModelsImpl.java @@ -0,0 +1,380 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CollectionsModels. + */ +public final class CollectionsModelsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final CollectionsModelsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of CollectionsModelsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionsModelsImpl(OptionalClientImpl client) { + this.service + = RestProxy.create(CollectionsModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientCollectionsModels to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientCollectionsModels") + public interface CollectionsModelsService { + @Get("/type/property/optional/collections/model/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/collections/model/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/collections/model/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/collections/model/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/collections/model/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/collections/model/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/collections/model/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/collections/model/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Optional): [
+     *          (Optional){
+     *             property: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DatetimeOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DatetimeOperationsImpl.java new file mode 100644 index 00000000000..3d28876cb7a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DatetimeOperationsImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DatetimeOperations. + */ +public final class DatetimeOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DatetimeOperationsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of DatetimeOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatetimeOperationsImpl(OptionalClientImpl client) { + this.service = RestProxy.create(DatetimeOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientDatetimeOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientDatetimeOperations") + public interface DatetimeOperationsService { + @Get("/type/property/optional/datetime/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/datetime/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/datetime/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/datetime/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/datetime/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/datetime/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/datetime/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/datetime/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DurationOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DurationOperationsImpl.java new file mode 100644 index 00000000000..65b1e975592 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/DurationOperationsImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DurationOperations. + */ +public final class DurationOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DurationOperationsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of DurationOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DurationOperationsImpl(OptionalClientImpl client) { + this.service = RestProxy.create(DurationOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientDurationOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientDurationOperations") + public interface DurationOperationsService { + @Get("/type/property/optional/duration/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/duration/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/duration/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/duration/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/duration/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/duration/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/duration/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/duration/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/FloatLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/FloatLiteralsImpl.java new file mode 100644 index 00000000000..2b4da625bf5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/FloatLiteralsImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FloatLiterals. + */ +public final class FloatLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FloatLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of FloatLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FloatLiteralsImpl(OptionalClientImpl client) { + this.service + = RestProxy.create(FloatLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientFloatLiterals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientFloatLiterals") + public interface FloatLiteralsService { + @Get("/type/property/optional/float/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/float/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/float/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/float/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/float/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/float/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/float/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/float/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/IntLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/IntLiteralsImpl.java new file mode 100644 index 00000000000..d1221cb8298 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/IntLiteralsImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in IntLiterals. + */ +public final class IntLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final IntLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of IntLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IntLiteralsImpl(OptionalClientImpl client) { + this.service + = RestProxy.create(IntLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientIntLiterals to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientIntLiterals") + public interface IntLiteralsService { + @Get("/type/property/optional/int/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/int/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/int/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/int/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/int/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/int/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/int/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/int/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/OptionalClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/OptionalClientImpl.java new file mode 100644 index 00000000000..94201d25ad4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/OptionalClientImpl.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 OptionalClient type. + */ +public final class OptionalClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 StringOperationsImpl object to access its operations. + */ + private final StringOperationsImpl stringOperations; + + /** + * Gets the StringOperationsImpl object to access its operations. + * + * @return the StringOperationsImpl object. + */ + public StringOperationsImpl getStringOperations() { + return this.stringOperations; + } + + /** + * The BytesImpl object to access its operations. + */ + private final BytesImpl bytes; + + /** + * Gets the BytesImpl object to access its operations. + * + * @return the BytesImpl object. + */ + public BytesImpl getBytes() { + return this.bytes; + } + + /** + * The DatetimeOperationsImpl object to access its operations. + */ + private final DatetimeOperationsImpl datetimeOperations; + + /** + * Gets the DatetimeOperationsImpl object to access its operations. + * + * @return the DatetimeOperationsImpl object. + */ + public DatetimeOperationsImpl getDatetimeOperations() { + return this.datetimeOperations; + } + + /** + * The DurationOperationsImpl object to access its operations. + */ + private final DurationOperationsImpl durationOperations; + + /** + * Gets the DurationOperationsImpl object to access its operations. + * + * @return the DurationOperationsImpl object. + */ + public DurationOperationsImpl getDurationOperations() { + return this.durationOperations; + } + + /** + * The PlainDatesImpl object to access its operations. + */ + private final PlainDatesImpl plainDates; + + /** + * Gets the PlainDatesImpl object to access its operations. + * + * @return the PlainDatesImpl object. + */ + public PlainDatesImpl getPlainDates() { + return this.plainDates; + } + + /** + * The PlainTimesImpl object to access its operations. + */ + private final PlainTimesImpl plainTimes; + + /** + * Gets the PlainTimesImpl object to access its operations. + * + * @return the PlainTimesImpl object. + */ + public PlainTimesImpl getPlainTimes() { + return this.plainTimes; + } + + /** + * The CollectionsBytesImpl object to access its operations. + */ + private final CollectionsBytesImpl collectionsBytes; + + /** + * Gets the CollectionsBytesImpl object to access its operations. + * + * @return the CollectionsBytesImpl object. + */ + public CollectionsBytesImpl getCollectionsBytes() { + return this.collectionsBytes; + } + + /** + * The CollectionsModelsImpl object to access its operations. + */ + private final CollectionsModelsImpl collectionsModels; + + /** + * Gets the CollectionsModelsImpl object to access its operations. + * + * @return the CollectionsModelsImpl object. + */ + public CollectionsModelsImpl getCollectionsModels() { + return this.collectionsModels; + } + + /** + * The StringLiteralsImpl object to access its operations. + */ + private final StringLiteralsImpl stringLiterals; + + /** + * Gets the StringLiteralsImpl object to access its operations. + * + * @return the StringLiteralsImpl object. + */ + public StringLiteralsImpl getStringLiterals() { + return this.stringLiterals; + } + + /** + * The IntLiteralsImpl object to access its operations. + */ + private final IntLiteralsImpl intLiterals; + + /** + * Gets the IntLiteralsImpl object to access its operations. + * + * @return the IntLiteralsImpl object. + */ + public IntLiteralsImpl getIntLiterals() { + return this.intLiterals; + } + + /** + * The FloatLiteralsImpl object to access its operations. + */ + private final FloatLiteralsImpl floatLiterals; + + /** + * Gets the FloatLiteralsImpl object to access its operations. + * + * @return the FloatLiteralsImpl object. + */ + public FloatLiteralsImpl getFloatLiterals() { + return this.floatLiterals; + } + + /** + * The BooleanLiteralsImpl object to access its operations. + */ + private final BooleanLiteralsImpl booleanLiterals; + + /** + * Gets the BooleanLiteralsImpl object to access its operations. + * + * @return the BooleanLiteralsImpl object. + */ + public BooleanLiteralsImpl getBooleanLiterals() { + return this.booleanLiterals; + } + + /** + * The UnionStringLiteralsImpl object to access its operations. + */ + private final UnionStringLiteralsImpl unionStringLiterals; + + /** + * Gets the UnionStringLiteralsImpl object to access its operations. + * + * @return the UnionStringLiteralsImpl object. + */ + public UnionStringLiteralsImpl getUnionStringLiterals() { + return this.unionStringLiterals; + } + + /** + * The UnionIntLiteralsImpl object to access its operations. + */ + private final UnionIntLiteralsImpl unionIntLiterals; + + /** + * Gets the UnionIntLiteralsImpl object to access its operations. + * + * @return the UnionIntLiteralsImpl object. + */ + public UnionIntLiteralsImpl getUnionIntLiterals() { + return this.unionIntLiterals; + } + + /** + * The UnionFloatLiteralsImpl object to access its operations. + */ + private final UnionFloatLiteralsImpl unionFloatLiterals; + + /** + * Gets the UnionFloatLiteralsImpl object to access its operations. + * + * @return the UnionFloatLiteralsImpl object. + */ + public UnionFloatLiteralsImpl getUnionFloatLiterals() { + return this.unionFloatLiterals; + } + + /** + * The RequiredAndOptionalsImpl object to access its operations. + */ + private final RequiredAndOptionalsImpl requiredAndOptionals; + + /** + * Gets the RequiredAndOptionalsImpl object to access its operations. + * + * @return the RequiredAndOptionalsImpl object. + */ + public RequiredAndOptionalsImpl getRequiredAndOptionals() { + return this.requiredAndOptionals; + } + + /** + * Initializes an instance of OptionalClient client. + * + * @param endpoint Service host. + */ + public OptionalClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of OptionalClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public OptionalClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of OptionalClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public OptionalClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.stringOperations = new StringOperationsImpl(this); + this.bytes = new BytesImpl(this); + this.datetimeOperations = new DatetimeOperationsImpl(this); + this.durationOperations = new DurationOperationsImpl(this); + this.plainDates = new PlainDatesImpl(this); + this.plainTimes = new PlainTimesImpl(this); + this.collectionsBytes = new CollectionsBytesImpl(this); + this.collectionsModels = new CollectionsModelsImpl(this); + this.stringLiterals = new StringLiteralsImpl(this); + this.intLiterals = new IntLiteralsImpl(this); + this.floatLiterals = new FloatLiteralsImpl(this); + this.booleanLiterals = new BooleanLiteralsImpl(this); + this.unionStringLiterals = new UnionStringLiteralsImpl(this); + this.unionIntLiterals = new UnionIntLiteralsImpl(this); + this.unionFloatLiterals = new UnionFloatLiteralsImpl(this); + this.requiredAndOptionals = new RequiredAndOptionalsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainDatesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainDatesImpl.java new file mode 100644 index 00000000000..81677c3cd2b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainDatesImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PlainDates. + */ +public final class PlainDatesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PlainDatesService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of PlainDatesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PlainDatesImpl(OptionalClientImpl client) { + this.service + = RestProxy.create(PlainDatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientPlainDates to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientPlainDates") + public interface PlainDatesService { + @Get("/type/property/optional/plainDate/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/plainDate/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/plainDate/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/plainDate/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/plainDate/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/plainDate/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/plainDate/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/plainDate/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: LocalDate (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainTimesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainTimesImpl.java new file mode 100644 index 00000000000..7aa7284829f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/PlainTimesImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in PlainTimes. + */ +public final class PlainTimesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final PlainTimesService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of PlainTimesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PlainTimesImpl(OptionalClientImpl client) { + this.service + = RestProxy.create(PlainTimesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientPlainTimes to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientPlainTimes") + public interface PlainTimesService { + @Get("/type/property/optional/plainTime/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/plainTime/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/plainTime/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/plainTime/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/plainTime/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/plainTime/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/plainTime/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/plainTime/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/RequiredAndOptionalsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/RequiredAndOptionalsImpl.java new file mode 100644 index 00000000000..1295973a803 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/RequiredAndOptionalsImpl.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RequiredAndOptionals. + */ +public final class RequiredAndOptionalsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RequiredAndOptionalsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of RequiredAndOptionalsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RequiredAndOptionalsImpl(OptionalClientImpl client) { + this.service = RestProxy.create(RequiredAndOptionalsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientRequiredAndOptionals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientRequiredAndOptionals") + public interface RequiredAndOptionalsService { + @Get("/type/property/optional/requiredAndOptional/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/requiredAndOptional/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/requiredAndOptional/requiredOnly") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getRequiredOnly(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/requiredAndOptional/requiredOnly") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getRequiredOnlySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/requiredAndOptional/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/requiredAndOptional/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/requiredAndOptional/requiredOnly") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putRequiredOnly(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/requiredAndOptional/requiredOnly") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putRequiredOnlySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return only the required properties. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return only the required properties along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRequiredOnlyWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getRequiredOnly(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return only the required properties. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return only the required properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRequiredOnlyWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getRequiredOnlySync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with only required properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putRequiredOnlyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putRequiredOnly(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with only required properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     optionalProperty: String (Optional)
+     *     requiredProperty: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putRequiredOnlyWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putRequiredOnlySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringLiteralsImpl.java new file mode 100644 index 00000000000..b24c53f9c0a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringLiteralsImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringLiterals. + */ +public final class StringLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of StringLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringLiteralsImpl(OptionalClientImpl client) { + this.service + = RestProxy.create(StringLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientStringLiterals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientStringLiterals") + public interface StringLiteralsService { + @Get("/type/property/optional/string/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/string/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/string/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/string/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/string/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/string/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/string/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/string/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringOperationsImpl.java new file mode 100644 index 00000000000..a8c3edf48fa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/StringOperationsImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringOperations. + */ +public final class StringOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringOperationsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of StringOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringOperationsImpl(OptionalClientImpl client) { + this.service + = RestProxy.create(StringOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientStringOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientStringOperations") + public interface StringOperationsService { + @Get("/type/property/optional/string/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/string/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/string/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/string/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/string/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/string/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/string/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/string/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionFloatLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionFloatLiteralsImpl.java new file mode 100644 index 00000000000..4e36b16d121 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionFloatLiteralsImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnionFloatLiterals. + */ +public final class UnionFloatLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnionFloatLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of UnionFloatLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnionFloatLiteralsImpl(OptionalClientImpl client) { + this.service = RestProxy.create(UnionFloatLiteralsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientUnionFloatLiterals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientUnionFloatLiterals") + public interface UnionFloatLiteralsService { + @Get("/type/property/optional/union/float/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/union/float/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/union/float/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/union/float/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/union/float/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/union/float/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/union/float/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/union/float/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1.25/2.375) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionIntLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionIntLiteralsImpl.java new file mode 100644 index 00000000000..1818f04350f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionIntLiteralsImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnionIntLiterals. + */ +public final class UnionIntLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnionIntLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of UnionIntLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnionIntLiteralsImpl(OptionalClientImpl client) { + this.service + = RestProxy.create(UnionIntLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientUnionIntLiterals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientUnionIntLiterals") + public interface UnionIntLiteralsService { + @Get("/type/property/optional/union/int/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/union/int/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/union/int/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/union/int/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/union/int/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/union/int/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/union/int/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/union/int/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(1/2) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionStringLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionStringLiteralsImpl.java new file mode 100644 index 00000000000..eabb37ea23d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/UnionStringLiteralsImpl.java @@ -0,0 +1,348 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnionStringLiterals. + */ +public final class UnionStringLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnionStringLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final OptionalClientImpl client; + + /** + * Initializes an instance of UnionStringLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnionStringLiteralsImpl(OptionalClientImpl client) { + this.service = RestProxy.create(UnionStringLiteralsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for OptionalClientUnionStringLiterals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "OptionalClientUnionStringLiterals") + public interface UnionStringLiteralsService { + @Get("/type/property/optional/union/string/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getAll(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/union/string/literal/all") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getAllSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/union/string/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/property/optional/union/string/literal/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/union/string/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putAll(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/union/string/literal/all") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putAllSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/union/string/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> putDefault(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/optional/union/string/literal/default") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putDefaultSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAll(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return all properties in the model. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return all properties in the model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAllWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getAllSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDefaultWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDefault(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get models that will return the default object. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return models that will return the default object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDefaultSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putAllWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putAll(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with all properties present. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putAllWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putAllSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putDefaultWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.putDefault(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put a body with default properties. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putDefaultWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putDefaultSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/package-info.java new file mode 100644 index 00000000000..95e1d23851f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Optional. + * Illustrates models with optional properties. + * + */ +package type.property.optional.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralProperty.java new file mode 100644 index 00000000000..5e79b380e83 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralProperty.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with boolean literal property. + */ +@Fluent +public final class BooleanLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private BooleanLiteralPropertyProperty property; + + /** + * Creates an instance of BooleanLiteralProperty class. + */ + @Generated + public BooleanLiteralProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public BooleanLiteralPropertyProperty getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the BooleanLiteralProperty object itself. + */ + @Generated + public BooleanLiteralProperty setProperty(BooleanLiteralPropertyProperty property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("property", this.property == null ? null : this.property.toBoolean()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BooleanLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BooleanLiteralProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the BooleanLiteralProperty. + */ + @Generated + public static BooleanLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BooleanLiteralProperty deserializedBooleanLiteralProperty = new BooleanLiteralProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedBooleanLiteralProperty.property + = BooleanLiteralPropertyProperty.fromBoolean(reader.getBoolean()); + } else { + reader.skipChildren(); + } + } + + return deserializedBooleanLiteralProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralPropertyProperty.java new file mode 100644 index 00000000000..fb21e83d316 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BooleanLiteralPropertyProperty.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +/** + * Defines values for BooleanLiteralPropertyProperty. + */ +public enum BooleanLiteralPropertyProperty { + /** + * Enum value true. + */ + TRUE(true); + + /** + * The actual serialized value for a BooleanLiteralPropertyProperty instance. + */ + private final boolean value; + + BooleanLiteralPropertyProperty(boolean value) { + this.value = value; + } + + /** + * Parses a serialized value to a BooleanLiteralPropertyProperty instance. + * + * @param value the serialized value to parse. + * @return the parsed BooleanLiteralPropertyProperty object, or null if unable to parse. + */ + public static BooleanLiteralPropertyProperty fromBoolean(boolean value) { + BooleanLiteralPropertyProperty[] items = BooleanLiteralPropertyProperty.values(); + for (BooleanLiteralPropertyProperty item : items) { + if (item.toBoolean() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to boolean value. + * + * @return the boolean value. + */ + public boolean toBoolean() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BytesProperty.java new file mode 100644 index 00000000000..6a6181c64bb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/BytesProperty.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Template type for testing models with optional property. Pass in the type of the property you are looking for. + */ +@Fluent +public final class BytesProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private byte[] property; + + /** + * Creates an instance of BytesProperty class. + */ + @Generated + public BytesProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public byte[] getProperty() { + return CoreUtils.clone(this.property); + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the BytesProperty object itself. + */ + @Generated + public BytesProperty setProperty(byte[] property) { + this.property = CoreUtils.clone(property); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBinaryField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BytesProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BytesProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BytesProperty. + */ + @Generated + public static BytesProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BytesProperty deserializedBytesProperty = new BytesProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedBytesProperty.property = reader.getBinary(); + } else { + reader.skipChildren(); + } + } + + return deserializedBytesProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsByteProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsByteProperty.java new file mode 100644 index 00000000000..121200b2437 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsByteProperty.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Model with collection bytes properties. + */ +@Fluent +public final class CollectionsByteProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private List property; + + /** + * Creates an instance of CollectionsByteProperty class. + */ + @Generated + public CollectionsByteProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public List getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the CollectionsByteProperty object itself. + */ + @Generated + public CollectionsByteProperty setProperty(List property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("property", this.property, (writer, element) -> writer.writeBinary(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CollectionsByteProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CollectionsByteProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the CollectionsByteProperty. + */ + @Generated + public static CollectionsByteProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CollectionsByteProperty deserializedCollectionsByteProperty = new CollectionsByteProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + List property = reader.readArray(reader1 -> reader1.getBinary()); + deserializedCollectionsByteProperty.property = property; + } else { + reader.skipChildren(); + } + } + + return deserializedCollectionsByteProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsModelProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsModelProperty.java new file mode 100644 index 00000000000..de2e57c216b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/CollectionsModelProperty.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Model with collection models properties. + */ +@Fluent +public final class CollectionsModelProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private List property; + + /** + * Creates an instance of CollectionsModelProperty class. + */ + @Generated + public CollectionsModelProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public List getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the CollectionsModelProperty object itself. + */ + @Generated + public CollectionsModelProperty setProperty(List property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("property", this.property, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CollectionsModelProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CollectionsModelProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CollectionsModelProperty. + */ + @Generated + public static CollectionsModelProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CollectionsModelProperty deserializedCollectionsModelProperty = new CollectionsModelProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + List property = reader.readArray(reader1 -> StringProperty.fromJson(reader1)); + deserializedCollectionsModelProperty.property = property; + } else { + reader.skipChildren(); + } + } + + return deserializedCollectionsModelProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DatetimeProperty.java new file mode 100644 index 00000000000..be3594c8a5e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DatetimeProperty.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Model with a datetime property. + */ +@Fluent +public final class DatetimeProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private OffsetDateTime property; + + /** + * Creates an instance of DatetimeProperty class. + */ + @Generated + public DatetimeProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public OffsetDateTime getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the DatetimeProperty object itself. + */ + @Generated + public DatetimeProperty setProperty(OffsetDateTime property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", + this.property == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.property)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatetimeProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatetimeProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DatetimeProperty. + */ + @Generated + public static DatetimeProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatetimeProperty deserializedDatetimeProperty = new DatetimeProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedDatetimeProperty.property = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDatetimeProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DurationProperty.java new file mode 100644 index 00000000000..dc88425a4ee --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/DurationProperty.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; + +/** + * Model with a duration property. + */ +@Fluent +public final class DurationProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private Duration property; + + /** + * Creates an instance of DurationProperty class. + */ + @Generated + public DurationProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public Duration getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the DurationProperty object itself. + */ + @Generated + public DurationProperty setProperty(Duration property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", CoreUtils.durationToStringWithDays(this.property)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DurationProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DurationProperty. + */ + @Generated + public static DurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DurationProperty deserializedDurationProperty = new DurationProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedDurationProperty.property + = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDurationProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralProperty.java new file mode 100644 index 00000000000..3502ff9f412 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralProperty.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with float literal property. + */ +@Fluent +public final class FloatLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private FloatLiteralPropertyProperty property; + + /** + * Creates an instance of FloatLiteralProperty class. + */ + @Generated + public FloatLiteralProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public FloatLiteralPropertyProperty getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the FloatLiteralProperty object itself. + */ + @Generated + public FloatLiteralProperty setProperty(FloatLiteralPropertyProperty property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("property", this.property == null ? null : this.property.toDouble()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FloatLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FloatLiteralProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the FloatLiteralProperty. + */ + @Generated + public static FloatLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FloatLiteralProperty deserializedFloatLiteralProperty = new FloatLiteralProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedFloatLiteralProperty.property + = FloatLiteralPropertyProperty.fromDouble(reader.getDouble()); + } else { + reader.skipChildren(); + } + } + + return deserializedFloatLiteralProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralPropertyProperty.java new file mode 100644 index 00000000000..f52f360a7d8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/FloatLiteralPropertyProperty.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +/** + * Defines values for FloatLiteralPropertyProperty. + */ +public enum FloatLiteralPropertyProperty { + /** + * Enum value 1.25. + */ + ONE_TWO_FIVE(1.25); + + /** + * The actual serialized value for a FloatLiteralPropertyProperty instance. + */ + private final double value; + + FloatLiteralPropertyProperty(double value) { + this.value = value; + } + + /** + * Parses a serialized value to a FloatLiteralPropertyProperty instance. + * + * @param value the serialized value to parse. + * @return the parsed FloatLiteralPropertyProperty object, or null if unable to parse. + */ + public static FloatLiteralPropertyProperty fromDouble(double value) { + FloatLiteralPropertyProperty[] items = FloatLiteralPropertyProperty.values(); + for (FloatLiteralPropertyProperty item : items) { + if (Double.doubleToLongBits(item.toDouble()) == Double.doubleToLongBits(value)) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to double value. + * + * @return the double value. + */ + public double toDouble() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralProperty.java new file mode 100644 index 00000000000..c91cdc59657 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralProperty.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with int literal property. + */ +@Fluent +public final class IntLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private IntLiteralPropertyProperty property; + + /** + * Creates an instance of IntLiteralProperty class. + */ + @Generated + public IntLiteralProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public IntLiteralPropertyProperty getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the IntLiteralProperty object itself. + */ + @Generated + public IntLiteralProperty setProperty(IntLiteralPropertyProperty property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("property", this.property == null ? null : this.property.toInt()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IntLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IntLiteralProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the IntLiteralProperty. + */ + @Generated + public static IntLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IntLiteralProperty deserializedIntLiteralProperty = new IntLiteralProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedIntLiteralProperty.property = IntLiteralPropertyProperty.fromInt(reader.getInt()); + } else { + reader.skipChildren(); + } + } + + return deserializedIntLiteralProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralPropertyProperty.java new file mode 100644 index 00000000000..2b5ec41e17c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/IntLiteralPropertyProperty.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +/** + * Defines values for IntLiteralPropertyProperty. + */ +public enum IntLiteralPropertyProperty { + /** + * Enum value 1. + */ + ONE(1); + + /** + * The actual serialized value for a IntLiteralPropertyProperty instance. + */ + private final int value; + + IntLiteralPropertyProperty(int value) { + this.value = value; + } + + /** + * Parses a serialized value to a IntLiteralPropertyProperty instance. + * + * @param value the serialized value to parse. + * @return the parsed IntLiteralPropertyProperty object, or null if unable to parse. + */ + public static IntLiteralPropertyProperty fromInt(int value) { + IntLiteralPropertyProperty[] items = IntLiteralPropertyProperty.values(); + for (IntLiteralPropertyProperty item : items) { + if (item.toInt() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to int value. + * + * @return the int value. + */ + public int toInt() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainDateProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainDateProperty.java new file mode 100644 index 00000000000..dc1ee163d81 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainDateProperty.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.LocalDate; +import java.util.Objects; + +/** + * Model with a plainDate property. + */ +@Fluent +public final class PlainDateProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private LocalDate property; + + /** + * Creates an instance of PlainDateProperty class. + */ + @Generated + public PlainDateProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public LocalDate getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the PlainDateProperty object itself. + */ + @Generated + public PlainDateProperty setProperty(LocalDate property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", Objects.toString(this.property, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PlainDateProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PlainDateProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PlainDateProperty. + */ + @Generated + public static PlainDateProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PlainDateProperty deserializedPlainDateProperty = new PlainDateProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedPlainDateProperty.property + = reader.getNullable(nonNullReader -> LocalDate.parse(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedPlainDateProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainTimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainTimeProperty.java new file mode 100644 index 00000000000..b61179179c2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/PlainTimeProperty.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a plainTime property. + */ +@Fluent +public final class PlainTimeProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private String property; + + /** + * Creates an instance of PlainTimeProperty class. + */ + @Generated + public PlainTimeProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public String getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the PlainTimeProperty object itself. + */ + @Generated + public PlainTimeProperty setProperty(String property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PlainTimeProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PlainTimeProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PlainTimeProperty. + */ + @Generated + public static PlainTimeProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PlainTimeProperty deserializedPlainTimeProperty = new PlainTimeProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedPlainTimeProperty.property = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPlainTimeProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/RequiredAndOptionalProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/RequiredAndOptionalProperty.java new file mode 100644 index 00000000000..671cf4f2496 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/RequiredAndOptionalProperty.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with required and optional properties. + */ +@Fluent +public final class RequiredAndOptionalProperty implements JsonSerializable { + /* + * optional string property + */ + @Generated + private String optionalProperty; + + /* + * required int property + */ + @Generated + private final int requiredProperty; + + /** + * Creates an instance of RequiredAndOptionalProperty class. + * + * @param requiredProperty the requiredProperty value to set. + */ + @Generated + public RequiredAndOptionalProperty(int requiredProperty) { + this.requiredProperty = requiredProperty; + } + + /** + * Get the optionalProperty property: optional string property. + * + * @return the optionalProperty value. + */ + @Generated + public String getOptionalProperty() { + return this.optionalProperty; + } + + /** + * Set the optionalProperty property: optional string property. + * + * @param optionalProperty the optionalProperty value to set. + * @return the RequiredAndOptionalProperty object itself. + */ + @Generated + public RequiredAndOptionalProperty setOptionalProperty(String optionalProperty) { + this.optionalProperty = optionalProperty; + return this; + } + + /** + * Get the requiredProperty property: required int property. + * + * @return the requiredProperty value. + */ + @Generated + public int getRequiredProperty() { + return this.requiredProperty; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("requiredProperty", this.requiredProperty); + jsonWriter.writeStringField("optionalProperty", this.optionalProperty); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequiredAndOptionalProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequiredAndOptionalProperty if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RequiredAndOptionalProperty. + */ + @Generated + public static RequiredAndOptionalProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int requiredProperty = 0; + String optionalProperty = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requiredProperty".equals(fieldName)) { + requiredProperty = reader.getInt(); + } else if ("optionalProperty".equals(fieldName)) { + optionalProperty = reader.getString(); + } else { + reader.skipChildren(); + } + } + RequiredAndOptionalProperty deserializedRequiredAndOptionalProperty + = new RequiredAndOptionalProperty(requiredProperty); + deserializedRequiredAndOptionalProperty.optionalProperty = optionalProperty; + + return deserializedRequiredAndOptionalProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralProperty.java new file mode 100644 index 00000000000..472e8daa6b2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralProperty.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with string literal property. + */ +@Fluent +public final class StringLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private StringLiteralPropertyProperty property; + + /** + * Creates an instance of StringLiteralProperty class. + */ + @Generated + public StringLiteralProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public StringLiteralPropertyProperty getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the StringLiteralProperty object itself. + */ + @Generated + public StringLiteralProperty setProperty(StringLiteralPropertyProperty property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StringLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StringLiteralProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the StringLiteralProperty. + */ + @Generated + public static StringLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StringLiteralProperty deserializedStringLiteralProperty = new StringLiteralProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedStringLiteralProperty.property + = StringLiteralPropertyProperty.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedStringLiteralProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralPropertyProperty.java new file mode 100644 index 00000000000..cbaebc95a3d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringLiteralPropertyProperty.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +/** + * Defines values for StringLiteralPropertyProperty. + */ +public enum StringLiteralPropertyProperty { + /** + * Enum value hello. + */ + HELLO("hello"); + + /** + * The actual serialized value for a StringLiteralPropertyProperty instance. + */ + private final String value; + + StringLiteralPropertyProperty(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a StringLiteralPropertyProperty instance. + * + * @param value the serialized value to parse. + * @return the parsed StringLiteralPropertyProperty object, or null if unable to parse. + */ + public static StringLiteralPropertyProperty fromString(String value) { + if (value == null) { + return null; + } + StringLiteralPropertyProperty[] items = StringLiteralPropertyProperty.values(); + for (StringLiteralPropertyProperty item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringProperty.java new file mode 100644 index 00000000000..6d8740a245a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/StringProperty.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Template type for testing models with optional property. Pass in the type of the property you are looking for. + */ +@Fluent +public final class StringProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private String property; + + /** + * Creates an instance of StringProperty class. + */ + @Generated + public StringProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public String getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the StringProperty object itself. + */ + @Generated + public StringProperty setProperty(String property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StringProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StringProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the StringProperty. + */ + @Generated + public static StringProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StringProperty deserializedStringProperty = new StringProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedStringProperty.property = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStringProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralProperty.java new file mode 100644 index 00000000000..773ce19ba68 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralProperty.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with union of float literal property. + */ +@Fluent +public final class UnionFloatLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private UnionFloatLiteralPropertyProperty property; + + /** + * Creates an instance of UnionFloatLiteralProperty class. + */ + @Generated + public UnionFloatLiteralProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public UnionFloatLiteralPropertyProperty getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the UnionFloatLiteralProperty object itself. + */ + @Generated + public UnionFloatLiteralProperty setProperty(UnionFloatLiteralPropertyProperty property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("property", this.property == null ? null : this.property.toDouble()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnionFloatLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnionFloatLiteralProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the UnionFloatLiteralProperty. + */ + @Generated + public static UnionFloatLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UnionFloatLiteralProperty deserializedUnionFloatLiteralProperty = new UnionFloatLiteralProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedUnionFloatLiteralProperty.property + = UnionFloatLiteralPropertyProperty.fromDouble(reader.getDouble()); + } else { + reader.skipChildren(); + } + } + + return deserializedUnionFloatLiteralProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralPropertyProperty.java new file mode 100644 index 00000000000..cfde1f7c170 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionFloatLiteralPropertyProperty.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +/** + * Defines values for UnionFloatLiteralPropertyProperty. + */ +public enum UnionFloatLiteralPropertyProperty { + /** + * Enum value 1.25. + */ + ONE_TWO_FIVE(1.25), + + /** + * Enum value 2.375. + */ + TWO_THREE_SEVEN_FIVE(2.375); + + /** + * The actual serialized value for a UnionFloatLiteralPropertyProperty instance. + */ + private final double value; + + UnionFloatLiteralPropertyProperty(double value) { + this.value = value; + } + + /** + * Parses a serialized value to a UnionFloatLiteralPropertyProperty instance. + * + * @param value the serialized value to parse. + * @return the parsed UnionFloatLiteralPropertyProperty object, or null if unable to parse. + */ + public static UnionFloatLiteralPropertyProperty fromDouble(double value) { + UnionFloatLiteralPropertyProperty[] items = UnionFloatLiteralPropertyProperty.values(); + for (UnionFloatLiteralPropertyProperty item : items) { + if (Double.doubleToLongBits(item.toDouble()) == Double.doubleToLongBits(value)) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to double value. + * + * @return the double value. + */ + public double toDouble() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralProperty.java new file mode 100644 index 00000000000..96237e2351b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralProperty.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with union of int literal property. + */ +@Fluent +public final class UnionIntLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private UnionIntLiteralPropertyProperty property; + + /** + * Creates an instance of UnionIntLiteralProperty class. + */ + @Generated + public UnionIntLiteralProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public UnionIntLiteralPropertyProperty getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the UnionIntLiteralProperty object itself. + */ + @Generated + public UnionIntLiteralProperty setProperty(UnionIntLiteralPropertyProperty property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("property", this.property == null ? null : this.property.toInt()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnionIntLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnionIntLiteralProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UnionIntLiteralProperty. + */ + @Generated + public static UnionIntLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UnionIntLiteralProperty deserializedUnionIntLiteralProperty = new UnionIntLiteralProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedUnionIntLiteralProperty.property + = UnionIntLiteralPropertyProperty.fromInt(reader.getInt()); + } else { + reader.skipChildren(); + } + } + + return deserializedUnionIntLiteralProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralPropertyProperty.java new file mode 100644 index 00000000000..703a2066b62 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionIntLiteralPropertyProperty.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +/** + * Defines values for UnionIntLiteralPropertyProperty. + */ +public enum UnionIntLiteralPropertyProperty { + /** + * Enum value 1. + */ + ONE(1), + + /** + * Enum value 2. + */ + TWO(2); + + /** + * The actual serialized value for a UnionIntLiteralPropertyProperty instance. + */ + private final int value; + + UnionIntLiteralPropertyProperty(int value) { + this.value = value; + } + + /** + * Parses a serialized value to a UnionIntLiteralPropertyProperty instance. + * + * @param value the serialized value to parse. + * @return the parsed UnionIntLiteralPropertyProperty object, or null if unable to parse. + */ + public static UnionIntLiteralPropertyProperty fromInt(int value) { + UnionIntLiteralPropertyProperty[] items = UnionIntLiteralPropertyProperty.values(); + for (UnionIntLiteralPropertyProperty item : items) { + if (item.toInt() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to int value. + * + * @return the int value. + */ + public int toInt() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralProperty.java new file mode 100644 index 00000000000..c5271cd552d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralProperty.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with union of string literal property. + */ +@Fluent +public final class UnionStringLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private UnionStringLiteralPropertyProperty property; + + /** + * Creates an instance of UnionStringLiteralProperty class. + */ + @Generated + public UnionStringLiteralProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public UnionStringLiteralPropertyProperty getProperty() { + return this.property; + } + + /** + * Set the property property: Property. + * + * @param property the property value to set. + * @return the UnionStringLiteralProperty object itself. + */ + @Generated + public UnionStringLiteralProperty setProperty(UnionStringLiteralPropertyProperty property) { + this.property = property; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnionStringLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnionStringLiteralProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the UnionStringLiteralProperty. + */ + @Generated + public static UnionStringLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UnionStringLiteralProperty deserializedUnionStringLiteralProperty = new UnionStringLiteralProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + deserializedUnionStringLiteralProperty.property + = UnionStringLiteralPropertyProperty.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedUnionStringLiteralProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralPropertyProperty.java new file mode 100644 index 00000000000..d38f242d770 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/UnionStringLiteralPropertyProperty.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.models; + +/** + * Defines values for UnionStringLiteralPropertyProperty. + */ +public enum UnionStringLiteralPropertyProperty { + /** + * Enum value hello. + */ + HELLO("hello"), + + /** + * Enum value world. + */ + WORLD("world"); + + /** + * The actual serialized value for a UnionStringLiteralPropertyProperty instance. + */ + private final String value; + + UnionStringLiteralPropertyProperty(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a UnionStringLiteralPropertyProperty instance. + * + * @param value the serialized value to parse. + * @return the parsed UnionStringLiteralPropertyProperty object, or null if unable to parse. + */ + public static UnionStringLiteralPropertyProperty fromString(String value) { + if (value == null) { + return null; + } + UnionStringLiteralPropertyProperty[] items = UnionStringLiteralPropertyProperty.values(); + for (UnionStringLiteralPropertyProperty item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/package-info.java new file mode 100644 index 00000000000..44d948e83d3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Optional. + * Illustrates models with optional properties. + * + */ +package type.property.optional.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/package-info.java new file mode 100644 index 00000000000..d28f3d60234 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/optional/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Optional. + * Illustrates models with optional properties. + * + */ +package type.property.optional; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralAsyncClient.java new file mode 100644 index 00000000000..257fd6e1b31 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.BooleanLiteralsImpl; +import type.property.valuetypes.models.BooleanLiteralProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class BooleanLiteralAsyncClient { + @Generated + private final BooleanLiteralsImpl serviceClient; + + /** + * Initializes an instance of BooleanLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BooleanLiteralAsyncClient(BooleanLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BooleanLiteralProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(BooleanLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralClient.java new file mode 100644 index 00000000000..e73faa591b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanLiteralClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.BooleanLiteralsImpl; +import type.property.valuetypes.models.BooleanLiteralProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class BooleanLiteralClient { + @Generated + private final BooleanLiteralsImpl serviceClient; + + /** + * Initializes an instance of BooleanLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BooleanLiteralClient(BooleanLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BooleanLiteralProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(BooleanLiteralProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(BooleanLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationAsyncClient.java new file mode 100644 index 00000000000..acec6a32e22 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.BooleanOperationsImpl; +import type.property.valuetypes.models.BooleanProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class BooleanOperationAsyncClient { + @Generated + private final BooleanOperationsImpl serviceClient; + + /** + * Initializes an instance of BooleanOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BooleanOperationAsyncClient(BooleanOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BooleanProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(BooleanProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationClient.java new file mode 100644 index 00000000000..fe86e922450 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BooleanOperationClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.BooleanOperationsImpl; +import type.property.valuetypes.models.BooleanProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class BooleanOperationClient { + @Generated + private final BooleanOperationsImpl serviceClient; + + /** + * Initializes an instance of BooleanOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BooleanOperationClient(BooleanOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BooleanProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(BooleanProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(BooleanProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesAsyncClient.java new file mode 100644 index 00000000000..d504e2423a0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.BytesImpl; +import type.property.valuetypes.models.BytesProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class BytesAsyncClient { + @Generated + private final BytesImpl serviceClient; + + /** + * Initializes an instance of BytesAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BytesAsyncClient(BytesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BytesProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(BytesProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesClient.java new file mode 100644 index 00000000000..7a4d99fa1e8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/BytesClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.BytesImpl; +import type.property.valuetypes.models.BytesProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class BytesClient { + @Generated + private final BytesImpl serviceClient; + + /** + * Initializes an instance of BytesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BytesClient(BytesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BytesProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(BytesProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(BytesProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntAsyncClient.java new file mode 100644 index 00000000000..0910790dad3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntAsyncClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.CollectionsIntsImpl; +import type.property.valuetypes.models.CollectionsIntProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class CollectionsIntAsyncClient { + @Generated + private final CollectionsIntsImpl serviceClient; + + /** + * Initializes an instance of CollectionsIntAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsIntAsyncClient(CollectionsIntsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsIntProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(CollectionsIntProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntClient.java new file mode 100644 index 00000000000..9c128f7e3c9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsIntClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.CollectionsIntsImpl; +import type.property.valuetypes.models.CollectionsIntProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class CollectionsIntClient { + @Generated + private final CollectionsIntsImpl serviceClient; + + /** + * Initializes an instance of CollectionsIntClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsIntClient(CollectionsIntsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsIntProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(CollectionsIntProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(CollectionsIntProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelAsyncClient.java new file mode 100644 index 00000000000..2dc7043cb00 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelAsyncClient.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.CollectionsModelsImpl; +import type.property.valuetypes.models.CollectionsModelProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class CollectionsModelAsyncClient { + @Generated + private final CollectionsModelsImpl serviceClient; + + /** + * Initializes an instance of CollectionsModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsModelAsyncClient(CollectionsModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *          (Required){
+     *             property: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *          (Required){
+     *             property: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsModelProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(CollectionsModelProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelClient.java new file mode 100644 index 00000000000..15c3d9f5d95 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsModelClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.CollectionsModelsImpl; +import type.property.valuetypes.models.CollectionsModelProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class CollectionsModelClient { + @Generated + private final CollectionsModelsImpl serviceClient; + + /** + * Initializes an instance of CollectionsModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsModelClient(CollectionsModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *          (Required){
+     *             property: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *          (Required){
+     *             property: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsModelProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(CollectionsModelProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(CollectionsModelProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringAsyncClient.java new file mode 100644 index 00000000000..b6e472a64cc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringAsyncClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.CollectionsStringsImpl; +import type.property.valuetypes.models.CollectionsStringProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class CollectionsStringAsyncClient { + @Generated + private final CollectionsStringsImpl serviceClient; + + /** + * Initializes an instance of CollectionsStringAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsStringAsyncClient(CollectionsStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(CollectionsStringProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(CollectionsStringProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringClient.java new file mode 100644 index 00000000000..74093195e00 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/CollectionsStringClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.CollectionsStringsImpl; +import type.property.valuetypes.models.CollectionsStringProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class CollectionsStringClient { + @Generated + private final CollectionsStringsImpl serviceClient; + + /** + * Initializes an instance of CollectionsStringClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + CollectionsStringClient(CollectionsStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public CollectionsStringProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(CollectionsStringProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(CollectionsStringProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationAsyncClient.java new file mode 100644 index 00000000000..464801eee86 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.DatetimeOperationsImpl; +import type.property.valuetypes.models.DatetimeProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class DatetimeOperationAsyncClient { + @Generated + private final DatetimeOperationsImpl serviceClient; + + /** + * Initializes an instance of DatetimeOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DatetimeOperationAsyncClient(DatetimeOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DatetimeProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(DatetimeProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationClient.java new file mode 100644 index 00000000000..0e28cd46928 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DatetimeOperationClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.DatetimeOperationsImpl; +import type.property.valuetypes.models.DatetimeProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class DatetimeOperationClient { + @Generated + private final DatetimeOperationsImpl serviceClient; + + /** + * Initializes an instance of DatetimeOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DatetimeOperationClient(DatetimeOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DatetimeProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(DatetimeProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(DatetimeProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128AsyncClient.java new file mode 100644 index 00000000000..937c62070a1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128AsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.Decimal128sImpl; +import type.property.valuetypes.models.Decimal128Property; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class Decimal128AsyncClient { + @Generated + private final Decimal128sImpl serviceClient; + + /** + * Initializes an instance of Decimal128AsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Decimal128AsyncClient(Decimal128sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Decimal128Property.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(Decimal128Property body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128Client.java new file mode 100644 index 00000000000..db977c18f52 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/Decimal128Client.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.Decimal128sImpl; +import type.property.valuetypes.models.Decimal128Property; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class Decimal128Client { + @Generated + private final Decimal128sImpl serviceClient; + + /** + * Initializes an instance of Decimal128Client class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Decimal128Client(Decimal128sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Decimal128Property get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(Decimal128Property.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(Decimal128Property body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalAsyncClient.java new file mode 100644 index 00000000000..c0a245e6fd3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.DecimalsImpl; +import type.property.valuetypes.models.DecimalProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class DecimalAsyncClient { + @Generated + private final DecimalsImpl serviceClient; + + /** + * Initializes an instance of DecimalAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DecimalAsyncClient(DecimalsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DecimalProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(DecimalProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalClient.java new file mode 100644 index 00000000000..0a0d4bb7572 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DecimalClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.DecimalsImpl; +import type.property.valuetypes.models.DecimalProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class DecimalClient { + @Generated + private final DecimalsImpl serviceClient; + + /** + * Initializes an instance of DecimalClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DecimalClient(DecimalsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DecimalProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(DecimalProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(DecimalProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringAsyncClient.java new file mode 100644 index 00000000000..67e677f9ec7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringAsyncClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.DictionaryStringsImpl; +import type.property.valuetypes.models.DictionaryStringProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class DictionaryStringAsyncClient { + @Generated + private final DictionaryStringsImpl serviceClient; + + /** + * Initializes an instance of DictionaryStringAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DictionaryStringAsyncClient(DictionaryStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DictionaryStringProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(DictionaryStringProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringClient.java new file mode 100644 index 00000000000..7a1795cc309 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DictionaryStringClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.DictionaryStringsImpl; +import type.property.valuetypes.models.DictionaryStringProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class DictionaryStringClient { + @Generated + private final DictionaryStringsImpl serviceClient; + + /** + * Initializes an instance of DictionaryStringClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DictionaryStringClient(DictionaryStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DictionaryStringProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(DictionaryStringProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(DictionaryStringProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationAsyncClient.java new file mode 100644 index 00000000000..df025c1be88 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.DurationOperationsImpl; +import type.property.valuetypes.models.DurationProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class DurationOperationAsyncClient { + @Generated + private final DurationOperationsImpl serviceClient; + + /** + * Initializes an instance of DurationOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DurationOperationAsyncClient(DurationOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DurationProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(DurationProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationClient.java new file mode 100644 index 00000000000..d8669e6dcae --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/DurationOperationClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.DurationOperationsImpl; +import type.property.valuetypes.models.DurationProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class DurationOperationClient { + @Generated + private final DurationOperationsImpl serviceClient; + + /** + * Initializes an instance of DurationOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DurationOperationClient(DurationOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DurationProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(DurationProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(DurationProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumAsyncClient.java new file mode 100644 index 00000000000..e9decfe2742 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.EnumsImpl; +import type.property.valuetypes.models.EnumProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class EnumAsyncClient { + @Generated + private final EnumsImpl serviceClient; + + /** + * Initializes an instance of EnumAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnumAsyncClient(EnumsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(EnumProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(EnumProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumClient.java new file mode 100644 index 00000000000..7fb0a385291 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/EnumClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.EnumsImpl; +import type.property.valuetypes.models.EnumProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class EnumClient { + @Generated + private final EnumsImpl serviceClient; + + /** + * Initializes an instance of EnumClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnumClient(EnumsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public EnumProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(EnumProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(EnumProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumAsyncClient.java new file mode 100644 index 00000000000..60ad21da1e5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.ExtensibleEnumsImpl; +import type.property.valuetypes.models.ExtensibleEnumProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class ExtensibleEnumAsyncClient { + @Generated + private final ExtensibleEnumsImpl serviceClient; + + /** + * Initializes an instance of ExtensibleEnumAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtensibleEnumAsyncClient(ExtensibleEnumsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ExtensibleEnumProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(ExtensibleEnumProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumClient.java new file mode 100644 index 00000000000..7e8fd209b76 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ExtensibleEnumClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.ExtensibleEnumsImpl; +import type.property.valuetypes.models.ExtensibleEnumProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class ExtensibleEnumClient { + @Generated + private final ExtensibleEnumsImpl serviceClient; + + /** + * Initializes an instance of ExtensibleEnumClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ExtensibleEnumClient(ExtensibleEnumsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtensibleEnumProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(ExtensibleEnumProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(ExtensibleEnumProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralAsyncClient.java new file mode 100644 index 00000000000..6fd89ca345b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.FloatLiteralsImpl; +import type.property.valuetypes.models.FloatLiteralProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class FloatLiteralAsyncClient { + @Generated + private final FloatLiteralsImpl serviceClient; + + /** + * Initializes an instance of FloatLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FloatLiteralAsyncClient(FloatLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FloatLiteralProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(FloatLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralClient.java new file mode 100644 index 00000000000..c5353dfca5d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatLiteralClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.FloatLiteralsImpl; +import type.property.valuetypes.models.FloatLiteralProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class FloatLiteralClient { + @Generated + private final FloatLiteralsImpl serviceClient; + + /** + * Initializes an instance of FloatLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FloatLiteralClient(FloatLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FloatLiteralProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(FloatLiteralProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(FloatLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationAsyncClient.java new file mode 100644 index 00000000000..8a88c6424d4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.FloatOperationsImpl; +import type.property.valuetypes.models.FloatProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class FloatOperationAsyncClient { + @Generated + private final FloatOperationsImpl serviceClient; + + /** + * Initializes an instance of FloatOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FloatOperationAsyncClient(FloatOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(FloatProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(FloatProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationClient.java new file mode 100644 index 00000000000..adf2ce0adf6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/FloatOperationClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.FloatOperationsImpl; +import type.property.valuetypes.models.FloatProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class FloatOperationClient { + @Generated + private final FloatOperationsImpl serviceClient; + + /** + * Initializes an instance of FloatOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FloatOperationClient(FloatOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public FloatProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(FloatProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(FloatProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntAsyncClient.java new file mode 100644 index 00000000000..cc01bc396dc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.IntsImpl; +import type.property.valuetypes.models.IntProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class IntAsyncClient { + @Generated + private final IntsImpl serviceClient; + + /** + * Initializes an instance of IntAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IntAsyncClient(IntsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(IntProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(IntProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntClient.java new file mode 100644 index 00000000000..443421301a6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.IntsImpl; +import type.property.valuetypes.models.IntProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class IntClient { + @Generated + private final IntsImpl serviceClient; + + /** + * Initializes an instance of IntClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IntClient(IntsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public IntProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(IntProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(IntProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralAsyncClient.java new file mode 100644 index 00000000000..81992421f96 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.IntLiteralsImpl; +import type.property.valuetypes.models.IntLiteralProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class IntLiteralAsyncClient { + @Generated + private final IntLiteralsImpl serviceClient; + + /** + * Initializes an instance of IntLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IntLiteralAsyncClient(IntLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(IntLiteralProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(IntLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralClient.java new file mode 100644 index 00000000000..24682c28370 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/IntLiteralClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.IntLiteralsImpl; +import type.property.valuetypes.models.IntLiteralProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class IntLiteralClient { + @Generated + private final IntLiteralsImpl serviceClient; + + /** + * Initializes an instance of IntLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IntLiteralClient(IntLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public IntLiteralProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(IntLiteralProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(IntLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelAsyncClient.java new file mode 100644 index 00000000000..5c06dde3802 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelAsyncClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.ModelsImpl; +import type.property.valuetypes.models.ModelProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class ModelAsyncClient { + @Generated + private final ModelsImpl serviceClient; + + /** + * Initializes an instance of ModelAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelAsyncClient(ModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         property: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         property: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ModelProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(ModelProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelClient.java new file mode 100644 index 00000000000..3b59f65f480 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ModelClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.ModelsImpl; +import type.property.valuetypes.models.ModelProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class ModelClient { + @Generated + private final ModelsImpl serviceClient; + + /** + * Initializes an instance of ModelClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelClient(ModelsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         property: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         property: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ModelProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(ModelProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(ModelProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverAsyncClient.java new file mode 100644 index 00000000000..9ee16bba40b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverAsyncClient.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.NeversImpl; +import type.property.valuetypes.models.NeverProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class NeverAsyncClient { + @Generated + private final NeversImpl serviceClient; + + /** + * Initializes an instance of NeverAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NeverAsyncClient(NeversImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(NeverProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(NeverProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverClient.java new file mode 100644 index 00000000000..4f8fc2b6082 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/NeverClient.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.NeversImpl; +import type.property.valuetypes.models.NeverProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class NeverClient { + @Generated + private final NeversImpl serviceClient; + + /** + * Initializes an instance of NeverClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NeverClient(NeversImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public NeverProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(NeverProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(NeverProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralAsyncClient.java new file mode 100644 index 00000000000..5ef3cd57db0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.StringLiteralsImpl; +import type.property.valuetypes.models.StringLiteralProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class StringLiteralAsyncClient { + @Generated + private final StringLiteralsImpl serviceClient; + + /** + * Initializes an instance of StringLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringLiteralAsyncClient(StringLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(StringLiteralProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(StringLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralClient.java new file mode 100644 index 00000000000..1392a584ca8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringLiteralClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.StringLiteralsImpl; +import type.property.valuetypes.models.StringLiteralProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class StringLiteralClient { + @Generated + private final StringLiteralsImpl serviceClient; + + /** + * Initializes an instance of StringLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringLiteralClient(StringLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public StringLiteralProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(StringLiteralProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(StringLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationAsyncClient.java new file mode 100644 index 00000000000..b53bac74036 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.StringOperationsImpl; +import type.property.valuetypes.models.StringProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class StringOperationAsyncClient { + @Generated + private final StringOperationsImpl serviceClient; + + /** + * Initializes an instance of StringOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringOperationAsyncClient(StringOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(StringProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(StringProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationClient.java new file mode 100644 index 00000000000..3344a312fba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/StringOperationClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.StringOperationsImpl; +import type.property.valuetypes.models.StringProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class StringOperationClient { + @Generated + private final StringOperationsImpl serviceClient; + + /** + * Initializes an instance of StringOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringOperationClient(StringOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public StringProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(StringProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(StringProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueAsyncClient.java new file mode 100644 index 00000000000..5090dabadab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.UnionEnumValuesImpl; +import type.property.valuetypes.models.UnionEnumValueProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class UnionEnumValueAsyncClient { + @Generated + private final UnionEnumValuesImpl serviceClient; + + /** + * Initializes an instance of UnionEnumValueAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionEnumValueAsyncClient(UnionEnumValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(value2) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(value2) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnionEnumValueProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(UnionEnumValueProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueClient.java new file mode 100644 index 00000000000..3509d918976 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionEnumValueClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.UnionEnumValuesImpl; +import type.property.valuetypes.models.UnionEnumValueProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class UnionEnumValueClient { + @Generated + private final UnionEnumValuesImpl serviceClient; + + /** + * Initializes an instance of UnionEnumValueClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionEnumValueClient(UnionEnumValuesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(value2) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(value2) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnionEnumValueProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(UnionEnumValueProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(UnionEnumValueProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralAsyncClient.java new file mode 100644 index 00000000000..cdecf563fd1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.UnionFloatLiteralsImpl; +import type.property.valuetypes.models.UnionFloatLiteralProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class UnionFloatLiteralAsyncClient { + @Generated + private final UnionFloatLiteralsImpl serviceClient; + + /** + * Initializes an instance of UnionFloatLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionFloatLiteralAsyncClient(UnionFloatLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(43.125/46.875) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(43.125/46.875) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnionFloatLiteralProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(UnionFloatLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralClient.java new file mode 100644 index 00000000000..46d85a2a14b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionFloatLiteralClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.UnionFloatLiteralsImpl; +import type.property.valuetypes.models.UnionFloatLiteralProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class UnionFloatLiteralClient { + @Generated + private final UnionFloatLiteralsImpl serviceClient; + + /** + * Initializes an instance of UnionFloatLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionFloatLiteralClient(UnionFloatLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(43.125/46.875) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(43.125/46.875) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnionFloatLiteralProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(UnionFloatLiteralProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(UnionFloatLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralAsyncClient.java new file mode 100644 index 00000000000..247f2d7bf90 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.UnionIntLiteralsImpl; +import type.property.valuetypes.models.UnionIntLiteralProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class UnionIntLiteralAsyncClient { + @Generated + private final UnionIntLiteralsImpl serviceClient; + + /** + * Initializes an instance of UnionIntLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionIntLiteralAsyncClient(UnionIntLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(42/43) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(42/43) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnionIntLiteralProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(UnionIntLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralClient.java new file mode 100644 index 00000000000..93b868a78a8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionIntLiteralClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.UnionIntLiteralsImpl; +import type.property.valuetypes.models.UnionIntLiteralProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class UnionIntLiteralClient { + @Generated + private final UnionIntLiteralsImpl serviceClient; + + /** + * Initializes an instance of UnionIntLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionIntLiteralClient(UnionIntLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(42/43) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(42/43) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnionIntLiteralProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(UnionIntLiteralProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(UnionIntLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralAsyncClient.java new file mode 100644 index 00000000000..3316d68e567 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.UnionStringLiteralsImpl; +import type.property.valuetypes.models.UnionStringLiteralProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class UnionStringLiteralAsyncClient { + @Generated + private final UnionStringLiteralsImpl serviceClient; + + /** + * Initializes an instance of UnionStringLiteralAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionStringLiteralAsyncClient(UnionStringLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnionStringLiteralProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(UnionStringLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralClient.java new file mode 100644 index 00000000000..62c49e85731 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnionStringLiteralClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.UnionStringLiteralsImpl; +import type.property.valuetypes.models.UnionStringLiteralProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class UnionStringLiteralClient { + @Generated + private final UnionStringLiteralsImpl serviceClient; + + /** + * Initializes an instance of UnionStringLiteralClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnionStringLiteralClient(UnionStringLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnionStringLiteralProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(UnionStringLiteralProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(UnionStringLiteralProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayAsyncClient.java new file mode 100644 index 00000000000..370a3785822 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.UnknownArraysImpl; +import type.property.valuetypes.models.UnknownArrayProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class UnknownArrayAsyncClient { + @Generated + private final UnknownArraysImpl serviceClient; + + /** + * Initializes an instance of UnknownArrayAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownArrayAsyncClient(UnknownArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnknownArrayProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(UnknownArrayProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayClient.java new file mode 100644 index 00000000000..c9b24de63b0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownArrayClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.UnknownArraysImpl; +import type.property.valuetypes.models.UnknownArrayProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class UnknownArrayClient { + @Generated + private final UnknownArraysImpl serviceClient; + + /** + * Initializes an instance of UnknownArrayClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownArrayClient(UnknownArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnknownArrayProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(UnknownArrayProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(UnknownArrayProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictAsyncClient.java new file mode 100644 index 00000000000..51876b76ba7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.UnknownDictsImpl; +import type.property.valuetypes.models.UnknownDictProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class UnknownDictAsyncClient { + @Generated + private final UnknownDictsImpl serviceClient; + + /** + * Initializes an instance of UnknownDictAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownDictAsyncClient(UnknownDictsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnknownDictProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(UnknownDictProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictClient.java new file mode 100644 index 00000000000..ea45edc46b8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownDictClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.UnknownDictsImpl; +import type.property.valuetypes.models.UnknownDictProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class UnknownDictClient { + @Generated + private final UnknownDictsImpl serviceClient; + + /** + * Initializes an instance of UnknownDictClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownDictClient(UnknownDictsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnknownDictProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(UnknownDictProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(UnknownDictProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntAsyncClient.java new file mode 100644 index 00000000000..9a999c47093 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.UnknownIntsImpl; +import type.property.valuetypes.models.UnknownIntProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class UnknownIntAsyncClient { + @Generated + private final UnknownIntsImpl serviceClient; + + /** + * Initializes an instance of UnknownIntAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownIntAsyncClient(UnknownIntsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnknownIntProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(UnknownIntProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntClient.java new file mode 100644 index 00000000000..b0001613606 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownIntClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.UnknownIntsImpl; +import type.property.valuetypes.models.UnknownIntProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class UnknownIntClient { + @Generated + private final UnknownIntsImpl serviceClient; + + /** + * Initializes an instance of UnknownIntClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownIntClient(UnknownIntsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnknownIntProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(UnknownIntProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(UnknownIntProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringAsyncClient.java new file mode 100644 index 00000000000..21c6fd67676 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringAsyncClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.property.valuetypes.implementation.UnknownStringsImpl; +import type.property.valuetypes.models.UnknownStringProperty; + +/** + * Initializes a new instance of the asynchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class, isAsync = true) +public final class UnknownStringAsyncClient { + @Generated + private final UnknownStringsImpl serviceClient; + + /** + * Initializes an instance of UnknownStringAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownStringAsyncClient(UnknownStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(UnknownStringProperty.class)); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(UnknownStringProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringClient.java new file mode 100644 index 00000000000..c8cebe3b243 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/UnknownStringClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.property.valuetypes.implementation.UnknownStringsImpl; +import type.property.valuetypes.models.UnknownStringProperty; + +/** + * Initializes a new instance of the synchronous ValueTypesClient type. + */ +@ServiceClient(builder = ValueTypesClientBuilder.class) +public final class UnknownStringClient { + @Generated + private final UnknownStringsImpl serviceClient; + + /** + * Initializes an instance of UnknownStringClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownStringClient(UnknownStringsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * Get call. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return call. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public UnknownStringProperty get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(UnknownStringProperty.class); + } + + /** + * Put operation. + * + * @param body body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(UnknownStringProperty body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ValueTypesClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ValueTypesClientBuilder.java new file mode 100644 index 00000000000..59ed21e1f79 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/ValueTypesClientBuilder.java @@ -0,0 +1,907 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.property.valuetypes.implementation.ValueTypesClientImpl; + +/** + * A builder for creating a new instance of the ValueTypesClient type. + */ +@ServiceClientBuilder( + serviceClients = { + BooleanOperationClient.class, + StringOperationClient.class, + BytesClient.class, + IntClient.class, + FloatOperationClient.class, + DecimalClient.class, + Decimal128Client.class, + DatetimeOperationClient.class, + DurationOperationClient.class, + EnumClient.class, + ExtensibleEnumClient.class, + ModelClient.class, + CollectionsStringClient.class, + CollectionsIntClient.class, + CollectionsModelClient.class, + DictionaryStringClient.class, + NeverClient.class, + UnknownStringClient.class, + UnknownIntClient.class, + UnknownDictClient.class, + UnknownArrayClient.class, + StringLiteralClient.class, + IntLiteralClient.class, + FloatLiteralClient.class, + BooleanLiteralClient.class, + UnionStringLiteralClient.class, + UnionIntLiteralClient.class, + UnionFloatLiteralClient.class, + UnionEnumValueClient.class, + BooleanOperationAsyncClient.class, + StringOperationAsyncClient.class, + BytesAsyncClient.class, + IntAsyncClient.class, + FloatOperationAsyncClient.class, + DecimalAsyncClient.class, + Decimal128AsyncClient.class, + DatetimeOperationAsyncClient.class, + DurationOperationAsyncClient.class, + EnumAsyncClient.class, + ExtensibleEnumAsyncClient.class, + ModelAsyncClient.class, + CollectionsStringAsyncClient.class, + CollectionsIntAsyncClient.class, + CollectionsModelAsyncClient.class, + DictionaryStringAsyncClient.class, + NeverAsyncClient.class, + UnknownStringAsyncClient.class, + UnknownIntAsyncClient.class, + UnknownDictAsyncClient.class, + UnknownArrayAsyncClient.class, + StringLiteralAsyncClient.class, + IntLiteralAsyncClient.class, + FloatLiteralAsyncClient.class, + BooleanLiteralAsyncClient.class, + UnionStringLiteralAsyncClient.class, + UnionIntLiteralAsyncClient.class, + UnionFloatLiteralAsyncClient.class, + UnionEnumValueAsyncClient.class }) +public final class ValueTypesClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("type-property-valuetypes.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ValueTypesClientBuilder. + */ + @Generated + public ValueTypesClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ValueTypesClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ValueTypesClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ValueTypesClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ValueTypesClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ValueTypesClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ValueTypesClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ValueTypesClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ValueTypesClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ValueTypesClientBuilder. + */ + @Generated + public ValueTypesClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ValueTypesClientImpl with the provided parameters. + * + * @return an instance of ValueTypesClientImpl. + */ + @Generated + private ValueTypesClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ValueTypesClientImpl client + = new ValueTypesClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of BooleanOperationAsyncClient class. + * + * @return an instance of BooleanOperationAsyncClient. + */ + @Generated + public BooleanOperationAsyncClient buildBooleanOperationAsyncClient() { + return new BooleanOperationAsyncClient(buildInnerClient().getBooleanOperations()); + } + + /** + * Builds an instance of StringOperationAsyncClient class. + * + * @return an instance of StringOperationAsyncClient. + */ + @Generated + public StringOperationAsyncClient buildStringOperationAsyncClient() { + return new StringOperationAsyncClient(buildInnerClient().getStringOperations()); + } + + /** + * Builds an instance of BytesAsyncClient class. + * + * @return an instance of BytesAsyncClient. + */ + @Generated + public BytesAsyncClient buildBytesAsyncClient() { + return new BytesAsyncClient(buildInnerClient().getBytes()); + } + + /** + * Builds an instance of IntAsyncClient class. + * + * @return an instance of IntAsyncClient. + */ + @Generated + public IntAsyncClient buildIntAsyncClient() { + return new IntAsyncClient(buildInnerClient().getInts()); + } + + /** + * Builds an instance of FloatOperationAsyncClient class. + * + * @return an instance of FloatOperationAsyncClient. + */ + @Generated + public FloatOperationAsyncClient buildFloatOperationAsyncClient() { + return new FloatOperationAsyncClient(buildInnerClient().getFloatOperations()); + } + + /** + * Builds an instance of DecimalAsyncClient class. + * + * @return an instance of DecimalAsyncClient. + */ + @Generated + public DecimalAsyncClient buildDecimalAsyncClient() { + return new DecimalAsyncClient(buildInnerClient().getDecimals()); + } + + /** + * Builds an instance of Decimal128AsyncClient class. + * + * @return an instance of Decimal128AsyncClient. + */ + @Generated + public Decimal128AsyncClient buildDecimal128AsyncClient() { + return new Decimal128AsyncClient(buildInnerClient().getDecimal128s()); + } + + /** + * Builds an instance of DatetimeOperationAsyncClient class. + * + * @return an instance of DatetimeOperationAsyncClient. + */ + @Generated + public DatetimeOperationAsyncClient buildDatetimeOperationAsyncClient() { + return new DatetimeOperationAsyncClient(buildInnerClient().getDatetimeOperations()); + } + + /** + * Builds an instance of DurationOperationAsyncClient class. + * + * @return an instance of DurationOperationAsyncClient. + */ + @Generated + public DurationOperationAsyncClient buildDurationOperationAsyncClient() { + return new DurationOperationAsyncClient(buildInnerClient().getDurationOperations()); + } + + /** + * Builds an instance of EnumAsyncClient class. + * + * @return an instance of EnumAsyncClient. + */ + @Generated + public EnumAsyncClient buildEnumAsyncClient() { + return new EnumAsyncClient(buildInnerClient().getEnums()); + } + + /** + * Builds an instance of ExtensibleEnumAsyncClient class. + * + * @return an instance of ExtensibleEnumAsyncClient. + */ + @Generated + public ExtensibleEnumAsyncClient buildExtensibleEnumAsyncClient() { + return new ExtensibleEnumAsyncClient(buildInnerClient().getExtensibleEnums()); + } + + /** + * Builds an instance of ModelAsyncClient class. + * + * @return an instance of ModelAsyncClient. + */ + @Generated + public ModelAsyncClient buildModelAsyncClient() { + return new ModelAsyncClient(buildInnerClient().getModels()); + } + + /** + * Builds an instance of CollectionsStringAsyncClient class. + * + * @return an instance of CollectionsStringAsyncClient. + */ + @Generated + public CollectionsStringAsyncClient buildCollectionsStringAsyncClient() { + return new CollectionsStringAsyncClient(buildInnerClient().getCollectionsStrings()); + } + + /** + * Builds an instance of CollectionsIntAsyncClient class. + * + * @return an instance of CollectionsIntAsyncClient. + */ + @Generated + public CollectionsIntAsyncClient buildCollectionsIntAsyncClient() { + return new CollectionsIntAsyncClient(buildInnerClient().getCollectionsInts()); + } + + /** + * Builds an instance of CollectionsModelAsyncClient class. + * + * @return an instance of CollectionsModelAsyncClient. + */ + @Generated + public CollectionsModelAsyncClient buildCollectionsModelAsyncClient() { + return new CollectionsModelAsyncClient(buildInnerClient().getCollectionsModels()); + } + + /** + * Builds an instance of DictionaryStringAsyncClient class. + * + * @return an instance of DictionaryStringAsyncClient. + */ + @Generated + public DictionaryStringAsyncClient buildDictionaryStringAsyncClient() { + return new DictionaryStringAsyncClient(buildInnerClient().getDictionaryStrings()); + } + + /** + * Builds an instance of NeverAsyncClient class. + * + * @return an instance of NeverAsyncClient. + */ + @Generated + public NeverAsyncClient buildNeverAsyncClient() { + return new NeverAsyncClient(buildInnerClient().getNevers()); + } + + /** + * Builds an instance of UnknownStringAsyncClient class. + * + * @return an instance of UnknownStringAsyncClient. + */ + @Generated + public UnknownStringAsyncClient buildUnknownStringAsyncClient() { + return new UnknownStringAsyncClient(buildInnerClient().getUnknownStrings()); + } + + /** + * Builds an instance of UnknownIntAsyncClient class. + * + * @return an instance of UnknownIntAsyncClient. + */ + @Generated + public UnknownIntAsyncClient buildUnknownIntAsyncClient() { + return new UnknownIntAsyncClient(buildInnerClient().getUnknownInts()); + } + + /** + * Builds an instance of UnknownDictAsyncClient class. + * + * @return an instance of UnknownDictAsyncClient. + */ + @Generated + public UnknownDictAsyncClient buildUnknownDictAsyncClient() { + return new UnknownDictAsyncClient(buildInnerClient().getUnknownDicts()); + } + + /** + * Builds an instance of UnknownArrayAsyncClient class. + * + * @return an instance of UnknownArrayAsyncClient. + */ + @Generated + public UnknownArrayAsyncClient buildUnknownArrayAsyncClient() { + return new UnknownArrayAsyncClient(buildInnerClient().getUnknownArrays()); + } + + /** + * Builds an instance of StringLiteralAsyncClient class. + * + * @return an instance of StringLiteralAsyncClient. + */ + @Generated + public StringLiteralAsyncClient buildStringLiteralAsyncClient() { + return new StringLiteralAsyncClient(buildInnerClient().getStringLiterals()); + } + + /** + * Builds an instance of IntLiteralAsyncClient class. + * + * @return an instance of IntLiteralAsyncClient. + */ + @Generated + public IntLiteralAsyncClient buildIntLiteralAsyncClient() { + return new IntLiteralAsyncClient(buildInnerClient().getIntLiterals()); + } + + /** + * Builds an instance of FloatLiteralAsyncClient class. + * + * @return an instance of FloatLiteralAsyncClient. + */ + @Generated + public FloatLiteralAsyncClient buildFloatLiteralAsyncClient() { + return new FloatLiteralAsyncClient(buildInnerClient().getFloatLiterals()); + } + + /** + * Builds an instance of BooleanLiteralAsyncClient class. + * + * @return an instance of BooleanLiteralAsyncClient. + */ + @Generated + public BooleanLiteralAsyncClient buildBooleanLiteralAsyncClient() { + return new BooleanLiteralAsyncClient(buildInnerClient().getBooleanLiterals()); + } + + /** + * Builds an instance of UnionStringLiteralAsyncClient class. + * + * @return an instance of UnionStringLiteralAsyncClient. + */ + @Generated + public UnionStringLiteralAsyncClient buildUnionStringLiteralAsyncClient() { + return new UnionStringLiteralAsyncClient(buildInnerClient().getUnionStringLiterals()); + } + + /** + * Builds an instance of UnionIntLiteralAsyncClient class. + * + * @return an instance of UnionIntLiteralAsyncClient. + */ + @Generated + public UnionIntLiteralAsyncClient buildUnionIntLiteralAsyncClient() { + return new UnionIntLiteralAsyncClient(buildInnerClient().getUnionIntLiterals()); + } + + /** + * Builds an instance of UnionFloatLiteralAsyncClient class. + * + * @return an instance of UnionFloatLiteralAsyncClient. + */ + @Generated + public UnionFloatLiteralAsyncClient buildUnionFloatLiteralAsyncClient() { + return new UnionFloatLiteralAsyncClient(buildInnerClient().getUnionFloatLiterals()); + } + + /** + * Builds an instance of UnionEnumValueAsyncClient class. + * + * @return an instance of UnionEnumValueAsyncClient. + */ + @Generated + public UnionEnumValueAsyncClient buildUnionEnumValueAsyncClient() { + return new UnionEnumValueAsyncClient(buildInnerClient().getUnionEnumValues()); + } + + /** + * Builds an instance of BooleanOperationClient class. + * + * @return an instance of BooleanOperationClient. + */ + @Generated + public BooleanOperationClient buildBooleanOperationClient() { + return new BooleanOperationClient(buildInnerClient().getBooleanOperations()); + } + + /** + * Builds an instance of StringOperationClient class. + * + * @return an instance of StringOperationClient. + */ + @Generated + public StringOperationClient buildStringOperationClient() { + return new StringOperationClient(buildInnerClient().getStringOperations()); + } + + /** + * Builds an instance of BytesClient class. + * + * @return an instance of BytesClient. + */ + @Generated + public BytesClient buildBytesClient() { + return new BytesClient(buildInnerClient().getBytes()); + } + + /** + * Builds an instance of IntClient class. + * + * @return an instance of IntClient. + */ + @Generated + public IntClient buildIntClient() { + return new IntClient(buildInnerClient().getInts()); + } + + /** + * Builds an instance of FloatOperationClient class. + * + * @return an instance of FloatOperationClient. + */ + @Generated + public FloatOperationClient buildFloatOperationClient() { + return new FloatOperationClient(buildInnerClient().getFloatOperations()); + } + + /** + * Builds an instance of DecimalClient class. + * + * @return an instance of DecimalClient. + */ + @Generated + public DecimalClient buildDecimalClient() { + return new DecimalClient(buildInnerClient().getDecimals()); + } + + /** + * Builds an instance of Decimal128Client class. + * + * @return an instance of Decimal128Client. + */ + @Generated + public Decimal128Client buildDecimal128Client() { + return new Decimal128Client(buildInnerClient().getDecimal128s()); + } + + /** + * Builds an instance of DatetimeOperationClient class. + * + * @return an instance of DatetimeOperationClient. + */ + @Generated + public DatetimeOperationClient buildDatetimeOperationClient() { + return new DatetimeOperationClient(buildInnerClient().getDatetimeOperations()); + } + + /** + * Builds an instance of DurationOperationClient class. + * + * @return an instance of DurationOperationClient. + */ + @Generated + public DurationOperationClient buildDurationOperationClient() { + return new DurationOperationClient(buildInnerClient().getDurationOperations()); + } + + /** + * Builds an instance of EnumClient class. + * + * @return an instance of EnumClient. + */ + @Generated + public EnumClient buildEnumClient() { + return new EnumClient(buildInnerClient().getEnums()); + } + + /** + * Builds an instance of ExtensibleEnumClient class. + * + * @return an instance of ExtensibleEnumClient. + */ + @Generated + public ExtensibleEnumClient buildExtensibleEnumClient() { + return new ExtensibleEnumClient(buildInnerClient().getExtensibleEnums()); + } + + /** + * Builds an instance of ModelClient class. + * + * @return an instance of ModelClient. + */ + @Generated + public ModelClient buildModelClient() { + return new ModelClient(buildInnerClient().getModels()); + } + + /** + * Builds an instance of CollectionsStringClient class. + * + * @return an instance of CollectionsStringClient. + */ + @Generated + public CollectionsStringClient buildCollectionsStringClient() { + return new CollectionsStringClient(buildInnerClient().getCollectionsStrings()); + } + + /** + * Builds an instance of CollectionsIntClient class. + * + * @return an instance of CollectionsIntClient. + */ + @Generated + public CollectionsIntClient buildCollectionsIntClient() { + return new CollectionsIntClient(buildInnerClient().getCollectionsInts()); + } + + /** + * Builds an instance of CollectionsModelClient class. + * + * @return an instance of CollectionsModelClient. + */ + @Generated + public CollectionsModelClient buildCollectionsModelClient() { + return new CollectionsModelClient(buildInnerClient().getCollectionsModels()); + } + + /** + * Builds an instance of DictionaryStringClient class. + * + * @return an instance of DictionaryStringClient. + */ + @Generated + public DictionaryStringClient buildDictionaryStringClient() { + return new DictionaryStringClient(buildInnerClient().getDictionaryStrings()); + } + + /** + * Builds an instance of NeverClient class. + * + * @return an instance of NeverClient. + */ + @Generated + public NeverClient buildNeverClient() { + return new NeverClient(buildInnerClient().getNevers()); + } + + /** + * Builds an instance of UnknownStringClient class. + * + * @return an instance of UnknownStringClient. + */ + @Generated + public UnknownStringClient buildUnknownStringClient() { + return new UnknownStringClient(buildInnerClient().getUnknownStrings()); + } + + /** + * Builds an instance of UnknownIntClient class. + * + * @return an instance of UnknownIntClient. + */ + @Generated + public UnknownIntClient buildUnknownIntClient() { + return new UnknownIntClient(buildInnerClient().getUnknownInts()); + } + + /** + * Builds an instance of UnknownDictClient class. + * + * @return an instance of UnknownDictClient. + */ + @Generated + public UnknownDictClient buildUnknownDictClient() { + return new UnknownDictClient(buildInnerClient().getUnknownDicts()); + } + + /** + * Builds an instance of UnknownArrayClient class. + * + * @return an instance of UnknownArrayClient. + */ + @Generated + public UnknownArrayClient buildUnknownArrayClient() { + return new UnknownArrayClient(buildInnerClient().getUnknownArrays()); + } + + /** + * Builds an instance of StringLiteralClient class. + * + * @return an instance of StringLiteralClient. + */ + @Generated + public StringLiteralClient buildStringLiteralClient() { + return new StringLiteralClient(buildInnerClient().getStringLiterals()); + } + + /** + * Builds an instance of IntLiteralClient class. + * + * @return an instance of IntLiteralClient. + */ + @Generated + public IntLiteralClient buildIntLiteralClient() { + return new IntLiteralClient(buildInnerClient().getIntLiterals()); + } + + /** + * Builds an instance of FloatLiteralClient class. + * + * @return an instance of FloatLiteralClient. + */ + @Generated + public FloatLiteralClient buildFloatLiteralClient() { + return new FloatLiteralClient(buildInnerClient().getFloatLiterals()); + } + + /** + * Builds an instance of BooleanLiteralClient class. + * + * @return an instance of BooleanLiteralClient. + */ + @Generated + public BooleanLiteralClient buildBooleanLiteralClient() { + return new BooleanLiteralClient(buildInnerClient().getBooleanLiterals()); + } + + /** + * Builds an instance of UnionStringLiteralClient class. + * + * @return an instance of UnionStringLiteralClient. + */ + @Generated + public UnionStringLiteralClient buildUnionStringLiteralClient() { + return new UnionStringLiteralClient(buildInnerClient().getUnionStringLiterals()); + } + + /** + * Builds an instance of UnionIntLiteralClient class. + * + * @return an instance of UnionIntLiteralClient. + */ + @Generated + public UnionIntLiteralClient buildUnionIntLiteralClient() { + return new UnionIntLiteralClient(buildInnerClient().getUnionIntLiterals()); + } + + /** + * Builds an instance of UnionFloatLiteralClient class. + * + * @return an instance of UnionFloatLiteralClient. + */ + @Generated + public UnionFloatLiteralClient buildUnionFloatLiteralClient() { + return new UnionFloatLiteralClient(buildInnerClient().getUnionFloatLiterals()); + } + + /** + * Builds an instance of UnionEnumValueClient class. + * + * @return an instance of UnionEnumValueClient. + */ + @Generated + public UnionEnumValueClient buildUnionEnumValueClient() { + return new UnionEnumValueClient(buildInnerClient().getUnionEnumValues()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ValueTypesClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanLiteralsImpl.java new file mode 100644 index 00000000000..2f10aabc507 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanLiteralsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BooleanLiterals. + */ +public final class BooleanLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BooleanLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of BooleanLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BooleanLiteralsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(BooleanLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientBooleanLiterals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientBooleanLiterals") + public interface BooleanLiteralsService { + @Get("/type/property/value-types/boolean/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/boolean/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/boolean/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/boolean/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanOperationsImpl.java new file mode 100644 index 00000000000..feb16123ee8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BooleanOperationsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BooleanOperations. + */ +public final class BooleanOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BooleanOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of BooleanOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BooleanOperationsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(BooleanOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientBooleanOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientBooleanOperations") + public interface BooleanOperationsService { + @Get("/type/property/value-types/boolean") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/boolean") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/boolean") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/boolean") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: boolean (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BytesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BytesImpl.java new file mode 100644 index 00000000000..a4438dfd871 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/BytesImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Bytes. + */ +public final class BytesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BytesService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of BytesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BytesImpl(ValueTypesClientImpl client) { + this.service = RestProxy.create(BytesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientBytes to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientBytes") + public interface BytesService { + @Get("/type/property/value-types/bytes") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/bytes") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/bytes") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/bytes") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: byte[] (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsIntsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsIntsImpl.java new file mode 100644 index 00000000000..ea7185bb581 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsIntsImpl.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CollectionsInts. + */ +public final class CollectionsIntsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final CollectionsIntsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of CollectionsIntsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionsIntsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(CollectionsIntsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientCollectionsInts to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientCollectionsInts") + public interface CollectionsIntsService { + @Get("/type/property/value-types/collections/int") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/collections/int") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/collections/int") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/collections/int") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         int (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsModelsImpl.java new file mode 100644 index 00000000000..6ec4d7806d1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsModelsImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CollectionsModels. + */ +public final class CollectionsModelsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final CollectionsModelsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of CollectionsModelsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionsModelsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(CollectionsModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientCollectionsModels to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientCollectionsModels") + public interface CollectionsModelsService { + @Get("/type/property/value-types/collections/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/collections/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/collections/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/collections/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *          (Required){
+     *             property: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *          (Required){
+     *             property: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *          (Required){
+     *             property: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *          (Required){
+     *             property: String (Required)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsStringsImpl.java new file mode 100644 index 00000000000..6a3f8caf66c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/CollectionsStringsImpl.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CollectionsStrings. + */ +public final class CollectionsStringsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final CollectionsStringsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of CollectionsStringsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CollectionsStringsImpl(ValueTypesClientImpl client) { + this.service = RestProxy.create(CollectionsStringsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientCollectionsStrings to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientCollectionsStrings") + public interface CollectionsStringsService { + @Get("/type/property/value-types/collections/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/collections/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/collections/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/collections/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): [
+     *         String (Required)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DatetimeOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DatetimeOperationsImpl.java new file mode 100644 index 00000000000..d6a9daa95bf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DatetimeOperationsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DatetimeOperations. + */ +public final class DatetimeOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DatetimeOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of DatetimeOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatetimeOperationsImpl(ValueTypesClientImpl client) { + this.service = RestProxy.create(DatetimeOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientDatetimeOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientDatetimeOperations") + public interface DatetimeOperationsService { + @Get("/type/property/value-types/datetime") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/datetime") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/datetime") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/datetime") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: OffsetDateTime (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/Decimal128sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/Decimal128sImpl.java new file mode 100644 index 00000000000..5a6efdc231b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/Decimal128sImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Decimal128s. + */ +public final class Decimal128sImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Decimal128sService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of Decimal128sImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Decimal128sImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(Decimal128sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientDecimal128s to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientDecimal128s") + public interface Decimal128sService { + @Get("/type/property/value-types/decimal128") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/decimal128") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/decimal128") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/decimal128") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DecimalsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DecimalsImpl.java new file mode 100644 index 00000000000..a6fe2c704ff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DecimalsImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Decimals. + */ +public final class DecimalsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DecimalsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of DecimalsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DecimalsImpl(ValueTypesClientImpl client) { + this.service = RestProxy.create(DecimalsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientDecimals to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientDecimals") + public interface DecimalsService { + @Get("/type/property/value-types/decimal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/decimal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/decimal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/decimal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BigDecimal (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DictionaryStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DictionaryStringsImpl.java new file mode 100644 index 00000000000..99379dae975 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DictionaryStringsImpl.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DictionaryStrings. + */ +public final class DictionaryStringsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DictionaryStringsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of DictionaryStringsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DictionaryStringsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(DictionaryStringsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientDictionaryStrings to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientDictionaryStrings") + public interface DictionaryStringsService { + @Get("/type/property/value-types/dictionary/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/dictionary/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/dictionary/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/dictionary/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DurationOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DurationOperationsImpl.java new file mode 100644 index 00000000000..7d266fb303d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/DurationOperationsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DurationOperations. + */ +public final class DurationOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DurationOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of DurationOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DurationOperationsImpl(ValueTypesClientImpl client) { + this.service = RestProxy.create(DurationOperationsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientDurationOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientDurationOperations") + public interface DurationOperationsService { + @Get("/type/property/value-types/duration") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/duration") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/duration") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/duration") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: Duration (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/EnumsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/EnumsImpl.java new file mode 100644 index 00000000000..710e7945c2f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/EnumsImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Enums. + */ +public final class EnumsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EnumsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of EnumsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnumsImpl(ValueTypesClientImpl client) { + this.service = RestProxy.create(EnumsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientEnums to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientEnums") + public interface EnumsService { + @Get("/type/property/value-types/enum") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/enum") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/enum") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/enum") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ExtensibleEnumsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ExtensibleEnumsImpl.java new file mode 100644 index 00000000000..9bb9da4c85d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ExtensibleEnumsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtensibleEnums. + */ +public final class ExtensibleEnumsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ExtensibleEnumsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of ExtensibleEnumsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtensibleEnumsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(ExtensibleEnumsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientExtensibleEnums to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientExtensibleEnums") + public interface ExtensibleEnumsService { + @Get("/type/property/value-types/extensible-enum") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/extensible-enum") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/extensible-enum") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/extensible-enum") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(ValueOne/ValueTwo) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatLiteralsImpl.java new file mode 100644 index 00000000000..c3e9adb82b0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatLiteralsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FloatLiterals. + */ +public final class FloatLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FloatLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of FloatLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FloatLiteralsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(FloatLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientFloatLiterals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientFloatLiterals") + public interface FloatLiteralsService { + @Get("/type/property/value-types/float/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/float/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/float/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/float/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatOperationsImpl.java new file mode 100644 index 00000000000..eee81b8e6ca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/FloatOperationsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FloatOperations. + */ +public final class FloatOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FloatOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of FloatOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FloatOperationsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(FloatOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientFloatOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientFloatOperations") + public interface FloatOperationsService { + @Get("/type/property/value-types/float") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/float") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/float") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/float") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: double (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntLiteralsImpl.java new file mode 100644 index 00000000000..780d6aa8971 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntLiteralsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in IntLiterals. + */ +public final class IntLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final IntLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of IntLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IntLiteralsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(IntLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientIntLiterals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientIntLiterals") + public interface IntLiteralsService { + @Get("/type/property/value-types/int/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/int/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/int/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/int/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntsImpl.java new file mode 100644 index 00000000000..191b2ff690c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/IntsImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Ints. + */ +public final class IntsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final IntsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of IntsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IntsImpl(ValueTypesClientImpl client) { + this.service = RestProxy.create(IntsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientInts to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientInts") + public interface IntsService { + @Get("/type/property/value-types/int") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/int") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/int") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/int") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: int (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ModelsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ModelsImpl.java new file mode 100644 index 00000000000..0b51fe6dba4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ModelsImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Models. + */ +public final class ModelsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ModelsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of ModelsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ModelsImpl(ValueTypesClientImpl client) { + this.service = RestProxy.create(ModelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientModels to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientModels") + public interface ModelsService { + @Get("/type/property/value-types/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/model") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/model") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         property: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         property: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         property: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property (Required): {
+     *         property: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/NeversImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/NeversImpl.java new file mode 100644 index 00000000000..f4f2ffbb86d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/NeversImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Nevers. + */ +public final class NeversImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NeversService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of NeversImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NeversImpl(ValueTypesClientImpl client) { + this.service = RestProxy.create(NeversService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientNevers to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientNevers") + public interface NeversService { + @Get("/type/property/value-types/never") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/never") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/never") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/never") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringLiteralsImpl.java new file mode 100644 index 00000000000..090022f5c9c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringLiteralsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringLiterals. + */ +public final class StringLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of StringLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringLiteralsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(StringLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientStringLiterals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientStringLiterals") + public interface StringLiteralsService { + @Get("/type/property/value-types/string/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/string/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/string/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/string/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringOperationsImpl.java new file mode 100644 index 00000000000..8f55bc90ad3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/StringOperationsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringOperations. + */ +public final class StringOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of StringOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringOperationsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(StringOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientStringOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientStringOperations") + public interface StringOperationsService { + @Get("/type/property/value-types/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionEnumValuesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionEnumValuesImpl.java new file mode 100644 index 00000000000..83f634d472a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionEnumValuesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnionEnumValues. + */ +public final class UnionEnumValuesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnionEnumValuesService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of UnionEnumValuesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnionEnumValuesImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(UnionEnumValuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientUnionEnumValues to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientUnionEnumValues") + public interface UnionEnumValuesService { + @Get("/type/property/value-types/union-enum-value") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/union-enum-value") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/union-enum-value") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/union-enum-value") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(value2) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(value2) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(value2) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(value2) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionFloatLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionFloatLiteralsImpl.java new file mode 100644 index 00000000000..2615c351363 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionFloatLiteralsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnionFloatLiterals. + */ +public final class UnionFloatLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnionFloatLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of UnionFloatLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnionFloatLiteralsImpl(ValueTypesClientImpl client) { + this.service = RestProxy.create(UnionFloatLiteralsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientUnionFloatLiterals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientUnionFloatLiterals") + public interface UnionFloatLiteralsService { + @Get("/type/property/value-types/union/float/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/union/float/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/union/float/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/union/float/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(43.125/46.875) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(43.125/46.875) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(43.125/46.875) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(43.125/46.875) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionIntLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionIntLiteralsImpl.java new file mode 100644 index 00000000000..3dccc0e7500 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionIntLiteralsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnionIntLiterals. + */ +public final class UnionIntLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnionIntLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of UnionIntLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnionIntLiteralsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(UnionIntLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientUnionIntLiterals to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientUnionIntLiterals") + public interface UnionIntLiteralsService { + @Get("/type/property/value-types/union/int/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/union/int/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/union/int/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/union/int/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(42/43) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(42/43) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(42/43) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(42/43) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionStringLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionStringLiteralsImpl.java new file mode 100644 index 00000000000..3e7b94df0c9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnionStringLiteralsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnionStringLiterals. + */ +public final class UnionStringLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnionStringLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of UnionStringLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnionStringLiteralsImpl(ValueTypesClientImpl client) { + this.service = RestProxy.create(UnionStringLiteralsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientUnionStringLiterals to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientUnionStringLiterals") + public interface UnionStringLiteralsService { + @Get("/type/property/value-types/union/string/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/union/string/literal") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/union/string/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/union/string/literal") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: String(hello/world) (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownArraysImpl.java new file mode 100644 index 00000000000..44999029889 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownArraysImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnknownArrays. + */ +public final class UnknownArraysImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnknownArraysService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of UnknownArraysImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnknownArraysImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(UnknownArraysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientUnknownArrays to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientUnknownArrays") + public interface UnknownArraysService { + @Get("/type/property/value-types/unknown/array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/unknown/array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/unknown/array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/unknown/array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownDictsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownDictsImpl.java new file mode 100644 index 00000000000..9d3678c1db9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownDictsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnknownDicts. + */ +public final class UnknownDictsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnknownDictsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of UnknownDictsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnknownDictsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(UnknownDictsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientUnknownDicts to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientUnknownDicts") + public interface UnknownDictsService { + @Get("/type/property/value-types/unknown/dict") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/unknown/dict") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/unknown/dict") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/unknown/dict") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownIntsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownIntsImpl.java new file mode 100644 index 00000000000..f623cbed5a8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownIntsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnknownInts. + */ +public final class UnknownIntsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnknownIntsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of UnknownIntsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnknownIntsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(UnknownIntsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientUnknownInts to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientUnknownInts") + public interface UnknownIntsService { + @Get("/type/property/value-types/unknown/int") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/unknown/int") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/unknown/int") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/unknown/int") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownStringsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownStringsImpl.java new file mode 100644 index 00000000000..940ae7a573f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/UnknownStringsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in UnknownStrings. + */ +public final class UnknownStringsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnknownStringsService service; + + /** + * The service client containing this operation class. + */ + private final ValueTypesClientImpl client; + + /** + * Initializes an instance of UnknownStringsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnknownStringsImpl(ValueTypesClientImpl client) { + this.service + = RestProxy.create(UnknownStringsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ValueTypesClientUnknownStrings to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ValueTypesClientUnknownStrings") + public interface UnknownStringsService { + @Get("/type/property/value-types/unknown/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/property/value-types/unknown/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/unknown/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/property/value-types/unknown/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * Get call. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return call along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * Put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     property: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java new file mode 100644 index 00000000000..de487bcec45 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java @@ -0,0 +1,527 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 ValueTypesClient type. + */ +public final class ValueTypesClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 BooleanOperationsImpl object to access its operations. + */ + private final BooleanOperationsImpl booleanOperations; + + /** + * Gets the BooleanOperationsImpl object to access its operations. + * + * @return the BooleanOperationsImpl object. + */ + public BooleanOperationsImpl getBooleanOperations() { + return this.booleanOperations; + } + + /** + * The StringOperationsImpl object to access its operations. + */ + private final StringOperationsImpl stringOperations; + + /** + * Gets the StringOperationsImpl object to access its operations. + * + * @return the StringOperationsImpl object. + */ + public StringOperationsImpl getStringOperations() { + return this.stringOperations; + } + + /** + * The BytesImpl object to access its operations. + */ + private final BytesImpl bytes; + + /** + * Gets the BytesImpl object to access its operations. + * + * @return the BytesImpl object. + */ + public BytesImpl getBytes() { + return this.bytes; + } + + /** + * The IntsImpl object to access its operations. + */ + private final IntsImpl ints; + + /** + * Gets the IntsImpl object to access its operations. + * + * @return the IntsImpl object. + */ + public IntsImpl getInts() { + return this.ints; + } + + /** + * The FloatOperationsImpl object to access its operations. + */ + private final FloatOperationsImpl floatOperations; + + /** + * Gets the FloatOperationsImpl object to access its operations. + * + * @return the FloatOperationsImpl object. + */ + public FloatOperationsImpl getFloatOperations() { + return this.floatOperations; + } + + /** + * The DecimalsImpl object to access its operations. + */ + private final DecimalsImpl decimals; + + /** + * Gets the DecimalsImpl object to access its operations. + * + * @return the DecimalsImpl object. + */ + public DecimalsImpl getDecimals() { + return this.decimals; + } + + /** + * The Decimal128sImpl object to access its operations. + */ + private final Decimal128sImpl decimal128s; + + /** + * Gets the Decimal128sImpl object to access its operations. + * + * @return the Decimal128sImpl object. + */ + public Decimal128sImpl getDecimal128s() { + return this.decimal128s; + } + + /** + * The DatetimeOperationsImpl object to access its operations. + */ + private final DatetimeOperationsImpl datetimeOperations; + + /** + * Gets the DatetimeOperationsImpl object to access its operations. + * + * @return the DatetimeOperationsImpl object. + */ + public DatetimeOperationsImpl getDatetimeOperations() { + return this.datetimeOperations; + } + + /** + * The DurationOperationsImpl object to access its operations. + */ + private final DurationOperationsImpl durationOperations; + + /** + * Gets the DurationOperationsImpl object to access its operations. + * + * @return the DurationOperationsImpl object. + */ + public DurationOperationsImpl getDurationOperations() { + return this.durationOperations; + } + + /** + * The EnumsImpl object to access its operations. + */ + private final EnumsImpl enums; + + /** + * Gets the EnumsImpl object to access its operations. + * + * @return the EnumsImpl object. + */ + public EnumsImpl getEnums() { + return this.enums; + } + + /** + * The ExtensibleEnumsImpl object to access its operations. + */ + private final ExtensibleEnumsImpl extensibleEnums; + + /** + * Gets the ExtensibleEnumsImpl object to access its operations. + * + * @return the ExtensibleEnumsImpl object. + */ + public ExtensibleEnumsImpl getExtensibleEnums() { + return this.extensibleEnums; + } + + /** + * The ModelsImpl object to access its operations. + */ + private final ModelsImpl models; + + /** + * Gets the ModelsImpl object to access its operations. + * + * @return the ModelsImpl object. + */ + public ModelsImpl getModels() { + return this.models; + } + + /** + * The CollectionsStringsImpl object to access its operations. + */ + private final CollectionsStringsImpl collectionsStrings; + + /** + * Gets the CollectionsStringsImpl object to access its operations. + * + * @return the CollectionsStringsImpl object. + */ + public CollectionsStringsImpl getCollectionsStrings() { + return this.collectionsStrings; + } + + /** + * The CollectionsIntsImpl object to access its operations. + */ + private final CollectionsIntsImpl collectionsInts; + + /** + * Gets the CollectionsIntsImpl object to access its operations. + * + * @return the CollectionsIntsImpl object. + */ + public CollectionsIntsImpl getCollectionsInts() { + return this.collectionsInts; + } + + /** + * The CollectionsModelsImpl object to access its operations. + */ + private final CollectionsModelsImpl collectionsModels; + + /** + * Gets the CollectionsModelsImpl object to access its operations. + * + * @return the CollectionsModelsImpl object. + */ + public CollectionsModelsImpl getCollectionsModels() { + return this.collectionsModels; + } + + /** + * The DictionaryStringsImpl object to access its operations. + */ + private final DictionaryStringsImpl dictionaryStrings; + + /** + * Gets the DictionaryStringsImpl object to access its operations. + * + * @return the DictionaryStringsImpl object. + */ + public DictionaryStringsImpl getDictionaryStrings() { + return this.dictionaryStrings; + } + + /** + * The NeversImpl object to access its operations. + */ + private final NeversImpl nevers; + + /** + * Gets the NeversImpl object to access its operations. + * + * @return the NeversImpl object. + */ + public NeversImpl getNevers() { + return this.nevers; + } + + /** + * The UnknownStringsImpl object to access its operations. + */ + private final UnknownStringsImpl unknownStrings; + + /** + * Gets the UnknownStringsImpl object to access its operations. + * + * @return the UnknownStringsImpl object. + */ + public UnknownStringsImpl getUnknownStrings() { + return this.unknownStrings; + } + + /** + * The UnknownIntsImpl object to access its operations. + */ + private final UnknownIntsImpl unknownInts; + + /** + * Gets the UnknownIntsImpl object to access its operations. + * + * @return the UnknownIntsImpl object. + */ + public UnknownIntsImpl getUnknownInts() { + return this.unknownInts; + } + + /** + * The UnknownDictsImpl object to access its operations. + */ + private final UnknownDictsImpl unknownDicts; + + /** + * Gets the UnknownDictsImpl object to access its operations. + * + * @return the UnknownDictsImpl object. + */ + public UnknownDictsImpl getUnknownDicts() { + return this.unknownDicts; + } + + /** + * The UnknownArraysImpl object to access its operations. + */ + private final UnknownArraysImpl unknownArrays; + + /** + * Gets the UnknownArraysImpl object to access its operations. + * + * @return the UnknownArraysImpl object. + */ + public UnknownArraysImpl getUnknownArrays() { + return this.unknownArrays; + } + + /** + * The StringLiteralsImpl object to access its operations. + */ + private final StringLiteralsImpl stringLiterals; + + /** + * Gets the StringLiteralsImpl object to access its operations. + * + * @return the StringLiteralsImpl object. + */ + public StringLiteralsImpl getStringLiterals() { + return this.stringLiterals; + } + + /** + * The IntLiteralsImpl object to access its operations. + */ + private final IntLiteralsImpl intLiterals; + + /** + * Gets the IntLiteralsImpl object to access its operations. + * + * @return the IntLiteralsImpl object. + */ + public IntLiteralsImpl getIntLiterals() { + return this.intLiterals; + } + + /** + * The FloatLiteralsImpl object to access its operations. + */ + private final FloatLiteralsImpl floatLiterals; + + /** + * Gets the FloatLiteralsImpl object to access its operations. + * + * @return the FloatLiteralsImpl object. + */ + public FloatLiteralsImpl getFloatLiterals() { + return this.floatLiterals; + } + + /** + * The BooleanLiteralsImpl object to access its operations. + */ + private final BooleanLiteralsImpl booleanLiterals; + + /** + * Gets the BooleanLiteralsImpl object to access its operations. + * + * @return the BooleanLiteralsImpl object. + */ + public BooleanLiteralsImpl getBooleanLiterals() { + return this.booleanLiterals; + } + + /** + * The UnionStringLiteralsImpl object to access its operations. + */ + private final UnionStringLiteralsImpl unionStringLiterals; + + /** + * Gets the UnionStringLiteralsImpl object to access its operations. + * + * @return the UnionStringLiteralsImpl object. + */ + public UnionStringLiteralsImpl getUnionStringLiterals() { + return this.unionStringLiterals; + } + + /** + * The UnionIntLiteralsImpl object to access its operations. + */ + private final UnionIntLiteralsImpl unionIntLiterals; + + /** + * Gets the UnionIntLiteralsImpl object to access its operations. + * + * @return the UnionIntLiteralsImpl object. + */ + public UnionIntLiteralsImpl getUnionIntLiterals() { + return this.unionIntLiterals; + } + + /** + * The UnionFloatLiteralsImpl object to access its operations. + */ + private final UnionFloatLiteralsImpl unionFloatLiterals; + + /** + * Gets the UnionFloatLiteralsImpl object to access its operations. + * + * @return the UnionFloatLiteralsImpl object. + */ + public UnionFloatLiteralsImpl getUnionFloatLiterals() { + return this.unionFloatLiterals; + } + + /** + * The UnionEnumValuesImpl object to access its operations. + */ + private final UnionEnumValuesImpl unionEnumValues; + + /** + * Gets the UnionEnumValuesImpl object to access its operations. + * + * @return the UnionEnumValuesImpl object. + */ + public UnionEnumValuesImpl getUnionEnumValues() { + return this.unionEnumValues; + } + + /** + * Initializes an instance of ValueTypesClient client. + * + * @param endpoint Service host. + */ + public ValueTypesClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ValueTypesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ValueTypesClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ValueTypesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ValueTypesClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.booleanOperations = new BooleanOperationsImpl(this); + this.stringOperations = new StringOperationsImpl(this); + this.bytes = new BytesImpl(this); + this.ints = new IntsImpl(this); + this.floatOperations = new FloatOperationsImpl(this); + this.decimals = new DecimalsImpl(this); + this.decimal128s = new Decimal128sImpl(this); + this.datetimeOperations = new DatetimeOperationsImpl(this); + this.durationOperations = new DurationOperationsImpl(this); + this.enums = new EnumsImpl(this); + this.extensibleEnums = new ExtensibleEnumsImpl(this); + this.models = new ModelsImpl(this); + this.collectionsStrings = new CollectionsStringsImpl(this); + this.collectionsInts = new CollectionsIntsImpl(this); + this.collectionsModels = new CollectionsModelsImpl(this); + this.dictionaryStrings = new DictionaryStringsImpl(this); + this.nevers = new NeversImpl(this); + this.unknownStrings = new UnknownStringsImpl(this); + this.unknownInts = new UnknownIntsImpl(this); + this.unknownDicts = new UnknownDictsImpl(this); + this.unknownArrays = new UnknownArraysImpl(this); + this.stringLiterals = new StringLiteralsImpl(this); + this.intLiterals = new IntLiteralsImpl(this); + this.floatLiterals = new FloatLiteralsImpl(this); + this.booleanLiterals = new BooleanLiteralsImpl(this); + this.unionStringLiterals = new UnionStringLiteralsImpl(this); + this.unionIntLiterals = new UnionIntLiteralsImpl(this); + this.unionFloatLiterals = new UnionFloatLiteralsImpl(this); + this.unionEnumValues = new UnionEnumValuesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/package-info.java new file mode 100644 index 00000000000..34103951ba0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ValueTypes. + * Illustrates various property types for models. + * + */ +package type.property.valuetypes.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanLiteralProperty.java new file mode 100644 index 00000000000..b7a689e78ce --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanLiteralProperty.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a boolean literal property. + */ +@Immutable +public final class BooleanLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final boolean property = true; + + /** + * Creates an instance of BooleanLiteralProperty class. + */ + @Generated + public BooleanLiteralProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public boolean isProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BooleanLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BooleanLiteralProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BooleanLiteralProperty. + */ + @Generated + public static BooleanLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BooleanLiteralProperty deserializedBooleanLiteralProperty = new BooleanLiteralProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedBooleanLiteralProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanProperty.java new file mode 100644 index 00000000000..41b64ac52e2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BooleanProperty.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a boolean property. + */ +@Immutable +public final class BooleanProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final boolean property; + + /** + * Creates an instance of BooleanProperty class. + * + * @param property the property value to set. + */ + @Generated + public BooleanProperty(boolean property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public boolean isProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BooleanProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BooleanProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BooleanProperty. + */ + @Generated + public static BooleanProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + boolean property = false; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + return new BooleanProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BytesProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BytesProperty.java new file mode 100644 index 00000000000..fbace5ecedb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/BytesProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a bytes property. + */ +@Immutable +public final class BytesProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final byte[] property; + + /** + * Creates an instance of BytesProperty class. + * + * @param property the property value to set. + */ + @Generated + public BytesProperty(byte[] property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public byte[] getProperty() { + return CoreUtils.clone(this.property); + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBinaryField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BytesProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BytesProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BytesProperty. + */ + @Generated + public static BytesProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + byte[] property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getBinary(); + } else { + reader.skipChildren(); + } + } + return new BytesProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsIntProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsIntProperty.java new file mode 100644 index 00000000000..c394910ff68 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsIntProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Model with collection int properties. + */ +@Immutable +public final class CollectionsIntProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final List property; + + /** + * Creates an instance of CollectionsIntProperty class. + * + * @param property the property value to set. + */ + @Generated + public CollectionsIntProperty(List property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public List getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("property", this.property, (writer, element) -> writer.writeInt(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CollectionsIntProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CollectionsIntProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CollectionsIntProperty. + */ + @Generated + public static CollectionsIntProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.readArray(reader1 -> reader1.getInt()); + } else { + reader.skipChildren(); + } + } + return new CollectionsIntProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsModelProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsModelProperty.java new file mode 100644 index 00000000000..7088cc2dc7a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsModelProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Model with collection model properties. + */ +@Immutable +public final class CollectionsModelProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final List property; + + /** + * Creates an instance of CollectionsModelProperty class. + * + * @param property the property value to set. + */ + @Generated + public CollectionsModelProperty(List property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public List getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("property", this.property, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CollectionsModelProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CollectionsModelProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CollectionsModelProperty. + */ + @Generated + public static CollectionsModelProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.readArray(reader1 -> InnerModel.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new CollectionsModelProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsStringProperty.java new file mode 100644 index 00000000000..f2f81d1de9d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/CollectionsStringProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Model with collection string properties. + */ +@Immutable +public final class CollectionsStringProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final List property; + + /** + * Creates an instance of CollectionsStringProperty class. + * + * @param property the property value to set. + */ + @Generated + public CollectionsStringProperty(List property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public List getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("property", this.property, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CollectionsStringProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CollectionsStringProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CollectionsStringProperty. + */ + @Generated + public static CollectionsStringProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.readArray(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + return new CollectionsStringProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DatetimeProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DatetimeProperty.java new file mode 100644 index 00000000000..501748838f1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DatetimeProperty.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Model with a datetime property. + */ +@Immutable +public final class DatetimeProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final OffsetDateTime property; + + /** + * Creates an instance of DatetimeProperty class. + * + * @param property the property value to set. + */ + @Generated + public DatetimeProperty(OffsetDateTime property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public OffsetDateTime getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", + this.property == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.property)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatetimeProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatetimeProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DatetimeProperty. + */ + @Generated + public static DatetimeProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffsetDateTime property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new DatetimeProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/Decimal128Property.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/Decimal128Property.java new file mode 100644 index 00000000000..da3abc59718 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/Decimal128Property.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; + +/** + * Model with a decimal128 property. + */ +@Immutable +public final class Decimal128Property implements JsonSerializable { + /* + * Property + */ + @Generated + private final BigDecimal property; + + /** + * Creates an instance of Decimal128Property class. + * + * @param property the property value to set. + */ + @Generated + public Decimal128Property(BigDecimal property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public BigDecimal getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Decimal128Property from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Decimal128Property if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Decimal128Property. + */ + @Generated + public static Decimal128Property fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BigDecimal property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getNullable(nonNullReader -> new BigDecimal(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new Decimal128Property(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DecimalProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DecimalProperty.java new file mode 100644 index 00000000000..0518fd901d8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DecimalProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; + +/** + * Model with a decimal property. + */ +@Immutable +public final class DecimalProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final BigDecimal property; + + /** + * Creates an instance of DecimalProperty class. + * + * @param property the property value to set. + */ + @Generated + public DecimalProperty(BigDecimal property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public BigDecimal getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DecimalProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DecimalProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DecimalProperty. + */ + @Generated + public static DecimalProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BigDecimal property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getNullable(nonNullReader -> new BigDecimal(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new DecimalProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DictionaryStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DictionaryStringProperty.java new file mode 100644 index 00000000000..e21d23522c2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DictionaryStringProperty.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Model with dictionary string properties. + */ +@Immutable +public final class DictionaryStringProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final Map property; + + /** + * Creates an instance of DictionaryStringProperty class. + * + * @param property the property value to set. + */ + @Generated + public DictionaryStringProperty(Map property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public Map getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("property", this.property, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DictionaryStringProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DictionaryStringProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DictionaryStringProperty. + */ + @Generated + public static DictionaryStringProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Map property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.readMap(reader1 -> reader1.getString()); + } else { + reader.skipChildren(); + } + } + return new DictionaryStringProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DurationProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DurationProperty.java new file mode 100644 index 00000000000..ee759f6d195 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/DurationProperty.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.Duration; + +/** + * Model with a duration property. + */ +@Immutable +public final class DurationProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final Duration property; + + /** + * Creates an instance of DurationProperty class. + * + * @param property the property value to set. + */ + @Generated + public DurationProperty(Duration property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public Duration getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", CoreUtils.durationToStringWithDays(this.property)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DurationProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DurationProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DurationProperty. + */ + @Generated + public static DurationProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Duration property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + return new DurationProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/EnumProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/EnumProperty.java new file mode 100644 index 00000000000..d871974fbe4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/EnumProperty.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with enum properties. + */ +@Immutable +public final class EnumProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final FixedInnerEnum property; + + /** + * Creates an instance of EnumProperty class. + * + * @param property the property value to set. + */ + @Generated + public EnumProperty(FixedInnerEnum property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public FixedInnerEnum getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnumProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnumProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EnumProperty. + */ + @Generated + public static EnumProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FixedInnerEnum property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = FixedInnerEnum.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new EnumProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtendedEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtendedEnum.java new file mode 100644 index 00000000000..4656aed65e5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtendedEnum.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ExtendedEnum. + */ +public final class ExtendedEnum extends ExpandableStringEnum { + /** + * Static value value2 for ExtendedEnum. + */ + @Generated + public static final ExtendedEnum ENUM_VALUE2 = fromString("value2"); + + /** + * Creates a new instance of ExtendedEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ExtendedEnum() { + } + + /** + * Creates or finds a ExtendedEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExtendedEnum. + */ + @Generated + public static ExtendedEnum fromString(String name) { + return fromString(name, ExtendedEnum.class); + } + + /** + * Gets known ExtendedEnum values. + * + * @return known ExtendedEnum values. + */ + @Generated + public static Collection values() { + return values(ExtendedEnum.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtensibleEnumProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtensibleEnumProperty.java new file mode 100644 index 00000000000..71365e7fafd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ExtensibleEnumProperty.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with extensible enum properties. + */ +@Immutable +public final class ExtensibleEnumProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final InnerEnum property; + + /** + * Creates an instance of ExtensibleEnumProperty class. + * + * @param property the property value to set. + */ + @Generated + public ExtensibleEnumProperty(InnerEnum property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public InnerEnum getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtensibleEnumProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtensibleEnumProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExtensibleEnumProperty. + */ + @Generated + public static ExtensibleEnumProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InnerEnum property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = InnerEnum.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new ExtensibleEnumProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FixedInnerEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FixedInnerEnum.java new file mode 100644 index 00000000000..84f48a0084f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FixedInnerEnum.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +/** + * Enum that will be used as a property for model EnumProperty. Non-extensible. + */ +public enum FixedInnerEnum { + /** + * First value. + */ + VALUE_ONE("ValueOne"), + + /** + * Second value. + */ + VALUE_TWO("ValueTwo"); + + /** + * The actual serialized value for a FixedInnerEnum instance. + */ + private final String value; + + FixedInnerEnum(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a FixedInnerEnum instance. + * + * @param value the serialized value to parse. + * @return the parsed FixedInnerEnum object, or null if unable to parse. + */ + public static FixedInnerEnum fromString(String value) { + if (value == null) { + return null; + } + FixedInnerEnum[] items = FixedInnerEnum.values(); + for (FixedInnerEnum item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatLiteralProperty.java new file mode 100644 index 00000000000..dfdda313680 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatLiteralProperty.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a float literal property. + */ +@Immutable +public final class FloatLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final double property = 43.125; + + /** + * Creates an instance of FloatLiteralProperty class. + */ + @Generated + public FloatLiteralProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public double getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FloatLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FloatLiteralProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FloatLiteralProperty. + */ + @Generated + public static FloatLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FloatLiteralProperty deserializedFloatLiteralProperty = new FloatLiteralProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedFloatLiteralProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatProperty.java new file mode 100644 index 00000000000..a2ff3ab67dc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/FloatProperty.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a float property. + */ +@Immutable +public final class FloatProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final double property; + + /** + * Creates an instance of FloatProperty class. + * + * @param property the property value to set. + */ + @Generated + public FloatProperty(double property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public double getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeDoubleField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FloatProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FloatProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FloatProperty. + */ + @Generated + public static FloatProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + double property = 0.0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getDouble(); + } else { + reader.skipChildren(); + } + } + return new FloatProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerEnum.java new file mode 100644 index 00000000000..727ca05bb31 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerEnum.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum that will be used as a property for model EnumProperty. Extensible. + */ +public final class InnerEnum extends ExpandableStringEnum { + /** + * First value. + */ + @Generated + public static final InnerEnum VALUE_ONE = fromString("ValueOne"); + + /** + * Second value. + */ + @Generated + public static final InnerEnum VALUE_TWO = fromString("ValueTwo"); + + /** + * Creates a new instance of InnerEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public InnerEnum() { + } + + /** + * Creates or finds a InnerEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding InnerEnum. + */ + @Generated + public static InnerEnum fromString(String name) { + return fromString(name, InnerEnum.class); + } + + /** + * Gets known InnerEnum values. + * + * @return known InnerEnum values. + */ + @Generated + public static Collection values() { + return values(InnerEnum.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerModel.java new file mode 100644 index 00000000000..0567649a5e0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/InnerModel.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Inner model. Will be a property type for ModelWithModelProperties. + */ +@Immutable +public final class InnerModel implements JsonSerializable { + /* + * Required string property + */ + @Generated + private final String property; + + /** + * Creates an instance of InnerModel class. + * + * @param property the property value to set. + */ + @Generated + public InnerModel(String property) { + this.property = property; + } + + /** + * Get the property property: Required string property. + * + * @return the property value. + */ + @Generated + public String getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InnerModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InnerModel. + */ + @Generated + public static InnerModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new InnerModel(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntLiteralProperty.java new file mode 100644 index 00000000000..46d15d77b1a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntLiteralProperty.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a int literal property. + */ +@Immutable +public final class IntLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final int property = 42; + + /** + * Creates an instance of IntLiteralProperty class. + */ + @Generated + public IntLiteralProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public int getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IntLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IntLiteralProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IntLiteralProperty. + */ + @Generated + public static IntLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IntLiteralProperty deserializedIntLiteralProperty = new IntLiteralProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedIntLiteralProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntProperty.java new file mode 100644 index 00000000000..37e5a584e34 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/IntProperty.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a int property. + */ +@Immutable +public final class IntProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final int property; + + /** + * Creates an instance of IntProperty class. + * + * @param property the property value to set. + */ + @Generated + public IntProperty(int property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public int getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IntProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IntProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IntProperty. + */ + @Generated + public static IntProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int property = 0; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getInt(); + } else { + reader.skipChildren(); + } + } + return new IntProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ModelProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ModelProperty.java new file mode 100644 index 00000000000..1f431790702 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/ModelProperty.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with model properties. + */ +@Immutable +public final class ModelProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final InnerModel property; + + /** + * Creates an instance of ModelProperty class. + * + * @param property the property value to set. + */ + @Generated + public ModelProperty(InnerModel property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public InnerModel getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ModelProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ModelProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ModelProperty. + */ + @Generated + public static ModelProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InnerModel property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = InnerModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new ModelProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/NeverProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/NeverProperty.java new file mode 100644 index 00000000000..61a92e165d3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/NeverProperty.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a property never. (This property should not be included). + */ +@Immutable +public final class NeverProperty implements JsonSerializable { + /** + * Creates an instance of NeverProperty class. + */ + @Generated + public NeverProperty() { + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NeverProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NeverProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the NeverProperty. + */ + @Generated + public static NeverProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NeverProperty deserializedNeverProperty = new NeverProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedNeverProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringLiteralProperty.java new file mode 100644 index 00000000000..bb4de27a2f8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringLiteralProperty.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a string literal property. + */ +@Immutable +public final class StringLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final String property = "hello"; + + /** + * Creates an instance of StringLiteralProperty class. + */ + @Generated + public StringLiteralProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public String getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StringLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StringLiteralProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StringLiteralProperty. + */ + @Generated + public static StringLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StringLiteralProperty deserializedStringLiteralProperty = new StringLiteralProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedStringLiteralProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringProperty.java new file mode 100644 index 00000000000..d61a4dd096d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/StringProperty.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a string property. + */ +@Immutable +public final class StringProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final String property; + + /** + * Creates an instance of StringProperty class. + * + * @param property the property value to set. + */ + @Generated + public StringProperty(String property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public String getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StringProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StringProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StringProperty. + */ + @Generated + public static StringProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new StringProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionEnumValueProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionEnumValueProperty.java new file mode 100644 index 00000000000..98bfb03f502 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionEnumValueProperty.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Template type for testing models with specific properties. Pass in the type of the property you are looking for. + */ +@Immutable +public final class UnionEnumValueProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final ExtendedEnum property = ExtendedEnum.ENUM_VALUE2; + + /** + * Creates an instance of UnionEnumValueProperty class. + */ + @Generated + public UnionEnumValueProperty() { + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public ExtendedEnum getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnionEnumValueProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnionEnumValueProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UnionEnumValueProperty. + */ + @Generated + public static UnionEnumValueProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UnionEnumValueProperty deserializedUnionEnumValueProperty = new UnionEnumValueProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedUnionEnumValueProperty; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralProperty.java new file mode 100644 index 00000000000..115ced37d2b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralProperty.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a union of float literal as property. + */ +@Immutable +public final class UnionFloatLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final UnionFloatLiteralPropertyProperty property; + + /** + * Creates an instance of UnionFloatLiteralProperty class. + * + * @param property the property value to set. + */ + @Generated + public UnionFloatLiteralProperty(UnionFloatLiteralPropertyProperty property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public UnionFloatLiteralPropertyProperty getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("property", this.property == null ? null : this.property.toDouble()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnionFloatLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnionFloatLiteralProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UnionFloatLiteralProperty. + */ + @Generated + public static UnionFloatLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UnionFloatLiteralPropertyProperty property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = UnionFloatLiteralPropertyProperty.fromDouble(reader.getDouble()); + } else { + reader.skipChildren(); + } + } + return new UnionFloatLiteralProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralPropertyProperty.java new file mode 100644 index 00000000000..a445f970692 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionFloatLiteralPropertyProperty.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +/** + * Defines values for UnionFloatLiteralPropertyProperty. + */ +public enum UnionFloatLiteralPropertyProperty { + /** + * Enum value 43.125. + */ + FOUR_THREE_ONE_TWO_FIVE(43.125), + + /** + * Enum value 46.875. + */ + FOUR_SIX_EIGHT_SEVEN_FIVE(46.875); + + /** + * The actual serialized value for a UnionFloatLiteralPropertyProperty instance. + */ + private final double value; + + UnionFloatLiteralPropertyProperty(double value) { + this.value = value; + } + + /** + * Parses a serialized value to a UnionFloatLiteralPropertyProperty instance. + * + * @param value the serialized value to parse. + * @return the parsed UnionFloatLiteralPropertyProperty object, or null if unable to parse. + */ + public static UnionFloatLiteralPropertyProperty fromDouble(double value) { + UnionFloatLiteralPropertyProperty[] items = UnionFloatLiteralPropertyProperty.values(); + for (UnionFloatLiteralPropertyProperty item : items) { + if (Double.doubleToLongBits(item.toDouble()) == Double.doubleToLongBits(value)) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to double value. + * + * @return the double value. + */ + public double toDouble() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralProperty.java new file mode 100644 index 00000000000..bed531ef4e3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralProperty.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a union of int literal as property. + */ +@Immutable +public final class UnionIntLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final UnionIntLiteralPropertyProperty property; + + /** + * Creates an instance of UnionIntLiteralProperty class. + * + * @param property the property value to set. + */ + @Generated + public UnionIntLiteralProperty(UnionIntLiteralPropertyProperty property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public UnionIntLiteralPropertyProperty getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("property", this.property == null ? null : this.property.toInt()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnionIntLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnionIntLiteralProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UnionIntLiteralProperty. + */ + @Generated + public static UnionIntLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UnionIntLiteralPropertyProperty property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = UnionIntLiteralPropertyProperty.fromInt(reader.getInt()); + } else { + reader.skipChildren(); + } + } + return new UnionIntLiteralProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralPropertyProperty.java new file mode 100644 index 00000000000..4e266ea00cd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionIntLiteralPropertyProperty.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +/** + * Defines values for UnionIntLiteralPropertyProperty. + */ +public enum UnionIntLiteralPropertyProperty { + /** + * Enum value 42. + */ + FOUR_TWO(42), + + /** + * Enum value 43. + */ + FOUR_THREE(43); + + /** + * The actual serialized value for a UnionIntLiteralPropertyProperty instance. + */ + private final int value; + + UnionIntLiteralPropertyProperty(int value) { + this.value = value; + } + + /** + * Parses a serialized value to a UnionIntLiteralPropertyProperty instance. + * + * @param value the serialized value to parse. + * @return the parsed UnionIntLiteralPropertyProperty object, or null if unable to parse. + */ + public static UnionIntLiteralPropertyProperty fromInt(int value) { + UnionIntLiteralPropertyProperty[] items = UnionIntLiteralPropertyProperty.values(); + for (UnionIntLiteralPropertyProperty item : items) { + if (item.toInt() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to int value. + * + * @return the int value. + */ + public int toInt() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralProperty.java new file mode 100644 index 00000000000..fabc9144c08 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralProperty.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a union of string literal as property. + */ +@Immutable +public final class UnionStringLiteralProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final UnionStringLiteralPropertyProperty property; + + /** + * Creates an instance of UnionStringLiteralProperty class. + * + * @param property the property value to set. + */ + @Generated + public UnionStringLiteralProperty(UnionStringLiteralPropertyProperty property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public UnionStringLiteralPropertyProperty getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("property", this.property == null ? null : this.property.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnionStringLiteralProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnionStringLiteralProperty if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UnionStringLiteralProperty. + */ + @Generated + public static UnionStringLiteralProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UnionStringLiteralPropertyProperty property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = UnionStringLiteralPropertyProperty.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new UnionStringLiteralProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralPropertyProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralPropertyProperty.java new file mode 100644 index 00000000000..d1c1110a080 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnionStringLiteralPropertyProperty.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +/** + * Defines values for UnionStringLiteralPropertyProperty. + */ +public enum UnionStringLiteralPropertyProperty { + /** + * Enum value hello. + */ + HELLO("hello"), + + /** + * Enum value world. + */ + WORLD("world"); + + /** + * The actual serialized value for a UnionStringLiteralPropertyProperty instance. + */ + private final String value; + + UnionStringLiteralPropertyProperty(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a UnionStringLiteralPropertyProperty instance. + * + * @param value the serialized value to parse. + * @return the parsed UnionStringLiteralPropertyProperty object, or null if unable to parse. + */ + public static UnionStringLiteralPropertyProperty fromString(String value) { + if (value == null) { + return null; + } + UnionStringLiteralPropertyProperty[] items = UnionStringLiteralPropertyProperty.values(); + for (UnionStringLiteralPropertyProperty item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownArrayProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownArrayProperty.java new file mode 100644 index 00000000000..adb0c54fdb9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownArrayProperty.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a property unknown, and the data is an array. + */ +@Immutable +public final class UnknownArrayProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final BinaryData property; + + /** + * Creates an instance of UnknownArrayProperty class. + * + * @param property the property value to set. + */ + @Generated + public UnknownArrayProperty(BinaryData property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public BinaryData getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeFieldName("property"); + this.property.writeTo(jsonWriter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnknownArrayProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnknownArrayProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UnknownArrayProperty. + */ + @Generated + public static UnknownArrayProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryData property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + return new UnknownArrayProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownDictProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownDictProperty.java new file mode 100644 index 00000000000..ab910ee8ba4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownDictProperty.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a property unknown, and the data is a dictionnary. + */ +@Immutable +public final class UnknownDictProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final BinaryData property; + + /** + * Creates an instance of UnknownDictProperty class. + * + * @param property the property value to set. + */ + @Generated + public UnknownDictProperty(BinaryData property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public BinaryData getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeFieldName("property"); + this.property.writeTo(jsonWriter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnknownDictProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnknownDictProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UnknownDictProperty. + */ + @Generated + public static UnknownDictProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryData property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + return new UnknownDictProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownIntProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownIntProperty.java new file mode 100644 index 00000000000..5d2ac90a0f9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownIntProperty.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a property unknown, and the data is a int32. + */ +@Immutable +public final class UnknownIntProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final BinaryData property; + + /** + * Creates an instance of UnknownIntProperty class. + * + * @param property the property value to set. + */ + @Generated + public UnknownIntProperty(BinaryData property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public BinaryData getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeFieldName("property"); + this.property.writeTo(jsonWriter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnknownIntProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnknownIntProperty if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UnknownIntProperty. + */ + @Generated + public static UnknownIntProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryData property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + return new UnknownIntProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownStringProperty.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownStringProperty.java new file mode 100644 index 00000000000..9afa18cc527 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/UnknownStringProperty.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model with a property unknown, and the data is a string. + */ +@Immutable +public final class UnknownStringProperty implements JsonSerializable { + /* + * Property + */ + @Generated + private final BinaryData property; + + /** + * Creates an instance of UnknownStringProperty class. + * + * @param property the property value to set. + */ + @Generated + public UnknownStringProperty(BinaryData property) { + this.property = property; + } + + /** + * Get the property property: Property. + * + * @return the property value. + */ + @Generated + public BinaryData getProperty() { + return this.property; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeFieldName("property"); + this.property.writeTo(jsonWriter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UnknownStringProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UnknownStringProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the UnknownStringProperty. + */ + @Generated + public static UnknownStringProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryData property = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("property".equals(fieldName)) { + property = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + return new UnknownStringProperty(property); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/package-info.java new file mode 100644 index 00000000000..74b53764dd3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for ValueTypes. + * Illustrates various property types for models. + * + */ +package type.property.valuetypes.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/package-info.java new file mode 100644 index 00000000000..0b9a128ae2f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/property/valuetypes/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ValueTypes. + * Illustrates various property types for models. + * + */ +package type.property.valuetypes; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationAsyncClient.java new file mode 100644 index 00000000000..7546b6de7b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationAsyncClient.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.scalar.implementation.BooleanOperationsImpl; + +/** + * Initializes a new instance of the asynchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) +public final class BooleanOperationAsyncClient { + @Generated + private final BooleanOperationsImpl serviceClient; + + /** + * Initializes an instance of BooleanOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BooleanOperationAsyncClient(BooleanOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * get boolean value. + *

Response Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return boolean value along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * put boolean value. + *

Request Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * get boolean value. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return boolean value on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Boolean.class)); + } + + /** + * put boolean value. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(boolean body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationClient.java new file mode 100644 index 00000000000..c9555540278 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/BooleanOperationClient.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.scalar.implementation.BooleanOperationsImpl; + +/** + * Initializes a new instance of the synchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class) +public final class BooleanOperationClient { + @Generated + private final BooleanOperationsImpl serviceClient; + + /** + * Initializes an instance of BooleanOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BooleanOperationClient(BooleanOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * get boolean value. + *

Response Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return boolean value along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * put boolean value. + *

Request Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * get boolean value. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return boolean value. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public boolean get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(Boolean.class); + } + + /** + * put boolean value. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(boolean body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeAsyncClient.java new file mode 100644 index 00000000000..40e784d5185 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeAsyncClient.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import java.math.BigDecimal; +import reactor.core.publisher.Mono; +import type.scalar.implementation.Decimal128TypesImpl; + +/** + * Initializes a new instance of the asynchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) +public final class Decimal128TypeAsyncClient { + @Generated + private final Decimal128TypesImpl serviceClient; + + /** + * Initializes an instance of Decimal128TypeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Decimal128TypeAsyncClient(Decimal128TypesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The responseBody operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 128-bit decimal number along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> responseBodyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.responseBodyWithResponseAsync(requestOptions); + } + + /** + * The requestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requestBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.requestBodyWithResponseAsync(body, requestOptions); + } + + /** + * The requestParameter operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requestParameterWithResponse(BigDecimal value, RequestOptions requestOptions) { + return this.serviceClient.requestParameterWithResponseAsync(value, requestOptions); + } + + /** + * The responseBody operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 128-bit decimal number on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono responseBody() { + // Generated convenience method for responseBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return responseBodyWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BigDecimal.class)); + } + + /** + * The requestBody operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono requestBody(BigDecimal body) { + // Generated convenience method for requestBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return requestBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The requestParameter operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono requestParameter(BigDecimal value) { + // Generated convenience method for requestParameterWithResponse + RequestOptions requestOptions = new RequestOptions(); + return requestParameterWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeClient.java new file mode 100644 index 00000000000..21e355a875b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128TypeClient.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.math.BigDecimal; +import type.scalar.implementation.Decimal128TypesImpl; + +/** + * Initializes a new instance of the synchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class) +public final class Decimal128TypeClient { + @Generated + private final Decimal128TypesImpl serviceClient; + + /** + * Initializes an instance of Decimal128TypeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Decimal128TypeClient(Decimal128TypesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The responseBody operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 128-bit decimal number along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response responseBodyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.responseBodyWithResponse(requestOptions); + } + + /** + * The requestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requestBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.requestBodyWithResponse(body, requestOptions); + } + + /** + * The requestParameter operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requestParameterWithResponse(BigDecimal value, RequestOptions requestOptions) { + return this.serviceClient.requestParameterWithResponse(value, requestOptions); + } + + /** + * The responseBody operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a 128-bit decimal number. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BigDecimal responseBody() { + // Generated convenience method for responseBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return responseBodyWithResponse(requestOptions).getValue().toObject(BigDecimal.class); + } + + /** + * The requestBody operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void requestBody(BigDecimal body) { + // Generated convenience method for requestBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + requestBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The requestParameter operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void requestParameter(BigDecimal value) { + // Generated convenience method for requestParameterWithResponse + RequestOptions requestOptions = new RequestOptions(); + requestParameterWithResponse(value, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyAsyncClient.java new file mode 100644 index 00000000000..db2d9d7d300 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyAsyncClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.math.BigDecimal; +import java.util.List; +import reactor.core.publisher.Mono; +import type.scalar.implementation.Decimal128VerifiesImpl; + +/** + * Initializes a new instance of the asynchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) +public final class Decimal128VerifyAsyncClient { + @Generated + private final Decimal128VerifiesImpl serviceClient; + + /** + * Initializes an instance of Decimal128VerifyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Decimal128VerifyAsyncClient(Decimal128VerifiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The prepareVerify operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     BigDecimal (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> prepareVerifyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.prepareVerifyWithResponseAsync(requestOptions); + } + + /** + * The verify operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.verifyWithResponseAsync(body, requestOptions); + } + + /** + * The prepareVerify operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> prepareVerify() { + // Generated convenience method for prepareVerifyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return prepareVerifyWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_BIG_DECIMAL)); + } + + /** + * The verify operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono verify(BigDecimal body) { + // Generated convenience method for verifyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return verifyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_BIG_DECIMAL + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyClient.java new file mode 100644 index 00000000000..3ed157063ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/Decimal128VerifyClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.math.BigDecimal; +import java.util.List; +import type.scalar.implementation.Decimal128VerifiesImpl; + +/** + * Initializes a new instance of the synchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class) +public final class Decimal128VerifyClient { + @Generated + private final Decimal128VerifiesImpl serviceClient; + + /** + * Initializes an instance of Decimal128VerifyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + Decimal128VerifyClient(Decimal128VerifiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The prepareVerify operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     BigDecimal (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response prepareVerifyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.prepareVerifyWithResponse(requestOptions); + } + + /** + * The verify operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.verifyWithResponse(body, requestOptions); + } + + /** + * The prepareVerify operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List prepareVerify() { + // Generated convenience method for prepareVerifyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return prepareVerifyWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_BIG_DECIMAL); + } + + /** + * The verify operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void verify(BigDecimal body) { + // Generated convenience method for verifyWithResponse + RequestOptions requestOptions = new RequestOptions(); + verifyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_BIG_DECIMAL + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeAsyncClient.java new file mode 100644 index 00000000000..9f607bd3f29 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeAsyncClient.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import java.math.BigDecimal; +import reactor.core.publisher.Mono; +import type.scalar.implementation.DecimalTypesImpl; + +/** + * Initializes a new instance of the asynchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) +public final class DecimalTypeAsyncClient { + @Generated + private final DecimalTypesImpl serviceClient; + + /** + * Initializes an instance of DecimalTypeAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DecimalTypeAsyncClient(DecimalTypesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The responseBody operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a decimal number with any length and precision along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> responseBodyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.responseBodyWithResponseAsync(requestOptions); + } + + /** + * The requestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requestBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.requestBodyWithResponseAsync(body, requestOptions); + } + + /** + * The requestParameter operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requestParameterWithResponse(BigDecimal value, RequestOptions requestOptions) { + return this.serviceClient.requestParameterWithResponseAsync(value, requestOptions); + } + + /** + * The responseBody operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a decimal number with any length and precision on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono responseBody() { + // Generated convenience method for responseBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return responseBodyWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(BigDecimal.class)); + } + + /** + * The requestBody operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono requestBody(BigDecimal body) { + // Generated convenience method for requestBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return requestBodyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The requestParameter operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono requestParameter(BigDecimal value) { + // Generated convenience method for requestParameterWithResponse + RequestOptions requestOptions = new RequestOptions(); + return requestParameterWithResponse(value, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeClient.java new file mode 100644 index 00000000000..8d348699360 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalTypeClient.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.math.BigDecimal; +import type.scalar.implementation.DecimalTypesImpl; + +/** + * Initializes a new instance of the synchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class) +public final class DecimalTypeClient { + @Generated + private final DecimalTypesImpl serviceClient; + + /** + * Initializes an instance of DecimalTypeClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DecimalTypeClient(DecimalTypesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The responseBody operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a decimal number with any length and precision along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response responseBodyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.responseBodyWithResponse(requestOptions); + } + + /** + * The requestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requestBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.requestBodyWithResponse(body, requestOptions); + } + + /** + * The requestParameter operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requestParameterWithResponse(BigDecimal value, RequestOptions requestOptions) { + return this.serviceClient.requestParameterWithResponse(value, requestOptions); + } + + /** + * The responseBody operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a decimal number with any length and precision. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BigDecimal responseBody() { + // Generated convenience method for responseBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return responseBodyWithResponse(requestOptions).getValue().toObject(BigDecimal.class); + } + + /** + * The requestBody operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void requestBody(BigDecimal body) { + // Generated convenience method for requestBodyWithResponse + RequestOptions requestOptions = new RequestOptions(); + requestBodyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + /** + * The requestParameter operation. + * + * @param value The value parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void requestParameter(BigDecimal value) { + // Generated convenience method for requestParameterWithResponse + RequestOptions requestOptions = new RequestOptions(); + requestParameterWithResponse(value, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyAsyncClient.java new file mode 100644 index 00000000000..680599b58b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyAsyncClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.TypeReference; +import java.math.BigDecimal; +import java.util.List; +import reactor.core.publisher.Mono; +import type.scalar.implementation.DecimalVerifiesImpl; + +/** + * Initializes a new instance of the asynchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) +public final class DecimalVerifyAsyncClient { + @Generated + private final DecimalVerifiesImpl serviceClient; + + /** + * Initializes an instance of DecimalVerifyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DecimalVerifyAsyncClient(DecimalVerifiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The prepareVerify operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     BigDecimal (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> prepareVerifyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.prepareVerifyWithResponseAsync(requestOptions); + } + + /** + * The verify operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.verifyWithResponseAsync(body, requestOptions); + } + + /** + * The prepareVerify operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> prepareVerify() { + // Generated convenience method for prepareVerifyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return prepareVerifyWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_BIG_DECIMAL)); + } + + /** + * The verify operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono verify(BigDecimal body) { + // Generated convenience method for verifyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return verifyWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_BIG_DECIMAL + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyClient.java new file mode 100644 index 00000000000..4626dbf214e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/DecimalVerifyClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.math.BigDecimal; +import java.util.List; +import type.scalar.implementation.DecimalVerifiesImpl; + +/** + * Initializes a new instance of the synchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class) +public final class DecimalVerifyClient { + @Generated + private final DecimalVerifiesImpl serviceClient; + + /** + * Initializes an instance of DecimalVerifyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + DecimalVerifyClient(DecimalVerifiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The prepareVerify operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     BigDecimal (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response prepareVerifyWithResponse(RequestOptions requestOptions) { + return this.serviceClient.prepareVerifyWithResponse(requestOptions); + } + + /** + * The verify operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.verifyWithResponse(body, requestOptions); + } + + /** + * The prepareVerify operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public List prepareVerify() { + // Generated convenience method for prepareVerifyWithResponse + RequestOptions requestOptions = new RequestOptions(); + return prepareVerifyWithResponse(requestOptions).getValue().toObject(TYPE_REFERENCE_LIST_BIG_DECIMAL); + } + + /** + * The verify operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void verify(BigDecimal body) { + // Generated convenience method for verifyWithResponse + RequestOptions requestOptions = new RequestOptions(); + verifyWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } + + @Generated + private static final TypeReference> TYPE_REFERENCE_LIST_BIG_DECIMAL + = new TypeReference>() { + }; +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/ScalarClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/ScalarClientBuilder.java new file mode 100644 index 00000000000..8e56dfce0c3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/ScalarClientBuilder.java @@ -0,0 +1,422 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.scalar.implementation.ScalarClientImpl; + +/** + * A builder for creating a new instance of the ScalarClient type. + */ +@ServiceClientBuilder( + serviceClients = { + StringOperationClient.class, + BooleanOperationClient.class, + UnknownClient.class, + DecimalTypeClient.class, + Decimal128TypeClient.class, + DecimalVerifyClient.class, + Decimal128VerifyClient.class, + StringOperationAsyncClient.class, + BooleanOperationAsyncClient.class, + UnknownAsyncClient.class, + DecimalTypeAsyncClient.class, + Decimal128TypeAsyncClient.class, + DecimalVerifyAsyncClient.class, + Decimal128VerifyAsyncClient.class }) +public final class ScalarClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("type-scalar.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ScalarClientBuilder. + */ + @Generated + public ScalarClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ScalarClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ScalarClientBuilder. + */ + @Generated + public ScalarClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ScalarClientImpl with the provided parameters. + * + * @return an instance of ScalarClientImpl. + */ + @Generated + private ScalarClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + ScalarClientImpl client + = new ScalarClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of StringOperationAsyncClient class. + * + * @return an instance of StringOperationAsyncClient. + */ + @Generated + public StringOperationAsyncClient buildStringOperationAsyncClient() { + return new StringOperationAsyncClient(buildInnerClient().getStringOperations()); + } + + /** + * Builds an instance of BooleanOperationAsyncClient class. + * + * @return an instance of BooleanOperationAsyncClient. + */ + @Generated + public BooleanOperationAsyncClient buildBooleanOperationAsyncClient() { + return new BooleanOperationAsyncClient(buildInnerClient().getBooleanOperations()); + } + + /** + * Builds an instance of UnknownAsyncClient class. + * + * @return an instance of UnknownAsyncClient. + */ + @Generated + public UnknownAsyncClient buildUnknownAsyncClient() { + return new UnknownAsyncClient(buildInnerClient().getUnknowns()); + } + + /** + * Builds an instance of DecimalTypeAsyncClient class. + * + * @return an instance of DecimalTypeAsyncClient. + */ + @Generated + public DecimalTypeAsyncClient buildDecimalTypeAsyncClient() { + return new DecimalTypeAsyncClient(buildInnerClient().getDecimalTypes()); + } + + /** + * Builds an instance of Decimal128TypeAsyncClient class. + * + * @return an instance of Decimal128TypeAsyncClient. + */ + @Generated + public Decimal128TypeAsyncClient buildDecimal128TypeAsyncClient() { + return new Decimal128TypeAsyncClient(buildInnerClient().getDecimal128Types()); + } + + /** + * Builds an instance of DecimalVerifyAsyncClient class. + * + * @return an instance of DecimalVerifyAsyncClient. + */ + @Generated + public DecimalVerifyAsyncClient buildDecimalVerifyAsyncClient() { + return new DecimalVerifyAsyncClient(buildInnerClient().getDecimalVerifies()); + } + + /** + * Builds an instance of Decimal128VerifyAsyncClient class. + * + * @return an instance of Decimal128VerifyAsyncClient. + */ + @Generated + public Decimal128VerifyAsyncClient buildDecimal128VerifyAsyncClient() { + return new Decimal128VerifyAsyncClient(buildInnerClient().getDecimal128Verifies()); + } + + /** + * Builds an instance of StringOperationClient class. + * + * @return an instance of StringOperationClient. + */ + @Generated + public StringOperationClient buildStringOperationClient() { + return new StringOperationClient(buildInnerClient().getStringOperations()); + } + + /** + * Builds an instance of BooleanOperationClient class. + * + * @return an instance of BooleanOperationClient. + */ + @Generated + public BooleanOperationClient buildBooleanOperationClient() { + return new BooleanOperationClient(buildInnerClient().getBooleanOperations()); + } + + /** + * Builds an instance of UnknownClient class. + * + * @return an instance of UnknownClient. + */ + @Generated + public UnknownClient buildUnknownClient() { + return new UnknownClient(buildInnerClient().getUnknowns()); + } + + /** + * Builds an instance of DecimalTypeClient class. + * + * @return an instance of DecimalTypeClient. + */ + @Generated + public DecimalTypeClient buildDecimalTypeClient() { + return new DecimalTypeClient(buildInnerClient().getDecimalTypes()); + } + + /** + * Builds an instance of Decimal128TypeClient class. + * + * @return an instance of Decimal128TypeClient. + */ + @Generated + public Decimal128TypeClient buildDecimal128TypeClient() { + return new Decimal128TypeClient(buildInnerClient().getDecimal128Types()); + } + + /** + * Builds an instance of DecimalVerifyClient class. + * + * @return an instance of DecimalVerifyClient. + */ + @Generated + public DecimalVerifyClient buildDecimalVerifyClient() { + return new DecimalVerifyClient(buildInnerClient().getDecimalVerifies()); + } + + /** + * Builds an instance of Decimal128VerifyClient class. + * + * @return an instance of Decimal128VerifyClient. + */ + @Generated + public Decimal128VerifyClient buildDecimal128VerifyClient() { + return new Decimal128VerifyClient(buildInnerClient().getDecimal128Verifies()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ScalarClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationAsyncClient.java new file mode 100644 index 00000000000..74d3f15b231 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationAsyncClient.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.scalar.implementation.StringOperationsImpl; + +/** + * Initializes a new instance of the asynchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) +public final class StringOperationAsyncClient { + @Generated + private final StringOperationsImpl serviceClient; + + /** + * Initializes an instance of StringOperationAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringOperationAsyncClient(StringOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * get string value. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return string value along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * put string value. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * get string value. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return string value on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(String.class)); + } + + /** + * put string value. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(String body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationClient.java new file mode 100644 index 00000000000..51fd1fe4a6e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/StringOperationClient.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.scalar.implementation.StringOperationsImpl; + +/** + * Initializes a new instance of the synchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class) +public final class StringOperationClient { + @Generated + private final StringOperationsImpl serviceClient; + + /** + * Initializes an instance of StringOperationClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringOperationClient(StringOperationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * get string value. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return string value along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * put string value. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * get string value. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return string value. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public String get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(String.class); + } + + /** + * put string value. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(String body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(BinaryData.fromObject(body), requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownAsyncClient.java new file mode 100644 index 00000000000..6e4b478f45b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownAsyncClient.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.scalar.implementation.UnknownsImpl; + +/** + * Initializes a new instance of the asynchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class, isAsync = true) +public final class UnknownAsyncClient { + @Generated + private final UnknownsImpl serviceClient; + + /** + * Initializes an instance of UnknownAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownAsyncClient(UnknownsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * get unknown value. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return unknown value along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * put unknown value. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(body, requestOptions); + } + + /** + * get unknown value. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return unknown value on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * put unknown value. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(BinaryData body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(body, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownClient.java new file mode 100644 index 00000000000..d4346bfe0b5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/UnknownClient.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.scalar.implementation.UnknownsImpl; + +/** + * Initializes a new instance of the synchronous ScalarClient type. + */ +@ServiceClient(builder = ScalarClientBuilder.class) +public final class UnknownClient { + @Generated + private final UnknownsImpl serviceClient; + + /** + * Initializes an instance of UnknownClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + UnknownClient(UnknownsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * get unknown value. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return unknown value along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * put unknown value. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(body, requestOptions); + } + + /** + * get unknown value. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return unknown value. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue(); + } + + /** + * put unknown value. + * + * @param body _. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void put(BinaryData body) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + putWithResponse(body, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/BooleanOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/BooleanOperationsImpl.java new file mode 100644 index 00000000000..e7caf161fb6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/BooleanOperationsImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BooleanOperations. + */ +public final class BooleanOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final BooleanOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ScalarClientImpl client; + + /** + * Initializes an instance of BooleanOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BooleanOperationsImpl(ScalarClientImpl client) { + this.service + = RestProxy.create(BooleanOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScalarClientBooleanOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ScalarClientBooleanOperations") + public interface BooleanOperationsService { + @Get("/type/scalar/boolean") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/scalar/boolean") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/scalar/boolean") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/scalar/boolean") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * get boolean value. + *

Response Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return boolean value along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * get boolean value. + *

Response Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return boolean value along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * put boolean value. + *

Request Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * put boolean value. + *

Request Body Schema

+ * + *
+     * {@code
+     * boolean
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128TypesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128TypesImpl.java new file mode 100644 index 00000000000..989b7c7a9eb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128TypesImpl.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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.math.BigDecimal; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Decimal128Types. + */ +public final class Decimal128TypesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Decimal128TypesService service; + + /** + * The service client containing this operation class. + */ + private final ScalarClientImpl client; + + /** + * Initializes an instance of Decimal128TypesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Decimal128TypesImpl(ScalarClientImpl client) { + this.service + = RestProxy.create(Decimal128TypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScalarClientDecimal128Types to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ScalarClientDecimal128Types") + public interface Decimal128TypesService { + @Get("/type/scalar/decimal128/response_body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> responseBody(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/scalar/decimal128/response_body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response responseBodySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/scalar/decimal128/resquest_body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> requestBody(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/scalar/decimal128/resquest_body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response requestBodySync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Get("/type/scalar/decimal128/request_parameter") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> requestParameter(@HostParam("endpoint") String endpoint, + @QueryParam("value") BigDecimal value, RequestOptions requestOptions, Context context); + + @Get("/type/scalar/decimal128/request_parameter") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response requestParameterSync(@HostParam("endpoint") String endpoint, + @QueryParam("value") BigDecimal value, RequestOptions requestOptions, Context context); + } + + /** + * The responseBody operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 128-bit decimal number along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> responseBodyWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.responseBody(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The responseBody operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a 128-bit decimal number along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response responseBodyWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.responseBodySync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The requestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requestBodyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.requestBody(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The requestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requestBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.requestBodySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The requestParameter operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requestParameterWithResponseAsync(BigDecimal value, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.requestParameter(this.client.getEndpoint(), value, requestOptions, context)); + } + + /** + * The requestParameter operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requestParameterWithResponse(BigDecimal value, RequestOptions requestOptions) { + return service.requestParameterSync(this.client.getEndpoint(), value, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128VerifiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128VerifiesImpl.java new file mode 100644 index 00000000000..da20cdb59e6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/Decimal128VerifiesImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Decimal128Verifies. + */ +public final class Decimal128VerifiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final Decimal128VerifiesService service; + + /** + * The service client containing this operation class. + */ + private final ScalarClientImpl client; + + /** + * Initializes an instance of Decimal128VerifiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + Decimal128VerifiesImpl(ScalarClientImpl client) { + this.service = RestProxy.create(Decimal128VerifiesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScalarClientDecimal128Verifies to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ScalarClientDecimal128Verifies") + public interface Decimal128VerifiesService { + @Get("/type/scalar/decimal128/prepare_verify") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> prepareVerify(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/scalar/decimal128/prepare_verify") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response prepareVerifySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/type/scalar/decimal128/verify") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> verify(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/type/scalar/decimal128/verify") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response verifySync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The prepareVerify operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     BigDecimal (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> prepareVerifyWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.prepareVerify(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The prepareVerify operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     BigDecimal (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response prepareVerifyWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.prepareVerifySync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The verify operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.verify(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The verify operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.verifySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalTypesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalTypesImpl.java new file mode 100644 index 00000000000..19bd429ff62 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalTypesImpl.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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.math.BigDecimal; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DecimalTypes. + */ +public final class DecimalTypesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DecimalTypesService service; + + /** + * The service client containing this operation class. + */ + private final ScalarClientImpl client; + + /** + * Initializes an instance of DecimalTypesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DecimalTypesImpl(ScalarClientImpl client) { + this.service + = RestProxy.create(DecimalTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScalarClientDecimalTypes to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ScalarClientDecimalTypes") + public interface DecimalTypesService { + @Get("/type/scalar/decimal/response_body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> responseBody(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/scalar/decimal/response_body") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response responseBodySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/type/scalar/decimal/resquest_body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> requestBody(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/scalar/decimal/resquest_body") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response requestBodySync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Get("/type/scalar/decimal/request_parameter") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> requestParameter(@HostParam("endpoint") String endpoint, + @QueryParam("value") BigDecimal value, RequestOptions requestOptions, Context context); + + @Get("/type/scalar/decimal/request_parameter") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response requestParameterSync(@HostParam("endpoint") String endpoint, + @QueryParam("value") BigDecimal value, RequestOptions requestOptions, Context context); + } + + /** + * The responseBody operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a decimal number with any length and precision along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> responseBodyWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.responseBody(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The responseBody operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a decimal number with any length and precision along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response responseBodyWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.responseBodySync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The requestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requestBodyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.requestBody(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The requestBody operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requestBodyWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.requestBodySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } + + /** + * The requestParameter operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> requestParameterWithResponseAsync(BigDecimal value, RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.requestParameter(this.client.getEndpoint(), value, requestOptions, context)); + } + + /** + * The requestParameter operation. + * + * @param value The value parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response requestParameterWithResponse(BigDecimal value, RequestOptions requestOptions) { + return service.requestParameterSync(this.client.getEndpoint(), value, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalVerifiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalVerifiesImpl.java new file mode 100644 index 00000000000..71389141343 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/DecimalVerifiesImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DecimalVerifies. + */ +public final class DecimalVerifiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final DecimalVerifiesService service; + + /** + * The service client containing this operation class. + */ + private final ScalarClientImpl client; + + /** + * Initializes an instance of DecimalVerifiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DecimalVerifiesImpl(ScalarClientImpl client) { + this.service + = RestProxy.create(DecimalVerifiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScalarClientDecimalVerifies to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ScalarClientDecimalVerifies") + public interface DecimalVerifiesService { + @Get("/type/scalar/decimal/prepare_verify") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> prepareVerify(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/type/scalar/decimal/prepare_verify") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response prepareVerifySync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/type/scalar/decimal/verify") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> verify(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/type/scalar/decimal/verify") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response verifySync(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The prepareVerify operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     BigDecimal (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> prepareVerifyWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.prepareVerify(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The prepareVerify operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * [
+     *     BigDecimal (Required)
+     * ]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response prepareVerifyWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.prepareVerifySync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The verify operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> verifyWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.verify(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * The verify operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BigDecimal
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response verifyWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.verifySync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/ScalarClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/ScalarClientImpl.java new file mode 100644 index 00000000000..ea22ed4ea3d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/ScalarClientImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 ScalarClient type. + */ +public final class ScalarClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 StringOperationsImpl object to access its operations. + */ + private final StringOperationsImpl stringOperations; + + /** + * Gets the StringOperationsImpl object to access its operations. + * + * @return the StringOperationsImpl object. + */ + public StringOperationsImpl getStringOperations() { + return this.stringOperations; + } + + /** + * The BooleanOperationsImpl object to access its operations. + */ + private final BooleanOperationsImpl booleanOperations; + + /** + * Gets the BooleanOperationsImpl object to access its operations. + * + * @return the BooleanOperationsImpl object. + */ + public BooleanOperationsImpl getBooleanOperations() { + return this.booleanOperations; + } + + /** + * The UnknownsImpl object to access its operations. + */ + private final UnknownsImpl unknowns; + + /** + * Gets the UnknownsImpl object to access its operations. + * + * @return the UnknownsImpl object. + */ + public UnknownsImpl getUnknowns() { + return this.unknowns; + } + + /** + * The DecimalTypesImpl object to access its operations. + */ + private final DecimalTypesImpl decimalTypes; + + /** + * Gets the DecimalTypesImpl object to access its operations. + * + * @return the DecimalTypesImpl object. + */ + public DecimalTypesImpl getDecimalTypes() { + return this.decimalTypes; + } + + /** + * The Decimal128TypesImpl object to access its operations. + */ + private final Decimal128TypesImpl decimal128Types; + + /** + * Gets the Decimal128TypesImpl object to access its operations. + * + * @return the Decimal128TypesImpl object. + */ + public Decimal128TypesImpl getDecimal128Types() { + return this.decimal128Types; + } + + /** + * The DecimalVerifiesImpl object to access its operations. + */ + private final DecimalVerifiesImpl decimalVerifies; + + /** + * Gets the DecimalVerifiesImpl object to access its operations. + * + * @return the DecimalVerifiesImpl object. + */ + public DecimalVerifiesImpl getDecimalVerifies() { + return this.decimalVerifies; + } + + /** + * The Decimal128VerifiesImpl object to access its operations. + */ + private final Decimal128VerifiesImpl decimal128Verifies; + + /** + * Gets the Decimal128VerifiesImpl object to access its operations. + * + * @return the Decimal128VerifiesImpl object. + */ + public Decimal128VerifiesImpl getDecimal128Verifies() { + return this.decimal128Verifies; + } + + /** + * Initializes an instance of ScalarClient client. + * + * @param endpoint Service host. + */ + public ScalarClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ScalarClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public ScalarClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of ScalarClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public ScalarClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.stringOperations = new StringOperationsImpl(this); + this.booleanOperations = new BooleanOperationsImpl(this); + this.unknowns = new UnknownsImpl(this); + this.decimalTypes = new DecimalTypesImpl(this); + this.decimal128Types = new Decimal128TypesImpl(this); + this.decimalVerifies = new DecimalVerifiesImpl(this); + this.decimal128Verifies = new Decimal128VerifiesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/StringOperationsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/StringOperationsImpl.java new file mode 100644 index 00000000000..4ea1e8f4946 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/StringOperationsImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringOperations. + */ +public final class StringOperationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringOperationsService service; + + /** + * The service client containing this operation class. + */ + private final ScalarClientImpl client; + + /** + * Initializes an instance of StringOperationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringOperationsImpl(ScalarClientImpl client) { + this.service + = RestProxy.create(StringOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScalarClientStringOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ScalarClientStringOperations") + public interface StringOperationsService { + @Get("/type/scalar/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/scalar/string") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/scalar/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/scalar/string") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * get string value. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return string value along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * get string value. + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return string value along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * put string value. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * put string value. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/UnknownsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/UnknownsImpl.java new file mode 100644 index 00000000000..22a87883706 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/UnknownsImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Unknowns. + */ +public final class UnknownsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final UnknownsService service; + + /** + * The service client containing this operation class. + */ + private final ScalarClientImpl client; + + /** + * Initializes an instance of UnknownsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UnknownsImpl(ScalarClientImpl client) { + this.service = RestProxy.create(UnknownsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ScalarClientUnknowns to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ScalarClientUnknowns") + public interface UnknownsService { + @Get("/type/scalar/unknown") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/scalar/unknown") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/scalar/unknown") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Put("/type/scalar/unknown") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, @HeaderParam("content-type") String contentType, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * get unknown value. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return unknown value along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * get unknown value. + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return unknown value along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * put unknown value. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), contentType, body, requestOptions, context)); + } + + /** + * put unknown value. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param body _. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/package-info.java new file mode 100644 index 00000000000..2f86196a408 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Scalar. + * + */ +package type.scalar.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/package-info.java new file mode 100644 index 00000000000..7d804ba2624 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/scalar/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Scalar. + * + */ +package type.scalar; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyAsyncClient.java new file mode 100644 index 00000000000..d225b1f6427 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyAsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.implementation.EnumsOnliesImpl; +import type.union.implementation.models.SendRequest6; +import type.union.models.EnumsOnlyCases; +import type.union.models.GetResponse6; + +/** + * Initializes a new instance of the asynchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) +public final class EnumsOnlyAsyncClient { + @Generated + private final EnumsOnliesImpl serviceClient; + + /** + * Initializes an instance of EnumsOnlyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnumsOnlyAsyncClient(EnumsOnliesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         lr: String(left/right/up/down) (Required)
+     *         ud: String(up/down) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         lr: String(left/right/up/down) (Required)
+     *         ud: String(up/down) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest6 The sendRequest6 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(BinaryData sendRequest6, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(sendRequest6, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetResponse6.class)); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(EnumsOnlyCases prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest6 sendRequest6Obj = new SendRequest6(prop); + BinaryData sendRequest6 = BinaryData.fromObject(sendRequest6Obj); + return sendWithResponse(sendRequest6, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyClient.java new file mode 100644 index 00000000000..e620c35453d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/EnumsOnlyClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.implementation.EnumsOnliesImpl; +import type.union.implementation.models.SendRequest6; +import type.union.models.EnumsOnlyCases; +import type.union.models.GetResponse6; + +/** + * Initializes a new instance of the synchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class) +public final class EnumsOnlyClient { + @Generated + private final EnumsOnliesImpl serviceClient; + + /** + * Initializes an instance of EnumsOnlyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnumsOnlyClient(EnumsOnliesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         lr: String(left/right/up/down) (Required)
+     *         ud: String(up/down) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         lr: String(left/right/up/down) (Required)
+     *         ud: String(up/down) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest6 The sendRequest6 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest6, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(sendRequest6, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetResponse6 get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(GetResponse6.class); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(EnumsOnlyCases prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest6 sendRequest6Obj = new SendRequest6(prop); + BinaryData sendRequest6 = BinaryData.fromObject(sendRequest6Obj); + sendWithResponse(sendRequest6, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyAsyncClient.java new file mode 100644 index 00000000000..aa9e58f0d88 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyAsyncClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.implementation.FloatsOnliesImpl; +import type.union.implementation.models.SendRequest4; +import type.union.models.GetResponse4; +import type.union.models.GetResponseProp3; + +/** + * Initializes a new instance of the asynchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) +public final class FloatsOnlyAsyncClient { + @Generated + private final FloatsOnliesImpl serviceClient; + + /** + * Initializes an instance of FloatsOnlyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FloatsOnlyAsyncClient(FloatsOnliesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1.1/2.2/3.3) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1.1/2.2/3.3) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest4 The sendRequest4 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(BinaryData sendRequest4, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(sendRequest4, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetResponse4.class)); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(GetResponseProp3 prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest4 sendRequest4Obj = new SendRequest4(prop); + BinaryData sendRequest4 = BinaryData.fromObject(sendRequest4Obj); + return sendWithResponse(sendRequest4, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyClient.java new file mode 100644 index 00000000000..97cf78ffb2c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/FloatsOnlyClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.implementation.FloatsOnliesImpl; +import type.union.implementation.models.SendRequest4; +import type.union.models.GetResponse4; +import type.union.models.GetResponseProp3; + +/** + * Initializes a new instance of the synchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class) +public final class FloatsOnlyClient { + @Generated + private final FloatsOnliesImpl serviceClient; + + /** + * Initializes an instance of FloatsOnlyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + FloatsOnlyClient(FloatsOnliesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1.1/2.2/3.3) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1.1/2.2/3.3) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest4 The sendRequest4 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest4, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(sendRequest4, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetResponse4 get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(GetResponse4.class); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(GetResponseProp3 prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest4 sendRequest4Obj = new SendRequest4(prop); + BinaryData sendRequest4 = BinaryData.fromObject(sendRequest4Obj); + sendWithResponse(sendRequest4, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyAsyncClient.java new file mode 100644 index 00000000000..5e4af5b1241 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyAsyncClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.implementation.IntsOnliesImpl; +import type.union.implementation.models.SendRequest3; +import type.union.models.GetResponse3; +import type.union.models.GetResponseProp2; + +/** + * Initializes a new instance of the asynchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) +public final class IntsOnlyAsyncClient { + @Generated + private final IntsOnliesImpl serviceClient; + + /** + * Initializes an instance of IntsOnlyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IntsOnlyAsyncClient(IntsOnliesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1/2/3) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1/2/3) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest3 The sendRequest3 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(BinaryData sendRequest3, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(sendRequest3, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetResponse3.class)); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(GetResponseProp2 prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest3 sendRequest3Obj = new SendRequest3(prop); + BinaryData sendRequest3 = BinaryData.fromObject(sendRequest3Obj); + return sendWithResponse(sendRequest3, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyClient.java new file mode 100644 index 00000000000..cbe8fec8eb9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/IntsOnlyClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.implementation.IntsOnliesImpl; +import type.union.implementation.models.SendRequest3; +import type.union.models.GetResponse3; +import type.union.models.GetResponseProp2; + +/** + * Initializes a new instance of the synchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class) +public final class IntsOnlyClient { + @Generated + private final IntsOnliesImpl serviceClient; + + /** + * Initializes an instance of IntsOnlyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + IntsOnlyClient(IntsOnliesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1/2/3) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1/2/3) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest3 The sendRequest3 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest3, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(sendRequest3, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetResponse3 get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(GetResponse3.class); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(GetResponseProp2 prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest3 sendRequest3Obj = new SendRequest3(prop); + BinaryData sendRequest3 = BinaryData.fromObject(sendRequest3Obj); + sendWithResponse(sendRequest3, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsAsyncClient.java new file mode 100644 index 00000000000..a60a7bcbbdf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsAsyncClient.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.implementation.MixedLiteralsImpl; +import type.union.implementation.models.SendRequest8; +import type.union.models.GetResponse8; +import type.union.models.MixedLiteralsCases; + +/** + * Initializes a new instance of the asynchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) +public final class MixedLiteralsAsyncClient { + @Generated + private final MixedLiteralsImpl serviceClient; + + /** + * Initializes an instance of MixedLiteralsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MixedLiteralsAsyncClient(MixedLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         stringLiteral: BinaryData (Required)
+     *         intLiteral: BinaryData (Required)
+     *         floatLiteral: BinaryData (Required)
+     *         booleanLiteral: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         stringLiteral: BinaryData (Required)
+     *         intLiteral: BinaryData (Required)
+     *         floatLiteral: BinaryData (Required)
+     *         booleanLiteral: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest8 The sendRequest8 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(BinaryData sendRequest8, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(sendRequest8, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetResponse8.class)); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(MixedLiteralsCases prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest8 sendRequest8Obj = new SendRequest8(prop); + BinaryData sendRequest8 = BinaryData.fromObject(sendRequest8Obj); + return sendWithResponse(sendRequest8, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsClient.java new file mode 100644 index 00000000000..a62ee7e90cd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedLiteralsClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.implementation.MixedLiteralsImpl; +import type.union.implementation.models.SendRequest8; +import type.union.models.GetResponse8; +import type.union.models.MixedLiteralsCases; + +/** + * Initializes a new instance of the synchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class) +public final class MixedLiteralsClient { + @Generated + private final MixedLiteralsImpl serviceClient; + + /** + * Initializes an instance of MixedLiteralsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MixedLiteralsClient(MixedLiteralsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         stringLiteral: BinaryData (Required)
+     *         intLiteral: BinaryData (Required)
+     *         floatLiteral: BinaryData (Required)
+     *         booleanLiteral: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         stringLiteral: BinaryData (Required)
+     *         intLiteral: BinaryData (Required)
+     *         floatLiteral: BinaryData (Required)
+     *         booleanLiteral: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest8 The sendRequest8 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest8, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(sendRequest8, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetResponse8 get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(GetResponse8.class); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(MixedLiteralsCases prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest8 sendRequest8Obj = new SendRequest8(prop); + BinaryData sendRequest8 = BinaryData.fromObject(sendRequest8Obj); + sendWithResponse(sendRequest8, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesAsyncClient.java new file mode 100644 index 00000000000..c13c976836e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesAsyncClient.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.implementation.MixedTypesImpl; +import type.union.implementation.models.SendRequest9; +import type.union.models.GetResponse9; +import type.union.models.MixedTypesCases; + +/** + * Initializes a new instance of the asynchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) +public final class MixedTypesAsyncClient { + @Generated + private final MixedTypesImpl serviceClient; + + /** + * Initializes an instance of MixedTypesAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MixedTypesAsyncClient(MixedTypesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         model: BinaryData (Required)
+     *         literal: BinaryData (Required)
+     *         int: BinaryData (Required)
+     *         boolean: BinaryData (Required)
+     *         array (Required): [
+     *             BinaryData (Required)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         model: BinaryData (Required)
+     *         literal: BinaryData (Required)
+     *         int: BinaryData (Required)
+     *         boolean: BinaryData (Required)
+     *         array (Required): [
+     *             BinaryData (Required)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest9 The sendRequest9 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(BinaryData sendRequest9, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(sendRequest9, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetResponse9.class)); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(MixedTypesCases prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest9 sendRequest9Obj = new SendRequest9(prop); + BinaryData sendRequest9 = BinaryData.fromObject(sendRequest9Obj); + return sendWithResponse(sendRequest9, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesClient.java new file mode 100644 index 00000000000..eb19100770c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/MixedTypesClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.implementation.MixedTypesImpl; +import type.union.implementation.models.SendRequest9; +import type.union.models.GetResponse9; +import type.union.models.MixedTypesCases; + +/** + * Initializes a new instance of the synchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class) +public final class MixedTypesClient { + @Generated + private final MixedTypesImpl serviceClient; + + /** + * Initializes an instance of MixedTypesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MixedTypesClient(MixedTypesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         model: BinaryData (Required)
+     *         literal: BinaryData (Required)
+     *         int: BinaryData (Required)
+     *         boolean: BinaryData (Required)
+     *         array (Required): [
+     *             BinaryData (Required)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         model: BinaryData (Required)
+     *         literal: BinaryData (Required)
+     *         int: BinaryData (Required)
+     *         boolean: BinaryData (Required)
+     *         array (Required): [
+     *             BinaryData (Required)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest9 The sendRequest9 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest9, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(sendRequest9, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetResponse9 get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(GetResponse9.class); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(MixedTypesCases prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest9 sendRequest9Obj = new SendRequest9(prop); + BinaryData sendRequest9 = BinaryData.fromObject(sendRequest9Obj); + sendWithResponse(sendRequest9, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyAsyncClient.java new file mode 100644 index 00000000000..e4398ccff94 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyAsyncClient.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.implementation.ModelsOnliesImpl; +import type.union.implementation.models.SendRequest5; +import type.union.models.GetResponse5; + +/** + * Initializes a new instance of the asynchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) +public final class ModelsOnlyAsyncClient { + @Generated + private final ModelsOnliesImpl serviceClient; + + /** + * Initializes an instance of ModelsOnlyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelsOnlyAsyncClient(ModelsOnliesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest5 The sendRequest5 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(BinaryData sendRequest5, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(sendRequest5, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetResponse5.class)); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(BinaryData prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest5 sendRequest5Obj = new SendRequest5(prop); + BinaryData sendRequest5 = BinaryData.fromObject(sendRequest5Obj); + return sendWithResponse(sendRequest5, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyClient.java new file mode 100644 index 00000000000..a9b173d6784 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/ModelsOnlyClient.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.implementation.ModelsOnliesImpl; +import type.union.implementation.models.SendRequest5; +import type.union.models.GetResponse5; + +/** + * Initializes a new instance of the synchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class) +public final class ModelsOnlyClient { + @Generated + private final ModelsOnliesImpl serviceClient; + + /** + * Initializes an instance of ModelsOnlyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ModelsOnlyClient(ModelsOnliesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest5 The sendRequest5 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest5, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(sendRequest5, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetResponse5 get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(GetResponse5.class); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(BinaryData prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest5 sendRequest5Obj = new SendRequest5(prop); + BinaryData sendRequest5 = BinaryData.fromObject(sendRequest5Obj); + sendWithResponse(sendRequest5, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayAsyncClient.java new file mode 100644 index 00000000000..56f4fb3b777 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayAsyncClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.implementation.StringAndArraysImpl; +import type.union.implementation.models.SendRequest7; +import type.union.models.GetResponse7; +import type.union.models.StringAndArrayCases; + +/** + * Initializes a new instance of the asynchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) +public final class StringAndArrayAsyncClient { + @Generated + private final StringAndArraysImpl serviceClient; + + /** + * Initializes an instance of StringAndArrayAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringAndArrayAsyncClient(StringAndArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         string: BinaryData (Required)
+     *         array: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         string: BinaryData (Required)
+     *         array: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest7 The sendRequest7 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(BinaryData sendRequest7, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(sendRequest7, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetResponse7.class)); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(StringAndArrayCases prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest7 sendRequest7Obj = new SendRequest7(prop); + BinaryData sendRequest7 = BinaryData.fromObject(sendRequest7Obj); + return sendWithResponse(sendRequest7, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayClient.java new file mode 100644 index 00000000000..cdf00c9eaa3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringAndArrayClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.implementation.StringAndArraysImpl; +import type.union.implementation.models.SendRequest7; +import type.union.models.GetResponse7; +import type.union.models.StringAndArrayCases; + +/** + * Initializes a new instance of the synchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class) +public final class StringAndArrayClient { + @Generated + private final StringAndArraysImpl serviceClient; + + /** + * Initializes an instance of StringAndArrayClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringAndArrayClient(StringAndArraysImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         string: BinaryData (Required)
+     *         array: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         string: BinaryData (Required)
+     *         array: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest7 The sendRequest7 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest7, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(sendRequest7, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetResponse7 get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(GetResponse7.class); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(StringAndArrayCases prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest7 sendRequest7Obj = new SendRequest7(prop); + BinaryData sendRequest7 = BinaryData.fromObject(sendRequest7Obj); + sendWithResponse(sendRequest7, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleAsyncClient.java new file mode 100644 index 00000000000..8d020845d73 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleAsyncClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.implementation.StringExtensiblesImpl; +import type.union.implementation.models.SendRequest1; +import type.union.models.GetResponse1; +import type.union.models.GetResponseProp1; + +/** + * Initializes a new instance of the asynchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) +public final class StringExtensibleAsyncClient { + @Generated + private final StringExtensiblesImpl serviceClient; + + /** + * Initializes an instance of StringExtensibleAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringExtensibleAsyncClient(StringExtensiblesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest1 The sendRequest1 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(BinaryData sendRequest1, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(sendRequest1, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetResponse1.class)); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(GetResponseProp1 prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest1 sendRequest1Obj = new SendRequest1(prop); + BinaryData sendRequest1 = BinaryData.fromObject(sendRequest1Obj); + return sendWithResponse(sendRequest1, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleClient.java new file mode 100644 index 00000000000..3149cdd1520 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.implementation.StringExtensiblesImpl; +import type.union.implementation.models.SendRequest1; +import type.union.models.GetResponse1; +import type.union.models.GetResponseProp1; + +/** + * Initializes a new instance of the synchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class) +public final class StringExtensibleClient { + @Generated + private final StringExtensiblesImpl serviceClient; + + /** + * Initializes an instance of StringExtensibleClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringExtensibleClient(StringExtensiblesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest1 The sendRequest1 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest1, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(sendRequest1, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetResponse1 get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(GetResponse1.class); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(GetResponseProp1 prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest1 sendRequest1Obj = new SendRequest1(prop); + BinaryData sendRequest1 = BinaryData.fromObject(sendRequest1Obj); + sendWithResponse(sendRequest1, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedAsyncClient.java new file mode 100644 index 00000000000..301fd440c80 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedAsyncClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.implementation.StringExtensibleNamedsImpl; +import type.union.implementation.models.SendRequest2; +import type.union.models.GetResponse2; +import type.union.models.StringExtensibleNamedUnion; + +/** + * Initializes a new instance of the asynchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) +public final class StringExtensibleNamedAsyncClient { + @Generated + private final StringExtensibleNamedsImpl serviceClient; + + /** + * Initializes an instance of StringExtensibleNamedAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringExtensibleNamedAsyncClient(StringExtensibleNamedsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest2 The sendRequest2 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(BinaryData sendRequest2, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(sendRequest2, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetResponse2.class)); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(StringExtensibleNamedUnion prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest2 sendRequest2Obj = new SendRequest2(prop); + BinaryData sendRequest2 = BinaryData.fromObject(sendRequest2Obj); + return sendWithResponse(sendRequest2, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedClient.java new file mode 100644 index 00000000000..117fd1dd10d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringExtensibleNamedClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.implementation.StringExtensibleNamedsImpl; +import type.union.implementation.models.SendRequest2; +import type.union.models.GetResponse2; +import type.union.models.StringExtensibleNamedUnion; + +/** + * Initializes a new instance of the synchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class) +public final class StringExtensibleNamedClient { + @Generated + private final StringExtensibleNamedsImpl serviceClient; + + /** + * Initializes an instance of StringExtensibleNamedClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringExtensibleNamedClient(StringExtensibleNamedsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest2 The sendRequest2 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest2, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(sendRequest2, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetResponse2 get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(GetResponse2.class); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(StringExtensibleNamedUnion prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest2 sendRequest2Obj = new SendRequest2(prop); + BinaryData sendRequest2 = BinaryData.fromObject(sendRequest2Obj); + sendWithResponse(sendRequest2, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyAsyncClient.java new file mode 100644 index 00000000000..20b34eb175c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyAsyncClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.implementation.StringsOnliesImpl; +import type.union.implementation.models.SendRequest; +import type.union.models.GetResponse; +import type.union.models.GetResponseProp; + +/** + * Initializes a new instance of the asynchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class, isAsync = true) +public final class StringsOnlyAsyncClient { + @Generated + private final StringsOnliesImpl serviceClient; + + /** + * Initializes an instance of StringsOnlyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringsOnlyAsyncClient(StringsOnliesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(a/b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(a/b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest The sendRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponse(BinaryData sendRequest, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponseAsync(sendRequest, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(GetResponse.class)); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono send(GetResponseProp prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest sendRequestObj = new SendRequest(prop); + BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); + return sendWithResponse(sendRequest, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyClient.java new file mode 100644 index 00000000000..2bc76714898 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/StringsOnlyClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.implementation.StringsOnliesImpl; +import type.union.implementation.models.SendRequest; +import type.union.models.GetResponse; +import type.union.models.GetResponseProp; + +/** + * Initializes a new instance of the synchronous UnionClient type. + */ +@ServiceClient(builder = UnionClientBuilder.class) +public final class StringsOnlyClient { + @Generated + private final StringsOnliesImpl serviceClient; + + /** + * Initializes an instance of StringsOnlyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + StringsOnlyClient(StringsOnliesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(a/b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(a/b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest The sendRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest, RequestOptions requestOptions) { + return this.serviceClient.sendWithResponse(sendRequest, requestOptions); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public GetResponse get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue().toObject(GetResponse.class); + } + + /** + * The send operation. + * + * @param prop The prop parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void send(GetResponseProp prop) { + // Generated convenience method for sendWithResponse + RequestOptions requestOptions = new RequestOptions(); + SendRequest sendRequestObj = new SendRequest(prop); + BinaryData sendRequest = BinaryData.fromObject(sendRequestObj); + sendWithResponse(sendRequest, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/UnionClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/UnionClientBuilder.java new file mode 100644 index 00000000000..6d99e9f8194 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/UnionClientBuilder.java @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.union.implementation.UnionClientImpl; + +/** + * A builder for creating a new instance of the UnionClient type. + */ +@ServiceClientBuilder( + serviceClients = { + StringsOnlyClient.class, + StringExtensibleClient.class, + StringExtensibleNamedClient.class, + IntsOnlyClient.class, + FloatsOnlyClient.class, + ModelsOnlyClient.class, + EnumsOnlyClient.class, + StringAndArrayClient.class, + MixedLiteralsClient.class, + MixedTypesClient.class, + StringsOnlyAsyncClient.class, + StringExtensibleAsyncClient.class, + StringExtensibleNamedAsyncClient.class, + IntsOnlyAsyncClient.class, + FloatsOnlyAsyncClient.class, + ModelsOnlyAsyncClient.class, + EnumsOnlyAsyncClient.class, + StringAndArrayAsyncClient.class, + MixedLiteralsAsyncClient.class, + MixedTypesAsyncClient.class }) +public final class UnionClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("type-union.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the UnionClientBuilder. + */ + @Generated + public UnionClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public UnionClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the UnionClientBuilder. + */ + @Generated + public UnionClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of UnionClientImpl with the provided parameters. + * + * @return an instance of UnionClientImpl. + */ + @Generated + private UnionClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + UnionClientImpl client + = new UnionClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of StringsOnlyAsyncClient class. + * + * @return an instance of StringsOnlyAsyncClient. + */ + @Generated + public StringsOnlyAsyncClient buildStringsOnlyAsyncClient() { + return new StringsOnlyAsyncClient(buildInnerClient().getStringsOnlies()); + } + + /** + * Builds an instance of StringExtensibleAsyncClient class. + * + * @return an instance of StringExtensibleAsyncClient. + */ + @Generated + public StringExtensibleAsyncClient buildStringExtensibleAsyncClient() { + return new StringExtensibleAsyncClient(buildInnerClient().getStringExtensibles()); + } + + /** + * Builds an instance of StringExtensibleNamedAsyncClient class. + * + * @return an instance of StringExtensibleNamedAsyncClient. + */ + @Generated + public StringExtensibleNamedAsyncClient buildStringExtensibleNamedAsyncClient() { + return new StringExtensibleNamedAsyncClient(buildInnerClient().getStringExtensibleNameds()); + } + + /** + * Builds an instance of IntsOnlyAsyncClient class. + * + * @return an instance of IntsOnlyAsyncClient. + */ + @Generated + public IntsOnlyAsyncClient buildIntsOnlyAsyncClient() { + return new IntsOnlyAsyncClient(buildInnerClient().getIntsOnlies()); + } + + /** + * Builds an instance of FloatsOnlyAsyncClient class. + * + * @return an instance of FloatsOnlyAsyncClient. + */ + @Generated + public FloatsOnlyAsyncClient buildFloatsOnlyAsyncClient() { + return new FloatsOnlyAsyncClient(buildInnerClient().getFloatsOnlies()); + } + + /** + * Builds an instance of ModelsOnlyAsyncClient class. + * + * @return an instance of ModelsOnlyAsyncClient. + */ + @Generated + public ModelsOnlyAsyncClient buildModelsOnlyAsyncClient() { + return new ModelsOnlyAsyncClient(buildInnerClient().getModelsOnlies()); + } + + /** + * Builds an instance of EnumsOnlyAsyncClient class. + * + * @return an instance of EnumsOnlyAsyncClient. + */ + @Generated + public EnumsOnlyAsyncClient buildEnumsOnlyAsyncClient() { + return new EnumsOnlyAsyncClient(buildInnerClient().getEnumsOnlies()); + } + + /** + * Builds an instance of StringAndArrayAsyncClient class. + * + * @return an instance of StringAndArrayAsyncClient. + */ + @Generated + public StringAndArrayAsyncClient buildStringAndArrayAsyncClient() { + return new StringAndArrayAsyncClient(buildInnerClient().getStringAndArrays()); + } + + /** + * Builds an instance of MixedLiteralsAsyncClient class. + * + * @return an instance of MixedLiteralsAsyncClient. + */ + @Generated + public MixedLiteralsAsyncClient buildMixedLiteralsAsyncClient() { + return new MixedLiteralsAsyncClient(buildInnerClient().getMixedLiterals()); + } + + /** + * Builds an instance of MixedTypesAsyncClient class. + * + * @return an instance of MixedTypesAsyncClient. + */ + @Generated + public MixedTypesAsyncClient buildMixedTypesAsyncClient() { + return new MixedTypesAsyncClient(buildInnerClient().getMixedTypes()); + } + + /** + * Builds an instance of StringsOnlyClient class. + * + * @return an instance of StringsOnlyClient. + */ + @Generated + public StringsOnlyClient buildStringsOnlyClient() { + return new StringsOnlyClient(buildInnerClient().getStringsOnlies()); + } + + /** + * Builds an instance of StringExtensibleClient class. + * + * @return an instance of StringExtensibleClient. + */ + @Generated + public StringExtensibleClient buildStringExtensibleClient() { + return new StringExtensibleClient(buildInnerClient().getStringExtensibles()); + } + + /** + * Builds an instance of StringExtensibleNamedClient class. + * + * @return an instance of StringExtensibleNamedClient. + */ + @Generated + public StringExtensibleNamedClient buildStringExtensibleNamedClient() { + return new StringExtensibleNamedClient(buildInnerClient().getStringExtensibleNameds()); + } + + /** + * Builds an instance of IntsOnlyClient class. + * + * @return an instance of IntsOnlyClient. + */ + @Generated + public IntsOnlyClient buildIntsOnlyClient() { + return new IntsOnlyClient(buildInnerClient().getIntsOnlies()); + } + + /** + * Builds an instance of FloatsOnlyClient class. + * + * @return an instance of FloatsOnlyClient. + */ + @Generated + public FloatsOnlyClient buildFloatsOnlyClient() { + return new FloatsOnlyClient(buildInnerClient().getFloatsOnlies()); + } + + /** + * Builds an instance of ModelsOnlyClient class. + * + * @return an instance of ModelsOnlyClient. + */ + @Generated + public ModelsOnlyClient buildModelsOnlyClient() { + return new ModelsOnlyClient(buildInnerClient().getModelsOnlies()); + } + + /** + * Builds an instance of EnumsOnlyClient class. + * + * @return an instance of EnumsOnlyClient. + */ + @Generated + public EnumsOnlyClient buildEnumsOnlyClient() { + return new EnumsOnlyClient(buildInnerClient().getEnumsOnlies()); + } + + /** + * Builds an instance of StringAndArrayClient class. + * + * @return an instance of StringAndArrayClient. + */ + @Generated + public StringAndArrayClient buildStringAndArrayClient() { + return new StringAndArrayClient(buildInnerClient().getStringAndArrays()); + } + + /** + * Builds an instance of MixedLiteralsClient class. + * + * @return an instance of MixedLiteralsClient. + */ + @Generated + public MixedLiteralsClient buildMixedLiteralsClient() { + return new MixedLiteralsClient(buildInnerClient().getMixedLiterals()); + } + + /** + * Builds an instance of MixedTypesClient class. + * + * @return an instance of MixedTypesClient. + */ + @Generated + public MixedTypesClient buildMixedTypesClient() { + return new MixedTypesClient(buildInnerClient().getMixedTypes()); + } + + private static final ClientLogger LOGGER = new ClientLogger(UnionClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/DiscriminatedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/DiscriminatedClientBuilder.java new file mode 100644 index 00000000000..345d218fae4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/DiscriminatedClientBuilder.java @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import type.union.discriminated.implementation.DiscriminatedClientImpl; + +/** + * A builder for creating a new instance of the DiscriminatedClient type. + */ +@ServiceClientBuilder( + serviceClients = { + EnvelopeObjectDefaultClient.class, + EnvelopeObjectCustomPropertiesClient.class, + NoEnvelopeDefaultClient.class, + NoEnvelopeCustomDiscriminatorClient.class, + EnvelopeObjectDefaultAsyncClient.class, + EnvelopeObjectCustomPropertiesAsyncClient.class, + NoEnvelopeDefaultAsyncClient.class, + NoEnvelopeCustomDiscriminatorAsyncClient.class }) +public final class DiscriminatedClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("type-union-discriminated.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the DiscriminatedClientBuilder. + */ + @Generated + public DiscriminatedClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatedClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatedClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatedClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatedClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatedClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public DiscriminatedClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the DiscriminatedClientBuilder. + */ + @Generated + public DiscriminatedClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of DiscriminatedClientImpl with the provided parameters. + * + * @return an instance of DiscriminatedClientImpl. + */ + @Generated + private DiscriminatedClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000"; + DiscriminatedClientImpl client = new DiscriminatedClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of EnvelopeObjectDefaultAsyncClient class. + * + * @return an instance of EnvelopeObjectDefaultAsyncClient. + */ + @Generated + public EnvelopeObjectDefaultAsyncClient buildEnvelopeObjectDefaultAsyncClient() { + return new EnvelopeObjectDefaultAsyncClient(buildInnerClient().getEnvelopeObjectDefaults()); + } + + /** + * Builds an instance of EnvelopeObjectCustomPropertiesAsyncClient class. + * + * @return an instance of EnvelopeObjectCustomPropertiesAsyncClient. + */ + @Generated + public EnvelopeObjectCustomPropertiesAsyncClient buildEnvelopeObjectCustomPropertiesAsyncClient() { + return new EnvelopeObjectCustomPropertiesAsyncClient(buildInnerClient().getEnvelopeObjectCustomProperties()); + } + + /** + * Builds an instance of NoEnvelopeDefaultAsyncClient class. + * + * @return an instance of NoEnvelopeDefaultAsyncClient. + */ + @Generated + public NoEnvelopeDefaultAsyncClient buildNoEnvelopeDefaultAsyncClient() { + return new NoEnvelopeDefaultAsyncClient(buildInnerClient().getNoEnvelopeDefaults()); + } + + /** + * Builds an instance of NoEnvelopeCustomDiscriminatorAsyncClient class. + * + * @return an instance of NoEnvelopeCustomDiscriminatorAsyncClient. + */ + @Generated + public NoEnvelopeCustomDiscriminatorAsyncClient buildNoEnvelopeCustomDiscriminatorAsyncClient() { + return new NoEnvelopeCustomDiscriminatorAsyncClient(buildInnerClient().getNoEnvelopeCustomDiscriminators()); + } + + /** + * Builds an instance of EnvelopeObjectDefaultClient class. + * + * @return an instance of EnvelopeObjectDefaultClient. + */ + @Generated + public EnvelopeObjectDefaultClient buildEnvelopeObjectDefaultClient() { + return new EnvelopeObjectDefaultClient(buildInnerClient().getEnvelopeObjectDefaults()); + } + + /** + * Builds an instance of EnvelopeObjectCustomPropertiesClient class. + * + * @return an instance of EnvelopeObjectCustomPropertiesClient. + */ + @Generated + public EnvelopeObjectCustomPropertiesClient buildEnvelopeObjectCustomPropertiesClient() { + return new EnvelopeObjectCustomPropertiesClient(buildInnerClient().getEnvelopeObjectCustomProperties()); + } + + /** + * Builds an instance of NoEnvelopeDefaultClient class. + * + * @return an instance of NoEnvelopeDefaultClient. + */ + @Generated + public NoEnvelopeDefaultClient buildNoEnvelopeDefaultClient() { + return new NoEnvelopeDefaultClient(buildInnerClient().getNoEnvelopeDefaults()); + } + + /** + * Builds an instance of NoEnvelopeCustomDiscriminatorClient class. + * + * @return an instance of NoEnvelopeCustomDiscriminatorClient. + */ + @Generated + public NoEnvelopeCustomDiscriminatorClient buildNoEnvelopeCustomDiscriminatorClient() { + return new NoEnvelopeCustomDiscriminatorClient(buildInnerClient().getNoEnvelopeCustomDiscriminators()); + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscriminatedClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesAsyncClient.java new file mode 100644 index 00000000000..3370506269c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesAsyncClient.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.discriminated.implementation.EnvelopeObjectCustomPropertiesImpl; + +/** + * Initializes a new instance of the asynchronous DiscriminatedClient type. + */ +@ServiceClient(builder = DiscriminatedClientBuilder.class, isAsync = true) +public final class EnvelopeObjectCustomPropertiesAsyncClient { + @Generated + private final EnvelopeObjectCustomPropertiesImpl serviceClient; + + /** + * Initializes an instance of EnvelopeObjectCustomPropertiesAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnvelopeObjectCustomPropertiesAsyncClient(EnvelopeObjectCustomPropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
petTypeStringNoThe petType parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(input, requestOptions); + } + + /** + * The get operation. + * + * @param petType The petType parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String petType) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (petType != null) { + requestOptions.addQueryParam("petType", petType, false); + } + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The put operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(BinaryData input) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesClient.java new file mode 100644 index 00000000000..52889b34ac7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesClient.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.discriminated.implementation.EnvelopeObjectCustomPropertiesImpl; + +/** + * Initializes a new instance of the synchronous DiscriminatedClient type. + */ +@ServiceClient(builder = DiscriminatedClientBuilder.class) +public final class EnvelopeObjectCustomPropertiesClient { + @Generated + private final EnvelopeObjectCustomPropertiesImpl serviceClient; + + /** + * Initializes an instance of EnvelopeObjectCustomPropertiesClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnvelopeObjectCustomPropertiesClient(EnvelopeObjectCustomPropertiesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
petTypeStringNoThe petType parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(input, requestOptions); + } + + /** + * The get operation. + * + * @param petType The petType parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData get(String petType) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (petType != null) { + requestOptions.addQueryParam("petType", petType, false); + } + return getWithResponse(requestOptions).getValue(); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue(); + } + + /** + * The put operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData put(BinaryData input) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(input, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultAsyncClient.java new file mode 100644 index 00000000000..ad437fbc0b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultAsyncClient.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.discriminated.implementation.EnvelopeObjectDefaultsImpl; + +/** + * Initializes a new instance of the asynchronous DiscriminatedClient type. + */ +@ServiceClient(builder = DiscriminatedClientBuilder.class, isAsync = true) +public final class EnvelopeObjectDefaultAsyncClient { + @Generated + private final EnvelopeObjectDefaultsImpl serviceClient; + + /** + * Initializes an instance of EnvelopeObjectDefaultAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnvelopeObjectDefaultAsyncClient(EnvelopeObjectDefaultsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(input, requestOptions); + } + + /** + * The get operation. + * + * @param kind The kind parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String kind) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (kind != null) { + requestOptions.addQueryParam("kind", kind, false); + } + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The put operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(BinaryData input) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultClient.java new file mode 100644 index 00000000000..5d4c5073765 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/EnvelopeObjectDefaultClient.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.discriminated.implementation.EnvelopeObjectDefaultsImpl; + +/** + * Initializes a new instance of the synchronous DiscriminatedClient type. + */ +@ServiceClient(builder = DiscriminatedClientBuilder.class) +public final class EnvelopeObjectDefaultClient { + @Generated + private final EnvelopeObjectDefaultsImpl serviceClient; + + /** + * Initializes an instance of EnvelopeObjectDefaultClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + EnvelopeObjectDefaultClient(EnvelopeObjectDefaultsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(input, requestOptions); + } + + /** + * The get operation. + * + * @param kind The kind parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData get(String kind) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (kind != null) { + requestOptions.addQueryParam("kind", kind, false); + } + return getWithResponse(requestOptions).getValue(); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue(); + } + + /** + * The put operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData put(BinaryData input) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(input, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorAsyncClient.java new file mode 100644 index 00000000000..759e359c721 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorAsyncClient.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.discriminated.implementation.NoEnvelopeCustomDiscriminatorsImpl; + +/** + * Initializes a new instance of the asynchronous DiscriminatedClient type. + */ +@ServiceClient(builder = DiscriminatedClientBuilder.class, isAsync = true) +public final class NoEnvelopeCustomDiscriminatorAsyncClient { + @Generated + private final NoEnvelopeCustomDiscriminatorsImpl serviceClient; + + /** + * Initializes an instance of NoEnvelopeCustomDiscriminatorAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NoEnvelopeCustomDiscriminatorAsyncClient(NoEnvelopeCustomDiscriminatorsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoThe type parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(input, requestOptions); + } + + /** + * The get operation. + * + * @param type The type parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String type) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (type != null) { + requestOptions.addQueryParam("type", type, false); + } + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The put operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(BinaryData input) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorClient.java new file mode 100644 index 00000000000..916d32c18ae --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorClient.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.discriminated.implementation.NoEnvelopeCustomDiscriminatorsImpl; + +/** + * Initializes a new instance of the synchronous DiscriminatedClient type. + */ +@ServiceClient(builder = DiscriminatedClientBuilder.class) +public final class NoEnvelopeCustomDiscriminatorClient { + @Generated + private final NoEnvelopeCustomDiscriminatorsImpl serviceClient; + + /** + * Initializes an instance of NoEnvelopeCustomDiscriminatorClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NoEnvelopeCustomDiscriminatorClient(NoEnvelopeCustomDiscriminatorsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoThe type parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(input, requestOptions); + } + + /** + * The get operation. + * + * @param type The type parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData get(String type) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (type != null) { + requestOptions.addQueryParam("type", type, false); + } + return getWithResponse(requestOptions).getValue(); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue(); + } + + /** + * The put operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData put(BinaryData input) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(input, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultAsyncClient.java new file mode 100644 index 00000000000..5ca3d2bf82c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultAsyncClient.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import type.union.discriminated.implementation.NoEnvelopeDefaultsImpl; + +/** + * Initializes a new instance of the asynchronous DiscriminatedClient type. + */ +@ServiceClient(builder = DiscriminatedClientBuilder.class, isAsync = true) +public final class NoEnvelopeDefaultAsyncClient { + @Generated + private final NoEnvelopeDefaultsImpl serviceClient; + + /** + * Initializes an instance of NoEnvelopeDefaultAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NoEnvelopeDefaultAsyncClient(NoEnvelopeDefaultsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putWithResponseAsync(input, requestOptions); + } + + /** + * The get operation. + * + * @param kind The kind parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String kind) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (kind != null) { + requestOptions.addQueryParam("kind", kind, false); + } + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * The put operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono put(BinaryData input) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(input, requestOptions).flatMap(FluxUtil::toMono); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultClient.java new file mode 100644 index 00000000000..a1c255b645f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/NoEnvelopeDefaultClient.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import type.union.discriminated.implementation.NoEnvelopeDefaultsImpl; + +/** + * Initializes a new instance of the synchronous DiscriminatedClient type. + */ +@ServiceClient(builder = DiscriminatedClientBuilder.class) +public final class NoEnvelopeDefaultClient { + @Generated + private final NoEnvelopeDefaultsImpl serviceClient; + + /** + * Initializes an instance of NoEnvelopeDefaultClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NoEnvelopeDefaultClient(NoEnvelopeDefaultsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(requestOptions); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { + return this.serviceClient.putWithResponse(input, requestOptions); + } + + /** + * The get operation. + * + * @param kind The kind parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData get(String kind) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (kind != null) { + requestOptions.addQueryParam("kind", kind, false); + } + return getWithResponse(requestOptions).getValue(); + } + + /** + * The get operation. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData get() { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(requestOptions).getValue(); + } + + /** + * The put operation. + * + * @param input The input parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public BinaryData put(BinaryData input) { + // Generated convenience method for putWithResponse + RequestOptions requestOptions = new RequestOptions(); + return putWithResponse(input, requestOptions).getValue(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/DiscriminatedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/DiscriminatedClientImpl.java new file mode 100644 index 00000000000..4e8f70e56d5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/DiscriminatedClientImpl.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 DiscriminatedClient type. + */ +public final class DiscriminatedClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 EnvelopeObjectDefaultsImpl object to access its operations. + */ + private final EnvelopeObjectDefaultsImpl envelopeObjectDefaults; + + /** + * Gets the EnvelopeObjectDefaultsImpl object to access its operations. + * + * @return the EnvelopeObjectDefaultsImpl object. + */ + public EnvelopeObjectDefaultsImpl getEnvelopeObjectDefaults() { + return this.envelopeObjectDefaults; + } + + /** + * The EnvelopeObjectCustomPropertiesImpl object to access its operations. + */ + private final EnvelopeObjectCustomPropertiesImpl envelopeObjectCustomProperties; + + /** + * Gets the EnvelopeObjectCustomPropertiesImpl object to access its operations. + * + * @return the EnvelopeObjectCustomPropertiesImpl object. + */ + public EnvelopeObjectCustomPropertiesImpl getEnvelopeObjectCustomProperties() { + return this.envelopeObjectCustomProperties; + } + + /** + * The NoEnvelopeDefaultsImpl object to access its operations. + */ + private final NoEnvelopeDefaultsImpl noEnvelopeDefaults; + + /** + * Gets the NoEnvelopeDefaultsImpl object to access its operations. + * + * @return the NoEnvelopeDefaultsImpl object. + */ + public NoEnvelopeDefaultsImpl getNoEnvelopeDefaults() { + return this.noEnvelopeDefaults; + } + + /** + * The NoEnvelopeCustomDiscriminatorsImpl object to access its operations. + */ + private final NoEnvelopeCustomDiscriminatorsImpl noEnvelopeCustomDiscriminators; + + /** + * Gets the NoEnvelopeCustomDiscriminatorsImpl object to access its operations. + * + * @return the NoEnvelopeCustomDiscriminatorsImpl object. + */ + public NoEnvelopeCustomDiscriminatorsImpl getNoEnvelopeCustomDiscriminators() { + return this.noEnvelopeCustomDiscriminators; + } + + /** + * Initializes an instance of DiscriminatedClient client. + * + * @param endpoint Service host. + */ + public DiscriminatedClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DiscriminatedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public DiscriminatedClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of DiscriminatedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public DiscriminatedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.envelopeObjectDefaults = new EnvelopeObjectDefaultsImpl(this); + this.envelopeObjectCustomProperties = new EnvelopeObjectCustomPropertiesImpl(this); + this.noEnvelopeDefaults = new NoEnvelopeDefaultsImpl(this); + this.noEnvelopeCustomDiscriminators = new NoEnvelopeCustomDiscriminatorsImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectCustomPropertiesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectCustomPropertiesImpl.java new file mode 100644 index 00000000000..445e19e84c7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectCustomPropertiesImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EnvelopeObjectCustomProperties. + */ +public final class EnvelopeObjectCustomPropertiesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EnvelopeObjectCustomPropertiesService service; + + /** + * The service client containing this operation class. + */ + private final DiscriminatedClientImpl client; + + /** + * Initializes an instance of EnvelopeObjectCustomPropertiesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnvelopeObjectCustomPropertiesImpl(DiscriminatedClientImpl client) { + this.service = RestProxy.create(EnvelopeObjectCustomPropertiesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscriminatedClientEnvelopeObjectCustomProperties to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscriminatedClientEnvelopeObjectCustomProperties") + public interface EnvelopeObjectCustomPropertiesService { + @Get("/type/union/discriminated/envelope/object/custom-properties") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/discriminated/envelope/object/custom-properties") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/union/discriminated/envelope/object/custom-properties") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + + @Put("/type/union/discriminated/envelope/object/custom-properties") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
petTypeStringNoThe petType parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
petTypeStringNoThe petType parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.put(this.client.getEndpoint(), contentType, accept, input, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with custom property names. + * The discriminated union should serialize with custom discriminator + * and envelope property names along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, accept, input, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectDefaultsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectDefaultsImpl.java new file mode 100644 index 00000000000..5714bdcb19d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/EnvelopeObjectDefaultsImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EnvelopeObjectDefaults. + */ +public final class EnvelopeObjectDefaultsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EnvelopeObjectDefaultsService service; + + /** + * The service client containing this operation class. + */ + private final DiscriminatedClientImpl client; + + /** + * Initializes an instance of EnvelopeObjectDefaultsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnvelopeObjectDefaultsImpl(DiscriminatedClientImpl client) { + this.service = RestProxy.create(EnvelopeObjectDefaultsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscriminatedClientEnvelopeObjectDefaults to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscriminatedClientEnvelopeObjectDefaults") + public interface EnvelopeObjectDefaultsService { + @Get("/type/union/discriminated/envelope/object/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/discriminated/envelope/object/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/union/discriminated/envelope/object/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + + @Put("/type/union/discriminated/envelope/object/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.put(this.client.getEndpoint(), contentType, accept, input, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with default envelope serialization. + * The discriminated union should serialize with "kind" as discriminator + * and "value" as envelope property along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, accept, input, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeCustomDiscriminatorsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeCustomDiscriminatorsImpl.java new file mode 100644 index 00000000000..9eb018e59d5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeCustomDiscriminatorsImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NoEnvelopeCustomDiscriminators. + */ +public final class NoEnvelopeCustomDiscriminatorsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NoEnvelopeCustomDiscriminatorsService service; + + /** + * The service client containing this operation class. + */ + private final DiscriminatedClientImpl client; + + /** + * Initializes an instance of NoEnvelopeCustomDiscriminatorsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NoEnvelopeCustomDiscriminatorsImpl(DiscriminatedClientImpl client) { + this.service = RestProxy.create(NoEnvelopeCustomDiscriminatorsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscriminatedClientNoEnvelopeCustomDiscriminators to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscriminatedClientNoEnvelopeCustomDiscriminators") + public interface NoEnvelopeCustomDiscriminatorsService { + @Get("/type/union/discriminated/no-envelope/custom-discriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/discriminated/no-envelope/custom-discriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/union/discriminated/no-envelope/custom-discriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + + @Put("/type/union/discriminated/no-envelope/custom-discriminator") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoThe type parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
typeStringNoThe type parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.put(this.client.getEndpoint(), contentType, accept, input, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator and custom discriminator property name. + * The discriminated union should serialize with custom discriminator property + * injected directly into the variant object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, accept, input, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeDefaultsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeDefaultsImpl.java new file mode 100644 index 00000000000..b9b5016e201 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/NoEnvelopeDefaultsImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Put; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in NoEnvelopeDefaults. + */ +public final class NoEnvelopeDefaultsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NoEnvelopeDefaultsService service; + + /** + * The service client containing this operation class. + */ + private final DiscriminatedClientImpl client; + + /** + * Initializes an instance of NoEnvelopeDefaultsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NoEnvelopeDefaultsImpl(DiscriminatedClientImpl client) { + this.service = RestProxy.create(NoEnvelopeDefaultsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscriminatedClientNoEnvelopeDefaults to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscriminatedClientNoEnvelopeDefaults") + public interface NoEnvelopeDefaultsService { + @Get("/type/union/discriminated/no-envelope/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/discriminated/no-envelope/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Put("/type/union/discriminated/no-envelope/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + + @Put("/type/union/discriminated/no-envelope/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response putSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData input, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
kindStringNoThe kind parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> putWithResponseAsync(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.put(this.client.getEndpoint(), contentType, accept, input, requestOptions, context)); + } + + /** + * The put operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * BinaryData
+     * }
+     * 
+ * + * @param input The input parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return test discriminated union with inline discriminator (no envelope). + * The discriminated union should serialize with discriminator property + * injected directly into the variant object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(BinaryData input, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putSync(this.client.getEndpoint(), contentType, accept, input, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/package-info.java new file mode 100644 index 00000000000..6871c6c6f53 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Discriminated. + * Describe scenarios for discriminated unions. + * + */ +package type.union.discriminated.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/package-info.java new file mode 100644 index 00000000000..7b54fc1b574 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/discriminated/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Discriminated. + * Describe scenarios for discriminated unions. + * + */ +package type.union.discriminated; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/EnumsOnliesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/EnumsOnliesImpl.java new file mode 100644 index 00000000000..608a4c002a2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/EnumsOnliesImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EnumsOnlies. + */ +public final class EnumsOnliesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final EnumsOnliesService service; + + /** + * The service client containing this operation class. + */ + private final UnionClientImpl client; + + /** + * Initializes an instance of EnumsOnliesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnumsOnliesImpl(UnionClientImpl client) { + this.service + = RestProxy.create(EnumsOnliesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for UnionClientEnumsOnlies to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UnionClientEnumsOnlies") + public interface EnumsOnliesService { + @Get("/type/union/enums-only") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/enums-only") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/type/union/enums-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest6, + RequestOptions requestOptions, Context context); + + @Post("/type/union/enums-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendRequest6, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         lr: String(left/right/up/down) (Required)
+     *         ud: String(up/down) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         lr: String(left/right/up/down) (Required)
+     *         ud: String(up/down) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         lr: String(left/right/up/down) (Required)
+     *         ud: String(up/down) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest6 The sendRequest6 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(BinaryData sendRequest6, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.send(this.client.getEndpoint(), contentType, sendRequest6, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         lr: String(left/right/up/down) (Required)
+     *         ud: String(up/down) (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest6 The sendRequest6 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest6, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendSync(this.client.getEndpoint(), contentType, sendRequest6, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/FloatsOnliesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/FloatsOnliesImpl.java new file mode 100644 index 00000000000..ef68f5571ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/FloatsOnliesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in FloatsOnlies. + */ +public final class FloatsOnliesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final FloatsOnliesService service; + + /** + * The service client containing this operation class. + */ + private final UnionClientImpl client; + + /** + * Initializes an instance of FloatsOnliesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FloatsOnliesImpl(UnionClientImpl client) { + this.service + = RestProxy.create(FloatsOnliesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for UnionClientFloatsOnlies to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UnionClientFloatsOnlies") + public interface FloatsOnliesService { + @Get("/type/union/floats-only") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/floats-only") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/type/union/floats-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest4, + RequestOptions requestOptions, Context context); + + @Post("/type/union/floats-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendRequest4, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1.1/2.2/3.3) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1.1/2.2/3.3) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1.1/2.2/3.3) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest4 The sendRequest4 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(BinaryData sendRequest4, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.send(this.client.getEndpoint(), contentType, sendRequest4, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1.1/2.2/3.3) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest4 The sendRequest4 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest4, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendSync(this.client.getEndpoint(), contentType, sendRequest4, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/IntsOnliesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/IntsOnliesImpl.java new file mode 100644 index 00000000000..a2a3eca8b13 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/IntsOnliesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in IntsOnlies. + */ +public final class IntsOnliesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final IntsOnliesService service; + + /** + * The service client containing this operation class. + */ + private final UnionClientImpl client; + + /** + * Initializes an instance of IntsOnliesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IntsOnliesImpl(UnionClientImpl client) { + this.service + = RestProxy.create(IntsOnliesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for UnionClientIntsOnlies to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UnionClientIntsOnlies") + public interface IntsOnliesService { + @Get("/type/union/ints-only") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/ints-only") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/type/union/ints-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest3, + RequestOptions requestOptions, Context context); + + @Post("/type/union/ints-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendRequest3, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1/2/3) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1/2/3) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1/2/3) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest3 The sendRequest3 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(BinaryData sendRequest3, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.send(this.client.getEndpoint(), contentType, sendRequest3, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(1/2/3) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest3 The sendRequest3 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest3, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendSync(this.client.getEndpoint(), contentType, sendRequest3, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedLiteralsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedLiteralsImpl.java new file mode 100644 index 00000000000..f2d48e7f5a0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedLiteralsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MixedLiterals. + */ +public final class MixedLiteralsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MixedLiteralsService service; + + /** + * The service client containing this operation class. + */ + private final UnionClientImpl client; + + /** + * Initializes an instance of MixedLiteralsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MixedLiteralsImpl(UnionClientImpl client) { + this.service + = RestProxy.create(MixedLiteralsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for UnionClientMixedLiterals to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UnionClientMixedLiterals") + public interface MixedLiteralsService { + @Get("/type/union/mixed-literals") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/mixed-literals") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/type/union/mixed-literals") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest8, + RequestOptions requestOptions, Context context); + + @Post("/type/union/mixed-literals") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendRequest8, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         stringLiteral: BinaryData (Required)
+     *         intLiteral: BinaryData (Required)
+     *         floatLiteral: BinaryData (Required)
+     *         booleanLiteral: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         stringLiteral: BinaryData (Required)
+     *         intLiteral: BinaryData (Required)
+     *         floatLiteral: BinaryData (Required)
+     *         booleanLiteral: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         stringLiteral: BinaryData (Required)
+     *         intLiteral: BinaryData (Required)
+     *         floatLiteral: BinaryData (Required)
+     *         booleanLiteral: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest8 The sendRequest8 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(BinaryData sendRequest8, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.send(this.client.getEndpoint(), contentType, sendRequest8, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         stringLiteral: BinaryData (Required)
+     *         intLiteral: BinaryData (Required)
+     *         floatLiteral: BinaryData (Required)
+     *         booleanLiteral: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest8 The sendRequest8 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest8, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendSync(this.client.getEndpoint(), contentType, sendRequest8, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedTypesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedTypesImpl.java new file mode 100644 index 00000000000..5b3bb182b15 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/MixedTypesImpl.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MixedTypes. + */ +public final class MixedTypesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MixedTypesService service; + + /** + * The service client containing this operation class. + */ + private final UnionClientImpl client; + + /** + * Initializes an instance of MixedTypesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MixedTypesImpl(UnionClientImpl client) { + this.service + = RestProxy.create(MixedTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for UnionClientMixedTypes to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UnionClientMixedTypes") + public interface MixedTypesService { + @Get("/type/union/mixed-types") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/mixed-types") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/type/union/mixed-types") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest9, + RequestOptions requestOptions, Context context); + + @Post("/type/union/mixed-types") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendRequest9, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         model: BinaryData (Required)
+     *         literal: BinaryData (Required)
+     *         int: BinaryData (Required)
+     *         boolean: BinaryData (Required)
+     *         array (Required): [
+     *             BinaryData (Required)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         model: BinaryData (Required)
+     *         literal: BinaryData (Required)
+     *         int: BinaryData (Required)
+     *         boolean: BinaryData (Required)
+     *         array (Required): [
+     *             BinaryData (Required)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         model: BinaryData (Required)
+     *         literal: BinaryData (Required)
+     *         int: BinaryData (Required)
+     *         boolean: BinaryData (Required)
+     *         array (Required): [
+     *             BinaryData (Required)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest9 The sendRequest9 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(BinaryData sendRequest9, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.send(this.client.getEndpoint(), contentType, sendRequest9, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         model: BinaryData (Required)
+     *         literal: BinaryData (Required)
+     *         int: BinaryData (Required)
+     *         boolean: BinaryData (Required)
+     *         array (Required): [
+     *             BinaryData (Required)
+     *         ]
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest9 The sendRequest9 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest9, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendSync(this.client.getEndpoint(), contentType, sendRequest9, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/ModelsOnliesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/ModelsOnliesImpl.java new file mode 100644 index 00000000000..7a8e9a1e0a3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/ModelsOnliesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ModelsOnlies. + */ +public final class ModelsOnliesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ModelsOnliesService service; + + /** + * The service client containing this operation class. + */ + private final UnionClientImpl client; + + /** + * Initializes an instance of ModelsOnliesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ModelsOnliesImpl(UnionClientImpl client) { + this.service + = RestProxy.create(ModelsOnliesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for UnionClientModelsOnlies to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UnionClientModelsOnlies") + public interface ModelsOnliesService { + @Get("/type/union/models-only") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/models-only") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/type/union/models-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest5, + RequestOptions requestOptions, Context context); + + @Post("/type/union/models-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendRequest5, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest5 The sendRequest5 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(BinaryData sendRequest5, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.send(this.client.getEndpoint(), contentType, sendRequest5, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest5 The sendRequest5 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest5, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendSync(this.client.getEndpoint(), contentType, sendRequest5, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringAndArraysImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringAndArraysImpl.java new file mode 100644 index 00000000000..78c6b3c35ff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringAndArraysImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringAndArrays. + */ +public final class StringAndArraysImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringAndArraysService service; + + /** + * The service client containing this operation class. + */ + private final UnionClientImpl client; + + /** + * Initializes an instance of StringAndArraysImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringAndArraysImpl(UnionClientImpl client) { + this.service + = RestProxy.create(StringAndArraysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for UnionClientStringAndArrays to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UnionClientStringAndArrays") + public interface StringAndArraysService { + @Get("/type/union/string-and-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/string-and-array") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/type/union/string-and-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest7, + RequestOptions requestOptions, Context context); + + @Post("/type/union/string-and-array") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendRequest7, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         string: BinaryData (Required)
+     *         array: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         string: BinaryData (Required)
+     *         array: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         string: BinaryData (Required)
+     *         array: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest7 The sendRequest7 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(BinaryData sendRequest7, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.send(this.client.getEndpoint(), contentType, sendRequest7, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop (Required): {
+     *         string: BinaryData (Required)
+     *         array: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param sendRequest7 The sendRequest7 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest7, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendSync(this.client.getEndpoint(), contentType, sendRequest7, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensibleNamedsImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensibleNamedsImpl.java new file mode 100644 index 00000000000..0c8c9298bb1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensibleNamedsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringExtensibleNameds. + */ +public final class StringExtensibleNamedsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringExtensibleNamedsService service; + + /** + * The service client containing this operation class. + */ + private final UnionClientImpl client; + + /** + * Initializes an instance of StringExtensibleNamedsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringExtensibleNamedsImpl(UnionClientImpl client) { + this.service = RestProxy.create(StringExtensibleNamedsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for UnionClientStringExtensibleNameds to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UnionClientStringExtensibleNameds") + public interface StringExtensibleNamedsService { + @Get("/type/union/string-extensible-named") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/string-extensible-named") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/type/union/string-extensible-named") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest2, + RequestOptions requestOptions, Context context); + + @Post("/type/union/string-extensible-named") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendRequest2, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest2 The sendRequest2 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(BinaryData sendRequest2, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.send(this.client.getEndpoint(), contentType, sendRequest2, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest2 The sendRequest2 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest2, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendSync(this.client.getEndpoint(), contentType, sendRequest2, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensiblesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensiblesImpl.java new file mode 100644 index 00000000000..a2e13ed210c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringExtensiblesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringExtensibles. + */ +public final class StringExtensiblesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringExtensiblesService service; + + /** + * The service client containing this operation class. + */ + private final UnionClientImpl client; + + /** + * Initializes an instance of StringExtensiblesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringExtensiblesImpl(UnionClientImpl client) { + this.service + = RestProxy.create(StringExtensiblesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for UnionClientStringExtensibles to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UnionClientStringExtensibles") + public interface StringExtensiblesService { + @Get("/type/union/string-extensible") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/string-extensible") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/type/union/string-extensible") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest1, + RequestOptions requestOptions, Context context); + + @Post("/type/union/string-extensible") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendRequest1, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest1 The sendRequest1 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(BinaryData sendRequest1, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.send(this.client.getEndpoint(), contentType, sendRequest1, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest1 The sendRequest1 parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest1, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendSync(this.client.getEndpoint(), contentType, sendRequest1, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringsOnliesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringsOnliesImpl.java new file mode 100644 index 00000000000..dcd4a865e38 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/StringsOnliesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in StringsOnlies. + */ +public final class StringsOnliesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final StringsOnliesService service; + + /** + * The service client containing this operation class. + */ + private final UnionClientImpl client; + + /** + * Initializes an instance of StringsOnliesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StringsOnliesImpl(UnionClientImpl client) { + this.service + = RestProxy.create(StringsOnliesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for UnionClientStringsOnlies to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "UnionClientStringsOnlies") + public interface StringsOnliesService { + @Get("/type/union/strings-only") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/type/union/strings-only") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/type/union/strings-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> send(@HostParam("endpoint") String endpoint, + @HeaderParam("Content-Type") String contentType, @BodyParam("application/json") BinaryData sendRequest, + RequestOptions requestOptions, Context context); + + @Post("/type/union/strings-only") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response sendSync(@HostParam("endpoint") String endpoint, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BinaryData sendRequest, RequestOptions requestOptions, Context context); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(a/b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The get operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(a/b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), accept, requestOptions, Context.NONE); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(a/b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest The sendRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> sendWithResponseAsync(BinaryData sendRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return FluxUtil.withContext( + context -> service.send(this.client.getEndpoint(), contentType, sendRequest, requestOptions, context)); + } + + /** + * The send operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String(a/b/c) (Required)
+     * }
+     * }
+     * 
+ * + * @param sendRequest The sendRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendWithResponse(BinaryData sendRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + return service.sendSync(this.client.getEndpoint(), contentType, sendRequest, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/UnionClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/UnionClientImpl.java new file mode 100644 index 00000000000..d551d7e26cc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/UnionClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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 UnionClient type. + */ +public final class UnionClientImpl { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * 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 StringsOnliesImpl object to access its operations. + */ + private final StringsOnliesImpl stringsOnlies; + + /** + * Gets the StringsOnliesImpl object to access its operations. + * + * @return the StringsOnliesImpl object. + */ + public StringsOnliesImpl getStringsOnlies() { + return this.stringsOnlies; + } + + /** + * The StringExtensiblesImpl object to access its operations. + */ + private final StringExtensiblesImpl stringExtensibles; + + /** + * Gets the StringExtensiblesImpl object to access its operations. + * + * @return the StringExtensiblesImpl object. + */ + public StringExtensiblesImpl getStringExtensibles() { + return this.stringExtensibles; + } + + /** + * The StringExtensibleNamedsImpl object to access its operations. + */ + private final StringExtensibleNamedsImpl stringExtensibleNameds; + + /** + * Gets the StringExtensibleNamedsImpl object to access its operations. + * + * @return the StringExtensibleNamedsImpl object. + */ + public StringExtensibleNamedsImpl getStringExtensibleNameds() { + return this.stringExtensibleNameds; + } + + /** + * The IntsOnliesImpl object to access its operations. + */ + private final IntsOnliesImpl intsOnlies; + + /** + * Gets the IntsOnliesImpl object to access its operations. + * + * @return the IntsOnliesImpl object. + */ + public IntsOnliesImpl getIntsOnlies() { + return this.intsOnlies; + } + + /** + * The FloatsOnliesImpl object to access its operations. + */ + private final FloatsOnliesImpl floatsOnlies; + + /** + * Gets the FloatsOnliesImpl object to access its operations. + * + * @return the FloatsOnliesImpl object. + */ + public FloatsOnliesImpl getFloatsOnlies() { + return this.floatsOnlies; + } + + /** + * The ModelsOnliesImpl object to access its operations. + */ + private final ModelsOnliesImpl modelsOnlies; + + /** + * Gets the ModelsOnliesImpl object to access its operations. + * + * @return the ModelsOnliesImpl object. + */ + public ModelsOnliesImpl getModelsOnlies() { + return this.modelsOnlies; + } + + /** + * The EnumsOnliesImpl object to access its operations. + */ + private final EnumsOnliesImpl enumsOnlies; + + /** + * Gets the EnumsOnliesImpl object to access its operations. + * + * @return the EnumsOnliesImpl object. + */ + public EnumsOnliesImpl getEnumsOnlies() { + return this.enumsOnlies; + } + + /** + * The StringAndArraysImpl object to access its operations. + */ + private final StringAndArraysImpl stringAndArrays; + + /** + * Gets the StringAndArraysImpl object to access its operations. + * + * @return the StringAndArraysImpl object. + */ + public StringAndArraysImpl getStringAndArrays() { + return this.stringAndArrays; + } + + /** + * The MixedLiteralsImpl object to access its operations. + */ + private final MixedLiteralsImpl mixedLiterals; + + /** + * Gets the MixedLiteralsImpl object to access its operations. + * + * @return the MixedLiteralsImpl object. + */ + public MixedLiteralsImpl getMixedLiterals() { + return this.mixedLiterals; + } + + /** + * The MixedTypesImpl object to access its operations. + */ + private final MixedTypesImpl mixedTypes; + + /** + * Gets the MixedTypesImpl object to access its operations. + * + * @return the MixedTypesImpl object. + */ + public MixedTypesImpl getMixedTypes() { + return this.mixedTypes; + } + + /** + * Initializes an instance of UnionClient client. + * + * @param endpoint Service host. + */ + public UnionClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of UnionClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public UnionClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of UnionClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public UnionClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.stringsOnlies = new StringsOnliesImpl(this); + this.stringExtensibles = new StringExtensiblesImpl(this); + this.stringExtensibleNameds = new StringExtensibleNamedsImpl(this); + this.intsOnlies = new IntsOnliesImpl(this); + this.floatsOnlies = new FloatsOnliesImpl(this); + this.modelsOnlies = new ModelsOnliesImpl(this); + this.enumsOnlies = new EnumsOnliesImpl(this); + this.stringAndArrays = new StringAndArraysImpl(this); + this.mixedLiterals = new MixedLiteralsImpl(this); + this.mixedTypes = new MixedTypesImpl(this); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest.java new file mode 100644 index 00000000000..7ba57041bf7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import type.union.models.GetResponseProp; + +/** + * The SendRequest model. + */ +@Immutable +public final class SendRequest implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final GetResponseProp prop; + + /** + * Creates an instance of SendRequest class. + * + * @param prop the prop value to set. + */ + @Generated + public SendRequest(GetResponseProp prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public GetResponseProp getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendRequest. + */ + @Generated + public static SendRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetResponseProp prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = GetResponseProp.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new SendRequest(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest1.java new file mode 100644 index 00000000000..b544425e4a6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest1.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import type.union.models.GetResponseProp1; + +/** + * The SendRequest1 model. + */ +@Immutable +public final class SendRequest1 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final GetResponseProp1 prop; + + /** + * Creates an instance of SendRequest1 class. + * + * @param prop the prop value to set. + */ + @Generated + public SendRequest1(GetResponseProp1 prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public GetResponseProp1 getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendRequest1 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendRequest1 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendRequest1. + */ + @Generated + public static SendRequest1 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetResponseProp1 prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = GetResponseProp1.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new SendRequest1(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest2.java new file mode 100644 index 00000000000..dcdf65ef1e1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest2.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import type.union.models.StringExtensibleNamedUnion; + +/** + * The SendRequest2 model. + */ +@Immutable +public final class SendRequest2 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final StringExtensibleNamedUnion prop; + + /** + * Creates an instance of SendRequest2 class. + * + * @param prop the prop value to set. + */ + @Generated + public SendRequest2(StringExtensibleNamedUnion prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public StringExtensibleNamedUnion getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendRequest2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendRequest2 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendRequest2. + */ + @Generated + public static SendRequest2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StringExtensibleNamedUnion prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = StringExtensibleNamedUnion.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new SendRequest2(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest3.java new file mode 100644 index 00000000000..e75175b093d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest3.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import type.union.models.GetResponseProp2; + +/** + * The SendRequest3 model. + */ +@Immutable +public final class SendRequest3 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final GetResponseProp2 prop; + + /** + * Creates an instance of SendRequest3 class. + * + * @param prop the prop value to set. + */ + @Generated + public SendRequest3(GetResponseProp2 prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public GetResponseProp2 getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("prop", this.prop == null ? null : this.prop.toInt()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendRequest3 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendRequest3 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendRequest3. + */ + @Generated + public static SendRequest3 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetResponseProp2 prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = GetResponseProp2.fromInt(reader.getInt()); + } else { + reader.skipChildren(); + } + } + return new SendRequest3(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest4.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest4.java new file mode 100644 index 00000000000..4e9e1c58a1b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest4.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import type.union.models.GetResponseProp3; + +/** + * The SendRequest4 model. + */ +@Immutable +public final class SendRequest4 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final GetResponseProp3 prop; + + /** + * Creates an instance of SendRequest4 class. + * + * @param prop the prop value to set. + */ + @Generated + public SendRequest4(GetResponseProp3 prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public GetResponseProp3 getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("prop", this.prop == null ? null : this.prop.toDouble()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendRequest4 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendRequest4 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendRequest4. + */ + @Generated + public static SendRequest4 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetResponseProp3 prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = GetResponseProp3.fromDouble(reader.getDouble()); + } else { + reader.skipChildren(); + } + } + return new SendRequest4(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest5.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest5.java new file mode 100644 index 00000000000..81e96e991c6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest5.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The SendRequest5 model. + */ +@Immutable +public final class SendRequest5 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final BinaryData prop; + + /** + * Creates an instance of SendRequest5 class. + * + * @param prop the prop value to set. + */ + @Generated + public SendRequest5(BinaryData prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public BinaryData getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeFieldName("prop"); + this.prop.writeTo(jsonWriter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendRequest5 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendRequest5 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendRequest5. + */ + @Generated + public static SendRequest5 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryData prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + return new SendRequest5(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest6.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest6.java new file mode 100644 index 00000000000..b50d494c717 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest6.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import type.union.models.EnumsOnlyCases; + +/** + * The SendRequest6 model. + */ +@Immutable +public final class SendRequest6 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final EnumsOnlyCases prop; + + /** + * Creates an instance of SendRequest6 class. + * + * @param prop the prop value to set. + */ + @Generated + public SendRequest6(EnumsOnlyCases prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public EnumsOnlyCases getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("prop", this.prop); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendRequest6 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendRequest6 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendRequest6. + */ + @Generated + public static SendRequest6 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnumsOnlyCases prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = EnumsOnlyCases.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new SendRequest6(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest7.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest7.java new file mode 100644 index 00000000000..6f82043a2f2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest7.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import type.union.models.StringAndArrayCases; + +/** + * The SendRequest7 model. + */ +@Immutable +public final class SendRequest7 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final StringAndArrayCases prop; + + /** + * Creates an instance of SendRequest7 class. + * + * @param prop the prop value to set. + */ + @Generated + public SendRequest7(StringAndArrayCases prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public StringAndArrayCases getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("prop", this.prop); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendRequest7 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendRequest7 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendRequest7. + */ + @Generated + public static SendRequest7 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StringAndArrayCases prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = StringAndArrayCases.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new SendRequest7(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest8.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest8.java new file mode 100644 index 00000000000..6f16d979b89 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest8.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import type.union.models.MixedLiteralsCases; + +/** + * The SendRequest8 model. + */ +@Immutable +public final class SendRequest8 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final MixedLiteralsCases prop; + + /** + * Creates an instance of SendRequest8 class. + * + * @param prop the prop value to set. + */ + @Generated + public SendRequest8(MixedLiteralsCases prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public MixedLiteralsCases getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("prop", this.prop); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendRequest8 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendRequest8 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendRequest8. + */ + @Generated + public static SendRequest8 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MixedLiteralsCases prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = MixedLiteralsCases.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new SendRequest8(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest9.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest9.java new file mode 100644 index 00000000000..ebcd173d226 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/SendRequest9.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import type.union.models.MixedTypesCases; + +/** + * The SendRequest9 model. + */ +@Immutable +public final class SendRequest9 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final MixedTypesCases prop; + + /** + * Creates an instance of SendRequest9 class. + * + * @param prop the prop value to set. + */ + @Generated + public SendRequest9(MixedTypesCases prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public MixedTypesCases getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("prop", this.prop); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SendRequest9 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SendRequest9 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SendRequest9. + */ + @Generated + public static SendRequest9 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MixedTypesCases prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = MixedTypesCases.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new SendRequest9(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/package-info.java new file mode 100644 index 00000000000..55893730844 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Union. + * Describe scenarios for various combinations of unions. + * + */ +package type.union.implementation.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/package-info.java new file mode 100644 index 00000000000..8bda5a7c044 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Union. + * Describe scenarios for various combinations of unions. + * + */ +package type.union.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Cat.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Cat.java new file mode 100644 index 00000000000..6146f45a215 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Cat.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Cat model. + */ +@Immutable +public final class Cat implements JsonSerializable { + /* + * The name property. + */ + @Generated + private final String name; + + /** + * Creates an instance of Cat class. + * + * @param name the name value to set. + */ + @Generated + public Cat(String name) { + this.name = name; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Cat from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Cat if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Cat. + */ + @Generated + public static Cat fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Cat(name); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Dog.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Dog.java new file mode 100644 index 00000000000..abb730302b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/Dog.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Dog model. + */ +@Immutable +public final class Dog implements JsonSerializable { + /* + * The bark property. + */ + @Generated + private final String bark; + + /** + * Creates an instance of Dog class. + * + * @param bark the bark value to set. + */ + @Generated + public Dog(String bark) { + this.bark = bark; + } + + /** + * Get the bark property: The bark property. + * + * @return the bark value. + */ + @Generated + public String getBark() { + return this.bark; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("bark", this.bark); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dog from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dog if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Dog. + */ + @Generated + public static Dog fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String bark = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("bark".equals(fieldName)) { + bark = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new Dog(bark); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCases.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCases.java new file mode 100644 index 00000000000..3cbc47d0a4b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCases.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The EnumsOnlyCases model. + */ +@Immutable +public final class EnumsOnlyCases implements JsonSerializable { + /* + * This should be receive/send the left variant + */ + @Generated + private final EnumsOnlyCasesLr lr; + + /* + * This should be receive/send the up variant + */ + @Generated + private final EnumsOnlyCasesUd ud; + + /** + * Creates an instance of EnumsOnlyCases class. + * + * @param lr the lr value to set. + * @param ud the ud value to set. + */ + @Generated + public EnumsOnlyCases(EnumsOnlyCasesLr lr, EnumsOnlyCasesUd ud) { + this.lr = lr; + this.ud = ud; + } + + /** + * Get the lr property: This should be receive/send the left variant. + * + * @return the lr value. + */ + @Generated + public EnumsOnlyCasesLr getLr() { + return this.lr; + } + + /** + * Get the ud property: This should be receive/send the up variant. + * + * @return the ud value. + */ + @Generated + public EnumsOnlyCasesUd getUd() { + return this.ud; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("lr", this.lr == null ? null : this.lr.toString()); + jsonWriter.writeStringField("ud", this.ud == null ? null : this.ud.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnumsOnlyCases from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnumsOnlyCases if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EnumsOnlyCases. + */ + @Generated + public static EnumsOnlyCases fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnumsOnlyCasesLr lr = null; + EnumsOnlyCasesUd ud = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lr".equals(fieldName)) { + lr = EnumsOnlyCasesLr.fromString(reader.getString()); + } else if ("ud".equals(fieldName)) { + ud = EnumsOnlyCasesUd.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new EnumsOnlyCases(lr, ud); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesLr.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesLr.java new file mode 100644 index 00000000000..6e9db0957e9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesLr.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +/** + * Defines values for EnumsOnlyCasesLr. + */ +public enum EnumsOnlyCasesLr { + /** + * Enum value left. + */ + LEFT("left"), + + /** + * Enum value right. + */ + RIGHT("right"), + + /** + * Enum value up. + */ + UP("up"), + + /** + * Enum value down. + */ + DOWN("down"); + + /** + * The actual serialized value for a EnumsOnlyCasesLr instance. + */ + private final String value; + + EnumsOnlyCasesLr(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EnumsOnlyCasesLr instance. + * + * @param value the serialized value to parse. + * @return the parsed EnumsOnlyCasesLr object, or null if unable to parse. + */ + public static EnumsOnlyCasesLr fromString(String value) { + if (value == null) { + return null; + } + EnumsOnlyCasesLr[] items = EnumsOnlyCasesLr.values(); + for (EnumsOnlyCasesLr item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesUd.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesUd.java new file mode 100644 index 00000000000..2c050adca51 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/EnumsOnlyCasesUd.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +/** + * Defines values for EnumsOnlyCasesUd. + */ +public enum EnumsOnlyCasesUd { + /** + * Enum value up. + */ + UP("up"), + + /** + * Enum value down. + */ + DOWN("down"); + + /** + * The actual serialized value for a EnumsOnlyCasesUd instance. + */ + private final String value; + + EnumsOnlyCasesUd(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EnumsOnlyCasesUd instance. + * + * @param value the serialized value to parse. + * @return the parsed EnumsOnlyCasesUd object, or null if unable to parse. + */ + public static EnumsOnlyCasesUd fromString(String value) { + if (value == null) { + return null; + } + EnumsOnlyCasesUd[] items = EnumsOnlyCasesUd.values(); + for (EnumsOnlyCasesUd item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse.java new file mode 100644 index 00000000000..32ef7aecc2c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetResponse model. + */ +@Immutable +public final class GetResponse implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final GetResponseProp prop; + + /** + * Creates an instance of GetResponse class. + * + * @param prop the prop value to set. + */ + @Generated + private GetResponse(GetResponseProp prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public GetResponseProp getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetResponse if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetResponse. + */ + @Generated + public static GetResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetResponseProp prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = GetResponseProp.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new GetResponse(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse1.java new file mode 100644 index 00000000000..f54657a3fcd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse1.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetResponse1 model. + */ +@Immutable +public final class GetResponse1 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final GetResponseProp1 prop; + + /** + * Creates an instance of GetResponse1 class. + * + * @param prop the prop value to set. + */ + @Generated + private GetResponse1(GetResponseProp1 prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public GetResponseProp1 getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetResponse1 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetResponse1 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetResponse1. + */ + @Generated + public static GetResponse1 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetResponseProp1 prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = GetResponseProp1.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new GetResponse1(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse2.java new file mode 100644 index 00000000000..01741b1e390 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse2.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetResponse2 model. + */ +@Immutable +public final class GetResponse2 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final StringExtensibleNamedUnion prop; + + /** + * Creates an instance of GetResponse2 class. + * + * @param prop the prop value to set. + */ + @Generated + private GetResponse2(StringExtensibleNamedUnion prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public StringExtensibleNamedUnion getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop == null ? null : this.prop.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetResponse2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetResponse2 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetResponse2. + */ + @Generated + public static GetResponse2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StringExtensibleNamedUnion prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = StringExtensibleNamedUnion.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new GetResponse2(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse3.java new file mode 100644 index 00000000000..8446ee1dbdc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse3.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetResponse3 model. + */ +@Immutable +public final class GetResponse3 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final GetResponseProp2 prop; + + /** + * Creates an instance of GetResponse3 class. + * + * @param prop the prop value to set. + */ + @Generated + private GetResponse3(GetResponseProp2 prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public GetResponseProp2 getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("prop", this.prop == null ? null : this.prop.toInt()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetResponse3 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetResponse3 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetResponse3. + */ + @Generated + public static GetResponse3 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetResponseProp2 prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = GetResponseProp2.fromInt(reader.getInt()); + } else { + reader.skipChildren(); + } + } + return new GetResponse3(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse4.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse4.java new file mode 100644 index 00000000000..45273d70bec --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse4.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetResponse4 model. + */ +@Immutable +public final class GetResponse4 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final GetResponseProp3 prop; + + /** + * Creates an instance of GetResponse4 class. + * + * @param prop the prop value to set. + */ + @Generated + private GetResponse4(GetResponseProp3 prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public GetResponseProp3 getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("prop", this.prop == null ? null : this.prop.toDouble()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetResponse4 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetResponse4 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetResponse4. + */ + @Generated + public static GetResponse4 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetResponseProp3 prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = GetResponseProp3.fromDouble(reader.getDouble()); + } else { + reader.skipChildren(); + } + } + return new GetResponse4(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse5.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse5.java new file mode 100644 index 00000000000..55ab59cfe85 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse5.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetResponse5 model. + */ +@Immutable +public final class GetResponse5 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final BinaryData prop; + + /** + * Creates an instance of GetResponse5 class. + * + * @param prop the prop value to set. + */ + @Generated + private GetResponse5(BinaryData prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public BinaryData getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeFieldName("prop"); + this.prop.writeTo(jsonWriter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetResponse5 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetResponse5 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetResponse5. + */ + @Generated + public static GetResponse5 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryData prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + return new GetResponse5(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse6.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse6.java new file mode 100644 index 00000000000..6cd2c8b3355 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse6.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetResponse6 model. + */ +@Immutable +public final class GetResponse6 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final EnumsOnlyCases prop; + + /** + * Creates an instance of GetResponse6 class. + * + * @param prop the prop value to set. + */ + @Generated + private GetResponse6(EnumsOnlyCases prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public EnumsOnlyCases getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("prop", this.prop); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetResponse6 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetResponse6 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetResponse6. + */ + @Generated + public static GetResponse6 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnumsOnlyCases prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = EnumsOnlyCases.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new GetResponse6(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse7.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse7.java new file mode 100644 index 00000000000..587c4542752 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse7.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetResponse7 model. + */ +@Immutable +public final class GetResponse7 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final StringAndArrayCases prop; + + /** + * Creates an instance of GetResponse7 class. + * + * @param prop the prop value to set. + */ + @Generated + private GetResponse7(StringAndArrayCases prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public StringAndArrayCases getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("prop", this.prop); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetResponse7 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetResponse7 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetResponse7. + */ + @Generated + public static GetResponse7 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StringAndArrayCases prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = StringAndArrayCases.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new GetResponse7(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse8.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse8.java new file mode 100644 index 00000000000..a6b9d01fd0f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse8.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetResponse8 model. + */ +@Immutable +public final class GetResponse8 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final MixedLiteralsCases prop; + + /** + * Creates an instance of GetResponse8 class. + * + * @param prop the prop value to set. + */ + @Generated + private GetResponse8(MixedLiteralsCases prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public MixedLiteralsCases getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("prop", this.prop); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetResponse8 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetResponse8 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetResponse8. + */ + @Generated + public static GetResponse8 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MixedLiteralsCases prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = MixedLiteralsCases.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new GetResponse8(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse9.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse9.java new file mode 100644 index 00000000000..5bbe7e395de --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponse9.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The GetResponse9 model. + */ +@Immutable +public final class GetResponse9 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final MixedTypesCases prop; + + /** + * Creates an instance of GetResponse9 class. + * + * @param prop the prop value to set. + */ + @Generated + private GetResponse9(MixedTypesCases prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public MixedTypesCases getProp() { + return this.prop; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("prop", this.prop); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetResponse9 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetResponse9 if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetResponse9. + */ + @Generated + public static GetResponse9 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MixedTypesCases prop = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = MixedTypesCases.fromJson(reader); + } else { + reader.skipChildren(); + } + } + return new GetResponse9(prop); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp.java new file mode 100644 index 00000000000..337c2615dac --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +/** + * Defines values for GetResponseProp. + */ +public enum GetResponseProp { + /** + * Enum value a. + */ + A("a"), + + /** + * Enum value b. + */ + B("b"), + + /** + * Enum value c. + */ + C("c"); + + /** + * The actual serialized value for a GetResponseProp instance. + */ + private final String value; + + GetResponseProp(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a GetResponseProp instance. + * + * @param value the serialized value to parse. + * @return the parsed GetResponseProp object, or null if unable to parse. + */ + public static GetResponseProp fromString(String value) { + if (value == null) { + return null; + } + GetResponseProp[] items = GetResponseProp.values(); + for (GetResponseProp item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp1.java new file mode 100644 index 00000000000..6e80a4a4003 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp1.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for GetResponseProp1. + */ +public final class GetResponseProp1 extends ExpandableStringEnum { + /** + * Static value b for GetResponseProp1. + */ + @Generated + public static final GetResponseProp1 B = fromString("b"); + + /** + * Static value c for GetResponseProp1. + */ + @Generated + public static final GetResponseProp1 C = fromString("c"); + + /** + * Creates a new instance of GetResponseProp1 value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public GetResponseProp1() { + } + + /** + * Creates or finds a GetResponseProp1 from its string representation. + * + * @param name a name to look for. + * @return the corresponding GetResponseProp1. + */ + @Generated + public static GetResponseProp1 fromString(String name) { + return fromString(name, GetResponseProp1.class); + } + + /** + * Gets known GetResponseProp1 values. + * + * @return known GetResponseProp1 values. + */ + @Generated + public static Collection values() { + return values(GetResponseProp1.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp2.java new file mode 100644 index 00000000000..3cd208970c3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp2.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +/** + * Defines values for GetResponseProp2. + */ +public enum GetResponseProp2 { + /** + * Enum value 1. + */ + ONE(1), + + /** + * Enum value 2. + */ + TWO(2), + + /** + * Enum value 3. + */ + THREE(3); + + /** + * The actual serialized value for a GetResponseProp2 instance. + */ + private final int value; + + GetResponseProp2(int value) { + this.value = value; + } + + /** + * Parses a serialized value to a GetResponseProp2 instance. + * + * @param value the serialized value to parse. + * @return the parsed GetResponseProp2 object, or null if unable to parse. + */ + public static GetResponseProp2 fromInt(int value) { + GetResponseProp2[] items = GetResponseProp2.values(); + for (GetResponseProp2 item : items) { + if (item.toInt() == value) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to int value. + * + * @return the int value. + */ + public int toInt() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp3.java new file mode 100644 index 00000000000..f35ff836f58 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/GetResponseProp3.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +/** + * Defines values for GetResponseProp3. + */ +public enum GetResponseProp3 { + /** + * Enum value 1.1. + */ + ONE_ONE(1.1), + + /** + * Enum value 2.2. + */ + TWO_TWO(2.2), + + /** + * Enum value 3.3. + */ + THREE_THREE(3.3); + + /** + * The actual serialized value for a GetResponseProp3 instance. + */ + private final double value; + + GetResponseProp3(double value) { + this.value = value; + } + + /** + * Parses a serialized value to a GetResponseProp3 instance. + * + * @param value the serialized value to parse. + * @return the parsed GetResponseProp3 object, or null if unable to parse. + */ + public static GetResponseProp3 fromDouble(double value) { + GetResponseProp3[] items = GetResponseProp3.values(); + for (GetResponseProp3 item : items) { + if (Double.doubleToLongBits(item.toDouble()) == Double.doubleToLongBits(value)) { + return item; + } + } + return null; + } + + /** + * De-serializes the instance to double value. + * + * @return the double value. + */ + public double toDouble() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedLiteralsCases.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedLiteralsCases.java new file mode 100644 index 00000000000..e6ac56e2a88 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedLiteralsCases.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The MixedLiteralsCases model. + */ +@Immutable +public final class MixedLiteralsCases implements JsonSerializable { + /* + * This should be receive/send the "a" variant + */ + @Generated + private final BinaryData stringLiteral; + + /* + * This should be receive/send the 2 variant + */ + @Generated + private final BinaryData intLiteral; + + /* + * This should be receive/send the 3.3 variant + */ + @Generated + private final BinaryData floatLiteral; + + /* + * This should be receive/send the true variant + */ + @Generated + private final BinaryData booleanLiteral; + + /** + * Creates an instance of MixedLiteralsCases class. + * + * @param stringLiteral the stringLiteral value to set. + * @param intLiteral the intLiteral value to set. + * @param floatLiteral the floatLiteral value to set. + * @param booleanLiteral the booleanLiteral value to set. + */ + @Generated + public MixedLiteralsCases(BinaryData stringLiteral, BinaryData intLiteral, BinaryData floatLiteral, + BinaryData booleanLiteral) { + this.stringLiteral = stringLiteral; + this.intLiteral = intLiteral; + this.floatLiteral = floatLiteral; + this.booleanLiteral = booleanLiteral; + } + + /** + * Get the stringLiteral property: This should be receive/send the "a" variant. + * + * @return the stringLiteral value. + */ + @Generated + public BinaryData getStringLiteral() { + return this.stringLiteral; + } + + /** + * Get the intLiteral property: This should be receive/send the 2 variant. + * + * @return the intLiteral value. + */ + @Generated + public BinaryData getIntLiteral() { + return this.intLiteral; + } + + /** + * Get the floatLiteral property: This should be receive/send the 3.3 variant. + * + * @return the floatLiteral value. + */ + @Generated + public BinaryData getFloatLiteral() { + return this.floatLiteral; + } + + /** + * Get the booleanLiteral property: This should be receive/send the true variant. + * + * @return the booleanLiteral value. + */ + @Generated + public BinaryData getBooleanLiteral() { + return this.booleanLiteral; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeFieldName("stringLiteral"); + this.stringLiteral.writeTo(jsonWriter); + jsonWriter.writeFieldName("intLiteral"); + this.intLiteral.writeTo(jsonWriter); + jsonWriter.writeFieldName("floatLiteral"); + this.floatLiteral.writeTo(jsonWriter); + jsonWriter.writeFieldName("booleanLiteral"); + this.booleanLiteral.writeTo(jsonWriter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MixedLiteralsCases from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MixedLiteralsCases if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MixedLiteralsCases. + */ + @Generated + public static MixedLiteralsCases fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryData stringLiteral = null; + BinaryData intLiteral = null; + BinaryData floatLiteral = null; + BinaryData booleanLiteral = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("stringLiteral".equals(fieldName)) { + stringLiteral + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("intLiteral".equals(fieldName)) { + intLiteral + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("floatLiteral".equals(fieldName)) { + floatLiteral + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("booleanLiteral".equals(fieldName)) { + booleanLiteral + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + return new MixedLiteralsCases(stringLiteral, intLiteral, floatLiteral, booleanLiteral); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedTypesCases.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedTypesCases.java new file mode 100644 index 00000000000..a1432230f8b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/MixedTypesCases.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The MixedTypesCases model. + */ +@Immutable +public final class MixedTypesCases implements JsonSerializable { + /* + * This should be receive/send the Cat variant + */ + @Generated + private final BinaryData model; + + /* + * This should be receive/send the "a" variant + */ + @Generated + private final BinaryData literal; + + /* + * This should be receive/send the int variant + */ + @Generated + private final BinaryData intProperty; + + /* + * This should be receive/send the boolean variant + */ + @Generated + private final BinaryData booleanProperty; + + /* + * This should be receive/send 4 element with Cat, "a", int, and boolean + */ + @Generated + private final List array; + + /** + * Creates an instance of MixedTypesCases class. + * + * @param model the model value to set. + * @param literal the literal value to set. + * @param intProperty the intProperty value to set. + * @param booleanProperty the booleanProperty value to set. + * @param array the array value to set. + */ + @Generated + public MixedTypesCases(BinaryData model, BinaryData literal, BinaryData intProperty, BinaryData booleanProperty, + List array) { + this.model = model; + this.literal = literal; + this.intProperty = intProperty; + this.booleanProperty = booleanProperty; + this.array = array; + } + + /** + * Get the model property: This should be receive/send the Cat variant. + * + * @return the model value. + */ + @Generated + public BinaryData getModel() { + return this.model; + } + + /** + * Get the literal property: This should be receive/send the "a" variant. + * + * @return the literal value. + */ + @Generated + public BinaryData getLiteral() { + return this.literal; + } + + /** + * Get the intProperty property: This should be receive/send the int variant. + * + * @return the intProperty value. + */ + @Generated + public BinaryData getIntProperty() { + return this.intProperty; + } + + /** + * Get the booleanProperty property: This should be receive/send the boolean variant. + * + * @return the booleanProperty value. + */ + @Generated + public BinaryData getBooleanProperty() { + return this.booleanProperty; + } + + /** + * Get the array property: This should be receive/send 4 element with Cat, "a", int, and boolean. + * + * @return the array value. + */ + @Generated + public List getArray() { + return this.array; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeFieldName("model"); + this.model.writeTo(jsonWriter); + jsonWriter.writeFieldName("literal"); + this.literal.writeTo(jsonWriter); + jsonWriter.writeFieldName("int"); + this.intProperty.writeTo(jsonWriter); + jsonWriter.writeFieldName("boolean"); + this.booleanProperty.writeTo(jsonWriter); + jsonWriter.writeArrayField("array", this.array, + (writer, element) -> writer.writeUntyped(element == null ? null : element.toObject(Object.class))); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MixedTypesCases from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MixedTypesCases if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MixedTypesCases. + */ + @Generated + public static MixedTypesCases fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryData model = null; + BinaryData literal = null; + BinaryData intProperty = null; + BinaryData booleanProperty = null; + List array = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("model".equals(fieldName)) { + model = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("literal".equals(fieldName)) { + literal = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("int".equals(fieldName)) { + intProperty + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("boolean".equals(fieldName)) { + booleanProperty + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("array".equals(fieldName)) { + array = reader.readArray(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } else { + reader.skipChildren(); + } + } + return new MixedTypesCases(model, literal, intProperty, booleanProperty, array); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringAndArrayCases.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringAndArrayCases.java new file mode 100644 index 00000000000..23fdda9c499 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringAndArrayCases.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The StringAndArrayCases model. + */ +@Immutable +public final class StringAndArrayCases implements JsonSerializable { + /* + * This should be receive/send the string variant + */ + @Generated + private final BinaryData string; + + /* + * This should be receive/send the array variant + */ + @Generated + private final BinaryData array; + + /** + * Creates an instance of StringAndArrayCases class. + * + * @param string the string value to set. + * @param array the array value to set. + */ + @Generated + public StringAndArrayCases(BinaryData string, BinaryData array) { + this.string = string; + this.array = array; + } + + /** + * Get the string property: This should be receive/send the string variant. + * + * @return the string value. + */ + @Generated + public BinaryData getString() { + return this.string; + } + + /** + * Get the array property: This should be receive/send the array variant. + * + * @return the array value. + */ + @Generated + public BinaryData getArray() { + return this.array; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeFieldName("string"); + this.string.writeTo(jsonWriter); + jsonWriter.writeFieldName("array"); + this.array.writeTo(jsonWriter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StringAndArrayCases from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StringAndArrayCases if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StringAndArrayCases. + */ + @Generated + public static StringAndArrayCases fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BinaryData string = null; + BinaryData array = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("string".equals(fieldName)) { + string = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("array".equals(fieldName)) { + array = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + return new StringAndArrayCases(string, array); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringExtensibleNamedUnion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringExtensibleNamedUnion.java new file mode 100644 index 00000000000..c4f2c185d8b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/StringExtensibleNamedUnion.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for StringExtensibleNamedUnion. + */ +public final class StringExtensibleNamedUnion extends ExpandableStringEnum { + /** + * Static value b for StringExtensibleNamedUnion. + */ + @Generated + public static final StringExtensibleNamedUnion OPTIONB = fromString("b"); + + /** + * Static value c for StringExtensibleNamedUnion. + */ + @Generated + public static final StringExtensibleNamedUnion C = fromString("c"); + + /** + * Creates a new instance of StringExtensibleNamedUnion value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public StringExtensibleNamedUnion() { + } + + /** + * Creates or finds a StringExtensibleNamedUnion from its string representation. + * + * @param name a name to look for. + * @return the corresponding StringExtensibleNamedUnion. + */ + @Generated + public static StringExtensibleNamedUnion fromString(String name) { + return fromString(name, StringExtensibleNamedUnion.class); + } + + /** + * Gets known StringExtensibleNamedUnion values. + * + * @return known StringExtensibleNamedUnion values. + */ + @Generated + public static Collection values() { + return values(StringExtensibleNamedUnion.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/package-info.java new file mode 100644 index 00000000000..7dd0ed7f5d4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Union. + * Describe scenarios for various combinations of unions. + * + */ +package type.union.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/package-info.java new file mode 100644 index 00000000000..5df10c6a5d3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/type/union/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Union. + * Describe scenarios for various combinations of unions. + * + */ +package type.union; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedAsyncClient.java new file mode 100644 index 00000000000..54243e275b1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedAsyncClient.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import versioning.added.implementation.AddedClientImpl; +import versioning.added.models.ModelV1; +import versioning.added.models.ModelV2; + +/** + * Initializes a new instance of the asynchronous AddedClient type. + */ +@ServiceClient(builder = AddedClientBuilder.class, isAsync = true) +public final class AddedAsyncClient { + @Generated + private final AddedClientImpl serviceClient; + + /** + * Initializes an instance of AddedAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AddedAsyncClient(AddedClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The v1 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param headerV2 The headerV2 parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> v1WithResponse(String headerV2, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.v1WithResponseAsync(headerV2, body, requestOptions); + } + + /** + * The v2 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> v2WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.v2WithResponseAsync(body, requestOptions); + } + + /** + * The v1 operation. + * + * @param headerV2 The headerV2 parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono v1(String headerV2, ModelV1 body) { + // Generated convenience method for v1WithResponse + RequestOptions requestOptions = new RequestOptions(); + return v1WithResponse(headerV2, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ModelV1.class)); + } + + /** + * The v2 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono v2(ModelV2 body) { + // Generated convenience method for v2WithResponse + RequestOptions requestOptions = new RequestOptions(); + return v2WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ModelV2.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClient.java new file mode 100644 index 00000000000..837a5b72a50 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClient.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import versioning.added.implementation.AddedClientImpl; +import versioning.added.models.ModelV1; +import versioning.added.models.ModelV2; + +/** + * Initializes a new instance of the synchronous AddedClient type. + */ +@ServiceClient(builder = AddedClientBuilder.class) +public final class AddedClient { + @Generated + private final AddedClientImpl serviceClient; + + /** + * Initializes an instance of AddedClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + AddedClient(AddedClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The v1 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param headerV2 The headerV2 parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response v1WithResponse(String headerV2, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.v1WithResponse(headerV2, body, requestOptions); + } + + /** + * The v2 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response v2WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.v2WithResponse(body, requestOptions); + } + + /** + * The v1 operation. + * + * @param headerV2 The headerV2 parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ModelV1 v1(String headerV2, ModelV1 body) { + // Generated convenience method for v1WithResponse + RequestOptions requestOptions = new RequestOptions(); + return v1WithResponse(headerV2, BinaryData.fromObject(body), requestOptions).getValue().toObject(ModelV1.class); + } + + /** + * The v2 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ModelV2 v2(ModelV2 body) { + // Generated convenience method for v2WithResponse + RequestOptions requestOptions = new RequestOptions(); + return v2WithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(ModelV2.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClientBuilder.java new file mode 100644 index 00000000000..a2268237c87 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedClientBuilder.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import versioning.added.implementation.AddedClientImpl; + +/** + * A builder for creating a new instance of the AddedClient type. + */ +@ServiceClientBuilder( + serviceClients = { + AddedClient.class, + InterfaceV2Client.class, + AddedAsyncClient.class, + InterfaceV2AsyncClient.class }) +public final class AddedClientBuilder implements HttpTrait, ConfigurationTrait, + EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("versioning-added.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the AddedClientBuilder. + */ + @Generated + public AddedClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AddedClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AddedClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AddedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AddedClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AddedClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AddedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AddedClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public AddedClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private AddedServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the AddedClientBuilder. + */ + @Generated + public AddedClientBuilder serviceVersion(AddedServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the AddedClientBuilder. + */ + @Generated + public AddedClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of AddedClientImpl with the provided parameters. + * + * @return an instance of AddedClientImpl. + */ + @Generated + private AddedClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + AddedServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : AddedServiceVersion.getLatest(); + AddedClientImpl client = new AddedClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of AddedAsyncClient class. + * + * @return an instance of AddedAsyncClient. + */ + @Generated + public AddedAsyncClient buildAsyncClient() { + return new AddedAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of InterfaceV2AsyncClient class. + * + * @return an instance of InterfaceV2AsyncClient. + */ + @Generated + public InterfaceV2AsyncClient buildInterfaceV2AsyncClient() { + return new InterfaceV2AsyncClient(buildInnerClient().getInterfaceV2s()); + } + + /** + * Builds an instance of AddedClient class. + * + * @return an instance of AddedClient. + */ + @Generated + public AddedClient buildClient() { + return new AddedClient(buildInnerClient()); + } + + /** + * Builds an instance of InterfaceV2Client class. + * + * @return an instance of InterfaceV2Client. + */ + @Generated + public InterfaceV2Client buildInterfaceV2Client() { + return new InterfaceV2Client(buildInnerClient().getInterfaceV2s()); + } + + private static final ClientLogger LOGGER = new ClientLogger(AddedClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedServiceVersion.java new file mode 100644 index 00000000000..88c3c16cca2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/AddedServiceVersion.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of AddedClient. + */ +public enum AddedServiceVersion implements ServiceVersion { + /** + * Enum value v1. + */ + V1("v1"), + + /** + * Enum value v2. + */ + V2("v2"); + + private final String version; + + AddedServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link AddedServiceVersion}. + */ + public static AddedServiceVersion getLatest() { + return V2; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2AsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2AsyncClient.java new file mode 100644 index 00000000000..006a4e8c4df --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2AsyncClient.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import versioning.added.implementation.InterfaceV2sImpl; +import versioning.added.models.ModelV2; + +/** + * Initializes a new instance of the asynchronous AddedClient type. + */ +@ServiceClient(builder = AddedClientBuilder.class, isAsync = true) +public final class InterfaceV2AsyncClient { + @Generated + private final InterfaceV2sImpl serviceClient; + + /** + * Initializes an instance of InterfaceV2AsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + InterfaceV2AsyncClient(InterfaceV2sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The v2InInterface operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> v2InInterfaceWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.v2InInterfaceWithResponseAsync(body, requestOptions); + } + + /** + * The v2InInterface operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono v2InInterface(ModelV2 body) { + // Generated convenience method for v2InInterfaceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return v2InInterfaceWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ModelV2.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2Client.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2Client.java new file mode 100644 index 00000000000..7414b02dc3b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/InterfaceV2Client.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import versioning.added.implementation.InterfaceV2sImpl; +import versioning.added.models.ModelV2; + +/** + * Initializes a new instance of the synchronous AddedClient type. + */ +@ServiceClient(builder = AddedClientBuilder.class) +public final class InterfaceV2Client { + @Generated + private final InterfaceV2sImpl serviceClient; + + /** + * Initializes an instance of InterfaceV2Client class. + * + * @param serviceClient the service client implementation. + */ + @Generated + InterfaceV2Client(InterfaceV2sImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The v2InInterface operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response v2InInterfaceWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.v2InInterfaceWithResponse(body, requestOptions); + } + + /** + * The v2InInterface operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ModelV2 v2InInterface(ModelV2 body) { + // Generated convenience method for v2InInterfaceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return v2InInterfaceWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(ModelV2.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/AddedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/AddedClientImpl.java new file mode 100644 index 00000000000..496d8ffc241 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/AddedClientImpl.java @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; +import versioning.added.AddedServiceVersion; + +/** + * Initializes a new instance of the AddedClient type. + */ +public final class AddedClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final AddedClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final AddedServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public AddedServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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 InterfaceV2sImpl object to access its operations. + */ + private final InterfaceV2sImpl interfaceV2s; + + /** + * Gets the InterfaceV2sImpl object to access its operations. + * + * @return the InterfaceV2sImpl object. + */ + public InterfaceV2sImpl getInterfaceV2s() { + return this.interfaceV2s; + } + + /** + * Initializes an instance of AddedClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public AddedClientImpl(String endpoint, AddedServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of AddedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public AddedClientImpl(HttpPipeline httpPipeline, String endpoint, AddedServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of AddedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public AddedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + AddedServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.interfaceV2s = new InterfaceV2sImpl(this); + this.service = RestProxy.create(AddedClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for AddedClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}/versioning/added/api-version:{version}") + @ServiceInterface(name = "AddedClient") + public interface AddedClientService { + @Post("/v1") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> v1(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @HeaderParam("header-v2") String headerV2, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/v1") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response v1Sync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @HeaderParam("header-v2") String headerV2, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/v2") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> v2(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/v2") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response v2Sync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The v1 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param headerV2 The headerV2 parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> v1WithResponseAsync(String headerV2, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.v1(this.getEndpoint(), this.getServiceVersion().getVersion(), + headerV2, contentType, accept, body, requestOptions, context)); + } + + /** + * The v1 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param headerV2 The headerV2 parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response v1WithResponse(String headerV2, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.v1Sync(this.getEndpoint(), this.getServiceVersion().getVersion(), headerV2, contentType, accept, + body, requestOptions, Context.NONE); + } + + /** + * The v2 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> v2WithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.v2(this.getEndpoint(), this.getServiceVersion().getVersion(), + contentType, accept, body, requestOptions, context)); + } + + /** + * The v2 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response v2WithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.v2Sync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, body, + requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/InterfaceV2sImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/InterfaceV2sImpl.java new file mode 100644 index 00000000000..986cd873e9c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/InterfaceV2sImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; +import versioning.added.AddedServiceVersion; + +/** + * An instance of this class provides access to all the operations defined in InterfaceV2s. + */ +public final class InterfaceV2sImpl { + /** + * The proxy service used to perform REST calls. + */ + private final InterfaceV2sService service; + + /** + * The service client containing this operation class. + */ + private final AddedClientImpl client; + + /** + * Initializes an instance of InterfaceV2sImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InterfaceV2sImpl(AddedClientImpl client) { + this.service + = RestProxy.create(InterfaceV2sService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public AddedServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for AddedClientInterfaceV2s to be used by the proxy service to perform + * REST calls. + */ + @Host("{endpoint}/versioning/added/api-version:{version}") + @ServiceInterface(name = "AddedClientInterfaceV2s") + public interface InterfaceV2sService { + @Post("/interface-v2/v2") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> v2InInterface(@HostParam("endpoint") String endpoint, + @HostParam("version") String version, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/interface-v2/v2") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response v2InInterfaceSync(@HostParam("endpoint") String endpoint, + @HostParam("version") String version, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The v2InInterface operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> v2InInterfaceWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.v2InInterface(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context)); + } + + /** + * The v2InInterface operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response v2InInterfaceWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.v2InInterfaceSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + contentType, accept, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/package-info.java new file mode 100644 index 00000000000..9e36e96b627 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Added. + * Test for the `@added` decorator. + * + */ +package versioning.added.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV1.java new file mode 100644 index 00000000000..13616b3bfda --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV1.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added.models; + +/** + * Defines values for EnumV1. + */ +public enum EnumV1 { + /** + * Enum value enumMemberV1. + */ + ENUM_MEMBER_V1("enumMemberV1"), + + /** + * Enum value enumMemberV2. + */ + ENUM_MEMBER_V2("enumMemberV2"); + + /** + * The actual serialized value for a EnumV1 instance. + */ + private final String value; + + EnumV1(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EnumV1 instance. + * + * @param value the serialized value to parse. + * @return the parsed EnumV1 object, or null if unable to parse. + */ + public static EnumV1 fromString(String value) { + if (value == null) { + return null; + } + EnumV1[] items = EnumV1.values(); + for (EnumV1 item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV2.java new file mode 100644 index 00000000000..e26df1b7793 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/EnumV2.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added.models; + +/** + * Defines values for EnumV2. + */ +public enum EnumV2 { + /** + * Enum value enumMember. + */ + ENUM_MEMBER("enumMember"); + + /** + * The actual serialized value for a EnumV2 instance. + */ + private final String value; + + EnumV2(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EnumV2 instance. + * + * @param value the serialized value to parse. + * @return the parsed EnumV2 object, or null if unable to parse. + */ + public static EnumV2 fromString(String value) { + if (value == null) { + return null; + } + EnumV2[] items = EnumV2.values(); + for (EnumV2 item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV1.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV1.java new file mode 100644 index 00000000000..a2fd46728ac --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV1.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ModelV1 model. + */ +@Immutable +public final class ModelV1 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final String prop; + + /* + * The enumProp property. + */ + @Generated + private final EnumV1 enumProp; + + /* + * The unionProp property. + */ + @Generated + private final BinaryData unionProp; + + /** + * Creates an instance of ModelV1 class. + * + * @param prop the prop value to set. + * @param enumProp the enumProp value to set. + * @param unionProp the unionProp value to set. + */ + @Generated + public ModelV1(String prop, EnumV1 enumProp, BinaryData unionProp) { + this.prop = prop; + this.enumProp = enumProp; + this.unionProp = unionProp; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public String getProp() { + return this.prop; + } + + /** + * Get the enumProp property: The enumProp property. + * + * @return the enumProp value. + */ + @Generated + public EnumV1 getEnumProp() { + return this.enumProp; + } + + /** + * Get the unionProp property: The unionProp property. + * + * @return the unionProp value. + */ + @Generated + public BinaryData getUnionProp() { + return this.unionProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop); + jsonWriter.writeStringField("enumProp", this.enumProp == null ? null : this.enumProp.toString()); + jsonWriter.writeFieldName("unionProp"); + this.unionProp.writeTo(jsonWriter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ModelV1 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ModelV1 if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ModelV1. + */ + @Generated + public static ModelV1 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String prop = null; + EnumV1 enumProp = null; + BinaryData unionProp = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = reader.getString(); + } else if ("enumProp".equals(fieldName)) { + enumProp = EnumV1.fromString(reader.getString()); + } else if ("unionProp".equals(fieldName)) { + unionProp = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + return new ModelV1(prop, enumProp, unionProp); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV2.java new file mode 100644 index 00000000000..08cfe783489 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/ModelV2.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ModelV2 model. + */ +@Immutable +public final class ModelV2 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final String prop; + + /* + * The enumProp property. + */ + @Generated + private final EnumV2 enumProp; + + /* + * The unionProp property. + */ + @Generated + private final BinaryData unionProp; + + /** + * Creates an instance of ModelV2 class. + * + * @param prop the prop value to set. + * @param enumProp the enumProp value to set. + * @param unionProp the unionProp value to set. + */ + @Generated + public ModelV2(String prop, EnumV2 enumProp, BinaryData unionProp) { + this.prop = prop; + this.enumProp = enumProp; + this.unionProp = unionProp; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public String getProp() { + return this.prop; + } + + /** + * Get the enumProp property: The enumProp property. + * + * @return the enumProp value. + */ + @Generated + public EnumV2 getEnumProp() { + return this.enumProp; + } + + /** + * Get the unionProp property: The unionProp property. + * + * @return the unionProp value. + */ + @Generated + public BinaryData getUnionProp() { + return this.unionProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop); + jsonWriter.writeStringField("enumProp", this.enumProp == null ? null : this.enumProp.toString()); + jsonWriter.writeFieldName("unionProp"); + this.unionProp.writeTo(jsonWriter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ModelV2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ModelV2 if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ModelV2. + */ + @Generated + public static ModelV2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String prop = null; + EnumV2 enumProp = null; + BinaryData unionProp = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = reader.getString(); + } else if ("enumProp".equals(fieldName)) { + enumProp = EnumV2.fromString(reader.getString()); + } else if ("unionProp".equals(fieldName)) { + unionProp = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + return new ModelV2(prop, enumProp, unionProp); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/package-info.java new file mode 100644 index 00000000000..a62e257ebff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Added. + * Test for the `@added` decorator. + * + */ +package versioning.added.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/package-info.java new file mode 100644 index 00000000000..ad44d5bef04 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/added/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Added. + * Test for the `@added` decorator. + * + */ +package versioning.added; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalAsyncClient.java new file mode 100644 index 00000000000..96d61d6a017 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalAsyncClient.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.madeoptional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import versioning.madeoptional.implementation.MadeOptionalClientImpl; +import versioning.madeoptional.models.TestModel; + +/** + * Initializes a new instance of the asynchronous MadeOptionalClient type. + */ +@ServiceClient(builder = MadeOptionalClientBuilder.class, isAsync = true) +public final class MadeOptionalAsyncClient { + @Generated + private final MadeOptionalClientImpl serviceClient; + + /** + * Initializes an instance of MadeOptionalAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MadeOptionalAsyncClient(MadeOptionalClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The test operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
paramStringNoThe param parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> testWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.testWithResponseAsync(body, requestOptions); + } + + /** + * The test operation. + * + * @param body The body parameter. + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono test(TestModel body, String param) { + // Generated convenience method for testWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (param != null) { + requestOptions.addQueryParam("param", param, false); + } + return testWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestModel.class)); + } + + /** + * The test operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono test(TestModel body) { + // Generated convenience method for testWithResponse + RequestOptions requestOptions = new RequestOptions(); + return testWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClient.java new file mode 100644 index 00000000000..ef8c7ccc333 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClient.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.madeoptional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import versioning.madeoptional.implementation.MadeOptionalClientImpl; +import versioning.madeoptional.models.TestModel; + +/** + * Initializes a new instance of the synchronous MadeOptionalClient type. + */ +@ServiceClient(builder = MadeOptionalClientBuilder.class) +public final class MadeOptionalClient { + @Generated + private final MadeOptionalClientImpl serviceClient; + + /** + * Initializes an instance of MadeOptionalClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + MadeOptionalClient(MadeOptionalClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The test operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
paramStringNoThe param parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.testWithResponse(body, requestOptions); + } + + /** + * The test operation. + * + * @param body The body parameter. + * @param param The param parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestModel test(TestModel body, String param) { + // Generated convenience method for testWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (param != null) { + requestOptions.addQueryParam("param", param, false); + } + return testWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(TestModel.class); + } + + /** + * The test operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestModel test(TestModel body) { + // Generated convenience method for testWithResponse + RequestOptions requestOptions = new RequestOptions(); + return testWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(TestModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClientBuilder.java new file mode 100644 index 00000000000..e9b490d5c16 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.madeoptional; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import versioning.madeoptional.implementation.MadeOptionalClientImpl; + +/** + * A builder for creating a new instance of the MadeOptionalClient type. + */ +@ServiceClientBuilder(serviceClients = { MadeOptionalClient.class, MadeOptionalAsyncClient.class }) +public final class MadeOptionalClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("versioning-madeoptional.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the MadeOptionalClientBuilder. + */ + @Generated + public MadeOptionalClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MadeOptionalClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MadeOptionalClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MadeOptionalClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MadeOptionalClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MadeOptionalClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MadeOptionalClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MadeOptionalClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public MadeOptionalClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private MadeOptionalServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the MadeOptionalClientBuilder. + */ + @Generated + public MadeOptionalClientBuilder serviceVersion(MadeOptionalServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the MadeOptionalClientBuilder. + */ + @Generated + public MadeOptionalClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of MadeOptionalClientImpl with the provided parameters. + * + * @return an instance of MadeOptionalClientImpl. + */ + @Generated + private MadeOptionalClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + MadeOptionalServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : MadeOptionalServiceVersion.getLatest(); + MadeOptionalClientImpl client = new MadeOptionalClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of MadeOptionalAsyncClient class. + * + * @return an instance of MadeOptionalAsyncClient. + */ + @Generated + public MadeOptionalAsyncClient buildAsyncClient() { + return new MadeOptionalAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of MadeOptionalClient class. + * + * @return an instance of MadeOptionalClient. + */ + @Generated + public MadeOptionalClient buildClient() { + return new MadeOptionalClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(MadeOptionalClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalServiceVersion.java new file mode 100644 index 00000000000..a533c131e89 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/MadeOptionalServiceVersion.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.madeoptional; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of MadeOptionalClient. + */ +public enum MadeOptionalServiceVersion implements ServiceVersion { + /** + * Enum value v1. + */ + V1("v1"), + + /** + * Enum value v2. + */ + V2("v2"); + + private final String version; + + MadeOptionalServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link MadeOptionalServiceVersion}. + */ + public static MadeOptionalServiceVersion getLatest() { + return V2; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java new file mode 100644 index 00000000000..3a3bfba439c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.madeoptional.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; +import versioning.madeoptional.MadeOptionalServiceVersion; + +/** + * Initializes a new instance of the MadeOptionalClient type. + */ +public final class MadeOptionalClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final MadeOptionalClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final MadeOptionalServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public MadeOptionalServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of MadeOptionalClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public MadeOptionalClientImpl(String endpoint, MadeOptionalServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of MadeOptionalClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public MadeOptionalClientImpl(HttpPipeline httpPipeline, String endpoint, + MadeOptionalServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of MadeOptionalClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public MadeOptionalClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + MadeOptionalServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service + = RestProxy.create(MadeOptionalClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for MadeOptionalClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}/versioning/made-optional/api-version:{version}") + @ServiceInterface(name = "MadeOptionalClient") + public interface MadeOptionalClientService { + @Post("/test") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> test(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/test") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response testSync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The test operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
paramStringNoThe param parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> testWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.test(this.getEndpoint(), this.getServiceVersion().getVersion(), + contentType, accept, body, requestOptions, context)); + } + + /** + * The test operation. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
paramStringNoThe param parameter
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.testSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, body, + requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/package-info.java new file mode 100644 index 00000000000..4bce0955ce5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for MadeOptional. + * Test for the `@madeOptional` decorator. + * + */ +package versioning.madeoptional.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/TestModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/TestModel.java new file mode 100644 index 00000000000..e7bf16492ca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/TestModel.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.madeoptional.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The TestModel model. + */ +@Fluent +public final class TestModel implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final String prop; + + /* + * The changedProp property. + */ + @Generated + private String changedProp; + + /** + * Creates an instance of TestModel class. + * + * @param prop the prop value to set. + */ + @Generated + public TestModel(String prop) { + this.prop = prop; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public String getProp() { + return this.prop; + } + + /** + * Get the changedProp property: The changedProp property. + * + * @return the changedProp value. + */ + @Generated + public String getChangedProp() { + return this.changedProp; + } + + /** + * Set the changedProp property: The changedProp property. + * + * @param changedProp the changedProp value to set. + * @return the TestModel object itself. + */ + @Generated + public TestModel setChangedProp(String changedProp) { + this.changedProp = changedProp; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop); + jsonWriter.writeStringField("changedProp", this.changedProp); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TestModel. + */ + @Generated + public static TestModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String prop = null; + String changedProp = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = reader.getString(); + } else if ("changedProp".equals(fieldName)) { + changedProp = reader.getString(); + } else { + reader.skipChildren(); + } + } + TestModel deserializedTestModel = new TestModel(prop); + deserializedTestModel.changedProp = changedProp; + + return deserializedTestModel; + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/package-info.java new file mode 100644 index 00000000000..bc77f60eaec --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for MadeOptional. + * Test for the `@madeOptional` decorator. + * + */ +package versioning.madeoptional.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/package-info.java new file mode 100644 index 00000000000..8fef006f20b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/madeoptional/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for MadeOptional. + * Test for the `@madeOptional` decorator. + * + */ +package versioning.madeoptional; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedAsyncClient.java new file mode 100644 index 00000000000..96e804cb0f2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedAsyncClient.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.removed; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import versioning.removed.implementation.RemovedClientImpl; +import versioning.removed.models.ModelV2; +import versioning.removed.models.ModelV3; + +/** + * Initializes a new instance of the asynchronous RemovedClient type. + */ +@ServiceClient(builder = RemovedClientBuilder.class, isAsync = true) +public final class RemovedAsyncClient { + @Generated + private final RemovedClientImpl serviceClient; + + /** + * Initializes an instance of RemovedAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RemovedAsyncClient(RemovedClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The v2 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> v2WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.v2WithResponseAsync(body, requestOptions); + } + + /** + * This operation will pass different paths and different request bodies based on different versions. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> modelV3WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.modelV3WithResponseAsync(body, requestOptions); + } + + /** + * The v2 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono v2(ModelV2 body) { + // Generated convenience method for v2WithResponse + RequestOptions requestOptions = new RequestOptions(); + return v2WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ModelV2.class)); + } + + /** + * This operation will pass different paths and different request bodies based on different versions. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono modelV3(ModelV3 body) { + // Generated convenience method for modelV3WithResponse + RequestOptions requestOptions = new RequestOptions(); + return modelV3WithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ModelV3.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClient.java new file mode 100644 index 00000000000..1c973172360 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClient.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.removed; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import versioning.removed.implementation.RemovedClientImpl; +import versioning.removed.models.ModelV2; +import versioning.removed.models.ModelV3; + +/** + * Initializes a new instance of the synchronous RemovedClient type. + */ +@ServiceClient(builder = RemovedClientBuilder.class) +public final class RemovedClient { + @Generated + private final RemovedClientImpl serviceClient; + + /** + * Initializes an instance of RemovedClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RemovedClient(RemovedClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The v2 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response v2WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.v2WithResponse(body, requestOptions); + } + + /** + * This operation will pass different paths and different request bodies based on different versions. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response modelV3WithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.modelV3WithResponse(body, requestOptions); + } + + /** + * The v2 operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ModelV2 v2(ModelV2 body) { + // Generated convenience method for v2WithResponse + RequestOptions requestOptions = new RequestOptions(); + return v2WithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(ModelV2.class); + } + + /** + * This operation will pass different paths and different request bodies based on different versions. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ModelV3 modelV3(ModelV3 body) { + // Generated convenience method for modelV3WithResponse + RequestOptions requestOptions = new RequestOptions(); + return modelV3WithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(ModelV3.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClientBuilder.java new file mode 100644 index 00000000000..26d588337a1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedClientBuilder.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.removed; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import versioning.removed.implementation.RemovedClientImpl; + +/** + * A builder for creating a new instance of the RemovedClient type. + */ +@ServiceClientBuilder(serviceClients = { RemovedClient.class, RemovedAsyncClient.class }) +public final class RemovedClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("versioning-removed.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the RemovedClientBuilder. + */ + @Generated + public RemovedClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RemovedClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RemovedClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RemovedClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RemovedClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RemovedClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RemovedClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RemovedClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RemovedClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private RemovedServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the RemovedClientBuilder. + */ + @Generated + public RemovedClientBuilder serviceVersion(RemovedServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the RemovedClientBuilder. + */ + @Generated + public RemovedClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of RemovedClientImpl with the provided parameters. + * + * @return an instance of RemovedClientImpl. + */ + @Generated + private RemovedClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + RemovedServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : RemovedServiceVersion.getLatest(); + RemovedClientImpl client = new RemovedClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(), + this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of RemovedAsyncClient class. + * + * @return an instance of RemovedAsyncClient. + */ + @Generated + public RemovedAsyncClient buildAsyncClient() { + return new RemovedAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of RemovedClient class. + * + * @return an instance of RemovedClient. + */ + @Generated + public RemovedClient buildClient() { + return new RemovedClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(RemovedClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedServiceVersion.java new file mode 100644 index 00000000000..58346a683f5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/RemovedServiceVersion.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.removed; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of RemovedClient. + */ +public enum RemovedServiceVersion implements ServiceVersion { + /** + * Enum value v1. + */ + V1("v1"), + + /** + * Enum value v2preview. + */ + V2PREVIEW("v2preview"), + + /** + * Enum value v2. + */ + V2("v2"); + + private final String version; + + RemovedServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link RemovedServiceVersion}. + */ + public static RemovedServiceVersion getLatest() { + return V2; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/RemovedClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/RemovedClientImpl.java new file mode 100644 index 00000000000..1ed0e073f48 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/RemovedClientImpl.java @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.removed.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; +import versioning.removed.RemovedServiceVersion; + +/** + * Initializes a new instance of the RemovedClient type. + */ +public final class RemovedClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RemovedClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final RemovedServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public RemovedServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of RemovedClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public RemovedClientImpl(String endpoint, RemovedServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of RemovedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public RemovedClientImpl(HttpPipeline httpPipeline, String endpoint, RemovedServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of RemovedClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public RemovedClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + RemovedServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(RemovedClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for RemovedClient to be used by the proxy service to perform REST calls. + */ + @Host("{endpoint}/versioning/removed/api-version:{version}") + @ServiceInterface(name = "RemovedClient") + public interface RemovedClientService { + @Post("/v2") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> v2(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/v2") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response v2Sync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/v3") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> modelV3(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/v3") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response modelV3Sync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The v2 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> v2WithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.v2(this.getEndpoint(), this.getServiceVersion().getVersion(), + contentType, accept, body, requestOptions, context)); + } + + /** + * The v2 operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     enumProp: String(enumMemberV2) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response v2WithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.v2Sync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, body, + requestOptions, Context.NONE); + } + + /** + * This operation will pass different paths and different request bodies based on different versions. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> modelV3WithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.modelV3(this.getEndpoint(), + this.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context)); + } + + /** + * This operation will pass different paths and different request bodies based on different versions. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     enumProp: String(enumMemberV1/enumMemberV2Preview) (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response modelV3WithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.modelV3Sync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, body, + requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/package-info.java new file mode 100644 index 00000000000..8030c5a13e8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for Removed. + * Test for the `@removed` decorator. + * + */ +package versioning.removed.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV2.java new file mode 100644 index 00000000000..ad9b193be64 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV2.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.removed.models; + +/** + * Defines values for EnumV2. + */ +public enum EnumV2 { + /** + * Enum value enumMemberV2. + */ + ENUM_MEMBER_V2("enumMemberV2"); + + /** + * The actual serialized value for a EnumV2 instance. + */ + private final String value; + + EnumV2(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EnumV2 instance. + * + * @param value the serialized value to parse. + * @return the parsed EnumV2 object, or null if unable to parse. + */ + public static EnumV2 fromString(String value) { + if (value == null) { + return null; + } + EnumV2[] items = EnumV2.values(); + for (EnumV2 item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV3.java new file mode 100644 index 00000000000..1d20a268df3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/EnumV3.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.removed.models; + +/** + * Defines values for EnumV3. + */ +public enum EnumV3 { + /** + * Enum value enumMemberV1. + */ + ENUM_MEMBER_V1("enumMemberV1"), + + /** + * Enum value enumMemberV2Preview. + */ + ENUM_MEMBER_V2PREVIEW("enumMemberV2Preview"); + + /** + * The actual serialized value for a EnumV3 instance. + */ + private final String value; + + EnumV3(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EnumV3 instance. + * + * @param value the serialized value to parse. + * @return the parsed EnumV3 object, or null if unable to parse. + */ + public static EnumV3 fromString(String value) { + if (value == null) { + return null; + } + EnumV3[] items = EnumV3.values(); + for (EnumV3 item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV2.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV2.java new file mode 100644 index 00000000000..beac0a213da --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV2.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.removed.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ModelV2 model. + */ +@Immutable +public final class ModelV2 implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final String prop; + + /* + * The enumProp property. + */ + @Generated + private final EnumV2 enumProp; + + /* + * The unionProp property. + */ + @Generated + private final BinaryData unionProp; + + /** + * Creates an instance of ModelV2 class. + * + * @param prop the prop value to set. + * @param enumProp the enumProp value to set. + * @param unionProp the unionProp value to set. + */ + @Generated + public ModelV2(String prop, EnumV2 enumProp, BinaryData unionProp) { + this.prop = prop; + this.enumProp = enumProp; + this.unionProp = unionProp; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public String getProp() { + return this.prop; + } + + /** + * Get the enumProp property: The enumProp property. + * + * @return the enumProp value. + */ + @Generated + public EnumV2 getEnumProp() { + return this.enumProp; + } + + /** + * Get the unionProp property: The unionProp property. + * + * @return the unionProp value. + */ + @Generated + public BinaryData getUnionProp() { + return this.unionProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop); + jsonWriter.writeStringField("enumProp", this.enumProp == null ? null : this.enumProp.toString()); + jsonWriter.writeFieldName("unionProp"); + this.unionProp.writeTo(jsonWriter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ModelV2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ModelV2 if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ModelV2. + */ + @Generated + public static ModelV2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String prop = null; + EnumV2 enumProp = null; + BinaryData unionProp = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = reader.getString(); + } else if ("enumProp".equals(fieldName)) { + enumProp = EnumV2.fromString(reader.getString()); + } else if ("unionProp".equals(fieldName)) { + unionProp = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + return new ModelV2(prop, enumProp, unionProp); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV3.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV3.java new file mode 100644 index 00000000000..bb624e06a68 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/ModelV3.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.removed.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ModelV3 model. + */ +@Immutable +public final class ModelV3 implements JsonSerializable { + /* + * The id property. + */ + @Generated + private final String id; + + /* + * The enumProp property. + */ + @Generated + private final EnumV3 enumProp; + + /** + * Creates an instance of ModelV3 class. + * + * @param id the id value to set. + * @param enumProp the enumProp value to set. + */ + @Generated + public ModelV3(String id, EnumV3 enumProp) { + this.id = id; + this.enumProp = enumProp; + } + + /** + * Get the id property: The id property. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the enumProp property: The enumProp property. + * + * @return the enumProp value. + */ + @Generated + public EnumV3 getEnumProp() { + return this.enumProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("enumProp", this.enumProp == null ? null : this.enumProp.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ModelV3 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ModelV3 if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ModelV3. + */ + @Generated + public static ModelV3 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + EnumV3 enumProp = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("enumProp".equals(fieldName)) { + enumProp = EnumV3.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + return new ModelV3(id, enumProp); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/package-info.java new file mode 100644 index 00000000000..bf1d0bf094b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for Removed. + * Test for the `@removed` decorator. + * + */ +package versioning.removed.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/package-info.java new file mode 100644 index 00000000000..21d69c27367 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/removed/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for Removed. + * Test for the `@removed` decorator. + * + */ +package versioning.removed; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceAsyncClient.java new file mode 100644 index 00000000000..05559102f22 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceAsyncClient.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.renamedfrom; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import versioning.renamedfrom.implementation.NewInterfacesImpl; +import versioning.renamedfrom.models.NewModel; + +/** + * Initializes a new instance of the asynchronous RenamedFromClient type. + */ +@ServiceClient(builder = RenamedFromClientBuilder.class, isAsync = true) +public final class NewInterfaceAsyncClient { + @Generated + private final NewInterfacesImpl serviceClient; + + /** + * Initializes an instance of NewInterfaceAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NewInterfaceAsyncClient(NewInterfacesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The newOpInNewInterface operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> newOpInNewInterfaceWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.newOpInNewInterfaceWithResponseAsync(body, requestOptions); + } + + /** + * The newOpInNewInterface operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono newOpInNewInterface(NewModel body) { + // Generated convenience method for newOpInNewInterfaceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return newOpInNewInterfaceWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(NewModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceClient.java new file mode 100644 index 00000000000..e5c384153a5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/NewInterfaceClient.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.renamedfrom; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import versioning.renamedfrom.implementation.NewInterfacesImpl; +import versioning.renamedfrom.models.NewModel; + +/** + * Initializes a new instance of the synchronous RenamedFromClient type. + */ +@ServiceClient(builder = RenamedFromClientBuilder.class) +public final class NewInterfaceClient { + @Generated + private final NewInterfacesImpl serviceClient; + + /** + * Initializes an instance of NewInterfaceClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + NewInterfaceClient(NewInterfacesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The newOpInNewInterface operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response newOpInNewInterfaceWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.newOpInNewInterfaceWithResponse(body, requestOptions); + } + + /** + * The newOpInNewInterface operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public NewModel newOpInNewInterface(NewModel body) { + // Generated convenience method for newOpInNewInterfaceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return newOpInNewInterfaceWithResponse(BinaryData.fromObject(body), requestOptions).getValue() + .toObject(NewModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromAsyncClient.java new file mode 100644 index 00000000000..488df96fc82 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromAsyncClient.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.renamedfrom; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import versioning.renamedfrom.implementation.RenamedFromClientImpl; +import versioning.renamedfrom.models.NewModel; + +/** + * Initializes a new instance of the asynchronous RenamedFromClient type. + */ +@ServiceClient(builder = RenamedFromClientBuilder.class, isAsync = true) +public final class RenamedFromAsyncClient { + @Generated + private final RenamedFromClientImpl serviceClient; + + /** + * Initializes an instance of RenamedFromAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RenamedFromAsyncClient(RenamedFromClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The newOp operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param newQuery The newQuery parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> newOpWithResponse(String newQuery, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.newOpWithResponseAsync(newQuery, body, requestOptions); + } + + /** + * The newOp operation. + * + * @param newQuery The newQuery parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono newOp(String newQuery, NewModel body) { + // Generated convenience method for newOpWithResponse + RequestOptions requestOptions = new RequestOptions(); + return newOpWithResponse(newQuery, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(NewModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClient.java new file mode 100644 index 00000000000..2f292a1ba34 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClient.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.renamedfrom; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import versioning.renamedfrom.implementation.RenamedFromClientImpl; +import versioning.renamedfrom.models.NewModel; + +/** + * Initializes a new instance of the synchronous RenamedFromClient type. + */ +@ServiceClient(builder = RenamedFromClientBuilder.class) +public final class RenamedFromClient { + @Generated + private final RenamedFromClientImpl serviceClient; + + /** + * Initializes an instance of RenamedFromClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + RenamedFromClient(RenamedFromClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The newOp operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param newQuery The newQuery parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response newOpWithResponse(String newQuery, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.newOpWithResponse(newQuery, body, requestOptions); + } + + /** + * The newOp operation. + * + * @param newQuery The newQuery parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public NewModel newOp(String newQuery, NewModel body) { + // Generated convenience method for newOpWithResponse + RequestOptions requestOptions = new RequestOptions(); + return newOpWithResponse(newQuery, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(NewModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClientBuilder.java new file mode 100644 index 00000000000..144a97dd4a3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromClientBuilder.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.renamedfrom; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import versioning.renamedfrom.implementation.RenamedFromClientImpl; + +/** + * A builder for creating a new instance of the RenamedFromClient type. + */ +@ServiceClientBuilder( + serviceClients = { + RenamedFromClient.class, + NewInterfaceClient.class, + RenamedFromAsyncClient.class, + NewInterfaceAsyncClient.class }) +public final class RenamedFromClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("versioning-renamedfrom.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the RenamedFromClientBuilder. + */ + @Generated + public RenamedFromClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedFromClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedFromClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedFromClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedFromClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedFromClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedFromClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedFromClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public RenamedFromClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private RenamedFromServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the RenamedFromClientBuilder. + */ + @Generated + public RenamedFromClientBuilder serviceVersion(RenamedFromServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the RenamedFromClientBuilder. + */ + @Generated + public RenamedFromClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of RenamedFromClientImpl with the provided parameters. + * + * @return an instance of RenamedFromClientImpl. + */ + @Generated + private RenamedFromClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + RenamedFromServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : RenamedFromServiceVersion.getLatest(); + RenamedFromClientImpl client = new RenamedFromClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of RenamedFromAsyncClient class. + * + * @return an instance of RenamedFromAsyncClient. + */ + @Generated + public RenamedFromAsyncClient buildAsyncClient() { + return new RenamedFromAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of NewInterfaceAsyncClient class. + * + * @return an instance of NewInterfaceAsyncClient. + */ + @Generated + public NewInterfaceAsyncClient buildNewInterfaceAsyncClient() { + return new NewInterfaceAsyncClient(buildInnerClient().getNewInterfaces()); + } + + /** + * Builds an instance of RenamedFromClient class. + * + * @return an instance of RenamedFromClient. + */ + @Generated + public RenamedFromClient buildClient() { + return new RenamedFromClient(buildInnerClient()); + } + + /** + * Builds an instance of NewInterfaceClient class. + * + * @return an instance of NewInterfaceClient. + */ + @Generated + public NewInterfaceClient buildNewInterfaceClient() { + return new NewInterfaceClient(buildInnerClient().getNewInterfaces()); + } + + private static final ClientLogger LOGGER = new ClientLogger(RenamedFromClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromServiceVersion.java new file mode 100644 index 00000000000..4d282157ff5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/RenamedFromServiceVersion.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.renamedfrom; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of RenamedFromClient. + */ +public enum RenamedFromServiceVersion implements ServiceVersion { + /** + * Enum value v1. + */ + V1("v1"), + + /** + * Enum value v2. + */ + V2("v2"); + + private final String version; + + RenamedFromServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link RenamedFromServiceVersion}. + */ + public static RenamedFromServiceVersion getLatest() { + return V2; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/NewInterfacesImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/NewInterfacesImpl.java new file mode 100644 index 00000000000..1f53d9600b3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/NewInterfacesImpl.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.renamedfrom.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +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 reactor.core.publisher.Mono; +import versioning.renamedfrom.RenamedFromServiceVersion; + +/** + * An instance of this class provides access to all the operations defined in NewInterfaces. + */ +public final class NewInterfacesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final NewInterfacesService service; + + /** + * The service client containing this operation class. + */ + private final RenamedFromClientImpl client; + + /** + * Initializes an instance of NewInterfacesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NewInterfacesImpl(RenamedFromClientImpl client) { + this.service + = RestProxy.create(NewInterfacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public RenamedFromServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for RenamedFromClientNewInterfaces to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}/versioning/renamed-from/api-version:{version}") + @ServiceInterface(name = "RenamedFromClientNewInterfaces") + public interface NewInterfacesService { + @Post("/interface/test") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> newOpInNewInterface(@HostParam("endpoint") String endpoint, + @HostParam("version") String version, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/interface/test") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response newOpInNewInterfaceSync(@HostParam("endpoint") String endpoint, + @HostParam("version") String version, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The newOpInNewInterface operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> newOpInNewInterfaceWithResponseAsync(BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.newOpInNewInterface(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context)); + } + + /** + * The newOpInNewInterface operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response newOpInNewInterfaceWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.newOpInNewInterfaceSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + contentType, accept, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java new file mode 100644 index 00000000000..c2c0fcac86a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.renamedfrom.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; +import versioning.renamedfrom.RenamedFromServiceVersion; + +/** + * Initializes a new instance of the RenamedFromClient type. + */ +public final class RenamedFromClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final RenamedFromClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final RenamedFromServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public RenamedFromServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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 NewInterfacesImpl object to access its operations. + */ + private final NewInterfacesImpl newInterfaces; + + /** + * Gets the NewInterfacesImpl object to access its operations. + * + * @return the NewInterfacesImpl object. + */ + public NewInterfacesImpl getNewInterfaces() { + return this.newInterfaces; + } + + /** + * Initializes an instance of RenamedFromClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public RenamedFromClientImpl(String endpoint, RenamedFromServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of RenamedFromClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public RenamedFromClientImpl(HttpPipeline httpPipeline, String endpoint, RenamedFromServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of RenamedFromClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public RenamedFromClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + RenamedFromServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.newInterfaces = new NewInterfacesImpl(this); + this.service = RestProxy.create(RenamedFromClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for RenamedFromClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}/versioning/renamed-from/api-version:{version}") + @ServiceInterface(name = "RenamedFromClient") + public interface RenamedFromClientService { + @Post("/test") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> newOp(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @QueryParam("newQuery") String newQuery, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/test") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response newOpSync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @QueryParam("newQuery") String newQuery, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The newOp operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param newQuery The newQuery parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> newOpWithResponseAsync(String newQuery, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.newOp(this.getEndpoint(), this.getServiceVersion().getVersion(), + newQuery, contentType, accept, body, requestOptions, context)); + } + + /** + * The newOp operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     newProp: String (Required)
+     *     enumProp: String(newEnumMember) (Required)
+     *     unionProp: BinaryData (Required)
+     * }
+     * }
+     * 
+ * + * @param newQuery The newQuery parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response newOpWithResponse(String newQuery, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.newOpSync(this.getEndpoint(), this.getServiceVersion().getVersion(), newQuery, contentType, + accept, body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/package-info.java new file mode 100644 index 00000000000..b867ec5e2e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for RenamedFrom. + * Test for the `@renamedFrom` decorator. + * + */ +package versioning.renamedfrom.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewEnum.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewEnum.java new file mode 100644 index 00000000000..c247ad3cdc3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewEnum.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.renamedfrom.models; + +/** + * Defines values for NewEnum. + */ +public enum NewEnum { + /** + * Enum value newEnumMember. + */ + NEW_ENUM_MEMBER("newEnumMember"); + + /** + * The actual serialized value for a NewEnum instance. + */ + private final String value; + + NewEnum(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a NewEnum instance. + * + * @param value the serialized value to parse. + * @return the parsed NewEnum object, or null if unable to parse. + */ + public static NewEnum fromString(String value) { + if (value == null) { + return null; + } + NewEnum[] items = NewEnum.values(); + for (NewEnum item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewModel.java new file mode 100644 index 00000000000..166c4086290 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/NewModel.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.renamedfrom.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The NewModel model. + */ +@Immutable +public final class NewModel implements JsonSerializable { + /* + * The newProp property. + */ + @Generated + private final String newProp; + + /* + * The enumProp property. + */ + @Generated + private final NewEnum enumProp; + + /* + * The unionProp property. + */ + @Generated + private final BinaryData unionProp; + + /** + * Creates an instance of NewModel class. + * + * @param newProp the newProp value to set. + * @param enumProp the enumProp value to set. + * @param unionProp the unionProp value to set. + */ + @Generated + public NewModel(String newProp, NewEnum enumProp, BinaryData unionProp) { + this.newProp = newProp; + this.enumProp = enumProp; + this.unionProp = unionProp; + } + + /** + * Get the newProp property: The newProp property. + * + * @return the newProp value. + */ + @Generated + public String getNewProp() { + return this.newProp; + } + + /** + * Get the enumProp property: The enumProp property. + * + * @return the enumProp value. + */ + @Generated + public NewEnum getEnumProp() { + return this.enumProp; + } + + /** + * Get the unionProp property: The unionProp property. + * + * @return the unionProp value. + */ + @Generated + public BinaryData getUnionProp() { + return this.unionProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("newProp", this.newProp); + jsonWriter.writeStringField("enumProp", this.enumProp == null ? null : this.enumProp.toString()); + jsonWriter.writeFieldName("unionProp"); + this.unionProp.writeTo(jsonWriter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NewModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NewModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NewModel. + */ + @Generated + public static NewModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String newProp = null; + NewEnum enumProp = null; + BinaryData unionProp = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("newProp".equals(fieldName)) { + newProp = reader.getString(); + } else if ("enumProp".equals(fieldName)) { + enumProp = NewEnum.fromString(reader.getString()); + } else if ("unionProp".equals(fieldName)) { + unionProp = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + return new NewModel(newProp, enumProp, unionProp); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/package-info.java new file mode 100644 index 00000000000..ae226cc9bc0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for RenamedFrom. + * Test for the `@renamedFrom` decorator. + * + */ +package versioning.renamedfrom.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/package-info.java new file mode 100644 index 00000000000..034c4381e79 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/renamedfrom/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for RenamedFrom. + * Test for the `@renamedFrom` decorator. + * + */ +package versioning.renamedfrom; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromAsyncClient.java new file mode 100644 index 00000000000..730393bf272 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromAsyncClient.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.returntypechangedfrom; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import versioning.returntypechangedfrom.implementation.ReturnTypeChangedFromClientImpl; + +/** + * Initializes a new instance of the asynchronous ReturnTypeChangedFromClient type. + */ +@ServiceClient(builder = ReturnTypeChangedFromClientBuilder.class, isAsync = true) +public final class ReturnTypeChangedFromAsyncClient { + @Generated + private final ReturnTypeChangedFromClientImpl serviceClient; + + /** + * Initializes an instance of ReturnTypeChangedFromAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ReturnTypeChangedFromAsyncClient(ReturnTypeChangedFromClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The test operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> testWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.testWithResponseAsync(body, requestOptions); + } + + /** + * The test operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sequence of textual characters on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono test(String body) { + // Generated convenience method for testWithResponse + RequestOptions requestOptions = new RequestOptions(); + return testWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(String.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClient.java new file mode 100644 index 00000000000..4bb0ffa8918 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClient.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.returntypechangedfrom; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import versioning.returntypechangedfrom.implementation.ReturnTypeChangedFromClientImpl; + +/** + * Initializes a new instance of the synchronous ReturnTypeChangedFromClient type. + */ +@ServiceClient(builder = ReturnTypeChangedFromClientBuilder.class) +public final class ReturnTypeChangedFromClient { + @Generated + private final ReturnTypeChangedFromClientImpl serviceClient; + + /** + * Initializes an instance of ReturnTypeChangedFromClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ReturnTypeChangedFromClient(ReturnTypeChangedFromClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The test operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testWithResponse(BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.testWithResponse(body, requestOptions); + } + + /** + * The test operation. + * + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sequence of textual characters. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public String test(String body) { + // Generated convenience method for testWithResponse + RequestOptions requestOptions = new RequestOptions(); + return testWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(String.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClientBuilder.java new file mode 100644 index 00000000000..0d63f6ec55c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClientBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.returntypechangedfrom; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import versioning.returntypechangedfrom.implementation.ReturnTypeChangedFromClientImpl; + +/** + * A builder for creating a new instance of the ReturnTypeChangedFromClient type. + */ +@ServiceClientBuilder(serviceClients = { ReturnTypeChangedFromClient.class, ReturnTypeChangedFromAsyncClient.class }) +public final class ReturnTypeChangedFromClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("versioning-returntypechangedfrom.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the ReturnTypeChangedFromClientBuilder. + */ + @Generated + public ReturnTypeChangedFromClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ReturnTypeChangedFromClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ReturnTypeChangedFromClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ReturnTypeChangedFromClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ReturnTypeChangedFromClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ReturnTypeChangedFromClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ReturnTypeChangedFromClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ReturnTypeChangedFromClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public ReturnTypeChangedFromClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private ReturnTypeChangedFromServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the ReturnTypeChangedFromClientBuilder. + */ + @Generated + public ReturnTypeChangedFromClientBuilder serviceVersion(ReturnTypeChangedFromServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the ReturnTypeChangedFromClientBuilder. + */ + @Generated + public ReturnTypeChangedFromClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of ReturnTypeChangedFromClientImpl with the provided parameters. + * + * @return an instance of ReturnTypeChangedFromClientImpl. + */ + @Generated + private ReturnTypeChangedFromClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + ReturnTypeChangedFromServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : ReturnTypeChangedFromServiceVersion.getLatest(); + ReturnTypeChangedFromClientImpl client = new ReturnTypeChangedFromClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of ReturnTypeChangedFromAsyncClient class. + * + * @return an instance of ReturnTypeChangedFromAsyncClient. + */ + @Generated + public ReturnTypeChangedFromAsyncClient buildAsyncClient() { + return new ReturnTypeChangedFromAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of ReturnTypeChangedFromClient class. + * + * @return an instance of ReturnTypeChangedFromClient. + */ + @Generated + public ReturnTypeChangedFromClient buildClient() { + return new ReturnTypeChangedFromClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(ReturnTypeChangedFromClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromServiceVersion.java new file mode 100644 index 00000000000..14bd3fee5fa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromServiceVersion.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.returntypechangedfrom; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of ReturnTypeChangedFromClient. + */ +public enum ReturnTypeChangedFromServiceVersion implements ServiceVersion { + /** + * Enum value v1. + */ + V1("v1"), + + /** + * Enum value v2. + */ + V2("v2"); + + private final String version; + + ReturnTypeChangedFromServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link ReturnTypeChangedFromServiceVersion}. + */ + public static ReturnTypeChangedFromServiceVersion getLatest() { + return V2; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java new file mode 100644 index 00000000000..54858014fdd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.returntypechangedfrom.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; +import versioning.returntypechangedfrom.ReturnTypeChangedFromServiceVersion; + +/** + * Initializes a new instance of the ReturnTypeChangedFromClient type. + */ +public final class ReturnTypeChangedFromClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ReturnTypeChangedFromClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final ReturnTypeChangedFromServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public ReturnTypeChangedFromServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of ReturnTypeChangedFromClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public ReturnTypeChangedFromClientImpl(String endpoint, ReturnTypeChangedFromServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ReturnTypeChangedFromClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public ReturnTypeChangedFromClientImpl(HttpPipeline httpPipeline, String endpoint, + ReturnTypeChangedFromServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of ReturnTypeChangedFromClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public ReturnTypeChangedFromClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + String endpoint, ReturnTypeChangedFromServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service = RestProxy.create(ReturnTypeChangedFromClientService.class, this.httpPipeline, + this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for ReturnTypeChangedFromClient to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}/versioning/return-type-changed-from/api-version:{version}") + @ServiceInterface(name = "ReturnTypeChangedFromClient") + public interface ReturnTypeChangedFromClientService { + @Post("/test") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> test(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/test") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response testSync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + } + + /** + * The test operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> testWithResponseAsync(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.test(this.getEndpoint(), this.getServiceVersion().getVersion(), + contentType, accept, body, requestOptions, context)); + } + + /** + * The test operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * String
+     * }
+     * 
+ * + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a sequence of textual characters along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testWithResponse(BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.testSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept, body, + requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/package-info.java new file mode 100644 index 00000000000..f92fb10e32c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for ReturnTypeChangedFrom. + * Test for the `@returnTypeChangedFrom` decorator. + * + */ +package versioning.returntypechangedfrom.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/package-info.java new file mode 100644 index 00000000000..69575d6326b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/returntypechangedfrom/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for ReturnTypeChangedFrom. + * Test for the `@returnTypeChangedFrom` decorator. + * + */ +package versioning.returntypechangedfrom; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromAsyncClient.java new file mode 100644 index 00000000000..d1863fca3cc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromAsyncClient.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.typechangedfrom; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import versioning.typechangedfrom.implementation.TypeChangedFromClientImpl; +import versioning.typechangedfrom.models.TestModel; + +/** + * Initializes a new instance of the asynchronous TypeChangedFromClient type. + */ +@ServiceClient(builder = TypeChangedFromClientBuilder.class, isAsync = true) +public final class TypeChangedFromAsyncClient { + @Generated + private final TypeChangedFromClientImpl serviceClient; + + /** + * Initializes an instance of TypeChangedFromAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TypeChangedFromAsyncClient(TypeChangedFromClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The test operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param param The param parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> testWithResponse(String param, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.testWithResponseAsync(param, body, requestOptions); + } + + /** + * The test operation. + * + * @param param The param parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono test(String param, TestModel body) { + // Generated convenience method for testWithResponse + RequestOptions requestOptions = new RequestOptions(); + return testWithResponse(param, BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(TestModel.class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClient.java new file mode 100644 index 00000000000..e1ee88b4841 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClient.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.typechangedfrom; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import versioning.typechangedfrom.implementation.TypeChangedFromClientImpl; +import versioning.typechangedfrom.models.TestModel; + +/** + * Initializes a new instance of the synchronous TypeChangedFromClient type. + */ +@ServiceClient(builder = TypeChangedFromClientBuilder.class) +public final class TypeChangedFromClient { + @Generated + private final TypeChangedFromClientImpl serviceClient; + + /** + * Initializes an instance of TypeChangedFromClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TypeChangedFromClient(TypeChangedFromClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The test operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param param The param parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testWithResponse(String param, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.testWithResponse(param, body, requestOptions); + } + + /** + * The test operation. + * + * @param param The param parameter. + * @param body The body parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public TestModel test(String param, TestModel body) { + // Generated convenience method for testWithResponse + RequestOptions requestOptions = new RequestOptions(); + return testWithResponse(param, BinaryData.fromObject(body), requestOptions).getValue() + .toObject(TestModel.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClientBuilder.java new file mode 100644 index 00000000000..25a8e6f43cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromClientBuilder.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.typechangedfrom; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +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.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import versioning.typechangedfrom.implementation.TypeChangedFromClientImpl; + +/** + * A builder for creating a new instance of the TypeChangedFromClient type. + */ +@ServiceClientBuilder(serviceClients = { TypeChangedFromClient.class, TypeChangedFromAsyncClient.class }) +public final class TypeChangedFromClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES + = CoreUtils.getProperties("versioning-typechangedfrom.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the TypeChangedFromClientBuilder. + */ + @Generated + public TypeChangedFromClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TypeChangedFromClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TypeChangedFromClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TypeChangedFromClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TypeChangedFromClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TypeChangedFromClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TypeChangedFromClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TypeChangedFromClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public TypeChangedFromClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private TypeChangedFromServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the TypeChangedFromClientBuilder. + */ + @Generated + public TypeChangedFromClientBuilder serviceVersion(TypeChangedFromServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the TypeChangedFromClientBuilder. + */ + @Generated + public TypeChangedFromClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of TypeChangedFromClientImpl with the provided parameters. + * + * @return an instance of TypeChangedFromClientImpl. + */ + @Generated + private TypeChangedFromClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + TypeChangedFromServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : TypeChangedFromServiceVersion.getLatest(); + TypeChangedFromClientImpl client = new TypeChangedFromClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of TypeChangedFromAsyncClient class. + * + * @return an instance of TypeChangedFromAsyncClient. + */ + @Generated + public TypeChangedFromAsyncClient buildAsyncClient() { + return new TypeChangedFromAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of TypeChangedFromClient class. + * + * @return an instance of TypeChangedFromClient. + */ + @Generated + public TypeChangedFromClient buildClient() { + return new TypeChangedFromClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(TypeChangedFromClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromServiceVersion.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromServiceVersion.java new file mode 100644 index 00000000000..9aeb02e2411 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/TypeChangedFromServiceVersion.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.typechangedfrom; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of TypeChangedFromClient. + */ +public enum TypeChangedFromServiceVersion implements ServiceVersion { + /** + * Enum value v1. + */ + V1("v1"), + + /** + * Enum value v2. + */ + V2("v2"); + + private final String version; + + TypeChangedFromServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link TypeChangedFromServiceVersion}. + */ + public static TypeChangedFromServiceVersion getLatest() { + return V2; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java new file mode 100644 index 00000000000..c91db882420 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.typechangedfrom.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +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.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +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 com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; +import versioning.typechangedfrom.TypeChangedFromServiceVersion; + +/** + * Initializes a new instance of the TypeChangedFromClient type. + */ +public final class TypeChangedFromClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final TypeChangedFromClientService service; + + /** + * Need to be set as 'http://localhost:3000' in client. + */ + private final String endpoint; + + /** + * Gets Need to be set as 'http://localhost:3000' in client. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final TypeChangedFromServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public TypeChangedFromServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * 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; + } + + /** + * Initializes an instance of TypeChangedFromClient client. + * + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public TypeChangedFromClientImpl(String endpoint, TypeChangedFromServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of TypeChangedFromClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public TypeChangedFromClientImpl(HttpPipeline httpPipeline, String endpoint, + TypeChangedFromServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of TypeChangedFromClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Need to be set as 'http://localhost:3000' in client. + * @param serviceVersion Service version. + */ + public TypeChangedFromClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + TypeChangedFromServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.service + = RestProxy.create(TypeChangedFromClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for TypeChangedFromClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}/versioning/type-changed-from/api-version:{version}") + @ServiceInterface(name = "TypeChangedFromClient") + public interface TypeChangedFromClientService { + @Post("/test") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> test(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @QueryParam("param") String param, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/test") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response testSync(@HostParam("endpoint") String endpoint, @HostParam("version") String version, + @QueryParam("param") String param, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * The test operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param param The param parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> testWithResponseAsync(String param, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.test(this.getEndpoint(), this.getServiceVersion().getVersion(), + param, contentType, accept, body, requestOptions, context)); + } + + /** + * The test operation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     prop: String (Required)
+     *     changedProp: String (Required)
+     * }
+     * }
+     * 
+ * + * @param param The param parameter. + * @param body The body parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testWithResponse(String param, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.testSync(this.getEndpoint(), this.getServiceVersion().getVersion(), param, contentType, accept, + body, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/package-info.java new file mode 100644 index 00000000000..a762818a80e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for TypeChangedFrom. + * Test for the `@typeChangedFrom` decorator. + * + */ +package versioning.typechangedfrom.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/TestModel.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/TestModel.java new file mode 100644 index 00000000000..42dd4af3301 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/TestModel.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.typechangedfrom.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The TestModel model. + */ +@Immutable +public final class TestModel implements JsonSerializable { + /* + * The prop property. + */ + @Generated + private final String prop; + + /* + * The changedProp property. + */ + @Generated + private final String changedProp; + + /** + * Creates an instance of TestModel class. + * + * @param prop the prop value to set. + * @param changedProp the changedProp value to set. + */ + @Generated + public TestModel(String prop, String changedProp) { + this.prop = prop; + this.changedProp = changedProp; + } + + /** + * Get the prop property: The prop property. + * + * @return the prop value. + */ + @Generated + public String getProp() { + return this.prop; + } + + /** + * Get the changedProp property: The changedProp property. + * + * @return the changedProp value. + */ + @Generated + public String getChangedProp() { + return this.changedProp; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("prop", this.prop); + jsonWriter.writeStringField("changedProp", this.changedProp); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TestModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TestModel if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TestModel. + */ + @Generated + public static TestModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String prop = null; + String changedProp = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prop".equals(fieldName)) { + prop = reader.getString(); + } else if ("changedProp".equals(fieldName)) { + changedProp = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new TestModel(prop, changedProp); + }); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/package-info.java new file mode 100644 index 00000000000..feabc53edbe --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the data models for TypeChangedFrom. + * Test for the `@typeChangedFrom` decorator. + * + */ +package versioning.typechangedfrom.models; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/package-info.java new file mode 100644 index 00000000000..114593801f6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/versioning/typechangedfrom/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for TypeChangedFrom. + * Test for the `@typeChangedFrom` decorator. + * + */ +package versioning.typechangedfrom; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_apiview_properties.json new file mode 100644 index 00000000000..d4b49f747a6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_apiview_properties.json @@ -0,0 +1,16 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "authentication.apikey.ApiKeyAsyncClient": "Authentication.ApiKey", + "authentication.apikey.ApiKeyAsyncClient.invalid": "Authentication.ApiKey.invalid", + "authentication.apikey.ApiKeyAsyncClient.invalidWithResponse": "Authentication.ApiKey.invalid", + "authentication.apikey.ApiKeyAsyncClient.valid": "Authentication.ApiKey.valid", + "authentication.apikey.ApiKeyAsyncClient.validWithResponse": "Authentication.ApiKey.valid", + "authentication.apikey.ApiKeyClient": "Authentication.ApiKey", + "authentication.apikey.ApiKeyClient.invalid": "Authentication.ApiKey.invalid", + "authentication.apikey.ApiKeyClient.invalidWithResponse": "Authentication.ApiKey.invalid", + "authentication.apikey.ApiKeyClient.valid": "Authentication.ApiKey.valid", + "authentication.apikey.ApiKeyClient.validWithResponse": "Authentication.ApiKey.valid", + "authentication.apikey.ApiKeyClientBuilder": "Authentication.ApiKey" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_metadata.json new file mode 100644 index 00000000000..697b8c7027b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-apikey_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"authentication.apikey.ApiKeyAsyncClient":"Authentication.ApiKey","authentication.apikey.ApiKeyAsyncClient.invalid":"Authentication.ApiKey.invalid","authentication.apikey.ApiKeyAsyncClient.invalidWithResponse":"Authentication.ApiKey.invalid","authentication.apikey.ApiKeyAsyncClient.valid":"Authentication.ApiKey.valid","authentication.apikey.ApiKeyAsyncClient.validWithResponse":"Authentication.ApiKey.valid","authentication.apikey.ApiKeyClient":"Authentication.ApiKey","authentication.apikey.ApiKeyClient.invalid":"Authentication.ApiKey.invalid","authentication.apikey.ApiKeyClient.invalidWithResponse":"Authentication.ApiKey.invalid","authentication.apikey.ApiKeyClient.valid":"Authentication.ApiKey.valid","authentication.apikey.ApiKeyClient.validWithResponse":"Authentication.ApiKey.valid","authentication.apikey.ApiKeyClientBuilder":"Authentication.ApiKey"},"generatedFiles":["src/main/java/authentication/apikey/ApiKeyAsyncClient.java","src/main/java/authentication/apikey/ApiKeyClient.java","src/main/java/authentication/apikey/ApiKeyClientBuilder.java","src/main/java/authentication/apikey/implementation/ApiKeyClientImpl.java","src/main/java/authentication/apikey/implementation/package-info.java","src/main/java/authentication/apikey/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_apiview_properties.json new file mode 100644 index 00000000000..5cb55d8a990 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_apiview_properties.json @@ -0,0 +1,16 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "authentication.http.custom.CustomAsyncClient": "Authentication.Http.Custom", + "authentication.http.custom.CustomAsyncClient.invalid": "Authentication.Http.Custom.invalid", + "authentication.http.custom.CustomAsyncClient.invalidWithResponse": "Authentication.Http.Custom.invalid", + "authentication.http.custom.CustomAsyncClient.valid": "Authentication.Http.Custom.valid", + "authentication.http.custom.CustomAsyncClient.validWithResponse": "Authentication.Http.Custom.valid", + "authentication.http.custom.CustomClient": "Authentication.Http.Custom", + "authentication.http.custom.CustomClient.invalid": "Authentication.Http.Custom.invalid", + "authentication.http.custom.CustomClient.invalidWithResponse": "Authentication.Http.Custom.invalid", + "authentication.http.custom.CustomClient.valid": "Authentication.Http.Custom.valid", + "authentication.http.custom.CustomClient.validWithResponse": "Authentication.Http.Custom.valid", + "authentication.http.custom.CustomClientBuilder": "Authentication.Http.Custom" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_metadata.json new file mode 100644 index 00000000000..2b83d16a831 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-http-custom_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"authentication.http.custom.CustomAsyncClient":"Authentication.Http.Custom","authentication.http.custom.CustomAsyncClient.invalid":"Authentication.Http.Custom.invalid","authentication.http.custom.CustomAsyncClient.invalidWithResponse":"Authentication.Http.Custom.invalid","authentication.http.custom.CustomAsyncClient.valid":"Authentication.Http.Custom.valid","authentication.http.custom.CustomAsyncClient.validWithResponse":"Authentication.Http.Custom.valid","authentication.http.custom.CustomClient":"Authentication.Http.Custom","authentication.http.custom.CustomClient.invalid":"Authentication.Http.Custom.invalid","authentication.http.custom.CustomClient.invalidWithResponse":"Authentication.Http.Custom.invalid","authentication.http.custom.CustomClient.valid":"Authentication.Http.Custom.valid","authentication.http.custom.CustomClient.validWithResponse":"Authentication.Http.Custom.valid","authentication.http.custom.CustomClientBuilder":"Authentication.Http.Custom"},"generatedFiles":["src/main/java/authentication/http/custom/CustomAsyncClient.java","src/main/java/authentication/http/custom/CustomClient.java","src/main/java/authentication/http/custom/CustomClientBuilder.java","src/main/java/authentication/http/custom/implementation/CustomClientImpl.java","src/main/java/authentication/http/custom/implementation/package-info.java","src/main/java/authentication/http/custom/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_apiview_properties.json new file mode 100644 index 00000000000..fce42c74766 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_apiview_properties.json @@ -0,0 +1,16 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "authentication.oauth2.OAuth2AsyncClient": "Authentication.OAuth2", + "authentication.oauth2.OAuth2AsyncClient.invalid": "Authentication.OAuth2.invalid", + "authentication.oauth2.OAuth2AsyncClient.invalidWithResponse": "Authentication.OAuth2.invalid", + "authentication.oauth2.OAuth2AsyncClient.valid": "Authentication.OAuth2.valid", + "authentication.oauth2.OAuth2AsyncClient.validWithResponse": "Authentication.OAuth2.valid", + "authentication.oauth2.OAuth2Client": "Authentication.OAuth2", + "authentication.oauth2.OAuth2Client.invalid": "Authentication.OAuth2.invalid", + "authentication.oauth2.OAuth2Client.invalidWithResponse": "Authentication.OAuth2.invalid", + "authentication.oauth2.OAuth2Client.valid": "Authentication.OAuth2.valid", + "authentication.oauth2.OAuth2Client.validWithResponse": "Authentication.OAuth2.valid", + "authentication.oauth2.OAuth2ClientBuilder": "Authentication.OAuth2" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_metadata.json new file mode 100644 index 00000000000..bf1691010b7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-oauth2_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"authentication.oauth2.OAuth2AsyncClient":"Authentication.OAuth2","authentication.oauth2.OAuth2AsyncClient.invalid":"Authentication.OAuth2.invalid","authentication.oauth2.OAuth2AsyncClient.invalidWithResponse":"Authentication.OAuth2.invalid","authentication.oauth2.OAuth2AsyncClient.valid":"Authentication.OAuth2.valid","authentication.oauth2.OAuth2AsyncClient.validWithResponse":"Authentication.OAuth2.valid","authentication.oauth2.OAuth2Client":"Authentication.OAuth2","authentication.oauth2.OAuth2Client.invalid":"Authentication.OAuth2.invalid","authentication.oauth2.OAuth2Client.invalidWithResponse":"Authentication.OAuth2.invalid","authentication.oauth2.OAuth2Client.valid":"Authentication.OAuth2.valid","authentication.oauth2.OAuth2Client.validWithResponse":"Authentication.OAuth2.valid","authentication.oauth2.OAuth2ClientBuilder":"Authentication.OAuth2"},"generatedFiles":["src/main/java/authentication/oauth2/OAuth2AsyncClient.java","src/main/java/authentication/oauth2/OAuth2Client.java","src/main/java/authentication/oauth2/OAuth2ClientBuilder.java","src/main/java/authentication/oauth2/implementation/OAuth2ClientImpl.java","src/main/java/authentication/oauth2/implementation/package-info.java","src/main/java/authentication/oauth2/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_apiview_properties.json new file mode 100644 index 00000000000..e1703358e43 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_apiview_properties.json @@ -0,0 +1,16 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "authentication.union.UnionAsyncClient": "Authentication.Union", + "authentication.union.UnionAsyncClient.validKey": "Authentication.Union.validKey", + "authentication.union.UnionAsyncClient.validKeyWithResponse": "Authentication.Union.validKey", + "authentication.union.UnionAsyncClient.validToken": "Authentication.Union.validToken", + "authentication.union.UnionAsyncClient.validTokenWithResponse": "Authentication.Union.validToken", + "authentication.union.UnionClient": "Authentication.Union", + "authentication.union.UnionClient.validKey": "Authentication.Union.validKey", + "authentication.union.UnionClient.validKeyWithResponse": "Authentication.Union.validKey", + "authentication.union.UnionClient.validToken": "Authentication.Union.validToken", + "authentication.union.UnionClient.validTokenWithResponse": "Authentication.Union.validToken", + "authentication.union.UnionClientBuilder": "Authentication.Union" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_metadata.json new file mode 100644 index 00000000000..af664fefa6a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/authentication-union_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"authentication.union.UnionAsyncClient":"Authentication.Union","authentication.union.UnionAsyncClient.validKey":"Authentication.Union.validKey","authentication.union.UnionAsyncClient.validKeyWithResponse":"Authentication.Union.validKey","authentication.union.UnionAsyncClient.validToken":"Authentication.Union.validToken","authentication.union.UnionAsyncClient.validTokenWithResponse":"Authentication.Union.validToken","authentication.union.UnionClient":"Authentication.Union","authentication.union.UnionClient.validKey":"Authentication.Union.validKey","authentication.union.UnionClient.validKeyWithResponse":"Authentication.Union.validKey","authentication.union.UnionClient.validToken":"Authentication.Union.validToken","authentication.union.UnionClient.validTokenWithResponse":"Authentication.Union.validToken","authentication.union.UnionClientBuilder":"Authentication.Union"},"generatedFiles":["src/main/java/authentication/union/UnionAsyncClient.java","src/main/java/authentication/union/UnionClient.java","src/main/java/authentication/union/UnionClientBuilder.java","src/main/java/authentication/union/implementation/UnionClientImpl.java","src/main/java/authentication/union/implementation/package-info.java","src/main/java/authentication/union/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_apiview_properties.json new file mode 100644 index 00000000000..b2ecacca094 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_apiview_properties.json @@ -0,0 +1,61 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.access.AccessClientBuilder": "_Specs_.Azure.ClientGenerator.Core.Access", + "azure.clientgenerator.core.access.InternalOperationAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation", + "azure.clientgenerator.core.access.InternalOperationAsyncClient.internalDecoratorInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal", + "azure.clientgenerator.core.access.InternalOperationAsyncClient.internalDecoratorInInternalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal", + "azure.clientgenerator.core.access.InternalOperationAsyncClient.noDecoratorInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal", + "azure.clientgenerator.core.access.InternalOperationAsyncClient.noDecoratorInInternalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal", + "azure.clientgenerator.core.access.InternalOperationAsyncClient.publicDecoratorInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal", + "azure.clientgenerator.core.access.InternalOperationAsyncClient.publicDecoratorInInternalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal", + "azure.clientgenerator.core.access.InternalOperationClient": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation", + "azure.clientgenerator.core.access.InternalOperationClient.internalDecoratorInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal", + "azure.clientgenerator.core.access.InternalOperationClient.internalDecoratorInInternalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal", + "azure.clientgenerator.core.access.InternalOperationClient.noDecoratorInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal", + "azure.clientgenerator.core.access.InternalOperationClient.noDecoratorInInternalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal", + "azure.clientgenerator.core.access.InternalOperationClient.publicDecoratorInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal", + "azure.clientgenerator.core.access.InternalOperationClient.publicDecoratorInInternalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal", + "azure.clientgenerator.core.access.PublicOperationAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation", + "azure.clientgenerator.core.access.PublicOperationAsyncClient.noDecoratorInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic", + "azure.clientgenerator.core.access.PublicOperationAsyncClient.noDecoratorInPublicWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic", + "azure.clientgenerator.core.access.PublicOperationAsyncClient.publicDecoratorInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic", + "azure.clientgenerator.core.access.PublicOperationAsyncClient.publicDecoratorInPublicWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic", + "azure.clientgenerator.core.access.PublicOperationClient": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation", + "azure.clientgenerator.core.access.PublicOperationClient.noDecoratorInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic", + "azure.clientgenerator.core.access.PublicOperationClient.noDecoratorInPublicWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic", + "azure.clientgenerator.core.access.PublicOperationClient.publicDecoratorInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic", + "azure.clientgenerator.core.access.PublicOperationClient.publicDecoratorInPublicWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic", + "azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation", + "azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.discriminator": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator", + "azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.discriminatorWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator", + "azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.operation": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation", + "azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.operationWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation", + "azure.clientgenerator.core.access.RelativeModelInOperationClient": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation", + "azure.clientgenerator.core.access.RelativeModelInOperationClient.discriminator": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator", + "azure.clientgenerator.core.access.RelativeModelInOperationClient.discriminatorWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator", + "azure.clientgenerator.core.access.RelativeModelInOperationClient.operation": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation", + "azure.clientgenerator.core.access.RelativeModelInOperationClient.operationWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation", + "azure.clientgenerator.core.access.SharedModelInOperationAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation", + "azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.internal": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal", + "azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.internalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal", + "azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.publicMethod": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public", + "azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.publicMethodWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public", + "azure.clientgenerator.core.access.SharedModelInOperationClient": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation", + "azure.clientgenerator.core.access.SharedModelInOperationClient.internal": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal", + "azure.clientgenerator.core.access.SharedModelInOperationClient.internalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal", + "azure.clientgenerator.core.access.SharedModelInOperationClient.publicMethod": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public", + "azure.clientgenerator.core.access.SharedModelInOperationClient.publicMethodWithResponse": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public", + "azure.clientgenerator.core.access.internaloperation.implementation.models.InternalDecoratorModelInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.InternalDecoratorModelInInternal", + "azure.clientgenerator.core.access.internaloperation.implementation.models.NoDecoratorModelInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.NoDecoratorModelInInternal", + "azure.clientgenerator.core.access.internaloperation.models.PublicDecoratorModelInInternal": "_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.PublicDecoratorModelInInternal", + "azure.clientgenerator.core.access.publicoperation.models.NoDecoratorModelInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.NoDecoratorModelInPublic", + "azure.clientgenerator.core.access.publicoperation.models.PublicDecoratorModelInPublic": "_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.PublicDecoratorModelInPublic", + "azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.AbstractModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.AbstractModel", + "azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.BaseModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.BaseModel", + "azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.InnerModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.InnerModel", + "azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.OuterModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.OuterModel", + "azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.RealModel": "_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.RealModel", + "azure.clientgenerator.core.access.sharedmodelinoperation.models.SharedModel": "_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.SharedModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_metadata.json new file mode 100644 index 00000000000..15214167dd7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-access_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.access.AccessClientBuilder":"_Specs_.Azure.ClientGenerator.Core.Access","azure.clientgenerator.core.access.InternalOperationAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation","azure.clientgenerator.core.access.InternalOperationAsyncClient.internalDecoratorInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationAsyncClient.internalDecoratorInInternalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationAsyncClient.noDecoratorInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationAsyncClient.noDecoratorInInternalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationAsyncClient.publicDecoratorInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationAsyncClient.publicDecoratorInInternalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationClient":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation","azure.clientgenerator.core.access.InternalOperationClient.internalDecoratorInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationClient.internalDecoratorInInternalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.internalDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationClient.noDecoratorInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationClient.noDecoratorInInternalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.noDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationClient.publicDecoratorInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal","azure.clientgenerator.core.access.InternalOperationClient.publicDecoratorInInternalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.publicDecoratorInInternal","azure.clientgenerator.core.access.PublicOperationAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation","azure.clientgenerator.core.access.PublicOperationAsyncClient.noDecoratorInPublic":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationAsyncClient.noDecoratorInPublicWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationAsyncClient.publicDecoratorInPublic":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationAsyncClient.publicDecoratorInPublicWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationClient":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation","azure.clientgenerator.core.access.PublicOperationClient.noDecoratorInPublic":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationClient.noDecoratorInPublicWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.noDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationClient.publicDecoratorInPublic":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic","azure.clientgenerator.core.access.PublicOperationClient.publicDecoratorInPublicWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.publicDecoratorInPublic","azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation","azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.discriminator":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator","azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.discriminatorWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator","azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.operation":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation","azure.clientgenerator.core.access.RelativeModelInOperationAsyncClient.operationWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation","azure.clientgenerator.core.access.RelativeModelInOperationClient":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation","azure.clientgenerator.core.access.RelativeModelInOperationClient.discriminator":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator","azure.clientgenerator.core.access.RelativeModelInOperationClient.discriminatorWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.discriminator","azure.clientgenerator.core.access.RelativeModelInOperationClient.operation":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation","azure.clientgenerator.core.access.RelativeModelInOperationClient.operationWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.operation","azure.clientgenerator.core.access.SharedModelInOperationAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation","azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.internal":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal","azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.internalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal","azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.publicMethod":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public","azure.clientgenerator.core.access.SharedModelInOperationAsyncClient.publicMethodWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public","azure.clientgenerator.core.access.SharedModelInOperationClient":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation","azure.clientgenerator.core.access.SharedModelInOperationClient.internal":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal","azure.clientgenerator.core.access.SharedModelInOperationClient.internalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.internal","azure.clientgenerator.core.access.SharedModelInOperationClient.publicMethod":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public","azure.clientgenerator.core.access.SharedModelInOperationClient.publicMethodWithResponse":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.public","azure.clientgenerator.core.access.internaloperation.implementation.models.InternalDecoratorModelInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.InternalDecoratorModelInInternal","azure.clientgenerator.core.access.internaloperation.implementation.models.NoDecoratorModelInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.NoDecoratorModelInInternal","azure.clientgenerator.core.access.internaloperation.models.PublicDecoratorModelInInternal":"_Specs_.Azure.ClientGenerator.Core.Access.InternalOperation.PublicDecoratorModelInInternal","azure.clientgenerator.core.access.publicoperation.models.NoDecoratorModelInPublic":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.NoDecoratorModelInPublic","azure.clientgenerator.core.access.publicoperation.models.PublicDecoratorModelInPublic":"_Specs_.Azure.ClientGenerator.Core.Access.PublicOperation.PublicDecoratorModelInPublic","azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.AbstractModel":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.AbstractModel","azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.BaseModel":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.BaseModel","azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.InnerModel":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.InnerModel","azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.OuterModel":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.OuterModel","azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.RealModel":"_Specs_.Azure.ClientGenerator.Core.Access.RelativeModelInOperation.RealModel","azure.clientgenerator.core.access.sharedmodelinoperation.models.SharedModel":"_Specs_.Azure.ClientGenerator.Core.Access.SharedModelInOperation.SharedModel"},"generatedFiles":["src/main/java/azure/clientgenerator/core/access/AccessClientBuilder.java","src/main/java/azure/clientgenerator/core/access/InternalOperationAsyncClient.java","src/main/java/azure/clientgenerator/core/access/InternalOperationClient.java","src/main/java/azure/clientgenerator/core/access/PublicOperationAsyncClient.java","src/main/java/azure/clientgenerator/core/access/PublicOperationClient.java","src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationAsyncClient.java","src/main/java/azure/clientgenerator/core/access/RelativeModelInOperationClient.java","src/main/java/azure/clientgenerator/core/access/SharedModelInOperationAsyncClient.java","src/main/java/azure/clientgenerator/core/access/SharedModelInOperationClient.java","src/main/java/azure/clientgenerator/core/access/implementation/AccessClientImpl.java","src/main/java/azure/clientgenerator/core/access/implementation/InternalOperationsImpl.java","src/main/java/azure/clientgenerator/core/access/implementation/PublicOperationsImpl.java","src/main/java/azure/clientgenerator/core/access/implementation/RelativeModelInOperationsImpl.java","src/main/java/azure/clientgenerator/core/access/implementation/SharedModelInOperationsImpl.java","src/main/java/azure/clientgenerator/core/access/implementation/package-info.java","src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/InternalDecoratorModelInInternal.java","src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/NoDecoratorModelInInternal.java","src/main/java/azure/clientgenerator/core/access/internaloperation/implementation/models/package-info.java","src/main/java/azure/clientgenerator/core/access/internaloperation/models/PublicDecoratorModelInInternal.java","src/main/java/azure/clientgenerator/core/access/internaloperation/models/package-info.java","src/main/java/azure/clientgenerator/core/access/package-info.java","src/main/java/azure/clientgenerator/core/access/publicoperation/models/NoDecoratorModelInPublic.java","src/main/java/azure/clientgenerator/core/access/publicoperation/models/PublicDecoratorModelInPublic.java","src/main/java/azure/clientgenerator/core/access/publicoperation/models/package-info.java","src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/AbstractModel.java","src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/BaseModel.java","src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/InnerModel.java","src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/OuterModel.java","src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/RealModel.java","src/main/java/azure/clientgenerator/core/access/relativemodelinoperation/implementation/models/package-info.java","src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/SharedModel.java","src/main/java/azure/clientgenerator/core/access/sharedmodelinoperation/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_apiview_properties.json new file mode 100644 index 00000000000..7c00ee0f7d6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_apiview_properties.json @@ -0,0 +1,25 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType", + "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getModel": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel", + "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel", + "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getProperty": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty", + "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getPropertyWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty", + "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putModel": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel", + "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel", + "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putProperty": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty", + "azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putPropertyWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty", + "azure.clientgenerator.core.alternatetype.AlternateTypeClient": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType", + "azure.clientgenerator.core.alternatetype.AlternateTypeClient.getModel": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel", + "azure.clientgenerator.core.alternatetype.AlternateTypeClient.getModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel", + "azure.clientgenerator.core.alternatetype.AlternateTypeClient.getProperty": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty", + "azure.clientgenerator.core.alternatetype.AlternateTypeClient.getPropertyWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty", + "azure.clientgenerator.core.alternatetype.AlternateTypeClient.putModel": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel", + "azure.clientgenerator.core.alternatetype.AlternateTypeClient.putModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel", + "azure.clientgenerator.core.alternatetype.AlternateTypeClient.putProperty": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty", + "azure.clientgenerator.core.alternatetype.AlternateTypeClient.putPropertyWithResponse": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty", + "azure.clientgenerator.core.alternatetype.AlternateTypeClientBuilder": "_Specs_.Azure.ClientGenerator.Core.AlternateType", + "azure.clientgenerator.core.alternatetype.externaltype.models.ModelWithFeatureProperty": "_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.ModelWithFeatureProperty" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_metadata.json new file mode 100644 index 00000000000..fb0167e921f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-alternatetype_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getModel":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getProperty":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.getPropertyWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putModel":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putProperty":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty","azure.clientgenerator.core.alternatetype.AlternateTypeAsyncClient.putPropertyWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty","azure.clientgenerator.core.alternatetype.AlternateTypeClient":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType","azure.clientgenerator.core.alternatetype.AlternateTypeClient.getModel":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel","azure.clientgenerator.core.alternatetype.AlternateTypeClient.getModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getModel","azure.clientgenerator.core.alternatetype.AlternateTypeClient.getProperty":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty","azure.clientgenerator.core.alternatetype.AlternateTypeClient.getPropertyWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.getProperty","azure.clientgenerator.core.alternatetype.AlternateTypeClient.putModel":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel","azure.clientgenerator.core.alternatetype.AlternateTypeClient.putModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putModel","azure.clientgenerator.core.alternatetype.AlternateTypeClient.putProperty":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty","azure.clientgenerator.core.alternatetype.AlternateTypeClient.putPropertyWithResponse":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.putProperty","azure.clientgenerator.core.alternatetype.AlternateTypeClientBuilder":"_Specs_.Azure.ClientGenerator.Core.AlternateType","azure.clientgenerator.core.alternatetype.externaltype.models.ModelWithFeatureProperty":"_Specs_.Azure.ClientGenerator.Core.AlternateType.ExternalType.ModelWithFeatureProperty"},"generatedFiles":["src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeAsyncClient.java","src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClient.java","src/main/java/azure/clientgenerator/core/alternatetype/AlternateTypeClientBuilder.java","src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/ModelWithFeatureProperty.java","src/main/java/azure/clientgenerator/core/alternatetype/externaltype/models/package-info.java","src/main/java/azure/clientgenerator/core/alternatetype/implementation/AlternateTypeClientImpl.java","src/main/java/azure/clientgenerator/core/alternatetype/implementation/ExternalTypesImpl.java","src/main/java/azure/clientgenerator/core/alternatetype/implementation/package-info.java","src/main/java/azure/clientgenerator/core/alternatetype/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_apiview_properties.json new file mode 100644 index 00000000000..a8c48566d57 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_apiview_properties.json @@ -0,0 +1,12 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.apiversion.header.HeaderAsyncClient": "Client.AlternateApiVersion.Service.Header", + "azure.clientgenerator.core.apiversion.header.HeaderAsyncClient.headerApiVersion": "Client.AlternateApiVersion.Service.Header.headerApiVersion", + "azure.clientgenerator.core.apiversion.header.HeaderAsyncClient.headerApiVersionWithResponse": "Client.AlternateApiVersion.Service.Header.headerApiVersion", + "azure.clientgenerator.core.apiversion.header.HeaderClient": "Client.AlternateApiVersion.Service.Header", + "azure.clientgenerator.core.apiversion.header.HeaderClient.headerApiVersion": "Client.AlternateApiVersion.Service.Header.headerApiVersion", + "azure.clientgenerator.core.apiversion.header.HeaderClient.headerApiVersionWithResponse": "Client.AlternateApiVersion.Service.Header.headerApiVersion", + "azure.clientgenerator.core.apiversion.header.HeaderClientBuilder": "Client.AlternateApiVersion.Service.Header" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_metadata.json new file mode 100644 index 00000000000..7fc6eb21f72 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-header_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2025-01-01","crossLanguageDefinitions":{"azure.clientgenerator.core.apiversion.header.HeaderAsyncClient":"Client.AlternateApiVersion.Service.Header","azure.clientgenerator.core.apiversion.header.HeaderAsyncClient.headerApiVersion":"Client.AlternateApiVersion.Service.Header.headerApiVersion","azure.clientgenerator.core.apiversion.header.HeaderAsyncClient.headerApiVersionWithResponse":"Client.AlternateApiVersion.Service.Header.headerApiVersion","azure.clientgenerator.core.apiversion.header.HeaderClient":"Client.AlternateApiVersion.Service.Header","azure.clientgenerator.core.apiversion.header.HeaderClient.headerApiVersion":"Client.AlternateApiVersion.Service.Header.headerApiVersion","azure.clientgenerator.core.apiversion.header.HeaderClient.headerApiVersionWithResponse":"Client.AlternateApiVersion.Service.Header.headerApiVersion","azure.clientgenerator.core.apiversion.header.HeaderClientBuilder":"Client.AlternateApiVersion.Service.Header"},"generatedFiles":["src/main/java/azure/clientgenerator/core/apiversion/header/HeaderAsyncClient.java","src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClient.java","src/main/java/azure/clientgenerator/core/apiversion/header/HeaderClientBuilder.java","src/main/java/azure/clientgenerator/core/apiversion/header/HeaderServiceVersion.java","src/main/java/azure/clientgenerator/core/apiversion/header/implementation/HeaderClientImpl.java","src/main/java/azure/clientgenerator/core/apiversion/header/implementation/package-info.java","src/main/java/azure/clientgenerator/core/apiversion/header/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_apiview_properties.json new file mode 100644 index 00000000000..01e17170519 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_apiview_properties.json @@ -0,0 +1,12 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.apiversion.path.PathAsyncClient": "Client.AlternateApiVersion.Service.Path", + "azure.clientgenerator.core.apiversion.path.PathAsyncClient.pathApiVersion": "Client.AlternateApiVersion.Service.Path.pathApiVersion", + "azure.clientgenerator.core.apiversion.path.PathAsyncClient.pathApiVersionWithResponse": "Client.AlternateApiVersion.Service.Path.pathApiVersion", + "azure.clientgenerator.core.apiversion.path.PathClient": "Client.AlternateApiVersion.Service.Path", + "azure.clientgenerator.core.apiversion.path.PathClient.pathApiVersion": "Client.AlternateApiVersion.Service.Path.pathApiVersion", + "azure.clientgenerator.core.apiversion.path.PathClient.pathApiVersionWithResponse": "Client.AlternateApiVersion.Service.Path.pathApiVersion", + "azure.clientgenerator.core.apiversion.path.PathClientBuilder": "Client.AlternateApiVersion.Service.Path" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_metadata.json new file mode 100644 index 00000000000..48a19a365c1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-path_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2025-01-01","crossLanguageDefinitions":{"azure.clientgenerator.core.apiversion.path.PathAsyncClient":"Client.AlternateApiVersion.Service.Path","azure.clientgenerator.core.apiversion.path.PathAsyncClient.pathApiVersion":"Client.AlternateApiVersion.Service.Path.pathApiVersion","azure.clientgenerator.core.apiversion.path.PathAsyncClient.pathApiVersionWithResponse":"Client.AlternateApiVersion.Service.Path.pathApiVersion","azure.clientgenerator.core.apiversion.path.PathClient":"Client.AlternateApiVersion.Service.Path","azure.clientgenerator.core.apiversion.path.PathClient.pathApiVersion":"Client.AlternateApiVersion.Service.Path.pathApiVersion","azure.clientgenerator.core.apiversion.path.PathClient.pathApiVersionWithResponse":"Client.AlternateApiVersion.Service.Path.pathApiVersion","azure.clientgenerator.core.apiversion.path.PathClientBuilder":"Client.AlternateApiVersion.Service.Path"},"generatedFiles":["src/main/java/azure/clientgenerator/core/apiversion/path/PathAsyncClient.java","src/main/java/azure/clientgenerator/core/apiversion/path/PathClient.java","src/main/java/azure/clientgenerator/core/apiversion/path/PathClientBuilder.java","src/main/java/azure/clientgenerator/core/apiversion/path/PathServiceVersion.java","src/main/java/azure/clientgenerator/core/apiversion/path/implementation/PathClientImpl.java","src/main/java/azure/clientgenerator/core/apiversion/path/implementation/package-info.java","src/main/java/azure/clientgenerator/core/apiversion/path/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_apiview_properties.json new file mode 100644 index 00000000000..ab6b566870b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_apiview_properties.json @@ -0,0 +1,12 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.apiversion.query.QueryAsyncClient": "Client.AlternateApiVersion.Service.Query", + "azure.clientgenerator.core.apiversion.query.QueryAsyncClient.queryApiVersion": "Client.AlternateApiVersion.Service.Query.queryApiVersion", + "azure.clientgenerator.core.apiversion.query.QueryAsyncClient.queryApiVersionWithResponse": "Client.AlternateApiVersion.Service.Query.queryApiVersion", + "azure.clientgenerator.core.apiversion.query.QueryClient": "Client.AlternateApiVersion.Service.Query", + "azure.clientgenerator.core.apiversion.query.QueryClient.queryApiVersion": "Client.AlternateApiVersion.Service.Query.queryApiVersion", + "azure.clientgenerator.core.apiversion.query.QueryClient.queryApiVersionWithResponse": "Client.AlternateApiVersion.Service.Query.queryApiVersion", + "azure.clientgenerator.core.apiversion.query.QueryClientBuilder": "Client.AlternateApiVersion.Service.Query" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_metadata.json new file mode 100644 index 00000000000..2f0a64f5572 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-apiversion-query_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2025-01-01","crossLanguageDefinitions":{"azure.clientgenerator.core.apiversion.query.QueryAsyncClient":"Client.AlternateApiVersion.Service.Query","azure.clientgenerator.core.apiversion.query.QueryAsyncClient.queryApiVersion":"Client.AlternateApiVersion.Service.Query.queryApiVersion","azure.clientgenerator.core.apiversion.query.QueryAsyncClient.queryApiVersionWithResponse":"Client.AlternateApiVersion.Service.Query.queryApiVersion","azure.clientgenerator.core.apiversion.query.QueryClient":"Client.AlternateApiVersion.Service.Query","azure.clientgenerator.core.apiversion.query.QueryClient.queryApiVersion":"Client.AlternateApiVersion.Service.Query.queryApiVersion","azure.clientgenerator.core.apiversion.query.QueryClient.queryApiVersionWithResponse":"Client.AlternateApiVersion.Service.Query.queryApiVersion","azure.clientgenerator.core.apiversion.query.QueryClientBuilder":"Client.AlternateApiVersion.Service.Query"},"generatedFiles":["src/main/java/azure/clientgenerator/core/apiversion/query/QueryAsyncClient.java","src/main/java/azure/clientgenerator/core/apiversion/query/QueryClient.java","src/main/java/azure/clientgenerator/core/apiversion/query/QueryClientBuilder.java","src/main/java/azure/clientgenerator/core/apiversion/query/QueryServiceVersion.java","src/main/java/azure/clientgenerator/core/apiversion/query/implementation/QueryClientImpl.java","src/main/java/azure/clientgenerator/core/apiversion/query/implementation/package-info.java","src/main/java/azure/clientgenerator/core/apiversion/query/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_apiview_properties.json new file mode 100644 index 00000000000..c7da87b4bf0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_apiview_properties.json @@ -0,0 +1,85 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam", + "azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withBody": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody", + "azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withBodyWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody", + "azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery", + "azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery", + "azure.clientgenerator.core.clientinitialization.HeaderParamClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam", + "azure.clientgenerator.core.clientinitialization.HeaderParamClient.withBody": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody", + "azure.clientgenerator.core.clientinitialization.HeaderParamClient.withBodyWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody", + "azure.clientgenerator.core.clientinitialization.HeaderParamClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery", + "azure.clientgenerator.core.clientinitialization.HeaderParamClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery", + "azure.clientgenerator.core.clientinitialization.HeaderParamClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam", + "azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams", + "azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withBody": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody", + "azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withBodyWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody", + "azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery", + "azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery", + "azure.clientgenerator.core.clientinitialization.MixedParamsClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams", + "azure.clientgenerator.core.clientinitialization.MixedParamsClient.withBody": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody", + "azure.clientgenerator.core.clientinitialization.MixedParamsClient.withBodyWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody", + "azure.clientgenerator.core.clientinitialization.MixedParamsClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery", + "azure.clientgenerator.core.clientinitialization.MixedParamsClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery", + "azure.clientgenerator.core.clientinitialization.MixedParamsClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams", + "azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams", + "azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withBody": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody", + "azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withBodyWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody", + "azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery", + "azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery", + "azure.clientgenerator.core.clientinitialization.MultipleParamsClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams", + "azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withBody": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody", + "azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withBodyWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody", + "azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery", + "azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery", + "azure.clientgenerator.core.clientinitialization.MultipleParamsClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams", + "azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias", + "azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withAliasedName": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName", + "azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withAliasedNameWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName", + "azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withOriginalName": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName", + "azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withOriginalNameWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName", + "azure.clientgenerator.core.clientinitialization.ParamAliasClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias", + "azure.clientgenerator.core.clientinitialization.ParamAliasClient.withAliasedName": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName", + "azure.clientgenerator.core.clientinitialization.ParamAliasClient.withAliasedNameWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName", + "azure.clientgenerator.core.clientinitialization.ParamAliasClient.withOriginalName": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName", + "azure.clientgenerator.core.clientinitialization.ParamAliasClient.withOriginalNameWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName", + "azure.clientgenerator.core.clientinitialization.ParamAliasClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias", + "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam", + "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.deleteStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone", + "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.deleteStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone", + "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.getStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone", + "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.getStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone", + "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery", + "azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery", + "azure.clientgenerator.core.clientinitialization.PathParamClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam", + "azure.clientgenerator.core.clientinitialization.PathParamClient.deleteStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone", + "azure.clientgenerator.core.clientinitialization.PathParamClient.deleteStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone", + "azure.clientgenerator.core.clientinitialization.PathParamClient.getStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone", + "azure.clientgenerator.core.clientinitialization.PathParamClient.getStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone", + "azure.clientgenerator.core.clientinitialization.PathParamClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery", + "azure.clientgenerator.core.clientinitialization.PathParamClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery", + "azure.clientgenerator.core.clientinitialization.PathParamClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam", + "azure.clientgenerator.core.clientinitialization.models.BlobProperties": "Service.BlobProperties", + "azure.clientgenerator.core.clientinitialization.models.Input": "Service.Input", + "azure.clientgenerator.core.clientinitialization.models.WithBodyRequest": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.withBody.Request.anonymous", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.deleteStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.deleteStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.getStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.getStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.deleteStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.deleteStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.getStandalone": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.getStandaloneWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.withQuery": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.withQueryWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery", + "azure.clientgenerator.core.clientinitialization.parentclient.ChildClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient", + "azure.clientgenerator.core.clientinitialization.parentclient.ParentAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient", + "azure.clientgenerator.core.clientinitialization.parentclient.ParentClient": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient", + "azure.clientgenerator.core.clientinitialization.parentclient.ParentClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_metadata.json new file mode 100644 index 00000000000..8b2cc8b5ed8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientinitialization_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam","azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withBody":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody","azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withBodyWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody","azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery","azure.clientgenerator.core.clientinitialization.HeaderParamAsyncClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery","azure.clientgenerator.core.clientinitialization.HeaderParamClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam","azure.clientgenerator.core.clientinitialization.HeaderParamClient.withBody":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody","azure.clientgenerator.core.clientinitialization.HeaderParamClient.withBodyWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withBody","azure.clientgenerator.core.clientinitialization.HeaderParamClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery","azure.clientgenerator.core.clientinitialization.HeaderParamClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam.withQuery","azure.clientgenerator.core.clientinitialization.HeaderParamClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.HeaderParam","azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams","azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withBody":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody","azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withBodyWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody","azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery","azure.clientgenerator.core.clientinitialization.MixedParamsAsyncClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery","azure.clientgenerator.core.clientinitialization.MixedParamsClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams","azure.clientgenerator.core.clientinitialization.MixedParamsClient.withBody":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody","azure.clientgenerator.core.clientinitialization.MixedParamsClient.withBodyWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withBody","azure.clientgenerator.core.clientinitialization.MixedParamsClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery","azure.clientgenerator.core.clientinitialization.MixedParamsClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams.withQuery","azure.clientgenerator.core.clientinitialization.MixedParamsClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MixedParams","azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams","azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withBody":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody","azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withBodyWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody","azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery","azure.clientgenerator.core.clientinitialization.MultipleParamsAsyncClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery","azure.clientgenerator.core.clientinitialization.MultipleParamsClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams","azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withBody":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody","azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withBodyWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withBody","azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery","azure.clientgenerator.core.clientinitialization.MultipleParamsClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams.withQuery","azure.clientgenerator.core.clientinitialization.MultipleParamsClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.MultipleParams","azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias","azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withAliasedName":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName","azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withAliasedNameWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName","azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withOriginalName":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName","azure.clientgenerator.core.clientinitialization.ParamAliasAsyncClient.withOriginalNameWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName","azure.clientgenerator.core.clientinitialization.ParamAliasClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias","azure.clientgenerator.core.clientinitialization.ParamAliasClient.withAliasedName":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName","azure.clientgenerator.core.clientinitialization.ParamAliasClient.withAliasedNameWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withAliasedName","azure.clientgenerator.core.clientinitialization.ParamAliasClient.withOriginalName":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName","azure.clientgenerator.core.clientinitialization.ParamAliasClient.withOriginalNameWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias.withOriginalName","azure.clientgenerator.core.clientinitialization.ParamAliasClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParamAlias","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.deleteStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.deleteStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.getStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.getStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery","azure.clientgenerator.core.clientinitialization.PathParamAsyncClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery","azure.clientgenerator.core.clientinitialization.PathParamClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam","azure.clientgenerator.core.clientinitialization.PathParamClient.deleteStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone","azure.clientgenerator.core.clientinitialization.PathParamClient.deleteStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.deleteStandalone","azure.clientgenerator.core.clientinitialization.PathParamClient.getStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone","azure.clientgenerator.core.clientinitialization.PathParamClient.getStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.getStandalone","azure.clientgenerator.core.clientinitialization.PathParamClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery","azure.clientgenerator.core.clientinitialization.PathParamClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam.withQuery","azure.clientgenerator.core.clientinitialization.PathParamClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.PathParam","azure.clientgenerator.core.clientinitialization.models.BlobProperties":"Service.BlobProperties","azure.clientgenerator.core.clientinitialization.models.Input":"Service.Input","azure.clientgenerator.core.clientinitialization.models.WithBodyRequest":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.withBody.Request.anonymous","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.deleteStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.deleteStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.getStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.getStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery","azure.clientgenerator.core.clientinitialization.parentclient.ChildAsyncClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.deleteStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.deleteStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.deleteStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.getStandalone":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.getStandaloneWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.getStandalone","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.withQuery":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery","azure.clientgenerator.core.clientinitialization.parentclient.ChildClient.withQueryWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient.withQuery","azure.clientgenerator.core.clientinitialization.parentclient.ChildClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient.ChildClient","azure.clientgenerator.core.clientinitialization.parentclient.ParentAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient","azure.clientgenerator.core.clientinitialization.parentclient.ParentClient":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient","azure.clientgenerator.core.clientinitialization.parentclient.ParentClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientInitialization.ParentClient"},"generatedFiles":["src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/HeaderParamClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/MixedParamsClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/MultipleParamsClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/ParamAliasClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/PathParamAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/PathParamClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ChildClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/HeaderParamClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MixedParamsClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/MultipleParamsClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParamAliasClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/ParentClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/PathParamClientImpl.java","src/main/java/azure/clientgenerator/core/clientinitialization/implementation/package-info.java","src/main/java/azure/clientgenerator/core/clientinitialization/models/BlobProperties.java","src/main/java/azure/clientgenerator/core/clientinitialization/models/Input.java","src/main/java/azure/clientgenerator/core/clientinitialization/models/WithBodyRequest.java","src/main/java/azure/clientgenerator/core/clientinitialization/models/package-info.java","src/main/java/azure/clientgenerator/core/clientinitialization/package-info.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ChildClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentAsyncClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClient.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/ParentClientBuilder.java","src/main/java/azure/clientgenerator/core/clientinitialization/parentclient/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_apiview_properties.json new file mode 100644 index 00000000000..68719194733 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_apiview_properties.json @@ -0,0 +1,53 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.clientlocation.ArchiveOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation", + "azure.clientgenerator.core.clientlocation.ArchiveOperationsAsyncClient.archiveProduct": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct", + "azure.clientgenerator.core.clientlocation.ArchiveOperationsAsyncClient.archiveProductWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct", + "azure.clientgenerator.core.clientlocation.ArchiveOperationsClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation", + "azure.clientgenerator.core.clientlocation.ArchiveOperationsClient.archiveProduct": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct", + "azure.clientgenerator.core.clientlocation.ArchiveOperationsClient.archiveProductWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct", + "azure.clientgenerator.core.clientlocation.ClientLocationAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation", + "azure.clientgenerator.core.clientlocation.ClientLocationAsyncClient.getHealthStatus": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus", + "azure.clientgenerator.core.clientlocation.ClientLocationAsyncClient.getHealthStatusWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus", + "azure.clientgenerator.core.clientlocation.ClientLocationClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation", + "azure.clientgenerator.core.clientlocation.ClientLocationClient.getHealthStatus": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus", + "azure.clientgenerator.core.clientlocation.ClientLocationClient.getHealthStatusWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus", + "azure.clientgenerator.core.clientlocation.ClientLocationClientBuilder": "_Specs_.Azure.ClientGenerator.Core.ClientLocation", + "azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations", + "azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsAsyncClient.getBlob": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob", + "azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsAsyncClient.getBlobWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob", + "azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations", + "azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient.getBlob": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob", + "azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient.getBlobWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.deleteUser": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.deleteUserWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.getAdminInfo": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.getAdminInfoWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.deleteUser": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.deleteUserWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.getAdminInfo": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.getAdminInfoWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsAsyncClient.getUser": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsAsyncClient.getUserWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient.getUser": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser", + "azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient.getUserWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser", + "azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations", + "azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsAsyncClient.listProducts": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts", + "azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsAsyncClient.listProductsWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts", + "azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations", + "azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient.listProducts": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts", + "azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient.listProductsWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts", + "azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations", + "azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsAsyncClient.getResource": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource", + "azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsAsyncClient.getResourceWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource", + "azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations", + "azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient.getResource": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource", + "azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient.getResourceWithResponse": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource", + "azure.clientgenerator.core.clientlocation.movemethodparametertoclient.models.Blob": "_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.Blob" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_metadata.json new file mode 100644 index 00000000000..18eab65464b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-clientlocation_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.clientlocation.ArchiveOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation","azure.clientgenerator.core.clientlocation.ArchiveOperationsAsyncClient.archiveProduct":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct","azure.clientgenerator.core.clientlocation.ArchiveOperationsAsyncClient.archiveProductWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct","azure.clientgenerator.core.clientlocation.ArchiveOperationsClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation","azure.clientgenerator.core.clientlocation.ArchiveOperationsClient.archiveProduct":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct","azure.clientgenerator.core.clientlocation.ArchiveOperationsClient.archiveProductWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.archiveProduct","azure.clientgenerator.core.clientlocation.ClientLocationAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation","azure.clientgenerator.core.clientlocation.ClientLocationAsyncClient.getHealthStatus":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus","azure.clientgenerator.core.clientlocation.ClientLocationAsyncClient.getHealthStatusWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus","azure.clientgenerator.core.clientlocation.ClientLocationClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation","azure.clientgenerator.core.clientlocation.ClientLocationClient.getHealthStatus":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus","azure.clientgenerator.core.clientlocation.ClientLocationClient.getHealthStatusWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getHealthStatus","azure.clientgenerator.core.clientlocation.ClientLocationClientBuilder":"_Specs_.Azure.ClientGenerator.Core.ClientLocation","azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations","azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsAsyncClient.getBlob":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob","azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsAsyncClient.getBlobWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob","azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations","azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient.getBlob":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob","azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient.getBlobWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.BlobOperations.getBlob","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.deleteUser":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.deleteUserWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.getAdminInfo":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsAsyncClient.getAdminInfoWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.deleteUser":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.deleteUserWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.deleteUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.getAdminInfo":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo","azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient.getAdminInfoWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.AdminOperations.getAdminInfo","azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations","azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsAsyncClient.getUser":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsAsyncClient.getUserWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations","azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient.getUser":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser","azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient.getUserWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToExistingSubClient.UserOperations.getUser","azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations","azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsAsyncClient.listProducts":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts","azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsAsyncClient.listProductsWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts","azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations","azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient.listProducts":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts","azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient.listProductsWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToNewSubClient.ProductOperations.listProducts","azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations","azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsAsyncClient.getResource":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource","azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsAsyncClient.getResourceWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource","azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations","azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient.getResource":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource","azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient.getResourceWithResponse":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveToRootClient.ResourceOperations.getResource","azure.clientgenerator.core.clientlocation.movemethodparametertoclient.models.Blob":"_Specs_.Azure.ClientGenerator.Core.ClientLocation.MoveMethodParameterToClient.Blob"},"generatedFiles":["src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/ArchiveOperationsClient.java","src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClient.java","src/main/java/azure/clientgenerator/core/clientlocation/ClientLocationClientBuilder.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveMethodParameterToBlobOperationsClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubAdminOperationsClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToExistingSubUserOperationsClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToNewSubProductOperationsClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/clientlocation/MoveToRootResourceOperationsClient.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/ArchiveOperationsImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/ClientLocationClientImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveMethodParameterToBlobOperationsImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubAdminOperationsImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToExistingSubUserOperationsImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToNewSubProductOperationsImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/MoveToRootResourceOperationsImpl.java","src/main/java/azure/clientgenerator/core/clientlocation/implementation/package-info.java","src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/Blob.java","src/main/java/azure/clientgenerator/core/clientlocation/movemethodparametertoclient/models/package-info.java","src/main/java/azure/clientgenerator/core/clientlocation/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_apiview_properties.json new file mode 100644 index 00000000000..7b58226868c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_apiview_properties.json @@ -0,0 +1,13 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullAsyncClient": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull", + "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullAsyncClient.get": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get", + "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullAsyncClient.getWithResponse": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get", + "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull", + "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient.get": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get", + "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient.getWithResponse": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get", + "azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClientBuilder": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull", + "azure.clientgenerator.core.deserialize.emptystringnull.models.ResponseModel": "_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.ResponseModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_metadata.json new file mode 100644 index 00000000000..b584ce2c196 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-deserialize-emptystringnull_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullAsyncClient":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull","azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullAsyncClient.get":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get","azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullAsyncClient.getWithResponse":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get","azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull","azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient.get":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get","azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient.getWithResponse":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.get","azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClientBuilder":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull","azure.clientgenerator.core.deserialize.emptystringnull.models.ResponseModel":"_Specs_.Azure.ClientGenerator.Core.DeserializeEmptyStringAsNull.ResponseModel"},"generatedFiles":["src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullAsyncClient.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClient.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullClientBuilder.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/DeserializeEmptyStringAsNullClientImpl.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/implementation/package-info.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/ResponseModel.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/models/package-info.java","src/main/java/azure/clientgenerator/core/deserialize/emptystringnull/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_apiview_properties.json new file mode 100644 index 00000000000..b62a2cbecf0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_apiview_properties.json @@ -0,0 +1,20 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty", + "azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel", + "azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putFlattenModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel", + "azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putNestedFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel", + "azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putNestedFlattenModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel", + "azure.clientgenerator.core.flattenproperty.FlattenPropertyClient": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty", + "azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel", + "azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putFlattenModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel", + "azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putNestedFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel", + "azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putNestedFlattenModelWithResponse": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel", + "azure.clientgenerator.core.flattenproperty.FlattenPropertyClientBuilder": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty", + "azure.clientgenerator.core.flattenproperty.models.ChildFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.ChildFlattenModel", + "azure.clientgenerator.core.flattenproperty.models.ChildModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.ChildModel", + "azure.clientgenerator.core.flattenproperty.models.FlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.FlattenModel", + "azure.clientgenerator.core.flattenproperty.models.NestedFlattenModel": "_Specs_.Azure.ClientGenerator.Core.FlattenProperty.NestedFlattenModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_metadata.json new file mode 100644 index 00000000000..91781c5335f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-flattenproperty_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty","azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putFlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putFlattenModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putNestedFlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyAsyncClient.putNestedFlattenModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyClient":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty","azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putFlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putFlattenModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putNestedFlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyClient.putNestedFlattenModelWithResponse":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.putNestedFlattenModel","azure.clientgenerator.core.flattenproperty.FlattenPropertyClientBuilder":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty","azure.clientgenerator.core.flattenproperty.models.ChildFlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.ChildFlattenModel","azure.clientgenerator.core.flattenproperty.models.ChildModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.ChildModel","azure.clientgenerator.core.flattenproperty.models.FlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.FlattenModel","azure.clientgenerator.core.flattenproperty.models.NestedFlattenModel":"_Specs_.Azure.ClientGenerator.Core.FlattenProperty.NestedFlattenModel"},"generatedFiles":["src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyAsyncClient.java","src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClient.java","src/main/java/azure/clientgenerator/core/flattenproperty/FlattenPropertyClientBuilder.java","src/main/java/azure/clientgenerator/core/flattenproperty/implementation/FlattenPropertyClientImpl.java","src/main/java/azure/clientgenerator/core/flattenproperty/implementation/package-info.java","src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildFlattenModel.java","src/main/java/azure/clientgenerator/core/flattenproperty/models/ChildModel.java","src/main/java/azure/clientgenerator/core/flattenproperty/models/FlattenModel.java","src/main/java/azure/clientgenerator/core/flattenproperty/models/NestedFlattenModel.java","src/main/java/azure/clientgenerator/core/flattenproperty/models/package-info.java","src/main/java/azure/clientgenerator/core/flattenproperty/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_apiview_properties.json new file mode 100644 index 00000000000..eb9b9c02053 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_apiview_properties.json @@ -0,0 +1,35 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations", + "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updateDogAsAnimal": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal", + "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updateDogAsAnimalWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal", + "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updatePetAsAnimal": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal", + "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updatePetAsAnimalWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal", + "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations", + "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updateDogAsAnimal": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal", + "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updateDogAsAnimalWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal", + "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updatePetAsAnimal": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal", + "azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updatePetAsAnimalWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal", + "azure.clientgenerator.core.hierarchybuilding.DogOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations", + "azure.clientgenerator.core.hierarchybuilding.DogOperationsAsyncClient.updateDogAsDog": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog", + "azure.clientgenerator.core.hierarchybuilding.DogOperationsAsyncClient.updateDogAsDogWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog", + "azure.clientgenerator.core.hierarchybuilding.DogOperationsClient": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations", + "azure.clientgenerator.core.hierarchybuilding.DogOperationsClient.updateDogAsDog": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog", + "azure.clientgenerator.core.hierarchybuilding.DogOperationsClient.updateDogAsDogWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog", + "azure.clientgenerator.core.hierarchybuilding.HierarchyBuildingClientBuilder": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding", + "azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations", + "azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updateDogAsPet": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet", + "azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updateDogAsPetWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet", + "azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updatePetAsPet": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet", + "azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updatePetAsPetWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet", + "azure.clientgenerator.core.hierarchybuilding.PetOperationsClient": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations", + "azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updateDogAsPet": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet", + "azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updateDogAsPetWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet", + "azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updatePetAsPet": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet", + "azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updatePetAsPetWithResponse": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet", + "azure.clientgenerator.core.hierarchybuilding.models.Animal": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.Animal", + "azure.clientgenerator.core.hierarchybuilding.models.Dog": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.Dog", + "azure.clientgenerator.core.hierarchybuilding.models.Pet": "_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.Pet" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_metadata.json new file mode 100644 index 00000000000..495d8219de7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-hierarchybuilding_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updateDogAsAnimal":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updateDogAsAnimalWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updatePetAsAnimal":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsAsyncClient.updatePetAsAnimalWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updateDogAsAnimal":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updateDogAsAnimalWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updateDogAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updatePetAsAnimal":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal","azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient.updatePetAsAnimalWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.AnimalOperations.updatePetAsAnimal","azure.clientgenerator.core.hierarchybuilding.DogOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations","azure.clientgenerator.core.hierarchybuilding.DogOperationsAsyncClient.updateDogAsDog":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog","azure.clientgenerator.core.hierarchybuilding.DogOperationsAsyncClient.updateDogAsDogWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog","azure.clientgenerator.core.hierarchybuilding.DogOperationsClient":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations","azure.clientgenerator.core.hierarchybuilding.DogOperationsClient.updateDogAsDog":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog","azure.clientgenerator.core.hierarchybuilding.DogOperationsClient.updateDogAsDogWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.DogOperations.updateDogAsDog","azure.clientgenerator.core.hierarchybuilding.HierarchyBuildingClientBuilder":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding","azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations","azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updateDogAsPet":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updateDogAsPetWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updatePetAsPet":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsAsyncClient.updatePetAsPetWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsClient":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations","azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updateDogAsPet":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updateDogAsPetWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updateDogAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updatePetAsPet":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet","azure.clientgenerator.core.hierarchybuilding.PetOperationsClient.updatePetAsPetWithResponse":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.PetOperations.updatePetAsPet","azure.clientgenerator.core.hierarchybuilding.models.Animal":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.Animal","azure.clientgenerator.core.hierarchybuilding.models.Dog":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.Dog","azure.clientgenerator.core.hierarchybuilding.models.Pet":"_Specs_.Azure.ClientGenerator.Core.HierarchyBuilding.Pet"},"generatedFiles":["src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/AnimalOperationsClient.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/DogOperationsClient.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/HierarchyBuildingClientBuilder.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsAsyncClient.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/PetOperationsClient.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/AnimalOperationsImpl.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/DogOperationsImpl.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/HierarchyBuildingClientImpl.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/PetOperationsImpl.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/implementation/package-info.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Animal.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Dog.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/models/Pet.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/models/package-info.java","src/main/java/azure/clientgenerator/core/hierarchybuilding/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_apiview_properties.json new file mode 100644 index 00000000000..e731f5daf59 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_apiview_properties.json @@ -0,0 +1,31 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.methodoverride.GroupParametersAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters", + "azure.clientgenerator.core.methodoverride.GroupParametersAsyncClient.group": "_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group", + "azure.clientgenerator.core.methodoverride.GroupParametersAsyncClient.groupWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group", + "azure.clientgenerator.core.methodoverride.GroupParametersClient": "_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters", + "azure.clientgenerator.core.methodoverride.GroupParametersClient.group": "_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group", + "azure.clientgenerator.core.methodoverride.GroupParametersClient.groupWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group", + "azure.clientgenerator.core.methodoverride.OverrideClientBuilder": "_Specs_.Azure.ClientGenerator.Core.Override", + "azure.clientgenerator.core.methodoverride.RemoveOptionalParameterAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter", + "azure.clientgenerator.core.methodoverride.RemoveOptionalParameterAsyncClient.removeOptional": "_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional", + "azure.clientgenerator.core.methodoverride.RemoveOptionalParameterAsyncClient.removeOptionalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional", + "azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient": "_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter", + "azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient.removeOptional": "_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional", + "azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient.removeOptionalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional", + "azure.clientgenerator.core.methodoverride.ReorderParametersAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters", + "azure.clientgenerator.core.methodoverride.ReorderParametersAsyncClient.reorder": "_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder", + "azure.clientgenerator.core.methodoverride.ReorderParametersAsyncClient.reorderWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder", + "azure.clientgenerator.core.methodoverride.ReorderParametersClient": "_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters", + "azure.clientgenerator.core.methodoverride.ReorderParametersClient.reorder": "_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder", + "azure.clientgenerator.core.methodoverride.ReorderParametersClient.reorderWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder", + "azure.clientgenerator.core.methodoverride.RequireOptionalParameterAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter", + "azure.clientgenerator.core.methodoverride.RequireOptionalParameterAsyncClient.requireOptional": "_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional", + "azure.clientgenerator.core.methodoverride.RequireOptionalParameterAsyncClient.requireOptionalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional", + "azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient": "_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter", + "azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient.requireOptional": "_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional", + "azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient.requireOptionalWithResponse": "_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional", + "azure.clientgenerator.core.methodoverride.models.GroupParametersOptions": null + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_metadata.json new file mode 100644 index 00000000000..d57f5228241 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-methodoverride_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.methodoverride.GroupParametersAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters","azure.clientgenerator.core.methodoverride.GroupParametersAsyncClient.group":"_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group","azure.clientgenerator.core.methodoverride.GroupParametersAsyncClient.groupWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group","azure.clientgenerator.core.methodoverride.GroupParametersClient":"_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters","azure.clientgenerator.core.methodoverride.GroupParametersClient.group":"_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group","azure.clientgenerator.core.methodoverride.GroupParametersClient.groupWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.GroupParameters.group","azure.clientgenerator.core.methodoverride.OverrideClientBuilder":"_Specs_.Azure.ClientGenerator.Core.Override","azure.clientgenerator.core.methodoverride.RemoveOptionalParameterAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter","azure.clientgenerator.core.methodoverride.RemoveOptionalParameterAsyncClient.removeOptional":"_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional","azure.clientgenerator.core.methodoverride.RemoveOptionalParameterAsyncClient.removeOptionalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional","azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient":"_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter","azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient.removeOptional":"_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional","azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient.removeOptionalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.RemoveOptionalParameter.removeOptional","azure.clientgenerator.core.methodoverride.ReorderParametersAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters","azure.clientgenerator.core.methodoverride.ReorderParametersAsyncClient.reorder":"_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder","azure.clientgenerator.core.methodoverride.ReorderParametersAsyncClient.reorderWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder","azure.clientgenerator.core.methodoverride.ReorderParametersClient":"_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters","azure.clientgenerator.core.methodoverride.ReorderParametersClient.reorder":"_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder","azure.clientgenerator.core.methodoverride.ReorderParametersClient.reorderWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.ReorderParameters.reorder","azure.clientgenerator.core.methodoverride.RequireOptionalParameterAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter","azure.clientgenerator.core.methodoverride.RequireOptionalParameterAsyncClient.requireOptional":"_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional","azure.clientgenerator.core.methodoverride.RequireOptionalParameterAsyncClient.requireOptionalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional","azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient":"_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter","azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient.requireOptional":"_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional","azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient.requireOptionalWithResponse":"_Specs_.Azure.ClientGenerator.Core.Override.RequireOptionalParameter.requireOptional","azure.clientgenerator.core.methodoverride.models.GroupParametersOptions":null},"generatedFiles":["src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersAsyncClient.java","src/main/java/azure/clientgenerator/core/methodoverride/GroupParametersClient.java","src/main/java/azure/clientgenerator/core/methodoverride/OverrideClientBuilder.java","src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterAsyncClient.java","src/main/java/azure/clientgenerator/core/methodoverride/RemoveOptionalParameterClient.java","src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersAsyncClient.java","src/main/java/azure/clientgenerator/core/methodoverride/ReorderParametersClient.java","src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterAsyncClient.java","src/main/java/azure/clientgenerator/core/methodoverride/RequireOptionalParameterClient.java","src/main/java/azure/clientgenerator/core/methodoverride/implementation/GroupParametersImpl.java","src/main/java/azure/clientgenerator/core/methodoverride/implementation/OverrideClientImpl.java","src/main/java/azure/clientgenerator/core/methodoverride/implementation/RemoveOptionalParametersImpl.java","src/main/java/azure/clientgenerator/core/methodoverride/implementation/ReorderParametersImpl.java","src/main/java/azure/clientgenerator/core/methodoverride/implementation/RequireOptionalParametersImpl.java","src/main/java/azure/clientgenerator/core/methodoverride/implementation/package-info.java","src/main/java/azure/clientgenerator/core/methodoverride/models/GroupParametersOptions.java","src/main/java/azure/clientgenerator/core/methodoverride/models/package-info.java","src/main/java/azure/clientgenerator/core/methodoverride/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_apiview_properties.json new file mode 100644 index 00000000000..c07cf51fbfc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_apiview_properties.json @@ -0,0 +1,11 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.nextlinkverb.NextLinkVerbAsyncClient": "_Specs_.Azure.ClientGenerator.Core.NextLinkVerb", + "azure.clientgenerator.core.nextlinkverb.NextLinkVerbAsyncClient.listItems": "_Specs_.Azure.ClientGenerator.Core.NextLinkVerb.listItems", + "azure.clientgenerator.core.nextlinkverb.NextLinkVerbClient": "_Specs_.Azure.ClientGenerator.Core.NextLinkVerb", + "azure.clientgenerator.core.nextlinkverb.NextLinkVerbClient.listItems": "_Specs_.Azure.ClientGenerator.Core.NextLinkVerb.listItems", + "azure.clientgenerator.core.nextlinkverb.NextLinkVerbClientBuilder": "_Specs_.Azure.ClientGenerator.Core.NextLinkVerb", + "azure.clientgenerator.core.nextlinkverb.models.Test": "_Specs_.Azure.ClientGenerator.Core.NextLinkVerb.Test" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_metadata.json new file mode 100644 index 00000000000..052cd7c74fe --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-nextlinkverb_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.nextlinkverb.NextLinkVerbAsyncClient":"_Specs_.Azure.ClientGenerator.Core.NextLinkVerb","azure.clientgenerator.core.nextlinkverb.NextLinkVerbAsyncClient.listItems":"_Specs_.Azure.ClientGenerator.Core.NextLinkVerb.listItems","azure.clientgenerator.core.nextlinkverb.NextLinkVerbClient":"_Specs_.Azure.ClientGenerator.Core.NextLinkVerb","azure.clientgenerator.core.nextlinkverb.NextLinkVerbClient.listItems":"_Specs_.Azure.ClientGenerator.Core.NextLinkVerb.listItems","azure.clientgenerator.core.nextlinkverb.NextLinkVerbClientBuilder":"_Specs_.Azure.ClientGenerator.Core.NextLinkVerb","azure.clientgenerator.core.nextlinkverb.models.Test":"_Specs_.Azure.ClientGenerator.Core.NextLinkVerb.Test"},"generatedFiles":["src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbAsyncClient.java","src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClient.java","src/main/java/azure/clientgenerator/core/nextlinkverb/NextLinkVerbClientBuilder.java","src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/NextLinkVerbClientImpl.java","src/main/java/azure/clientgenerator/core/nextlinkverb/implementation/package-info.java","src/main/java/azure/clientgenerator/core/nextlinkverb/models/Test.java","src/main/java/azure/clientgenerator/core/nextlinkverb/models/package-info.java","src/main/java/azure/clientgenerator/core/nextlinkverb/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_apiview_properties.json new file mode 100644 index 00000000000..0fc1637b80a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_apiview_properties.json @@ -0,0 +1,25 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.clientgenerator.core.usage.UsageAsyncClient": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation", + "azure.clientgenerator.core.usage.UsageAsyncClient.inputToInputOutput": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput", + "azure.clientgenerator.core.usage.UsageAsyncClient.inputToInputOutputWithResponse": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput", + "azure.clientgenerator.core.usage.UsageAsyncClient.modelInReadOnlyProperty": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty", + "azure.clientgenerator.core.usage.UsageAsyncClient.modelInReadOnlyPropertyWithResponse": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty", + "azure.clientgenerator.core.usage.UsageAsyncClient.outputToInputOutput": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput", + "azure.clientgenerator.core.usage.UsageAsyncClient.outputToInputOutputWithResponse": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput", + "azure.clientgenerator.core.usage.UsageClient": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation", + "azure.clientgenerator.core.usage.UsageClient.inputToInputOutput": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput", + "azure.clientgenerator.core.usage.UsageClient.inputToInputOutputWithResponse": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput", + "azure.clientgenerator.core.usage.UsageClient.modelInReadOnlyProperty": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty", + "azure.clientgenerator.core.usage.UsageClient.modelInReadOnlyPropertyWithResponse": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty", + "azure.clientgenerator.core.usage.UsageClient.outputToInputOutput": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput", + "azure.clientgenerator.core.usage.UsageClient.outputToInputOutputWithResponse": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput", + "azure.clientgenerator.core.usage.UsageClientBuilder": "_Specs_.Azure.ClientGenerator.Core.Usage", + "azure.clientgenerator.core.usage.models.InputModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.InputModel", + "azure.clientgenerator.core.usage.models.OrphanModel": "_Specs_.Azure.ClientGenerator.Core.Usage.OrphanModel", + "azure.clientgenerator.core.usage.models.OutputModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.OutputModel", + "azure.clientgenerator.core.usage.models.ResultModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.ResultModel", + "azure.clientgenerator.core.usage.models.RoundTripModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.RoundTripModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_metadata.json new file mode 100644 index 00000000000..8b43ddbb1ba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-clientgenerator-core-usage_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.clientgenerator.core.usage.UsageAsyncClient":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation","azure.clientgenerator.core.usage.UsageAsyncClient.inputToInputOutput":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput","azure.clientgenerator.core.usage.UsageAsyncClient.inputToInputOutputWithResponse":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput","azure.clientgenerator.core.usage.UsageAsyncClient.modelInReadOnlyProperty":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty","azure.clientgenerator.core.usage.UsageAsyncClient.modelInReadOnlyPropertyWithResponse":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty","azure.clientgenerator.core.usage.UsageAsyncClient.outputToInputOutput":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput","azure.clientgenerator.core.usage.UsageAsyncClient.outputToInputOutputWithResponse":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput","azure.clientgenerator.core.usage.UsageClient":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation","azure.clientgenerator.core.usage.UsageClient.inputToInputOutput":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput","azure.clientgenerator.core.usage.UsageClient.inputToInputOutputWithResponse":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.inputToInputOutput","azure.clientgenerator.core.usage.UsageClient.modelInReadOnlyProperty":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty","azure.clientgenerator.core.usage.UsageClient.modelInReadOnlyPropertyWithResponse":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty","azure.clientgenerator.core.usage.UsageClient.outputToInputOutput":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput","azure.clientgenerator.core.usage.UsageClient.outputToInputOutputWithResponse":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.outputToInputOutput","azure.clientgenerator.core.usage.UsageClientBuilder":"_Specs_.Azure.ClientGenerator.Core.Usage","azure.clientgenerator.core.usage.models.InputModel":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.InputModel","azure.clientgenerator.core.usage.models.OrphanModel":"_Specs_.Azure.ClientGenerator.Core.Usage.OrphanModel","azure.clientgenerator.core.usage.models.OutputModel":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.OutputModel","azure.clientgenerator.core.usage.models.ResultModel":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.ResultModel","azure.clientgenerator.core.usage.models.RoundTripModel":"_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.RoundTripModel"},"generatedFiles":["src/main/java/azure/clientgenerator/core/usage/UsageAsyncClient.java","src/main/java/azure/clientgenerator/core/usage/UsageClient.java","src/main/java/azure/clientgenerator/core/usage/UsageClientBuilder.java","src/main/java/azure/clientgenerator/core/usage/implementation/ModelInOperationsImpl.java","src/main/java/azure/clientgenerator/core/usage/implementation/UsageClientImpl.java","src/main/java/azure/clientgenerator/core/usage/implementation/package-info.java","src/main/java/azure/clientgenerator/core/usage/models/InputModel.java","src/main/java/azure/clientgenerator/core/usage/models/OrphanModel.java","src/main/java/azure/clientgenerator/core/usage/models/OutputModel.java","src/main/java/azure/clientgenerator/core/usage/models/ResultModel.java","src/main/java/azure/clientgenerator/core/usage/models/RoundTripModel.java","src/main/java/azure/clientgenerator/core/usage/models/package-info.java","src/main/java/azure/clientgenerator/core/usage/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_apiview_properties.json new file mode 100644 index 00000000000..6adeef17226 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_apiview_properties.json @@ -0,0 +1,37 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.core.basic.BasicAsyncClient": "_Specs_.Azure.Core.Basic", + "azure.core.basic.BasicAsyncClient.createOrReplace": "_Specs_.Azure.Core.Basic.createOrReplace", + "azure.core.basic.BasicAsyncClient.createOrReplaceWithResponse": "_Specs_.Azure.Core.Basic.createOrReplace", + "azure.core.basic.BasicAsyncClient.createOrUpdate": "_Specs_.Azure.Core.Basic.createOrUpdate", + "azure.core.basic.BasicAsyncClient.createOrUpdateWithResponse": "_Specs_.Azure.Core.Basic.createOrUpdate", + "azure.core.basic.BasicAsyncClient.delete": "_Specs_.Azure.Core.Basic.delete", + "azure.core.basic.BasicAsyncClient.deleteWithResponse": "_Specs_.Azure.Core.Basic.delete", + "azure.core.basic.BasicAsyncClient.export": "_Specs_.Azure.Core.Basic.export", + "azure.core.basic.BasicAsyncClient.exportAllUsers": "_Specs_.Azure.Core.Basic.exportAllUsers", + "azure.core.basic.BasicAsyncClient.exportAllUsersWithResponse": "_Specs_.Azure.Core.Basic.exportAllUsers", + "azure.core.basic.BasicAsyncClient.exportWithResponse": "_Specs_.Azure.Core.Basic.export", + "azure.core.basic.BasicAsyncClient.get": "_Specs_.Azure.Core.Basic.get", + "azure.core.basic.BasicAsyncClient.getWithResponse": "_Specs_.Azure.Core.Basic.get", + "azure.core.basic.BasicAsyncClient.list": "_Specs_.Azure.Core.Basic.list", + "azure.core.basic.BasicClient": "_Specs_.Azure.Core.Basic", + "azure.core.basic.BasicClient.createOrReplace": "_Specs_.Azure.Core.Basic.createOrReplace", + "azure.core.basic.BasicClient.createOrReplaceWithResponse": "_Specs_.Azure.Core.Basic.createOrReplace", + "azure.core.basic.BasicClient.createOrUpdate": "_Specs_.Azure.Core.Basic.createOrUpdate", + "azure.core.basic.BasicClient.createOrUpdateWithResponse": "_Specs_.Azure.Core.Basic.createOrUpdate", + "azure.core.basic.BasicClient.delete": "_Specs_.Azure.Core.Basic.delete", + "azure.core.basic.BasicClient.deleteWithResponse": "_Specs_.Azure.Core.Basic.delete", + "azure.core.basic.BasicClient.export": "_Specs_.Azure.Core.Basic.export", + "azure.core.basic.BasicClient.exportAllUsers": "_Specs_.Azure.Core.Basic.exportAllUsers", + "azure.core.basic.BasicClient.exportAllUsersWithResponse": "_Specs_.Azure.Core.Basic.exportAllUsers", + "azure.core.basic.BasicClient.exportWithResponse": "_Specs_.Azure.Core.Basic.export", + "azure.core.basic.BasicClient.get": "_Specs_.Azure.Core.Basic.get", + "azure.core.basic.BasicClient.getWithResponse": "_Specs_.Azure.Core.Basic.get", + "azure.core.basic.BasicClient.list": "_Specs_.Azure.Core.Basic.list", + "azure.core.basic.BasicClientBuilder": "_Specs_.Azure.Core.Basic", + "azure.core.basic.models.User": "_Specs_.Azure.Core.Basic.User", + "azure.core.basic.models.UserList": "_Specs_.Azure.Core.Basic.UserList", + "azure.core.basic.models.UserOrder": "_Specs_.Azure.Core.Basic.UserOrder" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_metadata.json new file mode 100644 index 00000000000..af3ee916621 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-basic_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.basic.BasicAsyncClient":"_Specs_.Azure.Core.Basic","azure.core.basic.BasicAsyncClient.createOrReplace":"_Specs_.Azure.Core.Basic.createOrReplace","azure.core.basic.BasicAsyncClient.createOrReplaceWithResponse":"_Specs_.Azure.Core.Basic.createOrReplace","azure.core.basic.BasicAsyncClient.createOrUpdate":"_Specs_.Azure.Core.Basic.createOrUpdate","azure.core.basic.BasicAsyncClient.createOrUpdateWithResponse":"_Specs_.Azure.Core.Basic.createOrUpdate","azure.core.basic.BasicAsyncClient.delete":"_Specs_.Azure.Core.Basic.delete","azure.core.basic.BasicAsyncClient.deleteWithResponse":"_Specs_.Azure.Core.Basic.delete","azure.core.basic.BasicAsyncClient.export":"_Specs_.Azure.Core.Basic.export","azure.core.basic.BasicAsyncClient.exportAllUsers":"_Specs_.Azure.Core.Basic.exportAllUsers","azure.core.basic.BasicAsyncClient.exportAllUsersWithResponse":"_Specs_.Azure.Core.Basic.exportAllUsers","azure.core.basic.BasicAsyncClient.exportWithResponse":"_Specs_.Azure.Core.Basic.export","azure.core.basic.BasicAsyncClient.get":"_Specs_.Azure.Core.Basic.get","azure.core.basic.BasicAsyncClient.getWithResponse":"_Specs_.Azure.Core.Basic.get","azure.core.basic.BasicAsyncClient.list":"_Specs_.Azure.Core.Basic.list","azure.core.basic.BasicClient":"_Specs_.Azure.Core.Basic","azure.core.basic.BasicClient.createOrReplace":"_Specs_.Azure.Core.Basic.createOrReplace","azure.core.basic.BasicClient.createOrReplaceWithResponse":"_Specs_.Azure.Core.Basic.createOrReplace","azure.core.basic.BasicClient.createOrUpdate":"_Specs_.Azure.Core.Basic.createOrUpdate","azure.core.basic.BasicClient.createOrUpdateWithResponse":"_Specs_.Azure.Core.Basic.createOrUpdate","azure.core.basic.BasicClient.delete":"_Specs_.Azure.Core.Basic.delete","azure.core.basic.BasicClient.deleteWithResponse":"_Specs_.Azure.Core.Basic.delete","azure.core.basic.BasicClient.export":"_Specs_.Azure.Core.Basic.export","azure.core.basic.BasicClient.exportAllUsers":"_Specs_.Azure.Core.Basic.exportAllUsers","azure.core.basic.BasicClient.exportAllUsersWithResponse":"_Specs_.Azure.Core.Basic.exportAllUsers","azure.core.basic.BasicClient.exportWithResponse":"_Specs_.Azure.Core.Basic.export","azure.core.basic.BasicClient.get":"_Specs_.Azure.Core.Basic.get","azure.core.basic.BasicClient.getWithResponse":"_Specs_.Azure.Core.Basic.get","azure.core.basic.BasicClient.list":"_Specs_.Azure.Core.Basic.list","azure.core.basic.BasicClientBuilder":"_Specs_.Azure.Core.Basic","azure.core.basic.models.User":"_Specs_.Azure.Core.Basic.User","azure.core.basic.models.UserList":"_Specs_.Azure.Core.Basic.UserList","azure.core.basic.models.UserOrder":"_Specs_.Azure.Core.Basic.UserOrder"},"generatedFiles":["src/main/java/azure/core/basic/BasicAsyncClient.java","src/main/java/azure/core/basic/BasicClient.java","src/main/java/azure/core/basic/BasicClientBuilder.java","src/main/java/azure/core/basic/BasicServiceVersion.java","src/main/java/azure/core/basic/implementation/BasicClientImpl.java","src/main/java/azure/core/basic/implementation/JsonMergePatchHelper.java","src/main/java/azure/core/basic/implementation/package-info.java","src/main/java/azure/core/basic/models/User.java","src/main/java/azure/core/basic/models/UserList.java","src/main/java/azure/core/basic/models/UserOrder.java","src/main/java/azure/core/basic/models/package-info.java","src/main/java/azure/core/basic/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_apiview_properties.json new file mode 100644 index 00000000000..2f41d55d8dc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_apiview_properties.json @@ -0,0 +1,14 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.core.lro.rpc.RpcAsyncClient": "_Specs_.Azure.Core.Lro.Rpc", + "azure.core.lro.rpc.RpcAsyncClient.beginLongRunningRpc": "_Specs_.Azure.Core.Lro.Rpc.longRunningRpc", + "azure.core.lro.rpc.RpcAsyncClient.beginLongRunningRpcWithModel": "_Specs_.Azure.Core.Lro.Rpc.longRunningRpc", + "azure.core.lro.rpc.RpcClient": "_Specs_.Azure.Core.Lro.Rpc", + "azure.core.lro.rpc.RpcClient.beginLongRunningRpc": "_Specs_.Azure.Core.Lro.Rpc.longRunningRpc", + "azure.core.lro.rpc.RpcClient.beginLongRunningRpcWithModel": "_Specs_.Azure.Core.Lro.Rpc.longRunningRpc", + "azure.core.lro.rpc.RpcClientBuilder": "_Specs_.Azure.Core.Lro.Rpc", + "azure.core.lro.rpc.models.GenerationOptions": "_Specs_.Azure.Core.Lro.Rpc.GenerationOptions", + "azure.core.lro.rpc.models.GenerationResult": "_Specs_.Azure.Core.Lro.Rpc.GenerationResult" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_metadata.json new file mode 100644 index 00000000000..779d36e24f7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-rpc_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.lro.rpc.RpcAsyncClient":"_Specs_.Azure.Core.Lro.Rpc","azure.core.lro.rpc.RpcAsyncClient.beginLongRunningRpc":"_Specs_.Azure.Core.Lro.Rpc.longRunningRpc","azure.core.lro.rpc.RpcAsyncClient.beginLongRunningRpcWithModel":"_Specs_.Azure.Core.Lro.Rpc.longRunningRpc","azure.core.lro.rpc.RpcClient":"_Specs_.Azure.Core.Lro.Rpc","azure.core.lro.rpc.RpcClient.beginLongRunningRpc":"_Specs_.Azure.Core.Lro.Rpc.longRunningRpc","azure.core.lro.rpc.RpcClient.beginLongRunningRpcWithModel":"_Specs_.Azure.Core.Lro.Rpc.longRunningRpc","azure.core.lro.rpc.RpcClientBuilder":"_Specs_.Azure.Core.Lro.Rpc","azure.core.lro.rpc.models.GenerationOptions":"_Specs_.Azure.Core.Lro.Rpc.GenerationOptions","azure.core.lro.rpc.models.GenerationResult":"_Specs_.Azure.Core.Lro.Rpc.GenerationResult"},"generatedFiles":["src/main/java/azure/core/lro/rpc/RpcAsyncClient.java","src/main/java/azure/core/lro/rpc/RpcClient.java","src/main/java/azure/core/lro/rpc/RpcClientBuilder.java","src/main/java/azure/core/lro/rpc/RpcServiceVersion.java","src/main/java/azure/core/lro/rpc/implementation/OperationLocationPollingStrategy.java","src/main/java/azure/core/lro/rpc/implementation/PollingUtils.java","src/main/java/azure/core/lro/rpc/implementation/RpcClientImpl.java","src/main/java/azure/core/lro/rpc/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/azure/core/lro/rpc/implementation/package-info.java","src/main/java/azure/core/lro/rpc/models/GenerationOptions.java","src/main/java/azure/core/lro/rpc/models/GenerationResult.java","src/main/java/azure/core/lro/rpc/models/package-info.java","src/main/java/azure/core/lro/rpc/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_apiview_properties.json new file mode 100644 index 00000000000..f595608fbe1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_apiview_properties.json @@ -0,0 +1,22 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.core.lro.standard.StandardAsyncClient": "_Specs_.Azure.Core.Lro.Standard", + "azure.core.lro.standard.StandardAsyncClient.beginCreateOrReplace": "_Specs_.Azure.Core.Lro.Standard.createOrReplace", + "azure.core.lro.standard.StandardAsyncClient.beginCreateOrReplaceWithModel": "_Specs_.Azure.Core.Lro.Standard.createOrReplace", + "azure.core.lro.standard.StandardAsyncClient.beginDelete": "_Specs_.Azure.Core.Lro.Standard.delete", + "azure.core.lro.standard.StandardAsyncClient.beginDeleteWithModel": "_Specs_.Azure.Core.Lro.Standard.delete", + "azure.core.lro.standard.StandardAsyncClient.beginExport": "_Specs_.Azure.Core.Lro.Standard.export", + "azure.core.lro.standard.StandardAsyncClient.beginExportWithModel": "_Specs_.Azure.Core.Lro.Standard.export", + "azure.core.lro.standard.StandardClient": "_Specs_.Azure.Core.Lro.Standard", + "azure.core.lro.standard.StandardClient.beginCreateOrReplace": "_Specs_.Azure.Core.Lro.Standard.createOrReplace", + "azure.core.lro.standard.StandardClient.beginCreateOrReplaceWithModel": "_Specs_.Azure.Core.Lro.Standard.createOrReplace", + "azure.core.lro.standard.StandardClient.beginDelete": "_Specs_.Azure.Core.Lro.Standard.delete", + "azure.core.lro.standard.StandardClient.beginDeleteWithModel": "_Specs_.Azure.Core.Lro.Standard.delete", + "azure.core.lro.standard.StandardClient.beginExport": "_Specs_.Azure.Core.Lro.Standard.export", + "azure.core.lro.standard.StandardClient.beginExportWithModel": "_Specs_.Azure.Core.Lro.Standard.export", + "azure.core.lro.standard.StandardClientBuilder": "_Specs_.Azure.Core.Lro.Standard", + "azure.core.lro.standard.models.ExportedUser": "_Specs_.Azure.Core.Lro.Standard.ExportedUser", + "azure.core.lro.standard.models.User": "_Specs_.Azure.Core.Lro.Standard.User" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_metadata.json new file mode 100644 index 00000000000..e826d2e20c1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-lro-standard_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.lro.standard.StandardAsyncClient":"_Specs_.Azure.Core.Lro.Standard","azure.core.lro.standard.StandardAsyncClient.beginCreateOrReplace":"_Specs_.Azure.Core.Lro.Standard.createOrReplace","azure.core.lro.standard.StandardAsyncClient.beginCreateOrReplaceWithModel":"_Specs_.Azure.Core.Lro.Standard.createOrReplace","azure.core.lro.standard.StandardAsyncClient.beginDelete":"_Specs_.Azure.Core.Lro.Standard.delete","azure.core.lro.standard.StandardAsyncClient.beginDeleteWithModel":"_Specs_.Azure.Core.Lro.Standard.delete","azure.core.lro.standard.StandardAsyncClient.beginExport":"_Specs_.Azure.Core.Lro.Standard.export","azure.core.lro.standard.StandardAsyncClient.beginExportWithModel":"_Specs_.Azure.Core.Lro.Standard.export","azure.core.lro.standard.StandardClient":"_Specs_.Azure.Core.Lro.Standard","azure.core.lro.standard.StandardClient.beginCreateOrReplace":"_Specs_.Azure.Core.Lro.Standard.createOrReplace","azure.core.lro.standard.StandardClient.beginCreateOrReplaceWithModel":"_Specs_.Azure.Core.Lro.Standard.createOrReplace","azure.core.lro.standard.StandardClient.beginDelete":"_Specs_.Azure.Core.Lro.Standard.delete","azure.core.lro.standard.StandardClient.beginDeleteWithModel":"_Specs_.Azure.Core.Lro.Standard.delete","azure.core.lro.standard.StandardClient.beginExport":"_Specs_.Azure.Core.Lro.Standard.export","azure.core.lro.standard.StandardClient.beginExportWithModel":"_Specs_.Azure.Core.Lro.Standard.export","azure.core.lro.standard.StandardClientBuilder":"_Specs_.Azure.Core.Lro.Standard","azure.core.lro.standard.models.ExportedUser":"_Specs_.Azure.Core.Lro.Standard.ExportedUser","azure.core.lro.standard.models.User":"_Specs_.Azure.Core.Lro.Standard.User"},"generatedFiles":["src/main/java/azure/core/lro/standard/StandardAsyncClient.java","src/main/java/azure/core/lro/standard/StandardClient.java","src/main/java/azure/core/lro/standard/StandardClientBuilder.java","src/main/java/azure/core/lro/standard/StandardServiceVersion.java","src/main/java/azure/core/lro/standard/implementation/OperationLocationPollingStrategy.java","src/main/java/azure/core/lro/standard/implementation/PollingUtils.java","src/main/java/azure/core/lro/standard/implementation/StandardClientImpl.java","src/main/java/azure/core/lro/standard/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/azure/core/lro/standard/implementation/package-info.java","src/main/java/azure/core/lro/standard/models/ExportedUser.java","src/main/java/azure/core/lro/standard/models/User.java","src/main/java/azure/core/lro/standard/models/package-info.java","src/main/java/azure/core/lro/standard/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_apiview_properties.json new file mode 100644 index 00000000000..2d2610f90c8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_apiview_properties.json @@ -0,0 +1,21 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.core.model.ModelAsyncClient": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector", + "azure.core.model.ModelAsyncClient.get": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get", + "azure.core.model.ModelAsyncClient.getWithResponse": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get", + "azure.core.model.ModelAsyncClient.post": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post", + "azure.core.model.ModelAsyncClient.postWithResponse": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post", + "azure.core.model.ModelAsyncClient.put": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put", + "azure.core.model.ModelAsyncClient.putWithResponse": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put", + "azure.core.model.ModelClient": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector", + "azure.core.model.ModelClient.get": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get", + "azure.core.model.ModelClient.getWithResponse": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get", + "azure.core.model.ModelClient.post": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post", + "azure.core.model.ModelClient.postWithResponse": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post", + "azure.core.model.ModelClient.put": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put", + "azure.core.model.ModelClient.putWithResponse": "_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put", + "azure.core.model.ModelClientBuilder": "_Specs_.Azure.Core.Model", + "azure.core.model.models.AzureEmbeddingModel": "_Specs_.Azure.Core.Model.AzureEmbeddingModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_metadata.json new file mode 100644 index 00000000000..d33186735b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-model_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.model.ModelAsyncClient":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector","azure.core.model.ModelAsyncClient.get":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get","azure.core.model.ModelAsyncClient.getWithResponse":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get","azure.core.model.ModelAsyncClient.post":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post","azure.core.model.ModelAsyncClient.postWithResponse":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post","azure.core.model.ModelAsyncClient.put":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put","azure.core.model.ModelAsyncClient.putWithResponse":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put","azure.core.model.ModelClient":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector","azure.core.model.ModelClient.get":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get","azure.core.model.ModelClient.getWithResponse":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.get","azure.core.model.ModelClient.post":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post","azure.core.model.ModelClient.postWithResponse":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.post","azure.core.model.ModelClient.put":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put","azure.core.model.ModelClient.putWithResponse":"_Specs_.Azure.Core.Model.AzureCoreEmbeddingVector.put","azure.core.model.ModelClientBuilder":"_Specs_.Azure.Core.Model","azure.core.model.models.AzureEmbeddingModel":"_Specs_.Azure.Core.Model.AzureEmbeddingModel"},"generatedFiles":["src/main/java/azure/core/model/ModelAsyncClient.java","src/main/java/azure/core/model/ModelClient.java","src/main/java/azure/core/model/ModelClientBuilder.java","src/main/java/azure/core/model/ModelServiceVersion.java","src/main/java/azure/core/model/implementation/AzureCoreEmbeddingVectorsImpl.java","src/main/java/azure/core/model/implementation/ModelClientImpl.java","src/main/java/azure/core/model/implementation/package-info.java","src/main/java/azure/core/model/models/AzureEmbeddingModel.java","src/main/java/azure/core/model/models/package-info.java","src/main/java/azure/core/model/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_apiview_properties.json new file mode 100644 index 00000000000..bbd2a4eae5d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_apiview_properties.json @@ -0,0 +1,28 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.core.page.PageAsyncClient": "_Specs_.Azure.Core.Page", + "azure.core.page.PageAsyncClient.listWithCustomPageModel": "_Specs_.Azure.Core.Page.listWithCustomPageModel", + "azure.core.page.PageAsyncClient.listWithPage": "_Specs_.Azure.Core.Page.listWithPage", + "azure.core.page.PageAsyncClient.listWithParameters": "_Specs_.Azure.Core.Page.listWithParameters", + "azure.core.page.PageAsyncClient.withParameterizedNextLink": "_Specs_.Azure.Core.Page.withParameterizedNextLink", + "azure.core.page.PageClient": "_Specs_.Azure.Core.Page", + "azure.core.page.PageClient.listWithCustomPageModel": "_Specs_.Azure.Core.Page.listWithCustomPageModel", + "azure.core.page.PageClient.listWithPage": "_Specs_.Azure.Core.Page.listWithPage", + "azure.core.page.PageClient.listWithParameters": "_Specs_.Azure.Core.Page.listWithParameters", + "azure.core.page.PageClient.withParameterizedNextLink": "_Specs_.Azure.Core.Page.withParameterizedNextLink", + "azure.core.page.PageClientBuilder": "_Specs_.Azure.Core.Page", + "azure.core.page.TwoModelsAsPageItemAsyncClient": "_Specs_.Azure.Core.Page.TwoModelsAsPageItem", + "azure.core.page.TwoModelsAsPageItemAsyncClient.listFirstItem": "_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listFirstItem", + "azure.core.page.TwoModelsAsPageItemAsyncClient.listSecondItem": "_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listSecondItem", + "azure.core.page.TwoModelsAsPageItemClient": "_Specs_.Azure.Core.Page.TwoModelsAsPageItem", + "azure.core.page.TwoModelsAsPageItemClient.listFirstItem": "_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listFirstItem", + "azure.core.page.TwoModelsAsPageItemClient.listSecondItem": "_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listSecondItem", + "azure.core.page.models.FirstItem": "_Specs_.Azure.Core.Page.FirstItem", + "azure.core.page.models.ListItemInputBody": "_Specs_.Azure.Core.Page.ListItemInputBody", + "azure.core.page.models.ListItemInputExtensibleEnum": "_Specs_.Azure.Core.Page.ListItemInputExtensibleEnum", + "azure.core.page.models.SecondItem": "_Specs_.Azure.Core.Page.SecondItem", + "azure.core.page.models.User": "_Specs_.Azure.Core.Page.User", + "azure.core.page.models.UserOrder": "_Specs_.Azure.Core.Page.UserOrder" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_metadata.json new file mode 100644 index 00000000000..fb07c449bde --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-page_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.page.PageAsyncClient":"_Specs_.Azure.Core.Page","azure.core.page.PageAsyncClient.listWithCustomPageModel":"_Specs_.Azure.Core.Page.listWithCustomPageModel","azure.core.page.PageAsyncClient.listWithPage":"_Specs_.Azure.Core.Page.listWithPage","azure.core.page.PageAsyncClient.listWithParameters":"_Specs_.Azure.Core.Page.listWithParameters","azure.core.page.PageAsyncClient.withParameterizedNextLink":"_Specs_.Azure.Core.Page.withParameterizedNextLink","azure.core.page.PageClient":"_Specs_.Azure.Core.Page","azure.core.page.PageClient.listWithCustomPageModel":"_Specs_.Azure.Core.Page.listWithCustomPageModel","azure.core.page.PageClient.listWithPage":"_Specs_.Azure.Core.Page.listWithPage","azure.core.page.PageClient.listWithParameters":"_Specs_.Azure.Core.Page.listWithParameters","azure.core.page.PageClient.withParameterizedNextLink":"_Specs_.Azure.Core.Page.withParameterizedNextLink","azure.core.page.PageClientBuilder":"_Specs_.Azure.Core.Page","azure.core.page.TwoModelsAsPageItemAsyncClient":"_Specs_.Azure.Core.Page.TwoModelsAsPageItem","azure.core.page.TwoModelsAsPageItemAsyncClient.listFirstItem":"_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listFirstItem","azure.core.page.TwoModelsAsPageItemAsyncClient.listSecondItem":"_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listSecondItem","azure.core.page.TwoModelsAsPageItemClient":"_Specs_.Azure.Core.Page.TwoModelsAsPageItem","azure.core.page.TwoModelsAsPageItemClient.listFirstItem":"_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listFirstItem","azure.core.page.TwoModelsAsPageItemClient.listSecondItem":"_Specs_.Azure.Core.Page.TwoModelsAsPageItem.listSecondItem","azure.core.page.models.FirstItem":"_Specs_.Azure.Core.Page.FirstItem","azure.core.page.models.ListItemInputBody":"_Specs_.Azure.Core.Page.ListItemInputBody","azure.core.page.models.ListItemInputExtensibleEnum":"_Specs_.Azure.Core.Page.ListItemInputExtensibleEnum","azure.core.page.models.SecondItem":"_Specs_.Azure.Core.Page.SecondItem","azure.core.page.models.User":"_Specs_.Azure.Core.Page.User","azure.core.page.models.UserOrder":"_Specs_.Azure.Core.Page.UserOrder"},"generatedFiles":["src/main/java/azure/core/page/PageAsyncClient.java","src/main/java/azure/core/page/PageClient.java","src/main/java/azure/core/page/PageClientBuilder.java","src/main/java/azure/core/page/PageServiceVersion.java","src/main/java/azure/core/page/TwoModelsAsPageItemAsyncClient.java","src/main/java/azure/core/page/TwoModelsAsPageItemClient.java","src/main/java/azure/core/page/implementation/PageClientImpl.java","src/main/java/azure/core/page/implementation/TwoModelsAsPageItemsImpl.java","src/main/java/azure/core/page/implementation/package-info.java","src/main/java/azure/core/page/models/FirstItem.java","src/main/java/azure/core/page/models/ListItemInputBody.java","src/main/java/azure/core/page/models/ListItemInputExtensibleEnum.java","src/main/java/azure/core/page/models/SecondItem.java","src/main/java/azure/core/page/models/User.java","src/main/java/azure/core/page/models/UserOrder.java","src/main/java/azure/core/page/models/package-info.java","src/main/java/azure/core/page/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_apiview_properties.json new file mode 100644 index 00000000000..5f4385ca34e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_apiview_properties.json @@ -0,0 +1,29 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.core.scalar.ScalarAsyncClient": "_Specs_.Azure.Core.Scalar.AzureLocationScalar", + "azure.core.scalar.ScalarAsyncClient.get": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.get", + "azure.core.scalar.ScalarAsyncClient.getWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.get", + "azure.core.scalar.ScalarAsyncClient.headerMethod": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.header", + "azure.core.scalar.ScalarAsyncClient.headerMethodWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.header", + "azure.core.scalar.ScalarAsyncClient.post": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.post", + "azure.core.scalar.ScalarAsyncClient.postWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.post", + "azure.core.scalar.ScalarAsyncClient.put": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.put", + "azure.core.scalar.ScalarAsyncClient.putWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.put", + "azure.core.scalar.ScalarAsyncClient.query": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.query", + "azure.core.scalar.ScalarAsyncClient.queryWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.query", + "azure.core.scalar.ScalarClient": "_Specs_.Azure.Core.Scalar.AzureLocationScalar", + "azure.core.scalar.ScalarClient.get": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.get", + "azure.core.scalar.ScalarClient.getWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.get", + "azure.core.scalar.ScalarClient.headerMethod": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.header", + "azure.core.scalar.ScalarClient.headerMethodWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.header", + "azure.core.scalar.ScalarClient.post": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.post", + "azure.core.scalar.ScalarClient.postWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.post", + "azure.core.scalar.ScalarClient.put": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.put", + "azure.core.scalar.ScalarClient.putWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.put", + "azure.core.scalar.ScalarClient.query": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.query", + "azure.core.scalar.ScalarClient.queryWithResponse": "_Specs_.Azure.Core.Scalar.AzureLocationScalar.query", + "azure.core.scalar.ScalarClientBuilder": "_Specs_.Azure.Core.Scalar", + "azure.core.scalar.models.AzureLocationModel": "_Specs_.Azure.Core.Scalar.AzureLocationModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_metadata.json new file mode 100644 index 00000000000..9751e756fd3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-scalar_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.scalar.ScalarAsyncClient":"_Specs_.Azure.Core.Scalar.AzureLocationScalar","azure.core.scalar.ScalarAsyncClient.get":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.get","azure.core.scalar.ScalarAsyncClient.getWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.get","azure.core.scalar.ScalarAsyncClient.headerMethod":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.header","azure.core.scalar.ScalarAsyncClient.headerMethodWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.header","azure.core.scalar.ScalarAsyncClient.post":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.post","azure.core.scalar.ScalarAsyncClient.postWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.post","azure.core.scalar.ScalarAsyncClient.put":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.put","azure.core.scalar.ScalarAsyncClient.putWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.put","azure.core.scalar.ScalarAsyncClient.query":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.query","azure.core.scalar.ScalarAsyncClient.queryWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.query","azure.core.scalar.ScalarClient":"_Specs_.Azure.Core.Scalar.AzureLocationScalar","azure.core.scalar.ScalarClient.get":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.get","azure.core.scalar.ScalarClient.getWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.get","azure.core.scalar.ScalarClient.headerMethod":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.header","azure.core.scalar.ScalarClient.headerMethodWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.header","azure.core.scalar.ScalarClient.post":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.post","azure.core.scalar.ScalarClient.postWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.post","azure.core.scalar.ScalarClient.put":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.put","azure.core.scalar.ScalarClient.putWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.put","azure.core.scalar.ScalarClient.query":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.query","azure.core.scalar.ScalarClient.queryWithResponse":"_Specs_.Azure.Core.Scalar.AzureLocationScalar.query","azure.core.scalar.ScalarClientBuilder":"_Specs_.Azure.Core.Scalar","azure.core.scalar.models.AzureLocationModel":"_Specs_.Azure.Core.Scalar.AzureLocationModel"},"generatedFiles":["src/main/java/azure/core/scalar/ScalarAsyncClient.java","src/main/java/azure/core/scalar/ScalarClient.java","src/main/java/azure/core/scalar/ScalarClientBuilder.java","src/main/java/azure/core/scalar/ScalarServiceVersion.java","src/main/java/azure/core/scalar/implementation/AzureLocationScalarsImpl.java","src/main/java/azure/core/scalar/implementation/ScalarClientImpl.java","src/main/java/azure/core/scalar/implementation/package-info.java","src/main/java/azure/core/scalar/models/AzureLocationModel.java","src/main/java/azure/core/scalar/models/package-info.java","src/main/java/azure/core/scalar/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_apiview_properties.json new file mode 100644 index 00000000000..1818e714dfc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_apiview_properties.json @@ -0,0 +1,19 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.core.traits.TraitsAsyncClient": "_Specs_.Azure.Core.Traits", + "azure.core.traits.TraitsAsyncClient.repeatableAction": "_Specs_.Azure.Core.Traits.repeatableAction", + "azure.core.traits.TraitsAsyncClient.repeatableActionWithResponse": "_Specs_.Azure.Core.Traits.repeatableAction", + "azure.core.traits.TraitsAsyncClient.smokeTest": "_Specs_.Azure.Core.Traits.smokeTest", + "azure.core.traits.TraitsAsyncClient.smokeTestWithResponse": "_Specs_.Azure.Core.Traits.smokeTest", + "azure.core.traits.TraitsClient": "_Specs_.Azure.Core.Traits", + "azure.core.traits.TraitsClient.repeatableAction": "_Specs_.Azure.Core.Traits.repeatableAction", + "azure.core.traits.TraitsClient.repeatableActionWithResponse": "_Specs_.Azure.Core.Traits.repeatableAction", + "azure.core.traits.TraitsClient.smokeTest": "_Specs_.Azure.Core.Traits.smokeTest", + "azure.core.traits.TraitsClient.smokeTestWithResponse": "_Specs_.Azure.Core.Traits.smokeTest", + "azure.core.traits.TraitsClientBuilder": "_Specs_.Azure.Core.Traits", + "azure.core.traits.models.User": "_Specs_.Azure.Core.Traits.User", + "azure.core.traits.models.UserActionParam": "_Specs_.Azure.Core.Traits.UserActionParam", + "azure.core.traits.models.UserActionResponse": "_Specs_.Azure.Core.Traits.UserActionResponse" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_metadata.json new file mode 100644 index 00000000000..44321ed9606 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-core-traits_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.core.traits.TraitsAsyncClient":"_Specs_.Azure.Core.Traits","azure.core.traits.TraitsAsyncClient.repeatableAction":"_Specs_.Azure.Core.Traits.repeatableAction","azure.core.traits.TraitsAsyncClient.repeatableActionWithResponse":"_Specs_.Azure.Core.Traits.repeatableAction","azure.core.traits.TraitsAsyncClient.smokeTest":"_Specs_.Azure.Core.Traits.smokeTest","azure.core.traits.TraitsAsyncClient.smokeTestWithResponse":"_Specs_.Azure.Core.Traits.smokeTest","azure.core.traits.TraitsClient":"_Specs_.Azure.Core.Traits","azure.core.traits.TraitsClient.repeatableAction":"_Specs_.Azure.Core.Traits.repeatableAction","azure.core.traits.TraitsClient.repeatableActionWithResponse":"_Specs_.Azure.Core.Traits.repeatableAction","azure.core.traits.TraitsClient.smokeTest":"_Specs_.Azure.Core.Traits.smokeTest","azure.core.traits.TraitsClient.smokeTestWithResponse":"_Specs_.Azure.Core.Traits.smokeTest","azure.core.traits.TraitsClientBuilder":"_Specs_.Azure.Core.Traits","azure.core.traits.models.User":"_Specs_.Azure.Core.Traits.User","azure.core.traits.models.UserActionParam":"_Specs_.Azure.Core.Traits.UserActionParam","azure.core.traits.models.UserActionResponse":"_Specs_.Azure.Core.Traits.UserActionResponse"},"generatedFiles":["src/main/java/azure/core/traits/TraitsAsyncClient.java","src/main/java/azure/core/traits/TraitsClient.java","src/main/java/azure/core/traits/TraitsClientBuilder.java","src/main/java/azure/core/traits/TraitsServiceVersion.java","src/main/java/azure/core/traits/implementation/TraitsClientImpl.java","src/main/java/azure/core/traits/implementation/package-info.java","src/main/java/azure/core/traits/models/User.java","src/main/java/azure/core/traits/models/UserActionParam.java","src/main/java/azure/core/traits/models/UserActionResponse.java","src/main/java/azure/core/traits/models/package-info.java","src/main/java/azure/core/traits/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_apiview_properties.json new file mode 100644 index 00000000000..26e8454c342 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_apiview_properties.json @@ -0,0 +1,13 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.encode.duration.DurationAsyncClient": "_Specs_.Azure.Encode.Duration", + "azure.encode.duration.DurationAsyncClient.durationConstant": "_Specs_.Azure.Encode.Duration.durationConstant", + "azure.encode.duration.DurationAsyncClient.durationConstantWithResponse": "_Specs_.Azure.Encode.Duration.durationConstant", + "azure.encode.duration.DurationClient": "_Specs_.Azure.Encode.Duration", + "azure.encode.duration.DurationClient.durationConstant": "_Specs_.Azure.Encode.Duration.durationConstant", + "azure.encode.duration.DurationClient.durationConstantWithResponse": "_Specs_.Azure.Encode.Duration.durationConstant", + "azure.encode.duration.DurationClientBuilder": "_Specs_.Azure.Encode.Duration", + "azure.encode.duration.models.DurationModel": "_Specs_.Azure.Encode.Duration.DurationModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_metadata.json new file mode 100644 index 00000000000..31f801694b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-encode-duration_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.encode.duration.DurationAsyncClient":"_Specs_.Azure.Encode.Duration","azure.encode.duration.DurationAsyncClient.durationConstant":"_Specs_.Azure.Encode.Duration.durationConstant","azure.encode.duration.DurationAsyncClient.durationConstantWithResponse":"_Specs_.Azure.Encode.Duration.durationConstant","azure.encode.duration.DurationClient":"_Specs_.Azure.Encode.Duration","azure.encode.duration.DurationClient.durationConstant":"_Specs_.Azure.Encode.Duration.durationConstant","azure.encode.duration.DurationClient.durationConstantWithResponse":"_Specs_.Azure.Encode.Duration.durationConstant","azure.encode.duration.DurationClientBuilder":"_Specs_.Azure.Encode.Duration","azure.encode.duration.models.DurationModel":"_Specs_.Azure.Encode.Duration.DurationModel"},"generatedFiles":["src/main/java/azure/encode/duration/DurationAsyncClient.java","src/main/java/azure/encode/duration/DurationClient.java","src/main/java/azure/encode/duration/DurationClientBuilder.java","src/main/java/azure/encode/duration/implementation/DurationClientImpl.java","src/main/java/azure/encode/duration/implementation/package-info.java","src/main/java/azure/encode/duration/models/DurationModel.java","src/main/java/azure/encode/duration/models/package-info.java","src/main/java/azure/encode/duration/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_apiview_properties.json new file mode 100644 index 00000000000..bfdc0a71ff3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_apiview_properties.json @@ -0,0 +1,16 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.example.basic.AzureExampleAsyncClient": "AzureExampleBasicClient.AzureExampleClient", + "azure.example.basic.AzureExampleAsyncClient.basicAction": "AzureExampleBasicClient.AzureExampleClient.basicAction", + "azure.example.basic.AzureExampleAsyncClient.basicActionWithResponse": "AzureExampleBasicClient.AzureExampleClient.basicAction", + "azure.example.basic.AzureExampleClient": "AzureExampleBasicClient.AzureExampleClient", + "azure.example.basic.AzureExampleClient.basicAction": "AzureExampleBasicClient.AzureExampleClient.basicAction", + "azure.example.basic.AzureExampleClient.basicActionWithResponse": "AzureExampleBasicClient.AzureExampleClient.basicAction", + "azure.example.basic.AzureExampleClientBuilder": "AzureExampleBasicClient.AzureExampleClient", + "azure.example.basic.models.ActionRequest": "_Specs_.Azure.Example.Basic.ActionRequest", + "azure.example.basic.models.ActionResponse": "_Specs_.Azure.Example.Basic.ActionResponse", + "azure.example.basic.models.Enum": "_Specs_.Azure.Example.Basic.Enum", + "azure.example.basic.models.Model": "_Specs_.Azure.Example.Basic.Model" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_metadata.json new file mode 100644 index 00000000000..1bfd695c8ce --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-example-basic_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"azure.example.basic.AzureExampleAsyncClient":"AzureExampleBasicClient.AzureExampleClient","azure.example.basic.AzureExampleAsyncClient.basicAction":"AzureExampleBasicClient.AzureExampleClient.basicAction","azure.example.basic.AzureExampleAsyncClient.basicActionWithResponse":"AzureExampleBasicClient.AzureExampleClient.basicAction","azure.example.basic.AzureExampleClient":"AzureExampleBasicClient.AzureExampleClient","azure.example.basic.AzureExampleClient.basicAction":"AzureExampleBasicClient.AzureExampleClient.basicAction","azure.example.basic.AzureExampleClient.basicActionWithResponse":"AzureExampleBasicClient.AzureExampleClient.basicAction","azure.example.basic.AzureExampleClientBuilder":"AzureExampleBasicClient.AzureExampleClient","azure.example.basic.models.ActionRequest":"_Specs_.Azure.Example.Basic.ActionRequest","azure.example.basic.models.ActionResponse":"_Specs_.Azure.Example.Basic.ActionResponse","azure.example.basic.models.Enum":"_Specs_.Azure.Example.Basic.Enum","azure.example.basic.models.Model":"_Specs_.Azure.Example.Basic.Model"},"generatedFiles":["src/main/java/azure/example/basic/AzureExampleAsyncClient.java","src/main/java/azure/example/basic/AzureExampleClient.java","src/main/java/azure/example/basic/AzureExampleClientBuilder.java","src/main/java/azure/example/basic/BasicServiceVersion.java","src/main/java/azure/example/basic/implementation/AzureExampleClientImpl.java","src/main/java/azure/example/basic/implementation/package-info.java","src/main/java/azure/example/basic/models/ActionRequest.java","src/main/java/azure/example/basic/models/ActionResponse.java","src/main/java/azure/example/basic/models/Enum.java","src/main/java/azure/example/basic/models/Model.java","src/main/java/azure/example/basic/models/package-info.java","src/main/java/azure/example/basic/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_apiview_properties.json new file mode 100644 index 00000000000..bd89a3061c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_apiview_properties.json @@ -0,0 +1,11 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.payload.pageable.PageableAsyncClient": "_Specs_.Azure.Payload.Pageable", + "azure.payload.pageable.PageableAsyncClient.list": "_Specs_.Azure.Payload.Pageable.list", + "azure.payload.pageable.PageableClient": "_Specs_.Azure.Payload.Pageable", + "azure.payload.pageable.PageableClient.list": "_Specs_.Azure.Payload.Pageable.list", + "azure.payload.pageable.PageableClientBuilder": "_Specs_.Azure.Payload.Pageable", + "azure.payload.pageable.models.User": "_Specs_.Azure.Payload.Pageable.User" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_metadata.json new file mode 100644 index 00000000000..008a93f1d53 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-payload-pageable_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.payload.pageable.PageableAsyncClient":"_Specs_.Azure.Payload.Pageable","azure.payload.pageable.PageableAsyncClient.list":"_Specs_.Azure.Payload.Pageable.list","azure.payload.pageable.PageableClient":"_Specs_.Azure.Payload.Pageable","azure.payload.pageable.PageableClient.list":"_Specs_.Azure.Payload.Pageable.list","azure.payload.pageable.PageableClientBuilder":"_Specs_.Azure.Payload.Pageable","azure.payload.pageable.models.User":"_Specs_.Azure.Payload.Pageable.User"},"generatedFiles":["src/main/java/azure/payload/pageable/PageableAsyncClient.java","src/main/java/azure/payload/pageable/PageableClient.java","src/main/java/azure/payload/pageable/PageableClientBuilder.java","src/main/java/azure/payload/pageable/implementation/PageableClientImpl.java","src/main/java/azure/payload/pageable/implementation/package-info.java","src/main/java/azure/payload/pageable/models/User.java","src/main/java/azure/payload/pageable/models/package-info.java","src/main/java/azure/payload/pageable/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_apiview_properties.json new file mode 100644 index 00000000000..2ed6a3a2d01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_apiview_properties.json @@ -0,0 +1,12 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.armcustomization.fluent.ArmCustomizationClient": "TspTest.ArmCustomization", + "tsptest.armcustomization.fluent.VaultsClient": "TspTest.ArmCustomization.Vaults", + "tsptest.armcustomization.fluent.VaultsClient.getByResourceGroup": "TspTest.ArmCustomization.Vaults.get", + "tsptest.armcustomization.fluent.VaultsClient.getByResourceGroupWithResponse": "TspTest.ArmCustomization.Vaults.get", + "tsptest.armcustomization.fluent.models.VaultInner": "TspTest.ArmCustomization.Vault", + "tsptest.armcustomization.implementation.ArmCustomizationClientBuilder": "TspTest.ArmCustomization", + "tsptest.armcustomization.models.VaultProperties": "TspTest.ArmCustomization.VaultProperties" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_metadata.json new file mode 100644 index 00000000000..e75ad0ce598 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armcustomization-generated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"tsptest.armcustomization.fluent.ArmCustomizationClient":"TspTest.ArmCustomization","tsptest.armcustomization.fluent.VaultsClient":"TspTest.ArmCustomization.Vaults","tsptest.armcustomization.fluent.VaultsClient.getByResourceGroup":"TspTest.ArmCustomization.Vaults.get","tsptest.armcustomization.fluent.VaultsClient.getByResourceGroupWithResponse":"TspTest.ArmCustomization.Vaults.get","tsptest.armcustomization.fluent.models.VaultInner":"TspTest.ArmCustomization.Vault","tsptest.armcustomization.implementation.ArmCustomizationClientBuilder":"TspTest.ArmCustomization","tsptest.armcustomization.models.VaultProperties":"TspTest.ArmCustomization.VaultProperties"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/armcustomization/ArmCustomizationManager.java","src/main/java/tsptest/armcustomization/fluent/ArmCustomizationClient.java","src/main/java/tsptest/armcustomization/fluent/VaultsClient.java","src/main/java/tsptest/armcustomization/fluent/models/VaultInner.java","src/main/java/tsptest/armcustomization/fluent/models/package-info.java","src/main/java/tsptest/armcustomization/fluent/package-info.java","src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientBuilder.java","src/main/java/tsptest/armcustomization/implementation/ArmCustomizationClientImpl.java","src/main/java/tsptest/armcustomization/implementation/ResourceManagerUtils.java","src/main/java/tsptest/armcustomization/implementation/VaultImpl.java","src/main/java/tsptest/armcustomization/implementation/VaultsClientImpl.java","src/main/java/tsptest/armcustomization/implementation/VaultsImpl.java","src/main/java/tsptest/armcustomization/implementation/package-info.java","src/main/java/tsptest/armcustomization/models/Vault.java","src/main/java/tsptest/armcustomization/models/VaultProperties.java","src/main/java/tsptest/armcustomization/models/Vaults.java","src/main/java/tsptest/armcustomization/models/package-info.java","src/main/java/tsptest/armcustomization/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_apiview_properties.json new file mode 100644 index 00000000000..f1496f1c481 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_apiview_properties.json @@ -0,0 +1,23 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.armlegacy.fluent.ArmLegacyClient": "TspTest.ArmLegacy", + "tsptest.armlegacy.fluent.SkusClient": "TspTest.ArmLegacy.Skus", + "tsptest.armlegacy.fluent.SkusClient.createNested": "TspTest.ArmLegacy.Skus.createNested", + "tsptest.armlegacy.fluent.SkusClient.createNestedWithResponse": "TspTest.ArmLegacy.Skus.createNested", + "tsptest.armlegacy.fluent.SkusClient.createRoot": "TspTest.ArmLegacy.Skus.createRoot", + "tsptest.armlegacy.fluent.SkusClient.createRootWithResponse": "TspTest.ArmLegacy.Skus.createRoot", + "tsptest.armlegacy.fluent.SkusClient.deleteNested": "TspTest.ArmLegacy.Skus.deleteNested", + "tsptest.armlegacy.fluent.SkusClient.deleteNestedWithResponse": "TspTest.ArmLegacy.Skus.deleteNested", + "tsptest.armlegacy.fluent.SkusClient.deleteRoot": "TspTest.ArmLegacy.Skus.deleteRoot", + "tsptest.armlegacy.fluent.SkusClient.deleteRootWithResponse": "TspTest.ArmLegacy.Skus.deleteRoot", + "tsptest.armlegacy.fluent.SkusClient.getNested": "TspTest.ArmLegacy.Skus.getNested", + "tsptest.armlegacy.fluent.SkusClient.getNestedWithResponse": "TspTest.ArmLegacy.Skus.getNested", + "tsptest.armlegacy.fluent.SkusClient.getRoot": "TspTest.ArmLegacy.Skus.getRoot", + "tsptest.armlegacy.fluent.SkusClient.getRootWithResponse": "TspTest.ArmLegacy.Skus.getRoot", + "tsptest.armlegacy.fluent.models.SkuResourceInner": "TspTest.ArmLegacy.SkuResource", + "tsptest.armlegacy.implementation.ArmLegacyClientBuilder": "TspTest.ArmLegacy", + "tsptest.armlegacy.models.ProvisioningState": "TspTest.ArmLegacy.ProvisioningState", + "tsptest.armlegacy.models.ResourceTypeSku": "TspTest.ArmLegacy.ResourceTypeSku" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_metadata.json new file mode 100644 index 00000000000..e73fd1e1c9d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armlegacy-generated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2024-12-01","crossLanguageDefinitions":{"tsptest.armlegacy.fluent.ArmLegacyClient":"TspTest.ArmLegacy","tsptest.armlegacy.fluent.SkusClient":"TspTest.ArmLegacy.Skus","tsptest.armlegacy.fluent.SkusClient.createNested":"TspTest.ArmLegacy.Skus.createNested","tsptest.armlegacy.fluent.SkusClient.createNestedWithResponse":"TspTest.ArmLegacy.Skus.createNested","tsptest.armlegacy.fluent.SkusClient.createRoot":"TspTest.ArmLegacy.Skus.createRoot","tsptest.armlegacy.fluent.SkusClient.createRootWithResponse":"TspTest.ArmLegacy.Skus.createRoot","tsptest.armlegacy.fluent.SkusClient.deleteNested":"TspTest.ArmLegacy.Skus.deleteNested","tsptest.armlegacy.fluent.SkusClient.deleteNestedWithResponse":"TspTest.ArmLegacy.Skus.deleteNested","tsptest.armlegacy.fluent.SkusClient.deleteRoot":"TspTest.ArmLegacy.Skus.deleteRoot","tsptest.armlegacy.fluent.SkusClient.deleteRootWithResponse":"TspTest.ArmLegacy.Skus.deleteRoot","tsptest.armlegacy.fluent.SkusClient.getNested":"TspTest.ArmLegacy.Skus.getNested","tsptest.armlegacy.fluent.SkusClient.getNestedWithResponse":"TspTest.ArmLegacy.Skus.getNested","tsptest.armlegacy.fluent.SkusClient.getRoot":"TspTest.ArmLegacy.Skus.getRoot","tsptest.armlegacy.fluent.SkusClient.getRootWithResponse":"TspTest.ArmLegacy.Skus.getRoot","tsptest.armlegacy.fluent.models.SkuResourceInner":"TspTest.ArmLegacy.SkuResource","tsptest.armlegacy.implementation.ArmLegacyClientBuilder":"TspTest.ArmLegacy","tsptest.armlegacy.models.ProvisioningState":"TspTest.ArmLegacy.ProvisioningState","tsptest.armlegacy.models.ResourceTypeSku":"TspTest.ArmLegacy.ResourceTypeSku"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/armlegacy/ArmLegacyManager.java","src/main/java/tsptest/armlegacy/fluent/ArmLegacyClient.java","src/main/java/tsptest/armlegacy/fluent/SkusClient.java","src/main/java/tsptest/armlegacy/fluent/models/SkuResourceInner.java","src/main/java/tsptest/armlegacy/fluent/models/package-info.java","src/main/java/tsptest/armlegacy/fluent/package-info.java","src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientBuilder.java","src/main/java/tsptest/armlegacy/implementation/ArmLegacyClientImpl.java","src/main/java/tsptest/armlegacy/implementation/ResourceManagerUtils.java","src/main/java/tsptest/armlegacy/implementation/SkuResourceImpl.java","src/main/java/tsptest/armlegacy/implementation/SkusClientImpl.java","src/main/java/tsptest/armlegacy/implementation/SkusImpl.java","src/main/java/tsptest/armlegacy/implementation/package-info.java","src/main/java/tsptest/armlegacy/models/ProvisioningState.java","src/main/java/tsptest/armlegacy/models/ResourceTypeSku.java","src/main/java/tsptest/armlegacy/models/SkuResource.java","src/main/java/tsptest/armlegacy/models/Skus.java","src/main/java/tsptest/armlegacy/models/package-info.java","src/main/java/tsptest/armlegacy/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_apiview_properties.json new file mode 100644 index 00000000000..f3403663ed7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_apiview_properties.json @@ -0,0 +1,174 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.armresourceprovider.fluent.ArmClient": "TspTest.ArmResourceProvider", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient": "TspTest.ArmResourceProvider.ChildExtensionResourceInterface", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginCreateOrUpdate": "Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginCreateOrUpdateAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginDelete": "Azure.ResourceManager.ChildExtensionResourceInterface.delete", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginDeleteAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.delete", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdate": "Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdateAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdateWithResponseAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.delete": "Azure.ResourceManager.ChildExtensionResourceInterface.delete", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.deleteAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.delete", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.deleteWithResponseAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.delete", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.get": "Azure.ResourceManager.ChildExtensionResourceInterface.get", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.get", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getWithResponse": "Azure.ResourceManager.ChildExtensionResourceInterface.get", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getWithResponseAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.get", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.listByTopLevelArmResource": "Azure.ResourceManager.ChildExtensionResourceInterface.listByTopLevelArmResource", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.listByTopLevelArmResourceAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.listByTopLevelArmResource", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.update": "Azure.ResourceManager.ChildExtensionResourceInterface.update", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.update", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateWithResponse": "Azure.ResourceManager.ChildExtensionResourceInterface.update", + "tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateWithResponseAsync": "Azure.ResourceManager.ChildExtensionResourceInterface.update", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient": "TspTest.ArmResourceProvider.ChildResourcesInterface", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBody": "TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBodyAsync": "TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBodyWithResponseAsync": "TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginActionWithoutBody": "TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginActionWithoutBodyAsync": "TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginCreateOrUpdate": "Azure.ResourceManager.ChildResourcesInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginCreateOrUpdateAsync": "Azure.ResourceManager.ChildResourcesInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginDelete": "Azure.ResourceManager.ChildResourcesInterface.delete", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginDeleteAsync": "Azure.ResourceManager.ChildResourcesInterface.delete", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdate": "Azure.ResourceManager.ChildResourcesInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdateAsync": "Azure.ResourceManager.ChildResourcesInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdateWithResponseAsync": "Azure.ResourceManager.ChildResourcesInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.delete": "Azure.ResourceManager.ChildResourcesInterface.delete", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.deleteAsync": "Azure.ResourceManager.ChildResourcesInterface.delete", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.deleteWithResponseAsync": "Azure.ResourceManager.ChildResourcesInterface.delete", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.get": "Azure.ResourceManager.ChildResourcesInterface.get", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getAsync": "Azure.ResourceManager.ChildResourcesInterface.get", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getWithResponse": "Azure.ResourceManager.ChildResourcesInterface.get", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getWithResponseAsync": "Azure.ResourceManager.ChildResourcesInterface.get", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.listByTopLevelArmResource": "TspTest.ArmResourceProvider.ChildResourcesInterface.listByTopLevelArmResource", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.listByTopLevelArmResourceAsync": "TspTest.ArmResourceProvider.ChildResourcesInterface.listByTopLevelArmResource", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.update": "Azure.ResourceManager.ChildResourcesInterface.update", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateAsync": "Azure.ResourceManager.ChildResourcesInterface.update", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateWithResponse": "Azure.ResourceManager.ChildResourcesInterface.update", + "tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateWithResponseAsync": "Azure.ResourceManager.ChildResourcesInterface.update", + "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface", + "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginCreateOrUpdate": "Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginCreateOrUpdateAsync": "Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginUpdateLongRunning": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning", + "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginUpdateLongRunningAsync": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning", + "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdate": "Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdateAsync": "Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdateWithResponseAsync": "Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunning": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning", + "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunningAsync": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning", + "tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunningWithResponseAsync": "TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning", + "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient": "TspTest.ArmResourceProvider.ImmutableResourceModel", + "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.beginCreateOrUpdate": "TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate", + "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.beginCreateOrUpdateAsync": "TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate", + "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdate": "TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate", + "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdateAsync": "TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate", + "tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdateWithResponseAsync": "TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate", + "tsptest.armresourceprovider.fluent.LroNoBodiesClient": "TspTest.ArmResourceProvider.LroNoBody", + "tsptest.armresourceprovider.fluent.LroNoBodiesClient.action": "TspTest.ArmResourceProvider.LroNoBody.action", + "tsptest.armresourceprovider.fluent.LroNoBodiesClient.actionAsync": "TspTest.ArmResourceProvider.LroNoBody.action", + "tsptest.armresourceprovider.fluent.LroNoBodiesClient.actionWithResponseAsync": "TspTest.ArmResourceProvider.LroNoBody.action", + "tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginAction": "TspTest.ArmResourceProvider.LroNoBody.action", + "tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginActionAsync": "TspTest.ArmResourceProvider.LroNoBody.action", + "tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginCreateOrUpdate": "TspTest.ArmResourceProvider.LroNoBody.createOrUpdate", + "tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginCreateOrUpdateAsync": "TspTest.ArmResourceProvider.LroNoBody.createOrUpdate", + "tsptest.armresourceprovider.fluent.LroNoBodiesClient.createOrUpdate": "TspTest.ArmResourceProvider.LroNoBody.createOrUpdate", + "tsptest.armresourceprovider.fluent.LroNoBodiesClient.createOrUpdateAsync": "TspTest.ArmResourceProvider.LroNoBody.createOrUpdate", + "tsptest.armresourceprovider.fluent.LroNoBodiesClient.createOrUpdateWithResponseAsync": "TspTest.ArmResourceProvider.LroNoBody.createOrUpdate", + "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus", + "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.beginDelete": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete", + "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.beginDeleteAsync": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete", + "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.delete": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete", + "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.deleteAsync": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete", + "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.deleteWithResponseAsync": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete", + "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroup": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get", + "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupAsync": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get", + "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupWithResponse": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get", + "tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupWithResponseAsync": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get", + "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient": "TspTest.ArmResourceProvider.ModelInterfaceSameName", + "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.delete": "TspTest.ArmResourceProvider.ModelInterfaceSameName.delete", + "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.deleteAsync": "TspTest.ArmResourceProvider.ModelInterfaceSameName.delete", + "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.deleteWithResponse": "TspTest.ArmResourceProvider.ModelInterfaceSameName.delete", + "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.deleteWithResponseAsync": "TspTest.ArmResourceProvider.ModelInterfaceSameName.delete", + "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroup": "TspTest.ArmResourceProvider.ModelInterfaceSameName.get", + "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupAsync": "TspTest.ArmResourceProvider.ModelInterfaceSameName.get", + "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupWithResponse": "TspTest.ArmResourceProvider.ModelInterfaceSameName.get", + "tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupWithResponseAsync": "TspTest.ArmResourceProvider.ModelInterfaceSameName.get", + "tsptest.armresourceprovider.fluent.OperationsClient": "TspTest.ArmResourceProvider.Operations", + "tsptest.armresourceprovider.fluent.OperationsClient.list": "Azure.ResourceManager.Operations.list", + "tsptest.armresourceprovider.fluent.OperationsClient.listAsync": "Azure.ResourceManager.Operations.list", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient": "TspTest.ArmResourceProvider.TopLevelArmResourceInterface", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.action": "TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.actionAsync": "TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.actionWithResponseAsync": "TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginAction": "TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginActionAsync": "TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginCreateOrUpdate": "Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginCreateOrUpdateAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginDelete": "Azure.ResourceManager.TopLevelArmResourceInterface.delete", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginDeleteAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.delete", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdate": "Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdateAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdateWithResponseAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.delete": "Azure.ResourceManager.TopLevelArmResourceInterface.delete", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.deleteAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.delete", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.deleteWithResponseAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.delete", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroup": "Azure.ResourceManager.TopLevelArmResourceInterface.get", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.get", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupWithResponse": "Azure.ResourceManager.TopLevelArmResourceInterface.get", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupWithResponseAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.get", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.list": "Azure.ResourceManager.TopLevelArmResourceInterface.listBySubscription", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.listBySubscription", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listByResourceGroup": "Azure.ResourceManager.TopLevelArmResourceInterface.listByResourceGroup", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listByResourceGroupAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.listByResourceGroup", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.update": "Azure.ResourceManager.TopLevelArmResourceInterface.update", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.update", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateWithResponse": "Azure.ResourceManager.TopLevelArmResourceInterface.update", + "tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateWithResponseAsync": "Azure.ResourceManager.TopLevelArmResourceInterface.update", + "tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner": "TspTest.ArmResourceProvider.ChildExtensionResource", + "tsptest.armresourceprovider.fluent.models.ChildResourceInner": "TspTest.ArmResourceProvider.ChildResource", + "tsptest.armresourceprovider.fluent.models.ChildResourceProperties": "TspTest.ArmResourceProvider.ChildResourceProperties", + "tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner": "TspTest.ArmResourceProvider.CustomTemplateResource", + "tsptest.armresourceprovider.fluent.models.CustomTemplateResourceProperties": "TspTest.ArmResourceProvider.CustomTemplateResourceProperties", + "tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusContentProperties": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContentProperties", + "tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner": "TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContent", + "tsptest.armresourceprovider.fluent.models.ModelInterfaceDifferentNameProperties": "TspTest.ArmResourceProvider.ModelInterfaceDifferentNameProperties", + "tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner": "TspTest.ArmResourceProvider.ModelInterfaceDifferentName", + "tsptest.armresourceprovider.fluent.models.OperationInner": "Azure.ResourceManager.CommonTypes.Operation", + "tsptest.armresourceprovider.fluent.models.ResourceLroNoBodyProperties": "TspTest.ArmResourceProvider.ResourceLroNoBodyProperties", + "tsptest.armresourceprovider.fluent.models.ResultInner": "TspTest.ArmResourceProvider.Result", + "tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner": "TspTest.ArmResourceProvider.TopLevelArmResource", + "tsptest.armresourceprovider.fluent.models.TopLevelArmResourceProperties": "TspTest.ArmResourceProvider.TopLevelArmResourceProperties", + "tsptest.armresourceprovider.fluent.models.TopLevelArmResourceUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "tsptest.armresourceprovider.implementation.ArmClientBuilder": "TspTest.ArmResourceProvider", + "tsptest.armresourceprovider.implementation.models.ChildExtensionResourceListResult": "Azure.ResourceManager.ResourceListResult", + "tsptest.armresourceprovider.implementation.models.ChildResourceListResult": "TspTest.ArmResourceProvider.ChildResourceListResult", + "tsptest.armresourceprovider.implementation.models.OperationListResult": "Azure.ResourceManager.CommonTypes.OperationListResult", + "tsptest.armresourceprovider.implementation.models.ResourceListResult": "Azure.ResourceManager.ResourceListResult", + "tsptest.armresourceprovider.models.ActionFinalResult": "TspTest.ArmResourceProvider.ActionFinalResult", + "tsptest.armresourceprovider.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "tsptest.armresourceprovider.models.AnonymousEmptyModel": "TspTest.ArmResourceProvider.CustomTemplateResourceProperties.anonymousEmptyModel.anonymous", + "tsptest.armresourceprovider.models.ChildExtensionResourceProperties": "TspTest.ArmResourceProvider.ChildExtensionResourceProperties", + "tsptest.armresourceprovider.models.ChildExtensionResourceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "tsptest.armresourceprovider.models.ChildResourceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "tsptest.armresourceprovider.models.CustomTemplateResourcePatch": "TspTest.ArmResourceProvider.CustomTemplateResourcePatch", + "tsptest.armresourceprovider.models.Dog": "TspTest.ArmResourceProvider.Dog", + "tsptest.armresourceprovider.models.DogKind": "TspTest.ArmResourceProvider.DogKind", + "tsptest.armresourceprovider.models.EmptyModel": "TspTest.ArmResourceProvider.EmptyModel", + "tsptest.armresourceprovider.models.Golden": "TspTest.ArmResourceProvider.Golden", + "tsptest.armresourceprovider.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", + "tsptest.armresourceprovider.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "tsptest.armresourceprovider.models.NginxConfigurationRequest": "TspTest.ArmResourceProvider.NginxConfigurationRequest", + "tsptest.armresourceprovider.models.NginxConfigurationResponse": "TspTest.ArmResourceProvider.NginxConfigurationResponse", + "tsptest.armresourceprovider.models.NginxConfigurationResponseProperties": "TspTest.ArmResourceProvider.NginxConfigurationResponseProperties", + "tsptest.armresourceprovider.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "tsptest.armresourceprovider.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "tsptest.armresourceprovider.models.PriorityModel": "TspTest.ArmResourceProvider.PriorityModel", + "tsptest.armresourceprovider.models.ProvisioningState": "TspTest.ArmResourceProvider.ProvisioningState", + "tsptest.armresourceprovider.models.ResourceLroNoBody": "TspTest.ArmResourceProvider.ResourceLroNoBody", + "tsptest.armresourceprovider.models.TopLevelArmResourceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "tsptest.armresourceprovider.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_metadata.json new file mode 100644 index 00000000000..89702dc97a1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armresourceprovider-generated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2023-11-01","crossLanguageDefinitions":{"tsptest.armresourceprovider.fluent.ArmClient":"TspTest.ArmResourceProvider","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient":"TspTest.ArmResourceProvider.ChildExtensionResourceInterface","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginCreateOrUpdateAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginDelete":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.beginDeleteAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdate":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdateAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.createOrUpdateWithResponseAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.delete":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.deleteAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.deleteWithResponseAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.delete","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.get":"Azure.ResourceManager.ChildExtensionResourceInterface.get","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.get","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getWithResponse":"Azure.ResourceManager.ChildExtensionResourceInterface.get","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.getWithResponseAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.get","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.listByTopLevelArmResource":"Azure.ResourceManager.ChildExtensionResourceInterface.listByTopLevelArmResource","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.listByTopLevelArmResourceAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.listByTopLevelArmResource","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.update":"Azure.ResourceManager.ChildExtensionResourceInterface.update","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.update","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateWithResponse":"Azure.ResourceManager.ChildExtensionResourceInterface.update","tsptest.armresourceprovider.fluent.ChildExtensionResourceInterfacesClient.updateWithResponseAsync":"Azure.ResourceManager.ChildExtensionResourceInterface.update","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient":"TspTest.ArmResourceProvider.ChildResourcesInterface","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBody":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBodyAsync":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.actionWithoutBodyWithResponseAsync":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginActionWithoutBody":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginActionWithoutBodyAsync":"TspTest.ArmResourceProvider.ChildResourcesInterface.actionWithoutBody","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginCreateOrUpdateAsync":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginDelete":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.beginDeleteAsync":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdate":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdateAsync":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.createOrUpdateWithResponseAsync":"Azure.ResourceManager.ChildResourcesInterface.createOrUpdate","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.delete":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.deleteAsync":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.deleteWithResponseAsync":"Azure.ResourceManager.ChildResourcesInterface.delete","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.get":"Azure.ResourceManager.ChildResourcesInterface.get","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getAsync":"Azure.ResourceManager.ChildResourcesInterface.get","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getWithResponse":"Azure.ResourceManager.ChildResourcesInterface.get","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.getWithResponseAsync":"Azure.ResourceManager.ChildResourcesInterface.get","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.listByTopLevelArmResource":"TspTest.ArmResourceProvider.ChildResourcesInterface.listByTopLevelArmResource","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.listByTopLevelArmResourceAsync":"TspTest.ArmResourceProvider.ChildResourcesInterface.listByTopLevelArmResource","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.update":"Azure.ResourceManager.ChildResourcesInterface.update","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateAsync":"Azure.ResourceManager.ChildResourcesInterface.update","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateWithResponse":"Azure.ResourceManager.ChildResourcesInterface.update","tsptest.armresourceprovider.fluent.ChildResourcesInterfacesClient.updateWithResponseAsync":"Azure.ResourceManager.ChildResourcesInterface.update","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginCreateOrUpdateAsync":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginUpdateLongRunning":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.beginUpdateLongRunningAsync":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdate":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdateAsync":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.createOrUpdateWithResponseAsync":"Azure.ResourceManager.CustomTemplateResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunning":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunningAsync":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.CustomTemplateResourceInterfacesClient.updateLongRunningWithResponseAsync":"TspTest.ArmResourceProvider.CustomTemplateResourceInterface.updateLongRunning","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient":"TspTest.ArmResourceProvider.ImmutableResourceModel","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.beginCreateOrUpdate":"TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.beginCreateOrUpdateAsync":"TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdate":"TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdateAsync":"TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate","tsptest.armresourceprovider.fluent.ImmutableResourceModelsClient.createOrUpdateWithResponseAsync":"TspTest.ArmResourceProvider.ImmutableResourceModel.createOrUpdate","tsptest.armresourceprovider.fluent.LroNoBodiesClient":"TspTest.ArmResourceProvider.LroNoBody","tsptest.armresourceprovider.fluent.LroNoBodiesClient.action":"TspTest.ArmResourceProvider.LroNoBody.action","tsptest.armresourceprovider.fluent.LroNoBodiesClient.actionAsync":"TspTest.ArmResourceProvider.LroNoBody.action","tsptest.armresourceprovider.fluent.LroNoBodiesClient.actionWithResponseAsync":"TspTest.ArmResourceProvider.LroNoBody.action","tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginAction":"TspTest.ArmResourceProvider.LroNoBody.action","tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginActionAsync":"TspTest.ArmResourceProvider.LroNoBody.action","tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginCreateOrUpdate":"TspTest.ArmResourceProvider.LroNoBody.createOrUpdate","tsptest.armresourceprovider.fluent.LroNoBodiesClient.beginCreateOrUpdateAsync":"TspTest.ArmResourceProvider.LroNoBody.createOrUpdate","tsptest.armresourceprovider.fluent.LroNoBodiesClient.createOrUpdate":"TspTest.ArmResourceProvider.LroNoBody.createOrUpdate","tsptest.armresourceprovider.fluent.LroNoBodiesClient.createOrUpdateAsync":"TspTest.ArmResourceProvider.LroNoBody.createOrUpdate","tsptest.armresourceprovider.fluent.LroNoBodiesClient.createOrUpdateWithResponseAsync":"TspTest.ArmResourceProvider.LroNoBody.createOrUpdate","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.beginDelete":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.beginDeleteAsync":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.delete":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.deleteAsync":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.deleteWithResponseAsync":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.delete","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroup":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupAsync":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupWithResponse":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get","tsptest.armresourceprovider.fluent.ManagedMaintenanceWindowStatusOperationsClient.getByResourceGroupWithResponseAsync":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatus.get","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient":"TspTest.ArmResourceProvider.ModelInterfaceSameName","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.delete":"TspTest.ArmResourceProvider.ModelInterfaceSameName.delete","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.deleteAsync":"TspTest.ArmResourceProvider.ModelInterfaceSameName.delete","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.deleteWithResponse":"TspTest.ArmResourceProvider.ModelInterfaceSameName.delete","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.deleteWithResponseAsync":"TspTest.ArmResourceProvider.ModelInterfaceSameName.delete","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroup":"TspTest.ArmResourceProvider.ModelInterfaceSameName.get","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupAsync":"TspTest.ArmResourceProvider.ModelInterfaceSameName.get","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupWithResponse":"TspTest.ArmResourceProvider.ModelInterfaceSameName.get","tsptest.armresourceprovider.fluent.ModelInterfaceSameNamesClient.getByResourceGroupWithResponseAsync":"TspTest.ArmResourceProvider.ModelInterfaceSameName.get","tsptest.armresourceprovider.fluent.OperationsClient":"TspTest.ArmResourceProvider.Operations","tsptest.armresourceprovider.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","tsptest.armresourceprovider.fluent.OperationsClient.listAsync":"Azure.ResourceManager.Operations.list","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.action":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.actionAsync":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.actionWithResponseAsync":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginAction":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginActionAsync":"TspTest.ArmResourceProvider.TopLevelArmResourceInterface.action","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginCreateOrUpdate":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginCreateOrUpdateAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginDelete":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.beginDeleteAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdate":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdateAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.createOrUpdateWithResponseAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.createOrUpdate","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.delete":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.deleteAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.deleteWithResponseAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.delete","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroup":"Azure.ResourceManager.TopLevelArmResourceInterface.get","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.get","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupWithResponse":"Azure.ResourceManager.TopLevelArmResourceInterface.get","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.getByResourceGroupWithResponseAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.get","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.list":"Azure.ResourceManager.TopLevelArmResourceInterface.listBySubscription","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.listBySubscription","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listByResourceGroup":"Azure.ResourceManager.TopLevelArmResourceInterface.listByResourceGroup","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.listByResourceGroupAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.listByResourceGroup","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.update":"Azure.ResourceManager.TopLevelArmResourceInterface.update","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.update","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateWithResponse":"Azure.ResourceManager.TopLevelArmResourceInterface.update","tsptest.armresourceprovider.fluent.TopLevelArmResourceInterfacesClient.updateWithResponseAsync":"Azure.ResourceManager.TopLevelArmResourceInterface.update","tsptest.armresourceprovider.fluent.models.ChildExtensionResourceInner":"TspTest.ArmResourceProvider.ChildExtensionResource","tsptest.armresourceprovider.fluent.models.ChildResourceInner":"TspTest.ArmResourceProvider.ChildResource","tsptest.armresourceprovider.fluent.models.ChildResourceProperties":"TspTest.ArmResourceProvider.ChildResourceProperties","tsptest.armresourceprovider.fluent.models.CustomTemplateResourceInner":"TspTest.ArmResourceProvider.CustomTemplateResource","tsptest.armresourceprovider.fluent.models.CustomTemplateResourceProperties":"TspTest.ArmResourceProvider.CustomTemplateResourceProperties","tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusContentProperties":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContentProperties","tsptest.armresourceprovider.fluent.models.ManagedMaintenanceWindowStatusInner":"TspTest.ArmResourceProvider.ManagedMaintenanceWindowStatusContent","tsptest.armresourceprovider.fluent.models.ModelInterfaceDifferentNameProperties":"TspTest.ArmResourceProvider.ModelInterfaceDifferentNameProperties","tsptest.armresourceprovider.fluent.models.ModelInterfaceSameNameInner":"TspTest.ArmResourceProvider.ModelInterfaceDifferentName","tsptest.armresourceprovider.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","tsptest.armresourceprovider.fluent.models.ResourceLroNoBodyProperties":"TspTest.ArmResourceProvider.ResourceLroNoBodyProperties","tsptest.armresourceprovider.fluent.models.ResultInner":"TspTest.ArmResourceProvider.Result","tsptest.armresourceprovider.fluent.models.TopLevelArmResourceInner":"TspTest.ArmResourceProvider.TopLevelArmResource","tsptest.armresourceprovider.fluent.models.TopLevelArmResourceProperties":"TspTest.ArmResourceProvider.TopLevelArmResourceProperties","tsptest.armresourceprovider.fluent.models.TopLevelArmResourceUpdateProperties":"Azure.ResourceManager.Foundations.ResourceUpdateModelProperties","tsptest.armresourceprovider.implementation.ArmClientBuilder":"TspTest.ArmResourceProvider","tsptest.armresourceprovider.implementation.models.ChildExtensionResourceListResult":"Azure.ResourceManager.ResourceListResult","tsptest.armresourceprovider.implementation.models.ChildResourceListResult":"TspTest.ArmResourceProvider.ChildResourceListResult","tsptest.armresourceprovider.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","tsptest.armresourceprovider.implementation.models.ResourceListResult":"Azure.ResourceManager.ResourceListResult","tsptest.armresourceprovider.models.ActionFinalResult":"TspTest.ArmResourceProvider.ActionFinalResult","tsptest.armresourceprovider.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","tsptest.armresourceprovider.models.AnonymousEmptyModel":"TspTest.ArmResourceProvider.CustomTemplateResourceProperties.anonymousEmptyModel.anonymous","tsptest.armresourceprovider.models.ChildExtensionResourceProperties":"TspTest.ArmResourceProvider.ChildExtensionResourceProperties","tsptest.armresourceprovider.models.ChildExtensionResourceUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","tsptest.armresourceprovider.models.ChildResourceUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","tsptest.armresourceprovider.models.CustomTemplateResourcePatch":"TspTest.ArmResourceProvider.CustomTemplateResourcePatch","tsptest.armresourceprovider.models.Dog":"TspTest.ArmResourceProvider.Dog","tsptest.armresourceprovider.models.DogKind":"TspTest.ArmResourceProvider.DogKind","tsptest.armresourceprovider.models.EmptyModel":"TspTest.ArmResourceProvider.EmptyModel","tsptest.armresourceprovider.models.Golden":"TspTest.ArmResourceProvider.Golden","tsptest.armresourceprovider.models.ManagedServiceIdentity":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentity","tsptest.armresourceprovider.models.ManagedServiceIdentityType":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType","tsptest.armresourceprovider.models.NginxConfigurationRequest":"TspTest.ArmResourceProvider.NginxConfigurationRequest","tsptest.armresourceprovider.models.NginxConfigurationResponse":"TspTest.ArmResourceProvider.NginxConfigurationResponse","tsptest.armresourceprovider.models.NginxConfigurationResponseProperties":"TspTest.ArmResourceProvider.NginxConfigurationResponseProperties","tsptest.armresourceprovider.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","tsptest.armresourceprovider.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","tsptest.armresourceprovider.models.PriorityModel":"TspTest.ArmResourceProvider.PriorityModel","tsptest.armresourceprovider.models.ProvisioningState":"TspTest.ArmResourceProvider.ProvisioningState","tsptest.armresourceprovider.models.ResourceLroNoBody":"TspTest.ArmResourceProvider.ResourceLroNoBody","tsptest.armresourceprovider.models.TopLevelArmResourceUpdate":"Azure.ResourceManager.Foundations.ResourceUpdateModel","tsptest.armresourceprovider.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/armresourceprovider/ArmResourceProviderManager.java","src/main/java/tsptest/armresourceprovider/fluent/ArmClient.java","src/main/java/tsptest/armresourceprovider/fluent/ChildExtensionResourceInterfacesClient.java","src/main/java/tsptest/armresourceprovider/fluent/ChildResourcesInterfacesClient.java","src/main/java/tsptest/armresourceprovider/fluent/CustomTemplateResourceInterfacesClient.java","src/main/java/tsptest/armresourceprovider/fluent/ImmutableResourceModelsClient.java","src/main/java/tsptest/armresourceprovider/fluent/LroNoBodiesClient.java","src/main/java/tsptest/armresourceprovider/fluent/ManagedMaintenanceWindowStatusOperationsClient.java","src/main/java/tsptest/armresourceprovider/fluent/ModelInterfaceSameNamesClient.java","src/main/java/tsptest/armresourceprovider/fluent/OperationsClient.java","src/main/java/tsptest/armresourceprovider/fluent/TopLevelArmResourceInterfacesClient.java","src/main/java/tsptest/armresourceprovider/fluent/models/ChildExtensionResourceInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/ChildResourceProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/CustomTemplateResourceProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusContentProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/ManagedMaintenanceWindowStatusInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceDifferentNameProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/ModelInterfaceSameNameInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/OperationInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/ResourceLroNoBodyProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/ResultInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceInner.java","src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/TopLevelArmResourceUpdateProperties.java","src/main/java/tsptest/armresourceprovider/fluent/models/package-info.java","src/main/java/tsptest/armresourceprovider/fluent/package-info.java","src/main/java/tsptest/armresourceprovider/implementation/ArmClientBuilder.java","src/main/java/tsptest/armresourceprovider/implementation/ArmClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ChildExtensionResourceInterfacesImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ChildResourceImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ChildResourcesInterfacesImpl.java","src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceImpl.java","src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/CustomTemplateResourceInterfacesImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ImmutableResourceModelsImpl.java","src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/LroNoBodiesImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ManagedMaintenanceWindowStatusOperationsImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNameImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ModelInterfaceSameNamesImpl.java","src/main/java/tsptest/armresourceprovider/implementation/OperationImpl.java","src/main/java/tsptest/armresourceprovider/implementation/OperationsClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/OperationsImpl.java","src/main/java/tsptest/armresourceprovider/implementation/ResourceManagerUtils.java","src/main/java/tsptest/armresourceprovider/implementation/ResultImpl.java","src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceImpl.java","src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesClientImpl.java","src/main/java/tsptest/armresourceprovider/implementation/TopLevelArmResourceInterfacesImpl.java","src/main/java/tsptest/armresourceprovider/implementation/models/ChildExtensionResourceListResult.java","src/main/java/tsptest/armresourceprovider/implementation/models/ChildResourceListResult.java","src/main/java/tsptest/armresourceprovider/implementation/models/OperationListResult.java","src/main/java/tsptest/armresourceprovider/implementation/models/ResourceListResult.java","src/main/java/tsptest/armresourceprovider/implementation/package-info.java","src/main/java/tsptest/armresourceprovider/models/ActionFinalResult.java","src/main/java/tsptest/armresourceprovider/models/ActionType.java","src/main/java/tsptest/armresourceprovider/models/AnonymousEmptyModel.java","src/main/java/tsptest/armresourceprovider/models/ChildExtensionResource.java","src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceInterfaces.java","src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceProperties.java","src/main/java/tsptest/armresourceprovider/models/ChildExtensionResourceUpdate.java","src/main/java/tsptest/armresourceprovider/models/ChildResource.java","src/main/java/tsptest/armresourceprovider/models/ChildResourceUpdate.java","src/main/java/tsptest/armresourceprovider/models/ChildResourcesInterfaces.java","src/main/java/tsptest/armresourceprovider/models/CustomTemplateResource.java","src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourceInterfaces.java","src/main/java/tsptest/armresourceprovider/models/CustomTemplateResourcePatch.java","src/main/java/tsptest/armresourceprovider/models/Dog.java","src/main/java/tsptest/armresourceprovider/models/DogKind.java","src/main/java/tsptest/armresourceprovider/models/EmptyModel.java","src/main/java/tsptest/armresourceprovider/models/Golden.java","src/main/java/tsptest/armresourceprovider/models/ImmutableResourceModels.java","src/main/java/tsptest/armresourceprovider/models/LroNoBodies.java","src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatus.java","src/main/java/tsptest/armresourceprovider/models/ManagedMaintenanceWindowStatusOperations.java","src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentity.java","src/main/java/tsptest/armresourceprovider/models/ManagedServiceIdentityType.java","src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameName.java","src/main/java/tsptest/armresourceprovider/models/ModelInterfaceSameNames.java","src/main/java/tsptest/armresourceprovider/models/NginxConfigurationRequest.java","src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponse.java","src/main/java/tsptest/armresourceprovider/models/NginxConfigurationResponseProperties.java","src/main/java/tsptest/armresourceprovider/models/Operation.java","src/main/java/tsptest/armresourceprovider/models/OperationDisplay.java","src/main/java/tsptest/armresourceprovider/models/Operations.java","src/main/java/tsptest/armresourceprovider/models/Origin.java","src/main/java/tsptest/armresourceprovider/models/PriorityModel.java","src/main/java/tsptest/armresourceprovider/models/ProvisioningState.java","src/main/java/tsptest/armresourceprovider/models/ResourceLroNoBody.java","src/main/java/tsptest/armresourceprovider/models/Result.java","src/main/java/tsptest/armresourceprovider/models/TopLevelArmResource.java","src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceInterfaces.java","src/main/java/tsptest/armresourceprovider/models/TopLevelArmResourceUpdate.java","src/main/java/tsptest/armresourceprovider/models/UserAssignedIdentity.java","src/main/java/tsptest/armresourceprovider/models/package-info.java","src/main/java/tsptest/armresourceprovider/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_apiview_properties.json new file mode 100644 index 00000000000..aeb257e3cca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_apiview_properties.json @@ -0,0 +1,56 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.armstreamstyleserialization.fluent.ArmResourceProviderManagementClient": "TspTest.ArmStreamStyleSerialization", + "tsptest.armstreamstyleserialization.fluent.FishesClient": "TspTest.ArmStreamStyleSerialization.Fishes", + "tsptest.armstreamstyleserialization.fluent.FishesClient.getModel": "TspTest.ArmStreamStyleSerialization.Fishes.getModel", + "tsptest.armstreamstyleserialization.fluent.FishesClient.getModelWithResponse": "TspTest.ArmStreamStyleSerialization.Fishes.getModel", + "tsptest.armstreamstyleserialization.fluent.FishesClient.getOutputOnlyModel": "TspTest.ArmStreamStyleSerialization.Fishes.getOutputOnlyModel", + "tsptest.armstreamstyleserialization.fluent.FishesClient.getOutputOnlyModelWithResponse": "TspTest.ArmStreamStyleSerialization.Fishes.getOutputOnlyModel", + "tsptest.armstreamstyleserialization.fluent.FishesClient.putModel": "TspTest.ArmStreamStyleSerialization.Fishes.putModel", + "tsptest.armstreamstyleserialization.fluent.FishesClient.putModelWithResponse": "TspTest.ArmStreamStyleSerialization.Fishes.putModel", + "tsptest.armstreamstyleserialization.fluent.FunctionsClient": "TspTest.ArmStreamStyleSerialization.Functions", + "tsptest.armstreamstyleserialization.fluent.FunctionsClient.createFunction": "TspTest.ArmStreamStyleSerialization.Functions.createFunction", + "tsptest.armstreamstyleserialization.fluent.FunctionsClient.createFunctionWithResponse": "TspTest.ArmStreamStyleSerialization.Functions.createFunction", + "tsptest.armstreamstyleserialization.fluent.ItemsClient": "TspTest.ArmStreamStyleSerialization.Items", + "tsptest.armstreamstyleserialization.fluent.ItemsClient.list": "TspTest.ArmStreamStyleSerialization.Items.list", + "tsptest.armstreamstyleserialization.fluent.PrioritiesClient": "TspTest.ArmStreamStyleSerialization.Priorities", + "tsptest.armstreamstyleserialization.fluent.PrioritiesClient.setPriority": "TspTest.ArmStreamStyleSerialization.Priorities.setPriority", + "tsptest.armstreamstyleserialization.fluent.PrioritiesClient.setPriorityWithResponse": "TspTest.ArmStreamStyleSerialization.Priorities.setPriority", + "tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient": "TspTest.ArmStreamStyleSerialization.TopLevelArmResources", + "tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient.beginUpdate": "TspTest.ArmStreamStyleSerialization.TopLevelArmResources.update", + "tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient.update": "TspTest.ArmStreamStyleSerialization.TopLevelArmResources.update", + "tsptest.armstreamstyleserialization.fluent.models.AnotherFishProperties": "TspTest.ArmStreamStyleSerialization.AnotherFishProperties", + "tsptest.armstreamstyleserialization.fluent.models.EyeProperties": "TspTest.ArmStreamStyleSerialization.EyeProperties", + "tsptest.armstreamstyleserialization.fluent.models.FishInner": "TspTest.ArmStreamStyleSerialization.Fish", + "tsptest.armstreamstyleserialization.fluent.models.FishProperties": "TspTest.ArmStreamStyleSerialization.FishProperties", + "tsptest.armstreamstyleserialization.fluent.models.FunctionConfiguration": "TspTest.ArmStreamStyleSerialization.FunctionConfiguration", + "tsptest.armstreamstyleserialization.fluent.models.FunctionInner": "TspTest.ArmStreamStyleSerialization.Function", + "tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner": "TspTest.ArmStreamStyleSerialization.OutputOnlyModel", + "tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelProperties": "TspTest.ArmStreamStyleSerialization.OutputOnlyModelProperties", + "tsptest.armstreamstyleserialization.fluent.models.ResultData": "TspTest.ArmStreamStyleSerialization.ResultData", + "tsptest.armstreamstyleserialization.fluent.models.SalmonInner": "TspTest.ArmStreamStyleSerialization.Salmon", + "tsptest.armstreamstyleserialization.fluent.models.TailProperties": "TspTest.ArmStreamStyleSerialization.TailProperties", + "tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner": "TspTest.ArmStreamStyleSerialization.TopLevelArmResource", + "tsptest.armstreamstyleserialization.implementation.ArmResourceProviderManagementClientBuilder": "TspTest.ArmStreamStyleSerialization", + "tsptest.armstreamstyleserialization.implementation.models.ListResult": "TspTest.ArmStreamStyleSerialization.ListResult", + "tsptest.armstreamstyleserialization.models.AggregateFunctionProperties": "TspTest.ArmStreamStyleSerialization.AggregateFunctionProperties", + "tsptest.armstreamstyleserialization.models.Builtin": "TspTest.ArmStreamStyleSerialization.Builtin", + "tsptest.armstreamstyleserialization.models.Dog": "TspTest.ArmStreamStyleSerialization.Dog", + "tsptest.armstreamstyleserialization.models.DogKind": "TspTest.ArmStreamStyleSerialization.DogKind", + "tsptest.armstreamstyleserialization.models.Encoded": "TspTest.ArmStreamStyleSerialization.Encoded", + "tsptest.armstreamstyleserialization.models.Error": "TspTest.ArmStreamStyleSerialization.ErrorResponse", + "tsptest.armstreamstyleserialization.models.ErrorMin": "TspTest.ArmStreamStyleSerialization.ErrorResponseMin", + "tsptest.armstreamstyleserialization.models.FunctionProperties": "TspTest.ArmStreamStyleSerialization.FunctionProperties", + "tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionHeaders": null, + "tsptest.armstreamstyleserialization.models.GoblinShark": "TspTest.ArmStreamStyleSerialization.GoblinShark", + "tsptest.armstreamstyleserialization.models.Golden": "TspTest.ArmStreamStyleSerialization.Golden", + "tsptest.armstreamstyleserialization.models.OutputOnlyModelChild": "TspTest.ArmStreamStyleSerialization.OutputOnlyModelChild", + "tsptest.armstreamstyleserialization.models.Priority": "TspTest.ArmStreamStyleSerialization.Priority", + "tsptest.armstreamstyleserialization.models.Result": "TspTest.ArmStreamStyleSerialization.Result", + "tsptest.armstreamstyleserialization.models.SawShark": "TspTest.ArmStreamStyleSerialization.SawShark", + "tsptest.armstreamstyleserialization.models.Shark": "TspTest.ArmStreamStyleSerialization.Shark", + "tsptest.armstreamstyleserialization.models.TopLevelArmResourceProperties": "TspTest.ArmStreamStyleSerialization.TopLevelArmResourceProperties", + "tsptest.armstreamstyleserialization.models.TopLevelArmResourceTagsUpdate": "Azure.ResourceManager.Foundations.TagsUpdateModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_metadata.json new file mode 100644 index 00000000000..e039ab6fcb4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armstreamstyleserialization-generated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"tsptest.armstreamstyleserialization.fluent.ArmResourceProviderManagementClient":"TspTest.ArmStreamStyleSerialization","tsptest.armstreamstyleserialization.fluent.FishesClient":"TspTest.ArmStreamStyleSerialization.Fishes","tsptest.armstreamstyleserialization.fluent.FishesClient.getModel":"TspTest.ArmStreamStyleSerialization.Fishes.getModel","tsptest.armstreamstyleserialization.fluent.FishesClient.getModelWithResponse":"TspTest.ArmStreamStyleSerialization.Fishes.getModel","tsptest.armstreamstyleserialization.fluent.FishesClient.getOutputOnlyModel":"TspTest.ArmStreamStyleSerialization.Fishes.getOutputOnlyModel","tsptest.armstreamstyleserialization.fluent.FishesClient.getOutputOnlyModelWithResponse":"TspTest.ArmStreamStyleSerialization.Fishes.getOutputOnlyModel","tsptest.armstreamstyleserialization.fluent.FishesClient.putModel":"TspTest.ArmStreamStyleSerialization.Fishes.putModel","tsptest.armstreamstyleserialization.fluent.FishesClient.putModelWithResponse":"TspTest.ArmStreamStyleSerialization.Fishes.putModel","tsptest.armstreamstyleserialization.fluent.FunctionsClient":"TspTest.ArmStreamStyleSerialization.Functions","tsptest.armstreamstyleserialization.fluent.FunctionsClient.createFunction":"TspTest.ArmStreamStyleSerialization.Functions.createFunction","tsptest.armstreamstyleserialization.fluent.FunctionsClient.createFunctionWithResponse":"TspTest.ArmStreamStyleSerialization.Functions.createFunction","tsptest.armstreamstyleserialization.fluent.ItemsClient":"TspTest.ArmStreamStyleSerialization.Items","tsptest.armstreamstyleserialization.fluent.ItemsClient.list":"TspTest.ArmStreamStyleSerialization.Items.list","tsptest.armstreamstyleserialization.fluent.PrioritiesClient":"TspTest.ArmStreamStyleSerialization.Priorities","tsptest.armstreamstyleserialization.fluent.PrioritiesClient.setPriority":"TspTest.ArmStreamStyleSerialization.Priorities.setPriority","tsptest.armstreamstyleserialization.fluent.PrioritiesClient.setPriorityWithResponse":"TspTest.ArmStreamStyleSerialization.Priorities.setPriority","tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient":"TspTest.ArmStreamStyleSerialization.TopLevelArmResources","tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient.beginUpdate":"TspTest.ArmStreamStyleSerialization.TopLevelArmResources.update","tsptest.armstreamstyleserialization.fluent.TopLevelArmResourcesClient.update":"TspTest.ArmStreamStyleSerialization.TopLevelArmResources.update","tsptest.armstreamstyleserialization.fluent.models.AnotherFishProperties":"TspTest.ArmStreamStyleSerialization.AnotherFishProperties","tsptest.armstreamstyleserialization.fluent.models.EyeProperties":"TspTest.ArmStreamStyleSerialization.EyeProperties","tsptest.armstreamstyleserialization.fluent.models.FishInner":"TspTest.ArmStreamStyleSerialization.Fish","tsptest.armstreamstyleserialization.fluent.models.FishProperties":"TspTest.ArmStreamStyleSerialization.FishProperties","tsptest.armstreamstyleserialization.fluent.models.FunctionConfiguration":"TspTest.ArmStreamStyleSerialization.FunctionConfiguration","tsptest.armstreamstyleserialization.fluent.models.FunctionInner":"TspTest.ArmStreamStyleSerialization.Function","tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelInner":"TspTest.ArmStreamStyleSerialization.OutputOnlyModel","tsptest.armstreamstyleserialization.fluent.models.OutputOnlyModelProperties":"TspTest.ArmStreamStyleSerialization.OutputOnlyModelProperties","tsptest.armstreamstyleserialization.fluent.models.ResultData":"TspTest.ArmStreamStyleSerialization.ResultData","tsptest.armstreamstyleserialization.fluent.models.SalmonInner":"TspTest.ArmStreamStyleSerialization.Salmon","tsptest.armstreamstyleserialization.fluent.models.TailProperties":"TspTest.ArmStreamStyleSerialization.TailProperties","tsptest.armstreamstyleserialization.fluent.models.TopLevelArmResourceInner":"TspTest.ArmStreamStyleSerialization.TopLevelArmResource","tsptest.armstreamstyleserialization.implementation.ArmResourceProviderManagementClientBuilder":"TspTest.ArmStreamStyleSerialization","tsptest.armstreamstyleserialization.implementation.models.ListResult":"TspTest.ArmStreamStyleSerialization.ListResult","tsptest.armstreamstyleserialization.models.AggregateFunctionProperties":"TspTest.ArmStreamStyleSerialization.AggregateFunctionProperties","tsptest.armstreamstyleserialization.models.Builtin":"TspTest.ArmStreamStyleSerialization.Builtin","tsptest.armstreamstyleserialization.models.Dog":"TspTest.ArmStreamStyleSerialization.Dog","tsptest.armstreamstyleserialization.models.DogKind":"TspTest.ArmStreamStyleSerialization.DogKind","tsptest.armstreamstyleserialization.models.Encoded":"TspTest.ArmStreamStyleSerialization.Encoded","tsptest.armstreamstyleserialization.models.Error":"TspTest.ArmStreamStyleSerialization.ErrorResponse","tsptest.armstreamstyleserialization.models.ErrorMin":"TspTest.ArmStreamStyleSerialization.ErrorResponseMin","tsptest.armstreamstyleserialization.models.FunctionProperties":"TspTest.ArmStreamStyleSerialization.FunctionProperties","tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionHeaders":null,"tsptest.armstreamstyleserialization.models.GoblinShark":"TspTest.ArmStreamStyleSerialization.GoblinShark","tsptest.armstreamstyleserialization.models.Golden":"TspTest.ArmStreamStyleSerialization.Golden","tsptest.armstreamstyleserialization.models.OutputOnlyModelChild":"TspTest.ArmStreamStyleSerialization.OutputOnlyModelChild","tsptest.armstreamstyleserialization.models.Priority":"TspTest.ArmStreamStyleSerialization.Priority","tsptest.armstreamstyleserialization.models.Result":"TspTest.ArmStreamStyleSerialization.Result","tsptest.armstreamstyleserialization.models.SawShark":"TspTest.ArmStreamStyleSerialization.SawShark","tsptest.armstreamstyleserialization.models.Shark":"TspTest.ArmStreamStyleSerialization.Shark","tsptest.armstreamstyleserialization.models.TopLevelArmResourceProperties":"TspTest.ArmStreamStyleSerialization.TopLevelArmResourceProperties","tsptest.armstreamstyleserialization.models.TopLevelArmResourceTagsUpdate":"Azure.ResourceManager.Foundations.TagsUpdateModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/armstreamstyleserialization/ArmResourceProviderManager.java","src/main/java/tsptest/armstreamstyleserialization/fluent/ArmResourceProviderManagementClient.java","src/main/java/tsptest/armstreamstyleserialization/fluent/FishesClient.java","src/main/java/tsptest/armstreamstyleserialization/fluent/FunctionsClient.java","src/main/java/tsptest/armstreamstyleserialization/fluent/ItemsClient.java","src/main/java/tsptest/armstreamstyleserialization/fluent/PrioritiesClient.java","src/main/java/tsptest/armstreamstyleserialization/fluent/TopLevelArmResourcesClient.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/AnotherFishProperties.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/EyeProperties.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishInner.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/FishProperties.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionConfiguration.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionInner.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelInner.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/OutputOnlyModelProperties.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/ResultData.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/SalmonInner.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/TailProperties.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/TopLevelArmResourceInner.java","src/main/java/tsptest/armstreamstyleserialization/fluent/models/package-info.java","src/main/java/tsptest/armstreamstyleserialization/fluent/package-info.java","src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientBuilder.java","src/main/java/tsptest/armstreamstyleserialization/implementation/ArmResourceProviderManagementClientImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/FishImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/FishesClientImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/FishesImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsClientImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsClientImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/ItemsImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/OutputOnlyModelImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesClientImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/PrioritiesImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/ResourceManagerUtils.java","src/main/java/tsptest/armstreamstyleserialization/implementation/SalmonImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourceImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesClientImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/TopLevelArmResourcesImpl.java","src/main/java/tsptest/armstreamstyleserialization/implementation/models/ListResult.java","src/main/java/tsptest/armstreamstyleserialization/implementation/package-info.java","src/main/java/tsptest/armstreamstyleserialization/models/AggregateFunctionProperties.java","src/main/java/tsptest/armstreamstyleserialization/models/Builtin.java","src/main/java/tsptest/armstreamstyleserialization/models/Dog.java","src/main/java/tsptest/armstreamstyleserialization/models/DogKind.java","src/main/java/tsptest/armstreamstyleserialization/models/Encoded.java","src/main/java/tsptest/armstreamstyleserialization/models/Error.java","src/main/java/tsptest/armstreamstyleserialization/models/ErrorException.java","src/main/java/tsptest/armstreamstyleserialization/models/ErrorMin.java","src/main/java/tsptest/armstreamstyleserialization/models/ErrorMinException.java","src/main/java/tsptest/armstreamstyleserialization/models/Fish.java","src/main/java/tsptest/armstreamstyleserialization/models/Fishes.java","src/main/java/tsptest/armstreamstyleserialization/models/Function.java","src/main/java/tsptest/armstreamstyleserialization/models/FunctionProperties.java","src/main/java/tsptest/armstreamstyleserialization/models/Functions.java","src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionHeaders.java","src/main/java/tsptest/armstreamstyleserialization/models/FunctionsCreateFunctionResponse.java","src/main/java/tsptest/armstreamstyleserialization/models/GoblinShark.java","src/main/java/tsptest/armstreamstyleserialization/models/Golden.java","src/main/java/tsptest/armstreamstyleserialization/models/Items.java","src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModel.java","src/main/java/tsptest/armstreamstyleserialization/models/OutputOnlyModelChild.java","src/main/java/tsptest/armstreamstyleserialization/models/Priorities.java","src/main/java/tsptest/armstreamstyleserialization/models/Priority.java","src/main/java/tsptest/armstreamstyleserialization/models/Result.java","src/main/java/tsptest/armstreamstyleserialization/models/Salmon.java","src/main/java/tsptest/armstreamstyleserialization/models/SawShark.java","src/main/java/tsptest/armstreamstyleserialization/models/Shark.java","src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResource.java","src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceProperties.java","src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResourceTagsUpdate.java","src/main/java/tsptest/armstreamstyleserialization/models/TopLevelArmResources.java","src/main/java/tsptest/armstreamstyleserialization/models/package-info.java","src/main/java/tsptest/armstreamstyleserialization/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_apiview_properties.json new file mode 100644 index 00000000000..6f845da1398 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_apiview_properties.json @@ -0,0 +1,22 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.armversioned.fluent.ArmVersionedClient": "TspTest.ArmVersioned", + "tsptest.armversioned.fluent.TopLevelArmResourcesClient": "TspTest.ArmVersioned.TopLevelArmResources", + "tsptest.armversioned.fluent.TopLevelArmResourcesClient.action": "TspTest.ArmVersioned.TopLevelArmResources.action", + "tsptest.armversioned.fluent.TopLevelArmResourcesClient.actionWithResponse": "TspTest.ArmVersioned.TopLevelArmResources.action", + "tsptest.armversioned.fluent.TopLevelArmResourcesClient.beginCreateOrUpdate": "TspTest.ArmVersioned.TopLevelArmResources.createOrUpdate", + "tsptest.armversioned.fluent.TopLevelArmResourcesClient.createOrUpdate": "TspTest.ArmVersioned.TopLevelArmResources.createOrUpdate", + "tsptest.armversioned.fluent.TopLevelArmResourcesClient.delete": "TspTest.ArmVersioned.TopLevelArmResources.delete", + "tsptest.armversioned.fluent.TopLevelArmResourcesClient.deleteWithResponse": "TspTest.ArmVersioned.TopLevelArmResources.delete", + "tsptest.armversioned.fluent.TopLevelArmResourcesClient.getByResourceGroup": "TspTest.ArmVersioned.TopLevelArmResources.get", + "tsptest.armversioned.fluent.TopLevelArmResourcesClient.getByResourceGroupWithResponse": "TspTest.ArmVersioned.TopLevelArmResources.get", + "tsptest.armversioned.fluent.TopLevelArmResourcesClient.list": "TspTest.ArmVersioned.TopLevelArmResources.listBySubscription", + "tsptest.armversioned.fluent.TopLevelArmResourcesClient.listByResourceGroup": "TspTest.ArmVersioned.TopLevelArmResources.listByResourceGroup", + "tsptest.armversioned.fluent.models.TopLevelArmResourceInner": "TspTest.ArmVersioned.TopLevelArmResource", + "tsptest.armversioned.implementation.ArmVersionedClientBuilder": "TspTest.ArmVersioned", + "tsptest.armversioned.implementation.models.TopLevelArmResourceListResult": "Azure.ResourceManager.ResourceListResult", + "tsptest.armversioned.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", + "tsptest.armversioned.models.TopLevelArmResourceProperties": "TspTest.ArmVersioned.TopLevelArmResourceProperties" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_metadata.json new file mode 100644 index 00000000000..5eb8d805513 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-armversioned-generated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2024-12-01","crossLanguageDefinitions":{"tsptest.armversioned.fluent.ArmVersionedClient":"TspTest.ArmVersioned","tsptest.armversioned.fluent.TopLevelArmResourcesClient":"TspTest.ArmVersioned.TopLevelArmResources","tsptest.armversioned.fluent.TopLevelArmResourcesClient.action":"TspTest.ArmVersioned.TopLevelArmResources.action","tsptest.armversioned.fluent.TopLevelArmResourcesClient.actionWithResponse":"TspTest.ArmVersioned.TopLevelArmResources.action","tsptest.armversioned.fluent.TopLevelArmResourcesClient.beginCreateOrUpdate":"TspTest.ArmVersioned.TopLevelArmResources.createOrUpdate","tsptest.armversioned.fluent.TopLevelArmResourcesClient.createOrUpdate":"TspTest.ArmVersioned.TopLevelArmResources.createOrUpdate","tsptest.armversioned.fluent.TopLevelArmResourcesClient.delete":"TspTest.ArmVersioned.TopLevelArmResources.delete","tsptest.armversioned.fluent.TopLevelArmResourcesClient.deleteWithResponse":"TspTest.ArmVersioned.TopLevelArmResources.delete","tsptest.armversioned.fluent.TopLevelArmResourcesClient.getByResourceGroup":"TspTest.ArmVersioned.TopLevelArmResources.get","tsptest.armversioned.fluent.TopLevelArmResourcesClient.getByResourceGroupWithResponse":"TspTest.ArmVersioned.TopLevelArmResources.get","tsptest.armversioned.fluent.TopLevelArmResourcesClient.list":"TspTest.ArmVersioned.TopLevelArmResources.listBySubscription","tsptest.armversioned.fluent.TopLevelArmResourcesClient.listByResourceGroup":"TspTest.ArmVersioned.TopLevelArmResources.listByResourceGroup","tsptest.armversioned.fluent.models.TopLevelArmResourceInner":"TspTest.ArmVersioned.TopLevelArmResource","tsptest.armversioned.implementation.ArmVersionedClientBuilder":"TspTest.ArmVersioned","tsptest.armversioned.implementation.models.TopLevelArmResourceListResult":"Azure.ResourceManager.ResourceListResult","tsptest.armversioned.models.ResourceProvisioningState":"Azure.ResourceManager.ResourceProvisioningState","tsptest.armversioned.models.TopLevelArmResourceProperties":"TspTest.ArmVersioned.TopLevelArmResourceProperties"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/armversioned/ArmVersionedManager.java","src/main/java/tsptest/armversioned/fluent/ArmVersionedClient.java","src/main/java/tsptest/armversioned/fluent/TopLevelArmResourcesClient.java","src/main/java/tsptest/armversioned/fluent/models/TopLevelArmResourceInner.java","src/main/java/tsptest/armversioned/fluent/models/package-info.java","src/main/java/tsptest/armversioned/fluent/package-info.java","src/main/java/tsptest/armversioned/implementation/ArmVersionedClientBuilder.java","src/main/java/tsptest/armversioned/implementation/ArmVersionedClientImpl.java","src/main/java/tsptest/armversioned/implementation/ResourceManagerUtils.java","src/main/java/tsptest/armversioned/implementation/TopLevelArmResourceImpl.java","src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesClientImpl.java","src/main/java/tsptest/armversioned/implementation/TopLevelArmResourcesImpl.java","src/main/java/tsptest/armversioned/implementation/models/TopLevelArmResourceListResult.java","src/main/java/tsptest/armversioned/implementation/package-info.java","src/main/java/tsptest/armversioned/models/ResourceProvisioningState.java","src/main/java/tsptest/armversioned/models/TopLevelArmResource.java","src/main/java/tsptest/armversioned/models/TopLevelArmResourceProperties.java","src/main/java/tsptest/armversioned/models/TopLevelArmResources.java","src/main/java/tsptest/armversioned/models/package-info.java","src/main/java/tsptest/armversioned/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_apiview_properties.json new file mode 100644 index 00000000000..0dd670209e9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_apiview_properties.json @@ -0,0 +1,22 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.resourcemanager.multiservice.combined.fluent.Combined": "Azure.ResourceManager.MultiService.Combined", + "azure.resourcemanager.multiservice.combined.fluent.DisksClient": "Azure.ResourceManager.MultiService.ComputeDisk.Disks", + "azure.resourcemanager.multiservice.combined.fluent.DisksClient.beginCreateOrUpdate": "Azure.ResourceManager.MultiService.ComputeDisk.Disks.createOrUpdate", + "azure.resourcemanager.multiservice.combined.fluent.DisksClient.createOrUpdate": "Azure.ResourceManager.MultiService.ComputeDisk.Disks.createOrUpdate", + "azure.resourcemanager.multiservice.combined.fluent.DisksClient.getByResourceGroup": "Azure.ResourceManager.MultiService.ComputeDisk.Disks.get", + "azure.resourcemanager.multiservice.combined.fluent.DisksClient.getByResourceGroupWithResponse": "Azure.ResourceManager.MultiService.ComputeDisk.Disks.get", + "azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient": "Azure.ResourceManager.MultiService.Compute.VirtualMachines", + "azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.beginCreateOrUpdate": "Azure.ResourceManager.MultiService.Compute.VirtualMachines.createOrUpdate", + "azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.createOrUpdate": "Azure.ResourceManager.MultiService.Compute.VirtualMachines.createOrUpdate", + "azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.getByResourceGroup": "Azure.ResourceManager.MultiService.Compute.VirtualMachines.get", + "azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.getByResourceGroupWithResponse": "Azure.ResourceManager.MultiService.Compute.VirtualMachines.get", + "azure.resourcemanager.multiservice.combined.fluent.models.DiskInner": "Azure.ResourceManager.MultiService.ComputeDisk.Disk", + "azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner": "Azure.ResourceManager.MultiService.Compute.VirtualMachine", + "azure.resourcemanager.multiservice.combined.implementation.CombinedBuilder": "Azure.ResourceManager.MultiService.Combined", + "azure.resourcemanager.multiservice.combined.models.DiskProperties": "Azure.ResourceManager.MultiService.ComputeDisk.DiskProperties", + "azure.resourcemanager.multiservice.combined.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", + "azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties": "Azure.ResourceManager.MultiService.Compute.VirtualMachineProperties" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_metadata.json new file mode 100644 index 00000000000..234887d5b64 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-combined-generated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.resourcemanager.multiservice.combined.fluent.Combined":"Azure.ResourceManager.MultiService.Combined","azure.resourcemanager.multiservice.combined.fluent.DisksClient":"Azure.ResourceManager.MultiService.ComputeDisk.Disks","azure.resourcemanager.multiservice.combined.fluent.DisksClient.beginCreateOrUpdate":"Azure.ResourceManager.MultiService.ComputeDisk.Disks.createOrUpdate","azure.resourcemanager.multiservice.combined.fluent.DisksClient.createOrUpdate":"Azure.ResourceManager.MultiService.ComputeDisk.Disks.createOrUpdate","azure.resourcemanager.multiservice.combined.fluent.DisksClient.getByResourceGroup":"Azure.ResourceManager.MultiService.ComputeDisk.Disks.get","azure.resourcemanager.multiservice.combined.fluent.DisksClient.getByResourceGroupWithResponse":"Azure.ResourceManager.MultiService.ComputeDisk.Disks.get","azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient":"Azure.ResourceManager.MultiService.Compute.VirtualMachines","azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.beginCreateOrUpdate":"Azure.ResourceManager.MultiService.Compute.VirtualMachines.createOrUpdate","azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.createOrUpdate":"Azure.ResourceManager.MultiService.Compute.VirtualMachines.createOrUpdate","azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.getByResourceGroup":"Azure.ResourceManager.MultiService.Compute.VirtualMachines.get","azure.resourcemanager.multiservice.combined.fluent.VirtualMachinesClient.getByResourceGroupWithResponse":"Azure.ResourceManager.MultiService.Compute.VirtualMachines.get","azure.resourcemanager.multiservice.combined.fluent.models.DiskInner":"Azure.ResourceManager.MultiService.ComputeDisk.Disk","azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner":"Azure.ResourceManager.MultiService.Compute.VirtualMachine","azure.resourcemanager.multiservice.combined.implementation.CombinedBuilder":"Azure.ResourceManager.MultiService.Combined","azure.resourcemanager.multiservice.combined.models.DiskProperties":"Azure.ResourceManager.MultiService.ComputeDisk.DiskProperties","azure.resourcemanager.multiservice.combined.models.ResourceProvisioningState":"Azure.ResourceManager.ResourceProvisioningState","azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties":"Azure.ResourceManager.MultiService.Compute.VirtualMachineProperties"},"generatedFiles":["src/main/java/azure/resourcemanager/multiservice/combined/CombinedManager.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/Combined.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/DisksClient.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/VirtualMachinesClient.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/DiskInner.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/VirtualMachineInner.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/models/package-info.java","src/main/java/azure/resourcemanager/multiservice/combined/fluent/package-info.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedBuilder.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/CombinedImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/DiskImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksClientImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/DisksImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachineImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesClientImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/VirtualMachinesImpl.java","src/main/java/azure/resourcemanager/multiservice/combined/implementation/package-info.java","src/main/java/azure/resourcemanager/multiservice/combined/models/Disk.java","src/main/java/azure/resourcemanager/multiservice/combined/models/DiskProperties.java","src/main/java/azure/resourcemanager/multiservice/combined/models/Disks.java","src/main/java/azure/resourcemanager/multiservice/combined/models/ResourceProvisioningState.java","src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachine.java","src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachineProperties.java","src/main/java/azure/resourcemanager/multiservice/combined/models/VirtualMachines.java","src/main/java/azure/resourcemanager/multiservice/combined/models/package-info.java","src/main/java/azure/resourcemanager/multiservice/combined/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_apiview_properties.json new file mode 100644 index 00000000000..b89c3621c4b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_apiview_properties.json @@ -0,0 +1,28 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.resourcemanager.commonproperties.fluent.CommonPropertiesClient": "Azure.ResourceManager.CommonProperties", + "azure.resourcemanager.commonproperties.fluent.ErrorsClient": "Azure.ResourceManager.CommonProperties.Error", + "azure.resourcemanager.commonproperties.fluent.ErrorsClient.createForUserDefinedError": "Azure.ResourceManager.CommonProperties.Error.createForUserDefinedError", + "azure.resourcemanager.commonproperties.fluent.ErrorsClient.createForUserDefinedErrorWithResponse": "Azure.ResourceManager.CommonProperties.Error.createForUserDefinedError", + "azure.resourcemanager.commonproperties.fluent.ErrorsClient.getByResourceGroup": "Azure.ResourceManager.CommonProperties.Error.getForPredefinedError", + "azure.resourcemanager.commonproperties.fluent.ErrorsClient.getByResourceGroupWithResponse": "Azure.ResourceManager.CommonProperties.Error.getForPredefinedError", + "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient": "Azure.ResourceManager.CommonProperties.ManagedIdentity", + "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.createWithSystemAssigned": "Azure.ResourceManager.CommonProperties.ManagedIdentity.createWithSystemAssigned", + "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.createWithSystemAssignedWithResponse": "Azure.ResourceManager.CommonProperties.ManagedIdentity.createWithSystemAssigned", + "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.getByResourceGroup": "Azure.ResourceManager.CommonProperties.ManagedIdentity.get", + "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.getByResourceGroupWithResponse": "Azure.ResourceManager.CommonProperties.ManagedIdentity.get", + "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.updateWithUserAssignedAndSystemAssigned": "Azure.ResourceManager.CommonProperties.ManagedIdentity.updateWithUserAssignedAndSystemAssigned", + "azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.updateWithUserAssignedAndSystemAssignedWithResponse": "Azure.ResourceManager.CommonProperties.ManagedIdentity.updateWithUserAssignedAndSystemAssigned", + "azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner": "Azure.ResourceManager.CommonProperties.ConfidentialResource", + "azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner": "Azure.ResourceManager.CommonProperties.ManagedIdentityTrackedResource", + "azure.resourcemanager.commonproperties.implementation.CommonPropertiesClientBuilder": "Azure.ResourceManager.CommonProperties", + "azure.resourcemanager.commonproperties.models.ApiError": "Azure.ResourceManager.CommonProperties.CloudError", + "azure.resourcemanager.commonproperties.models.ConfidentialResourceProperties": "Azure.ResourceManager.CommonProperties.ConfidentialResourceProperties", + "azure.resourcemanager.commonproperties.models.InnerError": "Azure.ResourceManager.CommonProperties.InnerError", + "azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResourceProperties": "Azure.ResourceManager.CommonProperties.ManagedIdentityTrackedResourceProperties", + "azure.resourcemanager.commonproperties.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", + "azure.resourcemanager.commonproperties.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "azure.resourcemanager.commonproperties.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_metadata.json new file mode 100644 index 00000000000..f93f7490097 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-commonproperties-generated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"azure.resourcemanager.commonproperties.fluent.CommonPropertiesClient":"Azure.ResourceManager.CommonProperties","azure.resourcemanager.commonproperties.fluent.ErrorsClient":"Azure.ResourceManager.CommonProperties.Error","azure.resourcemanager.commonproperties.fluent.ErrorsClient.createForUserDefinedError":"Azure.ResourceManager.CommonProperties.Error.createForUserDefinedError","azure.resourcemanager.commonproperties.fluent.ErrorsClient.createForUserDefinedErrorWithResponse":"Azure.ResourceManager.CommonProperties.Error.createForUserDefinedError","azure.resourcemanager.commonproperties.fluent.ErrorsClient.getByResourceGroup":"Azure.ResourceManager.CommonProperties.Error.getForPredefinedError","azure.resourcemanager.commonproperties.fluent.ErrorsClient.getByResourceGroupWithResponse":"Azure.ResourceManager.CommonProperties.Error.getForPredefinedError","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient":"Azure.ResourceManager.CommonProperties.ManagedIdentity","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.createWithSystemAssigned":"Azure.ResourceManager.CommonProperties.ManagedIdentity.createWithSystemAssigned","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.createWithSystemAssignedWithResponse":"Azure.ResourceManager.CommonProperties.ManagedIdentity.createWithSystemAssigned","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.getByResourceGroup":"Azure.ResourceManager.CommonProperties.ManagedIdentity.get","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.getByResourceGroupWithResponse":"Azure.ResourceManager.CommonProperties.ManagedIdentity.get","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.updateWithUserAssignedAndSystemAssigned":"Azure.ResourceManager.CommonProperties.ManagedIdentity.updateWithUserAssignedAndSystemAssigned","azure.resourcemanager.commonproperties.fluent.ManagedIdentitiesClient.updateWithUserAssignedAndSystemAssignedWithResponse":"Azure.ResourceManager.CommonProperties.ManagedIdentity.updateWithUserAssignedAndSystemAssigned","azure.resourcemanager.commonproperties.fluent.models.ConfidentialResourceInner":"Azure.ResourceManager.CommonProperties.ConfidentialResource","azure.resourcemanager.commonproperties.fluent.models.ManagedIdentityTrackedResourceInner":"Azure.ResourceManager.CommonProperties.ManagedIdentityTrackedResource","azure.resourcemanager.commonproperties.implementation.CommonPropertiesClientBuilder":"Azure.ResourceManager.CommonProperties","azure.resourcemanager.commonproperties.models.ApiError":"Azure.ResourceManager.CommonProperties.CloudError","azure.resourcemanager.commonproperties.models.ConfidentialResourceProperties":"Azure.ResourceManager.CommonProperties.ConfidentialResourceProperties","azure.resourcemanager.commonproperties.models.InnerError":"Azure.ResourceManager.CommonProperties.InnerError","azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResourceProperties":"Azure.ResourceManager.CommonProperties.ManagedIdentityTrackedResourceProperties","azure.resourcemanager.commonproperties.models.ManagedServiceIdentity":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentity","azure.resourcemanager.commonproperties.models.ManagedServiceIdentityType":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType","azure.resourcemanager.commonproperties.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity"},"generatedFiles":["src/main/java/azure/resourcemanager/commonproperties/CommonPropertiesManager.java","src/main/java/azure/resourcemanager/commonproperties/fluent/CommonPropertiesClient.java","src/main/java/azure/resourcemanager/commonproperties/fluent/ErrorsClient.java","src/main/java/azure/resourcemanager/commonproperties/fluent/ManagedIdentitiesClient.java","src/main/java/azure/resourcemanager/commonproperties/fluent/models/ConfidentialResourceInner.java","src/main/java/azure/resourcemanager/commonproperties/fluent/models/ManagedIdentityTrackedResourceInner.java","src/main/java/azure/resourcemanager/commonproperties/fluent/models/package-info.java","src/main/java/azure/resourcemanager/commonproperties/fluent/package-info.java","src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientBuilder.java","src/main/java/azure/resourcemanager/commonproperties/implementation/CommonPropertiesClientImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ConfidentialResourceImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsClientImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ErrorsImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesClientImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentitiesImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ManagedIdentityTrackedResourceImpl.java","src/main/java/azure/resourcemanager/commonproperties/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/commonproperties/implementation/package-info.java","src/main/java/azure/resourcemanager/commonproperties/models/ApiError.java","src/main/java/azure/resourcemanager/commonproperties/models/ApiErrorException.java","src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResource.java","src/main/java/azure/resourcemanager/commonproperties/models/ConfidentialResourceProperties.java","src/main/java/azure/resourcemanager/commonproperties/models/Errors.java","src/main/java/azure/resourcemanager/commonproperties/models/InnerError.java","src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentities.java","src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResource.java","src/main/java/azure/resourcemanager/commonproperties/models/ManagedIdentityTrackedResourceProperties.java","src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentity.java","src/main/java/azure/resourcemanager/commonproperties/models/ManagedServiceIdentityType.java","src/main/java/azure/resourcemanager/commonproperties/models/UserAssignedIdentity.java","src/main/java/azure/resourcemanager/commonproperties/models/package-info.java","src/main/java/azure/resourcemanager/commonproperties/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_apiview_properties.json new file mode 100644 index 00000000000..dfb9414cee4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_apiview_properties.json @@ -0,0 +1,11 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.resourcemanager.largeheader.fluent.LargeHeaderClient": "Azure.ResourceManager.LargeHeader", + "azure.resourcemanager.largeheader.fluent.LargeHeadersClient": "Azure.ResourceManager.LargeHeader.LargeHeaders", + "azure.resourcemanager.largeheader.fluent.LargeHeadersClient.beginTwo6k": "Azure.ResourceManager.LargeHeader.LargeHeaders.two6k", + "azure.resourcemanager.largeheader.fluent.LargeHeadersClient.two6k": "Azure.ResourceManager.LargeHeader.LargeHeaders.two6k", + "azure.resourcemanager.largeheader.fluent.models.CancelResultInner": "Azure.ResourceManager.LargeHeader.CancelResult", + "azure.resourcemanager.largeheader.implementation.LargeHeaderClientBuilder": "Azure.ResourceManager.LargeHeader" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_metadata.json new file mode 100644 index 00000000000..c508ef0d333 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-largeheader-generated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"azure.resourcemanager.largeheader.fluent.LargeHeaderClient":"Azure.ResourceManager.LargeHeader","azure.resourcemanager.largeheader.fluent.LargeHeadersClient":"Azure.ResourceManager.LargeHeader.LargeHeaders","azure.resourcemanager.largeheader.fluent.LargeHeadersClient.beginTwo6k":"Azure.ResourceManager.LargeHeader.LargeHeaders.two6k","azure.resourcemanager.largeheader.fluent.LargeHeadersClient.two6k":"Azure.ResourceManager.LargeHeader.LargeHeaders.two6k","azure.resourcemanager.largeheader.fluent.models.CancelResultInner":"Azure.ResourceManager.LargeHeader.CancelResult","azure.resourcemanager.largeheader.implementation.LargeHeaderClientBuilder":"Azure.ResourceManager.LargeHeader"},"generatedFiles":["src/main/java/azure/resourcemanager/largeheader/LargeHeaderManager.java","src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeaderClient.java","src/main/java/azure/resourcemanager/largeheader/fluent/LargeHeadersClient.java","src/main/java/azure/resourcemanager/largeheader/fluent/models/CancelResultInner.java","src/main/java/azure/resourcemanager/largeheader/fluent/models/package-info.java","src/main/java/azure/resourcemanager/largeheader/fluent/package-info.java","src/main/java/azure/resourcemanager/largeheader/implementation/CancelResultImpl.java","src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientBuilder.java","src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeaderClientImpl.java","src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersClientImpl.java","src/main/java/azure/resourcemanager/largeheader/implementation/LargeHeadersImpl.java","src/main/java/azure/resourcemanager/largeheader/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/largeheader/implementation/package-info.java","src/main/java/azure/resourcemanager/largeheader/models/CancelResult.java","src/main/java/azure/resourcemanager/largeheader/models/LargeHeaders.java","src/main/java/azure/resourcemanager/largeheader/models/package-info.java","src/main/java/azure/resourcemanager/largeheader/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_apiview_properties.json new file mode 100644 index 00000000000..70b60f8e8d0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_apiview_properties.json @@ -0,0 +1,51 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.resourcemanager.methodsubscriptionid.fluent.MethodSubscriptionIdClient": "Azure.ResourceManager.MethodSubscriptionId", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.delete": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.delete", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.deleteWithResponse": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.delete", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.getByResourceGroup": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.get", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.getByResourceGroupWithResponse": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.get", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.put": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.put", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.putWithResponse": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.put", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.delete": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.delete", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.deleteWithResponse": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.delete", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.get": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.get", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.getWithResponse": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.get", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.put": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.put", + "azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.putWithResponse": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.put", + "azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient": "Azure.ResourceManager.MethodSubscriptionId.Operations", + "azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient.list": "Azure.ResourceManager.Operations.list", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.delete": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.delete", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.deleteWithResponse": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.delete", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.get": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.get", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.getWithResponse": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.get", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.put": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.put", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.putWithResponse": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.put", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.delete": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.delete", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.deleteWithResponse": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.delete", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.get": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.get", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.getWithResponse": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.get", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.put": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.put", + "azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.putWithResponse": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.put", + "azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner": "Azure.ResourceManager.CommonTypes.Operation", + "azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResource", + "azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1", + "azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2", + "azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResource", + "azure.resourcemanager.methodsubscriptionid.implementation.MethodSubscriptionIdClientBuilder": "Azure.ResourceManager.MethodSubscriptionId", + "azure.resourcemanager.methodsubscriptionid.implementation.models.OperationListResult": "Azure.ResourceManager.CommonTypes.OperationListResult", + "azure.resourcemanager.methodsubscriptionid.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.resourcemanager.methodsubscriptionid.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.resourcemanager.methodsubscriptionid.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceProperties", + "azure.resourcemanager.methodsubscriptionid.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", + "azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Properties", + "azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties": "Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Properties", + "azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties": "Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceProperties" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_metadata.json new file mode 100644 index 00000000000..40c9aa31aa7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-methodsubscriptionid-generated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"azure.resourcemanager.methodsubscriptionid.fluent.MethodSubscriptionIdClient":"Azure.ResourceManager.MethodSubscriptionId","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.delete":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.delete","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.deleteWithResponse":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.delete","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.getByResourceGroup":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.get","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.getByResourceGroupWithResponse":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.get","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.put":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.put","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementResourceGroupResourceOperationsClient.putWithResponse":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceOperations.put","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.delete":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.delete","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.deleteWithResponse":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.delete","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.get":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.get","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.getWithResponse":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.get","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.put":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.put","azure.resourcemanager.methodsubscriptionid.fluent.MixedSubscriptionPlacementSubscriptionResourceOperationsClient.putWithResponse":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceOperations.put","azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient":"Azure.ResourceManager.MethodSubscriptionId.Operations","azure.resourcemanager.methodsubscriptionid.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.delete":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.delete","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.deleteWithResponse":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.delete","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.get":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.get","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.getWithResponse":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.get","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.put":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.put","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.putWithResponse":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Operations.put","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.delete":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.delete","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.deleteWithResponse":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.delete","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.get":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.get","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.getWithResponse":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.get","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.put":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.put","azure.resourcemanager.methodsubscriptionid.fluent.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.putWithResponse":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Operations.put","azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResource","azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1","azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2","azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResource","azure.resourcemanager.methodsubscriptionid.implementation.MethodSubscriptionIdClientBuilder":"Azure.ResourceManager.MethodSubscriptionId","azure.resourcemanager.methodsubscriptionid.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","azure.resourcemanager.methodsubscriptionid.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","azure.resourcemanager.methodsubscriptionid.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","azure.resourcemanager.methodsubscriptionid.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.ResourceGroupResourceProperties","azure.resourcemanager.methodsubscriptionid.models.ResourceProvisioningState":"Azure.ResourceManager.ResourceProvisioningState","azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource1Properties","azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties":"Azure.ResourceManager.MethodSubscriptionId.TwoSubscriptionResourcesMethodLevel.SubscriptionResource2Properties","azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties":"Azure.ResourceManager.MethodSubscriptionId.MixedSubscriptionPlacement.SubscriptionResourceProperties"},"generatedFiles":["src/main/java/azure/resourcemanager/methodsubscriptionid/MethodSubscriptionIdManager.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MethodSubscriptionIdClient.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementResourceGroupResourceOperationsClient.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/MixedSubscriptionPlacementSubscriptionResourceOperationsClient.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/OperationsClient.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClient.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClient.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/OperationInner.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/ResourceGroupResourceInner.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource1Inner.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResource2Inner.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/SubscriptionResourceInner.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/models/package-info.java","src/main/java/azure/resourcemanager/methodsubscriptionid/fluent/package-info.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientBuilder.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MethodSubscriptionIdClientImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementResourceGroupResourceOperationsImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/MixedSubscriptionPlacementSubscriptionResourceOperationsImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsClientImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/OperationsImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceGroupResourceImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource1Impl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResource2Impl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/SubscriptionResourceImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsImpl.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/models/OperationListResult.java","src/main/java/azure/resourcemanager/methodsubscriptionid/implementation/package-info.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/ActionType.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementResourceGroupResourceOperations.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/MixedSubscriptionPlacementSubscriptionResourceOperations.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operation.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/OperationDisplay.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/Operations.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/Origin.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResource.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceGroupResourceProperties.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/ResourceProvisioningState.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource1Properties.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResource2Properties.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/SubscriptionResourceProperties.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/TwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations.java","src/main/java/azure/resourcemanager/methodsubscriptionid/models/package-info.java","src/main/java/azure/resourcemanager/methodsubscriptionid/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_apiview_properties.json new file mode 100644 index 00000000000..0128abdd54d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_apiview_properties.json @@ -0,0 +1,13 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.resourcemanager.nonresource.fluent.NonResourceClient": "Azure.ResourceManager.NonResource", + "azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient": "Azure.ResourceManager.NonResource.NonResourceOperations", + "azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.create": "Azure.ResourceManager.NonResource.NonResourceOperations.create", + "azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.createWithResponse": "Azure.ResourceManager.NonResource.NonResourceOperations.create", + "azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.get": "Azure.ResourceManager.NonResource.NonResourceOperations.get", + "azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.getWithResponse": "Azure.ResourceManager.NonResource.NonResourceOperations.get", + "azure.resourcemanager.nonresource.fluent.models.NonResourceInner": "Azure.ResourceManager.NonResource.NonResource", + "azure.resourcemanager.nonresource.implementation.NonResourceClientBuilder": "Azure.ResourceManager.NonResource" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_metadata.json new file mode 100644 index 00000000000..f06e8dd7c98 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-nonresource-generated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"azure.resourcemanager.nonresource.fluent.NonResourceClient":"Azure.ResourceManager.NonResource","azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient":"Azure.ResourceManager.NonResource.NonResourceOperations","azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.create":"Azure.ResourceManager.NonResource.NonResourceOperations.create","azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.createWithResponse":"Azure.ResourceManager.NonResource.NonResourceOperations.create","azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.get":"Azure.ResourceManager.NonResource.NonResourceOperations.get","azure.resourcemanager.nonresource.fluent.NonResourceOperationsClient.getWithResponse":"Azure.ResourceManager.NonResource.NonResourceOperations.get","azure.resourcemanager.nonresource.fluent.models.NonResourceInner":"Azure.ResourceManager.NonResource.NonResource","azure.resourcemanager.nonresource.implementation.NonResourceClientBuilder":"Azure.ResourceManager.NonResource"},"generatedFiles":["src/main/java/azure/resourcemanager/nonresource/NonResourceManager.java","src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceClient.java","src/main/java/azure/resourcemanager/nonresource/fluent/NonResourceOperationsClient.java","src/main/java/azure/resourcemanager/nonresource/fluent/models/NonResourceInner.java","src/main/java/azure/resourcemanager/nonresource/fluent/models/package-info.java","src/main/java/azure/resourcemanager/nonresource/fluent/package-info.java","src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientBuilder.java","src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceClientImpl.java","src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceImpl.java","src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsClientImpl.java","src/main/java/azure/resourcemanager/nonresource/implementation/NonResourceOperationsImpl.java","src/main/java/azure/resourcemanager/nonresource/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/nonresource/implementation/package-info.java","src/main/java/azure/resourcemanager/nonresource/models/NonResource.java","src/main/java/azure/resourcemanager/nonresource/models/NonResourceOperations.java","src/main/java/azure/resourcemanager/nonresource/models/package-info.java","src/main/java/azure/resourcemanager/nonresource/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_apiview_properties.json new file mode 100644 index 00000000000..ecbc75a98aa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_apiview_properties.json @@ -0,0 +1,48 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient": "Azure.ResourceManager.OperationTemplates.CheckNameAvailability", + "azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkGlobal": "Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkGlobal", + "azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkGlobalWithResponse": "Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkGlobal", + "azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkLocal": "Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkLocal", + "azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkLocalWithResponse": "Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkLocal", + "azure.resourcemanager.operationtemplates.fluent.LroesClient": "Azure.ResourceManager.OperationTemplates.Lro", + "azure.resourcemanager.operationtemplates.fluent.LroesClient.beginCreateOrReplace": "Azure.ResourceManager.OperationTemplates.Lro.createOrReplace", + "azure.resourcemanager.operationtemplates.fluent.LroesClient.beginDelete": "Azure.ResourceManager.OperationTemplates.Lro.delete", + "azure.resourcemanager.operationtemplates.fluent.LroesClient.beginExport": "Azure.ResourceManager.OperationTemplates.Lro.export", + "azure.resourcemanager.operationtemplates.fluent.LroesClient.createOrReplace": "Azure.ResourceManager.OperationTemplates.Lro.createOrReplace", + "azure.resourcemanager.operationtemplates.fluent.LroesClient.delete": "Azure.ResourceManager.OperationTemplates.Lro.delete", + "azure.resourcemanager.operationtemplates.fluent.LroesClient.export": "Azure.ResourceManager.OperationTemplates.Lro.export", + "azure.resourcemanager.operationtemplates.fluent.OperationTemplatesClient": "Azure.ResourceManager.OperationTemplates", + "azure.resourcemanager.operationtemplates.fluent.OperationsClient": "Azure.ResourceManager.OperationTemplates.Operations", + "azure.resourcemanager.operationtemplates.fluent.OperationsClient.list": "Azure.ResourceManager.Operations.list", + "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient": "Azure.ResourceManager.OperationTemplates.OptionalBody", + "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.getByResourceGroup": "Azure.ResourceManager.OperationTemplates.OptionalBody.get", + "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.getByResourceGroupWithResponse": "Azure.ResourceManager.OperationTemplates.OptionalBody.get", + "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.patch": "Azure.ResourceManager.OperationTemplates.OptionalBody.patch", + "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.patchWithResponse": "Azure.ResourceManager.OperationTemplates.OptionalBody.patch", + "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.post": "Azure.ResourceManager.OperationTemplates.OptionalBody.post", + "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.postWithResponse": "Azure.ResourceManager.OperationTemplates.OptionalBody.post", + "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.providerPost": "Azure.ResourceManager.OperationTemplates.OptionalBody.providerPost", + "azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.providerPostWithResponse": "Azure.ResourceManager.OperationTemplates.OptionalBody.providerPost", + "azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner": "Azure.ResourceManager.OperationTemplates.ActionResult", + "azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner": "Azure.ResourceManager.OperationTemplates.ChangeAllowanceResult", + "azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse", + "azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner": "Azure.ResourceManager.OperationTemplates.ExportResult", + "azure.resourcemanager.operationtemplates.fluent.models.OperationInner": "Azure.ResourceManager.CommonTypes.Operation", + "azure.resourcemanager.operationtemplates.fluent.models.OrderInner": "Azure.ResourceManager.OperationTemplates.Order", + "azure.resourcemanager.operationtemplates.fluent.models.WidgetInner": "Azure.ResourceManager.OperationTemplates.Widget", + "azure.resourcemanager.operationtemplates.implementation.OperationTemplatesClientBuilder": "Azure.ResourceManager.OperationTemplates", + "azure.resourcemanager.operationtemplates.implementation.models.OperationListResult": "Azure.ResourceManager.CommonTypes.OperationListResult", + "azure.resourcemanager.operationtemplates.models.ActionRequest": "Azure.ResourceManager.OperationTemplates.ActionRequest", + "azure.resourcemanager.operationtemplates.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.resourcemanager.operationtemplates.models.ChangeAllowanceRequest": "Azure.ResourceManager.OperationTemplates.ChangeAllowanceRequest", + "azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityReason": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason", + "azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityRequest": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest", + "azure.resourcemanager.operationtemplates.models.ExportRequest": "Azure.ResourceManager.OperationTemplates.ExportRequest", + "azure.resourcemanager.operationtemplates.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.resourcemanager.operationtemplates.models.OrderProperties": "Azure.ResourceManager.OperationTemplates.OrderProperties", + "azure.resourcemanager.operationtemplates.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.resourcemanager.operationtemplates.models.WidgetProperties": "Azure.ResourceManager.OperationTemplates.WidgetProperties" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_metadata.json new file mode 100644 index 00000000000..90229b18af4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-operationtemplates-generated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient":"Azure.ResourceManager.OperationTemplates.CheckNameAvailability","azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkGlobal":"Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkGlobal","azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkGlobalWithResponse":"Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkGlobal","azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkLocal":"Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkLocal","azure.resourcemanager.operationtemplates.fluent.CheckNameAvailabilitiesClient.checkLocalWithResponse":"Azure.ResourceManager.OperationTemplates.CheckNameAvailability.checkLocal","azure.resourcemanager.operationtemplates.fluent.LroesClient":"Azure.ResourceManager.OperationTemplates.Lro","azure.resourcemanager.operationtemplates.fluent.LroesClient.beginCreateOrReplace":"Azure.ResourceManager.OperationTemplates.Lro.createOrReplace","azure.resourcemanager.operationtemplates.fluent.LroesClient.beginDelete":"Azure.ResourceManager.OperationTemplates.Lro.delete","azure.resourcemanager.operationtemplates.fluent.LroesClient.beginExport":"Azure.ResourceManager.OperationTemplates.Lro.export","azure.resourcemanager.operationtemplates.fluent.LroesClient.createOrReplace":"Azure.ResourceManager.OperationTemplates.Lro.createOrReplace","azure.resourcemanager.operationtemplates.fluent.LroesClient.delete":"Azure.ResourceManager.OperationTemplates.Lro.delete","azure.resourcemanager.operationtemplates.fluent.LroesClient.export":"Azure.ResourceManager.OperationTemplates.Lro.export","azure.resourcemanager.operationtemplates.fluent.OperationTemplatesClient":"Azure.ResourceManager.OperationTemplates","azure.resourcemanager.operationtemplates.fluent.OperationsClient":"Azure.ResourceManager.OperationTemplates.Operations","azure.resourcemanager.operationtemplates.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient":"Azure.ResourceManager.OperationTemplates.OptionalBody","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.getByResourceGroup":"Azure.ResourceManager.OperationTemplates.OptionalBody.get","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.getByResourceGroupWithResponse":"Azure.ResourceManager.OperationTemplates.OptionalBody.get","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.patch":"Azure.ResourceManager.OperationTemplates.OptionalBody.patch","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.patchWithResponse":"Azure.ResourceManager.OperationTemplates.OptionalBody.patch","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.post":"Azure.ResourceManager.OperationTemplates.OptionalBody.post","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.postWithResponse":"Azure.ResourceManager.OperationTemplates.OptionalBody.post","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.providerPost":"Azure.ResourceManager.OperationTemplates.OptionalBody.providerPost","azure.resourcemanager.operationtemplates.fluent.OptionalBodiesClient.providerPostWithResponse":"Azure.ResourceManager.OperationTemplates.OptionalBody.providerPost","azure.resourcemanager.operationtemplates.fluent.models.ActionResultInner":"Azure.ResourceManager.OperationTemplates.ActionResult","azure.resourcemanager.operationtemplates.fluent.models.ChangeAllowanceResultInner":"Azure.ResourceManager.OperationTemplates.ChangeAllowanceResult","azure.resourcemanager.operationtemplates.fluent.models.CheckNameAvailabilityResponseInner":"Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse","azure.resourcemanager.operationtemplates.fluent.models.ExportResultInner":"Azure.ResourceManager.OperationTemplates.ExportResult","azure.resourcemanager.operationtemplates.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","azure.resourcemanager.operationtemplates.fluent.models.OrderInner":"Azure.ResourceManager.OperationTemplates.Order","azure.resourcemanager.operationtemplates.fluent.models.WidgetInner":"Azure.ResourceManager.OperationTemplates.Widget","azure.resourcemanager.operationtemplates.implementation.OperationTemplatesClientBuilder":"Azure.ResourceManager.OperationTemplates","azure.resourcemanager.operationtemplates.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","azure.resourcemanager.operationtemplates.models.ActionRequest":"Azure.ResourceManager.OperationTemplates.ActionRequest","azure.resourcemanager.operationtemplates.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","azure.resourcemanager.operationtemplates.models.ChangeAllowanceRequest":"Azure.ResourceManager.OperationTemplates.ChangeAllowanceRequest","azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityReason":"Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason","azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityRequest":"Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest","azure.resourcemanager.operationtemplates.models.ExportRequest":"Azure.ResourceManager.OperationTemplates.ExportRequest","azure.resourcemanager.operationtemplates.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","azure.resourcemanager.operationtemplates.models.OrderProperties":"Azure.ResourceManager.OperationTemplates.OrderProperties","azure.resourcemanager.operationtemplates.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","azure.resourcemanager.operationtemplates.models.WidgetProperties":"Azure.ResourceManager.OperationTemplates.WidgetProperties"},"generatedFiles":["src/main/java/azure/resourcemanager/operationtemplates/OperationTemplatesManager.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/CheckNameAvailabilitiesClient.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/LroesClient.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationTemplatesClient.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/OperationsClient.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/OptionalBodiesClient.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ActionResultInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ChangeAllowanceResultInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/CheckNameAvailabilityResponseInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/ExportResultInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OperationInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/OrderInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/WidgetInner.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/models/package-info.java","src/main/java/azure/resourcemanager/operationtemplates/fluent/package-info.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/ActionResultImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/ChangeAllowanceResultImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesClientImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilitiesImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/CheckNameAvailabilityResponseImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/ExportResultImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesClientImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/LroesImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientBuilder.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationTemplatesClientImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsClientImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OperationsImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesClientImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OptionalBodiesImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/OrderImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/WidgetImpl.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/models/OperationListResult.java","src/main/java/azure/resourcemanager/operationtemplates/implementation/package-info.java","src/main/java/azure/resourcemanager/operationtemplates/models/ActionRequest.java","src/main/java/azure/resourcemanager/operationtemplates/models/ActionResult.java","src/main/java/azure/resourcemanager/operationtemplates/models/ActionType.java","src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceRequest.java","src/main/java/azure/resourcemanager/operationtemplates/models/ChangeAllowanceResult.java","src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilities.java","src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityReason.java","src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityRequest.java","src/main/java/azure/resourcemanager/operationtemplates/models/CheckNameAvailabilityResponse.java","src/main/java/azure/resourcemanager/operationtemplates/models/ExportRequest.java","src/main/java/azure/resourcemanager/operationtemplates/models/ExportResult.java","src/main/java/azure/resourcemanager/operationtemplates/models/Lroes.java","src/main/java/azure/resourcemanager/operationtemplates/models/Operation.java","src/main/java/azure/resourcemanager/operationtemplates/models/OperationDisplay.java","src/main/java/azure/resourcemanager/operationtemplates/models/Operations.java","src/main/java/azure/resourcemanager/operationtemplates/models/OptionalBodies.java","src/main/java/azure/resourcemanager/operationtemplates/models/Order.java","src/main/java/azure/resourcemanager/operationtemplates/models/OrderProperties.java","src/main/java/azure/resourcemanager/operationtemplates/models/Origin.java","src/main/java/azure/resourcemanager/operationtemplates/models/Widget.java","src/main/java/azure/resourcemanager/operationtemplates/models/WidgetProperties.java","src/main/java/azure/resourcemanager/operationtemplates/models/package-info.java","src/main/java/azure/resourcemanager/operationtemplates/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_apiview_properties.json new file mode 100644 index 00000000000..817067252c9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_apiview_properties.json @@ -0,0 +1,75 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient": "Azure.ResourceManager.Resources.ExtensionsResources", + "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.beginCreateOrUpdate": "Azure.ResourceManager.Resources.ExtensionsResources.createOrUpdate", + "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.createOrUpdate": "Azure.ResourceManager.Resources.ExtensionsResources.createOrUpdate", + "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.delete": "Azure.ResourceManager.Resources.ExtensionsResources.delete", + "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.deleteWithResponse": "Azure.ResourceManager.Resources.ExtensionsResources.delete", + "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.get": "Azure.ResourceManager.Resources.ExtensionsResources.get", + "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.getWithResponse": "Azure.ResourceManager.Resources.ExtensionsResources.get", + "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.listByScope": "Azure.ResourceManager.Resources.ExtensionsResources.listByScope", + "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.update": "Azure.ResourceManager.Resources.ExtensionsResources.update", + "azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.updateWithResponse": "Azure.ResourceManager.Resources.ExtensionsResources.update", + "azure.resourcemanager.resources.fluent.LocationResourcesClient": "Azure.ResourceManager.Resources.LocationResources", + "azure.resourcemanager.resources.fluent.LocationResourcesClient.createOrUpdate": "Azure.ResourceManager.Resources.LocationResources.createOrUpdate", + "azure.resourcemanager.resources.fluent.LocationResourcesClient.createOrUpdateWithResponse": "Azure.ResourceManager.Resources.LocationResources.createOrUpdate", + "azure.resourcemanager.resources.fluent.LocationResourcesClient.delete": "Azure.ResourceManager.Resources.LocationResources.delete", + "azure.resourcemanager.resources.fluent.LocationResourcesClient.deleteWithResponse": "Azure.ResourceManager.Resources.LocationResources.delete", + "azure.resourcemanager.resources.fluent.LocationResourcesClient.get": "Azure.ResourceManager.Resources.LocationResources.get", + "azure.resourcemanager.resources.fluent.LocationResourcesClient.getWithResponse": "Azure.ResourceManager.Resources.LocationResources.get", + "azure.resourcemanager.resources.fluent.LocationResourcesClient.listByLocation": "Azure.ResourceManager.Resources.LocationResources.listByLocation", + "azure.resourcemanager.resources.fluent.LocationResourcesClient.update": "Azure.ResourceManager.Resources.LocationResources.update", + "azure.resourcemanager.resources.fluent.LocationResourcesClient.updateWithResponse": "Azure.ResourceManager.Resources.LocationResources.update", + "azure.resourcemanager.resources.fluent.NestedsClient": "Azure.ResourceManager.Resources.Nested", + "azure.resourcemanager.resources.fluent.NestedsClient.beginCreateOrReplace": "Azure.ResourceManager.Resources.Nested.createOrReplace", + "azure.resourcemanager.resources.fluent.NestedsClient.beginDelete": "Azure.ResourceManager.Resources.Nested.delete", + "azure.resourcemanager.resources.fluent.NestedsClient.beginUpdate": "Azure.ResourceManager.Resources.Nested.update", + "azure.resourcemanager.resources.fluent.NestedsClient.createOrReplace": "Azure.ResourceManager.Resources.Nested.createOrReplace", + "azure.resourcemanager.resources.fluent.NestedsClient.delete": "Azure.ResourceManager.Resources.Nested.delete", + "azure.resourcemanager.resources.fluent.NestedsClient.get": "Azure.ResourceManager.Resources.Nested.get", + "azure.resourcemanager.resources.fluent.NestedsClient.getWithResponse": "Azure.ResourceManager.Resources.Nested.get", + "azure.resourcemanager.resources.fluent.NestedsClient.listByTopLevelTrackedResource": "Azure.ResourceManager.Resources.Nested.listByTopLevelTrackedResource", + "azure.resourcemanager.resources.fluent.NestedsClient.update": "Azure.ResourceManager.Resources.Nested.update", + "azure.resourcemanager.resources.fluent.ResourcesClient": "Azure.ResourceManager.Resources", + "azure.resourcemanager.resources.fluent.SingletonsClient": "Azure.ResourceManager.Resources.Singleton", + "azure.resourcemanager.resources.fluent.SingletonsClient.beginCreateOrUpdate": "Azure.ResourceManager.Resources.Singleton.createOrUpdate", + "azure.resourcemanager.resources.fluent.SingletonsClient.createOrUpdate": "Azure.ResourceManager.Resources.Singleton.createOrUpdate", + "azure.resourcemanager.resources.fluent.SingletonsClient.getByResourceGroup": "Azure.ResourceManager.Resources.Singleton.getByResourceGroup", + "azure.resourcemanager.resources.fluent.SingletonsClient.getByResourceGroupWithResponse": "Azure.ResourceManager.Resources.Singleton.getByResourceGroup", + "azure.resourcemanager.resources.fluent.SingletonsClient.listByResourceGroup": "Azure.ResourceManager.Resources.Singleton.listByResourceGroup", + "azure.resourcemanager.resources.fluent.SingletonsClient.update": "Azure.ResourceManager.Resources.Singleton.update", + "azure.resourcemanager.resources.fluent.SingletonsClient.updateWithResponse": "Azure.ResourceManager.Resources.Singleton.update", + "azure.resourcemanager.resources.fluent.TopLevelsClient": "Azure.ResourceManager.Resources.TopLevel", + "azure.resourcemanager.resources.fluent.TopLevelsClient.actionSync": "Azure.ResourceManager.Resources.TopLevel.actionSync", + "azure.resourcemanager.resources.fluent.TopLevelsClient.actionSyncWithResponse": "Azure.ResourceManager.Resources.TopLevel.actionSync", + "azure.resourcemanager.resources.fluent.TopLevelsClient.beginCreateOrReplace": "Azure.ResourceManager.Resources.TopLevel.createOrReplace", + "azure.resourcemanager.resources.fluent.TopLevelsClient.beginDelete": "Azure.ResourceManager.Resources.TopLevel.delete", + "azure.resourcemanager.resources.fluent.TopLevelsClient.beginUpdate": "Azure.ResourceManager.Resources.TopLevel.update", + "azure.resourcemanager.resources.fluent.TopLevelsClient.createOrReplace": "Azure.ResourceManager.Resources.TopLevel.createOrReplace", + "azure.resourcemanager.resources.fluent.TopLevelsClient.delete": "Azure.ResourceManager.Resources.TopLevel.delete", + "azure.resourcemanager.resources.fluent.TopLevelsClient.getByResourceGroup": "Azure.ResourceManager.Resources.TopLevel.get", + "azure.resourcemanager.resources.fluent.TopLevelsClient.getByResourceGroupWithResponse": "Azure.ResourceManager.Resources.TopLevel.get", + "azure.resourcemanager.resources.fluent.TopLevelsClient.list": "Azure.ResourceManager.Resources.TopLevel.listBySubscription", + "azure.resourcemanager.resources.fluent.TopLevelsClient.listByResourceGroup": "Azure.ResourceManager.Resources.TopLevel.listByResourceGroup", + "azure.resourcemanager.resources.fluent.TopLevelsClient.update": "Azure.ResourceManager.Resources.TopLevel.update", + "azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner": "Azure.ResourceManager.Resources.ExtensionsResource", + "azure.resourcemanager.resources.fluent.models.LocationResourceInner": "Azure.ResourceManager.Resources.LocationResource", + "azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner": "Azure.ResourceManager.Resources.NestedProxyResource", + "azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner": "Azure.ResourceManager.Resources.SingletonTrackedResource", + "azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner": "Azure.ResourceManager.Resources.TopLevelTrackedResource", + "azure.resourcemanager.resources.implementation.ResourcesClientBuilder": "Azure.ResourceManager.Resources", + "azure.resourcemanager.resources.implementation.models.ExtensionsResourceListResult": "Azure.ResourceManager.ResourceListResult", + "azure.resourcemanager.resources.implementation.models.LocationResourceListResult": "Azure.ResourceManager.ResourceListResult", + "azure.resourcemanager.resources.implementation.models.NestedProxyResourceListResult": "Azure.ResourceManager.ResourceListResult", + "azure.resourcemanager.resources.implementation.models.SingletonTrackedResourceListResult": "Azure.ResourceManager.ResourceListResult", + "azure.resourcemanager.resources.implementation.models.TopLevelTrackedResourceListResult": "Azure.ResourceManager.ResourceListResult", + "azure.resourcemanager.resources.models.ExtensionsResourceProperties": "Azure.ResourceManager.Resources.ExtensionsResourceProperties", + "azure.resourcemanager.resources.models.LocationResourceProperties": "Azure.ResourceManager.Resources.LocationResourceProperties", + "azure.resourcemanager.resources.models.NestedProxyResourceProperties": "Azure.ResourceManager.Resources.NestedProxyResourceProperties", + "azure.resourcemanager.resources.models.NotificationDetails": "Azure.ResourceManager.Resources.NotificationDetails", + "azure.resourcemanager.resources.models.ProvisioningState": "Azure.ResourceManager.Resources.ProvisioningState", + "azure.resourcemanager.resources.models.SingletonTrackedResourceProperties": "Azure.ResourceManager.Resources.SingletonTrackedResourceProperties", + "azure.resourcemanager.resources.models.TopLevelTrackedResourceProperties": "Azure.ResourceManager.Resources.TopLevelTrackedResourceProperties" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_metadata.json new file mode 100644 index 00000000000..bf88404e1d9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-resourcemanager-resources-generated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2023-12-01-preview","crossLanguageDefinitions":{"azure.resourcemanager.resources.fluent.ExtensionsResourcesClient":"Azure.ResourceManager.Resources.ExtensionsResources","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.beginCreateOrUpdate":"Azure.ResourceManager.Resources.ExtensionsResources.createOrUpdate","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.createOrUpdate":"Azure.ResourceManager.Resources.ExtensionsResources.createOrUpdate","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.delete":"Azure.ResourceManager.Resources.ExtensionsResources.delete","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.deleteWithResponse":"Azure.ResourceManager.Resources.ExtensionsResources.delete","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.get":"Azure.ResourceManager.Resources.ExtensionsResources.get","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.getWithResponse":"Azure.ResourceManager.Resources.ExtensionsResources.get","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.listByScope":"Azure.ResourceManager.Resources.ExtensionsResources.listByScope","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.update":"Azure.ResourceManager.Resources.ExtensionsResources.update","azure.resourcemanager.resources.fluent.ExtensionsResourcesClient.updateWithResponse":"Azure.ResourceManager.Resources.ExtensionsResources.update","azure.resourcemanager.resources.fluent.LocationResourcesClient":"Azure.ResourceManager.Resources.LocationResources","azure.resourcemanager.resources.fluent.LocationResourcesClient.createOrUpdate":"Azure.ResourceManager.Resources.LocationResources.createOrUpdate","azure.resourcemanager.resources.fluent.LocationResourcesClient.createOrUpdateWithResponse":"Azure.ResourceManager.Resources.LocationResources.createOrUpdate","azure.resourcemanager.resources.fluent.LocationResourcesClient.delete":"Azure.ResourceManager.Resources.LocationResources.delete","azure.resourcemanager.resources.fluent.LocationResourcesClient.deleteWithResponse":"Azure.ResourceManager.Resources.LocationResources.delete","azure.resourcemanager.resources.fluent.LocationResourcesClient.get":"Azure.ResourceManager.Resources.LocationResources.get","azure.resourcemanager.resources.fluent.LocationResourcesClient.getWithResponse":"Azure.ResourceManager.Resources.LocationResources.get","azure.resourcemanager.resources.fluent.LocationResourcesClient.listByLocation":"Azure.ResourceManager.Resources.LocationResources.listByLocation","azure.resourcemanager.resources.fluent.LocationResourcesClient.update":"Azure.ResourceManager.Resources.LocationResources.update","azure.resourcemanager.resources.fluent.LocationResourcesClient.updateWithResponse":"Azure.ResourceManager.Resources.LocationResources.update","azure.resourcemanager.resources.fluent.NestedsClient":"Azure.ResourceManager.Resources.Nested","azure.resourcemanager.resources.fluent.NestedsClient.beginCreateOrReplace":"Azure.ResourceManager.Resources.Nested.createOrReplace","azure.resourcemanager.resources.fluent.NestedsClient.beginDelete":"Azure.ResourceManager.Resources.Nested.delete","azure.resourcemanager.resources.fluent.NestedsClient.beginUpdate":"Azure.ResourceManager.Resources.Nested.update","azure.resourcemanager.resources.fluent.NestedsClient.createOrReplace":"Azure.ResourceManager.Resources.Nested.createOrReplace","azure.resourcemanager.resources.fluent.NestedsClient.delete":"Azure.ResourceManager.Resources.Nested.delete","azure.resourcemanager.resources.fluent.NestedsClient.get":"Azure.ResourceManager.Resources.Nested.get","azure.resourcemanager.resources.fluent.NestedsClient.getWithResponse":"Azure.ResourceManager.Resources.Nested.get","azure.resourcemanager.resources.fluent.NestedsClient.listByTopLevelTrackedResource":"Azure.ResourceManager.Resources.Nested.listByTopLevelTrackedResource","azure.resourcemanager.resources.fluent.NestedsClient.update":"Azure.ResourceManager.Resources.Nested.update","azure.resourcemanager.resources.fluent.ResourcesClient":"Azure.ResourceManager.Resources","azure.resourcemanager.resources.fluent.SingletonsClient":"Azure.ResourceManager.Resources.Singleton","azure.resourcemanager.resources.fluent.SingletonsClient.beginCreateOrUpdate":"Azure.ResourceManager.Resources.Singleton.createOrUpdate","azure.resourcemanager.resources.fluent.SingletonsClient.createOrUpdate":"Azure.ResourceManager.Resources.Singleton.createOrUpdate","azure.resourcemanager.resources.fluent.SingletonsClient.getByResourceGroup":"Azure.ResourceManager.Resources.Singleton.getByResourceGroup","azure.resourcemanager.resources.fluent.SingletonsClient.getByResourceGroupWithResponse":"Azure.ResourceManager.Resources.Singleton.getByResourceGroup","azure.resourcemanager.resources.fluent.SingletonsClient.listByResourceGroup":"Azure.ResourceManager.Resources.Singleton.listByResourceGroup","azure.resourcemanager.resources.fluent.SingletonsClient.update":"Azure.ResourceManager.Resources.Singleton.update","azure.resourcemanager.resources.fluent.SingletonsClient.updateWithResponse":"Azure.ResourceManager.Resources.Singleton.update","azure.resourcemanager.resources.fluent.TopLevelsClient":"Azure.ResourceManager.Resources.TopLevel","azure.resourcemanager.resources.fluent.TopLevelsClient.actionSync":"Azure.ResourceManager.Resources.TopLevel.actionSync","azure.resourcemanager.resources.fluent.TopLevelsClient.actionSyncWithResponse":"Azure.ResourceManager.Resources.TopLevel.actionSync","azure.resourcemanager.resources.fluent.TopLevelsClient.beginCreateOrReplace":"Azure.ResourceManager.Resources.TopLevel.createOrReplace","azure.resourcemanager.resources.fluent.TopLevelsClient.beginDelete":"Azure.ResourceManager.Resources.TopLevel.delete","azure.resourcemanager.resources.fluent.TopLevelsClient.beginUpdate":"Azure.ResourceManager.Resources.TopLevel.update","azure.resourcemanager.resources.fluent.TopLevelsClient.createOrReplace":"Azure.ResourceManager.Resources.TopLevel.createOrReplace","azure.resourcemanager.resources.fluent.TopLevelsClient.delete":"Azure.ResourceManager.Resources.TopLevel.delete","azure.resourcemanager.resources.fluent.TopLevelsClient.getByResourceGroup":"Azure.ResourceManager.Resources.TopLevel.get","azure.resourcemanager.resources.fluent.TopLevelsClient.getByResourceGroupWithResponse":"Azure.ResourceManager.Resources.TopLevel.get","azure.resourcemanager.resources.fluent.TopLevelsClient.list":"Azure.ResourceManager.Resources.TopLevel.listBySubscription","azure.resourcemanager.resources.fluent.TopLevelsClient.listByResourceGroup":"Azure.ResourceManager.Resources.TopLevel.listByResourceGroup","azure.resourcemanager.resources.fluent.TopLevelsClient.update":"Azure.ResourceManager.Resources.TopLevel.update","azure.resourcemanager.resources.fluent.models.ExtensionsResourceInner":"Azure.ResourceManager.Resources.ExtensionsResource","azure.resourcemanager.resources.fluent.models.LocationResourceInner":"Azure.ResourceManager.Resources.LocationResource","azure.resourcemanager.resources.fluent.models.NestedProxyResourceInner":"Azure.ResourceManager.Resources.NestedProxyResource","azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner":"Azure.ResourceManager.Resources.SingletonTrackedResource","azure.resourcemanager.resources.fluent.models.TopLevelTrackedResourceInner":"Azure.ResourceManager.Resources.TopLevelTrackedResource","azure.resourcemanager.resources.implementation.ResourcesClientBuilder":"Azure.ResourceManager.Resources","azure.resourcemanager.resources.implementation.models.ExtensionsResourceListResult":"Azure.ResourceManager.ResourceListResult","azure.resourcemanager.resources.implementation.models.LocationResourceListResult":"Azure.ResourceManager.ResourceListResult","azure.resourcemanager.resources.implementation.models.NestedProxyResourceListResult":"Azure.ResourceManager.ResourceListResult","azure.resourcemanager.resources.implementation.models.SingletonTrackedResourceListResult":"Azure.ResourceManager.ResourceListResult","azure.resourcemanager.resources.implementation.models.TopLevelTrackedResourceListResult":"Azure.ResourceManager.ResourceListResult","azure.resourcemanager.resources.models.ExtensionsResourceProperties":"Azure.ResourceManager.Resources.ExtensionsResourceProperties","azure.resourcemanager.resources.models.LocationResourceProperties":"Azure.ResourceManager.Resources.LocationResourceProperties","azure.resourcemanager.resources.models.NestedProxyResourceProperties":"Azure.ResourceManager.Resources.NestedProxyResourceProperties","azure.resourcemanager.resources.models.NotificationDetails":"Azure.ResourceManager.Resources.NotificationDetails","azure.resourcemanager.resources.models.ProvisioningState":"Azure.ResourceManager.Resources.ProvisioningState","azure.resourcemanager.resources.models.SingletonTrackedResourceProperties":"Azure.ResourceManager.Resources.SingletonTrackedResourceProperties","azure.resourcemanager.resources.models.TopLevelTrackedResourceProperties":"Azure.ResourceManager.Resources.TopLevelTrackedResourceProperties"},"generatedFiles":["src/main/java/azure/resourcemanager/resources/ResourcesManager.java","src/main/java/azure/resourcemanager/resources/fluent/ExtensionsResourcesClient.java","src/main/java/azure/resourcemanager/resources/fluent/LocationResourcesClient.java","src/main/java/azure/resourcemanager/resources/fluent/NestedsClient.java","src/main/java/azure/resourcemanager/resources/fluent/ResourcesClient.java","src/main/java/azure/resourcemanager/resources/fluent/SingletonsClient.java","src/main/java/azure/resourcemanager/resources/fluent/TopLevelsClient.java","src/main/java/azure/resourcemanager/resources/fluent/models/ExtensionsResourceInner.java","src/main/java/azure/resourcemanager/resources/fluent/models/LocationResourceInner.java","src/main/java/azure/resourcemanager/resources/fluent/models/NestedProxyResourceInner.java","src/main/java/azure/resourcemanager/resources/fluent/models/SingletonTrackedResourceInner.java","src/main/java/azure/resourcemanager/resources/fluent/models/TopLevelTrackedResourceInner.java","src/main/java/azure/resourcemanager/resources/fluent/models/package-info.java","src/main/java/azure/resourcemanager/resources/fluent/package-info.java","src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourceImpl.java","src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesClientImpl.java","src/main/java/azure/resourcemanager/resources/implementation/ExtensionsResourcesImpl.java","src/main/java/azure/resourcemanager/resources/implementation/LocationResourceImpl.java","src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesClientImpl.java","src/main/java/azure/resourcemanager/resources/implementation/LocationResourcesImpl.java","src/main/java/azure/resourcemanager/resources/implementation/NestedProxyResourceImpl.java","src/main/java/azure/resourcemanager/resources/implementation/NestedsClientImpl.java","src/main/java/azure/resourcemanager/resources/implementation/NestedsImpl.java","src/main/java/azure/resourcemanager/resources/implementation/ResourceManagerUtils.java","src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientBuilder.java","src/main/java/azure/resourcemanager/resources/implementation/ResourcesClientImpl.java","src/main/java/azure/resourcemanager/resources/implementation/SingletonTrackedResourceImpl.java","src/main/java/azure/resourcemanager/resources/implementation/SingletonsClientImpl.java","src/main/java/azure/resourcemanager/resources/implementation/SingletonsImpl.java","src/main/java/azure/resourcemanager/resources/implementation/TopLevelTrackedResourceImpl.java","src/main/java/azure/resourcemanager/resources/implementation/TopLevelsClientImpl.java","src/main/java/azure/resourcemanager/resources/implementation/TopLevelsImpl.java","src/main/java/azure/resourcemanager/resources/implementation/models/ExtensionsResourceListResult.java","src/main/java/azure/resourcemanager/resources/implementation/models/LocationResourceListResult.java","src/main/java/azure/resourcemanager/resources/implementation/models/NestedProxyResourceListResult.java","src/main/java/azure/resourcemanager/resources/implementation/models/SingletonTrackedResourceListResult.java","src/main/java/azure/resourcemanager/resources/implementation/models/TopLevelTrackedResourceListResult.java","src/main/java/azure/resourcemanager/resources/implementation/package-info.java","src/main/java/azure/resourcemanager/resources/models/ExtensionsResource.java","src/main/java/azure/resourcemanager/resources/models/ExtensionsResourceProperties.java","src/main/java/azure/resourcemanager/resources/models/ExtensionsResources.java","src/main/java/azure/resourcemanager/resources/models/LocationResource.java","src/main/java/azure/resourcemanager/resources/models/LocationResourceProperties.java","src/main/java/azure/resourcemanager/resources/models/LocationResources.java","src/main/java/azure/resourcemanager/resources/models/NestedProxyResource.java","src/main/java/azure/resourcemanager/resources/models/NestedProxyResourceProperties.java","src/main/java/azure/resourcemanager/resources/models/Nesteds.java","src/main/java/azure/resourcemanager/resources/models/NotificationDetails.java","src/main/java/azure/resourcemanager/resources/models/ProvisioningState.java","src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResource.java","src/main/java/azure/resourcemanager/resources/models/SingletonTrackedResourceProperties.java","src/main/java/azure/resourcemanager/resources/models/Singletons.java","src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResource.java","src/main/java/azure/resourcemanager/resources/models/TopLevelTrackedResourceProperties.java","src/main/java/azure/resourcemanager/resources/models/TopLevels.java","src/main/java/azure/resourcemanager/resources/models/package-info.java","src/main/java/azure/resourcemanager/resources/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_apiview_properties.json new file mode 100644 index 00000000000..ab80c581358 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_apiview_properties.json @@ -0,0 +1,12 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdAsyncClient": "Azure.SpecialHeaders.XmsClientRequestId", + "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdAsyncClient.get": "Azure.SpecialHeaders.XmsClientRequestId.get", + "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdAsyncClient.getWithResponse": "Azure.SpecialHeaders.XmsClientRequestId.get", + "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient": "Azure.SpecialHeaders.XmsClientRequestId", + "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient.get": "Azure.SpecialHeaders.XmsClientRequestId.get", + "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient.getWithResponse": "Azure.SpecialHeaders.XmsClientRequestId.get", + "azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClientBuilder": "Azure.SpecialHeaders.XmsClientRequestId" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_metadata.json new file mode 100644 index 00000000000..86eec9b4669 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-specialheaders-xmsclientrequestid_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"azure.specialheaders.xmsclientrequestid.XmsClientRequestIdAsyncClient":"Azure.SpecialHeaders.XmsClientRequestId","azure.specialheaders.xmsclientrequestid.XmsClientRequestIdAsyncClient.get":"Azure.SpecialHeaders.XmsClientRequestId.get","azure.specialheaders.xmsclientrequestid.XmsClientRequestIdAsyncClient.getWithResponse":"Azure.SpecialHeaders.XmsClientRequestId.get","azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient":"Azure.SpecialHeaders.XmsClientRequestId","azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient.get":"Azure.SpecialHeaders.XmsClientRequestId.get","azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient.getWithResponse":"Azure.SpecialHeaders.XmsClientRequestId.get","azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClientBuilder":"Azure.SpecialHeaders.XmsClientRequestId"},"generatedFiles":["src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdAsyncClient.java","src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClient.java","src/main/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdClientBuilder.java","src/main/java/azure/specialheaders/xmsclientrequestid/implementation/XmsClientRequestIdClientImpl.java","src/main/java/azure/specialheaders/xmsclientrequestid/implementation/package-info.java","src/main/java/azure/specialheaders/xmsclientrequestid/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_apiview_properties.json new file mode 100644 index 00000000000..bd69a696a6d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_apiview_properties.json @@ -0,0 +1,23 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "azure.versioning.previewversion.PreviewVersionAsyncClient": "_Specs_.Azure.Versioning.PreviewVersion", + "azure.versioning.previewversion.PreviewVersionAsyncClient.getWidget": "_Specs_.Azure.Versioning.PreviewVersion.getWidget", + "azure.versioning.previewversion.PreviewVersionAsyncClient.getWidgetWithResponse": "_Specs_.Azure.Versioning.PreviewVersion.getWidget", + "azure.versioning.previewversion.PreviewVersionAsyncClient.listWidgets": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets", + "azure.versioning.previewversion.PreviewVersionAsyncClient.listWidgetsWithResponse": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets", + "azure.versioning.previewversion.PreviewVersionAsyncClient.updateWidgetColor": "_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor", + "azure.versioning.previewversion.PreviewVersionAsyncClient.updateWidgetColorWithResponse": "_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor", + "azure.versioning.previewversion.PreviewVersionClient": "_Specs_.Azure.Versioning.PreviewVersion", + "azure.versioning.previewversion.PreviewVersionClient.getWidget": "_Specs_.Azure.Versioning.PreviewVersion.getWidget", + "azure.versioning.previewversion.PreviewVersionClient.getWidgetWithResponse": "_Specs_.Azure.Versioning.PreviewVersion.getWidget", + "azure.versioning.previewversion.PreviewVersionClient.listWidgets": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets", + "azure.versioning.previewversion.PreviewVersionClient.listWidgetsWithResponse": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets", + "azure.versioning.previewversion.PreviewVersionClient.updateWidgetColor": "_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor", + "azure.versioning.previewversion.PreviewVersionClient.updateWidgetColorWithResponse": "_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor", + "azure.versioning.previewversion.PreviewVersionClientBuilder": "_Specs_.Azure.Versioning.PreviewVersion", + "azure.versioning.previewversion.models.ListWidgetsResponse": "_Specs_.Azure.Versioning.PreviewVersion.listWidgets.Response.anonymous", + "azure.versioning.previewversion.models.UpdateWidgetColorRequest": "_Specs_.Azure.Versioning.PreviewVersion.UpdateWidgetColorRequest", + "azure.versioning.previewversion.models.Widget": "_Specs_.Azure.Versioning.PreviewVersion.Widget" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_metadata.json new file mode 100644 index 00000000000..036009afc6f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/azure-versioning-previewversion_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2024-12-01-preview","crossLanguageDefinitions":{"azure.versioning.previewversion.PreviewVersionAsyncClient":"_Specs_.Azure.Versioning.PreviewVersion","azure.versioning.previewversion.PreviewVersionAsyncClient.getWidget":"_Specs_.Azure.Versioning.PreviewVersion.getWidget","azure.versioning.previewversion.PreviewVersionAsyncClient.getWidgetWithResponse":"_Specs_.Azure.Versioning.PreviewVersion.getWidget","azure.versioning.previewversion.PreviewVersionAsyncClient.listWidgets":"_Specs_.Azure.Versioning.PreviewVersion.listWidgets","azure.versioning.previewversion.PreviewVersionAsyncClient.listWidgetsWithResponse":"_Specs_.Azure.Versioning.PreviewVersion.listWidgets","azure.versioning.previewversion.PreviewVersionAsyncClient.updateWidgetColor":"_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor","azure.versioning.previewversion.PreviewVersionAsyncClient.updateWidgetColorWithResponse":"_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor","azure.versioning.previewversion.PreviewVersionClient":"_Specs_.Azure.Versioning.PreviewVersion","azure.versioning.previewversion.PreviewVersionClient.getWidget":"_Specs_.Azure.Versioning.PreviewVersion.getWidget","azure.versioning.previewversion.PreviewVersionClient.getWidgetWithResponse":"_Specs_.Azure.Versioning.PreviewVersion.getWidget","azure.versioning.previewversion.PreviewVersionClient.listWidgets":"_Specs_.Azure.Versioning.PreviewVersion.listWidgets","azure.versioning.previewversion.PreviewVersionClient.listWidgetsWithResponse":"_Specs_.Azure.Versioning.PreviewVersion.listWidgets","azure.versioning.previewversion.PreviewVersionClient.updateWidgetColor":"_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor","azure.versioning.previewversion.PreviewVersionClient.updateWidgetColorWithResponse":"_Specs_.Azure.Versioning.PreviewVersion.updateWidgetColor","azure.versioning.previewversion.PreviewVersionClientBuilder":"_Specs_.Azure.Versioning.PreviewVersion","azure.versioning.previewversion.models.ListWidgetsResponse":"_Specs_.Azure.Versioning.PreviewVersion.listWidgets.Response.anonymous","azure.versioning.previewversion.models.UpdateWidgetColorRequest":"_Specs_.Azure.Versioning.PreviewVersion.UpdateWidgetColorRequest","azure.versioning.previewversion.models.Widget":"_Specs_.Azure.Versioning.PreviewVersion.Widget"},"generatedFiles":["src/main/java/azure/versioning/previewversion/PreviewVersionAsyncClient.java","src/main/java/azure/versioning/previewversion/PreviewVersionClient.java","src/main/java/azure/versioning/previewversion/PreviewVersionClientBuilder.java","src/main/java/azure/versioning/previewversion/PreviewVersionServiceVersion.java","src/main/java/azure/versioning/previewversion/implementation/JsonMergePatchHelper.java","src/main/java/azure/versioning/previewversion/implementation/PreviewVersionClientImpl.java","src/main/java/azure/versioning/previewversion/implementation/package-info.java","src/main/java/azure/versioning/previewversion/models/ListWidgetsResponse.java","src/main/java/azure/versioning/previewversion/models/UpdateWidgetColorRequest.java","src/main/java/azure/versioning/previewversion/models/Widget.java","src/main/java/azure/versioning/previewversion/models/package-info.java","src/main/java/azure/versioning/previewversion/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_apiview_properties.json new file mode 100644 index 00000000000..d59cf7dae7c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_apiview_properties.json @@ -0,0 +1,22 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "client.clientnamespace.ClientNamespaceFirstAsyncClient": "ClientNameSpaceClient.ClientNamespaceFirstClient", + "client.clientnamespace.ClientNamespaceFirstAsyncClient.getFirst": "ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst", + "client.clientnamespace.ClientNamespaceFirstAsyncClient.getFirstWithResponse": "ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst", + "client.clientnamespace.ClientNamespaceFirstClient": "ClientNameSpaceClient.ClientNamespaceFirstClient", + "client.clientnamespace.ClientNamespaceFirstClient.getFirst": "ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst", + "client.clientnamespace.ClientNamespaceFirstClient.getFirstWithResponse": "ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst", + "client.clientnamespace.ClientNamespaceFirstClientBuilder": "ClientNameSpaceClient.ClientNamespaceFirstClient", + "client.clientnamespace.first.models.FirstClientResult": "Client.ClientNamespace.FirstModel.FirstClientResult", + "client.clientnamespace.second.ClientNamespaceSecondAsyncClient": "ClientNameSpaceClient.ClientNamespaceSecondClient", + "client.clientnamespace.second.ClientNamespaceSecondAsyncClient.getSecond": "ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond", + "client.clientnamespace.second.ClientNamespaceSecondAsyncClient.getSecondWithResponse": "ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond", + "client.clientnamespace.second.ClientNamespaceSecondClient": "ClientNameSpaceClient.ClientNamespaceSecondClient", + "client.clientnamespace.second.ClientNamespaceSecondClient.getSecond": "ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond", + "client.clientnamespace.second.ClientNamespaceSecondClient.getSecondWithResponse": "ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond", + "client.clientnamespace.second.ClientNamespaceSecondClientBuilder": "ClientNameSpaceClient.ClientNamespaceSecondClient", + "client.clientnamespace.second.models.SecondClientResult": "Client.ClientNamespace.Second.Model.SecondClientResult", + "client.clientnamespace.second.sub.models.SecondClientEnumType": "Client.ClientNamespace.Second.Model.SecondClientEnumType" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_metadata.json new file mode 100644 index 00000000000..cfa23759df2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-clientnamespace_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"client.clientnamespace.ClientNamespaceFirstAsyncClient":"ClientNameSpaceClient.ClientNamespaceFirstClient","client.clientnamespace.ClientNamespaceFirstAsyncClient.getFirst":"ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst","client.clientnamespace.ClientNamespaceFirstAsyncClient.getFirstWithResponse":"ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst","client.clientnamespace.ClientNamespaceFirstClient":"ClientNameSpaceClient.ClientNamespaceFirstClient","client.clientnamespace.ClientNamespaceFirstClient.getFirst":"ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst","client.clientnamespace.ClientNamespaceFirstClient.getFirstWithResponse":"ClientNameSpaceClient.ClientNamespaceFirstClient.getFirst","client.clientnamespace.ClientNamespaceFirstClientBuilder":"ClientNameSpaceClient.ClientNamespaceFirstClient","client.clientnamespace.first.models.FirstClientResult":"Client.ClientNamespace.FirstModel.FirstClientResult","client.clientnamespace.second.ClientNamespaceSecondAsyncClient":"ClientNameSpaceClient.ClientNamespaceSecondClient","client.clientnamespace.second.ClientNamespaceSecondAsyncClient.getSecond":"ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond","client.clientnamespace.second.ClientNamespaceSecondAsyncClient.getSecondWithResponse":"ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond","client.clientnamespace.second.ClientNamespaceSecondClient":"ClientNameSpaceClient.ClientNamespaceSecondClient","client.clientnamespace.second.ClientNamespaceSecondClient.getSecond":"ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond","client.clientnamespace.second.ClientNamespaceSecondClient.getSecondWithResponse":"ClientNameSpaceClient.ClientNamespaceSecondClient.getSecond","client.clientnamespace.second.ClientNamespaceSecondClientBuilder":"ClientNameSpaceClient.ClientNamespaceSecondClient","client.clientnamespace.second.models.SecondClientResult":"Client.ClientNamespace.Second.Model.SecondClientResult","client.clientnamespace.second.sub.models.SecondClientEnumType":"Client.ClientNamespace.Second.Model.SecondClientEnumType"},"generatedFiles":["src/main/java/client/clientnamespace/ClientNamespaceFirstAsyncClient.java","src/main/java/client/clientnamespace/ClientNamespaceFirstClient.java","src/main/java/client/clientnamespace/ClientNamespaceFirstClientBuilder.java","src/main/java/client/clientnamespace/first/models/FirstClientResult.java","src/main/java/client/clientnamespace/first/models/package-info.java","src/main/java/client/clientnamespace/implementation/ClientNamespaceFirstClientImpl.java","src/main/java/client/clientnamespace/implementation/ClientNamespaceSecondClientImpl.java","src/main/java/client/clientnamespace/implementation/package-info.java","src/main/java/client/clientnamespace/package-info.java","src/main/java/client/clientnamespace/second/ClientNamespaceSecondAsyncClient.java","src/main/java/client/clientnamespace/second/ClientNamespaceSecondClient.java","src/main/java/client/clientnamespace/second/ClientNamespaceSecondClientBuilder.java","src/main/java/client/clientnamespace/second/models/SecondClientResult.java","src/main/java/client/clientnamespace/second/models/package-info.java","src/main/java/client/clientnamespace/second/package-info.java","src/main/java/client/clientnamespace/second/sub/models/SecondClientEnumType.java","src/main/java/client/clientnamespace/second/sub/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_apiview_properties.json new file mode 100644 index 00000000000..a4831a5f744 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_apiview_properties.json @@ -0,0 +1,22 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "client.naming.enumconflict.EnumConflictClientBuilder": "Client.Naming.EnumConflict", + "client.naming.enumconflict.FirstOperationsAsyncClient": "Client.Naming.EnumConflict.FirstOperations", + "client.naming.enumconflict.FirstOperationsAsyncClient.first": "Client.Naming.EnumConflict.FirstOperations.first", + "client.naming.enumconflict.FirstOperationsAsyncClient.firstWithResponse": "Client.Naming.EnumConflict.FirstOperations.first", + "client.naming.enumconflict.FirstOperationsClient": "Client.Naming.EnumConflict.FirstOperations", + "client.naming.enumconflict.FirstOperationsClient.first": "Client.Naming.EnumConflict.FirstOperations.first", + "client.naming.enumconflict.FirstOperationsClient.firstWithResponse": "Client.Naming.EnumConflict.FirstOperations.first", + "client.naming.enumconflict.SecondOperationsAsyncClient": "Client.Naming.EnumConflict.SecondOperations", + "client.naming.enumconflict.SecondOperationsAsyncClient.second": "Client.Naming.EnumConflict.SecondOperations.second", + "client.naming.enumconflict.SecondOperationsAsyncClient.secondWithResponse": "Client.Naming.EnumConflict.SecondOperations.second", + "client.naming.enumconflict.SecondOperationsClient": "Client.Naming.EnumConflict.SecondOperations", + "client.naming.enumconflict.SecondOperationsClient.second": "Client.Naming.EnumConflict.SecondOperations.second", + "client.naming.enumconflict.SecondOperationsClient.secondWithResponse": "Client.Naming.EnumConflict.SecondOperations.second", + "client.naming.enumconflict.firstnamespace.models.FirstModel": "Client.Naming.EnumConflict.FirstNamespace.FirstModel", + "client.naming.enumconflict.firstnamespace.models.Status": "Client.Naming.EnumConflict.FirstNamespace.Status", + "client.naming.enumconflict.secondnamespace.models.SecondModel": "Client.Naming.EnumConflict.SecondNamespace.SecondModel", + "client.naming.enumconflict.secondnamespace.models.SecondStatus": "Client.Naming.EnumConflict.SecondNamespace.Status" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_metadata.json new file mode 100644 index 00000000000..654827ac5b6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming-enumconflict_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"client.naming.enumconflict.EnumConflictClientBuilder":"Client.Naming.EnumConflict","client.naming.enumconflict.FirstOperationsAsyncClient":"Client.Naming.EnumConflict.FirstOperations","client.naming.enumconflict.FirstOperationsAsyncClient.first":"Client.Naming.EnumConflict.FirstOperations.first","client.naming.enumconflict.FirstOperationsAsyncClient.firstWithResponse":"Client.Naming.EnumConflict.FirstOperations.first","client.naming.enumconflict.FirstOperationsClient":"Client.Naming.EnumConflict.FirstOperations","client.naming.enumconflict.FirstOperationsClient.first":"Client.Naming.EnumConflict.FirstOperations.first","client.naming.enumconflict.FirstOperationsClient.firstWithResponse":"Client.Naming.EnumConflict.FirstOperations.first","client.naming.enumconflict.SecondOperationsAsyncClient":"Client.Naming.EnumConflict.SecondOperations","client.naming.enumconflict.SecondOperationsAsyncClient.second":"Client.Naming.EnumConflict.SecondOperations.second","client.naming.enumconflict.SecondOperationsAsyncClient.secondWithResponse":"Client.Naming.EnumConflict.SecondOperations.second","client.naming.enumconflict.SecondOperationsClient":"Client.Naming.EnumConflict.SecondOperations","client.naming.enumconflict.SecondOperationsClient.second":"Client.Naming.EnumConflict.SecondOperations.second","client.naming.enumconflict.SecondOperationsClient.secondWithResponse":"Client.Naming.EnumConflict.SecondOperations.second","client.naming.enumconflict.firstnamespace.models.FirstModel":"Client.Naming.EnumConflict.FirstNamespace.FirstModel","client.naming.enumconflict.firstnamespace.models.Status":"Client.Naming.EnumConflict.FirstNamespace.Status","client.naming.enumconflict.secondnamespace.models.SecondModel":"Client.Naming.EnumConflict.SecondNamespace.SecondModel","client.naming.enumconflict.secondnamespace.models.SecondStatus":"Client.Naming.EnumConflict.SecondNamespace.Status"},"generatedFiles":["src/main/java/client/naming/enumconflict/EnumConflictClientBuilder.java","src/main/java/client/naming/enumconflict/FirstOperationsAsyncClient.java","src/main/java/client/naming/enumconflict/FirstOperationsClient.java","src/main/java/client/naming/enumconflict/SecondOperationsAsyncClient.java","src/main/java/client/naming/enumconflict/SecondOperationsClient.java","src/main/java/client/naming/enumconflict/firstnamespace/models/FirstModel.java","src/main/java/client/naming/enumconflict/firstnamespace/models/Status.java","src/main/java/client/naming/enumconflict/firstnamespace/models/package-info.java","src/main/java/client/naming/enumconflict/implementation/EnumConflictClientImpl.java","src/main/java/client/naming/enumconflict/implementation/FirstOperationsImpl.java","src/main/java/client/naming/enumconflict/implementation/SecondOperationsImpl.java","src/main/java/client/naming/enumconflict/implementation/package-info.java","src/main/java/client/naming/enumconflict/package-info.java","src/main/java/client/naming/enumconflict/secondnamespace/models/SecondModel.java","src/main/java/client/naming/enumconflict/secondnamespace/models/SecondStatus.java","src/main/java/client/naming/enumconflict/secondnamespace/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_apiview_properties.json new file mode 100644 index 00000000000..40f6085435d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_apiview_properties.json @@ -0,0 +1,63 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "client.naming.ModelAsyncClient": "Client.Naming.Model", + "client.naming.ModelAsyncClient.client": "Client.Naming.Model.client", + "client.naming.ModelAsyncClient.clientWithResponse": "Client.Naming.Model.client", + "client.naming.ModelAsyncClient.language": "Client.Naming.Model.language", + "client.naming.ModelAsyncClient.languageWithResponse": "Client.Naming.Model.language", + "client.naming.ModelClient": "Client.Naming.Model", + "client.naming.ModelClient.client": "Client.Naming.Model.client", + "client.naming.ModelClient.clientWithResponse": "Client.Naming.Model.client", + "client.naming.ModelClient.language": "Client.Naming.Model.language", + "client.naming.ModelClient.languageWithResponse": "Client.Naming.Model.language", + "client.naming.NamingAsyncClient": "Client.Naming", + "client.naming.NamingAsyncClient.client": "Client.Naming.Property.client", + "client.naming.NamingAsyncClient.clientName": "Client.Naming.operation", + "client.naming.NamingAsyncClient.clientNameWithResponse": "Client.Naming.operation", + "client.naming.NamingAsyncClient.clientWithResponse": "Client.Naming.Property.client", + "client.naming.NamingAsyncClient.compatibleWithEncodedName": "Client.Naming.Property.compatibleWithEncodedName", + "client.naming.NamingAsyncClient.compatibleWithEncodedNameWithResponse": "Client.Naming.Property.compatibleWithEncodedName", + "client.naming.NamingAsyncClient.language": "Client.Naming.Property.language", + "client.naming.NamingAsyncClient.languageWithResponse": "Client.Naming.Property.language", + "client.naming.NamingAsyncClient.parameter": "Client.Naming.parameter", + "client.naming.NamingAsyncClient.parameterWithResponse": "Client.Naming.parameter", + "client.naming.NamingAsyncClient.request": "Client.Naming.Header.request", + "client.naming.NamingAsyncClient.requestWithResponse": "Client.Naming.Header.request", + "client.naming.NamingAsyncClient.response": "Client.Naming.Header.response", + "client.naming.NamingAsyncClient.responseWithResponse": "Client.Naming.Header.response", + "client.naming.NamingClient": "Client.Naming", + "client.naming.NamingClient.client": "Client.Naming.Property.client", + "client.naming.NamingClient.clientName": "Client.Naming.operation", + "client.naming.NamingClient.clientNameWithResponse": "Client.Naming.operation", + "client.naming.NamingClient.clientWithResponse": "Client.Naming.Property.client", + "client.naming.NamingClient.compatibleWithEncodedName": "Client.Naming.Property.compatibleWithEncodedName", + "client.naming.NamingClient.compatibleWithEncodedNameWithResponse": "Client.Naming.Property.compatibleWithEncodedName", + "client.naming.NamingClient.language": "Client.Naming.Property.language", + "client.naming.NamingClient.languageWithResponse": "Client.Naming.Property.language", + "client.naming.NamingClient.parameter": "Client.Naming.parameter", + "client.naming.NamingClient.parameterWithResponse": "Client.Naming.parameter", + "client.naming.NamingClient.request": "Client.Naming.Header.request", + "client.naming.NamingClient.requestWithResponse": "Client.Naming.Header.request", + "client.naming.NamingClient.response": "Client.Naming.Header.response", + "client.naming.NamingClient.responseWithResponse": "Client.Naming.Header.response", + "client.naming.NamingClientBuilder": "Client.Naming", + "client.naming.UnionEnumAsyncClient": "Client.Naming.UnionEnum", + "client.naming.UnionEnumAsyncClient.unionEnumMemberName": "Client.Naming.UnionEnum.unionEnumMemberName", + "client.naming.UnionEnumAsyncClient.unionEnumMemberNameWithResponse": "Client.Naming.UnionEnum.unionEnumMemberName", + "client.naming.UnionEnumAsyncClient.unionEnumName": "Client.Naming.UnionEnum.unionEnumName", + "client.naming.UnionEnumAsyncClient.unionEnumNameWithResponse": "Client.Naming.UnionEnum.unionEnumName", + "client.naming.UnionEnumClient": "Client.Naming.UnionEnum", + "client.naming.UnionEnumClient.unionEnumMemberName": "Client.Naming.UnionEnum.unionEnumMemberName", + "client.naming.UnionEnumClient.unionEnumMemberNameWithResponse": "Client.Naming.UnionEnum.unionEnumMemberName", + "client.naming.UnionEnumClient.unionEnumName": "Client.Naming.UnionEnum.unionEnumName", + "client.naming.UnionEnumClient.unionEnumNameWithResponse": "Client.Naming.UnionEnum.unionEnumName", + "client.naming.model.models.ClientModel": "Client.Naming.Model.ModelWithClientClientName", + "client.naming.model.models.JavaModel": "Client.Naming.Model.ModelWithLanguageClientName", + "client.naming.property.models.ClientNameAndJsonEncodedNameModel": "Client.Naming.Property.ClientNameAndJsonEncodedNameModel", + "client.naming.property.models.ClientNameModel": "Client.Naming.Property.ClientNameModel", + "client.naming.property.models.LanguageClientNameModel": "Client.Naming.Property.LanguageClientNameModel", + "client.naming.unionenum.models.ClientExtensibleEnum": "Client.Naming.UnionEnum.ServerExtensibleEnum", + "client.naming.unionenum.models.ExtensibleEnum": "Client.Naming.UnionEnum.ExtensibleEnum" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_metadata.json new file mode 100644 index 00000000000..310a52df4d1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-naming_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"client.naming.ModelAsyncClient":"Client.Naming.Model","client.naming.ModelAsyncClient.client":"Client.Naming.Model.client","client.naming.ModelAsyncClient.clientWithResponse":"Client.Naming.Model.client","client.naming.ModelAsyncClient.language":"Client.Naming.Model.language","client.naming.ModelAsyncClient.languageWithResponse":"Client.Naming.Model.language","client.naming.ModelClient":"Client.Naming.Model","client.naming.ModelClient.client":"Client.Naming.Model.client","client.naming.ModelClient.clientWithResponse":"Client.Naming.Model.client","client.naming.ModelClient.language":"Client.Naming.Model.language","client.naming.ModelClient.languageWithResponse":"Client.Naming.Model.language","client.naming.NamingAsyncClient":"Client.Naming","client.naming.NamingAsyncClient.client":"Client.Naming.Property.client","client.naming.NamingAsyncClient.clientName":"Client.Naming.operation","client.naming.NamingAsyncClient.clientNameWithResponse":"Client.Naming.operation","client.naming.NamingAsyncClient.clientWithResponse":"Client.Naming.Property.client","client.naming.NamingAsyncClient.compatibleWithEncodedName":"Client.Naming.Property.compatibleWithEncodedName","client.naming.NamingAsyncClient.compatibleWithEncodedNameWithResponse":"Client.Naming.Property.compatibleWithEncodedName","client.naming.NamingAsyncClient.language":"Client.Naming.Property.language","client.naming.NamingAsyncClient.languageWithResponse":"Client.Naming.Property.language","client.naming.NamingAsyncClient.parameter":"Client.Naming.parameter","client.naming.NamingAsyncClient.parameterWithResponse":"Client.Naming.parameter","client.naming.NamingAsyncClient.request":"Client.Naming.Header.request","client.naming.NamingAsyncClient.requestWithResponse":"Client.Naming.Header.request","client.naming.NamingAsyncClient.response":"Client.Naming.Header.response","client.naming.NamingAsyncClient.responseWithResponse":"Client.Naming.Header.response","client.naming.NamingClient":"Client.Naming","client.naming.NamingClient.client":"Client.Naming.Property.client","client.naming.NamingClient.clientName":"Client.Naming.operation","client.naming.NamingClient.clientNameWithResponse":"Client.Naming.operation","client.naming.NamingClient.clientWithResponse":"Client.Naming.Property.client","client.naming.NamingClient.compatibleWithEncodedName":"Client.Naming.Property.compatibleWithEncodedName","client.naming.NamingClient.compatibleWithEncodedNameWithResponse":"Client.Naming.Property.compatibleWithEncodedName","client.naming.NamingClient.language":"Client.Naming.Property.language","client.naming.NamingClient.languageWithResponse":"Client.Naming.Property.language","client.naming.NamingClient.parameter":"Client.Naming.parameter","client.naming.NamingClient.parameterWithResponse":"Client.Naming.parameter","client.naming.NamingClient.request":"Client.Naming.Header.request","client.naming.NamingClient.requestWithResponse":"Client.Naming.Header.request","client.naming.NamingClient.response":"Client.Naming.Header.response","client.naming.NamingClient.responseWithResponse":"Client.Naming.Header.response","client.naming.NamingClientBuilder":"Client.Naming","client.naming.UnionEnumAsyncClient":"Client.Naming.UnionEnum","client.naming.UnionEnumAsyncClient.unionEnumMemberName":"Client.Naming.UnionEnum.unionEnumMemberName","client.naming.UnionEnumAsyncClient.unionEnumMemberNameWithResponse":"Client.Naming.UnionEnum.unionEnumMemberName","client.naming.UnionEnumAsyncClient.unionEnumName":"Client.Naming.UnionEnum.unionEnumName","client.naming.UnionEnumAsyncClient.unionEnumNameWithResponse":"Client.Naming.UnionEnum.unionEnumName","client.naming.UnionEnumClient":"Client.Naming.UnionEnum","client.naming.UnionEnumClient.unionEnumMemberName":"Client.Naming.UnionEnum.unionEnumMemberName","client.naming.UnionEnumClient.unionEnumMemberNameWithResponse":"Client.Naming.UnionEnum.unionEnumMemberName","client.naming.UnionEnumClient.unionEnumName":"Client.Naming.UnionEnum.unionEnumName","client.naming.UnionEnumClient.unionEnumNameWithResponse":"Client.Naming.UnionEnum.unionEnumName","client.naming.model.models.ClientModel":"Client.Naming.Model.ModelWithClientClientName","client.naming.model.models.JavaModel":"Client.Naming.Model.ModelWithLanguageClientName","client.naming.property.models.ClientNameAndJsonEncodedNameModel":"Client.Naming.Property.ClientNameAndJsonEncodedNameModel","client.naming.property.models.ClientNameModel":"Client.Naming.Property.ClientNameModel","client.naming.property.models.LanguageClientNameModel":"Client.Naming.Property.LanguageClientNameModel","client.naming.unionenum.models.ClientExtensibleEnum":"Client.Naming.UnionEnum.ServerExtensibleEnum","client.naming.unionenum.models.ExtensibleEnum":"Client.Naming.UnionEnum.ExtensibleEnum"},"generatedFiles":["src/main/java/client/naming/ModelAsyncClient.java","src/main/java/client/naming/ModelClient.java","src/main/java/client/naming/NamingAsyncClient.java","src/main/java/client/naming/NamingClient.java","src/main/java/client/naming/NamingClientBuilder.java","src/main/java/client/naming/UnionEnumAsyncClient.java","src/main/java/client/naming/UnionEnumClient.java","src/main/java/client/naming/implementation/ModelClientsImpl.java","src/main/java/client/naming/implementation/NamingClientImpl.java","src/main/java/client/naming/implementation/UnionEnumsImpl.java","src/main/java/client/naming/implementation/package-info.java","src/main/java/client/naming/model/models/ClientModel.java","src/main/java/client/naming/model/models/JavaModel.java","src/main/java/client/naming/model/models/package-info.java","src/main/java/client/naming/package-info.java","src/main/java/client/naming/property/models/ClientNameAndJsonEncodedNameModel.java","src/main/java/client/naming/property/models/ClientNameModel.java","src/main/java/client/naming/property/models/LanguageClientNameModel.java","src/main/java/client/naming/property/models/package-info.java","src/main/java/client/naming/unionenum/models/ClientExtensibleEnum.java","src/main/java/client/naming/unionenum/models/ExtensibleEnum.java","src/main/java/client/naming/unionenum/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_apiview_properties.json new file mode 100644 index 00000000000..7f451d6a2d4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_apiview_properties.json @@ -0,0 +1,17 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "client.overload.OverloadAsyncClient": "Client.Overload", + "client.overload.OverloadAsyncClient.list": "Client.Overload.list", + "client.overload.OverloadAsyncClient.listByScope": "Client.Overload.listByScope", + "client.overload.OverloadAsyncClient.listByScopeWithResponse": "Client.Overload.listByScope", + "client.overload.OverloadAsyncClient.listWithResponse": "Client.Overload.list", + "client.overload.OverloadClient": "Client.Overload", + "client.overload.OverloadClient.list": "Client.Overload.list", + "client.overload.OverloadClient.listByScope": "Client.Overload.listByScope", + "client.overload.OverloadClient.listByScopeWithResponse": "Client.Overload.listByScope", + "client.overload.OverloadClient.listWithResponse": "Client.Overload.list", + "client.overload.OverloadClientBuilder": "Client.Overload", + "client.overload.models.Resource": "Client.Overload.Resource" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_metadata.json new file mode 100644 index 00000000000..05ce1b694de --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-overload_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"client.overload.OverloadAsyncClient":"Client.Overload","client.overload.OverloadAsyncClient.list":"Client.Overload.list","client.overload.OverloadAsyncClient.listByScope":"Client.Overload.listByScope","client.overload.OverloadAsyncClient.listByScopeWithResponse":"Client.Overload.listByScope","client.overload.OverloadAsyncClient.listWithResponse":"Client.Overload.list","client.overload.OverloadClient":"Client.Overload","client.overload.OverloadClient.list":"Client.Overload.list","client.overload.OverloadClient.listByScope":"Client.Overload.listByScope","client.overload.OverloadClient.listByScopeWithResponse":"Client.Overload.listByScope","client.overload.OverloadClient.listWithResponse":"Client.Overload.list","client.overload.OverloadClientBuilder":"Client.Overload","client.overload.models.Resource":"Client.Overload.Resource"},"generatedFiles":["src/main/java/client/overload/OverloadAsyncClient.java","src/main/java/client/overload/OverloadClient.java","src/main/java/client/overload/OverloadClientBuilder.java","src/main/java/client/overload/implementation/OverloadClientImpl.java","src/main/java/client/overload/implementation/package-info.java","src/main/java/client/overload/models/Resource.java","src/main/java/client/overload/models/package-info.java","src/main/java/client/overload/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_apiview_properties.json new file mode 100644 index 00000000000..190ae590faf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_apiview_properties.json @@ -0,0 +1,42 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "client.structure.anotherclientoperationgroup.subnamespace.Group5AsyncClient": "Client.Structure.AnotherClientOperationGroup.Group5", + "client.structure.anotherclientoperationgroup.subnamespace.Group5AsyncClient.six": "Client.Structure.AnotherClientOperationGroup.Group5.six", + "client.structure.anotherclientoperationgroup.subnamespace.Group5AsyncClient.sixWithResponse": "Client.Structure.AnotherClientOperationGroup.Group5.six", + "client.structure.anotherclientoperationgroup.subnamespace.Group5Client": "Client.Structure.AnotherClientOperationGroup.Group5", + "client.structure.anotherclientoperationgroup.subnamespace.Group5Client.six": "Client.Structure.AnotherClientOperationGroup.Group5.six", + "client.structure.anotherclientoperationgroup.subnamespace.Group5Client.sixWithResponse": "Client.Structure.AnotherClientOperationGroup.Group5.six", + "client.structure.anotherclientoperationgroup.subnamespace.SecondAsyncClient": "Client.Structure.AnotherClientOperationGroup", + "client.structure.anotherclientoperationgroup.subnamespace.SecondAsyncClient.five": "Client.Structure.AnotherClientOperationGroup.five", + "client.structure.anotherclientoperationgroup.subnamespace.SecondAsyncClient.fiveWithResponse": "Client.Structure.AnotherClientOperationGroup.five", + "client.structure.anotherclientoperationgroup.subnamespace.SecondClient": "Client.Structure.AnotherClientOperationGroup", + "client.structure.anotherclientoperationgroup.subnamespace.SecondClient.five": "Client.Structure.AnotherClientOperationGroup.five", + "client.structure.anotherclientoperationgroup.subnamespace.SecondClient.fiveWithResponse": "Client.Structure.AnotherClientOperationGroup.five", + "client.structure.anotherclientoperationgroup.subnamespace.SecondClientBuilder": "Client.Structure.AnotherClientOperationGroup", + "client.structure.clientoperationgroup.FirstAsyncClient": "Client.Structure.ClientOperationGroup", + "client.structure.clientoperationgroup.FirstAsyncClient.one": "Client.Structure.ClientOperationGroup.one", + "client.structure.clientoperationgroup.FirstAsyncClient.oneWithResponse": "Client.Structure.ClientOperationGroup.one", + "client.structure.clientoperationgroup.FirstClient": "Client.Structure.ClientOperationGroup", + "client.structure.clientoperationgroup.FirstClient.one": "Client.Structure.ClientOperationGroup.one", + "client.structure.clientoperationgroup.FirstClient.oneWithResponse": "Client.Structure.ClientOperationGroup.one", + "client.structure.clientoperationgroup.FirstClientBuilder": "Client.Structure.ClientOperationGroup", + "client.structure.clientoperationgroup.Group3AsyncClient": "Client.Structure.ClientOperationGroup.Group3", + "client.structure.clientoperationgroup.Group3AsyncClient.three": "Client.Structure.ClientOperationGroup.Group3.three", + "client.structure.clientoperationgroup.Group3AsyncClient.threeWithResponse": "Client.Structure.ClientOperationGroup.Group3.three", + "client.structure.clientoperationgroup.Group3AsyncClient.two": "Client.Structure.ClientOperationGroup.Group3.two", + "client.structure.clientoperationgroup.Group3AsyncClient.twoWithResponse": "Client.Structure.ClientOperationGroup.Group3.two", + "client.structure.clientoperationgroup.Group3Client": "Client.Structure.ClientOperationGroup.Group3", + "client.structure.clientoperationgroup.Group3Client.three": "Client.Structure.ClientOperationGroup.Group3.three", + "client.structure.clientoperationgroup.Group3Client.threeWithResponse": "Client.Structure.ClientOperationGroup.Group3.three", + "client.structure.clientoperationgroup.Group3Client.two": "Client.Structure.ClientOperationGroup.Group3.two", + "client.structure.clientoperationgroup.Group3Client.twoWithResponse": "Client.Structure.ClientOperationGroup.Group3.two", + "client.structure.clientoperationgroup.Group4AsyncClient": "Client.Structure.ClientOperationGroup.Group4", + "client.structure.clientoperationgroup.Group4AsyncClient.four": "Client.Structure.ClientOperationGroup.Group4.four", + "client.structure.clientoperationgroup.Group4AsyncClient.fourWithResponse": "Client.Structure.ClientOperationGroup.Group4.four", + "client.structure.clientoperationgroup.Group4Client": "Client.Structure.ClientOperationGroup.Group4", + "client.structure.clientoperationgroup.Group4Client.four": "Client.Structure.ClientOperationGroup.Group4.four", + "client.structure.clientoperationgroup.Group4Client.fourWithResponse": "Client.Structure.ClientOperationGroup.Group4.four", + "client.structure.service.models.ClientType": "Client.Structure.Service.ClientType" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_metadata.json new file mode 100644 index 00000000000..5cdad377d8d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-clientoperationgroup_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"client.structure.anotherclientoperationgroup.subnamespace.Group5AsyncClient":"Client.Structure.AnotherClientOperationGroup.Group5","client.structure.anotherclientoperationgroup.subnamespace.Group5AsyncClient.six":"Client.Structure.AnotherClientOperationGroup.Group5.six","client.structure.anotherclientoperationgroup.subnamespace.Group5AsyncClient.sixWithResponse":"Client.Structure.AnotherClientOperationGroup.Group5.six","client.structure.anotherclientoperationgroup.subnamespace.Group5Client":"Client.Structure.AnotherClientOperationGroup.Group5","client.structure.anotherclientoperationgroup.subnamespace.Group5Client.six":"Client.Structure.AnotherClientOperationGroup.Group5.six","client.structure.anotherclientoperationgroup.subnamespace.Group5Client.sixWithResponse":"Client.Structure.AnotherClientOperationGroup.Group5.six","client.structure.anotherclientoperationgroup.subnamespace.SecondAsyncClient":"Client.Structure.AnotherClientOperationGroup","client.structure.anotherclientoperationgroup.subnamespace.SecondAsyncClient.five":"Client.Structure.AnotherClientOperationGroup.five","client.structure.anotherclientoperationgroup.subnamespace.SecondAsyncClient.fiveWithResponse":"Client.Structure.AnotherClientOperationGroup.five","client.structure.anotherclientoperationgroup.subnamespace.SecondClient":"Client.Structure.AnotherClientOperationGroup","client.structure.anotherclientoperationgroup.subnamespace.SecondClient.five":"Client.Structure.AnotherClientOperationGroup.five","client.structure.anotherclientoperationgroup.subnamespace.SecondClient.fiveWithResponse":"Client.Structure.AnotherClientOperationGroup.five","client.structure.anotherclientoperationgroup.subnamespace.SecondClientBuilder":"Client.Structure.AnotherClientOperationGroup","client.structure.clientoperationgroup.FirstAsyncClient":"Client.Structure.ClientOperationGroup","client.structure.clientoperationgroup.FirstAsyncClient.one":"Client.Structure.ClientOperationGroup.one","client.structure.clientoperationgroup.FirstAsyncClient.oneWithResponse":"Client.Structure.ClientOperationGroup.one","client.structure.clientoperationgroup.FirstClient":"Client.Structure.ClientOperationGroup","client.structure.clientoperationgroup.FirstClient.one":"Client.Structure.ClientOperationGroup.one","client.structure.clientoperationgroup.FirstClient.oneWithResponse":"Client.Structure.ClientOperationGroup.one","client.structure.clientoperationgroup.FirstClientBuilder":"Client.Structure.ClientOperationGroup","client.structure.clientoperationgroup.Group3AsyncClient":"Client.Structure.ClientOperationGroup.Group3","client.structure.clientoperationgroup.Group3AsyncClient.three":"Client.Structure.ClientOperationGroup.Group3.three","client.structure.clientoperationgroup.Group3AsyncClient.threeWithResponse":"Client.Structure.ClientOperationGroup.Group3.three","client.structure.clientoperationgroup.Group3AsyncClient.two":"Client.Structure.ClientOperationGroup.Group3.two","client.structure.clientoperationgroup.Group3AsyncClient.twoWithResponse":"Client.Structure.ClientOperationGroup.Group3.two","client.structure.clientoperationgroup.Group3Client":"Client.Structure.ClientOperationGroup.Group3","client.structure.clientoperationgroup.Group3Client.three":"Client.Structure.ClientOperationGroup.Group3.three","client.structure.clientoperationgroup.Group3Client.threeWithResponse":"Client.Structure.ClientOperationGroup.Group3.three","client.structure.clientoperationgroup.Group3Client.two":"Client.Structure.ClientOperationGroup.Group3.two","client.structure.clientoperationgroup.Group3Client.twoWithResponse":"Client.Structure.ClientOperationGroup.Group3.two","client.structure.clientoperationgroup.Group4AsyncClient":"Client.Structure.ClientOperationGroup.Group4","client.structure.clientoperationgroup.Group4AsyncClient.four":"Client.Structure.ClientOperationGroup.Group4.four","client.structure.clientoperationgroup.Group4AsyncClient.fourWithResponse":"Client.Structure.ClientOperationGroup.Group4.four","client.structure.clientoperationgroup.Group4Client":"Client.Structure.ClientOperationGroup.Group4","client.structure.clientoperationgroup.Group4Client.four":"Client.Structure.ClientOperationGroup.Group4.four","client.structure.clientoperationgroup.Group4Client.fourWithResponse":"Client.Structure.ClientOperationGroup.Group4.four","client.structure.service.models.ClientType":"Client.Structure.Service.ClientType"},"generatedFiles":["src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5AsyncClient.java","src/main/java/client/structure/anotherclientoperationgroup/subnamespace/Group5Client.java","src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondAsyncClient.java","src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClient.java","src/main/java/client/structure/anotherclientoperationgroup/subnamespace/SecondClientBuilder.java","src/main/java/client/structure/anotherclientoperationgroup/subnamespace/package-info.java","src/main/java/client/structure/clientoperationgroup/FirstAsyncClient.java","src/main/java/client/structure/clientoperationgroup/FirstClient.java","src/main/java/client/structure/clientoperationgroup/FirstClientBuilder.java","src/main/java/client/structure/clientoperationgroup/Group3AsyncClient.java","src/main/java/client/structure/clientoperationgroup/Group3Client.java","src/main/java/client/structure/clientoperationgroup/Group4AsyncClient.java","src/main/java/client/structure/clientoperationgroup/Group4Client.java","src/main/java/client/structure/clientoperationgroup/implementation/FirstClientImpl.java","src/main/java/client/structure/clientoperationgroup/implementation/Group3sImpl.java","src/main/java/client/structure/clientoperationgroup/implementation/Group4sImpl.java","src/main/java/client/structure/clientoperationgroup/implementation/Group5sImpl.java","src/main/java/client/structure/clientoperationgroup/implementation/SecondClientImpl.java","src/main/java/client/structure/clientoperationgroup/implementation/package-info.java","src/main/java/client/structure/clientoperationgroup/package-info.java","src/main/java/client/structure/service/models/ClientType.java","src/main/java/client/structure/service/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_apiview_properties.json new file mode 100644 index 00000000000..d75958e00ec --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_apiview_properties.json @@ -0,0 +1,36 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "client.structure.multiclient.ClientAAsyncClient": "Client.Structure.MultiClient.ClientA", + "client.structure.multiclient.ClientAAsyncClient.renamedFive": "Client.Structure.MultiClient.ClientA.renamedFive", + "client.structure.multiclient.ClientAAsyncClient.renamedFiveWithResponse": "Client.Structure.MultiClient.ClientA.renamedFive", + "client.structure.multiclient.ClientAAsyncClient.renamedOne": "Client.Structure.MultiClient.ClientA.renamedOne", + "client.structure.multiclient.ClientAAsyncClient.renamedOneWithResponse": "Client.Structure.MultiClient.ClientA.renamedOne", + "client.structure.multiclient.ClientAAsyncClient.renamedThree": "Client.Structure.MultiClient.ClientA.renamedThree", + "client.structure.multiclient.ClientAAsyncClient.renamedThreeWithResponse": "Client.Structure.MultiClient.ClientA.renamedThree", + "client.structure.multiclient.ClientAClient": "Client.Structure.MultiClient.ClientA", + "client.structure.multiclient.ClientAClient.renamedFive": "Client.Structure.MultiClient.ClientA.renamedFive", + "client.structure.multiclient.ClientAClient.renamedFiveWithResponse": "Client.Structure.MultiClient.ClientA.renamedFive", + "client.structure.multiclient.ClientAClient.renamedOne": "Client.Structure.MultiClient.ClientA.renamedOne", + "client.structure.multiclient.ClientAClient.renamedOneWithResponse": "Client.Structure.MultiClient.ClientA.renamedOne", + "client.structure.multiclient.ClientAClient.renamedThree": "Client.Structure.MultiClient.ClientA.renamedThree", + "client.structure.multiclient.ClientAClient.renamedThreeWithResponse": "Client.Structure.MultiClient.ClientA.renamedThree", + "client.structure.multiclient.ClientAClientBuilder": "Client.Structure.MultiClient.ClientA", + "client.structure.multiclient.ClientBAsyncClient": "Client.Structure.MultiClient.ClientB", + "client.structure.multiclient.ClientBAsyncClient.renamedFour": "Client.Structure.MultiClient.ClientB.renamedFour", + "client.structure.multiclient.ClientBAsyncClient.renamedFourWithResponse": "Client.Structure.MultiClient.ClientB.renamedFour", + "client.structure.multiclient.ClientBAsyncClient.renamedSix": "Client.Structure.MultiClient.ClientB.renamedSix", + "client.structure.multiclient.ClientBAsyncClient.renamedSixWithResponse": "Client.Structure.MultiClient.ClientB.renamedSix", + "client.structure.multiclient.ClientBAsyncClient.renamedTwo": "Client.Structure.MultiClient.ClientB.renamedTwo", + "client.structure.multiclient.ClientBAsyncClient.renamedTwoWithResponse": "Client.Structure.MultiClient.ClientB.renamedTwo", + "client.structure.multiclient.ClientBClient": "Client.Structure.MultiClient.ClientB", + "client.structure.multiclient.ClientBClient.renamedFour": "Client.Structure.MultiClient.ClientB.renamedFour", + "client.structure.multiclient.ClientBClient.renamedFourWithResponse": "Client.Structure.MultiClient.ClientB.renamedFour", + "client.structure.multiclient.ClientBClient.renamedSix": "Client.Structure.MultiClient.ClientB.renamedSix", + "client.structure.multiclient.ClientBClient.renamedSixWithResponse": "Client.Structure.MultiClient.ClientB.renamedSix", + "client.structure.multiclient.ClientBClient.renamedTwo": "Client.Structure.MultiClient.ClientB.renamedTwo", + "client.structure.multiclient.ClientBClient.renamedTwoWithResponse": "Client.Structure.MultiClient.ClientB.renamedTwo", + "client.structure.multiclient.ClientBClientBuilder": "Client.Structure.MultiClient.ClientB", + "client.structure.service.models.ClientType": "Client.Structure.Service.ClientType" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_metadata.json new file mode 100644 index 00000000000..3405ed1cf36 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-multiclient_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"client.structure.multiclient.ClientAAsyncClient":"Client.Structure.MultiClient.ClientA","client.structure.multiclient.ClientAAsyncClient.renamedFive":"Client.Structure.MultiClient.ClientA.renamedFive","client.structure.multiclient.ClientAAsyncClient.renamedFiveWithResponse":"Client.Structure.MultiClient.ClientA.renamedFive","client.structure.multiclient.ClientAAsyncClient.renamedOne":"Client.Structure.MultiClient.ClientA.renamedOne","client.structure.multiclient.ClientAAsyncClient.renamedOneWithResponse":"Client.Structure.MultiClient.ClientA.renamedOne","client.structure.multiclient.ClientAAsyncClient.renamedThree":"Client.Structure.MultiClient.ClientA.renamedThree","client.structure.multiclient.ClientAAsyncClient.renamedThreeWithResponse":"Client.Structure.MultiClient.ClientA.renamedThree","client.structure.multiclient.ClientAClient":"Client.Structure.MultiClient.ClientA","client.structure.multiclient.ClientAClient.renamedFive":"Client.Structure.MultiClient.ClientA.renamedFive","client.structure.multiclient.ClientAClient.renamedFiveWithResponse":"Client.Structure.MultiClient.ClientA.renamedFive","client.structure.multiclient.ClientAClient.renamedOne":"Client.Structure.MultiClient.ClientA.renamedOne","client.structure.multiclient.ClientAClient.renamedOneWithResponse":"Client.Structure.MultiClient.ClientA.renamedOne","client.structure.multiclient.ClientAClient.renamedThree":"Client.Structure.MultiClient.ClientA.renamedThree","client.structure.multiclient.ClientAClient.renamedThreeWithResponse":"Client.Structure.MultiClient.ClientA.renamedThree","client.structure.multiclient.ClientAClientBuilder":"Client.Structure.MultiClient.ClientA","client.structure.multiclient.ClientBAsyncClient":"Client.Structure.MultiClient.ClientB","client.structure.multiclient.ClientBAsyncClient.renamedFour":"Client.Structure.MultiClient.ClientB.renamedFour","client.structure.multiclient.ClientBAsyncClient.renamedFourWithResponse":"Client.Structure.MultiClient.ClientB.renamedFour","client.structure.multiclient.ClientBAsyncClient.renamedSix":"Client.Structure.MultiClient.ClientB.renamedSix","client.structure.multiclient.ClientBAsyncClient.renamedSixWithResponse":"Client.Structure.MultiClient.ClientB.renamedSix","client.structure.multiclient.ClientBAsyncClient.renamedTwo":"Client.Structure.MultiClient.ClientB.renamedTwo","client.structure.multiclient.ClientBAsyncClient.renamedTwoWithResponse":"Client.Structure.MultiClient.ClientB.renamedTwo","client.structure.multiclient.ClientBClient":"Client.Structure.MultiClient.ClientB","client.structure.multiclient.ClientBClient.renamedFour":"Client.Structure.MultiClient.ClientB.renamedFour","client.structure.multiclient.ClientBClient.renamedFourWithResponse":"Client.Structure.MultiClient.ClientB.renamedFour","client.structure.multiclient.ClientBClient.renamedSix":"Client.Structure.MultiClient.ClientB.renamedSix","client.structure.multiclient.ClientBClient.renamedSixWithResponse":"Client.Structure.MultiClient.ClientB.renamedSix","client.structure.multiclient.ClientBClient.renamedTwo":"Client.Structure.MultiClient.ClientB.renamedTwo","client.structure.multiclient.ClientBClient.renamedTwoWithResponse":"Client.Structure.MultiClient.ClientB.renamedTwo","client.structure.multiclient.ClientBClientBuilder":"Client.Structure.MultiClient.ClientB","client.structure.service.models.ClientType":"Client.Structure.Service.ClientType"},"generatedFiles":["src/main/java/client/structure/multiclient/ClientAAsyncClient.java","src/main/java/client/structure/multiclient/ClientAClient.java","src/main/java/client/structure/multiclient/ClientAClientBuilder.java","src/main/java/client/structure/multiclient/ClientBAsyncClient.java","src/main/java/client/structure/multiclient/ClientBClient.java","src/main/java/client/structure/multiclient/ClientBClientBuilder.java","src/main/java/client/structure/multiclient/implementation/ClientAClientImpl.java","src/main/java/client/structure/multiclient/implementation/ClientBClientImpl.java","src/main/java/client/structure/multiclient/implementation/package-info.java","src/main/java/client/structure/multiclient/package-info.java","src/main/java/client/structure/service/models/ClientType.java","src/main/java/client/structure/service/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_apiview_properties.json new file mode 100644 index 00000000000..c3b92699425 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_apiview_properties.json @@ -0,0 +1,35 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "client.structure.renamedoperation.GroupAsyncClient": "Client.Structure.RenamedOperation.Group", + "client.structure.renamedoperation.GroupAsyncClient.renamedFour": "Client.Structure.RenamedOperation.Group.renamedFour", + "client.structure.renamedoperation.GroupAsyncClient.renamedFourWithResponse": "Client.Structure.RenamedOperation.Group.renamedFour", + "client.structure.renamedoperation.GroupAsyncClient.renamedSix": "Client.Structure.RenamedOperation.Group.renamedSix", + "client.structure.renamedoperation.GroupAsyncClient.renamedSixWithResponse": "Client.Structure.RenamedOperation.Group.renamedSix", + "client.structure.renamedoperation.GroupAsyncClient.renamedTwo": "Client.Structure.RenamedOperation.Group.renamedTwo", + "client.structure.renamedoperation.GroupAsyncClient.renamedTwoWithResponse": "Client.Structure.RenamedOperation.Group.renamedTwo", + "client.structure.renamedoperation.GroupClient": "Client.Structure.RenamedOperation.Group", + "client.structure.renamedoperation.GroupClient.renamedFour": "Client.Structure.RenamedOperation.Group.renamedFour", + "client.structure.renamedoperation.GroupClient.renamedFourWithResponse": "Client.Structure.RenamedOperation.Group.renamedFour", + "client.structure.renamedoperation.GroupClient.renamedSix": "Client.Structure.RenamedOperation.Group.renamedSix", + "client.structure.renamedoperation.GroupClient.renamedSixWithResponse": "Client.Structure.RenamedOperation.Group.renamedSix", + "client.structure.renamedoperation.GroupClient.renamedTwo": "Client.Structure.RenamedOperation.Group.renamedTwo", + "client.structure.renamedoperation.GroupClient.renamedTwoWithResponse": "Client.Structure.RenamedOperation.Group.renamedTwo", + "client.structure.renamedoperation.RenamedOperationAsyncClient": "Client.Structure.RenamedOperation", + "client.structure.renamedoperation.RenamedOperationAsyncClient.renamedFive": "Client.Structure.RenamedOperation.renamedFive", + "client.structure.renamedoperation.RenamedOperationAsyncClient.renamedFiveWithResponse": "Client.Structure.RenamedOperation.renamedFive", + "client.structure.renamedoperation.RenamedOperationAsyncClient.renamedOne": "Client.Structure.RenamedOperation.renamedOne", + "client.structure.renamedoperation.RenamedOperationAsyncClient.renamedOneWithResponse": "Client.Structure.RenamedOperation.renamedOne", + "client.structure.renamedoperation.RenamedOperationAsyncClient.renamedThree": "Client.Structure.RenamedOperation.renamedThree", + "client.structure.renamedoperation.RenamedOperationAsyncClient.renamedThreeWithResponse": "Client.Structure.RenamedOperation.renamedThree", + "client.structure.renamedoperation.RenamedOperationClient": "Client.Structure.RenamedOperation", + "client.structure.renamedoperation.RenamedOperationClient.renamedFive": "Client.Structure.RenamedOperation.renamedFive", + "client.structure.renamedoperation.RenamedOperationClient.renamedFiveWithResponse": "Client.Structure.RenamedOperation.renamedFive", + "client.structure.renamedoperation.RenamedOperationClient.renamedOne": "Client.Structure.RenamedOperation.renamedOne", + "client.structure.renamedoperation.RenamedOperationClient.renamedOneWithResponse": "Client.Structure.RenamedOperation.renamedOne", + "client.structure.renamedoperation.RenamedOperationClient.renamedThree": "Client.Structure.RenamedOperation.renamedThree", + "client.structure.renamedoperation.RenamedOperationClient.renamedThreeWithResponse": "Client.Structure.RenamedOperation.renamedThree", + "client.structure.renamedoperation.RenamedOperationClientBuilder": "Client.Structure.RenamedOperation", + "client.structure.service.models.ClientType": "Client.Structure.Service.ClientType" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_metadata.json new file mode 100644 index 00000000000..ac8f98b7c9a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-renamedoperation_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"client.structure.renamedoperation.GroupAsyncClient":"Client.Structure.RenamedOperation.Group","client.structure.renamedoperation.GroupAsyncClient.renamedFour":"Client.Structure.RenamedOperation.Group.renamedFour","client.structure.renamedoperation.GroupAsyncClient.renamedFourWithResponse":"Client.Structure.RenamedOperation.Group.renamedFour","client.structure.renamedoperation.GroupAsyncClient.renamedSix":"Client.Structure.RenamedOperation.Group.renamedSix","client.structure.renamedoperation.GroupAsyncClient.renamedSixWithResponse":"Client.Structure.RenamedOperation.Group.renamedSix","client.structure.renamedoperation.GroupAsyncClient.renamedTwo":"Client.Structure.RenamedOperation.Group.renamedTwo","client.structure.renamedoperation.GroupAsyncClient.renamedTwoWithResponse":"Client.Structure.RenamedOperation.Group.renamedTwo","client.structure.renamedoperation.GroupClient":"Client.Structure.RenamedOperation.Group","client.structure.renamedoperation.GroupClient.renamedFour":"Client.Structure.RenamedOperation.Group.renamedFour","client.structure.renamedoperation.GroupClient.renamedFourWithResponse":"Client.Structure.RenamedOperation.Group.renamedFour","client.structure.renamedoperation.GroupClient.renamedSix":"Client.Structure.RenamedOperation.Group.renamedSix","client.structure.renamedoperation.GroupClient.renamedSixWithResponse":"Client.Structure.RenamedOperation.Group.renamedSix","client.structure.renamedoperation.GroupClient.renamedTwo":"Client.Structure.RenamedOperation.Group.renamedTwo","client.structure.renamedoperation.GroupClient.renamedTwoWithResponse":"Client.Structure.RenamedOperation.Group.renamedTwo","client.structure.renamedoperation.RenamedOperationAsyncClient":"Client.Structure.RenamedOperation","client.structure.renamedoperation.RenamedOperationAsyncClient.renamedFive":"Client.Structure.RenamedOperation.renamedFive","client.structure.renamedoperation.RenamedOperationAsyncClient.renamedFiveWithResponse":"Client.Structure.RenamedOperation.renamedFive","client.structure.renamedoperation.RenamedOperationAsyncClient.renamedOne":"Client.Structure.RenamedOperation.renamedOne","client.structure.renamedoperation.RenamedOperationAsyncClient.renamedOneWithResponse":"Client.Structure.RenamedOperation.renamedOne","client.structure.renamedoperation.RenamedOperationAsyncClient.renamedThree":"Client.Structure.RenamedOperation.renamedThree","client.structure.renamedoperation.RenamedOperationAsyncClient.renamedThreeWithResponse":"Client.Structure.RenamedOperation.renamedThree","client.structure.renamedoperation.RenamedOperationClient":"Client.Structure.RenamedOperation","client.structure.renamedoperation.RenamedOperationClient.renamedFive":"Client.Structure.RenamedOperation.renamedFive","client.structure.renamedoperation.RenamedOperationClient.renamedFiveWithResponse":"Client.Structure.RenamedOperation.renamedFive","client.structure.renamedoperation.RenamedOperationClient.renamedOne":"Client.Structure.RenamedOperation.renamedOne","client.structure.renamedoperation.RenamedOperationClient.renamedOneWithResponse":"Client.Structure.RenamedOperation.renamedOne","client.structure.renamedoperation.RenamedOperationClient.renamedThree":"Client.Structure.RenamedOperation.renamedThree","client.structure.renamedoperation.RenamedOperationClient.renamedThreeWithResponse":"Client.Structure.RenamedOperation.renamedThree","client.structure.renamedoperation.RenamedOperationClientBuilder":"Client.Structure.RenamedOperation","client.structure.service.models.ClientType":"Client.Structure.Service.ClientType"},"generatedFiles":["src/main/java/client/structure/renamedoperation/GroupAsyncClient.java","src/main/java/client/structure/renamedoperation/GroupClient.java","src/main/java/client/structure/renamedoperation/RenamedOperationAsyncClient.java","src/main/java/client/structure/renamedoperation/RenamedOperationClient.java","src/main/java/client/structure/renamedoperation/RenamedOperationClientBuilder.java","src/main/java/client/structure/renamedoperation/implementation/GroupsImpl.java","src/main/java/client/structure/renamedoperation/implementation/RenamedOperationClientImpl.java","src/main/java/client/structure/renamedoperation/implementation/package-info.java","src/main/java/client/structure/renamedoperation/package-info.java","src/main/java/client/structure/service/models/ClientType.java","src/main/java/client/structure/service/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-service_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-service_apiview_properties.json new file mode 100644 index 00000000000..c57c264820f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-service_apiview_properties.json @@ -0,0 +1,55 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "client.structure.service.BarAsyncClient": "Client.Structure.Service.Bar", + "client.structure.service.BarAsyncClient.five": "Client.Structure.Service.Bar.five", + "client.structure.service.BarAsyncClient.fiveWithResponse": "Client.Structure.Service.Bar.five", + "client.structure.service.BarAsyncClient.six": "Client.Structure.Service.Bar.six", + "client.structure.service.BarAsyncClient.sixWithResponse": "Client.Structure.Service.Bar.six", + "client.structure.service.BarClient": "Client.Structure.Service.Bar", + "client.structure.service.BarClient.five": "Client.Structure.Service.Bar.five", + "client.structure.service.BarClient.fiveWithResponse": "Client.Structure.Service.Bar.five", + "client.structure.service.BarClient.six": "Client.Structure.Service.Bar.six", + "client.structure.service.BarClient.sixWithResponse": "Client.Structure.Service.Bar.six", + "client.structure.service.BazFooAsyncClient": "Client.Structure.Service.Baz.Foo", + "client.structure.service.BazFooAsyncClient.seven": "Client.Structure.Service.Baz.Foo.seven", + "client.structure.service.BazFooAsyncClient.sevenWithResponse": "Client.Structure.Service.Baz.Foo.seven", + "client.structure.service.BazFooClient": "Client.Structure.Service.Baz.Foo", + "client.structure.service.BazFooClient.seven": "Client.Structure.Service.Baz.Foo.seven", + "client.structure.service.BazFooClient.sevenWithResponse": "Client.Structure.Service.Baz.Foo.seven", + "client.structure.service.FooAsyncClient": "Client.Structure.Service.Foo", + "client.structure.service.FooAsyncClient.four": "Client.Structure.Service.Foo.four", + "client.structure.service.FooAsyncClient.fourWithResponse": "Client.Structure.Service.Foo.four", + "client.structure.service.FooAsyncClient.three": "Client.Structure.Service.Foo.three", + "client.structure.service.FooAsyncClient.threeWithResponse": "Client.Structure.Service.Foo.three", + "client.structure.service.FooClient": "Client.Structure.Service.Foo", + "client.structure.service.FooClient.four": "Client.Structure.Service.Foo.four", + "client.structure.service.FooClient.fourWithResponse": "Client.Structure.Service.Foo.four", + "client.structure.service.FooClient.three": "Client.Structure.Service.Foo.three", + "client.structure.service.FooClient.threeWithResponse": "Client.Structure.Service.Foo.three", + "client.structure.service.QuxAsyncClient": "Client.Structure.Service.Qux", + "client.structure.service.QuxAsyncClient.eight": "Client.Structure.Service.Qux.eight", + "client.structure.service.QuxAsyncClient.eightWithResponse": "Client.Structure.Service.Qux.eight", + "client.structure.service.QuxBarAsyncClient": "Client.Structure.Service.Qux.Bar", + "client.structure.service.QuxBarAsyncClient.nine": "Client.Structure.Service.Qux.Bar.nine", + "client.structure.service.QuxBarAsyncClient.nineWithResponse": "Client.Structure.Service.Qux.Bar.nine", + "client.structure.service.QuxBarClient": "Client.Structure.Service.Qux.Bar", + "client.structure.service.QuxBarClient.nine": "Client.Structure.Service.Qux.Bar.nine", + "client.structure.service.QuxBarClient.nineWithResponse": "Client.Structure.Service.Qux.Bar.nine", + "client.structure.service.QuxClient": "Client.Structure.Service.Qux", + "client.structure.service.QuxClient.eight": "Client.Structure.Service.Qux.eight", + "client.structure.service.QuxClient.eightWithResponse": "Client.Structure.Service.Qux.eight", + "client.structure.service.ServiceClientAsyncClient": "Client.Structure.Service", + "client.structure.service.ServiceClientAsyncClient.one": "Client.Structure.Service.one", + "client.structure.service.ServiceClientAsyncClient.oneWithResponse": "Client.Structure.Service.one", + "client.structure.service.ServiceClientAsyncClient.two": "Client.Structure.Service.two", + "client.structure.service.ServiceClientAsyncClient.twoWithResponse": "Client.Structure.Service.two", + "client.structure.service.ServiceClientClient": "Client.Structure.Service", + "client.structure.service.ServiceClientClient.one": "Client.Structure.Service.one", + "client.structure.service.ServiceClientClient.oneWithResponse": "Client.Structure.Service.one", + "client.structure.service.ServiceClientClient.two": "Client.Structure.Service.two", + "client.structure.service.ServiceClientClient.twoWithResponse": "Client.Structure.Service.two", + "client.structure.service.ServiceClientClientBuilder": "Client.Structure.Service", + "client.structure.service.models.ClientType": "Client.Structure.Service.ClientType" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_apiview_properties.json new file mode 100644 index 00000000000..4e8b278c515 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_apiview_properties.json @@ -0,0 +1,35 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "client.structure.service.models.ClientType": "Client.Structure.Service.ClientType", + "client.structure.twooperationgroup.Group1AsyncClient": "Client.Structure.TwoOperationGroup.Group1", + "client.structure.twooperationgroup.Group1AsyncClient.four": "Client.Structure.TwoOperationGroup.Group1.four", + "client.structure.twooperationgroup.Group1AsyncClient.fourWithResponse": "Client.Structure.TwoOperationGroup.Group1.four", + "client.structure.twooperationgroup.Group1AsyncClient.one": "Client.Structure.TwoOperationGroup.Group1.one", + "client.structure.twooperationgroup.Group1AsyncClient.oneWithResponse": "Client.Structure.TwoOperationGroup.Group1.one", + "client.structure.twooperationgroup.Group1AsyncClient.three": "Client.Structure.TwoOperationGroup.Group1.three", + "client.structure.twooperationgroup.Group1AsyncClient.threeWithResponse": "Client.Structure.TwoOperationGroup.Group1.three", + "client.structure.twooperationgroup.Group1Client": "Client.Structure.TwoOperationGroup.Group1", + "client.structure.twooperationgroup.Group1Client.four": "Client.Structure.TwoOperationGroup.Group1.four", + "client.structure.twooperationgroup.Group1Client.fourWithResponse": "Client.Structure.TwoOperationGroup.Group1.four", + "client.structure.twooperationgroup.Group1Client.one": "Client.Structure.TwoOperationGroup.Group1.one", + "client.structure.twooperationgroup.Group1Client.oneWithResponse": "Client.Structure.TwoOperationGroup.Group1.one", + "client.structure.twooperationgroup.Group1Client.three": "Client.Structure.TwoOperationGroup.Group1.three", + "client.structure.twooperationgroup.Group1Client.threeWithResponse": "Client.Structure.TwoOperationGroup.Group1.three", + "client.structure.twooperationgroup.Group2AsyncClient": "Client.Structure.TwoOperationGroup.Group2", + "client.structure.twooperationgroup.Group2AsyncClient.five": "Client.Structure.TwoOperationGroup.Group2.five", + "client.structure.twooperationgroup.Group2AsyncClient.fiveWithResponse": "Client.Structure.TwoOperationGroup.Group2.five", + "client.structure.twooperationgroup.Group2AsyncClient.six": "Client.Structure.TwoOperationGroup.Group2.six", + "client.structure.twooperationgroup.Group2AsyncClient.sixWithResponse": "Client.Structure.TwoOperationGroup.Group2.six", + "client.structure.twooperationgroup.Group2AsyncClient.two": "Client.Structure.TwoOperationGroup.Group2.two", + "client.structure.twooperationgroup.Group2AsyncClient.twoWithResponse": "Client.Structure.TwoOperationGroup.Group2.two", + "client.structure.twooperationgroup.Group2Client": "Client.Structure.TwoOperationGroup.Group2", + "client.structure.twooperationgroup.Group2Client.five": "Client.Structure.TwoOperationGroup.Group2.five", + "client.structure.twooperationgroup.Group2Client.fiveWithResponse": "Client.Structure.TwoOperationGroup.Group2.five", + "client.structure.twooperationgroup.Group2Client.six": "Client.Structure.TwoOperationGroup.Group2.six", + "client.structure.twooperationgroup.Group2Client.sixWithResponse": "Client.Structure.TwoOperationGroup.Group2.six", + "client.structure.twooperationgroup.Group2Client.two": "Client.Structure.TwoOperationGroup.Group2.two", + "client.structure.twooperationgroup.Group2Client.twoWithResponse": "Client.Structure.TwoOperationGroup.Group2.two", + "client.structure.twooperationgroup.TwoOperationGroupClientBuilder": "Client.Structure.TwoOperationGroup" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_metadata.json new file mode 100644 index 00000000000..a3c5969f803 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/client-structure-twooperationgroup_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"client.structure.service.models.ClientType":"Client.Structure.Service.ClientType","client.structure.twooperationgroup.Group1AsyncClient":"Client.Structure.TwoOperationGroup.Group1","client.structure.twooperationgroup.Group1AsyncClient.four":"Client.Structure.TwoOperationGroup.Group1.four","client.structure.twooperationgroup.Group1AsyncClient.fourWithResponse":"Client.Structure.TwoOperationGroup.Group1.four","client.structure.twooperationgroup.Group1AsyncClient.one":"Client.Structure.TwoOperationGroup.Group1.one","client.structure.twooperationgroup.Group1AsyncClient.oneWithResponse":"Client.Structure.TwoOperationGroup.Group1.one","client.structure.twooperationgroup.Group1AsyncClient.three":"Client.Structure.TwoOperationGroup.Group1.three","client.structure.twooperationgroup.Group1AsyncClient.threeWithResponse":"Client.Structure.TwoOperationGroup.Group1.three","client.structure.twooperationgroup.Group1Client":"Client.Structure.TwoOperationGroup.Group1","client.structure.twooperationgroup.Group1Client.four":"Client.Structure.TwoOperationGroup.Group1.four","client.structure.twooperationgroup.Group1Client.fourWithResponse":"Client.Structure.TwoOperationGroup.Group1.four","client.structure.twooperationgroup.Group1Client.one":"Client.Structure.TwoOperationGroup.Group1.one","client.structure.twooperationgroup.Group1Client.oneWithResponse":"Client.Structure.TwoOperationGroup.Group1.one","client.structure.twooperationgroup.Group1Client.three":"Client.Structure.TwoOperationGroup.Group1.three","client.structure.twooperationgroup.Group1Client.threeWithResponse":"Client.Structure.TwoOperationGroup.Group1.three","client.structure.twooperationgroup.Group2AsyncClient":"Client.Structure.TwoOperationGroup.Group2","client.structure.twooperationgroup.Group2AsyncClient.five":"Client.Structure.TwoOperationGroup.Group2.five","client.structure.twooperationgroup.Group2AsyncClient.fiveWithResponse":"Client.Structure.TwoOperationGroup.Group2.five","client.structure.twooperationgroup.Group2AsyncClient.six":"Client.Structure.TwoOperationGroup.Group2.six","client.structure.twooperationgroup.Group2AsyncClient.sixWithResponse":"Client.Structure.TwoOperationGroup.Group2.six","client.structure.twooperationgroup.Group2AsyncClient.two":"Client.Structure.TwoOperationGroup.Group2.two","client.structure.twooperationgroup.Group2AsyncClient.twoWithResponse":"Client.Structure.TwoOperationGroup.Group2.two","client.structure.twooperationgroup.Group2Client":"Client.Structure.TwoOperationGroup.Group2","client.structure.twooperationgroup.Group2Client.five":"Client.Structure.TwoOperationGroup.Group2.five","client.structure.twooperationgroup.Group2Client.fiveWithResponse":"Client.Structure.TwoOperationGroup.Group2.five","client.structure.twooperationgroup.Group2Client.six":"Client.Structure.TwoOperationGroup.Group2.six","client.structure.twooperationgroup.Group2Client.sixWithResponse":"Client.Structure.TwoOperationGroup.Group2.six","client.structure.twooperationgroup.Group2Client.two":"Client.Structure.TwoOperationGroup.Group2.two","client.structure.twooperationgroup.Group2Client.twoWithResponse":"Client.Structure.TwoOperationGroup.Group2.two","client.structure.twooperationgroup.TwoOperationGroupClientBuilder":"Client.Structure.TwoOperationGroup"},"generatedFiles":["src/main/java/client/structure/service/models/ClientType.java","src/main/java/client/structure/service/models/package-info.java","src/main/java/client/structure/twooperationgroup/Group1AsyncClient.java","src/main/java/client/structure/twooperationgroup/Group1Client.java","src/main/java/client/structure/twooperationgroup/Group2AsyncClient.java","src/main/java/client/structure/twooperationgroup/Group2Client.java","src/main/java/client/structure/twooperationgroup/TwoOperationGroupClientBuilder.java","src/main/java/client/structure/twooperationgroup/implementation/Group1sImpl.java","src/main/java/client/structure/twooperationgroup/implementation/Group2sImpl.java","src/main/java/client/structure/twooperationgroup/implementation/TwoOperationGroupClientImpl.java","src/main/java/client/structure/twooperationgroup/implementation/package-info.java","src/main/java/client/structure/twooperationgroup/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_apiview_properties.json new file mode 100644 index 00000000000..d2aa92134d7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_apiview_properties.json @@ -0,0 +1,37 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "documentation.DocumentationClientBuilder": "Documentation", + "documentation.ListsAsyncClient": "Documentation.Lists", + "documentation.ListsAsyncClient.bulletPointsModel": "Documentation.Lists.bulletPointsModel", + "documentation.ListsAsyncClient.bulletPointsModelWithResponse": "Documentation.Lists.bulletPointsModel", + "documentation.ListsAsyncClient.bulletPointsOp": "Documentation.Lists.bulletPointsOp", + "documentation.ListsAsyncClient.bulletPointsOpWithResponse": "Documentation.Lists.bulletPointsOp", + "documentation.ListsAsyncClient.numbered": "Documentation.Lists.numbered", + "documentation.ListsAsyncClient.numberedWithResponse": "Documentation.Lists.numbered", + "documentation.ListsClient": "Documentation.Lists", + "documentation.ListsClient.bulletPointsModel": "Documentation.Lists.bulletPointsModel", + "documentation.ListsClient.bulletPointsModelWithResponse": "Documentation.Lists.bulletPointsModel", + "documentation.ListsClient.bulletPointsOp": "Documentation.Lists.bulletPointsOp", + "documentation.ListsClient.bulletPointsOpWithResponse": "Documentation.Lists.bulletPointsOp", + "documentation.ListsClient.numbered": "Documentation.Lists.numbered", + "documentation.ListsClient.numberedWithResponse": "Documentation.Lists.numbered", + "documentation.TextFormattingAsyncClient": "Documentation.TextFormatting", + "documentation.TextFormattingAsyncClient.boldText": "Documentation.TextFormatting.boldText", + "documentation.TextFormattingAsyncClient.boldTextWithResponse": "Documentation.TextFormatting.boldText", + "documentation.TextFormattingAsyncClient.combinedFormatting": "Documentation.TextFormatting.combinedFormatting", + "documentation.TextFormattingAsyncClient.combinedFormattingWithResponse": "Documentation.TextFormatting.combinedFormatting", + "documentation.TextFormattingAsyncClient.italicText": "Documentation.TextFormatting.italicText", + "documentation.TextFormattingAsyncClient.italicTextWithResponse": "Documentation.TextFormatting.italicText", + "documentation.TextFormattingClient": "Documentation.TextFormatting", + "documentation.TextFormattingClient.boldText": "Documentation.TextFormatting.boldText", + "documentation.TextFormattingClient.boldTextWithResponse": "Documentation.TextFormatting.boldText", + "documentation.TextFormattingClient.combinedFormatting": "Documentation.TextFormatting.combinedFormatting", + "documentation.TextFormattingClient.combinedFormattingWithResponse": "Documentation.TextFormatting.combinedFormatting", + "documentation.TextFormattingClient.italicText": "Documentation.TextFormatting.italicText", + "documentation.TextFormattingClient.italicTextWithResponse": "Documentation.TextFormatting.italicText", + "documentation.lists.implementation.models.BulletPointsModelRequest": "Documentation.Lists.bulletPointsModel.Request.anonymous", + "documentation.lists.models.BulletPointsEnum": "Documentation.Lists.BulletPointsEnum", + "documentation.lists.models.BulletPointsModel": "Documentation.Lists.BulletPointsModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_metadata.json new file mode 100644 index 00000000000..8e1a954c7f1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/documentation_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"documentation.DocumentationClientBuilder":"Documentation","documentation.ListsAsyncClient":"Documentation.Lists","documentation.ListsAsyncClient.bulletPointsModel":"Documentation.Lists.bulletPointsModel","documentation.ListsAsyncClient.bulletPointsModelWithResponse":"Documentation.Lists.bulletPointsModel","documentation.ListsAsyncClient.bulletPointsOp":"Documentation.Lists.bulletPointsOp","documentation.ListsAsyncClient.bulletPointsOpWithResponse":"Documentation.Lists.bulletPointsOp","documentation.ListsAsyncClient.numbered":"Documentation.Lists.numbered","documentation.ListsAsyncClient.numberedWithResponse":"Documentation.Lists.numbered","documentation.ListsClient":"Documentation.Lists","documentation.ListsClient.bulletPointsModel":"Documentation.Lists.bulletPointsModel","documentation.ListsClient.bulletPointsModelWithResponse":"Documentation.Lists.bulletPointsModel","documentation.ListsClient.bulletPointsOp":"Documentation.Lists.bulletPointsOp","documentation.ListsClient.bulletPointsOpWithResponse":"Documentation.Lists.bulletPointsOp","documentation.ListsClient.numbered":"Documentation.Lists.numbered","documentation.ListsClient.numberedWithResponse":"Documentation.Lists.numbered","documentation.TextFormattingAsyncClient":"Documentation.TextFormatting","documentation.TextFormattingAsyncClient.boldText":"Documentation.TextFormatting.boldText","documentation.TextFormattingAsyncClient.boldTextWithResponse":"Documentation.TextFormatting.boldText","documentation.TextFormattingAsyncClient.combinedFormatting":"Documentation.TextFormatting.combinedFormatting","documentation.TextFormattingAsyncClient.combinedFormattingWithResponse":"Documentation.TextFormatting.combinedFormatting","documentation.TextFormattingAsyncClient.italicText":"Documentation.TextFormatting.italicText","documentation.TextFormattingAsyncClient.italicTextWithResponse":"Documentation.TextFormatting.italicText","documentation.TextFormattingClient":"Documentation.TextFormatting","documentation.TextFormattingClient.boldText":"Documentation.TextFormatting.boldText","documentation.TextFormattingClient.boldTextWithResponse":"Documentation.TextFormatting.boldText","documentation.TextFormattingClient.combinedFormatting":"Documentation.TextFormatting.combinedFormatting","documentation.TextFormattingClient.combinedFormattingWithResponse":"Documentation.TextFormatting.combinedFormatting","documentation.TextFormattingClient.italicText":"Documentation.TextFormatting.italicText","documentation.TextFormattingClient.italicTextWithResponse":"Documentation.TextFormatting.italicText","documentation.lists.implementation.models.BulletPointsModelRequest":"Documentation.Lists.bulletPointsModel.Request.anonymous","documentation.lists.models.BulletPointsEnum":"Documentation.Lists.BulletPointsEnum","documentation.lists.models.BulletPointsModel":"Documentation.Lists.BulletPointsModel"},"generatedFiles":["src/main/java/documentation/DocumentationClientBuilder.java","src/main/java/documentation/ListsAsyncClient.java","src/main/java/documentation/ListsClient.java","src/main/java/documentation/TextFormattingAsyncClient.java","src/main/java/documentation/TextFormattingClient.java","src/main/java/documentation/implementation/DocumentationClientImpl.java","src/main/java/documentation/implementation/ListsImpl.java","src/main/java/documentation/implementation/TextFormattingsImpl.java","src/main/java/documentation/implementation/package-info.java","src/main/java/documentation/lists/implementation/models/BulletPointsModelRequest.java","src/main/java/documentation/lists/implementation/models/package-info.java","src/main/java/documentation/lists/models/BulletPointsEnum.java","src/main/java/documentation/lists/models/BulletPointsModel.java","src/main/java/documentation/lists/models/package-info.java","src/main/java/documentation/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_apiview_properties.json new file mode 100644 index 00000000000..47a20deb2f2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_apiview_properties.json @@ -0,0 +1,28 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "encode.array.ArrayAsyncClient": "Encode.Array.Property", + "encode.array.ArrayAsyncClient.commaDelimited": "Encode.Array.Property.commaDelimited", + "encode.array.ArrayAsyncClient.commaDelimitedWithResponse": "Encode.Array.Property.commaDelimited", + "encode.array.ArrayAsyncClient.newlineDelimited": "Encode.Array.Property.newlineDelimited", + "encode.array.ArrayAsyncClient.newlineDelimitedWithResponse": "Encode.Array.Property.newlineDelimited", + "encode.array.ArrayAsyncClient.pipeDelimited": "Encode.Array.Property.pipeDelimited", + "encode.array.ArrayAsyncClient.pipeDelimitedWithResponse": "Encode.Array.Property.pipeDelimited", + "encode.array.ArrayAsyncClient.spaceDelimited": "Encode.Array.Property.spaceDelimited", + "encode.array.ArrayAsyncClient.spaceDelimitedWithResponse": "Encode.Array.Property.spaceDelimited", + "encode.array.ArrayClient": "Encode.Array.Property", + "encode.array.ArrayClient.commaDelimited": "Encode.Array.Property.commaDelimited", + "encode.array.ArrayClient.commaDelimitedWithResponse": "Encode.Array.Property.commaDelimited", + "encode.array.ArrayClient.newlineDelimited": "Encode.Array.Property.newlineDelimited", + "encode.array.ArrayClient.newlineDelimitedWithResponse": "Encode.Array.Property.newlineDelimited", + "encode.array.ArrayClient.pipeDelimited": "Encode.Array.Property.pipeDelimited", + "encode.array.ArrayClient.pipeDelimitedWithResponse": "Encode.Array.Property.pipeDelimited", + "encode.array.ArrayClient.spaceDelimited": "Encode.Array.Property.spaceDelimited", + "encode.array.ArrayClient.spaceDelimitedWithResponse": "Encode.Array.Property.spaceDelimited", + "encode.array.ArrayClientBuilder": "Encode.Array", + "encode.array.models.CommaDelimitedArrayProperty": "Encode.Array.CommaDelimitedArrayProperty", + "encode.array.models.NewlineDelimitedArrayProperty": "Encode.Array.NewlineDelimitedArrayProperty", + "encode.array.models.PipeDelimitedArrayProperty": "Encode.Array.PipeDelimitedArrayProperty", + "encode.array.models.SpaceDelimitedArrayProperty": "Encode.Array.SpaceDelimitedArrayProperty" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_metadata.json new file mode 100644 index 00000000000..a094a17ad8f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-array_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"encode.array.ArrayAsyncClient":"Encode.Array.Property","encode.array.ArrayAsyncClient.commaDelimited":"Encode.Array.Property.commaDelimited","encode.array.ArrayAsyncClient.commaDelimitedWithResponse":"Encode.Array.Property.commaDelimited","encode.array.ArrayAsyncClient.newlineDelimited":"Encode.Array.Property.newlineDelimited","encode.array.ArrayAsyncClient.newlineDelimitedWithResponse":"Encode.Array.Property.newlineDelimited","encode.array.ArrayAsyncClient.pipeDelimited":"Encode.Array.Property.pipeDelimited","encode.array.ArrayAsyncClient.pipeDelimitedWithResponse":"Encode.Array.Property.pipeDelimited","encode.array.ArrayAsyncClient.spaceDelimited":"Encode.Array.Property.spaceDelimited","encode.array.ArrayAsyncClient.spaceDelimitedWithResponse":"Encode.Array.Property.spaceDelimited","encode.array.ArrayClient":"Encode.Array.Property","encode.array.ArrayClient.commaDelimited":"Encode.Array.Property.commaDelimited","encode.array.ArrayClient.commaDelimitedWithResponse":"Encode.Array.Property.commaDelimited","encode.array.ArrayClient.newlineDelimited":"Encode.Array.Property.newlineDelimited","encode.array.ArrayClient.newlineDelimitedWithResponse":"Encode.Array.Property.newlineDelimited","encode.array.ArrayClient.pipeDelimited":"Encode.Array.Property.pipeDelimited","encode.array.ArrayClient.pipeDelimitedWithResponse":"Encode.Array.Property.pipeDelimited","encode.array.ArrayClient.spaceDelimited":"Encode.Array.Property.spaceDelimited","encode.array.ArrayClient.spaceDelimitedWithResponse":"Encode.Array.Property.spaceDelimited","encode.array.ArrayClientBuilder":"Encode.Array","encode.array.models.CommaDelimitedArrayProperty":"Encode.Array.CommaDelimitedArrayProperty","encode.array.models.NewlineDelimitedArrayProperty":"Encode.Array.NewlineDelimitedArrayProperty","encode.array.models.PipeDelimitedArrayProperty":"Encode.Array.PipeDelimitedArrayProperty","encode.array.models.SpaceDelimitedArrayProperty":"Encode.Array.SpaceDelimitedArrayProperty"},"generatedFiles":["src/main/java/encode/array/ArrayAsyncClient.java","src/main/java/encode/array/ArrayClient.java","src/main/java/encode/array/ArrayClientBuilder.java","src/main/java/encode/array/implementation/ArrayClientImpl.java","src/main/java/encode/array/implementation/PropertiesImpl.java","src/main/java/encode/array/implementation/package-info.java","src/main/java/encode/array/models/CommaDelimitedArrayProperty.java","src/main/java/encode/array/models/NewlineDelimitedArrayProperty.java","src/main/java/encode/array/models/PipeDelimitedArrayProperty.java","src/main/java/encode/array/models/SpaceDelimitedArrayProperty.java","src/main/java/encode/array/models/package-info.java","src/main/java/encode/array/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_apiview_properties.json new file mode 100644 index 00000000000..1497454c2d1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_apiview_properties.json @@ -0,0 +1,108 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "encode.bytes.BytesClientBuilder": "Encode.Bytes", + "encode.bytes.HeaderAsyncClient": "Encode.Bytes.Header", + "encode.bytes.HeaderAsyncClient.base64": "Encode.Bytes.Header.base64", + "encode.bytes.HeaderAsyncClient.base64WithResponse": "Encode.Bytes.Header.base64", + "encode.bytes.HeaderAsyncClient.base64url": "Encode.Bytes.Header.base64url", + "encode.bytes.HeaderAsyncClient.base64urlArray": "Encode.Bytes.Header.base64urlArray", + "encode.bytes.HeaderAsyncClient.base64urlArrayWithResponse": "Encode.Bytes.Header.base64urlArray", + "encode.bytes.HeaderAsyncClient.base64urlWithResponse": "Encode.Bytes.Header.base64url", + "encode.bytes.HeaderAsyncClient.defaultMethod": "Encode.Bytes.Header.default", + "encode.bytes.HeaderAsyncClient.defaultMethodWithResponse": "Encode.Bytes.Header.default", + "encode.bytes.HeaderClient": "Encode.Bytes.Header", + "encode.bytes.HeaderClient.base64": "Encode.Bytes.Header.base64", + "encode.bytes.HeaderClient.base64WithResponse": "Encode.Bytes.Header.base64", + "encode.bytes.HeaderClient.base64url": "Encode.Bytes.Header.base64url", + "encode.bytes.HeaderClient.base64urlArray": "Encode.Bytes.Header.base64urlArray", + "encode.bytes.HeaderClient.base64urlArrayWithResponse": "Encode.Bytes.Header.base64urlArray", + "encode.bytes.HeaderClient.base64urlWithResponse": "Encode.Bytes.Header.base64url", + "encode.bytes.HeaderClient.defaultMethod": "Encode.Bytes.Header.default", + "encode.bytes.HeaderClient.defaultMethodWithResponse": "Encode.Bytes.Header.default", + "encode.bytes.PropertyAsyncClient": "Encode.Bytes.Property", + "encode.bytes.PropertyAsyncClient.base64": "Encode.Bytes.Property.base64", + "encode.bytes.PropertyAsyncClient.base64WithResponse": "Encode.Bytes.Property.base64", + "encode.bytes.PropertyAsyncClient.base64url": "Encode.Bytes.Property.base64url", + "encode.bytes.PropertyAsyncClient.base64urlArray": "Encode.Bytes.Property.base64urlArray", + "encode.bytes.PropertyAsyncClient.base64urlArrayWithResponse": "Encode.Bytes.Property.base64urlArray", + "encode.bytes.PropertyAsyncClient.base64urlWithResponse": "Encode.Bytes.Property.base64url", + "encode.bytes.PropertyAsyncClient.defaultMethod": "Encode.Bytes.Property.default", + "encode.bytes.PropertyAsyncClient.defaultMethodWithResponse": "Encode.Bytes.Property.default", + "encode.bytes.PropertyClient": "Encode.Bytes.Property", + "encode.bytes.PropertyClient.base64": "Encode.Bytes.Property.base64", + "encode.bytes.PropertyClient.base64WithResponse": "Encode.Bytes.Property.base64", + "encode.bytes.PropertyClient.base64url": "Encode.Bytes.Property.base64url", + "encode.bytes.PropertyClient.base64urlArray": "Encode.Bytes.Property.base64urlArray", + "encode.bytes.PropertyClient.base64urlArrayWithResponse": "Encode.Bytes.Property.base64urlArray", + "encode.bytes.PropertyClient.base64urlWithResponse": "Encode.Bytes.Property.base64url", + "encode.bytes.PropertyClient.defaultMethod": "Encode.Bytes.Property.default", + "encode.bytes.PropertyClient.defaultMethodWithResponse": "Encode.Bytes.Property.default", + "encode.bytes.QueryAsyncClient": "Encode.Bytes.Query", + "encode.bytes.QueryAsyncClient.base64": "Encode.Bytes.Query.base64", + "encode.bytes.QueryAsyncClient.base64WithResponse": "Encode.Bytes.Query.base64", + "encode.bytes.QueryAsyncClient.base64url": "Encode.Bytes.Query.base64url", + "encode.bytes.QueryAsyncClient.base64urlArray": "Encode.Bytes.Query.base64urlArray", + "encode.bytes.QueryAsyncClient.base64urlArrayWithResponse": "Encode.Bytes.Query.base64urlArray", + "encode.bytes.QueryAsyncClient.base64urlWithResponse": "Encode.Bytes.Query.base64url", + "encode.bytes.QueryAsyncClient.defaultMethod": "Encode.Bytes.Query.default", + "encode.bytes.QueryAsyncClient.defaultMethodWithResponse": "Encode.Bytes.Query.default", + "encode.bytes.QueryClient": "Encode.Bytes.Query", + "encode.bytes.QueryClient.base64": "Encode.Bytes.Query.base64", + "encode.bytes.QueryClient.base64WithResponse": "Encode.Bytes.Query.base64", + "encode.bytes.QueryClient.base64url": "Encode.Bytes.Query.base64url", + "encode.bytes.QueryClient.base64urlArray": "Encode.Bytes.Query.base64urlArray", + "encode.bytes.QueryClient.base64urlArrayWithResponse": "Encode.Bytes.Query.base64urlArray", + "encode.bytes.QueryClient.base64urlWithResponse": "Encode.Bytes.Query.base64url", + "encode.bytes.QueryClient.defaultMethod": "Encode.Bytes.Query.default", + "encode.bytes.QueryClient.defaultMethodWithResponse": "Encode.Bytes.Query.default", + "encode.bytes.RequestBodyAsyncClient": "Encode.Bytes.RequestBody", + "encode.bytes.RequestBodyAsyncClient.base64": "Encode.Bytes.RequestBody.base64", + "encode.bytes.RequestBodyAsyncClient.base64WithResponse": "Encode.Bytes.RequestBody.base64", + "encode.bytes.RequestBodyAsyncClient.base64url": "Encode.Bytes.RequestBody.base64url", + "encode.bytes.RequestBodyAsyncClient.base64urlWithResponse": "Encode.Bytes.RequestBody.base64url", + "encode.bytes.RequestBodyAsyncClient.customContentType": "Encode.Bytes.RequestBody.customContentType", + "encode.bytes.RequestBodyAsyncClient.customContentTypeWithResponse": "Encode.Bytes.RequestBody.customContentType", + "encode.bytes.RequestBodyAsyncClient.defaultMethod": "Encode.Bytes.RequestBody.default", + "encode.bytes.RequestBodyAsyncClient.defaultMethodWithResponse": "Encode.Bytes.RequestBody.default", + "encode.bytes.RequestBodyAsyncClient.octetStream": "Encode.Bytes.RequestBody.octetStream", + "encode.bytes.RequestBodyAsyncClient.octetStreamWithResponse": "Encode.Bytes.RequestBody.octetStream", + "encode.bytes.RequestBodyClient": "Encode.Bytes.RequestBody", + "encode.bytes.RequestBodyClient.base64": "Encode.Bytes.RequestBody.base64", + "encode.bytes.RequestBodyClient.base64WithResponse": "Encode.Bytes.RequestBody.base64", + "encode.bytes.RequestBodyClient.base64url": "Encode.Bytes.RequestBody.base64url", + "encode.bytes.RequestBodyClient.base64urlWithResponse": "Encode.Bytes.RequestBody.base64url", + "encode.bytes.RequestBodyClient.customContentType": "Encode.Bytes.RequestBody.customContentType", + "encode.bytes.RequestBodyClient.customContentTypeWithResponse": "Encode.Bytes.RequestBody.customContentType", + "encode.bytes.RequestBodyClient.defaultMethod": "Encode.Bytes.RequestBody.default", + "encode.bytes.RequestBodyClient.defaultMethodWithResponse": "Encode.Bytes.RequestBody.default", + "encode.bytes.RequestBodyClient.octetStream": "Encode.Bytes.RequestBody.octetStream", + "encode.bytes.RequestBodyClient.octetStreamWithResponse": "Encode.Bytes.RequestBody.octetStream", + "encode.bytes.ResponseBodyAsyncClient": "Encode.Bytes.ResponseBody", + "encode.bytes.ResponseBodyAsyncClient.base64": "Encode.Bytes.ResponseBody.base64", + "encode.bytes.ResponseBodyAsyncClient.base64WithResponse": "Encode.Bytes.ResponseBody.base64", + "encode.bytes.ResponseBodyAsyncClient.base64url": "Encode.Bytes.ResponseBody.base64url", + "encode.bytes.ResponseBodyAsyncClient.base64urlWithResponse": "Encode.Bytes.ResponseBody.base64url", + "encode.bytes.ResponseBodyAsyncClient.customContentType": "Encode.Bytes.ResponseBody.customContentType", + "encode.bytes.ResponseBodyAsyncClient.customContentTypeWithResponse": "Encode.Bytes.ResponseBody.customContentType", + "encode.bytes.ResponseBodyAsyncClient.defaultMethod": "Encode.Bytes.ResponseBody.default", + "encode.bytes.ResponseBodyAsyncClient.defaultMethodWithResponse": "Encode.Bytes.ResponseBody.default", + "encode.bytes.ResponseBodyAsyncClient.octetStream": "Encode.Bytes.ResponseBody.octetStream", + "encode.bytes.ResponseBodyAsyncClient.octetStreamWithResponse": "Encode.Bytes.ResponseBody.octetStream", + "encode.bytes.ResponseBodyClient": "Encode.Bytes.ResponseBody", + "encode.bytes.ResponseBodyClient.base64": "Encode.Bytes.ResponseBody.base64", + "encode.bytes.ResponseBodyClient.base64WithResponse": "Encode.Bytes.ResponseBody.base64", + "encode.bytes.ResponseBodyClient.base64url": "Encode.Bytes.ResponseBody.base64url", + "encode.bytes.ResponseBodyClient.base64urlWithResponse": "Encode.Bytes.ResponseBody.base64url", + "encode.bytes.ResponseBodyClient.customContentType": "Encode.Bytes.ResponseBody.customContentType", + "encode.bytes.ResponseBodyClient.customContentTypeWithResponse": "Encode.Bytes.ResponseBody.customContentType", + "encode.bytes.ResponseBodyClient.defaultMethod": "Encode.Bytes.ResponseBody.default", + "encode.bytes.ResponseBodyClient.defaultMethodWithResponse": "Encode.Bytes.ResponseBody.default", + "encode.bytes.ResponseBodyClient.octetStream": "Encode.Bytes.ResponseBody.octetStream", + "encode.bytes.ResponseBodyClient.octetStreamWithResponse": "Encode.Bytes.ResponseBody.octetStream", + "encode.bytes.models.Base64BytesProperty": "Encode.Bytes.Base64BytesProperty", + "encode.bytes.models.Base64urlArrayBytesProperty": "Encode.Bytes.Base64urlArrayBytesProperty", + "encode.bytes.models.Base64urlBytesProperty": "Encode.Bytes.Base64urlBytesProperty", + "encode.bytes.models.DefaultBytesProperty": "Encode.Bytes.DefaultBytesProperty" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_metadata.json new file mode 100644 index 00000000000..3654d682d58 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-bytes_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"encode.bytes.BytesClientBuilder":"Encode.Bytes","encode.bytes.HeaderAsyncClient":"Encode.Bytes.Header","encode.bytes.HeaderAsyncClient.base64":"Encode.Bytes.Header.base64","encode.bytes.HeaderAsyncClient.base64WithResponse":"Encode.Bytes.Header.base64","encode.bytes.HeaderAsyncClient.base64url":"Encode.Bytes.Header.base64url","encode.bytes.HeaderAsyncClient.base64urlArray":"Encode.Bytes.Header.base64urlArray","encode.bytes.HeaderAsyncClient.base64urlArrayWithResponse":"Encode.Bytes.Header.base64urlArray","encode.bytes.HeaderAsyncClient.base64urlWithResponse":"Encode.Bytes.Header.base64url","encode.bytes.HeaderAsyncClient.defaultMethod":"Encode.Bytes.Header.default","encode.bytes.HeaderAsyncClient.defaultMethodWithResponse":"Encode.Bytes.Header.default","encode.bytes.HeaderClient":"Encode.Bytes.Header","encode.bytes.HeaderClient.base64":"Encode.Bytes.Header.base64","encode.bytes.HeaderClient.base64WithResponse":"Encode.Bytes.Header.base64","encode.bytes.HeaderClient.base64url":"Encode.Bytes.Header.base64url","encode.bytes.HeaderClient.base64urlArray":"Encode.Bytes.Header.base64urlArray","encode.bytes.HeaderClient.base64urlArrayWithResponse":"Encode.Bytes.Header.base64urlArray","encode.bytes.HeaderClient.base64urlWithResponse":"Encode.Bytes.Header.base64url","encode.bytes.HeaderClient.defaultMethod":"Encode.Bytes.Header.default","encode.bytes.HeaderClient.defaultMethodWithResponse":"Encode.Bytes.Header.default","encode.bytes.PropertyAsyncClient":"Encode.Bytes.Property","encode.bytes.PropertyAsyncClient.base64":"Encode.Bytes.Property.base64","encode.bytes.PropertyAsyncClient.base64WithResponse":"Encode.Bytes.Property.base64","encode.bytes.PropertyAsyncClient.base64url":"Encode.Bytes.Property.base64url","encode.bytes.PropertyAsyncClient.base64urlArray":"Encode.Bytes.Property.base64urlArray","encode.bytes.PropertyAsyncClient.base64urlArrayWithResponse":"Encode.Bytes.Property.base64urlArray","encode.bytes.PropertyAsyncClient.base64urlWithResponse":"Encode.Bytes.Property.base64url","encode.bytes.PropertyAsyncClient.defaultMethod":"Encode.Bytes.Property.default","encode.bytes.PropertyAsyncClient.defaultMethodWithResponse":"Encode.Bytes.Property.default","encode.bytes.PropertyClient":"Encode.Bytes.Property","encode.bytes.PropertyClient.base64":"Encode.Bytes.Property.base64","encode.bytes.PropertyClient.base64WithResponse":"Encode.Bytes.Property.base64","encode.bytes.PropertyClient.base64url":"Encode.Bytes.Property.base64url","encode.bytes.PropertyClient.base64urlArray":"Encode.Bytes.Property.base64urlArray","encode.bytes.PropertyClient.base64urlArrayWithResponse":"Encode.Bytes.Property.base64urlArray","encode.bytes.PropertyClient.base64urlWithResponse":"Encode.Bytes.Property.base64url","encode.bytes.PropertyClient.defaultMethod":"Encode.Bytes.Property.default","encode.bytes.PropertyClient.defaultMethodWithResponse":"Encode.Bytes.Property.default","encode.bytes.QueryAsyncClient":"Encode.Bytes.Query","encode.bytes.QueryAsyncClient.base64":"Encode.Bytes.Query.base64","encode.bytes.QueryAsyncClient.base64WithResponse":"Encode.Bytes.Query.base64","encode.bytes.QueryAsyncClient.base64url":"Encode.Bytes.Query.base64url","encode.bytes.QueryAsyncClient.base64urlArray":"Encode.Bytes.Query.base64urlArray","encode.bytes.QueryAsyncClient.base64urlArrayWithResponse":"Encode.Bytes.Query.base64urlArray","encode.bytes.QueryAsyncClient.base64urlWithResponse":"Encode.Bytes.Query.base64url","encode.bytes.QueryAsyncClient.defaultMethod":"Encode.Bytes.Query.default","encode.bytes.QueryAsyncClient.defaultMethodWithResponse":"Encode.Bytes.Query.default","encode.bytes.QueryClient":"Encode.Bytes.Query","encode.bytes.QueryClient.base64":"Encode.Bytes.Query.base64","encode.bytes.QueryClient.base64WithResponse":"Encode.Bytes.Query.base64","encode.bytes.QueryClient.base64url":"Encode.Bytes.Query.base64url","encode.bytes.QueryClient.base64urlArray":"Encode.Bytes.Query.base64urlArray","encode.bytes.QueryClient.base64urlArrayWithResponse":"Encode.Bytes.Query.base64urlArray","encode.bytes.QueryClient.base64urlWithResponse":"Encode.Bytes.Query.base64url","encode.bytes.QueryClient.defaultMethod":"Encode.Bytes.Query.default","encode.bytes.QueryClient.defaultMethodWithResponse":"Encode.Bytes.Query.default","encode.bytes.RequestBodyAsyncClient":"Encode.Bytes.RequestBody","encode.bytes.RequestBodyAsyncClient.base64":"Encode.Bytes.RequestBody.base64","encode.bytes.RequestBodyAsyncClient.base64WithResponse":"Encode.Bytes.RequestBody.base64","encode.bytes.RequestBodyAsyncClient.base64url":"Encode.Bytes.RequestBody.base64url","encode.bytes.RequestBodyAsyncClient.base64urlWithResponse":"Encode.Bytes.RequestBody.base64url","encode.bytes.RequestBodyAsyncClient.customContentType":"Encode.Bytes.RequestBody.customContentType","encode.bytes.RequestBodyAsyncClient.customContentTypeWithResponse":"Encode.Bytes.RequestBody.customContentType","encode.bytes.RequestBodyAsyncClient.defaultMethod":"Encode.Bytes.RequestBody.default","encode.bytes.RequestBodyAsyncClient.defaultMethodWithResponse":"Encode.Bytes.RequestBody.default","encode.bytes.RequestBodyAsyncClient.octetStream":"Encode.Bytes.RequestBody.octetStream","encode.bytes.RequestBodyAsyncClient.octetStreamWithResponse":"Encode.Bytes.RequestBody.octetStream","encode.bytes.RequestBodyClient":"Encode.Bytes.RequestBody","encode.bytes.RequestBodyClient.base64":"Encode.Bytes.RequestBody.base64","encode.bytes.RequestBodyClient.base64WithResponse":"Encode.Bytes.RequestBody.base64","encode.bytes.RequestBodyClient.base64url":"Encode.Bytes.RequestBody.base64url","encode.bytes.RequestBodyClient.base64urlWithResponse":"Encode.Bytes.RequestBody.base64url","encode.bytes.RequestBodyClient.customContentType":"Encode.Bytes.RequestBody.customContentType","encode.bytes.RequestBodyClient.customContentTypeWithResponse":"Encode.Bytes.RequestBody.customContentType","encode.bytes.RequestBodyClient.defaultMethod":"Encode.Bytes.RequestBody.default","encode.bytes.RequestBodyClient.defaultMethodWithResponse":"Encode.Bytes.RequestBody.default","encode.bytes.RequestBodyClient.octetStream":"Encode.Bytes.RequestBody.octetStream","encode.bytes.RequestBodyClient.octetStreamWithResponse":"Encode.Bytes.RequestBody.octetStream","encode.bytes.ResponseBodyAsyncClient":"Encode.Bytes.ResponseBody","encode.bytes.ResponseBodyAsyncClient.base64":"Encode.Bytes.ResponseBody.base64","encode.bytes.ResponseBodyAsyncClient.base64WithResponse":"Encode.Bytes.ResponseBody.base64","encode.bytes.ResponseBodyAsyncClient.base64url":"Encode.Bytes.ResponseBody.base64url","encode.bytes.ResponseBodyAsyncClient.base64urlWithResponse":"Encode.Bytes.ResponseBody.base64url","encode.bytes.ResponseBodyAsyncClient.customContentType":"Encode.Bytes.ResponseBody.customContentType","encode.bytes.ResponseBodyAsyncClient.customContentTypeWithResponse":"Encode.Bytes.ResponseBody.customContentType","encode.bytes.ResponseBodyAsyncClient.defaultMethod":"Encode.Bytes.ResponseBody.default","encode.bytes.ResponseBodyAsyncClient.defaultMethodWithResponse":"Encode.Bytes.ResponseBody.default","encode.bytes.ResponseBodyAsyncClient.octetStream":"Encode.Bytes.ResponseBody.octetStream","encode.bytes.ResponseBodyAsyncClient.octetStreamWithResponse":"Encode.Bytes.ResponseBody.octetStream","encode.bytes.ResponseBodyClient":"Encode.Bytes.ResponseBody","encode.bytes.ResponseBodyClient.base64":"Encode.Bytes.ResponseBody.base64","encode.bytes.ResponseBodyClient.base64WithResponse":"Encode.Bytes.ResponseBody.base64","encode.bytes.ResponseBodyClient.base64url":"Encode.Bytes.ResponseBody.base64url","encode.bytes.ResponseBodyClient.base64urlWithResponse":"Encode.Bytes.ResponseBody.base64url","encode.bytes.ResponseBodyClient.customContentType":"Encode.Bytes.ResponseBody.customContentType","encode.bytes.ResponseBodyClient.customContentTypeWithResponse":"Encode.Bytes.ResponseBody.customContentType","encode.bytes.ResponseBodyClient.defaultMethod":"Encode.Bytes.ResponseBody.default","encode.bytes.ResponseBodyClient.defaultMethodWithResponse":"Encode.Bytes.ResponseBody.default","encode.bytes.ResponseBodyClient.octetStream":"Encode.Bytes.ResponseBody.octetStream","encode.bytes.ResponseBodyClient.octetStreamWithResponse":"Encode.Bytes.ResponseBody.octetStream","encode.bytes.models.Base64BytesProperty":"Encode.Bytes.Base64BytesProperty","encode.bytes.models.Base64urlArrayBytesProperty":"Encode.Bytes.Base64urlArrayBytesProperty","encode.bytes.models.Base64urlBytesProperty":"Encode.Bytes.Base64urlBytesProperty","encode.bytes.models.DefaultBytesProperty":"Encode.Bytes.DefaultBytesProperty"},"generatedFiles":["src/main/java/encode/bytes/BytesClientBuilder.java","src/main/java/encode/bytes/HeaderAsyncClient.java","src/main/java/encode/bytes/HeaderClient.java","src/main/java/encode/bytes/PropertyAsyncClient.java","src/main/java/encode/bytes/PropertyClient.java","src/main/java/encode/bytes/QueryAsyncClient.java","src/main/java/encode/bytes/QueryClient.java","src/main/java/encode/bytes/RequestBodyAsyncClient.java","src/main/java/encode/bytes/RequestBodyClient.java","src/main/java/encode/bytes/ResponseBodyAsyncClient.java","src/main/java/encode/bytes/ResponseBodyClient.java","src/main/java/encode/bytes/implementation/BytesClientImpl.java","src/main/java/encode/bytes/implementation/HeadersImpl.java","src/main/java/encode/bytes/implementation/PropertiesImpl.java","src/main/java/encode/bytes/implementation/QueriesImpl.java","src/main/java/encode/bytes/implementation/RequestBodiesImpl.java","src/main/java/encode/bytes/implementation/ResponseBodiesImpl.java","src/main/java/encode/bytes/implementation/package-info.java","src/main/java/encode/bytes/models/Base64BytesProperty.java","src/main/java/encode/bytes/models/Base64urlArrayBytesProperty.java","src/main/java/encode/bytes/models/Base64urlBytesProperty.java","src/main/java/encode/bytes/models/DefaultBytesProperty.java","src/main/java/encode/bytes/models/package-info.java","src/main/java/encode/bytes/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_apiview_properties.json new file mode 100644 index 00000000000..0ccdfc55975 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_apiview_properties.json @@ -0,0 +1,95 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "encode.datetime.DatetimeClientBuilder": "Encode.Datetime", + "encode.datetime.HeaderAsyncClient": "Encode.Datetime.Header", + "encode.datetime.HeaderAsyncClient.defaultMethod": "Encode.Datetime.Header.default", + "encode.datetime.HeaderAsyncClient.defaultMethodWithResponse": "Encode.Datetime.Header.default", + "encode.datetime.HeaderAsyncClient.rfc3339": "Encode.Datetime.Header.rfc3339", + "encode.datetime.HeaderAsyncClient.rfc3339WithResponse": "Encode.Datetime.Header.rfc3339", + "encode.datetime.HeaderAsyncClient.rfc7231": "Encode.Datetime.Header.rfc7231", + "encode.datetime.HeaderAsyncClient.rfc7231WithResponse": "Encode.Datetime.Header.rfc7231", + "encode.datetime.HeaderAsyncClient.unixTimestamp": "Encode.Datetime.Header.unixTimestamp", + "encode.datetime.HeaderAsyncClient.unixTimestampArray": "Encode.Datetime.Header.unixTimestampArray", + "encode.datetime.HeaderAsyncClient.unixTimestampArrayWithResponse": "Encode.Datetime.Header.unixTimestampArray", + "encode.datetime.HeaderAsyncClient.unixTimestampWithResponse": "Encode.Datetime.Header.unixTimestamp", + "encode.datetime.HeaderClient": "Encode.Datetime.Header", + "encode.datetime.HeaderClient.defaultMethod": "Encode.Datetime.Header.default", + "encode.datetime.HeaderClient.defaultMethodWithResponse": "Encode.Datetime.Header.default", + "encode.datetime.HeaderClient.rfc3339": "Encode.Datetime.Header.rfc3339", + "encode.datetime.HeaderClient.rfc3339WithResponse": "Encode.Datetime.Header.rfc3339", + "encode.datetime.HeaderClient.rfc7231": "Encode.Datetime.Header.rfc7231", + "encode.datetime.HeaderClient.rfc7231WithResponse": "Encode.Datetime.Header.rfc7231", + "encode.datetime.HeaderClient.unixTimestamp": "Encode.Datetime.Header.unixTimestamp", + "encode.datetime.HeaderClient.unixTimestampArray": "Encode.Datetime.Header.unixTimestampArray", + "encode.datetime.HeaderClient.unixTimestampArrayWithResponse": "Encode.Datetime.Header.unixTimestampArray", + "encode.datetime.HeaderClient.unixTimestampWithResponse": "Encode.Datetime.Header.unixTimestamp", + "encode.datetime.PropertyAsyncClient": "Encode.Datetime.Property", + "encode.datetime.PropertyAsyncClient.defaultMethod": "Encode.Datetime.Property.default", + "encode.datetime.PropertyAsyncClient.defaultMethodWithResponse": "Encode.Datetime.Property.default", + "encode.datetime.PropertyAsyncClient.rfc3339": "Encode.Datetime.Property.rfc3339", + "encode.datetime.PropertyAsyncClient.rfc3339WithResponse": "Encode.Datetime.Property.rfc3339", + "encode.datetime.PropertyAsyncClient.rfc7231": "Encode.Datetime.Property.rfc7231", + "encode.datetime.PropertyAsyncClient.rfc7231WithResponse": "Encode.Datetime.Property.rfc7231", + "encode.datetime.PropertyAsyncClient.unixTimestamp": "Encode.Datetime.Property.unixTimestamp", + "encode.datetime.PropertyAsyncClient.unixTimestampArray": "Encode.Datetime.Property.unixTimestampArray", + "encode.datetime.PropertyAsyncClient.unixTimestampArrayWithResponse": "Encode.Datetime.Property.unixTimestampArray", + "encode.datetime.PropertyAsyncClient.unixTimestampWithResponse": "Encode.Datetime.Property.unixTimestamp", + "encode.datetime.PropertyClient": "Encode.Datetime.Property", + "encode.datetime.PropertyClient.defaultMethod": "Encode.Datetime.Property.default", + "encode.datetime.PropertyClient.defaultMethodWithResponse": "Encode.Datetime.Property.default", + "encode.datetime.PropertyClient.rfc3339": "Encode.Datetime.Property.rfc3339", + "encode.datetime.PropertyClient.rfc3339WithResponse": "Encode.Datetime.Property.rfc3339", + "encode.datetime.PropertyClient.rfc7231": "Encode.Datetime.Property.rfc7231", + "encode.datetime.PropertyClient.rfc7231WithResponse": "Encode.Datetime.Property.rfc7231", + "encode.datetime.PropertyClient.unixTimestamp": "Encode.Datetime.Property.unixTimestamp", + "encode.datetime.PropertyClient.unixTimestampArray": "Encode.Datetime.Property.unixTimestampArray", + "encode.datetime.PropertyClient.unixTimestampArrayWithResponse": "Encode.Datetime.Property.unixTimestampArray", + "encode.datetime.PropertyClient.unixTimestampWithResponse": "Encode.Datetime.Property.unixTimestamp", + "encode.datetime.QueryAsyncClient": "Encode.Datetime.Query", + "encode.datetime.QueryAsyncClient.defaultMethod": "Encode.Datetime.Query.default", + "encode.datetime.QueryAsyncClient.defaultMethodWithResponse": "Encode.Datetime.Query.default", + "encode.datetime.QueryAsyncClient.rfc3339": "Encode.Datetime.Query.rfc3339", + "encode.datetime.QueryAsyncClient.rfc3339WithResponse": "Encode.Datetime.Query.rfc3339", + "encode.datetime.QueryAsyncClient.rfc7231": "Encode.Datetime.Query.rfc7231", + "encode.datetime.QueryAsyncClient.rfc7231WithResponse": "Encode.Datetime.Query.rfc7231", + "encode.datetime.QueryAsyncClient.unixTimestamp": "Encode.Datetime.Query.unixTimestamp", + "encode.datetime.QueryAsyncClient.unixTimestampArray": "Encode.Datetime.Query.unixTimestampArray", + "encode.datetime.QueryAsyncClient.unixTimestampArrayWithResponse": "Encode.Datetime.Query.unixTimestampArray", + "encode.datetime.QueryAsyncClient.unixTimestampWithResponse": "Encode.Datetime.Query.unixTimestamp", + "encode.datetime.QueryClient": "Encode.Datetime.Query", + "encode.datetime.QueryClient.defaultMethod": "Encode.Datetime.Query.default", + "encode.datetime.QueryClient.defaultMethodWithResponse": "Encode.Datetime.Query.default", + "encode.datetime.QueryClient.rfc3339": "Encode.Datetime.Query.rfc3339", + "encode.datetime.QueryClient.rfc3339WithResponse": "Encode.Datetime.Query.rfc3339", + "encode.datetime.QueryClient.rfc7231": "Encode.Datetime.Query.rfc7231", + "encode.datetime.QueryClient.rfc7231WithResponse": "Encode.Datetime.Query.rfc7231", + "encode.datetime.QueryClient.unixTimestamp": "Encode.Datetime.Query.unixTimestamp", + "encode.datetime.QueryClient.unixTimestampArray": "Encode.Datetime.Query.unixTimestampArray", + "encode.datetime.QueryClient.unixTimestampArrayWithResponse": "Encode.Datetime.Query.unixTimestampArray", + "encode.datetime.QueryClient.unixTimestampWithResponse": "Encode.Datetime.Query.unixTimestamp", + "encode.datetime.ResponseHeaderAsyncClient": "Encode.Datetime.ResponseHeader", + "encode.datetime.ResponseHeaderAsyncClient.defaultMethod": "Encode.Datetime.ResponseHeader.default", + "encode.datetime.ResponseHeaderAsyncClient.defaultMethodWithResponse": "Encode.Datetime.ResponseHeader.default", + "encode.datetime.ResponseHeaderAsyncClient.rfc3339": "Encode.Datetime.ResponseHeader.rfc3339", + "encode.datetime.ResponseHeaderAsyncClient.rfc3339WithResponse": "Encode.Datetime.ResponseHeader.rfc3339", + "encode.datetime.ResponseHeaderAsyncClient.rfc7231": "Encode.Datetime.ResponseHeader.rfc7231", + "encode.datetime.ResponseHeaderAsyncClient.rfc7231WithResponse": "Encode.Datetime.ResponseHeader.rfc7231", + "encode.datetime.ResponseHeaderAsyncClient.unixTimestamp": "Encode.Datetime.ResponseHeader.unixTimestamp", + "encode.datetime.ResponseHeaderAsyncClient.unixTimestampWithResponse": "Encode.Datetime.ResponseHeader.unixTimestamp", + "encode.datetime.ResponseHeaderClient": "Encode.Datetime.ResponseHeader", + "encode.datetime.ResponseHeaderClient.defaultMethod": "Encode.Datetime.ResponseHeader.default", + "encode.datetime.ResponseHeaderClient.defaultMethodWithResponse": "Encode.Datetime.ResponseHeader.default", + "encode.datetime.ResponseHeaderClient.rfc3339": "Encode.Datetime.ResponseHeader.rfc3339", + "encode.datetime.ResponseHeaderClient.rfc3339WithResponse": "Encode.Datetime.ResponseHeader.rfc3339", + "encode.datetime.ResponseHeaderClient.rfc7231": "Encode.Datetime.ResponseHeader.rfc7231", + "encode.datetime.ResponseHeaderClient.rfc7231WithResponse": "Encode.Datetime.ResponseHeader.rfc7231", + "encode.datetime.ResponseHeaderClient.unixTimestamp": "Encode.Datetime.ResponseHeader.unixTimestamp", + "encode.datetime.ResponseHeaderClient.unixTimestampWithResponse": "Encode.Datetime.ResponseHeader.unixTimestamp", + "encode.datetime.models.DefaultDatetimeProperty": "Encode.Datetime.DefaultDatetimeProperty", + "encode.datetime.models.Rfc3339DatetimeProperty": "Encode.Datetime.Rfc3339DatetimeProperty", + "encode.datetime.models.Rfc7231DatetimeProperty": "Encode.Datetime.Rfc7231DatetimeProperty", + "encode.datetime.models.UnixTimestampArrayDatetimeProperty": "Encode.Datetime.UnixTimestampArrayDatetimeProperty", + "encode.datetime.models.UnixTimestampDatetimeProperty": "Encode.Datetime.UnixTimestampDatetimeProperty" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_metadata.json new file mode 100644 index 00000000000..84ce62f87c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-datetime_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"encode.datetime.DatetimeClientBuilder":"Encode.Datetime","encode.datetime.HeaderAsyncClient":"Encode.Datetime.Header","encode.datetime.HeaderAsyncClient.defaultMethod":"Encode.Datetime.Header.default","encode.datetime.HeaderAsyncClient.defaultMethodWithResponse":"Encode.Datetime.Header.default","encode.datetime.HeaderAsyncClient.rfc3339":"Encode.Datetime.Header.rfc3339","encode.datetime.HeaderAsyncClient.rfc3339WithResponse":"Encode.Datetime.Header.rfc3339","encode.datetime.HeaderAsyncClient.rfc7231":"Encode.Datetime.Header.rfc7231","encode.datetime.HeaderAsyncClient.rfc7231WithResponse":"Encode.Datetime.Header.rfc7231","encode.datetime.HeaderAsyncClient.unixTimestamp":"Encode.Datetime.Header.unixTimestamp","encode.datetime.HeaderAsyncClient.unixTimestampArray":"Encode.Datetime.Header.unixTimestampArray","encode.datetime.HeaderAsyncClient.unixTimestampArrayWithResponse":"Encode.Datetime.Header.unixTimestampArray","encode.datetime.HeaderAsyncClient.unixTimestampWithResponse":"Encode.Datetime.Header.unixTimestamp","encode.datetime.HeaderClient":"Encode.Datetime.Header","encode.datetime.HeaderClient.defaultMethod":"Encode.Datetime.Header.default","encode.datetime.HeaderClient.defaultMethodWithResponse":"Encode.Datetime.Header.default","encode.datetime.HeaderClient.rfc3339":"Encode.Datetime.Header.rfc3339","encode.datetime.HeaderClient.rfc3339WithResponse":"Encode.Datetime.Header.rfc3339","encode.datetime.HeaderClient.rfc7231":"Encode.Datetime.Header.rfc7231","encode.datetime.HeaderClient.rfc7231WithResponse":"Encode.Datetime.Header.rfc7231","encode.datetime.HeaderClient.unixTimestamp":"Encode.Datetime.Header.unixTimestamp","encode.datetime.HeaderClient.unixTimestampArray":"Encode.Datetime.Header.unixTimestampArray","encode.datetime.HeaderClient.unixTimestampArrayWithResponse":"Encode.Datetime.Header.unixTimestampArray","encode.datetime.HeaderClient.unixTimestampWithResponse":"Encode.Datetime.Header.unixTimestamp","encode.datetime.PropertyAsyncClient":"Encode.Datetime.Property","encode.datetime.PropertyAsyncClient.defaultMethod":"Encode.Datetime.Property.default","encode.datetime.PropertyAsyncClient.defaultMethodWithResponse":"Encode.Datetime.Property.default","encode.datetime.PropertyAsyncClient.rfc3339":"Encode.Datetime.Property.rfc3339","encode.datetime.PropertyAsyncClient.rfc3339WithResponse":"Encode.Datetime.Property.rfc3339","encode.datetime.PropertyAsyncClient.rfc7231":"Encode.Datetime.Property.rfc7231","encode.datetime.PropertyAsyncClient.rfc7231WithResponse":"Encode.Datetime.Property.rfc7231","encode.datetime.PropertyAsyncClient.unixTimestamp":"Encode.Datetime.Property.unixTimestamp","encode.datetime.PropertyAsyncClient.unixTimestampArray":"Encode.Datetime.Property.unixTimestampArray","encode.datetime.PropertyAsyncClient.unixTimestampArrayWithResponse":"Encode.Datetime.Property.unixTimestampArray","encode.datetime.PropertyAsyncClient.unixTimestampWithResponse":"Encode.Datetime.Property.unixTimestamp","encode.datetime.PropertyClient":"Encode.Datetime.Property","encode.datetime.PropertyClient.defaultMethod":"Encode.Datetime.Property.default","encode.datetime.PropertyClient.defaultMethodWithResponse":"Encode.Datetime.Property.default","encode.datetime.PropertyClient.rfc3339":"Encode.Datetime.Property.rfc3339","encode.datetime.PropertyClient.rfc3339WithResponse":"Encode.Datetime.Property.rfc3339","encode.datetime.PropertyClient.rfc7231":"Encode.Datetime.Property.rfc7231","encode.datetime.PropertyClient.rfc7231WithResponse":"Encode.Datetime.Property.rfc7231","encode.datetime.PropertyClient.unixTimestamp":"Encode.Datetime.Property.unixTimestamp","encode.datetime.PropertyClient.unixTimestampArray":"Encode.Datetime.Property.unixTimestampArray","encode.datetime.PropertyClient.unixTimestampArrayWithResponse":"Encode.Datetime.Property.unixTimestampArray","encode.datetime.PropertyClient.unixTimestampWithResponse":"Encode.Datetime.Property.unixTimestamp","encode.datetime.QueryAsyncClient":"Encode.Datetime.Query","encode.datetime.QueryAsyncClient.defaultMethod":"Encode.Datetime.Query.default","encode.datetime.QueryAsyncClient.defaultMethodWithResponse":"Encode.Datetime.Query.default","encode.datetime.QueryAsyncClient.rfc3339":"Encode.Datetime.Query.rfc3339","encode.datetime.QueryAsyncClient.rfc3339WithResponse":"Encode.Datetime.Query.rfc3339","encode.datetime.QueryAsyncClient.rfc7231":"Encode.Datetime.Query.rfc7231","encode.datetime.QueryAsyncClient.rfc7231WithResponse":"Encode.Datetime.Query.rfc7231","encode.datetime.QueryAsyncClient.unixTimestamp":"Encode.Datetime.Query.unixTimestamp","encode.datetime.QueryAsyncClient.unixTimestampArray":"Encode.Datetime.Query.unixTimestampArray","encode.datetime.QueryAsyncClient.unixTimestampArrayWithResponse":"Encode.Datetime.Query.unixTimestampArray","encode.datetime.QueryAsyncClient.unixTimestampWithResponse":"Encode.Datetime.Query.unixTimestamp","encode.datetime.QueryClient":"Encode.Datetime.Query","encode.datetime.QueryClient.defaultMethod":"Encode.Datetime.Query.default","encode.datetime.QueryClient.defaultMethodWithResponse":"Encode.Datetime.Query.default","encode.datetime.QueryClient.rfc3339":"Encode.Datetime.Query.rfc3339","encode.datetime.QueryClient.rfc3339WithResponse":"Encode.Datetime.Query.rfc3339","encode.datetime.QueryClient.rfc7231":"Encode.Datetime.Query.rfc7231","encode.datetime.QueryClient.rfc7231WithResponse":"Encode.Datetime.Query.rfc7231","encode.datetime.QueryClient.unixTimestamp":"Encode.Datetime.Query.unixTimestamp","encode.datetime.QueryClient.unixTimestampArray":"Encode.Datetime.Query.unixTimestampArray","encode.datetime.QueryClient.unixTimestampArrayWithResponse":"Encode.Datetime.Query.unixTimestampArray","encode.datetime.QueryClient.unixTimestampWithResponse":"Encode.Datetime.Query.unixTimestamp","encode.datetime.ResponseHeaderAsyncClient":"Encode.Datetime.ResponseHeader","encode.datetime.ResponseHeaderAsyncClient.defaultMethod":"Encode.Datetime.ResponseHeader.default","encode.datetime.ResponseHeaderAsyncClient.defaultMethodWithResponse":"Encode.Datetime.ResponseHeader.default","encode.datetime.ResponseHeaderAsyncClient.rfc3339":"Encode.Datetime.ResponseHeader.rfc3339","encode.datetime.ResponseHeaderAsyncClient.rfc3339WithResponse":"Encode.Datetime.ResponseHeader.rfc3339","encode.datetime.ResponseHeaderAsyncClient.rfc7231":"Encode.Datetime.ResponseHeader.rfc7231","encode.datetime.ResponseHeaderAsyncClient.rfc7231WithResponse":"Encode.Datetime.ResponseHeader.rfc7231","encode.datetime.ResponseHeaderAsyncClient.unixTimestamp":"Encode.Datetime.ResponseHeader.unixTimestamp","encode.datetime.ResponseHeaderAsyncClient.unixTimestampWithResponse":"Encode.Datetime.ResponseHeader.unixTimestamp","encode.datetime.ResponseHeaderClient":"Encode.Datetime.ResponseHeader","encode.datetime.ResponseHeaderClient.defaultMethod":"Encode.Datetime.ResponseHeader.default","encode.datetime.ResponseHeaderClient.defaultMethodWithResponse":"Encode.Datetime.ResponseHeader.default","encode.datetime.ResponseHeaderClient.rfc3339":"Encode.Datetime.ResponseHeader.rfc3339","encode.datetime.ResponseHeaderClient.rfc3339WithResponse":"Encode.Datetime.ResponseHeader.rfc3339","encode.datetime.ResponseHeaderClient.rfc7231":"Encode.Datetime.ResponseHeader.rfc7231","encode.datetime.ResponseHeaderClient.rfc7231WithResponse":"Encode.Datetime.ResponseHeader.rfc7231","encode.datetime.ResponseHeaderClient.unixTimestamp":"Encode.Datetime.ResponseHeader.unixTimestamp","encode.datetime.ResponseHeaderClient.unixTimestampWithResponse":"Encode.Datetime.ResponseHeader.unixTimestamp","encode.datetime.models.DefaultDatetimeProperty":"Encode.Datetime.DefaultDatetimeProperty","encode.datetime.models.Rfc3339DatetimeProperty":"Encode.Datetime.Rfc3339DatetimeProperty","encode.datetime.models.Rfc7231DatetimeProperty":"Encode.Datetime.Rfc7231DatetimeProperty","encode.datetime.models.UnixTimestampArrayDatetimeProperty":"Encode.Datetime.UnixTimestampArrayDatetimeProperty","encode.datetime.models.UnixTimestampDatetimeProperty":"Encode.Datetime.UnixTimestampDatetimeProperty"},"generatedFiles":["src/main/java/encode/datetime/DatetimeClientBuilder.java","src/main/java/encode/datetime/HeaderAsyncClient.java","src/main/java/encode/datetime/HeaderClient.java","src/main/java/encode/datetime/PropertyAsyncClient.java","src/main/java/encode/datetime/PropertyClient.java","src/main/java/encode/datetime/QueryAsyncClient.java","src/main/java/encode/datetime/QueryClient.java","src/main/java/encode/datetime/ResponseHeaderAsyncClient.java","src/main/java/encode/datetime/ResponseHeaderClient.java","src/main/java/encode/datetime/implementation/DatetimeClientImpl.java","src/main/java/encode/datetime/implementation/HeadersImpl.java","src/main/java/encode/datetime/implementation/PropertiesImpl.java","src/main/java/encode/datetime/implementation/QueriesImpl.java","src/main/java/encode/datetime/implementation/ResponseHeadersImpl.java","src/main/java/encode/datetime/implementation/package-info.java","src/main/java/encode/datetime/models/DefaultDatetimeProperty.java","src/main/java/encode/datetime/models/Rfc3339DatetimeProperty.java","src/main/java/encode/datetime/models/Rfc7231DatetimeProperty.java","src/main/java/encode/datetime/models/UnixTimestampArrayDatetimeProperty.java","src/main/java/encode/datetime/models/UnixTimestampDatetimeProperty.java","src/main/java/encode/datetime/models/package-info.java","src/main/java/encode/datetime/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_apiview_properties.json new file mode 100644 index 00000000000..821255378ba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_apiview_properties.json @@ -0,0 +1,194 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "encode.duration.DurationClientBuilder": "Encode.Duration", + "encode.duration.HeaderAsyncClient": "Encode.Duration.Header", + "encode.duration.HeaderAsyncClient.defaultMethod": "Encode.Duration.Header.default", + "encode.duration.HeaderAsyncClient.defaultMethodWithResponse": "Encode.Duration.Header.default", + "encode.duration.HeaderAsyncClient.float64Milliseconds": "Encode.Duration.Header.float64Milliseconds", + "encode.duration.HeaderAsyncClient.float64MillisecondsWithResponse": "Encode.Duration.Header.float64Milliseconds", + "encode.duration.HeaderAsyncClient.float64Seconds": "Encode.Duration.Header.float64Seconds", + "encode.duration.HeaderAsyncClient.float64SecondsWithResponse": "Encode.Duration.Header.float64Seconds", + "encode.duration.HeaderAsyncClient.floatMilliseconds": "Encode.Duration.Header.floatMilliseconds", + "encode.duration.HeaderAsyncClient.floatMillisecondsLargerUnit": "Encode.Duration.Header.floatMillisecondsLargerUnit", + "encode.duration.HeaderAsyncClient.floatMillisecondsLargerUnitWithResponse": "Encode.Duration.Header.floatMillisecondsLargerUnit", + "encode.duration.HeaderAsyncClient.floatMillisecondsWithResponse": "Encode.Duration.Header.floatMilliseconds", + "encode.duration.HeaderAsyncClient.floatSeconds": "Encode.Duration.Header.floatSeconds", + "encode.duration.HeaderAsyncClient.floatSecondsLargerUnit": "Encode.Duration.Header.floatSecondsLargerUnit", + "encode.duration.HeaderAsyncClient.floatSecondsLargerUnitWithResponse": "Encode.Duration.Header.floatSecondsLargerUnit", + "encode.duration.HeaderAsyncClient.floatSecondsWithResponse": "Encode.Duration.Header.floatSeconds", + "encode.duration.HeaderAsyncClient.int32Milliseconds": "Encode.Duration.Header.int32Milliseconds", + "encode.duration.HeaderAsyncClient.int32MillisecondsArray": "Encode.Duration.Header.int32MillisecondsArray", + "encode.duration.HeaderAsyncClient.int32MillisecondsArrayWithResponse": "Encode.Duration.Header.int32MillisecondsArray", + "encode.duration.HeaderAsyncClient.int32MillisecondsLargerUnit": "Encode.Duration.Header.int32MillisecondsLargerUnit", + "encode.duration.HeaderAsyncClient.int32MillisecondsLargerUnitWithResponse": "Encode.Duration.Header.int32MillisecondsLargerUnit", + "encode.duration.HeaderAsyncClient.int32MillisecondsWithResponse": "Encode.Duration.Header.int32Milliseconds", + "encode.duration.HeaderAsyncClient.int32Seconds": "Encode.Duration.Header.int32Seconds", + "encode.duration.HeaderAsyncClient.int32SecondsLargerUnit": "Encode.Duration.Header.int32SecondsLargerUnit", + "encode.duration.HeaderAsyncClient.int32SecondsLargerUnitWithResponse": "Encode.Duration.Header.int32SecondsLargerUnit", + "encode.duration.HeaderAsyncClient.int32SecondsWithResponse": "Encode.Duration.Header.int32Seconds", + "encode.duration.HeaderAsyncClient.iso8601": "Encode.Duration.Header.iso8601", + "encode.duration.HeaderAsyncClient.iso8601Array": "Encode.Duration.Header.iso8601Array", + "encode.duration.HeaderAsyncClient.iso8601ArrayWithResponse": "Encode.Duration.Header.iso8601Array", + "encode.duration.HeaderAsyncClient.iso8601WithResponse": "Encode.Duration.Header.iso8601", + "encode.duration.HeaderClient": "Encode.Duration.Header", + "encode.duration.HeaderClient.defaultMethod": "Encode.Duration.Header.default", + "encode.duration.HeaderClient.defaultMethodWithResponse": "Encode.Duration.Header.default", + "encode.duration.HeaderClient.float64Milliseconds": "Encode.Duration.Header.float64Milliseconds", + "encode.duration.HeaderClient.float64MillisecondsWithResponse": "Encode.Duration.Header.float64Milliseconds", + "encode.duration.HeaderClient.float64Seconds": "Encode.Duration.Header.float64Seconds", + "encode.duration.HeaderClient.float64SecondsWithResponse": "Encode.Duration.Header.float64Seconds", + "encode.duration.HeaderClient.floatMilliseconds": "Encode.Duration.Header.floatMilliseconds", + "encode.duration.HeaderClient.floatMillisecondsLargerUnit": "Encode.Duration.Header.floatMillisecondsLargerUnit", + "encode.duration.HeaderClient.floatMillisecondsLargerUnitWithResponse": "Encode.Duration.Header.floatMillisecondsLargerUnit", + "encode.duration.HeaderClient.floatMillisecondsWithResponse": "Encode.Duration.Header.floatMilliseconds", + "encode.duration.HeaderClient.floatSeconds": "Encode.Duration.Header.floatSeconds", + "encode.duration.HeaderClient.floatSecondsLargerUnit": "Encode.Duration.Header.floatSecondsLargerUnit", + "encode.duration.HeaderClient.floatSecondsLargerUnitWithResponse": "Encode.Duration.Header.floatSecondsLargerUnit", + "encode.duration.HeaderClient.floatSecondsWithResponse": "Encode.Duration.Header.floatSeconds", + "encode.duration.HeaderClient.int32Milliseconds": "Encode.Duration.Header.int32Milliseconds", + "encode.duration.HeaderClient.int32MillisecondsArray": "Encode.Duration.Header.int32MillisecondsArray", + "encode.duration.HeaderClient.int32MillisecondsArrayWithResponse": "Encode.Duration.Header.int32MillisecondsArray", + "encode.duration.HeaderClient.int32MillisecondsLargerUnit": "Encode.Duration.Header.int32MillisecondsLargerUnit", + "encode.duration.HeaderClient.int32MillisecondsLargerUnitWithResponse": "Encode.Duration.Header.int32MillisecondsLargerUnit", + "encode.duration.HeaderClient.int32MillisecondsWithResponse": "Encode.Duration.Header.int32Milliseconds", + "encode.duration.HeaderClient.int32Seconds": "Encode.Duration.Header.int32Seconds", + "encode.duration.HeaderClient.int32SecondsLargerUnit": "Encode.Duration.Header.int32SecondsLargerUnit", + "encode.duration.HeaderClient.int32SecondsLargerUnitWithResponse": "Encode.Duration.Header.int32SecondsLargerUnit", + "encode.duration.HeaderClient.int32SecondsWithResponse": "Encode.Duration.Header.int32Seconds", + "encode.duration.HeaderClient.iso8601": "Encode.Duration.Header.iso8601", + "encode.duration.HeaderClient.iso8601Array": "Encode.Duration.Header.iso8601Array", + "encode.duration.HeaderClient.iso8601ArrayWithResponse": "Encode.Duration.Header.iso8601Array", + "encode.duration.HeaderClient.iso8601WithResponse": "Encode.Duration.Header.iso8601", + "encode.duration.PropertyAsyncClient": "Encode.Duration.Property", + "encode.duration.PropertyAsyncClient.defaultMethod": "Encode.Duration.Property.default", + "encode.duration.PropertyAsyncClient.defaultMethodWithResponse": "Encode.Duration.Property.default", + "encode.duration.PropertyAsyncClient.float64Milliseconds": "Encode.Duration.Property.float64Milliseconds", + "encode.duration.PropertyAsyncClient.float64MillisecondsWithResponse": "Encode.Duration.Property.float64Milliseconds", + "encode.duration.PropertyAsyncClient.float64Seconds": "Encode.Duration.Property.float64Seconds", + "encode.duration.PropertyAsyncClient.float64SecondsWithResponse": "Encode.Duration.Property.float64Seconds", + "encode.duration.PropertyAsyncClient.floatMilliseconds": "Encode.Duration.Property.floatMilliseconds", + "encode.duration.PropertyAsyncClient.floatMillisecondsArray": "Encode.Duration.Property.floatMillisecondsArray", + "encode.duration.PropertyAsyncClient.floatMillisecondsArrayWithResponse": "Encode.Duration.Property.floatMillisecondsArray", + "encode.duration.PropertyAsyncClient.floatMillisecondsLargerUnit": "Encode.Duration.Property.floatMillisecondsLargerUnit", + "encode.duration.PropertyAsyncClient.floatMillisecondsLargerUnitWithResponse": "Encode.Duration.Property.floatMillisecondsLargerUnit", + "encode.duration.PropertyAsyncClient.floatMillisecondsWithResponse": "Encode.Duration.Property.floatMilliseconds", + "encode.duration.PropertyAsyncClient.floatSeconds": "Encode.Duration.Property.floatSeconds", + "encode.duration.PropertyAsyncClient.floatSecondsArray": "Encode.Duration.Property.floatSecondsArray", + "encode.duration.PropertyAsyncClient.floatSecondsArrayWithResponse": "Encode.Duration.Property.floatSecondsArray", + "encode.duration.PropertyAsyncClient.floatSecondsLargerUnit": "Encode.Duration.Property.floatSecondsLargerUnit", + "encode.duration.PropertyAsyncClient.floatSecondsLargerUnitWithResponse": "Encode.Duration.Property.floatSecondsLargerUnit", + "encode.duration.PropertyAsyncClient.floatSecondsWithResponse": "Encode.Duration.Property.floatSeconds", + "encode.duration.PropertyAsyncClient.int32Milliseconds": "Encode.Duration.Property.int32Milliseconds", + "encode.duration.PropertyAsyncClient.int32MillisecondsLargerUnit": "Encode.Duration.Property.int32MillisecondsLargerUnit", + "encode.duration.PropertyAsyncClient.int32MillisecondsLargerUnitWithResponse": "Encode.Duration.Property.int32MillisecondsLargerUnit", + "encode.duration.PropertyAsyncClient.int32MillisecondsWithResponse": "Encode.Duration.Property.int32Milliseconds", + "encode.duration.PropertyAsyncClient.int32Seconds": "Encode.Duration.Property.int32Seconds", + "encode.duration.PropertyAsyncClient.int32SecondsLargerUnit": "Encode.Duration.Property.int32SecondsLargerUnit", + "encode.duration.PropertyAsyncClient.int32SecondsLargerUnitWithResponse": "Encode.Duration.Property.int32SecondsLargerUnit", + "encode.duration.PropertyAsyncClient.int32SecondsWithResponse": "Encode.Duration.Property.int32Seconds", + "encode.duration.PropertyAsyncClient.iso8601": "Encode.Duration.Property.iso8601", + "encode.duration.PropertyAsyncClient.iso8601WithResponse": "Encode.Duration.Property.iso8601", + "encode.duration.PropertyClient": "Encode.Duration.Property", + "encode.duration.PropertyClient.defaultMethod": "Encode.Duration.Property.default", + "encode.duration.PropertyClient.defaultMethodWithResponse": "Encode.Duration.Property.default", + "encode.duration.PropertyClient.float64Milliseconds": "Encode.Duration.Property.float64Milliseconds", + "encode.duration.PropertyClient.float64MillisecondsWithResponse": "Encode.Duration.Property.float64Milliseconds", + "encode.duration.PropertyClient.float64Seconds": "Encode.Duration.Property.float64Seconds", + "encode.duration.PropertyClient.float64SecondsWithResponse": "Encode.Duration.Property.float64Seconds", + "encode.duration.PropertyClient.floatMilliseconds": "Encode.Duration.Property.floatMilliseconds", + "encode.duration.PropertyClient.floatMillisecondsArray": "Encode.Duration.Property.floatMillisecondsArray", + "encode.duration.PropertyClient.floatMillisecondsArrayWithResponse": "Encode.Duration.Property.floatMillisecondsArray", + "encode.duration.PropertyClient.floatMillisecondsLargerUnit": "Encode.Duration.Property.floatMillisecondsLargerUnit", + "encode.duration.PropertyClient.floatMillisecondsLargerUnitWithResponse": "Encode.Duration.Property.floatMillisecondsLargerUnit", + "encode.duration.PropertyClient.floatMillisecondsWithResponse": "Encode.Duration.Property.floatMilliseconds", + "encode.duration.PropertyClient.floatSeconds": "Encode.Duration.Property.floatSeconds", + "encode.duration.PropertyClient.floatSecondsArray": "Encode.Duration.Property.floatSecondsArray", + "encode.duration.PropertyClient.floatSecondsArrayWithResponse": "Encode.Duration.Property.floatSecondsArray", + "encode.duration.PropertyClient.floatSecondsLargerUnit": "Encode.Duration.Property.floatSecondsLargerUnit", + "encode.duration.PropertyClient.floatSecondsLargerUnitWithResponse": "Encode.Duration.Property.floatSecondsLargerUnit", + "encode.duration.PropertyClient.floatSecondsWithResponse": "Encode.Duration.Property.floatSeconds", + "encode.duration.PropertyClient.int32Milliseconds": "Encode.Duration.Property.int32Milliseconds", + "encode.duration.PropertyClient.int32MillisecondsLargerUnit": "Encode.Duration.Property.int32MillisecondsLargerUnit", + "encode.duration.PropertyClient.int32MillisecondsLargerUnitWithResponse": "Encode.Duration.Property.int32MillisecondsLargerUnit", + "encode.duration.PropertyClient.int32MillisecondsWithResponse": "Encode.Duration.Property.int32Milliseconds", + "encode.duration.PropertyClient.int32Seconds": "Encode.Duration.Property.int32Seconds", + "encode.duration.PropertyClient.int32SecondsLargerUnit": "Encode.Duration.Property.int32SecondsLargerUnit", + "encode.duration.PropertyClient.int32SecondsLargerUnitWithResponse": "Encode.Duration.Property.int32SecondsLargerUnit", + "encode.duration.PropertyClient.int32SecondsWithResponse": "Encode.Duration.Property.int32Seconds", + "encode.duration.PropertyClient.iso8601": "Encode.Duration.Property.iso8601", + "encode.duration.PropertyClient.iso8601WithResponse": "Encode.Duration.Property.iso8601", + "encode.duration.QueryAsyncClient": "Encode.Duration.Query", + "encode.duration.QueryAsyncClient.defaultMethod": "Encode.Duration.Query.default", + "encode.duration.QueryAsyncClient.defaultMethodWithResponse": "Encode.Duration.Query.default", + "encode.duration.QueryAsyncClient.float64Milliseconds": "Encode.Duration.Query.float64Milliseconds", + "encode.duration.QueryAsyncClient.float64MillisecondsWithResponse": "Encode.Duration.Query.float64Milliseconds", + "encode.duration.QueryAsyncClient.float64Seconds": "Encode.Duration.Query.float64Seconds", + "encode.duration.QueryAsyncClient.float64SecondsWithResponse": "Encode.Duration.Query.float64Seconds", + "encode.duration.QueryAsyncClient.floatMilliseconds": "Encode.Duration.Query.floatMilliseconds", + "encode.duration.QueryAsyncClient.floatMillisecondsLargerUnit": "Encode.Duration.Query.floatMillisecondsLargerUnit", + "encode.duration.QueryAsyncClient.floatMillisecondsLargerUnitWithResponse": "Encode.Duration.Query.floatMillisecondsLargerUnit", + "encode.duration.QueryAsyncClient.floatMillisecondsWithResponse": "Encode.Duration.Query.floatMilliseconds", + "encode.duration.QueryAsyncClient.floatSeconds": "Encode.Duration.Query.floatSeconds", + "encode.duration.QueryAsyncClient.floatSecondsLargerUnit": "Encode.Duration.Query.floatSecondsLargerUnit", + "encode.duration.QueryAsyncClient.floatSecondsLargerUnitWithResponse": "Encode.Duration.Query.floatSecondsLargerUnit", + "encode.duration.QueryAsyncClient.floatSecondsWithResponse": "Encode.Duration.Query.floatSeconds", + "encode.duration.QueryAsyncClient.int32Milliseconds": "Encode.Duration.Query.int32Milliseconds", + "encode.duration.QueryAsyncClient.int32MillisecondsArray": "Encode.Duration.Query.int32MillisecondsArray", + "encode.duration.QueryAsyncClient.int32MillisecondsArrayWithResponse": "Encode.Duration.Query.int32MillisecondsArray", + "encode.duration.QueryAsyncClient.int32MillisecondsLargerUnit": "Encode.Duration.Query.int32MillisecondsLargerUnit", + "encode.duration.QueryAsyncClient.int32MillisecondsLargerUnitWithResponse": "Encode.Duration.Query.int32MillisecondsLargerUnit", + "encode.duration.QueryAsyncClient.int32MillisecondsWithResponse": "Encode.Duration.Query.int32Milliseconds", + "encode.duration.QueryAsyncClient.int32Seconds": "Encode.Duration.Query.int32Seconds", + "encode.duration.QueryAsyncClient.int32SecondsArray": "Encode.Duration.Query.int32SecondsArray", + "encode.duration.QueryAsyncClient.int32SecondsArrayWithResponse": "Encode.Duration.Query.int32SecondsArray", + "encode.duration.QueryAsyncClient.int32SecondsLargerUnit": "Encode.Duration.Query.int32SecondsLargerUnit", + "encode.duration.QueryAsyncClient.int32SecondsLargerUnitWithResponse": "Encode.Duration.Query.int32SecondsLargerUnit", + "encode.duration.QueryAsyncClient.int32SecondsWithResponse": "Encode.Duration.Query.int32Seconds", + "encode.duration.QueryAsyncClient.iso8601": "Encode.Duration.Query.iso8601", + "encode.duration.QueryAsyncClient.iso8601WithResponse": "Encode.Duration.Query.iso8601", + "encode.duration.QueryClient": "Encode.Duration.Query", + "encode.duration.QueryClient.defaultMethod": "Encode.Duration.Query.default", + "encode.duration.QueryClient.defaultMethodWithResponse": "Encode.Duration.Query.default", + "encode.duration.QueryClient.float64Milliseconds": "Encode.Duration.Query.float64Milliseconds", + "encode.duration.QueryClient.float64MillisecondsWithResponse": "Encode.Duration.Query.float64Milliseconds", + "encode.duration.QueryClient.float64Seconds": "Encode.Duration.Query.float64Seconds", + "encode.duration.QueryClient.float64SecondsWithResponse": "Encode.Duration.Query.float64Seconds", + "encode.duration.QueryClient.floatMilliseconds": "Encode.Duration.Query.floatMilliseconds", + "encode.duration.QueryClient.floatMillisecondsLargerUnit": "Encode.Duration.Query.floatMillisecondsLargerUnit", + "encode.duration.QueryClient.floatMillisecondsLargerUnitWithResponse": "Encode.Duration.Query.floatMillisecondsLargerUnit", + "encode.duration.QueryClient.floatMillisecondsWithResponse": "Encode.Duration.Query.floatMilliseconds", + "encode.duration.QueryClient.floatSeconds": "Encode.Duration.Query.floatSeconds", + "encode.duration.QueryClient.floatSecondsLargerUnit": "Encode.Duration.Query.floatSecondsLargerUnit", + "encode.duration.QueryClient.floatSecondsLargerUnitWithResponse": "Encode.Duration.Query.floatSecondsLargerUnit", + "encode.duration.QueryClient.floatSecondsWithResponse": "Encode.Duration.Query.floatSeconds", + "encode.duration.QueryClient.int32Milliseconds": "Encode.Duration.Query.int32Milliseconds", + "encode.duration.QueryClient.int32MillisecondsArray": "Encode.Duration.Query.int32MillisecondsArray", + "encode.duration.QueryClient.int32MillisecondsArrayWithResponse": "Encode.Duration.Query.int32MillisecondsArray", + "encode.duration.QueryClient.int32MillisecondsLargerUnit": "Encode.Duration.Query.int32MillisecondsLargerUnit", + "encode.duration.QueryClient.int32MillisecondsLargerUnitWithResponse": "Encode.Duration.Query.int32MillisecondsLargerUnit", + "encode.duration.QueryClient.int32MillisecondsWithResponse": "Encode.Duration.Query.int32Milliseconds", + "encode.duration.QueryClient.int32Seconds": "Encode.Duration.Query.int32Seconds", + "encode.duration.QueryClient.int32SecondsArray": "Encode.Duration.Query.int32SecondsArray", + "encode.duration.QueryClient.int32SecondsArrayWithResponse": "Encode.Duration.Query.int32SecondsArray", + "encode.duration.QueryClient.int32SecondsLargerUnit": "Encode.Duration.Query.int32SecondsLargerUnit", + "encode.duration.QueryClient.int32SecondsLargerUnitWithResponse": "Encode.Duration.Query.int32SecondsLargerUnit", + "encode.duration.QueryClient.int32SecondsWithResponse": "Encode.Duration.Query.int32Seconds", + "encode.duration.QueryClient.iso8601": "Encode.Duration.Query.iso8601", + "encode.duration.QueryClient.iso8601WithResponse": "Encode.Duration.Query.iso8601", + "encode.duration.property.models.DefaultDurationProperty": "Encode.Duration.Property.DefaultDurationProperty", + "encode.duration.property.models.Float64MillisecondsDurationProperty": "Encode.Duration.Property.Float64MillisecondsDurationProperty", + "encode.duration.property.models.Float64SecondsDurationProperty": "Encode.Duration.Property.Float64SecondsDurationProperty", + "encode.duration.property.models.FloatMillisecondsDurationArrayProperty": "Encode.Duration.Property.FloatMillisecondsDurationArrayProperty", + "encode.duration.property.models.FloatMillisecondsDurationProperty": "Encode.Duration.Property.FloatMillisecondsDurationProperty", + "encode.duration.property.models.FloatMillisecondsLargerUnitDurationProperty": "Encode.Duration.Property.FloatMillisecondsLargerUnitDurationProperty", + "encode.duration.property.models.FloatSecondsDurationArrayProperty": "Encode.Duration.Property.FloatSecondsDurationArrayProperty", + "encode.duration.property.models.FloatSecondsDurationProperty": "Encode.Duration.Property.FloatSecondsDurationProperty", + "encode.duration.property.models.FloatSecondsLargerUnitDurationProperty": "Encode.Duration.Property.FloatSecondsLargerUnitDurationProperty", + "encode.duration.property.models.ISO8601DurationProperty": "Encode.Duration.Property.ISO8601DurationProperty", + "encode.duration.property.models.Int32MillisecondsDurationProperty": "Encode.Duration.Property.Int32MillisecondsDurationProperty", + "encode.duration.property.models.Int32MillisecondsLargerUnitDurationProperty": "Encode.Duration.Property.Int32MillisecondsLargerUnitDurationProperty", + "encode.duration.property.models.Int32SecondsDurationProperty": "Encode.Duration.Property.Int32SecondsDurationProperty", + "encode.duration.property.models.Int32SecondsLargerUnitDurationProperty": "Encode.Duration.Property.Int32SecondsLargerUnitDurationProperty" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_metadata.json new file mode 100644 index 00000000000..14ef5931425 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-duration_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"encode.duration.DurationClientBuilder":"Encode.Duration","encode.duration.HeaderAsyncClient":"Encode.Duration.Header","encode.duration.HeaderAsyncClient.defaultMethod":"Encode.Duration.Header.default","encode.duration.HeaderAsyncClient.defaultMethodWithResponse":"Encode.Duration.Header.default","encode.duration.HeaderAsyncClient.float64Milliseconds":"Encode.Duration.Header.float64Milliseconds","encode.duration.HeaderAsyncClient.float64MillisecondsWithResponse":"Encode.Duration.Header.float64Milliseconds","encode.duration.HeaderAsyncClient.float64Seconds":"Encode.Duration.Header.float64Seconds","encode.duration.HeaderAsyncClient.float64SecondsWithResponse":"Encode.Duration.Header.float64Seconds","encode.duration.HeaderAsyncClient.floatMilliseconds":"Encode.Duration.Header.floatMilliseconds","encode.duration.HeaderAsyncClient.floatMillisecondsLargerUnit":"Encode.Duration.Header.floatMillisecondsLargerUnit","encode.duration.HeaderAsyncClient.floatMillisecondsLargerUnitWithResponse":"Encode.Duration.Header.floatMillisecondsLargerUnit","encode.duration.HeaderAsyncClient.floatMillisecondsWithResponse":"Encode.Duration.Header.floatMilliseconds","encode.duration.HeaderAsyncClient.floatSeconds":"Encode.Duration.Header.floatSeconds","encode.duration.HeaderAsyncClient.floatSecondsLargerUnit":"Encode.Duration.Header.floatSecondsLargerUnit","encode.duration.HeaderAsyncClient.floatSecondsLargerUnitWithResponse":"Encode.Duration.Header.floatSecondsLargerUnit","encode.duration.HeaderAsyncClient.floatSecondsWithResponse":"Encode.Duration.Header.floatSeconds","encode.duration.HeaderAsyncClient.int32Milliseconds":"Encode.Duration.Header.int32Milliseconds","encode.duration.HeaderAsyncClient.int32MillisecondsArray":"Encode.Duration.Header.int32MillisecondsArray","encode.duration.HeaderAsyncClient.int32MillisecondsArrayWithResponse":"Encode.Duration.Header.int32MillisecondsArray","encode.duration.HeaderAsyncClient.int32MillisecondsLargerUnit":"Encode.Duration.Header.int32MillisecondsLargerUnit","encode.duration.HeaderAsyncClient.int32MillisecondsLargerUnitWithResponse":"Encode.Duration.Header.int32MillisecondsLargerUnit","encode.duration.HeaderAsyncClient.int32MillisecondsWithResponse":"Encode.Duration.Header.int32Milliseconds","encode.duration.HeaderAsyncClient.int32Seconds":"Encode.Duration.Header.int32Seconds","encode.duration.HeaderAsyncClient.int32SecondsLargerUnit":"Encode.Duration.Header.int32SecondsLargerUnit","encode.duration.HeaderAsyncClient.int32SecondsLargerUnitWithResponse":"Encode.Duration.Header.int32SecondsLargerUnit","encode.duration.HeaderAsyncClient.int32SecondsWithResponse":"Encode.Duration.Header.int32Seconds","encode.duration.HeaderAsyncClient.iso8601":"Encode.Duration.Header.iso8601","encode.duration.HeaderAsyncClient.iso8601Array":"Encode.Duration.Header.iso8601Array","encode.duration.HeaderAsyncClient.iso8601ArrayWithResponse":"Encode.Duration.Header.iso8601Array","encode.duration.HeaderAsyncClient.iso8601WithResponse":"Encode.Duration.Header.iso8601","encode.duration.HeaderClient":"Encode.Duration.Header","encode.duration.HeaderClient.defaultMethod":"Encode.Duration.Header.default","encode.duration.HeaderClient.defaultMethodWithResponse":"Encode.Duration.Header.default","encode.duration.HeaderClient.float64Milliseconds":"Encode.Duration.Header.float64Milliseconds","encode.duration.HeaderClient.float64MillisecondsWithResponse":"Encode.Duration.Header.float64Milliseconds","encode.duration.HeaderClient.float64Seconds":"Encode.Duration.Header.float64Seconds","encode.duration.HeaderClient.float64SecondsWithResponse":"Encode.Duration.Header.float64Seconds","encode.duration.HeaderClient.floatMilliseconds":"Encode.Duration.Header.floatMilliseconds","encode.duration.HeaderClient.floatMillisecondsLargerUnit":"Encode.Duration.Header.floatMillisecondsLargerUnit","encode.duration.HeaderClient.floatMillisecondsLargerUnitWithResponse":"Encode.Duration.Header.floatMillisecondsLargerUnit","encode.duration.HeaderClient.floatMillisecondsWithResponse":"Encode.Duration.Header.floatMilliseconds","encode.duration.HeaderClient.floatSeconds":"Encode.Duration.Header.floatSeconds","encode.duration.HeaderClient.floatSecondsLargerUnit":"Encode.Duration.Header.floatSecondsLargerUnit","encode.duration.HeaderClient.floatSecondsLargerUnitWithResponse":"Encode.Duration.Header.floatSecondsLargerUnit","encode.duration.HeaderClient.floatSecondsWithResponse":"Encode.Duration.Header.floatSeconds","encode.duration.HeaderClient.int32Milliseconds":"Encode.Duration.Header.int32Milliseconds","encode.duration.HeaderClient.int32MillisecondsArray":"Encode.Duration.Header.int32MillisecondsArray","encode.duration.HeaderClient.int32MillisecondsArrayWithResponse":"Encode.Duration.Header.int32MillisecondsArray","encode.duration.HeaderClient.int32MillisecondsLargerUnit":"Encode.Duration.Header.int32MillisecondsLargerUnit","encode.duration.HeaderClient.int32MillisecondsLargerUnitWithResponse":"Encode.Duration.Header.int32MillisecondsLargerUnit","encode.duration.HeaderClient.int32MillisecondsWithResponse":"Encode.Duration.Header.int32Milliseconds","encode.duration.HeaderClient.int32Seconds":"Encode.Duration.Header.int32Seconds","encode.duration.HeaderClient.int32SecondsLargerUnit":"Encode.Duration.Header.int32SecondsLargerUnit","encode.duration.HeaderClient.int32SecondsLargerUnitWithResponse":"Encode.Duration.Header.int32SecondsLargerUnit","encode.duration.HeaderClient.int32SecondsWithResponse":"Encode.Duration.Header.int32Seconds","encode.duration.HeaderClient.iso8601":"Encode.Duration.Header.iso8601","encode.duration.HeaderClient.iso8601Array":"Encode.Duration.Header.iso8601Array","encode.duration.HeaderClient.iso8601ArrayWithResponse":"Encode.Duration.Header.iso8601Array","encode.duration.HeaderClient.iso8601WithResponse":"Encode.Duration.Header.iso8601","encode.duration.PropertyAsyncClient":"Encode.Duration.Property","encode.duration.PropertyAsyncClient.defaultMethod":"Encode.Duration.Property.default","encode.duration.PropertyAsyncClient.defaultMethodWithResponse":"Encode.Duration.Property.default","encode.duration.PropertyAsyncClient.float64Milliseconds":"Encode.Duration.Property.float64Milliseconds","encode.duration.PropertyAsyncClient.float64MillisecondsWithResponse":"Encode.Duration.Property.float64Milliseconds","encode.duration.PropertyAsyncClient.float64Seconds":"Encode.Duration.Property.float64Seconds","encode.duration.PropertyAsyncClient.float64SecondsWithResponse":"Encode.Duration.Property.float64Seconds","encode.duration.PropertyAsyncClient.floatMilliseconds":"Encode.Duration.Property.floatMilliseconds","encode.duration.PropertyAsyncClient.floatMillisecondsArray":"Encode.Duration.Property.floatMillisecondsArray","encode.duration.PropertyAsyncClient.floatMillisecondsArrayWithResponse":"Encode.Duration.Property.floatMillisecondsArray","encode.duration.PropertyAsyncClient.floatMillisecondsLargerUnit":"Encode.Duration.Property.floatMillisecondsLargerUnit","encode.duration.PropertyAsyncClient.floatMillisecondsLargerUnitWithResponse":"Encode.Duration.Property.floatMillisecondsLargerUnit","encode.duration.PropertyAsyncClient.floatMillisecondsWithResponse":"Encode.Duration.Property.floatMilliseconds","encode.duration.PropertyAsyncClient.floatSeconds":"Encode.Duration.Property.floatSeconds","encode.duration.PropertyAsyncClient.floatSecondsArray":"Encode.Duration.Property.floatSecondsArray","encode.duration.PropertyAsyncClient.floatSecondsArrayWithResponse":"Encode.Duration.Property.floatSecondsArray","encode.duration.PropertyAsyncClient.floatSecondsLargerUnit":"Encode.Duration.Property.floatSecondsLargerUnit","encode.duration.PropertyAsyncClient.floatSecondsLargerUnitWithResponse":"Encode.Duration.Property.floatSecondsLargerUnit","encode.duration.PropertyAsyncClient.floatSecondsWithResponse":"Encode.Duration.Property.floatSeconds","encode.duration.PropertyAsyncClient.int32Milliseconds":"Encode.Duration.Property.int32Milliseconds","encode.duration.PropertyAsyncClient.int32MillisecondsLargerUnit":"Encode.Duration.Property.int32MillisecondsLargerUnit","encode.duration.PropertyAsyncClient.int32MillisecondsLargerUnitWithResponse":"Encode.Duration.Property.int32MillisecondsLargerUnit","encode.duration.PropertyAsyncClient.int32MillisecondsWithResponse":"Encode.Duration.Property.int32Milliseconds","encode.duration.PropertyAsyncClient.int32Seconds":"Encode.Duration.Property.int32Seconds","encode.duration.PropertyAsyncClient.int32SecondsLargerUnit":"Encode.Duration.Property.int32SecondsLargerUnit","encode.duration.PropertyAsyncClient.int32SecondsLargerUnitWithResponse":"Encode.Duration.Property.int32SecondsLargerUnit","encode.duration.PropertyAsyncClient.int32SecondsWithResponse":"Encode.Duration.Property.int32Seconds","encode.duration.PropertyAsyncClient.iso8601":"Encode.Duration.Property.iso8601","encode.duration.PropertyAsyncClient.iso8601WithResponse":"Encode.Duration.Property.iso8601","encode.duration.PropertyClient":"Encode.Duration.Property","encode.duration.PropertyClient.defaultMethod":"Encode.Duration.Property.default","encode.duration.PropertyClient.defaultMethodWithResponse":"Encode.Duration.Property.default","encode.duration.PropertyClient.float64Milliseconds":"Encode.Duration.Property.float64Milliseconds","encode.duration.PropertyClient.float64MillisecondsWithResponse":"Encode.Duration.Property.float64Milliseconds","encode.duration.PropertyClient.float64Seconds":"Encode.Duration.Property.float64Seconds","encode.duration.PropertyClient.float64SecondsWithResponse":"Encode.Duration.Property.float64Seconds","encode.duration.PropertyClient.floatMilliseconds":"Encode.Duration.Property.floatMilliseconds","encode.duration.PropertyClient.floatMillisecondsArray":"Encode.Duration.Property.floatMillisecondsArray","encode.duration.PropertyClient.floatMillisecondsArrayWithResponse":"Encode.Duration.Property.floatMillisecondsArray","encode.duration.PropertyClient.floatMillisecondsLargerUnit":"Encode.Duration.Property.floatMillisecondsLargerUnit","encode.duration.PropertyClient.floatMillisecondsLargerUnitWithResponse":"Encode.Duration.Property.floatMillisecondsLargerUnit","encode.duration.PropertyClient.floatMillisecondsWithResponse":"Encode.Duration.Property.floatMilliseconds","encode.duration.PropertyClient.floatSeconds":"Encode.Duration.Property.floatSeconds","encode.duration.PropertyClient.floatSecondsArray":"Encode.Duration.Property.floatSecondsArray","encode.duration.PropertyClient.floatSecondsArrayWithResponse":"Encode.Duration.Property.floatSecondsArray","encode.duration.PropertyClient.floatSecondsLargerUnit":"Encode.Duration.Property.floatSecondsLargerUnit","encode.duration.PropertyClient.floatSecondsLargerUnitWithResponse":"Encode.Duration.Property.floatSecondsLargerUnit","encode.duration.PropertyClient.floatSecondsWithResponse":"Encode.Duration.Property.floatSeconds","encode.duration.PropertyClient.int32Milliseconds":"Encode.Duration.Property.int32Milliseconds","encode.duration.PropertyClient.int32MillisecondsLargerUnit":"Encode.Duration.Property.int32MillisecondsLargerUnit","encode.duration.PropertyClient.int32MillisecondsLargerUnitWithResponse":"Encode.Duration.Property.int32MillisecondsLargerUnit","encode.duration.PropertyClient.int32MillisecondsWithResponse":"Encode.Duration.Property.int32Milliseconds","encode.duration.PropertyClient.int32Seconds":"Encode.Duration.Property.int32Seconds","encode.duration.PropertyClient.int32SecondsLargerUnit":"Encode.Duration.Property.int32SecondsLargerUnit","encode.duration.PropertyClient.int32SecondsLargerUnitWithResponse":"Encode.Duration.Property.int32SecondsLargerUnit","encode.duration.PropertyClient.int32SecondsWithResponse":"Encode.Duration.Property.int32Seconds","encode.duration.PropertyClient.iso8601":"Encode.Duration.Property.iso8601","encode.duration.PropertyClient.iso8601WithResponse":"Encode.Duration.Property.iso8601","encode.duration.QueryAsyncClient":"Encode.Duration.Query","encode.duration.QueryAsyncClient.defaultMethod":"Encode.Duration.Query.default","encode.duration.QueryAsyncClient.defaultMethodWithResponse":"Encode.Duration.Query.default","encode.duration.QueryAsyncClient.float64Milliseconds":"Encode.Duration.Query.float64Milliseconds","encode.duration.QueryAsyncClient.float64MillisecondsWithResponse":"Encode.Duration.Query.float64Milliseconds","encode.duration.QueryAsyncClient.float64Seconds":"Encode.Duration.Query.float64Seconds","encode.duration.QueryAsyncClient.float64SecondsWithResponse":"Encode.Duration.Query.float64Seconds","encode.duration.QueryAsyncClient.floatMilliseconds":"Encode.Duration.Query.floatMilliseconds","encode.duration.QueryAsyncClient.floatMillisecondsLargerUnit":"Encode.Duration.Query.floatMillisecondsLargerUnit","encode.duration.QueryAsyncClient.floatMillisecondsLargerUnitWithResponse":"Encode.Duration.Query.floatMillisecondsLargerUnit","encode.duration.QueryAsyncClient.floatMillisecondsWithResponse":"Encode.Duration.Query.floatMilliseconds","encode.duration.QueryAsyncClient.floatSeconds":"Encode.Duration.Query.floatSeconds","encode.duration.QueryAsyncClient.floatSecondsLargerUnit":"Encode.Duration.Query.floatSecondsLargerUnit","encode.duration.QueryAsyncClient.floatSecondsLargerUnitWithResponse":"Encode.Duration.Query.floatSecondsLargerUnit","encode.duration.QueryAsyncClient.floatSecondsWithResponse":"Encode.Duration.Query.floatSeconds","encode.duration.QueryAsyncClient.int32Milliseconds":"Encode.Duration.Query.int32Milliseconds","encode.duration.QueryAsyncClient.int32MillisecondsArray":"Encode.Duration.Query.int32MillisecondsArray","encode.duration.QueryAsyncClient.int32MillisecondsArrayWithResponse":"Encode.Duration.Query.int32MillisecondsArray","encode.duration.QueryAsyncClient.int32MillisecondsLargerUnit":"Encode.Duration.Query.int32MillisecondsLargerUnit","encode.duration.QueryAsyncClient.int32MillisecondsLargerUnitWithResponse":"Encode.Duration.Query.int32MillisecondsLargerUnit","encode.duration.QueryAsyncClient.int32MillisecondsWithResponse":"Encode.Duration.Query.int32Milliseconds","encode.duration.QueryAsyncClient.int32Seconds":"Encode.Duration.Query.int32Seconds","encode.duration.QueryAsyncClient.int32SecondsArray":"Encode.Duration.Query.int32SecondsArray","encode.duration.QueryAsyncClient.int32SecondsArrayWithResponse":"Encode.Duration.Query.int32SecondsArray","encode.duration.QueryAsyncClient.int32SecondsLargerUnit":"Encode.Duration.Query.int32SecondsLargerUnit","encode.duration.QueryAsyncClient.int32SecondsLargerUnitWithResponse":"Encode.Duration.Query.int32SecondsLargerUnit","encode.duration.QueryAsyncClient.int32SecondsWithResponse":"Encode.Duration.Query.int32Seconds","encode.duration.QueryAsyncClient.iso8601":"Encode.Duration.Query.iso8601","encode.duration.QueryAsyncClient.iso8601WithResponse":"Encode.Duration.Query.iso8601","encode.duration.QueryClient":"Encode.Duration.Query","encode.duration.QueryClient.defaultMethod":"Encode.Duration.Query.default","encode.duration.QueryClient.defaultMethodWithResponse":"Encode.Duration.Query.default","encode.duration.QueryClient.float64Milliseconds":"Encode.Duration.Query.float64Milliseconds","encode.duration.QueryClient.float64MillisecondsWithResponse":"Encode.Duration.Query.float64Milliseconds","encode.duration.QueryClient.float64Seconds":"Encode.Duration.Query.float64Seconds","encode.duration.QueryClient.float64SecondsWithResponse":"Encode.Duration.Query.float64Seconds","encode.duration.QueryClient.floatMilliseconds":"Encode.Duration.Query.floatMilliseconds","encode.duration.QueryClient.floatMillisecondsLargerUnit":"Encode.Duration.Query.floatMillisecondsLargerUnit","encode.duration.QueryClient.floatMillisecondsLargerUnitWithResponse":"Encode.Duration.Query.floatMillisecondsLargerUnit","encode.duration.QueryClient.floatMillisecondsWithResponse":"Encode.Duration.Query.floatMilliseconds","encode.duration.QueryClient.floatSeconds":"Encode.Duration.Query.floatSeconds","encode.duration.QueryClient.floatSecondsLargerUnit":"Encode.Duration.Query.floatSecondsLargerUnit","encode.duration.QueryClient.floatSecondsLargerUnitWithResponse":"Encode.Duration.Query.floatSecondsLargerUnit","encode.duration.QueryClient.floatSecondsWithResponse":"Encode.Duration.Query.floatSeconds","encode.duration.QueryClient.int32Milliseconds":"Encode.Duration.Query.int32Milliseconds","encode.duration.QueryClient.int32MillisecondsArray":"Encode.Duration.Query.int32MillisecondsArray","encode.duration.QueryClient.int32MillisecondsArrayWithResponse":"Encode.Duration.Query.int32MillisecondsArray","encode.duration.QueryClient.int32MillisecondsLargerUnit":"Encode.Duration.Query.int32MillisecondsLargerUnit","encode.duration.QueryClient.int32MillisecondsLargerUnitWithResponse":"Encode.Duration.Query.int32MillisecondsLargerUnit","encode.duration.QueryClient.int32MillisecondsWithResponse":"Encode.Duration.Query.int32Milliseconds","encode.duration.QueryClient.int32Seconds":"Encode.Duration.Query.int32Seconds","encode.duration.QueryClient.int32SecondsArray":"Encode.Duration.Query.int32SecondsArray","encode.duration.QueryClient.int32SecondsArrayWithResponse":"Encode.Duration.Query.int32SecondsArray","encode.duration.QueryClient.int32SecondsLargerUnit":"Encode.Duration.Query.int32SecondsLargerUnit","encode.duration.QueryClient.int32SecondsLargerUnitWithResponse":"Encode.Duration.Query.int32SecondsLargerUnit","encode.duration.QueryClient.int32SecondsWithResponse":"Encode.Duration.Query.int32Seconds","encode.duration.QueryClient.iso8601":"Encode.Duration.Query.iso8601","encode.duration.QueryClient.iso8601WithResponse":"Encode.Duration.Query.iso8601","encode.duration.property.models.DefaultDurationProperty":"Encode.Duration.Property.DefaultDurationProperty","encode.duration.property.models.Float64MillisecondsDurationProperty":"Encode.Duration.Property.Float64MillisecondsDurationProperty","encode.duration.property.models.Float64SecondsDurationProperty":"Encode.Duration.Property.Float64SecondsDurationProperty","encode.duration.property.models.FloatMillisecondsDurationArrayProperty":"Encode.Duration.Property.FloatMillisecondsDurationArrayProperty","encode.duration.property.models.FloatMillisecondsDurationProperty":"Encode.Duration.Property.FloatMillisecondsDurationProperty","encode.duration.property.models.FloatMillisecondsLargerUnitDurationProperty":"Encode.Duration.Property.FloatMillisecondsLargerUnitDurationProperty","encode.duration.property.models.FloatSecondsDurationArrayProperty":"Encode.Duration.Property.FloatSecondsDurationArrayProperty","encode.duration.property.models.FloatSecondsDurationProperty":"Encode.Duration.Property.FloatSecondsDurationProperty","encode.duration.property.models.FloatSecondsLargerUnitDurationProperty":"Encode.Duration.Property.FloatSecondsLargerUnitDurationProperty","encode.duration.property.models.ISO8601DurationProperty":"Encode.Duration.Property.ISO8601DurationProperty","encode.duration.property.models.Int32MillisecondsDurationProperty":"Encode.Duration.Property.Int32MillisecondsDurationProperty","encode.duration.property.models.Int32MillisecondsLargerUnitDurationProperty":"Encode.Duration.Property.Int32MillisecondsLargerUnitDurationProperty","encode.duration.property.models.Int32SecondsDurationProperty":"Encode.Duration.Property.Int32SecondsDurationProperty","encode.duration.property.models.Int32SecondsLargerUnitDurationProperty":"Encode.Duration.Property.Int32SecondsLargerUnitDurationProperty"},"generatedFiles":["src/main/java/encode/duration/DurationClientBuilder.java","src/main/java/encode/duration/HeaderAsyncClient.java","src/main/java/encode/duration/HeaderClient.java","src/main/java/encode/duration/PropertyAsyncClient.java","src/main/java/encode/duration/PropertyClient.java","src/main/java/encode/duration/QueryAsyncClient.java","src/main/java/encode/duration/QueryClient.java","src/main/java/encode/duration/implementation/DurationClientImpl.java","src/main/java/encode/duration/implementation/HeadersImpl.java","src/main/java/encode/duration/implementation/PropertiesImpl.java","src/main/java/encode/duration/implementation/QueriesImpl.java","src/main/java/encode/duration/implementation/package-info.java","src/main/java/encode/duration/package-info.java","src/main/java/encode/duration/property/models/DefaultDurationProperty.java","src/main/java/encode/duration/property/models/Float64MillisecondsDurationProperty.java","src/main/java/encode/duration/property/models/Float64SecondsDurationProperty.java","src/main/java/encode/duration/property/models/FloatMillisecondsDurationArrayProperty.java","src/main/java/encode/duration/property/models/FloatMillisecondsDurationProperty.java","src/main/java/encode/duration/property/models/FloatMillisecondsLargerUnitDurationProperty.java","src/main/java/encode/duration/property/models/FloatSecondsDurationArrayProperty.java","src/main/java/encode/duration/property/models/FloatSecondsDurationProperty.java","src/main/java/encode/duration/property/models/FloatSecondsLargerUnitDurationProperty.java","src/main/java/encode/duration/property/models/ISO8601DurationProperty.java","src/main/java/encode/duration/property/models/Int32MillisecondsDurationProperty.java","src/main/java/encode/duration/property/models/Int32MillisecondsLargerUnitDurationProperty.java","src/main/java/encode/duration/property/models/Int32SecondsDurationProperty.java","src/main/java/encode/duration/property/models/Int32SecondsLargerUnitDurationProperty.java","src/main/java/encode/duration/property/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_apiview_properties.json new file mode 100644 index 00000000000..33f149d361d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_apiview_properties.json @@ -0,0 +1,23 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "encode.numeric.NumericAsyncClient": "Encode.Numeric.Property", + "encode.numeric.NumericAsyncClient.safeintAsString": "Encode.Numeric.Property.safeintAsString", + "encode.numeric.NumericAsyncClient.safeintAsStringWithResponse": "Encode.Numeric.Property.safeintAsString", + "encode.numeric.NumericAsyncClient.uint32AsStringOptional": "Encode.Numeric.Property.uint32AsStringOptional", + "encode.numeric.NumericAsyncClient.uint32AsStringOptionalWithResponse": "Encode.Numeric.Property.uint32AsStringOptional", + "encode.numeric.NumericAsyncClient.uint8AsString": "Encode.Numeric.Property.uint8AsString", + "encode.numeric.NumericAsyncClient.uint8AsStringWithResponse": "Encode.Numeric.Property.uint8AsString", + "encode.numeric.NumericClient": "Encode.Numeric.Property", + "encode.numeric.NumericClient.safeintAsString": "Encode.Numeric.Property.safeintAsString", + "encode.numeric.NumericClient.safeintAsStringWithResponse": "Encode.Numeric.Property.safeintAsString", + "encode.numeric.NumericClient.uint32AsStringOptional": "Encode.Numeric.Property.uint32AsStringOptional", + "encode.numeric.NumericClient.uint32AsStringOptionalWithResponse": "Encode.Numeric.Property.uint32AsStringOptional", + "encode.numeric.NumericClient.uint8AsString": "Encode.Numeric.Property.uint8AsString", + "encode.numeric.NumericClient.uint8AsStringWithResponse": "Encode.Numeric.Property.uint8AsString", + "encode.numeric.NumericClientBuilder": "Encode.Numeric", + "encode.numeric.property.models.SafeintAsStringProperty": "Encode.Numeric.Property.SafeintAsStringProperty", + "encode.numeric.property.models.Uint32AsStringProperty": "Encode.Numeric.Property.Uint32AsStringProperty", + "encode.numeric.property.models.Uint8AsStringProperty": "Encode.Numeric.Property.Uint8AsStringProperty" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_metadata.json new file mode 100644 index 00000000000..8db4b2db574 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/encode-numeric_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"encode.numeric.NumericAsyncClient":"Encode.Numeric.Property","encode.numeric.NumericAsyncClient.safeintAsString":"Encode.Numeric.Property.safeintAsString","encode.numeric.NumericAsyncClient.safeintAsStringWithResponse":"Encode.Numeric.Property.safeintAsString","encode.numeric.NumericAsyncClient.uint32AsStringOptional":"Encode.Numeric.Property.uint32AsStringOptional","encode.numeric.NumericAsyncClient.uint32AsStringOptionalWithResponse":"Encode.Numeric.Property.uint32AsStringOptional","encode.numeric.NumericAsyncClient.uint8AsString":"Encode.Numeric.Property.uint8AsString","encode.numeric.NumericAsyncClient.uint8AsStringWithResponse":"Encode.Numeric.Property.uint8AsString","encode.numeric.NumericClient":"Encode.Numeric.Property","encode.numeric.NumericClient.safeintAsString":"Encode.Numeric.Property.safeintAsString","encode.numeric.NumericClient.safeintAsStringWithResponse":"Encode.Numeric.Property.safeintAsString","encode.numeric.NumericClient.uint32AsStringOptional":"Encode.Numeric.Property.uint32AsStringOptional","encode.numeric.NumericClient.uint32AsStringOptionalWithResponse":"Encode.Numeric.Property.uint32AsStringOptional","encode.numeric.NumericClient.uint8AsString":"Encode.Numeric.Property.uint8AsString","encode.numeric.NumericClient.uint8AsStringWithResponse":"Encode.Numeric.Property.uint8AsString","encode.numeric.NumericClientBuilder":"Encode.Numeric","encode.numeric.property.models.SafeintAsStringProperty":"Encode.Numeric.Property.SafeintAsStringProperty","encode.numeric.property.models.Uint32AsStringProperty":"Encode.Numeric.Property.Uint32AsStringProperty","encode.numeric.property.models.Uint8AsStringProperty":"Encode.Numeric.Property.Uint8AsStringProperty"},"generatedFiles":["src/main/java/encode/numeric/NumericAsyncClient.java","src/main/java/encode/numeric/NumericClient.java","src/main/java/encode/numeric/NumericClientBuilder.java","src/main/java/encode/numeric/implementation/NumericClientImpl.java","src/main/java/encode/numeric/implementation/PropertiesImpl.java","src/main/java/encode/numeric/implementation/package-info.java","src/main/java/encode/numeric/package-info.java","src/main/java/encode/numeric/property/models/SafeintAsStringProperty.java","src/main/java/encode/numeric/property/models/Uint32AsStringProperty.java","src/main/java/encode/numeric/property/models/Uint8AsStringProperty.java","src/main/java/encode/numeric/property/models/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/proxy-config.json new file mode 100644 index 00000000000..0160328f55f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/proxy-config.json @@ -0,0 +1 @@ +[["tsptest.armstreamstyleserialization.implementation.FishesClientImpl$FishesService"],["tsptest.armstreamstyleserialization.implementation.FunctionsClientImpl$FunctionsService"],["tsptest.armstreamstyleserialization.implementation.ItemsClientImpl$ItemsService"],["tsptest.armstreamstyleserialization.implementation.PrioritiesClientImpl$PrioritiesService"],["tsptest.armstreamstyleserialization.implementation.TopLevelArmResourcesClientImpl$TopLevelArmResourcesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/reflect-config.json new file mode 100644 index 00000000000..04b770df5e9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/armstreamstyleserialization-generated/reflect-config.json @@ -0,0 +1 @@ +[{"name":"tsptest.armstreamstyleserialization.models.Error","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true},{"name":"tsptest.armstreamstyleserialization.models.ErrorException","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true},{"name":"tsptest.armstreamstyleserialization.models.ErrorMin","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true},{"name":"tsptest.armstreamstyleserialization.models.ErrorMinException","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true}] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/proxy-config.json new file mode 100644 index 00000000000..cb9419fe3c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/proxy-config.json @@ -0,0 +1 @@ +[["tsptest.armcustomization.implementation.VaultsClientImpl$VaultsService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/reflect-config.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armcustomization-generated/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/proxy-config.json new file mode 100644 index 00000000000..14dc57b73cb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/proxy-config.json @@ -0,0 +1 @@ +[["tsptest.armlegacy.implementation.SkusClientImpl$SkusService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/reflect-config.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armlegacy-generated/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/proxy-config.json new file mode 100644 index 00000000000..5c06442deb0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/proxy-config.json @@ -0,0 +1 @@ +[["tsptest.armresourceprovider.implementation.ChildExtensionResourceInterfacesClientImpl$ChildExtensionResourceInterfacesService"],["tsptest.armresourceprovider.implementation.ChildResourcesInterfacesClientImpl$ChildResourcesInterfacesService"],["tsptest.armresourceprovider.implementation.CustomTemplateResourceInterfacesClientImpl$CustomTemplateResourceInterfacesService"],["tsptest.armresourceprovider.implementation.ImmutableResourceModelsClientImpl$ImmutableResourceModelsService"],["tsptest.armresourceprovider.implementation.LroNoBodiesClientImpl$LroNoBodiesService"],["tsptest.armresourceprovider.implementation.ManagedMaintenanceWindowStatusOperationsClientImpl$ManagedMaintenanceWindowStatusOperationsService"],["tsptest.armresourceprovider.implementation.ModelInterfaceSameNamesClientImpl$ModelInterfaceSameNamesService"],["tsptest.armresourceprovider.implementation.OperationsClientImpl$OperationsService"],["tsptest.armresourceprovider.implementation.TopLevelArmResourceInterfacesClientImpl$TopLevelArmResourceInterfacesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/reflect-config.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armresourceprovider-generated/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/proxy-config.json new file mode 100644 index 00000000000..12fd27ce30c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/proxy-config.json @@ -0,0 +1 @@ +[["tsptest.armversioned.implementation.TopLevelArmResourcesClientImpl$TopLevelArmResourcesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/reflect-config.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-armversioned-generated/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/proxy-config.json new file mode 100644 index 00000000000..425f1c93bd9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/proxy-config.json @@ -0,0 +1 @@ +[["azure.resourcemanager.multiservice.combined.implementation.DisksClientImpl$DisksService"],["azure.resourcemanager.multiservice.combined.implementation.VirtualMachinesClientImpl$VirtualMachinesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/reflect-config.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-combined-generated/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/proxy-config.json new file mode 100644 index 00000000000..cdd07e3847c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/proxy-config.json @@ -0,0 +1 @@ +[["azure.resourcemanager.commonproperties.implementation.ErrorsClientImpl$ErrorsService"],["azure.resourcemanager.commonproperties.implementation.ManagedIdentitiesClientImpl$ManagedIdentitiesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/reflect-config.json new file mode 100644 index 00000000000..a1c7b24fb3e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-commonproperties-generated/reflect-config.json @@ -0,0 +1 @@ +[{"name":"azure.resourcemanager.commonproperties.models.ApiError","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true},{"name":"azure.resourcemanager.commonproperties.models.ApiErrorException","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true},{"name":"azure.resourcemanager.commonproperties.models.InnerError","allDeclaredConstructors":true,"allDeclaredFields":true,"allDeclaredMethods":true}] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/proxy-config.json new file mode 100644 index 00000000000..3210cb4cd07 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/proxy-config.json @@ -0,0 +1 @@ +[["azure.resourcemanager.largeheader.implementation.LargeHeadersClientImpl$LargeHeadersService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/reflect-config.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-largeheader-generated/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/proxy-config.json new file mode 100644 index 00000000000..1455274376c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/proxy-config.json @@ -0,0 +1 @@ +[["azure.resourcemanager.methodsubscriptionid.implementation.MixedSubscriptionPlacementResourceGroupResourceOperationsClientImpl$MixedSubscriptionPlacementResourceGroupResourceOperationsService"],["azure.resourcemanager.methodsubscriptionid.implementation.MixedSubscriptionPlacementSubscriptionResourceOperationsClientImpl$MixedSubscriptionPlacementSubscriptionResourceOperationsService"],["azure.resourcemanager.methodsubscriptionid.implementation.OperationsClientImpl$OperationsService"],["azure.resourcemanager.methodsubscriptionid.implementation.TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsClientImpl$TwoSubscriptionResourcesMethodLevelSubscriptionResource1OperationsService"],["azure.resourcemanager.methodsubscriptionid.implementation.TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsClientImpl$TwoSubscriptionResourcesMethodLevelSubscriptionResource2OperationsService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/reflect-config.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-methodsubscriptionid-generated/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/proxy-config.json new file mode 100644 index 00000000000..0c77726d610 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/proxy-config.json @@ -0,0 +1 @@ +[["azure.resourcemanager.nonresource.implementation.NonResourceOperationsClientImpl$NonResourceOperationsService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/reflect-config.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-nonresource-generated/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/proxy-config.json new file mode 100644 index 00000000000..8d7e9644d75 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/proxy-config.json @@ -0,0 +1 @@ +[["azure.resourcemanager.operationtemplates.implementation.CheckNameAvailabilitiesClientImpl$CheckNameAvailabilitiesService"],["azure.resourcemanager.operationtemplates.implementation.LroesClientImpl$LroesService"],["azure.resourcemanager.operationtemplates.implementation.OperationsClientImpl$OperationsService"],["azure.resourcemanager.operationtemplates.implementation.OptionalBodiesClientImpl$OptionalBodiesService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/reflect-config.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-operationtemplates-generated/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/proxy-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/proxy-config.json new file mode 100644 index 00000000000..e9a02cb07be --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/proxy-config.json @@ -0,0 +1 @@ +[["azure.resourcemanager.resources.implementation.ExtensionsResourcesClientImpl$ExtensionsResourcesService"],["azure.resourcemanager.resources.implementation.LocationResourcesClientImpl$LocationResourcesService"],["azure.resourcemanager.resources.implementation.NestedsClientImpl$NestedsService"],["azure.resourcemanager.resources.implementation.SingletonsClientImpl$SingletonsService"],["azure.resourcemanager.resources.implementation.TopLevelsClientImpl$TopLevelsService"]] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/reflect-config.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/reflect-config.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-resources-generated/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_apiview_properties.json new file mode 100644 index 00000000000..f6f9142402b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_apiview_properties.json @@ -0,0 +1,20 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "parameters.basic.BasicClientBuilder": "Parameters.Basic", + "parameters.basic.ExplicitBodyAsyncClient": "Parameters.Basic.ExplicitBody", + "parameters.basic.ExplicitBodyAsyncClient.simple": "Parameters.Basic.ExplicitBody.simple", + "parameters.basic.ExplicitBodyAsyncClient.simpleWithResponse": "Parameters.Basic.ExplicitBody.simple", + "parameters.basic.ExplicitBodyClient": "Parameters.Basic.ExplicitBody", + "parameters.basic.ExplicitBodyClient.simple": "Parameters.Basic.ExplicitBody.simple", + "parameters.basic.ExplicitBodyClient.simpleWithResponse": "Parameters.Basic.ExplicitBody.simple", + "parameters.basic.ImplicitBodyAsyncClient": "Parameters.Basic.ImplicitBody", + "parameters.basic.ImplicitBodyAsyncClient.simple": "Parameters.Basic.ImplicitBody.simple", + "parameters.basic.ImplicitBodyAsyncClient.simpleWithResponse": "Parameters.Basic.ImplicitBody.simple", + "parameters.basic.ImplicitBodyClient": "Parameters.Basic.ImplicitBody", + "parameters.basic.ImplicitBodyClient.simple": "Parameters.Basic.ImplicitBody.simple", + "parameters.basic.ImplicitBodyClient.simpleWithResponse": "Parameters.Basic.ImplicitBody.simple", + "parameters.basic.explicitbody.models.User": "Parameters.Basic.ExplicitBody.User", + "parameters.basic.implicitbody.implementation.models.SimpleRequest": "Parameters.Basic.ImplicitBody.simple.Request.anonymous" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_metadata.json new file mode 100644 index 00000000000..3a597d991b9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-basic_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"parameters.basic.BasicClientBuilder":"Parameters.Basic","parameters.basic.ExplicitBodyAsyncClient":"Parameters.Basic.ExplicitBody","parameters.basic.ExplicitBodyAsyncClient.simple":"Parameters.Basic.ExplicitBody.simple","parameters.basic.ExplicitBodyAsyncClient.simpleWithResponse":"Parameters.Basic.ExplicitBody.simple","parameters.basic.ExplicitBodyClient":"Parameters.Basic.ExplicitBody","parameters.basic.ExplicitBodyClient.simple":"Parameters.Basic.ExplicitBody.simple","parameters.basic.ExplicitBodyClient.simpleWithResponse":"Parameters.Basic.ExplicitBody.simple","parameters.basic.ImplicitBodyAsyncClient":"Parameters.Basic.ImplicitBody","parameters.basic.ImplicitBodyAsyncClient.simple":"Parameters.Basic.ImplicitBody.simple","parameters.basic.ImplicitBodyAsyncClient.simpleWithResponse":"Parameters.Basic.ImplicitBody.simple","parameters.basic.ImplicitBodyClient":"Parameters.Basic.ImplicitBody","parameters.basic.ImplicitBodyClient.simple":"Parameters.Basic.ImplicitBody.simple","parameters.basic.ImplicitBodyClient.simpleWithResponse":"Parameters.Basic.ImplicitBody.simple","parameters.basic.explicitbody.models.User":"Parameters.Basic.ExplicitBody.User","parameters.basic.implicitbody.implementation.models.SimpleRequest":"Parameters.Basic.ImplicitBody.simple.Request.anonymous"},"generatedFiles":["src/main/java/module-info.java","src/main/java/parameters/basic/BasicClientBuilder.java","src/main/java/parameters/basic/ExplicitBodyAsyncClient.java","src/main/java/parameters/basic/ExplicitBodyClient.java","src/main/java/parameters/basic/ImplicitBodyAsyncClient.java","src/main/java/parameters/basic/ImplicitBodyClient.java","src/main/java/parameters/basic/explicitbody/models/User.java","src/main/java/parameters/basic/explicitbody/models/package-info.java","src/main/java/parameters/basic/implementation/BasicClientImpl.java","src/main/java/parameters/basic/implementation/ExplicitBodiesImpl.java","src/main/java/parameters/basic/implementation/ImplicitBodiesImpl.java","src/main/java/parameters/basic/implementation/package-info.java","src/main/java/parameters/basic/implicitbody/implementation/models/SimpleRequest.java","src/main/java/parameters/basic/implicitbody/implementation/models/package-info.java","src/main/java/parameters/basic/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_apiview_properties.json new file mode 100644 index 00000000000..36ee4a51333 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_apiview_properties.json @@ -0,0 +1,27 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "parameters.bodyoptionality.BodyOptionalityAsyncClient": "Parameters.BodyOptionality", + "parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredExplicit": "Parameters.BodyOptionality.requiredExplicit", + "parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredExplicitWithResponse": "Parameters.BodyOptionality.requiredExplicit", + "parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredImplicit": "Parameters.BodyOptionality.requiredImplicit", + "parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredImplicitWithResponse": "Parameters.BodyOptionality.requiredImplicit", + "parameters.bodyoptionality.BodyOptionalityClient": "Parameters.BodyOptionality", + "parameters.bodyoptionality.BodyOptionalityClient.requiredExplicit": "Parameters.BodyOptionality.requiredExplicit", + "parameters.bodyoptionality.BodyOptionalityClient.requiredExplicitWithResponse": "Parameters.BodyOptionality.requiredExplicit", + "parameters.bodyoptionality.BodyOptionalityClient.requiredImplicit": "Parameters.BodyOptionality.requiredImplicit", + "parameters.bodyoptionality.BodyOptionalityClient.requiredImplicitWithResponse": "Parameters.BodyOptionality.requiredImplicit", + "parameters.bodyoptionality.BodyOptionalityClientBuilder": "Parameters.BodyOptionality", + "parameters.bodyoptionality.OptionalExplicitAsyncClient": "Parameters.BodyOptionality.OptionalExplicit", + "parameters.bodyoptionality.OptionalExplicitAsyncClient.omit": "Parameters.BodyOptionality.OptionalExplicit.omit", + "parameters.bodyoptionality.OptionalExplicitAsyncClient.omitWithResponse": "Parameters.BodyOptionality.OptionalExplicit.omit", + "parameters.bodyoptionality.OptionalExplicitAsyncClient.set": "Parameters.BodyOptionality.OptionalExplicit.set", + "parameters.bodyoptionality.OptionalExplicitAsyncClient.setWithResponse": "Parameters.BodyOptionality.OptionalExplicit.set", + "parameters.bodyoptionality.OptionalExplicitClient": "Parameters.BodyOptionality.OptionalExplicit", + "parameters.bodyoptionality.OptionalExplicitClient.omit": "Parameters.BodyOptionality.OptionalExplicit.omit", + "parameters.bodyoptionality.OptionalExplicitClient.omitWithResponse": "Parameters.BodyOptionality.OptionalExplicit.omit", + "parameters.bodyoptionality.OptionalExplicitClient.set": "Parameters.BodyOptionality.OptionalExplicit.set", + "parameters.bodyoptionality.OptionalExplicitClient.setWithResponse": "Parameters.BodyOptionality.OptionalExplicit.set", + "parameters.bodyoptionality.models.BodyModel": "Parameters.BodyOptionality.BodyModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_metadata.json new file mode 100644 index 00000000000..4b8826c036a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-bodyoptionality_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"parameters.bodyoptionality.BodyOptionalityAsyncClient":"Parameters.BodyOptionality","parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredExplicit":"Parameters.BodyOptionality.requiredExplicit","parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredExplicitWithResponse":"Parameters.BodyOptionality.requiredExplicit","parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredImplicit":"Parameters.BodyOptionality.requiredImplicit","parameters.bodyoptionality.BodyOptionalityAsyncClient.requiredImplicitWithResponse":"Parameters.BodyOptionality.requiredImplicit","parameters.bodyoptionality.BodyOptionalityClient":"Parameters.BodyOptionality","parameters.bodyoptionality.BodyOptionalityClient.requiredExplicit":"Parameters.BodyOptionality.requiredExplicit","parameters.bodyoptionality.BodyOptionalityClient.requiredExplicitWithResponse":"Parameters.BodyOptionality.requiredExplicit","parameters.bodyoptionality.BodyOptionalityClient.requiredImplicit":"Parameters.BodyOptionality.requiredImplicit","parameters.bodyoptionality.BodyOptionalityClient.requiredImplicitWithResponse":"Parameters.BodyOptionality.requiredImplicit","parameters.bodyoptionality.BodyOptionalityClientBuilder":"Parameters.BodyOptionality","parameters.bodyoptionality.OptionalExplicitAsyncClient":"Parameters.BodyOptionality.OptionalExplicit","parameters.bodyoptionality.OptionalExplicitAsyncClient.omit":"Parameters.BodyOptionality.OptionalExplicit.omit","parameters.bodyoptionality.OptionalExplicitAsyncClient.omitWithResponse":"Parameters.BodyOptionality.OptionalExplicit.omit","parameters.bodyoptionality.OptionalExplicitAsyncClient.set":"Parameters.BodyOptionality.OptionalExplicit.set","parameters.bodyoptionality.OptionalExplicitAsyncClient.setWithResponse":"Parameters.BodyOptionality.OptionalExplicit.set","parameters.bodyoptionality.OptionalExplicitClient":"Parameters.BodyOptionality.OptionalExplicit","parameters.bodyoptionality.OptionalExplicitClient.omit":"Parameters.BodyOptionality.OptionalExplicit.omit","parameters.bodyoptionality.OptionalExplicitClient.omitWithResponse":"Parameters.BodyOptionality.OptionalExplicit.omit","parameters.bodyoptionality.OptionalExplicitClient.set":"Parameters.BodyOptionality.OptionalExplicit.set","parameters.bodyoptionality.OptionalExplicitClient.setWithResponse":"Parameters.BodyOptionality.OptionalExplicit.set","parameters.bodyoptionality.models.BodyModel":"Parameters.BodyOptionality.BodyModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/parameters/bodyoptionality/BodyOptionalityAsyncClient.java","src/main/java/parameters/bodyoptionality/BodyOptionalityClient.java","src/main/java/parameters/bodyoptionality/BodyOptionalityClientBuilder.java","src/main/java/parameters/bodyoptionality/OptionalExplicitAsyncClient.java","src/main/java/parameters/bodyoptionality/OptionalExplicitClient.java","src/main/java/parameters/bodyoptionality/implementation/BodyOptionalityClientImpl.java","src/main/java/parameters/bodyoptionality/implementation/OptionalExplicitsImpl.java","src/main/java/parameters/bodyoptionality/implementation/package-info.java","src/main/java/parameters/bodyoptionality/models/BodyModel.java","src/main/java/parameters/bodyoptionality/models/package-info.java","src/main/java/parameters/bodyoptionality/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_apiview_properties.json new file mode 100644 index 00000000000..22010c897f1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_apiview_properties.json @@ -0,0 +1,30 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "parameters.collectionformat.CollectionFormatClientBuilder": "Parameters.CollectionFormat", + "parameters.collectionformat.HeaderAsyncClient": "Parameters.CollectionFormat.Header", + "parameters.collectionformat.HeaderAsyncClient.csv": "Parameters.CollectionFormat.Header.csv", + "parameters.collectionformat.HeaderAsyncClient.csvWithResponse": "Parameters.CollectionFormat.Header.csv", + "parameters.collectionformat.HeaderClient": "Parameters.CollectionFormat.Header", + "parameters.collectionformat.HeaderClient.csv": "Parameters.CollectionFormat.Header.csv", + "parameters.collectionformat.HeaderClient.csvWithResponse": "Parameters.CollectionFormat.Header.csv", + "parameters.collectionformat.QueryAsyncClient": "Parameters.CollectionFormat.Query", + "parameters.collectionformat.QueryAsyncClient.csv": "Parameters.CollectionFormat.Query.csv", + "parameters.collectionformat.QueryAsyncClient.csvWithResponse": "Parameters.CollectionFormat.Query.csv", + "parameters.collectionformat.QueryAsyncClient.multi": "Parameters.CollectionFormat.Query.multi", + "parameters.collectionformat.QueryAsyncClient.multiWithResponse": "Parameters.CollectionFormat.Query.multi", + "parameters.collectionformat.QueryAsyncClient.pipes": "Parameters.CollectionFormat.Query.pipes", + "parameters.collectionformat.QueryAsyncClient.pipesWithResponse": "Parameters.CollectionFormat.Query.pipes", + "parameters.collectionformat.QueryAsyncClient.ssv": "Parameters.CollectionFormat.Query.ssv", + "parameters.collectionformat.QueryAsyncClient.ssvWithResponse": "Parameters.CollectionFormat.Query.ssv", + "parameters.collectionformat.QueryClient": "Parameters.CollectionFormat.Query", + "parameters.collectionformat.QueryClient.csv": "Parameters.CollectionFormat.Query.csv", + "parameters.collectionformat.QueryClient.csvWithResponse": "Parameters.CollectionFormat.Query.csv", + "parameters.collectionformat.QueryClient.multi": "Parameters.CollectionFormat.Query.multi", + "parameters.collectionformat.QueryClient.multiWithResponse": "Parameters.CollectionFormat.Query.multi", + "parameters.collectionformat.QueryClient.pipes": "Parameters.CollectionFormat.Query.pipes", + "parameters.collectionformat.QueryClient.pipesWithResponse": "Parameters.CollectionFormat.Query.pipes", + "parameters.collectionformat.QueryClient.ssv": "Parameters.CollectionFormat.Query.ssv", + "parameters.collectionformat.QueryClient.ssvWithResponse": "Parameters.CollectionFormat.Query.ssv" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_metadata.json new file mode 100644 index 00000000000..e105e86b5f3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-collectionformat_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"parameters.collectionformat.CollectionFormatClientBuilder":"Parameters.CollectionFormat","parameters.collectionformat.HeaderAsyncClient":"Parameters.CollectionFormat.Header","parameters.collectionformat.HeaderAsyncClient.csv":"Parameters.CollectionFormat.Header.csv","parameters.collectionformat.HeaderAsyncClient.csvWithResponse":"Parameters.CollectionFormat.Header.csv","parameters.collectionformat.HeaderClient":"Parameters.CollectionFormat.Header","parameters.collectionformat.HeaderClient.csv":"Parameters.CollectionFormat.Header.csv","parameters.collectionformat.HeaderClient.csvWithResponse":"Parameters.CollectionFormat.Header.csv","parameters.collectionformat.QueryAsyncClient":"Parameters.CollectionFormat.Query","parameters.collectionformat.QueryAsyncClient.csv":"Parameters.CollectionFormat.Query.csv","parameters.collectionformat.QueryAsyncClient.csvWithResponse":"Parameters.CollectionFormat.Query.csv","parameters.collectionformat.QueryAsyncClient.multi":"Parameters.CollectionFormat.Query.multi","parameters.collectionformat.QueryAsyncClient.multiWithResponse":"Parameters.CollectionFormat.Query.multi","parameters.collectionformat.QueryAsyncClient.pipes":"Parameters.CollectionFormat.Query.pipes","parameters.collectionformat.QueryAsyncClient.pipesWithResponse":"Parameters.CollectionFormat.Query.pipes","parameters.collectionformat.QueryAsyncClient.ssv":"Parameters.CollectionFormat.Query.ssv","parameters.collectionformat.QueryAsyncClient.ssvWithResponse":"Parameters.CollectionFormat.Query.ssv","parameters.collectionformat.QueryClient":"Parameters.CollectionFormat.Query","parameters.collectionformat.QueryClient.csv":"Parameters.CollectionFormat.Query.csv","parameters.collectionformat.QueryClient.csvWithResponse":"Parameters.CollectionFormat.Query.csv","parameters.collectionformat.QueryClient.multi":"Parameters.CollectionFormat.Query.multi","parameters.collectionformat.QueryClient.multiWithResponse":"Parameters.CollectionFormat.Query.multi","parameters.collectionformat.QueryClient.pipes":"Parameters.CollectionFormat.Query.pipes","parameters.collectionformat.QueryClient.pipesWithResponse":"Parameters.CollectionFormat.Query.pipes","parameters.collectionformat.QueryClient.ssv":"Parameters.CollectionFormat.Query.ssv","parameters.collectionformat.QueryClient.ssvWithResponse":"Parameters.CollectionFormat.Query.ssv"},"generatedFiles":["src/main/java/module-info.java","src/main/java/parameters/collectionformat/CollectionFormatClientBuilder.java","src/main/java/parameters/collectionformat/HeaderAsyncClient.java","src/main/java/parameters/collectionformat/HeaderClient.java","src/main/java/parameters/collectionformat/QueryAsyncClient.java","src/main/java/parameters/collectionformat/QueryClient.java","src/main/java/parameters/collectionformat/implementation/CollectionFormatClientImpl.java","src/main/java/parameters/collectionformat/implementation/HeadersImpl.java","src/main/java/parameters/collectionformat/implementation/QueriesImpl.java","src/main/java/parameters/collectionformat/implementation/package-info.java","src/main/java/parameters/collectionformat/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_apiview_properties.json new file mode 100644 index 00000000000..66d5687efad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_apiview_properties.json @@ -0,0 +1,16 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "parameters.path.PathAsyncClient": "Parameters.Path", + "parameters.path.PathAsyncClient.normal": "Parameters.Path.normal", + "parameters.path.PathAsyncClient.normalWithResponse": "Parameters.Path.normal", + "parameters.path.PathAsyncClient.optional": "Parameters.Path.optional", + "parameters.path.PathAsyncClient.optionalWithResponse": "Parameters.Path.optional", + "parameters.path.PathClient": "Parameters.Path", + "parameters.path.PathClient.normal": "Parameters.Path.normal", + "parameters.path.PathClient.normalWithResponse": "Parameters.Path.normal", + "parameters.path.PathClient.optional": "Parameters.Path.optional", + "parameters.path.PathClient.optionalWithResponse": "Parameters.Path.optional", + "parameters.path.PathClientBuilder": "Parameters.Path" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_metadata.json new file mode 100644 index 00000000000..02ff582ae64 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-path_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"parameters.path.PathAsyncClient":"Parameters.Path","parameters.path.PathAsyncClient.normal":"Parameters.Path.normal","parameters.path.PathAsyncClient.normalWithResponse":"Parameters.Path.normal","parameters.path.PathAsyncClient.optional":"Parameters.Path.optional","parameters.path.PathAsyncClient.optionalWithResponse":"Parameters.Path.optional","parameters.path.PathClient":"Parameters.Path","parameters.path.PathClient.normal":"Parameters.Path.normal","parameters.path.PathClient.normalWithResponse":"Parameters.Path.normal","parameters.path.PathClient.optional":"Parameters.Path.optional","parameters.path.PathClient.optionalWithResponse":"Parameters.Path.optional","parameters.path.PathClientBuilder":"Parameters.Path"},"generatedFiles":["src/main/java/module-info.java","src/main/java/parameters/path/PathAsyncClient.java","src/main/java/parameters/path/PathClient.java","src/main/java/parameters/path/PathClientBuilder.java","src/main/java/parameters/path/implementation/PathClientImpl.java","src/main/java/parameters/path/implementation/package-info.java","src/main/java/parameters/path/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_apiview_properties.json new file mode 100644 index 00000000000..94bb7ef9d28 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_apiview_properties.json @@ -0,0 +1,57 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "parameters.spread.AliasAsyncClient": "Parameters.Spread.Alias", + "parameters.spread.AliasAsyncClient.spreadAsRequestBody": "Parameters.Spread.Alias.spreadAsRequestBody", + "parameters.spread.AliasAsyncClient.spreadAsRequestBodyWithResponse": "Parameters.Spread.Alias.spreadAsRequestBody", + "parameters.spread.AliasAsyncClient.spreadAsRequestParameter": "Parameters.Spread.Alias.spreadAsRequestParameter", + "parameters.spread.AliasAsyncClient.spreadAsRequestParameterWithResponse": "Parameters.Spread.Alias.spreadAsRequestParameter", + "parameters.spread.AliasAsyncClient.spreadParameterWithInnerAlias": "Parameters.Spread.Alias.spreadParameterWithInnerAlias", + "parameters.spread.AliasAsyncClient.spreadParameterWithInnerAliasWithResponse": "Parameters.Spread.Alias.spreadParameterWithInnerAlias", + "parameters.spread.AliasAsyncClient.spreadParameterWithInnerModel": "Parameters.Spread.Alias.spreadParameterWithInnerModel", + "parameters.spread.AliasAsyncClient.spreadParameterWithInnerModelWithResponse": "Parameters.Spread.Alias.spreadParameterWithInnerModel", + "parameters.spread.AliasAsyncClient.spreadWithMultipleParameters": "Parameters.Spread.Alias.spreadWithMultipleParameters", + "parameters.spread.AliasAsyncClient.spreadWithMultipleParametersWithResponse": "Parameters.Spread.Alias.spreadWithMultipleParameters", + "parameters.spread.AliasClient": "Parameters.Spread.Alias", + "parameters.spread.AliasClient.spreadAsRequestBody": "Parameters.Spread.Alias.spreadAsRequestBody", + "parameters.spread.AliasClient.spreadAsRequestBodyWithResponse": "Parameters.Spread.Alias.spreadAsRequestBody", + "parameters.spread.AliasClient.spreadAsRequestParameter": "Parameters.Spread.Alias.spreadAsRequestParameter", + "parameters.spread.AliasClient.spreadAsRequestParameterWithResponse": "Parameters.Spread.Alias.spreadAsRequestParameter", + "parameters.spread.AliasClient.spreadParameterWithInnerAlias": "Parameters.Spread.Alias.spreadParameterWithInnerAlias", + "parameters.spread.AliasClient.spreadParameterWithInnerAliasWithResponse": "Parameters.Spread.Alias.spreadParameterWithInnerAlias", + "parameters.spread.AliasClient.spreadParameterWithInnerModel": "Parameters.Spread.Alias.spreadParameterWithInnerModel", + "parameters.spread.AliasClient.spreadParameterWithInnerModelWithResponse": "Parameters.Spread.Alias.spreadParameterWithInnerModel", + "parameters.spread.AliasClient.spreadWithMultipleParameters": "Parameters.Spread.Alias.spreadWithMultipleParameters", + "parameters.spread.AliasClient.spreadWithMultipleParametersWithResponse": "Parameters.Spread.Alias.spreadWithMultipleParameters", + "parameters.spread.ModelAsyncClient": "Parameters.Spread.Model", + "parameters.spread.ModelAsyncClient.spreadAsRequestBody": "Parameters.Spread.Model.spreadAsRequestBody", + "parameters.spread.ModelAsyncClient.spreadAsRequestBodyWithResponse": "Parameters.Spread.Model.spreadAsRequestBody", + "parameters.spread.ModelAsyncClient.spreadCompositeRequest": "Parameters.Spread.Model.spreadCompositeRequest", + "parameters.spread.ModelAsyncClient.spreadCompositeRequestMix": "Parameters.Spread.Model.spreadCompositeRequestMix", + "parameters.spread.ModelAsyncClient.spreadCompositeRequestMixWithResponse": "Parameters.Spread.Model.spreadCompositeRequestMix", + "parameters.spread.ModelAsyncClient.spreadCompositeRequestOnlyWithBody": "Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody", + "parameters.spread.ModelAsyncClient.spreadCompositeRequestOnlyWithBodyWithResponse": "Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody", + "parameters.spread.ModelAsyncClient.spreadCompositeRequestWithResponse": "Parameters.Spread.Model.spreadCompositeRequest", + "parameters.spread.ModelAsyncClient.spreadCompositeRequestWithoutBody": "Parameters.Spread.Model.spreadCompositeRequestWithoutBody", + "parameters.spread.ModelAsyncClient.spreadCompositeRequestWithoutBodyWithResponse": "Parameters.Spread.Model.spreadCompositeRequestWithoutBody", + "parameters.spread.ModelClient": "Parameters.Spread.Model", + "parameters.spread.ModelClient.spreadAsRequestBody": "Parameters.Spread.Model.spreadAsRequestBody", + "parameters.spread.ModelClient.spreadAsRequestBodyWithResponse": "Parameters.Spread.Model.spreadAsRequestBody", + "parameters.spread.ModelClient.spreadCompositeRequest": "Parameters.Spread.Model.spreadCompositeRequest", + "parameters.spread.ModelClient.spreadCompositeRequestMix": "Parameters.Spread.Model.spreadCompositeRequestMix", + "parameters.spread.ModelClient.spreadCompositeRequestMixWithResponse": "Parameters.Spread.Model.spreadCompositeRequestMix", + "parameters.spread.ModelClient.spreadCompositeRequestOnlyWithBody": "Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody", + "parameters.spread.ModelClient.spreadCompositeRequestOnlyWithBodyWithResponse": "Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody", + "parameters.spread.ModelClient.spreadCompositeRequestWithResponse": "Parameters.Spread.Model.spreadCompositeRequest", + "parameters.spread.ModelClient.spreadCompositeRequestWithoutBody": "Parameters.Spread.Model.spreadCompositeRequestWithoutBody", + "parameters.spread.ModelClient.spreadCompositeRequestWithoutBodyWithResponse": "Parameters.Spread.Model.spreadCompositeRequestWithoutBody", + "parameters.spread.SpreadClientBuilder": "Parameters.Spread", + "parameters.spread.alias.implementation.models.SpreadAsRequestBodyRequest": "Parameters.Spread.Alias.spreadAsRequestBody.Request.anonymous", + "parameters.spread.implementation.models.SpreadAsRequestParameterRequest": "Parameters.Spread.Alias.spreadAsRequestParameter.Request.anonymous", + "parameters.spread.implementation.models.SpreadCompositeRequestMixRequest": "Parameters.Spread.Model.spreadCompositeRequestMix.Request.anonymous", + "parameters.spread.implementation.models.SpreadParameterWithInnerAliasRequest": "Parameters.Spread.Alias.spreadParameterWithInnerAlias.Request.anonymous", + "parameters.spread.implementation.models.SpreadParameterWithInnerModelRequest": "Parameters.Spread.Alias.spreadParameterWithInnerModel.Request.anonymous", + "parameters.spread.implementation.models.SpreadWithMultipleParametersRequest": "Parameters.Spread.Alias.spreadWithMultipleParameters.Request.anonymous", + "parameters.spread.model.models.BodyParameter": "Parameters.Spread.Model.BodyParameter" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_metadata.json new file mode 100644 index 00000000000..d746a4940bb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/parameters-spread_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"parameters.spread.AliasAsyncClient":"Parameters.Spread.Alias","parameters.spread.AliasAsyncClient.spreadAsRequestBody":"Parameters.Spread.Alias.spreadAsRequestBody","parameters.spread.AliasAsyncClient.spreadAsRequestBodyWithResponse":"Parameters.Spread.Alias.spreadAsRequestBody","parameters.spread.AliasAsyncClient.spreadAsRequestParameter":"Parameters.Spread.Alias.spreadAsRequestParameter","parameters.spread.AliasAsyncClient.spreadAsRequestParameterWithResponse":"Parameters.Spread.Alias.spreadAsRequestParameter","parameters.spread.AliasAsyncClient.spreadParameterWithInnerAlias":"Parameters.Spread.Alias.spreadParameterWithInnerAlias","parameters.spread.AliasAsyncClient.spreadParameterWithInnerAliasWithResponse":"Parameters.Spread.Alias.spreadParameterWithInnerAlias","parameters.spread.AliasAsyncClient.spreadParameterWithInnerModel":"Parameters.Spread.Alias.spreadParameterWithInnerModel","parameters.spread.AliasAsyncClient.spreadParameterWithInnerModelWithResponse":"Parameters.Spread.Alias.spreadParameterWithInnerModel","parameters.spread.AliasAsyncClient.spreadWithMultipleParameters":"Parameters.Spread.Alias.spreadWithMultipleParameters","parameters.spread.AliasAsyncClient.spreadWithMultipleParametersWithResponse":"Parameters.Spread.Alias.spreadWithMultipleParameters","parameters.spread.AliasClient":"Parameters.Spread.Alias","parameters.spread.AliasClient.spreadAsRequestBody":"Parameters.Spread.Alias.spreadAsRequestBody","parameters.spread.AliasClient.spreadAsRequestBodyWithResponse":"Parameters.Spread.Alias.spreadAsRequestBody","parameters.spread.AliasClient.spreadAsRequestParameter":"Parameters.Spread.Alias.spreadAsRequestParameter","parameters.spread.AliasClient.spreadAsRequestParameterWithResponse":"Parameters.Spread.Alias.spreadAsRequestParameter","parameters.spread.AliasClient.spreadParameterWithInnerAlias":"Parameters.Spread.Alias.spreadParameterWithInnerAlias","parameters.spread.AliasClient.spreadParameterWithInnerAliasWithResponse":"Parameters.Spread.Alias.spreadParameterWithInnerAlias","parameters.spread.AliasClient.spreadParameterWithInnerModel":"Parameters.Spread.Alias.spreadParameterWithInnerModel","parameters.spread.AliasClient.spreadParameterWithInnerModelWithResponse":"Parameters.Spread.Alias.spreadParameterWithInnerModel","parameters.spread.AliasClient.spreadWithMultipleParameters":"Parameters.Spread.Alias.spreadWithMultipleParameters","parameters.spread.AliasClient.spreadWithMultipleParametersWithResponse":"Parameters.Spread.Alias.spreadWithMultipleParameters","parameters.spread.ModelAsyncClient":"Parameters.Spread.Model","parameters.spread.ModelAsyncClient.spreadAsRequestBody":"Parameters.Spread.Model.spreadAsRequestBody","parameters.spread.ModelAsyncClient.spreadAsRequestBodyWithResponse":"Parameters.Spread.Model.spreadAsRequestBody","parameters.spread.ModelAsyncClient.spreadCompositeRequest":"Parameters.Spread.Model.spreadCompositeRequest","parameters.spread.ModelAsyncClient.spreadCompositeRequestMix":"Parameters.Spread.Model.spreadCompositeRequestMix","parameters.spread.ModelAsyncClient.spreadCompositeRequestMixWithResponse":"Parameters.Spread.Model.spreadCompositeRequestMix","parameters.spread.ModelAsyncClient.spreadCompositeRequestOnlyWithBody":"Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody","parameters.spread.ModelAsyncClient.spreadCompositeRequestOnlyWithBodyWithResponse":"Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody","parameters.spread.ModelAsyncClient.spreadCompositeRequestWithResponse":"Parameters.Spread.Model.spreadCompositeRequest","parameters.spread.ModelAsyncClient.spreadCompositeRequestWithoutBody":"Parameters.Spread.Model.spreadCompositeRequestWithoutBody","parameters.spread.ModelAsyncClient.spreadCompositeRequestWithoutBodyWithResponse":"Parameters.Spread.Model.spreadCompositeRequestWithoutBody","parameters.spread.ModelClient":"Parameters.Spread.Model","parameters.spread.ModelClient.spreadAsRequestBody":"Parameters.Spread.Model.spreadAsRequestBody","parameters.spread.ModelClient.spreadAsRequestBodyWithResponse":"Parameters.Spread.Model.spreadAsRequestBody","parameters.spread.ModelClient.spreadCompositeRequest":"Parameters.Spread.Model.spreadCompositeRequest","parameters.spread.ModelClient.spreadCompositeRequestMix":"Parameters.Spread.Model.spreadCompositeRequestMix","parameters.spread.ModelClient.spreadCompositeRequestMixWithResponse":"Parameters.Spread.Model.spreadCompositeRequestMix","parameters.spread.ModelClient.spreadCompositeRequestOnlyWithBody":"Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody","parameters.spread.ModelClient.spreadCompositeRequestOnlyWithBodyWithResponse":"Parameters.Spread.Model.spreadCompositeRequestOnlyWithBody","parameters.spread.ModelClient.spreadCompositeRequestWithResponse":"Parameters.Spread.Model.spreadCompositeRequest","parameters.spread.ModelClient.spreadCompositeRequestWithoutBody":"Parameters.Spread.Model.spreadCompositeRequestWithoutBody","parameters.spread.ModelClient.spreadCompositeRequestWithoutBodyWithResponse":"Parameters.Spread.Model.spreadCompositeRequestWithoutBody","parameters.spread.SpreadClientBuilder":"Parameters.Spread","parameters.spread.alias.implementation.models.SpreadAsRequestBodyRequest":"Parameters.Spread.Alias.spreadAsRequestBody.Request.anonymous","parameters.spread.implementation.models.SpreadAsRequestParameterRequest":"Parameters.Spread.Alias.spreadAsRequestParameter.Request.anonymous","parameters.spread.implementation.models.SpreadCompositeRequestMixRequest":"Parameters.Spread.Model.spreadCompositeRequestMix.Request.anonymous","parameters.spread.implementation.models.SpreadParameterWithInnerAliasRequest":"Parameters.Spread.Alias.spreadParameterWithInnerAlias.Request.anonymous","parameters.spread.implementation.models.SpreadParameterWithInnerModelRequest":"Parameters.Spread.Alias.spreadParameterWithInnerModel.Request.anonymous","parameters.spread.implementation.models.SpreadWithMultipleParametersRequest":"Parameters.Spread.Alias.spreadWithMultipleParameters.Request.anonymous","parameters.spread.model.models.BodyParameter":"Parameters.Spread.Model.BodyParameter"},"generatedFiles":["src/main/java/module-info.java","src/main/java/parameters/spread/AliasAsyncClient.java","src/main/java/parameters/spread/AliasClient.java","src/main/java/parameters/spread/ModelAsyncClient.java","src/main/java/parameters/spread/ModelClient.java","src/main/java/parameters/spread/SpreadClientBuilder.java","src/main/java/parameters/spread/alias/implementation/models/SpreadAsRequestBodyRequest.java","src/main/java/parameters/spread/alias/implementation/models/package-info.java","src/main/java/parameters/spread/implementation/AliasImpl.java","src/main/java/parameters/spread/implementation/ModelsImpl.java","src/main/java/parameters/spread/implementation/SpreadClientImpl.java","src/main/java/parameters/spread/implementation/models/SpreadAsRequestParameterRequest.java","src/main/java/parameters/spread/implementation/models/SpreadCompositeRequestMixRequest.java","src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerAliasRequest.java","src/main/java/parameters/spread/implementation/models/SpreadParameterWithInnerModelRequest.java","src/main/java/parameters/spread/implementation/models/SpreadWithMultipleParametersRequest.java","src/main/java/parameters/spread/implementation/models/package-info.java","src/main/java/parameters/spread/implementation/package-info.java","src/main/java/parameters/spread/model/models/BodyParameter.java","src/main/java/parameters/spread/model/models/package-info.java","src/main/java/parameters/spread/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_apiview_properties.json new file mode 100644 index 00000000000..a545c0caa95 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_apiview_properties.json @@ -0,0 +1,27 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "payload.contentnegotiation.ContentNegotiationClientBuilder": "Payload.ContentNegotiation", + "payload.contentnegotiation.DifferentBodyAsyncClient": "Payload.ContentNegotiation.DifferentBody", + "payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsJson": "Payload.ContentNegotiation.DifferentBody.getAvatarAsJson", + "payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsJsonWithResponse": "Payload.ContentNegotiation.DifferentBody.getAvatarAsJson", + "payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsPng": "Payload.ContentNegotiation.DifferentBody.getAvatarAsPng", + "payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsPngWithResponse": "Payload.ContentNegotiation.DifferentBody.getAvatarAsPng", + "payload.contentnegotiation.DifferentBodyClient": "Payload.ContentNegotiation.DifferentBody", + "payload.contentnegotiation.DifferentBodyClient.getAvatarAsJson": "Payload.ContentNegotiation.DifferentBody.getAvatarAsJson", + "payload.contentnegotiation.DifferentBodyClient.getAvatarAsJsonWithResponse": "Payload.ContentNegotiation.DifferentBody.getAvatarAsJson", + "payload.contentnegotiation.DifferentBodyClient.getAvatarAsPng": "Payload.ContentNegotiation.DifferentBody.getAvatarAsPng", + "payload.contentnegotiation.DifferentBodyClient.getAvatarAsPngWithResponse": "Payload.ContentNegotiation.DifferentBody.getAvatarAsPng", + "payload.contentnegotiation.SameBodyAsyncClient": "Payload.ContentNegotiation.SameBody", + "payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsJpeg": "Payload.ContentNegotiation.SameBody.getAvatarAsJpeg", + "payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsJpegWithResponse": "Payload.ContentNegotiation.SameBody.getAvatarAsJpeg", + "payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsPng": "Payload.ContentNegotiation.SameBody.getAvatarAsPng", + "payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsPngWithResponse": "Payload.ContentNegotiation.SameBody.getAvatarAsPng", + "payload.contentnegotiation.SameBodyClient": "Payload.ContentNegotiation.SameBody", + "payload.contentnegotiation.SameBodyClient.getAvatarAsJpeg": "Payload.ContentNegotiation.SameBody.getAvatarAsJpeg", + "payload.contentnegotiation.SameBodyClient.getAvatarAsJpegWithResponse": "Payload.ContentNegotiation.SameBody.getAvatarAsJpeg", + "payload.contentnegotiation.SameBodyClient.getAvatarAsPng": "Payload.ContentNegotiation.SameBody.getAvatarAsPng", + "payload.contentnegotiation.SameBodyClient.getAvatarAsPngWithResponse": "Payload.ContentNegotiation.SameBody.getAvatarAsPng", + "payload.contentnegotiation.differentbody.models.PngImageAsJson": "Payload.ContentNegotiation.DifferentBody.PngImageAsJson" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_metadata.json new file mode 100644 index 00000000000..d136feae480 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-contentnegotiation_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"payload.contentnegotiation.ContentNegotiationClientBuilder":"Payload.ContentNegotiation","payload.contentnegotiation.DifferentBodyAsyncClient":"Payload.ContentNegotiation.DifferentBody","payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsJson":"Payload.ContentNegotiation.DifferentBody.getAvatarAsJson","payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsJsonWithResponse":"Payload.ContentNegotiation.DifferentBody.getAvatarAsJson","payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsPng":"Payload.ContentNegotiation.DifferentBody.getAvatarAsPng","payload.contentnegotiation.DifferentBodyAsyncClient.getAvatarAsPngWithResponse":"Payload.ContentNegotiation.DifferentBody.getAvatarAsPng","payload.contentnegotiation.DifferentBodyClient":"Payload.ContentNegotiation.DifferentBody","payload.contentnegotiation.DifferentBodyClient.getAvatarAsJson":"Payload.ContentNegotiation.DifferentBody.getAvatarAsJson","payload.contentnegotiation.DifferentBodyClient.getAvatarAsJsonWithResponse":"Payload.ContentNegotiation.DifferentBody.getAvatarAsJson","payload.contentnegotiation.DifferentBodyClient.getAvatarAsPng":"Payload.ContentNegotiation.DifferentBody.getAvatarAsPng","payload.contentnegotiation.DifferentBodyClient.getAvatarAsPngWithResponse":"Payload.ContentNegotiation.DifferentBody.getAvatarAsPng","payload.contentnegotiation.SameBodyAsyncClient":"Payload.ContentNegotiation.SameBody","payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsJpeg":"Payload.ContentNegotiation.SameBody.getAvatarAsJpeg","payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsJpegWithResponse":"Payload.ContentNegotiation.SameBody.getAvatarAsJpeg","payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsPng":"Payload.ContentNegotiation.SameBody.getAvatarAsPng","payload.contentnegotiation.SameBodyAsyncClient.getAvatarAsPngWithResponse":"Payload.ContentNegotiation.SameBody.getAvatarAsPng","payload.contentnegotiation.SameBodyClient":"Payload.ContentNegotiation.SameBody","payload.contentnegotiation.SameBodyClient.getAvatarAsJpeg":"Payload.ContentNegotiation.SameBody.getAvatarAsJpeg","payload.contentnegotiation.SameBodyClient.getAvatarAsJpegWithResponse":"Payload.ContentNegotiation.SameBody.getAvatarAsJpeg","payload.contentnegotiation.SameBodyClient.getAvatarAsPng":"Payload.ContentNegotiation.SameBody.getAvatarAsPng","payload.contentnegotiation.SameBodyClient.getAvatarAsPngWithResponse":"Payload.ContentNegotiation.SameBody.getAvatarAsPng","payload.contentnegotiation.differentbody.models.PngImageAsJson":"Payload.ContentNegotiation.DifferentBody.PngImageAsJson"},"generatedFiles":["src/main/java/module-info.java","src/main/java/payload/contentnegotiation/ContentNegotiationClientBuilder.java","src/main/java/payload/contentnegotiation/DifferentBodyAsyncClient.java","src/main/java/payload/contentnegotiation/DifferentBodyClient.java","src/main/java/payload/contentnegotiation/SameBodyAsyncClient.java","src/main/java/payload/contentnegotiation/SameBodyClient.java","src/main/java/payload/contentnegotiation/differentbody/models/PngImageAsJson.java","src/main/java/payload/contentnegotiation/differentbody/models/package-info.java","src/main/java/payload/contentnegotiation/implementation/ContentNegotiationClientImpl.java","src/main/java/payload/contentnegotiation/implementation/DifferentBodiesImpl.java","src/main/java/payload/contentnegotiation/implementation/SameBodiesImpl.java","src/main/java/payload/contentnegotiation/implementation/package-info.java","src/main/java/payload/contentnegotiation/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_apiview_properties.json new file mode 100644 index 00000000000..0f127fc8f9c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_apiview_properties.json @@ -0,0 +1,23 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "payload.jsonmergepatch.JsonMergePatchAsyncClient": "Payload.JsonMergePatch", + "payload.jsonmergepatch.JsonMergePatchAsyncClient.createResource": "Payload.JsonMergePatch.createResource", + "payload.jsonmergepatch.JsonMergePatchAsyncClient.createResourceWithResponse": "Payload.JsonMergePatch.createResource", + "payload.jsonmergepatch.JsonMergePatchAsyncClient.updateOptionalResource": "Payload.JsonMergePatch.updateOptionalResource", + "payload.jsonmergepatch.JsonMergePatchAsyncClient.updateOptionalResourceWithResponse": "Payload.JsonMergePatch.updateOptionalResource", + "payload.jsonmergepatch.JsonMergePatchAsyncClient.updateResource": "Payload.JsonMergePatch.updateResource", + "payload.jsonmergepatch.JsonMergePatchAsyncClient.updateResourceWithResponse": "Payload.JsonMergePatch.updateResource", + "payload.jsonmergepatch.JsonMergePatchClient": "Payload.JsonMergePatch", + "payload.jsonmergepatch.JsonMergePatchClient.createResource": "Payload.JsonMergePatch.createResource", + "payload.jsonmergepatch.JsonMergePatchClient.createResourceWithResponse": "Payload.JsonMergePatch.createResource", + "payload.jsonmergepatch.JsonMergePatchClient.updateOptionalResource": "Payload.JsonMergePatch.updateOptionalResource", + "payload.jsonmergepatch.JsonMergePatchClient.updateOptionalResourceWithResponse": "Payload.JsonMergePatch.updateOptionalResource", + "payload.jsonmergepatch.JsonMergePatchClient.updateResource": "Payload.JsonMergePatch.updateResource", + "payload.jsonmergepatch.JsonMergePatchClient.updateResourceWithResponse": "Payload.JsonMergePatch.updateResource", + "payload.jsonmergepatch.JsonMergePatchClientBuilder": "Payload.JsonMergePatch", + "payload.jsonmergepatch.models.InnerModel": "Payload.JsonMergePatch.InnerModel", + "payload.jsonmergepatch.models.Resource": "Payload.JsonMergePatch.Resource", + "payload.jsonmergepatch.models.ResourcePatch": "Payload.JsonMergePatch.ResourcePatch" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_metadata.json new file mode 100644 index 00000000000..45056ffa48e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-jsonmergepatch_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"payload.jsonmergepatch.JsonMergePatchAsyncClient":"Payload.JsonMergePatch","payload.jsonmergepatch.JsonMergePatchAsyncClient.createResource":"Payload.JsonMergePatch.createResource","payload.jsonmergepatch.JsonMergePatchAsyncClient.createResourceWithResponse":"Payload.JsonMergePatch.createResource","payload.jsonmergepatch.JsonMergePatchAsyncClient.updateOptionalResource":"Payload.JsonMergePatch.updateOptionalResource","payload.jsonmergepatch.JsonMergePatchAsyncClient.updateOptionalResourceWithResponse":"Payload.JsonMergePatch.updateOptionalResource","payload.jsonmergepatch.JsonMergePatchAsyncClient.updateResource":"Payload.JsonMergePatch.updateResource","payload.jsonmergepatch.JsonMergePatchAsyncClient.updateResourceWithResponse":"Payload.JsonMergePatch.updateResource","payload.jsonmergepatch.JsonMergePatchClient":"Payload.JsonMergePatch","payload.jsonmergepatch.JsonMergePatchClient.createResource":"Payload.JsonMergePatch.createResource","payload.jsonmergepatch.JsonMergePatchClient.createResourceWithResponse":"Payload.JsonMergePatch.createResource","payload.jsonmergepatch.JsonMergePatchClient.updateOptionalResource":"Payload.JsonMergePatch.updateOptionalResource","payload.jsonmergepatch.JsonMergePatchClient.updateOptionalResourceWithResponse":"Payload.JsonMergePatch.updateOptionalResource","payload.jsonmergepatch.JsonMergePatchClient.updateResource":"Payload.JsonMergePatch.updateResource","payload.jsonmergepatch.JsonMergePatchClient.updateResourceWithResponse":"Payload.JsonMergePatch.updateResource","payload.jsonmergepatch.JsonMergePatchClientBuilder":"Payload.JsonMergePatch","payload.jsonmergepatch.models.InnerModel":"Payload.JsonMergePatch.InnerModel","payload.jsonmergepatch.models.Resource":"Payload.JsonMergePatch.Resource","payload.jsonmergepatch.models.ResourcePatch":"Payload.JsonMergePatch.ResourcePatch"},"generatedFiles":["src/main/java/module-info.java","src/main/java/payload/jsonmergepatch/JsonMergePatchAsyncClient.java","src/main/java/payload/jsonmergepatch/JsonMergePatchClient.java","src/main/java/payload/jsonmergepatch/JsonMergePatchClientBuilder.java","src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java","src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchHelper.java","src/main/java/payload/jsonmergepatch/implementation/package-info.java","src/main/java/payload/jsonmergepatch/models/InnerModel.java","src/main/java/payload/jsonmergepatch/models/Resource.java","src/main/java/payload/jsonmergepatch/models/ResourcePatch.java","src/main/java/payload/jsonmergepatch/models/package-info.java","src/main/java/payload/jsonmergepatch/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_apiview_properties.json new file mode 100644 index 00000000000..6e003b50b54 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_apiview_properties.json @@ -0,0 +1,24 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "payload.mediatype.MediaTypeAsyncClient": "Payload.MediaType.StringBody", + "payload.mediatype.MediaTypeAsyncClient.getAsJson": "Payload.MediaType.StringBody.getAsJson", + "payload.mediatype.MediaTypeAsyncClient.getAsJsonWithResponse": "Payload.MediaType.StringBody.getAsJson", + "payload.mediatype.MediaTypeAsyncClient.getAsText": "Payload.MediaType.StringBody.getAsText", + "payload.mediatype.MediaTypeAsyncClient.getAsTextWithResponse": "Payload.MediaType.StringBody.getAsText", + "payload.mediatype.MediaTypeAsyncClient.sendAsJson": "Payload.MediaType.StringBody.sendAsJson", + "payload.mediatype.MediaTypeAsyncClient.sendAsJsonWithResponse": "Payload.MediaType.StringBody.sendAsJson", + "payload.mediatype.MediaTypeAsyncClient.sendAsText": "Payload.MediaType.StringBody.sendAsText", + "payload.mediatype.MediaTypeAsyncClient.sendAsTextWithResponse": "Payload.MediaType.StringBody.sendAsText", + "payload.mediatype.MediaTypeClient": "Payload.MediaType.StringBody", + "payload.mediatype.MediaTypeClient.getAsJson": "Payload.MediaType.StringBody.getAsJson", + "payload.mediatype.MediaTypeClient.getAsJsonWithResponse": "Payload.MediaType.StringBody.getAsJson", + "payload.mediatype.MediaTypeClient.getAsText": "Payload.MediaType.StringBody.getAsText", + "payload.mediatype.MediaTypeClient.getAsTextWithResponse": "Payload.MediaType.StringBody.getAsText", + "payload.mediatype.MediaTypeClient.sendAsJson": "Payload.MediaType.StringBody.sendAsJson", + "payload.mediatype.MediaTypeClient.sendAsJsonWithResponse": "Payload.MediaType.StringBody.sendAsJson", + "payload.mediatype.MediaTypeClient.sendAsText": "Payload.MediaType.StringBody.sendAsText", + "payload.mediatype.MediaTypeClient.sendAsTextWithResponse": "Payload.MediaType.StringBody.sendAsText", + "payload.mediatype.MediaTypeClientBuilder": "Payload.MediaType" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_metadata.json new file mode 100644 index 00000000000..7cfedb7a6a9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-mediatype_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"payload.mediatype.MediaTypeAsyncClient":"Payload.MediaType.StringBody","payload.mediatype.MediaTypeAsyncClient.getAsJson":"Payload.MediaType.StringBody.getAsJson","payload.mediatype.MediaTypeAsyncClient.getAsJsonWithResponse":"Payload.MediaType.StringBody.getAsJson","payload.mediatype.MediaTypeAsyncClient.getAsText":"Payload.MediaType.StringBody.getAsText","payload.mediatype.MediaTypeAsyncClient.getAsTextWithResponse":"Payload.MediaType.StringBody.getAsText","payload.mediatype.MediaTypeAsyncClient.sendAsJson":"Payload.MediaType.StringBody.sendAsJson","payload.mediatype.MediaTypeAsyncClient.sendAsJsonWithResponse":"Payload.MediaType.StringBody.sendAsJson","payload.mediatype.MediaTypeAsyncClient.sendAsText":"Payload.MediaType.StringBody.sendAsText","payload.mediatype.MediaTypeAsyncClient.sendAsTextWithResponse":"Payload.MediaType.StringBody.sendAsText","payload.mediatype.MediaTypeClient":"Payload.MediaType.StringBody","payload.mediatype.MediaTypeClient.getAsJson":"Payload.MediaType.StringBody.getAsJson","payload.mediatype.MediaTypeClient.getAsJsonWithResponse":"Payload.MediaType.StringBody.getAsJson","payload.mediatype.MediaTypeClient.getAsText":"Payload.MediaType.StringBody.getAsText","payload.mediatype.MediaTypeClient.getAsTextWithResponse":"Payload.MediaType.StringBody.getAsText","payload.mediatype.MediaTypeClient.sendAsJson":"Payload.MediaType.StringBody.sendAsJson","payload.mediatype.MediaTypeClient.sendAsJsonWithResponse":"Payload.MediaType.StringBody.sendAsJson","payload.mediatype.MediaTypeClient.sendAsText":"Payload.MediaType.StringBody.sendAsText","payload.mediatype.MediaTypeClient.sendAsTextWithResponse":"Payload.MediaType.StringBody.sendAsText","payload.mediatype.MediaTypeClientBuilder":"Payload.MediaType"},"generatedFiles":["src/main/java/module-info.java","src/main/java/payload/mediatype/MediaTypeAsyncClient.java","src/main/java/payload/mediatype/MediaTypeClient.java","src/main/java/payload/mediatype/MediaTypeClientBuilder.java","src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java","src/main/java/payload/mediatype/implementation/StringBodiesImpl.java","src/main/java/payload/mediatype/implementation/package-info.java","src/main/java/payload/mediatype/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_apiview_properties.json new file mode 100644 index 00000000000..36f7a51cedf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_apiview_properties.json @@ -0,0 +1,80 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "payload.multipart.FormDataAsyncClient": "Payload.MultiPart.FormData", + "payload.multipart.FormDataAsyncClient.anonymousModel": "Payload.MultiPart.FormData.anonymousModel", + "payload.multipart.FormDataAsyncClient.anonymousModelWithResponse": "Payload.MultiPart.FormData.anonymousModel", + "payload.multipart.FormDataAsyncClient.basic": "Payload.MultiPart.FormData.basic", + "payload.multipart.FormDataAsyncClient.basicWithResponse": "Payload.MultiPart.FormData.basic", + "payload.multipart.FormDataAsyncClient.binaryArrayParts": "Payload.MultiPart.FormData.binaryArrayParts", + "payload.multipart.FormDataAsyncClient.binaryArrayPartsWithResponse": "Payload.MultiPart.FormData.binaryArrayParts", + "payload.multipart.FormDataAsyncClient.checkFileNameAndContentType": "Payload.MultiPart.FormData.checkFileNameAndContentType", + "payload.multipart.FormDataAsyncClient.checkFileNameAndContentTypeWithResponse": "Payload.MultiPart.FormData.checkFileNameAndContentType", + "payload.multipart.FormDataAsyncClient.fileArrayAndBasic": "Payload.MultiPart.FormData.fileArrayAndBasic", + "payload.multipart.FormDataAsyncClient.fileArrayAndBasicWithResponse": "Payload.MultiPart.FormData.fileArrayAndBasic", + "payload.multipart.FormDataAsyncClient.jsonPart": "Payload.MultiPart.FormData.jsonPart", + "payload.multipart.FormDataAsyncClient.jsonPartWithResponse": "Payload.MultiPart.FormData.jsonPart", + "payload.multipart.FormDataAsyncClient.multiBinaryParts": "Payload.MultiPart.FormData.multiBinaryParts", + "payload.multipart.FormDataAsyncClient.multiBinaryPartsWithResponse": "Payload.MultiPart.FormData.multiBinaryParts", + "payload.multipart.FormDataClient": "Payload.MultiPart.FormData", + "payload.multipart.FormDataClient.anonymousModel": "Payload.MultiPart.FormData.anonymousModel", + "payload.multipart.FormDataClient.anonymousModelWithResponse": "Payload.MultiPart.FormData.anonymousModel", + "payload.multipart.FormDataClient.basic": "Payload.MultiPart.FormData.basic", + "payload.multipart.FormDataClient.basicWithResponse": "Payload.MultiPart.FormData.basic", + "payload.multipart.FormDataClient.binaryArrayParts": "Payload.MultiPart.FormData.binaryArrayParts", + "payload.multipart.FormDataClient.binaryArrayPartsWithResponse": "Payload.MultiPart.FormData.binaryArrayParts", + "payload.multipart.FormDataClient.checkFileNameAndContentType": "Payload.MultiPart.FormData.checkFileNameAndContentType", + "payload.multipart.FormDataClient.checkFileNameAndContentTypeWithResponse": "Payload.MultiPart.FormData.checkFileNameAndContentType", + "payload.multipart.FormDataClient.fileArrayAndBasic": "Payload.MultiPart.FormData.fileArrayAndBasic", + "payload.multipart.FormDataClient.fileArrayAndBasicWithResponse": "Payload.MultiPart.FormData.fileArrayAndBasic", + "payload.multipart.FormDataClient.jsonPart": "Payload.MultiPart.FormData.jsonPart", + "payload.multipart.FormDataClient.jsonPartWithResponse": "Payload.MultiPart.FormData.jsonPart", + "payload.multipart.FormDataClient.multiBinaryParts": "Payload.MultiPart.FormData.multiBinaryParts", + "payload.multipart.FormDataClient.multiBinaryPartsWithResponse": "Payload.MultiPart.FormData.multiBinaryParts", + "payload.multipart.FormDataHttpPartsAsyncClient": "Payload.MultiPart.FormData.HttpParts", + "payload.multipart.FormDataHttpPartsAsyncClient.jsonArrayAndFileArray": "Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray", + "payload.multipart.FormDataHttpPartsAsyncClient.jsonArrayAndFileArrayWithResponse": "Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray", + "payload.multipart.FormDataHttpPartsClient": "Payload.MultiPart.FormData.HttpParts", + "payload.multipart.FormDataHttpPartsClient.jsonArrayAndFileArray": "Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray", + "payload.multipart.FormDataHttpPartsClient.jsonArrayAndFileArrayWithResponse": "Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray", + "payload.multipart.FormDataHttpPartsContentTypeAsyncClient": "Payload.MultiPart.FormData.HttpParts.ContentType", + "payload.multipart.FormDataHttpPartsContentTypeAsyncClient.imageJpegContentType": "Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType", + "payload.multipart.FormDataHttpPartsContentTypeAsyncClient.imageJpegContentTypeWithResponse": "Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType", + "payload.multipart.FormDataHttpPartsContentTypeAsyncClient.optionalContentType": "Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType", + "payload.multipart.FormDataHttpPartsContentTypeAsyncClient.optionalContentTypeWithResponse": "Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType", + "payload.multipart.FormDataHttpPartsContentTypeAsyncClient.requiredContentType": "Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType", + "payload.multipart.FormDataHttpPartsContentTypeAsyncClient.requiredContentTypeWithResponse": "Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType", + "payload.multipart.FormDataHttpPartsContentTypeClient": "Payload.MultiPart.FormData.HttpParts.ContentType", + "payload.multipart.FormDataHttpPartsContentTypeClient.imageJpegContentType": "Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType", + "payload.multipart.FormDataHttpPartsContentTypeClient.imageJpegContentTypeWithResponse": "Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType", + "payload.multipart.FormDataHttpPartsContentTypeClient.optionalContentType": "Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType", + "payload.multipart.FormDataHttpPartsContentTypeClient.optionalContentTypeWithResponse": "Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType", + "payload.multipart.FormDataHttpPartsContentTypeClient.requiredContentType": "Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType", + "payload.multipart.FormDataHttpPartsContentTypeClient.requiredContentTypeWithResponse": "Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType", + "payload.multipart.FormDataHttpPartsNonStringAsyncClient": "Payload.MultiPart.FormData.HttpParts.NonString", + "payload.multipart.FormDataHttpPartsNonStringAsyncClient.floatMethod": "Payload.MultiPart.FormData.HttpParts.NonString.float", + "payload.multipart.FormDataHttpPartsNonStringAsyncClient.floatMethodWithResponse": "Payload.MultiPart.FormData.HttpParts.NonString.float", + "payload.multipart.FormDataHttpPartsNonStringClient": "Payload.MultiPart.FormData.HttpParts.NonString", + "payload.multipart.FormDataHttpPartsNonStringClient.floatMethod": "Payload.MultiPart.FormData.HttpParts.NonString.float", + "payload.multipart.FormDataHttpPartsNonStringClient.floatMethodWithResponse": "Payload.MultiPart.FormData.HttpParts.NonString.float", + "payload.multipart.MultiPartClientBuilder": "Payload.MultiPart", + "payload.multipart.formdata.httpparts.nonstring.models.FloatRequest": "Payload.MultiPart.FormData.HttpParts.NonString.float.Request.anonymous", + "payload.multipart.formdata.models.AnonymousModelRequest": "Payload.MultiPart.FormData.anonymousModel.Request.anonymous", + "payload.multipart.models.Address": "Payload.MultiPart.Address", + "payload.multipart.models.BinaryArrayPartsRequest": "Payload.MultiPart.BinaryArrayPartsRequest", + "payload.multipart.models.ComplexHttpPartsModelRequest": "Payload.MultiPart.ComplexHttpPartsModelRequest", + "payload.multipart.models.ComplexPartsRequest": "Payload.MultiPart.ComplexPartsRequest", + "payload.multipart.models.FileOptionalContentType": "Payload.MultiPart.FileOptionalContentType", + "payload.multipart.models.FileRequiredMetaData": "Payload.MultiPart.FileRequiredMetaData", + "payload.multipart.models.FileSpecificContentType": "Payload.MultiPart.FileSpecificContentType", + "payload.multipart.models.FileWithHttpPartOptionalContentTypeRequest": "Payload.MultiPart.FileWithHttpPartOptionalContentTypeRequest", + "payload.multipart.models.FileWithHttpPartRequiredContentTypeRequest": "Payload.MultiPart.FileWithHttpPartRequiredContentTypeRequest", + "payload.multipart.models.FileWithHttpPartSpecificContentTypeRequest": "Payload.MultiPart.FileWithHttpPartSpecificContentTypeRequest", + "payload.multipart.models.JsonPartRequest": "Payload.MultiPart.JsonPartRequest", + "payload.multipart.models.MultiBinaryPartsRequest": "Payload.MultiPart.MultiBinaryPartsRequest", + "payload.multipart.models.MultiPartRequest": "Payload.MultiPart.MultiPartRequest", + "payload.multipart.models.PictureFileDetails": null, + "payload.multipart.models.PicturesFileDetails": null, + "payload.multipart.models.ProfileImageFileDetails": null + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_metadata.json new file mode 100644 index 00000000000..3d6ba8c801f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/payload-multipart_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"payload.multipart.FormDataAsyncClient":"Payload.MultiPart.FormData","payload.multipart.FormDataAsyncClient.anonymousModel":"Payload.MultiPart.FormData.anonymousModel","payload.multipart.FormDataAsyncClient.anonymousModelWithResponse":"Payload.MultiPart.FormData.anonymousModel","payload.multipart.FormDataAsyncClient.basic":"Payload.MultiPart.FormData.basic","payload.multipart.FormDataAsyncClient.basicWithResponse":"Payload.MultiPart.FormData.basic","payload.multipart.FormDataAsyncClient.binaryArrayParts":"Payload.MultiPart.FormData.binaryArrayParts","payload.multipart.FormDataAsyncClient.binaryArrayPartsWithResponse":"Payload.MultiPart.FormData.binaryArrayParts","payload.multipart.FormDataAsyncClient.checkFileNameAndContentType":"Payload.MultiPart.FormData.checkFileNameAndContentType","payload.multipart.FormDataAsyncClient.checkFileNameAndContentTypeWithResponse":"Payload.MultiPart.FormData.checkFileNameAndContentType","payload.multipart.FormDataAsyncClient.fileArrayAndBasic":"Payload.MultiPart.FormData.fileArrayAndBasic","payload.multipart.FormDataAsyncClient.fileArrayAndBasicWithResponse":"Payload.MultiPart.FormData.fileArrayAndBasic","payload.multipart.FormDataAsyncClient.jsonPart":"Payload.MultiPart.FormData.jsonPart","payload.multipart.FormDataAsyncClient.jsonPartWithResponse":"Payload.MultiPart.FormData.jsonPart","payload.multipart.FormDataAsyncClient.multiBinaryParts":"Payload.MultiPart.FormData.multiBinaryParts","payload.multipart.FormDataAsyncClient.multiBinaryPartsWithResponse":"Payload.MultiPart.FormData.multiBinaryParts","payload.multipart.FormDataClient":"Payload.MultiPart.FormData","payload.multipart.FormDataClient.anonymousModel":"Payload.MultiPart.FormData.anonymousModel","payload.multipart.FormDataClient.anonymousModelWithResponse":"Payload.MultiPart.FormData.anonymousModel","payload.multipart.FormDataClient.basic":"Payload.MultiPart.FormData.basic","payload.multipart.FormDataClient.basicWithResponse":"Payload.MultiPart.FormData.basic","payload.multipart.FormDataClient.binaryArrayParts":"Payload.MultiPart.FormData.binaryArrayParts","payload.multipart.FormDataClient.binaryArrayPartsWithResponse":"Payload.MultiPart.FormData.binaryArrayParts","payload.multipart.FormDataClient.checkFileNameAndContentType":"Payload.MultiPart.FormData.checkFileNameAndContentType","payload.multipart.FormDataClient.checkFileNameAndContentTypeWithResponse":"Payload.MultiPart.FormData.checkFileNameAndContentType","payload.multipart.FormDataClient.fileArrayAndBasic":"Payload.MultiPart.FormData.fileArrayAndBasic","payload.multipart.FormDataClient.fileArrayAndBasicWithResponse":"Payload.MultiPart.FormData.fileArrayAndBasic","payload.multipart.FormDataClient.jsonPart":"Payload.MultiPart.FormData.jsonPart","payload.multipart.FormDataClient.jsonPartWithResponse":"Payload.MultiPart.FormData.jsonPart","payload.multipart.FormDataClient.multiBinaryParts":"Payload.MultiPart.FormData.multiBinaryParts","payload.multipart.FormDataClient.multiBinaryPartsWithResponse":"Payload.MultiPart.FormData.multiBinaryParts","payload.multipart.FormDataHttpPartsAsyncClient":"Payload.MultiPart.FormData.HttpParts","payload.multipart.FormDataHttpPartsAsyncClient.jsonArrayAndFileArray":"Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray","payload.multipart.FormDataHttpPartsAsyncClient.jsonArrayAndFileArrayWithResponse":"Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray","payload.multipart.FormDataHttpPartsClient":"Payload.MultiPart.FormData.HttpParts","payload.multipart.FormDataHttpPartsClient.jsonArrayAndFileArray":"Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray","payload.multipart.FormDataHttpPartsClient.jsonArrayAndFileArrayWithResponse":"Payload.MultiPart.FormData.HttpParts.jsonArrayAndFileArray","payload.multipart.FormDataHttpPartsContentTypeAsyncClient":"Payload.MultiPart.FormData.HttpParts.ContentType","payload.multipart.FormDataHttpPartsContentTypeAsyncClient.imageJpegContentType":"Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType","payload.multipart.FormDataHttpPartsContentTypeAsyncClient.imageJpegContentTypeWithResponse":"Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType","payload.multipart.FormDataHttpPartsContentTypeAsyncClient.optionalContentType":"Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType","payload.multipart.FormDataHttpPartsContentTypeAsyncClient.optionalContentTypeWithResponse":"Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType","payload.multipart.FormDataHttpPartsContentTypeAsyncClient.requiredContentType":"Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType","payload.multipart.FormDataHttpPartsContentTypeAsyncClient.requiredContentTypeWithResponse":"Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType","payload.multipart.FormDataHttpPartsContentTypeClient":"Payload.MultiPart.FormData.HttpParts.ContentType","payload.multipart.FormDataHttpPartsContentTypeClient.imageJpegContentType":"Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType","payload.multipart.FormDataHttpPartsContentTypeClient.imageJpegContentTypeWithResponse":"Payload.MultiPart.FormData.HttpParts.ContentType.imageJpegContentType","payload.multipart.FormDataHttpPartsContentTypeClient.optionalContentType":"Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType","payload.multipart.FormDataHttpPartsContentTypeClient.optionalContentTypeWithResponse":"Payload.MultiPart.FormData.HttpParts.ContentType.optionalContentType","payload.multipart.FormDataHttpPartsContentTypeClient.requiredContentType":"Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType","payload.multipart.FormDataHttpPartsContentTypeClient.requiredContentTypeWithResponse":"Payload.MultiPart.FormData.HttpParts.ContentType.requiredContentType","payload.multipart.FormDataHttpPartsNonStringAsyncClient":"Payload.MultiPart.FormData.HttpParts.NonString","payload.multipart.FormDataHttpPartsNonStringAsyncClient.floatMethod":"Payload.MultiPart.FormData.HttpParts.NonString.float","payload.multipart.FormDataHttpPartsNonStringAsyncClient.floatMethodWithResponse":"Payload.MultiPart.FormData.HttpParts.NonString.float","payload.multipart.FormDataHttpPartsNonStringClient":"Payload.MultiPart.FormData.HttpParts.NonString","payload.multipart.FormDataHttpPartsNonStringClient.floatMethod":"Payload.MultiPart.FormData.HttpParts.NonString.float","payload.multipart.FormDataHttpPartsNonStringClient.floatMethodWithResponse":"Payload.MultiPart.FormData.HttpParts.NonString.float","payload.multipart.MultiPartClientBuilder":"Payload.MultiPart","payload.multipart.formdata.httpparts.nonstring.models.FloatRequest":"Payload.MultiPart.FormData.HttpParts.NonString.float.Request.anonymous","payload.multipart.formdata.models.AnonymousModelRequest":"Payload.MultiPart.FormData.anonymousModel.Request.anonymous","payload.multipart.models.Address":"Payload.MultiPart.Address","payload.multipart.models.BinaryArrayPartsRequest":"Payload.MultiPart.BinaryArrayPartsRequest","payload.multipart.models.ComplexHttpPartsModelRequest":"Payload.MultiPart.ComplexHttpPartsModelRequest","payload.multipart.models.ComplexPartsRequest":"Payload.MultiPart.ComplexPartsRequest","payload.multipart.models.FileOptionalContentType":"Payload.MultiPart.FileOptionalContentType","payload.multipart.models.FileRequiredMetaData":"Payload.MultiPart.FileRequiredMetaData","payload.multipart.models.FileSpecificContentType":"Payload.MultiPart.FileSpecificContentType","payload.multipart.models.FileWithHttpPartOptionalContentTypeRequest":"Payload.MultiPart.FileWithHttpPartOptionalContentTypeRequest","payload.multipart.models.FileWithHttpPartRequiredContentTypeRequest":"Payload.MultiPart.FileWithHttpPartRequiredContentTypeRequest","payload.multipart.models.FileWithHttpPartSpecificContentTypeRequest":"Payload.MultiPart.FileWithHttpPartSpecificContentTypeRequest","payload.multipart.models.JsonPartRequest":"Payload.MultiPart.JsonPartRequest","payload.multipart.models.MultiBinaryPartsRequest":"Payload.MultiPart.MultiBinaryPartsRequest","payload.multipart.models.MultiPartRequest":"Payload.MultiPart.MultiPartRequest","payload.multipart.models.PictureFileDetails":null,"payload.multipart.models.PicturesFileDetails":null,"payload.multipart.models.ProfileImageFileDetails":null},"generatedFiles":["src/main/java/module-info.java","src/main/java/payload/multipart/FormDataAsyncClient.java","src/main/java/payload/multipart/FormDataClient.java","src/main/java/payload/multipart/FormDataHttpPartsAsyncClient.java","src/main/java/payload/multipart/FormDataHttpPartsClient.java","src/main/java/payload/multipart/FormDataHttpPartsContentTypeAsyncClient.java","src/main/java/payload/multipart/FormDataHttpPartsContentTypeClient.java","src/main/java/payload/multipart/FormDataHttpPartsNonStringAsyncClient.java","src/main/java/payload/multipart/FormDataHttpPartsNonStringClient.java","src/main/java/payload/multipart/MultiPartClientBuilder.java","src/main/java/payload/multipart/formdata/httpparts/nonstring/models/FloatRequest.java","src/main/java/payload/multipart/formdata/httpparts/nonstring/models/package-info.java","src/main/java/payload/multipart/formdata/models/AnonymousModelRequest.java","src/main/java/payload/multipart/formdata/models/package-info.java","src/main/java/payload/multipart/implementation/FormDataHttpPartsContentTypesImpl.java","src/main/java/payload/multipart/implementation/FormDataHttpPartsImpl.java","src/main/java/payload/multipart/implementation/FormDataHttpPartsNonStringsImpl.java","src/main/java/payload/multipart/implementation/FormDatasImpl.java","src/main/java/payload/multipart/implementation/MultiPartClientImpl.java","src/main/java/payload/multipart/implementation/MultipartFormDataHelper.java","src/main/java/payload/multipart/implementation/package-info.java","src/main/java/payload/multipart/models/Address.java","src/main/java/payload/multipart/models/BinaryArrayPartsRequest.java","src/main/java/payload/multipart/models/ComplexHttpPartsModelRequest.java","src/main/java/payload/multipart/models/ComplexPartsRequest.java","src/main/java/payload/multipart/models/FileOptionalContentType.java","src/main/java/payload/multipart/models/FileRequiredMetaData.java","src/main/java/payload/multipart/models/FileSpecificContentType.java","src/main/java/payload/multipart/models/FileWithHttpPartOptionalContentTypeRequest.java","src/main/java/payload/multipart/models/FileWithHttpPartRequiredContentTypeRequest.java","src/main/java/payload/multipart/models/FileWithHttpPartSpecificContentTypeRequest.java","src/main/java/payload/multipart/models/JsonPartRequest.java","src/main/java/payload/multipart/models/MultiBinaryPartsRequest.java","src/main/java/payload/multipart/models/MultiPartRequest.java","src/main/java/payload/multipart/models/PictureFileDetails.java","src/main/java/payload/multipart/models/PicturesFileDetails.java","src/main/java/payload/multipart/models/ProfileImageFileDetails.java","src/main/java/payload/multipart/models/package-info.java","src/main/java/payload/multipart/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_apiview_properties.json new file mode 100644 index 00000000000..a9628906051 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_apiview_properties.json @@ -0,0 +1,20 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient": "Resiliency.ServiceDriven", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromNone": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromNoneWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneOptional": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneOptionalWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneRequired": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneRequiredWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient": "Resiliency.ServiceDriven", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromNone": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromNoneWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneOptional": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneOptionalWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneRequired": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneRequiredWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", + "resiliency.servicedriven.v1.ResiliencyServiceDrivenClientBuilder": "Resiliency.ServiceDriven" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_metadata.json new file mode 100644 index 00000000000..916871c2b60 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven-v1_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"all","crossLanguageDefinitions":{"resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient":"Resiliency.ServiceDriven","resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromNone":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromNoneWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneOptional":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneOptionalWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneRequired":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.v1.ResiliencyServiceDrivenAsyncClient.fromOneRequiredWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient":"Resiliency.ServiceDriven","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromNone":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromNoneWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneOptional":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneOptionalWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneRequired":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.v1.ResiliencyServiceDrivenClient.fromOneRequiredWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.v1.ResiliencyServiceDrivenClientBuilder":"Resiliency.ServiceDriven"},"generatedFiles":["src/main/java/module-info.java","src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenAsyncClient.java","src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClient.java","src/main/java/resiliency/servicedriven/v1/ResiliencyServiceDrivenClientBuilder.java","src/main/java/resiliency/servicedriven/v1/ServiceDrivenServiceVersion.java","src/main/java/resiliency/servicedriven/v1/implementation/ResiliencyServiceDrivenClientImpl.java","src/main/java/resiliency/servicedriven/v1/implementation/package-info.java","src/main/java/resiliency/servicedriven/v1/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_apiview_properties.json new file mode 100644 index 00000000000..46deca191e8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_apiview_properties.json @@ -0,0 +1,24 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient": "Resiliency.ServiceDriven", + "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.addOperation": "Resiliency.ServiceDriven.addOperation", + "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.addOperationWithResponse": "Resiliency.ServiceDriven.addOperation", + "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromNone": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", + "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromNoneWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", + "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneOptional": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", + "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneOptionalWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", + "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneRequired": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", + "resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneRequiredWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", + "resiliency.servicedriven.ResiliencyServiceDrivenClient": "Resiliency.ServiceDriven", + "resiliency.servicedriven.ResiliencyServiceDrivenClient.addOperation": "Resiliency.ServiceDriven.addOperation", + "resiliency.servicedriven.ResiliencyServiceDrivenClient.addOperationWithResponse": "Resiliency.ServiceDriven.addOperation", + "resiliency.servicedriven.ResiliencyServiceDrivenClient.fromNone": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", + "resiliency.servicedriven.ResiliencyServiceDrivenClient.fromNoneWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromNone", + "resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneOptional": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", + "resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneOptionalWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional", + "resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneRequired": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", + "resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneRequiredWithResponse": "Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired", + "resiliency.servicedriven.ResiliencyServiceDrivenClientBuilder": "Resiliency.ServiceDriven" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_metadata.json new file mode 100644 index 00000000000..15907f7f4a4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/resiliency-servicedriven_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"all","crossLanguageDefinitions":{"resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient":"Resiliency.ServiceDriven","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.addOperation":"Resiliency.ServiceDriven.addOperation","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.addOperationWithResponse":"Resiliency.ServiceDriven.addOperation","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromNone":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromNoneWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneOptional":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneOptionalWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneRequired":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.ResiliencyServiceDrivenAsyncClient.fromOneRequiredWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.ResiliencyServiceDrivenClient":"Resiliency.ServiceDriven","resiliency.servicedriven.ResiliencyServiceDrivenClient.addOperation":"Resiliency.ServiceDriven.addOperation","resiliency.servicedriven.ResiliencyServiceDrivenClient.addOperationWithResponse":"Resiliency.ServiceDriven.addOperation","resiliency.servicedriven.ResiliencyServiceDrivenClient.fromNone":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.ResiliencyServiceDrivenClient.fromNoneWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromNone","resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneOptional":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneOptionalWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneOptional","resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneRequired":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.ResiliencyServiceDrivenClient.fromOneRequiredWithResponse":"Resiliency.ServiceDriven.AddOptionalParam.fromOneRequired","resiliency.servicedriven.ResiliencyServiceDrivenClientBuilder":"Resiliency.ServiceDriven"},"generatedFiles":["src/main/java/module-info.java","src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenAsyncClient.java","src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClient.java","src/main/java/resiliency/servicedriven/ResiliencyServiceDrivenClientBuilder.java","src/main/java/resiliency/servicedriven/ServiceDrivenServiceVersion.java","src/main/java/resiliency/servicedriven/implementation/ResiliencyServiceDrivenClientImpl.java","src/main/java/resiliency/servicedriven/implementation/package-info.java","src/main/java/resiliency/servicedriven/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_apiview_properties.json new file mode 100644 index 00000000000..916a08548b1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_apiview_properties.json @@ -0,0 +1,16 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "response.statuscoderange.StatusCodeRangeAsyncClient": "Response.StatusCodeRange", + "response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCode404": "Response.StatusCodeRange.errorResponseStatusCode404", + "response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCode404WithResponse": "Response.StatusCodeRange.errorResponseStatusCode404", + "response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCodeInRange": "Response.StatusCodeRange.errorResponseStatusCodeInRange", + "response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCodeInRangeWithResponse": "Response.StatusCodeRange.errorResponseStatusCodeInRange", + "response.statuscoderange.StatusCodeRangeClient": "Response.StatusCodeRange", + "response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCode404": "Response.StatusCodeRange.errorResponseStatusCode404", + "response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCode404WithResponse": "Response.StatusCodeRange.errorResponseStatusCode404", + "response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCodeInRange": "Response.StatusCodeRange.errorResponseStatusCodeInRange", + "response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCodeInRangeWithResponse": "Response.StatusCodeRange.errorResponseStatusCodeInRange", + "response.statuscoderange.StatusCodeRangeClientBuilder": "Response.StatusCodeRange" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_metadata.json new file mode 100644 index 00000000000..15d6f0b192d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/response-statuscoderange_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"response.statuscoderange.StatusCodeRangeAsyncClient":"Response.StatusCodeRange","response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCode404":"Response.StatusCodeRange.errorResponseStatusCode404","response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCode404WithResponse":"Response.StatusCodeRange.errorResponseStatusCode404","response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCodeInRange":"Response.StatusCodeRange.errorResponseStatusCodeInRange","response.statuscoderange.StatusCodeRangeAsyncClient.errorResponseStatusCodeInRangeWithResponse":"Response.StatusCodeRange.errorResponseStatusCodeInRange","response.statuscoderange.StatusCodeRangeClient":"Response.StatusCodeRange","response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCode404":"Response.StatusCodeRange.errorResponseStatusCode404","response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCode404WithResponse":"Response.StatusCodeRange.errorResponseStatusCode404","response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCodeInRange":"Response.StatusCodeRange.errorResponseStatusCodeInRange","response.statuscoderange.StatusCodeRangeClient.errorResponseStatusCodeInRangeWithResponse":"Response.StatusCodeRange.errorResponseStatusCodeInRange","response.statuscoderange.StatusCodeRangeClientBuilder":"Response.StatusCodeRange"},"generatedFiles":["src/main/java/module-info.java","src/main/java/response/statuscoderange/StatusCodeRangeAsyncClient.java","src/main/java/response/statuscoderange/StatusCodeRangeClient.java","src/main/java/response/statuscoderange/StatusCodeRangeClientBuilder.java","src/main/java/response/statuscoderange/implementation/StatusCodeRangeClientImpl.java","src/main/java/response/statuscoderange/implementation/package-info.java","src/main/java/response/statuscoderange/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_apiview_properties.json new file mode 100644 index 00000000000..f2c4c80ec03 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_apiview_properties.json @@ -0,0 +1,224 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "routes.InInterfaceAsyncClient": "Routes.InInterface", + "routes.InInterfaceAsyncClient.fixed": "Routes.InInterface.fixed", + "routes.InInterfaceAsyncClient.fixedWithResponse": "Routes.InInterface.fixed", + "routes.InInterfaceClient": "Routes.InInterface", + "routes.InInterfaceClient.fixed": "Routes.InInterface.fixed", + "routes.InInterfaceClient.fixedWithResponse": "Routes.InInterface.fixed", + "routes.PathParametersAsyncClient": "Routes.PathParameters", + "routes.PathParametersAsyncClient.annotationOnly": "Routes.PathParameters.annotationOnly", + "routes.PathParametersAsyncClient.annotationOnlyWithResponse": "Routes.PathParameters.annotationOnly", + "routes.PathParametersAsyncClient.explicit": "Routes.PathParameters.explicit", + "routes.PathParametersAsyncClient.explicitWithResponse": "Routes.PathParameters.explicit", + "routes.PathParametersAsyncClient.templateOnly": "Routes.PathParameters.templateOnly", + "routes.PathParametersAsyncClient.templateOnlyWithResponse": "Routes.PathParameters.templateOnly", + "routes.PathParametersClient": "Routes.PathParameters", + "routes.PathParametersClient.annotationOnly": "Routes.PathParameters.annotationOnly", + "routes.PathParametersClient.annotationOnlyWithResponse": "Routes.PathParameters.annotationOnly", + "routes.PathParametersClient.explicit": "Routes.PathParameters.explicit", + "routes.PathParametersClient.explicitWithResponse": "Routes.PathParameters.explicit", + "routes.PathParametersClient.templateOnly": "Routes.PathParameters.templateOnly", + "routes.PathParametersClient.templateOnlyWithResponse": "Routes.PathParameters.templateOnly", + "routes.PathParametersLabelExpansionExplodeAsyncClient": "Routes.PathParameters.LabelExpansion.Explode", + "routes.PathParametersLabelExpansionExplodeAsyncClient.array": "Routes.PathParameters.LabelExpansion.Explode.array", + "routes.PathParametersLabelExpansionExplodeAsyncClient.arrayWithResponse": "Routes.PathParameters.LabelExpansion.Explode.array", + "routes.PathParametersLabelExpansionExplodeAsyncClient.primitive": "Routes.PathParameters.LabelExpansion.Explode.primitive", + "routes.PathParametersLabelExpansionExplodeAsyncClient.primitiveWithResponse": "Routes.PathParameters.LabelExpansion.Explode.primitive", + "routes.PathParametersLabelExpansionExplodeAsyncClient.record": "Routes.PathParameters.LabelExpansion.Explode.record", + "routes.PathParametersLabelExpansionExplodeAsyncClient.recordWithResponse": "Routes.PathParameters.LabelExpansion.Explode.record", + "routes.PathParametersLabelExpansionExplodeClient": "Routes.PathParameters.LabelExpansion.Explode", + "routes.PathParametersLabelExpansionExplodeClient.array": "Routes.PathParameters.LabelExpansion.Explode.array", + "routes.PathParametersLabelExpansionExplodeClient.arrayWithResponse": "Routes.PathParameters.LabelExpansion.Explode.array", + "routes.PathParametersLabelExpansionExplodeClient.primitive": "Routes.PathParameters.LabelExpansion.Explode.primitive", + "routes.PathParametersLabelExpansionExplodeClient.primitiveWithResponse": "Routes.PathParameters.LabelExpansion.Explode.primitive", + "routes.PathParametersLabelExpansionExplodeClient.record": "Routes.PathParameters.LabelExpansion.Explode.record", + "routes.PathParametersLabelExpansionExplodeClient.recordWithResponse": "Routes.PathParameters.LabelExpansion.Explode.record", + "routes.PathParametersLabelExpansionStandardAsyncClient": "Routes.PathParameters.LabelExpansion.Standard", + "routes.PathParametersLabelExpansionStandardAsyncClient.array": "Routes.PathParameters.LabelExpansion.Standard.array", + "routes.PathParametersLabelExpansionStandardAsyncClient.arrayWithResponse": "Routes.PathParameters.LabelExpansion.Standard.array", + "routes.PathParametersLabelExpansionStandardAsyncClient.primitive": "Routes.PathParameters.LabelExpansion.Standard.primitive", + "routes.PathParametersLabelExpansionStandardAsyncClient.primitiveWithResponse": "Routes.PathParameters.LabelExpansion.Standard.primitive", + "routes.PathParametersLabelExpansionStandardAsyncClient.record": "Routes.PathParameters.LabelExpansion.Standard.record", + "routes.PathParametersLabelExpansionStandardAsyncClient.recordWithResponse": "Routes.PathParameters.LabelExpansion.Standard.record", + "routes.PathParametersLabelExpansionStandardClient": "Routes.PathParameters.LabelExpansion.Standard", + "routes.PathParametersLabelExpansionStandardClient.array": "Routes.PathParameters.LabelExpansion.Standard.array", + "routes.PathParametersLabelExpansionStandardClient.arrayWithResponse": "Routes.PathParameters.LabelExpansion.Standard.array", + "routes.PathParametersLabelExpansionStandardClient.primitive": "Routes.PathParameters.LabelExpansion.Standard.primitive", + "routes.PathParametersLabelExpansionStandardClient.primitiveWithResponse": "Routes.PathParameters.LabelExpansion.Standard.primitive", + "routes.PathParametersLabelExpansionStandardClient.record": "Routes.PathParameters.LabelExpansion.Standard.record", + "routes.PathParametersLabelExpansionStandardClient.recordWithResponse": "Routes.PathParameters.LabelExpansion.Standard.record", + "routes.PathParametersMatrixExpansionExplodeAsyncClient": "Routes.PathParameters.MatrixExpansion.Explode", + "routes.PathParametersMatrixExpansionExplodeAsyncClient.array": "Routes.PathParameters.MatrixExpansion.Explode.array", + "routes.PathParametersMatrixExpansionExplodeAsyncClient.arrayWithResponse": "Routes.PathParameters.MatrixExpansion.Explode.array", + "routes.PathParametersMatrixExpansionExplodeAsyncClient.primitive": "Routes.PathParameters.MatrixExpansion.Explode.primitive", + "routes.PathParametersMatrixExpansionExplodeAsyncClient.primitiveWithResponse": "Routes.PathParameters.MatrixExpansion.Explode.primitive", + "routes.PathParametersMatrixExpansionExplodeAsyncClient.record": "Routes.PathParameters.MatrixExpansion.Explode.record", + "routes.PathParametersMatrixExpansionExplodeAsyncClient.recordWithResponse": "Routes.PathParameters.MatrixExpansion.Explode.record", + "routes.PathParametersMatrixExpansionExplodeClient": "Routes.PathParameters.MatrixExpansion.Explode", + "routes.PathParametersMatrixExpansionExplodeClient.array": "Routes.PathParameters.MatrixExpansion.Explode.array", + "routes.PathParametersMatrixExpansionExplodeClient.arrayWithResponse": "Routes.PathParameters.MatrixExpansion.Explode.array", + "routes.PathParametersMatrixExpansionExplodeClient.primitive": "Routes.PathParameters.MatrixExpansion.Explode.primitive", + "routes.PathParametersMatrixExpansionExplodeClient.primitiveWithResponse": "Routes.PathParameters.MatrixExpansion.Explode.primitive", + "routes.PathParametersMatrixExpansionExplodeClient.record": "Routes.PathParameters.MatrixExpansion.Explode.record", + "routes.PathParametersMatrixExpansionExplodeClient.recordWithResponse": "Routes.PathParameters.MatrixExpansion.Explode.record", + "routes.PathParametersMatrixExpansionStandardAsyncClient": "Routes.PathParameters.MatrixExpansion.Standard", + "routes.PathParametersMatrixExpansionStandardAsyncClient.array": "Routes.PathParameters.MatrixExpansion.Standard.array", + "routes.PathParametersMatrixExpansionStandardAsyncClient.arrayWithResponse": "Routes.PathParameters.MatrixExpansion.Standard.array", + "routes.PathParametersMatrixExpansionStandardAsyncClient.primitive": "Routes.PathParameters.MatrixExpansion.Standard.primitive", + "routes.PathParametersMatrixExpansionStandardAsyncClient.primitiveWithResponse": "Routes.PathParameters.MatrixExpansion.Standard.primitive", + "routes.PathParametersMatrixExpansionStandardAsyncClient.record": "Routes.PathParameters.MatrixExpansion.Standard.record", + "routes.PathParametersMatrixExpansionStandardAsyncClient.recordWithResponse": "Routes.PathParameters.MatrixExpansion.Standard.record", + "routes.PathParametersMatrixExpansionStandardClient": "Routes.PathParameters.MatrixExpansion.Standard", + "routes.PathParametersMatrixExpansionStandardClient.array": "Routes.PathParameters.MatrixExpansion.Standard.array", + "routes.PathParametersMatrixExpansionStandardClient.arrayWithResponse": "Routes.PathParameters.MatrixExpansion.Standard.array", + "routes.PathParametersMatrixExpansionStandardClient.primitive": "Routes.PathParameters.MatrixExpansion.Standard.primitive", + "routes.PathParametersMatrixExpansionStandardClient.primitiveWithResponse": "Routes.PathParameters.MatrixExpansion.Standard.primitive", + "routes.PathParametersMatrixExpansionStandardClient.record": "Routes.PathParameters.MatrixExpansion.Standard.record", + "routes.PathParametersMatrixExpansionStandardClient.recordWithResponse": "Routes.PathParameters.MatrixExpansion.Standard.record", + "routes.PathParametersPathExpansionExplodeAsyncClient": "Routes.PathParameters.PathExpansion.Explode", + "routes.PathParametersPathExpansionExplodeAsyncClient.array": "Routes.PathParameters.PathExpansion.Explode.array", + "routes.PathParametersPathExpansionExplodeAsyncClient.arrayWithResponse": "Routes.PathParameters.PathExpansion.Explode.array", + "routes.PathParametersPathExpansionExplodeAsyncClient.primitive": "Routes.PathParameters.PathExpansion.Explode.primitive", + "routes.PathParametersPathExpansionExplodeAsyncClient.primitiveWithResponse": "Routes.PathParameters.PathExpansion.Explode.primitive", + "routes.PathParametersPathExpansionExplodeAsyncClient.record": "Routes.PathParameters.PathExpansion.Explode.record", + "routes.PathParametersPathExpansionExplodeAsyncClient.recordWithResponse": "Routes.PathParameters.PathExpansion.Explode.record", + "routes.PathParametersPathExpansionExplodeClient": "Routes.PathParameters.PathExpansion.Explode", + "routes.PathParametersPathExpansionExplodeClient.array": "Routes.PathParameters.PathExpansion.Explode.array", + "routes.PathParametersPathExpansionExplodeClient.arrayWithResponse": "Routes.PathParameters.PathExpansion.Explode.array", + "routes.PathParametersPathExpansionExplodeClient.primitive": "Routes.PathParameters.PathExpansion.Explode.primitive", + "routes.PathParametersPathExpansionExplodeClient.primitiveWithResponse": "Routes.PathParameters.PathExpansion.Explode.primitive", + "routes.PathParametersPathExpansionExplodeClient.record": "Routes.PathParameters.PathExpansion.Explode.record", + "routes.PathParametersPathExpansionExplodeClient.recordWithResponse": "Routes.PathParameters.PathExpansion.Explode.record", + "routes.PathParametersPathExpansionStandardAsyncClient": "Routes.PathParameters.PathExpansion.Standard", + "routes.PathParametersPathExpansionStandardAsyncClient.array": "Routes.PathParameters.PathExpansion.Standard.array", + "routes.PathParametersPathExpansionStandardAsyncClient.arrayWithResponse": "Routes.PathParameters.PathExpansion.Standard.array", + "routes.PathParametersPathExpansionStandardAsyncClient.primitive": "Routes.PathParameters.PathExpansion.Standard.primitive", + "routes.PathParametersPathExpansionStandardAsyncClient.primitiveWithResponse": "Routes.PathParameters.PathExpansion.Standard.primitive", + "routes.PathParametersPathExpansionStandardAsyncClient.record": "Routes.PathParameters.PathExpansion.Standard.record", + "routes.PathParametersPathExpansionStandardAsyncClient.recordWithResponse": "Routes.PathParameters.PathExpansion.Standard.record", + "routes.PathParametersPathExpansionStandardClient": "Routes.PathParameters.PathExpansion.Standard", + "routes.PathParametersPathExpansionStandardClient.array": "Routes.PathParameters.PathExpansion.Standard.array", + "routes.PathParametersPathExpansionStandardClient.arrayWithResponse": "Routes.PathParameters.PathExpansion.Standard.array", + "routes.PathParametersPathExpansionStandardClient.primitive": "Routes.PathParameters.PathExpansion.Standard.primitive", + "routes.PathParametersPathExpansionStandardClient.primitiveWithResponse": "Routes.PathParameters.PathExpansion.Standard.primitive", + "routes.PathParametersPathExpansionStandardClient.record": "Routes.PathParameters.PathExpansion.Standard.record", + "routes.PathParametersPathExpansionStandardClient.recordWithResponse": "Routes.PathParameters.PathExpansion.Standard.record", + "routes.PathParametersReservedExpansionAsyncClient": "Routes.PathParameters.ReservedExpansion", + "routes.PathParametersReservedExpansionAsyncClient.annotation": "Routes.PathParameters.ReservedExpansion.annotation", + "routes.PathParametersReservedExpansionAsyncClient.annotationWithResponse": "Routes.PathParameters.ReservedExpansion.annotation", + "routes.PathParametersReservedExpansionAsyncClient.template": "Routes.PathParameters.ReservedExpansion.template", + "routes.PathParametersReservedExpansionAsyncClient.templateWithResponse": "Routes.PathParameters.ReservedExpansion.template", + "routes.PathParametersReservedExpansionClient": "Routes.PathParameters.ReservedExpansion", + "routes.PathParametersReservedExpansionClient.annotation": "Routes.PathParameters.ReservedExpansion.annotation", + "routes.PathParametersReservedExpansionClient.annotationWithResponse": "Routes.PathParameters.ReservedExpansion.annotation", + "routes.PathParametersReservedExpansionClient.template": "Routes.PathParameters.ReservedExpansion.template", + "routes.PathParametersReservedExpansionClient.templateWithResponse": "Routes.PathParameters.ReservedExpansion.template", + "routes.PathParametersSimpleExpansionExplodeAsyncClient": "Routes.PathParameters.SimpleExpansion.Explode", + "routes.PathParametersSimpleExpansionExplodeAsyncClient.array": "Routes.PathParameters.SimpleExpansion.Explode.array", + "routes.PathParametersSimpleExpansionExplodeAsyncClient.arrayWithResponse": "Routes.PathParameters.SimpleExpansion.Explode.array", + "routes.PathParametersSimpleExpansionExplodeAsyncClient.primitive": "Routes.PathParameters.SimpleExpansion.Explode.primitive", + "routes.PathParametersSimpleExpansionExplodeAsyncClient.primitiveWithResponse": "Routes.PathParameters.SimpleExpansion.Explode.primitive", + "routes.PathParametersSimpleExpansionExplodeAsyncClient.record": "Routes.PathParameters.SimpleExpansion.Explode.record", + "routes.PathParametersSimpleExpansionExplodeAsyncClient.recordWithResponse": "Routes.PathParameters.SimpleExpansion.Explode.record", + "routes.PathParametersSimpleExpansionExplodeClient": "Routes.PathParameters.SimpleExpansion.Explode", + "routes.PathParametersSimpleExpansionExplodeClient.array": "Routes.PathParameters.SimpleExpansion.Explode.array", + "routes.PathParametersSimpleExpansionExplodeClient.arrayWithResponse": "Routes.PathParameters.SimpleExpansion.Explode.array", + "routes.PathParametersSimpleExpansionExplodeClient.primitive": "Routes.PathParameters.SimpleExpansion.Explode.primitive", + "routes.PathParametersSimpleExpansionExplodeClient.primitiveWithResponse": "Routes.PathParameters.SimpleExpansion.Explode.primitive", + "routes.PathParametersSimpleExpansionExplodeClient.record": "Routes.PathParameters.SimpleExpansion.Explode.record", + "routes.PathParametersSimpleExpansionExplodeClient.recordWithResponse": "Routes.PathParameters.SimpleExpansion.Explode.record", + "routes.PathParametersSimpleExpansionStandardAsyncClient": "Routes.PathParameters.SimpleExpansion.Standard", + "routes.PathParametersSimpleExpansionStandardAsyncClient.array": "Routes.PathParameters.SimpleExpansion.Standard.array", + "routes.PathParametersSimpleExpansionStandardAsyncClient.arrayWithResponse": "Routes.PathParameters.SimpleExpansion.Standard.array", + "routes.PathParametersSimpleExpansionStandardAsyncClient.primitive": "Routes.PathParameters.SimpleExpansion.Standard.primitive", + "routes.PathParametersSimpleExpansionStandardAsyncClient.primitiveWithResponse": "Routes.PathParameters.SimpleExpansion.Standard.primitive", + "routes.PathParametersSimpleExpansionStandardAsyncClient.record": "Routes.PathParameters.SimpleExpansion.Standard.record", + "routes.PathParametersSimpleExpansionStandardAsyncClient.recordWithResponse": "Routes.PathParameters.SimpleExpansion.Standard.record", + "routes.PathParametersSimpleExpansionStandardClient": "Routes.PathParameters.SimpleExpansion.Standard", + "routes.PathParametersSimpleExpansionStandardClient.array": "Routes.PathParameters.SimpleExpansion.Standard.array", + "routes.PathParametersSimpleExpansionStandardClient.arrayWithResponse": "Routes.PathParameters.SimpleExpansion.Standard.array", + "routes.PathParametersSimpleExpansionStandardClient.primitive": "Routes.PathParameters.SimpleExpansion.Standard.primitive", + "routes.PathParametersSimpleExpansionStandardClient.primitiveWithResponse": "Routes.PathParameters.SimpleExpansion.Standard.primitive", + "routes.PathParametersSimpleExpansionStandardClient.record": "Routes.PathParameters.SimpleExpansion.Standard.record", + "routes.PathParametersSimpleExpansionStandardClient.recordWithResponse": "Routes.PathParameters.SimpleExpansion.Standard.record", + "routes.QueryParametersAsyncClient": "Routes.QueryParameters", + "routes.QueryParametersAsyncClient.annotationOnly": "Routes.QueryParameters.annotationOnly", + "routes.QueryParametersAsyncClient.annotationOnlyWithResponse": "Routes.QueryParameters.annotationOnly", + "routes.QueryParametersAsyncClient.explicit": "Routes.QueryParameters.explicit", + "routes.QueryParametersAsyncClient.explicitWithResponse": "Routes.QueryParameters.explicit", + "routes.QueryParametersAsyncClient.templateOnly": "Routes.QueryParameters.templateOnly", + "routes.QueryParametersAsyncClient.templateOnlyWithResponse": "Routes.QueryParameters.templateOnly", + "routes.QueryParametersClient": "Routes.QueryParameters", + "routes.QueryParametersClient.annotationOnly": "Routes.QueryParameters.annotationOnly", + "routes.QueryParametersClient.annotationOnlyWithResponse": "Routes.QueryParameters.annotationOnly", + "routes.QueryParametersClient.explicit": "Routes.QueryParameters.explicit", + "routes.QueryParametersClient.explicitWithResponse": "Routes.QueryParameters.explicit", + "routes.QueryParametersClient.templateOnly": "Routes.QueryParameters.templateOnly", + "routes.QueryParametersClient.templateOnlyWithResponse": "Routes.QueryParameters.templateOnly", + "routes.QueryParametersQueryContinuationExplodeAsyncClient": "Routes.QueryParameters.QueryContinuation.Explode", + "routes.QueryParametersQueryContinuationExplodeAsyncClient.array": "Routes.QueryParameters.QueryContinuation.Explode.array", + "routes.QueryParametersQueryContinuationExplodeAsyncClient.arrayWithResponse": "Routes.QueryParameters.QueryContinuation.Explode.array", + "routes.QueryParametersQueryContinuationExplodeAsyncClient.primitive": "Routes.QueryParameters.QueryContinuation.Explode.primitive", + "routes.QueryParametersQueryContinuationExplodeAsyncClient.primitiveWithResponse": "Routes.QueryParameters.QueryContinuation.Explode.primitive", + "routes.QueryParametersQueryContinuationExplodeAsyncClient.record": "Routes.QueryParameters.QueryContinuation.Explode.record", + "routes.QueryParametersQueryContinuationExplodeAsyncClient.recordWithResponse": "Routes.QueryParameters.QueryContinuation.Explode.record", + "routes.QueryParametersQueryContinuationExplodeClient": "Routes.QueryParameters.QueryContinuation.Explode", + "routes.QueryParametersQueryContinuationExplodeClient.array": "Routes.QueryParameters.QueryContinuation.Explode.array", + "routes.QueryParametersQueryContinuationExplodeClient.arrayWithResponse": "Routes.QueryParameters.QueryContinuation.Explode.array", + "routes.QueryParametersQueryContinuationExplodeClient.primitive": "Routes.QueryParameters.QueryContinuation.Explode.primitive", + "routes.QueryParametersQueryContinuationExplodeClient.primitiveWithResponse": "Routes.QueryParameters.QueryContinuation.Explode.primitive", + "routes.QueryParametersQueryContinuationExplodeClient.record": "Routes.QueryParameters.QueryContinuation.Explode.record", + "routes.QueryParametersQueryContinuationExplodeClient.recordWithResponse": "Routes.QueryParameters.QueryContinuation.Explode.record", + "routes.QueryParametersQueryContinuationStandardAsyncClient": "Routes.QueryParameters.QueryContinuation.Standard", + "routes.QueryParametersQueryContinuationStandardAsyncClient.array": "Routes.QueryParameters.QueryContinuation.Standard.array", + "routes.QueryParametersQueryContinuationStandardAsyncClient.arrayWithResponse": "Routes.QueryParameters.QueryContinuation.Standard.array", + "routes.QueryParametersQueryContinuationStandardAsyncClient.primitive": "Routes.QueryParameters.QueryContinuation.Standard.primitive", + "routes.QueryParametersQueryContinuationStandardAsyncClient.primitiveWithResponse": "Routes.QueryParameters.QueryContinuation.Standard.primitive", + "routes.QueryParametersQueryContinuationStandardAsyncClient.record": "Routes.QueryParameters.QueryContinuation.Standard.record", + "routes.QueryParametersQueryContinuationStandardAsyncClient.recordWithResponse": "Routes.QueryParameters.QueryContinuation.Standard.record", + "routes.QueryParametersQueryContinuationStandardClient": "Routes.QueryParameters.QueryContinuation.Standard", + "routes.QueryParametersQueryContinuationStandardClient.array": "Routes.QueryParameters.QueryContinuation.Standard.array", + "routes.QueryParametersQueryContinuationStandardClient.arrayWithResponse": "Routes.QueryParameters.QueryContinuation.Standard.array", + "routes.QueryParametersQueryContinuationStandardClient.primitive": "Routes.QueryParameters.QueryContinuation.Standard.primitive", + "routes.QueryParametersQueryContinuationStandardClient.primitiveWithResponse": "Routes.QueryParameters.QueryContinuation.Standard.primitive", + "routes.QueryParametersQueryContinuationStandardClient.record": "Routes.QueryParameters.QueryContinuation.Standard.record", + "routes.QueryParametersQueryContinuationStandardClient.recordWithResponse": "Routes.QueryParameters.QueryContinuation.Standard.record", + "routes.QueryParametersQueryExpansionExplodeAsyncClient": "Routes.QueryParameters.QueryExpansion.Explode", + "routes.QueryParametersQueryExpansionExplodeAsyncClient.array": "Routes.QueryParameters.QueryExpansion.Explode.array", + "routes.QueryParametersQueryExpansionExplodeAsyncClient.arrayWithResponse": "Routes.QueryParameters.QueryExpansion.Explode.array", + "routes.QueryParametersQueryExpansionExplodeAsyncClient.primitive": "Routes.QueryParameters.QueryExpansion.Explode.primitive", + "routes.QueryParametersQueryExpansionExplodeAsyncClient.primitiveWithResponse": "Routes.QueryParameters.QueryExpansion.Explode.primitive", + "routes.QueryParametersQueryExpansionExplodeAsyncClient.record": "Routes.QueryParameters.QueryExpansion.Explode.record", + "routes.QueryParametersQueryExpansionExplodeAsyncClient.recordWithResponse": "Routes.QueryParameters.QueryExpansion.Explode.record", + "routes.QueryParametersQueryExpansionExplodeClient": "Routes.QueryParameters.QueryExpansion.Explode", + "routes.QueryParametersQueryExpansionExplodeClient.array": "Routes.QueryParameters.QueryExpansion.Explode.array", + "routes.QueryParametersQueryExpansionExplodeClient.arrayWithResponse": "Routes.QueryParameters.QueryExpansion.Explode.array", + "routes.QueryParametersQueryExpansionExplodeClient.primitive": "Routes.QueryParameters.QueryExpansion.Explode.primitive", + "routes.QueryParametersQueryExpansionExplodeClient.primitiveWithResponse": "Routes.QueryParameters.QueryExpansion.Explode.primitive", + "routes.QueryParametersQueryExpansionExplodeClient.record": "Routes.QueryParameters.QueryExpansion.Explode.record", + "routes.QueryParametersQueryExpansionExplodeClient.recordWithResponse": "Routes.QueryParameters.QueryExpansion.Explode.record", + "routes.QueryParametersQueryExpansionStandardAsyncClient": "Routes.QueryParameters.QueryExpansion.Standard", + "routes.QueryParametersQueryExpansionStandardAsyncClient.array": "Routes.QueryParameters.QueryExpansion.Standard.array", + "routes.QueryParametersQueryExpansionStandardAsyncClient.arrayWithResponse": "Routes.QueryParameters.QueryExpansion.Standard.array", + "routes.QueryParametersQueryExpansionStandardAsyncClient.primitive": "Routes.QueryParameters.QueryExpansion.Standard.primitive", + "routes.QueryParametersQueryExpansionStandardAsyncClient.primitiveWithResponse": "Routes.QueryParameters.QueryExpansion.Standard.primitive", + "routes.QueryParametersQueryExpansionStandardAsyncClient.record": "Routes.QueryParameters.QueryExpansion.Standard.record", + "routes.QueryParametersQueryExpansionStandardAsyncClient.recordWithResponse": "Routes.QueryParameters.QueryExpansion.Standard.record", + "routes.QueryParametersQueryExpansionStandardClient": "Routes.QueryParameters.QueryExpansion.Standard", + "routes.QueryParametersQueryExpansionStandardClient.array": "Routes.QueryParameters.QueryExpansion.Standard.array", + "routes.QueryParametersQueryExpansionStandardClient.arrayWithResponse": "Routes.QueryParameters.QueryExpansion.Standard.array", + "routes.QueryParametersQueryExpansionStandardClient.primitive": "Routes.QueryParameters.QueryExpansion.Standard.primitive", + "routes.QueryParametersQueryExpansionStandardClient.primitiveWithResponse": "Routes.QueryParameters.QueryExpansion.Standard.primitive", + "routes.QueryParametersQueryExpansionStandardClient.record": "Routes.QueryParameters.QueryExpansion.Standard.record", + "routes.QueryParametersQueryExpansionStandardClient.recordWithResponse": "Routes.QueryParameters.QueryExpansion.Standard.record", + "routes.RoutesAsyncClient": "Routes", + "routes.RoutesAsyncClient.fixed": "Routes.fixed", + "routes.RoutesAsyncClient.fixedWithResponse": "Routes.fixed", + "routes.RoutesClient": "Routes", + "routes.RoutesClient.fixed": "Routes.fixed", + "routes.RoutesClient.fixedWithResponse": "Routes.fixed", + "routes.RoutesClientBuilder": "Routes" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_metadata.json new file mode 100644 index 00000000000..1e82f42b581 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/routes_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"routes.InInterfaceAsyncClient":"Routes.InInterface","routes.InInterfaceAsyncClient.fixed":"Routes.InInterface.fixed","routes.InInterfaceAsyncClient.fixedWithResponse":"Routes.InInterface.fixed","routes.InInterfaceClient":"Routes.InInterface","routes.InInterfaceClient.fixed":"Routes.InInterface.fixed","routes.InInterfaceClient.fixedWithResponse":"Routes.InInterface.fixed","routes.PathParametersAsyncClient":"Routes.PathParameters","routes.PathParametersAsyncClient.annotationOnly":"Routes.PathParameters.annotationOnly","routes.PathParametersAsyncClient.annotationOnlyWithResponse":"Routes.PathParameters.annotationOnly","routes.PathParametersAsyncClient.explicit":"Routes.PathParameters.explicit","routes.PathParametersAsyncClient.explicitWithResponse":"Routes.PathParameters.explicit","routes.PathParametersAsyncClient.templateOnly":"Routes.PathParameters.templateOnly","routes.PathParametersAsyncClient.templateOnlyWithResponse":"Routes.PathParameters.templateOnly","routes.PathParametersClient":"Routes.PathParameters","routes.PathParametersClient.annotationOnly":"Routes.PathParameters.annotationOnly","routes.PathParametersClient.annotationOnlyWithResponse":"Routes.PathParameters.annotationOnly","routes.PathParametersClient.explicit":"Routes.PathParameters.explicit","routes.PathParametersClient.explicitWithResponse":"Routes.PathParameters.explicit","routes.PathParametersClient.templateOnly":"Routes.PathParameters.templateOnly","routes.PathParametersClient.templateOnlyWithResponse":"Routes.PathParameters.templateOnly","routes.PathParametersLabelExpansionExplodeAsyncClient":"Routes.PathParameters.LabelExpansion.Explode","routes.PathParametersLabelExpansionExplodeAsyncClient.array":"Routes.PathParameters.LabelExpansion.Explode.array","routes.PathParametersLabelExpansionExplodeAsyncClient.arrayWithResponse":"Routes.PathParameters.LabelExpansion.Explode.array","routes.PathParametersLabelExpansionExplodeAsyncClient.primitive":"Routes.PathParameters.LabelExpansion.Explode.primitive","routes.PathParametersLabelExpansionExplodeAsyncClient.primitiveWithResponse":"Routes.PathParameters.LabelExpansion.Explode.primitive","routes.PathParametersLabelExpansionExplodeAsyncClient.record":"Routes.PathParameters.LabelExpansion.Explode.record","routes.PathParametersLabelExpansionExplodeAsyncClient.recordWithResponse":"Routes.PathParameters.LabelExpansion.Explode.record","routes.PathParametersLabelExpansionExplodeClient":"Routes.PathParameters.LabelExpansion.Explode","routes.PathParametersLabelExpansionExplodeClient.array":"Routes.PathParameters.LabelExpansion.Explode.array","routes.PathParametersLabelExpansionExplodeClient.arrayWithResponse":"Routes.PathParameters.LabelExpansion.Explode.array","routes.PathParametersLabelExpansionExplodeClient.primitive":"Routes.PathParameters.LabelExpansion.Explode.primitive","routes.PathParametersLabelExpansionExplodeClient.primitiveWithResponse":"Routes.PathParameters.LabelExpansion.Explode.primitive","routes.PathParametersLabelExpansionExplodeClient.record":"Routes.PathParameters.LabelExpansion.Explode.record","routes.PathParametersLabelExpansionExplodeClient.recordWithResponse":"Routes.PathParameters.LabelExpansion.Explode.record","routes.PathParametersLabelExpansionStandardAsyncClient":"Routes.PathParameters.LabelExpansion.Standard","routes.PathParametersLabelExpansionStandardAsyncClient.array":"Routes.PathParameters.LabelExpansion.Standard.array","routes.PathParametersLabelExpansionStandardAsyncClient.arrayWithResponse":"Routes.PathParameters.LabelExpansion.Standard.array","routes.PathParametersLabelExpansionStandardAsyncClient.primitive":"Routes.PathParameters.LabelExpansion.Standard.primitive","routes.PathParametersLabelExpansionStandardAsyncClient.primitiveWithResponse":"Routes.PathParameters.LabelExpansion.Standard.primitive","routes.PathParametersLabelExpansionStandardAsyncClient.record":"Routes.PathParameters.LabelExpansion.Standard.record","routes.PathParametersLabelExpansionStandardAsyncClient.recordWithResponse":"Routes.PathParameters.LabelExpansion.Standard.record","routes.PathParametersLabelExpansionStandardClient":"Routes.PathParameters.LabelExpansion.Standard","routes.PathParametersLabelExpansionStandardClient.array":"Routes.PathParameters.LabelExpansion.Standard.array","routes.PathParametersLabelExpansionStandardClient.arrayWithResponse":"Routes.PathParameters.LabelExpansion.Standard.array","routes.PathParametersLabelExpansionStandardClient.primitive":"Routes.PathParameters.LabelExpansion.Standard.primitive","routes.PathParametersLabelExpansionStandardClient.primitiveWithResponse":"Routes.PathParameters.LabelExpansion.Standard.primitive","routes.PathParametersLabelExpansionStandardClient.record":"Routes.PathParameters.LabelExpansion.Standard.record","routes.PathParametersLabelExpansionStandardClient.recordWithResponse":"Routes.PathParameters.LabelExpansion.Standard.record","routes.PathParametersMatrixExpansionExplodeAsyncClient":"Routes.PathParameters.MatrixExpansion.Explode","routes.PathParametersMatrixExpansionExplodeAsyncClient.array":"Routes.PathParameters.MatrixExpansion.Explode.array","routes.PathParametersMatrixExpansionExplodeAsyncClient.arrayWithResponse":"Routes.PathParameters.MatrixExpansion.Explode.array","routes.PathParametersMatrixExpansionExplodeAsyncClient.primitive":"Routes.PathParameters.MatrixExpansion.Explode.primitive","routes.PathParametersMatrixExpansionExplodeAsyncClient.primitiveWithResponse":"Routes.PathParameters.MatrixExpansion.Explode.primitive","routes.PathParametersMatrixExpansionExplodeAsyncClient.record":"Routes.PathParameters.MatrixExpansion.Explode.record","routes.PathParametersMatrixExpansionExplodeAsyncClient.recordWithResponse":"Routes.PathParameters.MatrixExpansion.Explode.record","routes.PathParametersMatrixExpansionExplodeClient":"Routes.PathParameters.MatrixExpansion.Explode","routes.PathParametersMatrixExpansionExplodeClient.array":"Routes.PathParameters.MatrixExpansion.Explode.array","routes.PathParametersMatrixExpansionExplodeClient.arrayWithResponse":"Routes.PathParameters.MatrixExpansion.Explode.array","routes.PathParametersMatrixExpansionExplodeClient.primitive":"Routes.PathParameters.MatrixExpansion.Explode.primitive","routes.PathParametersMatrixExpansionExplodeClient.primitiveWithResponse":"Routes.PathParameters.MatrixExpansion.Explode.primitive","routes.PathParametersMatrixExpansionExplodeClient.record":"Routes.PathParameters.MatrixExpansion.Explode.record","routes.PathParametersMatrixExpansionExplodeClient.recordWithResponse":"Routes.PathParameters.MatrixExpansion.Explode.record","routes.PathParametersMatrixExpansionStandardAsyncClient":"Routes.PathParameters.MatrixExpansion.Standard","routes.PathParametersMatrixExpansionStandardAsyncClient.array":"Routes.PathParameters.MatrixExpansion.Standard.array","routes.PathParametersMatrixExpansionStandardAsyncClient.arrayWithResponse":"Routes.PathParameters.MatrixExpansion.Standard.array","routes.PathParametersMatrixExpansionStandardAsyncClient.primitive":"Routes.PathParameters.MatrixExpansion.Standard.primitive","routes.PathParametersMatrixExpansionStandardAsyncClient.primitiveWithResponse":"Routes.PathParameters.MatrixExpansion.Standard.primitive","routes.PathParametersMatrixExpansionStandardAsyncClient.record":"Routes.PathParameters.MatrixExpansion.Standard.record","routes.PathParametersMatrixExpansionStandardAsyncClient.recordWithResponse":"Routes.PathParameters.MatrixExpansion.Standard.record","routes.PathParametersMatrixExpansionStandardClient":"Routes.PathParameters.MatrixExpansion.Standard","routes.PathParametersMatrixExpansionStandardClient.array":"Routes.PathParameters.MatrixExpansion.Standard.array","routes.PathParametersMatrixExpansionStandardClient.arrayWithResponse":"Routes.PathParameters.MatrixExpansion.Standard.array","routes.PathParametersMatrixExpansionStandardClient.primitive":"Routes.PathParameters.MatrixExpansion.Standard.primitive","routes.PathParametersMatrixExpansionStandardClient.primitiveWithResponse":"Routes.PathParameters.MatrixExpansion.Standard.primitive","routes.PathParametersMatrixExpansionStandardClient.record":"Routes.PathParameters.MatrixExpansion.Standard.record","routes.PathParametersMatrixExpansionStandardClient.recordWithResponse":"Routes.PathParameters.MatrixExpansion.Standard.record","routes.PathParametersPathExpansionExplodeAsyncClient":"Routes.PathParameters.PathExpansion.Explode","routes.PathParametersPathExpansionExplodeAsyncClient.array":"Routes.PathParameters.PathExpansion.Explode.array","routes.PathParametersPathExpansionExplodeAsyncClient.arrayWithResponse":"Routes.PathParameters.PathExpansion.Explode.array","routes.PathParametersPathExpansionExplodeAsyncClient.primitive":"Routes.PathParameters.PathExpansion.Explode.primitive","routes.PathParametersPathExpansionExplodeAsyncClient.primitiveWithResponse":"Routes.PathParameters.PathExpansion.Explode.primitive","routes.PathParametersPathExpansionExplodeAsyncClient.record":"Routes.PathParameters.PathExpansion.Explode.record","routes.PathParametersPathExpansionExplodeAsyncClient.recordWithResponse":"Routes.PathParameters.PathExpansion.Explode.record","routes.PathParametersPathExpansionExplodeClient":"Routes.PathParameters.PathExpansion.Explode","routes.PathParametersPathExpansionExplodeClient.array":"Routes.PathParameters.PathExpansion.Explode.array","routes.PathParametersPathExpansionExplodeClient.arrayWithResponse":"Routes.PathParameters.PathExpansion.Explode.array","routes.PathParametersPathExpansionExplodeClient.primitive":"Routes.PathParameters.PathExpansion.Explode.primitive","routes.PathParametersPathExpansionExplodeClient.primitiveWithResponse":"Routes.PathParameters.PathExpansion.Explode.primitive","routes.PathParametersPathExpansionExplodeClient.record":"Routes.PathParameters.PathExpansion.Explode.record","routes.PathParametersPathExpansionExplodeClient.recordWithResponse":"Routes.PathParameters.PathExpansion.Explode.record","routes.PathParametersPathExpansionStandardAsyncClient":"Routes.PathParameters.PathExpansion.Standard","routes.PathParametersPathExpansionStandardAsyncClient.array":"Routes.PathParameters.PathExpansion.Standard.array","routes.PathParametersPathExpansionStandardAsyncClient.arrayWithResponse":"Routes.PathParameters.PathExpansion.Standard.array","routes.PathParametersPathExpansionStandardAsyncClient.primitive":"Routes.PathParameters.PathExpansion.Standard.primitive","routes.PathParametersPathExpansionStandardAsyncClient.primitiveWithResponse":"Routes.PathParameters.PathExpansion.Standard.primitive","routes.PathParametersPathExpansionStandardAsyncClient.record":"Routes.PathParameters.PathExpansion.Standard.record","routes.PathParametersPathExpansionStandardAsyncClient.recordWithResponse":"Routes.PathParameters.PathExpansion.Standard.record","routes.PathParametersPathExpansionStandardClient":"Routes.PathParameters.PathExpansion.Standard","routes.PathParametersPathExpansionStandardClient.array":"Routes.PathParameters.PathExpansion.Standard.array","routes.PathParametersPathExpansionStandardClient.arrayWithResponse":"Routes.PathParameters.PathExpansion.Standard.array","routes.PathParametersPathExpansionStandardClient.primitive":"Routes.PathParameters.PathExpansion.Standard.primitive","routes.PathParametersPathExpansionStandardClient.primitiveWithResponse":"Routes.PathParameters.PathExpansion.Standard.primitive","routes.PathParametersPathExpansionStandardClient.record":"Routes.PathParameters.PathExpansion.Standard.record","routes.PathParametersPathExpansionStandardClient.recordWithResponse":"Routes.PathParameters.PathExpansion.Standard.record","routes.PathParametersReservedExpansionAsyncClient":"Routes.PathParameters.ReservedExpansion","routes.PathParametersReservedExpansionAsyncClient.annotation":"Routes.PathParameters.ReservedExpansion.annotation","routes.PathParametersReservedExpansionAsyncClient.annotationWithResponse":"Routes.PathParameters.ReservedExpansion.annotation","routes.PathParametersReservedExpansionAsyncClient.template":"Routes.PathParameters.ReservedExpansion.template","routes.PathParametersReservedExpansionAsyncClient.templateWithResponse":"Routes.PathParameters.ReservedExpansion.template","routes.PathParametersReservedExpansionClient":"Routes.PathParameters.ReservedExpansion","routes.PathParametersReservedExpansionClient.annotation":"Routes.PathParameters.ReservedExpansion.annotation","routes.PathParametersReservedExpansionClient.annotationWithResponse":"Routes.PathParameters.ReservedExpansion.annotation","routes.PathParametersReservedExpansionClient.template":"Routes.PathParameters.ReservedExpansion.template","routes.PathParametersReservedExpansionClient.templateWithResponse":"Routes.PathParameters.ReservedExpansion.template","routes.PathParametersSimpleExpansionExplodeAsyncClient":"Routes.PathParameters.SimpleExpansion.Explode","routes.PathParametersSimpleExpansionExplodeAsyncClient.array":"Routes.PathParameters.SimpleExpansion.Explode.array","routes.PathParametersSimpleExpansionExplodeAsyncClient.arrayWithResponse":"Routes.PathParameters.SimpleExpansion.Explode.array","routes.PathParametersSimpleExpansionExplodeAsyncClient.primitive":"Routes.PathParameters.SimpleExpansion.Explode.primitive","routes.PathParametersSimpleExpansionExplodeAsyncClient.primitiveWithResponse":"Routes.PathParameters.SimpleExpansion.Explode.primitive","routes.PathParametersSimpleExpansionExplodeAsyncClient.record":"Routes.PathParameters.SimpleExpansion.Explode.record","routes.PathParametersSimpleExpansionExplodeAsyncClient.recordWithResponse":"Routes.PathParameters.SimpleExpansion.Explode.record","routes.PathParametersSimpleExpansionExplodeClient":"Routes.PathParameters.SimpleExpansion.Explode","routes.PathParametersSimpleExpansionExplodeClient.array":"Routes.PathParameters.SimpleExpansion.Explode.array","routes.PathParametersSimpleExpansionExplodeClient.arrayWithResponse":"Routes.PathParameters.SimpleExpansion.Explode.array","routes.PathParametersSimpleExpansionExplodeClient.primitive":"Routes.PathParameters.SimpleExpansion.Explode.primitive","routes.PathParametersSimpleExpansionExplodeClient.primitiveWithResponse":"Routes.PathParameters.SimpleExpansion.Explode.primitive","routes.PathParametersSimpleExpansionExplodeClient.record":"Routes.PathParameters.SimpleExpansion.Explode.record","routes.PathParametersSimpleExpansionExplodeClient.recordWithResponse":"Routes.PathParameters.SimpleExpansion.Explode.record","routes.PathParametersSimpleExpansionStandardAsyncClient":"Routes.PathParameters.SimpleExpansion.Standard","routes.PathParametersSimpleExpansionStandardAsyncClient.array":"Routes.PathParameters.SimpleExpansion.Standard.array","routes.PathParametersSimpleExpansionStandardAsyncClient.arrayWithResponse":"Routes.PathParameters.SimpleExpansion.Standard.array","routes.PathParametersSimpleExpansionStandardAsyncClient.primitive":"Routes.PathParameters.SimpleExpansion.Standard.primitive","routes.PathParametersSimpleExpansionStandardAsyncClient.primitiveWithResponse":"Routes.PathParameters.SimpleExpansion.Standard.primitive","routes.PathParametersSimpleExpansionStandardAsyncClient.record":"Routes.PathParameters.SimpleExpansion.Standard.record","routes.PathParametersSimpleExpansionStandardAsyncClient.recordWithResponse":"Routes.PathParameters.SimpleExpansion.Standard.record","routes.PathParametersSimpleExpansionStandardClient":"Routes.PathParameters.SimpleExpansion.Standard","routes.PathParametersSimpleExpansionStandardClient.array":"Routes.PathParameters.SimpleExpansion.Standard.array","routes.PathParametersSimpleExpansionStandardClient.arrayWithResponse":"Routes.PathParameters.SimpleExpansion.Standard.array","routes.PathParametersSimpleExpansionStandardClient.primitive":"Routes.PathParameters.SimpleExpansion.Standard.primitive","routes.PathParametersSimpleExpansionStandardClient.primitiveWithResponse":"Routes.PathParameters.SimpleExpansion.Standard.primitive","routes.PathParametersSimpleExpansionStandardClient.record":"Routes.PathParameters.SimpleExpansion.Standard.record","routes.PathParametersSimpleExpansionStandardClient.recordWithResponse":"Routes.PathParameters.SimpleExpansion.Standard.record","routes.QueryParametersAsyncClient":"Routes.QueryParameters","routes.QueryParametersAsyncClient.annotationOnly":"Routes.QueryParameters.annotationOnly","routes.QueryParametersAsyncClient.annotationOnlyWithResponse":"Routes.QueryParameters.annotationOnly","routes.QueryParametersAsyncClient.explicit":"Routes.QueryParameters.explicit","routes.QueryParametersAsyncClient.explicitWithResponse":"Routes.QueryParameters.explicit","routes.QueryParametersAsyncClient.templateOnly":"Routes.QueryParameters.templateOnly","routes.QueryParametersAsyncClient.templateOnlyWithResponse":"Routes.QueryParameters.templateOnly","routes.QueryParametersClient":"Routes.QueryParameters","routes.QueryParametersClient.annotationOnly":"Routes.QueryParameters.annotationOnly","routes.QueryParametersClient.annotationOnlyWithResponse":"Routes.QueryParameters.annotationOnly","routes.QueryParametersClient.explicit":"Routes.QueryParameters.explicit","routes.QueryParametersClient.explicitWithResponse":"Routes.QueryParameters.explicit","routes.QueryParametersClient.templateOnly":"Routes.QueryParameters.templateOnly","routes.QueryParametersClient.templateOnlyWithResponse":"Routes.QueryParameters.templateOnly","routes.QueryParametersQueryContinuationExplodeAsyncClient":"Routes.QueryParameters.QueryContinuation.Explode","routes.QueryParametersQueryContinuationExplodeAsyncClient.array":"Routes.QueryParameters.QueryContinuation.Explode.array","routes.QueryParametersQueryContinuationExplodeAsyncClient.arrayWithResponse":"Routes.QueryParameters.QueryContinuation.Explode.array","routes.QueryParametersQueryContinuationExplodeAsyncClient.primitive":"Routes.QueryParameters.QueryContinuation.Explode.primitive","routes.QueryParametersQueryContinuationExplodeAsyncClient.primitiveWithResponse":"Routes.QueryParameters.QueryContinuation.Explode.primitive","routes.QueryParametersQueryContinuationExplodeAsyncClient.record":"Routes.QueryParameters.QueryContinuation.Explode.record","routes.QueryParametersQueryContinuationExplodeAsyncClient.recordWithResponse":"Routes.QueryParameters.QueryContinuation.Explode.record","routes.QueryParametersQueryContinuationExplodeClient":"Routes.QueryParameters.QueryContinuation.Explode","routes.QueryParametersQueryContinuationExplodeClient.array":"Routes.QueryParameters.QueryContinuation.Explode.array","routes.QueryParametersQueryContinuationExplodeClient.arrayWithResponse":"Routes.QueryParameters.QueryContinuation.Explode.array","routes.QueryParametersQueryContinuationExplodeClient.primitive":"Routes.QueryParameters.QueryContinuation.Explode.primitive","routes.QueryParametersQueryContinuationExplodeClient.primitiveWithResponse":"Routes.QueryParameters.QueryContinuation.Explode.primitive","routes.QueryParametersQueryContinuationExplodeClient.record":"Routes.QueryParameters.QueryContinuation.Explode.record","routes.QueryParametersQueryContinuationExplodeClient.recordWithResponse":"Routes.QueryParameters.QueryContinuation.Explode.record","routes.QueryParametersQueryContinuationStandardAsyncClient":"Routes.QueryParameters.QueryContinuation.Standard","routes.QueryParametersQueryContinuationStandardAsyncClient.array":"Routes.QueryParameters.QueryContinuation.Standard.array","routes.QueryParametersQueryContinuationStandardAsyncClient.arrayWithResponse":"Routes.QueryParameters.QueryContinuation.Standard.array","routes.QueryParametersQueryContinuationStandardAsyncClient.primitive":"Routes.QueryParameters.QueryContinuation.Standard.primitive","routes.QueryParametersQueryContinuationStandardAsyncClient.primitiveWithResponse":"Routes.QueryParameters.QueryContinuation.Standard.primitive","routes.QueryParametersQueryContinuationStandardAsyncClient.record":"Routes.QueryParameters.QueryContinuation.Standard.record","routes.QueryParametersQueryContinuationStandardAsyncClient.recordWithResponse":"Routes.QueryParameters.QueryContinuation.Standard.record","routes.QueryParametersQueryContinuationStandardClient":"Routes.QueryParameters.QueryContinuation.Standard","routes.QueryParametersQueryContinuationStandardClient.array":"Routes.QueryParameters.QueryContinuation.Standard.array","routes.QueryParametersQueryContinuationStandardClient.arrayWithResponse":"Routes.QueryParameters.QueryContinuation.Standard.array","routes.QueryParametersQueryContinuationStandardClient.primitive":"Routes.QueryParameters.QueryContinuation.Standard.primitive","routes.QueryParametersQueryContinuationStandardClient.primitiveWithResponse":"Routes.QueryParameters.QueryContinuation.Standard.primitive","routes.QueryParametersQueryContinuationStandardClient.record":"Routes.QueryParameters.QueryContinuation.Standard.record","routes.QueryParametersQueryContinuationStandardClient.recordWithResponse":"Routes.QueryParameters.QueryContinuation.Standard.record","routes.QueryParametersQueryExpansionExplodeAsyncClient":"Routes.QueryParameters.QueryExpansion.Explode","routes.QueryParametersQueryExpansionExplodeAsyncClient.array":"Routes.QueryParameters.QueryExpansion.Explode.array","routes.QueryParametersQueryExpansionExplodeAsyncClient.arrayWithResponse":"Routes.QueryParameters.QueryExpansion.Explode.array","routes.QueryParametersQueryExpansionExplodeAsyncClient.primitive":"Routes.QueryParameters.QueryExpansion.Explode.primitive","routes.QueryParametersQueryExpansionExplodeAsyncClient.primitiveWithResponse":"Routes.QueryParameters.QueryExpansion.Explode.primitive","routes.QueryParametersQueryExpansionExplodeAsyncClient.record":"Routes.QueryParameters.QueryExpansion.Explode.record","routes.QueryParametersQueryExpansionExplodeAsyncClient.recordWithResponse":"Routes.QueryParameters.QueryExpansion.Explode.record","routes.QueryParametersQueryExpansionExplodeClient":"Routes.QueryParameters.QueryExpansion.Explode","routes.QueryParametersQueryExpansionExplodeClient.array":"Routes.QueryParameters.QueryExpansion.Explode.array","routes.QueryParametersQueryExpansionExplodeClient.arrayWithResponse":"Routes.QueryParameters.QueryExpansion.Explode.array","routes.QueryParametersQueryExpansionExplodeClient.primitive":"Routes.QueryParameters.QueryExpansion.Explode.primitive","routes.QueryParametersQueryExpansionExplodeClient.primitiveWithResponse":"Routes.QueryParameters.QueryExpansion.Explode.primitive","routes.QueryParametersQueryExpansionExplodeClient.record":"Routes.QueryParameters.QueryExpansion.Explode.record","routes.QueryParametersQueryExpansionExplodeClient.recordWithResponse":"Routes.QueryParameters.QueryExpansion.Explode.record","routes.QueryParametersQueryExpansionStandardAsyncClient":"Routes.QueryParameters.QueryExpansion.Standard","routes.QueryParametersQueryExpansionStandardAsyncClient.array":"Routes.QueryParameters.QueryExpansion.Standard.array","routes.QueryParametersQueryExpansionStandardAsyncClient.arrayWithResponse":"Routes.QueryParameters.QueryExpansion.Standard.array","routes.QueryParametersQueryExpansionStandardAsyncClient.primitive":"Routes.QueryParameters.QueryExpansion.Standard.primitive","routes.QueryParametersQueryExpansionStandardAsyncClient.primitiveWithResponse":"Routes.QueryParameters.QueryExpansion.Standard.primitive","routes.QueryParametersQueryExpansionStandardAsyncClient.record":"Routes.QueryParameters.QueryExpansion.Standard.record","routes.QueryParametersQueryExpansionStandardAsyncClient.recordWithResponse":"Routes.QueryParameters.QueryExpansion.Standard.record","routes.QueryParametersQueryExpansionStandardClient":"Routes.QueryParameters.QueryExpansion.Standard","routes.QueryParametersQueryExpansionStandardClient.array":"Routes.QueryParameters.QueryExpansion.Standard.array","routes.QueryParametersQueryExpansionStandardClient.arrayWithResponse":"Routes.QueryParameters.QueryExpansion.Standard.array","routes.QueryParametersQueryExpansionStandardClient.primitive":"Routes.QueryParameters.QueryExpansion.Standard.primitive","routes.QueryParametersQueryExpansionStandardClient.primitiveWithResponse":"Routes.QueryParameters.QueryExpansion.Standard.primitive","routes.QueryParametersQueryExpansionStandardClient.record":"Routes.QueryParameters.QueryExpansion.Standard.record","routes.QueryParametersQueryExpansionStandardClient.recordWithResponse":"Routes.QueryParameters.QueryExpansion.Standard.record","routes.RoutesAsyncClient":"Routes","routes.RoutesAsyncClient.fixed":"Routes.fixed","routes.RoutesAsyncClient.fixedWithResponse":"Routes.fixed","routes.RoutesClient":"Routes","routes.RoutesClient.fixed":"Routes.fixed","routes.RoutesClient.fixedWithResponse":"Routes.fixed","routes.RoutesClientBuilder":"Routes"},"generatedFiles":["src/main/java/module-info.java","src/main/java/routes/InInterfaceAsyncClient.java","src/main/java/routes/InInterfaceClient.java","src/main/java/routes/PathParametersAsyncClient.java","src/main/java/routes/PathParametersClient.java","src/main/java/routes/PathParametersLabelExpansionExplodeAsyncClient.java","src/main/java/routes/PathParametersLabelExpansionExplodeClient.java","src/main/java/routes/PathParametersLabelExpansionStandardAsyncClient.java","src/main/java/routes/PathParametersLabelExpansionStandardClient.java","src/main/java/routes/PathParametersMatrixExpansionExplodeAsyncClient.java","src/main/java/routes/PathParametersMatrixExpansionExplodeClient.java","src/main/java/routes/PathParametersMatrixExpansionStandardAsyncClient.java","src/main/java/routes/PathParametersMatrixExpansionStandardClient.java","src/main/java/routes/PathParametersPathExpansionExplodeAsyncClient.java","src/main/java/routes/PathParametersPathExpansionExplodeClient.java","src/main/java/routes/PathParametersPathExpansionStandardAsyncClient.java","src/main/java/routes/PathParametersPathExpansionStandardClient.java","src/main/java/routes/PathParametersReservedExpansionAsyncClient.java","src/main/java/routes/PathParametersReservedExpansionClient.java","src/main/java/routes/PathParametersSimpleExpansionExplodeAsyncClient.java","src/main/java/routes/PathParametersSimpleExpansionExplodeClient.java","src/main/java/routes/PathParametersSimpleExpansionStandardAsyncClient.java","src/main/java/routes/PathParametersSimpleExpansionStandardClient.java","src/main/java/routes/QueryParametersAsyncClient.java","src/main/java/routes/QueryParametersClient.java","src/main/java/routes/QueryParametersQueryContinuationExplodeAsyncClient.java","src/main/java/routes/QueryParametersQueryContinuationExplodeClient.java","src/main/java/routes/QueryParametersQueryContinuationStandardAsyncClient.java","src/main/java/routes/QueryParametersQueryContinuationStandardClient.java","src/main/java/routes/QueryParametersQueryExpansionExplodeAsyncClient.java","src/main/java/routes/QueryParametersQueryExpansionExplodeClient.java","src/main/java/routes/QueryParametersQueryExpansionStandardAsyncClient.java","src/main/java/routes/QueryParametersQueryExpansionStandardClient.java","src/main/java/routes/RoutesAsyncClient.java","src/main/java/routes/RoutesClient.java","src/main/java/routes/RoutesClientBuilder.java","src/main/java/routes/implementation/InInterfacesImpl.java","src/main/java/routes/implementation/PathParametersImpl.java","src/main/java/routes/implementation/PathParametersLabelExpansionExplodesImpl.java","src/main/java/routes/implementation/PathParametersLabelExpansionStandardsImpl.java","src/main/java/routes/implementation/PathParametersMatrixExpansionExplodesImpl.java","src/main/java/routes/implementation/PathParametersMatrixExpansionStandardsImpl.java","src/main/java/routes/implementation/PathParametersPathExpansionExplodesImpl.java","src/main/java/routes/implementation/PathParametersPathExpansionStandardsImpl.java","src/main/java/routes/implementation/PathParametersReservedExpansionsImpl.java","src/main/java/routes/implementation/PathParametersSimpleExpansionExplodesImpl.java","src/main/java/routes/implementation/PathParametersSimpleExpansionStandardsImpl.java","src/main/java/routes/implementation/QueryParametersImpl.java","src/main/java/routes/implementation/QueryParametersQueryContinuationExplodesImpl.java","src/main/java/routes/implementation/QueryParametersQueryContinuationStandardsImpl.java","src/main/java/routes/implementation/QueryParametersQueryExpansionExplodesImpl.java","src/main/java/routes/implementation/QueryParametersQueryExpansionStandardsImpl.java","src/main/java/routes/implementation/RoutesClientImpl.java","src/main/java/routes/implementation/package-info.java","src/main/java/routes/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_apiview_properties.json new file mode 100644 index 00000000000..92d2b385806 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_apiview_properties.json @@ -0,0 +1,17 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "serialization.encodedname.json.JsonAsyncClient": "Serialization.EncodedName.Json.Property", + "serialization.encodedname.json.JsonAsyncClient.get": "Serialization.EncodedName.Json.Property.get", + "serialization.encodedname.json.JsonAsyncClient.getWithResponse": "Serialization.EncodedName.Json.Property.get", + "serialization.encodedname.json.JsonAsyncClient.send": "Serialization.EncodedName.Json.Property.send", + "serialization.encodedname.json.JsonAsyncClient.sendWithResponse": "Serialization.EncodedName.Json.Property.send", + "serialization.encodedname.json.JsonClient": "Serialization.EncodedName.Json.Property", + "serialization.encodedname.json.JsonClient.get": "Serialization.EncodedName.Json.Property.get", + "serialization.encodedname.json.JsonClient.getWithResponse": "Serialization.EncodedName.Json.Property.get", + "serialization.encodedname.json.JsonClient.send": "Serialization.EncodedName.Json.Property.send", + "serialization.encodedname.json.JsonClient.sendWithResponse": "Serialization.EncodedName.Json.Property.send", + "serialization.encodedname.json.JsonClientBuilder": "Serialization.EncodedName.Json", + "serialization.encodedname.json.property.models.JsonEncodedNameModel": "Serialization.EncodedName.Json.Property.JsonEncodedNameModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_metadata.json new file mode 100644 index 00000000000..bbcad97db1a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/serialization-encodedname-json_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"serialization.encodedname.json.JsonAsyncClient":"Serialization.EncodedName.Json.Property","serialization.encodedname.json.JsonAsyncClient.get":"Serialization.EncodedName.Json.Property.get","serialization.encodedname.json.JsonAsyncClient.getWithResponse":"Serialization.EncodedName.Json.Property.get","serialization.encodedname.json.JsonAsyncClient.send":"Serialization.EncodedName.Json.Property.send","serialization.encodedname.json.JsonAsyncClient.sendWithResponse":"Serialization.EncodedName.Json.Property.send","serialization.encodedname.json.JsonClient":"Serialization.EncodedName.Json.Property","serialization.encodedname.json.JsonClient.get":"Serialization.EncodedName.Json.Property.get","serialization.encodedname.json.JsonClient.getWithResponse":"Serialization.EncodedName.Json.Property.get","serialization.encodedname.json.JsonClient.send":"Serialization.EncodedName.Json.Property.send","serialization.encodedname.json.JsonClient.sendWithResponse":"Serialization.EncodedName.Json.Property.send","serialization.encodedname.json.JsonClientBuilder":"Serialization.EncodedName.Json","serialization.encodedname.json.property.models.JsonEncodedNameModel":"Serialization.EncodedName.Json.Property.JsonEncodedNameModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/serialization/encodedname/json/JsonAsyncClient.java","src/main/java/serialization/encodedname/json/JsonClient.java","src/main/java/serialization/encodedname/json/JsonClientBuilder.java","src/main/java/serialization/encodedname/json/implementation/JsonClientImpl.java","src/main/java/serialization/encodedname/json/implementation/PropertiesImpl.java","src/main/java/serialization/encodedname/json/implementation/package-info.java","src/main/java/serialization/encodedname/json/package-info.java","src/main/java/serialization/encodedname/json/property/models/JsonEncodedNameModel.java","src/main/java/serialization/encodedname/json/property/models/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_apiview_properties.json new file mode 100644 index 00000000000..eaeafddebd3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_apiview_properties.json @@ -0,0 +1,12 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "server.endpoint.notdefined.NotDefinedAsyncClient": "Server.Endpoint.NotDefined", + "server.endpoint.notdefined.NotDefinedAsyncClient.valid": "Server.Endpoint.NotDefined.valid", + "server.endpoint.notdefined.NotDefinedAsyncClient.validWithResponse": "Server.Endpoint.NotDefined.valid", + "server.endpoint.notdefined.NotDefinedClient": "Server.Endpoint.NotDefined", + "server.endpoint.notdefined.NotDefinedClient.valid": "Server.Endpoint.NotDefined.valid", + "server.endpoint.notdefined.NotDefinedClient.validWithResponse": "Server.Endpoint.NotDefined.valid", + "server.endpoint.notdefined.NotDefinedClientBuilder": "Server.Endpoint.NotDefined" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_metadata.json new file mode 100644 index 00000000000..eda20fc720a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-endpoint-notdefined_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"server.endpoint.notdefined.NotDefinedAsyncClient":"Server.Endpoint.NotDefined","server.endpoint.notdefined.NotDefinedAsyncClient.valid":"Server.Endpoint.NotDefined.valid","server.endpoint.notdefined.NotDefinedAsyncClient.validWithResponse":"Server.Endpoint.NotDefined.valid","server.endpoint.notdefined.NotDefinedClient":"Server.Endpoint.NotDefined","server.endpoint.notdefined.NotDefinedClient.valid":"Server.Endpoint.NotDefined.valid","server.endpoint.notdefined.NotDefinedClient.validWithResponse":"Server.Endpoint.NotDefined.valid","server.endpoint.notdefined.NotDefinedClientBuilder":"Server.Endpoint.NotDefined"},"generatedFiles":["src/main/java/module-info.java","src/main/java/server/endpoint/notdefined/NotDefinedAsyncClient.java","src/main/java/server/endpoint/notdefined/NotDefinedClient.java","src/main/java/server/endpoint/notdefined/NotDefinedClientBuilder.java","src/main/java/server/endpoint/notdefined/implementation/NotDefinedClientImpl.java","src/main/java/server/endpoint/notdefined/implementation/package-info.java","src/main/java/server/endpoint/notdefined/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_apiview_properties.json new file mode 100644 index 00000000000..354265e93d4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_apiview_properties.json @@ -0,0 +1,16 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "server.path.multiple.MultipleAsyncClient": "Server.Path.Multiple", + "server.path.multiple.MultipleAsyncClient.noOperationParams": "Server.Path.Multiple.noOperationParams", + "server.path.multiple.MultipleAsyncClient.noOperationParamsWithResponse": "Server.Path.Multiple.noOperationParams", + "server.path.multiple.MultipleAsyncClient.withOperationPathParam": "Server.Path.Multiple.withOperationPathParam", + "server.path.multiple.MultipleAsyncClient.withOperationPathParamWithResponse": "Server.Path.Multiple.withOperationPathParam", + "server.path.multiple.MultipleClient": "Server.Path.Multiple", + "server.path.multiple.MultipleClient.noOperationParams": "Server.Path.Multiple.noOperationParams", + "server.path.multiple.MultipleClient.noOperationParamsWithResponse": "Server.Path.Multiple.noOperationParams", + "server.path.multiple.MultipleClient.withOperationPathParam": "Server.Path.Multiple.withOperationPathParam", + "server.path.multiple.MultipleClient.withOperationPathParamWithResponse": "Server.Path.Multiple.withOperationPathParam", + "server.path.multiple.MultipleClientBuilder": "Server.Path.Multiple" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_metadata.json new file mode 100644 index 00000000000..24c2aa4f6d0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-multiple_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"v1.0","crossLanguageDefinitions":{"server.path.multiple.MultipleAsyncClient":"Server.Path.Multiple","server.path.multiple.MultipleAsyncClient.noOperationParams":"Server.Path.Multiple.noOperationParams","server.path.multiple.MultipleAsyncClient.noOperationParamsWithResponse":"Server.Path.Multiple.noOperationParams","server.path.multiple.MultipleAsyncClient.withOperationPathParam":"Server.Path.Multiple.withOperationPathParam","server.path.multiple.MultipleAsyncClient.withOperationPathParamWithResponse":"Server.Path.Multiple.withOperationPathParam","server.path.multiple.MultipleClient":"Server.Path.Multiple","server.path.multiple.MultipleClient.noOperationParams":"Server.Path.Multiple.noOperationParams","server.path.multiple.MultipleClient.noOperationParamsWithResponse":"Server.Path.Multiple.noOperationParams","server.path.multiple.MultipleClient.withOperationPathParam":"Server.Path.Multiple.withOperationPathParam","server.path.multiple.MultipleClient.withOperationPathParamWithResponse":"Server.Path.Multiple.withOperationPathParam","server.path.multiple.MultipleClientBuilder":"Server.Path.Multiple"},"generatedFiles":["src/main/java/module-info.java","src/main/java/server/path/multiple/MultipleAsyncClient.java","src/main/java/server/path/multiple/MultipleClient.java","src/main/java/server/path/multiple/MultipleClientBuilder.java","src/main/java/server/path/multiple/MultipleServiceVersion.java","src/main/java/server/path/multiple/implementation/MultipleClientImpl.java","src/main/java/server/path/multiple/implementation/package-info.java","src/main/java/server/path/multiple/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_apiview_properties.json new file mode 100644 index 00000000000..a15da207d9f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_apiview_properties.json @@ -0,0 +1,12 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "server.path.single.SingleAsyncClient": "Server.Path.Single", + "server.path.single.SingleAsyncClient.myOp": "Server.Path.Single.myOp", + "server.path.single.SingleAsyncClient.myOpWithResponse": "Server.Path.Single.myOp", + "server.path.single.SingleClient": "Server.Path.Single", + "server.path.single.SingleClient.myOp": "Server.Path.Single.myOp", + "server.path.single.SingleClient.myOpWithResponse": "Server.Path.Single.myOp", + "server.path.single.SingleClientBuilder": "Server.Path.Single" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_metadata.json new file mode 100644 index 00000000000..41b5ee625b3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-path-single_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"server.path.single.SingleAsyncClient":"Server.Path.Single","server.path.single.SingleAsyncClient.myOp":"Server.Path.Single.myOp","server.path.single.SingleAsyncClient.myOpWithResponse":"Server.Path.Single.myOp","server.path.single.SingleClient":"Server.Path.Single","server.path.single.SingleClient.myOp":"Server.Path.Single.myOp","server.path.single.SingleClient.myOpWithResponse":"Server.Path.Single.myOp","server.path.single.SingleClientBuilder":"Server.Path.Single"},"generatedFiles":["src/main/java/module-info.java","src/main/java/server/path/single/SingleAsyncClient.java","src/main/java/server/path/single/SingleClient.java","src/main/java/server/path/single/SingleClientBuilder.java","src/main/java/server/path/single/implementation/SingleClientImpl.java","src/main/java/server/path/single/implementation/package-info.java","src/main/java/server/path/single/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_apiview_properties.json new file mode 100644 index 00000000000..7e8c0612518 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_apiview_properties.json @@ -0,0 +1,20 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "server.versions.notversioned.NotVersionedAsyncClient": "Server.Versions.NotVersioned", + "server.versions.notversioned.NotVersionedAsyncClient.withPathApiVersion": "Server.Versions.NotVersioned.withPathApiVersion", + "server.versions.notversioned.NotVersionedAsyncClient.withPathApiVersionWithResponse": "Server.Versions.NotVersioned.withPathApiVersion", + "server.versions.notversioned.NotVersionedAsyncClient.withQueryApiVersion": "Server.Versions.NotVersioned.withQueryApiVersion", + "server.versions.notversioned.NotVersionedAsyncClient.withQueryApiVersionWithResponse": "Server.Versions.NotVersioned.withQueryApiVersion", + "server.versions.notversioned.NotVersionedAsyncClient.withoutApiVersion": "Server.Versions.NotVersioned.withoutApiVersion", + "server.versions.notversioned.NotVersionedAsyncClient.withoutApiVersionWithResponse": "Server.Versions.NotVersioned.withoutApiVersion", + "server.versions.notversioned.NotVersionedClient": "Server.Versions.NotVersioned", + "server.versions.notversioned.NotVersionedClient.withPathApiVersion": "Server.Versions.NotVersioned.withPathApiVersion", + "server.versions.notversioned.NotVersionedClient.withPathApiVersionWithResponse": "Server.Versions.NotVersioned.withPathApiVersion", + "server.versions.notversioned.NotVersionedClient.withQueryApiVersion": "Server.Versions.NotVersioned.withQueryApiVersion", + "server.versions.notversioned.NotVersionedClient.withQueryApiVersionWithResponse": "Server.Versions.NotVersioned.withQueryApiVersion", + "server.versions.notversioned.NotVersionedClient.withoutApiVersion": "Server.Versions.NotVersioned.withoutApiVersion", + "server.versions.notversioned.NotVersionedClient.withoutApiVersionWithResponse": "Server.Versions.NotVersioned.withoutApiVersion", + "server.versions.notversioned.NotVersionedClientBuilder": "Server.Versions.NotVersioned" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_metadata.json new file mode 100644 index 00000000000..1e7846fb03b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-notversioned_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"server.versions.notversioned.NotVersionedAsyncClient":"Server.Versions.NotVersioned","server.versions.notversioned.NotVersionedAsyncClient.withPathApiVersion":"Server.Versions.NotVersioned.withPathApiVersion","server.versions.notversioned.NotVersionedAsyncClient.withPathApiVersionWithResponse":"Server.Versions.NotVersioned.withPathApiVersion","server.versions.notversioned.NotVersionedAsyncClient.withQueryApiVersion":"Server.Versions.NotVersioned.withQueryApiVersion","server.versions.notversioned.NotVersionedAsyncClient.withQueryApiVersionWithResponse":"Server.Versions.NotVersioned.withQueryApiVersion","server.versions.notversioned.NotVersionedAsyncClient.withoutApiVersion":"Server.Versions.NotVersioned.withoutApiVersion","server.versions.notversioned.NotVersionedAsyncClient.withoutApiVersionWithResponse":"Server.Versions.NotVersioned.withoutApiVersion","server.versions.notversioned.NotVersionedClient":"Server.Versions.NotVersioned","server.versions.notversioned.NotVersionedClient.withPathApiVersion":"Server.Versions.NotVersioned.withPathApiVersion","server.versions.notversioned.NotVersionedClient.withPathApiVersionWithResponse":"Server.Versions.NotVersioned.withPathApiVersion","server.versions.notversioned.NotVersionedClient.withQueryApiVersion":"Server.Versions.NotVersioned.withQueryApiVersion","server.versions.notversioned.NotVersionedClient.withQueryApiVersionWithResponse":"Server.Versions.NotVersioned.withQueryApiVersion","server.versions.notversioned.NotVersionedClient.withoutApiVersion":"Server.Versions.NotVersioned.withoutApiVersion","server.versions.notversioned.NotVersionedClient.withoutApiVersionWithResponse":"Server.Versions.NotVersioned.withoutApiVersion","server.versions.notversioned.NotVersionedClientBuilder":"Server.Versions.NotVersioned"},"generatedFiles":["src/main/java/module-info.java","src/main/java/server/versions/notversioned/NotVersionedAsyncClient.java","src/main/java/server/versions/notversioned/NotVersionedClient.java","src/main/java/server/versions/notversioned/NotVersionedClientBuilder.java","src/main/java/server/versions/notversioned/implementation/NotVersionedClientImpl.java","src/main/java/server/versions/notversioned/implementation/package-info.java","src/main/java/server/versions/notversioned/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_apiview_properties.json new file mode 100644 index 00000000000..4ef1c621313 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_apiview_properties.json @@ -0,0 +1,24 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "server.versions.versioned.VersionedAsyncClient": "Server.Versions.Versioned", + "server.versions.versioned.VersionedAsyncClient.withPathApiVersion": "Server.Versions.Versioned.withPathApiVersion", + "server.versions.versioned.VersionedAsyncClient.withPathApiVersionWithResponse": "Server.Versions.Versioned.withPathApiVersion", + "server.versions.versioned.VersionedAsyncClient.withQueryApiVersion": "Server.Versions.Versioned.withQueryApiVersion", + "server.versions.versioned.VersionedAsyncClient.withQueryApiVersionWithResponse": "Server.Versions.Versioned.withQueryApiVersion", + "server.versions.versioned.VersionedAsyncClient.withQueryOldApiVersion": "Server.Versions.Versioned.withQueryOldApiVersion", + "server.versions.versioned.VersionedAsyncClient.withQueryOldApiVersionWithResponse": "Server.Versions.Versioned.withQueryOldApiVersion", + "server.versions.versioned.VersionedAsyncClient.withoutApiVersion": "Server.Versions.Versioned.withoutApiVersion", + "server.versions.versioned.VersionedAsyncClient.withoutApiVersionWithResponse": "Server.Versions.Versioned.withoutApiVersion", + "server.versions.versioned.VersionedClient": "Server.Versions.Versioned", + "server.versions.versioned.VersionedClient.withPathApiVersion": "Server.Versions.Versioned.withPathApiVersion", + "server.versions.versioned.VersionedClient.withPathApiVersionWithResponse": "Server.Versions.Versioned.withPathApiVersion", + "server.versions.versioned.VersionedClient.withQueryApiVersion": "Server.Versions.Versioned.withQueryApiVersion", + "server.versions.versioned.VersionedClient.withQueryApiVersionWithResponse": "Server.Versions.Versioned.withQueryApiVersion", + "server.versions.versioned.VersionedClient.withQueryOldApiVersion": "Server.Versions.Versioned.withQueryOldApiVersion", + "server.versions.versioned.VersionedClient.withQueryOldApiVersionWithResponse": "Server.Versions.Versioned.withQueryOldApiVersion", + "server.versions.versioned.VersionedClient.withoutApiVersion": "Server.Versions.Versioned.withoutApiVersion", + "server.versions.versioned.VersionedClient.withoutApiVersionWithResponse": "Server.Versions.Versioned.withoutApiVersion", + "server.versions.versioned.VersionedClientBuilder": "Server.Versions.Versioned" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_metadata.json new file mode 100644 index 00000000000..168a72c64a6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/server-versions-versioned_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"server.versions.versioned.VersionedAsyncClient":"Server.Versions.Versioned","server.versions.versioned.VersionedAsyncClient.withPathApiVersion":"Server.Versions.Versioned.withPathApiVersion","server.versions.versioned.VersionedAsyncClient.withPathApiVersionWithResponse":"Server.Versions.Versioned.withPathApiVersion","server.versions.versioned.VersionedAsyncClient.withQueryApiVersion":"Server.Versions.Versioned.withQueryApiVersion","server.versions.versioned.VersionedAsyncClient.withQueryApiVersionWithResponse":"Server.Versions.Versioned.withQueryApiVersion","server.versions.versioned.VersionedAsyncClient.withQueryOldApiVersion":"Server.Versions.Versioned.withQueryOldApiVersion","server.versions.versioned.VersionedAsyncClient.withQueryOldApiVersionWithResponse":"Server.Versions.Versioned.withQueryOldApiVersion","server.versions.versioned.VersionedAsyncClient.withoutApiVersion":"Server.Versions.Versioned.withoutApiVersion","server.versions.versioned.VersionedAsyncClient.withoutApiVersionWithResponse":"Server.Versions.Versioned.withoutApiVersion","server.versions.versioned.VersionedClient":"Server.Versions.Versioned","server.versions.versioned.VersionedClient.withPathApiVersion":"Server.Versions.Versioned.withPathApiVersion","server.versions.versioned.VersionedClient.withPathApiVersionWithResponse":"Server.Versions.Versioned.withPathApiVersion","server.versions.versioned.VersionedClient.withQueryApiVersion":"Server.Versions.Versioned.withQueryApiVersion","server.versions.versioned.VersionedClient.withQueryApiVersionWithResponse":"Server.Versions.Versioned.withQueryApiVersion","server.versions.versioned.VersionedClient.withQueryOldApiVersion":"Server.Versions.Versioned.withQueryOldApiVersion","server.versions.versioned.VersionedClient.withQueryOldApiVersionWithResponse":"Server.Versions.Versioned.withQueryOldApiVersion","server.versions.versioned.VersionedClient.withoutApiVersion":"Server.Versions.Versioned.withoutApiVersion","server.versions.versioned.VersionedClient.withoutApiVersionWithResponse":"Server.Versions.Versioned.withoutApiVersion","server.versions.versioned.VersionedClientBuilder":"Server.Versions.Versioned"},"generatedFiles":["src/main/java/module-info.java","src/main/java/server/versions/versioned/VersionedAsyncClient.java","src/main/java/server/versions/versioned/VersionedClient.java","src/main/java/server/versions/versioned/VersionedClientBuilder.java","src/main/java/server/versions/versioned/VersionedServiceVersion.java","src/main/java/server/versions/versioned/implementation/VersionedClientImpl.java","src/main/java/server/versions/versioned/implementation/package-info.java","src/main/java/server/versions/versioned/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_apiview_properties.json new file mode 100644 index 00000000000..1d0bb376bda --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_apiview_properties.json @@ -0,0 +1,18 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "service.multiservice.combined.BarAsyncClient": "Service.MultiService.ServiceB.Bar", + "service.multiservice.combined.BarAsyncClient.test": "Service.MultiService.ServiceB.Bar.test", + "service.multiservice.combined.BarAsyncClient.testWithResponse": "Service.MultiService.ServiceB.Bar.test", + "service.multiservice.combined.BarClient": "Service.MultiService.ServiceB.Bar", + "service.multiservice.combined.BarClient.test": "Service.MultiService.ServiceB.Bar.test", + "service.multiservice.combined.BarClient.testWithResponse": "Service.MultiService.ServiceB.Bar.test", + "service.multiservice.combined.CombinedBuilder": "Service.MultiService.Combined", + "service.multiservice.combined.FooAsyncClient": "Service.MultiService.ServiceA.Foo", + "service.multiservice.combined.FooAsyncClient.test": "Service.MultiService.ServiceA.Foo.test", + "service.multiservice.combined.FooAsyncClient.testWithResponse": "Service.MultiService.ServiceA.Foo.test", + "service.multiservice.combined.FooClient": "Service.MultiService.ServiceA.Foo", + "service.multiservice.combined.FooClient.test": "Service.MultiService.ServiceA.Foo.test", + "service.multiservice.combined.FooClient.testWithResponse": "Service.MultiService.ServiceA.Foo.test" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_metadata.json new file mode 100644 index 00000000000..614135013ef --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/service-multiservice-combined_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"service.multiservice.combined.BarAsyncClient":"Service.MultiService.ServiceB.Bar","service.multiservice.combined.BarAsyncClient.test":"Service.MultiService.ServiceB.Bar.test","service.multiservice.combined.BarAsyncClient.testWithResponse":"Service.MultiService.ServiceB.Bar.test","service.multiservice.combined.BarClient":"Service.MultiService.ServiceB.Bar","service.multiservice.combined.BarClient.test":"Service.MultiService.ServiceB.Bar.test","service.multiservice.combined.BarClient.testWithResponse":"Service.MultiService.ServiceB.Bar.test","service.multiservice.combined.CombinedBuilder":"Service.MultiService.Combined","service.multiservice.combined.FooAsyncClient":"Service.MultiService.ServiceA.Foo","service.multiservice.combined.FooAsyncClient.test":"Service.MultiService.ServiceA.Foo.test","service.multiservice.combined.FooAsyncClient.testWithResponse":"Service.MultiService.ServiceA.Foo.test","service.multiservice.combined.FooClient":"Service.MultiService.ServiceA.Foo","service.multiservice.combined.FooClient.test":"Service.MultiService.ServiceA.Foo.test","service.multiservice.combined.FooClient.testWithResponse":"Service.MultiService.ServiceA.Foo.test"},"generatedFiles":["src/main/java/module-info.java","src/main/java/service/multiservice/combined/BarAsyncClient.java","src/main/java/service/multiservice/combined/BarClient.java","src/main/java/service/multiservice/combined/CombinedBuilder.java","src/main/java/service/multiservice/combined/FooAsyncClient.java","src/main/java/service/multiservice/combined/FooClient.java","src/main/java/service/multiservice/combined/implementation/BarsImpl.java","src/main/java/service/multiservice/combined/implementation/CombinedImpl.java","src/main/java/service/multiservice/combined/implementation/FoosImpl.java","src/main/java/service/multiservice/combined/implementation/package-info.java","src/main/java/service/multiservice/combined/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_apiview_properties.json new file mode 100644 index 00000000000..2755cb3e3aa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_apiview_properties.json @@ -0,0 +1,24 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "specialheaders.conditionalrequest.ConditionalRequestAsyncClient": "SpecialHeaders.ConditionalRequest", + "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.headIfModifiedSince": "SpecialHeaders.ConditionalRequest.headIfModifiedSince", + "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.headIfModifiedSinceWithResponse": "SpecialHeaders.ConditionalRequest.headIfModifiedSince", + "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfMatch": "SpecialHeaders.ConditionalRequest.postIfMatch", + "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfMatchWithResponse": "SpecialHeaders.ConditionalRequest.postIfMatch", + "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfNoneMatch": "SpecialHeaders.ConditionalRequest.postIfNoneMatch", + "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfNoneMatchWithResponse": "SpecialHeaders.ConditionalRequest.postIfNoneMatch", + "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfUnmodifiedSince": "SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince", + "specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfUnmodifiedSinceWithResponse": "SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince", + "specialheaders.conditionalrequest.ConditionalRequestClient": "SpecialHeaders.ConditionalRequest", + "specialheaders.conditionalrequest.ConditionalRequestClient.headIfModifiedSince": "SpecialHeaders.ConditionalRequest.headIfModifiedSince", + "specialheaders.conditionalrequest.ConditionalRequestClient.headIfModifiedSinceWithResponse": "SpecialHeaders.ConditionalRequest.headIfModifiedSince", + "specialheaders.conditionalrequest.ConditionalRequestClient.postIfMatch": "SpecialHeaders.ConditionalRequest.postIfMatch", + "specialheaders.conditionalrequest.ConditionalRequestClient.postIfMatchWithResponse": "SpecialHeaders.ConditionalRequest.postIfMatch", + "specialheaders.conditionalrequest.ConditionalRequestClient.postIfNoneMatch": "SpecialHeaders.ConditionalRequest.postIfNoneMatch", + "specialheaders.conditionalrequest.ConditionalRequestClient.postIfNoneMatchWithResponse": "SpecialHeaders.ConditionalRequest.postIfNoneMatch", + "specialheaders.conditionalrequest.ConditionalRequestClient.postIfUnmodifiedSince": "SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince", + "specialheaders.conditionalrequest.ConditionalRequestClient.postIfUnmodifiedSinceWithResponse": "SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince", + "specialheaders.conditionalrequest.ConditionalRequestClientBuilder": "SpecialHeaders.ConditionalRequest" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_metadata.json new file mode 100644 index 00000000000..badcb6ee5c3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-conditionalrequest_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"specialheaders.conditionalrequest.ConditionalRequestAsyncClient":"SpecialHeaders.ConditionalRequest","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.headIfModifiedSince":"SpecialHeaders.ConditionalRequest.headIfModifiedSince","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.headIfModifiedSinceWithResponse":"SpecialHeaders.ConditionalRequest.headIfModifiedSince","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfMatch":"SpecialHeaders.ConditionalRequest.postIfMatch","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfMatchWithResponse":"SpecialHeaders.ConditionalRequest.postIfMatch","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfNoneMatch":"SpecialHeaders.ConditionalRequest.postIfNoneMatch","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfNoneMatchWithResponse":"SpecialHeaders.ConditionalRequest.postIfNoneMatch","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfUnmodifiedSince":"SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince","specialheaders.conditionalrequest.ConditionalRequestAsyncClient.postIfUnmodifiedSinceWithResponse":"SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince","specialheaders.conditionalrequest.ConditionalRequestClient":"SpecialHeaders.ConditionalRequest","specialheaders.conditionalrequest.ConditionalRequestClient.headIfModifiedSince":"SpecialHeaders.ConditionalRequest.headIfModifiedSince","specialheaders.conditionalrequest.ConditionalRequestClient.headIfModifiedSinceWithResponse":"SpecialHeaders.ConditionalRequest.headIfModifiedSince","specialheaders.conditionalrequest.ConditionalRequestClient.postIfMatch":"SpecialHeaders.ConditionalRequest.postIfMatch","specialheaders.conditionalrequest.ConditionalRequestClient.postIfMatchWithResponse":"SpecialHeaders.ConditionalRequest.postIfMatch","specialheaders.conditionalrequest.ConditionalRequestClient.postIfNoneMatch":"SpecialHeaders.ConditionalRequest.postIfNoneMatch","specialheaders.conditionalrequest.ConditionalRequestClient.postIfNoneMatchWithResponse":"SpecialHeaders.ConditionalRequest.postIfNoneMatch","specialheaders.conditionalrequest.ConditionalRequestClient.postIfUnmodifiedSince":"SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince","specialheaders.conditionalrequest.ConditionalRequestClient.postIfUnmodifiedSinceWithResponse":"SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince","specialheaders.conditionalrequest.ConditionalRequestClientBuilder":"SpecialHeaders.ConditionalRequest"},"generatedFiles":["src/main/java/module-info.java","src/main/java/specialheaders/conditionalrequest/ConditionalRequestAsyncClient.java","src/main/java/specialheaders/conditionalrequest/ConditionalRequestClient.java","src/main/java/specialheaders/conditionalrequest/ConditionalRequestClientBuilder.java","src/main/java/specialheaders/conditionalrequest/implementation/ConditionalRequestClientImpl.java","src/main/java/specialheaders/conditionalrequest/implementation/package-info.java","src/main/java/specialheaders/conditionalrequest/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_apiview_properties.json new file mode 100644 index 00000000000..78b61690bc4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_apiview_properties.json @@ -0,0 +1,12 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "specialheaders.repeatability.RepeatabilityAsyncClient": "SpecialHeaders.Repeatability", + "specialheaders.repeatability.RepeatabilityAsyncClient.immediateSuccess": "SpecialHeaders.Repeatability.immediateSuccess", + "specialheaders.repeatability.RepeatabilityAsyncClient.immediateSuccessWithResponse": "SpecialHeaders.Repeatability.immediateSuccess", + "specialheaders.repeatability.RepeatabilityClient": "SpecialHeaders.Repeatability", + "specialheaders.repeatability.RepeatabilityClient.immediateSuccess": "SpecialHeaders.Repeatability.immediateSuccess", + "specialheaders.repeatability.RepeatabilityClient.immediateSuccessWithResponse": "SpecialHeaders.Repeatability.immediateSuccess", + "specialheaders.repeatability.RepeatabilityClientBuilder": "SpecialHeaders.Repeatability" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_metadata.json new file mode 100644 index 00000000000..82460b3991f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialheaders-repeatability_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"specialheaders.repeatability.RepeatabilityAsyncClient":"SpecialHeaders.Repeatability","specialheaders.repeatability.RepeatabilityAsyncClient.immediateSuccess":"SpecialHeaders.Repeatability.immediateSuccess","specialheaders.repeatability.RepeatabilityAsyncClient.immediateSuccessWithResponse":"SpecialHeaders.Repeatability.immediateSuccess","specialheaders.repeatability.RepeatabilityClient":"SpecialHeaders.Repeatability","specialheaders.repeatability.RepeatabilityClient.immediateSuccess":"SpecialHeaders.Repeatability.immediateSuccess","specialheaders.repeatability.RepeatabilityClient.immediateSuccessWithResponse":"SpecialHeaders.Repeatability.immediateSuccess","specialheaders.repeatability.RepeatabilityClientBuilder":"SpecialHeaders.Repeatability"},"generatedFiles":["src/main/java/module-info.java","src/main/java/specialheaders/repeatability/RepeatabilityAsyncClient.java","src/main/java/specialheaders/repeatability/RepeatabilityClient.java","src/main/java/specialheaders/repeatability/RepeatabilityClientBuilder.java","src/main/java/specialheaders/repeatability/implementation/RepeatabilityClientImpl.java","src/main/java/specialheaders/repeatability/implementation/package-info.java","src/main/java/specialheaders/repeatability/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_apiview_properties.json new file mode 100644 index 00000000000..8884bf558b4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_apiview_properties.json @@ -0,0 +1,453 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "specialwords.ModelPropertiesAsyncClient": "SpecialWords.ModelProperties", + "specialwords.ModelPropertiesAsyncClient.dictMethods": "SpecialWords.ModelProperties.dictMethods", + "specialwords.ModelPropertiesAsyncClient.dictMethodsWithResponse": "SpecialWords.ModelProperties.dictMethods", + "specialwords.ModelPropertiesAsyncClient.sameAsModel": "SpecialWords.ModelProperties.sameAsModel", + "specialwords.ModelPropertiesAsyncClient.sameAsModelWithResponse": "SpecialWords.ModelProperties.sameAsModel", + "specialwords.ModelPropertiesClient": "SpecialWords.ModelProperties", + "specialwords.ModelPropertiesClient.dictMethods": "SpecialWords.ModelProperties.dictMethods", + "specialwords.ModelPropertiesClient.dictMethodsWithResponse": "SpecialWords.ModelProperties.dictMethods", + "specialwords.ModelPropertiesClient.sameAsModel": "SpecialWords.ModelProperties.sameAsModel", + "specialwords.ModelPropertiesClient.sameAsModelWithResponse": "SpecialWords.ModelProperties.sameAsModel", + "specialwords.ModelsAsyncClient": "SpecialWords.Models", + "specialwords.ModelsAsyncClient.withAnd": "SpecialWords.Models.withAnd", + "specialwords.ModelsAsyncClient.withAndWithResponse": "SpecialWords.Models.withAnd", + "specialwords.ModelsAsyncClient.withAs": "SpecialWords.Models.withAs", + "specialwords.ModelsAsyncClient.withAsWithResponse": "SpecialWords.Models.withAs", + "specialwords.ModelsAsyncClient.withAssert": "SpecialWords.Models.withAssert", + "specialwords.ModelsAsyncClient.withAssertWithResponse": "SpecialWords.Models.withAssert", + "specialwords.ModelsAsyncClient.withAsyncWithResponse": "SpecialWords.Models.withAsync", + "specialwords.ModelsAsyncClient.withAwait": "SpecialWords.Models.withAwait", + "specialwords.ModelsAsyncClient.withAwaitWithResponse": "SpecialWords.Models.withAwait", + "specialwords.ModelsAsyncClient.withBreak": "SpecialWords.Models.withBreak", + "specialwords.ModelsAsyncClient.withBreakWithResponse": "SpecialWords.Models.withBreak", + "specialwords.ModelsAsyncClient.withClass": "SpecialWords.Models.withClass", + "specialwords.ModelsAsyncClient.withClassWithResponse": "SpecialWords.Models.withClass", + "specialwords.ModelsAsyncClient.withConstructor": "SpecialWords.Models.withConstructor", + "specialwords.ModelsAsyncClient.withConstructorWithResponse": "SpecialWords.Models.withConstructor", + "specialwords.ModelsAsyncClient.withContinue": "SpecialWords.Models.withContinue", + "specialwords.ModelsAsyncClient.withContinueWithResponse": "SpecialWords.Models.withContinue", + "specialwords.ModelsAsyncClient.withDef": "SpecialWords.Models.withDef", + "specialwords.ModelsAsyncClient.withDefWithResponse": "SpecialWords.Models.withDef", + "specialwords.ModelsAsyncClient.withDel": "SpecialWords.Models.withDel", + "specialwords.ModelsAsyncClient.withDelWithResponse": "SpecialWords.Models.withDel", + "specialwords.ModelsAsyncClient.withElif": "SpecialWords.Models.withElif", + "specialwords.ModelsAsyncClient.withElifWithResponse": "SpecialWords.Models.withElif", + "specialwords.ModelsAsyncClient.withElse": "SpecialWords.Models.withElse", + "specialwords.ModelsAsyncClient.withElseWithResponse": "SpecialWords.Models.withElse", + "specialwords.ModelsAsyncClient.withExcept": "SpecialWords.Models.withExcept", + "specialwords.ModelsAsyncClient.withExceptWithResponse": "SpecialWords.Models.withExcept", + "specialwords.ModelsAsyncClient.withExec": "SpecialWords.Models.withExec", + "specialwords.ModelsAsyncClient.withExecWithResponse": "SpecialWords.Models.withExec", + "specialwords.ModelsAsyncClient.withFinally": "SpecialWords.Models.withFinally", + "specialwords.ModelsAsyncClient.withFinallyWithResponse": "SpecialWords.Models.withFinally", + "specialwords.ModelsAsyncClient.withFor": "SpecialWords.Models.withFor", + "specialwords.ModelsAsyncClient.withForWithResponse": "SpecialWords.Models.withFor", + "specialwords.ModelsAsyncClient.withFrom": "SpecialWords.Models.withFrom", + "specialwords.ModelsAsyncClient.withFromWithResponse": "SpecialWords.Models.withFrom", + "specialwords.ModelsAsyncClient.withGlobal": "SpecialWords.Models.withGlobal", + "specialwords.ModelsAsyncClient.withGlobalWithResponse": "SpecialWords.Models.withGlobal", + "specialwords.ModelsAsyncClient.withIf": "SpecialWords.Models.withIf", + "specialwords.ModelsAsyncClient.withIfWithResponse": "SpecialWords.Models.withIf", + "specialwords.ModelsAsyncClient.withImport": "SpecialWords.Models.withImport", + "specialwords.ModelsAsyncClient.withImportWithResponse": "SpecialWords.Models.withImport", + "specialwords.ModelsAsyncClient.withIn": "SpecialWords.Models.withIn", + "specialwords.ModelsAsyncClient.withInWithResponse": "SpecialWords.Models.withIn", + "specialwords.ModelsAsyncClient.withIs": "SpecialWords.Models.withIs", + "specialwords.ModelsAsyncClient.withIsWithResponse": "SpecialWords.Models.withIs", + "specialwords.ModelsAsyncClient.withLambda": "SpecialWords.Models.withLambda", + "specialwords.ModelsAsyncClient.withLambdaWithResponse": "SpecialWords.Models.withLambda", + "specialwords.ModelsAsyncClient.withNot": "SpecialWords.Models.withNot", + "specialwords.ModelsAsyncClient.withNotWithResponse": "SpecialWords.Models.withNot", + "specialwords.ModelsAsyncClient.withOr": "SpecialWords.Models.withOr", + "specialwords.ModelsAsyncClient.withOrWithResponse": "SpecialWords.Models.withOr", + "specialwords.ModelsAsyncClient.withPass": "SpecialWords.Models.withPass", + "specialwords.ModelsAsyncClient.withPassWithResponse": "SpecialWords.Models.withPass", + "specialwords.ModelsAsyncClient.withRaise": "SpecialWords.Models.withRaise", + "specialwords.ModelsAsyncClient.withRaiseWithResponse": "SpecialWords.Models.withRaise", + "specialwords.ModelsAsyncClient.withReturn": "SpecialWords.Models.withReturn", + "specialwords.ModelsAsyncClient.withReturnWithResponse": "SpecialWords.Models.withReturn", + "specialwords.ModelsAsyncClient.withTry": "SpecialWords.Models.withTry", + "specialwords.ModelsAsyncClient.withTryWithResponse": "SpecialWords.Models.withTry", + "specialwords.ModelsAsyncClient.withWhile": "SpecialWords.Models.withWhile", + "specialwords.ModelsAsyncClient.withWhileWithResponse": "SpecialWords.Models.withWhile", + "specialwords.ModelsAsyncClient.withWith": "SpecialWords.Models.withWith", + "specialwords.ModelsAsyncClient.withWithWithResponse": "SpecialWords.Models.withWith", + "specialwords.ModelsAsyncClient.withYield": "SpecialWords.Models.withYield", + "specialwords.ModelsAsyncClient.withYieldWithResponse": "SpecialWords.Models.withYield", + "specialwords.ModelsClient": "SpecialWords.Models", + "specialwords.ModelsClient.withAnd": "SpecialWords.Models.withAnd", + "specialwords.ModelsClient.withAndWithResponse": "SpecialWords.Models.withAnd", + "specialwords.ModelsClient.withAs": "SpecialWords.Models.withAs", + "specialwords.ModelsClient.withAsWithResponse": "SpecialWords.Models.withAs", + "specialwords.ModelsClient.withAssert": "SpecialWords.Models.withAssert", + "specialwords.ModelsClient.withAssertWithResponse": "SpecialWords.Models.withAssert", + "specialwords.ModelsClient.withAsyncWithResponse": "SpecialWords.Models.withAsync", + "specialwords.ModelsClient.withAwait": "SpecialWords.Models.withAwait", + "specialwords.ModelsClient.withAwaitWithResponse": "SpecialWords.Models.withAwait", + "specialwords.ModelsClient.withBreak": "SpecialWords.Models.withBreak", + "specialwords.ModelsClient.withBreakWithResponse": "SpecialWords.Models.withBreak", + "specialwords.ModelsClient.withClass": "SpecialWords.Models.withClass", + "specialwords.ModelsClient.withClassWithResponse": "SpecialWords.Models.withClass", + "specialwords.ModelsClient.withConstructor": "SpecialWords.Models.withConstructor", + "specialwords.ModelsClient.withConstructorWithResponse": "SpecialWords.Models.withConstructor", + "specialwords.ModelsClient.withContinue": "SpecialWords.Models.withContinue", + "specialwords.ModelsClient.withContinueWithResponse": "SpecialWords.Models.withContinue", + "specialwords.ModelsClient.withDef": "SpecialWords.Models.withDef", + "specialwords.ModelsClient.withDefWithResponse": "SpecialWords.Models.withDef", + "specialwords.ModelsClient.withDel": "SpecialWords.Models.withDel", + "specialwords.ModelsClient.withDelWithResponse": "SpecialWords.Models.withDel", + "specialwords.ModelsClient.withElif": "SpecialWords.Models.withElif", + "specialwords.ModelsClient.withElifWithResponse": "SpecialWords.Models.withElif", + "specialwords.ModelsClient.withElse": "SpecialWords.Models.withElse", + "specialwords.ModelsClient.withElseWithResponse": "SpecialWords.Models.withElse", + "specialwords.ModelsClient.withExcept": "SpecialWords.Models.withExcept", + "specialwords.ModelsClient.withExceptWithResponse": "SpecialWords.Models.withExcept", + "specialwords.ModelsClient.withExec": "SpecialWords.Models.withExec", + "specialwords.ModelsClient.withExecWithResponse": "SpecialWords.Models.withExec", + "specialwords.ModelsClient.withFinally": "SpecialWords.Models.withFinally", + "specialwords.ModelsClient.withFinallyWithResponse": "SpecialWords.Models.withFinally", + "specialwords.ModelsClient.withFor": "SpecialWords.Models.withFor", + "specialwords.ModelsClient.withForWithResponse": "SpecialWords.Models.withFor", + "specialwords.ModelsClient.withFrom": "SpecialWords.Models.withFrom", + "specialwords.ModelsClient.withFromWithResponse": "SpecialWords.Models.withFrom", + "specialwords.ModelsClient.withGlobal": "SpecialWords.Models.withGlobal", + "specialwords.ModelsClient.withGlobalWithResponse": "SpecialWords.Models.withGlobal", + "specialwords.ModelsClient.withIf": "SpecialWords.Models.withIf", + "specialwords.ModelsClient.withIfWithResponse": "SpecialWords.Models.withIf", + "specialwords.ModelsClient.withImport": "SpecialWords.Models.withImport", + "specialwords.ModelsClient.withImportWithResponse": "SpecialWords.Models.withImport", + "specialwords.ModelsClient.withIn": "SpecialWords.Models.withIn", + "specialwords.ModelsClient.withInWithResponse": "SpecialWords.Models.withIn", + "specialwords.ModelsClient.withIs": "SpecialWords.Models.withIs", + "specialwords.ModelsClient.withIsWithResponse": "SpecialWords.Models.withIs", + "specialwords.ModelsClient.withLambda": "SpecialWords.Models.withLambda", + "specialwords.ModelsClient.withLambdaWithResponse": "SpecialWords.Models.withLambda", + "specialwords.ModelsClient.withNot": "SpecialWords.Models.withNot", + "specialwords.ModelsClient.withNotWithResponse": "SpecialWords.Models.withNot", + "specialwords.ModelsClient.withOr": "SpecialWords.Models.withOr", + "specialwords.ModelsClient.withOrWithResponse": "SpecialWords.Models.withOr", + "specialwords.ModelsClient.withPass": "SpecialWords.Models.withPass", + "specialwords.ModelsClient.withPassWithResponse": "SpecialWords.Models.withPass", + "specialwords.ModelsClient.withRaise": "SpecialWords.Models.withRaise", + "specialwords.ModelsClient.withRaiseWithResponse": "SpecialWords.Models.withRaise", + "specialwords.ModelsClient.withReturn": "SpecialWords.Models.withReturn", + "specialwords.ModelsClient.withReturnWithResponse": "SpecialWords.Models.withReturn", + "specialwords.ModelsClient.withTry": "SpecialWords.Models.withTry", + "specialwords.ModelsClient.withTryWithResponse": "SpecialWords.Models.withTry", + "specialwords.ModelsClient.withWhile": "SpecialWords.Models.withWhile", + "specialwords.ModelsClient.withWhileWithResponse": "SpecialWords.Models.withWhile", + "specialwords.ModelsClient.withWith": "SpecialWords.Models.withWith", + "specialwords.ModelsClient.withWithWithResponse": "SpecialWords.Models.withWith", + "specialwords.ModelsClient.withYield": "SpecialWords.Models.withYield", + "specialwords.ModelsClient.withYieldWithResponse": "SpecialWords.Models.withYield", + "specialwords.OperationsAsyncClient": "SpecialWords.Operations", + "specialwords.OperationsAsyncClient.and": "SpecialWords.Operations.and", + "specialwords.OperationsAsyncClient.andWithResponse": "SpecialWords.Operations.and", + "specialwords.OperationsAsyncClient.as": "SpecialWords.Operations.as", + "specialwords.OperationsAsyncClient.asWithResponse": "SpecialWords.Operations.as", + "specialwords.OperationsAsyncClient.assertMethod": "SpecialWords.Operations.assert", + "specialwords.OperationsAsyncClient.assertMethodWithResponse": "SpecialWords.Operations.assert", + "specialwords.OperationsAsyncClient.async": "SpecialWords.Operations.async", + "specialwords.OperationsAsyncClient.asyncWithResponse": "SpecialWords.Operations.async", + "specialwords.OperationsAsyncClient.await": "SpecialWords.Operations.await", + "specialwords.OperationsAsyncClient.awaitWithResponse": "SpecialWords.Operations.await", + "specialwords.OperationsAsyncClient.breakMethod": "SpecialWords.Operations.break", + "specialwords.OperationsAsyncClient.breakMethodWithResponse": "SpecialWords.Operations.break", + "specialwords.OperationsAsyncClient.classMethod": "SpecialWords.Operations.class", + "specialwords.OperationsAsyncClient.classMethodWithResponse": "SpecialWords.Operations.class", + "specialwords.OperationsAsyncClient.constructor": "SpecialWords.Operations.constructor", + "specialwords.OperationsAsyncClient.constructorWithResponse": "SpecialWords.Operations.constructor", + "specialwords.OperationsAsyncClient.continueMethod": "SpecialWords.Operations.continue", + "specialwords.OperationsAsyncClient.continueMethodWithResponse": "SpecialWords.Operations.continue", + "specialwords.OperationsAsyncClient.def": "SpecialWords.Operations.def", + "specialwords.OperationsAsyncClient.defWithResponse": "SpecialWords.Operations.def", + "specialwords.OperationsAsyncClient.del": "SpecialWords.Operations.del", + "specialwords.OperationsAsyncClient.delWithResponse": "SpecialWords.Operations.del", + "specialwords.OperationsAsyncClient.elif": "SpecialWords.Operations.elif", + "specialwords.OperationsAsyncClient.elifWithResponse": "SpecialWords.Operations.elif", + "specialwords.OperationsAsyncClient.elseMethod": "SpecialWords.Operations.else", + "specialwords.OperationsAsyncClient.elseMethodWithResponse": "SpecialWords.Operations.else", + "specialwords.OperationsAsyncClient.except": "SpecialWords.Operations.except", + "specialwords.OperationsAsyncClient.exceptWithResponse": "SpecialWords.Operations.except", + "specialwords.OperationsAsyncClient.exec": "SpecialWords.Operations.exec", + "specialwords.OperationsAsyncClient.execWithResponse": "SpecialWords.Operations.exec", + "specialwords.OperationsAsyncClient.finallyMethod": "SpecialWords.Operations.finally", + "specialwords.OperationsAsyncClient.finallyMethodWithResponse": "SpecialWords.Operations.finally", + "specialwords.OperationsAsyncClient.forMethod": "SpecialWords.Operations.for", + "specialwords.OperationsAsyncClient.forMethodWithResponse": "SpecialWords.Operations.for", + "specialwords.OperationsAsyncClient.from": "SpecialWords.Operations.from", + "specialwords.OperationsAsyncClient.fromWithResponse": "SpecialWords.Operations.from", + "specialwords.OperationsAsyncClient.global": "SpecialWords.Operations.global", + "specialwords.OperationsAsyncClient.globalWithResponse": "SpecialWords.Operations.global", + "specialwords.OperationsAsyncClient.ifMethod": "SpecialWords.Operations.if", + "specialwords.OperationsAsyncClient.ifMethodWithResponse": "SpecialWords.Operations.if", + "specialwords.OperationsAsyncClient.importMethod": "SpecialWords.Operations.import", + "specialwords.OperationsAsyncClient.importMethodWithResponse": "SpecialWords.Operations.import", + "specialwords.OperationsAsyncClient.in": "SpecialWords.Operations.in", + "specialwords.OperationsAsyncClient.inWithResponse": "SpecialWords.Operations.in", + "specialwords.OperationsAsyncClient.is": "SpecialWords.Operations.is", + "specialwords.OperationsAsyncClient.isWithResponse": "SpecialWords.Operations.is", + "specialwords.OperationsAsyncClient.lambda": "SpecialWords.Operations.lambda", + "specialwords.OperationsAsyncClient.lambdaWithResponse": "SpecialWords.Operations.lambda", + "specialwords.OperationsAsyncClient.not": "SpecialWords.Operations.not", + "specialwords.OperationsAsyncClient.notWithResponse": "SpecialWords.Operations.not", + "specialwords.OperationsAsyncClient.or": "SpecialWords.Operations.or", + "specialwords.OperationsAsyncClient.orWithResponse": "SpecialWords.Operations.or", + "specialwords.OperationsAsyncClient.pass": "SpecialWords.Operations.pass", + "specialwords.OperationsAsyncClient.passWithResponse": "SpecialWords.Operations.pass", + "specialwords.OperationsAsyncClient.raise": "SpecialWords.Operations.raise", + "specialwords.OperationsAsyncClient.raiseWithResponse": "SpecialWords.Operations.raise", + "specialwords.OperationsAsyncClient.returnMethod": "SpecialWords.Operations.return", + "specialwords.OperationsAsyncClient.returnMethodWithResponse": "SpecialWords.Operations.return", + "specialwords.OperationsAsyncClient.tryMethod": "SpecialWords.Operations.try", + "specialwords.OperationsAsyncClient.tryMethodWithResponse": "SpecialWords.Operations.try", + "specialwords.OperationsAsyncClient.whileMethod": "SpecialWords.Operations.while", + "specialwords.OperationsAsyncClient.whileMethodWithResponse": "SpecialWords.Operations.while", + "specialwords.OperationsAsyncClient.with": "SpecialWords.Operations.with", + "specialwords.OperationsAsyncClient.withWithResponse": "SpecialWords.Operations.with", + "specialwords.OperationsAsyncClient.yield": "SpecialWords.Operations.yield", + "specialwords.OperationsAsyncClient.yieldWithResponse": "SpecialWords.Operations.yield", + "specialwords.OperationsClient": "SpecialWords.Operations", + "specialwords.OperationsClient.and": "SpecialWords.Operations.and", + "specialwords.OperationsClient.andWithResponse": "SpecialWords.Operations.and", + "specialwords.OperationsClient.as": "SpecialWords.Operations.as", + "specialwords.OperationsClient.asWithResponse": "SpecialWords.Operations.as", + "specialwords.OperationsClient.assertMethod": "SpecialWords.Operations.assert", + "specialwords.OperationsClient.assertMethodWithResponse": "SpecialWords.Operations.assert", + "specialwords.OperationsClient.async": "SpecialWords.Operations.async", + "specialwords.OperationsClient.asyncWithResponse": "SpecialWords.Operations.async", + "specialwords.OperationsClient.await": "SpecialWords.Operations.await", + "specialwords.OperationsClient.awaitWithResponse": "SpecialWords.Operations.await", + "specialwords.OperationsClient.breakMethod": "SpecialWords.Operations.break", + "specialwords.OperationsClient.breakMethodWithResponse": "SpecialWords.Operations.break", + "specialwords.OperationsClient.classMethod": "SpecialWords.Operations.class", + "specialwords.OperationsClient.classMethodWithResponse": "SpecialWords.Operations.class", + "specialwords.OperationsClient.constructor": "SpecialWords.Operations.constructor", + "specialwords.OperationsClient.constructorWithResponse": "SpecialWords.Operations.constructor", + "specialwords.OperationsClient.continueMethod": "SpecialWords.Operations.continue", + "specialwords.OperationsClient.continueMethodWithResponse": "SpecialWords.Operations.continue", + "specialwords.OperationsClient.def": "SpecialWords.Operations.def", + "specialwords.OperationsClient.defWithResponse": "SpecialWords.Operations.def", + "specialwords.OperationsClient.del": "SpecialWords.Operations.del", + "specialwords.OperationsClient.delWithResponse": "SpecialWords.Operations.del", + "specialwords.OperationsClient.elif": "SpecialWords.Operations.elif", + "specialwords.OperationsClient.elifWithResponse": "SpecialWords.Operations.elif", + "specialwords.OperationsClient.elseMethod": "SpecialWords.Operations.else", + "specialwords.OperationsClient.elseMethodWithResponse": "SpecialWords.Operations.else", + "specialwords.OperationsClient.except": "SpecialWords.Operations.except", + "specialwords.OperationsClient.exceptWithResponse": "SpecialWords.Operations.except", + "specialwords.OperationsClient.exec": "SpecialWords.Operations.exec", + "specialwords.OperationsClient.execWithResponse": "SpecialWords.Operations.exec", + "specialwords.OperationsClient.finallyMethod": "SpecialWords.Operations.finally", + "specialwords.OperationsClient.finallyMethodWithResponse": "SpecialWords.Operations.finally", + "specialwords.OperationsClient.forMethod": "SpecialWords.Operations.for", + "specialwords.OperationsClient.forMethodWithResponse": "SpecialWords.Operations.for", + "specialwords.OperationsClient.from": "SpecialWords.Operations.from", + "specialwords.OperationsClient.fromWithResponse": "SpecialWords.Operations.from", + "specialwords.OperationsClient.global": "SpecialWords.Operations.global", + "specialwords.OperationsClient.globalWithResponse": "SpecialWords.Operations.global", + "specialwords.OperationsClient.ifMethod": "SpecialWords.Operations.if", + "specialwords.OperationsClient.ifMethodWithResponse": "SpecialWords.Operations.if", + "specialwords.OperationsClient.importMethod": "SpecialWords.Operations.import", + "specialwords.OperationsClient.importMethodWithResponse": "SpecialWords.Operations.import", + "specialwords.OperationsClient.in": "SpecialWords.Operations.in", + "specialwords.OperationsClient.inWithResponse": "SpecialWords.Operations.in", + "specialwords.OperationsClient.is": "SpecialWords.Operations.is", + "specialwords.OperationsClient.isWithResponse": "SpecialWords.Operations.is", + "specialwords.OperationsClient.lambda": "SpecialWords.Operations.lambda", + "specialwords.OperationsClient.lambdaWithResponse": "SpecialWords.Operations.lambda", + "specialwords.OperationsClient.not": "SpecialWords.Operations.not", + "specialwords.OperationsClient.notWithResponse": "SpecialWords.Operations.not", + "specialwords.OperationsClient.or": "SpecialWords.Operations.or", + "specialwords.OperationsClient.orWithResponse": "SpecialWords.Operations.or", + "specialwords.OperationsClient.pass": "SpecialWords.Operations.pass", + "specialwords.OperationsClient.passWithResponse": "SpecialWords.Operations.pass", + "specialwords.OperationsClient.raise": "SpecialWords.Operations.raise", + "specialwords.OperationsClient.raiseWithResponse": "SpecialWords.Operations.raise", + "specialwords.OperationsClient.returnMethod": "SpecialWords.Operations.return", + "specialwords.OperationsClient.returnMethodWithResponse": "SpecialWords.Operations.return", + "specialwords.OperationsClient.tryMethod": "SpecialWords.Operations.try", + "specialwords.OperationsClient.tryMethodWithResponse": "SpecialWords.Operations.try", + "specialwords.OperationsClient.whileMethod": "SpecialWords.Operations.while", + "specialwords.OperationsClient.whileMethodWithResponse": "SpecialWords.Operations.while", + "specialwords.OperationsClient.with": "SpecialWords.Operations.with", + "specialwords.OperationsClient.withWithResponse": "SpecialWords.Operations.with", + "specialwords.OperationsClient.yield": "SpecialWords.Operations.yield", + "specialwords.OperationsClient.yieldWithResponse": "SpecialWords.Operations.yield", + "specialwords.ParametersAsyncClient": "SpecialWords.Parameters", + "specialwords.ParametersAsyncClient.withAnd": "SpecialWords.Parameters.withAnd", + "specialwords.ParametersAsyncClient.withAndWithResponse": "SpecialWords.Parameters.withAnd", + "specialwords.ParametersAsyncClient.withAs": "SpecialWords.Parameters.withAs", + "specialwords.ParametersAsyncClient.withAsWithResponse": "SpecialWords.Parameters.withAs", + "specialwords.ParametersAsyncClient.withAssert": "SpecialWords.Parameters.withAssert", + "specialwords.ParametersAsyncClient.withAssertWithResponse": "SpecialWords.Parameters.withAssert", + "specialwords.ParametersAsyncClient.withAsyncWithResponse": "SpecialWords.Parameters.withAsync", + "specialwords.ParametersAsyncClient.withAwait": "SpecialWords.Parameters.withAwait", + "specialwords.ParametersAsyncClient.withAwaitWithResponse": "SpecialWords.Parameters.withAwait", + "specialwords.ParametersAsyncClient.withBreak": "SpecialWords.Parameters.withBreak", + "specialwords.ParametersAsyncClient.withBreakWithResponse": "SpecialWords.Parameters.withBreak", + "specialwords.ParametersAsyncClient.withCancellationToken": "SpecialWords.Parameters.withCancellationToken", + "specialwords.ParametersAsyncClient.withCancellationTokenWithResponse": "SpecialWords.Parameters.withCancellationToken", + "specialwords.ParametersAsyncClient.withClass": "SpecialWords.Parameters.withClass", + "specialwords.ParametersAsyncClient.withClassWithResponse": "SpecialWords.Parameters.withClass", + "specialwords.ParametersAsyncClient.withConstructor": "SpecialWords.Parameters.withConstructor", + "specialwords.ParametersAsyncClient.withConstructorWithResponse": "SpecialWords.Parameters.withConstructor", + "specialwords.ParametersAsyncClient.withContinue": "SpecialWords.Parameters.withContinue", + "specialwords.ParametersAsyncClient.withContinueWithResponse": "SpecialWords.Parameters.withContinue", + "specialwords.ParametersAsyncClient.withDef": "SpecialWords.Parameters.withDef", + "specialwords.ParametersAsyncClient.withDefWithResponse": "SpecialWords.Parameters.withDef", + "specialwords.ParametersAsyncClient.withDel": "SpecialWords.Parameters.withDel", + "specialwords.ParametersAsyncClient.withDelWithResponse": "SpecialWords.Parameters.withDel", + "specialwords.ParametersAsyncClient.withElif": "SpecialWords.Parameters.withElif", + "specialwords.ParametersAsyncClient.withElifWithResponse": "SpecialWords.Parameters.withElif", + "specialwords.ParametersAsyncClient.withElse": "SpecialWords.Parameters.withElse", + "specialwords.ParametersAsyncClient.withElseWithResponse": "SpecialWords.Parameters.withElse", + "specialwords.ParametersAsyncClient.withExcept": "SpecialWords.Parameters.withExcept", + "specialwords.ParametersAsyncClient.withExceptWithResponse": "SpecialWords.Parameters.withExcept", + "specialwords.ParametersAsyncClient.withExec": "SpecialWords.Parameters.withExec", + "specialwords.ParametersAsyncClient.withExecWithResponse": "SpecialWords.Parameters.withExec", + "specialwords.ParametersAsyncClient.withFinally": "SpecialWords.Parameters.withFinally", + "specialwords.ParametersAsyncClient.withFinallyWithResponse": "SpecialWords.Parameters.withFinally", + "specialwords.ParametersAsyncClient.withFor": "SpecialWords.Parameters.withFor", + "specialwords.ParametersAsyncClient.withForWithResponse": "SpecialWords.Parameters.withFor", + "specialwords.ParametersAsyncClient.withFrom": "SpecialWords.Parameters.withFrom", + "specialwords.ParametersAsyncClient.withFromWithResponse": "SpecialWords.Parameters.withFrom", + "specialwords.ParametersAsyncClient.withGlobal": "SpecialWords.Parameters.withGlobal", + "specialwords.ParametersAsyncClient.withGlobalWithResponse": "SpecialWords.Parameters.withGlobal", + "specialwords.ParametersAsyncClient.withIf": "SpecialWords.Parameters.withIf", + "specialwords.ParametersAsyncClient.withIfWithResponse": "SpecialWords.Parameters.withIf", + "specialwords.ParametersAsyncClient.withImport": "SpecialWords.Parameters.withImport", + "specialwords.ParametersAsyncClient.withImportWithResponse": "SpecialWords.Parameters.withImport", + "specialwords.ParametersAsyncClient.withIn": "SpecialWords.Parameters.withIn", + "specialwords.ParametersAsyncClient.withInWithResponse": "SpecialWords.Parameters.withIn", + "specialwords.ParametersAsyncClient.withIs": "SpecialWords.Parameters.withIs", + "specialwords.ParametersAsyncClient.withIsWithResponse": "SpecialWords.Parameters.withIs", + "specialwords.ParametersAsyncClient.withLambda": "SpecialWords.Parameters.withLambda", + "specialwords.ParametersAsyncClient.withLambdaWithResponse": "SpecialWords.Parameters.withLambda", + "specialwords.ParametersAsyncClient.withNot": "SpecialWords.Parameters.withNot", + "specialwords.ParametersAsyncClient.withNotWithResponse": "SpecialWords.Parameters.withNot", + "specialwords.ParametersAsyncClient.withOr": "SpecialWords.Parameters.withOr", + "specialwords.ParametersAsyncClient.withOrWithResponse": "SpecialWords.Parameters.withOr", + "specialwords.ParametersAsyncClient.withPass": "SpecialWords.Parameters.withPass", + "specialwords.ParametersAsyncClient.withPassWithResponse": "SpecialWords.Parameters.withPass", + "specialwords.ParametersAsyncClient.withRaise": "SpecialWords.Parameters.withRaise", + "specialwords.ParametersAsyncClient.withRaiseWithResponse": "SpecialWords.Parameters.withRaise", + "specialwords.ParametersAsyncClient.withReturn": "SpecialWords.Parameters.withReturn", + "specialwords.ParametersAsyncClient.withReturnWithResponse": "SpecialWords.Parameters.withReturn", + "specialwords.ParametersAsyncClient.withTry": "SpecialWords.Parameters.withTry", + "specialwords.ParametersAsyncClient.withTryWithResponse": "SpecialWords.Parameters.withTry", + "specialwords.ParametersAsyncClient.withWhile": "SpecialWords.Parameters.withWhile", + "specialwords.ParametersAsyncClient.withWhileWithResponse": "SpecialWords.Parameters.withWhile", + "specialwords.ParametersAsyncClient.withWith": "SpecialWords.Parameters.withWith", + "specialwords.ParametersAsyncClient.withWithWithResponse": "SpecialWords.Parameters.withWith", + "specialwords.ParametersAsyncClient.withYield": "SpecialWords.Parameters.withYield", + "specialwords.ParametersAsyncClient.withYieldWithResponse": "SpecialWords.Parameters.withYield", + "specialwords.ParametersClient": "SpecialWords.Parameters", + "specialwords.ParametersClient.withAnd": "SpecialWords.Parameters.withAnd", + "specialwords.ParametersClient.withAndWithResponse": "SpecialWords.Parameters.withAnd", + "specialwords.ParametersClient.withAs": "SpecialWords.Parameters.withAs", + "specialwords.ParametersClient.withAsWithResponse": "SpecialWords.Parameters.withAs", + "specialwords.ParametersClient.withAssert": "SpecialWords.Parameters.withAssert", + "specialwords.ParametersClient.withAssertWithResponse": "SpecialWords.Parameters.withAssert", + "specialwords.ParametersClient.withAsyncWithResponse": "SpecialWords.Parameters.withAsync", + "specialwords.ParametersClient.withAwait": "SpecialWords.Parameters.withAwait", + "specialwords.ParametersClient.withAwaitWithResponse": "SpecialWords.Parameters.withAwait", + "specialwords.ParametersClient.withBreak": "SpecialWords.Parameters.withBreak", + "specialwords.ParametersClient.withBreakWithResponse": "SpecialWords.Parameters.withBreak", + "specialwords.ParametersClient.withCancellationToken": "SpecialWords.Parameters.withCancellationToken", + "specialwords.ParametersClient.withCancellationTokenWithResponse": "SpecialWords.Parameters.withCancellationToken", + "specialwords.ParametersClient.withClass": "SpecialWords.Parameters.withClass", + "specialwords.ParametersClient.withClassWithResponse": "SpecialWords.Parameters.withClass", + "specialwords.ParametersClient.withConstructor": "SpecialWords.Parameters.withConstructor", + "specialwords.ParametersClient.withConstructorWithResponse": "SpecialWords.Parameters.withConstructor", + "specialwords.ParametersClient.withContinue": "SpecialWords.Parameters.withContinue", + "specialwords.ParametersClient.withContinueWithResponse": "SpecialWords.Parameters.withContinue", + "specialwords.ParametersClient.withDef": "SpecialWords.Parameters.withDef", + "specialwords.ParametersClient.withDefWithResponse": "SpecialWords.Parameters.withDef", + "specialwords.ParametersClient.withDel": "SpecialWords.Parameters.withDel", + "specialwords.ParametersClient.withDelWithResponse": "SpecialWords.Parameters.withDel", + "specialwords.ParametersClient.withElif": "SpecialWords.Parameters.withElif", + "specialwords.ParametersClient.withElifWithResponse": "SpecialWords.Parameters.withElif", + "specialwords.ParametersClient.withElse": "SpecialWords.Parameters.withElse", + "specialwords.ParametersClient.withElseWithResponse": "SpecialWords.Parameters.withElse", + "specialwords.ParametersClient.withExcept": "SpecialWords.Parameters.withExcept", + "specialwords.ParametersClient.withExceptWithResponse": "SpecialWords.Parameters.withExcept", + "specialwords.ParametersClient.withExec": "SpecialWords.Parameters.withExec", + "specialwords.ParametersClient.withExecWithResponse": "SpecialWords.Parameters.withExec", + "specialwords.ParametersClient.withFinally": "SpecialWords.Parameters.withFinally", + "specialwords.ParametersClient.withFinallyWithResponse": "SpecialWords.Parameters.withFinally", + "specialwords.ParametersClient.withFor": "SpecialWords.Parameters.withFor", + "specialwords.ParametersClient.withForWithResponse": "SpecialWords.Parameters.withFor", + "specialwords.ParametersClient.withFrom": "SpecialWords.Parameters.withFrom", + "specialwords.ParametersClient.withFromWithResponse": "SpecialWords.Parameters.withFrom", + "specialwords.ParametersClient.withGlobal": "SpecialWords.Parameters.withGlobal", + "specialwords.ParametersClient.withGlobalWithResponse": "SpecialWords.Parameters.withGlobal", + "specialwords.ParametersClient.withIf": "SpecialWords.Parameters.withIf", + "specialwords.ParametersClient.withIfWithResponse": "SpecialWords.Parameters.withIf", + "specialwords.ParametersClient.withImport": "SpecialWords.Parameters.withImport", + "specialwords.ParametersClient.withImportWithResponse": "SpecialWords.Parameters.withImport", + "specialwords.ParametersClient.withIn": "SpecialWords.Parameters.withIn", + "specialwords.ParametersClient.withInWithResponse": "SpecialWords.Parameters.withIn", + "specialwords.ParametersClient.withIs": "SpecialWords.Parameters.withIs", + "specialwords.ParametersClient.withIsWithResponse": "SpecialWords.Parameters.withIs", + "specialwords.ParametersClient.withLambda": "SpecialWords.Parameters.withLambda", + "specialwords.ParametersClient.withLambdaWithResponse": "SpecialWords.Parameters.withLambda", + "specialwords.ParametersClient.withNot": "SpecialWords.Parameters.withNot", + "specialwords.ParametersClient.withNotWithResponse": "SpecialWords.Parameters.withNot", + "specialwords.ParametersClient.withOr": "SpecialWords.Parameters.withOr", + "specialwords.ParametersClient.withOrWithResponse": "SpecialWords.Parameters.withOr", + "specialwords.ParametersClient.withPass": "SpecialWords.Parameters.withPass", + "specialwords.ParametersClient.withPassWithResponse": "SpecialWords.Parameters.withPass", + "specialwords.ParametersClient.withRaise": "SpecialWords.Parameters.withRaise", + "specialwords.ParametersClient.withRaiseWithResponse": "SpecialWords.Parameters.withRaise", + "specialwords.ParametersClient.withReturn": "SpecialWords.Parameters.withReturn", + "specialwords.ParametersClient.withReturnWithResponse": "SpecialWords.Parameters.withReturn", + "specialwords.ParametersClient.withTry": "SpecialWords.Parameters.withTry", + "specialwords.ParametersClient.withTryWithResponse": "SpecialWords.Parameters.withTry", + "specialwords.ParametersClient.withWhile": "SpecialWords.Parameters.withWhile", + "specialwords.ParametersClient.withWhileWithResponse": "SpecialWords.Parameters.withWhile", + "specialwords.ParametersClient.withWith": "SpecialWords.Parameters.withWith", + "specialwords.ParametersClient.withWithWithResponse": "SpecialWords.Parameters.withWith", + "specialwords.ParametersClient.withYield": "SpecialWords.Parameters.withYield", + "specialwords.ParametersClient.withYieldWithResponse": "SpecialWords.Parameters.withYield", + "specialwords.SpecialWordsClientBuilder": "SpecialWords", + "specialwords.modelproperties.models.DictMethods": "SpecialWords.ModelProperties.DictMethods", + "specialwords.modelproperties.models.SameAsModel": "SpecialWords.ModelProperties.SameAsModel", + "specialwords.models.models.And": "SpecialWords.Models.and", + "specialwords.models.models.As": "SpecialWords.Models.as", + "specialwords.models.models.Assert": "SpecialWords.Models.assert", + "specialwords.models.models.Async": "SpecialWords.Models.async", + "specialwords.models.models.Await": "SpecialWords.Models.await", + "specialwords.models.models.Break": "SpecialWords.Models.break", + "specialwords.models.models.ClassModel": "SpecialWords.Models.class", + "specialwords.models.models.Constructor": "SpecialWords.Models.constructor", + "specialwords.models.models.Continue": "SpecialWords.Models.continue", + "specialwords.models.models.Def": "SpecialWords.Models.def", + "specialwords.models.models.Del": "SpecialWords.Models.del", + "specialwords.models.models.Elif": "SpecialWords.Models.elif", + "specialwords.models.models.Else": "SpecialWords.Models.else", + "specialwords.models.models.Except": "SpecialWords.Models.except", + "specialwords.models.models.Exec": "SpecialWords.Models.exec", + "specialwords.models.models.Finally": "SpecialWords.Models.finally", + "specialwords.models.models.For": "SpecialWords.Models.for", + "specialwords.models.models.From": "SpecialWords.Models.from", + "specialwords.models.models.Global": "SpecialWords.Models.global", + "specialwords.models.models.If": "SpecialWords.Models.if", + "specialwords.models.models.Import": "SpecialWords.Models.import", + "specialwords.models.models.In": "SpecialWords.Models.in", + "specialwords.models.models.Is": "SpecialWords.Models.is", + "specialwords.models.models.Lambda": "SpecialWords.Models.lambda", + "specialwords.models.models.Not": "SpecialWords.Models.not", + "specialwords.models.models.Or": "SpecialWords.Models.or", + "specialwords.models.models.Pass": "SpecialWords.Models.pass", + "specialwords.models.models.Raise": "SpecialWords.Models.raise", + "specialwords.models.models.Return": "SpecialWords.Models.return", + "specialwords.models.models.Try": "SpecialWords.Models.try", + "specialwords.models.models.While": "SpecialWords.Models.while", + "specialwords.models.models.With": "SpecialWords.Models.with", + "specialwords.models.models.Yield": "SpecialWords.Models.yield" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_metadata.json new file mode 100644 index 00000000000..b15d6bfff0e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/specialwords_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"specialwords.ModelPropertiesAsyncClient":"SpecialWords.ModelProperties","specialwords.ModelPropertiesAsyncClient.dictMethods":"SpecialWords.ModelProperties.dictMethods","specialwords.ModelPropertiesAsyncClient.dictMethodsWithResponse":"SpecialWords.ModelProperties.dictMethods","specialwords.ModelPropertiesAsyncClient.sameAsModel":"SpecialWords.ModelProperties.sameAsModel","specialwords.ModelPropertiesAsyncClient.sameAsModelWithResponse":"SpecialWords.ModelProperties.sameAsModel","specialwords.ModelPropertiesClient":"SpecialWords.ModelProperties","specialwords.ModelPropertiesClient.dictMethods":"SpecialWords.ModelProperties.dictMethods","specialwords.ModelPropertiesClient.dictMethodsWithResponse":"SpecialWords.ModelProperties.dictMethods","specialwords.ModelPropertiesClient.sameAsModel":"SpecialWords.ModelProperties.sameAsModel","specialwords.ModelPropertiesClient.sameAsModelWithResponse":"SpecialWords.ModelProperties.sameAsModel","specialwords.ModelsAsyncClient":"SpecialWords.Models","specialwords.ModelsAsyncClient.withAnd":"SpecialWords.Models.withAnd","specialwords.ModelsAsyncClient.withAndWithResponse":"SpecialWords.Models.withAnd","specialwords.ModelsAsyncClient.withAs":"SpecialWords.Models.withAs","specialwords.ModelsAsyncClient.withAsWithResponse":"SpecialWords.Models.withAs","specialwords.ModelsAsyncClient.withAssert":"SpecialWords.Models.withAssert","specialwords.ModelsAsyncClient.withAssertWithResponse":"SpecialWords.Models.withAssert","specialwords.ModelsAsyncClient.withAsyncWithResponse":"SpecialWords.Models.withAsync","specialwords.ModelsAsyncClient.withAwait":"SpecialWords.Models.withAwait","specialwords.ModelsAsyncClient.withAwaitWithResponse":"SpecialWords.Models.withAwait","specialwords.ModelsAsyncClient.withBreak":"SpecialWords.Models.withBreak","specialwords.ModelsAsyncClient.withBreakWithResponse":"SpecialWords.Models.withBreak","specialwords.ModelsAsyncClient.withClass":"SpecialWords.Models.withClass","specialwords.ModelsAsyncClient.withClassWithResponse":"SpecialWords.Models.withClass","specialwords.ModelsAsyncClient.withConstructor":"SpecialWords.Models.withConstructor","specialwords.ModelsAsyncClient.withConstructorWithResponse":"SpecialWords.Models.withConstructor","specialwords.ModelsAsyncClient.withContinue":"SpecialWords.Models.withContinue","specialwords.ModelsAsyncClient.withContinueWithResponse":"SpecialWords.Models.withContinue","specialwords.ModelsAsyncClient.withDef":"SpecialWords.Models.withDef","specialwords.ModelsAsyncClient.withDefWithResponse":"SpecialWords.Models.withDef","specialwords.ModelsAsyncClient.withDel":"SpecialWords.Models.withDel","specialwords.ModelsAsyncClient.withDelWithResponse":"SpecialWords.Models.withDel","specialwords.ModelsAsyncClient.withElif":"SpecialWords.Models.withElif","specialwords.ModelsAsyncClient.withElifWithResponse":"SpecialWords.Models.withElif","specialwords.ModelsAsyncClient.withElse":"SpecialWords.Models.withElse","specialwords.ModelsAsyncClient.withElseWithResponse":"SpecialWords.Models.withElse","specialwords.ModelsAsyncClient.withExcept":"SpecialWords.Models.withExcept","specialwords.ModelsAsyncClient.withExceptWithResponse":"SpecialWords.Models.withExcept","specialwords.ModelsAsyncClient.withExec":"SpecialWords.Models.withExec","specialwords.ModelsAsyncClient.withExecWithResponse":"SpecialWords.Models.withExec","specialwords.ModelsAsyncClient.withFinally":"SpecialWords.Models.withFinally","specialwords.ModelsAsyncClient.withFinallyWithResponse":"SpecialWords.Models.withFinally","specialwords.ModelsAsyncClient.withFor":"SpecialWords.Models.withFor","specialwords.ModelsAsyncClient.withForWithResponse":"SpecialWords.Models.withFor","specialwords.ModelsAsyncClient.withFrom":"SpecialWords.Models.withFrom","specialwords.ModelsAsyncClient.withFromWithResponse":"SpecialWords.Models.withFrom","specialwords.ModelsAsyncClient.withGlobal":"SpecialWords.Models.withGlobal","specialwords.ModelsAsyncClient.withGlobalWithResponse":"SpecialWords.Models.withGlobal","specialwords.ModelsAsyncClient.withIf":"SpecialWords.Models.withIf","specialwords.ModelsAsyncClient.withIfWithResponse":"SpecialWords.Models.withIf","specialwords.ModelsAsyncClient.withImport":"SpecialWords.Models.withImport","specialwords.ModelsAsyncClient.withImportWithResponse":"SpecialWords.Models.withImport","specialwords.ModelsAsyncClient.withIn":"SpecialWords.Models.withIn","specialwords.ModelsAsyncClient.withInWithResponse":"SpecialWords.Models.withIn","specialwords.ModelsAsyncClient.withIs":"SpecialWords.Models.withIs","specialwords.ModelsAsyncClient.withIsWithResponse":"SpecialWords.Models.withIs","specialwords.ModelsAsyncClient.withLambda":"SpecialWords.Models.withLambda","specialwords.ModelsAsyncClient.withLambdaWithResponse":"SpecialWords.Models.withLambda","specialwords.ModelsAsyncClient.withNot":"SpecialWords.Models.withNot","specialwords.ModelsAsyncClient.withNotWithResponse":"SpecialWords.Models.withNot","specialwords.ModelsAsyncClient.withOr":"SpecialWords.Models.withOr","specialwords.ModelsAsyncClient.withOrWithResponse":"SpecialWords.Models.withOr","specialwords.ModelsAsyncClient.withPass":"SpecialWords.Models.withPass","specialwords.ModelsAsyncClient.withPassWithResponse":"SpecialWords.Models.withPass","specialwords.ModelsAsyncClient.withRaise":"SpecialWords.Models.withRaise","specialwords.ModelsAsyncClient.withRaiseWithResponse":"SpecialWords.Models.withRaise","specialwords.ModelsAsyncClient.withReturn":"SpecialWords.Models.withReturn","specialwords.ModelsAsyncClient.withReturnWithResponse":"SpecialWords.Models.withReturn","specialwords.ModelsAsyncClient.withTry":"SpecialWords.Models.withTry","specialwords.ModelsAsyncClient.withTryWithResponse":"SpecialWords.Models.withTry","specialwords.ModelsAsyncClient.withWhile":"SpecialWords.Models.withWhile","specialwords.ModelsAsyncClient.withWhileWithResponse":"SpecialWords.Models.withWhile","specialwords.ModelsAsyncClient.withWith":"SpecialWords.Models.withWith","specialwords.ModelsAsyncClient.withWithWithResponse":"SpecialWords.Models.withWith","specialwords.ModelsAsyncClient.withYield":"SpecialWords.Models.withYield","specialwords.ModelsAsyncClient.withYieldWithResponse":"SpecialWords.Models.withYield","specialwords.ModelsClient":"SpecialWords.Models","specialwords.ModelsClient.withAnd":"SpecialWords.Models.withAnd","specialwords.ModelsClient.withAndWithResponse":"SpecialWords.Models.withAnd","specialwords.ModelsClient.withAs":"SpecialWords.Models.withAs","specialwords.ModelsClient.withAsWithResponse":"SpecialWords.Models.withAs","specialwords.ModelsClient.withAssert":"SpecialWords.Models.withAssert","specialwords.ModelsClient.withAssertWithResponse":"SpecialWords.Models.withAssert","specialwords.ModelsClient.withAsyncWithResponse":"SpecialWords.Models.withAsync","specialwords.ModelsClient.withAwait":"SpecialWords.Models.withAwait","specialwords.ModelsClient.withAwaitWithResponse":"SpecialWords.Models.withAwait","specialwords.ModelsClient.withBreak":"SpecialWords.Models.withBreak","specialwords.ModelsClient.withBreakWithResponse":"SpecialWords.Models.withBreak","specialwords.ModelsClient.withClass":"SpecialWords.Models.withClass","specialwords.ModelsClient.withClassWithResponse":"SpecialWords.Models.withClass","specialwords.ModelsClient.withConstructor":"SpecialWords.Models.withConstructor","specialwords.ModelsClient.withConstructorWithResponse":"SpecialWords.Models.withConstructor","specialwords.ModelsClient.withContinue":"SpecialWords.Models.withContinue","specialwords.ModelsClient.withContinueWithResponse":"SpecialWords.Models.withContinue","specialwords.ModelsClient.withDef":"SpecialWords.Models.withDef","specialwords.ModelsClient.withDefWithResponse":"SpecialWords.Models.withDef","specialwords.ModelsClient.withDel":"SpecialWords.Models.withDel","specialwords.ModelsClient.withDelWithResponse":"SpecialWords.Models.withDel","specialwords.ModelsClient.withElif":"SpecialWords.Models.withElif","specialwords.ModelsClient.withElifWithResponse":"SpecialWords.Models.withElif","specialwords.ModelsClient.withElse":"SpecialWords.Models.withElse","specialwords.ModelsClient.withElseWithResponse":"SpecialWords.Models.withElse","specialwords.ModelsClient.withExcept":"SpecialWords.Models.withExcept","specialwords.ModelsClient.withExceptWithResponse":"SpecialWords.Models.withExcept","specialwords.ModelsClient.withExec":"SpecialWords.Models.withExec","specialwords.ModelsClient.withExecWithResponse":"SpecialWords.Models.withExec","specialwords.ModelsClient.withFinally":"SpecialWords.Models.withFinally","specialwords.ModelsClient.withFinallyWithResponse":"SpecialWords.Models.withFinally","specialwords.ModelsClient.withFor":"SpecialWords.Models.withFor","specialwords.ModelsClient.withForWithResponse":"SpecialWords.Models.withFor","specialwords.ModelsClient.withFrom":"SpecialWords.Models.withFrom","specialwords.ModelsClient.withFromWithResponse":"SpecialWords.Models.withFrom","specialwords.ModelsClient.withGlobal":"SpecialWords.Models.withGlobal","specialwords.ModelsClient.withGlobalWithResponse":"SpecialWords.Models.withGlobal","specialwords.ModelsClient.withIf":"SpecialWords.Models.withIf","specialwords.ModelsClient.withIfWithResponse":"SpecialWords.Models.withIf","specialwords.ModelsClient.withImport":"SpecialWords.Models.withImport","specialwords.ModelsClient.withImportWithResponse":"SpecialWords.Models.withImport","specialwords.ModelsClient.withIn":"SpecialWords.Models.withIn","specialwords.ModelsClient.withInWithResponse":"SpecialWords.Models.withIn","specialwords.ModelsClient.withIs":"SpecialWords.Models.withIs","specialwords.ModelsClient.withIsWithResponse":"SpecialWords.Models.withIs","specialwords.ModelsClient.withLambda":"SpecialWords.Models.withLambda","specialwords.ModelsClient.withLambdaWithResponse":"SpecialWords.Models.withLambda","specialwords.ModelsClient.withNot":"SpecialWords.Models.withNot","specialwords.ModelsClient.withNotWithResponse":"SpecialWords.Models.withNot","specialwords.ModelsClient.withOr":"SpecialWords.Models.withOr","specialwords.ModelsClient.withOrWithResponse":"SpecialWords.Models.withOr","specialwords.ModelsClient.withPass":"SpecialWords.Models.withPass","specialwords.ModelsClient.withPassWithResponse":"SpecialWords.Models.withPass","specialwords.ModelsClient.withRaise":"SpecialWords.Models.withRaise","specialwords.ModelsClient.withRaiseWithResponse":"SpecialWords.Models.withRaise","specialwords.ModelsClient.withReturn":"SpecialWords.Models.withReturn","specialwords.ModelsClient.withReturnWithResponse":"SpecialWords.Models.withReturn","specialwords.ModelsClient.withTry":"SpecialWords.Models.withTry","specialwords.ModelsClient.withTryWithResponse":"SpecialWords.Models.withTry","specialwords.ModelsClient.withWhile":"SpecialWords.Models.withWhile","specialwords.ModelsClient.withWhileWithResponse":"SpecialWords.Models.withWhile","specialwords.ModelsClient.withWith":"SpecialWords.Models.withWith","specialwords.ModelsClient.withWithWithResponse":"SpecialWords.Models.withWith","specialwords.ModelsClient.withYield":"SpecialWords.Models.withYield","specialwords.ModelsClient.withYieldWithResponse":"SpecialWords.Models.withYield","specialwords.OperationsAsyncClient":"SpecialWords.Operations","specialwords.OperationsAsyncClient.and":"SpecialWords.Operations.and","specialwords.OperationsAsyncClient.andWithResponse":"SpecialWords.Operations.and","specialwords.OperationsAsyncClient.as":"SpecialWords.Operations.as","specialwords.OperationsAsyncClient.asWithResponse":"SpecialWords.Operations.as","specialwords.OperationsAsyncClient.assertMethod":"SpecialWords.Operations.assert","specialwords.OperationsAsyncClient.assertMethodWithResponse":"SpecialWords.Operations.assert","specialwords.OperationsAsyncClient.async":"SpecialWords.Operations.async","specialwords.OperationsAsyncClient.asyncWithResponse":"SpecialWords.Operations.async","specialwords.OperationsAsyncClient.await":"SpecialWords.Operations.await","specialwords.OperationsAsyncClient.awaitWithResponse":"SpecialWords.Operations.await","specialwords.OperationsAsyncClient.breakMethod":"SpecialWords.Operations.break","specialwords.OperationsAsyncClient.breakMethodWithResponse":"SpecialWords.Operations.break","specialwords.OperationsAsyncClient.classMethod":"SpecialWords.Operations.class","specialwords.OperationsAsyncClient.classMethodWithResponse":"SpecialWords.Operations.class","specialwords.OperationsAsyncClient.constructor":"SpecialWords.Operations.constructor","specialwords.OperationsAsyncClient.constructorWithResponse":"SpecialWords.Operations.constructor","specialwords.OperationsAsyncClient.continueMethod":"SpecialWords.Operations.continue","specialwords.OperationsAsyncClient.continueMethodWithResponse":"SpecialWords.Operations.continue","specialwords.OperationsAsyncClient.def":"SpecialWords.Operations.def","specialwords.OperationsAsyncClient.defWithResponse":"SpecialWords.Operations.def","specialwords.OperationsAsyncClient.del":"SpecialWords.Operations.del","specialwords.OperationsAsyncClient.delWithResponse":"SpecialWords.Operations.del","specialwords.OperationsAsyncClient.elif":"SpecialWords.Operations.elif","specialwords.OperationsAsyncClient.elifWithResponse":"SpecialWords.Operations.elif","specialwords.OperationsAsyncClient.elseMethod":"SpecialWords.Operations.else","specialwords.OperationsAsyncClient.elseMethodWithResponse":"SpecialWords.Operations.else","specialwords.OperationsAsyncClient.except":"SpecialWords.Operations.except","specialwords.OperationsAsyncClient.exceptWithResponse":"SpecialWords.Operations.except","specialwords.OperationsAsyncClient.exec":"SpecialWords.Operations.exec","specialwords.OperationsAsyncClient.execWithResponse":"SpecialWords.Operations.exec","specialwords.OperationsAsyncClient.finallyMethod":"SpecialWords.Operations.finally","specialwords.OperationsAsyncClient.finallyMethodWithResponse":"SpecialWords.Operations.finally","specialwords.OperationsAsyncClient.forMethod":"SpecialWords.Operations.for","specialwords.OperationsAsyncClient.forMethodWithResponse":"SpecialWords.Operations.for","specialwords.OperationsAsyncClient.from":"SpecialWords.Operations.from","specialwords.OperationsAsyncClient.fromWithResponse":"SpecialWords.Operations.from","specialwords.OperationsAsyncClient.global":"SpecialWords.Operations.global","specialwords.OperationsAsyncClient.globalWithResponse":"SpecialWords.Operations.global","specialwords.OperationsAsyncClient.ifMethod":"SpecialWords.Operations.if","specialwords.OperationsAsyncClient.ifMethodWithResponse":"SpecialWords.Operations.if","specialwords.OperationsAsyncClient.importMethod":"SpecialWords.Operations.import","specialwords.OperationsAsyncClient.importMethodWithResponse":"SpecialWords.Operations.import","specialwords.OperationsAsyncClient.in":"SpecialWords.Operations.in","specialwords.OperationsAsyncClient.inWithResponse":"SpecialWords.Operations.in","specialwords.OperationsAsyncClient.is":"SpecialWords.Operations.is","specialwords.OperationsAsyncClient.isWithResponse":"SpecialWords.Operations.is","specialwords.OperationsAsyncClient.lambda":"SpecialWords.Operations.lambda","specialwords.OperationsAsyncClient.lambdaWithResponse":"SpecialWords.Operations.lambda","specialwords.OperationsAsyncClient.not":"SpecialWords.Operations.not","specialwords.OperationsAsyncClient.notWithResponse":"SpecialWords.Operations.not","specialwords.OperationsAsyncClient.or":"SpecialWords.Operations.or","specialwords.OperationsAsyncClient.orWithResponse":"SpecialWords.Operations.or","specialwords.OperationsAsyncClient.pass":"SpecialWords.Operations.pass","specialwords.OperationsAsyncClient.passWithResponse":"SpecialWords.Operations.pass","specialwords.OperationsAsyncClient.raise":"SpecialWords.Operations.raise","specialwords.OperationsAsyncClient.raiseWithResponse":"SpecialWords.Operations.raise","specialwords.OperationsAsyncClient.returnMethod":"SpecialWords.Operations.return","specialwords.OperationsAsyncClient.returnMethodWithResponse":"SpecialWords.Operations.return","specialwords.OperationsAsyncClient.tryMethod":"SpecialWords.Operations.try","specialwords.OperationsAsyncClient.tryMethodWithResponse":"SpecialWords.Operations.try","specialwords.OperationsAsyncClient.whileMethod":"SpecialWords.Operations.while","specialwords.OperationsAsyncClient.whileMethodWithResponse":"SpecialWords.Operations.while","specialwords.OperationsAsyncClient.with":"SpecialWords.Operations.with","specialwords.OperationsAsyncClient.withWithResponse":"SpecialWords.Operations.with","specialwords.OperationsAsyncClient.yield":"SpecialWords.Operations.yield","specialwords.OperationsAsyncClient.yieldWithResponse":"SpecialWords.Operations.yield","specialwords.OperationsClient":"SpecialWords.Operations","specialwords.OperationsClient.and":"SpecialWords.Operations.and","specialwords.OperationsClient.andWithResponse":"SpecialWords.Operations.and","specialwords.OperationsClient.as":"SpecialWords.Operations.as","specialwords.OperationsClient.asWithResponse":"SpecialWords.Operations.as","specialwords.OperationsClient.assertMethod":"SpecialWords.Operations.assert","specialwords.OperationsClient.assertMethodWithResponse":"SpecialWords.Operations.assert","specialwords.OperationsClient.async":"SpecialWords.Operations.async","specialwords.OperationsClient.asyncWithResponse":"SpecialWords.Operations.async","specialwords.OperationsClient.await":"SpecialWords.Operations.await","specialwords.OperationsClient.awaitWithResponse":"SpecialWords.Operations.await","specialwords.OperationsClient.breakMethod":"SpecialWords.Operations.break","specialwords.OperationsClient.breakMethodWithResponse":"SpecialWords.Operations.break","specialwords.OperationsClient.classMethod":"SpecialWords.Operations.class","specialwords.OperationsClient.classMethodWithResponse":"SpecialWords.Operations.class","specialwords.OperationsClient.constructor":"SpecialWords.Operations.constructor","specialwords.OperationsClient.constructorWithResponse":"SpecialWords.Operations.constructor","specialwords.OperationsClient.continueMethod":"SpecialWords.Operations.continue","specialwords.OperationsClient.continueMethodWithResponse":"SpecialWords.Operations.continue","specialwords.OperationsClient.def":"SpecialWords.Operations.def","specialwords.OperationsClient.defWithResponse":"SpecialWords.Operations.def","specialwords.OperationsClient.del":"SpecialWords.Operations.del","specialwords.OperationsClient.delWithResponse":"SpecialWords.Operations.del","specialwords.OperationsClient.elif":"SpecialWords.Operations.elif","specialwords.OperationsClient.elifWithResponse":"SpecialWords.Operations.elif","specialwords.OperationsClient.elseMethod":"SpecialWords.Operations.else","specialwords.OperationsClient.elseMethodWithResponse":"SpecialWords.Operations.else","specialwords.OperationsClient.except":"SpecialWords.Operations.except","specialwords.OperationsClient.exceptWithResponse":"SpecialWords.Operations.except","specialwords.OperationsClient.exec":"SpecialWords.Operations.exec","specialwords.OperationsClient.execWithResponse":"SpecialWords.Operations.exec","specialwords.OperationsClient.finallyMethod":"SpecialWords.Operations.finally","specialwords.OperationsClient.finallyMethodWithResponse":"SpecialWords.Operations.finally","specialwords.OperationsClient.forMethod":"SpecialWords.Operations.for","specialwords.OperationsClient.forMethodWithResponse":"SpecialWords.Operations.for","specialwords.OperationsClient.from":"SpecialWords.Operations.from","specialwords.OperationsClient.fromWithResponse":"SpecialWords.Operations.from","specialwords.OperationsClient.global":"SpecialWords.Operations.global","specialwords.OperationsClient.globalWithResponse":"SpecialWords.Operations.global","specialwords.OperationsClient.ifMethod":"SpecialWords.Operations.if","specialwords.OperationsClient.ifMethodWithResponse":"SpecialWords.Operations.if","specialwords.OperationsClient.importMethod":"SpecialWords.Operations.import","specialwords.OperationsClient.importMethodWithResponse":"SpecialWords.Operations.import","specialwords.OperationsClient.in":"SpecialWords.Operations.in","specialwords.OperationsClient.inWithResponse":"SpecialWords.Operations.in","specialwords.OperationsClient.is":"SpecialWords.Operations.is","specialwords.OperationsClient.isWithResponse":"SpecialWords.Operations.is","specialwords.OperationsClient.lambda":"SpecialWords.Operations.lambda","specialwords.OperationsClient.lambdaWithResponse":"SpecialWords.Operations.lambda","specialwords.OperationsClient.not":"SpecialWords.Operations.not","specialwords.OperationsClient.notWithResponse":"SpecialWords.Operations.not","specialwords.OperationsClient.or":"SpecialWords.Operations.or","specialwords.OperationsClient.orWithResponse":"SpecialWords.Operations.or","specialwords.OperationsClient.pass":"SpecialWords.Operations.pass","specialwords.OperationsClient.passWithResponse":"SpecialWords.Operations.pass","specialwords.OperationsClient.raise":"SpecialWords.Operations.raise","specialwords.OperationsClient.raiseWithResponse":"SpecialWords.Operations.raise","specialwords.OperationsClient.returnMethod":"SpecialWords.Operations.return","specialwords.OperationsClient.returnMethodWithResponse":"SpecialWords.Operations.return","specialwords.OperationsClient.tryMethod":"SpecialWords.Operations.try","specialwords.OperationsClient.tryMethodWithResponse":"SpecialWords.Operations.try","specialwords.OperationsClient.whileMethod":"SpecialWords.Operations.while","specialwords.OperationsClient.whileMethodWithResponse":"SpecialWords.Operations.while","specialwords.OperationsClient.with":"SpecialWords.Operations.with","specialwords.OperationsClient.withWithResponse":"SpecialWords.Operations.with","specialwords.OperationsClient.yield":"SpecialWords.Operations.yield","specialwords.OperationsClient.yieldWithResponse":"SpecialWords.Operations.yield","specialwords.ParametersAsyncClient":"SpecialWords.Parameters","specialwords.ParametersAsyncClient.withAnd":"SpecialWords.Parameters.withAnd","specialwords.ParametersAsyncClient.withAndWithResponse":"SpecialWords.Parameters.withAnd","specialwords.ParametersAsyncClient.withAs":"SpecialWords.Parameters.withAs","specialwords.ParametersAsyncClient.withAsWithResponse":"SpecialWords.Parameters.withAs","specialwords.ParametersAsyncClient.withAssert":"SpecialWords.Parameters.withAssert","specialwords.ParametersAsyncClient.withAssertWithResponse":"SpecialWords.Parameters.withAssert","specialwords.ParametersAsyncClient.withAsyncWithResponse":"SpecialWords.Parameters.withAsync","specialwords.ParametersAsyncClient.withAwait":"SpecialWords.Parameters.withAwait","specialwords.ParametersAsyncClient.withAwaitWithResponse":"SpecialWords.Parameters.withAwait","specialwords.ParametersAsyncClient.withBreak":"SpecialWords.Parameters.withBreak","specialwords.ParametersAsyncClient.withBreakWithResponse":"SpecialWords.Parameters.withBreak","specialwords.ParametersAsyncClient.withCancellationToken":"SpecialWords.Parameters.withCancellationToken","specialwords.ParametersAsyncClient.withCancellationTokenWithResponse":"SpecialWords.Parameters.withCancellationToken","specialwords.ParametersAsyncClient.withClass":"SpecialWords.Parameters.withClass","specialwords.ParametersAsyncClient.withClassWithResponse":"SpecialWords.Parameters.withClass","specialwords.ParametersAsyncClient.withConstructor":"SpecialWords.Parameters.withConstructor","specialwords.ParametersAsyncClient.withConstructorWithResponse":"SpecialWords.Parameters.withConstructor","specialwords.ParametersAsyncClient.withContinue":"SpecialWords.Parameters.withContinue","specialwords.ParametersAsyncClient.withContinueWithResponse":"SpecialWords.Parameters.withContinue","specialwords.ParametersAsyncClient.withDef":"SpecialWords.Parameters.withDef","specialwords.ParametersAsyncClient.withDefWithResponse":"SpecialWords.Parameters.withDef","specialwords.ParametersAsyncClient.withDel":"SpecialWords.Parameters.withDel","specialwords.ParametersAsyncClient.withDelWithResponse":"SpecialWords.Parameters.withDel","specialwords.ParametersAsyncClient.withElif":"SpecialWords.Parameters.withElif","specialwords.ParametersAsyncClient.withElifWithResponse":"SpecialWords.Parameters.withElif","specialwords.ParametersAsyncClient.withElse":"SpecialWords.Parameters.withElse","specialwords.ParametersAsyncClient.withElseWithResponse":"SpecialWords.Parameters.withElse","specialwords.ParametersAsyncClient.withExcept":"SpecialWords.Parameters.withExcept","specialwords.ParametersAsyncClient.withExceptWithResponse":"SpecialWords.Parameters.withExcept","specialwords.ParametersAsyncClient.withExec":"SpecialWords.Parameters.withExec","specialwords.ParametersAsyncClient.withExecWithResponse":"SpecialWords.Parameters.withExec","specialwords.ParametersAsyncClient.withFinally":"SpecialWords.Parameters.withFinally","specialwords.ParametersAsyncClient.withFinallyWithResponse":"SpecialWords.Parameters.withFinally","specialwords.ParametersAsyncClient.withFor":"SpecialWords.Parameters.withFor","specialwords.ParametersAsyncClient.withForWithResponse":"SpecialWords.Parameters.withFor","specialwords.ParametersAsyncClient.withFrom":"SpecialWords.Parameters.withFrom","specialwords.ParametersAsyncClient.withFromWithResponse":"SpecialWords.Parameters.withFrom","specialwords.ParametersAsyncClient.withGlobal":"SpecialWords.Parameters.withGlobal","specialwords.ParametersAsyncClient.withGlobalWithResponse":"SpecialWords.Parameters.withGlobal","specialwords.ParametersAsyncClient.withIf":"SpecialWords.Parameters.withIf","specialwords.ParametersAsyncClient.withIfWithResponse":"SpecialWords.Parameters.withIf","specialwords.ParametersAsyncClient.withImport":"SpecialWords.Parameters.withImport","specialwords.ParametersAsyncClient.withImportWithResponse":"SpecialWords.Parameters.withImport","specialwords.ParametersAsyncClient.withIn":"SpecialWords.Parameters.withIn","specialwords.ParametersAsyncClient.withInWithResponse":"SpecialWords.Parameters.withIn","specialwords.ParametersAsyncClient.withIs":"SpecialWords.Parameters.withIs","specialwords.ParametersAsyncClient.withIsWithResponse":"SpecialWords.Parameters.withIs","specialwords.ParametersAsyncClient.withLambda":"SpecialWords.Parameters.withLambda","specialwords.ParametersAsyncClient.withLambdaWithResponse":"SpecialWords.Parameters.withLambda","specialwords.ParametersAsyncClient.withNot":"SpecialWords.Parameters.withNot","specialwords.ParametersAsyncClient.withNotWithResponse":"SpecialWords.Parameters.withNot","specialwords.ParametersAsyncClient.withOr":"SpecialWords.Parameters.withOr","specialwords.ParametersAsyncClient.withOrWithResponse":"SpecialWords.Parameters.withOr","specialwords.ParametersAsyncClient.withPass":"SpecialWords.Parameters.withPass","specialwords.ParametersAsyncClient.withPassWithResponse":"SpecialWords.Parameters.withPass","specialwords.ParametersAsyncClient.withRaise":"SpecialWords.Parameters.withRaise","specialwords.ParametersAsyncClient.withRaiseWithResponse":"SpecialWords.Parameters.withRaise","specialwords.ParametersAsyncClient.withReturn":"SpecialWords.Parameters.withReturn","specialwords.ParametersAsyncClient.withReturnWithResponse":"SpecialWords.Parameters.withReturn","specialwords.ParametersAsyncClient.withTry":"SpecialWords.Parameters.withTry","specialwords.ParametersAsyncClient.withTryWithResponse":"SpecialWords.Parameters.withTry","specialwords.ParametersAsyncClient.withWhile":"SpecialWords.Parameters.withWhile","specialwords.ParametersAsyncClient.withWhileWithResponse":"SpecialWords.Parameters.withWhile","specialwords.ParametersAsyncClient.withWith":"SpecialWords.Parameters.withWith","specialwords.ParametersAsyncClient.withWithWithResponse":"SpecialWords.Parameters.withWith","specialwords.ParametersAsyncClient.withYield":"SpecialWords.Parameters.withYield","specialwords.ParametersAsyncClient.withYieldWithResponse":"SpecialWords.Parameters.withYield","specialwords.ParametersClient":"SpecialWords.Parameters","specialwords.ParametersClient.withAnd":"SpecialWords.Parameters.withAnd","specialwords.ParametersClient.withAndWithResponse":"SpecialWords.Parameters.withAnd","specialwords.ParametersClient.withAs":"SpecialWords.Parameters.withAs","specialwords.ParametersClient.withAsWithResponse":"SpecialWords.Parameters.withAs","specialwords.ParametersClient.withAssert":"SpecialWords.Parameters.withAssert","specialwords.ParametersClient.withAssertWithResponse":"SpecialWords.Parameters.withAssert","specialwords.ParametersClient.withAsyncWithResponse":"SpecialWords.Parameters.withAsync","specialwords.ParametersClient.withAwait":"SpecialWords.Parameters.withAwait","specialwords.ParametersClient.withAwaitWithResponse":"SpecialWords.Parameters.withAwait","specialwords.ParametersClient.withBreak":"SpecialWords.Parameters.withBreak","specialwords.ParametersClient.withBreakWithResponse":"SpecialWords.Parameters.withBreak","specialwords.ParametersClient.withCancellationToken":"SpecialWords.Parameters.withCancellationToken","specialwords.ParametersClient.withCancellationTokenWithResponse":"SpecialWords.Parameters.withCancellationToken","specialwords.ParametersClient.withClass":"SpecialWords.Parameters.withClass","specialwords.ParametersClient.withClassWithResponse":"SpecialWords.Parameters.withClass","specialwords.ParametersClient.withConstructor":"SpecialWords.Parameters.withConstructor","specialwords.ParametersClient.withConstructorWithResponse":"SpecialWords.Parameters.withConstructor","specialwords.ParametersClient.withContinue":"SpecialWords.Parameters.withContinue","specialwords.ParametersClient.withContinueWithResponse":"SpecialWords.Parameters.withContinue","specialwords.ParametersClient.withDef":"SpecialWords.Parameters.withDef","specialwords.ParametersClient.withDefWithResponse":"SpecialWords.Parameters.withDef","specialwords.ParametersClient.withDel":"SpecialWords.Parameters.withDel","specialwords.ParametersClient.withDelWithResponse":"SpecialWords.Parameters.withDel","specialwords.ParametersClient.withElif":"SpecialWords.Parameters.withElif","specialwords.ParametersClient.withElifWithResponse":"SpecialWords.Parameters.withElif","specialwords.ParametersClient.withElse":"SpecialWords.Parameters.withElse","specialwords.ParametersClient.withElseWithResponse":"SpecialWords.Parameters.withElse","specialwords.ParametersClient.withExcept":"SpecialWords.Parameters.withExcept","specialwords.ParametersClient.withExceptWithResponse":"SpecialWords.Parameters.withExcept","specialwords.ParametersClient.withExec":"SpecialWords.Parameters.withExec","specialwords.ParametersClient.withExecWithResponse":"SpecialWords.Parameters.withExec","specialwords.ParametersClient.withFinally":"SpecialWords.Parameters.withFinally","specialwords.ParametersClient.withFinallyWithResponse":"SpecialWords.Parameters.withFinally","specialwords.ParametersClient.withFor":"SpecialWords.Parameters.withFor","specialwords.ParametersClient.withForWithResponse":"SpecialWords.Parameters.withFor","specialwords.ParametersClient.withFrom":"SpecialWords.Parameters.withFrom","specialwords.ParametersClient.withFromWithResponse":"SpecialWords.Parameters.withFrom","specialwords.ParametersClient.withGlobal":"SpecialWords.Parameters.withGlobal","specialwords.ParametersClient.withGlobalWithResponse":"SpecialWords.Parameters.withGlobal","specialwords.ParametersClient.withIf":"SpecialWords.Parameters.withIf","specialwords.ParametersClient.withIfWithResponse":"SpecialWords.Parameters.withIf","specialwords.ParametersClient.withImport":"SpecialWords.Parameters.withImport","specialwords.ParametersClient.withImportWithResponse":"SpecialWords.Parameters.withImport","specialwords.ParametersClient.withIn":"SpecialWords.Parameters.withIn","specialwords.ParametersClient.withInWithResponse":"SpecialWords.Parameters.withIn","specialwords.ParametersClient.withIs":"SpecialWords.Parameters.withIs","specialwords.ParametersClient.withIsWithResponse":"SpecialWords.Parameters.withIs","specialwords.ParametersClient.withLambda":"SpecialWords.Parameters.withLambda","specialwords.ParametersClient.withLambdaWithResponse":"SpecialWords.Parameters.withLambda","specialwords.ParametersClient.withNot":"SpecialWords.Parameters.withNot","specialwords.ParametersClient.withNotWithResponse":"SpecialWords.Parameters.withNot","specialwords.ParametersClient.withOr":"SpecialWords.Parameters.withOr","specialwords.ParametersClient.withOrWithResponse":"SpecialWords.Parameters.withOr","specialwords.ParametersClient.withPass":"SpecialWords.Parameters.withPass","specialwords.ParametersClient.withPassWithResponse":"SpecialWords.Parameters.withPass","specialwords.ParametersClient.withRaise":"SpecialWords.Parameters.withRaise","specialwords.ParametersClient.withRaiseWithResponse":"SpecialWords.Parameters.withRaise","specialwords.ParametersClient.withReturn":"SpecialWords.Parameters.withReturn","specialwords.ParametersClient.withReturnWithResponse":"SpecialWords.Parameters.withReturn","specialwords.ParametersClient.withTry":"SpecialWords.Parameters.withTry","specialwords.ParametersClient.withTryWithResponse":"SpecialWords.Parameters.withTry","specialwords.ParametersClient.withWhile":"SpecialWords.Parameters.withWhile","specialwords.ParametersClient.withWhileWithResponse":"SpecialWords.Parameters.withWhile","specialwords.ParametersClient.withWith":"SpecialWords.Parameters.withWith","specialwords.ParametersClient.withWithWithResponse":"SpecialWords.Parameters.withWith","specialwords.ParametersClient.withYield":"SpecialWords.Parameters.withYield","specialwords.ParametersClient.withYieldWithResponse":"SpecialWords.Parameters.withYield","specialwords.SpecialWordsClientBuilder":"SpecialWords","specialwords.modelproperties.models.DictMethods":"SpecialWords.ModelProperties.DictMethods","specialwords.modelproperties.models.SameAsModel":"SpecialWords.ModelProperties.SameAsModel","specialwords.models.models.And":"SpecialWords.Models.and","specialwords.models.models.As":"SpecialWords.Models.as","specialwords.models.models.Assert":"SpecialWords.Models.assert","specialwords.models.models.Async":"SpecialWords.Models.async","specialwords.models.models.Await":"SpecialWords.Models.await","specialwords.models.models.Break":"SpecialWords.Models.break","specialwords.models.models.ClassModel":"SpecialWords.Models.class","specialwords.models.models.Constructor":"SpecialWords.Models.constructor","specialwords.models.models.Continue":"SpecialWords.Models.continue","specialwords.models.models.Def":"SpecialWords.Models.def","specialwords.models.models.Del":"SpecialWords.Models.del","specialwords.models.models.Elif":"SpecialWords.Models.elif","specialwords.models.models.Else":"SpecialWords.Models.else","specialwords.models.models.Except":"SpecialWords.Models.except","specialwords.models.models.Exec":"SpecialWords.Models.exec","specialwords.models.models.Finally":"SpecialWords.Models.finally","specialwords.models.models.For":"SpecialWords.Models.for","specialwords.models.models.From":"SpecialWords.Models.from","specialwords.models.models.Global":"SpecialWords.Models.global","specialwords.models.models.If":"SpecialWords.Models.if","specialwords.models.models.Import":"SpecialWords.Models.import","specialwords.models.models.In":"SpecialWords.Models.in","specialwords.models.models.Is":"SpecialWords.Models.is","specialwords.models.models.Lambda":"SpecialWords.Models.lambda","specialwords.models.models.Not":"SpecialWords.Models.not","specialwords.models.models.Or":"SpecialWords.Models.or","specialwords.models.models.Pass":"SpecialWords.Models.pass","specialwords.models.models.Raise":"SpecialWords.Models.raise","specialwords.models.models.Return":"SpecialWords.Models.return","specialwords.models.models.Try":"SpecialWords.Models.try","specialwords.models.models.While":"SpecialWords.Models.while","specialwords.models.models.With":"SpecialWords.Models.with","specialwords.models.models.Yield":"SpecialWords.Models.yield"},"generatedFiles":["src/main/java/module-info.java","src/main/java/specialwords/ModelPropertiesAsyncClient.java","src/main/java/specialwords/ModelPropertiesClient.java","src/main/java/specialwords/ModelsAsyncClient.java","src/main/java/specialwords/ModelsClient.java","src/main/java/specialwords/OperationsAsyncClient.java","src/main/java/specialwords/OperationsClient.java","src/main/java/specialwords/ParametersAsyncClient.java","src/main/java/specialwords/ParametersClient.java","src/main/java/specialwords/SpecialWordsClientBuilder.java","src/main/java/specialwords/implementation/ModelPropertiesImpl.java","src/main/java/specialwords/implementation/ModelsImpl.java","src/main/java/specialwords/implementation/OperationsImpl.java","src/main/java/specialwords/implementation/ParametersImpl.java","src/main/java/specialwords/implementation/SpecialWordsClientImpl.java","src/main/java/specialwords/implementation/package-info.java","src/main/java/specialwords/modelproperties/models/DictMethods.java","src/main/java/specialwords/modelproperties/models/SameAsModel.java","src/main/java/specialwords/modelproperties/models/package-info.java","src/main/java/specialwords/models/models/And.java","src/main/java/specialwords/models/models/As.java","src/main/java/specialwords/models/models/Assert.java","src/main/java/specialwords/models/models/Async.java","src/main/java/specialwords/models/models/Await.java","src/main/java/specialwords/models/models/Break.java","src/main/java/specialwords/models/models/ClassModel.java","src/main/java/specialwords/models/models/Constructor.java","src/main/java/specialwords/models/models/Continue.java","src/main/java/specialwords/models/models/Def.java","src/main/java/specialwords/models/models/Del.java","src/main/java/specialwords/models/models/Elif.java","src/main/java/specialwords/models/models/Else.java","src/main/java/specialwords/models/models/Except.java","src/main/java/specialwords/models/models/Exec.java","src/main/java/specialwords/models/models/Finally.java","src/main/java/specialwords/models/models/For.java","src/main/java/specialwords/models/models/From.java","src/main/java/specialwords/models/models/Global.java","src/main/java/specialwords/models/models/If.java","src/main/java/specialwords/models/models/Import.java","src/main/java/specialwords/models/models/In.java","src/main/java/specialwords/models/models/Is.java","src/main/java/specialwords/models/models/Lambda.java","src/main/java/specialwords/models/models/Not.java","src/main/java/specialwords/models/models/Or.java","src/main/java/specialwords/models/models/Pass.java","src/main/java/specialwords/models/models/Raise.java","src/main/java/specialwords/models/models/Return.java","src/main/java/specialwords/models/models/Try.java","src/main/java/specialwords/models/models/While.java","src/main/java/specialwords/models/models/With.java","src/main/java/specialwords/models/models/Yield.java","src/main/java/specialwords/models/models/package-info.java","src/main/java/specialwords/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_apiview_properties.json new file mode 100644 index 00000000000..3deb2426e93 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_apiview_properties.json @@ -0,0 +1,16 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "streaming.jsonl.JsonlAsyncClient": "Streaming.Jsonl.Basic", + "streaming.jsonl.JsonlAsyncClient.receive": "Streaming.Jsonl.Basic.receive", + "streaming.jsonl.JsonlAsyncClient.receiveWithResponse": "Streaming.Jsonl.Basic.receive", + "streaming.jsonl.JsonlAsyncClient.send": "Streaming.Jsonl.Basic.send", + "streaming.jsonl.JsonlAsyncClient.sendWithResponse": "Streaming.Jsonl.Basic.send", + "streaming.jsonl.JsonlClient": "Streaming.Jsonl.Basic", + "streaming.jsonl.JsonlClient.receive": "Streaming.Jsonl.Basic.receive", + "streaming.jsonl.JsonlClient.receiveWithResponse": "Streaming.Jsonl.Basic.receive", + "streaming.jsonl.JsonlClient.send": "Streaming.Jsonl.Basic.send", + "streaming.jsonl.JsonlClient.sendWithResponse": "Streaming.Jsonl.Basic.send", + "streaming.jsonl.JsonlClientBuilder": "Streaming.Jsonl" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_metadata.json new file mode 100644 index 00000000000..28c0c75f2ce --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/streaming-jsonl_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"streaming.jsonl.JsonlAsyncClient":"Streaming.Jsonl.Basic","streaming.jsonl.JsonlAsyncClient.receive":"Streaming.Jsonl.Basic.receive","streaming.jsonl.JsonlAsyncClient.receiveWithResponse":"Streaming.Jsonl.Basic.receive","streaming.jsonl.JsonlAsyncClient.send":"Streaming.Jsonl.Basic.send","streaming.jsonl.JsonlAsyncClient.sendWithResponse":"Streaming.Jsonl.Basic.send","streaming.jsonl.JsonlClient":"Streaming.Jsonl.Basic","streaming.jsonl.JsonlClient.receive":"Streaming.Jsonl.Basic.receive","streaming.jsonl.JsonlClient.receiveWithResponse":"Streaming.Jsonl.Basic.receive","streaming.jsonl.JsonlClient.send":"Streaming.Jsonl.Basic.send","streaming.jsonl.JsonlClient.sendWithResponse":"Streaming.Jsonl.Basic.send","streaming.jsonl.JsonlClientBuilder":"Streaming.Jsonl"},"generatedFiles":["src/main/java/module-info.java","src/main/java/streaming/jsonl/JsonlAsyncClient.java","src/main/java/streaming/jsonl/JsonlClient.java","src/main/java/streaming/jsonl/JsonlClientBuilder.java","src/main/java/streaming/jsonl/implementation/BasicsImpl.java","src/main/java/streaming/jsonl/implementation/JsonlClientImpl.java","src/main/java/streaming/jsonl/implementation/package-info.java","src/main/java/streaming/jsonl/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_apiview_properties.json new file mode 100644 index 00000000000..4f2f513124e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_apiview_properties.json @@ -0,0 +1,18 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.builtin.BuiltinAsyncClient": "TspTest.Builtin.BuiltinOp", + "tsptest.builtin.BuiltinAsyncClient.read": "TspTest.Builtin.BuiltinOp.read", + "tsptest.builtin.BuiltinAsyncClient.readWithResponse": "TspTest.Builtin.BuiltinOp.read", + "tsptest.builtin.BuiltinAsyncClient.write": "TspTest.Builtin.BuiltinOp.write", + "tsptest.builtin.BuiltinAsyncClient.writeWithResponse": "TspTest.Builtin.BuiltinOp.write", + "tsptest.builtin.BuiltinClient": "TspTest.Builtin.BuiltinOp", + "tsptest.builtin.BuiltinClient.read": "TspTest.Builtin.BuiltinOp.read", + "tsptest.builtin.BuiltinClient.readWithResponse": "TspTest.Builtin.BuiltinOp.read", + "tsptest.builtin.BuiltinClient.write": "TspTest.Builtin.BuiltinOp.write", + "tsptest.builtin.BuiltinClient.writeWithResponse": "TspTest.Builtin.BuiltinOp.write", + "tsptest.builtin.BuiltinClientBuilder": "TspTest.Builtin", + "tsptest.builtin.models.Builtin": "TspTest.Builtin.Builtin", + "tsptest.builtin.models.Encoded": "TspTest.Builtin.Encoded" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_metadata.json new file mode 100644 index 00000000000..8e0acdcd6f0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-builtin_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.builtin.BuiltinAsyncClient":"TspTest.Builtin.BuiltinOp","tsptest.builtin.BuiltinAsyncClient.read":"TspTest.Builtin.BuiltinOp.read","tsptest.builtin.BuiltinAsyncClient.readWithResponse":"TspTest.Builtin.BuiltinOp.read","tsptest.builtin.BuiltinAsyncClient.write":"TspTest.Builtin.BuiltinOp.write","tsptest.builtin.BuiltinAsyncClient.writeWithResponse":"TspTest.Builtin.BuiltinOp.write","tsptest.builtin.BuiltinClient":"TspTest.Builtin.BuiltinOp","tsptest.builtin.BuiltinClient.read":"TspTest.Builtin.BuiltinOp.read","tsptest.builtin.BuiltinClient.readWithResponse":"TspTest.Builtin.BuiltinOp.read","tsptest.builtin.BuiltinClient.write":"TspTest.Builtin.BuiltinOp.write","tsptest.builtin.BuiltinClient.writeWithResponse":"TspTest.Builtin.BuiltinOp.write","tsptest.builtin.BuiltinClientBuilder":"TspTest.Builtin","tsptest.builtin.models.Builtin":"TspTest.Builtin.Builtin","tsptest.builtin.models.Encoded":"TspTest.Builtin.Encoded"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/builtin/BuiltinAsyncClient.java","src/main/java/tsptest/builtin/BuiltinClient.java","src/main/java/tsptest/builtin/BuiltinClientBuilder.java","src/main/java/tsptest/builtin/implementation/BuiltinClientImpl.java","src/main/java/tsptest/builtin/implementation/BuiltinOpsImpl.java","src/main/java/tsptest/builtin/implementation/package-info.java","src/main/java/tsptest/builtin/models/Builtin.java","src/main/java/tsptest/builtin/models/Encoded.java","src/main/java/tsptest/builtin/models/package-info.java","src/main/java/tsptest/builtin/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_apiview_properties.json new file mode 100644 index 00000000000..155252204bc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_apiview_properties.json @@ -0,0 +1,21 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp", + "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildNewDiscrim": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim", + "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildNewDiscrimWithResponse": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim", + "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildRequiredDiscrim": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim", + "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildRequiredDiscrimWithResponse": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim", + "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp", + "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildNewDiscrim": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim", + "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildNewDiscrimWithResponse": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim", + "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildRequiredDiscrim": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim", + "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildRequiredDiscrimWithResponse": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim", + "tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClientBuilder": "TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp", + "tsptest.discriminatoredgecases.models.ChildWithAnotherDiscriminator": "TspTest.DiscriminatorEdgeCases.ChildWithAnotherDiscriminator", + "tsptest.discriminatoredgecases.models.ChildWithRequiredPropertyAsDiscriminator": "TspTest.DiscriminatorEdgeCases.ChildWithRequiredPropertyAsDiscriminator", + "tsptest.discriminatoredgecases.models.GrandChildWithAnotherDiscriminator": "TspTest.DiscriminatorEdgeCases.GrandChildWithAnotherDiscriminator", + "tsptest.discriminatoredgecases.models.GrandChildWithRequiredProperty": "TspTest.DiscriminatorEdgeCases.GrandChildWithRequiredProperty", + "tsptest.discriminatoredgecases.models.ParentWithRequiredProperty": "TspTest.DiscriminatorEdgeCases.ParentWithRequiredProperty" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_metadata.json new file mode 100644 index 00000000000..e873bad3cba --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-discriminatoredgecases_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildNewDiscrim":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildNewDiscrimWithResponse":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildRequiredDiscrim":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesAsyncClient.getChildRequiredDiscrimWithResponse":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildNewDiscrim":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildNewDiscrimWithResponse":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildNewDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildRequiredDiscrim":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient.getChildRequiredDiscrimWithResponse":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp.getChildRequiredDiscrim","tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClientBuilder":"TspTest.DiscriminatorEdgeCases.DiscriminatorEdgeCasesOp","tsptest.discriminatoredgecases.models.ChildWithAnotherDiscriminator":"TspTest.DiscriminatorEdgeCases.ChildWithAnotherDiscriminator","tsptest.discriminatoredgecases.models.ChildWithRequiredPropertyAsDiscriminator":"TspTest.DiscriminatorEdgeCases.ChildWithRequiredPropertyAsDiscriminator","tsptest.discriminatoredgecases.models.GrandChildWithAnotherDiscriminator":"TspTest.DiscriminatorEdgeCases.GrandChildWithAnotherDiscriminator","tsptest.discriminatoredgecases.models.GrandChildWithRequiredProperty":"TspTest.DiscriminatorEdgeCases.GrandChildWithRequiredProperty","tsptest.discriminatoredgecases.models.ParentWithRequiredProperty":"TspTest.DiscriminatorEdgeCases.ParentWithRequiredProperty"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesAsyncClient.java","src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClient.java","src/main/java/tsptest/discriminatoredgecases/DiscriminatorEdgeCasesClientBuilder.java","src/main/java/tsptest/discriminatoredgecases/implementation/DiscriminatorEdgeCasesClientImpl.java","src/main/java/tsptest/discriminatoredgecases/implementation/package-info.java","src/main/java/tsptest/discriminatoredgecases/models/ChildWithAnotherDiscriminator.java","src/main/java/tsptest/discriminatoredgecases/models/ChildWithRequiredPropertyAsDiscriminator.java","src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithAnotherDiscriminator.java","src/main/java/tsptest/discriminatoredgecases/models/GrandChildWithRequiredProperty.java","src/main/java/tsptest/discriminatoredgecases/models/ParentWithRequiredProperty.java","src/main/java/tsptest/discriminatoredgecases/models/package-info.java","src/main/java/tsptest/discriminatoredgecases/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_apiview_properties.json new file mode 100644 index 00000000000..c3c3c809f34 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_apiview_properties.json @@ -0,0 +1,39 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient": "TspTest.EnumNestedDiscriminator", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getMissingDiscriminator": "TspTest.EnumNestedDiscriminator.getMissingDiscriminator", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getMissingDiscriminatorWithResponse": "TspTest.EnumNestedDiscriminator.getMissingDiscriminator", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getModel": "TspTest.EnumNestedDiscriminator.getModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getModelWithResponse": "TspTest.EnumNestedDiscriminator.getModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getRecursiveModel": "TspTest.EnumNestedDiscriminator.getRecursiveModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getRecursiveModelWithResponse": "TspTest.EnumNestedDiscriminator.getRecursiveModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getWrongDiscriminator": "TspTest.EnumNestedDiscriminator.getWrongDiscriminator", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getWrongDiscriminatorWithResponse": "TspTest.EnumNestedDiscriminator.getWrongDiscriminator", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putModel": "TspTest.EnumNestedDiscriminator.putModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putModelWithResponse": "TspTest.EnumNestedDiscriminator.putModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putRecursiveModel": "TspTest.EnumNestedDiscriminator.putRecursiveModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putRecursiveModelWithResponse": "TspTest.EnumNestedDiscriminator.putRecursiveModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient": "TspTest.EnumNestedDiscriminator", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getMissingDiscriminator": "TspTest.EnumNestedDiscriminator.getMissingDiscriminator", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getMissingDiscriminatorWithResponse": "TspTest.EnumNestedDiscriminator.getMissingDiscriminator", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getModel": "TspTest.EnumNestedDiscriminator.getModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getModelWithResponse": "TspTest.EnumNestedDiscriminator.getModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getRecursiveModel": "TspTest.EnumNestedDiscriminator.getRecursiveModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getRecursiveModelWithResponse": "TspTest.EnumNestedDiscriminator.getRecursiveModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getWrongDiscriminator": "TspTest.EnumNestedDiscriminator.getWrongDiscriminator", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getWrongDiscriminatorWithResponse": "TspTest.EnumNestedDiscriminator.getWrongDiscriminator", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putModel": "TspTest.EnumNestedDiscriminator.putModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putModelWithResponse": "TspTest.EnumNestedDiscriminator.putModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putRecursiveModel": "TspTest.EnumNestedDiscriminator.putRecursiveModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putRecursiveModelWithResponse": "TspTest.EnumNestedDiscriminator.putRecursiveModel", + "tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClientBuilder": "TspTest.EnumNestedDiscriminator", + "tsptest.enumnesteddiscriminator.models.Fish": "TspTest.EnumNestedDiscriminator.Fish", + "tsptest.enumnesteddiscriminator.models.FishKind": "TspTest.EnumNestedDiscriminator.FishKind", + "tsptest.enumnesteddiscriminator.models.GoblinShark": "TspTest.EnumNestedDiscriminator.GoblinShark", + "tsptest.enumnesteddiscriminator.models.Salmon": "TspTest.EnumNestedDiscriminator.Salmon", + "tsptest.enumnesteddiscriminator.models.SawShark": "TspTest.EnumNestedDiscriminator.SawShark", + "tsptest.enumnesteddiscriminator.models.Shark": "TspTest.EnumNestedDiscriminator.Shark", + "tsptest.enumnesteddiscriminator.models.SharkKind": "TspTest.EnumNestedDiscriminator.SharkKind" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_metadata.json new file mode 100644 index 00000000000..266addcdb29 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumnesteddiscriminator_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient":"TspTest.EnumNestedDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getMissingDiscriminator":"TspTest.EnumNestedDiscriminator.getMissingDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getMissingDiscriminatorWithResponse":"TspTest.EnumNestedDiscriminator.getMissingDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getModel":"TspTest.EnumNestedDiscriminator.getModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getModelWithResponse":"TspTest.EnumNestedDiscriminator.getModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getRecursiveModel":"TspTest.EnumNestedDiscriminator.getRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getRecursiveModelWithResponse":"TspTest.EnumNestedDiscriminator.getRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getWrongDiscriminator":"TspTest.EnumNestedDiscriminator.getWrongDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.getWrongDiscriminatorWithResponse":"TspTest.EnumNestedDiscriminator.getWrongDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putModel":"TspTest.EnumNestedDiscriminator.putModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putModelWithResponse":"TspTest.EnumNestedDiscriminator.putModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putRecursiveModel":"TspTest.EnumNestedDiscriminator.putRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorAsyncClient.putRecursiveModelWithResponse":"TspTest.EnumNestedDiscriminator.putRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient":"TspTest.EnumNestedDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getMissingDiscriminator":"TspTest.EnumNestedDiscriminator.getMissingDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getMissingDiscriminatorWithResponse":"TspTest.EnumNestedDiscriminator.getMissingDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getModel":"TspTest.EnumNestedDiscriminator.getModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getModelWithResponse":"TspTest.EnumNestedDiscriminator.getModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getRecursiveModel":"TspTest.EnumNestedDiscriminator.getRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getRecursiveModelWithResponse":"TspTest.EnumNestedDiscriminator.getRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getWrongDiscriminator":"TspTest.EnumNestedDiscriminator.getWrongDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.getWrongDiscriminatorWithResponse":"TspTest.EnumNestedDiscriminator.getWrongDiscriminator","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putModel":"TspTest.EnumNestedDiscriminator.putModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putModelWithResponse":"TspTest.EnumNestedDiscriminator.putModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putRecursiveModel":"TspTest.EnumNestedDiscriminator.putRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient.putRecursiveModelWithResponse":"TspTest.EnumNestedDiscriminator.putRecursiveModel","tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClientBuilder":"TspTest.EnumNestedDiscriminator","tsptest.enumnesteddiscriminator.models.Fish":"TspTest.EnumNestedDiscriminator.Fish","tsptest.enumnesteddiscriminator.models.FishKind":"TspTest.EnumNestedDiscriminator.FishKind","tsptest.enumnesteddiscriminator.models.GoblinShark":"TspTest.EnumNestedDiscriminator.GoblinShark","tsptest.enumnesteddiscriminator.models.Salmon":"TspTest.EnumNestedDiscriminator.Salmon","tsptest.enumnesteddiscriminator.models.SawShark":"TspTest.EnumNestedDiscriminator.SawShark","tsptest.enumnesteddiscriminator.models.Shark":"TspTest.EnumNestedDiscriminator.Shark","tsptest.enumnesteddiscriminator.models.SharkKind":"TspTest.EnumNestedDiscriminator.SharkKind"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorAsyncClient.java","src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClient.java","src/main/java/tsptest/enumnesteddiscriminator/EnumNestedDiscriminatorClientBuilder.java","src/main/java/tsptest/enumnesteddiscriminator/implementation/EnumNestedDiscriminatorClientImpl.java","src/main/java/tsptest/enumnesteddiscriminator/implementation/package-info.java","src/main/java/tsptest/enumnesteddiscriminator/models/Fish.java","src/main/java/tsptest/enumnesteddiscriminator/models/FishKind.java","src/main/java/tsptest/enumnesteddiscriminator/models/GoblinShark.java","src/main/java/tsptest/enumnesteddiscriminator/models/Salmon.java","src/main/java/tsptest/enumnesteddiscriminator/models/SawShark.java","src/main/java/tsptest/enumnesteddiscriminator/models/Shark.java","src/main/java/tsptest/enumnesteddiscriminator/models/SharkKind.java","src/main/java/tsptest/enumnesteddiscriminator/models/package-info.java","src/main/java/tsptest/enumnesteddiscriminator/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_apiview_properties.json new file mode 100644 index 00000000000..b6e62977f28 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_apiview_properties.json @@ -0,0 +1,77 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.enumservice.EnumServiceAsyncClient": "TspTest.EnumService.EnumOp", + "tsptest.enumservice.EnumServiceAsyncClient.getColor": "TspTest.EnumService.EnumOp.getColor", + "tsptest.enumservice.EnumServiceAsyncClient.getColorModel": "TspTest.EnumService.EnumOp.getColorModel", + "tsptest.enumservice.EnumServiceAsyncClient.getColorModelWithResponse": "TspTest.EnumService.EnumOp.getColorModel", + "tsptest.enumservice.EnumServiceAsyncClient.getColorWithResponse": "TspTest.EnumService.EnumOp.getColor", + "tsptest.enumservice.EnumServiceAsyncClient.getOperation": "TspTest.EnumService.EnumOp.getOperation", + "tsptest.enumservice.EnumServiceAsyncClient.getOperationWithResponse": "TspTest.EnumService.EnumOp.getOperation", + "tsptest.enumservice.EnumServiceAsyncClient.getRunningOperation": "TspTest.EnumService.EnumOp.getRunningOperation", + "tsptest.enumservice.EnumServiceAsyncClient.getRunningOperationWithResponse": "TspTest.EnumService.EnumOp.getRunningOperation", + "tsptest.enumservice.EnumServiceAsyncClient.setColorModel": "TspTest.EnumService.EnumOp.setColorModel", + "tsptest.enumservice.EnumServiceAsyncClient.setColorModelWithResponse": "TspTest.EnumService.EnumOp.setColorModel", + "tsptest.enumservice.EnumServiceAsyncClient.setIntArray": "TspTest.EnumService.EnumOp.setIntArray", + "tsptest.enumservice.EnumServiceAsyncClient.setIntArrayWithResponse": "TspTest.EnumService.EnumOp.setIntArray", + "tsptest.enumservice.EnumServiceAsyncClient.setIntEnumArray": "TspTest.EnumService.EnumOp.setIntEnumArray", + "tsptest.enumservice.EnumServiceAsyncClient.setIntEnumArrayWithResponse": "TspTest.EnumService.EnumOp.setIntEnumArray", + "tsptest.enumservice.EnumServiceAsyncClient.setIntEnumMulti": "TspTest.EnumService.EnumOp.setIntEnumMulti", + "tsptest.enumservice.EnumServiceAsyncClient.setIntEnumMultiWithResponse": "TspTest.EnumService.EnumOp.setIntEnumMulti", + "tsptest.enumservice.EnumServiceAsyncClient.setIntMulti": "TspTest.EnumService.EnumOp.setIntMulti", + "tsptest.enumservice.EnumServiceAsyncClient.setIntMultiWithResponse": "TspTest.EnumService.EnumOp.setIntMulti", + "tsptest.enumservice.EnumServiceAsyncClient.setPriority": "TspTest.EnumService.EnumOp.setPriority", + "tsptest.enumservice.EnumServiceAsyncClient.setPriorityWithResponse": "TspTest.EnumService.EnumOp.setPriority", + "tsptest.enumservice.EnumServiceAsyncClient.setStringArray": "TspTest.EnumService.EnumOp.setStringArray", + "tsptest.enumservice.EnumServiceAsyncClient.setStringArrayWithResponse": "TspTest.EnumService.EnumOp.setStringArray", + "tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArray": "TspTest.EnumService.EnumOp.setStringEnumArray", + "tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArrayHeader": "TspTest.EnumService.EnumOp.setStringEnumArrayHeader", + "tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArrayHeaderWithResponse": "TspTest.EnumService.EnumOp.setStringEnumArrayHeader", + "tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArrayWithResponse": "TspTest.EnumService.EnumOp.setStringEnumArray", + "tsptest.enumservice.EnumServiceAsyncClient.setStringEnumMulti": "TspTest.EnumService.EnumOp.setStringEnumMulti", + "tsptest.enumservice.EnumServiceAsyncClient.setStringEnumMultiWithResponse": "TspTest.EnumService.EnumOp.setStringEnumMulti", + "tsptest.enumservice.EnumServiceAsyncClient.setStringMulti": "TspTest.EnumService.EnumOp.setStringMulti", + "tsptest.enumservice.EnumServiceAsyncClient.setStringMultiWithResponse": "TspTest.EnumService.EnumOp.setStringMulti", + "tsptest.enumservice.EnumServiceClient": "TspTest.EnumService.EnumOp", + "tsptest.enumservice.EnumServiceClient.getColor": "TspTest.EnumService.EnumOp.getColor", + "tsptest.enumservice.EnumServiceClient.getColorModel": "TspTest.EnumService.EnumOp.getColorModel", + "tsptest.enumservice.EnumServiceClient.getColorModelWithResponse": "TspTest.EnumService.EnumOp.getColorModel", + "tsptest.enumservice.EnumServiceClient.getColorWithResponse": "TspTest.EnumService.EnumOp.getColor", + "tsptest.enumservice.EnumServiceClient.getOperation": "TspTest.EnumService.EnumOp.getOperation", + "tsptest.enumservice.EnumServiceClient.getOperationWithResponse": "TspTest.EnumService.EnumOp.getOperation", + "tsptest.enumservice.EnumServiceClient.getRunningOperation": "TspTest.EnumService.EnumOp.getRunningOperation", + "tsptest.enumservice.EnumServiceClient.getRunningOperationWithResponse": "TspTest.EnumService.EnumOp.getRunningOperation", + "tsptest.enumservice.EnumServiceClient.setColorModel": "TspTest.EnumService.EnumOp.setColorModel", + "tsptest.enumservice.EnumServiceClient.setColorModelWithResponse": "TspTest.EnumService.EnumOp.setColorModel", + "tsptest.enumservice.EnumServiceClient.setIntArray": "TspTest.EnumService.EnumOp.setIntArray", + "tsptest.enumservice.EnumServiceClient.setIntArrayWithResponse": "TspTest.EnumService.EnumOp.setIntArray", + "tsptest.enumservice.EnumServiceClient.setIntEnumArray": "TspTest.EnumService.EnumOp.setIntEnumArray", + "tsptest.enumservice.EnumServiceClient.setIntEnumArrayWithResponse": "TspTest.EnumService.EnumOp.setIntEnumArray", + "tsptest.enumservice.EnumServiceClient.setIntEnumMulti": "TspTest.EnumService.EnumOp.setIntEnumMulti", + "tsptest.enumservice.EnumServiceClient.setIntEnumMultiWithResponse": "TspTest.EnumService.EnumOp.setIntEnumMulti", + "tsptest.enumservice.EnumServiceClient.setIntMulti": "TspTest.EnumService.EnumOp.setIntMulti", + "tsptest.enumservice.EnumServiceClient.setIntMultiWithResponse": "TspTest.EnumService.EnumOp.setIntMulti", + "tsptest.enumservice.EnumServiceClient.setPriority": "TspTest.EnumService.EnumOp.setPriority", + "tsptest.enumservice.EnumServiceClient.setPriorityWithResponse": "TspTest.EnumService.EnumOp.setPriority", + "tsptest.enumservice.EnumServiceClient.setStringArray": "TspTest.EnumService.EnumOp.setStringArray", + "tsptest.enumservice.EnumServiceClient.setStringArrayWithResponse": "TspTest.EnumService.EnumOp.setStringArray", + "tsptest.enumservice.EnumServiceClient.setStringEnumArray": "TspTest.EnumService.EnumOp.setStringEnumArray", + "tsptest.enumservice.EnumServiceClient.setStringEnumArrayHeader": "TspTest.EnumService.EnumOp.setStringEnumArrayHeader", + "tsptest.enumservice.EnumServiceClient.setStringEnumArrayHeaderWithResponse": "TspTest.EnumService.EnumOp.setStringEnumArrayHeader", + "tsptest.enumservice.EnumServiceClient.setStringEnumArrayWithResponse": "TspTest.EnumService.EnumOp.setStringEnumArray", + "tsptest.enumservice.EnumServiceClient.setStringEnumMulti": "TspTest.EnumService.EnumOp.setStringEnumMulti", + "tsptest.enumservice.EnumServiceClient.setStringEnumMultiWithResponse": "TspTest.EnumService.EnumOp.setStringEnumMulti", + "tsptest.enumservice.EnumServiceClient.setStringMulti": "TspTest.EnumService.EnumOp.setStringMulti", + "tsptest.enumservice.EnumServiceClient.setStringMultiWithResponse": "TspTest.EnumService.EnumOp.setStringMulti", + "tsptest.enumservice.EnumServiceClientBuilder": "TspTest.EnumService.EnumOp", + "tsptest.enumservice.models.Color": "TspTest.EnumService.Color", + "tsptest.enumservice.models.ColorModel": "TspTest.EnumService.ColorModel", + "tsptest.enumservice.models.OlympicRecordModel": "TspTest.EnumService.OlympicRecordModel", + "tsptest.enumservice.models.Operation": "TspTest.EnumService.Operation", + "tsptest.enumservice.models.OperationName": "TspTest.EnumService.Operation.name.anonymous", + "tsptest.enumservice.models.OperationStateValues": "TspTest.EnumService.OperationStateValues", + "tsptest.enumservice.models.Priority": "TspTest.EnumService.Priority", + "tsptest.enumservice.models.PriorityModel": "TspTest.EnumService.PriorityModel", + "tsptest.enumservice.models.Unit": "TspTest.EnumService.Unit" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_metadata.json new file mode 100644 index 00000000000..169c50ba56d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-enumservice_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.enumservice.EnumServiceAsyncClient":"TspTest.EnumService.EnumOp","tsptest.enumservice.EnumServiceAsyncClient.getColor":"TspTest.EnumService.EnumOp.getColor","tsptest.enumservice.EnumServiceAsyncClient.getColorModel":"TspTest.EnumService.EnumOp.getColorModel","tsptest.enumservice.EnumServiceAsyncClient.getColorModelWithResponse":"TspTest.EnumService.EnumOp.getColorModel","tsptest.enumservice.EnumServiceAsyncClient.getColorWithResponse":"TspTest.EnumService.EnumOp.getColor","tsptest.enumservice.EnumServiceAsyncClient.getOperation":"TspTest.EnumService.EnumOp.getOperation","tsptest.enumservice.EnumServiceAsyncClient.getOperationWithResponse":"TspTest.EnumService.EnumOp.getOperation","tsptest.enumservice.EnumServiceAsyncClient.getRunningOperation":"TspTest.EnumService.EnumOp.getRunningOperation","tsptest.enumservice.EnumServiceAsyncClient.getRunningOperationWithResponse":"TspTest.EnumService.EnumOp.getRunningOperation","tsptest.enumservice.EnumServiceAsyncClient.setColorModel":"TspTest.EnumService.EnumOp.setColorModel","tsptest.enumservice.EnumServiceAsyncClient.setColorModelWithResponse":"TspTest.EnumService.EnumOp.setColorModel","tsptest.enumservice.EnumServiceAsyncClient.setIntArray":"TspTest.EnumService.EnumOp.setIntArray","tsptest.enumservice.EnumServiceAsyncClient.setIntArrayWithResponse":"TspTest.EnumService.EnumOp.setIntArray","tsptest.enumservice.EnumServiceAsyncClient.setIntEnumArray":"TspTest.EnumService.EnumOp.setIntEnumArray","tsptest.enumservice.EnumServiceAsyncClient.setIntEnumArrayWithResponse":"TspTest.EnumService.EnumOp.setIntEnumArray","tsptest.enumservice.EnumServiceAsyncClient.setIntEnumMulti":"TspTest.EnumService.EnumOp.setIntEnumMulti","tsptest.enumservice.EnumServiceAsyncClient.setIntEnumMultiWithResponse":"TspTest.EnumService.EnumOp.setIntEnumMulti","tsptest.enumservice.EnumServiceAsyncClient.setIntMulti":"TspTest.EnumService.EnumOp.setIntMulti","tsptest.enumservice.EnumServiceAsyncClient.setIntMultiWithResponse":"TspTest.EnumService.EnumOp.setIntMulti","tsptest.enumservice.EnumServiceAsyncClient.setPriority":"TspTest.EnumService.EnumOp.setPriority","tsptest.enumservice.EnumServiceAsyncClient.setPriorityWithResponse":"TspTest.EnumService.EnumOp.setPriority","tsptest.enumservice.EnumServiceAsyncClient.setStringArray":"TspTest.EnumService.EnumOp.setStringArray","tsptest.enumservice.EnumServiceAsyncClient.setStringArrayWithResponse":"TspTest.EnumService.EnumOp.setStringArray","tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArray":"TspTest.EnumService.EnumOp.setStringEnumArray","tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArrayHeader":"TspTest.EnumService.EnumOp.setStringEnumArrayHeader","tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArrayHeaderWithResponse":"TspTest.EnumService.EnumOp.setStringEnumArrayHeader","tsptest.enumservice.EnumServiceAsyncClient.setStringEnumArrayWithResponse":"TspTest.EnumService.EnumOp.setStringEnumArray","tsptest.enumservice.EnumServiceAsyncClient.setStringEnumMulti":"TspTest.EnumService.EnumOp.setStringEnumMulti","tsptest.enumservice.EnumServiceAsyncClient.setStringEnumMultiWithResponse":"TspTest.EnumService.EnumOp.setStringEnumMulti","tsptest.enumservice.EnumServiceAsyncClient.setStringMulti":"TspTest.EnumService.EnumOp.setStringMulti","tsptest.enumservice.EnumServiceAsyncClient.setStringMultiWithResponse":"TspTest.EnumService.EnumOp.setStringMulti","tsptest.enumservice.EnumServiceClient":"TspTest.EnumService.EnumOp","tsptest.enumservice.EnumServiceClient.getColor":"TspTest.EnumService.EnumOp.getColor","tsptest.enumservice.EnumServiceClient.getColorModel":"TspTest.EnumService.EnumOp.getColorModel","tsptest.enumservice.EnumServiceClient.getColorModelWithResponse":"TspTest.EnumService.EnumOp.getColorModel","tsptest.enumservice.EnumServiceClient.getColorWithResponse":"TspTest.EnumService.EnumOp.getColor","tsptest.enumservice.EnumServiceClient.getOperation":"TspTest.EnumService.EnumOp.getOperation","tsptest.enumservice.EnumServiceClient.getOperationWithResponse":"TspTest.EnumService.EnumOp.getOperation","tsptest.enumservice.EnumServiceClient.getRunningOperation":"TspTest.EnumService.EnumOp.getRunningOperation","tsptest.enumservice.EnumServiceClient.getRunningOperationWithResponse":"TspTest.EnumService.EnumOp.getRunningOperation","tsptest.enumservice.EnumServiceClient.setColorModel":"TspTest.EnumService.EnumOp.setColorModel","tsptest.enumservice.EnumServiceClient.setColorModelWithResponse":"TspTest.EnumService.EnumOp.setColorModel","tsptest.enumservice.EnumServiceClient.setIntArray":"TspTest.EnumService.EnumOp.setIntArray","tsptest.enumservice.EnumServiceClient.setIntArrayWithResponse":"TspTest.EnumService.EnumOp.setIntArray","tsptest.enumservice.EnumServiceClient.setIntEnumArray":"TspTest.EnumService.EnumOp.setIntEnumArray","tsptest.enumservice.EnumServiceClient.setIntEnumArrayWithResponse":"TspTest.EnumService.EnumOp.setIntEnumArray","tsptest.enumservice.EnumServiceClient.setIntEnumMulti":"TspTest.EnumService.EnumOp.setIntEnumMulti","tsptest.enumservice.EnumServiceClient.setIntEnumMultiWithResponse":"TspTest.EnumService.EnumOp.setIntEnumMulti","tsptest.enumservice.EnumServiceClient.setIntMulti":"TspTest.EnumService.EnumOp.setIntMulti","tsptest.enumservice.EnumServiceClient.setIntMultiWithResponse":"TspTest.EnumService.EnumOp.setIntMulti","tsptest.enumservice.EnumServiceClient.setPriority":"TspTest.EnumService.EnumOp.setPriority","tsptest.enumservice.EnumServiceClient.setPriorityWithResponse":"TspTest.EnumService.EnumOp.setPriority","tsptest.enumservice.EnumServiceClient.setStringArray":"TspTest.EnumService.EnumOp.setStringArray","tsptest.enumservice.EnumServiceClient.setStringArrayWithResponse":"TspTest.EnumService.EnumOp.setStringArray","tsptest.enumservice.EnumServiceClient.setStringEnumArray":"TspTest.EnumService.EnumOp.setStringEnumArray","tsptest.enumservice.EnumServiceClient.setStringEnumArrayHeader":"TspTest.EnumService.EnumOp.setStringEnumArrayHeader","tsptest.enumservice.EnumServiceClient.setStringEnumArrayHeaderWithResponse":"TspTest.EnumService.EnumOp.setStringEnumArrayHeader","tsptest.enumservice.EnumServiceClient.setStringEnumArrayWithResponse":"TspTest.EnumService.EnumOp.setStringEnumArray","tsptest.enumservice.EnumServiceClient.setStringEnumMulti":"TspTest.EnumService.EnumOp.setStringEnumMulti","tsptest.enumservice.EnumServiceClient.setStringEnumMultiWithResponse":"TspTest.EnumService.EnumOp.setStringEnumMulti","tsptest.enumservice.EnumServiceClient.setStringMulti":"TspTest.EnumService.EnumOp.setStringMulti","tsptest.enumservice.EnumServiceClient.setStringMultiWithResponse":"TspTest.EnumService.EnumOp.setStringMulti","tsptest.enumservice.EnumServiceClientBuilder":"TspTest.EnumService.EnumOp","tsptest.enumservice.models.Color":"TspTest.EnumService.Color","tsptest.enumservice.models.ColorModel":"TspTest.EnumService.ColorModel","tsptest.enumservice.models.OlympicRecordModel":"TspTest.EnumService.OlympicRecordModel","tsptest.enumservice.models.Operation":"TspTest.EnumService.Operation","tsptest.enumservice.models.OperationName":"TspTest.EnumService.Operation.name.anonymous","tsptest.enumservice.models.OperationStateValues":"TspTest.EnumService.OperationStateValues","tsptest.enumservice.models.Priority":"TspTest.EnumService.Priority","tsptest.enumservice.models.PriorityModel":"TspTest.EnumService.PriorityModel","tsptest.enumservice.models.Unit":"TspTest.EnumService.Unit"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/enumservice/EnumServiceAsyncClient.java","src/main/java/tsptest/enumservice/EnumServiceClient.java","src/main/java/tsptest/enumservice/EnumServiceClientBuilder.java","src/main/java/tsptest/enumservice/implementation/EnumServiceClientImpl.java","src/main/java/tsptest/enumservice/implementation/package-info.java","src/main/java/tsptest/enumservice/models/Color.java","src/main/java/tsptest/enumservice/models/ColorModel.java","src/main/java/tsptest/enumservice/models/OlympicRecordModel.java","src/main/java/tsptest/enumservice/models/Operation.java","src/main/java/tsptest/enumservice/models/OperationName.java","src/main/java/tsptest/enumservice/models/OperationStateValues.java","src/main/java/tsptest/enumservice/models/Priority.java","src/main/java/tsptest/enumservice/models/PriorityModel.java","src/main/java/tsptest/enumservice/models/Unit.java","src/main/java/tsptest/enumservice/models/package-info.java","src/main/java/tsptest/enumservice/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_apiview_properties.json new file mode 100644 index 00000000000..5b466208aee --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_apiview_properties.json @@ -0,0 +1,19 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.errormodel.ErrorModelAsyncClient": "TspTest.ErrorModel.ErrorOp", + "tsptest.errormodel.ErrorModelAsyncClient.read": "TspTest.ErrorModel.ErrorOp.read", + "tsptest.errormodel.ErrorModelAsyncClient.readWithResponse": "TspTest.ErrorModel.ErrorOp.read", + "tsptest.errormodel.ErrorModelClient": "TspTest.ErrorModel.ErrorOp", + "tsptest.errormodel.ErrorModelClient.read": "TspTest.ErrorModel.ErrorOp.read", + "tsptest.errormodel.ErrorModelClient.readWithResponse": "TspTest.ErrorModel.ErrorOp.read", + "tsptest.errormodel.ErrorModelClientBuilder": "TspTest.ErrorModel", + "tsptest.errormodel.models.BadResponseError": "TspTest.ErrorModel.BadResponseError", + "tsptest.errormodel.models.BatchError": "TspTest.ErrorModel.BatchError", + "tsptest.errormodel.models.BatchErrorMessage": "TspTest.ErrorModel.BatchErrorMessage", + "tsptest.errormodel.models.Details": "TspTest.ErrorModel.Details", + "tsptest.errormodel.models.Diagnostic": "TspTest.ErrorModel.Diagnostic", + "tsptest.errormodel.models.InnerError": "Azure.Core.Foundations.InnerError", + "tsptest.errormodel.models.SubError": "TspTest.ErrorModel.SubError" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_metadata.json new file mode 100644 index 00000000000..ec105b0f181 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-errormodel_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.errormodel.ErrorModelAsyncClient":"TspTest.ErrorModel.ErrorOp","tsptest.errormodel.ErrorModelAsyncClient.read":"TspTest.ErrorModel.ErrorOp.read","tsptest.errormodel.ErrorModelAsyncClient.readWithResponse":"TspTest.ErrorModel.ErrorOp.read","tsptest.errormodel.ErrorModelClient":"TspTest.ErrorModel.ErrorOp","tsptest.errormodel.ErrorModelClient.read":"TspTest.ErrorModel.ErrorOp.read","tsptest.errormodel.ErrorModelClient.readWithResponse":"TspTest.ErrorModel.ErrorOp.read","tsptest.errormodel.ErrorModelClientBuilder":"TspTest.ErrorModel","tsptest.errormodel.models.BadResponseError":"TspTest.ErrorModel.BadResponseError","tsptest.errormodel.models.BatchError":"TspTest.ErrorModel.BatchError","tsptest.errormodel.models.BatchErrorMessage":"TspTest.ErrorModel.BatchErrorMessage","tsptest.errormodel.models.Details":"TspTest.ErrorModel.Details","tsptest.errormodel.models.Diagnostic":"TspTest.ErrorModel.Diagnostic","tsptest.errormodel.models.InnerError":"Azure.Core.Foundations.InnerError","tsptest.errormodel.models.SubError":"TspTest.ErrorModel.SubError"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/errormodel/ErrorModelAsyncClient.java","src/main/java/tsptest/errormodel/ErrorModelClient.java","src/main/java/tsptest/errormodel/ErrorModelClientBuilder.java","src/main/java/tsptest/errormodel/implementation/ErrorModelClientImpl.java","src/main/java/tsptest/errormodel/implementation/ErrorOpsImpl.java","src/main/java/tsptest/errormodel/implementation/package-info.java","src/main/java/tsptest/errormodel/models/BadResponseError.java","src/main/java/tsptest/errormodel/models/BadResponseErrorException.java","src/main/java/tsptest/errormodel/models/BatchError.java","src/main/java/tsptest/errormodel/models/BatchErrorException.java","src/main/java/tsptest/errormodel/models/BatchErrorMessage.java","src/main/java/tsptest/errormodel/models/Details.java","src/main/java/tsptest/errormodel/models/Diagnostic.java","src/main/java/tsptest/errormodel/models/InnerError.java","src/main/java/tsptest/errormodel/models/SubError.java","src/main/java/tsptest/errormodel/models/package-info.java","src/main/java/tsptest/errormodel/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_apiview_properties.json new file mode 100644 index 00000000000..27ab30ca8e6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_apiview_properties.json @@ -0,0 +1,39 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.flatten.FlattenAsyncClient": "TspTest.Flatten.FlattenOp", + "tsptest.flatten.FlattenAsyncClient.send": "TspTest.Flatten.FlattenOp.send", + "tsptest.flatten.FlattenAsyncClient.sendLong": "TspTest.Flatten.FlattenOp.sendLong", + "tsptest.flatten.FlattenAsyncClient.sendLongWithResponse": "TspTest.Flatten.FlattenOp.sendLong", + "tsptest.flatten.FlattenAsyncClient.sendOptionalBody": "TspTest.Flatten.FlattenOp.sendOptionalBody", + "tsptest.flatten.FlattenAsyncClient.sendOptionalBodyWithResponse": "TspTest.Flatten.FlattenOp.sendOptionalBody", + "tsptest.flatten.FlattenAsyncClient.sendProjectedName": "TspTest.Flatten.FlattenOp.sendProjectedName", + "tsptest.flatten.FlattenAsyncClient.sendProjectedNameWithResponse": "TspTest.Flatten.FlattenOp.sendProjectedName", + "tsptest.flatten.FlattenAsyncClient.sendWithResponse": "TspTest.Flatten.FlattenOp.send", + "tsptest.flatten.FlattenAsyncClient.update": "TspTest.Flatten.FlattenOp.update", + "tsptest.flatten.FlattenAsyncClient.updateWithResponse": "TspTest.Flatten.FlattenOp.update", + "tsptest.flatten.FlattenClient": "TspTest.Flatten.FlattenOp", + "tsptest.flatten.FlattenClient.send": "TspTest.Flatten.FlattenOp.send", + "tsptest.flatten.FlattenClient.sendLong": "TspTest.Flatten.FlattenOp.sendLong", + "tsptest.flatten.FlattenClient.sendLongWithResponse": "TspTest.Flatten.FlattenOp.sendLong", + "tsptest.flatten.FlattenClient.sendOptionalBody": "TspTest.Flatten.FlattenOp.sendOptionalBody", + "tsptest.flatten.FlattenClient.sendOptionalBodyWithResponse": "TspTest.Flatten.FlattenOp.sendOptionalBody", + "tsptest.flatten.FlattenClient.sendProjectedName": "TspTest.Flatten.FlattenOp.sendProjectedName", + "tsptest.flatten.FlattenClient.sendProjectedNameWithResponse": "TspTest.Flatten.FlattenOp.sendProjectedName", + "tsptest.flatten.FlattenClient.sendWithResponse": "TspTest.Flatten.FlattenOp.send", + "tsptest.flatten.FlattenClient.update": "TspTest.Flatten.FlattenOp.update", + "tsptest.flatten.FlattenClient.updateWithResponse": "TspTest.Flatten.FlattenOp.update", + "tsptest.flatten.FlattenClientBuilder": "TspTest.Flatten.FlattenOp", + "tsptest.flatten.implementation.models.SendLongRequest": "TspTest.Flatten.sendLong.Request.anonymous", + "tsptest.flatten.implementation.models.SendOptionalBodyRequest": "TspTest.Flatten.sendOptionalBody.Request.anonymous", + "tsptest.flatten.implementation.models.SendProjectedNameRequest": "TspTest.Flatten.sendProjectedName.Request.anonymous", + "tsptest.flatten.implementation.models.SendRequest": "TspTest.Flatten.send.Request.anonymous", + "tsptest.flatten.models.SendLongOptions": null, + "tsptest.flatten.models.SendLongRequestStatus": "TspTest.Flatten.sendLong.Request.status.anonymous", + "tsptest.flatten.models.TodoItem": "TspTest.Flatten.TodoItem", + "tsptest.flatten.models.TodoItemPatch": "TspTest.Flatten.TodoItemPatch", + "tsptest.flatten.models.TodoItemPatchStatus": "TspTest.Flatten.TodoItemPatch.status.anonymous", + "tsptest.flatten.models.UpdatePatchRequest": "TspTest.Flatten.update.Request.anonymous", + "tsptest.flatten.models.User": "TspTest.Flatten.User" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_metadata.json new file mode 100644 index 00000000000..027b10c8709 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-flatten_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-06-01-preview","crossLanguageDefinitions":{"tsptest.flatten.FlattenAsyncClient":"TspTest.Flatten.FlattenOp","tsptest.flatten.FlattenAsyncClient.send":"TspTest.Flatten.FlattenOp.send","tsptest.flatten.FlattenAsyncClient.sendLong":"TspTest.Flatten.FlattenOp.sendLong","tsptest.flatten.FlattenAsyncClient.sendLongWithResponse":"TspTest.Flatten.FlattenOp.sendLong","tsptest.flatten.FlattenAsyncClient.sendOptionalBody":"TspTest.Flatten.FlattenOp.sendOptionalBody","tsptest.flatten.FlattenAsyncClient.sendOptionalBodyWithResponse":"TspTest.Flatten.FlattenOp.sendOptionalBody","tsptest.flatten.FlattenAsyncClient.sendProjectedName":"TspTest.Flatten.FlattenOp.sendProjectedName","tsptest.flatten.FlattenAsyncClient.sendProjectedNameWithResponse":"TspTest.Flatten.FlattenOp.sendProjectedName","tsptest.flatten.FlattenAsyncClient.sendWithResponse":"TspTest.Flatten.FlattenOp.send","tsptest.flatten.FlattenAsyncClient.update":"TspTest.Flatten.FlattenOp.update","tsptest.flatten.FlattenAsyncClient.updateWithResponse":"TspTest.Flatten.FlattenOp.update","tsptest.flatten.FlattenClient":"TspTest.Flatten.FlattenOp","tsptest.flatten.FlattenClient.send":"TspTest.Flatten.FlattenOp.send","tsptest.flatten.FlattenClient.sendLong":"TspTest.Flatten.FlattenOp.sendLong","tsptest.flatten.FlattenClient.sendLongWithResponse":"TspTest.Flatten.FlattenOp.sendLong","tsptest.flatten.FlattenClient.sendOptionalBody":"TspTest.Flatten.FlattenOp.sendOptionalBody","tsptest.flatten.FlattenClient.sendOptionalBodyWithResponse":"TspTest.Flatten.FlattenOp.sendOptionalBody","tsptest.flatten.FlattenClient.sendProjectedName":"TspTest.Flatten.FlattenOp.sendProjectedName","tsptest.flatten.FlattenClient.sendProjectedNameWithResponse":"TspTest.Flatten.FlattenOp.sendProjectedName","tsptest.flatten.FlattenClient.sendWithResponse":"TspTest.Flatten.FlattenOp.send","tsptest.flatten.FlattenClient.update":"TspTest.Flatten.FlattenOp.update","tsptest.flatten.FlattenClient.updateWithResponse":"TspTest.Flatten.FlattenOp.update","tsptest.flatten.FlattenClientBuilder":"TspTest.Flatten.FlattenOp","tsptest.flatten.implementation.models.SendLongRequest":"TspTest.Flatten.sendLong.Request.anonymous","tsptest.flatten.implementation.models.SendOptionalBodyRequest":"TspTest.Flatten.sendOptionalBody.Request.anonymous","tsptest.flatten.implementation.models.SendProjectedNameRequest":"TspTest.Flatten.sendProjectedName.Request.anonymous","tsptest.flatten.implementation.models.SendRequest":"TspTest.Flatten.send.Request.anonymous","tsptest.flatten.models.SendLongOptions":null,"tsptest.flatten.models.SendLongRequestStatus":"TspTest.Flatten.sendLong.Request.status.anonymous","tsptest.flatten.models.TodoItem":"TspTest.Flatten.TodoItem","tsptest.flatten.models.TodoItemPatch":"TspTest.Flatten.TodoItemPatch","tsptest.flatten.models.TodoItemPatchStatus":"TspTest.Flatten.TodoItemPatch.status.anonymous","tsptest.flatten.models.UpdatePatchRequest":"TspTest.Flatten.update.Request.anonymous","tsptest.flatten.models.User":"TspTest.Flatten.User"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/flatten/FlattenAsyncClient.java","src/main/java/tsptest/flatten/FlattenClient.java","src/main/java/tsptest/flatten/FlattenClientBuilder.java","src/main/java/tsptest/flatten/FlattenServiceVersion.java","src/main/java/tsptest/flatten/implementation/FlattenClientImpl.java","src/main/java/tsptest/flatten/implementation/JsonMergePatchHelper.java","src/main/java/tsptest/flatten/implementation/models/SendLongRequest.java","src/main/java/tsptest/flatten/implementation/models/SendOptionalBodyRequest.java","src/main/java/tsptest/flatten/implementation/models/SendProjectedNameRequest.java","src/main/java/tsptest/flatten/implementation/models/SendRequest.java","src/main/java/tsptest/flatten/implementation/models/package-info.java","src/main/java/tsptest/flatten/implementation/package-info.java","src/main/java/tsptest/flatten/models/SendLongOptions.java","src/main/java/tsptest/flatten/models/SendLongRequestStatus.java","src/main/java/tsptest/flatten/models/TodoItem.java","src/main/java/tsptest/flatten/models/TodoItemPatch.java","src/main/java/tsptest/flatten/models/TodoItemPatchStatus.java","src/main/java/tsptest/flatten/models/UpdatePatchRequest.java","src/main/java/tsptest/flatten/models/User.java","src/main/java/tsptest/flatten/models/package-info.java","src/main/java/tsptest/flatten/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_apiview_properties.json new file mode 100644 index 00000000000..0f72102f872 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_apiview_properties.json @@ -0,0 +1,26 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.internal.InternalAsyncClient": "TspTest.Internal.InternalOp", + "tsptest.internal.InternalAsyncClient.getInternal": "TspTest.Internal.InternalOp.getInternal", + "tsptest.internal.InternalAsyncClient.getInternalWithResponse": "TspTest.Internal.InternalOp.getInternal", + "tsptest.internal.InternalAsyncClient.postInternal": "TspTest.Internal.InternalOp.postInternal", + "tsptest.internal.InternalAsyncClient.postInternalWithResponse": "TspTest.Internal.InternalOp.postInternal", + "tsptest.internal.InternalClient": "TspTest.Internal.InternalOp", + "tsptest.internal.InternalClient.getInternal": "TspTest.Internal.InternalOp.getInternal", + "tsptest.internal.InternalClient.getInternalWithResponse": "TspTest.Internal.InternalOp.getInternal", + "tsptest.internal.InternalClient.postInternal": "TspTest.Internal.InternalOp.postInternal", + "tsptest.internal.InternalClient.postInternalWithResponse": "TspTest.Internal.InternalOp.postInternal", + "tsptest.internal.InternalClientBuilder": "TspTest.Internal", + "tsptest.internal.implementation.models.Color": "TspTest.Internal.Color", + "tsptest.internal.implementation.models.ColorModel": "TspTest.Internal.ColorModel", + "tsptest.internal.models.ApiRequest": "TspTest.Internal.ApiRequest", + "tsptest.internal.models.ApiResponse": "TspTest.Internal.ApiResponse", + "tsptest.internal.models.RequestInner": "TspTest.Internal.RequestInner", + "tsptest.internal.models.ResponseInternal": "TspTest.Internal.ResponseInternal", + "tsptest.internal.models.ResponseInternalInner": "TspTest.Internal.ResponseInternalInner", + "tsptest.internal.models.StandAloneData": "TspTest.Internal.StandAloneData", + "tsptest.internal.models.StandAloneDataInner": "TspTest.Internal.StandAloneDataInner", + "tsptest.internal.models.UnusedEnum": "TspTest.Internal.UnusedEnum" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_metadata.json new file mode 100644 index 00000000000..0725b185a36 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-internal_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.internal.InternalAsyncClient":"TspTest.Internal.InternalOp","tsptest.internal.InternalAsyncClient.getInternal":"TspTest.Internal.InternalOp.getInternal","tsptest.internal.InternalAsyncClient.getInternalWithResponse":"TspTest.Internal.InternalOp.getInternal","tsptest.internal.InternalAsyncClient.postInternal":"TspTest.Internal.InternalOp.postInternal","tsptest.internal.InternalAsyncClient.postInternalWithResponse":"TspTest.Internal.InternalOp.postInternal","tsptest.internal.InternalClient":"TspTest.Internal.InternalOp","tsptest.internal.InternalClient.getInternal":"TspTest.Internal.InternalOp.getInternal","tsptest.internal.InternalClient.getInternalWithResponse":"TspTest.Internal.InternalOp.getInternal","tsptest.internal.InternalClient.postInternal":"TspTest.Internal.InternalOp.postInternal","tsptest.internal.InternalClient.postInternalWithResponse":"TspTest.Internal.InternalOp.postInternal","tsptest.internal.InternalClientBuilder":"TspTest.Internal","tsptest.internal.implementation.models.Color":"TspTest.Internal.Color","tsptest.internal.implementation.models.ColorModel":"TspTest.Internal.ColorModel","tsptest.internal.models.ApiRequest":"TspTest.Internal.ApiRequest","tsptest.internal.models.ApiResponse":"TspTest.Internal.ApiResponse","tsptest.internal.models.RequestInner":"TspTest.Internal.RequestInner","tsptest.internal.models.ResponseInternal":"TspTest.Internal.ResponseInternal","tsptest.internal.models.ResponseInternalInner":"TspTest.Internal.ResponseInternalInner","tsptest.internal.models.StandAloneData":"TspTest.Internal.StandAloneData","tsptest.internal.models.StandAloneDataInner":"TspTest.Internal.StandAloneDataInner","tsptest.internal.models.UnusedEnum":"TspTest.Internal.UnusedEnum"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/internal/InternalAsyncClient.java","src/main/java/tsptest/internal/InternalClient.java","src/main/java/tsptest/internal/InternalClientBuilder.java","src/main/java/tsptest/internal/implementation/InternalClientImpl.java","src/main/java/tsptest/internal/implementation/InternalOpsImpl.java","src/main/java/tsptest/internal/implementation/models/Color.java","src/main/java/tsptest/internal/implementation/models/ColorModel.java","src/main/java/tsptest/internal/implementation/models/package-info.java","src/main/java/tsptest/internal/implementation/package-info.java","src/main/java/tsptest/internal/models/ApiRequest.java","src/main/java/tsptest/internal/models/ApiResponse.java","src/main/java/tsptest/internal/models/RequestInner.java","src/main/java/tsptest/internal/models/ResponseInternal.java","src/main/java/tsptest/internal/models/ResponseInternalInner.java","src/main/java/tsptest/internal/models/StandAloneData.java","src/main/java/tsptest/internal/models/StandAloneDataInner.java","src/main/java/tsptest/internal/models/UnusedEnum.java","src/main/java/tsptest/internal/models/package-info.java","src/main/java/tsptest/internal/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_apiview_properties.json new file mode 100644 index 00000000000..70163b04f02 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_apiview_properties.json @@ -0,0 +1,15 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.literalservice.LiteralServiceAsyncClient": "TspTest.LiteralService.LiteralOp", + "tsptest.literalservice.LiteralServiceAsyncClient.put": "TspTest.LiteralService.LiteralOp.put", + "tsptest.literalservice.LiteralServiceAsyncClient.putWithResponse": "TspTest.LiteralService.LiteralOp.put", + "tsptest.literalservice.LiteralServiceClient": "TspTest.LiteralService.LiteralOp", + "tsptest.literalservice.LiteralServiceClient.put": "TspTest.LiteralService.LiteralOp.put", + "tsptest.literalservice.LiteralServiceClient.putWithResponse": "TspTest.LiteralService.LiteralOp.put", + "tsptest.literalservice.LiteralServiceClientBuilder": "TspTest.LiteralService", + "tsptest.literalservice.models.Model": "TspTest.LiteralService.Model", + "tsptest.literalservice.models.ModelOptionalLiteral": null, + "tsptest.literalservice.models.PutRequestOptionalLiteralParam": null + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_metadata.json new file mode 100644 index 00000000000..625e4dcfa65 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-literalservice_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.literalservice.LiteralServiceAsyncClient":"TspTest.LiteralService.LiteralOp","tsptest.literalservice.LiteralServiceAsyncClient.put":"TspTest.LiteralService.LiteralOp.put","tsptest.literalservice.LiteralServiceAsyncClient.putWithResponse":"TspTest.LiteralService.LiteralOp.put","tsptest.literalservice.LiteralServiceClient":"TspTest.LiteralService.LiteralOp","tsptest.literalservice.LiteralServiceClient.put":"TspTest.LiteralService.LiteralOp.put","tsptest.literalservice.LiteralServiceClient.putWithResponse":"TspTest.LiteralService.LiteralOp.put","tsptest.literalservice.LiteralServiceClientBuilder":"TspTest.LiteralService","tsptest.literalservice.models.Model":"TspTest.LiteralService.Model","tsptest.literalservice.models.ModelOptionalLiteral":null,"tsptest.literalservice.models.PutRequestOptionalLiteralParam":null},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/literalservice/LiteralServiceAsyncClient.java","src/main/java/tsptest/literalservice/LiteralServiceClient.java","src/main/java/tsptest/literalservice/LiteralServiceClientBuilder.java","src/main/java/tsptest/literalservice/implementation/LiteralOpsImpl.java","src/main/java/tsptest/literalservice/implementation/LiteralServiceClientImpl.java","src/main/java/tsptest/literalservice/implementation/package-info.java","src/main/java/tsptest/literalservice/models/Model.java","src/main/java/tsptest/literalservice/models/ModelOptionalLiteral.java","src/main/java/tsptest/literalservice/models/PutRequestOptionalLiteralParam.java","src/main/java/tsptest/literalservice/models/package-info.java","src/main/java/tsptest/literalservice/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_apiview_properties.json new file mode 100644 index 00000000000..df246d16cf3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_apiview_properties.json @@ -0,0 +1,26 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.longrunning.LongRunningAsyncClient": "TspTest.LongRunning", + "tsptest.longrunning.LongRunningAsyncClient.beginCreateJob": "TspTest.LongRunning.createJob", + "tsptest.longrunning.LongRunningAsyncClient.beginCreateJobWithModel": "TspTest.LongRunning.createJob", + "tsptest.longrunning.LongRunningAsyncClient.beginLongRunning": "TspTest.LongRunning.longRunning", + "tsptest.longrunning.LongRunningAsyncClient.beginLongRunningWithModel": "TspTest.LongRunning.longRunning", + "tsptest.longrunning.LongRunningAsyncClient.getJob": "TspTest.LongRunning.getJob", + "tsptest.longrunning.LongRunningAsyncClient.getJobWithResponse": "TspTest.LongRunning.getJob", + "tsptest.longrunning.LongRunningClient": "TspTest.LongRunning", + "tsptest.longrunning.LongRunningClient.beginCreateJob": "TspTest.LongRunning.createJob", + "tsptest.longrunning.LongRunningClient.beginCreateJobWithModel": "TspTest.LongRunning.createJob", + "tsptest.longrunning.LongRunningClient.beginLongRunning": "TspTest.LongRunning.longRunning", + "tsptest.longrunning.LongRunningClient.beginLongRunningWithModel": "TspTest.LongRunning.longRunning", + "tsptest.longrunning.LongRunningClient.getJob": "TspTest.LongRunning.getJob", + "tsptest.longrunning.LongRunningClient.getJobWithResponse": "TspTest.LongRunning.getJob", + "tsptest.longrunning.LongRunningClientBuilder": "TspTest.LongRunning", + "tsptest.longrunning.models.JobData": "TspTest.LongRunning.JobData", + "tsptest.longrunning.models.JobResult": "TspTest.LongRunning.JobResult", + "tsptest.longrunning.models.JobResultResult": "TspTest.LongRunning.JobResult.result.anonymous", + "tsptest.longrunning.models.JobStatus": "TspTest.LongRunning.JobStatus", + "tsptest.longrunning.models.OperationState": "Azure.Core.Foundations.OperationState", + "tsptest.longrunning.models.PollResponse": "TspTest.LongRunning.PollResponse" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_metadata.json new file mode 100644 index 00000000000..838cd158488 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-longrunning_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-06-01-preview","crossLanguageDefinitions":{"tsptest.longrunning.LongRunningAsyncClient":"TspTest.LongRunning","tsptest.longrunning.LongRunningAsyncClient.beginCreateJob":"TspTest.LongRunning.createJob","tsptest.longrunning.LongRunningAsyncClient.beginCreateJobWithModel":"TspTest.LongRunning.createJob","tsptest.longrunning.LongRunningAsyncClient.beginLongRunning":"TspTest.LongRunning.longRunning","tsptest.longrunning.LongRunningAsyncClient.beginLongRunningWithModel":"TspTest.LongRunning.longRunning","tsptest.longrunning.LongRunningAsyncClient.getJob":"TspTest.LongRunning.getJob","tsptest.longrunning.LongRunningAsyncClient.getJobWithResponse":"TspTest.LongRunning.getJob","tsptest.longrunning.LongRunningClient":"TspTest.LongRunning","tsptest.longrunning.LongRunningClient.beginCreateJob":"TspTest.LongRunning.createJob","tsptest.longrunning.LongRunningClient.beginCreateJobWithModel":"TspTest.LongRunning.createJob","tsptest.longrunning.LongRunningClient.beginLongRunning":"TspTest.LongRunning.longRunning","tsptest.longrunning.LongRunningClient.beginLongRunningWithModel":"TspTest.LongRunning.longRunning","tsptest.longrunning.LongRunningClient.getJob":"TspTest.LongRunning.getJob","tsptest.longrunning.LongRunningClient.getJobWithResponse":"TspTest.LongRunning.getJob","tsptest.longrunning.LongRunningClientBuilder":"TspTest.LongRunning","tsptest.longrunning.models.JobData":"TspTest.LongRunning.JobData","tsptest.longrunning.models.JobResult":"TspTest.LongRunning.JobResult","tsptest.longrunning.models.JobResultResult":"TspTest.LongRunning.JobResult.result.anonymous","tsptest.longrunning.models.JobStatus":"TspTest.LongRunning.JobStatus","tsptest.longrunning.models.OperationState":"Azure.Core.Foundations.OperationState","tsptest.longrunning.models.PollResponse":"TspTest.LongRunning.PollResponse"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/longrunning/LongRunningAsyncClient.java","src/main/java/tsptest/longrunning/LongRunningClient.java","src/main/java/tsptest/longrunning/LongRunningClientBuilder.java","src/main/java/tsptest/longrunning/LongRunningServiceVersion.java","src/main/java/tsptest/longrunning/implementation/LongRunningClientImpl.java","src/main/java/tsptest/longrunning/implementation/OperationLocationPollingStrategy.java","src/main/java/tsptest/longrunning/implementation/PollingUtils.java","src/main/java/tsptest/longrunning/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/tsptest/longrunning/implementation/package-info.java","src/main/java/tsptest/longrunning/models/JobData.java","src/main/java/tsptest/longrunning/models/JobResult.java","src/main/java/tsptest/longrunning/models/JobResultResult.java","src/main/java/tsptest/longrunning/models/JobStatus.java","src/main/java/tsptest/longrunning/models/OperationState.java","src/main/java/tsptest/longrunning/models/PollResponse.java","src/main/java/tsptest/longrunning/models/package-info.java","src/main/java/tsptest/longrunning/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_apiview_properties.json new file mode 100644 index 00000000000..10851663be0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_apiview_properties.json @@ -0,0 +1,41 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.methodoverride.MethodOverrideAsyncClient": "TspTest.MethodOverride", + "tsptest.methodoverride.MethodOverrideAsyncClient.groupAll": "TspTest.MethodOverride.groupAll", + "tsptest.methodoverride.MethodOverrideAsyncClient.groupAllWithResponse": "TspTest.MethodOverride.groupAll", + "tsptest.methodoverride.MethodOverrideAsyncClient.groupExcludeBody": "TspTest.MethodOverride.groupExcludeBody", + "tsptest.methodoverride.MethodOverrideAsyncClient.groupExcludeBodyWithResponse": "TspTest.MethodOverride.groupExcludeBody", + "tsptest.methodoverride.MethodOverrideAsyncClient.groupNone": "TspTest.MethodOverride.groupNone", + "tsptest.methodoverride.MethodOverrideAsyncClient.groupNoneWithResponse": "TspTest.MethodOverride.groupNone", + "tsptest.methodoverride.MethodOverrideAsyncClient.groupPart": "TspTest.MethodOverride.groupPart", + "tsptest.methodoverride.MethodOverrideAsyncClient.groupPartETag": "TspTest.MethodOverride.groupPartETag", + "tsptest.methodoverride.MethodOverrideAsyncClient.groupPartETagWithResponse": "TspTest.MethodOverride.groupPartETag", + "tsptest.methodoverride.MethodOverrideAsyncClient.groupPartWithResponse": "TspTest.MethodOverride.groupPart", + "tsptest.methodoverride.MethodOverrideAsyncClient.groupQuery": "TspTest.MethodOverride.groupQuery", + "tsptest.methodoverride.MethodOverrideAsyncClient.groupQueryWithResponse": "TspTest.MethodOverride.groupQuery", + "tsptest.methodoverride.MethodOverrideClient": "TspTest.MethodOverride", + "tsptest.methodoverride.MethodOverrideClient.groupAll": "TspTest.MethodOverride.groupAll", + "tsptest.methodoverride.MethodOverrideClient.groupAllWithResponse": "TspTest.MethodOverride.groupAll", + "tsptest.methodoverride.MethodOverrideClient.groupExcludeBody": "TspTest.MethodOverride.groupExcludeBody", + "tsptest.methodoverride.MethodOverrideClient.groupExcludeBodyWithResponse": "TspTest.MethodOverride.groupExcludeBody", + "tsptest.methodoverride.MethodOverrideClient.groupNone": "TspTest.MethodOverride.groupNone", + "tsptest.methodoverride.MethodOverrideClient.groupNoneWithResponse": "TspTest.MethodOverride.groupNone", + "tsptest.methodoverride.MethodOverrideClient.groupPart": "TspTest.MethodOverride.groupPart", + "tsptest.methodoverride.MethodOverrideClient.groupPartETag": "TspTest.MethodOverride.groupPartETag", + "tsptest.methodoverride.MethodOverrideClient.groupPartETagWithResponse": "TspTest.MethodOverride.groupPartETag", + "tsptest.methodoverride.MethodOverrideClient.groupPartWithResponse": "TspTest.MethodOverride.groupPart", + "tsptest.methodoverride.MethodOverrideClient.groupQuery": "TspTest.MethodOverride.groupQuery", + "tsptest.methodoverride.MethodOverrideClient.groupQueryWithResponse": "TspTest.MethodOverride.groupQuery", + "tsptest.methodoverride.MethodOverrideClientBuilder": "TspTest.MethodOverride", + "tsptest.methodoverride.implementation.models.GroupAllRequest": "TspTest.MethodOverride.groupAll.Request.anonymous", + "tsptest.methodoverride.implementation.models.GroupNoneRequest": "TspTest.MethodOverride.groupNone.Request.anonymous", + "tsptest.methodoverride.implementation.models.GroupPartETagRequest": "TspTest.MethodOverride.groupPartETag.Request.anonymous", + "tsptest.methodoverride.implementation.models.GroupPartRequest": "TspTest.MethodOverride.groupPart.Request.anonymous", + "tsptest.methodoverride.models.GroupAllOptions": null, + "tsptest.methodoverride.models.GroupExcludeBodyModel": "TspTest.MethodOverride.GroupExcludeBodyModel", + "tsptest.methodoverride.models.GroupPartETagOptions": null, + "tsptest.methodoverride.models.GroupPartOptions": null, + "tsptest.methodoverride.models.GroupQueryOptions": null + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_metadata.json new file mode 100644 index 00000000000..d3b5b3eab8c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-methodoverride_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-12-01-preview","crossLanguageDefinitions":{"tsptest.methodoverride.MethodOverrideAsyncClient":"TspTest.MethodOverride","tsptest.methodoverride.MethodOverrideAsyncClient.groupAll":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideAsyncClient.groupAllWithResponse":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideAsyncClient.groupExcludeBody":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideAsyncClient.groupExcludeBodyWithResponse":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideAsyncClient.groupNone":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideAsyncClient.groupNoneWithResponse":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideAsyncClient.groupPart":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideAsyncClient.groupPartETag":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideAsyncClient.groupPartETagWithResponse":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideAsyncClient.groupPartWithResponse":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideAsyncClient.groupQuery":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideAsyncClient.groupQueryWithResponse":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideClient":"TspTest.MethodOverride","tsptest.methodoverride.MethodOverrideClient.groupAll":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideClient.groupAllWithResponse":"TspTest.MethodOverride.groupAll","tsptest.methodoverride.MethodOverrideClient.groupExcludeBody":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideClient.groupExcludeBodyWithResponse":"TspTest.MethodOverride.groupExcludeBody","tsptest.methodoverride.MethodOverrideClient.groupNone":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideClient.groupNoneWithResponse":"TspTest.MethodOverride.groupNone","tsptest.methodoverride.MethodOverrideClient.groupPart":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideClient.groupPartETag":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideClient.groupPartETagWithResponse":"TspTest.MethodOverride.groupPartETag","tsptest.methodoverride.MethodOverrideClient.groupPartWithResponse":"TspTest.MethodOverride.groupPart","tsptest.methodoverride.MethodOverrideClient.groupQuery":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideClient.groupQueryWithResponse":"TspTest.MethodOverride.groupQuery","tsptest.methodoverride.MethodOverrideClientBuilder":"TspTest.MethodOverride","tsptest.methodoverride.implementation.models.GroupAllRequest":"TspTest.MethodOverride.groupAll.Request.anonymous","tsptest.methodoverride.implementation.models.GroupNoneRequest":"TspTest.MethodOverride.groupNone.Request.anonymous","tsptest.methodoverride.implementation.models.GroupPartETagRequest":"TspTest.MethodOverride.groupPartETag.Request.anonymous","tsptest.methodoverride.implementation.models.GroupPartRequest":"TspTest.MethodOverride.groupPart.Request.anonymous","tsptest.methodoverride.models.GroupAllOptions":null,"tsptest.methodoverride.models.GroupExcludeBodyModel":"TspTest.MethodOverride.GroupExcludeBodyModel","tsptest.methodoverride.models.GroupPartETagOptions":null,"tsptest.methodoverride.models.GroupPartOptions":null,"tsptest.methodoverride.models.GroupQueryOptions":null},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/methodoverride/MethodOverrideAsyncClient.java","src/main/java/tsptest/methodoverride/MethodOverrideClient.java","src/main/java/tsptest/methodoverride/MethodOverrideClientBuilder.java","src/main/java/tsptest/methodoverride/MethodOverrideServiceVersion.java","src/main/java/tsptest/methodoverride/implementation/MethodOverrideClientImpl.java","src/main/java/tsptest/methodoverride/implementation/models/GroupAllRequest.java","src/main/java/tsptest/methodoverride/implementation/models/GroupNoneRequest.java","src/main/java/tsptest/methodoverride/implementation/models/GroupPartETagRequest.java","src/main/java/tsptest/methodoverride/implementation/models/GroupPartRequest.java","src/main/java/tsptest/methodoverride/implementation/models/package-info.java","src/main/java/tsptest/methodoverride/implementation/package-info.java","src/main/java/tsptest/methodoverride/models/GroupAllOptions.java","src/main/java/tsptest/methodoverride/models/GroupExcludeBodyModel.java","src/main/java/tsptest/methodoverride/models/GroupPartETagOptions.java","src/main/java/tsptest/methodoverride/models/GroupPartOptions.java","src/main/java/tsptest/methodoverride/models/GroupQueryOptions.java","src/main/java/tsptest/methodoverride/models/package-info.java","src/main/java/tsptest/methodoverride/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_apiview_properties.json new file mode 100644 index 00000000000..4e61494580d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_apiview_properties.json @@ -0,0 +1,33 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.model.ModelAsyncClient": "TspTest.Model.ModelOp", + "tsptest.model.ModelAsyncClient.get3": "TspTest.Model.ModelOp.get3", + "tsptest.model.ModelAsyncClient.get3WithResponse": "TspTest.Model.ModelOp.get3", + "tsptest.model.ModelAsyncClient.put1": "TspTest.Model.ModelOp.put1", + "tsptest.model.ModelAsyncClient.put1WithResponse": "TspTest.Model.ModelOp.put1", + "tsptest.model.ModelAsyncClient.put2": "TspTest.Model.ModelOp.put2", + "tsptest.model.ModelAsyncClient.put2WithResponse": "TspTest.Model.ModelOp.put2", + "tsptest.model.ModelAsyncClient.putNested": "TspTest.Model.ModelOp.putNested", + "tsptest.model.ModelAsyncClient.putNestedWithResponse": "TspTest.Model.ModelOp.putNested", + "tsptest.model.ModelClient": "TspTest.Model.ModelOp", + "tsptest.model.ModelClient.get3": "TspTest.Model.ModelOp.get3", + "tsptest.model.ModelClient.get3WithResponse": "TspTest.Model.ModelOp.get3", + "tsptest.model.ModelClient.put1": "TspTest.Model.ModelOp.put1", + "tsptest.model.ModelClient.put1WithResponse": "TspTest.Model.ModelOp.put1", + "tsptest.model.ModelClient.put2": "TspTest.Model.ModelOp.put2", + "tsptest.model.ModelClient.put2WithResponse": "TspTest.Model.ModelOp.put2", + "tsptest.model.ModelClient.putNested": "TspTest.Model.ModelOp.putNested", + "tsptest.model.ModelClient.putNestedWithResponse": "TspTest.Model.ModelOp.putNested", + "tsptest.model.ModelClientBuilder": "TspTest.Model", + "tsptest.model.models.InputOutputData2": "TspTest.Model.InputOutputData2", + "tsptest.model.models.NestedModel": "TspTest.Model.NestedModel", + "tsptest.model.models.NestedModel1": "TspTest.Model.NestedModel1", + "tsptest.model.models.NestedModel2": "TspTest.Model.NestedModel2", + "tsptest.model.models.OutputData": "TspTest.Model.OutputData", + "tsptest.model.models.OutputData3": "TspTest.Model.OutputData3", + "tsptest.model.models.Resource1": "TspTest.Model.Resource1", + "tsptest.model.models.Resource2": "TspTest.Model.Resource2", + "tsptest.model.models.Resource3": "TspTest.Model.Resource3" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_metadata.json new file mode 100644 index 00000000000..b046c907fc0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-model_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.model.ModelAsyncClient":"TspTest.Model.ModelOp","tsptest.model.ModelAsyncClient.get3":"TspTest.Model.ModelOp.get3","tsptest.model.ModelAsyncClient.get3WithResponse":"TspTest.Model.ModelOp.get3","tsptest.model.ModelAsyncClient.put1":"TspTest.Model.ModelOp.put1","tsptest.model.ModelAsyncClient.put1WithResponse":"TspTest.Model.ModelOp.put1","tsptest.model.ModelAsyncClient.put2":"TspTest.Model.ModelOp.put2","tsptest.model.ModelAsyncClient.put2WithResponse":"TspTest.Model.ModelOp.put2","tsptest.model.ModelAsyncClient.putNested":"TspTest.Model.ModelOp.putNested","tsptest.model.ModelAsyncClient.putNestedWithResponse":"TspTest.Model.ModelOp.putNested","tsptest.model.ModelClient":"TspTest.Model.ModelOp","tsptest.model.ModelClient.get3":"TspTest.Model.ModelOp.get3","tsptest.model.ModelClient.get3WithResponse":"TspTest.Model.ModelOp.get3","tsptest.model.ModelClient.put1":"TspTest.Model.ModelOp.put1","tsptest.model.ModelClient.put1WithResponse":"TspTest.Model.ModelOp.put1","tsptest.model.ModelClient.put2":"TspTest.Model.ModelOp.put2","tsptest.model.ModelClient.put2WithResponse":"TspTest.Model.ModelOp.put2","tsptest.model.ModelClient.putNested":"TspTest.Model.ModelOp.putNested","tsptest.model.ModelClient.putNestedWithResponse":"TspTest.Model.ModelOp.putNested","tsptest.model.ModelClientBuilder":"TspTest.Model","tsptest.model.models.InputOutputData2":"TspTest.Model.InputOutputData2","tsptest.model.models.NestedModel":"TspTest.Model.NestedModel","tsptest.model.models.NestedModel1":"TspTest.Model.NestedModel1","tsptest.model.models.NestedModel2":"TspTest.Model.NestedModel2","tsptest.model.models.OutputData":"TspTest.Model.OutputData","tsptest.model.models.OutputData3":"TspTest.Model.OutputData3","tsptest.model.models.Resource1":"TspTest.Model.Resource1","tsptest.model.models.Resource2":"TspTest.Model.Resource2","tsptest.model.models.Resource3":"TspTest.Model.Resource3"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/model/ModelAsyncClient.java","src/main/java/tsptest/model/ModelClient.java","src/main/java/tsptest/model/ModelClientBuilder.java","src/main/java/tsptest/model/implementation/ModelClientImpl.java","src/main/java/tsptest/model/implementation/ModelOpsImpl.java","src/main/java/tsptest/model/implementation/package-info.java","src/main/java/tsptest/model/models/InputOutputData2.java","src/main/java/tsptest/model/models/NestedModel.java","src/main/java/tsptest/model/models/NestedModel1.java","src/main/java/tsptest/model/models/NestedModel2.java","src/main/java/tsptest/model/models/OutputData.java","src/main/java/tsptest/model/models/OutputData3.java","src/main/java/tsptest/model/models/Resource1.java","src/main/java/tsptest/model/models/Resource2.java","src/main/java/tsptest/model/models/Resource3.java","src/main/java/tsptest/model/models/package-info.java","src/main/java/tsptest/model/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_apiview_properties.json new file mode 100644 index 00000000000..e22e3a1a0a4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_apiview_properties.json @@ -0,0 +1,25 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.multicontenttypes.MultiContentTypesAsyncClient": "TspTest.MultiContentTypes", + "tsptest.multicontenttypes.MultiContentTypesClient": "TspTest.MultiContentTypes", + "tsptest.multicontenttypes.MultiContentTypesClientBuilder": "TspTest.MultiContentTypes", + "tsptest.multicontenttypes.MultipleContentTypesOnRequestAsyncClient": "TspTest.MultiContentTypes.MultipleContentTypesOnRequest", + "tsptest.multicontenttypes.MultipleContentTypesOnRequestAsyncClient.uploadJsonWithMultiBodyTypesForMultiContentTypes": "TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes", + "tsptest.multicontenttypes.MultipleContentTypesOnRequestAsyncClient.uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse": "TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes", + "tsptest.multicontenttypes.MultipleContentTypesOnRequestClient": "TspTest.MultiContentTypes.MultipleContentTypesOnRequest", + "tsptest.multicontenttypes.MultipleContentTypesOnRequestClient.uploadJsonWithMultiBodyTypesForMultiContentTypes": "TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes", + "tsptest.multicontenttypes.MultipleContentTypesOnRequestClient.uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse": "TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes", + "tsptest.multicontenttypes.SingleContentTypeAsyncClient": "TspTest.MultiContentTypes.SingleContentType", + "tsptest.multicontenttypes.SingleContentTypeAsyncClient.downloadImageForSingleContentType": "TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType", + "tsptest.multicontenttypes.SingleContentTypeAsyncClient.downloadImageForSingleContentTypeWithResponse": "TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType", + "tsptest.multicontenttypes.SingleContentTypeAsyncClient.uploadImageForSingleContentType": "TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType", + "tsptest.multicontenttypes.SingleContentTypeAsyncClient.uploadImageForSingleContentTypeWithResponse": "TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType", + "tsptest.multicontenttypes.SingleContentTypeClient": "TspTest.MultiContentTypes.SingleContentType", + "tsptest.multicontenttypes.SingleContentTypeClient.downloadImageForSingleContentType": "TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType", + "tsptest.multicontenttypes.SingleContentTypeClient.downloadImageForSingleContentTypeWithResponse": "TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType", + "tsptest.multicontenttypes.SingleContentTypeClient.uploadImageForSingleContentType": "TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType", + "tsptest.multicontenttypes.SingleContentTypeClient.uploadImageForSingleContentTypeWithResponse": "TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType", + "tsptest.multicontenttypes.models.Resource": "TspTest.MultiContentTypes.Resource" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_metadata.json new file mode 100644 index 00000000000..c6679c3d9ac --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multicontenttypes_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.multicontenttypes.MultiContentTypesAsyncClient":"TspTest.MultiContentTypes","tsptest.multicontenttypes.MultiContentTypesClient":"TspTest.MultiContentTypes","tsptest.multicontenttypes.MultiContentTypesClientBuilder":"TspTest.MultiContentTypes","tsptest.multicontenttypes.MultipleContentTypesOnRequestAsyncClient":"TspTest.MultiContentTypes.MultipleContentTypesOnRequest","tsptest.multicontenttypes.MultipleContentTypesOnRequestAsyncClient.uploadJsonWithMultiBodyTypesForMultiContentTypes":"TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes","tsptest.multicontenttypes.MultipleContentTypesOnRequestAsyncClient.uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse":"TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes","tsptest.multicontenttypes.MultipleContentTypesOnRequestClient":"TspTest.MultiContentTypes.MultipleContentTypesOnRequest","tsptest.multicontenttypes.MultipleContentTypesOnRequestClient.uploadJsonWithMultiBodyTypesForMultiContentTypes":"TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes","tsptest.multicontenttypes.MultipleContentTypesOnRequestClient.uploadJsonWithMultiBodyTypesForMultiContentTypesWithResponse":"TspTest.MultiContentTypes.MultipleContentTypesOnRequest.uploadJsonWithMultiBodyTypesForMultiContentTypes","tsptest.multicontenttypes.SingleContentTypeAsyncClient":"TspTest.MultiContentTypes.SingleContentType","tsptest.multicontenttypes.SingleContentTypeAsyncClient.downloadImageForSingleContentType":"TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeAsyncClient.downloadImageForSingleContentTypeWithResponse":"TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeAsyncClient.uploadImageForSingleContentType":"TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeAsyncClient.uploadImageForSingleContentTypeWithResponse":"TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeClient":"TspTest.MultiContentTypes.SingleContentType","tsptest.multicontenttypes.SingleContentTypeClient.downloadImageForSingleContentType":"TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeClient.downloadImageForSingleContentTypeWithResponse":"TspTest.MultiContentTypes.SingleContentType.downloadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeClient.uploadImageForSingleContentType":"TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType","tsptest.multicontenttypes.SingleContentTypeClient.uploadImageForSingleContentTypeWithResponse":"TspTest.MultiContentTypes.SingleContentType.uploadImageForSingleContentType","tsptest.multicontenttypes.models.Resource":"TspTest.MultiContentTypes.Resource"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/multicontenttypes/MultiContentTypesAsyncClient.java","src/main/java/tsptest/multicontenttypes/MultiContentTypesClient.java","src/main/java/tsptest/multicontenttypes/MultiContentTypesClientBuilder.java","src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestAsyncClient.java","src/main/java/tsptest/multicontenttypes/MultipleContentTypesOnRequestClient.java","src/main/java/tsptest/multicontenttypes/SingleContentTypeAsyncClient.java","src/main/java/tsptest/multicontenttypes/SingleContentTypeClient.java","src/main/java/tsptest/multicontenttypes/implementation/MultiContentTypesClientImpl.java","src/main/java/tsptest/multicontenttypes/implementation/MultipleContentTypesOnRequestsImpl.java","src/main/java/tsptest/multicontenttypes/implementation/SingleContentTypesImpl.java","src/main/java/tsptest/multicontenttypes/implementation/package-info.java","src/main/java/tsptest/multicontenttypes/models/Resource.java","src/main/java/tsptest/multicontenttypes/models/package-info.java","src/main/java/tsptest/multicontenttypes/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_apiview_properties.json new file mode 100644 index 00000000000..80c378ecf48 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_apiview_properties.json @@ -0,0 +1,24 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.multipart.MultipartAsyncClient": "TspTest.Multipart", + "tsptest.multipart.MultipartAsyncClient.upload": "TspTest.Multipart.upload", + "tsptest.multipart.MultipartAsyncClient.uploadHttpPart": "TspTest.Multipart.uploadHttpPart", + "tsptest.multipart.MultipartAsyncClient.uploadHttpPartWithResponse": "TspTest.Multipart.uploadHttpPart", + "tsptest.multipart.MultipartAsyncClient.uploadWithResponse": "TspTest.Multipart.upload", + "tsptest.multipart.MultipartClient": "TspTest.Multipart", + "tsptest.multipart.MultipartClient.upload": "TspTest.Multipart.upload", + "tsptest.multipart.MultipartClient.uploadHttpPart": "TspTest.Multipart.uploadHttpPart", + "tsptest.multipart.MultipartClient.uploadHttpPartWithResponse": "TspTest.Multipart.uploadHttpPart", + "tsptest.multipart.MultipartClient.uploadWithResponse": "TspTest.Multipart.upload", + "tsptest.multipart.MultipartClientBuilder": "TspTest.Multipart", + "tsptest.multipart.models.FileDataFileDetails": null, + "tsptest.multipart.models.FileDetails": "TypeSpec.Http.File", + "tsptest.multipart.models.FormData": "TspTest.Multipart.FormData", + "tsptest.multipart.models.ImageFileDetails": null, + "tsptest.multipart.models.ImageType": "TspTest.Multipart.ImageType", + "tsptest.multipart.models.InheritFileData": "TspTest.Multipart.Inherit2File", + "tsptest.multipart.models.Size": "TspTest.Multipart.Size", + "tsptest.multipart.models.UploadHttpPartRequest": "TspTest.Multipart.uploadHttpPart.Request.anonymous" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_metadata.json new file mode 100644 index 00000000000..ebc522ead6f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-multipart_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.multipart.MultipartAsyncClient":"TspTest.Multipart","tsptest.multipart.MultipartAsyncClient.upload":"TspTest.Multipart.upload","tsptest.multipart.MultipartAsyncClient.uploadHttpPart":"TspTest.Multipart.uploadHttpPart","tsptest.multipart.MultipartAsyncClient.uploadHttpPartWithResponse":"TspTest.Multipart.uploadHttpPart","tsptest.multipart.MultipartAsyncClient.uploadWithResponse":"TspTest.Multipart.upload","tsptest.multipart.MultipartClient":"TspTest.Multipart","tsptest.multipart.MultipartClient.upload":"TspTest.Multipart.upload","tsptest.multipart.MultipartClient.uploadHttpPart":"TspTest.Multipart.uploadHttpPart","tsptest.multipart.MultipartClient.uploadHttpPartWithResponse":"TspTest.Multipart.uploadHttpPart","tsptest.multipart.MultipartClient.uploadWithResponse":"TspTest.Multipart.upload","tsptest.multipart.MultipartClientBuilder":"TspTest.Multipart","tsptest.multipart.models.FileDataFileDetails":null,"tsptest.multipart.models.FileDetails":"TypeSpec.Http.File","tsptest.multipart.models.FormData":"TspTest.Multipart.FormData","tsptest.multipart.models.ImageFileDetails":null,"tsptest.multipart.models.ImageType":"TspTest.Multipart.ImageType","tsptest.multipart.models.InheritFileData":"TspTest.Multipart.Inherit2File","tsptest.multipart.models.Size":"TspTest.Multipart.Size","tsptest.multipart.models.UploadHttpPartRequest":"TspTest.Multipart.uploadHttpPart.Request.anonymous"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/multipart/MultipartAsyncClient.java","src/main/java/tsptest/multipart/MultipartClient.java","src/main/java/tsptest/multipart/MultipartClientBuilder.java","src/main/java/tsptest/multipart/implementation/MultipartClientImpl.java","src/main/java/tsptest/multipart/implementation/MultipartFormDataHelper.java","src/main/java/tsptest/multipart/implementation/package-info.java","src/main/java/tsptest/multipart/models/FileDataFileDetails.java","src/main/java/tsptest/multipart/models/FileDetails.java","src/main/java/tsptest/multipart/models/FormData.java","src/main/java/tsptest/multipart/models/ImageFileDetails.java","src/main/java/tsptest/multipart/models/ImageType.java","src/main/java/tsptest/multipart/models/InheritFileData.java","src/main/java/tsptest/multipart/models/Size.java","src/main/java/tsptest/multipart/models/UploadHttpPartRequest.java","src/main/java/tsptest/multipart/models/package-info.java","src/main/java/tsptest/multipart/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_apiview_properties.json new file mode 100644 index 00000000000..a177c21a899 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_apiview_properties.json @@ -0,0 +1,13 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.namespaceclient.NamespaceAsyncClient": "TspTest.NamespaceClient", + "tsptest.namespaceclient.NamespaceAsyncClient.get": "TspTest.NamespaceClient.get", + "tsptest.namespaceclient.NamespaceAsyncClient.getWithResponse": "TspTest.NamespaceClient.get", + "tsptest.namespaceclient.NamespaceClient": "TspTest.NamespaceClient", + "tsptest.namespaceclient.NamespaceClient.get": "TspTest.NamespaceClient.get", + "tsptest.namespaceclient.NamespaceClient.getWithResponse": "TspTest.NamespaceClient.get", + "tsptest.namespaceclient.NamespaceClientBuilder": "TspTest.NamespaceClient", + "tsptest.namespacemodel.models.Model": "TspTest.NamespaceModel.Model" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_metadata.json new file mode 100644 index 00000000000..c559630f57e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namespaceclient_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.namespaceclient.NamespaceAsyncClient":"TspTest.NamespaceClient","tsptest.namespaceclient.NamespaceAsyncClient.get":"TspTest.NamespaceClient.get","tsptest.namespaceclient.NamespaceAsyncClient.getWithResponse":"TspTest.NamespaceClient.get","tsptest.namespaceclient.NamespaceClient":"TspTest.NamespaceClient","tsptest.namespaceclient.NamespaceClient.get":"TspTest.NamespaceClient.get","tsptest.namespaceclient.NamespaceClient.getWithResponse":"TspTest.NamespaceClient.get","tsptest.namespaceclient.NamespaceClientBuilder":"TspTest.NamespaceClient","tsptest.namespacemodel.models.Model":"TspTest.NamespaceModel.Model"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/namespaceclient/NamespaceAsyncClient.java","src/main/java/tsptest/namespaceclient/NamespaceClient.java","src/main/java/tsptest/namespaceclient/NamespaceClientBuilder.java","src/main/java/tsptest/namespaceclient/implementation/NamespaceClientImpl.java","src/main/java/tsptest/namespaceclient/implementation/package-info.java","src/main/java/tsptest/namespaceclient/package-info.java","src/main/java/tsptest/namespacemodel/models/Model.java","src/main/java/tsptest/namespacemodel/models/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_apiview_properties.json new file mode 100644 index 00000000000..4fcd275ff4b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_apiview_properties.json @@ -0,0 +1,29 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.naming.NamingAsyncClient": "TspTest.Naming.NamingOp", + "tsptest.naming.NamingAsyncClient.getAnonymous": "TspTest.Naming.NamingOp.getAnonymous", + "tsptest.naming.NamingAsyncClient.getAnonymousWithResponse": "TspTest.Naming.NamingOp.getAnonymous", + "tsptest.naming.NamingAsyncClient.post": "TspTest.Naming.NamingOp.post", + "tsptest.naming.NamingAsyncClient.postWithResponse": "TspTest.Naming.NamingOp.post", + "tsptest.naming.NamingClient": "TspTest.Naming.NamingOp", + "tsptest.naming.NamingClient.getAnonymous": "TspTest.Naming.NamingOp.getAnonymous", + "tsptest.naming.NamingClient.getAnonymousWithResponse": "TspTest.Naming.NamingOp.getAnonymous", + "tsptest.naming.NamingClient.post": "TspTest.Naming.NamingOp.post", + "tsptest.naming.NamingClient.postWithResponse": "TspTest.Naming.NamingOp.post", + "tsptest.naming.NamingClientBuilder": "TspTest.Naming", + "tsptest.naming.models.BinaryData": "TspTest.Naming.DataModel", + "tsptest.naming.models.BytesData": "TspTest.Naming.BytesData", + "tsptest.naming.models.Data": "TspTest.Naming.Data", + "tsptest.naming.models.DataRequest": "TspTest.Naming.Request", + "tsptest.naming.models.DataResponse": "TspTest.Naming.Response", + "tsptest.naming.models.DataStatus": "TspTest.Naming.StatusModel", + "tsptest.naming.models.GetAnonymousResponse": "TspTest.Naming.getAnonymous.Response.anonymous", + "tsptest.naming.models.RequestParameters": "TspTest.Naming.Request.parameters.anonymous", + "tsptest.naming.models.RequestParametersType": "TspTest.Naming.Request.parameters.type.anonymous", + "tsptest.naming.models.RunObject": "TspTest.Naming.RunObject", + "tsptest.naming.models.RunObjectLastErrorCodeRenamed": "TspTest.Naming.RunObject.last_error.code.anonymous", + "tsptest.naming.models.RunObjectLastErrorRenamed": "TspTest.Naming.RunObject.last_error.anonymous", + "tsptest.naming.models.TypesModel": "TspTest.Naming.TypesModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_metadata.json new file mode 100644 index 00000000000..eec462e5b7c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-naming_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.naming.NamingAsyncClient":"TspTest.Naming.NamingOp","tsptest.naming.NamingAsyncClient.getAnonymous":"TspTest.Naming.NamingOp.getAnonymous","tsptest.naming.NamingAsyncClient.getAnonymousWithResponse":"TspTest.Naming.NamingOp.getAnonymous","tsptest.naming.NamingAsyncClient.post":"TspTest.Naming.NamingOp.post","tsptest.naming.NamingAsyncClient.postWithResponse":"TspTest.Naming.NamingOp.post","tsptest.naming.NamingClient":"TspTest.Naming.NamingOp","tsptest.naming.NamingClient.getAnonymous":"TspTest.Naming.NamingOp.getAnonymous","tsptest.naming.NamingClient.getAnonymousWithResponse":"TspTest.Naming.NamingOp.getAnonymous","tsptest.naming.NamingClient.post":"TspTest.Naming.NamingOp.post","tsptest.naming.NamingClient.postWithResponse":"TspTest.Naming.NamingOp.post","tsptest.naming.NamingClientBuilder":"TspTest.Naming","tsptest.naming.models.BinaryData":"TspTest.Naming.DataModel","tsptest.naming.models.BytesData":"TspTest.Naming.BytesData","tsptest.naming.models.Data":"TspTest.Naming.Data","tsptest.naming.models.DataRequest":"TspTest.Naming.Request","tsptest.naming.models.DataResponse":"TspTest.Naming.Response","tsptest.naming.models.DataStatus":"TspTest.Naming.StatusModel","tsptest.naming.models.GetAnonymousResponse":"TspTest.Naming.getAnonymous.Response.anonymous","tsptest.naming.models.RequestParameters":"TspTest.Naming.Request.parameters.anonymous","tsptest.naming.models.RequestParametersType":"TspTest.Naming.Request.parameters.type.anonymous","tsptest.naming.models.RunObject":"TspTest.Naming.RunObject","tsptest.naming.models.RunObjectLastErrorCodeRenamed":"TspTest.Naming.RunObject.last_error.code.anonymous","tsptest.naming.models.RunObjectLastErrorRenamed":"TspTest.Naming.RunObject.last_error.anonymous","tsptest.naming.models.TypesModel":"TspTest.Naming.TypesModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/naming/NamingAsyncClient.java","src/main/java/tsptest/naming/NamingClient.java","src/main/java/tsptest/naming/NamingClientBuilder.java","src/main/java/tsptest/naming/implementation/NamingClientImpl.java","src/main/java/tsptest/naming/implementation/NamingOpsImpl.java","src/main/java/tsptest/naming/implementation/package-info.java","src/main/java/tsptest/naming/models/BinaryData.java","src/main/java/tsptest/naming/models/BytesData.java","src/main/java/tsptest/naming/models/Data.java","src/main/java/tsptest/naming/models/DataRequest.java","src/main/java/tsptest/naming/models/DataResponse.java","src/main/java/tsptest/naming/models/DataStatus.java","src/main/java/tsptest/naming/models/GetAnonymousResponse.java","src/main/java/tsptest/naming/models/RequestParameters.java","src/main/java/tsptest/naming/models/RequestParametersType.java","src/main/java/tsptest/naming/models/RunObject.java","src/main/java/tsptest/naming/models/RunObjectLastErrorCodeRenamed.java","src/main/java/tsptest/naming/models/RunObjectLastErrorRenamed.java","src/main/java/tsptest/naming/models/TypesModel.java","src/main/java/tsptest/naming/models/package-info.java","src/main/java/tsptest/naming/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_apiview_properties.json new file mode 100644 index 00000000000..b9a1873b662 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_apiview_properties.json @@ -0,0 +1,29 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.namingjavaparser.NamingJavaParserAsyncClient": "TspTest.NamingJavaParser.NamingOp", + "tsptest.namingjavaparser.NamingJavaParserAsyncClient.getAnonymous": "TspTest.NamingJavaParser.NamingOp.getAnonymous", + "tsptest.namingjavaparser.NamingJavaParserAsyncClient.getAnonymousWithResponse": "TspTest.NamingJavaParser.NamingOp.getAnonymous", + "tsptest.namingjavaparser.NamingJavaParserAsyncClient.post": "TspTest.NamingJavaParser.NamingOp.post", + "tsptest.namingjavaparser.NamingJavaParserAsyncClient.postWithResponse": "TspTest.NamingJavaParser.NamingOp.post", + "tsptest.namingjavaparser.NamingJavaParserClient": "TspTest.NamingJavaParser.NamingOp", + "tsptest.namingjavaparser.NamingJavaParserClient.getAnonymous": "TspTest.NamingJavaParser.NamingOp.getAnonymous", + "tsptest.namingjavaparser.NamingJavaParserClient.getAnonymousWithResponse": "TspTest.NamingJavaParser.NamingOp.getAnonymous", + "tsptest.namingjavaparser.NamingJavaParserClient.post": "TspTest.NamingJavaParser.NamingOp.post", + "tsptest.namingjavaparser.NamingJavaParserClient.postWithResponse": "TspTest.NamingJavaParser.NamingOp.post", + "tsptest.namingjavaparser.NamingJavaParserClientBuilder": "TspTest.NamingJavaParser", + "tsptest.namingjavaparser.models.BinaryData": "TspTest.NamingJavaParser.DataModel", + "tsptest.namingjavaparser.models.BytesData": "TspTest.NamingJavaParser.BytesData", + "tsptest.namingjavaparser.models.Data": "TspTest.NamingJavaParser.Data", + "tsptest.namingjavaparser.models.DataRequest": "TspTest.NamingJavaParser.Request", + "tsptest.namingjavaparser.models.DataResponse": "TspTest.NamingJavaParser.Response", + "tsptest.namingjavaparser.models.DataStatus": "TspTest.NamingJavaParser.StatusModel", + "tsptest.namingjavaparser.models.GetAnonymousResponse": "TspTest.NamingJavaParser.getAnonymous.Response.anonymous", + "tsptest.namingjavaparser.models.RequestParameters": "TspTest.NamingJavaParser.Request.parameters.anonymous", + "tsptest.namingjavaparser.models.RequestParametersType": "TspTest.NamingJavaParser.Request.parameters.type.anonymous", + "tsptest.namingjavaparser.models.RunObject": "TspTest.NamingJavaParser.RunObject", + "tsptest.namingjavaparser.models.RunObjectLastError1": "TspTest.NamingJavaParser.RunObject.last_error.anonymous", + "tsptest.namingjavaparser.models.RunObjectLastErrorCode": "TspTest.NamingJavaParser.RunObject.last_error.code.anonymous", + "tsptest.namingjavaparser.models.TypesModel": "TspTest.NamingJavaParser.TypesModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_metadata.json new file mode 100644 index 00000000000..0cb93e61ec2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-namingjavaparser_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.namingjavaparser.NamingJavaParserAsyncClient":"TspTest.NamingJavaParser.NamingOp","tsptest.namingjavaparser.NamingJavaParserAsyncClient.getAnonymous":"TspTest.NamingJavaParser.NamingOp.getAnonymous","tsptest.namingjavaparser.NamingJavaParserAsyncClient.getAnonymousWithResponse":"TspTest.NamingJavaParser.NamingOp.getAnonymous","tsptest.namingjavaparser.NamingJavaParserAsyncClient.post":"TspTest.NamingJavaParser.NamingOp.post","tsptest.namingjavaparser.NamingJavaParserAsyncClient.postWithResponse":"TspTest.NamingJavaParser.NamingOp.post","tsptest.namingjavaparser.NamingJavaParserClient":"TspTest.NamingJavaParser.NamingOp","tsptest.namingjavaparser.NamingJavaParserClient.getAnonymous":"TspTest.NamingJavaParser.NamingOp.getAnonymous","tsptest.namingjavaparser.NamingJavaParserClient.getAnonymousWithResponse":"TspTest.NamingJavaParser.NamingOp.getAnonymous","tsptest.namingjavaparser.NamingJavaParserClient.post":"TspTest.NamingJavaParser.NamingOp.post","tsptest.namingjavaparser.NamingJavaParserClient.postWithResponse":"TspTest.NamingJavaParser.NamingOp.post","tsptest.namingjavaparser.NamingJavaParserClientBuilder":"TspTest.NamingJavaParser","tsptest.namingjavaparser.models.BinaryData":"TspTest.NamingJavaParser.DataModel","tsptest.namingjavaparser.models.BytesData":"TspTest.NamingJavaParser.BytesData","tsptest.namingjavaparser.models.Data":"TspTest.NamingJavaParser.Data","tsptest.namingjavaparser.models.DataRequest":"TspTest.NamingJavaParser.Request","tsptest.namingjavaparser.models.DataResponse":"TspTest.NamingJavaParser.Response","tsptest.namingjavaparser.models.DataStatus":"TspTest.NamingJavaParser.StatusModel","tsptest.namingjavaparser.models.GetAnonymousResponse":"TspTest.NamingJavaParser.getAnonymous.Response.anonymous","tsptest.namingjavaparser.models.RequestParameters":"TspTest.NamingJavaParser.Request.parameters.anonymous","tsptest.namingjavaparser.models.RequestParametersType":"TspTest.NamingJavaParser.Request.parameters.type.anonymous","tsptest.namingjavaparser.models.RunObject":"TspTest.NamingJavaParser.RunObject","tsptest.namingjavaparser.models.RunObjectLastError1":"TspTest.NamingJavaParser.RunObject.last_error.anonymous","tsptest.namingjavaparser.models.RunObjectLastErrorCode":"TspTest.NamingJavaParser.RunObject.last_error.code.anonymous","tsptest.namingjavaparser.models.TypesModel":"TspTest.NamingJavaParser.TypesModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/namingjavaparser/NamingJavaParserAsyncClient.java","src/main/java/tsptest/namingjavaparser/NamingJavaParserClient.java","src/main/java/tsptest/namingjavaparser/NamingJavaParserClientBuilder.java","src/main/java/tsptest/namingjavaparser/implementation/NamingJavaParserClientImpl.java","src/main/java/tsptest/namingjavaparser/implementation/NamingOpsImpl.java","src/main/java/tsptest/namingjavaparser/implementation/package-info.java","src/main/java/tsptest/namingjavaparser/models/BinaryData.java","src/main/java/tsptest/namingjavaparser/models/BytesData.java","src/main/java/tsptest/namingjavaparser/models/Data.java","src/main/java/tsptest/namingjavaparser/models/DataRequest.java","src/main/java/tsptest/namingjavaparser/models/DataResponse.java","src/main/java/tsptest/namingjavaparser/models/DataStatus.java","src/main/java/tsptest/namingjavaparser/models/GetAnonymousResponse.java","src/main/java/tsptest/namingjavaparser/models/RequestParameters.java","src/main/java/tsptest/namingjavaparser/models/RequestParametersType.java","src/main/java/tsptest/namingjavaparser/models/RunObject.java","src/main/java/tsptest/namingjavaparser/models/RunObjectLastError1.java","src/main/java/tsptest/namingjavaparser/models/RunObjectLastErrorCode.java","src/main/java/tsptest/namingjavaparser/models/TypesModel.java","src/main/java/tsptest/namingjavaparser/models/package-info.java","src/main/java/tsptest/namingjavaparser/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_apiview_properties.json new file mode 100644 index 00000000000..41b50abc027 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_apiview_properties.json @@ -0,0 +1,15 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.optional.OptionalAsyncClient": "TspTest.Optional.OptionalOp", + "tsptest.optional.OptionalAsyncClient.put": "TspTest.Optional.OptionalOp.put", + "tsptest.optional.OptionalAsyncClient.putWithResponse": "TspTest.Optional.OptionalOp.put", + "tsptest.optional.OptionalClient": "TspTest.Optional.OptionalOp", + "tsptest.optional.OptionalClient.put": "TspTest.Optional.OptionalOp.put", + "tsptest.optional.OptionalClient.putWithResponse": "TspTest.Optional.OptionalOp.put", + "tsptest.optional.OptionalClientBuilder": "TspTest.Optional", + "tsptest.optional.models.AllPropertiesOptional": "TspTest.Optional.AllPropertiesOptional", + "tsptest.optional.models.ImmutableModel": "TspTest.Optional.Immutable", + "tsptest.optional.models.Optional": "TspTest.Optional.Optional" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_metadata.json new file mode 100644 index 00000000000..dae73d46a49 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-optional_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.optional.OptionalAsyncClient":"TspTest.Optional.OptionalOp","tsptest.optional.OptionalAsyncClient.put":"TspTest.Optional.OptionalOp.put","tsptest.optional.OptionalAsyncClient.putWithResponse":"TspTest.Optional.OptionalOp.put","tsptest.optional.OptionalClient":"TspTest.Optional.OptionalOp","tsptest.optional.OptionalClient.put":"TspTest.Optional.OptionalOp.put","tsptest.optional.OptionalClient.putWithResponse":"TspTest.Optional.OptionalOp.put","tsptest.optional.OptionalClientBuilder":"TspTest.Optional","tsptest.optional.models.AllPropertiesOptional":"TspTest.Optional.AllPropertiesOptional","tsptest.optional.models.ImmutableModel":"TspTest.Optional.Immutable","tsptest.optional.models.Optional":"TspTest.Optional.Optional"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/optional/OptionalAsyncClient.java","src/main/java/tsptest/optional/OptionalClient.java","src/main/java/tsptest/optional/OptionalClientBuilder.java","src/main/java/tsptest/optional/implementation/OptionalClientImpl.java","src/main/java/tsptest/optional/implementation/OptionalOpsImpl.java","src/main/java/tsptest/optional/implementation/package-info.java","src/main/java/tsptest/optional/models/AllPropertiesOptional.java","src/main/java/tsptest/optional/models/ImmutableModel.java","src/main/java/tsptest/optional/models/Optional.java","src/main/java/tsptest/optional/models/package-info.java","src/main/java/tsptest/optional/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_apiview_properties.json new file mode 100644 index 00000000000..6fa1ea824c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_apiview_properties.json @@ -0,0 +1,31 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.patch.PatchAsyncClient": "TspTest.Patch.Patch", + "tsptest.patch.PatchAsyncClient.createOrUpdateFish": "TspTest.Patch.Patch.createOrUpdateFish", + "tsptest.patch.PatchAsyncClient.createOrUpdateFishWithResponse": "TspTest.Patch.Patch.createOrUpdateFish", + "tsptest.patch.PatchAsyncClient.createOrUpdateOptionalResource": "TspTest.Patch.Patch.createOrUpdateOptionalResource", + "tsptest.patch.PatchAsyncClient.createOrUpdateOptionalResourceWithResponse": "TspTest.Patch.Patch.createOrUpdateOptionalResource", + "tsptest.patch.PatchAsyncClient.createOrUpdateResource": "TspTest.Patch.Patch.createOrUpdateResource", + "tsptest.patch.PatchAsyncClient.createOrUpdateResourceWithResponse": "TspTest.Patch.Patch.createOrUpdateResource", + "tsptest.patch.PatchAsyncClient.createOrUpdateSalmon": "TspTest.Patch.Patch.createOrUpdateSalmon", + "tsptest.patch.PatchAsyncClient.createOrUpdateSalmonWithResponse": "TspTest.Patch.Patch.createOrUpdateSalmon", + "tsptest.patch.PatchClient": "TspTest.Patch.Patch", + "tsptest.patch.PatchClient.createOrUpdateFish": "TspTest.Patch.Patch.createOrUpdateFish", + "tsptest.patch.PatchClient.createOrUpdateFishWithResponse": "TspTest.Patch.Patch.createOrUpdateFish", + "tsptest.patch.PatchClient.createOrUpdateOptionalResource": "TspTest.Patch.Patch.createOrUpdateOptionalResource", + "tsptest.patch.PatchClient.createOrUpdateOptionalResourceWithResponse": "TspTest.Patch.Patch.createOrUpdateOptionalResource", + "tsptest.patch.PatchClient.createOrUpdateResource": "TspTest.Patch.Patch.createOrUpdateResource", + "tsptest.patch.PatchClient.createOrUpdateResourceWithResponse": "TspTest.Patch.Patch.createOrUpdateResource", + "tsptest.patch.PatchClient.createOrUpdateSalmon": "TspTest.Patch.Patch.createOrUpdateSalmon", + "tsptest.patch.PatchClient.createOrUpdateSalmonWithResponse": "TspTest.Patch.Patch.createOrUpdateSalmon", + "tsptest.patch.PatchClientBuilder": "TspTest.Patch", + "tsptest.patch.models.Fish": "TspTest.Patch.Fish", + "tsptest.patch.models.InnerModel": "TspTest.Patch.InnerModel", + "tsptest.patch.models.Resource": "TspTest.Patch.Resource", + "tsptest.patch.models.ResourceEnumValue": "TspTest.Patch.Resource.enumValue.anonymous", + "tsptest.patch.models.Salmon": "TspTest.Patch.Salmon", + "tsptest.patch.models.SawShark": "TspTest.Patch.SawShark", + "tsptest.patch.models.Shark": "TspTest.Patch.Shark" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_metadata.json new file mode 100644 index 00000000000..6bb6967928e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-patch_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.patch.PatchAsyncClient":"TspTest.Patch.Patch","tsptest.patch.PatchAsyncClient.createOrUpdateFish":"TspTest.Patch.Patch.createOrUpdateFish","tsptest.patch.PatchAsyncClient.createOrUpdateFishWithResponse":"TspTest.Patch.Patch.createOrUpdateFish","tsptest.patch.PatchAsyncClient.createOrUpdateOptionalResource":"TspTest.Patch.Patch.createOrUpdateOptionalResource","tsptest.patch.PatchAsyncClient.createOrUpdateOptionalResourceWithResponse":"TspTest.Patch.Patch.createOrUpdateOptionalResource","tsptest.patch.PatchAsyncClient.createOrUpdateResource":"TspTest.Patch.Patch.createOrUpdateResource","tsptest.patch.PatchAsyncClient.createOrUpdateResourceWithResponse":"TspTest.Patch.Patch.createOrUpdateResource","tsptest.patch.PatchAsyncClient.createOrUpdateSalmon":"TspTest.Patch.Patch.createOrUpdateSalmon","tsptest.patch.PatchAsyncClient.createOrUpdateSalmonWithResponse":"TspTest.Patch.Patch.createOrUpdateSalmon","tsptest.patch.PatchClient":"TspTest.Patch.Patch","tsptest.patch.PatchClient.createOrUpdateFish":"TspTest.Patch.Patch.createOrUpdateFish","tsptest.patch.PatchClient.createOrUpdateFishWithResponse":"TspTest.Patch.Patch.createOrUpdateFish","tsptest.patch.PatchClient.createOrUpdateOptionalResource":"TspTest.Patch.Patch.createOrUpdateOptionalResource","tsptest.patch.PatchClient.createOrUpdateOptionalResourceWithResponse":"TspTest.Patch.Patch.createOrUpdateOptionalResource","tsptest.patch.PatchClient.createOrUpdateResource":"TspTest.Patch.Patch.createOrUpdateResource","tsptest.patch.PatchClient.createOrUpdateResourceWithResponse":"TspTest.Patch.Patch.createOrUpdateResource","tsptest.patch.PatchClient.createOrUpdateSalmon":"TspTest.Patch.Patch.createOrUpdateSalmon","tsptest.patch.PatchClient.createOrUpdateSalmonWithResponse":"TspTest.Patch.Patch.createOrUpdateSalmon","tsptest.patch.PatchClientBuilder":"TspTest.Patch","tsptest.patch.models.Fish":"TspTest.Patch.Fish","tsptest.patch.models.InnerModel":"TspTest.Patch.InnerModel","tsptest.patch.models.Resource":"TspTest.Patch.Resource","tsptest.patch.models.ResourceEnumValue":"TspTest.Patch.Resource.enumValue.anonymous","tsptest.patch.models.Salmon":"TspTest.Patch.Salmon","tsptest.patch.models.SawShark":"TspTest.Patch.SawShark","tsptest.patch.models.Shark":"TspTest.Patch.Shark"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/patch/PatchAsyncClient.java","src/main/java/tsptest/patch/PatchClient.java","src/main/java/tsptest/patch/PatchClientBuilder.java","src/main/java/tsptest/patch/implementation/JsonMergePatchHelper.java","src/main/java/tsptest/patch/implementation/PatchClientImpl.java","src/main/java/tsptest/patch/implementation/PatchesImpl.java","src/main/java/tsptest/patch/implementation/package-info.java","src/main/java/tsptest/patch/models/Fish.java","src/main/java/tsptest/patch/models/InnerModel.java","src/main/java/tsptest/patch/models/Resource.java","src/main/java/tsptest/patch/models/ResourceEnumValue.java","src/main/java/tsptest/patch/models/Salmon.java","src/main/java/tsptest/patch/models/SawShark.java","src/main/java/tsptest/patch/models/Shark.java","src/main/java/tsptest/patch/models/package-info.java","src/main/java/tsptest/patch/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_apiview_properties.json new file mode 100644 index 00000000000..27d8b6340dc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_apiview_properties.json @@ -0,0 +1,28 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp", + "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.beginCreateOrReplace": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace", + "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.beginCreateOrReplaceWithModel": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace", + "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.bothConvenientAndProtocol": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol", + "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.bothConvenientAndProtocolWithResponse": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol", + "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.list": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.list", + "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.onlyConvenient": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient", + "tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.onlyConvenientWithResponse": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient", + "tsptest.protocolandconvenient.ProtocolAndConvenientClient": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp", + "tsptest.protocolandconvenient.ProtocolAndConvenientClient.beginCreateOrReplace": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace", + "tsptest.protocolandconvenient.ProtocolAndConvenientClient.beginCreateOrReplaceWithModel": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace", + "tsptest.protocolandconvenient.ProtocolAndConvenientClient.bothConvenientAndProtocol": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol", + "tsptest.protocolandconvenient.ProtocolAndConvenientClient.bothConvenientAndProtocolWithResponse": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol", + "tsptest.protocolandconvenient.ProtocolAndConvenientClient.list": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.list", + "tsptest.protocolandconvenient.ProtocolAndConvenientClient.onlyConvenient": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient", + "tsptest.protocolandconvenient.ProtocolAndConvenientClient.onlyConvenientWithResponse": "TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient", + "tsptest.protocolandconvenient.ProtocolAndConvenientClientBuilder": "TspTest.ProtocolAndConvenient", + "tsptest.protocolandconvenient.models.ResourceA": "TspTest.ProtocolAndConvenient.ResourceA", + "tsptest.protocolandconvenient.models.ResourceB": "TspTest.ProtocolAndConvenient.ResourceB", + "tsptest.protocolandconvenient.models.ResourceE": "TspTest.ProtocolAndConvenient.ResourceE", + "tsptest.protocolandconvenient.models.ResourceF": "TspTest.ProtocolAndConvenient.ResourceF", + "tsptest.protocolandconvenient.models.ResourceI": "TspTest.ProtocolAndConvenient.ResourceI", + "tsptest.protocolandconvenient.models.ResourceJ": "TspTest.ProtocolAndConvenient.ResourceJ" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_metadata.json new file mode 100644 index 00000000000..f51cf29b1e9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-protocolandconvenient_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-06-01-preview","crossLanguageDefinitions":{"tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.beginCreateOrReplace":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.beginCreateOrReplaceWithModel":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.bothConvenientAndProtocol":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.bothConvenientAndProtocolWithResponse":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.list":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.list","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.onlyConvenient":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient","tsptest.protocolandconvenient.ProtocolAndConvenientAsyncClient.onlyConvenientWithResponse":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient","tsptest.protocolandconvenient.ProtocolAndConvenientClient":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp","tsptest.protocolandconvenient.ProtocolAndConvenientClient.beginCreateOrReplace":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace","tsptest.protocolandconvenient.ProtocolAndConvenientClient.beginCreateOrReplaceWithModel":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.createOrReplace","tsptest.protocolandconvenient.ProtocolAndConvenientClient.bothConvenientAndProtocol":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol","tsptest.protocolandconvenient.ProtocolAndConvenientClient.bothConvenientAndProtocolWithResponse":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.bothConvenientAndProtocol","tsptest.protocolandconvenient.ProtocolAndConvenientClient.list":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.list","tsptest.protocolandconvenient.ProtocolAndConvenientClient.onlyConvenient":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient","tsptest.protocolandconvenient.ProtocolAndConvenientClient.onlyConvenientWithResponse":"TspTest.ProtocolAndConvenient.ProtocolAndConvenienceOp.onlyConvenient","tsptest.protocolandconvenient.ProtocolAndConvenientClientBuilder":"TspTest.ProtocolAndConvenient","tsptest.protocolandconvenient.models.ResourceA":"TspTest.ProtocolAndConvenient.ResourceA","tsptest.protocolandconvenient.models.ResourceB":"TspTest.ProtocolAndConvenient.ResourceB","tsptest.protocolandconvenient.models.ResourceE":"TspTest.ProtocolAndConvenient.ResourceE","tsptest.protocolandconvenient.models.ResourceF":"TspTest.ProtocolAndConvenient.ResourceF","tsptest.protocolandconvenient.models.ResourceI":"TspTest.ProtocolAndConvenient.ResourceI","tsptest.protocolandconvenient.models.ResourceJ":"TspTest.ProtocolAndConvenient.ResourceJ"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientAsyncClient.java","src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClient.java","src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientClientBuilder.java","src/main/java/tsptest/protocolandconvenient/ProtocolAndConvenientServiceVersion.java","src/main/java/tsptest/protocolandconvenient/implementation/OperationLocationPollingStrategy.java","src/main/java/tsptest/protocolandconvenient/implementation/PollingUtils.java","src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenienceOpsImpl.java","src/main/java/tsptest/protocolandconvenient/implementation/ProtocolAndConvenientClientImpl.java","src/main/java/tsptest/protocolandconvenient/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/tsptest/protocolandconvenient/implementation/package-info.java","src/main/java/tsptest/protocolandconvenient/models/ResourceA.java","src/main/java/tsptest/protocolandconvenient/models/ResourceB.java","src/main/java/tsptest/protocolandconvenient/models/ResourceE.java","src/main/java/tsptest/protocolandconvenient/models/ResourceF.java","src/main/java/tsptest/protocolandconvenient/models/ResourceI.java","src/main/java/tsptest/protocolandconvenient/models/ResourceJ.java","src/main/java/tsptest/protocolandconvenient/models/package-info.java","src/main/java/tsptest/protocolandconvenient/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_apiview_properties.json new file mode 100644 index 00000000000..90a2ed4ab6c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_apiview_properties.json @@ -0,0 +1,88 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.response.ResponseAsyncClient": "TspTest.Response.ResponseOp", + "tsptest.response.ResponseAsyncClient.beginLroInvalidPollResponse": "TspTest.Response.ResponseOp.lroInvalidPollResponse", + "tsptest.response.ResponseAsyncClient.beginLroInvalidPollResponseWithModel": "TspTest.Response.ResponseOp.lroInvalidPollResponse", + "tsptest.response.ResponseAsyncClient.beginLroInvalidResult": "TspTest.Response.ResponseOp.lroInvalidResult", + "tsptest.response.ResponseAsyncClient.beginLroInvalidResultWithModel": "TspTest.Response.ResponseOp.lroInvalidResult", + "tsptest.response.ResponseAsyncClient.createWithHeaders": "TspTest.Response.ResponseOp.createWithHeaders", + "tsptest.response.ResponseAsyncClient.createWithHeadersWithResponse": "TspTest.Response.ResponseOp.createWithHeaders", + "tsptest.response.ResponseAsyncClient.deleteWithHeaders": "TspTest.Response.ResponseOp.deleteWithHeaders", + "tsptest.response.ResponseAsyncClient.deleteWithHeadersWithResponse": "TspTest.Response.ResponseOp.deleteWithHeaders", + "tsptest.response.ResponseAsyncClient.exists": "TspTest.Response.ResponseOp.exists", + "tsptest.response.ResponseAsyncClient.existsWithResponse": "TspTest.Response.ResponseOp.exists", + "tsptest.response.ResponseAsyncClient.getAnotherArray": "TspTest.Response.ResponseOp.getAnotherArray", + "tsptest.response.ResponseAsyncClient.getAnotherArrayWithResponse": "TspTest.Response.ResponseOp.getAnotherArray", + "tsptest.response.ResponseAsyncClient.getArray": "TspTest.Response.ResponseOp.getArray", + "tsptest.response.ResponseAsyncClient.getArrayWithResponse": "TspTest.Response.ResponseOp.getArray", + "tsptest.response.ResponseAsyncClient.getBinary": "TspTest.Response.ResponseOp.getBinary", + "tsptest.response.ResponseAsyncClient.getBinaryWithResponse": "TspTest.Response.ResponseOp.getBinary", + "tsptest.response.ResponseAsyncClient.getJsonUtf8Response": "TspTest.Response.ResponseOp.getJsonUtf8Response", + "tsptest.response.ResponseAsyncClient.getJsonUtf8ResponseWithResponse": "TspTest.Response.ResponseOp.getJsonUtf8Response", + "tsptest.response.ResponseAsyncClient.getPlusJsonResponse": "TspTest.Response.ResponseOp.getPlusJsonResponse", + "tsptest.response.ResponseAsyncClient.getPlusJsonResponseWithResponse": "TspTest.Response.ResponseOp.getPlusJsonResponse", + "tsptest.response.ResponseAsyncClient.getTextBoolean": "TspTest.Response.ResponseOp.getTextBoolean", + "tsptest.response.ResponseAsyncClient.getTextBooleanWithResponse": "TspTest.Response.ResponseOp.getTextBoolean", + "tsptest.response.ResponseAsyncClient.getTextByte": "TspTest.Response.ResponseOp.getTextByte", + "tsptest.response.ResponseAsyncClient.getTextByteWithResponse": "TspTest.Response.ResponseOp.getTextByte", + "tsptest.response.ResponseAsyncClient.getTextChar": "TspTest.Response.ResponseOp.getTextChar", + "tsptest.response.ResponseAsyncClient.getTextCharWithResponse": "TspTest.Response.ResponseOp.getTextChar", + "tsptest.response.ResponseAsyncClient.getTextFloat32": "TspTest.Response.ResponseOp.getTextFloat32", + "tsptest.response.ResponseAsyncClient.getTextFloat32WithResponse": "TspTest.Response.ResponseOp.getTextFloat32", + "tsptest.response.ResponseAsyncClient.getTextFloat64": "TspTest.Response.ResponseOp.getTextFloat64", + "tsptest.response.ResponseAsyncClient.getTextFloat64WithResponse": "TspTest.Response.ResponseOp.getTextFloat64", + "tsptest.response.ResponseAsyncClient.getTextInt32": "TspTest.Response.ResponseOp.getTextInt32", + "tsptest.response.ResponseAsyncClient.getTextInt32WithResponse": "TspTest.Response.ResponseOp.getTextInt32", + "tsptest.response.ResponseAsyncClient.getTextInt64": "TspTest.Response.ResponseOp.getTextInt64", + "tsptest.response.ResponseAsyncClient.getTextInt64WithResponse": "TspTest.Response.ResponseOp.getTextInt64", + "tsptest.response.ResponseAsyncClient.getUnionResponse": "TspTest.Response.ResponseOp.getUnionResponse", + "tsptest.response.ResponseAsyncClient.getUnionResponseWithResponse": "TspTest.Response.ResponseOp.getUnionResponse", + "tsptest.response.ResponseAsyncClient.listIntegers": "TspTest.Response.ResponseOp.listIntegers", + "tsptest.response.ResponseAsyncClient.listStrings": "TspTest.Response.ResponseOp.listStrings", + "tsptest.response.ResponseClient": "TspTest.Response.ResponseOp", + "tsptest.response.ResponseClient.beginLroInvalidPollResponse": "TspTest.Response.ResponseOp.lroInvalidPollResponse", + "tsptest.response.ResponseClient.beginLroInvalidPollResponseWithModel": "TspTest.Response.ResponseOp.lroInvalidPollResponse", + "tsptest.response.ResponseClient.beginLroInvalidResult": "TspTest.Response.ResponseOp.lroInvalidResult", + "tsptest.response.ResponseClient.beginLroInvalidResultWithModel": "TspTest.Response.ResponseOp.lroInvalidResult", + "tsptest.response.ResponseClient.createWithHeaders": "TspTest.Response.ResponseOp.createWithHeaders", + "tsptest.response.ResponseClient.createWithHeadersWithResponse": "TspTest.Response.ResponseOp.createWithHeaders", + "tsptest.response.ResponseClient.deleteWithHeaders": "TspTest.Response.ResponseOp.deleteWithHeaders", + "tsptest.response.ResponseClient.deleteWithHeadersWithResponse": "TspTest.Response.ResponseOp.deleteWithHeaders", + "tsptest.response.ResponseClient.exists": "TspTest.Response.ResponseOp.exists", + "tsptest.response.ResponseClient.existsWithResponse": "TspTest.Response.ResponseOp.exists", + "tsptest.response.ResponseClient.getAnotherArray": "TspTest.Response.ResponseOp.getAnotherArray", + "tsptest.response.ResponseClient.getAnotherArrayWithResponse": "TspTest.Response.ResponseOp.getAnotherArray", + "tsptest.response.ResponseClient.getArray": "TspTest.Response.ResponseOp.getArray", + "tsptest.response.ResponseClient.getArrayWithResponse": "TspTest.Response.ResponseOp.getArray", + "tsptest.response.ResponseClient.getBinary": "TspTest.Response.ResponseOp.getBinary", + "tsptest.response.ResponseClient.getBinaryWithResponse": "TspTest.Response.ResponseOp.getBinary", + "tsptest.response.ResponseClient.getJsonUtf8Response": "TspTest.Response.ResponseOp.getJsonUtf8Response", + "tsptest.response.ResponseClient.getJsonUtf8ResponseWithResponse": "TspTest.Response.ResponseOp.getJsonUtf8Response", + "tsptest.response.ResponseClient.getPlusJsonResponse": "TspTest.Response.ResponseOp.getPlusJsonResponse", + "tsptest.response.ResponseClient.getPlusJsonResponseWithResponse": "TspTest.Response.ResponseOp.getPlusJsonResponse", + "tsptest.response.ResponseClient.getTextBoolean": "TspTest.Response.ResponseOp.getTextBoolean", + "tsptest.response.ResponseClient.getTextBooleanWithResponse": "TspTest.Response.ResponseOp.getTextBoolean", + "tsptest.response.ResponseClient.getTextByte": "TspTest.Response.ResponseOp.getTextByte", + "tsptest.response.ResponseClient.getTextByteWithResponse": "TspTest.Response.ResponseOp.getTextByte", + "tsptest.response.ResponseClient.getTextChar": "TspTest.Response.ResponseOp.getTextChar", + "tsptest.response.ResponseClient.getTextCharWithResponse": "TspTest.Response.ResponseOp.getTextChar", + "tsptest.response.ResponseClient.getTextFloat32": "TspTest.Response.ResponseOp.getTextFloat32", + "tsptest.response.ResponseClient.getTextFloat32WithResponse": "TspTest.Response.ResponseOp.getTextFloat32", + "tsptest.response.ResponseClient.getTextFloat64": "TspTest.Response.ResponseOp.getTextFloat64", + "tsptest.response.ResponseClient.getTextFloat64WithResponse": "TspTest.Response.ResponseOp.getTextFloat64", + "tsptest.response.ResponseClient.getTextInt32": "TspTest.Response.ResponseOp.getTextInt32", + "tsptest.response.ResponseClient.getTextInt32WithResponse": "TspTest.Response.ResponseOp.getTextInt32", + "tsptest.response.ResponseClient.getTextInt64": "TspTest.Response.ResponseOp.getTextInt64", + "tsptest.response.ResponseClient.getTextInt64WithResponse": "TspTest.Response.ResponseOp.getTextInt64", + "tsptest.response.ResponseClient.getUnionResponse": "TspTest.Response.ResponseOp.getUnionResponse", + "tsptest.response.ResponseClient.getUnionResponseWithResponse": "TspTest.Response.ResponseOp.getUnionResponse", + "tsptest.response.ResponseClient.listIntegers": "TspTest.Response.ResponseOp.listIntegers", + "tsptest.response.ResponseClient.listStrings": "TspTest.Response.ResponseOp.listStrings", + "tsptest.response.ResponseClientBuilder": "TspTest.Response.ResponseOp", + "tsptest.response.models.OperationDetails1": "TspTest.Response.OperationDetails1", + "tsptest.response.models.OperationDetails2": "TspTest.Response.OperationDetails2", + "tsptest.response.models.OperationState": "Azure.Core.Foundations.OperationState", + "tsptest.response.models.Resource": "TspTest.Response.Resource" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_metadata.json new file mode 100644 index 00000000000..0710c8eb04e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-response_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-06-01-preview","crossLanguageDefinitions":{"tsptest.response.ResponseAsyncClient":"TspTest.Response.ResponseOp","tsptest.response.ResponseAsyncClient.beginLroInvalidPollResponse":"TspTest.Response.ResponseOp.lroInvalidPollResponse","tsptest.response.ResponseAsyncClient.beginLroInvalidPollResponseWithModel":"TspTest.Response.ResponseOp.lroInvalidPollResponse","tsptest.response.ResponseAsyncClient.beginLroInvalidResult":"TspTest.Response.ResponseOp.lroInvalidResult","tsptest.response.ResponseAsyncClient.beginLroInvalidResultWithModel":"TspTest.Response.ResponseOp.lroInvalidResult","tsptest.response.ResponseAsyncClient.createWithHeaders":"TspTest.Response.ResponseOp.createWithHeaders","tsptest.response.ResponseAsyncClient.createWithHeadersWithResponse":"TspTest.Response.ResponseOp.createWithHeaders","tsptest.response.ResponseAsyncClient.deleteWithHeaders":"TspTest.Response.ResponseOp.deleteWithHeaders","tsptest.response.ResponseAsyncClient.deleteWithHeadersWithResponse":"TspTest.Response.ResponseOp.deleteWithHeaders","tsptest.response.ResponseAsyncClient.exists":"TspTest.Response.ResponseOp.exists","tsptest.response.ResponseAsyncClient.existsWithResponse":"TspTest.Response.ResponseOp.exists","tsptest.response.ResponseAsyncClient.getAnotherArray":"TspTest.Response.ResponseOp.getAnotherArray","tsptest.response.ResponseAsyncClient.getAnotherArrayWithResponse":"TspTest.Response.ResponseOp.getAnotherArray","tsptest.response.ResponseAsyncClient.getArray":"TspTest.Response.ResponseOp.getArray","tsptest.response.ResponseAsyncClient.getArrayWithResponse":"TspTest.Response.ResponseOp.getArray","tsptest.response.ResponseAsyncClient.getBinary":"TspTest.Response.ResponseOp.getBinary","tsptest.response.ResponseAsyncClient.getBinaryWithResponse":"TspTest.Response.ResponseOp.getBinary","tsptest.response.ResponseAsyncClient.getJsonUtf8Response":"TspTest.Response.ResponseOp.getJsonUtf8Response","tsptest.response.ResponseAsyncClient.getJsonUtf8ResponseWithResponse":"TspTest.Response.ResponseOp.getJsonUtf8Response","tsptest.response.ResponseAsyncClient.getPlusJsonResponse":"TspTest.Response.ResponseOp.getPlusJsonResponse","tsptest.response.ResponseAsyncClient.getPlusJsonResponseWithResponse":"TspTest.Response.ResponseOp.getPlusJsonResponse","tsptest.response.ResponseAsyncClient.getTextBoolean":"TspTest.Response.ResponseOp.getTextBoolean","tsptest.response.ResponseAsyncClient.getTextBooleanWithResponse":"TspTest.Response.ResponseOp.getTextBoolean","tsptest.response.ResponseAsyncClient.getTextByte":"TspTest.Response.ResponseOp.getTextByte","tsptest.response.ResponseAsyncClient.getTextByteWithResponse":"TspTest.Response.ResponseOp.getTextByte","tsptest.response.ResponseAsyncClient.getTextChar":"TspTest.Response.ResponseOp.getTextChar","tsptest.response.ResponseAsyncClient.getTextCharWithResponse":"TspTest.Response.ResponseOp.getTextChar","tsptest.response.ResponseAsyncClient.getTextFloat32":"TspTest.Response.ResponseOp.getTextFloat32","tsptest.response.ResponseAsyncClient.getTextFloat32WithResponse":"TspTest.Response.ResponseOp.getTextFloat32","tsptest.response.ResponseAsyncClient.getTextFloat64":"TspTest.Response.ResponseOp.getTextFloat64","tsptest.response.ResponseAsyncClient.getTextFloat64WithResponse":"TspTest.Response.ResponseOp.getTextFloat64","tsptest.response.ResponseAsyncClient.getTextInt32":"TspTest.Response.ResponseOp.getTextInt32","tsptest.response.ResponseAsyncClient.getTextInt32WithResponse":"TspTest.Response.ResponseOp.getTextInt32","tsptest.response.ResponseAsyncClient.getTextInt64":"TspTest.Response.ResponseOp.getTextInt64","tsptest.response.ResponseAsyncClient.getTextInt64WithResponse":"TspTest.Response.ResponseOp.getTextInt64","tsptest.response.ResponseAsyncClient.getUnionResponse":"TspTest.Response.ResponseOp.getUnionResponse","tsptest.response.ResponseAsyncClient.getUnionResponseWithResponse":"TspTest.Response.ResponseOp.getUnionResponse","tsptest.response.ResponseAsyncClient.listIntegers":"TspTest.Response.ResponseOp.listIntegers","tsptest.response.ResponseAsyncClient.listStrings":"TspTest.Response.ResponseOp.listStrings","tsptest.response.ResponseClient":"TspTest.Response.ResponseOp","tsptest.response.ResponseClient.beginLroInvalidPollResponse":"TspTest.Response.ResponseOp.lroInvalidPollResponse","tsptest.response.ResponseClient.beginLroInvalidPollResponseWithModel":"TspTest.Response.ResponseOp.lroInvalidPollResponse","tsptest.response.ResponseClient.beginLroInvalidResult":"TspTest.Response.ResponseOp.lroInvalidResult","tsptest.response.ResponseClient.beginLroInvalidResultWithModel":"TspTest.Response.ResponseOp.lroInvalidResult","tsptest.response.ResponseClient.createWithHeaders":"TspTest.Response.ResponseOp.createWithHeaders","tsptest.response.ResponseClient.createWithHeadersWithResponse":"TspTest.Response.ResponseOp.createWithHeaders","tsptest.response.ResponseClient.deleteWithHeaders":"TspTest.Response.ResponseOp.deleteWithHeaders","tsptest.response.ResponseClient.deleteWithHeadersWithResponse":"TspTest.Response.ResponseOp.deleteWithHeaders","tsptest.response.ResponseClient.exists":"TspTest.Response.ResponseOp.exists","tsptest.response.ResponseClient.existsWithResponse":"TspTest.Response.ResponseOp.exists","tsptest.response.ResponseClient.getAnotherArray":"TspTest.Response.ResponseOp.getAnotherArray","tsptest.response.ResponseClient.getAnotherArrayWithResponse":"TspTest.Response.ResponseOp.getAnotherArray","tsptest.response.ResponseClient.getArray":"TspTest.Response.ResponseOp.getArray","tsptest.response.ResponseClient.getArrayWithResponse":"TspTest.Response.ResponseOp.getArray","tsptest.response.ResponseClient.getBinary":"TspTest.Response.ResponseOp.getBinary","tsptest.response.ResponseClient.getBinaryWithResponse":"TspTest.Response.ResponseOp.getBinary","tsptest.response.ResponseClient.getJsonUtf8Response":"TspTest.Response.ResponseOp.getJsonUtf8Response","tsptest.response.ResponseClient.getJsonUtf8ResponseWithResponse":"TspTest.Response.ResponseOp.getJsonUtf8Response","tsptest.response.ResponseClient.getPlusJsonResponse":"TspTest.Response.ResponseOp.getPlusJsonResponse","tsptest.response.ResponseClient.getPlusJsonResponseWithResponse":"TspTest.Response.ResponseOp.getPlusJsonResponse","tsptest.response.ResponseClient.getTextBoolean":"TspTest.Response.ResponseOp.getTextBoolean","tsptest.response.ResponseClient.getTextBooleanWithResponse":"TspTest.Response.ResponseOp.getTextBoolean","tsptest.response.ResponseClient.getTextByte":"TspTest.Response.ResponseOp.getTextByte","tsptest.response.ResponseClient.getTextByteWithResponse":"TspTest.Response.ResponseOp.getTextByte","tsptest.response.ResponseClient.getTextChar":"TspTest.Response.ResponseOp.getTextChar","tsptest.response.ResponseClient.getTextCharWithResponse":"TspTest.Response.ResponseOp.getTextChar","tsptest.response.ResponseClient.getTextFloat32":"TspTest.Response.ResponseOp.getTextFloat32","tsptest.response.ResponseClient.getTextFloat32WithResponse":"TspTest.Response.ResponseOp.getTextFloat32","tsptest.response.ResponseClient.getTextFloat64":"TspTest.Response.ResponseOp.getTextFloat64","tsptest.response.ResponseClient.getTextFloat64WithResponse":"TspTest.Response.ResponseOp.getTextFloat64","tsptest.response.ResponseClient.getTextInt32":"TspTest.Response.ResponseOp.getTextInt32","tsptest.response.ResponseClient.getTextInt32WithResponse":"TspTest.Response.ResponseOp.getTextInt32","tsptest.response.ResponseClient.getTextInt64":"TspTest.Response.ResponseOp.getTextInt64","tsptest.response.ResponseClient.getTextInt64WithResponse":"TspTest.Response.ResponseOp.getTextInt64","tsptest.response.ResponseClient.getUnionResponse":"TspTest.Response.ResponseOp.getUnionResponse","tsptest.response.ResponseClient.getUnionResponseWithResponse":"TspTest.Response.ResponseOp.getUnionResponse","tsptest.response.ResponseClient.listIntegers":"TspTest.Response.ResponseOp.listIntegers","tsptest.response.ResponseClient.listStrings":"TspTest.Response.ResponseOp.listStrings","tsptest.response.ResponseClientBuilder":"TspTest.Response.ResponseOp","tsptest.response.models.OperationDetails1":"TspTest.Response.OperationDetails1","tsptest.response.models.OperationDetails2":"TspTest.Response.OperationDetails2","tsptest.response.models.OperationState":"Azure.Core.Foundations.OperationState","tsptest.response.models.Resource":"TspTest.Response.Resource"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/response/ResponseAsyncClient.java","src/main/java/tsptest/response/ResponseClient.java","src/main/java/tsptest/response/ResponseClientBuilder.java","src/main/java/tsptest/response/ResponseServiceVersion.java","src/main/java/tsptest/response/implementation/OperationLocationPollingStrategy.java","src/main/java/tsptest/response/implementation/PollingUtils.java","src/main/java/tsptest/response/implementation/ResponseClientImpl.java","src/main/java/tsptest/response/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/tsptest/response/implementation/package-info.java","src/main/java/tsptest/response/models/OperationDetails1.java","src/main/java/tsptest/response/models/OperationDetails2.java","src/main/java/tsptest/response/models/OperationState.java","src/main/java/tsptest/response/models/Resource.java","src/main/java/tsptest/response/models/package-info.java","src/main/java/tsptest/response/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_apiview_properties.json new file mode 100644 index 00000000000..466eacde758 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_apiview_properties.json @@ -0,0 +1,14 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.specialchars.SpecialCharsAsyncClient": "TspTest.SpecialChars.BuiltinOp", + "tsptest.specialchars.SpecialCharsAsyncClient.read": "TspTest.SpecialChars.BuiltinOp.read", + "tsptest.specialchars.SpecialCharsAsyncClient.readWithResponse": "TspTest.SpecialChars.BuiltinOp.read", + "tsptest.specialchars.SpecialCharsClient": "TspTest.SpecialChars.BuiltinOp", + "tsptest.specialchars.SpecialCharsClient.read": "TspTest.SpecialChars.BuiltinOp.read", + "tsptest.specialchars.SpecialCharsClient.readWithResponse": "TspTest.SpecialChars.BuiltinOp.read", + "tsptest.specialchars.SpecialCharsClientBuilder": "TspTest.SpecialChars", + "tsptest.specialchars.implementation.models.ReadRequest": "TspTest.SpecialChars.read.Request.anonymous", + "tsptest.specialchars.models.Resource": "TspTest.SpecialChars.Resource" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_metadata.json new file mode 100644 index 00000000000..06830ca0c57 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialchars_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.specialchars.SpecialCharsAsyncClient":"TspTest.SpecialChars.BuiltinOp","tsptest.specialchars.SpecialCharsAsyncClient.read":"TspTest.SpecialChars.BuiltinOp.read","tsptest.specialchars.SpecialCharsAsyncClient.readWithResponse":"TspTest.SpecialChars.BuiltinOp.read","tsptest.specialchars.SpecialCharsClient":"TspTest.SpecialChars.BuiltinOp","tsptest.specialchars.SpecialCharsClient.read":"TspTest.SpecialChars.BuiltinOp.read","tsptest.specialchars.SpecialCharsClient.readWithResponse":"TspTest.SpecialChars.BuiltinOp.read","tsptest.specialchars.SpecialCharsClientBuilder":"TspTest.SpecialChars","tsptest.specialchars.implementation.models.ReadRequest":"TspTest.SpecialChars.read.Request.anonymous","tsptest.specialchars.models.Resource":"TspTest.SpecialChars.Resource"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/specialchars/SpecialCharsAsyncClient.java","src/main/java/tsptest/specialchars/SpecialCharsClient.java","src/main/java/tsptest/specialchars/SpecialCharsClientBuilder.java","src/main/java/tsptest/specialchars/implementation/BuiltinOpsImpl.java","src/main/java/tsptest/specialchars/implementation/SpecialCharsClientImpl.java","src/main/java/tsptest/specialchars/implementation/models/ReadRequest.java","src/main/java/tsptest/specialchars/implementation/models/package-info.java","src/main/java/tsptest/specialchars/implementation/package-info.java","src/main/java/tsptest/specialchars/models/Resource.java","src/main/java/tsptest/specialchars/models/package-info.java","src/main/java/tsptest/specialchars/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_apiview_properties.json new file mode 100644 index 00000000000..7b25f95aa3d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_apiview_properties.json @@ -0,0 +1,49 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.specialheaders.EtagHeadersAsyncClient": "TspTest.SpecialHeaders.EtagHeaders", + "tsptest.specialheaders.EtagHeadersAsyncClient.listWithEtag": "TspTest.SpecialHeaders.EtagHeaders.listWithEtag", + "tsptest.specialheaders.EtagHeadersAsyncClient.patchWithMatchHeaders": "TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders", + "tsptest.specialheaders.EtagHeadersAsyncClient.patchWithMatchHeadersWithResponse": "TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders", + "tsptest.specialheaders.EtagHeadersAsyncClient.putWithRequestHeaders": "TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders", + "tsptest.specialheaders.EtagHeadersAsyncClient.putWithRequestHeadersWithResponse": "TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders", + "tsptest.specialheaders.EtagHeadersClient": "TspTest.SpecialHeaders.EtagHeaders", + "tsptest.specialheaders.EtagHeadersClient.listWithEtag": "TspTest.SpecialHeaders.EtagHeaders.listWithEtag", + "tsptest.specialheaders.EtagHeadersClient.patchWithMatchHeaders": "TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders", + "tsptest.specialheaders.EtagHeadersClient.patchWithMatchHeadersWithResponse": "TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders", + "tsptest.specialheaders.EtagHeadersClient.putWithRequestHeaders": "TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders", + "tsptest.specialheaders.EtagHeadersClient.putWithRequestHeadersWithResponse": "TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders", + "tsptest.specialheaders.EtagHeadersOptionalBodyAsyncClient": "TspTest.SpecialHeaders.EtagHeadersOptionalBody", + "tsptest.specialheaders.EtagHeadersOptionalBodyAsyncClient.putWithOptionalBody": "TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody", + "tsptest.specialheaders.EtagHeadersOptionalBodyAsyncClient.putWithOptionalBodyWithResponse": "TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody", + "tsptest.specialheaders.EtagHeadersOptionalBodyClient": "TspTest.SpecialHeaders.EtagHeadersOptionalBody", + "tsptest.specialheaders.EtagHeadersOptionalBodyClient.putWithOptionalBody": "TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody", + "tsptest.specialheaders.EtagHeadersOptionalBodyClient.putWithOptionalBodyWithResponse": "TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody", + "tsptest.specialheaders.RepeatabilityHeadersAsyncClient": "TspTest.SpecialHeaders.RepeatabilityHeaders", + "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.beginCreateLro": "TspTest.SpecialHeaders.RepeatabilityHeaders.createLro", + "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.beginCreateLroWithModel": "TspTest.SpecialHeaders.RepeatabilityHeaders.createLro", + "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.get": "TspTest.SpecialHeaders.RepeatabilityHeaders.get", + "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.getWithResponse": "TspTest.SpecialHeaders.RepeatabilityHeaders.get", + "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.post": "TspTest.SpecialHeaders.RepeatabilityHeaders.post", + "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.postWithResponse": "TspTest.SpecialHeaders.RepeatabilityHeaders.post", + "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.put": "TspTest.SpecialHeaders.RepeatabilityHeaders.put", + "tsptest.specialheaders.RepeatabilityHeadersAsyncClient.putWithResponse": "TspTest.SpecialHeaders.RepeatabilityHeaders.put", + "tsptest.specialheaders.RepeatabilityHeadersClient": "TspTest.SpecialHeaders.RepeatabilityHeaders", + "tsptest.specialheaders.RepeatabilityHeadersClient.beginCreateLro": "TspTest.SpecialHeaders.RepeatabilityHeaders.createLro", + "tsptest.specialheaders.RepeatabilityHeadersClient.beginCreateLroWithModel": "TspTest.SpecialHeaders.RepeatabilityHeaders.createLro", + "tsptest.specialheaders.RepeatabilityHeadersClient.get": "TspTest.SpecialHeaders.RepeatabilityHeaders.get", + "tsptest.specialheaders.RepeatabilityHeadersClient.getWithResponse": "TspTest.SpecialHeaders.RepeatabilityHeaders.get", + "tsptest.specialheaders.RepeatabilityHeadersClient.post": "TspTest.SpecialHeaders.RepeatabilityHeaders.post", + "tsptest.specialheaders.RepeatabilityHeadersClient.postWithResponse": "TspTest.SpecialHeaders.RepeatabilityHeaders.post", + "tsptest.specialheaders.RepeatabilityHeadersClient.put": "TspTest.SpecialHeaders.RepeatabilityHeaders.put", + "tsptest.specialheaders.RepeatabilityHeadersClient.putWithResponse": "TspTest.SpecialHeaders.RepeatabilityHeaders.put", + "tsptest.specialheaders.SkipSpecialHeadersAsyncClient": "TspTest.SpecialHeaders.SkipSpecialHeaders", + "tsptest.specialheaders.SkipSpecialHeadersAsyncClient.deleteWithSpecialHeaders": "TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders", + "tsptest.specialheaders.SkipSpecialHeadersAsyncClient.deleteWithSpecialHeadersWithResponse": "TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders", + "tsptest.specialheaders.SkipSpecialHeadersClient": "TspTest.SpecialHeaders.SkipSpecialHeaders", + "tsptest.specialheaders.SkipSpecialHeadersClient.deleteWithSpecialHeaders": "TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders", + "tsptest.specialheaders.SkipSpecialHeadersClient.deleteWithSpecialHeadersWithResponse": "TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders", + "tsptest.specialheaders.SpecialHeadersClientBuilder": "TspTest.SpecialHeaders", + "tsptest.specialheaders.models.Resource": "TspTest.SpecialHeaders.Resource" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_metadata.json new file mode 100644 index 00000000000..c9ff49456bb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-specialheaders_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-06-01-preview","crossLanguageDefinitions":{"tsptest.specialheaders.EtagHeadersAsyncClient":"TspTest.SpecialHeaders.EtagHeaders","tsptest.specialheaders.EtagHeadersAsyncClient.listWithEtag":"TspTest.SpecialHeaders.EtagHeaders.listWithEtag","tsptest.specialheaders.EtagHeadersAsyncClient.patchWithMatchHeaders":"TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders","tsptest.specialheaders.EtagHeadersAsyncClient.patchWithMatchHeadersWithResponse":"TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders","tsptest.specialheaders.EtagHeadersAsyncClient.putWithRequestHeaders":"TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders","tsptest.specialheaders.EtagHeadersAsyncClient.putWithRequestHeadersWithResponse":"TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders","tsptest.specialheaders.EtagHeadersClient":"TspTest.SpecialHeaders.EtagHeaders","tsptest.specialheaders.EtagHeadersClient.listWithEtag":"TspTest.SpecialHeaders.EtagHeaders.listWithEtag","tsptest.specialheaders.EtagHeadersClient.patchWithMatchHeaders":"TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders","tsptest.specialheaders.EtagHeadersClient.patchWithMatchHeadersWithResponse":"TspTest.SpecialHeaders.EtagHeaders.patchWithMatchHeaders","tsptest.specialheaders.EtagHeadersClient.putWithRequestHeaders":"TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders","tsptest.specialheaders.EtagHeadersClient.putWithRequestHeadersWithResponse":"TspTest.SpecialHeaders.EtagHeaders.putWithRequestHeaders","tsptest.specialheaders.EtagHeadersOptionalBodyAsyncClient":"TspTest.SpecialHeaders.EtagHeadersOptionalBody","tsptest.specialheaders.EtagHeadersOptionalBodyAsyncClient.putWithOptionalBody":"TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody","tsptest.specialheaders.EtagHeadersOptionalBodyAsyncClient.putWithOptionalBodyWithResponse":"TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody","tsptest.specialheaders.EtagHeadersOptionalBodyClient":"TspTest.SpecialHeaders.EtagHeadersOptionalBody","tsptest.specialheaders.EtagHeadersOptionalBodyClient.putWithOptionalBody":"TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody","tsptest.specialheaders.EtagHeadersOptionalBodyClient.putWithOptionalBodyWithResponse":"TspTest.SpecialHeaders.EtagHeadersOptionalBody.putWithOptionalBody","tsptest.specialheaders.RepeatabilityHeadersAsyncClient":"TspTest.SpecialHeaders.RepeatabilityHeaders","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.beginCreateLro":"TspTest.SpecialHeaders.RepeatabilityHeaders.createLro","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.beginCreateLroWithModel":"TspTest.SpecialHeaders.RepeatabilityHeaders.createLro","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.get":"TspTest.SpecialHeaders.RepeatabilityHeaders.get","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.getWithResponse":"TspTest.SpecialHeaders.RepeatabilityHeaders.get","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.post":"TspTest.SpecialHeaders.RepeatabilityHeaders.post","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.postWithResponse":"TspTest.SpecialHeaders.RepeatabilityHeaders.post","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.put":"TspTest.SpecialHeaders.RepeatabilityHeaders.put","tsptest.specialheaders.RepeatabilityHeadersAsyncClient.putWithResponse":"TspTest.SpecialHeaders.RepeatabilityHeaders.put","tsptest.specialheaders.RepeatabilityHeadersClient":"TspTest.SpecialHeaders.RepeatabilityHeaders","tsptest.specialheaders.RepeatabilityHeadersClient.beginCreateLro":"TspTest.SpecialHeaders.RepeatabilityHeaders.createLro","tsptest.specialheaders.RepeatabilityHeadersClient.beginCreateLroWithModel":"TspTest.SpecialHeaders.RepeatabilityHeaders.createLro","tsptest.specialheaders.RepeatabilityHeadersClient.get":"TspTest.SpecialHeaders.RepeatabilityHeaders.get","tsptest.specialheaders.RepeatabilityHeadersClient.getWithResponse":"TspTest.SpecialHeaders.RepeatabilityHeaders.get","tsptest.specialheaders.RepeatabilityHeadersClient.post":"TspTest.SpecialHeaders.RepeatabilityHeaders.post","tsptest.specialheaders.RepeatabilityHeadersClient.postWithResponse":"TspTest.SpecialHeaders.RepeatabilityHeaders.post","tsptest.specialheaders.RepeatabilityHeadersClient.put":"TspTest.SpecialHeaders.RepeatabilityHeaders.put","tsptest.specialheaders.RepeatabilityHeadersClient.putWithResponse":"TspTest.SpecialHeaders.RepeatabilityHeaders.put","tsptest.specialheaders.SkipSpecialHeadersAsyncClient":"TspTest.SpecialHeaders.SkipSpecialHeaders","tsptest.specialheaders.SkipSpecialHeadersAsyncClient.deleteWithSpecialHeaders":"TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders","tsptest.specialheaders.SkipSpecialHeadersAsyncClient.deleteWithSpecialHeadersWithResponse":"TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders","tsptest.specialheaders.SkipSpecialHeadersClient":"TspTest.SpecialHeaders.SkipSpecialHeaders","tsptest.specialheaders.SkipSpecialHeadersClient.deleteWithSpecialHeaders":"TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders","tsptest.specialheaders.SkipSpecialHeadersClient.deleteWithSpecialHeadersWithResponse":"TspTest.SpecialHeaders.SkipSpecialHeaders.deleteWithSpecialHeaders","tsptest.specialheaders.SpecialHeadersClientBuilder":"TspTest.SpecialHeaders","tsptest.specialheaders.models.Resource":"TspTest.SpecialHeaders.Resource"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/specialheaders/EtagHeadersAsyncClient.java","src/main/java/tsptest/specialheaders/EtagHeadersClient.java","src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyAsyncClient.java","src/main/java/tsptest/specialheaders/EtagHeadersOptionalBodyClient.java","src/main/java/tsptest/specialheaders/RepeatabilityHeadersAsyncClient.java","src/main/java/tsptest/specialheaders/RepeatabilityHeadersClient.java","src/main/java/tsptest/specialheaders/SkipSpecialHeadersAsyncClient.java","src/main/java/tsptest/specialheaders/SkipSpecialHeadersClient.java","src/main/java/tsptest/specialheaders/SpecialHeadersClientBuilder.java","src/main/java/tsptest/specialheaders/SpecialHeadersServiceVersion.java","src/main/java/tsptest/specialheaders/implementation/EtagHeadersImpl.java","src/main/java/tsptest/specialheaders/implementation/EtagHeadersOptionalBodiesImpl.java","src/main/java/tsptest/specialheaders/implementation/JsonMergePatchHelper.java","src/main/java/tsptest/specialheaders/implementation/OperationLocationPollingStrategy.java","src/main/java/tsptest/specialheaders/implementation/PollingUtils.java","src/main/java/tsptest/specialheaders/implementation/RepeatabilityHeadersImpl.java","src/main/java/tsptest/specialheaders/implementation/SkipSpecialHeadersImpl.java","src/main/java/tsptest/specialheaders/implementation/SpecialHeadersClientImpl.java","src/main/java/tsptest/specialheaders/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/tsptest/specialheaders/implementation/package-info.java","src/main/java/tsptest/specialheaders/models/Resource.java","src/main/java/tsptest/specialheaders/models/package-info.java","src/main/java/tsptest/specialheaders/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_apiview_properties.json new file mode 100644 index 00000000000..e4eb8cba216 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_apiview_properties.json @@ -0,0 +1,19 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.subclass.SubclassAsyncClient": "TspTest.Subclass.Subclass", + "tsptest.subclass.SubclassAsyncClient.propertyInSubclass": "TspTest.Subclass.Subclass.propertyInSubclass", + "tsptest.subclass.SubclassAsyncClient.propertyInSubclassWithResponse": "TspTest.Subclass.Subclass.propertyInSubclass", + "tsptest.subclass.SubclassClient": "TspTest.Subclass.Subclass", + "tsptest.subclass.SubclassClient.propertyInSubclass": "TspTest.Subclass.Subclass.propertyInSubclass", + "tsptest.subclass.SubclassClient.propertyInSubclassWithResponse": "TspTest.Subclass.Subclass.propertyInSubclass", + "tsptest.subclass.SubclassClientBuilder": "TspTest.Subclass", + "tsptest.subclass.models.Body": "TspTest.Subclass.Body", + "tsptest.subclass.models.DuplicateRequiredProperty": "TspTest.Subclass.DuplicateRequiredProperty", + "tsptest.subclass.models.DuplicateRequiredPropertyParent": "TspTest.Subclass.DuplicateRequiredPropertyParent", + "tsptest.subclass.models.PropertyChangedToConstant": "TspTest.Subclass.PropertyChangedToConstant", + "tsptest.subclass.models.PropertyChangedToConstantParent": "TspTest.Subclass.PropertyChangedToConstantParent", + "tsptest.subclass.models.PropertyChangedToRequired": "TspTest.Subclass.PropertyChangedToRequired", + "tsptest.subclass.models.PropertyChangedToRequiredParent": "TspTest.Subclass.PropertyChangedToRequiredParent" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_metadata.json new file mode 100644 index 00000000000..2ad8bd225c0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-subclass_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.subclass.SubclassAsyncClient":"TspTest.Subclass.Subclass","tsptest.subclass.SubclassAsyncClient.propertyInSubclass":"TspTest.Subclass.Subclass.propertyInSubclass","tsptest.subclass.SubclassAsyncClient.propertyInSubclassWithResponse":"TspTest.Subclass.Subclass.propertyInSubclass","tsptest.subclass.SubclassClient":"TspTest.Subclass.Subclass","tsptest.subclass.SubclassClient.propertyInSubclass":"TspTest.Subclass.Subclass.propertyInSubclass","tsptest.subclass.SubclassClient.propertyInSubclassWithResponse":"TspTest.Subclass.Subclass.propertyInSubclass","tsptest.subclass.SubclassClientBuilder":"TspTest.Subclass","tsptest.subclass.models.Body":"TspTest.Subclass.Body","tsptest.subclass.models.DuplicateRequiredProperty":"TspTest.Subclass.DuplicateRequiredProperty","tsptest.subclass.models.DuplicateRequiredPropertyParent":"TspTest.Subclass.DuplicateRequiredPropertyParent","tsptest.subclass.models.PropertyChangedToConstant":"TspTest.Subclass.PropertyChangedToConstant","tsptest.subclass.models.PropertyChangedToConstantParent":"TspTest.Subclass.PropertyChangedToConstantParent","tsptest.subclass.models.PropertyChangedToRequired":"TspTest.Subclass.PropertyChangedToRequired","tsptest.subclass.models.PropertyChangedToRequiredParent":"TspTest.Subclass.PropertyChangedToRequiredParent"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/subclass/SubclassAsyncClient.java","src/main/java/tsptest/subclass/SubclassClient.java","src/main/java/tsptest/subclass/SubclassClientBuilder.java","src/main/java/tsptest/subclass/implementation/SubclassClientImpl.java","src/main/java/tsptest/subclass/implementation/SubclassImpl.java","src/main/java/tsptest/subclass/implementation/package-info.java","src/main/java/tsptest/subclass/models/Body.java","src/main/java/tsptest/subclass/models/DuplicateRequiredProperty.java","src/main/java/tsptest/subclass/models/DuplicateRequiredPropertyParent.java","src/main/java/tsptest/subclass/models/PropertyChangedToConstant.java","src/main/java/tsptest/subclass/models/PropertyChangedToConstantParent.java","src/main/java/tsptest/subclass/models/PropertyChangedToRequired.java","src/main/java/tsptest/subclass/models/PropertyChangedToRequiredParent.java","src/main/java/tsptest/subclass/models/package-info.java","src/main/java/tsptest/subclass/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_apiview_properties.json new file mode 100644 index 00000000000..14a7ce16492 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_apiview_properties.json @@ -0,0 +1,31 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.union.UnionAsyncClient": "TspTest.Union.UnionFlattenOp", + "tsptest.union.UnionAsyncClient.beginGenerate": "TspTest.Union.UnionFlattenOp.generate", + "tsptest.union.UnionAsyncClient.beginGenerateWithModel": "TspTest.Union.UnionFlattenOp.generate", + "tsptest.union.UnionAsyncClient.get": "TspTest.Union.UnionFlattenOp.get", + "tsptest.union.UnionAsyncClient.getWithResponse": "TspTest.Union.UnionFlattenOp.get", + "tsptest.union.UnionAsyncClient.send": "TspTest.Union.UnionFlattenOp.send", + "tsptest.union.UnionAsyncClient.sendLong": "TspTest.Union.UnionFlattenOp.sendLong", + "tsptest.union.UnionAsyncClient.sendLongWithResponse": "TspTest.Union.UnionFlattenOp.sendLong", + "tsptest.union.UnionAsyncClient.sendWithResponse": "TspTest.Union.UnionFlattenOp.send", + "tsptest.union.UnionClient": "TspTest.Union.UnionFlattenOp", + "tsptest.union.UnionClient.beginGenerate": "TspTest.Union.UnionFlattenOp.generate", + "tsptest.union.UnionClient.beginGenerateWithModel": "TspTest.Union.UnionFlattenOp.generate", + "tsptest.union.UnionClient.get": "TspTest.Union.UnionFlattenOp.get", + "tsptest.union.UnionClient.getWithResponse": "TspTest.Union.UnionFlattenOp.get", + "tsptest.union.UnionClient.send": "TspTest.Union.UnionFlattenOp.send", + "tsptest.union.UnionClient.sendLong": "TspTest.Union.UnionFlattenOp.sendLong", + "tsptest.union.UnionClient.sendLongWithResponse": "TspTest.Union.UnionFlattenOp.sendLong", + "tsptest.union.UnionClient.sendWithResponse": "TspTest.Union.UnionFlattenOp.send", + "tsptest.union.UnionClientBuilder": "TspTest.Union", + "tsptest.union.implementation.models.SendLongRequest": "TspTest.Union.sendLong.Request.anonymous", + "tsptest.union.implementation.models.SendRequest": "TspTest.Union.send.Request.anonymous", + "tsptest.union.implementation.models.SubResult": "TspTest.Union.SubResult", + "tsptest.union.models.ArrayData": "TspTest.Union.ArrayData", + "tsptest.union.models.Result": "TspTest.Union.Result", + "tsptest.union.models.SendLongOptions": null, + "tsptest.union.models.User": "TspTest.Union.User" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_metadata.json new file mode 100644 index 00000000000..7a720173441 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-union_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-06-01-preview","crossLanguageDefinitions":{"tsptest.union.UnionAsyncClient":"TspTest.Union.UnionFlattenOp","tsptest.union.UnionAsyncClient.beginGenerate":"TspTest.Union.UnionFlattenOp.generate","tsptest.union.UnionAsyncClient.beginGenerateWithModel":"TspTest.Union.UnionFlattenOp.generate","tsptest.union.UnionAsyncClient.get":"TspTest.Union.UnionFlattenOp.get","tsptest.union.UnionAsyncClient.getWithResponse":"TspTest.Union.UnionFlattenOp.get","tsptest.union.UnionAsyncClient.send":"TspTest.Union.UnionFlattenOp.send","tsptest.union.UnionAsyncClient.sendLong":"TspTest.Union.UnionFlattenOp.sendLong","tsptest.union.UnionAsyncClient.sendLongWithResponse":"TspTest.Union.UnionFlattenOp.sendLong","tsptest.union.UnionAsyncClient.sendWithResponse":"TspTest.Union.UnionFlattenOp.send","tsptest.union.UnionClient":"TspTest.Union.UnionFlattenOp","tsptest.union.UnionClient.beginGenerate":"TspTest.Union.UnionFlattenOp.generate","tsptest.union.UnionClient.beginGenerateWithModel":"TspTest.Union.UnionFlattenOp.generate","tsptest.union.UnionClient.get":"TspTest.Union.UnionFlattenOp.get","tsptest.union.UnionClient.getWithResponse":"TspTest.Union.UnionFlattenOp.get","tsptest.union.UnionClient.send":"TspTest.Union.UnionFlattenOp.send","tsptest.union.UnionClient.sendLong":"TspTest.Union.UnionFlattenOp.sendLong","tsptest.union.UnionClient.sendLongWithResponse":"TspTest.Union.UnionFlattenOp.sendLong","tsptest.union.UnionClient.sendWithResponse":"TspTest.Union.UnionFlattenOp.send","tsptest.union.UnionClientBuilder":"TspTest.Union","tsptest.union.implementation.models.SendLongRequest":"TspTest.Union.sendLong.Request.anonymous","tsptest.union.implementation.models.SendRequest":"TspTest.Union.send.Request.anonymous","tsptest.union.implementation.models.SubResult":"TspTest.Union.SubResult","tsptest.union.models.ArrayData":"TspTest.Union.ArrayData","tsptest.union.models.Result":"TspTest.Union.Result","tsptest.union.models.SendLongOptions":null,"tsptest.union.models.User":"TspTest.Union.User"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/union/UnionAsyncClient.java","src/main/java/tsptest/union/UnionClient.java","src/main/java/tsptest/union/UnionClientBuilder.java","src/main/java/tsptest/union/UnionServiceVersion.java","src/main/java/tsptest/union/implementation/OperationLocationPollingStrategy.java","src/main/java/tsptest/union/implementation/PollingUtils.java","src/main/java/tsptest/union/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/tsptest/union/implementation/UnionClientImpl.java","src/main/java/tsptest/union/implementation/UnionFlattenOpsImpl.java","src/main/java/tsptest/union/implementation/models/SendLongRequest.java","src/main/java/tsptest/union/implementation/models/SendRequest.java","src/main/java/tsptest/union/implementation/models/SubResult.java","src/main/java/tsptest/union/implementation/models/package-info.java","src/main/java/tsptest/union/implementation/package-info.java","src/main/java/tsptest/union/models/ArrayData.java","src/main/java/tsptest/union/models/Result.java","src/main/java/tsptest/union/models/SendLongOptions.java","src/main/java/tsptest/union/models/User.java","src/main/java/tsptest/union/models/package-info.java","src/main/java/tsptest/union/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_apiview_properties.json new file mode 100644 index 00000000000..04355f40b29 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_apiview_properties.json @@ -0,0 +1,20 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.versioning.VersioningAsyncClient": "TspTest.Versioning.VersioningOp", + "tsptest.versioning.VersioningAsyncClient.beginCreateLongRunning": "TspTest.Versioning.VersioningOp.createLongRunning", + "tsptest.versioning.VersioningAsyncClient.beginCreateLongRunningWithModel": "TspTest.Versioning.VersioningOp.createLongRunning", + "tsptest.versioning.VersioningAsyncClient.beginExport": "TspTest.Versioning.VersioningOp.export", + "tsptest.versioning.VersioningAsyncClient.beginExportWithModel": "TspTest.Versioning.VersioningOp.export", + "tsptest.versioning.VersioningAsyncClient.list": "TspTest.Versioning.VersioningOp.list", + "tsptest.versioning.VersioningClient": "TspTest.Versioning.VersioningOp", + "tsptest.versioning.VersioningClient.beginCreateLongRunning": "TspTest.Versioning.VersioningOp.createLongRunning", + "tsptest.versioning.VersioningClient.beginCreateLongRunningWithModel": "TspTest.Versioning.VersioningOp.createLongRunning", + "tsptest.versioning.VersioningClient.beginExport": "TspTest.Versioning.VersioningOp.export", + "tsptest.versioning.VersioningClient.beginExportWithModel": "TspTest.Versioning.VersioningOp.export", + "tsptest.versioning.VersioningClient.list": "TspTest.Versioning.VersioningOp.list", + "tsptest.versioning.VersioningClientBuilder": "TspTest.Versioning", + "tsptest.versioning.models.ExportedResource": "TspTest.Versioning.ExportedResource", + "tsptest.versioning.models.Resource": "TspTest.Versioning.Resource" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_metadata.json new file mode 100644 index 00000000000..777fb73eb68 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-versioning_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"2022-09-01","crossLanguageDefinitions":{"tsptest.versioning.VersioningAsyncClient":"TspTest.Versioning.VersioningOp","tsptest.versioning.VersioningAsyncClient.beginCreateLongRunning":"TspTest.Versioning.VersioningOp.createLongRunning","tsptest.versioning.VersioningAsyncClient.beginCreateLongRunningWithModel":"TspTest.Versioning.VersioningOp.createLongRunning","tsptest.versioning.VersioningAsyncClient.beginExport":"TspTest.Versioning.VersioningOp.export","tsptest.versioning.VersioningAsyncClient.beginExportWithModel":"TspTest.Versioning.VersioningOp.export","tsptest.versioning.VersioningAsyncClient.list":"TspTest.Versioning.VersioningOp.list","tsptest.versioning.VersioningClient":"TspTest.Versioning.VersioningOp","tsptest.versioning.VersioningClient.beginCreateLongRunning":"TspTest.Versioning.VersioningOp.createLongRunning","tsptest.versioning.VersioningClient.beginCreateLongRunningWithModel":"TspTest.Versioning.VersioningOp.createLongRunning","tsptest.versioning.VersioningClient.beginExport":"TspTest.Versioning.VersioningOp.export","tsptest.versioning.VersioningClient.beginExportWithModel":"TspTest.Versioning.VersioningOp.export","tsptest.versioning.VersioningClient.list":"TspTest.Versioning.VersioningOp.list","tsptest.versioning.VersioningClientBuilder":"TspTest.Versioning","tsptest.versioning.models.ExportedResource":"TspTest.Versioning.ExportedResource","tsptest.versioning.models.Resource":"TspTest.Versioning.Resource"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/versioning/VersioningAsyncClient.java","src/main/java/tsptest/versioning/VersioningClient.java","src/main/java/tsptest/versioning/VersioningClientBuilder.java","src/main/java/tsptest/versioning/VersioningServiceVersion.java","src/main/java/tsptest/versioning/implementation/OperationLocationPollingStrategy.java","src/main/java/tsptest/versioning/implementation/PollingUtils.java","src/main/java/tsptest/versioning/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/tsptest/versioning/implementation/VersioningClientImpl.java","src/main/java/tsptest/versioning/implementation/VersioningOpsImpl.java","src/main/java/tsptest/versioning/implementation/package-info.java","src/main/java/tsptest/versioning/models/ExportedResource.java","src/main/java/tsptest/versioning/models/Resource.java","src/main/java/tsptest/versioning/models/package-info.java","src/main/java/tsptest/versioning/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_apiview_properties.json new file mode 100644 index 00000000000..ded2032de86 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_apiview_properties.json @@ -0,0 +1,40 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.visibility.VisibilityAsyncClient": "TspTest.Visibility", + "tsptest.visibility.VisibilityAsyncClient.create": "TspTest.Visibility.VisibilityOp.create", + "tsptest.visibility.VisibilityAsyncClient.createWithResponse": "TspTest.Visibility.VisibilityOp.create", + "tsptest.visibility.VisibilityAsyncClient.get": "TspTest.Visibility.VisibilityOp.get", + "tsptest.visibility.VisibilityAsyncClient.getWithResponse": "TspTest.Visibility.VisibilityOp.get", + "tsptest.visibility.VisibilityAsyncClient.query": "TspTest.Visibility.VisibilityOp.query", + "tsptest.visibility.VisibilityAsyncClient.queryWithResponse": "TspTest.Visibility.VisibilityOp.query", + "tsptest.visibility.VisibilityAsyncClient.roundtrip": "TspTest.Visibility.VisibilityOp.roundtrip", + "tsptest.visibility.VisibilityAsyncClient.roundtripWithResponse": "TspTest.Visibility.VisibilityOp.roundtrip", + "tsptest.visibility.VisibilityClient": "TspTest.Visibility", + "tsptest.visibility.VisibilityClient.create": "TspTest.Visibility.VisibilityOp.create", + "tsptest.visibility.VisibilityClient.createWithResponse": "TspTest.Visibility.VisibilityOp.create", + "tsptest.visibility.VisibilityClient.get": "TspTest.Visibility.VisibilityOp.get", + "tsptest.visibility.VisibilityClient.getWithResponse": "TspTest.Visibility.VisibilityOp.get", + "tsptest.visibility.VisibilityClient.query": "TspTest.Visibility.VisibilityOp.query", + "tsptest.visibility.VisibilityClient.queryWithResponse": "TspTest.Visibility.VisibilityOp.query", + "tsptest.visibility.VisibilityClient.roundtrip": "TspTest.Visibility.VisibilityOp.roundtrip", + "tsptest.visibility.VisibilityClient.roundtripWithResponse": "TspTest.Visibility.VisibilityOp.roundtrip", + "tsptest.visibility.VisibilityClientBuilder": "TspTest.Visibility", + "tsptest.visibility.VisibilityReadAsyncClient": "TspTest.Visibility.VisibilityRead", + "tsptest.visibility.VisibilityReadAsyncClient.get": "TspTest.Visibility.VisibilityRead.get", + "tsptest.visibility.VisibilityReadAsyncClient.getWithResponse": "TspTest.Visibility.VisibilityRead.get", + "tsptest.visibility.VisibilityReadClient": "TspTest.Visibility.VisibilityRead", + "tsptest.visibility.VisibilityReadClient.get": "TspTest.Visibility.VisibilityRead.get", + "tsptest.visibility.VisibilityReadClient.getWithResponse": "TspTest.Visibility.VisibilityRead.get", + "tsptest.visibility.VisibilityWriteAsyncClient": "TspTest.Visibility.VisibilityWrite", + "tsptest.visibility.VisibilityWriteAsyncClient.create": "TspTest.Visibility.VisibilityWrite.create", + "tsptest.visibility.VisibilityWriteAsyncClient.createWithResponse": "TspTest.Visibility.VisibilityWrite.create", + "tsptest.visibility.VisibilityWriteClient": "TspTest.Visibility.VisibilityWrite", + "tsptest.visibility.VisibilityWriteClient.create": "TspTest.Visibility.VisibilityWrite.create", + "tsptest.visibility.VisibilityWriteClient.createWithResponse": "TspTest.Visibility.VisibilityWrite.create", + "tsptest.visibility.models.Dog": "TspTest.Visibility.Dog", + "tsptest.visibility.models.ReadDog": "TspTest.Visibility.ReadDog", + "tsptest.visibility.models.RoundTripModel": "TspTest.Visibility.RoundTripModel", + "tsptest.visibility.models.WriteDog": "TspTest.Visibility.WriteDog" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_metadata.json new file mode 100644 index 00000000000..8782e235654 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-visibility_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.visibility.VisibilityAsyncClient":"TspTest.Visibility","tsptest.visibility.VisibilityAsyncClient.create":"TspTest.Visibility.VisibilityOp.create","tsptest.visibility.VisibilityAsyncClient.createWithResponse":"TspTest.Visibility.VisibilityOp.create","tsptest.visibility.VisibilityAsyncClient.get":"TspTest.Visibility.VisibilityOp.get","tsptest.visibility.VisibilityAsyncClient.getWithResponse":"TspTest.Visibility.VisibilityOp.get","tsptest.visibility.VisibilityAsyncClient.query":"TspTest.Visibility.VisibilityOp.query","tsptest.visibility.VisibilityAsyncClient.queryWithResponse":"TspTest.Visibility.VisibilityOp.query","tsptest.visibility.VisibilityAsyncClient.roundtrip":"TspTest.Visibility.VisibilityOp.roundtrip","tsptest.visibility.VisibilityAsyncClient.roundtripWithResponse":"TspTest.Visibility.VisibilityOp.roundtrip","tsptest.visibility.VisibilityClient":"TspTest.Visibility","tsptest.visibility.VisibilityClient.create":"TspTest.Visibility.VisibilityOp.create","tsptest.visibility.VisibilityClient.createWithResponse":"TspTest.Visibility.VisibilityOp.create","tsptest.visibility.VisibilityClient.get":"TspTest.Visibility.VisibilityOp.get","tsptest.visibility.VisibilityClient.getWithResponse":"TspTest.Visibility.VisibilityOp.get","tsptest.visibility.VisibilityClient.query":"TspTest.Visibility.VisibilityOp.query","tsptest.visibility.VisibilityClient.queryWithResponse":"TspTest.Visibility.VisibilityOp.query","tsptest.visibility.VisibilityClient.roundtrip":"TspTest.Visibility.VisibilityOp.roundtrip","tsptest.visibility.VisibilityClient.roundtripWithResponse":"TspTest.Visibility.VisibilityOp.roundtrip","tsptest.visibility.VisibilityClientBuilder":"TspTest.Visibility","tsptest.visibility.VisibilityReadAsyncClient":"TspTest.Visibility.VisibilityRead","tsptest.visibility.VisibilityReadAsyncClient.get":"TspTest.Visibility.VisibilityRead.get","tsptest.visibility.VisibilityReadAsyncClient.getWithResponse":"TspTest.Visibility.VisibilityRead.get","tsptest.visibility.VisibilityReadClient":"TspTest.Visibility.VisibilityRead","tsptest.visibility.VisibilityReadClient.get":"TspTest.Visibility.VisibilityRead.get","tsptest.visibility.VisibilityReadClient.getWithResponse":"TspTest.Visibility.VisibilityRead.get","tsptest.visibility.VisibilityWriteAsyncClient":"TspTest.Visibility.VisibilityWrite","tsptest.visibility.VisibilityWriteAsyncClient.create":"TspTest.Visibility.VisibilityWrite.create","tsptest.visibility.VisibilityWriteAsyncClient.createWithResponse":"TspTest.Visibility.VisibilityWrite.create","tsptest.visibility.VisibilityWriteClient":"TspTest.Visibility.VisibilityWrite","tsptest.visibility.VisibilityWriteClient.create":"TspTest.Visibility.VisibilityWrite.create","tsptest.visibility.VisibilityWriteClient.createWithResponse":"TspTest.Visibility.VisibilityWrite.create","tsptest.visibility.models.Dog":"TspTest.Visibility.Dog","tsptest.visibility.models.ReadDog":"TspTest.Visibility.ReadDog","tsptest.visibility.models.RoundTripModel":"TspTest.Visibility.RoundTripModel","tsptest.visibility.models.WriteDog":"TspTest.Visibility.WriteDog"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/visibility/VisibilityAsyncClient.java","src/main/java/tsptest/visibility/VisibilityClient.java","src/main/java/tsptest/visibility/VisibilityClientBuilder.java","src/main/java/tsptest/visibility/VisibilityReadAsyncClient.java","src/main/java/tsptest/visibility/VisibilityReadClient.java","src/main/java/tsptest/visibility/VisibilityWriteAsyncClient.java","src/main/java/tsptest/visibility/VisibilityWriteClient.java","src/main/java/tsptest/visibility/implementation/VisibilityClientImpl.java","src/main/java/tsptest/visibility/implementation/VisibilityReadsImpl.java","src/main/java/tsptest/visibility/implementation/VisibilityWritesImpl.java","src/main/java/tsptest/visibility/implementation/package-info.java","src/main/java/tsptest/visibility/models/Dog.java","src/main/java/tsptest/visibility/models/ReadDog.java","src/main/java/tsptest/visibility/models/RoundTripModel.java","src/main/java/tsptest/visibility/models/WriteDog.java","src/main/java/tsptest/visibility/models/package-info.java","src/main/java/tsptest/visibility/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_apiview_properties.json new file mode 100644 index 00000000000..05715761071 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_apiview_properties.json @@ -0,0 +1,25 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "tsptest.wiretype.WireTypeAsyncClient": "TspTest.WireType.WireTypeOp", + "tsptest.wiretype.WireTypeAsyncClient.bothClassMismatch": "TspTest.WireType.WireTypeOp.bothClassMismatch", + "tsptest.wiretype.WireTypeAsyncClient.bothClassMismatchWithResponse": "TspTest.WireType.WireTypeOp.bothClassMismatch", + "tsptest.wiretype.WireTypeAsyncClient.subClassMismatch": "TspTest.WireType.WireTypeOp.subClassMismatch", + "tsptest.wiretype.WireTypeAsyncClient.subClassMismatchWithResponse": "TspTest.WireType.WireTypeOp.subClassMismatch", + "tsptest.wiretype.WireTypeAsyncClient.superClassMismatch": "TspTest.WireType.WireTypeOp.superClassMismatch", + "tsptest.wiretype.WireTypeAsyncClient.superClassMismatchWithResponse": "TspTest.WireType.WireTypeOp.superClassMismatch", + "tsptest.wiretype.WireTypeClient": "TspTest.WireType.WireTypeOp", + "tsptest.wiretype.WireTypeClient.bothClassMismatch": "TspTest.WireType.WireTypeOp.bothClassMismatch", + "tsptest.wiretype.WireTypeClient.bothClassMismatchWithResponse": "TspTest.WireType.WireTypeOp.bothClassMismatch", + "tsptest.wiretype.WireTypeClient.subClassMismatch": "TspTest.WireType.WireTypeOp.subClassMismatch", + "tsptest.wiretype.WireTypeClient.subClassMismatchWithResponse": "TspTest.WireType.WireTypeOp.subClassMismatch", + "tsptest.wiretype.WireTypeClient.superClassMismatch": "TspTest.WireType.WireTypeOp.superClassMismatch", + "tsptest.wiretype.WireTypeClient.superClassMismatchWithResponse": "TspTest.WireType.WireTypeOp.superClassMismatch", + "tsptest.wiretype.WireTypeClientBuilder": "TspTest.WireType", + "tsptest.wiretype.models.SubClass": "TspTest.WireType.SubClass", + "tsptest.wiretype.models.SubClassBothMismatch": "TspTest.WireType.SubClassBothMismatch", + "tsptest.wiretype.models.SubClassMismatch": "TspTest.WireType.SubClassMismatch", + "tsptest.wiretype.models.SuperClass": "TspTest.WireType.SuperClass", + "tsptest.wiretype.models.SuperClassMismatch": "TspTest.WireType.SuperClassMismatch" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_metadata.json new file mode 100644 index 00000000000..457ca6191f3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-wiretype_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"tsptest.wiretype.WireTypeAsyncClient":"TspTest.WireType.WireTypeOp","tsptest.wiretype.WireTypeAsyncClient.bothClassMismatch":"TspTest.WireType.WireTypeOp.bothClassMismatch","tsptest.wiretype.WireTypeAsyncClient.bothClassMismatchWithResponse":"TspTest.WireType.WireTypeOp.bothClassMismatch","tsptest.wiretype.WireTypeAsyncClient.subClassMismatch":"TspTest.WireType.WireTypeOp.subClassMismatch","tsptest.wiretype.WireTypeAsyncClient.subClassMismatchWithResponse":"TspTest.WireType.WireTypeOp.subClassMismatch","tsptest.wiretype.WireTypeAsyncClient.superClassMismatch":"TspTest.WireType.WireTypeOp.superClassMismatch","tsptest.wiretype.WireTypeAsyncClient.superClassMismatchWithResponse":"TspTest.WireType.WireTypeOp.superClassMismatch","tsptest.wiretype.WireTypeClient":"TspTest.WireType.WireTypeOp","tsptest.wiretype.WireTypeClient.bothClassMismatch":"TspTest.WireType.WireTypeOp.bothClassMismatch","tsptest.wiretype.WireTypeClient.bothClassMismatchWithResponse":"TspTest.WireType.WireTypeOp.bothClassMismatch","tsptest.wiretype.WireTypeClient.subClassMismatch":"TspTest.WireType.WireTypeOp.subClassMismatch","tsptest.wiretype.WireTypeClient.subClassMismatchWithResponse":"TspTest.WireType.WireTypeOp.subClassMismatch","tsptest.wiretype.WireTypeClient.superClassMismatch":"TspTest.WireType.WireTypeOp.superClassMismatch","tsptest.wiretype.WireTypeClient.superClassMismatchWithResponse":"TspTest.WireType.WireTypeOp.superClassMismatch","tsptest.wiretype.WireTypeClientBuilder":"TspTest.WireType","tsptest.wiretype.models.SubClass":"TspTest.WireType.SubClass","tsptest.wiretype.models.SubClassBothMismatch":"TspTest.WireType.SubClassBothMismatch","tsptest.wiretype.models.SubClassMismatch":"TspTest.WireType.SubClassMismatch","tsptest.wiretype.models.SuperClass":"TspTest.WireType.SuperClass","tsptest.wiretype.models.SuperClassMismatch":"TspTest.WireType.SuperClassMismatch"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/wiretype/WireTypeAsyncClient.java","src/main/java/tsptest/wiretype/WireTypeClient.java","src/main/java/tsptest/wiretype/WireTypeClientBuilder.java","src/main/java/tsptest/wiretype/implementation/WireTypeClientImpl.java","src/main/java/tsptest/wiretype/implementation/WireTypeOpsImpl.java","src/main/java/tsptest/wiretype/implementation/package-info.java","src/main/java/tsptest/wiretype/models/SubClass.java","src/main/java/tsptest/wiretype/models/SubClassBothMismatch.java","src/main/java/tsptest/wiretype/models/SubClassMismatch.java","src/main/java/tsptest/wiretype/models/SuperClass.java","src/main/java/tsptest/wiretype/models/SuperClassMismatch.java","src/main/java/tsptest/wiretype/models/package-info.java","src/main/java/tsptest/wiretype/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_apiview_properties.json new file mode 100644 index 00000000000..d93e42231f3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_apiview_properties.json @@ -0,0 +1,147 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.array.ArrayClientBuilder": "Type.Array", + "type.array.BooleanValueAsyncClient": "Type.Array.BooleanValue", + "type.array.BooleanValueAsyncClient.get": "Type.Array.BooleanValue.get", + "type.array.BooleanValueAsyncClient.getWithResponse": "Type.Array.BooleanValue.get", + "type.array.BooleanValueAsyncClient.put": "Type.Array.BooleanValue.put", + "type.array.BooleanValueAsyncClient.putWithResponse": "Type.Array.BooleanValue.put", + "type.array.BooleanValueClient": "Type.Array.BooleanValue", + "type.array.BooleanValueClient.get": "Type.Array.BooleanValue.get", + "type.array.BooleanValueClient.getWithResponse": "Type.Array.BooleanValue.get", + "type.array.BooleanValueClient.put": "Type.Array.BooleanValue.put", + "type.array.BooleanValueClient.putWithResponse": "Type.Array.BooleanValue.put", + "type.array.DatetimeValueAsyncClient": "Type.Array.DatetimeValue", + "type.array.DatetimeValueAsyncClient.get": "Type.Array.DatetimeValue.get", + "type.array.DatetimeValueAsyncClient.getWithResponse": "Type.Array.DatetimeValue.get", + "type.array.DatetimeValueAsyncClient.put": "Type.Array.DatetimeValue.put", + "type.array.DatetimeValueAsyncClient.putWithResponse": "Type.Array.DatetimeValue.put", + "type.array.DatetimeValueClient": "Type.Array.DatetimeValue", + "type.array.DatetimeValueClient.get": "Type.Array.DatetimeValue.get", + "type.array.DatetimeValueClient.getWithResponse": "Type.Array.DatetimeValue.get", + "type.array.DatetimeValueClient.put": "Type.Array.DatetimeValue.put", + "type.array.DatetimeValueClient.putWithResponse": "Type.Array.DatetimeValue.put", + "type.array.DurationValueAsyncClient": "Type.Array.DurationValue", + "type.array.DurationValueAsyncClient.get": "Type.Array.DurationValue.get", + "type.array.DurationValueAsyncClient.getWithResponse": "Type.Array.DurationValue.get", + "type.array.DurationValueAsyncClient.put": "Type.Array.DurationValue.put", + "type.array.DurationValueAsyncClient.putWithResponse": "Type.Array.DurationValue.put", + "type.array.DurationValueClient": "Type.Array.DurationValue", + "type.array.DurationValueClient.get": "Type.Array.DurationValue.get", + "type.array.DurationValueClient.getWithResponse": "Type.Array.DurationValue.get", + "type.array.DurationValueClient.put": "Type.Array.DurationValue.put", + "type.array.DurationValueClient.putWithResponse": "Type.Array.DurationValue.put", + "type.array.Float32ValueAsyncClient": "Type.Array.Float32Value", + "type.array.Float32ValueAsyncClient.get": "Type.Array.Float32Value.get", + "type.array.Float32ValueAsyncClient.getWithResponse": "Type.Array.Float32Value.get", + "type.array.Float32ValueAsyncClient.put": "Type.Array.Float32Value.put", + "type.array.Float32ValueAsyncClient.putWithResponse": "Type.Array.Float32Value.put", + "type.array.Float32ValueClient": "Type.Array.Float32Value", + "type.array.Float32ValueClient.get": "Type.Array.Float32Value.get", + "type.array.Float32ValueClient.getWithResponse": "Type.Array.Float32Value.get", + "type.array.Float32ValueClient.put": "Type.Array.Float32Value.put", + "type.array.Float32ValueClient.putWithResponse": "Type.Array.Float32Value.put", + "type.array.Int32ValueAsyncClient": "Type.Array.Int32Value", + "type.array.Int32ValueAsyncClient.get": "Type.Array.Int32Value.get", + "type.array.Int32ValueAsyncClient.getWithResponse": "Type.Array.Int32Value.get", + "type.array.Int32ValueAsyncClient.put": "Type.Array.Int32Value.put", + "type.array.Int32ValueAsyncClient.putWithResponse": "Type.Array.Int32Value.put", + "type.array.Int32ValueClient": "Type.Array.Int32Value", + "type.array.Int32ValueClient.get": "Type.Array.Int32Value.get", + "type.array.Int32ValueClient.getWithResponse": "Type.Array.Int32Value.get", + "type.array.Int32ValueClient.put": "Type.Array.Int32Value.put", + "type.array.Int32ValueClient.putWithResponse": "Type.Array.Int32Value.put", + "type.array.Int64ValueAsyncClient": "Type.Array.Int64Value", + "type.array.Int64ValueAsyncClient.get": "Type.Array.Int64Value.get", + "type.array.Int64ValueAsyncClient.getWithResponse": "Type.Array.Int64Value.get", + "type.array.Int64ValueAsyncClient.put": "Type.Array.Int64Value.put", + "type.array.Int64ValueAsyncClient.putWithResponse": "Type.Array.Int64Value.put", + "type.array.Int64ValueClient": "Type.Array.Int64Value", + "type.array.Int64ValueClient.get": "Type.Array.Int64Value.get", + "type.array.Int64ValueClient.getWithResponse": "Type.Array.Int64Value.get", + "type.array.Int64ValueClient.put": "Type.Array.Int64Value.put", + "type.array.Int64ValueClient.putWithResponse": "Type.Array.Int64Value.put", + "type.array.ModelValueAsyncClient": "Type.Array.ModelValue", + "type.array.ModelValueAsyncClient.get": "Type.Array.ModelValue.get", + "type.array.ModelValueAsyncClient.getWithResponse": "Type.Array.ModelValue.get", + "type.array.ModelValueAsyncClient.put": "Type.Array.ModelValue.put", + "type.array.ModelValueAsyncClient.putWithResponse": "Type.Array.ModelValue.put", + "type.array.ModelValueClient": "Type.Array.ModelValue", + "type.array.ModelValueClient.get": "Type.Array.ModelValue.get", + "type.array.ModelValueClient.getWithResponse": "Type.Array.ModelValue.get", + "type.array.ModelValueClient.put": "Type.Array.ModelValue.put", + "type.array.ModelValueClient.putWithResponse": "Type.Array.ModelValue.put", + "type.array.NullableBooleanValueAsyncClient": "Type.Array.NullableBooleanValue", + "type.array.NullableBooleanValueAsyncClient.get": "Type.Array.NullableBooleanValue.get", + "type.array.NullableBooleanValueAsyncClient.getWithResponse": "Type.Array.NullableBooleanValue.get", + "type.array.NullableBooleanValueAsyncClient.put": "Type.Array.NullableBooleanValue.put", + "type.array.NullableBooleanValueAsyncClient.putWithResponse": "Type.Array.NullableBooleanValue.put", + "type.array.NullableBooleanValueClient": "Type.Array.NullableBooleanValue", + "type.array.NullableBooleanValueClient.get": "Type.Array.NullableBooleanValue.get", + "type.array.NullableBooleanValueClient.getWithResponse": "Type.Array.NullableBooleanValue.get", + "type.array.NullableBooleanValueClient.put": "Type.Array.NullableBooleanValue.put", + "type.array.NullableBooleanValueClient.putWithResponse": "Type.Array.NullableBooleanValue.put", + "type.array.NullableFloatValueAsyncClient": "Type.Array.NullableFloatValue", + "type.array.NullableFloatValueAsyncClient.get": "Type.Array.NullableFloatValue.get", + "type.array.NullableFloatValueAsyncClient.getWithResponse": "Type.Array.NullableFloatValue.get", + "type.array.NullableFloatValueAsyncClient.put": "Type.Array.NullableFloatValue.put", + "type.array.NullableFloatValueAsyncClient.putWithResponse": "Type.Array.NullableFloatValue.put", + "type.array.NullableFloatValueClient": "Type.Array.NullableFloatValue", + "type.array.NullableFloatValueClient.get": "Type.Array.NullableFloatValue.get", + "type.array.NullableFloatValueClient.getWithResponse": "Type.Array.NullableFloatValue.get", + "type.array.NullableFloatValueClient.put": "Type.Array.NullableFloatValue.put", + "type.array.NullableFloatValueClient.putWithResponse": "Type.Array.NullableFloatValue.put", + "type.array.NullableInt32ValueAsyncClient": "Type.Array.NullableInt32Value", + "type.array.NullableInt32ValueAsyncClient.get": "Type.Array.NullableInt32Value.get", + "type.array.NullableInt32ValueAsyncClient.getWithResponse": "Type.Array.NullableInt32Value.get", + "type.array.NullableInt32ValueAsyncClient.put": "Type.Array.NullableInt32Value.put", + "type.array.NullableInt32ValueAsyncClient.putWithResponse": "Type.Array.NullableInt32Value.put", + "type.array.NullableInt32ValueClient": "Type.Array.NullableInt32Value", + "type.array.NullableInt32ValueClient.get": "Type.Array.NullableInt32Value.get", + "type.array.NullableInt32ValueClient.getWithResponse": "Type.Array.NullableInt32Value.get", + "type.array.NullableInt32ValueClient.put": "Type.Array.NullableInt32Value.put", + "type.array.NullableInt32ValueClient.putWithResponse": "Type.Array.NullableInt32Value.put", + "type.array.NullableModelValueAsyncClient": "Type.Array.NullableModelValue", + "type.array.NullableModelValueAsyncClient.get": "Type.Array.NullableModelValue.get", + "type.array.NullableModelValueAsyncClient.getWithResponse": "Type.Array.NullableModelValue.get", + "type.array.NullableModelValueAsyncClient.put": "Type.Array.NullableModelValue.put", + "type.array.NullableModelValueAsyncClient.putWithResponse": "Type.Array.NullableModelValue.put", + "type.array.NullableModelValueClient": "Type.Array.NullableModelValue", + "type.array.NullableModelValueClient.get": "Type.Array.NullableModelValue.get", + "type.array.NullableModelValueClient.getWithResponse": "Type.Array.NullableModelValue.get", + "type.array.NullableModelValueClient.put": "Type.Array.NullableModelValue.put", + "type.array.NullableModelValueClient.putWithResponse": "Type.Array.NullableModelValue.put", + "type.array.NullableStringValueAsyncClient": "Type.Array.NullableStringValue", + "type.array.NullableStringValueAsyncClient.get": "Type.Array.NullableStringValue.get", + "type.array.NullableStringValueAsyncClient.getWithResponse": "Type.Array.NullableStringValue.get", + "type.array.NullableStringValueAsyncClient.put": "Type.Array.NullableStringValue.put", + "type.array.NullableStringValueAsyncClient.putWithResponse": "Type.Array.NullableStringValue.put", + "type.array.NullableStringValueClient": "Type.Array.NullableStringValue", + "type.array.NullableStringValueClient.get": "Type.Array.NullableStringValue.get", + "type.array.NullableStringValueClient.getWithResponse": "Type.Array.NullableStringValue.get", + "type.array.NullableStringValueClient.put": "Type.Array.NullableStringValue.put", + "type.array.NullableStringValueClient.putWithResponse": "Type.Array.NullableStringValue.put", + "type.array.StringValueAsyncClient": "Type.Array.StringValue", + "type.array.StringValueAsyncClient.get": "Type.Array.StringValue.get", + "type.array.StringValueAsyncClient.getWithResponse": "Type.Array.StringValue.get", + "type.array.StringValueAsyncClient.put": "Type.Array.StringValue.put", + "type.array.StringValueAsyncClient.putWithResponse": "Type.Array.StringValue.put", + "type.array.StringValueClient": "Type.Array.StringValue", + "type.array.StringValueClient.get": "Type.Array.StringValue.get", + "type.array.StringValueClient.getWithResponse": "Type.Array.StringValue.get", + "type.array.StringValueClient.put": "Type.Array.StringValue.put", + "type.array.StringValueClient.putWithResponse": "Type.Array.StringValue.put", + "type.array.UnknownValueAsyncClient": "Type.Array.UnknownValue", + "type.array.UnknownValueAsyncClient.get": "Type.Array.UnknownValue.get", + "type.array.UnknownValueAsyncClient.getWithResponse": "Type.Array.UnknownValue.get", + "type.array.UnknownValueAsyncClient.put": "Type.Array.UnknownValue.put", + "type.array.UnknownValueAsyncClient.putWithResponse": "Type.Array.UnknownValue.put", + "type.array.UnknownValueClient": "Type.Array.UnknownValue", + "type.array.UnknownValueClient.get": "Type.Array.UnknownValue.get", + "type.array.UnknownValueClient.getWithResponse": "Type.Array.UnknownValue.get", + "type.array.UnknownValueClient.put": "Type.Array.UnknownValue.put", + "type.array.UnknownValueClient.putWithResponse": "Type.Array.UnknownValue.put", + "type.array.models.InnerModel": "Type.Array.InnerModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_metadata.json new file mode 100644 index 00000000000..e3fee9b1ce4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-array_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.array.ArrayClientBuilder":"Type.Array","type.array.BooleanValueAsyncClient":"Type.Array.BooleanValue","type.array.BooleanValueAsyncClient.get":"Type.Array.BooleanValue.get","type.array.BooleanValueAsyncClient.getWithResponse":"Type.Array.BooleanValue.get","type.array.BooleanValueAsyncClient.put":"Type.Array.BooleanValue.put","type.array.BooleanValueAsyncClient.putWithResponse":"Type.Array.BooleanValue.put","type.array.BooleanValueClient":"Type.Array.BooleanValue","type.array.BooleanValueClient.get":"Type.Array.BooleanValue.get","type.array.BooleanValueClient.getWithResponse":"Type.Array.BooleanValue.get","type.array.BooleanValueClient.put":"Type.Array.BooleanValue.put","type.array.BooleanValueClient.putWithResponse":"Type.Array.BooleanValue.put","type.array.DatetimeValueAsyncClient":"Type.Array.DatetimeValue","type.array.DatetimeValueAsyncClient.get":"Type.Array.DatetimeValue.get","type.array.DatetimeValueAsyncClient.getWithResponse":"Type.Array.DatetimeValue.get","type.array.DatetimeValueAsyncClient.put":"Type.Array.DatetimeValue.put","type.array.DatetimeValueAsyncClient.putWithResponse":"Type.Array.DatetimeValue.put","type.array.DatetimeValueClient":"Type.Array.DatetimeValue","type.array.DatetimeValueClient.get":"Type.Array.DatetimeValue.get","type.array.DatetimeValueClient.getWithResponse":"Type.Array.DatetimeValue.get","type.array.DatetimeValueClient.put":"Type.Array.DatetimeValue.put","type.array.DatetimeValueClient.putWithResponse":"Type.Array.DatetimeValue.put","type.array.DurationValueAsyncClient":"Type.Array.DurationValue","type.array.DurationValueAsyncClient.get":"Type.Array.DurationValue.get","type.array.DurationValueAsyncClient.getWithResponse":"Type.Array.DurationValue.get","type.array.DurationValueAsyncClient.put":"Type.Array.DurationValue.put","type.array.DurationValueAsyncClient.putWithResponse":"Type.Array.DurationValue.put","type.array.DurationValueClient":"Type.Array.DurationValue","type.array.DurationValueClient.get":"Type.Array.DurationValue.get","type.array.DurationValueClient.getWithResponse":"Type.Array.DurationValue.get","type.array.DurationValueClient.put":"Type.Array.DurationValue.put","type.array.DurationValueClient.putWithResponse":"Type.Array.DurationValue.put","type.array.Float32ValueAsyncClient":"Type.Array.Float32Value","type.array.Float32ValueAsyncClient.get":"Type.Array.Float32Value.get","type.array.Float32ValueAsyncClient.getWithResponse":"Type.Array.Float32Value.get","type.array.Float32ValueAsyncClient.put":"Type.Array.Float32Value.put","type.array.Float32ValueAsyncClient.putWithResponse":"Type.Array.Float32Value.put","type.array.Float32ValueClient":"Type.Array.Float32Value","type.array.Float32ValueClient.get":"Type.Array.Float32Value.get","type.array.Float32ValueClient.getWithResponse":"Type.Array.Float32Value.get","type.array.Float32ValueClient.put":"Type.Array.Float32Value.put","type.array.Float32ValueClient.putWithResponse":"Type.Array.Float32Value.put","type.array.Int32ValueAsyncClient":"Type.Array.Int32Value","type.array.Int32ValueAsyncClient.get":"Type.Array.Int32Value.get","type.array.Int32ValueAsyncClient.getWithResponse":"Type.Array.Int32Value.get","type.array.Int32ValueAsyncClient.put":"Type.Array.Int32Value.put","type.array.Int32ValueAsyncClient.putWithResponse":"Type.Array.Int32Value.put","type.array.Int32ValueClient":"Type.Array.Int32Value","type.array.Int32ValueClient.get":"Type.Array.Int32Value.get","type.array.Int32ValueClient.getWithResponse":"Type.Array.Int32Value.get","type.array.Int32ValueClient.put":"Type.Array.Int32Value.put","type.array.Int32ValueClient.putWithResponse":"Type.Array.Int32Value.put","type.array.Int64ValueAsyncClient":"Type.Array.Int64Value","type.array.Int64ValueAsyncClient.get":"Type.Array.Int64Value.get","type.array.Int64ValueAsyncClient.getWithResponse":"Type.Array.Int64Value.get","type.array.Int64ValueAsyncClient.put":"Type.Array.Int64Value.put","type.array.Int64ValueAsyncClient.putWithResponse":"Type.Array.Int64Value.put","type.array.Int64ValueClient":"Type.Array.Int64Value","type.array.Int64ValueClient.get":"Type.Array.Int64Value.get","type.array.Int64ValueClient.getWithResponse":"Type.Array.Int64Value.get","type.array.Int64ValueClient.put":"Type.Array.Int64Value.put","type.array.Int64ValueClient.putWithResponse":"Type.Array.Int64Value.put","type.array.ModelValueAsyncClient":"Type.Array.ModelValue","type.array.ModelValueAsyncClient.get":"Type.Array.ModelValue.get","type.array.ModelValueAsyncClient.getWithResponse":"Type.Array.ModelValue.get","type.array.ModelValueAsyncClient.put":"Type.Array.ModelValue.put","type.array.ModelValueAsyncClient.putWithResponse":"Type.Array.ModelValue.put","type.array.ModelValueClient":"Type.Array.ModelValue","type.array.ModelValueClient.get":"Type.Array.ModelValue.get","type.array.ModelValueClient.getWithResponse":"Type.Array.ModelValue.get","type.array.ModelValueClient.put":"Type.Array.ModelValue.put","type.array.ModelValueClient.putWithResponse":"Type.Array.ModelValue.put","type.array.NullableBooleanValueAsyncClient":"Type.Array.NullableBooleanValue","type.array.NullableBooleanValueAsyncClient.get":"Type.Array.NullableBooleanValue.get","type.array.NullableBooleanValueAsyncClient.getWithResponse":"Type.Array.NullableBooleanValue.get","type.array.NullableBooleanValueAsyncClient.put":"Type.Array.NullableBooleanValue.put","type.array.NullableBooleanValueAsyncClient.putWithResponse":"Type.Array.NullableBooleanValue.put","type.array.NullableBooleanValueClient":"Type.Array.NullableBooleanValue","type.array.NullableBooleanValueClient.get":"Type.Array.NullableBooleanValue.get","type.array.NullableBooleanValueClient.getWithResponse":"Type.Array.NullableBooleanValue.get","type.array.NullableBooleanValueClient.put":"Type.Array.NullableBooleanValue.put","type.array.NullableBooleanValueClient.putWithResponse":"Type.Array.NullableBooleanValue.put","type.array.NullableFloatValueAsyncClient":"Type.Array.NullableFloatValue","type.array.NullableFloatValueAsyncClient.get":"Type.Array.NullableFloatValue.get","type.array.NullableFloatValueAsyncClient.getWithResponse":"Type.Array.NullableFloatValue.get","type.array.NullableFloatValueAsyncClient.put":"Type.Array.NullableFloatValue.put","type.array.NullableFloatValueAsyncClient.putWithResponse":"Type.Array.NullableFloatValue.put","type.array.NullableFloatValueClient":"Type.Array.NullableFloatValue","type.array.NullableFloatValueClient.get":"Type.Array.NullableFloatValue.get","type.array.NullableFloatValueClient.getWithResponse":"Type.Array.NullableFloatValue.get","type.array.NullableFloatValueClient.put":"Type.Array.NullableFloatValue.put","type.array.NullableFloatValueClient.putWithResponse":"Type.Array.NullableFloatValue.put","type.array.NullableInt32ValueAsyncClient":"Type.Array.NullableInt32Value","type.array.NullableInt32ValueAsyncClient.get":"Type.Array.NullableInt32Value.get","type.array.NullableInt32ValueAsyncClient.getWithResponse":"Type.Array.NullableInt32Value.get","type.array.NullableInt32ValueAsyncClient.put":"Type.Array.NullableInt32Value.put","type.array.NullableInt32ValueAsyncClient.putWithResponse":"Type.Array.NullableInt32Value.put","type.array.NullableInt32ValueClient":"Type.Array.NullableInt32Value","type.array.NullableInt32ValueClient.get":"Type.Array.NullableInt32Value.get","type.array.NullableInt32ValueClient.getWithResponse":"Type.Array.NullableInt32Value.get","type.array.NullableInt32ValueClient.put":"Type.Array.NullableInt32Value.put","type.array.NullableInt32ValueClient.putWithResponse":"Type.Array.NullableInt32Value.put","type.array.NullableModelValueAsyncClient":"Type.Array.NullableModelValue","type.array.NullableModelValueAsyncClient.get":"Type.Array.NullableModelValue.get","type.array.NullableModelValueAsyncClient.getWithResponse":"Type.Array.NullableModelValue.get","type.array.NullableModelValueAsyncClient.put":"Type.Array.NullableModelValue.put","type.array.NullableModelValueAsyncClient.putWithResponse":"Type.Array.NullableModelValue.put","type.array.NullableModelValueClient":"Type.Array.NullableModelValue","type.array.NullableModelValueClient.get":"Type.Array.NullableModelValue.get","type.array.NullableModelValueClient.getWithResponse":"Type.Array.NullableModelValue.get","type.array.NullableModelValueClient.put":"Type.Array.NullableModelValue.put","type.array.NullableModelValueClient.putWithResponse":"Type.Array.NullableModelValue.put","type.array.NullableStringValueAsyncClient":"Type.Array.NullableStringValue","type.array.NullableStringValueAsyncClient.get":"Type.Array.NullableStringValue.get","type.array.NullableStringValueAsyncClient.getWithResponse":"Type.Array.NullableStringValue.get","type.array.NullableStringValueAsyncClient.put":"Type.Array.NullableStringValue.put","type.array.NullableStringValueAsyncClient.putWithResponse":"Type.Array.NullableStringValue.put","type.array.NullableStringValueClient":"Type.Array.NullableStringValue","type.array.NullableStringValueClient.get":"Type.Array.NullableStringValue.get","type.array.NullableStringValueClient.getWithResponse":"Type.Array.NullableStringValue.get","type.array.NullableStringValueClient.put":"Type.Array.NullableStringValue.put","type.array.NullableStringValueClient.putWithResponse":"Type.Array.NullableStringValue.put","type.array.StringValueAsyncClient":"Type.Array.StringValue","type.array.StringValueAsyncClient.get":"Type.Array.StringValue.get","type.array.StringValueAsyncClient.getWithResponse":"Type.Array.StringValue.get","type.array.StringValueAsyncClient.put":"Type.Array.StringValue.put","type.array.StringValueAsyncClient.putWithResponse":"Type.Array.StringValue.put","type.array.StringValueClient":"Type.Array.StringValue","type.array.StringValueClient.get":"Type.Array.StringValue.get","type.array.StringValueClient.getWithResponse":"Type.Array.StringValue.get","type.array.StringValueClient.put":"Type.Array.StringValue.put","type.array.StringValueClient.putWithResponse":"Type.Array.StringValue.put","type.array.UnknownValueAsyncClient":"Type.Array.UnknownValue","type.array.UnknownValueAsyncClient.get":"Type.Array.UnknownValue.get","type.array.UnknownValueAsyncClient.getWithResponse":"Type.Array.UnknownValue.get","type.array.UnknownValueAsyncClient.put":"Type.Array.UnknownValue.put","type.array.UnknownValueAsyncClient.putWithResponse":"Type.Array.UnknownValue.put","type.array.UnknownValueClient":"Type.Array.UnknownValue","type.array.UnknownValueClient.get":"Type.Array.UnknownValue.get","type.array.UnknownValueClient.getWithResponse":"Type.Array.UnknownValue.get","type.array.UnknownValueClient.put":"Type.Array.UnknownValue.put","type.array.UnknownValueClient.putWithResponse":"Type.Array.UnknownValue.put","type.array.models.InnerModel":"Type.Array.InnerModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/array/ArrayClientBuilder.java","src/main/java/type/array/BooleanValueAsyncClient.java","src/main/java/type/array/BooleanValueClient.java","src/main/java/type/array/DatetimeValueAsyncClient.java","src/main/java/type/array/DatetimeValueClient.java","src/main/java/type/array/DurationValueAsyncClient.java","src/main/java/type/array/DurationValueClient.java","src/main/java/type/array/Float32ValueAsyncClient.java","src/main/java/type/array/Float32ValueClient.java","src/main/java/type/array/Int32ValueAsyncClient.java","src/main/java/type/array/Int32ValueClient.java","src/main/java/type/array/Int64ValueAsyncClient.java","src/main/java/type/array/Int64ValueClient.java","src/main/java/type/array/ModelValueAsyncClient.java","src/main/java/type/array/ModelValueClient.java","src/main/java/type/array/NullableBooleanValueAsyncClient.java","src/main/java/type/array/NullableBooleanValueClient.java","src/main/java/type/array/NullableFloatValueAsyncClient.java","src/main/java/type/array/NullableFloatValueClient.java","src/main/java/type/array/NullableInt32ValueAsyncClient.java","src/main/java/type/array/NullableInt32ValueClient.java","src/main/java/type/array/NullableModelValueAsyncClient.java","src/main/java/type/array/NullableModelValueClient.java","src/main/java/type/array/NullableStringValueAsyncClient.java","src/main/java/type/array/NullableStringValueClient.java","src/main/java/type/array/StringValueAsyncClient.java","src/main/java/type/array/StringValueClient.java","src/main/java/type/array/UnknownValueAsyncClient.java","src/main/java/type/array/UnknownValueClient.java","src/main/java/type/array/implementation/ArrayClientImpl.java","src/main/java/type/array/implementation/BooleanValuesImpl.java","src/main/java/type/array/implementation/DatetimeValuesImpl.java","src/main/java/type/array/implementation/DurationValuesImpl.java","src/main/java/type/array/implementation/Float32ValuesImpl.java","src/main/java/type/array/implementation/Int32ValuesImpl.java","src/main/java/type/array/implementation/Int64ValuesImpl.java","src/main/java/type/array/implementation/ModelValuesImpl.java","src/main/java/type/array/implementation/NullableBooleanValuesImpl.java","src/main/java/type/array/implementation/NullableFloatValuesImpl.java","src/main/java/type/array/implementation/NullableInt32ValuesImpl.java","src/main/java/type/array/implementation/NullableModelValuesImpl.java","src/main/java/type/array/implementation/NullableStringValuesImpl.java","src/main/java/type/array/implementation/StringValuesImpl.java","src/main/java/type/array/implementation/UnknownValuesImpl.java","src/main/java/type/array/implementation/package-info.java","src/main/java/type/array/models/InnerModel.java","src/main/java/type/array/models/package-info.java","src/main/java/type/array/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_apiview_properties.json new file mode 100644 index 00000000000..8cc56c8c284 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_apiview_properties.json @@ -0,0 +1,117 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.dictionary.BooleanValueAsyncClient": "Type.Dictionary.BooleanValue", + "type.dictionary.BooleanValueAsyncClient.get": "Type.Dictionary.BooleanValue.get", + "type.dictionary.BooleanValueAsyncClient.getWithResponse": "Type.Dictionary.BooleanValue.get", + "type.dictionary.BooleanValueAsyncClient.put": "Type.Dictionary.BooleanValue.put", + "type.dictionary.BooleanValueAsyncClient.putWithResponse": "Type.Dictionary.BooleanValue.put", + "type.dictionary.BooleanValueClient": "Type.Dictionary.BooleanValue", + "type.dictionary.BooleanValueClient.get": "Type.Dictionary.BooleanValue.get", + "type.dictionary.BooleanValueClient.getWithResponse": "Type.Dictionary.BooleanValue.get", + "type.dictionary.BooleanValueClient.put": "Type.Dictionary.BooleanValue.put", + "type.dictionary.BooleanValueClient.putWithResponse": "Type.Dictionary.BooleanValue.put", + "type.dictionary.DatetimeValueAsyncClient": "Type.Dictionary.DatetimeValue", + "type.dictionary.DatetimeValueAsyncClient.get": "Type.Dictionary.DatetimeValue.get", + "type.dictionary.DatetimeValueAsyncClient.getWithResponse": "Type.Dictionary.DatetimeValue.get", + "type.dictionary.DatetimeValueAsyncClient.put": "Type.Dictionary.DatetimeValue.put", + "type.dictionary.DatetimeValueAsyncClient.putWithResponse": "Type.Dictionary.DatetimeValue.put", + "type.dictionary.DatetimeValueClient": "Type.Dictionary.DatetimeValue", + "type.dictionary.DatetimeValueClient.get": "Type.Dictionary.DatetimeValue.get", + "type.dictionary.DatetimeValueClient.getWithResponse": "Type.Dictionary.DatetimeValue.get", + "type.dictionary.DatetimeValueClient.put": "Type.Dictionary.DatetimeValue.put", + "type.dictionary.DatetimeValueClient.putWithResponse": "Type.Dictionary.DatetimeValue.put", + "type.dictionary.DictionaryClientBuilder": "Type.Dictionary", + "type.dictionary.DurationValueAsyncClient": "Type.Dictionary.DurationValue", + "type.dictionary.DurationValueAsyncClient.get": "Type.Dictionary.DurationValue.get", + "type.dictionary.DurationValueAsyncClient.getWithResponse": "Type.Dictionary.DurationValue.get", + "type.dictionary.DurationValueAsyncClient.put": "Type.Dictionary.DurationValue.put", + "type.dictionary.DurationValueAsyncClient.putWithResponse": "Type.Dictionary.DurationValue.put", + "type.dictionary.DurationValueClient": "Type.Dictionary.DurationValue", + "type.dictionary.DurationValueClient.get": "Type.Dictionary.DurationValue.get", + "type.dictionary.DurationValueClient.getWithResponse": "Type.Dictionary.DurationValue.get", + "type.dictionary.DurationValueClient.put": "Type.Dictionary.DurationValue.put", + "type.dictionary.DurationValueClient.putWithResponse": "Type.Dictionary.DurationValue.put", + "type.dictionary.Float32ValueAsyncClient": "Type.Dictionary.Float32Value", + "type.dictionary.Float32ValueAsyncClient.get": "Type.Dictionary.Float32Value.get", + "type.dictionary.Float32ValueAsyncClient.getWithResponse": "Type.Dictionary.Float32Value.get", + "type.dictionary.Float32ValueAsyncClient.put": "Type.Dictionary.Float32Value.put", + "type.dictionary.Float32ValueAsyncClient.putWithResponse": "Type.Dictionary.Float32Value.put", + "type.dictionary.Float32ValueClient": "Type.Dictionary.Float32Value", + "type.dictionary.Float32ValueClient.get": "Type.Dictionary.Float32Value.get", + "type.dictionary.Float32ValueClient.getWithResponse": "Type.Dictionary.Float32Value.get", + "type.dictionary.Float32ValueClient.put": "Type.Dictionary.Float32Value.put", + "type.dictionary.Float32ValueClient.putWithResponse": "Type.Dictionary.Float32Value.put", + "type.dictionary.Int32ValueAsyncClient": "Type.Dictionary.Int32Value", + "type.dictionary.Int32ValueAsyncClient.get": "Type.Dictionary.Int32Value.get", + "type.dictionary.Int32ValueAsyncClient.getWithResponse": "Type.Dictionary.Int32Value.get", + "type.dictionary.Int32ValueAsyncClient.put": "Type.Dictionary.Int32Value.put", + "type.dictionary.Int32ValueAsyncClient.putWithResponse": "Type.Dictionary.Int32Value.put", + "type.dictionary.Int32ValueClient": "Type.Dictionary.Int32Value", + "type.dictionary.Int32ValueClient.get": "Type.Dictionary.Int32Value.get", + "type.dictionary.Int32ValueClient.getWithResponse": "Type.Dictionary.Int32Value.get", + "type.dictionary.Int32ValueClient.put": "Type.Dictionary.Int32Value.put", + "type.dictionary.Int32ValueClient.putWithResponse": "Type.Dictionary.Int32Value.put", + "type.dictionary.Int64ValueAsyncClient": "Type.Dictionary.Int64Value", + "type.dictionary.Int64ValueAsyncClient.get": "Type.Dictionary.Int64Value.get", + "type.dictionary.Int64ValueAsyncClient.getWithResponse": "Type.Dictionary.Int64Value.get", + "type.dictionary.Int64ValueAsyncClient.put": "Type.Dictionary.Int64Value.put", + "type.dictionary.Int64ValueAsyncClient.putWithResponse": "Type.Dictionary.Int64Value.put", + "type.dictionary.Int64ValueClient": "Type.Dictionary.Int64Value", + "type.dictionary.Int64ValueClient.get": "Type.Dictionary.Int64Value.get", + "type.dictionary.Int64ValueClient.getWithResponse": "Type.Dictionary.Int64Value.get", + "type.dictionary.Int64ValueClient.put": "Type.Dictionary.Int64Value.put", + "type.dictionary.Int64ValueClient.putWithResponse": "Type.Dictionary.Int64Value.put", + "type.dictionary.ModelValueAsyncClient": "Type.Dictionary.ModelValue", + "type.dictionary.ModelValueAsyncClient.get": "Type.Dictionary.ModelValue.get", + "type.dictionary.ModelValueAsyncClient.getWithResponse": "Type.Dictionary.ModelValue.get", + "type.dictionary.ModelValueAsyncClient.put": "Type.Dictionary.ModelValue.put", + "type.dictionary.ModelValueAsyncClient.putWithResponse": "Type.Dictionary.ModelValue.put", + "type.dictionary.ModelValueClient": "Type.Dictionary.ModelValue", + "type.dictionary.ModelValueClient.get": "Type.Dictionary.ModelValue.get", + "type.dictionary.ModelValueClient.getWithResponse": "Type.Dictionary.ModelValue.get", + "type.dictionary.ModelValueClient.put": "Type.Dictionary.ModelValue.put", + "type.dictionary.ModelValueClient.putWithResponse": "Type.Dictionary.ModelValue.put", + "type.dictionary.NullableFloatValueAsyncClient": "Type.Dictionary.NullableFloatValue", + "type.dictionary.NullableFloatValueAsyncClient.get": "Type.Dictionary.NullableFloatValue.get", + "type.dictionary.NullableFloatValueAsyncClient.getWithResponse": "Type.Dictionary.NullableFloatValue.get", + "type.dictionary.NullableFloatValueAsyncClient.put": "Type.Dictionary.NullableFloatValue.put", + "type.dictionary.NullableFloatValueAsyncClient.putWithResponse": "Type.Dictionary.NullableFloatValue.put", + "type.dictionary.NullableFloatValueClient": "Type.Dictionary.NullableFloatValue", + "type.dictionary.NullableFloatValueClient.get": "Type.Dictionary.NullableFloatValue.get", + "type.dictionary.NullableFloatValueClient.getWithResponse": "Type.Dictionary.NullableFloatValue.get", + "type.dictionary.NullableFloatValueClient.put": "Type.Dictionary.NullableFloatValue.put", + "type.dictionary.NullableFloatValueClient.putWithResponse": "Type.Dictionary.NullableFloatValue.put", + "type.dictionary.RecursiveModelValueAsyncClient": "Type.Dictionary.RecursiveModelValue", + "type.dictionary.RecursiveModelValueAsyncClient.get": "Type.Dictionary.RecursiveModelValue.get", + "type.dictionary.RecursiveModelValueAsyncClient.getWithResponse": "Type.Dictionary.RecursiveModelValue.get", + "type.dictionary.RecursiveModelValueAsyncClient.put": "Type.Dictionary.RecursiveModelValue.put", + "type.dictionary.RecursiveModelValueAsyncClient.putWithResponse": "Type.Dictionary.RecursiveModelValue.put", + "type.dictionary.RecursiveModelValueClient": "Type.Dictionary.RecursiveModelValue", + "type.dictionary.RecursiveModelValueClient.get": "Type.Dictionary.RecursiveModelValue.get", + "type.dictionary.RecursiveModelValueClient.getWithResponse": "Type.Dictionary.RecursiveModelValue.get", + "type.dictionary.RecursiveModelValueClient.put": "Type.Dictionary.RecursiveModelValue.put", + "type.dictionary.RecursiveModelValueClient.putWithResponse": "Type.Dictionary.RecursiveModelValue.put", + "type.dictionary.StringValueAsyncClient": "Type.Dictionary.StringValue", + "type.dictionary.StringValueAsyncClient.get": "Type.Dictionary.StringValue.get", + "type.dictionary.StringValueAsyncClient.getWithResponse": "Type.Dictionary.StringValue.get", + "type.dictionary.StringValueAsyncClient.put": "Type.Dictionary.StringValue.put", + "type.dictionary.StringValueAsyncClient.putWithResponse": "Type.Dictionary.StringValue.put", + "type.dictionary.StringValueClient": "Type.Dictionary.StringValue", + "type.dictionary.StringValueClient.get": "Type.Dictionary.StringValue.get", + "type.dictionary.StringValueClient.getWithResponse": "Type.Dictionary.StringValue.get", + "type.dictionary.StringValueClient.put": "Type.Dictionary.StringValue.put", + "type.dictionary.StringValueClient.putWithResponse": "Type.Dictionary.StringValue.put", + "type.dictionary.UnknownValueAsyncClient": "Type.Dictionary.UnknownValue", + "type.dictionary.UnknownValueAsyncClient.get": "Type.Dictionary.UnknownValue.get", + "type.dictionary.UnknownValueAsyncClient.getWithResponse": "Type.Dictionary.UnknownValue.get", + "type.dictionary.UnknownValueAsyncClient.put": "Type.Dictionary.UnknownValue.put", + "type.dictionary.UnknownValueAsyncClient.putWithResponse": "Type.Dictionary.UnknownValue.put", + "type.dictionary.UnknownValueClient": "Type.Dictionary.UnknownValue", + "type.dictionary.UnknownValueClient.get": "Type.Dictionary.UnknownValue.get", + "type.dictionary.UnknownValueClient.getWithResponse": "Type.Dictionary.UnknownValue.get", + "type.dictionary.UnknownValueClient.put": "Type.Dictionary.UnknownValue.put", + "type.dictionary.UnknownValueClient.putWithResponse": "Type.Dictionary.UnknownValue.put", + "type.dictionary.models.InnerModel": "Type.Dictionary.InnerModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_metadata.json new file mode 100644 index 00000000000..6a781e5c329 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-dictionary_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.dictionary.BooleanValueAsyncClient":"Type.Dictionary.BooleanValue","type.dictionary.BooleanValueAsyncClient.get":"Type.Dictionary.BooleanValue.get","type.dictionary.BooleanValueAsyncClient.getWithResponse":"Type.Dictionary.BooleanValue.get","type.dictionary.BooleanValueAsyncClient.put":"Type.Dictionary.BooleanValue.put","type.dictionary.BooleanValueAsyncClient.putWithResponse":"Type.Dictionary.BooleanValue.put","type.dictionary.BooleanValueClient":"Type.Dictionary.BooleanValue","type.dictionary.BooleanValueClient.get":"Type.Dictionary.BooleanValue.get","type.dictionary.BooleanValueClient.getWithResponse":"Type.Dictionary.BooleanValue.get","type.dictionary.BooleanValueClient.put":"Type.Dictionary.BooleanValue.put","type.dictionary.BooleanValueClient.putWithResponse":"Type.Dictionary.BooleanValue.put","type.dictionary.DatetimeValueAsyncClient":"Type.Dictionary.DatetimeValue","type.dictionary.DatetimeValueAsyncClient.get":"Type.Dictionary.DatetimeValue.get","type.dictionary.DatetimeValueAsyncClient.getWithResponse":"Type.Dictionary.DatetimeValue.get","type.dictionary.DatetimeValueAsyncClient.put":"Type.Dictionary.DatetimeValue.put","type.dictionary.DatetimeValueAsyncClient.putWithResponse":"Type.Dictionary.DatetimeValue.put","type.dictionary.DatetimeValueClient":"Type.Dictionary.DatetimeValue","type.dictionary.DatetimeValueClient.get":"Type.Dictionary.DatetimeValue.get","type.dictionary.DatetimeValueClient.getWithResponse":"Type.Dictionary.DatetimeValue.get","type.dictionary.DatetimeValueClient.put":"Type.Dictionary.DatetimeValue.put","type.dictionary.DatetimeValueClient.putWithResponse":"Type.Dictionary.DatetimeValue.put","type.dictionary.DictionaryClientBuilder":"Type.Dictionary","type.dictionary.DurationValueAsyncClient":"Type.Dictionary.DurationValue","type.dictionary.DurationValueAsyncClient.get":"Type.Dictionary.DurationValue.get","type.dictionary.DurationValueAsyncClient.getWithResponse":"Type.Dictionary.DurationValue.get","type.dictionary.DurationValueAsyncClient.put":"Type.Dictionary.DurationValue.put","type.dictionary.DurationValueAsyncClient.putWithResponse":"Type.Dictionary.DurationValue.put","type.dictionary.DurationValueClient":"Type.Dictionary.DurationValue","type.dictionary.DurationValueClient.get":"Type.Dictionary.DurationValue.get","type.dictionary.DurationValueClient.getWithResponse":"Type.Dictionary.DurationValue.get","type.dictionary.DurationValueClient.put":"Type.Dictionary.DurationValue.put","type.dictionary.DurationValueClient.putWithResponse":"Type.Dictionary.DurationValue.put","type.dictionary.Float32ValueAsyncClient":"Type.Dictionary.Float32Value","type.dictionary.Float32ValueAsyncClient.get":"Type.Dictionary.Float32Value.get","type.dictionary.Float32ValueAsyncClient.getWithResponse":"Type.Dictionary.Float32Value.get","type.dictionary.Float32ValueAsyncClient.put":"Type.Dictionary.Float32Value.put","type.dictionary.Float32ValueAsyncClient.putWithResponse":"Type.Dictionary.Float32Value.put","type.dictionary.Float32ValueClient":"Type.Dictionary.Float32Value","type.dictionary.Float32ValueClient.get":"Type.Dictionary.Float32Value.get","type.dictionary.Float32ValueClient.getWithResponse":"Type.Dictionary.Float32Value.get","type.dictionary.Float32ValueClient.put":"Type.Dictionary.Float32Value.put","type.dictionary.Float32ValueClient.putWithResponse":"Type.Dictionary.Float32Value.put","type.dictionary.Int32ValueAsyncClient":"Type.Dictionary.Int32Value","type.dictionary.Int32ValueAsyncClient.get":"Type.Dictionary.Int32Value.get","type.dictionary.Int32ValueAsyncClient.getWithResponse":"Type.Dictionary.Int32Value.get","type.dictionary.Int32ValueAsyncClient.put":"Type.Dictionary.Int32Value.put","type.dictionary.Int32ValueAsyncClient.putWithResponse":"Type.Dictionary.Int32Value.put","type.dictionary.Int32ValueClient":"Type.Dictionary.Int32Value","type.dictionary.Int32ValueClient.get":"Type.Dictionary.Int32Value.get","type.dictionary.Int32ValueClient.getWithResponse":"Type.Dictionary.Int32Value.get","type.dictionary.Int32ValueClient.put":"Type.Dictionary.Int32Value.put","type.dictionary.Int32ValueClient.putWithResponse":"Type.Dictionary.Int32Value.put","type.dictionary.Int64ValueAsyncClient":"Type.Dictionary.Int64Value","type.dictionary.Int64ValueAsyncClient.get":"Type.Dictionary.Int64Value.get","type.dictionary.Int64ValueAsyncClient.getWithResponse":"Type.Dictionary.Int64Value.get","type.dictionary.Int64ValueAsyncClient.put":"Type.Dictionary.Int64Value.put","type.dictionary.Int64ValueAsyncClient.putWithResponse":"Type.Dictionary.Int64Value.put","type.dictionary.Int64ValueClient":"Type.Dictionary.Int64Value","type.dictionary.Int64ValueClient.get":"Type.Dictionary.Int64Value.get","type.dictionary.Int64ValueClient.getWithResponse":"Type.Dictionary.Int64Value.get","type.dictionary.Int64ValueClient.put":"Type.Dictionary.Int64Value.put","type.dictionary.Int64ValueClient.putWithResponse":"Type.Dictionary.Int64Value.put","type.dictionary.ModelValueAsyncClient":"Type.Dictionary.ModelValue","type.dictionary.ModelValueAsyncClient.get":"Type.Dictionary.ModelValue.get","type.dictionary.ModelValueAsyncClient.getWithResponse":"Type.Dictionary.ModelValue.get","type.dictionary.ModelValueAsyncClient.put":"Type.Dictionary.ModelValue.put","type.dictionary.ModelValueAsyncClient.putWithResponse":"Type.Dictionary.ModelValue.put","type.dictionary.ModelValueClient":"Type.Dictionary.ModelValue","type.dictionary.ModelValueClient.get":"Type.Dictionary.ModelValue.get","type.dictionary.ModelValueClient.getWithResponse":"Type.Dictionary.ModelValue.get","type.dictionary.ModelValueClient.put":"Type.Dictionary.ModelValue.put","type.dictionary.ModelValueClient.putWithResponse":"Type.Dictionary.ModelValue.put","type.dictionary.NullableFloatValueAsyncClient":"Type.Dictionary.NullableFloatValue","type.dictionary.NullableFloatValueAsyncClient.get":"Type.Dictionary.NullableFloatValue.get","type.dictionary.NullableFloatValueAsyncClient.getWithResponse":"Type.Dictionary.NullableFloatValue.get","type.dictionary.NullableFloatValueAsyncClient.put":"Type.Dictionary.NullableFloatValue.put","type.dictionary.NullableFloatValueAsyncClient.putWithResponse":"Type.Dictionary.NullableFloatValue.put","type.dictionary.NullableFloatValueClient":"Type.Dictionary.NullableFloatValue","type.dictionary.NullableFloatValueClient.get":"Type.Dictionary.NullableFloatValue.get","type.dictionary.NullableFloatValueClient.getWithResponse":"Type.Dictionary.NullableFloatValue.get","type.dictionary.NullableFloatValueClient.put":"Type.Dictionary.NullableFloatValue.put","type.dictionary.NullableFloatValueClient.putWithResponse":"Type.Dictionary.NullableFloatValue.put","type.dictionary.RecursiveModelValueAsyncClient":"Type.Dictionary.RecursiveModelValue","type.dictionary.RecursiveModelValueAsyncClient.get":"Type.Dictionary.RecursiveModelValue.get","type.dictionary.RecursiveModelValueAsyncClient.getWithResponse":"Type.Dictionary.RecursiveModelValue.get","type.dictionary.RecursiveModelValueAsyncClient.put":"Type.Dictionary.RecursiveModelValue.put","type.dictionary.RecursiveModelValueAsyncClient.putWithResponse":"Type.Dictionary.RecursiveModelValue.put","type.dictionary.RecursiveModelValueClient":"Type.Dictionary.RecursiveModelValue","type.dictionary.RecursiveModelValueClient.get":"Type.Dictionary.RecursiveModelValue.get","type.dictionary.RecursiveModelValueClient.getWithResponse":"Type.Dictionary.RecursiveModelValue.get","type.dictionary.RecursiveModelValueClient.put":"Type.Dictionary.RecursiveModelValue.put","type.dictionary.RecursiveModelValueClient.putWithResponse":"Type.Dictionary.RecursiveModelValue.put","type.dictionary.StringValueAsyncClient":"Type.Dictionary.StringValue","type.dictionary.StringValueAsyncClient.get":"Type.Dictionary.StringValue.get","type.dictionary.StringValueAsyncClient.getWithResponse":"Type.Dictionary.StringValue.get","type.dictionary.StringValueAsyncClient.put":"Type.Dictionary.StringValue.put","type.dictionary.StringValueAsyncClient.putWithResponse":"Type.Dictionary.StringValue.put","type.dictionary.StringValueClient":"Type.Dictionary.StringValue","type.dictionary.StringValueClient.get":"Type.Dictionary.StringValue.get","type.dictionary.StringValueClient.getWithResponse":"Type.Dictionary.StringValue.get","type.dictionary.StringValueClient.put":"Type.Dictionary.StringValue.put","type.dictionary.StringValueClient.putWithResponse":"Type.Dictionary.StringValue.put","type.dictionary.UnknownValueAsyncClient":"Type.Dictionary.UnknownValue","type.dictionary.UnknownValueAsyncClient.get":"Type.Dictionary.UnknownValue.get","type.dictionary.UnknownValueAsyncClient.getWithResponse":"Type.Dictionary.UnknownValue.get","type.dictionary.UnknownValueAsyncClient.put":"Type.Dictionary.UnknownValue.put","type.dictionary.UnknownValueAsyncClient.putWithResponse":"Type.Dictionary.UnknownValue.put","type.dictionary.UnknownValueClient":"Type.Dictionary.UnknownValue","type.dictionary.UnknownValueClient.get":"Type.Dictionary.UnknownValue.get","type.dictionary.UnknownValueClient.getWithResponse":"Type.Dictionary.UnknownValue.get","type.dictionary.UnknownValueClient.put":"Type.Dictionary.UnknownValue.put","type.dictionary.UnknownValueClient.putWithResponse":"Type.Dictionary.UnknownValue.put","type.dictionary.models.InnerModel":"Type.Dictionary.InnerModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/dictionary/BooleanValueAsyncClient.java","src/main/java/type/dictionary/BooleanValueClient.java","src/main/java/type/dictionary/DatetimeValueAsyncClient.java","src/main/java/type/dictionary/DatetimeValueClient.java","src/main/java/type/dictionary/DictionaryClientBuilder.java","src/main/java/type/dictionary/DurationValueAsyncClient.java","src/main/java/type/dictionary/DurationValueClient.java","src/main/java/type/dictionary/Float32ValueAsyncClient.java","src/main/java/type/dictionary/Float32ValueClient.java","src/main/java/type/dictionary/Int32ValueAsyncClient.java","src/main/java/type/dictionary/Int32ValueClient.java","src/main/java/type/dictionary/Int64ValueAsyncClient.java","src/main/java/type/dictionary/Int64ValueClient.java","src/main/java/type/dictionary/ModelValueAsyncClient.java","src/main/java/type/dictionary/ModelValueClient.java","src/main/java/type/dictionary/NullableFloatValueAsyncClient.java","src/main/java/type/dictionary/NullableFloatValueClient.java","src/main/java/type/dictionary/RecursiveModelValueAsyncClient.java","src/main/java/type/dictionary/RecursiveModelValueClient.java","src/main/java/type/dictionary/StringValueAsyncClient.java","src/main/java/type/dictionary/StringValueClient.java","src/main/java/type/dictionary/UnknownValueAsyncClient.java","src/main/java/type/dictionary/UnknownValueClient.java","src/main/java/type/dictionary/implementation/BooleanValuesImpl.java","src/main/java/type/dictionary/implementation/DatetimeValuesImpl.java","src/main/java/type/dictionary/implementation/DictionaryClientImpl.java","src/main/java/type/dictionary/implementation/DurationValuesImpl.java","src/main/java/type/dictionary/implementation/Float32ValuesImpl.java","src/main/java/type/dictionary/implementation/Int32ValuesImpl.java","src/main/java/type/dictionary/implementation/Int64ValuesImpl.java","src/main/java/type/dictionary/implementation/ModelValuesImpl.java","src/main/java/type/dictionary/implementation/NullableFloatValuesImpl.java","src/main/java/type/dictionary/implementation/RecursiveModelValuesImpl.java","src/main/java/type/dictionary/implementation/StringValuesImpl.java","src/main/java/type/dictionary/implementation/UnknownValuesImpl.java","src/main/java/type/dictionary/implementation/package-info.java","src/main/java/type/dictionary/models/InnerModel.java","src/main/java/type/dictionary/models/package-info.java","src/main/java/type/dictionary/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_apiview_properties.json new file mode 100644 index 00000000000..68ae6fa5542 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_apiview_properties.json @@ -0,0 +1,25 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.enums.extensible.ExtensibleAsyncClient": "Type.Enum.Extensible.String", + "type.enums.extensible.ExtensibleAsyncClient.getKnownValue": "Type.Enum.Extensible.String.getKnownValue", + "type.enums.extensible.ExtensibleAsyncClient.getKnownValueWithResponse": "Type.Enum.Extensible.String.getKnownValue", + "type.enums.extensible.ExtensibleAsyncClient.getUnknownValue": "Type.Enum.Extensible.String.getUnknownValue", + "type.enums.extensible.ExtensibleAsyncClient.getUnknownValueWithResponse": "Type.Enum.Extensible.String.getUnknownValue", + "type.enums.extensible.ExtensibleAsyncClient.putKnownValue": "Type.Enum.Extensible.String.putKnownValue", + "type.enums.extensible.ExtensibleAsyncClient.putKnownValueWithResponse": "Type.Enum.Extensible.String.putKnownValue", + "type.enums.extensible.ExtensibleAsyncClient.putUnknownValue": "Type.Enum.Extensible.String.putUnknownValue", + "type.enums.extensible.ExtensibleAsyncClient.putUnknownValueWithResponse": "Type.Enum.Extensible.String.putUnknownValue", + "type.enums.extensible.ExtensibleClient": "Type.Enum.Extensible.String", + "type.enums.extensible.ExtensibleClient.getKnownValue": "Type.Enum.Extensible.String.getKnownValue", + "type.enums.extensible.ExtensibleClient.getKnownValueWithResponse": "Type.Enum.Extensible.String.getKnownValue", + "type.enums.extensible.ExtensibleClient.getUnknownValue": "Type.Enum.Extensible.String.getUnknownValue", + "type.enums.extensible.ExtensibleClient.getUnknownValueWithResponse": "Type.Enum.Extensible.String.getUnknownValue", + "type.enums.extensible.ExtensibleClient.putKnownValue": "Type.Enum.Extensible.String.putKnownValue", + "type.enums.extensible.ExtensibleClient.putKnownValueWithResponse": "Type.Enum.Extensible.String.putKnownValue", + "type.enums.extensible.ExtensibleClient.putUnknownValue": "Type.Enum.Extensible.String.putUnknownValue", + "type.enums.extensible.ExtensibleClient.putUnknownValueWithResponse": "Type.Enum.Extensible.String.putUnknownValue", + "type.enums.extensible.ExtensibleClientBuilder": "Type.Enum.Extensible", + "type.enums.extensible.models.DaysOfWeekExtensibleEnum": "Type.Enum.Extensible.DaysOfWeekExtensibleEnum" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_metadata.json new file mode 100644 index 00000000000..075d5fc74f9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-extensible_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.enums.extensible.ExtensibleAsyncClient":"Type.Enum.Extensible.String","type.enums.extensible.ExtensibleAsyncClient.getKnownValue":"Type.Enum.Extensible.String.getKnownValue","type.enums.extensible.ExtensibleAsyncClient.getKnownValueWithResponse":"Type.Enum.Extensible.String.getKnownValue","type.enums.extensible.ExtensibleAsyncClient.getUnknownValue":"Type.Enum.Extensible.String.getUnknownValue","type.enums.extensible.ExtensibleAsyncClient.getUnknownValueWithResponse":"Type.Enum.Extensible.String.getUnknownValue","type.enums.extensible.ExtensibleAsyncClient.putKnownValue":"Type.Enum.Extensible.String.putKnownValue","type.enums.extensible.ExtensibleAsyncClient.putKnownValueWithResponse":"Type.Enum.Extensible.String.putKnownValue","type.enums.extensible.ExtensibleAsyncClient.putUnknownValue":"Type.Enum.Extensible.String.putUnknownValue","type.enums.extensible.ExtensibleAsyncClient.putUnknownValueWithResponse":"Type.Enum.Extensible.String.putUnknownValue","type.enums.extensible.ExtensibleClient":"Type.Enum.Extensible.String","type.enums.extensible.ExtensibleClient.getKnownValue":"Type.Enum.Extensible.String.getKnownValue","type.enums.extensible.ExtensibleClient.getKnownValueWithResponse":"Type.Enum.Extensible.String.getKnownValue","type.enums.extensible.ExtensibleClient.getUnknownValue":"Type.Enum.Extensible.String.getUnknownValue","type.enums.extensible.ExtensibleClient.getUnknownValueWithResponse":"Type.Enum.Extensible.String.getUnknownValue","type.enums.extensible.ExtensibleClient.putKnownValue":"Type.Enum.Extensible.String.putKnownValue","type.enums.extensible.ExtensibleClient.putKnownValueWithResponse":"Type.Enum.Extensible.String.putKnownValue","type.enums.extensible.ExtensibleClient.putUnknownValue":"Type.Enum.Extensible.String.putUnknownValue","type.enums.extensible.ExtensibleClient.putUnknownValueWithResponse":"Type.Enum.Extensible.String.putUnknownValue","type.enums.extensible.ExtensibleClientBuilder":"Type.Enum.Extensible","type.enums.extensible.models.DaysOfWeekExtensibleEnum":"Type.Enum.Extensible.DaysOfWeekExtensibleEnum"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/enums/extensible/ExtensibleAsyncClient.java","src/main/java/type/enums/extensible/ExtensibleClient.java","src/main/java/type/enums/extensible/ExtensibleClientBuilder.java","src/main/java/type/enums/extensible/implementation/ExtensibleClientImpl.java","src/main/java/type/enums/extensible/implementation/StringOperationsImpl.java","src/main/java/type/enums/extensible/implementation/package-info.java","src/main/java/type/enums/extensible/models/DaysOfWeekExtensibleEnum.java","src/main/java/type/enums/extensible/models/package-info.java","src/main/java/type/enums/extensible/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_apiview_properties.json new file mode 100644 index 00000000000..1db0b5526e2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_apiview_properties.json @@ -0,0 +1,21 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.enums.fixed.FixedAsyncClient": "Type.Enum.Fixed.String", + "type.enums.fixed.FixedAsyncClient.getKnownValue": "Type.Enum.Fixed.String.getKnownValue", + "type.enums.fixed.FixedAsyncClient.getKnownValueWithResponse": "Type.Enum.Fixed.String.getKnownValue", + "type.enums.fixed.FixedAsyncClient.putKnownValue": "Type.Enum.Fixed.String.putKnownValue", + "type.enums.fixed.FixedAsyncClient.putKnownValueWithResponse": "Type.Enum.Fixed.String.putKnownValue", + "type.enums.fixed.FixedAsyncClient.putUnknownValue": "Type.Enum.Fixed.String.putUnknownValue", + "type.enums.fixed.FixedAsyncClient.putUnknownValueWithResponse": "Type.Enum.Fixed.String.putUnknownValue", + "type.enums.fixed.FixedClient": "Type.Enum.Fixed.String", + "type.enums.fixed.FixedClient.getKnownValue": "Type.Enum.Fixed.String.getKnownValue", + "type.enums.fixed.FixedClient.getKnownValueWithResponse": "Type.Enum.Fixed.String.getKnownValue", + "type.enums.fixed.FixedClient.putKnownValue": "Type.Enum.Fixed.String.putKnownValue", + "type.enums.fixed.FixedClient.putKnownValueWithResponse": "Type.Enum.Fixed.String.putKnownValue", + "type.enums.fixed.FixedClient.putUnknownValue": "Type.Enum.Fixed.String.putUnknownValue", + "type.enums.fixed.FixedClient.putUnknownValueWithResponse": "Type.Enum.Fixed.String.putUnknownValue", + "type.enums.fixed.FixedClientBuilder": "Type.Enum.Fixed", + "type.enums.fixed.models.DaysOfWeekEnum": "Type.Enum.Fixed.DaysOfWeekEnum" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_metadata.json new file mode 100644 index 00000000000..7ac8ef536fd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-enums-fixed_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.enums.fixed.FixedAsyncClient":"Type.Enum.Fixed.String","type.enums.fixed.FixedAsyncClient.getKnownValue":"Type.Enum.Fixed.String.getKnownValue","type.enums.fixed.FixedAsyncClient.getKnownValueWithResponse":"Type.Enum.Fixed.String.getKnownValue","type.enums.fixed.FixedAsyncClient.putKnownValue":"Type.Enum.Fixed.String.putKnownValue","type.enums.fixed.FixedAsyncClient.putKnownValueWithResponse":"Type.Enum.Fixed.String.putKnownValue","type.enums.fixed.FixedAsyncClient.putUnknownValue":"Type.Enum.Fixed.String.putUnknownValue","type.enums.fixed.FixedAsyncClient.putUnknownValueWithResponse":"Type.Enum.Fixed.String.putUnknownValue","type.enums.fixed.FixedClient":"Type.Enum.Fixed.String","type.enums.fixed.FixedClient.getKnownValue":"Type.Enum.Fixed.String.getKnownValue","type.enums.fixed.FixedClient.getKnownValueWithResponse":"Type.Enum.Fixed.String.getKnownValue","type.enums.fixed.FixedClient.putKnownValue":"Type.Enum.Fixed.String.putKnownValue","type.enums.fixed.FixedClient.putKnownValueWithResponse":"Type.Enum.Fixed.String.putKnownValue","type.enums.fixed.FixedClient.putUnknownValue":"Type.Enum.Fixed.String.putUnknownValue","type.enums.fixed.FixedClient.putUnknownValueWithResponse":"Type.Enum.Fixed.String.putUnknownValue","type.enums.fixed.FixedClientBuilder":"Type.Enum.Fixed","type.enums.fixed.models.DaysOfWeekEnum":"Type.Enum.Fixed.DaysOfWeekEnum"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/enums/fixed/FixedAsyncClient.java","src/main/java/type/enums/fixed/FixedClient.java","src/main/java/type/enums/fixed/FixedClientBuilder.java","src/main/java/type/enums/fixed/implementation/FixedClientImpl.java","src/main/java/type/enums/fixed/implementation/StringOperationsImpl.java","src/main/java/type/enums/fixed/implementation/package-info.java","src/main/java/type/enums/fixed/models/DaysOfWeekEnum.java","src/main/java/type/enums/fixed/models/package-info.java","src/main/java/type/enums/fixed/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_apiview_properties.json new file mode 100644 index 00000000000..23111e92cea --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_apiview_properties.json @@ -0,0 +1,23 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.model.empty.EmptyAsyncClient": "Type.Model.Empty", + "type.model.empty.EmptyAsyncClient.getEmpty": "Type.Model.Empty.getEmpty", + "type.model.empty.EmptyAsyncClient.getEmptyWithResponse": "Type.Model.Empty.getEmpty", + "type.model.empty.EmptyAsyncClient.postRoundTripEmpty": "Type.Model.Empty.postRoundTripEmpty", + "type.model.empty.EmptyAsyncClient.postRoundTripEmptyWithResponse": "Type.Model.Empty.postRoundTripEmpty", + "type.model.empty.EmptyAsyncClient.putEmpty": "Type.Model.Empty.putEmpty", + "type.model.empty.EmptyAsyncClient.putEmptyWithResponse": "Type.Model.Empty.putEmpty", + "type.model.empty.EmptyClient": "Type.Model.Empty", + "type.model.empty.EmptyClient.getEmpty": "Type.Model.Empty.getEmpty", + "type.model.empty.EmptyClient.getEmptyWithResponse": "Type.Model.Empty.getEmpty", + "type.model.empty.EmptyClient.postRoundTripEmpty": "Type.Model.Empty.postRoundTripEmpty", + "type.model.empty.EmptyClient.postRoundTripEmptyWithResponse": "Type.Model.Empty.postRoundTripEmpty", + "type.model.empty.EmptyClient.putEmpty": "Type.Model.Empty.putEmpty", + "type.model.empty.EmptyClient.putEmptyWithResponse": "Type.Model.Empty.putEmpty", + "type.model.empty.EmptyClientBuilder": "Type.Model.Empty", + "type.model.empty.models.EmptyInput": "Type.Model.Empty.EmptyInput", + "type.model.empty.models.EmptyInputOutput": "Type.Model.Empty.EmptyInputOutput", + "type.model.empty.models.EmptyOutput": "Type.Model.Empty.EmptyOutput" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_metadata.json new file mode 100644 index 00000000000..155723389ed --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-empty_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.model.empty.EmptyAsyncClient":"Type.Model.Empty","type.model.empty.EmptyAsyncClient.getEmpty":"Type.Model.Empty.getEmpty","type.model.empty.EmptyAsyncClient.getEmptyWithResponse":"Type.Model.Empty.getEmpty","type.model.empty.EmptyAsyncClient.postRoundTripEmpty":"Type.Model.Empty.postRoundTripEmpty","type.model.empty.EmptyAsyncClient.postRoundTripEmptyWithResponse":"Type.Model.Empty.postRoundTripEmpty","type.model.empty.EmptyAsyncClient.putEmpty":"Type.Model.Empty.putEmpty","type.model.empty.EmptyAsyncClient.putEmptyWithResponse":"Type.Model.Empty.putEmpty","type.model.empty.EmptyClient":"Type.Model.Empty","type.model.empty.EmptyClient.getEmpty":"Type.Model.Empty.getEmpty","type.model.empty.EmptyClient.getEmptyWithResponse":"Type.Model.Empty.getEmpty","type.model.empty.EmptyClient.postRoundTripEmpty":"Type.Model.Empty.postRoundTripEmpty","type.model.empty.EmptyClient.postRoundTripEmptyWithResponse":"Type.Model.Empty.postRoundTripEmpty","type.model.empty.EmptyClient.putEmpty":"Type.Model.Empty.putEmpty","type.model.empty.EmptyClient.putEmptyWithResponse":"Type.Model.Empty.putEmpty","type.model.empty.EmptyClientBuilder":"Type.Model.Empty","type.model.empty.models.EmptyInput":"Type.Model.Empty.EmptyInput","type.model.empty.models.EmptyInputOutput":"Type.Model.Empty.EmptyInputOutput","type.model.empty.models.EmptyOutput":"Type.Model.Empty.EmptyOutput"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/empty/EmptyAsyncClient.java","src/main/java/type/model/empty/EmptyClient.java","src/main/java/type/model/empty/EmptyClientBuilder.java","src/main/java/type/model/empty/implementation/EmptyClientImpl.java","src/main/java/type/model/empty/implementation/package-info.java","src/main/java/type/model/empty/models/EmptyInput.java","src/main/java/type/model/empty/models/EmptyInputOutput.java","src/main/java/type/model/empty/models/EmptyOutput.java","src/main/java/type/model/empty/models/package-info.java","src/main/java/type/model/empty/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_apiview_properties.json new file mode 100644 index 00000000000..a2ac2ec8474 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_apiview_properties.json @@ -0,0 +1,46 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient": "Type.Model.Inheritance.EnumDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModel": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelMissingDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelMissingDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelWrongDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelWrongDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModel": "Type.Model.Inheritance.EnumDiscriminator.getFixedModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelMissingDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelMissingDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getFixedModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelWrongDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelWrongDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putExtensibleModel": "Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putExtensibleModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putFixedModel": "Type.Model.Inheritance.EnumDiscriminator.putFixedModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putFixedModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.putFixedModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient": "Type.Model.Inheritance.EnumDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModel": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelMissingDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelMissingDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelWrongDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelWrongDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModel": "Type.Model.Inheritance.EnumDiscriminator.getFixedModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelMissingDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelMissingDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getFixedModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelWrongDiscriminator": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelWrongDiscriminatorWithResponse": "Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putExtensibleModel": "Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putExtensibleModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putFixedModel": "Type.Model.Inheritance.EnumDiscriminator.putFixedModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putFixedModelWithResponse": "Type.Model.Inheritance.EnumDiscriminator.putFixedModel", + "type.model.inheritance.enumdiscriminator.EnumDiscriminatorClientBuilder": "Type.Model.Inheritance.EnumDiscriminator", + "type.model.inheritance.enumdiscriminator.models.Cobra": "Type.Model.Inheritance.EnumDiscriminator.Cobra", + "type.model.inheritance.enumdiscriminator.models.Dog": "Type.Model.Inheritance.EnumDiscriminator.Dog", + "type.model.inheritance.enumdiscriminator.models.DogKind": "Type.Model.Inheritance.EnumDiscriminator.DogKind", + "type.model.inheritance.enumdiscriminator.models.Golden": "Type.Model.Inheritance.EnumDiscriminator.Golden", + "type.model.inheritance.enumdiscriminator.models.Snake": "Type.Model.Inheritance.EnumDiscriminator.Snake", + "type.model.inheritance.enumdiscriminator.models.SnakeKind": "Type.Model.Inheritance.EnumDiscriminator.SnakeKind" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_metadata.json new file mode 100644 index 00000000000..5720ee41028 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-enumdiscriminator_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient":"Type.Model.Inheritance.EnumDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModel":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelMissingDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelMissingDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelWrongDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getExtensibleModelWrongDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModel":"Type.Model.Inheritance.EnumDiscriminator.getFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelMissingDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelMissingDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelWrongDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.getFixedModelWrongDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putExtensibleModel":"Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putExtensibleModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putFixedModel":"Type.Model.Inheritance.EnumDiscriminator.putFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorAsyncClient.putFixedModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.putFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient":"Type.Model.Inheritance.EnumDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModel":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelMissingDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelMissingDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelWrongDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getExtensibleModelWrongDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getExtensibleModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModel":"Type.Model.Inheritance.EnumDiscriminator.getFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelMissingDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelMissingDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelMissingDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelWrongDiscriminator":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.getFixedModelWrongDiscriminatorWithResponse":"Type.Model.Inheritance.EnumDiscriminator.getFixedModelWrongDiscriminator","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putExtensibleModel":"Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putExtensibleModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.putExtensibleModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putFixedModel":"Type.Model.Inheritance.EnumDiscriminator.putFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient.putFixedModelWithResponse":"Type.Model.Inheritance.EnumDiscriminator.putFixedModel","type.model.inheritance.enumdiscriminator.EnumDiscriminatorClientBuilder":"Type.Model.Inheritance.EnumDiscriminator","type.model.inheritance.enumdiscriminator.models.Cobra":"Type.Model.Inheritance.EnumDiscriminator.Cobra","type.model.inheritance.enumdiscriminator.models.Dog":"Type.Model.Inheritance.EnumDiscriminator.Dog","type.model.inheritance.enumdiscriminator.models.DogKind":"Type.Model.Inheritance.EnumDiscriminator.DogKind","type.model.inheritance.enumdiscriminator.models.Golden":"Type.Model.Inheritance.EnumDiscriminator.Golden","type.model.inheritance.enumdiscriminator.models.Snake":"Type.Model.Inheritance.EnumDiscriminator.Snake","type.model.inheritance.enumdiscriminator.models.SnakeKind":"Type.Model.Inheritance.EnumDiscriminator.SnakeKind"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorAsyncClient.java","src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClient.java","src/main/java/type/model/inheritance/enumdiscriminator/EnumDiscriminatorClientBuilder.java","src/main/java/type/model/inheritance/enumdiscriminator/implementation/EnumDiscriminatorClientImpl.java","src/main/java/type/model/inheritance/enumdiscriminator/implementation/package-info.java","src/main/java/type/model/inheritance/enumdiscriminator/models/Cobra.java","src/main/java/type/model/inheritance/enumdiscriminator/models/Dog.java","src/main/java/type/model/inheritance/enumdiscriminator/models/DogKind.java","src/main/java/type/model/inheritance/enumdiscriminator/models/Golden.java","src/main/java/type/model/inheritance/enumdiscriminator/models/Snake.java","src/main/java/type/model/inheritance/enumdiscriminator/models/SnakeKind.java","src/main/java/type/model/inheritance/enumdiscriminator/models/package-info.java","src/main/java/type/model/inheritance/enumdiscriminator/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_apiview_properties.json new file mode 100644 index 00000000000..16c4638dfda --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_apiview_properties.json @@ -0,0 +1,37 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient": "Type.Model.Inheritance.NestedDiscriminator", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getMissingDiscriminator": "Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getMissingDiscriminatorWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getModel": "Type.Model.Inheritance.NestedDiscriminator.getModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getRecursiveModel": "Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getRecursiveModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getWrongDiscriminator": "Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getWrongDiscriminatorWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putModel": "Type.Model.Inheritance.NestedDiscriminator.putModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.putModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putRecursiveModel": "Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putRecursiveModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient": "Type.Model.Inheritance.NestedDiscriminator", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getMissingDiscriminator": "Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getMissingDiscriminatorWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getModel": "Type.Model.Inheritance.NestedDiscriminator.getModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getRecursiveModel": "Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getRecursiveModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getWrongDiscriminator": "Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getWrongDiscriminatorWithResponse": "Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putModel": "Type.Model.Inheritance.NestedDiscriminator.putModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.putModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putRecursiveModel": "Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putRecursiveModelWithResponse": "Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel", + "type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClientBuilder": "Type.Model.Inheritance.NestedDiscriminator", + "type.model.inheritance.nesteddiscriminator.models.Fish": "Type.Model.Inheritance.NestedDiscriminator.Fish", + "type.model.inheritance.nesteddiscriminator.models.GoblinShark": "Type.Model.Inheritance.NestedDiscriminator.GoblinShark", + "type.model.inheritance.nesteddiscriminator.models.Salmon": "Type.Model.Inheritance.NestedDiscriminator.Salmon", + "type.model.inheritance.nesteddiscriminator.models.SawShark": "Type.Model.Inheritance.NestedDiscriminator.SawShark", + "type.model.inheritance.nesteddiscriminator.models.Shark": "Type.Model.Inheritance.NestedDiscriminator.Shark" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_metadata.json new file mode 100644 index 00000000000..6ce5aa5e40a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-nesteddiscriminator_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient":"Type.Model.Inheritance.NestedDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getMissingDiscriminator":"Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getMissingDiscriminatorWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getModel":"Type.Model.Inheritance.NestedDiscriminator.getModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getRecursiveModel":"Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getRecursiveModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getWrongDiscriminator":"Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.getWrongDiscriminatorWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putModel":"Type.Model.Inheritance.NestedDiscriminator.putModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.putModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putRecursiveModel":"Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorAsyncClient.putRecursiveModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient":"Type.Model.Inheritance.NestedDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getMissingDiscriminator":"Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getMissingDiscriminatorWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getMissingDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getModel":"Type.Model.Inheritance.NestedDiscriminator.getModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getRecursiveModel":"Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getRecursiveModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getWrongDiscriminator":"Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.getWrongDiscriminatorWithResponse":"Type.Model.Inheritance.NestedDiscriminator.getWrongDiscriminator","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putModel":"Type.Model.Inheritance.NestedDiscriminator.putModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.putModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putRecursiveModel":"Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient.putRecursiveModelWithResponse":"Type.Model.Inheritance.NestedDiscriminator.putRecursiveModel","type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClientBuilder":"Type.Model.Inheritance.NestedDiscriminator","type.model.inheritance.nesteddiscriminator.models.Fish":"Type.Model.Inheritance.NestedDiscriminator.Fish","type.model.inheritance.nesteddiscriminator.models.GoblinShark":"Type.Model.Inheritance.NestedDiscriminator.GoblinShark","type.model.inheritance.nesteddiscriminator.models.Salmon":"Type.Model.Inheritance.NestedDiscriminator.Salmon","type.model.inheritance.nesteddiscriminator.models.SawShark":"Type.Model.Inheritance.NestedDiscriminator.SawShark","type.model.inheritance.nesteddiscriminator.models.Shark":"Type.Model.Inheritance.NestedDiscriminator.Shark"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorAsyncClient.java","src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClient.java","src/main/java/type/model/inheritance/nesteddiscriminator/NestedDiscriminatorClientBuilder.java","src/main/java/type/model/inheritance/nesteddiscriminator/implementation/NestedDiscriminatorClientImpl.java","src/main/java/type/model/inheritance/nesteddiscriminator/implementation/package-info.java","src/main/java/type/model/inheritance/nesteddiscriminator/models/Fish.java","src/main/java/type/model/inheritance/nesteddiscriminator/models/GoblinShark.java","src/main/java/type/model/inheritance/nesteddiscriminator/models/Salmon.java","src/main/java/type/model/inheritance/nesteddiscriminator/models/SawShark.java","src/main/java/type/model/inheritance/nesteddiscriminator/models/Shark.java","src/main/java/type/model/inheritance/nesteddiscriminator/models/package-info.java","src/main/java/type/model/inheritance/nesteddiscriminator/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_apiview_properties.json new file mode 100644 index 00000000000..c46978d245b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_apiview_properties.json @@ -0,0 +1,23 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient": "Type.Model.Inheritance.NotDiscriminated", + "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.getValid": "Type.Model.Inheritance.NotDiscriminated.getValid", + "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.getValidWithResponse": "Type.Model.Inheritance.NotDiscriminated.getValid", + "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.postValid": "Type.Model.Inheritance.NotDiscriminated.postValid", + "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.postValidWithResponse": "Type.Model.Inheritance.NotDiscriminated.postValid", + "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.putValid": "Type.Model.Inheritance.NotDiscriminated.putValid", + "type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.putValidWithResponse": "Type.Model.Inheritance.NotDiscriminated.putValid", + "type.model.inheritance.notdiscriminated.NotDiscriminatedClient": "Type.Model.Inheritance.NotDiscriminated", + "type.model.inheritance.notdiscriminated.NotDiscriminatedClient.getValid": "Type.Model.Inheritance.NotDiscriminated.getValid", + "type.model.inheritance.notdiscriminated.NotDiscriminatedClient.getValidWithResponse": "Type.Model.Inheritance.NotDiscriminated.getValid", + "type.model.inheritance.notdiscriminated.NotDiscriminatedClient.postValid": "Type.Model.Inheritance.NotDiscriminated.postValid", + "type.model.inheritance.notdiscriminated.NotDiscriminatedClient.postValidWithResponse": "Type.Model.Inheritance.NotDiscriminated.postValid", + "type.model.inheritance.notdiscriminated.NotDiscriminatedClient.putValid": "Type.Model.Inheritance.NotDiscriminated.putValid", + "type.model.inheritance.notdiscriminated.NotDiscriminatedClient.putValidWithResponse": "Type.Model.Inheritance.NotDiscriminated.putValid", + "type.model.inheritance.notdiscriminated.NotDiscriminatedClientBuilder": "Type.Model.Inheritance.NotDiscriminated", + "type.model.inheritance.notdiscriminated.models.Cat": "Type.Model.Inheritance.NotDiscriminated.Cat", + "type.model.inheritance.notdiscriminated.models.Pet": "Type.Model.Inheritance.NotDiscriminated.Pet", + "type.model.inheritance.notdiscriminated.models.Siamese": "Type.Model.Inheritance.NotDiscriminated.Siamese" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_metadata.json new file mode 100644 index 00000000000..2d2dd758f5c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-notdiscriminated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient":"Type.Model.Inheritance.NotDiscriminated","type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.getValid":"Type.Model.Inheritance.NotDiscriminated.getValid","type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.getValidWithResponse":"Type.Model.Inheritance.NotDiscriminated.getValid","type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.postValid":"Type.Model.Inheritance.NotDiscriminated.postValid","type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.postValidWithResponse":"Type.Model.Inheritance.NotDiscriminated.postValid","type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.putValid":"Type.Model.Inheritance.NotDiscriminated.putValid","type.model.inheritance.notdiscriminated.NotDiscriminatedAsyncClient.putValidWithResponse":"Type.Model.Inheritance.NotDiscriminated.putValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClient":"Type.Model.Inheritance.NotDiscriminated","type.model.inheritance.notdiscriminated.NotDiscriminatedClient.getValid":"Type.Model.Inheritance.NotDiscriminated.getValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClient.getValidWithResponse":"Type.Model.Inheritance.NotDiscriminated.getValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClient.postValid":"Type.Model.Inheritance.NotDiscriminated.postValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClient.postValidWithResponse":"Type.Model.Inheritance.NotDiscriminated.postValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClient.putValid":"Type.Model.Inheritance.NotDiscriminated.putValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClient.putValidWithResponse":"Type.Model.Inheritance.NotDiscriminated.putValid","type.model.inheritance.notdiscriminated.NotDiscriminatedClientBuilder":"Type.Model.Inheritance.NotDiscriminated","type.model.inheritance.notdiscriminated.models.Cat":"Type.Model.Inheritance.NotDiscriminated.Cat","type.model.inheritance.notdiscriminated.models.Pet":"Type.Model.Inheritance.NotDiscriminated.Pet","type.model.inheritance.notdiscriminated.models.Siamese":"Type.Model.Inheritance.NotDiscriminated.Siamese"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedAsyncClient.java","src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClient.java","src/main/java/type/model/inheritance/notdiscriminated/NotDiscriminatedClientBuilder.java","src/main/java/type/model/inheritance/notdiscriminated/implementation/NotDiscriminatedClientImpl.java","src/main/java/type/model/inheritance/notdiscriminated/implementation/package-info.java","src/main/java/type/model/inheritance/notdiscriminated/models/Cat.java","src/main/java/type/model/inheritance/notdiscriminated/models/Pet.java","src/main/java/type/model/inheritance/notdiscriminated/models/Siamese.java","src/main/java/type/model/inheritance/notdiscriminated/models/package-info.java","src/main/java/type/model/inheritance/notdiscriminated/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_apiview_properties.json new file mode 100644 index 00000000000..3aa7ccfa566 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_apiview_properties.json @@ -0,0 +1,18 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.model.inheritance.recursive.RecursiveAsyncClient": "Type.Model.Inheritance.Recursive", + "type.model.inheritance.recursive.RecursiveAsyncClient.get": "Type.Model.Inheritance.Recursive.get", + "type.model.inheritance.recursive.RecursiveAsyncClient.getWithResponse": "Type.Model.Inheritance.Recursive.get", + "type.model.inheritance.recursive.RecursiveAsyncClient.put": "Type.Model.Inheritance.Recursive.put", + "type.model.inheritance.recursive.RecursiveAsyncClient.putWithResponse": "Type.Model.Inheritance.Recursive.put", + "type.model.inheritance.recursive.RecursiveClient": "Type.Model.Inheritance.Recursive", + "type.model.inheritance.recursive.RecursiveClient.get": "Type.Model.Inheritance.Recursive.get", + "type.model.inheritance.recursive.RecursiveClient.getWithResponse": "Type.Model.Inheritance.Recursive.get", + "type.model.inheritance.recursive.RecursiveClient.put": "Type.Model.Inheritance.Recursive.put", + "type.model.inheritance.recursive.RecursiveClient.putWithResponse": "Type.Model.Inheritance.Recursive.put", + "type.model.inheritance.recursive.RecursiveClientBuilder": "Type.Model.Inheritance.Recursive", + "type.model.inheritance.recursive.models.Element": "Type.Model.Inheritance.Recursive.Element", + "type.model.inheritance.recursive.models.Extension": "Type.Model.Inheritance.Recursive.Extension" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_metadata.json new file mode 100644 index 00000000000..d7a2cbc5660 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-recursive_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.model.inheritance.recursive.RecursiveAsyncClient":"Type.Model.Inheritance.Recursive","type.model.inheritance.recursive.RecursiveAsyncClient.get":"Type.Model.Inheritance.Recursive.get","type.model.inheritance.recursive.RecursiveAsyncClient.getWithResponse":"Type.Model.Inheritance.Recursive.get","type.model.inheritance.recursive.RecursiveAsyncClient.put":"Type.Model.Inheritance.Recursive.put","type.model.inheritance.recursive.RecursiveAsyncClient.putWithResponse":"Type.Model.Inheritance.Recursive.put","type.model.inheritance.recursive.RecursiveClient":"Type.Model.Inheritance.Recursive","type.model.inheritance.recursive.RecursiveClient.get":"Type.Model.Inheritance.Recursive.get","type.model.inheritance.recursive.RecursiveClient.getWithResponse":"Type.Model.Inheritance.Recursive.get","type.model.inheritance.recursive.RecursiveClient.put":"Type.Model.Inheritance.Recursive.put","type.model.inheritance.recursive.RecursiveClient.putWithResponse":"Type.Model.Inheritance.Recursive.put","type.model.inheritance.recursive.RecursiveClientBuilder":"Type.Model.Inheritance.Recursive","type.model.inheritance.recursive.models.Element":"Type.Model.Inheritance.Recursive.Element","type.model.inheritance.recursive.models.Extension":"Type.Model.Inheritance.Recursive.Extension"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/inheritance/recursive/RecursiveAsyncClient.java","src/main/java/type/model/inheritance/recursive/RecursiveClient.java","src/main/java/type/model/inheritance/recursive/RecursiveClientBuilder.java","src/main/java/type/model/inheritance/recursive/implementation/RecursiveClientImpl.java","src/main/java/type/model/inheritance/recursive/implementation/package-info.java","src/main/java/type/model/inheritance/recursive/models/Element.java","src/main/java/type/model/inheritance/recursive/models/Extension.java","src/main/java/type/model/inheritance/recursive/models/package-info.java","src/main/java/type/model/inheritance/recursive/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_apiview_properties.json new file mode 100644 index 00000000000..f4ba5935669 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_apiview_properties.json @@ -0,0 +1,43 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient": "Type.Model.Inheritance.SingleDiscriminator", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getLegacyModel": "Type.Model.Inheritance.SingleDiscriminator.getLegacyModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getLegacyModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getLegacyModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getMissingDiscriminator": "Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getMissingDiscriminatorWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getModel": "Type.Model.Inheritance.SingleDiscriminator.getModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getRecursiveModel": "Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getRecursiveModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getWrongDiscriminator": "Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getWrongDiscriminatorWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putModel": "Type.Model.Inheritance.SingleDiscriminator.putModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.putModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putRecursiveModel": "Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putRecursiveModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient": "Type.Model.Inheritance.SingleDiscriminator", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getLegacyModel": "Type.Model.Inheritance.SingleDiscriminator.getLegacyModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getLegacyModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getLegacyModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getMissingDiscriminator": "Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getMissingDiscriminatorWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getModel": "Type.Model.Inheritance.SingleDiscriminator.getModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getRecursiveModel": "Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getRecursiveModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getWrongDiscriminator": "Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getWrongDiscriminatorWithResponse": "Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putModel": "Type.Model.Inheritance.SingleDiscriminator.putModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.putModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putRecursiveModel": "Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putRecursiveModelWithResponse": "Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel", + "type.model.inheritance.singlediscriminator.SingleDiscriminatorClientBuilder": "Type.Model.Inheritance.SingleDiscriminator", + "type.model.inheritance.singlediscriminator.models.Bird": "Type.Model.Inheritance.SingleDiscriminator.Bird", + "type.model.inheritance.singlediscriminator.models.Dinosaur": "Type.Model.Inheritance.SingleDiscriminator.Dinosaur", + "type.model.inheritance.singlediscriminator.models.Eagle": "Type.Model.Inheritance.SingleDiscriminator.Eagle", + "type.model.inheritance.singlediscriminator.models.Goose": "Type.Model.Inheritance.SingleDiscriminator.Goose", + "type.model.inheritance.singlediscriminator.models.SeaGull": "Type.Model.Inheritance.SingleDiscriminator.SeaGull", + "type.model.inheritance.singlediscriminator.models.Sparrow": "Type.Model.Inheritance.SingleDiscriminator.Sparrow", + "type.model.inheritance.singlediscriminator.models.TRex": "Type.Model.Inheritance.SingleDiscriminator.TRex" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_metadata.json new file mode 100644 index 00000000000..b3d3a183378 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-inheritance-singlediscriminator_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient":"Type.Model.Inheritance.SingleDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getLegacyModel":"Type.Model.Inheritance.SingleDiscriminator.getLegacyModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getLegacyModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getLegacyModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getMissingDiscriminator":"Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getMissingDiscriminatorWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getModel":"Type.Model.Inheritance.SingleDiscriminator.getModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getRecursiveModel":"Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getRecursiveModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getWrongDiscriminator":"Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.getWrongDiscriminatorWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putModel":"Type.Model.Inheritance.SingleDiscriminator.putModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.putModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putRecursiveModel":"Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorAsyncClient.putRecursiveModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient":"Type.Model.Inheritance.SingleDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getLegacyModel":"Type.Model.Inheritance.SingleDiscriminator.getLegacyModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getLegacyModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getLegacyModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getMissingDiscriminator":"Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getMissingDiscriminatorWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getMissingDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getModel":"Type.Model.Inheritance.SingleDiscriminator.getModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getRecursiveModel":"Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getRecursiveModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getWrongDiscriminator":"Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.getWrongDiscriminatorWithResponse":"Type.Model.Inheritance.SingleDiscriminator.getWrongDiscriminator","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putModel":"Type.Model.Inheritance.SingleDiscriminator.putModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.putModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putRecursiveModel":"Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClient.putRecursiveModelWithResponse":"Type.Model.Inheritance.SingleDiscriminator.putRecursiveModel","type.model.inheritance.singlediscriminator.SingleDiscriminatorClientBuilder":"Type.Model.Inheritance.SingleDiscriminator","type.model.inheritance.singlediscriminator.models.Bird":"Type.Model.Inheritance.SingleDiscriminator.Bird","type.model.inheritance.singlediscriminator.models.Dinosaur":"Type.Model.Inheritance.SingleDiscriminator.Dinosaur","type.model.inheritance.singlediscriminator.models.Eagle":"Type.Model.Inheritance.SingleDiscriminator.Eagle","type.model.inheritance.singlediscriminator.models.Goose":"Type.Model.Inheritance.SingleDiscriminator.Goose","type.model.inheritance.singlediscriminator.models.SeaGull":"Type.Model.Inheritance.SingleDiscriminator.SeaGull","type.model.inheritance.singlediscriminator.models.Sparrow":"Type.Model.Inheritance.SingleDiscriminator.Sparrow","type.model.inheritance.singlediscriminator.models.TRex":"Type.Model.Inheritance.SingleDiscriminator.TRex"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorAsyncClient.java","src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClient.java","src/main/java/type/model/inheritance/singlediscriminator/SingleDiscriminatorClientBuilder.java","src/main/java/type/model/inheritance/singlediscriminator/implementation/SingleDiscriminatorClientImpl.java","src/main/java/type/model/inheritance/singlediscriminator/implementation/package-info.java","src/main/java/type/model/inheritance/singlediscriminator/models/Bird.java","src/main/java/type/model/inheritance/singlediscriminator/models/Dinosaur.java","src/main/java/type/model/inheritance/singlediscriminator/models/Eagle.java","src/main/java/type/model/inheritance/singlediscriminator/models/Goose.java","src/main/java/type/model/inheritance/singlediscriminator/models/SeaGull.java","src/main/java/type/model/inheritance/singlediscriminator/models/Sparrow.java","src/main/java/type/model/inheritance/singlediscriminator/models/TRex.java","src/main/java/type/model/inheritance/singlediscriminator/models/package-info.java","src/main/java/type/model/inheritance/singlediscriminator/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_apiview_properties.json new file mode 100644 index 00000000000..f61716112e4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_apiview_properties.json @@ -0,0 +1,23 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.model.usage.UsageAsyncClient": "Type.Model.Usage", + "type.model.usage.UsageAsyncClient.input": "Type.Model.Usage.input", + "type.model.usage.UsageAsyncClient.inputAndOutput": "Type.Model.Usage.inputAndOutput", + "type.model.usage.UsageAsyncClient.inputAndOutputWithResponse": "Type.Model.Usage.inputAndOutput", + "type.model.usage.UsageAsyncClient.inputWithResponse": "Type.Model.Usage.input", + "type.model.usage.UsageAsyncClient.output": "Type.Model.Usage.output", + "type.model.usage.UsageAsyncClient.outputWithResponse": "Type.Model.Usage.output", + "type.model.usage.UsageClient": "Type.Model.Usage", + "type.model.usage.UsageClient.input": "Type.Model.Usage.input", + "type.model.usage.UsageClient.inputAndOutput": "Type.Model.Usage.inputAndOutput", + "type.model.usage.UsageClient.inputAndOutputWithResponse": "Type.Model.Usage.inputAndOutput", + "type.model.usage.UsageClient.inputWithResponse": "Type.Model.Usage.input", + "type.model.usage.UsageClient.output": "Type.Model.Usage.output", + "type.model.usage.UsageClient.outputWithResponse": "Type.Model.Usage.output", + "type.model.usage.UsageClientBuilder": "Type.Model.Usage", + "type.model.usage.models.InputOutputRecord": "Type.Model.Usage.InputOutputRecord", + "type.model.usage.models.InputRecord": "Type.Model.Usage.InputRecord", + "type.model.usage.models.OutputRecord": "Type.Model.Usage.OutputRecord" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_metadata.json new file mode 100644 index 00000000000..fd6f78b5843 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-usage_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.model.usage.UsageAsyncClient":"Type.Model.Usage","type.model.usage.UsageAsyncClient.input":"Type.Model.Usage.input","type.model.usage.UsageAsyncClient.inputAndOutput":"Type.Model.Usage.inputAndOutput","type.model.usage.UsageAsyncClient.inputAndOutputWithResponse":"Type.Model.Usage.inputAndOutput","type.model.usage.UsageAsyncClient.inputWithResponse":"Type.Model.Usage.input","type.model.usage.UsageAsyncClient.output":"Type.Model.Usage.output","type.model.usage.UsageAsyncClient.outputWithResponse":"Type.Model.Usage.output","type.model.usage.UsageClient":"Type.Model.Usage","type.model.usage.UsageClient.input":"Type.Model.Usage.input","type.model.usage.UsageClient.inputAndOutput":"Type.Model.Usage.inputAndOutput","type.model.usage.UsageClient.inputAndOutputWithResponse":"Type.Model.Usage.inputAndOutput","type.model.usage.UsageClient.inputWithResponse":"Type.Model.Usage.input","type.model.usage.UsageClient.output":"Type.Model.Usage.output","type.model.usage.UsageClient.outputWithResponse":"Type.Model.Usage.output","type.model.usage.UsageClientBuilder":"Type.Model.Usage","type.model.usage.models.InputOutputRecord":"Type.Model.Usage.InputOutputRecord","type.model.usage.models.InputRecord":"Type.Model.Usage.InputRecord","type.model.usage.models.OutputRecord":"Type.Model.Usage.OutputRecord"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/usage/UsageAsyncClient.java","src/main/java/type/model/usage/UsageClient.java","src/main/java/type/model/usage/UsageClientBuilder.java","src/main/java/type/model/usage/implementation/UsageClientImpl.java","src/main/java/type/model/usage/implementation/package-info.java","src/main/java/type/model/usage/models/InputOutputRecord.java","src/main/java/type/model/usage/models/InputRecord.java","src/main/java/type/model/usage/models/OutputRecord.java","src/main/java/type/model/usage/models/package-info.java","src/main/java/type/model/usage/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_apiview_properties.json new file mode 100644 index 00000000000..5104cc3c1c6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_apiview_properties.json @@ -0,0 +1,38 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.model.visibility.VisibilityAsyncClient": "Type.Model.Visibility", + "type.model.visibility.VisibilityAsyncClient.deleteModel": "Type.Model.Visibility.deleteModel", + "type.model.visibility.VisibilityAsyncClient.deleteModelWithResponse": "Type.Model.Visibility.deleteModel", + "type.model.visibility.VisibilityAsyncClient.getModel": "Type.Model.Visibility.getModel", + "type.model.visibility.VisibilityAsyncClient.getModelWithResponse": "Type.Model.Visibility.getModel", + "type.model.visibility.VisibilityAsyncClient.headModel": "Type.Model.Visibility.headModel", + "type.model.visibility.VisibilityAsyncClient.headModelWithResponse": "Type.Model.Visibility.headModel", + "type.model.visibility.VisibilityAsyncClient.patchModel": "Type.Model.Visibility.patchModel", + "type.model.visibility.VisibilityAsyncClient.patchModelWithResponse": "Type.Model.Visibility.patchModel", + "type.model.visibility.VisibilityAsyncClient.postModel": "Type.Model.Visibility.postModel", + "type.model.visibility.VisibilityAsyncClient.postModelWithResponse": "Type.Model.Visibility.postModel", + "type.model.visibility.VisibilityAsyncClient.putModel": "Type.Model.Visibility.putModel", + "type.model.visibility.VisibilityAsyncClient.putModelWithResponse": "Type.Model.Visibility.putModel", + "type.model.visibility.VisibilityAsyncClient.putReadOnlyModel": "Type.Model.Visibility.putReadOnlyModel", + "type.model.visibility.VisibilityAsyncClient.putReadOnlyModelWithResponse": "Type.Model.Visibility.putReadOnlyModel", + "type.model.visibility.VisibilityClient": "Type.Model.Visibility", + "type.model.visibility.VisibilityClient.deleteModel": "Type.Model.Visibility.deleteModel", + "type.model.visibility.VisibilityClient.deleteModelWithResponse": "Type.Model.Visibility.deleteModel", + "type.model.visibility.VisibilityClient.getModel": "Type.Model.Visibility.getModel", + "type.model.visibility.VisibilityClient.getModelWithResponse": "Type.Model.Visibility.getModel", + "type.model.visibility.VisibilityClient.headModel": "Type.Model.Visibility.headModel", + "type.model.visibility.VisibilityClient.headModelWithResponse": "Type.Model.Visibility.headModel", + "type.model.visibility.VisibilityClient.patchModel": "Type.Model.Visibility.patchModel", + "type.model.visibility.VisibilityClient.patchModelWithResponse": "Type.Model.Visibility.patchModel", + "type.model.visibility.VisibilityClient.postModel": "Type.Model.Visibility.postModel", + "type.model.visibility.VisibilityClient.postModelWithResponse": "Type.Model.Visibility.postModel", + "type.model.visibility.VisibilityClient.putModel": "Type.Model.Visibility.putModel", + "type.model.visibility.VisibilityClient.putModelWithResponse": "Type.Model.Visibility.putModel", + "type.model.visibility.VisibilityClient.putReadOnlyModel": "Type.Model.Visibility.putReadOnlyModel", + "type.model.visibility.VisibilityClient.putReadOnlyModelWithResponse": "Type.Model.Visibility.putReadOnlyModel", + "type.model.visibility.VisibilityClientBuilder": "Type.Model.Visibility", + "type.model.visibility.models.ReadOnlyModel": "Type.Model.Visibility.ReadOnlyModel", + "type.model.visibility.models.VisibilityModel": "Type.Model.Visibility.VisibilityModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_metadata.json new file mode 100644 index 00000000000..b60ec1a653a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-model-visibility_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.model.visibility.VisibilityAsyncClient":"Type.Model.Visibility","type.model.visibility.VisibilityAsyncClient.deleteModel":"Type.Model.Visibility.deleteModel","type.model.visibility.VisibilityAsyncClient.deleteModelWithResponse":"Type.Model.Visibility.deleteModel","type.model.visibility.VisibilityAsyncClient.getModel":"Type.Model.Visibility.getModel","type.model.visibility.VisibilityAsyncClient.getModelWithResponse":"Type.Model.Visibility.getModel","type.model.visibility.VisibilityAsyncClient.headModel":"Type.Model.Visibility.headModel","type.model.visibility.VisibilityAsyncClient.headModelWithResponse":"Type.Model.Visibility.headModel","type.model.visibility.VisibilityAsyncClient.patchModel":"Type.Model.Visibility.patchModel","type.model.visibility.VisibilityAsyncClient.patchModelWithResponse":"Type.Model.Visibility.patchModel","type.model.visibility.VisibilityAsyncClient.postModel":"Type.Model.Visibility.postModel","type.model.visibility.VisibilityAsyncClient.postModelWithResponse":"Type.Model.Visibility.postModel","type.model.visibility.VisibilityAsyncClient.putModel":"Type.Model.Visibility.putModel","type.model.visibility.VisibilityAsyncClient.putModelWithResponse":"Type.Model.Visibility.putModel","type.model.visibility.VisibilityAsyncClient.putReadOnlyModel":"Type.Model.Visibility.putReadOnlyModel","type.model.visibility.VisibilityAsyncClient.putReadOnlyModelWithResponse":"Type.Model.Visibility.putReadOnlyModel","type.model.visibility.VisibilityClient":"Type.Model.Visibility","type.model.visibility.VisibilityClient.deleteModel":"Type.Model.Visibility.deleteModel","type.model.visibility.VisibilityClient.deleteModelWithResponse":"Type.Model.Visibility.deleteModel","type.model.visibility.VisibilityClient.getModel":"Type.Model.Visibility.getModel","type.model.visibility.VisibilityClient.getModelWithResponse":"Type.Model.Visibility.getModel","type.model.visibility.VisibilityClient.headModel":"Type.Model.Visibility.headModel","type.model.visibility.VisibilityClient.headModelWithResponse":"Type.Model.Visibility.headModel","type.model.visibility.VisibilityClient.patchModel":"Type.Model.Visibility.patchModel","type.model.visibility.VisibilityClient.patchModelWithResponse":"Type.Model.Visibility.patchModel","type.model.visibility.VisibilityClient.postModel":"Type.Model.Visibility.postModel","type.model.visibility.VisibilityClient.postModelWithResponse":"Type.Model.Visibility.postModel","type.model.visibility.VisibilityClient.putModel":"Type.Model.Visibility.putModel","type.model.visibility.VisibilityClient.putModelWithResponse":"Type.Model.Visibility.putModel","type.model.visibility.VisibilityClient.putReadOnlyModel":"Type.Model.Visibility.putReadOnlyModel","type.model.visibility.VisibilityClient.putReadOnlyModelWithResponse":"Type.Model.Visibility.putReadOnlyModel","type.model.visibility.VisibilityClientBuilder":"Type.Model.Visibility","type.model.visibility.models.ReadOnlyModel":"Type.Model.Visibility.ReadOnlyModel","type.model.visibility.models.VisibilityModel":"Type.Model.Visibility.VisibilityModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/model/visibility/VisibilityAsyncClient.java","src/main/java/type/model/visibility/VisibilityClient.java","src/main/java/type/model/visibility/VisibilityClientBuilder.java","src/main/java/type/model/visibility/implementation/VisibilityClientImpl.java","src/main/java/type/model/visibility/implementation/package-info.java","src/main/java/type/model/visibility/models/ReadOnlyModel.java","src/main/java/type/model/visibility/models/VisibilityModel.java","src/main/java/type/model/visibility/models/package-info.java","src/main/java/type/model/visibility/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_apiview_properties.json new file mode 100644 index 00000000000..c7e092788c9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_apiview_properties.json @@ -0,0 +1,353 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.property.additionalproperties.AdditionalPropertiesClientBuilder": "Type.Property.AdditionalProperties", + "type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat", + "type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get", + "type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get", + "type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put", + "type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put", + "type.property.additionalproperties.ExtendsDifferentSpreadFloatClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat", + "type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get", + "type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get", + "type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put", + "type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put", + "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray", + "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get", + "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get", + "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put", + "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put", + "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray", + "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get", + "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get", + "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put", + "type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put", + "type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel", + "type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get", + "type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get", + "type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put", + "type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put", + "type.property.additionalproperties.ExtendsDifferentSpreadModelClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel", + "type.property.additionalproperties.ExtendsDifferentSpreadModelClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get", + "type.property.additionalproperties.ExtendsDifferentSpreadModelClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get", + "type.property.additionalproperties.ExtendsDifferentSpreadModelClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put", + "type.property.additionalproperties.ExtendsDifferentSpreadModelClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put", + "type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString", + "type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get", + "type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get", + "type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put", + "type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put", + "type.property.additionalproperties.ExtendsDifferentSpreadStringClient": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString", + "type.property.additionalproperties.ExtendsDifferentSpreadStringClient.get": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get", + "type.property.additionalproperties.ExtendsDifferentSpreadStringClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get", + "type.property.additionalproperties.ExtendsDifferentSpreadStringClient.put": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put", + "type.property.additionalproperties.ExtendsDifferentSpreadStringClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put", + "type.property.additionalproperties.ExtendsFloatAsyncClient": "Type.Property.AdditionalProperties.ExtendsFloat", + "type.property.additionalproperties.ExtendsFloatAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsFloat.get", + "type.property.additionalproperties.ExtendsFloatAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsFloat.get", + "type.property.additionalproperties.ExtendsFloatAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsFloat.put", + "type.property.additionalproperties.ExtendsFloatAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsFloat.put", + "type.property.additionalproperties.ExtendsFloatClient": "Type.Property.AdditionalProperties.ExtendsFloat", + "type.property.additionalproperties.ExtendsFloatClient.get": "Type.Property.AdditionalProperties.ExtendsFloat.get", + "type.property.additionalproperties.ExtendsFloatClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsFloat.get", + "type.property.additionalproperties.ExtendsFloatClient.put": "Type.Property.AdditionalProperties.ExtendsFloat.put", + "type.property.additionalproperties.ExtendsFloatClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsFloat.put", + "type.property.additionalproperties.ExtendsModelArrayAsyncClient": "Type.Property.AdditionalProperties.ExtendsModelArray", + "type.property.additionalproperties.ExtendsModelArrayAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsModelArray.get", + "type.property.additionalproperties.ExtendsModelArrayAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsModelArray.get", + "type.property.additionalproperties.ExtendsModelArrayAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsModelArray.put", + "type.property.additionalproperties.ExtendsModelArrayAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsModelArray.put", + "type.property.additionalproperties.ExtendsModelArrayClient": "Type.Property.AdditionalProperties.ExtendsModelArray", + "type.property.additionalproperties.ExtendsModelArrayClient.get": "Type.Property.AdditionalProperties.ExtendsModelArray.get", + "type.property.additionalproperties.ExtendsModelArrayClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsModelArray.get", + "type.property.additionalproperties.ExtendsModelArrayClient.put": "Type.Property.AdditionalProperties.ExtendsModelArray.put", + "type.property.additionalproperties.ExtendsModelArrayClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsModelArray.put", + "type.property.additionalproperties.ExtendsModelAsyncClient": "Type.Property.AdditionalProperties.ExtendsModel", + "type.property.additionalproperties.ExtendsModelAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsModel.get", + "type.property.additionalproperties.ExtendsModelAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsModel.get", + "type.property.additionalproperties.ExtendsModelAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsModel.put", + "type.property.additionalproperties.ExtendsModelAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsModel.put", + "type.property.additionalproperties.ExtendsModelClient": "Type.Property.AdditionalProperties.ExtendsModel", + "type.property.additionalproperties.ExtendsModelClient.get": "Type.Property.AdditionalProperties.ExtendsModel.get", + "type.property.additionalproperties.ExtendsModelClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsModel.get", + "type.property.additionalproperties.ExtendsModelClient.put": "Type.Property.AdditionalProperties.ExtendsModel.put", + "type.property.additionalproperties.ExtendsModelClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsModel.put", + "type.property.additionalproperties.ExtendsStringAsyncClient": "Type.Property.AdditionalProperties.ExtendsString", + "type.property.additionalproperties.ExtendsStringAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsString.get", + "type.property.additionalproperties.ExtendsStringAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsString.get", + "type.property.additionalproperties.ExtendsStringAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsString.put", + "type.property.additionalproperties.ExtendsStringAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsString.put", + "type.property.additionalproperties.ExtendsStringClient": "Type.Property.AdditionalProperties.ExtendsString", + "type.property.additionalproperties.ExtendsStringClient.get": "Type.Property.AdditionalProperties.ExtendsString.get", + "type.property.additionalproperties.ExtendsStringClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsString.get", + "type.property.additionalproperties.ExtendsStringClient.put": "Type.Property.AdditionalProperties.ExtendsString.put", + "type.property.additionalproperties.ExtendsStringClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsString.put", + "type.property.additionalproperties.ExtendsUnknownAsyncClient": "Type.Property.AdditionalProperties.ExtendsUnknown", + "type.property.additionalproperties.ExtendsUnknownAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsUnknown.get", + "type.property.additionalproperties.ExtendsUnknownAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknown.get", + "type.property.additionalproperties.ExtendsUnknownAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsUnknown.put", + "type.property.additionalproperties.ExtendsUnknownAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknown.put", + "type.property.additionalproperties.ExtendsUnknownClient": "Type.Property.AdditionalProperties.ExtendsUnknown", + "type.property.additionalproperties.ExtendsUnknownClient.get": "Type.Property.AdditionalProperties.ExtendsUnknown.get", + "type.property.additionalproperties.ExtendsUnknownClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknown.get", + "type.property.additionalproperties.ExtendsUnknownClient.put": "Type.Property.AdditionalProperties.ExtendsUnknown.put", + "type.property.additionalproperties.ExtendsUnknownClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknown.put", + "type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient": "Type.Property.AdditionalProperties.ExtendsUnknownDerived", + "type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.get", + "type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.get", + "type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.put", + "type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.put", + "type.property.additionalproperties.ExtendsUnknownDerivedClient": "Type.Property.AdditionalProperties.ExtendsUnknownDerived", + "type.property.additionalproperties.ExtendsUnknownDerivedClient.get": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.get", + "type.property.additionalproperties.ExtendsUnknownDerivedClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.get", + "type.property.additionalproperties.ExtendsUnknownDerivedClient.put": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.put", + "type.property.additionalproperties.ExtendsUnknownDerivedClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDerived.put", + "type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated", + "type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.get": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get", + "type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get", + "type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.put": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put", + "type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put", + "type.property.additionalproperties.ExtendsUnknownDiscriminatedClient": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated", + "type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.get": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get", + "type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.getWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get", + "type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.put": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put", + "type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.putWithResponse": "Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put", + "type.property.additionalproperties.IsFloatAsyncClient": "Type.Property.AdditionalProperties.IsFloat", + "type.property.additionalproperties.IsFloatAsyncClient.get": "Type.Property.AdditionalProperties.IsFloat.get", + "type.property.additionalproperties.IsFloatAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsFloat.get", + "type.property.additionalproperties.IsFloatAsyncClient.put": "Type.Property.AdditionalProperties.IsFloat.put", + "type.property.additionalproperties.IsFloatAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsFloat.put", + "type.property.additionalproperties.IsFloatClient": "Type.Property.AdditionalProperties.IsFloat", + "type.property.additionalproperties.IsFloatClient.get": "Type.Property.AdditionalProperties.IsFloat.get", + "type.property.additionalproperties.IsFloatClient.getWithResponse": "Type.Property.AdditionalProperties.IsFloat.get", + "type.property.additionalproperties.IsFloatClient.put": "Type.Property.AdditionalProperties.IsFloat.put", + "type.property.additionalproperties.IsFloatClient.putWithResponse": "Type.Property.AdditionalProperties.IsFloat.put", + "type.property.additionalproperties.IsModelArrayAsyncClient": "Type.Property.AdditionalProperties.IsModelArray", + "type.property.additionalproperties.IsModelArrayAsyncClient.get": "Type.Property.AdditionalProperties.IsModelArray.get", + "type.property.additionalproperties.IsModelArrayAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsModelArray.get", + "type.property.additionalproperties.IsModelArrayAsyncClient.put": "Type.Property.AdditionalProperties.IsModelArray.put", + "type.property.additionalproperties.IsModelArrayAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsModelArray.put", + "type.property.additionalproperties.IsModelArrayClient": "Type.Property.AdditionalProperties.IsModelArray", + "type.property.additionalproperties.IsModelArrayClient.get": "Type.Property.AdditionalProperties.IsModelArray.get", + "type.property.additionalproperties.IsModelArrayClient.getWithResponse": "Type.Property.AdditionalProperties.IsModelArray.get", + "type.property.additionalproperties.IsModelArrayClient.put": "Type.Property.AdditionalProperties.IsModelArray.put", + "type.property.additionalproperties.IsModelArrayClient.putWithResponse": "Type.Property.AdditionalProperties.IsModelArray.put", + "type.property.additionalproperties.IsModelAsyncClient": "Type.Property.AdditionalProperties.IsModel", + "type.property.additionalproperties.IsModelAsyncClient.get": "Type.Property.AdditionalProperties.IsModel.get", + "type.property.additionalproperties.IsModelAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsModel.get", + "type.property.additionalproperties.IsModelAsyncClient.put": "Type.Property.AdditionalProperties.IsModel.put", + "type.property.additionalproperties.IsModelAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsModel.put", + "type.property.additionalproperties.IsModelClient": "Type.Property.AdditionalProperties.IsModel", + "type.property.additionalproperties.IsModelClient.get": "Type.Property.AdditionalProperties.IsModel.get", + "type.property.additionalproperties.IsModelClient.getWithResponse": "Type.Property.AdditionalProperties.IsModel.get", + "type.property.additionalproperties.IsModelClient.put": "Type.Property.AdditionalProperties.IsModel.put", + "type.property.additionalproperties.IsModelClient.putWithResponse": "Type.Property.AdditionalProperties.IsModel.put", + "type.property.additionalproperties.IsStringAsyncClient": "Type.Property.AdditionalProperties.IsString", + "type.property.additionalproperties.IsStringAsyncClient.get": "Type.Property.AdditionalProperties.IsString.get", + "type.property.additionalproperties.IsStringAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsString.get", + "type.property.additionalproperties.IsStringAsyncClient.put": "Type.Property.AdditionalProperties.IsString.put", + "type.property.additionalproperties.IsStringAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsString.put", + "type.property.additionalproperties.IsStringClient": "Type.Property.AdditionalProperties.IsString", + "type.property.additionalproperties.IsStringClient.get": "Type.Property.AdditionalProperties.IsString.get", + "type.property.additionalproperties.IsStringClient.getWithResponse": "Type.Property.AdditionalProperties.IsString.get", + "type.property.additionalproperties.IsStringClient.put": "Type.Property.AdditionalProperties.IsString.put", + "type.property.additionalproperties.IsStringClient.putWithResponse": "Type.Property.AdditionalProperties.IsString.put", + "type.property.additionalproperties.IsUnknownAsyncClient": "Type.Property.AdditionalProperties.IsUnknown", + "type.property.additionalproperties.IsUnknownAsyncClient.get": "Type.Property.AdditionalProperties.IsUnknown.get", + "type.property.additionalproperties.IsUnknownAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsUnknown.get", + "type.property.additionalproperties.IsUnknownAsyncClient.put": "Type.Property.AdditionalProperties.IsUnknown.put", + "type.property.additionalproperties.IsUnknownAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsUnknown.put", + "type.property.additionalproperties.IsUnknownClient": "Type.Property.AdditionalProperties.IsUnknown", + "type.property.additionalproperties.IsUnknownClient.get": "Type.Property.AdditionalProperties.IsUnknown.get", + "type.property.additionalproperties.IsUnknownClient.getWithResponse": "Type.Property.AdditionalProperties.IsUnknown.get", + "type.property.additionalproperties.IsUnknownClient.put": "Type.Property.AdditionalProperties.IsUnknown.put", + "type.property.additionalproperties.IsUnknownClient.putWithResponse": "Type.Property.AdditionalProperties.IsUnknown.put", + "type.property.additionalproperties.IsUnknownDerivedAsyncClient": "Type.Property.AdditionalProperties.IsUnknownDerived", + "type.property.additionalproperties.IsUnknownDerivedAsyncClient.get": "Type.Property.AdditionalProperties.IsUnknownDerived.get", + "type.property.additionalproperties.IsUnknownDerivedAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsUnknownDerived.get", + "type.property.additionalproperties.IsUnknownDerivedAsyncClient.put": "Type.Property.AdditionalProperties.IsUnknownDerived.put", + "type.property.additionalproperties.IsUnknownDerivedAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsUnknownDerived.put", + "type.property.additionalproperties.IsUnknownDerivedClient": "Type.Property.AdditionalProperties.IsUnknownDerived", + "type.property.additionalproperties.IsUnknownDerivedClient.get": "Type.Property.AdditionalProperties.IsUnknownDerived.get", + "type.property.additionalproperties.IsUnknownDerivedClient.getWithResponse": "Type.Property.AdditionalProperties.IsUnknownDerived.get", + "type.property.additionalproperties.IsUnknownDerivedClient.put": "Type.Property.AdditionalProperties.IsUnknownDerived.put", + "type.property.additionalproperties.IsUnknownDerivedClient.putWithResponse": "Type.Property.AdditionalProperties.IsUnknownDerived.put", + "type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient": "Type.Property.AdditionalProperties.IsUnknownDiscriminated", + "type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.get": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.get", + "type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.get", + "type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.put": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.put", + "type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.put", + "type.property.additionalproperties.IsUnknownDiscriminatedClient": "Type.Property.AdditionalProperties.IsUnknownDiscriminated", + "type.property.additionalproperties.IsUnknownDiscriminatedClient.get": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.get", + "type.property.additionalproperties.IsUnknownDiscriminatedClient.getWithResponse": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.get", + "type.property.additionalproperties.IsUnknownDiscriminatedClient.put": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.put", + "type.property.additionalproperties.IsUnknownDiscriminatedClient.putWithResponse": "Type.Property.AdditionalProperties.IsUnknownDiscriminated.put", + "type.property.additionalproperties.MultipleSpreadAsyncClient": "Type.Property.AdditionalProperties.MultipleSpread", + "type.property.additionalproperties.MultipleSpreadAsyncClient.get": "Type.Property.AdditionalProperties.MultipleSpread.get", + "type.property.additionalproperties.MultipleSpreadAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.MultipleSpread.get", + "type.property.additionalproperties.MultipleSpreadAsyncClient.put": "Type.Property.AdditionalProperties.MultipleSpread.put", + "type.property.additionalproperties.MultipleSpreadAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.MultipleSpread.put", + "type.property.additionalproperties.MultipleSpreadClient": "Type.Property.AdditionalProperties.MultipleSpread", + "type.property.additionalproperties.MultipleSpreadClient.get": "Type.Property.AdditionalProperties.MultipleSpread.get", + "type.property.additionalproperties.MultipleSpreadClient.getWithResponse": "Type.Property.AdditionalProperties.MultipleSpread.get", + "type.property.additionalproperties.MultipleSpreadClient.put": "Type.Property.AdditionalProperties.MultipleSpread.put", + "type.property.additionalproperties.MultipleSpreadClient.putWithResponse": "Type.Property.AdditionalProperties.MultipleSpread.put", + "type.property.additionalproperties.SpreadDifferentFloatAsyncClient": "Type.Property.AdditionalProperties.SpreadDifferentFloat", + "type.property.additionalproperties.SpreadDifferentFloatAsyncClient.get": "Type.Property.AdditionalProperties.SpreadDifferentFloat.get", + "type.property.additionalproperties.SpreadDifferentFloatAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentFloat.get", + "type.property.additionalproperties.SpreadDifferentFloatAsyncClient.put": "Type.Property.AdditionalProperties.SpreadDifferentFloat.put", + "type.property.additionalproperties.SpreadDifferentFloatAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentFloat.put", + "type.property.additionalproperties.SpreadDifferentFloatClient": "Type.Property.AdditionalProperties.SpreadDifferentFloat", + "type.property.additionalproperties.SpreadDifferentFloatClient.get": "Type.Property.AdditionalProperties.SpreadDifferentFloat.get", + "type.property.additionalproperties.SpreadDifferentFloatClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentFloat.get", + "type.property.additionalproperties.SpreadDifferentFloatClient.put": "Type.Property.AdditionalProperties.SpreadDifferentFloat.put", + "type.property.additionalproperties.SpreadDifferentFloatClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentFloat.put", + "type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient": "Type.Property.AdditionalProperties.SpreadDifferentModelArray", + "type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.get": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.get", + "type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.get", + "type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.put": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.put", + "type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.put", + "type.property.additionalproperties.SpreadDifferentModelArrayClient": "Type.Property.AdditionalProperties.SpreadDifferentModelArray", + "type.property.additionalproperties.SpreadDifferentModelArrayClient.get": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.get", + "type.property.additionalproperties.SpreadDifferentModelArrayClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.get", + "type.property.additionalproperties.SpreadDifferentModelArrayClient.put": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.put", + "type.property.additionalproperties.SpreadDifferentModelArrayClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModelArray.put", + "type.property.additionalproperties.SpreadDifferentModelAsyncClient": "Type.Property.AdditionalProperties.SpreadDifferentModel", + "type.property.additionalproperties.SpreadDifferentModelAsyncClient.get": "Type.Property.AdditionalProperties.SpreadDifferentModel.get", + "type.property.additionalproperties.SpreadDifferentModelAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModel.get", + "type.property.additionalproperties.SpreadDifferentModelAsyncClient.put": "Type.Property.AdditionalProperties.SpreadDifferentModel.put", + "type.property.additionalproperties.SpreadDifferentModelAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModel.put", + "type.property.additionalproperties.SpreadDifferentModelClient": "Type.Property.AdditionalProperties.SpreadDifferentModel", + "type.property.additionalproperties.SpreadDifferentModelClient.get": "Type.Property.AdditionalProperties.SpreadDifferentModel.get", + "type.property.additionalproperties.SpreadDifferentModelClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModel.get", + "type.property.additionalproperties.SpreadDifferentModelClient.put": "Type.Property.AdditionalProperties.SpreadDifferentModel.put", + "type.property.additionalproperties.SpreadDifferentModelClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentModel.put", + "type.property.additionalproperties.SpreadDifferentStringAsyncClient": "Type.Property.AdditionalProperties.SpreadDifferentString", + "type.property.additionalproperties.SpreadDifferentStringAsyncClient.get": "Type.Property.AdditionalProperties.SpreadDifferentString.get", + "type.property.additionalproperties.SpreadDifferentStringAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentString.get", + "type.property.additionalproperties.SpreadDifferentStringAsyncClient.put": "Type.Property.AdditionalProperties.SpreadDifferentString.put", + "type.property.additionalproperties.SpreadDifferentStringAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentString.put", + "type.property.additionalproperties.SpreadDifferentStringClient": "Type.Property.AdditionalProperties.SpreadDifferentString", + "type.property.additionalproperties.SpreadDifferentStringClient.get": "Type.Property.AdditionalProperties.SpreadDifferentString.get", + "type.property.additionalproperties.SpreadDifferentStringClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentString.get", + "type.property.additionalproperties.SpreadDifferentStringClient.put": "Type.Property.AdditionalProperties.SpreadDifferentString.put", + "type.property.additionalproperties.SpreadDifferentStringClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadDifferentString.put", + "type.property.additionalproperties.SpreadFloatAsyncClient": "Type.Property.AdditionalProperties.SpreadFloat", + "type.property.additionalproperties.SpreadFloatAsyncClient.get": "Type.Property.AdditionalProperties.SpreadFloat.get", + "type.property.additionalproperties.SpreadFloatAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadFloat.get", + "type.property.additionalproperties.SpreadFloatAsyncClient.put": "Type.Property.AdditionalProperties.SpreadFloat.put", + "type.property.additionalproperties.SpreadFloatAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadFloat.put", + "type.property.additionalproperties.SpreadFloatClient": "Type.Property.AdditionalProperties.SpreadFloat", + "type.property.additionalproperties.SpreadFloatClient.get": "Type.Property.AdditionalProperties.SpreadFloat.get", + "type.property.additionalproperties.SpreadFloatClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadFloat.get", + "type.property.additionalproperties.SpreadFloatClient.put": "Type.Property.AdditionalProperties.SpreadFloat.put", + "type.property.additionalproperties.SpreadFloatClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadFloat.put", + "type.property.additionalproperties.SpreadModelArrayAsyncClient": "Type.Property.AdditionalProperties.SpreadModelArray", + "type.property.additionalproperties.SpreadModelArrayAsyncClient.get": "Type.Property.AdditionalProperties.SpreadModelArray.get", + "type.property.additionalproperties.SpreadModelArrayAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadModelArray.get", + "type.property.additionalproperties.SpreadModelArrayAsyncClient.put": "Type.Property.AdditionalProperties.SpreadModelArray.put", + "type.property.additionalproperties.SpreadModelArrayAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadModelArray.put", + "type.property.additionalproperties.SpreadModelArrayClient": "Type.Property.AdditionalProperties.SpreadModelArray", + "type.property.additionalproperties.SpreadModelArrayClient.get": "Type.Property.AdditionalProperties.SpreadModelArray.get", + "type.property.additionalproperties.SpreadModelArrayClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadModelArray.get", + "type.property.additionalproperties.SpreadModelArrayClient.put": "Type.Property.AdditionalProperties.SpreadModelArray.put", + "type.property.additionalproperties.SpreadModelArrayClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadModelArray.put", + "type.property.additionalproperties.SpreadModelAsyncClient": "Type.Property.AdditionalProperties.SpreadModel", + "type.property.additionalproperties.SpreadModelAsyncClient.get": "Type.Property.AdditionalProperties.SpreadModel.get", + "type.property.additionalproperties.SpreadModelAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadModel.get", + "type.property.additionalproperties.SpreadModelAsyncClient.put": "Type.Property.AdditionalProperties.SpreadModel.put", + "type.property.additionalproperties.SpreadModelAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadModel.put", + "type.property.additionalproperties.SpreadModelClient": "Type.Property.AdditionalProperties.SpreadModel", + "type.property.additionalproperties.SpreadModelClient.get": "Type.Property.AdditionalProperties.SpreadModel.get", + "type.property.additionalproperties.SpreadModelClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadModel.get", + "type.property.additionalproperties.SpreadModelClient.put": "Type.Property.AdditionalProperties.SpreadModel.put", + "type.property.additionalproperties.SpreadModelClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadModel.put", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.get": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.put": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.get": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.put": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.get": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.put": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.get": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.put": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.get": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.put": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.get": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.put": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put", + "type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put", + "type.property.additionalproperties.SpreadRecordUnionAsyncClient": "Type.Property.AdditionalProperties.SpreadRecordUnion", + "type.property.additionalproperties.SpreadRecordUnionAsyncClient.get": "Type.Property.AdditionalProperties.SpreadRecordUnion.get", + "type.property.additionalproperties.SpreadRecordUnionAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordUnion.get", + "type.property.additionalproperties.SpreadRecordUnionAsyncClient.put": "Type.Property.AdditionalProperties.SpreadRecordUnion.put", + "type.property.additionalproperties.SpreadRecordUnionAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordUnion.put", + "type.property.additionalproperties.SpreadRecordUnionClient": "Type.Property.AdditionalProperties.SpreadRecordUnion", + "type.property.additionalproperties.SpreadRecordUnionClient.get": "Type.Property.AdditionalProperties.SpreadRecordUnion.get", + "type.property.additionalproperties.SpreadRecordUnionClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadRecordUnion.get", + "type.property.additionalproperties.SpreadRecordUnionClient.put": "Type.Property.AdditionalProperties.SpreadRecordUnion.put", + "type.property.additionalproperties.SpreadRecordUnionClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadRecordUnion.put", + "type.property.additionalproperties.SpreadStringAsyncClient": "Type.Property.AdditionalProperties.SpreadString", + "type.property.additionalproperties.SpreadStringAsyncClient.get": "Type.Property.AdditionalProperties.SpreadString.get", + "type.property.additionalproperties.SpreadStringAsyncClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadString.get", + "type.property.additionalproperties.SpreadStringAsyncClient.put": "Type.Property.AdditionalProperties.SpreadString.put", + "type.property.additionalproperties.SpreadStringAsyncClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadString.put", + "type.property.additionalproperties.SpreadStringClient": "Type.Property.AdditionalProperties.SpreadString", + "type.property.additionalproperties.SpreadStringClient.get": "Type.Property.AdditionalProperties.SpreadString.get", + "type.property.additionalproperties.SpreadStringClient.getWithResponse": "Type.Property.AdditionalProperties.SpreadString.get", + "type.property.additionalproperties.SpreadStringClient.put": "Type.Property.AdditionalProperties.SpreadString.put", + "type.property.additionalproperties.SpreadStringClient.putWithResponse": "Type.Property.AdditionalProperties.SpreadString.put", + "type.property.additionalproperties.models.DifferentSpreadFloatDerived": "Type.Property.AdditionalProperties.DifferentSpreadFloatDerived", + "type.property.additionalproperties.models.DifferentSpreadFloatRecord": "Type.Property.AdditionalProperties.DifferentSpreadFloatRecord", + "type.property.additionalproperties.models.DifferentSpreadModelArrayDerived": "Type.Property.AdditionalProperties.DifferentSpreadModelArrayDerived", + "type.property.additionalproperties.models.DifferentSpreadModelArrayRecord": "Type.Property.AdditionalProperties.DifferentSpreadModelArrayRecord", + "type.property.additionalproperties.models.DifferentSpreadModelDerived": "Type.Property.AdditionalProperties.DifferentSpreadModelDerived", + "type.property.additionalproperties.models.DifferentSpreadModelRecord": "Type.Property.AdditionalProperties.DifferentSpreadModelRecord", + "type.property.additionalproperties.models.DifferentSpreadStringDerived": "Type.Property.AdditionalProperties.DifferentSpreadStringDerived", + "type.property.additionalproperties.models.DifferentSpreadStringRecord": "Type.Property.AdditionalProperties.DifferentSpreadStringRecord", + "type.property.additionalproperties.models.ExtendsFloatAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsFloatAdditionalProperties", + "type.property.additionalproperties.models.ExtendsModelAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsModelAdditionalProperties", + "type.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsModelArrayAdditionalProperties", + "type.property.additionalproperties.models.ExtendsStringAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsStringAdditionalProperties", + "type.property.additionalproperties.models.ExtendsUnknownAdditionalProperties": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalProperties", + "type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDerived": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDerived", + "type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminated": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDiscriminated", + "type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived": "Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived", + "type.property.additionalproperties.models.IsFloatAdditionalProperties": "Type.Property.AdditionalProperties.IsFloatAdditionalProperties", + "type.property.additionalproperties.models.IsModelAdditionalProperties": "Type.Property.AdditionalProperties.IsModelAdditionalProperties", + "type.property.additionalproperties.models.IsModelArrayAdditionalProperties": "Type.Property.AdditionalProperties.IsModelArrayAdditionalProperties", + "type.property.additionalproperties.models.IsStringAdditionalProperties": "Type.Property.AdditionalProperties.IsStringAdditionalProperties", + "type.property.additionalproperties.models.IsUnknownAdditionalProperties": "Type.Property.AdditionalProperties.IsUnknownAdditionalProperties", + "type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDerived": "Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDerived", + "type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminated": "Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDiscriminated", + "type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminatedDerived": "Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDiscriminatedDerived", + "type.property.additionalproperties.models.ModelForRecord": "Type.Property.AdditionalProperties.ModelForRecord", + "type.property.additionalproperties.models.MultipleSpreadRecord": "Type.Property.AdditionalProperties.MultipleSpreadRecord", + "type.property.additionalproperties.models.SpreadFloatRecord": "Type.Property.AdditionalProperties.SpreadFloatRecord", + "type.property.additionalproperties.models.SpreadModelArrayRecord": "Type.Property.AdditionalProperties.SpreadModelArrayRecord", + "type.property.additionalproperties.models.SpreadModelRecord": "Type.Property.AdditionalProperties.SpreadModelRecord", + "type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion": "Type.Property.AdditionalProperties.SpreadRecordForNonDiscriminatedUnion", + "type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion2": "Type.Property.AdditionalProperties.SpreadRecordForNonDiscriminatedUnion2", + "type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion3": "Type.Property.AdditionalProperties.SpreadRecordForNonDiscriminatedUnion3", + "type.property.additionalproperties.models.SpreadRecordForUnion": "Type.Property.AdditionalProperties.SpreadRecordForUnion", + "type.property.additionalproperties.models.SpreadStringRecord": "Type.Property.AdditionalProperties.SpreadStringRecord", + "type.property.additionalproperties.models.WidgetData0": "Type.Property.AdditionalProperties.WidgetData0", + "type.property.additionalproperties.models.WidgetData1": "Type.Property.AdditionalProperties.WidgetData1", + "type.property.additionalproperties.models.WidgetData2": "Type.Property.AdditionalProperties.WidgetData2" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_metadata.json new file mode 100644 index 00000000000..62d49c881f7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-additionalproperties_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.property.additionalproperties.AdditionalPropertiesClientBuilder":"Type.Property.AdditionalProperties","type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat","type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get","type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get","type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put","type.property.additionalproperties.ExtendsDifferentSpreadFloatAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put","type.property.additionalproperties.ExtendsDifferentSpreadFloatClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat","type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get","type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.get","type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put","type.property.additionalproperties.ExtendsDifferentSpreadFloatClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadFloat.put","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.get","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put","type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModelArray.put","type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel","type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get","type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get","type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put","type.property.additionalproperties.ExtendsDifferentSpreadModelAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put","type.property.additionalproperties.ExtendsDifferentSpreadModelClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel","type.property.additionalproperties.ExtendsDifferentSpreadModelClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get","type.property.additionalproperties.ExtendsDifferentSpreadModelClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.get","type.property.additionalproperties.ExtendsDifferentSpreadModelClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put","type.property.additionalproperties.ExtendsDifferentSpreadModelClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadModel.put","type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString","type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get","type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get","type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put","type.property.additionalproperties.ExtendsDifferentSpreadStringAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put","type.property.additionalproperties.ExtendsDifferentSpreadStringClient":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString","type.property.additionalproperties.ExtendsDifferentSpreadStringClient.get":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get","type.property.additionalproperties.ExtendsDifferentSpreadStringClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.get","type.property.additionalproperties.ExtendsDifferentSpreadStringClient.put":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put","type.property.additionalproperties.ExtendsDifferentSpreadStringClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsDifferentSpreadString.put","type.property.additionalproperties.ExtendsFloatAsyncClient":"Type.Property.AdditionalProperties.ExtendsFloat","type.property.additionalproperties.ExtendsFloatAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsFloat.get","type.property.additionalproperties.ExtendsFloatAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsFloat.get","type.property.additionalproperties.ExtendsFloatAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsFloat.put","type.property.additionalproperties.ExtendsFloatAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsFloat.put","type.property.additionalproperties.ExtendsFloatClient":"Type.Property.AdditionalProperties.ExtendsFloat","type.property.additionalproperties.ExtendsFloatClient.get":"Type.Property.AdditionalProperties.ExtendsFloat.get","type.property.additionalproperties.ExtendsFloatClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsFloat.get","type.property.additionalproperties.ExtendsFloatClient.put":"Type.Property.AdditionalProperties.ExtendsFloat.put","type.property.additionalproperties.ExtendsFloatClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsFloat.put","type.property.additionalproperties.ExtendsModelArrayAsyncClient":"Type.Property.AdditionalProperties.ExtendsModelArray","type.property.additionalproperties.ExtendsModelArrayAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsModelArray.get","type.property.additionalproperties.ExtendsModelArrayAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsModelArray.get","type.property.additionalproperties.ExtendsModelArrayAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsModelArray.put","type.property.additionalproperties.ExtendsModelArrayAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsModelArray.put","type.property.additionalproperties.ExtendsModelArrayClient":"Type.Property.AdditionalProperties.ExtendsModelArray","type.property.additionalproperties.ExtendsModelArrayClient.get":"Type.Property.AdditionalProperties.ExtendsModelArray.get","type.property.additionalproperties.ExtendsModelArrayClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsModelArray.get","type.property.additionalproperties.ExtendsModelArrayClient.put":"Type.Property.AdditionalProperties.ExtendsModelArray.put","type.property.additionalproperties.ExtendsModelArrayClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsModelArray.put","type.property.additionalproperties.ExtendsModelAsyncClient":"Type.Property.AdditionalProperties.ExtendsModel","type.property.additionalproperties.ExtendsModelAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsModel.get","type.property.additionalproperties.ExtendsModelAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsModel.get","type.property.additionalproperties.ExtendsModelAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsModel.put","type.property.additionalproperties.ExtendsModelAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsModel.put","type.property.additionalproperties.ExtendsModelClient":"Type.Property.AdditionalProperties.ExtendsModel","type.property.additionalproperties.ExtendsModelClient.get":"Type.Property.AdditionalProperties.ExtendsModel.get","type.property.additionalproperties.ExtendsModelClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsModel.get","type.property.additionalproperties.ExtendsModelClient.put":"Type.Property.AdditionalProperties.ExtendsModel.put","type.property.additionalproperties.ExtendsModelClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsModel.put","type.property.additionalproperties.ExtendsStringAsyncClient":"Type.Property.AdditionalProperties.ExtendsString","type.property.additionalproperties.ExtendsStringAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsString.get","type.property.additionalproperties.ExtendsStringAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsString.get","type.property.additionalproperties.ExtendsStringAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsString.put","type.property.additionalproperties.ExtendsStringAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsString.put","type.property.additionalproperties.ExtendsStringClient":"Type.Property.AdditionalProperties.ExtendsString","type.property.additionalproperties.ExtendsStringClient.get":"Type.Property.AdditionalProperties.ExtendsString.get","type.property.additionalproperties.ExtendsStringClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsString.get","type.property.additionalproperties.ExtendsStringClient.put":"Type.Property.AdditionalProperties.ExtendsString.put","type.property.additionalproperties.ExtendsStringClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsString.put","type.property.additionalproperties.ExtendsUnknownAsyncClient":"Type.Property.AdditionalProperties.ExtendsUnknown","type.property.additionalproperties.ExtendsUnknownAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsUnknown.get","type.property.additionalproperties.ExtendsUnknownAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknown.get","type.property.additionalproperties.ExtendsUnknownAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsUnknown.put","type.property.additionalproperties.ExtendsUnknownAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknown.put","type.property.additionalproperties.ExtendsUnknownClient":"Type.Property.AdditionalProperties.ExtendsUnknown","type.property.additionalproperties.ExtendsUnknownClient.get":"Type.Property.AdditionalProperties.ExtendsUnknown.get","type.property.additionalproperties.ExtendsUnknownClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknown.get","type.property.additionalproperties.ExtendsUnknownClient.put":"Type.Property.AdditionalProperties.ExtendsUnknown.put","type.property.additionalproperties.ExtendsUnknownClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknown.put","type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient":"Type.Property.AdditionalProperties.ExtendsUnknownDerived","type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.get","type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.get","type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.put","type.property.additionalproperties.ExtendsUnknownDerivedAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.put","type.property.additionalproperties.ExtendsUnknownDerivedClient":"Type.Property.AdditionalProperties.ExtendsUnknownDerived","type.property.additionalproperties.ExtendsUnknownDerivedClient.get":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.get","type.property.additionalproperties.ExtendsUnknownDerivedClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.get","type.property.additionalproperties.ExtendsUnknownDerivedClient.put":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.put","type.property.additionalproperties.ExtendsUnknownDerivedClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDerived.put","type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated","type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.get":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get","type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get","type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.put":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put","type.property.additionalproperties.ExtendsUnknownDiscriminatedAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put","type.property.additionalproperties.ExtendsUnknownDiscriminatedClient":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated","type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.get":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get","type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.getWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.get","type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.put":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put","type.property.additionalproperties.ExtendsUnknownDiscriminatedClient.putWithResponse":"Type.Property.AdditionalProperties.ExtendsUnknownDiscriminated.put","type.property.additionalproperties.IsFloatAsyncClient":"Type.Property.AdditionalProperties.IsFloat","type.property.additionalproperties.IsFloatAsyncClient.get":"Type.Property.AdditionalProperties.IsFloat.get","type.property.additionalproperties.IsFloatAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsFloat.get","type.property.additionalproperties.IsFloatAsyncClient.put":"Type.Property.AdditionalProperties.IsFloat.put","type.property.additionalproperties.IsFloatAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsFloat.put","type.property.additionalproperties.IsFloatClient":"Type.Property.AdditionalProperties.IsFloat","type.property.additionalproperties.IsFloatClient.get":"Type.Property.AdditionalProperties.IsFloat.get","type.property.additionalproperties.IsFloatClient.getWithResponse":"Type.Property.AdditionalProperties.IsFloat.get","type.property.additionalproperties.IsFloatClient.put":"Type.Property.AdditionalProperties.IsFloat.put","type.property.additionalproperties.IsFloatClient.putWithResponse":"Type.Property.AdditionalProperties.IsFloat.put","type.property.additionalproperties.IsModelArrayAsyncClient":"Type.Property.AdditionalProperties.IsModelArray","type.property.additionalproperties.IsModelArrayAsyncClient.get":"Type.Property.AdditionalProperties.IsModelArray.get","type.property.additionalproperties.IsModelArrayAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsModelArray.get","type.property.additionalproperties.IsModelArrayAsyncClient.put":"Type.Property.AdditionalProperties.IsModelArray.put","type.property.additionalproperties.IsModelArrayAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsModelArray.put","type.property.additionalproperties.IsModelArrayClient":"Type.Property.AdditionalProperties.IsModelArray","type.property.additionalproperties.IsModelArrayClient.get":"Type.Property.AdditionalProperties.IsModelArray.get","type.property.additionalproperties.IsModelArrayClient.getWithResponse":"Type.Property.AdditionalProperties.IsModelArray.get","type.property.additionalproperties.IsModelArrayClient.put":"Type.Property.AdditionalProperties.IsModelArray.put","type.property.additionalproperties.IsModelArrayClient.putWithResponse":"Type.Property.AdditionalProperties.IsModelArray.put","type.property.additionalproperties.IsModelAsyncClient":"Type.Property.AdditionalProperties.IsModel","type.property.additionalproperties.IsModelAsyncClient.get":"Type.Property.AdditionalProperties.IsModel.get","type.property.additionalproperties.IsModelAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsModel.get","type.property.additionalproperties.IsModelAsyncClient.put":"Type.Property.AdditionalProperties.IsModel.put","type.property.additionalproperties.IsModelAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsModel.put","type.property.additionalproperties.IsModelClient":"Type.Property.AdditionalProperties.IsModel","type.property.additionalproperties.IsModelClient.get":"Type.Property.AdditionalProperties.IsModel.get","type.property.additionalproperties.IsModelClient.getWithResponse":"Type.Property.AdditionalProperties.IsModel.get","type.property.additionalproperties.IsModelClient.put":"Type.Property.AdditionalProperties.IsModel.put","type.property.additionalproperties.IsModelClient.putWithResponse":"Type.Property.AdditionalProperties.IsModel.put","type.property.additionalproperties.IsStringAsyncClient":"Type.Property.AdditionalProperties.IsString","type.property.additionalproperties.IsStringAsyncClient.get":"Type.Property.AdditionalProperties.IsString.get","type.property.additionalproperties.IsStringAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsString.get","type.property.additionalproperties.IsStringAsyncClient.put":"Type.Property.AdditionalProperties.IsString.put","type.property.additionalproperties.IsStringAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsString.put","type.property.additionalproperties.IsStringClient":"Type.Property.AdditionalProperties.IsString","type.property.additionalproperties.IsStringClient.get":"Type.Property.AdditionalProperties.IsString.get","type.property.additionalproperties.IsStringClient.getWithResponse":"Type.Property.AdditionalProperties.IsString.get","type.property.additionalproperties.IsStringClient.put":"Type.Property.AdditionalProperties.IsString.put","type.property.additionalproperties.IsStringClient.putWithResponse":"Type.Property.AdditionalProperties.IsString.put","type.property.additionalproperties.IsUnknownAsyncClient":"Type.Property.AdditionalProperties.IsUnknown","type.property.additionalproperties.IsUnknownAsyncClient.get":"Type.Property.AdditionalProperties.IsUnknown.get","type.property.additionalproperties.IsUnknownAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsUnknown.get","type.property.additionalproperties.IsUnknownAsyncClient.put":"Type.Property.AdditionalProperties.IsUnknown.put","type.property.additionalproperties.IsUnknownAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsUnknown.put","type.property.additionalproperties.IsUnknownClient":"Type.Property.AdditionalProperties.IsUnknown","type.property.additionalproperties.IsUnknownClient.get":"Type.Property.AdditionalProperties.IsUnknown.get","type.property.additionalproperties.IsUnknownClient.getWithResponse":"Type.Property.AdditionalProperties.IsUnknown.get","type.property.additionalproperties.IsUnknownClient.put":"Type.Property.AdditionalProperties.IsUnknown.put","type.property.additionalproperties.IsUnknownClient.putWithResponse":"Type.Property.AdditionalProperties.IsUnknown.put","type.property.additionalproperties.IsUnknownDerivedAsyncClient":"Type.Property.AdditionalProperties.IsUnknownDerived","type.property.additionalproperties.IsUnknownDerivedAsyncClient.get":"Type.Property.AdditionalProperties.IsUnknownDerived.get","type.property.additionalproperties.IsUnknownDerivedAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsUnknownDerived.get","type.property.additionalproperties.IsUnknownDerivedAsyncClient.put":"Type.Property.AdditionalProperties.IsUnknownDerived.put","type.property.additionalproperties.IsUnknownDerivedAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsUnknownDerived.put","type.property.additionalproperties.IsUnknownDerivedClient":"Type.Property.AdditionalProperties.IsUnknownDerived","type.property.additionalproperties.IsUnknownDerivedClient.get":"Type.Property.AdditionalProperties.IsUnknownDerived.get","type.property.additionalproperties.IsUnknownDerivedClient.getWithResponse":"Type.Property.AdditionalProperties.IsUnknownDerived.get","type.property.additionalproperties.IsUnknownDerivedClient.put":"Type.Property.AdditionalProperties.IsUnknownDerived.put","type.property.additionalproperties.IsUnknownDerivedClient.putWithResponse":"Type.Property.AdditionalProperties.IsUnknownDerived.put","type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient":"Type.Property.AdditionalProperties.IsUnknownDiscriminated","type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.get":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.get","type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.get","type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.put":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.put","type.property.additionalproperties.IsUnknownDiscriminatedAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.put","type.property.additionalproperties.IsUnknownDiscriminatedClient":"Type.Property.AdditionalProperties.IsUnknownDiscriminated","type.property.additionalproperties.IsUnknownDiscriminatedClient.get":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.get","type.property.additionalproperties.IsUnknownDiscriminatedClient.getWithResponse":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.get","type.property.additionalproperties.IsUnknownDiscriminatedClient.put":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.put","type.property.additionalproperties.IsUnknownDiscriminatedClient.putWithResponse":"Type.Property.AdditionalProperties.IsUnknownDiscriminated.put","type.property.additionalproperties.MultipleSpreadAsyncClient":"Type.Property.AdditionalProperties.MultipleSpread","type.property.additionalproperties.MultipleSpreadAsyncClient.get":"Type.Property.AdditionalProperties.MultipleSpread.get","type.property.additionalproperties.MultipleSpreadAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.MultipleSpread.get","type.property.additionalproperties.MultipleSpreadAsyncClient.put":"Type.Property.AdditionalProperties.MultipleSpread.put","type.property.additionalproperties.MultipleSpreadAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.MultipleSpread.put","type.property.additionalproperties.MultipleSpreadClient":"Type.Property.AdditionalProperties.MultipleSpread","type.property.additionalproperties.MultipleSpreadClient.get":"Type.Property.AdditionalProperties.MultipleSpread.get","type.property.additionalproperties.MultipleSpreadClient.getWithResponse":"Type.Property.AdditionalProperties.MultipleSpread.get","type.property.additionalproperties.MultipleSpreadClient.put":"Type.Property.AdditionalProperties.MultipleSpread.put","type.property.additionalproperties.MultipleSpreadClient.putWithResponse":"Type.Property.AdditionalProperties.MultipleSpread.put","type.property.additionalproperties.SpreadDifferentFloatAsyncClient":"Type.Property.AdditionalProperties.SpreadDifferentFloat","type.property.additionalproperties.SpreadDifferentFloatAsyncClient.get":"Type.Property.AdditionalProperties.SpreadDifferentFloat.get","type.property.additionalproperties.SpreadDifferentFloatAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentFloat.get","type.property.additionalproperties.SpreadDifferentFloatAsyncClient.put":"Type.Property.AdditionalProperties.SpreadDifferentFloat.put","type.property.additionalproperties.SpreadDifferentFloatAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentFloat.put","type.property.additionalproperties.SpreadDifferentFloatClient":"Type.Property.AdditionalProperties.SpreadDifferentFloat","type.property.additionalproperties.SpreadDifferentFloatClient.get":"Type.Property.AdditionalProperties.SpreadDifferentFloat.get","type.property.additionalproperties.SpreadDifferentFloatClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentFloat.get","type.property.additionalproperties.SpreadDifferentFloatClient.put":"Type.Property.AdditionalProperties.SpreadDifferentFloat.put","type.property.additionalproperties.SpreadDifferentFloatClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentFloat.put","type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient":"Type.Property.AdditionalProperties.SpreadDifferentModelArray","type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.get":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.get","type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.get","type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.put":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.put","type.property.additionalproperties.SpreadDifferentModelArrayAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.put","type.property.additionalproperties.SpreadDifferentModelArrayClient":"Type.Property.AdditionalProperties.SpreadDifferentModelArray","type.property.additionalproperties.SpreadDifferentModelArrayClient.get":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.get","type.property.additionalproperties.SpreadDifferentModelArrayClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.get","type.property.additionalproperties.SpreadDifferentModelArrayClient.put":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.put","type.property.additionalproperties.SpreadDifferentModelArrayClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModelArray.put","type.property.additionalproperties.SpreadDifferentModelAsyncClient":"Type.Property.AdditionalProperties.SpreadDifferentModel","type.property.additionalproperties.SpreadDifferentModelAsyncClient.get":"Type.Property.AdditionalProperties.SpreadDifferentModel.get","type.property.additionalproperties.SpreadDifferentModelAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModel.get","type.property.additionalproperties.SpreadDifferentModelAsyncClient.put":"Type.Property.AdditionalProperties.SpreadDifferentModel.put","type.property.additionalproperties.SpreadDifferentModelAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModel.put","type.property.additionalproperties.SpreadDifferentModelClient":"Type.Property.AdditionalProperties.SpreadDifferentModel","type.property.additionalproperties.SpreadDifferentModelClient.get":"Type.Property.AdditionalProperties.SpreadDifferentModel.get","type.property.additionalproperties.SpreadDifferentModelClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModel.get","type.property.additionalproperties.SpreadDifferentModelClient.put":"Type.Property.AdditionalProperties.SpreadDifferentModel.put","type.property.additionalproperties.SpreadDifferentModelClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentModel.put","type.property.additionalproperties.SpreadDifferentStringAsyncClient":"Type.Property.AdditionalProperties.SpreadDifferentString","type.property.additionalproperties.SpreadDifferentStringAsyncClient.get":"Type.Property.AdditionalProperties.SpreadDifferentString.get","type.property.additionalproperties.SpreadDifferentStringAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentString.get","type.property.additionalproperties.SpreadDifferentStringAsyncClient.put":"Type.Property.AdditionalProperties.SpreadDifferentString.put","type.property.additionalproperties.SpreadDifferentStringAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentString.put","type.property.additionalproperties.SpreadDifferentStringClient":"Type.Property.AdditionalProperties.SpreadDifferentString","type.property.additionalproperties.SpreadDifferentStringClient.get":"Type.Property.AdditionalProperties.SpreadDifferentString.get","type.property.additionalproperties.SpreadDifferentStringClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentString.get","type.property.additionalproperties.SpreadDifferentStringClient.put":"Type.Property.AdditionalProperties.SpreadDifferentString.put","type.property.additionalproperties.SpreadDifferentStringClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadDifferentString.put","type.property.additionalproperties.SpreadFloatAsyncClient":"Type.Property.AdditionalProperties.SpreadFloat","type.property.additionalproperties.SpreadFloatAsyncClient.get":"Type.Property.AdditionalProperties.SpreadFloat.get","type.property.additionalproperties.SpreadFloatAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadFloat.get","type.property.additionalproperties.SpreadFloatAsyncClient.put":"Type.Property.AdditionalProperties.SpreadFloat.put","type.property.additionalproperties.SpreadFloatAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadFloat.put","type.property.additionalproperties.SpreadFloatClient":"Type.Property.AdditionalProperties.SpreadFloat","type.property.additionalproperties.SpreadFloatClient.get":"Type.Property.AdditionalProperties.SpreadFloat.get","type.property.additionalproperties.SpreadFloatClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadFloat.get","type.property.additionalproperties.SpreadFloatClient.put":"Type.Property.AdditionalProperties.SpreadFloat.put","type.property.additionalproperties.SpreadFloatClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadFloat.put","type.property.additionalproperties.SpreadModelArrayAsyncClient":"Type.Property.AdditionalProperties.SpreadModelArray","type.property.additionalproperties.SpreadModelArrayAsyncClient.get":"Type.Property.AdditionalProperties.SpreadModelArray.get","type.property.additionalproperties.SpreadModelArrayAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadModelArray.get","type.property.additionalproperties.SpreadModelArrayAsyncClient.put":"Type.Property.AdditionalProperties.SpreadModelArray.put","type.property.additionalproperties.SpreadModelArrayAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadModelArray.put","type.property.additionalproperties.SpreadModelArrayClient":"Type.Property.AdditionalProperties.SpreadModelArray","type.property.additionalproperties.SpreadModelArrayClient.get":"Type.Property.AdditionalProperties.SpreadModelArray.get","type.property.additionalproperties.SpreadModelArrayClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadModelArray.get","type.property.additionalproperties.SpreadModelArrayClient.put":"Type.Property.AdditionalProperties.SpreadModelArray.put","type.property.additionalproperties.SpreadModelArrayClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadModelArray.put","type.property.additionalproperties.SpreadModelAsyncClient":"Type.Property.AdditionalProperties.SpreadModel","type.property.additionalproperties.SpreadModelAsyncClient.get":"Type.Property.AdditionalProperties.SpreadModel.get","type.property.additionalproperties.SpreadModelAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadModel.get","type.property.additionalproperties.SpreadModelAsyncClient.put":"Type.Property.AdditionalProperties.SpreadModel.put","type.property.additionalproperties.SpreadModelAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadModel.put","type.property.additionalproperties.SpreadModelClient":"Type.Property.AdditionalProperties.SpreadModel","type.property.additionalproperties.SpreadModelClient.get":"Type.Property.AdditionalProperties.SpreadModel.get","type.property.additionalproperties.SpreadModelClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadModel.get","type.property.additionalproperties.SpreadModelClient.put":"Type.Property.AdditionalProperties.SpreadModel.put","type.property.additionalproperties.SpreadModelClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadModel.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.get":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.put":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2AsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.get":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.put":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion2.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.get":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.put":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3AsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.get":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.put":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion3.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.get":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.put":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.get":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.get","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.put":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put","type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordNonDiscriminatedUnion.put","type.property.additionalproperties.SpreadRecordUnionAsyncClient":"Type.Property.AdditionalProperties.SpreadRecordUnion","type.property.additionalproperties.SpreadRecordUnionAsyncClient.get":"Type.Property.AdditionalProperties.SpreadRecordUnion.get","type.property.additionalproperties.SpreadRecordUnionAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordUnion.get","type.property.additionalproperties.SpreadRecordUnionAsyncClient.put":"Type.Property.AdditionalProperties.SpreadRecordUnion.put","type.property.additionalproperties.SpreadRecordUnionAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordUnion.put","type.property.additionalproperties.SpreadRecordUnionClient":"Type.Property.AdditionalProperties.SpreadRecordUnion","type.property.additionalproperties.SpreadRecordUnionClient.get":"Type.Property.AdditionalProperties.SpreadRecordUnion.get","type.property.additionalproperties.SpreadRecordUnionClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadRecordUnion.get","type.property.additionalproperties.SpreadRecordUnionClient.put":"Type.Property.AdditionalProperties.SpreadRecordUnion.put","type.property.additionalproperties.SpreadRecordUnionClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadRecordUnion.put","type.property.additionalproperties.SpreadStringAsyncClient":"Type.Property.AdditionalProperties.SpreadString","type.property.additionalproperties.SpreadStringAsyncClient.get":"Type.Property.AdditionalProperties.SpreadString.get","type.property.additionalproperties.SpreadStringAsyncClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadString.get","type.property.additionalproperties.SpreadStringAsyncClient.put":"Type.Property.AdditionalProperties.SpreadString.put","type.property.additionalproperties.SpreadStringAsyncClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadString.put","type.property.additionalproperties.SpreadStringClient":"Type.Property.AdditionalProperties.SpreadString","type.property.additionalproperties.SpreadStringClient.get":"Type.Property.AdditionalProperties.SpreadString.get","type.property.additionalproperties.SpreadStringClient.getWithResponse":"Type.Property.AdditionalProperties.SpreadString.get","type.property.additionalproperties.SpreadStringClient.put":"Type.Property.AdditionalProperties.SpreadString.put","type.property.additionalproperties.SpreadStringClient.putWithResponse":"Type.Property.AdditionalProperties.SpreadString.put","type.property.additionalproperties.models.DifferentSpreadFloatDerived":"Type.Property.AdditionalProperties.DifferentSpreadFloatDerived","type.property.additionalproperties.models.DifferentSpreadFloatRecord":"Type.Property.AdditionalProperties.DifferentSpreadFloatRecord","type.property.additionalproperties.models.DifferentSpreadModelArrayDerived":"Type.Property.AdditionalProperties.DifferentSpreadModelArrayDerived","type.property.additionalproperties.models.DifferentSpreadModelArrayRecord":"Type.Property.AdditionalProperties.DifferentSpreadModelArrayRecord","type.property.additionalproperties.models.DifferentSpreadModelDerived":"Type.Property.AdditionalProperties.DifferentSpreadModelDerived","type.property.additionalproperties.models.DifferentSpreadModelRecord":"Type.Property.AdditionalProperties.DifferentSpreadModelRecord","type.property.additionalproperties.models.DifferentSpreadStringDerived":"Type.Property.AdditionalProperties.DifferentSpreadStringDerived","type.property.additionalproperties.models.DifferentSpreadStringRecord":"Type.Property.AdditionalProperties.DifferentSpreadStringRecord","type.property.additionalproperties.models.ExtendsFloatAdditionalProperties":"Type.Property.AdditionalProperties.ExtendsFloatAdditionalProperties","type.property.additionalproperties.models.ExtendsModelAdditionalProperties":"Type.Property.AdditionalProperties.ExtendsModelAdditionalProperties","type.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties":"Type.Property.AdditionalProperties.ExtendsModelArrayAdditionalProperties","type.property.additionalproperties.models.ExtendsStringAdditionalProperties":"Type.Property.AdditionalProperties.ExtendsStringAdditionalProperties","type.property.additionalproperties.models.ExtendsUnknownAdditionalProperties":"Type.Property.AdditionalProperties.ExtendsUnknownAdditionalProperties","type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDerived":"Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDerived","type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminated":"Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDiscriminated","type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived":"Type.Property.AdditionalProperties.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived","type.property.additionalproperties.models.IsFloatAdditionalProperties":"Type.Property.AdditionalProperties.IsFloatAdditionalProperties","type.property.additionalproperties.models.IsModelAdditionalProperties":"Type.Property.AdditionalProperties.IsModelAdditionalProperties","type.property.additionalproperties.models.IsModelArrayAdditionalProperties":"Type.Property.AdditionalProperties.IsModelArrayAdditionalProperties","type.property.additionalproperties.models.IsStringAdditionalProperties":"Type.Property.AdditionalProperties.IsStringAdditionalProperties","type.property.additionalproperties.models.IsUnknownAdditionalProperties":"Type.Property.AdditionalProperties.IsUnknownAdditionalProperties","type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDerived":"Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDerived","type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminated":"Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDiscriminated","type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminatedDerived":"Type.Property.AdditionalProperties.IsUnknownAdditionalPropertiesDiscriminatedDerived","type.property.additionalproperties.models.ModelForRecord":"Type.Property.AdditionalProperties.ModelForRecord","type.property.additionalproperties.models.MultipleSpreadRecord":"Type.Property.AdditionalProperties.MultipleSpreadRecord","type.property.additionalproperties.models.SpreadFloatRecord":"Type.Property.AdditionalProperties.SpreadFloatRecord","type.property.additionalproperties.models.SpreadModelArrayRecord":"Type.Property.AdditionalProperties.SpreadModelArrayRecord","type.property.additionalproperties.models.SpreadModelRecord":"Type.Property.AdditionalProperties.SpreadModelRecord","type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion":"Type.Property.AdditionalProperties.SpreadRecordForNonDiscriminatedUnion","type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion2":"Type.Property.AdditionalProperties.SpreadRecordForNonDiscriminatedUnion2","type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion3":"Type.Property.AdditionalProperties.SpreadRecordForNonDiscriminatedUnion3","type.property.additionalproperties.models.SpreadRecordForUnion":"Type.Property.AdditionalProperties.SpreadRecordForUnion","type.property.additionalproperties.models.SpreadStringRecord":"Type.Property.AdditionalProperties.SpreadStringRecord","type.property.additionalproperties.models.WidgetData0":"Type.Property.AdditionalProperties.WidgetData0","type.property.additionalproperties.models.WidgetData1":"Type.Property.AdditionalProperties.WidgetData1","type.property.additionalproperties.models.WidgetData2":"Type.Property.AdditionalProperties.WidgetData2"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/property/additionalproperties/AdditionalPropertiesClientBuilder.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadFloatClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelArrayClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadModelClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsDifferentSpreadStringClient.java","src/main/java/type/property/additionalproperties/ExtendsFloatAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsFloatClient.java","src/main/java/type/property/additionalproperties/ExtendsModelArrayAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsModelArrayClient.java","src/main/java/type/property/additionalproperties/ExtendsModelAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsModelClient.java","src/main/java/type/property/additionalproperties/ExtendsStringAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsStringClient.java","src/main/java/type/property/additionalproperties/ExtendsUnknownAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsUnknownClient.java","src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsUnknownDerivedClient.java","src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedAsyncClient.java","src/main/java/type/property/additionalproperties/ExtendsUnknownDiscriminatedClient.java","src/main/java/type/property/additionalproperties/IsFloatAsyncClient.java","src/main/java/type/property/additionalproperties/IsFloatClient.java","src/main/java/type/property/additionalproperties/IsModelArrayAsyncClient.java","src/main/java/type/property/additionalproperties/IsModelArrayClient.java","src/main/java/type/property/additionalproperties/IsModelAsyncClient.java","src/main/java/type/property/additionalproperties/IsModelClient.java","src/main/java/type/property/additionalproperties/IsStringAsyncClient.java","src/main/java/type/property/additionalproperties/IsStringClient.java","src/main/java/type/property/additionalproperties/IsUnknownAsyncClient.java","src/main/java/type/property/additionalproperties/IsUnknownClient.java","src/main/java/type/property/additionalproperties/IsUnknownDerivedAsyncClient.java","src/main/java/type/property/additionalproperties/IsUnknownDerivedClient.java","src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedAsyncClient.java","src/main/java/type/property/additionalproperties/IsUnknownDiscriminatedClient.java","src/main/java/type/property/additionalproperties/MultipleSpreadAsyncClient.java","src/main/java/type/property/additionalproperties/MultipleSpreadClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentFloatAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentFloatClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentModelArrayClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentModelAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentModelClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentStringAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadDifferentStringClient.java","src/main/java/type/property/additionalproperties/SpreadFloatAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadFloatClient.java","src/main/java/type/property/additionalproperties/SpreadModelArrayAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadModelArrayClient.java","src/main/java/type/property/additionalproperties/SpreadModelAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadModelClient.java","src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2AsyncClient.java","src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion2Client.java","src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3AsyncClient.java","src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnion3Client.java","src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadRecordNonDiscriminatedUnionClient.java","src/main/java/type/property/additionalproperties/SpreadRecordUnionAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadRecordUnionClient.java","src/main/java/type/property/additionalproperties/SpreadStringAsyncClient.java","src/main/java/type/property/additionalproperties/SpreadStringClient.java","src/main/java/type/property/additionalproperties/implementation/AdditionalPropertiesClientImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadFloatsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelArraysImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadModelsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsDifferentSpreadStringsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsFloatsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsModelArraysImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsModelsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsStringsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDerivedsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownDiscriminatedsImpl.java","src/main/java/type/property/additionalproperties/implementation/ExtendsUnknownsImpl.java","src/main/java/type/property/additionalproperties/implementation/IsFloatsImpl.java","src/main/java/type/property/additionalproperties/implementation/IsModelArraysImpl.java","src/main/java/type/property/additionalproperties/implementation/IsModelsImpl.java","src/main/java/type/property/additionalproperties/implementation/IsStringsImpl.java","src/main/java/type/property/additionalproperties/implementation/IsUnknownDerivedsImpl.java","src/main/java/type/property/additionalproperties/implementation/IsUnknownDiscriminatedsImpl.java","src/main/java/type/property/additionalproperties/implementation/IsUnknownsImpl.java","src/main/java/type/property/additionalproperties/implementation/MultipleSpreadsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadDifferentFloatsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelArraysImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadDifferentModelsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadDifferentStringsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadFloatsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadModelArraysImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadModelsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion2sImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnion3sImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadRecordNonDiscriminatedUnionsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadRecordUnionsImpl.java","src/main/java/type/property/additionalproperties/implementation/SpreadStringsImpl.java","src/main/java/type/property/additionalproperties/implementation/package-info.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatDerived.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadFloatRecord.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayDerived.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadModelArrayRecord.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadModelDerived.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadModelRecord.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadStringDerived.java","src/main/java/type/property/additionalproperties/models/DifferentSpreadStringRecord.java","src/main/java/type/property/additionalproperties/models/ExtendsFloatAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/ExtendsModelAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/ExtendsModelArrayAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/ExtendsStringAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDerived.java","src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminated.java","src/main/java/type/property/additionalproperties/models/ExtendsUnknownAdditionalPropertiesDiscriminatedDerived.java","src/main/java/type/property/additionalproperties/models/IsFloatAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/IsModelAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/IsModelArrayAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/IsStringAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalProperties.java","src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDerived.java","src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminated.java","src/main/java/type/property/additionalproperties/models/IsUnknownAdditionalPropertiesDiscriminatedDerived.java","src/main/java/type/property/additionalproperties/models/ModelForRecord.java","src/main/java/type/property/additionalproperties/models/MultipleSpreadRecord.java","src/main/java/type/property/additionalproperties/models/SpreadFloatRecord.java","src/main/java/type/property/additionalproperties/models/SpreadModelArrayRecord.java","src/main/java/type/property/additionalproperties/models/SpreadModelRecord.java","src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion.java","src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion2.java","src/main/java/type/property/additionalproperties/models/SpreadRecordForNonDiscriminatedUnion3.java","src/main/java/type/property/additionalproperties/models/SpreadRecordForUnion.java","src/main/java/type/property/additionalproperties/models/SpreadStringRecord.java","src/main/java/type/property/additionalproperties/models/WidgetData0.java","src/main/java/type/property/additionalproperties/models/WidgetData1.java","src/main/java/type/property/additionalproperties/models/WidgetData2.java","src/main/java/type/property/additionalproperties/models/package-info.java","src/main/java/type/property/additionalproperties/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_apiview_properties.json new file mode 100644 index 00000000000..55a6f1c60f9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_apiview_properties.json @@ -0,0 +1,140 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.property.nullable.BytesAsyncClient": "Type.Property.Nullable.Bytes", + "type.property.nullable.BytesAsyncClient.getNonNull": "Type.Property.Nullable.Bytes.getNonNull", + "type.property.nullable.BytesAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.Bytes.getNonNull", + "type.property.nullable.BytesAsyncClient.getNull": "Type.Property.Nullable.Bytes.getNull", + "type.property.nullable.BytesAsyncClient.getNullWithResponse": "Type.Property.Nullable.Bytes.getNull", + "type.property.nullable.BytesAsyncClient.patchNonNull": "Type.Property.Nullable.Bytes.patchNonNull", + "type.property.nullable.BytesAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.Bytes.patchNonNull", + "type.property.nullable.BytesAsyncClient.patchNull": "Type.Property.Nullable.Bytes.patchNull", + "type.property.nullable.BytesAsyncClient.patchNullWithResponse": "Type.Property.Nullable.Bytes.patchNull", + "type.property.nullable.BytesClient": "Type.Property.Nullable.Bytes", + "type.property.nullable.BytesClient.getNonNull": "Type.Property.Nullable.Bytes.getNonNull", + "type.property.nullable.BytesClient.getNonNullWithResponse": "Type.Property.Nullable.Bytes.getNonNull", + "type.property.nullable.BytesClient.getNull": "Type.Property.Nullable.Bytes.getNull", + "type.property.nullable.BytesClient.getNullWithResponse": "Type.Property.Nullable.Bytes.getNull", + "type.property.nullable.BytesClient.patchNonNull": "Type.Property.Nullable.Bytes.patchNonNull", + "type.property.nullable.BytesClient.patchNonNullWithResponse": "Type.Property.Nullable.Bytes.patchNonNull", + "type.property.nullable.BytesClient.patchNull": "Type.Property.Nullable.Bytes.patchNull", + "type.property.nullable.BytesClient.patchNullWithResponse": "Type.Property.Nullable.Bytes.patchNull", + "type.property.nullable.CollectionsByteAsyncClient": "Type.Property.Nullable.CollectionsByte", + "type.property.nullable.CollectionsByteAsyncClient.getNonNull": "Type.Property.Nullable.CollectionsByte.getNonNull", + "type.property.nullable.CollectionsByteAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.CollectionsByte.getNonNull", + "type.property.nullable.CollectionsByteAsyncClient.getNull": "Type.Property.Nullable.CollectionsByte.getNull", + "type.property.nullable.CollectionsByteAsyncClient.getNullWithResponse": "Type.Property.Nullable.CollectionsByte.getNull", + "type.property.nullable.CollectionsByteAsyncClient.patchNonNull": "Type.Property.Nullable.CollectionsByte.patchNonNull", + "type.property.nullable.CollectionsByteAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.CollectionsByte.patchNonNull", + "type.property.nullable.CollectionsByteAsyncClient.patchNull": "Type.Property.Nullable.CollectionsByte.patchNull", + "type.property.nullable.CollectionsByteAsyncClient.patchNullWithResponse": "Type.Property.Nullable.CollectionsByte.patchNull", + "type.property.nullable.CollectionsByteClient": "Type.Property.Nullable.CollectionsByte", + "type.property.nullable.CollectionsByteClient.getNonNull": "Type.Property.Nullable.CollectionsByte.getNonNull", + "type.property.nullable.CollectionsByteClient.getNonNullWithResponse": "Type.Property.Nullable.CollectionsByte.getNonNull", + "type.property.nullable.CollectionsByteClient.getNull": "Type.Property.Nullable.CollectionsByte.getNull", + "type.property.nullable.CollectionsByteClient.getNullWithResponse": "Type.Property.Nullable.CollectionsByte.getNull", + "type.property.nullable.CollectionsByteClient.patchNonNull": "Type.Property.Nullable.CollectionsByte.patchNonNull", + "type.property.nullable.CollectionsByteClient.patchNonNullWithResponse": "Type.Property.Nullable.CollectionsByte.patchNonNull", + "type.property.nullable.CollectionsByteClient.patchNull": "Type.Property.Nullable.CollectionsByte.patchNull", + "type.property.nullable.CollectionsByteClient.patchNullWithResponse": "Type.Property.Nullable.CollectionsByte.patchNull", + "type.property.nullable.CollectionsModelAsyncClient": "Type.Property.Nullable.CollectionsModel", + "type.property.nullable.CollectionsModelAsyncClient.getNonNull": "Type.Property.Nullable.CollectionsModel.getNonNull", + "type.property.nullable.CollectionsModelAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.CollectionsModel.getNonNull", + "type.property.nullable.CollectionsModelAsyncClient.getNull": "Type.Property.Nullable.CollectionsModel.getNull", + "type.property.nullable.CollectionsModelAsyncClient.getNullWithResponse": "Type.Property.Nullable.CollectionsModel.getNull", + "type.property.nullable.CollectionsModelAsyncClient.patchNonNull": "Type.Property.Nullable.CollectionsModel.patchNonNull", + "type.property.nullable.CollectionsModelAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.CollectionsModel.patchNonNull", + "type.property.nullable.CollectionsModelAsyncClient.patchNull": "Type.Property.Nullable.CollectionsModel.patchNull", + "type.property.nullable.CollectionsModelAsyncClient.patchNullWithResponse": "Type.Property.Nullable.CollectionsModel.patchNull", + "type.property.nullable.CollectionsModelClient": "Type.Property.Nullable.CollectionsModel", + "type.property.nullable.CollectionsModelClient.getNonNull": "Type.Property.Nullable.CollectionsModel.getNonNull", + "type.property.nullable.CollectionsModelClient.getNonNullWithResponse": "Type.Property.Nullable.CollectionsModel.getNonNull", + "type.property.nullable.CollectionsModelClient.getNull": "Type.Property.Nullable.CollectionsModel.getNull", + "type.property.nullable.CollectionsModelClient.getNullWithResponse": "Type.Property.Nullable.CollectionsModel.getNull", + "type.property.nullable.CollectionsModelClient.patchNonNull": "Type.Property.Nullable.CollectionsModel.patchNonNull", + "type.property.nullable.CollectionsModelClient.patchNonNullWithResponse": "Type.Property.Nullable.CollectionsModel.patchNonNull", + "type.property.nullable.CollectionsModelClient.patchNull": "Type.Property.Nullable.CollectionsModel.patchNull", + "type.property.nullable.CollectionsModelClient.patchNullWithResponse": "Type.Property.Nullable.CollectionsModel.patchNull", + "type.property.nullable.CollectionsStringAsyncClient": "Type.Property.Nullable.CollectionsString", + "type.property.nullable.CollectionsStringAsyncClient.getNonNull": "Type.Property.Nullable.CollectionsString.getNonNull", + "type.property.nullable.CollectionsStringAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.CollectionsString.getNonNull", + "type.property.nullable.CollectionsStringAsyncClient.getNull": "Type.Property.Nullable.CollectionsString.getNull", + "type.property.nullable.CollectionsStringAsyncClient.getNullWithResponse": "Type.Property.Nullable.CollectionsString.getNull", + "type.property.nullable.CollectionsStringAsyncClient.patchNonNull": "Type.Property.Nullable.CollectionsString.patchNonNull", + "type.property.nullable.CollectionsStringAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.CollectionsString.patchNonNull", + "type.property.nullable.CollectionsStringAsyncClient.patchNull": "Type.Property.Nullable.CollectionsString.patchNull", + "type.property.nullable.CollectionsStringAsyncClient.patchNullWithResponse": "Type.Property.Nullable.CollectionsString.patchNull", + "type.property.nullable.CollectionsStringClient": "Type.Property.Nullable.CollectionsString", + "type.property.nullable.CollectionsStringClient.getNonNull": "Type.Property.Nullable.CollectionsString.getNonNull", + "type.property.nullable.CollectionsStringClient.getNonNullWithResponse": "Type.Property.Nullable.CollectionsString.getNonNull", + "type.property.nullable.CollectionsStringClient.getNull": "Type.Property.Nullable.CollectionsString.getNull", + "type.property.nullable.CollectionsStringClient.getNullWithResponse": "Type.Property.Nullable.CollectionsString.getNull", + "type.property.nullable.CollectionsStringClient.patchNonNull": "Type.Property.Nullable.CollectionsString.patchNonNull", + "type.property.nullable.CollectionsStringClient.patchNonNullWithResponse": "Type.Property.Nullable.CollectionsString.patchNonNull", + "type.property.nullable.CollectionsStringClient.patchNull": "Type.Property.Nullable.CollectionsString.patchNull", + "type.property.nullable.CollectionsStringClient.patchNullWithResponse": "Type.Property.Nullable.CollectionsString.patchNull", + "type.property.nullable.DatetimeOperationAsyncClient": "Type.Property.Nullable.Datetime", + "type.property.nullable.DatetimeOperationAsyncClient.getNonNull": "Type.Property.Nullable.Datetime.getNonNull", + "type.property.nullable.DatetimeOperationAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.Datetime.getNonNull", + "type.property.nullable.DatetimeOperationAsyncClient.getNull": "Type.Property.Nullable.Datetime.getNull", + "type.property.nullable.DatetimeOperationAsyncClient.getNullWithResponse": "Type.Property.Nullable.Datetime.getNull", + "type.property.nullable.DatetimeOperationAsyncClient.patchNonNull": "Type.Property.Nullable.Datetime.patchNonNull", + "type.property.nullable.DatetimeOperationAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.Datetime.patchNonNull", + "type.property.nullable.DatetimeOperationAsyncClient.patchNull": "Type.Property.Nullable.Datetime.patchNull", + "type.property.nullable.DatetimeOperationAsyncClient.patchNullWithResponse": "Type.Property.Nullable.Datetime.patchNull", + "type.property.nullable.DatetimeOperationClient": "Type.Property.Nullable.Datetime", + "type.property.nullable.DatetimeOperationClient.getNonNull": "Type.Property.Nullable.Datetime.getNonNull", + "type.property.nullable.DatetimeOperationClient.getNonNullWithResponse": "Type.Property.Nullable.Datetime.getNonNull", + "type.property.nullable.DatetimeOperationClient.getNull": "Type.Property.Nullable.Datetime.getNull", + "type.property.nullable.DatetimeOperationClient.getNullWithResponse": "Type.Property.Nullable.Datetime.getNull", + "type.property.nullable.DatetimeOperationClient.patchNonNull": "Type.Property.Nullable.Datetime.patchNonNull", + "type.property.nullable.DatetimeOperationClient.patchNonNullWithResponse": "Type.Property.Nullable.Datetime.patchNonNull", + "type.property.nullable.DatetimeOperationClient.patchNull": "Type.Property.Nullable.Datetime.patchNull", + "type.property.nullable.DatetimeOperationClient.patchNullWithResponse": "Type.Property.Nullable.Datetime.patchNull", + "type.property.nullable.DurationOperationAsyncClient": "Type.Property.Nullable.Duration", + "type.property.nullable.DurationOperationAsyncClient.getNonNull": "Type.Property.Nullable.Duration.getNonNull", + "type.property.nullable.DurationOperationAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.Duration.getNonNull", + "type.property.nullable.DurationOperationAsyncClient.getNull": "Type.Property.Nullable.Duration.getNull", + "type.property.nullable.DurationOperationAsyncClient.getNullWithResponse": "Type.Property.Nullable.Duration.getNull", + "type.property.nullable.DurationOperationAsyncClient.patchNonNull": "Type.Property.Nullable.Duration.patchNonNull", + "type.property.nullable.DurationOperationAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.Duration.patchNonNull", + "type.property.nullable.DurationOperationAsyncClient.patchNull": "Type.Property.Nullable.Duration.patchNull", + "type.property.nullable.DurationOperationAsyncClient.patchNullWithResponse": "Type.Property.Nullable.Duration.patchNull", + "type.property.nullable.DurationOperationClient": "Type.Property.Nullable.Duration", + "type.property.nullable.DurationOperationClient.getNonNull": "Type.Property.Nullable.Duration.getNonNull", + "type.property.nullable.DurationOperationClient.getNonNullWithResponse": "Type.Property.Nullable.Duration.getNonNull", + "type.property.nullable.DurationOperationClient.getNull": "Type.Property.Nullable.Duration.getNull", + "type.property.nullable.DurationOperationClient.getNullWithResponse": "Type.Property.Nullable.Duration.getNull", + "type.property.nullable.DurationOperationClient.patchNonNull": "Type.Property.Nullable.Duration.patchNonNull", + "type.property.nullable.DurationOperationClient.patchNonNullWithResponse": "Type.Property.Nullable.Duration.patchNonNull", + "type.property.nullable.DurationOperationClient.patchNull": "Type.Property.Nullable.Duration.patchNull", + "type.property.nullable.DurationOperationClient.patchNullWithResponse": "Type.Property.Nullable.Duration.patchNull", + "type.property.nullable.NullableClientBuilder": "Type.Property.Nullable", + "type.property.nullable.StringOperationAsyncClient": "Type.Property.Nullable.String", + "type.property.nullable.StringOperationAsyncClient.getNonNull": "Type.Property.Nullable.String.getNonNull", + "type.property.nullable.StringOperationAsyncClient.getNonNullWithResponse": "Type.Property.Nullable.String.getNonNull", + "type.property.nullable.StringOperationAsyncClient.getNull": "Type.Property.Nullable.String.getNull", + "type.property.nullable.StringOperationAsyncClient.getNullWithResponse": "Type.Property.Nullable.String.getNull", + "type.property.nullable.StringOperationAsyncClient.patchNonNull": "Type.Property.Nullable.String.patchNonNull", + "type.property.nullable.StringOperationAsyncClient.patchNonNullWithResponse": "Type.Property.Nullable.String.patchNonNull", + "type.property.nullable.StringOperationAsyncClient.patchNull": "Type.Property.Nullable.String.patchNull", + "type.property.nullable.StringOperationAsyncClient.patchNullWithResponse": "Type.Property.Nullable.String.patchNull", + "type.property.nullable.StringOperationClient": "Type.Property.Nullable.String", + "type.property.nullable.StringOperationClient.getNonNull": "Type.Property.Nullable.String.getNonNull", + "type.property.nullable.StringOperationClient.getNonNullWithResponse": "Type.Property.Nullable.String.getNonNull", + "type.property.nullable.StringOperationClient.getNull": "Type.Property.Nullable.String.getNull", + "type.property.nullable.StringOperationClient.getNullWithResponse": "Type.Property.Nullable.String.getNull", + "type.property.nullable.StringOperationClient.patchNonNull": "Type.Property.Nullable.String.patchNonNull", + "type.property.nullable.StringOperationClient.patchNonNullWithResponse": "Type.Property.Nullable.String.patchNonNull", + "type.property.nullable.StringOperationClient.patchNull": "Type.Property.Nullable.String.patchNull", + "type.property.nullable.StringOperationClient.patchNullWithResponse": "Type.Property.Nullable.String.patchNull", + "type.property.nullable.models.BytesProperty": "Type.Property.Nullable.BytesProperty", + "type.property.nullable.models.CollectionsByteProperty": "Type.Property.Nullable.CollectionsByteProperty", + "type.property.nullable.models.CollectionsModelProperty": "Type.Property.Nullable.CollectionsModelProperty", + "type.property.nullable.models.CollectionsStringProperty": "Type.Property.Nullable.CollectionsStringProperty", + "type.property.nullable.models.DatetimeProperty": "Type.Property.Nullable.DatetimeProperty", + "type.property.nullable.models.DurationProperty": "Type.Property.Nullable.DurationProperty", + "type.property.nullable.models.InnerModel": "Type.Property.Nullable.InnerModel", + "type.property.nullable.models.StringProperty": "Type.Property.Nullable.StringProperty" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_metadata.json new file mode 100644 index 00000000000..c2b21d66665 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-nullable_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.property.nullable.BytesAsyncClient":"Type.Property.Nullable.Bytes","type.property.nullable.BytesAsyncClient.getNonNull":"Type.Property.Nullable.Bytes.getNonNull","type.property.nullable.BytesAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.Bytes.getNonNull","type.property.nullable.BytesAsyncClient.getNull":"Type.Property.Nullable.Bytes.getNull","type.property.nullable.BytesAsyncClient.getNullWithResponse":"Type.Property.Nullable.Bytes.getNull","type.property.nullable.BytesAsyncClient.patchNonNull":"Type.Property.Nullable.Bytes.patchNonNull","type.property.nullable.BytesAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.Bytes.patchNonNull","type.property.nullable.BytesAsyncClient.patchNull":"Type.Property.Nullable.Bytes.patchNull","type.property.nullable.BytesAsyncClient.patchNullWithResponse":"Type.Property.Nullable.Bytes.patchNull","type.property.nullable.BytesClient":"Type.Property.Nullable.Bytes","type.property.nullable.BytesClient.getNonNull":"Type.Property.Nullable.Bytes.getNonNull","type.property.nullable.BytesClient.getNonNullWithResponse":"Type.Property.Nullable.Bytes.getNonNull","type.property.nullable.BytesClient.getNull":"Type.Property.Nullable.Bytes.getNull","type.property.nullable.BytesClient.getNullWithResponse":"Type.Property.Nullable.Bytes.getNull","type.property.nullable.BytesClient.patchNonNull":"Type.Property.Nullable.Bytes.patchNonNull","type.property.nullable.BytesClient.patchNonNullWithResponse":"Type.Property.Nullable.Bytes.patchNonNull","type.property.nullable.BytesClient.patchNull":"Type.Property.Nullable.Bytes.patchNull","type.property.nullable.BytesClient.patchNullWithResponse":"Type.Property.Nullable.Bytes.patchNull","type.property.nullable.CollectionsByteAsyncClient":"Type.Property.Nullable.CollectionsByte","type.property.nullable.CollectionsByteAsyncClient.getNonNull":"Type.Property.Nullable.CollectionsByte.getNonNull","type.property.nullable.CollectionsByteAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.CollectionsByte.getNonNull","type.property.nullable.CollectionsByteAsyncClient.getNull":"Type.Property.Nullable.CollectionsByte.getNull","type.property.nullable.CollectionsByteAsyncClient.getNullWithResponse":"Type.Property.Nullable.CollectionsByte.getNull","type.property.nullable.CollectionsByteAsyncClient.patchNonNull":"Type.Property.Nullable.CollectionsByte.patchNonNull","type.property.nullable.CollectionsByteAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.CollectionsByte.patchNonNull","type.property.nullable.CollectionsByteAsyncClient.patchNull":"Type.Property.Nullable.CollectionsByte.patchNull","type.property.nullable.CollectionsByteAsyncClient.patchNullWithResponse":"Type.Property.Nullable.CollectionsByte.patchNull","type.property.nullable.CollectionsByteClient":"Type.Property.Nullable.CollectionsByte","type.property.nullable.CollectionsByteClient.getNonNull":"Type.Property.Nullable.CollectionsByte.getNonNull","type.property.nullable.CollectionsByteClient.getNonNullWithResponse":"Type.Property.Nullable.CollectionsByte.getNonNull","type.property.nullable.CollectionsByteClient.getNull":"Type.Property.Nullable.CollectionsByte.getNull","type.property.nullable.CollectionsByteClient.getNullWithResponse":"Type.Property.Nullable.CollectionsByte.getNull","type.property.nullable.CollectionsByteClient.patchNonNull":"Type.Property.Nullable.CollectionsByte.patchNonNull","type.property.nullable.CollectionsByteClient.patchNonNullWithResponse":"Type.Property.Nullable.CollectionsByte.patchNonNull","type.property.nullable.CollectionsByteClient.patchNull":"Type.Property.Nullable.CollectionsByte.patchNull","type.property.nullable.CollectionsByteClient.patchNullWithResponse":"Type.Property.Nullable.CollectionsByte.patchNull","type.property.nullable.CollectionsModelAsyncClient":"Type.Property.Nullable.CollectionsModel","type.property.nullable.CollectionsModelAsyncClient.getNonNull":"Type.Property.Nullable.CollectionsModel.getNonNull","type.property.nullable.CollectionsModelAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.CollectionsModel.getNonNull","type.property.nullable.CollectionsModelAsyncClient.getNull":"Type.Property.Nullable.CollectionsModel.getNull","type.property.nullable.CollectionsModelAsyncClient.getNullWithResponse":"Type.Property.Nullable.CollectionsModel.getNull","type.property.nullable.CollectionsModelAsyncClient.patchNonNull":"Type.Property.Nullable.CollectionsModel.patchNonNull","type.property.nullable.CollectionsModelAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.CollectionsModel.patchNonNull","type.property.nullable.CollectionsModelAsyncClient.patchNull":"Type.Property.Nullable.CollectionsModel.patchNull","type.property.nullable.CollectionsModelAsyncClient.patchNullWithResponse":"Type.Property.Nullable.CollectionsModel.patchNull","type.property.nullable.CollectionsModelClient":"Type.Property.Nullable.CollectionsModel","type.property.nullable.CollectionsModelClient.getNonNull":"Type.Property.Nullable.CollectionsModel.getNonNull","type.property.nullable.CollectionsModelClient.getNonNullWithResponse":"Type.Property.Nullable.CollectionsModel.getNonNull","type.property.nullable.CollectionsModelClient.getNull":"Type.Property.Nullable.CollectionsModel.getNull","type.property.nullable.CollectionsModelClient.getNullWithResponse":"Type.Property.Nullable.CollectionsModel.getNull","type.property.nullable.CollectionsModelClient.patchNonNull":"Type.Property.Nullable.CollectionsModel.patchNonNull","type.property.nullable.CollectionsModelClient.patchNonNullWithResponse":"Type.Property.Nullable.CollectionsModel.patchNonNull","type.property.nullable.CollectionsModelClient.patchNull":"Type.Property.Nullable.CollectionsModel.patchNull","type.property.nullable.CollectionsModelClient.patchNullWithResponse":"Type.Property.Nullable.CollectionsModel.patchNull","type.property.nullable.CollectionsStringAsyncClient":"Type.Property.Nullable.CollectionsString","type.property.nullable.CollectionsStringAsyncClient.getNonNull":"Type.Property.Nullable.CollectionsString.getNonNull","type.property.nullable.CollectionsStringAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.CollectionsString.getNonNull","type.property.nullable.CollectionsStringAsyncClient.getNull":"Type.Property.Nullable.CollectionsString.getNull","type.property.nullable.CollectionsStringAsyncClient.getNullWithResponse":"Type.Property.Nullable.CollectionsString.getNull","type.property.nullable.CollectionsStringAsyncClient.patchNonNull":"Type.Property.Nullable.CollectionsString.patchNonNull","type.property.nullable.CollectionsStringAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.CollectionsString.patchNonNull","type.property.nullable.CollectionsStringAsyncClient.patchNull":"Type.Property.Nullable.CollectionsString.patchNull","type.property.nullable.CollectionsStringAsyncClient.patchNullWithResponse":"Type.Property.Nullable.CollectionsString.patchNull","type.property.nullable.CollectionsStringClient":"Type.Property.Nullable.CollectionsString","type.property.nullable.CollectionsStringClient.getNonNull":"Type.Property.Nullable.CollectionsString.getNonNull","type.property.nullable.CollectionsStringClient.getNonNullWithResponse":"Type.Property.Nullable.CollectionsString.getNonNull","type.property.nullable.CollectionsStringClient.getNull":"Type.Property.Nullable.CollectionsString.getNull","type.property.nullable.CollectionsStringClient.getNullWithResponse":"Type.Property.Nullable.CollectionsString.getNull","type.property.nullable.CollectionsStringClient.patchNonNull":"Type.Property.Nullable.CollectionsString.patchNonNull","type.property.nullable.CollectionsStringClient.patchNonNullWithResponse":"Type.Property.Nullable.CollectionsString.patchNonNull","type.property.nullable.CollectionsStringClient.patchNull":"Type.Property.Nullable.CollectionsString.patchNull","type.property.nullable.CollectionsStringClient.patchNullWithResponse":"Type.Property.Nullable.CollectionsString.patchNull","type.property.nullable.DatetimeOperationAsyncClient":"Type.Property.Nullable.Datetime","type.property.nullable.DatetimeOperationAsyncClient.getNonNull":"Type.Property.Nullable.Datetime.getNonNull","type.property.nullable.DatetimeOperationAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.Datetime.getNonNull","type.property.nullable.DatetimeOperationAsyncClient.getNull":"Type.Property.Nullable.Datetime.getNull","type.property.nullable.DatetimeOperationAsyncClient.getNullWithResponse":"Type.Property.Nullable.Datetime.getNull","type.property.nullable.DatetimeOperationAsyncClient.patchNonNull":"Type.Property.Nullable.Datetime.patchNonNull","type.property.nullable.DatetimeOperationAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.Datetime.patchNonNull","type.property.nullable.DatetimeOperationAsyncClient.patchNull":"Type.Property.Nullable.Datetime.patchNull","type.property.nullable.DatetimeOperationAsyncClient.patchNullWithResponse":"Type.Property.Nullable.Datetime.patchNull","type.property.nullable.DatetimeOperationClient":"Type.Property.Nullable.Datetime","type.property.nullable.DatetimeOperationClient.getNonNull":"Type.Property.Nullable.Datetime.getNonNull","type.property.nullable.DatetimeOperationClient.getNonNullWithResponse":"Type.Property.Nullable.Datetime.getNonNull","type.property.nullable.DatetimeOperationClient.getNull":"Type.Property.Nullable.Datetime.getNull","type.property.nullable.DatetimeOperationClient.getNullWithResponse":"Type.Property.Nullable.Datetime.getNull","type.property.nullable.DatetimeOperationClient.patchNonNull":"Type.Property.Nullable.Datetime.patchNonNull","type.property.nullable.DatetimeOperationClient.patchNonNullWithResponse":"Type.Property.Nullable.Datetime.patchNonNull","type.property.nullable.DatetimeOperationClient.patchNull":"Type.Property.Nullable.Datetime.patchNull","type.property.nullable.DatetimeOperationClient.patchNullWithResponse":"Type.Property.Nullable.Datetime.patchNull","type.property.nullable.DurationOperationAsyncClient":"Type.Property.Nullable.Duration","type.property.nullable.DurationOperationAsyncClient.getNonNull":"Type.Property.Nullable.Duration.getNonNull","type.property.nullable.DurationOperationAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.Duration.getNonNull","type.property.nullable.DurationOperationAsyncClient.getNull":"Type.Property.Nullable.Duration.getNull","type.property.nullable.DurationOperationAsyncClient.getNullWithResponse":"Type.Property.Nullable.Duration.getNull","type.property.nullable.DurationOperationAsyncClient.patchNonNull":"Type.Property.Nullable.Duration.patchNonNull","type.property.nullable.DurationOperationAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.Duration.patchNonNull","type.property.nullable.DurationOperationAsyncClient.patchNull":"Type.Property.Nullable.Duration.patchNull","type.property.nullable.DurationOperationAsyncClient.patchNullWithResponse":"Type.Property.Nullable.Duration.patchNull","type.property.nullable.DurationOperationClient":"Type.Property.Nullable.Duration","type.property.nullable.DurationOperationClient.getNonNull":"Type.Property.Nullable.Duration.getNonNull","type.property.nullable.DurationOperationClient.getNonNullWithResponse":"Type.Property.Nullable.Duration.getNonNull","type.property.nullable.DurationOperationClient.getNull":"Type.Property.Nullable.Duration.getNull","type.property.nullable.DurationOperationClient.getNullWithResponse":"Type.Property.Nullable.Duration.getNull","type.property.nullable.DurationOperationClient.patchNonNull":"Type.Property.Nullable.Duration.patchNonNull","type.property.nullable.DurationOperationClient.patchNonNullWithResponse":"Type.Property.Nullable.Duration.patchNonNull","type.property.nullable.DurationOperationClient.patchNull":"Type.Property.Nullable.Duration.patchNull","type.property.nullable.DurationOperationClient.patchNullWithResponse":"Type.Property.Nullable.Duration.patchNull","type.property.nullable.NullableClientBuilder":"Type.Property.Nullable","type.property.nullable.StringOperationAsyncClient":"Type.Property.Nullable.String","type.property.nullable.StringOperationAsyncClient.getNonNull":"Type.Property.Nullable.String.getNonNull","type.property.nullable.StringOperationAsyncClient.getNonNullWithResponse":"Type.Property.Nullable.String.getNonNull","type.property.nullable.StringOperationAsyncClient.getNull":"Type.Property.Nullable.String.getNull","type.property.nullable.StringOperationAsyncClient.getNullWithResponse":"Type.Property.Nullable.String.getNull","type.property.nullable.StringOperationAsyncClient.patchNonNull":"Type.Property.Nullable.String.patchNonNull","type.property.nullable.StringOperationAsyncClient.patchNonNullWithResponse":"Type.Property.Nullable.String.patchNonNull","type.property.nullable.StringOperationAsyncClient.patchNull":"Type.Property.Nullable.String.patchNull","type.property.nullable.StringOperationAsyncClient.patchNullWithResponse":"Type.Property.Nullable.String.patchNull","type.property.nullable.StringOperationClient":"Type.Property.Nullable.String","type.property.nullable.StringOperationClient.getNonNull":"Type.Property.Nullable.String.getNonNull","type.property.nullable.StringOperationClient.getNonNullWithResponse":"Type.Property.Nullable.String.getNonNull","type.property.nullable.StringOperationClient.getNull":"Type.Property.Nullable.String.getNull","type.property.nullable.StringOperationClient.getNullWithResponse":"Type.Property.Nullable.String.getNull","type.property.nullable.StringOperationClient.patchNonNull":"Type.Property.Nullable.String.patchNonNull","type.property.nullable.StringOperationClient.patchNonNullWithResponse":"Type.Property.Nullable.String.patchNonNull","type.property.nullable.StringOperationClient.patchNull":"Type.Property.Nullable.String.patchNull","type.property.nullable.StringOperationClient.patchNullWithResponse":"Type.Property.Nullable.String.patchNull","type.property.nullable.models.BytesProperty":"Type.Property.Nullable.BytesProperty","type.property.nullable.models.CollectionsByteProperty":"Type.Property.Nullable.CollectionsByteProperty","type.property.nullable.models.CollectionsModelProperty":"Type.Property.Nullable.CollectionsModelProperty","type.property.nullable.models.CollectionsStringProperty":"Type.Property.Nullable.CollectionsStringProperty","type.property.nullable.models.DatetimeProperty":"Type.Property.Nullable.DatetimeProperty","type.property.nullable.models.DurationProperty":"Type.Property.Nullable.DurationProperty","type.property.nullable.models.InnerModel":"Type.Property.Nullable.InnerModel","type.property.nullable.models.StringProperty":"Type.Property.Nullable.StringProperty"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/property/nullable/BytesAsyncClient.java","src/main/java/type/property/nullable/BytesClient.java","src/main/java/type/property/nullable/CollectionsByteAsyncClient.java","src/main/java/type/property/nullable/CollectionsByteClient.java","src/main/java/type/property/nullable/CollectionsModelAsyncClient.java","src/main/java/type/property/nullable/CollectionsModelClient.java","src/main/java/type/property/nullable/CollectionsStringAsyncClient.java","src/main/java/type/property/nullable/CollectionsStringClient.java","src/main/java/type/property/nullable/DatetimeOperationAsyncClient.java","src/main/java/type/property/nullable/DatetimeOperationClient.java","src/main/java/type/property/nullable/DurationOperationAsyncClient.java","src/main/java/type/property/nullable/DurationOperationClient.java","src/main/java/type/property/nullable/NullableClientBuilder.java","src/main/java/type/property/nullable/StringOperationAsyncClient.java","src/main/java/type/property/nullable/StringOperationClient.java","src/main/java/type/property/nullable/implementation/BytesImpl.java","src/main/java/type/property/nullable/implementation/CollectionsBytesImpl.java","src/main/java/type/property/nullable/implementation/CollectionsModelsImpl.java","src/main/java/type/property/nullable/implementation/CollectionsStringsImpl.java","src/main/java/type/property/nullable/implementation/DatetimeOperationsImpl.java","src/main/java/type/property/nullable/implementation/DurationOperationsImpl.java","src/main/java/type/property/nullable/implementation/JsonMergePatchHelper.java","src/main/java/type/property/nullable/implementation/NullableClientImpl.java","src/main/java/type/property/nullable/implementation/StringOperationsImpl.java","src/main/java/type/property/nullable/implementation/package-info.java","src/main/java/type/property/nullable/models/BytesProperty.java","src/main/java/type/property/nullable/models/CollectionsByteProperty.java","src/main/java/type/property/nullable/models/CollectionsModelProperty.java","src/main/java/type/property/nullable/models/CollectionsStringProperty.java","src/main/java/type/property/nullable/models/DatetimeProperty.java","src/main/java/type/property/nullable/models/DurationProperty.java","src/main/java/type/property/nullable/models/InnerModel.java","src/main/java/type/property/nullable/models/StringProperty.java","src/main/java/type/property/nullable/models/package-info.java","src/main/java/type/property/nullable/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_apiview_properties.json new file mode 100644 index 00000000000..c584d938ab6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_apiview_properties.json @@ -0,0 +1,317 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.property.optional.BooleanLiteralAsyncClient": "Type.Property.Optional.BooleanLiteral", + "type.property.optional.BooleanLiteralAsyncClient.getAll": "Type.Property.Optional.BooleanLiteral.getAll", + "type.property.optional.BooleanLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.BooleanLiteral.getAll", + "type.property.optional.BooleanLiteralAsyncClient.getDefault": "Type.Property.Optional.BooleanLiteral.getDefault", + "type.property.optional.BooleanLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.BooleanLiteral.getDefault", + "type.property.optional.BooleanLiteralAsyncClient.putAll": "Type.Property.Optional.BooleanLiteral.putAll", + "type.property.optional.BooleanLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.BooleanLiteral.putAll", + "type.property.optional.BooleanLiteralAsyncClient.putDefault": "Type.Property.Optional.BooleanLiteral.putDefault", + "type.property.optional.BooleanLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.BooleanLiteral.putDefault", + "type.property.optional.BooleanLiteralClient": "Type.Property.Optional.BooleanLiteral", + "type.property.optional.BooleanLiteralClient.getAll": "Type.Property.Optional.BooleanLiteral.getAll", + "type.property.optional.BooleanLiteralClient.getAllWithResponse": "Type.Property.Optional.BooleanLiteral.getAll", + "type.property.optional.BooleanLiteralClient.getDefault": "Type.Property.Optional.BooleanLiteral.getDefault", + "type.property.optional.BooleanLiteralClient.getDefaultWithResponse": "Type.Property.Optional.BooleanLiteral.getDefault", + "type.property.optional.BooleanLiteralClient.putAll": "Type.Property.Optional.BooleanLiteral.putAll", + "type.property.optional.BooleanLiteralClient.putAllWithResponse": "Type.Property.Optional.BooleanLiteral.putAll", + "type.property.optional.BooleanLiteralClient.putDefault": "Type.Property.Optional.BooleanLiteral.putDefault", + "type.property.optional.BooleanLiteralClient.putDefaultWithResponse": "Type.Property.Optional.BooleanLiteral.putDefault", + "type.property.optional.BytesAsyncClient": "Type.Property.Optional.Bytes", + "type.property.optional.BytesAsyncClient.getAll": "Type.Property.Optional.Bytes.getAll", + "type.property.optional.BytesAsyncClient.getAllWithResponse": "Type.Property.Optional.Bytes.getAll", + "type.property.optional.BytesAsyncClient.getDefault": "Type.Property.Optional.Bytes.getDefault", + "type.property.optional.BytesAsyncClient.getDefaultWithResponse": "Type.Property.Optional.Bytes.getDefault", + "type.property.optional.BytesAsyncClient.putAll": "Type.Property.Optional.Bytes.putAll", + "type.property.optional.BytesAsyncClient.putAllWithResponse": "Type.Property.Optional.Bytes.putAll", + "type.property.optional.BytesAsyncClient.putDefault": "Type.Property.Optional.Bytes.putDefault", + "type.property.optional.BytesAsyncClient.putDefaultWithResponse": "Type.Property.Optional.Bytes.putDefault", + "type.property.optional.BytesClient": "Type.Property.Optional.Bytes", + "type.property.optional.BytesClient.getAll": "Type.Property.Optional.Bytes.getAll", + "type.property.optional.BytesClient.getAllWithResponse": "Type.Property.Optional.Bytes.getAll", + "type.property.optional.BytesClient.getDefault": "Type.Property.Optional.Bytes.getDefault", + "type.property.optional.BytesClient.getDefaultWithResponse": "Type.Property.Optional.Bytes.getDefault", + "type.property.optional.BytesClient.putAll": "Type.Property.Optional.Bytes.putAll", + "type.property.optional.BytesClient.putAllWithResponse": "Type.Property.Optional.Bytes.putAll", + "type.property.optional.BytesClient.putDefault": "Type.Property.Optional.Bytes.putDefault", + "type.property.optional.BytesClient.putDefaultWithResponse": "Type.Property.Optional.Bytes.putDefault", + "type.property.optional.CollectionsByteAsyncClient": "Type.Property.Optional.CollectionsByte", + "type.property.optional.CollectionsByteAsyncClient.getAll": "Type.Property.Optional.CollectionsByte.getAll", + "type.property.optional.CollectionsByteAsyncClient.getAllWithResponse": "Type.Property.Optional.CollectionsByte.getAll", + "type.property.optional.CollectionsByteAsyncClient.getDefault": "Type.Property.Optional.CollectionsByte.getDefault", + "type.property.optional.CollectionsByteAsyncClient.getDefaultWithResponse": "Type.Property.Optional.CollectionsByte.getDefault", + "type.property.optional.CollectionsByteAsyncClient.putAll": "Type.Property.Optional.CollectionsByte.putAll", + "type.property.optional.CollectionsByteAsyncClient.putAllWithResponse": "Type.Property.Optional.CollectionsByte.putAll", + "type.property.optional.CollectionsByteAsyncClient.putDefault": "Type.Property.Optional.CollectionsByte.putDefault", + "type.property.optional.CollectionsByteAsyncClient.putDefaultWithResponse": "Type.Property.Optional.CollectionsByte.putDefault", + "type.property.optional.CollectionsByteClient": "Type.Property.Optional.CollectionsByte", + "type.property.optional.CollectionsByteClient.getAll": "Type.Property.Optional.CollectionsByte.getAll", + "type.property.optional.CollectionsByteClient.getAllWithResponse": "Type.Property.Optional.CollectionsByte.getAll", + "type.property.optional.CollectionsByteClient.getDefault": "Type.Property.Optional.CollectionsByte.getDefault", + "type.property.optional.CollectionsByteClient.getDefaultWithResponse": "Type.Property.Optional.CollectionsByte.getDefault", + "type.property.optional.CollectionsByteClient.putAll": "Type.Property.Optional.CollectionsByte.putAll", + "type.property.optional.CollectionsByteClient.putAllWithResponse": "Type.Property.Optional.CollectionsByte.putAll", + "type.property.optional.CollectionsByteClient.putDefault": "Type.Property.Optional.CollectionsByte.putDefault", + "type.property.optional.CollectionsByteClient.putDefaultWithResponse": "Type.Property.Optional.CollectionsByte.putDefault", + "type.property.optional.CollectionsModelAsyncClient": "Type.Property.Optional.CollectionsModel", + "type.property.optional.CollectionsModelAsyncClient.getAll": "Type.Property.Optional.CollectionsModel.getAll", + "type.property.optional.CollectionsModelAsyncClient.getAllWithResponse": "Type.Property.Optional.CollectionsModel.getAll", + "type.property.optional.CollectionsModelAsyncClient.getDefault": "Type.Property.Optional.CollectionsModel.getDefault", + "type.property.optional.CollectionsModelAsyncClient.getDefaultWithResponse": "Type.Property.Optional.CollectionsModel.getDefault", + "type.property.optional.CollectionsModelAsyncClient.putAll": "Type.Property.Optional.CollectionsModel.putAll", + "type.property.optional.CollectionsModelAsyncClient.putAllWithResponse": "Type.Property.Optional.CollectionsModel.putAll", + "type.property.optional.CollectionsModelAsyncClient.putDefault": "Type.Property.Optional.CollectionsModel.putDefault", + "type.property.optional.CollectionsModelAsyncClient.putDefaultWithResponse": "Type.Property.Optional.CollectionsModel.putDefault", + "type.property.optional.CollectionsModelClient": "Type.Property.Optional.CollectionsModel", + "type.property.optional.CollectionsModelClient.getAll": "Type.Property.Optional.CollectionsModel.getAll", + "type.property.optional.CollectionsModelClient.getAllWithResponse": "Type.Property.Optional.CollectionsModel.getAll", + "type.property.optional.CollectionsModelClient.getDefault": "Type.Property.Optional.CollectionsModel.getDefault", + "type.property.optional.CollectionsModelClient.getDefaultWithResponse": "Type.Property.Optional.CollectionsModel.getDefault", + "type.property.optional.CollectionsModelClient.putAll": "Type.Property.Optional.CollectionsModel.putAll", + "type.property.optional.CollectionsModelClient.putAllWithResponse": "Type.Property.Optional.CollectionsModel.putAll", + "type.property.optional.CollectionsModelClient.putDefault": "Type.Property.Optional.CollectionsModel.putDefault", + "type.property.optional.CollectionsModelClient.putDefaultWithResponse": "Type.Property.Optional.CollectionsModel.putDefault", + "type.property.optional.DatetimeOperationAsyncClient": "Type.Property.Optional.Datetime", + "type.property.optional.DatetimeOperationAsyncClient.getAll": "Type.Property.Optional.Datetime.getAll", + "type.property.optional.DatetimeOperationAsyncClient.getAllWithResponse": "Type.Property.Optional.Datetime.getAll", + "type.property.optional.DatetimeOperationAsyncClient.getDefault": "Type.Property.Optional.Datetime.getDefault", + "type.property.optional.DatetimeOperationAsyncClient.getDefaultWithResponse": "Type.Property.Optional.Datetime.getDefault", + "type.property.optional.DatetimeOperationAsyncClient.putAll": "Type.Property.Optional.Datetime.putAll", + "type.property.optional.DatetimeOperationAsyncClient.putAllWithResponse": "Type.Property.Optional.Datetime.putAll", + "type.property.optional.DatetimeOperationAsyncClient.putDefault": "Type.Property.Optional.Datetime.putDefault", + "type.property.optional.DatetimeOperationAsyncClient.putDefaultWithResponse": "Type.Property.Optional.Datetime.putDefault", + "type.property.optional.DatetimeOperationClient": "Type.Property.Optional.Datetime", + "type.property.optional.DatetimeOperationClient.getAll": "Type.Property.Optional.Datetime.getAll", + "type.property.optional.DatetimeOperationClient.getAllWithResponse": "Type.Property.Optional.Datetime.getAll", + "type.property.optional.DatetimeOperationClient.getDefault": "Type.Property.Optional.Datetime.getDefault", + "type.property.optional.DatetimeOperationClient.getDefaultWithResponse": "Type.Property.Optional.Datetime.getDefault", + "type.property.optional.DatetimeOperationClient.putAll": "Type.Property.Optional.Datetime.putAll", + "type.property.optional.DatetimeOperationClient.putAllWithResponse": "Type.Property.Optional.Datetime.putAll", + "type.property.optional.DatetimeOperationClient.putDefault": "Type.Property.Optional.Datetime.putDefault", + "type.property.optional.DatetimeOperationClient.putDefaultWithResponse": "Type.Property.Optional.Datetime.putDefault", + "type.property.optional.DurationOperationAsyncClient": "Type.Property.Optional.Duration", + "type.property.optional.DurationOperationAsyncClient.getAll": "Type.Property.Optional.Duration.getAll", + "type.property.optional.DurationOperationAsyncClient.getAllWithResponse": "Type.Property.Optional.Duration.getAll", + "type.property.optional.DurationOperationAsyncClient.getDefault": "Type.Property.Optional.Duration.getDefault", + "type.property.optional.DurationOperationAsyncClient.getDefaultWithResponse": "Type.Property.Optional.Duration.getDefault", + "type.property.optional.DurationOperationAsyncClient.putAll": "Type.Property.Optional.Duration.putAll", + "type.property.optional.DurationOperationAsyncClient.putAllWithResponse": "Type.Property.Optional.Duration.putAll", + "type.property.optional.DurationOperationAsyncClient.putDefault": "Type.Property.Optional.Duration.putDefault", + "type.property.optional.DurationOperationAsyncClient.putDefaultWithResponse": "Type.Property.Optional.Duration.putDefault", + "type.property.optional.DurationOperationClient": "Type.Property.Optional.Duration", + "type.property.optional.DurationOperationClient.getAll": "Type.Property.Optional.Duration.getAll", + "type.property.optional.DurationOperationClient.getAllWithResponse": "Type.Property.Optional.Duration.getAll", + "type.property.optional.DurationOperationClient.getDefault": "Type.Property.Optional.Duration.getDefault", + "type.property.optional.DurationOperationClient.getDefaultWithResponse": "Type.Property.Optional.Duration.getDefault", + "type.property.optional.DurationOperationClient.putAll": "Type.Property.Optional.Duration.putAll", + "type.property.optional.DurationOperationClient.putAllWithResponse": "Type.Property.Optional.Duration.putAll", + "type.property.optional.DurationOperationClient.putDefault": "Type.Property.Optional.Duration.putDefault", + "type.property.optional.DurationOperationClient.putDefaultWithResponse": "Type.Property.Optional.Duration.putDefault", + "type.property.optional.FloatLiteralAsyncClient": "Type.Property.Optional.FloatLiteral", + "type.property.optional.FloatLiteralAsyncClient.getAll": "Type.Property.Optional.FloatLiteral.getAll", + "type.property.optional.FloatLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.FloatLiteral.getAll", + "type.property.optional.FloatLiteralAsyncClient.getDefault": "Type.Property.Optional.FloatLiteral.getDefault", + "type.property.optional.FloatLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.FloatLiteral.getDefault", + "type.property.optional.FloatLiteralAsyncClient.putAll": "Type.Property.Optional.FloatLiteral.putAll", + "type.property.optional.FloatLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.FloatLiteral.putAll", + "type.property.optional.FloatLiteralAsyncClient.putDefault": "Type.Property.Optional.FloatLiteral.putDefault", + "type.property.optional.FloatLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.FloatLiteral.putDefault", + "type.property.optional.FloatLiteralClient": "Type.Property.Optional.FloatLiteral", + "type.property.optional.FloatLiteralClient.getAll": "Type.Property.Optional.FloatLiteral.getAll", + "type.property.optional.FloatLiteralClient.getAllWithResponse": "Type.Property.Optional.FloatLiteral.getAll", + "type.property.optional.FloatLiteralClient.getDefault": "Type.Property.Optional.FloatLiteral.getDefault", + "type.property.optional.FloatLiteralClient.getDefaultWithResponse": "Type.Property.Optional.FloatLiteral.getDefault", + "type.property.optional.FloatLiteralClient.putAll": "Type.Property.Optional.FloatLiteral.putAll", + "type.property.optional.FloatLiteralClient.putAllWithResponse": "Type.Property.Optional.FloatLiteral.putAll", + "type.property.optional.FloatLiteralClient.putDefault": "Type.Property.Optional.FloatLiteral.putDefault", + "type.property.optional.FloatLiteralClient.putDefaultWithResponse": "Type.Property.Optional.FloatLiteral.putDefault", + "type.property.optional.IntLiteralAsyncClient": "Type.Property.Optional.IntLiteral", + "type.property.optional.IntLiteralAsyncClient.getAll": "Type.Property.Optional.IntLiteral.getAll", + "type.property.optional.IntLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.IntLiteral.getAll", + "type.property.optional.IntLiteralAsyncClient.getDefault": "Type.Property.Optional.IntLiteral.getDefault", + "type.property.optional.IntLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.IntLiteral.getDefault", + "type.property.optional.IntLiteralAsyncClient.putAll": "Type.Property.Optional.IntLiteral.putAll", + "type.property.optional.IntLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.IntLiteral.putAll", + "type.property.optional.IntLiteralAsyncClient.putDefault": "Type.Property.Optional.IntLiteral.putDefault", + "type.property.optional.IntLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.IntLiteral.putDefault", + "type.property.optional.IntLiteralClient": "Type.Property.Optional.IntLiteral", + "type.property.optional.IntLiteralClient.getAll": "Type.Property.Optional.IntLiteral.getAll", + "type.property.optional.IntLiteralClient.getAllWithResponse": "Type.Property.Optional.IntLiteral.getAll", + "type.property.optional.IntLiteralClient.getDefault": "Type.Property.Optional.IntLiteral.getDefault", + "type.property.optional.IntLiteralClient.getDefaultWithResponse": "Type.Property.Optional.IntLiteral.getDefault", + "type.property.optional.IntLiteralClient.putAll": "Type.Property.Optional.IntLiteral.putAll", + "type.property.optional.IntLiteralClient.putAllWithResponse": "Type.Property.Optional.IntLiteral.putAll", + "type.property.optional.IntLiteralClient.putDefault": "Type.Property.Optional.IntLiteral.putDefault", + "type.property.optional.IntLiteralClient.putDefaultWithResponse": "Type.Property.Optional.IntLiteral.putDefault", + "type.property.optional.OptionalClientBuilder": "Type.Property.Optional", + "type.property.optional.PlainDateAsyncClient": "Type.Property.Optional.PlainDate", + "type.property.optional.PlainDateAsyncClient.getAll": "Type.Property.Optional.PlainDate.getAll", + "type.property.optional.PlainDateAsyncClient.getAllWithResponse": "Type.Property.Optional.PlainDate.getAll", + "type.property.optional.PlainDateAsyncClient.getDefault": "Type.Property.Optional.PlainDate.getDefault", + "type.property.optional.PlainDateAsyncClient.getDefaultWithResponse": "Type.Property.Optional.PlainDate.getDefault", + "type.property.optional.PlainDateAsyncClient.putAll": "Type.Property.Optional.PlainDate.putAll", + "type.property.optional.PlainDateAsyncClient.putAllWithResponse": "Type.Property.Optional.PlainDate.putAll", + "type.property.optional.PlainDateAsyncClient.putDefault": "Type.Property.Optional.PlainDate.putDefault", + "type.property.optional.PlainDateAsyncClient.putDefaultWithResponse": "Type.Property.Optional.PlainDate.putDefault", + "type.property.optional.PlainDateClient": "Type.Property.Optional.PlainDate", + "type.property.optional.PlainDateClient.getAll": "Type.Property.Optional.PlainDate.getAll", + "type.property.optional.PlainDateClient.getAllWithResponse": "Type.Property.Optional.PlainDate.getAll", + "type.property.optional.PlainDateClient.getDefault": "Type.Property.Optional.PlainDate.getDefault", + "type.property.optional.PlainDateClient.getDefaultWithResponse": "Type.Property.Optional.PlainDate.getDefault", + "type.property.optional.PlainDateClient.putAll": "Type.Property.Optional.PlainDate.putAll", + "type.property.optional.PlainDateClient.putAllWithResponse": "Type.Property.Optional.PlainDate.putAll", + "type.property.optional.PlainDateClient.putDefault": "Type.Property.Optional.PlainDate.putDefault", + "type.property.optional.PlainDateClient.putDefaultWithResponse": "Type.Property.Optional.PlainDate.putDefault", + "type.property.optional.PlainTimeAsyncClient": "Type.Property.Optional.PlainTime", + "type.property.optional.PlainTimeAsyncClient.getAll": "Type.Property.Optional.PlainTime.getAll", + "type.property.optional.PlainTimeAsyncClient.getAllWithResponse": "Type.Property.Optional.PlainTime.getAll", + "type.property.optional.PlainTimeAsyncClient.getDefault": "Type.Property.Optional.PlainTime.getDefault", + "type.property.optional.PlainTimeAsyncClient.getDefaultWithResponse": "Type.Property.Optional.PlainTime.getDefault", + "type.property.optional.PlainTimeAsyncClient.putAll": "Type.Property.Optional.PlainTime.putAll", + "type.property.optional.PlainTimeAsyncClient.putAllWithResponse": "Type.Property.Optional.PlainTime.putAll", + "type.property.optional.PlainTimeAsyncClient.putDefault": "Type.Property.Optional.PlainTime.putDefault", + "type.property.optional.PlainTimeAsyncClient.putDefaultWithResponse": "Type.Property.Optional.PlainTime.putDefault", + "type.property.optional.PlainTimeClient": "Type.Property.Optional.PlainTime", + "type.property.optional.PlainTimeClient.getAll": "Type.Property.Optional.PlainTime.getAll", + "type.property.optional.PlainTimeClient.getAllWithResponse": "Type.Property.Optional.PlainTime.getAll", + "type.property.optional.PlainTimeClient.getDefault": "Type.Property.Optional.PlainTime.getDefault", + "type.property.optional.PlainTimeClient.getDefaultWithResponse": "Type.Property.Optional.PlainTime.getDefault", + "type.property.optional.PlainTimeClient.putAll": "Type.Property.Optional.PlainTime.putAll", + "type.property.optional.PlainTimeClient.putAllWithResponse": "Type.Property.Optional.PlainTime.putAll", + "type.property.optional.PlainTimeClient.putDefault": "Type.Property.Optional.PlainTime.putDefault", + "type.property.optional.PlainTimeClient.putDefaultWithResponse": "Type.Property.Optional.PlainTime.putDefault", + "type.property.optional.RequiredAndOptionalAsyncClient": "Type.Property.Optional.RequiredAndOptional", + "type.property.optional.RequiredAndOptionalAsyncClient.getAll": "Type.Property.Optional.RequiredAndOptional.getAll", + "type.property.optional.RequiredAndOptionalAsyncClient.getAllWithResponse": "Type.Property.Optional.RequiredAndOptional.getAll", + "type.property.optional.RequiredAndOptionalAsyncClient.getRequiredOnly": "Type.Property.Optional.RequiredAndOptional.getRequiredOnly", + "type.property.optional.RequiredAndOptionalAsyncClient.getRequiredOnlyWithResponse": "Type.Property.Optional.RequiredAndOptional.getRequiredOnly", + "type.property.optional.RequiredAndOptionalAsyncClient.putAll": "Type.Property.Optional.RequiredAndOptional.putAll", + "type.property.optional.RequiredAndOptionalAsyncClient.putAllWithResponse": "Type.Property.Optional.RequiredAndOptional.putAll", + "type.property.optional.RequiredAndOptionalAsyncClient.putRequiredOnly": "Type.Property.Optional.RequiredAndOptional.putRequiredOnly", + "type.property.optional.RequiredAndOptionalAsyncClient.putRequiredOnlyWithResponse": "Type.Property.Optional.RequiredAndOptional.putRequiredOnly", + "type.property.optional.RequiredAndOptionalClient": "Type.Property.Optional.RequiredAndOptional", + "type.property.optional.RequiredAndOptionalClient.getAll": "Type.Property.Optional.RequiredAndOptional.getAll", + "type.property.optional.RequiredAndOptionalClient.getAllWithResponse": "Type.Property.Optional.RequiredAndOptional.getAll", + "type.property.optional.RequiredAndOptionalClient.getRequiredOnly": "Type.Property.Optional.RequiredAndOptional.getRequiredOnly", + "type.property.optional.RequiredAndOptionalClient.getRequiredOnlyWithResponse": "Type.Property.Optional.RequiredAndOptional.getRequiredOnly", + "type.property.optional.RequiredAndOptionalClient.putAll": "Type.Property.Optional.RequiredAndOptional.putAll", + "type.property.optional.RequiredAndOptionalClient.putAllWithResponse": "Type.Property.Optional.RequiredAndOptional.putAll", + "type.property.optional.RequiredAndOptionalClient.putRequiredOnly": "Type.Property.Optional.RequiredAndOptional.putRequiredOnly", + "type.property.optional.RequiredAndOptionalClient.putRequiredOnlyWithResponse": "Type.Property.Optional.RequiredAndOptional.putRequiredOnly", + "type.property.optional.StringLiteralAsyncClient": "Type.Property.Optional.StringLiteral", + "type.property.optional.StringLiteralAsyncClient.getAll": "Type.Property.Optional.StringLiteral.getAll", + "type.property.optional.StringLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.StringLiteral.getAll", + "type.property.optional.StringLiteralAsyncClient.getDefault": "Type.Property.Optional.StringLiteral.getDefault", + "type.property.optional.StringLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.StringLiteral.getDefault", + "type.property.optional.StringLiteralAsyncClient.putAll": "Type.Property.Optional.StringLiteral.putAll", + "type.property.optional.StringLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.StringLiteral.putAll", + "type.property.optional.StringLiteralAsyncClient.putDefault": "Type.Property.Optional.StringLiteral.putDefault", + "type.property.optional.StringLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.StringLiteral.putDefault", + "type.property.optional.StringLiteralClient": "Type.Property.Optional.StringLiteral", + "type.property.optional.StringLiteralClient.getAll": "Type.Property.Optional.StringLiteral.getAll", + "type.property.optional.StringLiteralClient.getAllWithResponse": "Type.Property.Optional.StringLiteral.getAll", + "type.property.optional.StringLiteralClient.getDefault": "Type.Property.Optional.StringLiteral.getDefault", + "type.property.optional.StringLiteralClient.getDefaultWithResponse": "Type.Property.Optional.StringLiteral.getDefault", + "type.property.optional.StringLiteralClient.putAll": "Type.Property.Optional.StringLiteral.putAll", + "type.property.optional.StringLiteralClient.putAllWithResponse": "Type.Property.Optional.StringLiteral.putAll", + "type.property.optional.StringLiteralClient.putDefault": "Type.Property.Optional.StringLiteral.putDefault", + "type.property.optional.StringLiteralClient.putDefaultWithResponse": "Type.Property.Optional.StringLiteral.putDefault", + "type.property.optional.StringOperationAsyncClient": "Type.Property.Optional.String", + "type.property.optional.StringOperationAsyncClient.getAll": "Type.Property.Optional.String.getAll", + "type.property.optional.StringOperationAsyncClient.getAllWithResponse": "Type.Property.Optional.String.getAll", + "type.property.optional.StringOperationAsyncClient.getDefault": "Type.Property.Optional.String.getDefault", + "type.property.optional.StringOperationAsyncClient.getDefaultWithResponse": "Type.Property.Optional.String.getDefault", + "type.property.optional.StringOperationAsyncClient.putAll": "Type.Property.Optional.String.putAll", + "type.property.optional.StringOperationAsyncClient.putAllWithResponse": "Type.Property.Optional.String.putAll", + "type.property.optional.StringOperationAsyncClient.putDefault": "Type.Property.Optional.String.putDefault", + "type.property.optional.StringOperationAsyncClient.putDefaultWithResponse": "Type.Property.Optional.String.putDefault", + "type.property.optional.StringOperationClient": "Type.Property.Optional.String", + "type.property.optional.StringOperationClient.getAll": "Type.Property.Optional.String.getAll", + "type.property.optional.StringOperationClient.getAllWithResponse": "Type.Property.Optional.String.getAll", + "type.property.optional.StringOperationClient.getDefault": "Type.Property.Optional.String.getDefault", + "type.property.optional.StringOperationClient.getDefaultWithResponse": "Type.Property.Optional.String.getDefault", + "type.property.optional.StringOperationClient.putAll": "Type.Property.Optional.String.putAll", + "type.property.optional.StringOperationClient.putAllWithResponse": "Type.Property.Optional.String.putAll", + "type.property.optional.StringOperationClient.putDefault": "Type.Property.Optional.String.putDefault", + "type.property.optional.StringOperationClient.putDefaultWithResponse": "Type.Property.Optional.String.putDefault", + "type.property.optional.UnionFloatLiteralAsyncClient": "Type.Property.Optional.UnionFloatLiteral", + "type.property.optional.UnionFloatLiteralAsyncClient.getAll": "Type.Property.Optional.UnionFloatLiteral.getAll", + "type.property.optional.UnionFloatLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.UnionFloatLiteral.getAll", + "type.property.optional.UnionFloatLiteralAsyncClient.getDefault": "Type.Property.Optional.UnionFloatLiteral.getDefault", + "type.property.optional.UnionFloatLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.UnionFloatLiteral.getDefault", + "type.property.optional.UnionFloatLiteralAsyncClient.putAll": "Type.Property.Optional.UnionFloatLiteral.putAll", + "type.property.optional.UnionFloatLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.UnionFloatLiteral.putAll", + "type.property.optional.UnionFloatLiteralAsyncClient.putDefault": "Type.Property.Optional.UnionFloatLiteral.putDefault", + "type.property.optional.UnionFloatLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.UnionFloatLiteral.putDefault", + "type.property.optional.UnionFloatLiteralClient": "Type.Property.Optional.UnionFloatLiteral", + "type.property.optional.UnionFloatLiteralClient.getAll": "Type.Property.Optional.UnionFloatLiteral.getAll", + "type.property.optional.UnionFloatLiteralClient.getAllWithResponse": "Type.Property.Optional.UnionFloatLiteral.getAll", + "type.property.optional.UnionFloatLiteralClient.getDefault": "Type.Property.Optional.UnionFloatLiteral.getDefault", + "type.property.optional.UnionFloatLiteralClient.getDefaultWithResponse": "Type.Property.Optional.UnionFloatLiteral.getDefault", + "type.property.optional.UnionFloatLiteralClient.putAll": "Type.Property.Optional.UnionFloatLiteral.putAll", + "type.property.optional.UnionFloatLiteralClient.putAllWithResponse": "Type.Property.Optional.UnionFloatLiteral.putAll", + "type.property.optional.UnionFloatLiteralClient.putDefault": "Type.Property.Optional.UnionFloatLiteral.putDefault", + "type.property.optional.UnionFloatLiteralClient.putDefaultWithResponse": "Type.Property.Optional.UnionFloatLiteral.putDefault", + "type.property.optional.UnionIntLiteralAsyncClient": "Type.Property.Optional.UnionIntLiteral", + "type.property.optional.UnionIntLiteralAsyncClient.getAll": "Type.Property.Optional.UnionIntLiteral.getAll", + "type.property.optional.UnionIntLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.UnionIntLiteral.getAll", + "type.property.optional.UnionIntLiteralAsyncClient.getDefault": "Type.Property.Optional.UnionIntLiteral.getDefault", + "type.property.optional.UnionIntLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.UnionIntLiteral.getDefault", + "type.property.optional.UnionIntLiteralAsyncClient.putAll": "Type.Property.Optional.UnionIntLiteral.putAll", + "type.property.optional.UnionIntLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.UnionIntLiteral.putAll", + "type.property.optional.UnionIntLiteralAsyncClient.putDefault": "Type.Property.Optional.UnionIntLiteral.putDefault", + "type.property.optional.UnionIntLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.UnionIntLiteral.putDefault", + "type.property.optional.UnionIntLiteralClient": "Type.Property.Optional.UnionIntLiteral", + "type.property.optional.UnionIntLiteralClient.getAll": "Type.Property.Optional.UnionIntLiteral.getAll", + "type.property.optional.UnionIntLiteralClient.getAllWithResponse": "Type.Property.Optional.UnionIntLiteral.getAll", + "type.property.optional.UnionIntLiteralClient.getDefault": "Type.Property.Optional.UnionIntLiteral.getDefault", + "type.property.optional.UnionIntLiteralClient.getDefaultWithResponse": "Type.Property.Optional.UnionIntLiteral.getDefault", + "type.property.optional.UnionIntLiteralClient.putAll": "Type.Property.Optional.UnionIntLiteral.putAll", + "type.property.optional.UnionIntLiteralClient.putAllWithResponse": "Type.Property.Optional.UnionIntLiteral.putAll", + "type.property.optional.UnionIntLiteralClient.putDefault": "Type.Property.Optional.UnionIntLiteral.putDefault", + "type.property.optional.UnionIntLiteralClient.putDefaultWithResponse": "Type.Property.Optional.UnionIntLiteral.putDefault", + "type.property.optional.UnionStringLiteralAsyncClient": "Type.Property.Optional.UnionStringLiteral", + "type.property.optional.UnionStringLiteralAsyncClient.getAll": "Type.Property.Optional.UnionStringLiteral.getAll", + "type.property.optional.UnionStringLiteralAsyncClient.getAllWithResponse": "Type.Property.Optional.UnionStringLiteral.getAll", + "type.property.optional.UnionStringLiteralAsyncClient.getDefault": "Type.Property.Optional.UnionStringLiteral.getDefault", + "type.property.optional.UnionStringLiteralAsyncClient.getDefaultWithResponse": "Type.Property.Optional.UnionStringLiteral.getDefault", + "type.property.optional.UnionStringLiteralAsyncClient.putAll": "Type.Property.Optional.UnionStringLiteral.putAll", + "type.property.optional.UnionStringLiteralAsyncClient.putAllWithResponse": "Type.Property.Optional.UnionStringLiteral.putAll", + "type.property.optional.UnionStringLiteralAsyncClient.putDefault": "Type.Property.Optional.UnionStringLiteral.putDefault", + "type.property.optional.UnionStringLiteralAsyncClient.putDefaultWithResponse": "Type.Property.Optional.UnionStringLiteral.putDefault", + "type.property.optional.UnionStringLiteralClient": "Type.Property.Optional.UnionStringLiteral", + "type.property.optional.UnionStringLiteralClient.getAll": "Type.Property.Optional.UnionStringLiteral.getAll", + "type.property.optional.UnionStringLiteralClient.getAllWithResponse": "Type.Property.Optional.UnionStringLiteral.getAll", + "type.property.optional.UnionStringLiteralClient.getDefault": "Type.Property.Optional.UnionStringLiteral.getDefault", + "type.property.optional.UnionStringLiteralClient.getDefaultWithResponse": "Type.Property.Optional.UnionStringLiteral.getDefault", + "type.property.optional.UnionStringLiteralClient.putAll": "Type.Property.Optional.UnionStringLiteral.putAll", + "type.property.optional.UnionStringLiteralClient.putAllWithResponse": "Type.Property.Optional.UnionStringLiteral.putAll", + "type.property.optional.UnionStringLiteralClient.putDefault": "Type.Property.Optional.UnionStringLiteral.putDefault", + "type.property.optional.UnionStringLiteralClient.putDefaultWithResponse": "Type.Property.Optional.UnionStringLiteral.putDefault", + "type.property.optional.models.BooleanLiteralProperty": "Type.Property.Optional.BooleanLiteralProperty", + "type.property.optional.models.BooleanLiteralPropertyProperty": null, + "type.property.optional.models.BytesProperty": "Type.Property.Optional.BytesProperty", + "type.property.optional.models.CollectionsByteProperty": "Type.Property.Optional.CollectionsByteProperty", + "type.property.optional.models.CollectionsModelProperty": "Type.Property.Optional.CollectionsModelProperty", + "type.property.optional.models.DatetimeProperty": "Type.Property.Optional.DatetimeProperty", + "type.property.optional.models.DurationProperty": "Type.Property.Optional.DurationProperty", + "type.property.optional.models.FloatLiteralProperty": "Type.Property.Optional.FloatLiteralProperty", + "type.property.optional.models.FloatLiteralPropertyProperty": null, + "type.property.optional.models.IntLiteralProperty": "Type.Property.Optional.IntLiteralProperty", + "type.property.optional.models.IntLiteralPropertyProperty": null, + "type.property.optional.models.PlainDateProperty": "Type.Property.Optional.PlainDateProperty", + "type.property.optional.models.PlainTimeProperty": "Type.Property.Optional.PlainTimeProperty", + "type.property.optional.models.RequiredAndOptionalProperty": "Type.Property.Optional.RequiredAndOptionalProperty", + "type.property.optional.models.StringLiteralProperty": "Type.Property.Optional.StringLiteralProperty", + "type.property.optional.models.StringLiteralPropertyProperty": null, + "type.property.optional.models.StringProperty": "Type.Property.Optional.StringProperty", + "type.property.optional.models.UnionFloatLiteralProperty": "Type.Property.Optional.UnionFloatLiteralProperty", + "type.property.optional.models.UnionFloatLiteralPropertyProperty": "Type.Property.Optional.UnionFloatLiteralProperty.property.anonymous", + "type.property.optional.models.UnionIntLiteralProperty": "Type.Property.Optional.UnionIntLiteralProperty", + "type.property.optional.models.UnionIntLiteralPropertyProperty": "Type.Property.Optional.UnionIntLiteralProperty.property.anonymous", + "type.property.optional.models.UnionStringLiteralProperty": "Type.Property.Optional.UnionStringLiteralProperty", + "type.property.optional.models.UnionStringLiteralPropertyProperty": "Type.Property.Optional.UnionStringLiteralProperty.property.anonymous" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_metadata.json new file mode 100644 index 00000000000..d42e370e0f1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-optional_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.property.optional.BooleanLiteralAsyncClient":"Type.Property.Optional.BooleanLiteral","type.property.optional.BooleanLiteralAsyncClient.getAll":"Type.Property.Optional.BooleanLiteral.getAll","type.property.optional.BooleanLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.BooleanLiteral.getAll","type.property.optional.BooleanLiteralAsyncClient.getDefault":"Type.Property.Optional.BooleanLiteral.getDefault","type.property.optional.BooleanLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.BooleanLiteral.getDefault","type.property.optional.BooleanLiteralAsyncClient.putAll":"Type.Property.Optional.BooleanLiteral.putAll","type.property.optional.BooleanLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.BooleanLiteral.putAll","type.property.optional.BooleanLiteralAsyncClient.putDefault":"Type.Property.Optional.BooleanLiteral.putDefault","type.property.optional.BooleanLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.BooleanLiteral.putDefault","type.property.optional.BooleanLiteralClient":"Type.Property.Optional.BooleanLiteral","type.property.optional.BooleanLiteralClient.getAll":"Type.Property.Optional.BooleanLiteral.getAll","type.property.optional.BooleanLiteralClient.getAllWithResponse":"Type.Property.Optional.BooleanLiteral.getAll","type.property.optional.BooleanLiteralClient.getDefault":"Type.Property.Optional.BooleanLiteral.getDefault","type.property.optional.BooleanLiteralClient.getDefaultWithResponse":"Type.Property.Optional.BooleanLiteral.getDefault","type.property.optional.BooleanLiteralClient.putAll":"Type.Property.Optional.BooleanLiteral.putAll","type.property.optional.BooleanLiteralClient.putAllWithResponse":"Type.Property.Optional.BooleanLiteral.putAll","type.property.optional.BooleanLiteralClient.putDefault":"Type.Property.Optional.BooleanLiteral.putDefault","type.property.optional.BooleanLiteralClient.putDefaultWithResponse":"Type.Property.Optional.BooleanLiteral.putDefault","type.property.optional.BytesAsyncClient":"Type.Property.Optional.Bytes","type.property.optional.BytesAsyncClient.getAll":"Type.Property.Optional.Bytes.getAll","type.property.optional.BytesAsyncClient.getAllWithResponse":"Type.Property.Optional.Bytes.getAll","type.property.optional.BytesAsyncClient.getDefault":"Type.Property.Optional.Bytes.getDefault","type.property.optional.BytesAsyncClient.getDefaultWithResponse":"Type.Property.Optional.Bytes.getDefault","type.property.optional.BytesAsyncClient.putAll":"Type.Property.Optional.Bytes.putAll","type.property.optional.BytesAsyncClient.putAllWithResponse":"Type.Property.Optional.Bytes.putAll","type.property.optional.BytesAsyncClient.putDefault":"Type.Property.Optional.Bytes.putDefault","type.property.optional.BytesAsyncClient.putDefaultWithResponse":"Type.Property.Optional.Bytes.putDefault","type.property.optional.BytesClient":"Type.Property.Optional.Bytes","type.property.optional.BytesClient.getAll":"Type.Property.Optional.Bytes.getAll","type.property.optional.BytesClient.getAllWithResponse":"Type.Property.Optional.Bytes.getAll","type.property.optional.BytesClient.getDefault":"Type.Property.Optional.Bytes.getDefault","type.property.optional.BytesClient.getDefaultWithResponse":"Type.Property.Optional.Bytes.getDefault","type.property.optional.BytesClient.putAll":"Type.Property.Optional.Bytes.putAll","type.property.optional.BytesClient.putAllWithResponse":"Type.Property.Optional.Bytes.putAll","type.property.optional.BytesClient.putDefault":"Type.Property.Optional.Bytes.putDefault","type.property.optional.BytesClient.putDefaultWithResponse":"Type.Property.Optional.Bytes.putDefault","type.property.optional.CollectionsByteAsyncClient":"Type.Property.Optional.CollectionsByte","type.property.optional.CollectionsByteAsyncClient.getAll":"Type.Property.Optional.CollectionsByte.getAll","type.property.optional.CollectionsByteAsyncClient.getAllWithResponse":"Type.Property.Optional.CollectionsByte.getAll","type.property.optional.CollectionsByteAsyncClient.getDefault":"Type.Property.Optional.CollectionsByte.getDefault","type.property.optional.CollectionsByteAsyncClient.getDefaultWithResponse":"Type.Property.Optional.CollectionsByte.getDefault","type.property.optional.CollectionsByteAsyncClient.putAll":"Type.Property.Optional.CollectionsByte.putAll","type.property.optional.CollectionsByteAsyncClient.putAllWithResponse":"Type.Property.Optional.CollectionsByte.putAll","type.property.optional.CollectionsByteAsyncClient.putDefault":"Type.Property.Optional.CollectionsByte.putDefault","type.property.optional.CollectionsByteAsyncClient.putDefaultWithResponse":"Type.Property.Optional.CollectionsByte.putDefault","type.property.optional.CollectionsByteClient":"Type.Property.Optional.CollectionsByte","type.property.optional.CollectionsByteClient.getAll":"Type.Property.Optional.CollectionsByte.getAll","type.property.optional.CollectionsByteClient.getAllWithResponse":"Type.Property.Optional.CollectionsByte.getAll","type.property.optional.CollectionsByteClient.getDefault":"Type.Property.Optional.CollectionsByte.getDefault","type.property.optional.CollectionsByteClient.getDefaultWithResponse":"Type.Property.Optional.CollectionsByte.getDefault","type.property.optional.CollectionsByteClient.putAll":"Type.Property.Optional.CollectionsByte.putAll","type.property.optional.CollectionsByteClient.putAllWithResponse":"Type.Property.Optional.CollectionsByte.putAll","type.property.optional.CollectionsByteClient.putDefault":"Type.Property.Optional.CollectionsByte.putDefault","type.property.optional.CollectionsByteClient.putDefaultWithResponse":"Type.Property.Optional.CollectionsByte.putDefault","type.property.optional.CollectionsModelAsyncClient":"Type.Property.Optional.CollectionsModel","type.property.optional.CollectionsModelAsyncClient.getAll":"Type.Property.Optional.CollectionsModel.getAll","type.property.optional.CollectionsModelAsyncClient.getAllWithResponse":"Type.Property.Optional.CollectionsModel.getAll","type.property.optional.CollectionsModelAsyncClient.getDefault":"Type.Property.Optional.CollectionsModel.getDefault","type.property.optional.CollectionsModelAsyncClient.getDefaultWithResponse":"Type.Property.Optional.CollectionsModel.getDefault","type.property.optional.CollectionsModelAsyncClient.putAll":"Type.Property.Optional.CollectionsModel.putAll","type.property.optional.CollectionsModelAsyncClient.putAllWithResponse":"Type.Property.Optional.CollectionsModel.putAll","type.property.optional.CollectionsModelAsyncClient.putDefault":"Type.Property.Optional.CollectionsModel.putDefault","type.property.optional.CollectionsModelAsyncClient.putDefaultWithResponse":"Type.Property.Optional.CollectionsModel.putDefault","type.property.optional.CollectionsModelClient":"Type.Property.Optional.CollectionsModel","type.property.optional.CollectionsModelClient.getAll":"Type.Property.Optional.CollectionsModel.getAll","type.property.optional.CollectionsModelClient.getAllWithResponse":"Type.Property.Optional.CollectionsModel.getAll","type.property.optional.CollectionsModelClient.getDefault":"Type.Property.Optional.CollectionsModel.getDefault","type.property.optional.CollectionsModelClient.getDefaultWithResponse":"Type.Property.Optional.CollectionsModel.getDefault","type.property.optional.CollectionsModelClient.putAll":"Type.Property.Optional.CollectionsModel.putAll","type.property.optional.CollectionsModelClient.putAllWithResponse":"Type.Property.Optional.CollectionsModel.putAll","type.property.optional.CollectionsModelClient.putDefault":"Type.Property.Optional.CollectionsModel.putDefault","type.property.optional.CollectionsModelClient.putDefaultWithResponse":"Type.Property.Optional.CollectionsModel.putDefault","type.property.optional.DatetimeOperationAsyncClient":"Type.Property.Optional.Datetime","type.property.optional.DatetimeOperationAsyncClient.getAll":"Type.Property.Optional.Datetime.getAll","type.property.optional.DatetimeOperationAsyncClient.getAllWithResponse":"Type.Property.Optional.Datetime.getAll","type.property.optional.DatetimeOperationAsyncClient.getDefault":"Type.Property.Optional.Datetime.getDefault","type.property.optional.DatetimeOperationAsyncClient.getDefaultWithResponse":"Type.Property.Optional.Datetime.getDefault","type.property.optional.DatetimeOperationAsyncClient.putAll":"Type.Property.Optional.Datetime.putAll","type.property.optional.DatetimeOperationAsyncClient.putAllWithResponse":"Type.Property.Optional.Datetime.putAll","type.property.optional.DatetimeOperationAsyncClient.putDefault":"Type.Property.Optional.Datetime.putDefault","type.property.optional.DatetimeOperationAsyncClient.putDefaultWithResponse":"Type.Property.Optional.Datetime.putDefault","type.property.optional.DatetimeOperationClient":"Type.Property.Optional.Datetime","type.property.optional.DatetimeOperationClient.getAll":"Type.Property.Optional.Datetime.getAll","type.property.optional.DatetimeOperationClient.getAllWithResponse":"Type.Property.Optional.Datetime.getAll","type.property.optional.DatetimeOperationClient.getDefault":"Type.Property.Optional.Datetime.getDefault","type.property.optional.DatetimeOperationClient.getDefaultWithResponse":"Type.Property.Optional.Datetime.getDefault","type.property.optional.DatetimeOperationClient.putAll":"Type.Property.Optional.Datetime.putAll","type.property.optional.DatetimeOperationClient.putAllWithResponse":"Type.Property.Optional.Datetime.putAll","type.property.optional.DatetimeOperationClient.putDefault":"Type.Property.Optional.Datetime.putDefault","type.property.optional.DatetimeOperationClient.putDefaultWithResponse":"Type.Property.Optional.Datetime.putDefault","type.property.optional.DurationOperationAsyncClient":"Type.Property.Optional.Duration","type.property.optional.DurationOperationAsyncClient.getAll":"Type.Property.Optional.Duration.getAll","type.property.optional.DurationOperationAsyncClient.getAllWithResponse":"Type.Property.Optional.Duration.getAll","type.property.optional.DurationOperationAsyncClient.getDefault":"Type.Property.Optional.Duration.getDefault","type.property.optional.DurationOperationAsyncClient.getDefaultWithResponse":"Type.Property.Optional.Duration.getDefault","type.property.optional.DurationOperationAsyncClient.putAll":"Type.Property.Optional.Duration.putAll","type.property.optional.DurationOperationAsyncClient.putAllWithResponse":"Type.Property.Optional.Duration.putAll","type.property.optional.DurationOperationAsyncClient.putDefault":"Type.Property.Optional.Duration.putDefault","type.property.optional.DurationOperationAsyncClient.putDefaultWithResponse":"Type.Property.Optional.Duration.putDefault","type.property.optional.DurationOperationClient":"Type.Property.Optional.Duration","type.property.optional.DurationOperationClient.getAll":"Type.Property.Optional.Duration.getAll","type.property.optional.DurationOperationClient.getAllWithResponse":"Type.Property.Optional.Duration.getAll","type.property.optional.DurationOperationClient.getDefault":"Type.Property.Optional.Duration.getDefault","type.property.optional.DurationOperationClient.getDefaultWithResponse":"Type.Property.Optional.Duration.getDefault","type.property.optional.DurationOperationClient.putAll":"Type.Property.Optional.Duration.putAll","type.property.optional.DurationOperationClient.putAllWithResponse":"Type.Property.Optional.Duration.putAll","type.property.optional.DurationOperationClient.putDefault":"Type.Property.Optional.Duration.putDefault","type.property.optional.DurationOperationClient.putDefaultWithResponse":"Type.Property.Optional.Duration.putDefault","type.property.optional.FloatLiteralAsyncClient":"Type.Property.Optional.FloatLiteral","type.property.optional.FloatLiteralAsyncClient.getAll":"Type.Property.Optional.FloatLiteral.getAll","type.property.optional.FloatLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.FloatLiteral.getAll","type.property.optional.FloatLiteralAsyncClient.getDefault":"Type.Property.Optional.FloatLiteral.getDefault","type.property.optional.FloatLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.FloatLiteral.getDefault","type.property.optional.FloatLiteralAsyncClient.putAll":"Type.Property.Optional.FloatLiteral.putAll","type.property.optional.FloatLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.FloatLiteral.putAll","type.property.optional.FloatLiteralAsyncClient.putDefault":"Type.Property.Optional.FloatLiteral.putDefault","type.property.optional.FloatLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.FloatLiteral.putDefault","type.property.optional.FloatLiteralClient":"Type.Property.Optional.FloatLiteral","type.property.optional.FloatLiteralClient.getAll":"Type.Property.Optional.FloatLiteral.getAll","type.property.optional.FloatLiteralClient.getAllWithResponse":"Type.Property.Optional.FloatLiteral.getAll","type.property.optional.FloatLiteralClient.getDefault":"Type.Property.Optional.FloatLiteral.getDefault","type.property.optional.FloatLiteralClient.getDefaultWithResponse":"Type.Property.Optional.FloatLiteral.getDefault","type.property.optional.FloatLiteralClient.putAll":"Type.Property.Optional.FloatLiteral.putAll","type.property.optional.FloatLiteralClient.putAllWithResponse":"Type.Property.Optional.FloatLiteral.putAll","type.property.optional.FloatLiteralClient.putDefault":"Type.Property.Optional.FloatLiteral.putDefault","type.property.optional.FloatLiteralClient.putDefaultWithResponse":"Type.Property.Optional.FloatLiteral.putDefault","type.property.optional.IntLiteralAsyncClient":"Type.Property.Optional.IntLiteral","type.property.optional.IntLiteralAsyncClient.getAll":"Type.Property.Optional.IntLiteral.getAll","type.property.optional.IntLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.IntLiteral.getAll","type.property.optional.IntLiteralAsyncClient.getDefault":"Type.Property.Optional.IntLiteral.getDefault","type.property.optional.IntLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.IntLiteral.getDefault","type.property.optional.IntLiteralAsyncClient.putAll":"Type.Property.Optional.IntLiteral.putAll","type.property.optional.IntLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.IntLiteral.putAll","type.property.optional.IntLiteralAsyncClient.putDefault":"Type.Property.Optional.IntLiteral.putDefault","type.property.optional.IntLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.IntLiteral.putDefault","type.property.optional.IntLiteralClient":"Type.Property.Optional.IntLiteral","type.property.optional.IntLiteralClient.getAll":"Type.Property.Optional.IntLiteral.getAll","type.property.optional.IntLiteralClient.getAllWithResponse":"Type.Property.Optional.IntLiteral.getAll","type.property.optional.IntLiteralClient.getDefault":"Type.Property.Optional.IntLiteral.getDefault","type.property.optional.IntLiteralClient.getDefaultWithResponse":"Type.Property.Optional.IntLiteral.getDefault","type.property.optional.IntLiteralClient.putAll":"Type.Property.Optional.IntLiteral.putAll","type.property.optional.IntLiteralClient.putAllWithResponse":"Type.Property.Optional.IntLiteral.putAll","type.property.optional.IntLiteralClient.putDefault":"Type.Property.Optional.IntLiteral.putDefault","type.property.optional.IntLiteralClient.putDefaultWithResponse":"Type.Property.Optional.IntLiteral.putDefault","type.property.optional.OptionalClientBuilder":"Type.Property.Optional","type.property.optional.PlainDateAsyncClient":"Type.Property.Optional.PlainDate","type.property.optional.PlainDateAsyncClient.getAll":"Type.Property.Optional.PlainDate.getAll","type.property.optional.PlainDateAsyncClient.getAllWithResponse":"Type.Property.Optional.PlainDate.getAll","type.property.optional.PlainDateAsyncClient.getDefault":"Type.Property.Optional.PlainDate.getDefault","type.property.optional.PlainDateAsyncClient.getDefaultWithResponse":"Type.Property.Optional.PlainDate.getDefault","type.property.optional.PlainDateAsyncClient.putAll":"Type.Property.Optional.PlainDate.putAll","type.property.optional.PlainDateAsyncClient.putAllWithResponse":"Type.Property.Optional.PlainDate.putAll","type.property.optional.PlainDateAsyncClient.putDefault":"Type.Property.Optional.PlainDate.putDefault","type.property.optional.PlainDateAsyncClient.putDefaultWithResponse":"Type.Property.Optional.PlainDate.putDefault","type.property.optional.PlainDateClient":"Type.Property.Optional.PlainDate","type.property.optional.PlainDateClient.getAll":"Type.Property.Optional.PlainDate.getAll","type.property.optional.PlainDateClient.getAllWithResponse":"Type.Property.Optional.PlainDate.getAll","type.property.optional.PlainDateClient.getDefault":"Type.Property.Optional.PlainDate.getDefault","type.property.optional.PlainDateClient.getDefaultWithResponse":"Type.Property.Optional.PlainDate.getDefault","type.property.optional.PlainDateClient.putAll":"Type.Property.Optional.PlainDate.putAll","type.property.optional.PlainDateClient.putAllWithResponse":"Type.Property.Optional.PlainDate.putAll","type.property.optional.PlainDateClient.putDefault":"Type.Property.Optional.PlainDate.putDefault","type.property.optional.PlainDateClient.putDefaultWithResponse":"Type.Property.Optional.PlainDate.putDefault","type.property.optional.PlainTimeAsyncClient":"Type.Property.Optional.PlainTime","type.property.optional.PlainTimeAsyncClient.getAll":"Type.Property.Optional.PlainTime.getAll","type.property.optional.PlainTimeAsyncClient.getAllWithResponse":"Type.Property.Optional.PlainTime.getAll","type.property.optional.PlainTimeAsyncClient.getDefault":"Type.Property.Optional.PlainTime.getDefault","type.property.optional.PlainTimeAsyncClient.getDefaultWithResponse":"Type.Property.Optional.PlainTime.getDefault","type.property.optional.PlainTimeAsyncClient.putAll":"Type.Property.Optional.PlainTime.putAll","type.property.optional.PlainTimeAsyncClient.putAllWithResponse":"Type.Property.Optional.PlainTime.putAll","type.property.optional.PlainTimeAsyncClient.putDefault":"Type.Property.Optional.PlainTime.putDefault","type.property.optional.PlainTimeAsyncClient.putDefaultWithResponse":"Type.Property.Optional.PlainTime.putDefault","type.property.optional.PlainTimeClient":"Type.Property.Optional.PlainTime","type.property.optional.PlainTimeClient.getAll":"Type.Property.Optional.PlainTime.getAll","type.property.optional.PlainTimeClient.getAllWithResponse":"Type.Property.Optional.PlainTime.getAll","type.property.optional.PlainTimeClient.getDefault":"Type.Property.Optional.PlainTime.getDefault","type.property.optional.PlainTimeClient.getDefaultWithResponse":"Type.Property.Optional.PlainTime.getDefault","type.property.optional.PlainTimeClient.putAll":"Type.Property.Optional.PlainTime.putAll","type.property.optional.PlainTimeClient.putAllWithResponse":"Type.Property.Optional.PlainTime.putAll","type.property.optional.PlainTimeClient.putDefault":"Type.Property.Optional.PlainTime.putDefault","type.property.optional.PlainTimeClient.putDefaultWithResponse":"Type.Property.Optional.PlainTime.putDefault","type.property.optional.RequiredAndOptionalAsyncClient":"Type.Property.Optional.RequiredAndOptional","type.property.optional.RequiredAndOptionalAsyncClient.getAll":"Type.Property.Optional.RequiredAndOptional.getAll","type.property.optional.RequiredAndOptionalAsyncClient.getAllWithResponse":"Type.Property.Optional.RequiredAndOptional.getAll","type.property.optional.RequiredAndOptionalAsyncClient.getRequiredOnly":"Type.Property.Optional.RequiredAndOptional.getRequiredOnly","type.property.optional.RequiredAndOptionalAsyncClient.getRequiredOnlyWithResponse":"Type.Property.Optional.RequiredAndOptional.getRequiredOnly","type.property.optional.RequiredAndOptionalAsyncClient.putAll":"Type.Property.Optional.RequiredAndOptional.putAll","type.property.optional.RequiredAndOptionalAsyncClient.putAllWithResponse":"Type.Property.Optional.RequiredAndOptional.putAll","type.property.optional.RequiredAndOptionalAsyncClient.putRequiredOnly":"Type.Property.Optional.RequiredAndOptional.putRequiredOnly","type.property.optional.RequiredAndOptionalAsyncClient.putRequiredOnlyWithResponse":"Type.Property.Optional.RequiredAndOptional.putRequiredOnly","type.property.optional.RequiredAndOptionalClient":"Type.Property.Optional.RequiredAndOptional","type.property.optional.RequiredAndOptionalClient.getAll":"Type.Property.Optional.RequiredAndOptional.getAll","type.property.optional.RequiredAndOptionalClient.getAllWithResponse":"Type.Property.Optional.RequiredAndOptional.getAll","type.property.optional.RequiredAndOptionalClient.getRequiredOnly":"Type.Property.Optional.RequiredAndOptional.getRequiredOnly","type.property.optional.RequiredAndOptionalClient.getRequiredOnlyWithResponse":"Type.Property.Optional.RequiredAndOptional.getRequiredOnly","type.property.optional.RequiredAndOptionalClient.putAll":"Type.Property.Optional.RequiredAndOptional.putAll","type.property.optional.RequiredAndOptionalClient.putAllWithResponse":"Type.Property.Optional.RequiredAndOptional.putAll","type.property.optional.RequiredAndOptionalClient.putRequiredOnly":"Type.Property.Optional.RequiredAndOptional.putRequiredOnly","type.property.optional.RequiredAndOptionalClient.putRequiredOnlyWithResponse":"Type.Property.Optional.RequiredAndOptional.putRequiredOnly","type.property.optional.StringLiteralAsyncClient":"Type.Property.Optional.StringLiteral","type.property.optional.StringLiteralAsyncClient.getAll":"Type.Property.Optional.StringLiteral.getAll","type.property.optional.StringLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.StringLiteral.getAll","type.property.optional.StringLiteralAsyncClient.getDefault":"Type.Property.Optional.StringLiteral.getDefault","type.property.optional.StringLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.StringLiteral.getDefault","type.property.optional.StringLiteralAsyncClient.putAll":"Type.Property.Optional.StringLiteral.putAll","type.property.optional.StringLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.StringLiteral.putAll","type.property.optional.StringLiteralAsyncClient.putDefault":"Type.Property.Optional.StringLiteral.putDefault","type.property.optional.StringLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.StringLiteral.putDefault","type.property.optional.StringLiteralClient":"Type.Property.Optional.StringLiteral","type.property.optional.StringLiteralClient.getAll":"Type.Property.Optional.StringLiteral.getAll","type.property.optional.StringLiteralClient.getAllWithResponse":"Type.Property.Optional.StringLiteral.getAll","type.property.optional.StringLiteralClient.getDefault":"Type.Property.Optional.StringLiteral.getDefault","type.property.optional.StringLiteralClient.getDefaultWithResponse":"Type.Property.Optional.StringLiteral.getDefault","type.property.optional.StringLiteralClient.putAll":"Type.Property.Optional.StringLiteral.putAll","type.property.optional.StringLiteralClient.putAllWithResponse":"Type.Property.Optional.StringLiteral.putAll","type.property.optional.StringLiteralClient.putDefault":"Type.Property.Optional.StringLiteral.putDefault","type.property.optional.StringLiteralClient.putDefaultWithResponse":"Type.Property.Optional.StringLiteral.putDefault","type.property.optional.StringOperationAsyncClient":"Type.Property.Optional.String","type.property.optional.StringOperationAsyncClient.getAll":"Type.Property.Optional.String.getAll","type.property.optional.StringOperationAsyncClient.getAllWithResponse":"Type.Property.Optional.String.getAll","type.property.optional.StringOperationAsyncClient.getDefault":"Type.Property.Optional.String.getDefault","type.property.optional.StringOperationAsyncClient.getDefaultWithResponse":"Type.Property.Optional.String.getDefault","type.property.optional.StringOperationAsyncClient.putAll":"Type.Property.Optional.String.putAll","type.property.optional.StringOperationAsyncClient.putAllWithResponse":"Type.Property.Optional.String.putAll","type.property.optional.StringOperationAsyncClient.putDefault":"Type.Property.Optional.String.putDefault","type.property.optional.StringOperationAsyncClient.putDefaultWithResponse":"Type.Property.Optional.String.putDefault","type.property.optional.StringOperationClient":"Type.Property.Optional.String","type.property.optional.StringOperationClient.getAll":"Type.Property.Optional.String.getAll","type.property.optional.StringOperationClient.getAllWithResponse":"Type.Property.Optional.String.getAll","type.property.optional.StringOperationClient.getDefault":"Type.Property.Optional.String.getDefault","type.property.optional.StringOperationClient.getDefaultWithResponse":"Type.Property.Optional.String.getDefault","type.property.optional.StringOperationClient.putAll":"Type.Property.Optional.String.putAll","type.property.optional.StringOperationClient.putAllWithResponse":"Type.Property.Optional.String.putAll","type.property.optional.StringOperationClient.putDefault":"Type.Property.Optional.String.putDefault","type.property.optional.StringOperationClient.putDefaultWithResponse":"Type.Property.Optional.String.putDefault","type.property.optional.UnionFloatLiteralAsyncClient":"Type.Property.Optional.UnionFloatLiteral","type.property.optional.UnionFloatLiteralAsyncClient.getAll":"Type.Property.Optional.UnionFloatLiteral.getAll","type.property.optional.UnionFloatLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.UnionFloatLiteral.getAll","type.property.optional.UnionFloatLiteralAsyncClient.getDefault":"Type.Property.Optional.UnionFloatLiteral.getDefault","type.property.optional.UnionFloatLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.UnionFloatLiteral.getDefault","type.property.optional.UnionFloatLiteralAsyncClient.putAll":"Type.Property.Optional.UnionFloatLiteral.putAll","type.property.optional.UnionFloatLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.UnionFloatLiteral.putAll","type.property.optional.UnionFloatLiteralAsyncClient.putDefault":"Type.Property.Optional.UnionFloatLiteral.putDefault","type.property.optional.UnionFloatLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.UnionFloatLiteral.putDefault","type.property.optional.UnionFloatLiteralClient":"Type.Property.Optional.UnionFloatLiteral","type.property.optional.UnionFloatLiteralClient.getAll":"Type.Property.Optional.UnionFloatLiteral.getAll","type.property.optional.UnionFloatLiteralClient.getAllWithResponse":"Type.Property.Optional.UnionFloatLiteral.getAll","type.property.optional.UnionFloatLiteralClient.getDefault":"Type.Property.Optional.UnionFloatLiteral.getDefault","type.property.optional.UnionFloatLiteralClient.getDefaultWithResponse":"Type.Property.Optional.UnionFloatLiteral.getDefault","type.property.optional.UnionFloatLiteralClient.putAll":"Type.Property.Optional.UnionFloatLiteral.putAll","type.property.optional.UnionFloatLiteralClient.putAllWithResponse":"Type.Property.Optional.UnionFloatLiteral.putAll","type.property.optional.UnionFloatLiteralClient.putDefault":"Type.Property.Optional.UnionFloatLiteral.putDefault","type.property.optional.UnionFloatLiteralClient.putDefaultWithResponse":"Type.Property.Optional.UnionFloatLiteral.putDefault","type.property.optional.UnionIntLiteralAsyncClient":"Type.Property.Optional.UnionIntLiteral","type.property.optional.UnionIntLiteralAsyncClient.getAll":"Type.Property.Optional.UnionIntLiteral.getAll","type.property.optional.UnionIntLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.UnionIntLiteral.getAll","type.property.optional.UnionIntLiteralAsyncClient.getDefault":"Type.Property.Optional.UnionIntLiteral.getDefault","type.property.optional.UnionIntLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.UnionIntLiteral.getDefault","type.property.optional.UnionIntLiteralAsyncClient.putAll":"Type.Property.Optional.UnionIntLiteral.putAll","type.property.optional.UnionIntLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.UnionIntLiteral.putAll","type.property.optional.UnionIntLiteralAsyncClient.putDefault":"Type.Property.Optional.UnionIntLiteral.putDefault","type.property.optional.UnionIntLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.UnionIntLiteral.putDefault","type.property.optional.UnionIntLiteralClient":"Type.Property.Optional.UnionIntLiteral","type.property.optional.UnionIntLiteralClient.getAll":"Type.Property.Optional.UnionIntLiteral.getAll","type.property.optional.UnionIntLiteralClient.getAllWithResponse":"Type.Property.Optional.UnionIntLiteral.getAll","type.property.optional.UnionIntLiteralClient.getDefault":"Type.Property.Optional.UnionIntLiteral.getDefault","type.property.optional.UnionIntLiteralClient.getDefaultWithResponse":"Type.Property.Optional.UnionIntLiteral.getDefault","type.property.optional.UnionIntLiteralClient.putAll":"Type.Property.Optional.UnionIntLiteral.putAll","type.property.optional.UnionIntLiteralClient.putAllWithResponse":"Type.Property.Optional.UnionIntLiteral.putAll","type.property.optional.UnionIntLiteralClient.putDefault":"Type.Property.Optional.UnionIntLiteral.putDefault","type.property.optional.UnionIntLiteralClient.putDefaultWithResponse":"Type.Property.Optional.UnionIntLiteral.putDefault","type.property.optional.UnionStringLiteralAsyncClient":"Type.Property.Optional.UnionStringLiteral","type.property.optional.UnionStringLiteralAsyncClient.getAll":"Type.Property.Optional.UnionStringLiteral.getAll","type.property.optional.UnionStringLiteralAsyncClient.getAllWithResponse":"Type.Property.Optional.UnionStringLiteral.getAll","type.property.optional.UnionStringLiteralAsyncClient.getDefault":"Type.Property.Optional.UnionStringLiteral.getDefault","type.property.optional.UnionStringLiteralAsyncClient.getDefaultWithResponse":"Type.Property.Optional.UnionStringLiteral.getDefault","type.property.optional.UnionStringLiteralAsyncClient.putAll":"Type.Property.Optional.UnionStringLiteral.putAll","type.property.optional.UnionStringLiteralAsyncClient.putAllWithResponse":"Type.Property.Optional.UnionStringLiteral.putAll","type.property.optional.UnionStringLiteralAsyncClient.putDefault":"Type.Property.Optional.UnionStringLiteral.putDefault","type.property.optional.UnionStringLiteralAsyncClient.putDefaultWithResponse":"Type.Property.Optional.UnionStringLiteral.putDefault","type.property.optional.UnionStringLiteralClient":"Type.Property.Optional.UnionStringLiteral","type.property.optional.UnionStringLiteralClient.getAll":"Type.Property.Optional.UnionStringLiteral.getAll","type.property.optional.UnionStringLiteralClient.getAllWithResponse":"Type.Property.Optional.UnionStringLiteral.getAll","type.property.optional.UnionStringLiteralClient.getDefault":"Type.Property.Optional.UnionStringLiteral.getDefault","type.property.optional.UnionStringLiteralClient.getDefaultWithResponse":"Type.Property.Optional.UnionStringLiteral.getDefault","type.property.optional.UnionStringLiteralClient.putAll":"Type.Property.Optional.UnionStringLiteral.putAll","type.property.optional.UnionStringLiteralClient.putAllWithResponse":"Type.Property.Optional.UnionStringLiteral.putAll","type.property.optional.UnionStringLiteralClient.putDefault":"Type.Property.Optional.UnionStringLiteral.putDefault","type.property.optional.UnionStringLiteralClient.putDefaultWithResponse":"Type.Property.Optional.UnionStringLiteral.putDefault","type.property.optional.models.BooleanLiteralProperty":"Type.Property.Optional.BooleanLiteralProperty","type.property.optional.models.BooleanLiteralPropertyProperty":null,"type.property.optional.models.BytesProperty":"Type.Property.Optional.BytesProperty","type.property.optional.models.CollectionsByteProperty":"Type.Property.Optional.CollectionsByteProperty","type.property.optional.models.CollectionsModelProperty":"Type.Property.Optional.CollectionsModelProperty","type.property.optional.models.DatetimeProperty":"Type.Property.Optional.DatetimeProperty","type.property.optional.models.DurationProperty":"Type.Property.Optional.DurationProperty","type.property.optional.models.FloatLiteralProperty":"Type.Property.Optional.FloatLiteralProperty","type.property.optional.models.FloatLiteralPropertyProperty":null,"type.property.optional.models.IntLiteralProperty":"Type.Property.Optional.IntLiteralProperty","type.property.optional.models.IntLiteralPropertyProperty":null,"type.property.optional.models.PlainDateProperty":"Type.Property.Optional.PlainDateProperty","type.property.optional.models.PlainTimeProperty":"Type.Property.Optional.PlainTimeProperty","type.property.optional.models.RequiredAndOptionalProperty":"Type.Property.Optional.RequiredAndOptionalProperty","type.property.optional.models.StringLiteralProperty":"Type.Property.Optional.StringLiteralProperty","type.property.optional.models.StringLiteralPropertyProperty":null,"type.property.optional.models.StringProperty":"Type.Property.Optional.StringProperty","type.property.optional.models.UnionFloatLiteralProperty":"Type.Property.Optional.UnionFloatLiteralProperty","type.property.optional.models.UnionFloatLiteralPropertyProperty":"Type.Property.Optional.UnionFloatLiteralProperty.property.anonymous","type.property.optional.models.UnionIntLiteralProperty":"Type.Property.Optional.UnionIntLiteralProperty","type.property.optional.models.UnionIntLiteralPropertyProperty":"Type.Property.Optional.UnionIntLiteralProperty.property.anonymous","type.property.optional.models.UnionStringLiteralProperty":"Type.Property.Optional.UnionStringLiteralProperty","type.property.optional.models.UnionStringLiteralPropertyProperty":"Type.Property.Optional.UnionStringLiteralProperty.property.anonymous"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/property/optional/BooleanLiteralAsyncClient.java","src/main/java/type/property/optional/BooleanLiteralClient.java","src/main/java/type/property/optional/BytesAsyncClient.java","src/main/java/type/property/optional/BytesClient.java","src/main/java/type/property/optional/CollectionsByteAsyncClient.java","src/main/java/type/property/optional/CollectionsByteClient.java","src/main/java/type/property/optional/CollectionsModelAsyncClient.java","src/main/java/type/property/optional/CollectionsModelClient.java","src/main/java/type/property/optional/DatetimeOperationAsyncClient.java","src/main/java/type/property/optional/DatetimeOperationClient.java","src/main/java/type/property/optional/DurationOperationAsyncClient.java","src/main/java/type/property/optional/DurationOperationClient.java","src/main/java/type/property/optional/FloatLiteralAsyncClient.java","src/main/java/type/property/optional/FloatLiteralClient.java","src/main/java/type/property/optional/IntLiteralAsyncClient.java","src/main/java/type/property/optional/IntLiteralClient.java","src/main/java/type/property/optional/OptionalClientBuilder.java","src/main/java/type/property/optional/PlainDateAsyncClient.java","src/main/java/type/property/optional/PlainDateClient.java","src/main/java/type/property/optional/PlainTimeAsyncClient.java","src/main/java/type/property/optional/PlainTimeClient.java","src/main/java/type/property/optional/RequiredAndOptionalAsyncClient.java","src/main/java/type/property/optional/RequiredAndOptionalClient.java","src/main/java/type/property/optional/StringLiteralAsyncClient.java","src/main/java/type/property/optional/StringLiteralClient.java","src/main/java/type/property/optional/StringOperationAsyncClient.java","src/main/java/type/property/optional/StringOperationClient.java","src/main/java/type/property/optional/UnionFloatLiteralAsyncClient.java","src/main/java/type/property/optional/UnionFloatLiteralClient.java","src/main/java/type/property/optional/UnionIntLiteralAsyncClient.java","src/main/java/type/property/optional/UnionIntLiteralClient.java","src/main/java/type/property/optional/UnionStringLiteralAsyncClient.java","src/main/java/type/property/optional/UnionStringLiteralClient.java","src/main/java/type/property/optional/implementation/BooleanLiteralsImpl.java","src/main/java/type/property/optional/implementation/BytesImpl.java","src/main/java/type/property/optional/implementation/CollectionsBytesImpl.java","src/main/java/type/property/optional/implementation/CollectionsModelsImpl.java","src/main/java/type/property/optional/implementation/DatetimeOperationsImpl.java","src/main/java/type/property/optional/implementation/DurationOperationsImpl.java","src/main/java/type/property/optional/implementation/FloatLiteralsImpl.java","src/main/java/type/property/optional/implementation/IntLiteralsImpl.java","src/main/java/type/property/optional/implementation/OptionalClientImpl.java","src/main/java/type/property/optional/implementation/PlainDatesImpl.java","src/main/java/type/property/optional/implementation/PlainTimesImpl.java","src/main/java/type/property/optional/implementation/RequiredAndOptionalsImpl.java","src/main/java/type/property/optional/implementation/StringLiteralsImpl.java","src/main/java/type/property/optional/implementation/StringOperationsImpl.java","src/main/java/type/property/optional/implementation/UnionFloatLiteralsImpl.java","src/main/java/type/property/optional/implementation/UnionIntLiteralsImpl.java","src/main/java/type/property/optional/implementation/UnionStringLiteralsImpl.java","src/main/java/type/property/optional/implementation/package-info.java","src/main/java/type/property/optional/models/BooleanLiteralProperty.java","src/main/java/type/property/optional/models/BooleanLiteralPropertyProperty.java","src/main/java/type/property/optional/models/BytesProperty.java","src/main/java/type/property/optional/models/CollectionsByteProperty.java","src/main/java/type/property/optional/models/CollectionsModelProperty.java","src/main/java/type/property/optional/models/DatetimeProperty.java","src/main/java/type/property/optional/models/DurationProperty.java","src/main/java/type/property/optional/models/FloatLiteralProperty.java","src/main/java/type/property/optional/models/FloatLiteralPropertyProperty.java","src/main/java/type/property/optional/models/IntLiteralProperty.java","src/main/java/type/property/optional/models/IntLiteralPropertyProperty.java","src/main/java/type/property/optional/models/PlainDateProperty.java","src/main/java/type/property/optional/models/PlainTimeProperty.java","src/main/java/type/property/optional/models/RequiredAndOptionalProperty.java","src/main/java/type/property/optional/models/StringLiteralProperty.java","src/main/java/type/property/optional/models/StringLiteralPropertyProperty.java","src/main/java/type/property/optional/models/StringProperty.java","src/main/java/type/property/optional/models/UnionFloatLiteralProperty.java","src/main/java/type/property/optional/models/UnionFloatLiteralPropertyProperty.java","src/main/java/type/property/optional/models/UnionIntLiteralProperty.java","src/main/java/type/property/optional/models/UnionIntLiteralPropertyProperty.java","src/main/java/type/property/optional/models/UnionStringLiteralProperty.java","src/main/java/type/property/optional/models/UnionStringLiteralPropertyProperty.java","src/main/java/type/property/optional/models/package-info.java","src/main/java/type/property/optional/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_apiview_properties.json new file mode 100644 index 00000000000..77ed3a46f1d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_apiview_properties.json @@ -0,0 +1,332 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.property.valuetypes.BooleanLiteralAsyncClient": "Type.Property.ValueTypes.BooleanLiteral", + "type.property.valuetypes.BooleanLiteralAsyncClient.get": "Type.Property.ValueTypes.BooleanLiteral.get", + "type.property.valuetypes.BooleanLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.BooleanLiteral.get", + "type.property.valuetypes.BooleanLiteralAsyncClient.put": "Type.Property.ValueTypes.BooleanLiteral.put", + "type.property.valuetypes.BooleanLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.BooleanLiteral.put", + "type.property.valuetypes.BooleanLiteralClient": "Type.Property.ValueTypes.BooleanLiteral", + "type.property.valuetypes.BooleanLiteralClient.get": "Type.Property.ValueTypes.BooleanLiteral.get", + "type.property.valuetypes.BooleanLiteralClient.getWithResponse": "Type.Property.ValueTypes.BooleanLiteral.get", + "type.property.valuetypes.BooleanLiteralClient.put": "Type.Property.ValueTypes.BooleanLiteral.put", + "type.property.valuetypes.BooleanLiteralClient.putWithResponse": "Type.Property.ValueTypes.BooleanLiteral.put", + "type.property.valuetypes.BooleanOperationAsyncClient": "Type.Property.ValueTypes.Boolean", + "type.property.valuetypes.BooleanOperationAsyncClient.get": "Type.Property.ValueTypes.Boolean.get", + "type.property.valuetypes.BooleanOperationAsyncClient.getWithResponse": "Type.Property.ValueTypes.Boolean.get", + "type.property.valuetypes.BooleanOperationAsyncClient.put": "Type.Property.ValueTypes.Boolean.put", + "type.property.valuetypes.BooleanOperationAsyncClient.putWithResponse": "Type.Property.ValueTypes.Boolean.put", + "type.property.valuetypes.BooleanOperationClient": "Type.Property.ValueTypes.Boolean", + "type.property.valuetypes.BooleanOperationClient.get": "Type.Property.ValueTypes.Boolean.get", + "type.property.valuetypes.BooleanOperationClient.getWithResponse": "Type.Property.ValueTypes.Boolean.get", + "type.property.valuetypes.BooleanOperationClient.put": "Type.Property.ValueTypes.Boolean.put", + "type.property.valuetypes.BooleanOperationClient.putWithResponse": "Type.Property.ValueTypes.Boolean.put", + "type.property.valuetypes.BytesAsyncClient": "Type.Property.ValueTypes.Bytes", + "type.property.valuetypes.BytesAsyncClient.get": "Type.Property.ValueTypes.Bytes.get", + "type.property.valuetypes.BytesAsyncClient.getWithResponse": "Type.Property.ValueTypes.Bytes.get", + "type.property.valuetypes.BytesAsyncClient.put": "Type.Property.ValueTypes.Bytes.put", + "type.property.valuetypes.BytesAsyncClient.putWithResponse": "Type.Property.ValueTypes.Bytes.put", + "type.property.valuetypes.BytesClient": "Type.Property.ValueTypes.Bytes", + "type.property.valuetypes.BytesClient.get": "Type.Property.ValueTypes.Bytes.get", + "type.property.valuetypes.BytesClient.getWithResponse": "Type.Property.ValueTypes.Bytes.get", + "type.property.valuetypes.BytesClient.put": "Type.Property.ValueTypes.Bytes.put", + "type.property.valuetypes.BytesClient.putWithResponse": "Type.Property.ValueTypes.Bytes.put", + "type.property.valuetypes.CollectionsIntAsyncClient": "Type.Property.ValueTypes.CollectionsInt", + "type.property.valuetypes.CollectionsIntAsyncClient.get": "Type.Property.ValueTypes.CollectionsInt.get", + "type.property.valuetypes.CollectionsIntAsyncClient.getWithResponse": "Type.Property.ValueTypes.CollectionsInt.get", + "type.property.valuetypes.CollectionsIntAsyncClient.put": "Type.Property.ValueTypes.CollectionsInt.put", + "type.property.valuetypes.CollectionsIntAsyncClient.putWithResponse": "Type.Property.ValueTypes.CollectionsInt.put", + "type.property.valuetypes.CollectionsIntClient": "Type.Property.ValueTypes.CollectionsInt", + "type.property.valuetypes.CollectionsIntClient.get": "Type.Property.ValueTypes.CollectionsInt.get", + "type.property.valuetypes.CollectionsIntClient.getWithResponse": "Type.Property.ValueTypes.CollectionsInt.get", + "type.property.valuetypes.CollectionsIntClient.put": "Type.Property.ValueTypes.CollectionsInt.put", + "type.property.valuetypes.CollectionsIntClient.putWithResponse": "Type.Property.ValueTypes.CollectionsInt.put", + "type.property.valuetypes.CollectionsModelAsyncClient": "Type.Property.ValueTypes.CollectionsModel", + "type.property.valuetypes.CollectionsModelAsyncClient.get": "Type.Property.ValueTypes.CollectionsModel.get", + "type.property.valuetypes.CollectionsModelAsyncClient.getWithResponse": "Type.Property.ValueTypes.CollectionsModel.get", + "type.property.valuetypes.CollectionsModelAsyncClient.put": "Type.Property.ValueTypes.CollectionsModel.put", + "type.property.valuetypes.CollectionsModelAsyncClient.putWithResponse": "Type.Property.ValueTypes.CollectionsModel.put", + "type.property.valuetypes.CollectionsModelClient": "Type.Property.ValueTypes.CollectionsModel", + "type.property.valuetypes.CollectionsModelClient.get": "Type.Property.ValueTypes.CollectionsModel.get", + "type.property.valuetypes.CollectionsModelClient.getWithResponse": "Type.Property.ValueTypes.CollectionsModel.get", + "type.property.valuetypes.CollectionsModelClient.put": "Type.Property.ValueTypes.CollectionsModel.put", + "type.property.valuetypes.CollectionsModelClient.putWithResponse": "Type.Property.ValueTypes.CollectionsModel.put", + "type.property.valuetypes.CollectionsStringAsyncClient": "Type.Property.ValueTypes.CollectionsString", + "type.property.valuetypes.CollectionsStringAsyncClient.get": "Type.Property.ValueTypes.CollectionsString.get", + "type.property.valuetypes.CollectionsStringAsyncClient.getWithResponse": "Type.Property.ValueTypes.CollectionsString.get", + "type.property.valuetypes.CollectionsStringAsyncClient.put": "Type.Property.ValueTypes.CollectionsString.put", + "type.property.valuetypes.CollectionsStringAsyncClient.putWithResponse": "Type.Property.ValueTypes.CollectionsString.put", + "type.property.valuetypes.CollectionsStringClient": "Type.Property.ValueTypes.CollectionsString", + "type.property.valuetypes.CollectionsStringClient.get": "Type.Property.ValueTypes.CollectionsString.get", + "type.property.valuetypes.CollectionsStringClient.getWithResponse": "Type.Property.ValueTypes.CollectionsString.get", + "type.property.valuetypes.CollectionsStringClient.put": "Type.Property.ValueTypes.CollectionsString.put", + "type.property.valuetypes.CollectionsStringClient.putWithResponse": "Type.Property.ValueTypes.CollectionsString.put", + "type.property.valuetypes.DatetimeOperationAsyncClient": "Type.Property.ValueTypes.Datetime", + "type.property.valuetypes.DatetimeOperationAsyncClient.get": "Type.Property.ValueTypes.Datetime.get", + "type.property.valuetypes.DatetimeOperationAsyncClient.getWithResponse": "Type.Property.ValueTypes.Datetime.get", + "type.property.valuetypes.DatetimeOperationAsyncClient.put": "Type.Property.ValueTypes.Datetime.put", + "type.property.valuetypes.DatetimeOperationAsyncClient.putWithResponse": "Type.Property.ValueTypes.Datetime.put", + "type.property.valuetypes.DatetimeOperationClient": "Type.Property.ValueTypes.Datetime", + "type.property.valuetypes.DatetimeOperationClient.get": "Type.Property.ValueTypes.Datetime.get", + "type.property.valuetypes.DatetimeOperationClient.getWithResponse": "Type.Property.ValueTypes.Datetime.get", + "type.property.valuetypes.DatetimeOperationClient.put": "Type.Property.ValueTypes.Datetime.put", + "type.property.valuetypes.DatetimeOperationClient.putWithResponse": "Type.Property.ValueTypes.Datetime.put", + "type.property.valuetypes.Decimal128AsyncClient": "Type.Property.ValueTypes.Decimal128", + "type.property.valuetypes.Decimal128AsyncClient.get": "Type.Property.ValueTypes.Decimal128.get", + "type.property.valuetypes.Decimal128AsyncClient.getWithResponse": "Type.Property.ValueTypes.Decimal128.get", + "type.property.valuetypes.Decimal128AsyncClient.put": "Type.Property.ValueTypes.Decimal128.put", + "type.property.valuetypes.Decimal128AsyncClient.putWithResponse": "Type.Property.ValueTypes.Decimal128.put", + "type.property.valuetypes.Decimal128Client": "Type.Property.ValueTypes.Decimal128", + "type.property.valuetypes.Decimal128Client.get": "Type.Property.ValueTypes.Decimal128.get", + "type.property.valuetypes.Decimal128Client.getWithResponse": "Type.Property.ValueTypes.Decimal128.get", + "type.property.valuetypes.Decimal128Client.put": "Type.Property.ValueTypes.Decimal128.put", + "type.property.valuetypes.Decimal128Client.putWithResponse": "Type.Property.ValueTypes.Decimal128.put", + "type.property.valuetypes.DecimalAsyncClient": "Type.Property.ValueTypes.Decimal", + "type.property.valuetypes.DecimalAsyncClient.get": "Type.Property.ValueTypes.Decimal.get", + "type.property.valuetypes.DecimalAsyncClient.getWithResponse": "Type.Property.ValueTypes.Decimal.get", + "type.property.valuetypes.DecimalAsyncClient.put": "Type.Property.ValueTypes.Decimal.put", + "type.property.valuetypes.DecimalAsyncClient.putWithResponse": "Type.Property.ValueTypes.Decimal.put", + "type.property.valuetypes.DecimalClient": "Type.Property.ValueTypes.Decimal", + "type.property.valuetypes.DecimalClient.get": "Type.Property.ValueTypes.Decimal.get", + "type.property.valuetypes.DecimalClient.getWithResponse": "Type.Property.ValueTypes.Decimal.get", + "type.property.valuetypes.DecimalClient.put": "Type.Property.ValueTypes.Decimal.put", + "type.property.valuetypes.DecimalClient.putWithResponse": "Type.Property.ValueTypes.Decimal.put", + "type.property.valuetypes.DictionaryStringAsyncClient": "Type.Property.ValueTypes.DictionaryString", + "type.property.valuetypes.DictionaryStringAsyncClient.get": "Type.Property.ValueTypes.DictionaryString.get", + "type.property.valuetypes.DictionaryStringAsyncClient.getWithResponse": "Type.Property.ValueTypes.DictionaryString.get", + "type.property.valuetypes.DictionaryStringAsyncClient.put": "Type.Property.ValueTypes.DictionaryString.put", + "type.property.valuetypes.DictionaryStringAsyncClient.putWithResponse": "Type.Property.ValueTypes.DictionaryString.put", + "type.property.valuetypes.DictionaryStringClient": "Type.Property.ValueTypes.DictionaryString", + "type.property.valuetypes.DictionaryStringClient.get": "Type.Property.ValueTypes.DictionaryString.get", + "type.property.valuetypes.DictionaryStringClient.getWithResponse": "Type.Property.ValueTypes.DictionaryString.get", + "type.property.valuetypes.DictionaryStringClient.put": "Type.Property.ValueTypes.DictionaryString.put", + "type.property.valuetypes.DictionaryStringClient.putWithResponse": "Type.Property.ValueTypes.DictionaryString.put", + "type.property.valuetypes.DurationOperationAsyncClient": "Type.Property.ValueTypes.Duration", + "type.property.valuetypes.DurationOperationAsyncClient.get": "Type.Property.ValueTypes.Duration.get", + "type.property.valuetypes.DurationOperationAsyncClient.getWithResponse": "Type.Property.ValueTypes.Duration.get", + "type.property.valuetypes.DurationOperationAsyncClient.put": "Type.Property.ValueTypes.Duration.put", + "type.property.valuetypes.DurationOperationAsyncClient.putWithResponse": "Type.Property.ValueTypes.Duration.put", + "type.property.valuetypes.DurationOperationClient": "Type.Property.ValueTypes.Duration", + "type.property.valuetypes.DurationOperationClient.get": "Type.Property.ValueTypes.Duration.get", + "type.property.valuetypes.DurationOperationClient.getWithResponse": "Type.Property.ValueTypes.Duration.get", + "type.property.valuetypes.DurationOperationClient.put": "Type.Property.ValueTypes.Duration.put", + "type.property.valuetypes.DurationOperationClient.putWithResponse": "Type.Property.ValueTypes.Duration.put", + "type.property.valuetypes.EnumAsyncClient": "Type.Property.ValueTypes.Enum", + "type.property.valuetypes.EnumAsyncClient.get": "Type.Property.ValueTypes.Enum.get", + "type.property.valuetypes.EnumAsyncClient.getWithResponse": "Type.Property.ValueTypes.Enum.get", + "type.property.valuetypes.EnumAsyncClient.put": "Type.Property.ValueTypes.Enum.put", + "type.property.valuetypes.EnumAsyncClient.putWithResponse": "Type.Property.ValueTypes.Enum.put", + "type.property.valuetypes.EnumClient": "Type.Property.ValueTypes.Enum", + "type.property.valuetypes.EnumClient.get": "Type.Property.ValueTypes.Enum.get", + "type.property.valuetypes.EnumClient.getWithResponse": "Type.Property.ValueTypes.Enum.get", + "type.property.valuetypes.EnumClient.put": "Type.Property.ValueTypes.Enum.put", + "type.property.valuetypes.EnumClient.putWithResponse": "Type.Property.ValueTypes.Enum.put", + "type.property.valuetypes.ExtensibleEnumAsyncClient": "Type.Property.ValueTypes.ExtensibleEnum", + "type.property.valuetypes.ExtensibleEnumAsyncClient.get": "Type.Property.ValueTypes.ExtensibleEnum.get", + "type.property.valuetypes.ExtensibleEnumAsyncClient.getWithResponse": "Type.Property.ValueTypes.ExtensibleEnum.get", + "type.property.valuetypes.ExtensibleEnumAsyncClient.put": "Type.Property.ValueTypes.ExtensibleEnum.put", + "type.property.valuetypes.ExtensibleEnumAsyncClient.putWithResponse": "Type.Property.ValueTypes.ExtensibleEnum.put", + "type.property.valuetypes.ExtensibleEnumClient": "Type.Property.ValueTypes.ExtensibleEnum", + "type.property.valuetypes.ExtensibleEnumClient.get": "Type.Property.ValueTypes.ExtensibleEnum.get", + "type.property.valuetypes.ExtensibleEnumClient.getWithResponse": "Type.Property.ValueTypes.ExtensibleEnum.get", + "type.property.valuetypes.ExtensibleEnumClient.put": "Type.Property.ValueTypes.ExtensibleEnum.put", + "type.property.valuetypes.ExtensibleEnumClient.putWithResponse": "Type.Property.ValueTypes.ExtensibleEnum.put", + "type.property.valuetypes.FloatLiteralAsyncClient": "Type.Property.ValueTypes.FloatLiteral", + "type.property.valuetypes.FloatLiteralAsyncClient.get": "Type.Property.ValueTypes.FloatLiteral.get", + "type.property.valuetypes.FloatLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.FloatLiteral.get", + "type.property.valuetypes.FloatLiteralAsyncClient.put": "Type.Property.ValueTypes.FloatLiteral.put", + "type.property.valuetypes.FloatLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.FloatLiteral.put", + "type.property.valuetypes.FloatLiteralClient": "Type.Property.ValueTypes.FloatLiteral", + "type.property.valuetypes.FloatLiteralClient.get": "Type.Property.ValueTypes.FloatLiteral.get", + "type.property.valuetypes.FloatLiteralClient.getWithResponse": "Type.Property.ValueTypes.FloatLiteral.get", + "type.property.valuetypes.FloatLiteralClient.put": "Type.Property.ValueTypes.FloatLiteral.put", + "type.property.valuetypes.FloatLiteralClient.putWithResponse": "Type.Property.ValueTypes.FloatLiteral.put", + "type.property.valuetypes.FloatOperationAsyncClient": "Type.Property.ValueTypes.Float", + "type.property.valuetypes.FloatOperationAsyncClient.get": "Type.Property.ValueTypes.Float.get", + "type.property.valuetypes.FloatOperationAsyncClient.getWithResponse": "Type.Property.ValueTypes.Float.get", + "type.property.valuetypes.FloatOperationAsyncClient.put": "Type.Property.ValueTypes.Float.put", + "type.property.valuetypes.FloatOperationAsyncClient.putWithResponse": "Type.Property.ValueTypes.Float.put", + "type.property.valuetypes.FloatOperationClient": "Type.Property.ValueTypes.Float", + "type.property.valuetypes.FloatOperationClient.get": "Type.Property.ValueTypes.Float.get", + "type.property.valuetypes.FloatOperationClient.getWithResponse": "Type.Property.ValueTypes.Float.get", + "type.property.valuetypes.FloatOperationClient.put": "Type.Property.ValueTypes.Float.put", + "type.property.valuetypes.FloatOperationClient.putWithResponse": "Type.Property.ValueTypes.Float.put", + "type.property.valuetypes.IntAsyncClient": "Type.Property.ValueTypes.Int", + "type.property.valuetypes.IntAsyncClient.get": "Type.Property.ValueTypes.Int.get", + "type.property.valuetypes.IntAsyncClient.getWithResponse": "Type.Property.ValueTypes.Int.get", + "type.property.valuetypes.IntAsyncClient.put": "Type.Property.ValueTypes.Int.put", + "type.property.valuetypes.IntAsyncClient.putWithResponse": "Type.Property.ValueTypes.Int.put", + "type.property.valuetypes.IntClient": "Type.Property.ValueTypes.Int", + "type.property.valuetypes.IntClient.get": "Type.Property.ValueTypes.Int.get", + "type.property.valuetypes.IntClient.getWithResponse": "Type.Property.ValueTypes.Int.get", + "type.property.valuetypes.IntClient.put": "Type.Property.ValueTypes.Int.put", + "type.property.valuetypes.IntClient.putWithResponse": "Type.Property.ValueTypes.Int.put", + "type.property.valuetypes.IntLiteralAsyncClient": "Type.Property.ValueTypes.IntLiteral", + "type.property.valuetypes.IntLiteralAsyncClient.get": "Type.Property.ValueTypes.IntLiteral.get", + "type.property.valuetypes.IntLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.IntLiteral.get", + "type.property.valuetypes.IntLiteralAsyncClient.put": "Type.Property.ValueTypes.IntLiteral.put", + "type.property.valuetypes.IntLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.IntLiteral.put", + "type.property.valuetypes.IntLiteralClient": "Type.Property.ValueTypes.IntLiteral", + "type.property.valuetypes.IntLiteralClient.get": "Type.Property.ValueTypes.IntLiteral.get", + "type.property.valuetypes.IntLiteralClient.getWithResponse": "Type.Property.ValueTypes.IntLiteral.get", + "type.property.valuetypes.IntLiteralClient.put": "Type.Property.ValueTypes.IntLiteral.put", + "type.property.valuetypes.IntLiteralClient.putWithResponse": "Type.Property.ValueTypes.IntLiteral.put", + "type.property.valuetypes.ModelAsyncClient": "Type.Property.ValueTypes.Model", + "type.property.valuetypes.ModelAsyncClient.get": "Type.Property.ValueTypes.Model.get", + "type.property.valuetypes.ModelAsyncClient.getWithResponse": "Type.Property.ValueTypes.Model.get", + "type.property.valuetypes.ModelAsyncClient.put": "Type.Property.ValueTypes.Model.put", + "type.property.valuetypes.ModelAsyncClient.putWithResponse": "Type.Property.ValueTypes.Model.put", + "type.property.valuetypes.ModelClient": "Type.Property.ValueTypes.Model", + "type.property.valuetypes.ModelClient.get": "Type.Property.ValueTypes.Model.get", + "type.property.valuetypes.ModelClient.getWithResponse": "Type.Property.ValueTypes.Model.get", + "type.property.valuetypes.ModelClient.put": "Type.Property.ValueTypes.Model.put", + "type.property.valuetypes.ModelClient.putWithResponse": "Type.Property.ValueTypes.Model.put", + "type.property.valuetypes.NeverAsyncClient": "Type.Property.ValueTypes.Never", + "type.property.valuetypes.NeverAsyncClient.get": "Type.Property.ValueTypes.Never.get", + "type.property.valuetypes.NeverAsyncClient.getWithResponse": "Type.Property.ValueTypes.Never.get", + "type.property.valuetypes.NeverAsyncClient.put": "Type.Property.ValueTypes.Never.put", + "type.property.valuetypes.NeverAsyncClient.putWithResponse": "Type.Property.ValueTypes.Never.put", + "type.property.valuetypes.NeverClient": "Type.Property.ValueTypes.Never", + "type.property.valuetypes.NeverClient.get": "Type.Property.ValueTypes.Never.get", + "type.property.valuetypes.NeverClient.getWithResponse": "Type.Property.ValueTypes.Never.get", + "type.property.valuetypes.NeverClient.put": "Type.Property.ValueTypes.Never.put", + "type.property.valuetypes.NeverClient.putWithResponse": "Type.Property.ValueTypes.Never.put", + "type.property.valuetypes.StringLiteralAsyncClient": "Type.Property.ValueTypes.StringLiteral", + "type.property.valuetypes.StringLiteralAsyncClient.get": "Type.Property.ValueTypes.StringLiteral.get", + "type.property.valuetypes.StringLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.StringLiteral.get", + "type.property.valuetypes.StringLiteralAsyncClient.put": "Type.Property.ValueTypes.StringLiteral.put", + "type.property.valuetypes.StringLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.StringLiteral.put", + "type.property.valuetypes.StringLiteralClient": "Type.Property.ValueTypes.StringLiteral", + "type.property.valuetypes.StringLiteralClient.get": "Type.Property.ValueTypes.StringLiteral.get", + "type.property.valuetypes.StringLiteralClient.getWithResponse": "Type.Property.ValueTypes.StringLiteral.get", + "type.property.valuetypes.StringLiteralClient.put": "Type.Property.ValueTypes.StringLiteral.put", + "type.property.valuetypes.StringLiteralClient.putWithResponse": "Type.Property.ValueTypes.StringLiteral.put", + "type.property.valuetypes.StringOperationAsyncClient": "Type.Property.ValueTypes.String", + "type.property.valuetypes.StringOperationAsyncClient.get": "Type.Property.ValueTypes.String.get", + "type.property.valuetypes.StringOperationAsyncClient.getWithResponse": "Type.Property.ValueTypes.String.get", + "type.property.valuetypes.StringOperationAsyncClient.put": "Type.Property.ValueTypes.String.put", + "type.property.valuetypes.StringOperationAsyncClient.putWithResponse": "Type.Property.ValueTypes.String.put", + "type.property.valuetypes.StringOperationClient": "Type.Property.ValueTypes.String", + "type.property.valuetypes.StringOperationClient.get": "Type.Property.ValueTypes.String.get", + "type.property.valuetypes.StringOperationClient.getWithResponse": "Type.Property.ValueTypes.String.get", + "type.property.valuetypes.StringOperationClient.put": "Type.Property.ValueTypes.String.put", + "type.property.valuetypes.StringOperationClient.putWithResponse": "Type.Property.ValueTypes.String.put", + "type.property.valuetypes.UnionEnumValueAsyncClient": "Type.Property.ValueTypes.UnionEnumValue", + "type.property.valuetypes.UnionEnumValueAsyncClient.get": "Type.Property.ValueTypes.UnionEnumValue.get", + "type.property.valuetypes.UnionEnumValueAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnionEnumValue.get", + "type.property.valuetypes.UnionEnumValueAsyncClient.put": "Type.Property.ValueTypes.UnionEnumValue.put", + "type.property.valuetypes.UnionEnumValueAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnionEnumValue.put", + "type.property.valuetypes.UnionEnumValueClient": "Type.Property.ValueTypes.UnionEnumValue", + "type.property.valuetypes.UnionEnumValueClient.get": "Type.Property.ValueTypes.UnionEnumValue.get", + "type.property.valuetypes.UnionEnumValueClient.getWithResponse": "Type.Property.ValueTypes.UnionEnumValue.get", + "type.property.valuetypes.UnionEnumValueClient.put": "Type.Property.ValueTypes.UnionEnumValue.put", + "type.property.valuetypes.UnionEnumValueClient.putWithResponse": "Type.Property.ValueTypes.UnionEnumValue.put", + "type.property.valuetypes.UnionFloatLiteralAsyncClient": "Type.Property.ValueTypes.UnionFloatLiteral", + "type.property.valuetypes.UnionFloatLiteralAsyncClient.get": "Type.Property.ValueTypes.UnionFloatLiteral.get", + "type.property.valuetypes.UnionFloatLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnionFloatLiteral.get", + "type.property.valuetypes.UnionFloatLiteralAsyncClient.put": "Type.Property.ValueTypes.UnionFloatLiteral.put", + "type.property.valuetypes.UnionFloatLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnionFloatLiteral.put", + "type.property.valuetypes.UnionFloatLiteralClient": "Type.Property.ValueTypes.UnionFloatLiteral", + "type.property.valuetypes.UnionFloatLiteralClient.get": "Type.Property.ValueTypes.UnionFloatLiteral.get", + "type.property.valuetypes.UnionFloatLiteralClient.getWithResponse": "Type.Property.ValueTypes.UnionFloatLiteral.get", + "type.property.valuetypes.UnionFloatLiteralClient.put": "Type.Property.ValueTypes.UnionFloatLiteral.put", + "type.property.valuetypes.UnionFloatLiteralClient.putWithResponse": "Type.Property.ValueTypes.UnionFloatLiteral.put", + "type.property.valuetypes.UnionIntLiteralAsyncClient": "Type.Property.ValueTypes.UnionIntLiteral", + "type.property.valuetypes.UnionIntLiteralAsyncClient.get": "Type.Property.ValueTypes.UnionIntLiteral.get", + "type.property.valuetypes.UnionIntLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnionIntLiteral.get", + "type.property.valuetypes.UnionIntLiteralAsyncClient.put": "Type.Property.ValueTypes.UnionIntLiteral.put", + "type.property.valuetypes.UnionIntLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnionIntLiteral.put", + "type.property.valuetypes.UnionIntLiteralClient": "Type.Property.ValueTypes.UnionIntLiteral", + "type.property.valuetypes.UnionIntLiteralClient.get": "Type.Property.ValueTypes.UnionIntLiteral.get", + "type.property.valuetypes.UnionIntLiteralClient.getWithResponse": "Type.Property.ValueTypes.UnionIntLiteral.get", + "type.property.valuetypes.UnionIntLiteralClient.put": "Type.Property.ValueTypes.UnionIntLiteral.put", + "type.property.valuetypes.UnionIntLiteralClient.putWithResponse": "Type.Property.ValueTypes.UnionIntLiteral.put", + "type.property.valuetypes.UnionStringLiteralAsyncClient": "Type.Property.ValueTypes.UnionStringLiteral", + "type.property.valuetypes.UnionStringLiteralAsyncClient.get": "Type.Property.ValueTypes.UnionStringLiteral.get", + "type.property.valuetypes.UnionStringLiteralAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnionStringLiteral.get", + "type.property.valuetypes.UnionStringLiteralAsyncClient.put": "Type.Property.ValueTypes.UnionStringLiteral.put", + "type.property.valuetypes.UnionStringLiteralAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnionStringLiteral.put", + "type.property.valuetypes.UnionStringLiteralClient": "Type.Property.ValueTypes.UnionStringLiteral", + "type.property.valuetypes.UnionStringLiteralClient.get": "Type.Property.ValueTypes.UnionStringLiteral.get", + "type.property.valuetypes.UnionStringLiteralClient.getWithResponse": "Type.Property.ValueTypes.UnionStringLiteral.get", + "type.property.valuetypes.UnionStringLiteralClient.put": "Type.Property.ValueTypes.UnionStringLiteral.put", + "type.property.valuetypes.UnionStringLiteralClient.putWithResponse": "Type.Property.ValueTypes.UnionStringLiteral.put", + "type.property.valuetypes.UnknownArrayAsyncClient": "Type.Property.ValueTypes.UnknownArray", + "type.property.valuetypes.UnknownArrayAsyncClient.get": "Type.Property.ValueTypes.UnknownArray.get", + "type.property.valuetypes.UnknownArrayAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnknownArray.get", + "type.property.valuetypes.UnknownArrayAsyncClient.put": "Type.Property.ValueTypes.UnknownArray.put", + "type.property.valuetypes.UnknownArrayAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnknownArray.put", + "type.property.valuetypes.UnknownArrayClient": "Type.Property.ValueTypes.UnknownArray", + "type.property.valuetypes.UnknownArrayClient.get": "Type.Property.ValueTypes.UnknownArray.get", + "type.property.valuetypes.UnknownArrayClient.getWithResponse": "Type.Property.ValueTypes.UnknownArray.get", + "type.property.valuetypes.UnknownArrayClient.put": "Type.Property.ValueTypes.UnknownArray.put", + "type.property.valuetypes.UnknownArrayClient.putWithResponse": "Type.Property.ValueTypes.UnknownArray.put", + "type.property.valuetypes.UnknownDictAsyncClient": "Type.Property.ValueTypes.UnknownDict", + "type.property.valuetypes.UnknownDictAsyncClient.get": "Type.Property.ValueTypes.UnknownDict.get", + "type.property.valuetypes.UnknownDictAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnknownDict.get", + "type.property.valuetypes.UnknownDictAsyncClient.put": "Type.Property.ValueTypes.UnknownDict.put", + "type.property.valuetypes.UnknownDictAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnknownDict.put", + "type.property.valuetypes.UnknownDictClient": "Type.Property.ValueTypes.UnknownDict", + "type.property.valuetypes.UnknownDictClient.get": "Type.Property.ValueTypes.UnknownDict.get", + "type.property.valuetypes.UnknownDictClient.getWithResponse": "Type.Property.ValueTypes.UnknownDict.get", + "type.property.valuetypes.UnknownDictClient.put": "Type.Property.ValueTypes.UnknownDict.put", + "type.property.valuetypes.UnknownDictClient.putWithResponse": "Type.Property.ValueTypes.UnknownDict.put", + "type.property.valuetypes.UnknownIntAsyncClient": "Type.Property.ValueTypes.UnknownInt", + "type.property.valuetypes.UnknownIntAsyncClient.get": "Type.Property.ValueTypes.UnknownInt.get", + "type.property.valuetypes.UnknownIntAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnknownInt.get", + "type.property.valuetypes.UnknownIntAsyncClient.put": "Type.Property.ValueTypes.UnknownInt.put", + "type.property.valuetypes.UnknownIntAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnknownInt.put", + "type.property.valuetypes.UnknownIntClient": "Type.Property.ValueTypes.UnknownInt", + "type.property.valuetypes.UnknownIntClient.get": "Type.Property.ValueTypes.UnknownInt.get", + "type.property.valuetypes.UnknownIntClient.getWithResponse": "Type.Property.ValueTypes.UnknownInt.get", + "type.property.valuetypes.UnknownIntClient.put": "Type.Property.ValueTypes.UnknownInt.put", + "type.property.valuetypes.UnknownIntClient.putWithResponse": "Type.Property.ValueTypes.UnknownInt.put", + "type.property.valuetypes.UnknownStringAsyncClient": "Type.Property.ValueTypes.UnknownString", + "type.property.valuetypes.UnknownStringAsyncClient.get": "Type.Property.ValueTypes.UnknownString.get", + "type.property.valuetypes.UnknownStringAsyncClient.getWithResponse": "Type.Property.ValueTypes.UnknownString.get", + "type.property.valuetypes.UnknownStringAsyncClient.put": "Type.Property.ValueTypes.UnknownString.put", + "type.property.valuetypes.UnknownStringAsyncClient.putWithResponse": "Type.Property.ValueTypes.UnknownString.put", + "type.property.valuetypes.UnknownStringClient": "Type.Property.ValueTypes.UnknownString", + "type.property.valuetypes.UnknownStringClient.get": "Type.Property.ValueTypes.UnknownString.get", + "type.property.valuetypes.UnknownStringClient.getWithResponse": "Type.Property.ValueTypes.UnknownString.get", + "type.property.valuetypes.UnknownStringClient.put": "Type.Property.ValueTypes.UnknownString.put", + "type.property.valuetypes.UnknownStringClient.putWithResponse": "Type.Property.ValueTypes.UnknownString.put", + "type.property.valuetypes.ValueTypesClientBuilder": "Type.Property.ValueTypes", + "type.property.valuetypes.models.BooleanLiteralProperty": "Type.Property.ValueTypes.BooleanLiteralProperty", + "type.property.valuetypes.models.BooleanProperty": "Type.Property.ValueTypes.BooleanProperty", + "type.property.valuetypes.models.BytesProperty": "Type.Property.ValueTypes.BytesProperty", + "type.property.valuetypes.models.CollectionsIntProperty": "Type.Property.ValueTypes.CollectionsIntProperty", + "type.property.valuetypes.models.CollectionsModelProperty": "Type.Property.ValueTypes.CollectionsModelProperty", + "type.property.valuetypes.models.CollectionsStringProperty": "Type.Property.ValueTypes.CollectionsStringProperty", + "type.property.valuetypes.models.DatetimeProperty": "Type.Property.ValueTypes.DatetimeProperty", + "type.property.valuetypes.models.Decimal128Property": "Type.Property.ValueTypes.Decimal128Property", + "type.property.valuetypes.models.DecimalProperty": "Type.Property.ValueTypes.DecimalProperty", + "type.property.valuetypes.models.DictionaryStringProperty": "Type.Property.ValueTypes.DictionaryStringProperty", + "type.property.valuetypes.models.DurationProperty": "Type.Property.ValueTypes.DurationProperty", + "type.property.valuetypes.models.EnumProperty": "Type.Property.ValueTypes.EnumProperty", + "type.property.valuetypes.models.ExtendedEnum": "Type.Property.ValueTypes.ExtendedEnum", + "type.property.valuetypes.models.ExtensibleEnumProperty": "Type.Property.ValueTypes.ExtensibleEnumProperty", + "type.property.valuetypes.models.FixedInnerEnum": "Type.Property.ValueTypes.FixedInnerEnum", + "type.property.valuetypes.models.FloatLiteralProperty": "Type.Property.ValueTypes.FloatLiteralProperty", + "type.property.valuetypes.models.FloatProperty": "Type.Property.ValueTypes.FloatProperty", + "type.property.valuetypes.models.InnerEnum": "Type.Property.ValueTypes.InnerEnum", + "type.property.valuetypes.models.InnerModel": "Type.Property.ValueTypes.InnerModel", + "type.property.valuetypes.models.IntLiteralProperty": "Type.Property.ValueTypes.IntLiteralProperty", + "type.property.valuetypes.models.IntProperty": "Type.Property.ValueTypes.IntProperty", + "type.property.valuetypes.models.ModelProperty": "Type.Property.ValueTypes.ModelProperty", + "type.property.valuetypes.models.NeverProperty": "Type.Property.ValueTypes.NeverProperty", + "type.property.valuetypes.models.StringLiteralProperty": "Type.Property.ValueTypes.StringLiteralProperty", + "type.property.valuetypes.models.StringProperty": "Type.Property.ValueTypes.StringProperty", + "type.property.valuetypes.models.UnionEnumValueProperty": "Type.Property.ValueTypes.UnionEnumValueProperty", + "type.property.valuetypes.models.UnionFloatLiteralProperty": "Type.Property.ValueTypes.UnionFloatLiteralProperty", + "type.property.valuetypes.models.UnionFloatLiteralPropertyProperty": "Type.Property.ValueTypes.UnionFloatLiteralProperty.property.anonymous", + "type.property.valuetypes.models.UnionIntLiteralProperty": "Type.Property.ValueTypes.UnionIntLiteralProperty", + "type.property.valuetypes.models.UnionIntLiteralPropertyProperty": "Type.Property.ValueTypes.UnionIntLiteralProperty.property.anonymous", + "type.property.valuetypes.models.UnionStringLiteralProperty": "Type.Property.ValueTypes.UnionStringLiteralProperty", + "type.property.valuetypes.models.UnionStringLiteralPropertyProperty": "Type.Property.ValueTypes.UnionStringLiteralProperty.property.anonymous", + "type.property.valuetypes.models.UnknownArrayProperty": "Type.Property.ValueTypes.UnknownArrayProperty", + "type.property.valuetypes.models.UnknownDictProperty": "Type.Property.ValueTypes.UnknownDictProperty", + "type.property.valuetypes.models.UnknownIntProperty": "Type.Property.ValueTypes.UnknownIntProperty", + "type.property.valuetypes.models.UnknownStringProperty": "Type.Property.ValueTypes.UnknownStringProperty" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_metadata.json new file mode 100644 index 00000000000..8be7c6e3ac4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-property-valuetypes_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.property.valuetypes.BooleanLiteralAsyncClient":"Type.Property.ValueTypes.BooleanLiteral","type.property.valuetypes.BooleanLiteralAsyncClient.get":"Type.Property.ValueTypes.BooleanLiteral.get","type.property.valuetypes.BooleanLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.BooleanLiteral.get","type.property.valuetypes.BooleanLiteralAsyncClient.put":"Type.Property.ValueTypes.BooleanLiteral.put","type.property.valuetypes.BooleanLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.BooleanLiteral.put","type.property.valuetypes.BooleanLiteralClient":"Type.Property.ValueTypes.BooleanLiteral","type.property.valuetypes.BooleanLiteralClient.get":"Type.Property.ValueTypes.BooleanLiteral.get","type.property.valuetypes.BooleanLiteralClient.getWithResponse":"Type.Property.ValueTypes.BooleanLiteral.get","type.property.valuetypes.BooleanLiteralClient.put":"Type.Property.ValueTypes.BooleanLiteral.put","type.property.valuetypes.BooleanLiteralClient.putWithResponse":"Type.Property.ValueTypes.BooleanLiteral.put","type.property.valuetypes.BooleanOperationAsyncClient":"Type.Property.ValueTypes.Boolean","type.property.valuetypes.BooleanOperationAsyncClient.get":"Type.Property.ValueTypes.Boolean.get","type.property.valuetypes.BooleanOperationAsyncClient.getWithResponse":"Type.Property.ValueTypes.Boolean.get","type.property.valuetypes.BooleanOperationAsyncClient.put":"Type.Property.ValueTypes.Boolean.put","type.property.valuetypes.BooleanOperationAsyncClient.putWithResponse":"Type.Property.ValueTypes.Boolean.put","type.property.valuetypes.BooleanOperationClient":"Type.Property.ValueTypes.Boolean","type.property.valuetypes.BooleanOperationClient.get":"Type.Property.ValueTypes.Boolean.get","type.property.valuetypes.BooleanOperationClient.getWithResponse":"Type.Property.ValueTypes.Boolean.get","type.property.valuetypes.BooleanOperationClient.put":"Type.Property.ValueTypes.Boolean.put","type.property.valuetypes.BooleanOperationClient.putWithResponse":"Type.Property.ValueTypes.Boolean.put","type.property.valuetypes.BytesAsyncClient":"Type.Property.ValueTypes.Bytes","type.property.valuetypes.BytesAsyncClient.get":"Type.Property.ValueTypes.Bytes.get","type.property.valuetypes.BytesAsyncClient.getWithResponse":"Type.Property.ValueTypes.Bytes.get","type.property.valuetypes.BytesAsyncClient.put":"Type.Property.ValueTypes.Bytes.put","type.property.valuetypes.BytesAsyncClient.putWithResponse":"Type.Property.ValueTypes.Bytes.put","type.property.valuetypes.BytesClient":"Type.Property.ValueTypes.Bytes","type.property.valuetypes.BytesClient.get":"Type.Property.ValueTypes.Bytes.get","type.property.valuetypes.BytesClient.getWithResponse":"Type.Property.ValueTypes.Bytes.get","type.property.valuetypes.BytesClient.put":"Type.Property.ValueTypes.Bytes.put","type.property.valuetypes.BytesClient.putWithResponse":"Type.Property.ValueTypes.Bytes.put","type.property.valuetypes.CollectionsIntAsyncClient":"Type.Property.ValueTypes.CollectionsInt","type.property.valuetypes.CollectionsIntAsyncClient.get":"Type.Property.ValueTypes.CollectionsInt.get","type.property.valuetypes.CollectionsIntAsyncClient.getWithResponse":"Type.Property.ValueTypes.CollectionsInt.get","type.property.valuetypes.CollectionsIntAsyncClient.put":"Type.Property.ValueTypes.CollectionsInt.put","type.property.valuetypes.CollectionsIntAsyncClient.putWithResponse":"Type.Property.ValueTypes.CollectionsInt.put","type.property.valuetypes.CollectionsIntClient":"Type.Property.ValueTypes.CollectionsInt","type.property.valuetypes.CollectionsIntClient.get":"Type.Property.ValueTypes.CollectionsInt.get","type.property.valuetypes.CollectionsIntClient.getWithResponse":"Type.Property.ValueTypes.CollectionsInt.get","type.property.valuetypes.CollectionsIntClient.put":"Type.Property.ValueTypes.CollectionsInt.put","type.property.valuetypes.CollectionsIntClient.putWithResponse":"Type.Property.ValueTypes.CollectionsInt.put","type.property.valuetypes.CollectionsModelAsyncClient":"Type.Property.ValueTypes.CollectionsModel","type.property.valuetypes.CollectionsModelAsyncClient.get":"Type.Property.ValueTypes.CollectionsModel.get","type.property.valuetypes.CollectionsModelAsyncClient.getWithResponse":"Type.Property.ValueTypes.CollectionsModel.get","type.property.valuetypes.CollectionsModelAsyncClient.put":"Type.Property.ValueTypes.CollectionsModel.put","type.property.valuetypes.CollectionsModelAsyncClient.putWithResponse":"Type.Property.ValueTypes.CollectionsModel.put","type.property.valuetypes.CollectionsModelClient":"Type.Property.ValueTypes.CollectionsModel","type.property.valuetypes.CollectionsModelClient.get":"Type.Property.ValueTypes.CollectionsModel.get","type.property.valuetypes.CollectionsModelClient.getWithResponse":"Type.Property.ValueTypes.CollectionsModel.get","type.property.valuetypes.CollectionsModelClient.put":"Type.Property.ValueTypes.CollectionsModel.put","type.property.valuetypes.CollectionsModelClient.putWithResponse":"Type.Property.ValueTypes.CollectionsModel.put","type.property.valuetypes.CollectionsStringAsyncClient":"Type.Property.ValueTypes.CollectionsString","type.property.valuetypes.CollectionsStringAsyncClient.get":"Type.Property.ValueTypes.CollectionsString.get","type.property.valuetypes.CollectionsStringAsyncClient.getWithResponse":"Type.Property.ValueTypes.CollectionsString.get","type.property.valuetypes.CollectionsStringAsyncClient.put":"Type.Property.ValueTypes.CollectionsString.put","type.property.valuetypes.CollectionsStringAsyncClient.putWithResponse":"Type.Property.ValueTypes.CollectionsString.put","type.property.valuetypes.CollectionsStringClient":"Type.Property.ValueTypes.CollectionsString","type.property.valuetypes.CollectionsStringClient.get":"Type.Property.ValueTypes.CollectionsString.get","type.property.valuetypes.CollectionsStringClient.getWithResponse":"Type.Property.ValueTypes.CollectionsString.get","type.property.valuetypes.CollectionsStringClient.put":"Type.Property.ValueTypes.CollectionsString.put","type.property.valuetypes.CollectionsStringClient.putWithResponse":"Type.Property.ValueTypes.CollectionsString.put","type.property.valuetypes.DatetimeOperationAsyncClient":"Type.Property.ValueTypes.Datetime","type.property.valuetypes.DatetimeOperationAsyncClient.get":"Type.Property.ValueTypes.Datetime.get","type.property.valuetypes.DatetimeOperationAsyncClient.getWithResponse":"Type.Property.ValueTypes.Datetime.get","type.property.valuetypes.DatetimeOperationAsyncClient.put":"Type.Property.ValueTypes.Datetime.put","type.property.valuetypes.DatetimeOperationAsyncClient.putWithResponse":"Type.Property.ValueTypes.Datetime.put","type.property.valuetypes.DatetimeOperationClient":"Type.Property.ValueTypes.Datetime","type.property.valuetypes.DatetimeOperationClient.get":"Type.Property.ValueTypes.Datetime.get","type.property.valuetypes.DatetimeOperationClient.getWithResponse":"Type.Property.ValueTypes.Datetime.get","type.property.valuetypes.DatetimeOperationClient.put":"Type.Property.ValueTypes.Datetime.put","type.property.valuetypes.DatetimeOperationClient.putWithResponse":"Type.Property.ValueTypes.Datetime.put","type.property.valuetypes.Decimal128AsyncClient":"Type.Property.ValueTypes.Decimal128","type.property.valuetypes.Decimal128AsyncClient.get":"Type.Property.ValueTypes.Decimal128.get","type.property.valuetypes.Decimal128AsyncClient.getWithResponse":"Type.Property.ValueTypes.Decimal128.get","type.property.valuetypes.Decimal128AsyncClient.put":"Type.Property.ValueTypes.Decimal128.put","type.property.valuetypes.Decimal128AsyncClient.putWithResponse":"Type.Property.ValueTypes.Decimal128.put","type.property.valuetypes.Decimal128Client":"Type.Property.ValueTypes.Decimal128","type.property.valuetypes.Decimal128Client.get":"Type.Property.ValueTypes.Decimal128.get","type.property.valuetypes.Decimal128Client.getWithResponse":"Type.Property.ValueTypes.Decimal128.get","type.property.valuetypes.Decimal128Client.put":"Type.Property.ValueTypes.Decimal128.put","type.property.valuetypes.Decimal128Client.putWithResponse":"Type.Property.ValueTypes.Decimal128.put","type.property.valuetypes.DecimalAsyncClient":"Type.Property.ValueTypes.Decimal","type.property.valuetypes.DecimalAsyncClient.get":"Type.Property.ValueTypes.Decimal.get","type.property.valuetypes.DecimalAsyncClient.getWithResponse":"Type.Property.ValueTypes.Decimal.get","type.property.valuetypes.DecimalAsyncClient.put":"Type.Property.ValueTypes.Decimal.put","type.property.valuetypes.DecimalAsyncClient.putWithResponse":"Type.Property.ValueTypes.Decimal.put","type.property.valuetypes.DecimalClient":"Type.Property.ValueTypes.Decimal","type.property.valuetypes.DecimalClient.get":"Type.Property.ValueTypes.Decimal.get","type.property.valuetypes.DecimalClient.getWithResponse":"Type.Property.ValueTypes.Decimal.get","type.property.valuetypes.DecimalClient.put":"Type.Property.ValueTypes.Decimal.put","type.property.valuetypes.DecimalClient.putWithResponse":"Type.Property.ValueTypes.Decimal.put","type.property.valuetypes.DictionaryStringAsyncClient":"Type.Property.ValueTypes.DictionaryString","type.property.valuetypes.DictionaryStringAsyncClient.get":"Type.Property.ValueTypes.DictionaryString.get","type.property.valuetypes.DictionaryStringAsyncClient.getWithResponse":"Type.Property.ValueTypes.DictionaryString.get","type.property.valuetypes.DictionaryStringAsyncClient.put":"Type.Property.ValueTypes.DictionaryString.put","type.property.valuetypes.DictionaryStringAsyncClient.putWithResponse":"Type.Property.ValueTypes.DictionaryString.put","type.property.valuetypes.DictionaryStringClient":"Type.Property.ValueTypes.DictionaryString","type.property.valuetypes.DictionaryStringClient.get":"Type.Property.ValueTypes.DictionaryString.get","type.property.valuetypes.DictionaryStringClient.getWithResponse":"Type.Property.ValueTypes.DictionaryString.get","type.property.valuetypes.DictionaryStringClient.put":"Type.Property.ValueTypes.DictionaryString.put","type.property.valuetypes.DictionaryStringClient.putWithResponse":"Type.Property.ValueTypes.DictionaryString.put","type.property.valuetypes.DurationOperationAsyncClient":"Type.Property.ValueTypes.Duration","type.property.valuetypes.DurationOperationAsyncClient.get":"Type.Property.ValueTypes.Duration.get","type.property.valuetypes.DurationOperationAsyncClient.getWithResponse":"Type.Property.ValueTypes.Duration.get","type.property.valuetypes.DurationOperationAsyncClient.put":"Type.Property.ValueTypes.Duration.put","type.property.valuetypes.DurationOperationAsyncClient.putWithResponse":"Type.Property.ValueTypes.Duration.put","type.property.valuetypes.DurationOperationClient":"Type.Property.ValueTypes.Duration","type.property.valuetypes.DurationOperationClient.get":"Type.Property.ValueTypes.Duration.get","type.property.valuetypes.DurationOperationClient.getWithResponse":"Type.Property.ValueTypes.Duration.get","type.property.valuetypes.DurationOperationClient.put":"Type.Property.ValueTypes.Duration.put","type.property.valuetypes.DurationOperationClient.putWithResponse":"Type.Property.ValueTypes.Duration.put","type.property.valuetypes.EnumAsyncClient":"Type.Property.ValueTypes.Enum","type.property.valuetypes.EnumAsyncClient.get":"Type.Property.ValueTypes.Enum.get","type.property.valuetypes.EnumAsyncClient.getWithResponse":"Type.Property.ValueTypes.Enum.get","type.property.valuetypes.EnumAsyncClient.put":"Type.Property.ValueTypes.Enum.put","type.property.valuetypes.EnumAsyncClient.putWithResponse":"Type.Property.ValueTypes.Enum.put","type.property.valuetypes.EnumClient":"Type.Property.ValueTypes.Enum","type.property.valuetypes.EnumClient.get":"Type.Property.ValueTypes.Enum.get","type.property.valuetypes.EnumClient.getWithResponse":"Type.Property.ValueTypes.Enum.get","type.property.valuetypes.EnumClient.put":"Type.Property.ValueTypes.Enum.put","type.property.valuetypes.EnumClient.putWithResponse":"Type.Property.ValueTypes.Enum.put","type.property.valuetypes.ExtensibleEnumAsyncClient":"Type.Property.ValueTypes.ExtensibleEnum","type.property.valuetypes.ExtensibleEnumAsyncClient.get":"Type.Property.ValueTypes.ExtensibleEnum.get","type.property.valuetypes.ExtensibleEnumAsyncClient.getWithResponse":"Type.Property.ValueTypes.ExtensibleEnum.get","type.property.valuetypes.ExtensibleEnumAsyncClient.put":"Type.Property.ValueTypes.ExtensibleEnum.put","type.property.valuetypes.ExtensibleEnumAsyncClient.putWithResponse":"Type.Property.ValueTypes.ExtensibleEnum.put","type.property.valuetypes.ExtensibleEnumClient":"Type.Property.ValueTypes.ExtensibleEnum","type.property.valuetypes.ExtensibleEnumClient.get":"Type.Property.ValueTypes.ExtensibleEnum.get","type.property.valuetypes.ExtensibleEnumClient.getWithResponse":"Type.Property.ValueTypes.ExtensibleEnum.get","type.property.valuetypes.ExtensibleEnumClient.put":"Type.Property.ValueTypes.ExtensibleEnum.put","type.property.valuetypes.ExtensibleEnumClient.putWithResponse":"Type.Property.ValueTypes.ExtensibleEnum.put","type.property.valuetypes.FloatLiteralAsyncClient":"Type.Property.ValueTypes.FloatLiteral","type.property.valuetypes.FloatLiteralAsyncClient.get":"Type.Property.ValueTypes.FloatLiteral.get","type.property.valuetypes.FloatLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.FloatLiteral.get","type.property.valuetypes.FloatLiteralAsyncClient.put":"Type.Property.ValueTypes.FloatLiteral.put","type.property.valuetypes.FloatLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.FloatLiteral.put","type.property.valuetypes.FloatLiteralClient":"Type.Property.ValueTypes.FloatLiteral","type.property.valuetypes.FloatLiteralClient.get":"Type.Property.ValueTypes.FloatLiteral.get","type.property.valuetypes.FloatLiteralClient.getWithResponse":"Type.Property.ValueTypes.FloatLiteral.get","type.property.valuetypes.FloatLiteralClient.put":"Type.Property.ValueTypes.FloatLiteral.put","type.property.valuetypes.FloatLiteralClient.putWithResponse":"Type.Property.ValueTypes.FloatLiteral.put","type.property.valuetypes.FloatOperationAsyncClient":"Type.Property.ValueTypes.Float","type.property.valuetypes.FloatOperationAsyncClient.get":"Type.Property.ValueTypes.Float.get","type.property.valuetypes.FloatOperationAsyncClient.getWithResponse":"Type.Property.ValueTypes.Float.get","type.property.valuetypes.FloatOperationAsyncClient.put":"Type.Property.ValueTypes.Float.put","type.property.valuetypes.FloatOperationAsyncClient.putWithResponse":"Type.Property.ValueTypes.Float.put","type.property.valuetypes.FloatOperationClient":"Type.Property.ValueTypes.Float","type.property.valuetypes.FloatOperationClient.get":"Type.Property.ValueTypes.Float.get","type.property.valuetypes.FloatOperationClient.getWithResponse":"Type.Property.ValueTypes.Float.get","type.property.valuetypes.FloatOperationClient.put":"Type.Property.ValueTypes.Float.put","type.property.valuetypes.FloatOperationClient.putWithResponse":"Type.Property.ValueTypes.Float.put","type.property.valuetypes.IntAsyncClient":"Type.Property.ValueTypes.Int","type.property.valuetypes.IntAsyncClient.get":"Type.Property.ValueTypes.Int.get","type.property.valuetypes.IntAsyncClient.getWithResponse":"Type.Property.ValueTypes.Int.get","type.property.valuetypes.IntAsyncClient.put":"Type.Property.ValueTypes.Int.put","type.property.valuetypes.IntAsyncClient.putWithResponse":"Type.Property.ValueTypes.Int.put","type.property.valuetypes.IntClient":"Type.Property.ValueTypes.Int","type.property.valuetypes.IntClient.get":"Type.Property.ValueTypes.Int.get","type.property.valuetypes.IntClient.getWithResponse":"Type.Property.ValueTypes.Int.get","type.property.valuetypes.IntClient.put":"Type.Property.ValueTypes.Int.put","type.property.valuetypes.IntClient.putWithResponse":"Type.Property.ValueTypes.Int.put","type.property.valuetypes.IntLiteralAsyncClient":"Type.Property.ValueTypes.IntLiteral","type.property.valuetypes.IntLiteralAsyncClient.get":"Type.Property.ValueTypes.IntLiteral.get","type.property.valuetypes.IntLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.IntLiteral.get","type.property.valuetypes.IntLiteralAsyncClient.put":"Type.Property.ValueTypes.IntLiteral.put","type.property.valuetypes.IntLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.IntLiteral.put","type.property.valuetypes.IntLiteralClient":"Type.Property.ValueTypes.IntLiteral","type.property.valuetypes.IntLiteralClient.get":"Type.Property.ValueTypes.IntLiteral.get","type.property.valuetypes.IntLiteralClient.getWithResponse":"Type.Property.ValueTypes.IntLiteral.get","type.property.valuetypes.IntLiteralClient.put":"Type.Property.ValueTypes.IntLiteral.put","type.property.valuetypes.IntLiteralClient.putWithResponse":"Type.Property.ValueTypes.IntLiteral.put","type.property.valuetypes.ModelAsyncClient":"Type.Property.ValueTypes.Model","type.property.valuetypes.ModelAsyncClient.get":"Type.Property.ValueTypes.Model.get","type.property.valuetypes.ModelAsyncClient.getWithResponse":"Type.Property.ValueTypes.Model.get","type.property.valuetypes.ModelAsyncClient.put":"Type.Property.ValueTypes.Model.put","type.property.valuetypes.ModelAsyncClient.putWithResponse":"Type.Property.ValueTypes.Model.put","type.property.valuetypes.ModelClient":"Type.Property.ValueTypes.Model","type.property.valuetypes.ModelClient.get":"Type.Property.ValueTypes.Model.get","type.property.valuetypes.ModelClient.getWithResponse":"Type.Property.ValueTypes.Model.get","type.property.valuetypes.ModelClient.put":"Type.Property.ValueTypes.Model.put","type.property.valuetypes.ModelClient.putWithResponse":"Type.Property.ValueTypes.Model.put","type.property.valuetypes.NeverAsyncClient":"Type.Property.ValueTypes.Never","type.property.valuetypes.NeverAsyncClient.get":"Type.Property.ValueTypes.Never.get","type.property.valuetypes.NeverAsyncClient.getWithResponse":"Type.Property.ValueTypes.Never.get","type.property.valuetypes.NeverAsyncClient.put":"Type.Property.ValueTypes.Never.put","type.property.valuetypes.NeverAsyncClient.putWithResponse":"Type.Property.ValueTypes.Never.put","type.property.valuetypes.NeverClient":"Type.Property.ValueTypes.Never","type.property.valuetypes.NeverClient.get":"Type.Property.ValueTypes.Never.get","type.property.valuetypes.NeverClient.getWithResponse":"Type.Property.ValueTypes.Never.get","type.property.valuetypes.NeverClient.put":"Type.Property.ValueTypes.Never.put","type.property.valuetypes.NeverClient.putWithResponse":"Type.Property.ValueTypes.Never.put","type.property.valuetypes.StringLiteralAsyncClient":"Type.Property.ValueTypes.StringLiteral","type.property.valuetypes.StringLiteralAsyncClient.get":"Type.Property.ValueTypes.StringLiteral.get","type.property.valuetypes.StringLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.StringLiteral.get","type.property.valuetypes.StringLiteralAsyncClient.put":"Type.Property.ValueTypes.StringLiteral.put","type.property.valuetypes.StringLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.StringLiteral.put","type.property.valuetypes.StringLiteralClient":"Type.Property.ValueTypes.StringLiteral","type.property.valuetypes.StringLiteralClient.get":"Type.Property.ValueTypes.StringLiteral.get","type.property.valuetypes.StringLiteralClient.getWithResponse":"Type.Property.ValueTypes.StringLiteral.get","type.property.valuetypes.StringLiteralClient.put":"Type.Property.ValueTypes.StringLiteral.put","type.property.valuetypes.StringLiteralClient.putWithResponse":"Type.Property.ValueTypes.StringLiteral.put","type.property.valuetypes.StringOperationAsyncClient":"Type.Property.ValueTypes.String","type.property.valuetypes.StringOperationAsyncClient.get":"Type.Property.ValueTypes.String.get","type.property.valuetypes.StringOperationAsyncClient.getWithResponse":"Type.Property.ValueTypes.String.get","type.property.valuetypes.StringOperationAsyncClient.put":"Type.Property.ValueTypes.String.put","type.property.valuetypes.StringOperationAsyncClient.putWithResponse":"Type.Property.ValueTypes.String.put","type.property.valuetypes.StringOperationClient":"Type.Property.ValueTypes.String","type.property.valuetypes.StringOperationClient.get":"Type.Property.ValueTypes.String.get","type.property.valuetypes.StringOperationClient.getWithResponse":"Type.Property.ValueTypes.String.get","type.property.valuetypes.StringOperationClient.put":"Type.Property.ValueTypes.String.put","type.property.valuetypes.StringOperationClient.putWithResponse":"Type.Property.ValueTypes.String.put","type.property.valuetypes.UnionEnumValueAsyncClient":"Type.Property.ValueTypes.UnionEnumValue","type.property.valuetypes.UnionEnumValueAsyncClient.get":"Type.Property.ValueTypes.UnionEnumValue.get","type.property.valuetypes.UnionEnumValueAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnionEnumValue.get","type.property.valuetypes.UnionEnumValueAsyncClient.put":"Type.Property.ValueTypes.UnionEnumValue.put","type.property.valuetypes.UnionEnumValueAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnionEnumValue.put","type.property.valuetypes.UnionEnumValueClient":"Type.Property.ValueTypes.UnionEnumValue","type.property.valuetypes.UnionEnumValueClient.get":"Type.Property.ValueTypes.UnionEnumValue.get","type.property.valuetypes.UnionEnumValueClient.getWithResponse":"Type.Property.ValueTypes.UnionEnumValue.get","type.property.valuetypes.UnionEnumValueClient.put":"Type.Property.ValueTypes.UnionEnumValue.put","type.property.valuetypes.UnionEnumValueClient.putWithResponse":"Type.Property.ValueTypes.UnionEnumValue.put","type.property.valuetypes.UnionFloatLiteralAsyncClient":"Type.Property.ValueTypes.UnionFloatLiteral","type.property.valuetypes.UnionFloatLiteralAsyncClient.get":"Type.Property.ValueTypes.UnionFloatLiteral.get","type.property.valuetypes.UnionFloatLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnionFloatLiteral.get","type.property.valuetypes.UnionFloatLiteralAsyncClient.put":"Type.Property.ValueTypes.UnionFloatLiteral.put","type.property.valuetypes.UnionFloatLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnionFloatLiteral.put","type.property.valuetypes.UnionFloatLiteralClient":"Type.Property.ValueTypes.UnionFloatLiteral","type.property.valuetypes.UnionFloatLiteralClient.get":"Type.Property.ValueTypes.UnionFloatLiteral.get","type.property.valuetypes.UnionFloatLiteralClient.getWithResponse":"Type.Property.ValueTypes.UnionFloatLiteral.get","type.property.valuetypes.UnionFloatLiteralClient.put":"Type.Property.ValueTypes.UnionFloatLiteral.put","type.property.valuetypes.UnionFloatLiteralClient.putWithResponse":"Type.Property.ValueTypes.UnionFloatLiteral.put","type.property.valuetypes.UnionIntLiteralAsyncClient":"Type.Property.ValueTypes.UnionIntLiteral","type.property.valuetypes.UnionIntLiteralAsyncClient.get":"Type.Property.ValueTypes.UnionIntLiteral.get","type.property.valuetypes.UnionIntLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnionIntLiteral.get","type.property.valuetypes.UnionIntLiteralAsyncClient.put":"Type.Property.ValueTypes.UnionIntLiteral.put","type.property.valuetypes.UnionIntLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnionIntLiteral.put","type.property.valuetypes.UnionIntLiteralClient":"Type.Property.ValueTypes.UnionIntLiteral","type.property.valuetypes.UnionIntLiteralClient.get":"Type.Property.ValueTypes.UnionIntLiteral.get","type.property.valuetypes.UnionIntLiteralClient.getWithResponse":"Type.Property.ValueTypes.UnionIntLiteral.get","type.property.valuetypes.UnionIntLiteralClient.put":"Type.Property.ValueTypes.UnionIntLiteral.put","type.property.valuetypes.UnionIntLiteralClient.putWithResponse":"Type.Property.ValueTypes.UnionIntLiteral.put","type.property.valuetypes.UnionStringLiteralAsyncClient":"Type.Property.ValueTypes.UnionStringLiteral","type.property.valuetypes.UnionStringLiteralAsyncClient.get":"Type.Property.ValueTypes.UnionStringLiteral.get","type.property.valuetypes.UnionStringLiteralAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnionStringLiteral.get","type.property.valuetypes.UnionStringLiteralAsyncClient.put":"Type.Property.ValueTypes.UnionStringLiteral.put","type.property.valuetypes.UnionStringLiteralAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnionStringLiteral.put","type.property.valuetypes.UnionStringLiteralClient":"Type.Property.ValueTypes.UnionStringLiteral","type.property.valuetypes.UnionStringLiteralClient.get":"Type.Property.ValueTypes.UnionStringLiteral.get","type.property.valuetypes.UnionStringLiteralClient.getWithResponse":"Type.Property.ValueTypes.UnionStringLiteral.get","type.property.valuetypes.UnionStringLiteralClient.put":"Type.Property.ValueTypes.UnionStringLiteral.put","type.property.valuetypes.UnionStringLiteralClient.putWithResponse":"Type.Property.ValueTypes.UnionStringLiteral.put","type.property.valuetypes.UnknownArrayAsyncClient":"Type.Property.ValueTypes.UnknownArray","type.property.valuetypes.UnknownArrayAsyncClient.get":"Type.Property.ValueTypes.UnknownArray.get","type.property.valuetypes.UnknownArrayAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnknownArray.get","type.property.valuetypes.UnknownArrayAsyncClient.put":"Type.Property.ValueTypes.UnknownArray.put","type.property.valuetypes.UnknownArrayAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnknownArray.put","type.property.valuetypes.UnknownArrayClient":"Type.Property.ValueTypes.UnknownArray","type.property.valuetypes.UnknownArrayClient.get":"Type.Property.ValueTypes.UnknownArray.get","type.property.valuetypes.UnknownArrayClient.getWithResponse":"Type.Property.ValueTypes.UnknownArray.get","type.property.valuetypes.UnknownArrayClient.put":"Type.Property.ValueTypes.UnknownArray.put","type.property.valuetypes.UnknownArrayClient.putWithResponse":"Type.Property.ValueTypes.UnknownArray.put","type.property.valuetypes.UnknownDictAsyncClient":"Type.Property.ValueTypes.UnknownDict","type.property.valuetypes.UnknownDictAsyncClient.get":"Type.Property.ValueTypes.UnknownDict.get","type.property.valuetypes.UnknownDictAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnknownDict.get","type.property.valuetypes.UnknownDictAsyncClient.put":"Type.Property.ValueTypes.UnknownDict.put","type.property.valuetypes.UnknownDictAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnknownDict.put","type.property.valuetypes.UnknownDictClient":"Type.Property.ValueTypes.UnknownDict","type.property.valuetypes.UnknownDictClient.get":"Type.Property.ValueTypes.UnknownDict.get","type.property.valuetypes.UnknownDictClient.getWithResponse":"Type.Property.ValueTypes.UnknownDict.get","type.property.valuetypes.UnknownDictClient.put":"Type.Property.ValueTypes.UnknownDict.put","type.property.valuetypes.UnknownDictClient.putWithResponse":"Type.Property.ValueTypes.UnknownDict.put","type.property.valuetypes.UnknownIntAsyncClient":"Type.Property.ValueTypes.UnknownInt","type.property.valuetypes.UnknownIntAsyncClient.get":"Type.Property.ValueTypes.UnknownInt.get","type.property.valuetypes.UnknownIntAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnknownInt.get","type.property.valuetypes.UnknownIntAsyncClient.put":"Type.Property.ValueTypes.UnknownInt.put","type.property.valuetypes.UnknownIntAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnknownInt.put","type.property.valuetypes.UnknownIntClient":"Type.Property.ValueTypes.UnknownInt","type.property.valuetypes.UnknownIntClient.get":"Type.Property.ValueTypes.UnknownInt.get","type.property.valuetypes.UnknownIntClient.getWithResponse":"Type.Property.ValueTypes.UnknownInt.get","type.property.valuetypes.UnknownIntClient.put":"Type.Property.ValueTypes.UnknownInt.put","type.property.valuetypes.UnknownIntClient.putWithResponse":"Type.Property.ValueTypes.UnknownInt.put","type.property.valuetypes.UnknownStringAsyncClient":"Type.Property.ValueTypes.UnknownString","type.property.valuetypes.UnknownStringAsyncClient.get":"Type.Property.ValueTypes.UnknownString.get","type.property.valuetypes.UnknownStringAsyncClient.getWithResponse":"Type.Property.ValueTypes.UnknownString.get","type.property.valuetypes.UnknownStringAsyncClient.put":"Type.Property.ValueTypes.UnknownString.put","type.property.valuetypes.UnknownStringAsyncClient.putWithResponse":"Type.Property.ValueTypes.UnknownString.put","type.property.valuetypes.UnknownStringClient":"Type.Property.ValueTypes.UnknownString","type.property.valuetypes.UnknownStringClient.get":"Type.Property.ValueTypes.UnknownString.get","type.property.valuetypes.UnknownStringClient.getWithResponse":"Type.Property.ValueTypes.UnknownString.get","type.property.valuetypes.UnknownStringClient.put":"Type.Property.ValueTypes.UnknownString.put","type.property.valuetypes.UnknownStringClient.putWithResponse":"Type.Property.ValueTypes.UnknownString.put","type.property.valuetypes.ValueTypesClientBuilder":"Type.Property.ValueTypes","type.property.valuetypes.models.BooleanLiteralProperty":"Type.Property.ValueTypes.BooleanLiteralProperty","type.property.valuetypes.models.BooleanProperty":"Type.Property.ValueTypes.BooleanProperty","type.property.valuetypes.models.BytesProperty":"Type.Property.ValueTypes.BytesProperty","type.property.valuetypes.models.CollectionsIntProperty":"Type.Property.ValueTypes.CollectionsIntProperty","type.property.valuetypes.models.CollectionsModelProperty":"Type.Property.ValueTypes.CollectionsModelProperty","type.property.valuetypes.models.CollectionsStringProperty":"Type.Property.ValueTypes.CollectionsStringProperty","type.property.valuetypes.models.DatetimeProperty":"Type.Property.ValueTypes.DatetimeProperty","type.property.valuetypes.models.Decimal128Property":"Type.Property.ValueTypes.Decimal128Property","type.property.valuetypes.models.DecimalProperty":"Type.Property.ValueTypes.DecimalProperty","type.property.valuetypes.models.DictionaryStringProperty":"Type.Property.ValueTypes.DictionaryStringProperty","type.property.valuetypes.models.DurationProperty":"Type.Property.ValueTypes.DurationProperty","type.property.valuetypes.models.EnumProperty":"Type.Property.ValueTypes.EnumProperty","type.property.valuetypes.models.ExtendedEnum":"Type.Property.ValueTypes.ExtendedEnum","type.property.valuetypes.models.ExtensibleEnumProperty":"Type.Property.ValueTypes.ExtensibleEnumProperty","type.property.valuetypes.models.FixedInnerEnum":"Type.Property.ValueTypes.FixedInnerEnum","type.property.valuetypes.models.FloatLiteralProperty":"Type.Property.ValueTypes.FloatLiteralProperty","type.property.valuetypes.models.FloatProperty":"Type.Property.ValueTypes.FloatProperty","type.property.valuetypes.models.InnerEnum":"Type.Property.ValueTypes.InnerEnum","type.property.valuetypes.models.InnerModel":"Type.Property.ValueTypes.InnerModel","type.property.valuetypes.models.IntLiteralProperty":"Type.Property.ValueTypes.IntLiteralProperty","type.property.valuetypes.models.IntProperty":"Type.Property.ValueTypes.IntProperty","type.property.valuetypes.models.ModelProperty":"Type.Property.ValueTypes.ModelProperty","type.property.valuetypes.models.NeverProperty":"Type.Property.ValueTypes.NeverProperty","type.property.valuetypes.models.StringLiteralProperty":"Type.Property.ValueTypes.StringLiteralProperty","type.property.valuetypes.models.StringProperty":"Type.Property.ValueTypes.StringProperty","type.property.valuetypes.models.UnionEnumValueProperty":"Type.Property.ValueTypes.UnionEnumValueProperty","type.property.valuetypes.models.UnionFloatLiteralProperty":"Type.Property.ValueTypes.UnionFloatLiteralProperty","type.property.valuetypes.models.UnionFloatLiteralPropertyProperty":"Type.Property.ValueTypes.UnionFloatLiteralProperty.property.anonymous","type.property.valuetypes.models.UnionIntLiteralProperty":"Type.Property.ValueTypes.UnionIntLiteralProperty","type.property.valuetypes.models.UnionIntLiteralPropertyProperty":"Type.Property.ValueTypes.UnionIntLiteralProperty.property.anonymous","type.property.valuetypes.models.UnionStringLiteralProperty":"Type.Property.ValueTypes.UnionStringLiteralProperty","type.property.valuetypes.models.UnionStringLiteralPropertyProperty":"Type.Property.ValueTypes.UnionStringLiteralProperty.property.anonymous","type.property.valuetypes.models.UnknownArrayProperty":"Type.Property.ValueTypes.UnknownArrayProperty","type.property.valuetypes.models.UnknownDictProperty":"Type.Property.ValueTypes.UnknownDictProperty","type.property.valuetypes.models.UnknownIntProperty":"Type.Property.ValueTypes.UnknownIntProperty","type.property.valuetypes.models.UnknownStringProperty":"Type.Property.ValueTypes.UnknownStringProperty"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/property/valuetypes/BooleanLiteralAsyncClient.java","src/main/java/type/property/valuetypes/BooleanLiteralClient.java","src/main/java/type/property/valuetypes/BooleanOperationAsyncClient.java","src/main/java/type/property/valuetypes/BooleanOperationClient.java","src/main/java/type/property/valuetypes/BytesAsyncClient.java","src/main/java/type/property/valuetypes/BytesClient.java","src/main/java/type/property/valuetypes/CollectionsIntAsyncClient.java","src/main/java/type/property/valuetypes/CollectionsIntClient.java","src/main/java/type/property/valuetypes/CollectionsModelAsyncClient.java","src/main/java/type/property/valuetypes/CollectionsModelClient.java","src/main/java/type/property/valuetypes/CollectionsStringAsyncClient.java","src/main/java/type/property/valuetypes/CollectionsStringClient.java","src/main/java/type/property/valuetypes/DatetimeOperationAsyncClient.java","src/main/java/type/property/valuetypes/DatetimeOperationClient.java","src/main/java/type/property/valuetypes/Decimal128AsyncClient.java","src/main/java/type/property/valuetypes/Decimal128Client.java","src/main/java/type/property/valuetypes/DecimalAsyncClient.java","src/main/java/type/property/valuetypes/DecimalClient.java","src/main/java/type/property/valuetypes/DictionaryStringAsyncClient.java","src/main/java/type/property/valuetypes/DictionaryStringClient.java","src/main/java/type/property/valuetypes/DurationOperationAsyncClient.java","src/main/java/type/property/valuetypes/DurationOperationClient.java","src/main/java/type/property/valuetypes/EnumAsyncClient.java","src/main/java/type/property/valuetypes/EnumClient.java","src/main/java/type/property/valuetypes/ExtensibleEnumAsyncClient.java","src/main/java/type/property/valuetypes/ExtensibleEnumClient.java","src/main/java/type/property/valuetypes/FloatLiteralAsyncClient.java","src/main/java/type/property/valuetypes/FloatLiteralClient.java","src/main/java/type/property/valuetypes/FloatOperationAsyncClient.java","src/main/java/type/property/valuetypes/FloatOperationClient.java","src/main/java/type/property/valuetypes/IntAsyncClient.java","src/main/java/type/property/valuetypes/IntClient.java","src/main/java/type/property/valuetypes/IntLiteralAsyncClient.java","src/main/java/type/property/valuetypes/IntLiteralClient.java","src/main/java/type/property/valuetypes/ModelAsyncClient.java","src/main/java/type/property/valuetypes/ModelClient.java","src/main/java/type/property/valuetypes/NeverAsyncClient.java","src/main/java/type/property/valuetypes/NeverClient.java","src/main/java/type/property/valuetypes/StringLiteralAsyncClient.java","src/main/java/type/property/valuetypes/StringLiteralClient.java","src/main/java/type/property/valuetypes/StringOperationAsyncClient.java","src/main/java/type/property/valuetypes/StringOperationClient.java","src/main/java/type/property/valuetypes/UnionEnumValueAsyncClient.java","src/main/java/type/property/valuetypes/UnionEnumValueClient.java","src/main/java/type/property/valuetypes/UnionFloatLiteralAsyncClient.java","src/main/java/type/property/valuetypes/UnionFloatLiteralClient.java","src/main/java/type/property/valuetypes/UnionIntLiteralAsyncClient.java","src/main/java/type/property/valuetypes/UnionIntLiteralClient.java","src/main/java/type/property/valuetypes/UnionStringLiteralAsyncClient.java","src/main/java/type/property/valuetypes/UnionStringLiteralClient.java","src/main/java/type/property/valuetypes/UnknownArrayAsyncClient.java","src/main/java/type/property/valuetypes/UnknownArrayClient.java","src/main/java/type/property/valuetypes/UnknownDictAsyncClient.java","src/main/java/type/property/valuetypes/UnknownDictClient.java","src/main/java/type/property/valuetypes/UnknownIntAsyncClient.java","src/main/java/type/property/valuetypes/UnknownIntClient.java","src/main/java/type/property/valuetypes/UnknownStringAsyncClient.java","src/main/java/type/property/valuetypes/UnknownStringClient.java","src/main/java/type/property/valuetypes/ValueTypesClientBuilder.java","src/main/java/type/property/valuetypes/implementation/BooleanLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/BooleanOperationsImpl.java","src/main/java/type/property/valuetypes/implementation/BytesImpl.java","src/main/java/type/property/valuetypes/implementation/CollectionsIntsImpl.java","src/main/java/type/property/valuetypes/implementation/CollectionsModelsImpl.java","src/main/java/type/property/valuetypes/implementation/CollectionsStringsImpl.java","src/main/java/type/property/valuetypes/implementation/DatetimeOperationsImpl.java","src/main/java/type/property/valuetypes/implementation/Decimal128sImpl.java","src/main/java/type/property/valuetypes/implementation/DecimalsImpl.java","src/main/java/type/property/valuetypes/implementation/DictionaryStringsImpl.java","src/main/java/type/property/valuetypes/implementation/DurationOperationsImpl.java","src/main/java/type/property/valuetypes/implementation/EnumsImpl.java","src/main/java/type/property/valuetypes/implementation/ExtensibleEnumsImpl.java","src/main/java/type/property/valuetypes/implementation/FloatLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/FloatOperationsImpl.java","src/main/java/type/property/valuetypes/implementation/IntLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/IntsImpl.java","src/main/java/type/property/valuetypes/implementation/ModelsImpl.java","src/main/java/type/property/valuetypes/implementation/NeversImpl.java","src/main/java/type/property/valuetypes/implementation/StringLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/StringOperationsImpl.java","src/main/java/type/property/valuetypes/implementation/UnionEnumValuesImpl.java","src/main/java/type/property/valuetypes/implementation/UnionFloatLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/UnionIntLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/UnionStringLiteralsImpl.java","src/main/java/type/property/valuetypes/implementation/UnknownArraysImpl.java","src/main/java/type/property/valuetypes/implementation/UnknownDictsImpl.java","src/main/java/type/property/valuetypes/implementation/UnknownIntsImpl.java","src/main/java/type/property/valuetypes/implementation/UnknownStringsImpl.java","src/main/java/type/property/valuetypes/implementation/ValueTypesClientImpl.java","src/main/java/type/property/valuetypes/implementation/package-info.java","src/main/java/type/property/valuetypes/models/BooleanLiteralProperty.java","src/main/java/type/property/valuetypes/models/BooleanProperty.java","src/main/java/type/property/valuetypes/models/BytesProperty.java","src/main/java/type/property/valuetypes/models/CollectionsIntProperty.java","src/main/java/type/property/valuetypes/models/CollectionsModelProperty.java","src/main/java/type/property/valuetypes/models/CollectionsStringProperty.java","src/main/java/type/property/valuetypes/models/DatetimeProperty.java","src/main/java/type/property/valuetypes/models/Decimal128Property.java","src/main/java/type/property/valuetypes/models/DecimalProperty.java","src/main/java/type/property/valuetypes/models/DictionaryStringProperty.java","src/main/java/type/property/valuetypes/models/DurationProperty.java","src/main/java/type/property/valuetypes/models/EnumProperty.java","src/main/java/type/property/valuetypes/models/ExtendedEnum.java","src/main/java/type/property/valuetypes/models/ExtensibleEnumProperty.java","src/main/java/type/property/valuetypes/models/FixedInnerEnum.java","src/main/java/type/property/valuetypes/models/FloatLiteralProperty.java","src/main/java/type/property/valuetypes/models/FloatProperty.java","src/main/java/type/property/valuetypes/models/InnerEnum.java","src/main/java/type/property/valuetypes/models/InnerModel.java","src/main/java/type/property/valuetypes/models/IntLiteralProperty.java","src/main/java/type/property/valuetypes/models/IntProperty.java","src/main/java/type/property/valuetypes/models/ModelProperty.java","src/main/java/type/property/valuetypes/models/NeverProperty.java","src/main/java/type/property/valuetypes/models/StringLiteralProperty.java","src/main/java/type/property/valuetypes/models/StringProperty.java","src/main/java/type/property/valuetypes/models/UnionEnumValueProperty.java","src/main/java/type/property/valuetypes/models/UnionFloatLiteralProperty.java","src/main/java/type/property/valuetypes/models/UnionFloatLiteralPropertyProperty.java","src/main/java/type/property/valuetypes/models/UnionIntLiteralProperty.java","src/main/java/type/property/valuetypes/models/UnionIntLiteralPropertyProperty.java","src/main/java/type/property/valuetypes/models/UnionStringLiteralProperty.java","src/main/java/type/property/valuetypes/models/UnionStringLiteralPropertyProperty.java","src/main/java/type/property/valuetypes/models/UnknownArrayProperty.java","src/main/java/type/property/valuetypes/models/UnknownDictProperty.java","src/main/java/type/property/valuetypes/models/UnknownIntProperty.java","src/main/java/type/property/valuetypes/models/UnknownStringProperty.java","src/main/java/type/property/valuetypes/models/package-info.java","src/main/java/type/property/valuetypes/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_apiview_properties.json new file mode 100644 index 00000000000..bc0e915353d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_apiview_properties.json @@ -0,0 +1,84 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.scalar.BooleanOperationAsyncClient": "Type.Scalar.Boolean", + "type.scalar.BooleanOperationAsyncClient.get": "Type.Scalar.Boolean.get", + "type.scalar.BooleanOperationAsyncClient.getWithResponse": "Type.Scalar.Boolean.get", + "type.scalar.BooleanOperationAsyncClient.put": "Type.Scalar.Boolean.put", + "type.scalar.BooleanOperationAsyncClient.putWithResponse": "Type.Scalar.Boolean.put", + "type.scalar.BooleanOperationClient": "Type.Scalar.Boolean", + "type.scalar.BooleanOperationClient.get": "Type.Scalar.Boolean.get", + "type.scalar.BooleanOperationClient.getWithResponse": "Type.Scalar.Boolean.get", + "type.scalar.BooleanOperationClient.put": "Type.Scalar.Boolean.put", + "type.scalar.BooleanOperationClient.putWithResponse": "Type.Scalar.Boolean.put", + "type.scalar.Decimal128TypeAsyncClient": "Type.Scalar.Decimal128Type", + "type.scalar.Decimal128TypeAsyncClient.requestBody": "Type.Scalar.Decimal128Type.requestBody", + "type.scalar.Decimal128TypeAsyncClient.requestBodyWithResponse": "Type.Scalar.Decimal128Type.requestBody", + "type.scalar.Decimal128TypeAsyncClient.requestParameter": "Type.Scalar.Decimal128Type.requestParameter", + "type.scalar.Decimal128TypeAsyncClient.requestParameterWithResponse": "Type.Scalar.Decimal128Type.requestParameter", + "type.scalar.Decimal128TypeAsyncClient.responseBody": "Type.Scalar.Decimal128Type.responseBody", + "type.scalar.Decimal128TypeAsyncClient.responseBodyWithResponse": "Type.Scalar.Decimal128Type.responseBody", + "type.scalar.Decimal128TypeClient": "Type.Scalar.Decimal128Type", + "type.scalar.Decimal128TypeClient.requestBody": "Type.Scalar.Decimal128Type.requestBody", + "type.scalar.Decimal128TypeClient.requestBodyWithResponse": "Type.Scalar.Decimal128Type.requestBody", + "type.scalar.Decimal128TypeClient.requestParameter": "Type.Scalar.Decimal128Type.requestParameter", + "type.scalar.Decimal128TypeClient.requestParameterWithResponse": "Type.Scalar.Decimal128Type.requestParameter", + "type.scalar.Decimal128TypeClient.responseBody": "Type.Scalar.Decimal128Type.responseBody", + "type.scalar.Decimal128TypeClient.responseBodyWithResponse": "Type.Scalar.Decimal128Type.responseBody", + "type.scalar.Decimal128VerifyAsyncClient": "Type.Scalar.Decimal128Verify", + "type.scalar.Decimal128VerifyAsyncClient.prepareVerify": "Type.Scalar.Decimal128Verify.prepareVerify", + "type.scalar.Decimal128VerifyAsyncClient.prepareVerifyWithResponse": "Type.Scalar.Decimal128Verify.prepareVerify", + "type.scalar.Decimal128VerifyAsyncClient.verify": "Type.Scalar.Decimal128Verify.verify", + "type.scalar.Decimal128VerifyAsyncClient.verifyWithResponse": "Type.Scalar.Decimal128Verify.verify", + "type.scalar.Decimal128VerifyClient": "Type.Scalar.Decimal128Verify", + "type.scalar.Decimal128VerifyClient.prepareVerify": "Type.Scalar.Decimal128Verify.prepareVerify", + "type.scalar.Decimal128VerifyClient.prepareVerifyWithResponse": "Type.Scalar.Decimal128Verify.prepareVerify", + "type.scalar.Decimal128VerifyClient.verify": "Type.Scalar.Decimal128Verify.verify", + "type.scalar.Decimal128VerifyClient.verifyWithResponse": "Type.Scalar.Decimal128Verify.verify", + "type.scalar.DecimalTypeAsyncClient": "Type.Scalar.DecimalType", + "type.scalar.DecimalTypeAsyncClient.requestBody": "Type.Scalar.DecimalType.requestBody", + "type.scalar.DecimalTypeAsyncClient.requestBodyWithResponse": "Type.Scalar.DecimalType.requestBody", + "type.scalar.DecimalTypeAsyncClient.requestParameter": "Type.Scalar.DecimalType.requestParameter", + "type.scalar.DecimalTypeAsyncClient.requestParameterWithResponse": "Type.Scalar.DecimalType.requestParameter", + "type.scalar.DecimalTypeAsyncClient.responseBody": "Type.Scalar.DecimalType.responseBody", + "type.scalar.DecimalTypeAsyncClient.responseBodyWithResponse": "Type.Scalar.DecimalType.responseBody", + "type.scalar.DecimalTypeClient": "Type.Scalar.DecimalType", + "type.scalar.DecimalTypeClient.requestBody": "Type.Scalar.DecimalType.requestBody", + "type.scalar.DecimalTypeClient.requestBodyWithResponse": "Type.Scalar.DecimalType.requestBody", + "type.scalar.DecimalTypeClient.requestParameter": "Type.Scalar.DecimalType.requestParameter", + "type.scalar.DecimalTypeClient.requestParameterWithResponse": "Type.Scalar.DecimalType.requestParameter", + "type.scalar.DecimalTypeClient.responseBody": "Type.Scalar.DecimalType.responseBody", + "type.scalar.DecimalTypeClient.responseBodyWithResponse": "Type.Scalar.DecimalType.responseBody", + "type.scalar.DecimalVerifyAsyncClient": "Type.Scalar.DecimalVerify", + "type.scalar.DecimalVerifyAsyncClient.prepareVerify": "Type.Scalar.DecimalVerify.prepareVerify", + "type.scalar.DecimalVerifyAsyncClient.prepareVerifyWithResponse": "Type.Scalar.DecimalVerify.prepareVerify", + "type.scalar.DecimalVerifyAsyncClient.verify": "Type.Scalar.DecimalVerify.verify", + "type.scalar.DecimalVerifyAsyncClient.verifyWithResponse": "Type.Scalar.DecimalVerify.verify", + "type.scalar.DecimalVerifyClient": "Type.Scalar.DecimalVerify", + "type.scalar.DecimalVerifyClient.prepareVerify": "Type.Scalar.DecimalVerify.prepareVerify", + "type.scalar.DecimalVerifyClient.prepareVerifyWithResponse": "Type.Scalar.DecimalVerify.prepareVerify", + "type.scalar.DecimalVerifyClient.verify": "Type.Scalar.DecimalVerify.verify", + "type.scalar.DecimalVerifyClient.verifyWithResponse": "Type.Scalar.DecimalVerify.verify", + "type.scalar.ScalarClientBuilder": "Type.Scalar", + "type.scalar.StringOperationAsyncClient": "Type.Scalar.String", + "type.scalar.StringOperationAsyncClient.get": "Type.Scalar.String.get", + "type.scalar.StringOperationAsyncClient.getWithResponse": "Type.Scalar.String.get", + "type.scalar.StringOperationAsyncClient.put": "Type.Scalar.String.put", + "type.scalar.StringOperationAsyncClient.putWithResponse": "Type.Scalar.String.put", + "type.scalar.StringOperationClient": "Type.Scalar.String", + "type.scalar.StringOperationClient.get": "Type.Scalar.String.get", + "type.scalar.StringOperationClient.getWithResponse": "Type.Scalar.String.get", + "type.scalar.StringOperationClient.put": "Type.Scalar.String.put", + "type.scalar.StringOperationClient.putWithResponse": "Type.Scalar.String.put", + "type.scalar.UnknownAsyncClient": "Type.Scalar.Unknown", + "type.scalar.UnknownAsyncClient.get": "Type.Scalar.Unknown.get", + "type.scalar.UnknownAsyncClient.getWithResponse": "Type.Scalar.Unknown.get", + "type.scalar.UnknownAsyncClient.put": "Type.Scalar.Unknown.put", + "type.scalar.UnknownAsyncClient.putWithResponse": "Type.Scalar.Unknown.put", + "type.scalar.UnknownClient": "Type.Scalar.Unknown", + "type.scalar.UnknownClient.get": "Type.Scalar.Unknown.get", + "type.scalar.UnknownClient.getWithResponse": "Type.Scalar.Unknown.get", + "type.scalar.UnknownClient.put": "Type.Scalar.Unknown.put", + "type.scalar.UnknownClient.putWithResponse": "Type.Scalar.Unknown.put" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_metadata.json new file mode 100644 index 00000000000..7111fed4641 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-scalar_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.scalar.BooleanOperationAsyncClient":"Type.Scalar.Boolean","type.scalar.BooleanOperationAsyncClient.get":"Type.Scalar.Boolean.get","type.scalar.BooleanOperationAsyncClient.getWithResponse":"Type.Scalar.Boolean.get","type.scalar.BooleanOperationAsyncClient.put":"Type.Scalar.Boolean.put","type.scalar.BooleanOperationAsyncClient.putWithResponse":"Type.Scalar.Boolean.put","type.scalar.BooleanOperationClient":"Type.Scalar.Boolean","type.scalar.BooleanOperationClient.get":"Type.Scalar.Boolean.get","type.scalar.BooleanOperationClient.getWithResponse":"Type.Scalar.Boolean.get","type.scalar.BooleanOperationClient.put":"Type.Scalar.Boolean.put","type.scalar.BooleanOperationClient.putWithResponse":"Type.Scalar.Boolean.put","type.scalar.Decimal128TypeAsyncClient":"Type.Scalar.Decimal128Type","type.scalar.Decimal128TypeAsyncClient.requestBody":"Type.Scalar.Decimal128Type.requestBody","type.scalar.Decimal128TypeAsyncClient.requestBodyWithResponse":"Type.Scalar.Decimal128Type.requestBody","type.scalar.Decimal128TypeAsyncClient.requestParameter":"Type.Scalar.Decimal128Type.requestParameter","type.scalar.Decimal128TypeAsyncClient.requestParameterWithResponse":"Type.Scalar.Decimal128Type.requestParameter","type.scalar.Decimal128TypeAsyncClient.responseBody":"Type.Scalar.Decimal128Type.responseBody","type.scalar.Decimal128TypeAsyncClient.responseBodyWithResponse":"Type.Scalar.Decimal128Type.responseBody","type.scalar.Decimal128TypeClient":"Type.Scalar.Decimal128Type","type.scalar.Decimal128TypeClient.requestBody":"Type.Scalar.Decimal128Type.requestBody","type.scalar.Decimal128TypeClient.requestBodyWithResponse":"Type.Scalar.Decimal128Type.requestBody","type.scalar.Decimal128TypeClient.requestParameter":"Type.Scalar.Decimal128Type.requestParameter","type.scalar.Decimal128TypeClient.requestParameterWithResponse":"Type.Scalar.Decimal128Type.requestParameter","type.scalar.Decimal128TypeClient.responseBody":"Type.Scalar.Decimal128Type.responseBody","type.scalar.Decimal128TypeClient.responseBodyWithResponse":"Type.Scalar.Decimal128Type.responseBody","type.scalar.Decimal128VerifyAsyncClient":"Type.Scalar.Decimal128Verify","type.scalar.Decimal128VerifyAsyncClient.prepareVerify":"Type.Scalar.Decimal128Verify.prepareVerify","type.scalar.Decimal128VerifyAsyncClient.prepareVerifyWithResponse":"Type.Scalar.Decimal128Verify.prepareVerify","type.scalar.Decimal128VerifyAsyncClient.verify":"Type.Scalar.Decimal128Verify.verify","type.scalar.Decimal128VerifyAsyncClient.verifyWithResponse":"Type.Scalar.Decimal128Verify.verify","type.scalar.Decimal128VerifyClient":"Type.Scalar.Decimal128Verify","type.scalar.Decimal128VerifyClient.prepareVerify":"Type.Scalar.Decimal128Verify.prepareVerify","type.scalar.Decimal128VerifyClient.prepareVerifyWithResponse":"Type.Scalar.Decimal128Verify.prepareVerify","type.scalar.Decimal128VerifyClient.verify":"Type.Scalar.Decimal128Verify.verify","type.scalar.Decimal128VerifyClient.verifyWithResponse":"Type.Scalar.Decimal128Verify.verify","type.scalar.DecimalTypeAsyncClient":"Type.Scalar.DecimalType","type.scalar.DecimalTypeAsyncClient.requestBody":"Type.Scalar.DecimalType.requestBody","type.scalar.DecimalTypeAsyncClient.requestBodyWithResponse":"Type.Scalar.DecimalType.requestBody","type.scalar.DecimalTypeAsyncClient.requestParameter":"Type.Scalar.DecimalType.requestParameter","type.scalar.DecimalTypeAsyncClient.requestParameterWithResponse":"Type.Scalar.DecimalType.requestParameter","type.scalar.DecimalTypeAsyncClient.responseBody":"Type.Scalar.DecimalType.responseBody","type.scalar.DecimalTypeAsyncClient.responseBodyWithResponse":"Type.Scalar.DecimalType.responseBody","type.scalar.DecimalTypeClient":"Type.Scalar.DecimalType","type.scalar.DecimalTypeClient.requestBody":"Type.Scalar.DecimalType.requestBody","type.scalar.DecimalTypeClient.requestBodyWithResponse":"Type.Scalar.DecimalType.requestBody","type.scalar.DecimalTypeClient.requestParameter":"Type.Scalar.DecimalType.requestParameter","type.scalar.DecimalTypeClient.requestParameterWithResponse":"Type.Scalar.DecimalType.requestParameter","type.scalar.DecimalTypeClient.responseBody":"Type.Scalar.DecimalType.responseBody","type.scalar.DecimalTypeClient.responseBodyWithResponse":"Type.Scalar.DecimalType.responseBody","type.scalar.DecimalVerifyAsyncClient":"Type.Scalar.DecimalVerify","type.scalar.DecimalVerifyAsyncClient.prepareVerify":"Type.Scalar.DecimalVerify.prepareVerify","type.scalar.DecimalVerifyAsyncClient.prepareVerifyWithResponse":"Type.Scalar.DecimalVerify.prepareVerify","type.scalar.DecimalVerifyAsyncClient.verify":"Type.Scalar.DecimalVerify.verify","type.scalar.DecimalVerifyAsyncClient.verifyWithResponse":"Type.Scalar.DecimalVerify.verify","type.scalar.DecimalVerifyClient":"Type.Scalar.DecimalVerify","type.scalar.DecimalVerifyClient.prepareVerify":"Type.Scalar.DecimalVerify.prepareVerify","type.scalar.DecimalVerifyClient.prepareVerifyWithResponse":"Type.Scalar.DecimalVerify.prepareVerify","type.scalar.DecimalVerifyClient.verify":"Type.Scalar.DecimalVerify.verify","type.scalar.DecimalVerifyClient.verifyWithResponse":"Type.Scalar.DecimalVerify.verify","type.scalar.ScalarClientBuilder":"Type.Scalar","type.scalar.StringOperationAsyncClient":"Type.Scalar.String","type.scalar.StringOperationAsyncClient.get":"Type.Scalar.String.get","type.scalar.StringOperationAsyncClient.getWithResponse":"Type.Scalar.String.get","type.scalar.StringOperationAsyncClient.put":"Type.Scalar.String.put","type.scalar.StringOperationAsyncClient.putWithResponse":"Type.Scalar.String.put","type.scalar.StringOperationClient":"Type.Scalar.String","type.scalar.StringOperationClient.get":"Type.Scalar.String.get","type.scalar.StringOperationClient.getWithResponse":"Type.Scalar.String.get","type.scalar.StringOperationClient.put":"Type.Scalar.String.put","type.scalar.StringOperationClient.putWithResponse":"Type.Scalar.String.put","type.scalar.UnknownAsyncClient":"Type.Scalar.Unknown","type.scalar.UnknownAsyncClient.get":"Type.Scalar.Unknown.get","type.scalar.UnknownAsyncClient.getWithResponse":"Type.Scalar.Unknown.get","type.scalar.UnknownAsyncClient.put":"Type.Scalar.Unknown.put","type.scalar.UnknownAsyncClient.putWithResponse":"Type.Scalar.Unknown.put","type.scalar.UnknownClient":"Type.Scalar.Unknown","type.scalar.UnknownClient.get":"Type.Scalar.Unknown.get","type.scalar.UnknownClient.getWithResponse":"Type.Scalar.Unknown.get","type.scalar.UnknownClient.put":"Type.Scalar.Unknown.put","type.scalar.UnknownClient.putWithResponse":"Type.Scalar.Unknown.put"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/scalar/BooleanOperationAsyncClient.java","src/main/java/type/scalar/BooleanOperationClient.java","src/main/java/type/scalar/Decimal128TypeAsyncClient.java","src/main/java/type/scalar/Decimal128TypeClient.java","src/main/java/type/scalar/Decimal128VerifyAsyncClient.java","src/main/java/type/scalar/Decimal128VerifyClient.java","src/main/java/type/scalar/DecimalTypeAsyncClient.java","src/main/java/type/scalar/DecimalTypeClient.java","src/main/java/type/scalar/DecimalVerifyAsyncClient.java","src/main/java/type/scalar/DecimalVerifyClient.java","src/main/java/type/scalar/ScalarClientBuilder.java","src/main/java/type/scalar/StringOperationAsyncClient.java","src/main/java/type/scalar/StringOperationClient.java","src/main/java/type/scalar/UnknownAsyncClient.java","src/main/java/type/scalar/UnknownClient.java","src/main/java/type/scalar/implementation/BooleanOperationsImpl.java","src/main/java/type/scalar/implementation/Decimal128TypesImpl.java","src/main/java/type/scalar/implementation/Decimal128VerifiesImpl.java","src/main/java/type/scalar/implementation/DecimalTypesImpl.java","src/main/java/type/scalar/implementation/DecimalVerifiesImpl.java","src/main/java/type/scalar/implementation/ScalarClientImpl.java","src/main/java/type/scalar/implementation/StringOperationsImpl.java","src/main/java/type/scalar/implementation/UnknownsImpl.java","src/main/java/type/scalar/implementation/package-info.java","src/main/java/type/scalar/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_apiview_properties.json new file mode 100644 index 00000000000..95c1b7aafc0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_apiview_properties.json @@ -0,0 +1,46 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.union.discriminated.DiscriminatedClientBuilder": "Type.Union.Discriminated", + "type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient": "Type.Union.Discriminated.Envelope.Object.CustomProperties", + "type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.get": "Type.Union.Discriminated.Envelope.Object.CustomProperties.get", + "type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.getWithResponse": "Type.Union.Discriminated.Envelope.Object.CustomProperties.get", + "type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.put": "Type.Union.Discriminated.Envelope.Object.CustomProperties.put", + "type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.putWithResponse": "Type.Union.Discriminated.Envelope.Object.CustomProperties.put", + "type.union.discriminated.EnvelopeObjectCustomPropertiesClient": "Type.Union.Discriminated.Envelope.Object.CustomProperties", + "type.union.discriminated.EnvelopeObjectCustomPropertiesClient.get": "Type.Union.Discriminated.Envelope.Object.CustomProperties.get", + "type.union.discriminated.EnvelopeObjectCustomPropertiesClient.getWithResponse": "Type.Union.Discriminated.Envelope.Object.CustomProperties.get", + "type.union.discriminated.EnvelopeObjectCustomPropertiesClient.put": "Type.Union.Discriminated.Envelope.Object.CustomProperties.put", + "type.union.discriminated.EnvelopeObjectCustomPropertiesClient.putWithResponse": "Type.Union.Discriminated.Envelope.Object.CustomProperties.put", + "type.union.discriminated.EnvelopeObjectDefaultAsyncClient": "Type.Union.Discriminated.Envelope.Object.Default", + "type.union.discriminated.EnvelopeObjectDefaultAsyncClient.get": "Type.Union.Discriminated.Envelope.Object.Default.get", + "type.union.discriminated.EnvelopeObjectDefaultAsyncClient.getWithResponse": "Type.Union.Discriminated.Envelope.Object.Default.get", + "type.union.discriminated.EnvelopeObjectDefaultAsyncClient.put": "Type.Union.Discriminated.Envelope.Object.Default.put", + "type.union.discriminated.EnvelopeObjectDefaultAsyncClient.putWithResponse": "Type.Union.Discriminated.Envelope.Object.Default.put", + "type.union.discriminated.EnvelopeObjectDefaultClient": "Type.Union.Discriminated.Envelope.Object.Default", + "type.union.discriminated.EnvelopeObjectDefaultClient.get": "Type.Union.Discriminated.Envelope.Object.Default.get", + "type.union.discriminated.EnvelopeObjectDefaultClient.getWithResponse": "Type.Union.Discriminated.Envelope.Object.Default.get", + "type.union.discriminated.EnvelopeObjectDefaultClient.put": "Type.Union.Discriminated.Envelope.Object.Default.put", + "type.union.discriminated.EnvelopeObjectDefaultClient.putWithResponse": "Type.Union.Discriminated.Envelope.Object.Default.put", + "type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator", + "type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.get": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get", + "type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.getWithResponse": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get", + "type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.put": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put", + "type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.putWithResponse": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put", + "type.union.discriminated.NoEnvelopeCustomDiscriminatorClient": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator", + "type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.get": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get", + "type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.getWithResponse": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get", + "type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.put": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put", + "type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.putWithResponse": "Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put", + "type.union.discriminated.NoEnvelopeDefaultAsyncClient": "Type.Union.Discriminated.NoEnvelope.Default", + "type.union.discriminated.NoEnvelopeDefaultAsyncClient.get": "Type.Union.Discriminated.NoEnvelope.Default.get", + "type.union.discriminated.NoEnvelopeDefaultAsyncClient.getWithResponse": "Type.Union.Discriminated.NoEnvelope.Default.get", + "type.union.discriminated.NoEnvelopeDefaultAsyncClient.put": "Type.Union.Discriminated.NoEnvelope.Default.put", + "type.union.discriminated.NoEnvelopeDefaultAsyncClient.putWithResponse": "Type.Union.Discriminated.NoEnvelope.Default.put", + "type.union.discriminated.NoEnvelopeDefaultClient": "Type.Union.Discriminated.NoEnvelope.Default", + "type.union.discriminated.NoEnvelopeDefaultClient.get": "Type.Union.Discriminated.NoEnvelope.Default.get", + "type.union.discriminated.NoEnvelopeDefaultClient.getWithResponse": "Type.Union.Discriminated.NoEnvelope.Default.get", + "type.union.discriminated.NoEnvelopeDefaultClient.put": "Type.Union.Discriminated.NoEnvelope.Default.put", + "type.union.discriminated.NoEnvelopeDefaultClient.putWithResponse": "Type.Union.Discriminated.NoEnvelope.Default.put" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_metadata.json new file mode 100644 index 00000000000..1b64e37521d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union-discriminated_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.union.discriminated.DiscriminatedClientBuilder":"Type.Union.Discriminated","type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient":"Type.Union.Discriminated.Envelope.Object.CustomProperties","type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.get":"Type.Union.Discriminated.Envelope.Object.CustomProperties.get","type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.getWithResponse":"Type.Union.Discriminated.Envelope.Object.CustomProperties.get","type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.put":"Type.Union.Discriminated.Envelope.Object.CustomProperties.put","type.union.discriminated.EnvelopeObjectCustomPropertiesAsyncClient.putWithResponse":"Type.Union.Discriminated.Envelope.Object.CustomProperties.put","type.union.discriminated.EnvelopeObjectCustomPropertiesClient":"Type.Union.Discriminated.Envelope.Object.CustomProperties","type.union.discriminated.EnvelopeObjectCustomPropertiesClient.get":"Type.Union.Discriminated.Envelope.Object.CustomProperties.get","type.union.discriminated.EnvelopeObjectCustomPropertiesClient.getWithResponse":"Type.Union.Discriminated.Envelope.Object.CustomProperties.get","type.union.discriminated.EnvelopeObjectCustomPropertiesClient.put":"Type.Union.Discriminated.Envelope.Object.CustomProperties.put","type.union.discriminated.EnvelopeObjectCustomPropertiesClient.putWithResponse":"Type.Union.Discriminated.Envelope.Object.CustomProperties.put","type.union.discriminated.EnvelopeObjectDefaultAsyncClient":"Type.Union.Discriminated.Envelope.Object.Default","type.union.discriminated.EnvelopeObjectDefaultAsyncClient.get":"Type.Union.Discriminated.Envelope.Object.Default.get","type.union.discriminated.EnvelopeObjectDefaultAsyncClient.getWithResponse":"Type.Union.Discriminated.Envelope.Object.Default.get","type.union.discriminated.EnvelopeObjectDefaultAsyncClient.put":"Type.Union.Discriminated.Envelope.Object.Default.put","type.union.discriminated.EnvelopeObjectDefaultAsyncClient.putWithResponse":"Type.Union.Discriminated.Envelope.Object.Default.put","type.union.discriminated.EnvelopeObjectDefaultClient":"Type.Union.Discriminated.Envelope.Object.Default","type.union.discriminated.EnvelopeObjectDefaultClient.get":"Type.Union.Discriminated.Envelope.Object.Default.get","type.union.discriminated.EnvelopeObjectDefaultClient.getWithResponse":"Type.Union.Discriminated.Envelope.Object.Default.get","type.union.discriminated.EnvelopeObjectDefaultClient.put":"Type.Union.Discriminated.Envelope.Object.Default.put","type.union.discriminated.EnvelopeObjectDefaultClient.putWithResponse":"Type.Union.Discriminated.Envelope.Object.Default.put","type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator","type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.get":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get","type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.getWithResponse":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get","type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.put":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put","type.union.discriminated.NoEnvelopeCustomDiscriminatorAsyncClient.putWithResponse":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put","type.union.discriminated.NoEnvelopeCustomDiscriminatorClient":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator","type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.get":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get","type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.getWithResponse":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.get","type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.put":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put","type.union.discriminated.NoEnvelopeCustomDiscriminatorClient.putWithResponse":"Type.Union.Discriminated.NoEnvelope.CustomDiscriminator.put","type.union.discriminated.NoEnvelopeDefaultAsyncClient":"Type.Union.Discriminated.NoEnvelope.Default","type.union.discriminated.NoEnvelopeDefaultAsyncClient.get":"Type.Union.Discriminated.NoEnvelope.Default.get","type.union.discriminated.NoEnvelopeDefaultAsyncClient.getWithResponse":"Type.Union.Discriminated.NoEnvelope.Default.get","type.union.discriminated.NoEnvelopeDefaultAsyncClient.put":"Type.Union.Discriminated.NoEnvelope.Default.put","type.union.discriminated.NoEnvelopeDefaultAsyncClient.putWithResponse":"Type.Union.Discriminated.NoEnvelope.Default.put","type.union.discriminated.NoEnvelopeDefaultClient":"Type.Union.Discriminated.NoEnvelope.Default","type.union.discriminated.NoEnvelopeDefaultClient.get":"Type.Union.Discriminated.NoEnvelope.Default.get","type.union.discriminated.NoEnvelopeDefaultClient.getWithResponse":"Type.Union.Discriminated.NoEnvelope.Default.get","type.union.discriminated.NoEnvelopeDefaultClient.put":"Type.Union.Discriminated.NoEnvelope.Default.put","type.union.discriminated.NoEnvelopeDefaultClient.putWithResponse":"Type.Union.Discriminated.NoEnvelope.Default.put"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/union/discriminated/DiscriminatedClientBuilder.java","src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesAsyncClient.java","src/main/java/type/union/discriminated/EnvelopeObjectCustomPropertiesClient.java","src/main/java/type/union/discriminated/EnvelopeObjectDefaultAsyncClient.java","src/main/java/type/union/discriminated/EnvelopeObjectDefaultClient.java","src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorAsyncClient.java","src/main/java/type/union/discriminated/NoEnvelopeCustomDiscriminatorClient.java","src/main/java/type/union/discriminated/NoEnvelopeDefaultAsyncClient.java","src/main/java/type/union/discriminated/NoEnvelopeDefaultClient.java","src/main/java/type/union/discriminated/implementation/DiscriminatedClientImpl.java","src/main/java/type/union/discriminated/implementation/EnvelopeObjectCustomPropertiesImpl.java","src/main/java/type/union/discriminated/implementation/EnvelopeObjectDefaultsImpl.java","src/main/java/type/union/discriminated/implementation/NoEnvelopeCustomDiscriminatorsImpl.java","src/main/java/type/union/discriminated/implementation/NoEnvelopeDefaultsImpl.java","src/main/java/type/union/discriminated/implementation/package-info.java","src/main/java/type/union/discriminated/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_apiview_properties.json new file mode 100644 index 00000000000..7a6a8d03465 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_apiview_properties.json @@ -0,0 +1,139 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "type.union.EnumsOnlyAsyncClient": "Type.Union.EnumsOnly", + "type.union.EnumsOnlyAsyncClient.get": "Type.Union.EnumsOnly.get", + "type.union.EnumsOnlyAsyncClient.getWithResponse": "Type.Union.EnumsOnly.get", + "type.union.EnumsOnlyAsyncClient.send": "Type.Union.EnumsOnly.send", + "type.union.EnumsOnlyAsyncClient.sendWithResponse": "Type.Union.EnumsOnly.send", + "type.union.EnumsOnlyClient": "Type.Union.EnumsOnly", + "type.union.EnumsOnlyClient.get": "Type.Union.EnumsOnly.get", + "type.union.EnumsOnlyClient.getWithResponse": "Type.Union.EnumsOnly.get", + "type.union.EnumsOnlyClient.send": "Type.Union.EnumsOnly.send", + "type.union.EnumsOnlyClient.sendWithResponse": "Type.Union.EnumsOnly.send", + "type.union.FloatsOnlyAsyncClient": "Type.Union.FloatsOnly", + "type.union.FloatsOnlyAsyncClient.get": "Type.Union.FloatsOnly.get", + "type.union.FloatsOnlyAsyncClient.getWithResponse": "Type.Union.FloatsOnly.get", + "type.union.FloatsOnlyAsyncClient.send": "Type.Union.FloatsOnly.send", + "type.union.FloatsOnlyAsyncClient.sendWithResponse": "Type.Union.FloatsOnly.send", + "type.union.FloatsOnlyClient": "Type.Union.FloatsOnly", + "type.union.FloatsOnlyClient.get": "Type.Union.FloatsOnly.get", + "type.union.FloatsOnlyClient.getWithResponse": "Type.Union.FloatsOnly.get", + "type.union.FloatsOnlyClient.send": "Type.Union.FloatsOnly.send", + "type.union.FloatsOnlyClient.sendWithResponse": "Type.Union.FloatsOnly.send", + "type.union.IntsOnlyAsyncClient": "Type.Union.IntsOnly", + "type.union.IntsOnlyAsyncClient.get": "Type.Union.IntsOnly.get", + "type.union.IntsOnlyAsyncClient.getWithResponse": "Type.Union.IntsOnly.get", + "type.union.IntsOnlyAsyncClient.send": "Type.Union.IntsOnly.send", + "type.union.IntsOnlyAsyncClient.sendWithResponse": "Type.Union.IntsOnly.send", + "type.union.IntsOnlyClient": "Type.Union.IntsOnly", + "type.union.IntsOnlyClient.get": "Type.Union.IntsOnly.get", + "type.union.IntsOnlyClient.getWithResponse": "Type.Union.IntsOnly.get", + "type.union.IntsOnlyClient.send": "Type.Union.IntsOnly.send", + "type.union.IntsOnlyClient.sendWithResponse": "Type.Union.IntsOnly.send", + "type.union.MixedLiteralsAsyncClient": "Type.Union.MixedLiterals", + "type.union.MixedLiteralsAsyncClient.get": "Type.Union.MixedLiterals.get", + "type.union.MixedLiteralsAsyncClient.getWithResponse": "Type.Union.MixedLiterals.get", + "type.union.MixedLiteralsAsyncClient.send": "Type.Union.MixedLiterals.send", + "type.union.MixedLiteralsAsyncClient.sendWithResponse": "Type.Union.MixedLiterals.send", + "type.union.MixedLiteralsClient": "Type.Union.MixedLiterals", + "type.union.MixedLiteralsClient.get": "Type.Union.MixedLiterals.get", + "type.union.MixedLiteralsClient.getWithResponse": "Type.Union.MixedLiterals.get", + "type.union.MixedLiteralsClient.send": "Type.Union.MixedLiterals.send", + "type.union.MixedLiteralsClient.sendWithResponse": "Type.Union.MixedLiterals.send", + "type.union.MixedTypesAsyncClient": "Type.Union.MixedTypes", + "type.union.MixedTypesAsyncClient.get": "Type.Union.MixedTypes.get", + "type.union.MixedTypesAsyncClient.getWithResponse": "Type.Union.MixedTypes.get", + "type.union.MixedTypesAsyncClient.send": "Type.Union.MixedTypes.send", + "type.union.MixedTypesAsyncClient.sendWithResponse": "Type.Union.MixedTypes.send", + "type.union.MixedTypesClient": "Type.Union.MixedTypes", + "type.union.MixedTypesClient.get": "Type.Union.MixedTypes.get", + "type.union.MixedTypesClient.getWithResponse": "Type.Union.MixedTypes.get", + "type.union.MixedTypesClient.send": "Type.Union.MixedTypes.send", + "type.union.MixedTypesClient.sendWithResponse": "Type.Union.MixedTypes.send", + "type.union.ModelsOnlyAsyncClient": "Type.Union.ModelsOnly", + "type.union.ModelsOnlyAsyncClient.get": "Type.Union.ModelsOnly.get", + "type.union.ModelsOnlyAsyncClient.getWithResponse": "Type.Union.ModelsOnly.get", + "type.union.ModelsOnlyAsyncClient.send": "Type.Union.ModelsOnly.send", + "type.union.ModelsOnlyAsyncClient.sendWithResponse": "Type.Union.ModelsOnly.send", + "type.union.ModelsOnlyClient": "Type.Union.ModelsOnly", + "type.union.ModelsOnlyClient.get": "Type.Union.ModelsOnly.get", + "type.union.ModelsOnlyClient.getWithResponse": "Type.Union.ModelsOnly.get", + "type.union.ModelsOnlyClient.send": "Type.Union.ModelsOnly.send", + "type.union.ModelsOnlyClient.sendWithResponse": "Type.Union.ModelsOnly.send", + "type.union.StringAndArrayAsyncClient": "Type.Union.StringAndArray", + "type.union.StringAndArrayAsyncClient.get": "Type.Union.StringAndArray.get", + "type.union.StringAndArrayAsyncClient.getWithResponse": "Type.Union.StringAndArray.get", + "type.union.StringAndArrayAsyncClient.send": "Type.Union.StringAndArray.send", + "type.union.StringAndArrayAsyncClient.sendWithResponse": "Type.Union.StringAndArray.send", + "type.union.StringAndArrayClient": "Type.Union.StringAndArray", + "type.union.StringAndArrayClient.get": "Type.Union.StringAndArray.get", + "type.union.StringAndArrayClient.getWithResponse": "Type.Union.StringAndArray.get", + "type.union.StringAndArrayClient.send": "Type.Union.StringAndArray.send", + "type.union.StringAndArrayClient.sendWithResponse": "Type.Union.StringAndArray.send", + "type.union.StringExtensibleAsyncClient": "Type.Union.StringExtensible", + "type.union.StringExtensibleAsyncClient.get": "Type.Union.StringExtensible.get", + "type.union.StringExtensibleAsyncClient.getWithResponse": "Type.Union.StringExtensible.get", + "type.union.StringExtensibleAsyncClient.send": "Type.Union.StringExtensible.send", + "type.union.StringExtensibleAsyncClient.sendWithResponse": "Type.Union.StringExtensible.send", + "type.union.StringExtensibleClient": "Type.Union.StringExtensible", + "type.union.StringExtensibleClient.get": "Type.Union.StringExtensible.get", + "type.union.StringExtensibleClient.getWithResponse": "Type.Union.StringExtensible.get", + "type.union.StringExtensibleClient.send": "Type.Union.StringExtensible.send", + "type.union.StringExtensibleClient.sendWithResponse": "Type.Union.StringExtensible.send", + "type.union.StringExtensibleNamedAsyncClient": "Type.Union.StringExtensibleNamed", + "type.union.StringExtensibleNamedAsyncClient.get": "Type.Union.StringExtensibleNamed.get", + "type.union.StringExtensibleNamedAsyncClient.getWithResponse": "Type.Union.StringExtensibleNamed.get", + "type.union.StringExtensibleNamedAsyncClient.send": "Type.Union.StringExtensibleNamed.send", + "type.union.StringExtensibleNamedAsyncClient.sendWithResponse": "Type.Union.StringExtensibleNamed.send", + "type.union.StringExtensibleNamedClient": "Type.Union.StringExtensibleNamed", + "type.union.StringExtensibleNamedClient.get": "Type.Union.StringExtensibleNamed.get", + "type.union.StringExtensibleNamedClient.getWithResponse": "Type.Union.StringExtensibleNamed.get", + "type.union.StringExtensibleNamedClient.send": "Type.Union.StringExtensibleNamed.send", + "type.union.StringExtensibleNamedClient.sendWithResponse": "Type.Union.StringExtensibleNamed.send", + "type.union.StringsOnlyAsyncClient": "Type.Union.StringsOnly", + "type.union.StringsOnlyAsyncClient.get": "Type.Union.StringsOnly.get", + "type.union.StringsOnlyAsyncClient.getWithResponse": "Type.Union.StringsOnly.get", + "type.union.StringsOnlyAsyncClient.send": "Type.Union.StringsOnly.send", + "type.union.StringsOnlyAsyncClient.sendWithResponse": "Type.Union.StringsOnly.send", + "type.union.StringsOnlyClient": "Type.Union.StringsOnly", + "type.union.StringsOnlyClient.get": "Type.Union.StringsOnly.get", + "type.union.StringsOnlyClient.getWithResponse": "Type.Union.StringsOnly.get", + "type.union.StringsOnlyClient.send": "Type.Union.StringsOnly.send", + "type.union.StringsOnlyClient.sendWithResponse": "Type.Union.StringsOnly.send", + "type.union.UnionClientBuilder": "Type.Union", + "type.union.implementation.models.SendRequest": "Type.Union.send.Request.anonymous", + "type.union.implementation.models.SendRequest1": "Type.Union.send.Request.anonymous", + "type.union.implementation.models.SendRequest2": "Type.Union.send.Request.anonymous", + "type.union.implementation.models.SendRequest3": "Type.Union.send.Request.anonymous", + "type.union.implementation.models.SendRequest4": "Type.Union.send.Request.anonymous", + "type.union.implementation.models.SendRequest5": "Type.Union.send.Request.anonymous", + "type.union.implementation.models.SendRequest6": "Type.Union.send.Request.anonymous", + "type.union.implementation.models.SendRequest7": "Type.Union.send.Request.anonymous", + "type.union.implementation.models.SendRequest8": "Type.Union.send.Request.anonymous", + "type.union.implementation.models.SendRequest9": "Type.Union.send.Request.anonymous", + "type.union.models.Cat": "Type.Union.Cat", + "type.union.models.Dog": "Type.Union.Dog", + "type.union.models.EnumsOnlyCases": "Type.Union.EnumsOnlyCases", + "type.union.models.EnumsOnlyCasesLr": "Type.Union.EnumsOnlyCases.lr.anonymous", + "type.union.models.EnumsOnlyCasesUd": "Type.Union.EnumsOnlyCases.ud.anonymous", + "type.union.models.GetResponse": "Type.Union.get.Response.anonymous", + "type.union.models.GetResponse1": "Type.Union.get.Response.anonymous", + "type.union.models.GetResponse2": "Type.Union.get.Response.anonymous", + "type.union.models.GetResponse3": "Type.Union.get.Response.anonymous", + "type.union.models.GetResponse4": "Type.Union.get.Response.anonymous", + "type.union.models.GetResponse5": "Type.Union.get.Response.anonymous", + "type.union.models.GetResponse6": "Type.Union.get.Response.anonymous", + "type.union.models.GetResponse7": "Type.Union.get.Response.anonymous", + "type.union.models.GetResponse8": "Type.Union.get.Response.anonymous", + "type.union.models.GetResponse9": "Type.Union.get.Response.anonymous", + "type.union.models.GetResponseProp": "Type.Union.get.Response.prop.anonymous", + "type.union.models.GetResponseProp1": "Type.Union.get.Response.prop.anonymous", + "type.union.models.GetResponseProp2": "Type.Union.get.Response.prop.anonymous", + "type.union.models.GetResponseProp3": "Type.Union.get.Response.prop.anonymous", + "type.union.models.MixedLiteralsCases": "Type.Union.MixedLiteralsCases", + "type.union.models.MixedTypesCases": "Type.Union.MixedTypesCases", + "type.union.models.StringAndArrayCases": "Type.Union.StringAndArrayCases", + "type.union.models.StringExtensibleNamedUnion": "Type.Union.StringExtensibleNamedUnion" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_metadata.json new file mode 100644 index 00000000000..076eb870da1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/type-union_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","crossLanguageDefinitions":{"type.union.EnumsOnlyAsyncClient":"Type.Union.EnumsOnly","type.union.EnumsOnlyAsyncClient.get":"Type.Union.EnumsOnly.get","type.union.EnumsOnlyAsyncClient.getWithResponse":"Type.Union.EnumsOnly.get","type.union.EnumsOnlyAsyncClient.send":"Type.Union.EnumsOnly.send","type.union.EnumsOnlyAsyncClient.sendWithResponse":"Type.Union.EnumsOnly.send","type.union.EnumsOnlyClient":"Type.Union.EnumsOnly","type.union.EnumsOnlyClient.get":"Type.Union.EnumsOnly.get","type.union.EnumsOnlyClient.getWithResponse":"Type.Union.EnumsOnly.get","type.union.EnumsOnlyClient.send":"Type.Union.EnumsOnly.send","type.union.EnumsOnlyClient.sendWithResponse":"Type.Union.EnumsOnly.send","type.union.FloatsOnlyAsyncClient":"Type.Union.FloatsOnly","type.union.FloatsOnlyAsyncClient.get":"Type.Union.FloatsOnly.get","type.union.FloatsOnlyAsyncClient.getWithResponse":"Type.Union.FloatsOnly.get","type.union.FloatsOnlyAsyncClient.send":"Type.Union.FloatsOnly.send","type.union.FloatsOnlyAsyncClient.sendWithResponse":"Type.Union.FloatsOnly.send","type.union.FloatsOnlyClient":"Type.Union.FloatsOnly","type.union.FloatsOnlyClient.get":"Type.Union.FloatsOnly.get","type.union.FloatsOnlyClient.getWithResponse":"Type.Union.FloatsOnly.get","type.union.FloatsOnlyClient.send":"Type.Union.FloatsOnly.send","type.union.FloatsOnlyClient.sendWithResponse":"Type.Union.FloatsOnly.send","type.union.IntsOnlyAsyncClient":"Type.Union.IntsOnly","type.union.IntsOnlyAsyncClient.get":"Type.Union.IntsOnly.get","type.union.IntsOnlyAsyncClient.getWithResponse":"Type.Union.IntsOnly.get","type.union.IntsOnlyAsyncClient.send":"Type.Union.IntsOnly.send","type.union.IntsOnlyAsyncClient.sendWithResponse":"Type.Union.IntsOnly.send","type.union.IntsOnlyClient":"Type.Union.IntsOnly","type.union.IntsOnlyClient.get":"Type.Union.IntsOnly.get","type.union.IntsOnlyClient.getWithResponse":"Type.Union.IntsOnly.get","type.union.IntsOnlyClient.send":"Type.Union.IntsOnly.send","type.union.IntsOnlyClient.sendWithResponse":"Type.Union.IntsOnly.send","type.union.MixedLiteralsAsyncClient":"Type.Union.MixedLiterals","type.union.MixedLiteralsAsyncClient.get":"Type.Union.MixedLiterals.get","type.union.MixedLiteralsAsyncClient.getWithResponse":"Type.Union.MixedLiterals.get","type.union.MixedLiteralsAsyncClient.send":"Type.Union.MixedLiterals.send","type.union.MixedLiteralsAsyncClient.sendWithResponse":"Type.Union.MixedLiterals.send","type.union.MixedLiteralsClient":"Type.Union.MixedLiterals","type.union.MixedLiteralsClient.get":"Type.Union.MixedLiterals.get","type.union.MixedLiteralsClient.getWithResponse":"Type.Union.MixedLiterals.get","type.union.MixedLiteralsClient.send":"Type.Union.MixedLiterals.send","type.union.MixedLiteralsClient.sendWithResponse":"Type.Union.MixedLiterals.send","type.union.MixedTypesAsyncClient":"Type.Union.MixedTypes","type.union.MixedTypesAsyncClient.get":"Type.Union.MixedTypes.get","type.union.MixedTypesAsyncClient.getWithResponse":"Type.Union.MixedTypes.get","type.union.MixedTypesAsyncClient.send":"Type.Union.MixedTypes.send","type.union.MixedTypesAsyncClient.sendWithResponse":"Type.Union.MixedTypes.send","type.union.MixedTypesClient":"Type.Union.MixedTypes","type.union.MixedTypesClient.get":"Type.Union.MixedTypes.get","type.union.MixedTypesClient.getWithResponse":"Type.Union.MixedTypes.get","type.union.MixedTypesClient.send":"Type.Union.MixedTypes.send","type.union.MixedTypesClient.sendWithResponse":"Type.Union.MixedTypes.send","type.union.ModelsOnlyAsyncClient":"Type.Union.ModelsOnly","type.union.ModelsOnlyAsyncClient.get":"Type.Union.ModelsOnly.get","type.union.ModelsOnlyAsyncClient.getWithResponse":"Type.Union.ModelsOnly.get","type.union.ModelsOnlyAsyncClient.send":"Type.Union.ModelsOnly.send","type.union.ModelsOnlyAsyncClient.sendWithResponse":"Type.Union.ModelsOnly.send","type.union.ModelsOnlyClient":"Type.Union.ModelsOnly","type.union.ModelsOnlyClient.get":"Type.Union.ModelsOnly.get","type.union.ModelsOnlyClient.getWithResponse":"Type.Union.ModelsOnly.get","type.union.ModelsOnlyClient.send":"Type.Union.ModelsOnly.send","type.union.ModelsOnlyClient.sendWithResponse":"Type.Union.ModelsOnly.send","type.union.StringAndArrayAsyncClient":"Type.Union.StringAndArray","type.union.StringAndArrayAsyncClient.get":"Type.Union.StringAndArray.get","type.union.StringAndArrayAsyncClient.getWithResponse":"Type.Union.StringAndArray.get","type.union.StringAndArrayAsyncClient.send":"Type.Union.StringAndArray.send","type.union.StringAndArrayAsyncClient.sendWithResponse":"Type.Union.StringAndArray.send","type.union.StringAndArrayClient":"Type.Union.StringAndArray","type.union.StringAndArrayClient.get":"Type.Union.StringAndArray.get","type.union.StringAndArrayClient.getWithResponse":"Type.Union.StringAndArray.get","type.union.StringAndArrayClient.send":"Type.Union.StringAndArray.send","type.union.StringAndArrayClient.sendWithResponse":"Type.Union.StringAndArray.send","type.union.StringExtensibleAsyncClient":"Type.Union.StringExtensible","type.union.StringExtensibleAsyncClient.get":"Type.Union.StringExtensible.get","type.union.StringExtensibleAsyncClient.getWithResponse":"Type.Union.StringExtensible.get","type.union.StringExtensibleAsyncClient.send":"Type.Union.StringExtensible.send","type.union.StringExtensibleAsyncClient.sendWithResponse":"Type.Union.StringExtensible.send","type.union.StringExtensibleClient":"Type.Union.StringExtensible","type.union.StringExtensibleClient.get":"Type.Union.StringExtensible.get","type.union.StringExtensibleClient.getWithResponse":"Type.Union.StringExtensible.get","type.union.StringExtensibleClient.send":"Type.Union.StringExtensible.send","type.union.StringExtensibleClient.sendWithResponse":"Type.Union.StringExtensible.send","type.union.StringExtensibleNamedAsyncClient":"Type.Union.StringExtensibleNamed","type.union.StringExtensibleNamedAsyncClient.get":"Type.Union.StringExtensibleNamed.get","type.union.StringExtensibleNamedAsyncClient.getWithResponse":"Type.Union.StringExtensibleNamed.get","type.union.StringExtensibleNamedAsyncClient.send":"Type.Union.StringExtensibleNamed.send","type.union.StringExtensibleNamedAsyncClient.sendWithResponse":"Type.Union.StringExtensibleNamed.send","type.union.StringExtensibleNamedClient":"Type.Union.StringExtensibleNamed","type.union.StringExtensibleNamedClient.get":"Type.Union.StringExtensibleNamed.get","type.union.StringExtensibleNamedClient.getWithResponse":"Type.Union.StringExtensibleNamed.get","type.union.StringExtensibleNamedClient.send":"Type.Union.StringExtensibleNamed.send","type.union.StringExtensibleNamedClient.sendWithResponse":"Type.Union.StringExtensibleNamed.send","type.union.StringsOnlyAsyncClient":"Type.Union.StringsOnly","type.union.StringsOnlyAsyncClient.get":"Type.Union.StringsOnly.get","type.union.StringsOnlyAsyncClient.getWithResponse":"Type.Union.StringsOnly.get","type.union.StringsOnlyAsyncClient.send":"Type.Union.StringsOnly.send","type.union.StringsOnlyAsyncClient.sendWithResponse":"Type.Union.StringsOnly.send","type.union.StringsOnlyClient":"Type.Union.StringsOnly","type.union.StringsOnlyClient.get":"Type.Union.StringsOnly.get","type.union.StringsOnlyClient.getWithResponse":"Type.Union.StringsOnly.get","type.union.StringsOnlyClient.send":"Type.Union.StringsOnly.send","type.union.StringsOnlyClient.sendWithResponse":"Type.Union.StringsOnly.send","type.union.UnionClientBuilder":"Type.Union","type.union.implementation.models.SendRequest":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest1":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest2":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest3":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest4":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest5":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest6":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest7":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest8":"Type.Union.send.Request.anonymous","type.union.implementation.models.SendRequest9":"Type.Union.send.Request.anonymous","type.union.models.Cat":"Type.Union.Cat","type.union.models.Dog":"Type.Union.Dog","type.union.models.EnumsOnlyCases":"Type.Union.EnumsOnlyCases","type.union.models.EnumsOnlyCasesLr":"Type.Union.EnumsOnlyCases.lr.anonymous","type.union.models.EnumsOnlyCasesUd":"Type.Union.EnumsOnlyCases.ud.anonymous","type.union.models.GetResponse":"Type.Union.get.Response.anonymous","type.union.models.GetResponse1":"Type.Union.get.Response.anonymous","type.union.models.GetResponse2":"Type.Union.get.Response.anonymous","type.union.models.GetResponse3":"Type.Union.get.Response.anonymous","type.union.models.GetResponse4":"Type.Union.get.Response.anonymous","type.union.models.GetResponse5":"Type.Union.get.Response.anonymous","type.union.models.GetResponse6":"Type.Union.get.Response.anonymous","type.union.models.GetResponse7":"Type.Union.get.Response.anonymous","type.union.models.GetResponse8":"Type.Union.get.Response.anonymous","type.union.models.GetResponse9":"Type.Union.get.Response.anonymous","type.union.models.GetResponseProp":"Type.Union.get.Response.prop.anonymous","type.union.models.GetResponseProp1":"Type.Union.get.Response.prop.anonymous","type.union.models.GetResponseProp2":"Type.Union.get.Response.prop.anonymous","type.union.models.GetResponseProp3":"Type.Union.get.Response.prop.anonymous","type.union.models.MixedLiteralsCases":"Type.Union.MixedLiteralsCases","type.union.models.MixedTypesCases":"Type.Union.MixedTypesCases","type.union.models.StringAndArrayCases":"Type.Union.StringAndArrayCases","type.union.models.StringExtensibleNamedUnion":"Type.Union.StringExtensibleNamedUnion"},"generatedFiles":["src/main/java/module-info.java","src/main/java/type/union/EnumsOnlyAsyncClient.java","src/main/java/type/union/EnumsOnlyClient.java","src/main/java/type/union/FloatsOnlyAsyncClient.java","src/main/java/type/union/FloatsOnlyClient.java","src/main/java/type/union/IntsOnlyAsyncClient.java","src/main/java/type/union/IntsOnlyClient.java","src/main/java/type/union/MixedLiteralsAsyncClient.java","src/main/java/type/union/MixedLiteralsClient.java","src/main/java/type/union/MixedTypesAsyncClient.java","src/main/java/type/union/MixedTypesClient.java","src/main/java/type/union/ModelsOnlyAsyncClient.java","src/main/java/type/union/ModelsOnlyClient.java","src/main/java/type/union/StringAndArrayAsyncClient.java","src/main/java/type/union/StringAndArrayClient.java","src/main/java/type/union/StringExtensibleAsyncClient.java","src/main/java/type/union/StringExtensibleClient.java","src/main/java/type/union/StringExtensibleNamedAsyncClient.java","src/main/java/type/union/StringExtensibleNamedClient.java","src/main/java/type/union/StringsOnlyAsyncClient.java","src/main/java/type/union/StringsOnlyClient.java","src/main/java/type/union/UnionClientBuilder.java","src/main/java/type/union/implementation/EnumsOnliesImpl.java","src/main/java/type/union/implementation/FloatsOnliesImpl.java","src/main/java/type/union/implementation/IntsOnliesImpl.java","src/main/java/type/union/implementation/MixedLiteralsImpl.java","src/main/java/type/union/implementation/MixedTypesImpl.java","src/main/java/type/union/implementation/ModelsOnliesImpl.java","src/main/java/type/union/implementation/StringAndArraysImpl.java","src/main/java/type/union/implementation/StringExtensibleNamedsImpl.java","src/main/java/type/union/implementation/StringExtensiblesImpl.java","src/main/java/type/union/implementation/StringsOnliesImpl.java","src/main/java/type/union/implementation/UnionClientImpl.java","src/main/java/type/union/implementation/models/SendRequest.java","src/main/java/type/union/implementation/models/SendRequest1.java","src/main/java/type/union/implementation/models/SendRequest2.java","src/main/java/type/union/implementation/models/SendRequest3.java","src/main/java/type/union/implementation/models/SendRequest4.java","src/main/java/type/union/implementation/models/SendRequest5.java","src/main/java/type/union/implementation/models/SendRequest6.java","src/main/java/type/union/implementation/models/SendRequest7.java","src/main/java/type/union/implementation/models/SendRequest8.java","src/main/java/type/union/implementation/models/SendRequest9.java","src/main/java/type/union/implementation/models/package-info.java","src/main/java/type/union/implementation/package-info.java","src/main/java/type/union/models/Cat.java","src/main/java/type/union/models/Dog.java","src/main/java/type/union/models/EnumsOnlyCases.java","src/main/java/type/union/models/EnumsOnlyCasesLr.java","src/main/java/type/union/models/EnumsOnlyCasesUd.java","src/main/java/type/union/models/GetResponse.java","src/main/java/type/union/models/GetResponse1.java","src/main/java/type/union/models/GetResponse2.java","src/main/java/type/union/models/GetResponse3.java","src/main/java/type/union/models/GetResponse4.java","src/main/java/type/union/models/GetResponse5.java","src/main/java/type/union/models/GetResponse6.java","src/main/java/type/union/models/GetResponse7.java","src/main/java/type/union/models/GetResponse8.java","src/main/java/type/union/models/GetResponse9.java","src/main/java/type/union/models/GetResponseProp.java","src/main/java/type/union/models/GetResponseProp1.java","src/main/java/type/union/models/GetResponseProp2.java","src/main/java/type/union/models/GetResponseProp3.java","src/main/java/type/union/models/MixedLiteralsCases.java","src/main/java/type/union/models/MixedTypesCases.java","src/main/java/type/union/models/StringAndArrayCases.java","src/main/java/type/union/models/StringExtensibleNamedUnion.java","src/main/java/type/union/models/package-info.java","src/main/java/type/union/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_apiview_properties.json new file mode 100644 index 00000000000..c8dde1279f5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_apiview_properties.json @@ -0,0 +1,26 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "versioning.added.AddedAsyncClient": "Versioning.Added", + "versioning.added.AddedAsyncClient.v1": "Versioning.Added.v1", + "versioning.added.AddedAsyncClient.v1WithResponse": "Versioning.Added.v1", + "versioning.added.AddedAsyncClient.v2": "Versioning.Added.v2", + "versioning.added.AddedAsyncClient.v2WithResponse": "Versioning.Added.v2", + "versioning.added.AddedClient": "Versioning.Added", + "versioning.added.AddedClient.v1": "Versioning.Added.v1", + "versioning.added.AddedClient.v1WithResponse": "Versioning.Added.v1", + "versioning.added.AddedClient.v2": "Versioning.Added.v2", + "versioning.added.AddedClient.v2WithResponse": "Versioning.Added.v2", + "versioning.added.AddedClientBuilder": "Versioning.Added", + "versioning.added.InterfaceV2AsyncClient": "Versioning.Added.InterfaceV2", + "versioning.added.InterfaceV2AsyncClient.v2InInterface": "Versioning.Added.InterfaceV2.v2InInterface", + "versioning.added.InterfaceV2AsyncClient.v2InInterfaceWithResponse": "Versioning.Added.InterfaceV2.v2InInterface", + "versioning.added.InterfaceV2Client": "Versioning.Added.InterfaceV2", + "versioning.added.InterfaceV2Client.v2InInterface": "Versioning.Added.InterfaceV2.v2InInterface", + "versioning.added.InterfaceV2Client.v2InInterfaceWithResponse": "Versioning.Added.InterfaceV2.v2InInterface", + "versioning.added.models.EnumV1": "Versioning.Added.EnumV1", + "versioning.added.models.EnumV2": "Versioning.Added.EnumV2", + "versioning.added.models.ModelV1": "Versioning.Added.ModelV1", + "versioning.added.models.ModelV2": "Versioning.Added.ModelV2" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_metadata.json new file mode 100644 index 00000000000..4a0f5f82c05 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-added_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"v2","crossLanguageDefinitions":{"versioning.added.AddedAsyncClient":"Versioning.Added","versioning.added.AddedAsyncClient.v1":"Versioning.Added.v1","versioning.added.AddedAsyncClient.v1WithResponse":"Versioning.Added.v1","versioning.added.AddedAsyncClient.v2":"Versioning.Added.v2","versioning.added.AddedAsyncClient.v2WithResponse":"Versioning.Added.v2","versioning.added.AddedClient":"Versioning.Added","versioning.added.AddedClient.v1":"Versioning.Added.v1","versioning.added.AddedClient.v1WithResponse":"Versioning.Added.v1","versioning.added.AddedClient.v2":"Versioning.Added.v2","versioning.added.AddedClient.v2WithResponse":"Versioning.Added.v2","versioning.added.AddedClientBuilder":"Versioning.Added","versioning.added.InterfaceV2AsyncClient":"Versioning.Added.InterfaceV2","versioning.added.InterfaceV2AsyncClient.v2InInterface":"Versioning.Added.InterfaceV2.v2InInterface","versioning.added.InterfaceV2AsyncClient.v2InInterfaceWithResponse":"Versioning.Added.InterfaceV2.v2InInterface","versioning.added.InterfaceV2Client":"Versioning.Added.InterfaceV2","versioning.added.InterfaceV2Client.v2InInterface":"Versioning.Added.InterfaceV2.v2InInterface","versioning.added.InterfaceV2Client.v2InInterfaceWithResponse":"Versioning.Added.InterfaceV2.v2InInterface","versioning.added.models.EnumV1":"Versioning.Added.EnumV1","versioning.added.models.EnumV2":"Versioning.Added.EnumV2","versioning.added.models.ModelV1":"Versioning.Added.ModelV1","versioning.added.models.ModelV2":"Versioning.Added.ModelV2"},"generatedFiles":["src/main/java/module-info.java","src/main/java/versioning/added/AddedAsyncClient.java","src/main/java/versioning/added/AddedClient.java","src/main/java/versioning/added/AddedClientBuilder.java","src/main/java/versioning/added/AddedServiceVersion.java","src/main/java/versioning/added/InterfaceV2AsyncClient.java","src/main/java/versioning/added/InterfaceV2Client.java","src/main/java/versioning/added/implementation/AddedClientImpl.java","src/main/java/versioning/added/implementation/InterfaceV2sImpl.java","src/main/java/versioning/added/implementation/package-info.java","src/main/java/versioning/added/models/EnumV1.java","src/main/java/versioning/added/models/EnumV2.java","src/main/java/versioning/added/models/ModelV1.java","src/main/java/versioning/added/models/ModelV2.java","src/main/java/versioning/added/models/package-info.java","src/main/java/versioning/added/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_apiview_properties.json new file mode 100644 index 00000000000..81a95b261fd --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_apiview_properties.json @@ -0,0 +1,13 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "versioning.madeoptional.MadeOptionalAsyncClient": "Versioning.MadeOptional", + "versioning.madeoptional.MadeOptionalAsyncClient.test": "Versioning.MadeOptional.test", + "versioning.madeoptional.MadeOptionalAsyncClient.testWithResponse": "Versioning.MadeOptional.test", + "versioning.madeoptional.MadeOptionalClient": "Versioning.MadeOptional", + "versioning.madeoptional.MadeOptionalClient.test": "Versioning.MadeOptional.test", + "versioning.madeoptional.MadeOptionalClient.testWithResponse": "Versioning.MadeOptional.test", + "versioning.madeoptional.MadeOptionalClientBuilder": "Versioning.MadeOptional", + "versioning.madeoptional.models.TestModel": "Versioning.MadeOptional.TestModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_metadata.json new file mode 100644 index 00000000000..ccebfd95958 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-madeoptional_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"v2","crossLanguageDefinitions":{"versioning.madeoptional.MadeOptionalAsyncClient":"Versioning.MadeOptional","versioning.madeoptional.MadeOptionalAsyncClient.test":"Versioning.MadeOptional.test","versioning.madeoptional.MadeOptionalAsyncClient.testWithResponse":"Versioning.MadeOptional.test","versioning.madeoptional.MadeOptionalClient":"Versioning.MadeOptional","versioning.madeoptional.MadeOptionalClient.test":"Versioning.MadeOptional.test","versioning.madeoptional.MadeOptionalClient.testWithResponse":"Versioning.MadeOptional.test","versioning.madeoptional.MadeOptionalClientBuilder":"Versioning.MadeOptional","versioning.madeoptional.models.TestModel":"Versioning.MadeOptional.TestModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/versioning/madeoptional/MadeOptionalAsyncClient.java","src/main/java/versioning/madeoptional/MadeOptionalClient.java","src/main/java/versioning/madeoptional/MadeOptionalClientBuilder.java","src/main/java/versioning/madeoptional/MadeOptionalServiceVersion.java","src/main/java/versioning/madeoptional/implementation/MadeOptionalClientImpl.java","src/main/java/versioning/madeoptional/implementation/package-info.java","src/main/java/versioning/madeoptional/models/TestModel.java","src/main/java/versioning/madeoptional/models/package-info.java","src/main/java/versioning/madeoptional/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_apiview_properties.json new file mode 100644 index 00000000000..8bff65100c9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_apiview_properties.json @@ -0,0 +1,20 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "versioning.removed.RemovedAsyncClient": "Versioning.Removed", + "versioning.removed.RemovedAsyncClient.modelV3": "Versioning.Removed.modelV3", + "versioning.removed.RemovedAsyncClient.modelV3WithResponse": "Versioning.Removed.modelV3", + "versioning.removed.RemovedAsyncClient.v2": "Versioning.Removed.v2", + "versioning.removed.RemovedAsyncClient.v2WithResponse": "Versioning.Removed.v2", + "versioning.removed.RemovedClient": "Versioning.Removed", + "versioning.removed.RemovedClient.modelV3": "Versioning.Removed.modelV3", + "versioning.removed.RemovedClient.modelV3WithResponse": "Versioning.Removed.modelV3", + "versioning.removed.RemovedClient.v2": "Versioning.Removed.v2", + "versioning.removed.RemovedClient.v2WithResponse": "Versioning.Removed.v2", + "versioning.removed.RemovedClientBuilder": "Versioning.Removed", + "versioning.removed.models.EnumV2": "Versioning.Removed.EnumV2", + "versioning.removed.models.EnumV3": "Versioning.Removed.EnumV3", + "versioning.removed.models.ModelV2": "Versioning.Removed.ModelV2", + "versioning.removed.models.ModelV3": "Versioning.Removed.ModelV3" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_metadata.json new file mode 100644 index 00000000000..3cbb6843d41 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-removed_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"v2","crossLanguageDefinitions":{"versioning.removed.RemovedAsyncClient":"Versioning.Removed","versioning.removed.RemovedAsyncClient.modelV3":"Versioning.Removed.modelV3","versioning.removed.RemovedAsyncClient.modelV3WithResponse":"Versioning.Removed.modelV3","versioning.removed.RemovedAsyncClient.v2":"Versioning.Removed.v2","versioning.removed.RemovedAsyncClient.v2WithResponse":"Versioning.Removed.v2","versioning.removed.RemovedClient":"Versioning.Removed","versioning.removed.RemovedClient.modelV3":"Versioning.Removed.modelV3","versioning.removed.RemovedClient.modelV3WithResponse":"Versioning.Removed.modelV3","versioning.removed.RemovedClient.v2":"Versioning.Removed.v2","versioning.removed.RemovedClient.v2WithResponse":"Versioning.Removed.v2","versioning.removed.RemovedClientBuilder":"Versioning.Removed","versioning.removed.models.EnumV2":"Versioning.Removed.EnumV2","versioning.removed.models.EnumV3":"Versioning.Removed.EnumV3","versioning.removed.models.ModelV2":"Versioning.Removed.ModelV2","versioning.removed.models.ModelV3":"Versioning.Removed.ModelV3"},"generatedFiles":["src/main/java/module-info.java","src/main/java/versioning/removed/RemovedAsyncClient.java","src/main/java/versioning/removed/RemovedClient.java","src/main/java/versioning/removed/RemovedClientBuilder.java","src/main/java/versioning/removed/RemovedServiceVersion.java","src/main/java/versioning/removed/implementation/RemovedClientImpl.java","src/main/java/versioning/removed/implementation/package-info.java","src/main/java/versioning/removed/models/EnumV2.java","src/main/java/versioning/removed/models/EnumV3.java","src/main/java/versioning/removed/models/ModelV2.java","src/main/java/versioning/removed/models/ModelV3.java","src/main/java/versioning/removed/models/package-info.java","src/main/java/versioning/removed/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_apiview_properties.json new file mode 100644 index 00000000000..700b2cc4909 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_apiview_properties.json @@ -0,0 +1,20 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "versioning.renamedfrom.NewInterfaceAsyncClient": "Versioning.RenamedFrom.NewInterface", + "versioning.renamedfrom.NewInterfaceAsyncClient.newOpInNewInterface": "Versioning.RenamedFrom.NewInterface.newOpInNewInterface", + "versioning.renamedfrom.NewInterfaceAsyncClient.newOpInNewInterfaceWithResponse": "Versioning.RenamedFrom.NewInterface.newOpInNewInterface", + "versioning.renamedfrom.NewInterfaceClient": "Versioning.RenamedFrom.NewInterface", + "versioning.renamedfrom.NewInterfaceClient.newOpInNewInterface": "Versioning.RenamedFrom.NewInterface.newOpInNewInterface", + "versioning.renamedfrom.NewInterfaceClient.newOpInNewInterfaceWithResponse": "Versioning.RenamedFrom.NewInterface.newOpInNewInterface", + "versioning.renamedfrom.RenamedFromAsyncClient": "Versioning.RenamedFrom", + "versioning.renamedfrom.RenamedFromAsyncClient.newOp": "Versioning.RenamedFrom.newOp", + "versioning.renamedfrom.RenamedFromAsyncClient.newOpWithResponse": "Versioning.RenamedFrom.newOp", + "versioning.renamedfrom.RenamedFromClient": "Versioning.RenamedFrom", + "versioning.renamedfrom.RenamedFromClient.newOp": "Versioning.RenamedFrom.newOp", + "versioning.renamedfrom.RenamedFromClient.newOpWithResponse": "Versioning.RenamedFrom.newOp", + "versioning.renamedfrom.RenamedFromClientBuilder": "Versioning.RenamedFrom", + "versioning.renamedfrom.models.NewEnum": "Versioning.RenamedFrom.NewEnum", + "versioning.renamedfrom.models.NewModel": "Versioning.RenamedFrom.NewModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_metadata.json new file mode 100644 index 00000000000..4259526620d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-renamedfrom_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"v2","crossLanguageDefinitions":{"versioning.renamedfrom.NewInterfaceAsyncClient":"Versioning.RenamedFrom.NewInterface","versioning.renamedfrom.NewInterfaceAsyncClient.newOpInNewInterface":"Versioning.RenamedFrom.NewInterface.newOpInNewInterface","versioning.renamedfrom.NewInterfaceAsyncClient.newOpInNewInterfaceWithResponse":"Versioning.RenamedFrom.NewInterface.newOpInNewInterface","versioning.renamedfrom.NewInterfaceClient":"Versioning.RenamedFrom.NewInterface","versioning.renamedfrom.NewInterfaceClient.newOpInNewInterface":"Versioning.RenamedFrom.NewInterface.newOpInNewInterface","versioning.renamedfrom.NewInterfaceClient.newOpInNewInterfaceWithResponse":"Versioning.RenamedFrom.NewInterface.newOpInNewInterface","versioning.renamedfrom.RenamedFromAsyncClient":"Versioning.RenamedFrom","versioning.renamedfrom.RenamedFromAsyncClient.newOp":"Versioning.RenamedFrom.newOp","versioning.renamedfrom.RenamedFromAsyncClient.newOpWithResponse":"Versioning.RenamedFrom.newOp","versioning.renamedfrom.RenamedFromClient":"Versioning.RenamedFrom","versioning.renamedfrom.RenamedFromClient.newOp":"Versioning.RenamedFrom.newOp","versioning.renamedfrom.RenamedFromClient.newOpWithResponse":"Versioning.RenamedFrom.newOp","versioning.renamedfrom.RenamedFromClientBuilder":"Versioning.RenamedFrom","versioning.renamedfrom.models.NewEnum":"Versioning.RenamedFrom.NewEnum","versioning.renamedfrom.models.NewModel":"Versioning.RenamedFrom.NewModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/versioning/renamedfrom/NewInterfaceAsyncClient.java","src/main/java/versioning/renamedfrom/NewInterfaceClient.java","src/main/java/versioning/renamedfrom/RenamedFromAsyncClient.java","src/main/java/versioning/renamedfrom/RenamedFromClient.java","src/main/java/versioning/renamedfrom/RenamedFromClientBuilder.java","src/main/java/versioning/renamedfrom/RenamedFromServiceVersion.java","src/main/java/versioning/renamedfrom/implementation/NewInterfacesImpl.java","src/main/java/versioning/renamedfrom/implementation/RenamedFromClientImpl.java","src/main/java/versioning/renamedfrom/implementation/package-info.java","src/main/java/versioning/renamedfrom/models/NewEnum.java","src/main/java/versioning/renamedfrom/models/NewModel.java","src/main/java/versioning/renamedfrom/models/package-info.java","src/main/java/versioning/renamedfrom/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_apiview_properties.json new file mode 100644 index 00000000000..991d9caa878 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_apiview_properties.json @@ -0,0 +1,12 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "versioning.returntypechangedfrom.ReturnTypeChangedFromAsyncClient": "Versioning.ReturnTypeChangedFrom", + "versioning.returntypechangedfrom.ReturnTypeChangedFromAsyncClient.test": "Versioning.ReturnTypeChangedFrom.test", + "versioning.returntypechangedfrom.ReturnTypeChangedFromAsyncClient.testWithResponse": "Versioning.ReturnTypeChangedFrom.test", + "versioning.returntypechangedfrom.ReturnTypeChangedFromClient": "Versioning.ReturnTypeChangedFrom", + "versioning.returntypechangedfrom.ReturnTypeChangedFromClient.test": "Versioning.ReturnTypeChangedFrom.test", + "versioning.returntypechangedfrom.ReturnTypeChangedFromClient.testWithResponse": "Versioning.ReturnTypeChangedFrom.test", + "versioning.returntypechangedfrom.ReturnTypeChangedFromClientBuilder": "Versioning.ReturnTypeChangedFrom" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_metadata.json new file mode 100644 index 00000000000..ee35c59516f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-returntypechangedfrom_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"v2","crossLanguageDefinitions":{"versioning.returntypechangedfrom.ReturnTypeChangedFromAsyncClient":"Versioning.ReturnTypeChangedFrom","versioning.returntypechangedfrom.ReturnTypeChangedFromAsyncClient.test":"Versioning.ReturnTypeChangedFrom.test","versioning.returntypechangedfrom.ReturnTypeChangedFromAsyncClient.testWithResponse":"Versioning.ReturnTypeChangedFrom.test","versioning.returntypechangedfrom.ReturnTypeChangedFromClient":"Versioning.ReturnTypeChangedFrom","versioning.returntypechangedfrom.ReturnTypeChangedFromClient.test":"Versioning.ReturnTypeChangedFrom.test","versioning.returntypechangedfrom.ReturnTypeChangedFromClient.testWithResponse":"Versioning.ReturnTypeChangedFrom.test","versioning.returntypechangedfrom.ReturnTypeChangedFromClientBuilder":"Versioning.ReturnTypeChangedFrom"},"generatedFiles":["src/main/java/module-info.java","src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromAsyncClient.java","src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClient.java","src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClientBuilder.java","src/main/java/versioning/returntypechangedfrom/ReturnTypeChangedFromServiceVersion.java","src/main/java/versioning/returntypechangedfrom/implementation/ReturnTypeChangedFromClientImpl.java","src/main/java/versioning/returntypechangedfrom/implementation/package-info.java","src/main/java/versioning/returntypechangedfrom/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_apiview_properties.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_apiview_properties.json new file mode 100644 index 00000000000..0f0f6a1972a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_apiview_properties.json @@ -0,0 +1,13 @@ +{ + "flavor": "Azure", + "CrossLanguageDefinitionId": { + "versioning.typechangedfrom.TypeChangedFromAsyncClient": "Versioning.TypeChangedFrom", + "versioning.typechangedfrom.TypeChangedFromAsyncClient.test": "Versioning.TypeChangedFrom.test", + "versioning.typechangedfrom.TypeChangedFromAsyncClient.testWithResponse": "Versioning.TypeChangedFrom.test", + "versioning.typechangedfrom.TypeChangedFromClient": "Versioning.TypeChangedFrom", + "versioning.typechangedfrom.TypeChangedFromClient.test": "Versioning.TypeChangedFrom.test", + "versioning.typechangedfrom.TypeChangedFromClient.testWithResponse": "Versioning.TypeChangedFrom.test", + "versioning.typechangedfrom.TypeChangedFromClientBuilder": "Versioning.TypeChangedFrom", + "versioning.typechangedfrom.models.TestModel": "Versioning.TypeChangedFrom.TestModel" + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_metadata.json new file mode 100644 index 00000000000..231b4596ca8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/versioning-typechangedfrom_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersion":"v2","crossLanguageDefinitions":{"versioning.typechangedfrom.TypeChangedFromAsyncClient":"Versioning.TypeChangedFrom","versioning.typechangedfrom.TypeChangedFromAsyncClient.test":"Versioning.TypeChangedFrom.test","versioning.typechangedfrom.TypeChangedFromAsyncClient.testWithResponse":"Versioning.TypeChangedFrom.test","versioning.typechangedfrom.TypeChangedFromClient":"Versioning.TypeChangedFrom","versioning.typechangedfrom.TypeChangedFromClient.test":"Versioning.TypeChangedFrom.test","versioning.typechangedfrom.TypeChangedFromClient.testWithResponse":"Versioning.TypeChangedFrom.test","versioning.typechangedfrom.TypeChangedFromClientBuilder":"Versioning.TypeChangedFrom","versioning.typechangedfrom.models.TestModel":"Versioning.TypeChangedFrom.TestModel"},"generatedFiles":["src/main/java/module-info.java","src/main/java/versioning/typechangedfrom/TypeChangedFromAsyncClient.java","src/main/java/versioning/typechangedfrom/TypeChangedFromClient.java","src/main/java/versioning/typechangedfrom/TypeChangedFromClientBuilder.java","src/main/java/versioning/typechangedfrom/TypeChangedFromServiceVersion.java","src/main/java/versioning/typechangedfrom/implementation/TypeChangedFromClientImpl.java","src/main/java/versioning/typechangedfrom/implementation/package-info.java","src/main/java/versioning/typechangedfrom/models/TestModel.java","src/main/java/versioning/typechangedfrom/models/package-info.java","src/main/java/versioning/typechangedfrom/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-apikey.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-apikey.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-apikey.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-http-custom.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-http-custom.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-http-custom.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-oauth2.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-oauth2.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-oauth2.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-union.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-union.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/authentication-union.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-access.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-access.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-access.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-alternatetype.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-alternatetype.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-alternatetype.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-header.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-header.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-header.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-path.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-path.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-path.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-query.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-query.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-apiversion-query.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientinitialization.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientinitialization.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientinitialization.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientlocation.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientlocation.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-clientlocation.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-deserialize-emptystringnull.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-deserialize-emptystringnull.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-deserialize-emptystringnull.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-flattenproperty.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-flattenproperty.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-flattenproperty.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-hierarchybuilding.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-hierarchybuilding.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-hierarchybuilding.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-methodoverride.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-methodoverride.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-methodoverride.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-nextlinkverb.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-nextlinkverb.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-nextlinkverb.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-usage.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-usage.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-clientgenerator-core-usage.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-basic.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-basic.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-basic.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-rpc.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-rpc.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-rpc.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-standard.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-standard.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-lro-standard.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-model.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-model.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-model.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-page.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-page.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-page.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-scalar.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-scalar.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-scalar.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-traits.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-traits.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-core-traits.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-encode-duration.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-encode-duration.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-encode-duration.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-example-basic.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-example-basic.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-example-basic.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-payload-pageable.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-payload-pageable.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-payload-pageable.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armcustomization-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armcustomization-generated.properties new file mode 100644 index 00000000000..defbd48204e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armcustomization-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armlegacy-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armlegacy-generated.properties new file mode 100644 index 00000000000..defbd48204e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armlegacy-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armresourceprovider-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armresourceprovider-generated.properties new file mode 100644 index 00000000000..defbd48204e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armresourceprovider-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armstreamstyleserialization-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armstreamstyleserialization-generated.properties new file mode 100644 index 00000000000..defbd48204e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armstreamstyleserialization-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armversioned-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armversioned-generated.properties new file mode 100644 index 00000000000..defbd48204e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-armversioned-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-combined-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-combined-generated.properties new file mode 100644 index 00000000000..defbd48204e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-combined-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-commonproperties-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-commonproperties-generated.properties new file mode 100644 index 00000000000..defbd48204e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-commonproperties-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-largeheader-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-largeheader-generated.properties new file mode 100644 index 00000000000..defbd48204e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-largeheader-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-methodsubscriptionid-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-methodsubscriptionid-generated.properties new file mode 100644 index 00000000000..defbd48204e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-methodsubscriptionid-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-nonresource-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-nonresource-generated.properties new file mode 100644 index 00000000000..defbd48204e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-nonresource-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-operationtemplates-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-operationtemplates-generated.properties new file mode 100644 index 00000000000..defbd48204e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-operationtemplates-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-resources-generated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-resources-generated.properties new file mode 100644 index 00000000000..defbd48204e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-resourcemanager-resources-generated.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-specialheaders-xmsclientrequestid.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-specialheaders-xmsclientrequestid.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-specialheaders-xmsclientrequestid.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-versioning-previewversion.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-versioning-previewversion.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/azure-versioning-previewversion.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-clientnamespace.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-clientnamespace.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-clientnamespace.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming-enumconflict.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming-enumconflict.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming-enumconflict.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-naming.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-overload.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-overload.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-overload.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-clientoperationgroup.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-clientoperationgroup.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-clientoperationgroup.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-multiclient.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-multiclient.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-multiclient.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-renamedoperation.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-renamedoperation.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-renamedoperation.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-service.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-service.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-service.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-twooperationgroup.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-twooperationgroup.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/client-structure-twooperationgroup.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/documentation.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/documentation.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/documentation.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-array.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-array.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-array.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-bytes.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-bytes.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-bytes.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-datetime.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-datetime.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-datetime.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-duration.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-duration.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-duration.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-numeric.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-numeric.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/encode-numeric.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-basic.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-basic.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-basic.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-bodyoptionality.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-bodyoptionality.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-bodyoptionality.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-collectionformat.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-collectionformat.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-collectionformat.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-path.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-path.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-path.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-spread.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-spread.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/parameters-spread.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-contentnegotiation.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-contentnegotiation.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-contentnegotiation.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-jsonmergepatch.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-jsonmergepatch.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-jsonmergepatch.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-mediatype.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-mediatype.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-mediatype.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-multipart.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-multipart.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/payload-multipart.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven-v1.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven-v1.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven-v1.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/resiliency-servicedriven.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/response-statuscoderange.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/response-statuscoderange.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/response-statuscoderange.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/routes.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/routes.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/routes.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/serialization-encodedname-json.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/serialization-encodedname-json.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/serialization-encodedname-json.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-endpoint-notdefined.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-endpoint-notdefined.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-endpoint-notdefined.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-multiple.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-multiple.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-multiple.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-single.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-single.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-path-single.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-notversioned.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-notversioned.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-notversioned.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-versioned.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-versioned.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/server-versions-versioned.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/service-multiservice-combined.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/service-multiservice-combined.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/service-multiservice-combined.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-conditionalrequest.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-conditionalrequest.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-conditionalrequest.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-repeatability.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-repeatability.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialheaders-repeatability.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialwords.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialwords.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/specialwords.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/streaming-jsonl.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/streaming-jsonl.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/streaming-jsonl.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-builtin.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-builtin.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-builtin.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-clientinitialization.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-clientinitialization.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-clientinitialization.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-discriminatoredgecases.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-discriminatoredgecases.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-discriminatoredgecases.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumnesteddiscriminator.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumnesteddiscriminator.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumnesteddiscriminator.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumservice.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumservice.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-enumservice.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-errormodel.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-errormodel.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-errormodel.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-flatten.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-flatten.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-flatten.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-internal.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-internal.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-internal.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-literalservice.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-literalservice.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-literalservice.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-longrunning.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-longrunning.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-longrunning.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-methodoverride.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-methodoverride.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-methodoverride.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-model.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-model.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-model.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multicontenttypes.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multicontenttypes.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multicontenttypes.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multipart.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multipart.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-multipart.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namespaceclient.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namespaceclient.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namespaceclient.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-naming.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-naming.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-naming.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namingjavaparser.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namingjavaparser.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-namingjavaparser.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-optional.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-optional.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-optional.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-patch.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-patch.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-patch.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-protocolandconvenient.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-protocolandconvenient.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-protocolandconvenient.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-response.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-response.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-response.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialchars.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialchars.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialchars.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialheaders.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialheaders.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-specialheaders.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-subclass.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-subclass.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-subclass.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-union.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-union.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-union.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-versioning.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-versioning.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-versioning.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-visibility.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-visibility.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-visibility.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-wiretype.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-wiretype.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-wiretype.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-array.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-array.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-array.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-dictionary.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-dictionary.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-dictionary.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-extensible.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-extensible.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-extensible.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-fixed.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-fixed.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-enums-fixed.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-empty.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-empty.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-empty.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-enumdiscriminator.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-enumdiscriminator.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-enumdiscriminator.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-nesteddiscriminator.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-nesteddiscriminator.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-nesteddiscriminator.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-notdiscriminated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-notdiscriminated.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-notdiscriminated.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-recursive.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-recursive.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-recursive.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-singlediscriminator.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-singlediscriminator.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-inheritance-singlediscriminator.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-usage.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-usage.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-usage.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-visibility.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-visibility.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-model-visibility.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-additionalproperties.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-additionalproperties.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-additionalproperties.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-nullable.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-nullable.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-nullable.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-optional.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-optional.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-optional.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-valuetypes.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-valuetypes.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-property-valuetypes.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-scalar.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-scalar.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-scalar.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union-discriminated.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union-discriminated.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union-discriminated.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/type-union.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-added.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-added.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-added.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-madeoptional.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-madeoptional.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-madeoptional.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-removed.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-removed.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-removed.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-renamedfrom.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-renamedfrom.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-renamedfrom.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-returntypechangedfrom.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-returntypechangedfrom.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-returntypechangedfrom.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-typechangedfrom.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-typechangedfrom.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/versioning-typechangedfrom.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/azure/example/basic/generated/BasicAction.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/azure/example/basic/generated/BasicAction.java new file mode 100644 index 00000000000..245407b1313 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/azure/example/basic/generated/BasicAction.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.example.basic.generated; + +import azure.example.basic.AzureExampleClient; +import azure.example.basic.AzureExampleClientBuilder; +import azure.example.basic.models.ActionRequest; +import azure.example.basic.models.ActionResponse; +import azure.example.basic.models.Enum; +import azure.example.basic.models.Model; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +public class BasicAction { + public static void main(String[] args) { + AzureExampleClient azureExampleClient + = new AzureExampleClientBuilder().endpoint("http://localhost:3000").buildClient(); + // BEGIN:azure.example.basic.generated.basic-action.basic-action + ActionResponse response = azureExampleClient.basicAction("query", "header", + new ActionRequest("text") + .setModelProperty( + new Model().setInt32Property(1).setFloat32Property(1.5D).setEnumProperty(Enum.ENUM_VALUE1)) + .setArrayProperty(Arrays.asList("item")) + .setRecordProperty(mapOf("record", "value"))); + // END:azure.example.basic.generated.basic-action.basic-action + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpRead.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpRead.java new file mode 100644 index 00000000000..d6e2abe2255 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpRead.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.builtin.generated; + +import com.azure.core.util.Configuration; +import tsptest.builtin.BuiltinClient; +import tsptest.builtin.BuiltinClientBuilder; +import tsptest.builtin.models.Builtin; + +public class BuiltinOpRead { + public static void main(String[] args) { + BuiltinClient builtinClient + = new BuiltinClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")).buildClient(); + // BEGIN:tsptest.builtin.generated.builtin-op-read.builtin-op-read + Builtin response = builtinClient.read(null, null, null, "myFilter", null, null); + // END:tsptest.builtin.generated.builtin-op-read.builtin-op-read + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpWrite.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpWrite.java new file mode 100644 index 00000000000..daabacae809 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/builtin/generated/BuiltinOpWrite.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.builtin.generated; + +import com.azure.core.util.Configuration; +import java.time.Duration; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import tsptest.builtin.BuiltinClient; +import tsptest.builtin.BuiltinClientBuilder; +import tsptest.builtin.models.Builtin; +import tsptest.builtin.models.Encoded; + +public class BuiltinOpWrite { + public static void main(String[] args) { + BuiltinClient builtinClient + = new BuiltinClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")).buildClient(); + // BEGIN:tsptest.builtin.generated.builtin-op-write.builtin-op-write + builtinClient.write(new Builtin(true, "myString", null, 0, 32L, null, 64L, 32.0, 64.0, Duration.parse("PT15M"), + LocalDate.parse("2023-08-29"), OffsetDateTime.parse("2019-10-12T07:20:50.520Z"), + Arrays.asList("a", "b", "c"), null, "https://www.github.com", + mapOf("max", 15.0D, "min", 14.0D, "average", 14.3D), + new Encoded().setTimeInSeconds(Duration.parse("PT15M")) + .setTimeInSecondsFraction(Duration.parse("PT20M0.345S")) + .setDateTime(OffsetDateTime.parse("1966-03-03T00:06:56.52Z")) + .setDateTimeRfc7231(OffsetDateTime.parse("1994-11-06T08:49:37Z")) + .setUnixTimestamp(OffsetDateTime.parse("2023-08-30T02:35:03Z")) + .setBase64("aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==".getBytes()) + .setBase64url("aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==".getBytes()) + .setCommaDeliminatedArray(Arrays.asList("a", "b", "c")), + null)); + // END:tsptest.builtin.generated.builtin-op-write.builtin-op-write + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSend.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSend.java new file mode 100644 index 00000000000..fca52e8cf66 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSend.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.generated; + +import com.azure.core.util.Configuration; +import tsptest.flatten.FlattenClient; +import tsptest.flatten.FlattenClientBuilder; +import tsptest.flatten.models.User; + +public class FlattenOpSend { + public static void main(String[] args) { + FlattenClient flattenClient + = new FlattenClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")).buildClient(); + // BEGIN:tsptest.flatten.generated.send.flatten-op-send + flattenClient.send("myRequiredId", null, "myRequiredInput", 0, 50, new User("myOptionalUser")); + // END:tsptest.flatten.generated.send.flatten-op-send + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSendLong.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSendLong.java new file mode 100644 index 00000000000..60132dd01f2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/flatten/generated/FlattenOpSendLong.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.generated; + +import com.azure.core.util.Configuration; +import tsptest.flatten.FlattenClient; +import tsptest.flatten.FlattenClientBuilder; +import tsptest.flatten.models.SendLongOptions; +import tsptest.flatten.models.SendLongRequestStatus; +import tsptest.flatten.models.User; + +public class FlattenOpSendLong { + public static void main(String[] args) { + FlattenClient flattenClient + = new FlattenClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")).buildClient(); + // BEGIN:tsptest.flatten.generated.send-long.flatten-op-send-long + flattenClient.sendLong( + new SendLongOptions("myRequiredId", "myRequiredInput", 11, null, "title", SendLongRequestStatus.NOT_STARTED) + .setFilter("name=myName") + .setUser(new User("myOptionalUser")) + .setDataIntOptional(12) + .setDataLong(13L) + .setDataFloat(14.0D) + .setDescription("description")); + // END:tsptest.flatten.generated.send-long.flatten-op-send-long + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/longrunning/generated/LongRunningCreateJob.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/longrunning/generated/LongRunningCreateJob.java new file mode 100644 index 00000000000..83751b149b7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/longrunning/generated/LongRunningCreateJob.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.generated; + +import com.azure.core.util.Configuration; +import com.azure.core.util.polling.SyncPoller; +import java.util.HashMap; +import java.util.Map; +import tsptest.longrunning.LongRunningClient; +import tsptest.longrunning.LongRunningClientBuilder; +import tsptest.longrunning.models.JobData; +import tsptest.longrunning.models.JobResult; +import tsptest.longrunning.models.JobResultResult; + +public class LongRunningCreateJob { + public static void main(String[] args) { + LongRunningClient longRunningClient + = new LongRunningClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:tsptest.longrunning.generated.create-job.long-running-create-job + SyncPoller response = longRunningClient + .beginCreateJob(new JobData(mapOf("max", 15.0D, "min", 14.0D, "average", 14.3D)).setConfiguration("{}")); + // END:tsptest.longrunning.generated.create-job.long-running-create-job + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/model/generated/ModelOpPutNested.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/model/generated/ModelOpPutNested.java new file mode 100644 index 00000000000..8a31ccb2712 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/model/generated/ModelOpPutNested.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.generated; + +import com.azure.core.util.Configuration; +import tsptest.model.ModelClient; +import tsptest.model.ModelClientBuilder; +import tsptest.model.models.NestedModel; + +public class ModelOpPutNested { + public static void main(String[] args) { + ModelClient modelClient + = new ModelClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")).buildClient(); + // BEGIN:tsptest.model.generated.model-op-put-nested.model-op-put-nested + NestedModel response = modelClient.putNested(null); + // END:tsptest.model.generated.model-op-put-nested.model-op-put-nested + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentType.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentType.java new file mode 100644 index 00000000000..eb614198330 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentType.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes.generated; + +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import java.nio.charset.StandardCharsets; +import tsptest.multicontenttypes.MultiContentTypesClientBuilder; +import tsptest.multicontenttypes.SingleContentTypeClient; + +public class SingleContentTypeUploadImageForSingleContentType { + public static void main(String[] args) { + SingleContentTypeClient singleContentTypeClient + = new MultiContentTypesClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildSingleContentTypeClient(); + // BEGIN:tsptest.multicontenttypes.generated.single-content-type-upload-image-for-single-content-type.single-content-type-upload-image-for-single-content-type + singleContentTypeClient.uploadImageForSingleContentType( + BinaryData.fromBytes("\"D:\\Program Files\"".getBytes(StandardCharsets.UTF_8))); + // END:tsptest.multicontenttypes.generated.single-content-type-upload-image-for-single-content-type.single-content-type-upload-image-for-single-content-type + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpExists.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpExists.java new file mode 100644 index 00000000000..76d3e2ce7db --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpExists.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.generated; + +import com.azure.core.util.Configuration; +import tsptest.response.ResponseClient; +import tsptest.response.ResponseClientBuilder; + +public class ResponseOpExists { + public static void main(String[] args) { + ResponseClient responseClient + = new ResponseClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:tsptest.response.generated.exists.response-op-exists + boolean response = responseClient.exists(); + // END:tsptest.response.generated.exists.response-op-exists + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpListStrings.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpListStrings.java new file mode 100644 index 00000000000..89a4560026f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/response/generated/ResponseOpListStrings.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.generated; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Configuration; +import tsptest.response.ResponseClient; +import tsptest.response.ResponseClientBuilder; + +public class ResponseOpListStrings { + public static void main(String[] args) { + ResponseClient responseClient + = new ResponseClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:tsptest.response.generated.list-strings.response-op-list-strings + PagedIterable response = responseClient.listStrings(); + // END:tsptest.response.generated.list-strings.response-op-list-strings + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialchars/generated/BuiltinOpRead.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialchars/generated/BuiltinOpRead.java new file mode 100644 index 00000000000..4dd26ace46b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialchars/generated/BuiltinOpRead.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialchars.generated; + +import com.azure.core.util.Configuration; +import tsptest.specialchars.SpecialCharsClient; +import tsptest.specialchars.SpecialCharsClientBuilder; +import tsptest.specialchars.models.Resource; + +public class BuiltinOpRead { + public static void main(String[] args) { + SpecialCharsClient specialCharsClient + = new SpecialCharsClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:tsptest.specialchars.generated.builtin-op-read.builtin-op-read + Resource response = specialCharsClient.read(null); + // END:tsptest.specialchars.generated.builtin-op-read.builtin-op-read + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersListWithEtag.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersListWithEtag.java new file mode 100644 index 00000000000..a5540ca7d34 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersListWithEtag.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.generated; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Configuration; +import tsptest.specialheaders.EtagHeadersClient; +import tsptest.specialheaders.SpecialHeadersClientBuilder; +import tsptest.specialheaders.models.Resource; + +public class EtagHeadersListWithEtag { + public static void main(String[] args) { + EtagHeadersClient etagHeadersClient + = new SpecialHeadersClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildEtagHeadersClient(); + // BEGIN:tsptest.specialheaders.generated.etag-headers-list-with-etag.etag-headers-list-with-etag + PagedIterable response = etagHeadersClient.listWithEtag(); + // END:tsptest.specialheaders.generated.etag-headers-list-with-etag.etag-headers-list-with-etag + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeaders.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeaders.java new file mode 100644 index 00000000000..14c07ba70e8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeaders.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.generated; + +import com.azure.core.http.RequestConditions; +import com.azure.core.util.Configuration; +import tsptest.specialheaders.EtagHeadersClient; +import tsptest.specialheaders.SpecialHeadersClientBuilder; +import tsptest.specialheaders.models.Resource; + +public class EtagHeadersPutWithRequestHeaders { + public static void main(String[] args) { + EtagHeadersClient etagHeadersClient + = new SpecialHeadersClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildEtagHeadersClient(); + // BEGIN:tsptest.specialheaders.generated.etag-headers-put-with-request-headers.etag-headers-put-with-request-headers + Resource response = etagHeadersClient.putWithRequestHeaders("name", + new Resource().setDescription("This is sample for Etag headers").setType("myType"), + new RequestConditions().setIfMatch("\"64e005\"")); + // END:tsptest.specialheaders.generated.etag-headers-put-with-request-headers.etag-headers-put-with-request-headers + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/versioning/generated/VersioningOpList.java b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/versioning/generated/VersioningOpList.java new file mode 100644 index 00000000000..85f33ac976f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/samples/java/tsptest/versioning/generated/VersioningOpList.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning.generated; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Configuration; +import java.util.Arrays; +import tsptest.versioning.VersioningClient; +import tsptest.versioning.VersioningClientBuilder; +import tsptest.versioning.models.Resource; + +public class VersioningOpList { + public static void main(String[] args) { + VersioningClient versioningClient + = new VersioningClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:tsptest.versioning.generated.versioning-op-list.versioning-op-list + PagedIterable response = versioningClient.list(Arrays.asList("name=name"), null); + // END:tsptest.versioning.generated.versioning-op-list.versioning-op-list + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/apikey/generated/ApiKeyClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/apikey/generated/ApiKeyClientTestBase.java new file mode 100644 index 00000000000..def14e7d7c6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/apikey/generated/ApiKeyClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.apikey.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import authentication.apikey.ApiKeyClient; +import authentication.apikey.ApiKeyClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class ApiKeyClientTestBase extends TestProxyTestBase { + protected ApiKeyClient apiKeyClient; + + @Override + protected void beforeTest() { + ApiKeyClientBuilder apiKeyClientbuilder = new ApiKeyClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + apiKeyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + apiKeyClient = apiKeyClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/http/custom/generated/CustomClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/http/custom/generated/CustomClientTestBase.java new file mode 100644 index 00000000000..378314a1d3c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/http/custom/generated/CustomClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.http.custom.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import authentication.http.custom.CustomClient; +import authentication.http.custom.CustomClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class CustomClientTestBase extends TestProxyTestBase { + protected CustomClient customClient; + + @Override + protected void beforeTest() { + CustomClientBuilder customClientbuilder = new CustomClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + customClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + customClient = customClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/oauth2/generated/OAuth2ClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/oauth2/generated/OAuth2ClientTestBase.java new file mode 100644 index 00000000000..1ef211fea3a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/oauth2/generated/OAuth2ClientTestBase.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.oauth2.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import authentication.oauth2.OAuth2Client; +import authentication.oauth2.OAuth2ClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.test.utils.MockTokenCredential; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +class OAuth2ClientTestBase extends TestProxyTestBase { + protected OAuth2Client oAuth2Client; + + @Override + protected void beforeTest() { + OAuth2ClientBuilder oAuth2Clientbuilder = new OAuth2ClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + oAuth2Clientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + oAuth2Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + oAuth2Clientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + oAuth2Client = oAuth2Clientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/union/generated/UnionClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/union/generated/UnionClientTestBase.java new file mode 100644 index 00000000000..49878353b43 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/authentication/union/generated/UnionClientTestBase.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package authentication.union.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import authentication.union.UnionClient; +import authentication.union.UnionClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.test.utils.MockTokenCredential; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +class UnionClientTestBase extends TestProxyTestBase { + protected UnionClient unionClient; + + @Override + protected void beforeTest() { + UnionClientBuilder unionClientbuilder = new UnionClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + unionClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + unionClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + unionClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + unionClient = unionClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/access/generated/AccessClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/access/generated/AccessClientTestBase.java new file mode 100644 index 00000000000..b76c4f1c9d4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/access/generated/AccessClientTestBase.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.access.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.access.AccessClientBuilder; +import azure.clientgenerator.core.access.InternalOperationClient; +import azure.clientgenerator.core.access.PublicOperationClient; +import azure.clientgenerator.core.access.RelativeModelInOperationClient; +import azure.clientgenerator.core.access.SharedModelInOperationClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class AccessClientTestBase extends TestProxyTestBase { + protected PublicOperationClient publicOperationClient; + + protected InternalOperationClient internalOperationClient; + + protected SharedModelInOperationClient sharedModelInOperationClient; + + protected RelativeModelInOperationClient relativeModelInOperationClient; + + @Override + protected void beforeTest() { + AccessClientBuilder publicOperationClientbuilder = new AccessClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + publicOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + publicOperationClient = publicOperationClientbuilder.buildPublicOperationClient(); + + AccessClientBuilder internalOperationClientbuilder = new AccessClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + internalOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + internalOperationClient = internalOperationClientbuilder.buildInternalOperationClient(); + + AccessClientBuilder sharedModelInOperationClientbuilder = new AccessClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + sharedModelInOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + sharedModelInOperationClient = sharedModelInOperationClientbuilder.buildSharedModelInOperationClient(); + + AccessClientBuilder relativeModelInOperationClientbuilder = new AccessClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + relativeModelInOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + relativeModelInOperationClient = relativeModelInOperationClientbuilder.buildRelativeModelInOperationClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/alternatetype/generated/AlternateTypeClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/alternatetype/generated/AlternateTypeClientTestBase.java new file mode 100644 index 00000000000..31de5ac4b24 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/alternatetype/generated/AlternateTypeClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.alternatetype.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.alternatetype.AlternateTypeClient; +import azure.clientgenerator.core.alternatetype.AlternateTypeClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class AlternateTypeClientTestBase extends TestProxyTestBase { + protected AlternateTypeClient alternateTypeClient; + + @Override + protected void beforeTest() { + AlternateTypeClientBuilder alternateTypeClientbuilder = new AlternateTypeClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + alternateTypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + alternateTypeClient = alternateTypeClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/header/generated/HeaderClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/header/generated/HeaderClientTestBase.java new file mode 100644 index 00000000000..474a3ae6474 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/header/generated/HeaderClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.header.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.apiversion.header.HeaderClient; +import azure.clientgenerator.core.apiversion.header.HeaderClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class HeaderClientTestBase extends TestProxyTestBase { + protected HeaderClient headerClient; + + @Override + protected void beforeTest() { + HeaderClientBuilder headerClientbuilder = new HeaderClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + headerClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + headerClient = headerClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/path/generated/PathClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/path/generated/PathClientTestBase.java new file mode 100644 index 00000000000..ac80074243c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/path/generated/PathClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.path.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.apiversion.path.PathClient; +import azure.clientgenerator.core.apiversion.path.PathClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class PathClientTestBase extends TestProxyTestBase { + protected PathClient pathClient; + + @Override + protected void beforeTest() { + PathClientBuilder pathClientbuilder = new PathClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathClient = pathClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/query/generated/QueryClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/query/generated/QueryClientTestBase.java new file mode 100644 index 00000000000..2c87eea46ad --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/apiversion/query/generated/QueryClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.apiversion.query.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.apiversion.query.QueryClient; +import azure.clientgenerator.core.apiversion.query.QueryClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class QueryClientTestBase extends TestProxyTestBase { + protected QueryClient queryClient; + + @Override + protected void beforeTest() { + QueryClientBuilder queryClientbuilder = new QueryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + queryClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + queryClient = queryClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientinitialization/generated/HeaderParamClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientinitialization/generated/HeaderParamClientTestBase.java new file mode 100644 index 00000000000..16d677e966d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientinitialization/generated/HeaderParamClientTestBase.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientinitialization.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.clientinitialization.HeaderParamClient; +import azure.clientgenerator.core.clientinitialization.HeaderParamClientBuilder; +import azure.clientgenerator.core.clientinitialization.MixedParamsClient; +import azure.clientgenerator.core.clientinitialization.MixedParamsClientBuilder; +import azure.clientgenerator.core.clientinitialization.MultipleParamsClient; +import azure.clientgenerator.core.clientinitialization.MultipleParamsClientBuilder; +import azure.clientgenerator.core.clientinitialization.ParamAliasClient; +import azure.clientgenerator.core.clientinitialization.ParamAliasClientBuilder; +import azure.clientgenerator.core.clientinitialization.PathParamClient; +import azure.clientgenerator.core.clientinitialization.PathParamClientBuilder; +import azure.clientgenerator.core.clientinitialization.parentclient.ChildClient; +import azure.clientgenerator.core.clientinitialization.parentclient.ChildClientBuilder; +import azure.clientgenerator.core.clientinitialization.parentclient.ParentClient; +import azure.clientgenerator.core.clientinitialization.parentclient.ParentClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class HeaderParamClientTestBase extends TestProxyTestBase { + protected HeaderParamClient headerParamClient; + + protected MultipleParamsClient multipleParamsClient; + + protected MixedParamsClient mixedParamsClient; + + protected PathParamClient pathParamClient; + + protected ParamAliasClient paramAliasClient; + + protected ChildClient childClient; + + protected ParentClient parentClient; + + @Override + protected void beforeTest() { + HeaderParamClientBuilder headerParamClientbuilder = new HeaderParamClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .name(Configuration.getGlobalConfiguration().get("NAME", "name")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + headerParamClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + headerParamClient = headerParamClientbuilder.buildClient(); + + MultipleParamsClientBuilder multipleParamsClientbuilder = new MultipleParamsClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .name(Configuration.getGlobalConfiguration().get("NAME", "name")) + .region(Configuration.getGlobalConfiguration().get("REGION", "region")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + multipleParamsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + multipleParamsClient = multipleParamsClientbuilder.buildClient(); + + MixedParamsClientBuilder mixedParamsClientbuilder = new MixedParamsClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .name(Configuration.getGlobalConfiguration().get("NAME", "name")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + mixedParamsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + mixedParamsClient = mixedParamsClientbuilder.buildClient(); + + PathParamClientBuilder pathParamClientbuilder = new PathParamClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .blobName(Configuration.getGlobalConfiguration().get("BLOBNAME", "blobname")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathParamClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathParamClient = pathParamClientbuilder.buildClient(); + + ParamAliasClientBuilder paramAliasClientbuilder = new ParamAliasClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .blobName(Configuration.getGlobalConfiguration().get("BLOBNAME", "blobname")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + paramAliasClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + paramAliasClient = paramAliasClientbuilder.buildClient(); + + ChildClientBuilder childClientbuilder = new ChildClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .blobName(Configuration.getGlobalConfiguration().get("BLOBNAME", "blobname")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + childClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + childClient = childClientbuilder.buildClient(); + + ParentClientBuilder parentClientbuilder = new ParentClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + parentClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + parentClient = parentClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientlocation/generated/ClientLocationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientlocation/generated/ClientLocationClientTestBase.java new file mode 100644 index 00000000000..6886b0f18f0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/clientlocation/generated/ClientLocationClientTestBase.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.clientlocation.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.clientlocation.ArchiveOperationsClient; +import azure.clientgenerator.core.clientlocation.ClientLocationClient; +import azure.clientgenerator.core.clientlocation.ClientLocationClientBuilder; +import azure.clientgenerator.core.clientlocation.MoveMethodParameterToBlobOperationsClient; +import azure.clientgenerator.core.clientlocation.MoveToExistingSubAdminOperationsClient; +import azure.clientgenerator.core.clientlocation.MoveToExistingSubUserOperationsClient; +import azure.clientgenerator.core.clientlocation.MoveToNewSubProductOperationsClient; +import azure.clientgenerator.core.clientlocation.MoveToRootResourceOperationsClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class ClientLocationClientTestBase extends TestProxyTestBase { + protected ClientLocationClient clientLocationClient; + + protected MoveToExistingSubAdminOperationsClient moveToExistingSubAdminOperationsClient; + + protected MoveToExistingSubUserOperationsClient moveToExistingSubUserOperationsClient; + + protected MoveToNewSubProductOperationsClient moveToNewSubProductOperationsClient; + + protected MoveToRootResourceOperationsClient moveToRootResourceOperationsClient; + + protected MoveMethodParameterToBlobOperationsClient moveMethodParameterToBlobOperationsClient; + + protected ArchiveOperationsClient archiveOperationsClient; + + @Override + protected void beforeTest() { + ClientLocationClientBuilder clientLocationClientbuilder = new ClientLocationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + clientLocationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + clientLocationClient = clientLocationClientbuilder.buildClient(); + + ClientLocationClientBuilder moveToExistingSubAdminOperationsClientbuilder = new ClientLocationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + moveToExistingSubAdminOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + moveToExistingSubAdminOperationsClient + = moveToExistingSubAdminOperationsClientbuilder.buildMoveToExistingSubAdminOperationsClient(); + + ClientLocationClientBuilder moveToExistingSubUserOperationsClientbuilder = new ClientLocationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + moveToExistingSubUserOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + moveToExistingSubUserOperationsClient + = moveToExistingSubUserOperationsClientbuilder.buildMoveToExistingSubUserOperationsClient(); + + ClientLocationClientBuilder moveToNewSubProductOperationsClientbuilder = new ClientLocationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + moveToNewSubProductOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + moveToNewSubProductOperationsClient + = moveToNewSubProductOperationsClientbuilder.buildMoveToNewSubProductOperationsClient(); + + ClientLocationClientBuilder moveToRootResourceOperationsClientbuilder = new ClientLocationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + moveToRootResourceOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + moveToRootResourceOperationsClient + = moveToRootResourceOperationsClientbuilder.buildMoveToRootResourceOperationsClient(); + + ClientLocationClientBuilder moveMethodParameterToBlobOperationsClientbuilder = new ClientLocationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + moveMethodParameterToBlobOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + moveMethodParameterToBlobOperationsClient + = moveMethodParameterToBlobOperationsClientbuilder.buildMoveMethodParameterToBlobOperationsClient(); + + ClientLocationClientBuilder archiveOperationsClientbuilder = new ClientLocationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .storageAccount(Configuration.getGlobalConfiguration().get("STORAGEACCOUNT", "storageaccount")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + archiveOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + archiveOperationsClient = archiveOperationsClientbuilder.buildArchiveOperationsClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/deserialize/emptystringnull/generated/DeserializeEmptyStringAsNullClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/deserialize/emptystringnull/generated/DeserializeEmptyStringAsNullClientTestBase.java new file mode 100644 index 00000000000..595296653eb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/deserialize/emptystringnull/generated/DeserializeEmptyStringAsNullClientTestBase.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.deserialize.emptystringnull.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClient; +import azure.clientgenerator.core.deserialize.emptystringnull.DeserializeEmptyStringAsNullClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class DeserializeEmptyStringAsNullClientTestBase extends TestProxyTestBase { + protected DeserializeEmptyStringAsNullClient deserializeEmptyStringAsNullClient; + + @Override + protected void beforeTest() { + DeserializeEmptyStringAsNullClientBuilder deserializeEmptyStringAsNullClientbuilder + = new DeserializeEmptyStringAsNullClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + deserializeEmptyStringAsNullClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + deserializeEmptyStringAsNullClient = deserializeEmptyStringAsNullClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/flattenproperty/generated/FlattenPropertyClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/flattenproperty/generated/FlattenPropertyClientTestBase.java new file mode 100644 index 00000000000..c8d833fc248 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/flattenproperty/generated/FlattenPropertyClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.flattenproperty.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.flattenproperty.FlattenPropertyClient; +import azure.clientgenerator.core.flattenproperty.FlattenPropertyClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class FlattenPropertyClientTestBase extends TestProxyTestBase { + protected FlattenPropertyClient flattenPropertyClient; + + @Override + protected void beforeTest() { + FlattenPropertyClientBuilder flattenPropertyClientbuilder = new FlattenPropertyClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + flattenPropertyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + flattenPropertyClient = flattenPropertyClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/hierarchybuilding/generated/HierarchyBuildingClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/hierarchybuilding/generated/HierarchyBuildingClientTestBase.java new file mode 100644 index 00000000000..74869f676d6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/hierarchybuilding/generated/HierarchyBuildingClientTestBase.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.hierarchybuilding.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.hierarchybuilding.AnimalOperationsClient; +import azure.clientgenerator.core.hierarchybuilding.DogOperationsClient; +import azure.clientgenerator.core.hierarchybuilding.HierarchyBuildingClientBuilder; +import azure.clientgenerator.core.hierarchybuilding.PetOperationsClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class HierarchyBuildingClientTestBase extends TestProxyTestBase { + protected AnimalOperationsClient animalOperationsClient; + + protected PetOperationsClient petOperationsClient; + + protected DogOperationsClient dogOperationsClient; + + @Override + protected void beforeTest() { + HierarchyBuildingClientBuilder animalOperationsClientbuilder = new HierarchyBuildingClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + animalOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + animalOperationsClient = animalOperationsClientbuilder.buildAnimalOperationsClient(); + + HierarchyBuildingClientBuilder petOperationsClientbuilder = new HierarchyBuildingClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + petOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + petOperationsClient = petOperationsClientbuilder.buildPetOperationsClient(); + + HierarchyBuildingClientBuilder dogOperationsClientbuilder = new HierarchyBuildingClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + dogOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + dogOperationsClient = dogOperationsClientbuilder.buildDogOperationsClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/methodoverride/generated/OverrideClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/methodoverride/generated/OverrideClientTestBase.java new file mode 100644 index 00000000000..2ac2556e974 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/methodoverride/generated/OverrideClientTestBase.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.methodoverride.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.methodoverride.GroupParametersClient; +import azure.clientgenerator.core.methodoverride.OverrideClientBuilder; +import azure.clientgenerator.core.methodoverride.RemoveOptionalParameterClient; +import azure.clientgenerator.core.methodoverride.ReorderParametersClient; +import azure.clientgenerator.core.methodoverride.RequireOptionalParameterClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class OverrideClientTestBase extends TestProxyTestBase { + protected ReorderParametersClient reorderParametersClient; + + protected GroupParametersClient groupParametersClient; + + protected RequireOptionalParameterClient requireOptionalParameterClient; + + protected RemoveOptionalParameterClient removeOptionalParameterClient; + + @Override + protected void beforeTest() { + OverrideClientBuilder reorderParametersClientbuilder = new OverrideClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + reorderParametersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + reorderParametersClient = reorderParametersClientbuilder.buildReorderParametersClient(); + + OverrideClientBuilder groupParametersClientbuilder = new OverrideClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + groupParametersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + groupParametersClient = groupParametersClientbuilder.buildGroupParametersClient(); + + OverrideClientBuilder requireOptionalParameterClientbuilder = new OverrideClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + requireOptionalParameterClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + requireOptionalParameterClient = requireOptionalParameterClientbuilder.buildRequireOptionalParameterClient(); + + OverrideClientBuilder removeOptionalParameterClientbuilder = new OverrideClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + removeOptionalParameterClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + removeOptionalParameterClient = removeOptionalParameterClientbuilder.buildRemoveOptionalParameterClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/nextlinkverb/generated/NextLinkVerbClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/nextlinkverb/generated/NextLinkVerbClientTestBase.java new file mode 100644 index 00000000000..a32b4984cd7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/nextlinkverb/generated/NextLinkVerbClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.nextlinkverb.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.nextlinkverb.NextLinkVerbClient; +import azure.clientgenerator.core.nextlinkverb.NextLinkVerbClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class NextLinkVerbClientTestBase extends TestProxyTestBase { + protected NextLinkVerbClient nextLinkVerbClient; + + @Override + protected void beforeTest() { + NextLinkVerbClientBuilder nextLinkVerbClientbuilder = new NextLinkVerbClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + nextLinkVerbClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + nextLinkVerbClient = nextLinkVerbClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/usage/generated/UsageClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/usage/generated/UsageClientTestBase.java new file mode 100644 index 00000000000..b2185ab0cb5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/clientgenerator/core/usage/generated/UsageClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.clientgenerator.core.usage.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.clientgenerator.core.usage.UsageClient; +import azure.clientgenerator.core.usage.UsageClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class UsageClientTestBase extends TestProxyTestBase { + protected UsageClient usageClient; + + @Override + protected void beforeTest() { + UsageClientBuilder usageClientbuilder = new UsageClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + usageClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + usageClient = usageClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/basic/generated/BasicClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/basic/generated/BasicClientTestBase.java new file mode 100644 index 00000000000..6c3873f4ca3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/basic/generated/BasicClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.basic.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.core.basic.BasicClient; +import azure.core.basic.BasicClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class BasicClientTestBase extends TestProxyTestBase { + protected BasicClient basicClient; + + @Override + protected void beforeTest() { + BasicClientBuilder basicClientbuilder = new BasicClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + basicClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + basicClient = basicClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/rpc/generated/RpcClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/rpc/generated/RpcClientTestBase.java new file mode 100644 index 00000000000..5aee892ce5a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/rpc/generated/RpcClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.rpc.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.core.lro.rpc.RpcClient; +import azure.core.lro.rpc.RpcClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class RpcClientTestBase extends TestProxyTestBase { + protected RpcClient rpcClient; + + @Override + protected void beforeTest() { + RpcClientBuilder rpcClientbuilder = new RpcClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + rpcClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + rpcClient = rpcClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/standard/generated/StandardClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/standard/generated/StandardClientTestBase.java new file mode 100644 index 00000000000..4e1942d4967 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/lro/standard/generated/StandardClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.lro.standard.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.core.lro.standard.StandardClient; +import azure.core.lro.standard.StandardClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class StandardClientTestBase extends TestProxyTestBase { + protected StandardClient standardClient; + + @Override + protected void beforeTest() { + StandardClientBuilder standardClientbuilder = new StandardClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + standardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + standardClient = standardClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/model/generated/ModelClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/model/generated/ModelClientTestBase.java new file mode 100644 index 00000000000..ad31efa5c9d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/model/generated/ModelClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.model.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.core.model.ModelClient; +import azure.core.model.ModelClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class ModelClientTestBase extends TestProxyTestBase { + protected ModelClient modelClient; + + @Override + protected void beforeTest() { + ModelClientBuilder modelClientbuilder = new ModelClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + modelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + modelClient = modelClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/page/generated/PageClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/page/generated/PageClientTestBase.java new file mode 100644 index 00000000000..c9b74851b8b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/page/generated/PageClientTestBase.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.page.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.core.page.PageClient; +import azure.core.page.PageClientBuilder; +import azure.core.page.TwoModelsAsPageItemClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class PageClientTestBase extends TestProxyTestBase { + protected PageClient pageClient; + + protected TwoModelsAsPageItemClient twoModelsAsPageItemClient; + + @Override + protected void beforeTest() { + PageClientBuilder pageClientbuilder = new PageClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pageClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pageClient = pageClientbuilder.buildClient(); + + PageClientBuilder twoModelsAsPageItemClientbuilder = new PageClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + twoModelsAsPageItemClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + twoModelsAsPageItemClient = twoModelsAsPageItemClientbuilder.buildTwoModelsAsPageItemClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/scalar/generated/ScalarClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/scalar/generated/ScalarClientTestBase.java new file mode 100644 index 00000000000..36cf0c939ca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/scalar/generated/ScalarClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.scalar.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.core.scalar.ScalarClient; +import azure.core.scalar.ScalarClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class ScalarClientTestBase extends TestProxyTestBase { + protected ScalarClient scalarClient; + + @Override + protected void beforeTest() { + ScalarClientBuilder scalarClientbuilder = new ScalarClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + scalarClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + scalarClient = scalarClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/traits/generated/TraitsClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/traits/generated/TraitsClientTestBase.java new file mode 100644 index 00000000000..c92e418b805 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/core/traits/generated/TraitsClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.core.traits.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.core.traits.TraitsClient; +import azure.core.traits.TraitsClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class TraitsClientTestBase extends TestProxyTestBase { + protected TraitsClient traitsClient; + + @Override + protected void beforeTest() { + TraitsClientBuilder traitsClientbuilder = new TraitsClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + traitsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + traitsClient = traitsClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/encode/duration/generated/DurationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/encode/duration/generated/DurationClientTestBase.java new file mode 100644 index 00000000000..80f6bcc786b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/encode/duration/generated/DurationClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.encode.duration.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.encode.duration.DurationClient; +import azure.encode.duration.DurationClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class DurationClientTestBase extends TestProxyTestBase { + protected DurationClient durationClient; + + @Override + protected void beforeTest() { + DurationClientBuilder durationClientbuilder = new DurationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + durationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + durationClient = durationClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/AzureExampleClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/AzureExampleClientTestBase.java new file mode 100644 index 00000000000..2362cab6525 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/AzureExampleClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.example.basic.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.example.basic.AzureExampleClient; +import azure.example.basic.AzureExampleClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class AzureExampleClientTestBase extends TestProxyTestBase { + protected AzureExampleClient azureExampleClient; + + @Override + protected void beforeTest() { + AzureExampleClientBuilder azureExampleClientbuilder = new AzureExampleClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + azureExampleClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + azureExampleClient = azureExampleClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/BasicActionTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/BasicActionTests.java new file mode 100644 index 00000000000..326af4d4f2c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/example/basic/generated/BasicActionTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.example.basic.generated; + +import azure.example.basic.models.ActionRequest; +import azure.example.basic.models.ActionResponse; +import azure.example.basic.models.Enum; +import azure.example.basic.models.Model; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class BasicActionTests extends AzureExampleClientTestBase { + @Test + @Disabled + public void testBasicActionTests() { + // method invocation + ActionResponse response = azureExampleClient.basicAction("query", "header", + new ActionRequest("text") + .setModelProperty( + new Model().setInt32Property(1).setFloat32Property(1.5D).setEnumProperty(Enum.ENUM_VALUE1)) + .setArrayProperty(Arrays.asList("item")) + .setRecordProperty(mapOf("record", "value"))); + + // response assertion + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/payload/pageable/generated/PageableClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/payload/pageable/generated/PageableClientTestBase.java new file mode 100644 index 00000000000..b9e8543f58d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/payload/pageable/generated/PageableClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.payload.pageable.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.payload.pageable.PageableClient; +import azure.payload.pageable.PageableClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class PageableClientTestBase extends TestProxyTestBase { + protected PageableClient pageableClient; + + @Override + protected void beforeTest() { + PageableClientBuilder pageableClientbuilder = new PageableClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pageableClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pageableClient = pageableClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationDisplayTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationDisplayTests.java new file mode 100644 index 00000000000..99c7e1b597a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationDisplayTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.generated; + +import azure.resourcemanager.methodsubscriptionid.models.OperationDisplay; +import com.azure.core.util.BinaryData; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData + .fromString( + "{\"provider\":\"cs\",\"resource\":\"s\",\"operation\":\"nyejhkryhtnap\",\"description\":\"wlokjyem\"}") + .toObject(OperationDisplay.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationInnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationInnerTests.java new file mode 100644 index 00000000000..23ddd14bc29 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.generated; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.OperationInner; +import com.azure.core.util.BinaryData; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"hiv\",\"isDataAction\":false,\"display\":{\"provider\":\"b\",\"resource\":\"rkxvdum\",\"operation\":\"rtfw\",\"description\":\"k\"},\"origin\":\"user\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationListResultTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationListResultTests.java new file mode 100644 index 00000000000..e2d715ecdea --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/OperationListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.generated; + +import azure.resourcemanager.methodsubscriptionid.implementation.models.OperationListResult; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"dtmlxhekuksjt\",\"isDataAction\":false,\"display\":{\"provider\":\"mparcryuanzw\",\"resource\":\"zdxtayrlhmwhf\",\"operation\":\"rqobmtuk\",\"description\":\"ryrtihfxtijbpzv\"},\"origin\":\"user\",\"actionType\":\"Internal\"},{\"name\":\"mglzufcy\",\"isDataAction\":true,\"display\":{\"provider\":\"bihanuf\",\"resource\":\"cbjy\",\"operation\":\"git\",\"description\":\"qhabifpikxwcz\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"q\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("q", model.nextLink()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourceInnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourceInnerTests.java new file mode 100644 index 00000000000..6a6d3399dfa --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourceInnerTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.generated; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.ResourceGroupResourceInner; +import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties; +import com.azure.core.util.BinaryData; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ResourceGroupResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResourceGroupResourceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Failed\",\"resourceGroupSetting\":\"wmrvktsizntocipa\"},\"location\":\"ajpsquc\",\"tags\":{\"kfo\":\"yf\"},\"id\":\"knygjofjddeq\",\"name\":\"rd\",\"type\":\"upewnwreitjzy\"}") + .toObject(ResourceGroupResourceInner.class); + Assertions.assertEquals("ajpsquc", model.location()); + Assertions.assertEquals("yf", model.tags().get("kfo")); + Assertions.assertEquals("wmrvktsizntocipa", model.properties().resourceGroupSetting()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResourceGroupResourceInner model = new ResourceGroupResourceInner().withLocation("ajpsquc") + .withTags(mapOf("kfo", "yf")) + .withProperties(new ResourceGroupResourceProperties().withResourceGroupSetting("wmrvktsizntocipa")); + model = BinaryData.fromObject(model).toObject(ResourceGroupResourceInner.class); + Assertions.assertEquals("ajpsquc", model.location()); + Assertions.assertEquals("yf", model.tags().get("kfo")); + Assertions.assertEquals("wmrvktsizntocipa", model.properties().resourceGroupSetting()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourcePropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourcePropertiesTests.java new file mode 100644 index 00000000000..efbb282e688 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/ResourceGroupResourcePropertiesTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.generated; + +import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; + +public final class ResourceGroupResourcePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResourceGroupResourceProperties model + = BinaryData.fromString("{\"provisioningState\":\"Canceled\",\"resourceGroupSetting\":\"arhmofcqhsmy\"}") + .toObject(ResourceGroupResourceProperties.class); + Assertions.assertEquals("arhmofcqhsmy", model.resourceGroupSetting()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResourceGroupResourceProperties model + = new ResourceGroupResourceProperties().withResourceGroupSetting("arhmofcqhsmy"); + model = BinaryData.fromObject(model).toObject(ResourceGroupResourceProperties.class); + Assertions.assertEquals("arhmofcqhsmy", model.resourceGroupSetting()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1InnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1InnerTests.java new file mode 100644 index 00000000000..bac821c19a7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1InnerTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.generated; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; + +public final class SubscriptionResource1InnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubscriptionResource1Inner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"description\":\"uv\"},\"id\":\"xpyb\",\"name\":\"zm\",\"type\":\"hmtzopbsphrup\"}") + .toObject(SubscriptionResource1Inner.class); + Assertions.assertEquals("uv", model.properties().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubscriptionResource1Inner model = new SubscriptionResource1Inner() + .withProperties(new SubscriptionResource1Properties().withDescription("uv")); + model = BinaryData.fromObject(model).toObject(SubscriptionResource1Inner.class); + Assertions.assertEquals("uv", model.properties().description()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1PropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1PropertiesTests.java new file mode 100644 index 00000000000..83f6907b751 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource1PropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.generated; + +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; + +public final class SubscriptionResource1PropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubscriptionResource1Properties model + = BinaryData.fromString("{\"provisioningState\":\"Canceled\",\"description\":\"ybbejhph\"}") + .toObject(SubscriptionResource1Properties.class); + Assertions.assertEquals("ybbejhph", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubscriptionResource1Properties model = new SubscriptionResource1Properties().withDescription("ybbejhph"); + model = BinaryData.fromObject(model).toObject(SubscriptionResource1Properties.class); + Assertions.assertEquals("ybbejhph", model.description()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2InnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2InnerTests.java new file mode 100644 index 00000000000..3265f3db8ff --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2InnerTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.generated; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; + +public final class SubscriptionResource2InnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubscriptionResource2Inner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Canceled\",\"configValue\":\"xaobhdxbmtqioqjz\"},\"id\":\"tbmufpo\",\"name\":\"noi\",\"type\":\"hwlrx\"}") + .toObject(SubscriptionResource2Inner.class); + Assertions.assertEquals("xaobhdxbmtqioqjz", model.properties().configValue()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubscriptionResource2Inner model = new SubscriptionResource2Inner() + .withProperties(new SubscriptionResource2Properties().withConfigValue("xaobhdxbmtqioqjz")); + model = BinaryData.fromObject(model).toObject(SubscriptionResource2Inner.class); + Assertions.assertEquals("xaobhdxbmtqioqjz", model.properties().configValue()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2PropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2PropertiesTests.java new file mode 100644 index 00000000000..9c807099f3d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResource2PropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.generated; + +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; + +public final class SubscriptionResource2PropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubscriptionResource2Properties model + = BinaryData.fromString("{\"provisioningState\":\"Succeeded\",\"configValue\":\"oqijgkdmbpaz\"}") + .toObject(SubscriptionResource2Properties.class); + Assertions.assertEquals("oqijgkdmbpaz", model.configValue()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubscriptionResource2Properties model = new SubscriptionResource2Properties().withConfigValue("oqijgkdmbpaz"); + model = BinaryData.fromObject(model).toObject(SubscriptionResource2Properties.class); + Assertions.assertEquals("oqijgkdmbpaz", model.configValue()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourceInnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourceInnerTests.java new file mode 100644 index 00000000000..1954d0bb03c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourceInnerTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.generated; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; + +public final class SubscriptionResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubscriptionResourceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Canceled\",\"subscriptionSetting\":\"fp\"},\"id\":\"nrbtcqqjnq\",\"name\":\"lhqgnufooojy\",\"type\":\"ifsqesaagdfmg\"}") + .toObject(SubscriptionResourceInner.class); + Assertions.assertEquals("fp", model.properties().subscriptionSetting()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubscriptionResourceInner model = new SubscriptionResourceInner() + .withProperties(new SubscriptionResourceProperties().withSubscriptionSetting("fp")); + model = BinaryData.fromObject(model).toObject(SubscriptionResourceInner.class); + Assertions.assertEquals("fp", model.properties().subscriptionSetting()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourcePropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourcePropertiesTests.java new file mode 100644 index 00000000000..950637c8525 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/methodsubscriptionid/generated/SubscriptionResourcePropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.methodsubscriptionid.generated; + +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; + +public final class SubscriptionResourcePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubscriptionResourceProperties model + = BinaryData.fromString("{\"provisioningState\":\"Canceled\",\"subscriptionSetting\":\"j\"}") + .toObject(SubscriptionResourceProperties.class); + Assertions.assertEquals("j", model.subscriptionSetting()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubscriptionResourceProperties model = new SubscriptionResourceProperties().withSubscriptionSetting("j"); + model = BinaryData.fromObject(model).toObject(SubscriptionResourceProperties.class); + Assertions.assertEquals("j", model.subscriptionSetting()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskInnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskInnerTests.java new file mode 100644 index 00000000000..531354b48f7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskInnerTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.generated; + +import azure.resourcemanager.multiservice.combined.fluent.models.DiskInner; +import azure.resourcemanager.multiservice.combined.models.DiskProperties; +import com.azure.core.util.BinaryData; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DiskInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiskInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"zhwlrxy\",\"tags\":{\"obcu\":\"oqijgkdmbpaz\",\"qgn\":\"pdznrbtcqqjnqgl\"},\"id\":\"foooj\",\"name\":\"wifsq\",\"type\":\"saagdf\"}") + .toObject(DiskInner.class); + Assertions.assertEquals("zhwlrxy", model.location()); + Assertions.assertEquals("oqijgkdmbpaz", model.tags().get("obcu")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiskInner model = new DiskInner().withLocation("zhwlrxy") + .withTags(mapOf("obcu", "oqijgkdmbpaz", "qgn", "pdznrbtcqqjnqgl")) + .withProperties(new DiskProperties()); + model = BinaryData.fromObject(model).toObject(DiskInner.class); + Assertions.assertEquals("zhwlrxy", model.location()); + Assertions.assertEquals("oqijgkdmbpaz", model.tags().get("obcu")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskPropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskPropertiesTests.java new file mode 100644 index 00000000000..1afcf64161c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/DiskPropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.generated; + +import azure.resourcemanager.multiservice.combined.models.DiskProperties; +import com.azure.core.util.BinaryData; + +public final class DiskPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiskProperties model + = BinaryData.fromString("{\"provisioningState\":\"Failed\"}").toObject(DiskProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiskProperties model = new DiskProperties(); + model = BinaryData.fromObject(model).toObject(DiskProperties.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachineInnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachineInnerTests.java new file mode 100644 index 00000000000..88ae3ff1b4a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachineInnerTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.generated; + +import azure.resourcemanager.multiservice.combined.fluent.models.VirtualMachineInner; +import azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties; +import com.azure.core.util.BinaryData; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"uv\",\"tags\":{\"phrupidgsybbejhp\":\"pybczmehmtzopb\"},\"id\":\"oycmsxaobhdxbmt\",\"name\":\"ioq\",\"type\":\"zehtbmu\"}") + .toObject(VirtualMachineInner.class); + Assertions.assertEquals("uv", model.location()); + Assertions.assertEquals("pybczmehmtzopb", model.tags().get("phrupidgsybbejhp")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInner model = new VirtualMachineInner().withLocation("uv") + .withTags(mapOf("phrupidgsybbejhp", "pybczmehmtzopb")) + .withProperties(new VirtualMachineProperties()); + model = BinaryData.fromObject(model).toObject(VirtualMachineInner.class); + Assertions.assertEquals("uv", model.location()); + Assertions.assertEquals("pybczmehmtzopb", model.tags().get("phrupidgsybbejhp")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachinePropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachinePropertiesTests.java new file mode 100644 index 00000000000..d55bd6b30a0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/resourcemanager/multiservice/combined/generated/VirtualMachinePropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.resourcemanager.multiservice.combined.generated; + +import azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties; +import com.azure.core.util.BinaryData; + +public final class VirtualMachinePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineProperties model + = BinaryData.fromString("{\"provisioningState\":\"Canceled\"}").toObject(VirtualMachineProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineProperties model = new VirtualMachineProperties(); + model = BinaryData.fromObject(model).toObject(VirtualMachineProperties.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/specialheaders/xmsclientrequestid/generated/XmsClientRequestIdClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/specialheaders/xmsclientrequestid/generated/XmsClientRequestIdClientTestBase.java new file mode 100644 index 00000000000..00b6c8d031d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/specialheaders/xmsclientrequestid/generated/XmsClientRequestIdClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.specialheaders.xmsclientrequestid.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient; +import azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class XmsClientRequestIdClientTestBase extends TestProxyTestBase { + protected XmsClientRequestIdClient xmsClientRequestIdClient; + + @Override + protected void beforeTest() { + XmsClientRequestIdClientBuilder xmsClientRequestIdClientbuilder = new XmsClientRequestIdClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + xmsClientRequestIdClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + xmsClientRequestIdClient = xmsClientRequestIdClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/versioning/previewversion/generated/PreviewVersionClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/versioning/previewversion/generated/PreviewVersionClientTestBase.java new file mode 100644 index 00000000000..309d44ccf15 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/azure/versioning/previewversion/generated/PreviewVersionClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package azure.versioning.previewversion.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import azure.versioning.previewversion.PreviewVersionClient; +import azure.versioning.previewversion.PreviewVersionClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class PreviewVersionClientTestBase extends TestProxyTestBase { + protected PreviewVersionClient previewVersionClient; + + @Override + protected void beforeTest() { + PreviewVersionClientBuilder previewVersionClientbuilder = new PreviewVersionClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + previewVersionClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + previewVersionClient = previewVersionClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/clientnamespace/generated/ClientNamespaceFirstClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/clientnamespace/generated/ClientNamespaceFirstClientTestBase.java new file mode 100644 index 00000000000..b0736dc0e30 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/clientnamespace/generated/ClientNamespaceFirstClientTestBase.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.clientnamespace.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import client.clientnamespace.ClientNamespaceFirstClient; +import client.clientnamespace.ClientNamespaceFirstClientBuilder; +import client.clientnamespace.second.ClientNamespaceSecondClient; +import client.clientnamespace.second.ClientNamespaceSecondClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class ClientNamespaceFirstClientTestBase extends TestProxyTestBase { + protected ClientNamespaceFirstClient clientNamespaceFirstClient; + + protected ClientNamespaceSecondClient clientNamespaceSecondClient; + + @Override + protected void beforeTest() { + ClientNamespaceFirstClientBuilder clientNamespaceFirstClientbuilder = new ClientNamespaceFirstClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + clientNamespaceFirstClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + clientNamespaceFirstClient = clientNamespaceFirstClientbuilder.buildClient(); + + ClientNamespaceSecondClientBuilder clientNamespaceSecondClientbuilder = new ClientNamespaceSecondClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + clientNamespaceSecondClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + clientNamespaceSecondClient = clientNamespaceSecondClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/enumconflict/generated/EnumConflictClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/enumconflict/generated/EnumConflictClientTestBase.java new file mode 100644 index 00000000000..2984e47e125 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/enumconflict/generated/EnumConflictClientTestBase.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.enumconflict.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import client.naming.enumconflict.EnumConflictClientBuilder; +import client.naming.enumconflict.FirstOperationsClient; +import client.naming.enumconflict.SecondOperationsClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class EnumConflictClientTestBase extends TestProxyTestBase { + protected FirstOperationsClient firstOperationsClient; + + protected SecondOperationsClient secondOperationsClient; + + @Override + protected void beforeTest() { + EnumConflictClientBuilder firstOperationsClientbuilder = new EnumConflictClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + firstOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + firstOperationsClient = firstOperationsClientbuilder.buildFirstOperationsClient(); + + EnumConflictClientBuilder secondOperationsClientbuilder = new EnumConflictClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + secondOperationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + secondOperationsClient = secondOperationsClientbuilder.buildSecondOperationsClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/generated/NamingClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/generated/NamingClientTestBase.java new file mode 100644 index 00000000000..56ab4a928bb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/naming/generated/NamingClientTestBase.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.naming.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import client.naming.ModelClient; +import client.naming.NamingClient; +import client.naming.NamingClientBuilder; +import client.naming.UnionEnumClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class NamingClientTestBase extends TestProxyTestBase { + protected NamingClient namingClient; + + protected ModelClient modelClient; + + protected UnionEnumClient unionEnumClient; + + @Override + protected void beforeTest() { + NamingClientBuilder namingClientbuilder = new NamingClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + namingClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + namingClient = namingClientbuilder.buildClient(); + + NamingClientBuilder modelClientbuilder = new NamingClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + modelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + modelClient = modelClientbuilder.buildModelClient(); + + NamingClientBuilder unionEnumClientbuilder = new NamingClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unionEnumClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unionEnumClient = unionEnumClientbuilder.buildUnionEnumClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/overload/generated/OverloadClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/overload/generated/OverloadClientTestBase.java new file mode 100644 index 00000000000..8644d8fb893 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/overload/generated/OverloadClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.overload.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import client.overload.OverloadClient; +import client.overload.OverloadClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class OverloadClientTestBase extends TestProxyTestBase { + protected OverloadClient overloadClient; + + @Override + protected void beforeTest() { + OverloadClientBuilder overloadClientbuilder = new OverloadClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + overloadClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + overloadClient = overloadClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/clientoperationgroup/generated/FirstClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/clientoperationgroup/generated/FirstClientTestBase.java new file mode 100644 index 00000000000..1ab39e9696e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/clientoperationgroup/generated/FirstClientTestBase.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.clientoperationgroup.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import client.structure.anotherclientoperationgroup.subnamespace.Group5Client; +import client.structure.anotherclientoperationgroup.subnamespace.SecondClient; +import client.structure.anotherclientoperationgroup.subnamespace.SecondClientBuilder; +import client.structure.clientoperationgroup.FirstClient; +import client.structure.clientoperationgroup.FirstClientBuilder; +import client.structure.clientoperationgroup.Group3Client; +import client.structure.clientoperationgroup.Group4Client; +import client.structure.service.models.ClientType; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class FirstClientTestBase extends TestProxyTestBase { + protected FirstClient firstClient; + + protected Group3Client group3Client; + + protected Group4Client group4Client; + + protected SecondClient secondClient; + + protected Group5Client group5Client; + + @Override + protected void beforeTest() { + FirstClientBuilder firstClientbuilder + = new FirstClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + firstClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + firstClient = firstClientbuilder.buildClient(); + + FirstClientBuilder group3Clientbuilder + = new FirstClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + group3Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + group3Client = group3Clientbuilder.buildGroup3Client(); + + FirstClientBuilder group4Clientbuilder + = new FirstClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + group4Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + group4Client = group4Clientbuilder.buildGroup4Client(); + + SecondClientBuilder secondClientbuilder + = new SecondClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + secondClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + secondClient = secondClientbuilder.buildClient(); + + SecondClientBuilder group5Clientbuilder + = new SecondClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + group5Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + group5Client = group5Clientbuilder.buildGroup5Client(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/multiclient/generated/ClientAClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/multiclient/generated/ClientAClientTestBase.java new file mode 100644 index 00000000000..88228b9cda6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/multiclient/generated/ClientAClientTestBase.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.multiclient.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import client.structure.multiclient.ClientAClient; +import client.structure.multiclient.ClientAClientBuilder; +import client.structure.multiclient.ClientBClient; +import client.structure.multiclient.ClientBClientBuilder; +import client.structure.service.models.ClientType; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class ClientAClientTestBase extends TestProxyTestBase { + protected ClientAClient clientAClient; + + protected ClientBClient clientBClient; + + @Override + protected void beforeTest() { + ClientAClientBuilder clientAClientbuilder + = new ClientAClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + clientAClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + clientAClient = clientAClientbuilder.buildClient(); + + ClientBClientBuilder clientBClientbuilder + = new ClientBClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + clientBClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + clientBClient = clientBClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/renamedoperation/generated/RenamedOperationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/renamedoperation/generated/RenamedOperationClientTestBase.java new file mode 100644 index 00000000000..8b56c102df1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/renamedoperation/generated/RenamedOperationClientTestBase.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.renamedoperation.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import client.structure.renamedoperation.GroupClient; +import client.structure.renamedoperation.RenamedOperationClient; +import client.structure.renamedoperation.RenamedOperationClientBuilder; +import client.structure.service.models.ClientType; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class RenamedOperationClientTestBase extends TestProxyTestBase { + protected RenamedOperationClient renamedOperationClient; + + protected GroupClient groupClient; + + @Override + protected void beforeTest() { + RenamedOperationClientBuilder renamedOperationClientbuilder = new RenamedOperationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + renamedOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + renamedOperationClient = renamedOperationClientbuilder.buildClient(); + + RenamedOperationClientBuilder groupClientbuilder = new RenamedOperationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + groupClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + groupClient = groupClientbuilder.buildGroupClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/service/generated/ServiceClientClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/service/generated/ServiceClientClientTestBase.java new file mode 100644 index 00000000000..e9a538d4cfb --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/service/generated/ServiceClientClientTestBase.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.service.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import client.structure.service.BarClient; +import client.structure.service.BazFooClient; +import client.structure.service.FooClient; +import client.structure.service.QuxBarClient; +import client.structure.service.QuxClient; +import client.structure.service.ServiceClientClient; +import client.structure.service.ServiceClientClientBuilder; +import client.structure.service.models.ClientType; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class ServiceClientClientTestBase extends TestProxyTestBase { + protected ServiceClientClient serviceClientClient; + + protected BazFooClient bazFooClient; + + protected QuxClient quxClient; + + protected QuxBarClient quxBarClient; + + protected FooClient fooClient; + + protected BarClient barClient; + + @Override + protected void beforeTest() { + ServiceClientClientBuilder serviceClientClientbuilder = new ServiceClientClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + serviceClientClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + serviceClientClient = serviceClientClientbuilder.buildClient(); + + ServiceClientClientBuilder bazFooClientbuilder = new ServiceClientClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + bazFooClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + bazFooClient = bazFooClientbuilder.buildBazFooClient(); + + ServiceClientClientBuilder quxClientbuilder = new ServiceClientClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + quxClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + quxClient = quxClientbuilder.buildQuxClient(); + + ServiceClientClientBuilder quxBarClientbuilder = new ServiceClientClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + quxBarClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + quxBarClient = quxBarClientbuilder.buildQuxBarClient(); + + ServiceClientClientBuilder fooClientbuilder = new ServiceClientClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + fooClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + fooClient = fooClientbuilder.buildFooClient(); + + ServiceClientClientBuilder barClientbuilder = new ServiceClientClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + barClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + barClient = barClientbuilder.buildBarClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/twooperationgroup/generated/TwoOperationGroupClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/twooperationgroup/generated/TwoOperationGroupClientTestBase.java new file mode 100644 index 00000000000..09816fda0a0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/client/structure/twooperationgroup/generated/TwoOperationGroupClientTestBase.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package client.structure.twooperationgroup.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import client.structure.service.models.ClientType; +import client.structure.twooperationgroup.Group1Client; +import client.structure.twooperationgroup.Group2Client; +import client.structure.twooperationgroup.TwoOperationGroupClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; + +class TwoOperationGroupClientTestBase extends TestProxyTestBase { + protected Group1Client group1Client; + + protected Group2Client group2Client; + + @Override + protected void beforeTest() { + TwoOperationGroupClientBuilder group1Clientbuilder = new TwoOperationGroupClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + group1Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + group1Client = group1Clientbuilder.buildGroup1Client(); + + TwoOperationGroupClientBuilder group2Clientbuilder = new TwoOperationGroupClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .client(ClientType.fromString(Configuration.getGlobalConfiguration().get("CLIENT", "client"))) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + group2Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + group2Client = group2Clientbuilder.buildGroup2Client(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/documentation/generated/DocumentationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/documentation/generated/DocumentationClientTestBase.java new file mode 100644 index 00000000000..21b8d2c836b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/documentation/generated/DocumentationClientTestBase.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package documentation.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import documentation.DocumentationClientBuilder; +import documentation.ListsClient; +import documentation.TextFormattingClient; + +class DocumentationClientTestBase extends TestProxyTestBase { + protected ListsClient listsClient; + + protected TextFormattingClient textFormattingClient; + + @Override + protected void beforeTest() { + DocumentationClientBuilder listsClientbuilder = new DocumentationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + listsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + listsClient = listsClientbuilder.buildListsClient(); + + DocumentationClientBuilder textFormattingClientbuilder = new DocumentationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + textFormattingClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + textFormattingClient = textFormattingClientbuilder.buildTextFormattingClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/array/generated/ArrayClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/array/generated/ArrayClientTestBase.java new file mode 100644 index 00000000000..225f9f2497e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/array/generated/ArrayClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.array.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import encode.array.ArrayClient; +import encode.array.ArrayClientBuilder; + +class ArrayClientTestBase extends TestProxyTestBase { + protected ArrayClient arrayClient; + + @Override + protected void beforeTest() { + ArrayClientBuilder arrayClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + arrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + arrayClient = arrayClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/bytes/generated/BytesClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/bytes/generated/BytesClientTestBase.java new file mode 100644 index 00000000000..4ddae28782f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/bytes/generated/BytesClientTestBase.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.bytes.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import encode.bytes.BytesClientBuilder; +import encode.bytes.HeaderClient; +import encode.bytes.PropertyClient; +import encode.bytes.QueryClient; +import encode.bytes.RequestBodyClient; +import encode.bytes.ResponseBodyClient; + +class BytesClientTestBase extends TestProxyTestBase { + protected QueryClient queryClient; + + protected PropertyClient propertyClient; + + protected HeaderClient headerClient; + + protected RequestBodyClient requestBodyClient; + + protected ResponseBodyClient responseBodyClient; + + @Override + protected void beforeTest() { + BytesClientBuilder queryClientbuilder = new BytesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + queryClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + queryClient = queryClientbuilder.buildQueryClient(); + + BytesClientBuilder propertyClientbuilder = new BytesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + propertyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + propertyClient = propertyClientbuilder.buildPropertyClient(); + + BytesClientBuilder headerClientbuilder = new BytesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + headerClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + headerClient = headerClientbuilder.buildHeaderClient(); + + BytesClientBuilder requestBodyClientbuilder = new BytesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + requestBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + requestBodyClient = requestBodyClientbuilder.buildRequestBodyClient(); + + BytesClientBuilder responseBodyClientbuilder = new BytesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + responseBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + responseBodyClient = responseBodyClientbuilder.buildResponseBodyClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/datetime/generated/DatetimeClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/datetime/generated/DatetimeClientTestBase.java new file mode 100644 index 00000000000..40860cec643 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/datetime/generated/DatetimeClientTestBase.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.datetime.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import encode.datetime.DatetimeClientBuilder; +import encode.datetime.HeaderClient; +import encode.datetime.PropertyClient; +import encode.datetime.QueryClient; +import encode.datetime.ResponseHeaderClient; + +class DatetimeClientTestBase extends TestProxyTestBase { + protected QueryClient queryClient; + + protected PropertyClient propertyClient; + + protected HeaderClient headerClient; + + protected ResponseHeaderClient responseHeaderClient; + + @Override + protected void beforeTest() { + DatetimeClientBuilder queryClientbuilder = new DatetimeClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + queryClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + queryClient = queryClientbuilder.buildQueryClient(); + + DatetimeClientBuilder propertyClientbuilder = new DatetimeClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + propertyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + propertyClient = propertyClientbuilder.buildPropertyClient(); + + DatetimeClientBuilder headerClientbuilder = new DatetimeClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + headerClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + headerClient = headerClientbuilder.buildHeaderClient(); + + DatetimeClientBuilder responseHeaderClientbuilder = new DatetimeClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + responseHeaderClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + responseHeaderClient = responseHeaderClientbuilder.buildResponseHeaderClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/duration/generated/DurationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/duration/generated/DurationClientTestBase.java new file mode 100644 index 00000000000..950f6c711fe --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/duration/generated/DurationClientTestBase.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.duration.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import encode.duration.DurationClientBuilder; +import encode.duration.HeaderClient; +import encode.duration.PropertyClient; +import encode.duration.QueryClient; + +class DurationClientTestBase extends TestProxyTestBase { + protected QueryClient queryClient; + + protected PropertyClient propertyClient; + + protected HeaderClient headerClient; + + @Override + protected void beforeTest() { + DurationClientBuilder queryClientbuilder = new DurationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + queryClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + queryClient = queryClientbuilder.buildQueryClient(); + + DurationClientBuilder propertyClientbuilder = new DurationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + propertyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + propertyClient = propertyClientbuilder.buildPropertyClient(); + + DurationClientBuilder headerClientbuilder = new DurationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + headerClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + headerClient = headerClientbuilder.buildHeaderClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/numeric/generated/NumericClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/numeric/generated/NumericClientTestBase.java new file mode 100644 index 00000000000..ac27b6b84b8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/encode/numeric/generated/NumericClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package encode.numeric.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import encode.numeric.NumericClient; +import encode.numeric.NumericClientBuilder; + +class NumericClientTestBase extends TestProxyTestBase { + protected NumericClient numericClient; + + @Override + protected void beforeTest() { + NumericClientBuilder numericClientbuilder = new NumericClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + numericClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + numericClient = numericClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/basic/generated/BasicClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/basic/generated/BasicClientTestBase.java new file mode 100644 index 00000000000..aea2c3bdd81 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/basic/generated/BasicClientTestBase.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.basic.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import parameters.basic.BasicClientBuilder; +import parameters.basic.ExplicitBodyClient; +import parameters.basic.ImplicitBodyClient; + +class BasicClientTestBase extends TestProxyTestBase { + protected ExplicitBodyClient explicitBodyClient; + + protected ImplicitBodyClient implicitBodyClient; + + @Override + protected void beforeTest() { + BasicClientBuilder explicitBodyClientbuilder = new BasicClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + explicitBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + explicitBodyClient = explicitBodyClientbuilder.buildExplicitBodyClient(); + + BasicClientBuilder implicitBodyClientbuilder = new BasicClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + implicitBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + implicitBodyClient = implicitBodyClientbuilder.buildImplicitBodyClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/bodyoptionality/generated/BodyOptionalityClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/bodyoptionality/generated/BodyOptionalityClientTestBase.java new file mode 100644 index 00000000000..04872666ca2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/bodyoptionality/generated/BodyOptionalityClientTestBase.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.bodyoptionality.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import parameters.bodyoptionality.BodyOptionalityClient; +import parameters.bodyoptionality.BodyOptionalityClientBuilder; +import parameters.bodyoptionality.OptionalExplicitClient; + +class BodyOptionalityClientTestBase extends TestProxyTestBase { + protected BodyOptionalityClient bodyOptionalityClient; + + protected OptionalExplicitClient optionalExplicitClient; + + @Override + protected void beforeTest() { + BodyOptionalityClientBuilder bodyOptionalityClientbuilder = new BodyOptionalityClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + bodyOptionalityClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + bodyOptionalityClient = bodyOptionalityClientbuilder.buildClient(); + + BodyOptionalityClientBuilder optionalExplicitClientbuilder = new BodyOptionalityClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + optionalExplicitClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + optionalExplicitClient = optionalExplicitClientbuilder.buildOptionalExplicitClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/collectionformat/generated/CollectionFormatClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/collectionformat/generated/CollectionFormatClientTestBase.java new file mode 100644 index 00000000000..dd9b716e132 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/collectionformat/generated/CollectionFormatClientTestBase.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.collectionformat.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import parameters.collectionformat.CollectionFormatClientBuilder; +import parameters.collectionformat.HeaderClient; +import parameters.collectionformat.QueryClient; + +class CollectionFormatClientTestBase extends TestProxyTestBase { + protected QueryClient queryClient; + + protected HeaderClient headerClient; + + @Override + protected void beforeTest() { + CollectionFormatClientBuilder queryClientbuilder = new CollectionFormatClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + queryClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + queryClient = queryClientbuilder.buildQueryClient(); + + CollectionFormatClientBuilder headerClientbuilder = new CollectionFormatClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + headerClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + headerClient = headerClientbuilder.buildHeaderClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/path/generated/PathClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/path/generated/PathClientTestBase.java new file mode 100644 index 00000000000..573d1415554 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/path/generated/PathClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.path.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import parameters.path.PathClient; +import parameters.path.PathClientBuilder; + +class PathClientTestBase extends TestProxyTestBase { + protected PathClient pathClient; + + @Override + protected void beforeTest() { + PathClientBuilder pathClientbuilder = new PathClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathClient = pathClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/spread/generated/SpreadClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/spread/generated/SpreadClientTestBase.java new file mode 100644 index 00000000000..22c3cd60266 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/parameters/spread/generated/SpreadClientTestBase.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package parameters.spread.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import parameters.spread.AliasClient; +import parameters.spread.ModelClient; +import parameters.spread.SpreadClientBuilder; + +class SpreadClientTestBase extends TestProxyTestBase { + protected ModelClient modelClient; + + protected AliasClient aliasClient; + + @Override + protected void beforeTest() { + SpreadClientBuilder modelClientbuilder = new SpreadClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + modelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + modelClient = modelClientbuilder.buildModelClient(); + + SpreadClientBuilder aliasClientbuilder = new SpreadClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + aliasClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + aliasClient = aliasClientbuilder.buildAliasClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/contentnegotiation/generated/ContentNegotiationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/contentnegotiation/generated/ContentNegotiationClientTestBase.java new file mode 100644 index 00000000000..bdb898a4ad6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/contentnegotiation/generated/ContentNegotiationClientTestBase.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.contentnegotiation.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import payload.contentnegotiation.ContentNegotiationClientBuilder; +import payload.contentnegotiation.DifferentBodyClient; +import payload.contentnegotiation.SameBodyClient; + +class ContentNegotiationClientTestBase extends TestProxyTestBase { + protected SameBodyClient sameBodyClient; + + protected DifferentBodyClient differentBodyClient; + + @Override + protected void beforeTest() { + ContentNegotiationClientBuilder sameBodyClientbuilder = new ContentNegotiationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + sameBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + sameBodyClient = sameBodyClientbuilder.buildSameBodyClient(); + + ContentNegotiationClientBuilder differentBodyClientbuilder = new ContentNegotiationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + differentBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + differentBodyClient = differentBodyClientbuilder.buildDifferentBodyClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/jsonmergepatch/generated/JsonMergePatchClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/jsonmergepatch/generated/JsonMergePatchClientTestBase.java new file mode 100644 index 00000000000..3becae65f1e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/jsonmergepatch/generated/JsonMergePatchClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.jsonmergepatch.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import payload.jsonmergepatch.JsonMergePatchClient; +import payload.jsonmergepatch.JsonMergePatchClientBuilder; + +class JsonMergePatchClientTestBase extends TestProxyTestBase { + protected JsonMergePatchClient jsonMergePatchClient; + + @Override + protected void beforeTest() { + JsonMergePatchClientBuilder jsonMergePatchClientbuilder = new JsonMergePatchClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + jsonMergePatchClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + jsonMergePatchClient = jsonMergePatchClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/mediatype/generated/MediaTypeClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/mediatype/generated/MediaTypeClientTestBase.java new file mode 100644 index 00000000000..58a24aadb71 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/mediatype/generated/MediaTypeClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.mediatype.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import payload.mediatype.MediaTypeClient; +import payload.mediatype.MediaTypeClientBuilder; + +class MediaTypeClientTestBase extends TestProxyTestBase { + protected MediaTypeClient mediaTypeClient; + + @Override + protected void beforeTest() { + MediaTypeClientBuilder mediaTypeClientbuilder = new MediaTypeClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + mediaTypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + mediaTypeClient = mediaTypeClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/multipart/generated/MultiPartClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/multipart/generated/MultiPartClientTestBase.java new file mode 100644 index 00000000000..24d5eeb281f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/payload/multipart/generated/MultiPartClientTestBase.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package payload.multipart.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import payload.multipart.FormDataClient; +import payload.multipart.FormDataHttpPartsClient; +import payload.multipart.FormDataHttpPartsContentTypeClient; +import payload.multipart.FormDataHttpPartsNonStringClient; +import payload.multipart.MultiPartClientBuilder; + +class MultiPartClientTestBase extends TestProxyTestBase { + protected FormDataClient formDataClient; + + protected FormDataHttpPartsClient formDataHttpPartsClient; + + protected FormDataHttpPartsContentTypeClient formDataHttpPartsContentTypeClient; + + protected FormDataHttpPartsNonStringClient formDataHttpPartsNonStringClient; + + @Override + protected void beforeTest() { + MultiPartClientBuilder formDataClientbuilder = new MultiPartClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + formDataClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + formDataClient = formDataClientbuilder.buildFormDataClient(); + + MultiPartClientBuilder formDataHttpPartsClientbuilder = new MultiPartClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + formDataHttpPartsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + formDataHttpPartsClient = formDataHttpPartsClientbuilder.buildFormDataHttpPartsClient(); + + MultiPartClientBuilder formDataHttpPartsContentTypeClientbuilder = new MultiPartClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + formDataHttpPartsContentTypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + formDataHttpPartsContentTypeClient + = formDataHttpPartsContentTypeClientbuilder.buildFormDataHttpPartsContentTypeClient(); + + MultiPartClientBuilder formDataHttpPartsNonStringClientbuilder = new MultiPartClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + formDataHttpPartsNonStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + formDataHttpPartsNonStringClient + = formDataHttpPartsNonStringClientbuilder.buildFormDataHttpPartsNonStringClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/generated/ResiliencyServiceDrivenClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/generated/ResiliencyServiceDrivenClientTestBase.java new file mode 100644 index 00000000000..0eb4edcba82 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/generated/ResiliencyServiceDrivenClientTestBase.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package resiliency.servicedriven.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import resiliency.servicedriven.ResiliencyServiceDrivenClient; +import resiliency.servicedriven.ResiliencyServiceDrivenClientBuilder; + +class ResiliencyServiceDrivenClientTestBase extends TestProxyTestBase { + protected ResiliencyServiceDrivenClient resiliencyServiceDrivenClient; + + @Override + protected void beforeTest() { + ResiliencyServiceDrivenClientBuilder resiliencyServiceDrivenClientbuilder + = new ResiliencyServiceDrivenClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .serviceDeploymentVersion( + Configuration.getGlobalConfiguration().get("SERVICEDEPLOYMENTVERSION", "servicedeploymentversion")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + resiliencyServiceDrivenClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + resiliencyServiceDrivenClient = resiliencyServiceDrivenClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/v1/generated/ResiliencyServiceDrivenClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/v1/generated/ResiliencyServiceDrivenClientTestBase.java new file mode 100644 index 00000000000..afac6adc8c9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/resiliency/servicedriven/v1/generated/ResiliencyServiceDrivenClientTestBase.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package resiliency.servicedriven.v1.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import resiliency.servicedriven.v1.ResiliencyServiceDrivenClient; +import resiliency.servicedriven.v1.ResiliencyServiceDrivenClientBuilder; + +class ResiliencyServiceDrivenClientTestBase extends TestProxyTestBase { + protected ResiliencyServiceDrivenClient resiliencyServiceDrivenClient; + + @Override + protected void beforeTest() { + ResiliencyServiceDrivenClientBuilder resiliencyServiceDrivenClientbuilder + = new ResiliencyServiceDrivenClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .serviceDeploymentVersion( + Configuration.getGlobalConfiguration().get("SERVICEDEPLOYMENTVERSION", "servicedeploymentversion")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + resiliencyServiceDrivenClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + resiliencyServiceDrivenClient = resiliencyServiceDrivenClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/response/statuscoderange/generated/StatusCodeRangeClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/response/statuscoderange/generated/StatusCodeRangeClientTestBase.java new file mode 100644 index 00000000000..68df0911d9d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/response/statuscoderange/generated/StatusCodeRangeClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package response.statuscoderange.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import response.statuscoderange.StatusCodeRangeClient; +import response.statuscoderange.StatusCodeRangeClientBuilder; + +class StatusCodeRangeClientTestBase extends TestProxyTestBase { + protected StatusCodeRangeClient statusCodeRangeClient; + + @Override + protected void beforeTest() { + StatusCodeRangeClientBuilder statusCodeRangeClientbuilder = new StatusCodeRangeClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + statusCodeRangeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + statusCodeRangeClient = statusCodeRangeClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/routes/generated/RoutesClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/routes/generated/RoutesClientTestBase.java new file mode 100644 index 00000000000..0160bfaa21f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/routes/generated/RoutesClientTestBase.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package routes.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import routes.InInterfaceClient; +import routes.PathParametersClient; +import routes.PathParametersLabelExpansionExplodeClient; +import routes.PathParametersLabelExpansionStandardClient; +import routes.PathParametersMatrixExpansionExplodeClient; +import routes.PathParametersMatrixExpansionStandardClient; +import routes.PathParametersPathExpansionExplodeClient; +import routes.PathParametersPathExpansionStandardClient; +import routes.PathParametersReservedExpansionClient; +import routes.PathParametersSimpleExpansionExplodeClient; +import routes.PathParametersSimpleExpansionStandardClient; +import routes.QueryParametersClient; +import routes.QueryParametersQueryContinuationExplodeClient; +import routes.QueryParametersQueryContinuationStandardClient; +import routes.QueryParametersQueryExpansionExplodeClient; +import routes.QueryParametersQueryExpansionStandardClient; +import routes.RoutesClient; +import routes.RoutesClientBuilder; + +class RoutesClientTestBase extends TestProxyTestBase { + protected RoutesClient routesClient; + + protected PathParametersClient pathParametersClient; + + protected PathParametersReservedExpansionClient pathParametersReservedExpansionClient; + + protected PathParametersSimpleExpansionStandardClient pathParametersSimpleExpansionStandardClient; + + protected PathParametersSimpleExpansionExplodeClient pathParametersSimpleExpansionExplodeClient; + + protected PathParametersPathExpansionStandardClient pathParametersPathExpansionStandardClient; + + protected PathParametersPathExpansionExplodeClient pathParametersPathExpansionExplodeClient; + + protected PathParametersLabelExpansionStandardClient pathParametersLabelExpansionStandardClient; + + protected PathParametersLabelExpansionExplodeClient pathParametersLabelExpansionExplodeClient; + + protected PathParametersMatrixExpansionStandardClient pathParametersMatrixExpansionStandardClient; + + protected PathParametersMatrixExpansionExplodeClient pathParametersMatrixExpansionExplodeClient; + + protected QueryParametersClient queryParametersClient; + + protected QueryParametersQueryExpansionStandardClient queryParametersQueryExpansionStandardClient; + + protected QueryParametersQueryExpansionExplodeClient queryParametersQueryExpansionExplodeClient; + + protected QueryParametersQueryContinuationStandardClient queryParametersQueryContinuationStandardClient; + + protected QueryParametersQueryContinuationExplodeClient queryParametersQueryContinuationExplodeClient; + + protected InInterfaceClient inInterfaceClient; + + @Override + protected void beforeTest() { + RoutesClientBuilder routesClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + routesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + routesClient = routesClientbuilder.buildClient(); + + RoutesClientBuilder pathParametersClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathParametersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathParametersClient = pathParametersClientbuilder.buildPathParametersClient(); + + RoutesClientBuilder pathParametersReservedExpansionClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathParametersReservedExpansionClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathParametersReservedExpansionClient + = pathParametersReservedExpansionClientbuilder.buildPathParametersReservedExpansionClient(); + + RoutesClientBuilder pathParametersSimpleExpansionStandardClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathParametersSimpleExpansionStandardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathParametersSimpleExpansionStandardClient + = pathParametersSimpleExpansionStandardClientbuilder.buildPathParametersSimpleExpansionStandardClient(); + + RoutesClientBuilder pathParametersSimpleExpansionExplodeClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathParametersSimpleExpansionExplodeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathParametersSimpleExpansionExplodeClient + = pathParametersSimpleExpansionExplodeClientbuilder.buildPathParametersSimpleExpansionExplodeClient(); + + RoutesClientBuilder pathParametersPathExpansionStandardClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathParametersPathExpansionStandardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathParametersPathExpansionStandardClient + = pathParametersPathExpansionStandardClientbuilder.buildPathParametersPathExpansionStandardClient(); + + RoutesClientBuilder pathParametersPathExpansionExplodeClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathParametersPathExpansionExplodeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathParametersPathExpansionExplodeClient + = pathParametersPathExpansionExplodeClientbuilder.buildPathParametersPathExpansionExplodeClient(); + + RoutesClientBuilder pathParametersLabelExpansionStandardClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathParametersLabelExpansionStandardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathParametersLabelExpansionStandardClient + = pathParametersLabelExpansionStandardClientbuilder.buildPathParametersLabelExpansionStandardClient(); + + RoutesClientBuilder pathParametersLabelExpansionExplodeClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathParametersLabelExpansionExplodeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathParametersLabelExpansionExplodeClient + = pathParametersLabelExpansionExplodeClientbuilder.buildPathParametersLabelExpansionExplodeClient(); + + RoutesClientBuilder pathParametersMatrixExpansionStandardClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathParametersMatrixExpansionStandardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathParametersMatrixExpansionStandardClient + = pathParametersMatrixExpansionStandardClientbuilder.buildPathParametersMatrixExpansionStandardClient(); + + RoutesClientBuilder pathParametersMatrixExpansionExplodeClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + pathParametersMatrixExpansionExplodeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + pathParametersMatrixExpansionExplodeClient + = pathParametersMatrixExpansionExplodeClientbuilder.buildPathParametersMatrixExpansionExplodeClient(); + + RoutesClientBuilder queryParametersClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + queryParametersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + queryParametersClient = queryParametersClientbuilder.buildQueryParametersClient(); + + RoutesClientBuilder queryParametersQueryExpansionStandardClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + queryParametersQueryExpansionStandardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + queryParametersQueryExpansionStandardClient + = queryParametersQueryExpansionStandardClientbuilder.buildQueryParametersQueryExpansionStandardClient(); + + RoutesClientBuilder queryParametersQueryExpansionExplodeClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + queryParametersQueryExpansionExplodeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + queryParametersQueryExpansionExplodeClient + = queryParametersQueryExpansionExplodeClientbuilder.buildQueryParametersQueryExpansionExplodeClient(); + + RoutesClientBuilder queryParametersQueryContinuationStandardClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + queryParametersQueryContinuationStandardClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + queryParametersQueryContinuationStandardClient = queryParametersQueryContinuationStandardClientbuilder + .buildQueryParametersQueryContinuationStandardClient(); + + RoutesClientBuilder queryParametersQueryContinuationExplodeClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + queryParametersQueryContinuationExplodeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + queryParametersQueryContinuationExplodeClient + = queryParametersQueryContinuationExplodeClientbuilder.buildQueryParametersQueryContinuationExplodeClient(); + + RoutesClientBuilder inInterfaceClientbuilder = new RoutesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + inInterfaceClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + inInterfaceClient = inInterfaceClientbuilder.buildInInterfaceClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/serialization/encodedname/json/generated/JsonClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/serialization/encodedname/json/generated/JsonClientTestBase.java new file mode 100644 index 00000000000..2cccc578ec8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/serialization/encodedname/json/generated/JsonClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package serialization.encodedname.json.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import serialization.encodedname.json.JsonClient; +import serialization.encodedname.json.JsonClientBuilder; + +class JsonClientTestBase extends TestProxyTestBase { + protected JsonClient jsonClient; + + @Override + protected void beforeTest() { + JsonClientBuilder jsonClientbuilder = new JsonClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + jsonClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + jsonClient = jsonClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/endpoint/notdefined/generated/NotDefinedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/endpoint/notdefined/generated/NotDefinedClientTestBase.java new file mode 100644 index 00000000000..f0f479c425e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/endpoint/notdefined/generated/NotDefinedClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.endpoint.notdefined.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import server.endpoint.notdefined.NotDefinedClient; +import server.endpoint.notdefined.NotDefinedClientBuilder; + +class NotDefinedClientTestBase extends TestProxyTestBase { + protected NotDefinedClient notDefinedClient; + + @Override + protected void beforeTest() { + NotDefinedClientBuilder notDefinedClientbuilder + = new NotDefinedClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + notDefinedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + notDefinedClient = notDefinedClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/multiple/generated/MultipleClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/multiple/generated/MultipleClientTestBase.java new file mode 100644 index 00000000000..3fce7a29c4b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/multiple/generated/MultipleClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.path.multiple.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import server.path.multiple.MultipleClient; +import server.path.multiple.MultipleClientBuilder; + +class MultipleClientTestBase extends TestProxyTestBase { + protected MultipleClient multipleClient; + + @Override + protected void beforeTest() { + MultipleClientBuilder multipleClientbuilder + = new MultipleClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + multipleClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + multipleClient = multipleClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/single/generated/SingleClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/single/generated/SingleClientTestBase.java new file mode 100644 index 00000000000..4dd3e8effd5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/path/single/generated/SingleClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.path.single.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import server.path.single.SingleClient; +import server.path.single.SingleClientBuilder; + +class SingleClientTestBase extends TestProxyTestBase { + protected SingleClient singleClient; + + @Override + protected void beforeTest() { + SingleClientBuilder singleClientbuilder + = new SingleClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + singleClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + singleClient = singleClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/notversioned/generated/NotVersionedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/notversioned/generated/NotVersionedClientTestBase.java new file mode 100644 index 00000000000..966a2937ab5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/notversioned/generated/NotVersionedClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.versions.notversioned.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import server.versions.notversioned.NotVersionedClient; +import server.versions.notversioned.NotVersionedClientBuilder; + +class NotVersionedClientTestBase extends TestProxyTestBase { + protected NotVersionedClient notVersionedClient; + + @Override + protected void beforeTest() { + NotVersionedClientBuilder notVersionedClientbuilder = new NotVersionedClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + notVersionedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + notVersionedClient = notVersionedClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/versioned/generated/VersionedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/versioned/generated/VersionedClientTestBase.java new file mode 100644 index 00000000000..e1eb4a91434 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/server/versions/versioned/generated/VersionedClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package server.versions.versioned.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import server.versions.versioned.VersionedClient; +import server.versions.versioned.VersionedClientBuilder; + +class VersionedClientTestBase extends TestProxyTestBase { + protected VersionedClient versionedClient; + + @Override + protected void beforeTest() { + VersionedClientBuilder versionedClientbuilder + = new VersionedClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + versionedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + versionedClient = versionedClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/service/multiservice/combined/generated/CombinedTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/service/multiservice/combined/generated/CombinedTestBase.java new file mode 100644 index 00000000000..9cfd19eabb5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/service/multiservice/combined/generated/CombinedTestBase.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package service.multiservice.combined.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import service.multiservice.combined.BarClient; +import service.multiservice.combined.CombinedBuilder; +import service.multiservice.combined.FooClient; + +class CombinedTestBase extends TestProxyTestBase { + protected FooClient fooClient; + + protected BarClient barClient; + + @Override + protected void beforeTest() { + CombinedBuilder fooClientbuilder = new CombinedBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + fooClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + fooClient = fooClientbuilder.buildFooClient(); + + CombinedBuilder barClientbuilder = new CombinedBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + barClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + barClient = barClientbuilder.buildBarClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/conditionalrequest/generated/ConditionalRequestClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/conditionalrequest/generated/ConditionalRequestClientTestBase.java new file mode 100644 index 00000000000..3435febec89 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/conditionalrequest/generated/ConditionalRequestClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialheaders.conditionalrequest.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import specialheaders.conditionalrequest.ConditionalRequestClient; +import specialheaders.conditionalrequest.ConditionalRequestClientBuilder; + +class ConditionalRequestClientTestBase extends TestProxyTestBase { + protected ConditionalRequestClient conditionalRequestClient; + + @Override + protected void beforeTest() { + ConditionalRequestClientBuilder conditionalRequestClientbuilder = new ConditionalRequestClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + conditionalRequestClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + conditionalRequestClient = conditionalRequestClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/repeatability/generated/RepeatabilityClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/repeatability/generated/RepeatabilityClientTestBase.java new file mode 100644 index 00000000000..d3d07216f40 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialheaders/repeatability/generated/RepeatabilityClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialheaders.repeatability.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import specialheaders.repeatability.RepeatabilityClient; +import specialheaders.repeatability.RepeatabilityClientBuilder; + +class RepeatabilityClientTestBase extends TestProxyTestBase { + protected RepeatabilityClient repeatabilityClient; + + @Override + protected void beforeTest() { + RepeatabilityClientBuilder repeatabilityClientbuilder = new RepeatabilityClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + repeatabilityClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + repeatabilityClient = repeatabilityClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialwords/generated/SpecialWordsClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialwords/generated/SpecialWordsClientTestBase.java new file mode 100644 index 00000000000..20be242ec4c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/specialwords/generated/SpecialWordsClientTestBase.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package specialwords.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import specialwords.ModelPropertiesClient; +import specialwords.ModelsClient; +import specialwords.OperationsClient; +import specialwords.ParametersClient; +import specialwords.SpecialWordsClientBuilder; + +class SpecialWordsClientTestBase extends TestProxyTestBase { + protected ModelsClient modelsClient; + + protected ModelPropertiesClient modelPropertiesClient; + + protected OperationsClient operationsClient; + + protected ParametersClient parametersClient; + + @Override + protected void beforeTest() { + SpecialWordsClientBuilder modelsClientbuilder = new SpecialWordsClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + modelsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + modelsClient = modelsClientbuilder.buildModelsClient(); + + SpecialWordsClientBuilder modelPropertiesClientbuilder = new SpecialWordsClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + modelPropertiesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + modelPropertiesClient = modelPropertiesClientbuilder.buildModelPropertiesClient(); + + SpecialWordsClientBuilder operationsClientbuilder = new SpecialWordsClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + operationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + operationsClient = operationsClientbuilder.buildOperationsClient(); + + SpecialWordsClientBuilder parametersClientbuilder = new SpecialWordsClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + parametersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + parametersClient = parametersClientbuilder.buildParametersClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/streaming/jsonl/generated/JsonlClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/streaming/jsonl/generated/JsonlClientTestBase.java new file mode 100644 index 00000000000..82d776fe4c3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/streaming/jsonl/generated/JsonlClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package streaming.jsonl.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import streaming.jsonl.JsonlClient; +import streaming.jsonl.JsonlClientBuilder; + +class JsonlClientTestBase extends TestProxyTestBase { + protected JsonlClient jsonlClient; + + @Override + protected void beforeTest() { + JsonlClientBuilder jsonlClientbuilder = new JsonlClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + jsonlClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + jsonlClient = jsonlClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceInnerTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceInnerTests.java new file mode 100644 index 00000000000..c0f8f2fc1ee --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceInnerTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.generated; + +import com.azure.core.util.BinaryData; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; +import tsptest.armversioned.models.TopLevelArmResourceProperties; + +public final class TopLevelArmResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TopLevelArmResourceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"uv\",\"tags\":{\"phrupidgsybbejhp\":\"pybczmehmtzopb\"},\"id\":\"oycmsxaobhdxbmt\",\"name\":\"ioq\",\"type\":\"zehtbmu\"}") + .toObject(TopLevelArmResourceInner.class); + Assertions.assertEquals("uv", model.location()); + Assertions.assertEquals("pybczmehmtzopb", model.tags().get("phrupidgsybbejhp")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TopLevelArmResourceInner model = new TopLevelArmResourceInner().withLocation("uv") + .withTags(mapOf("phrupidgsybbejhp", "pybczmehmtzopb")) + .withProperties(new TopLevelArmResourceProperties()); + model = BinaryData.fromObject(model).toObject(TopLevelArmResourceInner.class); + Assertions.assertEquals("uv", model.location()); + Assertions.assertEquals("pybczmehmtzopb", model.tags().get("phrupidgsybbejhp")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceListResultTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceListResultTests.java new file mode 100644 index 00000000000..bc7524675a2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourceListResultTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.generated; + +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import tsptest.armversioned.implementation.models.TopLevelArmResourceListResult; + +public final class TopLevelArmResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TopLevelArmResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\"},\"location\":\"hwlrx\",\"tags\":{\"dmbpazlobcufpdz\":\"soqijg\",\"qqjnqgl\":\"rbt\",\"foooj\":\"qgn\"},\"id\":\"wifsq\",\"name\":\"saagdf\",\"type\":\"glzlhjxrifkwmrv\"}],\"nextLink\":\"siznto\"}") + .toObject(TopLevelArmResourceListResult.class); + Assertions.assertEquals("hwlrx", model.value().get(0).location()); + Assertions.assertEquals("soqijg", model.value().get(0).tags().get("dmbpazlobcufpdz")); + Assertions.assertEquals("siznto", model.nextLink()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourcePropertiesTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourcePropertiesTests.java new file mode 100644 index 00000000000..fe3644035e9 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/armversioned/generated/TopLevelArmResourcePropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.armversioned.generated; + +import com.azure.core.util.BinaryData; +import tsptest.armversioned.models.TopLevelArmResourceProperties; + +public final class TopLevelArmResourcePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TopLevelArmResourceProperties model = BinaryData.fromString("{\"provisioningState\":\"Canceled\"}") + .toObject(TopLevelArmResourceProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TopLevelArmResourceProperties model = new TopLevelArmResourceProperties(); + model = BinaryData.fromObject(model).toObject(TopLevelArmResourceProperties.class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinClientTestBase.java new file mode 100644 index 00000000000..3112ad7f814 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.builtin.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.builtin.BuiltinClient; +import tsptest.builtin.BuiltinClientBuilder; + +class BuiltinClientTestBase extends TestProxyTestBase { + protected BuiltinClient builtinClient; + + @Override + protected void beforeTest() { + BuiltinClientBuilder builtinClientbuilder + = new BuiltinClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + builtinClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + builtinClient = builtinClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpReadTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpReadTests.java new file mode 100644 index 00000000000..8fa08f909c1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpReadTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.builtin.generated; + +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import tsptest.builtin.models.Builtin; +import tsptest.builtin.models.Encoded; + +@Disabled +public final class BuiltinOpReadTests extends BuiltinClientTestBase { + @Test + @Disabled + public void testBuiltinOpReadTests() { + // method invocation + Builtin response = builtinClient.read(null, null, null, "myFilter", null, null); + + // response assertion + Assertions.assertNotNull(response); + // verify property "booleanProperty" + Assertions.assertEquals(true, response.isBooleanProperty()); + // verify property "string" + Assertions.assertEquals("myString", response.getString()); + // verify property "safeint" + Assertions.assertEquals(32L, response.getSafeint()); + // verify property "longProperty" + Assertions.assertEquals(64L, response.getLongProperty()); + // verify property "floatProperty" + Assertions.assertEquals(32.0, response.getFloatProperty()); + // verify property "doubleProperty" + Assertions.assertEquals(64.0, response.getDoubleProperty()); + // verify property "duration" + Assertions.assertNotNull(response.getDuration()); + // verify property "date" + Assertions.assertNotNull(response.getDate()); + // verify property "dateTime" + Assertions.assertNotNull(response.getDateTime()); + // verify property "stringList" + List responseStringList = response.getStringList(); + Assertions.assertEquals("a", responseStringList.iterator().next()); + // verify property "url" + Assertions.assertEquals("https://www.github.com", response.getUrl()); + // verify property "nullableFloatDict" + Assertions.assertNotNull(response.getNullableFloatDict()); + // verify property "encoded" + Encoded responseEncoded = response.getEncoded(); + Assertions.assertNotNull(responseEncoded); + Assertions.assertNotNull(responseEncoded.getTimeInSeconds()); + Assertions.assertNotNull(responseEncoded.getTimeInSecondsFraction()); + Assertions.assertNotNull(responseEncoded.getDateTime()); + Assertions.assertNotNull(responseEncoded.getDateTimeRfc7231()); + Assertions.assertNotNull(responseEncoded.getUnixTimestamp()); + Assertions.assertNotNull(responseEncoded.getBase64()); + Assertions.assertNotNull(responseEncoded.getBase64url()); + Assertions.assertNotNull(responseEncoded.getCommaDeliminatedArray()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpWriteTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpWriteTests.java new file mode 100644 index 00000000000..1f8e4e16d7a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/builtin/generated/BuiltinOpWriteTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.builtin.generated; + +import java.time.Duration; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import tsptest.builtin.models.Builtin; +import tsptest.builtin.models.Encoded; + +@Disabled +public final class BuiltinOpWriteTests extends BuiltinClientTestBase { + @Test + @Disabled + public void testBuiltinOpWriteTests() { + // method invocation + builtinClient.write(new Builtin(true, "myString", null, 0, 32L, null, 64L, 32.0, 64.0, Duration.parse("PT15M"), + LocalDate.parse("2023-08-29"), OffsetDateTime.parse("2019-10-12T07:20:50.520Z"), + Arrays.asList("a", "b", "c"), null, "https://www.github.com", + mapOf("max", 15.0D, "min", 14.0D, "average", 14.3D), + new Encoded().setTimeInSeconds(Duration.parse("PT15M")) + .setTimeInSecondsFraction(Duration.parse("PT20M0.345S")) + .setDateTime(OffsetDateTime.parse("1966-03-03T00:06:56.52Z")) + .setDateTimeRfc7231(OffsetDateTime.parse("1994-11-06T08:49:37Z")) + .setUnixTimestamp(OffsetDateTime.parse("2023-08-30T02:35:03Z")) + .setBase64("aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==".getBytes()) + .setBase64url("aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==".getBytes()) + .setCommaDeliminatedArray(Arrays.asList("a", "b", "c")), + null)); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/clientinitialization/generated/ClientInitializationClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/clientinitialization/generated/ClientInitializationClientTestBase.java new file mode 100644 index 00000000000..593cce4525c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/clientinitialization/generated/ClientInitializationClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.clientinitialization.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.clientinitialization.ClientInitializationClient; +import tsptest.clientinitialization.ClientInitializationClientBuilder; + +class ClientInitializationClientTestBase extends TestProxyTestBase { + protected ClientInitializationClient clientInitializationClient; + + @Override + protected void beforeTest() { + ClientInitializationClientBuilder clientInitializationClientbuilder = new ClientInitializationClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + clientInitializationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + clientInitializationClient = clientInitializationClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/discriminatoredgecases/generated/DiscriminatorEdgeCasesClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/discriminatoredgecases/generated/DiscriminatorEdgeCasesClientTestBase.java new file mode 100644 index 00000000000..370a1fb5d48 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/discriminatoredgecases/generated/DiscriminatorEdgeCasesClientTestBase.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.discriminatoredgecases.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClient; +import tsptest.discriminatoredgecases.DiscriminatorEdgeCasesClientBuilder; + +class DiscriminatorEdgeCasesClientTestBase extends TestProxyTestBase { + protected DiscriminatorEdgeCasesClient discriminatorEdgeCasesClient; + + @Override + protected void beforeTest() { + DiscriminatorEdgeCasesClientBuilder discriminatorEdgeCasesClientbuilder + = new DiscriminatorEdgeCasesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + discriminatorEdgeCasesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + discriminatorEdgeCasesClient = discriminatorEdgeCasesClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumnesteddiscriminator/generated/EnumNestedDiscriminatorClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumnesteddiscriminator/generated/EnumNestedDiscriminatorClientTestBase.java new file mode 100644 index 00000000000..a82fc558ce6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumnesteddiscriminator/generated/EnumNestedDiscriminatorClientTestBase.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumnesteddiscriminator.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClient; +import tsptest.enumnesteddiscriminator.EnumNestedDiscriminatorClientBuilder; + +class EnumNestedDiscriminatorClientTestBase extends TestProxyTestBase { + protected EnumNestedDiscriminatorClient enumNestedDiscriminatorClient; + + @Override + protected void beforeTest() { + EnumNestedDiscriminatorClientBuilder enumNestedDiscriminatorClientbuilder + = new EnumNestedDiscriminatorClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + enumNestedDiscriminatorClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + enumNestedDiscriminatorClient = enumNestedDiscriminatorClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumservice/generated/EnumServiceClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumservice/generated/EnumServiceClientTestBase.java new file mode 100644 index 00000000000..9dd80313b05 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/enumservice/generated/EnumServiceClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.enumservice.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.enumservice.EnumServiceClient; +import tsptest.enumservice.EnumServiceClientBuilder; + +class EnumServiceClientTestBase extends TestProxyTestBase { + protected EnumServiceClient enumServiceClient; + + @Override + protected void beforeTest() { + EnumServiceClientBuilder enumServiceClientbuilder = new EnumServiceClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + enumServiceClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + enumServiceClient = enumServiceClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/errormodel/generated/ErrorModelClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/errormodel/generated/ErrorModelClientTestBase.java new file mode 100644 index 00000000000..dc11b649137 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/errormodel/generated/ErrorModelClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.errormodel.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.errormodel.ErrorModelClient; +import tsptest.errormodel.ErrorModelClientBuilder; + +class ErrorModelClientTestBase extends TestProxyTestBase { + protected ErrorModelClient errorModelClient; + + @Override + protected void beforeTest() { + ErrorModelClientBuilder errorModelClientbuilder + = new ErrorModelClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + errorModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + errorModelClient = errorModelClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenClientTestBase.java new file mode 100644 index 00000000000..666dcf2cc21 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.flatten.FlattenClient; +import tsptest.flatten.FlattenClientBuilder; + +class FlattenClientTestBase extends TestProxyTestBase { + protected FlattenClient flattenClient; + + @Override + protected void beforeTest() { + FlattenClientBuilder flattenClientbuilder + = new FlattenClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + flattenClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + flattenClient = flattenClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendLongTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendLongTests.java new file mode 100644 index 00000000000..7d20f808991 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendLongTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.generated; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import tsptest.flatten.models.SendLongOptions; +import tsptest.flatten.models.SendLongRequestStatus; +import tsptest.flatten.models.User; + +@Disabled +public final class FlattenOpSendLongTests extends FlattenClientTestBase { + @Test + @Disabled + public void testFlattenOpSendLongTests() { + // method invocation + flattenClient.sendLong( + new SendLongOptions("myRequiredId", "myRequiredInput", 11, null, "title", SendLongRequestStatus.NOT_STARTED) + .setFilter("name=myName") + .setUser(new User("myOptionalUser")) + .setDataIntOptional(12) + .setDataLong(13L) + .setDataFloat(14.0D) + .setDescription("description")); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendTests.java new file mode 100644 index 00000000000..a968457260e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/flatten/generated/FlattenOpSendTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.flatten.generated; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import tsptest.flatten.models.User; + +@Disabled +public final class FlattenOpSendTests extends FlattenClientTestBase { + @Test + @Disabled + public void testFlattenOpSendTests() { + // method invocation + flattenClient.send("myRequiredId", null, "myRequiredInput", 0, 50, new User("myOptionalUser")); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/internal/generated/InternalClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/internal/generated/InternalClientTestBase.java new file mode 100644 index 00000000000..2536d1e9fc4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/internal/generated/InternalClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.internal.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.internal.InternalClient; +import tsptest.internal.InternalClientBuilder; + +class InternalClientTestBase extends TestProxyTestBase { + protected InternalClient internalClient; + + @Override + protected void beforeTest() { + InternalClientBuilder internalClientbuilder + = new InternalClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + internalClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + internalClient = internalClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/literalservice/generated/LiteralServiceClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/literalservice/generated/LiteralServiceClientTestBase.java new file mode 100644 index 00000000000..b54d4a93042 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/literalservice/generated/LiteralServiceClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.literalservice.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.literalservice.LiteralServiceClient; +import tsptest.literalservice.LiteralServiceClientBuilder; + +class LiteralServiceClientTestBase extends TestProxyTestBase { + protected LiteralServiceClient literalServiceClient; + + @Override + protected void beforeTest() { + LiteralServiceClientBuilder literalServiceClientbuilder = new LiteralServiceClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + literalServiceClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + literalServiceClient = literalServiceClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningClientTestBase.java new file mode 100644 index 00000000000..b1682f88100 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.longrunning.LongRunningClient; +import tsptest.longrunning.LongRunningClientBuilder; + +class LongRunningClientTestBase extends TestProxyTestBase { + protected LongRunningClient longRunningClient; + + @Override + protected void beforeTest() { + LongRunningClientBuilder longRunningClientbuilder = new LongRunningClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + longRunningClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + longRunningClient = longRunningClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningCreateJobTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningCreateJobTests.java new file mode 100644 index 00000000000..7b6d7a34583 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/longrunning/generated/LongRunningCreateJobTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.longrunning.generated; + +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.SyncPoller; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import tsptest.longrunning.models.JobData; +import tsptest.longrunning.models.JobResult; +import tsptest.longrunning.models.JobResultResult; + +@Disabled +public final class LongRunningCreateJobTests extends LongRunningClientTestBase { + @Test + @Disabled + public void testLongRunningCreateJobTests() { + // method invocation + SyncPoller response = setPlaybackSyncPollerPollInterval(longRunningClient + .beginCreateJob(new JobData(mapOf("max", 15.0D, "min", 14.0D, "average", 14.3D)).setConfiguration("{}"))); + + // response assertion + Assertions.assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, + response.waitForCompletion().getStatus()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/methodoverride/generated/MethodOverrideClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/methodoverride/generated/MethodOverrideClientTestBase.java new file mode 100644 index 00000000000..20e12ef3aed --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/methodoverride/generated/MethodOverrideClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.methodoverride.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.methodoverride.MethodOverrideClient; +import tsptest.methodoverride.MethodOverrideClientBuilder; + +class MethodOverrideClientTestBase extends TestProxyTestBase { + protected MethodOverrideClient methodOverrideClient; + + @Override + protected void beforeTest() { + MethodOverrideClientBuilder methodOverrideClientbuilder = new MethodOverrideClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + methodOverrideClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + methodOverrideClient = methodOverrideClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelClientTestBase.java new file mode 100644 index 00000000000..97f6f498216 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.model.ModelClient; +import tsptest.model.ModelClientBuilder; + +class ModelClientTestBase extends TestProxyTestBase { + protected ModelClient modelClient; + + @Override + protected void beforeTest() { + ModelClientBuilder modelClientbuilder + = new ModelClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + modelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + modelClient = modelClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelOpPutNestedTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelOpPutNestedTests.java new file mode 100644 index 00000000000..7b090e408a7 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/model/generated/ModelOpPutNestedTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.model.generated; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import tsptest.model.models.NestedModel; +import tsptest.model.models.NestedModel1; +import tsptest.model.models.NestedModel2; + +@Disabled +public final class ModelOpPutNestedTests extends ModelClientTestBase { + @Test + @Disabled + public void testModelOpPutNestedTests() { + // method invocation + NestedModel response = modelClient.putNested(null); + + // response assertion + Assertions.assertNotNull(response); + // verify property "nested1" + NestedModel1 responseNested1 = response.getNested1(); + Assertions.assertNotNull(responseNested1); + NestedModel2 responseNested1Nested2 = responseNested1.getNested2(); + Assertions.assertNotNull(responseNested1Nested2); + Assertions.assertEquals("123", responseNested1Nested2.getData()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/MultiContentTypesClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/MultiContentTypesClientTestBase.java new file mode 100644 index 00000000000..b895a57f738 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/MultiContentTypesClientTestBase.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.multicontenttypes.MultiContentTypesClient; +import tsptest.multicontenttypes.MultiContentTypesClientBuilder; +import tsptest.multicontenttypes.MultipleContentTypesOnRequestClient; +import tsptest.multicontenttypes.SingleContentTypeClient; + +class MultiContentTypesClientTestBase extends TestProxyTestBase { + protected MultiContentTypesClient multiContentTypesClient; + + protected SingleContentTypeClient singleContentTypeClient; + + protected MultipleContentTypesOnRequestClient multipleContentTypesOnRequestClient; + + @Override + protected void beforeTest() { + MultiContentTypesClientBuilder multiContentTypesClientbuilder = new MultiContentTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + multiContentTypesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + multiContentTypesClient = multiContentTypesClientbuilder.buildClient(); + + MultiContentTypesClientBuilder singleContentTypeClientbuilder = new MultiContentTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + singleContentTypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + singleContentTypeClient = singleContentTypeClientbuilder.buildSingleContentTypeClient(); + + MultiContentTypesClientBuilder multipleContentTypesOnRequestClientbuilder = new MultiContentTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + multipleContentTypesOnRequestClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + multipleContentTypesOnRequestClient + = multipleContentTypesOnRequestClientbuilder.buildMultipleContentTypesOnRequestClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentTypeTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentTypeTests.java new file mode 100644 index 00000000000..18de83445ee --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multicontenttypes/generated/SingleContentTypeUploadImageForSingleContentTypeTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multicontenttypes.generated; + +import com.azure.core.util.BinaryData; +import java.nio.charset.StandardCharsets; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class SingleContentTypeUploadImageForSingleContentTypeTests extends MultiContentTypesClientTestBase { + @Test + @Disabled + public void testSingleContentTypeUploadImageForSingleContentTypeTests() { + // method invocation + singleContentTypeClient.uploadImageForSingleContentType( + BinaryData.fromBytes("\"D:\\Program Files\"".getBytes(StandardCharsets.UTF_8))); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multipart/generated/MultipartClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multipart/generated/MultipartClientTestBase.java new file mode 100644 index 00000000000..fe72d08112e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/multipart/generated/MultipartClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.multipart.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.multipart.MultipartClient; +import tsptest.multipart.MultipartClientBuilder; + +class MultipartClientTestBase extends TestProxyTestBase { + protected MultipartClient multipartClient; + + @Override + protected void beforeTest() { + MultipartClientBuilder multipartClientbuilder + = new MultipartClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + multipartClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + multipartClient = multipartClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namespaceclient/generated/NamespaceClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namespaceclient/generated/NamespaceClientTestBase.java new file mode 100644 index 00000000000..f0721c907ab --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namespaceclient/generated/NamespaceClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namespaceclient.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.namespaceclient.NamespaceClient; +import tsptest.namespaceclient.NamespaceClientBuilder; + +class NamespaceClientTestBase extends TestProxyTestBase { + protected NamespaceClient namespaceClient; + + @Override + protected void beforeTest() { + NamespaceClientBuilder namespaceClientbuilder + = new NamespaceClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + namespaceClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + namespaceClient = namespaceClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/naming/generated/NamingClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/naming/generated/NamingClientTestBase.java new file mode 100644 index 00000000000..906de0756af --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/naming/generated/NamingClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.naming.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.naming.NamingClient; +import tsptest.naming.NamingClientBuilder; + +class NamingClientTestBase extends TestProxyTestBase { + protected NamingClient namingClient; + + @Override + protected void beforeTest() { + NamingClientBuilder namingClientbuilder + = new NamingClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + namingClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + namingClient = namingClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namingjavaparser/generated/NamingJavaParserClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namingjavaparser/generated/NamingJavaParserClientTestBase.java new file mode 100644 index 00000000000..3f5054bbec1 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/namingjavaparser/generated/NamingJavaParserClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.namingjavaparser.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.namingjavaparser.NamingJavaParserClient; +import tsptest.namingjavaparser.NamingJavaParserClientBuilder; + +class NamingJavaParserClientTestBase extends TestProxyTestBase { + protected NamingJavaParserClient namingJavaParserClient; + + @Override + protected void beforeTest() { + NamingJavaParserClientBuilder namingJavaParserClientbuilder = new NamingJavaParserClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + namingJavaParserClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + namingJavaParserClient = namingJavaParserClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/optional/generated/OptionalClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/optional/generated/OptionalClientTestBase.java new file mode 100644 index 00000000000..bdcb8e1f601 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/optional/generated/OptionalClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.optional.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.optional.OptionalClient; +import tsptest.optional.OptionalClientBuilder; + +class OptionalClientTestBase extends TestProxyTestBase { + protected OptionalClient optionalClient; + + @Override + protected void beforeTest() { + OptionalClientBuilder optionalClientbuilder + = new OptionalClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + optionalClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + optionalClient = optionalClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/patch/generated/PatchClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/patch/generated/PatchClientTestBase.java new file mode 100644 index 00000000000..52da5c9c820 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/patch/generated/PatchClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.patch.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.patch.PatchClient; +import tsptest.patch.PatchClientBuilder; + +class PatchClientTestBase extends TestProxyTestBase { + protected PatchClient patchClient; + + @Override + protected void beforeTest() { + PatchClientBuilder patchClientbuilder + = new PatchClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + patchClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + patchClient = patchClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/protocolandconvenient/generated/ProtocolAndConvenientClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/protocolandconvenient/generated/ProtocolAndConvenientClientTestBase.java new file mode 100644 index 00000000000..933f047dc84 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/protocolandconvenient/generated/ProtocolAndConvenientClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.protocolandconvenient.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.protocolandconvenient.ProtocolAndConvenientClient; +import tsptest.protocolandconvenient.ProtocolAndConvenientClientBuilder; + +class ProtocolAndConvenientClientTestBase extends TestProxyTestBase { + protected ProtocolAndConvenientClient protocolAndConvenientClient; + + @Override + protected void beforeTest() { + ProtocolAndConvenientClientBuilder protocolAndConvenientClientbuilder = new ProtocolAndConvenientClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + protocolAndConvenientClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + protocolAndConvenientClient = protocolAndConvenientClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseClientTestBase.java new file mode 100644 index 00000000000..29aaa1541f0 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.response.ResponseClient; +import tsptest.response.ResponseClientBuilder; + +class ResponseClientTestBase extends TestProxyTestBase { + protected ResponseClient responseClient; + + @Override + protected void beforeTest() { + ResponseClientBuilder responseClientbuilder + = new ResponseClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + responseClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + responseClient = responseClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpExistsTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpExistsTests.java new file mode 100644 index 00000000000..350106599e6 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpExistsTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.generated; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class ResponseOpExistsTests extends ResponseClientTestBase { + @Test + @Disabled + public void testResponseOpExistsTests() { + // method invocation + boolean response = responseClient.exists(); + + // response assertion + Assertions.assertTrue(response); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpListStringsTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpListStringsTests.java new file mode 100644 index 00000000000..c6ef3a2f788 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/response/generated/ResponseOpListStringsTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.response.generated; + +import com.azure.core.http.rest.PagedIterable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +@Disabled +public final class ResponseOpListStringsTests extends ResponseClientTestBase { + @Test + @Disabled + public void testResponseOpListStringsTests() { + // method invocation + PagedIterable response = responseClient.listStrings(); + + // response assertion + Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/BuiltinOpReadTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/BuiltinOpReadTests.java new file mode 100644 index 00000000000..528efd7f53a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/BuiltinOpReadTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialchars.generated; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import tsptest.specialchars.models.Resource; + +@Disabled +public final class BuiltinOpReadTests extends SpecialCharsClientTestBase { + @Test + @Disabled + public void testBuiltinOpReadTests() { + // method invocation + Resource response = specialCharsClient.read(null); + + // response assertion + Assertions.assertNotNull(response); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/SpecialCharsClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/SpecialCharsClientTestBase.java new file mode 100644 index 00000000000..1a0b709fddc --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialchars/generated/SpecialCharsClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialchars.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.specialchars.SpecialCharsClient; +import tsptest.specialchars.SpecialCharsClientBuilder; + +class SpecialCharsClientTestBase extends TestProxyTestBase { + protected SpecialCharsClient specialCharsClient; + + @Override + protected void beforeTest() { + SpecialCharsClientBuilder specialCharsClientbuilder = new SpecialCharsClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + specialCharsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + specialCharsClient = specialCharsClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersListWithEtagTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersListWithEtagTests.java new file mode 100644 index 00000000000..84cf79074f3 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersListWithEtagTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.generated; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.PagedIterable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import tsptest.specialheaders.models.Resource; + +@Disabled +public final class EtagHeadersListWithEtagTests extends SpecialHeadersClientTestBase { + @Test + @Disabled + public void testEtagHeadersListWithEtagTests() { + // method invocation + PagedIterable response = etagHeadersClient.listWithEtag(); + + // response assertion + Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); + Assertions.assertEquals("\"64e005\"", + response.iterableByPage().iterator().next().getHeaders().get(HttpHeaderName.fromString("ETag")).getValue()); + Resource firstItem = response.iterator().next(); + Assertions.assertNotNull(firstItem); + // verify property "id" + Assertions.assertEquals("myId", firstItem.getId()); + // verify property "name" + Assertions.assertEquals("name", firstItem.getName()); + // verify property "description" + Assertions.assertEquals("This is sample for Etag headers", firstItem.getDescription()); + // verify property "type" + Assertions.assertEquals("myType", firstItem.getType()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeadersTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeadersTests.java new file mode 100644 index 00000000000..a0f27011eca --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/EtagHeadersPutWithRequestHeadersTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.generated; + +import com.azure.core.http.RequestConditions; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import tsptest.specialheaders.models.Resource; + +@Disabled +public final class EtagHeadersPutWithRequestHeadersTests extends SpecialHeadersClientTestBase { + @Test + @Disabled + public void testEtagHeadersPutWithRequestHeadersTests() { + // method invocation + Resource response = etagHeadersClient.putWithRequestHeaders("name", + new Resource().setDescription("This is sample for Etag headers").setType("myType"), + new RequestConditions().setIfMatch("\"64e005\"")); + + // response assertion + Assertions.assertNotNull(response); + // verify property "id" + Assertions.assertEquals("myId", response.getId()); + // verify property "name" + Assertions.assertEquals("name", response.getName()); + // verify property "description" + Assertions.assertEquals("This is sample for Etag headers", response.getDescription()); + // verify property "type" + Assertions.assertEquals("myType", response.getType()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/SpecialHeadersClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/SpecialHeadersClientTestBase.java new file mode 100644 index 00000000000..16f1a7b3bda --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/specialheaders/generated/SpecialHeadersClientTestBase.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.specialheaders.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.specialheaders.EtagHeadersClient; +import tsptest.specialheaders.EtagHeadersOptionalBodyClient; +import tsptest.specialheaders.RepeatabilityHeadersClient; +import tsptest.specialheaders.SkipSpecialHeadersClient; +import tsptest.specialheaders.SpecialHeadersClientBuilder; + +class SpecialHeadersClientTestBase extends TestProxyTestBase { + protected RepeatabilityHeadersClient repeatabilityHeadersClient; + + protected EtagHeadersClient etagHeadersClient; + + protected EtagHeadersOptionalBodyClient etagHeadersOptionalBodyClient; + + protected SkipSpecialHeadersClient skipSpecialHeadersClient; + + @Override + protected void beforeTest() { + SpecialHeadersClientBuilder repeatabilityHeadersClientbuilder = new SpecialHeadersClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + repeatabilityHeadersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + repeatabilityHeadersClient = repeatabilityHeadersClientbuilder.buildRepeatabilityHeadersClient(); + + SpecialHeadersClientBuilder etagHeadersClientbuilder = new SpecialHeadersClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + etagHeadersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + etagHeadersClient = etagHeadersClientbuilder.buildEtagHeadersClient(); + + SpecialHeadersClientBuilder etagHeadersOptionalBodyClientbuilder = new SpecialHeadersClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + etagHeadersOptionalBodyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + etagHeadersOptionalBodyClient = etagHeadersOptionalBodyClientbuilder.buildEtagHeadersOptionalBodyClient(); + + SpecialHeadersClientBuilder skipSpecialHeadersClientbuilder = new SpecialHeadersClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + skipSpecialHeadersClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + skipSpecialHeadersClient = skipSpecialHeadersClientbuilder.buildSkipSpecialHeadersClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/subclass/generated/SubclassClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/subclass/generated/SubclassClientTestBase.java new file mode 100644 index 00000000000..5ade858bbcf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/subclass/generated/SubclassClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.subclass.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.subclass.SubclassClient; +import tsptest.subclass.SubclassClientBuilder; + +class SubclassClientTestBase extends TestProxyTestBase { + protected SubclassClient subclassClient; + + @Override + protected void beforeTest() { + SubclassClientBuilder subclassClientbuilder + = new SubclassClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + subclassClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + subclassClient = subclassClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/union/generated/UnionClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/union/generated/UnionClientTestBase.java new file mode 100644 index 00000000000..a1e04ef7073 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/union/generated/UnionClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.union.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.union.UnionClient; +import tsptest.union.UnionClientBuilder; + +class UnionClientTestBase extends TestProxyTestBase { + protected UnionClient unionClient; + + @Override + protected void beforeTest() { + UnionClientBuilder unionClientbuilder + = new UnionClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unionClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unionClient = unionClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningClientTestBase.java new file mode 100644 index 00000000000..10afb98ad7b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.versioning.VersioningClient; +import tsptest.versioning.VersioningClientBuilder; + +class VersioningClientTestBase extends TestProxyTestBase { + protected VersioningClient versioningClient; + + @Override + protected void beforeTest() { + VersioningClientBuilder versioningClientbuilder + = new VersioningClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + versioningClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + versioningClient = versioningClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningOpListTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningOpListTests.java new file mode 100644 index 00000000000..a5a7574b420 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/versioning/generated/VersioningOpListTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.versioning.generated; + +import com.azure.core.http.rest.PagedIterable; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import tsptest.versioning.models.Resource; + +@Disabled +public final class VersioningOpListTests extends VersioningClientTestBase { + @Test + @Disabled + public void testVersioningOpListTests() { + // method invocation + PagedIterable response = versioningClient.list(Arrays.asList("name=name"), null); + + // response assertion + Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); + Resource firstItem = response.iterator().next(); + Assertions.assertNotNull(firstItem); + // verify property "id" + Assertions.assertEquals("myId", firstItem.getId()); + // verify property "name" + Assertions.assertEquals("name", firstItem.getName()); + // verify property "type" + Assertions.assertEquals("type", firstItem.getType()); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/visibility/generated/VisibilityClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/visibility/generated/VisibilityClientTestBase.java new file mode 100644 index 00000000000..1a2f22b26c4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/visibility/generated/VisibilityClientTestBase.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.visibility.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.visibility.VisibilityClient; +import tsptest.visibility.VisibilityClientBuilder; +import tsptest.visibility.VisibilityReadClient; +import tsptest.visibility.VisibilityWriteClient; + +class VisibilityClientTestBase extends TestProxyTestBase { + protected VisibilityClient visibilityClient; + + protected VisibilityReadClient visibilityReadClient; + + protected VisibilityWriteClient visibilityWriteClient; + + @Override + protected void beforeTest() { + VisibilityClientBuilder visibilityClientbuilder + = new VisibilityClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + visibilityClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + visibilityClient = visibilityClientbuilder.buildClient(); + + VisibilityClientBuilder visibilityReadClientbuilder + = new VisibilityClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + visibilityReadClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + visibilityReadClient = visibilityReadClientbuilder.buildVisibilityReadClient(); + + VisibilityClientBuilder visibilityWriteClientbuilder + = new VisibilityClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + visibilityWriteClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + visibilityWriteClient = visibilityWriteClientbuilder.buildVisibilityWriteClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/wiretype/generated/WireTypeClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/wiretype/generated/WireTypeClientTestBase.java new file mode 100644 index 00000000000..2d869221135 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/wiretype/generated/WireTypeClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.wiretype.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.wiretype.WireTypeClient; +import tsptest.wiretype.WireTypeClientBuilder; + +class WireTypeClientTestBase extends TestProxyTestBase { + protected WireTypeClient wireTypeClient; + + @Override + protected void beforeTest() { + WireTypeClientBuilder wireTypeClientbuilder + = new WireTypeClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + wireTypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + wireTypeClient = wireTypeClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/array/generated/ArrayClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/array/generated/ArrayClientTestBase.java new file mode 100644 index 00000000000..abba8c122df --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/array/generated/ArrayClientTestBase.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.array.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.array.ArrayClientBuilder; +import type.array.BooleanValueClient; +import type.array.DatetimeValueClient; +import type.array.DurationValueClient; +import type.array.Float32ValueClient; +import type.array.Int32ValueClient; +import type.array.Int64ValueClient; +import type.array.ModelValueClient; +import type.array.NullableBooleanValueClient; +import type.array.NullableFloatValueClient; +import type.array.NullableInt32ValueClient; +import type.array.NullableModelValueClient; +import type.array.NullableStringValueClient; +import type.array.StringValueClient; +import type.array.UnknownValueClient; + +class ArrayClientTestBase extends TestProxyTestBase { + protected Int32ValueClient int32ValueClient; + + protected Int64ValueClient int64ValueClient; + + protected BooleanValueClient booleanValueClient; + + protected StringValueClient stringValueClient; + + protected Float32ValueClient float32ValueClient; + + protected DatetimeValueClient datetimeValueClient; + + protected DurationValueClient durationValueClient; + + protected UnknownValueClient unknownValueClient; + + protected ModelValueClient modelValueClient; + + protected NullableFloatValueClient nullableFloatValueClient; + + protected NullableInt32ValueClient nullableInt32ValueClient; + + protected NullableBooleanValueClient nullableBooleanValueClient; + + protected NullableStringValueClient nullableStringValueClient; + + protected NullableModelValueClient nullableModelValueClient; + + @Override + protected void beforeTest() { + ArrayClientBuilder int32ValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + int32ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + int32ValueClient = int32ValueClientbuilder.buildInt32ValueClient(); + + ArrayClientBuilder int64ValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + int64ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + int64ValueClient = int64ValueClientbuilder.buildInt64ValueClient(); + + ArrayClientBuilder booleanValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + booleanValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + booleanValueClient = booleanValueClientbuilder.buildBooleanValueClient(); + + ArrayClientBuilder stringValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + stringValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + stringValueClient = stringValueClientbuilder.buildStringValueClient(); + + ArrayClientBuilder float32ValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + float32ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + float32ValueClient = float32ValueClientbuilder.buildFloat32ValueClient(); + + ArrayClientBuilder datetimeValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + datetimeValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + datetimeValueClient = datetimeValueClientbuilder.buildDatetimeValueClient(); + + ArrayClientBuilder durationValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + durationValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + durationValueClient = durationValueClientbuilder.buildDurationValueClient(); + + ArrayClientBuilder unknownValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unknownValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unknownValueClient = unknownValueClientbuilder.buildUnknownValueClient(); + + ArrayClientBuilder modelValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + modelValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + modelValueClient = modelValueClientbuilder.buildModelValueClient(); + + ArrayClientBuilder nullableFloatValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + nullableFloatValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + nullableFloatValueClient = nullableFloatValueClientbuilder.buildNullableFloatValueClient(); + + ArrayClientBuilder nullableInt32ValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + nullableInt32ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + nullableInt32ValueClient = nullableInt32ValueClientbuilder.buildNullableInt32ValueClient(); + + ArrayClientBuilder nullableBooleanValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + nullableBooleanValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + nullableBooleanValueClient = nullableBooleanValueClientbuilder.buildNullableBooleanValueClient(); + + ArrayClientBuilder nullableStringValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + nullableStringValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + nullableStringValueClient = nullableStringValueClientbuilder.buildNullableStringValueClient(); + + ArrayClientBuilder nullableModelValueClientbuilder = new ArrayClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + nullableModelValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + nullableModelValueClient = nullableModelValueClientbuilder.buildNullableModelValueClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/dictionary/generated/DictionaryClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/dictionary/generated/DictionaryClientTestBase.java new file mode 100644 index 00000000000..c2ef40d1d2b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/dictionary/generated/DictionaryClientTestBase.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.dictionary.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.dictionary.BooleanValueClient; +import type.dictionary.DatetimeValueClient; +import type.dictionary.DictionaryClientBuilder; +import type.dictionary.DurationValueClient; +import type.dictionary.Float32ValueClient; +import type.dictionary.Int32ValueClient; +import type.dictionary.Int64ValueClient; +import type.dictionary.ModelValueClient; +import type.dictionary.NullableFloatValueClient; +import type.dictionary.RecursiveModelValueClient; +import type.dictionary.StringValueClient; +import type.dictionary.UnknownValueClient; + +class DictionaryClientTestBase extends TestProxyTestBase { + protected Int32ValueClient int32ValueClient; + + protected Int64ValueClient int64ValueClient; + + protected BooleanValueClient booleanValueClient; + + protected StringValueClient stringValueClient; + + protected Float32ValueClient float32ValueClient; + + protected DatetimeValueClient datetimeValueClient; + + protected DurationValueClient durationValueClient; + + protected UnknownValueClient unknownValueClient; + + protected ModelValueClient modelValueClient; + + protected RecursiveModelValueClient recursiveModelValueClient; + + protected NullableFloatValueClient nullableFloatValueClient; + + @Override + protected void beforeTest() { + DictionaryClientBuilder int32ValueClientbuilder = new DictionaryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + int32ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + int32ValueClient = int32ValueClientbuilder.buildInt32ValueClient(); + + DictionaryClientBuilder int64ValueClientbuilder = new DictionaryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + int64ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + int64ValueClient = int64ValueClientbuilder.buildInt64ValueClient(); + + DictionaryClientBuilder booleanValueClientbuilder = new DictionaryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + booleanValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + booleanValueClient = booleanValueClientbuilder.buildBooleanValueClient(); + + DictionaryClientBuilder stringValueClientbuilder = new DictionaryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + stringValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + stringValueClient = stringValueClientbuilder.buildStringValueClient(); + + DictionaryClientBuilder float32ValueClientbuilder = new DictionaryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + float32ValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + float32ValueClient = float32ValueClientbuilder.buildFloat32ValueClient(); + + DictionaryClientBuilder datetimeValueClientbuilder = new DictionaryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + datetimeValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + datetimeValueClient = datetimeValueClientbuilder.buildDatetimeValueClient(); + + DictionaryClientBuilder durationValueClientbuilder = new DictionaryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + durationValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + durationValueClient = durationValueClientbuilder.buildDurationValueClient(); + + DictionaryClientBuilder unknownValueClientbuilder = new DictionaryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unknownValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unknownValueClient = unknownValueClientbuilder.buildUnknownValueClient(); + + DictionaryClientBuilder modelValueClientbuilder = new DictionaryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + modelValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + modelValueClient = modelValueClientbuilder.buildModelValueClient(); + + DictionaryClientBuilder recursiveModelValueClientbuilder = new DictionaryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + recursiveModelValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + recursiveModelValueClient = recursiveModelValueClientbuilder.buildRecursiveModelValueClient(); + + DictionaryClientBuilder nullableFloatValueClientbuilder = new DictionaryClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + nullableFloatValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + nullableFloatValueClient = nullableFloatValueClientbuilder.buildNullableFloatValueClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/extensible/generated/ExtensibleClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/extensible/generated/ExtensibleClientTestBase.java new file mode 100644 index 00000000000..038458f064a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/extensible/generated/ExtensibleClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.extensible.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.enums.extensible.ExtensibleClient; +import type.enums.extensible.ExtensibleClientBuilder; + +class ExtensibleClientTestBase extends TestProxyTestBase { + protected ExtensibleClient extensibleClient; + + @Override + protected void beforeTest() { + ExtensibleClientBuilder extensibleClientbuilder = new ExtensibleClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extensibleClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extensibleClient = extensibleClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/fixed/generated/FixedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/fixed/generated/FixedClientTestBase.java new file mode 100644 index 00000000000..99e1909d7ef --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/enums/fixed/generated/FixedClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.enums.fixed.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.enums.fixed.FixedClient; +import type.enums.fixed.FixedClientBuilder; + +class FixedClientTestBase extends TestProxyTestBase { + protected FixedClient fixedClient; + + @Override + protected void beforeTest() { + FixedClientBuilder fixedClientbuilder = new FixedClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + fixedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + fixedClient = fixedClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/empty/generated/EmptyClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/empty/generated/EmptyClientTestBase.java new file mode 100644 index 00000000000..2a37097e8bf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/empty/generated/EmptyClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.empty.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.model.empty.EmptyClient; +import type.model.empty.EmptyClientBuilder; + +class EmptyClientTestBase extends TestProxyTestBase { + protected EmptyClient emptyClient; + + @Override + protected void beforeTest() { + EmptyClientBuilder emptyClientbuilder = new EmptyClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + emptyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + emptyClient = emptyClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/enumdiscriminator/generated/EnumDiscriminatorClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/enumdiscriminator/generated/EnumDiscriminatorClientTestBase.java new file mode 100644 index 00000000000..23d0fb02e38 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/enumdiscriminator/generated/EnumDiscriminatorClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.enumdiscriminator.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient; +import type.model.inheritance.enumdiscriminator.EnumDiscriminatorClientBuilder; + +class EnumDiscriminatorClientTestBase extends TestProxyTestBase { + protected EnumDiscriminatorClient enumDiscriminatorClient; + + @Override + protected void beforeTest() { + EnumDiscriminatorClientBuilder enumDiscriminatorClientbuilder = new EnumDiscriminatorClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + enumDiscriminatorClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + enumDiscriminatorClient = enumDiscriminatorClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/nesteddiscriminator/generated/NestedDiscriminatorClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/nesteddiscriminator/generated/NestedDiscriminatorClientTestBase.java new file mode 100644 index 00000000000..adab1f9b5cf --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/nesteddiscriminator/generated/NestedDiscriminatorClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.nesteddiscriminator.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient; +import type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClientBuilder; + +class NestedDiscriminatorClientTestBase extends TestProxyTestBase { + protected NestedDiscriminatorClient nestedDiscriminatorClient; + + @Override + protected void beforeTest() { + NestedDiscriminatorClientBuilder nestedDiscriminatorClientbuilder = new NestedDiscriminatorClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + nestedDiscriminatorClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + nestedDiscriminatorClient = nestedDiscriminatorClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/notdiscriminated/generated/NotDiscriminatedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/notdiscriminated/generated/NotDiscriminatedClientTestBase.java new file mode 100644 index 00000000000..d0d88992f48 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/notdiscriminated/generated/NotDiscriminatedClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.notdiscriminated.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.model.inheritance.notdiscriminated.NotDiscriminatedClient; +import type.model.inheritance.notdiscriminated.NotDiscriminatedClientBuilder; + +class NotDiscriminatedClientTestBase extends TestProxyTestBase { + protected NotDiscriminatedClient notDiscriminatedClient; + + @Override + protected void beforeTest() { + NotDiscriminatedClientBuilder notDiscriminatedClientbuilder = new NotDiscriminatedClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + notDiscriminatedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + notDiscriminatedClient = notDiscriminatedClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/recursive/generated/RecursiveClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/recursive/generated/RecursiveClientTestBase.java new file mode 100644 index 00000000000..06bc7a46240 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/recursive/generated/RecursiveClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.recursive.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.model.inheritance.recursive.RecursiveClient; +import type.model.inheritance.recursive.RecursiveClientBuilder; + +class RecursiveClientTestBase extends TestProxyTestBase { + protected RecursiveClient recursiveClient; + + @Override + protected void beforeTest() { + RecursiveClientBuilder recursiveClientbuilder = new RecursiveClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + recursiveClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + recursiveClient = recursiveClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/singlediscriminator/generated/SingleDiscriminatorClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/singlediscriminator/generated/SingleDiscriminatorClientTestBase.java new file mode 100644 index 00000000000..fae99d0b2f5 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/inheritance/singlediscriminator/generated/SingleDiscriminatorClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.inheritance.singlediscriminator.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.model.inheritance.singlediscriminator.SingleDiscriminatorClient; +import type.model.inheritance.singlediscriminator.SingleDiscriminatorClientBuilder; + +class SingleDiscriminatorClientTestBase extends TestProxyTestBase { + protected SingleDiscriminatorClient singleDiscriminatorClient; + + @Override + protected void beforeTest() { + SingleDiscriminatorClientBuilder singleDiscriminatorClientbuilder = new SingleDiscriminatorClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + singleDiscriminatorClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + singleDiscriminatorClient = singleDiscriminatorClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/usage/generated/UsageClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/usage/generated/UsageClientTestBase.java new file mode 100644 index 00000000000..711f198b038 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/usage/generated/UsageClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.usage.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.model.usage.UsageClient; +import type.model.usage.UsageClientBuilder; + +class UsageClientTestBase extends TestProxyTestBase { + protected UsageClient usageClient; + + @Override + protected void beforeTest() { + UsageClientBuilder usageClientbuilder = new UsageClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + usageClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + usageClient = usageClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/visibility/generated/VisibilityClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/visibility/generated/VisibilityClientTestBase.java new file mode 100644 index 00000000000..12159b49749 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/model/visibility/generated/VisibilityClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.model.visibility.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.model.visibility.VisibilityClient; +import type.model.visibility.VisibilityClientBuilder; + +class VisibilityClientTestBase extends TestProxyTestBase { + protected VisibilityClient visibilityClient; + + @Override + protected void beforeTest() { + VisibilityClientBuilder visibilityClientbuilder = new VisibilityClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + visibilityClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + visibilityClient = visibilityClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/additionalproperties/generated/AdditionalPropertiesClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/additionalproperties/generated/AdditionalPropertiesClientTestBase.java new file mode 100644 index 00000000000..283dd23022c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/additionalproperties/generated/AdditionalPropertiesClientTestBase.java @@ -0,0 +1,411 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.additionalproperties.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.property.additionalproperties.AdditionalPropertiesClientBuilder; +import type.property.additionalproperties.ExtendsDifferentSpreadFloatClient; +import type.property.additionalproperties.ExtendsDifferentSpreadModelArrayClient; +import type.property.additionalproperties.ExtendsDifferentSpreadModelClient; +import type.property.additionalproperties.ExtendsDifferentSpreadStringClient; +import type.property.additionalproperties.ExtendsFloatClient; +import type.property.additionalproperties.ExtendsModelArrayClient; +import type.property.additionalproperties.ExtendsModelClient; +import type.property.additionalproperties.ExtendsStringClient; +import type.property.additionalproperties.ExtendsUnknownClient; +import type.property.additionalproperties.ExtendsUnknownDerivedClient; +import type.property.additionalproperties.ExtendsUnknownDiscriminatedClient; +import type.property.additionalproperties.IsFloatClient; +import type.property.additionalproperties.IsModelArrayClient; +import type.property.additionalproperties.IsModelClient; +import type.property.additionalproperties.IsStringClient; +import type.property.additionalproperties.IsUnknownClient; +import type.property.additionalproperties.IsUnknownDerivedClient; +import type.property.additionalproperties.IsUnknownDiscriminatedClient; +import type.property.additionalproperties.MultipleSpreadClient; +import type.property.additionalproperties.SpreadDifferentFloatClient; +import type.property.additionalproperties.SpreadDifferentModelArrayClient; +import type.property.additionalproperties.SpreadDifferentModelClient; +import type.property.additionalproperties.SpreadDifferentStringClient; +import type.property.additionalproperties.SpreadFloatClient; +import type.property.additionalproperties.SpreadModelArrayClient; +import type.property.additionalproperties.SpreadModelClient; +import type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion2Client; +import type.property.additionalproperties.SpreadRecordNonDiscriminatedUnion3Client; +import type.property.additionalproperties.SpreadRecordNonDiscriminatedUnionClient; +import type.property.additionalproperties.SpreadRecordUnionClient; +import type.property.additionalproperties.SpreadStringClient; + +class AdditionalPropertiesClientTestBase extends TestProxyTestBase { + protected ExtendsUnknownClient extendsUnknownClient; + + protected ExtendsUnknownDerivedClient extendsUnknownDerivedClient; + + protected ExtendsUnknownDiscriminatedClient extendsUnknownDiscriminatedClient; + + protected IsUnknownClient isUnknownClient; + + protected IsUnknownDerivedClient isUnknownDerivedClient; + + protected IsUnknownDiscriminatedClient isUnknownDiscriminatedClient; + + protected ExtendsStringClient extendsStringClient; + + protected IsStringClient isStringClient; + + protected SpreadStringClient spreadStringClient; + + protected ExtendsFloatClient extendsFloatClient; + + protected IsFloatClient isFloatClient; + + protected SpreadFloatClient spreadFloatClient; + + protected ExtendsModelClient extendsModelClient; + + protected IsModelClient isModelClient; + + protected SpreadModelClient spreadModelClient; + + protected ExtendsModelArrayClient extendsModelArrayClient; + + protected IsModelArrayClient isModelArrayClient; + + protected SpreadModelArrayClient spreadModelArrayClient; + + protected SpreadDifferentStringClient spreadDifferentStringClient; + + protected SpreadDifferentFloatClient spreadDifferentFloatClient; + + protected SpreadDifferentModelClient spreadDifferentModelClient; + + protected SpreadDifferentModelArrayClient spreadDifferentModelArrayClient; + + protected ExtendsDifferentSpreadStringClient extendsDifferentSpreadStringClient; + + protected ExtendsDifferentSpreadFloatClient extendsDifferentSpreadFloatClient; + + protected ExtendsDifferentSpreadModelClient extendsDifferentSpreadModelClient; + + protected ExtendsDifferentSpreadModelArrayClient extendsDifferentSpreadModelArrayClient; + + protected MultipleSpreadClient multipleSpreadClient; + + protected SpreadRecordUnionClient spreadRecordUnionClient; + + protected SpreadRecordNonDiscriminatedUnionClient spreadRecordNonDiscriminatedUnionClient; + + protected SpreadRecordNonDiscriminatedUnion2Client spreadRecordNonDiscriminatedUnion2Client; + + protected SpreadRecordNonDiscriminatedUnion3Client spreadRecordNonDiscriminatedUnion3Client; + + @Override + protected void beforeTest() { + AdditionalPropertiesClientBuilder extendsUnknownClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extendsUnknownClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extendsUnknownClient = extendsUnknownClientbuilder.buildExtendsUnknownClient(); + + AdditionalPropertiesClientBuilder extendsUnknownDerivedClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extendsUnknownDerivedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extendsUnknownDerivedClient = extendsUnknownDerivedClientbuilder.buildExtendsUnknownDerivedClient(); + + AdditionalPropertiesClientBuilder extendsUnknownDiscriminatedClientbuilder + = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extendsUnknownDiscriminatedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extendsUnknownDiscriminatedClient + = extendsUnknownDiscriminatedClientbuilder.buildExtendsUnknownDiscriminatedClient(); + + AdditionalPropertiesClientBuilder isUnknownClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + isUnknownClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + isUnknownClient = isUnknownClientbuilder.buildIsUnknownClient(); + + AdditionalPropertiesClientBuilder isUnknownDerivedClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + isUnknownDerivedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + isUnknownDerivedClient = isUnknownDerivedClientbuilder.buildIsUnknownDerivedClient(); + + AdditionalPropertiesClientBuilder isUnknownDiscriminatedClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + isUnknownDiscriminatedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + isUnknownDiscriminatedClient = isUnknownDiscriminatedClientbuilder.buildIsUnknownDiscriminatedClient(); + + AdditionalPropertiesClientBuilder extendsStringClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extendsStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extendsStringClient = extendsStringClientbuilder.buildExtendsStringClient(); + + AdditionalPropertiesClientBuilder isStringClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + isStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + isStringClient = isStringClientbuilder.buildIsStringClient(); + + AdditionalPropertiesClientBuilder spreadStringClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + spreadStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + spreadStringClient = spreadStringClientbuilder.buildSpreadStringClient(); + + AdditionalPropertiesClientBuilder extendsFloatClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extendsFloatClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extendsFloatClient = extendsFloatClientbuilder.buildExtendsFloatClient(); + + AdditionalPropertiesClientBuilder isFloatClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + isFloatClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + isFloatClient = isFloatClientbuilder.buildIsFloatClient(); + + AdditionalPropertiesClientBuilder spreadFloatClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + spreadFloatClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + spreadFloatClient = spreadFloatClientbuilder.buildSpreadFloatClient(); + + AdditionalPropertiesClientBuilder extendsModelClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extendsModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extendsModelClient = extendsModelClientbuilder.buildExtendsModelClient(); + + AdditionalPropertiesClientBuilder isModelClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + isModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + isModelClient = isModelClientbuilder.buildIsModelClient(); + + AdditionalPropertiesClientBuilder spreadModelClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + spreadModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + spreadModelClient = spreadModelClientbuilder.buildSpreadModelClient(); + + AdditionalPropertiesClientBuilder extendsModelArrayClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extendsModelArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extendsModelArrayClient = extendsModelArrayClientbuilder.buildExtendsModelArrayClient(); + + AdditionalPropertiesClientBuilder isModelArrayClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + isModelArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + isModelArrayClient = isModelArrayClientbuilder.buildIsModelArrayClient(); + + AdditionalPropertiesClientBuilder spreadModelArrayClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + spreadModelArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + spreadModelArrayClient = spreadModelArrayClientbuilder.buildSpreadModelArrayClient(); + + AdditionalPropertiesClientBuilder spreadDifferentStringClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + spreadDifferentStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + spreadDifferentStringClient = spreadDifferentStringClientbuilder.buildSpreadDifferentStringClient(); + + AdditionalPropertiesClientBuilder spreadDifferentFloatClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + spreadDifferentFloatClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + spreadDifferentFloatClient = spreadDifferentFloatClientbuilder.buildSpreadDifferentFloatClient(); + + AdditionalPropertiesClientBuilder spreadDifferentModelClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + spreadDifferentModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + spreadDifferentModelClient = spreadDifferentModelClientbuilder.buildSpreadDifferentModelClient(); + + AdditionalPropertiesClientBuilder spreadDifferentModelArrayClientbuilder + = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + spreadDifferentModelArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + spreadDifferentModelArrayClient = spreadDifferentModelArrayClientbuilder.buildSpreadDifferentModelArrayClient(); + + AdditionalPropertiesClientBuilder extendsDifferentSpreadStringClientbuilder + = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extendsDifferentSpreadStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extendsDifferentSpreadStringClient + = extendsDifferentSpreadStringClientbuilder.buildExtendsDifferentSpreadStringClient(); + + AdditionalPropertiesClientBuilder extendsDifferentSpreadFloatClientbuilder + = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extendsDifferentSpreadFloatClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extendsDifferentSpreadFloatClient + = extendsDifferentSpreadFloatClientbuilder.buildExtendsDifferentSpreadFloatClient(); + + AdditionalPropertiesClientBuilder extendsDifferentSpreadModelClientbuilder + = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extendsDifferentSpreadModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extendsDifferentSpreadModelClient + = extendsDifferentSpreadModelClientbuilder.buildExtendsDifferentSpreadModelClient(); + + AdditionalPropertiesClientBuilder extendsDifferentSpreadModelArrayClientbuilder + = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extendsDifferentSpreadModelArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extendsDifferentSpreadModelArrayClient + = extendsDifferentSpreadModelArrayClientbuilder.buildExtendsDifferentSpreadModelArrayClient(); + + AdditionalPropertiesClientBuilder multipleSpreadClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + multipleSpreadClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + multipleSpreadClient = multipleSpreadClientbuilder.buildMultipleSpreadClient(); + + AdditionalPropertiesClientBuilder spreadRecordUnionClientbuilder = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + spreadRecordUnionClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + spreadRecordUnionClient = spreadRecordUnionClientbuilder.buildSpreadRecordUnionClient(); + + AdditionalPropertiesClientBuilder spreadRecordNonDiscriminatedUnionClientbuilder + = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + spreadRecordNonDiscriminatedUnionClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + spreadRecordNonDiscriminatedUnionClient + = spreadRecordNonDiscriminatedUnionClientbuilder.buildSpreadRecordNonDiscriminatedUnionClient(); + + AdditionalPropertiesClientBuilder spreadRecordNonDiscriminatedUnion2Clientbuilder + = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + spreadRecordNonDiscriminatedUnion2Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + spreadRecordNonDiscriminatedUnion2Client + = spreadRecordNonDiscriminatedUnion2Clientbuilder.buildSpreadRecordNonDiscriminatedUnion2Client(); + + AdditionalPropertiesClientBuilder spreadRecordNonDiscriminatedUnion3Clientbuilder + = new AdditionalPropertiesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + spreadRecordNonDiscriminatedUnion3Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + spreadRecordNonDiscriminatedUnion3Client + = spreadRecordNonDiscriminatedUnion3Clientbuilder.buildSpreadRecordNonDiscriminatedUnion3Client(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/nullable/generated/NullableClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/nullable/generated/NullableClientTestBase.java new file mode 100644 index 00000000000..90b52ac3463 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/nullable/generated/NullableClientTestBase.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.nullable.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.property.nullable.BytesClient; +import type.property.nullable.CollectionsByteClient; +import type.property.nullable.CollectionsModelClient; +import type.property.nullable.CollectionsStringClient; +import type.property.nullable.DatetimeOperationClient; +import type.property.nullable.DurationOperationClient; +import type.property.nullable.NullableClientBuilder; +import type.property.nullable.StringOperationClient; + +class NullableClientTestBase extends TestProxyTestBase { + protected StringOperationClient stringOperationClient; + + protected BytesClient bytesClient; + + protected DatetimeOperationClient datetimeOperationClient; + + protected DurationOperationClient durationOperationClient; + + protected CollectionsByteClient collectionsByteClient; + + protected CollectionsModelClient collectionsModelClient; + + protected CollectionsStringClient collectionsStringClient; + + @Override + protected void beforeTest() { + NullableClientBuilder stringOperationClientbuilder = new NullableClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + stringOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + stringOperationClient = stringOperationClientbuilder.buildStringOperationClient(); + + NullableClientBuilder bytesClientbuilder = new NullableClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + bytesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + bytesClient = bytesClientbuilder.buildBytesClient(); + + NullableClientBuilder datetimeOperationClientbuilder = new NullableClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + datetimeOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + datetimeOperationClient = datetimeOperationClientbuilder.buildDatetimeOperationClient(); + + NullableClientBuilder durationOperationClientbuilder = new NullableClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + durationOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + durationOperationClient = durationOperationClientbuilder.buildDurationOperationClient(); + + NullableClientBuilder collectionsByteClientbuilder = new NullableClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + collectionsByteClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + collectionsByteClient = collectionsByteClientbuilder.buildCollectionsByteClient(); + + NullableClientBuilder collectionsModelClientbuilder = new NullableClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + collectionsModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + collectionsModelClient = collectionsModelClientbuilder.buildCollectionsModelClient(); + + NullableClientBuilder collectionsStringClientbuilder = new NullableClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + collectionsStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + collectionsStringClient = collectionsStringClientbuilder.buildCollectionsStringClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/optional/generated/OptionalClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/optional/generated/OptionalClientTestBase.java new file mode 100644 index 00000000000..61b2a5e4b7a --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/optional/generated/OptionalClientTestBase.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.optional.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.property.optional.BooleanLiteralClient; +import type.property.optional.BytesClient; +import type.property.optional.CollectionsByteClient; +import type.property.optional.CollectionsModelClient; +import type.property.optional.DatetimeOperationClient; +import type.property.optional.DurationOperationClient; +import type.property.optional.FloatLiteralClient; +import type.property.optional.IntLiteralClient; +import type.property.optional.OptionalClientBuilder; +import type.property.optional.PlainDateClient; +import type.property.optional.PlainTimeClient; +import type.property.optional.RequiredAndOptionalClient; +import type.property.optional.StringLiteralClient; +import type.property.optional.StringOperationClient; +import type.property.optional.UnionFloatLiteralClient; +import type.property.optional.UnionIntLiteralClient; +import type.property.optional.UnionStringLiteralClient; + +class OptionalClientTestBase extends TestProxyTestBase { + protected StringOperationClient stringOperationClient; + + protected BytesClient bytesClient; + + protected DatetimeOperationClient datetimeOperationClient; + + protected DurationOperationClient durationOperationClient; + + protected PlainDateClient plainDateClient; + + protected PlainTimeClient plainTimeClient; + + protected CollectionsByteClient collectionsByteClient; + + protected CollectionsModelClient collectionsModelClient; + + protected StringLiteralClient stringLiteralClient; + + protected IntLiteralClient intLiteralClient; + + protected FloatLiteralClient floatLiteralClient; + + protected BooleanLiteralClient booleanLiteralClient; + + protected UnionStringLiteralClient unionStringLiteralClient; + + protected UnionIntLiteralClient unionIntLiteralClient; + + protected UnionFloatLiteralClient unionFloatLiteralClient; + + protected RequiredAndOptionalClient requiredAndOptionalClient; + + @Override + protected void beforeTest() { + OptionalClientBuilder stringOperationClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + stringOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + stringOperationClient = stringOperationClientbuilder.buildStringOperationClient(); + + OptionalClientBuilder bytesClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + bytesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + bytesClient = bytesClientbuilder.buildBytesClient(); + + OptionalClientBuilder datetimeOperationClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + datetimeOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + datetimeOperationClient = datetimeOperationClientbuilder.buildDatetimeOperationClient(); + + OptionalClientBuilder durationOperationClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + durationOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + durationOperationClient = durationOperationClientbuilder.buildDurationOperationClient(); + + OptionalClientBuilder plainDateClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + plainDateClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + plainDateClient = plainDateClientbuilder.buildPlainDateClient(); + + OptionalClientBuilder plainTimeClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + plainTimeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + plainTimeClient = plainTimeClientbuilder.buildPlainTimeClient(); + + OptionalClientBuilder collectionsByteClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + collectionsByteClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + collectionsByteClient = collectionsByteClientbuilder.buildCollectionsByteClient(); + + OptionalClientBuilder collectionsModelClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + collectionsModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + collectionsModelClient = collectionsModelClientbuilder.buildCollectionsModelClient(); + + OptionalClientBuilder stringLiteralClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + stringLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + stringLiteralClient = stringLiteralClientbuilder.buildStringLiteralClient(); + + OptionalClientBuilder intLiteralClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + intLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + intLiteralClient = intLiteralClientbuilder.buildIntLiteralClient(); + + OptionalClientBuilder floatLiteralClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + floatLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + floatLiteralClient = floatLiteralClientbuilder.buildFloatLiteralClient(); + + OptionalClientBuilder booleanLiteralClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + booleanLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + booleanLiteralClient = booleanLiteralClientbuilder.buildBooleanLiteralClient(); + + OptionalClientBuilder unionStringLiteralClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unionStringLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unionStringLiteralClient = unionStringLiteralClientbuilder.buildUnionStringLiteralClient(); + + OptionalClientBuilder unionIntLiteralClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unionIntLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unionIntLiteralClient = unionIntLiteralClientbuilder.buildUnionIntLiteralClient(); + + OptionalClientBuilder unionFloatLiteralClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unionFloatLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unionFloatLiteralClient = unionFloatLiteralClientbuilder.buildUnionFloatLiteralClient(); + + OptionalClientBuilder requiredAndOptionalClientbuilder = new OptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + requiredAndOptionalClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + requiredAndOptionalClient = requiredAndOptionalClientbuilder.buildRequiredAndOptionalClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/valuetypes/generated/ValueTypesClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/valuetypes/generated/ValueTypesClientTestBase.java new file mode 100644 index 00000000000..3a7e3736cf8 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/property/valuetypes/generated/ValueTypesClientTestBase.java @@ -0,0 +1,370 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.property.valuetypes.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.property.valuetypes.BooleanLiteralClient; +import type.property.valuetypes.BooleanOperationClient; +import type.property.valuetypes.BytesClient; +import type.property.valuetypes.CollectionsIntClient; +import type.property.valuetypes.CollectionsModelClient; +import type.property.valuetypes.CollectionsStringClient; +import type.property.valuetypes.DatetimeOperationClient; +import type.property.valuetypes.Decimal128Client; +import type.property.valuetypes.DecimalClient; +import type.property.valuetypes.DictionaryStringClient; +import type.property.valuetypes.DurationOperationClient; +import type.property.valuetypes.EnumClient; +import type.property.valuetypes.ExtensibleEnumClient; +import type.property.valuetypes.FloatLiteralClient; +import type.property.valuetypes.FloatOperationClient; +import type.property.valuetypes.IntClient; +import type.property.valuetypes.IntLiteralClient; +import type.property.valuetypes.ModelClient; +import type.property.valuetypes.NeverClient; +import type.property.valuetypes.StringLiteralClient; +import type.property.valuetypes.StringOperationClient; +import type.property.valuetypes.UnionEnumValueClient; +import type.property.valuetypes.UnionFloatLiteralClient; +import type.property.valuetypes.UnionIntLiteralClient; +import type.property.valuetypes.UnionStringLiteralClient; +import type.property.valuetypes.UnknownArrayClient; +import type.property.valuetypes.UnknownDictClient; +import type.property.valuetypes.UnknownIntClient; +import type.property.valuetypes.UnknownStringClient; +import type.property.valuetypes.ValueTypesClientBuilder; + +class ValueTypesClientTestBase extends TestProxyTestBase { + protected BooleanOperationClient booleanOperationClient; + + protected StringOperationClient stringOperationClient; + + protected BytesClient bytesClient; + + protected IntClient intClient; + + protected FloatOperationClient floatOperationClient; + + protected DecimalClient decimalClient; + + protected Decimal128Client decimal128Client; + + protected DatetimeOperationClient datetimeOperationClient; + + protected DurationOperationClient durationOperationClient; + + protected EnumClient enumClient; + + protected ExtensibleEnumClient extensibleEnumClient; + + protected ModelClient modelClient; + + protected CollectionsStringClient collectionsStringClient; + + protected CollectionsIntClient collectionsIntClient; + + protected CollectionsModelClient collectionsModelClient; + + protected DictionaryStringClient dictionaryStringClient; + + protected NeverClient neverClient; + + protected UnknownStringClient unknownStringClient; + + protected UnknownIntClient unknownIntClient; + + protected UnknownDictClient unknownDictClient; + + protected UnknownArrayClient unknownArrayClient; + + protected StringLiteralClient stringLiteralClient; + + protected IntLiteralClient intLiteralClient; + + protected FloatLiteralClient floatLiteralClient; + + protected BooleanLiteralClient booleanLiteralClient; + + protected UnionStringLiteralClient unionStringLiteralClient; + + protected UnionIntLiteralClient unionIntLiteralClient; + + protected UnionFloatLiteralClient unionFloatLiteralClient; + + protected UnionEnumValueClient unionEnumValueClient; + + @Override + protected void beforeTest() { + ValueTypesClientBuilder booleanOperationClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + booleanOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + booleanOperationClient = booleanOperationClientbuilder.buildBooleanOperationClient(); + + ValueTypesClientBuilder stringOperationClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + stringOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + stringOperationClient = stringOperationClientbuilder.buildStringOperationClient(); + + ValueTypesClientBuilder bytesClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + bytesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + bytesClient = bytesClientbuilder.buildBytesClient(); + + ValueTypesClientBuilder intClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + intClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + intClient = intClientbuilder.buildIntClient(); + + ValueTypesClientBuilder floatOperationClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + floatOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + floatOperationClient = floatOperationClientbuilder.buildFloatOperationClient(); + + ValueTypesClientBuilder decimalClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + decimalClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + decimalClient = decimalClientbuilder.buildDecimalClient(); + + ValueTypesClientBuilder decimal128Clientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + decimal128Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + decimal128Client = decimal128Clientbuilder.buildDecimal128Client(); + + ValueTypesClientBuilder datetimeOperationClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + datetimeOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + datetimeOperationClient = datetimeOperationClientbuilder.buildDatetimeOperationClient(); + + ValueTypesClientBuilder durationOperationClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + durationOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + durationOperationClient = durationOperationClientbuilder.buildDurationOperationClient(); + + ValueTypesClientBuilder enumClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + enumClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + enumClient = enumClientbuilder.buildEnumClient(); + + ValueTypesClientBuilder extensibleEnumClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + extensibleEnumClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + extensibleEnumClient = extensibleEnumClientbuilder.buildExtensibleEnumClient(); + + ValueTypesClientBuilder modelClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + modelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + modelClient = modelClientbuilder.buildModelClient(); + + ValueTypesClientBuilder collectionsStringClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + collectionsStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + collectionsStringClient = collectionsStringClientbuilder.buildCollectionsStringClient(); + + ValueTypesClientBuilder collectionsIntClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + collectionsIntClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + collectionsIntClient = collectionsIntClientbuilder.buildCollectionsIntClient(); + + ValueTypesClientBuilder collectionsModelClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + collectionsModelClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + collectionsModelClient = collectionsModelClientbuilder.buildCollectionsModelClient(); + + ValueTypesClientBuilder dictionaryStringClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + dictionaryStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + dictionaryStringClient = dictionaryStringClientbuilder.buildDictionaryStringClient(); + + ValueTypesClientBuilder neverClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + neverClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + neverClient = neverClientbuilder.buildNeverClient(); + + ValueTypesClientBuilder unknownStringClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unknownStringClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unknownStringClient = unknownStringClientbuilder.buildUnknownStringClient(); + + ValueTypesClientBuilder unknownIntClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unknownIntClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unknownIntClient = unknownIntClientbuilder.buildUnknownIntClient(); + + ValueTypesClientBuilder unknownDictClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unknownDictClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unknownDictClient = unknownDictClientbuilder.buildUnknownDictClient(); + + ValueTypesClientBuilder unknownArrayClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unknownArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unknownArrayClient = unknownArrayClientbuilder.buildUnknownArrayClient(); + + ValueTypesClientBuilder stringLiteralClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + stringLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + stringLiteralClient = stringLiteralClientbuilder.buildStringLiteralClient(); + + ValueTypesClientBuilder intLiteralClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + intLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + intLiteralClient = intLiteralClientbuilder.buildIntLiteralClient(); + + ValueTypesClientBuilder floatLiteralClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + floatLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + floatLiteralClient = floatLiteralClientbuilder.buildFloatLiteralClient(); + + ValueTypesClientBuilder booleanLiteralClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + booleanLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + booleanLiteralClient = booleanLiteralClientbuilder.buildBooleanLiteralClient(); + + ValueTypesClientBuilder unionStringLiteralClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unionStringLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unionStringLiteralClient = unionStringLiteralClientbuilder.buildUnionStringLiteralClient(); + + ValueTypesClientBuilder unionIntLiteralClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unionIntLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unionIntLiteralClient = unionIntLiteralClientbuilder.buildUnionIntLiteralClient(); + + ValueTypesClientBuilder unionFloatLiteralClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unionFloatLiteralClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unionFloatLiteralClient = unionFloatLiteralClientbuilder.buildUnionFloatLiteralClient(); + + ValueTypesClientBuilder unionEnumValueClientbuilder = new ValueTypesClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unionEnumValueClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unionEnumValueClient = unionEnumValueClientbuilder.buildUnionEnumValueClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/scalar/generated/ScalarClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/scalar/generated/ScalarClientTestBase.java new file mode 100644 index 00000000000..7b5bb4faa51 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/scalar/generated/ScalarClientTestBase.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.scalar.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.scalar.BooleanOperationClient; +import type.scalar.Decimal128TypeClient; +import type.scalar.Decimal128VerifyClient; +import type.scalar.DecimalTypeClient; +import type.scalar.DecimalVerifyClient; +import type.scalar.ScalarClientBuilder; +import type.scalar.StringOperationClient; +import type.scalar.UnknownClient; + +class ScalarClientTestBase extends TestProxyTestBase { + protected StringOperationClient stringOperationClient; + + protected BooleanOperationClient booleanOperationClient; + + protected UnknownClient unknownClient; + + protected DecimalTypeClient decimalTypeClient; + + protected Decimal128TypeClient decimal128TypeClient; + + protected DecimalVerifyClient decimalVerifyClient; + + protected Decimal128VerifyClient decimal128VerifyClient; + + @Override + protected void beforeTest() { + ScalarClientBuilder stringOperationClientbuilder = new ScalarClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + stringOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + stringOperationClient = stringOperationClientbuilder.buildStringOperationClient(); + + ScalarClientBuilder booleanOperationClientbuilder = new ScalarClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + booleanOperationClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + booleanOperationClient = booleanOperationClientbuilder.buildBooleanOperationClient(); + + ScalarClientBuilder unknownClientbuilder = new ScalarClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + unknownClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + unknownClient = unknownClientbuilder.buildUnknownClient(); + + ScalarClientBuilder decimalTypeClientbuilder = new ScalarClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + decimalTypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + decimalTypeClient = decimalTypeClientbuilder.buildDecimalTypeClient(); + + ScalarClientBuilder decimal128TypeClientbuilder = new ScalarClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + decimal128TypeClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + decimal128TypeClient = decimal128TypeClientbuilder.buildDecimal128TypeClient(); + + ScalarClientBuilder decimalVerifyClientbuilder = new ScalarClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + decimalVerifyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + decimalVerifyClient = decimalVerifyClientbuilder.buildDecimalVerifyClient(); + + ScalarClientBuilder decimal128VerifyClientbuilder = new ScalarClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + decimal128VerifyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + decimal128VerifyClient = decimal128VerifyClientbuilder.buildDecimal128VerifyClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/discriminated/generated/DiscriminatedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/discriminated/generated/DiscriminatedClientTestBase.java new file mode 100644 index 00000000000..fa2d23824ef --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/discriminated/generated/DiscriminatedClientTestBase.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.discriminated.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.union.discriminated.DiscriminatedClientBuilder; +import type.union.discriminated.EnvelopeObjectCustomPropertiesClient; +import type.union.discriminated.EnvelopeObjectDefaultClient; +import type.union.discriminated.NoEnvelopeCustomDiscriminatorClient; +import type.union.discriminated.NoEnvelopeDefaultClient; + +class DiscriminatedClientTestBase extends TestProxyTestBase { + protected EnvelopeObjectDefaultClient envelopeObjectDefaultClient; + + protected EnvelopeObjectCustomPropertiesClient envelopeObjectCustomPropertiesClient; + + protected NoEnvelopeDefaultClient noEnvelopeDefaultClient; + + protected NoEnvelopeCustomDiscriminatorClient noEnvelopeCustomDiscriminatorClient; + + @Override + protected void beforeTest() { + DiscriminatedClientBuilder envelopeObjectDefaultClientbuilder = new DiscriminatedClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + envelopeObjectDefaultClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + envelopeObjectDefaultClient = envelopeObjectDefaultClientbuilder.buildEnvelopeObjectDefaultClient(); + + DiscriminatedClientBuilder envelopeObjectCustomPropertiesClientbuilder = new DiscriminatedClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + envelopeObjectCustomPropertiesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + envelopeObjectCustomPropertiesClient + = envelopeObjectCustomPropertiesClientbuilder.buildEnvelopeObjectCustomPropertiesClient(); + + DiscriminatedClientBuilder noEnvelopeDefaultClientbuilder = new DiscriminatedClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + noEnvelopeDefaultClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + noEnvelopeDefaultClient = noEnvelopeDefaultClientbuilder.buildNoEnvelopeDefaultClient(); + + DiscriminatedClientBuilder noEnvelopeCustomDiscriminatorClientbuilder = new DiscriminatedClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + noEnvelopeCustomDiscriminatorClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + noEnvelopeCustomDiscriminatorClient + = noEnvelopeCustomDiscriminatorClientbuilder.buildNoEnvelopeCustomDiscriminatorClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/generated/UnionClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/generated/UnionClientTestBase.java new file mode 100644 index 00000000000..0382e0c3161 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/type/union/generated/UnionClientTestBase.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package type.union.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import type.union.EnumsOnlyClient; +import type.union.FloatsOnlyClient; +import type.union.IntsOnlyClient; +import type.union.MixedLiteralsClient; +import type.union.MixedTypesClient; +import type.union.ModelsOnlyClient; +import type.union.StringAndArrayClient; +import type.union.StringExtensibleClient; +import type.union.StringExtensibleNamedClient; +import type.union.StringsOnlyClient; +import type.union.UnionClientBuilder; + +class UnionClientTestBase extends TestProxyTestBase { + protected StringsOnlyClient stringsOnlyClient; + + protected StringExtensibleClient stringExtensibleClient; + + protected StringExtensibleNamedClient stringExtensibleNamedClient; + + protected IntsOnlyClient intsOnlyClient; + + protected FloatsOnlyClient floatsOnlyClient; + + protected ModelsOnlyClient modelsOnlyClient; + + protected EnumsOnlyClient enumsOnlyClient; + + protected StringAndArrayClient stringAndArrayClient; + + protected MixedLiteralsClient mixedLiteralsClient; + + protected MixedTypesClient mixedTypesClient; + + @Override + protected void beforeTest() { + UnionClientBuilder stringsOnlyClientbuilder = new UnionClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + stringsOnlyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + stringsOnlyClient = stringsOnlyClientbuilder.buildStringsOnlyClient(); + + UnionClientBuilder stringExtensibleClientbuilder = new UnionClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + stringExtensibleClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + stringExtensibleClient = stringExtensibleClientbuilder.buildStringExtensibleClient(); + + UnionClientBuilder stringExtensibleNamedClientbuilder = new UnionClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + stringExtensibleNamedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + stringExtensibleNamedClient = stringExtensibleNamedClientbuilder.buildStringExtensibleNamedClient(); + + UnionClientBuilder intsOnlyClientbuilder = new UnionClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + intsOnlyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + intsOnlyClient = intsOnlyClientbuilder.buildIntsOnlyClient(); + + UnionClientBuilder floatsOnlyClientbuilder = new UnionClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + floatsOnlyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + floatsOnlyClient = floatsOnlyClientbuilder.buildFloatsOnlyClient(); + + UnionClientBuilder modelsOnlyClientbuilder = new UnionClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + modelsOnlyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + modelsOnlyClient = modelsOnlyClientbuilder.buildModelsOnlyClient(); + + UnionClientBuilder enumsOnlyClientbuilder = new UnionClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + enumsOnlyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + enumsOnlyClient = enumsOnlyClientbuilder.buildEnumsOnlyClient(); + + UnionClientBuilder stringAndArrayClientbuilder = new UnionClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + stringAndArrayClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + stringAndArrayClient = stringAndArrayClientbuilder.buildStringAndArrayClient(); + + UnionClientBuilder mixedLiteralsClientbuilder = new UnionClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + mixedLiteralsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + mixedLiteralsClient = mixedLiteralsClientbuilder.buildMixedLiteralsClient(); + + UnionClientBuilder mixedTypesClientbuilder = new UnionClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "http://localhost:3000")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + mixedTypesClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + mixedTypesClient = mixedTypesClientbuilder.buildMixedTypesClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/added/generated/AddedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/added/generated/AddedClientTestBase.java new file mode 100644 index 00000000000..5d798c37d29 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/added/generated/AddedClientTestBase.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.added.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import versioning.added.AddedClient; +import versioning.added.AddedClientBuilder; +import versioning.added.InterfaceV2Client; + +class AddedClientTestBase extends TestProxyTestBase { + protected AddedClient addedClient; + + protected InterfaceV2Client interfaceV2Client; + + @Override + protected void beforeTest() { + AddedClientBuilder addedClientbuilder + = new AddedClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + addedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + addedClient = addedClientbuilder.buildClient(); + + AddedClientBuilder interfaceV2Clientbuilder + = new AddedClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + interfaceV2Clientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + interfaceV2Client = interfaceV2Clientbuilder.buildInterfaceV2Client(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/madeoptional/generated/MadeOptionalClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/madeoptional/generated/MadeOptionalClientTestBase.java new file mode 100644 index 00000000000..5a44848e0d2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/madeoptional/generated/MadeOptionalClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.madeoptional.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import versioning.madeoptional.MadeOptionalClient; +import versioning.madeoptional.MadeOptionalClientBuilder; + +class MadeOptionalClientTestBase extends TestProxyTestBase { + protected MadeOptionalClient madeOptionalClient; + + @Override + protected void beforeTest() { + MadeOptionalClientBuilder madeOptionalClientbuilder = new MadeOptionalClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + madeOptionalClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + madeOptionalClient = madeOptionalClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/removed/generated/RemovedClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/removed/generated/RemovedClientTestBase.java new file mode 100644 index 00000000000..66f2537db89 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/removed/generated/RemovedClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.removed.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import versioning.removed.RemovedClient; +import versioning.removed.RemovedClientBuilder; + +class RemovedClientTestBase extends TestProxyTestBase { + protected RemovedClient removedClient; + + @Override + protected void beforeTest() { + RemovedClientBuilder removedClientbuilder + = new RemovedClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + removedClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + removedClient = removedClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/renamedfrom/generated/RenamedFromClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/renamedfrom/generated/RenamedFromClientTestBase.java new file mode 100644 index 00000000000..ca58c927f5c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/renamedfrom/generated/RenamedFromClientTestBase.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.renamedfrom.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import versioning.renamedfrom.NewInterfaceClient; +import versioning.renamedfrom.RenamedFromClient; +import versioning.renamedfrom.RenamedFromClientBuilder; + +class RenamedFromClientTestBase extends TestProxyTestBase { + protected RenamedFromClient renamedFromClient; + + protected NewInterfaceClient newInterfaceClient; + + @Override + protected void beforeTest() { + RenamedFromClientBuilder renamedFromClientbuilder = new RenamedFromClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + renamedFromClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + renamedFromClient = renamedFromClientbuilder.buildClient(); + + RenamedFromClientBuilder newInterfaceClientbuilder = new RenamedFromClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + newInterfaceClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + newInterfaceClient = newInterfaceClientbuilder.buildNewInterfaceClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/returntypechangedfrom/generated/ReturnTypeChangedFromClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/returntypechangedfrom/generated/ReturnTypeChangedFromClientTestBase.java new file mode 100644 index 00000000000..7f18897698e --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/returntypechangedfrom/generated/ReturnTypeChangedFromClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.returntypechangedfrom.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import versioning.returntypechangedfrom.ReturnTypeChangedFromClient; +import versioning.returntypechangedfrom.ReturnTypeChangedFromClientBuilder; + +class ReturnTypeChangedFromClientTestBase extends TestProxyTestBase { + protected ReturnTypeChangedFromClient returnTypeChangedFromClient; + + @Override + protected void beforeTest() { + ReturnTypeChangedFromClientBuilder returnTypeChangedFromClientbuilder = new ReturnTypeChangedFromClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + returnTypeChangedFromClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + returnTypeChangedFromClient = returnTypeChangedFromClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/typechangedfrom/generated/TypeChangedFromClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/typechangedfrom/generated/TypeChangedFromClientTestBase.java new file mode 100644 index 00000000000..e713ac488ac --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/versioning/typechangedfrom/generated/TypeChangedFromClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package versioning.typechangedfrom.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import versioning.typechangedfrom.TypeChangedFromClient; +import versioning.typechangedfrom.TypeChangedFromClientBuilder; + +class TypeChangedFromClientTestBase extends TestProxyTestBase { + protected TypeChangedFromClient typeChangedFromClient; + + @Override + protected void beforeTest() { + TypeChangedFromClientBuilder typeChangedFromClientbuilder = new TypeChangedFromClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + typeChangedFromClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + typeChangedFromClient = typeChangedFromClientbuilder.buildClient(); + + } +}